From: support Date: Fri, 23 Sep 2022 15:25:25 +0000 (+0000) Subject: Built motion from commit 00bf23f6.|2.6.16 X-Git-Tag: 2.6.16 X-Git-Url: http://repos.xcallymotion.com/base/%22https:/wiki.xcallymotion.com/display/XMV//%22?a=commitdiff_plain;h=ece744b31d5c8c1b26913aafb50e0250a2a6b474;p=motion2.git Built motion from commit 00bf23f6.|2.6.16 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 8d283bb..45ba6b9 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -1,6 +1,6 @@ define({ "name": "xCALLY Motion API", - "version": "2.6.15", + "version": "2.6.16", "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-09-22T14:24:00.521Z", + "time": "2022-09-23T15:18:35.200Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 027cd44..02ba00f 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -1,6 +1,6 @@ { "name": "xCALLY Motion API", - "version": "2.6.15", + "version": "2.6.16", "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-09-22T14:24:00.521Z", + "time": "2022-09-23T15:18:35.200Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index 2f604ac..802b2cc 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -1,6 +1,6 @@ { "name": "motion", - "version": "2.6.15", + "version": "2.6.16", "dependencies": { "@babel/code-frame": { "version": "7.18.6", diff --git a/package.json b/package.json index c4ff6f9..be48aa4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "motion", - "version": "2.6.15", + "version": "2.6.16", "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 f166f26..0626693 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 _0x53c6=['urlForward[body]','sequelize','VIRTUAL','getDataValue','action','STRING','integration','motionbar','jscripty','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]'];(function(_0x3fd531,_0x538738){var _0x5bd9db=function(_0x676411){while(--_0x676411){_0x3fd531['push'](_0x3fd531['shift']());}};_0x5bd9db(++_0x538738);}(_0x53c6,0xd2));var _0x653c=function(_0x2eacb8,_0x1dd161){_0x2eacb8=_0x2eacb8-0x0;var _0x1be15e=_0x53c6[_0x2eacb8];return _0x1be15e;};'use strict';var Sequelize=require(_0x653c('0x0'));module['exports']={'name':{'type':Sequelize[_0x653c('0x1')],'get':function(_0x4a6c7a){return this[_0x653c('0x2')](_0x653c('0x3'));}},'action':{'type':Sequelize[_0x653c('0x4')],'allowNull':![],'validate':{'isIn':{'args':[['contactManager',_0x653c('0x5'),_0x653c('0x6'),_0x653c('0x7'),_0x653c('0x8'),_0x653c('0x9'),_0x653c('0xa'),_0x653c('0xb')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0x653c('0xc')},'data1':{'type':Sequelize[_0x653c('0x4')](0x1000),'comment':_0x653c('0xd')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0x653c('0xe')},'data3':{'type':Sequelize[_0x653c('0x4')](0x1000),'comment':_0x653c('0xf')},'data4':{'type':Sequelize['STRING'](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize['STRING'](0x1000),'comments':_0x653c('0x10')},'data6':{'type':Sequelize['STRING'],'comments':_0x653c('0x11')},'data7':{'type':Sequelize['TEXT'],'comments':_0x653c('0x12')}}; \ No newline at end of file +var _0x68c3=['browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','sequelize','exports','VIRTUAL','action','STRING','integration','jscripty','urlForward'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x68c3,0xdc));var _0x368c=function(_0x54abc8,_0xd098e){_0x54abc8=_0x54abc8-0x0;var _0x4dfe6d=_0x68c3[_0x54abc8];return _0x4dfe6d;};'use strict';var Sequelize=require(_0x368c('0x0'));module[_0x368c('0x1')]={'name':{'type':Sequelize[_0x368c('0x2')],'get':function(_0x408af6){return this['getDataValue'](_0x368c('0x3'));}},'action':{'type':Sequelize[_0x368c('0x4')],'allowNull':![],'validate':{'isIn':{'args':[['contactManager',_0x368c('0x5'),'motionbar',_0x368c('0x6'),_0x368c('0x7'),_0x368c('0x8'),_0x368c('0x9'),_0x368c('0xa')]],'msg':_0x368c('0xb')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0x368c('0x4')](0x1000),'comment':_0x368c('0xc')},'data2':{'type':Sequelize[_0x368c('0x4')](0x1000),'comment':_0x368c('0xd')},'data3':{'type':Sequelize[_0x368c('0x4')](0x1000),'comment':_0x368c('0xe')},'data4':{'type':Sequelize[_0x368c('0x4')](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize[_0x368c('0x4')](0x1000),'comments':_0x368c('0xf')},'data6':{'type':Sequelize[_0x368c('0x4')],'comments':_0x368c('0x10')},'data7':{'type':Sequelize[_0x368c('0x11')],'comments':_0x368c('0x12')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index b1f3520..4eef6bf 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 _0x1ed9=['count','set','Content-Range','json','apply','save','update','then','destroy','end','sendStatus','error','stack','name','send','body','Action','find','params','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','offset','undefined','limit'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1ed9,0x9b));var _0x91ed=function(_0x331efe,_0x1a1bc5){_0x331efe=_0x331efe-0x0;var _0x4bf5a=_0x1ed9[_0x331efe];return _0x4bf5a;};'use strict';var emlformat=require(_0x91ed('0x0'));var rimraf=require(_0x91ed('0x1'));var zipdir=require(_0x91ed('0x2'));var jsonpatch=require(_0x91ed('0x3'));var rp=require(_0x91ed('0x4'));var moment=require(_0x91ed('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x91ed('0x6'));var sox=require(_0x91ed('0x7'));var csv=require(_0x91ed('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x91ed('0x9'));var _=require(_0x91ed('0xa'));var squel=require('squel');var crypto=require(_0x91ed('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x91ed('0xc'));var toCsv=require(_0x91ed('0x8'));var querystring=require(_0x91ed('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x91ed('0xe'));var qs=require(_0x91ed('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x91ed('0x10'));var logger=require(_0x91ed('0x11'))(_0x91ed('0x12'));var utils=require(_0x91ed('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x91ed('0x14'))['db'];function respondWithStatusCode(_0x302e0c,_0x53fd69){_0x53fd69=_0x53fd69||0xcc;return function(_0x1775b0){if(_0x1775b0){return _0x302e0c['sendStatus'](_0x53fd69);}return _0x302e0c[_0x91ed('0x15')](_0x53fd69)['end']();};}function respondWithResult(_0x4ed51b,_0x4325fa){_0x4325fa=_0x4325fa||0xc8;return function(_0x60230b){if(_0x60230b){return _0x4ed51b[_0x91ed('0x15')](_0x4325fa)['json'](_0x60230b);}};}function respondWithFilteredResult(_0x5b0ee3,_0x14c1a0){return function(_0x3e7ff5){if(_0x3e7ff5){var _0x58b6e7=typeof _0x14c1a0[_0x91ed('0x16')]===_0x91ed('0x17')&&typeof _0x14c1a0[_0x91ed('0x18')]===_0x91ed('0x17');var _0x22bc46=_0x3e7ff5[_0x91ed('0x19')];var _0x47b453=_0x58b6e7?0x0:_0x14c1a0['offset'];var _0xc2f48a=_0x58b6e7?_0x3e7ff5[_0x91ed('0x19')]:_0x14c1a0[_0x91ed('0x16')]+_0x14c1a0['limit'];var _0x367ba4;if(_0xc2f48a>=_0x22bc46){_0xc2f48a=_0x22bc46;_0x367ba4=0xc8;}else{_0x367ba4=0xce;}_0x5b0ee3[_0x91ed('0x15')](_0x367ba4);return _0x5b0ee3[_0x91ed('0x1a')](_0x91ed('0x1b'),_0x47b453+'-'+_0xc2f48a+'/'+_0x22bc46)[_0x91ed('0x1c')](_0x3e7ff5);}return null;};}function patchUpdates(_0x53015f){return function(_0x4fa246){try{jsonpatch[_0x91ed('0x1d')](_0x4fa246,_0x53015f,!![]);}catch(_0x2acbd8){return BPromise['reject'](_0x2acbd8);}return _0x4fa246[_0x91ed('0x1e')]();};}function saveUpdates(_0x1e4643,_0x261f64){return function(_0x9b4d10){if(_0x9b4d10){return _0x9b4d10[_0x91ed('0x1f')](_0x1e4643)[_0x91ed('0x20')](function(_0x4b1b7e){return _0x4b1b7e;});}return null;};}function removeEntity(_0x5c45c8,_0x3a6cc6){return function(_0x2f6492){if(_0x2f6492){return _0x2f6492[_0x91ed('0x21')]()[_0x91ed('0x20')](function(){_0x5c45c8['status'](0xcc)[_0x91ed('0x22')]();});}};}function handleEntityNotFound(_0x4b8b97,_0x4864b4){return function(_0x2fff8d){if(!_0x2fff8d){_0x4b8b97[_0x91ed('0x23')](0x194);}return _0x2fff8d;};}function handleError(_0x8844e1,_0x1c2847){_0x1c2847=_0x1c2847||0x1f4;return function(_0x3786ce){logger[_0x91ed('0x24')](_0x3786ce[_0x91ed('0x25')]);if(_0x3786ce[_0x91ed('0x26')]){delete _0x3786ce['name'];}_0x8844e1[_0x91ed('0x15')](_0x1c2847)[_0x91ed('0x27')](_0x3786ce);};}exports['update']=function(_0x4d02d6,_0x4f963d){if(_0x4d02d6[_0x91ed('0x28')]['id']){delete _0x4d02d6['body']['id'];}return db[_0x91ed('0x29')][_0x91ed('0x2a')]({'where':{'id':_0x4d02d6[_0x91ed('0x2b')]['id']}})[_0x91ed('0x20')](handleEntityNotFound(_0x4f963d,null))[_0x91ed('0x20')](saveUpdates(_0x4d02d6[_0x91ed('0x28')],null))[_0x91ed('0x20')](respondWithResult(_0x4f963d,null))[_0x91ed('0x2c')](handleError(_0x4f963d,null));};exports[_0x91ed('0x21')]=function(_0x2cfe88,_0x90df38){return db['Action'][_0x91ed('0x2a')]({'where':{'id':_0x2cfe88[_0x91ed('0x2b')]['id']}})[_0x91ed('0x20')](handleEntityNotFound(_0x90df38,null))[_0x91ed('0x20')](removeEntity(_0x90df38,null))[_0x91ed('0x2c')](handleError(_0x90df38,null));}; \ No newline at end of file +var _0xd1f8=['util','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','../../mysqldb','end','status','json','undefined','limit','offset','count','set','apply','reject','save','update','destroy','error','stack','name','send','body','Action','find','params','then','catch','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x33c3d3,_0x51eed3){var _0xf3a17f=function(_0x22c578){while(--_0x22c578){_0x33c3d3['push'](_0x33c3d3['shift']());}};_0xf3a17f(++_0x51eed3);}(_0xd1f8,0x1e3));var _0x8d1f=function(_0x2c69a1,_0x201903){_0x2c69a1=_0x2c69a1-0x0;var _0x24bb91=_0xd1f8[_0x2c69a1];return _0x24bb91;};'use strict';var emlformat=require(_0x8d1f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8d1f('0x1'));var jsonpatch=require(_0x8d1f('0x2'));var rp=require(_0x8d1f('0x3'));var moment=require(_0x8d1f('0x4'));var BPromise=require(_0x8d1f('0x5'));var Mustache=require(_0x8d1f('0x6'));var util=require(_0x8d1f('0x7'));var path=require('path');var sox=require(_0x8d1f('0x8'));var csv=require(_0x8d1f('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8d1f('0xa'));var _=require('lodash');var squel=require(_0x8d1f('0xb'));var crypto=require(_0x8d1f('0xc'));var jsforce=require(_0x8d1f('0xd'));var deskjs=require(_0x8d1f('0xe'));var toCsv=require(_0x8d1f('0x9'));var querystring=require('querystring');var Papa=require(_0x8d1f('0xf'));var Redis=require(_0x8d1f('0x10'));var authService=require(_0x8d1f('0x11'));var qs=require(_0x8d1f('0x12'));var as=require(_0x8d1f('0x13'));var hardwareService=require(_0x8d1f('0x14'));var logger=require(_0x8d1f('0x15'))(_0x8d1f('0x16'));var utils=require(_0x8d1f('0x17'));var config=require(_0x8d1f('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x8d1f('0x19'))['db'];function respondWithStatusCode(_0x3e308f,_0x1716fd){_0x1716fd=_0x1716fd||0xcc;return function(_0x5bd4a4){if(_0x5bd4a4){return _0x3e308f['sendStatus'](_0x1716fd);}return _0x3e308f['status'](_0x1716fd)[_0x8d1f('0x1a')]();};}function respondWithResult(_0x1667ea,_0x349b23){_0x349b23=_0x349b23||0xc8;return function(_0x295c70){if(_0x295c70){return _0x1667ea[_0x8d1f('0x1b')](_0x349b23)[_0x8d1f('0x1c')](_0x295c70);}};}function respondWithFilteredResult(_0x4e686b,_0x566d6d){return function(_0x12f64e){if(_0x12f64e){var _0x3669c8=typeof _0x566d6d['offset']===_0x8d1f('0x1d')&&typeof _0x566d6d[_0x8d1f('0x1e')]==='undefined';var _0x4a69e9=_0x12f64e['count'];var _0x297108=_0x3669c8?0x0:_0x566d6d[_0x8d1f('0x1f')];var _0x52c702=_0x3669c8?_0x12f64e[_0x8d1f('0x20')]:_0x566d6d[_0x8d1f('0x1f')]+_0x566d6d[_0x8d1f('0x1e')];var _0x7c15eb;if(_0x52c702>=_0x4a69e9){_0x52c702=_0x4a69e9;_0x7c15eb=0xc8;}else{_0x7c15eb=0xce;}_0x4e686b[_0x8d1f('0x1b')](_0x7c15eb);return _0x4e686b[_0x8d1f('0x21')]('Content-Range',_0x297108+'-'+_0x52c702+'/'+_0x4a69e9)[_0x8d1f('0x1c')](_0x12f64e);}return null;};}function patchUpdates(_0x178620){return function(_0xe78505){try{jsonpatch[_0x8d1f('0x22')](_0xe78505,_0x178620,!![]);}catch(_0x3f8388){return BPromise[_0x8d1f('0x23')](_0x3f8388);}return _0xe78505[_0x8d1f('0x24')]();};}function saveUpdates(_0x368ed7,_0xa84085){return function(_0x1921a0){if(_0x1921a0){return _0x1921a0[_0x8d1f('0x25')](_0x368ed7)['then'](function(_0xd66af1){return _0xd66af1;});}return null;};}function removeEntity(_0x5a13d2,_0x40baac){return function(_0x451239){if(_0x451239){return _0x451239[_0x8d1f('0x26')]()['then'](function(){_0x5a13d2[_0x8d1f('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x26c68f,_0x590401){return function(_0x139a6d){if(!_0x139a6d){_0x26c68f['sendStatus'](0x194);}return _0x139a6d;};}function handleError(_0x2317e9,_0x409fff){_0x409fff=_0x409fff||0x1f4;return function(_0x26c9c8){logger[_0x8d1f('0x27')](_0x26c9c8[_0x8d1f('0x28')]);if(_0x26c9c8[_0x8d1f('0x29')]){delete _0x26c9c8[_0x8d1f('0x29')];}_0x2317e9[_0x8d1f('0x1b')](_0x409fff)[_0x8d1f('0x2a')](_0x26c9c8);};}exports[_0x8d1f('0x25')]=function(_0x1de479,_0x189194){if(_0x1de479[_0x8d1f('0x2b')]['id']){delete _0x1de479['body']['id'];}return db[_0x8d1f('0x2c')][_0x8d1f('0x2d')]({'where':{'id':_0x1de479[_0x8d1f('0x2e')]['id']}})[_0x8d1f('0x2f')](handleEntityNotFound(_0x189194,null))[_0x8d1f('0x2f')](saveUpdates(_0x1de479['body'],null))[_0x8d1f('0x2f')](respondWithResult(_0x189194,null))[_0x8d1f('0x30')](handleError(_0x189194,null));};exports[_0x8d1f('0x26')]=function(_0x1fec38,_0x3b2fb1){return db[_0x8d1f('0x2c')][_0x8d1f('0x2d')]({'where':{'id':_0x1fec38[_0x8d1f('0x2e')]['id']}})[_0x8d1f('0x2f')](handleEntityNotFound(_0x3b2fb1,null))[_0x8d1f('0x2f')](removeEntity(_0x3b2fb1,null))[_0x8d1f('0x30')](handleError(_0x3b2fb1,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index d01a976..6338aa4 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 _0x0077=['bluebird','request-promise','path','rimraf','./action.attributes','exports','define','Action','../../config/logger','api','moment'];(function(_0xd69b59,_0x4e79a4){var _0x2abb36=function(_0x57bb28){while(--_0x57bb28){_0xd69b59['push'](_0xd69b59['shift']());}};_0x2abb36(++_0x4e79a4);}(_0x0077,0x15d));var _0x7007=function(_0x5cc6d0,_0x77fdb4){_0x5cc6d0=_0x5cc6d0-0x0;var _0x19cbb2=_0x0077[_0x5cc6d0];return _0x19cbb2;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7007('0x0'))(_0x7007('0x1'));var moment=require(_0x7007('0x2'));var BPromise=require(_0x7007('0x3'));var rp=require(_0x7007('0x4'));var fs=require('fs');var path=require(_0x7007('0x5'));var rimraf=require(_0x7007('0x6'));var config=require('../../config/environment');var attributes=require(_0x7007('0x7'));module[_0x7007('0x8')]=function(_0x550b91,_0xa95e5b){return _0x550b91[_0x7007('0x9')](_0x7007('0xa'),attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8b30=['./action.attributes','define','util','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x55f9d1,_0x1ac477){var _0x3e2544=function(_0x120253){while(--_0x120253){_0x55f9d1['push'](_0x55f9d1['shift']());}};_0x3e2544(++_0x1ac477);}(_0x8b30,0x1f2));var _0x08b3=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x8b30[_0x36eaaa];return _0x461349;};'use strict';var _=require('lodash');var util=require(_0x08b3('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x08b3('0x1'));var BPromise=require(_0x08b3('0x2'));var rp=require(_0x08b3('0x3'));var fs=require('fs');var path=require(_0x08b3('0x4'));var rimraf=require('rimraf');var config=require(_0x08b3('0x5'));var attributes=require(_0x08b3('0x6'));module['exports']=function(_0x43d606,_0x33e71c){return _0x43d606[_0x08b3('0x7')]('Action',attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index ae95d6b..d5fbf0c 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 _0x5fc3=['../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','stringify','error','code','message','Action,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x1a548e,_0x26d74a){var _0x1749a4=function(_0x3e555d){while(--_0x3e555d){_0x1a548e['push'](_0x1a548e['shift']());}};_0x1749a4(++_0x26d74a);}(_0x5fc3,0xa8));var _0x35fc=function(_0x10004e,_0xd701e6){_0x10004e=_0x10004e-0x0;var _0x5af990=_0x5fc3[_0x10004e];return _0x5af990;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var moment=require('moment');var BPromise=require(_0x35fc('0x2'));var rs=require(_0x35fc('0x3'));var fs=require('fs');var Redis=require(_0x35fc('0x4'));var db=require(_0x35fc('0x5'))['db'];var utils=require(_0x35fc('0x6'));var logger=require('../../config/logger')(_0x35fc('0x7'));var config=require(_0x35fc('0x8'));var jayson=require(_0x35fc('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x19a0d1,_0x508b32,_0x16e153){return new BPromise(function(_0x27524f,_0xc72d93){return client[_0x35fc('0xa')](_0x19a0d1,_0x16e153)[_0x35fc('0xb')](function(_0xf9d3a6){logger[_0x35fc('0xc')]('Action,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'));logger[_0x35fc('0xe')]('Action,\x20%s,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'),JSON[_0x35fc('0xf')](_0xf9d3a6));if(_0xf9d3a6['error']){if(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x11')]===0x1f4){logger['error']('Action,\x20%s,\x20%s',_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0xc72d93(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x12')]);}logger[_0x35fc('0x10')](_0x35fc('0x13'),_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0x27524f(_0xf9d3a6['error']['message']);}else{logger['info'](_0x35fc('0x13'),_0x508b32,_0x35fc('0xd'));_0x27524f(_0xf9d3a6[_0x35fc('0x14')][_0x35fc('0x12')]);}})[_0x35fc('0x15')](function(_0x1121fa){logger['error'](_0x35fc('0x13'),_0x508b32,_0x1121fa);_0xc72d93(_0x1121fa);});});} \ No newline at end of file +var _0x326f=['info','Action,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x4c2eb3,_0x50c5e2){var _0x56c23a=function(_0x252461){while(--_0x252461){_0x4c2eb3['push'](_0x4c2eb3['shift']());}};_0x56c23a(++_0x50c5e2);}(_0x326f,0xd1));var _0xf326=function(_0x1b28cd,_0x4d7bc5){_0x1b28cd=_0x1b28cd-0x0;var _0x497956=_0x326f[_0x1b28cd];return _0x497956;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf326('0x1'));var rs=require(_0xf326('0x2'));var fs=require('fs');var Redis=require(_0xf326('0x3'));var db=require(_0xf326('0x4'))['db'];var utils=require(_0xf326('0x5'));var logger=require(_0xf326('0x6'))(_0xf326('0x7'));var config=require(_0xf326('0x8'));var jayson=require(_0xf326('0x9'));var client=jayson[_0xf326('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c254d,_0x3851eb,_0x165f95){return new BPromise(function(_0x1e7b8a,_0x515bfa){return client['request'](_0x3c254d,_0x165f95)['then'](function(_0x3bacf2){logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));logger[_0xf326('0xe')]('Action,\x20%s,\x20%s,\x20%s',_0x3851eb,_0xf326('0xd'),JSON['stringify'](_0x3bacf2));if(_0x3bacf2[_0xf326('0xf')]){if(_0x3bacf2['error'][_0xf326('0x10')]===0x1f4){logger['error'](_0xf326('0xc'),_0x3851eb,_0x3bacf2[_0xf326('0xf')]['message']);return _0x515bfa(_0x3bacf2[_0xf326('0xf')][_0xf326('0x11')]);}logger[_0xf326('0xf')](_0xf326('0xc'),_0x3851eb,_0x3bacf2['error'][_0xf326('0x11')]);return _0x1e7b8a(_0x3bacf2['error']['message']);}else{logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));_0x1e7b8a(_0x3bacf2[_0xf326('0x12')][_0xf326('0x11')]);}})[_0xf326('0x13')](function(_0x34128e){logger[_0xf326('0xf')]('Action,\x20%s,\x20%s',_0x3851eb,_0x34128e);_0x515bfa(_0x34128e);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 34b48d5..987c280 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 _0x3182=['/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','put','isAuthenticated','update','delete'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x3182,0x73));var _0x2318=function(_0x536ed0,_0x2f5e9a){_0x536ed0=_0x536ed0-0x0;var _0x24601c=_0x3182[_0x536ed0];return _0x24601c;};'use strict';var multer=require(_0x2318('0x0'));var util=require(_0x2318('0x1'));var path=require(_0x2318('0x2'));var timeout=require(_0x2318('0x3'));var express=require(_0x2318('0x4'));var router=express[_0x2318('0x5')]();var fs_extra=require(_0x2318('0x6'));var auth=require(_0x2318('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x2318('0x8'));var controller=require('./action.controller');router[_0x2318('0x9')]('/:id',auth[_0x2318('0xa')](),controller[_0x2318('0xb')]);router[_0x2318('0xc')](_0x2318('0xd'),auth['isAuthenticated'](),controller[_0x2318('0xe')]);module[_0x2318('0xf')]=router; \ No newline at end of file +var _0x10a4=['fs-extra','../../components/auth/service','../../components/interaction/service','./action.controller','put','/:id','isAuthenticated','update','delete','destroy','multer','connect-timeout'];(function(_0x40d731,_0x31a0c2){var _0x4a6b68=function(_0x103c69){while(--_0x103c69){_0x40d731['push'](_0x40d731['shift']());}};_0x4a6b68(++_0x31a0c2);}(_0x10a4,0x12a));var _0x410a=function(_0x5cdf5d,_0x616e66){_0x5cdf5d=_0x5cdf5d-0x0;var _0x2b947a=_0x10a4[_0x5cdf5d];return _0x2b947a;};'use strict';var multer=require(_0x410a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x410a('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x410a('0x2'));var auth=require(_0x410a('0x3'));var interaction=require(_0x410a('0x4'));var config=require('../../config/environment');var controller=require(_0x410a('0x5'));router[_0x410a('0x6')](_0x410a('0x7'),auth[_0x410a('0x8')](),controller[_0x410a('0x9')]);router[_0x410a('0xa')](_0x410a('0x7'),auth[_0x410a('0x8')](),controller[_0x410a('0xb')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index ece66fd..9b7a513 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 _0x8ef6=['STRING','TEXT','sequelize','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8ef6,0xf2));var _0x68ef=function(_0x28b76f,_0x200bbe){_0x28b76f=_0x28b76f-0x0;var _0x549317=_0x8ef6[_0x28b76f];return _0x549317;};'use strict';var Sequelize=require(_0x68ef('0x0'));module[_0x68ef('0x1')]={'name':{'type':Sequelize[_0x68ef('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x68ef('0x2')]},'parent':{'type':Sequelize[_0x68ef('0x2')]},'table':{'type':Sequelize[_0x68ef('0x2')]},'conditions':{'type':Sequelize[_0x68ef('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xb4c7=['STRING','TEXT','sequelize','exports'];(function(_0x57d370,_0x3ed0f6){var _0x550fd2=function(_0x59634f){while(--_0x59634f){_0x57d370['push'](_0x57d370['shift']());}};_0x550fd2(++_0x3ed0f6);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0xad8c9a,_0x3dd9cd){_0xad8c9a=_0xad8c9a-0x0;var _0x2196f8=_0xb4c7[_0xad8c9a];return _0x2196f8;};'use strict';var Sequelize=require(_0x7b4c('0x0'));module[_0x7b4c('0x1')]={'name':{'type':Sequelize[_0x7b4c('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x7b4c('0x2')]},'parent':{'type':Sequelize[_0x7b4c('0x2')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x7b4c('0x3')]},'joins':{'type':Sequelize[_0x7b4c('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index b0c8cd7..6113ee1 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 _0x74fb=['undefined','limit','count','set','apply','reject','save','update','then','destroy','CustomReports','UserProfileResource','error','stack','name','index','map','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','AnalyticCustomReport','rows','show','params','filters','includeAll','include','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','left_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','findAll','keyBy','select','from','MetricId','metric','function','format','replace','groupBy','orderBy','DESC','parse','joins','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','table','parentKey','conditions','clone','debug','Limited\x20Query:','toString','QueryTypes','SELECT','right_join','HOUR(%s)','IS\x20NULL','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','alias','fullPath','%s-%s.%s','randomstring','generate','output','csv','custom','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','join','../../files/reports','savename','COUNT(*)','sequelize','run','runReport','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','operator','rimraf','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','dbH','sendStatus','status','json','offset'];(function(_0x32f7e5,_0x2e8c0b){var _0x52a805=function(_0xe75a48){while(--_0xe75a48){_0x32f7e5['push'](_0x32f7e5['shift']());}};_0x52a805(++_0x2e8c0b);}(_0x74fb,0x1d3));var _0xb74f=function(_0x218463,_0x461814){_0x218463=_0x218463-0x0;var _0x46c714=_0x74fb[_0x218463];return _0x46c714;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb74f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb74f('0x1'));var moment=require(_0xb74f('0x2'));var BPromise=require(_0xb74f('0x3'));var Mustache=require(_0xb74f('0x4'));var util=require(_0xb74f('0x5'));var path=require(_0xb74f('0x6'));var sox=require('sox');var csv=require(_0xb74f('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb74f('0x8'));var _=require(_0xb74f('0x9'));var squel=require(_0xb74f('0xa'));var crypto=require(_0xb74f('0xb'));var jsforce=require(_0xb74f('0xc'));var deskjs=require(_0xb74f('0xd'));var toCsv=require(_0xb74f('0x7'));var querystring=require('querystring');var Papa=require(_0xb74f('0xe'));var Redis=require(_0xb74f('0xf'));var authService=require(_0xb74f('0x10'));var qs=require(_0xb74f('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb74f('0x12'));var logger=require(_0xb74f('0x13'))(_0xb74f('0x14'));var utils=require(_0xb74f('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb74f('0x16'))['db'];var dbH=require(_0xb74f('0x16'))[_0xb74f('0x17')];function respondWithStatusCode(_0x5af83f,_0x205809){_0x205809=_0x205809||0xcc;return function(_0xa5faa9){if(_0xa5faa9){return _0x5af83f[_0xb74f('0x18')](_0x205809);}return _0x5af83f['status'](_0x205809)['end']();};}function respondWithResult(_0x447db9,_0x38ae8f){_0x38ae8f=_0x38ae8f||0xc8;return function(_0x183ee6){if(_0x183ee6){return _0x447db9[_0xb74f('0x19')](_0x38ae8f)[_0xb74f('0x1a')](_0x183ee6);}};}function respondWithFilteredResult(_0x4130b3,_0xfe0363){return function(_0x2c0bf2){if(_0x2c0bf2){var _0x36261f=typeof _0xfe0363[_0xb74f('0x1b')]===_0xb74f('0x1c')&&typeof _0xfe0363[_0xb74f('0x1d')]===_0xb74f('0x1c');var _0x3503f2=_0x2c0bf2[_0xb74f('0x1e')];var _0x21b888=_0x36261f?0x0:_0xfe0363[_0xb74f('0x1b')];var _0x441bd9=_0x36261f?_0x2c0bf2[_0xb74f('0x1e')]:_0xfe0363[_0xb74f('0x1b')]+_0xfe0363[_0xb74f('0x1d')];var _0x3d703d;if(_0x441bd9>=_0x3503f2){_0x441bd9=_0x3503f2;_0x3d703d=0xc8;}else{_0x3d703d=0xce;}_0x4130b3[_0xb74f('0x19')](_0x3d703d);return _0x4130b3[_0xb74f('0x1f')]('Content-Range',_0x21b888+'-'+_0x441bd9+'/'+_0x3503f2)[_0xb74f('0x1a')](_0x2c0bf2);}return null;};}function patchUpdates(_0xa067ae){return function(_0x23e1db){try{jsonpatch[_0xb74f('0x20')](_0x23e1db,_0xa067ae,!![]);}catch(_0x5548ad){return BPromise[_0xb74f('0x21')](_0x5548ad);}return _0x23e1db[_0xb74f('0x22')]();};}function saveUpdates(_0x497786,_0x59b0bf){return function(_0x1a9758){if(_0x1a9758){return _0x1a9758[_0xb74f('0x23')](_0x497786)[_0xb74f('0x24')](function(_0x509863){return _0x509863;});}return null;};}function removeEntity(_0x45bb21,_0x21123d){return function(_0x5dc9aa){if(_0x5dc9aa){return _0x5dc9aa[_0xb74f('0x25')]()[_0xb74f('0x24')](function(){var _0x210892=_0x5dc9aa['get']({'plain':!![]});var _0x40eadc=_0xb74f('0x26');return db[_0xb74f('0x27')][_0xb74f('0x25')]({'where':{'type':_0x40eadc,'resourceId':_0x210892['id']}})[_0xb74f('0x24')](function(){return _0x5dc9aa;});})[_0xb74f('0x24')](function(){_0x45bb21['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x17bab1,_0x1effac){return function(_0xfbfbfc){if(!_0xfbfbfc){_0x17bab1[_0xb74f('0x18')](0x194);}return _0xfbfbfc;};}function handleError(_0x4a026e,_0x188a19){_0x188a19=_0x188a19||0x1f4;return function(_0x3bfe2f){logger[_0xb74f('0x28')](_0x3bfe2f[_0xb74f('0x29')]);if(_0x3bfe2f[_0xb74f('0x2a')]){delete _0x3bfe2f['name'];}_0x4a026e[_0xb74f('0x19')](_0x188a19)['send'](_0x3bfe2f);};}exports[_0xb74f('0x2b')]=function(_0x3b61b4,_0x10e19b){var _0x46c979={},_0x354dc7={},_0x515de6={'count':0x0,'rows':[]};var _0x1484d6=_[_0xb74f('0x2c')](db['AnalyticCustomReport'][_0xb74f('0x2d')],function(_0x22a1d0){return{'name':_0x22a1d0['fieldName'],'type':_0x22a1d0[_0xb74f('0x2e')][_0xb74f('0x2f')]};});_0x354dc7[_0xb74f('0x30')]=_[_0xb74f('0x2c')](_0x1484d6,_0xb74f('0x2a'));_0x354dc7[_0xb74f('0x31')]=_[_0xb74f('0x32')](_0x3b61b4[_0xb74f('0x31')]);_0x354dc7['filters']=_[_0xb74f('0x33')](_0x354dc7[_0xb74f('0x30')],_0x354dc7[_0xb74f('0x31')]);_0x46c979[_0xb74f('0x34')]=_[_0xb74f('0x33')](_0x354dc7['model'],qs[_0xb74f('0x35')](_0x3b61b4[_0xb74f('0x31')][_0xb74f('0x35')]));_0x46c979[_0xb74f('0x34')]=_0x46c979[_0xb74f('0x34')][_0xb74f('0x36')]?_0x46c979[_0xb74f('0x34')]:_0x354dc7['model'];if(!_0x3b61b4[_0xb74f('0x31')][_0xb74f('0x37')]('nolimit')){_0x46c979[_0xb74f('0x1d')]=qs[_0xb74f('0x1d')](_0x3b61b4['query'][_0xb74f('0x1d')]);_0x46c979[_0xb74f('0x1b')]=qs[_0xb74f('0x1b')](_0x3b61b4[_0xb74f('0x31')][_0xb74f('0x1b')]);}_0x46c979[_0xb74f('0x38')]=qs[_0xb74f('0x39')](_0x3b61b4['query'][_0xb74f('0x39')]);_0x46c979[_0xb74f('0x3a')]=qs['filters'](_['pick'](_0x3b61b4[_0xb74f('0x31')],_0x354dc7['filters']),_0x1484d6);if(_0x3b61b4['query'][_0xb74f('0x3b')]){_0x46c979[_0xb74f('0x3a')]=_[_0xb74f('0x3c')](_0x46c979[_0xb74f('0x3a')],{'$or':_[_0xb74f('0x2c')](_0x1484d6,function(_0x1fafc7){if(_0x1fafc7['type']!==_0xb74f('0x3d')){var _0x5365e2={};_0x5365e2[_0x1fafc7['name']]={'$like':'%'+_0x3b61b4['query'][_0xb74f('0x3b')]+'%'};return _0x5365e2;}})});}_0x46c979=_['merge']({},_0x46c979,_0x3b61b4[_0xb74f('0x3e')]);var _0x3cce08={'where':_0x46c979[_0xb74f('0x3a')]};return db[_0xb74f('0x3f')][_0xb74f('0x1e')](_0x3cce08)['then'](function(_0x119af9){_0x515de6['count']=_0x119af9;if(_0x3b61b4[_0xb74f('0x31')]['includeAll']){_0x46c979['include']=[{'all':!![]}];}return db[_0xb74f('0x3f')]['findAll'](_0x46c979);})['then'](function(_0x30e7e2){_0x515de6[_0xb74f('0x40')]=_0x30e7e2;return _0x515de6;})['then'](respondWithFilteredResult(_0x10e19b,_0x46c979))['catch'](handleError(_0x10e19b,null));};exports[_0xb74f('0x41')]=function(_0x5ea0f2,_0x5545fe){var _0x31fb66={'raw':![],'where':{'id':_0x5ea0f2[_0xb74f('0x42')]['id']}},_0x34d999={};_0x34d999['model']=_['keys'](db['AnalyticCustomReport'][_0xb74f('0x2d')]);_0x34d999['query']=_[_0xb74f('0x32')](_0x5ea0f2[_0xb74f('0x31')]);_0x34d999[_0xb74f('0x43')]=_[_0xb74f('0x33')](_0x34d999[_0xb74f('0x30')],_0x34d999['query']);_0x31fb66[_0xb74f('0x34')]=_[_0xb74f('0x33')](_0x34d999[_0xb74f('0x30')],qs[_0xb74f('0x35')](_0x5ea0f2[_0xb74f('0x31')][_0xb74f('0x35')]));_0x31fb66[_0xb74f('0x34')]=_0x31fb66[_0xb74f('0x34')][_0xb74f('0x36')]?_0x31fb66[_0xb74f('0x34')]:_0x34d999[_0xb74f('0x30')];if(_0x5ea0f2[_0xb74f('0x31')][_0xb74f('0x44')]){_0x31fb66[_0xb74f('0x45')]=[{'all':!![]}];}_0x31fb66=_['merge']({},_0x31fb66,_0x5ea0f2['options']);return db[_0xb74f('0x3f')][_0xb74f('0x46')](_0x31fb66)['then'](handleEntityNotFound(_0x5545fe,null))[_0xb74f('0x24')](respondWithResult(_0x5545fe,null))['catch'](handleError(_0x5545fe,null));};exports[_0xb74f('0x47')]=function(_0x5ecf3c,_0x225f58){return db[_0xb74f('0x3f')][_0xb74f('0x47')](_0x5ecf3c['body'],{})['then'](function(_0x7b117f){var _0x2ac3f8=_0x5ecf3c[_0xb74f('0x48')][_0xb74f('0x49')]({'plain':!![]});if(!_0x2ac3f8)throw new Error(_0xb74f('0x4a'));if(_0x2ac3f8[_0xb74f('0x4b')]===_0xb74f('0x48')){var _0x54e42a=_0x7b117f[_0xb74f('0x49')]({'plain':!![]});var _0x22047c=_0xb74f('0x4c');return db[_0xb74f('0x4d')][_0xb74f('0x46')]({'where':{'name':_0x22047c,'userProfileId':_0x2ac3f8['userProfileId']},'raw':!![]})['then'](function(_0x34e9b9){if(_0x34e9b9&&_0x34e9b9[_0xb74f('0x4e')]===0x0){return db['UserProfileResource'][_0xb74f('0x47')]({'name':_0x54e42a[_0xb74f('0x2a')],'resourceId':_0x54e42a['id'],'type':_0xb74f('0x26'),'sectionId':_0x34e9b9['id']},{})[_0xb74f('0x24')](function(){return _0x7b117f;});}else{return _0x7b117f;}})[_0xb74f('0x4f')](function(_0x8a31bd){logger[_0xb74f('0x28')](_0xb74f('0x50'),_0x8a31bd);throw _0x8a31bd;});}return _0x7b117f;})[_0xb74f('0x24')](respondWithResult(_0x225f58,0xc9))[_0xb74f('0x4f')](handleError(_0x225f58,null));};exports[_0xb74f('0x23')]=function(_0x4c0516,_0x3b566f){if(_0x4c0516[_0xb74f('0x51')]['id']){delete _0x4c0516[_0xb74f('0x51')]['id'];}return db[_0xb74f('0x3f')][_0xb74f('0x46')]({'where':{'id':_0x4c0516[_0xb74f('0x42')]['id']}})['then'](handleEntityNotFound(_0x3b566f,null))[_0xb74f('0x24')](saveUpdates(_0x4c0516[_0xb74f('0x51')],null))['then'](respondWithResult(_0x3b566f,null))[_0xb74f('0x4f')](handleError(_0x3b566f,null));};exports[_0xb74f('0x25')]=function(_0x53132a,_0x17d127){return db[_0xb74f('0x3f')]['find']({'where':{'id':_0x53132a[_0xb74f('0x42')]['id']}})[_0xb74f('0x24')](handleEntityNotFound(_0x17d127,null))[_0xb74f('0x24')](removeEntity(_0x17d127,null))['catch'](handleError(_0x17d127,null));};exports['preview']=function(_0x4c0ca9,_0x9da040){var _0x5ba4ed=0xa;var _0x281ca5=['join',_0xb74f('0x52'),'right_join',_0xb74f('0x53')];var _0xb1fe6={'SUM':_0xb74f('0x54'),'COUNT':_0xb74f('0x55'),'COUNT DISTINCT':_0xb74f('0x56'),'MAX':_0xb74f('0x57'),'MIN':_0xb74f('0x58'),'AVG':_0xb74f('0x59'),'GROUP_CONCAT':_0xb74f('0x5a'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xb74f('0x5b')};var _0x5d4078={'SEC_TO_TIME':_0xb74f('0x5c'),'DATE':_0xb74f('0x5d'),'HOUR':'HOUR(%s)','ROUND':_0xb74f('0x5e'),'UNIX_TIMESTAMP':_0xb74f('0x5f')};var _0x273585=function(_0x8a3dd6){return!_[_0xb74f('0x60')](['IS\x20NULL',_0xb74f('0x61'),_0xb74f('0x62'),_0xb74f('0x63')],_0x8a3dd6);};var _0x1926a7=function(_0x471d62){if(!_0x471d62||!_0x471d62[_0xb74f('0x64')][_0xb74f('0x36')]){return'';}for(var _0x1bf5a9='(',_0x241c58=0x0;_0x241c58<_0x471d62[_0xb74f('0x64')][_0xb74f('0x36')];_0x241c58+=0x1){_0x241c58>0x0&&(_0x1bf5a9+='\x20'+_0x471d62['operator']+'\x20');_0x1bf5a9+=_0x471d62['rules'][_0x241c58]['group']?_0x1926a7(_0x471d62[_0xb74f('0x64')][_0x241c58][_0xb74f('0x65')]):_0x471d62['rules'][_0x241c58][_0xb74f('0x66')]+'\x20'+_0x471d62[_0xb74f('0x64')][_0x241c58][_0xb74f('0x67')]+(_0x273585(_0x471d62[_0xb74f('0x64')][_0x241c58][_0xb74f('0x67')])?'\x20'+_0x471d62[_0xb74f('0x64')][_0x241c58][_0xb74f('0x68')]:'');}return _0x1bf5a9+')';};var _0x5d8b21={'where':{'id':_0x4c0ca9['params']['id']}},_0x3c6c9c,_0x4ec51f,_0x163bbc,_0x10e32f,_0x5bba6f;_0x5d8b21=_['merge']({},_0x5d8b21,_0x4c0ca9['options']);return db[_0xb74f('0x3f')][_0xb74f('0x46')](_0x5d8b21)[_0xb74f('0x24')](function(_0x996eba){if(_0x996eba){_0x3c6c9c=_0x996eba;return _0x996eba[_0xb74f('0x69')]();}return null;})[_0xb74f('0x24')](function(_0x34d994){if(_0x34d994){if(!_0x34d994[_0xb74f('0x36')]){throw new db[(_0xb74f('0x6a'))][(_0xb74f('0x6b'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x4ec51f=_0x34d994;return db['AnalyticMetric'][_0xb74f('0x6c')]({'raw':!![]});}return null;})['then'](function(_0x2150ee){if(_0x2150ee){_0x163bbc=_[_0xb74f('0x6d')](_0x2150ee,'id');var _0x1f27b7;var _0x1a2411=squel[_0xb74f('0x6e')]();_0x1a2411[_0xb74f('0x6f')](_0x3c6c9c['table']);for(var _0x5c39d1=0x0;_0x5c39d1<_0x4ec51f['length'];_0x5c39d1+=0x1){_0x1f27b7=_0x4ec51f[_0x5c39d1][_0xb74f('0x70')]?_0x163bbc[_0x4ec51f[_0x5c39d1][_0xb74f('0x70')]][_0xb74f('0x71')]:_0x4ec51f[_0x5c39d1][_0xb74f('0x66')];_0x1f27b7=_0x4ec51f[_0x5c39d1][_0xb74f('0x72')]?_['replace'](_0xb1fe6[_0x4ec51f[_0x5c39d1]['function']],'%s',_0x1f27b7):_0x1f27b7;_0x1f27b7=_0x4ec51f[_0x5c39d1][_0xb74f('0x73')]?_[_0xb74f('0x74')](_0x5d4078[_0x4ec51f[_0x5c39d1]['format']],'%s',_0x1f27b7):_0x1f27b7;if(_0x4ec51f[_0x5c39d1][_0xb74f('0x75')]){_0x1a2411[_0xb74f('0x65')](_0x1f27b7);}_0x4ec51f[_0x5c39d1][_0xb74f('0x76')]&&_0x1a2411['order'](_0x1f27b7,_0x4ec51f[_0x5c39d1][_0xb74f('0x76')]===_0xb74f('0x77')?![]:!![]);_0x1a2411[_0xb74f('0x66')](_0x1f27b7,_0x4ec51f[_0x5c39d1]['alias']||_0x1f27b7);}if(_0x3c6c9c['joins']){_0x3c6c9c['joins']=JSON[_0xb74f('0x78')](_0x3c6c9c[_0xb74f('0x79')]);for(var _0x5184e8=0x0;_0x5184e8<_0x3c6c9c[_0xb74f('0x79')][_0xb74f('0x36')];_0x5184e8+=0x1){if(_0x3c6c9c[_0xb74f('0x79')][_0x5184e8]['type']&&_[_0xb74f('0x60')](_0x281ca5,_0x3c6c9c[_0xb74f('0x79')][_0x5184e8]['type'])&&_0x3c6c9c[_0xb74f('0x79')][_0x5184e8]['parentKey']&&_0x3c6c9c[_0xb74f('0x79')][_0x5184e8]['foreignTable']&&_0x3c6c9c[_0xb74f('0x79')][_0x5184e8][_0xb74f('0x7a')]){_0x1a2411[_0x3c6c9c[_0xb74f('0x79')][_0x5184e8][_0xb74f('0x2e')]](_0x3c6c9c[_0xb74f('0x79')][_0x5184e8][_0xb74f('0x7b')],null,util[_0xb74f('0x73')](_0xb74f('0x7c'),_0x3c6c9c[_0xb74f('0x7d')],_0x3c6c9c[_0xb74f('0x79')][_0x5184e8][_0xb74f('0x7e')],_0x3c6c9c[_0xb74f('0x79')][_0x5184e8][_0xb74f('0x7b')],_0x3c6c9c[_0xb74f('0x79')][_0x5184e8][_0xb74f('0x7a')]));}}}if(_0x3c6c9c[_0xb74f('0x7f')]){_0x3c6c9c['conditions']=JSON[_0xb74f('0x78')](_0x3c6c9c['conditions']);_0x1a2411['where'](_0x1926a7(_0x3c6c9c['conditions'][_0xb74f('0x65')]));}_0x5bba6f=_0x1a2411[_0xb74f('0x80')]();_0x1a2411[_0xb74f('0x1d')](_0x5ba4ed);_0x1a2411['offset'](0x0);logger[_0xb74f('0x81')](_0xb74f('0x82'),_0x1a2411[_0xb74f('0x83')]());return dbH['sequelize'][_0xb74f('0x31')](_0x1a2411[_0xb74f('0x83')](),{'type':dbH['sequelize'][_0xb74f('0x84')][_0xb74f('0x85')]});}})['then'](respondWithResult(_0x9da040,null))[_0xb74f('0x4f')](handleError(_0x9da040,null));};function runReport(_0x260a7a,_0x3d3881,_0x152509){var _0x5865a2=_0x3d3881['name'];var _0x51bce6=0xa;var _0x3b876a=['join','left_join',_0xb74f('0x86'),_0xb74f('0x53')];var _0x1d9cbf={'SUM':_0xb74f('0x54'),'COUNT':_0xb74f('0x55'),'COUNT DISTINCT':_0xb74f('0x56'),'MAX':_0xb74f('0x57'),'MIN':_0xb74f('0x58'),'AVG':_0xb74f('0x59'),'GROUP_CONCAT':_0xb74f('0x5a'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x4bdd2a={'SEC_TO_TIME':_0xb74f('0x5c'),'DATE':_0xb74f('0x5d'),'HOUR':_0xb74f('0x87'),'ROUND':_0xb74f('0x5e'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x5ca029=function(_0xe7a925){return!_['includes']([_0xb74f('0x88'),'IS\x20NOT\x20NULL',_0xb74f('0x62'),'IS\x20NOT\x20EMPTY'],_0xe7a925);};var _0x329065=function(_0x2bf4ca){if(!_0x2bf4ca||!_0x2bf4ca[_0xb74f('0x64')][_0xb74f('0x36')]){return'';}for(var _0x3522ac='(',_0x5f4bb0=0x0;_0x5f4bb0<_0x2bf4ca[_0xb74f('0x64')][_0xb74f('0x36')];_0x5f4bb0+=0x1){_0x5f4bb0>0x0&&(_0x3522ac+='\x20'+_0x2bf4ca['operator']+'\x20');_0x3522ac+=_0x2bf4ca[_0xb74f('0x64')][_0x5f4bb0][_0xb74f('0x65')]?_0x329065(_0x2bf4ca[_0xb74f('0x64')][_0x5f4bb0][_0xb74f('0x65')]):_0x2bf4ca[_0xb74f('0x64')][_0x5f4bb0]['field']+'\x20'+_0x2bf4ca['rules'][_0x5f4bb0]['condition']+(_0x5ca029(_0x2bf4ca[_0xb74f('0x64')][_0x5f4bb0][_0xb74f('0x67')])?'\x20'+_0x2bf4ca['rules'][_0x5f4bb0][_0xb74f('0x68')]:'');}return _0x3522ac+')';};var _0x32e26d={'where':{'id':_0x260a7a['id']}},_0x6a40f9,_0x36bc7f,_0x63a599,_0x50661a,_0xfb4e74;_0x32e26d=_['merge']({},_0x32e26d,_0x152509);return db[_0xb74f('0x3f')]['find'](_0x32e26d)['then'](function(_0x442543){if(_0x442543){_0x6a40f9=_0x442543;return _0x442543[_0xb74f('0x69')]();}return null;})[_0xb74f('0x24')](function(_0x343b60){if(_0x343b60){if(!_0x343b60[_0xb74f('0x36')]){throw new db['Sequelize']['ValidationErrorItem'](_0xb74f('0x89'),0x193);}_0x36bc7f=_0x343b60;return db[_0xb74f('0x8a')][_0xb74f('0x6c')]({'raw':!![]});}return null;})[_0xb74f('0x24')](function(_0x3c5f7f){if(_0x3c5f7f){_0x63a599=_[_0xb74f('0x6d')](_0x3c5f7f,'id');var _0x4a7973;var _0x2286c4=squel[_0xb74f('0x6e')]();_0x2286c4[_0xb74f('0x6f')](_0x6a40f9[_0xb74f('0x7d')]);for(var _0x3636d0=0x0;_0x3636d0<_0x36bc7f[_0xb74f('0x36')];_0x3636d0+=0x1){_0x4a7973=_0x36bc7f[_0x3636d0]['MetricId']?_0x63a599[_0x36bc7f[_0x3636d0]['MetricId']][_0xb74f('0x71')]:_0x36bc7f[_0x3636d0][_0xb74f('0x66')];_0x4a7973=_0x36bc7f[_0x3636d0]['function']?_[_0xb74f('0x74')](_0x1d9cbf[_0x36bc7f[_0x3636d0]['function']],'%s',_0x4a7973):_0x4a7973;_0x4a7973=_0x36bc7f[_0x3636d0]['format']?_[_0xb74f('0x74')](_0x4bdd2a[_0x36bc7f[_0x3636d0][_0xb74f('0x73')]],'%s',_0x4a7973):_0x4a7973;if(_0x36bc7f[_0x3636d0][_0xb74f('0x75')]){_0x2286c4['group'](_0x4a7973);}_0x36bc7f[_0x3636d0][_0xb74f('0x76')]&&_0x2286c4['order'](_0x4a7973,_0x36bc7f[_0x3636d0][_0xb74f('0x76')]===_0xb74f('0x77')?![]:!![]);_0x2286c4[_0xb74f('0x66')](_0x4a7973,_0x36bc7f[_0x3636d0][_0xb74f('0x8b')]||_0x4a7973);}if(_0x6a40f9['joins']){_0x6a40f9[_0xb74f('0x79')]=JSON[_0xb74f('0x78')](_0x6a40f9['joins']);for(var _0x5bec99=0x0;_0x5bec99<_0x6a40f9[_0xb74f('0x79')]['length'];_0x5bec99+=0x1){if(_0x6a40f9[_0xb74f('0x79')][_0x5bec99][_0xb74f('0x2e')]&&_['includes'](_0x3b876a,_0x6a40f9['joins'][_0x5bec99][_0xb74f('0x2e')])&&_0x6a40f9['joins'][_0x5bec99][_0xb74f('0x7e')]&&_0x6a40f9['joins'][_0x5bec99][_0xb74f('0x7b')]&&_0x6a40f9['joins'][_0x5bec99][_0xb74f('0x7a')]){_0x2286c4[_0x6a40f9[_0xb74f('0x79')][_0x5bec99][_0xb74f('0x2e')]](_0x6a40f9[_0xb74f('0x79')][_0x5bec99][_0xb74f('0x7b')],null,util[_0xb74f('0x73')](_0xb74f('0x7c'),_0x6a40f9[_0xb74f('0x7d')],_0x6a40f9[_0xb74f('0x79')][_0x5bec99][_0xb74f('0x7e')],_0x6a40f9[_0xb74f('0x79')][_0x5bec99][_0xb74f('0x7b')],_0x6a40f9[_0xb74f('0x79')][_0x5bec99][_0xb74f('0x7a')]));}}}if(_0x6a40f9[_0xb74f('0x7f')]){_0x6a40f9[_0xb74f('0x7f')]=JSON[_0xb74f('0x78')](_0x6a40f9[_0xb74f('0x7f')]);_0x2286c4[_0xb74f('0x3a')](_0x329065(_0x6a40f9[_0xb74f('0x7f')][_0xb74f('0x65')]));}_0xfb4e74=_0x2286c4['clone']();_0x2286c4[_0xb74f('0x1d')](_0x51bce6);_0x2286c4[_0xb74f('0x1b')](0x0);return;}})[_0xb74f('0x24')](function(){if(_0x3d3881['output']==='web'){return null;}var _0x49d8ac=_[_0xb74f('0x3c')](_0x3d3881,{'name':_0x3d3881[_0xb74f('0x8c')]||_0x3d3881[_0xb74f('0x2a')]||_0x6a40f9[_0xb74f('0x2a')],'basename':_0x5865a2,'savename':util[_0xb74f('0x73')](_0xb74f('0x8d'),_0x3d3881[_0xb74f('0x2a')]||_0x6a40f9[_0xb74f('0x2a')],require(_0xb74f('0x8e'))[_0xb74f('0x8f')](0x4),_0x3d3881[_0xb74f('0x90')]||_0xb74f('0x91')),'reportId':_0x6a40f9['id'],'reportType':_0xb74f('0x92')});return db[_0xb74f('0x93')][_0xb74f('0x47')](_0x49d8ac,{'raw':!![]});})['then'](function(_0x5a647f){if(_0x6a40f9[_0xb74f('0x7d')]==='cdr'){_0xfb4e74['where'](_0x6a40f9[_0xb74f('0x7d')]+_0xb74f('0x94'),_0x3d3881[_0xb74f('0x95')],_0x3d3881[_0xb74f('0x96')]);}else{_0xfb4e74[_0xb74f('0x3a')](_0x6a40f9[_0xb74f('0x7d')]+_0xb74f('0x97'),_0x3d3881[_0xb74f('0x95')],_0x3d3881[_0xb74f('0x96')]);}if(_0x5a647f){logger[_0xb74f('0x98')](_0xb74f('0x99'),_0xfb4e74[_0xb74f('0x83')]());require(_0xb74f('0x9a'))[_0xb74f('0x9b')](path[_0xb74f('0x9c')](__dirname,'../../components/export/',_0x5a647f[_0xb74f('0x90')]),[_0x5a647f['id'],_0xfb4e74[_0xb74f('0x83')](),path[_0xb74f('0x9c')](__dirname,_0xb74f('0x9d'),_0x5a647f[_0xb74f('0x9e')]),_0x5865a2]);return _0x5a647f;}else{var _0x2f0335=squel[_0xb74f('0x6e')]();_0x2f0335[_0xb74f('0x6f')]('('+_0xfb4e74['toString']()+')','countTable');_0x2f0335['field'](_0xb74f('0x9f'),_0xb74f('0x1e'));_0xfb4e74['limit'](_0x3d3881[_0xb74f('0x1d')]||_0x51bce6);_0xfb4e74[_0xb74f('0x1b')](_0x3d3881[_0xb74f('0x1b')]||0x0);return dbH['sequelize'][_0xb74f('0x31')](_0x2f0335[_0xb74f('0x83')](),{'type':dbH[_0xb74f('0xa0')][_0xb74f('0x84')][_0xb74f('0x85')]})[_0xb74f('0x24')](function(_0x466e27){if(!_0x466e27[_0xb74f('0x36')]){_0x50661a=0x0;}else{_0x50661a=_0x466e27[0x0]['count']||0x0;}return dbH[_0xb74f('0xa0')]['query'](_0xfb4e74['toString'](),{'type':dbH[_0xb74f('0xa0')][_0xb74f('0x84')][_0xb74f('0x85')]});})[_0xb74f('0x24')](function(_0x5b0eea){return{'rows':_0x5b0eea||[],'count':_0x50661a};});}});}exports[_0xb74f('0xa1')]=function(_0x21581f,_0xbaaf65){return runReport(_0x21581f[_0xb74f('0x42')],_0x21581f[_0xb74f('0x31')],_0x21581f[_0xb74f('0x3e')])['then'](respondWithResult(_0xbaaf65,null))[_0xb74f('0x4f')](handleError(_0xbaaf65,null));};exports[_0xb74f('0xa2')]=runReport;exports[_0xb74f('0x31')]=function(_0x394c27,_0x163b62){var _0x3a3627=0xa;var _0x1431a5=[_0xb74f('0x9c'),_0xb74f('0x52'),_0xb74f('0x86'),'cross_join'];var _0x47aa36={'SUM':_0xb74f('0x54'),'COUNT':_0xb74f('0x55'),'COUNT DISTINCT':_0xb74f('0x56'),'MAX':_0xb74f('0x57'),'MIN':'MIN(%s)','AVG':_0xb74f('0x59'),'GROUP_CONCAT':_0xb74f('0x5a'),'GROUP_CONCAT ASC':_0xb74f('0xa3'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x49d0dc={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xb74f('0x5d'),'HOUR':_0xb74f('0x87'),'ROUND':_0xb74f('0x5e'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x3f02e6=function(_0x49d0ce){return!_[_0xb74f('0x60')](['IS\x20NULL',_0xb74f('0x61'),_0xb74f('0x62'),_0xb74f('0x63')],_0x49d0ce);};var _0x1c884c=function(_0x576caa){if(!_0x576caa||!_0x576caa['rules'][_0xb74f('0x36')]){return'';}for(var _0x21d82b='(',_0x1c6acb=0x0;_0x1c6acb<_0x576caa[_0xb74f('0x64')][_0xb74f('0x36')];_0x1c6acb+=0x1){_0x1c6acb>0x0&&(_0x21d82b+='\x20'+_0x576caa[_0xb74f('0xa4')]+'\x20');_0x21d82b+=_0x576caa[_0xb74f('0x64')][_0x1c6acb]['group']?_0x1c884c(_0x576caa[_0xb74f('0x64')][_0x1c6acb][_0xb74f('0x65')]):_0x576caa[_0xb74f('0x64')][_0x1c6acb]['field']+'\x20'+_0x576caa[_0xb74f('0x64')][_0x1c6acb][_0xb74f('0x67')]+(_0x3f02e6(_0x576caa[_0xb74f('0x64')][_0x1c6acb]['condition'])?'\x20'+_0x576caa['rules'][_0x1c6acb]['value']:'');}return _0x21d82b+')';};var _0x26a62d={'where':{'id':_0x394c27[_0xb74f('0x42')]['id']}},_0x44640,_0xb0a92b,_0x154b1a,_0x12086f,_0x558edb;_0x26a62d=_[_0xb74f('0x3c')]({},_0x26a62d,_0x394c27[_0xb74f('0x3e')]);return db[_0xb74f('0x3f')][_0xb74f('0x46')](_0x26a62d)[_0xb74f('0x24')](function(_0x28d556){if(_0x28d556){_0x44640=_0x28d556;return _0x28d556[_0xb74f('0x69')]();}return null;})[_0xb74f('0x24')](function(_0x2eb5ee){if(_0x2eb5ee){if(!_0x2eb5ee[_0xb74f('0x36')]){throw new db[(_0xb74f('0x6a'))]['ValidationErrorItem'](_0xb74f('0x89'),0x193);}_0xb0a92b=_0x2eb5ee;return db[_0xb74f('0x8a')][_0xb74f('0x6c')]({'raw':!![]});}return null;})['then'](function(_0x53943b){if(_0x53943b){_0x154b1a=_[_0xb74f('0x6d')](_0x53943b,'id');var _0x4ad526;var _0x408213=squel[_0xb74f('0x6e')]();_0x408213[_0xb74f('0x6f')](_0x44640[_0xb74f('0x7d')]);for(var _0x278f96=0x0;_0x278f96<_0xb0a92b[_0xb74f('0x36')];_0x278f96+=0x1){_0x4ad526=_0xb0a92b[_0x278f96][_0xb74f('0x70')]?_0x154b1a[_0xb0a92b[_0x278f96][_0xb74f('0x70')]][_0xb74f('0x71')]:_0xb0a92b[_0x278f96][_0xb74f('0x66')];_0x4ad526=_0xb0a92b[_0x278f96][_0xb74f('0x72')]?_['replace'](_0x47aa36[_0xb0a92b[_0x278f96][_0xb74f('0x72')]],'%s',_0x4ad526):_0x4ad526;_0x4ad526=_0xb0a92b[_0x278f96][_0xb74f('0x73')]?_[_0xb74f('0x74')](_0x49d0dc[_0xb0a92b[_0x278f96][_0xb74f('0x73')]],'%s',_0x4ad526):_0x4ad526;if(_0xb0a92b[_0x278f96][_0xb74f('0x75')]){_0x408213[_0xb74f('0x65')](_0x4ad526);}_0xb0a92b[_0x278f96][_0xb74f('0x76')]&&_0x408213[_0xb74f('0x38')](_0x4ad526,_0xb0a92b[_0x278f96][_0xb74f('0x76')]===_0xb74f('0x77')?![]:!![]);_0x408213[_0xb74f('0x66')](_0x4ad526,_0xb0a92b[_0x278f96]['alias']||_0x4ad526);}if(_0x44640['joins']){_0x44640[_0xb74f('0x79')]=JSON[_0xb74f('0x78')](_0x44640[_0xb74f('0x79')]);for(var _0x53482b=0x0;_0x53482b<_0x44640[_0xb74f('0x79')]['length'];_0x53482b+=0x1){if(_0x44640[_0xb74f('0x79')][_0x53482b]['type']&&_[_0xb74f('0x60')](_0x1431a5,_0x44640[_0xb74f('0x79')][_0x53482b][_0xb74f('0x2e')])&&_0x44640[_0xb74f('0x79')][_0x53482b][_0xb74f('0x7e')]&&_0x44640[_0xb74f('0x79')][_0x53482b][_0xb74f('0x7b')]&&_0x44640[_0xb74f('0x79')][_0x53482b][_0xb74f('0x7a')]){_0x408213[_0x44640[_0xb74f('0x79')][_0x53482b]['type']](_0x44640[_0xb74f('0x79')][_0x53482b]['foreignTable'],null,util[_0xb74f('0x73')](_0xb74f('0x7c'),_0x44640['table'],_0x44640[_0xb74f('0x79')][_0x53482b][_0xb74f('0x7e')],_0x44640[_0xb74f('0x79')][_0x53482b]['foreignTable'],_0x44640[_0xb74f('0x79')][_0x53482b][_0xb74f('0x7a')]));}}}if(_0x44640[_0xb74f('0x7f')]){_0x44640[_0xb74f('0x7f')]=JSON[_0xb74f('0x78')](_0x44640[_0xb74f('0x7f')]);_0x408213[_0xb74f('0x3a')](_0x1c884c(_0x44640[_0xb74f('0x7f')][_0xb74f('0x65')]));}_0x558edb=_0x408213[_0xb74f('0x80')]();_0x408213[_0xb74f('0x1d')](_0x3a3627);_0x408213[_0xb74f('0x1b')](0x0);logger[_0xb74f('0x81')](_0xb74f('0x82'),_0x408213['toString']());return dbH[_0xb74f('0xa0')]['query'](_0x408213[_0xb74f('0x83')](),{'type':dbH[_0xb74f('0xa0')][_0xb74f('0x84')]['SELECT']});}})[_0xb74f('0x24')](function(){return{'sql':_0x558edb[_0xb74f('0x83')]()};})[_0xb74f('0x24')](respondWithResult(_0x163b62,null))['catch'](handleError(_0x163b62,null));}; \ No newline at end of file +var _0x37a5=['body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Reports','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','rules','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','findAll','select','MetricId','replace','function','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignKey','foreignTable','table','conditions','debug','toString','sequelize','QueryTypes','SELECT','ROUND(%s)','IS\x20EMPTY','IS\x20NOT\x20EMPTY','operator','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','from','metric','%s.%s\x20=\x20%s.%s','clone','output','%s-%s.%s','randomstring','generate','csv','custom','AnalyticExtractedReport','cdr','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','../../components/export/','../../files/reports','savename','COUNT(*)','run','runReport','Limited\x20Query:','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','end','offset','limit','undefined','count','status','set','json','reject','save','then','destroy','get','CustomReports','UserProfileResource','error','stack','name','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','map','type','VIRTUAL','options','includeAll','AnalyticCustomReport','rows','catch','show','params','include','create'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x37a5,0x100));var _0x537a=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x37a5[_0x279d37];return _0x530173;};'use strict';var emlformat=require(_0x537a('0x0'));var rimraf=require(_0x537a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x537a('0x2'));var moment=require(_0x537a('0x3'));var BPromise=require(_0x537a('0x4'));var Mustache=require(_0x537a('0x5'));var util=require(_0x537a('0x6'));var path=require(_0x537a('0x7'));var sox=require(_0x537a('0x8'));var csv=require(_0x537a('0x9'));var ejs=require(_0x537a('0xa'));var fs=require('fs');var fs_extra=require(_0x537a('0xb'));var _=require(_0x537a('0xc'));var squel=require(_0x537a('0xd'));var crypto=require(_0x537a('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x537a('0xf'));var toCsv=require('to-csv');var querystring=require(_0x537a('0x10'));var Papa=require(_0x537a('0x11'));var Redis=require(_0x537a('0x12'));var authService=require(_0x537a('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x537a('0x14'));var hardwareService=require(_0x537a('0x15'));var logger=require('../../config/logger')(_0x537a('0x16'));var utils=require('../../config/utils');var config=require(_0x537a('0x17'));var licenseUtil=require(_0x537a('0x18'));var db=require(_0x537a('0x19'))['db'];var dbH=require(_0x537a('0x19'))[_0x537a('0x1a')];function respondWithStatusCode(_0x3aac38,_0x2af99d){_0x2af99d=_0x2af99d||0xcc;return function(_0x1d217d){if(_0x1d217d){return _0x3aac38[_0x537a('0x1b')](_0x2af99d);}return _0x3aac38['status'](_0x2af99d)[_0x537a('0x1c')]();};}function respondWithResult(_0x24251f,_0x5408ec){_0x5408ec=_0x5408ec||0xc8;return function(_0x43f947){if(_0x43f947){return _0x24251f['status'](_0x5408ec)['json'](_0x43f947);}};}function respondWithFilteredResult(_0x22ca6d,_0x3dbaad){return function(_0x1de481){if(_0x1de481){var _0x126282=typeof _0x3dbaad[_0x537a('0x1d')]==='undefined'&&typeof _0x3dbaad[_0x537a('0x1e')]===_0x537a('0x1f');var _0x13878d=_0x1de481['count'];var _0x45ac62=_0x126282?0x0:_0x3dbaad[_0x537a('0x1d')];var _0x55b05e=_0x126282?_0x1de481[_0x537a('0x20')]:_0x3dbaad[_0x537a('0x1d')]+_0x3dbaad[_0x537a('0x1e')];var _0x81d861;if(_0x55b05e>=_0x13878d){_0x55b05e=_0x13878d;_0x81d861=0xc8;}else{_0x81d861=0xce;}_0x22ca6d[_0x537a('0x21')](_0x81d861);return _0x22ca6d[_0x537a('0x22')]('Content-Range',_0x45ac62+'-'+_0x55b05e+'/'+_0x13878d)[_0x537a('0x23')](_0x1de481);}return null;};}function patchUpdates(_0x58693f){return function(_0x261149){try{jsonpatch['apply'](_0x261149,_0x58693f,!![]);}catch(_0x308018){return BPromise[_0x537a('0x24')](_0x308018);}return _0x261149[_0x537a('0x25')]();};}function saveUpdates(_0x5ac447,_0x47c84d){return function(_0xec03c){if(_0xec03c){return _0xec03c['update'](_0x5ac447)[_0x537a('0x26')](function(_0x1fd6ee){return _0x1fd6ee;});}return null;};}function removeEntity(_0xff35ae,_0x343f7f){return function(_0x33f05f){if(_0x33f05f){return _0x33f05f[_0x537a('0x27')]()[_0x537a('0x26')](function(){var _0x4f9759=_0x33f05f[_0x537a('0x28')]({'plain':!![]});var _0x1f7835=_0x537a('0x29');return db[_0x537a('0x2a')][_0x537a('0x27')]({'where':{'type':_0x1f7835,'resourceId':_0x4f9759['id']}})['then'](function(){return _0x33f05f;});})[_0x537a('0x26')](function(){_0xff35ae['status'](0xcc)[_0x537a('0x1c')]();});}};}function handleEntityNotFound(_0x3720f6,_0x55d7d7){return function(_0x55eda1){if(!_0x55eda1){_0x3720f6[_0x537a('0x1b')](0x194);}return _0x55eda1;};}function handleError(_0x23b9ab,_0xf9ee53){_0xf9ee53=_0xf9ee53||0x1f4;return function(_0x196ee8){logger[_0x537a('0x2b')](_0x196ee8[_0x537a('0x2c')]);if(_0x196ee8[_0x537a('0x2d')]){delete _0x196ee8[_0x537a('0x2d')];}_0x23b9ab[_0x537a('0x21')](_0xf9ee53)['send'](_0x196ee8);};}exports['index']=function(_0x324cc8,_0x24e703){var _0x991c8={},_0xa47381={},_0x445f99={'count':0x0,'rows':[]};var _0x2284ef=_['map'](db['AnalyticCustomReport'][_0x537a('0x2e')],function(_0x29e813){return{'name':_0x29e813[_0x537a('0x2f')],'type':_0x29e813['type'][_0x537a('0x30')]};});_0xa47381[_0x537a('0x31')]=_['map'](_0x2284ef,'name');_0xa47381[_0x537a('0x32')]=_[_0x537a('0x33')](_0x324cc8['query']);_0xa47381['filters']=_[_0x537a('0x34')](_0xa47381[_0x537a('0x31')],_0xa47381[_0x537a('0x32')]);_0x991c8[_0x537a('0x35')]=_[_0x537a('0x34')](_0xa47381[_0x537a('0x31')],qs[_0x537a('0x36')](_0x324cc8['query'][_0x537a('0x36')]));_0x991c8[_0x537a('0x35')]=_0x991c8[_0x537a('0x35')][_0x537a('0x37')]?_0x991c8[_0x537a('0x35')]:_0xa47381[_0x537a('0x31')];if(!_0x324cc8[_0x537a('0x32')]['hasOwnProperty'](_0x537a('0x38'))){_0x991c8[_0x537a('0x1e')]=qs[_0x537a('0x1e')](_0x324cc8[_0x537a('0x32')][_0x537a('0x1e')]);_0x991c8[_0x537a('0x1d')]=qs['offset'](_0x324cc8[_0x537a('0x32')][_0x537a('0x1d')]);}_0x991c8[_0x537a('0x39')]=qs[_0x537a('0x3a')](_0x324cc8[_0x537a('0x32')][_0x537a('0x3a')]);_0x991c8[_0x537a('0x3b')]=qs[_0x537a('0x3c')](_[_0x537a('0x3d')](_0x324cc8[_0x537a('0x32')],_0xa47381['filters']),_0x2284ef);if(_0x324cc8[_0x537a('0x32')][_0x537a('0x3e')]){_0x991c8[_0x537a('0x3b')]=_[_0x537a('0x3f')](_0x991c8[_0x537a('0x3b')],{'$or':_[_0x537a('0x40')](_0x2284ef,function(_0x2cca08){if(_0x2cca08[_0x537a('0x41')]!==_0x537a('0x42')){var _0x52c40d={};_0x52c40d[_0x2cca08[_0x537a('0x2d')]]={'$like':'%'+_0x324cc8[_0x537a('0x32')]['filter']+'%'};return _0x52c40d;}})});}_0x991c8=_['merge']({},_0x991c8,_0x324cc8[_0x537a('0x43')]);var _0x2fa5cd={'where':_0x991c8[_0x537a('0x3b')]};return db['AnalyticCustomReport'][_0x537a('0x20')](_0x2fa5cd)[_0x537a('0x26')](function(_0xa07f0a){_0x445f99[_0x537a('0x20')]=_0xa07f0a;if(_0x324cc8['query'][_0x537a('0x44')]){_0x991c8['include']=[{'all':!![]}];}return db[_0x537a('0x45')]['findAll'](_0x991c8);})[_0x537a('0x26')](function(_0x43cca7){_0x445f99[_0x537a('0x46')]=_0x43cca7;return _0x445f99;})[_0x537a('0x26')](respondWithFilteredResult(_0x24e703,_0x991c8))[_0x537a('0x47')](handleError(_0x24e703,null));};exports[_0x537a('0x48')]=function(_0x3e20f0,_0x12deb2){var _0x2d2e67={'raw':![],'where':{'id':_0x3e20f0[_0x537a('0x49')]['id']}},_0x295d8c={};_0x295d8c['model']=_['keys'](db[_0x537a('0x45')][_0x537a('0x2e')]);_0x295d8c[_0x537a('0x32')]=_[_0x537a('0x33')](_0x3e20f0[_0x537a('0x32')]);_0x295d8c['filters']=_[_0x537a('0x34')](_0x295d8c['model'],_0x295d8c[_0x537a('0x32')]);_0x2d2e67[_0x537a('0x35')]=_['intersection'](_0x295d8c[_0x537a('0x31')],qs[_0x537a('0x36')](_0x3e20f0['query'][_0x537a('0x36')]));_0x2d2e67['attributes']=_0x2d2e67['attributes'][_0x537a('0x37')]?_0x2d2e67['attributes']:_0x295d8c[_0x537a('0x31')];if(_0x3e20f0['query'][_0x537a('0x44')]){_0x2d2e67[_0x537a('0x4a')]=[{'all':!![]}];}_0x2d2e67=_[_0x537a('0x3f')]({},_0x2d2e67,_0x3e20f0[_0x537a('0x43')]);return db[_0x537a('0x45')]['find'](_0x2d2e67)[_0x537a('0x26')](handleEntityNotFound(_0x12deb2,null))['then'](respondWithResult(_0x12deb2,null))[_0x537a('0x47')](handleError(_0x12deb2,null));};exports[_0x537a('0x4b')]=function(_0x5243a9,_0x7cf7c3){return db[_0x537a('0x45')][_0x537a('0x4b')](_0x5243a9[_0x537a('0x4c')],{})[_0x537a('0x26')](function(_0x178659){var _0x3272ed=_0x5243a9['user']['get']({'plain':!![]});if(!_0x3272ed)throw new Error(_0x537a('0x4d'));if(_0x3272ed['role']===_0x537a('0x4e')){var _0x1101a2=_0x178659[_0x537a('0x28')]({'plain':!![]});var _0x4aad1e=_0x537a('0x4f');return db[_0x537a('0x50')]['find']({'where':{'name':_0x4aad1e,'userProfileId':_0x3272ed['userProfileId']},'raw':!![]})[_0x537a('0x26')](function(_0xd37962){if(_0xd37962&&_0xd37962[_0x537a('0x51')]===0x0){return db[_0x537a('0x2a')]['create']({'name':_0x1101a2[_0x537a('0x2d')],'resourceId':_0x1101a2['id'],'type':_0x537a('0x29'),'sectionId':_0xd37962['id']},{})[_0x537a('0x26')](function(){return _0x178659;});}else{return _0x178659;}})['catch'](function(_0xb0eb4d){logger[_0x537a('0x2b')](_0x537a('0x52'),_0xb0eb4d);throw _0xb0eb4d;});}return _0x178659;})[_0x537a('0x26')](respondWithResult(_0x7cf7c3,0xc9))[_0x537a('0x47')](handleError(_0x7cf7c3,null));};exports[_0x537a('0x53')]=function(_0xe2d43b,_0x2d258a){if(_0xe2d43b[_0x537a('0x4c')]['id']){delete _0xe2d43b[_0x537a('0x4c')]['id'];}return db[_0x537a('0x45')]['find']({'where':{'id':_0xe2d43b[_0x537a('0x49')]['id']}})[_0x537a('0x26')](handleEntityNotFound(_0x2d258a,null))[_0x537a('0x26')](saveUpdates(_0xe2d43b[_0x537a('0x4c')],null))[_0x537a('0x26')](respondWithResult(_0x2d258a,null))[_0x537a('0x47')](handleError(_0x2d258a,null));};exports[_0x537a('0x27')]=function(_0x40587e,_0x60388a){return db[_0x537a('0x45')][_0x537a('0x54')]({'where':{'id':_0x40587e[_0x537a('0x49')]['id']}})[_0x537a('0x26')](handleEntityNotFound(_0x60388a,null))[_0x537a('0x26')](removeEntity(_0x60388a,null))[_0x537a('0x47')](handleError(_0x60388a,null));};exports['preview']=function(_0x2ac3c2,_0x51e712){var _0x549e10=0xa;var _0x104c5c=[_0x537a('0x55'),_0x537a('0x56'),_0x537a('0x57'),_0x537a('0x58')];var _0x5eb546={'SUM':_0x537a('0x59'),'COUNT':_0x537a('0x5a'),'COUNT DISTINCT':_0x537a('0x5b'),'MAX':_0x537a('0x5c'),'MIN':_0x537a('0x5d'),'AVG':_0x537a('0x5e'),'GROUP_CONCAT':_0x537a('0x5f'),'GROUP_CONCAT ASC':_0x537a('0x60'),'GROUP_CONCAT DESC':_0x537a('0x61')};var _0x3df5f3={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x537a('0x62'),'HOUR':_0x537a('0x63'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x537a('0x64')};var _0x61aa87=function(_0x19affc){return!_[_0x537a('0x65')]([_0x537a('0x66'),_0x537a('0x67'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x19affc);};var _0x3de487=function(_0x432eed){if(!_0x432eed||!_0x432eed[_0x537a('0x68')][_0x537a('0x37')]){return'';}for(var _0x59c8c6='(',_0x24c8cd=0x0;_0x24c8cd<_0x432eed[_0x537a('0x68')][_0x537a('0x37')];_0x24c8cd+=0x1){_0x24c8cd>0x0&&(_0x59c8c6+='\x20'+_0x432eed['operator']+'\x20');_0x59c8c6+=_0x432eed['rules'][_0x24c8cd][_0x537a('0x69')]?_0x3de487(_0x432eed[_0x537a('0x68')][_0x24c8cd][_0x537a('0x69')]):_0x432eed[_0x537a('0x68')][_0x24c8cd][_0x537a('0x6a')]+'\x20'+_0x432eed[_0x537a('0x68')][_0x24c8cd][_0x537a('0x6b')]+(_0x61aa87(_0x432eed['rules'][_0x24c8cd]['condition'])?'\x20'+_0x432eed[_0x537a('0x68')][_0x24c8cd][_0x537a('0x6c')]:'');}return _0x59c8c6+')';};var _0x1db9c5={'where':{'id':_0x2ac3c2[_0x537a('0x49')]['id']}},_0x4b9766,_0x2ccff5,_0x1a044f,_0x1655cb,_0x14e0a2;_0x1db9c5=_['merge']({},_0x1db9c5,_0x2ac3c2[_0x537a('0x43')]);return db[_0x537a('0x45')]['find'](_0x1db9c5)[_0x537a('0x26')](function(_0x268e01){if(_0x268e01){_0x4b9766=_0x268e01;return _0x268e01[_0x537a('0x6d')]();}return null;})[_0x537a('0x26')](function(_0x29178c){if(_0x29178c){if(!_0x29178c['length']){throw new db[(_0x537a('0x6e'))][(_0x537a('0x6f'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2ccff5=_0x29178c;return db['AnalyticMetric'][_0x537a('0x70')]({'raw':!![]});}return null;})[_0x537a('0x26')](function(_0x4a5e3d){if(_0x4a5e3d){_0x1a044f=_['keyBy'](_0x4a5e3d,'id');var _0x3b23b9;var _0x14c7bd=squel[_0x537a('0x71')]();_0x14c7bd['from'](_0x4b9766['table']);for(var _0x5b3601=0x0;_0x5b3601<_0x2ccff5['length'];_0x5b3601+=0x1){_0x3b23b9=_0x2ccff5[_0x5b3601][_0x537a('0x72')]?_0x1a044f[_0x2ccff5[_0x5b3601]['MetricId']]['metric']:_0x2ccff5[_0x5b3601][_0x537a('0x6a')];_0x3b23b9=_0x2ccff5[_0x5b3601]['function']?_[_0x537a('0x73')](_0x5eb546[_0x2ccff5[_0x5b3601][_0x537a('0x74')]],'%s',_0x3b23b9):_0x3b23b9;_0x3b23b9=_0x2ccff5[_0x5b3601]['format']?_[_0x537a('0x73')](_0x3df5f3[_0x2ccff5[_0x5b3601][_0x537a('0x75')]],'%s',_0x3b23b9):_0x3b23b9;if(_0x2ccff5[_0x5b3601][_0x537a('0x76')]){_0x14c7bd['group'](_0x3b23b9);}_0x2ccff5[_0x5b3601][_0x537a('0x77')]&&_0x14c7bd[_0x537a('0x39')](_0x3b23b9,_0x2ccff5[_0x5b3601]['orderBy']===_0x537a('0x78')?![]:!![]);_0x14c7bd['field'](_0x3b23b9,_0x2ccff5[_0x5b3601][_0x537a('0x79')]||_0x3b23b9);}if(_0x4b9766['joins']){_0x4b9766[_0x537a('0x7a')]=JSON[_0x537a('0x7b')](_0x4b9766[_0x537a('0x7a')]);for(var _0x2f88cc=0x0;_0x2f88cc<_0x4b9766[_0x537a('0x7a')][_0x537a('0x37')];_0x2f88cc+=0x1){if(_0x4b9766[_0x537a('0x7a')][_0x2f88cc][_0x537a('0x41')]&&_[_0x537a('0x65')](_0x104c5c,_0x4b9766[_0x537a('0x7a')][_0x2f88cc][_0x537a('0x41')])&&_0x4b9766[_0x537a('0x7a')][_0x2f88cc][_0x537a('0x7c')]&&_0x4b9766[_0x537a('0x7a')][_0x2f88cc]['foreignTable']&&_0x4b9766[_0x537a('0x7a')][_0x2f88cc][_0x537a('0x7d')]){_0x14c7bd[_0x4b9766[_0x537a('0x7a')][_0x2f88cc][_0x537a('0x41')]](_0x4b9766[_0x537a('0x7a')][_0x2f88cc][_0x537a('0x7e')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x4b9766[_0x537a('0x7f')],_0x4b9766[_0x537a('0x7a')][_0x2f88cc]['parentKey'],_0x4b9766[_0x537a('0x7a')][_0x2f88cc][_0x537a('0x7e')],_0x4b9766[_0x537a('0x7a')][_0x2f88cc][_0x537a('0x7d')]));}}}if(_0x4b9766[_0x537a('0x80')]){_0x4b9766[_0x537a('0x80')]=JSON[_0x537a('0x7b')](_0x4b9766['conditions']);_0x14c7bd[_0x537a('0x3b')](_0x3de487(_0x4b9766[_0x537a('0x80')][_0x537a('0x69')]));}_0x14e0a2=_0x14c7bd['clone']();_0x14c7bd[_0x537a('0x1e')](_0x549e10);_0x14c7bd[_0x537a('0x1d')](0x0);logger[_0x537a('0x81')]('Limited\x20Query:',_0x14c7bd[_0x537a('0x82')]());return dbH[_0x537a('0x83')][_0x537a('0x32')](_0x14c7bd[_0x537a('0x82')](),{'type':dbH[_0x537a('0x83')][_0x537a('0x84')][_0x537a('0x85')]});}})[_0x537a('0x26')](respondWithResult(_0x51e712,null))[_0x537a('0x47')](handleError(_0x51e712,null));};function runReport(_0x6b309e,_0x954afe,_0xf9eaa9){var _0x106f85=_0x954afe['name'];var _0x2ff464=0xa;var _0x413b85=[_0x537a('0x55'),'left_join',_0x537a('0x57'),_0x537a('0x58')];var _0x3aa14b={'SUM':'SUM(%s)','COUNT':_0x537a('0x5a'),'COUNT DISTINCT':_0x537a('0x5b'),'MAX':_0x537a('0x5c'),'MIN':'MIN(%s)','AVG':_0x537a('0x5e'),'GROUP_CONCAT':_0x537a('0x5f'),'GROUP_CONCAT ASC':_0x537a('0x60'),'GROUP_CONCAT DESC':_0x537a('0x61')};var _0x32875a={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x537a('0x62'),'HOUR':_0x537a('0x63'),'ROUND':_0x537a('0x86'),'UNIX_TIMESTAMP':_0x537a('0x64')};var _0x5e9a5c=function(_0xa8ae4c){return!_[_0x537a('0x65')]([_0x537a('0x66'),'IS\x20NOT\x20NULL',_0x537a('0x87'),_0x537a('0x88')],_0xa8ae4c);};var _0x10f1af=function(_0x481254){if(!_0x481254||!_0x481254[_0x537a('0x68')][_0x537a('0x37')]){return'';}for(var _0x309f9b='(',_0xd1e8ef=0x0;_0xd1e8ef<_0x481254['rules']['length'];_0xd1e8ef+=0x1){_0xd1e8ef>0x0&&(_0x309f9b+='\x20'+_0x481254[_0x537a('0x89')]+'\x20');_0x309f9b+=_0x481254[_0x537a('0x68')][_0xd1e8ef][_0x537a('0x69')]?_0x10f1af(_0x481254[_0x537a('0x68')][_0xd1e8ef][_0x537a('0x69')]):_0x481254[_0x537a('0x68')][_0xd1e8ef][_0x537a('0x6a')]+'\x20'+_0x481254[_0x537a('0x68')][_0xd1e8ef][_0x537a('0x6b')]+(_0x5e9a5c(_0x481254['rules'][_0xd1e8ef][_0x537a('0x6b')])?'\x20'+_0x481254[_0x537a('0x68')][_0xd1e8ef][_0x537a('0x6c')]:'');}return _0x309f9b+')';};var _0xa805e={'where':{'id':_0x6b309e['id']}},_0xabac0f,_0x1c95e0,_0x35a164,_0xc05e6e,_0x7d1805;_0xa805e=_[_0x537a('0x3f')]({},_0xa805e,_0xf9eaa9);return db['AnalyticCustomReport'][_0x537a('0x54')](_0xa805e)['then'](function(_0x14f623){if(_0x14f623){_0xabac0f=_0x14f623;return _0x14f623['getFields']();}return null;})['then'](function(_0x53efa9){if(_0x53efa9){if(!_0x53efa9[_0x537a('0x37')]){throw new db[(_0x537a('0x6e'))]['ValidationErrorItem'](_0x537a('0x8a'),0x193);}_0x1c95e0=_0x53efa9;return db[_0x537a('0x8b')][_0x537a('0x70')]({'raw':!![]});}return null;})[_0x537a('0x26')](function(_0x1ad8d7){if(_0x1ad8d7){_0x35a164=_[_0x537a('0x8c')](_0x1ad8d7,'id');var _0x2c3e3e;var _0x3c1c43=squel[_0x537a('0x71')]();_0x3c1c43[_0x537a('0x8d')](_0xabac0f[_0x537a('0x7f')]);for(var _0x1d343c=0x0;_0x1d343c<_0x1c95e0[_0x537a('0x37')];_0x1d343c+=0x1){_0x2c3e3e=_0x1c95e0[_0x1d343c][_0x537a('0x72')]?_0x35a164[_0x1c95e0[_0x1d343c]['MetricId']][_0x537a('0x8e')]:_0x1c95e0[_0x1d343c][_0x537a('0x6a')];_0x2c3e3e=_0x1c95e0[_0x1d343c]['function']?_[_0x537a('0x73')](_0x3aa14b[_0x1c95e0[_0x1d343c][_0x537a('0x74')]],'%s',_0x2c3e3e):_0x2c3e3e;_0x2c3e3e=_0x1c95e0[_0x1d343c][_0x537a('0x75')]?_[_0x537a('0x73')](_0x32875a[_0x1c95e0[_0x1d343c][_0x537a('0x75')]],'%s',_0x2c3e3e):_0x2c3e3e;if(_0x1c95e0[_0x1d343c][_0x537a('0x76')]){_0x3c1c43[_0x537a('0x69')](_0x2c3e3e);}_0x1c95e0[_0x1d343c][_0x537a('0x77')]&&_0x3c1c43['order'](_0x2c3e3e,_0x1c95e0[_0x1d343c][_0x537a('0x77')]==='DESC'?![]:!![]);_0x3c1c43[_0x537a('0x6a')](_0x2c3e3e,_0x1c95e0[_0x1d343c]['alias']||_0x2c3e3e);}if(_0xabac0f[_0x537a('0x7a')]){_0xabac0f[_0x537a('0x7a')]=JSON['parse'](_0xabac0f['joins']);for(var _0x468d21=0x0;_0x468d21<_0xabac0f[_0x537a('0x7a')]['length'];_0x468d21+=0x1){if(_0xabac0f[_0x537a('0x7a')][_0x468d21][_0x537a('0x41')]&&_[_0x537a('0x65')](_0x413b85,_0xabac0f[_0x537a('0x7a')][_0x468d21][_0x537a('0x41')])&&_0xabac0f[_0x537a('0x7a')][_0x468d21][_0x537a('0x7c')]&&_0xabac0f[_0x537a('0x7a')][_0x468d21][_0x537a('0x7e')]&&_0xabac0f['joins'][_0x468d21][_0x537a('0x7d')]){_0x3c1c43[_0xabac0f[_0x537a('0x7a')][_0x468d21][_0x537a('0x41')]](_0xabac0f[_0x537a('0x7a')][_0x468d21][_0x537a('0x7e')],null,util[_0x537a('0x75')](_0x537a('0x8f'),_0xabac0f[_0x537a('0x7f')],_0xabac0f[_0x537a('0x7a')][_0x468d21][_0x537a('0x7c')],_0xabac0f[_0x537a('0x7a')][_0x468d21][_0x537a('0x7e')],_0xabac0f[_0x537a('0x7a')][_0x468d21][_0x537a('0x7d')]));}}}if(_0xabac0f[_0x537a('0x80')]){_0xabac0f[_0x537a('0x80')]=JSON[_0x537a('0x7b')](_0xabac0f[_0x537a('0x80')]);_0x3c1c43['where'](_0x10f1af(_0xabac0f[_0x537a('0x80')][_0x537a('0x69')]));}_0x7d1805=_0x3c1c43[_0x537a('0x90')]();_0x3c1c43[_0x537a('0x1e')](_0x2ff464);_0x3c1c43['offset'](0x0);return;}})['then'](function(){if(_0x954afe[_0x537a('0x91')]==='web'){return null;}var _0xf8c42=_['merge'](_0x954afe,{'name':_0x954afe['fullPath']||_0x954afe[_0x537a('0x2d')]||_0xabac0f['name'],'basename':_0x106f85,'savename':util[_0x537a('0x75')](_0x537a('0x92'),_0x954afe['name']||_0xabac0f['name'],require(_0x537a('0x93'))[_0x537a('0x94')](0x4),_0x954afe['output']||_0x537a('0x95')),'reportId':_0xabac0f['id'],'reportType':_0x537a('0x96')});return db[_0x537a('0x97')]['create'](_0xf8c42,{'raw':!![]});})[_0x537a('0x26')](function(_0x4cdf8d){if(_0xabac0f[_0x537a('0x7f')]===_0x537a('0x98')){_0x7d1805[_0x537a('0x3b')](_0xabac0f[_0x537a('0x7f')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x954afe[_0x537a('0x99')],_0x954afe[_0x537a('0x9a')]);}else{_0x7d1805[_0x537a('0x3b')](_0xabac0f[_0x537a('0x7f')]+_0x537a('0x9b'),_0x954afe[_0x537a('0x99')],_0x954afe[_0x537a('0x9a')]);}if(_0x4cdf8d){logger[_0x537a('0x9c')](_0x537a('0x9d'),_0x7d1805[_0x537a('0x82')]());require(_0x537a('0x9e'))['fork'](path[_0x537a('0x55')](__dirname,_0x537a('0x9f'),_0x4cdf8d[_0x537a('0x91')]),[_0x4cdf8d['id'],_0x7d1805[_0x537a('0x82')](),path[_0x537a('0x55')](__dirname,_0x537a('0xa0'),_0x4cdf8d[_0x537a('0xa1')]),_0x106f85]);return _0x4cdf8d;}else{var _0x429c76=squel[_0x537a('0x71')]();_0x429c76[_0x537a('0x8d')]('('+_0x7d1805['toString']()+')','countTable');_0x429c76[_0x537a('0x6a')](_0x537a('0xa2'),_0x537a('0x20'));_0x7d1805[_0x537a('0x1e')](_0x954afe['limit']||_0x2ff464);_0x7d1805[_0x537a('0x1d')](_0x954afe[_0x537a('0x1d')]||0x0);return dbH[_0x537a('0x83')][_0x537a('0x32')](_0x429c76[_0x537a('0x82')](),{'type':dbH[_0x537a('0x83')][_0x537a('0x84')][_0x537a('0x85')]})[_0x537a('0x26')](function(_0x3aa15b){if(!_0x3aa15b['length']){_0xc05e6e=0x0;}else{_0xc05e6e=_0x3aa15b[0x0][_0x537a('0x20')]||0x0;}return dbH[_0x537a('0x83')][_0x537a('0x32')](_0x7d1805[_0x537a('0x82')](),{'type':dbH[_0x537a('0x83')][_0x537a('0x84')][_0x537a('0x85')]});})['then'](function(_0x38649d){return{'rows':_0x38649d||[],'count':_0xc05e6e};});}});}exports[_0x537a('0xa3')]=function(_0x3a4cdf,_0x388d08){return runReport(_0x3a4cdf[_0x537a('0x49')],_0x3a4cdf[_0x537a('0x32')],_0x3a4cdf[_0x537a('0x43')])[_0x537a('0x26')](respondWithResult(_0x388d08,null))['catch'](handleError(_0x388d08,null));};exports[_0x537a('0xa4')]=runReport;exports[_0x537a('0x32')]=function(_0x24a318,_0x124ed8){var _0xfca19=0xa;var _0x5b31c0=[_0x537a('0x55'),_0x537a('0x56'),_0x537a('0x57'),_0x537a('0x58')];var _0x51f7bc={'SUM':_0x537a('0x59'),'COUNT':_0x537a('0x5a'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0x537a('0x5d'),'AVG':_0x537a('0x5e'),'GROUP_CONCAT':_0x537a('0x5f'),'GROUP_CONCAT ASC':_0x537a('0x60'),'GROUP_CONCAT DESC':_0x537a('0x61')};var _0xbab6bf={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x537a('0x62'),'HOUR':_0x537a('0x63'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x537a('0x64')};var _0x272158=function(_0x2ba6a5){return!_[_0x537a('0x65')]([_0x537a('0x66'),_0x537a('0x67'),'IS\x20EMPTY',_0x537a('0x88')],_0x2ba6a5);};var _0x1956b3=function(_0x154dd9){if(!_0x154dd9||!_0x154dd9['rules'][_0x537a('0x37')]){return'';}for(var _0x2a2134='(',_0x314f89=0x0;_0x314f89<_0x154dd9[_0x537a('0x68')][_0x537a('0x37')];_0x314f89+=0x1){_0x314f89>0x0&&(_0x2a2134+='\x20'+_0x154dd9['operator']+'\x20');_0x2a2134+=_0x154dd9[_0x537a('0x68')][_0x314f89][_0x537a('0x69')]?_0x1956b3(_0x154dd9[_0x537a('0x68')][_0x314f89][_0x537a('0x69')]):_0x154dd9[_0x537a('0x68')][_0x314f89]['field']+'\x20'+_0x154dd9['rules'][_0x314f89][_0x537a('0x6b')]+(_0x272158(_0x154dd9[_0x537a('0x68')][_0x314f89]['condition'])?'\x20'+_0x154dd9[_0x537a('0x68')][_0x314f89][_0x537a('0x6c')]:'');}return _0x2a2134+')';};var _0x57e4b9={'where':{'id':_0x24a318[_0x537a('0x49')]['id']}},_0x4428d2,_0x36b628,_0x5a665,_0x1d1969,_0x255281;_0x57e4b9=_['merge']({},_0x57e4b9,_0x24a318[_0x537a('0x43')]);return db[_0x537a('0x45')][_0x537a('0x54')](_0x57e4b9)[_0x537a('0x26')](function(_0x2ba332){if(_0x2ba332){_0x4428d2=_0x2ba332;return _0x2ba332['getFields']();}return null;})[_0x537a('0x26')](function(_0x4bd79b){if(_0x4bd79b){if(!_0x4bd79b[_0x537a('0x37')]){throw new db[(_0x537a('0x6e'))]['ValidationErrorItem'](_0x537a('0x8a'),0x193);}_0x36b628=_0x4bd79b;return db[_0x537a('0x8b')][_0x537a('0x70')]({'raw':!![]});}return null;})[_0x537a('0x26')](function(_0x4498df){if(_0x4498df){_0x5a665=_[_0x537a('0x8c')](_0x4498df,'id');var _0x104224;var _0x3f76fd=squel['select']();_0x3f76fd[_0x537a('0x8d')](_0x4428d2['table']);for(var _0x316781=0x0;_0x316781<_0x36b628[_0x537a('0x37')];_0x316781+=0x1){_0x104224=_0x36b628[_0x316781][_0x537a('0x72')]?_0x5a665[_0x36b628[_0x316781][_0x537a('0x72')]][_0x537a('0x8e')]:_0x36b628[_0x316781][_0x537a('0x6a')];_0x104224=_0x36b628[_0x316781][_0x537a('0x74')]?_['replace'](_0x51f7bc[_0x36b628[_0x316781][_0x537a('0x74')]],'%s',_0x104224):_0x104224;_0x104224=_0x36b628[_0x316781]['format']?_[_0x537a('0x73')](_0xbab6bf[_0x36b628[_0x316781][_0x537a('0x75')]],'%s',_0x104224):_0x104224;if(_0x36b628[_0x316781][_0x537a('0x76')]){_0x3f76fd[_0x537a('0x69')](_0x104224);}_0x36b628[_0x316781][_0x537a('0x77')]&&_0x3f76fd['order'](_0x104224,_0x36b628[_0x316781]['orderBy']===_0x537a('0x78')?![]:!![]);_0x3f76fd['field'](_0x104224,_0x36b628[_0x316781]['alias']||_0x104224);}if(_0x4428d2['joins']){_0x4428d2[_0x537a('0x7a')]=JSON[_0x537a('0x7b')](_0x4428d2[_0x537a('0x7a')]);for(var _0x4e89e0=0x0;_0x4e89e0<_0x4428d2[_0x537a('0x7a')][_0x537a('0x37')];_0x4e89e0+=0x1){if(_0x4428d2[_0x537a('0x7a')][_0x4e89e0][_0x537a('0x41')]&&_['includes'](_0x5b31c0,_0x4428d2[_0x537a('0x7a')][_0x4e89e0][_0x537a('0x41')])&&_0x4428d2['joins'][_0x4e89e0]['parentKey']&&_0x4428d2['joins'][_0x4e89e0]['foreignTable']&&_0x4428d2['joins'][_0x4e89e0][_0x537a('0x7d')]){_0x3f76fd[_0x4428d2[_0x537a('0x7a')][_0x4e89e0]['type']](_0x4428d2[_0x537a('0x7a')][_0x4e89e0][_0x537a('0x7e')],null,util[_0x537a('0x75')]('%s.%s\x20=\x20%s.%s',_0x4428d2['table'],_0x4428d2['joins'][_0x4e89e0][_0x537a('0x7c')],_0x4428d2[_0x537a('0x7a')][_0x4e89e0]['foreignTable'],_0x4428d2['joins'][_0x4e89e0][_0x537a('0x7d')]));}}}if(_0x4428d2[_0x537a('0x80')]){_0x4428d2[_0x537a('0x80')]=JSON[_0x537a('0x7b')](_0x4428d2[_0x537a('0x80')]);_0x3f76fd[_0x537a('0x3b')](_0x1956b3(_0x4428d2['conditions']['group']));}_0x255281=_0x3f76fd[_0x537a('0x90')]();_0x3f76fd[_0x537a('0x1e')](_0xfca19);_0x3f76fd['offset'](0x0);logger[_0x537a('0x81')](_0x537a('0xa5'),_0x3f76fd[_0x537a('0x82')]());return dbH[_0x537a('0x83')][_0x537a('0x32')](_0x3f76fd[_0x537a('0x82')](),{'type':dbH[_0x537a('0x83')][_0x537a('0x84')][_0x537a('0x85')]});}})[_0x537a('0x26')](function(){return{'sql':_0x255281[_0x537a('0x82')]()};})[_0x537a('0x26')](respondWithResult(_0x124ed8,null))['catch'](handleError(_0x124ed8,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 0930ada..3052102 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 _0xd0ab=['moment','bluebird','request-promise','path','rimraf','./analyticCustomReport.attributes','exports','AnalyticCustomReport','lodash','util','../../config/logger','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd0ab,0x11c));var _0xbd0a=function(_0xb61664,_0x210075){_0xb61664=_0xb61664-0x0;var _0x46f78a=_0xd0ab[_0xb61664];return _0x46f78a;};'use strict';var _=require(_0xbd0a('0x0'));var util=require(_0xbd0a('0x1'));var logger=require(_0xbd0a('0x2'))(_0xbd0a('0x3'));var moment=require(_0xbd0a('0x4'));var BPromise=require(_0xbd0a('0x5'));var rp=require(_0xbd0a('0x6'));var fs=require('fs');var path=require(_0xbd0a('0x7'));var rimraf=require(_0xbd0a('0x8'));var config=require('../../config/environment');var attributes=require(_0xbd0a('0x9'));module[_0xbd0a('0xa')]=function(_0xc5b135,_0x59c923){return _0xc5b135['define'](_0xbd0a('0xb'),attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc1de=['rimraf','../../config/environment','define','AnalyticCustomReport','analytics_custom_reports','lodash','util','api','bluebird','path'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xc1de,0x16d));var _0xec1d=function(_0xc8ebf2,_0x52e902){_0xc8ebf2=_0xc8ebf2-0x0;var _0x3c5882=_0xc1de[_0xc8ebf2];return _0x3c5882;};'use strict';var _=require(_0xec1d('0x0'));var util=require(_0xec1d('0x1'));var logger=require('../../config/logger')(_0xec1d('0x2'));var moment=require('moment');var BPromise=require(_0xec1d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xec1d('0x4'));var rimraf=require(_0xec1d('0x5'));var config=require(_0xec1d('0x6'));var attributes=require('./analyticCustomReport.attributes');module['exports']=function(_0x103de9,_0x1e601f){return _0x103de9[_0xec1d('0x7')](_0xec1d('0x8'),attributes,{'tableName':_0xec1d('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 c18706d..151bb32 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 _0xfb5d=['client','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise'];(function(_0x179f4a,_0x4572d7){var _0xfafb29=function(_0x555a40){while(--_0x555a40){_0x179f4a['push'](_0x179f4a['shift']());}};_0xfafb29(++_0x4572d7);}(_0xfb5d,0x151));var _0xdfb5=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xfb5d[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0xdfb5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xdfb5('0x1'));var rs=require(_0xdfb5('0x2'));var fs=require('fs');var Redis=require(_0xdfb5('0x3'));var db=require(_0xdfb5('0x4'))['db'];var utils=require(_0xdfb5('0x5'));var logger=require('../../config/logger')(_0xdfb5('0x6'));var config=require('../../config/environment');var jayson=require(_0xdfb5('0x7'));var client=jayson[_0xdfb5('0x8')][_0xdfb5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x369d3f,_0x57366a,_0x578f47){return new BPromise(function(_0x2e103f,_0x3ac1a8){return client[_0xdfb5('0xa')](_0x369d3f,_0x578f47)[_0xdfb5('0xb')](function(_0x34757f){logger[_0xdfb5('0xc')](_0xdfb5('0xd'),_0x57366a,_0xdfb5('0xe'));logger[_0xdfb5('0xf')](_0xdfb5('0x10'),_0x57366a,_0xdfb5('0xe'),JSON[_0xdfb5('0x11')](_0x34757f));if(_0x34757f['error']){if(_0x34757f[_0xdfb5('0x12')][_0xdfb5('0x13')]===0x1f4){logger[_0xdfb5('0x12')](_0xdfb5('0xd'),_0x57366a,_0x34757f[_0xdfb5('0x12')][_0xdfb5('0x14')]);return _0x3ac1a8(_0x34757f[_0xdfb5('0x12')]['message']);}logger[_0xdfb5('0x12')]('AnalyticCustomReport,\x20%s,\x20%s',_0x57366a,_0x34757f[_0xdfb5('0x12')]['message']);return _0x2e103f(_0x34757f[_0xdfb5('0x12')][_0xdfb5('0x14')]);}else{logger[_0xdfb5('0xc')](_0xdfb5('0xd'),_0x57366a,_0xdfb5('0xe'));_0x2e103f(_0x34757f[_0xdfb5('0x15')][_0xdfb5('0x14')]);}})[_0xdfb5('0x16')](function(_0x573874){logger[_0xdfb5('0x12')](_0xdfb5('0xd'),_0x57366a,_0x573874);_0x3ac1a8(_0x573874);});});} \ No newline at end of file +var _0x3c51=['catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','AnalyticCustomReport,\x20%s,\x20%s','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info'];(function(_0x3ea41f,_0x337284){var _0x1fd181=function(_0x344efa){while(--_0x344efa){_0x3ea41f['push'](_0x3ea41f['shift']());}};_0x1fd181(++_0x337284);}(_0x3c51,0x79));var _0x13c5=function(_0x3c88a8,_0xa040d1){_0x3c88a8=_0x3c88a8-0x0;var _0x370cf6=_0x3c51[_0x3c88a8];return _0x370cf6;};'use strict';var _=require(_0x13c5('0x0'));var util=require(_0x13c5('0x1'));var moment=require(_0x13c5('0x2'));var BPromise=require(_0x13c5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x13c5('0x4'));var db=require(_0x13c5('0x5'))['db'];var utils=require(_0x13c5('0x6'));var logger=require(_0x13c5('0x7'))(_0x13c5('0x8'));var config=require(_0x13c5('0x9'));var jayson=require(_0x13c5('0xa'));var client=jayson[_0x13c5('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x13ee75,_0x28cb2c,_0x3e6212){return new BPromise(function(_0x367b6f,_0x5e48ef){return client[_0x13c5('0xc')](_0x13ee75,_0x3e6212)[_0x13c5('0xd')](function(_0x557e64){logger['info'](_0x13c5('0xe'),_0x28cb2c,'request\x20sent');logger[_0x13c5('0xf')](_0x13c5('0x10'),_0x28cb2c,_0x13c5('0x11'),JSON[_0x13c5('0x12')](_0x557e64));if(_0x557e64[_0x13c5('0x13')]){if(_0x557e64['error'][_0x13c5('0x14')]===0x1f4){logger[_0x13c5('0x13')](_0x13c5('0xe'),_0x28cb2c,_0x557e64[_0x13c5('0x13')][_0x13c5('0x15')]);return _0x5e48ef(_0x557e64[_0x13c5('0x13')]['message']);}logger[_0x13c5('0x13')]('AnalyticCustomReport,\x20%s,\x20%s',_0x28cb2c,_0x557e64[_0x13c5('0x13')][_0x13c5('0x15')]);return _0x367b6f(_0x557e64[_0x13c5('0x13')][_0x13c5('0x15')]);}else{logger[_0x13c5('0x16')](_0x13c5('0xe'),_0x28cb2c,_0x13c5('0x11'));_0x367b6f(_0x557e64['result'][_0x13c5('0x15')]);}})[_0x13c5('0x17')](function(_0x13567d){logger[_0x13c5('0x13')](_0x13c5('0xe'),_0x28cb2c,_0x13567d);_0x5e48ef(_0x13567d);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 50be486..8d5ad48 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 _0x04b0=['../../components/interaction/service','./analyticCustomReport.controller','isAuthenticated','index','get','show','/:id/preview','preview','/:id/run','/:id/query','query','post','put','/:id','destroy','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x38cc49,_0x4c5995){var _0x2288f1=function(_0x1bd2f4){while(--_0x1bd2f4){_0x38cc49['push'](_0x38cc49['shift']());}};_0x2288f1(++_0x4c5995);}(_0x04b0,0x8d));var _0x004b=function(_0x21f14b,_0x8db9c7){_0x21f14b=_0x21f14b-0x0;var _0x242523=_0x04b0[_0x21f14b];return _0x242523;};'use strict';var multer=require(_0x004b('0x0'));var util=require(_0x004b('0x1'));var path=require('path');var timeout=require(_0x004b('0x2'));var express=require('express');var router=express[_0x004b('0x3')]();var fs_extra=require(_0x004b('0x4'));var auth=require(_0x004b('0x5'));var interaction=require(_0x004b('0x6'));var config=require('../../config/environment');var controller=require(_0x004b('0x7'));router['get']('/',auth[_0x004b('0x8')](),controller[_0x004b('0x9')]);router[_0x004b('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x004b('0xb')]);router['get'](_0x004b('0xc'),auth['isAuthenticated'](),controller[_0x004b('0xd')]);router[_0x004b('0xa')](_0x004b('0xe'),auth[_0x004b('0x8')](),controller['run']);router[_0x004b('0xa')](_0x004b('0xf'),auth['isAuthenticated'](),controller[_0x004b('0x10')]);router[_0x004b('0x11')]('/',auth[_0x004b('0x8')](),controller['create']);router[_0x004b('0x12')](_0x004b('0x13'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x004b('0x13'),auth[_0x004b('0x8')](),controller[_0x004b('0x14')]);module['exports']=router; \ No newline at end of file +var _0x56f0=['update','delete','/:id','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','show','/:id/preview','preview','/:id/run','query','post','create','put'];(function(_0x4ae829,_0x2c842c){var _0x256b31=function(_0x34f104){while(--_0x34f104){_0x4ae829['push'](_0x4ae829['shift']());}};_0x256b31(++_0x2c842c);}(_0x56f0,0xdd));var _0x056f=function(_0x345705,_0x2829c1){_0x345705=_0x345705-0x0;var _0x22c250=_0x56f0[_0x345705];return _0x22c250;};'use strict';var multer=require(_0x056f('0x0'));var util=require('util');var path=require(_0x056f('0x1'));var timeout=require(_0x056f('0x2'));var express=require('express');var router=express[_0x056f('0x3')]();var fs_extra=require(_0x056f('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x056f('0x5'));var config=require(_0x056f('0x6'));var controller=require(_0x056f('0x7'));router[_0x056f('0x8')]('/',auth[_0x056f('0x9')](),controller[_0x056f('0xa')]);router[_0x056f('0x8')]('/:id',auth[_0x056f('0x9')](),controller[_0x056f('0xb')]);router[_0x056f('0x8')](_0x056f('0xc'),auth[_0x056f('0x9')](),controller[_0x056f('0xd')]);router['get'](_0x056f('0xe'),auth['isAuthenticated'](),controller['run']);router[_0x056f('0x8')]('/:id/query',auth[_0x056f('0x9')](),controller[_0x056f('0xf')]);router[_0x056f('0x10')]('/',auth['isAuthenticated'](),controller[_0x056f('0x11')]);router[_0x056f('0x12')]('/:id',auth[_0x056f('0x9')](),controller[_0x056f('0x13')]);router[_0x056f('0x14')](_0x056f('0x15'),auth[_0x056f('0x9')](),controller[_0x056f('0x16')]);module[_0x056f('0x17')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 62fdf7d..2adee4a 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 _0x7c09=['exports','STRING','TEXT'];(function(_0x34dd1c,_0x22922f){var _0xe547b0=function(_0x4fa055){while(--_0x4fa055){_0x34dd1c['push'](_0x34dd1c['shift']());}};_0xe547b0(++_0x22922f);}(_0x7c09,0x102));var _0x97c0=function(_0x513a6a,_0x5909ec){_0x513a6a=_0x513a6a-0x0;var _0x16ea12=_0x7c09[_0x513a6a];return _0x16ea12;};'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 +var _0xabce=['exports','STRING','TEXT','sequelize'];(function(_0x4f1704,_0x589482){var _0x5208f1=function(_0x470940){while(--_0x470940){_0x4f1704['push'](_0x4f1704['shift']());}};_0x5208f1(++_0x589482);}(_0xabce,0x103));var _0xeabc=function(_0x20c9b2,_0x55d7b1){_0x20c9b2=_0x20c9b2-0x0;var _0x2c6030=_0xabce[_0x20c9b2];return _0x2c6030;};'use strict';var Sequelize=require(_0xeabc('0x0'));module[_0xeabc('0x1')]={'name':{'type':Sequelize[_0xeabc('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xeabc('0x2')]},'parent':{'type':Sequelize[_0xeabc('0x2')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xeabc('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 89abb3a..c869fb2 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 _0x4975=['set','Content-Range','save','update','then','destroy','get','DefaultReports','UserProfileResource','error','stack','name','index','AnalyticDefaultReport','rawAttributes','type','key','map','query','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','keys','find','body','role','user','Reports','UserProfileSection','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','SUM(%s)','COUNT(%s)','MAX(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','value','Sequelize','ValidationErrorItem','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','format','groupBy','orderBy','DESC','joins','includes','parentKey','foreignKey','foreignTable','conditions','parse','debug','Limited\x20Query:','sequelize','QueryTypes','SELECT','left_join','COUNT(DISTINCT\x20%s)','MIN(%s)','AVG(%s)','HOUR(%s)','operator','Please\x20insert\x20at\x20least\x20one\x20field','alias','%s.%s\x20=\x20%s.%s','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','toString','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','run','runReport','cross_join','getFields','replace','clone','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','count','limit'];(function(_0x2bee8e,_0x2aca67){var _0x164795=function(_0x244b63){while(--_0x244b63){_0x2bee8e['push'](_0x2bee8e['shift']());}};_0x164795(++_0x2aca67);}(_0x4975,0x86));var _0x5497=function(_0x331956,_0x2d6b58){_0x331956=_0x331956-0x0;var _0x3ebe55=_0x4975[_0x331956];return _0x3ebe55;};'use strict';var emlformat=require(_0x5497('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5497('0x1'));var jsonpatch=require(_0x5497('0x2'));var rp=require(_0x5497('0x3'));var moment=require(_0x5497('0x4'));var BPromise=require(_0x5497('0x5'));var Mustache=require(_0x5497('0x6'));var util=require(_0x5497('0x7'));var path=require(_0x5497('0x8'));var sox=require(_0x5497('0x9'));var csv=require(_0x5497('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5497('0xb'));var _=require('lodash');var squel=require(_0x5497('0xc'));var crypto=require(_0x5497('0xd'));var jsforce=require(_0x5497('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5497('0xa'));var querystring=require('querystring');var Papa=require(_0x5497('0xf'));var Redis=require(_0x5497('0x10'));var authService=require(_0x5497('0x11'));var qs=require(_0x5497('0x12'));var as=require(_0x5497('0x13'));var hardwareService=require(_0x5497('0x14'));var logger=require(_0x5497('0x15'))(_0x5497('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5497('0x17'))['db'];var dbH=require(_0x5497('0x17'))[_0x5497('0x18')];function respondWithStatusCode(_0x984990,_0x747dc7){_0x747dc7=_0x747dc7||0xcc;return function(_0x365144){if(_0x365144){return _0x984990[_0x5497('0x19')](_0x747dc7);}return _0x984990[_0x5497('0x1a')](_0x747dc7)[_0x5497('0x1b')]();};}function respondWithResult(_0x1a4c74,_0x55f590){_0x55f590=_0x55f590||0xc8;return function(_0x11b0a9){if(_0x11b0a9){return _0x1a4c74['status'](_0x55f590)[_0x5497('0x1c')](_0x11b0a9);}};}function respondWithFilteredResult(_0x2bfd8a,_0x19e5f3){return function(_0x3ce50b){if(_0x3ce50b){var _0x37c18e=typeof _0x19e5f3[_0x5497('0x1d')]===_0x5497('0x1e')&&typeof _0x19e5f3['limit']==='undefined';var _0x3f4d20=_0x3ce50b[_0x5497('0x1f')];var _0x3a47fd=_0x37c18e?0x0:_0x19e5f3['offset'];var _0xbf1ba7=_0x37c18e?_0x3ce50b[_0x5497('0x1f')]:_0x19e5f3[_0x5497('0x1d')]+_0x19e5f3[_0x5497('0x20')];var _0x1b1b43;if(_0xbf1ba7>=_0x3f4d20){_0xbf1ba7=_0x3f4d20;_0x1b1b43=0xc8;}else{_0x1b1b43=0xce;}_0x2bfd8a[_0x5497('0x1a')](_0x1b1b43);return _0x2bfd8a[_0x5497('0x21')](_0x5497('0x22'),_0x3a47fd+'-'+_0xbf1ba7+'/'+_0x3f4d20)[_0x5497('0x1c')](_0x3ce50b);}return null;};}function patchUpdates(_0x3f54ef){return function(_0x186065){try{jsonpatch['apply'](_0x186065,_0x3f54ef,!![]);}catch(_0x720767){return BPromise['reject'](_0x720767);}return _0x186065[_0x5497('0x23')]();};}function saveUpdates(_0xd0868d,_0x44265c){return function(_0x2f587d){if(_0x2f587d){return _0x2f587d[_0x5497('0x24')](_0xd0868d)[_0x5497('0x25')](function(_0x5018fa){return _0x5018fa;});}return null;};}function removeEntity(_0x54043a,_0x1eefce){return function(_0x34b97f){if(_0x34b97f){return _0x34b97f[_0x5497('0x26')]()[_0x5497('0x25')](function(){var _0x5223b5=_0x34b97f[_0x5497('0x27')]({'plain':!![]});var _0x57268c=_0x5497('0x28');return db[_0x5497('0x29')][_0x5497('0x26')]({'where':{'type':_0x57268c,'resourceId':_0x5223b5['id']}})[_0x5497('0x25')](function(){return _0x34b97f;});})[_0x5497('0x25')](function(){_0x54043a[_0x5497('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4af5f4,_0x5406e2){return function(_0x583d06){if(!_0x583d06){_0x4af5f4['sendStatus'](0x194);}return _0x583d06;};}function handleError(_0x39a2b7,_0x48d146){_0x48d146=_0x48d146||0x1f4;return function(_0x5e9356){logger[_0x5497('0x2a')](_0x5e9356[_0x5497('0x2b')]);if(_0x5e9356[_0x5497('0x2c')]){delete _0x5e9356['name'];}_0x39a2b7['status'](_0x48d146)['send'](_0x5e9356);};}exports[_0x5497('0x2d')]=function(_0x471e0b,_0xf4c117){var _0x5b8f79={},_0x489f71={},_0x594866={'count':0x0,'rows':[]};var _0xa28dd8=_['map'](db[_0x5497('0x2e')][_0x5497('0x2f')],function(_0x77c575){return{'name':_0x77c575['fieldName'],'type':_0x77c575[_0x5497('0x30')][_0x5497('0x31')]};});_0x489f71['model']=_[_0x5497('0x32')](_0xa28dd8,_0x5497('0x2c'));_0x489f71[_0x5497('0x33')]=_['keys'](_0x471e0b[_0x5497('0x33')]);_0x489f71[_0x5497('0x34')]=_[_0x5497('0x35')](_0x489f71[_0x5497('0x36')],_0x489f71[_0x5497('0x33')]);_0x5b8f79['attributes']=_[_0x5497('0x35')](_0x489f71[_0x5497('0x36')],qs['fields'](_0x471e0b[_0x5497('0x33')][_0x5497('0x37')]));_0x5b8f79[_0x5497('0x38')]=_0x5b8f79[_0x5497('0x38')][_0x5497('0x39')]?_0x5b8f79[_0x5497('0x38')]:_0x489f71['model'];if(!_0x471e0b[_0x5497('0x33')]['hasOwnProperty'](_0x5497('0x3a'))){_0x5b8f79[_0x5497('0x20')]=qs[_0x5497('0x20')](_0x471e0b['query']['limit']);_0x5b8f79[_0x5497('0x1d')]=qs[_0x5497('0x1d')](_0x471e0b[_0x5497('0x33')][_0x5497('0x1d')]);}_0x5b8f79[_0x5497('0x3b')]=qs[_0x5497('0x3c')](_0x471e0b['query'][_0x5497('0x3c')]);_0x5b8f79[_0x5497('0x3d')]=qs[_0x5497('0x34')](_[_0x5497('0x3e')](_0x471e0b[_0x5497('0x33')],_0x489f71[_0x5497('0x34')]),_0xa28dd8);if(_0x471e0b[_0x5497('0x33')][_0x5497('0x3f')]){_0x5b8f79[_0x5497('0x3d')]=_['merge'](_0x5b8f79[_0x5497('0x3d')],{'$or':_[_0x5497('0x32')](_0xa28dd8,function(_0x1e9616){if(_0x1e9616[_0x5497('0x30')]!==_0x5497('0x40')){var _0xa5ebe6={};_0xa5ebe6[_0x1e9616[_0x5497('0x2c')]]={'$like':'%'+_0x471e0b['query'][_0x5497('0x3f')]+'%'};return _0xa5ebe6;}})});}_0x5b8f79=_[_0x5497('0x41')]({},_0x5b8f79,_0x471e0b[_0x5497('0x42')]);var _0x35993c={'where':_0x5b8f79[_0x5497('0x3d')]};return db[_0x5497('0x2e')][_0x5497('0x1f')](_0x35993c)['then'](function(_0x2137bd){_0x594866[_0x5497('0x1f')]=_0x2137bd;if(_0x471e0b[_0x5497('0x33')][_0x5497('0x43')]){_0x5b8f79[_0x5497('0x44')]=[{'all':!![]}];}return db[_0x5497('0x2e')][_0x5497('0x45')](_0x5b8f79);})[_0x5497('0x25')](function(_0x2021ae){_0x594866[_0x5497('0x46')]=_0x2021ae;return _0x594866;})['then'](respondWithFilteredResult(_0xf4c117,_0x5b8f79))[_0x5497('0x47')](handleError(_0xf4c117,null));};exports['show']=function(_0x40822a,_0x9fc24){var _0x26ef01={'raw':!![],'where':{'id':_0x40822a[_0x5497('0x48')]['id']}},_0x3602ec={};_0x3602ec['model']=_[_0x5497('0x49')](db[_0x5497('0x2e')]['rawAttributes']);_0x3602ec[_0x5497('0x33')]=_['keys'](_0x40822a[_0x5497('0x33')]);_0x3602ec['filters']=_[_0x5497('0x35')](_0x3602ec[_0x5497('0x36')],_0x3602ec[_0x5497('0x33')]);_0x26ef01[_0x5497('0x38')]=_[_0x5497('0x35')](_0x3602ec['model'],qs['fields'](_0x40822a['query']['fields']));_0x26ef01[_0x5497('0x38')]=_0x26ef01[_0x5497('0x38')][_0x5497('0x39')]?_0x26ef01[_0x5497('0x38')]:_0x3602ec[_0x5497('0x36')];if(_0x40822a[_0x5497('0x33')][_0x5497('0x43')]){_0x26ef01[_0x5497('0x44')]=[{'all':!![]}];}_0x26ef01=_[_0x5497('0x41')]({},_0x26ef01,_0x40822a['options']);return db[_0x5497('0x2e')][_0x5497('0x4a')](_0x26ef01)[_0x5497('0x25')](handleEntityNotFound(_0x9fc24,null))['then'](respondWithResult(_0x9fc24,null))[_0x5497('0x47')](handleError(_0x9fc24,null));};exports['create']=function(_0x12ffbc,_0x31f1ba){return db[_0x5497('0x2e')]['create'](_0x12ffbc[_0x5497('0x4b')],{})[_0x5497('0x25')](function(_0x515c3e){var _0x3abc92=_0x12ffbc['user'][_0x5497('0x27')]({'plain':!![]});if(!_0x3abc92)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3abc92[_0x5497('0x4c')]===_0x5497('0x4d')){var _0x26fd9f=_0x515c3e[_0x5497('0x27')]({'plain':!![]});var _0x25e80c=_0x5497('0x4e');return db[_0x5497('0x4f')][_0x5497('0x4a')]({'where':{'name':_0x25e80c,'userProfileId':_0x3abc92['userProfileId']},'raw':!![]})[_0x5497('0x25')](function(_0x5b2c22){if(_0x5b2c22&&_0x5b2c22['autoAssociation']===0x0){return db[_0x5497('0x29')][_0x5497('0x50')]({'name':_0x26fd9f['name'],'resourceId':_0x26fd9f['id'],'type':_0x5497('0x28'),'sectionId':_0x5b2c22['id']},{})[_0x5497('0x25')](function(){return _0x515c3e;});}else{return _0x515c3e;}})[_0x5497('0x47')](function(_0x3094c7){logger['error'](_0x5497('0x51'),_0x3094c7);throw _0x3094c7;});}return _0x515c3e;})['then'](respondWithResult(_0x31f1ba,0xc9))['catch'](handleError(_0x31f1ba,null));};exports[_0x5497('0x24')]=function(_0x33dd07,_0x2f7ec8){if(_0x33dd07['body']['id']){delete _0x33dd07['body']['id'];}return db[_0x5497('0x2e')]['find']({'where':{'id':_0x33dd07[_0x5497('0x48')]['id']}})['then'](handleEntityNotFound(_0x2f7ec8,null))[_0x5497('0x25')](saveUpdates(_0x33dd07['body'],null))[_0x5497('0x25')](respondWithResult(_0x2f7ec8,null))[_0x5497('0x47')](handleError(_0x2f7ec8,null));};exports['destroy']=function(_0x418f17,_0x5dccfb){return db['AnalyticDefaultReport'][_0x5497('0x4a')]({'where':{'id':_0x418f17[_0x5497('0x48')]['id']}})['then'](handleEntityNotFound(_0x5dccfb,null))[_0x5497('0x25')](removeEntity(_0x5dccfb,null))[_0x5497('0x47')](handleError(_0x5dccfb,null));};exports[_0x5497('0x52')]=function(_0x28b2a3,_0x3fca40){var _0x25c75e=0xa;var _0x590be7=[_0x5497('0x53'),'left_join','right_join','cross_join'];var _0x1f3965={'SUM':_0x5497('0x54'),'COUNT':_0x5497('0x55'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x5497('0x56'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x5497('0x57'),'GROUP_CONCAT ASC':_0x5497('0x58'),'GROUP_CONCAT DESC':_0x5497('0x59')};var _0x25f349={'SEC_TO_TIME':_0x5497('0x5a'),'DATE':_0x5497('0x5b'),'HOUR':'HOUR(%s)','ROUND':_0x5497('0x5c'),'UNIX_TIMESTAMP':_0x5497('0x5d')};var _0x425995=function(_0xc783ce){return!_['includes']([_0x5497('0x5e'),_0x5497('0x5f'),_0x5497('0x60'),_0x5497('0x61')],_0xc783ce);};var _0x5823f6=function(_0x31271c){if(!_0x31271c||!_0x31271c[_0x5497('0x62')][_0x5497('0x39')]){return'';}for(var _0x542bcf='(',_0x1ab48f=0x0;_0x1ab48f<_0x31271c['rules']['length'];_0x1ab48f+=0x1){_0x1ab48f>0x0&&(_0x542bcf+='\x20'+_0x31271c['operator']+'\x20');_0x542bcf+=_0x31271c[_0x5497('0x62')][_0x1ab48f][_0x5497('0x63')]?_0x5823f6(_0x31271c[_0x5497('0x62')][_0x1ab48f]['group']):_0x31271c[_0x5497('0x62')][_0x1ab48f][_0x5497('0x64')]+'\x20'+_0x31271c[_0x5497('0x62')][_0x1ab48f][_0x5497('0x65')]+(_0x425995(_0x31271c['rules'][_0x1ab48f][_0x5497('0x65')])?'\x20'+_0x31271c[_0x5497('0x62')][_0x1ab48f][_0x5497('0x66')]:'');}return _0x542bcf+')';};var _0x49617c={'where':{'id':_0x28b2a3[_0x5497('0x48')]['id']}},_0x164de1,_0x465bed,_0xb3eec2,_0x4368e3,_0x1467c4;_0x49617c=_[_0x5497('0x41')]({},_0x49617c,_0x28b2a3['options']);return db[_0x5497('0x2e')][_0x5497('0x4a')](_0x49617c)[_0x5497('0x25')](function(_0x20efea){if(_0x20efea){_0x164de1=_0x20efea;return _0x20efea['getFields']();}return null;})['then'](function(_0x4a7360){if(_0x4a7360){if(!_0x4a7360[_0x5497('0x39')]){throw new db[(_0x5497('0x67'))][(_0x5497('0x68'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x465bed=_0x4a7360;return db[_0x5497('0x69')][_0x5497('0x45')]({'raw':!![]});}return null;})[_0x5497('0x25')](function(_0x464df3){if(_0x464df3){_0xb3eec2=_[_0x5497('0x6a')](_0x464df3,'id');var _0x4338d4;var _0x3f38bf=squel[_0x5497('0x6b')]();_0x3f38bf[_0x5497('0x6c')](_0x164de1[_0x5497('0x6d')]);for(var _0x1fc6ad=0x0;_0x1fc6ad<_0x465bed['length'];_0x1fc6ad+=0x1){_0x4338d4=_0x465bed[_0x1fc6ad][_0x5497('0x6e')]?_0xb3eec2[_0x465bed[_0x1fc6ad][_0x5497('0x6e')]][_0x5497('0x6f')]:_0x465bed[_0x1fc6ad]['field'];_0x4338d4=_0x465bed[_0x1fc6ad][_0x5497('0x70')]?_['replace'](_0x1f3965[_0x465bed[_0x1fc6ad][_0x5497('0x70')]],'%s',_0x4338d4):_0x4338d4;_0x4338d4=_0x465bed[_0x1fc6ad][_0x5497('0x71')]?_['replace'](_0x25f349[_0x465bed[_0x1fc6ad][_0x5497('0x71')]],'%s',_0x4338d4):_0x4338d4;if(_0x465bed[_0x1fc6ad][_0x5497('0x72')]){_0x3f38bf[_0x5497('0x63')](_0x4338d4);}_0x465bed[_0x1fc6ad][_0x5497('0x73')]&&_0x3f38bf['order'](_0x4338d4,_0x465bed[_0x1fc6ad][_0x5497('0x73')]===_0x5497('0x74')?![]:!![]);_0x3f38bf[_0x5497('0x64')](_0x4338d4,_0x465bed[_0x1fc6ad]['alias']||_0x4338d4);}if(_0x164de1[_0x5497('0x75')]){_0x164de1[_0x5497('0x75')]=JSON['parse'](_0x164de1[_0x5497('0x75')]);for(var _0xebe694=0x0;_0xebe694<_0x164de1[_0x5497('0x75')]['length'];_0xebe694+=0x1){if(_0x164de1['joins'][_0xebe694][_0x5497('0x30')]&&_[_0x5497('0x76')](_0x590be7,_0x164de1[_0x5497('0x75')][_0xebe694][_0x5497('0x30')])&&_0x164de1[_0x5497('0x75')][_0xebe694][_0x5497('0x77')]&&_0x164de1[_0x5497('0x75')][_0xebe694]['foreignTable']&&_0x164de1['joins'][_0xebe694][_0x5497('0x78')]){_0x3f38bf[_0x164de1[_0x5497('0x75')][_0xebe694]['type']](_0x164de1[_0x5497('0x75')][_0xebe694][_0x5497('0x79')],null,util[_0x5497('0x71')]('%s.%s\x20=\x20%s.%s',_0x164de1[_0x5497('0x6d')],_0x164de1[_0x5497('0x75')][_0xebe694]['parentKey'],_0x164de1[_0x5497('0x75')][_0xebe694][_0x5497('0x79')],_0x164de1[_0x5497('0x75')][_0xebe694][_0x5497('0x78')]));}}}if(_0x164de1[_0x5497('0x7a')]){_0x164de1['conditions']=JSON[_0x5497('0x7b')](_0x164de1[_0x5497('0x7a')]);_0x3f38bf[_0x5497('0x3d')](_0x5823f6(_0x164de1[_0x5497('0x7a')][_0x5497('0x63')]));}_0x1467c4=_0x3f38bf['clone']();_0x3f38bf[_0x5497('0x20')](_0x25c75e);_0x3f38bf[_0x5497('0x1d')](0x0);logger[_0x5497('0x7c')](_0x5497('0x7d'),_0x3f38bf['toString']());return dbH[_0x5497('0x7e')][_0x5497('0x33')](_0x3f38bf['toString'](),{'type':dbH[_0x5497('0x7e')][_0x5497('0x7f')][_0x5497('0x80')]});}})[_0x5497('0x25')](respondWithResult(_0x3fca40,null))['catch'](handleError(_0x3fca40,null));};function runReport(_0x547de7,_0x4ff64f,_0x5343d5){var _0x594761=_0x4ff64f[_0x5497('0x2c')];var _0x2375cc=0xa;var _0x15d0da=[_0x5497('0x53'),_0x5497('0x81'),'right_join','cross_join'];var _0x392987={'SUM':_0x5497('0x54'),'COUNT':_0x5497('0x55'),'COUNT DISTINCT':_0x5497('0x82'),'MAX':_0x5497('0x56'),'MIN':_0x5497('0x83'),'AVG':_0x5497('0x84'),'GROUP_CONCAT':_0x5497('0x57'),'GROUP_CONCAT ASC':_0x5497('0x58'),'GROUP_CONCAT DESC':_0x5497('0x59')};var _0x4c41c4={'SEC_TO_TIME':_0x5497('0x5a'),'DATE':_0x5497('0x5b'),'HOUR':_0x5497('0x85'),'ROUND':_0x5497('0x5c'),'UNIX_TIMESTAMP':_0x5497('0x5d')};var _0x22b019=function(_0x4aa4ba){return!_[_0x5497('0x76')](['IS\x20NULL',_0x5497('0x5f'),_0x5497('0x60'),_0x5497('0x61')],_0x4aa4ba);};var _0x5b0f9d=function(_0x59960b){if(!_0x59960b||!_0x59960b[_0x5497('0x62')][_0x5497('0x39')]){return'';}for(var _0x953b31='(',_0xeb52c9=0x0;_0xeb52c9<_0x59960b[_0x5497('0x62')][_0x5497('0x39')];_0xeb52c9+=0x1){_0xeb52c9>0x0&&(_0x953b31+='\x20'+_0x59960b[_0x5497('0x86')]+'\x20');_0x953b31+=_0x59960b[_0x5497('0x62')][_0xeb52c9]['group']?_0x5b0f9d(_0x59960b['rules'][_0xeb52c9]['group']):_0x59960b[_0x5497('0x62')][_0xeb52c9][_0x5497('0x64')]+'\x20'+_0x59960b[_0x5497('0x62')][_0xeb52c9][_0x5497('0x65')]+(_0x22b019(_0x59960b['rules'][_0xeb52c9]['condition'])?'\x20'+_0x59960b[_0x5497('0x62')][_0xeb52c9][_0x5497('0x66')]:'');}return _0x953b31+')';};var _0x5dd9bc={'where':{'id':_0x547de7['id']}},_0x83b240,_0x2fc11a,_0x3ce2ee,_0x36c09f,_0x51e9fb;_0x5dd9bc=_['merge']({},_0x5dd9bc,_0x5343d5);return db['AnalyticDefaultReport']['find'](_0x5dd9bc)['then'](function(_0x497295){if(_0x497295){_0x83b240=_0x497295;return _0x497295['getFields']();}return null;})[_0x5497('0x25')](function(_0x5aa5e1){if(_0x5aa5e1){if(!_0x5aa5e1[_0x5497('0x39')]){throw new db[(_0x5497('0x67'))][(_0x5497('0x68'))](_0x5497('0x87'),0x193);}_0x2fc11a=_0x5aa5e1;return db[_0x5497('0x69')][_0x5497('0x45')]({'raw':!![]});}return null;})['then'](function(_0x77d52c){if(_0x77d52c){_0x3ce2ee=_['keyBy'](_0x77d52c,'id');var _0x15a67d;var _0x2721b2=squel[_0x5497('0x6b')]();_0x2721b2[_0x5497('0x6c')](_0x83b240[_0x5497('0x6d')]);for(var _0x38fa59=0x0;_0x38fa59<_0x2fc11a[_0x5497('0x39')];_0x38fa59+=0x1){_0x15a67d=_0x2fc11a[_0x38fa59][_0x5497('0x6e')]?_0x3ce2ee[_0x2fc11a[_0x38fa59][_0x5497('0x6e')]][_0x5497('0x6f')]:_0x2fc11a[_0x38fa59]['field'];_0x15a67d=_0x2fc11a[_0x38fa59][_0x5497('0x70')]?_['replace'](_0x392987[_0x2fc11a[_0x38fa59][_0x5497('0x70')]],'%s',_0x15a67d):_0x15a67d;_0x15a67d=_0x2fc11a[_0x38fa59][_0x5497('0x71')]?_['replace'](_0x4c41c4[_0x2fc11a[_0x38fa59][_0x5497('0x71')]],'%s',_0x15a67d):_0x15a67d;if(_0x2fc11a[_0x38fa59][_0x5497('0x72')]){_0x2721b2[_0x5497('0x63')](_0x15a67d);}_0x2fc11a[_0x38fa59][_0x5497('0x73')]&&_0x2721b2[_0x5497('0x3b')](_0x15a67d,_0x2fc11a[_0x38fa59][_0x5497('0x73')]===_0x5497('0x74')?![]:!![]);_0x2721b2[_0x5497('0x64')](_0x15a67d,_0x2fc11a[_0x38fa59][_0x5497('0x88')]||_0x15a67d);}if(_0x83b240[_0x5497('0x75')]){_0x83b240[_0x5497('0x75')]=JSON[_0x5497('0x7b')](_0x83b240[_0x5497('0x75')]);for(var _0x22426e=0x0;_0x22426e<_0x83b240['joins'][_0x5497('0x39')];_0x22426e+=0x1){if(_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x30')]&&_[_0x5497('0x76')](_0x15d0da,_0x83b240[_0x5497('0x75')][_0x22426e]['type'])&&_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x77')]&&_0x83b240['joins'][_0x22426e]['foreignTable']&&_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x78')]){_0x2721b2[_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x30')]](_0x83b240[_0x5497('0x75')][_0x22426e]['foreignTable'],null,util['format'](_0x5497('0x89'),_0x83b240['table'],_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x77')],_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x79')],_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x78')]));}}}if(_0x83b240['conditions']){_0x83b240['conditions']=JSON[_0x5497('0x7b')](_0x83b240[_0x5497('0x7a')]);_0x2721b2[_0x5497('0x3d')](_0x5b0f9d(_0x83b240['conditions'][_0x5497('0x63')]));}_0x51e9fb=_0x2721b2['clone']();_0x2721b2[_0x5497('0x20')](_0x2375cc);_0x2721b2['offset'](0x0);return;}})['then'](function(){if(_0x4ff64f[_0x5497('0x8a')]===_0x5497('0x8b')){return null;}var _0x4ce768=_[_0x5497('0x41')](_0x4ff64f,{'name':_0x4ff64f[_0x5497('0x8c')]||_0x4ff64f[_0x5497('0x2c')]||_0x83b240[_0x5497('0x2c')],'basename':_0x594761,'savename':util['format'](_0x5497('0x8d'),_0x4ff64f[_0x5497('0x2c')]||_0x83b240[_0x5497('0x2c')],require(_0x5497('0x8e'))[_0x5497('0x8f')](0x4),_0x4ff64f['output']||_0x5497('0x90')),'reportId':_0x83b240['id'],'reportType':'default'});return db[_0x5497('0x91')][_0x5497('0x50')](_0x4ce768,{'raw':!![]});})[_0x5497('0x25')](function(_0x314db4){if(_0x83b240[_0x5497('0x6d')]===_0x5497('0x92')){_0x51e9fb[_0x5497('0x3d')](_0x83b240[_0x5497('0x6d')]+_0x5497('0x93'),_0x4ff64f[_0x5497('0x94')],_0x4ff64f[_0x5497('0x95')]);}else{_0x51e9fb['where'](_0x83b240[_0x5497('0x6d')]+_0x5497('0x96'),_0x4ff64f[_0x5497('0x94')],_0x4ff64f[_0x5497('0x95')]);}if(_0x314db4){logger[_0x5497('0x97')](_0x5497('0x98'),_0x51e9fb[_0x5497('0x99')]());require(_0x5497('0x9a'))[_0x5497('0x9b')](path[_0x5497('0x53')](__dirname,_0x5497('0x9c'),_0x314db4['output']),[_0x314db4['id'],_0x51e9fb[_0x5497('0x99')](),path[_0x5497('0x53')](__dirname,_0x5497('0x9d'),_0x314db4[_0x5497('0x9e')]),_0x594761]);return _0x314db4;}else{var _0x46be08=squel[_0x5497('0x6b')]();_0x46be08[_0x5497('0x6c')]('('+_0x51e9fb[_0x5497('0x99')]()+')',_0x5497('0x9f'));_0x46be08[_0x5497('0x64')](_0x5497('0xa0'),_0x5497('0x1f'));_0x51e9fb[_0x5497('0x20')](_0x4ff64f[_0x5497('0x20')]||_0x2375cc);_0x51e9fb['offset'](_0x4ff64f['offset']||0x0);return dbH[_0x5497('0x7e')][_0x5497('0x33')](_0x46be08[_0x5497('0x99')](),{'type':dbH['sequelize'][_0x5497('0x7f')][_0x5497('0x80')]})[_0x5497('0x25')](function(_0x2bd48c){if(!_0x2bd48c[_0x5497('0x39')]){_0x36c09f=0x0;}else{_0x36c09f=_0x2bd48c[0x0][_0x5497('0x1f')]||0x0;}return dbH[_0x5497('0x7e')][_0x5497('0x33')](_0x51e9fb['toString'](),{'type':dbH['sequelize']['QueryTypes'][_0x5497('0x80')]});})[_0x5497('0x25')](function(_0x4dab6a){return{'rows':_0x4dab6a||[],'count':_0x36c09f};});}});}exports[_0x5497('0xa1')]=function(_0x27f42b,_0x1bef85){return runReport(_0x27f42b['params'],_0x27f42b[_0x5497('0x33')],_0x27f42b['options'])[_0x5497('0x25')](respondWithResult(_0x1bef85,null))[_0x5497('0x47')](handleError(_0x1bef85,null));};exports[_0x5497('0xa2')]=runReport;exports['query']=function(_0x1c3dad,_0xfba062){var _0x494cc3=0xa;var _0x401f04=[_0x5497('0x53'),_0x5497('0x81'),'right_join',_0x5497('0xa3')];var _0x1a5c32={'SUM':_0x5497('0x54'),'COUNT':_0x5497('0x55'),'COUNT DISTINCT':_0x5497('0x82'),'MAX':_0x5497('0x56'),'MIN':_0x5497('0x83'),'AVG':_0x5497('0x84'),'GROUP_CONCAT':_0x5497('0x57'),'GROUP_CONCAT ASC':_0x5497('0x58'),'GROUP_CONCAT DESC':_0x5497('0x59')};var _0x1dfb76={'SEC_TO_TIME':_0x5497('0x5a'),'DATE':_0x5497('0x5b'),'HOUR':_0x5497('0x85'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x5497('0x5d')};var _0x5c2517=function(_0x367929){return!_[_0x5497('0x76')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x5497('0x60'),_0x5497('0x61')],_0x367929);};var _0x2fd2e3=function(_0x2fe770){if(!_0x2fe770||!_0x2fe770['rules'][_0x5497('0x39')]){return'';}for(var _0x1299cd='(',_0x4c2b14=0x0;_0x4c2b14<_0x2fe770['rules'][_0x5497('0x39')];_0x4c2b14+=0x1){_0x4c2b14>0x0&&(_0x1299cd+='\x20'+_0x2fe770[_0x5497('0x86')]+'\x20');_0x1299cd+=_0x2fe770[_0x5497('0x62')][_0x4c2b14][_0x5497('0x63')]?_0x2fd2e3(_0x2fe770[_0x5497('0x62')][_0x4c2b14]['group']):_0x2fe770['rules'][_0x4c2b14][_0x5497('0x64')]+'\x20'+_0x2fe770[_0x5497('0x62')][_0x4c2b14]['condition']+(_0x5c2517(_0x2fe770[_0x5497('0x62')][_0x4c2b14][_0x5497('0x65')])?'\x20'+_0x2fe770[_0x5497('0x62')][_0x4c2b14][_0x5497('0x66')]:'');}return _0x1299cd+')';};var _0x358ec5={'where':{'id':_0x1c3dad['params']['id']}},_0x5cddbc,_0x188d21,_0xf92129,_0x2d5cc1,_0x4f9228;_0x358ec5=_[_0x5497('0x41')]({},_0x358ec5,_0x1c3dad[_0x5497('0x42')]);return db[_0x5497('0x2e')]['find'](_0x358ec5)[_0x5497('0x25')](function(_0x30a248){if(_0x30a248){_0x5cddbc=_0x30a248;return _0x30a248[_0x5497('0xa4')]();}return null;})['then'](function(_0x1d4c76){if(_0x1d4c76){if(!_0x1d4c76[_0x5497('0x39')]){throw new db['Sequelize']['ValidationErrorItem'](_0x5497('0x87'),0x193);}_0x188d21=_0x1d4c76;return db[_0x5497('0x69')]['findAll']({'raw':!![]});}return null;})[_0x5497('0x25')](function(_0x5001d5){if(_0x5001d5){_0xf92129=_[_0x5497('0x6a')](_0x5001d5,'id');var _0x2c58e6;var _0x300f3e=squel[_0x5497('0x6b')]();_0x300f3e[_0x5497('0x6c')](_0x5cddbc[_0x5497('0x6d')]);for(var _0x23732d=0x0;_0x23732d<_0x188d21['length'];_0x23732d+=0x1){_0x2c58e6=_0x188d21[_0x23732d]['MetricId']?_0xf92129[_0x188d21[_0x23732d][_0x5497('0x6e')]][_0x5497('0x6f')]:_0x188d21[_0x23732d]['field'];_0x2c58e6=_0x188d21[_0x23732d]['function']?_[_0x5497('0xa5')](_0x1a5c32[_0x188d21[_0x23732d][_0x5497('0x70')]],'%s',_0x2c58e6):_0x2c58e6;_0x2c58e6=_0x188d21[_0x23732d][_0x5497('0x71')]?_[_0x5497('0xa5')](_0x1dfb76[_0x188d21[_0x23732d][_0x5497('0x71')]],'%s',_0x2c58e6):_0x2c58e6;if(_0x188d21[_0x23732d][_0x5497('0x72')]){_0x300f3e['group'](_0x2c58e6);}_0x188d21[_0x23732d][_0x5497('0x73')]&&_0x300f3e[_0x5497('0x3b')](_0x2c58e6,_0x188d21[_0x23732d][_0x5497('0x73')]===_0x5497('0x74')?![]:!![]);_0x300f3e[_0x5497('0x64')](_0x2c58e6,_0x188d21[_0x23732d][_0x5497('0x88')]||_0x2c58e6);}if(_0x5cddbc['joins']){_0x5cddbc[_0x5497('0x75')]=JSON['parse'](_0x5cddbc[_0x5497('0x75')]);for(var _0x261804=0x0;_0x261804<_0x5cddbc[_0x5497('0x75')]['length'];_0x261804+=0x1){if(_0x5cddbc[_0x5497('0x75')][_0x261804]['type']&&_['includes'](_0x401f04,_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x30')])&&_0x5cddbc['joins'][_0x261804][_0x5497('0x77')]&&_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x79')]&&_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x78')]){_0x300f3e[_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x30')]](_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x79')],null,util['format'](_0x5497('0x89'),_0x5cddbc[_0x5497('0x6d')],_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x77')],_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x79')],_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x78')]));}}}if(_0x5cddbc[_0x5497('0x7a')]){_0x5cddbc[_0x5497('0x7a')]=JSON[_0x5497('0x7b')](_0x5cddbc[_0x5497('0x7a')]);_0x300f3e[_0x5497('0x3d')](_0x2fd2e3(_0x5cddbc[_0x5497('0x7a')][_0x5497('0x63')]));}_0x4f9228=_0x300f3e[_0x5497('0xa6')]();_0x300f3e[_0x5497('0x20')](_0x494cc3);_0x300f3e[_0x5497('0x1d')](0x0);logger[_0x5497('0x7c')]('Limited\x20Query:',_0x300f3e[_0x5497('0x99')]());return dbH[_0x5497('0x7e')]['query'](_0x300f3e['toString'](),{'type':dbH[_0x5497('0x7e')]['QueryTypes'][_0x5497('0x80')]});}})[_0x5497('0x25')](function(){return{'sql':_0x4f9228[_0x5497('0x99')]()};})[_0x5497('0x25')](respondWithResult(_0xfba062,null))[_0x5497('0x47')](handleError(_0xfba062,null));}; \ No newline at end of file +var _0xdbf5=['includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','MetricId','function','replace','format','groupBy','orderBy','alias','joins','parse','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','table','parentKey','conditions','debug','Limited\x20Query:','toString','SELECT','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','IS\x20EMPTY','ValidationErrorItem','metric','DESC','clone','output','fullPath','%s-%s.%s','randomstring','generate','default','AnalyticExtractedReport','cdr','startDate','endDate','info','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','sequelize','QueryTypes','run','Sequelize','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','dbH','end','status','json','limit','undefined','count','set','Content-Range','reject','save','then','destroy','get','DefaultReports','UserProfileResource','sendStatus','error','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','show','params','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','find','userProfileId','catch','update','join','left_join','right_join','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x5d65af,_0x29aedf){_0x5d65af=_0x5d65af-0x0;var _0x4c2fe7=_0xdbf5[_0x5d65af];return _0x4c2fe7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5dbf('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5dbf('0x1'));var moment=require(_0x5dbf('0x2'));var BPromise=require(_0x5dbf('0x3'));var Mustache=require(_0x5dbf('0x4'));var util=require(_0x5dbf('0x5'));var path=require(_0x5dbf('0x6'));var sox=require(_0x5dbf('0x7'));var csv=require(_0x5dbf('0x8'));var ejs=require(_0x5dbf('0x9'));var fs=require('fs');var fs_extra=require(_0x5dbf('0xa'));var _=require(_0x5dbf('0xb'));var squel=require(_0x5dbf('0xc'));var crypto=require(_0x5dbf('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x5dbf('0xe'));var toCsv=require('to-csv');var querystring=require(_0x5dbf('0xf'));var Papa=require(_0x5dbf('0x10'));var Redis=require(_0x5dbf('0x11'));var authService=require(_0x5dbf('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x5dbf('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5dbf('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5dbf('0x15'));var db=require('../../mysqldb')['db'];var dbH=require(_0x5dbf('0x16'))[_0x5dbf('0x17')];function respondWithStatusCode(_0x1453a9,_0x7cb848){_0x7cb848=_0x7cb848||0xcc;return function(_0x14493a){if(_0x14493a){return _0x1453a9['sendStatus'](_0x7cb848);}return _0x1453a9['status'](_0x7cb848)[_0x5dbf('0x18')]();};}function respondWithResult(_0x3480c8,_0x48e7fd){_0x48e7fd=_0x48e7fd||0xc8;return function(_0x19624e){if(_0x19624e){return _0x3480c8[_0x5dbf('0x19')](_0x48e7fd)[_0x5dbf('0x1a')](_0x19624e);}};}function respondWithFilteredResult(_0x2dfa44,_0x181816){return function(_0x472eb9){if(_0x472eb9){var _0x2d32cc=typeof _0x181816['offset']==='undefined'&&typeof _0x181816[_0x5dbf('0x1b')]===_0x5dbf('0x1c');var _0x39c7aa=_0x472eb9[_0x5dbf('0x1d')];var _0x20c2b0=_0x2d32cc?0x0:_0x181816['offset'];var _0x11cd00=_0x2d32cc?_0x472eb9['count']:_0x181816['offset']+_0x181816['limit'];var _0x23d1e7;if(_0x11cd00>=_0x39c7aa){_0x11cd00=_0x39c7aa;_0x23d1e7=0xc8;}else{_0x23d1e7=0xce;}_0x2dfa44[_0x5dbf('0x19')](_0x23d1e7);return _0x2dfa44[_0x5dbf('0x1e')](_0x5dbf('0x1f'),_0x20c2b0+'-'+_0x11cd00+'/'+_0x39c7aa)[_0x5dbf('0x1a')](_0x472eb9);}return null;};}function patchUpdates(_0x5b2518){return function(_0x2764ea){try{jsonpatch['apply'](_0x2764ea,_0x5b2518,!![]);}catch(_0xb68f92){return BPromise[_0x5dbf('0x20')](_0xb68f92);}return _0x2764ea[_0x5dbf('0x21')]();};}function saveUpdates(_0x43a612,_0x3b763c){return function(_0x2f154e){if(_0x2f154e){return _0x2f154e['update'](_0x43a612)[_0x5dbf('0x22')](function(_0x3e3a2d){return _0x3e3a2d;});}return null;};}function removeEntity(_0x2d3e1b,_0x2079fc){return function(_0x2763ec){if(_0x2763ec){return _0x2763ec[_0x5dbf('0x23')]()[_0x5dbf('0x22')](function(){var _0x20ab1b=_0x2763ec[_0x5dbf('0x24')]({'plain':!![]});var _0x15a790=_0x5dbf('0x25');return db[_0x5dbf('0x26')][_0x5dbf('0x23')]({'where':{'type':_0x15a790,'resourceId':_0x20ab1b['id']}})[_0x5dbf('0x22')](function(){return _0x2763ec;});})[_0x5dbf('0x22')](function(){_0x2d3e1b[_0x5dbf('0x19')](0xcc)[_0x5dbf('0x18')]();});}};}function handleEntityNotFound(_0x3f8341,_0x159e61){return function(_0x22ec42){if(!_0x22ec42){_0x3f8341[_0x5dbf('0x27')](0x194);}return _0x22ec42;};}function handleError(_0x471027,_0x21cd00){_0x21cd00=_0x21cd00||0x1f4;return function(_0x5768b7){logger[_0x5dbf('0x28')](_0x5768b7[_0x5dbf('0x29')]);if(_0x5768b7[_0x5dbf('0x2a')]){delete _0x5768b7[_0x5dbf('0x2a')];}_0x471027[_0x5dbf('0x19')](_0x21cd00)[_0x5dbf('0x2b')](_0x5768b7);};}exports[_0x5dbf('0x2c')]=function(_0x31d57a,_0x406ce6){var _0x273b63={},_0x294dd7={},_0x50a307={'count':0x0,'rows':[]};var _0x4c1587=_[_0x5dbf('0x2d')](db[_0x5dbf('0x2e')][_0x5dbf('0x2f')],function(_0x3b73ad){return{'name':_0x3b73ad[_0x5dbf('0x30')],'type':_0x3b73ad['type']['key']};});_0x294dd7[_0x5dbf('0x31')]=_[_0x5dbf('0x2d')](_0x4c1587,'name');_0x294dd7[_0x5dbf('0x32')]=_[_0x5dbf('0x33')](_0x31d57a[_0x5dbf('0x32')]);_0x294dd7[_0x5dbf('0x34')]=_[_0x5dbf('0x35')](_0x294dd7['model'],_0x294dd7[_0x5dbf('0x32')]);_0x273b63[_0x5dbf('0x36')]=_[_0x5dbf('0x35')](_0x294dd7[_0x5dbf('0x31')],qs[_0x5dbf('0x37')](_0x31d57a['query'][_0x5dbf('0x37')]));_0x273b63[_0x5dbf('0x36')]=_0x273b63[_0x5dbf('0x36')][_0x5dbf('0x38')]?_0x273b63['attributes']:_0x294dd7[_0x5dbf('0x31')];if(!_0x31d57a[_0x5dbf('0x32')][_0x5dbf('0x39')](_0x5dbf('0x3a'))){_0x273b63[_0x5dbf('0x1b')]=qs[_0x5dbf('0x1b')](_0x31d57a[_0x5dbf('0x32')][_0x5dbf('0x1b')]);_0x273b63[_0x5dbf('0x3b')]=qs[_0x5dbf('0x3b')](_0x31d57a[_0x5dbf('0x32')]['offset']);}_0x273b63[_0x5dbf('0x3c')]=qs[_0x5dbf('0x3d')](_0x31d57a[_0x5dbf('0x32')]['sort']);_0x273b63[_0x5dbf('0x3e')]=qs[_0x5dbf('0x34')](_[_0x5dbf('0x3f')](_0x31d57a['query'],_0x294dd7[_0x5dbf('0x34')]),_0x4c1587);if(_0x31d57a[_0x5dbf('0x32')][_0x5dbf('0x40')]){_0x273b63['where']=_[_0x5dbf('0x41')](_0x273b63[_0x5dbf('0x3e')],{'$or':_[_0x5dbf('0x2d')](_0x4c1587,function(_0x260c9f){if(_0x260c9f[_0x5dbf('0x42')]!==_0x5dbf('0x43')){var _0x321ae3={};_0x321ae3[_0x260c9f[_0x5dbf('0x2a')]]={'$like':'%'+_0x31d57a['query']['filter']+'%'};return _0x321ae3;}})});}_0x273b63=_['merge']({},_0x273b63,_0x31d57a['options']);var _0x28b28f={'where':_0x273b63[_0x5dbf('0x3e')]};return db['AnalyticDefaultReport'][_0x5dbf('0x1d')](_0x28b28f)[_0x5dbf('0x22')](function(_0x5a60e8){_0x50a307[_0x5dbf('0x1d')]=_0x5a60e8;if(_0x31d57a[_0x5dbf('0x32')][_0x5dbf('0x44')]){_0x273b63[_0x5dbf('0x45')]=[{'all':!![]}];}return db[_0x5dbf('0x2e')][_0x5dbf('0x46')](_0x273b63);})[_0x5dbf('0x22')](function(_0x1c020a){_0x50a307[_0x5dbf('0x47')]=_0x1c020a;return _0x50a307;})[_0x5dbf('0x22')](respondWithFilteredResult(_0x406ce6,_0x273b63))['catch'](handleError(_0x406ce6,null));};exports[_0x5dbf('0x48')]=function(_0x22f958,_0xec1d28){var _0x50880d={'raw':!![],'where':{'id':_0x22f958[_0x5dbf('0x49')]['id']}},_0x16b0ff={};_0x16b0ff[_0x5dbf('0x31')]=_[_0x5dbf('0x33')](db['AnalyticDefaultReport'][_0x5dbf('0x2f')]);_0x16b0ff['query']=_[_0x5dbf('0x33')](_0x22f958[_0x5dbf('0x32')]);_0x16b0ff[_0x5dbf('0x34')]=_[_0x5dbf('0x35')](_0x16b0ff['model'],_0x16b0ff['query']);_0x50880d[_0x5dbf('0x36')]=_[_0x5dbf('0x35')](_0x16b0ff[_0x5dbf('0x31')],qs['fields'](_0x22f958[_0x5dbf('0x32')]['fields']));_0x50880d['attributes']=_0x50880d['attributes']['length']?_0x50880d[_0x5dbf('0x36')]:_0x16b0ff[_0x5dbf('0x31')];if(_0x22f958['query'][_0x5dbf('0x44')]){_0x50880d[_0x5dbf('0x45')]=[{'all':!![]}];}_0x50880d=_['merge']({},_0x50880d,_0x22f958[_0x5dbf('0x4a')]);return db[_0x5dbf('0x2e')]['find'](_0x50880d)[_0x5dbf('0x22')](handleEntityNotFound(_0xec1d28,null))['then'](respondWithResult(_0xec1d28,null))['catch'](handleError(_0xec1d28,null));};exports[_0x5dbf('0x4b')]=function(_0x2a3d30,_0x17a1c0){return db['AnalyticDefaultReport']['create'](_0x2a3d30[_0x5dbf('0x4c')],{})[_0x5dbf('0x22')](function(_0x21f477){var _0x307a00=_0x2a3d30[_0x5dbf('0x4d')][_0x5dbf('0x24')]({'plain':!![]});if(!_0x307a00)throw new Error(_0x5dbf('0x4e'));if(_0x307a00[_0x5dbf('0x4f')]==='user'){var _0x3f38a0=_0x21f477[_0x5dbf('0x24')]({'plain':!![]});var _0x2927a3=_0x5dbf('0x50');return db[_0x5dbf('0x51')][_0x5dbf('0x52')]({'where':{'name':_0x2927a3,'userProfileId':_0x307a00[_0x5dbf('0x53')]},'raw':!![]})['then'](function(_0x1b0b13){if(_0x1b0b13&&_0x1b0b13['autoAssociation']===0x0){return db[_0x5dbf('0x26')][_0x5dbf('0x4b')]({'name':_0x3f38a0[_0x5dbf('0x2a')],'resourceId':_0x3f38a0['id'],'type':_0x5dbf('0x25'),'sectionId':_0x1b0b13['id']},{})[_0x5dbf('0x22')](function(){return _0x21f477;});}else{return _0x21f477;}})[_0x5dbf('0x54')](function(_0x353d0f){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x353d0f);throw _0x353d0f;});}return _0x21f477;})['then'](respondWithResult(_0x17a1c0,0xc9))[_0x5dbf('0x54')](handleError(_0x17a1c0,null));};exports[_0x5dbf('0x55')]=function(_0x36a787,_0x56c8b2){if(_0x36a787['body']['id']){delete _0x36a787[_0x5dbf('0x4c')]['id'];}return db[_0x5dbf('0x2e')][_0x5dbf('0x52')]({'where':{'id':_0x36a787['params']['id']}})[_0x5dbf('0x22')](handleEntityNotFound(_0x56c8b2,null))['then'](saveUpdates(_0x36a787[_0x5dbf('0x4c')],null))[_0x5dbf('0x22')](respondWithResult(_0x56c8b2,null))[_0x5dbf('0x54')](handleError(_0x56c8b2,null));};exports['destroy']=function(_0x55fd51,_0x1b316d){return db[_0x5dbf('0x2e')][_0x5dbf('0x52')]({'where':{'id':_0x55fd51[_0x5dbf('0x49')]['id']}})['then'](handleEntityNotFound(_0x1b316d,null))[_0x5dbf('0x22')](removeEntity(_0x1b316d,null))[_0x5dbf('0x54')](handleError(_0x1b316d,null));};exports['preview']=function(_0x5485f3,_0x19ec03){var _0x14bdb1=0xa;var _0x197e8c=[_0x5dbf('0x56'),_0x5dbf('0x57'),_0x5dbf('0x58'),'cross_join'];var _0x4107f1={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x5dbf('0x59'),'MIN':'MIN(%s)','AVG':_0x5dbf('0x5a'),'GROUP_CONCAT':_0x5dbf('0x5b'),'GROUP_CONCAT ASC':_0x5dbf('0x5c'),'GROUP_CONCAT DESC':_0x5dbf('0x5d')};var _0x461ffb={'SEC_TO_TIME':_0x5dbf('0x5e'),'DATE':_0x5dbf('0x5f'),'HOUR':_0x5dbf('0x60'),'ROUND':_0x5dbf('0x61'),'UNIX_TIMESTAMP':_0x5dbf('0x62')};var _0x3a84c2=function(_0x2ca889){return!_[_0x5dbf('0x63')]([_0x5dbf('0x64'),_0x5dbf('0x65'),'IS\x20EMPTY',_0x5dbf('0x66')],_0x2ca889);};var _0x553be4=function(_0xb0a9bf){if(!_0xb0a9bf||!_0xb0a9bf[_0x5dbf('0x67')][_0x5dbf('0x38')]){return'';}for(var _0x110224='(',_0x5a975a=0x0;_0x5a975a<_0xb0a9bf[_0x5dbf('0x67')][_0x5dbf('0x38')];_0x5a975a+=0x1){_0x5a975a>0x0&&(_0x110224+='\x20'+_0xb0a9bf[_0x5dbf('0x68')]+'\x20');_0x110224+=_0xb0a9bf[_0x5dbf('0x67')][_0x5a975a][_0x5dbf('0x69')]?_0x553be4(_0xb0a9bf[_0x5dbf('0x67')][_0x5a975a]['group']):_0xb0a9bf[_0x5dbf('0x67')][_0x5a975a][_0x5dbf('0x6a')]+'\x20'+_0xb0a9bf[_0x5dbf('0x67')][_0x5a975a][_0x5dbf('0x6b')]+(_0x3a84c2(_0xb0a9bf[_0x5dbf('0x67')][_0x5a975a][_0x5dbf('0x6b')])?'\x20'+_0xb0a9bf[_0x5dbf('0x67')][_0x5a975a][_0x5dbf('0x6c')]:'');}return _0x110224+')';};var _0x12d69b={'where':{'id':_0x5485f3[_0x5dbf('0x49')]['id']}},_0x3b53da,_0x13c8ab,_0x2997a8,_0x5d7a37,_0x52109d;_0x12d69b=_[_0x5dbf('0x41')]({},_0x12d69b,_0x5485f3[_0x5dbf('0x4a')]);return db[_0x5dbf('0x2e')][_0x5dbf('0x52')](_0x12d69b)[_0x5dbf('0x22')](function(_0x1b42cf){if(_0x1b42cf){_0x3b53da=_0x1b42cf;return _0x1b42cf[_0x5dbf('0x6d')]();}return null;})[_0x5dbf('0x22')](function(_0x57c568){if(_0x57c568){if(!_0x57c568['length']){throw new db['Sequelize']['ValidationErrorItem'](_0x5dbf('0x6e'),0x193);}_0x13c8ab=_0x57c568;return db[_0x5dbf('0x6f')][_0x5dbf('0x46')]({'raw':!![]});}return null;})[_0x5dbf('0x22')](function(_0x29c4d9){if(_0x29c4d9){_0x2997a8=_[_0x5dbf('0x70')](_0x29c4d9,'id');var _0x5331ff;var _0x5bb990=squel[_0x5dbf('0x71')]();_0x5bb990[_0x5dbf('0x72')](_0x3b53da['table']);for(var _0x1728b9=0x0;_0x1728b9<_0x13c8ab[_0x5dbf('0x38')];_0x1728b9+=0x1){_0x5331ff=_0x13c8ab[_0x1728b9][_0x5dbf('0x73')]?_0x2997a8[_0x13c8ab[_0x1728b9][_0x5dbf('0x73')]]['metric']:_0x13c8ab[_0x1728b9][_0x5dbf('0x6a')];_0x5331ff=_0x13c8ab[_0x1728b9][_0x5dbf('0x74')]?_[_0x5dbf('0x75')](_0x4107f1[_0x13c8ab[_0x1728b9][_0x5dbf('0x74')]],'%s',_0x5331ff):_0x5331ff;_0x5331ff=_0x13c8ab[_0x1728b9][_0x5dbf('0x76')]?_['replace'](_0x461ffb[_0x13c8ab[_0x1728b9][_0x5dbf('0x76')]],'%s',_0x5331ff):_0x5331ff;if(_0x13c8ab[_0x1728b9][_0x5dbf('0x77')]){_0x5bb990[_0x5dbf('0x69')](_0x5331ff);}_0x13c8ab[_0x1728b9][_0x5dbf('0x78')]&&_0x5bb990['order'](_0x5331ff,_0x13c8ab[_0x1728b9][_0x5dbf('0x78')]==='DESC'?![]:!![]);_0x5bb990[_0x5dbf('0x6a')](_0x5331ff,_0x13c8ab[_0x1728b9][_0x5dbf('0x79')]||_0x5331ff);}if(_0x3b53da[_0x5dbf('0x7a')]){_0x3b53da['joins']=JSON[_0x5dbf('0x7b')](_0x3b53da[_0x5dbf('0x7a')]);for(var _0x4166ce=0x0;_0x4166ce<_0x3b53da[_0x5dbf('0x7a')]['length'];_0x4166ce+=0x1){if(_0x3b53da[_0x5dbf('0x7a')][_0x4166ce][_0x5dbf('0x42')]&&_[_0x5dbf('0x63')](_0x197e8c,_0x3b53da[_0x5dbf('0x7a')][_0x4166ce][_0x5dbf('0x42')])&&_0x3b53da[_0x5dbf('0x7a')][_0x4166ce]['parentKey']&&_0x3b53da[_0x5dbf('0x7a')][_0x4166ce][_0x5dbf('0x7c')]&&_0x3b53da['joins'][_0x4166ce][_0x5dbf('0x7d')]){_0x5bb990[_0x3b53da[_0x5dbf('0x7a')][_0x4166ce][_0x5dbf('0x42')]](_0x3b53da[_0x5dbf('0x7a')][_0x4166ce][_0x5dbf('0x7c')],null,util[_0x5dbf('0x76')](_0x5dbf('0x7e'),_0x3b53da[_0x5dbf('0x7f')],_0x3b53da[_0x5dbf('0x7a')][_0x4166ce][_0x5dbf('0x80')],_0x3b53da[_0x5dbf('0x7a')][_0x4166ce][_0x5dbf('0x7c')],_0x3b53da[_0x5dbf('0x7a')][_0x4166ce][_0x5dbf('0x7d')]));}}}if(_0x3b53da[_0x5dbf('0x81')]){_0x3b53da[_0x5dbf('0x81')]=JSON['parse'](_0x3b53da[_0x5dbf('0x81')]);_0x5bb990[_0x5dbf('0x3e')](_0x553be4(_0x3b53da[_0x5dbf('0x81')][_0x5dbf('0x69')]));}_0x52109d=_0x5bb990['clone']();_0x5bb990[_0x5dbf('0x1b')](_0x14bdb1);_0x5bb990[_0x5dbf('0x3b')](0x0);logger[_0x5dbf('0x82')](_0x5dbf('0x83'),_0x5bb990[_0x5dbf('0x84')]());return dbH['sequelize'][_0x5dbf('0x32')](_0x5bb990[_0x5dbf('0x84')](),{'type':dbH['sequelize']['QueryTypes'][_0x5dbf('0x85')]});}})[_0x5dbf('0x22')](respondWithResult(_0x19ec03,null))[_0x5dbf('0x54')](handleError(_0x19ec03,null));};function runReport(_0x8ca7de,_0x14b21b,_0x23ec75){var _0x22339b=_0x14b21b['name'];var _0x310078=0xa;var _0x3b01c0=[_0x5dbf('0x56'),_0x5dbf('0x57'),_0x5dbf('0x58'),_0x5dbf('0x86')];var _0x4cceb1={'SUM':_0x5dbf('0x87'),'COUNT':_0x5dbf('0x88'),'COUNT DISTINCT':_0x5dbf('0x89'),'MAX':_0x5dbf('0x59'),'MIN':_0x5dbf('0x8a'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x5dbf('0x5b'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x5924d2={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x5dbf('0x5f'),'HOUR':_0x5dbf('0x60'),'ROUND':_0x5dbf('0x61'),'UNIX_TIMESTAMP':_0x5dbf('0x62')};var _0x4333db=function(_0x4cb92d){return!_['includes']([_0x5dbf('0x64'),'IS\x20NOT\x20NULL',_0x5dbf('0x8b'),_0x5dbf('0x66')],_0x4cb92d);};var _0x541241=function(_0x3c7eaa){if(!_0x3c7eaa||!_0x3c7eaa['rules'][_0x5dbf('0x38')]){return'';}for(var _0x24d90a='(',_0xa3e94f=0x0;_0xa3e94f<_0x3c7eaa[_0x5dbf('0x67')][_0x5dbf('0x38')];_0xa3e94f+=0x1){_0xa3e94f>0x0&&(_0x24d90a+='\x20'+_0x3c7eaa['operator']+'\x20');_0x24d90a+=_0x3c7eaa[_0x5dbf('0x67')][_0xa3e94f][_0x5dbf('0x69')]?_0x541241(_0x3c7eaa[_0x5dbf('0x67')][_0xa3e94f][_0x5dbf('0x69')]):_0x3c7eaa['rules'][_0xa3e94f][_0x5dbf('0x6a')]+'\x20'+_0x3c7eaa[_0x5dbf('0x67')][_0xa3e94f][_0x5dbf('0x6b')]+(_0x4333db(_0x3c7eaa[_0x5dbf('0x67')][_0xa3e94f][_0x5dbf('0x6b')])?'\x20'+_0x3c7eaa[_0x5dbf('0x67')][_0xa3e94f][_0x5dbf('0x6c')]:'');}return _0x24d90a+')';};var _0x334f63={'where':{'id':_0x8ca7de['id']}},_0x5ac29f,_0x533fdd,_0x5bf068,_0x1bd06b,_0x274497;_0x334f63=_['merge']({},_0x334f63,_0x23ec75);return db['AnalyticDefaultReport']['find'](_0x334f63)[_0x5dbf('0x22')](function(_0x20bda9){if(_0x20bda9){_0x5ac29f=_0x20bda9;return _0x20bda9[_0x5dbf('0x6d')]();}return null;})[_0x5dbf('0x22')](function(_0x12757d){if(_0x12757d){if(!_0x12757d[_0x5dbf('0x38')]){throw new db['Sequelize'][(_0x5dbf('0x8c'))](_0x5dbf('0x6e'),0x193);}_0x533fdd=_0x12757d;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0x5dbf('0x22')](function(_0x5722b3){if(_0x5722b3){_0x5bf068=_['keyBy'](_0x5722b3,'id');var _0x3a27c4;var _0x3620d2=squel[_0x5dbf('0x71')]();_0x3620d2['from'](_0x5ac29f[_0x5dbf('0x7f')]);for(var _0x447259=0x0;_0x447259<_0x533fdd['length'];_0x447259+=0x1){_0x3a27c4=_0x533fdd[_0x447259][_0x5dbf('0x73')]?_0x5bf068[_0x533fdd[_0x447259][_0x5dbf('0x73')]][_0x5dbf('0x8d')]:_0x533fdd[_0x447259][_0x5dbf('0x6a')];_0x3a27c4=_0x533fdd[_0x447259][_0x5dbf('0x74')]?_[_0x5dbf('0x75')](_0x4cceb1[_0x533fdd[_0x447259][_0x5dbf('0x74')]],'%s',_0x3a27c4):_0x3a27c4;_0x3a27c4=_0x533fdd[_0x447259][_0x5dbf('0x76')]?_['replace'](_0x5924d2[_0x533fdd[_0x447259]['format']],'%s',_0x3a27c4):_0x3a27c4;if(_0x533fdd[_0x447259]['groupBy']){_0x3620d2[_0x5dbf('0x69')](_0x3a27c4);}_0x533fdd[_0x447259][_0x5dbf('0x78')]&&_0x3620d2[_0x5dbf('0x3c')](_0x3a27c4,_0x533fdd[_0x447259][_0x5dbf('0x78')]===_0x5dbf('0x8e')?![]:!![]);_0x3620d2[_0x5dbf('0x6a')](_0x3a27c4,_0x533fdd[_0x447259][_0x5dbf('0x79')]||_0x3a27c4);}if(_0x5ac29f[_0x5dbf('0x7a')]){_0x5ac29f[_0x5dbf('0x7a')]=JSON[_0x5dbf('0x7b')](_0x5ac29f['joins']);for(var _0x2ded2b=0x0;_0x2ded2b<_0x5ac29f[_0x5dbf('0x7a')][_0x5dbf('0x38')];_0x2ded2b+=0x1){if(_0x5ac29f[_0x5dbf('0x7a')][_0x2ded2b][_0x5dbf('0x42')]&&_[_0x5dbf('0x63')](_0x3b01c0,_0x5ac29f[_0x5dbf('0x7a')][_0x2ded2b][_0x5dbf('0x42')])&&_0x5ac29f['joins'][_0x2ded2b]['parentKey']&&_0x5ac29f[_0x5dbf('0x7a')][_0x2ded2b]['foreignTable']&&_0x5ac29f['joins'][_0x2ded2b][_0x5dbf('0x7d')]){_0x3620d2[_0x5ac29f['joins'][_0x2ded2b]['type']](_0x5ac29f['joins'][_0x2ded2b]['foreignTable'],null,util[_0x5dbf('0x76')]('%s.%s\x20=\x20%s.%s',_0x5ac29f[_0x5dbf('0x7f')],_0x5ac29f[_0x5dbf('0x7a')][_0x2ded2b][_0x5dbf('0x80')],_0x5ac29f['joins'][_0x2ded2b][_0x5dbf('0x7c')],_0x5ac29f[_0x5dbf('0x7a')][_0x2ded2b][_0x5dbf('0x7d')]));}}}if(_0x5ac29f['conditions']){_0x5ac29f[_0x5dbf('0x81')]=JSON[_0x5dbf('0x7b')](_0x5ac29f[_0x5dbf('0x81')]);_0x3620d2['where'](_0x541241(_0x5ac29f[_0x5dbf('0x81')][_0x5dbf('0x69')]));}_0x274497=_0x3620d2[_0x5dbf('0x8f')]();_0x3620d2['limit'](_0x310078);_0x3620d2[_0x5dbf('0x3b')](0x0);return;}})[_0x5dbf('0x22')](function(){if(_0x14b21b[_0x5dbf('0x90')]==='web'){return null;}var _0x48a8c5=_['merge'](_0x14b21b,{'name':_0x14b21b[_0x5dbf('0x91')]||_0x14b21b[_0x5dbf('0x2a')]||_0x5ac29f[_0x5dbf('0x2a')],'basename':_0x22339b,'savename':util[_0x5dbf('0x76')](_0x5dbf('0x92'),_0x14b21b[_0x5dbf('0x2a')]||_0x5ac29f['name'],require(_0x5dbf('0x93'))[_0x5dbf('0x94')](0x4),_0x14b21b[_0x5dbf('0x90')]||'csv'),'reportId':_0x5ac29f['id'],'reportType':_0x5dbf('0x95')});return db[_0x5dbf('0x96')][_0x5dbf('0x4b')](_0x48a8c5,{'raw':!![]});})[_0x5dbf('0x22')](function(_0x2afbd4){if(_0x5ac29f[_0x5dbf('0x7f')]===_0x5dbf('0x97')){_0x274497['where'](_0x5ac29f[_0x5dbf('0x7f')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x14b21b[_0x5dbf('0x98')],_0x14b21b[_0x5dbf('0x99')]);}else{_0x274497[_0x5dbf('0x3e')](_0x5ac29f['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x14b21b['startDate'],_0x14b21b[_0x5dbf('0x99')]);}if(_0x2afbd4){logger[_0x5dbf('0x9a')]('Run\x20Query:',_0x274497[_0x5dbf('0x84')]());require('child_process')[_0x5dbf('0x9b')](path[_0x5dbf('0x56')](__dirname,_0x5dbf('0x9c'),_0x2afbd4['output']),[_0x2afbd4['id'],_0x274497[_0x5dbf('0x84')](),path[_0x5dbf('0x56')](__dirname,_0x5dbf('0x9d'),_0x2afbd4[_0x5dbf('0x9e')]),_0x22339b]);return _0x2afbd4;}else{var _0x4bc5af=squel[_0x5dbf('0x71')]();_0x4bc5af[_0x5dbf('0x72')]('('+_0x274497['toString']()+')',_0x5dbf('0x9f'));_0x4bc5af['field'](_0x5dbf('0xa0'),_0x5dbf('0x1d'));_0x274497[_0x5dbf('0x1b')](_0x14b21b['limit']||_0x310078);_0x274497[_0x5dbf('0x3b')](_0x14b21b[_0x5dbf('0x3b')]||0x0);return dbH[_0x5dbf('0xa1')][_0x5dbf('0x32')](_0x4bc5af[_0x5dbf('0x84')](),{'type':dbH[_0x5dbf('0xa1')]['QueryTypes'][_0x5dbf('0x85')]})['then'](function(_0x6cfb82){if(!_0x6cfb82[_0x5dbf('0x38')]){_0x1bd06b=0x0;}else{_0x1bd06b=_0x6cfb82[0x0][_0x5dbf('0x1d')]||0x0;}return dbH[_0x5dbf('0xa1')][_0x5dbf('0x32')](_0x274497[_0x5dbf('0x84')](),{'type':dbH['sequelize'][_0x5dbf('0xa2')][_0x5dbf('0x85')]});})[_0x5dbf('0x22')](function(_0x4d68f6){return{'rows':_0x4d68f6||[],'count':_0x1bd06b};});}});}exports[_0x5dbf('0xa3')]=function(_0x47ac95,_0x51b241){return runReport(_0x47ac95[_0x5dbf('0x49')],_0x47ac95[_0x5dbf('0x32')],_0x47ac95[_0x5dbf('0x4a')])[_0x5dbf('0x22')](respondWithResult(_0x51b241,null))[_0x5dbf('0x54')](handleError(_0x51b241,null));};exports['runReport']=runReport;exports['query']=function(_0x4f38a0,_0x144300){var _0x1da1e3=0xa;var _0x25e681=[_0x5dbf('0x56'),_0x5dbf('0x57'),_0x5dbf('0x58'),_0x5dbf('0x86')];var _0x236754={'SUM':'SUM(%s)','COUNT':_0x5dbf('0x88'),'COUNT DISTINCT':_0x5dbf('0x89'),'MAX':_0x5dbf('0x59'),'MIN':_0x5dbf('0x8a'),'AVG':_0x5dbf('0x5a'),'GROUP_CONCAT':_0x5dbf('0x5b'),'GROUP_CONCAT ASC':_0x5dbf('0x5c'),'GROUP_CONCAT DESC':_0x5dbf('0x5d')};var _0x191a16={'SEC_TO_TIME':_0x5dbf('0x5e'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x5dbf('0x62')};var _0x51b0df=function(_0x48ea8a){return!_['includes']([_0x5dbf('0x64'),_0x5dbf('0x65'),_0x5dbf('0x8b'),_0x5dbf('0x66')],_0x48ea8a);};var _0x3de263=function(_0x4f8dde){if(!_0x4f8dde||!_0x4f8dde[_0x5dbf('0x67')][_0x5dbf('0x38')]){return'';}for(var _0x19effa='(',_0x29177e=0x0;_0x29177e<_0x4f8dde[_0x5dbf('0x67')]['length'];_0x29177e+=0x1){_0x29177e>0x0&&(_0x19effa+='\x20'+_0x4f8dde[_0x5dbf('0x68')]+'\x20');_0x19effa+=_0x4f8dde[_0x5dbf('0x67')][_0x29177e][_0x5dbf('0x69')]?_0x3de263(_0x4f8dde[_0x5dbf('0x67')][_0x29177e]['group']):_0x4f8dde[_0x5dbf('0x67')][_0x29177e][_0x5dbf('0x6a')]+'\x20'+_0x4f8dde[_0x5dbf('0x67')][_0x29177e][_0x5dbf('0x6b')]+(_0x51b0df(_0x4f8dde[_0x5dbf('0x67')][_0x29177e][_0x5dbf('0x6b')])?'\x20'+_0x4f8dde[_0x5dbf('0x67')][_0x29177e]['value']:'');}return _0x19effa+')';};var _0x4899ac={'where':{'id':_0x4f38a0['params']['id']}},_0x51864c,_0x4562a4,_0x240304,_0x5df275,_0xc588a2;_0x4899ac=_[_0x5dbf('0x41')]({},_0x4899ac,_0x4f38a0['options']);return db[_0x5dbf('0x2e')][_0x5dbf('0x52')](_0x4899ac)[_0x5dbf('0x22')](function(_0x2eafe0){if(_0x2eafe0){_0x51864c=_0x2eafe0;return _0x2eafe0[_0x5dbf('0x6d')]();}return null;})[_0x5dbf('0x22')](function(_0x414859){if(_0x414859){if(!_0x414859['length']){throw new db[(_0x5dbf('0xa4'))][(_0x5dbf('0x8c'))](_0x5dbf('0x6e'),0x193);}_0x4562a4=_0x414859;return db[_0x5dbf('0x6f')][_0x5dbf('0x46')]({'raw':!![]});}return null;})[_0x5dbf('0x22')](function(_0x153401){if(_0x153401){_0x240304=_[_0x5dbf('0x70')](_0x153401,'id');var _0xbe0ca0;var _0x521c72=squel[_0x5dbf('0x71')]();_0x521c72[_0x5dbf('0x72')](_0x51864c[_0x5dbf('0x7f')]);for(var _0x6b4262=0x0;_0x6b4262<_0x4562a4[_0x5dbf('0x38')];_0x6b4262+=0x1){_0xbe0ca0=_0x4562a4[_0x6b4262][_0x5dbf('0x73')]?_0x240304[_0x4562a4[_0x6b4262][_0x5dbf('0x73')]][_0x5dbf('0x8d')]:_0x4562a4[_0x6b4262][_0x5dbf('0x6a')];_0xbe0ca0=_0x4562a4[_0x6b4262][_0x5dbf('0x74')]?_[_0x5dbf('0x75')](_0x236754[_0x4562a4[_0x6b4262][_0x5dbf('0x74')]],'%s',_0xbe0ca0):_0xbe0ca0;_0xbe0ca0=_0x4562a4[_0x6b4262][_0x5dbf('0x76')]?_[_0x5dbf('0x75')](_0x191a16[_0x4562a4[_0x6b4262][_0x5dbf('0x76')]],'%s',_0xbe0ca0):_0xbe0ca0;if(_0x4562a4[_0x6b4262][_0x5dbf('0x77')]){_0x521c72[_0x5dbf('0x69')](_0xbe0ca0);}_0x4562a4[_0x6b4262][_0x5dbf('0x78')]&&_0x521c72[_0x5dbf('0x3c')](_0xbe0ca0,_0x4562a4[_0x6b4262]['orderBy']===_0x5dbf('0x8e')?![]:!![]);_0x521c72['field'](_0xbe0ca0,_0x4562a4[_0x6b4262][_0x5dbf('0x79')]||_0xbe0ca0);}if(_0x51864c['joins']){_0x51864c[_0x5dbf('0x7a')]=JSON['parse'](_0x51864c[_0x5dbf('0x7a')]);for(var _0x417869=0x0;_0x417869<_0x51864c[_0x5dbf('0x7a')]['length'];_0x417869+=0x1){if(_0x51864c[_0x5dbf('0x7a')][_0x417869][_0x5dbf('0x42')]&&_[_0x5dbf('0x63')](_0x25e681,_0x51864c[_0x5dbf('0x7a')][_0x417869][_0x5dbf('0x42')])&&_0x51864c[_0x5dbf('0x7a')][_0x417869][_0x5dbf('0x80')]&&_0x51864c['joins'][_0x417869][_0x5dbf('0x7c')]&&_0x51864c[_0x5dbf('0x7a')][_0x417869]['foreignKey']){_0x521c72[_0x51864c[_0x5dbf('0x7a')][_0x417869]['type']](_0x51864c['joins'][_0x417869][_0x5dbf('0x7c')],null,util[_0x5dbf('0x76')]('%s.%s\x20=\x20%s.%s',_0x51864c[_0x5dbf('0x7f')],_0x51864c['joins'][_0x417869]['parentKey'],_0x51864c[_0x5dbf('0x7a')][_0x417869]['foreignTable'],_0x51864c[_0x5dbf('0x7a')][_0x417869][_0x5dbf('0x7d')]));}}}if(_0x51864c[_0x5dbf('0x81')]){_0x51864c[_0x5dbf('0x81')]=JSON[_0x5dbf('0x7b')](_0x51864c[_0x5dbf('0x81')]);_0x521c72[_0x5dbf('0x3e')](_0x3de263(_0x51864c[_0x5dbf('0x81')][_0x5dbf('0x69')]));}_0xc588a2=_0x521c72[_0x5dbf('0x8f')]();_0x521c72[_0x5dbf('0x1b')](_0x1da1e3);_0x521c72[_0x5dbf('0x3b')](0x0);logger[_0x5dbf('0x82')]('Limited\x20Query:',_0x521c72[_0x5dbf('0x84')]());return dbH[_0x5dbf('0xa1')][_0x5dbf('0x32')](_0x521c72[_0x5dbf('0x84')](),{'type':dbH[_0x5dbf('0xa1')][_0x5dbf('0xa2')]['SELECT']});}})[_0x5dbf('0x22')](function(){return{'sql':_0xc588a2[_0x5dbf('0x84')]()};})[_0x5dbf('0x22')](respondWithResult(_0x144300,null))[_0x5dbf('0x54')](handleError(_0x144300,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index f79e4f8..11a4f66 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 _0x55b6=['../../config/environment','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger','api','moment'];(function(_0x1f3aec,_0x24c18e){var _0x409f0d=function(_0x52b818){while(--_0x52b818){_0x1f3aec['push'](_0x1f3aec['shift']());}};_0x409f0d(++_0x24c18e);}(_0x55b6,0x74));var _0x655b=function(_0xd566cb,_0x445ab3){_0xd566cb=_0xd566cb-0x0;var _0x229f8d=_0x55b6[_0xd566cb];return _0x229f8d;};'use strict';var _=require(_0x655b('0x0'));var util=require(_0x655b('0x1'));var logger=require(_0x655b('0x2'))(_0x655b('0x3'));var moment=require(_0x655b('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x655b('0x5'));var attributes=require(_0x655b('0x6'));module[_0x655b('0x7')]=function(_0x5d3784,_0x2842f9){return _0x5d3784[_0x655b('0x8')](_0x655b('0x9'),attributes,{'tableName':_0x655b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x66be=['bluebird','request-promise','path','rimraf','exports','define','AnalyticDefaultReport','analytics_default_reports','lodash','../../config/logger','api','moment'];(function(_0x5489af,_0x496656){var _0x2684cd=function(_0xde3997){while(--_0xde3997){_0x5489af['push'](_0x5489af['shift']());}};_0x2684cd(++_0x496656);}(_0x66be,0xa4));var _0xe66b=function(_0x1b97e3,_0x270974){_0x1b97e3=_0x1b97e3-0x0;var _0x7c878e=_0x66be[_0x1b97e3];return _0x7c878e;};'use strict';var _=require(_0xe66b('0x0'));var util=require('util');var logger=require(_0xe66b('0x1'))(_0xe66b('0x2'));var moment=require(_0xe66b('0x3'));var BPromise=require(_0xe66b('0x4'));var rp=require(_0xe66b('0x5'));var fs=require('fs');var path=require(_0xe66b('0x6'));var rimraf=require(_0xe66b('0x7'));var config=require('../../config/environment');var attributes=require('./analyticDefaultReport.attributes');module[_0xe66b('0x8')]=function(_0x2ae1f2,_0x191084){return _0x2ae1f2[_0xe66b('0x9')](_0xe66b('0xa'),attributes,{'tableName':_0xe66b('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 83e9e62..bda1e09 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 _0xb83b=['client','http','request','then','info','request\x20sent','debug','stringify','error','AnalyticDefaultReport,\x20%s,\x20%s','message','catch','lodash','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise'];(function(_0x4593e2,_0x4de5f0){var _0x8c7ce2=function(_0x116450){while(--_0x116450){_0x4593e2['push'](_0x4593e2['shift']());}};_0x8c7ce2(++_0x4de5f0);}(_0xb83b,0x129));var _0xbb83=function(_0x4c8f61,_0x149887){_0x4c8f61=_0x4c8f61-0x0;var _0x2a162e=_0xb83b[_0x4c8f61];return _0x2a162e;};'use strict';var _=require(_0xbb83('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xbb83('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbb83('0x2'));var db=require(_0xbb83('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xbb83('0x4'));var config=require(_0xbb83('0x5'));var jayson=require(_0xbb83('0x6'));var client=jayson[_0xbb83('0x7')][_0xbb83('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5f7efa,_0x4d940d,_0xc31f4f){return new BPromise(function(_0x3f4146,_0x22f09e){return client[_0xbb83('0x9')](_0x5f7efa,_0xc31f4f)[_0xbb83('0xa')](function(_0x3d0261){logger[_0xbb83('0xb')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x4d940d,_0xbb83('0xc'));logger[_0xbb83('0xd')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x4d940d,_0xbb83('0xc'),JSON[_0xbb83('0xe')](_0x3d0261));if(_0x3d0261['error']){if(_0x3d0261[_0xbb83('0xf')]['code']===0x1f4){logger[_0xbb83('0xf')](_0xbb83('0x10'),_0x4d940d,_0x3d0261[_0xbb83('0xf')][_0xbb83('0x11')]);return _0x22f09e(_0x3d0261[_0xbb83('0xf')][_0xbb83('0x11')]);}logger['error'](_0xbb83('0x10'),_0x4d940d,_0x3d0261[_0xbb83('0xf')][_0xbb83('0x11')]);return _0x3f4146(_0x3d0261[_0xbb83('0xf')][_0xbb83('0x11')]);}else{logger[_0xbb83('0xb')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x4d940d,_0xbb83('0xc'));_0x3f4146(_0x3d0261['result'][_0xbb83('0x11')]);}})[_0xbb83('0x12')](function(_0x231c05){logger[_0xbb83('0xf')](_0xbb83('0x10'),_0x4d940d,_0x231c05);_0x22f09e(_0x231c05);});});} \ No newline at end of file +var _0xef2c=['message','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x210258,_0x55d4d9){var _0x18ee62=function(_0x1f290d){while(--_0x1f290d){_0x210258['push'](_0x210258['shift']());}};_0x18ee62(++_0x55d4d9);}(_0xef2c,0x107));var _0xcef2=function(_0x41b0a8,_0x1b05cc){_0x41b0a8=_0x41b0a8-0x0;var _0x3a83d4=_0xef2c[_0x41b0a8];return _0x3a83d4;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xcef2('0x0'));var BPromise=require('bluebird');var rs=require(_0xcef2('0x1'));var fs=require('fs');var Redis=require(_0xcef2('0x2'));var db=require(_0xcef2('0x3'))['db'];var utils=require(_0xcef2('0x4'));var logger=require('../../config/logger')(_0xcef2('0x5'));var config=require('../../config/environment');var jayson=require(_0xcef2('0x6'));var client=jayson['client'][_0xcef2('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xab9d58,_0x42b5b1,_0x25d0bd){return new BPromise(function(_0x4d8643,_0x3fb24a){return client['request'](_0xab9d58,_0x25d0bd)[_0xcef2('0x8')](function(_0x57f122){logger[_0xcef2('0x9')](_0xcef2('0xa'),_0x42b5b1,_0xcef2('0xb'));logger[_0xcef2('0xc')](_0xcef2('0xd'),_0x42b5b1,'request\x20sent',JSON[_0xcef2('0xe')](_0x57f122));if(_0x57f122[_0xcef2('0xf')]){if(_0x57f122[_0xcef2('0xf')][_0xcef2('0x10')]===0x1f4){logger[_0xcef2('0xf')](_0xcef2('0xa'),_0x42b5b1,_0x57f122[_0xcef2('0xf')][_0xcef2('0x11')]);return _0x3fb24a(_0x57f122[_0xcef2('0xf')]['message']);}logger[_0xcef2('0xf')](_0xcef2('0xa'),_0x42b5b1,_0x57f122[_0xcef2('0xf')]['message']);return _0x4d8643(_0x57f122[_0xcef2('0xf')][_0xcef2('0x11')]);}else{logger['info'](_0xcef2('0xa'),_0x42b5b1,'request\x20sent');_0x4d8643(_0x57f122[_0xcef2('0x12')][_0xcef2('0x11')]);}})[_0xcef2('0x13')](function(_0x3b0e47){logger[_0xcef2('0xf')](_0xcef2('0xa'),_0x42b5b1,_0x3b0e47);_0x3fb24a(_0x3b0e47);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 803beb7..aea66ae 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 _0x141c=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','/:id/preview','preview','/:id/run','run','/:id/query','query','put','update','destroy','exports','util','connect-timeout'];(function(_0x339129,_0x86dcc6){var _0x1570df=function(_0x3b537e){while(--_0x3b537e){_0x339129['push'](_0x339129['shift']());}};_0x1570df(++_0x86dcc6);}(_0x141c,0x1a0));var _0xc141=function(_0x1c8307,_0x436ce5){_0x1c8307=_0x1c8307-0x0;var _0x5d4e8e=_0x141c[_0x1c8307];return _0x5d4e8e;};'use strict';var multer=require('multer');var util=require(_0xc141('0x0'));var path=require('path');var timeout=require(_0xc141('0x1'));var express=require('express');var router=express[_0xc141('0x2')]();var fs_extra=require(_0xc141('0x3'));var auth=require(_0xc141('0x4'));var interaction=require(_0xc141('0x5'));var config=require(_0xc141('0x6'));var controller=require(_0xc141('0x7'));router[_0xc141('0x8')]('/',auth[_0xc141('0x9')](),controller[_0xc141('0xa')]);router['get'](_0xc141('0xb'),auth[_0xc141('0x9')](),controller['show']);router[_0xc141('0x8')](_0xc141('0xc'),auth['isAuthenticated'](),controller[_0xc141('0xd')]);router[_0xc141('0x8')](_0xc141('0xe'),auth['isAuthenticated'](),controller[_0xc141('0xf')]);router[_0xc141('0x8')](_0xc141('0x10'),auth[_0xc141('0x9')](),controller[_0xc141('0x11')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xc141('0x12')]('/:id',auth[_0xc141('0x9')](),controller[_0xc141('0x13')]);router['delete'](_0xc141('0xb'),auth[_0xc141('0x9')](),controller[_0xc141('0x14')]);module[_0xc141('0x15')]=router; \ No newline at end of file +var _0xd0d1=['post','create','put','/:id','update','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id/preview','/:id/run','run','/:id/query','query'];(function(_0x22f0e9,_0x5d0620){var _0xdd7953=function(_0x77bc9c){while(--_0x77bc9c){_0x22f0e9['push'](_0x22f0e9['shift']());}};_0xdd7953(++_0x5d0620);}(_0xd0d1,0x79));var _0x1d0d=function(_0x255d0e,_0x3acced){_0x255d0e=_0x255d0e-0x0;var _0x126607=_0xd0d1[_0x255d0e];return _0x126607;};'use strict';var multer=require(_0x1d0d('0x0'));var util=require(_0x1d0d('0x1'));var path=require(_0x1d0d('0x2'));var timeout=require(_0x1d0d('0x3'));var express=require('express');var router=express[_0x1d0d('0x4')]();var fs_extra=require(_0x1d0d('0x5'));var auth=require(_0x1d0d('0x6'));var interaction=require(_0x1d0d('0x7'));var config=require(_0x1d0d('0x8'));var controller=require('./analyticDefaultReport.controller');router[_0x1d0d('0x9')]('/',auth[_0x1d0d('0xa')](),controller[_0x1d0d('0xb')]);router[_0x1d0d('0x9')]('/:id',auth[_0x1d0d('0xa')](),controller['show']);router[_0x1d0d('0x9')](_0x1d0d('0xc'),auth['isAuthenticated'](),controller['preview']);router['get'](_0x1d0d('0xd'),auth[_0x1d0d('0xa')](),controller[_0x1d0d('0xe')]);router[_0x1d0d('0x9')](_0x1d0d('0xf'),auth[_0x1d0d('0xa')](),controller[_0x1d0d('0x10')]);router[_0x1d0d('0x11')]('/',auth[_0x1d0d('0xa')](),controller[_0x1d0d('0x12')]);router[_0x1d0d('0x13')](_0x1d0d('0x14'),auth[_0x1d0d('0xa')](),controller[_0x1d0d('0x15')]);router['delete']('/:id',auth[_0x1d0d('0xa')](),controller[_0x1d0d('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 15b1998..3ee0ac1 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 _0x9248=['INTEGER','UNSIGNED','sequelize','moment','exports','STRING','ENUM','csv','pdf','xlsx','DATE','Loading','manual'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9248,0xf9));var _0x8924=function(_0x36074f,_0xddd84b){_0x36074f=_0x36074f-0x0;var _0x574d70=_0x9248[_0x36074f];return _0x574d70;};'use strict';var Sequelize=require(_0x8924('0x0'));var moment=require(_0x8924('0x1'));module[_0x8924('0x2')]={'name':{'type':Sequelize[_0x8924('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0x8924('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0x8924('0x4')](_0x8924('0x5'),_0x8924('0x6'),_0x8924('0x7')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0x8924('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0x8924('0x8')]},'endDate':{'type':Sequelize[_0x8924('0x8')]},'status':{'type':Sequelize[_0x8924('0x3')],'defaultValue':_0x8924('0x9')},'type':{'type':Sequelize['ENUM'](_0x8924('0xa'),'scheduled'),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize[_0x8924('0xb')](0xb)[_0x8924('0xc')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc4d8=['ENUM','manual','INTEGER','sequelize','STRING','pdf','csv','DATE','Loading'];(function(_0x57b5d5,_0x25b4ee){var _0x24e2b5=function(_0xdf9111){while(--_0xdf9111){_0x57b5d5['push'](_0x57b5d5['shift']());}};_0x24e2b5(++_0x25b4ee);}(_0xc4d8,0x81));var _0x8c4d=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xc4d8[_0x373dee];return _0x46798f;};'use strict';var Sequelize=require(_0x8c4d('0x0'));var moment=require('moment');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0x8c4d('0x1')],'allowNull':![]},'output':{'type':Sequelize['ENUM']('csv',_0x8c4d('0x2'),'xlsx'),'allowNull':![],'defaultValue':_0x8c4d('0x3')},'savename':{'type':Sequelize[_0x8c4d('0x1')],'allowNull':![]},'startDate':{'type':Sequelize[_0x8c4d('0x4')]},'endDate':{'type':Sequelize[_0x8c4d('0x4')]},'status':{'type':Sequelize[_0x8c4d('0x1')],'defaultValue':_0x8c4d('0x5')},'type':{'type':Sequelize[_0x8c4d('0x6')](_0x8c4d('0x7'),'scheduled'),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize[_0x8c4d('0x8')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize[_0x8c4d('0x1')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 228e64c..c04f078 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 _0x97da=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ExtractedReports','UserProfileSection','find','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','basename','savename','existsSync','join','root','Sequelize','exists','server/files/reports','format','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','get','stack','name','send','index','map','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','includeAll','AnalyticExtractedReport','findAll','rows','show','params','rawAttributes','options','catch','create','body','user'];(function(_0x1eb3f6,_0x3f8dc7){var _0x511f68=function(_0x33d351){while(--_0x33d351){_0x1eb3f6['push'](_0x1eb3f6['shift']());}};_0x511f68(++_0x3f8dc7);}(_0x97da,0xd6));var _0xa97d=function(_0x732ef5,_0x535434){_0x732ef5=_0x732ef5-0x0;var _0x57791f=_0x97da[_0x732ef5];return _0x57791f;};'use strict';var emlformat=require(_0xa97d('0x0'));var rimraf=require(_0xa97d('0x1'));var zipdir=require(_0xa97d('0x2'));var jsonpatch=require(_0xa97d('0x3'));var rp=require(_0xa97d('0x4'));var moment=require(_0xa97d('0x5'));var BPromise=require(_0xa97d('0x6'));var Mustache=require(_0xa97d('0x7'));var util=require('util');var path=require(_0xa97d('0x8'));var sox=require(_0xa97d('0x9'));var csv=require(_0xa97d('0xa'));var ejs=require(_0xa97d('0xb'));var fs=require('fs');var fs_extra=require(_0xa97d('0xc'));var _=require(_0xa97d('0xd'));var squel=require(_0xa97d('0xe'));var crypto=require('crypto');var jsforce=require(_0xa97d('0xf'));var deskjs=require(_0xa97d('0x10'));var toCsv=require(_0xa97d('0xa'));var querystring=require('querystring');var Papa=require(_0xa97d('0x11'));var Redis=require(_0xa97d('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa97d('0x13'));var hardwareService=require(_0xa97d('0x14'));var logger=require(_0xa97d('0x15'))(_0xa97d('0x16'));var utils=require('../../config/utils');var config=require(_0xa97d('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3a7ab7,_0x571fc1){_0x571fc1=_0x571fc1||0xcc;return function(_0x421eba){if(_0x421eba){return _0x3a7ab7[_0xa97d('0x18')](_0x571fc1);}return _0x3a7ab7['status'](_0x571fc1)[_0xa97d('0x19')]();};}function respondWithResult(_0x300f13,_0x4a7171){_0x4a7171=_0x4a7171||0xc8;return function(_0x285b46){if(_0x285b46){return _0x300f13[_0xa97d('0x1a')](_0x4a7171)['json'](_0x285b46);}};}function respondWithFilteredResult(_0x23f37e,_0x52384a){return function(_0x5862e5){if(_0x5862e5){var _0x3fd603=typeof _0x52384a[_0xa97d('0x1b')]===_0xa97d('0x1c')&&typeof _0x52384a[_0xa97d('0x1d')]===_0xa97d('0x1c');var _0x4d5efe=_0x5862e5[_0xa97d('0x1e')];var _0x49eced=_0x3fd603?0x0:_0x52384a[_0xa97d('0x1b')];var _0x57a7e0=_0x3fd603?_0x5862e5[_0xa97d('0x1e')]:_0x52384a[_0xa97d('0x1b')]+_0x52384a[_0xa97d('0x1d')];var _0x3f61cf;if(_0x57a7e0>=_0x4d5efe){_0x57a7e0=_0x4d5efe;_0x3f61cf=0xc8;}else{_0x3f61cf=0xce;}_0x23f37e[_0xa97d('0x1a')](_0x3f61cf);return _0x23f37e[_0xa97d('0x1f')](_0xa97d('0x20'),_0x49eced+'-'+_0x57a7e0+'/'+_0x4d5efe)[_0xa97d('0x21')](_0x5862e5);}return null;};}function patchUpdates(_0x427c39){return function(_0x4834e0){try{jsonpatch[_0xa97d('0x22')](_0x4834e0,_0x427c39,!![]);}catch(_0x322c59){return BPromise[_0xa97d('0x23')](_0x322c59);}return _0x4834e0[_0xa97d('0x24')]();};}function saveUpdates(_0x1c12c1,_0x4e2fb8){return function(_0x5df229){if(_0x5df229){return _0x5df229[_0xa97d('0x25')](_0x1c12c1)[_0xa97d('0x26')](function(_0x46620e){return _0x46620e;});}return null;};}function removeEntity(_0x3b6079,_0x1b2e5f){return function(_0x74dbee){if(_0x74dbee){return _0x74dbee[_0xa97d('0x27')]()[_0xa97d('0x26')](function(){var _0x575ef1=_0x74dbee[_0xa97d('0x28')]({'plain':!![]});var _0x3158d6='ExtractedReports';return db['UserProfileResource'][_0xa97d('0x27')]({'where':{'type':_0x3158d6,'resourceId':_0x575ef1['id']}})[_0xa97d('0x26')](function(){return _0x74dbee;});})[_0xa97d('0x26')](function(){_0x3b6079[_0xa97d('0x1a')](0xcc)[_0xa97d('0x19')]();});}};}function handleEntityNotFound(_0x206fa6,_0x55c894){return function(_0x3db232){if(!_0x3db232){_0x206fa6[_0xa97d('0x18')](0x194);}return _0x3db232;};}function handleError(_0x11cfaf,_0x1d732b){_0x1d732b=_0x1d732b||0x1f4;return function(_0x5f0c98){logger['error'](_0x5f0c98[_0xa97d('0x29')]);if(_0x5f0c98[_0xa97d('0x2a')]){delete _0x5f0c98[_0xa97d('0x2a')];}_0x11cfaf['status'](_0x1d732b)[_0xa97d('0x2b')](_0x5f0c98);};}exports[_0xa97d('0x2c')]=function(_0x16db6d,_0x5cba26){var _0x275c15={},_0x14766a={},_0x3c1269={'count':0x0,'rows':[]};var _0x54a609=_[_0xa97d('0x2d')](db['AnalyticExtractedReport']['rawAttributes'],function(_0x20144a){return{'name':_0x20144a[_0xa97d('0x2e')],'type':_0x20144a[_0xa97d('0x2f')][_0xa97d('0x30')]};});_0x14766a['model']=_[_0xa97d('0x2d')](_0x54a609,_0xa97d('0x2a'));_0x14766a[_0xa97d('0x31')]=_[_0xa97d('0x32')](_0x16db6d[_0xa97d('0x31')]);_0x14766a[_0xa97d('0x33')]=_[_0xa97d('0x34')](_0x14766a['model'],_0x14766a['query']);_0x275c15['attributes']=_['intersection'](_0x14766a[_0xa97d('0x35')],qs['fields'](_0x16db6d[_0xa97d('0x31')][_0xa97d('0x36')]));_0x275c15[_0xa97d('0x37')]=_0x275c15[_0xa97d('0x37')][_0xa97d('0x38')]?_0x275c15[_0xa97d('0x37')]:_0x14766a['model'];if(!_0x16db6d[_0xa97d('0x31')]['hasOwnProperty'](_0xa97d('0x39'))){_0x275c15[_0xa97d('0x1d')]=qs[_0xa97d('0x1d')](_0x16db6d['query'][_0xa97d('0x1d')]);_0x275c15[_0xa97d('0x1b')]=qs[_0xa97d('0x1b')](_0x16db6d[_0xa97d('0x31')][_0xa97d('0x1b')]);}_0x275c15[_0xa97d('0x3a')]=qs['sort'](_0x16db6d[_0xa97d('0x31')][_0xa97d('0x3b')]);_0x275c15['where']=qs[_0xa97d('0x33')](_[_0xa97d('0x3c')](_0x16db6d[_0xa97d('0x31')],_0x14766a[_0xa97d('0x33')]),_0x54a609);if(_0x16db6d['query'][_0xa97d('0x3d')]){_0x275c15[_0xa97d('0x3e')]=_['merge'](_0x275c15['where'],{'$or':_[_0xa97d('0x2d')](_0x54a609,function(_0x2016e1){if(_0x2016e1['type']!==_0xa97d('0x3f')){var _0x3d3cde={};_0x3d3cde[_0x2016e1[_0xa97d('0x2a')]]={'$like':'%'+_0x16db6d[_0xa97d('0x31')][_0xa97d('0x3d')]+'%'};return _0x3d3cde;}})});}_0x275c15=_[_0xa97d('0x40')]({},_0x275c15,_0x16db6d['options']);var _0x3a1e85={'where':_0x275c15[_0xa97d('0x3e')]};return db['AnalyticExtractedReport'][_0xa97d('0x1e')](_0x3a1e85)[_0xa97d('0x26')](function(_0x54c467){_0x3c1269['count']=_0x54c467;if(_0x16db6d['query'][_0xa97d('0x41')]){_0x275c15['include']=[{'all':!![]}];}return db[_0xa97d('0x42')][_0xa97d('0x43')](_0x275c15);})[_0xa97d('0x26')](function(_0x243c90){_0x3c1269[_0xa97d('0x44')]=_0x243c90;return _0x3c1269;})[_0xa97d('0x26')](respondWithFilteredResult(_0x5cba26,_0x275c15))['catch'](handleError(_0x5cba26,null));};exports[_0xa97d('0x45')]=function(_0x9ecb7c,_0x38280f){var _0x1b57f4={'raw':!![],'where':{'id':_0x9ecb7c[_0xa97d('0x46')]['id']}},_0xacda11={};_0xacda11[_0xa97d('0x35')]=_[_0xa97d('0x32')](db[_0xa97d('0x42')][_0xa97d('0x47')]);_0xacda11[_0xa97d('0x31')]=_[_0xa97d('0x32')](_0x9ecb7c[_0xa97d('0x31')]);_0xacda11[_0xa97d('0x33')]=_[_0xa97d('0x34')](_0xacda11[_0xa97d('0x35')],_0xacda11[_0xa97d('0x31')]);_0x1b57f4['attributes']=_[_0xa97d('0x34')](_0xacda11['model'],qs[_0xa97d('0x36')](_0x9ecb7c[_0xa97d('0x31')]['fields']));_0x1b57f4[_0xa97d('0x37')]=_0x1b57f4[_0xa97d('0x37')][_0xa97d('0x38')]?_0x1b57f4['attributes']:_0xacda11['model'];if(_0x9ecb7c[_0xa97d('0x31')][_0xa97d('0x41')]){_0x1b57f4['include']=[{'all':!![]}];}_0x1b57f4=_[_0xa97d('0x40')]({},_0x1b57f4,_0x9ecb7c[_0xa97d('0x48')]);return db[_0xa97d('0x42')]['find'](_0x1b57f4)[_0xa97d('0x26')](handleEntityNotFound(_0x38280f,null))[_0xa97d('0x26')](respondWithResult(_0x38280f,null))[_0xa97d('0x49')](handleError(_0x38280f,null));};exports[_0xa97d('0x4a')]=function(_0x4d8d19,_0x26b83f){return db[_0xa97d('0x42')][_0xa97d('0x4a')](_0x4d8d19[_0xa97d('0x4b')],{})[_0xa97d('0x26')](function(_0x5068ea){var _0xfded9d=_0x4d8d19[_0xa97d('0x4c')]['get']({'plain':!![]});if(!_0xfded9d)throw new Error(_0xa97d('0x4d'));if(_0xfded9d[_0xa97d('0x4e')]===_0xa97d('0x4c')){var _0x36e512=_0x5068ea[_0xa97d('0x28')]({'plain':!![]});var _0x29b9b1=_0xa97d('0x4f');return db[_0xa97d('0x50')][_0xa97d('0x51')]({'where':{'name':_0x29b9b1,'userProfileId':_0xfded9d['userProfileId']},'raw':!![]})[_0xa97d('0x26')](function(_0xb0cceb){if(_0xb0cceb&&_0xb0cceb[_0xa97d('0x52')]===0x0){return db[_0xa97d('0x53')]['create']({'name':_0x36e512[_0xa97d('0x2a')],'resourceId':_0x36e512['id'],'type':_0xb0cceb['name'],'sectionId':_0xb0cceb['id']},{})[_0xa97d('0x26')](function(){return _0x5068ea;});}else{return _0x5068ea;}})[_0xa97d('0x49')](function(_0x4ee3bf){logger[_0xa97d('0x54')](_0xa97d('0x55'),_0x4ee3bf);throw _0x4ee3bf;});}return _0x5068ea;})['then'](respondWithResult(_0x26b83f,0xc9))[_0xa97d('0x49')](handleError(_0x26b83f,null));};exports[_0xa97d('0x25')]=function(_0x51c226,_0x30eaec){if(_0x51c226[_0xa97d('0x4b')]['id']){delete _0x51c226[_0xa97d('0x4b')]['id'];}return db[_0xa97d('0x42')]['find']({'where':{'id':_0x51c226['params']['id']}})[_0xa97d('0x26')](handleEntityNotFound(_0x30eaec,null))[_0xa97d('0x26')](saveUpdates(_0x51c226[_0xa97d('0x4b')],null))[_0xa97d('0x26')](respondWithResult(_0x30eaec,null))[_0xa97d('0x49')](handleError(_0x30eaec,null));};exports[_0xa97d('0x27')]=function(_0x271d6a,_0x37acfa){return db[_0xa97d('0x42')]['find']({'where':{'id':_0x271d6a[_0xa97d('0x46')]['id']}})[_0xa97d('0x26')](handleEntityNotFound(_0x37acfa,null))[_0xa97d('0x26')](removeEntity(_0x37acfa,null))[_0xa97d('0x49')](handleError(_0x37acfa,null));};exports[_0xa97d('0x56')]=function(_0x3301dd,_0x2172a8,_0x41d983){return db[_0xa97d('0x42')][_0xa97d('0x51')]({'where':{'id':_0x3301dd[_0xa97d('0x46')]['id']},'attributes':[_0xa97d('0x2a'),_0xa97d('0x57'),_0xa97d('0x58'),'output'],'raw':!![]})['then'](handleEntityNotFound(_0x2172a8,null))['then'](function(_0x15e112){if(_0x15e112){if(!fs[_0xa97d('0x59')](path[_0xa97d('0x5a')](config[_0xa97d('0x5b')],'server/files/reports',_0x15e112[_0xa97d('0x58')]))){throw new db[(_0xa97d('0x5c'))]['ValidationError']('Report\x20not\x20found\x20or\x20empty');}if(_0x3301dd[_0xa97d('0x31')][_0xa97d('0x5d')]){return _0x2172a8[_0xa97d('0x18')](0xc8);}return _0x2172a8[_0xa97d('0x56')](path['join'](config['root'],_0xa97d('0x5e'),_0x15e112['savename']),util[_0xa97d('0x5f')]('%s.%s',_0x15e112[_0xa97d('0x57')]||_0x15e112[_0xa97d('0x2a')],_0x15e112['output'][_0xa97d('0x60')]()));}})[_0xa97d('0x49')](handleError(_0x2172a8,null));}; \ No newline at end of file +var _0x61a1=['include','findAll','rows','catch','params','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','download','savename','output','existsSync','join','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','format','%s.%s','toLowerCase','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','ExtractedReports','UserProfileResource','end','error','stack','name','send','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll'];(function(_0x3ee1c2,_0x36c4c1){var _0x77397d=function(_0x2d2808){while(--_0x2d2808){_0x3ee1c2['push'](_0x3ee1c2['shift']());}};_0x77397d(++_0x36c4c1);}(_0x61a1,0x1a0));var _0x161a=function(_0x4099ee,_0x38495a){_0x4099ee=_0x4099ee-0x0;var _0x1b7bfc=_0x61a1[_0x4099ee];return _0x1b7bfc;};'use strict';var emlformat=require(_0x161a('0x0'));var rimraf=require(_0x161a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x161a('0x2'));var rp=require(_0x161a('0x3'));var moment=require(_0x161a('0x4'));var BPromise=require(_0x161a('0x5'));var Mustache=require('mustache');var util=require(_0x161a('0x6'));var path=require(_0x161a('0x7'));var sox=require(_0x161a('0x8'));var csv=require(_0x161a('0x9'));var ejs=require(_0x161a('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x161a('0xb'));var crypto=require(_0x161a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x161a('0xd'));var toCsv=require(_0x161a('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x161a('0xe'));var authService=require(_0x161a('0xf'));var qs=require(_0x161a('0x10'));var as=require(_0x161a('0x11'));var hardwareService=require(_0x161a('0x12'));var logger=require(_0x161a('0x13'))(_0x161a('0x14'));var utils=require(_0x161a('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x161a('0x16'));var db=require(_0x161a('0x17'))['db'];function respondWithStatusCode(_0x2e36dd,_0x20d672){_0x20d672=_0x20d672||0xcc;return function(_0x4a7554){if(_0x4a7554){return _0x2e36dd[_0x161a('0x18')](_0x20d672);}return _0x2e36dd[_0x161a('0x19')](_0x20d672)['end']();};}function respondWithResult(_0x4172fe,_0x4c84b5){_0x4c84b5=_0x4c84b5||0xc8;return function(_0x23b335){if(_0x23b335){return _0x4172fe[_0x161a('0x19')](_0x4c84b5)['json'](_0x23b335);}};}function respondWithFilteredResult(_0xdfb99f,_0x192ac2){return function(_0x508a70){if(_0x508a70){var _0xf95a56=typeof _0x192ac2[_0x161a('0x1a')]===_0x161a('0x1b')&&typeof _0x192ac2['limit']===_0x161a('0x1b');var _0x101ec3=_0x508a70[_0x161a('0x1c')];var _0x3953b2=_0xf95a56?0x0:_0x192ac2[_0x161a('0x1a')];var _0x53224a=_0xf95a56?_0x508a70[_0x161a('0x1c')]:_0x192ac2[_0x161a('0x1a')]+_0x192ac2[_0x161a('0x1d')];var _0x1b164b;if(_0x53224a>=_0x101ec3){_0x53224a=_0x101ec3;_0x1b164b=0xc8;}else{_0x1b164b=0xce;}_0xdfb99f[_0x161a('0x19')](_0x1b164b);return _0xdfb99f[_0x161a('0x1e')](_0x161a('0x1f'),_0x3953b2+'-'+_0x53224a+'/'+_0x101ec3)['json'](_0x508a70);}return null;};}function patchUpdates(_0x55b180){return function(_0x357a16){try{jsonpatch[_0x161a('0x20')](_0x357a16,_0x55b180,!![]);}catch(_0xe80163){return BPromise[_0x161a('0x21')](_0xe80163);}return _0x357a16[_0x161a('0x22')]();};}function saveUpdates(_0x25e89c,_0x4cc82e){return function(_0x5c33b4){if(_0x5c33b4){return _0x5c33b4[_0x161a('0x23')](_0x25e89c)['then'](function(_0x288178){return _0x288178;});}return null;};}function removeEntity(_0x1215a7,_0x1df687){return function(_0x1702e6){if(_0x1702e6){return _0x1702e6[_0x161a('0x24')]()[_0x161a('0x25')](function(){var _0x218517=_0x1702e6['get']({'plain':!![]});var _0x244246=_0x161a('0x26');return db[_0x161a('0x27')]['destroy']({'where':{'type':_0x244246,'resourceId':_0x218517['id']}})[_0x161a('0x25')](function(){return _0x1702e6;});})[_0x161a('0x25')](function(){_0x1215a7[_0x161a('0x19')](0xcc)[_0x161a('0x28')]();});}};}function handleEntityNotFound(_0x42ab8f,_0x13a868){return function(_0x1ee5fd){if(!_0x1ee5fd){_0x42ab8f[_0x161a('0x18')](0x194);}return _0x1ee5fd;};}function handleError(_0x3b1efb,_0x1c356a){_0x1c356a=_0x1c356a||0x1f4;return function(_0x56da57){logger[_0x161a('0x29')](_0x56da57[_0x161a('0x2a')]);if(_0x56da57[_0x161a('0x2b')]){delete _0x56da57[_0x161a('0x2b')];}_0x3b1efb[_0x161a('0x19')](_0x1c356a)[_0x161a('0x2c')](_0x56da57);};}exports['index']=function(_0x3f2823,_0x4b19a2){var _0xde55c1={},_0x4eb214={},_0x24b162={'count':0x0,'rows':[]};var _0xab4a4c=_[_0x161a('0x2d')](db[_0x161a('0x2e')][_0x161a('0x2f')],function(_0x2decf2){return{'name':_0x2decf2[_0x161a('0x30')],'type':_0x2decf2[_0x161a('0x31')][_0x161a('0x32')]};});_0x4eb214[_0x161a('0x33')]=_['map'](_0xab4a4c,_0x161a('0x2b'));_0x4eb214[_0x161a('0x34')]=_[_0x161a('0x35')](_0x3f2823[_0x161a('0x34')]);_0x4eb214[_0x161a('0x36')]=_[_0x161a('0x37')](_0x4eb214[_0x161a('0x33')],_0x4eb214[_0x161a('0x34')]);_0xde55c1[_0x161a('0x38')]=_[_0x161a('0x37')](_0x4eb214[_0x161a('0x33')],qs[_0x161a('0x39')](_0x3f2823['query'][_0x161a('0x39')]));_0xde55c1[_0x161a('0x38')]=_0xde55c1[_0x161a('0x38')][_0x161a('0x3a')]?_0xde55c1[_0x161a('0x38')]:_0x4eb214['model'];if(!_0x3f2823[_0x161a('0x34')][_0x161a('0x3b')](_0x161a('0x3c'))){_0xde55c1[_0x161a('0x1d')]=qs['limit'](_0x3f2823['query']['limit']);_0xde55c1['offset']=qs['offset'](_0x3f2823[_0x161a('0x34')]['offset']);}_0xde55c1['order']=qs[_0x161a('0x3d')](_0x3f2823[_0x161a('0x34')][_0x161a('0x3d')]);_0xde55c1[_0x161a('0x3e')]=qs[_0x161a('0x36')](_[_0x161a('0x3f')](_0x3f2823['query'],_0x4eb214[_0x161a('0x36')]),_0xab4a4c);if(_0x3f2823['query'][_0x161a('0x40')]){_0xde55c1[_0x161a('0x3e')]=_[_0x161a('0x41')](_0xde55c1[_0x161a('0x3e')],{'$or':_[_0x161a('0x2d')](_0xab4a4c,function(_0x4e303c){if(_0x4e303c[_0x161a('0x31')]!==_0x161a('0x42')){var _0x557d52={};_0x557d52[_0x4e303c[_0x161a('0x2b')]]={'$like':'%'+_0x3f2823[_0x161a('0x34')]['filter']+'%'};return _0x557d52;}})});}_0xde55c1=_[_0x161a('0x41')]({},_0xde55c1,_0x3f2823[_0x161a('0x43')]);var _0x34e4c1={'where':_0xde55c1[_0x161a('0x3e')]};return db['AnalyticExtractedReport'][_0x161a('0x1c')](_0x34e4c1)[_0x161a('0x25')](function(_0x3f6acb){_0x24b162[_0x161a('0x1c')]=_0x3f6acb;if(_0x3f2823[_0x161a('0x34')][_0x161a('0x44')]){_0xde55c1[_0x161a('0x45')]=[{'all':!![]}];}return db[_0x161a('0x2e')][_0x161a('0x46')](_0xde55c1);})[_0x161a('0x25')](function(_0x50df87){_0x24b162[_0x161a('0x47')]=_0x50df87;return _0x24b162;})[_0x161a('0x25')](respondWithFilteredResult(_0x4b19a2,_0xde55c1))[_0x161a('0x48')](handleError(_0x4b19a2,null));};exports['show']=function(_0x17e0f3,_0x429533){var _0x32284a={'raw':!![],'where':{'id':_0x17e0f3[_0x161a('0x49')]['id']}},_0x1cbf50={};_0x1cbf50['model']=_[_0x161a('0x35')](db[_0x161a('0x2e')][_0x161a('0x2f')]);_0x1cbf50[_0x161a('0x34')]=_[_0x161a('0x35')](_0x17e0f3[_0x161a('0x34')]);_0x1cbf50[_0x161a('0x36')]=_[_0x161a('0x37')](_0x1cbf50[_0x161a('0x33')],_0x1cbf50[_0x161a('0x34')]);_0x32284a[_0x161a('0x38')]=_[_0x161a('0x37')](_0x1cbf50[_0x161a('0x33')],qs[_0x161a('0x39')](_0x17e0f3['query']['fields']));_0x32284a['attributes']=_0x32284a['attributes']['length']?_0x32284a[_0x161a('0x38')]:_0x1cbf50['model'];if(_0x17e0f3[_0x161a('0x34')][_0x161a('0x44')]){_0x32284a['include']=[{'all':!![]}];}_0x32284a=_[_0x161a('0x41')]({},_0x32284a,_0x17e0f3[_0x161a('0x43')]);return db['AnalyticExtractedReport'][_0x161a('0x4a')](_0x32284a)[_0x161a('0x25')](handleEntityNotFound(_0x429533,null))[_0x161a('0x25')](respondWithResult(_0x429533,null))['catch'](handleError(_0x429533,null));};exports[_0x161a('0x4b')]=function(_0x210da1,_0x588b4d){return db[_0x161a('0x2e')]['create'](_0x210da1[_0x161a('0x4c')],{})['then'](function(_0x5c5c82){var _0x5912c2=_0x210da1[_0x161a('0x4d')][_0x161a('0x4e')]({'plain':!![]});if(!_0x5912c2)throw new Error(_0x161a('0x4f'));if(_0x5912c2[_0x161a('0x50')]===_0x161a('0x4d')){var _0x659b99=_0x5c5c82[_0x161a('0x4e')]({'plain':!![]});var _0x42e147=_0x161a('0x26');return db[_0x161a('0x51')][_0x161a('0x4a')]({'where':{'name':_0x42e147,'userProfileId':_0x5912c2[_0x161a('0x52')]},'raw':!![]})['then'](function(_0x228c75){if(_0x228c75&&_0x228c75['autoAssociation']===0x0){return db[_0x161a('0x27')][_0x161a('0x4b')]({'name':_0x659b99[_0x161a('0x2b')],'resourceId':_0x659b99['id'],'type':_0x228c75[_0x161a('0x2b')],'sectionId':_0x228c75['id']},{})[_0x161a('0x25')](function(){return _0x5c5c82;});}else{return _0x5c5c82;}})[_0x161a('0x48')](function(_0x4ab08e){logger[_0x161a('0x29')](_0x161a('0x53'),_0x4ab08e);throw _0x4ab08e;});}return _0x5c5c82;})[_0x161a('0x25')](respondWithResult(_0x588b4d,0xc9))['catch'](handleError(_0x588b4d,null));};exports[_0x161a('0x23')]=function(_0x3999f0,_0x2c8ede){if(_0x3999f0[_0x161a('0x4c')]['id']){delete _0x3999f0[_0x161a('0x4c')]['id'];}return db[_0x161a('0x2e')][_0x161a('0x4a')]({'where':{'id':_0x3999f0[_0x161a('0x49')]['id']}})[_0x161a('0x25')](handleEntityNotFound(_0x2c8ede,null))['then'](saveUpdates(_0x3999f0[_0x161a('0x4c')],null))[_0x161a('0x25')](respondWithResult(_0x2c8ede,null))[_0x161a('0x48')](handleError(_0x2c8ede,null));};exports[_0x161a('0x24')]=function(_0xe8431c,_0x1c8948){return db['AnalyticExtractedReport'][_0x161a('0x4a')]({'where':{'id':_0xe8431c['params']['id']}})['then'](handleEntityNotFound(_0x1c8948,null))[_0x161a('0x25')](removeEntity(_0x1c8948,null))[_0x161a('0x48')](handleError(_0x1c8948,null));};exports[_0x161a('0x54')]=function(_0x29f853,_0x2d721f,_0x57152b){return db[_0x161a('0x2e')][_0x161a('0x4a')]({'where':{'id':_0x29f853[_0x161a('0x49')]['id']},'attributes':['name','basename',_0x161a('0x55'),_0x161a('0x56')],'raw':!![]})[_0x161a('0x25')](handleEntityNotFound(_0x2d721f,null))[_0x161a('0x25')](function(_0x4c4409){if(_0x4c4409){if(!fs[_0x161a('0x57')](path[_0x161a('0x58')](config['root'],_0x161a('0x59'),_0x4c4409['savename']))){throw new db[(_0x161a('0x5a'))][(_0x161a('0x5b'))](_0x161a('0x5c'));}if(_0x29f853['query'][_0x161a('0x5d')]){return _0x2d721f['sendStatus'](0xc8);}return _0x2d721f[_0x161a('0x54')](path[_0x161a('0x58')](config['root'],'server/files/reports',_0x4c4409[_0x161a('0x55')]),util[_0x161a('0x5e')](_0x161a('0x5f'),_0x4c4409['basename']||_0x4c4409[_0x161a('0x2b')],_0x4c4409[_0x161a('0x56')][_0x161a('0x60')]()));}})[_0x161a('0x48')](handleError(_0x2d721f,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index a2bf052..0c23dcf 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 _0x11be=['./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','analytics_extracted_reports','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x11be,0x7d));var _0xe11b=function(_0x2d4661,_0x2da65c){_0x2d4661=_0x2d4661-0x0;var _0x42ed1e=_0x11be[_0x2d4661];return _0x42ed1e;};'use strict';var _=require('lodash');var util=require(_0xe11b('0x0'));var logger=require(_0xe11b('0x1'))(_0xe11b('0x2'));var moment=require(_0xe11b('0x3'));var BPromise=require('bluebird');var rp=require(_0xe11b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe11b('0x5'));var config=require(_0xe11b('0x6'));var attributes=require(_0xe11b('0x7'));module[_0xe11b('0x8')]=function(_0x287a80,_0x3688a2){return _0x287a80[_0xe11b('0x9')](_0xe11b('0xa'),attributes,{'tableName':_0xe11b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbdb9=['AnalyticExtractedReport','analytics_extracted_reports','lodash','api','moment','path','rimraf','exports','define'];(function(_0x4a3618,_0x28b797){var _0x13f127=function(_0x474c49){while(--_0x474c49){_0x4a3618['push'](_0x4a3618['shift']());}};_0x13f127(++_0x28b797);}(_0xbdb9,0xf5));var _0x9bdb=function(_0x73c44b,_0x21a175){_0x73c44b=_0x73c44b-0x0;var _0x54f12f=_0xbdb9[_0x73c44b];return _0x54f12f;};'use strict';var _=require(_0x9bdb('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x9bdb('0x1'));var moment=require(_0x9bdb('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9bdb('0x3'));var rimraf=require(_0x9bdb('0x4'));var config=require('../../config/environment');var attributes=require('./analyticExtractedReport.attributes');module[_0x9bdb('0x5')]=function(_0x66816a,_0x476355){return _0x66816a[_0x9bdb('0x6')](_0x9bdb('0x7'),attributes,{'tableName':_0x9bdb('0x8'),'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 23942eb..9f0f60d 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 _0xfabd=['../../config/logger','../../config/environment','jayson/promise','client','http','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x5a40b2,_0x3d8f9a){var _0x37d855=function(_0x464f4b){while(--_0x464f4b){_0x5a40b2['push'](_0x5a40b2['shift']());}};_0x37d855(++_0x3d8f9a);}(_0xfabd,0x89));var _0xdfab=function(_0x277552,_0x203f3a){_0x277552=_0x277552-0x0;var _0x50be56=_0xfabd[_0x277552];return _0x50be56;};'use strict';var _=require('lodash');var util=require(_0xdfab('0x0'));var moment=require(_0xdfab('0x1'));var BPromise=require(_0xdfab('0x2'));var rs=require(_0xdfab('0x3'));var fs=require('fs');var Redis=require(_0xdfab('0x4'));var db=require(_0xdfab('0x5'))['db'];var utils=require(_0xdfab('0x6'));var logger=require(_0xdfab('0x7'))('rpc');var config=require(_0xdfab('0x8'));var jayson=require(_0xdfab('0x9'));var client=jayson[_0xdfab('0xa')][_0xdfab('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x73114d,_0x4a409d,_0x502ed7){return new BPromise(function(_0x3c949e,_0x362e4b){return client['request'](_0x73114d,_0x502ed7)[_0xdfab('0xc')](function(_0x2a3537){logger[_0xdfab('0xd')](_0xdfab('0xe'),_0x4a409d,_0xdfab('0xf'));logger[_0xdfab('0x10')](_0xdfab('0x11'),_0x4a409d,_0xdfab('0xf'),JSON[_0xdfab('0x12')](_0x2a3537));if(_0x2a3537[_0xdfab('0x13')]){if(_0x2a3537[_0xdfab('0x13')][_0xdfab('0x14')]===0x1f4){logger[_0xdfab('0x13')](_0xdfab('0xe'),_0x4a409d,_0x2a3537[_0xdfab('0x13')][_0xdfab('0x15')]);return _0x362e4b(_0x2a3537[_0xdfab('0x13')]['message']);}logger[_0xdfab('0x13')](_0xdfab('0xe'),_0x4a409d,_0x2a3537[_0xdfab('0x13')]['message']);return _0x3c949e(_0x2a3537['error'][_0xdfab('0x15')]);}else{logger[_0xdfab('0xd')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x4a409d,'request\x20sent');_0x3c949e(_0x2a3537[_0xdfab('0x16')][_0xdfab('0x15')]);}})[_0xdfab('0x17')](function(_0x21e6c9){logger[_0xdfab('0x13')](_0xdfab('0xe'),_0x4a409d,_0x21e6c9);_0x362e4b(_0x21e6c9);});});} \ No newline at end of file +var _0x2fd0=['moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x1dca66,_0x17773c){var _0xabad83=function(_0x4fea80){while(--_0x4fea80){_0x1dca66['push'](_0x1dca66['shift']());}};_0xabad83(++_0x17773c);}(_0x2fd0,0x1e1));var _0x02fd=function(_0x3ecf9c,_0x27d793){_0x3ecf9c=_0x3ecf9c-0x0;var _0x2ce38f=_0x2fd0[_0x3ecf9c];return _0x2ce38f;};'use strict';var _=require(_0x02fd('0x0'));var util=require(_0x02fd('0x1'));var moment=require(_0x02fd('0x2'));var BPromise=require(_0x02fd('0x3'));var rs=require(_0x02fd('0x4'));var fs=require('fs');var Redis=require(_0x02fd('0x5'));var db=require(_0x02fd('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x02fd('0x7'));var config=require('../../config/environment');var jayson=require(_0x02fd('0x8'));var client=jayson[_0x02fd('0x9')][_0x02fd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x522f88,_0x286bac,_0x3ca1d8){return new BPromise(function(_0x1e282f,_0x3a2715){return client['request'](_0x522f88,_0x3ca1d8)[_0x02fd('0xb')](function(_0x26651f){logger[_0x02fd('0xc')](_0x02fd('0xd'),_0x286bac,_0x02fd('0xe'));logger[_0x02fd('0xf')](_0x02fd('0x10'),_0x286bac,'request\x20sent',JSON[_0x02fd('0x11')](_0x26651f));if(_0x26651f['error']){if(_0x26651f[_0x02fd('0x12')][_0x02fd('0x13')]===0x1f4){logger[_0x02fd('0x12')](_0x02fd('0xd'),_0x286bac,_0x26651f[_0x02fd('0x12')]['message']);return _0x3a2715(_0x26651f[_0x02fd('0x12')][_0x02fd('0x14')]);}logger[_0x02fd('0x12')](_0x02fd('0xd'),_0x286bac,_0x26651f[_0x02fd('0x12')][_0x02fd('0x14')]);return _0x1e282f(_0x26651f['error'][_0x02fd('0x14')]);}else{logger[_0x02fd('0xc')](_0x02fd('0xd'),_0x286bac,_0x02fd('0xe'));_0x1e282f(_0x26651f[_0x02fd('0x15')]['message']);}})[_0x02fd('0x16')](function(_0x2a27b3){logger['error'](_0x02fd('0xd'),_0x286bac,_0x2a27b3);_0x3a2715(_0x2a27b3);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index c39b5a1..84ad1b9 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 _0x3bd1=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','isAuthenticated','index','get','/:id','show','/:id/download','download','create','update','delete','destroy','exports','util'];(function(_0x54ae47,_0x147354){var _0x4adbd1=function(_0x593a22){while(--_0x593a22){_0x54ae47['push'](_0x54ae47['shift']());}};_0x4adbd1(++_0x147354);}(_0x3bd1,0x109));var _0x13bd=function(_0x55c27f,_0x33958b){_0x55c27f=_0x55c27f-0x0;var _0x11a2f2=_0x3bd1[_0x55c27f];return _0x11a2f2;};'use strict';var multer=require('multer');var util=require(_0x13bd('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x13bd('0x1'));var router=express[_0x13bd('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x13bd('0x3'));var interaction=require(_0x13bd('0x4'));var config=require(_0x13bd('0x5'));var controller=require(_0x13bd('0x6'));router['get']('/',auth[_0x13bd('0x7')](),controller[_0x13bd('0x8')]);router[_0x13bd('0x9')](_0x13bd('0xa'),auth[_0x13bd('0x7')](),controller[_0x13bd('0xb')]);router[_0x13bd('0x9')](_0x13bd('0xc'),auth[_0x13bd('0x7')](),controller[_0x13bd('0xd')]);router['post']('/',auth[_0x13bd('0x7')](),controller[_0x13bd('0xe')]);router['put'](_0x13bd('0xa'),auth[_0x13bd('0x7')](),controller[_0x13bd('0xf')]);router[_0x13bd('0x10')](_0x13bd('0xa'),auth[_0x13bd('0x7')](),controller[_0x13bd('0x11')]);module[_0x13bd('0x12')]=router; \ No newline at end of file +var _0x69b0=['download','post','create','put','/:id','update','delete','destroy','express','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','show','/:id/download'];(function(_0x420f19,_0x18b435){var _0x41a58a=function(_0x2fecde){while(--_0x2fecde){_0x420f19['push'](_0x420f19['shift']());}};_0x41a58a(++_0x18b435);}(_0x69b0,0xc6));var _0x069b=function(_0x186222,_0x3bdfb0){_0x186222=_0x186222-0x0;var _0x226a38=_0x69b0[_0x186222];return _0x226a38;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x069b('0x0'));var router=express[_0x069b('0x1')]();var fs_extra=require(_0x069b('0x2'));var auth=require(_0x069b('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x069b('0x4'));var controller=require(_0x069b('0x5'));router[_0x069b('0x6')]('/',auth[_0x069b('0x7')](),controller[_0x069b('0x8')]);router[_0x069b('0x6')]('/:id',auth[_0x069b('0x7')](),controller[_0x069b('0x9')]);router[_0x069b('0x6')](_0x069b('0xa'),auth[_0x069b('0x7')](),controller[_0x069b('0xb')]);router[_0x069b('0xc')]('/',auth['isAuthenticated'](),controller[_0x069b('0xd')]);router[_0x069b('0xe')](_0x069b('0xf'),auth[_0x069b('0x7')](),controller[_0x069b('0x10')]);router[_0x069b('0x11')](_0x069b('0xf'),auth[_0x069b('0x7')](),controller[_0x069b('0x12')]);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 57897d8..dcd868e 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 _0x7b25=['TEXT','STRING','BOOLEAN','exports'];(function(_0x239a39,_0x5b787d){var _0x5bdc07=function(_0x3eb166){while(--_0x3eb166){_0x239a39['push'](_0x239a39['shift']());}};_0x5bdc07(++_0x5b787d);}(_0x7b25,0x1bf));var _0x57b2=function(_0x361b6c,_0x426c64){_0x361b6c=_0x361b6c-0x0;var _0x533ccf=_0x7b25[_0x361b6c];return _0x533ccf;};'use strict';var Sequelize=require('sequelize');module[_0x57b2('0x0')]={'field':{'type':Sequelize[_0x57b2('0x1')]},'alias':{'type':Sequelize[_0x57b2('0x2')]},'function':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x57b2('0x2')]},'groupBy':{'type':Sequelize[_0x57b2('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x7d99=['BOOLEAN','sequelize','exports','TEXT','STRING'];(function(_0xf2f46b,_0x89cf58){var _0x382051=function(_0x177d63){while(--_0x177d63){_0xf2f46b['push'](_0xf2f46b['shift']());}};_0x382051(++_0x89cf58);}(_0x7d99,0x1f0));var _0x97d9=function(_0x215e03,_0x1eccc0){_0x215e03=_0x215e03-0x0;var _0x17fbe8=_0x7d99[_0x215e03];return _0x17fbe8;};'use strict';var Sequelize=require(_0x97d9('0x0'));module[_0x97d9('0x1')]={'field':{'type':Sequelize[_0x97d9('0x2')]},'alias':{'type':Sequelize[_0x97d9('0x3')]},'function':{'type':Sequelize[_0x97d9('0x3')]},'format':{'type':Sequelize[_0x97d9('0x3')]},'groupBy':{'type':Sequelize[_0x97d9('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x97d9('0x3')]},'custom':{'type':Sequelize[_0x97d9('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index bdc7fc4..0367c60 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 _0xa5f8=['update','params','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','then','destroy','error','name','AnalyticFieldReport','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','rawAttributes','include','find','create','bulkCreate','body'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0xa5f8,0xf7));var _0x8a5f=function(_0x1fa167,_0x1fc02d){_0x1fa167=_0x1fa167-0x0;var _0x7e512a=_0xa5f8[_0x1fa167];return _0x7e512a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8a5f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8a5f('0x1'));var rp=require(_0x8a5f('0x2'));var moment=require('moment');var BPromise=require(_0x8a5f('0x3'));var Mustache=require(_0x8a5f('0x4'));var util=require(_0x8a5f('0x5'));var path=require(_0x8a5f('0x6'));var sox=require(_0x8a5f('0x7'));var csv=require('to-csv');var ejs=require(_0x8a5f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8a5f('0x9'));var crypto=require(_0x8a5f('0xa'));var jsforce=require(_0x8a5f('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x8a5f('0xc'));var querystring=require(_0x8a5f('0xd'));var Papa=require(_0x8a5f('0xe'));var Redis=require('ioredis');var authService=require(_0x8a5f('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x8a5f('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8a5f('0x11'))(_0x8a5f('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8a5f('0x13'));var db=require(_0x8a5f('0x14'))['db'];function respondWithStatusCode(_0x1bd57f,_0x465f2b){_0x465f2b=_0x465f2b||0xcc;return function(_0x46c30b){if(_0x46c30b){return _0x1bd57f[_0x8a5f('0x15')](_0x465f2b);}return _0x1bd57f[_0x8a5f('0x16')](_0x465f2b)[_0x8a5f('0x17')]();};}function respondWithResult(_0x39fd60,_0x44d9dd){_0x44d9dd=_0x44d9dd||0xc8;return function(_0x547349){if(_0x547349){return _0x39fd60['status'](_0x44d9dd)[_0x8a5f('0x18')](_0x547349);}};}function respondWithFilteredResult(_0x3c31f2,_0x22647d){return function(_0x3cc29c){if(_0x3cc29c){var _0x272cb4=typeof _0x22647d['offset']===_0x8a5f('0x19')&&typeof _0x22647d['limit']===_0x8a5f('0x19');var _0x326a04=_0x3cc29c[_0x8a5f('0x1a')];var _0x4d799b=_0x272cb4?0x0:_0x22647d[_0x8a5f('0x1b')];var _0x40b05c=_0x272cb4?_0x3cc29c['count']:_0x22647d[_0x8a5f('0x1b')]+_0x22647d[_0x8a5f('0x1c')];var _0x2fb752;if(_0x40b05c>=_0x326a04){_0x40b05c=_0x326a04;_0x2fb752=0xc8;}else{_0x2fb752=0xce;}_0x3c31f2[_0x8a5f('0x16')](_0x2fb752);return _0x3c31f2[_0x8a5f('0x1d')](_0x8a5f('0x1e'),_0x4d799b+'-'+_0x40b05c+'/'+_0x326a04)['json'](_0x3cc29c);}return null;};}function patchUpdates(_0x3fdde6){return function(_0x40dfcf){try{jsonpatch[_0x8a5f('0x1f')](_0x40dfcf,_0x3fdde6,!![]);}catch(_0x209dae){return BPromise[_0x8a5f('0x20')](_0x209dae);}return _0x40dfcf['save']();};}function saveUpdates(_0x5758fd,_0x137d4c){return function(_0x5d91b4){if(_0x5d91b4){return _0x5d91b4['update'](_0x5758fd)[_0x8a5f('0x21')](function(_0x2a7fdf){return _0x2a7fdf;});}return null;};}function removeEntity(_0x3b33a0,_0x22fbd7){return function(_0x5c743a){if(_0x5c743a){return _0x5c743a[_0x8a5f('0x22')]()['then'](function(){_0x3b33a0['status'](0xcc)[_0x8a5f('0x17')]();});}};}function handleEntityNotFound(_0x153712,_0x426f33){return function(_0x1d69b7){if(!_0x1d69b7){_0x153712[_0x8a5f('0x15')](0x194);}return _0x1d69b7;};}function handleError(_0x15f13c,_0x1aa316){_0x1aa316=_0x1aa316||0x1f4;return function(_0x5f5373){logger[_0x8a5f('0x23')](_0x5f5373['stack']);if(_0x5f5373['name']){delete _0x5f5373[_0x8a5f('0x24')];}_0x15f13c[_0x8a5f('0x16')](_0x1aa316)['send'](_0x5f5373);};}exports['index']=function(_0x22cf4e,_0x2d48ab){var _0x4d5d27={},_0x4514a6={},_0x514f15={'count':0x0,'rows':[]};var _0x5e2f2c=_['map'](db[_0x8a5f('0x25')]['rawAttributes'],function(_0x5447a9){return{'name':_0x5447a9['fieldName'],'type':_0x5447a9[_0x8a5f('0x26')][_0x8a5f('0x27')]};});_0x4514a6[_0x8a5f('0x28')]=_[_0x8a5f('0x29')](_0x5e2f2c,'name');_0x4514a6[_0x8a5f('0x2a')]=_[_0x8a5f('0x2b')](_0x22cf4e[_0x8a5f('0x2a')]);_0x4514a6[_0x8a5f('0x2c')]=_[_0x8a5f('0x2d')](_0x4514a6[_0x8a5f('0x28')],_0x4514a6[_0x8a5f('0x2a')]);_0x4d5d27[_0x8a5f('0x2e')]=_[_0x8a5f('0x2d')](_0x4514a6['model'],qs[_0x8a5f('0x2f')](_0x22cf4e[_0x8a5f('0x2a')]['fields']));_0x4d5d27[_0x8a5f('0x2e')]=_0x4d5d27[_0x8a5f('0x2e')][_0x8a5f('0x30')]?_0x4d5d27[_0x8a5f('0x2e')]:_0x4514a6[_0x8a5f('0x28')];if(!_0x22cf4e['query'][_0x8a5f('0x31')](_0x8a5f('0x32'))){_0x4d5d27[_0x8a5f('0x1c')]=qs[_0x8a5f('0x1c')](_0x22cf4e[_0x8a5f('0x2a')][_0x8a5f('0x1c')]);_0x4d5d27[_0x8a5f('0x1b')]=qs[_0x8a5f('0x1b')](_0x22cf4e['query']['offset']);}_0x4d5d27['order']=qs[_0x8a5f('0x33')](_0x22cf4e['query']['sort']);_0x4d5d27[_0x8a5f('0x34')]=qs[_0x8a5f('0x2c')](_[_0x8a5f('0x35')](_0x22cf4e[_0x8a5f('0x2a')],_0x4514a6[_0x8a5f('0x2c')]),_0x5e2f2c);if(_0x22cf4e[_0x8a5f('0x2a')][_0x8a5f('0x36')]){_0x4d5d27[_0x8a5f('0x34')]=_[_0x8a5f('0x37')](_0x4d5d27['where'],{'$or':_[_0x8a5f('0x29')](_0x5e2f2c,function(_0x3cb0be){if(_0x3cb0be[_0x8a5f('0x26')]!==_0x8a5f('0x38')){var _0x47b7d2={};_0x47b7d2[_0x3cb0be[_0x8a5f('0x24')]]={'$like':'%'+_0x22cf4e['query'][_0x8a5f('0x36')]+'%'};return _0x47b7d2;}})});}_0x4d5d27=_['merge']({},_0x4d5d27,_0x22cf4e[_0x8a5f('0x39')]);var _0xda74b0={'where':_0x4d5d27[_0x8a5f('0x34')]};return db[_0x8a5f('0x25')][_0x8a5f('0x1a')](_0xda74b0)[_0x8a5f('0x21')](function(_0x14decd){_0x514f15[_0x8a5f('0x1a')]=_0x14decd;if(_0x22cf4e[_0x8a5f('0x2a')][_0x8a5f('0x3a')]){_0x4d5d27['include']=[{'all':!![]}];}return db['AnalyticFieldReport'][_0x8a5f('0x3b')](_0x4d5d27);})[_0x8a5f('0x21')](function(_0x4d39c9){_0x514f15[_0x8a5f('0x3c')]=_0x4d39c9;return _0x514f15;})['then'](respondWithFilteredResult(_0x2d48ab,_0x4d5d27))[_0x8a5f('0x3d')](handleError(_0x2d48ab,null));};exports[_0x8a5f('0x3e')]=function(_0x42213d,_0x5b3191){var _0x28d112={'raw':![],'where':{'id':_0x42213d['params']['id']}},_0x117c92={};_0x117c92['model']=_[_0x8a5f('0x2b')](db['AnalyticFieldReport'][_0x8a5f('0x3f')]);_0x117c92[_0x8a5f('0x2a')]=_[_0x8a5f('0x2b')](_0x42213d[_0x8a5f('0x2a')]);_0x117c92[_0x8a5f('0x2c')]=_['intersection'](_0x117c92[_0x8a5f('0x28')],_0x117c92['query']);_0x28d112['attributes']=_[_0x8a5f('0x2d')](_0x117c92[_0x8a5f('0x28')],qs[_0x8a5f('0x2f')](_0x42213d[_0x8a5f('0x2a')][_0x8a5f('0x2f')]));_0x28d112[_0x8a5f('0x2e')]=_0x28d112['attributes'][_0x8a5f('0x30')]?_0x28d112[_0x8a5f('0x2e')]:_0x117c92[_0x8a5f('0x28')];if(_0x42213d[_0x8a5f('0x2a')][_0x8a5f('0x3a')]){_0x28d112[_0x8a5f('0x40')]=[{'all':!![]}];}_0x28d112=_[_0x8a5f('0x37')]({},_0x28d112,_0x42213d[_0x8a5f('0x39')]);return db[_0x8a5f('0x25')][_0x8a5f('0x41')](_0x28d112)[_0x8a5f('0x21')](handleEntityNotFound(_0x5b3191,null))['then'](respondWithResult(_0x5b3191,null))['catch'](handleError(_0x5b3191,null));};exports['create']=function(_0x4f9a32,_0x6925ee){return db[_0x8a5f('0x25')][_0x8a5f('0x42')](_0x4f9a32['body'],{})[_0x8a5f('0x21')](respondWithResult(_0x6925ee,0xc9))[_0x8a5f('0x3d')](handleError(_0x6925ee,null));};exports['bulkCreate']=function(_0x2c7b9b,_0x13d76a){return db[_0x8a5f('0x25')][_0x8a5f('0x43')](_0x2c7b9b[_0x8a5f('0x44')],{'raw':![],'individualHooks':!![]})[_0x8a5f('0x21')](respondWithResult(_0x13d76a,0xc9))['catch'](handleError(_0x13d76a,null));};exports[_0x8a5f('0x45')]=function(_0x150f21,_0xf6a73a){if(_0x150f21['body']['id']){delete _0x150f21[_0x8a5f('0x44')]['id'];}return db['AnalyticFieldReport']['find']({'where':{'id':_0x150f21['params']['id']}})[_0x8a5f('0x21')](handleEntityNotFound(_0xf6a73a,null))['then'](saveUpdates(_0x150f21[_0x8a5f('0x44')],null))['then'](respondWithResult(_0xf6a73a,null))[_0x8a5f('0x3d')](handleError(_0xf6a73a,null));};exports[_0x8a5f('0x22')]=function(_0x3ce6f7,_0x1883b8){return db[_0x8a5f('0x25')][_0x8a5f('0x41')]({'where':{'id':_0x3ce6f7[_0x8a5f('0x46')]['id']}})[_0x8a5f('0x21')](handleEntityNotFound(_0x1883b8,null))[_0x8a5f('0x21')](removeEntity(_0x1883b8,null))['catch'](handleError(_0x1883b8,null));};exports[_0x8a5f('0x47')]=function(_0x257c1f,_0x1e7679){return db[_0x8a5f('0x25')][_0x8a5f('0x22')]({'where':{'id':_0x257c1f['query'][_0x8a5f('0x48')]||[]},'raw':![],'individualHooks':!![]})[_0x8a5f('0x21')](respondWithResult(_0x1e7679,0xcc))[_0x8a5f('0x3d')](handleError(_0x1e7679,null));};exports[_0x8a5f('0x49')]=function(_0x59e26f,_0x481665,_0x5eef7a){return db[_0x8a5f('0x4a')][_0x8a5f('0x4b')]({'where':{'id':_0x59e26f[_0x8a5f('0x46')]['id']}})[_0x8a5f('0x21')](handleEntityNotFound(_0x481665,null))[_0x8a5f('0x21')](function(_0x190288){if(_0x190288){return db[_0x8a5f('0x4c')][_0x8a5f('0x4d')](function(_0x494359){return db[_0x8a5f('0x25')][_0x8a5f('0x22')]({'where':{'CustomReportId':_0x59e26f[_0x8a5f('0x46')]['id']},'transaction':_0x494359})[_0x8a5f('0x21')](function(_0x106b08){var _0x599c2a=_[_0x8a5f('0x29')](_0x59e26f[_0x8a5f('0x44')],function(_0x2077fa){delete _0x2077fa['id'];_0x2077fa[_0x8a5f('0x4e')]=_0x59e26f[_0x8a5f('0x46')]['id'];return _0x2077fa;});return db['AnalyticFieldReport'][_0x8a5f('0x43')](_0x599c2a,{'transaction':_0x494359});});})[_0x8a5f('0x21')](function(){return db[_0x8a5f('0x25')][_0x8a5f('0x3b')]({'where':{'CustomReportId':_0x59e26f[_0x8a5f('0x46')]['id']}});});}})['then'](respondWithResult(_0x481665,null))[_0x8a5f('0x3d')](handleError(_0x481665,null));}; \ No newline at end of file +var _0x63e4=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','where','pick','filter','VIRTUAL','merge','options','AnalyticFieldReport','includeAll','include','findAll','rows','show','params','find','create','body','catch','bulkCreate','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','CustomReportId','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x63e4,0x94));var _0x463e=function(_0x26dbbd,_0x84e35b){_0x26dbbd=_0x26dbbd-0x0;var _0x282404=_0x63e4[_0x26dbbd];return _0x282404;};'use strict';var emlformat=require(_0x463e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x463e('0x1'));var jsonpatch=require(_0x463e('0x2'));var rp=require(_0x463e('0x3'));var moment=require(_0x463e('0x4'));var BPromise=require(_0x463e('0x5'));var Mustache=require(_0x463e('0x6'));var util=require(_0x463e('0x7'));var path=require(_0x463e('0x8'));var sox=require(_0x463e('0x9'));var csv=require(_0x463e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x463e('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x463e('0xc'));var jsforce=require(_0x463e('0xd'));var deskjs=require(_0x463e('0xe'));var toCsv=require(_0x463e('0xa'));var querystring=require(_0x463e('0xf'));var Papa=require(_0x463e('0x10'));var Redis=require(_0x463e('0x11'));var authService=require(_0x463e('0x12'));var qs=require(_0x463e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x463e('0x14'));var logger=require(_0x463e('0x15'))(_0x463e('0x16'));var utils=require(_0x463e('0x17'));var config=require(_0x463e('0x18'));var licenseUtil=require(_0x463e('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x136dc7,_0x477b7c){_0x477b7c=_0x477b7c||0xcc;return function(_0xc8ce53){if(_0xc8ce53){return _0x136dc7[_0x463e('0x1a')](_0x477b7c);}return _0x136dc7[_0x463e('0x1b')](_0x477b7c)[_0x463e('0x1c')]();};}function respondWithResult(_0x4ec607,_0x598854){_0x598854=_0x598854||0xc8;return function(_0x4b00fb){if(_0x4b00fb){return _0x4ec607[_0x463e('0x1b')](_0x598854)[_0x463e('0x1d')](_0x4b00fb);}};}function respondWithFilteredResult(_0x2a98aa,_0x521344){return function(_0x1482a1){if(_0x1482a1){var _0x6d897=typeof _0x521344[_0x463e('0x1e')]==='undefined'&&typeof _0x521344[_0x463e('0x1f')]===_0x463e('0x20');var _0xc003e7=_0x1482a1[_0x463e('0x21')];var _0x2b06f8=_0x6d897?0x0:_0x521344['offset'];var _0x4355bc=_0x6d897?_0x1482a1['count']:_0x521344[_0x463e('0x1e')]+_0x521344[_0x463e('0x1f')];var _0x49e3ee;if(_0x4355bc>=_0xc003e7){_0x4355bc=_0xc003e7;_0x49e3ee=0xc8;}else{_0x49e3ee=0xce;}_0x2a98aa['status'](_0x49e3ee);return _0x2a98aa[_0x463e('0x22')](_0x463e('0x23'),_0x2b06f8+'-'+_0x4355bc+'/'+_0xc003e7)[_0x463e('0x1d')](_0x1482a1);}return null;};}function patchUpdates(_0x28f315){return function(_0x5c8232){try{jsonpatch[_0x463e('0x24')](_0x5c8232,_0x28f315,!![]);}catch(_0x1d36ed){return BPromise[_0x463e('0x25')](_0x1d36ed);}return _0x5c8232[_0x463e('0x26')]();};}function saveUpdates(_0xc47d0b,_0x5e52e3){return function(_0x2e3eea){if(_0x2e3eea){return _0x2e3eea['update'](_0xc47d0b)[_0x463e('0x27')](function(_0x3b5108){return _0x3b5108;});}return null;};}function removeEntity(_0x473cd,_0xc75545){return function(_0x2ef527){if(_0x2ef527){return _0x2ef527[_0x463e('0x28')]()[_0x463e('0x27')](function(){_0x473cd[_0x463e('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x560df2,_0x1d1fd6){return function(_0x1cbc18){if(!_0x1cbc18){_0x560df2[_0x463e('0x1a')](0x194);}return _0x1cbc18;};}function handleError(_0x15a75e,_0x5dc5a0){_0x5dc5a0=_0x5dc5a0||0x1f4;return function(_0x400113){logger['error'](_0x400113[_0x463e('0x29')]);if(_0x400113[_0x463e('0x2a')]){delete _0x400113[_0x463e('0x2a')];}_0x15a75e['status'](_0x5dc5a0)[_0x463e('0x2b')](_0x400113);};}exports[_0x463e('0x2c')]=function(_0x377e30,_0x1cbce0){var _0xd308fa={},_0x5ba1db={},_0x4fff95={'count':0x0,'rows':[]};var _0x104e41=_['map'](db['AnalyticFieldReport'][_0x463e('0x2d')],function(_0x4c6aa3){return{'name':_0x4c6aa3[_0x463e('0x2e')],'type':_0x4c6aa3[_0x463e('0x2f')][_0x463e('0x30')]};});_0x5ba1db['model']=_[_0x463e('0x31')](_0x104e41,_0x463e('0x2a'));_0x5ba1db[_0x463e('0x32')]=_[_0x463e('0x33')](_0x377e30['query']);_0x5ba1db[_0x463e('0x34')]=_[_0x463e('0x35')](_0x5ba1db['model'],_0x5ba1db[_0x463e('0x32')]);_0xd308fa['attributes']=_[_0x463e('0x35')](_0x5ba1db[_0x463e('0x36')],qs[_0x463e('0x37')](_0x377e30['query'][_0x463e('0x37')]));_0xd308fa[_0x463e('0x38')]=_0xd308fa[_0x463e('0x38')][_0x463e('0x39')]?_0xd308fa[_0x463e('0x38')]:_0x5ba1db['model'];if(!_0x377e30[_0x463e('0x32')]['hasOwnProperty'](_0x463e('0x3a'))){_0xd308fa[_0x463e('0x1f')]=qs[_0x463e('0x1f')](_0x377e30['query'][_0x463e('0x1f')]);_0xd308fa[_0x463e('0x1e')]=qs[_0x463e('0x1e')](_0x377e30[_0x463e('0x32')]['offset']);}_0xd308fa[_0x463e('0x3b')]=qs['sort'](_0x377e30['query']['sort']);_0xd308fa[_0x463e('0x3c')]=qs[_0x463e('0x34')](_[_0x463e('0x3d')](_0x377e30['query'],_0x5ba1db[_0x463e('0x34')]),_0x104e41);if(_0x377e30[_0x463e('0x32')][_0x463e('0x3e')]){_0xd308fa[_0x463e('0x3c')]=_['merge'](_0xd308fa[_0x463e('0x3c')],{'$or':_['map'](_0x104e41,function(_0x20501e){if(_0x20501e[_0x463e('0x2f')]!==_0x463e('0x3f')){var _0x5724ef={};_0x5724ef[_0x20501e['name']]={'$like':'%'+_0x377e30[_0x463e('0x32')][_0x463e('0x3e')]+'%'};return _0x5724ef;}})});}_0xd308fa=_[_0x463e('0x40')]({},_0xd308fa,_0x377e30[_0x463e('0x41')]);var _0x489b22={'where':_0xd308fa[_0x463e('0x3c')]};return db[_0x463e('0x42')][_0x463e('0x21')](_0x489b22)['then'](function(_0x49bd86){_0x4fff95[_0x463e('0x21')]=_0x49bd86;if(_0x377e30[_0x463e('0x32')][_0x463e('0x43')]){_0xd308fa[_0x463e('0x44')]=[{'all':!![]}];}return db['AnalyticFieldReport'][_0x463e('0x45')](_0xd308fa);})['then'](function(_0x440770){_0x4fff95[_0x463e('0x46')]=_0x440770;return _0x4fff95;})[_0x463e('0x27')](respondWithFilteredResult(_0x1cbce0,_0xd308fa))['catch'](handleError(_0x1cbce0,null));};exports[_0x463e('0x47')]=function(_0x2123ac,_0x27e5bb){var _0x36d125={'raw':![],'where':{'id':_0x2123ac[_0x463e('0x48')]['id']}},_0x109fcf={};_0x109fcf[_0x463e('0x36')]=_[_0x463e('0x33')](db[_0x463e('0x42')]['rawAttributes']);_0x109fcf[_0x463e('0x32')]=_[_0x463e('0x33')](_0x2123ac[_0x463e('0x32')]);_0x109fcf[_0x463e('0x34')]=_[_0x463e('0x35')](_0x109fcf['model'],_0x109fcf['query']);_0x36d125[_0x463e('0x38')]=_[_0x463e('0x35')](_0x109fcf[_0x463e('0x36')],qs['fields'](_0x2123ac[_0x463e('0x32')]['fields']));_0x36d125[_0x463e('0x38')]=_0x36d125[_0x463e('0x38')][_0x463e('0x39')]?_0x36d125[_0x463e('0x38')]:_0x109fcf[_0x463e('0x36')];if(_0x2123ac[_0x463e('0x32')][_0x463e('0x43')]){_0x36d125['include']=[{'all':!![]}];}_0x36d125=_[_0x463e('0x40')]({},_0x36d125,_0x2123ac[_0x463e('0x41')]);return db['AnalyticFieldReport'][_0x463e('0x49')](_0x36d125)['then'](handleEntityNotFound(_0x27e5bb,null))['then'](respondWithResult(_0x27e5bb,null))['catch'](handleError(_0x27e5bb,null));};exports[_0x463e('0x4a')]=function(_0x1af42e,_0x1e4a74){return db[_0x463e('0x42')]['create'](_0x1af42e[_0x463e('0x4b')],{})[_0x463e('0x27')](respondWithResult(_0x1e4a74,0xc9))[_0x463e('0x4c')](handleError(_0x1e4a74,null));};exports[_0x463e('0x4d')]=function(_0x11b73a,_0xf7c9bd){return db[_0x463e('0x42')][_0x463e('0x4d')](_0x11b73a[_0x463e('0x4b')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0xf7c9bd,0xc9))[_0x463e('0x4c')](handleError(_0xf7c9bd,null));};exports['update']=function(_0x205bef,_0x35eb4c){if(_0x205bef[_0x463e('0x4b')]['id']){delete _0x205bef['body']['id'];}return db[_0x463e('0x42')][_0x463e('0x49')]({'where':{'id':_0x205bef[_0x463e('0x48')]['id']}})[_0x463e('0x27')](handleEntityNotFound(_0x35eb4c,null))[_0x463e('0x27')](saveUpdates(_0x205bef[_0x463e('0x4b')],null))[_0x463e('0x27')](respondWithResult(_0x35eb4c,null))[_0x463e('0x4c')](handleError(_0x35eb4c,null));};exports['destroy']=function(_0x518f89,_0x4e674b){return db[_0x463e('0x42')][_0x463e('0x49')]({'where':{'id':_0x518f89[_0x463e('0x48')]['id']}})['then'](handleEntityNotFound(_0x4e674b,null))[_0x463e('0x27')](removeEntity(_0x4e674b,null))[_0x463e('0x4c')](handleError(_0x4e674b,null));};exports[_0x463e('0x4e')]=function(_0x57c82f,_0x5148cb){return db['AnalyticFieldReport'][_0x463e('0x28')]({'where':{'id':_0x57c82f[_0x463e('0x32')][_0x463e('0x4f')]||[]},'raw':![],'individualHooks':!![]})[_0x463e('0x27')](respondWithResult(_0x5148cb,0xcc))[_0x463e('0x4c')](handleError(_0x5148cb,null));};exports[_0x463e('0x50')]=function(_0x209acc,_0x3a977e,_0x501f6d){return db[_0x463e('0x51')][_0x463e('0x52')]({'where':{'id':_0x209acc['params']['id']}})['then'](handleEntityNotFound(_0x3a977e,null))[_0x463e('0x27')](function(_0x25a750){if(_0x25a750){return db['sequelize']['transaction'](function(_0x5ef0fb){return db['AnalyticFieldReport'][_0x463e('0x28')]({'where':{'CustomReportId':_0x209acc['params']['id']},'transaction':_0x5ef0fb})[_0x463e('0x27')](function(_0x2c6547){var _0x267f32=_[_0x463e('0x31')](_0x209acc[_0x463e('0x4b')],function(_0x465ba3){delete _0x465ba3['id'];_0x465ba3[_0x463e('0x53')]=_0x209acc[_0x463e('0x48')]['id'];return _0x465ba3;});return db[_0x463e('0x42')][_0x463e('0x4d')](_0x267f32,{'transaction':_0x5ef0fb});});})[_0x463e('0x27')](function(){return db[_0x463e('0x42')][_0x463e('0x45')]({'where':{'CustomReportId':_0x209acc[_0x463e('0x48')]['id']}});});}})[_0x463e('0x27')](respondWithResult(_0x3a977e,null))[_0x463e('0x4c')](handleError(_0x3a977e,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 182a43c..2a05d84 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 _0x501c=['AnalyticFieldReport','analytics_report_fields','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','define'];(function(_0x55e39b,_0x208ca0){var _0x4fd3da=function(_0x58f8b3){while(--_0x58f8b3){_0x55e39b['push'](_0x55e39b['shift']());}};_0x4fd3da(++_0x208ca0);}(_0x501c,0xce));var _0xc501=function(_0x2a7b92,_0x4499c1){_0x2a7b92=_0x2a7b92-0x0;var _0x51a19c=_0x501c[_0x2a7b92];return _0x51a19c;};'use strict';var _=require(_0xc501('0x0'));var util=require(_0xc501('0x1'));var logger=require(_0xc501('0x2'))('api');var moment=require('moment');var BPromise=require(_0xc501('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc501('0x4'));var rimraf=require(_0xc501('0x5'));var config=require(_0xc501('0x6'));var attributes=require(_0xc501('0x7'));module[_0xc501('0x8')]=function(_0x257300,_0x55b9f6){return _0x257300[_0xc501('0x9')](_0xc501('0xa'),attributes,{'tableName':_0xc501('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x50a9=['util','../../config/logger','api','moment','bluebird','rimraf','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields','lodash'];(function(_0x5326b4,_0x35f070){var _0x2cb12e=function(_0x354d7c){while(--_0x354d7c){_0x5326b4['push'](_0x5326b4['shift']());}};_0x2cb12e(++_0x35f070);}(_0x50a9,0x17f));var _0x950a=function(_0x46368d,_0xe608d0){_0x46368d=_0x46368d-0x0;var _0x5efc16=_0x50a9[_0x46368d];return _0x5efc16;};'use strict';var _=require(_0x950a('0x0'));var util=require(_0x950a('0x1'));var logger=require(_0x950a('0x2'))(_0x950a('0x3'));var moment=require(_0x950a('0x4'));var BPromise=require(_0x950a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x950a('0x6'));var config=require('../../config/environment');var attributes=require(_0x950a('0x7'));module[_0x950a('0x8')]=function(_0x5aedfb,_0x446d8e){return _0x5aedfb[_0x950a('0x9')](_0x950a('0xa'),attributes,{'tableName':_0x950a('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 8f493bf..bb482fa 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 _0xc997=['message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x29b5e9,_0x27e566){var _0x11a644=function(_0x2a69a0){while(--_0x2a69a0){_0x29b5e9['push'](_0x29b5e9['shift']());}};_0x11a644(++_0x27e566);}(_0xc997,0x1a1));var _0x7c99=function(_0x28e157,_0x35ce5f){_0x28e157=_0x28e157-0x0;var _0x1abb00=_0xc997[_0x28e157];return _0x1abb00;};'use strict';var _=require(_0x7c99('0x0'));var util=require(_0x7c99('0x1'));var moment=require('moment');var BPromise=require(_0x7c99('0x2'));var rs=require(_0x7c99('0x3'));var fs=require('fs');var Redis=require(_0x7c99('0x4'));var db=require(_0x7c99('0x5'))['db'];var utils=require(_0x7c99('0x6'));var logger=require('../../config/logger')(_0x7c99('0x7'));var config=require('../../config/environment');var jayson=require(_0x7c99('0x8'));var client=jayson['client'][_0x7c99('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x46a3dd,_0x214999,_0xb815){return new BPromise(function(_0x415e3e,_0x12b4ce){return client[_0x7c99('0xa')](_0x46a3dd,_0xb815)[_0x7c99('0xb')](function(_0x42be42){logger[_0x7c99('0xc')](_0x7c99('0xd'),_0x214999,_0x7c99('0xe'));logger[_0x7c99('0xf')](_0x7c99('0x10'),_0x214999,_0x7c99('0xe'),JSON[_0x7c99('0x11')](_0x42be42));if(_0x42be42[_0x7c99('0x12')]){if(_0x42be42[_0x7c99('0x12')][_0x7c99('0x13')]===0x1f4){logger[_0x7c99('0x12')]('AnalyticFieldReport,\x20%s,\x20%s',_0x214999,_0x42be42['error']['message']);return _0x12b4ce(_0x42be42[_0x7c99('0x12')]['message']);}logger[_0x7c99('0x12')](_0x7c99('0xd'),_0x214999,_0x42be42[_0x7c99('0x12')]['message']);return _0x415e3e(_0x42be42[_0x7c99('0x12')][_0x7c99('0x14')]);}else{logger['info'](_0x7c99('0xd'),_0x214999,_0x7c99('0xe'));_0x415e3e(_0x42be42[_0x7c99('0x15')][_0x7c99('0x14')]);}})[_0x7c99('0x16')](function(_0x158828){logger[_0x7c99('0x12')](_0x7c99('0xd'),_0x214999,_0x158828);_0x12b4ce(_0x158828);});});} \ No newline at end of file +var _0x89bc=['client','http','request','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','jayson/promise'];(function(_0x229b99,_0xb6a166){var _0x13e10c=function(_0x166e54){while(--_0x166e54){_0x229b99['push'](_0x229b99['shift']());}};_0x13e10c(++_0xb6a166);}(_0x89bc,0x1c6));var _0xc89b=function(_0x1d5458,_0x3acf09){_0x1d5458=_0x1d5458-0x0;var _0x9bf6f=_0x89bc[_0x1d5458];return _0x9bf6f;};'use strict';var _=require(_0xc89b('0x0'));var util=require(_0xc89b('0x1'));var moment=require(_0xc89b('0x2'));var BPromise=require(_0xc89b('0x3'));var rs=require(_0xc89b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc89b('0x5'))['db'];var utils=require(_0xc89b('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xc89b('0x7'));var client=jayson[_0xc89b('0x8')][_0xc89b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x11483c,_0x4730e1,_0x3d541b){return new BPromise(function(_0x1a2b7d,_0xa197b1){return client[_0xc89b('0xa')](_0x11483c,_0x3d541b)['then'](function(_0x15b9cf){logger[_0xc89b('0xb')](_0xc89b('0xc'),_0x4730e1,_0xc89b('0xd'));logger[_0xc89b('0xe')](_0xc89b('0xf'),_0x4730e1,_0xc89b('0xd'),JSON[_0xc89b('0x10')](_0x15b9cf));if(_0x15b9cf[_0xc89b('0x11')]){if(_0x15b9cf[_0xc89b('0x11')]['code']===0x1f4){logger[_0xc89b('0x11')](_0xc89b('0xc'),_0x4730e1,_0x15b9cf[_0xc89b('0x11')][_0xc89b('0x12')]);return _0xa197b1(_0x15b9cf[_0xc89b('0x11')][_0xc89b('0x12')]);}logger[_0xc89b('0x11')]('AnalyticFieldReport,\x20%s,\x20%s',_0x4730e1,_0x15b9cf['error']['message']);return _0x1a2b7d(_0x15b9cf[_0xc89b('0x11')][_0xc89b('0x12')]);}else{logger[_0xc89b('0xb')](_0xc89b('0xc'),_0x4730e1,'request\x20sent');_0x1a2b7d(_0x15b9cf[_0xc89b('0x13')][_0xc89b('0x12')]);}})[_0xc89b('0x14')](function(_0x33a781){logger[_0xc89b('0x11')](_0xc89b('0xc'),_0x4730e1,_0x33a781);_0xa197b1(_0x33a781);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 8561802..1605ddb 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(_0x35ad84,_0x2a0067){var _0x50ea13=function(_0xc5dc88){while(--_0xc5dc88){_0x35ad84['push'](_0x35ad84['shift']());}};_0x50ea13(++_0x2a0067);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'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(_0x583ea0,_0x53b7e7){var _0xd8d95=function(_0x40bf75){while(--_0x40bf75){_0x583ea0['push'](_0x583ea0['shift']());}};_0xd8d95(++_0x53b7e7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'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 41acf26..81a7419 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 _0xa25c=['STRING','name','TEXT','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa25c,0x13f));var _0xca25=function(_0x326038,_0x7bdb1b){_0x326038=_0x326038-0x0;var _0x4b744a=_0xa25c[_0x326038];return _0x4b744a;};'use strict';var Sequelize=require('sequelize');module[_0xca25('0x0')]={'name':{'type':Sequelize[_0xca25('0x1')],'allowNull':![],'unique':_0xca25('0x2')},'table':{'type':Sequelize[_0xca25('0x1')]},'metric':{'type':Sequelize[_0xca25('0x3')]},'description':{'type':Sequelize[_0xca25('0x1')]}}; \ No newline at end of file +var _0xc343=['STRING','name','sequelize'];(function(_0x49e677,_0x2975){var _0x4cb8eb=function(_0x554af8){while(--_0x554af8){_0x49e677['push'](_0x49e677['shift']());}};_0x4cb8eb(++_0x2975);}(_0xc343,0x173));var _0x3c34=function(_0x3757d5,_0x2364f4){_0x3757d5=_0x3757d5-0x0;var _0x433c20=_0xc343[_0x3757d5];return _0x433c20;};'use strict';var Sequelize=require(_0x3c34('0x0'));module['exports']={'name':{'type':Sequelize[_0x3c34('0x1')],'allowNull':![],'unique':_0x3c34('0x2')},'table':{'type':Sequelize[_0x3c34('0x1')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 38fff28..2e55a41 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 _0x7da7=['model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','merge','options','where','AnalyticMetric','includeAll','include','findAll','rows','catch','params','keys','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','moment','bluebird','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','json','apply','reject','update','then','destroy','get','Metrics','UserProfileResource','end','name','send','index','map','rawAttributes','fieldName','type','key'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x7da7,0x10d));var _0x77da=function(_0x3877c1,_0x238c29){_0x3877c1=_0x3877c1-0x0;var _0x59056a=_0x7da7[_0x3877c1];return _0x59056a;};'use strict';var emlformat=require(_0x77da('0x0'));var rimraf=require(_0x77da('0x1'));var zipdir=require(_0x77da('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x77da('0x3'));var BPromise=require(_0x77da('0x4'));var Mustache=require('mustache');var util=require(_0x77da('0x5'));var path=require(_0x77da('0x6'));var sox=require('sox');var csv=require(_0x77da('0x7'));var ejs=require(_0x77da('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x77da('0x9'));var squel=require('squel');var crypto=require(_0x77da('0xa'));var jsforce=require(_0x77da('0xb'));var deskjs=require(_0x77da('0xc'));var toCsv=require(_0x77da('0x7'));var querystring=require(_0x77da('0xd'));var Papa=require('papaparse');var Redis=require(_0x77da('0xe'));var authService=require(_0x77da('0xf'));var qs=require(_0x77da('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x77da('0x11'));var logger=require(_0x77da('0x12'))(_0x77da('0x13'));var utils=require(_0x77da('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x77da('0x15'));var db=require(_0x77da('0x16'))['db'];function respondWithStatusCode(_0x2acc65,_0x5d6e2f){_0x5d6e2f=_0x5d6e2f||0xcc;return function(_0x4a7748){if(_0x4a7748){return _0x2acc65[_0x77da('0x17')](_0x5d6e2f);}return _0x2acc65[_0x77da('0x18')](_0x5d6e2f)['end']();};}function respondWithResult(_0x3b0ff2,_0x369df0){_0x369df0=_0x369df0||0xc8;return function(_0x355719){if(_0x355719){return _0x3b0ff2[_0x77da('0x18')](_0x369df0)['json'](_0x355719);}};}function respondWithFilteredResult(_0x2172d0,_0x4e130c){return function(_0x29cd7b){if(_0x29cd7b){var _0x366443=typeof _0x4e130c[_0x77da('0x19')]===_0x77da('0x1a')&&typeof _0x4e130c['limit']==='undefined';var _0x514016=_0x29cd7b['count'];var _0x103e46=_0x366443?0x0:_0x4e130c[_0x77da('0x19')];var _0x289887=_0x366443?_0x29cd7b[_0x77da('0x1b')]:_0x4e130c[_0x77da('0x19')]+_0x4e130c[_0x77da('0x1c')];var _0x1d325c;if(_0x289887>=_0x514016){_0x289887=_0x514016;_0x1d325c=0xc8;}else{_0x1d325c=0xce;}_0x2172d0[_0x77da('0x18')](_0x1d325c);return _0x2172d0['set']('Content-Range',_0x103e46+'-'+_0x289887+'/'+_0x514016)[_0x77da('0x1d')](_0x29cd7b);}return null;};}function patchUpdates(_0x4d1512){return function(_0x507979){try{jsonpatch[_0x77da('0x1e')](_0x507979,_0x4d1512,!![]);}catch(_0x304a2b){return BPromise[_0x77da('0x1f')](_0x304a2b);}return _0x507979['save']();};}function saveUpdates(_0x58270c,_0x3e6cfe){return function(_0x58f6c1){if(_0x58f6c1){return _0x58f6c1[_0x77da('0x20')](_0x58270c)[_0x77da('0x21')](function(_0xc52f0e){return _0xc52f0e;});}return null;};}function removeEntity(_0x27b6c7,_0x10399a){return function(_0x270318){if(_0x270318){return _0x270318[_0x77da('0x22')]()['then'](function(){var _0x4885ec=_0x270318[_0x77da('0x23')]({'plain':!![]});var _0x2d009f=_0x77da('0x24');return db[_0x77da('0x25')]['destroy']({'where':{'type':_0x2d009f,'resourceId':_0x4885ec['id']}})[_0x77da('0x21')](function(){return _0x270318;});})[_0x77da('0x21')](function(){_0x27b6c7[_0x77da('0x18')](0xcc)[_0x77da('0x26')]();});}};}function handleEntityNotFound(_0x446ae7,_0x5997b6){return function(_0xce24b8){if(!_0xce24b8){_0x446ae7[_0x77da('0x17')](0x194);}return _0xce24b8;};}function handleError(_0x1f2279,_0x2913f7){_0x2913f7=_0x2913f7||0x1f4;return function(_0x496ecd){logger['error'](_0x496ecd['stack']);if(_0x496ecd[_0x77da('0x27')]){delete _0x496ecd[_0x77da('0x27')];}_0x1f2279[_0x77da('0x18')](_0x2913f7)[_0x77da('0x28')](_0x496ecd);};}exports[_0x77da('0x29')]=function(_0x4eeb99,_0x350b4e){var _0x26f5a0={},_0x356bfb={},_0x1d381b={'count':0x0,'rows':[]};var _0x1e7853=_[_0x77da('0x2a')](db['AnalyticMetric'][_0x77da('0x2b')],function(_0x228851){return{'name':_0x228851[_0x77da('0x2c')],'type':_0x228851[_0x77da('0x2d')][_0x77da('0x2e')]};});_0x356bfb[_0x77da('0x2f')]=_[_0x77da('0x2a')](_0x1e7853,_0x77da('0x27'));_0x356bfb['query']=_['keys'](_0x4eeb99[_0x77da('0x30')]);_0x356bfb[_0x77da('0x31')]=_['intersection'](_0x356bfb[_0x77da('0x2f')],_0x356bfb[_0x77da('0x30')]);_0x26f5a0[_0x77da('0x32')]=_[_0x77da('0x33')](_0x356bfb[_0x77da('0x2f')],qs[_0x77da('0x34')](_0x4eeb99[_0x77da('0x30')]['fields']));_0x26f5a0[_0x77da('0x32')]=_0x26f5a0['attributes']['length']?_0x26f5a0['attributes']:_0x356bfb[_0x77da('0x2f')];if(!_0x4eeb99['query'][_0x77da('0x35')](_0x77da('0x36'))){_0x26f5a0[_0x77da('0x1c')]=qs[_0x77da('0x1c')](_0x4eeb99[_0x77da('0x30')][_0x77da('0x1c')]);_0x26f5a0[_0x77da('0x19')]=qs['offset'](_0x4eeb99[_0x77da('0x30')][_0x77da('0x19')]);}_0x26f5a0[_0x77da('0x37')]=qs[_0x77da('0x38')](_0x4eeb99[_0x77da('0x30')][_0x77da('0x38')]);_0x26f5a0['where']=qs[_0x77da('0x31')](_[_0x77da('0x39')](_0x4eeb99[_0x77da('0x30')],_0x356bfb['filters']),_0x1e7853);if(_0x4eeb99[_0x77da('0x30')]['filter']){_0x26f5a0['where']=_['merge'](_0x26f5a0['where'],{'$or':_[_0x77da('0x2a')](_0x1e7853,function(_0x1adba5){if(_0x1adba5[_0x77da('0x2d')]!=='VIRTUAL'){var _0x21d337={};_0x21d337[_0x1adba5['name']]={'$like':'%'+_0x4eeb99[_0x77da('0x30')]['filter']+'%'};return _0x21d337;}})});}_0x26f5a0=_[_0x77da('0x3a')]({},_0x26f5a0,_0x4eeb99[_0x77da('0x3b')]);var _0x290667={'where':_0x26f5a0[_0x77da('0x3c')]};return db[_0x77da('0x3d')]['count'](_0x290667)[_0x77da('0x21')](function(_0x1f48bd){_0x1d381b[_0x77da('0x1b')]=_0x1f48bd;if(_0x4eeb99[_0x77da('0x30')][_0x77da('0x3e')]){_0x26f5a0[_0x77da('0x3f')]=[{'all':!![]}];}return db['AnalyticMetric'][_0x77da('0x40')](_0x26f5a0);})[_0x77da('0x21')](function(_0x21de41){_0x1d381b[_0x77da('0x41')]=_0x21de41;return _0x1d381b;})[_0x77da('0x21')](respondWithFilteredResult(_0x350b4e,_0x26f5a0))[_0x77da('0x42')](handleError(_0x350b4e,null));};exports['show']=function(_0x10957b,_0x5abcd9){var _0x1ae806={'raw':!![],'where':{'id':_0x10957b[_0x77da('0x43')]['id']}},_0x373fb2={};_0x373fb2['model']=_[_0x77da('0x44')](db[_0x77da('0x3d')][_0x77da('0x2b')]);_0x373fb2[_0x77da('0x30')]=_[_0x77da('0x44')](_0x10957b[_0x77da('0x30')]);_0x373fb2[_0x77da('0x31')]=_[_0x77da('0x33')](_0x373fb2[_0x77da('0x2f')],_0x373fb2['query']);_0x1ae806[_0x77da('0x32')]=_[_0x77da('0x33')](_0x373fb2[_0x77da('0x2f')],qs[_0x77da('0x34')](_0x10957b[_0x77da('0x30')][_0x77da('0x34')]));_0x1ae806['attributes']=_0x1ae806['attributes'][_0x77da('0x45')]?_0x1ae806[_0x77da('0x32')]:_0x373fb2[_0x77da('0x2f')];if(_0x10957b[_0x77da('0x30')][_0x77da('0x3e')]){_0x1ae806[_0x77da('0x3f')]=[{'all':!![]}];}_0x1ae806=_['merge']({},_0x1ae806,_0x10957b[_0x77da('0x3b')]);return db[_0x77da('0x3d')][_0x77da('0x46')](_0x1ae806)[_0x77da('0x21')](handleEntityNotFound(_0x5abcd9,null))['then'](respondWithResult(_0x5abcd9,null))[_0x77da('0x42')](handleError(_0x5abcd9,null));};exports['create']=function(_0x518fd5,_0x36263b){return db[_0x77da('0x3d')][_0x77da('0x47')](_0x518fd5[_0x77da('0x48')],{})['then'](function(_0x16bf4b){var _0x1e36ee=_0x518fd5['user'][_0x77da('0x23')]({'plain':!![]});if(!_0x1e36ee)throw new Error(_0x77da('0x49'));if(_0x1e36ee['role']===_0x77da('0x4a')){var _0x3aaf5b=_0x16bf4b[_0x77da('0x23')]({'plain':!![]});var _0xef2496=_0x77da('0x24');return db[_0x77da('0x4b')][_0x77da('0x46')]({'where':{'name':_0xef2496,'userProfileId':_0x1e36ee[_0x77da('0x4c')]},'raw':!![]})[_0x77da('0x21')](function(_0x3a34a8){if(_0x3a34a8&&_0x3a34a8['autoAssociation']===0x0){return db[_0x77da('0x25')]['create']({'name':_0x3aaf5b[_0x77da('0x27')],'resourceId':_0x3aaf5b['id'],'type':_0x3a34a8[_0x77da('0x27')],'sectionId':_0x3a34a8['id']},{})[_0x77da('0x21')](function(){return _0x16bf4b;});}else{return _0x16bf4b;}})[_0x77da('0x42')](function(_0x374179){logger[_0x77da('0x4d')](_0x77da('0x4e'),_0x374179);throw _0x374179;});}return _0x16bf4b;})['then'](respondWithResult(_0x36263b,0xc9))[_0x77da('0x42')](handleError(_0x36263b,null));};exports[_0x77da('0x20')]=function(_0x1a7115,_0x353be9){if(_0x1a7115['body']['id']){delete _0x1a7115[_0x77da('0x48')]['id'];}return db[_0x77da('0x3d')][_0x77da('0x46')]({'where':{'id':_0x1a7115['params']['id']}})['then'](handleEntityNotFound(_0x353be9,null))[_0x77da('0x21')](saveUpdates(_0x1a7115[_0x77da('0x48')],null))[_0x77da('0x21')](respondWithResult(_0x353be9,null))[_0x77da('0x42')](handleError(_0x353be9,null));};exports[_0x77da('0x22')]=function(_0x528a32,_0x50437b){return db[_0x77da('0x3d')][_0x77da('0x46')]({'where':{'id':_0x528a32['params']['id']}})[_0x77da('0x21')](handleEntityNotFound(_0x50437b,null))[_0x77da('0x21')](removeEntity(_0x50437b,null))[_0x77da('0x42')](handleError(_0x50437b,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(_0xe74768,_0x4c0bf9){var _0x302e8a=function(_0x5ba5c8){while(--_0x5ba5c8){_0xe74768['push'](_0xe74768['shift']());}};_0x302e8a(++_0x4c0bf9);}(_0x4b84,0x1cc));var _0x44b8=function(_0x54d4a8,_0x585a59){_0x54d4a8=_0x54d4a8-0x0;var _0x3b321b=_0x4b84[_0x54d4a8];return _0x3b321b;};'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 9148a52..f36ac8c 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 _0xf96b=['bluebird','request-promise','path','rimraf','../../config/environment','./analyticMetric.attributes','exports','define','AnalyticMetric','analytics_metrics','lodash','util','../../config/logger','api','moment'];(function(_0x5f3b0a,_0x442f2f){var _0x81e1f3=function(_0x4a6a9c){while(--_0x4a6a9c){_0x5f3b0a['push'](_0x5f3b0a['shift']());}};_0x81e1f3(++_0x442f2f);}(_0xf96b,0x109));var _0xbf96=function(_0x4ea8c5,_0x4d2a5c){_0x4ea8c5=_0x4ea8c5-0x0;var _0x6a0b3a=_0xf96b[_0x4ea8c5];return _0x6a0b3a;};'use strict';var _=require(_0xbf96('0x0'));var util=require(_0xbf96('0x1'));var logger=require(_0xbf96('0x2'))(_0xbf96('0x3'));var moment=require(_0xbf96('0x4'));var BPromise=require(_0xbf96('0x5'));var rp=require(_0xbf96('0x6'));var fs=require('fs');var path=require(_0xbf96('0x7'));var rimraf=require(_0xbf96('0x8'));var config=require(_0xbf96('0x9'));var attributes=require(_0xbf96('0xa'));module[_0xbf96('0xb')]=function(_0x162c19,_0x4de1c3){return _0x162c19[_0xbf96('0xc')](_0xbf96('0xd'),attributes,{'tableName':_0xbf96('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1ffe=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticMetric.attributes','exports','define','AnalyticMetric','analytics_metrics'];(function(_0x951a87,_0x52027e){var _0x512820=function(_0x6c64cc){while(--_0x6c64cc){_0x951a87['push'](_0x951a87['shift']());}};_0x512820(++_0x52027e);}(_0x1ffe,0xa5));var _0xe1ff=function(_0x5dc5c6,_0x2cf7e2){_0x5dc5c6=_0x5dc5c6-0x0;var _0x509aa7=_0x1ffe[_0x5dc5c6];return _0x509aa7;};'use strict';var _=require(_0xe1ff('0x0'));var util=require(_0xe1ff('0x1'));var logger=require(_0xe1ff('0x2'))(_0xe1ff('0x3'));var moment=require(_0xe1ff('0x4'));var BPromise=require(_0xe1ff('0x5'));var rp=require(_0xe1ff('0x6'));var fs=require('fs');var path=require(_0xe1ff('0x7'));var rimraf=require(_0xe1ff('0x8'));var config=require(_0xe1ff('0x9'));var attributes=require(_0xe1ff('0xa'));module[_0xe1ff('0xb')]=function(_0x54f710,_0x4bd010){return _0x54f710[_0xe1ff('0xc')](_0xe1ff('0xd'),attributes,{'tableName':_0xe1ff('0xe'),'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 fee435d..9b8e2e8 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 _0x82a4=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','lodash','util'];(function(_0x2dab48,_0x25cf19){var _0x3e22c9=function(_0xf46e12){while(--_0xf46e12){_0x2dab48['push'](_0x2dab48['shift']());}};_0x3e22c9(++_0x25cf19);}(_0x82a4,0x140));var _0x482a=function(_0x26dbf4,_0x5314a5){_0x26dbf4=_0x26dbf4-0x0;var _0x2d2e00=_0x82a4[_0x26dbf4];return _0x2d2e00;};'use strict';var _=require(_0x482a('0x0'));var util=require(_0x482a('0x1'));var moment=require(_0x482a('0x2'));var BPromise=require(_0x482a('0x3'));var rs=require(_0x482a('0x4'));var fs=require('fs');var Redis=require(_0x482a('0x5'));var db=require(_0x482a('0x6'))['db'];var utils=require(_0x482a('0x7'));var logger=require(_0x482a('0x8'))('rpc');var config=require(_0x482a('0x9'));var jayson=require(_0x482a('0xa'));var client=jayson[_0x482a('0xb')][_0x482a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5a525e,_0x205dba,_0x1a830c){return new BPromise(function(_0x547fbc,_0x1ffa14){return client['request'](_0x5a525e,_0x1a830c)[_0x482a('0xd')](function(_0x2477b2){logger['info'](_0x482a('0xe'),_0x205dba,_0x482a('0xf'));logger[_0x482a('0x10')](_0x482a('0x11'),_0x205dba,_0x482a('0xf'),JSON[_0x482a('0x12')](_0x2477b2));if(_0x2477b2[_0x482a('0x13')]){if(_0x2477b2['error']['code']===0x1f4){logger[_0x482a('0x13')](_0x482a('0xe'),_0x205dba,_0x2477b2['error'][_0x482a('0x14')]);return _0x1ffa14(_0x2477b2[_0x482a('0x13')][_0x482a('0x14')]);}logger[_0x482a('0x13')](_0x482a('0xe'),_0x205dba,_0x2477b2['error'][_0x482a('0x14')]);return _0x547fbc(_0x2477b2[_0x482a('0x13')][_0x482a('0x14')]);}else{logger[_0x482a('0x15')](_0x482a('0xe'),_0x205dba,_0x482a('0xf'));_0x547fbc(_0x2477b2['result'][_0x482a('0x14')]);}})[_0x482a('0x16')](function(_0x434f99){logger[_0x482a('0x13')](_0x482a('0xe'),_0x205dba,_0x434f99);_0x1ffa14(_0x434f99);});});} \ No newline at end of file +var _0xab4c=['jayson/promise','client','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x4c4340,_0x357f3e){var _0x5d5889=function(_0x4e380a){while(--_0x4e380a){_0x4c4340['push'](_0x4c4340['shift']());}};_0x5d5889(++_0x357f3e);}(_0xab4c,0x158));var _0xcab4=function(_0x726624,_0x21f598){_0x726624=_0x726624-0x0;var _0x14fb9f=_0xab4c[_0x726624];return _0x14fb9f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xcab4('0x0'));var BPromise=require(_0xcab4('0x1'));var rs=require(_0xcab4('0x2'));var fs=require('fs');var Redis=require(_0xcab4('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xcab4('0x4'));var logger=require(_0xcab4('0x5'))(_0xcab4('0x6'));var config=require(_0xcab4('0x7'));var jayson=require(_0xcab4('0x8'));var client=jayson[_0xcab4('0x9')][_0xcab4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1f5112,_0x124513,_0x304daf){return new BPromise(function(_0x16a13f,_0x43ef64){return client[_0xcab4('0xb')](_0x1f5112,_0x304daf)[_0xcab4('0xc')](function(_0x6832c0){logger[_0xcab4('0xd')](_0xcab4('0xe'),_0x124513,_0xcab4('0xf'));logger['debug'](_0xcab4('0x10'),_0x124513,_0xcab4('0xf'),JSON[_0xcab4('0x11')](_0x6832c0));if(_0x6832c0[_0xcab4('0x12')]){if(_0x6832c0['error'][_0xcab4('0x13')]===0x1f4){logger['error'](_0xcab4('0xe'),_0x124513,_0x6832c0[_0xcab4('0x12')][_0xcab4('0x14')]);return _0x43ef64(_0x6832c0[_0xcab4('0x12')][_0xcab4('0x14')]);}logger[_0xcab4('0x12')](_0xcab4('0xe'),_0x124513,_0x6832c0['error'][_0xcab4('0x14')]);return _0x16a13f(_0x6832c0[_0xcab4('0x12')][_0xcab4('0x14')]);}else{logger[_0xcab4('0xd')](_0xcab4('0xe'),_0x124513,_0xcab4('0xf'));_0x16a13f(_0x6832c0['result'][_0xcab4('0x14')]);}})[_0xcab4('0x15')](function(_0x44dae7){logger[_0xcab4('0x12')](_0xcab4('0xe'),_0x124513,_0x44dae7);_0x43ef64(_0x44dae7);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index abf1081..d6b1c52 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 _0x7118=['show','post','create','put','destroy','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','index','/:id','isAuthenticated'];(function(_0x423549,_0x242e63){var _0xdcb104=function(_0x6bff59){while(--_0x6bff59){_0x423549['push'](_0x423549['shift']());}};_0xdcb104(++_0x242e63);}(_0x7118,0x159));var _0x8711=function(_0x1e6a1c,_0x545b3b){_0x1e6a1c=_0x1e6a1c-0x0;var _0x3c7124=_0x7118[_0x1e6a1c];return _0x3c7124;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8711('0x0'));var timeout=require(_0x8711('0x1'));var express=require('express');var router=express[_0x8711('0x2')]();var fs_extra=require(_0x8711('0x3'));var auth=require(_0x8711('0x4'));var interaction=require(_0x8711('0x5'));var config=require(_0x8711('0x6'));var controller=require(_0x8711('0x7'));router[_0x8711('0x8')]('/',auth['isAuthenticated'](),controller[_0x8711('0x9')]);router[_0x8711('0x8')](_0x8711('0xa'),auth[_0x8711('0xb')](),controller[_0x8711('0xc')]);router[_0x8711('0xd')]('/',auth[_0x8711('0xb')](),controller[_0x8711('0xe')]);router[_0x8711('0xf')](_0x8711('0xa'),auth[_0x8711('0xb')](),controller['update']);router['delete'](_0x8711('0xa'),auth[_0x8711('0xb')](),controller[_0x8711('0x10')]);module['exports']=router; \ No newline at end of file +var _0xfb82=['update','delete','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','/:id','post','create','put'];(function(_0x360e71,_0x4bdede){var _0x511e95=function(_0x3ddf34){while(--_0x3ddf34){_0x360e71['push'](_0x360e71['shift']());}};_0x511e95(++_0x4bdede);}(_0xfb82,0x17f));var _0x2fb8=function(_0x53880f,_0x5e3097){_0x53880f=_0x53880f-0x0;var _0x56e24a=_0xfb82[_0x53880f];return _0x56e24a;};'use strict';var multer=require(_0x2fb8('0x0'));var util=require(_0x2fb8('0x1'));var path=require(_0x2fb8('0x2'));var timeout=require('connect-timeout');var express=require(_0x2fb8('0x3'));var router=express[_0x2fb8('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2fb8('0x5'));var interaction=require(_0x2fb8('0x6'));var config=require(_0x2fb8('0x7'));var controller=require(_0x2fb8('0x8'));router[_0x2fb8('0x9')]('/',auth[_0x2fb8('0xa')](),controller[_0x2fb8('0xb')]);router[_0x2fb8('0x9')](_0x2fb8('0xc'),auth[_0x2fb8('0xa')](),controller['show']);router[_0x2fb8('0xd')]('/',auth[_0x2fb8('0xa')](),controller[_0x2fb8('0xe')]);router[_0x2fb8('0xf')](_0x2fb8('0xc'),auth[_0x2fb8('0xa')](),controller[_0x2fb8('0x10')]);router[_0x2fb8('0x11')](_0x2fb8('0xc'),auth[_0x2fb8('0xa')](),controller[_0x2fb8('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 0ecb294..4a71496 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 _0x75e7=['sequelize','TEXT'];(function(_0x111ee6,_0xd8a3ea){var _0x8bbb51=function(_0x273011){while(--_0x273011){_0x111ee6['push'](_0x111ee6['shift']());}};_0x8bbb51(++_0xd8a3ea);}(_0x75e7,0x1c8));var _0x775e=function(_0x48d6a3,_0x37c848){_0x48d6a3=_0x48d6a3-0x0;var _0x38bfa0=_0x75e7[_0x48d6a3];return _0x38bfa0;};'use strict';var Sequelize=require(_0x775e('0x0'));module['exports']={'tree':{'type':Sequelize[_0x775e('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x7231=['exports','TEXT'];(function(_0x1fd17b,_0x44d43d){var _0x3ddbb5=function(_0x3ee35e){while(--_0x3ee35e){_0x1fd17b['push'](_0x1fd17b['shift']());}};_0x3ddbb5(++_0x44d43d);}(_0x7231,0xd2));var _0x1723=function(_0x713846,_0x1c8897){_0x713846=_0x713846-0x0;var _0x1266a6=_0x7231[_0x713846];return _0x1266a6;};'use strict';var Sequelize=require('sequelize');module[_0x1723('0x0')]={'tree':{'type':Sequelize[_0x1723('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index b530bb5..0f0f30b 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 _0x280f=['moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','end','stack','name','send','index','AnalyticTreeReport','rawAttributes','model','map','query','filters','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filter','type','merge','options','includeAll','include','findAll','rows','catch','keys','attributes','length','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x1ba52b,_0xe8055a){var _0xf14517=function(_0x33bb2e){while(--_0x33bb2e){_0x1ba52b['push'](_0x1ba52b['shift']());}};_0xf14517(++_0xe8055a);}(_0x280f,0xdc));var _0xf280=function(_0x2718c7,_0x5a1636){_0x2718c7=_0x2718c7-0x0;var _0x59d89c=_0x280f[_0x2718c7];return _0x59d89c;};'use strict';var emlformat=require(_0xf280('0x0'));var rimraf=require(_0xf280('0x1'));var zipdir=require(_0xf280('0x2'));var jsonpatch=require(_0xf280('0x3'));var rp=require(_0xf280('0x4'));var moment=require(_0xf280('0x5'));var BPromise=require(_0xf280('0x6'));var Mustache=require(_0xf280('0x7'));var util=require(_0xf280('0x8'));var path=require(_0xf280('0x9'));var sox=require(_0xf280('0xa'));var csv=require(_0xf280('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf280('0xc'));var _=require(_0xf280('0xd'));var squel=require('squel');var crypto=require(_0xf280('0xe'));var jsforce=require(_0xf280('0xf'));var deskjs=require(_0xf280('0x10'));var toCsv=require(_0xf280('0xb'));var querystring=require('querystring');var Papa=require(_0xf280('0x11'));var Redis=require(_0xf280('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xf280('0x13'));var as=require(_0xf280('0x14'));var hardwareService=require(_0xf280('0x15'));var logger=require(_0xf280('0x16'))(_0xf280('0x17'));var utils=require(_0xf280('0x18'));var config=require(_0xf280('0x19'));var licenseUtil=require(_0xf280('0x1a'));var db=require(_0xf280('0x1b'))['db'];function respondWithStatusCode(_0x3006a6,_0x2247e5){_0x2247e5=_0x2247e5||0xcc;return function(_0x3652d4){if(_0x3652d4){return _0x3006a6[_0xf280('0x1c')](_0x2247e5);}return _0x3006a6['status'](_0x2247e5)['end']();};}function respondWithResult(_0x1b4b75,_0x23f85c){_0x23f85c=_0x23f85c||0xc8;return function(_0x299de3){if(_0x299de3){return _0x1b4b75[_0xf280('0x1d')](_0x23f85c)[_0xf280('0x1e')](_0x299de3);}};}function respondWithFilteredResult(_0x2c00e5,_0x363049){return function(_0x3eeecc){if(_0x3eeecc){var _0x4dd261=typeof _0x363049['offset']==='undefined'&&typeof _0x363049[_0xf280('0x1f')]==='undefined';var _0x5d7427=_0x3eeecc[_0xf280('0x20')];var _0x4d7745=_0x4dd261?0x0:_0x363049['offset'];var _0x71208=_0x4dd261?_0x3eeecc[_0xf280('0x20')]:_0x363049[_0xf280('0x21')]+_0x363049[_0xf280('0x1f')];var _0x6b9c21;if(_0x71208>=_0x5d7427){_0x71208=_0x5d7427;_0x6b9c21=0xc8;}else{_0x6b9c21=0xce;}_0x2c00e5[_0xf280('0x1d')](_0x6b9c21);return _0x2c00e5[_0xf280('0x22')](_0xf280('0x23'),_0x4d7745+'-'+_0x71208+'/'+_0x5d7427)['json'](_0x3eeecc);}return null;};}function patchUpdates(_0x377f76){return function(_0x46d975){try{jsonpatch[_0xf280('0x24')](_0x46d975,_0x377f76,!![]);}catch(_0x274dc8){return BPromise['reject'](_0x274dc8);}return _0x46d975[_0xf280('0x25')]();};}function saveUpdates(_0x42c42e,_0x5aeea1){return function(_0x414d92){if(_0x414d92){return _0x414d92[_0xf280('0x26')](_0x42c42e)[_0xf280('0x27')](function(_0x56bad9){return _0x56bad9;});}return null;};}function removeEntity(_0x249904,_0x171e73){return function(_0xf76d3b){if(_0xf76d3b){return _0xf76d3b[_0xf280('0x28')]()[_0xf280('0x27')](function(){_0x249904[_0xf280('0x1d')](0xcc)[_0xf280('0x29')]();});}};}function handleEntityNotFound(_0x5595ab,_0x38d9c7){return function(_0x416a3b){if(!_0x416a3b){_0x5595ab[_0xf280('0x1c')](0x194);}return _0x416a3b;};}function handleError(_0x66b8fc,_0x22c5a1){_0x22c5a1=_0x22c5a1||0x1f4;return function(_0x3b7232){logger['error'](_0x3b7232[_0xf280('0x2a')]);if(_0x3b7232[_0xf280('0x2b')]){delete _0x3b7232[_0xf280('0x2b')];}_0x66b8fc[_0xf280('0x1d')](_0x22c5a1)[_0xf280('0x2c')](_0x3b7232);};}exports[_0xf280('0x2d')]=function(_0x4d407b,_0x5125b8){var _0x128d0f={},_0x22ef11={},_0x27b6a3={'count':0x0,'rows':[]};var _0x1a2e92=_['map'](db[_0xf280('0x2e')][_0xf280('0x2f')],function(_0x375058){return{'name':_0x375058['fieldName'],'type':_0x375058['type']['key']};});_0x22ef11[_0xf280('0x30')]=_[_0xf280('0x31')](_0x1a2e92,_0xf280('0x2b'));_0x22ef11[_0xf280('0x32')]=_['keys'](_0x4d407b[_0xf280('0x32')]);_0x22ef11[_0xf280('0x33')]=_[_0xf280('0x34')](_0x22ef11[_0xf280('0x30')],_0x22ef11[_0xf280('0x32')]);_0x128d0f['attributes']=_[_0xf280('0x34')](_0x22ef11[_0xf280('0x30')],qs[_0xf280('0x35')](_0x4d407b[_0xf280('0x32')][_0xf280('0x35')]));_0x128d0f['attributes']=_0x128d0f['attributes']['length']?_0x128d0f['attributes']:_0x22ef11[_0xf280('0x30')];if(!_0x4d407b[_0xf280('0x32')][_0xf280('0x36')](_0xf280('0x37'))){_0x128d0f[_0xf280('0x1f')]=qs[_0xf280('0x1f')](_0x4d407b[_0xf280('0x32')]['limit']);_0x128d0f['offset']=qs[_0xf280('0x21')](_0x4d407b[_0xf280('0x32')]['offset']);}_0x128d0f[_0xf280('0x38')]=qs[_0xf280('0x39')](_0x4d407b['query'][_0xf280('0x39')]);_0x128d0f[_0xf280('0x3a')]=qs[_0xf280('0x33')](_['pick'](_0x4d407b[_0xf280('0x32')],_0x22ef11[_0xf280('0x33')]),_0x1a2e92);if(_0x4d407b[_0xf280('0x32')][_0xf280('0x3b')]){_0x128d0f[_0xf280('0x3a')]=_['merge'](_0x128d0f[_0xf280('0x3a')],{'$or':_[_0xf280('0x31')](_0x1a2e92,function(_0x1f90af){if(_0x1f90af[_0xf280('0x3c')]!=='VIRTUAL'){var _0x5a0bd9={};_0x5a0bd9[_0x1f90af['name']]={'$like':'%'+_0x4d407b['query'][_0xf280('0x3b')]+'%'};return _0x5a0bd9;}})});}_0x128d0f=_[_0xf280('0x3d')]({},_0x128d0f,_0x4d407b[_0xf280('0x3e')]);var _0x495ef4={'where':_0x128d0f[_0xf280('0x3a')]};return db[_0xf280('0x2e')][_0xf280('0x20')](_0x495ef4)['then'](function(_0x1c4612){_0x27b6a3[_0xf280('0x20')]=_0x1c4612;if(_0x4d407b[_0xf280('0x32')][_0xf280('0x3f')]){_0x128d0f[_0xf280('0x40')]=[{'all':!![]}];}return db['AnalyticTreeReport'][_0xf280('0x41')](_0x128d0f);})[_0xf280('0x27')](function(_0x425f7b){_0x27b6a3[_0xf280('0x42')]=_0x425f7b;return _0x27b6a3;})[_0xf280('0x27')](respondWithFilteredResult(_0x5125b8,_0x128d0f))[_0xf280('0x43')](handleError(_0x5125b8,null));};exports['show']=function(_0x3a4d31,_0x15e8a9){var _0x5a4c59={'raw':!![],'where':{'id':_0x3a4d31['params']['id']}},_0x371d3b={};_0x371d3b[_0xf280('0x30')]=_[_0xf280('0x44')](db[_0xf280('0x2e')][_0xf280('0x2f')]);_0x371d3b['query']=_['keys'](_0x3a4d31[_0xf280('0x32')]);_0x371d3b[_0xf280('0x33')]=_[_0xf280('0x34')](_0x371d3b['model'],_0x371d3b[_0xf280('0x32')]);_0x5a4c59[_0xf280('0x45')]=_['intersection'](_0x371d3b[_0xf280('0x30')],qs[_0xf280('0x35')](_0x3a4d31[_0xf280('0x32')]['fields']));_0x5a4c59['attributes']=_0x5a4c59['attributes'][_0xf280('0x46')]?_0x5a4c59[_0xf280('0x45')]:_0x371d3b[_0xf280('0x30')];if(_0x3a4d31[_0xf280('0x32')][_0xf280('0x3f')]){_0x5a4c59[_0xf280('0x40')]=[{'all':!![]}];}_0x5a4c59=_[_0xf280('0x3d')]({},_0x5a4c59,_0x3a4d31[_0xf280('0x3e')]);return db[_0xf280('0x2e')][_0xf280('0x47')](_0x5a4c59)[_0xf280('0x27')](handleEntityNotFound(_0x15e8a9,null))[_0xf280('0x27')](respondWithResult(_0x15e8a9,null))[_0xf280('0x43')](handleError(_0x15e8a9,null));};exports[_0xf280('0x48')]=function(_0x212c7f,_0x17df68){return db[_0xf280('0x2e')][_0xf280('0x48')](_0x212c7f['body'],{})[_0xf280('0x27')](respondWithResult(_0x17df68,0xc9))[_0xf280('0x43')](handleError(_0x17df68,null));};exports[_0xf280('0x26')]=function(_0x7706e9,_0x3ad9fd){if(_0x7706e9[_0xf280('0x49')]['id']){delete _0x7706e9[_0xf280('0x49')]['id'];}return db[_0xf280('0x2e')][_0xf280('0x47')]({'where':{'id':_0x7706e9[_0xf280('0x4a')]['id']}})[_0xf280('0x27')](handleEntityNotFound(_0x3ad9fd,null))[_0xf280('0x27')](saveUpdates(_0x7706e9['body'],null))[_0xf280('0x27')](respondWithResult(_0x3ad9fd,null))[_0xf280('0x43')](handleError(_0x3ad9fd,null));};exports[_0xf280('0x28')]=function(_0x4174da,_0xbf05){return db[_0xf280('0x2e')][_0xf280('0x47')]({'where':{'id':_0x4174da[_0xf280('0x4a')]['id']}})[_0xf280('0x27')](handleEntityNotFound(_0xbf05,null))[_0xf280('0x27')](removeEntity(_0xbf05,null))[_0xf280('0x43')](handleError(_0xbf05,null));}; \ No newline at end of file +var _0x0a11=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','Content-Range','save','update','then','destroy','error','stack','name','send','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','query','keys','model','fields','attributes','length','order','sort','where','filters','pick','filter','merge','options','include','rows','intersection','includeAll','create','body','catch','find','params','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x58d61e,_0x65c88b){var _0x420e3f=function(_0x44893e){while(--_0x44893e){_0x58d61e['push'](_0x58d61e['shift']());}};_0x420e3f(++_0x65c88b);}(_0x0a11,0x104));var _0x10a1=function(_0x420f2a,_0x2cc58d){_0x420f2a=_0x420f2a-0x0;var _0x28f802=_0x0a11[_0x420f2a];return _0x28f802;};'use strict';var emlformat=require(_0x10a1('0x0'));var rimraf=require(_0x10a1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x10a1('0x2'));var rp=require(_0x10a1('0x3'));var moment=require(_0x10a1('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x10a1('0x5'));var util=require(_0x10a1('0x6'));var path=require('path');var sox=require(_0x10a1('0x7'));var csv=require(_0x10a1('0x8'));var ejs=require(_0x10a1('0x9'));var fs=require('fs');var fs_extra=require(_0x10a1('0xa'));var _=require('lodash');var squel=require(_0x10a1('0xb'));var crypto=require('crypto');var jsforce=require(_0x10a1('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x10a1('0x8'));var querystring=require(_0x10a1('0xd'));var Papa=require('papaparse');var Redis=require(_0x10a1('0xe'));var authService=require(_0x10a1('0xf'));var qs=require(_0x10a1('0x10'));var as=require(_0x10a1('0x11'));var hardwareService=require(_0x10a1('0x12'));var logger=require(_0x10a1('0x13'))(_0x10a1('0x14'));var utils=require(_0x10a1('0x15'));var config=require(_0x10a1('0x16'));var licenseUtil=require(_0x10a1('0x17'));var db=require(_0x10a1('0x18'))['db'];function respondWithStatusCode(_0x56faa8,_0x5a2a03){_0x5a2a03=_0x5a2a03||0xcc;return function(_0x11738e){if(_0x11738e){return _0x56faa8[_0x10a1('0x19')](_0x5a2a03);}return _0x56faa8[_0x10a1('0x1a')](_0x5a2a03)[_0x10a1('0x1b')]();};}function respondWithResult(_0x50150d,_0x4c3fa1){_0x4c3fa1=_0x4c3fa1||0xc8;return function(_0x2d450d){if(_0x2d450d){return _0x50150d['status'](_0x4c3fa1)['json'](_0x2d450d);}};}function respondWithFilteredResult(_0x286901,_0x3a2b29){return function(_0x4542b0){if(_0x4542b0){var _0x16eb27=typeof _0x3a2b29[_0x10a1('0x1c')]==='undefined'&&typeof _0x3a2b29[_0x10a1('0x1d')]===_0x10a1('0x1e');var _0x553d4a=_0x4542b0[_0x10a1('0x1f')];var _0x35ad98=_0x16eb27?0x0:_0x3a2b29[_0x10a1('0x1c')];var _0x1313f9=_0x16eb27?_0x4542b0['count']:_0x3a2b29[_0x10a1('0x1c')]+_0x3a2b29[_0x10a1('0x1d')];var _0x1b0149;if(_0x1313f9>=_0x553d4a){_0x1313f9=_0x553d4a;_0x1b0149=0xc8;}else{_0x1b0149=0xce;}_0x286901[_0x10a1('0x1a')](_0x1b0149);return _0x286901['set'](_0x10a1('0x20'),_0x35ad98+'-'+_0x1313f9+'/'+_0x553d4a)['json'](_0x4542b0);}return null;};}function patchUpdates(_0x567932){return function(_0x5b043b){try{jsonpatch['apply'](_0x5b043b,_0x567932,!![]);}catch(_0x406609){return BPromise['reject'](_0x406609);}return _0x5b043b[_0x10a1('0x21')]();};}function saveUpdates(_0x4bcb76,_0x3bf836){return function(_0x102a0c){if(_0x102a0c){return _0x102a0c[_0x10a1('0x22')](_0x4bcb76)[_0x10a1('0x23')](function(_0x553f48){return _0x553f48;});}return null;};}function removeEntity(_0x475339,_0x34cfc9){return function(_0x4cbe36){if(_0x4cbe36){return _0x4cbe36[_0x10a1('0x24')]()[_0x10a1('0x23')](function(){_0x475339[_0x10a1('0x1a')](0xcc)[_0x10a1('0x1b')]();});}};}function handleEntityNotFound(_0x45ed47,_0x2ac9e4){return function(_0x3fd1b5){if(!_0x3fd1b5){_0x45ed47['sendStatus'](0x194);}return _0x3fd1b5;};}function handleError(_0x876ea0,_0x27001f){_0x27001f=_0x27001f||0x1f4;return function(_0x2c3569){logger[_0x10a1('0x25')](_0x2c3569[_0x10a1('0x26')]);if(_0x2c3569[_0x10a1('0x27')]){delete _0x2c3569[_0x10a1('0x27')];}_0x876ea0[_0x10a1('0x1a')](_0x27001f)[_0x10a1('0x28')](_0x2c3569);};}exports['index']=function(_0x355a5e,_0x44c0c1){var _0x27eff1={},_0x55bd45={},_0x36b32c={'count':0x0,'rows':[]};var _0x43ef18=_[_0x10a1('0x29')](db[_0x10a1('0x2a')][_0x10a1('0x2b')],function(_0x4a70d8){return{'name':_0x4a70d8[_0x10a1('0x2c')],'type':_0x4a70d8[_0x10a1('0x2d')][_0x10a1('0x2e')]};});_0x55bd45['model']=_[_0x10a1('0x29')](_0x43ef18,_0x10a1('0x27'));_0x55bd45[_0x10a1('0x2f')]=_[_0x10a1('0x30')](_0x355a5e['query']);_0x55bd45['filters']=_['intersection'](_0x55bd45[_0x10a1('0x31')],_0x55bd45['query']);_0x27eff1['attributes']=_['intersection'](_0x55bd45['model'],qs[_0x10a1('0x32')](_0x355a5e[_0x10a1('0x2f')][_0x10a1('0x32')]));_0x27eff1[_0x10a1('0x33')]=_0x27eff1[_0x10a1('0x33')][_0x10a1('0x34')]?_0x27eff1[_0x10a1('0x33')]:_0x55bd45['model'];if(!_0x355a5e['query']['hasOwnProperty']('nolimit')){_0x27eff1['limit']=qs[_0x10a1('0x1d')](_0x355a5e[_0x10a1('0x2f')][_0x10a1('0x1d')]);_0x27eff1[_0x10a1('0x1c')]=qs['offset'](_0x355a5e[_0x10a1('0x2f')]['offset']);}_0x27eff1[_0x10a1('0x35')]=qs['sort'](_0x355a5e[_0x10a1('0x2f')][_0x10a1('0x36')]);_0x27eff1[_0x10a1('0x37')]=qs[_0x10a1('0x38')](_[_0x10a1('0x39')](_0x355a5e[_0x10a1('0x2f')],_0x55bd45[_0x10a1('0x38')]),_0x43ef18);if(_0x355a5e[_0x10a1('0x2f')][_0x10a1('0x3a')]){_0x27eff1[_0x10a1('0x37')]=_[_0x10a1('0x3b')](_0x27eff1[_0x10a1('0x37')],{'$or':_[_0x10a1('0x29')](_0x43ef18,function(_0x59f48f){if(_0x59f48f['type']!=='VIRTUAL'){var _0x4cf2ea={};_0x4cf2ea[_0x59f48f[_0x10a1('0x27')]]={'$like':'%'+_0x355a5e['query']['filter']+'%'};return _0x4cf2ea;}})});}_0x27eff1=_[_0x10a1('0x3b')]({},_0x27eff1,_0x355a5e[_0x10a1('0x3c')]);var _0x4b3f47={'where':_0x27eff1[_0x10a1('0x37')]};return db['AnalyticTreeReport']['count'](_0x4b3f47)[_0x10a1('0x23')](function(_0x3ec03d){_0x36b32c[_0x10a1('0x1f')]=_0x3ec03d;if(_0x355a5e[_0x10a1('0x2f')]['includeAll']){_0x27eff1[_0x10a1('0x3d')]=[{'all':!![]}];}return db[_0x10a1('0x2a')]['findAll'](_0x27eff1);})[_0x10a1('0x23')](function(_0x386668){_0x36b32c[_0x10a1('0x3e')]=_0x386668;return _0x36b32c;})['then'](respondWithFilteredResult(_0x44c0c1,_0x27eff1))['catch'](handleError(_0x44c0c1,null));};exports['show']=function(_0x474760,_0x14a2ab){var _0x3b96b8={'raw':!![],'where':{'id':_0x474760['params']['id']}},_0x3fa6ad={};_0x3fa6ad[_0x10a1('0x31')]=_[_0x10a1('0x30')](db[_0x10a1('0x2a')]['rawAttributes']);_0x3fa6ad['query']=_[_0x10a1('0x30')](_0x474760['query']);_0x3fa6ad[_0x10a1('0x38')]=_[_0x10a1('0x3f')](_0x3fa6ad[_0x10a1('0x31')],_0x3fa6ad[_0x10a1('0x2f')]);_0x3b96b8[_0x10a1('0x33')]=_[_0x10a1('0x3f')](_0x3fa6ad['model'],qs['fields'](_0x474760[_0x10a1('0x2f')]['fields']));_0x3b96b8[_0x10a1('0x33')]=_0x3b96b8[_0x10a1('0x33')]['length']?_0x3b96b8[_0x10a1('0x33')]:_0x3fa6ad[_0x10a1('0x31')];if(_0x474760[_0x10a1('0x2f')][_0x10a1('0x40')]){_0x3b96b8[_0x10a1('0x3d')]=[{'all':!![]}];}_0x3b96b8=_[_0x10a1('0x3b')]({},_0x3b96b8,_0x474760[_0x10a1('0x3c')]);return db[_0x10a1('0x2a')]['find'](_0x3b96b8)[_0x10a1('0x23')](handleEntityNotFound(_0x14a2ab,null))['then'](respondWithResult(_0x14a2ab,null))['catch'](handleError(_0x14a2ab,null));};exports[_0x10a1('0x41')]=function(_0x565624,_0x104b01){return db[_0x10a1('0x2a')][_0x10a1('0x41')](_0x565624[_0x10a1('0x42')],{})['then'](respondWithResult(_0x104b01,0xc9))[_0x10a1('0x43')](handleError(_0x104b01,null));};exports[_0x10a1('0x22')]=function(_0x2310a1,_0x287620){if(_0x2310a1['body']['id']){delete _0x2310a1[_0x10a1('0x42')]['id'];}return db[_0x10a1('0x2a')][_0x10a1('0x44')]({'where':{'id':_0x2310a1[_0x10a1('0x45')]['id']}})[_0x10a1('0x23')](handleEntityNotFound(_0x287620,null))[_0x10a1('0x23')](saveUpdates(_0x2310a1['body'],null))['then'](respondWithResult(_0x287620,null))['catch'](handleError(_0x287620,null));};exports['destroy']=function(_0x32e289,_0x57f59b){return db[_0x10a1('0x2a')][_0x10a1('0x44')]({'where':{'id':_0x32e289['params']['id']}})[_0x10a1('0x23')](handleEntityNotFound(_0x57f59b,null))['then'](removeEntity(_0x57f59b,null))[_0x10a1('0x43')](handleError(_0x57f59b,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 47be330..38a0994 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 _0xfcf2=['analytics_report_trees','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes','define'];(function(_0x46cf00,_0x457a43){var _0x3974dc=function(_0x4b5d0a){while(--_0x4b5d0a){_0x46cf00['push'](_0x46cf00['shift']());}};_0x3974dc(++_0x457a43);}(_0xfcf2,0x16d));var _0x2fcf=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0xfcf2[_0x29d94e];return _0x106237;};'use strict';var _=require(_0x2fcf('0x0'));var util=require(_0x2fcf('0x1'));var logger=require(_0x2fcf('0x2'))(_0x2fcf('0x3'));var moment=require(_0x2fcf('0x4'));var BPromise=require(_0x2fcf('0x5'));var rp=require(_0x2fcf('0x6'));var fs=require('fs');var path=require(_0x2fcf('0x7'));var rimraf=require(_0x2fcf('0x8'));var config=require(_0x2fcf('0x9'));var attributes=require(_0x2fcf('0xa'));module['exports']=function(_0x5bc354,_0x3dfdd4){return _0x5bc354[_0x2fcf('0xb')]('AnalyticTreeReport',attributes,{'tableName':_0x2fcf('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x045a=['./analyticTreeReport.attributes','exports','define','lodash','util','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x4b13f0,_0x1273df){var _0x2a1955=function(_0x5634ea){while(--_0x5634ea){_0x4b13f0['push'](_0x4b13f0['shift']());}};_0x2a1955(++_0x1273df);}(_0x045a,0x175));var _0xa045=function(_0x47876b,_0x13ea94){_0x47876b=_0x47876b-0x0;var _0x4a32f3=_0x045a[_0x47876b];return _0x4a32f3;};'use strict';var _=require(_0xa045('0x0'));var util=require(_0xa045('0x1'));var logger=require(_0xa045('0x2'))('api');var moment=require(_0xa045('0x3'));var BPromise=require('bluebird');var rp=require(_0xa045('0x4'));var fs=require('fs');var path=require(_0xa045('0x5'));var rimraf=require(_0xa045('0x6'));var config=require('../../config/environment');var attributes=require(_0xa045('0x7'));module[_0xa045('0x8')]=function(_0x218a79,_0xb480de){return _0x218a79[_0xa045('0x9')]('AnalyticTreeReport',attributes,{'tableName':'analytics_report_trees','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 d889cb6..e201be5 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.rpc.js +++ b/server/api/analyticTreeReport/analyticTreeReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['info','AnalyticTreeReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7a54,0x106));var _0x47a5=function(_0x1b0b91,_0x13ab8d){_0x1b0b91=_0x1b0b91-0x0;var _0x1006d1=_0x7a54[_0x1b0b91];return _0x1006d1;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0x5f66=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','util','bluebird','randomstring','ioredis'];(function(_0x192363,_0x1caa87){var _0x324774=function(_0x538da6){while(--_0x538da6){_0x192363['push'](_0x192363['shift']());}};_0x324774(++_0x1caa87);}(_0x5f66,0x1a0));var _0x65f6=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x5f66[_0x122096];return _0x3d1966;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ed98f,_0x1c0e12,_0x2c6571){return new BPromise(function(_0x112079,_0x8f6451){return client[_0x65f6('0x9')](_0x4ed98f,_0x2c6571)[_0x65f6('0xa')](function(_0x48d85c){logger['info'](_0x65f6('0xb'),_0x1c0e12,_0x65f6('0xc'));logger[_0x65f6('0xd')](_0x65f6('0xe'),_0x1c0e12,'request\x20sent',JSON[_0x65f6('0xf')](_0x48d85c));if(_0x48d85c['error']){if(_0x48d85c['error'][_0x65f6('0x10')]===0x1f4){logger['error'](_0x65f6('0xb'),_0x1c0e12,_0x48d85c['error'][_0x65f6('0x11')]);return _0x8f6451(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);return _0x112079(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}else{logger[_0x65f6('0x13')]('AnalyticTreeReport,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 05c097b..aa5fa1a 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 _0xf5f9=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index','/:id','show','put','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0xe334ff,_0x292181){var _0x2f4c66=function(_0x55a29f){while(--_0x55a29f){_0xe334ff['push'](_0xe334ff['shift']());}};_0x2f4c66(++_0x292181);}(_0xf5f9,0x11a));var _0x9f5f=function(_0x74ca2b,_0x1707df){_0x74ca2b=_0x74ca2b-0x0;var _0x381195=_0xf5f9[_0x74ca2b];return _0x381195;};'use strict';var multer=require('multer');var util=require(_0x9f5f('0x0'));var path=require(_0x9f5f('0x1'));var timeout=require(_0x9f5f('0x2'));var express=require(_0x9f5f('0x3'));var router=express['Router']();var fs_extra=require(_0x9f5f('0x4'));var auth=require(_0x9f5f('0x5'));var interaction=require(_0x9f5f('0x6'));var config=require(_0x9f5f('0x7'));var controller=require(_0x9f5f('0x8'));router[_0x9f5f('0x9')]('/',auth[_0x9f5f('0xa')](),controller[_0x9f5f('0xb')]);router[_0x9f5f('0x9')](_0x9f5f('0xc'),auth[_0x9f5f('0xa')](),controller[_0x9f5f('0xd')]);router['post']('/',auth[_0x9f5f('0xa')](),controller['create']);router[_0x9f5f('0xe')](_0x9f5f('0xc'),auth[_0x9f5f('0xa')](),controller[_0x9f5f('0xf')]);router[_0x9f5f('0x10')]('/:id',auth[_0x9f5f('0xa')](),controller[_0x9f5f('0x11')]);module[_0x9f5f('0x12')]=router; \ No newline at end of file +var _0xf944=['../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','path','connect-timeout','express','Router','fs-extra'];(function(_0x4e8236,_0x2d7147){var _0x14390f=function(_0x23fb0d){while(--_0x23fb0d){_0x4e8236['push'](_0x4e8236['shift']());}};_0x14390f(++_0x2d7147);}(_0xf944,0xcc));var _0x4f94=function(_0x106731,_0xd21e31){_0x106731=_0x106731-0x0;var _0x223f3a=_0xf944[_0x106731];return _0x223f3a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4f94('0x0'));var timeout=require(_0x4f94('0x1'));var express=require(_0x4f94('0x2'));var router=express[_0x4f94('0x3')]();var fs_extra=require(_0x4f94('0x4'));var auth=require(_0x4f94('0x5'));var interaction=require(_0x4f94('0x6'));var config=require(_0x4f94('0x7'));var controller=require(_0x4f94('0x8'));router[_0x4f94('0x9')]('/',auth['isAuthenticated'](),controller[_0x4f94('0xa')]);router[_0x4f94('0x9')](_0x4f94('0xb'),auth[_0x4f94('0xc')](),controller[_0x4f94('0xd')]);router[_0x4f94('0xe')]('/',auth[_0x4f94('0xc')](),controller[_0x4f94('0xf')]);router[_0x4f94('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x4f94('0x11')]);router[_0x4f94('0x12')](_0x4f94('0xb'),auth[_0x4f94('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 8ca0308..179fcf2 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 _0xdad2=['exports','STRING'];(function(_0x3635d4,_0x5ecc27){var _0xa2ed30=function(_0x195d27){while(--_0x195d27){_0x3635d4['push'](_0x3635d4['shift']());}};_0xa2ed30(++_0x5ecc27);}(_0xdad2,0x14c));var _0x2dad=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xdad2[_0x4e676e];return _0x336a3c;};'use strict';var Sequelize=require('sequelize');module[_0x2dad('0x0')]={'name':{'type':Sequelize[_0x2dad('0x1')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x2dad('0x1')]}}; \ No newline at end of file +var _0x2b84=['STRING','sequelize'];(function(_0x20a40e,_0x265c21){var _0x34477d=function(_0x34454f){while(--_0x34454f){_0x20a40e['push'](_0x20a40e['shift']());}};_0x34477d(++_0x265c21);}(_0x2b84,0x105));var _0x42b8=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0x2b84[_0xd1d19a];return _0x52a79d;};'use strict';var Sequelize=require(_0x42b8('0x0'));module['exports']={'name':{'type':Sequelize[_0x42b8('0x1')]},'basename':{'type':Sequelize[_0x42b8('0x1')]},'type':{'type':Sequelize[_0x42b8('0x1')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index ae7b6d0..49e7d73 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 _0xc6d4=['query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','Attachment','includeAll','include','findAll','rows','catch','show','params','fields','find','clone','options','get','omit','createdAt','updatedAt','body','create','update','file','originalname','basename','filename','mimetype','ChatOfflineMessageId','join','root','download','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','sendStatus','error','name','rawAttributes','type','model','map'];(function(_0x589248,_0x31dea3){var _0x486750=function(_0x3e7c21){while(--_0x3e7c21){_0x589248['push'](_0x589248['shift']());}};_0x486750(++_0x31dea3);}(_0xc6d4,0x192));var _0x4c6d=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xc6d4[_0x2d7f0e];return _0x110b07;};'use strict';var emlformat=require(_0x4c6d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4c6d('0x1'));var rp=require(_0x4c6d('0x2'));var moment=require(_0x4c6d('0x3'));var BPromise=require(_0x4c6d('0x4'));var Mustache=require(_0x4c6d('0x5'));var util=require(_0x4c6d('0x6'));var path=require('path');var sox=require(_0x4c6d('0x7'));var csv=require(_0x4c6d('0x8'));var ejs=require(_0x4c6d('0x9'));var fs=require('fs');var fs_extra=require(_0x4c6d('0xa'));var _=require(_0x4c6d('0xb'));var squel=require(_0x4c6d('0xc'));var crypto=require(_0x4c6d('0xd'));var jsforce=require(_0x4c6d('0xe'));var deskjs=require(_0x4c6d('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4c6d('0x10'));var Papa=require(_0x4c6d('0x11'));var Redis=require(_0x4c6d('0x12'));var authService=require(_0x4c6d('0x13'));var qs=require(_0x4c6d('0x14'));var as=require(_0x4c6d('0x15'));var hardwareService=require(_0x4c6d('0x16'));var logger=require(_0x4c6d('0x17'))(_0x4c6d('0x18'));var utils=require(_0x4c6d('0x19'));var config=require(_0x4c6d('0x1a'));var licenseUtil=require(_0x4c6d('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x349b59,_0x2edd1f){_0x2edd1f=_0x2edd1f||0xcc;return function(_0x439990){if(_0x439990){return _0x349b59['sendStatus'](_0x2edd1f);}return _0x349b59[_0x4c6d('0x1c')](_0x2edd1f)[_0x4c6d('0x1d')]();};}function respondWithResult(_0x3f08bf,_0x1c3823){_0x1c3823=_0x1c3823||0xc8;return function(_0x5c71cd){if(_0x5c71cd){return _0x3f08bf[_0x4c6d('0x1c')](_0x1c3823)['json'](_0x5c71cd);}};}function respondWithFilteredResult(_0x7a9de8,_0x5f3e57){return function(_0xa3bab6){if(_0xa3bab6){var _0x1d22c1=typeof _0x5f3e57[_0x4c6d('0x1e')]===_0x4c6d('0x1f')&&typeof _0x5f3e57[_0x4c6d('0x20')]===_0x4c6d('0x1f');var _0x524fdd=_0xa3bab6[_0x4c6d('0x21')];var _0x1f583e=_0x1d22c1?0x0:_0x5f3e57[_0x4c6d('0x1e')];var _0x53b8e0=_0x1d22c1?_0xa3bab6[_0x4c6d('0x21')]:_0x5f3e57[_0x4c6d('0x1e')]+_0x5f3e57[_0x4c6d('0x20')];var _0x3a8473;if(_0x53b8e0>=_0x524fdd){_0x53b8e0=_0x524fdd;_0x3a8473=0xc8;}else{_0x3a8473=0xce;}_0x7a9de8['status'](_0x3a8473);return _0x7a9de8[_0x4c6d('0x22')](_0x4c6d('0x23'),_0x1f583e+'-'+_0x53b8e0+'/'+_0x524fdd)['json'](_0xa3bab6);}return null;};}function patchUpdates(_0xd21491){return function(_0x4a8a16){try{jsonpatch[_0x4c6d('0x24')](_0x4a8a16,_0xd21491,!![]);}catch(_0x6c6f54){return BPromise[_0x4c6d('0x25')](_0x6c6f54);}return _0x4a8a16[_0x4c6d('0x26')]();};}function saveUpdates(_0x4be924,_0x325c76){return function(_0x23f01e){if(_0x23f01e){return _0x23f01e['update'](_0x4be924)['then'](function(_0x20d25a){return _0x20d25a;});}return null;};}function removeEntity(_0x33f0ba,_0x2c63f3){return function(_0x3f4d5a){if(_0x3f4d5a){return _0x3f4d5a[_0x4c6d('0x27')]()[_0x4c6d('0x28')](function(){_0x33f0ba[_0x4c6d('0x1c')](0xcc)[_0x4c6d('0x1d')]();});}};}function handleEntityNotFound(_0x224993,_0x1fedb8){return function(_0x576a8c){if(!_0x576a8c){_0x224993[_0x4c6d('0x29')](0x194);}return _0x576a8c;};}function handleError(_0x1b3308,_0x520a1d){_0x520a1d=_0x520a1d||0x1f4;return function(_0x572e7a){logger[_0x4c6d('0x2a')](_0x572e7a['stack']);if(_0x572e7a['name']){delete _0x572e7a[_0x4c6d('0x2b')];}_0x1b3308['status'](_0x520a1d)['send'](_0x572e7a);};}exports['index']=function(_0x2adb5d,_0x5609b9){var _0x4ccd70={},_0x5e480a={},_0x255e57={'count':0x0,'rows':[]};var _0x43cd6a=_['map'](db['Attachment'][_0x4c6d('0x2c')],function(_0x2e6c5c){return{'name':_0x2e6c5c['fieldName'],'type':_0x2e6c5c[_0x4c6d('0x2d')]['key']};});_0x5e480a[_0x4c6d('0x2e')]=_[_0x4c6d('0x2f')](_0x43cd6a,'name');_0x5e480a[_0x4c6d('0x30')]=_[_0x4c6d('0x31')](_0x2adb5d['query']);_0x5e480a[_0x4c6d('0x32')]=_[_0x4c6d('0x33')](_0x5e480a[_0x4c6d('0x2e')],_0x5e480a[_0x4c6d('0x30')]);_0x4ccd70[_0x4c6d('0x34')]=_['intersection'](_0x5e480a['model'],qs['fields'](_0x2adb5d['query']['fields']));_0x4ccd70[_0x4c6d('0x34')]=_0x4ccd70['attributes'][_0x4c6d('0x35')]?_0x4ccd70[_0x4c6d('0x34')]:_0x5e480a[_0x4c6d('0x2e')];if(!_0x2adb5d[_0x4c6d('0x30')][_0x4c6d('0x36')](_0x4c6d('0x37'))){_0x4ccd70[_0x4c6d('0x20')]=qs[_0x4c6d('0x20')](_0x2adb5d[_0x4c6d('0x30')][_0x4c6d('0x20')]);_0x4ccd70[_0x4c6d('0x1e')]=qs['offset'](_0x2adb5d[_0x4c6d('0x30')][_0x4c6d('0x1e')]);}_0x4ccd70[_0x4c6d('0x38')]=qs[_0x4c6d('0x39')](_0x2adb5d[_0x4c6d('0x30')][_0x4c6d('0x39')]);_0x4ccd70[_0x4c6d('0x3a')]=qs[_0x4c6d('0x32')](_[_0x4c6d('0x3b')](_0x2adb5d[_0x4c6d('0x30')],_0x5e480a[_0x4c6d('0x32')]),_0x43cd6a);if(_0x2adb5d[_0x4c6d('0x30')]['filter']){_0x4ccd70[_0x4c6d('0x3a')]=_[_0x4c6d('0x3c')](_0x4ccd70[_0x4c6d('0x3a')],{'$or':_[_0x4c6d('0x2f')](_0x43cd6a,function(_0x18cf5b){if(_0x18cf5b[_0x4c6d('0x2d')]!=='VIRTUAL'){var _0x490e5e={};_0x490e5e[_0x18cf5b['name']]={'$like':'%'+_0x2adb5d['query'][_0x4c6d('0x3d')]+'%'};return _0x490e5e;}})});}_0x4ccd70=_['merge']({},_0x4ccd70,_0x2adb5d['options']);var _0x3b109c={'where':_0x4ccd70['where']};return db[_0x4c6d('0x3e')][_0x4c6d('0x21')](_0x3b109c)['then'](function(_0xcc18c8){_0x255e57[_0x4c6d('0x21')]=_0xcc18c8;if(_0x2adb5d[_0x4c6d('0x30')][_0x4c6d('0x3f')]){_0x4ccd70[_0x4c6d('0x40')]=[{'all':!![]}];}return db[_0x4c6d('0x3e')][_0x4c6d('0x41')](_0x4ccd70);})[_0x4c6d('0x28')](function(_0x51a881){_0x255e57[_0x4c6d('0x42')]=_0x51a881;return _0x255e57;})[_0x4c6d('0x28')](respondWithFilteredResult(_0x5609b9,_0x4ccd70))[_0x4c6d('0x43')](handleError(_0x5609b9,null));};exports[_0x4c6d('0x44')]=function(_0x49d85e,_0x4088fe){var _0x29be3b={'raw':!![],'where':{'id':_0x49d85e[_0x4c6d('0x45')]['id']}},_0x377598={};_0x377598['model']=_[_0x4c6d('0x31')](db[_0x4c6d('0x3e')][_0x4c6d('0x2c')]);_0x377598[_0x4c6d('0x30')]=_['keys'](_0x49d85e[_0x4c6d('0x30')]);_0x377598[_0x4c6d('0x32')]=_[_0x4c6d('0x33')](_0x377598['model'],_0x377598[_0x4c6d('0x30')]);_0x29be3b[_0x4c6d('0x34')]=_[_0x4c6d('0x33')](_0x377598['model'],qs[_0x4c6d('0x46')](_0x49d85e['query'][_0x4c6d('0x46')]));_0x29be3b[_0x4c6d('0x34')]=_0x29be3b['attributes'][_0x4c6d('0x35')]?_0x29be3b[_0x4c6d('0x34')]:_0x377598[_0x4c6d('0x2e')];if(_0x49d85e[_0x4c6d('0x30')][_0x4c6d('0x3f')]){_0x29be3b[_0x4c6d('0x40')]=[{'all':!![]}];}_0x29be3b=_['merge']({},_0x29be3b,_0x49d85e['options']);return db[_0x4c6d('0x3e')][_0x4c6d('0x47')](_0x29be3b)[_0x4c6d('0x28')](handleEntityNotFound(_0x4088fe,null))[_0x4c6d('0x28')](respondWithResult(_0x4088fe,null))['catch'](handleError(_0x4088fe,null));};exports[_0x4c6d('0x48')]=function(_0xa343ae,_0x2822e3){var _0x52dac9={'where':{'id':_0xa343ae[_0x4c6d('0x45')]['id']}},_0x9fc11f={};_0x9fc11f[_0x4c6d('0x2e')]=_[_0x4c6d('0x31')](db[_0x4c6d('0x3e')]['rawAttributes']);_0x52dac9[_0x4c6d('0x34')]=_[_0x4c6d('0x33')](_0x9fc11f[_0x4c6d('0x2e')],qs[_0x4c6d('0x46')](_0xa343ae['query'][_0x4c6d('0x46')]));_0x52dac9[_0x4c6d('0x34')]=_0x52dac9[_0x4c6d('0x34')][_0x4c6d('0x35')]?_0x52dac9[_0x4c6d('0x34')]:_0x9fc11f[_0x4c6d('0x2e')];if(_0xa343ae['query'][_0x4c6d('0x3f')]){_0x52dac9[_0x4c6d('0x40')]=[{'all':!![]}];}_0x52dac9=_['merge']({},_0x52dac9,_0xa343ae[_0x4c6d('0x49')]);return db[_0x4c6d('0x3e')][_0x4c6d('0x47')](_0x52dac9)[_0x4c6d('0x28')](handleEntityNotFound(_0x2822e3,null))[_0x4c6d('0x28')](function(_0x556120){if(_0x556120){var _0x25789e=_0x556120[_0x4c6d('0x4a')]({'plain':!![]});_0x25789e=qs[_0x4c6d('0x4b')](_0x25789e,['id',_0x4c6d('0x4c'),_0x4c6d('0x4d')]);_0xa343ae['body']=_[_0x4c6d('0x4b')](_0xa343ae[_0x4c6d('0x4e')],['id',_0x4c6d('0x4c'),_0x4c6d('0x4d')]);return db[_0x4c6d('0x3e')][_0x4c6d('0x4f')](_[_0x4c6d('0x3c')](_0x25789e,_0xa343ae[_0x4c6d('0x4e')]),{'include':_0xa343ae['query']['includeAll']?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x2822e3,0xc9))[_0x4c6d('0x43')](handleError(_0x2822e3,null));};exports[_0x4c6d('0x50')]=function(_0x3e6f75,_0xbea47a){if(_0x3e6f75['body']['id']){delete _0x3e6f75[_0x4c6d('0x4e')]['id'];}return db['Attachment'][_0x4c6d('0x47')]({'where':{'id':_0x3e6f75['params']['id']}})[_0x4c6d('0x28')](handleEntityNotFound(_0xbea47a,null))[_0x4c6d('0x28')](saveUpdates(_0x3e6f75[_0x4c6d('0x4e')],null))[_0x4c6d('0x28')](respondWithResult(_0xbea47a,null))[_0x4c6d('0x43')](handleError(_0xbea47a,null));};exports[_0x4c6d('0x27')]=function(_0x22f5a5,_0x5c5803){return db[_0x4c6d('0x3e')][_0x4c6d('0x47')]({'where':{'id':_0x22f5a5[_0x4c6d('0x45')]['id']}})[_0x4c6d('0x28')](handleEntityNotFound(_0x5c5803,null))[_0x4c6d('0x28')](removeEntity(_0x5c5803,null))[_0x4c6d('0x43')](handleError(_0x5c5803,null));};exports[_0x4c6d('0x4f')]=function(_0x4b7596,_0x8cdcf8,_0x518d72){_0x4b7596[_0x4c6d('0x4e')][_0x4c6d('0x2b')]=_0x4b7596[_0x4c6d('0x51')][_0x4c6d('0x52')];_0x4b7596[_0x4c6d('0x4e')][_0x4c6d('0x53')]=_0x4b7596[_0x4c6d('0x51')][_0x4c6d('0x54')];_0x4b7596[_0x4c6d('0x4e')]['type']=_0x4b7596[_0x4c6d('0x51')][_0x4c6d('0x55')];return db[_0x4c6d('0x3e')][_0x4c6d('0x4f')](_0x4b7596[_0x4c6d('0x4e')])[_0x4c6d('0x28')](respondWithResult(_0x8cdcf8,0xc9))[_0x4c6d('0x43')](handleError(_0x8cdcf8,null));};exports['download']=function(_0x39eb2a,_0x2ef94a,_0x568e54){return db[_0x4c6d('0x3e')]['findOne']({'where':{'id':_0x39eb2a[_0x4c6d('0x45')]['id']},'raw':!![]})[_0x4c6d('0x28')](handleEntityNotFound(_0x2ef94a,null))['then'](function(_0x1deacc){if(_0x1deacc){var _0x4b1999=_0x1deacc[_0x4c6d('0x56')]!==null;var _0x183879=path[_0x4c6d('0x57')](config[_0x4c6d('0x58')],'server/files/attachments/');if(_0x4b1999){_0x183879=path['join'](_0x183879,'offline-chat/');}var _0x223486=path[_0x4c6d('0x57')](_0x183879,_0x1deacc[_0x4c6d('0x53')]);return _0x2ef94a[_0x4c6d('0x59')](_0x223486);}})[_0x4c6d('0x43')](handleError(_0x2ef94a,null));}; \ No newline at end of file +var _0x7e6b=['reject','save','update','destroy','then','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','options','Attachment','includeAll','include','findAll','rows','catch','show','params','find','clone','fields','get','omit','createdAt','body','updatedAt','create','file','originalname','basename','mimetype','download','findOne','ChatOfflineMessageId','join','root','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0x7e6b,0xf1));var _0xb7e6=function(_0x3bb688,_0x366c76){_0x3bb688=_0x3bb688-0x0;var _0x3cf101=_0x7e6b[_0x3bb688];return _0x3cf101;};'use strict';var emlformat=require(_0xb7e6('0x0'));var rimraf=require(_0xb7e6('0x1'));var zipdir=require(_0xb7e6('0x2'));var jsonpatch=require(_0xb7e6('0x3'));var rp=require(_0xb7e6('0x4'));var moment=require(_0xb7e6('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb7e6('0x6'));var util=require(_0xb7e6('0x7'));var path=require(_0xb7e6('0x8'));var sox=require(_0xb7e6('0x9'));var csv=require(_0xb7e6('0xa'));var ejs=require(_0xb7e6('0xb'));var fs=require('fs');var fs_extra=require(_0xb7e6('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xb7e6('0xd'));var jsforce=require(_0xb7e6('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb7e6('0xf'));var Papa=require('papaparse');var Redis=require(_0xb7e6('0x10'));var authService=require(_0xb7e6('0x11'));var qs=require(_0xb7e6('0x12'));var as=require(_0xb7e6('0x13'));var hardwareService=require(_0xb7e6('0x14'));var logger=require(_0xb7e6('0x15'))(_0xb7e6('0x16'));var utils=require(_0xb7e6('0x17'));var config=require(_0xb7e6('0x18'));var licenseUtil=require(_0xb7e6('0x19'));var db=require(_0xb7e6('0x1a'))['db'];function respondWithStatusCode(_0x295367,_0x1c96e6){_0x1c96e6=_0x1c96e6||0xcc;return function(_0x13d386){if(_0x13d386){return _0x295367[_0xb7e6('0x1b')](_0x1c96e6);}return _0x295367[_0xb7e6('0x1c')](_0x1c96e6)[_0xb7e6('0x1d')]();};}function respondWithResult(_0x266dbc,_0x4e57ef){_0x4e57ef=_0x4e57ef||0xc8;return function(_0x14be64){if(_0x14be64){return _0x266dbc[_0xb7e6('0x1c')](_0x4e57ef)['json'](_0x14be64);}};}function respondWithFilteredResult(_0x267340,_0x274f7f){return function(_0x25dd5e){if(_0x25dd5e){var _0x3dd038=typeof _0x274f7f[_0xb7e6('0x1e')]==='undefined'&&typeof _0x274f7f['limit']===_0xb7e6('0x1f');var _0x3166cb=_0x25dd5e[_0xb7e6('0x20')];var _0x5433bd=_0x3dd038?0x0:_0x274f7f[_0xb7e6('0x1e')];var _0x5e5cda=_0x3dd038?_0x25dd5e[_0xb7e6('0x20')]:_0x274f7f[_0xb7e6('0x1e')]+_0x274f7f[_0xb7e6('0x21')];var _0x38b478;if(_0x5e5cda>=_0x3166cb){_0x5e5cda=_0x3166cb;_0x38b478=0xc8;}else{_0x38b478=0xce;}_0x267340[_0xb7e6('0x1c')](_0x38b478);return _0x267340[_0xb7e6('0x22')](_0xb7e6('0x23'),_0x5433bd+'-'+_0x5e5cda+'/'+_0x3166cb)[_0xb7e6('0x24')](_0x25dd5e);}return null;};}function patchUpdates(_0x2d3f3a){return function(_0x40d0a0){try{jsonpatch[_0xb7e6('0x25')](_0x40d0a0,_0x2d3f3a,!![]);}catch(_0x35486c){return BPromise[_0xb7e6('0x26')](_0x35486c);}return _0x40d0a0[_0xb7e6('0x27')]();};}function saveUpdates(_0x1d6328,_0x76c130){return function(_0xe5ea87){if(_0xe5ea87){return _0xe5ea87[_0xb7e6('0x28')](_0x1d6328)['then'](function(_0x1dadd2){return _0x1dadd2;});}return null;};}function removeEntity(_0x41a3e8,_0x278c71){return function(_0x27e647){if(_0x27e647){return _0x27e647[_0xb7e6('0x29')]()[_0xb7e6('0x2a')](function(){_0x41a3e8[_0xb7e6('0x1c')](0xcc)[_0xb7e6('0x1d')]();});}};}function handleEntityNotFound(_0x1e2b2b,_0x189092){return function(_0x59948f){if(!_0x59948f){_0x1e2b2b[_0xb7e6('0x1b')](0x194);}return _0x59948f;};}function handleError(_0x22e0f5,_0x516a39){_0x516a39=_0x516a39||0x1f4;return function(_0x3b9774){logger['error'](_0x3b9774[_0xb7e6('0x2b')]);if(_0x3b9774[_0xb7e6('0x2c')]){delete _0x3b9774[_0xb7e6('0x2c')];}_0x22e0f5[_0xb7e6('0x1c')](_0x516a39)[_0xb7e6('0x2d')](_0x3b9774);};}exports[_0xb7e6('0x2e')]=function(_0xdb6943,_0x5b42b9){var _0x38d2f3={},_0x5d15fc={},_0x4e7a4b={'count':0x0,'rows':[]};var _0x43847f=_[_0xb7e6('0x2f')](db['Attachment'][_0xb7e6('0x30')],function(_0x16ff3d){return{'name':_0x16ff3d[_0xb7e6('0x31')],'type':_0x16ff3d[_0xb7e6('0x32')][_0xb7e6('0x33')]};});_0x5d15fc[_0xb7e6('0x34')]=_['map'](_0x43847f,_0xb7e6('0x2c'));_0x5d15fc['query']=_[_0xb7e6('0x35')](_0xdb6943[_0xb7e6('0x36')]);_0x5d15fc[_0xb7e6('0x37')]=_['intersection'](_0x5d15fc[_0xb7e6('0x34')],_0x5d15fc[_0xb7e6('0x36')]);_0x38d2f3[_0xb7e6('0x38')]=_[_0xb7e6('0x39')](_0x5d15fc[_0xb7e6('0x34')],qs['fields'](_0xdb6943[_0xb7e6('0x36')]['fields']));_0x38d2f3['attributes']=_0x38d2f3[_0xb7e6('0x38')][_0xb7e6('0x3a')]?_0x38d2f3[_0xb7e6('0x38')]:_0x5d15fc[_0xb7e6('0x34')];if(!_0xdb6943[_0xb7e6('0x36')][_0xb7e6('0x3b')](_0xb7e6('0x3c'))){_0x38d2f3[_0xb7e6('0x21')]=qs[_0xb7e6('0x21')](_0xdb6943['query'][_0xb7e6('0x21')]);_0x38d2f3[_0xb7e6('0x1e')]=qs['offset'](_0xdb6943[_0xb7e6('0x36')]['offset']);}_0x38d2f3['order']=qs['sort'](_0xdb6943['query'][_0xb7e6('0x3d')]);_0x38d2f3[_0xb7e6('0x3e')]=qs['filters'](_['pick'](_0xdb6943[_0xb7e6('0x36')],_0x5d15fc['filters']),_0x43847f);if(_0xdb6943['query']['filter']){_0x38d2f3[_0xb7e6('0x3e')]=_[_0xb7e6('0x3f')](_0x38d2f3[_0xb7e6('0x3e')],{'$or':_[_0xb7e6('0x2f')](_0x43847f,function(_0x5a6b72){if(_0x5a6b72[_0xb7e6('0x32')]!==_0xb7e6('0x40')){var _0x1b8905={};_0x1b8905[_0x5a6b72[_0xb7e6('0x2c')]]={'$like':'%'+_0xdb6943[_0xb7e6('0x36')][_0xb7e6('0x41')]+'%'};return _0x1b8905;}})});}_0x38d2f3=_[_0xb7e6('0x3f')]({},_0x38d2f3,_0xdb6943[_0xb7e6('0x42')]);var _0x22ac6e={'where':_0x38d2f3['where']};return db[_0xb7e6('0x43')][_0xb7e6('0x20')](_0x22ac6e)['then'](function(_0xfca5cc){_0x4e7a4b[_0xb7e6('0x20')]=_0xfca5cc;if(_0xdb6943[_0xb7e6('0x36')][_0xb7e6('0x44')]){_0x38d2f3[_0xb7e6('0x45')]=[{'all':!![]}];}return db[_0xb7e6('0x43')][_0xb7e6('0x46')](_0x38d2f3);})['then'](function(_0x132e65){_0x4e7a4b[_0xb7e6('0x47')]=_0x132e65;return _0x4e7a4b;})['then'](respondWithFilteredResult(_0x5b42b9,_0x38d2f3))[_0xb7e6('0x48')](handleError(_0x5b42b9,null));};exports[_0xb7e6('0x49')]=function(_0x15c51b,_0x31f694){var _0x3c2d43={'raw':!![],'where':{'id':_0x15c51b[_0xb7e6('0x4a')]['id']}},_0x1465f1={};_0x1465f1[_0xb7e6('0x34')]=_['keys'](db[_0xb7e6('0x43')][_0xb7e6('0x30')]);_0x1465f1['query']=_[_0xb7e6('0x35')](_0x15c51b[_0xb7e6('0x36')]);_0x1465f1[_0xb7e6('0x37')]=_[_0xb7e6('0x39')](_0x1465f1[_0xb7e6('0x34')],_0x1465f1[_0xb7e6('0x36')]);_0x3c2d43[_0xb7e6('0x38')]=_['intersection'](_0x1465f1[_0xb7e6('0x34')],qs['fields'](_0x15c51b['query']['fields']));_0x3c2d43[_0xb7e6('0x38')]=_0x3c2d43[_0xb7e6('0x38')][_0xb7e6('0x3a')]?_0x3c2d43['attributes']:_0x1465f1['model'];if(_0x15c51b[_0xb7e6('0x36')][_0xb7e6('0x44')]){_0x3c2d43[_0xb7e6('0x45')]=[{'all':!![]}];}_0x3c2d43=_[_0xb7e6('0x3f')]({},_0x3c2d43,_0x15c51b[_0xb7e6('0x42')]);return db[_0xb7e6('0x43')][_0xb7e6('0x4b')](_0x3c2d43)['then'](handleEntityNotFound(_0x31f694,null))[_0xb7e6('0x2a')](respondWithResult(_0x31f694,null))[_0xb7e6('0x48')](handleError(_0x31f694,null));};exports[_0xb7e6('0x4c')]=function(_0x30a41e,_0x463ca1){var _0x1b9b20={'where':{'id':_0x30a41e['params']['id']}},_0x28b3f2={};_0x28b3f2[_0xb7e6('0x34')]=_[_0xb7e6('0x35')](db[_0xb7e6('0x43')][_0xb7e6('0x30')]);_0x1b9b20['attributes']=_[_0xb7e6('0x39')](_0x28b3f2[_0xb7e6('0x34')],qs[_0xb7e6('0x4d')](_0x30a41e[_0xb7e6('0x36')]['fields']));_0x1b9b20[_0xb7e6('0x38')]=_0x1b9b20[_0xb7e6('0x38')]['length']?_0x1b9b20[_0xb7e6('0x38')]:_0x28b3f2[_0xb7e6('0x34')];if(_0x30a41e[_0xb7e6('0x36')]['includeAll']){_0x1b9b20[_0xb7e6('0x45')]=[{'all':!![]}];}_0x1b9b20=_['merge']({},_0x1b9b20,_0x30a41e[_0xb7e6('0x42')]);return db[_0xb7e6('0x43')][_0xb7e6('0x4b')](_0x1b9b20)['then'](handleEntityNotFound(_0x463ca1,null))['then'](function(_0x18e9d3){if(_0x18e9d3){var _0x57f818=_0x18e9d3[_0xb7e6('0x4e')]({'plain':!![]});_0x57f818=qs[_0xb7e6('0x4f')](_0x57f818,['id',_0xb7e6('0x50'),'updatedAt']);_0x30a41e[_0xb7e6('0x51')]=_[_0xb7e6('0x4f')](_0x30a41e[_0xb7e6('0x51')],['id',_0xb7e6('0x50'),_0xb7e6('0x52')]);return db[_0xb7e6('0x43')][_0xb7e6('0x53')](_[_0xb7e6('0x3f')](_0x57f818,_0x30a41e[_0xb7e6('0x51')]),{'include':_0x30a41e['query'][_0xb7e6('0x44')]?[{'all':!![]}]:undefined});}})[_0xb7e6('0x2a')](respondWithResult(_0x463ca1,0xc9))[_0xb7e6('0x48')](handleError(_0x463ca1,null));};exports[_0xb7e6('0x28')]=function(_0x3b2482,_0x1d4113){if(_0x3b2482[_0xb7e6('0x51')]['id']){delete _0x3b2482[_0xb7e6('0x51')]['id'];}return db[_0xb7e6('0x43')][_0xb7e6('0x4b')]({'where':{'id':_0x3b2482[_0xb7e6('0x4a')]['id']}})[_0xb7e6('0x2a')](handleEntityNotFound(_0x1d4113,null))[_0xb7e6('0x2a')](saveUpdates(_0x3b2482['body'],null))[_0xb7e6('0x2a')](respondWithResult(_0x1d4113,null))[_0xb7e6('0x48')](handleError(_0x1d4113,null));};exports['destroy']=function(_0xfd220c,_0x51d020){return db[_0xb7e6('0x43')][_0xb7e6('0x4b')]({'where':{'id':_0xfd220c[_0xb7e6('0x4a')]['id']}})[_0xb7e6('0x2a')](handleEntityNotFound(_0x51d020,null))[_0xb7e6('0x2a')](removeEntity(_0x51d020,null))[_0xb7e6('0x48')](handleError(_0x51d020,null));};exports[_0xb7e6('0x53')]=function(_0x356afd,_0x5c5ccb,_0x26245e){_0x356afd['body'][_0xb7e6('0x2c')]=_0x356afd[_0xb7e6('0x54')][_0xb7e6('0x55')];_0x356afd[_0xb7e6('0x51')][_0xb7e6('0x56')]=_0x356afd[_0xb7e6('0x54')]['filename'];_0x356afd[_0xb7e6('0x51')][_0xb7e6('0x32')]=_0x356afd[_0xb7e6('0x54')][_0xb7e6('0x57')];return db[_0xb7e6('0x43')][_0xb7e6('0x53')](_0x356afd[_0xb7e6('0x51')])[_0xb7e6('0x2a')](respondWithResult(_0x5c5ccb,0xc9))[_0xb7e6('0x48')](handleError(_0x5c5ccb,null));};exports[_0xb7e6('0x58')]=function(_0x2cf568,_0x4d2ecb,_0x5cce7f){return db[_0xb7e6('0x43')][_0xb7e6('0x59')]({'where':{'id':_0x2cf568[_0xb7e6('0x4a')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x4d2ecb,null))[_0xb7e6('0x2a')](function(_0x1cd4f0){if(_0x1cd4f0){var _0xf43222=_0x1cd4f0[_0xb7e6('0x5a')]!==null;var _0x512a36=path[_0xb7e6('0x5b')](config[_0xb7e6('0x5c')],'server/files/attachments/');if(_0xf43222){_0x512a36=path['join'](_0x512a36,'offline-chat/');}var _0x3e1760=path[_0xb7e6('0x5b')](_0x512a36,_0x1cd4f0[_0xb7e6('0x56')]);return _0x4d2ecb[_0xb7e6('0x58')](_0x3e1760);}})[_0xb7e6('0x48')](handleError(_0x4d2ecb,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 4a26901..3938851 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 _0x9068=['../../config/environment','./attachment.attributes','Attachment','attachments','util','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x1b32d6,_0x34743a){var _0x2b1289=function(_0x1b047a){while(--_0x1b047a){_0x1b32d6['push'](_0x1b32d6['shift']());}};_0x2b1289(++_0x34743a);}(_0x9068,0xea));var _0x8906=function(_0x5534b7,_0xbe6ba4){_0x5534b7=_0x5534b7-0x0;var _0x34af05=_0x9068[_0x5534b7];return _0x34af05;};'use strict';var _=require('lodash');var util=require(_0x8906('0x0'));var logger=require(_0x8906('0x1'))(_0x8906('0x2'));var moment=require(_0x8906('0x3'));var BPromise=require('bluebird');var rp=require(_0x8906('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8906('0x5'));var config=require(_0x8906('0x6'));var attributes=require(_0x8906('0x7'));module['exports']=function(_0x903328,_0x34bcff){return _0x903328['define'](_0x8906('0x8'),attributes,{'tableName':_0x8906('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x29c5=['define','attachments','lodash','util','bluebird','rimraf','../../config/environment','./attachment.attributes'];(function(_0x396910,_0x397bda){var _0x217d81=function(_0x1e6ab9){while(--_0x1e6ab9){_0x396910['push'](_0x396910['shift']());}};_0x217d81(++_0x397bda);}(_0x29c5,0xe2));var _0x529c=function(_0x1f0713,_0x11450d){_0x1f0713=_0x1f0713-0x0;var _0x26477d=_0x29c5[_0x1f0713];return _0x26477d;};'use strict';var _=require(_0x529c('0x0'));var util=require(_0x529c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x529c('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x529c('0x3'));var config=require(_0x529c('0x4'));var attributes=require(_0x529c('0x5'));module['exports']=function(_0xeff314,_0x199a38){return _0xeff314[_0x529c('0x6')]('Attachment',attributes,{'tableName':_0x529c('0x7'),'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 6d3420d..026a6d4 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 _0x97a2=['Attachment,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','CreateAttachment','Attachment','body','options','raw','debug','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0xa1c275,_0x155b61){var _0x46c55e=function(_0x5dbdb7){while(--_0x5dbdb7){_0xa1c275['push'](_0xa1c275['shift']());}};_0x46c55e(++_0x155b61);}(_0x97a2,0x1b1));var _0x297a=function(_0x193384,_0x7f0f42){_0x193384=_0x193384-0x0;var _0x4b5803=_0x97a2[_0x193384];return _0x4b5803;};'use strict';var _=require(_0x297a('0x0'));var util=require('util');var moment=require(_0x297a('0x1'));var BPromise=require(_0x297a('0x2'));var rs=require(_0x297a('0x3'));var fs=require('fs');var Redis=require(_0x297a('0x4'));var db=require(_0x297a('0x5'))['db'];var utils=require(_0x297a('0x6'));var logger=require(_0x297a('0x7'))(_0x297a('0x8'));var config=require('../../config/environment');var jayson=require(_0x297a('0x9'));var client=jayson[_0x297a('0xa')][_0x297a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x8cbc92,_0x43a7d7,_0x3d9c6a){return new BPromise(function(_0x5ab57b,_0x38b066){return client[_0x297a('0xc')](_0x8cbc92,_0x3d9c6a)[_0x297a('0xd')](function(_0xbf6378){logger[_0x297a('0xe')](_0x297a('0xf'),_0x43a7d7,'request\x20sent');logger['debug']('Attachment,\x20%s,\x20%s,\x20%s',_0x43a7d7,_0x297a('0x10'),JSON[_0x297a('0x11')](_0xbf6378));if(_0xbf6378[_0x297a('0x12')]){if(_0xbf6378[_0x297a('0x12')]['code']===0x1f4){logger[_0x297a('0x12')](_0x297a('0xf'),_0x43a7d7,_0xbf6378[_0x297a('0x12')][_0x297a('0x13')]);return _0x38b066(_0xbf6378[_0x297a('0x12')][_0x297a('0x13')]);}logger[_0x297a('0x12')]('Attachment,\x20%s,\x20%s',_0x43a7d7,_0xbf6378['error'][_0x297a('0x13')]);return _0x5ab57b(_0xbf6378['error'][_0x297a('0x13')]);}else{logger[_0x297a('0xe')]('Attachment,\x20%s,\x20%s',_0x43a7d7,_0x297a('0x10'));_0x5ab57b(_0xbf6378[_0x297a('0x14')]['message']);}})[_0x297a('0x15')](function(_0x333868){logger[_0x297a('0x12')]('Attachment,\x20%s,\x20%s',_0x43a7d7,_0x333868);_0x38b066(_0x333868);});});}exports[_0x297a('0x16')]=function(_0x3af847){var _0x29c6d6=this;return new Promise(function(_0x4d6194,_0xba3b73){return db[_0x297a('0x17')]['create'](_0x3af847[_0x297a('0x18')],{'raw':_0x3af847[_0x297a('0x19')]?_0x3af847[_0x297a('0x19')][_0x297a('0x1a')]===undefined?!![]:![]:!![]})[_0x297a('0xd')](function(_0xde6d1c){logger[_0x297a('0xe')](_0x297a('0x16'),_0x3af847);logger[_0x297a('0x1b')](_0x297a('0x16'),_0x3af847,JSON[_0x297a('0x11')](_0xde6d1c));_0x4d6194(_0xde6d1c);})[_0x297a('0x15')](function(_0x481f59){logger['error']('CreateAttachment',_0x481f59[_0x297a('0x13')],_0x3af847);_0xba3b73(_0x29c6d6[_0x297a('0x12')](0x1f4,_0x481f59['message']));});});}; \ No newline at end of file +var _0xbdb7=['Attachment','body','options','raw','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateAttachment'];(function(_0xee4c5f,_0x1bf72d){var _0x5accbc=function(_0x5ca2aa){while(--_0x5ca2aa){_0xee4c5f['push'](_0xee4c5f['shift']());}};_0x5accbc(++_0x1bf72d);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x3b6652,_0x32486d){_0x3b6652=_0x3b6652-0x0;var _0x14d39f=_0xbdb7[_0x3b6652];return _0x14d39f;};'use strict';var _=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var moment=require(_0x7bdb('0x2'));var BPromise=require(_0x7bdb('0x3'));var rs=require(_0x7bdb('0x4'));var fs=require('fs');var Redis=require(_0x7bdb('0x5'));var db=require(_0x7bdb('0x6'))['db'];var utils=require(_0x7bdb('0x7'));var logger=require(_0x7bdb('0x8'))('rpc');var config=require(_0x7bdb('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7bdb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e23a3,_0x493bde,_0x513cba){return new BPromise(function(_0x468041,_0x11a877){return client['request'](_0x1e23a3,_0x513cba)['then'](function(_0xdc2ffc){logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));logger[_0x7bdb('0xe')](_0x7bdb('0xf'),_0x493bde,_0x7bdb('0xd'),JSON[_0x7bdb('0x10')](_0xdc2ffc));if(_0xdc2ffc['error']){if(_0xdc2ffc['error']['code']===0x1f4){logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error'][_0x7bdb('0x12')]);return _0x11a877(_0xdc2ffc['error']['message']);}logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error']['message']);return _0x468041(_0xdc2ffc['error'][_0x7bdb('0x12')]);}else{logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));_0x468041(_0xdc2ffc[_0x7bdb('0x13')][_0x7bdb('0x12')]);}})[_0x7bdb('0x14')](function(_0x1b2d9b){logger['error'](_0x7bdb('0xc'),_0x493bde,_0x1b2d9b);_0x11a877(_0x1b2d9b);});});}exports[_0x7bdb('0x15')]=function(_0x5723f4){var _0x2aff6a=this;return new Promise(function(_0x4ffd4b,_0x41f540){return db[_0x7bdb('0x16')]['create'](_0x5723f4[_0x7bdb('0x17')],{'raw':_0x5723f4[_0x7bdb('0x18')]?_0x5723f4[_0x7bdb('0x18')][_0x7bdb('0x19')]===undefined?!![]:![]:!![]})[_0x7bdb('0x1a')](function(_0x5bfc35){logger['info'](_0x7bdb('0x15'),_0x5723f4);logger[_0x7bdb('0xe')]('CreateAttachment',_0x5723f4,JSON[_0x7bdb('0x10')](_0x5bfc35));_0x4ffd4b(_0x5bfc35);})[_0x7bdb('0x14')](function(_0x346c72){logger[_0x7bdb('0x11')](_0x7bdb('0x15'),_0x346c72['message'],_0x5723f4);_0x41f540(_0x2aff6a[_0x7bdb('0x11')](0x1f4,_0x346c72[_0x7bdb('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index d5deb6f..ef5dac5 100644 --- a/server/api/attachment/index.js +++ b/server/api/attachment/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['originalname','replace','single','file','create','put','/:id','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','index','isAuthenticated','show','/:id/download','download','post','/:id/clone','diskStorage','join','server/files/attachments/','format','%s-%s'];(function(_0x2f96e4,_0x405efb){var _0x4d5747=function(_0x2636e4){while(--_0x2636e4){_0x2f96e4['push'](_0x2f96e4['shift']());}};_0x4d5747(++_0x405efb);}(_0xb10b,0x12a));var _0xbb10=function(_0x2c699e,_0x5e9d6c){_0x2c699e=_0x2c699e-0x0;var _0x5844e3=_0xb10b[_0x2c699e];return _0x5844e3;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')](_0xbb10('0x10'),auth['isAuthenticated'](),controller['clone']);var upload=multer({'storage':multer[_0xbb10('0x11')]({'destination':function(_0x118a74,_0xce64f3,_0x5e136d){_0x5e136d(null,path[_0xbb10('0x12')](config['root'],_0xbb10('0x13')));},'filename':function(_0x916a32,_0x285009,_0x193a27){_0x193a27(null,util[_0xbb10('0x14')](_0xbb10('0x15'),Date['now'](),_0x285009[_0xbb10('0x16')][_0xbb10('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xbb10('0xf')]('/',upload[_0xbb10('0x18')](_0xbb10('0x19')),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1d')]);router['delete'](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);module[_0xbb10('0x1f')]=router; \ No newline at end of file +var _0x5f2f=['show','/:id/download','download','post','/:id/clone','clone','root','server/files/attachments/','format','now','originalname','replace','single','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./attachment.controller','get','isAuthenticated','index','/:id'];(function(_0x293f72,_0xa2657b){var _0x1f7078=function(_0x46e063){while(--_0x46e063){_0x293f72['push'](_0x293f72['shift']());}};_0x1f7078(++_0xa2657b);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1f38c6,_0x428650){_0x1f38c6=_0x1f38c6-0x0;var _0x259367=_0x5f2f[_0x1f38c6];return _0x259367;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x10')](_0xf5f2('0x11'),auth['isAuthenticated'](),controller[_0xf5f2('0x12')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x53fb33,_0xa7e1a6,_0x151aba){_0x151aba(null,path['join'](config[_0xf5f2('0x13')],_0xf5f2('0x14')));},'filename':function(_0x331482,_0x3f2997,_0x59bb6c){_0x59bb6c(null,util[_0xf5f2('0x15')]('%s-%s',Date[_0xf5f2('0x16')](),_0x3f2997[_0xf5f2('0x17')][_0xf5f2('0x18')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xf5f2('0x10')]('/',upload[_0xf5f2('0x19')]('file'),controller[_0xf5f2('0x1a')]);router[_0xf5f2('0x1b')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1c')]);router[_0xf5f2('0x1d')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1e')]);module[_0xf5f2('0x1f')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index 442e2b0..80a429a 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 _0x2714=['Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','role','disabled','blockedAt','online','user','agent','blocked','add','minutes','clearBlockUser','getLicense','catch','send','login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','use','ad-login','passport','passport-local','Strategy','moment','activedirectory2','bluebird','util','../../mysqldb','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','api','activedirectory','undefined','url','domain','authenticate','error','Error\x20authenticate\x20%s:\x20%s','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','adSsoEnabled','blockDuration','then'];(function(_0x55fb83,_0x1d3856){var _0x59a87a=function(_0x38bdd1){while(--_0x38bdd1){_0x55fb83['push'](_0x55fb83['shift']());}};_0x59a87a(++_0x1d3856);}(_0x2714,0xdd));var _0x4271=function(_0xce84cd,_0x14b85b){_0xce84cd=_0xce84cd-0x0;var _0x4a3f4b=_0x2714[_0xce84cd];return _0x4a3f4b;};'use strict';var passport=require(_0x4271('0x0'));var LocalStrategy=require(_0x4271('0x1'))[_0x4271('0x2')];var moment=require(_0x4271('0x3'));var ActiveDirectory=require(_0x4271('0x4'));var BPromise=require(_0x4271('0x5'));var util=require(_0x4271('0x6'));var db=require(_0x4271('0x7'))['db'];var authService=require(_0x4271('0x8'));var utils=require(_0x4271('0x9'));var config=require(_0x4271('0xa'));var logger=require(_0x4271('0xb'))(_0x4271('0xc'));function isActiveDirectoryConfigured(_0x323727){var _0x32c11b=![];if(typeof _0x323727[_0x4271('0xd')]!==_0x4271('0xe')){_0x32c11b=_0x323727[_0x4271('0xd')]['baseDN']&&_0x323727[_0x4271('0xd')][_0x4271('0xf')]&&_0x323727['activedirectory'][_0x4271('0x10')];}return _0x32c11b;}function adAuthenticate(_0x2b0a68,_0x1b24ab,_0x3247a5){return new BPromise(function(_0x57969f,_0x5ce16d){try{var _0x5409ef=new ActiveDirectory(_0x2b0a68);_0x5409ef[_0x4271('0x11')](_0x1b24ab,_0x3247a5,function(_0x4f846a,_0x3d776e){if(_0x4f846a){logger[_0x4271('0x12')](_0x4271('0x13'),_0x1b24ab,util[_0x4271('0x14')](_0x4f846a,{'showHidden':![],'depth':null}));_0x5ce16d(_0x4271('0x15'));}else if(!_0x3d776e){logger[_0x4271('0x12')](_0x4271('0x16'),_0x1b24ab);_0x5ce16d(_0x4271('0x15'));}else{_0x57969f(_0x3d776e);}});}catch(_0x404cd0){_0x5ce16d(_0x404cd0);}});}function ActiveDirectoryAuthenticate(_0x445fdd,_0x42ed04,_0xa1cfa9,_0x4cc20c){var _0x16816e,_0x54eacd;if(!isActiveDirectoryConfigured(config)){logger[_0x4271('0x12')](_0x4271('0x17'),_0x42ed04);return _0x4cc20c(null,![],{'message':_0x4271('0x15')});}return db[_0x4271('0x18')][_0x4271('0x19')]({'where':{'id':0x1},'attributes':[_0x4271('0x1a'),_0x4271('0x1b')],'raw':!![]})[_0x4271('0x1c')](function(_0xdad6fd){_0x16816e=_0xdad6fd;if(!_0x16816e[_0x4271('0x1a')]){logger[_0x4271('0x12')](_0x4271('0x1d'),_0x42ed04);throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return _0x445fdd[_0x4271('0x19')]({'attributes':['id',_0x4271('0x1e'),_0x4271('0x1f'),'salt',_0x4271('0x20'),_0x4271('0x21'),'blocked',_0x4271('0x22'),_0x4271('0x23')],'where':{'name':_0x42ed04,'role':{'$or':['admin',_0x4271('0x24'),_0x4271('0x25')]},'adSsoEnabled':!![]}});})['then'](function(_0xffd340){if(!_0xffd340||_0xffd340&&_0xffd340[_0x4271('0x1e')]!==_0x42ed04){throw new Error(_0x4271('0x15'));}_0x54eacd=_0xffd340;var _0x74c4f9=_0x54eacd[_0x4271('0x1e')]+'@'+config[_0x4271('0xd')][_0x4271('0x10')];return adAuthenticate(config[_0x4271('0xd')],_0x74c4f9,_0xa1cfa9);})['then'](function(_0x20890b){if(_0x54eacd[_0x4271('0x21')]){throw new Error(_0x4271('0x15'));}if(_0x16816e[_0x4271('0x1b')]>0x0){if(_0x54eacd[_0x4271('0x26')]){if(moment(_0x54eacd[_0x4271('0x22')])[_0x4271('0x27')](_0x16816e[_0x4271('0x1b')],_0x4271('0x28'))>moment()){throw new Error(_0x4271('0x15'));}return utils[_0x4271('0x29')](_0x54eacd,0x0,![],null)[_0x4271('0x1c')](function(){return utils[_0x4271('0x2a')](_0x54eacd);})[_0x4271('0x1c')](function(){return _0x4cc20c(null,_0x54eacd);});}else{return utils[_0x4271('0x2a')](_0x54eacd)[_0x4271('0x1c')](function(){return _0x4cc20c(null,_0x54eacd);});}}else{return utils[_0x4271('0x2a')](_0x54eacd)['then'](function(){return _0x4cc20c(null,_0x54eacd);});}})[_0x4271('0x2b')](function(_0x221594){return _0x4cc20c(null,![],_0x221594);});}function handleError(_0x58e1a6,_0x3d1ebc,_0x4a23b0){return _0x58e1a6['status'](_0x3d1ebc||0x1f4)[_0x4271('0x2c')]({'message':_0x4a23b0?_0x4a23b0['message']||_0x4a23b0:''});}exports[_0x4271('0x2d')]=function(_0xa5d289,_0x59ca89,_0xa23442){passport['authenticate']('ad-login',function(_0x5f54bb,_0x4f1840,_0xab9f26){var _0x23d101=_0x5f54bb||_0xab9f26;if(_0x23d101){return handleError(_0x59ca89,0x191,_0x23d101);}if(!_0x4f1840){return handleError(_0x59ca89,0x194,{'message':_0x4271('0x2e')});}else{var _0xc2c9fb={'payload':{'id':_0x4f1840['id'],'role':_0x4f1840[_0x4271('0x20')]},'options':{'expiresIn':0x15180}};return authService[_0x4271('0x2f')](_0xc2c9fb)[_0x4271('0x1c')](function(_0x5aacd6){_0x59ca89['json']({'id':_0x4f1840['id'],'token':_0x5aacd6,'statusCall':'','isAlreadyLogged':_0x4f1840[_0x4271('0x23')]});});}})(_0xa5d289,_0x59ca89,_0xa23442);};passport[_0x4271('0x30')](_0x4271('0x31'),new LocalStrategy({'usernameField':'name','passwordField':'password'},function(_0x84bc06,_0x1f9462,_0x5f4edd){return ActiveDirectoryAuthenticate(db['User'],_0x84bc06,_0x1f9462,_0x5f4edd);})); \ No newline at end of file +var _0x109b=['moment','activedirectory2','bluebird','util','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','api','activedirectory','undefined','baseDN','domain','Error\x20authenticate\x20%s:\x20%s','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','error','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','role','disabled','blockedAt','online','admin','user','agent','add','clearBlockUser','getLicense','catch','status','login','Something\x20went\x20wrong,\x20please\x20try\x20again.','use','ad-login','User','passport','passport-local','Strategy'];(function(_0x3a1b0d,_0x143c53){var _0xf9de11=function(_0x148a0d){while(--_0x148a0d){_0x3a1b0d['push'](_0x3a1b0d['shift']());}};_0xf9de11(++_0x143c53);}(_0x109b,0x175));var _0xb109=function(_0xaab427,_0x46fede){_0xaab427=_0xaab427-0x0;var _0x5041f3=_0x109b[_0xaab427];return _0x5041f3;};'use strict';var passport=require(_0xb109('0x0'));var LocalStrategy=require(_0xb109('0x1'))[_0xb109('0x2')];var moment=require(_0xb109('0x3'));var ActiveDirectory=require(_0xb109('0x4'));var BPromise=require(_0xb109('0x5'));var util=require(_0xb109('0x6'));var db=require('../../mysqldb')['db'];var authService=require(_0xb109('0x7'));var utils=require(_0xb109('0x8'));var config=require(_0xb109('0x9'));var logger=require(_0xb109('0xa'))(_0xb109('0xb'));function isActiveDirectoryConfigured(_0x1038d3){var _0x479d1f=![];if(typeof _0x1038d3[_0xb109('0xc')]!==_0xb109('0xd')){_0x479d1f=_0x1038d3[_0xb109('0xc')][_0xb109('0xe')]&&_0x1038d3['activedirectory']['url']&&_0x1038d3['activedirectory'][_0xb109('0xf')];}return _0x479d1f;}function adAuthenticate(_0x570c04,_0x531da2,_0x481efd){return new BPromise(function(_0x16b15b,_0x4b9f66){try{var _0x4801ea=new ActiveDirectory(_0x570c04);_0x4801ea['authenticate'](_0x531da2,_0x481efd,function(_0x2c9287,_0x2e4b85){if(_0x2c9287){logger['error'](_0xb109('0x10'),_0x531da2,util[_0xb109('0x11')](_0x2c9287,{'showHidden':![],'depth':null}));_0x4b9f66(_0xb109('0x12'));}else if(!_0x2e4b85){logger[_0xb109('0x13')](_0xb109('0x14'),_0x531da2);_0x4b9f66(_0xb109('0x12'));}else{_0x16b15b(_0x2e4b85);}});}catch(_0x89db16){_0x4b9f66(_0x89db16);}});}function ActiveDirectoryAuthenticate(_0x15fa10,_0x3511db,_0x35505d,_0xfdbfcb){var _0x3eff49,_0x1feefa;if(!isActiveDirectoryConfigured(config)){logger[_0xb109('0x13')](_0xb109('0x15'),_0x3511db);return _0xfdbfcb(null,![],{'message':_0xb109('0x12')});}return db[_0xb109('0x16')][_0xb109('0x17')]({'where':{'id':0x1},'attributes':[_0xb109('0x18'),_0xb109('0x19')],'raw':!![]})[_0xb109('0x1a')](function(_0x514d10){_0x3eff49=_0x514d10;if(!_0x3eff49['adSsoEnabled']){logger[_0xb109('0x13')](_0xb109('0x1b'),_0x3511db);throw new Error(_0xb109('0x12'));}return _0x15fa10['findOne']({'attributes':['id',_0xb109('0x1c'),_0xb109('0x1d'),'salt',_0xb109('0x1e'),_0xb109('0x1f'),'blocked',_0xb109('0x20'),_0xb109('0x21')],'where':{'name':_0x3511db,'role':{'$or':[_0xb109('0x22'),_0xb109('0x23'),_0xb109('0x24')]},'adSsoEnabled':!![]}});})[_0xb109('0x1a')](function(_0x1e3e98){if(!_0x1e3e98||_0x1e3e98&&_0x1e3e98[_0xb109('0x1c')]!==_0x3511db){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}_0x1feefa=_0x1e3e98;var _0x1abdc6=_0x1feefa[_0xb109('0x1c')]+'@'+config[_0xb109('0xc')][_0xb109('0xf')];return adAuthenticate(config[_0xb109('0xc')],_0x1abdc6,_0x35505d);})[_0xb109('0x1a')](function(_0x4518a7){if(_0x1feefa['disabled']){throw new Error(_0xb109('0x12'));}if(_0x3eff49[_0xb109('0x19')]>0x0){if(_0x1feefa['blocked']){if(moment(_0x1feefa[_0xb109('0x20')])[_0xb109('0x25')](_0x3eff49[_0xb109('0x19')],'minutes')>moment()){throw new Error(_0xb109('0x12'));}return utils[_0xb109('0x26')](_0x1feefa,0x0,![],null)[_0xb109('0x1a')](function(){return utils[_0xb109('0x27')](_0x1feefa);})[_0xb109('0x1a')](function(){return _0xfdbfcb(null,_0x1feefa);});}else{return utils['getLicense'](_0x1feefa)['then'](function(){return _0xfdbfcb(null,_0x1feefa);});}}else{return utils[_0xb109('0x27')](_0x1feefa)['then'](function(){return _0xfdbfcb(null,_0x1feefa);});}})[_0xb109('0x28')](function(_0x4b14a6){return _0xfdbfcb(null,![],_0x4b14a6);});}function handleError(_0xca125b,_0x32bed0,_0x258772){return _0xca125b[_0xb109('0x29')](_0x32bed0||0x1f4)['send']({'message':_0x258772?_0x258772['message']||_0x258772:''});}exports[_0xb109('0x2a')]=function(_0xe5bc9c,_0x2f1128,_0x3475d1){passport['authenticate']('ad-login',function(_0x4be211,_0x4f23c2,_0x142dbd){var _0x366365=_0x4be211||_0x142dbd;if(_0x366365){return handleError(_0x2f1128,0x191,_0x366365);}if(!_0x4f23c2){return handleError(_0x2f1128,0x194,{'message':_0xb109('0x2b')});}else{var _0x2f8e24={'payload':{'id':_0x4f23c2['id'],'role':_0x4f23c2[_0xb109('0x1e')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x2f8e24)[_0xb109('0x1a')](function(_0xff7b17){_0x2f1128['json']({'id':_0x4f23c2['id'],'token':_0xff7b17,'statusCall':'','isAlreadyLogged':_0x4f23c2[_0xb109('0x21')]});});}})(_0xe5bc9c,_0x2f1128,_0x3475d1);};passport[_0xb109('0x2c')](_0xb109('0x2d'),new LocalStrategy({'usernameField':_0xb109('0x1c'),'passwordField':_0xb109('0x1d')},function(_0x40346b,_0x550a41,_0x45574){return ActiveDirectoryAuthenticate(db[_0xb109('0x2e')],_0x40346b,_0x550a41,_0x45574);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index 9df1974..676bbfb 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 _0x1edb=['post','login','exports','express','Router'];(function(_0x7dc7a8,_0x56a053){var _0x37f727=function(_0x2ad3cf){while(--_0x2ad3cf){_0x7dc7a8['push'](_0x7dc7a8['shift']());}};_0x37f727(++_0x56a053);}(_0x1edb,0xee));var _0xb1ed=function(_0x5766a5,_0x54d7dd){_0x5766a5=_0x5766a5-0x0;var _0x3dcc88=_0x1edb[_0x5766a5];return _0x3dcc88;};'use strict';var express=require(_0xb1ed('0x0'));var router=express[_0xb1ed('0x1')]();var controller=require('./authActiveDirectory.controller');router[_0xb1ed('0x2')]('/',controller[_0xb1ed('0x3')]);module[_0xb1ed('0x4')]=router; \ No newline at end of file +var _0xf084=['exports','express','Router','./authActiveDirectory.controller','login'];(function(_0x5d9ceb,_0x1a49f5){var _0x33ce82=function(_0x583915){while(--_0x583915){_0x5d9ceb['push'](_0x5d9ceb['shift']());}};_0x33ce82(++_0x1a49f5);}(_0xf084,0x1dc));var _0x4f08=function(_0x3433bb,_0xa47bc2){_0x3433bb=_0x3433bb-0x0;var _0x153240=_0xf084[_0x3433bb];return _0x153240;};'use strict';var express=require(_0x4f08('0x0'));var router=express[_0x4f08('0x1')]();var controller=require(_0x4f08('0x2'));router['post']('/',controller[_0x4f08('0x3')]);module[_0x4f08('0x4')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 4baa790..3ef8bf3 100644 --- a/server/api/authGoogle/authGoogle.controller.js +++ b/server/api/authGoogle/authGoogle.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['../../config/environment','../../config/utils','login','google','/login','profile','email','callback','authenticate','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','User','find','map','emails','value','admin','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb'];(function(_0x2340e2,_0x1627f9){var _0x5ced10=function(_0x3c5250){while(--_0x3c5250){_0x2340e2['push'](_0x2340e2['shift']());}};_0x5ced10(++_0x1627f9);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});})); \ No newline at end of file +var _0x9957=['../../config/environment','../../config/utils','login','google','/login','profile','email','callback','authenticate','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','User','find','map','emails','value','admin','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb'];(function(_0x18958a,_0x1d1e33){var _0x583740=function(_0x1ec90b){while(--_0x1ec90b){_0x18958a['push'](_0x18958a['shift']());}};_0x583740(++_0x1d1e33);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index d32a3a3..e8913d9 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 _0xf9a3=['login','/callback','callback','exports','express','passport','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get'];(function(_0x8d6333,_0x3abc16){var _0x151cf4=function(_0x57e912){while(--_0x57e912){_0x8d6333['push'](_0x8d6333['shift']());}};_0x151cf4(++_0x3abc16);}(_0xf9a3,0x17a));var _0x3f9a=function(_0x4e283d,_0x29ced1){_0x4e283d=_0x4e283d-0x0;var _0x566f7c=_0xf9a3[_0x4e283d];return _0x566f7c;};'use strict';var express=require(_0x3f9a('0x0'));var passport=require(_0x3f9a('0x1'));var router=express[_0x3f9a('0x2')]();var controller=require(_0x3f9a('0x3'));var userController=require(_0x3f9a('0x4'));var authService=require(_0x3f9a('0x5'));router[_0x3f9a('0x6')]('/',controller[_0x3f9a('0x7')]);router[_0x3f9a('0x6')](_0x3f9a('0x8'),controller[_0x3f9a('0x9')],authService['isMiddleware'],userController[_0x3f9a('0x7')],authService['setTokenCookie']);module[_0x3f9a('0xa')]=router; \ No newline at end of file +var _0x69e8=['get','/callback','login','setTokenCookie','exports','express','Router','./authGoogle.controller','../../components/auth/service'];(function(_0x31510c,_0x5b445b){var _0xc98150=function(_0x104507){while(--_0x104507){_0x31510c['push'](_0x31510c['shift']());}};_0xc98150(++_0x5b445b);}(_0x69e8,0x137));var _0x869e=function(_0x5219ed,_0x54087e){_0x5219ed=_0x5219ed-0x0;var _0x510b27=_0x69e8[_0x5219ed];return _0x510b27;};'use strict';var express=require(_0x869e('0x0'));var passport=require('passport');var router=express[_0x869e('0x1')]();var controller=require(_0x869e('0x2'));var userController=require('../user/user.controller.js');var authService=require(_0x869e('0x3'));router['get']('/',controller['login']);router[_0x869e('0x4')](_0x869e('0x5'),controller['callback'],authService['isMiddleware'],userController[_0x869e('0x6')],authService[_0x869e('0x7')]);module[_0x869e('0x8')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 5adb7d9..bc32903 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 _0xdc12=['validatePasswordPattern','previousPasswords','send','Password\x20reset!','use','util','passport-local','Strategy','lodash','randomstring','../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting','findOne','then','name','password','salt','role','disabled','blocked','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','allowedLoginAttempts','blockDuration','blockedAt','minutes','clearBlockUser','add','getLicense','catch','MailAccount','find','email','MailServerOut','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','\x22%s\x22\x20<%s>','Smtp','user','format','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','error','message','stringify','status','login','authenticate','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','forgot','body','generate','trim','toLowerCase','User','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','https://','host','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit'];(function(_0xe9ac75,_0x523839){var _0x4a43b=function(_0x2404dd){while(--_0x2404dd){_0xe9ac75['push'](_0xe9ac75['shift']());}};_0x4a43b(++_0x523839);}(_0xdc12,0xf2));var _0x2dc1=function(_0x5b5db0,_0x350063){_0x5b5db0=_0x5b5db0-0x0;var _0x3788e4=_0xdc12[_0x5b5db0];return _0x3788e4;};'use strict';var util=require(_0x2dc1('0x0'));var passport=require('passport');var LocalStrategy=require(_0x2dc1('0x1'))[_0x2dc1('0x2')];var jayson=require('jayson/promise');var _=require(_0x2dc1('0x3'));var rs=require(_0x2dc1('0x4'));var moment=require('moment');var db=require(_0x2dc1('0x5'))['db'];var authService=require(_0x2dc1('0x6'));var utils=require(_0x2dc1('0x7'));var client=jayson[_0x2dc1('0x8')][_0x2dc1('0x9')]({'port':0x232b});function localAuthenticate(_0x553941,_0x2e2307,_0x55b108,_0x2cab84){var _0x36ca88,_0x2104c5;return db[_0x2dc1('0xa')][_0x2dc1('0xb')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]})[_0x2dc1('0xc')](function(_0x59e37b){_0x36ca88=_0x59e37b;return _0x553941['findOne']({'attributes':['id',_0x2dc1('0xd'),_0x2dc1('0xe'),_0x2dc1('0xf'),_0x2dc1('0x10'),_0x2dc1('0x11'),_0x2dc1('0x12'),'blockedAt','loginAttempts'],'where':{'name':_0x2e2307,'role':{'$or':['admin','user',_0x2dc1('0x13')]}}});})[_0x2dc1('0xc')](function(_0x43c9de){if(!_0x43c9de||_0x43c9de&&_0x43c9de[_0x2dc1('0xd')]!==_0x2e2307){throw new Error(_0x2dc1('0x14'));}else{_0x2104c5=_0x43c9de;return _0x2104c5;}})['then'](function(){_0x2104c5['authenticate'](_0x55b108,function(_0x1e193d,_0x3146f1){var _0x3114fc=_0x2104c5['loginAttempts']+0x1;if(_0x1e193d){return _0x2cab84(_0x1e193d);}else if(!_0x3146f1){if(_0x2104c5[_0x2dc1('0x11')]){return _0x2cab84(null,![],{'message':_0x2dc1('0x14')});}else if(_0x36ca88[_0x2dc1('0x15')]>0x0){if(_0x2104c5[_0x2dc1('0x12')]){if(_0x36ca88[_0x2dc1('0x16')]>0x0){if(moment(_0x2104c5[_0x2dc1('0x17')])['add'](_0x36ca88[_0x2dc1('0x16')],_0x2dc1('0x18'))>moment()){return _0x2cab84(null,![],{'message':_0x2dc1('0x14')});}else{return utils[_0x2dc1('0x19')](_0x2104c5,_0x3114fc,![],null)[_0x2dc1('0xc')](function(){return _0x2cab84(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x2cab84(null,![],{'message':_0x2dc1('0x14')});}}else{if(_0x3114fc>=_0x36ca88['allowedLoginAttempts']){return utils[_0x2dc1('0x19')](_0x2104c5,0x0,!![],moment())['then'](function(){return _0x2cab84(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0x2dc1('0x19')](_0x2104c5,_0x3114fc,![],null)['then'](function(){return _0x2cab84(null,![],{'message':_0x2dc1('0x14')});});}}}else{return _0x2cab84(null,![],{'message':_0x2dc1('0x14')});}}else{if(_0x2104c5[_0x2dc1('0x11')]){return _0x2cab84(null,![],{'message':_0x2dc1('0x14')});}else if(_0x36ca88[_0x2dc1('0x15')]>0x0){if(_0x2104c5[_0x2dc1('0x12')]){if(_0x36ca88[_0x2dc1('0x16')]>0x0){if(moment(_0x2104c5['blockedAt'])[_0x2dc1('0x1a')](_0x36ca88[_0x2dc1('0x16')],_0x2dc1('0x18'))>moment()){return _0x2cab84(null,![],{'message':_0x2dc1('0x14')});}else{return utils[_0x2dc1('0x19')](_0x2104c5,0x0,![],null)[_0x2dc1('0xc')](function(){return utils[_0x2dc1('0x1b')](_0x2104c5);})[_0x2dc1('0xc')](function(){return _0x2cab84(null,_0x2104c5);});}}else{return _0x2cab84(null,![],{'message':_0x2dc1('0x14')});}}else{return utils[_0x2dc1('0x19')](_0x2104c5,0x0,![],null)['then'](function(){return utils[_0x2dc1('0x1b')](_0x2104c5);})[_0x2dc1('0xc')](function(){return _0x2cab84(null,_0x2104c5);})[_0x2dc1('0x1c')](function(_0x4ee2a9){return _0x2cab84(null,![],_0x4ee2a9);});}}else{if(_0x2104c5['blocked']){return _0x2cab84(null,![],{'message':_0x2dc1('0x14')});}else{return utils[_0x2dc1('0x1b')](_0x2104c5)[_0x2dc1('0xc')](function(){return _0x2cab84(null,_0x2104c5);});}}}});})[_0x2dc1('0x1c')](function(_0x36998f){return _0x2cab84(null,![],_0x36998f);});}function sendServiceMail(_0x3c0f35){return db[_0x2dc1('0x1d')][_0x2dc1('0x1e')]({'where':{'service':!![]},'attributes':['id','name',_0x2dc1('0x1f')],'include':[{'model':db[_0x2dc1('0x20')],'as':'Smtp','include':[{'model':db[_0x2dc1('0x21')],'as':_0x2dc1('0x21')}]}]})[_0x2dc1('0xc')](function(_0x76b933){if(!_0x76b933){throw new Error(_0x2dc1('0x22'));}var _0xc2a10d=_0x76b933[_0x2dc1('0x23')]();var _0x45239d={'account':_0xc2a10d,'message':_[_0x2dc1('0x24')]({'from':util['format'](_0x2dc1('0x25'),_0x76b933[_0x2dc1('0xd')],_0x76b933['email']||_0x76b933[_0x2dc1('0x26')][_0x2dc1('0x27')])},_0x3c0f35)};return client['request']('SendMail',_0x45239d);})[_0x2dc1('0xc')](function(_0x196ca1){if(_0x196ca1['error']){throw new Error(util[_0x2dc1('0x28')](_0x2dc1('0x29'),_0x196ca1[_0x2dc1('0x2a')][_0x2dc1('0x2b')]||JSON[_0x2dc1('0x2c')](_0x196ca1[_0x2dc1('0x2a')])));}return!![];});}function handleError(_0x537ad7,_0x2cc984,_0x4fa94f){return _0x537ad7[_0x2dc1('0x2d')](_0x2cc984||0x1f4)['send']({'message':_0x4fa94f?_0x4fa94f['message']||_0x4fa94f:''});}exports[_0x2dc1('0x2e')]=function(_0x3deae0,_0x536c47,_0x476ee9){passport[_0x2dc1('0x2f')](_0x2dc1('0x30'),function(_0x41b977,_0x34249a,_0xe9f790){var _0x425f6f=_0x41b977||_0xe9f790;if(_0x425f6f){return handleError(_0x536c47,0x191,_0x425f6f);}if(!_0x34249a){return handleError(_0x536c47,0x194,{'message':_0x2dc1('0x31')});}else{var _0x15eb77={'payload':{'id':_0x34249a['id'],'role':_0x34249a[_0x2dc1('0x10')]},'options':{'expiresIn':0x15180}};return authService[_0x2dc1('0x32')](_0x15eb77)[_0x2dc1('0xc')](function(_0x5c1871){_0x536c47['json']({'id':_0x34249a['id'],'token':_0x5c1871,'statusCall':'','isAlreadyLogged':_0x34249a['online']});});}})(_0x3deae0,_0x536c47,_0x476ee9);};exports[_0x2dc1('0x33')]=function(_0x41abe4,_0x1fb5f9){if(!_0x41abe4[_0x2dc1('0x34')][_0x2dc1('0x1f')]){return handleError(_0x1fb5f9,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0xb3da5f=rs[_0x2dc1('0x35')]();_0x41abe4['body']['email']=_0x41abe4[_0x2dc1('0x34')][_0x2dc1('0x1f')][_0x2dc1('0x36')]()[_0x2dc1('0x37')]();var _0x1fe946;return db[_0x2dc1('0xa')]['findOne']({'where':{'id':0x1},'attributes':[_0x2dc1('0x15'),_0x2dc1('0x16')],'raw':!![]})[_0x2dc1('0xc')](function(_0x59d6aa){_0x1fe946=_0x59d6aa;return db[_0x2dc1('0x38')][_0x2dc1('0x1e')]({'where':{'email':_0x41abe4[_0x2dc1('0x34')]['email']}});})['then'](function(_0x9cfc8e){if(!_0x9cfc8e){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x9cfc8e[_0x2dc1('0x11')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x9cfc8e[_0x2dc1('0x12')]){if(moment(_0x9cfc8e[_0x2dc1('0x17')])['add'](_0x1fe946[_0x2dc1('0x16')],'minutes')>moment()){throw new Error(_0x2dc1('0x39'));}else{_0x9cfc8e['blocked']=![];_0x9cfc8e['blockedAt']=null;}}_0x9cfc8e[_0x2dc1('0x3a')]=_0xb3da5f;_0x9cfc8e[_0x2dc1('0x3b')]=Date[_0x2dc1('0x3c')]()+0x36ee80;return _0x9cfc8e['save']();})['then'](function(){return sendServiceMail({'to':_0x41abe4[_0x2dc1('0x34')][_0x2dc1('0x1f')],'subject':_0x2dc1('0x3d'),'text':_0x2dc1('0x3e')+_0x2dc1('0x3f')+_0x2dc1('0x40')+_0x41abe4['headers'][_0x2dc1('0x41')]+'/reset/'+_0xb3da5f+'\x0a\x0a'+_0x2dc1('0x42')});})['then'](function(){_0x1fb5f9[_0x2dc1('0x2d')](0xc8)['send']({'message':_0x2dc1('0x43')});})[_0x2dc1('0x1c')](function(_0x12f25e){return handleError(_0x1fb5f9,0x1f4,_0x12f25e);});};exports['reset']=function(_0x22b63a,_0x56c65){return db[_0x2dc1('0x38')]['find']({'where':{'resetPasswordToken':_0x22b63a[_0x2dc1('0x44')][_0x2dc1('0x45')],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0x2dc1('0xc')](function(_0x3f0976){if(!_0x3f0976){throw new Error(_0x2dc1('0x46'));}return db[_0x2dc1('0xa')][_0x2dc1('0xb')]({'attributes':['id',_0x2dc1('0x47'),_0x2dc1('0x48'),_0x2dc1('0x49')]})[_0x2dc1('0xc')](function(_0x31aec0){if(_0x31aec0['securePassword'])authService[_0x2dc1('0x4a')](_0x22b63a[_0x2dc1('0x34')][_0x2dc1('0xe')]);if(!_0x31aec0[_0x2dc1('0x48')]||!_0x3f0976[_0x2dc1('0x4b')])return _0x3f0976;authService['validatePasswordHistory'](_0x22b63a[_0x2dc1('0x34')][_0x2dc1('0xe')],_0x3f0976[_0x2dc1('0x4b')],_0x31aec0[_0x2dc1('0x49')]);return _0x3f0976;})[_0x2dc1('0xc')](function(){_0x3f0976['password']=_0x22b63a[_0x2dc1('0x34')]['password'];_0x3f0976[_0x2dc1('0x3a')]=null;_0x3f0976[_0x2dc1('0x3b')]=null;return _0x3f0976['save']();});})[_0x2dc1('0xc')](function(){_0x56c65[_0x2dc1('0x2d')](0xc8)[_0x2dc1('0x4c')]({'message':_0x2dc1('0x4d')});})[_0x2dc1('0x1c')](function(_0x33ffa2){return handleError(_0x56c65,0x1f4,_0x33ffa2);});};passport[_0x2dc1('0x4e')](_0x2dc1('0x30'),new LocalStrategy({'usernameField':'name','passwordField':_0x2dc1('0xe')},function(_0x460bb7,_0x2da45f,_0xaed21c){return localAuthenticate(db[_0x2dc1('0x38')],_0x460bb7,_0x2da45f,_0xaed21c);})); \ No newline at end of file +var _0x3bbf=['resetPasswordToken','Password\x20reset!','use','local-login','util','passport-local','Strategy','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting','allowedLoginAttempts','blockDuration','then','findOne','name','salt','role','disabled','blockedAt','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','loginAttempts','blocked','minutes','clearBlockUser','add','getLicense','catch','MailAccount','email','MailServerOut','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','format','\x22%s\x22\x20<%s>','Smtp','request','error','message','stringify','status','login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','body','generate','trim','toLowerCase','find','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','send','Reset\x20Email\x20sent!','User','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','password','previousPasswords','validatePasswordHistory'];(function(_0x39d666,_0x2ef328){var _0x1a5677=function(_0xe3f545){while(--_0xe3f545){_0x39d666['push'](_0x39d666['shift']());}};_0x1a5677(++_0x2ef328);}(_0x3bbf,0xb4));var _0xf3bb=function(_0x1fdf85,_0x5c801d){_0x1fdf85=_0x1fdf85-0x0;var _0x18d1b1=_0x3bbf[_0x1fdf85];return _0x18d1b1;};'use strict';var util=require(_0xf3bb('0x0'));var passport=require('passport');var LocalStrategy=require(_0xf3bb('0x1'))[_0xf3bb('0x2')];var jayson=require(_0xf3bb('0x3'));var _=require(_0xf3bb('0x4'));var rs=require(_0xf3bb('0x5'));var moment=require(_0xf3bb('0x6'));var db=require(_0xf3bb('0x7'))['db'];var authService=require(_0xf3bb('0x8'));var utils=require(_0xf3bb('0x9'));var client=jayson[_0xf3bb('0xa')][_0xf3bb('0xb')]({'port':0x232b});function localAuthenticate(_0x3d89e0,_0x45e4e4,_0x30c290,_0x19eb59){var _0x2dd4c6,_0x53b317;return db[_0xf3bb('0xc')]['findOne']({'where':{'id':0x1},'attributes':[_0xf3bb('0xd'),_0xf3bb('0xe')],'raw':!![]})[_0xf3bb('0xf')](function(_0xcbab60){_0x2dd4c6=_0xcbab60;return _0x3d89e0[_0xf3bb('0x10')]({'attributes':['id',_0xf3bb('0x11'),'password',_0xf3bb('0x12'),_0xf3bb('0x13'),_0xf3bb('0x14'),'blocked',_0xf3bb('0x15'),'loginAttempts'],'where':{'name':_0x45e4e4,'role':{'$or':['admin',_0xf3bb('0x16'),_0xf3bb('0x17')]}}});})[_0xf3bb('0xf')](function(_0xb6110){if(!_0xb6110||_0xb6110&&_0xb6110[_0xf3bb('0x11')]!==_0x45e4e4){throw new Error(_0xf3bb('0x18'));}else{_0x53b317=_0xb6110;return _0x53b317;}})[_0xf3bb('0xf')](function(){_0x53b317[_0xf3bb('0x19')](_0x30c290,function(_0x1b46e3,_0x354964){var _0x4348f8=_0x53b317[_0xf3bb('0x1a')]+0x1;if(_0x1b46e3){return _0x19eb59(_0x1b46e3);}else if(!_0x354964){if(_0x53b317[_0xf3bb('0x14')]){return _0x19eb59(null,![],{'message':_0xf3bb('0x18')});}else if(_0x2dd4c6[_0xf3bb('0xd')]>0x0){if(_0x53b317[_0xf3bb('0x1b')]){if(_0x2dd4c6[_0xf3bb('0xe')]>0x0){if(moment(_0x53b317[_0xf3bb('0x15')])['add'](_0x2dd4c6[_0xf3bb('0xe')],_0xf3bb('0x1c'))>moment()){return _0x19eb59(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xf3bb('0x1d')](_0x53b317,_0x4348f8,![],null)[_0xf3bb('0xf')](function(){return _0x19eb59(null,![],{'message':_0xf3bb('0x18')});});}}else{return _0x19eb59(null,![],{'message':_0xf3bb('0x18')});}}else{if(_0x4348f8>=_0x2dd4c6[_0xf3bb('0xd')]){return utils['clearBlockUser'](_0x53b317,0x0,!![],moment())[_0xf3bb('0xf')](function(){return _0x19eb59(null,![],{'message':_0xf3bb('0x18')});});}else{return utils[_0xf3bb('0x1d')](_0x53b317,_0x4348f8,![],null)[_0xf3bb('0xf')](function(){return _0x19eb59(null,![],{'message':_0xf3bb('0x18')});});}}}else{return _0x19eb59(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x53b317[_0xf3bb('0x14')]){return _0x19eb59(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x2dd4c6[_0xf3bb('0xd')]>0x0){if(_0x53b317['blocked']){if(_0x2dd4c6['blockDuration']>0x0){if(moment(_0x53b317[_0xf3bb('0x15')])[_0xf3bb('0x1e')](_0x2dd4c6[_0xf3bb('0xe')],'minutes')>moment()){return _0x19eb59(null,![],{'message':_0xf3bb('0x18')});}else{return utils[_0xf3bb('0x1d')](_0x53b317,0x0,![],null)['then'](function(){return utils[_0xf3bb('0x1f')](_0x53b317);})[_0xf3bb('0xf')](function(){return _0x19eb59(null,_0x53b317);});}}else{return _0x19eb59(null,![],{'message':_0xf3bb('0x18')});}}else{return utils[_0xf3bb('0x1d')](_0x53b317,0x0,![],null)['then'](function(){return utils[_0xf3bb('0x1f')](_0x53b317);})['then'](function(){return _0x19eb59(null,_0x53b317);})[_0xf3bb('0x20')](function(_0x456287){return _0x19eb59(null,![],_0x456287);});}}else{if(_0x53b317[_0xf3bb('0x1b')]){return _0x19eb59(null,![],{'message':_0xf3bb('0x18')});}else{return utils[_0xf3bb('0x1f')](_0x53b317)[_0xf3bb('0xf')](function(){return _0x19eb59(null,_0x53b317);});}}}});})[_0xf3bb('0x20')](function(_0x1ec676){return _0x19eb59(null,![],_0x1ec676);});}function sendServiceMail(_0xe9194d){return db[_0xf3bb('0x21')]['find']({'where':{'service':!![]},'attributes':['id','name',_0xf3bb('0x22')],'include':[{'model':db[_0xf3bb('0x23')],'as':'Smtp','include':[{'model':db[_0xf3bb('0x24')],'as':_0xf3bb('0x24')}]}]})['then'](function(_0xb117d){if(!_0xb117d){throw new Error(_0xf3bb('0x25'));}var _0x3a581d=_0xb117d[_0xf3bb('0x26')]();var _0x4c2536={'account':_0x3a581d,'message':_[_0xf3bb('0x27')]({'from':util[_0xf3bb('0x28')](_0xf3bb('0x29'),_0xb117d[_0xf3bb('0x11')],_0xb117d['email']||_0xb117d[_0xf3bb('0x2a')][_0xf3bb('0x16')])},_0xe9194d)};return client[_0xf3bb('0x2b')]('SendMail',_0x4c2536);})[_0xf3bb('0xf')](function(_0x18bf68){if(_0x18bf68['error']){throw new Error(util[_0xf3bb('0x28')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x18bf68[_0xf3bb('0x2c')][_0xf3bb('0x2d')]||JSON[_0xf3bb('0x2e')](_0x18bf68[_0xf3bb('0x2c')])));}return!![];});}function handleError(_0x237582,_0x2a92ed,_0x491865){return _0x237582[_0xf3bb('0x2f')](_0x2a92ed||0x1f4)['send']({'message':_0x491865?_0x491865[_0xf3bb('0x2d')]||_0x491865:''});}exports[_0xf3bb('0x30')]=function(_0x332815,_0x352654,_0x52edbc){passport[_0xf3bb('0x19')]('local-login',function(_0x1ec0ca,_0xc24a5b,_0x1d8ac9){var _0xd09cd7=_0x1ec0ca||_0x1d8ac9;if(_0xd09cd7){return handleError(_0x352654,0x191,_0xd09cd7);}if(!_0xc24a5b){return handleError(_0x352654,0x194,{'message':_0xf3bb('0x31')});}else{var _0x548454={'payload':{'id':_0xc24a5b['id'],'role':_0xc24a5b[_0xf3bb('0x13')]},'options':{'expiresIn':0x15180}};return authService[_0xf3bb('0x32')](_0x548454)[_0xf3bb('0xf')](function(_0x426194){_0x352654[_0xf3bb('0x33')]({'id':_0xc24a5b['id'],'token':_0x426194,'statusCall':'','isAlreadyLogged':_0xc24a5b[_0xf3bb('0x34')]});});}})(_0x332815,_0x352654,_0x52edbc);};exports[_0xf3bb('0x35')]=function(_0x98961c,_0x5e107a){if(!_0x98961c[_0xf3bb('0x36')][_0xf3bb('0x22')]){return handleError(_0x5e107a,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x4dd9c4=rs[_0xf3bb('0x37')]();_0x98961c[_0xf3bb('0x36')][_0xf3bb('0x22')]=_0x98961c[_0xf3bb('0x36')][_0xf3bb('0x22')][_0xf3bb('0x38')]()[_0xf3bb('0x39')]();var _0x11dad3;return db[_0xf3bb('0xc')][_0xf3bb('0x10')]({'where':{'id':0x1},'attributes':[_0xf3bb('0xd'),_0xf3bb('0xe')],'raw':!![]})[_0xf3bb('0xf')](function(_0x91b301){_0x11dad3=_0x91b301;return db['User'][_0xf3bb('0x3a')]({'where':{'email':_0x98961c['body'][_0xf3bb('0x22')]}});})['then'](function(_0x15a7b4){if(!_0x15a7b4){throw new Error(_0xf3bb('0x3b'));}if(_0x15a7b4[_0xf3bb('0x14')]){throw new Error(_0xf3bb('0x3c'));}if(_0x15a7b4[_0xf3bb('0x1b')]){if(moment(_0x15a7b4[_0xf3bb('0x15')])['add'](_0x11dad3[_0xf3bb('0xe')],_0xf3bb('0x1c'))>moment()){throw new Error(_0xf3bb('0x3d'));}else{_0x15a7b4[_0xf3bb('0x1b')]=![];_0x15a7b4[_0xf3bb('0x15')]=null;}}_0x15a7b4['resetPasswordToken']=_0x4dd9c4;_0x15a7b4[_0xf3bb('0x3e')]=Date[_0xf3bb('0x3f')]()+0x36ee80;return _0x15a7b4[_0xf3bb('0x40')]();})[_0xf3bb('0xf')](function(){return sendServiceMail({'to':_0x98961c[_0xf3bb('0x36')][_0xf3bb('0x22')],'subject':_0xf3bb('0x41'),'text':_0xf3bb('0x42')+_0xf3bb('0x43')+_0xf3bb('0x44')+_0x98961c['headers']['host']+_0xf3bb('0x45')+_0x4dd9c4+'\x0a\x0a'+_0xf3bb('0x46')});})[_0xf3bb('0xf')](function(){_0x5e107a[_0xf3bb('0x2f')](0xc8)[_0xf3bb('0x47')]({'message':_0xf3bb('0x48')});})[_0xf3bb('0x20')](function(_0x234a29){return handleError(_0x5e107a,0x1f4,_0x234a29);});};exports['reset']=function(_0x46a986,_0x4bd790){return db[_0xf3bb('0x49')][_0xf3bb('0x3a')]({'where':{'resetPasswordToken':_0x46a986[_0xf3bb('0x4a')][_0xf3bb('0x4b')],'resetPasswordExpires':{'$gt':Date[_0xf3bb('0x3f')]()}}})[_0xf3bb('0xf')](function(_0x3679c4){if(!_0x3679c4){throw new Error(_0xf3bb('0x4c'));}return db[_0xf3bb('0xc')]['findOne']({'attributes':['id',_0xf3bb('0x4d'),_0xf3bb('0x4e'),_0xf3bb('0x4f')]})[_0xf3bb('0xf')](function(_0x4eac70){if(_0x4eac70[_0xf3bb('0x4d')])authService[_0xf3bb('0x50')](_0x46a986[_0xf3bb('0x36')][_0xf3bb('0x51')]);if(!_0x4eac70[_0xf3bb('0x4e')]||!_0x3679c4[_0xf3bb('0x52')])return _0x3679c4;authService[_0xf3bb('0x53')](_0x46a986[_0xf3bb('0x36')][_0xf3bb('0x51')],_0x3679c4[_0xf3bb('0x52')],_0x4eac70[_0xf3bb('0x4f')]);return _0x3679c4;})['then'](function(){_0x3679c4[_0xf3bb('0x51')]=_0x46a986[_0xf3bb('0x36')][_0xf3bb('0x51')];_0x3679c4[_0xf3bb('0x54')]=null;_0x3679c4['resetPasswordExpires']=null;return _0x3679c4[_0xf3bb('0x40')]();});})[_0xf3bb('0xf')](function(){_0x4bd790['status'](0xc8)['send']({'message':_0xf3bb('0x55')});})['catch'](function(_0x1898b4){return handleError(_0x4bd790,0x1f4,_0x1898b4);});};passport[_0xf3bb('0x56')](_0xf3bb('0x57'),new LocalStrategy({'usernameField':_0xf3bb('0x11'),'passwordField':_0xf3bb('0x51')},function(_0x455fb5,_0x5429a4,_0x55f7b6){return localAuthenticate(db['User'],_0x455fb5,_0x5429a4,_0x55f7b6);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 5d0ab83..d8953c5 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 _0xe145=['/reset/:token','reset','exports','express','Router','./authLocal.controller','login','/forgot'];(function(_0x5c1932,_0x5b1a24){var _0x2e8728=function(_0x495742){while(--_0x495742){_0x5c1932['push'](_0x5c1932['shift']());}};_0x2e8728(++_0x5b1a24);}(_0xe145,0x16b));var _0x5e14=function(_0x1fb704,_0x3d5bae){_0x1fb704=_0x1fb704-0x0;var _0x47d149=_0xe145[_0x1fb704];return _0x47d149;};'use strict';var express=require(_0x5e14('0x0'));var router=express[_0x5e14('0x1')]();var controller=require(_0x5e14('0x2'));router['post']('/',controller[_0x5e14('0x3')]);router['post'](_0x5e14('0x4'),controller['forgot']);router['post'](_0x5e14('0x5'),controller[_0x5e14('0x6')]);module[_0x5e14('0x7')]=router; \ No newline at end of file +var _0xe602=['Router','./authLocal.controller','post','/forgot','reset'];(function(_0x5cf0b1,_0x53548d){var _0x4b97d3=function(_0x49b29d){while(--_0x49b29d){_0x5cf0b1['push'](_0x5cf0b1['shift']());}};_0x4b97d3(++_0x53548d);}(_0xe602,0x1c2));var _0x2e60=function(_0x1efe1c,_0x29dec4){_0x1efe1c=_0x1efe1c-0x0;var _0x31dbd1=_0xe602[_0x1efe1c];return _0x31dbd1;};'use strict';var express=require('express');var router=express[_0x2e60('0x0')]();var controller=require(_0x2e60('0x1'));router[_0x2e60('0x2')]('/',controller['login']);router[_0x2e60('0x2')](_0x2e60('0x3'),controller['forgot']);router[_0x2e60('0x2')]('/reset/:token',controller[_0x2e60('0x4')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 971593a..d82a274 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 _0x9ad9=['exports','STRING','INTEGER'];(function(_0x350104,_0x422321){var _0xc14665=function(_0x28170c){while(--_0x28170c){_0x350104['push'](_0x350104['shift']());}};_0xc14665(++_0x422321);}(_0x9ad9,0x186));var _0x99ad=function(_0x295e3e,_0x30b417){_0x295e3e=_0x295e3e-0x0;var _0x4c8a9c=_0x9ad9[_0x295e3e];return _0x4c8a9c;};'use strict';var Sequelize=require('sequelize');module[_0x99ad('0x0')]={'name':{'type':Sequelize[_0x99ad('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0x99ad('0x1')]},'description':{'type':Sequelize[_0x99ad('0x1')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0x99ad('0x2')],'defaultValue':0xa}}; \ No newline at end of file +var _0x1e81=['BOOLEAN','INTEGER','sequelize','STRING'];(function(_0x369b51,_0x1c8d97){var _0x247729=function(_0x3264aa){while(--_0x3264aa){_0x369b51['push'](_0x369b51['shift']());}};_0x247729(++_0x1c8d97);}(_0x1e81,0x1e2));var _0x11e8=function(_0x4dadd4,_0x481e65){_0x4dadd4=_0x4dadd4-0x0;var _0x405599=_0x1e81[_0x4dadd4];return _0x405599;};'use strict';var Sequelize=require(_0x11e8('0x0'));module['exports']={'name':{'type':Sequelize[_0x11e8('0x1')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x11e8('0x1')]},'status':{'type':Sequelize[_0x11e8('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x11e8('0x3')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 82f481f..76c9fb7 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 _0xad32=['find','create','body','destroy','addConditions','ids','getConditions','findOne','Condition','order','pick','addActions','Action','omit','getActions','eml-format','rimraf','request-promise','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','count','limit','set','apply','reject','update','then','sendStatus','error','stack','name','index','Automation','rawAttributes','fieldName','type','key','model','map','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','options','findAll','rows','catch','params','includeAll','include','merge'];(function(_0x9f34bc,_0x3fb4ce){var _0x4c353e=function(_0x5b3007){while(--_0x5b3007){_0x9f34bc['push'](_0x9f34bc['shift']());}};_0x4c353e(++_0x3fb4ce);}(_0xad32,0x64));var _0x2ad3=function(_0x19ba30,_0x5e43bf){_0x19ba30=_0x19ba30-0x0;var _0x483fb2=_0xad32[_0x19ba30];return _0x483fb2;};'use strict';var emlformat=require(_0x2ad3('0x0'));var rimraf=require(_0x2ad3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2ad3('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2ad3('0x3'));var util=require(_0x2ad3('0x4'));var path=require(_0x2ad3('0x5'));var sox=require(_0x2ad3('0x6'));var csv=require(_0x2ad3('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2ad3('0x8'));var _=require(_0x2ad3('0x9'));var squel=require(_0x2ad3('0xa'));var crypto=require(_0x2ad3('0xb'));var jsforce=require(_0x2ad3('0xc'));var deskjs=require(_0x2ad3('0xd'));var toCsv=require(_0x2ad3('0x7'));var querystring=require(_0x2ad3('0xe'));var Papa=require(_0x2ad3('0xf'));var Redis=require(_0x2ad3('0x10'));var authService=require(_0x2ad3('0x11'));var qs=require(_0x2ad3('0x12'));var as=require(_0x2ad3('0x13'));var hardwareService=require(_0x2ad3('0x14'));var logger=require(_0x2ad3('0x15'))(_0x2ad3('0x16'));var utils=require(_0x2ad3('0x17'));var config=require(_0x2ad3('0x18'));var licenseUtil=require(_0x2ad3('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2300e7,_0x59297e){_0x59297e=_0x59297e||0xcc;return function(_0x4c79fd){if(_0x4c79fd){return _0x2300e7['sendStatus'](_0x59297e);}return _0x2300e7[_0x2ad3('0x1a')](_0x59297e)[_0x2ad3('0x1b')]();};}function respondWithResult(_0x3e2569,_0x28fd8e){_0x28fd8e=_0x28fd8e||0xc8;return function(_0x40cc48){if(_0x40cc48){return _0x3e2569[_0x2ad3('0x1a')](_0x28fd8e)[_0x2ad3('0x1c')](_0x40cc48);}};}function respondWithFilteredResult(_0x47f763,_0x1505d4){return function(_0xe08ed8){if(_0xe08ed8){var _0x165060=typeof _0x1505d4[_0x2ad3('0x1d')]==='undefined'&&typeof _0x1505d4['limit']===_0x2ad3('0x1e');var _0x5f2de0=_0xe08ed8[_0x2ad3('0x1f')];var _0x445f73=_0x165060?0x0:_0x1505d4[_0x2ad3('0x1d')];var _0x440997=_0x165060?_0xe08ed8[_0x2ad3('0x1f')]:_0x1505d4['offset']+_0x1505d4[_0x2ad3('0x20')];var _0x5db3f0;if(_0x440997>=_0x5f2de0){_0x440997=_0x5f2de0;_0x5db3f0=0xc8;}else{_0x5db3f0=0xce;}_0x47f763[_0x2ad3('0x1a')](_0x5db3f0);return _0x47f763[_0x2ad3('0x21')]('Content-Range',_0x445f73+'-'+_0x440997+'/'+_0x5f2de0)[_0x2ad3('0x1c')](_0xe08ed8);}return null;};}function patchUpdates(_0x4da1b2){return function(_0x3e60b9){try{jsonpatch[_0x2ad3('0x22')](_0x3e60b9,_0x4da1b2,!![]);}catch(_0x127db5){return BPromise[_0x2ad3('0x23')](_0x127db5);}return _0x3e60b9['save']();};}function saveUpdates(_0x524737,_0x461f34){return function(_0x274d0f){if(_0x274d0f){return _0x274d0f[_0x2ad3('0x24')](_0x524737)[_0x2ad3('0x25')](function(_0x1bfe29){return _0x1bfe29;});}return null;};}function removeEntity(_0x6b2171,_0x2f30ec){return function(_0x11efe5){if(_0x11efe5){return _0x11efe5['destroy']()[_0x2ad3('0x25')](function(){_0x6b2171[_0x2ad3('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xbdf5be,_0x2ac222){return function(_0x23fe9e){if(!_0x23fe9e){_0xbdf5be[_0x2ad3('0x26')](0x194);}return _0x23fe9e;};}function handleError(_0x2ae984,_0x3ff970){_0x3ff970=_0x3ff970||0x1f4;return function(_0x3a6ccf){logger[_0x2ad3('0x27')](_0x3a6ccf[_0x2ad3('0x28')]);if(_0x3a6ccf[_0x2ad3('0x29')]){delete _0x3a6ccf[_0x2ad3('0x29')];}_0x2ae984[_0x2ad3('0x1a')](_0x3ff970)['send'](_0x3a6ccf);};}exports[_0x2ad3('0x2a')]=function(_0x36aff5,_0x5e2f7e){var _0x4fe215={},_0x3fd607={},_0x5a4c7f={'count':0x0,'rows':[]};var _0x445c1e=_['map'](db[_0x2ad3('0x2b')][_0x2ad3('0x2c')],function(_0x55e0ba){return{'name':_0x55e0ba[_0x2ad3('0x2d')],'type':_0x55e0ba[_0x2ad3('0x2e')][_0x2ad3('0x2f')]};});_0x3fd607[_0x2ad3('0x30')]=_[_0x2ad3('0x31')](_0x445c1e,_0x2ad3('0x29'));_0x3fd607[_0x2ad3('0x32')]=_[_0x2ad3('0x33')](_0x36aff5[_0x2ad3('0x32')]);_0x3fd607['filters']=_['intersection'](_0x3fd607[_0x2ad3('0x30')],_0x3fd607[_0x2ad3('0x32')]);_0x4fe215[_0x2ad3('0x34')]=_[_0x2ad3('0x35')](_0x3fd607[_0x2ad3('0x30')],qs[_0x2ad3('0x36')](_0x36aff5[_0x2ad3('0x32')][_0x2ad3('0x36')]));_0x4fe215['attributes']=_0x4fe215[_0x2ad3('0x34')][_0x2ad3('0x37')]?_0x4fe215[_0x2ad3('0x34')]:_0x3fd607[_0x2ad3('0x30')];if(!_0x36aff5[_0x2ad3('0x32')][_0x2ad3('0x38')](_0x2ad3('0x39'))){_0x4fe215['limit']=qs[_0x2ad3('0x20')](_0x36aff5[_0x2ad3('0x32')][_0x2ad3('0x20')]);_0x4fe215[_0x2ad3('0x1d')]=qs[_0x2ad3('0x1d')](_0x36aff5[_0x2ad3('0x32')][_0x2ad3('0x1d')]);}_0x4fe215['order']=qs[_0x2ad3('0x3a')](_0x36aff5[_0x2ad3('0x32')]['sort']);_0x4fe215[_0x2ad3('0x3b')]=qs[_0x2ad3('0x3c')](_['pick'](_0x36aff5[_0x2ad3('0x32')],_0x3fd607['filters']),_0x445c1e);if(_0x36aff5[_0x2ad3('0x32')][_0x2ad3('0x3d')]){_0x4fe215[_0x2ad3('0x3b')]=_['merge'](_0x4fe215[_0x2ad3('0x3b')],{'$or':_[_0x2ad3('0x31')](_0x445c1e,function(_0x5200d2){if(_0x5200d2[_0x2ad3('0x2e')]!=='VIRTUAL'){var _0xcdd759={};_0xcdd759[_0x5200d2[_0x2ad3('0x29')]]={'$like':'%'+_0x36aff5['query'][_0x2ad3('0x3d')]+'%'};return _0xcdd759;}})});}_0x4fe215=_['merge']({},_0x4fe215,_0x36aff5[_0x2ad3('0x3e')]);var _0x12f005={'where':_0x4fe215[_0x2ad3('0x3b')]};return db['Automation'][_0x2ad3('0x1f')](_0x12f005)[_0x2ad3('0x25')](function(_0x339773){_0x5a4c7f[_0x2ad3('0x1f')]=_0x339773;if(_0x36aff5[_0x2ad3('0x32')]['includeAll']){_0x4fe215['include']=[{'all':!![]}];}return db[_0x2ad3('0x2b')][_0x2ad3('0x3f')](_0x4fe215);})[_0x2ad3('0x25')](function(_0x1686f2){_0x5a4c7f[_0x2ad3('0x40')]=_0x1686f2;return _0x5a4c7f;})[_0x2ad3('0x25')](respondWithFilteredResult(_0x5e2f7e,_0x4fe215))[_0x2ad3('0x41')](handleError(_0x5e2f7e,null));};exports['show']=function(_0x28a274,_0xff6d78){var _0x3faa67={'raw':![],'where':{'id':_0x28a274[_0x2ad3('0x42')]['id']}},_0x454d8b={};_0x454d8b['model']=_['keys'](db[_0x2ad3('0x2b')]['rawAttributes']);_0x454d8b['query']=_[_0x2ad3('0x33')](_0x28a274[_0x2ad3('0x32')]);_0x454d8b[_0x2ad3('0x3c')]=_['intersection'](_0x454d8b['model'],_0x454d8b[_0x2ad3('0x32')]);_0x3faa67[_0x2ad3('0x34')]=_[_0x2ad3('0x35')](_0x454d8b[_0x2ad3('0x30')],qs[_0x2ad3('0x36')](_0x28a274[_0x2ad3('0x32')]['fields']));_0x3faa67[_0x2ad3('0x34')]=_0x3faa67[_0x2ad3('0x34')][_0x2ad3('0x37')]?_0x3faa67[_0x2ad3('0x34')]:_0x454d8b[_0x2ad3('0x30')];if(_0x28a274[_0x2ad3('0x32')][_0x2ad3('0x43')]){_0x3faa67[_0x2ad3('0x44')]=[{'all':!![]}];}_0x3faa67=_[_0x2ad3('0x45')]({},_0x3faa67,_0x28a274['options']);return db[_0x2ad3('0x2b')][_0x2ad3('0x46')](_0x3faa67)[_0x2ad3('0x25')](handleEntityNotFound(_0xff6d78,null))[_0x2ad3('0x25')](respondWithResult(_0xff6d78,null))[_0x2ad3('0x41')](handleError(_0xff6d78,null));};exports[_0x2ad3('0x47')]=function(_0x1f991b,_0x433e9c){return db[_0x2ad3('0x2b')][_0x2ad3('0x47')](_0x1f991b['body'],{})['then'](respondWithResult(_0x433e9c,0xc9))[_0x2ad3('0x41')](handleError(_0x433e9c,null));};exports[_0x2ad3('0x24')]=function(_0x3340d9,_0x481f3e){if(_0x3340d9[_0x2ad3('0x48')]['id']){delete _0x3340d9[_0x2ad3('0x48')]['id'];}return db[_0x2ad3('0x2b')]['find']({'where':{'id':_0x3340d9[_0x2ad3('0x42')]['id']}})[_0x2ad3('0x25')](handleEntityNotFound(_0x481f3e,null))[_0x2ad3('0x25')](saveUpdates(_0x3340d9[_0x2ad3('0x48')],null))[_0x2ad3('0x25')](respondWithResult(_0x481f3e,null))[_0x2ad3('0x41')](handleError(_0x481f3e,null));};exports[_0x2ad3('0x49')]=function(_0x5a4c42,_0x409806){return db[_0x2ad3('0x2b')][_0x2ad3('0x46')]({'where':{'id':_0x5a4c42[_0x2ad3('0x42')]['id']}})[_0x2ad3('0x25')](handleEntityNotFound(_0x409806,null))[_0x2ad3('0x25')](removeEntity(_0x409806,null))[_0x2ad3('0x41')](handleError(_0x409806,null));};exports[_0x2ad3('0x4a')]=function(_0x449fcf,_0x1172eb,_0x59264f){return db['Condition'][_0x2ad3('0x46')]({'where':{'id':_0x449fcf[_0x2ad3('0x42')]['id']}})[_0x2ad3('0x25')](handleEntityNotFound(_0x1172eb,null))[_0x2ad3('0x25')](function(_0x5af924){if(_0x5af924){return _0x5af924[_0x2ad3('0x4a')](_0x449fcf[_0x2ad3('0x48')][_0x2ad3('0x4b')],_['omit'](_0x449fcf[_0x2ad3('0x48')],['ids','id'])||{});}})[_0x2ad3('0x25')](respondWithResult(_0x1172eb,null))[_0x2ad3('0x41')](handleError(_0x1172eb,null));};exports[_0x2ad3('0x4c')]=function(_0x824da6,_0x26a14f,_0x15a6f9){var _0x412dc0={};var _0x247315={};var _0x1c0857;var _0x3d407e;return db[_0x2ad3('0x2b')][_0x2ad3('0x4d')]({'where':{'id':_0x824da6[_0x2ad3('0x42')]['id']}})[_0x2ad3('0x25')](handleEntityNotFound(_0x26a14f,null))[_0x2ad3('0x25')](function(_0x28d6ec){if(_0x28d6ec){_0x1c0857=_0x28d6ec;_0x247315[_0x2ad3('0x30')]=_['keys'](db[_0x2ad3('0x4e')][_0x2ad3('0x2c')]);_0x247315[_0x2ad3('0x32')]=_[_0x2ad3('0x33')](_0x824da6[_0x2ad3('0x32')]);_0x247315['filters']=_[_0x2ad3('0x35')](_0x247315['model'],_0x247315[_0x2ad3('0x32')]);_0x412dc0[_0x2ad3('0x34')]=_[_0x2ad3('0x35')](_0x247315[_0x2ad3('0x30')],qs[_0x2ad3('0x36')](_0x824da6[_0x2ad3('0x32')][_0x2ad3('0x36')]));_0x412dc0[_0x2ad3('0x34')]=_0x412dc0['attributes'][_0x2ad3('0x37')]?_0x412dc0[_0x2ad3('0x34')]:_0x247315[_0x2ad3('0x30')];_0x412dc0[_0x2ad3('0x4f')]=qs[_0x2ad3('0x3a')](_0x824da6[_0x2ad3('0x32')][_0x2ad3('0x3a')]);_0x412dc0[_0x2ad3('0x3b')]=qs[_0x2ad3('0x3c')](_[_0x2ad3('0x50')](_0x824da6[_0x2ad3('0x32')],_0x247315[_0x2ad3('0x3c')]));if(_0x824da6[_0x2ad3('0x32')][_0x2ad3('0x3d')]){_0x412dc0[_0x2ad3('0x3b')]=_[_0x2ad3('0x45')](_0x412dc0['where'],{'$or':_['map'](_0x412dc0[_0x2ad3('0x34')],function(_0x4765bc){var _0x488864={};_0x488864[_0x4765bc]={'$like':'%'+_0x824da6[_0x2ad3('0x32')]['filter']+'%'};return _0x488864;})});}_0x412dc0=_[_0x2ad3('0x45')]({},_0x412dc0,_0x824da6['options']);return _0x1c0857['getConditions'](_0x412dc0);}})[_0x2ad3('0x25')](function(_0x491210){if(_0x491210){_0x3d407e=_0x491210[_0x2ad3('0x37')];if(!_0x824da6[_0x2ad3('0x32')]['hasOwnProperty'](_0x2ad3('0x39'))){_0x412dc0[_0x2ad3('0x20')]=qs['limit'](_0x824da6[_0x2ad3('0x32')]['limit']);_0x412dc0['offset']=qs[_0x2ad3('0x1d')](_0x824da6[_0x2ad3('0x32')][_0x2ad3('0x1d')]);}return _0x1c0857[_0x2ad3('0x4c')](_0x412dc0);}})['then'](function(_0xd3dafd){if(_0xd3dafd){return _0xd3dafd?{'count':_0x3d407e,'rows':_0xd3dafd}:null;}})[_0x2ad3('0x25')](respondWithResult(_0x26a14f,null))[_0x2ad3('0x41')](handleError(_0x26a14f,null));};exports[_0x2ad3('0x51')]=function(_0x3d3fe7,_0x4ee731,_0x21fbb3){return db[_0x2ad3('0x52')][_0x2ad3('0x46')]({'where':{'id':_0x3d3fe7[_0x2ad3('0x42')]['id']}})[_0x2ad3('0x25')](handleEntityNotFound(_0x4ee731,null))[_0x2ad3('0x25')](function(_0x19f489){if(_0x19f489){return _0x19f489[_0x2ad3('0x51')](_0x3d3fe7[_0x2ad3('0x48')][_0x2ad3('0x4b')],_[_0x2ad3('0x53')](_0x3d3fe7[_0x2ad3('0x48')],[_0x2ad3('0x4b'),'id'])||{});}})[_0x2ad3('0x25')](respondWithResult(_0x4ee731,null))[_0x2ad3('0x41')](handleError(_0x4ee731,null));};exports[_0x2ad3('0x54')]=function(_0x5705da,_0xb1f8bd,_0x49ebd4){var _0x2dc775={};var _0x3f9c64={};var _0x58764e;var _0x30eb91;return db[_0x2ad3('0x2b')][_0x2ad3('0x4d')]({'where':{'id':_0x5705da[_0x2ad3('0x42')]['id']}})['then'](handleEntityNotFound(_0xb1f8bd,null))[_0x2ad3('0x25')](function(_0x5d1ac9){if(_0x5d1ac9){_0x58764e=_0x5d1ac9;_0x3f9c64[_0x2ad3('0x30')]=_[_0x2ad3('0x33')](db[_0x2ad3('0x52')][_0x2ad3('0x2c')]);_0x3f9c64[_0x2ad3('0x32')]=_[_0x2ad3('0x33')](_0x5705da[_0x2ad3('0x32')]);_0x3f9c64[_0x2ad3('0x3c')]=_[_0x2ad3('0x35')](_0x3f9c64['model'],_0x3f9c64[_0x2ad3('0x32')]);_0x2dc775[_0x2ad3('0x34')]=_[_0x2ad3('0x35')](_0x3f9c64[_0x2ad3('0x30')],qs[_0x2ad3('0x36')](_0x5705da[_0x2ad3('0x32')][_0x2ad3('0x36')]));_0x2dc775[_0x2ad3('0x34')]=_0x2dc775[_0x2ad3('0x34')][_0x2ad3('0x37')]?_0x2dc775['attributes']:_0x3f9c64[_0x2ad3('0x30')];_0x2dc775[_0x2ad3('0x4f')]=qs['sort'](_0x5705da[_0x2ad3('0x32')][_0x2ad3('0x3a')]);_0x2dc775['where']=qs[_0x2ad3('0x3c')](_[_0x2ad3('0x50')](_0x5705da[_0x2ad3('0x32')],_0x3f9c64['filters']));if(_0x5705da['query']['filter']){_0x2dc775[_0x2ad3('0x3b')]=_[_0x2ad3('0x45')](_0x2dc775[_0x2ad3('0x3b')],{'$or':_[_0x2ad3('0x31')](_0x2dc775[_0x2ad3('0x34')],function(_0x27fb80){var _0x242c52={};_0x242c52[_0x27fb80]={'$like':'%'+_0x5705da['query'][_0x2ad3('0x3d')]+'%'};return _0x242c52;})});}_0x2dc775=_['merge']({},_0x2dc775,_0x5705da['options']);return _0x58764e[_0x2ad3('0x54')](_0x2dc775);}})[_0x2ad3('0x25')](function(_0xc4dbf3){if(_0xc4dbf3){_0x30eb91=_0xc4dbf3[_0x2ad3('0x37')];if(!_0x5705da[_0x2ad3('0x32')]['hasOwnProperty'](_0x2ad3('0x39'))){_0x2dc775[_0x2ad3('0x20')]=qs['limit'](_0x5705da[_0x2ad3('0x32')][_0x2ad3('0x20')]);_0x2dc775[_0x2ad3('0x1d')]=qs['offset'](_0x5705da[_0x2ad3('0x32')]['offset']);}return _0x58764e[_0x2ad3('0x54')](_0x2dc775);}})['then'](function(_0x4333e7){if(_0x4333e7){return _0x4333e7?{'count':_0x30eb91,'rows':_0x4333e7}:null;}})['then'](respondWithResult(_0xb1f8bd,null))['catch'](handleError(_0xb1f8bd,null));}; \ No newline at end of file +var _0xa284=['keys','filters','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','findAll','rows','show','attributes','includeAll','include','catch','create','body','find','destroy','params','addConditions','Condition','findOne','getConditions','addActions','Action','omit','ids','getActions','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','count','set','Content-Range','apply','reject','save','then','name','Automation','rawAttributes','fieldName','type','model','map','query'];(function(_0x533bf7,_0x29485b){var _0x9e4c57=function(_0xe4211f){while(--_0xe4211f){_0x533bf7['push'](_0x533bf7['shift']());}};_0x9e4c57(++_0x29485b);}(_0xa284,0x1aa));var _0x4a28=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xa284[_0x57b54c];return _0x59cc19;};'use strict';var emlformat=require(_0x4a28('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4a28('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4a28('0x2'));var moment=require(_0x4a28('0x3'));var BPromise=require(_0x4a28('0x4'));var Mustache=require(_0x4a28('0x5'));var util=require('util');var path=require(_0x4a28('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4a28('0x7'));var _=require(_0x4a28('0x8'));var squel=require(_0x4a28('0x9'));var crypto=require(_0x4a28('0xa'));var jsforce=require(_0x4a28('0xb'));var deskjs=require(_0x4a28('0xc'));var toCsv=require(_0x4a28('0xd'));var querystring=require(_0x4a28('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4a28('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x4a28('0x10'));var hardwareService=require(_0x4a28('0x11'));var logger=require(_0x4a28('0x12'))('api');var utils=require(_0x4a28('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x4a28('0x14'));var db=require(_0x4a28('0x15'))['db'];function respondWithStatusCode(_0xefb677,_0x7890b1){_0x7890b1=_0x7890b1||0xcc;return function(_0x2f6e20){if(_0x2f6e20){return _0xefb677[_0x4a28('0x16')](_0x7890b1);}return _0xefb677[_0x4a28('0x17')](_0x7890b1)['end']();};}function respondWithResult(_0x2536ee,_0x3146a1){_0x3146a1=_0x3146a1||0xc8;return function(_0x521577){if(_0x521577){return _0x2536ee[_0x4a28('0x17')](_0x3146a1)[_0x4a28('0x18')](_0x521577);}};}function respondWithFilteredResult(_0x119e6f,_0x5e08c2){return function(_0x49bf17){if(_0x49bf17){var _0x565c73=typeof _0x5e08c2[_0x4a28('0x19')]==='undefined'&&typeof _0x5e08c2[_0x4a28('0x1a')]==='undefined';var _0x5a3c64=_0x49bf17[_0x4a28('0x1b')];var _0x21d43d=_0x565c73?0x0:_0x5e08c2[_0x4a28('0x19')];var _0x3c4202=_0x565c73?_0x49bf17[_0x4a28('0x1b')]:_0x5e08c2[_0x4a28('0x19')]+_0x5e08c2['limit'];var _0x15e8f2;if(_0x3c4202>=_0x5a3c64){_0x3c4202=_0x5a3c64;_0x15e8f2=0xc8;}else{_0x15e8f2=0xce;}_0x119e6f['status'](_0x15e8f2);return _0x119e6f[_0x4a28('0x1c')](_0x4a28('0x1d'),_0x21d43d+'-'+_0x3c4202+'/'+_0x5a3c64)[_0x4a28('0x18')](_0x49bf17);}return null;};}function patchUpdates(_0x461ac2){return function(_0x49a3e4){try{jsonpatch[_0x4a28('0x1e')](_0x49a3e4,_0x461ac2,!![]);}catch(_0x4bf531){return BPromise[_0x4a28('0x1f')](_0x4bf531);}return _0x49a3e4[_0x4a28('0x20')]();};}function saveUpdates(_0x52316b,_0x1151a5){return function(_0x464174){if(_0x464174){return _0x464174['update'](_0x52316b)[_0x4a28('0x21')](function(_0x5dfd6b){return _0x5dfd6b;});}return null;};}function removeEntity(_0x4f62b4,_0x4c3ce6){return function(_0x47bcfd){if(_0x47bcfd){return _0x47bcfd['destroy']()[_0x4a28('0x21')](function(){_0x4f62b4[_0x4a28('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4cd2e2,_0x42b43b){return function(_0x58b300){if(!_0x58b300){_0x4cd2e2['sendStatus'](0x194);}return _0x58b300;};}function handleError(_0x565850,_0x58509c){_0x58509c=_0x58509c||0x1f4;return function(_0x186ba6){logger['error'](_0x186ba6['stack']);if(_0x186ba6[_0x4a28('0x22')]){delete _0x186ba6[_0x4a28('0x22')];}_0x565850[_0x4a28('0x17')](_0x58509c)['send'](_0x186ba6);};}exports['index']=function(_0x4b3343,_0x5d048e){var _0x21fbd4={},_0x14a9d2={},_0x3996ae={'count':0x0,'rows':[]};var _0x4a10c9=_['map'](db[_0x4a28('0x23')][_0x4a28('0x24')],function(_0x265f13){return{'name':_0x265f13[_0x4a28('0x25')],'type':_0x265f13[_0x4a28('0x26')]['key']};});_0x14a9d2[_0x4a28('0x27')]=_[_0x4a28('0x28')](_0x4a10c9,_0x4a28('0x22'));_0x14a9d2[_0x4a28('0x29')]=_[_0x4a28('0x2a')](_0x4b3343['query']);_0x14a9d2[_0x4a28('0x2b')]=_[_0x4a28('0x2c')](_0x14a9d2[_0x4a28('0x27')],_0x14a9d2[_0x4a28('0x29')]);_0x21fbd4['attributes']=_[_0x4a28('0x2c')](_0x14a9d2[_0x4a28('0x27')],qs[_0x4a28('0x2d')](_0x4b3343[_0x4a28('0x29')]['fields']));_0x21fbd4['attributes']=_0x21fbd4['attributes'][_0x4a28('0x2e')]?_0x21fbd4['attributes']:_0x14a9d2['model'];if(!_0x4b3343[_0x4a28('0x29')][_0x4a28('0x2f')](_0x4a28('0x30'))){_0x21fbd4[_0x4a28('0x1a')]=qs[_0x4a28('0x1a')](_0x4b3343[_0x4a28('0x29')][_0x4a28('0x1a')]);_0x21fbd4[_0x4a28('0x19')]=qs['offset'](_0x4b3343[_0x4a28('0x29')]['offset']);}_0x21fbd4[_0x4a28('0x31')]=qs['sort'](_0x4b3343[_0x4a28('0x29')][_0x4a28('0x32')]);_0x21fbd4['where']=qs[_0x4a28('0x2b')](_[_0x4a28('0x33')](_0x4b3343[_0x4a28('0x29')],_0x14a9d2[_0x4a28('0x2b')]),_0x4a10c9);if(_0x4b3343[_0x4a28('0x29')]['filter']){_0x21fbd4[_0x4a28('0x34')]=_[_0x4a28('0x35')](_0x21fbd4[_0x4a28('0x34')],{'$or':_['map'](_0x4a10c9,function(_0x2a6470){if(_0x2a6470[_0x4a28('0x26')]!==_0x4a28('0x36')){var _0x557aac={};_0x557aac[_0x2a6470['name']]={'$like':'%'+_0x4b3343[_0x4a28('0x29')][_0x4a28('0x37')]+'%'};return _0x557aac;}})});}_0x21fbd4=_['merge']({},_0x21fbd4,_0x4b3343[_0x4a28('0x38')]);var _0x4bab17={'where':_0x21fbd4[_0x4a28('0x34')]};return db[_0x4a28('0x23')][_0x4a28('0x1b')](_0x4bab17)['then'](function(_0x1d0fea){_0x3996ae['count']=_0x1d0fea;if(_0x4b3343[_0x4a28('0x29')]['includeAll']){_0x21fbd4['include']=[{'all':!![]}];}return db[_0x4a28('0x23')][_0x4a28('0x39')](_0x21fbd4);})[_0x4a28('0x21')](function(_0x3dde9d){_0x3996ae[_0x4a28('0x3a')]=_0x3dde9d;return _0x3996ae;})[_0x4a28('0x21')](respondWithFilteredResult(_0x5d048e,_0x21fbd4))['catch'](handleError(_0x5d048e,null));};exports[_0x4a28('0x3b')]=function(_0x57beb0,_0x25f0a5){var _0x185559={'raw':![],'where':{'id':_0x57beb0['params']['id']}},_0x2c8c4f={};_0x2c8c4f['model']=_[_0x4a28('0x2a')](db[_0x4a28('0x23')][_0x4a28('0x24')]);_0x2c8c4f[_0x4a28('0x29')]=_[_0x4a28('0x2a')](_0x57beb0[_0x4a28('0x29')]);_0x2c8c4f[_0x4a28('0x2b')]=_[_0x4a28('0x2c')](_0x2c8c4f['model'],_0x2c8c4f['query']);_0x185559[_0x4a28('0x3c')]=_[_0x4a28('0x2c')](_0x2c8c4f[_0x4a28('0x27')],qs['fields'](_0x57beb0[_0x4a28('0x29')][_0x4a28('0x2d')]));_0x185559[_0x4a28('0x3c')]=_0x185559[_0x4a28('0x3c')][_0x4a28('0x2e')]?_0x185559['attributes']:_0x2c8c4f[_0x4a28('0x27')];if(_0x57beb0[_0x4a28('0x29')][_0x4a28('0x3d')]){_0x185559[_0x4a28('0x3e')]=[{'all':!![]}];}_0x185559=_[_0x4a28('0x35')]({},_0x185559,_0x57beb0[_0x4a28('0x38')]);return db[_0x4a28('0x23')]['find'](_0x185559)['then'](handleEntityNotFound(_0x25f0a5,null))[_0x4a28('0x21')](respondWithResult(_0x25f0a5,null))[_0x4a28('0x3f')](handleError(_0x25f0a5,null));};exports[_0x4a28('0x40')]=function(_0x49a791,_0x549a80){return db[_0x4a28('0x23')][_0x4a28('0x40')](_0x49a791[_0x4a28('0x41')],{})[_0x4a28('0x21')](respondWithResult(_0x549a80,0xc9))['catch'](handleError(_0x549a80,null));};exports['update']=function(_0x43ff45,_0x199ddd){if(_0x43ff45[_0x4a28('0x41')]['id']){delete _0x43ff45['body']['id'];}return db[_0x4a28('0x23')][_0x4a28('0x42')]({'where':{'id':_0x43ff45['params']['id']}})[_0x4a28('0x21')](handleEntityNotFound(_0x199ddd,null))[_0x4a28('0x21')](saveUpdates(_0x43ff45[_0x4a28('0x41')],null))[_0x4a28('0x21')](respondWithResult(_0x199ddd,null))[_0x4a28('0x3f')](handleError(_0x199ddd,null));};exports[_0x4a28('0x43')]=function(_0x14fcea,_0x5570f1){return db[_0x4a28('0x23')]['find']({'where':{'id':_0x14fcea[_0x4a28('0x44')]['id']}})['then'](handleEntityNotFound(_0x5570f1,null))[_0x4a28('0x21')](removeEntity(_0x5570f1,null))[_0x4a28('0x3f')](handleError(_0x5570f1,null));};exports[_0x4a28('0x45')]=function(_0x232546,_0x318318,_0x2ae3cc){return db[_0x4a28('0x46')][_0x4a28('0x42')]({'where':{'id':_0x232546[_0x4a28('0x44')]['id']}})[_0x4a28('0x21')](handleEntityNotFound(_0x318318,null))[_0x4a28('0x21')](function(_0x856a70){if(_0x856a70){return _0x856a70[_0x4a28('0x45')](_0x232546[_0x4a28('0x41')]['ids'],_['omit'](_0x232546['body'],['ids','id'])||{});}})[_0x4a28('0x21')](respondWithResult(_0x318318,null))[_0x4a28('0x3f')](handleError(_0x318318,null));};exports['getConditions']=function(_0x202e3a,_0x4987f9,_0x35cafc){var _0x182699={};var _0x340778={};var _0x45f520;var _0x37eee3;return db[_0x4a28('0x23')][_0x4a28('0x47')]({'where':{'id':_0x202e3a['params']['id']}})[_0x4a28('0x21')](handleEntityNotFound(_0x4987f9,null))['then'](function(_0x2699ce){if(_0x2699ce){_0x45f520=_0x2699ce;_0x340778['model']=_['keys'](db[_0x4a28('0x46')][_0x4a28('0x24')]);_0x340778[_0x4a28('0x29')]=_['keys'](_0x202e3a[_0x4a28('0x29')]);_0x340778[_0x4a28('0x2b')]=_[_0x4a28('0x2c')](_0x340778[_0x4a28('0x27')],_0x340778[_0x4a28('0x29')]);_0x182699[_0x4a28('0x3c')]=_[_0x4a28('0x2c')](_0x340778[_0x4a28('0x27')],qs[_0x4a28('0x2d')](_0x202e3a[_0x4a28('0x29')][_0x4a28('0x2d')]));_0x182699[_0x4a28('0x3c')]=_0x182699[_0x4a28('0x3c')][_0x4a28('0x2e')]?_0x182699[_0x4a28('0x3c')]:_0x340778[_0x4a28('0x27')];_0x182699['order']=qs[_0x4a28('0x32')](_0x202e3a[_0x4a28('0x29')]['sort']);_0x182699[_0x4a28('0x34')]=qs[_0x4a28('0x2b')](_[_0x4a28('0x33')](_0x202e3a[_0x4a28('0x29')],_0x340778[_0x4a28('0x2b')]));if(_0x202e3a[_0x4a28('0x29')][_0x4a28('0x37')]){_0x182699[_0x4a28('0x34')]=_['merge'](_0x182699['where'],{'$or':_['map'](_0x182699[_0x4a28('0x3c')],function(_0x589d95){var _0xdc2a77={};_0xdc2a77[_0x589d95]={'$like':'%'+_0x202e3a[_0x4a28('0x29')][_0x4a28('0x37')]+'%'};return _0xdc2a77;})});}_0x182699=_[_0x4a28('0x35')]({},_0x182699,_0x202e3a[_0x4a28('0x38')]);return _0x45f520['getConditions'](_0x182699);}})[_0x4a28('0x21')](function(_0x4b1b9b){if(_0x4b1b9b){_0x37eee3=_0x4b1b9b[_0x4a28('0x2e')];if(!_0x202e3a[_0x4a28('0x29')][_0x4a28('0x2f')]('nolimit')){_0x182699[_0x4a28('0x1a')]=qs['limit'](_0x202e3a[_0x4a28('0x29')]['limit']);_0x182699[_0x4a28('0x19')]=qs[_0x4a28('0x19')](_0x202e3a[_0x4a28('0x29')][_0x4a28('0x19')]);}return _0x45f520[_0x4a28('0x48')](_0x182699);}})[_0x4a28('0x21')](function(_0x2f0919){if(_0x2f0919){return _0x2f0919?{'count':_0x37eee3,'rows':_0x2f0919}:null;}})['then'](respondWithResult(_0x4987f9,null))[_0x4a28('0x3f')](handleError(_0x4987f9,null));};exports[_0x4a28('0x49')]=function(_0x31189a,_0x3bd8f2,_0x5474c5){return db[_0x4a28('0x4a')]['find']({'where':{'id':_0x31189a[_0x4a28('0x44')]['id']}})['then'](handleEntityNotFound(_0x3bd8f2,null))[_0x4a28('0x21')](function(_0x3ae4ae){if(_0x3ae4ae){return _0x3ae4ae['addActions'](_0x31189a[_0x4a28('0x41')]['ids'],_[_0x4a28('0x4b')](_0x31189a[_0x4a28('0x41')],[_0x4a28('0x4c'),'id'])||{});}})[_0x4a28('0x21')](respondWithResult(_0x3bd8f2,null))[_0x4a28('0x3f')](handleError(_0x3bd8f2,null));};exports['getActions']=function(_0x463481,_0x5403fd,_0x5d9065){var _0x5e2e29={};var _0x8b873d={};var _0x4a6d1f;var _0x5bcaa2;return db['Automation'][_0x4a28('0x47')]({'where':{'id':_0x463481[_0x4a28('0x44')]['id']}})[_0x4a28('0x21')](handleEntityNotFound(_0x5403fd,null))['then'](function(_0x8cce3){if(_0x8cce3){_0x4a6d1f=_0x8cce3;_0x8b873d[_0x4a28('0x27')]=_['keys'](db[_0x4a28('0x4a')]['rawAttributes']);_0x8b873d[_0x4a28('0x29')]=_[_0x4a28('0x2a')](_0x463481['query']);_0x8b873d['filters']=_[_0x4a28('0x2c')](_0x8b873d[_0x4a28('0x27')],_0x8b873d[_0x4a28('0x29')]);_0x5e2e29[_0x4a28('0x3c')]=_[_0x4a28('0x2c')](_0x8b873d[_0x4a28('0x27')],qs[_0x4a28('0x2d')](_0x463481[_0x4a28('0x29')]['fields']));_0x5e2e29[_0x4a28('0x3c')]=_0x5e2e29[_0x4a28('0x3c')][_0x4a28('0x2e')]?_0x5e2e29[_0x4a28('0x3c')]:_0x8b873d[_0x4a28('0x27')];_0x5e2e29[_0x4a28('0x31')]=qs[_0x4a28('0x32')](_0x463481[_0x4a28('0x29')][_0x4a28('0x32')]);_0x5e2e29['where']=qs[_0x4a28('0x2b')](_['pick'](_0x463481[_0x4a28('0x29')],_0x8b873d['filters']));if(_0x463481['query']['filter']){_0x5e2e29[_0x4a28('0x34')]=_[_0x4a28('0x35')](_0x5e2e29[_0x4a28('0x34')],{'$or':_[_0x4a28('0x28')](_0x5e2e29['attributes'],function(_0x28b617){var _0xa686e7={};_0xa686e7[_0x28b617]={'$like':'%'+_0x463481['query'][_0x4a28('0x37')]+'%'};return _0xa686e7;})});}_0x5e2e29=_[_0x4a28('0x35')]({},_0x5e2e29,_0x463481[_0x4a28('0x38')]);return _0x4a6d1f[_0x4a28('0x4d')](_0x5e2e29);}})[_0x4a28('0x21')](function(_0x5e6098){if(_0x5e6098){_0x5bcaa2=_0x5e6098[_0x4a28('0x2e')];if(!_0x463481[_0x4a28('0x29')][_0x4a28('0x2f')](_0x4a28('0x30'))){_0x5e2e29[_0x4a28('0x1a')]=qs[_0x4a28('0x1a')](_0x463481[_0x4a28('0x29')][_0x4a28('0x1a')]);_0x5e2e29[_0x4a28('0x19')]=qs[_0x4a28('0x19')](_0x463481[_0x4a28('0x29')][_0x4a28('0x19')]);}return _0x4a6d1f['getActions'](_0x5e2e29);}})[_0x4a28('0x21')](function(_0x33a709){if(_0x33a709){return _0x33a709?{'count':_0x5bcaa2,'rows':_0x33a709}:null;}})[_0x4a28('0x21')](respondWithResult(_0x5403fd,null))['catch'](handleError(_0x5403fd,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 8fb5290..d806a62 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 _0x6db8=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./automation.attributes','exports','define','Automation','tools_automations'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x6db8,0x1ba));var _0x86db=function(_0x819464,_0x46fc91){_0x819464=_0x819464-0x0;var _0x49dcc0=_0x6db8[_0x819464];return _0x49dcc0;};'use strict';var _=require(_0x86db('0x0'));var util=require(_0x86db('0x1'));var logger=require(_0x86db('0x2'))(_0x86db('0x3'));var moment=require(_0x86db('0x4'));var BPromise=require('bluebird');var rp=require(_0x86db('0x5'));var fs=require('fs');var path=require(_0x86db('0x6'));var rimraf=require(_0x86db('0x7'));var config=require('../../config/environment');var attributes=require(_0x86db('0x8'));module[_0x86db('0x9')]=function(_0x32e7ad,_0x5f429b){return _0x32e7ad[_0x86db('0xa')](_0x86db('0xb'),attributes,{'tableName':_0x86db('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd0a1=['tools_automations','lodash','api','moment','request-promise','path','../../config/environment','./automation.attributes','exports','define','Automation'];(function(_0x2ee303,_0xa14f94){var _0x3a4e1b=function(_0x158607){while(--_0x158607){_0x2ee303['push'](_0x2ee303['shift']());}};_0x3a4e1b(++_0xa14f94);}(_0xd0a1,0x109));var _0x1d0a=function(_0x3d5416,_0x28a599){_0x3d5416=_0x3d5416-0x0;var _0x17712c=_0xd0a1[_0x3d5416];return _0x17712c;};'use strict';var _=require(_0x1d0a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1d0a('0x1'));var moment=require(_0x1d0a('0x2'));var BPromise=require('bluebird');var rp=require(_0x1d0a('0x3'));var fs=require('fs');var path=require(_0x1d0a('0x4'));var rimraf=require('rimraf');var config=require(_0x1d0a('0x5'));var attributes=require(_0x1d0a('0x6'));module[_0x1d0a('0x7')]=function(_0x316996,_0x268935){return _0x316996[_0x1d0a('0x8')](_0x1d0a('0x9'),attributes,{'tableName':_0x1d0a('0xa'),'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 a1f74d5..f84ad72 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 _0x4888=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x182ae,_0x42fc8d){var _0x1be768=function(_0x202bb5){while(--_0x202bb5){_0x182ae['push'](_0x182ae['shift']());}};_0x1be768(++_0x42fc8d);}(_0x4888,0x198));var _0x8488=function(_0x374ada,_0x27b3a5){_0x374ada=_0x374ada-0x0;var _0x449ed8=_0x4888[_0x374ada];return _0x449ed8;};'use strict';var _=require('lodash');var util=require(_0x8488('0x0'));var moment=require(_0x8488('0x1'));var BPromise=require(_0x8488('0x2'));var rs=require(_0x8488('0x3'));var fs=require('fs');var Redis=require(_0x8488('0x4'));var db=require(_0x8488('0x5'))['db'];var utils=require(_0x8488('0x6'));var logger=require('../../config/logger')(_0x8488('0x7'));var config=require(_0x8488('0x8'));var jayson=require(_0x8488('0x9'));var client=jayson[_0x8488('0xa')][_0x8488('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x19e508,_0x5250a1,_0x5b30a7){return new BPromise(function(_0x56aad0,_0x568a82){return client[_0x8488('0xc')](_0x19e508,_0x5b30a7)[_0x8488('0xd')](function(_0x542bd8){logger[_0x8488('0xe')](_0x8488('0xf'),_0x5250a1,_0x8488('0x10'));logger[_0x8488('0x11')]('Automation,\x20%s,\x20%s,\x20%s',_0x5250a1,_0x8488('0x10'),JSON[_0x8488('0x12')](_0x542bd8));if(_0x542bd8[_0x8488('0x13')]){if(_0x542bd8[_0x8488('0x13')][_0x8488('0x14')]===0x1f4){logger['error'](_0x8488('0xf'),_0x5250a1,_0x542bd8[_0x8488('0x13')]['message']);return _0x568a82(_0x542bd8['error'][_0x8488('0x15')]);}logger['error'](_0x8488('0xf'),_0x5250a1,_0x542bd8['error']['message']);return _0x56aad0(_0x542bd8[_0x8488('0x13')][_0x8488('0x15')]);}else{logger[_0x8488('0xe')](_0x8488('0xf'),_0x5250a1,_0x8488('0x10'));_0x56aad0(_0x542bd8[_0x8488('0x16')][_0x8488('0x15')]);}})['catch'](function(_0x3dad45){logger[_0x8488('0x13')](_0x8488('0xf'),_0x5250a1,_0x3dad45);_0x568a82(_0x3dad45);});});} \ No newline at end of file +var _0x7524=['../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Automation,\x20%s,\x20%s','debug','Automation,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','randomstring','ioredis'];(function(_0x4cadfd,_0x889708){var _0x4985f6=function(_0x518760){while(--_0x518760){_0x4cadfd['push'](_0x4cadfd['shift']());}};_0x4985f6(++_0x889708);}(_0x7524,0xce));var _0x4752=function(_0x1a5770,_0x5d5983){_0x1a5770=_0x1a5770-0x0;var _0x59ccdf=_0x7524[_0x1a5770];return _0x59ccdf;};'use strict';var _=require('lodash');var util=require(_0x4752('0x0'));var moment=require(_0x4752('0x1'));var BPromise=require('bluebird');var rs=require(_0x4752('0x2'));var fs=require('fs');var Redis=require(_0x4752('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4752('0x4'))('rpc');var config=require(_0x4752('0x5'));var jayson=require(_0x4752('0x6'));var client=jayson[_0x4752('0x7')][_0x4752('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x104962,_0x5b98c0,_0x1e76cf){return new BPromise(function(_0x1cbf34,_0x59477c){return client['request'](_0x104962,_0x1e76cf)[_0x4752('0x9')](function(_0x45e0ff){logger[_0x4752('0xa')](_0x4752('0xb'),_0x5b98c0,'request\x20sent');logger[_0x4752('0xc')](_0x4752('0xd'),_0x5b98c0,_0x4752('0xe'),JSON[_0x4752('0xf')](_0x45e0ff));if(_0x45e0ff[_0x4752('0x10')]){if(_0x45e0ff['error'][_0x4752('0x11')]===0x1f4){logger[_0x4752('0x10')](_0x4752('0xb'),_0x5b98c0,_0x45e0ff[_0x4752('0x10')][_0x4752('0x12')]);return _0x59477c(_0x45e0ff[_0x4752('0x10')][_0x4752('0x12')]);}logger['error'](_0x4752('0xb'),_0x5b98c0,_0x45e0ff['error'][_0x4752('0x12')]);return _0x1cbf34(_0x45e0ff[_0x4752('0x10')][_0x4752('0x12')]);}else{logger[_0x4752('0xa')](_0x4752('0xb'),_0x5b98c0,_0x4752('0xe'));_0x1cbf34(_0x45e0ff[_0x4752('0x13')]['message']);}})[_0x4752('0x14')](function(_0x1dad7c){logger['error'](_0x4752('0xb'),_0x5b98c0,_0x1dad7c);_0x59477c(_0x1dad7c);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 461d47e..d0f11bb 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 _0x0c29=['get','isAuthenticated','index','/:id','show','/:id/conditions','getConditions','/:id/actions','getActions','post','create','addActions','put','delete','destroy','path','express','Router','fs-extra','../../config/environment','./automation.controller'];(function(_0x642554,_0x152591){var _0x494c54=function(_0x314773){while(--_0x314773){_0x642554['push'](_0x642554['shift']());}};_0x494c54(++_0x152591);}(_0x0c29,0xb7));var _0x90c2=function(_0x368bba,_0x1f625b){_0x368bba=_0x368bba-0x0;var _0x409f8f=_0x0c29[_0x368bba];return _0x409f8f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x90c2('0x0'));var timeout=require('connect-timeout');var express=require(_0x90c2('0x1'));var router=express[_0x90c2('0x2')]();var fs_extra=require(_0x90c2('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x90c2('0x4'));var controller=require(_0x90c2('0x5'));router[_0x90c2('0x6')]('/',auth[_0x90c2('0x7')](),controller[_0x90c2('0x8')]);router[_0x90c2('0x6')](_0x90c2('0x9'),auth[_0x90c2('0x7')](),controller[_0x90c2('0xa')]);router[_0x90c2('0x6')](_0x90c2('0xb'),auth[_0x90c2('0x7')](),controller[_0x90c2('0xc')]);router[_0x90c2('0x6')](_0x90c2('0xd'),auth[_0x90c2('0x7')](),controller[_0x90c2('0xe')]);router[_0x90c2('0xf')]('/',auth[_0x90c2('0x7')](),controller[_0x90c2('0x10')]);router['post'](_0x90c2('0xb'),auth[_0x90c2('0x7')](),controller['addConditions']);router[_0x90c2('0xf')](_0x90c2('0xd'),auth[_0x90c2('0x7')](),controller[_0x90c2('0x11')]);router[_0x90c2('0x12')](_0x90c2('0x9'),auth[_0x90c2('0x7')](),controller['update']);router[_0x90c2('0x13')](_0x90c2('0x9'),auth[_0x90c2('0x7')](),controller[_0x90c2('0x14')]);module['exports']=router; \ No newline at end of file +var _0x49c4=['../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/conditions','getConditions','/:id/actions','getActions','create','post','addActions','update','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0xe7895e,_0xc15331){var _0x387475=function(_0x247fc4){while(--_0x247fc4){_0xe7895e['push'](_0xe7895e['shift']());}};_0x387475(++_0xc15331);}(_0x49c4,0x9b));var _0x449c=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x49c4[_0x3511d3];return _0x5d6321;};'use strict';var multer=require(_0x449c('0x0'));var util=require('util');var path=require(_0x449c('0x1'));var timeout=require(_0x449c('0x2'));var express=require(_0x449c('0x3'));var router=express[_0x449c('0x4')]();var fs_extra=require(_0x449c('0x5'));var auth=require(_0x449c('0x6'));var interaction=require(_0x449c('0x7'));var config=require('../../config/environment');var controller=require('./automation.controller');router[_0x449c('0x8')]('/',auth[_0x449c('0x9')](),controller[_0x449c('0xa')]);router[_0x449c('0x8')](_0x449c('0xb'),auth[_0x449c('0x9')](),controller[_0x449c('0xc')]);router[_0x449c('0x8')](_0x449c('0xd'),auth[_0x449c('0x9')](),controller[_0x449c('0xe')]);router[_0x449c('0x8')](_0x449c('0xf'),auth[_0x449c('0x9')](),controller[_0x449c('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x449c('0x11')]);router[_0x449c('0x12')]('/:id/conditions',auth['isAuthenticated'](),controller['addConditions']);router[_0x449c('0x12')](_0x449c('0xf'),auth[_0x449c('0x9')](),controller[_0x449c('0x13')]);router['put'](_0x449c('0xb'),auth['isAuthenticated'](),controller[_0x449c('0x14')]);router['delete'](_0x449c('0xb'),auth[_0x449c('0x9')](),controller[_0x449c('0x15')]);module[_0x449c('0x16')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index feb0850..701b982 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 _0x66e5=['AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','name','ivr','STRING','BOOLEAN','Active/Disactive\x20Campaign','UNSIGNED','Max\x20200\x20calls.','INTEGER','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','ENUM','always','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','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)'];(function(_0x535db7,_0xa0271a){var _0x2a93fe=function(_0x584236){while(--_0x584236){_0x535db7['push'](_0x535db7['shift']());}};_0x2a93fe(++_0xa0271a);}(_0x66e5,0x1a1));var _0x566e=function(_0x2c3514,_0x5604d4){_0x2c3514=_0x2c3514-0x0;var _0x22ab07=_0x66e5[_0x2c3514];return _0x22ab07;};'use strict';var Sequelize=require(_0x566e('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x566e('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x566e('0x2')),'allowNull':![],'defaultValue':_0x566e('0x2')},'description':{'type':Sequelize[_0x566e('0x3')]},'active':{'type':Sequelize[_0x566e('0x4')],'defaultValue':0x0,'comment':_0x566e('0x5')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0x566e('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x566e('0x7')},'dialOriginateCallerIdName':{'type':Sequelize[_0x566e('0x3')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x566e('0x3')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x566e('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x566e('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x566e('0x9')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x566e('0x8')](0x5)[_0x566e('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x566e('0xa')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x566e('0xb')},'dialBusyRetryFrequency':{'type':Sequelize[_0x566e('0x8')](0x5)[_0x566e('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x566e('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x566e('0x8')](0x3)[_0x566e('0x6')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'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[_0x566e('0x8')](0x3)[_0x566e('0x6')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x566e('0x3')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x566e('0x3')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0x566e('0xd')](_0x566e('0xe'),'never',_0x566e('0xf')),'defaultValue':_0x566e('0xe')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x566e('0x10')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x566e('0x6')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x566e('0x11')},'dialAMDGreeting':{'type':Sequelize[_0x566e('0x8')](0x9)[_0x566e('0x6')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x566e('0x12')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x566e('0x8')](0x9)[_0x566e('0x6')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x566e('0x8')](0x9)[_0x566e('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x566e('0x13')},'dialAMDMinWordLength':{'type':Sequelize[_0x566e('0x8')](0x9)[_0x566e('0x6')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x566e('0x8')](0x9)[_0x566e('0x6')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x566e('0x14')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x566e('0x6')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x566e('0x15')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x566e('0x16')},'dialOrderByScheduledAt':{'type':Sequelize[_0x566e('0xd')](_0x566e('0x17'),_0x566e('0x18')),'defaultValue':_0x566e('0x17')},'dialPrefix':{'type':Sequelize[_0x566e('0x3')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x566e('0x8')](0x3)[_0x566e('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x566e('0x19')},'dialCutDigit':{'type':Sequelize[_0x566e('0x8')](0x3)[_0x566e('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x566e('0x8')](0x3)[_0x566e('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x566e('0x1a')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x566e('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x566e('0x8')](0x3)[_0x566e('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x566e('0x8')](0x5)[_0x566e('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x566e('0x1b')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x566e('0x8')](0x3)[_0x566e('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x566e('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x566e('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x566e('0x1c')},'dialMachineRetryFrequency':{'type':Sequelize[_0x566e('0x8')](0x5)[_0x566e('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x566e('0x1d')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x566e('0x8')](0x3)[_0x566e('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x566e('0x1e')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x566e('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x566e('0x1f')}}; \ No newline at end of file +var _0xf960=['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','STRING','ENUM','ivr','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\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','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)'];(function(_0x2d2bcb,_0x3051fc){var _0x303f0f=function(_0x3fd68f){while(--_0x3fd68f){_0x2d2bcb['push'](_0x2d2bcb['shift']());}};_0x303f0f(++_0x3051fc);}(_0xf960,0x193));var _0x0f96=function(_0x18e52b,_0x1fae35){_0x18e52b=_0x18e52b-0x0;var _0x3d3062=_0xf960[_0x18e52b];return _0x3d3062;};'use strict';var Sequelize=require(_0x0f96('0x0'));module['exports']={'name':{'type':Sequelize[_0x0f96('0x1')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x0f96('0x2')](_0x0f96('0x3')),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0x0f96('0x1')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0x0f96('0x4')](0x4)[_0x0f96('0x5')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x0f96('0x6')},'dialOriginateCallerIdName':{'type':Sequelize[_0x0f96('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x0f96('0x1')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0f96('0x7')},'dialCongestionMaxRetry':{'type':Sequelize[_0x0f96('0x4')](0x3)[_0x0f96('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0f96('0x8')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x0f96('0x4')](0x5)[_0x0f96('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x0f96('0x4')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0f96('0x9')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0f96('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0f96('0xa')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x0f96('0x4')](0x3)[_0x0f96('0x5')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x0f96('0x4')](0x5)[_0x0f96('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0f96('0xb')},'dialGlobalMaxRetry':{'type':Sequelize[_0x0f96('0x4')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x0f96('0xc')},'dialTimezone':{'type':Sequelize[_0x0f96('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x0f96('0x1')],'defaultValue':_0x0f96('0xd')},'dialCheckDuplicateType':{'type':Sequelize[_0x0f96('0x2')](_0x0f96('0xe'),'never',_0x0f96('0xf')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x0f96('0x10')},'dialAMDInitialSilence':{'type':Sequelize[_0x0f96('0x4')](0x9)[_0x0f96('0x5')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x0f96('0x11')},'dialAMDGreeting':{'type':Sequelize[_0x0f96('0x4')](0x9)[_0x0f96('0x5')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x0f96('0x12')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x0f96('0x4')](0x9)[_0x0f96('0x5')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x0f96('0x13')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x0f96('0x4')](0x9)[_0x0f96('0x5')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0f96('0x14')},'dialAMDMinWordLength':{'type':Sequelize[_0x0f96('0x4')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x0f96('0x15')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x0f96('0x4')](0x9)[_0x0f96('0x5')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x0f96('0x16')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x0f96('0x5')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x0f96('0x17')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x0f96('0x4')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x0f96('0x18')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x0f96('0x4')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0f96('0x19')},'dialOrderByScheduledAt':{'type':Sequelize[_0x0f96('0x2')](_0x0f96('0x1a'),_0x0f96('0x1b')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0x0f96('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x0f96('0x4')](0x3)[_0x0f96('0x5')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0f96('0x1c')},'dialCutDigit':{'type':Sequelize[_0x0f96('0x4')](0x3)[_0x0f96('0x5')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0f96('0x1d')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0f96('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0f96('0x1e')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x0f96('0x4')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0f96('0x1f')},'dialDropMaxRetry':{'type':Sequelize[_0x0f96('0x4')](0x3)[_0x0f96('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0f96('0x20')},'dialDropRetryFrequency':{'type':Sequelize[_0x0f96('0x4')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0f96('0x21')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x0f96('0x4')](0x3)[_0x0f96('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0f96('0x22')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x0f96('0x4')](0x5)[_0x0f96('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0f96('0x23')},'dialMachineMaxRetry':{'type':Sequelize[_0x0f96('0x4')](0x3)[_0x0f96('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0f96('0x24')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0f96('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0f96('0x25')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0f96('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0f96('0x26')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0f96('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0f96('0x27')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 9c145e5..c8ac3d8 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 _0xb2ca=['api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','IvrCampaigns','UserProfileResource','error','stack','name','send','index','Campaign','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','rawAttributes','length','create','user','role','get','UserProfileSection','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','getHoppers','findOne','CmHopper','nolimit','order','CampaignId','getHopperHistories','CmHopperHistory','CmHopperBlack','getLists','format','addLists','ids','spread','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','field','NOW()','CmListId','toString','from','cm_contacts','phone\x20NOT\x20IN\x20(?)','select','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','onlyIfOpen','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','COALESCE(phone,\x27\x27)','phone\x20IS\x20NOT\x20NULL','OrderBy','h.id','ci.item','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','push','sequelize','all','removeLists','getBlackLists','CmList','addBlackLists','YYYY-MM-DD\x20HH:mm:ss','cm_hopper_black','removeBlackLists','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb2ca,0x1a8));var _0xab2c=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0xb2ca[_0xbd08b4];return _0x314f1e;};'use strict';var emlformat=require(_0xab2c('0x0'));var rimraf=require(_0xab2c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xab2c('0x2'));var rp=require(_0xab2c('0x3'));var moment=require(_0xab2c('0x4'));var BPromise=require(_0xab2c('0x5'));var Mustache=require(_0xab2c('0x6'));var util=require(_0xab2c('0x7'));var path=require(_0xab2c('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xab2c('0x9'));var fs=require('fs');var fs_extra=require(_0xab2c('0xa'));var _=require(_0xab2c('0xb'));var squel=require('squel');var crypto=require(_0xab2c('0xc'));var jsforce=require(_0xab2c('0xd'));var deskjs=require(_0xab2c('0xe'));var toCsv=require(_0xab2c('0xf'));var querystring=require(_0xab2c('0x10'));var Papa=require(_0xab2c('0x11'));var Redis=require('ioredis');var authService=require(_0xab2c('0x12'));var qs=require(_0xab2c('0x13'));var as=require(_0xab2c('0x14'));var hardwareService=require(_0xab2c('0x15'));var logger=require(_0xab2c('0x16'))(_0xab2c('0x17'));var utils=require(_0xab2c('0x18'));var config=require(_0xab2c('0x19'));var licenseUtil=require(_0xab2c('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x49d0df,_0xdde708){_0xdde708=_0xdde708||0xcc;return function(_0x311da1){if(_0x311da1){return _0x49d0df[_0xab2c('0x1b')](_0xdde708);}return _0x49d0df[_0xab2c('0x1c')](_0xdde708)[_0xab2c('0x1d')]();};}function respondWithResult(_0x261889,_0x5a7c70){_0x5a7c70=_0x5a7c70||0xc8;return function(_0xcb6182){if(_0xcb6182){return _0x261889[_0xab2c('0x1c')](_0x5a7c70)[_0xab2c('0x1e')](_0xcb6182);}};}function respondWithFilteredResult(_0x292fe9,_0x53d442){return function(_0x5cc6fb){if(_0x5cc6fb){var _0x5c9131=typeof _0x53d442[_0xab2c('0x1f')]===_0xab2c('0x20')&&typeof _0x53d442[_0xab2c('0x21')]===_0xab2c('0x20');var _0x8abfc4=_0x5cc6fb[_0xab2c('0x22')];var _0x290681=_0x5c9131?0x0:_0x53d442[_0xab2c('0x1f')];var _0x571026=_0x5c9131?_0x5cc6fb[_0xab2c('0x22')]:_0x53d442[_0xab2c('0x1f')]+_0x53d442['limit'];var _0x99c052;if(_0x571026>=_0x8abfc4){_0x571026=_0x8abfc4;_0x99c052=0xc8;}else{_0x99c052=0xce;}_0x292fe9[_0xab2c('0x1c')](_0x99c052);return _0x292fe9[_0xab2c('0x23')](_0xab2c('0x24'),_0x290681+'-'+_0x571026+'/'+_0x8abfc4)['json'](_0x5cc6fb);}return null;};}function patchUpdates(_0x2b61d4){return function(_0x2f3950){try{jsonpatch[_0xab2c('0x25')](_0x2f3950,_0x2b61d4,!![]);}catch(_0x1c6a6c){return BPromise[_0xab2c('0x26')](_0x1c6a6c);}return _0x2f3950[_0xab2c('0x27')]();};}function saveUpdates(_0x429f6a,_0x31c163){return function(_0x101678){if(_0x101678){return _0x101678[_0xab2c('0x28')](_0x429f6a)[_0xab2c('0x29')](function(_0x2b8936){return _0x2b8936;});}return null;};}function removeEntity(_0x33eb52,_0x4d63de){return function(_0x36931f){if(_0x36931f){return _0x36931f[_0xab2c('0x2a')]()[_0xab2c('0x29')](function(){var _0x5f2066=_0x36931f['get']({'plain':!![]});var _0x4db87c=_0xab2c('0x2b');return db[_0xab2c('0x2c')][_0xab2c('0x2a')]({'where':{'type':_0x4db87c,'resourceId':_0x5f2066['id']}})[_0xab2c('0x29')](function(){return _0x36931f;});})[_0xab2c('0x29')](function(){_0x33eb52[_0xab2c('0x1c')](0xcc)[_0xab2c('0x1d')]();});}};}function handleEntityNotFound(_0x3ea457,_0x13673a){return function(_0x58f591){if(!_0x58f591){_0x3ea457[_0xab2c('0x1b')](0x194);}return _0x58f591;};}function handleError(_0x3ec008,_0x3fd3a1){_0x3fd3a1=_0x3fd3a1||0x1f4;return function(_0x1784df){logger[_0xab2c('0x2d')](_0x1784df[_0xab2c('0x2e')]);if(_0x1784df[_0xab2c('0x2f')]){delete _0x1784df[_0xab2c('0x2f')];}_0x3ec008[_0xab2c('0x1c')](_0x3fd3a1)[_0xab2c('0x30')](_0x1784df);};}exports[_0xab2c('0x31')]=function(_0x57be3c,_0x6f3c58){var _0xadbf6d={},_0x4422da={},_0x565e82={'count':0x0,'rows':[]};var _0x2305a8=_['map'](db[_0xab2c('0x32')]['rawAttributes'],function(_0x1a294f){return{'name':_0x1a294f[_0xab2c('0x33')],'type':_0x1a294f[_0xab2c('0x34')]['key']};});_0x4422da[_0xab2c('0x35')]=_[_0xab2c('0x36')](_0x2305a8,_0xab2c('0x2f'));_0x4422da[_0xab2c('0x37')]=_[_0xab2c('0x38')](_0x57be3c[_0xab2c('0x37')]);_0x4422da[_0xab2c('0x39')]=_[_0xab2c('0x3a')](_0x4422da[_0xab2c('0x35')],_0x4422da['query']);_0xadbf6d[_0xab2c('0x3b')]=_[_0xab2c('0x3a')](_0x4422da[_0xab2c('0x35')],qs['fields'](_0x57be3c[_0xab2c('0x37')][_0xab2c('0x3c')]));_0xadbf6d[_0xab2c('0x3b')]=_0xadbf6d['attributes']['length']?_0xadbf6d[_0xab2c('0x3b')]:_0x4422da[_0xab2c('0x35')];if(!_0x57be3c[_0xab2c('0x37')][_0xab2c('0x3d')]('nolimit')){_0xadbf6d[_0xab2c('0x21')]=qs[_0xab2c('0x21')](_0x57be3c[_0xab2c('0x37')][_0xab2c('0x21')]);_0xadbf6d[_0xab2c('0x1f')]=qs[_0xab2c('0x1f')](_0x57be3c['query'][_0xab2c('0x1f')]);}_0xadbf6d['order']=qs[_0xab2c('0x3e')](_0x57be3c[_0xab2c('0x37')][_0xab2c('0x3e')]);_0xadbf6d[_0xab2c('0x3f')]=qs['filters'](_[_0xab2c('0x40')](_0x57be3c[_0xab2c('0x37')],_0x4422da[_0xab2c('0x39')]),_0x2305a8);if(_0x57be3c[_0xab2c('0x37')][_0xab2c('0x41')]){_0xadbf6d[_0xab2c('0x3f')]=_[_0xab2c('0x42')](_0xadbf6d[_0xab2c('0x3f')],{'$or':_[_0xab2c('0x36')](_0x2305a8,function(_0x444be2){if(_0x444be2[_0xab2c('0x34')]!==_0xab2c('0x43')){var _0x723c6a={};_0x723c6a[_0x444be2[_0xab2c('0x2f')]]={'$like':'%'+_0x57be3c['query']['filter']+'%'};return _0x723c6a;}})});}_0xadbf6d=_[_0xab2c('0x42')]({},_0xadbf6d,_0x57be3c[_0xab2c('0x44')]);var _0x2dca1b={'where':_0xadbf6d['where']};return db[_0xab2c('0x32')]['count'](_0x2dca1b)[_0xab2c('0x29')](function(_0x40ed32){_0x565e82[_0xab2c('0x22')]=_0x40ed32;if(_0x57be3c[_0xab2c('0x37')][_0xab2c('0x45')]){_0xadbf6d[_0xab2c('0x46')]=[{'all':!![]}];}return db[_0xab2c('0x32')][_0xab2c('0x47')](_0xadbf6d);})[_0xab2c('0x29')](function(_0x2adb65){_0x565e82[_0xab2c('0x48')]=_0x2adb65;return _0x565e82;})[_0xab2c('0x29')](respondWithFilteredResult(_0x6f3c58,_0xadbf6d))[_0xab2c('0x49')](handleError(_0x6f3c58,null));};exports['show']=function(_0x5bce43,_0x107753){var _0x52a965={'raw':![],'where':{'id':_0x5bce43[_0xab2c('0x4a')]['id']}},_0xea2f42={};_0xea2f42['model']=_['keys'](db[_0xab2c('0x32')][_0xab2c('0x4b')]);_0xea2f42[_0xab2c('0x37')]=_[_0xab2c('0x38')](_0x5bce43[_0xab2c('0x37')]);_0xea2f42['filters']=_[_0xab2c('0x3a')](_0xea2f42[_0xab2c('0x35')],_0xea2f42['query']);_0x52a965[_0xab2c('0x3b')]=_[_0xab2c('0x3a')](_0xea2f42['model'],qs[_0xab2c('0x3c')](_0x5bce43[_0xab2c('0x37')]['fields']));_0x52a965[_0xab2c('0x3b')]=_0x52a965['attributes'][_0xab2c('0x4c')]?_0x52a965[_0xab2c('0x3b')]:_0xea2f42['model'];if(_0x5bce43[_0xab2c('0x37')][_0xab2c('0x45')]){_0x52a965[_0xab2c('0x46')]=[{'all':!![]}];}_0x52a965=_['merge']({},_0x52a965,_0x5bce43[_0xab2c('0x44')]);return db[_0xab2c('0x32')]['find'](_0x52a965)[_0xab2c('0x29')](handleEntityNotFound(_0x107753,null))[_0xab2c('0x29')](respondWithResult(_0x107753,null))['catch'](handleError(_0x107753,null));};exports[_0xab2c('0x4d')]=function(_0x14bae3,_0xae5782){return db[_0xab2c('0x32')][_0xab2c('0x4d')](_0x14bae3['body'],{})[_0xab2c('0x29')](function(_0x227259){var _0x4a5772=_0x14bae3[_0xab2c('0x4e')]['get']({'plain':!![]});if(!_0x4a5772)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4a5772[_0xab2c('0x4f')]===_0xab2c('0x4e')){var _0x20d18a=_0x227259[_0xab2c('0x50')]({'plain':!![]});var _0x1589b6=_0xab2c('0x2b');return db[_0xab2c('0x51')][_0xab2c('0x52')]({'where':{'name':_0x1589b6,'userProfileId':_0x4a5772['userProfileId']},'raw':!![]})[_0xab2c('0x29')](function(_0x31f80e){if(_0x31f80e&&_0x31f80e['autoAssociation']===0x0){return db['UserProfileResource'][_0xab2c('0x4d')]({'name':_0x20d18a[_0xab2c('0x2f')],'resourceId':_0x20d18a['id'],'type':_0x31f80e[_0xab2c('0x2f')],'sectionId':_0x31f80e['id']},{})[_0xab2c('0x29')](function(){return _0x227259;});}else{return _0x227259;}})[_0xab2c('0x49')](function(_0x3cc203){logger[_0xab2c('0x2d')](_0xab2c('0x53'),_0x3cc203);throw _0x3cc203;});}return _0x227259;})['then'](respondWithResult(_0xae5782,0xc9))[_0xab2c('0x49')](handleError(_0xae5782,null));};exports[_0xab2c('0x54')]=function(_0x482c3d,_0x4ddee1){var _0x57b600={'where':{'id':_0x482c3d[_0xab2c('0x4a')]['id']}},_0x197607={};_0x197607[_0xab2c('0x35')]=_[_0xab2c('0x38')](db[_0xab2c('0x32')][_0xab2c('0x4b')]);_0x57b600[_0xab2c('0x3b')]=_[_0xab2c('0x3a')](_0x197607[_0xab2c('0x35')],qs[_0xab2c('0x3c')](_0x482c3d[_0xab2c('0x37')][_0xab2c('0x3c')]));_0x57b600['attributes']=_0x57b600[_0xab2c('0x3b')][_0xab2c('0x4c')]?_0x57b600[_0xab2c('0x3b')]:_0x197607[_0xab2c('0x35')];if(_0x482c3d[_0xab2c('0x37')][_0xab2c('0x45')]){_0x57b600[_0xab2c('0x46')]=[{'all':!![]}];}_0x57b600=_[_0xab2c('0x42')]({},_0x57b600,_0x482c3d[_0xab2c('0x44')]);return db[_0xab2c('0x32')]['find'](_0x57b600)['then'](handleEntityNotFound(_0x4ddee1,null))[_0xab2c('0x29')](function(_0x38c8e7){if(_0x38c8e7){var _0x391f26=_0x38c8e7['get']({'plain':!![]});_0x391f26=qs[_0xab2c('0x55')](_0x391f26,['id',_0xab2c('0x56'),_0xab2c('0x57')]);_0x482c3d[_0xab2c('0x58')]=_[_0xab2c('0x55')](_0x482c3d[_0xab2c('0x58')],['id',_0xab2c('0x56'),_0xab2c('0x57')]);return db[_0xab2c('0x32')]['create'](_[_0xab2c('0x42')](_0x391f26,_0x482c3d['body']),{'include':_0x482c3d[_0xab2c('0x37')][_0xab2c('0x45')]?[{'all':!![]}]:undefined})[_0xab2c('0x29')](function(_0x3db889){var _0x24fef0=_0x482c3d[_0xab2c('0x4e')][_0xab2c('0x50')]({'plain':!![]});if(!_0x24fef0)throw new Error(_0xab2c('0x59'));if(_0x24fef0['role']===_0xab2c('0x4e')){var _0x54c8ab=_0x3db889[_0xab2c('0x50')]({'plain':!![]});var _0x2680e7=_0xab2c('0x2b');return db[_0xab2c('0x51')][_0xab2c('0x52')]({'where':{'name':_0x2680e7,'userProfileId':_0x24fef0[_0xab2c('0x5a')]},'raw':!![]})[_0xab2c('0x29')](function(_0x4a8d9f){if(_0x4a8d9f&&_0x4a8d9f[_0xab2c('0x5b')]===0x0){return db['UserProfileResource']['create']({'name':_0x54c8ab[_0xab2c('0x2f')],'resourceId':_0x54c8ab['id'],'type':_0x4a8d9f[_0xab2c('0x2f')],'sectionId':_0x4a8d9f['id']},{})[_0xab2c('0x29')](function(){return _0x3db889;});}else{return _0x3db889;}})[_0xab2c('0x49')](function(_0x19fbc3){logger[_0xab2c('0x2d')](_0xab2c('0x53'),_0x19fbc3);throw _0x19fbc3;});}return _0x3db889;});}})[_0xab2c('0x29')](respondWithResult(_0x4ddee1,0xc9))[_0xab2c('0x49')](handleError(_0x4ddee1,null));};exports[_0xab2c('0x28')]=function(_0x1b1d88,_0x4ffc1d){if(_0x1b1d88[_0xab2c('0x58')]['id']){delete _0x1b1d88[_0xab2c('0x58')]['id'];}return db[_0xab2c('0x32')][_0xab2c('0x52')]({'where':{'id':_0x1b1d88[_0xab2c('0x4a')]['id']}})[_0xab2c('0x29')](handleEntityNotFound(_0x4ffc1d,null))[_0xab2c('0x29')](saveUpdates(_0x1b1d88[_0xab2c('0x58')],null))['then'](respondWithResult(_0x4ffc1d,null))[_0xab2c('0x49')](handleError(_0x4ffc1d,null));};exports[_0xab2c('0x2a')]=function(_0x32d807,_0xd03143){return db[_0xab2c('0x32')][_0xab2c('0x52')]({'where':{'id':_0x32d807[_0xab2c('0x4a')]['id']}})[_0xab2c('0x29')](handleEntityNotFound(_0xd03143,null))[_0xab2c('0x29')](removeEntity(_0xd03143,null))[_0xab2c('0x49')](handleError(_0xd03143,null));};exports[_0xab2c('0x5c')]=function(_0x87ef56,_0x3a6a89,_0x318bc2){var _0x48a596={'raw':!![],'where':{}};var _0x3b2272={};var _0x1d1890={'count':0x0,'rows':[]};return db[_0xab2c('0x32')][_0xab2c('0x5d')]({'where':{'id':_0x87ef56[_0xab2c('0x4a')]['id']}})[_0xab2c('0x29')](handleEntityNotFound(_0x3a6a89,null))['then'](function(_0x425106){if(_0x425106){_0x3b2272['model']=_['keys'](db[_0xab2c('0x5e')][_0xab2c('0x4b')]);_0x3b2272[_0xab2c('0x37')]=_[_0xab2c('0x38')](_0x87ef56[_0xab2c('0x37')]);_0x3b2272[_0xab2c('0x39')]=_[_0xab2c('0x3a')](_0x3b2272['model'],_0x3b2272[_0xab2c('0x37')]);_0x48a596[_0xab2c('0x3b')]=_[_0xab2c('0x3a')](_0x3b2272[_0xab2c('0x35')],qs['fields'](_0x87ef56[_0xab2c('0x37')][_0xab2c('0x3c')]));_0x48a596['attributes']=_0x48a596[_0xab2c('0x3b')][_0xab2c('0x4c')]?_0x48a596[_0xab2c('0x3b')]:_0x3b2272['model'];if(!_0x87ef56[_0xab2c('0x37')][_0xab2c('0x3d')](_0xab2c('0x5f'))){_0x48a596[_0xab2c('0x21')]=qs[_0xab2c('0x21')](_0x87ef56['query'][_0xab2c('0x21')]);_0x48a596[_0xab2c('0x1f')]=qs['offset'](_0x87ef56[_0xab2c('0x37')][_0xab2c('0x1f')]);}_0x48a596[_0xab2c('0x60')]=qs[_0xab2c('0x3e')](_0x87ef56[_0xab2c('0x37')]['sort']);_0x48a596[_0xab2c('0x3f')]=qs['filters'](_[_0xab2c('0x40')](_0x87ef56[_0xab2c('0x37')],_0x3b2272['filters']));_0x48a596[_0xab2c('0x3f')][_0xab2c('0x61')]=_0x425106['id'];if(_0x87ef56[_0xab2c('0x37')][_0xab2c('0x41')]){_0x48a596[_0xab2c('0x3f')]=_['merge'](_0x48a596['where'],{'$or':_[_0xab2c('0x36')](_0x48a596[_0xab2c('0x3b')],function(_0x5f2c09){var _0x486b1c={};_0x486b1c[_0x5f2c09]={'$like':'%'+_0x87ef56[_0xab2c('0x37')][_0xab2c('0x41')]+'%'};return _0x486b1c;})});}_0x48a596=_['merge']({},_0x48a596,_0x87ef56[_0xab2c('0x44')]);return db[_0xab2c('0x5e')][_0xab2c('0x22')]({'where':_0x48a596[_0xab2c('0x3f')]})['then'](function(_0x3ff3f9){_0x1d1890[_0xab2c('0x22')]=_0x3ff3f9;if(_0x87ef56[_0xab2c('0x37')][_0xab2c('0x45')]){_0x48a596[_0xab2c('0x46')]=[{'all':!![]}];}return db[_0xab2c('0x5e')][_0xab2c('0x47')](_0x48a596);})[_0xab2c('0x29')](function(_0x17d1d7){_0x1d1890[_0xab2c('0x48')]=_0x17d1d7;return _0x1d1890;});}})[_0xab2c('0x29')](respondWithFilteredResult(_0x3a6a89,_0x48a596))['catch'](handleError(_0x3a6a89,null));};exports[_0xab2c('0x62')]=function(_0x1f124f,_0x391041,_0x1bd45d){var _0x4ce753={'raw':!![],'where':{}};var _0x3e7b6b={};var _0x38910b={'count':0x0,'rows':[]};return db[_0xab2c('0x32')]['findOne']({'where':{'id':_0x1f124f[_0xab2c('0x4a')]['id']}})['then'](handleEntityNotFound(_0x391041,null))[_0xab2c('0x29')](function(_0x54ad65){if(_0x54ad65){_0x3e7b6b[_0xab2c('0x35')]=_[_0xab2c('0x38')](db['CmHopperHistory'][_0xab2c('0x4b')]);_0x3e7b6b[_0xab2c('0x37')]=_[_0xab2c('0x38')](_0x1f124f[_0xab2c('0x37')]);_0x3e7b6b[_0xab2c('0x39')]=_['intersection'](_0x3e7b6b[_0xab2c('0x35')],_0x3e7b6b[_0xab2c('0x37')]);_0x4ce753[_0xab2c('0x3b')]=_[_0xab2c('0x3a')](_0x3e7b6b[_0xab2c('0x35')],qs[_0xab2c('0x3c')](_0x1f124f[_0xab2c('0x37')][_0xab2c('0x3c')]));_0x4ce753['attributes']=_0x4ce753[_0xab2c('0x3b')]['length']?_0x4ce753[_0xab2c('0x3b')]:_0x3e7b6b[_0xab2c('0x35')];if(!_0x1f124f[_0xab2c('0x37')][_0xab2c('0x3d')](_0xab2c('0x5f'))){_0x4ce753[_0xab2c('0x21')]=qs[_0xab2c('0x21')](_0x1f124f[_0xab2c('0x37')][_0xab2c('0x21')]);_0x4ce753[_0xab2c('0x1f')]=qs[_0xab2c('0x1f')](_0x1f124f[_0xab2c('0x37')][_0xab2c('0x1f')]);}_0x4ce753['order']=qs[_0xab2c('0x3e')](_0x1f124f[_0xab2c('0x37')][_0xab2c('0x3e')]);_0x4ce753[_0xab2c('0x3f')]=qs['filters'](_[_0xab2c('0x40')](_0x1f124f[_0xab2c('0x37')],_0x3e7b6b[_0xab2c('0x39')]));_0x4ce753[_0xab2c('0x3f')][_0xab2c('0x61')]=_0x54ad65['id'];if(_0x1f124f[_0xab2c('0x37')][_0xab2c('0x41')]){_0x4ce753[_0xab2c('0x3f')]=_['merge'](_0x4ce753[_0xab2c('0x3f')],{'$or':_[_0xab2c('0x36')](_0x4ce753['attributes'],function(_0x23b6c7){var _0x2e1ba8={};_0x2e1ba8[_0x23b6c7]={'$like':'%'+_0x1f124f[_0xab2c('0x37')][_0xab2c('0x41')]+'%'};return _0x2e1ba8;})});}_0x4ce753=_[_0xab2c('0x42')]({},_0x4ce753,_0x1f124f[_0xab2c('0x44')]);return db[_0xab2c('0x63')]['count']({'where':_0x4ce753[_0xab2c('0x3f')]})[_0xab2c('0x29')](function(_0xe2f178){_0x38910b[_0xab2c('0x22')]=_0xe2f178;if(_0x1f124f[_0xab2c('0x37')][_0xab2c('0x45')]){_0x4ce753['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0xab2c('0x47')](_0x4ce753);})[_0xab2c('0x29')](function(_0x4c8e57){_0x38910b[_0xab2c('0x48')]=_0x4c8e57;return _0x38910b;});}})[_0xab2c('0x29')](respondWithFilteredResult(_0x391041,_0x4ce753))['catch'](handleError(_0x391041,null));};exports['getHopperFinals']=function(_0x320ab2,_0x4588e5,_0x556598){var _0x29ba0e={'raw':!![],'where':{}};var _0x37c731={};var _0x695a12={'count':0x0,'rows':[]};return db[_0xab2c('0x32')][_0xab2c('0x5d')]({'where':{'id':_0x320ab2[_0xab2c('0x4a')]['id']}})[_0xab2c('0x29')](handleEntityNotFound(_0x4588e5,null))[_0xab2c('0x29')](function(_0x419e70){if(_0x419e70){_0x37c731[_0xab2c('0x35')]=_[_0xab2c('0x38')](db['CmHopperFinal'][_0xab2c('0x4b')]);_0x37c731[_0xab2c('0x37')]=_[_0xab2c('0x38')](_0x320ab2[_0xab2c('0x37')]);_0x37c731[_0xab2c('0x39')]=_[_0xab2c('0x3a')](_0x37c731[_0xab2c('0x35')],_0x37c731[_0xab2c('0x37')]);_0x29ba0e[_0xab2c('0x3b')]=_[_0xab2c('0x3a')](_0x37c731[_0xab2c('0x35')],qs[_0xab2c('0x3c')](_0x320ab2[_0xab2c('0x37')][_0xab2c('0x3c')]));_0x29ba0e[_0xab2c('0x3b')]=_0x29ba0e['attributes'][_0xab2c('0x4c')]?_0x29ba0e[_0xab2c('0x3b')]:_0x37c731[_0xab2c('0x35')];if(!_0x320ab2[_0xab2c('0x37')][_0xab2c('0x3d')](_0xab2c('0x5f'))){_0x29ba0e[_0xab2c('0x21')]=qs[_0xab2c('0x21')](_0x320ab2[_0xab2c('0x37')][_0xab2c('0x21')]);_0x29ba0e[_0xab2c('0x1f')]=qs[_0xab2c('0x1f')](_0x320ab2['query']['offset']);}_0x29ba0e[_0xab2c('0x60')]=qs[_0xab2c('0x3e')](_0x320ab2[_0xab2c('0x37')][_0xab2c('0x3e')]);_0x29ba0e['where']=qs[_0xab2c('0x39')](_[_0xab2c('0x40')](_0x320ab2[_0xab2c('0x37')],_0x37c731['filters']));_0x29ba0e[_0xab2c('0x3f')]['CampaignId']=_0x419e70['id'];if(_0x320ab2[_0xab2c('0x37')]['filter']){_0x29ba0e[_0xab2c('0x3f')]=_[_0xab2c('0x42')](_0x29ba0e[_0xab2c('0x3f')],{'$or':_[_0xab2c('0x36')](_0x29ba0e[_0xab2c('0x3b')],function(_0x4c0a9b){var _0x14a8f5={};_0x14a8f5[_0x4c0a9b]={'$like':'%'+_0x320ab2['query'][_0xab2c('0x41')]+'%'};return _0x14a8f5;})});}_0x29ba0e=_[_0xab2c('0x42')]({},_0x29ba0e,_0x320ab2['options']);return db['CmHopperFinal'][_0xab2c('0x22')]({'where':_0x29ba0e[_0xab2c('0x3f')]})[_0xab2c('0x29')](function(_0xe19b61){_0x695a12[_0xab2c('0x22')]=_0xe19b61;if(_0x320ab2[_0xab2c('0x37')][_0xab2c('0x45')]){_0x29ba0e[_0xab2c('0x46')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x29ba0e);})[_0xab2c('0x29')](function(_0x2f7899){_0x695a12['rows']=_0x2f7899;return _0x695a12;});}})[_0xab2c('0x29')](respondWithFilteredResult(_0x4588e5,_0x29ba0e))[_0xab2c('0x49')](handleError(_0x4588e5,null));};exports['getHopperBlacks']=function(_0x647e5b,_0x17d5fb,_0x51c997){var _0x33f455={'raw':!![],'where':{}};var _0x17069a={};var _0x369589={'count':0x0,'rows':[]};return db[_0xab2c('0x32')][_0xab2c('0x5d')]({'where':{'id':_0x647e5b[_0xab2c('0x4a')]['id']}})['then'](handleEntityNotFound(_0x17d5fb,null))['then'](function(_0x4d2984){if(_0x4d2984){_0x17069a[_0xab2c('0x35')]=_['keys'](db[_0xab2c('0x64')][_0xab2c('0x4b')]);_0x17069a['query']=_[_0xab2c('0x38')](_0x647e5b[_0xab2c('0x37')]);_0x17069a[_0xab2c('0x39')]=_['intersection'](_0x17069a[_0xab2c('0x35')],_0x17069a['query']);_0x33f455['attributes']=_[_0xab2c('0x3a')](_0x17069a[_0xab2c('0x35')],qs['fields'](_0x647e5b[_0xab2c('0x37')]['fields']));_0x33f455['attributes']=_0x33f455[_0xab2c('0x3b')][_0xab2c('0x4c')]?_0x33f455[_0xab2c('0x3b')]:_0x17069a[_0xab2c('0x35')];if(!_0x647e5b[_0xab2c('0x37')][_0xab2c('0x3d')](_0xab2c('0x5f'))){_0x33f455[_0xab2c('0x21')]=qs[_0xab2c('0x21')](_0x647e5b[_0xab2c('0x37')][_0xab2c('0x21')]);_0x33f455[_0xab2c('0x1f')]=qs[_0xab2c('0x1f')](_0x647e5b[_0xab2c('0x37')][_0xab2c('0x1f')]);}_0x33f455['order']=qs[_0xab2c('0x3e')](_0x647e5b[_0xab2c('0x37')][_0xab2c('0x3e')]);_0x33f455['where']=qs[_0xab2c('0x39')](_[_0xab2c('0x40')](_0x647e5b[_0xab2c('0x37')],_0x17069a['filters']));_0x33f455['where'][_0xab2c('0x61')]=_0x4d2984['id'];if(_0x647e5b['query']['filter']){_0x33f455[_0xab2c('0x3f')]=_['merge'](_0x33f455[_0xab2c('0x3f')],{'$or':_[_0xab2c('0x36')](_0x33f455[_0xab2c('0x3b')],function(_0x474132){var _0x5e848e={};_0x5e848e[_0x474132]={'$like':'%'+_0x647e5b[_0xab2c('0x37')]['filter']+'%'};return _0x5e848e;})});}_0x33f455=_[_0xab2c('0x42')]({},_0x33f455,_0x647e5b[_0xab2c('0x44')]);return db[_0xab2c('0x64')][_0xab2c('0x22')]({'where':_0x33f455[_0xab2c('0x3f')]})[_0xab2c('0x29')](function(_0x49d9d6){_0x369589[_0xab2c('0x22')]=_0x49d9d6;if(_0x647e5b[_0xab2c('0x37')][_0xab2c('0x45')]){_0x33f455[_0xab2c('0x46')]=[{'all':!![]}];}return db[_0xab2c('0x64')]['findAll'](_0x33f455);})[_0xab2c('0x29')](function(_0x361f65){_0x369589['rows']=_0x361f65;return _0x369589;});}})[_0xab2c('0x29')](respondWithFilteredResult(_0x17d5fb,_0x33f455))[_0xab2c('0x49')](handleError(_0x17d5fb,null));};exports[_0xab2c('0x65')]=function(_0x2a44c9,_0xdd3bd8,_0x361a62){var _0x40fff5={};var _0x5d4fa2={};var _0x3073c9;var _0x11061b;return db[_0xab2c('0x32')][_0xab2c('0x5d')]({'where':{'id':_0x2a44c9[_0xab2c('0x4a')]['id']}})[_0xab2c('0x29')](handleEntityNotFound(_0xdd3bd8,null))[_0xab2c('0x29')](function(_0x368e27){if(_0x368e27){_0x3073c9=_0x368e27;_0x5d4fa2[_0xab2c('0x35')]=_[_0xab2c('0x38')](db['CmList'][_0xab2c('0x4b')]);_0x5d4fa2[_0xab2c('0x37')]=_['keys'](_0x2a44c9[_0xab2c('0x37')]);_0x5d4fa2[_0xab2c('0x39')]=_[_0xab2c('0x3a')](_0x5d4fa2[_0xab2c('0x35')],_0x5d4fa2[_0xab2c('0x37')]);_0x40fff5[_0xab2c('0x3b')]=_['intersection'](_0x5d4fa2['model'],qs[_0xab2c('0x3c')](_0x2a44c9['query'][_0xab2c('0x3c')]));_0x40fff5['attributes']=_0x40fff5[_0xab2c('0x3b')][_0xab2c('0x4c')]?_0x40fff5[_0xab2c('0x3b')]:_0x5d4fa2[_0xab2c('0x35')];_0x40fff5[_0xab2c('0x60')]=qs[_0xab2c('0x3e')](_0x2a44c9[_0xab2c('0x37')][_0xab2c('0x3e')]);_0x40fff5[_0xab2c('0x3f')]=qs[_0xab2c('0x39')](_[_0xab2c('0x40')](_0x2a44c9[_0xab2c('0x37')],_0x5d4fa2[_0xab2c('0x39')]));if(_0x2a44c9[_0xab2c('0x37')][_0xab2c('0x41')]){_0x40fff5[_0xab2c('0x3f')]=_[_0xab2c('0x42')](_0x40fff5[_0xab2c('0x3f')],{'$or':_[_0xab2c('0x36')](_0x40fff5[_0xab2c('0x3b')],function(_0x3e6fb2){var _0x43301f={};_0x43301f[_0x3e6fb2]={'$like':'%'+_0x2a44c9[_0xab2c('0x37')][_0xab2c('0x41')]+'%'};return _0x43301f;})});}_0x40fff5=_['merge']({},_0x40fff5,_0x2a44c9[_0xab2c('0x44')]);return _0x3073c9[_0xab2c('0x65')](_0x40fff5);}})['then'](function(_0x394767){if(_0x394767){_0x11061b=_0x394767[_0xab2c('0x4c')];if(!_0x2a44c9[_0xab2c('0x37')][_0xab2c('0x3d')](_0xab2c('0x5f'))){_0x40fff5[_0xab2c('0x21')]=qs[_0xab2c('0x21')](_0x2a44c9['query'][_0xab2c('0x21')]);_0x40fff5['offset']=qs[_0xab2c('0x1f')](_0x2a44c9[_0xab2c('0x37')][_0xab2c('0x1f')]);}return _0x3073c9[_0xab2c('0x65')](_0x40fff5);}})['then'](function(_0x421728){if(_0x421728){return _0x421728?{'count':_0x11061b,'rows':_0x421728}:null;}})[_0xab2c('0x29')](respondWithResult(_0xdd3bd8,null))[_0xab2c('0x49')](handleError(_0xdd3bd8,null));};exports['addLists']=function(_0x445810,_0xe649b3,_0x17ce3c){var _0x3ebe68,_0x50b150;var _0x11f6e4=[];var _0x352261=moment()[_0xab2c('0x66')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0xab2c('0x32')][_0xab2c('0x52')]({'where':{'id':_0x445810['params']['id']}})[_0xab2c('0x29')](handleEntityNotFound(_0xe649b3,null))['then'](function(_0x5e0cd1){if(_0x5e0cd1){_0x50b150=_0x5e0cd1;return _0x5e0cd1[_0xab2c('0x67')](_0x445810[_0xab2c('0x58')][_0xab2c('0x68')],_[_0xab2c('0x55')](_0x445810[_0xab2c('0x58')],[_0xab2c('0x68'),'id'])||{});}return null;})[_0xab2c('0x69')](function(_0xe28928){var _0x13c439;var _0x1b370a;_0x3ebe68=_0xe28928||[];var _0xf2eb93=[];if(_0xe28928){for(var _0x32ab01=0x0;_0x32ab01<_0xe28928[_0xab2c('0x4c')];_0x32ab01+=0x1){var _0x2815b6=_0xe28928[_0x32ab01]['get']({'plain':!![]});_0x50b150['dialCheckDuplicateType']=_0x445810[_0xab2c('0x58')][_0xab2c('0x6a')]?_0x445810[_0xab2c('0x58')][_0xab2c('0x6a')]:_0x50b150[_0xab2c('0x6a')];switch(_0x50b150[_0xab2c('0x6a')]){case'always':_0x13c439=squel[_0xab2c('0x6b')]()[_0xab2c('0x6c')](_0xab2c('0x6d'))[_0xab2c('0x6e')]([_0xab2c('0x6f'),_0xab2c('0x70'),_0xab2c('0x71'),_0xab2c('0x72'),_0xab2c('0x61'),_0xab2c('0x56'),'updatedAt'],squel['select']()[_0xab2c('0x73')](_0xab2c('0x6f'),_0xab2c('0x6f'))[_0xab2c('0x73')](_0xab2c('0x74'),_0xab2c('0x70'))[_0xab2c('0x73')]('id',_0xab2c('0x71'))['field'](_0x2815b6[_0xab2c('0x75')][_0xab2c('0x76')](),'ListId')['field'](_0x445810[_0xab2c('0x4a')]['id'][_0xab2c('0x76')](),'CampaignId')[_0xab2c('0x73')]('\x27'+_0x352261+'\x27',_0xab2c('0x56'))[_0xab2c('0x73')]('\x27'+_0x352261+'\x27',_0xab2c('0x57'))[_0xab2c('0x77')](_0xab2c('0x78'))[_0xab2c('0x3f')]('deletedAt\x20IS\x20NULL')[_0xab2c('0x3f')]('ListId\x20=\x20?',_0x2815b6[_0xab2c('0x75')]['toString']())[_0xab2c('0x3f')]('phone\x20IS\x20NOT\x20NULL')['where'](_0xab2c('0x79'),squel[_0xab2c('0x7a')]()['field'](_0xab2c('0x7b'))['from'](_0xab2c('0x7c'))['where'](_0xab2c('0x7d'),_0x445810[_0xab2c('0x4a')]['id'][_0xab2c('0x76')]()))[_0xab2c('0x3f')](_0xab2c('0x79'),squel['select']()[_0xab2c('0x73')]('COALESCE(phone,\x27\x27)')[_0xab2c('0x77')]('cm_hopper')[_0xab2c('0x3f')](_0xab2c('0x7d'),_0x445810[_0xab2c('0x4a')]['id'][_0xab2c('0x76')]())))[_0xab2c('0x76')]();break;case _0xab2c('0x7e'):_0x13c439=squel[_0xab2c('0x6b')]()[_0xab2c('0x6c')]('cm_hopper')[_0xab2c('0x6e')]([_0xab2c('0x6f'),_0xab2c('0x70'),'ContactId',_0xab2c('0x72'),_0xab2c('0x61'),_0xab2c('0x56'),'updatedAt'],squel['select']()['field'](_0xab2c('0x6f'),_0xab2c('0x6f'))[_0xab2c('0x73')]('NOW()',_0xab2c('0x70'))[_0xab2c('0x73')]('id',_0xab2c('0x71'))[_0xab2c('0x73')](_0x2815b6[_0xab2c('0x75')][_0xab2c('0x76')](),'ListId')[_0xab2c('0x73')](_0x445810[_0xab2c('0x4a')]['id'][_0xab2c('0x76')](),_0xab2c('0x61'))['field']('\x27'+_0x352261+'\x27',_0xab2c('0x56'))[_0xab2c('0x73')]('\x27'+_0x352261+'\x27','updatedAt')[_0xab2c('0x77')](_0xab2c('0x78'))[_0xab2c('0x3f')](_0xab2c('0x7f'))[_0xab2c('0x3f')](_0xab2c('0x80'),_0x2815b6[_0xab2c('0x75')][_0xab2c('0x76')]())['where']('phone\x20IS\x20NOT\x20NULL')[_0xab2c('0x3f')]('phone\x20NOT\x20IN\x20(?)',squel[_0xab2c('0x7a')]()[_0xab2c('0x73')](_0xab2c('0x81'))[_0xab2c('0x77')](_0xab2c('0x6d'))[_0xab2c('0x3f')](_0xab2c('0x7d'),_0x445810[_0xab2c('0x4a')]['id'][_0xab2c('0x76')]())))[_0xab2c('0x76')]();break;default:_0x13c439=squel[_0xab2c('0x6b')]()[_0xab2c('0x6c')](_0xab2c('0x6d'))[_0xab2c('0x6e')](['phone',_0xab2c('0x70'),_0xab2c('0x71'),_0xab2c('0x72'),'CampaignId',_0xab2c('0x56'),_0xab2c('0x57')],squel['select']()[_0xab2c('0x73')](_0xab2c('0x6f'),'phone')['field'](_0xab2c('0x74'),'scheduledAt')['field']('id','ContactId')[_0xab2c('0x73')](_0x2815b6[_0xab2c('0x75')]['toString'](),_0xab2c('0x72'))[_0xab2c('0x73')](_0x445810['params']['id'][_0xab2c('0x76')](),_0xab2c('0x61'))['field']('\x27'+_0x352261+'\x27',_0xab2c('0x56'))['field']('\x27'+_0x352261+'\x27',_0xab2c('0x57'))['from'](_0xab2c('0x78'))[_0xab2c('0x3f')]('deletedAt\x20IS\x20NULL')['where'](_0xab2c('0x80'),_0x2815b6[_0xab2c('0x75')][_0xab2c('0x76')]())[_0xab2c('0x3f')](_0xab2c('0x82')))[_0xab2c('0x76')]();}_0x1b370a=squel[_0xab2c('0x6b')]()['into']('cm_hopper_additional_phones')[_0xab2c('0x6e')](['cmHopperId',_0xab2c('0x70'),'phone',_0xab2c('0x83'),_0xab2c('0x56'),'updatedAt'],squel[_0xab2c('0x7a')]()[_0xab2c('0x73')](_0xab2c('0x84'),'id')[_0xab2c('0x73')](_0xab2c('0x74'),_0xab2c('0x70'))[_0xab2c('0x73')](_0xab2c('0x85'),_0xab2c('0x6f'))[_0xab2c('0x73')]('ci.OrderBY',_0xab2c('0x83'))['field']('\x27'+_0x352261+'\x27',_0xab2c('0x56'))[_0xab2c('0x73')]('\x27'+_0x352261+'\x27','updatedAt')[_0xab2c('0x77')](_0xab2c('0x86'),'ci')[_0xab2c('0x87')]('cm_hopper','h',_0xab2c('0x88'))[_0xab2c('0x3f')](_0xab2c('0x89'),_0x2815b6[_0xab2c('0x75')]['toString']())[_0xab2c('0x3f')](_0xab2c('0x8a'),_0x445810[_0xab2c('0x4a')]['id'][_0xab2c('0x76')]())[_0xab2c('0x3f')]('h.createdAt\x20=\x20?',_0x352261))['toString']();_0xf2eb93[_0xab2c('0x8b')](db['sequelize'][_0xab2c('0x37')](_0x13c439));_0x11f6e4[_0xab2c('0x8b')](db[_0xab2c('0x8c')][_0xab2c('0x37')](_0x1b370a));}return BPromise[_0xab2c('0x8d')](_0xf2eb93);}})['then'](function(){return BPromise[_0xab2c('0x8d')](_0x11f6e4);})['then'](function(){return _0x3ebe68;})[_0xab2c('0x29')](respondWithResult(_0xe649b3,null))['catch'](handleError(_0xe649b3,null));};exports[_0xab2c('0x8e')]=function(_0xca1a51,_0x189dcc,_0x5c444c){return db[_0xab2c('0x32')][_0xab2c('0x52')]({'where':{'id':_0xca1a51['params']['id']}})[_0xab2c('0x29')](handleEntityNotFound(_0x189dcc,null))[_0xab2c('0x29')](function(_0x3813db){if(_0x3813db){return _0x3813db['removeLists'](_0xca1a51[_0xab2c('0x37')][_0xab2c('0x68')]);}})[_0xab2c('0x29')](function(_0xafa87c){if(_0xafa87c){return db[_0xab2c('0x5e')][_0xab2c('0x2a')]({'where':{'ListId':_0xca1a51[_0xab2c('0x37')][_0xab2c('0x68')],'CampaignId':_0xca1a51['params']['id']}})[_0xab2c('0x29')](function(){return _0xafa87c;});}})[_0xab2c('0x29')](respondWithStatusCode(_0x189dcc,null))[_0xab2c('0x49')](handleError(_0x189dcc,null));};exports[_0xab2c('0x8f')]=function(_0x46420e,_0x3fc097,_0x28745c){var _0x577a43={};var _0x4bb4a2={};var _0x2a5264;var _0x5f55dc;return db['Campaign'][_0xab2c('0x5d')]({'where':{'id':_0x46420e[_0xab2c('0x4a')]['id']}})[_0xab2c('0x29')](handleEntityNotFound(_0x3fc097,null))[_0xab2c('0x29')](function(_0xf53a7e){if(_0xf53a7e){_0x2a5264=_0xf53a7e;_0x4bb4a2[_0xab2c('0x35')]=_[_0xab2c('0x38')](db[_0xab2c('0x90')][_0xab2c('0x4b')]);_0x4bb4a2[_0xab2c('0x37')]=_[_0xab2c('0x38')](_0x46420e[_0xab2c('0x37')]);_0x4bb4a2[_0xab2c('0x39')]=_[_0xab2c('0x3a')](_0x4bb4a2[_0xab2c('0x35')],_0x4bb4a2[_0xab2c('0x37')]);_0x577a43[_0xab2c('0x3b')]=_['intersection'](_0x4bb4a2['model'],qs['fields'](_0x46420e[_0xab2c('0x37')][_0xab2c('0x3c')]));_0x577a43[_0xab2c('0x3b')]=_0x577a43[_0xab2c('0x3b')][_0xab2c('0x4c')]?_0x577a43[_0xab2c('0x3b')]:_0x4bb4a2['model'];_0x577a43[_0xab2c('0x60')]=qs['sort'](_0x46420e[_0xab2c('0x37')]['sort']);_0x577a43[_0xab2c('0x3f')]=qs['filters'](_[_0xab2c('0x40')](_0x46420e[_0xab2c('0x37')],_0x4bb4a2[_0xab2c('0x39')]));if(_0x46420e['query'][_0xab2c('0x41')]){_0x577a43[_0xab2c('0x3f')]=_['merge'](_0x577a43[_0xab2c('0x3f')],{'$or':_['map'](_0x577a43['attributes'],function(_0x51644c){var _0x2a121={};_0x2a121[_0x51644c]={'$like':'%'+_0x46420e[_0xab2c('0x37')][_0xab2c('0x41')]+'%'};return _0x2a121;})});}_0x577a43=_[_0xab2c('0x42')]({},_0x577a43,_0x46420e[_0xab2c('0x44')]);return _0x2a5264[_0xab2c('0x8f')](_0x577a43);}})[_0xab2c('0x29')](function(_0x29a84a){if(_0x29a84a){_0x5f55dc=_0x29a84a[_0xab2c('0x4c')];if(!_0x46420e[_0xab2c('0x37')][_0xab2c('0x3d')](_0xab2c('0x5f'))){_0x577a43[_0xab2c('0x21')]=qs[_0xab2c('0x21')](_0x46420e[_0xab2c('0x37')]['limit']);_0x577a43[_0xab2c('0x1f')]=qs[_0xab2c('0x1f')](_0x46420e[_0xab2c('0x37')][_0xab2c('0x1f')]);}return _0x2a5264[_0xab2c('0x8f')](_0x577a43);}})[_0xab2c('0x29')](function(_0x169aa4){if(_0x169aa4){return _0x169aa4?{'count':_0x5f55dc,'rows':_0x169aa4}:null;}})['then'](respondWithResult(_0x3fc097,null))[_0xab2c('0x49')](handleError(_0x3fc097,null));};exports[_0xab2c('0x91')]=function(_0x2841ba,_0x20d296,_0x45a834){var _0x290546,_0x10d644;var _0x2d361a=[];var _0x5af741=moment()[_0xab2c('0x66')](_0xab2c('0x92'));return db[_0xab2c('0x32')][_0xab2c('0x52')]({'where':{'id':_0x2841ba[_0xab2c('0x4a')]['id']}})[_0xab2c('0x29')](handleEntityNotFound(_0x20d296,null))[_0xab2c('0x29')](function(_0x50ea45){if(_0x50ea45){_0x10d644=_0x50ea45;return _0x50ea45['addBlackLists'](_0x2841ba[_0xab2c('0x58')]['ids'],_['omit'](_0x2841ba['body'],[_0xab2c('0x68'),'id'])||{});}return null;})[_0xab2c('0x69')](function(_0x2f2983){var _0x723416;var _0x443d49;_0x290546=_0x2f2983||[];var _0x1738e9=[];if(_0x2f2983){for(var _0x498d91=0x0;_0x498d91<_0x2f2983[_0xab2c('0x4c')];_0x498d91+=0x1){var _0x2a5893=_0x2f2983[_0x498d91][_0xab2c('0x50')]({'plain':!![]});_0x723416=squel[_0xab2c('0x6b')]()[_0xab2c('0x6c')](_0xab2c('0x93'))[_0xab2c('0x6e')]([_0xab2c('0x6f'),_0xab2c('0x71'),'ListId',_0xab2c('0x61'),_0xab2c('0x56'),_0xab2c('0x57')],squel[_0xab2c('0x7a')]()[_0xab2c('0x73')](_0xab2c('0x6f'),_0xab2c('0x6f'))['field']('id',_0xab2c('0x71'))[_0xab2c('0x73')](_0x2a5893['CmListId']['toString'](),_0xab2c('0x72'))[_0xab2c('0x73')](_0x2841ba['params']['id'][_0xab2c('0x76')](),_0xab2c('0x61'))[_0xab2c('0x73')](_0xab2c('0x74'),_0xab2c('0x56'))['field'](_0xab2c('0x74'),_0xab2c('0x57'))['from'](_0xab2c('0x78'))[_0xab2c('0x3f')](_0xab2c('0x7f'))[_0xab2c('0x3f')]('ListId\x20=\x20?',_0x2a5893['CmListId'][_0xab2c('0x76')]())['where'](_0xab2c('0x82')))[_0xab2c('0x76')]();_0x1738e9[_0xab2c('0x8b')](db[_0xab2c('0x8c')]['query'](_0x723416));}return BPromise[_0xab2c('0x8d')](_0x1738e9);}})[_0xab2c('0x29')](function(){return _0x290546;})[_0xab2c('0x29')](respondWithResult(_0x20d296,null))[_0xab2c('0x49')](handleError(_0x20d296,null));};exports[_0xab2c('0x94')]=function(_0x2382d3,_0x980b27,_0x25e148){return db[_0xab2c('0x32')][_0xab2c('0x52')]({'where':{'id':_0x2382d3['params']['id']}})[_0xab2c('0x29')](handleEntityNotFound(_0x980b27,null))['then'](function(_0x3aa18f){if(_0x3aa18f){return _0x3aa18f[_0xab2c('0x94')](_0x2382d3[_0xab2c('0x37')][_0xab2c('0x68')]);}})['then'](function(_0x15606a){if(_0x15606a){return db[_0xab2c('0x64')][_0xab2c('0x2a')]({'where':{'ListId':_0x2382d3[_0xab2c('0x37')]['ids'],'CampaignId':_0x2382d3[_0xab2c('0x4a')]['id']}})[_0xab2c('0x29')](function(){return _0x15606a;});}})[_0xab2c('0x29')](respondWithStatusCode(_0x980b27,null))[_0xab2c('0x49')](handleError(_0x980b27,null));}; \ No newline at end of file +var _0xb4c2=['UserProfileResource','error','stack','name','send','index','map','Campaign','fieldName','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','findAll','catch','show','params','keys','include','find','user','role','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','rawAttributes','includeAll','options','omit','updatedAt','body','createdAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','IvrCampaigns','UserProfileSection','destroy','getHoppers','findOne','CmHopper','order','CampaignId','rows','getHopperHistories','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','format','YYYY-MM-DD\x20HH:mm:ss','addLists','ids','spread','dialCheckDuplicateType','always','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','select','field','NOW()','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','toString','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','from','cm_hopper_final','CampaignId\x20=\x20?','onlyIfOpen','insert','into','COALESCE(phone,\x27\x27)','cm_hopper_additional_phones','cmHopperId','OrderBy','ci.OrderBY','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','CmList','addBlackLists','cm_hopper_black','removeBlackLists','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb4c2,0x19c));var _0x2b4c=function(_0x40723b,_0x1daabf){_0x40723b=_0x40723b-0x0;var _0x71179a=_0xb4c2[_0x40723b];return _0x71179a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2b4c('0x0'));var zipdir=require(_0x2b4c('0x1'));var jsonpatch=require(_0x2b4c('0x2'));var rp=require(_0x2b4c('0x3'));var moment=require(_0x2b4c('0x4'));var BPromise=require(_0x2b4c('0x5'));var Mustache=require(_0x2b4c('0x6'));var util=require(_0x2b4c('0x7'));var path=require(_0x2b4c('0x8'));var sox=require(_0x2b4c('0x9'));var csv=require(_0x2b4c('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2b4c('0xb'));var _=require('lodash');var squel=require(_0x2b4c('0xc'));var crypto=require('crypto');var jsforce=require(_0x2b4c('0xd'));var deskjs=require(_0x2b4c('0xe'));var toCsv=require('to-csv');var querystring=require(_0x2b4c('0xf'));var Papa=require(_0x2b4c('0x10'));var Redis=require(_0x2b4c('0x11'));var authService=require(_0x2b4c('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x2b4c('0x13'));var hardwareService=require(_0x2b4c('0x14'));var logger=require(_0x2b4c('0x15'))(_0x2b4c('0x16'));var utils=require(_0x2b4c('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x2b4c('0x18'));var db=require(_0x2b4c('0x19'))['db'];function respondWithStatusCode(_0x2650d0,_0x12ab59){_0x12ab59=_0x12ab59||0xcc;return function(_0x340de0){if(_0x340de0){return _0x2650d0[_0x2b4c('0x1a')](_0x12ab59);}return _0x2650d0[_0x2b4c('0x1b')](_0x12ab59)[_0x2b4c('0x1c')]();};}function respondWithResult(_0x323ebe,_0x425240){_0x425240=_0x425240||0xc8;return function(_0x52dc26){if(_0x52dc26){return _0x323ebe[_0x2b4c('0x1b')](_0x425240)[_0x2b4c('0x1d')](_0x52dc26);}};}function respondWithFilteredResult(_0x38c517,_0x2f6fd5){return function(_0x1e9508){if(_0x1e9508){var _0x7fcee9=typeof _0x2f6fd5[_0x2b4c('0x1e')]==='undefined'&&typeof _0x2f6fd5[_0x2b4c('0x1f')]===_0x2b4c('0x20');var _0x3fa354=_0x1e9508[_0x2b4c('0x21')];var _0x396824=_0x7fcee9?0x0:_0x2f6fd5[_0x2b4c('0x1e')];var _0x38d460=_0x7fcee9?_0x1e9508[_0x2b4c('0x21')]:_0x2f6fd5[_0x2b4c('0x1e')]+_0x2f6fd5[_0x2b4c('0x1f')];var _0x33fe96;if(_0x38d460>=_0x3fa354){_0x38d460=_0x3fa354;_0x33fe96=0xc8;}else{_0x33fe96=0xce;}_0x38c517[_0x2b4c('0x1b')](_0x33fe96);return _0x38c517[_0x2b4c('0x22')](_0x2b4c('0x23'),_0x396824+'-'+_0x38d460+'/'+_0x3fa354)[_0x2b4c('0x1d')](_0x1e9508);}return null;};}function patchUpdates(_0xb251){return function(_0x17a169){try{jsonpatch[_0x2b4c('0x24')](_0x17a169,_0xb251,!![]);}catch(_0x16bbbc){return BPromise[_0x2b4c('0x25')](_0x16bbbc);}return _0x17a169['save']();};}function saveUpdates(_0x830d7c,_0x3cb67b){return function(_0x2d268d){if(_0x2d268d){return _0x2d268d[_0x2b4c('0x26')](_0x830d7c)['then'](function(_0x2e3a06){return _0x2e3a06;});}return null;};}function removeEntity(_0x417a85,_0x5c437e){return function(_0x3bc9c1){if(_0x3bc9c1){return _0x3bc9c1['destroy']()[_0x2b4c('0x27')](function(){var _0x4aaac4=_0x3bc9c1[_0x2b4c('0x28')]({'plain':!![]});var _0x4e66ce='IvrCampaigns';return db[_0x2b4c('0x29')]['destroy']({'where':{'type':_0x4e66ce,'resourceId':_0x4aaac4['id']}})[_0x2b4c('0x27')](function(){return _0x3bc9c1;});})[_0x2b4c('0x27')](function(){_0x417a85[_0x2b4c('0x1b')](0xcc)[_0x2b4c('0x1c')]();});}};}function handleEntityNotFound(_0x2286f1,_0x4091ed){return function(_0x2a1db3){if(!_0x2a1db3){_0x2286f1['sendStatus'](0x194);}return _0x2a1db3;};}function handleError(_0x335aae,_0xf61db3){_0xf61db3=_0xf61db3||0x1f4;return function(_0xf77b17){logger[_0x2b4c('0x2a')](_0xf77b17[_0x2b4c('0x2b')]);if(_0xf77b17[_0x2b4c('0x2c')]){delete _0xf77b17[_0x2b4c('0x2c')];}_0x335aae[_0x2b4c('0x1b')](_0xf61db3)[_0x2b4c('0x2d')](_0xf77b17);};}exports[_0x2b4c('0x2e')]=function(_0x2636bd,_0x1c9a1b){var _0x17f15f={},_0x292a1b={},_0x481d3c={'count':0x0,'rows':[]};var _0x519280=_[_0x2b4c('0x2f')](db[_0x2b4c('0x30')]['rawAttributes'],function(_0x3b1b52){return{'name':_0x3b1b52[_0x2b4c('0x31')],'type':_0x3b1b52['type']['key']};});_0x292a1b[_0x2b4c('0x32')]=_[_0x2b4c('0x2f')](_0x519280,_0x2b4c('0x2c'));_0x292a1b[_0x2b4c('0x33')]=_['keys'](_0x2636bd[_0x2b4c('0x33')]);_0x292a1b[_0x2b4c('0x34')]=_[_0x2b4c('0x35')](_0x292a1b[_0x2b4c('0x32')],_0x292a1b[_0x2b4c('0x33')]);_0x17f15f[_0x2b4c('0x36')]=_[_0x2b4c('0x35')](_0x292a1b['model'],qs[_0x2b4c('0x37')](_0x2636bd[_0x2b4c('0x33')]['fields']));_0x17f15f[_0x2b4c('0x36')]=_0x17f15f[_0x2b4c('0x36')][_0x2b4c('0x38')]?_0x17f15f['attributes']:_0x292a1b[_0x2b4c('0x32')];if(!_0x2636bd[_0x2b4c('0x33')][_0x2b4c('0x39')](_0x2b4c('0x3a'))){_0x17f15f[_0x2b4c('0x1f')]=qs[_0x2b4c('0x1f')](_0x2636bd[_0x2b4c('0x33')][_0x2b4c('0x1f')]);_0x17f15f[_0x2b4c('0x1e')]=qs[_0x2b4c('0x1e')](_0x2636bd[_0x2b4c('0x33')][_0x2b4c('0x1e')]);}_0x17f15f['order']=qs[_0x2b4c('0x3b')](_0x2636bd[_0x2b4c('0x33')][_0x2b4c('0x3b')]);_0x17f15f[_0x2b4c('0x3c')]=qs[_0x2b4c('0x34')](_[_0x2b4c('0x3d')](_0x2636bd[_0x2b4c('0x33')],_0x292a1b[_0x2b4c('0x34')]),_0x519280);if(_0x2636bd[_0x2b4c('0x33')]['filter']){_0x17f15f['where']=_[_0x2b4c('0x3e')](_0x17f15f[_0x2b4c('0x3c')],{'$or':_['map'](_0x519280,function(_0xeef758){if(_0xeef758['type']!==_0x2b4c('0x3f')){var _0x16b4a9={};_0x16b4a9[_0xeef758[_0x2b4c('0x2c')]]={'$like':'%'+_0x2636bd[_0x2b4c('0x33')][_0x2b4c('0x40')]+'%'};return _0x16b4a9;}})});}_0x17f15f=_[_0x2b4c('0x3e')]({},_0x17f15f,_0x2636bd['options']);var _0x397a24={'where':_0x17f15f[_0x2b4c('0x3c')]};return db[_0x2b4c('0x30')][_0x2b4c('0x21')](_0x397a24)['then'](function(_0x12d558){_0x481d3c[_0x2b4c('0x21')]=_0x12d558;if(_0x2636bd['query']['includeAll']){_0x17f15f['include']=[{'all':!![]}];}return db['Campaign'][_0x2b4c('0x41')](_0x17f15f);})[_0x2b4c('0x27')](function(_0x3cf504){_0x481d3c['rows']=_0x3cf504;return _0x481d3c;})[_0x2b4c('0x27')](respondWithFilteredResult(_0x1c9a1b,_0x17f15f))[_0x2b4c('0x42')](handleError(_0x1c9a1b,null));};exports[_0x2b4c('0x43')]=function(_0x577c55,_0x4a3a1b){var _0x33cd5b={'raw':![],'where':{'id':_0x577c55[_0x2b4c('0x44')]['id']}},_0x212bd2={};_0x212bd2[_0x2b4c('0x32')]=_[_0x2b4c('0x45')](db['Campaign']['rawAttributes']);_0x212bd2[_0x2b4c('0x33')]=_[_0x2b4c('0x45')](_0x577c55[_0x2b4c('0x33')]);_0x212bd2[_0x2b4c('0x34')]=_[_0x2b4c('0x35')](_0x212bd2[_0x2b4c('0x32')],_0x212bd2['query']);_0x33cd5b[_0x2b4c('0x36')]=_[_0x2b4c('0x35')](_0x212bd2[_0x2b4c('0x32')],qs[_0x2b4c('0x37')](_0x577c55[_0x2b4c('0x33')][_0x2b4c('0x37')]));_0x33cd5b[_0x2b4c('0x36')]=_0x33cd5b[_0x2b4c('0x36')][_0x2b4c('0x38')]?_0x33cd5b[_0x2b4c('0x36')]:_0x212bd2[_0x2b4c('0x32')];if(_0x577c55[_0x2b4c('0x33')]['includeAll']){_0x33cd5b[_0x2b4c('0x46')]=[{'all':!![]}];}_0x33cd5b=_['merge']({},_0x33cd5b,_0x577c55['options']);return db[_0x2b4c('0x30')][_0x2b4c('0x47')](_0x33cd5b)['then'](handleEntityNotFound(_0x4a3a1b,null))[_0x2b4c('0x27')](respondWithResult(_0x4a3a1b,null))['catch'](handleError(_0x4a3a1b,null));};exports['create']=function(_0x38f932,_0x3d23a4){return db['Campaign']['create'](_0x38f932['body'],{})[_0x2b4c('0x27')](function(_0x58d505){var _0xa50b51=_0x38f932[_0x2b4c('0x48')][_0x2b4c('0x28')]({'plain':!![]});if(!_0xa50b51)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xa50b51[_0x2b4c('0x49')]==='user'){var _0x400267=_0x58d505[_0x2b4c('0x28')]({'plain':!![]});var _0x17fd1e='IvrCampaigns';return db['UserProfileSection'][_0x2b4c('0x47')]({'where':{'name':_0x17fd1e,'userProfileId':_0xa50b51[_0x2b4c('0x4a')]},'raw':!![]})['then'](function(_0x23e486){if(_0x23e486&&_0x23e486[_0x2b4c('0x4b')]===0x0){return db[_0x2b4c('0x29')][_0x2b4c('0x4c')]({'name':_0x400267['name'],'resourceId':_0x400267['id'],'type':_0x23e486[_0x2b4c('0x2c')],'sectionId':_0x23e486['id']},{})[_0x2b4c('0x27')](function(){return _0x58d505;});}else{return _0x58d505;}})[_0x2b4c('0x42')](function(_0x5f24f6){logger[_0x2b4c('0x2a')](_0x2b4c('0x4d'),_0x5f24f6);throw _0x5f24f6;});}return _0x58d505;})[_0x2b4c('0x27')](respondWithResult(_0x3d23a4,0xc9))['catch'](handleError(_0x3d23a4,null));};exports[_0x2b4c('0x4e')]=function(_0x135fbb,_0x415954){var _0x44f314={'where':{'id':_0x135fbb['params']['id']}},_0x275e2d={};_0x275e2d[_0x2b4c('0x32')]=_[_0x2b4c('0x45')](db['Campaign'][_0x2b4c('0x4f')]);_0x44f314[_0x2b4c('0x36')]=_[_0x2b4c('0x35')](_0x275e2d[_0x2b4c('0x32')],qs['fields'](_0x135fbb[_0x2b4c('0x33')][_0x2b4c('0x37')]));_0x44f314['attributes']=_0x44f314[_0x2b4c('0x36')][_0x2b4c('0x38')]?_0x44f314[_0x2b4c('0x36')]:_0x275e2d['model'];if(_0x135fbb[_0x2b4c('0x33')][_0x2b4c('0x50')]){_0x44f314[_0x2b4c('0x46')]=[{'all':!![]}];}_0x44f314=_['merge']({},_0x44f314,_0x135fbb[_0x2b4c('0x51')]);return db[_0x2b4c('0x30')][_0x2b4c('0x47')](_0x44f314)[_0x2b4c('0x27')](handleEntityNotFound(_0x415954,null))['then'](function(_0x37198c){if(_0x37198c){var _0x5cfa3c=_0x37198c['get']({'plain':!![]});_0x5cfa3c=qs[_0x2b4c('0x52')](_0x5cfa3c,['id','createdAt',_0x2b4c('0x53')]);_0x135fbb[_0x2b4c('0x54')]=_[_0x2b4c('0x52')](_0x135fbb[_0x2b4c('0x54')],['id',_0x2b4c('0x55'),_0x2b4c('0x53')]);return db[_0x2b4c('0x30')][_0x2b4c('0x4c')](_['merge'](_0x5cfa3c,_0x135fbb[_0x2b4c('0x54')]),{'include':_0x135fbb[_0x2b4c('0x33')]['includeAll']?[{'all':!![]}]:undefined})[_0x2b4c('0x27')](function(_0x2a2244){var _0x2bcb95=_0x135fbb[_0x2b4c('0x48')][_0x2b4c('0x28')]({'plain':!![]});if(!_0x2bcb95)throw new Error(_0x2b4c('0x56'));if(_0x2bcb95['role']===_0x2b4c('0x48')){var _0x188e8b=_0x2a2244[_0x2b4c('0x28')]({'plain':!![]});var _0xf9e4c2=_0x2b4c('0x57');return db[_0x2b4c('0x58')][_0x2b4c('0x47')]({'where':{'name':_0xf9e4c2,'userProfileId':_0x2bcb95[_0x2b4c('0x4a')]},'raw':!![]})[_0x2b4c('0x27')](function(_0x356463){if(_0x356463&&_0x356463[_0x2b4c('0x4b')]===0x0){return db[_0x2b4c('0x29')]['create']({'name':_0x188e8b['name'],'resourceId':_0x188e8b['id'],'type':_0x356463[_0x2b4c('0x2c')],'sectionId':_0x356463['id']},{})['then'](function(){return _0x2a2244;});}else{return _0x2a2244;}})[_0x2b4c('0x42')](function(_0x5e67e5){logger[_0x2b4c('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5e67e5);throw _0x5e67e5;});}return _0x2a2244;});}})['then'](respondWithResult(_0x415954,0xc9))[_0x2b4c('0x42')](handleError(_0x415954,null));};exports[_0x2b4c('0x26')]=function(_0x403c92,_0x1df7fa){if(_0x403c92[_0x2b4c('0x54')]['id']){delete _0x403c92['body']['id'];}return db[_0x2b4c('0x30')]['find']({'where':{'id':_0x403c92[_0x2b4c('0x44')]['id']}})[_0x2b4c('0x27')](handleEntityNotFound(_0x1df7fa,null))['then'](saveUpdates(_0x403c92['body'],null))[_0x2b4c('0x27')](respondWithResult(_0x1df7fa,null))['catch'](handleError(_0x1df7fa,null));};exports[_0x2b4c('0x59')]=function(_0x4f53d6,_0x51fb59){return db[_0x2b4c('0x30')][_0x2b4c('0x47')]({'where':{'id':_0x4f53d6[_0x2b4c('0x44')]['id']}})[_0x2b4c('0x27')](handleEntityNotFound(_0x51fb59,null))[_0x2b4c('0x27')](removeEntity(_0x51fb59,null))['catch'](handleError(_0x51fb59,null));};exports[_0x2b4c('0x5a')]=function(_0x45a485,_0x1c417f,_0x28f664){var _0x4351b2={'raw':!![],'where':{}};var _0xa0162c={};var _0x1863d2={'count':0x0,'rows':[]};return db[_0x2b4c('0x30')][_0x2b4c('0x5b')]({'where':{'id':_0x45a485['params']['id']}})[_0x2b4c('0x27')](handleEntityNotFound(_0x1c417f,null))[_0x2b4c('0x27')](function(_0x5aab5e){if(_0x5aab5e){_0xa0162c[_0x2b4c('0x32')]=_[_0x2b4c('0x45')](db[_0x2b4c('0x5c')][_0x2b4c('0x4f')]);_0xa0162c[_0x2b4c('0x33')]=_[_0x2b4c('0x45')](_0x45a485[_0x2b4c('0x33')]);_0xa0162c[_0x2b4c('0x34')]=_[_0x2b4c('0x35')](_0xa0162c[_0x2b4c('0x32')],_0xa0162c[_0x2b4c('0x33')]);_0x4351b2['attributes']=_['intersection'](_0xa0162c[_0x2b4c('0x32')],qs[_0x2b4c('0x37')](_0x45a485[_0x2b4c('0x33')][_0x2b4c('0x37')]));_0x4351b2[_0x2b4c('0x36')]=_0x4351b2['attributes'][_0x2b4c('0x38')]?_0x4351b2[_0x2b4c('0x36')]:_0xa0162c[_0x2b4c('0x32')];if(!_0x45a485['query'][_0x2b4c('0x39')](_0x2b4c('0x3a'))){_0x4351b2[_0x2b4c('0x1f')]=qs[_0x2b4c('0x1f')](_0x45a485[_0x2b4c('0x33')][_0x2b4c('0x1f')]);_0x4351b2[_0x2b4c('0x1e')]=qs[_0x2b4c('0x1e')](_0x45a485['query'][_0x2b4c('0x1e')]);}_0x4351b2[_0x2b4c('0x5d')]=qs[_0x2b4c('0x3b')](_0x45a485[_0x2b4c('0x33')][_0x2b4c('0x3b')]);_0x4351b2['where']=qs[_0x2b4c('0x34')](_[_0x2b4c('0x3d')](_0x45a485[_0x2b4c('0x33')],_0xa0162c['filters']));_0x4351b2['where'][_0x2b4c('0x5e')]=_0x5aab5e['id'];if(_0x45a485['query'][_0x2b4c('0x40')]){_0x4351b2[_0x2b4c('0x3c')]=_['merge'](_0x4351b2[_0x2b4c('0x3c')],{'$or':_['map'](_0x4351b2[_0x2b4c('0x36')],function(_0x279c39){var _0x5d8c6a={};_0x5d8c6a[_0x279c39]={'$like':'%'+_0x45a485[_0x2b4c('0x33')]['filter']+'%'};return _0x5d8c6a;})});}_0x4351b2=_['merge']({},_0x4351b2,_0x45a485[_0x2b4c('0x51')]);return db['CmHopper']['count']({'where':_0x4351b2[_0x2b4c('0x3c')]})[_0x2b4c('0x27')](function(_0x2cdf3f){_0x1863d2['count']=_0x2cdf3f;if(_0x45a485[_0x2b4c('0x33')][_0x2b4c('0x50')]){_0x4351b2[_0x2b4c('0x46')]=[{'all':!![]}];}return db[_0x2b4c('0x5c')][_0x2b4c('0x41')](_0x4351b2);})[_0x2b4c('0x27')](function(_0x3b1f83){_0x1863d2[_0x2b4c('0x5f')]=_0x3b1f83;return _0x1863d2;});}})[_0x2b4c('0x27')](respondWithFilteredResult(_0x1c417f,_0x4351b2))[_0x2b4c('0x42')](handleError(_0x1c417f,null));};exports[_0x2b4c('0x60')]=function(_0x3f4bfb,_0x1e7e5d,_0x1f6d00){var _0x1989b7={'raw':!![],'where':{}};var _0x492617={};var _0x5c2886={'count':0x0,'rows':[]};return db[_0x2b4c('0x30')][_0x2b4c('0x5b')]({'where':{'id':_0x3f4bfb['params']['id']}})[_0x2b4c('0x27')](handleEntityNotFound(_0x1e7e5d,null))[_0x2b4c('0x27')](function(_0x263e67){if(_0x263e67){_0x492617[_0x2b4c('0x32')]=_[_0x2b4c('0x45')](db[_0x2b4c('0x61')]['rawAttributes']);_0x492617[_0x2b4c('0x33')]=_[_0x2b4c('0x45')](_0x3f4bfb[_0x2b4c('0x33')]);_0x492617[_0x2b4c('0x34')]=_[_0x2b4c('0x35')](_0x492617[_0x2b4c('0x32')],_0x492617['query']);_0x1989b7[_0x2b4c('0x36')]=_[_0x2b4c('0x35')](_0x492617[_0x2b4c('0x32')],qs['fields'](_0x3f4bfb[_0x2b4c('0x33')][_0x2b4c('0x37')]));_0x1989b7[_0x2b4c('0x36')]=_0x1989b7[_0x2b4c('0x36')][_0x2b4c('0x38')]?_0x1989b7['attributes']:_0x492617['model'];if(!_0x3f4bfb[_0x2b4c('0x33')][_0x2b4c('0x39')](_0x2b4c('0x3a'))){_0x1989b7['limit']=qs['limit'](_0x3f4bfb[_0x2b4c('0x33')][_0x2b4c('0x1f')]);_0x1989b7[_0x2b4c('0x1e')]=qs[_0x2b4c('0x1e')](_0x3f4bfb[_0x2b4c('0x33')]['offset']);}_0x1989b7[_0x2b4c('0x5d')]=qs[_0x2b4c('0x3b')](_0x3f4bfb['query'][_0x2b4c('0x3b')]);_0x1989b7[_0x2b4c('0x3c')]=qs[_0x2b4c('0x34')](_[_0x2b4c('0x3d')](_0x3f4bfb['query'],_0x492617[_0x2b4c('0x34')]));_0x1989b7['where'][_0x2b4c('0x5e')]=_0x263e67['id'];if(_0x3f4bfb[_0x2b4c('0x33')][_0x2b4c('0x40')]){_0x1989b7['where']=_[_0x2b4c('0x3e')](_0x1989b7[_0x2b4c('0x3c')],{'$or':_[_0x2b4c('0x2f')](_0x1989b7[_0x2b4c('0x36')],function(_0x32fa33){var _0x452f29={};_0x452f29[_0x32fa33]={'$like':'%'+_0x3f4bfb[_0x2b4c('0x33')]['filter']+'%'};return _0x452f29;})});}_0x1989b7=_[_0x2b4c('0x3e')]({},_0x1989b7,_0x3f4bfb['options']);return db[_0x2b4c('0x61')][_0x2b4c('0x21')]({'where':_0x1989b7[_0x2b4c('0x3c')]})[_0x2b4c('0x27')](function(_0x2b560d){_0x5c2886[_0x2b4c('0x21')]=_0x2b560d;if(_0x3f4bfb[_0x2b4c('0x33')][_0x2b4c('0x50')]){_0x1989b7['include']=[{'all':!![]}];}return db[_0x2b4c('0x61')]['findAll'](_0x1989b7);})['then'](function(_0x3e290b){_0x5c2886['rows']=_0x3e290b;return _0x5c2886;});}})[_0x2b4c('0x27')](respondWithFilteredResult(_0x1e7e5d,_0x1989b7))[_0x2b4c('0x42')](handleError(_0x1e7e5d,null));};exports['getHopperFinals']=function(_0x43ca12,_0x198308,_0x4d3611){var _0x562117={'raw':!![],'where':{}};var _0x3e8bf1={};var _0x5bf78c={'count':0x0,'rows':[]};return db[_0x2b4c('0x30')]['findOne']({'where':{'id':_0x43ca12[_0x2b4c('0x44')]['id']}})[_0x2b4c('0x27')](handleEntityNotFound(_0x198308,null))[_0x2b4c('0x27')](function(_0x3e4b48){if(_0x3e4b48){_0x3e8bf1['model']=_[_0x2b4c('0x45')](db[_0x2b4c('0x62')][_0x2b4c('0x4f')]);_0x3e8bf1[_0x2b4c('0x33')]=_[_0x2b4c('0x45')](_0x43ca12[_0x2b4c('0x33')]);_0x3e8bf1[_0x2b4c('0x34')]=_[_0x2b4c('0x35')](_0x3e8bf1[_0x2b4c('0x32')],_0x3e8bf1[_0x2b4c('0x33')]);_0x562117[_0x2b4c('0x36')]=_[_0x2b4c('0x35')](_0x3e8bf1[_0x2b4c('0x32')],qs[_0x2b4c('0x37')](_0x43ca12['query']['fields']));_0x562117[_0x2b4c('0x36')]=_0x562117[_0x2b4c('0x36')]['length']?_0x562117[_0x2b4c('0x36')]:_0x3e8bf1[_0x2b4c('0x32')];if(!_0x43ca12[_0x2b4c('0x33')][_0x2b4c('0x39')](_0x2b4c('0x3a'))){_0x562117[_0x2b4c('0x1f')]=qs['limit'](_0x43ca12[_0x2b4c('0x33')][_0x2b4c('0x1f')]);_0x562117[_0x2b4c('0x1e')]=qs['offset'](_0x43ca12[_0x2b4c('0x33')][_0x2b4c('0x1e')]);}_0x562117[_0x2b4c('0x5d')]=qs[_0x2b4c('0x3b')](_0x43ca12[_0x2b4c('0x33')][_0x2b4c('0x3b')]);_0x562117['where']=qs['filters'](_['pick'](_0x43ca12[_0x2b4c('0x33')],_0x3e8bf1[_0x2b4c('0x34')]));_0x562117[_0x2b4c('0x3c')]['CampaignId']=_0x3e4b48['id'];if(_0x43ca12[_0x2b4c('0x33')]['filter']){_0x562117['where']=_[_0x2b4c('0x3e')](_0x562117['where'],{'$or':_['map'](_0x562117[_0x2b4c('0x36')],function(_0x40da30){var _0x48f6bf={};_0x48f6bf[_0x40da30]={'$like':'%'+_0x43ca12[_0x2b4c('0x33')][_0x2b4c('0x40')]+'%'};return _0x48f6bf;})});}_0x562117=_[_0x2b4c('0x3e')]({},_0x562117,_0x43ca12[_0x2b4c('0x51')]);return db['CmHopperFinal'][_0x2b4c('0x21')]({'where':_0x562117[_0x2b4c('0x3c')]})['then'](function(_0x15cbc4){_0x5bf78c[_0x2b4c('0x21')]=_0x15cbc4;if(_0x43ca12[_0x2b4c('0x33')][_0x2b4c('0x50')]){_0x562117[_0x2b4c('0x46')]=[{'all':!![]}];}return db[_0x2b4c('0x62')][_0x2b4c('0x41')](_0x562117);})['then'](function(_0x59b808){_0x5bf78c[_0x2b4c('0x5f')]=_0x59b808;return _0x5bf78c;});}})[_0x2b4c('0x27')](respondWithFilteredResult(_0x198308,_0x562117))['catch'](handleError(_0x198308,null));};exports[_0x2b4c('0x63')]=function(_0x21c2e4,_0x164374,_0x87fef8){var _0x2dc36d={'raw':!![],'where':{}};var _0x13f176={};var _0x3c91c0={'count':0x0,'rows':[]};return db[_0x2b4c('0x30')][_0x2b4c('0x5b')]({'where':{'id':_0x21c2e4['params']['id']}})[_0x2b4c('0x27')](handleEntityNotFound(_0x164374,null))[_0x2b4c('0x27')](function(_0xd43bbb){if(_0xd43bbb){_0x13f176[_0x2b4c('0x32')]=_[_0x2b4c('0x45')](db['CmHopperBlack'][_0x2b4c('0x4f')]);_0x13f176[_0x2b4c('0x33')]=_[_0x2b4c('0x45')](_0x21c2e4[_0x2b4c('0x33')]);_0x13f176[_0x2b4c('0x34')]=_[_0x2b4c('0x35')](_0x13f176[_0x2b4c('0x32')],_0x13f176['query']);_0x2dc36d[_0x2b4c('0x36')]=_[_0x2b4c('0x35')](_0x13f176['model'],qs[_0x2b4c('0x37')](_0x21c2e4[_0x2b4c('0x33')][_0x2b4c('0x37')]));_0x2dc36d[_0x2b4c('0x36')]=_0x2dc36d[_0x2b4c('0x36')][_0x2b4c('0x38')]?_0x2dc36d['attributes']:_0x13f176['model'];if(!_0x21c2e4['query']['hasOwnProperty'](_0x2b4c('0x3a'))){_0x2dc36d[_0x2b4c('0x1f')]=qs[_0x2b4c('0x1f')](_0x21c2e4[_0x2b4c('0x33')][_0x2b4c('0x1f')]);_0x2dc36d[_0x2b4c('0x1e')]=qs[_0x2b4c('0x1e')](_0x21c2e4[_0x2b4c('0x33')]['offset']);}_0x2dc36d['order']=qs['sort'](_0x21c2e4['query'][_0x2b4c('0x3b')]);_0x2dc36d[_0x2b4c('0x3c')]=qs['filters'](_['pick'](_0x21c2e4[_0x2b4c('0x33')],_0x13f176[_0x2b4c('0x34')]));_0x2dc36d[_0x2b4c('0x3c')][_0x2b4c('0x5e')]=_0xd43bbb['id'];if(_0x21c2e4[_0x2b4c('0x33')][_0x2b4c('0x40')]){_0x2dc36d[_0x2b4c('0x3c')]=_[_0x2b4c('0x3e')](_0x2dc36d[_0x2b4c('0x3c')],{'$or':_['map'](_0x2dc36d[_0x2b4c('0x36')],function(_0x4e309e){var _0x4f0e57={};_0x4f0e57[_0x4e309e]={'$like':'%'+_0x21c2e4[_0x2b4c('0x33')][_0x2b4c('0x40')]+'%'};return _0x4f0e57;})});}_0x2dc36d=_[_0x2b4c('0x3e')]({},_0x2dc36d,_0x21c2e4[_0x2b4c('0x51')]);return db[_0x2b4c('0x64')][_0x2b4c('0x21')]({'where':_0x2dc36d[_0x2b4c('0x3c')]})[_0x2b4c('0x27')](function(_0x16ca4b){_0x3c91c0[_0x2b4c('0x21')]=_0x16ca4b;if(_0x21c2e4['query'][_0x2b4c('0x50')]){_0x2dc36d[_0x2b4c('0x46')]=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x2dc36d);})[_0x2b4c('0x27')](function(_0x13d7fb){_0x3c91c0[_0x2b4c('0x5f')]=_0x13d7fb;return _0x3c91c0;});}})[_0x2b4c('0x27')](respondWithFilteredResult(_0x164374,_0x2dc36d))[_0x2b4c('0x42')](handleError(_0x164374,null));};exports[_0x2b4c('0x65')]=function(_0x4a5677,_0x3ae159,_0x2ff4a3){var _0x30dbdc={};var _0x4dc6ae={};var _0x19eef6;var _0x392faa;return db[_0x2b4c('0x30')][_0x2b4c('0x5b')]({'where':{'id':_0x4a5677['params']['id']}})[_0x2b4c('0x27')](handleEntityNotFound(_0x3ae159,null))[_0x2b4c('0x27')](function(_0x32cd35){if(_0x32cd35){_0x19eef6=_0x32cd35;_0x4dc6ae['model']=_[_0x2b4c('0x45')](db['CmList'][_0x2b4c('0x4f')]);_0x4dc6ae[_0x2b4c('0x33')]=_[_0x2b4c('0x45')](_0x4a5677[_0x2b4c('0x33')]);_0x4dc6ae['filters']=_['intersection'](_0x4dc6ae[_0x2b4c('0x32')],_0x4dc6ae[_0x2b4c('0x33')]);_0x30dbdc[_0x2b4c('0x36')]=_[_0x2b4c('0x35')](_0x4dc6ae[_0x2b4c('0x32')],qs[_0x2b4c('0x37')](_0x4a5677['query'][_0x2b4c('0x37')]));_0x30dbdc[_0x2b4c('0x36')]=_0x30dbdc[_0x2b4c('0x36')][_0x2b4c('0x38')]?_0x30dbdc[_0x2b4c('0x36')]:_0x4dc6ae[_0x2b4c('0x32')];_0x30dbdc[_0x2b4c('0x5d')]=qs['sort'](_0x4a5677[_0x2b4c('0x33')][_0x2b4c('0x3b')]);_0x30dbdc[_0x2b4c('0x3c')]=qs[_0x2b4c('0x34')](_[_0x2b4c('0x3d')](_0x4a5677[_0x2b4c('0x33')],_0x4dc6ae[_0x2b4c('0x34')]));if(_0x4a5677['query'][_0x2b4c('0x40')]){_0x30dbdc[_0x2b4c('0x3c')]=_[_0x2b4c('0x3e')](_0x30dbdc['where'],{'$or':_['map'](_0x30dbdc[_0x2b4c('0x36')],function(_0x34d361){var _0x4ffbe8={};_0x4ffbe8[_0x34d361]={'$like':'%'+_0x4a5677[_0x2b4c('0x33')][_0x2b4c('0x40')]+'%'};return _0x4ffbe8;})});}_0x30dbdc=_['merge']({},_0x30dbdc,_0x4a5677[_0x2b4c('0x51')]);return _0x19eef6[_0x2b4c('0x65')](_0x30dbdc);}})[_0x2b4c('0x27')](function(_0x393a3d){if(_0x393a3d){_0x392faa=_0x393a3d['length'];if(!_0x4a5677[_0x2b4c('0x33')][_0x2b4c('0x39')]('nolimit')){_0x30dbdc['limit']=qs['limit'](_0x4a5677[_0x2b4c('0x33')][_0x2b4c('0x1f')]);_0x30dbdc['offset']=qs['offset'](_0x4a5677[_0x2b4c('0x33')]['offset']);}return _0x19eef6['getLists'](_0x30dbdc);}})[_0x2b4c('0x27')](function(_0x1ac546){if(_0x1ac546){return _0x1ac546?{'count':_0x392faa,'rows':_0x1ac546}:null;}})[_0x2b4c('0x27')](respondWithResult(_0x3ae159,null))[_0x2b4c('0x42')](handleError(_0x3ae159,null));};exports['addLists']=function(_0x45a64a,_0xd0b704,_0x2c54a4){var _0x1ec072,_0x186b24;var _0xef442b=[];var _0x5f2ebe=moment()[_0x2b4c('0x66')](_0x2b4c('0x67'));return db['Campaign'][_0x2b4c('0x47')]({'where':{'id':_0x45a64a[_0x2b4c('0x44')]['id']}})[_0x2b4c('0x27')](handleEntityNotFound(_0xd0b704,null))[_0x2b4c('0x27')](function(_0x3f1010){if(_0x3f1010){_0x186b24=_0x3f1010;return _0x3f1010[_0x2b4c('0x68')](_0x45a64a[_0x2b4c('0x54')]['ids'],_[_0x2b4c('0x52')](_0x45a64a[_0x2b4c('0x54')],[_0x2b4c('0x69'),'id'])||{});}return null;})[_0x2b4c('0x6a')](function(_0x39b214){var _0x47f21b;var _0x3f1733;_0x1ec072=_0x39b214||[];var _0x4b56c8=[];if(_0x39b214){for(var _0x5934cc=0x0;_0x5934cc<_0x39b214[_0x2b4c('0x38')];_0x5934cc+=0x1){var _0x5b6f67=_0x39b214[_0x5934cc][_0x2b4c('0x28')]({'plain':!![]});_0x186b24[_0x2b4c('0x6b')]=_0x45a64a[_0x2b4c('0x54')][_0x2b4c('0x6b')]?_0x45a64a[_0x2b4c('0x54')]['dialCheckDuplicateType']:_0x186b24[_0x2b4c('0x6b')];switch(_0x186b24[_0x2b4c('0x6b')]){case _0x2b4c('0x6c'):_0x47f21b=squel['insert']()['into'](_0x2b4c('0x6d'))[_0x2b4c('0x6e')]([_0x2b4c('0x6f'),_0x2b4c('0x70'),_0x2b4c('0x71'),_0x2b4c('0x72'),_0x2b4c('0x5e'),_0x2b4c('0x55'),_0x2b4c('0x53')],squel[_0x2b4c('0x73')]()[_0x2b4c('0x74')](_0x2b4c('0x6f'),_0x2b4c('0x6f'))[_0x2b4c('0x74')](_0x2b4c('0x75'),'scheduledAt')[_0x2b4c('0x74')]('id','ContactId')[_0x2b4c('0x74')](_0x5b6f67['CmListId']['toString'](),_0x2b4c('0x72'))[_0x2b4c('0x74')](_0x45a64a['params']['id']['toString'](),_0x2b4c('0x5e'))[_0x2b4c('0x74')]('\x27'+_0x5f2ebe+'\x27',_0x2b4c('0x55'))[_0x2b4c('0x74')]('\x27'+_0x5f2ebe+'\x27',_0x2b4c('0x53'))['from'](_0x2b4c('0x76'))['where'](_0x2b4c('0x77'))[_0x2b4c('0x3c')](_0x2b4c('0x78'),_0x5b6f67[_0x2b4c('0x79')][_0x2b4c('0x7a')]())[_0x2b4c('0x3c')](_0x2b4c('0x7b'))[_0x2b4c('0x3c')](_0x2b4c('0x7c'),squel['select']()[_0x2b4c('0x74')](_0x2b4c('0x7d'))[_0x2b4c('0x7e')](_0x2b4c('0x7f'))[_0x2b4c('0x3c')]('CampaignId\x20=\x20?',_0x45a64a[_0x2b4c('0x44')]['id'][_0x2b4c('0x7a')]()))[_0x2b4c('0x3c')](_0x2b4c('0x7c'),squel['select']()[_0x2b4c('0x74')]('COALESCE(phone,\x27\x27)')['from'](_0x2b4c('0x6d'))['where'](_0x2b4c('0x80'),_0x45a64a['params']['id'][_0x2b4c('0x7a')]())))[_0x2b4c('0x7a')]();break;case _0x2b4c('0x81'):_0x47f21b=squel[_0x2b4c('0x82')]()[_0x2b4c('0x83')](_0x2b4c('0x6d'))[_0x2b4c('0x6e')]([_0x2b4c('0x6f'),_0x2b4c('0x70'),'ContactId','ListId',_0x2b4c('0x5e'),'createdAt','updatedAt'],squel[_0x2b4c('0x73')]()[_0x2b4c('0x74')](_0x2b4c('0x6f'),_0x2b4c('0x6f'))['field'](_0x2b4c('0x75'),'scheduledAt')[_0x2b4c('0x74')]('id',_0x2b4c('0x71'))[_0x2b4c('0x74')](_0x5b6f67[_0x2b4c('0x79')][_0x2b4c('0x7a')](),_0x2b4c('0x72'))['field'](_0x45a64a[_0x2b4c('0x44')]['id']['toString'](),_0x2b4c('0x5e'))[_0x2b4c('0x74')]('\x27'+_0x5f2ebe+'\x27',_0x2b4c('0x55'))[_0x2b4c('0x74')]('\x27'+_0x5f2ebe+'\x27',_0x2b4c('0x53'))[_0x2b4c('0x7e')](_0x2b4c('0x76'))[_0x2b4c('0x3c')]('deletedAt\x20IS\x20NULL')[_0x2b4c('0x3c')](_0x2b4c('0x78'),_0x5b6f67[_0x2b4c('0x79')][_0x2b4c('0x7a')]())[_0x2b4c('0x3c')](_0x2b4c('0x7b'))[_0x2b4c('0x3c')](_0x2b4c('0x7c'),squel[_0x2b4c('0x73')]()[_0x2b4c('0x74')](_0x2b4c('0x84'))[_0x2b4c('0x7e')]('cm_hopper')['where'](_0x2b4c('0x80'),_0x45a64a[_0x2b4c('0x44')]['id']['toString']())))[_0x2b4c('0x7a')]();break;default:_0x47f21b=squel[_0x2b4c('0x82')]()[_0x2b4c('0x83')](_0x2b4c('0x6d'))[_0x2b4c('0x6e')]([_0x2b4c('0x6f'),'scheduledAt',_0x2b4c('0x71'),_0x2b4c('0x72'),_0x2b4c('0x5e'),'createdAt',_0x2b4c('0x53')],squel[_0x2b4c('0x73')]()[_0x2b4c('0x74')](_0x2b4c('0x6f'),_0x2b4c('0x6f'))[_0x2b4c('0x74')](_0x2b4c('0x75'),_0x2b4c('0x70'))[_0x2b4c('0x74')]('id',_0x2b4c('0x71'))[_0x2b4c('0x74')](_0x5b6f67[_0x2b4c('0x79')][_0x2b4c('0x7a')](),_0x2b4c('0x72'))[_0x2b4c('0x74')](_0x45a64a[_0x2b4c('0x44')]['id'][_0x2b4c('0x7a')](),_0x2b4c('0x5e'))[_0x2b4c('0x74')]('\x27'+_0x5f2ebe+'\x27',_0x2b4c('0x55'))[_0x2b4c('0x74')]('\x27'+_0x5f2ebe+'\x27','updatedAt')[_0x2b4c('0x7e')](_0x2b4c('0x76'))['where'](_0x2b4c('0x77'))[_0x2b4c('0x3c')]('ListId\x20=\x20?',_0x5b6f67[_0x2b4c('0x79')][_0x2b4c('0x7a')]())['where'](_0x2b4c('0x7b')))[_0x2b4c('0x7a')]();}_0x3f1733=squel[_0x2b4c('0x82')]()[_0x2b4c('0x83')](_0x2b4c('0x85'))[_0x2b4c('0x6e')]([_0x2b4c('0x86'),_0x2b4c('0x70'),'phone',_0x2b4c('0x87'),'createdAt','updatedAt'],squel[_0x2b4c('0x73')]()[_0x2b4c('0x74')]('h.id','id')[_0x2b4c('0x74')](_0x2b4c('0x75'),'scheduledAt')[_0x2b4c('0x74')]('ci.item',_0x2b4c('0x6f'))[_0x2b4c('0x74')](_0x2b4c('0x88'),_0x2b4c('0x87'))[_0x2b4c('0x74')]('\x27'+_0x5f2ebe+'\x27',_0x2b4c('0x55'))[_0x2b4c('0x74')]('\x27'+_0x5f2ebe+'\x27',_0x2b4c('0x53'))['from'](_0x2b4c('0x89'),'ci')[_0x2b4c('0x8a')](_0x2b4c('0x6d'),'h',_0x2b4c('0x8b'))[_0x2b4c('0x3c')](_0x2b4c('0x8c'),_0x5b6f67[_0x2b4c('0x79')][_0x2b4c('0x7a')]())[_0x2b4c('0x3c')]('h.CampaignId=?',_0x45a64a['params']['id'][_0x2b4c('0x7a')]())[_0x2b4c('0x3c')](_0x2b4c('0x8d'),_0x5f2ebe))[_0x2b4c('0x7a')]();_0x4b56c8['push'](db['sequelize'][_0x2b4c('0x33')](_0x47f21b));_0xef442b[_0x2b4c('0x8e')](db[_0x2b4c('0x8f')]['query'](_0x3f1733));}return BPromise[_0x2b4c('0x90')](_0x4b56c8);}})[_0x2b4c('0x27')](function(){return BPromise[_0x2b4c('0x90')](_0xef442b);})[_0x2b4c('0x27')](function(){return _0x1ec072;})['then'](respondWithResult(_0xd0b704,null))[_0x2b4c('0x42')](handleError(_0xd0b704,null));};exports[_0x2b4c('0x91')]=function(_0x1b026c,_0x5423e3,_0x150231){return db[_0x2b4c('0x30')][_0x2b4c('0x47')]({'where':{'id':_0x1b026c[_0x2b4c('0x44')]['id']}})[_0x2b4c('0x27')](handleEntityNotFound(_0x5423e3,null))[_0x2b4c('0x27')](function(_0xcd273d){if(_0xcd273d){return _0xcd273d['removeLists'](_0x1b026c[_0x2b4c('0x33')][_0x2b4c('0x69')]);}})['then'](function(_0x634897){if(_0x634897){return db[_0x2b4c('0x5c')][_0x2b4c('0x59')]({'where':{'ListId':_0x1b026c['query'][_0x2b4c('0x69')],'CampaignId':_0x1b026c[_0x2b4c('0x44')]['id']}})[_0x2b4c('0x27')](function(){return _0x634897;});}})[_0x2b4c('0x27')](respondWithStatusCode(_0x5423e3,null))[_0x2b4c('0x42')](handleError(_0x5423e3,null));};exports[_0x2b4c('0x92')]=function(_0x3d2c6d,_0x5ce129,_0x5e3a73){var _0x55c5c8={};var _0x43d388={};var _0x5e9dd6;var _0x72c91c;return db[_0x2b4c('0x30')][_0x2b4c('0x5b')]({'where':{'id':_0x3d2c6d[_0x2b4c('0x44')]['id']}})[_0x2b4c('0x27')](handleEntityNotFound(_0x5ce129,null))['then'](function(_0x1884fb){if(_0x1884fb){_0x5e9dd6=_0x1884fb;_0x43d388['model']=_['keys'](db[_0x2b4c('0x93')][_0x2b4c('0x4f')]);_0x43d388['query']=_[_0x2b4c('0x45')](_0x3d2c6d[_0x2b4c('0x33')]);_0x43d388[_0x2b4c('0x34')]=_['intersection'](_0x43d388[_0x2b4c('0x32')],_0x43d388[_0x2b4c('0x33')]);_0x55c5c8[_0x2b4c('0x36')]=_[_0x2b4c('0x35')](_0x43d388[_0x2b4c('0x32')],qs[_0x2b4c('0x37')](_0x3d2c6d['query']['fields']));_0x55c5c8[_0x2b4c('0x36')]=_0x55c5c8[_0x2b4c('0x36')]['length']?_0x55c5c8[_0x2b4c('0x36')]:_0x43d388[_0x2b4c('0x32')];_0x55c5c8[_0x2b4c('0x5d')]=qs[_0x2b4c('0x3b')](_0x3d2c6d['query'][_0x2b4c('0x3b')]);_0x55c5c8[_0x2b4c('0x3c')]=qs[_0x2b4c('0x34')](_[_0x2b4c('0x3d')](_0x3d2c6d[_0x2b4c('0x33')],_0x43d388[_0x2b4c('0x34')]));if(_0x3d2c6d['query'][_0x2b4c('0x40')]){_0x55c5c8[_0x2b4c('0x3c')]=_[_0x2b4c('0x3e')](_0x55c5c8['where'],{'$or':_[_0x2b4c('0x2f')](_0x55c5c8[_0x2b4c('0x36')],function(_0x34e723){var _0x466a72={};_0x466a72[_0x34e723]={'$like':'%'+_0x3d2c6d[_0x2b4c('0x33')][_0x2b4c('0x40')]+'%'};return _0x466a72;})});}_0x55c5c8=_['merge']({},_0x55c5c8,_0x3d2c6d[_0x2b4c('0x51')]);return _0x5e9dd6[_0x2b4c('0x92')](_0x55c5c8);}})[_0x2b4c('0x27')](function(_0x38262f){if(_0x38262f){_0x72c91c=_0x38262f['length'];if(!_0x3d2c6d[_0x2b4c('0x33')][_0x2b4c('0x39')](_0x2b4c('0x3a'))){_0x55c5c8[_0x2b4c('0x1f')]=qs[_0x2b4c('0x1f')](_0x3d2c6d['query']['limit']);_0x55c5c8[_0x2b4c('0x1e')]=qs[_0x2b4c('0x1e')](_0x3d2c6d[_0x2b4c('0x33')][_0x2b4c('0x1e')]);}return _0x5e9dd6[_0x2b4c('0x92')](_0x55c5c8);}})[_0x2b4c('0x27')](function(_0x4512b9){if(_0x4512b9){return _0x4512b9?{'count':_0x72c91c,'rows':_0x4512b9}:null;}})['then'](respondWithResult(_0x5ce129,null))['catch'](handleError(_0x5ce129,null));};exports[_0x2b4c('0x94')]=function(_0x2cecbb,_0x379c46,_0x5dd6ec){var _0x3c50c3,_0x2d9b0f;var _0x2a268a=[];var _0x27046b=moment()[_0x2b4c('0x66')](_0x2b4c('0x67'));return db[_0x2b4c('0x30')]['find']({'where':{'id':_0x2cecbb[_0x2b4c('0x44')]['id']}})[_0x2b4c('0x27')](handleEntityNotFound(_0x379c46,null))[_0x2b4c('0x27')](function(_0x54d801){if(_0x54d801){_0x2d9b0f=_0x54d801;return _0x54d801[_0x2b4c('0x94')](_0x2cecbb[_0x2b4c('0x54')][_0x2b4c('0x69')],_[_0x2b4c('0x52')](_0x2cecbb[_0x2b4c('0x54')],[_0x2b4c('0x69'),'id'])||{});}return null;})['spread'](function(_0xbe70e0){var _0x42c7a6;var _0x366099;_0x3c50c3=_0xbe70e0||[];var _0x30f8b1=[];if(_0xbe70e0){for(var _0x366317=0x0;_0x366317<_0xbe70e0[_0x2b4c('0x38')];_0x366317+=0x1){var _0x1a058a=_0xbe70e0[_0x366317][_0x2b4c('0x28')]({'plain':!![]});_0x42c7a6=squel[_0x2b4c('0x82')]()[_0x2b4c('0x83')](_0x2b4c('0x95'))[_0x2b4c('0x6e')]([_0x2b4c('0x6f'),_0x2b4c('0x71'),_0x2b4c('0x72'),_0x2b4c('0x5e'),_0x2b4c('0x55'),_0x2b4c('0x53')],squel[_0x2b4c('0x73')]()['field']('phone',_0x2b4c('0x6f'))['field']('id','ContactId')['field'](_0x1a058a[_0x2b4c('0x79')]['toString'](),'ListId')[_0x2b4c('0x74')](_0x2cecbb[_0x2b4c('0x44')]['id'][_0x2b4c('0x7a')](),'CampaignId')[_0x2b4c('0x74')]('NOW()','createdAt')[_0x2b4c('0x74')](_0x2b4c('0x75'),_0x2b4c('0x53'))['from'](_0x2b4c('0x76'))[_0x2b4c('0x3c')]('deletedAt\x20IS\x20NULL')['where'](_0x2b4c('0x78'),_0x1a058a[_0x2b4c('0x79')]['toString']())[_0x2b4c('0x3c')](_0x2b4c('0x7b')))['toString']();_0x30f8b1[_0x2b4c('0x8e')](db[_0x2b4c('0x8f')][_0x2b4c('0x33')](_0x42c7a6));}return BPromise[_0x2b4c('0x90')](_0x30f8b1);}})[_0x2b4c('0x27')](function(){return _0x3c50c3;})[_0x2b4c('0x27')](respondWithResult(_0x379c46,null))[_0x2b4c('0x42')](handleError(_0x379c46,null));};exports[_0x2b4c('0x96')]=function(_0x589738,_0x360231,_0x2593bf){return db[_0x2b4c('0x30')][_0x2b4c('0x47')]({'where':{'id':_0x589738[_0x2b4c('0x44')]['id']}})['then'](handleEntityNotFound(_0x360231,null))[_0x2b4c('0x27')](function(_0x3e7c6c){if(_0x3e7c6c){return _0x3e7c6c[_0x2b4c('0x96')](_0x589738[_0x2b4c('0x33')][_0x2b4c('0x69')]);}})[_0x2b4c('0x27')](function(_0x3c5628){if(_0x3c5628){return db[_0x2b4c('0x64')][_0x2b4c('0x59')]({'where':{'ListId':_0x589738[_0x2b4c('0x33')][_0x2b4c('0x69')],'CampaignId':_0x589738[_0x2b4c('0x44')]['id']}})[_0x2b4c('0x27')](function(){return _0x3c5628;});}})[_0x2b4c('0x27')](respondWithStatusCode(_0x360231,null))[_0x2b4c('0x42')](handleError(_0x360231,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index c0375ec..4e23b01 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x41d2d4,_0x12bcf4){var _0x225e0f=function(_0x8464f5){while(--_0x8464f5){_0x41d2d4['push'](_0x41d2d4['shift']());}};_0x225e0f(++_0x12bcf4);}(_0x7a54,0x106));var _0x47a5=function(_0x4b948d,_0x41b506){_0x4b948d=_0x4b948d-0x0;var _0x39e2ca=_0x7a54[_0x4b948d];return _0x39e2ca;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x16ec8d,_0x4bf3f0){var _0x12bdbf=function(_0x1a73ba){while(--_0x1a73ba){_0x16ec8d['push'](_0x16ec8d['shift']());}};_0x12bdbf(++_0x4bf3f0);}(_0x7a54,0x106));var _0x47a5=function(_0x4a78c5,_0x3a0932){_0x4a78c5=_0x4a78c5-0x0;var _0x2190e9=_0x7a54[_0x4a78c5];return _0x2190e9;};'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 a0fbe77..7b8d6d7 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 _0xac55=['attributes','limit','include','map','model','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','Campaign,\x20%s,\x20%s','request\x20sent','Campaign,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetCampaign','Campaign','options','where'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xac55,0x1c8));var _0x5ac5=function(_0x3f1556,_0x113d4c){_0x3f1556=_0x3f1556-0x0;var _0x9739ba=_0xac55[_0x3f1556];return _0x9739ba;};'use strict';var _=require(_0x5ac5('0x0'));var util=require(_0x5ac5('0x1'));var moment=require(_0x5ac5('0x2'));var BPromise=require(_0x5ac5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5ac5('0x4'));var db=require(_0x5ac5('0x5'))['db'];var utils=require(_0x5ac5('0x6'));var logger=require(_0x5ac5('0x7'))(_0x5ac5('0x8'));var config=require(_0x5ac5('0x9'));var jayson=require(_0x5ac5('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x34093b,_0x247752,_0x2bee03){return new BPromise(function(_0x42551a,_0x455a94){return client[_0x5ac5('0xb')](_0x34093b,_0x2bee03)[_0x5ac5('0xc')](function(_0x5b84a3){logger['info'](_0x5ac5('0xd'),_0x247752,_0x5ac5('0xe'));logger['debug'](_0x5ac5('0xf'),_0x247752,_0x5ac5('0xe'),JSON['stringify'](_0x5b84a3));if(_0x5b84a3[_0x5ac5('0x10')]){if(_0x5b84a3[_0x5ac5('0x10')]['code']===0x1f4){logger[_0x5ac5('0x10')](_0x5ac5('0xd'),_0x247752,_0x5b84a3[_0x5ac5('0x10')][_0x5ac5('0x11')]);return _0x455a94(_0x5b84a3[_0x5ac5('0x10')]['message']);}logger[_0x5ac5('0x10')]('Campaign,\x20%s,\x20%s',_0x247752,_0x5b84a3[_0x5ac5('0x10')][_0x5ac5('0x11')]);return _0x42551a(_0x5b84a3['error'][_0x5ac5('0x11')]);}else{logger['info'](_0x5ac5('0xd'),_0x247752,_0x5ac5('0xe'));_0x42551a(_0x5b84a3[_0x5ac5('0x12')][_0x5ac5('0x11')]);}})[_0x5ac5('0x13')](function(_0x3e35e9){logger[_0x5ac5('0x10')]('Campaign,\x20%s,\x20%s',_0x247752,_0x3e35e9);_0x455a94(_0x3e35e9);});});}exports[_0x5ac5('0x14')]=function(_0x5364a6){var _0x3c6062=this;return new Promise(function(_0x14d164,_0x4ece77){return db[_0x5ac5('0x15')]['findAll']({'raw':_0x5364a6[_0x5ac5('0x16')]?_0x5364a6['options']['raw']===undefined?!![]:![]:!![],'where':_0x5364a6[_0x5ac5('0x16')]?_0x5364a6['options'][_0x5ac5('0x17')]||null:null,'attributes':_0x5364a6[_0x5ac5('0x16')]?_0x5364a6['options'][_0x5ac5('0x18')]||null:null,'limit':_0x5364a6['options']?_0x5364a6[_0x5ac5('0x16')][_0x5ac5('0x19')]||null:null,'include':_0x5364a6['options']?_0x5364a6['options'][_0x5ac5('0x1a')]?_[_0x5ac5('0x1b')](_0x5364a6[_0x5ac5('0x16')][_0x5ac5('0x1a')],function(_0xee1c62){return{'model':db[_0xee1c62['model']],'as':_0xee1c62['as'],'attributes':_0xee1c62[_0x5ac5('0x18')],'include':_0xee1c62[_0x5ac5('0x1a')]?_[_0x5ac5('0x1b')](_0xee1c62[_0x5ac5('0x1a')],function(_0x4b81e2){return{'model':db[_0x4b81e2[_0x5ac5('0x1c')]],'as':_0x4b81e2['as'],'attributes':_0x4b81e2['attributes'],'include':_0x4b81e2[_0x5ac5('0x1a')]?_[_0x5ac5('0x1b')](_0x4b81e2[_0x5ac5('0x1a')],function(_0x2cb82f){return{'model':db[_0x2cb82f[_0x5ac5('0x1c')]],'as':_0x2cb82f['as'],'attributes':_0x2cb82f[_0x5ac5('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x31f9cc){logger['info'](_0x5ac5('0x14'),_0x5364a6);logger[_0x5ac5('0x1d')](_0x5ac5('0x14'),_0x5364a6,JSON['stringify'](_0x31f9cc));_0x14d164(_0x31f9cc);})[_0x5ac5('0x13')](function(_0x229941){logger[_0x5ac5('0x10')](_0x5ac5('0x14'),_0x229941['message'],_0x5364a6);_0x4ece77(_0x3c6062[_0x5ac5('0x10')](0x1f4,_0x229941['message']));});});}; \ No newline at end of file +var _0x0eec=['jayson/promise','http','request','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetCampaign','Campaign','options','where','attributes','include','model','map','then','stringify','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x332c3c,_0x193ab0){var _0x498357=function(_0x16733c){while(--_0x16733c){_0x332c3c['push'](_0x332c3c['shift']());}};_0x498357(++_0x193ab0);}(_0x0eec,0xac));var _0xc0ee=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0eec[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xc0ee('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc0ee('0x1'));var rs=require(_0xc0ee('0x2'));var fs=require('fs');var Redis=require(_0xc0ee('0x3'));var db=require(_0xc0ee('0x4'))['db'];var utils=require(_0xc0ee('0x5'));var logger=require(_0xc0ee('0x6'))(_0xc0ee('0x7'));var config=require('../../config/environment');var jayson=require(_0xc0ee('0x8'));var client=jayson['client'][_0xc0ee('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x39022a,_0x2d364d,_0x3aaca5){return new BPromise(function(_0x38b387,_0x1d9dca){return client[_0xc0ee('0xa')](_0x39022a,_0x3aaca5)['then'](function(_0x141f4a){logger[_0xc0ee('0xb')](_0xc0ee('0xc'),_0x2d364d,_0xc0ee('0xd'));logger[_0xc0ee('0xe')](_0xc0ee('0xf'),_0x2d364d,_0xc0ee('0xd'),JSON['stringify'](_0x141f4a));if(_0x141f4a[_0xc0ee('0x10')]){if(_0x141f4a[_0xc0ee('0x10')][_0xc0ee('0x11')]===0x1f4){logger[_0xc0ee('0x10')](_0xc0ee('0xc'),_0x2d364d,_0x141f4a[_0xc0ee('0x10')][_0xc0ee('0x12')]);return _0x1d9dca(_0x141f4a[_0xc0ee('0x10')][_0xc0ee('0x12')]);}logger['error']('Campaign,\x20%s,\x20%s',_0x2d364d,_0x141f4a[_0xc0ee('0x10')][_0xc0ee('0x12')]);return _0x38b387(_0x141f4a[_0xc0ee('0x10')]['message']);}else{logger[_0xc0ee('0xb')](_0xc0ee('0xc'),_0x2d364d,_0xc0ee('0xd'));_0x38b387(_0x141f4a['result']['message']);}})[_0xc0ee('0x13')](function(_0x4dc6de){logger[_0xc0ee('0x10')](_0xc0ee('0xc'),_0x2d364d,_0x4dc6de);_0x1d9dca(_0x4dc6de);});});}exports[_0xc0ee('0x14')]=function(_0x59aad9){var _0x4e7e82=this;return new Promise(function(_0x16d050,_0x276e2e){return db[_0xc0ee('0x15')]['findAll']({'raw':_0x59aad9[_0xc0ee('0x16')]?_0x59aad9[_0xc0ee('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x59aad9['options']?_0x59aad9[_0xc0ee('0x16')][_0xc0ee('0x17')]||null:null,'attributes':_0x59aad9['options']?_0x59aad9[_0xc0ee('0x16')][_0xc0ee('0x18')]||null:null,'limit':_0x59aad9[_0xc0ee('0x16')]?_0x59aad9['options']['limit']||null:null,'include':_0x59aad9['options']?_0x59aad9[_0xc0ee('0x16')][_0xc0ee('0x19')]?_['map'](_0x59aad9[_0xc0ee('0x16')][_0xc0ee('0x19')],function(_0x20b657){return{'model':db[_0x20b657[_0xc0ee('0x1a')]],'as':_0x20b657['as'],'attributes':_0x20b657[_0xc0ee('0x18')],'include':_0x20b657[_0xc0ee('0x19')]?_[_0xc0ee('0x1b')](_0x20b657[_0xc0ee('0x19')],function(_0x38abc9){return{'model':db[_0x38abc9[_0xc0ee('0x1a')]],'as':_0x38abc9['as'],'attributes':_0x38abc9[_0xc0ee('0x18')],'include':_0x38abc9[_0xc0ee('0x19')]?_[_0xc0ee('0x1b')](_0x38abc9[_0xc0ee('0x19')],function(_0x4288e1){return{'model':db[_0x4288e1['model']],'as':_0x4288e1['as'],'attributes':_0x4288e1[_0xc0ee('0x18')]};}):[]};}):[]};}):[]:[]})[_0xc0ee('0x1c')](function(_0x4c1b5c){logger[_0xc0ee('0xb')]('GetCampaign',_0x59aad9);logger[_0xc0ee('0xe')](_0xc0ee('0x14'),_0x59aad9,JSON[_0xc0ee('0x1d')](_0x4c1b5c));_0x16d050(_0x4c1b5c);})[_0xc0ee('0x13')](function(_0x46ca29){logger[_0xc0ee('0x10')](_0xc0ee('0x14'),_0x46ca29[_0xc0ee('0x12')],_0x59aad9);_0x276e2e(_0x4e7e82[_0xc0ee('0x10')](0x1f4,_0x46ca29[_0xc0ee('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 851f81a..220f386 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 _0x1156=['/:id','get','/:id/hoppers','isAuthenticated','getHopperHistories','/:id/hopper_finals','getLists','/:id/blacklists','getBlackLists','create','post','/:id/clone','clone','addLists','addBlackLists','put','destroy','delete','/:id/lists','removeLists','removeBlackLists','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','index'];(function(_0xddde15,_0x3676cd){var _0x3d9d4d=function(_0x2f4144){while(--_0x2f4144){_0xddde15['push'](_0xddde15['shift']());}};_0x3d9d4d(++_0x3676cd);}(_0x1156,0x1a8));var _0x6115=function(_0x22f8ab,_0x15d8ff){_0x22f8ab=_0x22f8ab-0x0;var _0x2a70e5=_0x1156[_0x22f8ab];return _0x2a70e5;};'use strict';var multer=require(_0x6115('0x0'));var util=require('util');var path=require(_0x6115('0x1'));var timeout=require(_0x6115('0x2'));var express=require(_0x6115('0x3'));var router=express[_0x6115('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6115('0x5'));var interaction=require(_0x6115('0x6'));var config=require(_0x6115('0x7'));var controller=require(_0x6115('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x6115('0x9')]);router['get'](_0x6115('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x6115('0xb')](_0x6115('0xc'),auth[_0x6115('0xd')](),controller['getHoppers']);router[_0x6115('0xb')]('/:id/hopper_histories',auth[_0x6115('0xd')](),controller[_0x6115('0xe')]);router[_0x6115('0xb')](_0x6115('0xf'),auth[_0x6115('0xd')](),controller['getHopperFinals']);router[_0x6115('0xb')]('/:id/hopper_black',auth['isAuthenticated'](),controller['getHopperBlacks']);router['get']('/:id/lists',auth[_0x6115('0xd')](),controller[_0x6115('0x10')]);router[_0x6115('0xb')](_0x6115('0x11'),auth[_0x6115('0xd')](),controller[_0x6115('0x12')]);router['post']('/',auth['isAuthenticated'](),controller[_0x6115('0x13')]);router[_0x6115('0x14')](_0x6115('0x15'),auth[_0x6115('0xd')](),controller[_0x6115('0x16')]);router['post']('/:id/lists',auth[_0x6115('0xd')](),controller[_0x6115('0x17')]);router[_0x6115('0x14')](_0x6115('0x11'),auth[_0x6115('0xd')](),controller[_0x6115('0x18')]);router[_0x6115('0x19')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x6115('0xa'),auth[_0x6115('0xd')](),controller[_0x6115('0x1a')]);router[_0x6115('0x1b')](_0x6115('0x1c'),auth['isAuthenticated'](),controller[_0x6115('0x1d')]);router[_0x6115('0x1b')](_0x6115('0x11'),auth[_0x6115('0xd')](),controller[_0x6115('0x1e')]);module['exports']=router; \ No newline at end of file +var _0xdceb=['isAuthenticated','/:id','show','getHoppers','/:id/hopper_histories','getHopperHistories','getHopperFinals','/:id/hopper_black','/:id/lists','getLists','/:id/blacklists','post','create','/:id/clone','addBlackLists','put','update','destroy','delete','removeBlackLists','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./campaign.controller','get'];(function(_0x52acf9,_0x325d20){var _0x11530c=function(_0x78af62){while(--_0x78af62){_0x52acf9['push'](_0x52acf9['shift']());}};_0x11530c(++_0x325d20);}(_0xdceb,0x1d5));var _0xbdce=function(_0x353fa3,_0x319079){_0x353fa3=_0x353fa3-0x0;var _0x4a5dc4=_0xdceb[_0x353fa3];return _0x4a5dc4;};'use strict';var multer=require(_0xbdce('0x0'));var util=require(_0xbdce('0x1'));var path=require(_0xbdce('0x2'));var timeout=require(_0xbdce('0x3'));var express=require(_0xbdce('0x4'));var router=express[_0xbdce('0x5')]();var fs_extra=require(_0xbdce('0x6'));var auth=require(_0xbdce('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xbdce('0x8'));var controller=require(_0xbdce('0x9'));router[_0xbdce('0xa')]('/',auth[_0xbdce('0xb')](),controller['index']);router['get'](_0xbdce('0xc'),auth[_0xbdce('0xb')](),controller[_0xbdce('0xd')]);router[_0xbdce('0xa')]('/:id/hoppers',auth[_0xbdce('0xb')](),controller[_0xbdce('0xe')]);router[_0xbdce('0xa')](_0xbdce('0xf'),auth[_0xbdce('0xb')](),controller[_0xbdce('0x10')]);router[_0xbdce('0xa')]('/:id/hopper_finals',auth[_0xbdce('0xb')](),controller[_0xbdce('0x11')]);router[_0xbdce('0xa')](_0xbdce('0x12'),auth[_0xbdce('0xb')](),controller['getHopperBlacks']);router['get'](_0xbdce('0x13'),auth[_0xbdce('0xb')](),controller[_0xbdce('0x14')]);router[_0xbdce('0xa')](_0xbdce('0x15'),auth[_0xbdce('0xb')](),controller['getBlackLists']);router[_0xbdce('0x16')]('/',auth[_0xbdce('0xb')](),controller[_0xbdce('0x17')]);router[_0xbdce('0x16')](_0xbdce('0x18'),auth[_0xbdce('0xb')](),controller['clone']);router[_0xbdce('0x16')](_0xbdce('0x13'),auth[_0xbdce('0xb')](),controller['addLists']);router[_0xbdce('0x16')](_0xbdce('0x15'),auth['isAuthenticated'](),controller[_0xbdce('0x19')]);router[_0xbdce('0x1a')](_0xbdce('0xc'),auth[_0xbdce('0xb')](),controller[_0xbdce('0x1b')]);router['delete'](_0xbdce('0xc'),auth[_0xbdce('0xb')](),controller[_0xbdce('0x1c')]);router[_0xbdce('0x1d')](_0xbdce('0x13'),auth[_0xbdce('0xb')](),controller['removeLists']);router['delete'](_0xbdce('0x15'),auth[_0xbdce('0xb')](),controller[_0xbdce('0x1e')]);module[_0xbdce('0x1f')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 6ab2740..8cbdbfb 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 _0xd686=['key','exports','STRING','TEXT','VIRTUAL','getDataValue'];(function(_0x396ec3,_0x5995bd){var _0x876934=function(_0x43a3f2){while(--_0x43a3f2){_0x396ec3['push'](_0x396ec3['shift']());}};_0x876934(++_0x5995bd);}(_0xd686,0x199));var _0x6d68=function(_0x2132a3,_0x4639e9){_0x2132a3=_0x2132a3-0x0;var _0x21890c=_0xd686[_0x2132a3];return _0x21890c;};'use strict';var Sequelize=require('sequelize');module[_0x6d68('0x0')]={'key':{'type':Sequelize[_0x6d68('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0x6d68('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x6d68('0x3')],'get':function(){return this[_0x6d68('0x4')](_0x6d68('0x5'));}}}; \ No newline at end of file +var _0x3466=['STRING','getDataValue','sequelize','exports'];(function(_0x24a5cf,_0x4446e4){var _0xcc694d=function(_0x5b13b6){while(--_0x5b13b6){_0x24a5cf['push'](_0x24a5cf['shift']());}};_0xcc694d(++_0x4446e4);}(_0x3466,0x1ce));var _0x6346=function(_0x239f0e,_0x20dd66){_0x239f0e=_0x239f0e-0x0;var _0x4b1ec3=_0x3466[_0x239f0e];return _0x4b1ec3;};'use strict';var Sequelize=require(_0x6346('0x0'));module[_0x6346('0x1')]={'key':{'type':Sequelize[_0x6346('0x2')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x6346('0x3')]('key');}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 5fa6b89..4038f7a 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 _0x89f9=['ChatWebsiteId','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','CannedAnswers','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','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/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','get','UserProfileResource','sendStatus','error','stack','name','send','index','rawAttributes','fieldName','key','map','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','CannedAnswer','includeAll','include','findAll','catch','show','params','body','find','destroy','create','MailAccountId','SmsAccountId','OpenchannelAccountId'];(function(_0x31fdc1,_0xfdd4e0){var _0x109528=function(_0x2f31b2){while(--_0x2f31b2){_0x31fdc1['push'](_0x31fdc1['shift']());}};_0x109528(++_0xfdd4e0);}(_0x89f9,0x68));var _0x989f=function(_0x1efdc0,_0x5a2099){_0x1efdc0=_0x1efdc0-0x0;var _0x3350fb=_0x89f9[_0x1efdc0];return _0x3350fb;};'use strict';var emlformat=require(_0x989f('0x0'));var rimraf=require(_0x989f('0x1'));var zipdir=require(_0x989f('0x2'));var jsonpatch=require(_0x989f('0x3'));var rp=require(_0x989f('0x4'));var moment=require(_0x989f('0x5'));var BPromise=require(_0x989f('0x6'));var Mustache=require(_0x989f('0x7'));var util=require(_0x989f('0x8'));var path=require(_0x989f('0x9'));var sox=require(_0x989f('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x989f('0xb'));var _=require(_0x989f('0xc'));var squel=require(_0x989f('0xd'));var crypto=require(_0x989f('0xe'));var jsforce=require(_0x989f('0xf'));var deskjs=require(_0x989f('0x10'));var toCsv=require('to-csv');var querystring=require(_0x989f('0x11'));var Papa=require(_0x989f('0x12'));var Redis=require(_0x989f('0x13'));var authService=require(_0x989f('0x14'));var qs=require(_0x989f('0x15'));var as=require(_0x989f('0x16'));var hardwareService=require(_0x989f('0x17'));var logger=require(_0x989f('0x18'))(_0x989f('0x19'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x989f('0x1a'));var db=require(_0x989f('0x1b'))['db'];function respondWithStatusCode(_0x4c036c,_0x445d36){_0x445d36=_0x445d36||0xcc;return function(_0xc44ae9){if(_0xc44ae9){return _0x4c036c['sendStatus'](_0x445d36);}return _0x4c036c[_0x989f('0x1c')](_0x445d36)[_0x989f('0x1d')]();};}function respondWithResult(_0x181bc0,_0x2e8fb7){_0x2e8fb7=_0x2e8fb7||0xc8;return function(_0x238e74){if(_0x238e74){return _0x181bc0[_0x989f('0x1c')](_0x2e8fb7)[_0x989f('0x1e')](_0x238e74);}};}function respondWithFilteredResult(_0x590595,_0x140474){return function(_0x34ba67){if(_0x34ba67){var _0x6413df=typeof _0x140474[_0x989f('0x1f')]===_0x989f('0x20')&&typeof _0x140474[_0x989f('0x21')]===_0x989f('0x20');var _0x572be1=_0x34ba67[_0x989f('0x22')];var _0x1fc70e=_0x6413df?0x0:_0x140474[_0x989f('0x1f')];var _0xe61197=_0x6413df?_0x34ba67[_0x989f('0x22')]:_0x140474[_0x989f('0x1f')]+_0x140474['limit'];var _0x407dc1;if(_0xe61197>=_0x572be1){_0xe61197=_0x572be1;_0x407dc1=0xc8;}else{_0x407dc1=0xce;}_0x590595[_0x989f('0x1c')](_0x407dc1);return _0x590595['set'](_0x989f('0x23'),_0x1fc70e+'-'+_0xe61197+'/'+_0x572be1)[_0x989f('0x1e')](_0x34ba67);}return null;};}function patchUpdates(_0x3e8afa){return function(_0x3216b4){try{jsonpatch[_0x989f('0x24')](_0x3216b4,_0x3e8afa,!![]);}catch(_0x3d1df6){return BPromise[_0x989f('0x25')](_0x3d1df6);}return _0x3216b4[_0x989f('0x26')]();};}function saveUpdates(_0x5ac893,_0x2cc5eb){return function(_0x72896b){if(_0x72896b){return _0x72896b[_0x989f('0x27')](_0x5ac893)[_0x989f('0x28')](function(_0x2f0c2e){return _0x2f0c2e;});}return null;};}function removeEntity(_0x521c95,_0x40d0a6){return function(_0x3e5e39){if(_0x3e5e39){return _0x3e5e39['destroy']()[_0x989f('0x28')](function(){var _0x106511=_0x3e5e39[_0x989f('0x29')]({'plain':!![]});var _0x1212f4='CannedAnswers';return db[_0x989f('0x2a')]['destroy']({'where':{'type':_0x1212f4,'resourceId':_0x106511['id']}})[_0x989f('0x28')](function(){return _0x3e5e39;});})[_0x989f('0x28')](function(){_0x521c95[_0x989f('0x1c')](0xcc)[_0x989f('0x1d')]();});}};}function handleEntityNotFound(_0x476bb5,_0x3e352b){return function(_0x4bf7f9){if(!_0x4bf7f9){_0x476bb5[_0x989f('0x2b')](0x194);}return _0x4bf7f9;};}function handleError(_0x17ece7,_0x44e91f){_0x44e91f=_0x44e91f||0x1f4;return function(_0x16a807){logger[_0x989f('0x2c')](_0x16a807[_0x989f('0x2d')]);if(_0x16a807[_0x989f('0x2e')]){delete _0x16a807[_0x989f('0x2e')];}_0x17ece7['status'](_0x44e91f)[_0x989f('0x2f')](_0x16a807);};}exports[_0x989f('0x30')]=function(_0x23835d,_0x384bf5){var _0x1588b8={},_0x46b4d2={},_0x25b1ed={'count':0x0,'rows':[]};var _0x49b7ea=_['map'](db['CannedAnswer'][_0x989f('0x31')],function(_0x3dd3ca){return{'name':_0x3dd3ca[_0x989f('0x32')],'type':_0x3dd3ca['type'][_0x989f('0x33')]};});_0x46b4d2['model']=_[_0x989f('0x34')](_0x49b7ea,_0x989f('0x2e'));_0x46b4d2[_0x989f('0x35')]=_[_0x989f('0x36')](_0x23835d[_0x989f('0x35')]);_0x46b4d2[_0x989f('0x37')]=_['intersection'](_0x46b4d2['model'],_0x46b4d2[_0x989f('0x35')]);_0x1588b8[_0x989f('0x38')]=_[_0x989f('0x39')](_0x46b4d2[_0x989f('0x3a')],qs[_0x989f('0x3b')](_0x23835d[_0x989f('0x35')][_0x989f('0x3b')]));_0x1588b8[_0x989f('0x38')]=_0x1588b8[_0x989f('0x38')][_0x989f('0x3c')]?_0x1588b8['attributes']:_0x46b4d2[_0x989f('0x3a')];if(!_0x23835d[_0x989f('0x35')][_0x989f('0x3d')](_0x989f('0x3e'))){_0x1588b8[_0x989f('0x21')]=qs[_0x989f('0x21')](_0x23835d[_0x989f('0x35')][_0x989f('0x21')]);_0x1588b8[_0x989f('0x1f')]=qs['offset'](_0x23835d[_0x989f('0x35')][_0x989f('0x1f')]);}_0x1588b8[_0x989f('0x3f')]=qs['sort'](_0x23835d[_0x989f('0x35')][_0x989f('0x40')]);_0x1588b8[_0x989f('0x41')]=qs[_0x989f('0x37')](_['pick'](_0x23835d[_0x989f('0x35')],_0x46b4d2[_0x989f('0x37')]),_0x49b7ea);if(_0x23835d['query'][_0x989f('0x42')]){_0x1588b8[_0x989f('0x41')]=_[_0x989f('0x43')](_0x1588b8[_0x989f('0x41')],{'$or':[{'key':{'$like':'%'+_0x23835d[_0x989f('0x35')][_0x989f('0x42')]+'%'}},{'value':{'$like':'%'+_0x23835d[_0x989f('0x35')][_0x989f('0x42')]+'%'}}]});}_0x1588b8=_[_0x989f('0x43')]({},_0x1588b8,_0x23835d['options']);var _0xe822d1={'where':_0x1588b8[_0x989f('0x41')]};return db[_0x989f('0x44')][_0x989f('0x22')](_0xe822d1)[_0x989f('0x28')](function(_0x2184b8){_0x25b1ed[_0x989f('0x22')]=_0x2184b8;if(_0x23835d[_0x989f('0x35')][_0x989f('0x45')]){_0x1588b8[_0x989f('0x46')]=[{'all':!![]}];}return db['CannedAnswer'][_0x989f('0x47')](_0x1588b8);})[_0x989f('0x28')](function(_0x335dd2){_0x25b1ed['rows']=_0x335dd2;return _0x25b1ed;})[_0x989f('0x28')](respondWithFilteredResult(_0x384bf5,_0x1588b8))[_0x989f('0x48')](handleError(_0x384bf5,null));};exports[_0x989f('0x49')]=function(_0x19e3f9,_0x22fee1){var _0x13a4a1={'raw':!![],'where':{'id':_0x19e3f9[_0x989f('0x4a')]['id']}},_0x4fdd35={};_0x4fdd35[_0x989f('0x3a')]=_['keys'](db[_0x989f('0x44')]['rawAttributes']);_0x4fdd35[_0x989f('0x35')]=_[_0x989f('0x36')](_0x19e3f9[_0x989f('0x35')]);_0x4fdd35[_0x989f('0x37')]=_['intersection'](_0x4fdd35['model'],_0x4fdd35['query']);_0x13a4a1[_0x989f('0x38')]=_[_0x989f('0x39')](_0x4fdd35[_0x989f('0x3a')],qs[_0x989f('0x3b')](_0x19e3f9[_0x989f('0x35')]['fields']));_0x13a4a1[_0x989f('0x38')]=_0x13a4a1[_0x989f('0x38')][_0x989f('0x3c')]?_0x13a4a1['attributes']:_0x4fdd35[_0x989f('0x3a')];if(_0x19e3f9[_0x989f('0x35')][_0x989f('0x45')]){_0x13a4a1[_0x989f('0x46')]=[{'all':!![]}];}_0x13a4a1=_[_0x989f('0x43')]({},_0x13a4a1,_0x19e3f9['options']);return db[_0x989f('0x44')]['find'](_0x13a4a1)[_0x989f('0x28')](handleEntityNotFound(_0x22fee1,null))['then'](respondWithResult(_0x22fee1,null))['catch'](handleError(_0x22fee1,null));};exports[_0x989f('0x27')]=function(_0x2ed1f5,_0x6b2e18){if(_0x2ed1f5[_0x989f('0x4b')]['id']){delete _0x2ed1f5[_0x989f('0x4b')]['id'];}return db[_0x989f('0x44')][_0x989f('0x4c')]({'where':{'id':_0x2ed1f5[_0x989f('0x4a')]['id']}})[_0x989f('0x28')](handleEntityNotFound(_0x6b2e18,null))[_0x989f('0x28')](saveUpdates(_0x2ed1f5[_0x989f('0x4b')],null))[_0x989f('0x28')](respondWithResult(_0x6b2e18,null))[_0x989f('0x48')](handleError(_0x6b2e18,null));};exports[_0x989f('0x4d')]=function(_0x5f5d40,_0x5d0b8f){return db[_0x989f('0x44')]['find']({'where':{'id':_0x5f5d40[_0x989f('0x4a')]['id']}})[_0x989f('0x28')](handleEntityNotFound(_0x5d0b8f,null))[_0x989f('0x28')](removeEntity(_0x5d0b8f,null))[_0x989f('0x48')](handleError(_0x5d0b8f,null));};exports[_0x989f('0x4e')]=function(_0x33637b,_0x4f108b){var _0x154963={'key':_0x33637b['body']['key']};if(_0x33637b[_0x989f('0x4b')][_0x989f('0x4f')]){_0x154963[_0x989f('0x4f')]=_0x33637b[_0x989f('0x4b')][_0x989f('0x4f')];}else if(_0x33637b[_0x989f('0x4b')][_0x989f('0x50')]){_0x154963[_0x989f('0x50')]=_0x33637b[_0x989f('0x4b')][_0x989f('0x50')];}else if(_0x33637b[_0x989f('0x4b')]['OpenchannelAccountId']){_0x154963[_0x989f('0x51')]=_0x33637b[_0x989f('0x4b')][_0x989f('0x51')];}else if(_0x33637b[_0x989f('0x4b')][_0x989f('0x52')]){_0x154963[_0x989f('0x52')]=_0x33637b['body'][_0x989f('0x52')];}return db['CannedAnswer'][_0x989f('0x4c')]({'where':_0x154963})[_0x989f('0x28')](function(_0x50cb42){if(_0x50cb42){throw new db['Sequelize'][(_0x989f('0x53'))](_0x989f('0x54'));}return db[_0x989f('0x44')][_0x989f('0x4e')](_0x33637b['body']);})['then'](function(_0x5761f2){var _0x357697=_0x33637b[_0x989f('0x55')]['get']({'plain':!![]});if(!_0x357697)throw new Error(_0x989f('0x56'));if(_0x357697[_0x989f('0x57')]==='user'){var _0x4aaea0=_0x5761f2['get']({'plain':!![]});return db[_0x989f('0x58')][_0x989f('0x4c')]({'where':{'name':_0x989f('0x59'),'userProfileId':_0x357697[_0x989f('0x5a')]},'raw':!![]})[_0x989f('0x28')](function(_0x5707f9){if(_0x5707f9&&_0x5707f9[_0x989f('0x5b')]===0x0){return db[_0x989f('0x2a')][_0x989f('0x4e')]({'name':_0x4aaea0[_0x989f('0x2e')],'resourceId':_0x4aaea0['id'],'type':_0x5707f9[_0x989f('0x2e')],'sectionId':_0x5707f9['id']},{})[_0x989f('0x28')](function(){return _0x5761f2;});}else{return _0x5761f2;}})[_0x989f('0x48')](function(_0x511032){logger[_0x989f('0x2c')](_0x989f('0x5c'),_0x511032);throw _0x511032;});}return _0x5761f2;})[_0x989f('0x28')](respondWithResult(_0x4f108b,0xc9))[_0x989f('0x48')](handleError(_0x4f108b,null));}; \ No newline at end of file +var _0x8de3=['then','destroy','get','UserProfileResource','error','stack','name','send','index','CannedAnswer','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','options','includeAll','findAll','rows','catch','show','params','include','find','update','body','create','key','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','CannedAnswers','autoAssociation','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject'];(function(_0x413b4d,_0xa3459c){var _0x8b810a=function(_0x22d441){while(--_0x22d441){_0x413b4d['push'](_0x413b4d['shift']());}};_0x8b810a(++_0xa3459c);}(_0x8de3,0x19d));var _0x38de=function(_0x5e3cef,_0x3c57f5){_0x5e3cef=_0x5e3cef-0x0;var _0x34c370=_0x8de3[_0x5e3cef];return _0x34c370;};'use strict';var emlformat=require(_0x38de('0x0'));var rimraf=require(_0x38de('0x1'));var zipdir=require(_0x38de('0x2'));var jsonpatch=require(_0x38de('0x3'));var rp=require(_0x38de('0x4'));var moment=require(_0x38de('0x5'));var BPromise=require(_0x38de('0x6'));var Mustache=require(_0x38de('0x7'));var util=require(_0x38de('0x8'));var path=require(_0x38de('0x9'));var sox=require('sox');var csv=require(_0x38de('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x38de('0xb'));var _=require(_0x38de('0xc'));var squel=require(_0x38de('0xd'));var crypto=require(_0x38de('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x38de('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x38de('0x10'));var authService=require(_0x38de('0x11'));var qs=require(_0x38de('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x38de('0x13'));var logger=require(_0x38de('0x14'))(_0x38de('0x15'));var utils=require('../../config/utils');var config=require(_0x38de('0x16'));var licenseUtil=require(_0x38de('0x17'));var db=require(_0x38de('0x18'))['db'];function respondWithStatusCode(_0x109c64,_0x42c5b2){_0x42c5b2=_0x42c5b2||0xcc;return function(_0xb97760){if(_0xb97760){return _0x109c64[_0x38de('0x19')](_0x42c5b2);}return _0x109c64[_0x38de('0x1a')](_0x42c5b2)[_0x38de('0x1b')]();};}function respondWithResult(_0x46994b,_0x1277d1){_0x1277d1=_0x1277d1||0xc8;return function(_0x2fc70b){if(_0x2fc70b){return _0x46994b['status'](_0x1277d1)[_0x38de('0x1c')](_0x2fc70b);}};}function respondWithFilteredResult(_0x3c2ef7,_0x2088db){return function(_0x3bd612){if(_0x3bd612){var _0x473cd4=typeof _0x2088db['offset']===_0x38de('0x1d')&&typeof _0x2088db[_0x38de('0x1e')]===_0x38de('0x1d');var _0x3c5e72=_0x3bd612[_0x38de('0x1f')];var _0x383386=_0x473cd4?0x0:_0x2088db[_0x38de('0x20')];var _0x3e3eca=_0x473cd4?_0x3bd612[_0x38de('0x1f')]:_0x2088db[_0x38de('0x20')]+_0x2088db[_0x38de('0x1e')];var _0x428926;if(_0x3e3eca>=_0x3c5e72){_0x3e3eca=_0x3c5e72;_0x428926=0xc8;}else{_0x428926=0xce;}_0x3c2ef7[_0x38de('0x1a')](_0x428926);return _0x3c2ef7[_0x38de('0x21')](_0x38de('0x22'),_0x383386+'-'+_0x3e3eca+'/'+_0x3c5e72)[_0x38de('0x1c')](_0x3bd612);}return null;};}function patchUpdates(_0x3cdb47){return function(_0x5c9ab8){try{jsonpatch[_0x38de('0x23')](_0x5c9ab8,_0x3cdb47,!![]);}catch(_0x364776){return BPromise[_0x38de('0x24')](_0x364776);}return _0x5c9ab8['save']();};}function saveUpdates(_0x59c549,_0x33605e){return function(_0x45c2cf){if(_0x45c2cf){return _0x45c2cf['update'](_0x59c549)[_0x38de('0x25')](function(_0x50a6f5){return _0x50a6f5;});}return null;};}function removeEntity(_0x49de2e,_0x4f60db){return function(_0x37a2e4){if(_0x37a2e4){return _0x37a2e4[_0x38de('0x26')]()['then'](function(){var _0x1d9faf=_0x37a2e4[_0x38de('0x27')]({'plain':!![]});var _0x1d35b7='CannedAnswers';return db[_0x38de('0x28')][_0x38de('0x26')]({'where':{'type':_0x1d35b7,'resourceId':_0x1d9faf['id']}})[_0x38de('0x25')](function(){return _0x37a2e4;});})[_0x38de('0x25')](function(){_0x49de2e[_0x38de('0x1a')](0xcc)[_0x38de('0x1b')]();});}};}function handleEntityNotFound(_0x1f25f9,_0x40581a){return function(_0x160a50){if(!_0x160a50){_0x1f25f9['sendStatus'](0x194);}return _0x160a50;};}function handleError(_0xa9eeac,_0x3faba2){_0x3faba2=_0x3faba2||0x1f4;return function(_0x478f94){logger[_0x38de('0x29')](_0x478f94[_0x38de('0x2a')]);if(_0x478f94[_0x38de('0x2b')]){delete _0x478f94['name'];}_0xa9eeac[_0x38de('0x1a')](_0x3faba2)[_0x38de('0x2c')](_0x478f94);};}exports[_0x38de('0x2d')]=function(_0x1cde59,_0x23299e){var _0x5e0faa={},_0x5425a2={},_0x51a854={'count':0x0,'rows':[]};var _0x35b030=_['map'](db[_0x38de('0x2e')][_0x38de('0x2f')],function(_0x46b830){return{'name':_0x46b830[_0x38de('0x30')],'type':_0x46b830[_0x38de('0x31')]['key']};});_0x5425a2[_0x38de('0x32')]=_[_0x38de('0x33')](_0x35b030,_0x38de('0x2b'));_0x5425a2[_0x38de('0x34')]=_[_0x38de('0x35')](_0x1cde59[_0x38de('0x34')]);_0x5425a2[_0x38de('0x36')]=_[_0x38de('0x37')](_0x5425a2[_0x38de('0x32')],_0x5425a2[_0x38de('0x34')]);_0x5e0faa[_0x38de('0x38')]=_[_0x38de('0x37')](_0x5425a2[_0x38de('0x32')],qs['fields'](_0x1cde59['query'][_0x38de('0x39')]));_0x5e0faa[_0x38de('0x38')]=_0x5e0faa[_0x38de('0x38')][_0x38de('0x3a')]?_0x5e0faa['attributes']:_0x5425a2[_0x38de('0x32')];if(!_0x1cde59[_0x38de('0x34')][_0x38de('0x3b')](_0x38de('0x3c'))){_0x5e0faa[_0x38de('0x1e')]=qs[_0x38de('0x1e')](_0x1cde59['query'][_0x38de('0x1e')]);_0x5e0faa[_0x38de('0x20')]=qs[_0x38de('0x20')](_0x1cde59[_0x38de('0x34')][_0x38de('0x20')]);}_0x5e0faa['order']=qs[_0x38de('0x3d')](_0x1cde59[_0x38de('0x34')][_0x38de('0x3d')]);_0x5e0faa[_0x38de('0x3e')]=qs[_0x38de('0x36')](_[_0x38de('0x3f')](_0x1cde59[_0x38de('0x34')],_0x5425a2[_0x38de('0x36')]),_0x35b030);if(_0x1cde59[_0x38de('0x34')][_0x38de('0x40')]){_0x5e0faa[_0x38de('0x3e')]=_['merge'](_0x5e0faa[_0x38de('0x3e')],{'$or':[{'key':{'$like':'%'+_0x1cde59[_0x38de('0x34')][_0x38de('0x40')]+'%'}},{'value':{'$like':'%'+_0x1cde59[_0x38de('0x34')]['filter']+'%'}}]});}_0x5e0faa=_['merge']({},_0x5e0faa,_0x1cde59[_0x38de('0x41')]);var _0x36063f={'where':_0x5e0faa[_0x38de('0x3e')]};return db[_0x38de('0x2e')]['count'](_0x36063f)[_0x38de('0x25')](function(_0x517f8c){_0x51a854[_0x38de('0x1f')]=_0x517f8c;if(_0x1cde59[_0x38de('0x34')][_0x38de('0x42')]){_0x5e0faa['include']=[{'all':!![]}];}return db[_0x38de('0x2e')][_0x38de('0x43')](_0x5e0faa);})[_0x38de('0x25')](function(_0x4b449f){_0x51a854[_0x38de('0x44')]=_0x4b449f;return _0x51a854;})[_0x38de('0x25')](respondWithFilteredResult(_0x23299e,_0x5e0faa))[_0x38de('0x45')](handleError(_0x23299e,null));};exports[_0x38de('0x46')]=function(_0x444b40,_0x20cd8a){var _0x44373f={'raw':!![],'where':{'id':_0x444b40[_0x38de('0x47')]['id']}},_0x4771c0={};_0x4771c0['model']=_[_0x38de('0x35')](db[_0x38de('0x2e')]['rawAttributes']);_0x4771c0[_0x38de('0x34')]=_[_0x38de('0x35')](_0x444b40['query']);_0x4771c0[_0x38de('0x36')]=_[_0x38de('0x37')](_0x4771c0[_0x38de('0x32')],_0x4771c0[_0x38de('0x34')]);_0x44373f[_0x38de('0x38')]=_[_0x38de('0x37')](_0x4771c0['model'],qs['fields'](_0x444b40['query'][_0x38de('0x39')]));_0x44373f['attributes']=_0x44373f[_0x38de('0x38')][_0x38de('0x3a')]?_0x44373f['attributes']:_0x4771c0['model'];if(_0x444b40[_0x38de('0x34')][_0x38de('0x42')]){_0x44373f[_0x38de('0x48')]=[{'all':!![]}];}_0x44373f=_['merge']({},_0x44373f,_0x444b40['options']);return db[_0x38de('0x2e')][_0x38de('0x49')](_0x44373f)[_0x38de('0x25')](handleEntityNotFound(_0x20cd8a,null))[_0x38de('0x25')](respondWithResult(_0x20cd8a,null))[_0x38de('0x45')](handleError(_0x20cd8a,null));};exports[_0x38de('0x4a')]=function(_0x3ebe93,_0x4acf7e){if(_0x3ebe93[_0x38de('0x4b')]['id']){delete _0x3ebe93['body']['id'];}return db[_0x38de('0x2e')]['find']({'where':{'id':_0x3ebe93[_0x38de('0x47')]['id']}})['then'](handleEntityNotFound(_0x4acf7e,null))[_0x38de('0x25')](saveUpdates(_0x3ebe93['body'],null))['then'](respondWithResult(_0x4acf7e,null))[_0x38de('0x45')](handleError(_0x4acf7e,null));};exports['destroy']=function(_0x14f699,_0x29e110){return db[_0x38de('0x2e')][_0x38de('0x49')]({'where':{'id':_0x14f699[_0x38de('0x47')]['id']}})[_0x38de('0x25')](handleEntityNotFound(_0x29e110,null))['then'](removeEntity(_0x29e110,null))[_0x38de('0x45')](handleError(_0x29e110,null));};exports[_0x38de('0x4c')]=function(_0x2d22dd,_0x1f3e25){var _0x188311={'key':_0x2d22dd[_0x38de('0x4b')][_0x38de('0x4d')]};if(_0x2d22dd[_0x38de('0x4b')][_0x38de('0x4e')]){_0x188311[_0x38de('0x4e')]=_0x2d22dd[_0x38de('0x4b')][_0x38de('0x4e')];}else if(_0x2d22dd[_0x38de('0x4b')]['SmsAccountId']){_0x188311['SmsAccountId']=_0x2d22dd[_0x38de('0x4b')][_0x38de('0x4f')];}else if(_0x2d22dd['body'][_0x38de('0x50')]){_0x188311[_0x38de('0x50')]=_0x2d22dd[_0x38de('0x4b')][_0x38de('0x50')];}else if(_0x2d22dd[_0x38de('0x4b')][_0x38de('0x51')]){_0x188311['ChatWebsiteId']=_0x2d22dd[_0x38de('0x4b')]['ChatWebsiteId'];}return db['CannedAnswer'][_0x38de('0x49')]({'where':_0x188311})[_0x38de('0x25')](function(_0x37347e){if(_0x37347e){throw new db['Sequelize'][(_0x38de('0x52'))](_0x38de('0x53'));}return db[_0x38de('0x2e')][_0x38de('0x4c')](_0x2d22dd['body']);})[_0x38de('0x25')](function(_0x23f77b){var _0x5d4c47=_0x2d22dd[_0x38de('0x54')][_0x38de('0x27')]({'plain':!![]});if(!_0x5d4c47)throw new Error(_0x38de('0x55'));if(_0x5d4c47[_0x38de('0x56')]===_0x38de('0x54')){var _0x479c74=_0x23f77b[_0x38de('0x27')]({'plain':!![]});return db[_0x38de('0x57')][_0x38de('0x49')]({'where':{'name':_0x38de('0x58'),'userProfileId':_0x5d4c47['userProfileId']},'raw':!![]})[_0x38de('0x25')](function(_0x249fbd){if(_0x249fbd&&_0x249fbd[_0x38de('0x59')]===0x0){return db['UserProfileResource']['create']({'name':_0x479c74[_0x38de('0x2b')],'resourceId':_0x479c74['id'],'type':_0x249fbd[_0x38de('0x2b')],'sectionId':_0x249fbd['id']},{})[_0x38de('0x25')](function(){return _0x23f77b;});}else{return _0x23f77b;}})[_0x38de('0x45')](function(_0x3eab35){logger[_0x38de('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3eab35);throw _0x3eab35;});}return _0x23f77b;})[_0x38de('0x25')](respondWithResult(_0x1f3e25,0xc9))['catch'](handleError(_0x1f3e25,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index b3dc18c..df2c2d4 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 _0x13b5=['../../config/environment','exports','define','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x13b5,0x69));var _0x513b=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x13b5[_0x32f7d7];return _0x133d09;};'use strict';var _=require('lodash');var util=require(_0x513b('0x0'));var logger=require('../../config/logger')(_0x513b('0x1'));var moment=require(_0x513b('0x2'));var BPromise=require(_0x513b('0x3'));var rp=require(_0x513b('0x4'));var fs=require('fs');var path=require(_0x513b('0x5'));var rimraf=require(_0x513b('0x6'));var config=require(_0x513b('0x7'));var attributes=require('./cannedAnswer.attributes');module[_0x513b('0x8')]=function(_0x28fc69,_0x27f9a7){return _0x28fc69[_0x513b('0x9')](_0x513b('0xa'),attributes,{'tableName':_0x513b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x513b('0xc'),'collate':_0x513b('0xd')});}; \ No newline at end of file +var _0xdacd=['utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./cannedAnswer.attributes','CannedAnswer','tools_canned_answers'];(function(_0x2b98dc,_0x2beab6){var _0xe9ce36=function(_0x395bc6){while(--_0x395bc6){_0x2b98dc['push'](_0x2b98dc['shift']());}};_0xe9ce36(++_0x2beab6);}(_0xdacd,0xab));var _0xddac=function(_0xa9c02d,_0x3fb872){_0xa9c02d=_0xa9c02d-0x0;var _0x22c970=_0xdacd[_0xa9c02d];return _0x22c970;};'use strict';var _=require('lodash');var util=require(_0xddac('0x0'));var logger=require(_0xddac('0x1'))(_0xddac('0x2'));var moment=require(_0xddac('0x3'));var BPromise=require(_0xddac('0x4'));var rp=require(_0xddac('0x5'));var fs=require('fs');var path=require(_0xddac('0x6'));var rimraf=require(_0xddac('0x7'));var config=require('../../config/environment');var attributes=require(_0xddac('0x8'));module['exports']=function(_0x28438d,_0x3d4e83){return _0x28438d['define'](_0xddac('0x9'),attributes,{'tableName':_0xddac('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xddac('0xb'),'collate':_0xddac('0xc')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index f612c33..893d61b 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(_0x1ac52d,_0x180994){var _0x444095=function(_0x488e1d){while(--_0x488e1d){_0x1ac52d['push'](_0x1ac52d['shift']());}};_0x444095(++_0x180994);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'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(_0xe337e6,_0x52c174){var _0x1c7ca1=function(_0x5bb651){while(--_0x5bb651){_0xe337e6['push'](_0xe337e6['shift']());}};_0x1c7ca1(++_0x52c174);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'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 355cc58..cd649a0 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 _0xa91a=['get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller'];(function(_0x5b9986,_0x5d376a){var _0x2c3085=function(_0x1e0f8b){while(--_0x1e0f8b){_0x5b9986['push'](_0x5b9986['shift']());}};_0x2c3085(++_0x5d376a);}(_0xa91a,0x146));var _0xaa91=function(_0xfb8a4,_0x9a05ca){_0xfb8a4=_0xfb8a4-0x0;var _0x30df8d=_0xa91a[_0xfb8a4];return _0x30df8d;};'use strict';var multer=require(_0xaa91('0x0'));var util=require(_0xaa91('0x1'));var path=require(_0xaa91('0x2'));var timeout=require(_0xaa91('0x3'));var express=require(_0xaa91('0x4'));var router=express[_0xaa91('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xaa91('0x6'));var interaction=require(_0xaa91('0x7'));var config=require(_0xaa91('0x8'));var controller=require(_0xaa91('0x9'));router[_0xaa91('0xa')]('/',auth['isAuthenticated'](),controller[_0xaa91('0xb')]);router[_0xaa91('0xa')](_0xaa91('0xc'),auth[_0xaa91('0xd')](),controller[_0xaa91('0xe')]);router[_0xaa91('0xf')]('/',auth[_0xaa91('0xd')](),controller[_0xaa91('0x10')]);router[_0xaa91('0x11')](_0xaa91('0xc'),auth[_0xaa91('0xd')](),controller[_0xaa91('0x12')]);router[_0xaa91('0x13')](_0xaa91('0xc'),auth[_0xaa91('0xd')](),controller[_0xaa91('0x14')]);module['exports']=router; \ No newline at end of file +var _0xbcee=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','index','get','/:id','isAuthenticated','show','post','create','put','delete','destroy','multer','util','Router'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xbcee,0xc3));var _0xebce=function(_0x33013d,_0x4ff316){_0x33013d=_0x33013d-0x0;var _0x3df63f=_0xbcee[_0x33013d];return _0x3df63f;};'use strict';var multer=require(_0xebce('0x0'));var util=require(_0xebce('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xebce('0x2')]();var fs_extra=require(_0xebce('0x3'));var auth=require(_0xebce('0x4'));var interaction=require(_0xebce('0x5'));var config=require(_0xebce('0x6'));var controller=require(_0xebce('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xebce('0x8')]);router[_0xebce('0x9')](_0xebce('0xa'),auth[_0xebce('0xb')](),controller[_0xebce('0xc')]);router[_0xebce('0xd')]('/',auth[_0xebce('0xb')](),controller[_0xebce('0xe')]);router[_0xebce('0xf')](_0xebce('0xa'),auth[_0xebce('0xb')](),controller['update']);router[_0xebce('0x10')](_0xebce('0xa'),auth[_0xebce('0xb')](),controller[_0xebce('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 4d741b8..611bdea 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 _0xde9d=['sequelize','exports','DATE','1970-01-01\x2000:00:01','STRING','INTEGER'];(function(_0xb45dc5,_0x3c6b74){var _0x13d06e=function(_0xf05cc0){while(--_0xf05cc0){_0xb45dc5['push'](_0xb45dc5['shift']());}};_0x13d06e(++_0x3c6b74);}(_0xde9d,0x156));var _0xdde9=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xde9d[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0xdde9('0x0'));module[_0xdde9('0x1')]={'calldate':{'type':Sequelize[_0xdde9('0x2')],'allowNull':![],'defaultValue':_0xdde9('0x3')},'clid':{'type':Sequelize[_0xdde9('0x4')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0xdde9('0x4')]},'dcontext':{'type':Sequelize[_0xdde9('0x4')]},'channel':{'type':Sequelize[_0xdde9('0x4')]},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize[_0xdde9('0x4')]},'lastdata':{'type':Sequelize[_0xdde9('0x4')]},'duration':{'type':Sequelize[_0xdde9('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xdde9('0x4')]},'amaflags':{'type':Sequelize[_0xdde9('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xdde9('0x4')]},'userfield':{'type':Sequelize[_0xdde9('0x4')]},'uniqueid':{'type':Sequelize[_0xdde9('0x4')]},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0xdde9('0x4')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0xdde9('0x4')]}}; \ No newline at end of file +var _0xd547=['INTEGER','DATE','1970-01-01\x2000:00:01','STRING'];(function(_0x49052b,_0x3ba709){var _0x48c045=function(_0x41ac38){while(--_0x41ac38){_0x49052b['push'](_0x49052b['shift']());}};_0x48c045(++_0x3ba709);}(_0xd547,0x1c1));var _0x7d54=function(_0x373059,_0x17b09c){_0x373059=_0x373059-0x0;var _0x368f67=_0xd547[_0x373059];return _0x368f67;};'use strict';var Sequelize=require('sequelize');module['exports']={'calldate':{'type':Sequelize[_0x7d54('0x0')],'allowNull':![],'defaultValue':_0x7d54('0x1')},'clid':{'type':Sequelize[_0x7d54('0x2')]},'src':{'type':Sequelize[_0x7d54('0x2')]},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x7d54('0x2')]},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize[_0x7d54('0x2')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0x7d54('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x7d54('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x7d54('0x2')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x7d54('0x2')]},'linkedid':{'type':Sequelize[_0x7d54('0x2')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0x7d54('0x2')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0x7d54('0x2')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 46c1dd3..a6d787c 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 _0x5292=['rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','length','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','params','fields','options','find','create','body','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','lodash','squel','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','limit','count','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','Cdr'];(function(_0x486f4a,_0x478dc7){var _0x135d99=function(_0x434008){while(--_0x434008){_0x486f4a['push'](_0x486f4a['shift']());}};_0x135d99(++_0x478dc7);}(_0x5292,0xf7));var _0x2529=function(_0x542a9b,_0x351513){_0x542a9b=_0x542a9b-0x0;var _0x4d5032=_0x5292[_0x542a9b];return _0x4d5032;};'use strict';var emlformat=require(_0x2529('0x0'));var rimraf=require(_0x2529('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2529('0x2'));var rp=require('request-promise');var moment=require(_0x2529('0x3'));var BPromise=require(_0x2529('0x4'));var Mustache=require(_0x2529('0x5'));var util=require(_0x2529('0x6'));var path=require('path');var sox=require(_0x2529('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2529('0x8'));var squel=require(_0x2529('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2529('0xa'));var toCsv=require(_0x2529('0xb'));var querystring=require('querystring');var Papa=require(_0x2529('0xc'));var Redis=require(_0x2529('0xd'));var authService=require(_0x2529('0xe'));var qs=require(_0x2529('0xf'));var as=require(_0x2529('0x10'));var hardwareService=require(_0x2529('0x11'));var logger=require(_0x2529('0x12'))(_0x2529('0x13'));var utils=require('../../config/utils');var config=require(_0x2529('0x14'));var licenseUtil=require(_0x2529('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe333c9,_0x23bfaf){_0x23bfaf=_0x23bfaf||0xcc;return function(_0x149692){if(_0x149692){return _0xe333c9[_0x2529('0x16')](_0x23bfaf);}return _0xe333c9[_0x2529('0x17')](_0x23bfaf)[_0x2529('0x18')]();};}function respondWithResult(_0x3f3b40,_0x5245cf){_0x5245cf=_0x5245cf||0xc8;return function(_0x101668){if(_0x101668){return _0x3f3b40[_0x2529('0x17')](_0x5245cf)[_0x2529('0x19')](_0x101668);}};}function respondWithFilteredResult(_0x19e4bf,_0x1cc716){return function(_0x2598a1){if(_0x2598a1){var _0x1a1ccc=typeof _0x1cc716[_0x2529('0x1a')]==='undefined'&&typeof _0x1cc716[_0x2529('0x1b')]==='undefined';var _0x337720=_0x2598a1[_0x2529('0x1c')];var _0x89be58=_0x1a1ccc?0x0:_0x1cc716['offset'];var _0x5b4d0d=_0x1a1ccc?_0x2598a1[_0x2529('0x1c')]:_0x1cc716[_0x2529('0x1a')]+_0x1cc716[_0x2529('0x1b')];var _0x37204a;if(_0x5b4d0d>=_0x337720){_0x5b4d0d=_0x337720;_0x37204a=0xc8;}else{_0x37204a=0xce;}_0x19e4bf[_0x2529('0x17')](_0x37204a);return _0x19e4bf['set'](_0x2529('0x1d'),_0x89be58+'-'+_0x5b4d0d+'/'+_0x337720)[_0x2529('0x19')](_0x2598a1);}return null;};}function patchUpdates(_0x1ca15f){return function(_0xeff5a6){try{jsonpatch['apply'](_0xeff5a6,_0x1ca15f,!![]);}catch(_0x1fa873){return BPromise[_0x2529('0x1e')](_0x1fa873);}return _0xeff5a6[_0x2529('0x1f')]();};}function saveUpdates(_0x5b4760,_0x3d5d17){return function(_0x3f57da){if(_0x3f57da){return _0x3f57da[_0x2529('0x20')](_0x5b4760)[_0x2529('0x21')](function(_0x5540e4){return _0x5540e4;});}return null;};}function removeEntity(_0x2736f6,_0x2d0c6d){return function(_0x400a01){if(_0x400a01){return _0x400a01[_0x2529('0x22')]()[_0x2529('0x21')](function(){_0x2736f6[_0x2529('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5539ef,_0x856e50){return function(_0x40f42b){if(!_0x40f42b){_0x5539ef[_0x2529('0x16')](0x194);}return _0x40f42b;};}function handleError(_0x431c40,_0x24418a){_0x24418a=_0x24418a||0x1f4;return function(_0x2a8371){logger[_0x2529('0x23')](_0x2a8371[_0x2529('0x24')]);if(_0x2a8371[_0x2529('0x25')]){delete _0x2a8371[_0x2529('0x25')];}_0x431c40['status'](_0x24418a)[_0x2529('0x26')](_0x2a8371);};}exports[_0x2529('0x27')]=function(_0x4dd0fb,_0x1822ce){var _0x3c46c6={},_0x5bea2d={},_0x17bcbd={'count':0x0,'rows':[]};var _0x1d7e98=_['map'](db[_0x2529('0x28')][_0x2529('0x29')],function(_0x4a18f6){return{'name':_0x4a18f6[_0x2529('0x2a')],'type':_0x4a18f6[_0x2529('0x2b')][_0x2529('0x2c')]};});_0x5bea2d[_0x2529('0x2d')]=_[_0x2529('0x2e')](_0x1d7e98,'name');_0x5bea2d[_0x2529('0x2f')]=_[_0x2529('0x30')](_0x4dd0fb[_0x2529('0x2f')]);_0x5bea2d[_0x2529('0x31')]=_[_0x2529('0x32')](_0x5bea2d[_0x2529('0x2d')],_0x5bea2d[_0x2529('0x2f')]);_0x3c46c6['attributes']=_['intersection'](_0x5bea2d[_0x2529('0x2d')],qs['fields'](_0x4dd0fb[_0x2529('0x2f')]['fields']));_0x3c46c6['attributes']=_0x3c46c6['attributes'][_0x2529('0x33')]?_0x3c46c6[_0x2529('0x34')]:_0x5bea2d[_0x2529('0x2d')];if(!_0x4dd0fb['query'][_0x2529('0x35')]('nolimit')){_0x3c46c6['limit']=qs['limit'](_0x4dd0fb[_0x2529('0x2f')][_0x2529('0x1b')]);_0x3c46c6[_0x2529('0x1a')]=qs[_0x2529('0x1a')](_0x4dd0fb[_0x2529('0x2f')][_0x2529('0x1a')]);}_0x3c46c6[_0x2529('0x36')]=qs[_0x2529('0x37')](_0x4dd0fb[_0x2529('0x2f')][_0x2529('0x37')]);_0x3c46c6[_0x2529('0x38')]=qs[_0x2529('0x31')](_[_0x2529('0x39')](_0x4dd0fb['query'],_0x5bea2d['filters']),_0x1d7e98);if(_0x4dd0fb[_0x2529('0x2f')][_0x2529('0x3a')]){_0x3c46c6['where']=_[_0x2529('0x3b')](_0x3c46c6[_0x2529('0x38')],{'$or':_[_0x2529('0x2e')](_0x1d7e98,function(_0x1b1f81){if(_0x1b1f81[_0x2529('0x2b')]!==_0x2529('0x3c')){var _0x1b8226={};_0x1b8226[_0x1b1f81['name']]={'$like':'%'+_0x4dd0fb[_0x2529('0x2f')][_0x2529('0x3a')]+'%'};return _0x1b8226;}})});}_0x3c46c6=_[_0x2529('0x3b')]({},_0x3c46c6,_0x4dd0fb['options']);var _0x1393b7={'where':_0x3c46c6[_0x2529('0x38')]};return db[_0x2529('0x28')][_0x2529('0x1c')](_0x1393b7)[_0x2529('0x21')](function(_0x33acbf){_0x17bcbd[_0x2529('0x1c')]=_0x33acbf;if(_0x4dd0fb[_0x2529('0x2f')][_0x2529('0x3d')]){_0x3c46c6['include']=[{'all':!![]}];}return db[_0x2529('0x28')][_0x2529('0x3e')](_0x3c46c6);})[_0x2529('0x21')](function(_0x3b4e47){_0x17bcbd[_0x2529('0x3f')]=_0x3b4e47;return _0x17bcbd;})[_0x2529('0x21')](respondWithFilteredResult(_0x1822ce,_0x3c46c6))[_0x2529('0x40')](handleError(_0x1822ce,null));};exports['show']=function(_0x8ced2e,_0x33a13e){var _0x3f76e8={'raw':!![],'where':{'id':_0x8ced2e[_0x2529('0x41')]['id']}},_0x2aaecb={};_0x2aaecb['model']=_[_0x2529('0x30')](db[_0x2529('0x28')][_0x2529('0x29')]);_0x2aaecb[_0x2529('0x2f')]=_[_0x2529('0x30')](_0x8ced2e[_0x2529('0x2f')]);_0x2aaecb['filters']=_['intersection'](_0x2aaecb['model'],_0x2aaecb['query']);_0x3f76e8[_0x2529('0x34')]=_['intersection'](_0x2aaecb[_0x2529('0x2d')],qs[_0x2529('0x42')](_0x8ced2e[_0x2529('0x2f')][_0x2529('0x42')]));_0x3f76e8[_0x2529('0x34')]=_0x3f76e8['attributes'][_0x2529('0x33')]?_0x3f76e8['attributes']:_0x2aaecb[_0x2529('0x2d')];if(_0x8ced2e['query'][_0x2529('0x3d')]){_0x3f76e8['include']=[{'all':!![]}];}_0x3f76e8=_[_0x2529('0x3b')]({},_0x3f76e8,_0x8ced2e[_0x2529('0x43')]);return db['Cdr'][_0x2529('0x44')](_0x3f76e8)['then'](handleEntityNotFound(_0x33a13e,null))[_0x2529('0x21')](respondWithResult(_0x33a13e,null))[_0x2529('0x40')](handleError(_0x33a13e,null));};exports[_0x2529('0x45')]=function(_0x3c6d79,_0xdc4bef){return db[_0x2529('0x28')][_0x2529('0x45')](_0x3c6d79[_0x2529('0x46')],{})[_0x2529('0x21')](respondWithResult(_0xdc4bef,0xc9))['catch'](handleError(_0xdc4bef,null));};exports['update']=function(_0x5e72d1,_0x37a23a){if(_0x5e72d1[_0x2529('0x46')]['id']){delete _0x5e72d1[_0x2529('0x46')]['id'];}return db['Cdr']['find']({'where':{'id':_0x5e72d1[_0x2529('0x41')]['id']}})['then'](handleEntityNotFound(_0x37a23a,null))[_0x2529('0x21')](saveUpdates(_0x5e72d1[_0x2529('0x46')],null))[_0x2529('0x21')](respondWithResult(_0x37a23a,null))[_0x2529('0x40')](handleError(_0x37a23a,null));};exports[_0x2529('0x22')]=function(_0x196ee8,_0x4583ba){return db[_0x2529('0x28')]['find']({'where':{'id':_0x196ee8['params']['id']}})[_0x2529('0x21')](handleEntityNotFound(_0x4583ba,null))[_0x2529('0x21')](removeEntity(_0x4583ba,null))[_0x2529('0x40')](handleError(_0x4583ba,null));};exports[_0x2529('0x47')]=function(_0x1f76d3,_0x3ac799){return db[_0x2529('0x28')][_0x2529('0x47')]()[_0x2529('0x21')](respondWithResult(_0x3ac799,null))[_0x2529('0x40')](handleError(_0x3ac799,null));}; \ No newline at end of file +var _0xfb65=['../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','Cdr','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','describe','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api'];(function(_0x33975c,_0x50d085){var _0x1c15ab=function(_0x54e8bc){while(--_0x54e8bc){_0x33975c['push'](_0x33975c['shift']());}};_0x1c15ab(++_0x50d085);}(_0xfb65,0x82));var _0x5fb6=function(_0x3adf4e,_0x26d25f){_0x3adf4e=_0x3adf4e-0x0;var _0x4dc28b=_0xfb65[_0x3adf4e];return _0x4dc28b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5fb6('0x0'));var zipdir=require(_0x5fb6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5fb6('0x2'));var moment=require('moment');var BPromise=require(_0x5fb6('0x3'));var Mustache=require(_0x5fb6('0x4'));var util=require(_0x5fb6('0x5'));var path=require(_0x5fb6('0x6'));var sox=require(_0x5fb6('0x7'));var csv=require(_0x5fb6('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5fb6('0x9'));var squel=require(_0x5fb6('0xa'));var crypto=require(_0x5fb6('0xb'));var jsforce=require(_0x5fb6('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x5fb6('0x8'));var querystring=require(_0x5fb6('0xd'));var Papa=require(_0x5fb6('0xe'));var Redis=require(_0x5fb6('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x5fb6('0x10'));var as=require(_0x5fb6('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5fb6('0x12'))(_0x5fb6('0x13'));var utils=require(_0x5fb6('0x14'));var config=require(_0x5fb6('0x15'));var licenseUtil=require(_0x5fb6('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1927d0,_0x15b296){_0x15b296=_0x15b296||0xcc;return function(_0x42285b){if(_0x42285b){return _0x1927d0[_0x5fb6('0x17')](_0x15b296);}return _0x1927d0[_0x5fb6('0x18')](_0x15b296)[_0x5fb6('0x19')]();};}function respondWithResult(_0x1a391f,_0x1ded21){_0x1ded21=_0x1ded21||0xc8;return function(_0x5e69c3){if(_0x5e69c3){return _0x1a391f['status'](_0x1ded21)[_0x5fb6('0x1a')](_0x5e69c3);}};}function respondWithFilteredResult(_0xfaea56,_0x58febe){return function(_0x1d57b1){if(_0x1d57b1){var _0x21ddd3=typeof _0x58febe[_0x5fb6('0x1b')]==='undefined'&&typeof _0x58febe[_0x5fb6('0x1c')]===_0x5fb6('0x1d');var _0x27bd8b=_0x1d57b1[_0x5fb6('0x1e')];var _0x167354=_0x21ddd3?0x0:_0x58febe[_0x5fb6('0x1b')];var _0x50bca8=_0x21ddd3?_0x1d57b1[_0x5fb6('0x1e')]:_0x58febe['offset']+_0x58febe[_0x5fb6('0x1c')];var _0x54c319;if(_0x50bca8>=_0x27bd8b){_0x50bca8=_0x27bd8b;_0x54c319=0xc8;}else{_0x54c319=0xce;}_0xfaea56[_0x5fb6('0x18')](_0x54c319);return _0xfaea56[_0x5fb6('0x1f')](_0x5fb6('0x20'),_0x167354+'-'+_0x50bca8+'/'+_0x27bd8b)[_0x5fb6('0x1a')](_0x1d57b1);}return null;};}function patchUpdates(_0x5885f1){return function(_0x418f58){try{jsonpatch[_0x5fb6('0x21')](_0x418f58,_0x5885f1,!![]);}catch(_0x50a414){return BPromise['reject'](_0x50a414);}return _0x418f58[_0x5fb6('0x22')]();};}function saveUpdates(_0x39ace4,_0x48a70e){return function(_0xdf1794){if(_0xdf1794){return _0xdf1794[_0x5fb6('0x23')](_0x39ace4)[_0x5fb6('0x24')](function(_0x36457e){return _0x36457e;});}return null;};}function removeEntity(_0x582f60,_0x2fca34){return function(_0x44aebe){if(_0x44aebe){return _0x44aebe[_0x5fb6('0x25')]()[_0x5fb6('0x24')](function(){_0x582f60[_0x5fb6('0x18')](0xcc)[_0x5fb6('0x19')]();});}};}function handleEntityNotFound(_0x4e2bff,_0x4cbdaf){return function(_0x298b44){if(!_0x298b44){_0x4e2bff[_0x5fb6('0x17')](0x194);}return _0x298b44;};}function handleError(_0x92f94d,_0x3ce22f){_0x3ce22f=_0x3ce22f||0x1f4;return function(_0x2731a3){logger[_0x5fb6('0x26')](_0x2731a3[_0x5fb6('0x27')]);if(_0x2731a3['name']){delete _0x2731a3[_0x5fb6('0x28')];}_0x92f94d[_0x5fb6('0x18')](_0x3ce22f)[_0x5fb6('0x29')](_0x2731a3);};}exports['index']=function(_0x2afc08,_0x1b4ae4){var _0x49a828={},_0x218428={},_0x408fd9={'count':0x0,'rows':[]};var _0x52afd7=_[_0x5fb6('0x2a')](db['Cdr'][_0x5fb6('0x2b')],function(_0x53dbeb){return{'name':_0x53dbeb['fieldName'],'type':_0x53dbeb[_0x5fb6('0x2c')][_0x5fb6('0x2d')]};});_0x218428[_0x5fb6('0x2e')]=_[_0x5fb6('0x2a')](_0x52afd7,_0x5fb6('0x28'));_0x218428[_0x5fb6('0x2f')]=_['keys'](_0x2afc08[_0x5fb6('0x2f')]);_0x218428[_0x5fb6('0x30')]=_[_0x5fb6('0x31')](_0x218428[_0x5fb6('0x2e')],_0x218428[_0x5fb6('0x2f')]);_0x49a828[_0x5fb6('0x32')]=_[_0x5fb6('0x31')](_0x218428[_0x5fb6('0x2e')],qs[_0x5fb6('0x33')](_0x2afc08[_0x5fb6('0x2f')][_0x5fb6('0x33')]));_0x49a828['attributes']=_0x49a828[_0x5fb6('0x32')][_0x5fb6('0x34')]?_0x49a828['attributes']:_0x218428[_0x5fb6('0x2e')];if(!_0x2afc08['query']['hasOwnProperty'](_0x5fb6('0x35'))){_0x49a828[_0x5fb6('0x1c')]=qs[_0x5fb6('0x1c')](_0x2afc08['query'][_0x5fb6('0x1c')]);_0x49a828['offset']=qs['offset'](_0x2afc08[_0x5fb6('0x2f')][_0x5fb6('0x1b')]);}_0x49a828[_0x5fb6('0x36')]=qs[_0x5fb6('0x37')](_0x2afc08[_0x5fb6('0x2f')][_0x5fb6('0x37')]);_0x49a828[_0x5fb6('0x38')]=qs[_0x5fb6('0x30')](_[_0x5fb6('0x39')](_0x2afc08[_0x5fb6('0x2f')],_0x218428[_0x5fb6('0x30')]),_0x52afd7);if(_0x2afc08[_0x5fb6('0x2f')]['filter']){_0x49a828[_0x5fb6('0x38')]=_[_0x5fb6('0x3a')](_0x49a828[_0x5fb6('0x38')],{'$or':_['map'](_0x52afd7,function(_0x1e83fc){if(_0x1e83fc['type']!==_0x5fb6('0x3b')){var _0x4bd9e5={};_0x4bd9e5[_0x1e83fc[_0x5fb6('0x28')]]={'$like':'%'+_0x2afc08[_0x5fb6('0x2f')][_0x5fb6('0x3c')]+'%'};return _0x4bd9e5;}})});}_0x49a828=_[_0x5fb6('0x3a')]({},_0x49a828,_0x2afc08[_0x5fb6('0x3d')]);var _0x59875a={'where':_0x49a828[_0x5fb6('0x38')]};return db[_0x5fb6('0x3e')][_0x5fb6('0x1e')](_0x59875a)[_0x5fb6('0x24')](function(_0x52e858){_0x408fd9[_0x5fb6('0x1e')]=_0x52e858;if(_0x2afc08[_0x5fb6('0x2f')][_0x5fb6('0x3f')]){_0x49a828[_0x5fb6('0x40')]=[{'all':!![]}];}return db[_0x5fb6('0x3e')][_0x5fb6('0x41')](_0x49a828);})['then'](function(_0x10c242){_0x408fd9[_0x5fb6('0x42')]=_0x10c242;return _0x408fd9;})[_0x5fb6('0x24')](respondWithFilteredResult(_0x1b4ae4,_0x49a828))[_0x5fb6('0x43')](handleError(_0x1b4ae4,null));};exports[_0x5fb6('0x44')]=function(_0x290e77,_0xd3245f){var _0x529c2d={'raw':!![],'where':{'id':_0x290e77[_0x5fb6('0x45')]['id']}},_0x2e3f97={};_0x2e3f97[_0x5fb6('0x2e')]=_['keys'](db[_0x5fb6('0x3e')]['rawAttributes']);_0x2e3f97[_0x5fb6('0x2f')]=_[_0x5fb6('0x46')](_0x290e77['query']);_0x2e3f97[_0x5fb6('0x30')]=_[_0x5fb6('0x31')](_0x2e3f97[_0x5fb6('0x2e')],_0x2e3f97['query']);_0x529c2d['attributes']=_[_0x5fb6('0x31')](_0x2e3f97[_0x5fb6('0x2e')],qs[_0x5fb6('0x33')](_0x290e77[_0x5fb6('0x2f')][_0x5fb6('0x33')]));_0x529c2d[_0x5fb6('0x32')]=_0x529c2d[_0x5fb6('0x32')][_0x5fb6('0x34')]?_0x529c2d[_0x5fb6('0x32')]:_0x2e3f97[_0x5fb6('0x2e')];if(_0x290e77[_0x5fb6('0x2f')]['includeAll']){_0x529c2d[_0x5fb6('0x40')]=[{'all':!![]}];}_0x529c2d=_['merge']({},_0x529c2d,_0x290e77['options']);return db[_0x5fb6('0x3e')][_0x5fb6('0x47')](_0x529c2d)[_0x5fb6('0x24')](handleEntityNotFound(_0xd3245f,null))[_0x5fb6('0x24')](respondWithResult(_0xd3245f,null))[_0x5fb6('0x43')](handleError(_0xd3245f,null));};exports[_0x5fb6('0x48')]=function(_0x45ba31,_0x5729a2){return db[_0x5fb6('0x3e')][_0x5fb6('0x48')](_0x45ba31['body'],{})[_0x5fb6('0x24')](respondWithResult(_0x5729a2,0xc9))[_0x5fb6('0x43')](handleError(_0x5729a2,null));};exports[_0x5fb6('0x23')]=function(_0x3fc547,_0x3b508a){if(_0x3fc547[_0x5fb6('0x49')]['id']){delete _0x3fc547[_0x5fb6('0x49')]['id'];}return db[_0x5fb6('0x3e')]['find']({'where':{'id':_0x3fc547[_0x5fb6('0x45')]['id']}})[_0x5fb6('0x24')](handleEntityNotFound(_0x3b508a,null))['then'](saveUpdates(_0x3fc547[_0x5fb6('0x49')],null))[_0x5fb6('0x24')](respondWithResult(_0x3b508a,null))[_0x5fb6('0x43')](handleError(_0x3b508a,null));};exports[_0x5fb6('0x25')]=function(_0x4bf156,_0x4bb943){return db[_0x5fb6('0x3e')][_0x5fb6('0x47')]({'where':{'id':_0x4bf156[_0x5fb6('0x45')]['id']}})['then'](handleEntityNotFound(_0x4bb943,null))[_0x5fb6('0x24')](removeEntity(_0x4bb943,null))['catch'](handleError(_0x4bb943,null));};exports[_0x5fb6('0x4a')]=function(_0x5eb7cf,_0xa949ae){return db[_0x5fb6('0x3e')][_0x5fb6('0x4a')]()['then'](respondWithResult(_0xa949ae,null))[_0x5fb6('0x43')](handleError(_0xa949ae,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index a29fbd0..021527d 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(_0x710984,_0x16f3c0){var _0x1f68fc=function(_0x539e03){while(--_0x539e03){_0x710984['push'](_0x710984['shift']());}};_0x1f68fc(++_0x16f3c0);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file +var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x32569d,_0x58f9de){var _0x52dabf=function(_0x441a10){while(--_0x441a10){_0x32569d['push'](_0x32569d['shift']());}};_0x52dabf(++_0x58f9de);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index c2cca25..6042c9b 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 _0xb932=['error','message','info','result','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','Cdr,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb932,0x1c7));var _0x2b93=function(_0x16409d,_0x477463){_0x16409d=_0x16409d-0x0;var _0x38c55c=_0xb932[_0x16409d];return _0x38c55c;};'use strict';var _=require(_0x2b93('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2b93('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2b93('0x2'));var db=require(_0x2b93('0x3'))['db'];var utils=require(_0x2b93('0x4'));var logger=require(_0x2b93('0x5'))('rpc');var config=require(_0x2b93('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2b93('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x33f2a5,_0x132a1a,_0x5c191d){return new BPromise(function(_0x1d97d3,_0x3f91e3){return client[_0x2b93('0x8')](_0x33f2a5,_0x5c191d)[_0x2b93('0x9')](function(_0x308b56){logger['info'](_0x2b93('0xa'),_0x132a1a,_0x2b93('0xb'));logger['debug']('Cdr,\x20%s,\x20%s,\x20%s',_0x132a1a,_0x2b93('0xb'),JSON[_0x2b93('0xc')](_0x308b56));if(_0x308b56[_0x2b93('0xd')]){if(_0x308b56[_0x2b93('0xd')]['code']===0x1f4){logger[_0x2b93('0xd')](_0x2b93('0xa'),_0x132a1a,_0x308b56[_0x2b93('0xd')][_0x2b93('0xe')]);return _0x3f91e3(_0x308b56[_0x2b93('0xd')][_0x2b93('0xe')]);}logger[_0x2b93('0xd')](_0x2b93('0xa'),_0x132a1a,_0x308b56['error'][_0x2b93('0xe')]);return _0x1d97d3(_0x308b56['error'][_0x2b93('0xe')]);}else{logger[_0x2b93('0xf')](_0x2b93('0xa'),_0x132a1a,_0x2b93('0xb'));_0x1d97d3(_0x308b56[_0x2b93('0x10')][_0x2b93('0xe')]);}})[_0x2b93('0x11')](function(_0xb5fd45){logger[_0x2b93('0xd')](_0x2b93('0xa'),_0x132a1a,_0xb5fd45);_0x3f91e3(_0xb5fd45);});});} \ No newline at end of file +var _0x8863=['stringify','error','code','message','result','catch','util','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s'];(function(_0x5a1de2,_0x56daed){var _0xf89bf3=function(_0x5ead7b){while(--_0x5ead7b){_0x5a1de2['push'](_0x5a1de2['shift']());}};_0xf89bf3(++_0x56daed);}(_0x8863,0xe2));var _0x3886=function(_0x38cb37,_0x499145){_0x38cb37=_0x38cb37-0x0;var _0x2efd84=_0x8863[_0x38cb37];return _0x2efd84;};'use strict';var _=require('lodash');var util=require(_0x3886('0x0'));var moment=require('moment');var BPromise=require(_0x3886('0x1'));var rs=require(_0x3886('0x2'));var fs=require('fs');var Redis=require(_0x3886('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3886('0x4'));var config=require(_0x3886('0x5'));var jayson=require(_0x3886('0x6'));var client=jayson[_0x3886('0x7')][_0x3886('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x342a03,_0x358fe9,_0x4a0056){return new BPromise(function(_0x36d06a,_0x5a07c4){return client[_0x3886('0x9')](_0x342a03,_0x4a0056)[_0x3886('0xa')](function(_0x5962ef){logger[_0x3886('0xb')](_0x3886('0xc'),_0x358fe9,_0x3886('0xd'));logger[_0x3886('0xe')](_0x3886('0xf'),_0x358fe9,'request\x20sent',JSON[_0x3886('0x10')](_0x5962ef));if(_0x5962ef[_0x3886('0x11')]){if(_0x5962ef[_0x3886('0x11')][_0x3886('0x12')]===0x1f4){logger[_0x3886('0x11')](_0x3886('0xc'),_0x358fe9,_0x5962ef[_0x3886('0x11')][_0x3886('0x13')]);return _0x5a07c4(_0x5962ef[_0x3886('0x11')]['message']);}logger['error'](_0x3886('0xc'),_0x358fe9,_0x5962ef[_0x3886('0x11')][_0x3886('0x13')]);return _0x36d06a(_0x5962ef[_0x3886('0x11')][_0x3886('0x13')]);}else{logger[_0x3886('0xb')](_0x3886('0xc'),_0x358fe9,_0x3886('0xd'));_0x36d06a(_0x5962ef[_0x3886('0x14')][_0x3886('0x13')]);}})[_0x3886('0x15')](function(_0x47bb97){logger[_0x3886('0x11')](_0x3886('0xc'),_0x358fe9,_0x47bb97);_0x5a07c4(_0x47bb97);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 1820957..61ff98e 100644 --- a/server/api/cdr/index.js +++ b/server/api/cdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0xeb4c8b,_0x1dc497){var _0x90b0d0=function(_0x332e32){while(--_0x332e32){_0xeb4c8b['push'](_0xeb4c8b['shift']());}};_0x90b0d0(++_0x1dc497);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x417211,_0x473c09){var _0x2c04a5=function(_0x4a3bb8){while(--_0x4a3bb8){_0x417211['push'](_0x417211['shift']());}};_0x2c04a5(++_0x473c09);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 4ad1967..baa9b69 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 _0x3757=['sequelize','exports','INTEGER','STRING','noop','*,*,*,*'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0x3757,0x1a4));var _0x7375=function(_0x1e62c7,_0x2790ca){_0x1e62c7=_0x1e62c7-0x0;var _0x9934d4=_0x3757[_0x1e62c7];return _0x9934d4;};'use strict';var Sequelize=require(_0x7375('0x0'));module[_0x7375('0x1')]={'priority':{'type':Sequelize[_0x7375('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x7375('0x3')],'allowNull':![],'defaultValue':_0x7375('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x7375('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x7375('0x5')}}; \ No newline at end of file +var _0xc425=['noop','TEXT','STRING'];(function(_0x3dc089,_0x5ccb0d){var _0x34d9d3=function(_0x4556bf){while(--_0x4556bf){_0x3dc089['push'](_0x3dc089['shift']());}};_0x34d9d3(++_0x5ccb0d);}(_0xc425,0x149));var _0x5c42=function(_0x2bec8b,_0x1f3454){_0x2bec8b=_0x2bec8b-0x0;var _0x141b26=_0xc425[_0x2bec8b];return _0x141b26;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x5c42('0x0')],'allowNull':![],'defaultValue':_0x5c42('0x1')},'appdata':{'type':Sequelize[_0x5c42('0x2')]()},'description':{'type':Sequelize[_0x5c42('0x0')]},'interval':{'type':Sequelize[_0x5c42('0x0')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 48c5365..eea2e80 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 _0xeffd=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','limit','set','Content-Range','json','reject','update','then','destroy','stack','name','send','show','params','keys','ChatApplication','rawAttributes','query','intersection','model','fields','attributes','includeAll','include','merge','options','find','catch','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x4e389d,_0x4e108f){var _0x318212=function(_0x368163){while(--_0x368163){_0x4e389d['push'](_0x4e389d['shift']());}};_0x318212(++_0x4e108f);}(_0xeffd,0x6b));var _0xdeff=function(_0x24b305,_0x5f05d5){_0x24b305=_0x24b305-0x0;var _0x340a4b=_0xeffd[_0x24b305];return _0x340a4b;};'use strict';var emlformat=require(_0xdeff('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdeff('0x1'));var jsonpatch=require(_0xdeff('0x2'));var rp=require(_0xdeff('0x3'));var moment=require(_0xdeff('0x4'));var BPromise=require(_0xdeff('0x5'));var Mustache=require(_0xdeff('0x6'));var util=require(_0xdeff('0x7'));var path=require(_0xdeff('0x8'));var sox=require(_0xdeff('0x9'));var csv=require(_0xdeff('0xa'));var ejs=require(_0xdeff('0xb'));var fs=require('fs');var fs_extra=require(_0xdeff('0xc'));var _=require(_0xdeff('0xd'));var squel=require(_0xdeff('0xe'));var crypto=require(_0xdeff('0xf'));var jsforce=require(_0xdeff('0x10'));var deskjs=require(_0xdeff('0x11'));var toCsv=require('to-csv');var querystring=require(_0xdeff('0x12'));var Papa=require(_0xdeff('0x13'));var Redis=require(_0xdeff('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xdeff('0x15'));var as=require(_0xdeff('0x16'));var hardwareService=require(_0xdeff('0x17'));var logger=require(_0xdeff('0x18'))(_0xdeff('0x19'));var utils=require(_0xdeff('0x1a'));var config=require(_0xdeff('0x1b'));var licenseUtil=require(_0xdeff('0x1c'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x461699,_0x116bf9){_0x116bf9=_0x116bf9||0xcc;return function(_0x4952f2){if(_0x4952f2){return _0x461699[_0xdeff('0x1d')](_0x116bf9);}return _0x461699['status'](_0x116bf9)['end']();};}function respondWithResult(_0x3e56a1,_0x47410f){_0x47410f=_0x47410f||0xc8;return function(_0x1585e8){if(_0x1585e8){return _0x3e56a1[_0xdeff('0x1e')](_0x47410f)['json'](_0x1585e8);}};}function respondWithFilteredResult(_0x826132,_0x314ded){return function(_0xea6c4){if(_0xea6c4){var _0x391633=typeof _0x314ded[_0xdeff('0x1f')]===_0xdeff('0x20')&&typeof _0x314ded['limit']==='undefined';var _0x7440af=_0xea6c4['count'];var _0x5c9837=_0x391633?0x0:_0x314ded[_0xdeff('0x1f')];var _0x369e13=_0x391633?_0xea6c4['count']:_0x314ded[_0xdeff('0x1f')]+_0x314ded[_0xdeff('0x21')];var _0x1ab1fa;if(_0x369e13>=_0x7440af){_0x369e13=_0x7440af;_0x1ab1fa=0xc8;}else{_0x1ab1fa=0xce;}_0x826132[_0xdeff('0x1e')](_0x1ab1fa);return _0x826132[_0xdeff('0x22')](_0xdeff('0x23'),_0x5c9837+'-'+_0x369e13+'/'+_0x7440af)[_0xdeff('0x24')](_0xea6c4);}return null;};}function patchUpdates(_0x919c93){return function(_0x488faa){try{jsonpatch['apply'](_0x488faa,_0x919c93,!![]);}catch(_0x56cb84){return BPromise[_0xdeff('0x25')](_0x56cb84);}return _0x488faa['save']();};}function saveUpdates(_0x189627,_0x91c0b4){return function(_0x543653){if(_0x543653){return _0x543653[_0xdeff('0x26')](_0x189627)[_0xdeff('0x27')](function(_0x4eb2a8){return _0x4eb2a8;});}return null;};}function removeEntity(_0x5dbe96,_0x3b2554){return function(_0x15c425){if(_0x15c425){return _0x15c425[_0xdeff('0x28')]()[_0xdeff('0x27')](function(){_0x5dbe96[_0xdeff('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb08f19,_0x412db3){return function(_0x3741fb){if(!_0x3741fb){_0xb08f19[_0xdeff('0x1d')](0x194);}return _0x3741fb;};}function handleError(_0x16974b,_0x35823c){_0x35823c=_0x35823c||0x1f4;return function(_0x3d0111){logger['error'](_0x3d0111[_0xdeff('0x29')]);if(_0x3d0111[_0xdeff('0x2a')]){delete _0x3d0111['name'];}_0x16974b['status'](_0x35823c)[_0xdeff('0x2b')](_0x3d0111);};}exports[_0xdeff('0x2c')]=function(_0x16b2d0,_0xcb819c){var _0x533069={'raw':!![],'where':{'id':_0x16b2d0[_0xdeff('0x2d')]['id']}},_0xf9b278={};_0xf9b278['model']=_[_0xdeff('0x2e')](db[_0xdeff('0x2f')][_0xdeff('0x30')]);_0xf9b278['query']=_['keys'](_0x16b2d0[_0xdeff('0x31')]);_0xf9b278['filters']=_[_0xdeff('0x32')](_0xf9b278[_0xdeff('0x33')],_0xf9b278[_0xdeff('0x31')]);_0x533069['attributes']=_[_0xdeff('0x32')](_0xf9b278['model'],qs['fields'](_0x16b2d0[_0xdeff('0x31')][_0xdeff('0x34')]));_0x533069[_0xdeff('0x35')]=_0x533069[_0xdeff('0x35')]['length']?_0x533069[_0xdeff('0x35')]:_0xf9b278[_0xdeff('0x33')];if(_0x16b2d0[_0xdeff('0x31')][_0xdeff('0x36')]){_0x533069[_0xdeff('0x37')]=[{'all':!![]}];}_0x533069=_[_0xdeff('0x38')]({},_0x533069,_0x16b2d0[_0xdeff('0x39')]);return db['ChatApplication'][_0xdeff('0x3a')](_0x533069)['then'](handleEntityNotFound(_0xcb819c,null))[_0xdeff('0x27')](respondWithResult(_0xcb819c,null))[_0xdeff('0x3b')](handleError(_0xcb819c,null));};exports[_0xdeff('0x26')]=function(_0x28b21a,_0x210dd6){if(_0x28b21a[_0xdeff('0x3c')]['id']){delete _0x28b21a['body']['id'];}return db[_0xdeff('0x2f')][_0xdeff('0x3a')]({'where':{'id':_0x28b21a['params']['id']}})[_0xdeff('0x27')](handleEntityNotFound(_0x210dd6,null))[_0xdeff('0x27')](saveUpdates(_0x28b21a[_0xdeff('0x3c')],null))[_0xdeff('0x27')](respondWithResult(_0x210dd6,null))[_0xdeff('0x3b')](handleError(_0x210dd6,null));};exports[_0xdeff('0x28')]=function(_0x4268e4,_0x54c20e){return db['ChatApplication'][_0xdeff('0x3a')]({'where':{'id':_0x4268e4['params']['id']}})[_0xdeff('0x27')](handleEntityNotFound(_0x54c20e,null))[_0xdeff('0x27')](removeEntity(_0x54c20e,null))[_0xdeff('0x3b')](handleError(_0x54c20e,null));}; \ No newline at end of file +var _0x8d08=['../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','undefined','limit','offset','count','set','Content-Range','apply','save','then','destroy','end','name','send','show','params','model','keys','ChatApplication','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','catch','update','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs'];(function(_0x45d6cb,_0x535e0f){var _0x59cac4=function(_0x51a5c9){while(--_0x51a5c9){_0x45d6cb['push'](_0x45d6cb['shift']());}};_0x59cac4(++_0x535e0f);}(_0x8d08,0x118));var _0x88d0=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0x8d08[_0x1ccdf7];return _0x52a0ae;};'use strict';var emlformat=require(_0x88d0('0x0'));var rimraf=require(_0x88d0('0x1'));var zipdir=require(_0x88d0('0x2'));var jsonpatch=require(_0x88d0('0x3'));var rp=require(_0x88d0('0x4'));var moment=require(_0x88d0('0x5'));var BPromise=require(_0x88d0('0x6'));var Mustache=require(_0x88d0('0x7'));var util=require(_0x88d0('0x8'));var path=require(_0x88d0('0x9'));var sox=require(_0x88d0('0xa'));var csv=require(_0x88d0('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x88d0('0xc'));var _=require(_0x88d0('0xd'));var squel=require('squel');var crypto=require(_0x88d0('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x88d0('0xf'));var toCsv=require('to-csv');var querystring=require(_0x88d0('0x10'));var Papa=require(_0x88d0('0x11'));var Redis=require(_0x88d0('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x88d0('0x13'));var as=require(_0x88d0('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x88d0('0x15'))('api');var utils=require(_0x88d0('0x16'));var config=require(_0x88d0('0x17'));var licenseUtil=require(_0x88d0('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5de471,_0x5da161){_0x5da161=_0x5da161||0xcc;return function(_0x2854a5){if(_0x2854a5){return _0x5de471[_0x88d0('0x19')](_0x5da161);}return _0x5de471[_0x88d0('0x1a')](_0x5da161)['end']();};}function respondWithResult(_0x47a572,_0x57b18e){_0x57b18e=_0x57b18e||0xc8;return function(_0x461ae6){if(_0x461ae6){return _0x47a572[_0x88d0('0x1a')](_0x57b18e)['json'](_0x461ae6);}};}function respondWithFilteredResult(_0x2bba74,_0x189ea6){return function(_0x2b3ebd){if(_0x2b3ebd){var _0x37083a=typeof _0x189ea6['offset']===_0x88d0('0x1b')&&typeof _0x189ea6[_0x88d0('0x1c')]===_0x88d0('0x1b');var _0x3fe6b8=_0x2b3ebd['count'];var _0x100727=_0x37083a?0x0:_0x189ea6[_0x88d0('0x1d')];var _0x5862d1=_0x37083a?_0x2b3ebd[_0x88d0('0x1e')]:_0x189ea6[_0x88d0('0x1d')]+_0x189ea6['limit'];var _0x1212a7;if(_0x5862d1>=_0x3fe6b8){_0x5862d1=_0x3fe6b8;_0x1212a7=0xc8;}else{_0x1212a7=0xce;}_0x2bba74['status'](_0x1212a7);return _0x2bba74[_0x88d0('0x1f')](_0x88d0('0x20'),_0x100727+'-'+_0x5862d1+'/'+_0x3fe6b8)['json'](_0x2b3ebd);}return null;};}function patchUpdates(_0x463d67){return function(_0x46aabb){try{jsonpatch[_0x88d0('0x21')](_0x46aabb,_0x463d67,!![]);}catch(_0x2c2f73){return BPromise['reject'](_0x2c2f73);}return _0x46aabb[_0x88d0('0x22')]();};}function saveUpdates(_0xbeb2f9,_0x40155e){return function(_0x4e8b5a){if(_0x4e8b5a){return _0x4e8b5a['update'](_0xbeb2f9)[_0x88d0('0x23')](function(_0x124525){return _0x124525;});}return null;};}function removeEntity(_0x5d6d85,_0x3bd137){return function(_0x2d2aac){if(_0x2d2aac){return _0x2d2aac[_0x88d0('0x24')]()[_0x88d0('0x23')](function(){_0x5d6d85[_0x88d0('0x1a')](0xcc)[_0x88d0('0x25')]();});}};}function handleEntityNotFound(_0x481a86,_0x2499a1){return function(_0x4d20ae){if(!_0x4d20ae){_0x481a86[_0x88d0('0x19')](0x194);}return _0x4d20ae;};}function handleError(_0x2b5adb,_0x1daaf1){_0x1daaf1=_0x1daaf1||0x1f4;return function(_0x3aa683){logger['error'](_0x3aa683['stack']);if(_0x3aa683[_0x88d0('0x26')]){delete _0x3aa683[_0x88d0('0x26')];}_0x2b5adb[_0x88d0('0x1a')](_0x1daaf1)[_0x88d0('0x27')](_0x3aa683);};}exports[_0x88d0('0x28')]=function(_0xa17c71,_0x32782e){var _0x5bab64={'raw':!![],'where':{'id':_0xa17c71[_0x88d0('0x29')]['id']}},_0x28f306={};_0x28f306[_0x88d0('0x2a')]=_[_0x88d0('0x2b')](db[_0x88d0('0x2c')][_0x88d0('0x2d')]);_0x28f306[_0x88d0('0x2e')]=_[_0x88d0('0x2b')](_0xa17c71[_0x88d0('0x2e')]);_0x28f306[_0x88d0('0x2f')]=_[_0x88d0('0x30')](_0x28f306[_0x88d0('0x2a')],_0x28f306[_0x88d0('0x2e')]);_0x5bab64[_0x88d0('0x31')]=_['intersection'](_0x28f306[_0x88d0('0x2a')],qs[_0x88d0('0x32')](_0xa17c71[_0x88d0('0x2e')][_0x88d0('0x32')]));_0x5bab64[_0x88d0('0x31')]=_0x5bab64[_0x88d0('0x31')][_0x88d0('0x33')]?_0x5bab64[_0x88d0('0x31')]:_0x28f306[_0x88d0('0x2a')];if(_0xa17c71['query'][_0x88d0('0x34')]){_0x5bab64[_0x88d0('0x35')]=[{'all':!![]}];}_0x5bab64=_[_0x88d0('0x36')]({},_0x5bab64,_0xa17c71[_0x88d0('0x37')]);return db[_0x88d0('0x2c')]['find'](_0x5bab64)[_0x88d0('0x23')](handleEntityNotFound(_0x32782e,null))[_0x88d0('0x23')](respondWithResult(_0x32782e,null))[_0x88d0('0x38')](handleError(_0x32782e,null));};exports[_0x88d0('0x39')]=function(_0x2cb175,_0x46e3db){if(_0x2cb175[_0x88d0('0x3a')]['id']){delete _0x2cb175[_0x88d0('0x3a')]['id'];}return db[_0x88d0('0x2c')][_0x88d0('0x3b')]({'where':{'id':_0x2cb175[_0x88d0('0x29')]['id']}})[_0x88d0('0x23')](handleEntityNotFound(_0x46e3db,null))[_0x88d0('0x23')](saveUpdates(_0x2cb175[_0x88d0('0x3a')],null))['then'](respondWithResult(_0x46e3db,null))[_0x88d0('0x38')](handleError(_0x46e3db,null));};exports['destroy']=function(_0x29f08b,_0x4d67fb){return db[_0x88d0('0x2c')][_0x88d0('0x3b')]({'where':{'id':_0x29f08b[_0x88d0('0x29')]['id']}})['then'](handleEntityNotFound(_0x4d67fb,null))[_0x88d0('0x23')](removeEntity(_0x4d67fb,null))[_0x88d0('0x38')](handleError(_0x4d67fb,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 72d0068..570a519 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 _0xc678=['define','chat_applications','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x3aea15,_0x5ec90f){var _0x1ee54a=function(_0x608d07){while(--_0x608d07){_0x3aea15['push'](_0x3aea15['shift']());}};_0x1ee54a(++_0x5ec90f);}(_0xc678,0x1b4));var _0x8c67=function(_0x541c9a,_0x15c154){_0x541c9a=_0x541c9a-0x0;var _0x50fbae=_0xc678[_0x541c9a];return _0x50fbae;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8c67('0x0'))(_0x8c67('0x1'));var moment=require(_0x8c67('0x2'));var BPromise=require('bluebird');var rp=require(_0x8c67('0x3'));var fs=require('fs');var path=require(_0x8c67('0x4'));var rimraf=require(_0x8c67('0x5'));var config=require(_0x8c67('0x6'));var attributes=require('./chatApplication.attributes');module[_0x8c67('0x7')]=function(_0x5cdb40,_0x351c21){return _0x5cdb40[_0x8c67('0x8')]('ChatApplication',attributes,{'tableName':_0x8c67('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8c67('0xa'),'collate':_0x8c67('0xb')});}; \ No newline at end of file +var _0x1b12=['ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x1b12,0x1b6));var _0x21b1=function(_0x2d02eb,_0x317324){_0x2d02eb=_0x2d02eb-0x0;var _0x41ea15=_0x1b12[_0x2d02eb];return _0x41ea15;};'use strict';var _=require(_0x21b1('0x0'));var util=require('util');var logger=require(_0x21b1('0x1'))(_0x21b1('0x2'));var moment=require(_0x21b1('0x3'));var BPromise=require('bluebird');var rp=require(_0x21b1('0x4'));var fs=require('fs');var path=require(_0x21b1('0x5'));var rimraf=require(_0x21b1('0x6'));var config=require(_0x21b1('0x7'));var attributes=require('./chatApplication.attributes');module[_0x21b1('0x8')]=function(_0x16ab91,_0x34ed01){return _0x16ab91[_0x21b1('0x9')](_0x21b1('0xa'),attributes,{'tableName':_0x21b1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x21b1('0xc'),'collate':_0x21b1('0xd')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 6df7cfe..39dfdfc 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 _0xbdf8=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbdf8,0x120));var _0x8bdf=function(_0xf3045b,_0x59987b){_0xf3045b=_0xf3045b-0x0;var _0x2d0959=_0xbdf8[_0xf3045b];return _0x2d0959;};'use strict';var _=require(_0x8bdf('0x0'));var util=require('util');var moment=require(_0x8bdf('0x1'));var BPromise=require(_0x8bdf('0x2'));var rs=require(_0x8bdf('0x3'));var fs=require('fs');var Redis=require(_0x8bdf('0x4'));var db=require(_0x8bdf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8bdf('0x6'))(_0x8bdf('0x7'));var config=require(_0x8bdf('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8bdf('0x9')][_0x8bdf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1a4011,_0x34f94c,_0x23fe0a){return new BPromise(function(_0x419f57,_0x108a83){return client[_0x8bdf('0xb')](_0x1a4011,_0x23fe0a)[_0x8bdf('0xc')](function(_0x526e97){logger['info'](_0x8bdf('0xd'),_0x34f94c,_0x8bdf('0xe'));logger[_0x8bdf('0xf')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0x34f94c,_0x8bdf('0xe'),JSON[_0x8bdf('0x10')](_0x526e97));if(_0x526e97[_0x8bdf('0x11')]){if(_0x526e97[_0x8bdf('0x11')][_0x8bdf('0x12')]===0x1f4){logger[_0x8bdf('0x11')](_0x8bdf('0xd'),_0x34f94c,_0x526e97[_0x8bdf('0x11')][_0x8bdf('0x13')]);return _0x108a83(_0x526e97[_0x8bdf('0x11')][_0x8bdf('0x13')]);}logger[_0x8bdf('0x11')]('ChatApplication,\x20%s,\x20%s',_0x34f94c,_0x526e97[_0x8bdf('0x11')][_0x8bdf('0x13')]);return _0x419f57(_0x526e97[_0x8bdf('0x11')][_0x8bdf('0x13')]);}else{logger['info']('ChatApplication,\x20%s,\x20%s',_0x34f94c,_0x8bdf('0xe'));_0x419f57(_0x526e97[_0x8bdf('0x14')][_0x8bdf('0x13')]);}})[_0x8bdf('0x15')](function(_0x5d8f86){logger[_0x8bdf('0x11')](_0x8bdf('0xd'),_0x34f94c,_0x5d8f86);_0x108a83(_0x5d8f86);});});} \ No newline at end of file +var _0x26ee=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','moment'];(function(_0xf55be,_0x52451a){var _0x89b95f=function(_0x55dc94){while(--_0x55dc94){_0xf55be['push'](_0xf55be['shift']());}};_0x89b95f(++_0x52451a);}(_0x26ee,0x1e2));var _0xe26e=function(_0x52753e,_0x188c1e){_0x52753e=_0x52753e-0x0;var _0x2dab27=_0x26ee[_0x52753e];return _0x2dab27;};'use strict';var _=require(_0xe26e('0x0'));var util=require('util');var moment=require(_0xe26e('0x1'));var BPromise=require(_0xe26e('0x2'));var rs=require(_0xe26e('0x3'));var fs=require('fs');var Redis=require(_0xe26e('0x4'));var db=require(_0xe26e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe26e('0x6'))(_0xe26e('0x7'));var config=require(_0xe26e('0x8'));var jayson=require(_0xe26e('0x9'));var client=jayson[_0xe26e('0xa')][_0xe26e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2bbf53,_0x40b3e4,_0x5883e4){return new BPromise(function(_0x40853a,_0x48fb8f){return client[_0xe26e('0xc')](_0x2bbf53,_0x5883e4)['then'](function(_0x427875){logger[_0xe26e('0xd')](_0xe26e('0xe'),_0x40b3e4,_0xe26e('0xf'));logger[_0xe26e('0x10')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0x40b3e4,_0xe26e('0xf'),JSON['stringify'](_0x427875));if(_0x427875[_0xe26e('0x11')]){if(_0x427875['error'][_0xe26e('0x12')]===0x1f4){logger[_0xe26e('0x11')](_0xe26e('0xe'),_0x40b3e4,_0x427875[_0xe26e('0x11')]['message']);return _0x48fb8f(_0x427875[_0xe26e('0x11')][_0xe26e('0x13')]);}logger[_0xe26e('0x11')]('ChatApplication,\x20%s,\x20%s',_0x40b3e4,_0x427875[_0xe26e('0x11')][_0xe26e('0x13')]);return _0x40853a(_0x427875['error'][_0xe26e('0x13')]);}else{logger[_0xe26e('0xd')](_0xe26e('0xe'),_0x40b3e4,_0xe26e('0xf'));_0x40853a(_0x427875[_0xe26e('0x14')][_0xe26e('0x13')]);}})[_0xe26e('0x15')](function(_0xca24a4){logger[_0xe26e('0x11')](_0xe26e('0xe'),_0x40b3e4,_0xca24a4);_0x48fb8f(_0xca24a4);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index b56d4da..8ede07a 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 _0xdd4e=['/:id','show','put','isAuthenticated','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./chatApplication.controller','get'];(function(_0x310d56,_0x581328){var _0x8759c7=function(_0x2eafc5){while(--_0x2eafc5){_0x310d56['push'](_0x310d56['shift']());}};_0x8759c7(++_0x581328);}(_0xdd4e,0xd3));var _0xedd4=function(_0x412e27,_0x20a978){_0x412e27=_0x412e27-0x0;var _0x53da42=_0xdd4e[_0x412e27];return _0x53da42;};'use strict';var multer=require(_0xedd4('0x0'));var util=require(_0xedd4('0x1'));var path=require(_0xedd4('0x2'));var timeout=require(_0xedd4('0x3'));var express=require(_0xedd4('0x4'));var router=express[_0xedd4('0x5')]();var fs_extra=require(_0xedd4('0x6'));var auth=require(_0xedd4('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xedd4('0x8'));router[_0xedd4('0x9')](_0xedd4('0xa'),auth['isAuthenticated'](),controller[_0xedd4('0xb')]);router[_0xedd4('0xc')](_0xedd4('0xa'),auth[_0xedd4('0xd')](),controller[_0xedd4('0xe')]);router[_0xedd4('0xf')]('/:id',auth[_0xedd4('0xd')](),controller[_0xedd4('0x10')]);module['exports']=router; \ No newline at end of file +var _0x570d=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','/:id','show','put','isAuthenticated','update','delete','exports','multer','util','path','connect-timeout','express'];(function(_0x2fb624,_0x1e7832){var _0x18e5d0=function(_0x544ef3){while(--_0x544ef3){_0x2fb624['push'](_0x2fb624['shift']());}};_0x18e5d0(++_0x1e7832);}(_0x570d,0xfa));var _0xd570=function(_0x241ef5,_0x17f16a){_0x241ef5=_0x241ef5-0x0;var _0x2e72e7=_0x570d[_0x241ef5];return _0x2e72e7;};'use strict';var multer=require(_0xd570('0x0'));var util=require(_0xd570('0x1'));var path=require(_0xd570('0x2'));var timeout=require(_0xd570('0x3'));var express=require(_0xd570('0x4'));var router=express[_0xd570('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xd570('0x6'));var interaction=require(_0xd570('0x7'));var config=require(_0xd570('0x8'));var controller=require(_0xd570('0x9'));router['get'](_0xd570('0xa'),auth['isAuthenticated'](),controller[_0xd570('0xb')]);router[_0xd570('0xc')](_0xd570('0xa'),auth[_0xd570('0xd')](),controller[_0xd570('0xe')]);router[_0xd570('0xf')](_0xd570('0xa'),auth[_0xd570('0xd')](),controller['destroy']);module[_0xd570('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index cb18086..ebeaa91 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 _0xf4b9=['STRING','BOOLEAN','exports'];(function(_0x31eef3,_0x159c9d){var _0x49caee=function(_0x24b93e){while(--_0x24b93e){_0x31eef3['push'](_0x31eef3['shift']());}};_0x49caee(++_0x159c9d);}(_0xf4b9,0xbc));var _0x9f4b=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0xf4b9[_0x5f09c5];return _0x426ad9;};'use strict';var Sequelize=require('sequelize');module[_0x9f4b('0x0')]={'name':{'type':Sequelize[_0x9f4b('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0x9f4b('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x3dec=['STRING','sequelize','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3dec,0x8e));var _0xc3de=function(_0x230951,_0x4dad52){_0x230951=_0x230951-0x0;var _0xeb26b1=_0x3dec[_0x230951];return _0xeb26b1;};'use strict';var Sequelize=require(_0xc3de('0x0'));module[_0xc3de('0x1')]={'name':{'type':Sequelize[_0xc3de('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xc3de('0x2')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 0ca2821..5719dc0 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 _0x6082=['body','update','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','getMembers','findOne','removeMembers','addMessage','ChatGroupId','getMessages','format','YYYY-MM-DD\x20HH:mm:ss','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','then','destroy','error','name','send','map','ChatGroup','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','findAll','catch','show','params','include','find','create'];(function(_0x6b14c8,_0x3be7c2){var _0x51b553=function(_0x483dd){while(--_0x483dd){_0x6b14c8['push'](_0x6b14c8['shift']());}};_0x51b553(++_0x3be7c2);}(_0x6082,0x124));var _0x2608=function(_0x5202e8,_0x176362){_0x5202e8=_0x5202e8-0x0;var _0x290bff=_0x6082[_0x5202e8];return _0x290bff;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2608('0x0'));var zipdir=require(_0x2608('0x1'));var jsonpatch=require(_0x2608('0x2'));var rp=require(_0x2608('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2608('0x4'));var util=require(_0x2608('0x5'));var path=require(_0x2608('0x6'));var sox=require('sox');var csv=require(_0x2608('0x7'));var ejs=require(_0x2608('0x8'));var fs=require('fs');var fs_extra=require(_0x2608('0x9'));var _=require(_0x2608('0xa'));var squel=require(_0x2608('0xb'));var crypto=require(_0x2608('0xc'));var jsforce=require(_0x2608('0xd'));var deskjs=require(_0x2608('0xe'));var toCsv=require('to-csv');var querystring=require(_0x2608('0xf'));var Papa=require(_0x2608('0x10'));var Redis=require(_0x2608('0x11'));var authService=require(_0x2608('0x12'));var qs=require(_0x2608('0x13'));var as=require(_0x2608('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2608('0x15'));var utils=require(_0x2608('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2608('0x17'))['db'];config[_0x2608('0x18')]=_[_0x2608('0x19')](config[_0x2608('0x18')],{'host':_0x2608('0x1a'),'port':0x18eb});var socket=require(_0x2608('0x1b'))(new Redis(config['redis']));require('./chatGroup.socket')[_0x2608('0x1c')](socket);function respondWithStatusCode(_0x3b5eb6,_0x33aa67){_0x33aa67=_0x33aa67||0xcc;return function(_0x461c74){if(_0x461c74){return _0x3b5eb6[_0x2608('0x1d')](_0x33aa67);}return _0x3b5eb6[_0x2608('0x1e')](_0x33aa67)[_0x2608('0x1f')]();};}function respondWithResult(_0x3a1fae,_0x9cc8a1){_0x9cc8a1=_0x9cc8a1||0xc8;return function(_0x27fab8){if(_0x27fab8){return _0x3a1fae['status'](_0x9cc8a1)[_0x2608('0x20')](_0x27fab8);}};}function respondWithFilteredResult(_0x25db8a,_0x921df5){return function(_0x5badf1){if(_0x5badf1){var _0x311143=typeof _0x921df5[_0x2608('0x21')]===_0x2608('0x22')&&typeof _0x921df5[_0x2608('0x23')]===_0x2608('0x22');var _0x25bd68=_0x5badf1['count'];var _0x436e16=_0x311143?0x0:_0x921df5[_0x2608('0x21')];var _0x6b92dc=_0x311143?_0x5badf1[_0x2608('0x24')]:_0x921df5['offset']+_0x921df5['limit'];var _0x3cc4e5;if(_0x6b92dc>=_0x25bd68){_0x6b92dc=_0x25bd68;_0x3cc4e5=0xc8;}else{_0x3cc4e5=0xce;}_0x25db8a['status'](_0x3cc4e5);return _0x25db8a[_0x2608('0x25')](_0x2608('0x26'),_0x436e16+'-'+_0x6b92dc+'/'+_0x25bd68)[_0x2608('0x20')](_0x5badf1);}return null;};}function patchUpdates(_0x4399b0){return function(_0x46bbed){try{jsonpatch['apply'](_0x46bbed,_0x4399b0,!![]);}catch(_0x25f0b2){return BPromise['reject'](_0x25f0b2);}return _0x46bbed[_0x2608('0x27')]();};}function saveUpdates(_0x4c315f,_0x39c823){return function(_0x3e313c){if(_0x3e313c){return _0x3e313c['update'](_0x4c315f)[_0x2608('0x28')](function(_0x28dcd7){return _0x28dcd7;});}return null;};}function removeEntity(_0x4e459d,_0x1e3f25){return function(_0x92cab2){if(_0x92cab2){return _0x92cab2[_0x2608('0x29')]()['then'](function(){_0x4e459d['status'](0xcc)[_0x2608('0x1f')]();});}};}function handleEntityNotFound(_0x27dd94,_0x559497){return function(_0x225bc4){if(!_0x225bc4){_0x27dd94[_0x2608('0x1d')](0x194);}return _0x225bc4;};}function handleError(_0x123305,_0x1c8a42){_0x1c8a42=_0x1c8a42||0x1f4;return function(_0x3942ad){logger[_0x2608('0x2a')](_0x3942ad['stack']);if(_0x3942ad[_0x2608('0x2b')]){delete _0x3942ad['name'];}_0x123305[_0x2608('0x1e')](_0x1c8a42)[_0x2608('0x2c')](_0x3942ad);};}exports['index']=function(_0x3d7802,_0x5bebc6){var _0x5f2a21={},_0x70690f={},_0x4ea49e={'count':0x0,'rows':[]};var _0xdafefa=_[_0x2608('0x2d')](db[_0x2608('0x2e')][_0x2608('0x2f')],function(_0x29f413){return{'name':_0x29f413[_0x2608('0x30')],'type':_0x29f413['type'][_0x2608('0x31')]};});_0x70690f[_0x2608('0x32')]=_[_0x2608('0x2d')](_0xdafefa,'name');_0x70690f[_0x2608('0x33')]=_[_0x2608('0x34')](_0x3d7802[_0x2608('0x33')]);_0x70690f[_0x2608('0x35')]=_['intersection'](_0x70690f[_0x2608('0x32')],_0x70690f[_0x2608('0x33')]);_0x5f2a21[_0x2608('0x36')]=_[_0x2608('0x37')](_0x70690f[_0x2608('0x32')],qs[_0x2608('0x38')](_0x3d7802[_0x2608('0x33')][_0x2608('0x38')]));_0x5f2a21[_0x2608('0x36')]=_0x5f2a21[_0x2608('0x36')][_0x2608('0x39')]?_0x5f2a21['attributes']:_0x70690f[_0x2608('0x32')];if(!_0x3d7802[_0x2608('0x33')][_0x2608('0x3a')](_0x2608('0x3b'))){_0x5f2a21[_0x2608('0x23')]=qs['limit'](_0x3d7802[_0x2608('0x33')]['limit']);_0x5f2a21[_0x2608('0x21')]=qs[_0x2608('0x21')](_0x3d7802[_0x2608('0x33')][_0x2608('0x21')]);}_0x5f2a21[_0x2608('0x3c')]=qs[_0x2608('0x3d')](_0x3d7802[_0x2608('0x33')][_0x2608('0x3d')]);_0x5f2a21[_0x2608('0x3e')]=qs['filters'](_[_0x2608('0x3f')](_0x3d7802['query'],_0x70690f['filters']),_0xdafefa);if(_0x3d7802[_0x2608('0x33')][_0x2608('0x40')]){_0x5f2a21[_0x2608('0x3e')]=_[_0x2608('0x41')](_0x5f2a21[_0x2608('0x3e')],{'$or':_[_0x2608('0x2d')](_0xdafefa,function(_0x40549e){if(_0x40549e[_0x2608('0x42')]!=='VIRTUAL'){var _0xbcc4e9={};_0xbcc4e9[_0x40549e['name']]={'$like':'%'+_0x3d7802['query'][_0x2608('0x40')]+'%'};return _0xbcc4e9;}})});}_0x5f2a21=_[_0x2608('0x41')]({},_0x5f2a21,_0x3d7802[_0x2608('0x43')]);var _0x1223c5={'where':_0x5f2a21[_0x2608('0x3e')]};return db[_0x2608('0x2e')][_0x2608('0x24')](_0x1223c5)[_0x2608('0x28')](function(_0x3e4a63){_0x4ea49e['count']=_0x3e4a63;if(_0x3d7802[_0x2608('0x33')][_0x2608('0x44')]){_0x5f2a21['include']=[{'all':!![]}];}return db['ChatGroup'][_0x2608('0x45')](_0x5f2a21);})[_0x2608('0x28')](function(_0x39247f){_0x4ea49e['rows']=_0x39247f;return _0x4ea49e;})[_0x2608('0x28')](respondWithFilteredResult(_0x5bebc6,_0x5f2a21))[_0x2608('0x46')](handleError(_0x5bebc6,null));};exports[_0x2608('0x47')]=function(_0x17c509,_0x283c12){var _0x5c1fc2={'raw':!![],'where':{'id':_0x17c509[_0x2608('0x48')]['id']}},_0xc5064a={};_0xc5064a['model']=_[_0x2608('0x34')](db[_0x2608('0x2e')][_0x2608('0x2f')]);_0xc5064a[_0x2608('0x33')]=_['keys'](_0x17c509[_0x2608('0x33')]);_0xc5064a['filters']=_[_0x2608('0x37')](_0xc5064a[_0x2608('0x32')],_0xc5064a[_0x2608('0x33')]);_0x5c1fc2[_0x2608('0x36')]=_[_0x2608('0x37')](_0xc5064a[_0x2608('0x32')],qs[_0x2608('0x38')](_0x17c509[_0x2608('0x33')]['fields']));_0x5c1fc2['attributes']=_0x5c1fc2['attributes'][_0x2608('0x39')]?_0x5c1fc2[_0x2608('0x36')]:_0xc5064a[_0x2608('0x32')];if(_0x17c509[_0x2608('0x33')][_0x2608('0x44')]){_0x5c1fc2[_0x2608('0x49')]=[{'all':!![]}];}_0x5c1fc2=_['merge']({},_0x5c1fc2,_0x17c509['options']);return db['ChatGroup'][_0x2608('0x4a')](_0x5c1fc2)[_0x2608('0x28')](handleEntityNotFound(_0x283c12,null))[_0x2608('0x28')](respondWithResult(_0x283c12,null))[_0x2608('0x46')](handleError(_0x283c12,null));};exports[_0x2608('0x4b')]=function(_0x35b97e,_0x31f089){return db[_0x2608('0x2e')]['create'](_0x35b97e[_0x2608('0x4c')],{})[_0x2608('0x28')](respondWithResult(_0x31f089,0xc9))[_0x2608('0x46')](handleError(_0x31f089,null));};exports[_0x2608('0x4d')]=function(_0x3dac59,_0x44a2ab){if(_0x3dac59[_0x2608('0x4c')]['id']){delete _0x3dac59[_0x2608('0x4c')]['id'];}return db[_0x2608('0x2e')][_0x2608('0x4a')]({'where':{'id':_0x3dac59[_0x2608('0x48')]['id']}})[_0x2608('0x28')](handleEntityNotFound(_0x44a2ab,null))[_0x2608('0x28')](saveUpdates(_0x3dac59[_0x2608('0x4c')],null))['then'](respondWithResult(_0x44a2ab,null))['catch'](handleError(_0x44a2ab,null));};exports[_0x2608('0x29')]=function(_0x148e87,_0x1744fa){return db[_0x2608('0x2e')][_0x2608('0x4a')]({'where':{'id':_0x148e87[_0x2608('0x48')]['id']}})[_0x2608('0x28')](handleEntityNotFound(_0x1744fa,null))['then'](removeEntity(_0x1744fa,null))['catch'](handleError(_0x1744fa,null));};exports['describe']=function(_0x590911,_0x4bdaeb){return db[_0x2608('0x2e')][_0x2608('0x4e')]()['then'](respondWithResult(_0x4bdaeb,null))[_0x2608('0x46')](handleError(_0x4bdaeb,null));};exports[_0x2608('0x4f')]=function(_0x20025c,_0x3f9de1,_0x36cb3c){return db[_0x2608('0x50')]['count']({'where':{'ChatGroupId':_0x20025c[_0x2608('0x48')]['id'],'ToId':_0x20025c[_0x2608('0x51')]['id'],'read':![]}})[_0x2608('0x28')](function(_0x4a7d5e){return{'id':_[_0x2608('0x52')](_0x20025c[_0x2608('0x48')]['id']),'count':_0x4a7d5e};})['then'](respondWithResult(_0x3f9de1,null))['catch'](handleError(_0x3f9de1,null));};exports[_0x2608('0x53')]=function(_0x44fb75,_0x367f96,_0x59db46){return db[_0x2608('0x2e')][_0x2608('0x4a')]({'where':{'id':_0x44fb75[_0x2608('0x48')]['id']}})[_0x2608('0x28')](handleEntityNotFound(_0x367f96,null))[_0x2608('0x28')](function(_0x1b5178){if(_0x1b5178){return _0x1b5178['addMembers'](_0x44fb75[_0x2608('0x4c')]['ids'],_['omit'](_0x44fb75[_0x2608('0x4c')],['ids','id'])||{});}})[_0x2608('0x28')](respondWithResult(_0x367f96,null))[_0x2608('0x46')](handleError(_0x367f96,null));};exports[_0x2608('0x54')]=function(_0x3b6a40,_0x5dd9ce,_0x440d53){var _0x4ab768={};var _0x1df361={};var _0x567684;var _0xffc7c5;return db[_0x2608('0x2e')][_0x2608('0x55')]({'where':{'id':_0x3b6a40[_0x2608('0x48')]['id']}})[_0x2608('0x28')](handleEntityNotFound(_0x5dd9ce,null))[_0x2608('0x28')](function(_0x5a05f1){if(_0x5a05f1){_0x567684=_0x5a05f1;_0x1df361['model']=_['keys'](db['User'][_0x2608('0x2f')]);_0x1df361[_0x2608('0x33')]=_['keys'](_0x3b6a40[_0x2608('0x33')]);_0x1df361[_0x2608('0x35')]=_[_0x2608('0x37')](_0x1df361[_0x2608('0x32')],_0x1df361[_0x2608('0x33')]);_0x4ab768['attributes']=_[_0x2608('0x37')](_0x1df361[_0x2608('0x32')],qs[_0x2608('0x38')](_0x3b6a40['query'][_0x2608('0x38')]));_0x4ab768['attributes']=_0x4ab768[_0x2608('0x36')]['length']?_0x4ab768['attributes']:_0x1df361[_0x2608('0x32')];_0x4ab768[_0x2608('0x3c')]=qs['sort'](_0x3b6a40[_0x2608('0x33')][_0x2608('0x3d')]);_0x4ab768['where']=qs[_0x2608('0x35')](_['pick'](_0x3b6a40[_0x2608('0x33')],_0x1df361['filters']));if(_0x3b6a40['query'][_0x2608('0x40')]){_0x4ab768['where']=_[_0x2608('0x41')](_0x4ab768[_0x2608('0x3e')],{'$or':_[_0x2608('0x2d')](_0x4ab768['attributes'],function(_0x4c7f71){var _0x465039={};_0x465039[_0x4c7f71]={'$like':'%'+_0x3b6a40[_0x2608('0x33')]['filter']+'%'};return _0x465039;})});}_0x4ab768=_[_0x2608('0x41')]({},_0x4ab768,_0x3b6a40[_0x2608('0x43')]);return _0x567684[_0x2608('0x54')](_0x4ab768);}})['then'](function(_0x3a32da){if(_0x3a32da){_0xffc7c5=_0x3a32da[_0x2608('0x39')];if(!_0x3b6a40['query']['hasOwnProperty'](_0x2608('0x3b'))){_0x4ab768['limit']=qs[_0x2608('0x23')](_0x3b6a40[_0x2608('0x33')][_0x2608('0x23')]);_0x4ab768[_0x2608('0x21')]=qs[_0x2608('0x21')](_0x3b6a40[_0x2608('0x33')][_0x2608('0x21')]);}return _0x567684[_0x2608('0x54')](_0x4ab768);}})[_0x2608('0x28')](function(_0x219e52){if(_0x219e52){return _0x219e52?{'count':_0xffc7c5,'rows':_0x219e52}:null;}})['then'](respondWithResult(_0x5dd9ce,null))['catch'](handleError(_0x5dd9ce,null));};exports[_0x2608('0x56')]=function(_0x570d8b,_0x1212ce,_0x48c5fb){return db[_0x2608('0x2e')]['find']({'where':{'id':_0x570d8b[_0x2608('0x48')]['id']}})[_0x2608('0x28')](handleEntityNotFound(_0x1212ce,null))[_0x2608('0x28')](function(_0x4dac97){if(_0x4dac97){return _0x4dac97[_0x2608('0x56')](_0x570d8b[_0x2608('0x33')]['ids']);}})[_0x2608('0x28')](respondWithStatusCode(_0x1212ce,null))['catch'](handleError(_0x1212ce,null));};exports[_0x2608('0x57')]=function(_0x4681f0,_0x122a42,_0x218230){if(_0x4681f0['body']['id']){delete _0x4681f0[_0x2608('0x4c')]['id'];}return db[_0x2608('0x2e')][_0x2608('0x4a')]({'where':{'id':_0x4681f0['params']['id']}})['then'](handleEntityNotFound(_0x122a42,null))['then'](function(_0x345fd2){if(_0x345fd2){_0x4681f0[_0x2608('0x4c')][_0x2608('0x58')]=_0x345fd2['id'];return db['ChatInternalMessage'][_0x2608('0x4b')](_0x4681f0[_0x2608('0x4c')]);}})[_0x2608('0x28')](respondWithResult(_0x122a42,null))[_0x2608('0x46')](handleError(_0x122a42,null));};exports[_0x2608('0x59')]=function(_0x1bd1fd,_0x1e9d95,_0x70445d){var _0x3a74e0={};var _0x4db469={};var _0x356c23;var _0x52b4f9;return db[_0x2608('0x2e')][_0x2608('0x55')]({'where':{'id':_0x1bd1fd[_0x2608('0x48')]['id']}})[_0x2608('0x28')](handleEntityNotFound(_0x1e9d95,null))[_0x2608('0x28')](function(_0x27de4d){if(_0x27de4d){_0x356c23=_0x27de4d;_0x4db469[_0x2608('0x32')]=_[_0x2608('0x34')](db[_0x2608('0x50')][_0x2608('0x2f')]);_0x4db469[_0x2608('0x33')]=_[_0x2608('0x34')](_0x1bd1fd[_0x2608('0x33')]);_0x4db469[_0x2608('0x35')]=_[_0x2608('0x37')](_0x4db469[_0x2608('0x32')],_0x4db469[_0x2608('0x33')]);_0x3a74e0[_0x2608('0x36')]=_['intersection'](_0x4db469[_0x2608('0x32')],qs['fields'](_0x1bd1fd[_0x2608('0x33')][_0x2608('0x38')]));_0x3a74e0[_0x2608('0x36')]=_0x3a74e0[_0x2608('0x36')][_0x2608('0x39')]?_0x3a74e0[_0x2608('0x36')]:_0x4db469[_0x2608('0x32')];_0x3a74e0[_0x2608('0x3c')]=qs[_0x2608('0x3d')](_0x1bd1fd[_0x2608('0x33')][_0x2608('0x3d')]);_0x3a74e0[_0x2608('0x3e')]=qs[_0x2608('0x35')](_['pick'](_0x1bd1fd[_0x2608('0x33')],_0x4db469['filters']));if(_0x1bd1fd['query'][_0x2608('0x40')]){_0x3a74e0[_0x2608('0x3e')]=_[_0x2608('0x41')](_0x3a74e0['where'],{'$or':_[_0x2608('0x2d')](_0x3a74e0[_0x2608('0x36')],function(_0x2d12bd){var _0x26967f={};_0x26967f[_0x2d12bd]={'$like':'%'+_0x1bd1fd['query'][_0x2608('0x40')]+'%'};return _0x26967f;})});}if(_0x1bd1fd[_0x2608('0x33')]['$gte']){var _0x1323f1=_0x1bd1fd['query']['$gte']['split'](',');var _0x495480={};_0x495480[_0x1323f1[0x0]]={'$gte':moment(_0x1323f1[0x1])[_0x2608('0x5a')](_0x2608('0x5b'))};_0x3a74e0[_0x2608('0x3e')]=_[_0x2608('0x41')](_0x3a74e0[_0x2608('0x3e')],_0x495480);}_0x3a74e0=_[_0x2608('0x41')]({},_0x3a74e0,_0x1bd1fd[_0x2608('0x43')]);return _0x356c23[_0x2608('0x59')](_0x3a74e0);}})[_0x2608('0x28')](function(_0x8a1568){if(_0x8a1568){_0x52b4f9=_0x8a1568[_0x2608('0x39')];if(!_0x1bd1fd[_0x2608('0x33')][_0x2608('0x3a')]('nolimit')){_0x3a74e0['limit']=qs[_0x2608('0x23')](_0x1bd1fd[_0x2608('0x33')][_0x2608('0x23')]);_0x3a74e0[_0x2608('0x21')]=qs[_0x2608('0x21')](_0x1bd1fd[_0x2608('0x33')]['offset']);}return _0x356c23['getMessages'](_0x3a74e0);}})['then'](function(_0x1cd938){if(_0x1cd938){return _0x1cd938?{'count':_0x52b4f9,'rows':_0x1cd938}:null;}})[_0x2608('0x28')](respondWithResult(_0x1e9d95,null))[_0x2608('0x46')](handleError(_0x1e9d95,null));}; \ No newline at end of file +var _0xc996=['show','create','update','find','params','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','omit','body','getMembers','findOne','User','order','pick','removeMembers','addMessage','ChatGroupId','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','zip-dir','fast-json-patch','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','sendStatus','status','offset','limit','undefined','count','set','Content-Range','json','reject','save','destroy','then','end','error','stack','name','send','index','ChatGroup','rawAttributes','model','map','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch'];(function(_0x4f583e,_0x64c65a){var _0x1e5002=function(_0x12a0a5){while(--_0x12a0a5){_0x4f583e['push'](_0x4f583e['shift']());}};_0x1e5002(++_0x64c65a);}(_0xc996,0x144));var _0x6c99=function(_0x459d40,_0x5a20d6){_0x459d40=_0x459d40-0x0;var _0x19c224=_0xc996[_0x459d40];return _0x19c224;};'use strict';var emlformat=require(_0x6c99('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6c99('0x1'));var jsonpatch=require(_0x6c99('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6c99('0x3'));var path=require(_0x6c99('0x4'));var sox=require(_0x6c99('0x5'));var csv=require(_0x6c99('0x6'));var ejs=require(_0x6c99('0x7'));var fs=require('fs');var fs_extra=require(_0x6c99('0x8'));var _=require(_0x6c99('0x9'));var squel=require('squel');var crypto=require(_0x6c99('0xa'));var jsforce=require(_0x6c99('0xb'));var deskjs=require(_0x6c99('0xc'));var toCsv=require(_0x6c99('0x6'));var querystring=require(_0x6c99('0xd'));var Papa=require(_0x6c99('0xe'));var Redis=require(_0x6c99('0xf'));var authService=require(_0x6c99('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x6c99('0x11'));var hardwareService=require(_0x6c99('0x12'));var logger=require(_0x6c99('0x13'))('api');var utils=require(_0x6c99('0x14'));var config=require(_0x6c99('0x15'));var licenseUtil=require(_0x6c99('0x16'));var db=require(_0x6c99('0x17'))['db'];config['redis']=_[_0x6c99('0x18')](config[_0x6c99('0x19')],{'host':_0x6c99('0x1a'),'port':0x18eb});var socket=require(_0x6c99('0x1b'))(new Redis(config['redis']));require('./chatGroup.socket')[_0x6c99('0x1c')](socket);function respondWithStatusCode(_0x1b5a05,_0x141f5f){_0x141f5f=_0x141f5f||0xcc;return function(_0x38b90c){if(_0x38b90c){return _0x1b5a05[_0x6c99('0x1d')](_0x141f5f);}return _0x1b5a05[_0x6c99('0x1e')](_0x141f5f)['end']();};}function respondWithResult(_0x526d4b,_0x113cb4){_0x113cb4=_0x113cb4||0xc8;return function(_0x18cc2c){if(_0x18cc2c){return _0x526d4b[_0x6c99('0x1e')](_0x113cb4)['json'](_0x18cc2c);}};}function respondWithFilteredResult(_0x1fce6e,_0x4a36d1){return function(_0x586ed1){if(_0x586ed1){var _0x26d6bd=typeof _0x4a36d1[_0x6c99('0x1f')]==='undefined'&&typeof _0x4a36d1[_0x6c99('0x20')]===_0x6c99('0x21');var _0x41fbbc=_0x586ed1[_0x6c99('0x22')];var _0x59ad2a=_0x26d6bd?0x0:_0x4a36d1[_0x6c99('0x1f')];var _0x16d5b7=_0x26d6bd?_0x586ed1[_0x6c99('0x22')]:_0x4a36d1['offset']+_0x4a36d1[_0x6c99('0x20')];var _0xb20d66;if(_0x16d5b7>=_0x41fbbc){_0x16d5b7=_0x41fbbc;_0xb20d66=0xc8;}else{_0xb20d66=0xce;}_0x1fce6e[_0x6c99('0x1e')](_0xb20d66);return _0x1fce6e[_0x6c99('0x23')](_0x6c99('0x24'),_0x59ad2a+'-'+_0x16d5b7+'/'+_0x41fbbc)[_0x6c99('0x25')](_0x586ed1);}return null;};}function patchUpdates(_0x770a6c){return function(_0x538873){try{jsonpatch['apply'](_0x538873,_0x770a6c,!![]);}catch(_0x2e3a1b){return BPromise[_0x6c99('0x26')](_0x2e3a1b);}return _0x538873[_0x6c99('0x27')]();};}function saveUpdates(_0x4f7163,_0x3b6c91){return function(_0xc4edbc){if(_0xc4edbc){return _0xc4edbc['update'](_0x4f7163)['then'](function(_0x5697c0){return _0x5697c0;});}return null;};}function removeEntity(_0x36c5a4,_0x273c60){return function(_0x5dd47f){if(_0x5dd47f){return _0x5dd47f[_0x6c99('0x28')]()[_0x6c99('0x29')](function(){_0x36c5a4['status'](0xcc)[_0x6c99('0x2a')]();});}};}function handleEntityNotFound(_0x5be413,_0x210a5a){return function(_0x3c5f87){if(!_0x3c5f87){_0x5be413[_0x6c99('0x1d')](0x194);}return _0x3c5f87;};}function handleError(_0xab281f,_0x17b2ad){_0x17b2ad=_0x17b2ad||0x1f4;return function(_0x585e18){logger[_0x6c99('0x2b')](_0x585e18[_0x6c99('0x2c')]);if(_0x585e18[_0x6c99('0x2d')]){delete _0x585e18['name'];}_0xab281f['status'](_0x17b2ad)[_0x6c99('0x2e')](_0x585e18);};}exports[_0x6c99('0x2f')]=function(_0x181b45,_0x5c4aee){var _0x314848={},_0x285406={},_0x12be76={'count':0x0,'rows':[]};var _0x1653f1=_['map'](db[_0x6c99('0x30')][_0x6c99('0x31')],function(_0x32c667){return{'name':_0x32c667['fieldName'],'type':_0x32c667['type']['key']};});_0x285406[_0x6c99('0x32')]=_[_0x6c99('0x33')](_0x1653f1,'name');_0x285406['query']=_[_0x6c99('0x34')](_0x181b45[_0x6c99('0x35')]);_0x285406['filters']=_[_0x6c99('0x36')](_0x285406['model'],_0x285406[_0x6c99('0x35')]);_0x314848[_0x6c99('0x37')]=_[_0x6c99('0x36')](_0x285406['model'],qs['fields'](_0x181b45[_0x6c99('0x35')][_0x6c99('0x38')]));_0x314848[_0x6c99('0x37')]=_0x314848['attributes'][_0x6c99('0x39')]?_0x314848[_0x6c99('0x37')]:_0x285406[_0x6c99('0x32')];if(!_0x181b45[_0x6c99('0x35')][_0x6c99('0x3a')](_0x6c99('0x3b'))){_0x314848['limit']=qs[_0x6c99('0x20')](_0x181b45[_0x6c99('0x35')]['limit']);_0x314848[_0x6c99('0x1f')]=qs[_0x6c99('0x1f')](_0x181b45[_0x6c99('0x35')][_0x6c99('0x1f')]);}_0x314848['order']=qs[_0x6c99('0x3c')](_0x181b45[_0x6c99('0x35')]['sort']);_0x314848[_0x6c99('0x3d')]=qs['filters'](_['pick'](_0x181b45[_0x6c99('0x35')],_0x285406[_0x6c99('0x3e')]),_0x1653f1);if(_0x181b45[_0x6c99('0x35')][_0x6c99('0x3f')]){_0x314848[_0x6c99('0x3d')]=_[_0x6c99('0x40')](_0x314848['where'],{'$or':_[_0x6c99('0x33')](_0x1653f1,function(_0x4128cd){if(_0x4128cd[_0x6c99('0x41')]!==_0x6c99('0x42')){var _0x3486cc={};_0x3486cc[_0x4128cd[_0x6c99('0x2d')]]={'$like':'%'+_0x181b45[_0x6c99('0x35')][_0x6c99('0x3f')]+'%'};return _0x3486cc;}})});}_0x314848=_['merge']({},_0x314848,_0x181b45[_0x6c99('0x43')]);var _0x2922cb={'where':_0x314848['where']};return db[_0x6c99('0x30')]['count'](_0x2922cb)[_0x6c99('0x29')](function(_0xfffd0){_0x12be76['count']=_0xfffd0;if(_0x181b45[_0x6c99('0x35')][_0x6c99('0x44')]){_0x314848[_0x6c99('0x45')]=[{'all':!![]}];}return db[_0x6c99('0x30')][_0x6c99('0x46')](_0x314848);})[_0x6c99('0x29')](function(_0x526754){_0x12be76['rows']=_0x526754;return _0x12be76;})[_0x6c99('0x29')](respondWithFilteredResult(_0x5c4aee,_0x314848))[_0x6c99('0x47')](handleError(_0x5c4aee,null));};exports[_0x6c99('0x48')]=function(_0x2a141b,_0x2ef5c4){var _0x4b76a1={'raw':!![],'where':{'id':_0x2a141b['params']['id']}},_0x3f7f0a={};_0x3f7f0a[_0x6c99('0x32')]=_[_0x6c99('0x34')](db[_0x6c99('0x30')][_0x6c99('0x31')]);_0x3f7f0a[_0x6c99('0x35')]=_[_0x6c99('0x34')](_0x2a141b[_0x6c99('0x35')]);_0x3f7f0a[_0x6c99('0x3e')]=_[_0x6c99('0x36')](_0x3f7f0a['model'],_0x3f7f0a[_0x6c99('0x35')]);_0x4b76a1[_0x6c99('0x37')]=_[_0x6c99('0x36')](_0x3f7f0a[_0x6c99('0x32')],qs['fields'](_0x2a141b[_0x6c99('0x35')]['fields']));_0x4b76a1[_0x6c99('0x37')]=_0x4b76a1['attributes']['length']?_0x4b76a1['attributes']:_0x3f7f0a[_0x6c99('0x32')];if(_0x2a141b['query'][_0x6c99('0x44')]){_0x4b76a1[_0x6c99('0x45')]=[{'all':!![]}];}_0x4b76a1=_[_0x6c99('0x40')]({},_0x4b76a1,_0x2a141b['options']);return db[_0x6c99('0x30')]['find'](_0x4b76a1)[_0x6c99('0x29')](handleEntityNotFound(_0x2ef5c4,null))[_0x6c99('0x29')](respondWithResult(_0x2ef5c4,null))[_0x6c99('0x47')](handleError(_0x2ef5c4,null));};exports[_0x6c99('0x49')]=function(_0x3627bc,_0x142419){return db[_0x6c99('0x30')]['create'](_0x3627bc['body'],{})['then'](respondWithResult(_0x142419,0xc9))['catch'](handleError(_0x142419,null));};exports[_0x6c99('0x4a')]=function(_0x5ad6a3,_0x5f5b84){if(_0x5ad6a3['body']['id']){delete _0x5ad6a3['body']['id'];}return db[_0x6c99('0x30')][_0x6c99('0x4b')]({'where':{'id':_0x5ad6a3['params']['id']}})[_0x6c99('0x29')](handleEntityNotFound(_0x5f5b84,null))['then'](saveUpdates(_0x5ad6a3['body'],null))[_0x6c99('0x29')](respondWithResult(_0x5f5b84,null))[_0x6c99('0x47')](handleError(_0x5f5b84,null));};exports[_0x6c99('0x28')]=function(_0x368d44,_0x4678da){return db[_0x6c99('0x30')][_0x6c99('0x4b')]({'where':{'id':_0x368d44[_0x6c99('0x4c')]['id']}})[_0x6c99('0x29')](handleEntityNotFound(_0x4678da,null))[_0x6c99('0x29')](removeEntity(_0x4678da,null))[_0x6c99('0x47')](handleError(_0x4678da,null));};exports[_0x6c99('0x4d')]=function(_0x2f64bb,_0x3b3773){return db['ChatGroup']['describe']()[_0x6c99('0x29')](respondWithResult(_0x3b3773,null))[_0x6c99('0x47')](handleError(_0x3b3773,null));};exports[_0x6c99('0x4e')]=function(_0x3fc181,_0xdbb2d1,_0x284aab){return db[_0x6c99('0x4f')][_0x6c99('0x22')]({'where':{'ChatGroupId':_0x3fc181[_0x6c99('0x4c')]['id'],'ToId':_0x3fc181[_0x6c99('0x50')]['id'],'read':![]}})[_0x6c99('0x29')](function(_0x2f51b9){return{'id':_[_0x6c99('0x51')](_0x3fc181[_0x6c99('0x4c')]['id']),'count':_0x2f51b9};})[_0x6c99('0x29')](respondWithResult(_0xdbb2d1,null))[_0x6c99('0x47')](handleError(_0xdbb2d1,null));};exports[_0x6c99('0x52')]=function(_0x33b1a8,_0x3eacab,_0x27044c){return db[_0x6c99('0x30')]['find']({'where':{'id':_0x33b1a8['params']['id']}})[_0x6c99('0x29')](handleEntityNotFound(_0x3eacab,null))[_0x6c99('0x29')](function(_0x54c783){if(_0x54c783){return _0x54c783[_0x6c99('0x52')](_0x33b1a8['body'][_0x6c99('0x53')],_[_0x6c99('0x54')](_0x33b1a8[_0x6c99('0x55')],[_0x6c99('0x53'),'id'])||{});}})['then'](respondWithResult(_0x3eacab,null))['catch'](handleError(_0x3eacab,null));};exports[_0x6c99('0x56')]=function(_0x536b8a,_0x262456,_0x143431){var _0x3874f2={};var _0x507a10={};var _0x3a2415;var _0x4d42f8;return db[_0x6c99('0x30')][_0x6c99('0x57')]({'where':{'id':_0x536b8a[_0x6c99('0x4c')]['id']}})[_0x6c99('0x29')](handleEntityNotFound(_0x262456,null))[_0x6c99('0x29')](function(_0x3bd76e){if(_0x3bd76e){_0x3a2415=_0x3bd76e;_0x507a10[_0x6c99('0x32')]=_[_0x6c99('0x34')](db[_0x6c99('0x58')]['rawAttributes']);_0x507a10[_0x6c99('0x35')]=_[_0x6c99('0x34')](_0x536b8a[_0x6c99('0x35')]);_0x507a10[_0x6c99('0x3e')]=_[_0x6c99('0x36')](_0x507a10['model'],_0x507a10[_0x6c99('0x35')]);_0x3874f2[_0x6c99('0x37')]=_[_0x6c99('0x36')](_0x507a10[_0x6c99('0x32')],qs['fields'](_0x536b8a[_0x6c99('0x35')]['fields']));_0x3874f2[_0x6c99('0x37')]=_0x3874f2[_0x6c99('0x37')][_0x6c99('0x39')]?_0x3874f2[_0x6c99('0x37')]:_0x507a10[_0x6c99('0x32')];_0x3874f2[_0x6c99('0x59')]=qs[_0x6c99('0x3c')](_0x536b8a[_0x6c99('0x35')]['sort']);_0x3874f2[_0x6c99('0x3d')]=qs[_0x6c99('0x3e')](_[_0x6c99('0x5a')](_0x536b8a[_0x6c99('0x35')],_0x507a10[_0x6c99('0x3e')]));if(_0x536b8a[_0x6c99('0x35')][_0x6c99('0x3f')]){_0x3874f2['where']=_[_0x6c99('0x40')](_0x3874f2[_0x6c99('0x3d')],{'$or':_[_0x6c99('0x33')](_0x3874f2[_0x6c99('0x37')],function(_0x190e7b){var _0x49c190={};_0x49c190[_0x190e7b]={'$like':'%'+_0x536b8a[_0x6c99('0x35')][_0x6c99('0x3f')]+'%'};return _0x49c190;})});}_0x3874f2=_[_0x6c99('0x40')]({},_0x3874f2,_0x536b8a['options']);return _0x3a2415['getMembers'](_0x3874f2);}})[_0x6c99('0x29')](function(_0x193434){if(_0x193434){_0x4d42f8=_0x193434[_0x6c99('0x39')];if(!_0x536b8a['query'][_0x6c99('0x3a')](_0x6c99('0x3b'))){_0x3874f2[_0x6c99('0x20')]=qs[_0x6c99('0x20')](_0x536b8a[_0x6c99('0x35')][_0x6c99('0x20')]);_0x3874f2[_0x6c99('0x1f')]=qs['offset'](_0x536b8a[_0x6c99('0x35')][_0x6c99('0x1f')]);}return _0x3a2415[_0x6c99('0x56')](_0x3874f2);}})[_0x6c99('0x29')](function(_0x1e4ae0){if(_0x1e4ae0){return _0x1e4ae0?{'count':_0x4d42f8,'rows':_0x1e4ae0}:null;}})[_0x6c99('0x29')](respondWithResult(_0x262456,null))[_0x6c99('0x47')](handleError(_0x262456,null));};exports[_0x6c99('0x5b')]=function(_0xf85b5c,_0x160953,_0x3f5998){return db['ChatGroup']['find']({'where':{'id':_0xf85b5c[_0x6c99('0x4c')]['id']}})[_0x6c99('0x29')](handleEntityNotFound(_0x160953,null))['then'](function(_0x536b34){if(_0x536b34){return _0x536b34[_0x6c99('0x5b')](_0xf85b5c[_0x6c99('0x35')]['ids']);}})['then'](respondWithStatusCode(_0x160953,null))[_0x6c99('0x47')](handleError(_0x160953,null));};exports[_0x6c99('0x5c')]=function(_0x48e6b8,_0x1d6a13,_0x3211ae){if(_0x48e6b8[_0x6c99('0x55')]['id']){delete _0x48e6b8[_0x6c99('0x55')]['id'];}return db[_0x6c99('0x30')][_0x6c99('0x4b')]({'where':{'id':_0x48e6b8[_0x6c99('0x4c')]['id']}})[_0x6c99('0x29')](handleEntityNotFound(_0x1d6a13,null))['then'](function(_0x271f28){if(_0x271f28){_0x48e6b8[_0x6c99('0x55')][_0x6c99('0x5d')]=_0x271f28['id'];return db[_0x6c99('0x4f')][_0x6c99('0x49')](_0x48e6b8[_0x6c99('0x55')]);}})[_0x6c99('0x29')](respondWithResult(_0x1d6a13,null))[_0x6c99('0x47')](handleError(_0x1d6a13,null));};exports[_0x6c99('0x5e')]=function(_0x55ca9b,_0x3c8c11,_0x1fdd64){var _0x346471={};var _0x2f9df3={};var _0x33a50a;var _0x22c6ff;return db[_0x6c99('0x30')][_0x6c99('0x57')]({'where':{'id':_0x55ca9b[_0x6c99('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3c8c11,null))[_0x6c99('0x29')](function(_0x467d69){if(_0x467d69){_0x33a50a=_0x467d69;_0x2f9df3[_0x6c99('0x32')]=_[_0x6c99('0x34')](db['ChatInternalMessage']['rawAttributes']);_0x2f9df3[_0x6c99('0x35')]=_['keys'](_0x55ca9b[_0x6c99('0x35')]);_0x2f9df3[_0x6c99('0x3e')]=_[_0x6c99('0x36')](_0x2f9df3['model'],_0x2f9df3[_0x6c99('0x35')]);_0x346471['attributes']=_[_0x6c99('0x36')](_0x2f9df3[_0x6c99('0x32')],qs['fields'](_0x55ca9b[_0x6c99('0x35')][_0x6c99('0x38')]));_0x346471[_0x6c99('0x37')]=_0x346471[_0x6c99('0x37')]['length']?_0x346471[_0x6c99('0x37')]:_0x2f9df3['model'];_0x346471[_0x6c99('0x59')]=qs[_0x6c99('0x3c')](_0x55ca9b[_0x6c99('0x35')]['sort']);_0x346471[_0x6c99('0x3d')]=qs[_0x6c99('0x3e')](_[_0x6c99('0x5a')](_0x55ca9b['query'],_0x2f9df3[_0x6c99('0x3e')]));if(_0x55ca9b[_0x6c99('0x35')]['filter']){_0x346471[_0x6c99('0x3d')]=_[_0x6c99('0x40')](_0x346471[_0x6c99('0x3d')],{'$or':_[_0x6c99('0x33')](_0x346471[_0x6c99('0x37')],function(_0x483c2f){var _0x48e2c6={};_0x48e2c6[_0x483c2f]={'$like':'%'+_0x55ca9b[_0x6c99('0x35')][_0x6c99('0x3f')]+'%'};return _0x48e2c6;})});}if(_0x55ca9b[_0x6c99('0x35')][_0x6c99('0x5f')]){var _0x502159=_0x55ca9b[_0x6c99('0x35')][_0x6c99('0x5f')][_0x6c99('0x60')](',');var _0x2ecbf8={};_0x2ecbf8[_0x502159[0x0]]={'$gte':moment(_0x502159[0x1])[_0x6c99('0x61')](_0x6c99('0x62'))};_0x346471[_0x6c99('0x3d')]=_['merge'](_0x346471[_0x6c99('0x3d')],_0x2ecbf8);}_0x346471=_['merge']({},_0x346471,_0x55ca9b['options']);return _0x33a50a[_0x6c99('0x5e')](_0x346471);}})[_0x6c99('0x29')](function(_0x46a9f3){if(_0x46a9f3){_0x22c6ff=_0x46a9f3[_0x6c99('0x39')];if(!_0x55ca9b[_0x6c99('0x35')][_0x6c99('0x3a')]('nolimit')){_0x346471['limit']=qs[_0x6c99('0x20')](_0x55ca9b['query'][_0x6c99('0x20')]);_0x346471[_0x6c99('0x1f')]=qs['offset'](_0x55ca9b['query'][_0x6c99('0x1f')]);}return _0x33a50a[_0x6c99('0x5e')](_0x346471);}})[_0x6c99('0x29')](function(_0xb64767){if(_0xb64767){return _0xb64767?{'count':_0x22c6ff,'rows':_0xb64767}:null;}})['then'](respondWithResult(_0x3c8c11,null))[_0x6c99('0x47')](handleError(_0x3c8c11,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 23df62d..cf32d4f 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 _0x0776=['events','../../mysqldb','ChatGroup','setMaxListeners','save','update','emit','hook'];(function(_0x1decf1,_0x981bc0){var _0x27a7b9=function(_0x451136){while(--_0x451136){_0x1decf1['push'](_0x1decf1['shift']());}};_0x27a7b9(++_0x981bc0);}(_0x0776,0x128));var _0x6077=function(_0x1121f1,_0x14756b){_0x1121f1=_0x1121f1-0x0;var _0x2656f5=_0x0776[_0x1121f1];return _0x2656f5;};'use strict';var EventEmitter=require(_0x6077('0x0'));var ChatGroup=require(_0x6077('0x1'))['db'][_0x6077('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x6077('0x3')](0x0);var events={'afterCreate':_0x6077('0x4'),'afterUpdate':_0x6077('0x5'),'afterDestroy':'remove'};function emitEvent(_0x42e54a){return function(_0x1dd543,_0x31388e,_0x47c46a){ChatGroupEvents[_0x6077('0x6')](_0x42e54a+':'+_0x1dd543['id'],_0x1dd543);ChatGroupEvents[_0x6077('0x6')](_0x42e54a,_0x1dd543);_0x47c46a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0x6077('0x7')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file +var _0x59d2=['exports','../../mysqldb','ChatGroup','update','emit','hook'];(function(_0x662b75,_0x335e22){var _0xd7a3a8=function(_0xc60044){while(--_0xc60044){_0x662b75['push'](_0x662b75['shift']());}};_0xd7a3a8(++_0x335e22);}(_0x59d2,0xd9));var _0x259d=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x59d2[_0x5bd426];return _0x23a7eb;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x259d('0x0'))['db'][_0x259d('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x259d('0x2'),'afterDestroy':'remove'};function emitEvent(_0x7a02d2){return function(_0xe122f3,_0x1d9023,_0x30b093){ChatGroupEvents[_0x259d('0x3')](_0x7a02d2+':'+_0xe122f3['id'],_0xe122f3);ChatGroupEvents[_0x259d('0x3')](_0x7a02d2,_0xe122f3);_0x30b093(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0x259d('0x4')](e,emitEvent(event));}}module[_0x259d('0x5')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index edd66b7..a63fe07 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 _0x0a09=['lodash','bluebird','request-promise','path','../../config/environment','./chatGroup.attributes','exports','define','ChatGroup','chat_groups'];(function(_0x124728,_0x463dca){var _0x8eb20f=function(_0x49d9de){while(--_0x49d9de){_0x124728['push'](_0x124728['shift']());}};_0x8eb20f(++_0x463dca);}(_0x0a09,0xdc));var _0x90a0=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0x0a09[_0x8de54f];return _0x14cba4;};'use strict';var _=require(_0x90a0('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x90a0('0x1'));var rp=require(_0x90a0('0x2'));var fs=require('fs');var path=require(_0x90a0('0x3'));var rimraf=require('rimraf');var config=require(_0x90a0('0x4'));var attributes=require(_0x90a0('0x5'));module[_0x90a0('0x6')]=function(_0x21afab,_0x1e32a5){return _0x21afab[_0x90a0('0x7')](_0x90a0('0x8'),attributes,{'tableName':_0x90a0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xca09=['lodash','../../config/logger','moment','bluebird','request-promise','../../config/environment','./chatGroup.attributes','exports','define','ChatGroup','chat_groups'];(function(_0x21b231,_0x193e0e){var _0x4c2083=function(_0x5312fe){while(--_0x5312fe){_0x21b231['push'](_0x21b231['shift']());}};_0x4c2083(++_0x193e0e);}(_0xca09,0x1a2));var _0x9ca0=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xca09[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x9ca0('0x0'));var util=require('util');var logger=require(_0x9ca0('0x1'))('api');var moment=require(_0x9ca0('0x2'));var BPromise=require(_0x9ca0('0x3'));var rp=require(_0x9ca0('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9ca0('0x5'));var attributes=require(_0x9ca0('0x6'));module[_0x9ca0('0x7')]=function(_0x366344,_0x1dad8a){return _0x366344[_0x9ca0('0x8')](_0x9ca0('0x9'),attributes,{'tableName':_0x9ca0('0xa'),'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 79dc279..766e098 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 _0x2caf=['request','then','ChatGroup,\x20%s,\x20%s','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./chatGroup.socket','register'];(function(_0x117e78,_0x4c523c){var _0x4e6faa=function(_0x283b0c){while(--_0x283b0c){_0x117e78['push'](_0x117e78['shift']());}};_0x4e6faa(++_0x4c523c);}(_0x2caf,0x6a));var _0xf2ca=function(_0x401a8b,_0x88935b){_0x401a8b=_0x401a8b-0x0;var _0x18397c=_0x2caf[_0x401a8b];return _0x18397c;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xf2ca('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf2ca('0x1'));var db=require(_0xf2ca('0x2'))['db'];var utils=require(_0xf2ca('0x3'));var logger=require(_0xf2ca('0x4'))(_0xf2ca('0x5'));var config=require(_0xf2ca('0x6'));var jayson=require(_0xf2ca('0x7'));var client=jayson['client'][_0xf2ca('0x8')]({'port':0x232a});config[_0xf2ca('0x9')]=_[_0xf2ca('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xf2ca('0xb'))(new Redis(config[_0xf2ca('0x9')]));require(_0xf2ca('0xc'))[_0xf2ca('0xd')](socket);function respondWithRpcPromise(_0x1c1afd,_0x5be288,_0x1ecd50){return new BPromise(function(_0x34d82a,_0x30e975){return client[_0xf2ca('0xe')](_0x1c1afd,_0x1ecd50)[_0xf2ca('0xf')](function(_0x328d80){logger['info'](_0xf2ca('0x10'),_0x5be288,_0xf2ca('0x11'));logger['debug'](_0xf2ca('0x12'),_0x5be288,_0xf2ca('0x11'),JSON['stringify'](_0x328d80));if(_0x328d80['error']){if(_0x328d80[_0xf2ca('0x13')]['code']===0x1f4){logger[_0xf2ca('0x13')](_0xf2ca('0x10'),_0x5be288,_0x328d80[_0xf2ca('0x13')][_0xf2ca('0x14')]);return _0x30e975(_0x328d80[_0xf2ca('0x13')][_0xf2ca('0x14')]);}logger[_0xf2ca('0x13')]('ChatGroup,\x20%s,\x20%s',_0x5be288,_0x328d80[_0xf2ca('0x13')]['message']);return _0x34d82a(_0x328d80[_0xf2ca('0x13')]['message']);}else{logger[_0xf2ca('0x15')](_0xf2ca('0x10'),_0x5be288,'request\x20sent');_0x34d82a(_0x328d80[_0xf2ca('0x16')][_0xf2ca('0x14')]);}})[_0xf2ca('0x17')](function(_0x310504){logger[_0xf2ca('0x13')](_0xf2ca('0x10'),_0x5be288,_0x310504);_0x30e975(_0x310504);});});} \ No newline at end of file +var _0xe94a=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','then','ChatGroup,\x20%s,\x20%s','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe94a,0x1c7));var _0xae94=function(_0x15cdcb,_0x4340e9){_0x15cdcb=_0x15cdcb-0x0;var _0x37b069=_0xe94a[_0x15cdcb];return _0x37b069;};'use strict';var _=require(_0xae94('0x0'));var util=require(_0xae94('0x1'));var moment=require(_0xae94('0x2'));var BPromise=require('bluebird');var rs=require(_0xae94('0x3'));var fs=require('fs');var Redis=require(_0xae94('0x4'));var db=require(_0xae94('0x5'))['db'];var utils=require(_0xae94('0x6'));var logger=require(_0xae94('0x7'))(_0xae94('0x8'));var config=require('../../config/environment');var jayson=require(_0xae94('0x9'));var client=jayson[_0xae94('0xa')][_0xae94('0xb')]({'port':0x232a});config[_0xae94('0xc')]=_[_0xae94('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xae94('0xe'))(new Redis(config[_0xae94('0xc')]));require('./chatGroup.socket')[_0xae94('0xf')](socket);function respondWithRpcPromise(_0x35cd04,_0x3a5a57,_0x2fa556){return new BPromise(function(_0x1cb23d,_0x3fdafe){return client[_0xae94('0x10')](_0x35cd04,_0x2fa556)[_0xae94('0x11')](function(_0x4cb724){logger['info'](_0xae94('0x12'),_0x3a5a57,_0xae94('0x13'));logger['debug'](_0xae94('0x14'),_0x3a5a57,'request\x20sent',JSON[_0xae94('0x15')](_0x4cb724));if(_0x4cb724[_0xae94('0x16')]){if(_0x4cb724[_0xae94('0x16')][_0xae94('0x17')]===0x1f4){logger[_0xae94('0x16')]('ChatGroup,\x20%s,\x20%s',_0x3a5a57,_0x4cb724[_0xae94('0x16')][_0xae94('0x18')]);return _0x3fdafe(_0x4cb724[_0xae94('0x16')]['message']);}logger[_0xae94('0x16')]('ChatGroup,\x20%s,\x20%s',_0x3a5a57,_0x4cb724[_0xae94('0x16')]['message']);return _0x1cb23d(_0x4cb724[_0xae94('0x16')][_0xae94('0x18')]);}else{logger['info']('ChatGroup,\x20%s,\x20%s',_0x3a5a57,_0xae94('0x13'));_0x1cb23d(_0x4cb724[_0xae94('0x19')][_0xae94('0x18')]);}})[_0xae94('0x1a')](function(_0x5d4379){logger[_0xae94('0x16')](_0xae94('0x12'),_0x3a5a57,_0x5d4379);_0x3fdafe(_0x5d4379);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 6bff38a..2573439 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 _0x5784=['removeListener','register','length','./chatGroup.events','save','remove','update'];(function(_0x202ad9,_0x3a0a61){var _0x128608=function(_0x1a0546){while(--_0x1a0546){_0x202ad9['push'](_0x202ad9['shift']());}};_0x128608(++_0x3a0a61);}(_0x5784,0x114));var _0x4578=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x5784[_0x122ef9];return _0x42fba0;};'use strict';var ChatGroupEvents=require(_0x4578('0x0'));var events=[_0x4578('0x1'),_0x4578('0x2'),_0x4578('0x3')];function createListener(_0x5ece75,_0x5a6200){return function(_0x204dbb){_0x5a6200['emit'](_0x5ece75,_0x204dbb);};}function removeListener(_0xc6569f,_0x22c23d){return function(){ChatGroupEvents[_0x4578('0x4')](_0xc6569f,_0x22c23d);};}exports[_0x4578('0x5')]=function(_0x47a1ec){for(var _0x465c81=0x0,_0xb8caf4=events[_0x4578('0x6')];_0x465c81<_0xb8caf4;_0x465c81++){var _0x5ea461=events[_0x465c81];var _0x45b7b2=createListener('chatGroup:'+_0x5ea461,_0x47a1ec);ChatGroupEvents['on'](_0x5ea461,_0x45b7b2);}}; \ No newline at end of file +var _0x89bc=['emit','register','length','save','remove'];(function(_0x4bbfb1,_0x3f888c){var _0x417bdd=function(_0x4a0155){while(--_0x4a0155){_0x4bbfb1['push'](_0x4bbfb1['shift']());}};_0x417bdd(++_0x3f888c);}(_0x89bc,0x1c0));var _0xc89b=function(_0x3c3e72,_0x3e1858){_0x3c3e72=_0x3c3e72-0x0;var _0x48a7e5=_0x89bc[_0x3c3e72];return _0x48a7e5;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0xc89b('0x0'),_0xc89b('0x1'),'update'];function createListener(_0x48615e,_0x73ca26){return function(_0x50493d){_0x73ca26[_0xc89b('0x2')](_0x48615e,_0x50493d);};}function removeListener(_0x2dd6b4,_0xc0b733){return function(){ChatGroupEvents['removeListener'](_0x2dd6b4,_0xc0b733);};}exports[_0xc89b('0x3')]=function(_0x309f45){for(var _0x5e1e62=0x0,_0x5b20b5=events[_0xc89b('0x4')];_0x5e1e62<_0x5b20b5;_0x5e1e62++){var _0x1f707a=events[_0x5e1e62];var _0x102aeb=createListener('chatGroup:'+_0x1f707a,_0x309f45);ChatGroupEvents['on'](_0x1f707a,_0x102aeb);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 409d873..5c6b20e 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 _0xccf8=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatGroup.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/messages','post','create','/:id/members','addMembers','addMessage','put','delete','destroy','removeMembers','exports','multer','util'];(function(_0x45804b,_0x38905e){var _0x538282=function(_0xdfa594){while(--_0xdfa594){_0x45804b['push'](_0x45804b['shift']());}};_0x538282(++_0x38905e);}(_0xccf8,0x1a2));var _0x8ccf=function(_0x385685,_0x488287){_0x385685=_0x385685-0x0;var _0x41320f=_0xccf8[_0x385685];return _0x41320f;};'use strict';var multer=require(_0x8ccf('0x0'));var util=require(_0x8ccf('0x1'));var path=require(_0x8ccf('0x2'));var timeout=require(_0x8ccf('0x3'));var express=require(_0x8ccf('0x4'));var router=express[_0x8ccf('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x8ccf('0x6'));var interaction=require(_0x8ccf('0x7'));var config=require('../../config/environment');var controller=require(_0x8ccf('0x8'));router[_0x8ccf('0x9')]('/',auth[_0x8ccf('0xa')](),controller[_0x8ccf('0xb')]);router[_0x8ccf('0x9')](_0x8ccf('0xc'),auth[_0x8ccf('0xa')](),controller[_0x8ccf('0xd')]);router[_0x8ccf('0x9')](_0x8ccf('0xe'),auth[_0x8ccf('0xa')](),controller[_0x8ccf('0xf')]);router['get']('/:id/unread',auth[_0x8ccf('0xa')](),controller['getUnread']);router[_0x8ccf('0x9')]('/:id/members',auth[_0x8ccf('0xa')](),controller[_0x8ccf('0x10')]);router['get'](_0x8ccf('0x11'),auth[_0x8ccf('0xa')](),controller['getMessages']);router[_0x8ccf('0x12')]('/',auth[_0x8ccf('0xa')](),controller[_0x8ccf('0x13')]);router[_0x8ccf('0x12')](_0x8ccf('0x14'),auth[_0x8ccf('0xa')](),controller[_0x8ccf('0x15')]);router[_0x8ccf('0x12')](_0x8ccf('0x11'),auth[_0x8ccf('0xa')](),controller[_0x8ccf('0x16')]);router[_0x8ccf('0x17')](_0x8ccf('0xe'),auth[_0x8ccf('0xa')](),controller['update']);router[_0x8ccf('0x18')]('/:id',auth['isAuthenticated'](),controller[_0x8ccf('0x19')]);router[_0x8ccf('0x18')]('/:id/members',auth[_0x8ccf('0xa')](),controller[_0x8ccf('0x1a')]);module[_0x8ccf('0x1b')]=router; \ No newline at end of file +var _0x65b1=['destroy','removeMembers','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','index','/:id','show','/:id/unread','getUnread','/:id/members','/:id/messages','getMessages','create','post','addMembers','addMessage','put','update','delete'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x65b1,0x1f0));var _0x165b=function(_0x2c41a3,_0x179c3c){_0x2c41a3=_0x2c41a3-0x0;var _0x37510f=_0x65b1[_0x2c41a3];return _0x37510f;};'use strict';var multer=require(_0x165b('0x0'));var util=require(_0x165b('0x1'));var path=require(_0x165b('0x2'));var timeout=require('connect-timeout');var express=require(_0x165b('0x3'));var router=express[_0x165b('0x4')]();var fs_extra=require(_0x165b('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x165b('0x6'));var config=require(_0x165b('0x7'));var controller=require(_0x165b('0x8'));router[_0x165b('0x9')]('/',auth[_0x165b('0xa')](),controller[_0x165b('0xb')]);router[_0x165b('0x9')]('/describe',auth[_0x165b('0xa')](),controller['describe']);router['get'](_0x165b('0xc'),auth[_0x165b('0xa')](),controller[_0x165b('0xd')]);router[_0x165b('0x9')](_0x165b('0xe'),auth[_0x165b('0xa')](),controller[_0x165b('0xf')]);router[_0x165b('0x9')](_0x165b('0x10'),auth[_0x165b('0xa')](),controller['getMembers']);router[_0x165b('0x9')](_0x165b('0x11'),auth[_0x165b('0xa')](),controller[_0x165b('0x12')]);router['post']('/',auth[_0x165b('0xa')](),controller[_0x165b('0x13')]);router[_0x165b('0x14')]('/:id/members',auth['isAuthenticated'](),controller[_0x165b('0x15')]);router[_0x165b('0x14')](_0x165b('0x11'),auth[_0x165b('0xa')](),controller[_0x165b('0x16')]);router[_0x165b('0x17')](_0x165b('0xc'),auth[_0x165b('0xa')](),controller[_0x165b('0x18')]);router[_0x165b('0x19')](_0x165b('0xc'),auth[_0x165b('0xa')](),controller[_0x165b('0x1a')]);router[_0x165b('0x19')](_0x165b('0x10'),auth[_0x165b('0xa')](),controller[_0x165b('0x1b')]);module[_0x165b('0x1c')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index c308a42..0e6830b 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 _0xe2cf=['thumb','TEXT','STRING','DATE','long','ENUM','out','exports','INTEGER','star'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xe2cf,0x1a1));var _0xfe2c=function(_0x56eefb,_0x1a1c6d){_0x56eefb=_0x56eefb-0x0;var _0x13ed78=_0xe2cf[_0x56eefb];return _0x13ed78;};'use strict';var Sequelize=require('sequelize');module[_0xfe2c('0x0')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xfe2c('0x1')]},'ratingType':{'type':Sequelize['ENUM'](_0xfe2c('0x2'),_0xfe2c('0x3')),'defaultValue':_0xfe2c('0x2')},'ratingMessage':{'type':Sequelize[_0xfe2c('0x4')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0xfe2c('0x5')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xfe2c('0x6')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xfe2c('0x5')]},'note':{'type':Sequelize[_0xfe2c('0x5')]},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0xfe2c('0x5')]},'osVersion':{'type':Sequelize[_0xfe2c('0x5')]},'deviceModel':{'type':Sequelize[_0xfe2c('0x5')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0xfe2c('0x4')]},'customerIp':{'type':Sequelize[_0xfe2c('0x5')]},'formData':{'type':Sequelize['TEXT'](_0xfe2c('0x7'))},'read1stAt':{'type':Sequelize[_0xfe2c('0x6')]},'lastMsgAt':{'type':Sequelize[_0xfe2c('0x6')]},'lastMsgDirection':{'type':Sequelize[_0xfe2c('0x8')]('in',_0xfe2c('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xfe2c('0x5')]},'customerPort':{'type':Sequelize[_0xfe2c('0x5')]},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x1678=['exports','BOOLEAN','INTEGER','ENUM','star','TEXT','STRING','DATE','long','sequelize'];(function(_0x1793de,_0x4d7233){var _0x4f0309=function(_0x229ee7){while(--_0x229ee7){_0x1793de['push'](_0x1793de['shift']());}};_0x4f0309(++_0x4d7233);}(_0x1678,0x17b));var _0x8167=function(_0x1140d2,_0x3edffb){_0x1140d2=_0x1140d2-0x0;var _0x397044=_0x1678[_0x1140d2];return _0x397044;};'use strict';var Sequelize=require(_0x8167('0x0'));module[_0x8167('0x1')]={'closed':{'type':Sequelize[_0x8167('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x8167('0x3')]},'ratingType':{'type':Sequelize[_0x8167('0x4')]('star','thumb'),'defaultValue':_0x8167('0x5')},'ratingMessage':{'type':Sequelize[_0x8167('0x6')]},'pathTranscript':{'type':Sequelize[_0x8167('0x6')]},'mailTranscript':{'type':Sequelize[_0x8167('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x8167('0x8')]},'disposition':{'type':Sequelize[_0x8167('0x7')]},'secondDisposition':{'type':Sequelize[_0x8167('0x7')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x8167('0x7')]},'browserName':{'type':Sequelize[_0x8167('0x7')]},'browserVersion':{'type':Sequelize[_0x8167('0x7')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0x8167('0x7')]},'deviceVendor':{'type':Sequelize[_0x8167('0x7')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0x8167('0x6')]},'customerIp':{'type':Sequelize[_0x8167('0x7')]},'formData':{'type':Sequelize[_0x8167('0x6')](_0x8167('0x9'))},'read1stAt':{'type':Sequelize[_0x8167('0x8')]},'lastMsgAt':{'type':Sequelize[_0x8167('0x8')]},'lastMsgDirection':{'type':Sequelize[_0x8167('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0x8167('0x7')]},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize[_0x8167('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index c219f22..b6b7173 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 _0x4bf6=['existsSync','createReadStream','createWriteStream','out','firstName','value','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','rimraf','zip-dir','request-promise','moment','mustache','util','lodash','ioredis','../../components/interaction/service','../../components/export/pdf','../../config/logger','api','../../mysqldb','redis','defaults','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','update','destroy','stack','name','send','render','interaction','map','ChatInteraction','fieldName','type','getOptions','findAll','chat','query','user','show','model','keys','intersection','attributes','fields','length','includeAll','merge','find','create','body','params','describe','findOne','ChatWebsite','ChatWebsiteId','vidaooTopic','vidaooNote','vidaooMetadata','vidaooApiKey','vidaooEscalation','fullname','email','contact','account','POST','isNull','follow','parse','Sequelize','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','Interaction\x20already\x20assigned','closed','disposition','attachmentUpload','file','originalname','filename','mimetype','Attachment','attachmentDownload','Unauthorized','ChatOfflineMessageId','join','root','offline-chat/','basename','download','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','ChatMessage','Messages','User','ContactId','UserId','%s%d','customer','Visitor','agentIdentifier','website_alias','agentAlias','alias','System','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','appendFileSync','MailAccount','CloudProvider','Smtp','SendMail','sendMail','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','filters','hasOwnProperty','nolimit','order','sort','where','pick','filter','$gte','YYYY-MM-DD\x20HH:mm:ss','options','include','rows','getMyMessages','rawAttributes','ChatInteractionId','secret','omit','spread','color','emit','chatInteractionTags:save','removeTags','unix','server','files','push','lastName','attachments','read','Owner','get','Chat','Account','N.A.','toString','closedAt','osName','referer','customerIp','customerPort','tail'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0x4bf6,0xdd));var _0x64bf=function(_0x3bd353,_0x493b19){_0x3bd353=_0x3bd353-0x0;var _0x2f1304=_0x4bf6[_0x3bd353];return _0x2f1304;};'use strict';var rimraf=require(_0x64bf('0x0'));var zipdir=require(_0x64bf('0x1'));var rp=require(_0x64bf('0x2'));var moment=require(_0x64bf('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x64bf('0x4'));var util=require(_0x64bf('0x5'));var path=require('path');var ejs=require('ejs');var fs=require('fs');var _=require(_0x64bf('0x6'));var Redis=require(_0x64bf('0x7'));var interaction=require(_0x64bf('0x8'));var qs=require('../../components/parsers/qs');var pdf=require(_0x64bf('0x9'));var logger=require(_0x64bf('0xa'))(_0x64bf('0xb'));var config=require('../../config/environment');var db=require(_0x64bf('0xc'))['db'];config[_0x64bf('0xd')]=_[_0x64bf('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x64bf('0xf'))(new Redis(config[_0x64bf('0xd')]));require(_0x64bf('0x10'))[_0x64bf('0x11')](socket);var jayson=require(_0x64bf('0x12'));var client=jayson[_0x64bf('0x13')][_0x64bf('0x14')]({'port':0x232b});var client9004=jayson[_0x64bf('0x13')][_0x64bf('0x14')]({'port':0x232c});function respondWithRpcPromise(_0x3bc3b1,_0x52566e,_0x41a2e3,_0x1fce11){return new BPromise(function(_0x1cbdec,_0x53b09e){var _0x5d4871=_0x1fce11||client;return _0x5d4871[_0x64bf('0x15')](_0x3bc3b1,_0x41a2e3)[_0x64bf('0x16')](function(_0x4632bd){logger[_0x64bf('0x17')](_0x64bf('0x18'),_0x52566e,_0x64bf('0x19'));logger[_0x64bf('0x1a')](_0x64bf('0x1b'),_0x52566e,_0x64bf('0x19'),JSON[_0x64bf('0x1c')](_0x4632bd));if(_0x4632bd[_0x64bf('0x1d')]){if(_0x4632bd[_0x64bf('0x1d')][_0x64bf('0x1e')]===0x1f4){logger[_0x64bf('0x1d')](_0x64bf('0x18'),_0x52566e,_0x4632bd[_0x64bf('0x1d')][_0x64bf('0x1f')]);return _0x53b09e(_0x4632bd[_0x64bf('0x1d')][_0x64bf('0x1f')]);}logger[_0x64bf('0x1d')](_0x64bf('0x18'),_0x52566e,_0x4632bd[_0x64bf('0x1d')]['message']);return _0x1cbdec(_0x4632bd[_0x64bf('0x1d')]['message']);}else{logger[_0x64bf('0x17')](_0x64bf('0x18'),_0x52566e,_0x64bf('0x19'));_0x1cbdec(_0x4632bd[_0x64bf('0x20')][_0x64bf('0x1f')]);}})[_0x64bf('0x21')](function(_0x3cdf33){logger['error'](_0x64bf('0x18'),_0x52566e,_0x3cdf33);_0x53b09e(_0x3cdf33);});});}function respondWithStatusCode(_0x436524,_0x4d2c30){_0x4d2c30=_0x4d2c30||0xcc;return function(_0xcefd03){if(_0xcefd03){return _0x436524[_0x64bf('0x22')](_0x4d2c30);}return _0x436524[_0x64bf('0x23')](_0x4d2c30)[_0x64bf('0x24')]();};}function respondWithResult(_0x5d887c,_0xd3e105){_0xd3e105=_0xd3e105||0xc8;return function(_0x2360a9){if(_0x2360a9){return _0x5d887c['status'](_0xd3e105)[_0x64bf('0x25')](_0x2360a9);}};}function respondWithFilteredResult(_0xff0309,_0x5cd4e0){return function(_0x57bb29){if(_0x57bb29){var _0x308e6a=typeof _0x5cd4e0['offset']===_0x64bf('0x26')&&typeof _0x5cd4e0[_0x64bf('0x27')]===_0x64bf('0x26');var _0x36d955=_0x57bb29[_0x64bf('0x28')];var _0x39e2bc=_0x308e6a?0x0:_0x5cd4e0[_0x64bf('0x29')];var _0x5b5a05=_0x308e6a?_0x57bb29['count']:_0x5cd4e0[_0x64bf('0x29')]+_0x5cd4e0[_0x64bf('0x27')];var _0x2dd122;if(_0x5b5a05>=_0x36d955){_0x5b5a05=_0x36d955;_0x2dd122=0xc8;}else{_0x2dd122=0xce;}_0xff0309[_0x64bf('0x23')](_0x2dd122);return _0xff0309[_0x64bf('0x2a')](_0x64bf('0x2b'),_0x39e2bc+'-'+_0x5b5a05+'/'+_0x36d955)['json'](_0x57bb29);}return null;};}function saveUpdates(_0x15d909){return function(_0x15d9c6){if(_0x15d9c6){return _0x15d9c6[_0x64bf('0x2c')](_0x15d909)[_0x64bf('0x16')](function(_0x4deef1){return _0x4deef1;});}return null;};}function removeEntity(_0x37cc9c){return function(_0x40a1e3){if(_0x40a1e3){return _0x40a1e3[_0x64bf('0x2d')]()[_0x64bf('0x16')](function(){_0x37cc9c[_0x64bf('0x23')](0xcc)[_0x64bf('0x24')]();});}};}function handleEntityNotFound(_0x49eb7b){return function(_0x318e11){if(!_0x318e11){_0x49eb7b['sendStatus'](0x194);}return _0x318e11;};}function handleError(_0x56aed3,_0x510815){_0x510815=_0x510815||0x1f4;return function(_0x4dcda6){logger['error'](_0x4dcda6[_0x64bf('0x2e')]);if(_0x4dcda6[_0x64bf('0x2f')]){delete _0x4dcda6[_0x64bf('0x2f')];}_0x56aed3[_0x64bf('0x23')](_0x510815)[_0x64bf('0x30')](_0x4dcda6);};}function getMustacheRender(_0xa12135,_0x40698e){return Mustache[_0x64bf('0x31')](_0xa12135,_['merge'](_0x40698e['body'],{'contact':_0x40698e['contact'],'message':_0x40698e[_0x64bf('0x1f')],'agent':_0x40698e['agent'],'interaction':_0x40698e[_0x64bf('0x32')],'account':_0x40698e['account']}))||'';}exports['index']=function(_0x3d75ce,_0x449f34){var _0x339e1a={};var _0x11b910=_[_0x64bf('0x33')](db[_0x64bf('0x34')]['rawAttributes'],function(_0x1b8469){return{'name':_0x1b8469[_0x64bf('0x35')],'type':_0x1b8469[_0x64bf('0x36')]['key']};});_0x339e1a=qs[_0x64bf('0x37')](_0x11b910,_0x3d75ce);return interaction[_0x64bf('0x38')](_0x64bf('0x39'),_0x3d75ce[_0x64bf('0x3a')],_0x3d75ce[_0x64bf('0x3b')],_0x339e1a,_0x11b910)[_0x64bf('0x16')](respondWithFilteredResult(_0x449f34,_0x339e1a))['catch'](handleError(_0x449f34,null));};exports[_0x64bf('0x3c')]=function(_0x33a1b9,_0x1ddba2){var _0x4e38aa={'raw':![],'where':{'id':_0x33a1b9['params']['id']}},_0x5b0781={};_0x5b0781[_0x64bf('0x3d')]=_[_0x64bf('0x3e')](db[_0x64bf('0x34')]['rawAttributes']);_0x5b0781[_0x64bf('0x3a')]=_[_0x64bf('0x3e')](_0x33a1b9[_0x64bf('0x3a')]);_0x5b0781['filters']=_[_0x64bf('0x3f')](_0x5b0781['model'],_0x5b0781[_0x64bf('0x3a')]);_0x4e38aa[_0x64bf('0x40')]=_[_0x64bf('0x3f')](_0x5b0781[_0x64bf('0x3d')],qs[_0x64bf('0x41')](_0x33a1b9[_0x64bf('0x3a')][_0x64bf('0x41')]));_0x4e38aa[_0x64bf('0x40')]=_0x4e38aa[_0x64bf('0x40')][_0x64bf('0x42')]?_0x4e38aa[_0x64bf('0x40')]:_0x5b0781[_0x64bf('0x3d')];if(_0x33a1b9[_0x64bf('0x3a')][_0x64bf('0x43')]){_0x4e38aa['include']=[{'all':!![]}];}_0x4e38aa=_[_0x64bf('0x44')]({},_0x4e38aa,_0x33a1b9['options']);return db[_0x64bf('0x34')][_0x64bf('0x45')](_0x4e38aa)[_0x64bf('0x16')](handleEntityNotFound(_0x1ddba2,null))[_0x64bf('0x16')](respondWithResult(_0x1ddba2,null))['catch'](handleError(_0x1ddba2,null));};exports[_0x64bf('0x46')]=function(_0x381e60,_0x8ca264){return db[_0x64bf('0x34')][_0x64bf('0x46')](_0x381e60[_0x64bf('0x47')],{})[_0x64bf('0x16')](respondWithResult(_0x8ca264,0xc9))[_0x64bf('0x21')](handleError(_0x8ca264,null));};exports[_0x64bf('0x2c')]=function(_0x1e0fdb,_0x2d20e1){if(_0x1e0fdb['body']['id']){delete _0x1e0fdb[_0x64bf('0x47')]['id'];}return db[_0x64bf('0x34')][_0x64bf('0x45')]({'where':{'id':_0x1e0fdb[_0x64bf('0x48')]['id']}})['then'](handleEntityNotFound(_0x2d20e1,null))[_0x64bf('0x16')](saveUpdates(_0x1e0fdb[_0x64bf('0x47')],null))[_0x64bf('0x16')](respondWithResult(_0x2d20e1,null))[_0x64bf('0x21')](handleError(_0x2d20e1,null));};exports[_0x64bf('0x2d')]=function(_0x3a55bc,_0xe53651){return db['ChatInteraction'][_0x64bf('0x45')]({'where':{'id':_0x3a55bc['params']['id']}})[_0x64bf('0x16')](handleEntityNotFound(_0xe53651,null))[_0x64bf('0x16')](removeEntity(_0xe53651,null))['catch'](handleError(_0xe53651,null));};exports[_0x64bf('0x49')]=function(_0x1e5ccf,_0x22fa02){return db[_0x64bf('0x34')]['describe']()[_0x64bf('0x16')](respondWithResult(_0x22fa02,null))[_0x64bf('0x21')](handleError(_0x22fa02,null));};exports['createVidaooSession']=function(_0x3f1215,_0x1ff283){var _0x425ef2=_0x3f1215[_0x64bf('0x48')]['id'];var _0x229f5f;var _0x4e8bfa;var _0x3cb19e;return db[_0x64bf('0x34')][_0x64bf('0x4a')]({'where':{'id':_0x425ef2}})[_0x64bf('0x16')](function(_0x9a56f1){_0x229f5f=_0x9a56f1;return db[_0x64bf('0x4b')][_0x64bf('0x4a')]({'where':{'id':_0x9a56f1[_0x64bf('0x4c')]},'attributes':['id','vidaooApiKey','vidaooEscalation',_0x64bf('0x4d'),_0x64bf('0x4e'),_0x64bf('0x4f')],'raw':!![]});})[_0x64bf('0x16')](function(_0x549289){if(_0x549289&&_0x549289[_0x64bf('0x50')]&&_0x549289[_0x64bf('0x51')]){_0x4e8bfa=_0x549289;var _0x76a157={'interaction':{'id':_0x425ef2},'agent':{'id':_0x3f1215[_0x64bf('0x3b')]['id'],'name':_0x3f1215[_0x64bf('0x3b')]['name'],'fullname':_0x3f1215[_0x64bf('0x3b')][_0x64bf('0x52')],'email':_0x3f1215[_0x64bf('0x3b')][_0x64bf('0x53')]},'contact':_0x3f1215[_0x64bf('0x47')][_0x64bf('0x54')],'account':_0x3f1215['body'][_0x64bf('0x55')]};var _0x114863={'rejectUnauthorized':![],'method':_0x64bf('0x56'),'url':'https://api-vidaoo.xcally.com/api/v1/meetings','headers':{'X-APIKEY':_0x549289[_0x64bf('0x50')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x3f1215[_0x64bf('0x3b')][_0x64bf('0x53')]],'buttons':null,'topic':_0x4e8bfa['vidaooTopic'],'note':_[_0x64bf('0x57')](_0x4e8bfa['vidaooNote'])?null:getMustacheRender(_0x4e8bfa[_0x64bf('0x4e')],_0x76a157),'metadata':null},'redirect':_0x64bf('0x58'),'json':!![]};try{if(!_[_0x64bf('0x57')](_0x4e8bfa[_0x64bf('0x4f')])){var _0x406822=getMustacheRender(_0x4e8bfa[_0x64bf('0x4f')],_0x76a157);var _0x1a0ddd=JSON[_0x64bf('0x59')](_0x406822);_0x114863[_0x64bf('0x47')]['metadata']=_0x1a0ddd;}}catch(_0x154037){throw new db['Sequelize']['ValidationError']('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x114863);}else{throw new db[(_0x64bf('0x5a'))][(_0x64bf('0x5b'))](_0x64bf('0x5c'));}})[_0x64bf('0x16')](function(_0x73e862){_0x3cb19e=_0x73e862;if(_0x3cb19e['id']){var _0x21d396={'body':_0x3cb19e[_0x64bf('0x5d')],'ChatWebsiteId':_0x4e8bfa['id'],'ChatInteractionId':_0x229f5f['id'],'direction':'out','UserId':_0x3f1215[_0x64bf('0x3b')]['id']};return db['ChatMessage'][_0x64bf('0x46')](_0x21d396,{});}else{throw new db[(_0x64bf('0x5a'))]['ValidationError'](_0x64bf('0x5e'));}})[_0x64bf('0x16')](function(){return _0x229f5f[_0x64bf('0x5f')]({'vidaooSessionId':_0x3cb19e['id']});})['then'](respondWithResult(_0x1ff283,null))[_0x64bf('0x21')](handleError(_0x1ff283,null));};exports[_0x64bf('0x60')]=function(_0x26cc50,_0x5cadd5){if(_0x26cc50[_0x64bf('0x47')]['id']){delete _0x26cc50['body']['id'];}return db[_0x64bf('0x34')]['find']({'where':{'id':_0x26cc50[_0x64bf('0x48')]['id']},'include':[{'model':db[_0x64bf('0x61')],'as':_0x64bf('0x62')}]})[_0x64bf('0x16')](handleEntityNotFound(_0x5cadd5,null))[_0x64bf('0x16')](saveUpdates(_0x26cc50[_0x64bf('0x47')],null))[_0x64bf('0x16')](respondWithResult(_0x5cadd5,null))['catch'](handleError(_0x5cadd5,null));};exports[_0x64bf('0x63')]=function(_0x7ab698,_0x16a14f){if(_0x7ab698[_0x64bf('0x47')]['id']){delete _0x7ab698[_0x64bf('0x47')]['id'];}return db[_0x64bf('0x34')][_0x64bf('0x45')]({'where':{'id':_0x7ab698['params']['id']}})[_0x64bf('0x16')](function(_0x143a99){if(!_0x143a99){logger[_0x64bf('0x1d')](_0x64bf('0x64'),_0x64bf('0x63'),0x194,'entity\x20not\x20found');_0x16a14f['sendStatus'](0x194);}else{if(_0x143a99['UserId']){throw new db['Sequelize']['ValidationError'](_0x64bf('0x65'));}}return _0x143a99;})['then'](function(_0x5449fe){if(_0x5449fe){return _0x5449fe[_0x64bf('0x2c')]({'closed':_0x7ab698['body'][_0x64bf('0x66')],'disposition':_0x7ab698[_0x64bf('0x47')][_0x64bf('0x67')]})[_0x64bf('0x16')](function(_0x2be8c4){return _0x2be8c4;});}})[_0x64bf('0x16')](function(){return respondWithRpcPromise('AbandonInteraction','abandon',_0x7ab698['body'],client9004);})['then'](respondWithResult(_0x16a14f,null))[_0x64bf('0x21')](handleError(_0x16a14f,null));};exports[_0x64bf('0x68')]=function(_0x12a538,_0x3e6e27){_0x12a538[_0x64bf('0x47')][_0x64bf('0x2f')]=_0x12a538[_0x64bf('0x69')][_0x64bf('0x6a')];_0x12a538['body']['basename']=_0x12a538[_0x64bf('0x69')][_0x64bf('0x6b')];_0x12a538[_0x64bf('0x47')][_0x64bf('0x36')]=_0x12a538[_0x64bf('0x69')][_0x64bf('0x6c')];return db[_0x64bf('0x6d')][_0x64bf('0x46')](_0x12a538[_0x64bf('0x47')])[_0x64bf('0x16')](respondWithResult(_0x3e6e27,0xc9))[_0x64bf('0x21')](handleError(_0x3e6e27,null));};exports[_0x64bf('0x6e')]=function(_0x1e712e,_0x448dd0){return db[_0x64bf('0x34')][_0x64bf('0x4a')]({'where':{'id':_0x1e712e[_0x64bf('0x48')]['id']},'raw':!![]})[_0x64bf('0x16')](handleEntityNotFound(_0x448dd0,null))[_0x64bf('0x16')](function(_0x253d44){if(_0x253d44){if(_0x253d44[_0x64bf('0x66')]){return _0x448dd0[_0x64bf('0x23')](0x193)[_0x64bf('0x25')]({'status':0x193,'message':_0x64bf('0x6f')});}return db[_0x64bf('0x6d')][_0x64bf('0x4a')]({'where':{'id':_0x1e712e[_0x64bf('0x3a')]['attachId']},'raw':!![]})[_0x64bf('0x16')](handleEntityNotFound(_0x448dd0,null));}})[_0x64bf('0x16')](function(_0x54f9fe){if(_0x54f9fe){var _0x4a4631=_0x54f9fe[_0x64bf('0x70')]!==null;var _0x2c25ca=path[_0x64bf('0x71')](config[_0x64bf('0x72')],'server/files/attachments/');if(_0x4a4631){_0x2c25ca=path[_0x64bf('0x71')](_0x2c25ca,_0x64bf('0x73'));}var _0x4f035c=path[_0x64bf('0x71')](_0x2c25ca,_0x54f9fe[_0x64bf('0x74')]);return _0x448dd0[_0x64bf('0x75')](_0x4f035c);}})[_0x64bf('0x21')](handleError(_0x448dd0,null));};exports[_0x64bf('0x76')]=function(_0x3b1d3b,_0x410768){var _0x3804b3=null;var _0x4a3156=null;var _0x128087=null;if(_0x3b1d3b['body']['id']){delete _0x3b1d3b[_0x64bf('0x47')]['id'];}if(_0x3b1d3b[_0x64bf('0x47')][_0x64bf('0x77')]){_0x128087=path[_0x64bf('0x71')](config[_0x64bf('0x72')],_0x64bf('0x78'),util[_0x64bf('0x79')](_0x64bf('0x7a'),Date[_0x64bf('0x7b')]()));_0x3b1d3b[_0x64bf('0x47')][_0x64bf('0x7c')]=_0x128087;}return db['ChatInteraction']['find']({'where':{'id':_0x3b1d3b['params']['id']},'include':[{'model':db[_0x64bf('0x7d')],'as':_0x64bf('0x7e'),'include':[{'model':db[_0x64bf('0x7f')],'as':'User'}]}]})[_0x64bf('0x16')](handleEntityNotFound(_0x410768,null))[_0x64bf('0x16')](saveUpdates(_0x3b1d3b[_0x64bf('0x47')],null))[_0x64bf('0x16')](function(_0x4da5ba){if(_0x4da5ba){_0x3804b3=_0x4da5ba;return db[_0x64bf('0x4b')][_0x64bf('0x45')]({'where':{'id':_0x3804b3[_0x64bf('0x4c')]}});}})[_0x64bf('0x16')](function(_0xa18e27){if(_0xa18e27){_0x4a3156=_0xa18e27;return db['CmContact'][_0x64bf('0x45')]({'where':{'id':_0x3804b3[_0x64bf('0x80')]}});}})[_0x64bf('0x16')](function(_0x383dc7){if(_0x383dc7){if(_0x128087){var _0x3aa0fa=null;for(var _0x792fb9=0x1;_0x792fb9<_0x3804b3[_0x64bf('0x7e')][_0x64bf('0x42')];++_0x792fb9){_0x3aa0fa=_0x3804b3[_0x64bf('0x7e')][_0x792fb9];var _0x59c646=_0x3aa0fa[_0x64bf('0x81')]?util['format'](_0x64bf('0x82'),_0x4a3156['agentAlias'],_0x3aa0fa['UserId']):'System';var _0x531391=_0x3b1d3b[_0x64bf('0x47')][_0x64bf('0x83')]||util[_0x64bf('0x79')](_0x64bf('0x82'),_0x64bf('0x84'),_0x3aa0fa['ContactId']);switch(_0x4a3156[_0x64bf('0x85')]){case _0x64bf('0x86'):_0x59c646=_0x3aa0fa[_0x64bf('0x81')]?util[_0x64bf('0x79')](_0x64bf('0x82'),_0x4a3156[_0x64bf('0x87')],_0x3aa0fa['UserId']):'System';break;case'agent_alias':_0x59c646=_0x3aa0fa[_0x64bf('0x81')]?_0x3aa0fa[_0x64bf('0x7f')][_0x64bf('0x88')]||_0x3aa0fa[_0x64bf('0x7f')]['fullname']:_0x64bf('0x89');break;case _0x64bf('0x8a'):_0x59c646=_0x3aa0fa[_0x64bf('0x81')]?_0x3aa0fa[_0x64bf('0x7f')][_0x64bf('0x52')]:_0x64bf('0x89');break;default:_0x59c646=_0x3aa0fa[_0x64bf('0x81')]?util['format'](_0x64bf('0x82'),_0x4a3156[_0x64bf('0x87')],_0x3aa0fa['UserId']):_0x64bf('0x89');}var _0x42649e=util['format'](_0x64bf('0x8b'),moment(_0x3aa0fa[_0x64bf('0x8c')])[_0x64bf('0x79')](_0x64bf('0x8d')),_0x3aa0fa[_0x64bf('0x8e')]==='in'?_0x531391:_0x59c646,_0x3aa0fa[_0x64bf('0x47')]);if(!_0x3aa0fa['secret']){fs[_0x64bf('0x8f')](_0x128087,_0x42649e);}}return db[_0x64bf('0x90')][_0x64bf('0x4a')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db[_0x64bf('0x91')],'as':_0x64bf('0x91'),'raw':!![]}]}]});}}})[_0x64bf('0x16')](function(_0x83efeb){if(!_0x83efeb||!_0x83efeb[_0x64bf('0x92')]||!_0x3b1d3b['body'])return _0x3804b3;var _0x4d629f=_0x83efeb['getSmtpOptions']();return respondWithRpcPromise(_0x64bf('0x93'),_0x64bf('0x94'),{'account':_0x4d629f,'message':{'from':util[_0x64bf('0x79')]('\x22%s\x22\x20<%s>',_0x83efeb[_0x64bf('0x2f')],_0x83efeb[_0x64bf('0x53')]||_0x83efeb['Smtp'][_0x64bf('0x3b')]),'to':_0x3b1d3b[_0x64bf('0x47')][_0x64bf('0x77')],'subject':_0x64bf('0x95'),'text':util['format'](_0x64bf('0x96'),_0x3b1d3b[_0x64bf('0x47')][_0x64bf('0x77')]),'attachments':[{'path':_0x128087}]}})[_0x64bf('0x16')](function(){return _0x3804b3;})[_0x64bf('0x21')](function(_0x5599a6){logger[_0x64bf('0x1d')](_0x5599a6);});})[_0x64bf('0x16')](respondWithStatusCode(_0x410768,0xc8))[_0x64bf('0x21')](handleError(_0x410768,null));};exports[_0x64bf('0x97')]=function(_0x5f58a6,_0x47a759){return db[_0x64bf('0x7d')]['find']({'where':{'id':_0x5f58a6[_0x64bf('0x48')]['id']}})[_0x64bf('0x16')](handleEntityNotFound(_0x47a759,null))[_0x64bf('0x16')](function(_0x11b4ae){if(_0x11b4ae){return _0x11b4ae[_0x64bf('0x97')](_0x5f58a6[_0x64bf('0x47')][_0x64bf('0x98')],_['omit'](_0x5f58a6[_0x64bf('0x47')],['ids','id'])||{});}})['then'](respondWithResult(_0x47a759,null))[_0x64bf('0x21')](handleError(_0x47a759,null));};exports['getMessages']=function(_0x1a183f,_0x47d217){var _0x2f27eb={'raw':![],'where':{}};var _0x5ba494={};var _0xf6b002={'count':0x0,'rows':[]};return db[_0x64bf('0x34')][_0x64bf('0x4a')]({'where':{'id':_0x1a183f[_0x64bf('0x48')]['id']}})[_0x64bf('0x16')](handleEntityNotFound(_0x47d217,null))['then'](function(_0x30d695){if(_0x30d695){_0x5ba494[_0x64bf('0x3d')]=_[_0x64bf('0x3e')](db[_0x64bf('0x7d')]['rawAttributes']);_0x5ba494['query']=_['keys'](_0x1a183f[_0x64bf('0x3a')]);_0x5ba494[_0x64bf('0x99')]=_[_0x64bf('0x3f')](_0x5ba494[_0x64bf('0x3d')],_0x5ba494[_0x64bf('0x3a')]);_0x2f27eb[_0x64bf('0x40')]=_[_0x64bf('0x3f')](_0x5ba494['model'],qs['fields'](_0x1a183f[_0x64bf('0x3a')][_0x64bf('0x41')]));_0x2f27eb['attributes']=_0x2f27eb[_0x64bf('0x40')][_0x64bf('0x42')]?_0x2f27eb['attributes']:_0x5ba494[_0x64bf('0x3d')];if(!_0x1a183f[_0x64bf('0x3a')][_0x64bf('0x9a')](_0x64bf('0x9b'))){_0x2f27eb[_0x64bf('0x27')]=qs['limit'](_0x1a183f[_0x64bf('0x3a')][_0x64bf('0x27')]);_0x2f27eb[_0x64bf('0x29')]=qs[_0x64bf('0x29')](_0x1a183f[_0x64bf('0x3a')]['offset']);}_0x2f27eb[_0x64bf('0x9c')]=qs[_0x64bf('0x9d')](_0x1a183f[_0x64bf('0x3a')][_0x64bf('0x9d')]);_0x2f27eb[_0x64bf('0x9e')]=qs['filters'](_[_0x64bf('0x9f')](_0x1a183f[_0x64bf('0x3a')],_0x5ba494[_0x64bf('0x99')]));_0x2f27eb[_0x64bf('0x9e')]['ChatInteractionId']=_0x30d695['id'];if(_0x1a183f[_0x64bf('0x3a')][_0x64bf('0xa0')]){_0x2f27eb[_0x64bf('0x9e')]=_[_0x64bf('0x44')](_0x2f27eb[_0x64bf('0x9e')],{'$or':_[_0x64bf('0x33')](_0x2f27eb[_0x64bf('0x40')],function(_0x83795d){var _0x1760d5={};_0x1760d5[_0x83795d]={'$like':'%'+_0x1a183f[_0x64bf('0x3a')]['filter']+'%'};return _0x1760d5;})});}if(_0x1a183f[_0x64bf('0x3a')][_0x64bf('0xa1')]){var _0x5d51b0=_0x1a183f[_0x64bf('0x3a')][_0x64bf('0xa1')]['split'](',');var _0x2a267a={};_0x2a267a[_0x5d51b0[0x0]]={'$gte':moment(_0x5d51b0[0x1])[_0x64bf('0x79')](_0x64bf('0xa2'))};_0x2f27eb['where']=_[_0x64bf('0x44')](_0x2f27eb[_0x64bf('0x9e')],_0x2a267a);}_0x2f27eb=_[_0x64bf('0x44')]({},_0x2f27eb,_0x1a183f[_0x64bf('0xa3')]);return db['ChatMessage'][_0x64bf('0x28')]({'where':_0x2f27eb[_0x64bf('0x9e')]})['then'](function(_0x162f5c){_0xf6b002[_0x64bf('0x28')]=_0x162f5c;if(_0x1a183f[_0x64bf('0x3a')]['includeAll']){_0x2f27eb[_0x64bf('0xa4')]=[{'all':!![]}];}return db[_0x64bf('0x7d')][_0x64bf('0x38')](_0x2f27eb);})['then'](function(_0xa9adc2){_0xf6b002[_0x64bf('0xa5')]=_0xa9adc2;return _0xf6b002;});}})[_0x64bf('0x16')](respondWithFilteredResult(_0x47d217,_0x2f27eb))[_0x64bf('0x21')](handleError(_0x47d217,null));};exports[_0x64bf('0xa6')]=function(_0x788c6f,_0xa89504){var _0x7d6c58={'where':{}},_0x4fc0f7={},_0xe96477={'count':0x0,'rows':[]};return db[_0x64bf('0x34')][_0x64bf('0x4a')]({'where':{'id':_0x788c6f['params']['id']}})[_0x64bf('0x16')](handleEntityNotFound(_0xa89504,null))[_0x64bf('0x16')](function(_0x39be51){if(_0x39be51){_0x4fc0f7[_0x64bf('0x3d')]=_[_0x64bf('0x3e')](db[_0x64bf('0x7d')][_0x64bf('0xa7')]);_0x4fc0f7[_0x64bf('0x3a')]=_['keys'](_0x788c6f[_0x64bf('0x3a')]);_0x4fc0f7['filters']=_['intersection'](_0x4fc0f7[_0x64bf('0x3d')],_0x4fc0f7[_0x64bf('0x3a')]);_0x7d6c58[_0x64bf('0x40')]=_['intersection'](_0x4fc0f7[_0x64bf('0x3d')],qs[_0x64bf('0x41')](_0x788c6f[_0x64bf('0x3a')][_0x64bf('0x41')]));_0x7d6c58['attributes']=_0x7d6c58['attributes'][_0x64bf('0x42')]?_0x7d6c58[_0x64bf('0x40')]:_0x4fc0f7[_0x64bf('0x3d')];if(!_0x788c6f['query']['hasOwnProperty']('nolimit')){_0x7d6c58[_0x64bf('0x27')]=qs[_0x64bf('0x27')](_0x788c6f['query'][_0x64bf('0x27')]);_0x7d6c58[_0x64bf('0x29')]=qs[_0x64bf('0x29')](_0x788c6f[_0x64bf('0x3a')][_0x64bf('0x29')]);}_0x7d6c58['order']=qs[_0x64bf('0x9d')](_0x788c6f[_0x64bf('0x3a')][_0x64bf('0x9d')]);_0x7d6c58['where']=qs[_0x64bf('0x99')](_[_0x64bf('0x9f')](_0x788c6f[_0x64bf('0x3a')],_0x4fc0f7['filters']));_0x7d6c58[_0x64bf('0x9e')][_0x64bf('0xa8')]=_0x39be51['id'];if(_0x788c6f[_0x64bf('0x3a')][_0x64bf('0xa0')]){_0x7d6c58[_0x64bf('0x9e')]=_['merge'](_0x7d6c58[_0x64bf('0x9e')],{'$or':_['map'](_0x7d6c58[_0x64bf('0x40')],function(_0xb85e0e){var _0x3d6c29={};_0x3d6c29[_0xb85e0e]={'$like':'%'+_0x788c6f[_0x64bf('0x3a')][_0x64bf('0xa0')]+'%'};return _0x3d6c29;})});}_0x7d6c58[_0x64bf('0x9e')][_0x64bf('0xa9')]=![];if(_0x788c6f['query']['id']){_0x7d6c58['where']['id']={'$gt':_0x788c6f[_0x64bf('0x3a')]['id']};}_0x7d6c58=_[_0x64bf('0x44')]({},_0x7d6c58,_0x788c6f[_0x64bf('0xa3')]);return db[_0x64bf('0x7d')]['count']({'where':_0x7d6c58[_0x64bf('0x9e')]})[_0x64bf('0x16')](function(_0x6f9253){_0xe96477[_0x64bf('0x28')]=_0x6f9253;_0x7d6c58[_0x64bf('0xa4')]=[];if(_0x788c6f['query']['includeAgent']){_0x7d6c58[_0x64bf('0xa4')]['push']({'model':db['User'],'as':_0x64bf('0x7f'),'attributes':['id',_0x64bf('0x52'),_0x64bf('0x88')]});}if(_0x788c6f[_0x64bf('0x3a')]['includeAll']){_0x7d6c58['include']=[{'all':!![]}];}return db['ChatMessage'][_0x64bf('0x38')](_0x7d6c58);})[_0x64bf('0x16')](function(_0x127d07){_0xe96477[_0x64bf('0xa5')]=_0x127d07;return _0xe96477;});}})['then'](respondWithFilteredResult(_0xa89504,_0x7d6c58))['catch'](handleError(_0xa89504,null));};exports['addTags']=function(_0x1a5b6f,_0x433ec0){return db[_0x64bf('0x34')][_0x64bf('0x45')]({'where':{'id':_0x1a5b6f['params']['id']}})['then'](handleEntityNotFound(_0x433ec0,null))[_0x64bf('0x16')](function(_0x1d20f){if(_0x1d20f){return _0x1d20f['setTags'](_0x1a5b6f[_0x64bf('0x47')][_0x64bf('0x98')],_[_0x64bf('0xaa')](_0x1a5b6f[_0x64bf('0x47')],[_0x64bf('0x98'),'id'])||{})[_0x64bf('0xab')](function(){return db['Tag']['findAll']({'attributes':['id',_0x64bf('0x2f'),_0x64bf('0xac')],'where':{'id':_0x1a5b6f[_0x64bf('0x47')][_0x64bf('0x98')]}});})[_0x64bf('0x16')](function(_0x2f24d8){socket[_0x64bf('0xad')](_0x64bf('0xae'),{'id':Number(_0x1a5b6f[_0x64bf('0x48')]['id']),'tags':_0x2f24d8||[]});return{'id':Number(_0x1a5b6f[_0x64bf('0x48')]['id']),'tags':_0x2f24d8||[]};});}})[_0x64bf('0x16')](respondWithResult(_0x433ec0,null))[_0x64bf('0x21')](handleError(_0x433ec0,null));};exports[_0x64bf('0xaf')]=function(_0x119b05,_0x110ea4){return db[_0x64bf('0x34')][_0x64bf('0x45')]({'where':{'id':_0x119b05[_0x64bf('0x48')]['id']}})[_0x64bf('0x16')](handleEntityNotFound(_0x110ea4,null))[_0x64bf('0x16')](function(_0x1c706d){if(_0x1c706d){return _0x1c706d[_0x64bf('0xaf')](_0x119b05['query'][_0x64bf('0x98')]);}})[_0x64bf('0x16')](respondWithStatusCode(_0x110ea4,null))[_0x64bf('0x21')](handleError(_0x110ea4,null));};exports[_0x64bf('0x75')]=function(_0x4f244a,_0x1d71a5){var _0x50773d=moment()[_0x64bf('0xb0')]()['toString']();var _0x251f9c=path[_0x64bf('0x71')](config['root'],_0x64bf('0xb1'),_0x64bf('0xb2'),'tmp');var _0x596ff2=path[_0x64bf('0x71')](config[_0x64bf('0x72')],_0x64bf('0xb1'),_0x64bf('0xb2'),'attachments');var _0x15d2d7=path[_0x64bf('0x71')](_0x251f9c,_0x50773d);var _0x32fff8=util['format']('transcript-%d-%s.zip',_0x4f244a[_0x64bf('0x48')]['id'],_0x50773d);var _0x4dc0f9=path[_0x64bf('0x71')](_0x251f9c,_0x32fff8);var _0x5a75ab=[];_0x5a75ab[_0x64bf('0xb3')]({'model':db['User'],'as':'User','attributes':['id',_0x64bf('0x52')],'raw':!![]});_0x5a75ab[_0x64bf('0xb3')]({'model':db['CmContact'],'as':_0x64bf('0x62'),'attributes':['id','firstName',_0x64bf('0xb4')],'raw':!![]});if(_0x4f244a['query'][_0x64bf('0xb5')]){_0x5a75ab[_0x64bf('0xb3')]({'model':db[_0x64bf('0x6d')],'as':_0x64bf('0x6d'),'raw':!![]});}var _0xc68501=[{'model':db['ChatMessage'],'as':_0x64bf('0x7e'),'attributes':['id',_0x64bf('0x47'),_0x64bf('0x8c'),_0x64bf('0x8e'),_0x64bf('0xa9'),_0x64bf('0xb6')],'include':_0x5a75ab}];_0xc68501[_0x64bf('0xb3')]({'model':db['ChatWebsite'],'as':'Account','attributes':['id','name']});_0xc68501[_0x64bf('0xb3')]({'model':db[_0x64bf('0x7f')],'as':_0x64bf('0xb7'),'attributes':['id',_0x64bf('0x52')]});return db[_0x64bf('0x34')][_0x64bf('0x45')]({'where':{'id':_0x4f244a['params']['id']},'include':_0xc68501})['then'](handleEntityNotFound(_0x1d71a5,null))[_0x64bf('0x16')](function(_0x1fcb2c){if(_0x1fcb2c){var _0x5ee9c8=_0x1fcb2c[_0x64bf('0xb8')]({'plain':!![]});fs['mkdirSync'](_0x15d2d7);var _0x440af5={'channel':_0x64bf('0xb9'),'account':_0x5ee9c8[_0x64bf('0xba')]['name'],'agent':_0x5ee9c8[_0x64bf('0xb7')]?_0x5ee9c8[_0x64bf('0xb7')][_0x64bf('0x52')]:_0x64bf('0xbb'),'createdAt':moment(_0x5ee9c8[_0x64bf('0x8c')])[_0x64bf('0x79')](_0x64bf('0xa2'))[_0x64bf('0xbc')](),'closedAt':_0x5ee9c8[_0x64bf('0x66')]?moment(_0x5ee9c8[_0x64bf('0xbd')])[_0x64bf('0x79')](_0x64bf('0xa2'))['toString']():'','disposition':_0x5ee9c8[_0x64bf('0x67')],'chatInfo':{'browser':_0x5ee9c8['browserName'],'os':_0x5ee9c8[_0x64bf('0xbe')],'referer':_0x5ee9c8[_0x64bf('0xbf')],'customerIp':_0x5ee9c8[_0x64bf('0xc0')],'customerPort':_0x5ee9c8[_0x64bf('0xc1')]?_0x5ee9c8[_0x64bf('0xc1')]:_0x64bf('0xbb')},'messages':_(_0x5ee9c8[_0x64bf('0x7e')])[_0x64bf('0xc2')]()['filter']({'secret':![]})[_0x64bf('0x33')](function(_0x47ec62){if(_0x47ec62[_0x64bf('0x6d')]){var _0x516a66=path[_0x64bf('0x71')](_0x596ff2,_0x47ec62[_0x64bf('0x6d')]['basename']);if(fs[_0x64bf('0xc3')](_0x516a66)){fs[_0x64bf('0xc4')](_0x516a66)['pipe'](fs[_0x64bf('0xc5')](path[_0x64bf('0x71')](_0x15d2d7,_0x47ec62['Attachment'][_0x64bf('0x74')])));}}return{'date':moment(_0x47ec62[_0x64bf('0x8c')])[_0x64bf('0x79')](_0x64bf('0xa2'))[_0x64bf('0xbc')](),'sender':_0x47ec62[_0x64bf('0x8e')]===_0x64bf('0xc6')?_0x47ec62['User']?_0x47ec62[_0x64bf('0x7f')][_0x64bf('0x52')]:'System':_0x47ec62[_0x64bf('0x62')][_0x64bf('0xc7')]+(_0x47ec62[_0x64bf('0x62')]['lastName']?'\x20'+_0x47ec62['Contact'][_0x64bf('0xb4')]:''),'body':_0x47ec62[_0x64bf('0x6d')]?_0x47ec62['Attachment']['basename']:_0x47ec62['body'],'direction':_0x47ec62[_0x64bf('0x8e')]===_0x64bf('0xc6')?'A':'C','secret':_0x47ec62[_0x64bf('0xa9')],'read':_0x47ec62[_0x64bf('0xb6')],'attachment':_0x47ec62['Attachment']};})[_0x64bf('0xc8')]()};return ejs['renderFile'](path[_0x64bf('0x71')](config[_0x64bf('0x72')],'server',_0x64bf('0xc9'),_0x64bf('0xca')),{'interaction':_0x440af5})[_0x64bf('0x16')](function(_0x5cc49a){var _0x2ffb44=path['join'](_0x15d2d7,_0x64bf('0xcb')+_0x5ee9c8['id']+'-'+_0x50773d+_0x64bf('0xcc'));var _0x5ac3da={'path':_0x2ffb44,'channel':_0x64bf('0xb9'),'interactionId':_0x5ee9c8['id']};return pdf[_0x64bf('0xcd')](_0x5cc49a,_0x5ac3da);})[_0x64bf('0x16')](function(){return new Promise(function(_0x33a3a2,_0x3e6dac){zipdir(_0x15d2d7,{'saveTo':_0x4dc0f9},function(_0x3ddd02,_0x1d04b6){if(_0x3ddd02)return _0x3e6dac(_0x3ddd02);return _0x33a3a2(_0x1d04b6);});})[_0x64bf('0x16')](function(){return new BPromise(function(_0x282894,_0x232c94){rimraf(_0x15d2d7,function(_0x22e246){if(_0x22e246)_0x232c94(_0x22e246);return _0x282894();});});})[_0x64bf('0x16')](function(){return _0x1d71a5[_0x64bf('0x75')](_0x4dc0f9,_0x32fff8,function(_0x581e9c){if(_0x581e9c){logger[_0x64bf('0x1d')](_0x64bf('0xce'),_0x581e9c);}else{fs[_0x64bf('0xcf')](_0x4dc0f9);}});});});}else{return _0x1d71a5[_0x64bf('0x22')](0xc8);}})['catch'](handleError(_0x1d71a5,null));}; \ No newline at end of file +var _0x19dc=['file','originalname','basename','filename','mimetype','Attachment','attachmentDownload','Unauthorized','attachId','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','download','close','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','ContactId','Messages','agentAlias','UserId','%s%d','System','agent_alias','User','alias','fullname','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','direction','secret','MailAccount','MailServerOut','Smtp','CloudProvider','getSmtpOptions','sendMail','\x22%s\x22\x20<%s>','addMessage','ids','omit','getMessages','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','map','$gte','YYYY-MM-DD\x20HH:mm:ss','includeAll','rows','getMyMessages','includeAgent','push','addTags','spread','Tag','removeTags','unix','toString','server','files','attachments','transcript-%d-%s.zip','Owner','mkdirSync','Chat','closedAt','osName','referer','customerIp','customerPort','N.A.','existsSync','createReadStream','pipe','createWriteStream','out','firstName','lastName','value','renderFile','downloadInteraction.ejs','transcript-','createPdfFromHTML','err','unlinkSync','rimraf','request-promise','moment','bluebird','mustache','path','ejs','lodash','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','update','destroy','stack','name','send','render','merge','body','contact','agent','interaction','account','index','ChatInteraction','fieldName','type','key','getOptions','findAll','chat','query','user','show','params','model','keys','rawAttributes','intersection','attributes','fields','include','options','create','find','describe','createVidaooSession','findOne','ChatWebsite','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','vidaooMetadata','parse','metadata','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','ChatMessage','customUpdate','CmContact','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','closed','disposition','attachmentUpload'];(function(_0x5de514,_0x59bf18){var _0x20f32f=function(_0x4543bd){while(--_0x4543bd){_0x5de514['push'](_0x5de514['shift']());}};_0x20f32f(++_0x59bf18);}(_0x19dc,0x12c));var _0xc19d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x19dc[_0x3dd15e];return _0x231fd0;};'use strict';var rimraf=require(_0xc19d('0x0'));var zipdir=require('zip-dir');var rp=require(_0xc19d('0x1'));var moment=require(_0xc19d('0x2'));var BPromise=require(_0xc19d('0x3'));var Mustache=require(_0xc19d('0x4'));var util=require('util');var path=require(_0xc19d('0x5'));var ejs=require(_0xc19d('0x6'));var fs=require('fs');var _=require(_0xc19d('0x7'));var Redis=require('ioredis');var interaction=require(_0xc19d('0x8'));var qs=require(_0xc19d('0x9'));var pdf=require(_0xc19d('0xa'));var logger=require(_0xc19d('0xb'))(_0xc19d('0xc'));var config=require(_0xc19d('0xd'));var db=require(_0xc19d('0xe'))['db'];config[_0xc19d('0xf')]=_[_0xc19d('0x10')](config[_0xc19d('0xf')],{'host':_0xc19d('0x11'),'port':0x18eb});var socket=require(_0xc19d('0x12'))(new Redis(config[_0xc19d('0xf')]));require('./chatInteraction.socket')[_0xc19d('0x13')](socket);var jayson=require(_0xc19d('0x14'));var client=jayson[_0xc19d('0x15')]['http']({'port':0x232b});var client9004=jayson[_0xc19d('0x15')][_0xc19d('0x16')]({'port':0x232c});function respondWithRpcPromise(_0x48168c,_0x353c57,_0x599d3c,_0x4978e5){return new BPromise(function(_0x500e2c,_0x58d246){var _0x49e445=_0x4978e5||client;return _0x49e445[_0xc19d('0x17')](_0x48168c,_0x599d3c)[_0xc19d('0x18')](function(_0x558b39){logger['info'](_0xc19d('0x19'),_0x353c57,_0xc19d('0x1a'));logger[_0xc19d('0x1b')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x353c57,_0xc19d('0x1a'),JSON[_0xc19d('0x1c')](_0x558b39));if(_0x558b39[_0xc19d('0x1d')]){if(_0x558b39[_0xc19d('0x1d')]['code']===0x1f4){logger['error'](_0xc19d('0x19'),_0x353c57,_0x558b39['error']['message']);return _0x58d246(_0x558b39['error'][_0xc19d('0x1e')]);}logger[_0xc19d('0x1d')](_0xc19d('0x19'),_0x353c57,_0x558b39[_0xc19d('0x1d')][_0xc19d('0x1e')]);return _0x500e2c(_0x558b39[_0xc19d('0x1d')][_0xc19d('0x1e')]);}else{logger['info'](_0xc19d('0x19'),_0x353c57,_0xc19d('0x1a'));_0x500e2c(_0x558b39[_0xc19d('0x1f')][_0xc19d('0x1e')]);}})[_0xc19d('0x20')](function(_0x421d2e){logger[_0xc19d('0x1d')](_0xc19d('0x19'),_0x353c57,_0x421d2e);_0x58d246(_0x421d2e);});});}function respondWithStatusCode(_0xa81cca,_0x260d43){_0x260d43=_0x260d43||0xcc;return function(_0x25f044){if(_0x25f044){return _0xa81cca[_0xc19d('0x21')](_0x260d43);}return _0xa81cca[_0xc19d('0x22')](_0x260d43)[_0xc19d('0x23')]();};}function respondWithResult(_0x419b93,_0x30ff65){_0x30ff65=_0x30ff65||0xc8;return function(_0x39beed){if(_0x39beed){return _0x419b93[_0xc19d('0x22')](_0x30ff65)[_0xc19d('0x24')](_0x39beed);}};}function respondWithFilteredResult(_0x488b70,_0x2364ed){return function(_0x517092){if(_0x517092){var _0xc8c5dc=typeof _0x2364ed['offset']===_0xc19d('0x25')&&typeof _0x2364ed[_0xc19d('0x26')]===_0xc19d('0x25');var _0x3bb1f0=_0x517092[_0xc19d('0x27')];var _0x4ce34e=_0xc8c5dc?0x0:_0x2364ed['offset'];var _0x3af720=_0xc8c5dc?_0x517092[_0xc19d('0x27')]:_0x2364ed[_0xc19d('0x28')]+_0x2364ed[_0xc19d('0x26')];var _0x3c7d6c;if(_0x3af720>=_0x3bb1f0){_0x3af720=_0x3bb1f0;_0x3c7d6c=0xc8;}else{_0x3c7d6c=0xce;}_0x488b70['status'](_0x3c7d6c);return _0x488b70[_0xc19d('0x29')]('Content-Range',_0x4ce34e+'-'+_0x3af720+'/'+_0x3bb1f0)['json'](_0x517092);}return null;};}function saveUpdates(_0x46e5c4){return function(_0x1ab042){if(_0x1ab042){return _0x1ab042[_0xc19d('0x2a')](_0x46e5c4)[_0xc19d('0x18')](function(_0x333333){return _0x333333;});}return null;};}function removeEntity(_0x308ef8){return function(_0xea3948){if(_0xea3948){return _0xea3948[_0xc19d('0x2b')]()[_0xc19d('0x18')](function(){_0x308ef8[_0xc19d('0x22')](0xcc)[_0xc19d('0x23')]();});}};}function handleEntityNotFound(_0x4523d4){return function(_0x14b7e4){if(!_0x14b7e4){_0x4523d4[_0xc19d('0x21')](0x194);}return _0x14b7e4;};}function handleError(_0x195134,_0x5b0eef){_0x5b0eef=_0x5b0eef||0x1f4;return function(_0x2aa023){logger[_0xc19d('0x1d')](_0x2aa023[_0xc19d('0x2c')]);if(_0x2aa023[_0xc19d('0x2d')]){delete _0x2aa023['name'];}_0x195134['status'](_0x5b0eef)[_0xc19d('0x2e')](_0x2aa023);};}function getMustacheRender(_0x137936,_0x1d9025){return Mustache[_0xc19d('0x2f')](_0x137936,_[_0xc19d('0x30')](_0x1d9025[_0xc19d('0x31')],{'contact':_0x1d9025[_0xc19d('0x32')],'message':_0x1d9025[_0xc19d('0x1e')],'agent':_0x1d9025[_0xc19d('0x33')],'interaction':_0x1d9025[_0xc19d('0x34')],'account':_0x1d9025[_0xc19d('0x35')]}))||'';}exports[_0xc19d('0x36')]=function(_0x56eb4b,_0x2fe111){var _0x525c5f={};var _0xb3a99=_['map'](db[_0xc19d('0x37')]['rawAttributes'],function(_0x1c05d8){return{'name':_0x1c05d8[_0xc19d('0x38')],'type':_0x1c05d8[_0xc19d('0x39')][_0xc19d('0x3a')]};});_0x525c5f=qs[_0xc19d('0x3b')](_0xb3a99,_0x56eb4b);return interaction[_0xc19d('0x3c')](_0xc19d('0x3d'),_0x56eb4b[_0xc19d('0x3e')],_0x56eb4b[_0xc19d('0x3f')],_0x525c5f,_0xb3a99)[_0xc19d('0x18')](respondWithFilteredResult(_0x2fe111,_0x525c5f))['catch'](handleError(_0x2fe111,null));};exports[_0xc19d('0x40')]=function(_0x16983b,_0x5c9ac1){var _0x3de2be={'raw':![],'where':{'id':_0x16983b[_0xc19d('0x41')]['id']}},_0x52ff04={};_0x52ff04[_0xc19d('0x42')]=_[_0xc19d('0x43')](db[_0xc19d('0x37')][_0xc19d('0x44')]);_0x52ff04['query']=_['keys'](_0x16983b['query']);_0x52ff04['filters']=_[_0xc19d('0x45')](_0x52ff04[_0xc19d('0x42')],_0x52ff04[_0xc19d('0x3e')]);_0x3de2be[_0xc19d('0x46')]=_[_0xc19d('0x45')](_0x52ff04[_0xc19d('0x42')],qs[_0xc19d('0x47')](_0x16983b[_0xc19d('0x3e')]['fields']));_0x3de2be['attributes']=_0x3de2be[_0xc19d('0x46')]['length']?_0x3de2be[_0xc19d('0x46')]:_0x52ff04[_0xc19d('0x42')];if(_0x16983b[_0xc19d('0x3e')]['includeAll']){_0x3de2be[_0xc19d('0x48')]=[{'all':!![]}];}_0x3de2be=_[_0xc19d('0x30')]({},_0x3de2be,_0x16983b[_0xc19d('0x49')]);return db['ChatInteraction']['find'](_0x3de2be)[_0xc19d('0x18')](handleEntityNotFound(_0x5c9ac1,null))[_0xc19d('0x18')](respondWithResult(_0x5c9ac1,null))[_0xc19d('0x20')](handleError(_0x5c9ac1,null));};exports[_0xc19d('0x4a')]=function(_0x49160d,_0x2202df){return db['ChatInteraction']['create'](_0x49160d[_0xc19d('0x31')],{})[_0xc19d('0x18')](respondWithResult(_0x2202df,0xc9))[_0xc19d('0x20')](handleError(_0x2202df,null));};exports[_0xc19d('0x2a')]=function(_0x30eb3f,_0x3e4ea9){if(_0x30eb3f[_0xc19d('0x31')]['id']){delete _0x30eb3f[_0xc19d('0x31')]['id'];}return db[_0xc19d('0x37')]['find']({'where':{'id':_0x30eb3f[_0xc19d('0x41')]['id']}})[_0xc19d('0x18')](handleEntityNotFound(_0x3e4ea9,null))[_0xc19d('0x18')](saveUpdates(_0x30eb3f[_0xc19d('0x31')],null))[_0xc19d('0x18')](respondWithResult(_0x3e4ea9,null))[_0xc19d('0x20')](handleError(_0x3e4ea9,null));};exports[_0xc19d('0x2b')]=function(_0x21f918,_0x543a0c){return db['ChatInteraction'][_0xc19d('0x4b')]({'where':{'id':_0x21f918[_0xc19d('0x41')]['id']}})['then'](handleEntityNotFound(_0x543a0c,null))[_0xc19d('0x18')](removeEntity(_0x543a0c,null))[_0xc19d('0x20')](handleError(_0x543a0c,null));};exports[_0xc19d('0x4c')]=function(_0x2abebc,_0x5c0273){return db[_0xc19d('0x37')][_0xc19d('0x4c')]()[_0xc19d('0x18')](respondWithResult(_0x5c0273,null))[_0xc19d('0x20')](handleError(_0x5c0273,null));};exports[_0xc19d('0x4d')]=function(_0x3cf777,_0x2f3a91){var _0x5563a1=_0x3cf777[_0xc19d('0x41')]['id'];var _0x30f27f;var _0x33b9e7;var _0x30aa97;return db[_0xc19d('0x37')][_0xc19d('0x4e')]({'where':{'id':_0x5563a1}})[_0xc19d('0x18')](function(_0x1e02bd){_0x30f27f=_0x1e02bd;return db[_0xc19d('0x4f')][_0xc19d('0x4e')]({'where':{'id':_0x1e02bd[_0xc19d('0x50')]},'attributes':['id',_0xc19d('0x51'),_0xc19d('0x52'),_0xc19d('0x53'),_0xc19d('0x54'),'vidaooMetadata'],'raw':!![]});})[_0xc19d('0x18')](function(_0x5d1abc){if(_0x5d1abc&&_0x5d1abc[_0xc19d('0x51')]&&_0x5d1abc[_0xc19d('0x52')]){_0x33b9e7=_0x5d1abc;var _0x49b0db={'interaction':{'id':_0x5563a1},'agent':{'id':_0x3cf777[_0xc19d('0x3f')]['id'],'name':_0x3cf777[_0xc19d('0x3f')][_0xc19d('0x2d')],'fullname':_0x3cf777[_0xc19d('0x3f')]['fullname'],'email':_0x3cf777['user'][_0xc19d('0x55')]},'contact':_0x3cf777[_0xc19d('0x31')][_0xc19d('0x32')],'account':_0x3cf777['body'][_0xc19d('0x35')]};var _0x4304f4={'rejectUnauthorized':![],'method':_0xc19d('0x56'),'url':_0xc19d('0x57'),'headers':{'X-APIKEY':_0x5d1abc[_0xc19d('0x51')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x3cf777['user'][_0xc19d('0x55')]],'buttons':null,'topic':_0x33b9e7[_0xc19d('0x53')],'note':_['isNull'](_0x33b9e7[_0xc19d('0x54')])?null:getMustacheRender(_0x33b9e7[_0xc19d('0x54')],_0x49b0db),'metadata':null},'redirect':'follow','json':!![]};try{if(!_['isNull'](_0x33b9e7[_0xc19d('0x58')])){var _0x210b95=getMustacheRender(_0x33b9e7[_0xc19d('0x58')],_0x49b0db);var _0x1e6983=JSON[_0xc19d('0x59')](_0x210b95);_0x4304f4[_0xc19d('0x31')][_0xc19d('0x5a')]=_0x1e6983;}}catch(_0x49f2bb){throw new db[(_0xc19d('0x5b'))][(_0xc19d('0x5c'))](_0xc19d('0x5d'));}return rp(_0x4304f4);}else{throw new db[(_0xc19d('0x5b'))][(_0xc19d('0x5c'))](_0xc19d('0x5e'));}})[_0xc19d('0x18')](function(_0x1d43c4){_0x30aa97=_0x1d43c4;if(_0x30aa97['id']){var _0x1ebb05={'body':_0x30aa97['join_url'],'ChatWebsiteId':_0x33b9e7['id'],'ChatInteractionId':_0x30f27f['id'],'direction':'out','UserId':_0x3cf777[_0xc19d('0x3f')]['id']};return db[_0xc19d('0x5f')][_0xc19d('0x4a')](_0x1ebb05,{});}else{throw new db['Sequelize'][(_0xc19d('0x5c'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0xc19d('0x18')](function(){return _0x30f27f['updateAttributes']({'vidaooSessionId':_0x30aa97['id']});})[_0xc19d('0x18')](respondWithResult(_0x2f3a91,null))[_0xc19d('0x20')](handleError(_0x2f3a91,null));};exports[_0xc19d('0x60')]=function(_0x706fc0,_0x337f2f){if(_0x706fc0[_0xc19d('0x31')]['id']){delete _0x706fc0[_0xc19d('0x31')]['id'];}return db[_0xc19d('0x37')][_0xc19d('0x4b')]({'where':{'id':_0x706fc0['params']['id']},'include':[{'model':db[_0xc19d('0x61')],'as':_0xc19d('0x62')}]})[_0xc19d('0x18')](handleEntityNotFound(_0x337f2f,null))[_0xc19d('0x18')](saveUpdates(_0x706fc0[_0xc19d('0x31')],null))['then'](respondWithResult(_0x337f2f,null))['catch'](handleError(_0x337f2f,null));};exports[_0xc19d('0x63')]=function(_0xee4fb7,_0x4c7a82){if(_0xee4fb7[_0xc19d('0x31')]['id']){delete _0xee4fb7[_0xc19d('0x31')]['id'];}return db[_0xc19d('0x37')][_0xc19d('0x4b')]({'where':{'id':_0xee4fb7['params']['id']}})[_0xc19d('0x18')](function(_0x570df8){if(!_0x570df8){logger[_0xc19d('0x1d')](_0xc19d('0x64'),_0xc19d('0x63'),0x194,_0xc19d('0x65'));_0x4c7a82[_0xc19d('0x21')](0x194);}else{if(_0x570df8['UserId']){throw new db[(_0xc19d('0x5b'))]['ValidationError'](_0xc19d('0x66'));}}return _0x570df8;})[_0xc19d('0x18')](function(_0xfd3ba7){if(_0xfd3ba7){return _0xfd3ba7['update']({'closed':_0xee4fb7['body'][_0xc19d('0x67')],'disposition':_0xee4fb7['body'][_0xc19d('0x68')]})[_0xc19d('0x18')](function(_0x23f62e){return _0x23f62e;});}})['then'](function(){return respondWithRpcPromise('AbandonInteraction',_0xc19d('0x63'),_0xee4fb7[_0xc19d('0x31')],client9004);})['then'](respondWithResult(_0x4c7a82,null))[_0xc19d('0x20')](handleError(_0x4c7a82,null));};exports[_0xc19d('0x69')]=function(_0x4a2818,_0x33d99f){_0x4a2818[_0xc19d('0x31')][_0xc19d('0x2d')]=_0x4a2818[_0xc19d('0x6a')][_0xc19d('0x6b')];_0x4a2818[_0xc19d('0x31')][_0xc19d('0x6c')]=_0x4a2818[_0xc19d('0x6a')][_0xc19d('0x6d')];_0x4a2818[_0xc19d('0x31')][_0xc19d('0x39')]=_0x4a2818[_0xc19d('0x6a')][_0xc19d('0x6e')];return db[_0xc19d('0x6f')][_0xc19d('0x4a')](_0x4a2818[_0xc19d('0x31')])[_0xc19d('0x18')](respondWithResult(_0x33d99f,0xc9))[_0xc19d('0x20')](handleError(_0x33d99f,null));};exports[_0xc19d('0x70')]=function(_0x27fafe,_0x37c55c){return db[_0xc19d('0x37')][_0xc19d('0x4e')]({'where':{'id':_0x27fafe[_0xc19d('0x41')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x37c55c,null))[_0xc19d('0x18')](function(_0x2b9cf6){if(_0x2b9cf6){if(_0x2b9cf6[_0xc19d('0x67')]){return _0x37c55c[_0xc19d('0x22')](0x193)[_0xc19d('0x24')]({'status':0x193,'message':_0xc19d('0x71')});}return db[_0xc19d('0x6f')]['findOne']({'where':{'id':_0x27fafe[_0xc19d('0x3e')][_0xc19d('0x72')]},'raw':!![]})['then'](handleEntityNotFound(_0x37c55c,null));}})[_0xc19d('0x18')](function(_0x1ba2c4){if(_0x1ba2c4){var _0x1e6e11=_0x1ba2c4[_0xc19d('0x73')]!==null;var _0x4a4c68=path[_0xc19d('0x74')](config[_0xc19d('0x75')],_0xc19d('0x76'));if(_0x1e6e11){_0x4a4c68=path['join'](_0x4a4c68,_0xc19d('0x77'));}var _0x51a304=path[_0xc19d('0x74')](_0x4a4c68,_0x1ba2c4[_0xc19d('0x6c')]);return _0x37c55c[_0xc19d('0x78')](_0x51a304);}})[_0xc19d('0x20')](handleError(_0x37c55c,null));};exports[_0xc19d('0x79')]=function(_0x171968,_0x54e48e){var _0x3982ee=null;var _0x1390f7=null;var _0x30d6f4=null;if(_0x171968['body']['id']){delete _0x171968[_0xc19d('0x31')]['id'];}if(_0x171968['body']['mailTranscript']){_0x30d6f4=path['join'](config[_0xc19d('0x75')],_0xc19d('0x7a'),util[_0xc19d('0x7b')](_0xc19d('0x7c'),Date[_0xc19d('0x7d')]()));_0x171968[_0xc19d('0x31')][_0xc19d('0x7e')]=_0x30d6f4;}return db['ChatInteraction'][_0xc19d('0x4b')]({'where':{'id':_0x171968['params']['id']},'include':[{'model':db['ChatMessage'],'as':'Messages','include':[{'model':db['User'],'as':'User'}]}]})[_0xc19d('0x18')](handleEntityNotFound(_0x54e48e,null))[_0xc19d('0x18')](saveUpdates(_0x171968['body'],null))[_0xc19d('0x18')](function(_0x4d6a63){if(_0x4d6a63){_0x3982ee=_0x4d6a63;return db[_0xc19d('0x4f')][_0xc19d('0x4b')]({'where':{'id':_0x3982ee['ChatWebsiteId']}});}})[_0xc19d('0x18')](function(_0x54811d){if(_0x54811d){_0x1390f7=_0x54811d;return db['CmContact']['find']({'where':{'id':_0x3982ee[_0xc19d('0x7f')]}});}})[_0xc19d('0x18')](function(_0x44c6f1){if(_0x44c6f1){if(_0x30d6f4){var _0x50cb91=null;for(var _0x31358f=0x1;_0x31358f<_0x3982ee[_0xc19d('0x80')]['length'];++_0x31358f){_0x50cb91=_0x3982ee[_0xc19d('0x80')][_0x31358f];var _0x345e82=_0x50cb91['UserId']?util['format']('%s%d',_0x1390f7[_0xc19d('0x81')],_0x50cb91[_0xc19d('0x82')]):'System';var _0x84d68d=_0x171968['body']['customer']||util['format'](_0xc19d('0x83'),'Visitor',_0x50cb91[_0xc19d('0x7f')]);switch(_0x1390f7['agentIdentifier']){case'website_alias':_0x345e82=_0x50cb91[_0xc19d('0x82')]?util[_0xc19d('0x7b')]('%s%d',_0x1390f7[_0xc19d('0x81')],_0x50cb91[_0xc19d('0x82')]):_0xc19d('0x84');break;case _0xc19d('0x85'):_0x345e82=_0x50cb91[_0xc19d('0x82')]?_0x50cb91[_0xc19d('0x86')][_0xc19d('0x87')]||_0x50cb91[_0xc19d('0x86')][_0xc19d('0x88')]:_0xc19d('0x84');break;case _0xc19d('0x89'):_0x345e82=_0x50cb91[_0xc19d('0x82')]?_0x50cb91[_0xc19d('0x86')][_0xc19d('0x88')]:'System';break;default:_0x345e82=_0x50cb91[_0xc19d('0x82')]?util[_0xc19d('0x7b')]('%s%d',_0x1390f7[_0xc19d('0x81')],_0x50cb91[_0xc19d('0x82')]):_0xc19d('0x84');}var _0x395a12=util[_0xc19d('0x7b')](_0xc19d('0x8a'),moment(_0x50cb91[_0xc19d('0x8b')])['format']('MM/DD/YYYY\x20HH:mm:ss'),_0x50cb91[_0xc19d('0x8c')]==='in'?_0x84d68d:_0x345e82,_0x50cb91['body']);if(!_0x50cb91[_0xc19d('0x8d')]){fs['appendFileSync'](_0x30d6f4,_0x395a12);}}return db[_0xc19d('0x8e')][_0xc19d('0x4e')]({'where':{'service':!![]},'include':[{'model':db[_0xc19d('0x8f')],'as':_0xc19d('0x90'),'raw':!![],'include':[{'model':db[_0xc19d('0x91')],'as':'CloudProvider','raw':!![]}]}]});}}})[_0xc19d('0x18')](function(_0x43beba){if(!_0x43beba||!_0x43beba[_0xc19d('0x90')]||!_0x171968['body'])return _0x3982ee;var _0x42d7d8=_0x43beba[_0xc19d('0x92')]();return respondWithRpcPromise('SendMail',_0xc19d('0x93'),{'account':_0x42d7d8,'message':{'from':util['format'](_0xc19d('0x94'),_0x43beba[_0xc19d('0x2d')],_0x43beba['email']||_0x43beba[_0xc19d('0x90')][_0xc19d('0x3f')]),'to':_0x171968['body']['mailTranscript'],'subject':'Mail\x20Transcript','text':util[_0xc19d('0x7b')]('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x171968[_0xc19d('0x31')]['mailTranscript']),'attachments':[{'path':_0x30d6f4}]}})['then'](function(){return _0x3982ee;})[_0xc19d('0x20')](function(_0x3b6c45){logger[_0xc19d('0x1d')](_0x3b6c45);});})['then'](respondWithStatusCode(_0x54e48e,0xc8))[_0xc19d('0x20')](handleError(_0x54e48e,null));};exports[_0xc19d('0x95')]=function(_0x18bb0a,_0x2ff13d){return db['ChatMessage'][_0xc19d('0x4b')]({'where':{'id':_0x18bb0a[_0xc19d('0x41')]['id']}})[_0xc19d('0x18')](handleEntityNotFound(_0x2ff13d,null))[_0xc19d('0x18')](function(_0x5945d1){if(_0x5945d1){return _0x5945d1['addMessage'](_0x18bb0a['body'][_0xc19d('0x96')],_[_0xc19d('0x97')](_0x18bb0a['body'],[_0xc19d('0x96'),'id'])||{});}})[_0xc19d('0x18')](respondWithResult(_0x2ff13d,null))[_0xc19d('0x20')](handleError(_0x2ff13d,null));};exports[_0xc19d('0x98')]=function(_0x23fbc7,_0x5d7658){var _0x290e6f={'raw':![],'where':{}};var _0x3642b2={};var _0x403286={'count':0x0,'rows':[]};return db[_0xc19d('0x37')][_0xc19d('0x4e')]({'where':{'id':_0x23fbc7['params']['id']}})[_0xc19d('0x18')](handleEntityNotFound(_0x5d7658,null))['then'](function(_0x390aba){if(_0x390aba){_0x3642b2[_0xc19d('0x42')]=_['keys'](db[_0xc19d('0x5f')][_0xc19d('0x44')]);_0x3642b2['query']=_[_0xc19d('0x43')](_0x23fbc7[_0xc19d('0x3e')]);_0x3642b2['filters']=_['intersection'](_0x3642b2[_0xc19d('0x42')],_0x3642b2['query']);_0x290e6f[_0xc19d('0x46')]=_[_0xc19d('0x45')](_0x3642b2[_0xc19d('0x42')],qs[_0xc19d('0x47')](_0x23fbc7['query'][_0xc19d('0x47')]));_0x290e6f[_0xc19d('0x46')]=_0x290e6f[_0xc19d('0x46')][_0xc19d('0x99')]?_0x290e6f['attributes']:_0x3642b2[_0xc19d('0x42')];if(!_0x23fbc7['query'][_0xc19d('0x9a')](_0xc19d('0x9b'))){_0x290e6f[_0xc19d('0x26')]=qs['limit'](_0x23fbc7[_0xc19d('0x3e')][_0xc19d('0x26')]);_0x290e6f['offset']=qs[_0xc19d('0x28')](_0x23fbc7[_0xc19d('0x3e')]['offset']);}_0x290e6f[_0xc19d('0x9c')]=qs[_0xc19d('0x9d')](_0x23fbc7['query'][_0xc19d('0x9d')]);_0x290e6f[_0xc19d('0x9e')]=qs['filters'](_[_0xc19d('0x9f')](_0x23fbc7[_0xc19d('0x3e')],_0x3642b2[_0xc19d('0xa0')]));_0x290e6f[_0xc19d('0x9e')]['ChatInteractionId']=_0x390aba['id'];if(_0x23fbc7[_0xc19d('0x3e')][_0xc19d('0xa1')]){_0x290e6f['where']=_['merge'](_0x290e6f['where'],{'$or':_[_0xc19d('0xa2')](_0x290e6f[_0xc19d('0x46')],function(_0x336ef0){var _0x3fde7a={};_0x3fde7a[_0x336ef0]={'$like':'%'+_0x23fbc7[_0xc19d('0x3e')]['filter']+'%'};return _0x3fde7a;})});}if(_0x23fbc7[_0xc19d('0x3e')]['$gte']){var _0x5d3a4c=_0x23fbc7[_0xc19d('0x3e')][_0xc19d('0xa3')]['split'](',');var _0x3b17eb={};_0x3b17eb[_0x5d3a4c[0x0]]={'$gte':moment(_0x5d3a4c[0x1])[_0xc19d('0x7b')](_0xc19d('0xa4'))};_0x290e6f['where']=_[_0xc19d('0x30')](_0x290e6f[_0xc19d('0x9e')],_0x3b17eb);}_0x290e6f=_[_0xc19d('0x30')]({},_0x290e6f,_0x23fbc7[_0xc19d('0x49')]);return db[_0xc19d('0x5f')][_0xc19d('0x27')]({'where':_0x290e6f[_0xc19d('0x9e')]})[_0xc19d('0x18')](function(_0x587b33){_0x403286['count']=_0x587b33;if(_0x23fbc7['query'][_0xc19d('0xa5')]){_0x290e6f[_0xc19d('0x48')]=[{'all':!![]}];}return db['ChatMessage']['findAll'](_0x290e6f);})[_0xc19d('0x18')](function(_0x76ba0){_0x403286[_0xc19d('0xa6')]=_0x76ba0;return _0x403286;});}})[_0xc19d('0x18')](respondWithFilteredResult(_0x5d7658,_0x290e6f))[_0xc19d('0x20')](handleError(_0x5d7658,null));};exports[_0xc19d('0xa7')]=function(_0x1c1812,_0x4e46fc){var _0x414bbb={'where':{}},_0x4ebb6b={},_0x2d55d9={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xc19d('0x4e')]({'where':{'id':_0x1c1812[_0xc19d('0x41')]['id']}})[_0xc19d('0x18')](handleEntityNotFound(_0x4e46fc,null))['then'](function(_0x508db4){if(_0x508db4){_0x4ebb6b['model']=_['keys'](db[_0xc19d('0x5f')][_0xc19d('0x44')]);_0x4ebb6b[_0xc19d('0x3e')]=_[_0xc19d('0x43')](_0x1c1812[_0xc19d('0x3e')]);_0x4ebb6b[_0xc19d('0xa0')]=_['intersection'](_0x4ebb6b[_0xc19d('0x42')],_0x4ebb6b[_0xc19d('0x3e')]);_0x414bbb[_0xc19d('0x46')]=_[_0xc19d('0x45')](_0x4ebb6b[_0xc19d('0x42')],qs[_0xc19d('0x47')](_0x1c1812[_0xc19d('0x3e')][_0xc19d('0x47')]));_0x414bbb[_0xc19d('0x46')]=_0x414bbb[_0xc19d('0x46')][_0xc19d('0x99')]?_0x414bbb[_0xc19d('0x46')]:_0x4ebb6b['model'];if(!_0x1c1812[_0xc19d('0x3e')]['hasOwnProperty'](_0xc19d('0x9b'))){_0x414bbb[_0xc19d('0x26')]=qs[_0xc19d('0x26')](_0x1c1812[_0xc19d('0x3e')]['limit']);_0x414bbb[_0xc19d('0x28')]=qs[_0xc19d('0x28')](_0x1c1812['query'][_0xc19d('0x28')]);}_0x414bbb[_0xc19d('0x9c')]=qs[_0xc19d('0x9d')](_0x1c1812[_0xc19d('0x3e')][_0xc19d('0x9d')]);_0x414bbb[_0xc19d('0x9e')]=qs[_0xc19d('0xa0')](_[_0xc19d('0x9f')](_0x1c1812[_0xc19d('0x3e')],_0x4ebb6b[_0xc19d('0xa0')]));_0x414bbb[_0xc19d('0x9e')]['ChatInteractionId']=_0x508db4['id'];if(_0x1c1812['query'][_0xc19d('0xa1')]){_0x414bbb[_0xc19d('0x9e')]=_[_0xc19d('0x30')](_0x414bbb[_0xc19d('0x9e')],{'$or':_[_0xc19d('0xa2')](_0x414bbb[_0xc19d('0x46')],function(_0x51e4a9){var _0xe859b4={};_0xe859b4[_0x51e4a9]={'$like':'%'+_0x1c1812[_0xc19d('0x3e')][_0xc19d('0xa1')]+'%'};return _0xe859b4;})});}_0x414bbb[_0xc19d('0x9e')][_0xc19d('0x8d')]=![];if(_0x1c1812[_0xc19d('0x3e')]['id']){_0x414bbb[_0xc19d('0x9e')]['id']={'$gt':_0x1c1812[_0xc19d('0x3e')]['id']};}_0x414bbb=_['merge']({},_0x414bbb,_0x1c1812[_0xc19d('0x49')]);return db[_0xc19d('0x5f')][_0xc19d('0x27')]({'where':_0x414bbb[_0xc19d('0x9e')]})[_0xc19d('0x18')](function(_0x42b3f1){_0x2d55d9[_0xc19d('0x27')]=_0x42b3f1;_0x414bbb[_0xc19d('0x48')]=[];if(_0x1c1812['query'][_0xc19d('0xa8')]){_0x414bbb[_0xc19d('0x48')][_0xc19d('0xa9')]({'model':db[_0xc19d('0x86')],'as':_0xc19d('0x86'),'attributes':['id',_0xc19d('0x88'),'alias']});}if(_0x1c1812[_0xc19d('0x3e')][_0xc19d('0xa5')]){_0x414bbb['include']=[{'all':!![]}];}return db[_0xc19d('0x5f')][_0xc19d('0x3c')](_0x414bbb);})[_0xc19d('0x18')](function(_0xd77ac3){_0x2d55d9[_0xc19d('0xa6')]=_0xd77ac3;return _0x2d55d9;});}})[_0xc19d('0x18')](respondWithFilteredResult(_0x4e46fc,_0x414bbb))[_0xc19d('0x20')](handleError(_0x4e46fc,null));};exports[_0xc19d('0xaa')]=function(_0x35ab01,_0x428995){return db[_0xc19d('0x37')]['find']({'where':{'id':_0x35ab01[_0xc19d('0x41')]['id']}})[_0xc19d('0x18')](handleEntityNotFound(_0x428995,null))[_0xc19d('0x18')](function(_0x2d4d1e){if(_0x2d4d1e){return _0x2d4d1e['setTags'](_0x35ab01[_0xc19d('0x31')][_0xc19d('0x96')],_[_0xc19d('0x97')](_0x35ab01['body'],[_0xc19d('0x96'),'id'])||{})[_0xc19d('0xab')](function(){return db[_0xc19d('0xac')][_0xc19d('0x3c')]({'attributes':['id',_0xc19d('0x2d'),'color'],'where':{'id':_0x35ab01[_0xc19d('0x31')][_0xc19d('0x96')]}});})[_0xc19d('0x18')](function(_0x4906d8){socket['emit']('chatInteractionTags:save',{'id':Number(_0x35ab01['params']['id']),'tags':_0x4906d8||[]});return{'id':Number(_0x35ab01[_0xc19d('0x41')]['id']),'tags':_0x4906d8||[]};});}})[_0xc19d('0x18')](respondWithResult(_0x428995,null))['catch'](handleError(_0x428995,null));};exports[_0xc19d('0xad')]=function(_0x19dbc4,_0x219d21){return db[_0xc19d('0x37')]['find']({'where':{'id':_0x19dbc4[_0xc19d('0x41')]['id']}})[_0xc19d('0x18')](handleEntityNotFound(_0x219d21,null))[_0xc19d('0x18')](function(_0x447f41){if(_0x447f41){return _0x447f41[_0xc19d('0xad')](_0x19dbc4[_0xc19d('0x3e')]['ids']);}})[_0xc19d('0x18')](respondWithStatusCode(_0x219d21,null))[_0xc19d('0x20')](handleError(_0x219d21,null));};exports[_0xc19d('0x78')]=function(_0x20b67c,_0x2d8ff6){var _0x1533a0=moment()[_0xc19d('0xae')]()[_0xc19d('0xaf')]();var _0xaf6136=path[_0xc19d('0x74')](config[_0xc19d('0x75')],_0xc19d('0xb0'),_0xc19d('0xb1'),'tmp');var _0x4bfc37=path[_0xc19d('0x74')](config[_0xc19d('0x75')],'server',_0xc19d('0xb1'),_0xc19d('0xb2'));var _0x4d7ed8=path[_0xc19d('0x74')](_0xaf6136,_0x1533a0);var _0x5a9316=util[_0xc19d('0x7b')](_0xc19d('0xb3'),_0x20b67c['params']['id'],_0x1533a0);var _0xb463dd=path[_0xc19d('0x74')](_0xaf6136,_0x5a9316);var _0x165000=[];_0x165000[_0xc19d('0xa9')]({'model':db[_0xc19d('0x86')],'as':_0xc19d('0x86'),'attributes':['id',_0xc19d('0x88')],'raw':!![]});_0x165000[_0xc19d('0xa9')]({'model':db[_0xc19d('0x61')],'as':_0xc19d('0x62'),'attributes':['id','firstName','lastName'],'raw':!![]});if(_0x20b67c[_0xc19d('0x3e')]['attachments']){_0x165000[_0xc19d('0xa9')]({'model':db[_0xc19d('0x6f')],'as':'Attachment','raw':!![]});}var _0x21d22d=[{'model':db[_0xc19d('0x5f')],'as':_0xc19d('0x80'),'attributes':['id',_0xc19d('0x31'),_0xc19d('0x8b'),_0xc19d('0x8c'),_0xc19d('0x8d'),'read'],'include':_0x165000}];_0x21d22d[_0xc19d('0xa9')]({'model':db[_0xc19d('0x4f')],'as':'Account','attributes':['id',_0xc19d('0x2d')]});_0x21d22d[_0xc19d('0xa9')]({'model':db[_0xc19d('0x86')],'as':_0xc19d('0xb4'),'attributes':['id',_0xc19d('0x88')]});return db[_0xc19d('0x37')]['find']({'where':{'id':_0x20b67c['params']['id']},'include':_0x21d22d})[_0xc19d('0x18')](handleEntityNotFound(_0x2d8ff6,null))[_0xc19d('0x18')](function(_0x373d4f){if(_0x373d4f){var _0x5bcb81=_0x373d4f['get']({'plain':!![]});fs[_0xc19d('0xb5')](_0x4d7ed8);var _0x3596cd={'channel':_0xc19d('0xb6'),'account':_0x5bcb81['Account']['name'],'agent':_0x5bcb81['Owner']?_0x5bcb81['Owner'][_0xc19d('0x88')]:'N.A.','createdAt':moment(_0x5bcb81['createdAt'])[_0xc19d('0x7b')](_0xc19d('0xa4'))[_0xc19d('0xaf')](),'closedAt':_0x5bcb81[_0xc19d('0x67')]?moment(_0x5bcb81[_0xc19d('0xb7')])['format'](_0xc19d('0xa4'))[_0xc19d('0xaf')]():'','disposition':_0x5bcb81['disposition'],'chatInfo':{'browser':_0x5bcb81['browserName'],'os':_0x5bcb81[_0xc19d('0xb8')],'referer':_0x5bcb81[_0xc19d('0xb9')],'customerIp':_0x5bcb81[_0xc19d('0xba')],'customerPort':_0x5bcb81[_0xc19d('0xbb')]?_0x5bcb81[_0xc19d('0xbb')]:_0xc19d('0xbc')},'messages':_(_0x5bcb81[_0xc19d('0x80')])['tail']()['filter']({'secret':![]})[_0xc19d('0xa2')](function(_0x4e43c8){if(_0x4e43c8[_0xc19d('0x6f')]){var _0xb977f5=path[_0xc19d('0x74')](_0x4bfc37,_0x4e43c8['Attachment'][_0xc19d('0x6c')]);if(fs[_0xc19d('0xbd')](_0xb977f5)){fs[_0xc19d('0xbe')](_0xb977f5)[_0xc19d('0xbf')](fs[_0xc19d('0xc0')](path[_0xc19d('0x74')](_0x4d7ed8,_0x4e43c8[_0xc19d('0x6f')][_0xc19d('0x6c')])));}}return{'date':moment(_0x4e43c8[_0xc19d('0x8b')])[_0xc19d('0x7b')](_0xc19d('0xa4'))[_0xc19d('0xaf')](),'sender':_0x4e43c8[_0xc19d('0x8c')]===_0xc19d('0xc1')?_0x4e43c8[_0xc19d('0x86')]?_0x4e43c8[_0xc19d('0x86')]['fullname']:_0xc19d('0x84'):_0x4e43c8[_0xc19d('0x62')][_0xc19d('0xc2')]+(_0x4e43c8['Contact']['lastName']?'\x20'+_0x4e43c8[_0xc19d('0x62')][_0xc19d('0xc3')]:''),'body':_0x4e43c8[_0xc19d('0x6f')]?_0x4e43c8[_0xc19d('0x6f')][_0xc19d('0x6c')]:_0x4e43c8['body'],'direction':_0x4e43c8[_0xc19d('0x8c')]==='out'?'A':'C','secret':_0x4e43c8['secret'],'read':_0x4e43c8['read'],'attachment':_0x4e43c8[_0xc19d('0x6f')]};})[_0xc19d('0xc4')]()};return ejs[_0xc19d('0xc5')](path[_0xc19d('0x74')](config['root'],_0xc19d('0xb0'),'views',_0xc19d('0xc6')),{'interaction':_0x3596cd})[_0xc19d('0x18')](function(_0x51b12f){var _0x1c1d03=path['join'](_0x4d7ed8,_0xc19d('0xc7')+_0x5bcb81['id']+'-'+_0x1533a0+'.pdf');var _0x28e6db={'path':_0x1c1d03,'channel':'Chat','interactionId':_0x5bcb81['id']};return pdf[_0xc19d('0xc8')](_0x51b12f,_0x28e6db);})['then'](function(){return new Promise(function(_0x28a413,_0xfd148f){zipdir(_0x4d7ed8,{'saveTo':_0xb463dd},function(_0x42c417,_0x2f6911){if(_0x42c417)return _0xfd148f(_0x42c417);return _0x28a413(_0x2f6911);});})[_0xc19d('0x18')](function(){return new BPromise(function(_0x301aa9,_0x479876){rimraf(_0x4d7ed8,function(_0x50cf7f){if(_0x50cf7f)_0x479876(_0x50cf7f);return _0x301aa9();});});})[_0xc19d('0x18')](function(){return _0x2d8ff6[_0xc19d('0x78')](_0xb463dd,_0x5a9316,function(_0x583425){if(_0x583425){logger[_0xc19d('0x1d')](_0xc19d('0xc9'),_0x583425);}else{fs[_0xc19d('0xca')](_0xb463dd);}});});});}else{return _0x2d8ff6[_0xc19d('0x21')](0xc8);}})[_0xc19d('0x20')](handleError(_0x2d8ff6,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 5a954db..c4b029b 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 _0xb852=['ChatInteraction','ChatMessage','setMaxListeners','update','remove','getUsers','setDataValue','Users','map','then','unreadMessages','length','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x134e6f,_0x2d9541){var _0x49bb7f=function(_0x10c5ce){while(--_0x10c5ce){_0x134e6f['push'](_0x134e6f['shift']());}};_0x49bb7f(++_0x2d9541);}(_0xb852,0x8e));var _0x2b85=function(_0x5f109f,_0x4fb729){_0x5f109f=_0x5f109f-0x0;var _0x215022=_0xb852[_0x5f109f];return _0x215022;};'use strict';var EventEmitter=require(_0x2b85('0x0'));var ChatInteraction=require(_0x2b85('0x1'))['db'][_0x2b85('0x2')];var ChatMessage=require('../../mysqldb')['db'][_0x2b85('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x2b85('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2b85('0x5'),'afterDestroy':_0x2b85('0x6')};function emitEvent(_0x37063e){return function(_0x5195f3,_0x50ed01,_0x3a2afd){_0x5195f3[_0x2b85('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0xf37c9e){_0x5195f3[_0x2b85('0x8')](_0x2b85('0x9'),_0xf37c9e[_0x2b85('0xa')](function(_0x27daf2){return{'id':_0x27daf2['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x5195f3['id'],'direction':'in','read':![]},'raw':!![]});})[_0x2b85('0xb')](function(_0x51c215){_0x5195f3[_0x2b85('0x8')](_0x2b85('0xc'),_0x51c215[_0x2b85('0xd')]);ChatInteractionEvents['emit'](_0x37063e+':'+_0x5195f3['id'],_0x5195f3);ChatInteractionEvents[_0x2b85('0xe')](_0x37063e,_0x5195f3);_0x3a2afd(null);})['catch'](_0x3a2afd(null));};}for(var e in events){if(events[_0x2b85('0xf')](e)){var event=events[e];ChatInteraction[_0x2b85('0x10')](e,emitEvent(event));}}module[_0x2b85('0x11')]=ChatInteractionEvents; \ No newline at end of file +var _0x84b3=['then','setDataValue','map','findAll','unreadMessages','length','emit','catch','hook','exports','events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save','update','remove','getUsers'];(function(_0x32e3af,_0x591451){var _0x5a2928=function(_0x19048b){while(--_0x19048b){_0x32e3af['push'](_0x32e3af['shift']());}};_0x5a2928(++_0x591451);}(_0x84b3,0xb5));var _0x384b=function(_0x167aba,_0x2d7711){_0x167aba=_0x167aba-0x0;var _0x4b6768=_0x84b3[_0x167aba];return _0x4b6768;};'use strict';var EventEmitter=require(_0x384b('0x0'));var ChatInteraction=require(_0x384b('0x1'))['db'][_0x384b('0x2')];var ChatMessage=require(_0x384b('0x1'))['db'][_0x384b('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x384b('0x4')](0x0);var events={'afterCreate':_0x384b('0x5'),'afterUpdate':_0x384b('0x6'),'afterDestroy':_0x384b('0x7')};function emitEvent(_0x441f7a){return function(_0x4ae894,_0x91fa80,_0x48ee3b){_0x4ae894[_0x384b('0x8')]({'attributes':['id'],'raw':!![]})[_0x384b('0x9')](function(_0x3fabbb){_0x4ae894[_0x384b('0xa')]('Users',_0x3fabbb[_0x384b('0xb')](function(_0x65e29e){return{'id':_0x65e29e['id']};}));return ChatMessage[_0x384b('0xc')]({'where':{'ChatInteractionId':_0x4ae894['id'],'direction':'in','read':![]},'raw':!![]});})[_0x384b('0x9')](function(_0x3e5f58){_0x4ae894[_0x384b('0xa')](_0x384b('0xd'),_0x3e5f58[_0x384b('0xe')]);ChatInteractionEvents[_0x384b('0xf')](_0x441f7a+':'+_0x4ae894['id'],_0x4ae894);ChatInteractionEvents[_0x384b('0xf')](_0x441f7a,_0x4ae894);_0x48ee3b(null);})[_0x384b('0x10')](_0x48ee3b(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction[_0x384b('0x11')](e,emitEvent(event));}}module[_0x384b('0x12')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index e0541a7..b691af4 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 _0xffc9=['format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','../../config/environment','./chatInteraction.attributes','exports','ChatInteraction','chat_interactions','changed'];(function(_0x5c4f8f,_0x3e68c7){var _0x1a2e41=function(_0x19af72){while(--_0x19af72){_0x5c4f8f['push'](_0x5c4f8f['shift']());}};_0x1a2e41(++_0x3e68c7);}(_0xffc9,0xc7));var _0x9ffc=function(_0x189a28,_0x496b3b){_0x189a28=_0x189a28-0x0;var _0x3fc4f0=_0xffc9[_0x189a28];return _0x3fc4f0;};'use strict';var _=require('lodash');var util=require(_0x9ffc('0x0'));var logger=require(_0x9ffc('0x1'))(_0x9ffc('0x2'));var moment=require(_0x9ffc('0x3'));var BPromise=require(_0x9ffc('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9ffc('0x5'));var attributes=require(_0x9ffc('0x6'));module[_0x9ffc('0x7')]=function(_0x4d5e10,_0x4f7a6a){return _0x4d5e10['define'](_0x9ffc('0x8'),attributes,{'tableName':_0x9ffc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x456869,_0x485959,_0x3845e3){if(_0x456869[_0x9ffc('0xa')]('closed')){_0x456869['closedAt']=moment()[_0x9ffc('0xb')](_0x9ffc('0xc'));}_0x3845e3(null,_0x456869);}},'charset':_0x9ffc('0xd'),'collate':_0x9ffc('0xe')});}; \ No newline at end of file +var _0xc64f=['changed','closedAt','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','../../config/environment','./chatInteraction.attributes','exports','define','chat_interactions'];(function(_0xa44f92,_0x4e78f2){var _0x452e6=function(_0x47f9eb){while(--_0x47f9eb){_0xa44f92['push'](_0xa44f92['shift']());}};_0x452e6(++_0x4e78f2);}(_0xc64f,0x75));var _0xfc64=function(_0xc26f0e,_0x536747){_0xc26f0e=_0xc26f0e-0x0;var _0x2b4dbe=_0xc64f[_0xc26f0e];return _0x2b4dbe;};'use strict';var _=require(_0xfc64('0x0'));var util=require(_0xfc64('0x1'));var logger=require(_0xfc64('0x2'))(_0xfc64('0x3'));var moment=require(_0xfc64('0x4'));var BPromise=require('bluebird');var rp=require(_0xfc64('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xfc64('0x6'));var attributes=require(_0xfc64('0x7'));module[_0xfc64('0x8')]=function(_0x437399,_0x4c3d2a){return _0x437399[_0xfc64('0x9')]('ChatInteraction',attributes,{'tableName':_0xfc64('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5f0ac2,_0x275434,_0x3ae0e5){if(_0x5f0ac2[_0xfc64('0xb')]('closed')){_0x5f0ac2[_0xfc64('0xc')]=moment()['format'](_0xfc64('0xd'));}_0x3ae0e5(null,_0x5f0ac2);}},'charset':_0xfc64('0xe'),'collate':_0xfc64('0xf')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index be31261..ace5a76 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 _0x0223=['then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ChatInteraction','update','body','options','raw','where','attributes','limit','UpdateChatInteraction','AddTagsToChatInteraction','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','request'];(function(_0x3b00dc,_0x5d08d2){var _0x9fde1d=function(_0x43aac0){while(--_0x43aac0){_0x3b00dc['push'](_0x3b00dc['shift']());}};_0x9fde1d(++_0x5d08d2);}(_0x0223,0xcb));var _0x3022=function(_0x1c238f,_0x36012b){_0x1c238f=_0x1c238f-0x0;var _0x344288=_0x0223[_0x1c238f];return _0x344288;};'use strict';var _=require(_0x3022('0x0'));var util=require(_0x3022('0x1'));var moment=require(_0x3022('0x2'));var BPromise=require(_0x3022('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3022('0x4'))['db'];var utils=require(_0x3022('0x5'));var logger=require(_0x3022('0x6'))('rpc');var config=require(_0x3022('0x7'));var jayson=require(_0x3022('0x8'));var client=jayson['client'][_0x3022('0x9')]({'port':0x232a});config[_0x3022('0xa')]=_[_0x3022('0xb')](config[_0x3022('0xa')],{'host':_0x3022('0xc'),'port':0x18eb});var socket=require(_0x3022('0xd'))(new Redis(config['redis']));require(_0x3022('0xe'))[_0x3022('0xf')](socket);function respondWithRpcPromise(_0x489bbc,_0x2eb0a8,_0x6f09ef){return new BPromise(function(_0x5dbbfa,_0x533953){return client[_0x3022('0x10')](_0x489bbc,_0x6f09ef)[_0x3022('0x11')](function(_0x31d43f){logger[_0x3022('0x12')](_0x3022('0x13'),_0x2eb0a8,_0x3022('0x14'));logger[_0x3022('0x15')](_0x3022('0x16'),_0x2eb0a8,'request\x20sent',JSON[_0x3022('0x17')](_0x31d43f));if(_0x31d43f[_0x3022('0x18')]){if(_0x31d43f[_0x3022('0x18')][_0x3022('0x19')]===0x1f4){logger['error'](_0x3022('0x13'),_0x2eb0a8,_0x31d43f[_0x3022('0x18')][_0x3022('0x1a')]);return _0x533953(_0x31d43f[_0x3022('0x18')][_0x3022('0x1a')]);}logger[_0x3022('0x18')]('ChatInteraction,\x20%s,\x20%s',_0x2eb0a8,_0x31d43f[_0x3022('0x18')][_0x3022('0x1a')]);return _0x5dbbfa(_0x31d43f[_0x3022('0x18')][_0x3022('0x1a')]);}else{logger['info'](_0x3022('0x13'),_0x2eb0a8,_0x3022('0x14'));_0x5dbbfa(_0x31d43f[_0x3022('0x1b')]['message']);}})[_0x3022('0x1c')](function(_0x2d04af){logger[_0x3022('0x18')](_0x3022('0x13'),_0x2eb0a8,_0x2d04af);_0x533953(_0x2d04af);});});}exports['UpdateChatInteraction']=function(_0x5a12fd){var _0x3dffaa=this;return new Promise(function(_0x182eb2,_0x33a59b){return db[_0x3022('0x1d')][_0x3022('0x1e')](_0x5a12fd[_0x3022('0x1f')],{'raw':_0x5a12fd[_0x3022('0x20')]?_0x5a12fd[_0x3022('0x20')][_0x3022('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a12fd[_0x3022('0x20')]?_0x5a12fd[_0x3022('0x20')][_0x3022('0x22')]||null:null,'attributes':_0x5a12fd[_0x3022('0x20')]?_0x5a12fd[_0x3022('0x20')][_0x3022('0x23')]||null:null,'limit':_0x5a12fd[_0x3022('0x20')]?_0x5a12fd[_0x3022('0x20')][_0x3022('0x24')]||null:null})[_0x3022('0x11')](function(_0x47ce63){logger[_0x3022('0x12')](_0x3022('0x25'),_0x5a12fd);logger[_0x3022('0x15')](_0x3022('0x25'),_0x5a12fd,JSON['stringify'](_0x47ce63));_0x182eb2(_0x47ce63);})[_0x3022('0x1c')](function(_0x23cce6){logger[_0x3022('0x18')](_0x3022('0x25'),_0x23cce6[_0x3022('0x1a')],_0x5a12fd);_0x33a59b(_0x3dffaa['error'](0x1f4,_0x23cce6[_0x3022('0x1a')]));});});};exports[_0x3022('0x26')]=function(_0x5eb071){return new Promise(function(_0x3e6dd5,_0x514ecf){return db[_0x3022('0x1d')]['find']({'where':_0x5eb071[_0x3022('0x20')]?_0x5eb071[_0x3022('0x20')][_0x3022('0x22')]||null:null})[_0x3022('0x11')](function(_0x9ecf1b){if(_0x9ecf1b){return _0x9ecf1b[_0x3022('0x27')](_0x5eb071['body'][_0x3022('0x28')],_[_0x3022('0x29')](_0x5eb071[_0x3022('0x1f')],[_0x3022('0x28'),'id'])||{});}})[_0x3022('0x2a')](function(_0x37b398){logger[_0x3022('0x12')]('AddTags',_0x5eb071);logger['debug']('AddTags',_0x5eb071,JSON['stringify'](_0x37b398));_0x3e6dd5(_0x37b398);})[_0x3022('0x1c')](function(_0x2c0afb){logger[_0x3022('0x18')](_0x3022('0x2b'),_0x2c0afb['message'],_0x5eb071);_0x514ecf(_this[_0x3022('0x18')](0x1f4,_0x2c0afb[_0x3022('0x1a')]));});});}; \ No newline at end of file +var _0x7001=['ChatInteraction','find','where','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','./chatInteraction.socket','register','request','then','info','ChatInteraction,\x20%s,\x20%s','debug','error','code','message','request\x20sent','result','catch','update','body','options','raw','attributes','limit','UpdateChatInteraction','stringify','AddTagsToChatInteraction'];(function(_0x4c3267,_0xf2b77){var _0xfa5c9=function(_0x445e6d){while(--_0x445e6d){_0x4c3267['push'](_0x4c3267['shift']());}};_0xfa5c9(++_0xf2b77);}(_0x7001,0x180));var _0x1700=function(_0x4bd9f8,_0x5b2516){_0x4bd9f8=_0x4bd9f8-0x0;var _0x4b35f9=_0x7001[_0x4bd9f8];return _0x4b35f9;};'use strict';var _=require(_0x1700('0x0'));var util=require(_0x1700('0x1'));var moment=require(_0x1700('0x2'));var BPromise=require(_0x1700('0x3'));var rs=require(_0x1700('0x4'));var fs=require('fs');var Redis=require(_0x1700('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x1700('0x6'));var logger=require(_0x1700('0x7'))(_0x1700('0x8'));var config=require(_0x1700('0x9'));var jayson=require(_0x1700('0xa'));var client=jayson[_0x1700('0xb')]['http']({'port':0x232a});config[_0x1700('0xc')]=_[_0x1700('0xd')](config[_0x1700('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1700('0xc')]));require(_0x1700('0xe'))[_0x1700('0xf')](socket);function respondWithRpcPromise(_0x3a3b6c,_0x41e28e,_0x34a811){return new BPromise(function(_0x25ca3c,_0x5aa325){return client[_0x1700('0x10')](_0x3a3b6c,_0x34a811)[_0x1700('0x11')](function(_0x532e31){logger[_0x1700('0x12')](_0x1700('0x13'),_0x41e28e,'request\x20sent');logger[_0x1700('0x14')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x41e28e,'request\x20sent',JSON['stringify'](_0x532e31));if(_0x532e31[_0x1700('0x15')]){if(_0x532e31[_0x1700('0x15')][_0x1700('0x16')]===0x1f4){logger[_0x1700('0x15')]('ChatInteraction,\x20%s,\x20%s',_0x41e28e,_0x532e31[_0x1700('0x15')][_0x1700('0x17')]);return _0x5aa325(_0x532e31[_0x1700('0x15')][_0x1700('0x17')]);}logger[_0x1700('0x15')](_0x1700('0x13'),_0x41e28e,_0x532e31[_0x1700('0x15')][_0x1700('0x17')]);return _0x25ca3c(_0x532e31[_0x1700('0x15')]['message']);}else{logger[_0x1700('0x12')](_0x1700('0x13'),_0x41e28e,_0x1700('0x18'));_0x25ca3c(_0x532e31[_0x1700('0x19')][_0x1700('0x17')]);}})[_0x1700('0x1a')](function(_0x54ecbe){logger[_0x1700('0x15')]('ChatInteraction,\x20%s,\x20%s',_0x41e28e,_0x54ecbe);_0x5aa325(_0x54ecbe);});});}exports['UpdateChatInteraction']=function(_0x4a5718){var _0x9053c5=this;return new Promise(function(_0x55f74b,_0x1c58dc){return db['ChatInteraction'][_0x1700('0x1b')](_0x4a5718[_0x1700('0x1c')],{'raw':_0x4a5718['options']?_0x4a5718[_0x1700('0x1d')][_0x1700('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4a5718['options']?_0x4a5718[_0x1700('0x1d')]['where']||null:null,'attributes':_0x4a5718[_0x1700('0x1d')]?_0x4a5718[_0x1700('0x1d')][_0x1700('0x1f')]||null:null,'limit':_0x4a5718[_0x1700('0x1d')]?_0x4a5718[_0x1700('0x1d')][_0x1700('0x20')]||null:null})['then'](function(_0x803833){logger[_0x1700('0x12')](_0x1700('0x21'),_0x4a5718);logger[_0x1700('0x14')](_0x1700('0x21'),_0x4a5718,JSON[_0x1700('0x22')](_0x803833));_0x55f74b(_0x803833);})[_0x1700('0x1a')](function(_0x43e330){logger[_0x1700('0x15')](_0x1700('0x21'),_0x43e330[_0x1700('0x17')],_0x4a5718);_0x1c58dc(_0x9053c5[_0x1700('0x15')](0x1f4,_0x43e330[_0x1700('0x17')]));});});};exports[_0x1700('0x23')]=function(_0xfbdabb){return new Promise(function(_0x5ce26c,_0x54b79a){return db[_0x1700('0x24')][_0x1700('0x25')]({'where':_0xfbdabb[_0x1700('0x1d')]?_0xfbdabb[_0x1700('0x1d')][_0x1700('0x26')]||null:null})[_0x1700('0x11')](function(_0x4e15a0){if(_0x4e15a0){return _0x4e15a0['addTags'](_0xfbdabb[_0x1700('0x1c')][_0x1700('0x27')],_['omit'](_0xfbdabb[_0x1700('0x1c')],['ids','id'])||{});}})[_0x1700('0x28')](function(_0x1f9e43){logger[_0x1700('0x12')](_0x1700('0x29'),_0xfbdabb);logger[_0x1700('0x14')](_0x1700('0x29'),_0xfbdabb,JSON[_0x1700('0x22')](_0x1f9e43));_0x5ce26c(_0x1f9e43);})[_0x1700('0x1a')](function(_0x40ea80){logger[_0x1700('0x15')]('AddTags',_0x40ea80[_0x1700('0x17')],_0xfbdabb);_0x54b79a(_this[_0x1700('0x15')](0x1f4,_0x40ea80[_0x1700('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 1884457..707819a 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 _0xfc4d=['length','chatInteraction:','./chatInteraction.events','save','remove','update','emit','removeListener','register'];(function(_0x5bf8cb,_0x4ab14e){var _0xc39bf1=function(_0x5e69f4){while(--_0x5e69f4){_0x5bf8cb['push'](_0x5bf8cb['shift']());}};_0xc39bf1(++_0x4ab14e);}(_0xfc4d,0xc8));var _0xdfc4=function(_0x1385f0,_0x5550bb){_0x1385f0=_0x1385f0-0x0;var _0x36ca00=_0xfc4d[_0x1385f0];return _0x36ca00;};'use strict';var ChatInteractionEvents=require(_0xdfc4('0x0'));var events=[_0xdfc4('0x1'),_0xdfc4('0x2'),_0xdfc4('0x3')];function createListener(_0x32e653,_0x449b9c){return function(_0x3abdf2){_0x449b9c[_0xdfc4('0x4')](_0x32e653,_0x3abdf2);};}function removeListener(_0x2884d1,_0x3ea716){return function(){ChatInteractionEvents[_0xdfc4('0x5')](_0x2884d1,_0x3ea716);};}exports[_0xdfc4('0x6')]=function(_0x5cf983){for(var _0x447526=0x0,_0x19ced9=events[_0xdfc4('0x7')];_0x447526<_0x19ced9;_0x447526++){var _0x1123c8=events[_0x447526];var _0x5cb59b=createListener(_0xdfc4('0x8')+_0x1123c8,_0x5cf983);ChatInteractionEvents['on'](_0x1123c8,_0x5cb59b);}}; \ No newline at end of file +var _0x0227=['length','chatInteraction:','save','remove','emit'];(function(_0xf6e75d,_0xc70967){var _0x27514d=function(_0xc2c6dd){while(--_0xc2c6dd){_0xf6e75d['push'](_0xf6e75d['shift']());}};_0x27514d(++_0xc70967);}(_0x0227,0x16a));var _0x7022=function(_0x304c43,_0x128e22){_0x304c43=_0x304c43-0x0;var _0x48296e=_0x0227[_0x304c43];return _0x48296e;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=[_0x7022('0x0'),_0x7022('0x1'),'update'];function createListener(_0x12d55d,_0x18b14a){return function(_0xca46ed){_0x18b14a[_0x7022('0x2')](_0x12d55d,_0xca46ed);};}function removeListener(_0x4263d1,_0x4d05e9){return function(){ChatInteractionEvents['removeListener'](_0x4263d1,_0x4d05e9);};}exports['register']=function(_0x503d2a){for(var _0x1cfc3a=0x0,_0x2776d8=events[_0x7022('0x3')];_0x1cfc3a<_0x2776d8;_0x1cfc3a++){var _0x171832=events[_0x1cfc3a];var _0x4997bb=createListener(_0x7022('0x4')+_0x171832,_0x503d2a);ChatInteractionEvents['on'](_0x171832,_0x4997bb);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index ff033e2..abc5be9 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 _0x508d=['chatinteraction:update','update','put','/:id/custom_update','customUpdate','/:id/abandon','/:id/close','close','delete','chatinteraction:destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','download','post','diskStorage','join','root','server/files/attachments/','format','now','originalname','/:id/attachment_upload','single','attachmentUpload','addMessage','/:id/tags','chat','addTags','tracked'];(function(_0x6a9549,_0x784e1b){var _0x307f2e=function(_0xdf8715){while(--_0xdf8715){_0x6a9549['push'](_0x6a9549['shift']());}};_0x307f2e(++_0x784e1b);}(_0x508d,0x1bb));var _0xd508=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x508d[_0x13b02f];return _0x12e9a6;};'use strict';var multer=require(_0xd508('0x0'));var util=require(_0xd508('0x1'));var path=require(_0xd508('0x2'));var timeout=require('connect-timeout');var express=require(_0xd508('0x3'));var router=express['Router']();var fs_extra=require(_0xd508('0x4'));var auth=require(_0xd508('0x5'));var interaction=require(_0xd508('0x6'));var config=require(_0xd508('0x7'));var controller=require('./chatInteraction.controller');router[_0xd508('0x8')]('/',auth[_0xd508('0x9')](),controller['index']);router[_0xd508('0x8')](_0xd508('0xa'),auth[_0xd508('0x9')](),controller['describe']);router[_0xd508('0x8')](_0xd508('0xb'),auth[_0xd508('0xc')](),controller[_0xd508('0xd')]);router[_0xd508('0x8')](_0xd508('0xe'),auth[_0xd508('0xc')](),controller[_0xd508('0xf')]);router[_0xd508('0x8')](_0xd508('0x10'),auth[_0xd508('0x9')](),controller[_0xd508('0x11')]);router['get'](_0xd508('0x12'),auth[_0xd508('0xc')](),controller[_0xd508('0x13')]);router[_0xd508('0x8')]('/:id/download',auth[_0xd508('0x9')](),controller[_0xd508('0x14')]);router[_0xd508('0x15')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/vidaoo',auth[_0xd508('0x9')](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0xd508('0x16')]({'destination':function(_0x47a2ad,_0x539029,_0x250e34){_0x250e34(null,path[_0xd508('0x17')](config[_0xd508('0x18')],_0xd508('0x19')));},'filename':function(_0x375854,_0x2afa3b,_0x454d85){_0x454d85(null,util[_0xd508('0x1a')]('%s-%s',Date[_0xd508('0x1b')](),_0x2afa3b[_0xd508('0x1c')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xd508('0x15')](_0xd508('0x1d'),upload[_0xd508('0x1e')]('file'),controller[_0xd508('0x1f')]);router[_0xd508('0x15')](_0xd508('0x10'),auth[_0xd508('0xc')](),controller[_0xd508('0x20')]);router[_0xd508('0x15')](_0xd508('0x21'),auth[_0xd508('0x9')](),interaction['tracked'](_0xd508('0x22'),'chatinteraction:addtags'),controller[_0xd508('0x23')]);router['put'](_0xd508('0xb'),auth['isAuthenticated'](),interaction[_0xd508('0x24')](_0xd508('0x22'),_0xd508('0x25')),controller[_0xd508('0x26')]);router[_0xd508('0x27')](_0xd508('0x28'),controller[_0xd508('0x29')]);router[_0xd508('0x27')](_0xd508('0x2a'),auth[_0xd508('0xc')](),controller['abandon']);router[_0xd508('0x27')](_0xd508('0x2b'),controller[_0xd508('0x2c')]);router[_0xd508('0x2d')](_0xd508('0xb'),auth[_0xd508('0x9')](),interaction[_0xd508('0x24')]('chat',_0xd508('0x2e')),controller['destroy']);router[_0xd508('0x2d')]('/:id/tags',auth['isAuthenticated'](),controller['removeTags']);module[_0xd508('0x2f')]=router; \ No newline at end of file +var _0xd476=['multer','path','connect-timeout','express','Router','../../components/auth/service','./chatInteraction.controller','get','isAuthenticated','/describe','describe','/:id','isChatInteractionAuthorized','/:id/attachment_download','getMessages','/:id/my_messages','/:id/download','download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','join','root','format','%s-%s','originalname','replace','single','attachmentUpload','/:id/messages','addMessage','/:id/tags','tracked','chatinteraction:addtags','addTags','chat','chatinteraction:update','update','put','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','close','chatinteraction:destroy','destroy','delete','removeTags'];(function(_0x145b3c,_0x31ea4a){var _0x1b6e36=function(_0xfccee6){while(--_0xfccee6){_0x145b3c['push'](_0x145b3c['shift']());}};_0x1b6e36(++_0x31ea4a);}(_0xd476,0xff));var _0x6d47=function(_0x4a627b,_0x1dcadf){_0x4a627b=_0x4a627b-0x0;var _0x17b024=_0xd476[_0x4a627b];return _0x17b024;};'use strict';var multer=require(_0x6d47('0x0'));var util=require('util');var path=require(_0x6d47('0x1'));var timeout=require(_0x6d47('0x2'));var express=require(_0x6d47('0x3'));var router=express[_0x6d47('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6d47('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6d47('0x6'));router[_0x6d47('0x7')]('/',auth[_0x6d47('0x8')](),controller['index']);router[_0x6d47('0x7')](_0x6d47('0x9'),auth[_0x6d47('0x8')](),controller[_0x6d47('0xa')]);router[_0x6d47('0x7')](_0x6d47('0xb'),auth[_0x6d47('0xc')](),controller['show']);router[_0x6d47('0x7')](_0x6d47('0xd'),auth[_0x6d47('0xc')](),controller['attachmentDownload']);router[_0x6d47('0x7')]('/:id/messages',auth[_0x6d47('0x8')](),controller[_0x6d47('0xe')]);router[_0x6d47('0x7')](_0x6d47('0xf'),auth['isChatInteractionAuthorized'](),controller['getMyMessages']);router[_0x6d47('0x7')](_0x6d47('0x10'),auth['isAuthenticated'](),controller[_0x6d47('0x11')]);router[_0x6d47('0x12')]('/',auth['isAuthenticated'](),controller[_0x6d47('0x13')]);router[_0x6d47('0x12')](_0x6d47('0x14'),auth[_0x6d47('0x8')](),controller[_0x6d47('0x15')]);var upload=multer({'storage':multer[_0x6d47('0x16')]({'destination':function(_0xaa072f,_0x2aecee,_0x24749b){_0x24749b(null,path[_0x6d47('0x17')](config[_0x6d47('0x18')],'server/files/attachments/'));},'filename':function(_0x3fe4a8,_0x1201fc,_0x120777){_0x120777(null,util[_0x6d47('0x19')](_0x6d47('0x1a'),Date['now'](),_0x1201fc[_0x6d47('0x1b')][_0x6d47('0x1c')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x6d47('0x12')]('/:id/attachment_upload',upload[_0x6d47('0x1d')]('file'),controller[_0x6d47('0x1e')]);router[_0x6d47('0x12')](_0x6d47('0x1f'),auth[_0x6d47('0xc')](),controller[_0x6d47('0x20')]);router[_0x6d47('0x12')](_0x6d47('0x21'),auth['isAuthenticated'](),interaction[_0x6d47('0x22')]('chat',_0x6d47('0x23')),controller[_0x6d47('0x24')]);router['put'](_0x6d47('0xb'),auth[_0x6d47('0x8')](),interaction[_0x6d47('0x22')](_0x6d47('0x25'),_0x6d47('0x26')),controller[_0x6d47('0x27')]);router[_0x6d47('0x28')](_0x6d47('0x29'),controller[_0x6d47('0x2a')]);router[_0x6d47('0x28')](_0x6d47('0x2b'),auth[_0x6d47('0xc')](),controller[_0x6d47('0x2c')]);router[_0x6d47('0x28')](_0x6d47('0x2d'),controller[_0x6d47('0x2e')]);router['delete'](_0x6d47('0xb'),auth[_0x6d47('0x8')](),interaction['tracked']('chat',_0x6d47('0x2f')),controller[_0x6d47('0x30')]);router[_0x6d47('0x31')](_0x6d47('0x21'),auth[_0x6d47('0x8')](),controller[_0x6d47('0x32')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 9e67d20..04c0a4f 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 _0x2e88=['TEXT','BOOLEAN','INTEGER','sequelize'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x2e88,0x177));var _0x82e8=function(_0x4c6d6f,_0x291557){_0x4c6d6f=_0x4c6d6f-0x0;var _0x2d4478=_0x2e88[_0x4c6d6f];return _0x2d4478;};'use strict';var Sequelize=require(_0x82e8('0x0'));module['exports']={'body':{'type':Sequelize[_0x82e8('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x82e8('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x82e8('0x3')]}}; \ No newline at end of file +var _0x0043=['exports','TEXT','medium','BOOLEAN','INTEGER','sequelize'];(function(_0x87b0ff,_0x314389){var _0x3bc0b2=function(_0x41682b){while(--_0x41682b){_0x87b0ff['push'](_0x87b0ff['shift']());}};_0x3bc0b2(++_0x314389);}(_0x0043,0x14f));var _0x3004=function(_0x65c50e,_0x1aa926){_0x65c50e=_0x65c50e-0x0;var _0x4573e7=_0x0043[_0x65c50e];return _0x4573e7;};'use strict';var Sequelize=require(_0x3004('0x0'));module[_0x3004('0x1')]={'body':{'type':Sequelize[_0x3004('0x2')](_0x3004('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x3004('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x3004('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 87b2fb0..153fbef 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 _0xcb63=['rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','order','sort','where','filter','merge','VIRTUAL','options','ChatInternalMessage','then','includeAll','findAll','rows','catch','show','params','keys','include','find','create','body','destroy','describe','get','messages','lastMessageAt','createdAt','lastMessage','format','getUsers','User','agent','admin','user','fullname','role','userpic','internal','allowmessenger','-online','VoiceQueues','UserProfileSection','Agents','userProfileId','autoAssociation','isEmpty','push','FromId','ToId','read','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','redis','./chatInternalMessage.socket','register','sendStatus','status','end','json','offset','undefined','count','Content-Range','apply','reject','save','update','stack','name','send','index','map'];(function(_0x159f22,_0x3f5c6f){var _0x341060=function(_0x273d94){while(--_0x273d94){_0x159f22['push'](_0x159f22['shift']());}};_0x341060(++_0x3f5c6f);}(_0xcb63,0x1c3));var _0x3cb6=function(_0x23110e,_0x307fbe){_0x23110e=_0x23110e-0x0;var _0x36a0cc=_0xcb63[_0x23110e];return _0x36a0cc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3cb6('0x0'));var zipdir=require(_0x3cb6('0x1'));var jsonpatch=require(_0x3cb6('0x2'));var rp=require(_0x3cb6('0x3'));var moment=require(_0x3cb6('0x4'));var BPromise=require(_0x3cb6('0x5'));var Mustache=require(_0x3cb6('0x6'));var util=require('util');var path=require(_0x3cb6('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3cb6('0x8'));var _=require(_0x3cb6('0x9'));var squel=require(_0x3cb6('0xa'));var crypto=require(_0x3cb6('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3cb6('0xc'));var Papa=require(_0x3cb6('0xd'));var Redis=require('ioredis');var authService=require(_0x3cb6('0xe'));var qs=require(_0x3cb6('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3cb6('0x10'));var utils=require(_0x3cb6('0x11'));var config=require(_0x3cb6('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x3cb6('0x13')]=_['defaults'](config[_0x3cb6('0x13')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3cb6('0x14'))[_0x3cb6('0x15')](socket);function respondWithStatusCode(_0x1ef43b,_0x4c355d){_0x4c355d=_0x4c355d||0xcc;return function(_0x44e3e6){if(_0x44e3e6){return _0x1ef43b[_0x3cb6('0x16')](_0x4c355d);}return _0x1ef43b[_0x3cb6('0x17')](_0x4c355d)[_0x3cb6('0x18')]();};}function respondWithResult(_0x2418ce,_0x41844d){_0x41844d=_0x41844d||0xc8;return function(_0x27dee8){if(_0x27dee8){return _0x2418ce[_0x3cb6('0x17')](_0x41844d)[_0x3cb6('0x19')](_0x27dee8);}};}function respondWithFilteredResult(_0x311892,_0x398d07){return function(_0xec94b8){if(_0xec94b8){var _0x5d9694=typeof _0x398d07[_0x3cb6('0x1a')]===_0x3cb6('0x1b')&&typeof _0x398d07['limit']==='undefined';var _0x24fd4a=_0xec94b8[_0x3cb6('0x1c')];var _0x218af5=_0x5d9694?0x0:_0x398d07[_0x3cb6('0x1a')];var _0x490f35=_0x5d9694?_0xec94b8[_0x3cb6('0x1c')]:_0x398d07['offset']+_0x398d07['limit'];var _0x3f2cd9;if(_0x490f35>=_0x24fd4a){_0x490f35=_0x24fd4a;_0x3f2cd9=0xc8;}else{_0x3f2cd9=0xce;}_0x311892[_0x3cb6('0x17')](_0x3f2cd9);return _0x311892['set'](_0x3cb6('0x1d'),_0x218af5+'-'+_0x490f35+'/'+_0x24fd4a)[_0x3cb6('0x19')](_0xec94b8);}return null;};}function patchUpdates(_0x4bfc8b){return function(_0x59dc42){try{jsonpatch[_0x3cb6('0x1e')](_0x59dc42,_0x4bfc8b,!![]);}catch(_0x1cfb1c){return BPromise[_0x3cb6('0x1f')](_0x1cfb1c);}return _0x59dc42[_0x3cb6('0x20')]();};}function saveUpdates(_0x82a5ff,_0x1c4161){return function(_0x532fa5){if(_0x532fa5){return _0x532fa5[_0x3cb6('0x21')](_0x82a5ff)['then'](function(_0x18def1){return _0x18def1;});}return null;};}function removeEntity(_0x3d6682,_0x397205){return function(_0x290ed7){if(_0x290ed7){return _0x290ed7['destroy']()['then'](function(){_0x3d6682[_0x3cb6('0x17')](0xcc)[_0x3cb6('0x18')]();});}};}function handleEntityNotFound(_0x10d381,_0x3c4102){return function(_0x3c9211){if(!_0x3c9211){_0x10d381['sendStatus'](0x194);}return _0x3c9211;};}function handleError(_0x3d2d79,_0x1eec9e){_0x1eec9e=_0x1eec9e||0x1f4;return function(_0x5e5178){logger['error'](_0x5e5178[_0x3cb6('0x22')]);if(_0x5e5178[_0x3cb6('0x23')]){delete _0x5e5178[_0x3cb6('0x23')];}_0x3d2d79[_0x3cb6('0x17')](_0x1eec9e)[_0x3cb6('0x24')](_0x5e5178);};}exports[_0x3cb6('0x25')]=function(_0x56560d,_0x450bf3){var _0x583d5a={},_0x13ec83={},_0x475fcb={'count':0x0,'rows':[]};var _0x51f409=_[_0x3cb6('0x26')](db['ChatInternalMessage'][_0x3cb6('0x27')],function(_0x3b3ccd){return{'name':_0x3b3ccd['fieldName'],'type':_0x3b3ccd[_0x3cb6('0x28')][_0x3cb6('0x29')]};});_0x13ec83[_0x3cb6('0x2a')]=_['map'](_0x51f409,_0x3cb6('0x23'));_0x13ec83[_0x3cb6('0x2b')]=_['keys'](_0x56560d[_0x3cb6('0x2b')]);_0x13ec83[_0x3cb6('0x2c')]=_[_0x3cb6('0x2d')](_0x13ec83[_0x3cb6('0x2a')],_0x13ec83[_0x3cb6('0x2b')]);_0x583d5a[_0x3cb6('0x2e')]=_['intersection'](_0x13ec83['model'],qs[_0x3cb6('0x2f')](_0x56560d[_0x3cb6('0x2b')][_0x3cb6('0x2f')]));_0x583d5a[_0x3cb6('0x2e')]=_0x583d5a[_0x3cb6('0x2e')][_0x3cb6('0x30')]?_0x583d5a[_0x3cb6('0x2e')]:_0x13ec83[_0x3cb6('0x2a')];if(!_0x56560d[_0x3cb6('0x2b')]['hasOwnProperty']('nolimit')){_0x583d5a['limit']=qs['limit'](_0x56560d[_0x3cb6('0x2b')]['limit']);_0x583d5a[_0x3cb6('0x1a')]=qs[_0x3cb6('0x1a')](_0x56560d['query'][_0x3cb6('0x1a')]);}_0x583d5a[_0x3cb6('0x31')]=qs['sort'](_0x56560d[_0x3cb6('0x2b')][_0x3cb6('0x32')]);_0x583d5a[_0x3cb6('0x33')]=qs['filters'](_['pick'](_0x56560d['query'],_0x13ec83[_0x3cb6('0x2c')]),_0x51f409);if(_0x56560d[_0x3cb6('0x2b')][_0x3cb6('0x34')]){_0x583d5a[_0x3cb6('0x33')]=_[_0x3cb6('0x35')](_0x583d5a['where'],{'$or':_['map'](_0x51f409,function(_0x57b219){if(_0x57b219[_0x3cb6('0x28')]!==_0x3cb6('0x36')){var _0x789a0c={};_0x789a0c[_0x57b219[_0x3cb6('0x23')]]={'$like':'%'+_0x56560d[_0x3cb6('0x2b')][_0x3cb6('0x34')]+'%'};return _0x789a0c;}})});}_0x583d5a=_['merge']({},_0x583d5a,_0x56560d[_0x3cb6('0x37')]);var _0x2c04c2={'where':_0x583d5a[_0x3cb6('0x33')]};return db[_0x3cb6('0x38')][_0x3cb6('0x1c')](_0x2c04c2)[_0x3cb6('0x39')](function(_0x50f403){_0x475fcb[_0x3cb6('0x1c')]=_0x50f403;if(_0x56560d[_0x3cb6('0x2b')][_0x3cb6('0x3a')]){_0x583d5a['include']=[{'all':!![]}];}return db[_0x3cb6('0x38')][_0x3cb6('0x3b')](_0x583d5a);})[_0x3cb6('0x39')](function(_0x5d9b32){_0x475fcb[_0x3cb6('0x3c')]=_0x5d9b32;return _0x475fcb;})[_0x3cb6('0x39')](respondWithFilteredResult(_0x450bf3,_0x583d5a))[_0x3cb6('0x3d')](handleError(_0x450bf3,null));};exports[_0x3cb6('0x3e')]=function(_0x24b144,_0x3165b4){var _0x49d24f={'raw':!![],'where':{'id':_0x24b144[_0x3cb6('0x3f')]['id']}},_0x4f00ba={};_0x4f00ba[_0x3cb6('0x2a')]=_[_0x3cb6('0x40')](db[_0x3cb6('0x38')][_0x3cb6('0x27')]);_0x4f00ba['query']=_['keys'](_0x24b144[_0x3cb6('0x2b')]);_0x4f00ba[_0x3cb6('0x2c')]=_[_0x3cb6('0x2d')](_0x4f00ba[_0x3cb6('0x2a')],_0x4f00ba[_0x3cb6('0x2b')]);_0x49d24f[_0x3cb6('0x2e')]=_[_0x3cb6('0x2d')](_0x4f00ba[_0x3cb6('0x2a')],qs[_0x3cb6('0x2f')](_0x24b144[_0x3cb6('0x2b')][_0x3cb6('0x2f')]));_0x49d24f[_0x3cb6('0x2e')]=_0x49d24f['attributes']['length']?_0x49d24f[_0x3cb6('0x2e')]:_0x4f00ba[_0x3cb6('0x2a')];if(_0x24b144[_0x3cb6('0x2b')]['includeAll']){_0x49d24f[_0x3cb6('0x41')]=[{'all':!![]}];}_0x49d24f=_[_0x3cb6('0x35')]({},_0x49d24f,_0x24b144[_0x3cb6('0x37')]);return db[_0x3cb6('0x38')][_0x3cb6('0x42')](_0x49d24f)[_0x3cb6('0x39')](handleEntityNotFound(_0x3165b4,null))[_0x3cb6('0x39')](respondWithResult(_0x3165b4,null))[_0x3cb6('0x3d')](handleError(_0x3165b4,null));};exports[_0x3cb6('0x43')]=function(_0x1cc789,_0x57d7c0){return db[_0x3cb6('0x38')]['create'](_0x1cc789[_0x3cb6('0x44')],{})[_0x3cb6('0x39')](respondWithResult(_0x57d7c0,0xc9))['catch'](handleError(_0x57d7c0,null));};exports['update']=function(_0x4f6213,_0x339b73){if(_0x4f6213['body']['id']){delete _0x4f6213['body']['id'];}return db[_0x3cb6('0x38')][_0x3cb6('0x42')]({'where':{'id':_0x4f6213[_0x3cb6('0x3f')]['id']}})[_0x3cb6('0x39')](handleEntityNotFound(_0x339b73,null))[_0x3cb6('0x39')](saveUpdates(_0x4f6213[_0x3cb6('0x44')],null))[_0x3cb6('0x39')](respondWithResult(_0x339b73,null))['catch'](handleError(_0x339b73,null));};exports[_0x3cb6('0x45')]=function(_0x16ab50,_0x497dcb){return db[_0x3cb6('0x38')][_0x3cb6('0x42')]({'where':{'id':_0x16ab50[_0x3cb6('0x3f')]['id']}})[_0x3cb6('0x39')](handleEntityNotFound(_0x497dcb,null))['then'](removeEntity(_0x497dcb,null))[_0x3cb6('0x3d')](handleError(_0x497dcb,null));};exports['describe']=function(_0x4b7515,_0x55f11b){return db[_0x3cb6('0x38')][_0x3cb6('0x46')]()[_0x3cb6('0x39')](respondWithResult(_0x55f11b,null))[_0x3cb6('0x3d')](handleError(_0x55f11b,null));};function wrapUser(_0x5b73e8){return function(_0x7cacea){var _0x28fceb=_0x5b73e8[_0x3cb6('0x47')]({'plain':!![]});_0x28fceb[_0x3cb6('0x48')]=[];if(_0x7cacea){_0x28fceb[_0x3cb6('0x49')]=_0x7cacea[_0x3cb6('0x4a')];_0x28fceb[_0x3cb6('0x4b')]=_0x7cacea;}else{_0x28fceb['lastMessageAt']=moment(0x0)[_0x3cb6('0x4c')]('YYYY-MM-DD\x20HH:mm:ss');_0x28fceb[_0x3cb6('0x4b')]={};}return _0x28fceb;};}exports[_0x3cb6('0x4d')]=function(_0x2ad28f,_0x5d91aa,_0x509ae5){var _0x5b1c47=[];return db[_0x3cb6('0x4e')]['findAll']({'where':{'role':[_0x3cb6('0x4f'),_0x3cb6('0x50'),_0x3cb6('0x51')]},'attributes':['id',_0x3cb6('0x52'),_0x3cb6('0x23'),_0x3cb6('0x53'),_0x3cb6('0x54'),_0x3cb6('0x55'),'online','lastLoginAt',_0x3cb6('0x56'),'showWebBar'],'order':qs[_0x3cb6('0x32')](_0x3cb6('0x57')),'include':[{'model':db['VoiceQueue'],'as':_0x3cb6('0x58'),'attributes':['id',_0x3cb6('0x23'),_0x3cb6('0x28')],'through':{'attributes':[]}}]})[_0x3cb6('0x39')](function(_0x298f1f){if(_0x298f1f){var _0x401168=_0x2ad28f[_0x3cb6('0x51')]['get']({'plain':!![]});if(!_0x401168)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x401168[_0x3cb6('0x53')]===_0x3cb6('0x51')){return db[_0x3cb6('0x59')]['find']({'where':{'name':_0x3cb6('0x5a'),'userProfileId':_0x401168[_0x3cb6('0x5b')]},'raw':!![]})[_0x3cb6('0x39')](function(_0xc41c51){if(_0xc41c51){if(_0xc41c51[_0x3cb6('0x5c')]===0x0){return db['UserProfileResource'][_0x3cb6('0x3b')]({'where':{'sectionId':_0xc41c51['id']},'raw':!![]})[_0x3cb6('0x39')](function(_0x32dbd7){var _0x46815a=[];if(_[_0x3cb6('0x5d')](_0x32dbd7)){_0x46815a=_[_0x3cb6('0x34')](_0x298f1f,function(_0x4a7032){if(_0x4a7032[_0x3cb6('0x53')]!==_0x3cb6('0x4f')){return _0x4a7032;}});return _0x46815a;}else{for(var _0x43e48c=0x0;_0x43e48c<_0x298f1f[_0x3cb6('0x30')];_0x43e48c++){var _0x5dc268=_0x298f1f[_0x43e48c];if(_0x5dc268['role']===_0x3cb6('0x4f')){var _0x8dfaef=_['find'](_0x32dbd7,function(_0x4b7682){return _0x4b7682['resourceId']===_0x5dc268['id'];});if(_0x8dfaef)_0x46815a['push'](_0x5dc268);}else{_0x46815a['push'](_0x5dc268);}}return _0x46815a;}});}else{return _0x298f1f;}}else{var _0xce73d6=_[_0x3cb6('0x34')](_0x298f1f,function(_0x232e27){if(_0x232e27[_0x3cb6('0x53')]!==_0x3cb6('0x4f')){return _0x232e27;}});return _0xce73d6;}});}else{return _0x298f1f;}}})[_0x3cb6('0x39')](function(_0x1e71d4){var _0x54b3bd=[];if(_0x1e71d4){_0x5b1c47=_0x1e71d4;for(var _0x5d243d=0x0;_0x5d243d<_0x1e71d4[_0x3cb6('0x30')];_0x5d243d+=0x1){_0x5b1c47[_0x5d243d][_0x3cb6('0x48')]=[];_0x54b3bd[_0x3cb6('0x5e')](db['ChatInternalMessage'][_0x3cb6('0x42')]({'where':{'FromId':[_0x2ad28f[_0x3cb6('0x51')]['id'],_0x1e71d4[_0x5d243d]['id']],'ToId':[_0x2ad28f['user']['id'],_0x1e71d4[_0x5d243d]['id']],'ChatGroupId':null},'attributes':['id',_0x3cb6('0x4a'),_0x3cb6('0x5f'),_0x3cb6('0x60'),_0x3cb6('0x61'),_0x3cb6('0x44')],'order':qs['sort']('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0x3cb6('0x39')](wrapUser(_0x1e71d4[_0x5d243d])));}return BPromise['all'](_0x54b3bd);}return[];})[_0x3cb6('0x39')](function(_0x4ac02b){return{'rows':_0x4ac02b,'count':_0x4ac02b[_0x3cb6('0x30')]};})['then'](respondWithResult(_0x5d91aa,null))[_0x3cb6('0x3d')](handleError(_0x5d91aa,null));}; \ No newline at end of file +var _0xf18e=['find','catch','create','body','params','describe','messages','createdAt','lastMessage','lastMessageAt','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','user','fullname','role','internal','online','lastLoginAt','allowmessenger','-online','VoiceQueue','VoiceQueues','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','UserProfileResource','findAll','isEmpty','resourceId','push','ToId','read','-createdAt','all','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatInternalMessage.socket','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','destroy','error','stack','name','send','map','ChatInternalMessage','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','merge','VIRTUAL','options','where','includeAll','include','then','show','rawAttributes'];(function(_0x29ae4e,_0x377359){var _0xc2dcf=function(_0x4e6135){while(--_0x4e6135){_0x29ae4e['push'](_0x29ae4e['shift']());}};_0xc2dcf(++_0x377359);}(_0xf18e,0x1da));var _0xef18=function(_0x1f55f3,_0xac0628){_0x1f55f3=_0x1f55f3-0x0;var _0x456d70=_0xf18e[_0x1f55f3];return _0x456d70;};'use strict';var emlformat=require(_0xef18('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xef18('0x1'));var jsonpatch=require(_0xef18('0x2'));var rp=require('request-promise');var moment=require(_0xef18('0x3'));var BPromise=require(_0xef18('0x4'));var Mustache=require('mustache');var util=require(_0xef18('0x5'));var path=require(_0xef18('0x6'));var sox=require(_0xef18('0x7'));var csv=require(_0xef18('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xef18('0x9'));var _=require(_0xef18('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xef18('0xb'));var deskjs=require(_0xef18('0xc'));var toCsv=require(_0xef18('0x8'));var querystring=require(_0xef18('0xd'));var Papa=require(_0xef18('0xe'));var Redis=require(_0xef18('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xef18('0x10'));var as=require(_0xef18('0x11'));var hardwareService=require(_0xef18('0x12'));var logger=require(_0xef18('0x13'))(_0xef18('0x14'));var utils=require(_0xef18('0x15'));var config=require(_0xef18('0x16'));var licenseUtil=require(_0xef18('0x17'));var db=require(_0xef18('0x18'))['db'];config[_0xef18('0x19')]=_[_0xef18('0x1a')](config[_0xef18('0x19')],{'host':_0xef18('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xef18('0x19')]));require(_0xef18('0x1c'))['register'](socket);function respondWithStatusCode(_0x5c6892,_0x3cd668){_0x3cd668=_0x3cd668||0xcc;return function(_0x3b1195){if(_0x3b1195){return _0x5c6892[_0xef18('0x1d')](_0x3cd668);}return _0x5c6892['status'](_0x3cd668)[_0xef18('0x1e')]();};}function respondWithResult(_0x47875f,_0x3d3cc8){_0x3d3cc8=_0x3d3cc8||0xc8;return function(_0x2759fe){if(_0x2759fe){return _0x47875f[_0xef18('0x1f')](_0x3d3cc8)[_0xef18('0x20')](_0x2759fe);}};}function respondWithFilteredResult(_0x5dae14,_0x10d234){return function(_0x41b265){if(_0x41b265){var _0x19877d=typeof _0x10d234[_0xef18('0x21')]===_0xef18('0x22')&&typeof _0x10d234[_0xef18('0x23')]===_0xef18('0x22');var _0x3cf77b=_0x41b265['count'];var _0x299bd9=_0x19877d?0x0:_0x10d234[_0xef18('0x21')];var _0x5cb8ac=_0x19877d?_0x41b265[_0xef18('0x24')]:_0x10d234[_0xef18('0x21')]+_0x10d234[_0xef18('0x23')];var _0x2e556a;if(_0x5cb8ac>=_0x3cf77b){_0x5cb8ac=_0x3cf77b;_0x2e556a=0xc8;}else{_0x2e556a=0xce;}_0x5dae14[_0xef18('0x1f')](_0x2e556a);return _0x5dae14['set'](_0xef18('0x25'),_0x299bd9+'-'+_0x5cb8ac+'/'+_0x3cf77b)[_0xef18('0x20')](_0x41b265);}return null;};}function patchUpdates(_0x2130f1){return function(_0x3bae8a){try{jsonpatch[_0xef18('0x26')](_0x3bae8a,_0x2130f1,!![]);}catch(_0x754bbe){return BPromise['reject'](_0x754bbe);}return _0x3bae8a[_0xef18('0x27')]();};}function saveUpdates(_0x232546,_0x4f12fb){return function(_0x61b15e){if(_0x61b15e){return _0x61b15e[_0xef18('0x28')](_0x232546)['then'](function(_0xaf9f64){return _0xaf9f64;});}return null;};}function removeEntity(_0x1b4efb,_0x544557){return function(_0x2042c6){if(_0x2042c6){return _0x2042c6[_0xef18('0x29')]()['then'](function(){_0x1b4efb[_0xef18('0x1f')](0xcc)[_0xef18('0x1e')]();});}};}function handleEntityNotFound(_0x4bf77a,_0x545d85){return function(_0x361d26){if(!_0x361d26){_0x4bf77a[_0xef18('0x1d')](0x194);}return _0x361d26;};}function handleError(_0x1d80e6,_0x4f0912){_0x4f0912=_0x4f0912||0x1f4;return function(_0x13aba8){logger[_0xef18('0x2a')](_0x13aba8[_0xef18('0x2b')]);if(_0x13aba8[_0xef18('0x2c')]){delete _0x13aba8[_0xef18('0x2c')];}_0x1d80e6[_0xef18('0x1f')](_0x4f0912)[_0xef18('0x2d')](_0x13aba8);};}exports['index']=function(_0x539a01,_0x46d49c){var _0x5a2f7f={},_0x218325={},_0xb09aa8={'count':0x0,'rows':[]};var _0x3e118d=_[_0xef18('0x2e')](db[_0xef18('0x2f')]['rawAttributes'],function(_0x47c4ab){return{'name':_0x47c4ab['fieldName'],'type':_0x47c4ab[_0xef18('0x30')]['key']};});_0x218325[_0xef18('0x31')]=_['map'](_0x3e118d,_0xef18('0x2c'));_0x218325[_0xef18('0x32')]=_[_0xef18('0x33')](_0x539a01['query']);_0x218325[_0xef18('0x34')]=_[_0xef18('0x35')](_0x218325[_0xef18('0x31')],_0x218325[_0xef18('0x32')]);_0x5a2f7f[_0xef18('0x36')]=_[_0xef18('0x35')](_0x218325[_0xef18('0x31')],qs[_0xef18('0x37')](_0x539a01[_0xef18('0x32')][_0xef18('0x37')]));_0x5a2f7f[_0xef18('0x36')]=_0x5a2f7f[_0xef18('0x36')][_0xef18('0x38')]?_0x5a2f7f['attributes']:_0x218325['model'];if(!_0x539a01['query'][_0xef18('0x39')](_0xef18('0x3a'))){_0x5a2f7f[_0xef18('0x23')]=qs['limit'](_0x539a01['query']['limit']);_0x5a2f7f[_0xef18('0x21')]=qs[_0xef18('0x21')](_0x539a01[_0xef18('0x32')][_0xef18('0x21')]);}_0x5a2f7f['order']=qs[_0xef18('0x3b')](_0x539a01[_0xef18('0x32')][_0xef18('0x3b')]);_0x5a2f7f['where']=qs[_0xef18('0x34')](_[_0xef18('0x3c')](_0x539a01[_0xef18('0x32')],_0x218325[_0xef18('0x34')]),_0x3e118d);if(_0x539a01['query'][_0xef18('0x3d')]){_0x5a2f7f['where']=_[_0xef18('0x3e')](_0x5a2f7f['where'],{'$or':_[_0xef18('0x2e')](_0x3e118d,function(_0x256519){if(_0x256519['type']!==_0xef18('0x3f')){var _0x3161f0={};_0x3161f0[_0x256519[_0xef18('0x2c')]]={'$like':'%'+_0x539a01[_0xef18('0x32')][_0xef18('0x3d')]+'%'};return _0x3161f0;}})});}_0x5a2f7f=_[_0xef18('0x3e')]({},_0x5a2f7f,_0x539a01[_0xef18('0x40')]);var _0x226e14={'where':_0x5a2f7f[_0xef18('0x41')]};return db[_0xef18('0x2f')][_0xef18('0x24')](_0x226e14)['then'](function(_0x1cad7f){_0xb09aa8[_0xef18('0x24')]=_0x1cad7f;if(_0x539a01['query'][_0xef18('0x42')]){_0x5a2f7f[_0xef18('0x43')]=[{'all':!![]}];}return db[_0xef18('0x2f')]['findAll'](_0x5a2f7f);})[_0xef18('0x44')](function(_0x409163){_0xb09aa8['rows']=_0x409163;return _0xb09aa8;})[_0xef18('0x44')](respondWithFilteredResult(_0x46d49c,_0x5a2f7f))['catch'](handleError(_0x46d49c,null));};exports[_0xef18('0x45')]=function(_0x116441,_0x14d366){var _0x4bec95={'raw':!![],'where':{'id':_0x116441['params']['id']}},_0x46a76a={};_0x46a76a[_0xef18('0x31')]=_[_0xef18('0x33')](db[_0xef18('0x2f')][_0xef18('0x46')]);_0x46a76a['query']=_['keys'](_0x116441[_0xef18('0x32')]);_0x46a76a['filters']=_[_0xef18('0x35')](_0x46a76a[_0xef18('0x31')],_0x46a76a[_0xef18('0x32')]);_0x4bec95[_0xef18('0x36')]=_['intersection'](_0x46a76a['model'],qs[_0xef18('0x37')](_0x116441[_0xef18('0x32')][_0xef18('0x37')]));_0x4bec95['attributes']=_0x4bec95[_0xef18('0x36')]['length']?_0x4bec95['attributes']:_0x46a76a[_0xef18('0x31')];if(_0x116441[_0xef18('0x32')][_0xef18('0x42')]){_0x4bec95[_0xef18('0x43')]=[{'all':!![]}];}_0x4bec95=_[_0xef18('0x3e')]({},_0x4bec95,_0x116441[_0xef18('0x40')]);return db['ChatInternalMessage'][_0xef18('0x47')](_0x4bec95)[_0xef18('0x44')](handleEntityNotFound(_0x14d366,null))[_0xef18('0x44')](respondWithResult(_0x14d366,null))[_0xef18('0x48')](handleError(_0x14d366,null));};exports[_0xef18('0x49')]=function(_0x37442c,_0x338b16){return db[_0xef18('0x2f')][_0xef18('0x49')](_0x37442c['body'],{})[_0xef18('0x44')](respondWithResult(_0x338b16,0xc9))[_0xef18('0x48')](handleError(_0x338b16,null));};exports[_0xef18('0x28')]=function(_0x41dedf,_0x4a8208){if(_0x41dedf[_0xef18('0x4a')]['id']){delete _0x41dedf[_0xef18('0x4a')]['id'];}return db[_0xef18('0x2f')][_0xef18('0x47')]({'where':{'id':_0x41dedf[_0xef18('0x4b')]['id']}})[_0xef18('0x44')](handleEntityNotFound(_0x4a8208,null))[_0xef18('0x44')](saveUpdates(_0x41dedf[_0xef18('0x4a')],null))[_0xef18('0x44')](respondWithResult(_0x4a8208,null))[_0xef18('0x48')](handleError(_0x4a8208,null));};exports['destroy']=function(_0x1609ff,_0x3e3e25){return db['ChatInternalMessage'][_0xef18('0x47')]({'where':{'id':_0x1609ff['params']['id']}})[_0xef18('0x44')](handleEntityNotFound(_0x3e3e25,null))['then'](removeEntity(_0x3e3e25,null))[_0xef18('0x48')](handleError(_0x3e3e25,null));};exports[_0xef18('0x4c')]=function(_0x3158bc,_0x2d7260){return db[_0xef18('0x2f')][_0xef18('0x4c')]()[_0xef18('0x44')](respondWithResult(_0x2d7260,null))['catch'](handleError(_0x2d7260,null));};function wrapUser(_0x26897a){return function(_0x47515e){var _0x751941=_0x26897a['get']({'plain':!![]});_0x751941[_0xef18('0x4d')]=[];if(_0x47515e){_0x751941['lastMessageAt']=_0x47515e[_0xef18('0x4e')];_0x751941[_0xef18('0x4f')]=_0x47515e;}else{_0x751941[_0xef18('0x50')]=moment(0x0)[_0xef18('0x51')](_0xef18('0x52'));_0x751941[_0xef18('0x4f')]={};}return _0x751941;};}exports[_0xef18('0x53')]=function(_0x5d8dca,_0x199f3f,_0x691456){var _0x2b8baf=[];return db[_0xef18('0x54')]['findAll']({'where':{'role':[_0xef18('0x55'),'admin',_0xef18('0x56')]},'attributes':['id',_0xef18('0x57'),'name',_0xef18('0x58'),'userpic',_0xef18('0x59'),_0xef18('0x5a'),_0xef18('0x5b'),_0xef18('0x5c'),'showWebBar'],'order':qs['sort'](_0xef18('0x5d')),'include':[{'model':db[_0xef18('0x5e')],'as':_0xef18('0x5f'),'attributes':['id',_0xef18('0x2c'),_0xef18('0x30')],'through':{'attributes':[]}}]})['then'](function(_0x572c11){if(_0x572c11){var _0x1df914=_0x5d8dca['user'][_0xef18('0x60')]({'plain':!![]});if(!_0x1df914)throw new Error(_0xef18('0x61'));if(_0x1df914['role']===_0xef18('0x56')){return db[_0xef18('0x62')][_0xef18('0x47')]({'where':{'name':'Agents','userProfileId':_0x1df914[_0xef18('0x63')]},'raw':!![]})[_0xef18('0x44')](function(_0x201920){if(_0x201920){if(_0x201920['autoAssociation']===0x0){return db[_0xef18('0x64')][_0xef18('0x65')]({'where':{'sectionId':_0x201920['id']},'raw':!![]})[_0xef18('0x44')](function(_0x4bc163){var _0x5c44d9=[];if(_[_0xef18('0x66')](_0x4bc163)){_0x5c44d9=_[_0xef18('0x3d')](_0x572c11,function(_0x4df976){if(_0x4df976[_0xef18('0x58')]!==_0xef18('0x55')){return _0x4df976;}});return _0x5c44d9;}else{for(var _0xe475fa=0x0;_0xe475fa<_0x572c11[_0xef18('0x38')];_0xe475fa++){var _0xfc53b5=_0x572c11[_0xe475fa];if(_0xfc53b5[_0xef18('0x58')]===_0xef18('0x55')){var _0x2bb14a=_[_0xef18('0x47')](_0x4bc163,function(_0x2cbd93){return _0x2cbd93[_0xef18('0x67')]===_0xfc53b5['id'];});if(_0x2bb14a)_0x5c44d9[_0xef18('0x68')](_0xfc53b5);}else{_0x5c44d9[_0xef18('0x68')](_0xfc53b5);}}return _0x5c44d9;}});}else{return _0x572c11;}}else{var _0x13f93e=_[_0xef18('0x3d')](_0x572c11,function(_0x4fa930){if(_0x4fa930[_0xef18('0x58')]!==_0xef18('0x55')){return _0x4fa930;}});return _0x13f93e;}});}else{return _0x572c11;}}})[_0xef18('0x44')](function(_0x2908f0){var _0x4a30b3=[];if(_0x2908f0){_0x2b8baf=_0x2908f0;for(var _0x2aac4d=0x0;_0x2aac4d<_0x2908f0[_0xef18('0x38')];_0x2aac4d+=0x1){_0x2b8baf[_0x2aac4d]['messages']=[];_0x4a30b3[_0xef18('0x68')](db[_0xef18('0x2f')][_0xef18('0x47')]({'where':{'FromId':[_0x5d8dca[_0xef18('0x56')]['id'],_0x2908f0[_0x2aac4d]['id']],'ToId':[_0x5d8dca['user']['id'],_0x2908f0[_0x2aac4d]['id']],'ChatGroupId':null},'attributes':['id','createdAt','FromId',_0xef18('0x69'),_0xef18('0x6a'),_0xef18('0x4a')],'order':qs[_0xef18('0x3b')](_0xef18('0x6b')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xef18('0x44')](wrapUser(_0x2908f0[_0x2aac4d])));}return BPromise[_0xef18('0x6c')](_0x4a30b3);}return[];})['then'](function(_0x3ccaff){return{'rows':_0x3ccaff,'count':_0x3ccaff[_0xef18('0x38')]};})[_0xef18('0x44')](respondWithResult(_0x199f3f,null))[_0xef18('0x48')](handleError(_0x199f3f,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 53ab34f..63a25ab 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 _0xc863=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','ChatInternalMessage','save','update'];(function(_0x53038a,_0x5511e2){var _0x57a08c=function(_0x23b413){while(--_0x23b413){_0x53038a['push'](_0x53038a['shift']());}};_0x57a08c(++_0x5511e2);}(_0xc863,0x1ea));var _0x3c86=function(_0x234ae1,_0x42bdd6){_0x234ae1=_0x234ae1-0x0;var _0x227ba0=_0xc863[_0x234ae1];return _0x227ba0;};'use strict';var EventEmitter=require(_0x3c86('0x0'));var ChatInternalMessage=require(_0x3c86('0x1'))['db'][_0x3c86('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3c86('0x3'),'afterUpdate':_0x3c86('0x4'),'afterDestroy':_0x3c86('0x5')};function emitEvent(_0x34ff53){return function(_0x2df100,_0x215fcb,_0x588257){ChatInternalMessageEvents[_0x3c86('0x6')](_0x34ff53+':'+_0x2df100['id'],_0x2df100);ChatInternalMessageEvents['emit'](_0x34ff53,_0x2df100);_0x588257(null);};}for(var e in events){if(events[_0x3c86('0x7')](e)){var event=events[e];ChatInternalMessage[_0x3c86('0x8')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file +var _0x2b3f=['emit','hasOwnProperty','hook','exports','events','ChatInternalMessage','setMaxListeners','save','remove'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2b3f,0x1e1));var _0xf2b3=function(_0x59b2f4,_0x3c660e){_0x59b2f4=_0x59b2f4-0x0;var _0x39f9d6=_0x2b3f[_0x59b2f4];return _0x39f9d6;};'use strict';var EventEmitter=require(_0xf2b3('0x0'));var ChatInternalMessage=require('../../mysqldb')['db'][_0xf2b3('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xf2b3('0x2')](0x0);var events={'afterCreate':_0xf2b3('0x3'),'afterUpdate':'update','afterDestroy':_0xf2b3('0x4')};function emitEvent(_0x322e5b){return function(_0xc7a63b,_0x468ed6,_0x1562aa){ChatInternalMessageEvents[_0xf2b3('0x5')](_0x322e5b+':'+_0xc7a63b['id'],_0xc7a63b);ChatInternalMessageEvents[_0xf2b3('0x5')](_0x322e5b,_0xc7a63b);_0x1562aa(null);};}for(var e in events){if(events[_0xf2b3('0x6')](e)){var event=events[e];ChatInternalMessage[_0xf2b3('0x7')](e,emitEvent(event));}}module[_0xf2b3('0x8')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 44d764f..344a6dc 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 _0x3f33=['rimraf','../../config/environment','./chatInternalMessage.attributes','exports','define','ChatInternalMessage','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x42c126,_0x1fdb0c){var _0x5db17d=function(_0x2cbb7f){while(--_0x2cbb7f){_0x42c126['push'](_0x42c126['shift']());}};_0x5db17d(++_0x1fdb0c);}(_0x3f33,0x1aa));var _0x33f3=function(_0x11f893,_0x259935){_0x11f893=_0x11f893-0x0;var _0x400fa8=_0x3f33[_0x11f893];return _0x400fa8;};'use strict';var _=require(_0x33f3('0x0'));var util=require(_0x33f3('0x1'));var logger=require(_0x33f3('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x33f3('0x3'));var config=require(_0x33f3('0x4'));var attributes=require(_0x33f3('0x5'));module[_0x33f3('0x6')]=function(_0x89c5e8,_0x4a793a){return _0x89c5e8[_0x33f3('0x7')](_0x33f3('0x8'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x33f3('0x9'),'collate':_0x33f3('0xa')});}; \ No newline at end of file +var _0x2982=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./chatInternalMessage.attributes','define','chat_internal_messages','utf8mb4'];(function(_0x456eae,_0x4290c3){var _0x49f4b1=function(_0x225612){while(--_0x225612){_0x456eae['push'](_0x456eae['shift']());}};_0x49f4b1(++_0x4290c3);}(_0x2982,0x15c));var _0x2298=function(_0x3ac16a,_0x52def3){_0x3ac16a=_0x3ac16a-0x0;var _0x457623=_0x2982[_0x3ac16a];return _0x457623;};'use strict';var _=require(_0x2298('0x0'));var util=require(_0x2298('0x1'));var logger=require(_0x2298('0x2'))(_0x2298('0x3'));var moment=require(_0x2298('0x4'));var BPromise=require(_0x2298('0x5'));var rp=require(_0x2298('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2298('0x7'));var attributes=require(_0x2298('0x8'));module['exports']=function(_0x36af29,_0x3696d9){return _0x36af29[_0x2298('0x9')]('ChatInternalMessage',attributes,{'tableName':_0x2298('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2298('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index a42d45a..3d26f89 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 _0xca89=['client','http','redis','defaults','localhost','register','request','info','ChatInternalMessage,\x20%s,\x20%s','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x3cf713,_0x3901a9){var _0x174d42=function(_0x3bff25){while(--_0x3bff25){_0x3cf713['push'](_0x3cf713['shift']());}};_0x174d42(++_0x3901a9);}(_0xca89,0x187));var _0x9ca8=function(_0x75481,_0x10c01){_0x75481=_0x75481-0x0;var _0x42d57d=_0xca89[_0x75481];return _0x42d57d;};'use strict';var _=require('lodash');var util=require(_0x9ca8('0x0'));var moment=require(_0x9ca8('0x1'));var BPromise=require(_0x9ca8('0x2'));var rs=require(_0x9ca8('0x3'));var fs=require('fs');var Redis=require(_0x9ca8('0x4'));var db=require(_0x9ca8('0x5'))['db'];var utils=require(_0x9ca8('0x6'));var logger=require(_0x9ca8('0x7'))(_0x9ca8('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9ca8('0x9')][_0x9ca8('0xa')]({'port':0x232a});config[_0x9ca8('0xb')]=_[_0x9ca8('0xc')](config[_0x9ca8('0xb')],{'host':_0x9ca8('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9ca8('0xb')]));require('./chatInternalMessage.socket')[_0x9ca8('0xe')](socket);function respondWithRpcPromise(_0x4e0598,_0x3e1912,_0x49086c){return new BPromise(function(_0x33b4b1,_0x236773){return client[_0x9ca8('0xf')](_0x4e0598,_0x49086c)['then'](function(_0x3269d9){logger[_0x9ca8('0x10')](_0x9ca8('0x11'),_0x3e1912,'request\x20sent');logger[_0x9ca8('0x12')](_0x9ca8('0x13'),_0x3e1912,'request\x20sent',JSON['stringify'](_0x3269d9));if(_0x3269d9[_0x9ca8('0x14')]){if(_0x3269d9[_0x9ca8('0x14')]['code']===0x1f4){logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x3e1912,_0x3269d9['error'][_0x9ca8('0x15')]);return _0x236773(_0x3269d9[_0x9ca8('0x14')][_0x9ca8('0x15')]);}logger[_0x9ca8('0x14')]('ChatInternalMessage,\x20%s,\x20%s',_0x3e1912,_0x3269d9[_0x9ca8('0x14')][_0x9ca8('0x15')]);return _0x33b4b1(_0x3269d9[_0x9ca8('0x14')][_0x9ca8('0x15')]);}else{logger[_0x9ca8('0x10')](_0x9ca8('0x11'),_0x3e1912,_0x9ca8('0x16'));_0x33b4b1(_0x3269d9[_0x9ca8('0x17')][_0x9ca8('0x15')]);}})[_0x9ca8('0x18')](function(_0x315396){logger['error'](_0x9ca8('0x11'),_0x3e1912,_0x315396);_0x236773(_0x315396);});});} \ No newline at end of file +var _0xc7e6=['register','request','then','info','request\x20sent','error','code','ChatInternalMessage,\x20%s,\x20%s','message','result','catch','lodash','util','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','redis','socket.io-emitter','./chatInternalMessage.socket'];(function(_0x2da871,_0x77f588){var _0x4984bd=function(_0x1d9f2d){while(--_0x1d9f2d){_0x2da871['push'](_0x2da871['shift']());}};_0x4984bd(++_0x77f588);}(_0xc7e6,0x1ef));var _0x6c7e=function(_0x5162ed,_0x386cb7){_0x5162ed=_0x5162ed-0x0;var _0x4c579b=_0xc7e6[_0x5162ed];return _0x4c579b;};'use strict';var _=require(_0x6c7e('0x0'));var util=require(_0x6c7e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6c7e('0x2'));var db=require(_0x6c7e('0x3'))['db'];var utils=require(_0x6c7e('0x4'));var logger=require('../../config/logger')(_0x6c7e('0x5'));var config=require('../../config/environment');var jayson=require(_0x6c7e('0x6'));var client=jayson['client'][_0x6c7e('0x7')]({'port':0x232a});config['redis']=_['defaults'](config[_0x6c7e('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x6c7e('0x9'))(new Redis(config[_0x6c7e('0x8')]));require(_0x6c7e('0xa'))[_0x6c7e('0xb')](socket);function respondWithRpcPromise(_0x4da581,_0x250276,_0x1a27c9){return new BPromise(function(_0x407fd4,_0x50cfcf){return client[_0x6c7e('0xc')](_0x4da581,_0x1a27c9)[_0x6c7e('0xd')](function(_0xa3761e){logger[_0x6c7e('0xe')]('ChatInternalMessage,\x20%s,\x20%s',_0x250276,_0x6c7e('0xf'));logger['debug']('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x250276,'request\x20sent',JSON['stringify'](_0xa3761e));if(_0xa3761e['error']){if(_0xa3761e[_0x6c7e('0x10')][_0x6c7e('0x11')]===0x1f4){logger['error'](_0x6c7e('0x12'),_0x250276,_0xa3761e['error']['message']);return _0x50cfcf(_0xa3761e['error'][_0x6c7e('0x13')]);}logger['error'](_0x6c7e('0x12'),_0x250276,_0xa3761e[_0x6c7e('0x10')][_0x6c7e('0x13')]);return _0x407fd4(_0xa3761e[_0x6c7e('0x10')][_0x6c7e('0x13')]);}else{logger[_0x6c7e('0xe')](_0x6c7e('0x12'),_0x250276,_0x6c7e('0xf'));_0x407fd4(_0xa3761e[_0x6c7e('0x14')]['message']);}})[_0x6c7e('0x15')](function(_0x25d380){logger[_0x6c7e('0x10')](_0x6c7e('0x12'),_0x250276,_0x25d380);_0x50cfcf(_0x25d380);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 59100b4..bccd144 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 _0xf3da=['chatInternalMessage:','./chatInternalMessage.events','save','emit','register','length'];(function(_0x21bfab,_0x2fee48){var _0x4db318=function(_0x10396d){while(--_0x10396d){_0x21bfab['push'](_0x21bfab['shift']());}};_0x4db318(++_0x2fee48);}(_0xf3da,0xf7));var _0xaf3d=function(_0x37ca19,_0x5c91a0){_0x37ca19=_0x37ca19-0x0;var _0x57766e=_0xf3da[_0x37ca19];return _0x57766e;};'use strict';var ChatInternalMessageEvents=require(_0xaf3d('0x0'));var events=[_0xaf3d('0x1'),'remove','update'];function createListener(_0xe86e97,_0x52b36d){return function(_0x1940d0){_0x52b36d[_0xaf3d('0x2')](_0xe86e97,_0x1940d0);};}function removeListener(_0x410b8e,_0x222c85){return function(){ChatInternalMessageEvents['removeListener'](_0x410b8e,_0x222c85);};}exports[_0xaf3d('0x3')]=function(_0x549c2e){for(var _0x336531=0x0,_0x52c22b=events[_0xaf3d('0x4')];_0x336531<_0x52c22b;_0x336531++){var _0x4882fe=events[_0x336531];var _0xc97cd7=createListener(_0xaf3d('0x5')+_0x4882fe,_0x549c2e);ChatInternalMessageEvents['on'](_0x4882fe,_0xc97cd7);}}; \ No newline at end of file +var _0x3447=['chatInternalMessage:','./chatInternalMessage.events','save','remove','emit','removeListener','register'];(function(_0x3e2c33,_0x579090){var _0x533aa0=function(_0x40f12a){while(--_0x40f12a){_0x3e2c33['push'](_0x3e2c33['shift']());}};_0x533aa0(++_0x579090);}(_0x3447,0x135));var _0x7344=function(_0x3f6b1b,_0x58d3d6){_0x3f6b1b=_0x3f6b1b-0x0;var _0x4a3d2b=_0x3447[_0x3f6b1b];return _0x4a3d2b;};'use strict';var ChatInternalMessageEvents=require(_0x7344('0x0'));var events=[_0x7344('0x1'),_0x7344('0x2'),'update'];function createListener(_0x267cb5,_0x11483f){return function(_0xcab7c7){_0x11483f[_0x7344('0x3')](_0x267cb5,_0xcab7c7);};}function removeListener(_0x53cf91,_0x2d354e){return function(){ChatInternalMessageEvents[_0x7344('0x4')](_0x53cf91,_0x2d354e);};}exports[_0x7344('0x5')]=function(_0x1aad03){for(var _0x1a578a=0x0,_0x2654c6=events['length'];_0x1a578a<_0x2654c6;_0x1a578a++){var _0x2b2029=events[_0x1a578a];var _0x2e4136=createListener(_0x7344('0x6')+_0x2b2029,_0x1aad03);ChatInternalMessageEvents['on'](_0x2b2029,_0x2e4136);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 468d238..56748d6 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 _0xe6a9=['create','put','/:id','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','getUsers','show'];(function(_0x5cc118,_0x479136){var _0x87ff2b=function(_0x2e3aa7){while(--_0x2e3aa7){_0x5cc118['push'](_0x5cc118['shift']());}};_0x87ff2b(++_0x479136);}(_0xe6a9,0x181));var _0x9e6a=function(_0x30986c,_0x39ce58){_0x30986c=_0x30986c-0x0;var _0x57c209=_0xe6a9[_0x30986c];return _0x57c209;};'use strict';var multer=require(_0x9e6a('0x0'));var util=require(_0x9e6a('0x1'));var path=require(_0x9e6a('0x2'));var timeout=require(_0x9e6a('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x9e6a('0x4'));var auth=require(_0x9e6a('0x5'));var interaction=require(_0x9e6a('0x6'));var config=require(_0x9e6a('0x7'));var controller=require(_0x9e6a('0x8'));router[_0x9e6a('0x9')]('/',auth[_0x9e6a('0xa')](),controller[_0x9e6a('0xb')]);router[_0x9e6a('0x9')]('/describe',auth[_0x9e6a('0xa')](),controller['describe']);router[_0x9e6a('0x9')]('/users',auth['isAuthenticated'](),controller[_0x9e6a('0xc')]);router[_0x9e6a('0x9')]('/:id',auth[_0x9e6a('0xa')](),controller[_0x9e6a('0xd')]);router['post']('/',auth[_0x9e6a('0xa')](),controller[_0x9e6a('0xe')]);router[_0x9e6a('0xf')](_0x9e6a('0x10'),controller['update']);router['delete']('/:id',auth[_0x9e6a('0xa')](),controller[_0x9e6a('0x11')]);module[_0x9e6a('0x12')]=router; \ No newline at end of file +var _0xca85=['delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','/describe','isAuthenticated','describe','/users','getUsers','/:id','post','create','put','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xca85,0x17d));var _0x5ca8=function(_0x589bee,_0x3e06b9){_0x589bee=_0x589bee-0x0;var _0x58f126=_0xca85[_0x589bee];return _0x58f126;};'use strict';var multer=require(_0x5ca8('0x0'));var util=require('util');var path=require(_0x5ca8('0x1'));var timeout=require(_0x5ca8('0x2'));var express=require(_0x5ca8('0x3'));var router=express[_0x5ca8('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x5ca8('0x5'));var interaction=require(_0x5ca8('0x6'));var config=require('../../config/environment');var controller=require('./chatInternalMessage.controller');router[_0x5ca8('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5ca8('0x7')](_0x5ca8('0x8'),auth[_0x5ca8('0x9')](),controller[_0x5ca8('0xa')]);router[_0x5ca8('0x7')](_0x5ca8('0xb'),auth['isAuthenticated'](),controller[_0x5ca8('0xc')]);router['get'](_0x5ca8('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x5ca8('0xe')]('/',auth['isAuthenticated'](),controller[_0x5ca8('0xf')]);router[_0x5ca8('0x10')](_0x5ca8('0xd'),controller[_0x5ca8('0x11')]);router[_0x5ca8('0x12')](_0x5ca8('0xd'),auth[_0x5ca8('0x9')](),controller[_0x5ca8('0x13')]);module[_0x5ca8('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 89dbd4e..e796cfa 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 _0xe9e8=['exports','TEXT','medium','BOOLEAN','ENUM','out','DATE','STRING','sequelize'];(function(_0x34e1f4,_0x278e82){var _0x4c4822=function(_0x13726e){while(--_0x13726e){_0x34e1f4['push'](_0x34e1f4['shift']());}};_0x4c4822(++_0x278e82);}(_0xe9e8,0x6b));var _0x8e9e=function(_0x254ff4,_0x2a1957){_0x254ff4=_0x254ff4-0x0;var _0x4ae756=_0xe9e8[_0x254ff4];return _0x4ae756;};'use strict';var Sequelize=require(_0x8e9e('0x0'));module[_0x8e9e('0x1')]={'body':{'type':Sequelize[_0x8e9e('0x2')](_0x8e9e('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x8e9e('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x8e9e('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x8e9e('0x5')]('in','out'),'defaultValue':_0x8e9e('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0x8e9e('0x7')]},'providerName':{'type':Sequelize[_0x8e9e('0x8')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x3014=['exports','medium','BOOLEAN','out','DATE','STRING','TEXT','sequelize'];(function(_0x451f88,_0x5c061a){var _0x2cc2b7=function(_0x5bb6ce){while(--_0x5bb6ce){_0x451f88['push'](_0x451f88['shift']());}};_0x2cc2b7(++_0x5c061a);}(_0x3014,0x1d7));var _0x4301=function(_0x4b6827,_0x3328bb){_0x4b6827=_0x4b6827-0x0;var _0x302cb0=_0x3014[_0x4b6827];return _0x302cb0;};'use strict';var Sequelize=require(_0x4301('0x0'));module[_0x4301('0x1')]={'body':{'type':Sequelize['TEXT'](_0x4301('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x4301('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x4301('0x4')),'defaultValue':_0x4301('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x4301('0x5')]},'providerName':{'type':Sequelize[_0x4301('0x6')]},'providerResponse':{'type':Sequelize[_0x4301('0x7')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 7fccd0e..525a727 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 _0xed33=['send','index','map','ChatMessage','rawAttributes','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','create','body','describe','chat-interactions','chat','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteraction','isNil','read1stAt','interaction','info','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','QueryTypes','SELECT','fullname','internal','manual','SIP/%s','channel','motionChannel','event','accept','EventManager','acceptmessage','parse','ChatInteractionId','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','rejectMessage','ContactId','sequelize','contact','User','email','interface','rejectmessage','formData','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','./chatMessage.socket','jayson/promise','client','http','request','then','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','destroy','status','name'];(function(_0x5e3167,_0xf05dcd){var _0x17f61c=function(_0x19efd9){while(--_0x19efd9){_0x5e3167['push'](_0x5e3167['shift']());}};_0x17f61c(++_0xf05dcd);}(_0xed33,0xda));var _0x3ed3=function(_0x24cabd,_0x1554b6){_0x24cabd=_0x24cabd-0x0;var _0x2d2a9f=_0xed33[_0x24cabd];return _0x2d2a9f;};'use strict';var emlformat=require(_0x3ed3('0x0'));var rimraf=require(_0x3ed3('0x1'));var zipdir=require(_0x3ed3('0x2'));var jsonpatch=require(_0x3ed3('0x3'));var rp=require(_0x3ed3('0x4'));var moment=require(_0x3ed3('0x5'));var BPromise=require(_0x3ed3('0x6'));var Mustache=require(_0x3ed3('0x7'));var util=require(_0x3ed3('0x8'));var path=require('path');var sox=require(_0x3ed3('0x9'));var csv=require(_0x3ed3('0xa'));var ejs=require(_0x3ed3('0xb'));var fs=require('fs');var fs_extra=require(_0x3ed3('0xc'));var _=require(_0x3ed3('0xd'));var squel=require(_0x3ed3('0xe'));var crypto=require('crypto');var jsforce=require(_0x3ed3('0xf'));var deskjs=require(_0x3ed3('0x10'));var toCsv=require(_0x3ed3('0xa'));var querystring=require(_0x3ed3('0x11'));var Papa=require(_0x3ed3('0x12'));var Redis=require(_0x3ed3('0x13'));var authService=require(_0x3ed3('0x14'));var qs=require(_0x3ed3('0x15'));var as=require(_0x3ed3('0x16'));var hardwareService=require(_0x3ed3('0x17'));var logger=require(_0x3ed3('0x18'))('api');var utils=require(_0x3ed3('0x19'));var config=require(_0x3ed3('0x1a'));var licenseUtil=require(_0x3ed3('0x1b'));var db=require('../../mysqldb')['db'];config[_0x3ed3('0x1c')]=_['defaults'](config[_0x3ed3('0x1c')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3ed3('0x1d'))['register'](socket);var jayson=require(_0x3ed3('0x1e'));var client=jayson[_0x3ed3('0x1f')][_0x3ed3('0x20')]({'port':0x232c});var client9002=jayson[_0x3ed3('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x8033df,_0x2c6727,_0x244cb6,_0x5dbcda){return new BPromise(function(_0x112745,_0x10bc0c){var _0x4722c6=_0x5dbcda||client;return _0x4722c6[_0x3ed3('0x21')](_0x8033df,_0x244cb6)[_0x3ed3('0x22')](function(_0x1143eb){logger['info'](_0x3ed3('0x23'),_0x2c6727,_0x3ed3('0x24'));logger[_0x3ed3('0x25')](_0x3ed3('0x26'),_0x2c6727,_0x3ed3('0x24'),JSON[_0x3ed3('0x27')](_0x1143eb));if(_0x1143eb[_0x3ed3('0x28')]){if(_0x1143eb[_0x3ed3('0x28')][_0x3ed3('0x29')]===0x1f4){logger[_0x3ed3('0x28')]('ChatMessage,\x20%s,\x20%s',_0x2c6727,_0x1143eb[_0x3ed3('0x28')][_0x3ed3('0x2a')]);return _0x10bc0c(_0x1143eb[_0x3ed3('0x28')]['message']);}logger[_0x3ed3('0x28')](_0x3ed3('0x23'),_0x2c6727,_0x1143eb['error']['message']);return _0x112745(_0x1143eb['error'][_0x3ed3('0x2a')]);}else{logger['info'](_0x3ed3('0x23'),_0x2c6727,_0x3ed3('0x24'));_0x112745(_0x1143eb[_0x3ed3('0x2b')][_0x3ed3('0x2a')]);}})[_0x3ed3('0x2c')](function(_0x19ebbd){logger[_0x3ed3('0x28')](_0x3ed3('0x23'),_0x2c6727,_0x19ebbd);_0x10bc0c(_0x19ebbd);});});}function respondWithStatusCode(_0x4bef65,_0x1b2b74){_0x1b2b74=_0x1b2b74||0xcc;return function(_0x5b018a){if(_0x5b018a){return _0x4bef65[_0x3ed3('0x2d')](_0x1b2b74);}return _0x4bef65['status'](_0x1b2b74)[_0x3ed3('0x2e')]();};}function respondWithResult(_0x2ddd27,_0x4146cc){_0x4146cc=_0x4146cc||0xc8;return function(_0x2d9283){if(_0x2d9283){return _0x2ddd27['status'](_0x4146cc)[_0x3ed3('0x2f')](_0x2d9283);}};}function respondWithFilteredResult(_0x55485b,_0x489fa3){return function(_0x14bf78){if(_0x14bf78){var _0x23dcd5=typeof _0x489fa3['offset']===_0x3ed3('0x30')&&typeof _0x489fa3[_0x3ed3('0x31')]===_0x3ed3('0x30');var _0x1b998d=_0x14bf78['count'];var _0x5bb512=_0x23dcd5?0x0:_0x489fa3['offset'];var _0x46db01=_0x23dcd5?_0x14bf78[_0x3ed3('0x32')]:_0x489fa3[_0x3ed3('0x33')]+_0x489fa3['limit'];var _0x5645e2;if(_0x46db01>=_0x1b998d){_0x46db01=_0x1b998d;_0x5645e2=0xc8;}else{_0x5645e2=0xce;}_0x55485b['status'](_0x5645e2);return _0x55485b[_0x3ed3('0x34')](_0x3ed3('0x35'),_0x5bb512+'-'+_0x46db01+'/'+_0x1b998d)[_0x3ed3('0x2f')](_0x14bf78);}return null;};}function patchUpdates(_0x422f3b){return function(_0x2e4d51){try{jsonpatch['apply'](_0x2e4d51,_0x422f3b,!![]);}catch(_0x5f3c37){return BPromise[_0x3ed3('0x36')](_0x5f3c37);}return _0x2e4d51[_0x3ed3('0x37')]();};}function saveUpdates(_0x4902f5,_0x3b7c43){return function(_0x517032){if(_0x517032){return _0x517032[_0x3ed3('0x38')](_0x4902f5)[_0x3ed3('0x22')](function(_0x49ef8b){return _0x49ef8b;});}return null;};}function removeEntity(_0x41c77a,_0x38ef87){return function(_0xd41615){if(_0xd41615){return _0xd41615[_0x3ed3('0x39')]()[_0x3ed3('0x22')](function(){_0x41c77a[_0x3ed3('0x3a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d05e1,_0x245005){return function(_0x490e74){if(!_0x490e74){_0x3d05e1[_0x3ed3('0x2d')](0x194);}return _0x490e74;};}function handleError(_0x2d26af,_0x11e1c6){_0x11e1c6=_0x11e1c6||0x1f4;return function(_0xe96a10){logger['error'](_0xe96a10['stack']);if(_0xe96a10[_0x3ed3('0x3b')]){delete _0xe96a10['name'];}_0x2d26af[_0x3ed3('0x3a')](_0x11e1c6)[_0x3ed3('0x3c')](_0xe96a10);};}exports[_0x3ed3('0x3d')]=function(_0x1cc22a,_0x2ed119){var _0x4788c6={},_0x24bc3d={},_0x4ac1b5={'count':0x0,'rows':[]};var _0x788004=_[_0x3ed3('0x3e')](db[_0x3ed3('0x3f')][_0x3ed3('0x40')],function(_0xe881d1){return{'name':_0xe881d1['fieldName'],'type':_0xe881d1[_0x3ed3('0x41')][_0x3ed3('0x42')]};});_0x24bc3d[_0x3ed3('0x43')]=_[_0x3ed3('0x3e')](_0x788004,_0x3ed3('0x3b'));_0x24bc3d['query']=_[_0x3ed3('0x44')](_0x1cc22a[_0x3ed3('0x45')]);_0x24bc3d['filters']=_[_0x3ed3('0x46')](_0x24bc3d[_0x3ed3('0x43')],_0x24bc3d[_0x3ed3('0x45')]);_0x4788c6[_0x3ed3('0x47')]=_[_0x3ed3('0x46')](_0x24bc3d[_0x3ed3('0x43')],qs[_0x3ed3('0x48')](_0x1cc22a[_0x3ed3('0x45')][_0x3ed3('0x48')]));_0x4788c6['attributes']=_0x4788c6[_0x3ed3('0x47')][_0x3ed3('0x49')]?_0x4788c6[_0x3ed3('0x47')]:_0x24bc3d[_0x3ed3('0x43')];if(!_0x1cc22a[_0x3ed3('0x45')][_0x3ed3('0x4a')](_0x3ed3('0x4b'))){_0x4788c6[_0x3ed3('0x31')]=qs[_0x3ed3('0x31')](_0x1cc22a[_0x3ed3('0x45')]['limit']);_0x4788c6[_0x3ed3('0x33')]=qs['offset'](_0x1cc22a[_0x3ed3('0x45')][_0x3ed3('0x33')]);}_0x4788c6[_0x3ed3('0x4c')]=qs[_0x3ed3('0x4d')](_0x1cc22a[_0x3ed3('0x45')][_0x3ed3('0x4d')]);_0x4788c6[_0x3ed3('0x4e')]=qs[_0x3ed3('0x4f')](_[_0x3ed3('0x50')](_0x1cc22a[_0x3ed3('0x45')],_0x24bc3d[_0x3ed3('0x4f')]),_0x788004);if(_0x1cc22a[_0x3ed3('0x45')][_0x3ed3('0x51')]){_0x4788c6['where']=_[_0x3ed3('0x52')](_0x4788c6[_0x3ed3('0x4e')],{'$or':_[_0x3ed3('0x3e')](_0x788004,function(_0x524f41){if(_0x524f41[_0x3ed3('0x41')]!==_0x3ed3('0x53')){var _0x540a1d={};_0x540a1d[_0x524f41[_0x3ed3('0x3b')]]={'$like':'%'+_0x1cc22a[_0x3ed3('0x45')][_0x3ed3('0x51')]+'%'};return _0x540a1d;}})});}_0x4788c6=_['merge']({},_0x4788c6,_0x1cc22a[_0x3ed3('0x54')]);var _0x982298={'where':_0x4788c6[_0x3ed3('0x4e')]};return db[_0x3ed3('0x3f')][_0x3ed3('0x32')](_0x982298)['then'](function(_0x13b848){_0x4ac1b5[_0x3ed3('0x32')]=_0x13b848;if(_0x1cc22a[_0x3ed3('0x45')][_0x3ed3('0x55')]){_0x4788c6[_0x3ed3('0x56')]=[{'all':!![]}];}return db[_0x3ed3('0x3f')][_0x3ed3('0x57')](_0x4788c6);})[_0x3ed3('0x22')](function(_0xbc266a){_0x4ac1b5[_0x3ed3('0x58')]=_0xbc266a;return _0x4ac1b5;})[_0x3ed3('0x22')](respondWithFilteredResult(_0x2ed119,_0x4788c6))['catch'](handleError(_0x2ed119,null));};exports[_0x3ed3('0x59')]=function(_0x1b5197,_0x4bfeda){var _0x5c7e12={'raw':!![],'where':{'id':_0x1b5197[_0x3ed3('0x5a')]['id']}},_0x471846={};_0x471846['model']=_['keys'](db[_0x3ed3('0x3f')]['rawAttributes']);_0x471846['query']=_[_0x3ed3('0x44')](_0x1b5197[_0x3ed3('0x45')]);_0x471846['filters']=_[_0x3ed3('0x46')](_0x471846[_0x3ed3('0x43')],_0x471846[_0x3ed3('0x45')]);_0x5c7e12[_0x3ed3('0x47')]=_[_0x3ed3('0x46')](_0x471846[_0x3ed3('0x43')],qs[_0x3ed3('0x48')](_0x1b5197[_0x3ed3('0x45')]['fields']));_0x5c7e12[_0x3ed3('0x47')]=_0x5c7e12[_0x3ed3('0x47')]['length']?_0x5c7e12[_0x3ed3('0x47')]:_0x471846[_0x3ed3('0x43')];if(_0x1b5197[_0x3ed3('0x45')]['includeAll']){_0x5c7e12[_0x3ed3('0x56')]=[{'all':!![]}];}_0x5c7e12=_[_0x3ed3('0x52')]({},_0x5c7e12,_0x1b5197[_0x3ed3('0x54')]);return db[_0x3ed3('0x3f')][_0x3ed3('0x5b')](_0x5c7e12)[_0x3ed3('0x22')](handleEntityNotFound(_0x4bfeda,null))['then'](respondWithResult(_0x4bfeda,null))[_0x3ed3('0x2c')](handleError(_0x4bfeda,null));};exports['create']=function(_0x53e77c,_0x184ab9){return db[_0x3ed3('0x3f')][_0x3ed3('0x5c')](_0x53e77c[_0x3ed3('0x5d')],{})['then'](respondWithResult(_0x184ab9,0xc9))[_0x3ed3('0x2c')](handleError(_0x184ab9,null));};exports[_0x3ed3('0x38')]=function(_0x8e0cfe,_0x543d73){if(_0x8e0cfe[_0x3ed3('0x5d')]['id']){delete _0x8e0cfe[_0x3ed3('0x5d')]['id'];}return db[_0x3ed3('0x3f')]['find']({'where':{'id':_0x8e0cfe[_0x3ed3('0x5a')]['id']}})[_0x3ed3('0x22')](handleEntityNotFound(_0x543d73,null))['then'](saveUpdates(_0x8e0cfe[_0x3ed3('0x5d')],null))[_0x3ed3('0x22')](respondWithResult(_0x543d73,null))['catch'](handleError(_0x543d73,null));};exports[_0x3ed3('0x39')]=function(_0x28ac6e,_0x5cadd0){return db[_0x3ed3('0x3f')][_0x3ed3('0x5b')]({'where':{'id':_0x28ac6e[_0x3ed3('0x5a')]['id']}})[_0x3ed3('0x22')](handleEntityNotFound(_0x5cadd0,null))[_0x3ed3('0x22')](removeEntity(_0x5cadd0,null))['catch'](handleError(_0x5cadd0,null));};exports['describe']=function(_0x2158dd,_0x3cb54d){return db['ChatMessage'][_0x3ed3('0x5e')]()[_0x3ed3('0x22')](respondWithResult(_0x3cb54d,null))[_0x3ed3('0x2c')](handleError(_0x3cb54d,null));};var interaction_log=require('../../config/logger')(_0x3ed3('0x5f'));exports['accept']=function(_0x236331,_0x1184e7,_0x599078){var _0x31baf3={'agent':{},'channel':_0x3ed3('0x60')};if(_0x236331[_0x3ed3('0x5d')]['id']){delete _0x236331['body']['id'];}_0x236331[_0x3ed3('0x5d')]['read']=!![];_0x236331[_0x3ed3('0x5d')][_0x3ed3('0x61')]=moment()[_0x3ed3('0x62')](_0x3ed3('0x63'));_0x236331[_0x3ed3('0x5d')][_0x3ed3('0x64')]=_0x236331[_0x3ed3('0x5d')][_0x3ed3('0x64')]||_0x236331[_0x3ed3('0x65')]['id'];_0x31baf3[_0x3ed3('0x66')]['id']=_0x236331[_0x3ed3('0x5d')]['UserId'];return db[_0x3ed3('0x3f')]['find']({'where':{'id':_0x236331[_0x3ed3('0x5a')]['id'],'UserId':null}})[_0x3ed3('0x22')](handleEntityNotFound(_0x1184e7,null))['then'](saveUpdates(_0x236331[_0x3ed3('0x5d')],null))[_0x3ed3('0x22')](function(_0x343168){if(_0x343168){_0x31baf3['message']=_0x343168[_0x3ed3('0x67')]({'plain':!![]});return db[_0x3ed3('0x68')][_0x3ed3('0x5b')]({'where':{'id':_0x343168['ChatInteractionId']}});}return null;})[_0x3ed3('0x22')](handleEntityNotFound(_0x1184e7,null))[_0x3ed3('0x22')](function(_0x220d4a){if(_0x220d4a){return _0x220d4a[_0x3ed3('0x38')]({'UserId':_0x236331[_0x3ed3('0x5d')][_0x3ed3('0x64')],'read1stAt':_[_0x3ed3('0x69')](_0x220d4a[_0x3ed3('0x6a')])?moment()[_0x3ed3('0x62')](_0x3ed3('0x63')):undefined});}return null;})[_0x3ed3('0x22')](function(_0x259038){if(_0x259038){_0x31baf3[_0x3ed3('0x6b')]=_0x259038[_0x3ed3('0x67')]({'plain':!![]});interaction_log[_0x3ed3('0x6c')](_0x3ed3('0x6d'),_0x236331[_0x3ed3('0x65')]['id'],_0x236331['user'][_0x3ed3('0x3b')],_0x236331[_0x3ed3('0x65')]['role'],_0x31baf3[_0x3ed3('0x6b')]['id'],_0x236331[_0x3ed3('0x5d')]?JSON['stringify'](_0x236331[_0x3ed3('0x5d')]):'null');return respondWithRpcPromise(_0x3ed3('0x6e'),_0x3ed3('0x6f'),_0x31baf3);}return null;})[_0x3ed3('0x22')](function(_0x2dec40){var _0x472802=_0x3ed3('0x70')+_0x2dec40[_0x3ed3('0x2a')]['ContactId'];return db['sequelize'][_0x3ed3('0x45')](_0x472802,{'type':db[_0x3ed3('0x71')][_0x3ed3('0x72')][_0x3ed3('0x73')],'raw':!![]})[_0x3ed3('0x22')](function(_0x171f71){return _0x171f71;});})[_0x3ed3('0x22')](function(_0x4e658d){if(_0x4e658d){_0x31baf3[_0x3ed3('0x2a')]['contact']=_0x4e658d[0x0];if(!_0x236331[_0x3ed3('0x5d')][_0x3ed3('0x64')])return;return db['User'][_0x3ed3('0x5b')]({'where':{'id':_0x236331['body']['UserId'],'role':_0x3ed3('0x66')},'attributes':['id','name',_0x3ed3('0x74'),'email',_0x3ed3('0x75')],'raw':!![]});}return null;})[_0x3ed3('0x22')](function(_0x3bb7fd){if(!_0x3bb7fd)return null;_0x31baf3['message'][_0x3ed3('0x66')]=_0x3bb7fd;return _0x31baf3;})[_0x3ed3('0x22')](function(_0x59fb72){if(_0x59fb72){if(_0x236331[_0x3ed3('0x5d')][_0x3ed3('0x76')]){_0x31baf3[_0x3ed3('0x2a')]['interface']=util[_0x3ed3('0x62')](_0x3ed3('0x77'),_0x236331['user'][_0x3ed3('0x3b')]);_0x31baf3[_0x3ed3('0x2a')][_0x3ed3('0x78')]=_0x31baf3[_0x3ed3('0x78')];_0x31baf3[_0x3ed3('0x2a')][_0x3ed3('0x79')]=_0x31baf3[_0x3ed3('0x78')];_0x31baf3['message'][_0x3ed3('0x7a')]=_0x3ed3('0x7b');return respondWithRpcPromise(_0x3ed3('0x7c'),_0x3ed3('0x7c'),{'event':_0x3ed3('0x7d'),'message':_[_0x3ed3('0x52')](_0x31baf3['message'],JSON[_0x3ed3('0x7e')](_0x31baf3['interaction']['formData']))},client9002)[_0x3ed3('0x22')](function(){return _0x31baf3;});}return _0x31baf3;}return null;})[_0x3ed3('0x22')](respondWithResult(_0x1184e7,null))[_0x3ed3('0x2c')](handleError(_0x1184e7,null));};var interaction_log=require('../../config/logger')(_0x3ed3('0x5f'));exports['reject']=function(_0xafc625,_0x5258ce,_0x13611c){var _0x15d0a5={'agent':{},'channel':'chat'};if(_0xafc625[_0x3ed3('0x5d')]['id']){delete _0xafc625[_0x3ed3('0x5d')]['id'];}_0xafc625[_0x3ed3('0x5d')][_0x3ed3('0x64')]=_0xafc625[_0x3ed3('0x5d')][_0x3ed3('0x64')]||_0xafc625['user']['id'];_0x15d0a5[_0x3ed3('0x66')]['id']=_0xafc625[_0x3ed3('0x5d')][_0x3ed3('0x64')];return db[_0x3ed3('0x3f')]['find']({'where':{'id':_0xafc625[_0x3ed3('0x5a')]['id'],'UserId':null}})[_0x3ed3('0x22')](handleEntityNotFound(_0x5258ce,null))[_0x3ed3('0x22')](function(_0x284d47){if(_0x284d47){_0x15d0a5['message']=_0x284d47[_0x3ed3('0x67')]({'plain':!![]});return db[_0x3ed3('0x68')][_0x3ed3('0x5b')]({'where':{'id':_0x284d47[_0x3ed3('0x7f')]}});}return null;})['then'](handleEntityNotFound(_0x5258ce,null))[_0x3ed3('0x22')](function(_0x21d9ff){if(_0x21d9ff){_0x15d0a5['interaction']=_0x21d9ff[_0x3ed3('0x67')]({'plain':!![]});interaction_log[_0x3ed3('0x6c')](_0x3ed3('0x80'),_0xafc625[_0x3ed3('0x65')]['id'],_0xafc625['user'][_0x3ed3('0x3b')],_0xafc625['user']['role'],_0x15d0a5[_0x3ed3('0x6b')]['id'],_0xafc625[_0x3ed3('0x5d')]?JSON[_0x3ed3('0x27')](_0xafc625[_0x3ed3('0x5d')]):_0x3ed3('0x81'));return respondWithRpcPromise('RejectMessage',_0x3ed3('0x82'),_0x15d0a5);}return null;})[_0x3ed3('0x22')](function(_0x845178){var _0x28033b=_0x3ed3('0x70')+_0x845178[_0x3ed3('0x2a')][_0x3ed3('0x83')];return db[_0x3ed3('0x84')][_0x3ed3('0x45')](_0x28033b,{'type':db[_0x3ed3('0x71')][_0x3ed3('0x72')][_0x3ed3('0x73')],'raw':!![]})[_0x3ed3('0x22')](function(_0x1cf22f){return _0x1cf22f;});})['then'](function(_0x5f291e){if(_0x5f291e){_0x15d0a5[_0x3ed3('0x2a')][_0x3ed3('0x85')]=_0x5f291e[0x0];if(!_0xafc625[_0x3ed3('0x5d')][_0x3ed3('0x64')])return;return db[_0x3ed3('0x86')][_0x3ed3('0x5b')]({'where':{'id':_0xafc625['body'][_0x3ed3('0x64')],'role':_0x3ed3('0x66')},'attributes':['id','name',_0x3ed3('0x74'),_0x3ed3('0x87'),_0x3ed3('0x75')],'raw':!![]});}return null;})[_0x3ed3('0x22')](function(_0xafef50){if(!_0xafef50)return null;_0x15d0a5[_0x3ed3('0x2a')][_0x3ed3('0x66')]=_0xafef50;return _0x15d0a5;})[_0x3ed3('0x22')](function(_0xdbce56){if(_0xdbce56){_0xdbce56[_0x3ed3('0x2a')][_0x3ed3('0x88')]=util[_0x3ed3('0x62')](_0x3ed3('0x77'),_0xafc625[_0x3ed3('0x65')][_0x3ed3('0x3b')]);_0xdbce56[_0x3ed3('0x2a')][_0x3ed3('0x78')]=_0x15d0a5[_0x3ed3('0x78')];_0xdbce56['message']['motionChannel']=_0x15d0a5[_0x3ed3('0x78')];_0xdbce56[_0x3ed3('0x2a')][_0x3ed3('0x7a')]='reject';respondWithRpcPromise(_0x3ed3('0x7c'),_0x3ed3('0x7c'),{'event':_0x3ed3('0x89'),'message':_['merge'](_0x15d0a5['message'],JSON['parse'](_0x15d0a5[_0x3ed3('0x6b')][_0x3ed3('0x8a')]))},client9002);return _0x15d0a5;}return null;})[_0x3ed3('0x22')](respondWithResult(_0x5258ce,null))[_0x3ed3('0x2c')](handleError(_0x5258ce,null));}; \ No newline at end of file +var _0x3a71=['info','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','contact','User','email','internal','manual','interface','SIP/%s','channel','event','accept','EventManager','acceptmessage','parse','formData','reject','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','Sequelize','SELECT','motionChannel','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','to-csv','ejs','fs-extra','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','redis','localhost','./chatMessage.socket','jayson/promise','client','http','request','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','then','destroy','end','stack','name','send','index','map','ChatMessage','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','update','describe','chat-interactions','chat','read','format','UserId','user','agent','ChatInteraction','YYYY-MM-DD\x20HH:mm:ss','interaction','get'];(function(_0x549cc0,_0x4b244d){var _0x1bfc0f=function(_0x2660d0){while(--_0x2660d0){_0x549cc0['push'](_0x549cc0['shift']());}};_0x1bfc0f(++_0x4b244d);}(_0x3a71,0x1ad));var _0x13a7=function(_0x27d7b9,_0x4c1554){_0x27d7b9=_0x27d7b9-0x0;var _0x1a8dd0=_0x3a71[_0x27d7b9];return _0x1a8dd0;};'use strict';var emlformat=require(_0x13a7('0x0'));var rimraf=require(_0x13a7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x13a7('0x2'));var rp=require(_0x13a7('0x3'));var moment=require('moment');var BPromise=require(_0x13a7('0x4'));var Mustache=require('mustache');var util=require(_0x13a7('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x13a7('0x6'));var ejs=require(_0x13a7('0x7'));var fs=require('fs');var fs_extra=require(_0x13a7('0x8'));var _=require(_0x13a7('0x9'));var squel=require(_0x13a7('0xa'));var crypto=require(_0x13a7('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x13a7('0xc'));var toCsv=require('to-csv');var querystring=require(_0x13a7('0xd'));var Papa=require(_0x13a7('0xe'));var Redis=require('ioredis');var authService=require(_0x13a7('0xf'));var qs=require(_0x13a7('0x10'));var as=require(_0x13a7('0x11'));var hardwareService=require(_0x13a7('0x12'));var logger=require(_0x13a7('0x13'))(_0x13a7('0x14'));var utils=require(_0x13a7('0x15'));var config=require(_0x13a7('0x16'));var licenseUtil=require(_0x13a7('0x17'));var db=require(_0x13a7('0x18'))['db'];config[_0x13a7('0x19')]=_['defaults'](config['redis'],{'host':_0x13a7('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x13a7('0x19')]));require(_0x13a7('0x1b'))['register'](socket);var jayson=require(_0x13a7('0x1c'));var client=jayson[_0x13a7('0x1d')][_0x13a7('0x1e')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2affd4,_0x2f2282,_0x58ebcb,_0x3c845e){return new BPromise(function(_0x334657,_0x2ff99a){var _0x1ee96f=_0x3c845e||client;return _0x1ee96f[_0x13a7('0x1f')](_0x2affd4,_0x58ebcb)['then'](function(_0x2a0517){logger['info'](_0x13a7('0x20'),_0x2f2282,'request\x20sent');logger[_0x13a7('0x21')](_0x13a7('0x22'),_0x2f2282,_0x13a7('0x23'),JSON[_0x13a7('0x24')](_0x2a0517));if(_0x2a0517[_0x13a7('0x25')]){if(_0x2a0517[_0x13a7('0x25')][_0x13a7('0x26')]===0x1f4){logger[_0x13a7('0x25')](_0x13a7('0x20'),_0x2f2282,_0x2a0517[_0x13a7('0x25')][_0x13a7('0x27')]);return _0x2ff99a(_0x2a0517['error'][_0x13a7('0x27')]);}logger[_0x13a7('0x25')](_0x13a7('0x20'),_0x2f2282,_0x2a0517[_0x13a7('0x25')][_0x13a7('0x27')]);return _0x334657(_0x2a0517['error']['message']);}else{logger['info'](_0x13a7('0x20'),_0x2f2282,_0x13a7('0x23'));_0x334657(_0x2a0517[_0x13a7('0x28')][_0x13a7('0x27')]);}})['catch'](function(_0x17a2f1){logger[_0x13a7('0x25')](_0x13a7('0x20'),_0x2f2282,_0x17a2f1);_0x2ff99a(_0x17a2f1);});});}function respondWithStatusCode(_0x58ca1f,_0xf6b27){_0xf6b27=_0xf6b27||0xcc;return function(_0x4f0b2e){if(_0x4f0b2e){return _0x58ca1f[_0x13a7('0x29')](_0xf6b27);}return _0x58ca1f[_0x13a7('0x2a')](_0xf6b27)['end']();};}function respondWithResult(_0x571e2d,_0x51b48c){_0x51b48c=_0x51b48c||0xc8;return function(_0x485e4f){if(_0x485e4f){return _0x571e2d[_0x13a7('0x2a')](_0x51b48c)[_0x13a7('0x2b')](_0x485e4f);}};}function respondWithFilteredResult(_0x5a03bb,_0x4e1142){return function(_0x545947){if(_0x545947){var _0x2c9954=typeof _0x4e1142[_0x13a7('0x2c')]===_0x13a7('0x2d')&&typeof _0x4e1142['limit']===_0x13a7('0x2d');var _0x2ce2a6=_0x545947[_0x13a7('0x2e')];var _0x1e4d04=_0x2c9954?0x0:_0x4e1142[_0x13a7('0x2c')];var _0x3e65a9=_0x2c9954?_0x545947[_0x13a7('0x2e')]:_0x4e1142['offset']+_0x4e1142[_0x13a7('0x2f')];var _0x20448d;if(_0x3e65a9>=_0x2ce2a6){_0x3e65a9=_0x2ce2a6;_0x20448d=0xc8;}else{_0x20448d=0xce;}_0x5a03bb[_0x13a7('0x2a')](_0x20448d);return _0x5a03bb[_0x13a7('0x30')](_0x13a7('0x31'),_0x1e4d04+'-'+_0x3e65a9+'/'+_0x2ce2a6)[_0x13a7('0x2b')](_0x545947);}return null;};}function patchUpdates(_0x502a9a){return function(_0x34d58e){try{jsonpatch[_0x13a7('0x32')](_0x34d58e,_0x502a9a,!![]);}catch(_0x2a5072){return BPromise['reject'](_0x2a5072);}return _0x34d58e['save']();};}function saveUpdates(_0x7d854e,_0x1c44e5){return function(_0x1be5da){if(_0x1be5da){return _0x1be5da['update'](_0x7d854e)[_0x13a7('0x33')](function(_0x1aaad8){return _0x1aaad8;});}return null;};}function removeEntity(_0xcb0fae,_0x1cc7a8){return function(_0x4a1c33){if(_0x4a1c33){return _0x4a1c33[_0x13a7('0x34')]()[_0x13a7('0x33')](function(){_0xcb0fae[_0x13a7('0x2a')](0xcc)[_0x13a7('0x35')]();});}};}function handleEntityNotFound(_0x1ae2ea,_0x549497){return function(_0xfdae39){if(!_0xfdae39){_0x1ae2ea['sendStatus'](0x194);}return _0xfdae39;};}function handleError(_0x3d2f69,_0x54aff0){_0x54aff0=_0x54aff0||0x1f4;return function(_0x58be94){logger[_0x13a7('0x25')](_0x58be94[_0x13a7('0x36')]);if(_0x58be94[_0x13a7('0x37')]){delete _0x58be94[_0x13a7('0x37')];}_0x3d2f69['status'](_0x54aff0)[_0x13a7('0x38')](_0x58be94);};}exports[_0x13a7('0x39')]=function(_0x5ed4de,_0x295798){var _0x4ba208={},_0x4f02c4={},_0x5b7550={'count':0x0,'rows':[]};var _0xba47d6=_[_0x13a7('0x3a')](db[_0x13a7('0x3b')][_0x13a7('0x3c')],function(_0x1cf607){return{'name':_0x1cf607[_0x13a7('0x3d')],'type':_0x1cf607['type']['key']};});_0x4f02c4[_0x13a7('0x3e')]=_[_0x13a7('0x3a')](_0xba47d6,_0x13a7('0x37'));_0x4f02c4[_0x13a7('0x3f')]=_['keys'](_0x5ed4de[_0x13a7('0x3f')]);_0x4f02c4[_0x13a7('0x40')]=_[_0x13a7('0x41')](_0x4f02c4[_0x13a7('0x3e')],_0x4f02c4[_0x13a7('0x3f')]);_0x4ba208[_0x13a7('0x42')]=_[_0x13a7('0x41')](_0x4f02c4[_0x13a7('0x3e')],qs[_0x13a7('0x43')](_0x5ed4de[_0x13a7('0x3f')]['fields']));_0x4ba208[_0x13a7('0x42')]=_0x4ba208['attributes'][_0x13a7('0x44')]?_0x4ba208[_0x13a7('0x42')]:_0x4f02c4['model'];if(!_0x5ed4de['query'][_0x13a7('0x45')](_0x13a7('0x46'))){_0x4ba208['limit']=qs[_0x13a7('0x2f')](_0x5ed4de[_0x13a7('0x3f')]['limit']);_0x4ba208['offset']=qs[_0x13a7('0x2c')](_0x5ed4de[_0x13a7('0x3f')][_0x13a7('0x2c')]);}_0x4ba208[_0x13a7('0x47')]=qs[_0x13a7('0x48')](_0x5ed4de['query']['sort']);_0x4ba208['where']=qs[_0x13a7('0x40')](_['pick'](_0x5ed4de[_0x13a7('0x3f')],_0x4f02c4[_0x13a7('0x40')]),_0xba47d6);if(_0x5ed4de[_0x13a7('0x3f')]['filter']){_0x4ba208[_0x13a7('0x49')]=_[_0x13a7('0x4a')](_0x4ba208[_0x13a7('0x49')],{'$or':_[_0x13a7('0x3a')](_0xba47d6,function(_0x15b1b7){if(_0x15b1b7[_0x13a7('0x4b')]!==_0x13a7('0x4c')){var _0x4c8e02={};_0x4c8e02[_0x15b1b7['name']]={'$like':'%'+_0x5ed4de[_0x13a7('0x3f')][_0x13a7('0x4d')]+'%'};return _0x4c8e02;}})});}_0x4ba208=_[_0x13a7('0x4a')]({},_0x4ba208,_0x5ed4de[_0x13a7('0x4e')]);var _0x220e10={'where':_0x4ba208[_0x13a7('0x49')]};return db['ChatMessage'][_0x13a7('0x2e')](_0x220e10)['then'](function(_0x3ec86d){_0x5b7550['count']=_0x3ec86d;if(_0x5ed4de[_0x13a7('0x3f')][_0x13a7('0x4f')]){_0x4ba208[_0x13a7('0x50')]=[{'all':!![]}];}return db[_0x13a7('0x3b')][_0x13a7('0x51')](_0x4ba208);})[_0x13a7('0x33')](function(_0x348bfd){_0x5b7550[_0x13a7('0x52')]=_0x348bfd;return _0x5b7550;})[_0x13a7('0x33')](respondWithFilteredResult(_0x295798,_0x4ba208))[_0x13a7('0x53')](handleError(_0x295798,null));};exports[_0x13a7('0x54')]=function(_0x9a2799,_0x48aaa6){var _0x6432bc={'raw':!![],'where':{'id':_0x9a2799[_0x13a7('0x55')]['id']}},_0x58c0a5={};_0x58c0a5[_0x13a7('0x3e')]=_['keys'](db[_0x13a7('0x3b')][_0x13a7('0x3c')]);_0x58c0a5[_0x13a7('0x3f')]=_[_0x13a7('0x56')](_0x9a2799['query']);_0x58c0a5['filters']=_[_0x13a7('0x41')](_0x58c0a5[_0x13a7('0x3e')],_0x58c0a5[_0x13a7('0x3f')]);_0x6432bc[_0x13a7('0x42')]=_[_0x13a7('0x41')](_0x58c0a5['model'],qs[_0x13a7('0x43')](_0x9a2799[_0x13a7('0x3f')][_0x13a7('0x43')]));_0x6432bc['attributes']=_0x6432bc[_0x13a7('0x42')][_0x13a7('0x44')]?_0x6432bc[_0x13a7('0x42')]:_0x58c0a5['model'];if(_0x9a2799['query'][_0x13a7('0x4f')]){_0x6432bc[_0x13a7('0x50')]=[{'all':!![]}];}_0x6432bc=_[_0x13a7('0x4a')]({},_0x6432bc,_0x9a2799[_0x13a7('0x4e')]);return db[_0x13a7('0x3b')][_0x13a7('0x57')](_0x6432bc)[_0x13a7('0x33')](handleEntityNotFound(_0x48aaa6,null))[_0x13a7('0x33')](respondWithResult(_0x48aaa6,null))[_0x13a7('0x53')](handleError(_0x48aaa6,null));};exports[_0x13a7('0x58')]=function(_0xf6cc0c,_0x1ff769){return db[_0x13a7('0x3b')][_0x13a7('0x58')](_0xf6cc0c[_0x13a7('0x59')],{})[_0x13a7('0x33')](respondWithResult(_0x1ff769,0xc9))['catch'](handleError(_0x1ff769,null));};exports[_0x13a7('0x5a')]=function(_0xd7b2d2,_0x3a5c5c){if(_0xd7b2d2[_0x13a7('0x59')]['id']){delete _0xd7b2d2[_0x13a7('0x59')]['id'];}return db[_0x13a7('0x3b')][_0x13a7('0x57')]({'where':{'id':_0xd7b2d2[_0x13a7('0x55')]['id']}})['then'](handleEntityNotFound(_0x3a5c5c,null))[_0x13a7('0x33')](saveUpdates(_0xd7b2d2[_0x13a7('0x59')],null))[_0x13a7('0x33')](respondWithResult(_0x3a5c5c,null))[_0x13a7('0x53')](handleError(_0x3a5c5c,null));};exports[_0x13a7('0x34')]=function(_0x4183cb,_0x194426){return db['ChatMessage'][_0x13a7('0x57')]({'where':{'id':_0x4183cb[_0x13a7('0x55')]['id']}})[_0x13a7('0x33')](handleEntityNotFound(_0x194426,null))[_0x13a7('0x33')](removeEntity(_0x194426,null))['catch'](handleError(_0x194426,null));};exports['describe']=function(_0xc26147,_0x24969e){return db[_0x13a7('0x3b')][_0x13a7('0x5b')]()[_0x13a7('0x33')](respondWithResult(_0x24969e,null))[_0x13a7('0x53')](handleError(_0x24969e,null));};var interaction_log=require(_0x13a7('0x13'))(_0x13a7('0x5c'));exports['accept']=function(_0x1b8250,_0x4867bc,_0x70e9a8){var _0x30c17c={'agent':{},'channel':_0x13a7('0x5d')};if(_0x1b8250[_0x13a7('0x59')]['id']){delete _0x1b8250[_0x13a7('0x59')]['id'];}_0x1b8250[_0x13a7('0x59')][_0x13a7('0x5e')]=!![];_0x1b8250[_0x13a7('0x59')]['readAt']=moment()[_0x13a7('0x5f')]('YYYY-MM-DD\x20HH:mm:ss');_0x1b8250[_0x13a7('0x59')][_0x13a7('0x60')]=_0x1b8250[_0x13a7('0x59')][_0x13a7('0x60')]||_0x1b8250[_0x13a7('0x61')]['id'];_0x30c17c[_0x13a7('0x62')]['id']=_0x1b8250[_0x13a7('0x59')][_0x13a7('0x60')];return db['ChatMessage']['find']({'where':{'id':_0x1b8250[_0x13a7('0x55')]['id'],'UserId':null}})[_0x13a7('0x33')](handleEntityNotFound(_0x4867bc,null))[_0x13a7('0x33')](saveUpdates(_0x1b8250[_0x13a7('0x59')],null))[_0x13a7('0x33')](function(_0x9832a){if(_0x9832a){_0x30c17c[_0x13a7('0x27')]=_0x9832a['get']({'plain':!![]});return db[_0x13a7('0x63')][_0x13a7('0x57')]({'where':{'id':_0x9832a['ChatInteractionId']}});}return null;})[_0x13a7('0x33')](handleEntityNotFound(_0x4867bc,null))[_0x13a7('0x33')](function(_0x1b969a){if(_0x1b969a){return _0x1b969a['update']({'UserId':_0x1b8250['body'][_0x13a7('0x60')],'read1stAt':_['isNil'](_0x1b969a['read1stAt'])?moment()['format'](_0x13a7('0x64')):undefined});}return null;})[_0x13a7('0x33')](function(_0x571d98){if(_0x571d98){_0x30c17c[_0x13a7('0x65')]=_0x571d98[_0x13a7('0x66')]({'plain':!![]});interaction_log[_0x13a7('0x67')](_0x13a7('0x68'),_0x1b8250['user']['id'],_0x1b8250[_0x13a7('0x61')][_0x13a7('0x37')],_0x1b8250[_0x13a7('0x61')][_0x13a7('0x69')],_0x30c17c[_0x13a7('0x65')]['id'],_0x1b8250[_0x13a7('0x59')]?JSON['stringify'](_0x1b8250[_0x13a7('0x59')]):_0x13a7('0x6a'));return respondWithRpcPromise(_0x13a7('0x6b'),_0x13a7('0x6c'),_0x30c17c);}return null;})[_0x13a7('0x33')](function(_0x4be950){var _0x379cf5=_0x13a7('0x6d')+_0x4be950[_0x13a7('0x27')][_0x13a7('0x6e')];return db[_0x13a7('0x6f')]['query'](_0x379cf5,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]})[_0x13a7('0x33')](function(_0x523c08){return _0x523c08;});})[_0x13a7('0x33')](function(_0x38dde4){if(_0x38dde4){_0x30c17c[_0x13a7('0x27')][_0x13a7('0x70')]=_0x38dde4[0x0];if(!_0x1b8250[_0x13a7('0x59')][_0x13a7('0x60')])return;return db[_0x13a7('0x71')]['find']({'where':{'id':_0x1b8250[_0x13a7('0x59')][_0x13a7('0x60')],'role':'agent'},'attributes':['id',_0x13a7('0x37'),'fullname',_0x13a7('0x72'),_0x13a7('0x73')],'raw':!![]});}return null;})[_0x13a7('0x33')](function(_0x1bd698){if(!_0x1bd698)return null;_0x30c17c[_0x13a7('0x27')][_0x13a7('0x62')]=_0x1bd698;return _0x30c17c;})[_0x13a7('0x33')](function(_0x492827){if(_0x492827){if(_0x1b8250[_0x13a7('0x59')][_0x13a7('0x74')]){_0x30c17c[_0x13a7('0x27')][_0x13a7('0x75')]=util[_0x13a7('0x5f')](_0x13a7('0x76'),_0x1b8250[_0x13a7('0x61')]['name']);_0x30c17c[_0x13a7('0x27')][_0x13a7('0x77')]=_0x30c17c[_0x13a7('0x77')];_0x30c17c['message']['motionChannel']=_0x30c17c['channel'];_0x30c17c['message'][_0x13a7('0x78')]=_0x13a7('0x79');return respondWithRpcPromise(_0x13a7('0x7a'),_0x13a7('0x7a'),{'event':_0x13a7('0x7b'),'message':_['merge'](_0x30c17c[_0x13a7('0x27')],JSON[_0x13a7('0x7c')](_0x30c17c['interaction'][_0x13a7('0x7d')]))},client9002)[_0x13a7('0x33')](function(){return _0x30c17c;});}return _0x30c17c;}return null;})[_0x13a7('0x33')](respondWithResult(_0x4867bc,null))['catch'](handleError(_0x4867bc,null));};var interaction_log=require('../../config/logger')(_0x13a7('0x5c'));exports[_0x13a7('0x7e')]=function(_0x30b48f,_0x3c3ee3,_0x5b6854){var _0x4c3016={'agent':{},'channel':'chat'};if(_0x30b48f[_0x13a7('0x59')]['id']){delete _0x30b48f[_0x13a7('0x59')]['id'];}_0x30b48f[_0x13a7('0x59')]['UserId']=_0x30b48f[_0x13a7('0x59')][_0x13a7('0x60')]||_0x30b48f[_0x13a7('0x61')]['id'];_0x4c3016['agent']['id']=_0x30b48f[_0x13a7('0x59')][_0x13a7('0x60')];return db[_0x13a7('0x3b')][_0x13a7('0x57')]({'where':{'id':_0x30b48f['params']['id'],'UserId':null}})[_0x13a7('0x33')](handleEntityNotFound(_0x3c3ee3,null))[_0x13a7('0x33')](function(_0xb8444){if(_0xb8444){_0x4c3016[_0x13a7('0x27')]=_0xb8444[_0x13a7('0x66')]({'plain':!![]});return db[_0x13a7('0x63')][_0x13a7('0x57')]({'where':{'id':_0xb8444['ChatInteractionId']}});}return null;})[_0x13a7('0x33')](handleEntityNotFound(_0x3c3ee3,null))[_0x13a7('0x33')](function(_0x4039a4){if(_0x4039a4){_0x4c3016[_0x13a7('0x65')]=_0x4039a4[_0x13a7('0x66')]({'plain':!![]});interaction_log[_0x13a7('0x67')](_0x13a7('0x7f'),_0x30b48f[_0x13a7('0x61')]['id'],_0x30b48f[_0x13a7('0x61')][_0x13a7('0x37')],_0x30b48f[_0x13a7('0x61')]['role'],_0x4c3016['interaction']['id'],_0x30b48f[_0x13a7('0x59')]?JSON[_0x13a7('0x24')](_0x30b48f[_0x13a7('0x59')]):_0x13a7('0x6a'));return respondWithRpcPromise(_0x13a7('0x80'),_0x13a7('0x81'),_0x4c3016);}return null;})[_0x13a7('0x33')](function(_0xe4f503){var _0x4c69bb=_0x13a7('0x6d')+_0xe4f503[_0x13a7('0x27')][_0x13a7('0x6e')];return db['sequelize'][_0x13a7('0x3f')](_0x4c69bb,{'type':db[_0x13a7('0x82')]['QueryTypes'][_0x13a7('0x83')],'raw':!![]})['then'](function(_0x5a2412){return _0x5a2412;});})[_0x13a7('0x33')](function(_0x287634){if(_0x287634){_0x4c3016['message']['contact']=_0x287634[0x0];if(!_0x30b48f[_0x13a7('0x59')][_0x13a7('0x60')])return;return db[_0x13a7('0x71')][_0x13a7('0x57')]({'where':{'id':_0x30b48f[_0x13a7('0x59')][_0x13a7('0x60')],'role':_0x13a7('0x62')},'attributes':['id','name','fullname',_0x13a7('0x72'),_0x13a7('0x73')],'raw':!![]});}return null;})[_0x13a7('0x33')](function(_0x45ebad){if(!_0x45ebad)return null;_0x4c3016['message']['agent']=_0x45ebad;return _0x4c3016;})['then'](function(_0xd16f1c){if(_0xd16f1c){_0xd16f1c[_0x13a7('0x27')]['interface']=util[_0x13a7('0x5f')](_0x13a7('0x76'),_0x30b48f[_0x13a7('0x61')][_0x13a7('0x37')]);_0xd16f1c['message']['channel']=_0x4c3016[_0x13a7('0x77')];_0xd16f1c['message'][_0x13a7('0x84')]=_0x4c3016[_0x13a7('0x77')];_0xd16f1c[_0x13a7('0x27')]['event']=_0x13a7('0x7e');respondWithRpcPromise(_0x13a7('0x7a'),'EventManager',{'event':'rejectmessage','message':_[_0x13a7('0x4a')](_0x4c3016[_0x13a7('0x27')],JSON[_0x13a7('0x7c')](_0x4c3016[_0x13a7('0x65')][_0x13a7('0x7d')]))},client9002);return _0x4c3016;}return null;})[_0x13a7('0x33')](respondWithResult(_0x3c3ee3,null))['catch'](handleError(_0x3c3ee3,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index c4f9c3c..d85454b 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 _0x77cd=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','ChatMessage'];(function(_0x3f5355,_0x2a9b81){var _0x36b3c4=function(_0x10716d){while(--_0x10716d){_0x3f5355['push'](_0x3f5355['shift']());}};_0x36b3c4(++_0x2a9b81);}(_0x77cd,0xc4));var _0xd77c=function(_0x47803a,_0xb16f7f){_0x47803a=_0x47803a-0x0;var _0x56ea24=_0x77cd[_0x47803a];return _0x56ea24;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0xd77c('0x0'))['db'][_0xd77c('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xd77c('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd77c('0x3'),'afterDestroy':_0xd77c('0x4')};function emitEvent(_0x45174a){return function(_0xf2b13f,_0x1cdeb6,_0x34b10e){ChatMessageEvents[_0xd77c('0x5')](_0x45174a+':'+_0xf2b13f['id'],_0xf2b13f);ChatMessageEvents[_0xd77c('0x5')](_0x45174a,_0xf2b13f);_0x34b10e(null);};}for(var e in events){if(events[_0xd77c('0x6')](e)){var event=events[e];ChatMessage[_0xd77c('0x7')](e,emitEvent(event));}}module[_0xd77c('0x8')]=ChatMessageEvents; \ No newline at end of file +var _0x1d60=['save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatMessage','setMaxListeners'];(function(_0x50b57f,_0x2f01e9){var _0x4386fd=function(_0x9aa517){while(--_0x9aa517){_0x50b57f['push'](_0x50b57f['shift']());}};_0x4386fd(++_0x2f01e9);}(_0x1d60,0x100));var _0x01d6=function(_0x11116a,_0x462932){_0x11116a=_0x11116a-0x0;var _0x35dbc7=_0x1d60[_0x11116a];return _0x35dbc7;};'use strict';var EventEmitter=require(_0x01d6('0x0'));var ChatMessage=require(_0x01d6('0x1'))['db'][_0x01d6('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x01d6('0x3')](0x0);var events={'afterCreate':_0x01d6('0x4'),'afterUpdate':_0x01d6('0x5'),'afterDestroy':'remove'};function emitEvent(_0x2a9ae6){return function(_0x3449a8,_0x1accec,_0x10aa7c){ChatMessageEvents[_0x01d6('0x6')](_0x2a9ae6+':'+_0x3449a8['id'],_0x3449a8);ChatMessageEvents[_0x01d6('0x6')](_0x2a9ae6,_0x3449a8);_0x10aa7c(null);};}for(var e in events){if(events[_0x01d6('0x7')](e)){var event=events[e];ChatMessage[_0x01d6('0x8')](e,emitEvent(event));}}module[_0x01d6('0x9')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index f7eb424..c9b43cd 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 _0xc5da=['toLowerCase','out','secret','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','then','update','createdAt','catch','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','exports','define','ChatMessage','body','FULLTEXT','models','direction'];(function(_0x30e469,_0x5de53c){var _0xf75061=function(_0x16a336){while(--_0x16a336){_0x30e469['push'](_0x30e469['shift']());}};_0xf75061(++_0x5de53c);}(_0xc5da,0x1b2));var _0xac5d=function(_0x4f606d,_0x4acb05){_0x4f606d=_0x4f606d-0x0;var _0x3e7d17=_0xc5da[_0x4f606d];return _0x3e7d17;};'use strict';var _=require(_0xac5d('0x0'));var util=require('util');var logger=require(_0xac5d('0x1'))('api');var moment=require(_0xac5d('0x2'));var BPromise=require(_0xac5d('0x3'));var rp=require(_0xac5d('0x4'));var fs=require('fs');var path=require(_0xac5d('0x5'));var rimraf=require('rimraf');var config=require(_0xac5d('0x6'));var attributes=require('./chatMessage.attributes');module[_0xac5d('0x7')]=function(_0x3b0203,_0xc57a4){return _0x3b0203[_0xac5d('0x8')](_0xac5d('0x9'),attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':[_0xac5d('0xa')],'type':_0xac5d('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1be9ac,_0x559aea,_0x1fb4f9){var _0xf533ec=_0x3b0203[_0xac5d('0xc')];var _0x457de4=_0x1be9ac['get']({'plain':!![]});if(_0x457de4[_0xac5d('0xd')][_0xac5d('0xe')]()==='in'||_0x457de4['direction'][_0xac5d('0xe')]()===_0xac5d('0xf')&&!_0x457de4[_0xac5d('0x10')]&&!_[_0xac5d('0x11')](_0x457de4[_0xac5d('0x12')])){_0xf533ec[_0xac5d('0x13')][_0xac5d('0x14')]({'where':{'id':_0x457de4[_0xac5d('0x15')]}})[_0xac5d('0x16')](function(_0x559c5a){if(_0x559c5a){_0x559c5a[_0xac5d('0x17')]({'lastMsgAt':_0x457de4[_0xac5d('0x18')],'lastMsgDirection':_0x457de4[_0xac5d('0xd')][_0xac5d('0xe')]()});}})[_0xac5d('0x19')](function(_0x22e514){console['error'](_0x22e514);});}_0x1fb4f9();}},'charset':_0xac5d('0x1a'),'collate':_0xac5d('0x1b')});}; \ No newline at end of file +var _0xee40=['out','UserId','findOne','ChatInteractionId','then','update','createdAt','direction','catch','error','utf8mb4_unicode_ci','util','api','moment','bluebird','path','./chatMessage.attributes','define','chat_messages','FULLTEXT','models','get','toLowerCase'];(function(_0x219aa7,_0x5eec5e){var _0x1e38e4=function(_0x465f12){while(--_0x465f12){_0x219aa7['push'](_0x219aa7['shift']());}};_0x1e38e4(++_0x5eec5e);}(_0xee40,0x136));var _0x0ee4=function(_0x5bf3c1,_0xc246be){_0x5bf3c1=_0x5bf3c1-0x0;var _0x59d4d1=_0xee40[_0x5bf3c1];return _0x59d4d1;};'use strict';var _=require('lodash');var util=require(_0x0ee4('0x0'));var logger=require('../../config/logger')(_0x0ee4('0x1'));var moment=require(_0x0ee4('0x2'));var BPromise=require(_0x0ee4('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0ee4('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0ee4('0x5'));module['exports']=function(_0x3e2a7e,_0x48564b){return _0x3e2a7e[_0x0ee4('0x6')]('ChatMessage',attributes,{'tableName':_0x0ee4('0x7'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':['body'],'type':_0x0ee4('0x8')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x23f1e9,_0x33ba38,_0x36acc2){var _0x30af4b=_0x3e2a7e[_0x0ee4('0x9')];var _0x29c1d5=_0x23f1e9[_0x0ee4('0xa')]({'plain':!![]});if(_0x29c1d5['direction'][_0x0ee4('0xb')]()==='in'||_0x29c1d5['direction'][_0x0ee4('0xb')]()===_0x0ee4('0xc')&&!_0x29c1d5['secret']&&!_['isNil'](_0x29c1d5[_0x0ee4('0xd')])){_0x30af4b['ChatInteraction'][_0x0ee4('0xe')]({'where':{'id':_0x29c1d5[_0x0ee4('0xf')]}})[_0x0ee4('0x10')](function(_0x338d62){if(_0x338d62){_0x338d62[_0x0ee4('0x11')]({'lastMsgAt':_0x29c1d5[_0x0ee4('0x12')],'lastMsgDirection':_0x29c1d5[_0x0ee4('0x13')][_0x0ee4('0xb')]()});}})[_0x0ee4('0x14')](function(_0x2cd821){console[_0x0ee4('0x15')](_0x2cd821);});}_0x36acc2();}},'charset':'utf8mb4','collate':_0x0ee4('0x16')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index efad36e..25f33a3 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 _0x5388=['then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateChatMessage','ChatMessage','create','options','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register'];(function(_0x5817e3,_0x98056c){var _0x4de9a7=function(_0x5659ca){while(--_0x5659ca){_0x5817e3['push'](_0x5817e3['shift']());}};_0x4de9a7(++_0x98056c);}(_0x5388,0x159));var _0x8538=function(_0x216972,_0x25bc73){_0x216972=_0x216972-0x0;var _0x24e239=_0x5388[_0x216972];return _0x24e239;};'use strict';var _=require('lodash');var util=require(_0x8538('0x0'));var moment=require('moment');var BPromise=require(_0x8538('0x1'));var rs=require(_0x8538('0x2'));var fs=require('fs');var Redis=require(_0x8538('0x3'));var db=require(_0x8538('0x4'))['db'];var utils=require(_0x8538('0x5'));var logger=require(_0x8538('0x6'))(_0x8538('0x7'));var config=require(_0x8538('0x8'));var jayson=require(_0x8538('0x9'));var client=jayson[_0x8538('0xa')][_0x8538('0xb')]({'port':0x232a});config[_0x8538('0xc')]=_[_0x8538('0xd')](config[_0x8538('0xc')],{'host':_0x8538('0xe'),'port':0x18eb});var socket=require(_0x8538('0xf'))(new Redis(config[_0x8538('0xc')]));require(_0x8538('0x10'))[_0x8538('0x11')](socket);function respondWithRpcPromise(_0x4cba4b,_0x15d3ba,_0x166cb2){return new BPromise(function(_0x1fbfeb,_0x765a6f){return client['request'](_0x4cba4b,_0x166cb2)[_0x8538('0x12')](function(_0x1f9727){logger[_0x8538('0x13')](_0x8538('0x14'),_0x15d3ba,_0x8538('0x15'));logger[_0x8538('0x16')](_0x8538('0x17'),_0x15d3ba,_0x8538('0x15'),JSON[_0x8538('0x18')](_0x1f9727));if(_0x1f9727['error']){if(_0x1f9727[_0x8538('0x19')]['code']===0x1f4){logger[_0x8538('0x19')]('ChatMessage,\x20%s,\x20%s',_0x15d3ba,_0x1f9727[_0x8538('0x19')]['message']);return _0x765a6f(_0x1f9727['error'][_0x8538('0x1a')]);}logger['error'](_0x8538('0x14'),_0x15d3ba,_0x1f9727[_0x8538('0x19')]['message']);return _0x1fbfeb(_0x1f9727[_0x8538('0x19')][_0x8538('0x1a')]);}else{logger[_0x8538('0x13')]('ChatMessage,\x20%s,\x20%s',_0x15d3ba,_0x8538('0x15'));_0x1fbfeb(_0x1f9727[_0x8538('0x1b')][_0x8538('0x1a')]);}})[_0x8538('0x1c')](function(_0x54bab0){logger[_0x8538('0x19')](_0x8538('0x14'),_0x15d3ba,_0x54bab0);_0x765a6f(_0x54bab0);});});}exports[_0x8538('0x1d')]=function(_0x2c3f76){var _0x36ca23=this;return new Promise(function(_0x110ac7,_0x11c1e8){return db[_0x8538('0x1e')][_0x8538('0x1f')](_0x2c3f76['body'],{'raw':_0x2c3f76[_0x8538('0x20')]?_0x2c3f76[_0x8538('0x20')]['raw']===undefined?!![]:![]:!![]})[_0x8538('0x12')](function(_0x4091bd){logger['info'](_0x8538('0x1d'),_0x2c3f76);logger[_0x8538('0x16')](_0x8538('0x1d'),_0x2c3f76,JSON[_0x8538('0x18')](_0x4091bd));_0x110ac7(_0x4091bd);})[_0x8538('0x1c')](function(_0xa4fe00){logger[_0x8538('0x19')](_0x8538('0x1d'),_0xa4fe00[_0x8538('0x1a')],_0x2c3f76);_0x11c1e8(_0x36ca23['error'](0x1f4,_0xa4fe00[_0x8538('0x1a')]));});});}; \ No newline at end of file +var _0x7ddf=['localhost','socket.io-emitter','./chatMessage.socket','register','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateChatMessage','ChatMessage','create','body','raw','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis'];(function(_0x782d69,_0x1274a3){var _0x31c737=function(_0x51ce26){while(--_0x51ce26){_0x782d69['push'](_0x782d69['shift']());}};_0x31c737(++_0x1274a3);}(_0x7ddf,0x1e4));var _0xf7dd=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0x7ddf[_0x173d7e];return _0x2220d6;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf7dd('0x0'));var fs=require('fs');var Redis=require(_0xf7dd('0x1'));var db=require(_0xf7dd('0x2'))['db'];var utils=require(_0xf7dd('0x3'));var logger=require(_0xf7dd('0x4'))(_0xf7dd('0x5'));var config=require('../../config/environment');var jayson=require(_0xf7dd('0x6'));var client=jayson['client'][_0xf7dd('0x7')]({'port':0x232a});config[_0xf7dd('0x8')]=_['defaults'](config['redis'],{'host':_0xf7dd('0x9'),'port':0x18eb});var socket=require(_0xf7dd('0xa'))(new Redis(config[_0xf7dd('0x8')]));require(_0xf7dd('0xb'))[_0xf7dd('0xc')](socket);function respondWithRpcPromise(_0x680c93,_0x38228b,_0x2531ca){return new BPromise(function(_0x34f7f0,_0x20e53d){return client['request'](_0x680c93,_0x2531ca)[_0xf7dd('0xd')](function(_0x41c8a0){logger[_0xf7dd('0xe')](_0xf7dd('0xf'),_0x38228b,_0xf7dd('0x10'));logger['debug'](_0xf7dd('0x11'),_0x38228b,'request\x20sent',JSON[_0xf7dd('0x12')](_0x41c8a0));if(_0x41c8a0[_0xf7dd('0x13')]){if(_0x41c8a0[_0xf7dd('0x13')][_0xf7dd('0x14')]===0x1f4){logger[_0xf7dd('0x13')](_0xf7dd('0xf'),_0x38228b,_0x41c8a0[_0xf7dd('0x13')][_0xf7dd('0x15')]);return _0x20e53d(_0x41c8a0[_0xf7dd('0x13')]['message']);}logger[_0xf7dd('0x13')](_0xf7dd('0xf'),_0x38228b,_0x41c8a0[_0xf7dd('0x13')][_0xf7dd('0x15')]);return _0x34f7f0(_0x41c8a0[_0xf7dd('0x13')][_0xf7dd('0x15')]);}else{logger['info']('ChatMessage,\x20%s,\x20%s',_0x38228b,_0xf7dd('0x10'));_0x34f7f0(_0x41c8a0[_0xf7dd('0x16')][_0xf7dd('0x15')]);}})[_0xf7dd('0x17')](function(_0xf85359){logger[_0xf7dd('0x13')](_0xf7dd('0xf'),_0x38228b,_0xf85359);_0x20e53d(_0xf85359);});});}exports[_0xf7dd('0x18')]=function(_0x501c6b){var _0x348a1a=this;return new Promise(function(_0x438764,_0x9b04e){return db[_0xf7dd('0x19')][_0xf7dd('0x1a')](_0x501c6b[_0xf7dd('0x1b')],{'raw':_0x501c6b['options']?_0x501c6b['options'][_0xf7dd('0x1c')]===undefined?!![]:![]:!![]})[_0xf7dd('0xd')](function(_0x273ab8){logger[_0xf7dd('0xe')](_0xf7dd('0x18'),_0x501c6b);logger['debug'](_0xf7dd('0x18'),_0x501c6b,JSON[_0xf7dd('0x12')](_0x273ab8));_0x438764(_0x273ab8);})[_0xf7dd('0x17')](function(_0xbd36f7){logger[_0xf7dd('0x13')](_0xf7dd('0x18'),_0xbd36f7['message'],_0x501c6b);_0x9b04e(_0x348a1a[_0xf7dd('0x13')](0x1f4,_0xbd36f7[_0xf7dd('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 1359950..cccb80d 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 _0x979e=['update','emit','register','length','chatMessage:','./chatMessage.events','save','remove'];(function(_0xc84f3d,_0x2e4385){var _0x33f88e=function(_0x50f4a6){while(--_0x50f4a6){_0xc84f3d['push'](_0xc84f3d['shift']());}};_0x33f88e(++_0x2e4385);}(_0x979e,0x195));var _0xe979=function(_0x13a40c,_0x382920){_0x13a40c=_0x13a40c-0x0;var _0x4c94ad=_0x979e[_0x13a40c];return _0x4c94ad;};'use strict';var ChatMessageEvents=require(_0xe979('0x0'));var events=[_0xe979('0x1'),_0xe979('0x2'),_0xe979('0x3')];function createListener(_0x5ce889,_0x10fb90){return function(_0x47321a){_0x10fb90[_0xe979('0x4')](_0x5ce889,_0x47321a);};}function removeListener(_0x3b4b06,_0x2d62dd){return function(){ChatMessageEvents['removeListener'](_0x3b4b06,_0x2d62dd);};}exports[_0xe979('0x5')]=function(_0x580e20){for(var _0x1a0d35=0x0,_0x13a9ee=events[_0xe979('0x6')];_0x1a0d35<_0x13a9ee;_0x1a0d35++){var _0xc63524=events[_0x1a0d35];var _0xc79c06=createListener(_0xe979('0x7')+_0xc63524,_0x580e20);ChatMessageEvents['on'](_0xc63524,_0xc79c06);}}; \ No newline at end of file +var _0x383d=['register','length','remove','update','emit','removeListener'];(function(_0x5e81e3,_0x45ed0a){var _0x4ce3eb=function(_0x2e073a){while(--_0x2e073a){_0x5e81e3['push'](_0x5e81e3['shift']());}};_0x4ce3eb(++_0x45ed0a);}(_0x383d,0x86));var _0xd383=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x383d[_0x20a584];return _0x4b41a8;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=['save',_0xd383('0x0'),_0xd383('0x1')];function createListener(_0x35486e,_0x559dd3){return function(_0x7554ef){_0x559dd3[_0xd383('0x2')](_0x35486e,_0x7554ef);};}function removeListener(_0x319f67,_0x3439dd){return function(){ChatMessageEvents[_0xd383('0x3')](_0x319f67,_0x3439dd);};}exports[_0xd383('0x4')]=function(_0x5a0b1d){for(var _0xc64e9b=0x0,_0x30ba82=events[_0xd383('0x5')];_0xc64e9b<_0x30ba82;_0xc64e9b++){var _0x470d8d=events[_0xc64e9b];var _0xffa778=createListener('chatMessage:'+_0x470d8d,_0x5a0b1d);ChatMessageEvents['on'](_0x470d8d,_0xffa778);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 1d83f24..228ae52 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 _0x3caf=['fs-extra','../../config/environment','./chatMessage.controller','get','isAuthenticated','/describe','describe','/:id','post','tracked','chat','chatmessage:create','create','update','/:id/accept','accept','put','/:id/reject','delete','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3caf,0x1cf));var _0xf3ca=function(_0x207b87,_0x3266e5){_0x207b87=_0x207b87-0x0;var _0xbc46ff=_0x3caf[_0x207b87];return _0xbc46ff;};'use strict';var multer=require('multer');var util=require(_0xf3ca('0x0'));var path=require(_0xf3ca('0x1'));var timeout=require(_0xf3ca('0x2'));var express=require(_0xf3ca('0x3'));var router=express[_0xf3ca('0x4')]();var fs_extra=require(_0xf3ca('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf3ca('0x6'));var controller=require(_0xf3ca('0x7'));router[_0xf3ca('0x8')]('/',auth[_0xf3ca('0x9')](),controller['index']);router[_0xf3ca('0x8')](_0xf3ca('0xa'),auth['isAuthenticated'](),controller[_0xf3ca('0xb')]);router[_0xf3ca('0x8')](_0xf3ca('0xc'),auth[_0xf3ca('0x9')](),controller['show']);router[_0xf3ca('0xd')]('/',auth[_0xf3ca('0x9')](),interaction[_0xf3ca('0xe')](_0xf3ca('0xf'),_0xf3ca('0x10')),controller[_0xf3ca('0x11')]);router['put'](_0xf3ca('0xc'),controller[_0xf3ca('0x12')]);router['put'](_0xf3ca('0x13'),auth[_0xf3ca('0x9')](),controller[_0xf3ca('0x14')]);router[_0xf3ca('0x15')](_0xf3ca('0x16'),auth[_0xf3ca('0x9')](),controller['reject']);router[_0xf3ca('0x17')]('/:id',auth[_0xf3ca('0x9')](),controller[_0xf3ca('0x18')]);module[_0xf3ca('0x19')]=router; \ No newline at end of file +var _0x1241=['update','/:id/accept','accept','put','/:id/reject','reject','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','./chatMessage.controller','isAuthenticated','index','get','/:id','show','post','tracked','create'];(function(_0x316c76,_0x34d7a8){var _0x59114e=function(_0x5bc901){while(--_0x5bc901){_0x316c76['push'](_0x316c76['shift']());}};_0x59114e(++_0x34d7a8);}(_0x1241,0x161));var _0x1124=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1241[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x1124('0x0'));var path=require(_0x1124('0x1'));var timeout=require(_0x1124('0x2'));var express=require(_0x1124('0x3'));var router=express[_0x1124('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x1124('0x5'));var config=require('../../config/environment');var controller=require(_0x1124('0x6'));router['get']('/',auth[_0x1124('0x7')](),controller[_0x1124('0x8')]);router[_0x1124('0x9')]('/describe',auth[_0x1124('0x7')](),controller['describe']);router['get'](_0x1124('0xa'),auth[_0x1124('0x7')](),controller[_0x1124('0xb')]);router[_0x1124('0xc')]('/',auth[_0x1124('0x7')](),interaction[_0x1124('0xd')]('chat','chatmessage:create'),controller[_0x1124('0xe')]);router['put'](_0x1124('0xa'),controller[_0x1124('0xf')]);router['put'](_0x1124('0x10'),auth[_0x1124('0x7')](),controller[_0x1124('0x11')]);router[_0x1124('0x12')](_0x1124('0x13'),auth['isAuthenticated'](),controller[_0x1124('0x14')]);router['delete'](_0x1124('0xa'),auth[_0x1124('0x7')](),controller[_0x1124('0x15')]);module[_0x1124('0x16')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index c5aaf48..688ead6 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(_0x1d25ad,_0x5293e3){var _0x56c341=function(_0x493721){while(--_0x493721){_0x1d25ad['push'](_0x1d25ad['shift']());}};_0x56c341(++_0x5293e3);}(_0x5f66,0x1a0));var _0x65f6=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x5f66[_0x138adb];return _0x1b27f2;};'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 _0x5f2f=['exports','TEXT','medium','sequelize'];(function(_0x32b342,_0x4fbe5c){var _0x13ae06=function(_0x1f8487){while(--_0x1f8487){_0x32b342['push'](_0x32b342['shift']());}};_0x13ae06(++_0x4fbe5c);}(_0x5f2f,0x73));var _0xf5f2=function(_0x385e7a,_0x7ffd81){_0x385e7a=_0x385e7a-0x0;var _0x164a3d=_0x5f2f[_0x385e7a];return _0x164a3d;};'use strict';var Sequelize=require(_0xf5f2('0x0'));module[_0xf5f2('0x1')]={'body':{'type':Sequelize[_0xf5f2('0x2')](_0xf5f2('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xf5f2('0x2')](_0xf5f2('0x3')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index b32a14f..ab9baca 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(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x7a54,0x106));var _0x47a5=function(_0x2b2e8a,_0x3cb027){_0x2b2e8a=_0x2b2e8a-0x0;var _0x3dcac4=_0x7a54[_0x2b2e8a];return _0x3dcac4;};'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(_0x35f070,_0x3f360b){var _0x3a921b=function(_0x389311){while(--_0x389311){_0x35f070['push'](_0x35f070['shift']());}};_0x3a921b(++_0x3f360b);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'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 5fb8199..d18e842 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 _0xe3d4=['hasOwnProperty','exports','events','../../mysqldb','ChatOfflineMessage','setMaxListeners','save','update','remove','emit'];(function(_0x5c3c0b,_0x4ee35e){var _0x52ecd2=function(_0x3cf575){while(--_0x3cf575){_0x5c3c0b['push'](_0x5c3c0b['shift']());}};_0x52ecd2(++_0x4ee35e);}(_0xe3d4,0x1ba));var _0x4e3d=function(_0x52c8e8,_0x5ee20d){_0x52c8e8=_0x52c8e8-0x0;var _0x31bb1a=_0xe3d4[_0x52c8e8];return _0x31bb1a;};'use strict';var EventEmitter=require(_0x4e3d('0x0'));var ChatOfflineMessage=require(_0x4e3d('0x1'))['db'][_0x4e3d('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x4e3d('0x3')](0x0);var events={'afterCreate':_0x4e3d('0x4'),'afterUpdate':_0x4e3d('0x5'),'afterDestroy':_0x4e3d('0x6')};function emitEvent(_0x1d80d2){return function(_0x33ae34,_0x1fd123,_0x27371a){ChatOfflineMessageEvents[_0x4e3d('0x7')](_0x1d80d2+':'+_0x33ae34['id'],_0x33ae34);ChatOfflineMessageEvents[_0x4e3d('0x7')](_0x1d80d2,_0x33ae34);_0x27371a(null);};}for(var e in events){if(events[_0x4e3d('0x8')](e)){var event=events[e];ChatOfflineMessage['hook'](e,emitEvent(event));}}module[_0x4e3d('0x9')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0x4cff=['hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','update','remove','emit'];(function(_0x340380,_0x4bd2a8){var _0x49ce1c=function(_0x4cb9e2){while(--_0x4cb9e2){_0x340380['push'](_0x340380['shift']());}};_0x49ce1c(++_0x4bd2a8);}(_0x4cff,0x14a));var _0xf4cf=function(_0x29e848,_0x1c44ef){_0x29e848=_0x29e848-0x0;var _0x572ae5=_0x4cff[_0x29e848];return _0x572ae5;};'use strict';var EventEmitter=require(_0xf4cf('0x0'));var ChatOfflineMessage=require(_0xf4cf('0x1'))['db']['ChatOfflineMessage'];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0xf4cf('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf4cf('0x3'),'afterDestroy':_0xf4cf('0x4')};function emitEvent(_0x548b62){return function(_0x3d5ddc,_0x1c1936,_0x9bcfbe){ChatOfflineMessageEvents[_0xf4cf('0x5')](_0x548b62+':'+_0x3d5ddc['id'],_0x3d5ddc);ChatOfflineMessageEvents[_0xf4cf('0x5')](_0x548b62,_0x3d5ddc);_0x9bcfbe(null);};}for(var e in events){if(events[_0xf4cf('0x6')](e)){var event=events[e];ChatOfflineMessage['hook'](e,emitEvent(event));}}module[_0xf4cf('0x7')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index bd84946..b5baa64 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 _0x9cb9=['ChatOfflineMessage','chat_offline_messages','utf8mb4','./chatOfflineMessage.attributes','exports','define'];(function(_0x2e913b,_0x4b7071){var _0x173899=function(_0x2a7d22){while(--_0x2a7d22){_0x2e913b['push'](_0x2e913b['shift']());}};_0x173899(++_0x4b7071);}(_0x9cb9,0x141));var _0x99cb=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x9cb9[_0x59ee6f];return _0x4c0979;};'use strict';var attributes=require(_0x99cb('0x0'));module[_0x99cb('0x1')]=function(_0x4450a4){return _0x4450a4[_0x99cb('0x2')](_0x99cb('0x3'),attributes,{'tableName':_0x99cb('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x99cb('0x5'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x5fca=['ChatOfflineMessage','utf8mb4','utf8mb4_unicode_ci','./chatOfflineMessage.attributes','exports'];(function(_0x42e7a4,_0x2c8bd4){var _0x232c81=function(_0x5678d3){while(--_0x5678d3){_0x42e7a4['push'](_0x42e7a4['shift']());}};_0x232c81(++_0x2c8bd4);}(_0x5fca,0x80));var _0xa5fc=function(_0x3b231a,_0x53a00d){_0x3b231a=_0x3b231a-0x0;var _0x18d67a=_0x5fca[_0x3b231a];return _0x18d67a;};'use strict';var attributes=require(_0xa5fc('0x0'));module[_0xa5fc('0x1')]=function(_0x13163d){return _0x13163d['define'](_0xa5fc('0x2'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa5fc('0x3'),'collate':_0xa5fc('0x4')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 45956dc..718d137 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 _0xff16=['request','then','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x2abd13,_0x501317){var _0x5ad645=function(_0x55ae11){while(--_0x55ae11){_0x2abd13['push'](_0x2abd13['shift']());}};_0x5ad645(++_0x501317);}(_0xff16,0x7f));var _0x6ff1=function(_0x372e47,_0x253f7e){_0x372e47=_0x372e47-0x0;var _0x5ea356=_0xff16[_0x372e47];return _0x5ea356;};'use strict';var _=require(_0x6ff1('0x0'));var util=require(_0x6ff1('0x1'));var moment=require('moment');var BPromise=require(_0x6ff1('0x2'));var rs=require(_0x6ff1('0x3'));var fs=require('fs');var Redis=require(_0x6ff1('0x4'));var db=require(_0x6ff1('0x5'))['db'];var utils=require(_0x6ff1('0x6'));var logger=require(_0x6ff1('0x7'))(_0x6ff1('0x8'));var config=require(_0x6ff1('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6ff1('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x133524,_0x649806,_0x2333b1){return new BPromise(function(_0xbea21f,_0x1fb27c){return client[_0x6ff1('0xb')](_0x133524,_0x2333b1)[_0x6ff1('0xc')](function(_0x172393){logger['info'](_0x6ff1('0xd'),_0x649806,_0x6ff1('0xe'));logger[_0x6ff1('0xf')](_0x6ff1('0x10'),_0x649806,_0x6ff1('0xe'),JSON[_0x6ff1('0x11')](_0x172393));if(_0x172393[_0x6ff1('0x12')]){if(_0x172393[_0x6ff1('0x12')][_0x6ff1('0x13')]===0x1f4){logger[_0x6ff1('0x12')]('ChatOfflineMessage,\x20%s,\x20%s',_0x649806,_0x172393['error'][_0x6ff1('0x14')]);return _0x1fb27c(_0x172393['error'][_0x6ff1('0x14')]);}logger[_0x6ff1('0x12')](_0x6ff1('0xd'),_0x649806,_0x172393['error']['message']);return _0xbea21f(_0x172393['error'][_0x6ff1('0x14')]);}else{logger[_0x6ff1('0x15')](_0x6ff1('0xd'),_0x649806,_0x6ff1('0xe'));_0xbea21f(_0x172393[_0x6ff1('0x16')][_0x6ff1('0x14')]);}})['catch'](function(_0x155d26){logger[_0x6ff1('0x12')](_0x6ff1('0xd'),_0x649806,_0x155d26);_0x1fb27c(_0x155d26);});});} \ No newline at end of file +var _0x1f2f=['code','message','result','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','error'];(function(_0x3e377c,_0x50d780){var _0x412396=function(_0x26f894){while(--_0x26f894){_0x3e377c['push'](_0x3e377c['shift']());}};_0x412396(++_0x50d780);}(_0x1f2f,0x1d2));var _0xf1f2=function(_0x33c65a,_0x2fa474){_0x33c65a=_0x33c65a-0x0;var _0x55b76e=_0x1f2f[_0x33c65a];return _0x55b76e;};'use strict';var _=require(_0xf1f2('0x0'));var util=require('util');var moment=require(_0xf1f2('0x1'));var BPromise=require('bluebird');var rs=require(_0xf1f2('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf1f2('0x3'))['db'];var utils=require(_0xf1f2('0x4'));var logger=require('../../config/logger')(_0xf1f2('0x5'));var config=require(_0xf1f2('0x6'));var jayson=require(_0xf1f2('0x7'));var client=jayson[_0xf1f2('0x8')][_0xf1f2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x540d6f,_0x52b577,_0x3ee4c0){return new BPromise(function(_0x4d747e,_0x317888){return client[_0xf1f2('0xa')](_0x540d6f,_0x3ee4c0)[_0xf1f2('0xb')](function(_0x1d11e0){logger[_0xf1f2('0xc')](_0xf1f2('0xd'),_0x52b577,_0xf1f2('0xe'));logger[_0xf1f2('0xf')](_0xf1f2('0x10'),_0x52b577,_0xf1f2('0xe'),JSON['stringify'](_0x1d11e0));if(_0x1d11e0[_0xf1f2('0x11')]){if(_0x1d11e0[_0xf1f2('0x11')][_0xf1f2('0x12')]===0x1f4){logger[_0xf1f2('0x11')](_0xf1f2('0xd'),_0x52b577,_0x1d11e0[_0xf1f2('0x11')]['message']);return _0x317888(_0x1d11e0['error'][_0xf1f2('0x13')]);}logger[_0xf1f2('0x11')](_0xf1f2('0xd'),_0x52b577,_0x1d11e0[_0xf1f2('0x11')][_0xf1f2('0x13')]);return _0x4d747e(_0x1d11e0[_0xf1f2('0x11')][_0xf1f2('0x13')]);}else{logger[_0xf1f2('0xc')](_0xf1f2('0xd'),_0x52b577,_0xf1f2('0xe'));_0x4d747e(_0x1d11e0[_0xf1f2('0x14')]['message']);}})[_0xf1f2('0x15')](function(_0x3d9978){logger[_0xf1f2('0x11')]('ChatOfflineMessage,\x20%s,\x20%s',_0x52b577,_0x3d9978);_0x317888(_0x3d9978);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 04cdd9b..3715d6f 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 _0xf1d1=['post','put','update','destroy','exports','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x31cb5f,_0x2df766){var _0x586042=function(_0x53c807){while(--_0x53c807){_0x31cb5f['push'](_0x31cb5f['shift']());}};_0x586042(++_0x2df766);}(_0xf1d1,0x1d1));var _0x1f1d=function(_0x49f609,_0x3d2a52){_0x49f609=_0x49f609-0x0;var _0x33a21f=_0xf1d1[_0x49f609];return _0x33a21f;};'use strict';var multer=require('multer');var util=require(_0x1f1d('0x0'));var path=require(_0x1f1d('0x1'));var timeout=require('connect-timeout');var express=require(_0x1f1d('0x2'));var router=express[_0x1f1d('0x3')]();var fs_extra=require(_0x1f1d('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x1f1d('0x5'));var config=require(_0x1f1d('0x6'));var controller=require(_0x1f1d('0x7'));router[_0x1f1d('0x8')]('/',auth[_0x1f1d('0x9')](),controller[_0x1f1d('0xa')]);router[_0x1f1d('0x8')](_0x1f1d('0xb'),auth['isAuthenticated'](),controller[_0x1f1d('0xc')]);router[_0x1f1d('0x8')](_0x1f1d('0xd'),auth[_0x1f1d('0x9')](),controller[_0x1f1d('0xe')]);router[_0x1f1d('0xf')]('/',auth[_0x1f1d('0x9')](),controller['create']);router[_0x1f1d('0x10')]('/:id',auth[_0x1f1d('0x9')](),controller[_0x1f1d('0x11')]);router['delete'](_0x1f1d('0xd'),auth[_0x1f1d('0x9')](),controller[_0x1f1d('0x12')]);module[_0x1f1d('0x13')]=router; \ No newline at end of file +var _0xa02b=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','destroy','exports','util','path'];(function(_0x4dcc2d,_0x422839){var _0x1bbd79=function(_0x173341){while(--_0x173341){_0x4dcc2d['push'](_0x4dcc2d['shift']());}};_0x1bbd79(++_0x422839);}(_0xa02b,0xbb));var _0xba02=function(_0x1fbafd,_0x1ba0a5){_0x1fbafd=_0x1fbafd-0x0;var _0x2ccceb=_0xa02b[_0x1fbafd];return _0x2ccceb;};'use strict';var multer=require('multer');var util=require(_0xba02('0x0'));var path=require(_0xba02('0x1'));var timeout=require(_0xba02('0x2'));var express=require(_0xba02('0x3'));var router=express[_0xba02('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xba02('0x5'));var interaction=require(_0xba02('0x6'));var config=require(_0xba02('0x7'));var controller=require('./chatOfflineMessage.controller');router[_0xba02('0x8')]('/',auth['isAuthenticated'](),controller[_0xba02('0x9')]);router[_0xba02('0x8')](_0xba02('0xa'),auth[_0xba02('0xb')](),controller[_0xba02('0xc')]);router[_0xba02('0x8')](_0xba02('0xd'),auth[_0xba02('0xb')](),controller[_0xba02('0xe')]);router[_0xba02('0xf')]('/',auth[_0xba02('0xb')](),controller[_0xba02('0x10')]);router[_0xba02('0x11')]('/:id',auth[_0xba02('0xb')](),controller[_0xba02('0x12')]);router['delete'](_0xba02('0xd'),auth[_0xba02('0xb')](),controller[_0xba02('0x13')]);module[_0xba02('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index dec475e..084e1dc 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 _0x2c33=['INTEGER','exports','STRING','ENUM','timeout'];(function(_0x33bf48,_0x2b6fd6){var _0x208689=function(_0x5d5b20){while(--_0x5d5b20){_0x33bf48['push'](_0x33bf48['shift']());}};_0x208689(++_0x2b6fd6);}(_0x2c33,0x12d));var _0x32c3=function(_0xcd71b6,_0x426692){_0xcd71b6=_0xcd71b6-0x0;var _0x4811fb=_0x2c33[_0xcd71b6];return _0x4811fb;};'use strict';var Sequelize=require('sequelize');module[_0x32c3('0x0')]={'name':{'type':Sequelize[_0x32c3('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x32c3('0x2')]('mouseOver',_0x32c3('0x3')),'defaultValue':'mouseOver'},'selector':{'type':Sequelize[_0x32c3('0x1')]},'timeout':{'type':Sequelize[_0x32c3('0x4')]}}; \ No newline at end of file +var _0xf130=['STRING','mouseOver','exports'];(function(_0x290b68,_0x1f82af){var _0x2f23af=function(_0x5efc22){while(--_0x5efc22){_0x290b68['push'](_0x290b68['shift']());}};_0x2f23af(++_0x1f82af);}(_0xf130,0xfb));var _0x0f13=function(_0x734db7,_0x5b858c){_0x734db7=_0x734db7-0x0;var _0x36f3d9=_0xf130[_0x734db7];return _0x36f3d9;};'use strict';var Sequelize=require('sequelize');module[_0x0f13('0x0')]={'name':{'type':Sequelize[_0x0f13('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('mouseOver','timeout'),'defaultValue':_0x0f13('0x2')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 2ef1a1d..25de7a0 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 _0x7c49=['ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','update','then','destroy','error','stack','name','send','show','model','keys','query','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','create','body','params','eml-format','rimraf','request-promise','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x3dfba9,_0x239672){var _0x227379=function(_0x5b0254){while(--_0x5b0254){_0x3dfba9['push'](_0x3dfba9['shift']());}};_0x227379(++_0x239672);}(_0x7c49,0x141));var _0x97c4=function(_0x171ca1,_0x503c37){_0x171ca1=_0x171ca1-0x0;var _0x53de15=_0x7c49[_0x171ca1];return _0x53de15;};'use strict';var emlformat=require(_0x97c4('0x0'));var rimraf=require(_0x97c4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x97c4('0x2'));var moment=require('moment');var BPromise=require(_0x97c4('0x3'));var Mustache=require(_0x97c4('0x4'));var util=require('util');var path=require('path');var sox=require(_0x97c4('0x5'));var csv=require(_0x97c4('0x6'));var ejs=require(_0x97c4('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x97c4('0x8'));var squel=require(_0x97c4('0x9'));var crypto=require(_0x97c4('0xa'));var jsforce=require(_0x97c4('0xb'));var deskjs=require(_0x97c4('0xc'));var toCsv=require(_0x97c4('0x6'));var querystring=require(_0x97c4('0xd'));var Papa=require(_0x97c4('0xe'));var Redis=require(_0x97c4('0xf'));var authService=require(_0x97c4('0x10'));var qs=require(_0x97c4('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x97c4('0x12'))(_0x97c4('0x13'));var utils=require('../../config/utils');var config=require(_0x97c4('0x14'));var licenseUtil=require(_0x97c4('0x15'));var db=require(_0x97c4('0x16'))['db'];function respondWithStatusCode(_0x5bd0a2,_0x4e5e98){_0x4e5e98=_0x4e5e98||0xcc;return function(_0x1f16cc){if(_0x1f16cc){return _0x5bd0a2[_0x97c4('0x17')](_0x4e5e98);}return _0x5bd0a2['status'](_0x4e5e98)[_0x97c4('0x18')]();};}function respondWithResult(_0x519188,_0xbd9965){_0xbd9965=_0xbd9965||0xc8;return function(_0x37b746){if(_0x37b746){return _0x519188[_0x97c4('0x19')](_0xbd9965)[_0x97c4('0x1a')](_0x37b746);}};}function respondWithFilteredResult(_0x94f8ed,_0x3434ee){return function(_0x50d8ad){if(_0x50d8ad){var _0x1fff7e=typeof _0x3434ee['offset']===_0x97c4('0x1b')&&typeof _0x3434ee[_0x97c4('0x1c')]===_0x97c4('0x1b');var _0x1f178b=_0x50d8ad[_0x97c4('0x1d')];var _0x142f94=_0x1fff7e?0x0:_0x3434ee[_0x97c4('0x1e')];var _0x1ce103=_0x1fff7e?_0x50d8ad[_0x97c4('0x1d')]:_0x3434ee[_0x97c4('0x1e')]+_0x3434ee['limit'];var _0x317916;if(_0x1ce103>=_0x1f178b){_0x1ce103=_0x1f178b;_0x317916=0xc8;}else{_0x317916=0xce;}_0x94f8ed[_0x97c4('0x19')](_0x317916);return _0x94f8ed[_0x97c4('0x1f')]('Content-Range',_0x142f94+'-'+_0x1ce103+'/'+_0x1f178b)[_0x97c4('0x1a')](_0x50d8ad);}return null;};}function patchUpdates(_0x222ba2){return function(_0x288284){try{jsonpatch['apply'](_0x288284,_0x222ba2,!![]);}catch(_0x511947){return BPromise['reject'](_0x511947);}return _0x288284['save']();};}function saveUpdates(_0x3373f8,_0x3447fc){return function(_0x40859){if(_0x40859){return _0x40859[_0x97c4('0x20')](_0x3373f8)[_0x97c4('0x21')](function(_0x8e8544){return _0x8e8544;});}return null;};}function removeEntity(_0x2ca647,_0x3c00aa){return function(_0x42abf6){if(_0x42abf6){return _0x42abf6[_0x97c4('0x22')]()[_0x97c4('0x21')](function(){_0x2ca647[_0x97c4('0x19')](0xcc)[_0x97c4('0x18')]();});}};}function handleEntityNotFound(_0x4afb57,_0x3da867){return function(_0x15a15f){if(!_0x15a15f){_0x4afb57[_0x97c4('0x17')](0x194);}return _0x15a15f;};}function handleError(_0x58f724,_0x2daa91){_0x2daa91=_0x2daa91||0x1f4;return function(_0x531c31){logger[_0x97c4('0x23')](_0x531c31[_0x97c4('0x24')]);if(_0x531c31[_0x97c4('0x25')]){delete _0x531c31[_0x97c4('0x25')];}_0x58f724[_0x97c4('0x19')](_0x2daa91)[_0x97c4('0x26')](_0x531c31);};}exports[_0x97c4('0x27')]=function(_0x38cb3f,_0x174be5){var _0x3c4323={'raw':!![],'where':{'id':_0x38cb3f['params']['id']}},_0x3bc0d2={};_0x3bc0d2[_0x97c4('0x28')]=_[_0x97c4('0x29')](db['ChatProactiveAction']['rawAttributes']);_0x3bc0d2[_0x97c4('0x2a')]=_['keys'](_0x38cb3f[_0x97c4('0x2a')]);_0x3bc0d2['filters']=_[_0x97c4('0x2b')](_0x3bc0d2[_0x97c4('0x28')],_0x3bc0d2[_0x97c4('0x2a')]);_0x3c4323[_0x97c4('0x2c')]=_[_0x97c4('0x2b')](_0x3bc0d2[_0x97c4('0x28')],qs[_0x97c4('0x2d')](_0x38cb3f[_0x97c4('0x2a')][_0x97c4('0x2d')]));_0x3c4323['attributes']=_0x3c4323['attributes'][_0x97c4('0x2e')]?_0x3c4323[_0x97c4('0x2c')]:_0x3bc0d2[_0x97c4('0x28')];if(_0x38cb3f[_0x97c4('0x2a')][_0x97c4('0x2f')]){_0x3c4323[_0x97c4('0x30')]=[{'all':!![]}];}_0x3c4323=_[_0x97c4('0x31')]({},_0x3c4323,_0x38cb3f[_0x97c4('0x32')]);return db['ChatProactiveAction'][_0x97c4('0x33')](_0x3c4323)[_0x97c4('0x21')](handleEntityNotFound(_0x174be5,null))[_0x97c4('0x21')](respondWithResult(_0x174be5,null))[_0x97c4('0x34')](handleError(_0x174be5,null));};exports[_0x97c4('0x35')]=function(_0x2d391d,_0x329d7e){return db['ChatProactiveAction'][_0x97c4('0x35')](_0x2d391d['body'],{})['then'](respondWithResult(_0x329d7e,0xc9))[_0x97c4('0x34')](handleError(_0x329d7e,null));};exports[_0x97c4('0x20')]=function(_0xaecbd8,_0x19334a){if(_0xaecbd8[_0x97c4('0x36')]['id']){delete _0xaecbd8['body']['id'];}return db['ChatProactiveAction']['find']({'where':{'id':_0xaecbd8['params']['id']}})[_0x97c4('0x21')](handleEntityNotFound(_0x19334a,null))[_0x97c4('0x21')](saveUpdates(_0xaecbd8[_0x97c4('0x36')],null))[_0x97c4('0x21')](respondWithResult(_0x19334a,null))[_0x97c4('0x34')](handleError(_0x19334a,null));};exports[_0x97c4('0x22')]=function(_0x1b442b,_0x4f14c7){return db['ChatProactiveAction'][_0x97c4('0x33')]({'where':{'id':_0x1b442b[_0x97c4('0x37')]['id']}})['then'](handleEntityNotFound(_0x4f14c7,null))[_0x97c4('0x21')](removeEntity(_0x4f14c7,null))['catch'](handleError(_0x4f14c7,null));}; \ No newline at end of file +var _0x6fc4=['update','then','destroy','error','stack','name','send','show','params','model','keys','ChatProactiveAction','query','filters','intersection','attributes','fields','includeAll','merge','options','find','catch','create','body','eml-format','rimraf','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save'];(function(_0x387777,_0x356171){var _0x3f84c0=function(_0x4d4423){while(--_0x4d4423){_0x387777['push'](_0x387777['shift']());}};_0x3f84c0(++_0x356171);}(_0x6fc4,0x1a0));var _0x46fc=function(_0x3e18bf,_0x387f5e){_0x3e18bf=_0x3e18bf-0x0;var _0x1022e5=_0x6fc4[_0x3e18bf];return _0x1022e5;};'use strict';var emlformat=require(_0x46fc('0x0'));var rimraf=require(_0x46fc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x46fc('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x46fc('0x3'));var path=require(_0x46fc('0x4'));var sox=require(_0x46fc('0x5'));var csv=require(_0x46fc('0x6'));var ejs=require(_0x46fc('0x7'));var fs=require('fs');var fs_extra=require(_0x46fc('0x8'));var _=require(_0x46fc('0x9'));var squel=require(_0x46fc('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x46fc('0xb'));var toCsv=require(_0x46fc('0x6'));var querystring=require(_0x46fc('0xc'));var Papa=require(_0x46fc('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x46fc('0xe'));var as=require(_0x46fc('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x46fc('0x10'))('api');var utils=require(_0x46fc('0x11'));var config=require(_0x46fc('0x12'));var licenseUtil=require(_0x46fc('0x13'));var db=require(_0x46fc('0x14'))['db'];function respondWithStatusCode(_0x317f01,_0x36ec39){_0x36ec39=_0x36ec39||0xcc;return function(_0x1013ae){if(_0x1013ae){return _0x317f01[_0x46fc('0x15')](_0x36ec39);}return _0x317f01[_0x46fc('0x16')](_0x36ec39)[_0x46fc('0x17')]();};}function respondWithResult(_0x34a019,_0x403564){_0x403564=_0x403564||0xc8;return function(_0x36f17c){if(_0x36f17c){return _0x34a019[_0x46fc('0x16')](_0x403564)[_0x46fc('0x18')](_0x36f17c);}};}function respondWithFilteredResult(_0x39aa74,_0x246499){return function(_0x67f365){if(_0x67f365){var _0x51ab37=typeof _0x246499[_0x46fc('0x19')]===_0x46fc('0x1a')&&typeof _0x246499[_0x46fc('0x1b')]===_0x46fc('0x1a');var _0xd40ad2=_0x67f365['count'];var _0x23b041=_0x51ab37?0x0:_0x246499[_0x46fc('0x19')];var _0x2ebd06=_0x51ab37?_0x67f365[_0x46fc('0x1c')]:_0x246499[_0x46fc('0x19')]+_0x246499[_0x46fc('0x1b')];var _0x5d168a;if(_0x2ebd06>=_0xd40ad2){_0x2ebd06=_0xd40ad2;_0x5d168a=0xc8;}else{_0x5d168a=0xce;}_0x39aa74[_0x46fc('0x16')](_0x5d168a);return _0x39aa74['set'](_0x46fc('0x1d'),_0x23b041+'-'+_0x2ebd06+'/'+_0xd40ad2)[_0x46fc('0x18')](_0x67f365);}return null;};}function patchUpdates(_0x1e6f26){return function(_0x126bf1){try{jsonpatch['apply'](_0x126bf1,_0x1e6f26,!![]);}catch(_0x568f87){return BPromise[_0x46fc('0x1e')](_0x568f87);}return _0x126bf1[_0x46fc('0x1f')]();};}function saveUpdates(_0x1bbc88,_0x48d00f){return function(_0x483acf){if(_0x483acf){return _0x483acf[_0x46fc('0x20')](_0x1bbc88)[_0x46fc('0x21')](function(_0x5b8731){return _0x5b8731;});}return null;};}function removeEntity(_0x720693,_0x9cbc15){return function(_0x372c6f){if(_0x372c6f){return _0x372c6f[_0x46fc('0x22')]()[_0x46fc('0x21')](function(){_0x720693[_0x46fc('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16a8e3,_0x352c0f){return function(_0x4f8ad7){if(!_0x4f8ad7){_0x16a8e3[_0x46fc('0x15')](0x194);}return _0x4f8ad7;};}function handleError(_0x28f575,_0x5d5bcc){_0x5d5bcc=_0x5d5bcc||0x1f4;return function(_0x4442f0){logger[_0x46fc('0x23')](_0x4442f0[_0x46fc('0x24')]);if(_0x4442f0[_0x46fc('0x25')]){delete _0x4442f0[_0x46fc('0x25')];}_0x28f575[_0x46fc('0x16')](_0x5d5bcc)[_0x46fc('0x26')](_0x4442f0);};}exports[_0x46fc('0x27')]=function(_0x448f91,_0x29e78d){var _0x3591f9={'raw':!![],'where':{'id':_0x448f91[_0x46fc('0x28')]['id']}},_0x38f8f5={};_0x38f8f5[_0x46fc('0x29')]=_[_0x46fc('0x2a')](db[_0x46fc('0x2b')]['rawAttributes']);_0x38f8f5[_0x46fc('0x2c')]=_[_0x46fc('0x2a')](_0x448f91[_0x46fc('0x2c')]);_0x38f8f5[_0x46fc('0x2d')]=_[_0x46fc('0x2e')](_0x38f8f5[_0x46fc('0x29')],_0x38f8f5['query']);_0x3591f9[_0x46fc('0x2f')]=_[_0x46fc('0x2e')](_0x38f8f5[_0x46fc('0x29')],qs[_0x46fc('0x30')](_0x448f91[_0x46fc('0x2c')][_0x46fc('0x30')]));_0x3591f9[_0x46fc('0x2f')]=_0x3591f9['attributes']['length']?_0x3591f9[_0x46fc('0x2f')]:_0x38f8f5[_0x46fc('0x29')];if(_0x448f91[_0x46fc('0x2c')][_0x46fc('0x31')]){_0x3591f9['include']=[{'all':!![]}];}_0x3591f9=_[_0x46fc('0x32')]({},_0x3591f9,_0x448f91[_0x46fc('0x33')]);return db[_0x46fc('0x2b')][_0x46fc('0x34')](_0x3591f9)[_0x46fc('0x21')](handleEntityNotFound(_0x29e78d,null))[_0x46fc('0x21')](respondWithResult(_0x29e78d,null))[_0x46fc('0x35')](handleError(_0x29e78d,null));};exports[_0x46fc('0x36')]=function(_0x1d075e,_0x1efc32){return db['ChatProactiveAction'][_0x46fc('0x36')](_0x1d075e[_0x46fc('0x37')],{})[_0x46fc('0x21')](respondWithResult(_0x1efc32,0xc9))[_0x46fc('0x35')](handleError(_0x1efc32,null));};exports[_0x46fc('0x20')]=function(_0xa85ff6,_0x5bc0e4){if(_0xa85ff6[_0x46fc('0x37')]['id']){delete _0xa85ff6[_0x46fc('0x37')]['id'];}return db[_0x46fc('0x2b')]['find']({'where':{'id':_0xa85ff6[_0x46fc('0x28')]['id']}})[_0x46fc('0x21')](handleEntityNotFound(_0x5bc0e4,null))[_0x46fc('0x21')](saveUpdates(_0xa85ff6[_0x46fc('0x37')],null))[_0x46fc('0x21')](respondWithResult(_0x5bc0e4,null))[_0x46fc('0x35')](handleError(_0x5bc0e4,null));};exports['destroy']=function(_0x272595,_0x3dac4d){return db[_0x46fc('0x2b')][_0x46fc('0x34')]({'where':{'id':_0x272595['params']['id']}})[_0x46fc('0x21')](handleEntityNotFound(_0x3dac4d,null))[_0x46fc('0x21')](removeEntity(_0x3dac4d,null))[_0x46fc('0x35')](handleError(_0x3dac4d,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 3aa442e..1c9d08c 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 _0x7c66=['./chatProactiveAction.attributes','exports','define','ChatProactiveAction','chat_proactive_actions','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x7c66,0x161));var _0x67c6=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x7c66[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x67c6('0x0'));var util=require('util');var logger=require(_0x67c6('0x1'))(_0x67c6('0x2'));var moment=require(_0x67c6('0x3'));var BPromise=require(_0x67c6('0x4'));var rp=require(_0x67c6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x67c6('0x6'));var config=require('../../config/environment');var attributes=require(_0x67c6('0x7'));module[_0x67c6('0x8')]=function(_0x3064d0,_0x570d9a){return _0x3064d0[_0x67c6('0x9')](_0x67c6('0xa'),attributes,{'tableName':_0x67c6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xced0=['define','chat_proactive_actions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','exports'];(function(_0x3200ea,_0x4fb38c){var _0x4b0858=function(_0xe1288b){while(--_0xe1288b){_0x3200ea['push'](_0x3200ea['shift']());}};_0x4b0858(++_0x4fb38c);}(_0xced0,0xd4));var _0x0ced=function(_0x1eb3a9,_0x1bc3d2){_0x1eb3a9=_0x1eb3a9-0x0;var _0x588a71=_0xced0[_0x1eb3a9];return _0x588a71;};'use strict';var _=require(_0x0ced('0x0'));var util=require(_0x0ced('0x1'));var logger=require(_0x0ced('0x2'))(_0x0ced('0x3'));var moment=require(_0x0ced('0x4'));var BPromise=require(_0x0ced('0x5'));var rp=require(_0x0ced('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./chatProactiveAction.attributes');module[_0x0ced('0x7')]=function(_0x4179af,_0x4b9206){return _0x4179af[_0x0ced('0x8')]('ChatProactiveAction',attributes,{'tableName':_0x0ced('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 40de96c..9ce59b0 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 _0xb75a=['../../config/environment','jayson/promise','client','request','then','info','request\x20sent','stringify','error','code','ChatProactiveAction,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0xfc970,_0x490f43){var _0x2d033a=function(_0x19c458){while(--_0x19c458){_0xfc970['push'](_0xfc970['shift']());}};_0x2d033a(++_0x490f43);}(_0xb75a,0x92));var _0xab75=function(_0x20fa63,_0x65c8d3){_0x20fa63=_0x20fa63-0x0;var _0x4c37ae=_0xb75a[_0x20fa63];return _0x4c37ae;};'use strict';var _=require(_0xab75('0x0'));var util=require(_0xab75('0x1'));var moment=require(_0xab75('0x2'));var BPromise=require(_0xab75('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xab75('0x4'));var db=require(_0xab75('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xab75('0x6'))(_0xab75('0x7'));var config=require(_0xab75('0x8'));var jayson=require(_0xab75('0x9'));var client=jayson[_0xab75('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x526e89,_0x35bf7b,_0xc095cd){return new BPromise(function(_0x3801b2,_0xb7c0b5){return client[_0xab75('0xb')](_0x526e89,_0xc095cd)[_0xab75('0xc')](function(_0x10e861){logger[_0xab75('0xd')]('ChatProactiveAction,\x20%s,\x20%s',_0x35bf7b,_0xab75('0xe'));logger['debug']('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x35bf7b,_0xab75('0xe'),JSON[_0xab75('0xf')](_0x10e861));if(_0x10e861[_0xab75('0x10')]){if(_0x10e861['error'][_0xab75('0x11')]===0x1f4){logger[_0xab75('0x10')](_0xab75('0x12'),_0x35bf7b,_0x10e861[_0xab75('0x10')][_0xab75('0x13')]);return _0xb7c0b5(_0x10e861[_0xab75('0x10')][_0xab75('0x13')]);}logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x35bf7b,_0x10e861[_0xab75('0x10')]['message']);return _0x3801b2(_0x10e861[_0xab75('0x10')][_0xab75('0x13')]);}else{logger[_0xab75('0xd')](_0xab75('0x12'),_0x35bf7b,'request\x20sent');_0x3801b2(_0x10e861[_0xab75('0x14')]['message']);}})[_0xab75('0x15')](function(_0x322239){logger[_0xab75('0x10')](_0xab75('0x12'),_0x35bf7b,_0x322239);_0xb7c0b5(_0x322239);});});} \ No newline at end of file +var _0xde03=['moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','client','http','request','then','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','ChatProactiveAction,\x20%s,\x20%s,\x20%s','error','code','message','result','util'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0xde03,0x1af));var _0x3de0=function(_0x364857,_0x2ca0fe){_0x364857=_0x364857-0x0;var _0x3ab9a6=_0xde03[_0x364857];return _0x3ab9a6;};'use strict';var _=require('lodash');var util=require(_0x3de0('0x0'));var moment=require(_0x3de0('0x1'));var BPromise=require(_0x3de0('0x2'));var rs=require(_0x3de0('0x3'));var fs=require('fs');var Redis=require(_0x3de0('0x4'));var db=require(_0x3de0('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3de0('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3de0('0x7')][_0x3de0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1795ae,_0x2b1256,_0xcd5c2c){return new BPromise(function(_0x26cff3,_0x5bd684){return client[_0x3de0('0x9')](_0x1795ae,_0xcd5c2c)[_0x3de0('0xa')](function(_0x3b03db){logger['info'](_0x3de0('0xb'),_0x2b1256,_0x3de0('0xc'));logger['debug'](_0x3de0('0xd'),_0x2b1256,'request\x20sent',JSON['stringify'](_0x3b03db));if(_0x3b03db[_0x3de0('0xe')]){if(_0x3b03db[_0x3de0('0xe')][_0x3de0('0xf')]===0x1f4){logger[_0x3de0('0xe')](_0x3de0('0xb'),_0x2b1256,_0x3b03db[_0x3de0('0xe')][_0x3de0('0x10')]);return _0x5bd684(_0x3b03db[_0x3de0('0xe')][_0x3de0('0x10')]);}logger[_0x3de0('0xe')](_0x3de0('0xb'),_0x2b1256,_0x3b03db[_0x3de0('0xe')][_0x3de0('0x10')]);return _0x26cff3(_0x3b03db[_0x3de0('0xe')][_0x3de0('0x10')]);}else{logger['info']('ChatProactiveAction,\x20%s,\x20%s',_0x2b1256,_0x3de0('0xc'));_0x26cff3(_0x3b03db[_0x3de0('0x11')]['message']);}})['catch'](function(_0xf32061){logger[_0x3de0('0xe')]('ChatProactiveAction,\x20%s,\x20%s',_0x2b1256,_0xf32061);_0x5bd684(_0xf32061);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 560771b..3e00002 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 _0x038b=['isAuthenticated','/:id','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./chatProactiveAction.controller','get','show','post'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x038b,0x114));var _0xb038=function(_0x4bd995,_0x2aeb8a){_0x4bd995=_0x4bd995-0x0;var _0xd61420=_0x038b[_0x4bd995];return _0xd61420;};'use strict';var multer=require('multer');var util=require(_0xb038('0x0'));var path=require(_0xb038('0x1'));var timeout=require(_0xb038('0x2'));var express=require('express');var router=express[_0xb038('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb038('0x4'));var interaction=require(_0xb038('0x5'));var config=require('../../config/environment');var controller=require(_0xb038('0x6'));router[_0xb038('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xb038('0x8')]);router[_0xb038('0x9')]('/',auth[_0xb038('0xa')](),controller['create']);router['put'](_0xb038('0xb'),auth[_0xb038('0xa')](),controller['update']);router['delete'](_0xb038('0xb'),auth[_0xb038('0xa')](),controller['destroy']);module[_0xb038('0xc')]=router; \ No newline at end of file +var _0x7dfd=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','post','put','update','destroy','multer','util','path','connect-timeout','express','Router'];(function(_0x442ac2,_0x4b7e0f){var _0x4b6e69=function(_0x2b2866){while(--_0x2b2866){_0x442ac2['push'](_0x442ac2['shift']());}};_0x4b6e69(++_0x4b7e0f);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xd7df('0x0'));var util=require(_0xd7df('0x1'));var path=require(_0xd7df('0x2'));var timeout=require(_0xd7df('0x3'));var express=require(_0xd7df('0x4'));var router=express[_0xd7df('0x5')]();var fs_extra=require(_0xd7df('0x6'));var auth=require(_0xd7df('0x7'));var interaction=require(_0xd7df('0x8'));var config=require(_0xd7df('0x9'));var controller=require(_0xd7df('0xa'));router[_0xd7df('0xb')](_0xd7df('0xc'),auth[_0xd7df('0xd')](),controller[_0xd7df('0xe')]);router[_0xd7df('0xf')]('/',auth[_0xd7df('0xd')](),controller['create']);router[_0xd7df('0x10')](_0xd7df('0xc'),auth[_0xd7df('0xd')](),controller[_0xd7df('0x11')]);router['delete'](_0xd7df('0xc'),auth['isAuthenticated'](),controller[_0xd7df('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index ff8ae05..0fefacf 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 _0x9d44=['exports','STRING','rrmemory','beepall','roundrobin','sequelize'];(function(_0x4e1752,_0x541a18){var _0x353e5d=function(_0x525b1b){while(--_0x525b1b){_0x4e1752['push'](_0x4e1752['shift']());}};_0x353e5d(++_0x541a18);}(_0x9d44,0x1a9));var _0x49d4=function(_0x5b6828,_0x4a19d9){_0x5b6828=_0x5b6828-0x0;var _0x2dbd2c=_0x9d44[_0x5b6828];return _0x2dbd2c;};'use strict';var Sequelize=require(_0x49d4('0x0'));module[_0x49d4('0x1')]={'name':{'type':Sequelize[_0x49d4('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x49d4('0x3'),_0x49d4('0x4'),_0x49d4('0x5'))}}; \ No newline at end of file +var _0x2f4f=['rrmemory','beepall','roundrobin','exports','STRING','name','INTEGER','ENUM'];(function(_0x51674a,_0x77ccff){var _0x13fca6=function(_0x3d6c27){while(--_0x3d6c27){_0x51674a['push'](_0x51674a['shift']());}};_0x13fca6(++_0x77ccff);}(_0x2f4f,0xcb));var _0xf2f4=function(_0x53b6b8,_0x242ae8){_0x53b6b8=_0x53b6b8-0x0;var _0x30d76a=_0x2f4f[_0x53b6b8];return _0x30d76a;};'use strict';var Sequelize=require('sequelize');module[_0xf2f4('0x0')]={'name':{'type':Sequelize[_0xf2f4('0x1')],'unique':_0xf2f4('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xf2f4('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xf2f4('0x4')](_0xf2f4('0x5'),_0xf2f4('0x6'),_0xf2f4('0x7'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 4b04368..eedd978 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 _0xdf28=['join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','sequelize','toString','SELECT','all','union','compact','value','removeAgents','userChatQueue:remove','addAgents','omit','spread','emit','userChatQueue:save','isArray','getAgents','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','jayson/promise','client','http','request','then','info','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','sendStatus','status','end','offset','undefined','limit','count','set','apply','save','destroy','UserProfileResource','name','send','index','map','ChatQueue','rawAttributes','fieldName','type','query','keys','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','length','find','create','body','user','ChatQueues','UserProfileSection','userProfileId','autoAssociation','update','describe','getMembers','findOne','get','ChatQueueId','UserChatQueue','User','findAndCountAll','UserId','chatPause','updatedAt','format','SIP','createdAt','Team','getTeams','Agents','online','voicePause','flatMap','transaction','each','forEach','ids','field','tq.TeamId','from','team_has_chat_queues'];(function(_0x2c2a5e,_0x2e453b){var _0x2fb8db=function(_0x43ad18){while(--_0x43ad18){_0x2c2a5e['push'](_0x2c2a5e['shift']());}};_0x2fb8db(++_0x2e453b);}(_0xdf28,0x1c3));var _0x8df2=function(_0x59c301,_0x359c50){_0x59c301=_0x59c301-0x0;var _0x3866b9=_0xdf28[_0x59c301];return _0x3866b9;};'use strict';var emlformat=require(_0x8df2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8df2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8df2('0x2'));var moment=require(_0x8df2('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x8df2('0x4'));var util=require(_0x8df2('0x5'));var path=require(_0x8df2('0x6'));var sox=require(_0x8df2('0x7'));var csv=require(_0x8df2('0x8'));var ejs=require(_0x8df2('0x9'));var fs=require('fs');var fs_extra=require(_0x8df2('0xa'));var _=require(_0x8df2('0xb'));var squel=require(_0x8df2('0xc'));var crypto=require(_0x8df2('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x8df2('0xe'));var toCsv=require(_0x8df2('0x8'));var querystring=require(_0x8df2('0xf'));var Papa=require(_0x8df2('0x10'));var Redis=require(_0x8df2('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8df2('0x12'));var logger=require(_0x8df2('0x13'))('api');var utils=require(_0x8df2('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x8df2('0x15'));var db=require(_0x8df2('0x16'))['db'];config[_0x8df2('0x17')]=_[_0x8df2('0x18')](config['redis'],{'host':_0x8df2('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8df2('0x17')]));require('./chatQueue.socket')['register'](socket);var jayson=require(_0x8df2('0x1a'));var client=jayson[_0x8df2('0x1b')][_0x8df2('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x78958c,_0x1aa3b9,_0xce0ae7,_0x1b71ff){return new BPromise(function(_0x1e91dd,_0x51953d){var _0x525b0a=_0x1b71ff||client;return _0x525b0a[_0x8df2('0x1d')](_0x78958c,_0xce0ae7)[_0x8df2('0x1e')](function(_0x386788){logger[_0x8df2('0x1f')](_0x8df2('0x20'),_0x1aa3b9,'request\x20sent');logger[_0x8df2('0x21')](_0x8df2('0x22'),_0x1aa3b9,_0x8df2('0x23'),JSON[_0x8df2('0x24')](_0x386788));if(_0x386788[_0x8df2('0x25')]){if(_0x386788['error'][_0x8df2('0x26')]===0x1f4){logger[_0x8df2('0x25')]('ChatQueue,\x20%s,\x20%s',_0x1aa3b9,_0x386788[_0x8df2('0x25')]['message']);return _0x51953d(_0x386788['error']['message']);}logger[_0x8df2('0x25')](_0x8df2('0x20'),_0x1aa3b9,_0x386788[_0x8df2('0x25')]['message']);return _0x1e91dd(_0x386788[_0x8df2('0x25')][_0x8df2('0x27')]);}else{logger[_0x8df2('0x1f')]('ChatQueue,\x20%s,\x20%s',_0x1aa3b9,'request\x20sent');_0x1e91dd(_0x386788['result']['message']);}})['catch'](function(_0xfca1f1){logger[_0x8df2('0x25')](_0x8df2('0x20'),_0x1aa3b9,_0xfca1f1);_0x51953d(_0xfca1f1);});});}function respondWithStatusCode(_0x2a0cbc,_0x1ea7a3){_0x1ea7a3=_0x1ea7a3||0xcc;return function(_0x5498ce){if(_0x5498ce){return _0x2a0cbc[_0x8df2('0x28')](_0x1ea7a3);}return _0x2a0cbc[_0x8df2('0x29')](_0x1ea7a3)[_0x8df2('0x2a')]();};}function respondWithResult(_0x52ee00,_0x3f2727){_0x3f2727=_0x3f2727||0xc8;return function(_0x543bd6){if(_0x543bd6){return _0x52ee00[_0x8df2('0x29')](_0x3f2727)['json'](_0x543bd6);}};}function respondWithFilteredResult(_0x5c5a95,_0x4384dd){return function(_0x525b3b){if(_0x525b3b){var _0xffef2e=typeof _0x4384dd[_0x8df2('0x2b')]===_0x8df2('0x2c')&&typeof _0x4384dd[_0x8df2('0x2d')]==='undefined';var _0x5ebc92=_0x525b3b['count'];var _0x8deb30=_0xffef2e?0x0:_0x4384dd[_0x8df2('0x2b')];var _0x264792=_0xffef2e?_0x525b3b[_0x8df2('0x2e')]:_0x4384dd[_0x8df2('0x2b')]+_0x4384dd['limit'];var _0x878ae1;if(_0x264792>=_0x5ebc92){_0x264792=_0x5ebc92;_0x878ae1=0xc8;}else{_0x878ae1=0xce;}_0x5c5a95[_0x8df2('0x29')](_0x878ae1);return _0x5c5a95[_0x8df2('0x2f')]('Content-Range',_0x8deb30+'-'+_0x264792+'/'+_0x5ebc92)['json'](_0x525b3b);}return null;};}function patchUpdates(_0x425641){return function(_0x2fcbef){try{jsonpatch[_0x8df2('0x30')](_0x2fcbef,_0x425641,!![]);}catch(_0x30adef){return BPromise['reject'](_0x30adef);}return _0x2fcbef[_0x8df2('0x31')]();};}function saveUpdates(_0x271dc2,_0x4e963d){return function(_0xc8fcc0){if(_0xc8fcc0){return _0xc8fcc0['update'](_0x271dc2)['then'](function(_0xdc292f){return _0xdc292f;});}return null;};}function removeEntity(_0xd6e2dc,_0x4affef){return function(_0x39305b){if(_0x39305b){return _0x39305b[_0x8df2('0x32')]()[_0x8df2('0x1e')](function(){var _0x7fa845=_0x39305b['get']({'plain':!![]});var _0x2f61a5='ChatQueues';return db[_0x8df2('0x33')][_0x8df2('0x32')]({'where':{'type':_0x2f61a5,'resourceId':_0x7fa845['id']}})[_0x8df2('0x1e')](function(){return _0x39305b;});})['then'](function(){_0xd6e2dc['status'](0xcc)[_0x8df2('0x2a')]();});}};}function handleEntityNotFound(_0x3a8f81,_0x16286d){return function(_0x196b3e){if(!_0x196b3e){_0x3a8f81[_0x8df2('0x28')](0x194);}return _0x196b3e;};}function handleError(_0x490956,_0x25e73b){_0x25e73b=_0x25e73b||0x1f4;return function(_0x4b81d5){logger[_0x8df2('0x25')](_0x4b81d5['stack']);if(_0x4b81d5[_0x8df2('0x34')]){delete _0x4b81d5[_0x8df2('0x34')];}_0x490956[_0x8df2('0x29')](_0x25e73b)[_0x8df2('0x35')](_0x4b81d5);};}exports[_0x8df2('0x36')]=function(_0x261b1d,_0x4b7fa8){var _0x34dffd={},_0x167e1d={},_0x41e510={'count':0x0,'rows':[]};var _0x2f0fdd=_[_0x8df2('0x37')](db[_0x8df2('0x38')][_0x8df2('0x39')],function(_0xbee36e){return{'name':_0xbee36e[_0x8df2('0x3a')],'type':_0xbee36e[_0x8df2('0x3b')]['key']};});_0x167e1d['model']=_[_0x8df2('0x37')](_0x2f0fdd,_0x8df2('0x34'));_0x167e1d[_0x8df2('0x3c')]=_[_0x8df2('0x3d')](_0x261b1d[_0x8df2('0x3c')]);_0x167e1d['filters']=_['intersection'](_0x167e1d['model'],_0x167e1d[_0x8df2('0x3c')]);_0x34dffd['attributes']=_[_0x8df2('0x3e')](_0x167e1d[_0x8df2('0x3f')],qs[_0x8df2('0x40')](_0x261b1d[_0x8df2('0x3c')][_0x8df2('0x40')]));_0x34dffd[_0x8df2('0x41')]=_0x34dffd[_0x8df2('0x41')]['length']?_0x34dffd[_0x8df2('0x41')]:_0x167e1d[_0x8df2('0x3f')];if(!_0x261b1d[_0x8df2('0x3c')][_0x8df2('0x42')](_0x8df2('0x43'))){_0x34dffd[_0x8df2('0x2d')]=qs['limit'](_0x261b1d['query'][_0x8df2('0x2d')]);_0x34dffd[_0x8df2('0x2b')]=qs[_0x8df2('0x2b')](_0x261b1d[_0x8df2('0x3c')][_0x8df2('0x2b')]);}_0x34dffd[_0x8df2('0x44')]=qs[_0x8df2('0x45')](_0x261b1d[_0x8df2('0x3c')][_0x8df2('0x45')]);_0x34dffd[_0x8df2('0x46')]=qs[_0x8df2('0x47')](_[_0x8df2('0x48')](_0x261b1d[_0x8df2('0x3c')],_0x167e1d[_0x8df2('0x47')]),_0x2f0fdd);if(_0x261b1d[_0x8df2('0x3c')]['filter']){_0x34dffd['where']=_[_0x8df2('0x49')](_0x34dffd[_0x8df2('0x46')],{'$or':_[_0x8df2('0x37')](_0x2f0fdd,function(_0x104bdb){if(_0x104bdb[_0x8df2('0x3b')]!==_0x8df2('0x4a')){var _0x34be6e={};_0x34be6e[_0x104bdb[_0x8df2('0x34')]]={'$like':'%'+_0x261b1d[_0x8df2('0x3c')][_0x8df2('0x4b')]+'%'};return _0x34be6e;}})});}_0x34dffd=_[_0x8df2('0x49')]({},_0x34dffd,_0x261b1d[_0x8df2('0x4c')]);var _0x4913e={'where':_0x34dffd[_0x8df2('0x46')]};return db[_0x8df2('0x38')][_0x8df2('0x2e')](_0x4913e)['then'](function(_0x754e11){_0x41e510[_0x8df2('0x2e')]=_0x754e11;if(_0x261b1d[_0x8df2('0x3c')][_0x8df2('0x4d')]){_0x34dffd['include']=[{'all':!![]}];}return db[_0x8df2('0x38')][_0x8df2('0x4e')](_0x34dffd);})[_0x8df2('0x1e')](function(_0x27eea4){_0x41e510[_0x8df2('0x4f')]=_0x27eea4;return _0x41e510;})[_0x8df2('0x1e')](respondWithFilteredResult(_0x4b7fa8,_0x34dffd))[_0x8df2('0x50')](handleError(_0x4b7fa8,null));};exports[_0x8df2('0x51')]=function(_0x428822,_0x471ca2){var _0xb300df={'raw':!![],'where':{'id':_0x428822[_0x8df2('0x52')]['id']}},_0x14a3b5={};_0x14a3b5[_0x8df2('0x3f')]=_[_0x8df2('0x3d')](db[_0x8df2('0x38')][_0x8df2('0x39')]);_0x14a3b5[_0x8df2('0x3c')]=_[_0x8df2('0x3d')](_0x428822['query']);_0x14a3b5[_0x8df2('0x47')]=_[_0x8df2('0x3e')](_0x14a3b5['model'],_0x14a3b5[_0x8df2('0x3c')]);_0xb300df[_0x8df2('0x41')]=_['intersection'](_0x14a3b5[_0x8df2('0x3f')],qs[_0x8df2('0x40')](_0x428822['query']['fields']));_0xb300df['attributes']=_0xb300df[_0x8df2('0x41')][_0x8df2('0x53')]?_0xb300df[_0x8df2('0x41')]:_0x14a3b5['model'];if(_0x428822[_0x8df2('0x3c')]['includeAll']){_0xb300df['include']=[{'all':!![]}];}_0xb300df=_[_0x8df2('0x49')]({},_0xb300df,_0x428822[_0x8df2('0x4c')]);return db['ChatQueue'][_0x8df2('0x54')](_0xb300df)['then'](handleEntityNotFound(_0x471ca2,null))[_0x8df2('0x1e')](respondWithResult(_0x471ca2,null))[_0x8df2('0x50')](handleError(_0x471ca2,null));};exports[_0x8df2('0x55')]=function(_0x1517f7,_0x2ac587){return db[_0x8df2('0x38')]['create'](_0x1517f7[_0x8df2('0x56')],{})[_0x8df2('0x1e')](function(_0x85d9f2){var _0x3078f6=_0x1517f7[_0x8df2('0x57')]['get']({'plain':!![]});if(!_0x3078f6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3078f6['role']===_0x8df2('0x57')){var _0x49aea0=_0x85d9f2['get']({'plain':!![]});var _0x36839b=_0x8df2('0x58');return db[_0x8df2('0x59')]['find']({'where':{'name':_0x36839b,'userProfileId':_0x3078f6[_0x8df2('0x5a')]},'raw':!![]})['then'](function(_0x424bfb){if(_0x424bfb&&_0x424bfb[_0x8df2('0x5b')]===0x0){return db[_0x8df2('0x33')][_0x8df2('0x55')]({'name':_0x49aea0[_0x8df2('0x34')],'resourceId':_0x49aea0['id'],'type':_0x424bfb[_0x8df2('0x34')],'sectionId':_0x424bfb['id']},{})['then'](function(){return _0x85d9f2;});}else{return _0x85d9f2;}})[_0x8df2('0x50')](function(_0x14fb10){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x14fb10);throw _0x14fb10;});}return _0x85d9f2;})['then'](respondWithResult(_0x2ac587,0xc9))[_0x8df2('0x50')](handleError(_0x2ac587,null));};exports[_0x8df2('0x5c')]=function(_0x3c204f,_0x35aafd){if(_0x3c204f['body']['id']){delete _0x3c204f['body']['id'];}return db[_0x8df2('0x38')]['find']({'where':{'id':_0x3c204f[_0x8df2('0x52')]['id']}})[_0x8df2('0x1e')](handleEntityNotFound(_0x35aafd,null))['then'](saveUpdates(_0x3c204f['body'],null))[_0x8df2('0x1e')](respondWithResult(_0x35aafd,null))[_0x8df2('0x50')](handleError(_0x35aafd,null));};exports['destroy']=function(_0x4c26fa,_0x51530e){return db['ChatQueue']['find']({'where':{'id':_0x4c26fa[_0x8df2('0x52')]['id']}})[_0x8df2('0x1e')](handleEntityNotFound(_0x51530e,null))[_0x8df2('0x1e')](removeEntity(_0x51530e,null))[_0x8df2('0x50')](handleError(_0x51530e,null));};exports['describe']=function(_0xb299bf,_0x8e031e){return db[_0x8df2('0x38')][_0x8df2('0x5d')]()['then'](respondWithResult(_0x8e031e,null))[_0x8df2('0x50')](handleError(_0x8e031e,null));};exports[_0x8df2('0x5e')]=function(_0xa8e5fd,_0x29ac3f,_0x1a93d9){var _0x54b8a8={'raw':!![],'where':{}},_0x276c00={},_0x202ed4;return db[_0x8df2('0x38')][_0x8df2('0x5f')]({'where':{'id':_0xa8e5fd[_0x8df2('0x52')]['id']}})[_0x8df2('0x1e')](handleEntityNotFound(_0x29ac3f,null))[_0x8df2('0x1e')](function(_0x1cbed3){if(_0x1cbed3){_0x202ed4=_0x1cbed3[_0x8df2('0x60')]({'plain':!![]});_0x276c00[_0x8df2('0x3f')]=_[_0x8df2('0x3d')](db['UserChatQueue']['rawAttributes']);_0x276c00[_0x8df2('0x3c')]=_[_0x8df2('0x3d')](_0xa8e5fd[_0x8df2('0x3c')]);_0x276c00[_0x8df2('0x47')]=_[_0x8df2('0x3e')](_0x276c00[_0x8df2('0x3f')],_0x276c00[_0x8df2('0x3c')]);_0x54b8a8['attributes']=_[_0x8df2('0x3e')](_0x276c00['model'],qs['fields'](_0xa8e5fd[_0x8df2('0x3c')][_0x8df2('0x40')]));_0x54b8a8[_0x8df2('0x41')]=_0x54b8a8[_0x8df2('0x41')]['length']?_0x54b8a8['attributes']:_0x276c00[_0x8df2('0x3f')];if(!_0xa8e5fd['query'][_0x8df2('0x42')]('nolimit')){_0x54b8a8[_0x8df2('0x2d')]=qs['limit'](_0xa8e5fd[_0x8df2('0x3c')]['limit']);_0x54b8a8[_0x8df2('0x2b')]=qs[_0x8df2('0x2b')](_0xa8e5fd[_0x8df2('0x3c')][_0x8df2('0x2b')]);}_0x54b8a8[_0x8df2('0x44')]=qs[_0x8df2('0x45')](_0xa8e5fd['query'][_0x8df2('0x45')]);_0x54b8a8[_0x8df2('0x46')]=qs[_0x8df2('0x47')](_[_0x8df2('0x48')](_0xa8e5fd['query'],_0x276c00[_0x8df2('0x47')]));_0x54b8a8[_0x8df2('0x46')][_0x8df2('0x61')]=_0x1cbed3['id'];if(_0xa8e5fd[_0x8df2('0x3c')][_0x8df2('0x4b')]){_0x54b8a8[_0x8df2('0x46')]=_[_0x8df2('0x49')](_0x54b8a8['where'],{'$or':_[_0x8df2('0x37')](_0x54b8a8[_0x8df2('0x41')],function(_0x3e0c05){var _0x5003b2={};_0x5003b2[_0x3e0c05]={'$like':'%'+_0xa8e5fd[_0x8df2('0x3c')][_0x8df2('0x4b')]+'%'};return _0x5003b2;})});}_0x54b8a8=_[_0x8df2('0x49')]({},_0x54b8a8,_0xa8e5fd[_0x8df2('0x4c')]);return db[_0x8df2('0x62')][_0x8df2('0x4e')](_0x54b8a8);}})[_0x8df2('0x1e')](function(_0x4eb6e0){if(_0x4eb6e0){return db[_0x8df2('0x63')][_0x8df2('0x64')]({'where':{'id':_[_0x8df2('0x37')](_0x4eb6e0,_0x8df2('0x65')),'role':'agent'},'attributes':['id',_0x8df2('0x34'),_0x8df2('0x66'),_0x8df2('0x67'),'createdAt']});}})[_0x8df2('0x1e')](function(_0x21df53){if(_0x21df53){return{'count':_0x21df53[_0x8df2('0x2e')],'rows':_['map'](_0x21df53['rows'],function(_0x36e297){return{'membername':_0x36e297[_0x8df2('0x34')],'UserId':_0x36e297['id'],'queue_name':_0x202ed4[_0x8df2('0x34')],'ChatQueueId':_0x202ed4['id'],'interface':util[_0x8df2('0x68')]('%s/%s',_0x8df2('0x69'),_0x36e297[_0x8df2('0x34')]),'penalty':0x0,'paused':_0x36e297[_0x8df2('0x66')],'createdAt':_0x36e297[_0x8df2('0x6a')],'updatedAt':_0x36e297[_0x8df2('0x67')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x8df2('0x1e')](respondWithFilteredResult(_0x29ac3f,_0x54b8a8))[_0x8df2('0x50')](handleError(_0x29ac3f,null));};exports['getTeams']=function(_0x5386b2,_0x25ab97,_0xfa446a){var _0x521340={};var _0xb63ed5={};var _0x23e068;var _0x5209e6;return db[_0x8df2('0x38')]['findOne']({'where':{'id':_0x5386b2[_0x8df2('0x52')]['id']}})[_0x8df2('0x1e')](handleEntityNotFound(_0x25ab97,null))['then'](function(_0x557eb8){if(_0x557eb8){_0x23e068=_0x557eb8;_0xb63ed5['model']=_[_0x8df2('0x3d')](db[_0x8df2('0x6b')][_0x8df2('0x39')]);_0xb63ed5['query']=_[_0x8df2('0x3d')](_0x5386b2['query']);_0xb63ed5['filters']=_[_0x8df2('0x3e')](_0xb63ed5[_0x8df2('0x3f')],_0xb63ed5[_0x8df2('0x3c')]);_0x521340[_0x8df2('0x41')]=_[_0x8df2('0x3e')](_0xb63ed5[_0x8df2('0x3f')],qs['fields'](_0x5386b2[_0x8df2('0x3c')][_0x8df2('0x40')]));_0x521340[_0x8df2('0x41')]=_0x521340[_0x8df2('0x41')][_0x8df2('0x53')]?_0x521340[_0x8df2('0x41')]:_0xb63ed5[_0x8df2('0x3f')];_0x521340[_0x8df2('0x44')]=qs[_0x8df2('0x45')](_0x5386b2[_0x8df2('0x3c')][_0x8df2('0x45')]);_0x521340[_0x8df2('0x46')]=qs[_0x8df2('0x47')](_['pick'](_0x5386b2[_0x8df2('0x3c')],_0xb63ed5['filters']));if(_0x5386b2[_0x8df2('0x3c')][_0x8df2('0x4b')]){_0x521340['where']=_['merge'](_0x521340['where'],{'$or':_[_0x8df2('0x37')](_0x521340['attributes'],function(_0x18759b){var _0x3f51ca={};_0x3f51ca[_0x18759b]={'$like':'%'+_0x5386b2[_0x8df2('0x3c')][_0x8df2('0x4b')]+'%'};return _0x3f51ca;})});}_0x521340=_['merge']({},_0x521340,_0x5386b2['options']);return _0x23e068[_0x8df2('0x6c')](_0x521340);}})['then'](function(_0x4cc8bf){if(_0x4cc8bf){_0x5209e6=_0x4cc8bf['length'];if(!_0x5386b2[_0x8df2('0x3c')][_0x8df2('0x42')](_0x8df2('0x43'))){_0x521340[_0x8df2('0x2d')]=qs[_0x8df2('0x2d')](_0x5386b2[_0x8df2('0x3c')]['limit']);_0x521340[_0x8df2('0x2b')]=qs[_0x8df2('0x2b')](_0x5386b2[_0x8df2('0x3c')][_0x8df2('0x2b')]);}return _0x23e068[_0x8df2('0x6c')](_0x521340);}})['then'](function(_0xdc6cdd){if(_0xdc6cdd){return _0xdc6cdd?{'count':_0x5209e6,'rows':_0xdc6cdd}:null;}})[_0x8df2('0x1e')](respondWithResult(_0x25ab97,null))[_0x8df2('0x50')](handleError(_0x25ab97,null));};exports['addTeams']=function(_0x534585,_0x34e85b,_0x4986f4){var _0x125a16=_0x534585[_0x8df2('0x56')]['ids'];return db[_0x8df2('0x6b')][_0x8df2('0x4e')]({'where':{'id':_0x125a16},'attributes':['id'],'include':[{'model':db[_0x8df2('0x63')],'as':_0x8df2('0x6d'),'attributes':['id',_0x8df2('0x34'),_0x8df2('0x6e'),_0x8df2('0x6f'),'interface'],'raw':!![]}]})[_0x8df2('0x1e')](function(_0x8f903e){if(_0x8f903e){var _0x293259=_[_0x8df2('0x70')](_0x8f903e,function(_0x2c2a55){var _0x36cf3a=_0x2c2a55[_0x8df2('0x60')]({'plain':!![]});return _0x36cf3a[_0x8df2('0x6d')];});return db['ChatQueue'][_0x8df2('0x54')]({'where':{'id':_0x534585['params']['id']}})[_0x8df2('0x1e')](function(_0x18aea6){return db['sequelize'][_0x8df2('0x71')](function(_0x46b5b3){return _0x18aea6['addTeams'](_0x125a16,{'transaction':_0x46b5b3})['then'](function(){return BPromise[_0x8df2('0x72')](_0x293259,function(_0x4fd0be){return db[_0x8df2('0x62')]['findOrCreate']({'where':{'UserId':_0x4fd0be['id'],'ChatQueueId':_0x534585[_0x8df2('0x52')]['id']},'transaction':_0x46b5b3});});})[_0x8df2('0x1e')](function(){_0x293259[_0x8df2('0x73')](function(_0x572d65){socket['emit']('userChatQueue:save',{'UserId':_0x572d65['id'],'ChatQueueId':_0x18aea6['id']});});});});});}})['then'](respondWithStatusCode(_0x34e85b,null))['catch'](handleError(_0x34e85b,null));};exports['removeTeams']=function(_0x15534f,_0x48c429,_0x5029d9){return db['Team'][_0x8df2('0x4e')]({'where':{'id':_0x15534f[_0x8df2('0x3c')][_0x8df2('0x74')]},'attributes':['id'],'include':[{'model':db[_0x8df2('0x63')],'as':_0x8df2('0x6d'),'attributes':['id'],'raw':!![]}]})[_0x8df2('0x1e')](handleEntityNotFound(_0x48c429,null))[_0x8df2('0x1e')](function(_0x2a261d){var _0xcdd1a3=_[_0x8df2('0x37')](_0x2a261d,'id');var _0x1422b9=[];var _0x23fd80=[];var _0x432e94=squel['select']();_0x432e94[_0x8df2('0x75')](_0x8df2('0x76'))[_0x8df2('0x77')](_0x8df2('0x78'),'tq')[_0x8df2('0x79')](_0x8df2('0x7a'),'ut',_0x8df2('0x7b'))[_0x8df2('0x46')](_0x8df2('0x7c'),_0x15534f[_0x8df2('0x52')]['id']);for(var _0x9f8849=0x0;_0x9f8849<_0x2a261d['length'];_0x9f8849+=0x1){let _0x9e1305=_0x2a261d[_0x9f8849];for(var _0x1c3810=0x0;_0x1c3810<_0x9e1305[_0x8df2('0x6d')][_0x8df2('0x53')];_0x1c3810+=0x1){let _0x2d2a6c=_0x9e1305[_0x8df2('0x6d')][_0x1c3810];var _0x56cb43=_0x432e94['clone']();_0x56cb43[_0x8df2('0x46')](_0x8df2('0x7d'),_0x2d2a6c['id']);_0x23fd80[_0x8df2('0x7e')](db[_0x8df2('0x7f')][_0x8df2('0x3c')](_0x56cb43[_0x8df2('0x80')](),{'type':db['sequelize']['QueryTypes'][_0x8df2('0x81')]})[_0x8df2('0x1e')](function(_0x3c29b5){if(_0x3c29b5['length']===0x1){return _0x2d2a6c['id'];}else{var _0x54bad5=_['every'](_['map'](_0x3c29b5,'TeamId'),function(_0x504d42){return _['includes'](_0xcdd1a3,_0x504d42);});if(_0x54bad5){return _0x2d2a6c['id'];}}}));}}return BPromise[_0x8df2('0x82')](_0x23fd80)[_0x8df2('0x1e')](function(_0x298ff1){_0x1422b9=_(_0x1422b9)[_0x8df2('0x83')](_0x298ff1)[_0x8df2('0x84')]()[_0x8df2('0x85')]();return db[_0x8df2('0x38')][_0x8df2('0x54')]({'where':{'id':_0x15534f[_0x8df2('0x52')]['id']}})[_0x8df2('0x1e')](function(_0x468c5a){return db['sequelize']['transaction'](function(_0x19f03f){return _0x468c5a['removeTeams'](_0x15534f[_0x8df2('0x3c')][_0x8df2('0x74')],{'transaction':_0x19f03f})[_0x8df2('0x1e')](function(){if(!_['isEmpty'](_0x1422b9)){return _0x468c5a[_0x8df2('0x86')](_0x1422b9,{'transaction':_0x19f03f});}})[_0x8df2('0x1e')](function(){_0x1422b9[_0x8df2('0x73')](function(_0x212146){socket['emit'](_0x8df2('0x87'),{'UserId':_0x212146,'ChatQueueId':_0x468c5a['id']});});});});});});})[_0x8df2('0x1e')](respondWithStatusCode(_0x48c429,null))['catch'](handleError(_0x48c429,null));};exports[_0x8df2('0x88')]=function(_0xee637f,_0x1d9ac7,_0x3da538){return db[_0x8df2('0x38')][_0x8df2('0x54')]({'where':{'id':_0xee637f[_0x8df2('0x52')]['id']}})[_0x8df2('0x1e')](handleEntityNotFound(_0x1d9ac7,null))[_0x8df2('0x1e')](function(_0x3c2f82){if(_0x3c2f82){return _0x3c2f82[_0x8df2('0x88')](_0xee637f['body']['ids'],_[_0x8df2('0x89')](_0xee637f[_0x8df2('0x56')],['ids','id'])||{})[_0x8df2('0x8a')](function(_0x507711){for(var _0x1fd23f=0x0;_0x1fd23f<_0xee637f[_0x8df2('0x56')][_0x8df2('0x74')][_0x8df2('0x53')];_0x1fd23f+=0x1){socket[_0x8df2('0x8b')](_0x8df2('0x8c'),{'UserId':Number(_0xee637f[_0x8df2('0x56')][_0x8df2('0x74')][_0x1fd23f]),'ChatQueueId':Number(_0xee637f[_0x8df2('0x52')]['id'])});}return _0x507711;});}})['then'](respondWithResult(_0x1d9ac7,null))[_0x8df2('0x50')](handleError(_0x1d9ac7,null));};exports[_0x8df2('0x86')]=function(_0x2de239,_0x4bc721,_0x36087d){return db[_0x8df2('0x38')]['find']({'where':{'id':_0x2de239[_0x8df2('0x52')]['id']}})[_0x8df2('0x1e')](handleEntityNotFound(_0x4bc721,null))['then'](function(_0x368388){if(_0x368388){return _0x368388[_0x8df2('0x86')](_0x2de239[_0x8df2('0x3c')][_0x8df2('0x74')])['then'](function(){if(_[_0x8df2('0x8d')](_0x2de239[_0x8df2('0x3c')][_0x8df2('0x74')])){for(var _0x3adf7f=0x0;_0x3adf7f<_0x2de239[_0x8df2('0x3c')][_0x8df2('0x74')][_0x8df2('0x53')];_0x3adf7f+=0x1){socket[_0x8df2('0x8b')](_0x8df2('0x87'),{'UserId':Number(_0x2de239[_0x8df2('0x3c')]['ids'][_0x3adf7f]),'ChatQueueId':Number(_0x2de239[_0x8df2('0x52')]['id'])});}}else{socket[_0x8df2('0x8b')](_0x8df2('0x87'),{'UserId':Number(_0x2de239[_0x8df2('0x3c')][_0x8df2('0x74')]),'ChatQueueId':Number(_0x2de239[_0x8df2('0x52')]['id'])});}});}})[_0x8df2('0x1e')](respondWithStatusCode(_0x4bc721,null))[_0x8df2('0x50')](handleError(_0x4bc721,null));};exports[_0x8df2('0x8e')]=function(_0x1d9265,_0x4b63e7,_0x48fa98){var _0x21ea6d={};var _0x438d87={};var _0x9c26fa;var _0x293ce6;return db[_0x8df2('0x38')]['findOne']({'where':{'id':_0x1d9265[_0x8df2('0x52')]['id']}})[_0x8df2('0x1e')](handleEntityNotFound(_0x4b63e7,null))['then'](function(_0x4fc369){if(_0x4fc369){_0x9c26fa=_0x4fc369;_0x438d87[_0x8df2('0x3f')]=_[_0x8df2('0x3d')](db[_0x8df2('0x63')][_0x8df2('0x39')]);_0x438d87[_0x8df2('0x3c')]=_['keys'](_0x1d9265[_0x8df2('0x3c')]);_0x438d87['filters']=_[_0x8df2('0x3e')](_0x438d87['model'],_0x438d87[_0x8df2('0x3c')]);_0x21ea6d[_0x8df2('0x41')]=_[_0x8df2('0x3e')](_0x438d87['model'],qs['fields'](_0x1d9265[_0x8df2('0x3c')][_0x8df2('0x40')]));_0x21ea6d[_0x8df2('0x41')]=_0x21ea6d['attributes']['length']?_0x21ea6d['attributes']:_0x438d87[_0x8df2('0x3f')];_0x21ea6d[_0x8df2('0x44')]=qs[_0x8df2('0x45')](_0x1d9265['query']['sort']);_0x21ea6d[_0x8df2('0x46')]=qs['filters'](_[_0x8df2('0x48')](_0x1d9265[_0x8df2('0x3c')],_0x438d87[_0x8df2('0x47')]));if(_0x1d9265[_0x8df2('0x3c')][_0x8df2('0x4b')]){_0x21ea6d['where']=_[_0x8df2('0x49')](_0x21ea6d[_0x8df2('0x46')],{'$or':_['map'](_0x21ea6d[_0x8df2('0x41')],function(_0xf36da8){var _0x38d1d9={};_0x38d1d9[_0xf36da8]={'$like':'%'+_0x1d9265[_0x8df2('0x3c')][_0x8df2('0x4b')]+'%'};return _0x38d1d9;})});}_0x21ea6d=_[_0x8df2('0x49')]({},_0x21ea6d,_0x1d9265[_0x8df2('0x4c')]);return _0x9c26fa['getAgents'](_0x21ea6d);}})['then'](function(_0x33a880){if(_0x33a880){_0x293ce6=_0x33a880[_0x8df2('0x53')];if(!_0x1d9265[_0x8df2('0x3c')][_0x8df2('0x42')](_0x8df2('0x43'))){_0x21ea6d[_0x8df2('0x2d')]=qs[_0x8df2('0x2d')](_0x1d9265['query'][_0x8df2('0x2d')]);_0x21ea6d[_0x8df2('0x2b')]=qs[_0x8df2('0x2b')](_0x1d9265[_0x8df2('0x3c')][_0x8df2('0x2b')]);}return _0x9c26fa[_0x8df2('0x8e')](_0x21ea6d);}})[_0x8df2('0x1e')](function(_0x316ce1){if(_0x316ce1){return _0x316ce1?{'count':_0x293ce6,'rows':_0x316ce1}:null;}})[_0x8df2('0x1e')](respondWithResult(_0x4b63e7,null))[_0x8df2('0x50')](handleError(_0x4b63e7,null));}; \ No newline at end of file +var _0xa8fd=['../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','jayson/promise','client','request','ChatQueue,\x20%s,\x20%s','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','status','json','undefined','limit','count','offset','Content-Range','apply','save','update','destroy','then','ChatQueues','UserProfileResource','end','sendStatus','name','send','index','map','ChatQueue','rawAttributes','type','key','model','keys','query','filters','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','show','params','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','intersection','UserChatQueue','User','findAndCountAll','agent','updatedAt','createdAt','rows','format','%s/%s','getTeams','addTeams','ids','Team','findAll','Agents','online','voicePause','interface','transaction','findOrCreate','userChatQueue:save','removeTeams','field','tq.TeamId','from','join','user_has_teams','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','sequelize','toString','SELECT','every','TeamId','all','compact','value','isEmpty','emit','userChatQueue:remove','addAgents','spread','removeAgents','isArray','getAgents','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xa8fd,0x19f));var _0xda8f=function(_0x2c9c68,_0x49ad48){_0x2c9c68=_0x2c9c68-0x0;var _0x53576f=_0xa8fd[_0x2c9c68];return _0x53576f;};'use strict';var emlformat=require(_0xda8f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xda8f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xda8f('0x2'));var moment=require(_0xda8f('0x3'));var BPromise=require(_0xda8f('0x4'));var Mustache=require(_0xda8f('0x5'));var util=require(_0xda8f('0x6'));var path=require(_0xda8f('0x7'));var sox=require(_0xda8f('0x8'));var csv=require(_0xda8f('0x9'));var ejs=require(_0xda8f('0xa'));var fs=require('fs');var fs_extra=require(_0xda8f('0xb'));var _=require(_0xda8f('0xc'));var squel=require(_0xda8f('0xd'));var crypto=require('crypto');var jsforce=require(_0xda8f('0xe'));var deskjs=require(_0xda8f('0xf'));var toCsv=require(_0xda8f('0x9'));var querystring=require(_0xda8f('0x10'));var Papa=require(_0xda8f('0x11'));var Redis=require(_0xda8f('0x12'));var authService=require(_0xda8f('0x13'));var qs=require(_0xda8f('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xda8f('0x15'))('api');var utils=require(_0xda8f('0x16'));var config=require(_0xda8f('0x17'));var licenseUtil=require(_0xda8f('0x18'));var db=require(_0xda8f('0x19'))['db'];config[_0xda8f('0x1a')]=_[_0xda8f('0x1b')](config[_0xda8f('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xda8f('0x1c'))(new Redis(config[_0xda8f('0x1a')]));require('./chatQueue.socket')[_0xda8f('0x1d')](socket);var jayson=require(_0xda8f('0x1e'));var client=jayson[_0xda8f('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x27b793,_0x3788ae,_0x43d058,_0x57627b){return new BPromise(function(_0x2f75ce,_0x2367ff){var _0x3e295f=_0x57627b||client;return _0x3e295f[_0xda8f('0x20')](_0x27b793,_0x43d058)['then'](function(_0x3a9711){logger['info'](_0xda8f('0x21'),_0x3788ae,_0xda8f('0x22'));logger['debug'](_0xda8f('0x23'),_0x3788ae,_0xda8f('0x22'),JSON[_0xda8f('0x24')](_0x3a9711));if(_0x3a9711[_0xda8f('0x25')]){if(_0x3a9711['error'][_0xda8f('0x26')]===0x1f4){logger[_0xda8f('0x25')](_0xda8f('0x21'),_0x3788ae,_0x3a9711['error'][_0xda8f('0x27')]);return _0x2367ff(_0x3a9711[_0xda8f('0x25')][_0xda8f('0x27')]);}logger[_0xda8f('0x25')](_0xda8f('0x21'),_0x3788ae,_0x3a9711['error']['message']);return _0x2f75ce(_0x3a9711[_0xda8f('0x25')][_0xda8f('0x27')]);}else{logger[_0xda8f('0x28')](_0xda8f('0x21'),_0x3788ae,_0xda8f('0x22'));_0x2f75ce(_0x3a9711['result'][_0xda8f('0x27')]);}})[_0xda8f('0x29')](function(_0x27ba46){logger[_0xda8f('0x25')](_0xda8f('0x21'),_0x3788ae,_0x27ba46);_0x2367ff(_0x27ba46);});});}function respondWithStatusCode(_0x42906a,_0x591dca){_0x591dca=_0x591dca||0xcc;return function(_0x582e8b){if(_0x582e8b){return _0x42906a['sendStatus'](_0x591dca);}return _0x42906a[_0xda8f('0x2a')](_0x591dca)['end']();};}function respondWithResult(_0x42389e,_0x1fa685){_0x1fa685=_0x1fa685||0xc8;return function(_0x1b3f1d){if(_0x1b3f1d){return _0x42389e[_0xda8f('0x2a')](_0x1fa685)[_0xda8f('0x2b')](_0x1b3f1d);}};}function respondWithFilteredResult(_0x50565c,_0x68a0fe){return function(_0x271959){if(_0x271959){var _0x79e39e=typeof _0x68a0fe['offset']===_0xda8f('0x2c')&&typeof _0x68a0fe[_0xda8f('0x2d')]==='undefined';var _0x357618=_0x271959[_0xda8f('0x2e')];var _0x1fdfec=_0x79e39e?0x0:_0x68a0fe['offset'];var _0x43477b=_0x79e39e?_0x271959[_0xda8f('0x2e')]:_0x68a0fe[_0xda8f('0x2f')]+_0x68a0fe[_0xda8f('0x2d')];var _0x1cdc7f;if(_0x43477b>=_0x357618){_0x43477b=_0x357618;_0x1cdc7f=0xc8;}else{_0x1cdc7f=0xce;}_0x50565c[_0xda8f('0x2a')](_0x1cdc7f);return _0x50565c['set'](_0xda8f('0x30'),_0x1fdfec+'-'+_0x43477b+'/'+_0x357618)[_0xda8f('0x2b')](_0x271959);}return null;};}function patchUpdates(_0x3e7482){return function(_0x4fe133){try{jsonpatch[_0xda8f('0x31')](_0x4fe133,_0x3e7482,!![]);}catch(_0x5132cb){return BPromise['reject'](_0x5132cb);}return _0x4fe133[_0xda8f('0x32')]();};}function saveUpdates(_0x360ec5,_0x26232b){return function(_0x336e7c){if(_0x336e7c){return _0x336e7c[_0xda8f('0x33')](_0x360ec5)['then'](function(_0x2ec48b){return _0x2ec48b;});}return null;};}function removeEntity(_0x510df0,_0x5531fc){return function(_0x42c59c){if(_0x42c59c){return _0x42c59c[_0xda8f('0x34')]()[_0xda8f('0x35')](function(){var _0x299085=_0x42c59c['get']({'plain':!![]});var _0x433002=_0xda8f('0x36');return db[_0xda8f('0x37')]['destroy']({'where':{'type':_0x433002,'resourceId':_0x299085['id']}})[_0xda8f('0x35')](function(){return _0x42c59c;});})[_0xda8f('0x35')](function(){_0x510df0[_0xda8f('0x2a')](0xcc)[_0xda8f('0x38')]();});}};}function handleEntityNotFound(_0x4ca540,_0x459936){return function(_0x5a99a8){if(!_0x5a99a8){_0x4ca540[_0xda8f('0x39')](0x194);}return _0x5a99a8;};}function handleError(_0x19e247,_0x93ec11){_0x93ec11=_0x93ec11||0x1f4;return function(_0x3c43ba){logger[_0xda8f('0x25')](_0x3c43ba['stack']);if(_0x3c43ba[_0xda8f('0x3a')]){delete _0x3c43ba['name'];}_0x19e247['status'](_0x93ec11)[_0xda8f('0x3b')](_0x3c43ba);};}exports[_0xda8f('0x3c')]=function(_0x2945ac,_0x39bc0d){var _0x3d5310={},_0x2db641={},_0x2e2ec8={'count':0x0,'rows':[]};var _0x3dc621=_[_0xda8f('0x3d')](db[_0xda8f('0x3e')][_0xda8f('0x3f')],function(_0x4538f7){return{'name':_0x4538f7['fieldName'],'type':_0x4538f7[_0xda8f('0x40')][_0xda8f('0x41')]};});_0x2db641[_0xda8f('0x42')]=_[_0xda8f('0x3d')](_0x3dc621,_0xda8f('0x3a'));_0x2db641['query']=_[_0xda8f('0x43')](_0x2945ac[_0xda8f('0x44')]);_0x2db641[_0xda8f('0x45')]=_['intersection'](_0x2db641[_0xda8f('0x42')],_0x2db641[_0xda8f('0x44')]);_0x3d5310['attributes']=_['intersection'](_0x2db641[_0xda8f('0x42')],qs[_0xda8f('0x46')](_0x2945ac[_0xda8f('0x44')]['fields']));_0x3d5310[_0xda8f('0x47')]=_0x3d5310['attributes']['length']?_0x3d5310[_0xda8f('0x47')]:_0x2db641[_0xda8f('0x42')];if(!_0x2945ac[_0xda8f('0x44')][_0xda8f('0x48')](_0xda8f('0x49'))){_0x3d5310[_0xda8f('0x2d')]=qs['limit'](_0x2945ac[_0xda8f('0x44')][_0xda8f('0x2d')]);_0x3d5310['offset']=qs[_0xda8f('0x2f')](_0x2945ac['query'][_0xda8f('0x2f')]);}_0x3d5310[_0xda8f('0x4a')]=qs[_0xda8f('0x4b')](_0x2945ac[_0xda8f('0x44')][_0xda8f('0x4b')]);_0x3d5310[_0xda8f('0x4c')]=qs[_0xda8f('0x45')](_[_0xda8f('0x4d')](_0x2945ac[_0xda8f('0x44')],_0x2db641[_0xda8f('0x45')]),_0x3dc621);if(_0x2945ac['query'][_0xda8f('0x4e')]){_0x3d5310[_0xda8f('0x4c')]=_[_0xda8f('0x4f')](_0x3d5310[_0xda8f('0x4c')],{'$or':_[_0xda8f('0x3d')](_0x3dc621,function(_0x1d1724){if(_0x1d1724[_0xda8f('0x40')]!==_0xda8f('0x50')){var _0x10bdf8={};_0x10bdf8[_0x1d1724[_0xda8f('0x3a')]]={'$like':'%'+_0x2945ac[_0xda8f('0x44')][_0xda8f('0x4e')]+'%'};return _0x10bdf8;}})});}_0x3d5310=_[_0xda8f('0x4f')]({},_0x3d5310,_0x2945ac[_0xda8f('0x51')]);var _0x387875={'where':_0x3d5310[_0xda8f('0x4c')]};return db[_0xda8f('0x3e')][_0xda8f('0x2e')](_0x387875)[_0xda8f('0x35')](function(_0x3ec4e0){_0x2e2ec8[_0xda8f('0x2e')]=_0x3ec4e0;if(_0x2945ac[_0xda8f('0x44')][_0xda8f('0x52')]){_0x3d5310[_0xda8f('0x53')]=[{'all':!![]}];}return db['ChatQueue']['findAll'](_0x3d5310);})[_0xda8f('0x35')](function(_0x58b771){_0x2e2ec8['rows']=_0x58b771;return _0x2e2ec8;})[_0xda8f('0x35')](respondWithFilteredResult(_0x39bc0d,_0x3d5310))['catch'](handleError(_0x39bc0d,null));};exports[_0xda8f('0x54')]=function(_0x80cdbd,_0x34363d){var _0x549f7f={'raw':!![],'where':{'id':_0x80cdbd[_0xda8f('0x55')]['id']}},_0x1e6843={};_0x1e6843[_0xda8f('0x42')]=_[_0xda8f('0x43')](db['ChatQueue']['rawAttributes']);_0x1e6843[_0xda8f('0x44')]=_[_0xda8f('0x43')](_0x80cdbd[_0xda8f('0x44')]);_0x1e6843[_0xda8f('0x45')]=_['intersection'](_0x1e6843['model'],_0x1e6843[_0xda8f('0x44')]);_0x549f7f[_0xda8f('0x47')]=_['intersection'](_0x1e6843[_0xda8f('0x42')],qs['fields'](_0x80cdbd[_0xda8f('0x44')][_0xda8f('0x46')]));_0x549f7f[_0xda8f('0x47')]=_0x549f7f[_0xda8f('0x47')][_0xda8f('0x56')]?_0x549f7f[_0xda8f('0x47')]:_0x1e6843[_0xda8f('0x42')];if(_0x80cdbd[_0xda8f('0x44')][_0xda8f('0x52')]){_0x549f7f[_0xda8f('0x53')]=[{'all':!![]}];}_0x549f7f=_[_0xda8f('0x4f')]({},_0x549f7f,_0x80cdbd[_0xda8f('0x51')]);return db['ChatQueue']['find'](_0x549f7f)[_0xda8f('0x35')](handleEntityNotFound(_0x34363d,null))[_0xda8f('0x35')](respondWithResult(_0x34363d,null))['catch'](handleError(_0x34363d,null));};exports[_0xda8f('0x57')]=function(_0x243c68,_0x2d9f7d){return db[_0xda8f('0x3e')][_0xda8f('0x57')](_0x243c68[_0xda8f('0x58')],{})[_0xda8f('0x35')](function(_0x12b583){var _0x5db342=_0x243c68[_0xda8f('0x59')]['get']({'plain':!![]});if(!_0x5db342)throw new Error(_0xda8f('0x5a'));if(_0x5db342[_0xda8f('0x5b')]===_0xda8f('0x59')){var _0x5bbb7d=_0x12b583[_0xda8f('0x5c')]({'plain':!![]});var _0x513a25=_0xda8f('0x36');return db['UserProfileSection'][_0xda8f('0x5d')]({'where':{'name':_0x513a25,'userProfileId':_0x5db342[_0xda8f('0x5e')]},'raw':!![]})[_0xda8f('0x35')](function(_0x8f7524){if(_0x8f7524&&_0x8f7524['autoAssociation']===0x0){return db[_0xda8f('0x37')][_0xda8f('0x57')]({'name':_0x5bbb7d[_0xda8f('0x3a')],'resourceId':_0x5bbb7d['id'],'type':_0x8f7524['name'],'sectionId':_0x8f7524['id']},{})['then'](function(){return _0x12b583;});}else{return _0x12b583;}})[_0xda8f('0x29')](function(_0x1bb663){logger[_0xda8f('0x25')](_0xda8f('0x5f'),_0x1bb663);throw _0x1bb663;});}return _0x12b583;})[_0xda8f('0x35')](respondWithResult(_0x2d9f7d,0xc9))['catch'](handleError(_0x2d9f7d,null));};exports[_0xda8f('0x33')]=function(_0x355f25,_0x147d5d){if(_0x355f25['body']['id']){delete _0x355f25[_0xda8f('0x58')]['id'];}return db[_0xda8f('0x3e')]['find']({'where':{'id':_0x355f25[_0xda8f('0x55')]['id']}})['then'](handleEntityNotFound(_0x147d5d,null))[_0xda8f('0x35')](saveUpdates(_0x355f25[_0xda8f('0x58')],null))[_0xda8f('0x35')](respondWithResult(_0x147d5d,null))['catch'](handleError(_0x147d5d,null));};exports[_0xda8f('0x34')]=function(_0x3954b2,_0xc80e57){return db[_0xda8f('0x3e')][_0xda8f('0x5d')]({'where':{'id':_0x3954b2[_0xda8f('0x55')]['id']}})[_0xda8f('0x35')](handleEntityNotFound(_0xc80e57,null))['then'](removeEntity(_0xc80e57,null))[_0xda8f('0x29')](handleError(_0xc80e57,null));};exports[_0xda8f('0x60')]=function(_0x399d22,_0x1895e0){return db['ChatQueue'][_0xda8f('0x60')]()[_0xda8f('0x35')](respondWithResult(_0x1895e0,null))[_0xda8f('0x29')](handleError(_0x1895e0,null));};exports[_0xda8f('0x61')]=function(_0x6bbb8a,_0x7bcb,_0x45fba0){var _0x102a74={'raw':!![],'where':{}},_0x3cdbbb={},_0x1cd9e3;return db[_0xda8f('0x3e')][_0xda8f('0x62')]({'where':{'id':_0x6bbb8a[_0xda8f('0x55')]['id']}})[_0xda8f('0x35')](handleEntityNotFound(_0x7bcb,null))[_0xda8f('0x35')](function(_0x7260b2){if(_0x7260b2){_0x1cd9e3=_0x7260b2[_0xda8f('0x5c')]({'plain':!![]});_0x3cdbbb[_0xda8f('0x42')]=_['keys'](db['UserChatQueue']['rawAttributes']);_0x3cdbbb['query']=_[_0xda8f('0x43')](_0x6bbb8a[_0xda8f('0x44')]);_0x3cdbbb[_0xda8f('0x45')]=_[_0xda8f('0x63')](_0x3cdbbb[_0xda8f('0x42')],_0x3cdbbb['query']);_0x102a74[_0xda8f('0x47')]=_['intersection'](_0x3cdbbb[_0xda8f('0x42')],qs[_0xda8f('0x46')](_0x6bbb8a[_0xda8f('0x44')]['fields']));_0x102a74['attributes']=_0x102a74[_0xda8f('0x47')][_0xda8f('0x56')]?_0x102a74[_0xda8f('0x47')]:_0x3cdbbb['model'];if(!_0x6bbb8a['query'][_0xda8f('0x48')](_0xda8f('0x49'))){_0x102a74[_0xda8f('0x2d')]=qs['limit'](_0x6bbb8a[_0xda8f('0x44')]['limit']);_0x102a74[_0xda8f('0x2f')]=qs[_0xda8f('0x2f')](_0x6bbb8a[_0xda8f('0x44')][_0xda8f('0x2f')]);}_0x102a74[_0xda8f('0x4a')]=qs[_0xda8f('0x4b')](_0x6bbb8a[_0xda8f('0x44')]['sort']);_0x102a74[_0xda8f('0x4c')]=qs[_0xda8f('0x45')](_['pick'](_0x6bbb8a[_0xda8f('0x44')],_0x3cdbbb[_0xda8f('0x45')]));_0x102a74['where']['ChatQueueId']=_0x7260b2['id'];if(_0x6bbb8a[_0xda8f('0x44')][_0xda8f('0x4e')]){_0x102a74[_0xda8f('0x4c')]=_[_0xda8f('0x4f')](_0x102a74[_0xda8f('0x4c')],{'$or':_[_0xda8f('0x3d')](_0x102a74[_0xda8f('0x47')],function(_0x4b01d1){var _0x3abd0d={};_0x3abd0d[_0x4b01d1]={'$like':'%'+_0x6bbb8a['query'][_0xda8f('0x4e')]+'%'};return _0x3abd0d;})});}_0x102a74=_[_0xda8f('0x4f')]({},_0x102a74,_0x6bbb8a[_0xda8f('0x51')]);return db[_0xda8f('0x64')]['findAll'](_0x102a74);}})[_0xda8f('0x35')](function(_0xc0092){if(_0xc0092){return db[_0xda8f('0x65')][_0xda8f('0x66')]({'where':{'id':_[_0xda8f('0x3d')](_0xc0092,'UserId'),'role':_0xda8f('0x67')},'attributes':['id',_0xda8f('0x3a'),'chatPause',_0xda8f('0x68'),_0xda8f('0x69')]});}})['then'](function(_0x383305){if(_0x383305){return{'count':_0x383305[_0xda8f('0x2e')],'rows':_[_0xda8f('0x3d')](_0x383305[_0xda8f('0x6a')],function(_0x437c0d){return{'membername':_0x437c0d['name'],'UserId':_0x437c0d['id'],'queue_name':_0x1cd9e3[_0xda8f('0x3a')],'ChatQueueId':_0x1cd9e3['id'],'interface':util[_0xda8f('0x6b')](_0xda8f('0x6c'),'SIP',_0x437c0d['name']),'penalty':0x0,'paused':_0x437c0d['chatPause'],'createdAt':_0x437c0d[_0xda8f('0x69')],'updatedAt':_0x437c0d[_0xda8f('0x68')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xda8f('0x35')](respondWithFilteredResult(_0x7bcb,_0x102a74))[_0xda8f('0x29')](handleError(_0x7bcb,null));};exports['getTeams']=function(_0x170885,_0x2e89b6,_0x914568){var _0x418cc6={};var _0x505b29={};var _0x59c5f3;var _0x542137;return db['ChatQueue'][_0xda8f('0x62')]({'where':{'id':_0x170885['params']['id']}})[_0xda8f('0x35')](handleEntityNotFound(_0x2e89b6,null))['then'](function(_0x27c6e0){if(_0x27c6e0){_0x59c5f3=_0x27c6e0;_0x505b29[_0xda8f('0x42')]=_['keys'](db['Team']['rawAttributes']);_0x505b29[_0xda8f('0x44')]=_[_0xda8f('0x43')](_0x170885[_0xda8f('0x44')]);_0x505b29[_0xda8f('0x45')]=_[_0xda8f('0x63')](_0x505b29[_0xda8f('0x42')],_0x505b29[_0xda8f('0x44')]);_0x418cc6[_0xda8f('0x47')]=_[_0xda8f('0x63')](_0x505b29['model'],qs[_0xda8f('0x46')](_0x170885[_0xda8f('0x44')]['fields']));_0x418cc6[_0xda8f('0x47')]=_0x418cc6[_0xda8f('0x47')][_0xda8f('0x56')]?_0x418cc6['attributes']:_0x505b29[_0xda8f('0x42')];_0x418cc6[_0xda8f('0x4a')]=qs[_0xda8f('0x4b')](_0x170885[_0xda8f('0x44')][_0xda8f('0x4b')]);_0x418cc6[_0xda8f('0x4c')]=qs[_0xda8f('0x45')](_['pick'](_0x170885[_0xda8f('0x44')],_0x505b29[_0xda8f('0x45')]));if(_0x170885[_0xda8f('0x44')]['filter']){_0x418cc6[_0xda8f('0x4c')]=_[_0xda8f('0x4f')](_0x418cc6['where'],{'$or':_[_0xda8f('0x3d')](_0x418cc6[_0xda8f('0x47')],function(_0x592900){var _0x11a258={};_0x11a258[_0x592900]={'$like':'%'+_0x170885[_0xda8f('0x44')][_0xda8f('0x4e')]+'%'};return _0x11a258;})});}_0x418cc6=_[_0xda8f('0x4f')]({},_0x418cc6,_0x170885['options']);return _0x59c5f3[_0xda8f('0x6d')](_0x418cc6);}})[_0xda8f('0x35')](function(_0x406467){if(_0x406467){_0x542137=_0x406467[_0xda8f('0x56')];if(!_0x170885[_0xda8f('0x44')][_0xda8f('0x48')]('nolimit')){_0x418cc6['limit']=qs['limit'](_0x170885[_0xda8f('0x44')]['limit']);_0x418cc6[_0xda8f('0x2f')]=qs[_0xda8f('0x2f')](_0x170885[_0xda8f('0x44')]['offset']);}return _0x59c5f3[_0xda8f('0x6d')](_0x418cc6);}})[_0xda8f('0x35')](function(_0x4cca34){if(_0x4cca34){return _0x4cca34?{'count':_0x542137,'rows':_0x4cca34}:null;}})[_0xda8f('0x35')](respondWithResult(_0x2e89b6,null))['catch'](handleError(_0x2e89b6,null));};exports[_0xda8f('0x6e')]=function(_0xa5ce27,_0x64dd5f,_0x48d945){var _0x1ea98c=_0xa5ce27[_0xda8f('0x58')][_0xda8f('0x6f')];return db[_0xda8f('0x70')][_0xda8f('0x71')]({'where':{'id':_0x1ea98c},'attributes':['id'],'include':[{'model':db[_0xda8f('0x65')],'as':_0xda8f('0x72'),'attributes':['id',_0xda8f('0x3a'),_0xda8f('0x73'),_0xda8f('0x74'),_0xda8f('0x75')],'raw':!![]}]})['then'](function(_0x463988){if(_0x463988){var _0x25bec5=_['flatMap'](_0x463988,function(_0x33e402){var _0x1eb113=_0x33e402[_0xda8f('0x5c')]({'plain':!![]});return _0x1eb113['Agents'];});return db[_0xda8f('0x3e')][_0xda8f('0x5d')]({'where':{'id':_0xa5ce27[_0xda8f('0x55')]['id']}})[_0xda8f('0x35')](function(_0x575b36){return db['sequelize'][_0xda8f('0x76')](function(_0x469dc1){return _0x575b36[_0xda8f('0x6e')](_0x1ea98c,{'transaction':_0x469dc1})[_0xda8f('0x35')](function(){return BPromise['each'](_0x25bec5,function(_0x513ce5){return db[_0xda8f('0x64')][_0xda8f('0x77')]({'where':{'UserId':_0x513ce5['id'],'ChatQueueId':_0xa5ce27[_0xda8f('0x55')]['id']},'transaction':_0x469dc1});});})[_0xda8f('0x35')](function(){_0x25bec5['forEach'](function(_0x5e3b2d){socket['emit'](_0xda8f('0x78'),{'UserId':_0x5e3b2d['id'],'ChatQueueId':_0x575b36['id']});});});});});}})[_0xda8f('0x35')](respondWithStatusCode(_0x64dd5f,null))[_0xda8f('0x29')](handleError(_0x64dd5f,null));};exports[_0xda8f('0x79')]=function(_0x41b66f,_0x22f204,_0x4823a2){return db[_0xda8f('0x70')][_0xda8f('0x71')]({'where':{'id':_0x41b66f['query'][_0xda8f('0x6f')]},'attributes':['id'],'include':[{'model':db[_0xda8f('0x65')],'as':_0xda8f('0x72'),'attributes':['id'],'raw':!![]}]})[_0xda8f('0x35')](handleEntityNotFound(_0x22f204,null))[_0xda8f('0x35')](function(_0x5a7cb6){var _0x3e9a30=_['map'](_0x5a7cb6,'id');var _0x52725e=[];var _0x16e5e1=[];var _0x4a5bf0=squel['select']();_0x4a5bf0[_0xda8f('0x7a')](_0xda8f('0x7b'))[_0xda8f('0x7c')]('team_has_chat_queues','tq')[_0xda8f('0x7d')](_0xda8f('0x7e'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xda8f('0x4c')](_0xda8f('0x7f'),_0x41b66f[_0xda8f('0x55')]['id']);for(var _0x38497f=0x0;_0x38497f<_0x5a7cb6['length'];_0x38497f+=0x1){let _0x365ba7=_0x5a7cb6[_0x38497f];for(var _0x39234e=0x0;_0x39234e<_0x365ba7[_0xda8f('0x72')][_0xda8f('0x56')];_0x39234e+=0x1){let _0xc1e367=_0x365ba7[_0xda8f('0x72')][_0x39234e];var _0x218a50=_0x4a5bf0[_0xda8f('0x80')]();_0x218a50[_0xda8f('0x4c')](_0xda8f('0x81'),_0xc1e367['id']);_0x16e5e1['push'](db[_0xda8f('0x82')][_0xda8f('0x44')](_0x218a50[_0xda8f('0x83')](),{'type':db['sequelize']['QueryTypes'][_0xda8f('0x84')]})['then'](function(_0x544a3a){if(_0x544a3a[_0xda8f('0x56')]===0x1){return _0xc1e367['id'];}else{var _0xa9467a=_[_0xda8f('0x85')](_[_0xda8f('0x3d')](_0x544a3a,_0xda8f('0x86')),function(_0x1a2f00){return _['includes'](_0x3e9a30,_0x1a2f00);});if(_0xa9467a){return _0xc1e367['id'];}}}));}}return BPromise[_0xda8f('0x87')](_0x16e5e1)[_0xda8f('0x35')](function(_0x56b505){_0x52725e=_(_0x52725e)['union'](_0x56b505)[_0xda8f('0x88')]()[_0xda8f('0x89')]();return db[_0xda8f('0x3e')]['find']({'where':{'id':_0x41b66f[_0xda8f('0x55')]['id']}})[_0xda8f('0x35')](function(_0x39caa8){return db[_0xda8f('0x82')][_0xda8f('0x76')](function(_0x1d09a0){return _0x39caa8[_0xda8f('0x79')](_0x41b66f[_0xda8f('0x44')]['ids'],{'transaction':_0x1d09a0})['then'](function(){if(!_[_0xda8f('0x8a')](_0x52725e)){return _0x39caa8['removeAgents'](_0x52725e,{'transaction':_0x1d09a0});}})[_0xda8f('0x35')](function(){_0x52725e['forEach'](function(_0x4e0d39){socket[_0xda8f('0x8b')](_0xda8f('0x8c'),{'UserId':_0x4e0d39,'ChatQueueId':_0x39caa8['id']});});});});});});})[_0xda8f('0x35')](respondWithStatusCode(_0x22f204,null))['catch'](handleError(_0x22f204,null));};exports[_0xda8f('0x8d')]=function(_0x168a32,_0x43c901,_0xf678a){return db[_0xda8f('0x3e')][_0xda8f('0x5d')]({'where':{'id':_0x168a32[_0xda8f('0x55')]['id']}})['then'](handleEntityNotFound(_0x43c901,null))['then'](function(_0x5022d9){if(_0x5022d9){return _0x5022d9['addAgents'](_0x168a32[_0xda8f('0x58')][_0xda8f('0x6f')],_['omit'](_0x168a32[_0xda8f('0x58')],['ids','id'])||{})[_0xda8f('0x8e')](function(_0x488744){for(var _0x2e013b=0x0;_0x2e013b<_0x168a32[_0xda8f('0x58')][_0xda8f('0x6f')]['length'];_0x2e013b+=0x1){socket['emit']('userChatQueue:save',{'UserId':Number(_0x168a32['body'][_0xda8f('0x6f')][_0x2e013b]),'ChatQueueId':Number(_0x168a32[_0xda8f('0x55')]['id'])});}return _0x488744;});}})['then'](respondWithResult(_0x43c901,null))[_0xda8f('0x29')](handleError(_0x43c901,null));};exports['removeAgents']=function(_0x60dc9c,_0x51f86f,_0x408511){return db[_0xda8f('0x3e')]['find']({'where':{'id':_0x60dc9c[_0xda8f('0x55')]['id']}})[_0xda8f('0x35')](handleEntityNotFound(_0x51f86f,null))[_0xda8f('0x35')](function(_0x434af0){if(_0x434af0){return _0x434af0[_0xda8f('0x8f')](_0x60dc9c['query'][_0xda8f('0x6f')])[_0xda8f('0x35')](function(){if(_[_0xda8f('0x90')](_0x60dc9c[_0xda8f('0x44')][_0xda8f('0x6f')])){for(var _0x28fc82=0x0;_0x28fc82<_0x60dc9c[_0xda8f('0x44')][_0xda8f('0x6f')][_0xda8f('0x56')];_0x28fc82+=0x1){socket[_0xda8f('0x8b')](_0xda8f('0x8c'),{'UserId':Number(_0x60dc9c[_0xda8f('0x44')][_0xda8f('0x6f')][_0x28fc82]),'ChatQueueId':Number(_0x60dc9c[_0xda8f('0x55')]['id'])});}}else{socket[_0xda8f('0x8b')](_0xda8f('0x8c'),{'UserId':Number(_0x60dc9c['query']['ids']),'ChatQueueId':Number(_0x60dc9c['params']['id'])});}});}})[_0xda8f('0x35')](respondWithStatusCode(_0x51f86f,null))[_0xda8f('0x29')](handleError(_0x51f86f,null));};exports[_0xda8f('0x91')]=function(_0x5f47c1,_0x7757b4,_0x51466c){var _0x1eaefd={};var _0x2ce46b={};var _0x5c97af;var _0x29115a;return db[_0xda8f('0x3e')][_0xda8f('0x62')]({'where':{'id':_0x5f47c1[_0xda8f('0x55')]['id']}})[_0xda8f('0x35')](handleEntityNotFound(_0x7757b4,null))[_0xda8f('0x35')](function(_0x1186ea){if(_0x1186ea){_0x5c97af=_0x1186ea;_0x2ce46b[_0xda8f('0x42')]=_[_0xda8f('0x43')](db[_0xda8f('0x65')][_0xda8f('0x3f')]);_0x2ce46b[_0xda8f('0x44')]=_['keys'](_0x5f47c1[_0xda8f('0x44')]);_0x2ce46b[_0xda8f('0x45')]=_['intersection'](_0x2ce46b[_0xda8f('0x42')],_0x2ce46b['query']);_0x1eaefd[_0xda8f('0x47')]=_[_0xda8f('0x63')](_0x2ce46b[_0xda8f('0x42')],qs[_0xda8f('0x46')](_0x5f47c1[_0xda8f('0x44')][_0xda8f('0x46')]));_0x1eaefd[_0xda8f('0x47')]=_0x1eaefd[_0xda8f('0x47')][_0xda8f('0x56')]?_0x1eaefd['attributes']:_0x2ce46b[_0xda8f('0x42')];_0x1eaefd['order']=qs[_0xda8f('0x4b')](_0x5f47c1[_0xda8f('0x44')][_0xda8f('0x4b')]);_0x1eaefd['where']=qs['filters'](_[_0xda8f('0x4d')](_0x5f47c1[_0xda8f('0x44')],_0x2ce46b[_0xda8f('0x45')]));if(_0x5f47c1['query'][_0xda8f('0x4e')]){_0x1eaefd[_0xda8f('0x4c')]=_[_0xda8f('0x4f')](_0x1eaefd[_0xda8f('0x4c')],{'$or':_[_0xda8f('0x3d')](_0x1eaefd[_0xda8f('0x47')],function(_0x4dfba2){var _0xbbb0d3={};_0xbbb0d3[_0x4dfba2]={'$like':'%'+_0x5f47c1[_0xda8f('0x44')]['filter']+'%'};return _0xbbb0d3;})});}_0x1eaefd=_[_0xda8f('0x4f')]({},_0x1eaefd,_0x5f47c1['options']);return _0x5c97af[_0xda8f('0x91')](_0x1eaefd);}})['then'](function(_0x28dfec){if(_0x28dfec){_0x29115a=_0x28dfec[_0xda8f('0x56')];if(!_0x5f47c1[_0xda8f('0x44')]['hasOwnProperty'](_0xda8f('0x49'))){_0x1eaefd[_0xda8f('0x2d')]=qs['limit'](_0x5f47c1[_0xda8f('0x44')][_0xda8f('0x2d')]);_0x1eaefd[_0xda8f('0x2f')]=qs['offset'](_0x5f47c1['query'][_0xda8f('0x2f')]);}return _0x5c97af[_0xda8f('0x91')](_0x1eaefd);}})['then'](function(_0x4abc23){if(_0x4abc23){return _0x4abc23?{'count':_0x29115a,'rows':_0x4abc23}:null;}})['then'](respondWithResult(_0x7757b4,null))[_0xda8f('0x29')](handleError(_0x7757b4,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index a5cb532..aceed5c 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 _0x0434=['setMaxListeners','save','emit','hook','exports','events','../../mysqldb','ChatQueue'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x0434,0x1ad));var _0x4043=function(_0x450689,_0x3b857c){_0x450689=_0x450689-0x0;var _0x46ffb0=_0x0434[_0x450689];return _0x46ffb0;};'use strict';var EventEmitter=require(_0x4043('0x0'));var ChatQueue=require(_0x4043('0x1'))['db'][_0x4043('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x4043('0x3')](0x0);var events={'afterCreate':_0x4043('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2e6bdf){return function(_0xfa9ae8,_0x3e475f,_0x2e1aec){ChatQueueEvents[_0x4043('0x5')](_0x2e6bdf+':'+_0xfa9ae8['id'],_0xfa9ae8);ChatQueueEvents[_0x4043('0x5')](_0x2e6bdf,_0xfa9ae8);_0x2e1aec(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue[_0x4043('0x6')](e,emitEvent(event));}}module[_0x4043('0x7')]=ChatQueueEvents; \ No newline at end of file +var _0x3e6d=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','ChatQueue','setMaxListeners','save'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x3e6d,0x15b));var _0xd3e6=function(_0x32e73c,_0x24c424){_0x32e73c=_0x32e73c-0x0;var _0x215cda=_0x3e6d[_0x32e73c];return _0x215cda;};'use strict';var EventEmitter=require('events');var ChatQueue=require(_0xd3e6('0x0'))['db'][_0xd3e6('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xd3e6('0x2')](0x0);var events={'afterCreate':_0xd3e6('0x3'),'afterUpdate':'update','afterDestroy':_0xd3e6('0x4')};function emitEvent(_0x21d633){return function(_0x3441b2,_0x15898e,_0x1768df){ChatQueueEvents[_0xd3e6('0x5')](_0x21d633+':'+_0x3441b2['id'],_0x3441b2);ChatQueueEvents[_0xd3e6('0x5')](_0x21d633,_0x3441b2);_0x1768df(null);};}for(var e in events){if(events[_0xd3e6('0x6')](e)){var event=events[e];ChatQueue[_0xd3e6('0x7')](e,emitEvent(event));}}module[_0xd3e6('0x8')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index cb9898f..751fb63 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 _0xda87=['rimraf','../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','chat_queues','util','../../config/logger','api','moment','request-promise'];(function(_0x2ee55f,_0xde849b){var _0x2e5927=function(_0x270f52){while(--_0x270f52){_0x2ee55f['push'](_0x2ee55f['shift']());}};_0x2e5927(++_0xde849b);}(_0xda87,0xeb));var _0x7da8=function(_0x469393,_0x247969){_0x469393=_0x469393-0x0;var _0x5f720d=_0xda87[_0x469393];return _0x5f720d;};'use strict';var _=require('lodash');var util=require(_0x7da8('0x0'));var logger=require(_0x7da8('0x1'))(_0x7da8('0x2'));var moment=require(_0x7da8('0x3'));var BPromise=require('bluebird');var rp=require(_0x7da8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7da8('0x5'));var config=require(_0x7da8('0x6'));var attributes=require(_0x7da8('0x7'));module[_0x7da8('0x8')]=function(_0x12de35,_0x17d669){return _0x12de35[_0x7da8('0x9')](_0x7da8('0xa'),attributes,{'tableName':_0x7da8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa867=['moment','bluebird','rimraf','../../config/environment','./chatQueue.attributes','ChatQueue','chat_queues','../../config/logger'];(function(_0x356a58,_0x342f53){var _0xf9502=function(_0x445bcb){while(--_0x445bcb){_0x356a58['push'](_0x356a58['shift']());}};_0xf9502(++_0x342f53);}(_0xa867,0xa7));var _0x7a86=function(_0x44d385,_0xf9587a){_0x44d385=_0x44d385-0x0;var _0x4e69da=_0xa867[_0x44d385];return _0x4e69da;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7a86('0x0'))('api');var moment=require(_0x7a86('0x1'));var BPromise=require(_0x7a86('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7a86('0x3'));var config=require(_0x7a86('0x4'));var attributes=require(_0x7a86('0x5'));module['exports']=function(_0x825477,_0x39733a){return _0x825477['define'](_0x7a86('0x6'),attributes,{'tableName':_0x7a86('0x7'),'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 247184b..5756840 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 _0x2964=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetChatQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowChatQueue','ChatQueue','find'];(function(_0x5238d0,_0xb0e175){var _0x5e9db7=function(_0x22f7a8){while(--_0x22f7a8){_0x5238d0['push'](_0x5238d0['shift']());}};_0x5e9db7(++_0xb0e175);}(_0x2964,0x108));var _0x4296=function(_0x1c3d21,_0xde2116){_0x1c3d21=_0x1c3d21-0x0;var _0x5ee919=_0x2964[_0x1c3d21];return _0x5ee919;};'use strict';var _=require(_0x4296('0x0'));var util=require(_0x4296('0x1'));var moment=require(_0x4296('0x2'));var BPromise=require(_0x4296('0x3'));var rs=require(_0x4296('0x4'));var fs=require('fs');var Redis=require(_0x4296('0x5'));var db=require(_0x4296('0x6'))['db'];var utils=require(_0x4296('0x7'));var logger=require(_0x4296('0x8'))('rpc');var config=require(_0x4296('0x9'));var jayson=require(_0x4296('0xa'));var client=jayson[_0x4296('0xb')][_0x4296('0xc')]({'port':0x232a});config[_0x4296('0xd')]=_[_0x4296('0xe')](config['redis'],{'host':_0x4296('0xf'),'port':0x18eb});var socket=require(_0x4296('0x10'))(new Redis(config[_0x4296('0xd')]));require(_0x4296('0x11'))[_0x4296('0x12')](socket);function respondWithRpcPromise(_0x3814d4,_0x3e826e,_0x41e8c7){return new BPromise(function(_0x1e3635,_0xaea543){return client[_0x4296('0x13')](_0x3814d4,_0x41e8c7)[_0x4296('0x14')](function(_0x5012c2){logger[_0x4296('0x15')](_0x4296('0x16'),_0x3e826e,_0x4296('0x17'));logger[_0x4296('0x18')](_0x4296('0x19'),_0x3e826e,_0x4296('0x17'),JSON[_0x4296('0x1a')](_0x5012c2));if(_0x5012c2['error']){if(_0x5012c2[_0x4296('0x1b')][_0x4296('0x1c')]===0x1f4){logger[_0x4296('0x1b')]('ChatQueue,\x20%s,\x20%s',_0x3e826e,_0x5012c2[_0x4296('0x1b')][_0x4296('0x1d')]);return _0xaea543(_0x5012c2[_0x4296('0x1b')]['message']);}logger[_0x4296('0x1b')](_0x4296('0x16'),_0x3e826e,_0x5012c2[_0x4296('0x1b')]['message']);return _0x1e3635(_0x5012c2[_0x4296('0x1b')][_0x4296('0x1d')]);}else{logger[_0x4296('0x15')](_0x4296('0x16'),_0x3e826e,_0x4296('0x17'));_0x1e3635(_0x5012c2['result'][_0x4296('0x1d')]);}})[_0x4296('0x1e')](function(_0x2d544c){logger['error'](_0x4296('0x16'),_0x3e826e,_0x2d544c);_0xaea543(_0x2d544c);});});}exports[_0x4296('0x1f')]=function(_0x448f46){var _0x3d3b2e=this;return new Promise(function(_0x1826c4,_0x336894){return db['ChatQueue'][_0x4296('0x20')]({'raw':_0x448f46[_0x4296('0x21')]?_0x448f46['options'][_0x4296('0x22')]===undefined?!![]:![]:!![],'where':_0x448f46[_0x4296('0x21')]?_0x448f46[_0x4296('0x21')][_0x4296('0x23')]||null:null,'attributes':_0x448f46['options']?_0x448f46['options'][_0x4296('0x24')]||null:null,'limit':_0x448f46[_0x4296('0x21')]?_0x448f46['options'][_0x4296('0x25')]||null:null,'include':_0x448f46['options']?_0x448f46[_0x4296('0x21')][_0x4296('0x26')]?_[_0x4296('0x27')](_0x448f46[_0x4296('0x21')]['include'],function(_0x3b8b48){return{'model':db[_0x3b8b48['model']],'as':_0x3b8b48['as'],'attributes':_0x3b8b48[_0x4296('0x24')],'include':_0x3b8b48['include']?_['map'](_0x3b8b48[_0x4296('0x26')],function(_0x38a83c){return{'model':db[_0x38a83c[_0x4296('0x28')]],'as':_0x38a83c['as'],'attributes':_0x38a83c['attributes'],'include':_0x38a83c[_0x4296('0x26')]?_[_0x4296('0x27')](_0x38a83c['include'],function(_0x30fa22){return{'model':db[_0x30fa22['model']],'as':_0x30fa22['as'],'attributes':_0x30fa22['attributes']};}):[]};}):[]};}):[]:[]})[_0x4296('0x14')](function(_0x2f5a2e){logger[_0x4296('0x15')](_0x4296('0x1f'),_0x448f46);logger[_0x4296('0x18')](_0x4296('0x1f'),_0x448f46,JSON[_0x4296('0x1a')](_0x2f5a2e));_0x1826c4(_0x2f5a2e);})[_0x4296('0x1e')](function(_0x599a74){logger[_0x4296('0x1b')]('GetChatQueue',_0x599a74[_0x4296('0x1d')],_0x448f46);_0x336894(_0x3d3b2e['error'](0x1f4,_0x599a74['message']));});});};exports[_0x4296('0x29')]=function(_0x557c3c){var _0x2f7aba=this;return new Promise(function(_0x1dc461,_0x3c056c){return db[_0x4296('0x2a')][_0x4296('0x2b')]({'raw':_0x557c3c[_0x4296('0x21')]?_0x557c3c[_0x4296('0x21')][_0x4296('0x22')]===undefined?!![]:![]:!![],'where':_0x557c3c[_0x4296('0x21')]?_0x557c3c[_0x4296('0x21')][_0x4296('0x23')]||null:null,'attributes':_0x557c3c['options']?_0x557c3c['options'][_0x4296('0x24')]||null:null,'include':_0x557c3c[_0x4296('0x21')]?_0x557c3c[_0x4296('0x21')][_0x4296('0x26')]?_['map'](_0x557c3c['options'][_0x4296('0x26')],function(_0x2d1c64){return{'model':db[_0x2d1c64[_0x4296('0x28')]],'as':_0x2d1c64['as'],'attributes':_0x2d1c64[_0x4296('0x24')],'include':_0x2d1c64['include']?_[_0x4296('0x27')](_0x2d1c64[_0x4296('0x26')],function(_0x5273ef){return{'model':db[_0x5273ef['model']],'as':_0x5273ef['as'],'attributes':_0x5273ef['attributes'],'include':_0x5273ef[_0x4296('0x26')]?_[_0x4296('0x27')](_0x5273ef['include'],function(_0xa815a2){return{'model':db[_0xa815a2[_0x4296('0x28')]],'as':_0xa815a2['as'],'attributes':_0xa815a2[_0x4296('0x24')]};}):[]};}):[]};}):[]:[]})[_0x4296('0x14')](function(_0x3c8ca9){logger[_0x4296('0x15')](_0x4296('0x29'),_0x557c3c);logger[_0x4296('0x18')](_0x4296('0x29'),_0x557c3c,JSON[_0x4296('0x1a')](_0x3c8ca9));_0x1dc461(_0x3c8ca9);})[_0x4296('0x1e')](function(_0x455ce9){logger[_0x4296('0x1b')]('ShowChatQueue',_0x455ce9[_0x4296('0x1d')],_0x557c3c);_0x3c056c(_0x2f7aba[_0x4296('0x1b')](0x1f4,_0x455ce9[_0x4296('0x1d')]));});});}; \ No newline at end of file +var _0x7896=['ShowChatQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./chatQueue.socket','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetChatQueue','ChatQueue','findAll','options','raw','limit','include','map','model','attributes','find','where'];(function(_0x1dcde4,_0x38b5c8){var _0x5ed662=function(_0x8d468d){while(--_0x8d468d){_0x1dcde4['push'](_0x1dcde4['shift']());}};_0x5ed662(++_0x38b5c8);}(_0x7896,0x127));var _0x6789=function(_0x222df7,_0x3e073f){_0x222df7=_0x222df7-0x0;var _0x2cceae=_0x7896[_0x222df7];return _0x2cceae;};'use strict';var _=require(_0x6789('0x0'));var util=require(_0x6789('0x1'));var moment=require(_0x6789('0x2'));var BPromise=require(_0x6789('0x3'));var rs=require(_0x6789('0x4'));var fs=require('fs');var Redis=require(_0x6789('0x5'));var db=require(_0x6789('0x6'))['db'];var utils=require(_0x6789('0x7'));var logger=require(_0x6789('0x8'))(_0x6789('0x9'));var config=require(_0x6789('0xa'));var jayson=require(_0x6789('0xb'));var client=jayson['client'][_0x6789('0xc')]({'port':0x232a});config[_0x6789('0xd')]=_[_0x6789('0xe')](config['redis'],{'host':_0x6789('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6789('0xd')]));require(_0x6789('0x10'))['register'](socket);function respondWithRpcPromise(_0x21864f,_0x54aca8,_0x43f6b6){return new BPromise(function(_0x4c5ccc,_0x286894){return client['request'](_0x21864f,_0x43f6b6)[_0x6789('0x11')](function(_0x32f867){logger[_0x6789('0x12')](_0x6789('0x13'),_0x54aca8,_0x6789('0x14'));logger[_0x6789('0x15')](_0x6789('0x16'),_0x54aca8,_0x6789('0x14'),JSON[_0x6789('0x17')](_0x32f867));if(_0x32f867[_0x6789('0x18')]){if(_0x32f867['error'][_0x6789('0x19')]===0x1f4){logger[_0x6789('0x18')](_0x6789('0x13'),_0x54aca8,_0x32f867[_0x6789('0x18')][_0x6789('0x1a')]);return _0x286894(_0x32f867[_0x6789('0x18')]['message']);}logger['error'](_0x6789('0x13'),_0x54aca8,_0x32f867[_0x6789('0x18')][_0x6789('0x1a')]);return _0x4c5ccc(_0x32f867[_0x6789('0x18')][_0x6789('0x1a')]);}else{logger[_0x6789('0x12')](_0x6789('0x13'),_0x54aca8,'request\x20sent');_0x4c5ccc(_0x32f867[_0x6789('0x1b')]['message']);}})[_0x6789('0x1c')](function(_0x2422ed){logger[_0x6789('0x18')](_0x6789('0x13'),_0x54aca8,_0x2422ed);_0x286894(_0x2422ed);});});}exports[_0x6789('0x1d')]=function(_0x51d52d){var _0x13a341=this;return new Promise(function(_0x59e6ff,_0x4360a0){return db[_0x6789('0x1e')][_0x6789('0x1f')]({'raw':_0x51d52d[_0x6789('0x20')]?_0x51d52d[_0x6789('0x20')][_0x6789('0x21')]===undefined?!![]:![]:!![],'where':_0x51d52d[_0x6789('0x20')]?_0x51d52d[_0x6789('0x20')]['where']||null:null,'attributes':_0x51d52d[_0x6789('0x20')]?_0x51d52d['options']['attributes']||null:null,'limit':_0x51d52d[_0x6789('0x20')]?_0x51d52d[_0x6789('0x20')][_0x6789('0x22')]||null:null,'include':_0x51d52d[_0x6789('0x20')]?_0x51d52d[_0x6789('0x20')][_0x6789('0x23')]?_[_0x6789('0x24')](_0x51d52d[_0x6789('0x20')]['include'],function(_0x535bd5){return{'model':db[_0x535bd5[_0x6789('0x25')]],'as':_0x535bd5['as'],'attributes':_0x535bd5[_0x6789('0x26')],'include':_0x535bd5[_0x6789('0x23')]?_[_0x6789('0x24')](_0x535bd5[_0x6789('0x23')],function(_0x40d1cf){return{'model':db[_0x40d1cf['model']],'as':_0x40d1cf['as'],'attributes':_0x40d1cf[_0x6789('0x26')],'include':_0x40d1cf[_0x6789('0x23')]?_['map'](_0x40d1cf[_0x6789('0x23')],function(_0x264507){return{'model':db[_0x264507[_0x6789('0x25')]],'as':_0x264507['as'],'attributes':_0x264507['attributes']};}):[]};}):[]};}):[]:[]})[_0x6789('0x11')](function(_0x292d7e){logger[_0x6789('0x12')](_0x6789('0x1d'),_0x51d52d);logger[_0x6789('0x15')](_0x6789('0x1d'),_0x51d52d,JSON[_0x6789('0x17')](_0x292d7e));_0x59e6ff(_0x292d7e);})[_0x6789('0x1c')](function(_0x2e44b0){logger[_0x6789('0x18')](_0x6789('0x1d'),_0x2e44b0[_0x6789('0x1a')],_0x51d52d);_0x4360a0(_0x13a341[_0x6789('0x18')](0x1f4,_0x2e44b0[_0x6789('0x1a')]));});});};exports['ShowChatQueue']=function(_0x1439f1){var _0x1a9bb5=this;return new Promise(function(_0x166e27,_0x4210e9){return db[_0x6789('0x1e')][_0x6789('0x27')]({'raw':_0x1439f1['options']?_0x1439f1[_0x6789('0x20')][_0x6789('0x21')]===undefined?!![]:![]:!![],'where':_0x1439f1['options']?_0x1439f1[_0x6789('0x20')][_0x6789('0x28')]||null:null,'attributes':_0x1439f1[_0x6789('0x20')]?_0x1439f1[_0x6789('0x20')][_0x6789('0x26')]||null:null,'include':_0x1439f1['options']?_0x1439f1['options'][_0x6789('0x23')]?_['map'](_0x1439f1['options'][_0x6789('0x23')],function(_0x3bcc77){return{'model':db[_0x3bcc77[_0x6789('0x25')]],'as':_0x3bcc77['as'],'attributes':_0x3bcc77['attributes'],'include':_0x3bcc77[_0x6789('0x23')]?_[_0x6789('0x24')](_0x3bcc77[_0x6789('0x23')],function(_0x18e990){return{'model':db[_0x18e990[_0x6789('0x25')]],'as':_0x18e990['as'],'attributes':_0x18e990[_0x6789('0x26')],'include':_0x18e990['include']?_[_0x6789('0x24')](_0x18e990['include'],function(_0x11770e){return{'model':db[_0x11770e[_0x6789('0x25')]],'as':_0x11770e['as'],'attributes':_0x11770e['attributes']};}):[]};}):[]};}):[]:[]})[_0x6789('0x11')](function(_0x51a540){logger[_0x6789('0x12')]('ShowChatQueue',_0x1439f1);logger[_0x6789('0x15')](_0x6789('0x29'),_0x1439f1,JSON[_0x6789('0x17')](_0x51a540));_0x166e27(_0x51a540);})[_0x6789('0x1c')](function(_0x4f8339){logger[_0x6789('0x18')]('ShowChatQueue',_0x4f8339[_0x6789('0x1a')],_0x1439f1);_0x4210e9(_0x1a9bb5[_0x6789('0x18')](0x1f4,_0x4f8339[_0x6789('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index c0742c5..8f4fde6 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 _0x70e0=['chatQueue:','./chatQueue.events','save','remove','emit','removeListener'];(function(_0x5670e0,_0x29c05a){var _0x32957d=function(_0x218b42){while(--_0x218b42){_0x5670e0['push'](_0x5670e0['shift']());}};_0x32957d(++_0x29c05a);}(_0x70e0,0x17b));var _0x070e=function(_0x147b19,_0x2cf92c){_0x147b19=_0x147b19-0x0;var _0xa51635=_0x70e0[_0x147b19];return _0xa51635;};'use strict';var ChatQueueEvents=require(_0x070e('0x0'));var events=[_0x070e('0x1'),_0x070e('0x2'),'update'];function createListener(_0x579b83,_0x16e651){return function(_0xee173){_0x16e651[_0x070e('0x3')](_0x579b83,_0xee173);};}function removeListener(_0x2593e5,_0x5c90fc){return function(){ChatQueueEvents[_0x070e('0x4')](_0x2593e5,_0x5c90fc);};}exports['register']=function(_0x46fe68){for(var _0x4b041d=0x0,_0x56e420=events['length'];_0x4b041d<_0x56e420;_0x4b041d++){var _0x35ab0c=events[_0x4b041d];var _0x1e11f0=createListener(_0x070e('0x5')+_0x35ab0c,_0x46fe68);ChatQueueEvents['on'](_0x35ab0c,_0x1e11f0);}}; \ No newline at end of file +var _0x6f0d=['update','emit','removeListener','length','save','remove'];(function(_0x3dfb56,_0xfe844d){var _0x5e6e1b=function(_0x4e002f){while(--_0x4e002f){_0x3dfb56['push'](_0x3dfb56['shift']());}};_0x5e6e1b(++_0xfe844d);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x160a4e,_0x6b75b){_0x160a4e=_0x160a4e-0x0;var _0x552404=_0x6f0d[_0x160a4e];return _0x552404;};'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 06e2977..3000444 100644 --- a/server/api/chatQueue/index.js +++ b/server/api/chatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x008c=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','show','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','update','delete','/:id','removeTeams','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x21e459,_0x2820bf){var _0x49f525=function(_0x18bc8f){while(--_0x18bc8f){_0x21e459['push'](_0x21e459['shift']());}};_0x49f525(++_0x2820bf);}(_0x008c,0x188));var _0xc008=function(_0x2074db,_0x10b81b){_0x2074db=_0x2074db-0x0;var _0x27324c=_0x008c[_0x2074db];return _0x27324c;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/describe',auth[_0xc008('0xb')](),controller['describe']);router[_0xc008('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/members',auth['isAuthenticated'](),controller['getMembers']);router[_0xc008('0xa')](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0xf')]);router[_0xc008('0xa')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')]('/',auth[_0xc008('0xb')](),controller['create']);router['post'](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x12')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x14')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x15')]);router[_0xc008('0x16')](_0xc008('0x17'),auth[_0xc008('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth['isAuthenticated'](),controller[_0xc008('0x18')]);router[_0xc008('0x16')]('/:id/users',auth[_0xc008('0xb')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x7217=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','addTeams','update','delete','destroy','removeTeams','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x377449,_0x3335f2){var _0x1d0d0d=function(_0x2f03df){while(--_0x2f03df){_0x377449['push'](_0x377449['shift']());}};_0x1d0d0d(++_0x3335f2);}(_0x7217,0x19e));var _0x7721=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x7217[_0xa1e3e3];return _0xc980e9;};'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['getAgents']);router[_0x7721('0x14')]('/',auth[_0x7721('0x9')](),controller['create']);router[_0x7721('0x14')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x15')]);router['post'](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['addAgents']);router['put']('/:id',auth[_0x7721('0x9')](),controller[_0x7721('0x16')]);router[_0x7721('0x17')](_0x7721('0xd'),auth['isAuthenticated'](),controller[_0x7721('0x18')]);router['delete'](_0x7721('0x11'),auth['isAuthenticated'](),controller[_0x7721('0x19')]);router[_0x7721('0x17')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller[_0x7721('0x1a')]);module[_0x7721('0x1b')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 8ffccd8..0fdca16 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 _0xb9c2=['STRING','DATE','sequelize','exports'];(function(_0x212deb,_0x360d11){var _0x2ce4c4=function(_0x40250c){while(--_0x40250c){_0x212deb['push'](_0x212deb['shift']());}};_0x2ce4c4(++_0x360d11);}(_0xb9c2,0x72));var _0x2b9c=function(_0xcc9e86,_0x4417fe){_0xcc9e86=_0xcc9e86-0x0;var _0x1ba436=_0xb9c2[_0xcc9e86];return _0x1ba436;};'use strict';var moment=require('moment');var Sequelize=require(_0x2b9c('0x0'));module[_0x2b9c('0x1')]={'uniqueid':{'type':Sequelize[_0x2b9c('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x2b9c('0x2')]},'joinAt':{'type':Sequelize[_0x2b9c('0x3')]},'leaveAt':{'type':Sequelize[_0x2b9c('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x2b9c('0x3')]},'reason':{'type':Sequelize[_0x2b9c('0x2')]}}; \ No newline at end of file +var _0xa02e=['DATE','sequelize','STRING'];(function(_0x506e75,_0x3dd9f3){var _0x2aa895=function(_0x1f1830){while(--_0x1f1830){_0x506e75['push'](_0x506e75['shift']());}};_0x2aa895(++_0x3dd9f3);}(_0xa02e,0xa3));var _0xea02=function(_0x1c6d56,_0x4d38da){_0x1c6d56=_0x1c6d56-0x0;var _0x4b8df9=_0xa02e[_0x1c6d56];return _0x4b8df9;};'use strict';var moment=require('moment');var Sequelize=require(_0xea02('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xea02('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0xea02('0x1')]},'joinAt':{'type':Sequelize[_0xea02('0x2')]},'leaveAt':{'type':Sequelize[_0xea02('0x2')]},'acceptAt':{'type':Sequelize[_0xea02('0x2')]},'exitAt':{'type':Sequelize[_0xea02('0x2')]},'reason':{'type':Sequelize[_0xea02('0x1')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index c079bb5..733eb60 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 _0x0954=['hasOwnProperty','limit','order','sort','where','filter','merge','VIRTUAL','ChatQueueReport','include','findAll','show','includeAll','options','find','catch','create','body','destroy','params','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','end','offset','undefined','count','status','set','Content-Range','apply','reject','save','update','then','sendStatus','error','name','send','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length'];(function(_0x2c0ded,_0x3de22c){var _0x4473e5=function(_0x3705bc){while(--_0x3705bc){_0x2c0ded['push'](_0x2c0ded['shift']());}};_0x4473e5(++_0x3de22c);}(_0x0954,0x135));var _0x4095=function(_0x2b2c53,_0x4bcf9b){_0x2b2c53=_0x2b2c53-0x0;var _0x311ec2=_0x0954[_0x2b2c53];return _0x311ec2;};'use strict';var emlformat=require(_0x4095('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4095('0x1'));var jsonpatch=require(_0x4095('0x2'));var rp=require('request-promise');var moment=require(_0x4095('0x3'));var BPromise=require(_0x4095('0x4'));var Mustache=require(_0x4095('0x5'));var util=require(_0x4095('0x6'));var path=require(_0x4095('0x7'));var sox=require(_0x4095('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4095('0x9'));var squel=require(_0x4095('0xa'));var crypto=require(_0x4095('0xb'));var jsforce=require(_0x4095('0xc'));var deskjs=require(_0x4095('0xd'));var toCsv=require(_0x4095('0xe'));var querystring=require('querystring');var Papa=require(_0x4095('0xf'));var Redis=require(_0x4095('0x10'));var authService=require(_0x4095('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x4095('0x12'));var hardwareService=require(_0x4095('0x13'));var logger=require(_0x4095('0x14'))('api');var utils=require(_0x4095('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x4095('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x339cb5,_0x13b73c){_0x13b73c=_0x13b73c||0xcc;return function(_0x148df0){if(_0x148df0){return _0x339cb5['sendStatus'](_0x13b73c);}return _0x339cb5['status'](_0x13b73c)[_0x4095('0x17')]();};}function respondWithResult(_0xba3792,_0x1a9ec2){_0x1a9ec2=_0x1a9ec2||0xc8;return function(_0x51b78a){if(_0x51b78a){return _0xba3792['status'](_0x1a9ec2)['json'](_0x51b78a);}};}function respondWithFilteredResult(_0x108a48,_0x410c25){return function(_0x2965aa){if(_0x2965aa){var _0x400d5e=typeof _0x410c25[_0x4095('0x18')]===_0x4095('0x19')&&typeof _0x410c25['limit']==='undefined';var _0x24e902=_0x2965aa[_0x4095('0x1a')];var _0x47ebf5=_0x400d5e?0x0:_0x410c25[_0x4095('0x18')];var _0x5c3503=_0x400d5e?_0x2965aa['count']:_0x410c25[_0x4095('0x18')]+_0x410c25['limit'];var _0x2e417e;if(_0x5c3503>=_0x24e902){_0x5c3503=_0x24e902;_0x2e417e=0xc8;}else{_0x2e417e=0xce;}_0x108a48[_0x4095('0x1b')](_0x2e417e);return _0x108a48[_0x4095('0x1c')](_0x4095('0x1d'),_0x47ebf5+'-'+_0x5c3503+'/'+_0x24e902)['json'](_0x2965aa);}return null;};}function patchUpdates(_0x5ebf50){return function(_0x3e5706){try{jsonpatch[_0x4095('0x1e')](_0x3e5706,_0x5ebf50,!![]);}catch(_0x1d7c3b){return BPromise[_0x4095('0x1f')](_0x1d7c3b);}return _0x3e5706[_0x4095('0x20')]();};}function saveUpdates(_0x233f47,_0x126c8b){return function(_0x18c321){if(_0x18c321){return _0x18c321[_0x4095('0x21')](_0x233f47)[_0x4095('0x22')](function(_0x30d171){return _0x30d171;});}return null;};}function removeEntity(_0x3edf83,_0x440631){return function(_0x3c9824){if(_0x3c9824){return _0x3c9824['destroy']()['then'](function(){_0x3edf83[_0x4095('0x1b')](0xcc)[_0x4095('0x17')]();});}};}function handleEntityNotFound(_0x26604f,_0x4cae6a){return function(_0x4f2581){if(!_0x4f2581){_0x26604f[_0x4095('0x23')](0x194);}return _0x4f2581;};}function handleError(_0x989cb9,_0x46bcc1){_0x46bcc1=_0x46bcc1||0x1f4;return function(_0xbe5842){logger[_0x4095('0x24')](_0xbe5842['stack']);if(_0xbe5842[_0x4095('0x25')]){delete _0xbe5842[_0x4095('0x25')];}_0x989cb9[_0x4095('0x1b')](_0x46bcc1)[_0x4095('0x26')](_0xbe5842);};}exports['index']=function(_0x1ddcdc,_0x555953){var _0x59d296={},_0x199b7d={},_0xe68318={'count':0x0,'rows':[]};var _0x1f70d2=_[_0x4095('0x27')](db['ChatQueueReport'][_0x4095('0x28')],function(_0x4f9959){return{'name':_0x4f9959[_0x4095('0x29')],'type':_0x4f9959[_0x4095('0x2a')]['key']};});_0x199b7d[_0x4095('0x2b')]=_[_0x4095('0x27')](_0x1f70d2,_0x4095('0x25'));_0x199b7d[_0x4095('0x2c')]=_[_0x4095('0x2d')](_0x1ddcdc[_0x4095('0x2c')]);_0x199b7d[_0x4095('0x2e')]=_[_0x4095('0x2f')](_0x199b7d['model'],_0x199b7d[_0x4095('0x2c')]);_0x59d296['attributes']=_[_0x4095('0x2f')](_0x199b7d[_0x4095('0x2b')],qs['fields'](_0x1ddcdc[_0x4095('0x2c')][_0x4095('0x30')]));_0x59d296[_0x4095('0x31')]=_0x59d296[_0x4095('0x31')][_0x4095('0x32')]?_0x59d296[_0x4095('0x31')]:_0x199b7d[_0x4095('0x2b')];if(!_0x1ddcdc[_0x4095('0x2c')][_0x4095('0x33')]('nolimit')){_0x59d296[_0x4095('0x34')]=qs[_0x4095('0x34')](_0x1ddcdc['query'][_0x4095('0x34')]);_0x59d296['offset']=qs['offset'](_0x1ddcdc[_0x4095('0x2c')][_0x4095('0x18')]);}_0x59d296[_0x4095('0x35')]=qs['sort'](_0x1ddcdc['query'][_0x4095('0x36')]);_0x59d296[_0x4095('0x37')]=qs[_0x4095('0x2e')](_['pick'](_0x1ddcdc[_0x4095('0x2c')],_0x199b7d[_0x4095('0x2e')]),_0x1f70d2);if(_0x1ddcdc[_0x4095('0x2c')][_0x4095('0x38')]){_0x59d296[_0x4095('0x37')]=_[_0x4095('0x39')](_0x59d296[_0x4095('0x37')],{'$or':_[_0x4095('0x27')](_0x1f70d2,function(_0x45b64f){if(_0x45b64f[_0x4095('0x2a')]!==_0x4095('0x3a')){var _0x2e3ebd={};_0x2e3ebd[_0x45b64f[_0x4095('0x25')]]={'$like':'%'+_0x1ddcdc[_0x4095('0x2c')]['filter']+'%'};return _0x2e3ebd;}})});}_0x59d296=_[_0x4095('0x39')]({},_0x59d296,_0x1ddcdc['options']);var _0x3160ed={'where':_0x59d296[_0x4095('0x37')]};return db[_0x4095('0x3b')][_0x4095('0x1a')](_0x3160ed)['then'](function(_0x173ed1){_0xe68318['count']=_0x173ed1;if(_0x1ddcdc[_0x4095('0x2c')]['includeAll']){_0x59d296[_0x4095('0x3c')]=[{'all':!![]}];}return db[_0x4095('0x3b')][_0x4095('0x3d')](_0x59d296);})[_0x4095('0x22')](function(_0x4a9f66){_0xe68318['rows']=_0x4a9f66;return _0xe68318;})['then'](respondWithFilteredResult(_0x555953,_0x59d296))['catch'](handleError(_0x555953,null));};exports[_0x4095('0x3e')]=function(_0x36135e,_0x2c3437){var _0x2df255={'raw':!![],'where':{'id':_0x36135e['params']['id']}},_0x149834={};_0x149834[_0x4095('0x2b')]=_[_0x4095('0x2d')](db[_0x4095('0x3b')]['rawAttributes']);_0x149834['query']=_['keys'](_0x36135e['query']);_0x149834[_0x4095('0x2e')]=_['intersection'](_0x149834[_0x4095('0x2b')],_0x149834[_0x4095('0x2c')]);_0x2df255[_0x4095('0x31')]=_[_0x4095('0x2f')](_0x149834[_0x4095('0x2b')],qs[_0x4095('0x30')](_0x36135e[_0x4095('0x2c')]['fields']));_0x2df255[_0x4095('0x31')]=_0x2df255[_0x4095('0x31')]['length']?_0x2df255[_0x4095('0x31')]:_0x149834[_0x4095('0x2b')];if(_0x36135e[_0x4095('0x2c')][_0x4095('0x3f')]){_0x2df255['include']=[{'all':!![]}];}_0x2df255=_['merge']({},_0x2df255,_0x36135e[_0x4095('0x40')]);return db[_0x4095('0x3b')][_0x4095('0x41')](_0x2df255)[_0x4095('0x22')](handleEntityNotFound(_0x2c3437,null))['then'](respondWithResult(_0x2c3437,null))[_0x4095('0x42')](handleError(_0x2c3437,null));};exports['create']=function(_0x146276,_0x325a35){return db[_0x4095('0x3b')][_0x4095('0x43')](_0x146276[_0x4095('0x44')],{})[_0x4095('0x22')](respondWithResult(_0x325a35,0xc9))[_0x4095('0x42')](handleError(_0x325a35,null));};exports[_0x4095('0x21')]=function(_0x3ab424,_0x29c4b3){if(_0x3ab424[_0x4095('0x44')]['id']){delete _0x3ab424[_0x4095('0x44')]['id'];}return db['ChatQueueReport'][_0x4095('0x41')]({'where':{'id':_0x3ab424['params']['id']}})[_0x4095('0x22')](handleEntityNotFound(_0x29c4b3,null))[_0x4095('0x22')](saveUpdates(_0x3ab424[_0x4095('0x44')],null))[_0x4095('0x22')](respondWithResult(_0x29c4b3,null))[_0x4095('0x42')](handleError(_0x29c4b3,null));};exports[_0x4095('0x45')]=function(_0x2ed7f8,_0x339607){return db[_0x4095('0x3b')][_0x4095('0x41')]({'where':{'id':_0x2ed7f8[_0x4095('0x46')]['id']}})[_0x4095('0x22')](handleEntityNotFound(_0x339607,null))[_0x4095('0x22')](removeEntity(_0x339607,null))[_0x4095('0x42')](handleError(_0x339607,null));};exports[_0x4095('0x47')]=function(_0x305c4e,_0xe35bc8){return db[_0x4095('0x3b')][_0x4095('0x47')]()['then'](respondWithResult(_0xe35bc8,null))[_0x4095('0x42')](handleError(_0xe35bc8,null));}; \ No newline at end of file +var _0x0309=['describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','status','end','offset','undefined','count','limit','set','json','apply','reject','then','destroy','sendStatus','stack','name','send','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','VIRTUAL','filter','merge','options','includeAll','ChatQueueReport','findAll','rows','show','create','body','update','find','catch','params'];(function(_0x3c05b2,_0x2a2dc3){var _0x586819=function(_0x52129b){while(--_0x52129b){_0x3c05b2['push'](_0x3c05b2['shift']());}};_0x586819(++_0x2a2dc3);}(_0x0309,0x8d));var _0x9030=function(_0x2ba3c5,_0x405d42){_0x2ba3c5=_0x2ba3c5-0x0;var _0x426eaf=_0x0309[_0x2ba3c5];return _0x426eaf;};'use strict';var emlformat=require(_0x9030('0x0'));var rimraf=require(_0x9030('0x1'));var zipdir=require(_0x9030('0x2'));var jsonpatch=require(_0x9030('0x3'));var rp=require(_0x9030('0x4'));var moment=require('moment');var BPromise=require(_0x9030('0x5'));var Mustache=require(_0x9030('0x6'));var util=require('util');var path=require('path');var sox=require(_0x9030('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9030('0x8'));var squel=require('squel');var crypto=require(_0x9030('0x9'));var jsforce=require(_0x9030('0xa'));var deskjs=require(_0x9030('0xb'));var toCsv=require(_0x9030('0xc'));var querystring=require(_0x9030('0xd'));var Papa=require(_0x9030('0xe'));var Redis=require(_0x9030('0xf'));var authService=require(_0x9030('0x10'));var qs=require(_0x9030('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9030('0x12'));var logger=require('../../config/logger')(_0x9030('0x13'));var utils=require(_0x9030('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x9030('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x21ded6,_0x5096a0){_0x5096a0=_0x5096a0||0xcc;return function(_0x444132){if(_0x444132){return _0x21ded6['sendStatus'](_0x5096a0);}return _0x21ded6[_0x9030('0x16')](_0x5096a0)[_0x9030('0x17')]();};}function respondWithResult(_0x438211,_0x142a9e){_0x142a9e=_0x142a9e||0xc8;return function(_0x551021){if(_0x551021){return _0x438211['status'](_0x142a9e)['json'](_0x551021);}};}function respondWithFilteredResult(_0x493b5f,_0x14eb75){return function(_0x3b61cc){if(_0x3b61cc){var _0x4b8351=typeof _0x14eb75[_0x9030('0x18')]===_0x9030('0x19')&&typeof _0x14eb75['limit']===_0x9030('0x19');var _0x4bc394=_0x3b61cc[_0x9030('0x1a')];var _0x4960fd=_0x4b8351?0x0:_0x14eb75['offset'];var _0x36f91d=_0x4b8351?_0x3b61cc[_0x9030('0x1a')]:_0x14eb75[_0x9030('0x18')]+_0x14eb75[_0x9030('0x1b')];var _0x42207a;if(_0x36f91d>=_0x4bc394){_0x36f91d=_0x4bc394;_0x42207a=0xc8;}else{_0x42207a=0xce;}_0x493b5f[_0x9030('0x16')](_0x42207a);return _0x493b5f[_0x9030('0x1c')]('Content-Range',_0x4960fd+'-'+_0x36f91d+'/'+_0x4bc394)[_0x9030('0x1d')](_0x3b61cc);}return null;};}function patchUpdates(_0x3e0d21){return function(_0x279cd1){try{jsonpatch[_0x9030('0x1e')](_0x279cd1,_0x3e0d21,!![]);}catch(_0x56c9a5){return BPromise[_0x9030('0x1f')](_0x56c9a5);}return _0x279cd1['save']();};}function saveUpdates(_0x50a924,_0x2d1041){return function(_0x350ef3){if(_0x350ef3){return _0x350ef3['update'](_0x50a924)[_0x9030('0x20')](function(_0x2c26ed){return _0x2c26ed;});}return null;};}function removeEntity(_0x39fd02,_0x303885){return function(_0x2cb254){if(_0x2cb254){return _0x2cb254[_0x9030('0x21')]()[_0x9030('0x20')](function(){_0x39fd02[_0x9030('0x16')](0xcc)[_0x9030('0x17')]();});}};}function handleEntityNotFound(_0x46f19c,_0x1ae92e){return function(_0x53dbc2){if(!_0x53dbc2){_0x46f19c[_0x9030('0x22')](0x194);}return _0x53dbc2;};}function handleError(_0x434152,_0x5864e1){_0x5864e1=_0x5864e1||0x1f4;return function(_0x1761ee){logger['error'](_0x1761ee[_0x9030('0x23')]);if(_0x1761ee[_0x9030('0x24')]){delete _0x1761ee[_0x9030('0x24')];}_0x434152['status'](_0x5864e1)[_0x9030('0x25')](_0x1761ee);};}exports['index']=function(_0x4ab6d4,_0x3e0c85){var _0x3af16a={},_0x1afa08={},_0x5328c5={'count':0x0,'rows':[]};var _0xf71255=_['map'](db['ChatQueueReport'][_0x9030('0x26')],function(_0x25410e){return{'name':_0x25410e[_0x9030('0x27')],'type':_0x25410e[_0x9030('0x28')]['key']};});_0x1afa08[_0x9030('0x29')]=_['map'](_0xf71255,_0x9030('0x24'));_0x1afa08[_0x9030('0x2a')]=_[_0x9030('0x2b')](_0x4ab6d4[_0x9030('0x2a')]);_0x1afa08['filters']=_['intersection'](_0x1afa08[_0x9030('0x29')],_0x1afa08['query']);_0x3af16a[_0x9030('0x2c')]=_[_0x9030('0x2d')](_0x1afa08[_0x9030('0x29')],qs[_0x9030('0x2e')](_0x4ab6d4[_0x9030('0x2a')][_0x9030('0x2e')]));_0x3af16a[_0x9030('0x2c')]=_0x3af16a['attributes']['length']?_0x3af16a[_0x9030('0x2c')]:_0x1afa08[_0x9030('0x29')];if(!_0x4ab6d4['query'][_0x9030('0x2f')](_0x9030('0x30'))){_0x3af16a[_0x9030('0x1b')]=qs[_0x9030('0x1b')](_0x4ab6d4[_0x9030('0x2a')][_0x9030('0x1b')]);_0x3af16a[_0x9030('0x18')]=qs['offset'](_0x4ab6d4[_0x9030('0x2a')][_0x9030('0x18')]);}_0x3af16a[_0x9030('0x31')]=qs['sort'](_0x4ab6d4[_0x9030('0x2a')][_0x9030('0x32')]);_0x3af16a[_0x9030('0x33')]=qs[_0x9030('0x34')](_[_0x9030('0x35')](_0x4ab6d4[_0x9030('0x2a')],_0x1afa08['filters']),_0xf71255);if(_0x4ab6d4[_0x9030('0x2a')]['filter']){_0x3af16a['where']=_['merge'](_0x3af16a['where'],{'$or':_['map'](_0xf71255,function(_0x232e53){if(_0x232e53[_0x9030('0x28')]!==_0x9030('0x36')){var _0x1ca60a={};_0x1ca60a[_0x232e53[_0x9030('0x24')]]={'$like':'%'+_0x4ab6d4[_0x9030('0x2a')][_0x9030('0x37')]+'%'};return _0x1ca60a;}})});}_0x3af16a=_[_0x9030('0x38')]({},_0x3af16a,_0x4ab6d4[_0x9030('0x39')]);var _0xa13cc6={'where':_0x3af16a['where']};return db['ChatQueueReport'][_0x9030('0x1a')](_0xa13cc6)[_0x9030('0x20')](function(_0x4f4b46){_0x5328c5[_0x9030('0x1a')]=_0x4f4b46;if(_0x4ab6d4[_0x9030('0x2a')][_0x9030('0x3a')]){_0x3af16a['include']=[{'all':!![]}];}return db[_0x9030('0x3b')][_0x9030('0x3c')](_0x3af16a);})[_0x9030('0x20')](function(_0x11ccb2){_0x5328c5[_0x9030('0x3d')]=_0x11ccb2;return _0x5328c5;})[_0x9030('0x20')](respondWithFilteredResult(_0x3e0c85,_0x3af16a))['catch'](handleError(_0x3e0c85,null));};exports[_0x9030('0x3e')]=function(_0x45e99f,_0x26bd68){var _0x4640dd={'raw':!![],'where':{'id':_0x45e99f['params']['id']}},_0x5c95ec={};_0x5c95ec[_0x9030('0x29')]=_[_0x9030('0x2b')](db[_0x9030('0x3b')][_0x9030('0x26')]);_0x5c95ec[_0x9030('0x2a')]=_[_0x9030('0x2b')](_0x45e99f[_0x9030('0x2a')]);_0x5c95ec[_0x9030('0x34')]=_[_0x9030('0x2d')](_0x5c95ec[_0x9030('0x29')],_0x5c95ec[_0x9030('0x2a')]);_0x4640dd[_0x9030('0x2c')]=_[_0x9030('0x2d')](_0x5c95ec[_0x9030('0x29')],qs[_0x9030('0x2e')](_0x45e99f[_0x9030('0x2a')]['fields']));_0x4640dd['attributes']=_0x4640dd[_0x9030('0x2c')]['length']?_0x4640dd[_0x9030('0x2c')]:_0x5c95ec[_0x9030('0x29')];if(_0x45e99f[_0x9030('0x2a')][_0x9030('0x3a')]){_0x4640dd['include']=[{'all':!![]}];}_0x4640dd=_[_0x9030('0x38')]({},_0x4640dd,_0x45e99f[_0x9030('0x39')]);return db[_0x9030('0x3b')]['find'](_0x4640dd)[_0x9030('0x20')](handleEntityNotFound(_0x26bd68,null))[_0x9030('0x20')](respondWithResult(_0x26bd68,null))['catch'](handleError(_0x26bd68,null));};exports['create']=function(_0x587cfb,_0x35978a){return db[_0x9030('0x3b')][_0x9030('0x3f')](_0x587cfb[_0x9030('0x40')],{})[_0x9030('0x20')](respondWithResult(_0x35978a,0xc9))['catch'](handleError(_0x35978a,null));};exports[_0x9030('0x41')]=function(_0x2340e1,_0x35d0a9){if(_0x2340e1[_0x9030('0x40')]['id']){delete _0x2340e1[_0x9030('0x40')]['id'];}return db['ChatQueueReport'][_0x9030('0x42')]({'where':{'id':_0x2340e1['params']['id']}})[_0x9030('0x20')](handleEntityNotFound(_0x35d0a9,null))['then'](saveUpdates(_0x2340e1[_0x9030('0x40')],null))[_0x9030('0x20')](respondWithResult(_0x35d0a9,null))[_0x9030('0x43')](handleError(_0x35d0a9,null));};exports[_0x9030('0x21')]=function(_0x446173,_0x55c8b8){return db['ChatQueueReport'][_0x9030('0x42')]({'where':{'id':_0x446173[_0x9030('0x44')]['id']}})[_0x9030('0x20')](handleEntityNotFound(_0x55c8b8,null))[_0x9030('0x20')](removeEntity(_0x55c8b8,null))[_0x9030('0x43')](handleError(_0x55c8b8,null));};exports['describe']=function(_0xd04274,_0x52d097){return db[_0x9030('0x3b')][_0x9030('0x45')]()['then'](respondWithResult(_0x52d097,null))['catch'](handleError(_0x52d097,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 10a8871..92397f0 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 _0xd8b0=['define','report_chat_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1cbfd5,_0x182533){var _0x222615=function(_0x2b8e0d){while(--_0x2b8e0d){_0x1cbfd5['push'](_0x1cbfd5['shift']());}};_0x222615(++_0x182533);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./chatQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('ChatQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b0=['define','report_chat_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x20d313,_0xc2d7a6){var _0x5421b3=function(_0x90040b){while(--_0x90040b){_0x20d313['push'](_0x20d313['shift']());}};_0x5421b3(++_0xc2d7a6);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./chatQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('ChatQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 1ba7279..03beeff 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 _0xa3e1=['../../mysqldb','../../config/logger','rpc','http','request','then','info','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','ChatQueueReport,\x20%s,\x20%s','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','update','where','attributes','limit','UpdateChatQueueReport','stringify','util','moment','bluebird','randomstring','ioredis'];(function(_0x3434c7,_0x301679){var _0x2432a0=function(_0x101cfe){while(--_0x101cfe){_0x3434c7['push'](_0x3434c7['shift']());}};_0x2432a0(++_0x301679);}(_0xa3e1,0x13b));var _0x1a3e=function(_0x44d3d7,_0x1c6356){_0x44d3d7=_0x44d3d7-0x0;var _0x1886c0=_0xa3e1[_0x44d3d7];return _0x1886c0;};'use strict';var _=require('lodash');var util=require(_0x1a3e('0x0'));var moment=require(_0x1a3e('0x1'));var BPromise=require(_0x1a3e('0x2'));var rs=require(_0x1a3e('0x3'));var fs=require('fs');var Redis=require(_0x1a3e('0x4'));var db=require(_0x1a3e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1a3e('0x6'))(_0x1a3e('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x1a3e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x34663e,_0x609cd0,_0x31891a){return new BPromise(function(_0x3f724f,_0xa09273){return client[_0x1a3e('0x9')](_0x34663e,_0x31891a)[_0x1a3e('0xa')](function(_0x2ba883){logger[_0x1a3e('0xb')]('ChatQueueReport,\x20%s,\x20%s',_0x609cd0,_0x1a3e('0xc'));logger[_0x1a3e('0xd')](_0x1a3e('0xe'),_0x609cd0,_0x1a3e('0xc'),JSON['stringify'](_0x2ba883));if(_0x2ba883[_0x1a3e('0xf')]){if(_0x2ba883[_0x1a3e('0xf')][_0x1a3e('0x10')]===0x1f4){logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x609cd0,_0x2ba883[_0x1a3e('0xf')][_0x1a3e('0x11')]);return _0xa09273(_0x2ba883[_0x1a3e('0xf')][_0x1a3e('0x11')]);}logger['error'](_0x1a3e('0x12'),_0x609cd0,_0x2ba883['error'][_0x1a3e('0x11')]);return _0x3f724f(_0x2ba883['error'][_0x1a3e('0x11')]);}else{logger[_0x1a3e('0xb')](_0x1a3e('0x12'),_0x609cd0,_0x1a3e('0xc'));_0x3f724f(_0x2ba883['result']['message']);}})[_0x1a3e('0x13')](function(_0x4f3580){logger[_0x1a3e('0xf')](_0x1a3e('0x12'),_0x609cd0,_0x4f3580);_0xa09273(_0x4f3580);});});}exports[_0x1a3e('0x14')]=function(_0x40b091){var _0x37a876=this;return new Promise(function(_0x53025a,_0x34fd4b){return db[_0x1a3e('0x15')][_0x1a3e('0x16')](_0x40b091[_0x1a3e('0x17')],{'raw':_0x40b091[_0x1a3e('0x18')]?_0x40b091[_0x1a3e('0x18')][_0x1a3e('0x19')]===undefined?!![]:![]:!![]})[_0x1a3e('0xa')](function(_0x341bce){logger[_0x1a3e('0xb')](_0x1a3e('0x14'),_0x40b091);logger[_0x1a3e('0xd')](_0x1a3e('0x14'),_0x40b091,JSON['stringify'](_0x341bce));_0x53025a(_0x341bce);})[_0x1a3e('0x13')](function(_0x23987c){logger[_0x1a3e('0xf')](_0x1a3e('0x14'),_0x23987c['message'],_0x40b091);_0x34fd4b(_0x37a876[_0x1a3e('0xf')](0x1f4,_0x23987c[_0x1a3e('0x11')]));});});};exports['UpdateChatQueueReport']=function(_0x5d87a6){var _0xf55ca1=this;return new Promise(function(_0x1abdf2,_0x3d7199){return db['ChatQueueReport'][_0x1a3e('0x1a')](_0x5d87a6[_0x1a3e('0x17')],{'raw':_0x5d87a6[_0x1a3e('0x18')]?_0x5d87a6['options'][_0x1a3e('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d87a6[_0x1a3e('0x18')]?_0x5d87a6[_0x1a3e('0x18')][_0x1a3e('0x1b')]||null:null,'attributes':_0x5d87a6[_0x1a3e('0x18')]?_0x5d87a6[_0x1a3e('0x18')][_0x1a3e('0x1c')]||null:null,'limit':_0x5d87a6[_0x1a3e('0x18')]?_0x5d87a6[_0x1a3e('0x18')][_0x1a3e('0x1d')]||null:null})[_0x1a3e('0xa')](function(_0x30957c){logger[_0x1a3e('0xb')](_0x1a3e('0x1e'),_0x5d87a6);logger[_0x1a3e('0xd')](_0x1a3e('0x1e'),_0x5d87a6,JSON[_0x1a3e('0x1f')](_0x30957c));_0x1abdf2(_0x30957c);})['catch'](function(_0x2df155){logger[_0x1a3e('0xf')](_0x1a3e('0x1e'),_0x2df155['message'],_0x5d87a6);_0x3d7199(_0xf55ca1[_0x1a3e('0xf')](0x1f4,_0x2df155['message']));});});}; \ No newline at end of file +var _0x775e=['limit','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','CreateChatQueueReport','create','body','options','raw','catch','UpdateChatQueueReport','ChatQueueReport','update','where'];(function(_0x1da448,_0x565a9f){var _0xdb7a13=function(_0x48bfc7){while(--_0x48bfc7){_0x1da448['push'](_0x1da448['shift']());}};_0xdb7a13(++_0x565a9f);}(_0x775e,0x181));var _0xe775=function(_0x5b7e5b,_0x119ecf){_0x5b7e5b=_0x5b7e5b-0x0;var _0xe1f0f0=_0x775e[_0x5b7e5b];return _0xe1f0f0;};'use strict';var _=require(_0xe775('0x0'));var util=require(_0xe775('0x1'));var moment=require(_0xe775('0x2'));var BPromise=require(_0xe775('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe775('0x4'))['db'];var utils=require(_0xe775('0x5'));var logger=require(_0xe775('0x6'))(_0xe775('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe775('0x8')][_0xe775('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x48af89,_0x5716c7,_0x514730){return new BPromise(function(_0x59e96c,_0x1730c5){return client[_0xe775('0xa')](_0x48af89,_0x514730)[_0xe775('0xb')](function(_0x1fc9b7){logger[_0xe775('0xc')](_0xe775('0xd'),_0x5716c7,_0xe775('0xe'));logger[_0xe775('0xf')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x5716c7,'request\x20sent',JSON[_0xe775('0x10')](_0x1fc9b7));if(_0x1fc9b7[_0xe775('0x11')]){if(_0x1fc9b7[_0xe775('0x11')][_0xe775('0x12')]===0x1f4){logger['error'](_0xe775('0xd'),_0x5716c7,_0x1fc9b7[_0xe775('0x11')][_0xe775('0x13')]);return _0x1730c5(_0x1fc9b7['error'][_0xe775('0x13')]);}logger[_0xe775('0x11')](_0xe775('0xd'),_0x5716c7,_0x1fc9b7[_0xe775('0x11')]['message']);return _0x59e96c(_0x1fc9b7['error'][_0xe775('0x13')]);}else{logger[_0xe775('0xc')](_0xe775('0xd'),_0x5716c7,'request\x20sent');_0x59e96c(_0x1fc9b7[_0xe775('0x14')][_0xe775('0x13')]);}})['catch'](function(_0xc16224){logger[_0xe775('0x11')]('ChatQueueReport,\x20%s,\x20%s',_0x5716c7,_0xc16224);_0x1730c5(_0xc16224);});});}exports[_0xe775('0x15')]=function(_0xad4621){var _0x36b08e=this;return new Promise(function(_0x24bd97,_0x1b57e9){return db['ChatQueueReport'][_0xe775('0x16')](_0xad4621[_0xe775('0x17')],{'raw':_0xad4621[_0xe775('0x18')]?_0xad4621[_0xe775('0x18')][_0xe775('0x19')]===undefined?!![]:![]:!![]})[_0xe775('0xb')](function(_0x561afa){logger['info'](_0xe775('0x15'),_0xad4621);logger[_0xe775('0xf')](_0xe775('0x15'),_0xad4621,JSON[_0xe775('0x10')](_0x561afa));_0x24bd97(_0x561afa);})[_0xe775('0x1a')](function(_0x2749bc){logger[_0xe775('0x11')]('CreateChatQueueReport',_0x2749bc[_0xe775('0x13')],_0xad4621);_0x1b57e9(_0x36b08e['error'](0x1f4,_0x2749bc['message']));});});};exports[_0xe775('0x1b')]=function(_0x14c73d){var _0x25863=this;return new Promise(function(_0x8ff59c,_0x5428cc){return db[_0xe775('0x1c')][_0xe775('0x1d')](_0x14c73d[_0xe775('0x17')],{'raw':_0x14c73d[_0xe775('0x18')]?_0x14c73d[_0xe775('0x18')][_0xe775('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x14c73d['options']?_0x14c73d[_0xe775('0x18')][_0xe775('0x1e')]||null:null,'attributes':_0x14c73d[_0xe775('0x18')]?_0x14c73d['options']['attributes']||null:null,'limit':_0x14c73d[_0xe775('0x18')]?_0x14c73d['options'][_0xe775('0x1f')]||null:null})['then'](function(_0x14013c){logger[_0xe775('0xc')](_0xe775('0x1b'),_0x14c73d);logger['debug'](_0xe775('0x1b'),_0x14c73d,JSON['stringify'](_0x14013c));_0x8ff59c(_0x14013c);})[_0xe775('0x1a')](function(_0x82b509){logger[_0xe775('0x11')](_0xe775('0x1b'),_0x82b509['message'],_0x14c73d);_0x5428cc(_0x25863[_0xe775('0x11')](0x1f4,_0x82b509['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index da4549a..9d1f20e 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 _0x3aab=['get','isAuthenticated','index','/describe','show','put','update','/:id','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatQueueReport.controller'];(function(_0x1e4492,_0x4a8802){var _0x18736e=function(_0x2ec68b){while(--_0x2ec68b){_0x1e4492['push'](_0x1e4492['shift']());}};_0x18736e(++_0x4a8802);}(_0x3aab,0x196));var _0xb3aa=function(_0x53a1dc,_0x1efd54){_0x53a1dc=_0x53a1dc-0x0;var _0xf01b64=_0x3aab[_0x53a1dc];return _0xf01b64;};'use strict';var multer=require(_0xb3aa('0x0'));var util=require('util');var path=require(_0xb3aa('0x1'));var timeout=require(_0xb3aa('0x2'));var express=require(_0xb3aa('0x3'));var router=express[_0xb3aa('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb3aa('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb3aa('0x6'));var controller=require(_0xb3aa('0x7'));router[_0xb3aa('0x8')]('/',auth[_0xb3aa('0x9')](),controller[_0xb3aa('0xa')]);router['get'](_0xb3aa('0xb'),auth[_0xb3aa('0x9')](),controller['describe']);router[_0xb3aa('0x8')]('/:id',auth[_0xb3aa('0x9')](),controller[_0xb3aa('0xc')]);router['post']('/',auth[_0xb3aa('0x9')](),controller['create']);router[_0xb3aa('0xd')]('/:id',auth[_0xb3aa('0x9')](),controller[_0xb3aa('0xe')]);router['delete'](_0xb3aa('0xf'),auth['isAuthenticated'](),controller[_0xb3aa('0x10')]);module[_0xb3aa('0x11')]=router; \ No newline at end of file +var _0x5dfb=['multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','/:id','show','post','create','delete','destroy','exports'];(function(_0x59d0cc,_0xa7c52b){var _0x2ae79f=function(_0x33042e){while(--_0x33042e){_0x59d0cc['push'](_0x59d0cc['shift']());}};_0x2ae79f(++_0xa7c52b);}(_0x5dfb,0xa2));var _0xb5df=function(_0x1781de,_0x5c4b38){_0x1781de=_0x1781de-0x0;var _0x48d7fc=_0x5dfb[_0x1781de];return _0x48d7fc;};'use strict';var multer=require(_0xb5df('0x0'));var util=require(_0xb5df('0x1'));var path=require(_0xb5df('0x2'));var timeout=require('connect-timeout');var express=require(_0xb5df('0x3'));var router=express[_0xb5df('0x4')]();var fs_extra=require(_0xb5df('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb5df('0x6'));var config=require(_0xb5df('0x7'));var controller=require('./chatQueueReport.controller');router[_0xb5df('0x8')]('/',auth[_0xb5df('0x9')](),controller['index']);router['get'](_0xb5df('0xa'),auth[_0xb5df('0x9')](),controller['describe']);router[_0xb5df('0x8')](_0xb5df('0xb'),auth[_0xb5df('0x9')](),controller[_0xb5df('0xc')]);router[_0xb5df('0xd')]('/',auth[_0xb5df('0x9')](),controller[_0xb5df('0xe')]);router['put'](_0xb5df('0xb'),auth[_0xb5df('0x9')](),controller['update']);router[_0xb5df('0xf')](_0xb5df('0xb'),auth[_0xb5df('0x9')](),controller[_0xb5df('0x10')]);module[_0xb5df('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 2b57c33..4612d07 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(_0x2aee4d,_0x2e33f6){var _0xa523be=function(_0x12284a){while(--_0x12284a){_0x2aee4d['push'](_0x2aee4d['shift']());}};_0xa523be(++_0x2e33f6);}(_0xf4eb,0xec));var _0xbf4e=function(_0x49d231,_0x7c8c9f){_0x49d231=_0x49d231-0x0;var _0xdc8e51=_0xf4eb[_0x49d231];return _0xdc8e51;};'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(_0x38d663,_0x311cc1){var _0x2de367=function(_0x46df61){while(--_0x46df61){_0x38d663['push'](_0x38d663['shift']());}};_0x2de367(++_0x311cc1);}(_0xedd9,0xfc));var _0x9edd=function(_0xdef717,_0x2fda4c){_0xdef717=_0xdef717-0x0;var _0x2d0fe5=_0xedd9[_0xdef717];return _0x2d0fe5;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 93cd237..6bf62f6 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 _0x484e=['params','include','options','create','body','destroy','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','error','stack','map','ChatTransferReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','name','includeAll','catch','show'];(function(_0x41a21a,_0xf520c9){var _0xa0542b=function(_0x598c3c){while(--_0x598c3c){_0x41a21a['push'](_0x41a21a['shift']());}};_0xa0542b(++_0xf520c9);}(_0x484e,0x1b8));var _0xe484=function(_0x5e8127,_0x380e9b){_0x5e8127=_0x5e8127-0x0;var _0x1ab2a0=_0x484e[_0x5e8127];return _0x1ab2a0;};'use strict';var emlformat=require(_0xe484('0x0'));var rimraf=require(_0xe484('0x1'));var zipdir=require(_0xe484('0x2'));var jsonpatch=require(_0xe484('0x3'));var rp=require(_0xe484('0x4'));var moment=require(_0xe484('0x5'));var BPromise=require(_0xe484('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xe484('0x7'));var ejs=require(_0xe484('0x8'));var fs=require('fs');var fs_extra=require(_0xe484('0x9'));var _=require('lodash');var squel=require(_0xe484('0xa'));var crypto=require(_0xe484('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xe484('0xc'));var toCsv=require(_0xe484('0x7'));var querystring=require(_0xe484('0xd'));var Papa=require(_0xe484('0xe'));var Redis=require(_0xe484('0xf'));var authService=require(_0xe484('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe484('0x11'));var hardwareService=require(_0xe484('0x12'));var logger=require(_0xe484('0x13'))(_0xe484('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe484('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xcd1fa0,_0x2b3a56){_0x2b3a56=_0x2b3a56||0xcc;return function(_0x20592f){if(_0x20592f){return _0xcd1fa0[_0xe484('0x16')](_0x2b3a56);}return _0xcd1fa0[_0xe484('0x17')](_0x2b3a56)[_0xe484('0x18')]();};}function respondWithResult(_0x57f042,_0x2a22b1){_0x2a22b1=_0x2a22b1||0xc8;return function(_0x1aaa3a){if(_0x1aaa3a){return _0x57f042[_0xe484('0x17')](_0x2a22b1)[_0xe484('0x19')](_0x1aaa3a);}};}function respondWithFilteredResult(_0x18b30e,_0x49243e){return function(_0x58a531){if(_0x58a531){var _0x5d435f=typeof _0x49243e[_0xe484('0x1a')]===_0xe484('0x1b')&&typeof _0x49243e[_0xe484('0x1c')]==='undefined';var _0x34fc17=_0x58a531['count'];var _0x195600=_0x5d435f?0x0:_0x49243e[_0xe484('0x1a')];var _0x102d03=_0x5d435f?_0x58a531[_0xe484('0x1d')]:_0x49243e[_0xe484('0x1a')]+_0x49243e['limit'];var _0x4387f4;if(_0x102d03>=_0x34fc17){_0x102d03=_0x34fc17;_0x4387f4=0xc8;}else{_0x4387f4=0xce;}_0x18b30e[_0xe484('0x17')](_0x4387f4);return _0x18b30e[_0xe484('0x1e')]('Content-Range',_0x195600+'-'+_0x102d03+'/'+_0x34fc17)['json'](_0x58a531);}return null;};}function patchUpdates(_0x455ebf){return function(_0x2c57eb){try{jsonpatch[_0xe484('0x1f')](_0x2c57eb,_0x455ebf,!![]);}catch(_0x5e7b22){return BPromise[_0xe484('0x20')](_0x5e7b22);}return _0x2c57eb[_0xe484('0x21')]();};}function saveUpdates(_0x2259a0,_0x4bc70b){return function(_0x2be829){if(_0x2be829){return _0x2be829[_0xe484('0x22')](_0x2259a0)[_0xe484('0x23')](function(_0x512742){return _0x512742;});}return null;};}function removeEntity(_0x2b1731,_0x14cea8){return function(_0x6a645d){if(_0x6a645d){return _0x6a645d['destroy']()[_0xe484('0x23')](function(){_0x2b1731['status'](0xcc)[_0xe484('0x18')]();});}};}function handleEntityNotFound(_0x7689d6,_0x4ec6d9){return function(_0x519d22){if(!_0x519d22){_0x7689d6[_0xe484('0x16')](0x194);}return _0x519d22;};}function handleError(_0x2af8c3,_0x3daa55){_0x3daa55=_0x3daa55||0x1f4;return function(_0x544aae){logger[_0xe484('0x24')](_0x544aae[_0xe484('0x25')]);if(_0x544aae['name']){delete _0x544aae['name'];}_0x2af8c3[_0xe484('0x17')](_0x3daa55)['send'](_0x544aae);};}exports['index']=function(_0x4aee6d,_0x3822f8){var _0x6af986={},_0x16e50c={},_0x3b1182={'count':0x0,'rows':[]};var _0x8a7ee9=_[_0xe484('0x26')](db[_0xe484('0x27')][_0xe484('0x28')],function(_0x684084){return{'name':_0x684084[_0xe484('0x29')],'type':_0x684084['type'][_0xe484('0x2a')]};});_0x16e50c[_0xe484('0x2b')]=_[_0xe484('0x26')](_0x8a7ee9,'name');_0x16e50c[_0xe484('0x2c')]=_[_0xe484('0x2d')](_0x4aee6d[_0xe484('0x2c')]);_0x16e50c[_0xe484('0x2e')]=_[_0xe484('0x2f')](_0x16e50c[_0xe484('0x2b')],_0x16e50c[_0xe484('0x2c')]);_0x6af986[_0xe484('0x30')]=_[_0xe484('0x2f')](_0x16e50c[_0xe484('0x2b')],qs[_0xe484('0x31')](_0x4aee6d['query'][_0xe484('0x31')]));_0x6af986['attributes']=_0x6af986[_0xe484('0x30')][_0xe484('0x32')]?_0x6af986[_0xe484('0x30')]:_0x16e50c[_0xe484('0x2b')];if(!_0x4aee6d[_0xe484('0x2c')][_0xe484('0x33')](_0xe484('0x34'))){_0x6af986[_0xe484('0x1c')]=qs[_0xe484('0x1c')](_0x4aee6d[_0xe484('0x2c')][_0xe484('0x1c')]);_0x6af986['offset']=qs['offset'](_0x4aee6d['query'][_0xe484('0x1a')]);}_0x6af986[_0xe484('0x35')]=qs[_0xe484('0x36')](_0x4aee6d[_0xe484('0x2c')]['sort']);_0x6af986[_0xe484('0x37')]=qs[_0xe484('0x2e')](_[_0xe484('0x38')](_0x4aee6d[_0xe484('0x2c')],_0x16e50c[_0xe484('0x2e')]),_0x8a7ee9);if(_0x4aee6d['query'][_0xe484('0x39')]){_0x6af986[_0xe484('0x37')]=_['merge'](_0x6af986[_0xe484('0x37')],{'$or':_[_0xe484('0x26')](_0x8a7ee9,function(_0x5d4299){if(_0x5d4299[_0xe484('0x3a')]!==_0xe484('0x3b')){var _0x217104={};_0x217104[_0x5d4299[_0xe484('0x3c')]]={'$like':'%'+_0x4aee6d[_0xe484('0x2c')]['filter']+'%'};return _0x217104;}})});}_0x6af986=_['merge']({},_0x6af986,_0x4aee6d['options']);var _0x469207={'where':_0x6af986[_0xe484('0x37')]};return db[_0xe484('0x27')][_0xe484('0x1d')](_0x469207)[_0xe484('0x23')](function(_0x447431){_0x3b1182[_0xe484('0x1d')]=_0x447431;if(_0x4aee6d[_0xe484('0x2c')][_0xe484('0x3d')]){_0x6af986['include']=[{'all':!![]}];}return db[_0xe484('0x27')]['findAll'](_0x6af986);})['then'](function(_0x4830d8){_0x3b1182['rows']=_0x4830d8;return _0x3b1182;})[_0xe484('0x23')](respondWithFilteredResult(_0x3822f8,_0x6af986))[_0xe484('0x3e')](handleError(_0x3822f8,null));};exports[_0xe484('0x3f')]=function(_0x2f66cd,_0x5bddbd){var _0x31abc1={'raw':!![],'where':{'id':_0x2f66cd[_0xe484('0x40')]['id']}},_0x1794b8={};_0x1794b8[_0xe484('0x2b')]=_['keys'](db[_0xe484('0x27')]['rawAttributes']);_0x1794b8[_0xe484('0x2c')]=_['keys'](_0x2f66cd[_0xe484('0x2c')]);_0x1794b8['filters']=_['intersection'](_0x1794b8['model'],_0x1794b8[_0xe484('0x2c')]);_0x31abc1[_0xe484('0x30')]=_[_0xe484('0x2f')](_0x1794b8[_0xe484('0x2b')],qs[_0xe484('0x31')](_0x2f66cd['query'][_0xe484('0x31')]));_0x31abc1['attributes']=_0x31abc1[_0xe484('0x30')][_0xe484('0x32')]?_0x31abc1[_0xe484('0x30')]:_0x1794b8[_0xe484('0x2b')];if(_0x2f66cd[_0xe484('0x2c')][_0xe484('0x3d')]){_0x31abc1[_0xe484('0x41')]=[{'all':!![]}];}_0x31abc1=_['merge']({},_0x31abc1,_0x2f66cd[_0xe484('0x42')]);return db['ChatTransferReport']['find'](_0x31abc1)[_0xe484('0x23')](handleEntityNotFound(_0x5bddbd,null))[_0xe484('0x23')](respondWithResult(_0x5bddbd,null))[_0xe484('0x3e')](handleError(_0x5bddbd,null));};exports['create']=function(_0x36ab84,_0x5d3d46){return db[_0xe484('0x27')][_0xe484('0x43')](_0x36ab84[_0xe484('0x44')],{})['then'](respondWithResult(_0x5d3d46,0xc9))[_0xe484('0x3e')](handleError(_0x5d3d46,null));};exports['update']=function(_0x44b2a7,_0x7947e9){if(_0x44b2a7[_0xe484('0x44')]['id']){delete _0x44b2a7[_0xe484('0x44')]['id'];}return db['ChatTransferReport']['find']({'where':{'id':_0x44b2a7[_0xe484('0x40')]['id']}})[_0xe484('0x23')](handleEntityNotFound(_0x7947e9,null))[_0xe484('0x23')](saveUpdates(_0x44b2a7[_0xe484('0x44')],null))[_0xe484('0x23')](respondWithResult(_0x7947e9,null))['catch'](handleError(_0x7947e9,null));};exports[_0xe484('0x45')]=function(_0x1fb015,_0x2affc3){return db[_0xe484('0x27')][_0xe484('0x46')]({'where':{'id':_0x1fb015[_0xe484('0x40')]['id']}})['then'](handleEntityNotFound(_0x2affc3,null))[_0xe484('0x23')](removeEntity(_0x2affc3,null))[_0xe484('0x3e')](handleError(_0x2affc3,null));};exports[_0xe484('0x47')]=function(_0x2660ac,_0x38dd8f){return db[_0xe484('0x27')][_0xe484('0x47')]()[_0xe484('0x23')](respondWithResult(_0x38dd8f,null))[_0xe484('0x3e')](handleError(_0x38dd8f,null));}; \ No newline at end of file +var _0x5cb9=['fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','pick','filter','type','options','where','includeAll','findAll','rows','catch','show','params','length','include','merge','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','index','ChatTransferReport','rawAttributes'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x5cb9,0xbb));var _0x95cb=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x5cb9[_0x4a9fb1];return _0x348672;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x95cb('0x0'));var zipdir=require(_0x95cb('0x1'));var jsonpatch=require(_0x95cb('0x2'));var rp=require(_0x95cb('0x3'));var moment=require(_0x95cb('0x4'));var BPromise=require(_0x95cb('0x5'));var Mustache=require(_0x95cb('0x6'));var util=require(_0x95cb('0x7'));var path=require(_0x95cb('0x8'));var sox=require('sox');var csv=require(_0x95cb('0x9'));var ejs=require(_0x95cb('0xa'));var fs=require('fs');var fs_extra=require(_0x95cb('0xb'));var _=require(_0x95cb('0xc'));var squel=require(_0x95cb('0xd'));var crypto=require(_0x95cb('0xe'));var jsforce=require(_0x95cb('0xf'));var deskjs=require(_0x95cb('0x10'));var toCsv=require('to-csv');var querystring=require(_0x95cb('0x11'));var Papa=require('papaparse');var Redis=require(_0x95cb('0x12'));var authService=require(_0x95cb('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x95cb('0x14'))(_0x95cb('0x15'));var utils=require(_0x95cb('0x16'));var config=require(_0x95cb('0x17'));var licenseUtil=require(_0x95cb('0x18'));var db=require(_0x95cb('0x19'))['db'];function respondWithStatusCode(_0x402b07,_0x4a9571){_0x4a9571=_0x4a9571||0xcc;return function(_0x63dd0d){if(_0x63dd0d){return _0x402b07['sendStatus'](_0x4a9571);}return _0x402b07['status'](_0x4a9571)[_0x95cb('0x1a')]();};}function respondWithResult(_0x208e52,_0x31543a){_0x31543a=_0x31543a||0xc8;return function(_0x1c4d4b){if(_0x1c4d4b){return _0x208e52[_0x95cb('0x1b')](_0x31543a)[_0x95cb('0x1c')](_0x1c4d4b);}};}function respondWithFilteredResult(_0x156cd5,_0xcc13b0){return function(_0x284ee5){if(_0x284ee5){var _0x43918e=typeof _0xcc13b0['offset']===_0x95cb('0x1d')&&typeof _0xcc13b0[_0x95cb('0x1e')]===_0x95cb('0x1d');var _0x2d1629=_0x284ee5[_0x95cb('0x1f')];var _0x76b599=_0x43918e?0x0:_0xcc13b0[_0x95cb('0x20')];var _0x189792=_0x43918e?_0x284ee5['count']:_0xcc13b0[_0x95cb('0x20')]+_0xcc13b0[_0x95cb('0x1e')];var _0x26230c;if(_0x189792>=_0x2d1629){_0x189792=_0x2d1629;_0x26230c=0xc8;}else{_0x26230c=0xce;}_0x156cd5[_0x95cb('0x1b')](_0x26230c);return _0x156cd5[_0x95cb('0x21')](_0x95cb('0x22'),_0x76b599+'-'+_0x189792+'/'+_0x2d1629)[_0x95cb('0x1c')](_0x284ee5);}return null;};}function patchUpdates(_0x5df16b){return function(_0x15b035){try{jsonpatch[_0x95cb('0x23')](_0x15b035,_0x5df16b,!![]);}catch(_0x33587e){return BPromise[_0x95cb('0x24')](_0x33587e);}return _0x15b035['save']();};}function saveUpdates(_0x360c81,_0x47f11a){return function(_0x182223){if(_0x182223){return _0x182223[_0x95cb('0x25')](_0x360c81)[_0x95cb('0x26')](function(_0x4b39a8){return _0x4b39a8;});}return null;};}function removeEntity(_0x13d00c,_0x1a689d){return function(_0x5dce86){if(_0x5dce86){return _0x5dce86[_0x95cb('0x27')]()[_0x95cb('0x26')](function(){_0x13d00c[_0x95cb('0x1b')](0xcc)[_0x95cb('0x1a')]();});}};}function handleEntityNotFound(_0x4e2d62,_0x55b4ea){return function(_0xac6da8){if(!_0xac6da8){_0x4e2d62[_0x95cb('0x28')](0x194);}return _0xac6da8;};}function handleError(_0x3f2ee9,_0x266f16){_0x266f16=_0x266f16||0x1f4;return function(_0x246139){logger[_0x95cb('0x29')](_0x246139[_0x95cb('0x2a')]);if(_0x246139[_0x95cb('0x2b')]){delete _0x246139[_0x95cb('0x2b')];}_0x3f2ee9[_0x95cb('0x1b')](_0x266f16)['send'](_0x246139);};}exports[_0x95cb('0x2c')]=function(_0x21a6a1,_0x2a2b0d){var _0x54627e={},_0x9eddf={},_0x4a9e18={'count':0x0,'rows':[]};var _0xc56123=_['map'](db[_0x95cb('0x2d')][_0x95cb('0x2e')],function(_0x41df22){return{'name':_0x41df22[_0x95cb('0x2f')],'type':_0x41df22['type'][_0x95cb('0x30')]};});_0x9eddf[_0x95cb('0x31')]=_[_0x95cb('0x32')](_0xc56123,_0x95cb('0x2b'));_0x9eddf[_0x95cb('0x33')]=_[_0x95cb('0x34')](_0x21a6a1[_0x95cb('0x33')]);_0x9eddf[_0x95cb('0x35')]=_[_0x95cb('0x36')](_0x9eddf[_0x95cb('0x31')],_0x9eddf[_0x95cb('0x33')]);_0x54627e[_0x95cb('0x37')]=_[_0x95cb('0x36')](_0x9eddf[_0x95cb('0x31')],qs[_0x95cb('0x38')](_0x21a6a1[_0x95cb('0x33')]['fields']));_0x54627e[_0x95cb('0x37')]=_0x54627e['attributes']['length']?_0x54627e[_0x95cb('0x37')]:_0x9eddf[_0x95cb('0x31')];if(!_0x21a6a1[_0x95cb('0x33')][_0x95cb('0x39')]('nolimit')){_0x54627e['limit']=qs[_0x95cb('0x1e')](_0x21a6a1[_0x95cb('0x33')][_0x95cb('0x1e')]);_0x54627e['offset']=qs[_0x95cb('0x20')](_0x21a6a1[_0x95cb('0x33')][_0x95cb('0x20')]);}_0x54627e[_0x95cb('0x3a')]=qs['sort'](_0x21a6a1[_0x95cb('0x33')][_0x95cb('0x3b')]);_0x54627e['where']=qs[_0x95cb('0x35')](_[_0x95cb('0x3c')](_0x21a6a1[_0x95cb('0x33')],_0x9eddf[_0x95cb('0x35')]),_0xc56123);if(_0x21a6a1['query'][_0x95cb('0x3d')]){_0x54627e['where']=_['merge'](_0x54627e['where'],{'$or':_[_0x95cb('0x32')](_0xc56123,function(_0x2e77d8){if(_0x2e77d8[_0x95cb('0x3e')]!=='VIRTUAL'){var _0x389c2b={};_0x389c2b[_0x2e77d8['name']]={'$like':'%'+_0x21a6a1[_0x95cb('0x33')][_0x95cb('0x3d')]+'%'};return _0x389c2b;}})});}_0x54627e=_['merge']({},_0x54627e,_0x21a6a1[_0x95cb('0x3f')]);var _0x21e687={'where':_0x54627e[_0x95cb('0x40')]};return db[_0x95cb('0x2d')][_0x95cb('0x1f')](_0x21e687)[_0x95cb('0x26')](function(_0x3f986e){_0x4a9e18[_0x95cb('0x1f')]=_0x3f986e;if(_0x21a6a1[_0x95cb('0x33')][_0x95cb('0x41')]){_0x54627e['include']=[{'all':!![]}];}return db[_0x95cb('0x2d')][_0x95cb('0x42')](_0x54627e);})[_0x95cb('0x26')](function(_0x11579a){_0x4a9e18[_0x95cb('0x43')]=_0x11579a;return _0x4a9e18;})[_0x95cb('0x26')](respondWithFilteredResult(_0x2a2b0d,_0x54627e))[_0x95cb('0x44')](handleError(_0x2a2b0d,null));};exports[_0x95cb('0x45')]=function(_0x163518,_0x3f1e7f){var _0x16d076={'raw':!![],'where':{'id':_0x163518[_0x95cb('0x46')]['id']}},_0x50cfd9={};_0x50cfd9[_0x95cb('0x31')]=_[_0x95cb('0x34')](db[_0x95cb('0x2d')]['rawAttributes']);_0x50cfd9[_0x95cb('0x33')]=_[_0x95cb('0x34')](_0x163518['query']);_0x50cfd9[_0x95cb('0x35')]=_['intersection'](_0x50cfd9[_0x95cb('0x31')],_0x50cfd9[_0x95cb('0x33')]);_0x16d076[_0x95cb('0x37')]=_[_0x95cb('0x36')](_0x50cfd9[_0x95cb('0x31')],qs[_0x95cb('0x38')](_0x163518[_0x95cb('0x33')][_0x95cb('0x38')]));_0x16d076[_0x95cb('0x37')]=_0x16d076[_0x95cb('0x37')][_0x95cb('0x47')]?_0x16d076['attributes']:_0x50cfd9[_0x95cb('0x31')];if(_0x163518[_0x95cb('0x33')][_0x95cb('0x41')]){_0x16d076[_0x95cb('0x48')]=[{'all':!![]}];}_0x16d076=_[_0x95cb('0x49')]({},_0x16d076,_0x163518[_0x95cb('0x3f')]);return db[_0x95cb('0x2d')][_0x95cb('0x4a')](_0x16d076)[_0x95cb('0x26')](handleEntityNotFound(_0x3f1e7f,null))[_0x95cb('0x26')](respondWithResult(_0x3f1e7f,null))[_0x95cb('0x44')](handleError(_0x3f1e7f,null));};exports[_0x95cb('0x4b')]=function(_0x3656f2,_0x40747f){return db['ChatTransferReport']['create'](_0x3656f2['body'],{})[_0x95cb('0x26')](respondWithResult(_0x40747f,0xc9))['catch'](handleError(_0x40747f,null));};exports[_0x95cb('0x25')]=function(_0x13f6ba,_0x5037ef){if(_0x13f6ba[_0x95cb('0x4c')]['id']){delete _0x13f6ba['body']['id'];}return db[_0x95cb('0x2d')][_0x95cb('0x4a')]({'where':{'id':_0x13f6ba[_0x95cb('0x46')]['id']}})[_0x95cb('0x26')](handleEntityNotFound(_0x5037ef,null))[_0x95cb('0x26')](saveUpdates(_0x13f6ba[_0x95cb('0x4c')],null))[_0x95cb('0x26')](respondWithResult(_0x5037ef,null))[_0x95cb('0x44')](handleError(_0x5037ef,null));};exports[_0x95cb('0x27')]=function(_0x28e576,_0x5664f2){return db[_0x95cb('0x2d')][_0x95cb('0x4a')]({'where':{'id':_0x28e576['params']['id']}})[_0x95cb('0x26')](handleEntityNotFound(_0x5664f2,null))[_0x95cb('0x26')](removeEntity(_0x5664f2,null))[_0x95cb('0x44')](handleError(_0x5664f2,null));};exports[_0x95cb('0x4d')]=function(_0x37e385,_0x1b96f1){return db['ChatTransferReport'][_0x95cb('0x4d')]()[_0x95cb('0x26')](respondWithResult(_0x1b96f1,null))['catch'](handleError(_0x1b96f1,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index e0467c6..2a4e301 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 _0xe373=['define','report_chat_transfer','uniqueid','lodash','util','../../config/logger','api','path','rimraf','./chatTransferReport.attributes','exports'];(function(_0x263c22,_0x4cf32e){var _0x51f11c=function(_0x1bce74){while(--_0x1bce74){_0x263c22['push'](_0x263c22['shift']());}};_0x51f11c(++_0x4cf32e);}(_0xe373,0xc9));var _0x3e37=function(_0xfb358b,_0xda57fb){_0xfb358b=_0xfb358b-0x0;var _0x2ba9fd=_0xe373[_0xfb358b];return _0x2ba9fd;};'use strict';var _=require(_0x3e37('0x0'));var util=require(_0x3e37('0x1'));var logger=require(_0x3e37('0x2'))(_0x3e37('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3e37('0x4'));var rimraf=require(_0x3e37('0x5'));var config=require('../../config/environment');var attributes=require(_0x3e37('0x6'));module[_0x3e37('0x7')]=function(_0x2fea1f,_0xc4225a){return _0x2fea1f[_0x3e37('0x8')]('ChatTransferReport',attributes,{'tableName':_0x3e37('0x9'),'paranoid':![],'indexes':[{'name':_0x3e37('0xa'),'fields':[_0x3e37('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1a58=['ChatTransferReport','uniqueid','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatTransferReport.attributes','exports','define'];(function(_0x2bbc53,_0x7783c6){var _0x2a230b=function(_0x2b5bb7){while(--_0x2b5bb7){_0x2bbc53['push'](_0x2bbc53['shift']());}};_0x2a230b(++_0x7783c6);}(_0x1a58,0x1ca));var _0x81a5=function(_0x29e672,_0x290fa9){_0x29e672=_0x29e672-0x0;var _0x48f210=_0x1a58[_0x29e672];return _0x48f210;};'use strict';var _=require('lodash');var util=require(_0x81a5('0x0'));var logger=require('../../config/logger')(_0x81a5('0x1'));var moment=require(_0x81a5('0x2'));var BPromise=require(_0x81a5('0x3'));var rp=require(_0x81a5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x81a5('0x5'));var config=require(_0x81a5('0x6'));var attributes=require(_0x81a5('0x7'));module[_0x81a5('0x8')]=function(_0x5059f0,_0x2e08aa){return _0x5059f0[_0x81a5('0x9')](_0x81a5('0xa'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0x81a5('0xb'),'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 33cc195..ac64834 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 _0xcde9=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','randomstring','ioredis'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xcde9,0x10d));var _0x9cde=function(_0x4886bf,_0x450fc6){_0x4886bf=_0x4886bf-0x0;var _0x2a1fb5=_0xcde9[_0x4886bf];return _0x2a1fb5;};'use strict';var _=require(_0x9cde('0x0'));var util=require(_0x9cde('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9cde('0x2'));var fs=require('fs');var Redis=require(_0x9cde('0x3'));var db=require(_0x9cde('0x4'))['db'];var utils=require(_0x9cde('0x5'));var logger=require('../../config/logger')(_0x9cde('0x6'));var config=require(_0x9cde('0x7'));var jayson=require(_0x9cde('0x8'));var client=jayson[_0x9cde('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x29512c,_0x182969,_0x11500d){return new BPromise(function(_0x5d61f5,_0x210873){return client[_0x9cde('0xa')](_0x29512c,_0x11500d)[_0x9cde('0xb')](function(_0x1a7708){logger[_0x9cde('0xc')](_0x9cde('0xd'),_0x182969,_0x9cde('0xe'));logger['debug'](_0x9cde('0xf'),_0x182969,_0x9cde('0xe'),JSON[_0x9cde('0x10')](_0x1a7708));if(_0x1a7708['error']){if(_0x1a7708[_0x9cde('0x11')][_0x9cde('0x12')]===0x1f4){logger[_0x9cde('0x11')](_0x9cde('0xd'),_0x182969,_0x1a7708['error']['message']);return _0x210873(_0x1a7708[_0x9cde('0x11')][_0x9cde('0x13')]);}logger['error'](_0x9cde('0xd'),_0x182969,_0x1a7708[_0x9cde('0x11')][_0x9cde('0x13')]);return _0x5d61f5(_0x1a7708[_0x9cde('0x11')]['message']);}else{logger[_0x9cde('0xc')](_0x9cde('0xd'),_0x182969,'request\x20sent');_0x5d61f5(_0x1a7708['result'][_0x9cde('0x13')]);}})[_0x9cde('0x14')](function(_0x4a62eb){logger['error'](_0x9cde('0xd'),_0x182969,_0x4a62eb);_0x210873(_0x4a62eb);});});} \ No newline at end of file +var _0x0976=['error','code','ChatTransferReport,\x20%s,\x20%s','message','result','catch','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request\x20sent','debug'];(function(_0x30cfe2,_0x5c930f){var _0x411c38=function(_0x5f3472){while(--_0x5f3472){_0x30cfe2['push'](_0x30cfe2['shift']());}};_0x411c38(++_0x5c930f);}(_0x0976,0x126));var _0x6097=function(_0x3e12f2,_0x24f611){_0x3e12f2=_0x3e12f2-0x0;var _0x56b3f7=_0x0976[_0x3e12f2];return _0x56b3f7;};'use strict';var _=require('lodash');var util=require(_0x6097('0x0'));var moment=require('moment');var BPromise=require(_0x6097('0x1'));var rs=require(_0x6097('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6097('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x6097('0x4'))(_0x6097('0x5'));var config=require(_0x6097('0x6'));var jayson=require(_0x6097('0x7'));var client=jayson[_0x6097('0x8')][_0x6097('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2fb77e,_0x34a2c0,_0x2d4d41){return new BPromise(function(_0x154f7a,_0x23b244){return client['request'](_0x2fb77e,_0x2d4d41)['then'](function(_0x302d61){logger['info']('ChatTransferReport,\x20%s,\x20%s',_0x34a2c0,_0x6097('0xa'));logger[_0x6097('0xb')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x34a2c0,_0x6097('0xa'),JSON['stringify'](_0x302d61));if(_0x302d61[_0x6097('0xc')]){if(_0x302d61[_0x6097('0xc')][_0x6097('0xd')]===0x1f4){logger[_0x6097('0xc')](_0x6097('0xe'),_0x34a2c0,_0x302d61[_0x6097('0xc')][_0x6097('0xf')]);return _0x23b244(_0x302d61[_0x6097('0xc')][_0x6097('0xf')]);}logger[_0x6097('0xc')](_0x6097('0xe'),_0x34a2c0,_0x302d61['error']['message']);return _0x154f7a(_0x302d61[_0x6097('0xc')][_0x6097('0xf')]);}else{logger['info']('ChatTransferReport,\x20%s,\x20%s',_0x34a2c0,_0x6097('0xa'));_0x154f7a(_0x302d61[_0x6097('0x10')][_0x6097('0xf')]);}})[_0x6097('0x11')](function(_0x200406){logger[_0x6097('0xc')]('ChatTransferReport,\x20%s,\x20%s',_0x34a2c0,_0x200406);_0x23b244(_0x200406);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 1cc2671..e2f0dc2 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 _0x0a52=['/:id','show','post','create','update','delete','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x125ff8,_0x41925f){var _0x2d9ef=function(_0x4ef34c){while(--_0x4ef34c){_0x125ff8['push'](_0x125ff8['shift']());}};_0x2d9ef(++_0x41925f);}(_0x0a52,0x132));var _0x20a5=function(_0x5274eb,_0x510d9a){_0x5274eb=_0x5274eb-0x0;var _0x2ca2c0=_0x0a52[_0x5274eb];return _0x2ca2c0;};'use strict';var multer=require(_0x20a5('0x0'));var util=require(_0x20a5('0x1'));var path=require(_0x20a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x20a5('0x3'));var router=express[_0x20a5('0x4')]();var fs_extra=require(_0x20a5('0x5'));var auth=require(_0x20a5('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x20a5('0x7'));var controller=require(_0x20a5('0x8'));router[_0x20a5('0x9')]('/',auth[_0x20a5('0xa')](),controller[_0x20a5('0xb')]);router[_0x20a5('0x9')](_0x20a5('0xc'),auth[_0x20a5('0xa')](),controller[_0x20a5('0xd')]);router[_0x20a5('0x9')](_0x20a5('0xe'),auth[_0x20a5('0xa')](),controller[_0x20a5('0xf')]);router[_0x20a5('0x10')]('/',auth[_0x20a5('0xa')](),controller[_0x20a5('0x11')]);router['put'](_0x20a5('0xe'),auth['isAuthenticated'](),controller[_0x20a5('0x12')]);router[_0x20a5('0x13')](_0x20a5('0xe'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xe3d6=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','get','index','isAuthenticated','describe','/:id','show','put','update'];(function(_0x22bdd3,_0x552e50){var _0x44d9d9=function(_0x2b4ab9){while(--_0x2b4ab9){_0x22bdd3['push'](_0x22bdd3['shift']());}};_0x44d9d9(++_0x552e50);}(_0xe3d6,0x102));var _0x6e3d=function(_0x5b8da7,_0x48a3b8){_0x5b8da7=_0x5b8da7-0x0;var _0x49145e=_0xe3d6[_0x5b8da7];return _0x49145e;};'use strict';var multer=require(_0x6e3d('0x0'));var util=require(_0x6e3d('0x1'));var path=require(_0x6e3d('0x2'));var timeout=require(_0x6e3d('0x3'));var express=require(_0x6e3d('0x4'));var router=express[_0x6e3d('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./chatTransferReport.controller');router[_0x6e3d('0x6')]('/',auth['isAuthenticated'](),controller[_0x6e3d('0x7')]);router['get']('/describe',auth[_0x6e3d('0x8')](),controller[_0x6e3d('0x9')]);router['get'](_0x6e3d('0xa'),auth[_0x6e3d('0x8')](),controller[_0x6e3d('0xb')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x6e3d('0xc')]('/:id',auth[_0x6e3d('0x8')](),controller[_0x6e3d('0xd')]);router[_0x6e3d('0xe')](_0x6e3d('0xa'),auth['isAuthenticated'](),controller[_0x6e3d('0xf')]);module[_0x6e3d('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 276fc88..8c5b99b 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 _0x9f62=['Skip','Feedback','thumb','stringify','input','name','getDataValue','parse','setDataValue','onlineForm','textarea','Comments','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','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','CHAT','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','randomstring','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','ENUM','rounded','Send','Contact\x20us','BOOLEAN','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Thanks\x20you\x20for\x20your\x20time!'];(function(_0x1d9b96,_0x37ed54){var _0x562bea=function(_0x97a6bd){while(--_0x97a6bd){_0x1d9b96['push'](_0x1d9b96['shift']());}};_0x562bea(++_0x37ed54);}(_0x9f62,0x154));var _0x29f6=function(_0x5d7796,_0x1aa3bd){_0x5d7796=_0x5d7796-0x0;var _0x45a640=_0x9f62[_0x5d7796];return _0x45a640;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x29f6('0x0'));module['exports']={'name':{'type':Sequelize[_0x29f6('0x1')],'allowNull':![]},'address':{'type':Sequelize[_0x29f6('0x1')],'allowNull':![],'unique':_0x29f6('0x2')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0x29f6('0x3')},'mapKeyOffline':{'type':Sequelize[_0x29f6('0x1')],'defaultValue':_0x29f6('0x3')},'key':{'type':Sequelize[_0x29f6('0x1')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0x29f6('0x4')},'customerAlias':{'type':Sequelize[_0x29f6('0x1')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x29f6('0x1')],'allowNull':![],'defaultValue':_0x29f6('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x29f6('0x1')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x29f6('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x29f6('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x29f6('0x8')](_0x29f6('0x9'),'squared'),'defaultValue':_0x29f6('0x9')},'header_online':{'type':Sequelize[_0x29f6('0x1')],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x29f6('0xa')},'header_offline':{'type':Sequelize[_0x29f6('0x1')],'defaultValue':_0x29f6('0xb')},'download_transcript':{'type':Sequelize[_0x29f6('0xc')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x29f6('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x29f6('0x1')],'defaultValue':_0x29f6('0xd')},'defaultWhiteLabel':{'type':Sequelize[_0x29f6('0xc')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x29f6('0xe')]},'closingQuestion':{'type':Sequelize[_0x29f6('0x1')],'defaultValue':_0x29f6('0xf')},'formSubmitSuccessMessage':{'type':Sequelize[_0x29f6('0x1')],'defaultValue':_0x29f6('0x10')},'formSubmitFailureMessage':{'type':Sequelize[_0x29f6('0x1')],'defaultValue':_0x29f6('0x11')},'noteTitle':{'type':Sequelize[_0x29f6('0x1')],'defaultValue':_0x29f6('0x12')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0x29f6('0x1')],'defaultValue':_0x29f6('0x13')},'closingMessageButton':{'type':Sequelize[_0x29f6('0x1')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0x29f6('0x1')],'defaultValue':_0x29f6('0x14')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x29f6('0xc')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x29f6('0xc')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x29f6('0xc')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x29f6('0x1')],'defaultValue':_0x29f6('0x15')},'ratingType':{'type':Sequelize[_0x29f6('0x8')]('star',_0x29f6('0x16')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x29f6('0xe')],'defaultValue':function(){return JSON[_0x29f6('0x17')]({'items':[{'type':_0x29f6('0x18'),'variable':null,'config':{'placeholder':_0x29f6('0x19'),'type':'text','required':!![]},'props':{'title':_0x29f6('0x19'),'helpText':''}},{'type':'input','props':{'title':_0x29f6('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0x29f6('0x3'),'type':_0x29f6('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x29f6('0x1a')]('onlineForm')?JSON[_0x29f6('0x1b')](this[_0x29f6('0x1a')]('onlineForm')):{};},'set':function(_0x1401fb){return this[_0x29f6('0x1c')](_0x29f6('0x1d'),JSON[_0x29f6('0x17')](_0x1401fb));}},'offlineForm':{'type':Sequelize[_0x29f6('0xe')],'defaultValue':function(){return JSON[_0x29f6('0x17')]({'items':[{'type':_0x29f6('0x18'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x29f6('0x3'),'type':_0x29f6('0x3')},'variable':null},{'type':_0x29f6('0x1e'),'config':{'placeholder':_0x29f6('0x1f')},'props':{'title':_0x29f6('0x1f'),'helpText':_0x29f6('0x20')}}],'fromKey':0x0});},'get':function(){return this[_0x29f6('0x1a')](_0x29f6('0x21'))?JSON[_0x29f6('0x1b')](this[_0x29f6('0x1a')](_0x29f6('0x21'))):{};},'set':function(_0x1c3f0b){return this[_0x29f6('0x1c')](_0x29f6('0x21'),JSON[_0x29f6('0x17')](_0x1c3f0b));}},'token':{'type':Sequelize[_0x29f6('0x1')],'defaultValue':function(){return rs[_0x29f6('0x22')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x29f6('0xc')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize[_0x29f6('0xc')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x29f6('0x1')]},'waitingTitle':{'type':Sequelize[_0x29f6('0x1')],'defaultValue':_0x29f6('0x23')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0x29f6('0x1')],'defaultValue':_0x29f6('0x24')},'offlineMessageBody':{'type':Sequelize[_0x29f6('0x1')],'defaultValue':_0x29f6('0x25')},'enableUnmanagedNote':{'type':Sequelize[_0x29f6('0xc')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x29f6('0x1')],'defaultValue':_0x29f6('0x26')},'skipUnmanaged':{'type':Sequelize[_0x29f6('0x1')],'defaultValue':_0x29f6('0x14')},'sendUnmanaged':{'type':Sequelize[_0x29f6('0x1')],'defaultValue':_0x29f6('0xa')},'enableCustomerAttachment':{'type':Sequelize[_0x29f6('0xc')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x29f6('0xc')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x29f6('0xe')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x29f6('0xe')],'defaultValue':function(){return _0x29f6('0x27');}},'notificationSound':{'type':Sequelize[_0x29f6('0xc')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x29f6('0xc')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x29f6('0x1')],'defaultValue':_0x29f6('0x28')},'waitForTheAssignedAgent':{'type':Sequelize[_0x29f6('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x29f6('0x1')],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize[_0x29f6('0x7')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x29f6('0x1')],'defaultValue':_0x29f6('0x29')},'messagesAlignment':{'type':Sequelize[_0x29f6('0x1')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0x29f6('0x1')]},'customerAvatar':{'type':Sequelize[_0x29f6('0xe')]},'showCustomerAvatar':{'type':Sequelize[_0x29f6('0xc')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x29f6('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x29f6('0xc')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x29f6('0xc')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x29f6('0x1')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize[_0x29f6('0xe')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x29f6('0x7')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x29f6('0xc')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x3f3475){if(!_0x3f3475)this[_0x29f6('0x1c')]('mandatoryDispositionPauseId',null);this[_0x29f6('0x1c')](_0x29f6('0x2a'),_0x3f3475);}},'vidaooEscalation':{'type':Sequelize[_0x29f6('0xc')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x29f6('0x1')]},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x29f6('0x2b')},'vidaooNote':{'type':Sequelize[_0x29f6('0x1')],'defaultValue':function(){return _0x29f6('0x2c');}},'vidaooMetadata':{'type':Sequelize[_0x29f6('0xe')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x29f6('0xc')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x5b02=['Feedback','star','thumb','stringify','name','text','input','parse','getDataValue','onlineForm','setDataValue','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','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','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','email','#ffffff','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','INTEGER','Powered\x20by\x20xCALLY','TEXT','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Thanks\x20you\x20for\x20your\x20time!','Skip'];(function(_0x21775a,_0x57ef8b){var _0x564d8c=function(_0x3c25e4){while(--_0x3c25e4){_0x21775a['push'](_0x21775a['shift']());}};_0x564d8c(++_0x57ef8b);}(_0x5b02,0xe9));var _0x25b0=function(_0x369ead,_0x423c58){_0x369ead=_0x369ead-0x0;var _0x25bf0b=_0x5b02[_0x369ead];return _0x25bf0b;};'use strict';var Sequelize=require(_0x25b0('0x0'));var rs=require(_0x25b0('0x1'));module[_0x25b0('0x2')]={'name':{'type':Sequelize[_0x25b0('0x3')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0x25b0('0x3')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0x25b0('0x4')},'mapKeyOffline':{'type':Sequelize[_0x25b0('0x3')],'defaultValue':_0x25b0('0x4')},'key':{'type':Sequelize[_0x25b0('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x25b0('0x3')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0x25b0('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x25b0('0x3')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x25b0('0x3')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x25b0('0x5'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x25b0('0x3')],'allowNull':![],'defaultValue':_0x25b0('0x5'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0x25b0('0x3')]},'animation':{'type':Sequelize[_0x25b0('0x6')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x25b0('0x7')](_0x25b0('0x8'),_0x25b0('0x9')),'defaultValue':_0x25b0('0x8')},'header_online':{'type':Sequelize[_0x25b0('0x3')],'defaultValue':_0x25b0('0xa')},'start_chat_button':{'type':Sequelize[_0x25b0('0x3')],'defaultValue':_0x25b0('0xb')},'offline_chat_button':{'type':Sequelize[_0x25b0('0x3')],'defaultValue':_0x25b0('0xc')},'header_offline':{'type':Sequelize[_0x25b0('0x3')],'defaultValue':_0x25b0('0xd')},'download_transcript':{'type':Sequelize[_0x25b0('0x6')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x25b0('0xe')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x25b0('0x3')],'defaultValue':_0x25b0('0xf')},'defaultWhiteLabel':{'type':Sequelize[_0x25b0('0x6')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x25b0('0x10')]},'closingQuestion':{'type':Sequelize[_0x25b0('0x3')],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0x25b0('0x11')},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':_0x25b0('0x12')},'noteTitle':{'type':Sequelize[_0x25b0('0x3')],'defaultValue':_0x25b0('0x13')},'placeholderMessage':{'type':Sequelize[_0x25b0('0x3')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0x25b0('0x3')],'defaultValue':_0x25b0('0x14')},'closingMessageButton':{'type':Sequelize[_0x25b0('0x3')],'defaultValue':_0x25b0('0xc')},'skipMessageButton':{'type':Sequelize[_0x25b0('0x3')],'defaultValue':_0x25b0('0x15')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x25b0('0x6')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x25b0('0x6')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x25b0('0x6')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x25b0('0x3')],'defaultValue':_0x25b0('0x16')},'ratingType':{'type':Sequelize[_0x25b0('0x7')](_0x25b0('0x17'),_0x25b0('0x18')),'defaultValue':_0x25b0('0x17')},'ratingStarsNumber':{'type':Sequelize[_0x25b0('0xe')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x25b0('0x10')],'defaultValue':function(){return JSON[_0x25b0('0x19')]({'items':[{'type':'input','variable':null,'config':{'placeholder':_0x25b0('0x1a'),'type':_0x25b0('0x1b'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':_0x25b0('0x1c'),'props':{'title':_0x25b0('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x25b0('0x4'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue']('onlineForm')?JSON[_0x25b0('0x1d')](this[_0x25b0('0x1e')](_0x25b0('0x1f'))):{};},'set':function(_0x24f847){return this[_0x25b0('0x20')](_0x25b0('0x1f'),JSON[_0x25b0('0x19')](_0x24f847));}},'offlineForm':{'type':Sequelize[_0x25b0('0x10')],'defaultValue':function(){return JSON[_0x25b0('0x19')]({'items':[{'type':'input','props':{'title':_0x25b0('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x25b0('0x4'),'type':'email'},'variable':null},{'type':'textarea','config':{'placeholder':'Comments'},'props':{'title':_0x25b0('0x21'),'helpText':_0x25b0('0x22')}}],'fromKey':0x0});},'get':function(){return this[_0x25b0('0x1e')](_0x25b0('0x23'))?JSON[_0x25b0('0x1d')](this[_0x25b0('0x1e')](_0x25b0('0x23'))):{};},'set':function(_0x227287){return this[_0x25b0('0x20')](_0x25b0('0x23'),JSON[_0x25b0('0x19')](_0x227287));}},'token':{'type':Sequelize[_0x25b0('0x3')],'defaultValue':function(){return rs[_0x25b0('0x24')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x25b0('0x6')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x25b0('0x3')]},'waitingTitle':{'type':Sequelize[_0x25b0('0x3')],'defaultValue':_0x25b0('0x25')},'waitingMessage':{'type':Sequelize[_0x25b0('0x3')],'defaultValue':_0x25b0('0x26')},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':_0x25b0('0x27')},'offlineMessageBody':{'type':Sequelize[_0x25b0('0x3')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0x25b0('0x6')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x25b0('0x3')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0x25b0('0x3')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize[_0x25b0('0x3')],'defaultValue':_0x25b0('0xc')},'enableCustomerAttachment':{'type':Sequelize[_0x25b0('0x6')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x25b0('0x6')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x25b0('0x10')]},'showAgentAvatar':{'type':Sequelize[_0x25b0('0x6')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x25b0('0x3')]},'notificationTemplate':{'type':Sequelize[_0x25b0('0x10')],'defaultValue':function(){return _0x25b0('0x28');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x25b0('0x6')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x25b0('0x6')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x25b0('0x3')],'defaultValue':_0x25b0('0x29')},'waitForTheAssignedAgent':{'type':Sequelize[_0x25b0('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x25b0('0x3')],'defaultValue':_0x25b0('0x2a')},'verticalAlignment':{'type':Sequelize[_0x25b0('0xe')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x25b0('0x3')],'defaultValue':_0x25b0('0x2b')},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x25b0('0x2c')},'defaultTitle':{'type':Sequelize[_0x25b0('0x3')]},'customerAvatar':{'type':Sequelize[_0x25b0('0x10')]},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x25b0('0xe')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x25b0('0x3')],'allowNull':![],'defaultValue':_0x25b0('0x2d'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x25b0('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x25b0('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x25b0('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x25b0('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x25b0('0x3')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x25b0('0xe')],'comment':_0x25b0('0x2e')},'mandatoryDisposition':{'type':Sequelize[_0x25b0('0x6')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x9c6ab4){if(!_0x9c6ab4)this['setDataValue'](_0x25b0('0x2f'),null);this[_0x25b0('0x20')](_0x25b0('0x30'),_0x9c6ab4);}},'vidaooEscalation':{'type':Sequelize[_0x25b0('0x6')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x25b0('0x3')]},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x25b0('0x31')},'vidaooNote':{'type':Sequelize[_0x25b0('0x3')],'defaultValue':function(){return _0x25b0('0x32');}},'vidaooMetadata':{'type':Sequelize[_0x25b0('0x10')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x25b0('0x6')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index cfc8a77..1edc066 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 _0xdfdf=['headers','user-agent','chat','CmContact','difference','createdAt','updatedAt','ListId','from','Sequelize','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','Contacts','DESC','ChatApplication','Applications','account','applications','list','orderBy','priority','contact','customerIp','x-forwarded-for','first','split','firstName','lastName','x-real-port','referer','browser','version','format','unknown','%s\x20%s','device','vendor','%s\x20%s\x20%s','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','messageId','created','push','close','unmanaged','ChatMessage','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','Start','startRouting','EventManager','notify','offline','files','no\x20available\x20attributes','CompanyId','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','CmList','findOrCreate','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','fromString','server','attachments','offline-chat','basename','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','MailAccount','MailServerOut','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions','SendMail','email','offlineMessageSubject','MailAccountId','mimetype','subjectOffline','mapValues','Chat','NotifyMailAccount','notifyMail','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','getInteractions','Owner','fullname','internal','Tags','color','tag','Command','timezone','iftime\x20%s','interval','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','inspect','No\x20timezone','Interval','Intervals','../../config/license/util','getLicense','virtual','License','increment','chatLicenseExceeded','all','some','readFileSync','server/files/chat/iframe.ejs','address','origin','3.1.0','remote','x-real-ip','connection','remoteAddress','replace','alignment','verticalAlignment','labelText','textColor','textButtonColor','color_button','backgroundColor','hideWhenOffline','addApplications','ISOLATION_LEVELS','READ_COMMITTED','finally','getApplications','omit','getProactiveActions','ChatProactiveAction','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','ChatOfflineMessage','Contact','Attachments','addAgents','removeAgents','isArray','emit','getAgents','mustache','path','ejs','fs-extra','lodash','querystring','ioredis','../../config/logger','../../config/environment','url','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','html-to-text','jayson/promise','client','http','request','info','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','ChatWebsite,\x20%s,\x20%s','message','error','result','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','update','then','destroy','get','ChatWebsites','UserProfileResource','stack','name','send','index','Pause','map','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','options','ChatWebsite','includeAll','findAll','rows','catch','show','mandatoryDispositionPause','include','create','user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','rawAttributes','order','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','addLogo','file','addAvatar','agentAvatar','filename','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','root','server/files/images/logos/default_logo.svg','custom','isNil','sitepic','existsSync','join','server/files/images/logos/','getAvatar','server/files/images/avatars/','download','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','server/files/images/avatars/system_avatar.png','user-agent-parser','setUA'];(function(_0x1881cd,_0x3b1e96){var _0x549812=function(_0x6d0ee){while(--_0x6d0ee){_0x1881cd['push'](_0x1881cd['shift']());}};_0x549812(++_0x3b1e96);}(_0xdfdf,0x1e0));var _0xfdfd=function(_0x6aebf,_0xbf7ebc){_0x6aebf=_0x6aebf-0x0;var _0x362e4e=_0xdfdf[_0x6aebf];return _0x362e4e;};'use strict';var BPromise=require('bluebird');var Mustache=require(_0xfdfd('0x0'));var util=require('util');var path=require(_0xfdfd('0x1'));var ejs=require(_0xfdfd('0x2'));var fs=require('fs');var fs_extra=require(_0xfdfd('0x3'));var _=require(_0xfdfd('0x4'));var querystring=require(_0xfdfd('0x5'));var Redis=require(_0xfdfd('0x6'));var qs=require('../../components/parsers/qs');var logger=require(_0xfdfd('0x7'))('api');var config=require(_0xfdfd('0x8'));var url=require(_0xfdfd('0x9'));var db=require('../../mysqldb')['db'];config[_0xfdfd('0xa')]=_[_0xfdfd('0xb')](config['redis'],{'host':_0xfdfd('0xc'),'port':0x18eb});var socket=require(_0xfdfd('0xd'))(new Redis(config[_0xfdfd('0xa')]));require(_0xfdfd('0xe'))[_0xfdfd('0xf')](socket);var htmlToText=require(_0xfdfd('0x10'));var jayson=require(_0xfdfd('0x11'));var client=jayson[_0xfdfd('0x12')][_0xfdfd('0x13')]({'port':0x232c});var client9002=jayson[_0xfdfd('0x12')]['http']({'port':0x232a});var client9003=jayson[_0xfdfd('0x12')][_0xfdfd('0x13')]({'port':0x232b});var client9001=jayson[_0xfdfd('0x12')][_0xfdfd('0x13')]({'port':0x2329});function respondWithRpcPromise(_0x4952af,_0x1f75e6,_0x3db2a8,_0x38265d){return new BPromise(function(_0x4d9ae9,_0x19b7ef){var _0x16be1d=_0x38265d||client;return _0x16be1d[_0xfdfd('0x14')](_0x4952af,_0x3db2a8)['then'](function(_0x485a4b){logger[_0xfdfd('0x15')]('ChatWebsite,\x20%s,\x20%s',_0x1f75e6,'request\x20sent');logger[_0xfdfd('0x16')](_0xfdfd('0x17'),_0x1f75e6,'request\x20sent',JSON[_0xfdfd('0x18')](_0x485a4b));if(_0x485a4b['error']){if(_0x485a4b['error']['code']===0x1f4){logger['error'](_0xfdfd('0x19'),_0x1f75e6,_0x485a4b['error'][_0xfdfd('0x1a')]);return _0x19b7ef(_0x485a4b[_0xfdfd('0x1b')]['message']);}logger[_0xfdfd('0x1b')](_0xfdfd('0x19'),_0x1f75e6,_0x485a4b[_0xfdfd('0x1b')]['message']);return _0x4d9ae9(_0x485a4b['error'][_0xfdfd('0x1a')]);}else{logger[_0xfdfd('0x15')](_0xfdfd('0x19'),_0x1f75e6,'request\x20sent');_0x4d9ae9(_0x485a4b[_0xfdfd('0x1c')]['message']);}})['catch'](function(_0x4ebdaf){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x1f75e6,_0x4ebdaf);_0x19b7ef(_0x4ebdaf);});});}function respondWithStatusCode(_0x5214f0,_0x5998a6){_0x5998a6=_0x5998a6||0xcc;return function(_0x73cde9){if(_0x73cde9){return _0x5214f0[_0xfdfd('0x1d')](_0x5998a6);}return _0x5214f0[_0xfdfd('0x1e')](_0x5998a6)[_0xfdfd('0x1f')]();};}function respondWithResult(_0x162593,_0x16bd58){_0x16bd58=_0x16bd58||0xc8;return function(_0xd73093){if(_0xd73093){return _0x162593[_0xfdfd('0x1e')](_0x16bd58)[_0xfdfd('0x20')](_0xd73093);}};}function respondWithFilteredResult(_0x1363d0,_0x54958f){return function(_0x144e0b){if(_0x144e0b){var _0x52a7bb=typeof _0x54958f[_0xfdfd('0x21')]===_0xfdfd('0x22')&&typeof _0x54958f[_0xfdfd('0x23')]===_0xfdfd('0x22');var _0x87a69c=_0x144e0b[_0xfdfd('0x24')];var _0x2a0789=_0x52a7bb?0x0:_0x54958f[_0xfdfd('0x21')];var _0x4a396a=_0x52a7bb?_0x144e0b[_0xfdfd('0x24')]:_0x54958f['offset']+_0x54958f['limit'];var _0x4afe43;if(_0x4a396a>=_0x87a69c){_0x4a396a=_0x87a69c;_0x4afe43=0xc8;}else{_0x4afe43=0xce;}_0x1363d0['status'](_0x4afe43);return _0x1363d0['set'](_0xfdfd('0x25'),_0x2a0789+'-'+_0x4a396a+'/'+_0x87a69c)[_0xfdfd('0x20')](_0x144e0b);}return null;};}function saveUpdates(_0x107af8){return function(_0x2de3ee){if(_0x2de3ee){return _0x2de3ee[_0xfdfd('0x26')](_0x107af8)[_0xfdfd('0x27')](function(_0x1a1f38){return _0x1a1f38;});}return null;};}function removeEntity(_0x5016ac){return function(_0x11aef2){if(_0x11aef2){return _0x11aef2[_0xfdfd('0x28')]()[_0xfdfd('0x27')](function(){var _0x3e9758=_0x11aef2[_0xfdfd('0x29')]({'plain':!![]});var _0x303fc0=_0xfdfd('0x2a');return db[_0xfdfd('0x2b')]['destroy']({'where':{'type':_0x303fc0,'resourceId':_0x3e9758['id']}})[_0xfdfd('0x27')](function(){return _0x11aef2;});})['then'](function(){_0x5016ac[_0xfdfd('0x1e')](0xcc)[_0xfdfd('0x1f')]();});}};}function handleEntityNotFound(_0x40631c){return function(_0x2f223a){if(!_0x2f223a){_0x40631c[_0xfdfd('0x1d')](0x194);}return _0x2f223a;};}function handleError(_0x2d90b4,_0x23c83d){_0x23c83d=_0x23c83d||0x1f4;return function(_0x3a5b2e){logger[_0xfdfd('0x1b')](_0x3a5b2e[_0xfdfd('0x2c')]);if(_0x3a5b2e[_0xfdfd('0x2d')]){delete _0x3a5b2e['name'];}_0x2d90b4['status'](_0x23c83d)[_0xfdfd('0x2e')](_0x3a5b2e);};}exports[_0xfdfd('0x2f')]=function(_0x5d311a,_0x5d1285){var _0x4acd3e={'include':[{'model':db[_0xfdfd('0x30')],'as':'mandatoryDispositionPause'}]},_0x247a09={},_0x282e9a={'count':0x0,'rows':[]};var _0x4e4bc5=_[_0xfdfd('0x31')](db['ChatWebsite']['rawAttributes'],function(_0xb9cd83){return{'name':_0xb9cd83[_0xfdfd('0x32')],'type':_0xb9cd83[_0xfdfd('0x33')][_0xfdfd('0x34')]};});_0x247a09[_0xfdfd('0x35')]=_[_0xfdfd('0x31')](_0x4e4bc5,'name');_0x247a09[_0xfdfd('0x36')]=_[_0xfdfd('0x37')](_0x5d311a[_0xfdfd('0x36')]);_0x247a09['filters']=_[_0xfdfd('0x38')](_0x247a09[_0xfdfd('0x35')],_0x247a09[_0xfdfd('0x36')]);_0x4acd3e[_0xfdfd('0x39')]=_[_0xfdfd('0x38')](_0x247a09['model'],qs['fields'](_0x5d311a['query'][_0xfdfd('0x3a')]));_0x4acd3e[_0xfdfd('0x39')]=_0x4acd3e[_0xfdfd('0x39')][_0xfdfd('0x3b')]?_0x4acd3e[_0xfdfd('0x39')]:_0x247a09[_0xfdfd('0x35')];if(!_0x5d311a['query'][_0xfdfd('0x3c')](_0xfdfd('0x3d'))){_0x4acd3e['limit']=qs[_0xfdfd('0x23')](_0x5d311a[_0xfdfd('0x36')][_0xfdfd('0x23')]);_0x4acd3e[_0xfdfd('0x21')]=qs['offset'](_0x5d311a[_0xfdfd('0x36')][_0xfdfd('0x21')]);}_0x4acd3e['order']=qs['sort'](_0x5d311a['query'][_0xfdfd('0x3e')]);_0x4acd3e['where']=qs[_0xfdfd('0x3f')](_[_0xfdfd('0x40')](_0x5d311a[_0xfdfd('0x36')],_0x247a09['filters']),_0x4e4bc5);if(_0x5d311a[_0xfdfd('0x36')][_0xfdfd('0x41')]){_0x4acd3e[_0xfdfd('0x42')]=_[_0xfdfd('0x43')](_0x4acd3e[_0xfdfd('0x42')],{'$or':_[_0xfdfd('0x31')](_0x4e4bc5,function(_0x3ebe64){if(_0x3ebe64['type']!==_0xfdfd('0x44')){var _0x5c4959={};_0x5c4959[_0x3ebe64[_0xfdfd('0x2d')]]={'$like':'%'+_0x5d311a[_0xfdfd('0x36')]['filter']+'%'};return _0x5c4959;}})});}_0x4acd3e=_[_0xfdfd('0x43')]({},_0x4acd3e,_0x5d311a[_0xfdfd('0x45')]);var _0x56e165={'where':_0x4acd3e['where']};return db[_0xfdfd('0x46')][_0xfdfd('0x24')](_0x56e165)[_0xfdfd('0x27')](function(_0x3e65b8){_0x282e9a[_0xfdfd('0x24')]=_0x3e65b8;if(_0x5d311a[_0xfdfd('0x36')][_0xfdfd('0x47')]){_0x4acd3e['include']=[{'all':!![]}];}return db[_0xfdfd('0x46')][_0xfdfd('0x48')](_0x4acd3e);})[_0xfdfd('0x27')](function(_0x4476f3){_0x282e9a[_0xfdfd('0x49')]=_0x4476f3;return _0x282e9a;})['then'](respondWithFilteredResult(_0x5d1285,_0x4acd3e))[_0xfdfd('0x4a')](handleError(_0x5d1285,null));};exports[_0xfdfd('0x4b')]=function(_0x3b7cf3,_0x427356){var _0x27269b={'raw':![],'where':{'id':_0x3b7cf3['params']['id']},'include':[{'model':db[_0xfdfd('0x30')],'as':_0xfdfd('0x4c')}]},_0x5c0e59={};_0x5c0e59[_0xfdfd('0x35')]=_[_0xfdfd('0x37')](db['ChatWebsite']['rawAttributes']);_0x5c0e59[_0xfdfd('0x36')]=_[_0xfdfd('0x37')](_0x3b7cf3[_0xfdfd('0x36')]);_0x5c0e59[_0xfdfd('0x3f')]=_[_0xfdfd('0x38')](_0x5c0e59['model'],_0x5c0e59['query']);_0x27269b[_0xfdfd('0x39')]=_['intersection'](_0x5c0e59[_0xfdfd('0x35')],qs['fields'](_0x3b7cf3[_0xfdfd('0x36')]['fields']));_0x27269b[_0xfdfd('0x39')]=_0x27269b[_0xfdfd('0x39')][_0xfdfd('0x3b')]?_0x27269b[_0xfdfd('0x39')]:_0x5c0e59['model'];if(_0x3b7cf3[_0xfdfd('0x36')][_0xfdfd('0x47')]){_0x27269b[_0xfdfd('0x4d')]=[{'all':!![]}];}_0x27269b=_[_0xfdfd('0x43')]({},_0x27269b,_0x3b7cf3[_0xfdfd('0x45')]);return db['ChatWebsite']['find'](_0x27269b)[_0xfdfd('0x27')](handleEntityNotFound(_0x427356,null))[_0xfdfd('0x27')](respondWithResult(_0x427356,null))['catch'](handleError(_0x427356,null));};exports[_0xfdfd('0x4e')]=function(_0x304bcc,_0x30f1fa){return db[_0xfdfd('0x46')][_0xfdfd('0x4e')](_0x304bcc['body'],{})[_0xfdfd('0x27')](function(_0x4eaf9d){var _0x427751=_0x304bcc[_0xfdfd('0x4f')]['get']({'plain':!![]});if(!_0x427751)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x427751[_0xfdfd('0x50')]===_0xfdfd('0x4f')){var _0x7355a7=_0x4eaf9d[_0xfdfd('0x29')]({'plain':!![]});var _0xec2e3=_0xfdfd('0x2a');return db['UserProfileSection'][_0xfdfd('0x51')]({'where':{'name':_0xec2e3,'userProfileId':_0x427751[_0xfdfd('0x52')]},'raw':!![]})[_0xfdfd('0x27')](function(_0x1314db){if(_0x1314db&&_0x1314db[_0xfdfd('0x53')]===0x0){return db[_0xfdfd('0x2b')]['create']({'name':_0x7355a7['name'],'resourceId':_0x7355a7['id'],'type':_0x1314db[_0xfdfd('0x2d')],'sectionId':_0x1314db['id']},{})[_0xfdfd('0x27')](function(){return _0x4eaf9d;});}else{return _0x4eaf9d;}})['catch'](function(_0x479a43){logger[_0xfdfd('0x1b')](_0xfdfd('0x54'),_0x479a43);throw _0x479a43;});}return _0x4eaf9d;})[_0xfdfd('0x27')](respondWithResult(_0x30f1fa,0xc9))[_0xfdfd('0x4a')](handleError(_0x30f1fa,null));};exports[_0xfdfd('0x26')]=function(_0x13d89f,_0x2774fc){if(_0x13d89f[_0xfdfd('0x55')]['id']){delete _0x13d89f[_0xfdfd('0x55')]['id'];}return db['ChatWebsite'][_0xfdfd('0x51')]({'where':{'id':_0x13d89f[_0xfdfd('0x56')]['id']},'include':[{'model':db[_0xfdfd('0x30')],'as':_0xfdfd('0x4c')}]})[_0xfdfd('0x27')](handleEntityNotFound(_0x2774fc,null))['then'](saveUpdates(_0x13d89f[_0xfdfd('0x55')],null))[_0xfdfd('0x27')](respondWithResult(_0x2774fc,null))[_0xfdfd('0x4a')](handleError(_0x2774fc,null));};exports['destroy']=function(_0x498ca1,_0x49fd7d){return db['ChatWebsite'][_0xfdfd('0x51')]({'where':{'id':_0x498ca1[_0xfdfd('0x56')]['id']}})['then'](handleEntityNotFound(_0x49fd7d,null))[_0xfdfd('0x27')](removeEntity(_0x49fd7d,null))[_0xfdfd('0x4a')](handleError(_0x49fd7d,null));};exports['describe']=function(_0x5cc6b5,_0x23ae53){return db['ChatWebsite'][_0xfdfd('0x57')]()['then'](respondWithResult(_0x23ae53,null))[_0xfdfd('0x4a')](handleError(_0x23ae53,null));};exports[_0xfdfd('0x58')]=function(_0x283b50,_0x34de54){if(_0x283b50[_0xfdfd('0x55')]['id']){delete _0x283b50['body']['id'];}return db['ChatWebsite'][_0xfdfd('0x51')]({'where':{'id':_0x283b50['params']['id']}})[_0xfdfd('0x27')](handleEntityNotFound(_0x34de54,null))[_0xfdfd('0x27')](function(_0x3a1ee8){if(_0x3a1ee8){_0x283b50[_0xfdfd('0x55')][_0xfdfd('0x59')]=_0x3a1ee8['id'];return db[_0xfdfd('0x5a')][_0xfdfd('0x4e')](_0x283b50['body']);}})['then'](respondWithResult(_0x34de54,null))[_0xfdfd('0x4a')](handleError(_0x34de54,null));};exports[_0xfdfd('0x5b')]=function(_0x435c03,_0x57b75c){var _0x470d43={'raw':![],'where':{}};var _0x58f2df={};var _0xc1650a={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xfdfd('0x5c')]({'where':{'id':_0x435c03[_0xfdfd('0x56')]['id']}})['then'](handleEntityNotFound(_0x57b75c,null))[_0xfdfd('0x27')](function(_0x18c0a7){if(_0x18c0a7){_0x58f2df[_0xfdfd('0x35')]=_[_0xfdfd('0x37')](db[_0xfdfd('0x5a')][_0xfdfd('0x5d')]);_0x58f2df[_0xfdfd('0x36')]=_[_0xfdfd('0x37')](_0x435c03[_0xfdfd('0x36')]);_0x58f2df['filters']=_[_0xfdfd('0x38')](_0x58f2df[_0xfdfd('0x35')],_0x58f2df['query']);_0x470d43[_0xfdfd('0x39')]=_[_0xfdfd('0x38')](_0x58f2df[_0xfdfd('0x35')],qs['fields'](_0x435c03['query'][_0xfdfd('0x3a')]));_0x470d43['attributes']=_0x470d43[_0xfdfd('0x39')][_0xfdfd('0x3b')]?_0x470d43['attributes']:_0x58f2df['model'];if(!_0x435c03['query']['hasOwnProperty'](_0xfdfd('0x3d'))){_0x470d43['limit']=qs['limit'](_0x435c03[_0xfdfd('0x36')][_0xfdfd('0x23')]);_0x470d43[_0xfdfd('0x21')]=qs[_0xfdfd('0x21')](_0x435c03[_0xfdfd('0x36')][_0xfdfd('0x21')]);}_0x470d43[_0xfdfd('0x5e')]=qs[_0xfdfd('0x3e')](_0x435c03['query'][_0xfdfd('0x3e')]);_0x470d43[_0xfdfd('0x42')]=qs['filters'](_[_0xfdfd('0x40')](_0x435c03[_0xfdfd('0x36')],_0x58f2df[_0xfdfd('0x3f')]));_0x470d43['where'][_0xfdfd('0x59')]=_0x18c0a7['id'];if(_0x435c03[_0xfdfd('0x36')][_0xfdfd('0x41')]){_0x470d43['where']=_[_0xfdfd('0x43')](_0x470d43[_0xfdfd('0x42')],{'$or':_[_0xfdfd('0x31')](_0x470d43[_0xfdfd('0x39')],function(_0xef4892){var _0xfedcad={};_0xfedcad[_0xef4892]={'$like':'%'+_0x435c03[_0xfdfd('0x36')][_0xfdfd('0x41')]+'%'};return _0xfedcad;})});}_0x470d43=_[_0xfdfd('0x43')]({},_0x470d43,_0x435c03[_0xfdfd('0x45')]);return db[_0xfdfd('0x5a')]['count']({'where':_0x470d43[_0xfdfd('0x42')]})[_0xfdfd('0x27')](function(_0x283e94){_0xc1650a[_0xfdfd('0x24')]=_0x283e94;if(_0x435c03['query'][_0xfdfd('0x47')]){_0x470d43[_0xfdfd('0x4d')]=[{'all':!![]}];}return db['Disposition'][_0xfdfd('0x48')](_0x470d43);})['then'](function(_0x1a30bc){_0xc1650a[_0xfdfd('0x49')]=_0x1a30bc;return _0xc1650a;});}})['then'](respondWithFilteredResult(_0x57b75c,_0x470d43))['catch'](handleError(_0x57b75c,null));};exports[_0xfdfd('0x5f')]=function(_0x25e527,_0x810511){return db[_0xfdfd('0x46')][_0xfdfd('0x51')]({'where':{'id':_0x25e527[_0xfdfd('0x56')]['id']}})[_0xfdfd('0x27')](handleEntityNotFound(_0x810511,null))[_0xfdfd('0x27')](function(_0x5e0609){if(_0x5e0609){return _0x5e0609[_0xfdfd('0x5f')](_0x25e527[_0xfdfd('0x36')]['ids']);}})[_0xfdfd('0x27')](respondWithStatusCode(_0x810511,null))[_0xfdfd('0x4a')](handleError(_0x810511,null));};exports[_0xfdfd('0x60')]=function(_0x29e30f,_0x416a52){if(_0x29e30f[_0xfdfd('0x55')]['id']){delete _0x29e30f[_0xfdfd('0x55')]['id'];}return db[_0xfdfd('0x46')]['find']({'where':{'id':_0x29e30f['params']['id']}})[_0xfdfd('0x27')](handleEntityNotFound(_0x416a52,null))[_0xfdfd('0x27')](function(_0x9675d3){if(_0x9675d3){_0x29e30f['body'][_0xfdfd('0x59')]=_0x9675d3['id'];return db[_0xfdfd('0x61')][_0xfdfd('0x4e')](_0x29e30f[_0xfdfd('0x55')]);}})[_0xfdfd('0x27')](respondWithResult(_0x416a52,null))['catch'](handleError(_0x416a52,null));};exports[_0xfdfd('0x62')]=function(_0xe724c3,_0x3e8e69){var _0x1d7ef3={'raw':![],'where':{}};var _0x2c5979={};var _0x4a581b={'count':0x0,'rows':[]};return db[_0xfdfd('0x46')][_0xfdfd('0x5c')]({'where':{'id':_0xe724c3[_0xfdfd('0x56')]['id']}})['then'](handleEntityNotFound(_0x3e8e69,null))[_0xfdfd('0x27')](function(_0x494c9f){if(_0x494c9f){_0x2c5979['model']=_[_0xfdfd('0x37')](db[_0xfdfd('0x61')]['rawAttributes']);_0x2c5979[_0xfdfd('0x36')]=_[_0xfdfd('0x37')](_0xe724c3[_0xfdfd('0x36')]);_0x2c5979[_0xfdfd('0x3f')]=_[_0xfdfd('0x38')](_0x2c5979[_0xfdfd('0x35')],_0x2c5979['query']);_0x1d7ef3[_0xfdfd('0x39')]=_['intersection'](_0x2c5979[_0xfdfd('0x35')],qs['fields'](_0xe724c3[_0xfdfd('0x36')][_0xfdfd('0x3a')]));_0x1d7ef3[_0xfdfd('0x39')]=_0x1d7ef3[_0xfdfd('0x39')]['length']?_0x1d7ef3['attributes']:_0x2c5979['model'];if(!_0xe724c3[_0xfdfd('0x36')][_0xfdfd('0x3c')]('nolimit')){_0x1d7ef3[_0xfdfd('0x23')]=qs['limit'](_0xe724c3['query']['limit']);_0x1d7ef3[_0xfdfd('0x21')]=qs[_0xfdfd('0x21')](_0xe724c3['query']['offset']);}_0x1d7ef3[_0xfdfd('0x5e')]=qs[_0xfdfd('0x3e')](_0xe724c3[_0xfdfd('0x36')][_0xfdfd('0x3e')]);_0x1d7ef3[_0xfdfd('0x42')]=qs[_0xfdfd('0x3f')](_['pick'](_0xe724c3[_0xfdfd('0x36')],_0x2c5979[_0xfdfd('0x3f')]));_0x1d7ef3[_0xfdfd('0x42')]['ChatWebsiteId']=_0x494c9f['id'];if(_0xe724c3[_0xfdfd('0x36')][_0xfdfd('0x41')]){_0x1d7ef3[_0xfdfd('0x42')]=_[_0xfdfd('0x43')](_0x1d7ef3[_0xfdfd('0x42')],{'$or':_[_0xfdfd('0x31')](_0x1d7ef3['attributes'],function(_0x373239){var _0xd8a3f8={};_0xd8a3f8[_0x373239]={'$like':'%'+_0xe724c3[_0xfdfd('0x36')]['filter']+'%'};return _0xd8a3f8;})});}_0x1d7ef3=_[_0xfdfd('0x43')]({},_0x1d7ef3,_0xe724c3[_0xfdfd('0x45')]);return db[_0xfdfd('0x61')][_0xfdfd('0x24')]({'where':_0x1d7ef3[_0xfdfd('0x42')]})[_0xfdfd('0x27')](function(_0x5798ba){_0x4a581b[_0xfdfd('0x24')]=_0x5798ba;if(_0xe724c3['query'][_0xfdfd('0x47')]){_0x1d7ef3['include']=[{'all':!![]}];}return db[_0xfdfd('0x61')]['findAll'](_0x1d7ef3);})[_0xfdfd('0x27')](function(_0x580bfa){_0x4a581b[_0xfdfd('0x49')]=_0x580bfa;return _0x4a581b;});}})['then'](respondWithFilteredResult(_0x3e8e69,_0x1d7ef3))['catch'](handleError(_0x3e8e69,null));};exports[_0xfdfd('0x63')]=function(_0xc7fa98,_0x3e81f6){return db[_0xfdfd('0x46')]['find']({'where':{'id':_0xc7fa98[_0xfdfd('0x56')]['id']}})[_0xfdfd('0x27')](handleEntityNotFound(_0x3e81f6,null))[_0xfdfd('0x27')](function(_0x2081d2){if(_0x2081d2){return _0x2081d2[_0xfdfd('0x63')](_0xc7fa98[_0xfdfd('0x36')][_0xfdfd('0x64')]);}})[_0xfdfd('0x27')](respondWithStatusCode(_0x3e81f6,null))['catch'](handleError(_0x3e81f6,null));};exports[_0xfdfd('0x65')]=function(_0x18a252,_0x123273){_0x18a252[_0xfdfd('0x55')]['sitepic']=_0x18a252[_0xfdfd('0x66')]['filename'];return db[_0xfdfd('0x46')][_0xfdfd('0x51')]({'where':{'id':_0x18a252[_0xfdfd('0x56')]['id']}})[_0xfdfd('0x27')](handleEntityNotFound(_0x123273,null))['then'](saveUpdates(_0x18a252[_0xfdfd('0x55')],null))[_0xfdfd('0x27')](respondWithResult(_0x123273,null))[_0xfdfd('0x4a')](handleError(_0x123273,null));};exports[_0xfdfd('0x67')]=function(_0x498050,_0x2d3256){_0x498050[_0xfdfd('0x55')][_0xfdfd('0x68')]=_0x498050[_0xfdfd('0x66')][_0xfdfd('0x69')];return db[_0xfdfd('0x46')][_0xfdfd('0x51')]({'where':{'id':_0x498050[_0xfdfd('0x56')]['id']}})[_0xfdfd('0x27')](handleEntityNotFound(_0x2d3256,null))[_0xfdfd('0x27')](saveUpdates(_0x498050[_0xfdfd('0x55')],null))[_0xfdfd('0x27')](respondWithResult(_0x2d3256,null))[_0xfdfd('0x4a')](handleError(_0x2d3256,null));};exports[_0xfdfd('0x6a')]=function(_0x24798f,_0x140641){_0x24798f['body'][_0xfdfd('0x6b')]=_0x24798f[_0xfdfd('0x66')][_0xfdfd('0x69')];return db[_0xfdfd('0x46')][_0xfdfd('0x51')]({'where':{'id':_0x24798f['params']['id']}})[_0xfdfd('0x27')](handleEntityNotFound(_0x140641,null))[_0xfdfd('0x27')](saveUpdates(_0x24798f[_0xfdfd('0x55')],null))['then'](respondWithResult(_0x140641,null))[_0xfdfd('0x4a')](handleError(_0x140641,null));};exports[_0xfdfd('0x6c')]=function(_0x5e31f9,_0x450461){_0x5e31f9[_0xfdfd('0x55')][_0xfdfd('0x6d')]=_0x5e31f9[_0xfdfd('0x66')][_0xfdfd('0x69')];return db[_0xfdfd('0x46')][_0xfdfd('0x51')]({'where':{'id':_0x5e31f9[_0xfdfd('0x56')]['id']}})[_0xfdfd('0x27')](handleEntityNotFound(_0x450461,null))[_0xfdfd('0x27')](saveUpdates(_0x5e31f9['body'],null))[_0xfdfd('0x27')](respondWithResult(_0x450461,null))[_0xfdfd('0x4a')](handleError(_0x450461,null));};exports[_0xfdfd('0x6e')]=function(_0x19d10d,_0xe65366){var _0x42f7ed=path['join'](config[_0xfdfd('0x6f')],_0xfdfd('0x70'));var _0x36d6f9={'where':{'id':_0x19d10d[_0xfdfd('0x56')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x19823d=![];return require('../../config/license/util')['getLicense']()[_0xfdfd('0x27')](function(_0x74e492){if(_0x74e492){_0x19823d=_0x74e492[_0xfdfd('0x71')];}})[_0xfdfd('0x27')](function(){return db[_0xfdfd('0x46')][_0xfdfd('0x51')](_0x36d6f9);})[_0xfdfd('0x27')](handleEntityNotFound(_0xe65366,null))[_0xfdfd('0x27')](function(_0x53ff12){if(_0x53ff12){if(!_[_0xfdfd('0x72')](_0x53ff12[_0xfdfd('0x73')])){if(fs[_0xfdfd('0x74')](path['join'](config[_0xfdfd('0x6f')],'server/files/images/logos/',_0x53ff12['sitepic']))&&_0x19823d){_0x42f7ed=path[_0xfdfd('0x75')](config[_0xfdfd('0x6f')],_0xfdfd('0x76'),_0x53ff12[_0xfdfd('0x73')]);}}return _0xe65366['download'](_0x42f7ed);}})[_0xfdfd('0x4a')](handleError(_0xe65366,null));};exports[_0xfdfd('0x77')]=function(_0x534601,_0x2cd1a5){var _0x2b1546=path[_0xfdfd('0x75')](config[_0xfdfd('0x6f')],'server/files/images/avatars/default_avatar.png');var _0x3a5851={'where':{'id':_0x534601['params']['id']},'attributes':['id',_0xfdfd('0x68')],'raw':!![]};return db[_0xfdfd('0x46')][_0xfdfd('0x51')](_0x3a5851)['then'](handleEntityNotFound(_0x2cd1a5,null))[_0xfdfd('0x27')](function(_0x30e281){if(_0x30e281){if(!_[_0xfdfd('0x72')](_0x30e281[_0xfdfd('0x68')])){if(fs[_0xfdfd('0x74')](path[_0xfdfd('0x75')](config[_0xfdfd('0x6f')],_0xfdfd('0x78'),_0x30e281[_0xfdfd('0x68')]))){_0x2b1546=path[_0xfdfd('0x75')](config['root'],_0xfdfd('0x78'),_0x30e281['agentAvatar']);}}return _0x2cd1a5[_0xfdfd('0x79')](_0x2b1546);}})['catch'](handleError(_0x2cd1a5,null));};exports[_0xfdfd('0x7a')]=function(_0x4b1fb2,_0xa60cf3){var _0x149a71=path[_0xfdfd('0x75')](config[_0xfdfd('0x6f')],_0xfdfd('0x7b'));var _0x1e7fac={'where':{'id':_0x4b1fb2['params']['id']},'attributes':['id',_0xfdfd('0x6b'),_0xfdfd('0x7c')],'raw':!![]};return db[_0xfdfd('0x46')]['find'](_0x1e7fac)['then'](handleEntityNotFound(_0xa60cf3,null))['then'](function(_0x138fbc){if(_0x138fbc){if(!_['isNil'](_0x138fbc[_0xfdfd('0x6b')])){if(fs[_0xfdfd('0x74')](path[_0xfdfd('0x75')](config[_0xfdfd('0x6f')],_0xfdfd('0x78'),_0x138fbc[_0xfdfd('0x6b')]))&&_0x138fbc['showCustomerAvatar']){_0x149a71=path[_0xfdfd('0x75')](config[_0xfdfd('0x6f')],_0xfdfd('0x78'),_0x138fbc['customerAvatar']);}}return _0xa60cf3[_0xfdfd('0x79')](_0x149a71);}})[_0xfdfd('0x4a')](handleError(_0xa60cf3,null));};exports['getSystemAvatar']=function(_0x2f4013,_0x2ef81a){var _0x2f3f01=path[_0xfdfd('0x75')](config[_0xfdfd('0x6f')],_0xfdfd('0x7d'));var _0x58840c={'where':{'id':_0x2f4013[_0xfdfd('0x56')]['id']},'attributes':['id',_0xfdfd('0x6d')],'raw':!![]};return db[_0xfdfd('0x46')][_0xfdfd('0x51')](_0x58840c)['then'](handleEntityNotFound(_0x2ef81a,null))[_0xfdfd('0x27')](function(_0x1be010){if(_0x1be010){if(!_[_0xfdfd('0x72')](_0x1be010[_0xfdfd('0x6d')])){if(fs[_0xfdfd('0x74')](path[_0xfdfd('0x75')](config['root'],'server/files/images/avatars/',_0x1be010[_0xfdfd('0x6d')]))){_0x2f3f01=path[_0xfdfd('0x75')](config[_0xfdfd('0x6f')],_0xfdfd('0x78'),_0x1be010[_0xfdfd('0x6d')]);}}return _0x2ef81a['download'](_0x2f3f01);}})[_0xfdfd('0x4a')](handleError(_0x2ef81a,null));};exports['notify']=function(_0x18d286,_0x200458){var _0x222b17=require(_0xfdfd('0x7e'));var _0x4f15ec=new _0x222b17();var _0x93e267=_0x4f15ec[_0xfdfd('0x7f')](_0x18d286[_0xfdfd('0x80')][_0xfdfd('0x81')])['getResult']();var _0x282c1f={'body':_0x18d286[_0xfdfd('0x55')],'channel':_0xfdfd('0x82')};var _0x120b5e=[];var _0x33a3b6=[];var _0x30ec08={};var _0x622486=![];return db[_0xfdfd('0x83')]['describe']()[_0xfdfd('0x27')](function(_0x3000e9){if(!_0x3000e9){throw new db['Sequelize']['ValidationError']('no\x20available\x20attributes');}_0x120b5e=_[_0xfdfd('0x84')](_[_0xfdfd('0x37')](_0x3000e9),[_0xfdfd('0x85'),_0xfdfd('0x86')]);_0x33a3b6=_['difference'](_[_0xfdfd('0x37')](_0x3000e9),['createdAt',_0xfdfd('0x86'),'CompanyId',_0xfdfd('0x87')]);if(_0x18d286['body']['id']){delete _0x18d286['body']['id'];}if(_[_0xfdfd('0x72')](_0x18d286['body'][_0xfdfd('0x88')])){throw new db[(_0xfdfd('0x89'))][(_0xfdfd('0x8a'))]('from\x20is\x20mandatory');}if(_[_0xfdfd('0x72')](_0x18d286['body'][_0xfdfd('0x55')])||_0x18d286[_0xfdfd('0x55')]['body']===''){throw new db['Sequelize'][(_0xfdfd('0x8a'))](_0xfdfd('0x8b'));}if(_[_0xfdfd('0x72')](_0x18d286['body'][_0xfdfd('0x8c')])){throw new db['Sequelize']['ValidationError'](_0xfdfd('0x8d')+_0x33a3b6);}if(!_[_0xfdfd('0x8e')](_0x33a3b6,_0x18d286[_0xfdfd('0x55')][_0xfdfd('0x8c')])){throw new db[(_0xfdfd('0x89'))][(_0xfdfd('0x8a'))](_0xfdfd('0x8f')+_0x33a3b6);}_0x30ec08[_0x18d286[_0xfdfd('0x55')]['mapKey']]=_0x18d286['body'][_0xfdfd('0x88')];})[_0xfdfd('0x27')](function(){return db[_0xfdfd('0x46')][_0xfdfd('0x51')]({'where':{'id':_0x18d286[_0xfdfd('0x56')]['id']},'include':[{'model':db['CmList'],'as':_0xfdfd('0x90'),'include':[{'model':db[_0xfdfd('0x83')],'as':_0xfdfd('0x91'),'where':_0x30ec08,'limit':0x1,'order':[['updatedAt',_0xfdfd('0x92')]]}]},{'model':db[_0xfdfd('0x93')],'as':_0xfdfd('0x94')}]});})[_0xfdfd('0x27')](handleEntityNotFound(_0x200458,null))['then'](function(_0x5ad72c){if(_0x5ad72c&&_0x5ad72c[_0xfdfd('0x90')]){_0x282c1f[_0xfdfd('0x95')]=_0x5ad72c;_0x282c1f[_0xfdfd('0x96')]=_0x5ad72c[_0xfdfd('0x94')];_0x282c1f[_0xfdfd('0x97')]=_0x5ad72c[_0xfdfd('0x90')];_0x282c1f[_0xfdfd('0x96')]=_[_0xfdfd('0x98')](_0x282c1f[_0xfdfd('0x96')],[_0xfdfd('0x99')],['asc']);if(_0x282c1f[_0xfdfd('0x95')]['Applications']){delete _0x282c1f['account'][_0xfdfd('0x94')];}if(_0x282c1f[_0xfdfd('0x95')]['List']&&_0x282c1f[_0xfdfd('0x95')][_0xfdfd('0x90')][_0xfdfd('0x91')]['length']){return _0x282c1f['account'][_0xfdfd('0x90')][_0xfdfd('0x91')][0x0];}var _0x242cbe=_[_0xfdfd('0xb')](_0x18d286['body'],{'firstName':_0x18d286[_0xfdfd('0x55')]['from'],'ListId':_0x5ad72c[_0xfdfd('0x87')]});_0x242cbe[_0x18d286[_0xfdfd('0x55')][_0xfdfd('0x8c')]]=_0x18d286[_0xfdfd('0x55')][_0xfdfd('0x88')];return db['CmContact'][_0xfdfd('0x4e')](_0x242cbe,{'fields':_0x120b5e,'raw':!![]});}})['then'](handleEntityNotFound(_0x200458,null))[_0xfdfd('0x27')](function(_0x1bdf80){_0x282c1f[_0xfdfd('0x9a')]=_0x1bdf80;var _0x246760=_0x18d286[_0xfdfd('0x55')][_0xfdfd('0x9b')];if(_0x18d286[_0xfdfd('0x80')]['cf-connecting-ip']){_0x246760=_0x18d286[_0xfdfd('0x80')]['cf-connecting-ip'];}else if(_0x18d286[_0xfdfd('0x80')][_0xfdfd('0x9c')]){_0x246760=_[_0xfdfd('0x9d')](_0x18d286['headers'][_0xfdfd('0x9c')][_0xfdfd('0x9e')](','));}if(_0x1bdf80){var _0x301dce={'ContactId':_0x1bdf80['id'],'ChatWebsiteId':_0x18d286[_0xfdfd('0x56')]['id'],'from':(_0x1bdf80[_0xfdfd('0x9f')]||'')+'\x20'+(_0x1bdf80[_0xfdfd('0xa0')]||''),'customerIp':_0x246760,'customerPort':_0x18d286['headers'][_0xfdfd('0xa1')]?_0x18d286[_0xfdfd('0x80')]['x-real-port']:null,'referer':_0x18d286[_0xfdfd('0x55')][_0xfdfd('0xa2')],'browserName':_0x93e267[_0xfdfd('0xa3')][_0xfdfd('0x2d')]&&_0x93e267['browser'][_0xfdfd('0xa4')]?util[_0xfdfd('0xa5')]('%s\x20%s',_0x93e267[_0xfdfd('0xa3')][_0xfdfd('0x2d')],_0x93e267[_0xfdfd('0xa3')][_0xfdfd('0xa4')]):'unknown','browserVersion':_0x93e267[_0xfdfd('0xa3')][_0xfdfd('0xa4')]||_0xfdfd('0xa6'),'osName':util[_0xfdfd('0xa5')](_0xfdfd('0xa7'),_0x93e267['os'][_0xfdfd('0x2d')],_0x93e267['os']['version']),'osVersion':_0x93e267['os']['version'],'deviceModel':_0x93e267[_0xfdfd('0xa8')][_0xfdfd('0x35')]&&_0x93e267['device'][_0xfdfd('0xa9')]?util[_0xfdfd('0xa5')](_0xfdfd('0xaa'),_0x93e267[_0xfdfd('0xa8')][_0xfdfd('0x35')],_0x93e267['device']['vendor'],_0x93e267[_0xfdfd('0xa8')][_0xfdfd('0x33')]):null,'deviceVendor':_0x93e267['device'][_0xfdfd('0xa9')],'deviceType':_0x93e267[_0xfdfd('0xa8')][_0xfdfd('0x33')],'formData':JSON[_0xfdfd('0x18')](_0x18d286[_0xfdfd('0x55')])};var _0x2da49b={'ChatWebsiteId':_0x18d286['params']['id'],'closed':![]};if(_0x18d286[_0xfdfd('0x55')][_0xfdfd('0xab')]){_0x2da49b[_0xfdfd('0xab')]=_0x18d286[_0xfdfd('0x55')][_0xfdfd('0xab')];return db[_0xfdfd('0xac')][_0xfdfd('0x51')]({'where':_0x2da49b})[_0xfdfd('0x27')](function(_0xf4107d){if(_0xf4107d){return[_0xf4107d,![]];}_0x301dce['threadId']=_0x18d286[_0xfdfd('0x55')][_0xfdfd('0xab')];_0x301dce[_0xfdfd('0xad')]=_0x18d286[_0xfdfd('0x55')][_0xfdfd('0xad')];return db[_0xfdfd('0xac')][_0xfdfd('0x4e')](_0x301dce)['then'](function(_0x3a7ad2){return[_0x3a7ad2,!![]];});});}_0x2da49b[_0xfdfd('0xae')]=_0x1bdf80['id'];if(_0x18d286[_0xfdfd('0x55')][_0xfdfd('0xaf')]&&_0x18d286[_0xfdfd('0x55')][_0xfdfd('0xaf')]['id']){_0x2da49b['id']=_0x18d286[_0xfdfd('0x55')][_0xfdfd('0xaf')]['id'];return db['ChatInteraction']['find']({'where':_0x2da49b})[_0xfdfd('0x27')](function(_0x3e15cf){if(_0x3e15cf){return[_0x3e15cf,![]];}return db[_0xfdfd('0xac')][_0xfdfd('0x4e')](_0x301dce)['then'](function(_0x451e95){return[_0x451e95,!![]];});});}return db[_0xfdfd('0xac')][_0xfdfd('0x4e')](_0x301dce)[_0xfdfd('0x27')](function(_0x3d94e2){return[_0x3d94e2,!![]];});}})[_0xfdfd('0xb0')](function(_0x125313,_0x22612a){if(_0x125313){_0x622486=_0x22612a;if(!_0x22612a){var _0x549a62={'from':(_0x282c1f[_0xfdfd('0x9a')][_0xfdfd('0x9f')]||'')+'\x20'+(_0x282c1f[_0xfdfd('0x9a')][_0xfdfd('0xa0')]||'')};if(_0x18d286['body'][_0xfdfd('0xab')]&&_0x18d286['body'][_0xfdfd('0xb1')]&&_0x18d286[_0xfdfd('0x55')][_0xfdfd('0xab')]!=_0x18d286['body']['messageId']){_0x549a62['threadId']=_0x18d286['body'][_0xfdfd('0xb1')];}return _0x125313['update'](_0x549a62);}else{return _0x125313;}}})['then'](function(_0x2ddf46){_0x282c1f[_0xfdfd('0xaf')]=_0x2ddf46[_0xfdfd('0x29')]({'plain':!![]});_0x282c1f[_0xfdfd('0xaf')][_0xfdfd('0xb2')]=_0x622486;if(_0x282c1f[_0xfdfd('0xaf')][_0xfdfd('0xb2')]){if(_0x282c1f['account']['autoclose']){_0x282c1f['applications'][_0xfdfd('0xb3')]({'id':0x0,'priority':_0x282c1f[_0xfdfd('0x96')]['length']+0x1,'app':_0xfdfd('0xb4'),'appdata':_0xfdfd('0xb5'),'interval':'*,*,*,*'});}}return db[_0xfdfd('0xb6')][_0xfdfd('0x4e')]({'body':_0x18d286['body']['body'],'ChatWebsiteId':_0x18d286[_0xfdfd('0x56')]['id'],'ChatInteractionId':_0x2ddf46['id'],'direction':'in','ContactId':_0x282c1f['contact']['id'],'AttachmentId':_0x18d286[_0xfdfd('0x55')][_0xfdfd('0xb7')]});})['then'](function(_0x3b4a6b){_0x282c1f[_0xfdfd('0x1a')]=_0x3b4a6b;if(_0x282c1f[_0xfdfd('0xaf')][_0xfdfd('0xb8')]){return db[_0xfdfd('0xb9')][_0xfdfd('0x51')]({'attributes':['id',_0xfdfd('0x2d')],'where':{'id':_0x282c1f[_0xfdfd('0xaf')]['UserId']}})[_0xfdfd('0x27')](function(_0x5703db){if(_0x5703db){_0x282c1f[_0xfdfd('0x96')][_0xfdfd('0xba')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x5703db[_0xfdfd('0x2d')]+','+(_0x282c1f[_0xfdfd('0x95')][_0xfdfd('0xbb')]||0xa),'interval':_0xfdfd('0xbc')});_0x282c1f[_0xfdfd('0xbd')]=!![];}return respondWithRpcPromise(_0xfdfd('0xbe'),_0xfdfd('0xbf'),_0x282c1f);});}return respondWithRpcPromise(_0xfdfd('0xbe'),_0xfdfd('0xbf'),_0x282c1f);})[_0xfdfd('0x27')](function(_0x384a57){respondWithRpcPromise(_0xfdfd('0xc0'),_0xfdfd('0xc0'),{'event':_0xfdfd('0xc1'),'message':_0x384a57},client9002);return _0x384a57;})[_0xfdfd('0x27')](respondWithResult(_0x200458,null))[_0xfdfd('0x4a')](handleError(_0x200458,null));};exports[_0xfdfd('0xc2')]=function(_0x59c1fb,_0x24cd3c){var _0x1cfd52,_0x381883,_0x648db3;var _0x22b21a=[];var _0x412474={};var _0x58e396=_0x59c1fb[_0xfdfd('0xc3')]||[];var _0x5b9209=[];var _0x4bcabd;return db[_0xfdfd('0x83')]['describe']()['then'](function(_0x4e8e8d){if(!_0x4e8e8d){throw new db[(_0xfdfd('0x89'))][(_0xfdfd('0x8a'))](_0xfdfd('0xc4'));}_0x22b21a=_['difference'](_[_0xfdfd('0x37')](_0x4e8e8d),[_0xfdfd('0x85'),'updatedAt',_0xfdfd('0xc5'),'ListId']);if(_0x59c1fb['body']['id']){delete _0x59c1fb[_0xfdfd('0x55')]['id'];}if(_['isNil'](_0x59c1fb['body'][_0xfdfd('0x88')])){throw _0x24cd3c[_0xfdfd('0x1e')](0x1f4)[_0xfdfd('0x2e')](new db[(_0xfdfd('0x89'))]['ValidationError']('from\x20is\x20mandatory'));}if(_['isNil'](_0x59c1fb[_0xfdfd('0x55')][_0xfdfd('0x55')])||_0x59c1fb[_0xfdfd('0x55')]['body']===''){throw _0x24cd3c[_0xfdfd('0x1e')](0x1f4)[_0xfdfd('0x2e')](new db['Sequelize'][(_0xfdfd('0x8a'))](_0xfdfd('0x8b')));}if(_[_0xfdfd('0x72')](_0x59c1fb['body']['mapKeyOffline'])){throw _0x24cd3c['status'](0x1f4)[_0xfdfd('0x2e')](new db[(_0xfdfd('0x89'))]['ValidationError']('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x22b21a));}if(!_[_0xfdfd('0x8e')](_0x22b21a,_0x59c1fb[_0xfdfd('0x55')]['mapKeyOffline'])){throw _0x24cd3c[_0xfdfd('0x1e')](0x1f4)[_0xfdfd('0x2e')](new db[(_0xfdfd('0x89'))]['ValidationError'](_0xfdfd('0xc6')+_0x22b21a));}_0x412474[_0x59c1fb['body'][_0xfdfd('0xc7')]]=_0x59c1fb[_0xfdfd('0x55')]['from'];})[_0xfdfd('0x27')](function(){return db[_0xfdfd('0x46')][_0xfdfd('0x51')]({'where':{'id':_0x59c1fb[_0xfdfd('0x56')]['id']},'include':[{'model':db[_0xfdfd('0xc8')],'as':_0xfdfd('0x90')},{'model':db['MailAccount'],'as':'MailAccount'}]});})[_0xfdfd('0x27')](handleEntityNotFound(_0x24cd3c,null))[_0xfdfd('0x27')](function(_0x5e9970){if(_0x5e9970&&_0x5e9970[_0xfdfd('0x90')]){_0x381883=_0x5e9970;var _0x203c13=_[_0xfdfd('0xb')](_0x59c1fb[_0xfdfd('0x55')],{'firstName':_0x59c1fb[_0xfdfd('0x55')][_0xfdfd('0x88')],'phone':_0x59c1fb[_0xfdfd('0x55')][_0xfdfd('0x88')],'ListId':_0x5e9970[_0xfdfd('0x87')]});_0x203c13[_0x59c1fb[_0xfdfd('0x55')]['mapKeyOffline']]=_0x59c1fb[_0xfdfd('0x55')][_0xfdfd('0x88')];return db['CmContact'][_0xfdfd('0xc9')]({'where':_0x412474,'defaults':_0x203c13});}})[_0xfdfd('0xb0')](function(_0x5a7589){if(_0x5a7589){_0x648db3=_0x5a7589;var _0x53b01f=fs['readFileSync'](path['join'](config[_0xfdfd('0x6f')],_0xfdfd('0xca')),_0xfdfd('0xcb'));var _0x26e9b7=ejs[_0xfdfd('0xcc')](_0x53b01f,{'body':_[_0xfdfd('0xcd')](_0x59c1fb[_0xfdfd('0x55')][_0xfdfd('0x55')]),'bodyTitle':_0x381883[_0xfdfd('0xce')]});return db['ChatOfflineMessage'][_0xfdfd('0x4e')]({'body':_0x26e9b7,'plainBody':htmlToText[_0xfdfd('0xcf')](_0x26e9b7),'ContactId':_0x5a7589['id'],'ChatWebsiteId':_0x381883['id']});}})['then'](function(_0x28091b){_0x4bcabd=_0x28091b;if(_0x58e396[_0xfdfd('0x3b')]){var _0x52d93b=_0x58e396[_0xfdfd('0x31')](function(_0x198047){return{'name':_0x198047['originalname'],'basename':_0x198047[_0xfdfd('0x69')],'type':_0x198047['mimetype'],'ChatOfflineMessageId':_0x28091b['id']};});_0x5b9209=_0x52d93b['map'](_0x11440a=>{var _0x8ec378={'filename':_0x11440a[_0xfdfd('0x2d')],'path':path['join'](config[_0xfdfd('0x6f')],_0xfdfd('0xd0'),'files',_0xfdfd('0xd1'),_0xfdfd('0xd2'),_0x11440a[_0xfdfd('0xd3')])};return _0x8ec378;});if(!_0x381883[_0xfdfd('0xd4')]){return db[_0xfdfd('0xd5')][_0xfdfd('0xd6')](function(_0x34567d){return db[_0xfdfd('0xd7')][_0xfdfd('0xd8')](_0x52d93b,{'transaction':_0x34567d});});}}})[_0xfdfd('0x27')](function(){if(_0x4bcabd){_0x1cfd52=_0x4bcabd;return db[_0xfdfd('0xd9')][_0xfdfd('0x5c')]({'where':{'service':!![]},'include':[{'model':db[_0xfdfd('0xda')],'as':_0xfdfd('0xdb'),'raw':!![],'include':[{'model':db[_0xfdfd('0xdc')],'as':_0xfdfd('0xdc'),'raw':!![]}]}]});}})[_0xfdfd('0x27')](function(_0x5a5030){if(_0x5a5030&&_0x5a5030[_0xfdfd('0xdb')]&&_0x381883[_0xfdfd('0xdd')]&&_0x381883[_0xfdfd('0xde')]){var _0xe502c2=_0x5a5030[_0xfdfd('0xdf')]();return respondWithRpcPromise(_0xfdfd('0xe0'),'sendMail',{'account':_0xe502c2,'message':{'from':util[_0xfdfd('0xa5')]('\x22%s\x22\x20<%s>',_0x5a5030[_0xfdfd('0x2d')],_0x5a5030[_0xfdfd('0xe1')]||_0x5a5030[_0xfdfd('0xdb')][_0xfdfd('0x4f')]),'to':_0x381883[_0xfdfd('0xde')],'subject':_0x381883[_0xfdfd('0xe2')],'html':_0x1cfd52[_0xfdfd('0x55')],'attachments':_0x5b9209}},client9003)[_0xfdfd('0x27')](function(){return _0x1cfd52;})[_0xfdfd('0x4a')](function(_0x420ed8){logger['error'](_0x420ed8);});}})[_0xfdfd('0x27')](function(){if(_0x381883&&_0x381883[_0xfdfd('0xd4')]&&_0x381883[_0xfdfd('0xe3')]){var _0x28ebed=[];if(_0x58e396['length']){_0x28ebed=_0x58e396['map'](function(_0x406c43){return{'name':_0x406c43['originalname'],'basename':_0x406c43[_0xfdfd('0x69')],'type':_0x406c43[_0xfdfd('0xe4')],'ChatOfflineMessageId':_0x4bcabd['id']};});}var _0x1e92b2;if(!_[_0xfdfd('0x72')](_0x381883[_0xfdfd('0xe5')])){var _0x51a3f2=_['map'](_0x59c1fb[_0xfdfd('0x55')],function(_0xe22bfa){return _0xe22bfa;});var _0x3c3532=_['toPairsIn'](_0x51a3f2)[0x0];var _0x59d717=_[_0xfdfd('0xe6')](_0x3c3532,function(_0xfe89d9){return _0xfe89d9;});_0x1e92b2=_0x59d717[0x1][_0x381883['subjectOffline']];}var _0x52cdcd={'from':_0x648db3[_0xfdfd('0xe1')],'firstName':_0x648db3[_0xfdfd('0x9f')],'lastName':_0x648db3[_0xfdfd('0xa0')],'mapKey':_0xfdfd('0xe1'),'message':{'from':_0x648db3['email'],'to':_0x381883[_0xfdfd('0xd9')][_0xfdfd('0xe1')],'cc':'','subject':_[_0xfdfd('0x72')](_0x1e92b2)?_0x381883[_0xfdfd('0xe2')]:_0x1e92b2,'messageId':'','sentAt':new Date(),'attach':_0x28ebed[_0xfdfd('0x3b')],'attachments':_0x28ebed,'originChannel':_0xfdfd('0xe7'),'ChatWebsiteId':_0x381883['id'],'ChatOfflineMessageId':_0x1cfd52['id'],'originTo':_0x381883[_0xfdfd('0xd9')][_0xfdfd('0xe1')]},'body':_0x1cfd52[_0xfdfd('0x55')]};var _0x52ff96={'account':{'id':_0x381883[_0xfdfd('0xe3')]},'body':_0x52cdcd,'log':'NotifyMailAccount'};return respondWithRpcPromise(_0xfdfd('0xe8'),_0xfdfd('0xe9'),_0x52ff96,client9001)[_0xfdfd('0x27')](function(){return _0x1cfd52;})[_0xfdfd('0x4a')](function(_0x4aba97){logger['error'](_0x4aba97);});}return;})[_0xfdfd('0x27')](function(){if(_0x1cfd52){return _0x1cfd52;}})[_0xfdfd('0x27')](respondWithResult(_0x24cd3c,null))[_0xfdfd('0x4a')](function(_0x42578f){logger[_0xfdfd('0x1b')]('catch',_0x42578f);for(var _0x44c75e of _0x58e396){var _0x264f88=path[_0xfdfd('0x75')](config[_0xfdfd('0x6f')],'server',_0xfdfd('0xc3'),_0xfdfd('0xd1'),_0xfdfd('0xd2'),_0x44c75e['filename']);fs_extra[_0xfdfd('0xea')](_0x264f88)[_0xfdfd('0x4a')](function(_0x5c518a){logger['error'](_0xfdfd('0xeb'),_0x264f88,_0x5c518a);});}});};exports[_0xfdfd('0xec')]=function(_0x5195d4,_0x48eedb){return db[_0xfdfd('0xac')][_0xfdfd('0x51')]({'where':{'id':_0x5195d4[_0xfdfd('0x56')]['id']}})[_0xfdfd('0x27')](handleEntityNotFound(_0x48eedb,null))[_0xfdfd('0x27')](function(_0x349138){if(_0x349138){return _0x349138[_0xfdfd('0xec')](_0x5195d4[_0xfdfd('0x55')][_0xfdfd('0x64')],_['omit'](_0x5195d4['body'],[_0xfdfd('0x64'),'id'])||{});}})[_0xfdfd('0x27')](respondWithResult(_0x48eedb,null))[_0xfdfd('0x4a')](handleError(_0x48eedb,null));};exports[_0xfdfd('0xed')]=function(_0x46cd5e,_0x521b04){var _0x40efe5={'raw':![],'where':{}};var _0x5c63fc={};var _0x4e17d2={'count':0x0,'rows':[]};return db[_0xfdfd('0x46')][_0xfdfd('0x5c')]({'where':{'id':_0x46cd5e[_0xfdfd('0x56')]['id']}})[_0xfdfd('0x27')](handleEntityNotFound(_0x521b04,null))[_0xfdfd('0x27')](function(_0x3e22f8){if(_0x3e22f8){_0x5c63fc[_0xfdfd('0x35')]=_['keys'](db[_0xfdfd('0xac')][_0xfdfd('0x5d')]);_0x5c63fc[_0xfdfd('0x36')]=_[_0xfdfd('0x37')](_0x46cd5e[_0xfdfd('0x36')]);_0x5c63fc[_0xfdfd('0x3f')]=_['intersection'](_0x5c63fc['model'],_0x5c63fc[_0xfdfd('0x36')]);_0x40efe5['attributes']=_[_0xfdfd('0x38')](_0x5c63fc['model'],qs['fields'](_0x46cd5e[_0xfdfd('0x36')]['fields']));_0x40efe5[_0xfdfd('0x39')]=_0x40efe5[_0xfdfd('0x39')][_0xfdfd('0x3b')]?_0x40efe5['attributes']:_0x5c63fc[_0xfdfd('0x35')];if(!_0x46cd5e['query'][_0xfdfd('0x3c')]('nolimit')){_0x40efe5[_0xfdfd('0x23')]=qs[_0xfdfd('0x23')](_0x46cd5e[_0xfdfd('0x36')][_0xfdfd('0x23')]);_0x40efe5[_0xfdfd('0x21')]=qs[_0xfdfd('0x21')](_0x46cd5e[_0xfdfd('0x36')][_0xfdfd('0x21')]);}_0x40efe5[_0xfdfd('0x5e')]=qs[_0xfdfd('0x3e')](_0x46cd5e[_0xfdfd('0x36')][_0xfdfd('0x3e')]);_0x40efe5[_0xfdfd('0x42')]=qs['filters'](_[_0xfdfd('0x40')](_0x46cd5e[_0xfdfd('0x36')],_0x5c63fc[_0xfdfd('0x3f')]));_0x40efe5[_0xfdfd('0x42')][_0xfdfd('0x59')]=_0x3e22f8['id'];if(_0x46cd5e[_0xfdfd('0x36')][_0xfdfd('0x41')]){_0x40efe5[_0xfdfd('0x42')]=_[_0xfdfd('0x43')](_0x40efe5['where'],{'$or':_[_0xfdfd('0x31')](_0x40efe5[_0xfdfd('0x39')],function(_0x18016e){var _0x46f31e={};_0x46f31e[_0x18016e]={'$like':'%'+_0x46cd5e[_0xfdfd('0x36')][_0xfdfd('0x41')]+'%'};return _0x46f31e;})});}_0x40efe5=_['merge']({},_0x40efe5,_0x46cd5e[_0xfdfd('0x45')]);return db[_0xfdfd('0xac')]['count']({'where':_0x40efe5[_0xfdfd('0x42')]})['then'](function(_0x2478ac){_0x4e17d2[_0xfdfd('0x24')]=_0x2478ac;if(_0x46cd5e['query'][_0xfdfd('0x47')]){_0x40efe5[_0xfdfd('0x4d')]=[{'model':db[_0xfdfd('0x83')],'as':'Contact','required':![]},{'model':db[_0xfdfd('0xb9')],'as':_0xfdfd('0xee'),'attributes':[_0xfdfd('0x2d'),_0xfdfd('0xef'),_0xfdfd('0xf0')],'required':![]},{'model':db['Tag'],'as':_0xfdfd('0xf1'),'attributes':['id','name',_0xfdfd('0xf2')],'where':_0x46cd5e[_0xfdfd('0x36')][_0xfdfd('0xf3')]?{'id':_0x46cd5e[_0xfdfd('0x36')][_0xfdfd('0xf3')]}:undefined,'required':_0x46cd5e['query'][_0xfdfd('0xf3')]?!![]:![]}];}return db['ChatInteraction'][_0xfdfd('0x48')](_0x40efe5);})[_0xfdfd('0x27')](function(_0x3092a4){_0x4e17d2['rows']=_0x3092a4;return _0x4e17d2;});}})[_0xfdfd('0x27')](respondWithFilteredResult(_0x521b04,_0x40efe5))[_0xfdfd('0x4a')](handleError(_0x521b04,null));};function iftimePromise(_0x4828e4,_0x450437){return respondWithRpcPromise(_0xfdfd('0xf4'),'getSnippet',{'command':_0x450437[_0xfdfd('0xf5')]?util[_0xfdfd('0xa5')]('iftime\x20%s,%s',_0x4828e4['interval'],_0x450437[_0xfdfd('0xf5')]):util[_0xfdfd('0xa5')](_0xfdfd('0xf6'),_0x4828e4[_0xfdfd('0xf7')])},client9002)['then'](function(_0x3fa2ec){var _0xc7153=_0x3fa2ec&&_0x3fa2ec['indexOf']('true')>=0x0?!![]:![];logger['info'](_0xfdfd('0xf8'),_0x450437['id'],_0x4828e4['id'],_0x4828e4[_0xfdfd('0xf7')],_0xc7153?_0xfdfd('0xf9'):_0xfdfd('0xfa'),_0x450437[_0xfdfd('0xf5')]?_0x450437[_0xfdfd('0xf5')]:'No\x20timezone');return _0xc7153;})[_0xfdfd('0x4a')](function(_0x1fd92a){logger[_0xfdfd('0x1b')](_0xfdfd('0xf8'),_0x450437['id'],_0x4828e4['id'],_0x4828e4[_0xfdfd('0xf7')],util[_0xfdfd('0xfb')](_0x1fd92a,{'showHidden':![],'depth':null}),_0x450437[_0xfdfd('0xf5')]?_0x450437['timezone']:_0xfdfd('0xfc'));return![];});}exports['getSnippet']=function(_0x3656c3,_0x2efbdc){var _0x1c7402=0x0;var _0x1a7438=0x0;var _0x487dc1=![];var _0x35f79c;var _0x2a2a93;return db[_0xfdfd('0x46')][_0xfdfd('0x51')]({'where':{'id':_0x3656c3[_0xfdfd('0x56')]['id']},'include':[{'model':db[_0xfdfd('0xfd')],'as':_0xfdfd('0xfd'),'include':[{'model':db[_0xfdfd('0xfd')],'as':_0xfdfd('0xfe'),'attributes':['id',_0xfdfd('0xf7')],'raw':!![]}]}]})[_0xfdfd('0x27')](handleEntityNotFound(_0x2efbdc,null))[_0xfdfd('0x27')](function(_0xb959bc){if(_0xb959bc){_0x35f79c=_0xb959bc;return _0xb959bc['getProactiveActions']({'raw':!![]});}})[_0xfdfd('0x27')](function(_0x29a848){if(_0x35f79c){if(_0x29a848){_0x2a2a93=_0x29a848;}}return require(_0xfdfd('0xff'))[_0xfdfd('0x100')]();})['then'](function(_0x5c20dc){if(_0x5c20dc){_0x1a7438=_0x5c20dc[_0xfdfd('0x101')];_0x487dc1=_0x5c20dc[_0xfdfd('0x71')];}})[_0xfdfd('0x27')](function(){return db[_0xfdfd('0xac')][_0xfdfd('0x24')]({'where':{'closed':![]}});})['then'](function(_0xc79749){_0x1c7402=_0xc79749;if(_0x1a7438&&_0xc79749>_0x1a7438){return db[_0xfdfd('0x102')][_0xfdfd('0x5c')]({'where':{'id':0x1}})[_0xfdfd('0x27')](function(_0x327484){if(_0x327484){_0x327484[_0xfdfd('0x103')](_0xfdfd('0x104'));}});}})[_0xfdfd('0x27')](function(){if(_0x35f79c[_0xfdfd('0xfd')]&&_0x35f79c[_0xfdfd('0xfd')]['Intervals']){var _0x525aa4=[];for(var _0xf2770=0x0;_0xf2770<_0x35f79c[_0xfdfd('0xfd')][_0xfdfd('0xfe')][_0xfdfd('0x3b')];_0xf2770++){var _0x23ef03=_0x35f79c['Interval'][_0xfdfd('0xfe')][_0xf2770]['get']({'plain':!![]});_0x525aa4[_0xfdfd('0xb3')](iftimePromise(_0x23ef03,_0x35f79c));}return BPromise[_0xfdfd('0x105')](_0x525aa4)[_0xfdfd('0x27')](function(_0x2163cc){return _[_0xfdfd('0x106')](_0x2163cc);});}else{return!![];}})[_0xfdfd('0x27')](function(_0x210b36){var _0x3ecd48=fs[_0xfdfd('0x107')](path[_0xfdfd('0x75')](config[_0xfdfd('0x6f')],_0xfdfd('0x108')),_0xfdfd('0xcb'));var _0x4d02b4=new url['URL'](_0x35f79c[_0xfdfd('0x109')])[_0xfdfd('0x10a')];var _0x2f6b78=_0xfdfd('0x10b');var _0x1d06f2=![];var _0x2c9a12={'chatVersion':_0x2f6b78,'chatWebsiteAddressOrigin':_0x4d02b4,'remote':_0x35f79c[_0xfdfd('0x10c')],'query':querystring[_0xfdfd('0x18')](_[_0xfdfd('0x43')](_0x35f79c[_0xfdfd('0x29')]({'plain':!![]}),{'customerIp':_0x3656c3['headers'][_0xfdfd('0x9c')]||_0x3656c3[_0xfdfd('0x80')][_0xfdfd('0x10d')]||_0x3656c3[_0xfdfd('0x10e')][_0xfdfd('0x10f')]||_0x3656c3['ip'],'referer':_0x3656c3['headers']['referer'],'openedInteractions':_0x1c7402,'maxInteractions':_0x1a7438,'virtual':_0x487dc1[_0xfdfd('0x101')],'online':_0x210b36,'custom':_0x487dc1}))[_0xfdfd('0x110')](/'/g,'\x5c\x27')};_0x2efbdc[_0xfdfd('0x2e')](ejs[_0xfdfd('0xcc')](Mustache['render'](_0x3ecd48,_0x2c9a12),{'proactiveActions':_0x2a2a93,'alignment':_0x35f79c[_0xfdfd('0x111')],'verticalAlignment':_0x35f79c[_0xfdfd('0x112')],'div_color':_0x35f79c[_0xfdfd('0xf2')],'labelText':_0x35f79c[_0xfdfd('0x113')],'text_color':_0x35f79c[_0xfdfd('0x114')],'text_button_color':_0x35f79c[_0xfdfd('0x115')],'button_color':_0x35f79c[_0xfdfd('0x116')],'background_color':_0x35f79c[_0xfdfd('0x117')],'hideWhenOffline':_0x35f79c[_0xfdfd('0x118')],'intervalId':_0x35f79c['IntervalId'],'isDevelopment':_0x1d06f2,'chatVersion':_0x2f6b78}));})[_0xfdfd('0x4a')](handleError(_0x2efbdc,null));};exports[_0xfdfd('0x119')]=function(_0x4f5280,_0x3541ff){var _0x15ac3d=_0x4f5280[_0xfdfd('0x56')]['id'];var _0x5d2358=_0x4f5280['body'];var _0x4bed71=0xc8;var _0x343bd3=null;return db['sequelize'][_0xfdfd('0xd6')]({'isolationLevel':db[_0xfdfd('0xd5')]['Transaction'][_0xfdfd('0x11a')][_0xfdfd('0x11b')]},function(_0x5109f9){return db[_0xfdfd('0x46')][_0xfdfd('0x5c')]({'where':{'id':_0x15ac3d},'transaction':_0x5109f9})['then'](function(_0x12d119){if(_0x12d119){return db[_0xfdfd('0x93')][_0xfdfd('0x28')]({'where':{'ChatWebsiteId':_0x15ac3d},'transaction':_0x5109f9})['then'](function(){var _0x6baa8f=_[_0xfdfd('0x31')](_0x5d2358,function(_0x133e3e){_0x133e3e[_0xfdfd('0x59')]=_0x15ac3d;return _0x133e3e;});return db['ChatApplication'][_0xfdfd('0xd8')](_0x6baa8f,{'transaction':_0x5109f9});});}else{_0x4bed71=0x194;_0x343bd3=[];}});})['then'](function(){if(_0x4bed71!==0x194){return db[_0xfdfd('0x93')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x15ac3d},'order':_0xfdfd('0x99')})['then'](function(_0x556c03){_0x343bd3=_0x556c03;});}})[_0xfdfd('0x4a')](function(_0x55d026){_0x4bed71=0x1f4;logger[_0xfdfd('0x1b')](_0x55d026[_0xfdfd('0x2c')]);if(_0x55d026[_0xfdfd('0x2d')]){delete _0x55d026[_0xfdfd('0x2d')];}_0x343bd3=_0x55d026;})[_0xfdfd('0x11c')](function(){if(_0x343bd3===null){_0x3541ff[_0xfdfd('0x1d')](_0x4bed71);}else{if(_0x4bed71===0x1f4){_0x3541ff[_0xfdfd('0x1e')](_0x4bed71)[_0xfdfd('0x2e')](_0x343bd3);}else{_0x3541ff[_0xfdfd('0x1e')](_0x4bed71)[_0xfdfd('0x20')](_0x343bd3);}}});};exports[_0xfdfd('0x11d')]=function(_0x18b65e,_0x1e4cf5){var _0x1aa118={};var _0x4d4432={};var _0x52f279;var _0x410753;return db[_0xfdfd('0x46')][_0xfdfd('0x5c')]({'where':{'id':_0x18b65e[_0xfdfd('0x56')]['id']}})[_0xfdfd('0x27')](handleEntityNotFound(_0x1e4cf5,null))['then'](function(_0xc6ab3e){if(_0xc6ab3e){_0x52f279=_0xc6ab3e;_0x4d4432[_0xfdfd('0x35')]=_[_0xfdfd('0x37')](db[_0xfdfd('0x93')][_0xfdfd('0x5d')]);_0x4d4432[_0xfdfd('0x36')]=_[_0xfdfd('0x37')](_0x18b65e[_0xfdfd('0x36')]);_0x4d4432[_0xfdfd('0x3f')]=_['intersection'](_0x4d4432[_0xfdfd('0x35')],_0x4d4432[_0xfdfd('0x36')]);_0x1aa118['attributes']=_['intersection'](_0x4d4432[_0xfdfd('0x35')],qs[_0xfdfd('0x3a')](_0x18b65e[_0xfdfd('0x36')][_0xfdfd('0x3a')]));_0x1aa118['attributes']=_0x1aa118['attributes']['length']?_0x1aa118['attributes']:_0x4d4432[_0xfdfd('0x35')];_0x1aa118[_0xfdfd('0x5e')]=qs[_0xfdfd('0x3e')](_0x18b65e[_0xfdfd('0x36')][_0xfdfd('0x3e')]);_0x1aa118[_0xfdfd('0x42')]=qs['filters'](_[_0xfdfd('0x40')](_0x18b65e[_0xfdfd('0x36')],_0x4d4432['filters']));if(_0x18b65e['query'][_0xfdfd('0x41')]){_0x1aa118['where']=_[_0xfdfd('0x43')](_0x1aa118['where'],{'$or':_[_0xfdfd('0x31')](_0x1aa118[_0xfdfd('0x39')],function(_0x1790ca){var _0x18470e={};_0x18470e[_0x1790ca]={'$like':'%'+_0x18b65e[_0xfdfd('0x36')][_0xfdfd('0x41')]+'%'};return _0x18470e;})});}_0x1aa118=_[_0xfdfd('0x43')]({},_0x1aa118,_0x18b65e[_0xfdfd('0x45')]);return _0x52f279[_0xfdfd('0x11d')](_0x1aa118);}})['then'](function(_0x3bca92){if(_0x3bca92){_0x410753=_0x3bca92[_0xfdfd('0x3b')];if(!_0x18b65e[_0xfdfd('0x36')][_0xfdfd('0x3c')](_0xfdfd('0x3d'))){_0x1aa118[_0xfdfd('0x23')]=qs[_0xfdfd('0x23')](_0x18b65e[_0xfdfd('0x36')][_0xfdfd('0x23')]);_0x1aa118[_0xfdfd('0x21')]=qs[_0xfdfd('0x21')](_0x18b65e[_0xfdfd('0x36')]['offset']);}return _0x52f279[_0xfdfd('0x11d')](_0x1aa118);}})[_0xfdfd('0x27')](function(_0x4391a4){if(_0x4391a4){return _0x4391a4?{'count':_0x410753,'rows':_0x4391a4}:null;}})['then'](respondWithResult(_0x1e4cf5,null))['catch'](handleError(_0x1e4cf5,null));};exports['addProactiveActions']=function(_0x474727,_0x52f507){return db['chatProactiveAction'][_0xfdfd('0x51')]({'where':{'id':_0x474727[_0xfdfd('0x56')]['id']}})[_0xfdfd('0x27')](handleEntityNotFound(_0x52f507,null))['then'](function(_0x353aef){if(_0x353aef){return _0x353aef['addProactiveActions'](_0x474727[_0xfdfd('0x55')][_0xfdfd('0x64')],_[_0xfdfd('0x11e')](_0x474727[_0xfdfd('0x55')],['ids','id'])||{});}})[_0xfdfd('0x27')](respondWithResult(_0x52f507,null))[_0xfdfd('0x4a')](handleError(_0x52f507,null));};exports[_0xfdfd('0x11f')]=function(_0x5932ff,_0x306970){var _0x332d51={};var _0xbec890={};var _0x52eaac;var _0x2ce6fb;return db[_0xfdfd('0x46')][_0xfdfd('0x5c')]({'where':{'id':_0x5932ff['params']['id']}})[_0xfdfd('0x27')](handleEntityNotFound(_0x306970,null))[_0xfdfd('0x27')](function(_0x2ee742){if(_0x2ee742){_0x52eaac=_0x2ee742;_0xbec890['model']=_[_0xfdfd('0x37')](db[_0xfdfd('0x120')][_0xfdfd('0x5d')]);_0xbec890[_0xfdfd('0x36')]=_['keys'](_0x5932ff[_0xfdfd('0x36')]);_0xbec890[_0xfdfd('0x3f')]=_[_0xfdfd('0x38')](_0xbec890[_0xfdfd('0x35')],_0xbec890['query']);_0x332d51[_0xfdfd('0x39')]=_['intersection'](_0xbec890[_0xfdfd('0x35')],qs[_0xfdfd('0x3a')](_0x5932ff[_0xfdfd('0x36')]['fields']));_0x332d51['attributes']=_0x332d51[_0xfdfd('0x39')][_0xfdfd('0x3b')]?_0x332d51['attributes']:_0xbec890['model'];_0x332d51[_0xfdfd('0x5e')]=qs[_0xfdfd('0x3e')](_0x5932ff[_0xfdfd('0x36')][_0xfdfd('0x3e')]);_0x332d51[_0xfdfd('0x42')]=qs[_0xfdfd('0x3f')](_[_0xfdfd('0x40')](_0x5932ff['query'],_0xbec890[_0xfdfd('0x3f')]));if(_0x5932ff[_0xfdfd('0x36')][_0xfdfd('0x41')]){_0x332d51[_0xfdfd('0x42')]=_['merge'](_0x332d51[_0xfdfd('0x42')],{'$or':_[_0xfdfd('0x31')](_0x332d51['attributes'],function(_0x58673c){var _0x715c03={};_0x715c03[_0x58673c]={'$like':'%'+_0x5932ff['query']['filter']+'%'};return _0x715c03;})});}_0x332d51=_[_0xfdfd('0x43')]({},_0x332d51,_0x5932ff[_0xfdfd('0x45')]);return _0x52eaac[_0xfdfd('0x11f')](_0x332d51);}})[_0xfdfd('0x27')](function(_0x4fe45e){if(_0x4fe45e){_0x2ce6fb=_0x4fe45e['length'];if(!_0x5932ff[_0xfdfd('0x36')][_0xfdfd('0x3c')]('nolimit')){_0x332d51[_0xfdfd('0x23')]=qs[_0xfdfd('0x23')](_0x5932ff[_0xfdfd('0x36')][_0xfdfd('0x23')]);_0x332d51[_0xfdfd('0x21')]=qs[_0xfdfd('0x21')](_0x5932ff['query'][_0xfdfd('0x21')]);}return _0x52eaac[_0xfdfd('0x11f')](_0x332d51);}})[_0xfdfd('0x27')](function(_0x28f8d5){if(_0x28f8d5){return _0x28f8d5?{'count':_0x2ce6fb,'rows':_0x28f8d5}:null;}})['then'](respondWithResult(_0x306970,null))['catch'](handleError(_0x306970,null));};exports['getFields']=function(_0x1fa73f,_0x430971){var _0x1f6449=_0x1fa73f[_0xfdfd('0x36')][_0xfdfd('0x121')]===_0xfdfd('0x122')?_0xfdfd('0x123'):_0xfdfd('0x124');return db[_0xfdfd('0x46')]['find']({'attributes':['id',_0x1f6449],'where':{'id':_0x1fa73f[_0xfdfd('0x56')]['id']}})[_0xfdfd('0x27')](handleEntityNotFound(_0x430971,null))[_0xfdfd('0x27')](function(_0x3cbdf4){if(_0x3cbdf4){var _0x1c3961=_0x3cbdf4[_0x1f6449];var _0x32117f=_0x1c3961&&_0x1c3961[_0xfdfd('0x125')]?_0x1c3961[_0xfdfd('0x125')]:[];_0x430971['send']({'fromKey':_['isNil'](_0x1c3961['fromKey'])?undefined:_0x1c3961[_0xfdfd('0x126')],'count':_0x32117f['length'],'rows':_0x32117f});}})['catch'](handleError(_0x430971,null));};exports[_0xfdfd('0x127')]=function(_0x247e12,_0x11c504){var _0x42d987={'raw':![],'where':{}};var _0x6444c={};var _0x598017={'count':0x0,'rows':[]};return db[_0xfdfd('0x46')][_0xfdfd('0x5c')]({'where':{'id':_0x247e12[_0xfdfd('0x56')]['id']}})[_0xfdfd('0x27')](handleEntityNotFound(_0x11c504,null))[_0xfdfd('0x27')](function(_0x1cb968){if(_0x1cb968){_0x6444c['model']=_['keys'](db[_0xfdfd('0x128')]['rawAttributes']);_0x6444c[_0xfdfd('0x36')]=_['keys'](_0x247e12['query']);_0x6444c[_0xfdfd('0x3f')]=_['intersection'](_0x6444c[_0xfdfd('0x35')],_0x6444c[_0xfdfd('0x36')]);_0x42d987[_0xfdfd('0x39')]=_[_0xfdfd('0x38')](_0x6444c[_0xfdfd('0x35')],qs[_0xfdfd('0x3a')](_0x247e12[_0xfdfd('0x36')][_0xfdfd('0x3a')]));_0x42d987[_0xfdfd('0x39')]=_0x42d987[_0xfdfd('0x39')][_0xfdfd('0x3b')]?_0x42d987[_0xfdfd('0x39')]:_0x6444c[_0xfdfd('0x35')];if(!_0x247e12[_0xfdfd('0x36')][_0xfdfd('0x3c')]('nolimit')){_0x42d987[_0xfdfd('0x23')]=qs[_0xfdfd('0x23')](_0x247e12[_0xfdfd('0x36')]['limit']);_0x42d987[_0xfdfd('0x21')]=qs['offset'](_0x247e12[_0xfdfd('0x36')]['offset']);}_0x42d987[_0xfdfd('0x5e')]=qs[_0xfdfd('0x3e')](_0x247e12[_0xfdfd('0x36')][_0xfdfd('0x3e')]);_0x42d987[_0xfdfd('0x42')]=qs[_0xfdfd('0x3f')](_[_0xfdfd('0x40')](_0x247e12[_0xfdfd('0x36')],_0x6444c['filters']));_0x42d987['where']['ChatWebsiteId']=_0x1cb968['id'];if(_0x247e12[_0xfdfd('0x36')][_0xfdfd('0x41')]){_0x42d987['where']=_[_0xfdfd('0x43')](_0x42d987[_0xfdfd('0x42')],{'$or':_['map'](_0x42d987['attributes'],function(_0x4124a3){var _0x237629={};_0x237629[_0x4124a3]={'$like':'%'+_0x247e12[_0xfdfd('0x36')][_0xfdfd('0x41')]+'%'};return _0x237629;})});}_0x42d987=_[_0xfdfd('0x43')]({},_0x42d987,_0x247e12[_0xfdfd('0x45')]);return db[_0xfdfd('0x128')]['count']({'where':_0x42d987[_0xfdfd('0x42')]})[_0xfdfd('0x27')](function(_0x267afd){_0x598017[_0xfdfd('0x24')]=_0x267afd;if(_0x247e12[_0xfdfd('0x36')][_0xfdfd('0x47')]){_0x42d987[_0xfdfd('0x4d')]=[{'all':!![]}];}else{_0x42d987[_0xfdfd('0x4d')]=[{'model':db[_0xfdfd('0x83')],'as':_0xfdfd('0x129'),'required':![]},{'model':db[_0xfdfd('0xd7')],'as':_0xfdfd('0x12a'),'required':![]}];}return db['ChatOfflineMessage'][_0xfdfd('0x48')](_0x42d987);})[_0xfdfd('0x27')](function(_0x54b132){_0x598017[_0xfdfd('0x49')]=_0x54b132;return _0x598017;});}})[_0xfdfd('0x27')](respondWithFilteredResult(_0x11c504,_0x42d987))['catch'](handleError(_0x11c504,null));};exports['addAgents']=function(_0x122bda,_0x29eced){return db[_0xfdfd('0x46')][_0xfdfd('0x51')]({'where':{'id':_0x122bda[_0xfdfd('0x56')]['id']}})['then'](handleEntityNotFound(_0x29eced,null))[_0xfdfd('0x27')](function(_0x53a06c){if(_0x53a06c){return _0x53a06c[_0xfdfd('0x12b')](_0x122bda[_0xfdfd('0x55')][_0xfdfd('0x64')],_[_0xfdfd('0x11e')](_0x122bda[_0xfdfd('0x55')],['ids','id'])||{})['spread'](function(_0x32bfad){for(var _0x3953c0=0x0;_0x3953c0<_0x122bda[_0xfdfd('0x55')][_0xfdfd('0x64')][_0xfdfd('0x3b')];_0x3953c0+=0x1){socket['emit']('userChatWebsite:save',{'UserId':Number(_0x122bda[_0xfdfd('0x55')][_0xfdfd('0x64')][_0x3953c0]),'ChatWebsiteId':Number(_0x122bda[_0xfdfd('0x56')]['id'])});}return _0x32bfad;});}})[_0xfdfd('0x27')](respondWithResult(_0x29eced,null))[_0xfdfd('0x4a')](handleError(_0x29eced,null));};exports[_0xfdfd('0x12c')]=function(_0x12c32a,_0x245ac1){return db['ChatWebsite']['find']({'where':{'id':_0x12c32a[_0xfdfd('0x56')]['id']}})[_0xfdfd('0x27')](handleEntityNotFound(_0x245ac1,null))[_0xfdfd('0x27')](function(_0x1d7dec){if(_0x1d7dec){return _0x1d7dec[_0xfdfd('0x12c')](_0x12c32a['query']['ids'])[_0xfdfd('0x27')](function(){if(_[_0xfdfd('0x12d')](_0x12c32a[_0xfdfd('0x36')]['ids'])){for(var _0x261cef=0x0;_0x261cef<_0x12c32a['query']['ids'][_0xfdfd('0x3b')];_0x261cef+=0x1){socket['emit']('userChatWebsite:remove',{'UserId':Number(_0x12c32a[_0xfdfd('0x36')][_0xfdfd('0x64')][_0x261cef]),'ChatWebsiteId':Number(_0x12c32a['params']['id'])});}}else{socket[_0xfdfd('0x12e')]('userChatWebsite:remove',{'UserId':Number(_0x12c32a['query']['ids']),'ChatWebsiteId':Number(_0x12c32a[_0xfdfd('0x56')]['id'])});}});}})[_0xfdfd('0x27')](respondWithStatusCode(_0x245ac1,null))[_0xfdfd('0x4a')](handleError(_0x245ac1,null));};exports[_0xfdfd('0x12f')]=function(_0x25c849,_0x365d5c){var _0x4e4057={};var _0x4656cb={};var _0x568bca;var _0x827539;return db['ChatWebsite'][_0xfdfd('0x5c')]({'where':{'id':_0x25c849[_0xfdfd('0x56')]['id']}})['then'](handleEntityNotFound(_0x365d5c,null))[_0xfdfd('0x27')](function(_0x2fa15a){if(_0x2fa15a){_0x568bca=_0x2fa15a;_0x4656cb[_0xfdfd('0x35')]=_[_0xfdfd('0x37')](db[_0xfdfd('0xb9')]['rawAttributes']);_0x4656cb[_0xfdfd('0x36')]=_[_0xfdfd('0x37')](_0x25c849['query']);_0x4656cb['filters']=_[_0xfdfd('0x38')](_0x4656cb[_0xfdfd('0x35')],_0x4656cb[_0xfdfd('0x36')]);_0x4e4057[_0xfdfd('0x39')]=_[_0xfdfd('0x38')](_0x4656cb[_0xfdfd('0x35')],qs['fields'](_0x25c849[_0xfdfd('0x36')][_0xfdfd('0x3a')]));_0x4e4057['attributes']=_0x4e4057[_0xfdfd('0x39')]['length']?_0x4e4057[_0xfdfd('0x39')]:_0x4656cb[_0xfdfd('0x35')];_0x4e4057[_0xfdfd('0x5e')]=qs[_0xfdfd('0x3e')](_0x25c849[_0xfdfd('0x36')][_0xfdfd('0x3e')]);_0x4e4057[_0xfdfd('0x42')]=qs[_0xfdfd('0x3f')](_['pick'](_0x25c849[_0xfdfd('0x36')],_0x4656cb[_0xfdfd('0x3f')]));if(_0x25c849[_0xfdfd('0x36')][_0xfdfd('0x41')]){_0x4e4057[_0xfdfd('0x42')]=_[_0xfdfd('0x43')](_0x4e4057['where'],{'$or':_[_0xfdfd('0x31')](_0x4e4057['attributes'],function(_0x325e88){var _0x730e6c={};_0x730e6c[_0x325e88]={'$like':'%'+_0x25c849['query'][_0xfdfd('0x41')]+'%'};return _0x730e6c;})});}_0x4e4057=_[_0xfdfd('0x43')]({},_0x4e4057,_0x25c849[_0xfdfd('0x45')]);return _0x568bca[_0xfdfd('0x12f')](_0x4e4057);}})[_0xfdfd('0x27')](function(_0x2d0840){if(_0x2d0840){_0x827539=_0x2d0840['length'];if(!_0x25c849[_0xfdfd('0x36')]['hasOwnProperty'](_0xfdfd('0x3d'))){_0x4e4057[_0xfdfd('0x23')]=qs[_0xfdfd('0x23')](_0x25c849[_0xfdfd('0x36')][_0xfdfd('0x23')]);_0x4e4057['offset']=qs['offset'](_0x25c849[_0xfdfd('0x36')]['offset']);}return _0x568bca[_0xfdfd('0x12f')](_0x4e4057);}})[_0xfdfd('0x27')](function(_0x269840){if(_0x269840){return _0x269840?{'count':_0x827539,'rows':_0x269840}:null;}})[_0xfdfd('0x27')](respondWithResult(_0x365d5c,null))['catch'](handleError(_0x365d5c,null));}; \ No newline at end of file +var _0x34cb=['ContactId','interaction','contact','messageId','created','push','close','unmanaged','ChatMessage','AttachmentId','User','UserId','unshift','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','startRouting','Start','EventManager','offline','files','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','spread','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','ChatOfflineMessage','fromString','mimetype','server','attachments','offline-chat','basename','openNewInteraction','transaction','Attachment','bulkCreate','Smtp','CloudProvider','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','email','forwardOfflineAddress','originalname','subjectOffline','toPairsIn','offlineMessageSubject','Chat','MailAccountId','NotifyMailAccount','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','Tag','Tags','color','tag','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','No\x20timezone','inspect','Interval','Intervals','getProactiveActions','../../config/license/util','getLicense','virtual','custom','chatLicenseExceeded','some','server/files/chat/iframe.ejs','address','origin','3.1.0','x-real-ip','connection','remoteAddress','replace','alignment','verticalAlignment','labelText','textColor','color_button','backgroundColor','hideWhenOffline','IntervalId','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','finally','json','getApplications','addProactiveActions','ChatProactiveAction','getFields','online','false','onlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','userChatWebsite:remove','getAgents','mustache','path','ejs','fs-extra','lodash','querystring','../../components/parsers/qs','../../config/logger','api','../../config/environment','url','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','html-to-text','jayson/promise','client','http','request','then','ChatWebsite,\x20%s,\x20%s','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','message','info','request\x20sent','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','update','destroy','get','stack','name','send','Pause','mandatoryDispositionPause','ChatWebsite','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','map','options','includeAll','include','findAll','rows','catch','params','keys','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','order','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','addLogo','sitepic','file','filename','addAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','isNil','existsSync','root','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','agentAvatar','server/files/images/avatars/','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','notify','user-agent-parser','setUA','headers','user-agent','getResult','CmContact','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ListId','from','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','ChatApplication','Applications','List','account','applications','list','orderBy','priority','asc','mapKey','customerIp','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','referer','browser','version','format','unknown','%s\x20%s','device','vendor','%s\x20%s\x20%s','threadId','ChatInteraction','externalUrl'];(function(_0x53af79,_0x45274e){var _0x4d827b=function(_0x543d29){while(--_0x543d29){_0x53af79['push'](_0x53af79['shift']());}};_0x4d827b(++_0x45274e);}(_0x34cb,0x1aa));var _0xb34c=function(_0x3af2a5,_0x2ca3f9){_0x3af2a5=_0x3af2a5-0x0;var _0x43c05a=_0x34cb[_0x3af2a5];return _0x43c05a;};'use strict';var BPromise=require('bluebird');var Mustache=require(_0xb34c('0x0'));var util=require('util');var path=require(_0xb34c('0x1'));var ejs=require(_0xb34c('0x2'));var fs=require('fs');var fs_extra=require(_0xb34c('0x3'));var _=require(_0xb34c('0x4'));var querystring=require(_0xb34c('0x5'));var Redis=require('ioredis');var qs=require(_0xb34c('0x6'));var logger=require(_0xb34c('0x7'))(_0xb34c('0x8'));var config=require(_0xb34c('0x9'));var url=require(_0xb34c('0xa'));var db=require('../../mysqldb')['db'];config[_0xb34c('0xb')]=_[_0xb34c('0xc')](config[_0xb34c('0xb')],{'host':_0xb34c('0xd'),'port':0x18eb});var socket=require(_0xb34c('0xe'))(new Redis(config[_0xb34c('0xb')]));require(_0xb34c('0xf'))['register'](socket);var htmlToText=require(_0xb34c('0x10'));var jayson=require(_0xb34c('0x11'));var client=jayson[_0xb34c('0x12')][_0xb34c('0x13')]({'port':0x232c});var client9002=jayson['client'][_0xb34c('0x13')]({'port':0x232a});var client9003=jayson[_0xb34c('0x12')]['http']({'port':0x232b});var client9001=jayson[_0xb34c('0x12')]['http']({'port':0x2329});function respondWithRpcPromise(_0xabc229,_0x9cd9bf,_0x139bd3,_0x40b71c){return new BPromise(function(_0xc2d7c7,_0xe3c0e4){var _0x27dd76=_0x40b71c||client;return _0x27dd76[_0xb34c('0x14')](_0xabc229,_0x139bd3)[_0xb34c('0x15')](function(_0x3b3acd){logger['info'](_0xb34c('0x16'),_0x9cd9bf,'request\x20sent');logger['debug'](_0xb34c('0x17'),_0x9cd9bf,'request\x20sent',JSON[_0xb34c('0x18')](_0x3b3acd));if(_0x3b3acd[_0xb34c('0x19')]){if(_0x3b3acd['error']['code']===0x1f4){logger['error'](_0xb34c('0x16'),_0x9cd9bf,_0x3b3acd[_0xb34c('0x19')][_0xb34c('0x1a')]);return _0xe3c0e4(_0x3b3acd[_0xb34c('0x19')][_0xb34c('0x1a')]);}logger[_0xb34c('0x19')]('ChatWebsite,\x20%s,\x20%s',_0x9cd9bf,_0x3b3acd[_0xb34c('0x19')][_0xb34c('0x1a')]);return _0xc2d7c7(_0x3b3acd[_0xb34c('0x19')]['message']);}else{logger[_0xb34c('0x1b')](_0xb34c('0x16'),_0x9cd9bf,_0xb34c('0x1c'));_0xc2d7c7(_0x3b3acd['result']['message']);}})['catch'](function(_0x2631c0){logger[_0xb34c('0x19')]('ChatWebsite,\x20%s,\x20%s',_0x9cd9bf,_0x2631c0);_0xe3c0e4(_0x2631c0);});});}function respondWithStatusCode(_0x588010,_0x53c687){_0x53c687=_0x53c687||0xcc;return function(_0x262d88){if(_0x262d88){return _0x588010[_0xb34c('0x1d')](_0x53c687);}return _0x588010[_0xb34c('0x1e')](_0x53c687)[_0xb34c('0x1f')]();};}function respondWithResult(_0x488a54,_0x192bdd){_0x192bdd=_0x192bdd||0xc8;return function(_0x17d7b6){if(_0x17d7b6){return _0x488a54[_0xb34c('0x1e')](_0x192bdd)['json'](_0x17d7b6);}};}function respondWithFilteredResult(_0x152f74,_0x2f9db7){return function(_0x286cea){if(_0x286cea){var _0xa2e90d=typeof _0x2f9db7[_0xb34c('0x20')]===_0xb34c('0x21')&&typeof _0x2f9db7[_0xb34c('0x22')]===_0xb34c('0x21');var _0x59649f=_0x286cea[_0xb34c('0x23')];var _0x5c769f=_0xa2e90d?0x0:_0x2f9db7[_0xb34c('0x20')];var _0x28ddf6=_0xa2e90d?_0x286cea['count']:_0x2f9db7[_0xb34c('0x20')]+_0x2f9db7[_0xb34c('0x22')];var _0xb392f9;if(_0x28ddf6>=_0x59649f){_0x28ddf6=_0x59649f;_0xb392f9=0xc8;}else{_0xb392f9=0xce;}_0x152f74['status'](_0xb392f9);return _0x152f74[_0xb34c('0x24')](_0xb34c('0x25'),_0x5c769f+'-'+_0x28ddf6+'/'+_0x59649f)['json'](_0x286cea);}return null;};}function saveUpdates(_0xdbe791){return function(_0x2d0b58){if(_0x2d0b58){return _0x2d0b58[_0xb34c('0x26')](_0xdbe791)[_0xb34c('0x15')](function(_0x172364){return _0x172364;});}return null;};}function removeEntity(_0x351020){return function(_0x3c8f1d){if(_0x3c8f1d){return _0x3c8f1d[_0xb34c('0x27')]()[_0xb34c('0x15')](function(){var _0x435bc7=_0x3c8f1d[_0xb34c('0x28')]({'plain':!![]});var _0x51a0e2='ChatWebsites';return db['UserProfileResource'][_0xb34c('0x27')]({'where':{'type':_0x51a0e2,'resourceId':_0x435bc7['id']}})[_0xb34c('0x15')](function(){return _0x3c8f1d;});})[_0xb34c('0x15')](function(){_0x351020[_0xb34c('0x1e')](0xcc)[_0xb34c('0x1f')]();});}};}function handleEntityNotFound(_0x39d38e){return function(_0x2e9b2e){if(!_0x2e9b2e){_0x39d38e[_0xb34c('0x1d')](0x194);}return _0x2e9b2e;};}function handleError(_0x1dbd2e,_0x5b39c4){_0x5b39c4=_0x5b39c4||0x1f4;return function(_0x523c66){logger[_0xb34c('0x19')](_0x523c66[_0xb34c('0x29')]);if(_0x523c66[_0xb34c('0x2a')]){delete _0x523c66[_0xb34c('0x2a')];}_0x1dbd2e[_0xb34c('0x1e')](_0x5b39c4)[_0xb34c('0x2b')](_0x523c66);};}exports['index']=function(_0x1df379,_0x4270f7){var _0x166861={'include':[{'model':db[_0xb34c('0x2c')],'as':_0xb34c('0x2d')}]},_0x400198={},_0x266252={'count':0x0,'rows':[]};var _0x2c8327=_['map'](db[_0xb34c('0x2e')]['rawAttributes'],function(_0x304e04){return{'name':_0x304e04[_0xb34c('0x2f')],'type':_0x304e04[_0xb34c('0x30')][_0xb34c('0x31')]};});_0x400198[_0xb34c('0x32')]=_['map'](_0x2c8327,_0xb34c('0x2a'));_0x400198[_0xb34c('0x33')]=_['keys'](_0x1df379[_0xb34c('0x33')]);_0x400198[_0xb34c('0x34')]=_[_0xb34c('0x35')](_0x400198['model'],_0x400198[_0xb34c('0x33')]);_0x166861[_0xb34c('0x36')]=_[_0xb34c('0x35')](_0x400198[_0xb34c('0x32')],qs[_0xb34c('0x37')](_0x1df379['query'][_0xb34c('0x37')]));_0x166861[_0xb34c('0x36')]=_0x166861[_0xb34c('0x36')][_0xb34c('0x38')]?_0x166861[_0xb34c('0x36')]:_0x400198[_0xb34c('0x32')];if(!_0x1df379[_0xb34c('0x33')][_0xb34c('0x39')](_0xb34c('0x3a'))){_0x166861[_0xb34c('0x22')]=qs[_0xb34c('0x22')](_0x1df379[_0xb34c('0x33')][_0xb34c('0x22')]);_0x166861[_0xb34c('0x20')]=qs[_0xb34c('0x20')](_0x1df379[_0xb34c('0x33')][_0xb34c('0x20')]);}_0x166861['order']=qs[_0xb34c('0x3b')](_0x1df379[_0xb34c('0x33')][_0xb34c('0x3b')]);_0x166861[_0xb34c('0x3c')]=qs[_0xb34c('0x34')](_[_0xb34c('0x3d')](_0x1df379[_0xb34c('0x33')],_0x400198[_0xb34c('0x34')]),_0x2c8327);if(_0x1df379[_0xb34c('0x33')][_0xb34c('0x3e')]){_0x166861['where']=_[_0xb34c('0x3f')](_0x166861[_0xb34c('0x3c')],{'$or':_[_0xb34c('0x40')](_0x2c8327,function(_0x5c1895){if(_0x5c1895[_0xb34c('0x30')]!=='VIRTUAL'){var _0x400a09={};_0x400a09[_0x5c1895[_0xb34c('0x2a')]]={'$like':'%'+_0x1df379[_0xb34c('0x33')][_0xb34c('0x3e')]+'%'};return _0x400a09;}})});}_0x166861=_[_0xb34c('0x3f')]({},_0x166861,_0x1df379[_0xb34c('0x41')]);var _0x10796d={'where':_0x166861[_0xb34c('0x3c')]};return db['ChatWebsite'][_0xb34c('0x23')](_0x10796d)[_0xb34c('0x15')](function(_0x224e91){_0x266252[_0xb34c('0x23')]=_0x224e91;if(_0x1df379[_0xb34c('0x33')][_0xb34c('0x42')]){_0x166861[_0xb34c('0x43')]=[{'all':!![]}];}return db[_0xb34c('0x2e')][_0xb34c('0x44')](_0x166861);})[_0xb34c('0x15')](function(_0x3e1b68){_0x266252[_0xb34c('0x45')]=_0x3e1b68;return _0x266252;})[_0xb34c('0x15')](respondWithFilteredResult(_0x4270f7,_0x166861))[_0xb34c('0x46')](handleError(_0x4270f7,null));};exports['show']=function(_0x1827ac,_0x2c355a){var _0x165e92={'raw':![],'where':{'id':_0x1827ac[_0xb34c('0x47')]['id']},'include':[{'model':db[_0xb34c('0x2c')],'as':'mandatoryDispositionPause'}]},_0x32927b={};_0x32927b[_0xb34c('0x32')]=_[_0xb34c('0x48')](db['ChatWebsite'][_0xb34c('0x49')]);_0x32927b[_0xb34c('0x33')]=_[_0xb34c('0x48')](_0x1827ac[_0xb34c('0x33')]);_0x32927b[_0xb34c('0x34')]=_['intersection'](_0x32927b[_0xb34c('0x32')],_0x32927b[_0xb34c('0x33')]);_0x165e92['attributes']=_[_0xb34c('0x35')](_0x32927b[_0xb34c('0x32')],qs['fields'](_0x1827ac[_0xb34c('0x33')][_0xb34c('0x37')]));_0x165e92[_0xb34c('0x36')]=_0x165e92['attributes'][_0xb34c('0x38')]?_0x165e92[_0xb34c('0x36')]:_0x32927b[_0xb34c('0x32')];if(_0x1827ac[_0xb34c('0x33')][_0xb34c('0x42')]){_0x165e92['include']=[{'all':!![]}];}_0x165e92=_['merge']({},_0x165e92,_0x1827ac['options']);return db['ChatWebsite'][_0xb34c('0x4a')](_0x165e92)[_0xb34c('0x15')](handleEntityNotFound(_0x2c355a,null))[_0xb34c('0x15')](respondWithResult(_0x2c355a,null))['catch'](handleError(_0x2c355a,null));};exports[_0xb34c('0x4b')]=function(_0xc9992,_0x1e60ab){return db['ChatWebsite'][_0xb34c('0x4b')](_0xc9992[_0xb34c('0x4c')],{})['then'](function(_0x4aff8e){var _0x33f433=_0xc9992[_0xb34c('0x4d')][_0xb34c('0x28')]({'plain':!![]});if(!_0x33f433)throw new Error(_0xb34c('0x4e'));if(_0x33f433[_0xb34c('0x4f')]==='user'){var _0x2803a1=_0x4aff8e[_0xb34c('0x28')]({'plain':!![]});var _0x1a0b01='ChatWebsites';return db['UserProfileSection'][_0xb34c('0x4a')]({'where':{'name':_0x1a0b01,'userProfileId':_0x33f433[_0xb34c('0x50')]},'raw':!![]})[_0xb34c('0x15')](function(_0x5b66c1){if(_0x5b66c1&&_0x5b66c1[_0xb34c('0x51')]===0x0){return db[_0xb34c('0x52')][_0xb34c('0x4b')]({'name':_0x2803a1['name'],'resourceId':_0x2803a1['id'],'type':_0x5b66c1[_0xb34c('0x2a')],'sectionId':_0x5b66c1['id']},{})[_0xb34c('0x15')](function(){return _0x4aff8e;});}else{return _0x4aff8e;}})[_0xb34c('0x46')](function(_0x4aba45){logger[_0xb34c('0x19')](_0xb34c('0x53'),_0x4aba45);throw _0x4aba45;});}return _0x4aff8e;})[_0xb34c('0x15')](respondWithResult(_0x1e60ab,0xc9))['catch'](handleError(_0x1e60ab,null));};exports[_0xb34c('0x26')]=function(_0x346a77,_0x2fb7c1){if(_0x346a77[_0xb34c('0x4c')]['id']){delete _0x346a77[_0xb34c('0x4c')]['id'];}return db[_0xb34c('0x2e')][_0xb34c('0x4a')]({'where':{'id':_0x346a77[_0xb34c('0x47')]['id']},'include':[{'model':db[_0xb34c('0x2c')],'as':_0xb34c('0x2d')}]})[_0xb34c('0x15')](handleEntityNotFound(_0x2fb7c1,null))[_0xb34c('0x15')](saveUpdates(_0x346a77[_0xb34c('0x4c')],null))['then'](respondWithResult(_0x2fb7c1,null))[_0xb34c('0x46')](handleError(_0x2fb7c1,null));};exports['destroy']=function(_0x29677f,_0x12412d){return db[_0xb34c('0x2e')][_0xb34c('0x4a')]({'where':{'id':_0x29677f[_0xb34c('0x47')]['id']}})[_0xb34c('0x15')](handleEntityNotFound(_0x12412d,null))[_0xb34c('0x15')](removeEntity(_0x12412d,null))[_0xb34c('0x46')](handleError(_0x12412d,null));};exports[_0xb34c('0x54')]=function(_0x27df85,_0x3dea40){return db[_0xb34c('0x2e')][_0xb34c('0x54')]()[_0xb34c('0x15')](respondWithResult(_0x3dea40,null))['catch'](handleError(_0x3dea40,null));};exports[_0xb34c('0x55')]=function(_0x475b7a,_0x49b5bf){if(_0x475b7a[_0xb34c('0x4c')]['id']){delete _0x475b7a['body']['id'];}return db[_0xb34c('0x2e')][_0xb34c('0x4a')]({'where':{'id':_0x475b7a[_0xb34c('0x47')]['id']}})['then'](handleEntityNotFound(_0x49b5bf,null))['then'](function(_0xc1bab5){if(_0xc1bab5){_0x475b7a['body'][_0xb34c('0x56')]=_0xc1bab5['id'];return db[_0xb34c('0x57')][_0xb34c('0x4b')](_0x475b7a[_0xb34c('0x4c')]);}})['then'](respondWithResult(_0x49b5bf,null))[_0xb34c('0x46')](handleError(_0x49b5bf,null));};exports[_0xb34c('0x58')]=function(_0x20ae6b,_0x23d7fa){var _0x5ebacd={'raw':![],'where':{}};var _0x266ebf={};var _0x2f5ef0={'count':0x0,'rows':[]};return db[_0xb34c('0x2e')][_0xb34c('0x59')]({'where':{'id':_0x20ae6b['params']['id']}})[_0xb34c('0x15')](handleEntityNotFound(_0x23d7fa,null))['then'](function(_0x234e72){if(_0x234e72){_0x266ebf[_0xb34c('0x32')]=_[_0xb34c('0x48')](db[_0xb34c('0x57')]['rawAttributes']);_0x266ebf[_0xb34c('0x33')]=_['keys'](_0x20ae6b[_0xb34c('0x33')]);_0x266ebf[_0xb34c('0x34')]=_[_0xb34c('0x35')](_0x266ebf[_0xb34c('0x32')],_0x266ebf[_0xb34c('0x33')]);_0x5ebacd[_0xb34c('0x36')]=_[_0xb34c('0x35')](_0x266ebf['model'],qs[_0xb34c('0x37')](_0x20ae6b[_0xb34c('0x33')][_0xb34c('0x37')]));_0x5ebacd['attributes']=_0x5ebacd[_0xb34c('0x36')][_0xb34c('0x38')]?_0x5ebacd['attributes']:_0x266ebf[_0xb34c('0x32')];if(!_0x20ae6b[_0xb34c('0x33')]['hasOwnProperty'](_0xb34c('0x3a'))){_0x5ebacd['limit']=qs[_0xb34c('0x22')](_0x20ae6b[_0xb34c('0x33')][_0xb34c('0x22')]);_0x5ebacd[_0xb34c('0x20')]=qs['offset'](_0x20ae6b['query'][_0xb34c('0x20')]);}_0x5ebacd[_0xb34c('0x5a')]=qs[_0xb34c('0x3b')](_0x20ae6b[_0xb34c('0x33')][_0xb34c('0x3b')]);_0x5ebacd[_0xb34c('0x3c')]=qs[_0xb34c('0x34')](_['pick'](_0x20ae6b['query'],_0x266ebf[_0xb34c('0x34')]));_0x5ebacd[_0xb34c('0x3c')][_0xb34c('0x56')]=_0x234e72['id'];if(_0x20ae6b[_0xb34c('0x33')][_0xb34c('0x3e')]){_0x5ebacd[_0xb34c('0x3c')]=_[_0xb34c('0x3f')](_0x5ebacd['where'],{'$or':_[_0xb34c('0x40')](_0x5ebacd[_0xb34c('0x36')],function(_0x318a0b){var _0x4ec3b3={};_0x4ec3b3[_0x318a0b]={'$like':'%'+_0x20ae6b['query']['filter']+'%'};return _0x4ec3b3;})});}_0x5ebacd=_[_0xb34c('0x3f')]({},_0x5ebacd,_0x20ae6b[_0xb34c('0x41')]);return db[_0xb34c('0x57')][_0xb34c('0x23')]({'where':_0x5ebacd[_0xb34c('0x3c')]})[_0xb34c('0x15')](function(_0x32df89){_0x2f5ef0[_0xb34c('0x23')]=_0x32df89;if(_0x20ae6b[_0xb34c('0x33')][_0xb34c('0x42')]){_0x5ebacd[_0xb34c('0x43')]=[{'all':!![]}];}return db['Disposition'][_0xb34c('0x44')](_0x5ebacd);})[_0xb34c('0x15')](function(_0x576ff6){_0x2f5ef0[_0xb34c('0x45')]=_0x576ff6;return _0x2f5ef0;});}})[_0xb34c('0x15')](respondWithFilteredResult(_0x23d7fa,_0x5ebacd))[_0xb34c('0x46')](handleError(_0x23d7fa,null));};exports['removeDispositions']=function(_0x1f4039,_0x666022){return db[_0xb34c('0x2e')][_0xb34c('0x4a')]({'where':{'id':_0x1f4039['params']['id']}})['then'](handleEntityNotFound(_0x666022,null))[_0xb34c('0x15')](function(_0x2392de){if(_0x2392de){return _0x2392de[_0xb34c('0x5b')](_0x1f4039['query'][_0xb34c('0x5c')]);}})[_0xb34c('0x15')](respondWithStatusCode(_0x666022,null))[_0xb34c('0x46')](handleError(_0x666022,null));};exports[_0xb34c('0x5d')]=function(_0x56a374,_0x4ad259){if(_0x56a374[_0xb34c('0x4c')]['id']){delete _0x56a374[_0xb34c('0x4c')]['id'];}return db['ChatWebsite'][_0xb34c('0x4a')]({'where':{'id':_0x56a374[_0xb34c('0x47')]['id']}})[_0xb34c('0x15')](handleEntityNotFound(_0x4ad259,null))[_0xb34c('0x15')](function(_0x4e9119){if(_0x4e9119){_0x56a374[_0xb34c('0x4c')][_0xb34c('0x56')]=_0x4e9119['id'];return db[_0xb34c('0x5e')][_0xb34c('0x4b')](_0x56a374[_0xb34c('0x4c')]);}})['then'](respondWithResult(_0x4ad259,null))[_0xb34c('0x46')](handleError(_0x4ad259,null));};exports['getAnswers']=function(_0xebf721,_0x3fd097){var _0xea1dd4={'raw':![],'where':{}};var _0x3d12a8={};var _0x208afb={'count':0x0,'rows':[]};return db[_0xb34c('0x2e')]['findOne']({'where':{'id':_0xebf721[_0xb34c('0x47')]['id']}})[_0xb34c('0x15')](handleEntityNotFound(_0x3fd097,null))[_0xb34c('0x15')](function(_0x4d6129){if(_0x4d6129){_0x3d12a8[_0xb34c('0x32')]=_['keys'](db[_0xb34c('0x5e')][_0xb34c('0x49')]);_0x3d12a8[_0xb34c('0x33')]=_[_0xb34c('0x48')](_0xebf721[_0xb34c('0x33')]);_0x3d12a8[_0xb34c('0x34')]=_['intersection'](_0x3d12a8[_0xb34c('0x32')],_0x3d12a8[_0xb34c('0x33')]);_0xea1dd4[_0xb34c('0x36')]=_[_0xb34c('0x35')](_0x3d12a8[_0xb34c('0x32')],qs[_0xb34c('0x37')](_0xebf721[_0xb34c('0x33')]['fields']));_0xea1dd4['attributes']=_0xea1dd4[_0xb34c('0x36')]['length']?_0xea1dd4[_0xb34c('0x36')]:_0x3d12a8[_0xb34c('0x32')];if(!_0xebf721['query'][_0xb34c('0x39')](_0xb34c('0x3a'))){_0xea1dd4['limit']=qs[_0xb34c('0x22')](_0xebf721['query']['limit']);_0xea1dd4[_0xb34c('0x20')]=qs[_0xb34c('0x20')](_0xebf721[_0xb34c('0x33')][_0xb34c('0x20')]);}_0xea1dd4[_0xb34c('0x5a')]=qs[_0xb34c('0x3b')](_0xebf721[_0xb34c('0x33')]['sort']);_0xea1dd4[_0xb34c('0x3c')]=qs[_0xb34c('0x34')](_['pick'](_0xebf721[_0xb34c('0x33')],_0x3d12a8[_0xb34c('0x34')]));_0xea1dd4[_0xb34c('0x3c')]['ChatWebsiteId']=_0x4d6129['id'];if(_0xebf721[_0xb34c('0x33')][_0xb34c('0x3e')]){_0xea1dd4['where']=_[_0xb34c('0x3f')](_0xea1dd4[_0xb34c('0x3c')],{'$or':_[_0xb34c('0x40')](_0xea1dd4[_0xb34c('0x36')],function(_0x10603a){var _0x1f57fe={};_0x1f57fe[_0x10603a]={'$like':'%'+_0xebf721[_0xb34c('0x33')]['filter']+'%'};return _0x1f57fe;})});}_0xea1dd4=_[_0xb34c('0x3f')]({},_0xea1dd4,_0xebf721[_0xb34c('0x41')]);return db[_0xb34c('0x5e')][_0xb34c('0x23')]({'where':_0xea1dd4[_0xb34c('0x3c')]})['then'](function(_0x2368db){_0x208afb[_0xb34c('0x23')]=_0x2368db;if(_0xebf721[_0xb34c('0x33')]['includeAll']){_0xea1dd4[_0xb34c('0x43')]=[{'all':!![]}];}return db[_0xb34c('0x5e')][_0xb34c('0x44')](_0xea1dd4);})[_0xb34c('0x15')](function(_0x11d3df){_0x208afb['rows']=_0x11d3df;return _0x208afb;});}})['then'](respondWithFilteredResult(_0x3fd097,_0xea1dd4))['catch'](handleError(_0x3fd097,null));};exports[_0xb34c('0x5f')]=function(_0x596d1d,_0x40e42b){return db[_0xb34c('0x2e')][_0xb34c('0x4a')]({'where':{'id':_0x596d1d['params']['id']}})['then'](handleEntityNotFound(_0x40e42b,null))[_0xb34c('0x15')](function(_0x33840a){if(_0x33840a){return _0x33840a[_0xb34c('0x5f')](_0x596d1d['query'][_0xb34c('0x5c')]);}})['then'](respondWithStatusCode(_0x40e42b,null))[_0xb34c('0x46')](handleError(_0x40e42b,null));};exports[_0xb34c('0x60')]=function(_0x34f086,_0x3d78aa){_0x34f086[_0xb34c('0x4c')][_0xb34c('0x61')]=_0x34f086[_0xb34c('0x62')][_0xb34c('0x63')];return db['ChatWebsite'][_0xb34c('0x4a')]({'where':{'id':_0x34f086[_0xb34c('0x47')]['id']}})[_0xb34c('0x15')](handleEntityNotFound(_0x3d78aa,null))[_0xb34c('0x15')](saveUpdates(_0x34f086[_0xb34c('0x4c')],null))[_0xb34c('0x15')](respondWithResult(_0x3d78aa,null))[_0xb34c('0x46')](handleError(_0x3d78aa,null));};exports[_0xb34c('0x64')]=function(_0x13d3ee,_0x4d49fb){_0x13d3ee[_0xb34c('0x4c')]['agentAvatar']=_0x13d3ee[_0xb34c('0x62')]['filename'];return db[_0xb34c('0x2e')][_0xb34c('0x4a')]({'where':{'id':_0x13d3ee['params']['id']}})[_0xb34c('0x15')](handleEntityNotFound(_0x4d49fb,null))['then'](saveUpdates(_0x13d3ee[_0xb34c('0x4c')],null))[_0xb34c('0x15')](respondWithResult(_0x4d49fb,null))[_0xb34c('0x46')](handleError(_0x4d49fb,null));};exports['addCustomerAvatar']=function(_0x35b21c,_0x2ae871){_0x35b21c[_0xb34c('0x4c')][_0xb34c('0x65')]=_0x35b21c[_0xb34c('0x62')][_0xb34c('0x63')];return db[_0xb34c('0x2e')]['find']({'where':{'id':_0x35b21c[_0xb34c('0x47')]['id']}})['then'](handleEntityNotFound(_0x2ae871,null))[_0xb34c('0x15')](saveUpdates(_0x35b21c[_0xb34c('0x4c')],null))[_0xb34c('0x15')](respondWithResult(_0x2ae871,null))[_0xb34c('0x46')](handleError(_0x2ae871,null));};exports[_0xb34c('0x66')]=function(_0x201b4d,_0x2afa71){_0x201b4d[_0xb34c('0x4c')][_0xb34c('0x67')]=_0x201b4d[_0xb34c('0x62')][_0xb34c('0x63')];return db['ChatWebsite'][_0xb34c('0x4a')]({'where':{'id':_0x201b4d['params']['id']}})[_0xb34c('0x15')](handleEntityNotFound(_0x2afa71,null))['then'](saveUpdates(_0x201b4d[_0xb34c('0x4c')],null))[_0xb34c('0x15')](respondWithResult(_0x2afa71,null))[_0xb34c('0x46')](handleError(_0x2afa71,null));};exports[_0xb34c('0x68')]=function(_0x34a26d,_0x31afac){var _0x20632a=path[_0xb34c('0x69')](config['root'],'server/files/images/logos/default_logo.svg');var _0x426e9d={'where':{'id':_0x34a26d[_0xb34c('0x47')]['id']},'attributes':['id',_0xb34c('0x61')],'raw':!![]};var _0xd1cf8f=![];return require('../../config/license/util')['getLicense']()['then'](function(_0x360765){if(_0x360765){_0xd1cf8f=_0x360765['custom'];}})['then'](function(){return db['ChatWebsite']['find'](_0x426e9d);})[_0xb34c('0x15')](handleEntityNotFound(_0x31afac,null))[_0xb34c('0x15')](function(_0x244015){if(_0x244015){if(!_[_0xb34c('0x6a')](_0x244015[_0xb34c('0x61')])){if(fs[_0xb34c('0x6b')](path['join'](config[_0xb34c('0x6c')],_0xb34c('0x6d'),_0x244015['sitepic']))&&_0xd1cf8f){_0x20632a=path[_0xb34c('0x69')](config[_0xb34c('0x6c')],'server/files/images/logos/',_0x244015[_0xb34c('0x61')]);}}return _0x31afac[_0xb34c('0x6e')](_0x20632a);}})[_0xb34c('0x46')](handleError(_0x31afac,null));};exports[_0xb34c('0x6f')]=function(_0x34a36b,_0x2f7035){var _0x29e095=path['join'](config[_0xb34c('0x6c')],_0xb34c('0x70'));var _0x3dc1f7={'where':{'id':_0x34a36b[_0xb34c('0x47')]['id']},'attributes':['id',_0xb34c('0x71')],'raw':!![]};return db[_0xb34c('0x2e')][_0xb34c('0x4a')](_0x3dc1f7)[_0xb34c('0x15')](handleEntityNotFound(_0x2f7035,null))['then'](function(_0x2120f8){if(_0x2120f8){if(!_['isNil'](_0x2120f8[_0xb34c('0x71')])){if(fs[_0xb34c('0x6b')](path['join'](config[_0xb34c('0x6c')],_0xb34c('0x72'),_0x2120f8[_0xb34c('0x71')]))){_0x29e095=path['join'](config['root'],_0xb34c('0x72'),_0x2120f8[_0xb34c('0x71')]);}}return _0x2f7035[_0xb34c('0x6e')](_0x29e095);}})['catch'](handleError(_0x2f7035,null));};exports['getCustomerAvatar']=function(_0xd936e1,_0x38978a){var _0x11b09b=path['join'](config[_0xb34c('0x6c')],_0xb34c('0x73'));var _0x1b7c0d={'where':{'id':_0xd936e1['params']['id']},'attributes':['id','customerAvatar',_0xb34c('0x74')],'raw':!![]};return db[_0xb34c('0x2e')][_0xb34c('0x4a')](_0x1b7c0d)[_0xb34c('0x15')](handleEntityNotFound(_0x38978a,null))[_0xb34c('0x15')](function(_0x1acee9){if(_0x1acee9){if(!_[_0xb34c('0x6a')](_0x1acee9[_0xb34c('0x65')])){if(fs[_0xb34c('0x6b')](path[_0xb34c('0x69')](config['root'],_0xb34c('0x72'),_0x1acee9[_0xb34c('0x65')]))&&_0x1acee9[_0xb34c('0x74')]){_0x11b09b=path[_0xb34c('0x69')](config[_0xb34c('0x6c')],_0xb34c('0x72'),_0x1acee9[_0xb34c('0x65')]);}}return _0x38978a[_0xb34c('0x6e')](_0x11b09b);}})[_0xb34c('0x46')](handleError(_0x38978a,null));};exports[_0xb34c('0x75')]=function(_0x78691,_0x4509f1){var _0x126e60=path[_0xb34c('0x69')](config['root'],'server/files/images/avatars/system_avatar.png');var _0x47c3f2={'where':{'id':_0x78691[_0xb34c('0x47')]['id']},'attributes':['id',_0xb34c('0x67')],'raw':!![]};return db[_0xb34c('0x2e')][_0xb34c('0x4a')](_0x47c3f2)['then'](handleEntityNotFound(_0x4509f1,null))[_0xb34c('0x15')](function(_0x31b6aa){if(_0x31b6aa){if(!_[_0xb34c('0x6a')](_0x31b6aa[_0xb34c('0x67')])){if(fs[_0xb34c('0x6b')](path[_0xb34c('0x69')](config[_0xb34c('0x6c')],'server/files/images/avatars/',_0x31b6aa[_0xb34c('0x67')]))){_0x126e60=path[_0xb34c('0x69')](config[_0xb34c('0x6c')],'server/files/images/avatars/',_0x31b6aa[_0xb34c('0x67')]);}}return _0x4509f1[_0xb34c('0x6e')](_0x126e60);}})[_0xb34c('0x46')](handleError(_0x4509f1,null));};exports[_0xb34c('0x76')]=function(_0x57f4de,_0x5e2683){var _0x39ada3=require(_0xb34c('0x77'));var _0x3a6350=new _0x39ada3();var _0x110292=_0x3a6350[_0xb34c('0x78')](_0x57f4de[_0xb34c('0x79')][_0xb34c('0x7a')])[_0xb34c('0x7b')]();var _0x178aee={'body':_0x57f4de['body'],'channel':'chat'};var _0x4075d9=[];var _0x31e9a6=[];var _0xc29103={};var _0x1da3d0=![];return db[_0xb34c('0x7c')][_0xb34c('0x54')]()[_0xb34c('0x15')](function(_0x4cf713){if(!_0x4cf713){throw new db['Sequelize'][(_0xb34c('0x7d'))](_0xb34c('0x7e'));}_0x4075d9=_[_0xb34c('0x7f')](_[_0xb34c('0x48')](_0x4cf713),['createdAt',_0xb34c('0x80')]);_0x31e9a6=_[_0xb34c('0x7f')](_[_0xb34c('0x48')](_0x4cf713),[_0xb34c('0x81'),_0xb34c('0x80'),_0xb34c('0x82'),_0xb34c('0x83')]);if(_0x57f4de['body']['id']){delete _0x57f4de[_0xb34c('0x4c')]['id'];}if(_['isNil'](_0x57f4de['body'][_0xb34c('0x84')])){throw new db[(_0xb34c('0x85'))][(_0xb34c('0x7d'))](_0xb34c('0x86'));}if(_['isNil'](_0x57f4de[_0xb34c('0x4c')][_0xb34c('0x4c')])||_0x57f4de[_0xb34c('0x4c')][_0xb34c('0x4c')]===''){throw new db['Sequelize'][(_0xb34c('0x7d'))](_0xb34c('0x87'));}if(_[_0xb34c('0x6a')](_0x57f4de['body']['mapKey'])){throw new db['Sequelize'][(_0xb34c('0x7d'))](_0xb34c('0x88')+_0x31e9a6);}if(!_[_0xb34c('0x89')](_0x31e9a6,_0x57f4de[_0xb34c('0x4c')]['mapKey'])){throw new db['Sequelize'][(_0xb34c('0x7d'))](_0xb34c('0x8a')+_0x31e9a6);}_0xc29103[_0x57f4de[_0xb34c('0x4c')]['mapKey']]=_0x57f4de[_0xb34c('0x4c')]['from'];})[_0xb34c('0x15')](function(){return db[_0xb34c('0x2e')][_0xb34c('0x4a')]({'where':{'id':_0x57f4de[_0xb34c('0x47')]['id']},'include':[{'model':db[_0xb34c('0x8b')],'as':'List','include':[{'model':db[_0xb34c('0x7c')],'as':_0xb34c('0x8c'),'where':_0xc29103,'limit':0x1,'order':[['updatedAt',_0xb34c('0x8d')]]}]},{'model':db[_0xb34c('0x8e')],'as':_0xb34c('0x8f')}]});})['then'](handleEntityNotFound(_0x5e2683,null))[_0xb34c('0x15')](function(_0x30b045){if(_0x30b045&&_0x30b045[_0xb34c('0x90')]){_0x178aee[_0xb34c('0x91')]=_0x30b045;_0x178aee[_0xb34c('0x92')]=_0x30b045[_0xb34c('0x8f')];_0x178aee[_0xb34c('0x93')]=_0x30b045[_0xb34c('0x90')];_0x178aee[_0xb34c('0x92')]=_[_0xb34c('0x94')](_0x178aee[_0xb34c('0x92')],[_0xb34c('0x95')],[_0xb34c('0x96')]);if(_0x178aee[_0xb34c('0x91')][_0xb34c('0x8f')]){delete _0x178aee[_0xb34c('0x91')][_0xb34c('0x8f')];}if(_0x178aee['account'][_0xb34c('0x90')]&&_0x178aee[_0xb34c('0x91')]['List'][_0xb34c('0x8c')][_0xb34c('0x38')]){return _0x178aee[_0xb34c('0x91')]['List']['Contacts'][0x0];}var _0x816cea=_['defaults'](_0x57f4de['body'],{'firstName':_0x57f4de[_0xb34c('0x4c')][_0xb34c('0x84')],'ListId':_0x30b045[_0xb34c('0x83')]});_0x816cea[_0x57f4de[_0xb34c('0x4c')][_0xb34c('0x97')]]=_0x57f4de[_0xb34c('0x4c')][_0xb34c('0x84')];return db['CmContact'][_0xb34c('0x4b')](_0x816cea,{'fields':_0x4075d9,'raw':!![]});}})[_0xb34c('0x15')](handleEntityNotFound(_0x5e2683,null))['then'](function(_0x153b2a){_0x178aee['contact']=_0x153b2a;var _0x39a680=_0x57f4de['body'][_0xb34c('0x98')];if(_0x57f4de[_0xb34c('0x79')][_0xb34c('0x99')]){_0x39a680=_0x57f4de[_0xb34c('0x79')][_0xb34c('0x99')];}else if(_0x57f4de['headers'][_0xb34c('0x9a')]){_0x39a680=_[_0xb34c('0x9b')](_0x57f4de[_0xb34c('0x79')][_0xb34c('0x9a')][_0xb34c('0x9c')](','));}if(_0x153b2a){var _0x3a69e4={'ContactId':_0x153b2a['id'],'ChatWebsiteId':_0x57f4de[_0xb34c('0x47')]['id'],'from':(_0x153b2a[_0xb34c('0x9d')]||'')+'\x20'+(_0x153b2a[_0xb34c('0x9e')]||''),'customerIp':_0x39a680,'customerPort':_0x57f4de[_0xb34c('0x79')][_0xb34c('0x9f')]?_0x57f4de['headers']['x-real-port']:null,'referer':_0x57f4de[_0xb34c('0x4c')][_0xb34c('0xa0')],'browserName':_0x110292[_0xb34c('0xa1')]['name']&&_0x110292[_0xb34c('0xa1')][_0xb34c('0xa2')]?util[_0xb34c('0xa3')]('%s\x20%s',_0x110292['browser'][_0xb34c('0x2a')],_0x110292[_0xb34c('0xa1')]['version']):_0xb34c('0xa4'),'browserVersion':_0x110292['browser'][_0xb34c('0xa2')]||_0xb34c('0xa4'),'osName':util[_0xb34c('0xa3')](_0xb34c('0xa5'),_0x110292['os'][_0xb34c('0x2a')],_0x110292['os']['version']),'osVersion':_0x110292['os'][_0xb34c('0xa2')],'deviceModel':_0x110292[_0xb34c('0xa6')][_0xb34c('0x32')]&&_0x110292[_0xb34c('0xa6')][_0xb34c('0xa7')]?util[_0xb34c('0xa3')](_0xb34c('0xa8'),_0x110292[_0xb34c('0xa6')][_0xb34c('0x32')],_0x110292[_0xb34c('0xa6')]['vendor'],_0x110292[_0xb34c('0xa6')][_0xb34c('0x30')]):null,'deviceVendor':_0x110292['device']['vendor'],'deviceType':_0x110292[_0xb34c('0xa6')]['type'],'formData':JSON[_0xb34c('0x18')](_0x57f4de[_0xb34c('0x4c')])};var _0x264cfa={'ChatWebsiteId':_0x57f4de[_0xb34c('0x47')]['id'],'closed':![]};if(_0x57f4de['body'][_0xb34c('0xa9')]){_0x264cfa[_0xb34c('0xa9')]=_0x57f4de[_0xb34c('0x4c')]['threadId'];return db[_0xb34c('0xaa')][_0xb34c('0x4a')]({'where':_0x264cfa})[_0xb34c('0x15')](function(_0x4bfd57){if(_0x4bfd57){return[_0x4bfd57,![]];}_0x3a69e4[_0xb34c('0xa9')]=_0x57f4de[_0xb34c('0x4c')][_0xb34c('0xa9')];_0x3a69e4[_0xb34c('0xab')]=_0x57f4de[_0xb34c('0x4c')]['externalUrl'];return db[_0xb34c('0xaa')][_0xb34c('0x4b')](_0x3a69e4)[_0xb34c('0x15')](function(_0x41d5dc){return[_0x41d5dc,!![]];});});}_0x264cfa[_0xb34c('0xac')]=_0x153b2a['id'];if(_0x57f4de[_0xb34c('0x4c')][_0xb34c('0xad')]&&_0x57f4de[_0xb34c('0x4c')]['interaction']['id']){_0x264cfa['id']=_0x57f4de[_0xb34c('0x4c')][_0xb34c('0xad')]['id'];return db[_0xb34c('0xaa')][_0xb34c('0x4a')]({'where':_0x264cfa})[_0xb34c('0x15')](function(_0x1035da){if(_0x1035da){return[_0x1035da,![]];}return db['ChatInteraction'][_0xb34c('0x4b')](_0x3a69e4)[_0xb34c('0x15')](function(_0x281132){return[_0x281132,!![]];});});}return db[_0xb34c('0xaa')][_0xb34c('0x4b')](_0x3a69e4)[_0xb34c('0x15')](function(_0x5b1304){return[_0x5b1304,!![]];});}})['spread'](function(_0x22e261,_0x3d82f2){if(_0x22e261){_0x1da3d0=_0x3d82f2;if(!_0x3d82f2){var _0x2bae9a={'from':(_0x178aee[_0xb34c('0xae')][_0xb34c('0x9d')]||'')+'\x20'+(_0x178aee[_0xb34c('0xae')][_0xb34c('0x9e')]||'')};if(_0x57f4de[_0xb34c('0x4c')][_0xb34c('0xa9')]&&_0x57f4de['body'][_0xb34c('0xaf')]&&_0x57f4de['body']['threadId']!=_0x57f4de[_0xb34c('0x4c')][_0xb34c('0xaf')]){_0x2bae9a['threadId']=_0x57f4de[_0xb34c('0x4c')][_0xb34c('0xaf')];}return _0x22e261[_0xb34c('0x26')](_0x2bae9a);}else{return _0x22e261;}}})[_0xb34c('0x15')](function(_0x355cda){_0x178aee[_0xb34c('0xad')]=_0x355cda['get']({'plain':!![]});_0x178aee[_0xb34c('0xad')][_0xb34c('0xb0')]=_0x1da3d0;if(_0x178aee['interaction'][_0xb34c('0xb0')]){if(_0x178aee[_0xb34c('0x91')]['autoclose']){_0x178aee[_0xb34c('0x92')][_0xb34c('0xb1')]({'id':0x0,'priority':_0x178aee[_0xb34c('0x92')][_0xb34c('0x38')]+0x1,'app':_0xb34c('0xb2'),'appdata':_0xb34c('0xb3'),'interval':'*,*,*,*'});}}return db[_0xb34c('0xb4')]['create']({'body':_0x57f4de[_0xb34c('0x4c')][_0xb34c('0x4c')],'ChatWebsiteId':_0x57f4de['params']['id'],'ChatInteractionId':_0x355cda['id'],'direction':'in','ContactId':_0x178aee[_0xb34c('0xae')]['id'],'AttachmentId':_0x57f4de[_0xb34c('0x4c')][_0xb34c('0xb5')]});})[_0xb34c('0x15')](function(_0x187ace){_0x178aee[_0xb34c('0x1a')]=_0x187ace;if(_0x178aee[_0xb34c('0xad')]['UserId']){return db[_0xb34c('0xb6')][_0xb34c('0x4a')]({'attributes':['id',_0xb34c('0x2a')],'where':{'id':_0x178aee['interaction'][_0xb34c('0xb7')]}})[_0xb34c('0x15')](function(_0x1897b9){if(_0x1897b9){_0x178aee['applications'][_0xb34c('0xb8')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x1897b9[_0xb34c('0x2a')]+','+(_0x178aee['account'][_0xb34c('0xb9')]||0xa),'interval':_0xb34c('0xba')});_0x178aee[_0xb34c('0xbb')]=!![];}return respondWithRpcPromise('Start',_0xb34c('0xbc'),_0x178aee);});}return respondWithRpcPromise(_0xb34c('0xbd'),_0xb34c('0xbc'),_0x178aee);})['then'](function(_0x190213){respondWithRpcPromise(_0xb34c('0xbe'),_0xb34c('0xbe'),{'event':'notify','message':_0x190213},client9002);return _0x190213;})[_0xb34c('0x15')](respondWithResult(_0x5e2683,null))[_0xb34c('0x46')](handleError(_0x5e2683,null));};exports[_0xb34c('0xbf')]=function(_0x578261,_0x322903){var _0x5a1aa7,_0x40a17b,_0x8f6790;var _0x2c764a=[];var _0x3e13c8={};var _0x48eb8f=_0x578261[_0xb34c('0xc0')]||[];var _0x567ee2=[];var _0x20d719;return db[_0xb34c('0x7c')][_0xb34c('0x54')]()[_0xb34c('0x15')](function(_0x2f7219){if(!_0x2f7219){throw new db[(_0xb34c('0x85'))][(_0xb34c('0x7d'))](_0xb34c('0x7e'));}_0x2c764a=_['difference'](_[_0xb34c('0x48')](_0x2f7219),[_0xb34c('0x81'),_0xb34c('0x80'),_0xb34c('0x82'),_0xb34c('0x83')]);if(_0x578261[_0xb34c('0x4c')]['id']){delete _0x578261[_0xb34c('0x4c')]['id'];}if(_[_0xb34c('0x6a')](_0x578261[_0xb34c('0x4c')][_0xb34c('0x84')])){throw _0x322903[_0xb34c('0x1e')](0x1f4)[_0xb34c('0x2b')](new db[(_0xb34c('0x85'))]['ValidationError'](_0xb34c('0x86')));}if(_[_0xb34c('0x6a')](_0x578261['body'][_0xb34c('0x4c')])||_0x578261[_0xb34c('0x4c')][_0xb34c('0x4c')]===''){throw _0x322903[_0xb34c('0x1e')](0x1f4)[_0xb34c('0x2b')](new db['Sequelize'][(_0xb34c('0x7d'))](_0xb34c('0x87')));}if(_[_0xb34c('0x6a')](_0x578261[_0xb34c('0x4c')]['mapKeyOffline'])){throw _0x322903[_0xb34c('0x1e')](0x1f4)[_0xb34c('0x2b')](new db[(_0xb34c('0x85'))][(_0xb34c('0x7d'))]('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2c764a));}if(!_[_0xb34c('0x89')](_0x2c764a,_0x578261[_0xb34c('0x4c')][_0xb34c('0xc1')])){throw _0x322903[_0xb34c('0x1e')](0x1f4)[_0xb34c('0x2b')](new db[(_0xb34c('0x85'))][(_0xb34c('0x7d'))](_0xb34c('0xc2')+_0x2c764a));}_0x3e13c8[_0x578261[_0xb34c('0x4c')][_0xb34c('0xc1')]]=_0x578261[_0xb34c('0x4c')][_0xb34c('0x84')];})[_0xb34c('0x15')](function(){return db[_0xb34c('0x2e')][_0xb34c('0x4a')]({'where':{'id':_0x578261['params']['id']},'include':[{'model':db[_0xb34c('0x8b')],'as':_0xb34c('0x90')},{'model':db['MailAccount'],'as':_0xb34c('0xc3')}]});})[_0xb34c('0x15')](handleEntityNotFound(_0x322903,null))[_0xb34c('0x15')](function(_0x406777){if(_0x406777&&_0x406777[_0xb34c('0x90')]){_0x40a17b=_0x406777;var _0x294340=_[_0xb34c('0xc')](_0x578261[_0xb34c('0x4c')],{'firstName':_0x578261[_0xb34c('0x4c')][_0xb34c('0x84')],'phone':_0x578261[_0xb34c('0x4c')]['from'],'ListId':_0x406777[_0xb34c('0x83')]});_0x294340[_0x578261['body'][_0xb34c('0xc1')]]=_0x578261['body'][_0xb34c('0x84')];return db[_0xb34c('0x7c')][_0xb34c('0xc4')]({'where':_0x3e13c8,'defaults':_0x294340});}})[_0xb34c('0xc5')](function(_0x4c42c9){if(_0x4c42c9){_0x8f6790=_0x4c42c9;var _0x48ea4b=fs[_0xb34c('0xc6')](path[_0xb34c('0x69')](config[_0xb34c('0x6c')],_0xb34c('0xc7')),_0xb34c('0xc8'));var _0x992bc=ejs[_0xb34c('0xc9')](_0x48ea4b,{'body':_[_0xb34c('0xca')](_0x578261[_0xb34c('0x4c')][_0xb34c('0x4c')]),'bodyTitle':_0x40a17b['offlineMessageBody']});return db[_0xb34c('0xcb')][_0xb34c('0x4b')]({'body':_0x992bc,'plainBody':htmlToText[_0xb34c('0xcc')](_0x992bc),'ContactId':_0x4c42c9['id'],'ChatWebsiteId':_0x40a17b['id']});}})[_0xb34c('0x15')](function(_0x587e95){_0x20d719=_0x587e95;if(_0x48eb8f[_0xb34c('0x38')]){var _0x2874ae=_0x48eb8f[_0xb34c('0x40')](function(_0x222b8b){return{'name':_0x222b8b['originalname'],'basename':_0x222b8b[_0xb34c('0x63')],'type':_0x222b8b[_0xb34c('0xcd')],'ChatOfflineMessageId':_0x587e95['id']};});_0x567ee2=_0x2874ae[_0xb34c('0x40')](_0x24e328=>{var _0x172c38={'filename':_0x24e328[_0xb34c('0x2a')],'path':path[_0xb34c('0x69')](config[_0xb34c('0x6c')],_0xb34c('0xce'),'files',_0xb34c('0xcf'),_0xb34c('0xd0'),_0x24e328[_0xb34c('0xd1')])};return _0x172c38;});if(!_0x40a17b[_0xb34c('0xd2')]){return db['sequelize'][_0xb34c('0xd3')](function(_0x409ba4){return db[_0xb34c('0xd4')][_0xb34c('0xd5')](_0x2874ae,{'transaction':_0x409ba4});});}}})['then'](function(){if(_0x20d719){_0x5a1aa7=_0x20d719;return db[_0xb34c('0xc3')]['findOne']({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0xb34c('0xd6'),'raw':!![],'include':[{'model':db[_0xb34c('0xd7')],'as':_0xb34c('0xd7'),'raw':!![]}]}]});}})['then'](function(_0x33c6ba){if(_0x33c6ba&&_0x33c6ba['Smtp']&&_0x40a17b['forwardOffline']&&_0x40a17b['forwardOfflineAddress']){var _0x169a79=_0x33c6ba[_0xb34c('0xd8')]();return respondWithRpcPromise(_0xb34c('0xd9'),_0xb34c('0xda'),{'account':_0x169a79,'message':{'from':util[_0xb34c('0xa3')](_0xb34c('0xdb'),_0x33c6ba['name'],_0x33c6ba[_0xb34c('0xdc')]||_0x33c6ba[_0xb34c('0xd6')]['user']),'to':_0x40a17b[_0xb34c('0xdd')],'subject':_0x40a17b['offlineMessageSubject'],'html':_0x5a1aa7['body'],'attachments':_0x567ee2}},client9003)[_0xb34c('0x15')](function(){return _0x5a1aa7;})[_0xb34c('0x46')](function(_0x1abac1){logger[_0xb34c('0x19')](_0x1abac1);});}})[_0xb34c('0x15')](function(){if(_0x40a17b&&_0x40a17b['openNewInteraction']&&_0x40a17b['MailAccountId']){var _0xb1fab1=[];if(_0x48eb8f[_0xb34c('0x38')]){_0xb1fab1=_0x48eb8f[_0xb34c('0x40')](function(_0x4f9225){return{'name':_0x4f9225[_0xb34c('0xde')],'basename':_0x4f9225[_0xb34c('0x63')],'type':_0x4f9225['mimetype'],'ChatOfflineMessageId':_0x20d719['id']};});}var _0x75d987;if(!_[_0xb34c('0x6a')](_0x40a17b[_0xb34c('0xdf')])){var _0x265397=_['map'](_0x578261[_0xb34c('0x4c')],function(_0x3f191b){return _0x3f191b;});var _0x500084=_[_0xb34c('0xe0')](_0x265397)[0x0];var _0x463d00=_['mapValues'](_0x500084,function(_0xc1f34a){return _0xc1f34a;});_0x75d987=_0x463d00[0x1][_0x40a17b[_0xb34c('0xdf')]];}var _0x1c6ab5={'from':_0x8f6790[_0xb34c('0xdc')],'firstName':_0x8f6790[_0xb34c('0x9d')],'lastName':_0x8f6790[_0xb34c('0x9e')],'mapKey':'email','message':{'from':_0x8f6790[_0xb34c('0xdc')],'to':_0x40a17b[_0xb34c('0xc3')][_0xb34c('0xdc')],'cc':'','subject':_[_0xb34c('0x6a')](_0x75d987)?_0x40a17b[_0xb34c('0xe1')]:_0x75d987,'messageId':'','sentAt':new Date(),'attach':_0xb1fab1[_0xb34c('0x38')],'attachments':_0xb1fab1,'originChannel':_0xb34c('0xe2'),'ChatWebsiteId':_0x40a17b['id'],'ChatOfflineMessageId':_0x5a1aa7['id'],'originTo':_0x40a17b[_0xb34c('0xc3')][_0xb34c('0xdc')]},'body':_0x5a1aa7['body']};var _0x17c9e0={'account':{'id':_0x40a17b[_0xb34c('0xe3')]},'body':_0x1c6ab5,'log':'NotifyMailAccount'};return respondWithRpcPromise(_0xb34c('0xe4'),'notifyMail',_0x17c9e0,client9001)[_0xb34c('0x15')](function(){return _0x5a1aa7;})[_0xb34c('0x46')](function(_0xd56af1){logger[_0xb34c('0x19')](_0xd56af1);});}return;})[_0xb34c('0x15')](function(){if(_0x5a1aa7){return _0x5a1aa7;}})[_0xb34c('0x15')](respondWithResult(_0x322903,null))[_0xb34c('0x46')](function(_0x1e2709){logger[_0xb34c('0x19')]('catch',_0x1e2709);for(var _0x1d72c7 of _0x48eb8f){var _0x22c59c=path[_0xb34c('0x69')](config[_0xb34c('0x6c')],'server',_0xb34c('0xc0'),_0xb34c('0xcf'),'offline-chat',_0x1d72c7[_0xb34c('0x63')]);fs_extra[_0xb34c('0xe5')](_0x22c59c)[_0xb34c('0x46')](function(_0x468d30){logger[_0xb34c('0x19')](_0xb34c('0xe6'),_0x22c59c,_0x468d30);});}});};exports['addInteraction']=function(_0x78cfb4,_0x12772e){return db['ChatInteraction'][_0xb34c('0x4a')]({'where':{'id':_0x78cfb4['params']['id']}})['then'](handleEntityNotFound(_0x12772e,null))[_0xb34c('0x15')](function(_0x1ffbd5){if(_0x1ffbd5){return _0x1ffbd5[_0xb34c('0xe7')](_0x78cfb4['body'][_0xb34c('0x5c')],_[_0xb34c('0xe8')](_0x78cfb4[_0xb34c('0x4c')],[_0xb34c('0x5c'),'id'])||{});}})[_0xb34c('0x15')](respondWithResult(_0x12772e,null))[_0xb34c('0x46')](handleError(_0x12772e,null));};exports[_0xb34c('0xe9')]=function(_0xed5cd,_0x585010){var _0x84bf34={'raw':![],'where':{}};var _0x434aef={};var _0x32deb9={'count':0x0,'rows':[]};return db[_0xb34c('0x2e')]['findOne']({'where':{'id':_0xed5cd[_0xb34c('0x47')]['id']}})[_0xb34c('0x15')](handleEntityNotFound(_0x585010,null))[_0xb34c('0x15')](function(_0x38955d){if(_0x38955d){_0x434aef[_0xb34c('0x32')]=_['keys'](db['ChatInteraction'][_0xb34c('0x49')]);_0x434aef['query']=_[_0xb34c('0x48')](_0xed5cd[_0xb34c('0x33')]);_0x434aef[_0xb34c('0x34')]=_['intersection'](_0x434aef['model'],_0x434aef['query']);_0x84bf34[_0xb34c('0x36')]=_[_0xb34c('0x35')](_0x434aef[_0xb34c('0x32')],qs[_0xb34c('0x37')](_0xed5cd[_0xb34c('0x33')][_0xb34c('0x37')]));_0x84bf34[_0xb34c('0x36')]=_0x84bf34[_0xb34c('0x36')][_0xb34c('0x38')]?_0x84bf34[_0xb34c('0x36')]:_0x434aef['model'];if(!_0xed5cd['query'][_0xb34c('0x39')](_0xb34c('0x3a'))){_0x84bf34['limit']=qs[_0xb34c('0x22')](_0xed5cd[_0xb34c('0x33')][_0xb34c('0x22')]);_0x84bf34[_0xb34c('0x20')]=qs['offset'](_0xed5cd[_0xb34c('0x33')][_0xb34c('0x20')]);}_0x84bf34['order']=qs[_0xb34c('0x3b')](_0xed5cd[_0xb34c('0x33')][_0xb34c('0x3b')]);_0x84bf34[_0xb34c('0x3c')]=qs[_0xb34c('0x34')](_['pick'](_0xed5cd[_0xb34c('0x33')],_0x434aef[_0xb34c('0x34')]));_0x84bf34[_0xb34c('0x3c')]['ChatWebsiteId']=_0x38955d['id'];if(_0xed5cd['query']['filter']){_0x84bf34[_0xb34c('0x3c')]=_[_0xb34c('0x3f')](_0x84bf34[_0xb34c('0x3c')],{'$or':_[_0xb34c('0x40')](_0x84bf34[_0xb34c('0x36')],function(_0x54dab2){var _0x46c6b5={};_0x46c6b5[_0x54dab2]={'$like':'%'+_0xed5cd[_0xb34c('0x33')][_0xb34c('0x3e')]+'%'};return _0x46c6b5;})});}_0x84bf34=_[_0xb34c('0x3f')]({},_0x84bf34,_0xed5cd[_0xb34c('0x41')]);return db['ChatInteraction'][_0xb34c('0x23')]({'where':_0x84bf34['where']})['then'](function(_0x59b761){_0x32deb9[_0xb34c('0x23')]=_0x59b761;if(_0xed5cd[_0xb34c('0x33')][_0xb34c('0x42')]){_0x84bf34[_0xb34c('0x43')]=[{'model':db[_0xb34c('0x7c')],'as':_0xb34c('0xea'),'required':![]},{'model':db[_0xb34c('0xb6')],'as':'Owner','attributes':[_0xb34c('0x2a'),'fullname','internal'],'required':![]},{'model':db[_0xb34c('0xeb')],'as':_0xb34c('0xec'),'attributes':['id',_0xb34c('0x2a'),_0xb34c('0xed')],'where':_0xed5cd[_0xb34c('0x33')]['tag']?{'id':_0xed5cd['query'][_0xb34c('0xee')]}:undefined,'required':_0xed5cd['query'][_0xb34c('0xee')]?!![]:![]}];}return db[_0xb34c('0xaa')]['findAll'](_0x84bf34);})[_0xb34c('0x15')](function(_0x506fef){_0x32deb9[_0xb34c('0x45')]=_0x506fef;return _0x32deb9;});}})[_0xb34c('0x15')](respondWithFilteredResult(_0x585010,_0x84bf34))[_0xb34c('0x46')](handleError(_0x585010,null));};function iftimePromise(_0x403365,_0x304188){return respondWithRpcPromise('Command',_0xb34c('0xef'),{'command':_0x304188[_0xb34c('0xf0')]?util[_0xb34c('0xa3')](_0xb34c('0xf1'),_0x403365[_0xb34c('0xf2')],_0x304188[_0xb34c('0xf0')]):util[_0xb34c('0xa3')](_0xb34c('0xf3'),_0x403365[_0xb34c('0xf2')])},client9002)[_0xb34c('0x15')](function(_0x2e06e8){var _0x19ae27=_0x2e06e8&&_0x2e06e8['indexOf'](_0xb34c('0xf4'))>=0x0?!![]:![];logger[_0xb34c('0x1b')](_0xb34c('0xf5'),_0x304188['id'],_0x403365['id'],_0x403365['interval'],_0x19ae27?_0xb34c('0xf6'):'OFFLINE',_0x304188[_0xb34c('0xf0')]?_0x304188[_0xb34c('0xf0')]:_0xb34c('0xf7'));return _0x19ae27;})[_0xb34c('0x46')](function(_0x454f05){logger['error'](_0xb34c('0xf5'),_0x304188['id'],_0x403365['id'],_0x403365[_0xb34c('0xf2')],util[_0xb34c('0xf8')](_0x454f05,{'showHidden':![],'depth':null}),_0x304188[_0xb34c('0xf0')]?_0x304188[_0xb34c('0xf0')]:'No\x20timezone');return![];});}exports[_0xb34c('0xef')]=function(_0x524cf7,_0x5a6a9a){var _0x7e566=0x0;var _0x4d5c92=0x0;var _0x3e7d6f=![];var _0x1a8cae;var _0x1fff20;return db['ChatWebsite'][_0xb34c('0x4a')]({'where':{'id':_0x524cf7[_0xb34c('0x47')]['id']},'include':[{'model':db[_0xb34c('0xf9')],'as':_0xb34c('0xf9'),'include':[{'model':db[_0xb34c('0xf9')],'as':_0xb34c('0xfa'),'attributes':['id',_0xb34c('0xf2')],'raw':!![]}]}]})[_0xb34c('0x15')](handleEntityNotFound(_0x5a6a9a,null))[_0xb34c('0x15')](function(_0x5522b1){if(_0x5522b1){_0x1a8cae=_0x5522b1;return _0x5522b1[_0xb34c('0xfb')]({'raw':!![]});}})[_0xb34c('0x15')](function(_0x64ac6c){if(_0x1a8cae){if(_0x64ac6c){_0x1fff20=_0x64ac6c;}}return require(_0xb34c('0xfc'))[_0xb34c('0xfd')]();})[_0xb34c('0x15')](function(_0x4e0e47){if(_0x4e0e47){_0x4d5c92=_0x4e0e47[_0xb34c('0xfe')];_0x3e7d6f=_0x4e0e47[_0xb34c('0xff')];}})[_0xb34c('0x15')](function(){return db[_0xb34c('0xaa')][_0xb34c('0x23')]({'where':{'closed':![]}});})[_0xb34c('0x15')](function(_0x3e0ebd){_0x7e566=_0x3e0ebd;if(_0x4d5c92&&_0x3e0ebd>_0x4d5c92){return db['License'][_0xb34c('0x59')]({'where':{'id':0x1}})[_0xb34c('0x15')](function(_0x2bc916){if(_0x2bc916){_0x2bc916['increment'](_0xb34c('0x100'));}});}})[_0xb34c('0x15')](function(){if(_0x1a8cae[_0xb34c('0xf9')]&&_0x1a8cae[_0xb34c('0xf9')][_0xb34c('0xfa')]){var _0x3223a3=[];for(var _0x12930e=0x0;_0x12930e<_0x1a8cae[_0xb34c('0xf9')]['Intervals'][_0xb34c('0x38')];_0x12930e++){var _0xabb328=_0x1a8cae[_0xb34c('0xf9')]['Intervals'][_0x12930e]['get']({'plain':!![]});_0x3223a3[_0xb34c('0xb1')](iftimePromise(_0xabb328,_0x1a8cae));}return BPromise['all'](_0x3223a3)['then'](function(_0x266459){return _[_0xb34c('0x101')](_0x266459);});}else{return!![];}})[_0xb34c('0x15')](function(_0x6c9a6e){var _0x2c842c=fs[_0xb34c('0xc6')](path[_0xb34c('0x69')](config['root'],_0xb34c('0x102')),'utf8');var _0x4b5cca=new url['URL'](_0x1a8cae[_0xb34c('0x103')])[_0xb34c('0x104')];var _0x5bbe39=_0xb34c('0x105');var _0x48530f=![];var _0x5d16cf={'chatVersion':_0x5bbe39,'chatWebsiteAddressOrigin':_0x4b5cca,'remote':_0x1a8cae['remote'],'query':querystring[_0xb34c('0x18')](_['merge'](_0x1a8cae[_0xb34c('0x28')]({'plain':!![]}),{'customerIp':_0x524cf7['headers'][_0xb34c('0x9a')]||_0x524cf7[_0xb34c('0x79')][_0xb34c('0x106')]||_0x524cf7[_0xb34c('0x107')][_0xb34c('0x108')]||_0x524cf7['ip'],'referer':_0x524cf7[_0xb34c('0x79')]['referer'],'openedInteractions':_0x7e566,'maxInteractions':_0x4d5c92,'virtual':_0x3e7d6f[_0xb34c('0xfe')],'online':_0x6c9a6e,'custom':_0x3e7d6f}))[_0xb34c('0x109')](/'/g,'\x5c\x27')};_0x5a6a9a[_0xb34c('0x2b')](ejs[_0xb34c('0xc9')](Mustache[_0xb34c('0xc9')](_0x2c842c,_0x5d16cf),{'proactiveActions':_0x1fff20,'alignment':_0x1a8cae[_0xb34c('0x10a')],'verticalAlignment':_0x1a8cae[_0xb34c('0x10b')],'div_color':_0x1a8cae[_0xb34c('0xed')],'labelText':_0x1a8cae[_0xb34c('0x10c')],'text_color':_0x1a8cae[_0xb34c('0x10d')],'text_button_color':_0x1a8cae['textButtonColor'],'button_color':_0x1a8cae[_0xb34c('0x10e')],'background_color':_0x1a8cae[_0xb34c('0x10f')],'hideWhenOffline':_0x1a8cae[_0xb34c('0x110')],'intervalId':_0x1a8cae[_0xb34c('0x111')],'isDevelopment':_0x48530f,'chatVersion':_0x5bbe39}));})[_0xb34c('0x46')](handleError(_0x5a6a9a,null));};exports[_0xb34c('0x112')]=function(_0x5dc89b,_0x4c722b){var _0x578077=_0x5dc89b[_0xb34c('0x47')]['id'];var _0x57ab2a=_0x5dc89b['body'];var _0x21fa45=0xc8;var _0x9abc5a=null;return db[_0xb34c('0x113')][_0xb34c('0xd3')]({'isolationLevel':db[_0xb34c('0x113')][_0xb34c('0x114')][_0xb34c('0x115')][_0xb34c('0x116')]},function(_0x52bf86){return db[_0xb34c('0x2e')][_0xb34c('0x59')]({'where':{'id':_0x578077},'transaction':_0x52bf86})[_0xb34c('0x15')](function(_0x27e411){if(_0x27e411){return db[_0xb34c('0x8e')][_0xb34c('0x27')]({'where':{'ChatWebsiteId':_0x578077},'transaction':_0x52bf86})[_0xb34c('0x15')](function(){var _0x4ceca2=_['map'](_0x57ab2a,function(_0x156513){_0x156513[_0xb34c('0x56')]=_0x578077;return _0x156513;});return db[_0xb34c('0x8e')][_0xb34c('0xd5')](_0x4ceca2,{'transaction':_0x52bf86});});}else{_0x21fa45=0x194;_0x9abc5a=[];}});})[_0xb34c('0x15')](function(){if(_0x21fa45!==0x194){return db[_0xb34c('0x8e')][_0xb34c('0x117')]({'where':{'ChatWebsiteId':_0x578077},'order':_0xb34c('0x95')})[_0xb34c('0x15')](function(_0x16eba6){_0x9abc5a=_0x16eba6;});}})[_0xb34c('0x46')](function(_0x92a937){_0x21fa45=0x1f4;logger[_0xb34c('0x19')](_0x92a937[_0xb34c('0x29')]);if(_0x92a937[_0xb34c('0x2a')]){delete _0x92a937[_0xb34c('0x2a')];}_0x9abc5a=_0x92a937;})[_0xb34c('0x118')](function(){if(_0x9abc5a===null){_0x4c722b[_0xb34c('0x1d')](_0x21fa45);}else{if(_0x21fa45===0x1f4){_0x4c722b['status'](_0x21fa45)[_0xb34c('0x2b')](_0x9abc5a);}else{_0x4c722b[_0xb34c('0x1e')](_0x21fa45)[_0xb34c('0x119')](_0x9abc5a);}}});};exports[_0xb34c('0x11a')]=function(_0x246cc6,_0x2fbeda){var _0x53eaa4={};var _0x1e1a05={};var _0x4d66be;var _0x495bb8;return db[_0xb34c('0x2e')][_0xb34c('0x59')]({'where':{'id':_0x246cc6['params']['id']}})[_0xb34c('0x15')](handleEntityNotFound(_0x2fbeda,null))[_0xb34c('0x15')](function(_0x16d1cc){if(_0x16d1cc){_0x4d66be=_0x16d1cc;_0x1e1a05[_0xb34c('0x32')]=_[_0xb34c('0x48')](db[_0xb34c('0x8e')][_0xb34c('0x49')]);_0x1e1a05[_0xb34c('0x33')]=_['keys'](_0x246cc6[_0xb34c('0x33')]);_0x1e1a05[_0xb34c('0x34')]=_[_0xb34c('0x35')](_0x1e1a05[_0xb34c('0x32')],_0x1e1a05[_0xb34c('0x33')]);_0x53eaa4[_0xb34c('0x36')]=_[_0xb34c('0x35')](_0x1e1a05['model'],qs['fields'](_0x246cc6[_0xb34c('0x33')]['fields']));_0x53eaa4[_0xb34c('0x36')]=_0x53eaa4[_0xb34c('0x36')][_0xb34c('0x38')]?_0x53eaa4['attributes']:_0x1e1a05['model'];_0x53eaa4[_0xb34c('0x5a')]=qs[_0xb34c('0x3b')](_0x246cc6[_0xb34c('0x33')][_0xb34c('0x3b')]);_0x53eaa4[_0xb34c('0x3c')]=qs['filters'](_[_0xb34c('0x3d')](_0x246cc6[_0xb34c('0x33')],_0x1e1a05[_0xb34c('0x34')]));if(_0x246cc6['query'][_0xb34c('0x3e')]){_0x53eaa4[_0xb34c('0x3c')]=_[_0xb34c('0x3f')](_0x53eaa4[_0xb34c('0x3c')],{'$or':_[_0xb34c('0x40')](_0x53eaa4['attributes'],function(_0x20310c){var _0x23bf29={};_0x23bf29[_0x20310c]={'$like':'%'+_0x246cc6['query'][_0xb34c('0x3e')]+'%'};return _0x23bf29;})});}_0x53eaa4=_[_0xb34c('0x3f')]({},_0x53eaa4,_0x246cc6[_0xb34c('0x41')]);return _0x4d66be[_0xb34c('0x11a')](_0x53eaa4);}})['then'](function(_0xebfddb){if(_0xebfddb){_0x495bb8=_0xebfddb[_0xb34c('0x38')];if(!_0x246cc6[_0xb34c('0x33')]['hasOwnProperty']('nolimit')){_0x53eaa4[_0xb34c('0x22')]=qs['limit'](_0x246cc6[_0xb34c('0x33')][_0xb34c('0x22')]);_0x53eaa4[_0xb34c('0x20')]=qs[_0xb34c('0x20')](_0x246cc6[_0xb34c('0x33')][_0xb34c('0x20')]);}return _0x4d66be[_0xb34c('0x11a')](_0x53eaa4);}})['then'](function(_0x346c30){if(_0x346c30){return _0x346c30?{'count':_0x495bb8,'rows':_0x346c30}:null;}})[_0xb34c('0x15')](respondWithResult(_0x2fbeda,null))[_0xb34c('0x46')](handleError(_0x2fbeda,null));};exports['addProactiveActions']=function(_0x202d63,_0x28b1f1){return db['chatProactiveAction']['find']({'where':{'id':_0x202d63[_0xb34c('0x47')]['id']}})[_0xb34c('0x15')](handleEntityNotFound(_0x28b1f1,null))[_0xb34c('0x15')](function(_0x488cf7){if(_0x488cf7){return _0x488cf7[_0xb34c('0x11b')](_0x202d63[_0xb34c('0x4c')][_0xb34c('0x5c')],_[_0xb34c('0xe8')](_0x202d63[_0xb34c('0x4c')],[_0xb34c('0x5c'),'id'])||{});}})[_0xb34c('0x15')](respondWithResult(_0x28b1f1,null))[_0xb34c('0x46')](handleError(_0x28b1f1,null));};exports[_0xb34c('0xfb')]=function(_0x11ca54,_0x3d034e){var _0x4ab98e={};var _0x26cbe8={};var _0xdd3751;var _0x4a5a58;return db['ChatWebsite'][_0xb34c('0x59')]({'where':{'id':_0x11ca54[_0xb34c('0x47')]['id']}})[_0xb34c('0x15')](handleEntityNotFound(_0x3d034e,null))['then'](function(_0xb9debc){if(_0xb9debc){_0xdd3751=_0xb9debc;_0x26cbe8[_0xb34c('0x32')]=_[_0xb34c('0x48')](db[_0xb34c('0x11c')]['rawAttributes']);_0x26cbe8[_0xb34c('0x33')]=_[_0xb34c('0x48')](_0x11ca54[_0xb34c('0x33')]);_0x26cbe8[_0xb34c('0x34')]=_[_0xb34c('0x35')](_0x26cbe8[_0xb34c('0x32')],_0x26cbe8[_0xb34c('0x33')]);_0x4ab98e[_0xb34c('0x36')]=_[_0xb34c('0x35')](_0x26cbe8[_0xb34c('0x32')],qs[_0xb34c('0x37')](_0x11ca54[_0xb34c('0x33')]['fields']));_0x4ab98e['attributes']=_0x4ab98e[_0xb34c('0x36')]['length']?_0x4ab98e[_0xb34c('0x36')]:_0x26cbe8['model'];_0x4ab98e[_0xb34c('0x5a')]=qs[_0xb34c('0x3b')](_0x11ca54['query'][_0xb34c('0x3b')]);_0x4ab98e['where']=qs['filters'](_[_0xb34c('0x3d')](_0x11ca54['query'],_0x26cbe8['filters']));if(_0x11ca54[_0xb34c('0x33')][_0xb34c('0x3e')]){_0x4ab98e['where']=_[_0xb34c('0x3f')](_0x4ab98e['where'],{'$or':_[_0xb34c('0x40')](_0x4ab98e[_0xb34c('0x36')],function(_0x3e7649){var _0x2c677e={};_0x2c677e[_0x3e7649]={'$like':'%'+_0x11ca54[_0xb34c('0x33')][_0xb34c('0x3e')]+'%'};return _0x2c677e;})});}_0x4ab98e=_[_0xb34c('0x3f')]({},_0x4ab98e,_0x11ca54[_0xb34c('0x41')]);return _0xdd3751[_0xb34c('0xfb')](_0x4ab98e);}})[_0xb34c('0x15')](function(_0x39e92f){if(_0x39e92f){_0x4a5a58=_0x39e92f[_0xb34c('0x38')];if(!_0x11ca54[_0xb34c('0x33')][_0xb34c('0x39')]('nolimit')){_0x4ab98e['limit']=qs[_0xb34c('0x22')](_0x11ca54[_0xb34c('0x33')]['limit']);_0x4ab98e[_0xb34c('0x20')]=qs[_0xb34c('0x20')](_0x11ca54['query'][_0xb34c('0x20')]);}return _0xdd3751[_0xb34c('0xfb')](_0x4ab98e);}})['then'](function(_0x3aebd8){if(_0x3aebd8){return _0x3aebd8?{'count':_0x4a5a58,'rows':_0x3aebd8}:null;}})['then'](respondWithResult(_0x3d034e,null))[_0xb34c('0x46')](handleError(_0x3d034e,null));};exports[_0xb34c('0x11d')]=function(_0x3a4a32,_0x1ea941){var _0x3298c3=_0x3a4a32[_0xb34c('0x33')][_0xb34c('0x11e')]===_0xb34c('0x11f')?'offlineForm':_0xb34c('0x120');return db[_0xb34c('0x2e')][_0xb34c('0x4a')]({'attributes':['id',_0x3298c3],'where':{'id':_0x3a4a32[_0xb34c('0x47')]['id']}})[_0xb34c('0x15')](handleEntityNotFound(_0x1ea941,null))[_0xb34c('0x15')](function(_0x1ca769){if(_0x1ca769){var _0x4ed082=_0x1ca769[_0x3298c3];var _0x18a1a4=_0x4ed082&&_0x4ed082[_0xb34c('0x121')]?_0x4ed082[_0xb34c('0x121')]:[];_0x1ea941['send']({'fromKey':_[_0xb34c('0x6a')](_0x4ed082[_0xb34c('0x122')])?undefined:_0x4ed082[_0xb34c('0x122')],'count':_0x18a1a4[_0xb34c('0x38')],'rows':_0x18a1a4});}})[_0xb34c('0x46')](handleError(_0x1ea941,null));};exports[_0xb34c('0x123')]=function(_0xaf80d0,_0x50f2eb){var _0x517f02={'raw':![],'where':{}};var _0x36969d={};var _0x5d8e54={'count':0x0,'rows':[]};return db[_0xb34c('0x2e')][_0xb34c('0x59')]({'where':{'id':_0xaf80d0[_0xb34c('0x47')]['id']}})[_0xb34c('0x15')](handleEntityNotFound(_0x50f2eb,null))['then'](function(_0x41322d){if(_0x41322d){_0x36969d['model']=_[_0xb34c('0x48')](db[_0xb34c('0xcb')][_0xb34c('0x49')]);_0x36969d[_0xb34c('0x33')]=_[_0xb34c('0x48')](_0xaf80d0[_0xb34c('0x33')]);_0x36969d['filters']=_[_0xb34c('0x35')](_0x36969d[_0xb34c('0x32')],_0x36969d[_0xb34c('0x33')]);_0x517f02['attributes']=_[_0xb34c('0x35')](_0x36969d[_0xb34c('0x32')],qs['fields'](_0xaf80d0[_0xb34c('0x33')][_0xb34c('0x37')]));_0x517f02[_0xb34c('0x36')]=_0x517f02[_0xb34c('0x36')][_0xb34c('0x38')]?_0x517f02[_0xb34c('0x36')]:_0x36969d[_0xb34c('0x32')];if(!_0xaf80d0[_0xb34c('0x33')][_0xb34c('0x39')]('nolimit')){_0x517f02[_0xb34c('0x22')]=qs[_0xb34c('0x22')](_0xaf80d0[_0xb34c('0x33')][_0xb34c('0x22')]);_0x517f02[_0xb34c('0x20')]=qs['offset'](_0xaf80d0[_0xb34c('0x33')][_0xb34c('0x20')]);}_0x517f02['order']=qs['sort'](_0xaf80d0['query'][_0xb34c('0x3b')]);_0x517f02[_0xb34c('0x3c')]=qs['filters'](_[_0xb34c('0x3d')](_0xaf80d0[_0xb34c('0x33')],_0x36969d['filters']));_0x517f02[_0xb34c('0x3c')]['ChatWebsiteId']=_0x41322d['id'];if(_0xaf80d0[_0xb34c('0x33')][_0xb34c('0x3e')]){_0x517f02[_0xb34c('0x3c')]=_[_0xb34c('0x3f')](_0x517f02[_0xb34c('0x3c')],{'$or':_['map'](_0x517f02['attributes'],function(_0x2da3a8){var _0x51b371={};_0x51b371[_0x2da3a8]={'$like':'%'+_0xaf80d0[_0xb34c('0x33')][_0xb34c('0x3e')]+'%'};return _0x51b371;})});}_0x517f02=_[_0xb34c('0x3f')]({},_0x517f02,_0xaf80d0[_0xb34c('0x41')]);return db['ChatOfflineMessage'][_0xb34c('0x23')]({'where':_0x517f02[_0xb34c('0x3c')]})[_0xb34c('0x15')](function(_0xf6a351){_0x5d8e54[_0xb34c('0x23')]=_0xf6a351;if(_0xaf80d0[_0xb34c('0x33')][_0xb34c('0x42')]){_0x517f02[_0xb34c('0x43')]=[{'all':!![]}];}else{_0x517f02[_0xb34c('0x43')]=[{'model':db['CmContact'],'as':_0xb34c('0xea'),'required':![]},{'model':db['Attachment'],'as':_0xb34c('0x124'),'required':![]}];}return db[_0xb34c('0xcb')][_0xb34c('0x44')](_0x517f02);})[_0xb34c('0x15')](function(_0x472cd2){_0x5d8e54['rows']=_0x472cd2;return _0x5d8e54;});}})[_0xb34c('0x15')](respondWithFilteredResult(_0x50f2eb,_0x517f02))[_0xb34c('0x46')](handleError(_0x50f2eb,null));};exports[_0xb34c('0x125')]=function(_0x5b80b1,_0x4e1005){return db[_0xb34c('0x2e')][_0xb34c('0x4a')]({'where':{'id':_0x5b80b1[_0xb34c('0x47')]['id']}})[_0xb34c('0x15')](handleEntityNotFound(_0x4e1005,null))[_0xb34c('0x15')](function(_0xf15ff){if(_0xf15ff){return _0xf15ff[_0xb34c('0x125')](_0x5b80b1[_0xb34c('0x4c')][_0xb34c('0x5c')],_[_0xb34c('0xe8')](_0x5b80b1[_0xb34c('0x4c')],[_0xb34c('0x5c'),'id'])||{})[_0xb34c('0xc5')](function(_0x97237c){for(var _0x1e8b65=0x0;_0x1e8b65<_0x5b80b1[_0xb34c('0x4c')]['ids'][_0xb34c('0x38')];_0x1e8b65+=0x1){socket[_0xb34c('0x126')](_0xb34c('0x127'),{'UserId':Number(_0x5b80b1[_0xb34c('0x4c')][_0xb34c('0x5c')][_0x1e8b65]),'ChatWebsiteId':Number(_0x5b80b1[_0xb34c('0x47')]['id'])});}return _0x97237c;});}})['then'](respondWithResult(_0x4e1005,null))['catch'](handleError(_0x4e1005,null));};exports['removeAgents']=function(_0x5e865c,_0x10ae2b){return db[_0xb34c('0x2e')][_0xb34c('0x4a')]({'where':{'id':_0x5e865c[_0xb34c('0x47')]['id']}})['then'](handleEntityNotFound(_0x10ae2b,null))[_0xb34c('0x15')](function(_0x420970){if(_0x420970){return _0x420970[_0xb34c('0x128')](_0x5e865c[_0xb34c('0x33')][_0xb34c('0x5c')])[_0xb34c('0x15')](function(){if(_['isArray'](_0x5e865c[_0xb34c('0x33')]['ids'])){for(var _0x4c90ed=0x0;_0x4c90ed<_0x5e865c['query'][_0xb34c('0x5c')][_0xb34c('0x38')];_0x4c90ed+=0x1){socket['emit'](_0xb34c('0x129'),{'UserId':Number(_0x5e865c['query'][_0xb34c('0x5c')][_0x4c90ed]),'ChatWebsiteId':Number(_0x5e865c[_0xb34c('0x47')]['id'])});}}else{socket[_0xb34c('0x126')](_0xb34c('0x129'),{'UserId':Number(_0x5e865c[_0xb34c('0x33')][_0xb34c('0x5c')]),'ChatWebsiteId':Number(_0x5e865c[_0xb34c('0x47')]['id'])});}});}})['then'](respondWithStatusCode(_0x10ae2b,null))[_0xb34c('0x46')](handleError(_0x10ae2b,null));};exports[_0xb34c('0x12a')]=function(_0x49f6dd,_0x4b12a4){var _0x2da10e={};var _0x204759={};var _0x2e0206;var _0x577d15;return db['ChatWebsite'][_0xb34c('0x59')]({'where':{'id':_0x49f6dd[_0xb34c('0x47')]['id']}})[_0xb34c('0x15')](handleEntityNotFound(_0x4b12a4,null))[_0xb34c('0x15')](function(_0x17dc43){if(_0x17dc43){_0x2e0206=_0x17dc43;_0x204759[_0xb34c('0x32')]=_[_0xb34c('0x48')](db[_0xb34c('0xb6')]['rawAttributes']);_0x204759[_0xb34c('0x33')]=_[_0xb34c('0x48')](_0x49f6dd['query']);_0x204759['filters']=_[_0xb34c('0x35')](_0x204759[_0xb34c('0x32')],_0x204759[_0xb34c('0x33')]);_0x2da10e[_0xb34c('0x36')]=_['intersection'](_0x204759[_0xb34c('0x32')],qs[_0xb34c('0x37')](_0x49f6dd['query'][_0xb34c('0x37')]));_0x2da10e[_0xb34c('0x36')]=_0x2da10e[_0xb34c('0x36')][_0xb34c('0x38')]?_0x2da10e['attributes']:_0x204759['model'];_0x2da10e[_0xb34c('0x5a')]=qs[_0xb34c('0x3b')](_0x49f6dd[_0xb34c('0x33')][_0xb34c('0x3b')]);_0x2da10e[_0xb34c('0x3c')]=qs[_0xb34c('0x34')](_[_0xb34c('0x3d')](_0x49f6dd[_0xb34c('0x33')],_0x204759[_0xb34c('0x34')]));if(_0x49f6dd['query']['filter']){_0x2da10e['where']=_[_0xb34c('0x3f')](_0x2da10e[_0xb34c('0x3c')],{'$or':_['map'](_0x2da10e[_0xb34c('0x36')],function(_0x5cd1f7){var _0x2a1b48={};_0x2a1b48[_0x5cd1f7]={'$like':'%'+_0x49f6dd[_0xb34c('0x33')][_0xb34c('0x3e')]+'%'};return _0x2a1b48;})});}_0x2da10e=_[_0xb34c('0x3f')]({},_0x2da10e,_0x49f6dd[_0xb34c('0x41')]);return _0x2e0206[_0xb34c('0x12a')](_0x2da10e);}})[_0xb34c('0x15')](function(_0x2439a6){if(_0x2439a6){_0x577d15=_0x2439a6['length'];if(!_0x49f6dd[_0xb34c('0x33')]['hasOwnProperty']('nolimit')){_0x2da10e[_0xb34c('0x22')]=qs['limit'](_0x49f6dd[_0xb34c('0x33')]['limit']);_0x2da10e[_0xb34c('0x20')]=qs[_0xb34c('0x20')](_0x49f6dd[_0xb34c('0x33')]['offset']);}return _0x2e0206[_0xb34c('0x12a')](_0x2da10e);}})[_0xb34c('0x15')](function(_0x3d326d){if(_0x3d326d){return _0x3d326d?{'count':_0x577d15,'rows':_0x3d326d}:null;}})[_0xb34c('0x15')](respondWithResult(_0x4b12a4,null))[_0xb34c('0x46')](handleError(_0x4b12a4,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 57cd73c..26a73e4 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 _0x05bc=['save','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners'];(function(_0x594e11,_0x28f652){var _0x5418ad=function(_0x5dcfa7){while(--_0x5dcfa7){_0x594e11['push'](_0x594e11['shift']());}};_0x5418ad(++_0x28f652);}(_0x05bc,0xae));var _0xc05b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x05bc[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0xc05b('0x0'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xc05b('0x1')](0x0);var events={'afterCreate':_0xc05b('0x2'),'afterUpdate':'update','afterDestroy':_0xc05b('0x3')};function emitEvent(_0x2deceb){return function(_0xf971c9,_0x36356e,_0x27d374){ChatWebsiteEvents[_0xc05b('0x4')](_0x2deceb+':'+_0xf971c9['id'],_0xf971c9);ChatWebsiteEvents[_0xc05b('0x4')](_0x2deceb,_0xf971c9);_0x27d374(null);};}for(var e in events){if(events[_0xc05b('0x5')](e)){var event=events[e];ChatWebsite[_0xc05b('0x6')](e,emitEvent(event));}}module[_0xc05b('0x7')]=ChatWebsiteEvents; \ No newline at end of file +var _0xab5b=['hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','save','emit'];(function(_0x2e50a2,_0x27f31e){var _0x47e5de=function(_0x4e1f70){while(--_0x4e1f70){_0x2e50a2['push'](_0x2e50a2['shift']());}};_0x47e5de(++_0x27f31e);}(_0xab5b,0x11a));var _0xbab5=function(_0x3a9baf,_0x2f772b){_0x3a9baf=_0x3a9baf-0x0;var _0x3a9d8a=_0xab5b[_0x3a9baf];return _0x3a9d8a;};'use strict';var EventEmitter=require(_0xbab5('0x0'));var ChatWebsite=require(_0xbab5('0x1'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xbab5('0x2')](0x0);var events={'afterCreate':_0xbab5('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2a5d23){return function(_0x58f49f,_0xa320ef,_0x2fe469){ChatWebsiteEvents[_0xbab5('0x4')](_0x2a5d23+':'+_0x58f49f['id'],_0x58f49f);ChatWebsiteEvents[_0xbab5('0x4')](_0x2a5d23,_0x58f49f);_0x2fe469(null);};}for(var e in events){if(events[_0xbab5('0x5')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0xbab5('0x6')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index df4de97..d68ae8f 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 _0xa961=['lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','chat_websites'];(function(_0x5b697a,_0x280202){var _0x5de43b=function(_0x2bc32f){while(--_0x2bc32f){_0x5b697a['push'](_0x5b697a['shift']());}};_0x5de43b(++_0x280202);}(_0xa961,0x1a7));var _0x1a96=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0xa961[_0x2aec52];return _0x3b8835;};'use strict';var _=require(_0x1a96('0x0'));var util=require(_0x1a96('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x1a96('0x2'));var BPromise=require(_0x1a96('0x3'));var rp=require(_0x1a96('0x4'));var fs=require('fs');var path=require(_0x1a96('0x5'));var rimraf=require(_0x1a96('0x6'));var config=require(_0x1a96('0x7'));var attributes=require('./chatWebsite.attributes');module['exports']=function(_0x4437e8,_0x145d2a){return _0x4437e8['define']('ChatWebsite',attributes,{'tableName':_0x1a96('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd9ac=['path','../../config/environment','exports','chat_websites','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x5ee28a,_0xd60bbd){var _0x4bd261=function(_0x2f3e67){while(--_0x2f3e67){_0x5ee28a['push'](_0x5ee28a['shift']());}};_0x4bd261(++_0xd60bbd);}(_0xd9ac,0x112));var _0xcd9a=function(_0x12c6c0,_0x4dba50){_0x12c6c0=_0x12c6c0-0x0;var _0x30f9cc=_0xd9ac[_0x12c6c0];return _0x30f9cc;};'use strict';var _=require(_0xcd9a('0x0'));var util=require('util');var logger=require(_0xcd9a('0x1'))(_0xcd9a('0x2'));var moment=require('moment');var BPromise=require(_0xcd9a('0x3'));var rp=require(_0xcd9a('0x4'));var fs=require('fs');var path=require(_0xcd9a('0x5'));var rimraf=require('rimraf');var config=require(_0xcd9a('0x6'));var attributes=require('./chatWebsite.attributes');module[_0xcd9a('0x7')]=function(_0x10aac2,_0x1c7065){return _0x10aac2['define']('ChatWebsite',attributes,{'tableName':_0xcd9a('0x8'),'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 6b28208..1af5422 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 _0xd1cd=['code','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','request','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x661b08,_0x75cb8c){var _0x2bf737=function(_0x34c55e){while(--_0x34c55e){_0x661b08['push'](_0x661b08['shift']());}};_0x2bf737(++_0x75cb8c);}(_0xd1cd,0x7d));var _0xdd1c=function(_0xc447ba,_0x3fc0ce){_0xc447ba=_0xc447ba-0x0;var _0x4b8d6c=_0xd1cd[_0xc447ba];return _0x4b8d6c;};'use strict';var _=require(_0xdd1c('0x0'));var util=require(_0xdd1c('0x1'));var moment=require(_0xdd1c('0x2'));var BPromise=require(_0xdd1c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdd1c('0x4'));var db=require(_0xdd1c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xdd1c('0x6'))(_0xdd1c('0x7'));var config=require('../../config/environment');var jayson=require(_0xdd1c('0x8'));var client=jayson[_0xdd1c('0x9')][_0xdd1c('0xa')]({'port':0x232a});config[_0xdd1c('0xb')]=_[_0xdd1c('0xc')](config[_0xdd1c('0xb')],{'host':_0xdd1c('0xd'),'port':0x18eb});var socket=require(_0xdd1c('0xe'))(new Redis(config[_0xdd1c('0xb')]));require(_0xdd1c('0xf'))[_0xdd1c('0x10')](socket);function respondWithRpcPromise(_0x107a2b,_0x133ee5,_0x243932){return new BPromise(function(_0x281c75,_0x190784){return client[_0xdd1c('0x11')](_0x107a2b,_0x243932)[_0xdd1c('0x12')](function(_0xb6b254){logger['info'](_0xdd1c('0x13'),_0x133ee5,_0xdd1c('0x14'));logger[_0xdd1c('0x15')](_0xdd1c('0x16'),_0x133ee5,_0xdd1c('0x14'),JSON[_0xdd1c('0x17')](_0xb6b254));if(_0xb6b254['error']){if(_0xb6b254[_0xdd1c('0x18')][_0xdd1c('0x19')]===0x1f4){logger[_0xdd1c('0x18')](_0xdd1c('0x13'),_0x133ee5,_0xb6b254[_0xdd1c('0x18')][_0xdd1c('0x1a')]);return _0x190784(_0xb6b254['error'][_0xdd1c('0x1a')]);}logger[_0xdd1c('0x18')](_0xdd1c('0x13'),_0x133ee5,_0xb6b254[_0xdd1c('0x18')][_0xdd1c('0x1a')]);return _0x281c75(_0xb6b254[_0xdd1c('0x18')][_0xdd1c('0x1a')]);}else{logger[_0xdd1c('0x1b')](_0xdd1c('0x13'),_0x133ee5,'request\x20sent');_0x281c75(_0xb6b254[_0xdd1c('0x1c')][_0xdd1c('0x1a')]);}})[_0xdd1c('0x1d')](function(_0x71cf20){logger[_0xdd1c('0x18')](_0xdd1c('0x13'),_0x133ee5,_0x71cf20);_0x190784(_0x71cf20);});});} \ No newline at end of file +var _0x1740=['rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','request','then','info','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x5a89ea,_0x436388){var _0x21193d=function(_0x1a9118){while(--_0x1a9118){_0x5a89ea['push'](_0x5a89ea['shift']());}};_0x21193d(++_0x436388);}(_0x1740,0x121));var _0x0174=function(_0x95429c,_0x34a8bd){_0x95429c=_0x95429c-0x0;var _0x21348a=_0x1740[_0x95429c];return _0x21348a;};'use strict';var _=require(_0x0174('0x0'));var util=require(_0x0174('0x1'));var moment=require(_0x0174('0x2'));var BPromise=require(_0x0174('0x3'));var rs=require(_0x0174('0x4'));var fs=require('fs');var Redis=require(_0x0174('0x5'));var db=require(_0x0174('0x6'))['db'];var utils=require(_0x0174('0x7'));var logger=require('../../config/logger')(_0x0174('0x8'));var config=require(_0x0174('0x9'));var jayson=require(_0x0174('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0x0174('0xb')]=_[_0x0174('0xc')](config['redis'],{'host':_0x0174('0xd'),'port':0x18eb});var socket=require(_0x0174('0xe'))(new Redis(config['redis']));require(_0x0174('0xf'))['register'](socket);function respondWithRpcPromise(_0x7922d,_0x3469e6,_0x500875){return new BPromise(function(_0x79dbe7,_0x5b50b4){return client[_0x0174('0x10')](_0x7922d,_0x500875)[_0x0174('0x11')](function(_0xd02ba2){logger[_0x0174('0x12')](_0x0174('0x13'),_0x3469e6,'request\x20sent');logger[_0x0174('0x14')](_0x0174('0x15'),_0x3469e6,'request\x20sent',JSON[_0x0174('0x16')](_0xd02ba2));if(_0xd02ba2[_0x0174('0x17')]){if(_0xd02ba2['error'][_0x0174('0x18')]===0x1f4){logger[_0x0174('0x17')](_0x0174('0x13'),_0x3469e6,_0xd02ba2[_0x0174('0x17')][_0x0174('0x19')]);return _0x5b50b4(_0xd02ba2['error']['message']);}logger[_0x0174('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x3469e6,_0xd02ba2['error'][_0x0174('0x19')]);return _0x79dbe7(_0xd02ba2['error'][_0x0174('0x19')]);}else{logger['info'](_0x0174('0x13'),_0x3469e6,_0x0174('0x1a'));_0x79dbe7(_0xd02ba2['result'][_0x0174('0x19')]);}})['catch'](function(_0x185e02){logger[_0x0174('0x17')](_0x0174('0x13'),_0x3469e6,_0x185e02);_0x5b50b4(_0x185e02);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 89fe829..a8652d7 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 _0xb140=['save','remove','emit','removeListener','length','chatWebsite:'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0xb140,0xba));var _0x0b14=function(_0x5207d3,_0x1b67d4){_0x5207d3=_0x5207d3-0x0;var _0x36785c=_0xb140[_0x5207d3];return _0x36785c;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=[_0x0b14('0x0'),_0x0b14('0x1'),'update'];function createListener(_0x5d5013,_0x392587){return function(_0x10da8f){_0x392587[_0x0b14('0x2')](_0x5d5013,_0x10da8f);};}function removeListener(_0x4ba48c,_0x2f33b7){return function(){ChatWebsiteEvents[_0x0b14('0x3')](_0x4ba48c,_0x2f33b7);};}exports['register']=function(_0x1f23b9){for(var _0x3895b1=0x0,_0x154258=events[_0x0b14('0x4')];_0x3895b1<_0x154258;_0x3895b1++){var _0x21c53f=events[_0x3895b1];var _0x26e399=createListener(_0x0b14('0x5')+_0x21c53f,_0x1f23b9);ChatWebsiteEvents['on'](_0x21c53f,_0x26e399);}}; \ No newline at end of file +var _0x54a9=['register','length','chatWebsite:','./chatWebsite.events','save','remove','update','emit','removeListener'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x54a9,0x1c5));var _0x954a=function(_0x1febe9,_0x52b65a){_0x1febe9=_0x1febe9-0x0;var _0x24e1de=_0x54a9[_0x1febe9];return _0x24e1de;};'use strict';var ChatWebsiteEvents=require(_0x954a('0x0'));var events=[_0x954a('0x1'),_0x954a('0x2'),_0x954a('0x3')];function createListener(_0x4852c9,_0x55b10f){return function(_0x4c05b7){_0x55b10f[_0x954a('0x4')](_0x4852c9,_0x4c05b7);};}function removeListener(_0x356121,_0x11c8b6){return function(){ChatWebsiteEvents[_0x954a('0x5')](_0x356121,_0x11c8b6);};}exports[_0x954a('0x6')]=function(_0x1bd698){for(var _0x399ec1=0x0,_0x167531=events[_0x954a('0x7')];_0x399ec1<_0x167531;_0x399ec1++){var _0x194d87=events[_0x399ec1];var _0xe5ac80=createListener(_0x954a('0x8')+_0x194d87,_0x1bd698);ChatWebsiteEvents['on'](_0x194d87,_0xe5ac80);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index eb43f20..8211852 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 _0x9bca=['/:id/notify','server/files','attachments','offline-chat','ensureDir','replace','extname','/:id/offline','any','addApplications','addProactiveActions','addAgents','put','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','express','Router','fs-extra','../../components/interaction/service','./chatWebsite.controller','get','isAuthenticated','index','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getLogo','getAvatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','/:id/offline_messages','getOfflineMessages','/:id/users','post','create','addDisposition','addAnswer','diskStorage','server/files/images/logos/','format','%s-%s','now','originalname','/:id/logo','single','addLogo','join','server/files/images/avatars/','/:id/avatar','addAvatar','root','/:id/customer_avatar','file','addCustomerAvatar','addSystemAvatar'];(function(_0x539356,_0xf0ae3){var _0x4ee1c7=function(_0x2a0bc4){while(--_0x2a0bc4){_0x539356['push'](_0x539356['shift']());}};_0x4ee1c7(++_0xf0ae3);}(_0x9bca,0xa9));var _0xa9bc=function(_0x40bc3e,_0x51713d){_0x40bc3e=_0x40bc3e-0x0;var _0x3dc036=_0x9bca[_0x40bc3e];return _0x3dc036;};'use strict';var multer=require(_0xa9bc('0x0'));var util=require(_0xa9bc('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa9bc('0x2'));var router=express[_0xa9bc('0x3')]();var fs_extra=require(_0xa9bc('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xa9bc('0x5'));var config=require('../../config/environment');var controller=require(_0xa9bc('0x6'));router[_0xa9bc('0x7')]('/',auth[_0xa9bc('0x8')](),controller[_0xa9bc('0x9')]);router[_0xa9bc('0x7')]('/describe',auth[_0xa9bc('0x8')](),controller[_0xa9bc('0xa')]);router['get'](_0xa9bc('0xb'),auth[_0xa9bc('0x8')](),controller[_0xa9bc('0xc')]);router['get'](_0xa9bc('0xd'),auth[_0xa9bc('0x8')](),controller[_0xa9bc('0xe')]);router[_0xa9bc('0x7')](_0xa9bc('0xf'),auth[_0xa9bc('0x8')](),controller[_0xa9bc('0x10')]);router[_0xa9bc('0x7')]('/:id/logo',controller[_0xa9bc('0x11')]);router[_0xa9bc('0x7')]('/:id/avatar',controller[_0xa9bc('0x12')]);router[_0xa9bc('0x7')]('/:id/customer_avatar',controller[_0xa9bc('0x13')]);router['get'](_0xa9bc('0x14'),controller[_0xa9bc('0x15')]);router[_0xa9bc('0x7')](_0xa9bc('0x16'),auth[_0xa9bc('0x8')](),controller[_0xa9bc('0x17')]);router['get'](_0xa9bc('0x18'),controller[_0xa9bc('0x19')]);router[_0xa9bc('0x7')](_0xa9bc('0x1a'),auth[_0xa9bc('0x8')](),controller[_0xa9bc('0x1b')]);router['get'](_0xa9bc('0x1c'),auth[_0xa9bc('0x8')](),controller[_0xa9bc('0x1d')]);router[_0xa9bc('0x7')](_0xa9bc('0x1e'),controller['getFields']);router[_0xa9bc('0x7')](_0xa9bc('0x1f'),auth[_0xa9bc('0x8')](),controller[_0xa9bc('0x20')]);router['get'](_0xa9bc('0x21'),auth[_0xa9bc('0x8')](),controller['getAgents']);router[_0xa9bc('0x22')]('/',auth[_0xa9bc('0x8')](),controller[_0xa9bc('0x23')]);router['post'](_0xa9bc('0xd'),auth[_0xa9bc('0x8')](),controller[_0xa9bc('0x24')]);router['post'](_0xa9bc('0xf'),auth[_0xa9bc('0x8')](),controller[_0xa9bc('0x25')]);var upload=multer({'storage':multer[_0xa9bc('0x26')]({'destination':function(_0x2a5092,_0x5c7f0a,_0x4c358d){_0x4c358d(null,path['join'](config['root'],_0xa9bc('0x27')));},'filename':function(_0x48cabc,_0x41ce36,_0x46592c){_0x46592c(null,util[_0xa9bc('0x28')](_0xa9bc('0x29'),Date[_0xa9bc('0x2a')](),_0x41ce36[_0xa9bc('0x2b')]));}})});router[_0xa9bc('0x22')](_0xa9bc('0x2c'),upload[_0xa9bc('0x2d')]('file'),controller[_0xa9bc('0x2e')]);var upload=multer({'storage':multer[_0xa9bc('0x26')]({'destination':function(_0x28a89a,_0x189f94,_0x3282a8){_0x3282a8(null,path[_0xa9bc('0x2f')](config['root'],_0xa9bc('0x30')));},'filename':function(_0x1bf2f5,_0x599c4b,_0x2cbda5){_0x2cbda5(null,util[_0xa9bc('0x28')](_0xa9bc('0x29'),Date['now'](),_0x599c4b[_0xa9bc('0x2b')]));}})});router[_0xa9bc('0x22')](_0xa9bc('0x31'),upload[_0xa9bc('0x2d')]('file'),controller[_0xa9bc('0x32')]);var upload=multer({'storage':multer[_0xa9bc('0x26')]({'destination':function(_0x523067,_0x3a8e63,_0x579419){_0x579419(null,path[_0xa9bc('0x2f')](config[_0xa9bc('0x33')],_0xa9bc('0x30')));},'filename':function(_0x5f3af4,_0x5d3063,_0x575441){_0x575441(null,util[_0xa9bc('0x28')](_0xa9bc('0x29'),Date[_0xa9bc('0x2a')](),_0x5d3063[_0xa9bc('0x2b')]));}})});router[_0xa9bc('0x22')](_0xa9bc('0x34'),upload['single'](_0xa9bc('0x35')),controller[_0xa9bc('0x36')]);var upload=multer({'storage':multer[_0xa9bc('0x26')]({'destination':function(_0x1e6d57,_0x762f94,_0x592250){_0x592250(null,path[_0xa9bc('0x2f')](config[_0xa9bc('0x33')],_0xa9bc('0x30')));},'filename':function(_0x35a662,_0x7c332f,_0x4e9f37){_0x4e9f37(null,util[_0xa9bc('0x28')](_0xa9bc('0x29'),Date[_0xa9bc('0x2a')](),_0x7c332f[_0xa9bc('0x2b')]));}})});router[_0xa9bc('0x22')](_0xa9bc('0x14'),upload[_0xa9bc('0x2d')](_0xa9bc('0x35')),controller[_0xa9bc('0x37')]);router[_0xa9bc('0x22')](_0xa9bc('0x38'),controller['notify']);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x2b9fe7,_0x4a0bef,_0x521b5d){const _0xd03e3a=path[_0xa9bc('0x2f')](config[_0xa9bc('0x33')],_0xa9bc('0x39'),_0xa9bc('0x3a'),_0xa9bc('0x3b'));fs_extra[_0xa9bc('0x3c')](_0xd03e3a,function(){_0x521b5d(null,_0xd03e3a);});},'filename':function(_0x5d1359,_0xea0cb3,_0x137c4c){const _0x16f410=_0xea0cb3[_0xa9bc('0x2b')][_0xa9bc('0x3d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x1629bc=path[_0xa9bc('0x3e')](_0x16f410);const _0x15f1bb=Date['now']()+'-'+_0x16f410['replace'](_0x1629bc,'')+_0x1629bc;_0x137c4c(null,_0x15f1bb);}})});router[_0xa9bc('0x22')](_0xa9bc('0x3f'),offlineUploadMulter[_0xa9bc('0x40')](),controller['offline']);router['post'](_0xa9bc('0x16'),auth[_0xa9bc('0x8')](),controller['addInteraction']);router['post'](_0xa9bc('0x1a'),auth[_0xa9bc('0x8')](),controller[_0xa9bc('0x41')]);router[_0xa9bc('0x22')](_0xa9bc('0x1c'),auth[_0xa9bc('0x8')](),controller[_0xa9bc('0x42')]);router[_0xa9bc('0x22')](_0xa9bc('0x21'),auth[_0xa9bc('0x8')](),controller[_0xa9bc('0x43')]);router[_0xa9bc('0x44')](_0xa9bc('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xa9bc('0x45')](_0xa9bc('0xb'),auth[_0xa9bc('0x8')](),controller[_0xa9bc('0x46')]);router[_0xa9bc('0x45')](_0xa9bc('0xd'),auth[_0xa9bc('0x8')](),controller[_0xa9bc('0x47')]);router[_0xa9bc('0x45')]('/:id/canned_answers',auth[_0xa9bc('0x8')](),controller[_0xa9bc('0x48')]);router[_0xa9bc('0x45')](_0xa9bc('0x21'),auth['isAuthenticated'](),controller[_0xa9bc('0x49')]);module[_0xa9bc('0x4a')]=router; \ No newline at end of file +var _0x67e7=['getFields','/:id/offline_messages','/:id/users','getAgents','post','create','addDisposition','diskStorage','join','root','server/files/images/logos/','originalname','/:id/logo','single','file','addLogo','server/files/images/avatars/','format','%s-%s','now','addAvatar','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','server/files','ensureDir','replace','extname','/:id/offline','any','offline','addInteraction','/:id/applications','addApplications','addProactiveActions','addAgents','put','update','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','/:id/snippet','getSnippet','/:id/proactive_actions','getProactiveActions','/:id/fields'];(function(_0x2b4726,_0x40fc93){var _0x1d123a=function(_0x2fefa4){while(--_0x2fefa4){_0x2b4726['push'](_0x2b4726['shift']());}};_0x1d123a(++_0x40fc93);}(_0x67e7,0x199));var _0x767e=function(_0x31b5af,_0x51449f){_0x31b5af=_0x31b5af-0x0;var _0x1f8cc2=_0x67e7[_0x31b5af];return _0x1f8cc2;};'use strict';var multer=require(_0x767e('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x767e('0x1'));var router=express[_0x767e('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x767e('0x3'));var interaction=require(_0x767e('0x4'));var config=require(_0x767e('0x5'));var controller=require(_0x767e('0x6'));router[_0x767e('0x7')]('/',auth[_0x767e('0x8')](),controller[_0x767e('0x9')]);router[_0x767e('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x767e('0xa')]);router[_0x767e('0x7')](_0x767e('0xb'),auth[_0x767e('0x8')](),controller['show']);router[_0x767e('0x7')](_0x767e('0xc'),auth['isAuthenticated'](),controller[_0x767e('0xd')]);router['get'](_0x767e('0xe'),auth[_0x767e('0x8')](),controller[_0x767e('0xf')]);router[_0x767e('0x7')]('/:id/logo',controller[_0x767e('0x10')]);router[_0x767e('0x7')](_0x767e('0x11'),controller[_0x767e('0x12')]);router[_0x767e('0x7')](_0x767e('0x13'),controller[_0x767e('0x14')]);router['get'](_0x767e('0x15'),controller[_0x767e('0x16')]);router[_0x767e('0x7')](_0x767e('0x17'),auth[_0x767e('0x8')](),controller['getInteractions']);router['get'](_0x767e('0x18'),controller[_0x767e('0x19')]);router[_0x767e('0x7')]('/:id/applications',auth[_0x767e('0x8')](),controller['getApplications']);router[_0x767e('0x7')](_0x767e('0x1a'),auth[_0x767e('0x8')](),controller[_0x767e('0x1b')]);router[_0x767e('0x7')](_0x767e('0x1c'),controller[_0x767e('0x1d')]);router['get'](_0x767e('0x1e'),auth['isAuthenticated'](),controller['getOfflineMessages']);router['get'](_0x767e('0x1f'),auth[_0x767e('0x8')](),controller[_0x767e('0x20')]);router[_0x767e('0x21')]('/',auth['isAuthenticated'](),controller[_0x767e('0x22')]);router[_0x767e('0x21')](_0x767e('0xc'),auth[_0x767e('0x8')](),controller[_0x767e('0x23')]);router['post'](_0x767e('0xe'),auth[_0x767e('0x8')](),controller['addAnswer']);var upload=multer({'storage':multer[_0x767e('0x24')]({'destination':function(_0x3150a1,_0x36cc41,_0x3db43d){_0x3db43d(null,path[_0x767e('0x25')](config[_0x767e('0x26')],_0x767e('0x27')));},'filename':function(_0x55b047,_0xcd6752,_0x39b04c){_0x39b04c(null,util['format']('%s-%s',Date['now'](),_0xcd6752[_0x767e('0x28')]));}})});router['post'](_0x767e('0x29'),upload[_0x767e('0x2a')](_0x767e('0x2b')),controller[_0x767e('0x2c')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x45f265,_0x2728f5,_0x2d2f1c){_0x2d2f1c(null,path[_0x767e('0x25')](config['root'],_0x767e('0x2d')));},'filename':function(_0x3f3cb1,_0x50ddda,_0x1865b4){_0x1865b4(null,util[_0x767e('0x2e')](_0x767e('0x2f'),Date[_0x767e('0x30')](),_0x50ddda[_0x767e('0x28')]));}})});router[_0x767e('0x21')](_0x767e('0x11'),upload[_0x767e('0x2a')](_0x767e('0x2b')),controller[_0x767e('0x31')]);var upload=multer({'storage':multer[_0x767e('0x24')]({'destination':function(_0x4198fd,_0x468b12,_0x3880dd){_0x3880dd(null,path[_0x767e('0x25')](config[_0x767e('0x26')],_0x767e('0x2d')));},'filename':function(_0xf93686,_0x1dbd64,_0x1ad117){_0x1ad117(null,util['format'](_0x767e('0x2f'),Date['now'](),_0x1dbd64[_0x767e('0x28')]));}})});router[_0x767e('0x21')](_0x767e('0x13'),upload[_0x767e('0x2a')](_0x767e('0x2b')),controller[_0x767e('0x32')]);var upload=multer({'storage':multer[_0x767e('0x24')]({'destination':function(_0x357f57,_0x5c97b7,_0x36031f){_0x36031f(null,path[_0x767e('0x25')](config['root'],'server/files/images/avatars/'));},'filename':function(_0x4e053e,_0x1eac06,_0x579ab6){_0x579ab6(null,util[_0x767e('0x2e')](_0x767e('0x2f'),Date[_0x767e('0x30')](),_0x1eac06['originalname']));}})});router['post']('/:id/system_avatar',upload[_0x767e('0x2a')]('file'),controller[_0x767e('0x33')]);router[_0x767e('0x21')](_0x767e('0x34'),controller[_0x767e('0x35')]);const offlineUploadMulter=multer({'storage':multer[_0x767e('0x24')]({'destination':function(_0x599724,_0x1fe62c,_0xc423a6){const _0x52e44c=path[_0x767e('0x25')](config[_0x767e('0x26')],_0x767e('0x36'),'attachments','offline-chat');fs_extra[_0x767e('0x37')](_0x52e44c,function(){_0xc423a6(null,_0x52e44c);});},'filename':function(_0x19070f,_0x2b8365,_0x585273){const _0x323496=_0x2b8365[_0x767e('0x28')][_0x767e('0x38')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x5f1221=path[_0x767e('0x39')](_0x323496);const _0x13ede1=Date['now']()+'-'+_0x323496['replace'](_0x5f1221,'')+_0x5f1221;_0x585273(null,_0x13ede1);}})});router[_0x767e('0x21')](_0x767e('0x3a'),offlineUploadMulter[_0x767e('0x3b')](),controller[_0x767e('0x3c')]);router[_0x767e('0x21')](_0x767e('0x17'),auth[_0x767e('0x8')](),controller[_0x767e('0x3d')]);router[_0x767e('0x21')](_0x767e('0x3e'),auth[_0x767e('0x8')](),controller[_0x767e('0x3f')]);router['post'](_0x767e('0x1a'),auth[_0x767e('0x8')](),controller[_0x767e('0x40')]);router[_0x767e('0x21')](_0x767e('0x1f'),auth[_0x767e('0x8')](),controller[_0x767e('0x41')]);router[_0x767e('0x42')]('/:id',auth[_0x767e('0x8')](),controller[_0x767e('0x43')]);router['delete'](_0x767e('0xb'),auth[_0x767e('0x8')](),controller['destroy']);router[_0x767e('0x44')](_0x767e('0xc'),auth[_0x767e('0x8')](),controller[_0x767e('0x45')]);router[_0x767e('0x44')]('/:id/canned_answers',auth[_0x767e('0x8')](),controller[_0x767e('0x46')]);router[_0x767e('0x44')]('/:id/users',auth['isAuthenticated'](),controller[_0x767e('0x47')]);module[_0x767e('0x48')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index 1deccab..3f3875e 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 _0x8200=['Router','env','production','app','get','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','use','isAuthenticated','express','../components/auth/service','../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8200,0x115));var _0x0820=function(_0x92aa92,_0x1302c4){_0x92aa92=_0x92aa92-0x0;var _0x10a40a=_0x8200[_0x92aa92];return _0x10a40a;};var beaverLogger=require('beaver-logger/server');var express=require(_0x0820('0x0'));var auth=require(_0x0820('0x1'));var config=require(_0x0820('0x2'));var router=express[_0x0820('0x3')]();var isProduction=config[_0x0820('0x4')]===_0x0820('0x5')||![];function clientSideLogs(_0xc1ac67,_0x1928c9,_0x2e7c30){var _0x5b3d1f=_0xc1ac67[_0x0820('0x6')][_0x0820('0x7')](_0x0820('0x8'));if(!_0x5b3d1f){throw new Error(_0x0820('0x9'));}return beaverLogger[_0x0820('0xa')]({'uri':_0x0820('0xb'),'logger':_0x5b3d1f,'enableCors':!isProduction})(_0xc1ac67,_0x1928c9,_0x2e7c30);}router[_0x0820('0xc')](auth[_0x0820('0xd')](),clientSideLogs);module['exports']=router; \ No newline at end of file +var _0xf2dd=['get','expressEndpoint','use','isAuthenticated','exports','../components/auth/service','../config/environment','env','app'];(function(_0x2eebcc,_0x1e649d){var _0x39f1a5=function(_0x35c0d4){while(--_0x35c0d4){_0x2eebcc['push'](_0x2eebcc['shift']());}};_0x39f1a5(++_0x1e649d);}(_0xf2dd,0x12e));var _0xdf2d=function(_0x3a2e49,_0x21ebea){_0x3a2e49=_0x3a2e49-0x0;var _0x257140=_0xf2dd[_0x3a2e49];return _0x257140;};var beaverLogger=require('beaver-logger/server');var express=require('express');var auth=require(_0xdf2d('0x0'));var config=require(_0xdf2d('0x1'));var router=express['Router']();var isProduction=config[_0xdf2d('0x2')]==='production'||![];function clientSideLogs(_0x2151ad,_0x493c59,_0x4cabfb){var _0x49cb1e=_0x2151ad[_0xdf2d('0x3')][_0xdf2d('0x4')]('client-side-logger');if(!_0x49cb1e){throw new Error('Client-Side\x20logger\x20not\x20found!');}return beaverLogger[_0xdf2d('0x5')]({'uri':'/client-logs','logger':_0x49cb1e,'enableCors':!isProduction})(_0x2151ad,_0x493c59,_0x4cabfb);}router[_0xdf2d('0x6')](auth[_0xdf2d('0x7')](),clientSideLogs);module[_0xdf2d('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 d2f80eb..584d4c4 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 _0x1836=['Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','exports','STRING','ENUM','AmazonAWS','MicrosoftAzure'];(function(_0x5b11e0,_0x96af1c){var _0x3c2aa7=function(_0x337d5a){while(--_0x337d5a){_0x5b11e0['push'](_0x5b11e0['shift']());}};_0x3c2aa7(++_0x96af1c);}(_0x1836,0x18e));var _0x6183=function(_0x552b27,_0x43e138){_0x552b27=_0x552b27-0x0;var _0x5ce471=_0x1836[_0x552b27];return _0x5ce471;};'use strict';var Sequelize=require('sequelize');module[_0x6183('0x0')]={'name':{'type':Sequelize[_0x6183('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x6183('0x2')](_0x6183('0x3'),'Google',_0x6183('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x6183('0x2')]('Outlook365',_0x6183('0x5'))},'data1':{'type':Sequelize[_0x6183('0x1')],'comment':_0x6183('0x6')},'data2':{'type':Sequelize['STRING'],'comment':_0x6183('0x7')},'data3':{'type':Sequelize[_0x6183('0x1')],'comment':_0x6183('0x8')},'data4':{'type':Sequelize[_0x6183('0x1')],'comment':_0x6183('0x9')},'data5':{'type':Sequelize[_0x6183('0xa')],'comment':_0x6183('0xb')},'data6':{'type':Sequelize[_0x6183('0xa')],'comment':'MicrosoftAzure\x20=>\x20refresh_token'},'data7':{'type':Sequelize[_0x6183('0xa')],'comment':_0x6183('0xc')}}; \ No newline at end of file +var _0x7d30=['MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','exports','ENUM','Google','Dynamics365','STRING','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret'];(function(_0x51e75c,_0xa0005e){var _0x437c68=function(_0x1a7ab4){while(--_0x1a7ab4){_0x51e75c['push'](_0x51e75c['shift']());}};_0x437c68(++_0xa0005e);}(_0x7d30,0xf4));var _0x07d3=function(_0x3cb9eb,_0x3fd4b9){_0x3cb9eb=_0x3cb9eb-0x0;var _0x4d5970=_0x7d30[_0x3cb9eb];return _0x4d5970;};'use strict';var Sequelize=require('sequelize');module[_0x07d3('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x07d3('0x1')]('AmazonAWS',_0x07d3('0x2'),'MicrosoftAzure'),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x07d3('0x1')]('Outlook365',_0x07d3('0x3'))},'data1':{'type':Sequelize[_0x07d3('0x4')],'comment':_0x07d3('0x5')},'data2':{'type':Sequelize[_0x07d3('0x4')],'comment':_0x07d3('0x6')},'data3':{'type':Sequelize['STRING'],'comment':_0x07d3('0x7')},'data4':{'type':Sequelize[_0x07d3('0x4')],'comment':_0x07d3('0x8')},'data5':{'type':Sequelize[_0x07d3('0x9')],'comment':_0x07d3('0xa')},'data6':{'type':Sequelize['TEXT'],'comment':'MicrosoftAzure\x20=>\x20refresh_token'},'data7':{'type':Sequelize[_0x07d3('0x9')],'comment':_0x07d3('0xb')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 712bb66..1024d35 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 _0x97cf=['oauth2MicrosoftCallback','get','state','Invalid\x20state\x20parameter','parse','from','base64','ascii','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','data6','data5','startRefreshInterval','microsoftAuthorization:success','emit','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','../../components/encryptor','../../config/environment','../../config/logger','api','../../mysqldb','./cloudProvider.oauth','redis','defaults','localhost','socket.io-emitter','status','end','json','offset','limit','undefined','count','set','Content-Range','update','then','destroy','error','name','send','padEnd','index','map','CloudProvider','rawAttributes','fieldName','type','key','model','query','keys','attributes','fields','length','hasOwnProperty','where','filters','filter','merge','options','includeAll','include','findAll','rows','service','MicrosoftAzure','data3','catch','show','params','intersection','find','decryptString','create','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','oauth2MicrosoftAuthorize','findOne','sendStatus','generateMicrosoftAuthorizationUrl','user'];(function(_0x22bf78,_0x37c854){var _0x2d5ceb=function(_0x1f091f){while(--_0x1f091f){_0x22bf78['push'](_0x22bf78['shift']());}};_0x2d5ceb(++_0x37c854);}(_0x97cf,0x133));var _0xf97c=function(_0x368abe,_0x263c91){_0x368abe=_0x368abe-0x0;var _0x43a451=_0x97cf[_0x368abe];return _0x43a451;};'use strict';var _=require(_0xf97c('0x0'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var encryptor=require(_0xf97c('0x1'));var config=require(_0xf97c('0x2'));var logger=require(_0xf97c('0x3'))(_0xf97c('0x4'));var db=require(_0xf97c('0x5'))['db'];var oauth=require(_0xf97c('0x6'));config[_0xf97c('0x7')]=_[_0xf97c('0x8')](config[_0xf97c('0x7')],{'host':_0xf97c('0x9'),'port':0x18eb});var socket=require(_0xf97c('0xa'))(new Redis(config[_0xf97c('0x7')]));var redis=new Redis(config[_0xf97c('0x7')]);function respondWithStatusCode(_0x57e279,_0x333085){_0x333085=_0x333085||0xcc;return function(_0x102a5c){if(_0x102a5c){return _0x57e279['sendStatus'](_0x333085);}return _0x57e279[_0xf97c('0xb')](_0x333085)[_0xf97c('0xc')]();};}function respondWithResult(_0x91b2bc,_0x2c441c){_0x2c441c=_0x2c441c||0xc8;return function(_0x588a59){if(_0x588a59){return _0x91b2bc[_0xf97c('0xb')](_0x2c441c)[_0xf97c('0xd')](_0x588a59);}};}function respondWithFilteredResult(_0x14f4b5,_0x46d625){return function(_0x241f6a){if(_0x241f6a){var _0x4a2476=typeof _0x46d625[_0xf97c('0xe')]==='undefined'&&typeof _0x46d625[_0xf97c('0xf')]===_0xf97c('0x10');var _0x1b0448=_0x241f6a[_0xf97c('0x11')];var _0x54254e=_0x4a2476?0x0:_0x46d625[_0xf97c('0xe')];var _0x1fb581=_0x4a2476?_0x241f6a[_0xf97c('0x11')]:_0x46d625[_0xf97c('0xe')]+_0x46d625[_0xf97c('0xf')];var _0x508d8b;if(_0x1fb581>=_0x1b0448){_0x1fb581=_0x1b0448;_0x508d8b=0xc8;}else{_0x508d8b=0xce;}_0x14f4b5[_0xf97c('0xb')](_0x508d8b);return _0x14f4b5[_0xf97c('0x12')](_0xf97c('0x13'),_0x54254e+'-'+_0x1fb581+'/'+_0x1b0448)[_0xf97c('0xd')](_0x241f6a);}return null;};}function saveUpdates(_0x53479b){return function(_0x32bb77){if(_0x32bb77){return _0x32bb77[_0xf97c('0x14')](_0x53479b)[_0xf97c('0x15')](function(_0x14aeaa){return _0x14aeaa;});}return null;};}function removeEntity(_0x9c46fd){return function(_0x1e3ab9){if(_0x1e3ab9){return _0x1e3ab9[_0xf97c('0x16')]()[_0xf97c('0x15')](function(){_0x9c46fd['status'](0xcc)[_0xf97c('0xc')]();});}};}function handleEntityNotFound(_0x653bad){return function(_0x1d7377){if(!_0x1d7377){_0x653bad['sendStatus'](0x194);}return _0x1d7377;};}function handleError(_0x41e07e,_0x54edc1){_0x54edc1=_0x54edc1||0x1f4;return function(_0x1a747a){logger[_0xf97c('0x17')](_0x1a747a['stack']);if(_0x1a747a['name']){delete _0x1a747a[_0xf97c('0x18')];}_0x41e07e[_0xf97c('0xb')](_0x54edc1)[_0xf97c('0x19')](_0x1a747a);};}function maskClientSecret(_0x4925ef){return _[_0xf97c('0x1a')](_0x4925ef['slice'](0x0,0x3),0x14,'*');}exports[_0xf97c('0x1b')]=function(_0x1929cf,_0x22a3d7){var _0x240a44={},_0x439448={},_0xf8a112={'count':0x0,'rows':[]};var _0x18f66e=_[_0xf97c('0x1c')](db[_0xf97c('0x1d')][_0xf97c('0x1e')],function(_0x28ff47){return{'name':_0x28ff47[_0xf97c('0x1f')],'type':_0x28ff47[_0xf97c('0x20')][_0xf97c('0x21')]};});_0x439448[_0xf97c('0x22')]=_[_0xf97c('0x1c')](_0x18f66e,'name');_0x439448[_0xf97c('0x23')]=_[_0xf97c('0x24')](_0x1929cf['query']);_0x439448['filters']=_['intersection'](_0x439448['model'],_0x439448[_0xf97c('0x23')]);_0x240a44[_0xf97c('0x25')]=_['intersection'](_0x439448['model'],qs[_0xf97c('0x26')](_0x1929cf[_0xf97c('0x23')][_0xf97c('0x26')]));_0x240a44[_0xf97c('0x25')]=_0x240a44[_0xf97c('0x25')][_0xf97c('0x27')]?_0x240a44['attributes']:_0x439448[_0xf97c('0x22')];if(!_0x1929cf[_0xf97c('0x23')][_0xf97c('0x28')]('nolimit')){_0x240a44[_0xf97c('0xf')]=qs[_0xf97c('0xf')](_0x1929cf['query'][_0xf97c('0xf')]);_0x240a44['offset']=qs[_0xf97c('0xe')](_0x1929cf[_0xf97c('0x23')][_0xf97c('0xe')]);}_0x240a44['order']=qs['sort'](_0x1929cf[_0xf97c('0x23')]['sort']);_0x240a44[_0xf97c('0x29')]=qs['filters'](_['pick'](_0x1929cf[_0xf97c('0x23')],_0x439448[_0xf97c('0x2a')]),_0x18f66e);if(_0x1929cf['query'][_0xf97c('0x2b')]){_0x240a44[_0xf97c('0x29')]=_[_0xf97c('0x2c')](_0x240a44[_0xf97c('0x29')],{'$or':_[_0xf97c('0x1c')](_0x18f66e,function(_0x46d50c){if(_0x46d50c[_0xf97c('0x20')]!=='VIRTUAL'){var _0x5c12bb={};_0x5c12bb[_0x46d50c[_0xf97c('0x18')]]={'$like':'%'+_0x1929cf[_0xf97c('0x23')]['filter']+'%'};return _0x5c12bb;}})});}_0x240a44=_[_0xf97c('0x2c')]({},_0x240a44,_0x1929cf[_0xf97c('0x2d')]);var _0x399859={'where':_0x240a44[_0xf97c('0x29')]};return db[_0xf97c('0x1d')][_0xf97c('0x11')](_0x399859)[_0xf97c('0x15')](function(_0x579cab){_0xf8a112['count']=_0x579cab;if(_0x1929cf['query'][_0xf97c('0x2e')]){_0x240a44[_0xf97c('0x2f')]=[{'all':!![]}];}return db[_0xf97c('0x1d')][_0xf97c('0x30')](_0x240a44);})[_0xf97c('0x15')](function(_0x5ee765){_0xf8a112[_0xf97c('0x31')]=_[_0xf97c('0x1c')](_0x5ee765,function(_0x3606e7){if(_0x3606e7[_0xf97c('0x32')]===_0xf97c('0x33')){var _0x48e74d=encryptor['decryptString'](_0x3606e7[_0xf97c('0x34')]);_0x3606e7[_0xf97c('0x34')]=maskClientSecret(_0x48e74d);}return _0x3606e7;});return _0xf8a112;})[_0xf97c('0x15')](respondWithFilteredResult(_0x22a3d7,_0x240a44))[_0xf97c('0x35')](handleError(_0x22a3d7,null));};exports[_0xf97c('0x36')]=function(_0x4d9504,_0x12f078){var _0x3da6b9={'raw':!![],'where':{'id':_0x4d9504[_0xf97c('0x37')]['id']}},_0x5510ce={};_0x5510ce[_0xf97c('0x22')]=_[_0xf97c('0x24')](db[_0xf97c('0x1d')][_0xf97c('0x1e')]);_0x5510ce[_0xf97c('0x23')]=_[_0xf97c('0x24')](_0x4d9504[_0xf97c('0x23')]);_0x5510ce[_0xf97c('0x2a')]=_[_0xf97c('0x38')](_0x5510ce[_0xf97c('0x22')],_0x5510ce[_0xf97c('0x23')]);_0x3da6b9['attributes']=_['intersection'](_0x5510ce[_0xf97c('0x22')],qs[_0xf97c('0x26')](_0x4d9504['query'][_0xf97c('0x26')]));_0x3da6b9[_0xf97c('0x25')]=_0x3da6b9[_0xf97c('0x25')][_0xf97c('0x27')]?_0x3da6b9[_0xf97c('0x25')]:_0x5510ce['model'];if(_0x4d9504[_0xf97c('0x23')][_0xf97c('0x2e')]){_0x3da6b9['include']=[{'all':!![]}];}_0x3da6b9=_[_0xf97c('0x2c')]({},_0x3da6b9,_0x4d9504[_0xf97c('0x2d')]);return db[_0xf97c('0x1d')][_0xf97c('0x39')](_0x3da6b9)[_0xf97c('0x15')](handleEntityNotFound(_0x12f078,null))[_0xf97c('0x15')](function(_0x18c702){if(_0x18c702['service']===_0xf97c('0x33')){var _0x2776dc=encryptor[_0xf97c('0x3a')](_0x18c702[_0xf97c('0x34')]);_0x18c702[_0xf97c('0x34')]=maskClientSecret(_0x2776dc);}return _0x18c702;})[_0xf97c('0x15')](respondWithResult(_0x12f078,null))['catch'](handleError(_0x12f078,null));};exports[_0xf97c('0x3b')]=function(_0x48f103,_0x117dbc){if(!_0x48f103[_0xf97c('0x3c')][_0xf97c('0x18')])throw new Error(_0xf97c('0x3d'));if(!_0x48f103['body'][_0xf97c('0x32')])throw new Error(_0xf97c('0x3e'));var _0x52f734=db[_0xf97c('0x1d')][_0xf97c('0x1e')][_0xf97c('0x32')][_0xf97c('0x3f')];if(!_0x52f734[_0xf97c('0x40')](_0x48f103[_0xf97c('0x3c')]['service']))throw new Error(_0xf97c('0x41')+_0x52f734[_0xf97c('0x42')](',\x20'));if(_0x48f103[_0xf97c('0x3c')][_0xf97c('0x32')]==='MicrosoftAzure'&&_0x48f103[_0xf97c('0x3c')][_0xf97c('0x34')]){_0x48f103[_0xf97c('0x3c')][_0xf97c('0x34')]=encryptor['encryptString'](_0x48f103[_0xf97c('0x3c')][_0xf97c('0x34')]);}return db[_0xf97c('0x1d')][_0xf97c('0x3b')](_0x48f103[_0xf97c('0x3c')],{})[_0xf97c('0x15')](respondWithResult(_0x117dbc,0xc9))[_0xf97c('0x35')](handleError(_0x117dbc,null));};exports['update']=function(_0xbe5c9a,_0x29dad4){if(_0xbe5c9a[_0xf97c('0x3c')]['id']){delete _0xbe5c9a[_0xf97c('0x3c')]['id'];}return db[_0xf97c('0x1d')]['find']({'where':{'id':_0xbe5c9a['params']['id']}})['then'](handleEntityNotFound(_0x29dad4,null))[_0xf97c('0x15')](function(_0x490a58){if(_0x490a58[_0xf97c('0x32')]==='MicrosoftAzure'&&_0xbe5c9a[_0xf97c('0x3c')][_0xf97c('0x34')]){_0xbe5c9a[_0xf97c('0x3c')][_0xf97c('0x34')]=encryptor[_0xf97c('0x43')](_0xbe5c9a[_0xf97c('0x3c')][_0xf97c('0x34')]);}return _0x490a58;})['then'](saveUpdates(_0xbe5c9a[_0xf97c('0x3c')],null))[_0xf97c('0x15')](respondWithResult(_0x29dad4,null))[_0xf97c('0x35')](handleError(_0x29dad4,null));};exports[_0xf97c('0x16')]=function(_0x3efd7e,_0x11c8c2){return db[_0xf97c('0x1d')][_0xf97c('0x39')]({'where':{'id':_0x3efd7e[_0xf97c('0x37')]['id']}})[_0xf97c('0x15')](handleEntityNotFound(_0x11c8c2,null))[_0xf97c('0x15')](removeEntity(_0x11c8c2,null))['catch'](handleError(_0x11c8c2,null));};exports[_0xf97c('0x44')]=function(_0x4c4d83,_0x3c2173){return db['CloudProvider'][_0xf97c('0x45')]({'where':{'id':_0x4c4d83[_0xf97c('0x37')]['id']},'raw':!![]})[_0xf97c('0x15')](function(_0x546c9c){if(!_0x546c9c)return _0x3c2173[_0xf97c('0x46')](0x194);return{'url':oauth[_0xf97c('0x47')](_0x546c9c,_0x4c4d83[_0xf97c('0x48')]['id'])};})[_0xf97c('0x15')](respondWithResult(_0x3c2173,null))[_0xf97c('0x35')](handleError(_0x3c2173,null));};exports[_0xf97c('0x49')]=function(_0x1a3d2e,_0x3d8d89){var _0x333e8e=_0x1a3d2e[_0xf97c('0x3c')];var _0x1ceda2;var _0x483a80;if(_0x333e8e[_0xf97c('0x17')])throw _0x333e8e;redis[_0xf97c('0x4a')](_0x333e8e[_0xf97c('0x4b')])['then'](function(_0x3b622e){if(!_0x3b622e)throw new Error(_0xf97c('0x4c'));_0x1ceda2=JSON[_0xf97c('0x4d')](_0x3b622e);var _0x4f32d8=Buffer[_0xf97c('0x4e')](_0x333e8e['state'],_0xf97c('0x4f'))['toString'](_0xf97c('0x50'));_0x483a80=JSON[_0xf97c('0x4d')](_0x4f32d8);if(!oauth['isValidIdToken'](_0x333e8e[_0xf97c('0x51')],_0x1ceda2[_0xf97c('0x52')]))throw new Error(_0xf97c('0x53'));redis[_0xf97c('0x54')](_0x333e8e[_0xf97c('0x4b')]);return oauth[_0xf97c('0x55')](_0x333e8e['code'],_0x1ceda2);})[_0xf97c('0x15')](function(_0x25bb9d){_0x1ceda2['data5']=_0x25bb9d['access_token'];_0x1ceda2[_0xf97c('0x56')]=_0x25bb9d['refresh_token'];return db[_0xf97c('0x1d')][_0xf97c('0x14')]({'data5':_0x1ceda2[_0xf97c('0x57')],'data6':_0x1ceda2[_0xf97c('0x56')]},{'where':{'id':_0x1ceda2['id']}});})[_0xf97c('0x15')](function(){oauth[_0xf97c('0x58')](_0x1ceda2);socket['emit'](_0xf97c('0x59'),{'id':_0x483a80['id']});return;})['then'](respondWithStatusCode(_0x3d8d89,null))[_0xf97c('0x35')](function(_0x2a9ccb){if(_0x483a80){socket[_0xf97c('0x5a')](_0xf97c('0x5b'),{'id':_0x483a80['id']});}if(!_0x1ceda2){logger[_0xf97c('0x17')](_0xf97c('0x5c'),_0x2a9ccb);return _0x3d8d89[_0xf97c('0xb')](0x1f4)[_0xf97c('0x19')](_0x2a9ccb['message']);}logger[_0xf97c('0x17')](_0xf97c('0x5d'),_0x1ceda2['id'],JSON[_0xf97c('0x5e')](_0x2a9ccb));});}; \ No newline at end of file +var _0x7f2f=['filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','MicrosoftAzure','data3','show','params','keys','rawAttributes','service','decryptString','catch','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','encryptString','create','find','oauth2MicrosoftAuthorize','generateMicrosoftAuthorizationUrl','error','get','state','Invalid\x20state\x20parameter','parse','toString','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code','data5','data6','refresh_token','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','stringify','../../components/encryptor','../../config/environment','../../config/logger','api','./cloudProvider.oauth','redis','defaults','socket.io-emitter','end','status','offset','undefined','limit','count','set','Content-Range','json','update','destroy','then','sendStatus','stack','name','send','padEnd','index','map','CloudProvider','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x1226ee,_0x1d772c){var _0x1a7739=function(_0x129817){while(--_0x129817){_0x1226ee['push'](_0x1226ee['shift']());}};_0x1a7739(++_0x1d772c);}(_0x7f2f,0xec));var _0xf7f2=function(_0x13e9d4,_0x25483d){_0x13e9d4=_0x13e9d4-0x0;var _0x2c62b8=_0x7f2f[_0x13e9d4];return _0x2c62b8;};'use strict';var _=require('lodash');var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var encryptor=require(_0xf7f2('0x0'));var config=require(_0xf7f2('0x1'));var logger=require(_0xf7f2('0x2'))(_0xf7f2('0x3'));var db=require('../../mysqldb')['db'];var oauth=require(_0xf7f2('0x4'));config[_0xf7f2('0x5')]=_[_0xf7f2('0x6')](config[_0xf7f2('0x5')],{'host':'localhost','port':0x18eb});var socket=require(_0xf7f2('0x7'))(new Redis(config['redis']));var redis=new Redis(config[_0xf7f2('0x5')]);function respondWithStatusCode(_0x3c9f1d,_0x1fbbdb){_0x1fbbdb=_0x1fbbdb||0xcc;return function(_0x5ce4a9){if(_0x5ce4a9){return _0x3c9f1d['sendStatus'](_0x1fbbdb);}return _0x3c9f1d['status'](_0x1fbbdb)[_0xf7f2('0x8')]();};}function respondWithResult(_0xb2763f,_0x39954d){_0x39954d=_0x39954d||0xc8;return function(_0x3c78c3){if(_0x3c78c3){return _0xb2763f[_0xf7f2('0x9')](_0x39954d)['json'](_0x3c78c3);}};}function respondWithFilteredResult(_0x3e1a77,_0xdc5d02){return function(_0x2db9a0){if(_0x2db9a0){var _0x2f88fe=typeof _0xdc5d02[_0xf7f2('0xa')]===_0xf7f2('0xb')&&typeof _0xdc5d02[_0xf7f2('0xc')]===_0xf7f2('0xb');var _0x80cce6=_0x2db9a0[_0xf7f2('0xd')];var _0x47438a=_0x2f88fe?0x0:_0xdc5d02[_0xf7f2('0xa')];var _0xf3f072=_0x2f88fe?_0x2db9a0[_0xf7f2('0xd')]:_0xdc5d02['offset']+_0xdc5d02[_0xf7f2('0xc')];var _0x3418ab;if(_0xf3f072>=_0x80cce6){_0xf3f072=_0x80cce6;_0x3418ab=0xc8;}else{_0x3418ab=0xce;}_0x3e1a77[_0xf7f2('0x9')](_0x3418ab);return _0x3e1a77[_0xf7f2('0xe')](_0xf7f2('0xf'),_0x47438a+'-'+_0xf3f072+'/'+_0x80cce6)[_0xf7f2('0x10')](_0x2db9a0);}return null;};}function saveUpdates(_0x524f05){return function(_0x142a00){if(_0x142a00){return _0x142a00[_0xf7f2('0x11')](_0x524f05)['then'](function(_0x21fad8){return _0x21fad8;});}return null;};}function removeEntity(_0x5391a4){return function(_0xd92251){if(_0xd92251){return _0xd92251[_0xf7f2('0x12')]()[_0xf7f2('0x13')](function(){_0x5391a4[_0xf7f2('0x9')](0xcc)['end']();});}};}function handleEntityNotFound(_0x38e95a){return function(_0x50ecba){if(!_0x50ecba){_0x38e95a[_0xf7f2('0x14')](0x194);}return _0x50ecba;};}function handleError(_0x447394,_0x11e0cc){_0x11e0cc=_0x11e0cc||0x1f4;return function(_0x1f7f86){logger['error'](_0x1f7f86[_0xf7f2('0x15')]);if(_0x1f7f86[_0xf7f2('0x16')]){delete _0x1f7f86[_0xf7f2('0x16')];}_0x447394[_0xf7f2('0x9')](_0x11e0cc)[_0xf7f2('0x17')](_0x1f7f86);};}function maskClientSecret(_0x4d6bdc){return _[_0xf7f2('0x18')](_0x4d6bdc['slice'](0x0,0x3),0x14,'*');}exports[_0xf7f2('0x19')]=function(_0x531e86,_0x3a42d4){var _0x51ae4d={},_0x114722={},_0x17a806={'count':0x0,'rows':[]};var _0x5e40fa=_[_0xf7f2('0x1a')](db[_0xf7f2('0x1b')]['rawAttributes'],function(_0x3639be){return{'name':_0x3639be[_0xf7f2('0x1c')],'type':_0x3639be['type'][_0xf7f2('0x1d')]};});_0x114722[_0xf7f2('0x1e')]=_[_0xf7f2('0x1a')](_0x5e40fa,_0xf7f2('0x16'));_0x114722[_0xf7f2('0x1f')]=_['keys'](_0x531e86['query']);_0x114722[_0xf7f2('0x20')]=_[_0xf7f2('0x21')](_0x114722[_0xf7f2('0x1e')],_0x114722[_0xf7f2('0x1f')]);_0x51ae4d[_0xf7f2('0x22')]=_['intersection'](_0x114722[_0xf7f2('0x1e')],qs['fields'](_0x531e86[_0xf7f2('0x1f')][_0xf7f2('0x23')]));_0x51ae4d[_0xf7f2('0x22')]=_0x51ae4d[_0xf7f2('0x22')][_0xf7f2('0x24')]?_0x51ae4d['attributes']:_0x114722['model'];if(!_0x531e86[_0xf7f2('0x1f')][_0xf7f2('0x25')](_0xf7f2('0x26'))){_0x51ae4d['limit']=qs['limit'](_0x531e86[_0xf7f2('0x1f')]['limit']);_0x51ae4d[_0xf7f2('0xa')]=qs[_0xf7f2('0xa')](_0x531e86[_0xf7f2('0x1f')][_0xf7f2('0xa')]);}_0x51ae4d[_0xf7f2('0x27')]=qs[_0xf7f2('0x28')](_0x531e86[_0xf7f2('0x1f')]['sort']);_0x51ae4d[_0xf7f2('0x29')]=qs[_0xf7f2('0x20')](_[_0xf7f2('0x2a')](_0x531e86[_0xf7f2('0x1f')],_0x114722[_0xf7f2('0x20')]),_0x5e40fa);if(_0x531e86[_0xf7f2('0x1f')][_0xf7f2('0x2b')]){_0x51ae4d[_0xf7f2('0x29')]=_['merge'](_0x51ae4d[_0xf7f2('0x29')],{'$or':_[_0xf7f2('0x1a')](_0x5e40fa,function(_0x42b024){if(_0x42b024[_0xf7f2('0x2c')]!==_0xf7f2('0x2d')){var _0x953f05={};_0x953f05[_0x42b024['name']]={'$like':'%'+_0x531e86[_0xf7f2('0x1f')][_0xf7f2('0x2b')]+'%'};return _0x953f05;}})});}_0x51ae4d=_[_0xf7f2('0x2e')]({},_0x51ae4d,_0x531e86[_0xf7f2('0x2f')]);var _0x48df73={'where':_0x51ae4d[_0xf7f2('0x29')]};return db[_0xf7f2('0x1b')][_0xf7f2('0xd')](_0x48df73)[_0xf7f2('0x13')](function(_0x59f3f8){_0x17a806[_0xf7f2('0xd')]=_0x59f3f8;if(_0x531e86['query'][_0xf7f2('0x30')]){_0x51ae4d[_0xf7f2('0x31')]=[{'all':!![]}];}return db['CloudProvider'][_0xf7f2('0x32')](_0x51ae4d);})[_0xf7f2('0x13')](function(_0x91ecf6){_0x17a806[_0xf7f2('0x33')]=_[_0xf7f2('0x1a')](_0x91ecf6,function(_0x5bee75){if(_0x5bee75['service']===_0xf7f2('0x34')){var _0x1a040e=encryptor['decryptString'](_0x5bee75['data3']);_0x5bee75[_0xf7f2('0x35')]=maskClientSecret(_0x1a040e);}return _0x5bee75;});return _0x17a806;})[_0xf7f2('0x13')](respondWithFilteredResult(_0x3a42d4,_0x51ae4d))['catch'](handleError(_0x3a42d4,null));};exports[_0xf7f2('0x36')]=function(_0x5f1157,_0x3f32c0){var _0x55270e={'raw':!![],'where':{'id':_0x5f1157[_0xf7f2('0x37')]['id']}},_0x1599a2={};_0x1599a2[_0xf7f2('0x1e')]=_[_0xf7f2('0x38')](db[_0xf7f2('0x1b')][_0xf7f2('0x39')]);_0x1599a2['query']=_[_0xf7f2('0x38')](_0x5f1157[_0xf7f2('0x1f')]);_0x1599a2[_0xf7f2('0x20')]=_[_0xf7f2('0x21')](_0x1599a2['model'],_0x1599a2['query']);_0x55270e[_0xf7f2('0x22')]=_[_0xf7f2('0x21')](_0x1599a2[_0xf7f2('0x1e')],qs[_0xf7f2('0x23')](_0x5f1157[_0xf7f2('0x1f')][_0xf7f2('0x23')]));_0x55270e[_0xf7f2('0x22')]=_0x55270e[_0xf7f2('0x22')]['length']?_0x55270e[_0xf7f2('0x22')]:_0x1599a2[_0xf7f2('0x1e')];if(_0x5f1157[_0xf7f2('0x1f')][_0xf7f2('0x30')]){_0x55270e[_0xf7f2('0x31')]=[{'all':!![]}];}_0x55270e=_[_0xf7f2('0x2e')]({},_0x55270e,_0x5f1157[_0xf7f2('0x2f')]);return db[_0xf7f2('0x1b')]['find'](_0x55270e)[_0xf7f2('0x13')](handleEntityNotFound(_0x3f32c0,null))[_0xf7f2('0x13')](function(_0x58b05e){if(_0x58b05e[_0xf7f2('0x3a')]===_0xf7f2('0x34')){var _0x87f75a=encryptor[_0xf7f2('0x3b')](_0x58b05e['data3']);_0x58b05e['data3']=maskClientSecret(_0x87f75a);}return _0x58b05e;})['then'](respondWithResult(_0x3f32c0,null))[_0xf7f2('0x3c')](handleError(_0x3f32c0,null));};exports['create']=function(_0x7a58c4,_0x34a3b5){if(!_0x7a58c4[_0xf7f2('0x3d')][_0xf7f2('0x16')])throw new Error(_0xf7f2('0x3e'));if(!_0x7a58c4[_0xf7f2('0x3d')][_0xf7f2('0x3a')])throw new Error(_0xf7f2('0x3f'));var _0x540072=db[_0xf7f2('0x1b')][_0xf7f2('0x39')][_0xf7f2('0x3a')][_0xf7f2('0x40')];if(!_0x540072[_0xf7f2('0x41')](_0x7a58c4[_0xf7f2('0x3d')][_0xf7f2('0x3a')]))throw new Error(_0xf7f2('0x42')+_0x540072['join'](',\x20'));if(_0x7a58c4['body']['service']==='MicrosoftAzure'&&_0x7a58c4[_0xf7f2('0x3d')][_0xf7f2('0x35')]){_0x7a58c4[_0xf7f2('0x3d')]['data3']=encryptor[_0xf7f2('0x43')](_0x7a58c4[_0xf7f2('0x3d')]['data3']);}return db[_0xf7f2('0x1b')][_0xf7f2('0x44')](_0x7a58c4[_0xf7f2('0x3d')],{})[_0xf7f2('0x13')](respondWithResult(_0x34a3b5,0xc9))[_0xf7f2('0x3c')](handleError(_0x34a3b5,null));};exports[_0xf7f2('0x11')]=function(_0x5b6903,_0x5a80b0){if(_0x5b6903[_0xf7f2('0x3d')]['id']){delete _0x5b6903['body']['id'];}return db[_0xf7f2('0x1b')][_0xf7f2('0x45')]({'where':{'id':_0x5b6903[_0xf7f2('0x37')]['id']}})['then'](handleEntityNotFound(_0x5a80b0,null))['then'](function(_0x11af4a){if(_0x11af4a[_0xf7f2('0x3a')]===_0xf7f2('0x34')&&_0x5b6903[_0xf7f2('0x3d')][_0xf7f2('0x35')]){_0x5b6903[_0xf7f2('0x3d')][_0xf7f2('0x35')]=encryptor[_0xf7f2('0x43')](_0x5b6903['body']['data3']);}return _0x11af4a;})[_0xf7f2('0x13')](saveUpdates(_0x5b6903['body'],null))[_0xf7f2('0x13')](respondWithResult(_0x5a80b0,null))[_0xf7f2('0x3c')](handleError(_0x5a80b0,null));};exports[_0xf7f2('0x12')]=function(_0x1d6a3c,_0x218d9f){return db['CloudProvider'][_0xf7f2('0x45')]({'where':{'id':_0x1d6a3c[_0xf7f2('0x37')]['id']}})[_0xf7f2('0x13')](handleEntityNotFound(_0x218d9f,null))[_0xf7f2('0x13')](removeEntity(_0x218d9f,null))[_0xf7f2('0x3c')](handleError(_0x218d9f,null));};exports[_0xf7f2('0x46')]=function(_0x1adad0,_0x1a7171){return db[_0xf7f2('0x1b')]['findOne']({'where':{'id':_0x1adad0[_0xf7f2('0x37')]['id']},'raw':!![]})[_0xf7f2('0x13')](function(_0x19daab){if(!_0x19daab)return _0x1a7171['sendStatus'](0x194);return{'url':oauth[_0xf7f2('0x47')](_0x19daab,_0x1adad0['user']['id'])};})['then'](respondWithResult(_0x1a7171,null))[_0xf7f2('0x3c')](handleError(_0x1a7171,null));};exports['oauth2MicrosoftCallback']=function(_0x5af852,_0x237d92){var _0x14fba3=_0x5af852['body'];var _0x1b99d9;var _0x329f27;if(_0x14fba3[_0xf7f2('0x48')])throw _0x14fba3;redis[_0xf7f2('0x49')](_0x14fba3[_0xf7f2('0x4a')])[_0xf7f2('0x13')](function(_0x4355f5){if(!_0x4355f5)throw new Error(_0xf7f2('0x4b'));_0x1b99d9=JSON[_0xf7f2('0x4c')](_0x4355f5);var _0x191228=Buffer['from'](_0x14fba3['state'],'base64')[_0xf7f2('0x4d')]('ascii');_0x329f27=JSON['parse'](_0x191228);if(!oauth[_0xf7f2('0x4e')](_0x14fba3[_0xf7f2('0x4f')],_0x1b99d9[_0xf7f2('0x50')]))throw new Error(_0xf7f2('0x51'));redis[_0xf7f2('0x52')](_0x14fba3[_0xf7f2('0x4a')]);return oauth[_0xf7f2('0x53')](_0x14fba3[_0xf7f2('0x54')],_0x1b99d9);})['then'](function(_0x18eb7c){_0x1b99d9[_0xf7f2('0x55')]=_0x18eb7c['access_token'];_0x1b99d9[_0xf7f2('0x56')]=_0x18eb7c[_0xf7f2('0x57')];return db[_0xf7f2('0x1b')]['update']({'data5':_0x1b99d9[_0xf7f2('0x55')],'data6':_0x1b99d9[_0xf7f2('0x56')]},{'where':{'id':_0x1b99d9['id']}});})[_0xf7f2('0x13')](function(){oauth[_0xf7f2('0x58')](_0x1b99d9);socket[_0xf7f2('0x59')](_0xf7f2('0x5a'),{'id':_0x329f27['id']});return;})[_0xf7f2('0x13')](respondWithStatusCode(_0x237d92,null))[_0xf7f2('0x3c')](function(_0xcc4b4e){if(_0x329f27){socket[_0xf7f2('0x59')](_0xf7f2('0x5b'),{'id':_0x329f27['id']});}if(!_0x1b99d9){logger[_0xf7f2('0x48')]('Invalid\x20authentication\x20state\x20parameter',_0xcc4b4e);return _0x237d92[_0xf7f2('0x9')](0x1f4)['send'](_0xcc4b4e['message']);}logger[_0xf7f2('0x48')]('Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s',_0x1b99d9['id'],JSON[_0xf7f2('0x5c')](_0xcc4b4e));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 1430d10..cee5d75 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 _0x3b1f=['CloudProvider','cloud_providers','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./cloudProvider.attributes','exports'];(function(_0x3bb38,_0x5649cc){var _0x5349f6=function(_0x1e8281){while(--_0x1e8281){_0x3bb38['push'](_0x3bb38['shift']());}};_0x5349f6(++_0x5649cc);}(_0x3b1f,0x10a));var _0xf3b1=function(_0x3644c4,_0x33285b){_0x3644c4=_0x3644c4-0x0;var _0x375a18=_0x3b1f[_0x3644c4];return _0x375a18;};'use strict';var _=require(_0xf3b1('0x0'));var util=require(_0xf3b1('0x1'));var logger=require(_0xf3b1('0x2'))(_0xf3b1('0x3'));var moment=require(_0xf3b1('0x4'));var BPromise=require('bluebird');var rp=require(_0xf3b1('0x5'));var fs=require('fs');var path=require(_0xf3b1('0x6'));var rimraf=require('rimraf');var config=require(_0xf3b1('0x7'));var attributes=require(_0xf3b1('0x8'));module[_0xf3b1('0x9')]=function(_0x28de67,_0x39ca15){return _0x28de67['define'](_0xf3b1('0xa'),attributes,{'tableName':_0xf3b1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd5cc=['cloud_providers','util','../../config/logger','api','moment','bluebird','request-promise','path','exports','define','CloudProvider'];(function(_0x1332d0,_0x193365){var _0xc63b37=function(_0x3c01d9){while(--_0x3c01d9){_0x1332d0['push'](_0x1332d0['shift']());}};_0xc63b37(++_0x193365);}(_0xd5cc,0xb1));var _0xcd5c=function(_0x2abd91,_0x5c706b){_0x2abd91=_0x2abd91-0x0;var _0x560e13=_0xd5cc[_0x2abd91];return _0x560e13;};'use strict';var _=require('lodash');var util=require(_0xcd5c('0x0'));var logger=require(_0xcd5c('0x1'))(_0xcd5c('0x2'));var moment=require(_0xcd5c('0x3'));var BPromise=require(_0xcd5c('0x4'));var rp=require(_0xcd5c('0x5'));var fs=require('fs');var path=require(_0xcd5c('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./cloudProvider.attributes');module[_0xcd5c('0x7')]=function(_0x2cfe27,_0x2de564){return _0x2cfe27[_0xcd5c('0x8')](_0xcd5c('0x9'),attributes,{'tableName':_0xcd5c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.oauth.js b/server/api/cloudProvider/cloudProvider.oauth.js index fbe51c8..6229b16 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 _0x778f=['../../config/schedule/cloud-provider','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','profile','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','openid','/authorize','/token','map','type','Dynamics365','push','data7','join','Outlook365','/.default','replace','{TENANT_ID}','data2','code','id_token','stringify','toString','base64','randomBytes','hex','client_id','data1','response_type','redirect_uri','data4','form_post','scope','state','nonce','prompt','key','value','oauth2Claims','oauth2/','set','payload','iss','aud','audience','isAfter','exp','data3','CloudProvider','findOne','then','refresh_token','data6','decryptString','data5','access_token','update','catch','authorization_code','intervals','bind','all','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','jsonwebtoken','moment','ioredis','request-promise','util','../../components/encryptor','../../config/environment'];(function(_0x438bd2,_0x22dddc){var _0x4922b0=function(_0x4e50c7){while(--_0x4e50c7){_0x438bd2['push'](_0x438bd2['shift']());}};_0x4922b0(++_0x22dddc);}(_0x778f,0x134));var _0xf778=function(_0x17928f,_0x4ad33f){_0x17928f=_0x17928f-0x0;var _0x500b63=_0x778f[_0x17928f];return _0x500b63;};'use strict';var _=require(_0xf778('0x0'));var crypto=require('crypto');var jwt=require(_0xf778('0x1'));var moment=require(_0xf778('0x2'));var Redis=require(_0xf778('0x3'));var rp=require(_0xf778('0x4'));var util=require(_0xf778('0x5'));var encryptor=require(_0xf778('0x6'));var config=require(_0xf778('0x7'));var logger=require('../../config/logger')('api');var schedule=require(_0xf778('0x8'));var db=require('../../mysqldb')['db'];config[_0xf778('0x9')]=_[_0xf778('0xa')](config['redis'],{'host':_0xf778('0xb'),'port':0x18eb});var redis=new Redis(config['redis']);var MICROSOFT_AUTH_URL=_0xf778('0xc');var AZURE_AUTH_SCOPES={'Outlook365':['openid',_0xf778('0xd'),_0xf778('0xe'),_0xf778('0xf'),_0xf778('0x10'),_0xf778('0x11'),_0xf778('0x12')],'Dynamics365':[_0xf778('0x13'),_0xf778('0xf')]};var MICROSOFT_AUTH_ENDPOINT=_0xf778('0x14');var MICROSOFT_TOKEN_ENDPOINT=_0xf778('0x15');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x3759ae){var _0xf7c0c5=_[_0xf778('0x16')](AZURE_AUTH_SCOPES[_0x3759ae['type']]);if(_0x3759ae[_0xf778('0x17')]===_0xf778('0x18'))_0xf7c0c5[_0xf778('0x19')](_0x3759ae[_0xf778('0x1a')]+'/.default');return _0xf7c0c5[_0xf778('0x1b')]('\x20');}function getAccessTokenScope(_0x36e350){if(_0x36e350[_0xf778('0x17')]===_0xf778('0x1c'))return _0xf778('0x10');if(_0x36e350['type']===_0xf778('0x18'))return _0x36e350[_0xf778('0x1a')]+_0xf778('0x1d');}function generateMicrosoftAuthorizationUrl(_0x579577,_0x5026a9){var _0x42f012=MICROSOFT_AUTH_URL[_0xf778('0x1e')](_0xf778('0x1f'),_0x579577[_0xf778('0x20')]);var _0x12a601=[_0xf778('0x21'),_0xf778('0x22')];var _0x3f0d51=Buffer['from'](JSON[_0xf778('0x23')]({'id':_0x5026a9}))[_0xf778('0x24')](_0xf778('0x25'));var _0x492fd8=crypto[_0xf778('0x26')](0x10)[_0xf778('0x24')](_0xf778('0x27'));var _0x599dac=getAuthorizationScopes(_0x579577);var _0x5b5402=[{'key':_0xf778('0x28'),'value':_0x579577[_0xf778('0x29')]},{'key':_0xf778('0x2a'),'value':encodeURIComponent(_0x12a601[_0xf778('0x1b')]('\x20'))},{'key':_0xf778('0x2b'),'value':_0x579577[_0xf778('0x2c')]},{'key':'response_mode','value':_0xf778('0x2d')},{'key':_0xf778('0x2e'),'value':encodeURIComponent(_0x599dac)},{'key':_0xf778('0x2f'),'value':_0x3f0d51},{'key':_0xf778('0x30'),'value':_0x492fd8},{'key':_0xf778('0x31'),'value':'login'}];var _0x4c9e17=_0x42f012+MICROSOFT_AUTH_ENDPOINT+'?'+_['map'](_0x5b5402,function(_0x1f527b){return _0x1f527b[_0xf778('0x32')]+'='+_0x1f527b[_0xf778('0x33')];})['join']('&');_0x579577[_0xf778('0x34')]={'issuer':_0x42f012[_0xf778('0x1e')](_0xf778('0x35'),''),'audience':_0x579577[_0xf778('0x29')],'state':_0x3f0d51,'nonce':_0x492fd8};redis[_0xf778('0x36')](_0x3f0d51,JSON[_0xf778('0x23')](_0x579577));return _0x4c9e17;}function isValidIdToken(_0x49fc2d,_0x197d4c){try{var _0x986268=jwt['decode'](_0x49fc2d,{'complete':!![]});var _0x3e63fd=_0x986268[_0xf778('0x37')];if(_0x3e63fd[_0xf778('0x38')]!==_0x197d4c['issuer'])return![];if(_0x3e63fd[_0xf778('0x39')]!==_0x197d4c[_0xf778('0x3a')])return![];if(_0x3e63fd[_0xf778('0x30')]!==_0x197d4c['nonce'])return![];if(moment()[_0xf778('0x3b')](moment['unix'](_0x3e63fd[_0xf778('0x3c')])))return![];return!![];}catch(_0x329b5b){throw _0x329b5b;}}function refreshOauth2MicrosoftAccessToken(_0x238d18){return Promise['resolve']()['then'](function(){if(_0x238d18[_0xf778('0x3d')])return _0x238d18;return db[_0xf778('0x3e')][_0xf778('0x3f')]({'where':{'id':_0x238d18['id']},'raw':!![]});})[_0xf778('0x40')](function(_0x1f94c6){var _0xe478d6={'grant_type':_0xf778('0x41'),'refresh_token':_0x1f94c6[_0xf778('0x42')],'scope':getAccessTokenScope(_0x1f94c6),'redirect_uri':_0x1f94c6[_0xf778('0x2c')],'client_id':_0x1f94c6[_0xf778('0x29')],'client_secret':encryptor[_0xf778('0x43')](_0x1f94c6[_0xf778('0x3d')])};var _0x3ab67d={'method':'POST','uri':MICROSOFT_AUTH_URL[_0xf778('0x1e')]('{TENANT_ID}',_0x1f94c6[_0xf778('0x20')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0xe478d6,'json':!![]};return rp(_0x3ab67d);})[_0xf778('0x40')](function(_0x29b139){_0x238d18[_0xf778('0x44')]=_0x29b139[_0xf778('0x45')];_0x238d18[_0xf778('0x42')]=_0x29b139['refresh_token'];return db['CloudProvider'][_0xf778('0x46')]({'data5':_0x238d18[_0xf778('0x44')],'data6':_0x238d18[_0xf778('0x42')]},{'where':{'id':_0x238d18['id']}});})['then'](function(){return _0x238d18;})[_0xf778('0x47')](function(_0xbb8467){logger['error']('Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s',_0x238d18['id'],_0xbb8467);});}function getOauth2MicrosoftAccessToken(_0x709647,_0x1c12a6){var _0x5ee8e1={'grant_type':_0xf778('0x48'),'code':_0x709647,'scope':getAccessTokenScope(_0x1c12a6),'redirect_uri':_0x1c12a6[_0xf778('0x2c')],'client_id':_0x1c12a6[_0xf778('0x29')],'client_secret':encryptor[_0xf778('0x43')](_0x1c12a6['data3'])};var _0x1881a1={'method':'POST','uri':MICROSOFT_AUTH_URL['replace']('{TENANT_ID}',_0x1c12a6[_0xf778('0x20')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x5ee8e1,'json':!![]};return rp(_0x1881a1);}function startRefreshInterval(_0x3464b0){var _0x11bcf1=schedule[_0xf778('0x49')];if(_0x11bcf1[_0x3464b0['id']])clearInterval(_0x11bcf1[_0x3464b0['id']]);_0x11bcf1[_0x3464b0['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0xf778('0x4a')](this,{'id':_0x3464b0['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0xf778('0x49')]=_0x11bcf1;}function startAllRefreshIntervals(){return db['CloudProvider']['findAll']({'where':{'data6':{'$ne':null}},'raw':!![]})[_0xf778('0x40')](function(_0x3a3039){var _0x5881e9=_0x3a3039[_0xf778('0x16')](function(_0x2896b5){return refreshOauth2MicrosoftAccessToken(_0x2896b5)[_0xf778('0x40')](function(_0x55e59f){startRefreshInterval(_0x55e59f);});});return Promise[_0xf778('0x4b')](_0x5881e9);})['catch'](function(_0x3a6ad5){var _0x3d66f3=_0x3a6ad5?util[_0xf778('0x4c')](_0x3a6ad5,{'showHidden':![],'depth':null}):'';logger['error'](_0xf778('0x4d'),_0x3d66f3);});}module[_0xf778('0x4e')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0xb796=['[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','crypto','jsonwebtoken','request-promise','../../components/encryptor','../../config/logger','api','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','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','map','type','Dynamics365','push','data7','/.default','join','Outlook365','data2','code','id_token','from','stringify','toString','base64','randomBytes','client_id','redirect_uri','data4','scope','state','nonce','prompt','login','key','value','replace','oauth2/','data1','set','decode','payload','issuer','aud','audience','isAfter','exp','then','CloudProvider','findOne','refresh_token','data6','decryptString','data3','POST','{TENANT_ID}','data5','update','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','intervals','bind','findAll','all','inspect'];(function(_0x20b9fc,_0x5dab92){var _0x511a2b=function(_0x292cbd){while(--_0x292cbd){_0x20b9fc['push'](_0x20b9fc['shift']());}};_0x511a2b(++_0x5dab92);}(_0xb796,0x13a));var _0x6b79=function(_0x45c2f5,_0x586478){_0x45c2f5=_0x45c2f5-0x0;var _0xe27109=_0xb796[_0x45c2f5];return _0xe27109;};'use strict';var _=require(_0x6b79('0x0'));var crypto=require(_0x6b79('0x1'));var jwt=require(_0x6b79('0x2'));var moment=require('moment');var Redis=require('ioredis');var rp=require(_0x6b79('0x3'));var util=require('util');var encryptor=require(_0x6b79('0x4'));var config=require('../../config/environment');var logger=require(_0x6b79('0x5'))(_0x6b79('0x6'));var schedule=require('../../config/schedule/cloud-provider');var db=require('../../mysqldb')['db'];config[_0x6b79('0x7')]=_[_0x6b79('0x8')](config[_0x6b79('0x7')],{'host':_0x6b79('0x9'),'port':0x18eb});var redis=new Redis(config['redis']);var MICROSOFT_AUTH_URL=_0x6b79('0xa');var AZURE_AUTH_SCOPES={'Outlook365':[_0x6b79('0xb'),'profile',_0x6b79('0xc'),_0x6b79('0xd'),_0x6b79('0xe'),_0x6b79('0xf'),_0x6b79('0x10')],'Dynamics365':['openid',_0x6b79('0xd')]};var MICROSOFT_AUTH_ENDPOINT=_0x6b79('0x11');var MICROSOFT_TOKEN_ENDPOINT=_0x6b79('0x12');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x8abf93){var _0x167517=_[_0x6b79('0x13')](AZURE_AUTH_SCOPES[_0x8abf93[_0x6b79('0x14')]]);if(_0x8abf93['type']===_0x6b79('0x15'))_0x167517[_0x6b79('0x16')](_0x8abf93[_0x6b79('0x17')]+_0x6b79('0x18'));return _0x167517[_0x6b79('0x19')]('\x20');}function getAccessTokenScope(_0x540bb4){if(_0x540bb4[_0x6b79('0x14')]===_0x6b79('0x1a'))return _0x6b79('0xe');if(_0x540bb4[_0x6b79('0x14')]===_0x6b79('0x15'))return _0x540bb4[_0x6b79('0x17')]+_0x6b79('0x18');}function generateMicrosoftAuthorizationUrl(_0x23dded,_0x117259){var _0x2bf9cb=MICROSOFT_AUTH_URL['replace']('{TENANT_ID}',_0x23dded[_0x6b79('0x1b')]);var _0x59704a=[_0x6b79('0x1c'),_0x6b79('0x1d')];var _0x10fb64=Buffer[_0x6b79('0x1e')](JSON[_0x6b79('0x1f')]({'id':_0x117259}))[_0x6b79('0x20')](_0x6b79('0x21'));var _0x1f4f36=crypto[_0x6b79('0x22')](0x10)[_0x6b79('0x20')]('hex');var _0x209d68=getAuthorizationScopes(_0x23dded);var _0x3c30e5=[{'key':_0x6b79('0x23'),'value':_0x23dded['data1']},{'key':'response_type','value':encodeURIComponent(_0x59704a[_0x6b79('0x19')]('\x20'))},{'key':_0x6b79('0x24'),'value':_0x23dded[_0x6b79('0x25')]},{'key':'response_mode','value':'form_post'},{'key':_0x6b79('0x26'),'value':encodeURIComponent(_0x209d68)},{'key':_0x6b79('0x27'),'value':_0x10fb64},{'key':_0x6b79('0x28'),'value':_0x1f4f36},{'key':_0x6b79('0x29'),'value':_0x6b79('0x2a')}];var _0x5d1168=_0x2bf9cb+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x6b79('0x13')](_0x3c30e5,function(_0x2cee39){return _0x2cee39[_0x6b79('0x2b')]+'='+_0x2cee39[_0x6b79('0x2c')];})[_0x6b79('0x19')]('&');_0x23dded['oauth2Claims']={'issuer':_0x2bf9cb[_0x6b79('0x2d')](_0x6b79('0x2e'),''),'audience':_0x23dded[_0x6b79('0x2f')],'state':_0x10fb64,'nonce':_0x1f4f36};redis[_0x6b79('0x30')](_0x10fb64,JSON[_0x6b79('0x1f')](_0x23dded));return _0x5d1168;}function isValidIdToken(_0x1777a6,_0x1ae8dc){try{var _0x5c96ca=jwt[_0x6b79('0x31')](_0x1777a6,{'complete':!![]});var _0x171f7a=_0x5c96ca[_0x6b79('0x32')];if(_0x171f7a['iss']!==_0x1ae8dc[_0x6b79('0x33')])return![];if(_0x171f7a[_0x6b79('0x34')]!==_0x1ae8dc[_0x6b79('0x35')])return![];if(_0x171f7a['nonce']!==_0x1ae8dc[_0x6b79('0x28')])return![];if(moment()[_0x6b79('0x36')](moment['unix'](_0x171f7a[_0x6b79('0x37')])))return![];return!![];}catch(_0x44602f){throw _0x44602f;}}function refreshOauth2MicrosoftAccessToken(_0x2bfb52){return Promise['resolve']()[_0x6b79('0x38')](function(){if(_0x2bfb52['data3'])return _0x2bfb52;return db[_0x6b79('0x39')][_0x6b79('0x3a')]({'where':{'id':_0x2bfb52['id']},'raw':!![]});})[_0x6b79('0x38')](function(_0x5794ab){var _0x2189a6={'grant_type':_0x6b79('0x3b'),'refresh_token':_0x5794ab[_0x6b79('0x3c')],'scope':getAccessTokenScope(_0x5794ab),'redirect_uri':_0x5794ab[_0x6b79('0x25')],'client_id':_0x5794ab[_0x6b79('0x2f')],'client_secret':encryptor[_0x6b79('0x3d')](_0x5794ab[_0x6b79('0x3e')])};var _0x31d9c1={'method':_0x6b79('0x3f'),'uri':MICROSOFT_AUTH_URL['replace'](_0x6b79('0x40'),_0x5794ab[_0x6b79('0x1b')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x2189a6,'json':!![]};return rp(_0x31d9c1);})[_0x6b79('0x38')](function(_0x37c251){_0x2bfb52[_0x6b79('0x41')]=_0x37c251['access_token'];_0x2bfb52[_0x6b79('0x3c')]=_0x37c251[_0x6b79('0x3b')];return db['CloudProvider'][_0x6b79('0x42')]({'data5':_0x2bfb52['data5'],'data6':_0x2bfb52[_0x6b79('0x3c')]},{'where':{'id':_0x2bfb52['id']}});})[_0x6b79('0x38')](function(){return _0x2bfb52;})[_0x6b79('0x43')](function(_0x430676){logger[_0x6b79('0x44')](_0x6b79('0x45'),_0x2bfb52['id'],_0x430676);});}function getOauth2MicrosoftAccessToken(_0x526649,_0x35e0f6){var _0x5c831e={'grant_type':_0x6b79('0x46'),'code':_0x526649,'scope':getAccessTokenScope(_0x35e0f6),'redirect_uri':_0x35e0f6[_0x6b79('0x25')],'client_id':_0x35e0f6['data1'],'client_secret':encryptor[_0x6b79('0x3d')](_0x35e0f6['data3'])};var _0x458315={'method':_0x6b79('0x3f'),'uri':MICROSOFT_AUTH_URL['replace'](_0x6b79('0x40'),_0x35e0f6['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x5c831e,'json':!![]};return rp(_0x458315);}function startRefreshInterval(_0x35062b){var _0x4ab8d8=schedule[_0x6b79('0x47')];if(_0x4ab8d8[_0x35062b['id']])clearInterval(_0x4ab8d8[_0x35062b['id']]);_0x4ab8d8[_0x35062b['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x6b79('0x48')](this,{'id':_0x35062b['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule['intervals']=_0x4ab8d8;}function startAllRefreshIntervals(){return db[_0x6b79('0x39')][_0x6b79('0x49')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x6b79('0x38')](function(_0x2dc6e0){var _0x90ad72=_0x2dc6e0[_0x6b79('0x13')](function(_0x20d334){return refreshOauth2MicrosoftAccessToken(_0x20d334)['then'](function(_0x16184d){startRefreshInterval(_0x16184d);});});return Promise[_0x6b79('0x4a')](_0x90ad72);})[_0x6b79('0x43')](function(_0x18a908){var _0x35860d=_0x18a908?util[_0x6b79('0x4b')](_0x18a908,{'showHidden':![],'depth':null}):'';logger[_0x6b79('0x44')](_0x6b79('0x4c'),_0x35860d);});}module[_0x6b79('0x4d')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index 4fed54a..591dffe 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 _0xfef3=['lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xfef3,0x118));var _0x3fef=function(_0x114ff6,_0x19e80d){_0x114ff6=_0x114ff6-0x0;var _0x4d3a58=_0xfef3[_0x114ff6];return _0x4d3a58;};'use strict';var _=require(_0x3fef('0x0'));var util=require('util');var moment=require(_0x3fef('0x1'));var BPromise=require('bluebird');var rs=require(_0x3fef('0x2'));var fs=require('fs');var Redis=require(_0x3fef('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3fef('0x4'));var logger=require(_0x3fef('0x5'))('rpc');var config=require(_0x3fef('0x6'));var jayson=require(_0x3fef('0x7'));var client=jayson['client'][_0x3fef('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5f5b72,_0x800850,_0x33e00a){return new BPromise(function(_0x1fffc5,_0x41960c){return client[_0x3fef('0x9')](_0x5f5b72,_0x33e00a)[_0x3fef('0xa')](function(_0x31c30f){logger[_0x3fef('0xb')](_0x3fef('0xc'),_0x800850,_0x3fef('0xd'));logger[_0x3fef('0xe')](_0x3fef('0xf'),_0x800850,'request\x20sent',JSON[_0x3fef('0x10')](_0x31c30f));if(_0x31c30f[_0x3fef('0x11')]){if(_0x31c30f[_0x3fef('0x11')]['code']===0x1f4){logger[_0x3fef('0x11')]('CloudProvider,\x20%s,\x20%s',_0x800850,_0x31c30f[_0x3fef('0x11')][_0x3fef('0x12')]);return _0x41960c(_0x31c30f[_0x3fef('0x11')]['message']);}logger[_0x3fef('0x11')]('CloudProvider,\x20%s,\x20%s',_0x800850,_0x31c30f[_0x3fef('0x11')][_0x3fef('0x12')]);return _0x1fffc5(_0x31c30f['error'][_0x3fef('0x12')]);}else{logger[_0x3fef('0xb')](_0x3fef('0xc'),_0x800850,_0x3fef('0xd'));_0x1fffc5(_0x31c30f[_0x3fef('0x13')][_0x3fef('0x12')]);}})['catch'](function(_0x1cbdbb){logger[_0x3fef('0x11')](_0x3fef('0xc'),_0x800850,_0x1cbdbb);_0x41960c(_0x1cbdbb);});});} \ No newline at end of file +var _0x390a=['jayson/promise','client','request','then','info','debug','CloudProvider,\x20%s,\x20%s,\x20%s','request\x20sent','error','CloudProvider,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x12628f,_0x5082a7){var _0x7c92ca=function(_0x4dc58e){while(--_0x4dc58e){_0x12628f['push'](_0x12628f['shift']());}};_0x7c92ca(++_0x5082a7);}(_0x390a,0xc9));var _0xa390=function(_0x2fa894,_0x1f5f84){_0x2fa894=_0x2fa894-0x0;var _0x212e83=_0x390a[_0x2fa894];return _0x212e83;};'use strict';var _=require(_0xa390('0x0'));var util=require(_0xa390('0x1'));var moment=require(_0xa390('0x2'));var BPromise=require(_0xa390('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa390('0x4'));var db=require(_0xa390('0x5'))['db'];var utils=require(_0xa390('0x6'));var logger=require(_0xa390('0x7'))('rpc');var config=require(_0xa390('0x8'));var jayson=require(_0xa390('0x9'));var client=jayson[_0xa390('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d49cc,_0x1f9de0,_0x53bfb4){return new BPromise(function(_0x492418,_0xc8cd85){return client[_0xa390('0xb')](_0x2d49cc,_0x53bfb4)[_0xa390('0xc')](function(_0x226003){logger[_0xa390('0xd')]('CloudProvider,\x20%s,\x20%s',_0x1f9de0,'request\x20sent');logger[_0xa390('0xe')](_0xa390('0xf'),_0x1f9de0,_0xa390('0x10'),JSON['stringify'](_0x226003));if(_0x226003[_0xa390('0x11')]){if(_0x226003[_0xa390('0x11')]['code']===0x1f4){logger[_0xa390('0x11')](_0xa390('0x12'),_0x1f9de0,_0x226003['error']['message']);return _0xc8cd85(_0x226003[_0xa390('0x11')][_0xa390('0x13')]);}logger['error'](_0xa390('0x12'),_0x1f9de0,_0x226003['error']['message']);return _0x492418(_0x226003['error'][_0xa390('0x13')]);}else{logger['info'](_0xa390('0x12'),_0x1f9de0,_0xa390('0x10'));_0x492418(_0x226003['result'][_0xa390('0x13')]);}})[_0xa390('0x14')](function(_0x59d609){logger[_0xa390('0x11')]('CloudProvider,\x20%s,\x20%s',_0x1f9de0,_0x59d609);_0xc8cd85(_0x59d609);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index f358633..b718635 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 _0xadb5=['put','update','delete','destroy','/:id/oauth2/microsoft/authorize/','/oauth2/microsoft/callback','oauth2MicrosoftCallback','exports','Router','./cloudProvider.controller','get','isAuthenticated','/:id','post','create'];(function(_0x12b706,_0x42cf39){var _0x11e6c2=function(_0x4a0a3e){while(--_0x4a0a3e){_0x12b706['push'](_0x12b706['shift']());}};_0x11e6c2(++_0x42cf39);}(_0xadb5,0xad));var _0x5adb=function(_0x3fb736,_0xa59510){_0x3fb736=_0x3fb736-0x0;var _0x534dd5=_0xadb5[_0x3fb736];return _0x534dd5;};'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['index']);router[_0x5adb('0x2')](_0x5adb('0x4'),auth[_0x5adb('0x3')](),controller['show']);router[_0x5adb('0x5')]('/',auth[_0x5adb('0x3')](),controller[_0x5adb('0x6')]);router[_0x5adb('0x7')](_0x5adb('0x4'),auth[_0x5adb('0x3')](),controller[_0x5adb('0x8')]);router[_0x5adb('0x9')](_0x5adb('0x4'),auth[_0x5adb('0x3')](),controller[_0x5adb('0xa')]);router[_0x5adb('0x2')](_0x5adb('0xb'),auth[_0x5adb('0x3')](),controller['oauth2MicrosoftAuthorize']);router['post'](_0x5adb('0xc'),controller[_0x5adb('0xd')]);module[_0x5adb('0xe')]=router; \ No newline at end of file +var _0xadb5=['put','update','delete','destroy','/:id/oauth2/microsoft/authorize/','/oauth2/microsoft/callback','oauth2MicrosoftCallback','exports','Router','./cloudProvider.controller','get','isAuthenticated','/:id','post','create'];(function(_0x1be03f,_0x4b46d0){var _0xd9431d=function(_0xa7ea64){while(--_0xa7ea64){_0x1be03f['push'](_0x1be03f['shift']());}};_0xd9431d(++_0x4b46d0);}(_0xadb5,0xad));var _0x5adb=function(_0x5aea18,_0x2638e1){_0x5aea18=_0x5aea18-0x0;var _0x3c71d0=_0xadb5[_0x5aea18];return _0x3c71d0;};'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['index']);router[_0x5adb('0x2')](_0x5adb('0x4'),auth[_0x5adb('0x3')](),controller['show']);router[_0x5adb('0x5')]('/',auth[_0x5adb('0x3')](),controller[_0x5adb('0x6')]);router[_0x5adb('0x7')](_0x5adb('0x4'),auth[_0x5adb('0x3')](),controller[_0x5adb('0x8')]);router[_0x5adb('0x9')](_0x5adb('0x4'),auth[_0x5adb('0x3')](),controller[_0x5adb('0xa')]);router[_0x5adb('0x2')](_0x5adb('0xb'),auth[_0x5adb('0x3')](),controller['oauth2MicrosoftAuthorize']);router['post'](_0x5adb('0xc'),controller[_0x5adb('0xd')]);module[_0x5adb('0xe')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 4bdd116..013386b 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 _0x5ab9=['exports','STRING','name','sequelize'];(function(_0x120e59,_0x443649){var _0x53ff80=function(_0x5a642e){while(--_0x5a642e){_0x120e59['push'](_0x120e59['shift']());}};_0x53ff80(++_0x443649);}(_0x5ab9,0x1c7));var _0x95ab=function(_0xabfec4,_0x35076e){_0xabfec4=_0xabfec4-0x0;var _0x7bafa2=_0x5ab9[_0xabfec4];return _0x7bafa2;};'use strict';var Sequelize=require(_0x95ab('0x0'));module[_0x95ab('0x1')]={'name':{'type':Sequelize[_0x95ab('0x2')],'unique':_0x95ab('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x95ab('0x2')]},'companyId':{'type':Sequelize[_0x95ab('0x2')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x95ab('0x2')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x95ab('0x2')]},'street':{'type':Sequelize[_0x95ab('0x2')]},'postalCode':{'type':Sequelize[_0x95ab('0x2')]},'city':{'type':Sequelize[_0x95ab('0x2')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x95ab('0x2')]},'sStreet':{'type':Sequelize[_0x95ab('0x2')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0x95ab('0x2')]},'sCountry':{'type':Sequelize[_0x95ab('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc331=['STRING','exports'];(function(_0x2c5ec9,_0x497868){var _0x2ce268=function(_0x14cd42){while(--_0x14cd42){_0x2c5ec9['push'](_0x2c5ec9['shift']());}};_0x2ce268(++_0x497868);}(_0xc331,0x163));var _0x1c33=function(_0x2690d3,_0xb74117){_0x2690d3=_0x2690d3-0x0;var _0x231f83=_0xc331[_0x2690d3];return _0x231f83;};'use strict';var Sequelize=require('sequelize');module[_0x1c33('0x0')]={'name':{'type':Sequelize[_0x1c33('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x1c33('0x1')]},'companyId':{'type':Sequelize[_0x1c33('0x1')]},'website':{'type':Sequelize[_0x1c33('0x1')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x1c33('0x1')]},'type':{'type':Sequelize[_0x1c33('0x1')]},'street':{'type':Sequelize[_0x1c33('0x1')]},'postalCode':{'type':Sequelize[_0x1c33('0x1')]},'city':{'type':Sequelize[_0x1c33('0x1')]},'country':{'type':Sequelize[_0x1c33('0x1')]},'email':{'type':Sequelize[_0x1c33('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0x1c33('0x1')]},'sPostalCode':{'type':Sequelize[_0x1c33('0x1')]},'sCity':{'type':Sequelize[_0x1c33('0x1')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1c33('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index e153753..0d60835 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 _0x3477=['destroy','addContacts','CmContact','omit','ids','getContacts','findOne','filter','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','count','offset','limit','Content-Range','apply','reject','get','Companies','UserProfileResource','then','error','stack','name','send','index','CmCompany','describe','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','options','includeAll','include','rows','catch','show','params','rawAttributes','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'];(function(_0x3b7af4,_0x5d9914){var _0x44a410=function(_0x32ac47){while(--_0x32ac47){_0x3b7af4['push'](_0x3b7af4['shift']());}};_0x44a410(++_0x5d9914);}(_0x3477,0x119));var _0x7347=function(_0x53da20,_0x11aa12){_0x53da20=_0x53da20-0x0;var _0x2622e8=_0x3477[_0x53da20];return _0x2622e8;};'use strict';var emlformat=require(_0x7347('0x0'));var rimraf=require(_0x7347('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7347('0x2'));var rp=require(_0x7347('0x3'));var moment=require(_0x7347('0x4'));var BPromise=require(_0x7347('0x5'));var Mustache=require(_0x7347('0x6'));var util=require(_0x7347('0x7'));var path=require(_0x7347('0x8'));var sox=require(_0x7347('0x9'));var csv=require(_0x7347('0xa'));var ejs=require(_0x7347('0xb'));var fs=require('fs');var fs_extra=require(_0x7347('0xc'));var _=require(_0x7347('0xd'));var squel=require(_0x7347('0xe'));var crypto=require('crypto');var jsforce=require(_0x7347('0xf'));var deskjs=require(_0x7347('0x10'));var toCsv=require(_0x7347('0xa'));var querystring=require(_0x7347('0x11'));var Papa=require(_0x7347('0x12'));var Redis=require(_0x7347('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x7347('0x14'));var as=require(_0x7347('0x15'));var hardwareService=require(_0x7347('0x16'));var logger=require('../../config/logger')(_0x7347('0x17'));var utils=require(_0x7347('0x18'));var config=require(_0x7347('0x19'));var licenseUtil=require(_0x7347('0x1a'));var db=require(_0x7347('0x1b'))['db'];function respondWithStatusCode(_0xfeda14,_0x123857){_0x123857=_0x123857||0xcc;return function(_0x1a2723){if(_0x1a2723){return _0xfeda14[_0x7347('0x1c')](_0x123857);}return _0xfeda14['status'](_0x123857)[_0x7347('0x1d')]();};}function respondWithResult(_0x2f65f7,_0x23df9c){_0x23df9c=_0x23df9c||0xc8;return function(_0x48589c){if(_0x48589c){return _0x2f65f7[_0x7347('0x1e')](_0x23df9c)[_0x7347('0x1f')](_0x48589c);}};}function respondWithFilteredResult(_0x30518c,_0x3e84ea){return function(_0x1e42f5){if(_0x1e42f5){var _0x1ccb91=typeof _0x3e84ea['offset']===_0x7347('0x20')&&typeof _0x3e84ea['limit']==='undefined';var _0xcb8e2=_0x1e42f5[_0x7347('0x21')];var _0x372448=_0x1ccb91?0x0:_0x3e84ea[_0x7347('0x22')];var _0x18a7b0=_0x1ccb91?_0x1e42f5['count']:_0x3e84ea[_0x7347('0x22')]+_0x3e84ea[_0x7347('0x23')];var _0xa4f52e;if(_0x18a7b0>=_0xcb8e2){_0x18a7b0=_0xcb8e2;_0xa4f52e=0xc8;}else{_0xa4f52e=0xce;}_0x30518c[_0x7347('0x1e')](_0xa4f52e);return _0x30518c['set'](_0x7347('0x24'),_0x372448+'-'+_0x18a7b0+'/'+_0xcb8e2)[_0x7347('0x1f')](_0x1e42f5);}return null;};}function patchUpdates(_0x469b49){return function(_0xf3355c){try{jsonpatch[_0x7347('0x25')](_0xf3355c,_0x469b49,!![]);}catch(_0x451d5f){return BPromise[_0x7347('0x26')](_0x451d5f);}return _0xf3355c['save']();};}function saveUpdates(_0x250ac3,_0x141568){return function(_0x395105){if(_0x395105){return _0x395105['update'](_0x250ac3)['then'](function(_0x40977c){return _0x40977c;});}return null;};}function removeEntity(_0x324c5d,_0x5befb1){return function(_0x31454d){if(_0x31454d){return _0x31454d['destroy']()['then'](function(){var _0x5d7383=_0x31454d[_0x7347('0x27')]({'plain':!![]});var _0x357b7a=_0x7347('0x28');return db[_0x7347('0x29')]['destroy']({'where':{'type':_0x357b7a,'resourceId':_0x5d7383['id']}})[_0x7347('0x2a')](function(){return _0x31454d;});})[_0x7347('0x2a')](function(){_0x324c5d[_0x7347('0x1e')](0xcc)[_0x7347('0x1d')]();});}};}function handleEntityNotFound(_0x5704ec,_0x18d5b4){return function(_0xf4a772){if(!_0xf4a772){_0x5704ec[_0x7347('0x1c')](0x194);}return _0xf4a772;};}function handleError(_0x5c87fa,_0x5e66da){_0x5e66da=_0x5e66da||0x1f4;return function(_0x2c70b7){logger[_0x7347('0x2b')](_0x2c70b7[_0x7347('0x2c')]);if(_0x2c70b7[_0x7347('0x2d')]){delete _0x2c70b7[_0x7347('0x2d')];}_0x5c87fa[_0x7347('0x1e')](_0x5e66da)[_0x7347('0x2e')](_0x2c70b7);};}exports[_0x7347('0x2f')]=function(_0x2694b6,_0x3b2d58){var _0x4ace98={},_0x4fdc50={},_0x252844={'count':0x0,'rows':[]};return db[_0x7347('0x30')][_0x7347('0x31')]()[_0x7347('0x2a')](function(_0x494c71){_0x4fdc50[_0x7347('0x32')]=_[_0x7347('0x33')](_0x494c71);_0x4fdc50[_0x7347('0x34')]=_[_0x7347('0x33')](_0x2694b6[_0x7347('0x34')]);_0x4fdc50[_0x7347('0x35')]=_['intersection'](_0x4fdc50['model'],_0x4fdc50[_0x7347('0x34')]);_0x4ace98[_0x7347('0x36')]=_[_0x7347('0x37')](_0x4fdc50[_0x7347('0x32')],qs[_0x7347('0x38')](_0x2694b6['query'][_0x7347('0x38')]));_0x4ace98[_0x7347('0x36')]=_0x4ace98[_0x7347('0x36')][_0x7347('0x39')]?_0x4ace98[_0x7347('0x36')]:_0x4fdc50[_0x7347('0x32')];if(!_0x2694b6[_0x7347('0x34')][_0x7347('0x3a')](_0x7347('0x3b'))){_0x4ace98[_0x7347('0x23')]=qs[_0x7347('0x23')](_0x2694b6['query'][_0x7347('0x23')]);_0x4ace98[_0x7347('0x22')]=qs[_0x7347('0x22')](_0x2694b6[_0x7347('0x34')][_0x7347('0x22')]);}_0x4ace98[_0x7347('0x3c')]=qs[_0x7347('0x3d')](_0x2694b6['query'][_0x7347('0x3d')]);_0x4ace98['where']=qs[_0x7347('0x35')](_[_0x7347('0x3e')](_0x2694b6['query'],_0x4fdc50[_0x7347('0x35')]),_0x494c71);if(_0x2694b6['query']['filter']){_0x4ace98['where']=_['merge'](_0x4ace98[_0x7347('0x3f')],{'$or':_['map'](_0x4ace98[_0x7347('0x36')],function(_0x42859f){var _0x56053c={};_0x56053c[_0x42859f]={'$like':'%'+_0x2694b6['query']['filter']+'%'};return _0x56053c;})});}_0x4ace98=_[_0x7347('0x40')]({},_0x4ace98,_0x2694b6[_0x7347('0x41')]);var _0xcb7481={'where':_0x4ace98['where']};return db[_0x7347('0x30')][_0x7347('0x21')](_0xcb7481)['then'](function(_0x2e903b){_0x252844[_0x7347('0x21')]=_0x2e903b;if(_0x2694b6[_0x7347('0x34')][_0x7347('0x42')]){_0x4ace98[_0x7347('0x43')]=[{'all':!![]}];}return db[_0x7347('0x30')]['findAll'](_0x4ace98);})[_0x7347('0x2a')](function(_0x377177){_0x252844[_0x7347('0x44')]=_0x377177;return _0x252844;})[_0x7347('0x2a')](respondWithFilteredResult(_0x3b2d58,_0x4ace98))[_0x7347('0x45')](handleError(_0x3b2d58,null));})[_0x7347('0x45')](handleError(_0x3b2d58,null));};exports[_0x7347('0x46')]=function(_0x49f175,_0x9ee224){var _0x4d47af={'raw':![],'where':{'id':_0x49f175[_0x7347('0x47')]['id']}},_0x22eb56={};_0x22eb56[_0x7347('0x32')]=_[_0x7347('0x33')](db[_0x7347('0x30')][_0x7347('0x48')]);_0x22eb56['query']=_[_0x7347('0x33')](_0x49f175[_0x7347('0x34')]);_0x22eb56['filters']=_['intersection'](_0x22eb56[_0x7347('0x32')],_0x22eb56[_0x7347('0x34')]);_0x4d47af['attributes']=_['intersection'](_0x22eb56[_0x7347('0x32')],qs['fields'](_0x49f175[_0x7347('0x34')]['fields']));_0x4d47af[_0x7347('0x36')]=_0x4d47af[_0x7347('0x36')]['length']?_0x4d47af[_0x7347('0x36')]:_0x22eb56[_0x7347('0x32')];if(_0x49f175['query'][_0x7347('0x42')]){_0x4d47af['include']=[{'all':!![]}];}_0x4d47af=_[_0x7347('0x40')]({},_0x4d47af,_0x49f175[_0x7347('0x41')]);return db['CmCompany'][_0x7347('0x49')](_0x4d47af)[_0x7347('0x2a')](handleEntityNotFound(_0x9ee224,null))[_0x7347('0x2a')](respondWithResult(_0x9ee224,null))['catch'](handleError(_0x9ee224,null));};exports[_0x7347('0x4a')]=function(_0x12cdb4,_0x2ac148){return db[_0x7347('0x30')]['create'](_0x12cdb4[_0x7347('0x4b')],{})[_0x7347('0x2a')](function(_0x451ac4){var _0x614e0=_0x12cdb4['user'][_0x7347('0x27')]({'plain':!![]});if(!_0x614e0)throw new Error(_0x7347('0x4c'));if(_0x614e0[_0x7347('0x4d')]==='user'){var _0x5956e3=_0x451ac4[_0x7347('0x27')]({'plain':!![]});var _0x4fcc99=_0x7347('0x28');return db[_0x7347('0x4e')][_0x7347('0x49')]({'where':{'name':_0x4fcc99,'userProfileId':_0x614e0[_0x7347('0x4f')]},'raw':!![]})[_0x7347('0x2a')](function(_0x457993){if(_0x457993&&_0x457993[_0x7347('0x50')]===0x0){return db[_0x7347('0x29')][_0x7347('0x4a')]({'name':_0x5956e3[_0x7347('0x2d')],'resourceId':_0x5956e3['id'],'type':_0x457993['name'],'sectionId':_0x457993['id']},{})[_0x7347('0x2a')](function(){return _0x451ac4;});}else{return _0x451ac4;}})['catch'](function(_0x59ce88){logger['error'](_0x7347('0x51'),_0x59ce88);throw _0x59ce88;});}return _0x451ac4;})[_0x7347('0x2a')](respondWithResult(_0x2ac148,0xc9))[_0x7347('0x45')](handleError(_0x2ac148,null));};exports[_0x7347('0x52')]=function(_0x207357,_0x5db0fc){if(_0x207357['body']['id']){delete _0x207357[_0x7347('0x4b')]['id'];}return db[_0x7347('0x30')][_0x7347('0x49')]({'where':{'id':_0x207357['params']['id']}})[_0x7347('0x2a')](handleEntityNotFound(_0x5db0fc,null))[_0x7347('0x2a')](saveUpdates(_0x207357[_0x7347('0x4b')],null))[_0x7347('0x2a')](respondWithResult(_0x5db0fc,null))[_0x7347('0x45')](handleError(_0x5db0fc,null));};exports[_0x7347('0x53')]=function(_0x4af720,_0x1fb629){return db[_0x7347('0x30')][_0x7347('0x49')]({'where':{'id':_0x4af720['params']['id']}})[_0x7347('0x2a')](handleEntityNotFound(_0x1fb629,null))[_0x7347('0x2a')](removeEntity(_0x1fb629,null))[_0x7347('0x45')](handleError(_0x1fb629,null));};exports[_0x7347('0x31')]=function(_0x58b757,_0x4084eb){return db[_0x7347('0x30')][_0x7347('0x31')]()[_0x7347('0x2a')](respondWithResult(_0x4084eb,null))['catch'](handleError(_0x4084eb,null));};exports[_0x7347('0x54')]=function(_0x2a5bae,_0x500862,_0x30cf19){return db[_0x7347('0x55')]['find']({'where':{'id':_0x2a5bae[_0x7347('0x47')]['id']}})['then'](handleEntityNotFound(_0x500862,null))[_0x7347('0x2a')](function(_0x3dd941){if(_0x3dd941){return _0x3dd941[_0x7347('0x54')](_0x2a5bae['body']['ids'],_[_0x7347('0x56')](_0x2a5bae['body'],[_0x7347('0x57'),'id'])||{});}})[_0x7347('0x2a')](respondWithResult(_0x500862,null))['catch'](handleError(_0x500862,null));};exports[_0x7347('0x58')]=function(_0x5fd422,_0x2cb95f,_0x1e0000){var _0x1b1698={};var _0x4eeee8={};var _0x58294e;var _0x3c078e;return db['CmCompany'][_0x7347('0x59')]({'where':{'id':_0x5fd422[_0x7347('0x47')]['id']}})['then'](handleEntityNotFound(_0x2cb95f,null))['then'](function(_0x35c0e3){if(_0x35c0e3){_0x58294e=_0x35c0e3;_0x4eeee8['model']=_[_0x7347('0x33')](db[_0x7347('0x55')][_0x7347('0x48')]);_0x4eeee8[_0x7347('0x34')]=_[_0x7347('0x33')](_0x5fd422[_0x7347('0x34')]);_0x4eeee8[_0x7347('0x35')]=_[_0x7347('0x37')](_0x4eeee8[_0x7347('0x32')],_0x4eeee8[_0x7347('0x34')]);_0x1b1698[_0x7347('0x36')]=_[_0x7347('0x37')](_0x4eeee8['model'],qs[_0x7347('0x38')](_0x5fd422[_0x7347('0x34')][_0x7347('0x38')]));_0x1b1698['attributes']=_0x1b1698[_0x7347('0x36')][_0x7347('0x39')]?_0x1b1698[_0x7347('0x36')]:_0x4eeee8[_0x7347('0x32')];_0x1b1698['order']=qs['sort'](_0x5fd422[_0x7347('0x34')][_0x7347('0x3d')]);_0x1b1698[_0x7347('0x3f')]=qs['filters'](_[_0x7347('0x3e')](_0x5fd422[_0x7347('0x34')],_0x4eeee8[_0x7347('0x35')]));if(_0x5fd422[_0x7347('0x34')][_0x7347('0x5a')]){_0x1b1698['where']=_['merge'](_0x1b1698[_0x7347('0x3f')],{'$or':_['map'](_0x1b1698[_0x7347('0x36')],function(_0x3927e3){var _0x1d4a04={};_0x1d4a04[_0x3927e3]={'$like':'%'+_0x5fd422[_0x7347('0x34')][_0x7347('0x5a')]+'%'};return _0x1d4a04;})});}_0x1b1698=_[_0x7347('0x40')]({},_0x1b1698,_0x5fd422[_0x7347('0x41')]);return _0x58294e[_0x7347('0x58')](_0x1b1698);}})[_0x7347('0x2a')](function(_0x1ac89b){if(_0x1ac89b){_0x3c078e=_0x1ac89b[_0x7347('0x39')];if(!_0x5fd422['query'][_0x7347('0x3a')](_0x7347('0x3b'))){_0x1b1698[_0x7347('0x23')]=qs[_0x7347('0x23')](_0x5fd422['query']['limit']);_0x1b1698['offset']=qs['offset'](_0x5fd422['query'][_0x7347('0x22')]);}return _0x58294e['getContacts'](_0x1b1698);}})[_0x7347('0x2a')](function(_0x3b0a5a){if(_0x3b0a5a){return _0x3b0a5a?{'count':_0x3c078e,'rows':_0x3b0a5a}:null;}})[_0x7347('0x2a')](respondWithResult(_0x2cb95f,null))[_0x7347('0x45')](handleError(_0x2cb95f,null));}; \ No newline at end of file +var _0x26dc=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','destroy','then','get','Companies','UserProfileResource','sendStatus','stack','name','send','index','CmCompany','describe','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','filter','merge','includeAll','include','rows','catch','show','params','rawAttributes','length','options','create','body','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','addContacts','omit','ids','getContacts','findOne','CmContact','order','pick','map'];(function(_0x79a6e8,_0x1c2b24){var _0xeeb993=function(_0x9ed95e){while(--_0x9ed95e){_0x79a6e8['push'](_0x79a6e8['shift']());}};_0xeeb993(++_0x1c2b24);}(_0x26dc,0x168));var _0xc26d=function(_0x2a183c,_0xd95703){_0x2a183c=_0x2a183c-0x0;var _0x5cfa9d=_0x26dc[_0x2a183c];return _0x5cfa9d;};'use strict';var emlformat=require(_0xc26d('0x0'));var rimraf=require(_0xc26d('0x1'));var zipdir=require(_0xc26d('0x2'));var jsonpatch=require(_0xc26d('0x3'));var rp=require(_0xc26d('0x4'));var moment=require(_0xc26d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc26d('0x6'));var util=require(_0xc26d('0x7'));var path=require(_0xc26d('0x8'));var sox=require(_0xc26d('0x9'));var csv=require(_0xc26d('0xa'));var ejs=require(_0xc26d('0xb'));var fs=require('fs');var fs_extra=require(_0xc26d('0xc'));var _=require('lodash');var squel=require(_0xc26d('0xd'));var crypto=require('crypto');var jsforce=require(_0xc26d('0xe'));var deskjs=require(_0xc26d('0xf'));var toCsv=require(_0xc26d('0xa'));var querystring=require('querystring');var Papa=require(_0xc26d('0x10'));var Redis=require(_0xc26d('0x11'));var authService=require(_0xc26d('0x12'));var qs=require(_0xc26d('0x13'));var as=require(_0xc26d('0x14'));var hardwareService=require(_0xc26d('0x15'));var logger=require(_0xc26d('0x16'))(_0xc26d('0x17'));var utils=require(_0xc26d('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xc26d('0x19'));var db=require(_0xc26d('0x1a'))['db'];function respondWithStatusCode(_0x1ffa07,_0x766e5c){_0x766e5c=_0x766e5c||0xcc;return function(_0x4a547e){if(_0x4a547e){return _0x1ffa07['sendStatus'](_0x766e5c);}return _0x1ffa07['status'](_0x766e5c)[_0xc26d('0x1b')]();};}function respondWithResult(_0x3d1dc3,_0x62504b){_0x62504b=_0x62504b||0xc8;return function(_0x910b2){if(_0x910b2){return _0x3d1dc3[_0xc26d('0x1c')](_0x62504b)[_0xc26d('0x1d')](_0x910b2);}};}function respondWithFilteredResult(_0x12d257,_0x5c704e){return function(_0x437bc1){if(_0x437bc1){var _0x74c00b=typeof _0x5c704e[_0xc26d('0x1e')]==='undefined'&&typeof _0x5c704e[_0xc26d('0x1f')]===_0xc26d('0x20');var _0x1d62f6=_0x437bc1[_0xc26d('0x21')];var _0x56b94b=_0x74c00b?0x0:_0x5c704e[_0xc26d('0x1e')];var _0x99634d=_0x74c00b?_0x437bc1[_0xc26d('0x21')]:_0x5c704e['offset']+_0x5c704e[_0xc26d('0x1f')];var _0x345906;if(_0x99634d>=_0x1d62f6){_0x99634d=_0x1d62f6;_0x345906=0xc8;}else{_0x345906=0xce;}_0x12d257[_0xc26d('0x1c')](_0x345906);return _0x12d257['set'](_0xc26d('0x22'),_0x56b94b+'-'+_0x99634d+'/'+_0x1d62f6)[_0xc26d('0x1d')](_0x437bc1);}return null;};}function patchUpdates(_0x29cbe0){return function(_0x4148b2){try{jsonpatch[_0xc26d('0x23')](_0x4148b2,_0x29cbe0,!![]);}catch(_0x68cd4d){return BPromise[_0xc26d('0x24')](_0x68cd4d);}return _0x4148b2[_0xc26d('0x25')]();};}function saveUpdates(_0x40733b,_0x3d48a9){return function(_0x2f279d){if(_0x2f279d){return _0x2f279d[_0xc26d('0x26')](_0x40733b)['then'](function(_0x383e10){return _0x383e10;});}return null;};}function removeEntity(_0x331ec4,_0x57f08c){return function(_0x4b8208){if(_0x4b8208){return _0x4b8208[_0xc26d('0x27')]()[_0xc26d('0x28')](function(){var _0x4fe734=_0x4b8208[_0xc26d('0x29')]({'plain':!![]});var _0x72471b=_0xc26d('0x2a');return db[_0xc26d('0x2b')][_0xc26d('0x27')]({'where':{'type':_0x72471b,'resourceId':_0x4fe734['id']}})['then'](function(){return _0x4b8208;});})[_0xc26d('0x28')](function(){_0x331ec4[_0xc26d('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ed7cb,_0x586bae){return function(_0xff9c96){if(!_0xff9c96){_0x3ed7cb[_0xc26d('0x2c')](0x194);}return _0xff9c96;};}function handleError(_0x178fdc,_0x21e884){_0x21e884=_0x21e884||0x1f4;return function(_0x140eda){logger['error'](_0x140eda[_0xc26d('0x2d')]);if(_0x140eda['name']){delete _0x140eda[_0xc26d('0x2e')];}_0x178fdc[_0xc26d('0x1c')](_0x21e884)[_0xc26d('0x2f')](_0x140eda);};}exports[_0xc26d('0x30')]=function(_0x59ef0e,_0x7db743){var _0x579e55={},_0x22a8b4={},_0x45aa6a={'count':0x0,'rows':[]};return db[_0xc26d('0x31')][_0xc26d('0x32')]()['then'](function(_0x52cb66){_0x22a8b4[_0xc26d('0x33')]=_['keys'](_0x52cb66);_0x22a8b4[_0xc26d('0x34')]=_[_0xc26d('0x35')](_0x59ef0e['query']);_0x22a8b4[_0xc26d('0x36')]=_['intersection'](_0x22a8b4['model'],_0x22a8b4[_0xc26d('0x34')]);_0x579e55[_0xc26d('0x37')]=_[_0xc26d('0x38')](_0x22a8b4[_0xc26d('0x33')],qs[_0xc26d('0x39')](_0x59ef0e[_0xc26d('0x34')][_0xc26d('0x39')]));_0x579e55['attributes']=_0x579e55[_0xc26d('0x37')]['length']?_0x579e55[_0xc26d('0x37')]:_0x22a8b4[_0xc26d('0x33')];if(!_0x59ef0e['query'][_0xc26d('0x3a')](_0xc26d('0x3b'))){_0x579e55['limit']=qs[_0xc26d('0x1f')](_0x59ef0e[_0xc26d('0x34')]['limit']);_0x579e55[_0xc26d('0x1e')]=qs['offset'](_0x59ef0e[_0xc26d('0x34')][_0xc26d('0x1e')]);}_0x579e55['order']=qs['sort'](_0x59ef0e[_0xc26d('0x34')][_0xc26d('0x3c')]);_0x579e55[_0xc26d('0x3d')]=qs[_0xc26d('0x36')](_['pick'](_0x59ef0e[_0xc26d('0x34')],_0x22a8b4['filters']),_0x52cb66);if(_0x59ef0e[_0xc26d('0x34')][_0xc26d('0x3e')]){_0x579e55['where']=_['merge'](_0x579e55['where'],{'$or':_['map'](_0x579e55[_0xc26d('0x37')],function(_0x401a5d){var _0x52e3a0={};_0x52e3a0[_0x401a5d]={'$like':'%'+_0x59ef0e[_0xc26d('0x34')]['filter']+'%'};return _0x52e3a0;})});}_0x579e55=_[_0xc26d('0x3f')]({},_0x579e55,_0x59ef0e['options']);var _0x1bd51a={'where':_0x579e55[_0xc26d('0x3d')]};return db['CmCompany'][_0xc26d('0x21')](_0x1bd51a)[_0xc26d('0x28')](function(_0x330a1b){_0x45aa6a[_0xc26d('0x21')]=_0x330a1b;if(_0x59ef0e[_0xc26d('0x34')][_0xc26d('0x40')]){_0x579e55[_0xc26d('0x41')]=[{'all':!![]}];}return db[_0xc26d('0x31')]['findAll'](_0x579e55);})['then'](function(_0x42a634){_0x45aa6a[_0xc26d('0x42')]=_0x42a634;return _0x45aa6a;})[_0xc26d('0x28')](respondWithFilteredResult(_0x7db743,_0x579e55))['catch'](handleError(_0x7db743,null));})[_0xc26d('0x43')](handleError(_0x7db743,null));};exports[_0xc26d('0x44')]=function(_0x478921,_0x291de4){var _0x4701ff={'raw':![],'where':{'id':_0x478921[_0xc26d('0x45')]['id']}},_0x803987={};_0x803987[_0xc26d('0x33')]=_['keys'](db['CmCompany'][_0xc26d('0x46')]);_0x803987[_0xc26d('0x34')]=_[_0xc26d('0x35')](_0x478921[_0xc26d('0x34')]);_0x803987[_0xc26d('0x36')]=_['intersection'](_0x803987[_0xc26d('0x33')],_0x803987[_0xc26d('0x34')]);_0x4701ff[_0xc26d('0x37')]=_[_0xc26d('0x38')](_0x803987[_0xc26d('0x33')],qs['fields'](_0x478921[_0xc26d('0x34')][_0xc26d('0x39')]));_0x4701ff['attributes']=_0x4701ff['attributes'][_0xc26d('0x47')]?_0x4701ff[_0xc26d('0x37')]:_0x803987[_0xc26d('0x33')];if(_0x478921[_0xc26d('0x34')][_0xc26d('0x40')]){_0x4701ff[_0xc26d('0x41')]=[{'all':!![]}];}_0x4701ff=_[_0xc26d('0x3f')]({},_0x4701ff,_0x478921[_0xc26d('0x48')]);return db[_0xc26d('0x31')]['find'](_0x4701ff)[_0xc26d('0x28')](handleEntityNotFound(_0x291de4,null))[_0xc26d('0x28')](respondWithResult(_0x291de4,null))[_0xc26d('0x43')](handleError(_0x291de4,null));};exports['create']=function(_0x4da900,_0x61220a){return db[_0xc26d('0x31')][_0xc26d('0x49')](_0x4da900[_0xc26d('0x4a')],{})[_0xc26d('0x28')](function(_0x5ee7dd){var _0x2b0166=_0x4da900['user'][_0xc26d('0x29')]({'plain':!![]});if(!_0x2b0166)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2b0166['role']===_0xc26d('0x4b')){var _0x1f5e24=_0x5ee7dd[_0xc26d('0x29')]({'plain':!![]});var _0x1e8d7f=_0xc26d('0x2a');return db[_0xc26d('0x4c')]['find']({'where':{'name':_0x1e8d7f,'userProfileId':_0x2b0166[_0xc26d('0x4d')]},'raw':!![]})['then'](function(_0x134079){if(_0x134079&&_0x134079[_0xc26d('0x4e')]===0x0){return db[_0xc26d('0x2b')][_0xc26d('0x49')]({'name':_0x1f5e24[_0xc26d('0x2e')],'resourceId':_0x1f5e24['id'],'type':_0x134079[_0xc26d('0x2e')],'sectionId':_0x134079['id']},{})[_0xc26d('0x28')](function(){return _0x5ee7dd;});}else{return _0x5ee7dd;}})[_0xc26d('0x43')](function(_0x3babce){logger['error'](_0xc26d('0x4f'),_0x3babce);throw _0x3babce;});}return _0x5ee7dd;})[_0xc26d('0x28')](respondWithResult(_0x61220a,0xc9))[_0xc26d('0x43')](handleError(_0x61220a,null));};exports[_0xc26d('0x26')]=function(_0x3485d5,_0x34bf65){if(_0x3485d5[_0xc26d('0x4a')]['id']){delete _0x3485d5[_0xc26d('0x4a')]['id'];}return db[_0xc26d('0x31')][_0xc26d('0x50')]({'where':{'id':_0x3485d5[_0xc26d('0x45')]['id']}})[_0xc26d('0x28')](handleEntityNotFound(_0x34bf65,null))[_0xc26d('0x28')](saveUpdates(_0x3485d5[_0xc26d('0x4a')],null))['then'](respondWithResult(_0x34bf65,null))['catch'](handleError(_0x34bf65,null));};exports[_0xc26d('0x27')]=function(_0xc8b484,_0x28f3ee){return db[_0xc26d('0x31')]['find']({'where':{'id':_0xc8b484['params']['id']}})['then'](handleEntityNotFound(_0x28f3ee,null))['then'](removeEntity(_0x28f3ee,null))[_0xc26d('0x43')](handleError(_0x28f3ee,null));};exports[_0xc26d('0x32')]=function(_0x36b0d7,_0x1cc965){return db[_0xc26d('0x31')][_0xc26d('0x32')]()['then'](respondWithResult(_0x1cc965,null))['catch'](handleError(_0x1cc965,null));};exports['addContacts']=function(_0x2b2260,_0x1f6b17,_0x4cde67){return db['CmContact'][_0xc26d('0x50')]({'where':{'id':_0x2b2260[_0xc26d('0x45')]['id']}})[_0xc26d('0x28')](handleEntityNotFound(_0x1f6b17,null))[_0xc26d('0x28')](function(_0x3a2847){if(_0x3a2847){return _0x3a2847[_0xc26d('0x51')](_0x2b2260[_0xc26d('0x4a')]['ids'],_[_0xc26d('0x52')](_0x2b2260[_0xc26d('0x4a')],[_0xc26d('0x53'),'id'])||{});}})['then'](respondWithResult(_0x1f6b17,null))[_0xc26d('0x43')](handleError(_0x1f6b17,null));};exports[_0xc26d('0x54')]=function(_0x28beb1,_0x4b22ea,_0x367fd3){var _0x455409={};var _0x232e89={};var _0x2501b5;var _0x549661;return db['CmCompany'][_0xc26d('0x55')]({'where':{'id':_0x28beb1[_0xc26d('0x45')]['id']}})[_0xc26d('0x28')](handleEntityNotFound(_0x4b22ea,null))[_0xc26d('0x28')](function(_0x2ad519){if(_0x2ad519){_0x2501b5=_0x2ad519;_0x232e89[_0xc26d('0x33')]=_['keys'](db[_0xc26d('0x56')][_0xc26d('0x46')]);_0x232e89[_0xc26d('0x34')]=_['keys'](_0x28beb1['query']);_0x232e89['filters']=_['intersection'](_0x232e89[_0xc26d('0x33')],_0x232e89[_0xc26d('0x34')]);_0x455409[_0xc26d('0x37')]=_[_0xc26d('0x38')](_0x232e89[_0xc26d('0x33')],qs[_0xc26d('0x39')](_0x28beb1[_0xc26d('0x34')][_0xc26d('0x39')]));_0x455409[_0xc26d('0x37')]=_0x455409[_0xc26d('0x37')][_0xc26d('0x47')]?_0x455409[_0xc26d('0x37')]:_0x232e89[_0xc26d('0x33')];_0x455409[_0xc26d('0x57')]=qs[_0xc26d('0x3c')](_0x28beb1[_0xc26d('0x34')]['sort']);_0x455409['where']=qs['filters'](_[_0xc26d('0x58')](_0x28beb1['query'],_0x232e89[_0xc26d('0x36')]));if(_0x28beb1['query'][_0xc26d('0x3e')]){_0x455409[_0xc26d('0x3d')]=_[_0xc26d('0x3f')](_0x455409[_0xc26d('0x3d')],{'$or':_[_0xc26d('0x59')](_0x455409['attributes'],function(_0x3557a5){var _0x3709a8={};_0x3709a8[_0x3557a5]={'$like':'%'+_0x28beb1[_0xc26d('0x34')][_0xc26d('0x3e')]+'%'};return _0x3709a8;})});}_0x455409=_[_0xc26d('0x3f')]({},_0x455409,_0x28beb1['options']);return _0x2501b5[_0xc26d('0x54')](_0x455409);}})[_0xc26d('0x28')](function(_0x1d3801){if(_0x1d3801){_0x549661=_0x1d3801['length'];if(!_0x28beb1[_0xc26d('0x34')][_0xc26d('0x3a')]('nolimit')){_0x455409['limit']=qs[_0xc26d('0x1f')](_0x28beb1[_0xc26d('0x34')][_0xc26d('0x1f')]);_0x455409[_0xc26d('0x1e')]=qs[_0xc26d('0x1e')](_0x28beb1[_0xc26d('0x34')][_0xc26d('0x1e')]);}return _0x2501b5[_0xc26d('0x54')](_0x455409);}})['then'](function(_0x24329c){if(_0x24329c){return _0x24329c?{'count':_0x549661,'rows':_0x24329c}:null;}})[_0xc26d('0x28')](respondWithResult(_0x4b22ea,null))[_0xc26d('0x43')](handleError(_0x4b22ea,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 23718c4..40ebeb5 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 _0xb6b4=['bluebird','request-promise','path','rimraf','../../config/environment','./cmCompany.attributes','exports','define','lodash','util','../../config/logger','api','moment'];(function(_0x3ce3c,_0x319337){var _0x55a2c9=function(_0x1568d0){while(--_0x1568d0){_0x3ce3c['push'](_0x3ce3c['shift']());}};_0x55a2c9(++_0x319337);}(_0xb6b4,0x18e));var _0x4b6b=function(_0x2e7538,_0x5c6b05){_0x2e7538=_0x2e7538-0x0;var _0x4c8a6f=_0xb6b4[_0x2e7538];return _0x4c8a6f;};'use strict';var _=require(_0x4b6b('0x0'));var util=require(_0x4b6b('0x1'));var logger=require(_0x4b6b('0x2'))(_0x4b6b('0x3'));var moment=require(_0x4b6b('0x4'));var BPromise=require(_0x4b6b('0x5'));var rp=require(_0x4b6b('0x6'));var fs=require('fs');var path=require(_0x4b6b('0x7'));var rimraf=require(_0x4b6b('0x8'));var config=require(_0x4b6b('0x9'));var attributes=require(_0x4b6b('0xa'));module[_0x4b6b('0xb')]=function(_0x21db0e,_0x39331c){return _0x21db0e[_0x4b6b('0xc')]('CmCompany',attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5932=['../../config/logger','moment','bluebird','path','./cmCompany.attributes','define','CmCompany','cm_companies','lodash','util'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0x5932,0xee));var _0x2593=function(_0x16a78b,_0x9e4b21){_0x16a78b=_0x16a78b-0x0;var _0x2bb204=_0x5932[_0x16a78b];return _0x2bb204;};'use strict';var _=require(_0x2593('0x0'));var util=require(_0x2593('0x1'));var logger=require(_0x2593('0x2'))('api');var moment=require(_0x2593('0x3'));var BPromise=require(_0x2593('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2593('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2593('0x6'));module['exports']=function(_0x14482e,_0x2c5588){return _0x14482e[_0x2593('0x7')](_0x2593('0x8'),attributes,{'tableName':_0x2593('0x9'),'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 9ad5600..84ac913 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 _0x8c19=['rpc','jayson/promise','http','then','CmCompany,\x20%s,\x20%s','debug','request\x20sent','error','code','message','info','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x2d7712,_0x39aba4){var _0x2efa08=function(_0xfbe847){while(--_0xfbe847){_0x2d7712['push'](_0x2d7712['shift']());}};_0x2efa08(++_0x39aba4);}(_0x8c19,0xca));var _0x98c1=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x8c19[_0x30ae5e];return _0x1f2e93;};'use strict';var _=require('lodash');var util=require(_0x98c1('0x0'));var moment=require(_0x98c1('0x1'));var BPromise=require(_0x98c1('0x2'));var rs=require(_0x98c1('0x3'));var fs=require('fs');var Redis=require(_0x98c1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x98c1('0x5'));var logger=require(_0x98c1('0x6'))(_0x98c1('0x7'));var config=require('../../config/environment');var jayson=require(_0x98c1('0x8'));var client=jayson['client'][_0x98c1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xaf04b6,_0x5071d6,_0x20e06f){return new BPromise(function(_0x1f62c0,_0x507fa6){return client['request'](_0xaf04b6,_0x20e06f)[_0x98c1('0xa')](function(_0x190cf1){logger['info'](_0x98c1('0xb'),_0x5071d6,'request\x20sent');logger[_0x98c1('0xc')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x5071d6,_0x98c1('0xd'),JSON['stringify'](_0x190cf1));if(_0x190cf1[_0x98c1('0xe')]){if(_0x190cf1[_0x98c1('0xe')][_0x98c1('0xf')]===0x1f4){logger[_0x98c1('0xe')](_0x98c1('0xb'),_0x5071d6,_0x190cf1['error']['message']);return _0x507fa6(_0x190cf1[_0x98c1('0xe')][_0x98c1('0x10')]);}logger[_0x98c1('0xe')](_0x98c1('0xb'),_0x5071d6,_0x190cf1['error'][_0x98c1('0x10')]);return _0x1f62c0(_0x190cf1['error'][_0x98c1('0x10')]);}else{logger[_0x98c1('0x11')]('CmCompany,\x20%s,\x20%s',_0x5071d6,_0x98c1('0xd'));_0x1f62c0(_0x190cf1['result'][_0x98c1('0x10')]);}})[_0x98c1('0x12')](function(_0x22bcdf){logger['error']('CmCompany,\x20%s,\x20%s',_0x5071d6,_0x22bcdf);_0x507fa6(_0x22bcdf);});});} \ No newline at end of file +var _0x22ce=['request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','CmCompany,\x20%s,\x20%s','debug','CmCompany,\x20%s,\x20%s,\x20%s'];(function(_0x25b2b4,_0x457cf0){var _0x3c096e=function(_0x422b19){while(--_0x422b19){_0x25b2b4['push'](_0x25b2b4['shift']());}};_0x3c096e(++_0x457cf0);}(_0x22ce,0x11c));var _0xe22c=function(_0x180bdf,_0x2f7edb){_0x180bdf=_0x180bdf-0x0;var _0x1036d0=_0x22ce[_0x180bdf];return _0x1036d0;};'use strict';var _=require(_0xe22c('0x0'));var util=require(_0xe22c('0x1'));var moment=require(_0xe22c('0x2'));var BPromise=require(_0xe22c('0x3'));var rs=require(_0xe22c('0x4'));var fs=require('fs');var Redis=require(_0xe22c('0x5'));var db=require(_0xe22c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xe22c('0x7'))('rpc');var config=require(_0xe22c('0x8'));var jayson=require(_0xe22c('0x9'));var client=jayson['client'][_0xe22c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x19948e,_0x41a98b,_0x8a859){return new BPromise(function(_0x197122,_0x1e3851){return client[_0xe22c('0xb')](_0x19948e,_0x8a859)['then'](function(_0x924b5b){logger['info'](_0xe22c('0xc'),_0x41a98b,'request\x20sent');logger[_0xe22c('0xd')](_0xe22c('0xe'),_0x41a98b,_0xe22c('0xf'),JSON[_0xe22c('0x10')](_0x924b5b));if(_0x924b5b['error']){if(_0x924b5b[_0xe22c('0x11')][_0xe22c('0x12')]===0x1f4){logger[_0xe22c('0x11')](_0xe22c('0xc'),_0x41a98b,_0x924b5b[_0xe22c('0x11')][_0xe22c('0x13')]);return _0x1e3851(_0x924b5b['error'][_0xe22c('0x13')]);}logger[_0xe22c('0x11')]('CmCompany,\x20%s,\x20%s',_0x41a98b,_0x924b5b['error']['message']);return _0x197122(_0x924b5b['error'][_0xe22c('0x13')]);}else{logger[_0xe22c('0x14')](_0xe22c('0xc'),_0x41a98b,_0xe22c('0xf'));_0x197122(_0x924b5b[_0xe22c('0x15')]['message']);}})[_0xe22c('0x16')](function(_0x56526f){logger[_0xe22c('0x11')](_0xe22c('0xc'),_0x41a98b,_0x56526f);_0x1e3851(_0x56526f);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index ab6b00d..67eca5e 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 _0x51ba=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','/:id/contacts','getContacts','post','addContacts','put','update','delete'];(function(_0x50ece0,_0x5808ed){var _0x483bf9=function(_0x59bae7){while(--_0x59bae7){_0x50ece0['push'](_0x50ece0['shift']());}};_0x483bf9(++_0x5808ed);}(_0x51ba,0x152));var _0xa51b=function(_0xd15042,_0x38fe3c){_0xd15042=_0xd15042-0x0;var _0x4957ed=_0x51ba[_0xd15042];return _0x4957ed;};'use strict';var multer=require(_0xa51b('0x0'));var util=require(_0xa51b('0x1'));var path=require(_0xa51b('0x2'));var timeout=require(_0xa51b('0x3'));var express=require(_0xa51b('0x4'));var router=express[_0xa51b('0x5')]();var fs_extra=require(_0xa51b('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xa51b('0x7'));var config=require(_0xa51b('0x8'));var controller=require('./cmCompany.controller');router[_0xa51b('0x9')]('/',auth[_0xa51b('0xa')](),controller[_0xa51b('0xb')]);router[_0xa51b('0x9')](_0xa51b('0xc'),auth[_0xa51b('0xa')](),controller[_0xa51b('0xd')]);router[_0xa51b('0x9')](_0xa51b('0xe'),auth['isAuthenticated'](),controller['show']);router[_0xa51b('0x9')](_0xa51b('0xf'),auth[_0xa51b('0xa')](),controller[_0xa51b('0x10')]);router[_0xa51b('0x11')]('/',auth[_0xa51b('0xa')](),controller['create']);router[_0xa51b('0x11')](_0xa51b('0xf'),auth[_0xa51b('0xa')](),controller[_0xa51b('0x12')]);router[_0xa51b('0x13')](_0xa51b('0xe'),auth[_0xa51b('0xa')](),controller[_0xa51b('0x14')]);router[_0xa51b('0x15')](_0xa51b('0xe'),auth[_0xa51b('0xa')](),controller[_0xa51b('0x16')]);module[_0xa51b('0x17')]=router; \ No newline at end of file +var _0x31d5=['isAuthenticated','describe','show','/:id/contacts','getContacts','post','create','put','/:id','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','/describe'];(function(_0x3e8270,_0x293590){var _0x1ccde9=function(_0x213490){while(--_0x213490){_0x3e8270['push'](_0x3e8270['shift']());}};_0x1ccde9(++_0x293590);}(_0x31d5,0x193));var _0x531d=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x31d5[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0x531d('0x0'));var util=require(_0x531d('0x1'));var path=require('path');var timeout=require(_0x531d('0x2'));var express=require(_0x531d('0x3'));var router=express[_0x531d('0x4')]();var fs_extra=require(_0x531d('0x5'));var auth=require(_0x531d('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x531d('0x7'));var controller=require('./cmCompany.controller');router[_0x531d('0x8')]('/',auth['isAuthenticated'](),controller[_0x531d('0x9')]);router[_0x531d('0x8')](_0x531d('0xa'),auth[_0x531d('0xb')](),controller[_0x531d('0xc')]);router['get']('/:id',auth[_0x531d('0xb')](),controller[_0x531d('0xd')]);router[_0x531d('0x8')](_0x531d('0xe'),auth[_0x531d('0xb')](),controller[_0x531d('0xf')]);router[_0x531d('0x10')]('/',auth[_0x531d('0xb')](),controller[_0x531d('0x11')]);router[_0x531d('0x10')](_0x531d('0xe'),auth[_0x531d('0xb')](),controller['addContacts']);router[_0x531d('0x12')](_0x531d('0x13'),auth[_0x531d('0xb')](),controller['update']);router[_0x531d('0x14')]('/:id',auth[_0x531d('0xb')](),controller[_0x531d('0x15')]);module[_0x531d('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index a5b63b7..72df443 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 _0x19bb=['INTEGER','sequelize','STRING','TEXT'];(function(_0x38665a,_0x1c1665){var _0x1cdc23=function(_0x561f2e){while(--_0x561f2e){_0x38665a['push'](_0x38665a['shift']());}};_0x1cdc23(++_0x1c1665);}(_0x19bb,0x159));var _0xb19b=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x19bb[_0x40a045];return _0x1a687c;};'use strict';var _=require('lodash');var Sequelize=require(_0xb19b('0x0'));module['exports']={'firstName':{'type':Sequelize[_0xb19b('0x1')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0xb19b('0x1')]},'city':{'type':Sequelize[_0xb19b('0x1')]},'country':{'type':Sequelize[_0xb19b('0x1')]},'dateOfBirth':{'type':Sequelize[_0xb19b('0x1')]},'description':{'type':Sequelize[_0xb19b('0x2')]},'phone':{'type':Sequelize[_0xb19b('0x1')]},'mobile':{'type':Sequelize[_0xb19b('0x1')]},'fax':{'type':Sequelize[_0xb19b('0x1')]},'email':{'type':Sequelize[_0xb19b('0x1')]},'url':{'type':Sequelize[_0xb19b('0x1')]},'facebook':{'type':Sequelize[_0xb19b('0x1')]},'fb_data':{'type':Sequelize[_0xb19b('0x1')]},'twitter':{'type':Sequelize[_0xb19b('0x1')]},'skype':{'type':Sequelize[_0xb19b('0x1')]},'teams':{'type':Sequelize[_0xb19b('0x1')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0xb19b('0x1')]},'wechat':{'type':Sequelize[_0xb19b('0x1')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize['INTEGER']},'AdditionalPhones':{'type':Sequelize[_0xb19b('0x1')]},'priority':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize['NOW']},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize[_0xb19b('0x3')]}}; \ No newline at end of file +var _0x8950=['sequelize','exports','STRING','TEXT','INTEGER','UNSIGNED','DATE','NOW','lodash'];(function(_0x19f1f2,_0x519e33){var _0x4cc191=function(_0x382dfc){while(--_0x382dfc){_0x19f1f2['push'](_0x19f1f2['shift']());}};_0x4cc191(++_0x519e33);}(_0x8950,0x1dc));var _0x0895=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x8950[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x0895('0x0'));var Sequelize=require(_0x0895('0x1'));module[_0x0895('0x2')]={'firstName':{'type':Sequelize[_0x0895('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0x0895('0x3')]},'street':{'type':Sequelize[_0x0895('0x3')]},'postalCode':{'type':Sequelize[_0x0895('0x3')]},'city':{'type':Sequelize[_0x0895('0x3')]},'country':{'type':Sequelize[_0x0895('0x3')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x0895('0x4')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x0895('0x3')]},'fax':{'type':Sequelize[_0x0895('0x3')]},'email':{'type':Sequelize[_0x0895('0x3')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0x0895('0x3')]},'skype':{'type':Sequelize[_0x0895('0x3')]},'teams':{'type':Sequelize[_0x0895('0x3')]},'viber':{'type':Sequelize[_0x0895('0x3')]},'line':{'type':Sequelize[_0x0895('0x3')]},'wechat':{'type':Sequelize[_0x0895('0x3')]},'telegram':{'type':Sequelize[_0x0895('0x3')]},'UserId':{'type':Sequelize['INTEGER']},'AdditionalPhones':{'type':Sequelize[_0x0895('0x3')]},'priority':{'type':Sequelize[_0x0895('0x5')](0x2)[_0x0895('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x0895('0x7')],'defaultValue':Sequelize[_0x0895('0x8')]},'dialTimezone':{'type':Sequelize[_0x0895('0x3')]},'utcOffset':{'type':Sequelize[_0x0895('0x5')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 9d111c6..dcfc3f3 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 _0x97a1=['$or','push','ListId','findOrCreate','all','show','params','Tags','tag','Phones','ItemType','sequelize','literal','$and','CmCustomField','omit','cf_%d','pickBy','map','format','isEmpty','table','cm_contacts','id\x20=\x20?','toParam','text','phone','getTags','findOne','filters','model','fields','attributes','sort','pick','filter','merge','setTags','ContactItemType','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','CmHopperAdditionalPhone','item','ItemType.OrderBy','getAdditionalPhones','PHONE','`ItemType`.OrderBy','rescheduleAdditionalPhones','hopperId','rawAttributes','intersection','nolimit','ContactId','includeAll','rows','getHopperHistories','order','options','include','getHopperFinals','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','root','file','filename','chmodSync','0777','child_process','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','pid','upload','createReadStream','parse','import','User','binding','firstName','No\x20firstName\x20column\x20specified','message','start\x20child\x20process\x20correctly!','error\x20child\x20process','importUpdates','agent','fork','../../components/import/cm/csvUpdates','stringify','chat','sms','openchannel','whatsapp','voice','channel','includes','toLowerCase','Invalid\x20channel','range','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','type','callerid','starttime','endtime','duration','note','userDisposition','UserId','createdAt','DESC','findAndCountAll','fullname','startCase','closedAt','disposition','secondDisposition','thirdDisposition','key','Owner','Tag','color','browserName','customerIp','customerPort','deviceModel','osName','ratingType','ratingValue','mail','subject','substatus','threadId','Interaction','flatten','sortBy','reverse','value','slice','moment','bluebird','util','path','lodash','squel','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/environment/shared','../../mysqldb','redis','localhost','register','status','json','offset','undefined','count','limit','set','update','then','destroy','end','sendStatus','error','stack','name','send','describe','getOptions','query','catch','CmContact','find','tags','keys','startsWith','columnName','displayName','analytics','length','cf_','alias','values','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','hasOwnProperty','findAll','body','from','get','isArray','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','ChatInteraction','ChatMessage','MailInteraction','MailMessage','SmsMessage','FaxInteraction','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','CmHopperHistory','VoiceCallReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','create','dialTimezone','isNil','timezones','utcOffset','additionalPhones','bulkCreate','duplicates','where'];(function(_0x32e9c7,_0x241437){var _0x2ee90d=function(_0x18a562){while(--_0x18a562){_0x32e9c7['push'](_0x32e9c7['shift']());}};_0x2ee90d(++_0x241437);}(_0x97a1,0x18e));var _0x197a=function(_0x3cba90,_0x10e941){_0x3cba90=_0x3cba90-0x0;var _0x12d73c=_0x97a1[_0x3cba90];return _0x12d73c;};'use strict';var moment=require(_0x197a('0x0'));var BPromise=require(_0x197a('0x1'));var util=require(_0x197a('0x2'));var path=require(_0x197a('0x3'));var fs=require('fs');var _=require(_0x197a('0x4'));var squel=require(_0x197a('0x5'));var Papa=require(_0x197a('0x6'));var Redis=require('ioredis');var contacts=require('../../components/contacts');var qs=require(_0x197a('0x7'));var logger=require(_0x197a('0x8'))(_0x197a('0x9'));var config=require(_0x197a('0xa'));var shared=require(_0x197a('0xb'));var db=require(_0x197a('0xc'))['db'];config[_0x197a('0xd')]=_['defaults'](config['redis'],{'host':_0x197a('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./cmContact.socket')[_0x197a('0xf')](socket);function respondWithResult(_0x2e5446,_0xa9de28){_0xa9de28=_0xa9de28||0xc8;return function(_0x2255c2){if(_0x2255c2){return _0x2e5446[_0x197a('0x10')](_0xa9de28)[_0x197a('0x11')](_0x2255c2);}};}function respondWithFilteredResult(_0x39722,_0x990331){return function(_0x3e8129){if(_0x3e8129){var _0x37e64b=typeof _0x990331[_0x197a('0x12')]===_0x197a('0x13')&&typeof _0x990331['limit']==='undefined';var _0x5eb5f0=_0x3e8129[_0x197a('0x14')];var _0x4008c6=_0x37e64b?0x0:_0x990331[_0x197a('0x12')];var _0xf14632=_0x37e64b?_0x3e8129[_0x197a('0x14')]:_0x990331[_0x197a('0x12')]+_0x990331[_0x197a('0x15')];var _0x5d5a90;if(_0xf14632>=_0x5eb5f0){_0xf14632=_0x5eb5f0;_0x5d5a90=0xc8;}else{_0x5d5a90=0xce;}_0x39722['status'](_0x5d5a90);return _0x39722[_0x197a('0x16')]('Content-Range',_0x4008c6+'-'+_0xf14632+'/'+_0x5eb5f0)[_0x197a('0x11')](_0x3e8129);}return null;};}function saveUpdates(_0x78690d){return function(_0x59c9a6){if(_0x59c9a6){return _0x59c9a6[_0x197a('0x17')](_0x78690d)[_0x197a('0x18')](function(_0x2811f6){return _0x2811f6;});}return null;};}function removeEntity(_0x31c94e){return function(_0x2da6e2){if(_0x2da6e2){return _0x2da6e2[_0x197a('0x19')]()['then'](function(){_0x31c94e[_0x197a('0x10')](0xcc)[_0x197a('0x1a')]();});}};}function handleEntityNotFound(_0x52a0e7){return function(_0x4aa7b2){if(!_0x4aa7b2){_0x52a0e7[_0x197a('0x1b')](0x194);}return _0x4aa7b2;};}function handleError(_0x138ba5,_0x22b53a){_0x22b53a=_0x22b53a||0x1f4;return function(_0x277e42){logger[_0x197a('0x1c')](_0x277e42[_0x197a('0x1d')]);if(_0x277e42[_0x197a('0x1e')]){delete _0x277e42['name'];}_0x138ba5[_0x197a('0x10')](_0x22b53a)[_0x197a('0x1f')](_0x277e42);};}exports['index']=function(_0x504a2f,_0x4c18fe){var _0x400e64={};return contacts[_0x197a('0x20')]()['then'](function(_0x43fc45){_0x400e64=qs[_0x197a('0x21')](_0x43fc45,_0x504a2f);return contacts['findAll'](_0x504a2f[_0x197a('0x22')],_0x504a2f['user'],_0x400e64,_0x43fc45);})[_0x197a('0x18')](respondWithFilteredResult(_0x4c18fe,_0x400e64))[_0x197a('0x23')](handleError(_0x4c18fe,null));};exports['destroy']=function(_0x4e0a8a,_0x3bfe97){return db[_0x197a('0x24')][_0x197a('0x25')]({'where':{'id':_0x4e0a8a['params']['id']}})[_0x197a('0x18')](handleEntityNotFound(_0x3bfe97,null))['then'](removeEntity(_0x3bfe97,null))[_0x197a('0x23')](handleError(_0x3bfe97,null));};exports[_0x197a('0x20')]=function(_0x220c5f,_0x4aa8da){return db[_0x197a('0x24')]['describe']()[_0x197a('0x18')](function(_0x55f17f){delete _0x55f17f[_0x197a('0x26')];for(var _0x4c776d=0x0;_0x4c776d0x0){return new Promise(function(_0x5ce6b8){var _0x2ae7b9=[];for(var _0x50f563=0x0;_0x50f563<_0x398f97[_0x197a('0x2c')];_0x50f563++){_0x2ae7b9[_0x197a('0x5b')](insertAdditionalPhones(_0x398f97[_0x50f563]['contact'],_0x398f97[_0x50f563][_0x197a('0x56')]));}Promise[_0x197a('0x5e')](_0x2ae7b9)['then'](function(){_0x5ce6b8(0x1);});})[_0x197a('0x18')](function(){return{'success':_0x408136,'failure':_0x3f3fd9,'duplicates':_0x27bfd9};});}else{return{'success':_0x408136,'failure':_0x3f3fd9,'duplicates':_0x27bfd9};}}})['then'](respondWithResult(_0x2dcfb2,0xc9))[_0x197a('0x23')](handleError(_0x2dcfb2,null));};exports[_0x197a('0x5f')]=function(_0x5edb15,_0xc81ae5){var _0x2eaa0c;return db[_0x197a('0x24')]['describe']()[_0x197a('0x18')](function(_0xbd5bf3){return db[_0x197a('0x24')][_0x197a('0x25')]({'where':{'id':_0x5edb15[_0x197a('0x60')]['id']},'include':[{'model':db['Tag'],'as':_0x197a('0x61'),'attributes':['id',_0x197a('0x1e'),'color'],'required':_0x5edb15['query'][_0x197a('0x62')]?!![]:![]},{'model':db[_0x197a('0x47')],'as':_0x197a('0x63'),'where':{'CmContactId':_0x5edb15[_0x197a('0x60')]['id']},'required':![],'include':[{'model':db['ContactItemType'],'as':_0x197a('0x64')}]}],'order':[db[_0x197a('0x65')][_0x197a('0x66')]('Phones.OrderBy')],'attributes':_[_0x197a('0x27')](_0xbd5bf3)});})[_0x197a('0x18')](function(_0x21f1bb){if(!_[_0x197a('0x53')](_0x21f1bb)){_0x2eaa0c=_0x21f1bb[_0x197a('0x37')]({'plain':!![]});var _0x493414={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x21f1bb&&_0x21f1bb[_0x197a('0x5c')]){if(_0x21f1bb[_0x197a('0x5c')]){_0x493414[_0x197a('0x59')][_0x197a('0x67')][_0x197a('0x5b')]({'ListId':{'$ne':_0x21f1bb[_0x197a('0x5c')]}});}}return db[_0x197a('0x68')]['findAll'](_0x493414);}})[_0x197a('0x18')](function(_0x590017){if(!_[_0x197a('0x53')](_0x590017)){return _[_0x197a('0x69')](_0x2eaa0c,_['map'](_0x590017,function(_0x46c6f){return util['format'](_0x197a('0x6a'),_0x46c6f['id']);}));}})[_0x197a('0x18')](handleEntityNotFound(_0xc81ae5,null))[_0x197a('0x18')](respondWithResult(_0xc81ae5,null))[_0x197a('0x23')](handleError(_0xc81ae5,null));};exports['update']=function(_0x35444d,_0x2ba50a){var _0x5cb23d;if(_0x35444d[_0x197a('0x35')]['id']){delete _0x35444d[_0x197a('0x35')]['id'];}if(!_[_0x197a('0x53')](_0x35444d[_0x197a('0x35')][_0x197a('0x52')])){var _0x1b7cf5=_0x35444d['body'][_0x197a('0x52')];if(!_[_0x197a('0x53')](shared[_0x197a('0x54')][_0x1b7cf5]))_0x35444d[_0x197a('0x35')]['utcOffset']=shared[_0x197a('0x54')][_0x1b7cf5][_0x197a('0x55')];}return db[_0x197a('0x24')]['find']({'where':{'id':_0x35444d[_0x197a('0x60')]['id']}})[_0x197a('0x18')](handleEntityNotFound(_0x2ba50a,null))[_0x197a('0x18')](saveUpdates(_0x35444d['body'],null))['then'](function(_0x3bb24c){_0x5cb23d=_0x3bb24c;var _0xe6504f={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x3bb24c&&_0x3bb24c['ListId']){if(_0x3bb24c[_0x197a('0x5c')]){_0xe6504f[_0x197a('0x59')]['$and']['push']({'ListId':{'$ne':_0x3bb24c['ListId']}});}}return db[_0x197a('0x68')]['findAll'](_0xe6504f);})['then'](function(_0x65887d){if(_0x65887d){return _[_0x197a('0x69')](_[_0x197a('0x6b')](_0x35444d[_0x197a('0x35')],function(_0x454fed,_0x11f206){return _[_0x197a('0x28')](_0x11f206,_0x197a('0x2d'));}),_[_0x197a('0x6c')](_0x65887d,function(_0x4c794f){return util[_0x197a('0x6d')](_0x197a('0x6a'),_0x4c794f['id']);}));}})[_0x197a('0x18')](function(_0x54f162){if(_0x54f162&&!_[_0x197a('0x6e')](_0x54f162)){var _0x56fa70=squel[_0x197a('0x17')]()[_0x197a('0x6f')](_0x197a('0x70'))['setFields'](_0x54f162)[_0x197a('0x59')](_0x197a('0x71'),_0x35444d['params']['id'])[_0x197a('0x72')]();return db[_0x197a('0x65')][_0x197a('0x22')](_0x56fa70[_0x197a('0x73')],{'replacements':_0x56fa70[_0x197a('0x2f')]});}})['then'](function(){if(_0x35444d['body'][_0x197a('0x74')]&&_0x5cb23d){return db['CmHopper'][_0x197a('0x17')]({'phone':_0x35444d['body']['phone'],'OrderBy':0x0},{'where':{'ContactId':_0x5cb23d['id']}});}})[_0x197a('0x18')](function(){return _0x5cb23d;})[_0x197a('0x18')](respondWithResult(_0x2ba50a,null))[_0x197a('0x23')](handleError(_0x2ba50a,null));};exports[_0x197a('0x75')]=function(_0x53c253,_0x5a85e7){var _0x4dbd69={};var _0x4770be={};var _0x25f930;var _0x34d858;return db[_0x197a('0x24')][_0x197a('0x76')]({'where':{'id':_0x53c253[_0x197a('0x60')]['id']}})['then'](handleEntityNotFound(_0x5a85e7,null))[_0x197a('0x18')](function(_0x1f170d){if(_0x1f170d){_0x25f930=_0x1f170d;_0x4770be['model']=_[_0x197a('0x27')](db['Tag']['rawAttributes']);_0x4770be[_0x197a('0x22')]=_[_0x197a('0x27')](_0x53c253[_0x197a('0x22')]);_0x4770be[_0x197a('0x77')]=_['intersection'](_0x4770be[_0x197a('0x78')],_0x4770be['query']);_0x4dbd69['attributes']=_['intersection'](_0x4770be[_0x197a('0x78')],qs[_0x197a('0x79')](_0x53c253[_0x197a('0x22')][_0x197a('0x79')]));_0x4dbd69['attributes']=_0x4dbd69[_0x197a('0x7a')]['length']?_0x4dbd69[_0x197a('0x7a')]:_0x4770be[_0x197a('0x78')];_0x4dbd69['order']=qs[_0x197a('0x7b')](_0x53c253[_0x197a('0x22')][_0x197a('0x7b')]);_0x4dbd69[_0x197a('0x59')]=qs['filters'](_[_0x197a('0x7c')](_0x53c253[_0x197a('0x22')],_0x4770be['filters']));if(_0x53c253[_0x197a('0x22')][_0x197a('0x7d')]){_0x4dbd69[_0x197a('0x59')]=_[_0x197a('0x7e')](_0x4dbd69['where'],{'$or':_['map'](_0x4dbd69[_0x197a('0x7a')],function(_0x5e7553){var _0xad756c={};_0xad756c[_0x5e7553]={'$like':'%'+_0x53c253['query'][_0x197a('0x7d')]+'%'};return _0xad756c;})});}_0x4dbd69=_[_0x197a('0x7e')]({},_0x4dbd69,_0x53c253['options']);return _0x25f930[_0x197a('0x75')](_0x4dbd69);}})['then'](function(_0x428951){if(_0x428951){_0x34d858=_0x428951[_0x197a('0x2c')];if(!_0x53c253[_0x197a('0x22')][_0x197a('0x33')]('nolimit')){_0x4dbd69[_0x197a('0x15')]=qs[_0x197a('0x15')](_0x53c253[_0x197a('0x22')][_0x197a('0x15')]);_0x4dbd69[_0x197a('0x12')]=qs[_0x197a('0x12')](_0x53c253[_0x197a('0x22')][_0x197a('0x12')]);}return _0x25f930[_0x197a('0x75')](_0x4dbd69);}})['then'](function(_0x2ae3c7){if(_0x2ae3c7){return _0x2ae3c7?{'count':_0x34d858,'rows':_0x2ae3c7}:null;}})[_0x197a('0x18')](respondWithResult(_0x5a85e7,null))['catch'](handleError(_0x5a85e7,null));};exports[_0x197a('0x7f')]=function(_0x285196,_0x315827){if(_0x285196[_0x197a('0x35')]['id']){delete _0x285196[_0x197a('0x35')]['id'];}return db[_0x197a('0x24')]['findOne']({'where':{'id':_0x285196[_0x197a('0x60')]['id']}})[_0x197a('0x18')](handleEntityNotFound(_0x315827,null))[_0x197a('0x18')](function(_0x3f41f7){if(_0x3f41f7){return _0x3f41f7['setTags'](_0x285196[_0x197a('0x35')]['ids']||[]);}return null;})[_0x197a('0x18')](respondWithResult(_0x315827,null))[_0x197a('0x23')](handleError(_0x315827,null));};exports['setAdditionalPhones']=function(_0x55baa8,_0x322c3e){var _0x28f931=[];_0x28f931[_0x197a('0x5b')](addAdditionalPhones(_0x55baa8[_0x197a('0x35')]));Promise[_0x197a('0x5e')](_0x28f931)['then'](function(){_0x28f931=[];_0x28f931[_0x197a('0x5b')](deleteCmHopperPhones(_0x55baa8[_0x197a('0x35')]['id']));_0x28f931[_0x197a('0x5b')](addCmHopperPhones(_0x55baa8['body']['id']));Promise['all'](_0x28f931)['then'](function(){return[0x1];})['then'](respondWithResult(_0x322c3e,null));});};function addAdditionalPhones(_0x5656f5){var _0x52d4ab;return new Promise(function(_0x37eff2){return db[_0x197a('0x47')][_0x197a('0x19')]({'where':{'CmContactId':_0x5656f5['id']}})[_0x197a('0x18')](function(){db[_0x197a('0x80')][_0x197a('0x34')]({'raw':!![],'attributes':['id',_0x197a('0x81')]})['then'](function(_0x4cea64){var _0x15c4a3=[];for(var _0x29783e=0x0;_0x29783e<_0x5656f5[_0x197a('0x82')][_0x197a('0x2c')];_0x29783e++){var _0x158640=_0x5656f5['item_types']?_[_0x197a('0x53')](_0x5656f5[_0x197a('0x83')][_0x29783e])?'':_0x5656f5[_0x197a('0x83')][_0x29783e]:_0x5656f5[_0x197a('0x82')][_0x29783e][_0x197a('0x84')]?_0x5656f5[_0x197a('0x82')][_0x29783e][_0x197a('0x84')]:'';var _0x559b73=_[_0x197a('0x53')](_0x5656f5[_0x197a('0x82')][_0x29783e]['description'])?'':_0x5656f5[_0x197a('0x82')][_0x29783e][_0x197a('0x85')];var _0x51120c=_0x158640+':'+_0x5656f5[_0x197a('0x82')][_0x29783e][_0x197a('0x74')]+'§'+_0x559b73;if(_['isNil'](_0x52d4ab))_0x52d4ab=_0x51120c;else _0x52d4ab+=';'+_0x51120c;var _0x5bc106=null;var _0x29dc83=null;if(_0x5656f5[_0x197a('0x83')]){if(!_['isNil'](_0x5656f5['item_types'][_0x29783e])){_0x29dc83=_[_0x197a('0x25')](_0x4cea64,function(_0x20d98b){return _0x20d98b['id']===_0x5656f5[_0x197a('0x83')][_0x29783e];});if(!_[_0x197a('0x53')](_0x29dc83)){_0x5bc106=_0x29dc83['OrderBy'];}}}else{if(!_[_0x197a('0x53')](_0x5656f5[_0x197a('0x82')][_0x29783e])){_0x29dc83=_[_0x197a('0x25')](_0x4cea64,function(_0x380b1b){return _0x380b1b['id']===_0x5656f5[_0x197a('0x82')][_0x29783e][_0x197a('0x84')];});if(!_[_0x197a('0x53')](_0x29dc83)){_0x5bc106=_0x29783e;}}}if(_[_0x197a('0x53')](_0x5bc106)){_0x5bc106=0x64;}_0x15c4a3['push'](addAdditionalPhone(_0x5656f5['id'],_0x5656f5[_0x197a('0x82')][_0x29783e][_0x197a('0x74')],_0x5656f5[_0x197a('0x83')]?_[_0x197a('0x53')](_0x5656f5[_0x197a('0x83')][_0x29783e])?null:_0x5656f5[_0x197a('0x83')][_0x29783e]:_0x5656f5[_0x197a('0x82')][_0x29783e][_0x197a('0x84')]?_0x5656f5[_0x197a('0x82')][_0x29783e][_0x197a('0x84')]:null,_0x5bc106,_0x559b73));}Promise[_0x197a('0x5e')](_0x15c4a3)[_0x197a('0x18')](function(){db[_0x197a('0x24')]['update']({'AdditionalPhones':_0x52d4ab},{'where':{'id':_0x5656f5['id']}})[_0x197a('0x18')](function(){_0x37eff2(0x1);});});});});});}function addAdditionalPhone(_0x474db8,_0x30d1b2,_0x11f7f7,_0x5a25e9,_0xa5d6b4){return db['CmContactHasItem'][_0x197a('0x25')]({'where':{'CmContactId':_0x474db8,'item':_0x30d1b2}})[_0x197a('0x18')](function(_0x1563af){if(_0x1563af)logger[_0x197a('0x30')](_0x197a('0x86'),_0x1563af);else{db['CmContactHasItem']['create']({'CmContactId':_0x474db8,'item':_0x30d1b2,'ItemTypeId':_0x11f7f7,'OrderBy':_0x5a25e9,'ItemClass':'PHONE','description':_0xa5d6b4});}});}function deleteCmHopperPhones(_0x3e538b){return new Promise(function(_0x5bab4f){return db[_0x197a('0x3b')][_0x197a('0x34')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x3e538b}})['then'](function(_0xf94b){db[_0x197a('0x87')]['destroy']({'where':{'CmHopperId':{'$in':_['map'](_0xf94b,'id')}}});})[_0x197a('0x18')](function(){_0x5bab4f(0x1);});});}function addCmHopperPhones(_0xdfdc3d){return new Promise(function(_0x58dca9){return db[_0x197a('0x3b')][_0x197a('0x34')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0xdfdc3d}})[_0x197a('0x18')](function(_0x598f16){var _0x2f0dfd=[];_[_0x197a('0x6c')](_0x598f16,function(_0x4c36a8){_0x2f0dfd[_0x197a('0x5b')](createCmHopperPhone(_0xdfdc3d,_0x4c36a8['id']));});Promise[_0x197a('0x5e')](_0x2f0dfd)[_0x197a('0x18')](function(){_0x58dca9(0x1);});});});}function createCmHopperPhone(_0x4109b0,_0x1df600){return new Promise(function(_0x26294d){db[_0x197a('0x47')][_0x197a('0x34')]({'raw':!![],'attributes':['item',_0x197a('0x81')],'where':{'CmContactId':_0x4109b0,'ItemClass':'PHONE'},'include':[{'model':db[_0x197a('0x80')],'attributes':[_0x197a('0x81')],'as':_0x197a('0x64')}],'order':[_0x197a('0x81'),db[_0x197a('0x65')][_0x197a('0x66')]('`ItemType`.OrderBy')]})['then'](function(_0x1566b7){var _0xd019b=0x1;var _0x3cd0c8=_[_0x197a('0x6c')](_0x1566b7,function(_0x146d44){_0x146d44['CmHopperId']=_0x1df600;_0x146d44[_0x197a('0x74')]=_0x146d44[_0x197a('0x88')];_0x146d44[_0x197a('0x81')]=_0xd019b;delete _0x146d44[_0x197a('0x89')];_0xd019b=_0xd019b+0x1;return _0x146d44;});return db['CmHopperAdditionalPhone'][_0x197a('0x57')](_0x3cd0c8,{});})[_0x197a('0x18')](function(){_0x26294d(0x1);});});}function insertAdditionalPhones(_0x5b5815,_0x1d3198){return new Promise(function(_0x17a8bb){var _0x23410a=[];for(var _0x3304a2=0x0;_0x3304a2<_0x1d3198[_0x197a('0x2c')];_0x3304a2++){var _0x461937=_0x1d3198[_0x3304a2];_0x23410a[_0x197a('0x5b')](parseContactItemType(_0x461937));}Promise['all'](_0x23410a)[_0x197a('0x18')](function(){var _0x2737f2={'id':_0x5b5815['id'],'items':_0x1d3198};return addAdditionalPhones(_0x2737f2)[_0x197a('0x18')](function(){return addCmHopperPhones(_0x5b5815['id']);});})[_0x197a('0x18')](function(){_0x17a8bb(_0x5b5815);});});}function parseContactItemType(_0x49def3){return new Promise(function(_0x1d9b30){if(_0x49def3[_0x197a('0x33')](_0x197a('0x84'))){_0x1d9b30(_0x49def3);}else{return db[_0x197a('0x80')][_0x197a('0x25')]({'where':{'name':_0x49def3[_0x197a('0x64')]}})[_0x197a('0x18')](function(_0xf78a1a){if(_['isNil'](_0xf78a1a))_0x49def3['ItemTypeId']=null;else _0x49def3[_0x197a('0x84')]=_0xf78a1a['id'];_0x1d9b30(_0x49def3);});}});}exports[_0x197a('0x8a')]=function(_0x88f310,_0x3ca345){return db[_0x197a('0x47')][_0x197a('0x34')]({'raw':!![],'where':{'CmContactId':_0x88f310[_0x197a('0x60')]['id'],'ItemClass':_0x197a('0x8b')},'include':[{'model':db[_0x197a('0x80')],'as':_0x197a('0x64')}],'order':[[_0x197a('0x81')],[db[_0x197a('0x65')][_0x197a('0x66')](_0x197a('0x8c'))]]})[_0x197a('0x18')](function(_0xeb7905){return _0xeb7905;})[_0x197a('0x18')](respondWithResult(_0x3ca345,null))['catch'](handleError(_0x3ca345,null));};exports['duplicateAdditionalPhones']=function(_0x13c51d,_0x3ef275){return db[_0x197a('0x47')][_0x197a('0x34')]({'raw':!![],'where':{'CmContactId':_0x13c51d[_0x197a('0x35')]['fromContactId']}})['then'](function(_0x11df5f){var _0x51338e=_[_0x197a('0x6c')](_0x11df5f,function(_0x316ea0){_0x316ea0['CmContactId']=_0x13c51d[_0x197a('0x35')]['toContactId'];return _0x316ea0;});return db[_0x197a('0x47')][_0x197a('0x57')](_0x51338e,{});})[_0x197a('0x18')](function(){return addCmHopperPhones(_0x13c51d[_0x197a('0x35')]['toContactId']);})[_0x197a('0x18')](function(){return['ok'];})[_0x197a('0x18')](respondWithResult(_0x3ef275,null))['catch'](handleError(_0x3ef275,null));};exports[_0x197a('0x8d')]=function(_0x14c0a0,_0x364acc){var _0x652069=[];_0x652069[_0x197a('0x5b')](createCmHopperPhone(_0x14c0a0[_0x197a('0x35')]['id'],_0x14c0a0['body'][_0x197a('0x8e')]));Promise['all'](_0x652069)[_0x197a('0x18')](function(){return[0x1];})[_0x197a('0x18')](respondWithResult(_0x364acc,null));};exports['getHoppers']=function(_0x2153b7,_0x3ef7fa){var _0x265cf1={'raw':![],'where':{}};var _0x551c6e={};var _0x211837={'count':0x0,'rows':[]};return db[_0x197a('0x24')][_0x197a('0x76')]({'where':{'id':_0x2153b7['params']['id']}})['then'](handleEntityNotFound(_0x3ef7fa,null))[_0x197a('0x18')](function(_0x47c5db){if(_0x47c5db){_0x551c6e['model']=_[_0x197a('0x27')](db[_0x197a('0x3b')][_0x197a('0x8f')]);_0x551c6e['query']=_[_0x197a('0x27')](_0x2153b7['query']);_0x551c6e[_0x197a('0x77')]=_[_0x197a('0x90')](_0x551c6e[_0x197a('0x78')],_0x551c6e[_0x197a('0x22')]);_0x265cf1[_0x197a('0x7a')]=_[_0x197a('0x90')](_0x551c6e[_0x197a('0x78')],qs[_0x197a('0x79')](_0x2153b7[_0x197a('0x22')][_0x197a('0x79')]));_0x265cf1['attributes']=_0x265cf1[_0x197a('0x7a')]['length']?_0x265cf1[_0x197a('0x7a')]:_0x551c6e['model'];if(!_0x2153b7[_0x197a('0x22')]['hasOwnProperty'](_0x197a('0x91'))){_0x265cf1[_0x197a('0x15')]=qs[_0x197a('0x15')](_0x2153b7[_0x197a('0x22')]['limit']);_0x265cf1['offset']=qs[_0x197a('0x12')](_0x2153b7[_0x197a('0x22')][_0x197a('0x12')]);}_0x265cf1['order']=qs[_0x197a('0x7b')](_0x2153b7[_0x197a('0x22')][_0x197a('0x7b')]);_0x265cf1['where']=qs[_0x197a('0x77')](_[_0x197a('0x7c')](_0x2153b7[_0x197a('0x22')],_0x551c6e[_0x197a('0x77')]));_0x265cf1[_0x197a('0x59')][_0x197a('0x92')]=_0x47c5db['id'];if(_0x2153b7['query']['filter']){_0x265cf1[_0x197a('0x59')]=_[_0x197a('0x7e')](_0x265cf1[_0x197a('0x59')],{'$or':_[_0x197a('0x6c')](_0x265cf1[_0x197a('0x7a')],function(_0x18bb53){var _0x12be91={};_0x12be91[_0x18bb53]={'$like':'%'+_0x2153b7['query']['filter']+'%'};return _0x12be91;})});}_0x265cf1=_[_0x197a('0x7e')]({},_0x265cf1,_0x2153b7['options']);return db['CmHopper']['count']({'where':_0x265cf1[_0x197a('0x59')]})[_0x197a('0x18')](function(_0x221e6f){_0x211837['count']=_0x221e6f;if(_0x2153b7[_0x197a('0x22')][_0x197a('0x93')]){_0x265cf1['include']=[{'all':!![]}];}return db[_0x197a('0x3b')][_0x197a('0x34')](_0x265cf1);})[_0x197a('0x18')](function(_0x544ba9){_0x211837[_0x197a('0x94')]=_0x544ba9;return _0x211837;});}})[_0x197a('0x18')](respondWithFilteredResult(_0x3ef7fa,_0x265cf1))['catch'](handleError(_0x3ef7fa,null));};exports[_0x197a('0x95')]=function(_0x4bf225,_0x2c6df7){var _0x40f32d={'raw':!![],'where':{}};var _0xa336fa={};var _0x222f4c={'count':0x0,'rows':[]};return db['CmContact'][_0x197a('0x76')]({'where':{'id':_0x4bf225[_0x197a('0x60')]['id']}})['then'](handleEntityNotFound(_0x2c6df7,null))[_0x197a('0x18')](function(_0x1be3fa){if(_0x1be3fa){_0xa336fa[_0x197a('0x78')]=_[_0x197a('0x27')](db[_0x197a('0x49')][_0x197a('0x8f')]);_0xa336fa['query']=_[_0x197a('0x27')](_0x4bf225['query']);_0xa336fa[_0x197a('0x77')]=_[_0x197a('0x90')](_0xa336fa[_0x197a('0x78')],_0xa336fa[_0x197a('0x22')]);_0x40f32d[_0x197a('0x7a')]=_[_0x197a('0x90')](_0xa336fa['model'],qs[_0x197a('0x79')](_0x4bf225[_0x197a('0x22')][_0x197a('0x79')]));_0x40f32d[_0x197a('0x7a')]=_0x40f32d[_0x197a('0x7a')]['length']?_0x40f32d[_0x197a('0x7a')]:_0xa336fa[_0x197a('0x78')];if(!_0x4bf225[_0x197a('0x22')][_0x197a('0x33')](_0x197a('0x91'))){_0x40f32d[_0x197a('0x15')]=qs[_0x197a('0x15')](_0x4bf225[_0x197a('0x22')][_0x197a('0x15')]);_0x40f32d['offset']=qs[_0x197a('0x12')](_0x4bf225[_0x197a('0x22')][_0x197a('0x12')]);}_0x40f32d[_0x197a('0x96')]=qs['sort'](_0x4bf225[_0x197a('0x22')][_0x197a('0x7b')]);_0x40f32d[_0x197a('0x59')]=qs[_0x197a('0x77')](_['pick'](_0x4bf225[_0x197a('0x22')],_0xa336fa[_0x197a('0x77')]));_0x40f32d[_0x197a('0x59')][_0x197a('0x92')]=_0x1be3fa['id'];if(_0x4bf225['query'][_0x197a('0x7d')]){_0x40f32d[_0x197a('0x59')]=_['merge'](_0x40f32d[_0x197a('0x59')],{'$or':_[_0x197a('0x6c')](_0x40f32d['attributes'],function(_0x278f91){var _0x3795f1={};_0x3795f1[_0x278f91]={'$like':'%'+_0x4bf225[_0x197a('0x22')][_0x197a('0x7d')]+'%'};return _0x3795f1;})});}_0x40f32d=_[_0x197a('0x7e')]({},_0x40f32d,_0x4bf225[_0x197a('0x97')]);return db[_0x197a('0x49')][_0x197a('0x14')]({'where':_0x40f32d['where']})[_0x197a('0x18')](function(_0x4dc0f6){_0x222f4c[_0x197a('0x14')]=_0x4dc0f6;if(_0x4bf225[_0x197a('0x22')]['includeAll']){_0x40f32d[_0x197a('0x98')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x197a('0x34')](_0x40f32d);})[_0x197a('0x18')](function(_0xd545fb){_0x222f4c[_0x197a('0x94')]=_0xd545fb;return _0x222f4c;});}})[_0x197a('0x18')](respondWithFilteredResult(_0x2c6df7,_0x40f32d))[_0x197a('0x23')](handleError(_0x2c6df7,null));};exports[_0x197a('0x99')]=function(_0x118262,_0x2ae057){var _0x550f5a={'raw':!![],'where':{}};var _0x3ca625={};var _0x1bddf1={'count':0x0,'rows':[]};return db[_0x197a('0x24')][_0x197a('0x76')]({'where':{'id':_0x118262[_0x197a('0x60')]['id']}})[_0x197a('0x18')](handleEntityNotFound(_0x2ae057,null))[_0x197a('0x18')](function(_0x1bbccb){if(_0x1bbccb){_0x3ca625[_0x197a('0x78')]=_['keys'](db[_0x197a('0x48')]['rawAttributes']);_0x3ca625[_0x197a('0x22')]=_[_0x197a('0x27')](_0x118262[_0x197a('0x22')]);_0x3ca625['filters']=_[_0x197a('0x90')](_0x3ca625[_0x197a('0x78')],_0x3ca625['query']);_0x550f5a['attributes']=_[_0x197a('0x90')](_0x3ca625[_0x197a('0x78')],qs[_0x197a('0x79')](_0x118262['query'][_0x197a('0x79')]));_0x550f5a[_0x197a('0x7a')]=_0x550f5a[_0x197a('0x7a')][_0x197a('0x2c')]?_0x550f5a[_0x197a('0x7a')]:_0x3ca625[_0x197a('0x78')];if(!_0x118262[_0x197a('0x22')]['hasOwnProperty'](_0x197a('0x91'))){_0x550f5a['limit']=qs[_0x197a('0x15')](_0x118262['query'][_0x197a('0x15')]);_0x550f5a[_0x197a('0x12')]=qs[_0x197a('0x12')](_0x118262[_0x197a('0x22')][_0x197a('0x12')]);}_0x550f5a[_0x197a('0x96')]=qs[_0x197a('0x7b')](_0x118262[_0x197a('0x22')][_0x197a('0x7b')]);_0x550f5a['where']=qs[_0x197a('0x77')](_['pick'](_0x118262[_0x197a('0x22')],_0x3ca625[_0x197a('0x77')]));_0x550f5a[_0x197a('0x59')][_0x197a('0x92')]=_0x1bbccb['id'];if(_0x118262['query'][_0x197a('0x7d')]){_0x550f5a['where']=_['merge'](_0x550f5a[_0x197a('0x59')],{'$or':_[_0x197a('0x6c')](_0x550f5a['attributes'],function(_0x1a0317){var _0x17eda5={};_0x17eda5[_0x1a0317]={'$like':'%'+_0x118262[_0x197a('0x22')][_0x197a('0x7d')]+'%'};return _0x17eda5;})});}_0x550f5a=_[_0x197a('0x7e')]({},_0x550f5a,_0x118262[_0x197a('0x97')]);return db['CmHopperFinal']['count']({'where':_0x550f5a[_0x197a('0x59')]})['then'](function(_0x3fcc43){_0x1bddf1[_0x197a('0x14')]=_0x3fcc43;if(_0x118262[_0x197a('0x22')]['includeAll']){_0x550f5a['include']=[{'all':!![]}];}return db['CmHopperFinal'][_0x197a('0x34')](_0x550f5a);})[_0x197a('0x18')](function(_0x1f5021){_0x1bddf1[_0x197a('0x94')]=_0x1f5021;return _0x1bddf1;});}})[_0x197a('0x18')](respondWithFilteredResult(_0x2ae057,_0x550f5a))['catch'](handleError(_0x2ae057,null));};exports[_0x197a('0x9a')]=function(_0x3a7e56,_0x22f1b4){var _0x3daab4={'raw':!![],'where':{}};var _0x4b7e0a={};var _0x206043={'count':0x0,'rows':[]};return db[_0x197a('0x24')][_0x197a('0x76')]({'where':{'id':_0x3a7e56[_0x197a('0x60')]['id']}})[_0x197a('0x18')](handleEntityNotFound(_0x22f1b4,null))['then'](function(_0x46da07){if(_0x46da07){_0x4b7e0a[_0x197a('0x78')]=_[_0x197a('0x27')](db[_0x197a('0x4e')][_0x197a('0x8f')]);_0x4b7e0a[_0x197a('0x22')]=_['keys'](_0x3a7e56[_0x197a('0x22')]);_0x4b7e0a[_0x197a('0x77')]=_[_0x197a('0x90')](_0x4b7e0a[_0x197a('0x78')],_0x4b7e0a[_0x197a('0x22')]);_0x3daab4[_0x197a('0x7a')]=_[_0x197a('0x90')](_0x4b7e0a[_0x197a('0x78')],qs[_0x197a('0x79')](_0x3a7e56[_0x197a('0x22')][_0x197a('0x79')]));_0x3daab4['attributes']=_0x3daab4[_0x197a('0x7a')][_0x197a('0x2c')]?_0x3daab4['attributes']:_0x4b7e0a[_0x197a('0x78')];if(!_0x3a7e56[_0x197a('0x22')][_0x197a('0x33')](_0x197a('0x91'))){_0x3daab4[_0x197a('0x15')]=qs[_0x197a('0x15')](_0x3a7e56[_0x197a('0x22')][_0x197a('0x15')]);_0x3daab4['offset']=qs[_0x197a('0x12')](_0x3a7e56[_0x197a('0x22')][_0x197a('0x12')]);}_0x3daab4[_0x197a('0x96')]=qs[_0x197a('0x7b')](_0x3a7e56[_0x197a('0x22')]['sort']);_0x3daab4['where']=qs[_0x197a('0x77')](_[_0x197a('0x7c')](_0x3a7e56[_0x197a('0x22')],_0x4b7e0a[_0x197a('0x77')]));_0x3daab4[_0x197a('0x59')]['ContactId']=_0x46da07['id'];if(_0x3a7e56[_0x197a('0x22')][_0x197a('0x7d')]){_0x3daab4[_0x197a('0x59')]=_['merge'](_0x3daab4['where'],{'$or':_[_0x197a('0x6c')](_0x3daab4[_0x197a('0x7a')],function(_0x5ca33d){var _0x4faad8={};_0x4faad8[_0x5ca33d]={'$like':'%'+_0x3a7e56['query']['filter']+'%'};return _0x4faad8;})});}_0x3daab4=_[_0x197a('0x7e')]({},_0x3daab4,_0x3a7e56[_0x197a('0x97')]);return db[_0x197a('0x4e')][_0x197a('0x14')]({'where':_0x3daab4[_0x197a('0x59')]})[_0x197a('0x18')](function(_0x52f2e0){_0x206043[_0x197a('0x14')]=_0x52f2e0;if(_0x3a7e56[_0x197a('0x22')][_0x197a('0x93')]){_0x3daab4['include']=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0x3daab4);})[_0x197a('0x18')](function(_0x54b852){_0x206043[_0x197a('0x94')]=_0x54b852;return _0x206043;});}})[_0x197a('0x18')](respondWithFilteredResult(_0x22f1b4,_0x3daab4))[_0x197a('0x23')](handleError(_0x22f1b4,null));};exports[_0x197a('0x9b')]=function(_0x13a109,_0x313c00){try{if(!_0x13a109['body'][_0x197a('0x5c')]){throw new Error(_0x197a('0x9c'));}if(!_0x13a109['body'][_0x197a('0x9d')]){throw new Error(_0x197a('0x9e'));}if(!_0x13a109[_0x197a('0x35')][_0x197a('0x9f')]){throw new Error(_0x197a('0xa0'));}if(!_0x13a109[_0x197a('0x35')][_0x197a('0xa1')]){throw new Error(_0x197a('0xa2'));}var _0x38082b=_0x13a109[_0x197a('0x35')][_0x197a('0x9d')][_0x197a('0xa3')](',');var _0x41cb16=_0x13a109[_0x197a('0x35')][_0x197a('0x9f')][_0x197a('0xa3')](',');if(!_0x38082b[_0x197a('0x2c')]||!_0x41cb16[_0x197a('0x2c')]||_0x38082b[_0x197a('0x2c')]!==_0x41cb16[_0x197a('0x2c')]){throw new Error(_0x197a('0xa4'));}_0x13a109[_0x197a('0x35')]['fields']=_[_0x197a('0xa5')](_0x38082b,_0x41cb16);if(!_0x13a109[_0x197a('0x35')][_0x197a('0x79')][_0x197a('0x74')]){throw new Error(_0x197a('0xa6'));}if(!_0x13a109['body']['fields']['firstName']){throw new Error('No\x20firstName\x20column\x20specified');}var _0x45527d=path[_0x197a('0x39')](config[_0x197a('0xa7')],'server/files/tmp',_0x13a109[_0x197a('0xa8')][_0x197a('0xa9')]);fs[_0x197a('0xaa')](_0x45527d,parseInt(_0x197a('0xab'),0x8));var _0x10b582=require(_0x197a('0xac'))['fork'](path['join'](__dirname,_0x197a('0xad')),[_0x45527d,_0x13a109[_0x197a('0x35')][_0x197a('0x9d')],_0x13a109[_0x197a('0x35')][_0x197a('0x9f')],_0x13a109[_0x197a('0x35')][_0x197a('0x5c')],_0x13a109['body'][_0x197a('0xae')],_0x13a109['body'][_0x197a('0x58')],_0x13a109[_0x197a('0x35')]['socket_timestamp']]);return _0x313c00['status'](0xc8)[_0x197a('0x11')]({'message':_0x197a('0xaf'),'pid':_0x10b582[_0x197a('0xb0')]});}catch(_0x5e6362){return _0x313c00[_0x197a('0x10')](0x1f4)['send'](_0x5e6362);}};exports[_0x197a('0xb1')]=function(_0x3edc0f,_0x5ea567){var _0x123158=fs[_0x197a('0xb2')](_0x3edc0f[_0x197a('0xa8')][_0x197a('0x3')]);Papa[_0x197a('0xb3')](_0x123158,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x471ded){return _0x5ea567['status'](0xc8)[_0x197a('0x11')]({'file':_0x3edc0f['file'],'fields':_0x471ded['meta'][_0x197a('0x79')]});}});};exports[_0x197a('0xb4')]=function(_0x39cfb1,_0x139f1a){return db[_0x197a('0xb5')][_0x197a('0x34')]({'raw':!![],'attributes':['id'],'where':{'role':'agent'}})[_0x197a('0x18')](function(_0x5bc0ea){var _0x4cacf4=![];if(!_0x39cfb1['body']['ListId']){throw new Error(_0x197a('0x9c'));}if(!_0x39cfb1[_0x197a('0x35')][_0x197a('0xb6')][_0x197a('0x74')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x39cfb1[_0x197a('0x35')][_0x197a('0xb6')][_0x197a('0xb7')]){throw new Error(_0x197a('0xb8'));}if(!_0x39cfb1['body']['socket_timestamp']){throw new Error(_0x197a('0xa2'));}var _0x2949ef=require('child_process')['fork'](path[_0x197a('0x39')](__dirname,'../../components/import/cm/csv2'),[_0x39cfb1[_0x197a('0x60')]['id'],JSON['stringify'](_0x39cfb1[_0x197a('0x35')]),JSON['stringify'](_0x5bc0ea)]);_0x2949ef['on'](_0x197a('0xb9'),function(){_0x4cacf4=!![];return _0x139f1a[_0x197a('0x10')](0xc8)[_0x197a('0x11')]({'message':_0x197a('0xba'),'pid':_0x2949ef[_0x197a('0xb0')]});});_0x2949ef['on']('exit',function(_0x41527c){if(_0x41527c&&!_0x4cacf4){return _0x139f1a['status'](0x1f4)['json']({'message':_0x197a('0xbb'),'pid':_0x2949ef[_0x197a('0xb0')]});}});})[_0x197a('0x23')](handleError(_0x139f1a,null));};exports[_0x197a('0xbc')]=function(_0x503ef5,_0x34d4de){return db[_0x197a('0xb5')][_0x197a('0x34')]({'raw':!![],'attributes':['id'],'where':{'role':_0x197a('0xbd')}})['then'](function(_0x5612c8){var _0x3cc11a=![];if(!_0x503ef5['body'][_0x197a('0x5c')]){throw new Error('No\x20ListId\x20specified');}if(!_0x503ef5[_0x197a('0x35')][_0x197a('0xb6')]['phone']){throw new Error(_0x197a('0xa6'));}if(!_0x503ef5[_0x197a('0x35')][_0x197a('0xb6')][_0x197a('0xb7')]){throw new Error(_0x197a('0xb8'));}if(!_0x503ef5['body']['socket_timestamp']){throw new Error(_0x197a('0xa2'));}var _0x1b930b=require('child_process')[_0x197a('0xbe')](path['join'](__dirname,_0x197a('0xbf')),[_0x503ef5['params']['id'],JSON[_0x197a('0xc0')](_0x503ef5[_0x197a('0x35')]),JSON[_0x197a('0xc0')](_0x5612c8)]);_0x1b930b['on'](_0x197a('0xb9'),function(){_0x3cc11a=!![];return _0x34d4de[_0x197a('0x10')](0xc8)[_0x197a('0x11')]({'message':_0x197a('0xba'),'pid':_0x1b930b[_0x197a('0xb0')]});});_0x1b930b['on']('exit',function(_0x29cdcf){if(_0x29cdcf&&!_0x3cc11a){return _0x34d4de['status'](0x1f4)[_0x197a('0x11')]({'message':_0x197a('0xbb'),'pid':_0x1b930b[_0x197a('0xb0')]});}});})['catch'](handleError(_0x34d4de,null));};exports['getJourney']=function(_0x23d884,_0xad64aa){var _0x22742a=['mail',_0x197a('0xc1'),_0x197a('0xc2'),_0x197a('0xc3'),'fax',_0x197a('0xc4'),_0x197a('0xc5')];var _0x112327={'offset':0x0,'order':qs[_0x197a('0x7b')]('-createdAt')},_0x492afc={'count':0x0,'rows':[]};Promise['resolve']()[_0x197a('0x18')](function(){if(_0x23d884['query'][_0x197a('0xc6')]){if(!_[_0x197a('0xc7')](_0x22742a,_0x23d884[_0x197a('0x22')][_0x197a('0xc6')][_0x197a('0xc8')]())){throw new Error(_0x197a('0xc9'));}_0x22742a=[_0x23d884[_0x197a('0x22')]['channel'][_0x197a('0xc8')]()];}if(_0x23d884[_0x197a('0x22')][_0x197a('0xca')]){try{var _0x5c05bd=JSON[_0x197a('0xb3')](_0x23d884[_0x197a('0x22')][_0x197a('0xca')]);if(!moment(_0x5c05bd['from'])['isValid']()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x5c05bd['to'])[_0x197a('0xcb')]()){throw new Error(_0x197a('0xcc'));}}catch(_0x3a175e){throw new Error(_0x197a('0xcd'));}}if(!_0x23d884['query'][_0x197a('0x33')](_0x197a('0x91'))){_0x112327[_0x197a('0x15')]=qs[_0x197a('0x15')](_0x23d884[_0x197a('0x22')]['limit']||0xa);_0x112327['offset']=qs['offset'](_0x23d884[_0x197a('0x22')]['offset']);}var _0x1c83ab=_0x22742a['map'](function(_0x359cdb){if(_0x359cdb===_0x197a('0xc5')){var _0x291844={'attributes':['id','uniqueid',_0x197a('0xce'),'source','destination',_0x197a('0xcf'),_0x197a('0xd0'),_0x197a('0xd1'),_0x197a('0xd2'),_0x197a('0xd3'),'createdAt',_0x197a('0xd4'),'userSecondDisposition','userThirdDisposition',_0x197a('0xd5')],'where':{'ContactId':_0x23d884[_0x197a('0x60')]['id']},'include':[{'model':db['User'],'as':'User','attributes':['id',_0x197a('0x1e'),'fullname',_0x197a('0x2e')]}],'order':[[_0x197a('0xd6'),_0x197a('0xd7')]]};if(_0x23d884[_0x197a('0x22')]['range']){_0x291844['where'][_0x197a('0xd6')]={'$gte':_0x5c05bd[_0x197a('0x36')],'$lte':_0x5c05bd['to']};}return db['VoiceCallReport'][_0x197a('0xd8')](_0x291844)[_0x197a('0x18')](function(_0x55b0e6){_0x492afc[_0x197a('0x14')]+=_0x55b0e6[_0x197a('0x14')];return _['map'](_0x55b0e6[_0x197a('0x94')],function(_0x61541e){var _0x2bb1de=_0x61541e['get']({'plain':!![]});_0x2bb1de[_0x197a('0xc6')]=_0x359cdb;if(_0x2bb1de[_0x197a('0xb5')]){_0x2bb1de[_0x197a('0xb5')]={'id':_0x2bb1de[_0x197a('0xb5')]['id'],'name':_0x2bb1de[_0x197a('0xb5')][_0x197a('0x1e')],'fullname':_0x2bb1de[_0x197a('0xb5')][_0x197a('0xd9')],'alias':_0x2bb1de[_0x197a('0xb5')][_0x197a('0x2e')]};}return _0x2bb1de;});});}else{var _0x27a79c=_[_0x197a('0xda')](_0x359cdb)+(_0x359cdb===_0x197a('0xc1')?'Website':'Account');var _0x31fca9={'attributes':['id','closed',_0x197a('0xdb'),'createdAt',_0x197a('0xd3'),_0x197a('0xdc'),_0x197a('0xdd'),_0x197a('0xde'),_0x197a('0xd5'),_0x27a79c+'Id'],'where':{'ContactId':_0x23d884[_0x197a('0x60')]['id']},'include':[{'model':db[_0x27a79c],'as':'Account','attributes':['id','name',_0x197a('0xdf')]},{'model':db[_0x197a('0xb5')],'as':_0x197a('0xe0'),'attributes':['id',_0x197a('0x1e'),'fullname']},{'model':db[_0x197a('0xe1')],'as':_0x197a('0x61'),'attributes':['id',_0x197a('0x1e'),_0x197a('0xe2')],'through':{'attributes':[]}}],'order':[[_0x197a('0xd6'),'DESC']]};if(_0x23d884['query'][_0x197a('0xca')]){_0x31fca9[_0x197a('0x59')][_0x197a('0xd6')]={'$gte':_0x5c05bd['from'],'$lte':_0x5c05bd['to']};}switch(_0x359cdb){case'chat':_0x31fca9[_0x197a('0x7a')][_0x197a('0x5b')](_0x197a('0xe3'),_0x197a('0xe4'),_0x197a('0xe5'),_0x197a('0xe6'),_0x197a('0xe7'),'ratingMessage',_0x197a('0xe8'),_0x197a('0xe9'),'referer');break;case _0x197a('0xea'):_0x31fca9[_0x197a('0x7a')][_0x197a('0x5b')](_0x197a('0xeb'),_0x197a('0xec'));break;case _0x197a('0xc3'):_0x31fca9['attributes'][_0x197a('0x5b')]('externalUrl',_0x197a('0xed'));break;}return db[_['startCase'](_0x359cdb)+_0x197a('0xee')][_0x197a('0xd8')](_0x31fca9)['then'](function(_0x47abf9){_0x492afc[_0x197a('0x14')]+=_0x47abf9[_0x197a('0x14')];return _[_0x197a('0x6c')](_0x47abf9[_0x197a('0x94')],function(_0x13e4b4){var _0x39b5a6=_0x13e4b4['get']({'plain':!![]});_0x39b5a6[_0x197a('0xc6')]=_0x359cdb;if(_0x39b5a6['Owner']){_0x39b5a6[_0x197a('0xe0')]={'id':_0x39b5a6['Owner']['id'],'name':_0x39b5a6[_0x197a('0xe0')][_0x197a('0x1e')],'fullname':_0x39b5a6[_0x197a('0xe0')]['fullname']};}return _0x39b5a6;});});}});return Promise[_0x197a('0x5e')](_0x1c83ab);})[_0x197a('0x18')](function(_0x5af589){return _(_0x5af589)[_0x197a('0xef')]()[_0x197a('0xf0')](_0x197a('0xd6'))[_0x197a('0xf1')]()[_0x197a('0xf2')]();})[_0x197a('0x18')](function(_0x451b6a){_0x492afc['rows']=_0x112327['limit']?_0x451b6a[_0x197a('0xf3')](_0x112327[_0x197a('0x12')],_0x112327[_0x197a('0x12')]+_0x112327[_0x197a('0x15')]):_0x451b6a;return _0x492afc;})[_0x197a('0x18')](respondWithFilteredResult(_0xad64aa,_0x112327))['catch'](handleError(_0xad64aa,null));}; \ No newline at end of file +var _0x2b95=['start\x20child\x20process\x20correctly!','exit','pid','importUpdates','getJourney','mail','chat','sms','whatsapp','channel','includes','toLowerCase','Invalid\x20channel','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','voice','uniqueid','type','source','destination','callerid','starttime','endtime','duration','note','userDisposition','userSecondDisposition','userThirdDisposition','UserId','createdAt','DESC','findAndCountAll','startCase','Website','closedAt','disposition','secondDisposition','thirdDisposition','Account','Owner','fullname','browserName','customerIp','customerPort','deviceModel','ratingMessage','ratingType','ratingValue','referer','subject','openchannel','externalUrl','threadId','Interaction','flatten','sortBy','reverse','value','moment','bluebird','util','path','squel','../../components/contacts','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmContact.socket','json','offset','undefined','count','limit','status','Content-Range','update','destroy','sendStatus','error','name','index','then','findAll','catch','find','params','CmContact','describe','tags','keys','startsWith','cf_','columnName','displayName','query','analytics','CmCustomField','length','alias','custom','values','info','hasOwnProperty','merge','body','from','get','mergeWith','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','ChatInteraction','ChatMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxMessage','OpenchannelInteraction','CmHopperFinal','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappMessage','create','join','isNil','dialTimezone','timezones','utcOffset','additionalPhones','bulkCreate','duplicates','$or','where','ListId','findOrCreate','spread','push','contact','all','show','Tags','color','tag','Phones','ItemType','sequelize','literal','Phones.OrderBy','$and','omit','format','cf_%d','pickBy','isEmpty','table','cm_contacts','setFields','id\x20=\x20?','text','phone','findOne','model','Tag','rawAttributes','filters','intersection','attributes','fields','sort','filter','map','getTags','setTags','setAdditionalPhones','CmContactHasItem','ContactItemType','items','item_types','ItemTypeId','description','OrderBy','contact\x20phone\x20exists','CmHopperAdditionalPhone','item','`ItemType`.OrderBy','getAdditionalPhones','PHONE','duplicateAdditionalPhones','fromContactId','CmContactId','rescheduleAdditionalPhones','hopperId','getHoppers','nolimit','order','pick','include','rows','getHopperHistories','ContactId','getHopperFinals','includeAll','getJscriptySessions','options','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','binding_values','split','zipObject','No\x20phone\x20column\x20specified','root','server/files/tmp','file','filename','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','send','createReadStream','parse','User','agent','binding','firstName','No\x20firstName\x20column\x20specified','stringify','message'];(function(_0x4a8a5d,_0x389853){var _0x2876b0=function(_0xd32d0d){while(--_0xd32d0d){_0x4a8a5d['push'](_0x4a8a5d['shift']());}};_0x2876b0(++_0x389853);}(_0x2b95,0x139));var _0x52b9=function(_0x2351c4,_0x1dca54){_0x2351c4=_0x2351c4-0x0;var _0x1dd3f8=_0x2b95[_0x2351c4];return _0x1dd3f8;};'use strict';var moment=require(_0x52b9('0x0'));var BPromise=require(_0x52b9('0x1'));var util=require(_0x52b9('0x2'));var path=require(_0x52b9('0x3'));var fs=require('fs');var _=require('lodash');var squel=require(_0x52b9('0x4'));var Papa=require('papaparse');var Redis=require('ioredis');var contacts=require(_0x52b9('0x5'));var qs=require(_0x52b9('0x6'));var logger=require(_0x52b9('0x7'))('api');var config=require(_0x52b9('0x8'));var shared=require('../../config/environment/shared');var db=require(_0x52b9('0x9'))['db'];config[_0x52b9('0xa')]=_[_0x52b9('0xb')](config[_0x52b9('0xa')],{'host':_0x52b9('0xc'),'port':0x18eb});var socket=require(_0x52b9('0xd'))(new Redis(config['redis']));require(_0x52b9('0xe'))['register'](socket);function respondWithResult(_0x27317a,_0x4495b0){_0x4495b0=_0x4495b0||0xc8;return function(_0xd5edf0){if(_0xd5edf0){return _0x27317a['status'](_0x4495b0)[_0x52b9('0xf')](_0xd5edf0);}};}function respondWithFilteredResult(_0x4a5c56,_0x1afbbd){return function(_0x1927f7){if(_0x1927f7){var _0x485e51=typeof _0x1afbbd[_0x52b9('0x10')]===_0x52b9('0x11')&&typeof _0x1afbbd['limit']===_0x52b9('0x11');var _0x18cf75=_0x1927f7[_0x52b9('0x12')];var _0x235f09=_0x485e51?0x0:_0x1afbbd[_0x52b9('0x10')];var _0x3f3b4d=_0x485e51?_0x1927f7[_0x52b9('0x12')]:_0x1afbbd[_0x52b9('0x10')]+_0x1afbbd[_0x52b9('0x13')];var _0x3d8c13;if(_0x3f3b4d>=_0x18cf75){_0x3f3b4d=_0x18cf75;_0x3d8c13=0xc8;}else{_0x3d8c13=0xce;}_0x4a5c56[_0x52b9('0x14')](_0x3d8c13);return _0x4a5c56['set'](_0x52b9('0x15'),_0x235f09+'-'+_0x3f3b4d+'/'+_0x18cf75)[_0x52b9('0xf')](_0x1927f7);}return null;};}function saveUpdates(_0x17776b){return function(_0x3722e6){if(_0x3722e6){return _0x3722e6[_0x52b9('0x16')](_0x17776b)['then'](function(_0x4fca9d){return _0x4fca9d;});}return null;};}function removeEntity(_0x7c7ebc){return function(_0x6d1f98){if(_0x6d1f98){return _0x6d1f98[_0x52b9('0x17')]()['then'](function(){_0x7c7ebc['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3da9bf){return function(_0x12663c){if(!_0x12663c){_0x3da9bf[_0x52b9('0x18')](0x194);}return _0x12663c;};}function handleError(_0x1633d2,_0x3415f5){_0x3415f5=_0x3415f5||0x1f4;return function(_0x20ad31){logger[_0x52b9('0x19')](_0x20ad31['stack']);if(_0x20ad31[_0x52b9('0x1a')]){delete _0x20ad31[_0x52b9('0x1a')];}_0x1633d2[_0x52b9('0x14')](_0x3415f5)['send'](_0x20ad31);};}exports[_0x52b9('0x1b')]=function(_0x324839,_0x5ad946){var _0x31f28c={};return contacts['describe']()[_0x52b9('0x1c')](function(_0x2c5b13){_0x31f28c=qs['getOptions'](_0x2c5b13,_0x324839);return contacts[_0x52b9('0x1d')](_0x324839['query'],_0x324839['user'],_0x31f28c,_0x2c5b13);})[_0x52b9('0x1c')](respondWithFilteredResult(_0x5ad946,_0x31f28c))[_0x52b9('0x1e')](handleError(_0x5ad946,null));};exports[_0x52b9('0x17')]=function(_0x105c82,_0x32f224){return db['CmContact'][_0x52b9('0x1f')]({'where':{'id':_0x105c82[_0x52b9('0x20')]['id']}})[_0x52b9('0x1c')](handleEntityNotFound(_0x32f224,null))['then'](removeEntity(_0x32f224,null))[_0x52b9('0x1e')](handleError(_0x32f224,null));};exports['describe']=function(_0x2c465e,_0x12f26b){return db[_0x52b9('0x21')][_0x52b9('0x22')]()[_0x52b9('0x1c')](function(_0x121bf1){delete _0x121bf1[_0x52b9('0x23')];for(var _0x42bd5f=0x0;_0x42bd5f0x0){return new Promise(function(_0x57cb88){var _0x5b2c24=[];for(var _0x365bf0=0x0;_0x365bf0<_0x4800f9[_0x52b9('0x2c')];_0x365bf0++){_0x5b2c24['push'](insertAdditionalPhones(_0x4800f9[_0x365bf0][_0x52b9('0x5c')],_0x4800f9[_0x365bf0]['additionalPhones']));}Promise[_0x52b9('0x5d')](_0x5b2c24)[_0x52b9('0x1c')](function(){_0x57cb88(0x1);});})[_0x52b9('0x1c')](function(){return{'success':_0xc91efa,'failure':_0x23f46d,'duplicates':_0x523b09};});}else{return{'success':_0xc91efa,'failure':_0x23f46d,'duplicates':_0x523b09};}}})[_0x52b9('0x1c')](respondWithResult(_0x4e339d,0xc9))[_0x52b9('0x1e')](handleError(_0x4e339d,null));};exports[_0x52b9('0x5e')]=function(_0x1b0275,_0x556691){var _0x1656b0;return db['CmContact']['describe']()['then'](function(_0x26f9f3){return db[_0x52b9('0x21')][_0x52b9('0x1f')]({'where':{'id':_0x1b0275['params']['id']},'include':[{'model':db['Tag'],'as':_0x52b9('0x5f'),'attributes':['id',_0x52b9('0x1a'),_0x52b9('0x60')],'required':_0x1b0275[_0x52b9('0x29')][_0x52b9('0x61')]?!![]:![]},{'model':db['CmContactHasItem'],'as':_0x52b9('0x62'),'where':{'CmContactId':_0x1b0275['params']['id']},'required':![],'include':[{'model':db['ContactItemType'],'as':_0x52b9('0x63')}]}],'order':[db[_0x52b9('0x64')][_0x52b9('0x65')](_0x52b9('0x66'))],'attributes':_[_0x52b9('0x24')](_0x26f9f3)});})[_0x52b9('0x1c')](function(_0x476022){if(!_[_0x52b9('0x4f')](_0x476022)){_0x1656b0=_0x476022[_0x52b9('0x35')]({'plain':!![]});var _0x4c27a0={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x476022&&_0x476022['ListId']){if(_0x476022[_0x52b9('0x58')]){_0x4c27a0[_0x52b9('0x57')][_0x52b9('0x67')][_0x52b9('0x5b')]({'ListId':{'$ne':_0x476022[_0x52b9('0x58')]}});}}return db[_0x52b9('0x2b')][_0x52b9('0x1d')](_0x4c27a0);}})[_0x52b9('0x1c')](function(_0x54b4db){if(!_[_0x52b9('0x4f')](_0x54b4db)){return _[_0x52b9('0x68')](_0x1656b0,_['map'](_0x54b4db,function(_0x221762){return util[_0x52b9('0x69')](_0x52b9('0x6a'),_0x221762['id']);}));}})[_0x52b9('0x1c')](handleEntityNotFound(_0x556691,null))[_0x52b9('0x1c')](respondWithResult(_0x556691,null))[_0x52b9('0x1e')](handleError(_0x556691,null));};exports[_0x52b9('0x16')]=function(_0x51b10a,_0x3c00ef){var _0x46158f;if(_0x51b10a['body']['id']){delete _0x51b10a[_0x52b9('0x33')]['id'];}if(!_[_0x52b9('0x4f')](_0x51b10a['body'][_0x52b9('0x50')])){var _0x29c1d9=_0x51b10a['body'][_0x52b9('0x50')];if(!_[_0x52b9('0x4f')](shared[_0x52b9('0x51')][_0x29c1d9]))_0x51b10a[_0x52b9('0x33')][_0x52b9('0x52')]=shared[_0x52b9('0x51')][_0x29c1d9]['utcOffset'];}return db[_0x52b9('0x21')][_0x52b9('0x1f')]({'where':{'id':_0x51b10a[_0x52b9('0x20')]['id']}})[_0x52b9('0x1c')](handleEntityNotFound(_0x3c00ef,null))[_0x52b9('0x1c')](saveUpdates(_0x51b10a[_0x52b9('0x33')],null))[_0x52b9('0x1c')](function(_0x2f21ef){_0x46158f=_0x2f21ef;var _0xb4afd={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x2f21ef&&_0x2f21ef[_0x52b9('0x58')]){if(_0x2f21ef[_0x52b9('0x58')]){_0xb4afd['where']['$and'][_0x52b9('0x5b')]({'ListId':{'$ne':_0x2f21ef[_0x52b9('0x58')]}});}}return db[_0x52b9('0x2b')][_0x52b9('0x1d')](_0xb4afd);})[_0x52b9('0x1c')](function(_0x3206b1){if(_0x3206b1){return _[_0x52b9('0x68')](_[_0x52b9('0x6b')](_0x51b10a[_0x52b9('0x33')],function(_0x217f53,_0x58da2f){return _[_0x52b9('0x25')](_0x58da2f,_0x52b9('0x26'));}),_['map'](_0x3206b1,function(_0x3a1728){return util[_0x52b9('0x69')](_0x52b9('0x6a'),_0x3a1728['id']);}));}})[_0x52b9('0x1c')](function(_0xafb174){if(_0xafb174&&!_[_0x52b9('0x6c')](_0xafb174)){var _0x2fac8c=squel[_0x52b9('0x16')]()[_0x52b9('0x6d')](_0x52b9('0x6e'))[_0x52b9('0x6f')](_0xafb174)[_0x52b9('0x57')](_0x52b9('0x70'),_0x51b10a[_0x52b9('0x20')]['id'])['toParam']();return db[_0x52b9('0x64')][_0x52b9('0x29')](_0x2fac8c[_0x52b9('0x71')],{'replacements':_0x2fac8c['values']});}})[_0x52b9('0x1c')](function(){if(_0x51b10a[_0x52b9('0x33')][_0x52b9('0x72')]&&_0x46158f){return db['CmHopper']['update']({'phone':_0x51b10a[_0x52b9('0x33')][_0x52b9('0x72')],'OrderBy':0x0},{'where':{'ContactId':_0x46158f['id']}});}})[_0x52b9('0x1c')](function(){return _0x46158f;})[_0x52b9('0x1c')](respondWithResult(_0x3c00ef,null))[_0x52b9('0x1e')](handleError(_0x3c00ef,null));};exports['getTags']=function(_0x19dfbb,_0x3a33af){var _0x40148e={};var _0xcedc83={};var _0x5510dd;var _0x37038f;return db['CmContact'][_0x52b9('0x73')]({'where':{'id':_0x19dfbb['params']['id']}})[_0x52b9('0x1c')](handleEntityNotFound(_0x3a33af,null))[_0x52b9('0x1c')](function(_0x2ac7b5){if(_0x2ac7b5){_0x5510dd=_0x2ac7b5;_0xcedc83[_0x52b9('0x74')]=_[_0x52b9('0x24')](db[_0x52b9('0x75')][_0x52b9('0x76')]);_0xcedc83[_0x52b9('0x29')]=_[_0x52b9('0x24')](_0x19dfbb[_0x52b9('0x29')]);_0xcedc83[_0x52b9('0x77')]=_[_0x52b9('0x78')](_0xcedc83[_0x52b9('0x74')],_0xcedc83[_0x52b9('0x29')]);_0x40148e[_0x52b9('0x79')]=_['intersection'](_0xcedc83[_0x52b9('0x74')],qs[_0x52b9('0x7a')](_0x19dfbb[_0x52b9('0x29')][_0x52b9('0x7a')]));_0x40148e['attributes']=_0x40148e[_0x52b9('0x79')][_0x52b9('0x2c')]?_0x40148e[_0x52b9('0x79')]:_0xcedc83[_0x52b9('0x74')];_0x40148e['order']=qs['sort'](_0x19dfbb[_0x52b9('0x29')][_0x52b9('0x7b')]);_0x40148e[_0x52b9('0x57')]=qs[_0x52b9('0x77')](_['pick'](_0x19dfbb[_0x52b9('0x29')],_0xcedc83[_0x52b9('0x77')]));if(_0x19dfbb[_0x52b9('0x29')][_0x52b9('0x7c')]){_0x40148e[_0x52b9('0x57')]=_[_0x52b9('0x32')](_0x40148e[_0x52b9('0x57')],{'$or':_[_0x52b9('0x7d')](_0x40148e[_0x52b9('0x79')],function(_0x4457f){var _0x244b8c={};_0x244b8c[_0x4457f]={'$like':'%'+_0x19dfbb[_0x52b9('0x29')][_0x52b9('0x7c')]+'%'};return _0x244b8c;})});}_0x40148e=_[_0x52b9('0x32')]({},_0x40148e,_0x19dfbb['options']);return _0x5510dd[_0x52b9('0x7e')](_0x40148e);}})[_0x52b9('0x1c')](function(_0xe14550){if(_0xe14550){_0x37038f=_0xe14550[_0x52b9('0x2c')];if(!_0x19dfbb[_0x52b9('0x29')][_0x52b9('0x31')]('nolimit')){_0x40148e[_0x52b9('0x13')]=qs[_0x52b9('0x13')](_0x19dfbb[_0x52b9('0x29')]['limit']);_0x40148e[_0x52b9('0x10')]=qs[_0x52b9('0x10')](_0x19dfbb[_0x52b9('0x29')][_0x52b9('0x10')]);}return _0x5510dd['getTags'](_0x40148e);}})[_0x52b9('0x1c')](function(_0x1c5e4a){if(_0x1c5e4a){return _0x1c5e4a?{'count':_0x37038f,'rows':_0x1c5e4a}:null;}})[_0x52b9('0x1c')](respondWithResult(_0x3a33af,null))[_0x52b9('0x1e')](handleError(_0x3a33af,null));};exports[_0x52b9('0x7f')]=function(_0x12f974,_0x38c126){if(_0x12f974['body']['id']){delete _0x12f974['body']['id'];}return db[_0x52b9('0x21')]['findOne']({'where':{'id':_0x12f974[_0x52b9('0x20')]['id']}})[_0x52b9('0x1c')](handleEntityNotFound(_0x38c126,null))[_0x52b9('0x1c')](function(_0x3ed24f){if(_0x3ed24f){return _0x3ed24f[_0x52b9('0x7f')](_0x12f974[_0x52b9('0x33')]['ids']||[]);}return null;})['then'](respondWithResult(_0x38c126,null))['catch'](handleError(_0x38c126,null));};exports[_0x52b9('0x80')]=function(_0xffb71f,_0xf5ffca){var _0x3adeb3=[];_0x3adeb3[_0x52b9('0x5b')](addAdditionalPhones(_0xffb71f['body']));Promise[_0x52b9('0x5d')](_0x3adeb3)[_0x52b9('0x1c')](function(){_0x3adeb3=[];_0x3adeb3[_0x52b9('0x5b')](deleteCmHopperPhones(_0xffb71f[_0x52b9('0x33')]['id']));_0x3adeb3[_0x52b9('0x5b')](addCmHopperPhones(_0xffb71f[_0x52b9('0x33')]['id']));Promise['all'](_0x3adeb3)[_0x52b9('0x1c')](function(){return[0x1];})[_0x52b9('0x1c')](respondWithResult(_0xf5ffca,null));});};function addAdditionalPhones(_0x24634a){var _0x5117ee;return new Promise(function(_0x15aecd){return db[_0x52b9('0x81')][_0x52b9('0x17')]({'where':{'CmContactId':_0x24634a['id']}})[_0x52b9('0x1c')](function(){db[_0x52b9('0x82')][_0x52b9('0x1d')]({'raw':!![],'attributes':['id','OrderBy']})[_0x52b9('0x1c')](function(_0x22375c){var _0x46514e=[];for(var _0x592bd6=0x0;_0x592bd6<_0x24634a[_0x52b9('0x83')][_0x52b9('0x2c')];_0x592bd6++){var _0x51e824=_0x24634a[_0x52b9('0x84')]?_[_0x52b9('0x4f')](_0x24634a['item_types'][_0x592bd6])?'':_0x24634a['item_types'][_0x592bd6]:_0x24634a['items'][_0x592bd6][_0x52b9('0x85')]?_0x24634a[_0x52b9('0x83')][_0x592bd6][_0x52b9('0x85')]:'';var _0x1a8976=_['isNil'](_0x24634a[_0x52b9('0x83')][_0x592bd6][_0x52b9('0x86')])?'':_0x24634a[_0x52b9('0x83')][_0x592bd6][_0x52b9('0x86')];var _0x492c84=_0x51e824+':'+_0x24634a[_0x52b9('0x83')][_0x592bd6][_0x52b9('0x72')]+'§'+_0x1a8976;if(_['isNil'](_0x5117ee))_0x5117ee=_0x492c84;else _0x5117ee+=';'+_0x492c84;var _0x3560cc=null;var _0x2e52ec=null;if(_0x24634a['item_types']){if(!_[_0x52b9('0x4f')](_0x24634a[_0x52b9('0x84')][_0x592bd6])){_0x2e52ec=_[_0x52b9('0x1f')](_0x22375c,function(_0x5eb74b){return _0x5eb74b['id']===_0x24634a['item_types'][_0x592bd6];});if(!_[_0x52b9('0x4f')](_0x2e52ec)){_0x3560cc=_0x2e52ec[_0x52b9('0x87')];}}}else{if(!_['isNil'](_0x24634a['items'][_0x592bd6])){_0x2e52ec=_[_0x52b9('0x1f')](_0x22375c,function(_0x295499){return _0x295499['id']===_0x24634a[_0x52b9('0x83')][_0x592bd6][_0x52b9('0x85')];});if(!_['isNil'](_0x2e52ec)){_0x3560cc=_0x592bd6;}}}if(_[_0x52b9('0x4f')](_0x3560cc)){_0x3560cc=0x64;}_0x46514e['push'](addAdditionalPhone(_0x24634a['id'],_0x24634a[_0x52b9('0x83')][_0x592bd6][_0x52b9('0x72')],_0x24634a[_0x52b9('0x84')]?_[_0x52b9('0x4f')](_0x24634a[_0x52b9('0x84')][_0x592bd6])?null:_0x24634a[_0x52b9('0x84')][_0x592bd6]:_0x24634a[_0x52b9('0x83')][_0x592bd6][_0x52b9('0x85')]?_0x24634a['items'][_0x592bd6][_0x52b9('0x85')]:null,_0x3560cc,_0x1a8976));}Promise[_0x52b9('0x5d')](_0x46514e)[_0x52b9('0x1c')](function(){db[_0x52b9('0x21')][_0x52b9('0x16')]({'AdditionalPhones':_0x5117ee},{'where':{'id':_0x24634a['id']}})[_0x52b9('0x1c')](function(){_0x15aecd(0x1);});});});});});}function addAdditionalPhone(_0x29c08b,_0x204181,_0x245716,_0x11dc97,_0x30cb19){return db['CmContactHasItem'][_0x52b9('0x1f')]({'where':{'CmContactId':_0x29c08b,'item':_0x204181}})[_0x52b9('0x1c')](function(_0x52ffe7){if(_0x52ffe7)logger[_0x52b9('0x30')](_0x52b9('0x88'),_0x52ffe7);else{db['CmContactHasItem'][_0x52b9('0x4d')]({'CmContactId':_0x29c08b,'item':_0x204181,'ItemTypeId':_0x245716,'OrderBy':_0x11dc97,'ItemClass':'PHONE','description':_0x30cb19});}});}function deleteCmHopperPhones(_0x1daeba){return new Promise(function(_0x40be8b){return db['CmHopper'][_0x52b9('0x1d')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1daeba}})[_0x52b9('0x1c')](function(_0x344200){db[_0x52b9('0x89')][_0x52b9('0x17')]({'where':{'CmHopperId':{'$in':_[_0x52b9('0x7d')](_0x344200,'id')}}});})[_0x52b9('0x1c')](function(){_0x40be8b(0x1);});});}function addCmHopperPhones(_0x55df27){return new Promise(function(_0x1751c4){return db[_0x52b9('0x38')][_0x52b9('0x1d')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x55df27}})['then'](function(_0x292339){var _0x3bded6=[];_[_0x52b9('0x7d')](_0x292339,function(_0x10a578){_0x3bded6[_0x52b9('0x5b')](createCmHopperPhone(_0x55df27,_0x10a578['id']));});Promise['all'](_0x3bded6)[_0x52b9('0x1c')](function(){_0x1751c4(0x1);});});});}function createCmHopperPhone(_0x478253,_0x48f67e){return new Promise(function(_0x4780a){db[_0x52b9('0x81')][_0x52b9('0x1d')]({'raw':!![],'attributes':[_0x52b9('0x8a'),_0x52b9('0x87')],'where':{'CmContactId':_0x478253,'ItemClass':'PHONE'},'include':[{'model':db[_0x52b9('0x82')],'attributes':[_0x52b9('0x87')],'as':_0x52b9('0x63')}],'order':[_0x52b9('0x87'),db[_0x52b9('0x64')]['literal'](_0x52b9('0x8b'))]})['then'](function(_0x48d937){var _0x124f74=0x1;var _0x449439=_[_0x52b9('0x7d')](_0x48d937,function(_0x272154){_0x272154['CmHopperId']=_0x48f67e;_0x272154[_0x52b9('0x72')]=_0x272154[_0x52b9('0x8a')];_0x272154[_0x52b9('0x87')]=_0x124f74;delete _0x272154['ItemType.OrderBy'];_0x124f74=_0x124f74+0x1;return _0x272154;});return db['CmHopperAdditionalPhone'][_0x52b9('0x54')](_0x449439,{});})[_0x52b9('0x1c')](function(){_0x4780a(0x1);});});}function insertAdditionalPhones(_0x337771,_0x448665){return new Promise(function(_0x3c3c93){var _0x2b642e=[];for(var _0x3f9228=0x0;_0x3f9228<_0x448665[_0x52b9('0x2c')];_0x3f9228++){var _0x423968=_0x448665[_0x3f9228];_0x2b642e[_0x52b9('0x5b')](parseContactItemType(_0x423968));}Promise[_0x52b9('0x5d')](_0x2b642e)['then'](function(){var _0x5ac216={'id':_0x337771['id'],'items':_0x448665};return addAdditionalPhones(_0x5ac216)[_0x52b9('0x1c')](function(){return addCmHopperPhones(_0x337771['id']);});})[_0x52b9('0x1c')](function(){_0x3c3c93(_0x337771);});});}function parseContactItemType(_0x533518){return new Promise(function(_0x530c9e){if(_0x533518[_0x52b9('0x31')](_0x52b9('0x85'))){_0x530c9e(_0x533518);}else{return db[_0x52b9('0x82')][_0x52b9('0x1f')]({'where':{'name':_0x533518[_0x52b9('0x63')]}})[_0x52b9('0x1c')](function(_0x414cd3){if(_[_0x52b9('0x4f')](_0x414cd3))_0x533518[_0x52b9('0x85')]=null;else _0x533518['ItemTypeId']=_0x414cd3['id'];_0x530c9e(_0x533518);});}});}exports[_0x52b9('0x8c')]=function(_0x1dcc88,_0x2367ab){return db[_0x52b9('0x81')][_0x52b9('0x1d')]({'raw':!![],'where':{'CmContactId':_0x1dcc88[_0x52b9('0x20')]['id'],'ItemClass':_0x52b9('0x8d')},'include':[{'model':db[_0x52b9('0x82')],'as':_0x52b9('0x63')}],'order':[[_0x52b9('0x87')],[db[_0x52b9('0x64')][_0x52b9('0x65')](_0x52b9('0x8b'))]]})[_0x52b9('0x1c')](function(_0x20c83d){return _0x20c83d;})[_0x52b9('0x1c')](respondWithResult(_0x2367ab,null))['catch'](handleError(_0x2367ab,null));};exports[_0x52b9('0x8e')]=function(_0x173b3a,_0x216062){return db['CmContactHasItem'][_0x52b9('0x1d')]({'raw':!![],'where':{'CmContactId':_0x173b3a[_0x52b9('0x33')][_0x52b9('0x8f')]}})[_0x52b9('0x1c')](function(_0x201aa9){var _0x506e1d=_[_0x52b9('0x7d')](_0x201aa9,function(_0x30195a){_0x30195a[_0x52b9('0x90')]=_0x173b3a[_0x52b9('0x33')]['toContactId'];return _0x30195a;});return db[_0x52b9('0x81')][_0x52b9('0x54')](_0x506e1d,{});})['then'](function(){return addCmHopperPhones(_0x173b3a[_0x52b9('0x33')]['toContactId']);})[_0x52b9('0x1c')](function(){return['ok'];})[_0x52b9('0x1c')](respondWithResult(_0x216062,null))[_0x52b9('0x1e')](handleError(_0x216062,null));};exports[_0x52b9('0x91')]=function(_0x21b4a5,_0x241186){var _0x599ffe=[];_0x599ffe[_0x52b9('0x5b')](createCmHopperPhone(_0x21b4a5['body']['id'],_0x21b4a5[_0x52b9('0x33')][_0x52b9('0x92')]));Promise[_0x52b9('0x5d')](_0x599ffe)[_0x52b9('0x1c')](function(){return[0x1];})[_0x52b9('0x1c')](respondWithResult(_0x241186,null));};exports[_0x52b9('0x93')]=function(_0x927662,_0x409a70){var _0x5d5ca6={'raw':![],'where':{}};var _0x139771={};var _0x30a474={'count':0x0,'rows':[]};return db[_0x52b9('0x21')]['findOne']({'where':{'id':_0x927662[_0x52b9('0x20')]['id']}})[_0x52b9('0x1c')](handleEntityNotFound(_0x409a70,null))[_0x52b9('0x1c')](function(_0xe1c1cf){if(_0xe1c1cf){_0x139771[_0x52b9('0x74')]=_[_0x52b9('0x24')](db[_0x52b9('0x38')][_0x52b9('0x76')]);_0x139771[_0x52b9('0x29')]=_[_0x52b9('0x24')](_0x927662[_0x52b9('0x29')]);_0x139771[_0x52b9('0x77')]=_['intersection'](_0x139771['model'],_0x139771[_0x52b9('0x29')]);_0x5d5ca6[_0x52b9('0x79')]=_[_0x52b9('0x78')](_0x139771['model'],qs[_0x52b9('0x7a')](_0x927662[_0x52b9('0x29')][_0x52b9('0x7a')]));_0x5d5ca6['attributes']=_0x5d5ca6[_0x52b9('0x79')]['length']?_0x5d5ca6[_0x52b9('0x79')]:_0x139771[_0x52b9('0x74')];if(!_0x927662[_0x52b9('0x29')][_0x52b9('0x31')](_0x52b9('0x94'))){_0x5d5ca6[_0x52b9('0x13')]=qs['limit'](_0x927662[_0x52b9('0x29')][_0x52b9('0x13')]);_0x5d5ca6[_0x52b9('0x10')]=qs[_0x52b9('0x10')](_0x927662['query'][_0x52b9('0x10')]);}_0x5d5ca6[_0x52b9('0x95')]=qs[_0x52b9('0x7b')](_0x927662[_0x52b9('0x29')][_0x52b9('0x7b')]);_0x5d5ca6[_0x52b9('0x57')]=qs[_0x52b9('0x77')](_[_0x52b9('0x96')](_0x927662[_0x52b9('0x29')],_0x139771[_0x52b9('0x77')]));_0x5d5ca6[_0x52b9('0x57')]['ContactId']=_0xe1c1cf['id'];if(_0x927662['query'][_0x52b9('0x7c')]){_0x5d5ca6[_0x52b9('0x57')]=_[_0x52b9('0x32')](_0x5d5ca6['where'],{'$or':_[_0x52b9('0x7d')](_0x5d5ca6[_0x52b9('0x79')],function(_0x570b03){var _0x302418={};_0x302418[_0x570b03]={'$like':'%'+_0x927662[_0x52b9('0x29')][_0x52b9('0x7c')]+'%'};return _0x302418;})});}_0x5d5ca6=_[_0x52b9('0x32')]({},_0x5d5ca6,_0x927662['options']);return db[_0x52b9('0x38')][_0x52b9('0x12')]({'where':_0x5d5ca6[_0x52b9('0x57')]})[_0x52b9('0x1c')](function(_0x6c5b7f){_0x30a474[_0x52b9('0x12')]=_0x6c5b7f;if(_0x927662[_0x52b9('0x29')]['includeAll']){_0x5d5ca6[_0x52b9('0x97')]=[{'all':!![]}];}return db[_0x52b9('0x38')][_0x52b9('0x1d')](_0x5d5ca6);})[_0x52b9('0x1c')](function(_0x280dbd){_0x30a474[_0x52b9('0x98')]=_0x280dbd;return _0x30a474;});}})['then'](respondWithFilteredResult(_0x409a70,_0x5d5ca6))[_0x52b9('0x1e')](handleError(_0x409a70,null));};exports[_0x52b9('0x99')]=function(_0x56744e,_0x2d71da){var _0x1e70bb={'raw':!![],'where':{}};var _0x2a2ddc={};var _0x444efc={'count':0x0,'rows':[]};return db[_0x52b9('0x21')][_0x52b9('0x73')]({'where':{'id':_0x56744e[_0x52b9('0x20')]['id']}})[_0x52b9('0x1c')](handleEntityNotFound(_0x2d71da,null))['then'](function(_0x4bc556){if(_0x4bc556){_0x2a2ddc[_0x52b9('0x74')]=_[_0x52b9('0x24')](db[_0x52b9('0x44')]['rawAttributes']);_0x2a2ddc[_0x52b9('0x29')]=_[_0x52b9('0x24')](_0x56744e['query']);_0x2a2ddc[_0x52b9('0x77')]=_[_0x52b9('0x78')](_0x2a2ddc[_0x52b9('0x74')],_0x2a2ddc[_0x52b9('0x29')]);_0x1e70bb['attributes']=_[_0x52b9('0x78')](_0x2a2ddc['model'],qs[_0x52b9('0x7a')](_0x56744e['query']['fields']));_0x1e70bb[_0x52b9('0x79')]=_0x1e70bb[_0x52b9('0x79')][_0x52b9('0x2c')]?_0x1e70bb[_0x52b9('0x79')]:_0x2a2ddc[_0x52b9('0x74')];if(!_0x56744e[_0x52b9('0x29')][_0x52b9('0x31')]('nolimit')){_0x1e70bb[_0x52b9('0x13')]=qs[_0x52b9('0x13')](_0x56744e[_0x52b9('0x29')][_0x52b9('0x13')]);_0x1e70bb[_0x52b9('0x10')]=qs[_0x52b9('0x10')](_0x56744e['query'][_0x52b9('0x10')]);}_0x1e70bb[_0x52b9('0x95')]=qs[_0x52b9('0x7b')](_0x56744e[_0x52b9('0x29')][_0x52b9('0x7b')]);_0x1e70bb[_0x52b9('0x57')]=qs[_0x52b9('0x77')](_[_0x52b9('0x96')](_0x56744e[_0x52b9('0x29')],_0x2a2ddc['filters']));_0x1e70bb[_0x52b9('0x57')][_0x52b9('0x9a')]=_0x4bc556['id'];if(_0x56744e['query'][_0x52b9('0x7c')]){_0x1e70bb[_0x52b9('0x57')]=_[_0x52b9('0x32')](_0x1e70bb[_0x52b9('0x57')],{'$or':_[_0x52b9('0x7d')](_0x1e70bb[_0x52b9('0x79')],function(_0x10c170){var _0x1cc523={};_0x1cc523[_0x10c170]={'$like':'%'+_0x56744e['query']['filter']+'%'};return _0x1cc523;})});}_0x1e70bb=_[_0x52b9('0x32')]({},_0x1e70bb,_0x56744e['options']);return db['CmHopperHistory'][_0x52b9('0x12')]({'where':_0x1e70bb[_0x52b9('0x57')]})['then'](function(_0x1ccdad){_0x444efc[_0x52b9('0x12')]=_0x1ccdad;if(_0x56744e['query']['includeAll']){_0x1e70bb[_0x52b9('0x97')]=[{'all':!![]}];}return db[_0x52b9('0x44')][_0x52b9('0x1d')](_0x1e70bb);})[_0x52b9('0x1c')](function(_0x53fa75){_0x444efc[_0x52b9('0x98')]=_0x53fa75;return _0x444efc;});}})[_0x52b9('0x1c')](respondWithFilteredResult(_0x2d71da,_0x1e70bb))[_0x52b9('0x1e')](handleError(_0x2d71da,null));};exports[_0x52b9('0x9b')]=function(_0x4f15f0,_0x334b26){var _0x57e70e={'raw':!![],'where':{}};var _0x408fc2={};var _0x53071b={'count':0x0,'rows':[]};return db[_0x52b9('0x21')][_0x52b9('0x73')]({'where':{'id':_0x4f15f0['params']['id']}})['then'](handleEntityNotFound(_0x334b26,null))[_0x52b9('0x1c')](function(_0x11a8a6){if(_0x11a8a6){_0x408fc2['model']=_[_0x52b9('0x24')](db['CmHopperFinal'][_0x52b9('0x76')]);_0x408fc2['query']=_['keys'](_0x4f15f0[_0x52b9('0x29')]);_0x408fc2['filters']=_['intersection'](_0x408fc2['model'],_0x408fc2[_0x52b9('0x29')]);_0x57e70e[_0x52b9('0x79')]=_[_0x52b9('0x78')](_0x408fc2[_0x52b9('0x74')],qs[_0x52b9('0x7a')](_0x4f15f0[_0x52b9('0x29')][_0x52b9('0x7a')]));_0x57e70e[_0x52b9('0x79')]=_0x57e70e[_0x52b9('0x79')][_0x52b9('0x2c')]?_0x57e70e[_0x52b9('0x79')]:_0x408fc2[_0x52b9('0x74')];if(!_0x4f15f0[_0x52b9('0x29')]['hasOwnProperty'](_0x52b9('0x94'))){_0x57e70e[_0x52b9('0x13')]=qs['limit'](_0x4f15f0[_0x52b9('0x29')]['limit']);_0x57e70e[_0x52b9('0x10')]=qs[_0x52b9('0x10')](_0x4f15f0['query'][_0x52b9('0x10')]);}_0x57e70e[_0x52b9('0x95')]=qs[_0x52b9('0x7b')](_0x4f15f0[_0x52b9('0x29')][_0x52b9('0x7b')]);_0x57e70e[_0x52b9('0x57')]=qs[_0x52b9('0x77')](_[_0x52b9('0x96')](_0x4f15f0[_0x52b9('0x29')],_0x408fc2[_0x52b9('0x77')]));_0x57e70e[_0x52b9('0x57')]['ContactId']=_0x11a8a6['id'];if(_0x4f15f0['query'][_0x52b9('0x7c')]){_0x57e70e[_0x52b9('0x57')]=_[_0x52b9('0x32')](_0x57e70e[_0x52b9('0x57')],{'$or':_[_0x52b9('0x7d')](_0x57e70e['attributes'],function(_0x40862a){var _0x5c6e05={};_0x5c6e05[_0x40862a]={'$like':'%'+_0x4f15f0[_0x52b9('0x29')][_0x52b9('0x7c')]+'%'};return _0x5c6e05;})});}_0x57e70e=_[_0x52b9('0x32')]({},_0x57e70e,_0x4f15f0['options']);return db[_0x52b9('0x43')][_0x52b9('0x12')]({'where':_0x57e70e[_0x52b9('0x57')]})['then'](function(_0xf6418e){_0x53071b['count']=_0xf6418e;if(_0x4f15f0[_0x52b9('0x29')][_0x52b9('0x9c')]){_0x57e70e[_0x52b9('0x97')]=[{'all':!![]}];}return db[_0x52b9('0x43')]['findAll'](_0x57e70e);})[_0x52b9('0x1c')](function(_0x287b3d){_0x53071b[_0x52b9('0x98')]=_0x287b3d;return _0x53071b;});}})[_0x52b9('0x1c')](respondWithFilteredResult(_0x334b26,_0x57e70e))[_0x52b9('0x1e')](handleError(_0x334b26,null));};exports[_0x52b9('0x9d')]=function(_0x1aba6c,_0x660122){var _0x2de872={'raw':!![],'where':{}};var _0x128250={};var _0x1e882d={'count':0x0,'rows':[]};return db[_0x52b9('0x21')][_0x52b9('0x73')]({'where':{'id':_0x1aba6c['params']['id']}})[_0x52b9('0x1c')](handleEntityNotFound(_0x660122,null))['then'](function(_0x593676){if(_0x593676){_0x128250[_0x52b9('0x74')]=_['keys'](db[_0x52b9('0x4b')]['rawAttributes']);_0x128250['query']=_[_0x52b9('0x24')](_0x1aba6c['query']);_0x128250[_0x52b9('0x77')]=_[_0x52b9('0x78')](_0x128250['model'],_0x128250['query']);_0x2de872['attributes']=_[_0x52b9('0x78')](_0x128250[_0x52b9('0x74')],qs[_0x52b9('0x7a')](_0x1aba6c[_0x52b9('0x29')][_0x52b9('0x7a')]));_0x2de872[_0x52b9('0x79')]=_0x2de872['attributes'][_0x52b9('0x2c')]?_0x2de872[_0x52b9('0x79')]:_0x128250['model'];if(!_0x1aba6c[_0x52b9('0x29')]['hasOwnProperty']('nolimit')){_0x2de872[_0x52b9('0x13')]=qs[_0x52b9('0x13')](_0x1aba6c['query'][_0x52b9('0x13')]);_0x2de872['offset']=qs[_0x52b9('0x10')](_0x1aba6c[_0x52b9('0x29')]['offset']);}_0x2de872['order']=qs['sort'](_0x1aba6c[_0x52b9('0x29')][_0x52b9('0x7b')]);_0x2de872[_0x52b9('0x57')]=qs[_0x52b9('0x77')](_[_0x52b9('0x96')](_0x1aba6c[_0x52b9('0x29')],_0x128250[_0x52b9('0x77')]));_0x2de872['where'][_0x52b9('0x9a')]=_0x593676['id'];if(_0x1aba6c['query'][_0x52b9('0x7c')]){_0x2de872[_0x52b9('0x57')]=_[_0x52b9('0x32')](_0x2de872[_0x52b9('0x57')],{'$or':_[_0x52b9('0x7d')](_0x2de872[_0x52b9('0x79')],function(_0x4d3395){var _0x14fbf4={};_0x14fbf4[_0x4d3395]={'$like':'%'+_0x1aba6c['query']['filter']+'%'};return _0x14fbf4;})});}_0x2de872=_[_0x52b9('0x32')]({},_0x2de872,_0x1aba6c[_0x52b9('0x9e')]);return db['JscriptySessionReport'][_0x52b9('0x12')]({'where':_0x2de872['where']})[_0x52b9('0x1c')](function(_0x26384a){_0x1e882d[_0x52b9('0x12')]=_0x26384a;if(_0x1aba6c[_0x52b9('0x29')][_0x52b9('0x9c')]){_0x2de872[_0x52b9('0x97')]=[{'all':!![]}];}return db[_0x52b9('0x4b')][_0x52b9('0x1d')](_0x2de872);})['then'](function(_0x4d36fd){_0x1e882d[_0x52b9('0x98')]=_0x4d36fd;return _0x1e882d;});}})[_0x52b9('0x1c')](respondWithFilteredResult(_0x660122,_0x2de872))[_0x52b9('0x1e')](handleError(_0x660122,null));};exports[_0x52b9('0x9f')]=function(_0x4f8a7d,_0x249dc7){try{if(!_0x4f8a7d['body'][_0x52b9('0x58')]){throw new Error(_0x52b9('0xa0'));}if(!_0x4f8a7d[_0x52b9('0x33')][_0x52b9('0xa1')]){throw new Error(_0x52b9('0xa2'));}if(!_0x4f8a7d[_0x52b9('0x33')]['binding_values']){throw new Error(_0x52b9('0xa3'));}if(!_0x4f8a7d['body'][_0x52b9('0xa4')]){throw new Error(_0x52b9('0xa5'));}var _0x48b97d=_0x4f8a7d[_0x52b9('0x33')][_0x52b9('0xa1')]['split'](',');var _0x29bc08=_0x4f8a7d[_0x52b9('0x33')][_0x52b9('0xa6')][_0x52b9('0xa7')](',');if(!_0x48b97d['length']||!_0x29bc08['length']||_0x48b97d[_0x52b9('0x2c')]!==_0x29bc08[_0x52b9('0x2c')]){throw new Error('Incorrect\x20binding\x20parameters\x20passed!');}_0x4f8a7d['body'][_0x52b9('0x7a')]=_[_0x52b9('0xa8')](_0x48b97d,_0x29bc08);if(!_0x4f8a7d['body'][_0x52b9('0x7a')][_0x52b9('0x72')]){throw new Error(_0x52b9('0xa9'));}if(!_0x4f8a7d[_0x52b9('0x33')][_0x52b9('0x7a')]['firstName']){throw new Error('No\x20firstName\x20column\x20specified');}var _0xca1e3f=path[_0x52b9('0x4e')](config[_0x52b9('0xaa')],_0x52b9('0xab'),_0x4f8a7d[_0x52b9('0xac')][_0x52b9('0xad')]);fs[_0x52b9('0xae')](_0xca1e3f,parseInt(_0x52b9('0xaf'),0x8));var _0x1a192a=require(_0x52b9('0xb0'))[_0x52b9('0xb1')](path[_0x52b9('0x4e')](__dirname,_0x52b9('0xb2')),[_0xca1e3f,_0x4f8a7d['body'][_0x52b9('0xa1')],_0x4f8a7d[_0x52b9('0x33')][_0x52b9('0xa6')],_0x4f8a7d[_0x52b9('0x33')][_0x52b9('0x58')],_0x4f8a7d['body'][_0x52b9('0xb3')],_0x4f8a7d[_0x52b9('0x33')][_0x52b9('0x55')],_0x4f8a7d['body'][_0x52b9('0xa4')]]);return _0x249dc7['status'](0xc8)[_0x52b9('0xf')]({'message':_0x52b9('0xb4'),'pid':_0x1a192a['pid']});}catch(_0x696e22){return _0x249dc7[_0x52b9('0x14')](0x1f4)[_0x52b9('0xb5')](_0x696e22);}};exports['upload']=function(_0xe1e489,_0x5949b0){var _0x1aaa04=fs[_0x52b9('0xb6')](_0xe1e489[_0x52b9('0xac')]['path']);Papa[_0x52b9('0xb7')](_0x1aaa04,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x45ac6b){return _0x5949b0[_0x52b9('0x14')](0xc8)[_0x52b9('0xf')]({'file':_0xe1e489[_0x52b9('0xac')],'fields':_0x45ac6b['meta'][_0x52b9('0x7a')]});}});};exports['import']=function(_0x594a72,_0x4030ca){return db[_0x52b9('0xb8')][_0x52b9('0x1d')]({'raw':!![],'attributes':['id'],'where':{'role':_0x52b9('0xb9')}})[_0x52b9('0x1c')](function(_0x114397){var _0xcda94d=![];if(!_0x594a72[_0x52b9('0x33')][_0x52b9('0x58')]){throw new Error('No\x20ListId\x20specified');}if(!_0x594a72[_0x52b9('0x33')][_0x52b9('0xba')][_0x52b9('0x72')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x594a72[_0x52b9('0x33')]['binding'][_0x52b9('0xbb')]){throw new Error(_0x52b9('0xbc'));}if(!_0x594a72['body'][_0x52b9('0xa4')]){throw new Error(_0x52b9('0xa5'));}var _0x296f0e=require('child_process')[_0x52b9('0xb1')](path['join'](__dirname,'../../components/import/cm/csv2'),[_0x594a72['params']['id'],JSON[_0x52b9('0xbd')](_0x594a72[_0x52b9('0x33')]),JSON[_0x52b9('0xbd')](_0x114397)]);_0x296f0e['on'](_0x52b9('0xbe'),function(){_0xcda94d=!![];return _0x4030ca[_0x52b9('0x14')](0xc8)[_0x52b9('0xf')]({'message':_0x52b9('0xbf'),'pid':_0x296f0e['pid']});});_0x296f0e['on'](_0x52b9('0xc0'),function(_0x399bfd){if(_0x399bfd&&!_0xcda94d){return _0x4030ca[_0x52b9('0x14')](0x1f4)[_0x52b9('0xf')]({'message':'error\x20child\x20process','pid':_0x296f0e[_0x52b9('0xc1')]});}});})[_0x52b9('0x1e')](handleError(_0x4030ca,null));};exports[_0x52b9('0xc2')]=function(_0x4b65fc,_0x31ca39){return db[_0x52b9('0xb8')][_0x52b9('0x1d')]({'raw':!![],'attributes':['id'],'where':{'role':_0x52b9('0xb9')}})[_0x52b9('0x1c')](function(_0x212c6c){var _0x8dd00b=![];if(!_0x4b65fc[_0x52b9('0x33')]['ListId']){throw new Error(_0x52b9('0xa0'));}if(!_0x4b65fc[_0x52b9('0x33')]['binding'][_0x52b9('0x72')]){throw new Error(_0x52b9('0xa9'));}if(!_0x4b65fc['body'][_0x52b9('0xba')][_0x52b9('0xbb')]){throw new Error(_0x52b9('0xbc'));}if(!_0x4b65fc[_0x52b9('0x33')][_0x52b9('0xa4')]){throw new Error(_0x52b9('0xa5'));}var _0x3dc115=require(_0x52b9('0xb0'))[_0x52b9('0xb1')](path['join'](__dirname,'../../components/import/cm/csvUpdates'),[_0x4b65fc[_0x52b9('0x20')]['id'],JSON[_0x52b9('0xbd')](_0x4b65fc['body']),JSON[_0x52b9('0xbd')](_0x212c6c)]);_0x3dc115['on'](_0x52b9('0xbe'),function(){_0x8dd00b=!![];return _0x31ca39[_0x52b9('0x14')](0xc8)[_0x52b9('0xf')]({'message':_0x52b9('0xbf'),'pid':_0x3dc115[_0x52b9('0xc1')]});});_0x3dc115['on'](_0x52b9('0xc0'),function(_0x4d1878){if(_0x4d1878&&!_0x8dd00b){return _0x31ca39['status'](0x1f4)[_0x52b9('0xf')]({'message':'error\x20child\x20process','pid':_0x3dc115[_0x52b9('0xc1')]});}});})[_0x52b9('0x1e')](handleError(_0x31ca39,null));};exports[_0x52b9('0xc3')]=function(_0x27912b,_0x5704c0){var _0x3a0107=[_0x52b9('0xc4'),_0x52b9('0xc5'),_0x52b9('0xc6'),'openchannel','fax',_0x52b9('0xc7'),'voice'];var _0xc3bfad={'offset':0x0,'order':qs[_0x52b9('0x7b')]('-createdAt')},_0x91fd03={'count':0x0,'rows':[]};Promise['resolve']()[_0x52b9('0x1c')](function(){if(_0x27912b[_0x52b9('0x29')][_0x52b9('0xc8')]){if(!_[_0x52b9('0xc9')](_0x3a0107,_0x27912b['query'][_0x52b9('0xc8')][_0x52b9('0xca')]())){throw new Error(_0x52b9('0xcb'));}_0x3a0107=[_0x27912b['query'][_0x52b9('0xc8')]['toLowerCase']()];}if(_0x27912b[_0x52b9('0x29')]['range']){try{var _0x58ef73=JSON[_0x52b9('0xb7')](_0x27912b[_0x52b9('0x29')][_0x52b9('0xcc')]);if(!moment(_0x58ef73[_0x52b9('0x34')])[_0x52b9('0xcd')]()){throw new Error(_0x52b9('0xce'));}if(!moment(_0x58ef73['to'])[_0x52b9('0xcd')]()){throw new Error(_0x52b9('0xcf'));}}catch(_0x3f7983){throw new Error(_0x52b9('0xd0'));}}if(!_0x27912b[_0x52b9('0x29')][_0x52b9('0x31')](_0x52b9('0x94'))){_0xc3bfad[_0x52b9('0x13')]=qs['limit'](_0x27912b[_0x52b9('0x29')][_0x52b9('0x13')]||0xa);_0xc3bfad[_0x52b9('0x10')]=qs[_0x52b9('0x10')](_0x27912b['query'][_0x52b9('0x10')]);}var _0x5d4552=_0x3a0107[_0x52b9('0x7d')](function(_0x2e6c7c){if(_0x2e6c7c===_0x52b9('0xd1')){var _0x4e3837={'attributes':['id',_0x52b9('0xd2'),_0x52b9('0xd3'),_0x52b9('0xd4'),_0x52b9('0xd5'),_0x52b9('0xd6'),_0x52b9('0xd7'),_0x52b9('0xd8'),_0x52b9('0xd9'),_0x52b9('0xda'),'createdAt',_0x52b9('0xdb'),_0x52b9('0xdc'),_0x52b9('0xdd'),_0x52b9('0xde')],'where':{'ContactId':_0x27912b[_0x52b9('0x20')]['id']},'include':[{'model':db[_0x52b9('0xb8')],'as':'User','attributes':['id',_0x52b9('0x1a'),'fullname',_0x52b9('0x2d')]}],'order':[[_0x52b9('0xdf'),_0x52b9('0xe0')]]};if(_0x27912b[_0x52b9('0x29')]['range']){_0x4e3837['where'][_0x52b9('0xdf')]={'$gte':_0x58ef73[_0x52b9('0x34')],'$lte':_0x58ef73['to']};}return db[_0x52b9('0x46')][_0x52b9('0xe1')](_0x4e3837)[_0x52b9('0x1c')](function(_0x58e7f5){_0x91fd03[_0x52b9('0x12')]+=_0x58e7f5[_0x52b9('0x12')];return _[_0x52b9('0x7d')](_0x58e7f5[_0x52b9('0x98')],function(_0x40b07a){var _0x750b36=_0x40b07a[_0x52b9('0x35')]({'plain':!![]});_0x750b36[_0x52b9('0xc8')]=_0x2e6c7c;if(_0x750b36[_0x52b9('0xb8')]){_0x750b36[_0x52b9('0xb8')]={'id':_0x750b36[_0x52b9('0xb8')]['id'],'name':_0x750b36[_0x52b9('0xb8')][_0x52b9('0x1a')],'fullname':_0x750b36[_0x52b9('0xb8')]['fullname'],'alias':_0x750b36[_0x52b9('0xb8')]['alias']};}return _0x750b36;});});}else{var _0x5bf9a3=_[_0x52b9('0xe2')](_0x2e6c7c)+(_0x2e6c7c===_0x52b9('0xc5')?_0x52b9('0xe3'):'Account');var _0x5e614f={'attributes':['id','closed',_0x52b9('0xe4'),_0x52b9('0xdf'),_0x52b9('0xda'),_0x52b9('0xe5'),_0x52b9('0xe6'),_0x52b9('0xe7'),'UserId',_0x5bf9a3+'Id'],'where':{'ContactId':_0x27912b['params']['id']},'include':[{'model':db[_0x5bf9a3],'as':_0x52b9('0xe8'),'attributes':['id','name','key']},{'model':db[_0x52b9('0xb8')],'as':_0x52b9('0xe9'),'attributes':['id','name',_0x52b9('0xea')]},{'model':db[_0x52b9('0x75')],'as':_0x52b9('0x5f'),'attributes':['id',_0x52b9('0x1a'),_0x52b9('0x60')],'through':{'attributes':[]}}],'order':[[_0x52b9('0xdf'),_0x52b9('0xe0')]]};if(_0x27912b['query'][_0x52b9('0xcc')]){_0x5e614f[_0x52b9('0x57')][_0x52b9('0xdf')]={'$gte':_0x58ef73[_0x52b9('0x34')],'$lte':_0x58ef73['to']};}switch(_0x2e6c7c){case _0x52b9('0xc5'):_0x5e614f[_0x52b9('0x79')][_0x52b9('0x5b')](_0x52b9('0xeb'),_0x52b9('0xec'),_0x52b9('0xed'),_0x52b9('0xee'),'osName',_0x52b9('0xef'),_0x52b9('0xf0'),_0x52b9('0xf1'),_0x52b9('0xf2'));break;case _0x52b9('0xc4'):_0x5e614f['attributes'][_0x52b9('0x5b')](_0x52b9('0xf3'),'substatus');break;case _0x52b9('0xf4'):_0x5e614f[_0x52b9('0x79')]['push'](_0x52b9('0xf5'),_0x52b9('0xf6'));break;}return db[_[_0x52b9('0xe2')](_0x2e6c7c)+_0x52b9('0xf7')][_0x52b9('0xe1')](_0x5e614f)['then'](function(_0x4c89c4){_0x91fd03[_0x52b9('0x12')]+=_0x4c89c4['count'];return _[_0x52b9('0x7d')](_0x4c89c4[_0x52b9('0x98')],function(_0x92bb35){var _0x873283=_0x92bb35['get']({'plain':!![]});_0x873283[_0x52b9('0xc8')]=_0x2e6c7c;if(_0x873283[_0x52b9('0xe9')]){_0x873283[_0x52b9('0xe9')]={'id':_0x873283['Owner']['id'],'name':_0x873283[_0x52b9('0xe9')][_0x52b9('0x1a')],'fullname':_0x873283[_0x52b9('0xe9')]['fullname']};}return _0x873283;});});}});return Promise[_0x52b9('0x5d')](_0x5d4552);})[_0x52b9('0x1c')](function(_0x4419d2){return _(_0x4419d2)[_0x52b9('0xf8')]()[_0x52b9('0xf9')](_0x52b9('0xdf'))[_0x52b9('0xfa')]()[_0x52b9('0xfb')]();})[_0x52b9('0x1c')](function(_0x19b5ee){_0x91fd03[_0x52b9('0x98')]=_0xc3bfad[_0x52b9('0x13')]?_0x19b5ee['slice'](_0xc3bfad[_0x52b9('0x10')],_0xc3bfad[_0x52b9('0x10')]+_0xc3bfad['limit']):_0x19b5ee;return _0x91fd03;})[_0x52b9('0x1c')](respondWithFilteredResult(_0x5704c0,_0xc3bfad))[_0x52b9('0x1e')](handleError(_0x5704c0,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index 64f573d..c2264d1 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 _0x8350=['save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners'];(function(_0x2d8db5,_0x3c9c8d){var _0xdc5579=function(_0x36f14f){while(--_0x36f14f){_0x2d8db5['push'](_0x2d8db5['shift']());}};_0xdc5579(++_0x3c9c8d);}(_0x8350,0xf0));var _0x0835=function(_0x2f080f,_0x16f6f8){_0x2f080f=_0x2f080f-0x0;var _0x4d4abe=_0x8350[_0x2f080f];return _0x4d4abe;};'use strict';var EventEmitter=require(_0x0835('0x0'));var CmContact=require(_0x0835('0x1'))['db']['CmContact'];var CmContactEvents=new EventEmitter();CmContactEvents[_0x0835('0x2')](0x0);var events={'afterCreate':_0x0835('0x3'),'afterUpdate':_0x0835('0x4'),'afterDestroy':_0x0835('0x5')};function emitEvent(_0x1798bb){return function(_0x54ef05,_0x2c44a4,_0xe0d6ec){CmContactEvents[_0x0835('0x6')](_0x1798bb+':'+_0x54ef05['id'],_0x54ef05);CmContactEvents[_0x0835('0x6')](_0x1798bb,_0x54ef05);_0xe0d6ec(null);};}for(var e in events){if(events[_0x0835('0x7')](e)){var event=events[e];CmContact[_0x0835('0x8')](e,emitEvent(event));}}module['exports']=CmContactEvents; \ No newline at end of file +var _0xbf45=['emit','hasOwnProperty','exports','events','setMaxListeners','save','update','remove'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0xbf45,0x1f3));var _0x5bf4=function(_0x2d8073,_0x209303){_0x2d8073=_0x2d8073-0x0;var _0xf3dc11=_0xbf45[_0x2d8073];return _0xf3dc11;};'use strict';var EventEmitter=require(_0x5bf4('0x0'));var CmContact=require('../../mysqldb')['db']['CmContact'];var CmContactEvents=new EventEmitter();CmContactEvents[_0x5bf4('0x1')](0x0);var events={'afterCreate':_0x5bf4('0x2'),'afterUpdate':_0x5bf4('0x3'),'afterDestroy':_0x5bf4('0x4')};function emitEvent(_0x356c32){return function(_0x485921,_0x4e1ebe,_0x792f0b){CmContactEvents['emit'](_0x356c32+':'+_0x485921['id'],_0x485921);CmContactEvents[_0x5bf4('0x5')](_0x356c32,_0x485921);_0x792f0b(null);};}for(var e in events){if(events[_0x5bf4('0x6')](e)){var event=events[e];CmContact['hook'](e,emitEvent(event));}}module[_0x5bf4('0x7')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index b0f1ffb..8e96341 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 _0xdc91=['fti_cm_contacts','lastName','mobile','fax','email','FULLTEXT','utf8mb4','error','cmContact','afterCreate','inspect','scheduledat','format','isNil','dialTimezone','VoiceQueue','findOne','then','timezones','add','minutes','YYYY-MM-DD\x20HH:mm:ss','ret','CmHopper','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','create','priority','callbackUniqueid','catch','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','Campaign','utcOffset','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','CmHopperFinal','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','ListId','outbound','dialCheckDuplicateType','CmList','length','get','always','onlyIfOpen','findAll','cmContact,\x20%s,\x20%s','Lists','BlackLists','CmHopperBlack','message','List\x20not\x20found','isEmpty','destroy','CampaignId','push','all','info','util','../../config/logger','api','moment','bluebird','path','../../config/environment','../../config/environment/shared','./cmContact.attributes','define','cm_contacts','phone'];(function(_0x1e7b82,_0x194500){var _0x2eabe5=function(_0x20c2c1){while(--_0x20c2c1){_0x1e7b82['push'](_0x1e7b82['shift']());}};_0x2eabe5(++_0x194500);}(_0xdc91,0x110));var _0x1dc9=function(_0x12e34b,_0x19164f){_0x12e34b=_0x12e34b-0x0;var _0x16f094=_0xdc91[_0x12e34b];return _0x16f094;};'use strict';var _=require('lodash');var util=require(_0x1dc9('0x0'));var logger=require(_0x1dc9('0x1'))(_0x1dc9('0x2'));var moment=require(_0x1dc9('0x3'));var BPromise=require(_0x1dc9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1dc9('0x5'));var rimraf=require('rimraf');var config=require(_0x1dc9('0x6'));var shared=require(_0x1dc9('0x7'));var attributes=require(_0x1dc9('0x8'));module['exports']=function(_0x43c736,_0x3f7bff){return _0x43c736[_0x1dc9('0x9')]('CmContact',attributes,{'tableName':_0x1dc9('0xa'),'paranoid':!![],'indexes':[{'name':_0x1dc9('0xb'),'fields':['phone']},{'name':_0x1dc9('0xc'),'fields':['firstName',_0x1dc9('0xd'),_0x1dc9('0xb'),_0x1dc9('0xe'),_0x1dc9('0xf'),_0x1dc9('0x10')],'type':_0x1dc9('0x11')}],'timestamps':!![],'charset':_0x1dc9('0x12'),'collate':'utf8mb4_unicode_ci','hooks':{'afterCreate':function(_0x39f032,_0x5c7d6b,_0x47acc3){var _0x359eec=_0x43c736['models'];var _0x54e31d=_0x39f032['get']({'plain':!![]});function _0x3ec5a7(){return function(_0x21909d){logger[_0x1dc9('0x13')](_0x1dc9('0x14'),_0x1dc9('0x15'),util[_0x1dc9('0x16')](_0x21909d,{'showHidden':![],'depth':null}));};}function _0x310852(_0x4cc358,_0x2da55f){var _0x398314=_0x2da55f['scheduledat']?_0x2da55f[_0x1dc9('0x17')]:moment()[_0x1dc9('0x18')]('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0x2ad36f,_0x24bd3c){if(_[_0x1dc9('0x19')](_0x2da55f[_0x1dc9('0x1a')])){_0x2ad36f({'ret':_0x398314});}else{_0x359eec[_0x1dc9('0x1b')][_0x1dc9('0x1c')]({'where':{'id':_0x4cc358['id']}})[_0x1dc9('0x1d')](function(_0x24467e){if(!_['isNil'](_0x24467e)){var _0x1b1440=_0x24467e['dialTimezone'];if(!_[_0x1dc9('0x19')](_0x1b1440)){var _0x21699d=shared[_0x1dc9('0x1e')];var _0x51d071=_0x21699d[_0x1b1440];var _0x4ff10d=_0x21699d[_0x2da55f[_0x1dc9('0x1a')]];if(!_[_0x1dc9('0x19')](_0x51d071)&&!_[_0x1dc9('0x19')](_0x4ff10d)){var _0x108555=_0x51d071['utcOffset']-_0x4ff10d['utcOffset'];_0x398314=_0x2da55f[_0x1dc9('0x17')]?_0x2da55f[_0x1dc9('0x17')]:moment();var _0x45f85b=moment(_0x398314)[_0x1dc9('0x1f')](_0x108555,_0x1dc9('0x20'));_0x2ad36f({'ret':_0x45f85b[_0x1dc9('0x18')](_0x1dc9('0x21'))});}else _0x2ad36f({'ret':_0x398314});}else _0x2ad36f({'ret':_0x398314});}else{_0x2ad36f({'ret':_0x398314});}});}});return 0xa;}var _0x5806a4=function(_0x254f93){return new BPromise(function(_0x4ecca4,_0x2b304c){_0x310852(_0x254f93,_0x54e31d)['then'](function(_0x4881b1){_0x54e31d[_0x1dc9('0x17')]=_0x4881b1[_0x1dc9('0x22')];_0x359eec[_0x1dc9('0x23')][_0x1dc9('0x1c')]({'where':{'phone':_0x54e31d[_0x1dc9('0xb')],'VoiceQueueId':_0x254f93['id']}})[_0x1dc9('0x1d')](function(_0x311ec8){if(!_[_0x1dc9('0x19')](_0x311ec8)){throw new Error(_0x1dc9('0x24')+_0x54e31d[_0x1dc9('0xb')]+_0x1dc9('0x25')+_0x254f93['id']);}return _0x359eec[_0x1dc9('0x23')][_0x1dc9('0x26')]({'phone':_0x54e31d[_0x1dc9('0xb')],'ContactId':_0x54e31d['id'],'ListId':_0x54e31d['ListId'],'priority':_0x54e31d['priority']?_0x54e31d[_0x1dc9('0x27')]:0x2,'scheduledat':_0x54e31d['scheduledat']?_0x54e31d[_0x1dc9('0x17')]:moment()[_0x1dc9('0x18')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x54e31d[_0x1dc9('0x28')]?!![]:![],'callbackuniqueid':_0x54e31d['callbackUniqueid']?_0x54e31d[_0x1dc9('0x28')]:undefined,'callbackat':_0x54e31d['callbackUniqueid']?moment()[_0x1dc9('0x18')](_0x1dc9('0x21')):undefined,'VoiceQueueId':_0x254f93['id']});})[_0x1dc9('0x29')](function(_0x4d69ad){_0x2b304c(_0x4d69ad);});});});};var _0x13fe05=function(_0x7849f){return new BPromise(function(_0x3472c9,_0x55b574){_0x310852(_0x7849f,_0x54e31d)[_0x1dc9('0x1d')](function(_0x5c87eb){_0x54e31d[_0x1dc9('0x17')]=_0x5c87eb[_0x1dc9('0x22')];_0x359eec[_0x1dc9('0x23')]['findOne']({'where':{'phone':_0x54e31d[_0x1dc9('0xb')],'VoiceQueueId':_0x7849f['id']}})['then'](function(_0x2a8ecc){if(!_[_0x1dc9('0x19')](_0x2a8ecc)){throw new Error(_0x1dc9('0x24')+_0x54e31d[_0x1dc9('0xb')]+_0x1dc9('0x2a')+_0x7849f['id']);}return _0x359eec['CmHopperFinal']['findOne']({'where':{'calleridnum':_0x54e31d[_0x1dc9('0xb')],'VoiceQueueId':_0x7849f['id']}});})[_0x1dc9('0x1d')](function(_0x1a2fc2){if(!_['isNil'](_0x1a2fc2)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x54e31d[_0x1dc9('0xb')]+_0x1dc9('0x2b')+_0x7849f['id']);}return _0x359eec['CmHopper'][_0x1dc9('0x26')]({'phone':_0x54e31d['phone'],'ContactId':_0x54e31d['id'],'ListId':_0x54e31d['ListId'],'priority':_0x54e31d[_0x1dc9('0x27')]?_0x54e31d[_0x1dc9('0x27')]:0x2,'scheduledat':_0x54e31d[_0x1dc9('0x17')]?_0x54e31d[_0x1dc9('0x17')]:moment()[_0x1dc9('0x18')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x54e31d[_0x1dc9('0x28')]?!![]:![],'callbackuniqueid':_0x54e31d[_0x1dc9('0x28')]?_0x54e31d[_0x1dc9('0x28')]:undefined,'callbackat':_0x54e31d[_0x1dc9('0x28')]?moment()[_0x1dc9('0x18')](_0x1dc9('0x21')):undefined,'VoiceQueueId':_0x7849f['id']});})[_0x1dc9('0x29')](function(_0x3caab8){_0x55b574(_0x3caab8);});});});};function _0x1add3f(){return function(_0x47b2f3){logger[_0x1dc9('0x13')](_0x1dc9('0x14'),_0x1dc9('0x15'),util[_0x1dc9('0x16')](_0x47b2f3,{'showHidden':![],'depth':null}));};}function _0x2fff97(_0x1921f7,_0x20450f){var _0x48f42d=_0x20450f[_0x1dc9('0x17')]?_0x20450f[_0x1dc9('0x17')]:moment()[_0x1dc9('0x18')](_0x1dc9('0x21'));return new BPromise(function(_0x4fe3d3,_0x8a5bb3){if(_[_0x1dc9('0x19')](_0x20450f[_0x1dc9('0x1a')])){_0x4fe3d3({'ret':_0x48f42d});}else{_0x359eec[_0x1dc9('0x2c')][_0x1dc9('0x1c')]({'where':{'id':_0x1921f7['id']}})['then'](function(_0x4d8ae6){if(!_[_0x1dc9('0x19')](_0x4d8ae6)){var _0x23f179=_0x4d8ae6[_0x1dc9('0x1a')];if(!_[_0x1dc9('0x19')](_0x23f179)){var _0x8802b9=shared['timezones'];var _0x4ed22f=_0x8802b9[_0x23f179];var _0x293c1c=_0x8802b9[_0x20450f[_0x1dc9('0x1a')]];if(!_['isNil'](_0x4ed22f)&&!_[_0x1dc9('0x19')](_0x293c1c)){var _0x2b77b0=_0x4ed22f[_0x1dc9('0x2d')]-_0x293c1c['utcOffset'];_0x48f42d=_0x20450f['scheduledat']?_0x20450f['scheduledat']:moment();var _0x27e19d=moment(_0x48f42d)[_0x1dc9('0x1f')](_0x2b77b0,_0x1dc9('0x20'));_0x4fe3d3({'ret':_0x27e19d[_0x1dc9('0x18')]('YYYY-MM-DD\x20HH:mm:ss')});}else _0x4fe3d3({'ret':_0x48f42d});}else _0x4fe3d3({'ret':_0x48f42d});}else{_0x4fe3d3({'ret':_0x48f42d});}});}});return 0xa;}var _0x66a0f3=function(_0x3c9102){return new BPromise(function(_0x57106f,_0x1b8da5){_0x2fff97(_0x3c9102,_0x54e31d)[_0x1dc9('0x1d')](function(_0x5f1c1d){_0x54e31d[_0x1dc9('0x17')]=_0x5f1c1d[_0x1dc9('0x22')];_0x359eec[_0x1dc9('0x23')][_0x1dc9('0x1c')]({'where':{'phone':_0x54e31d[_0x1dc9('0xb')],'CampaignId':_0x3c9102['id']}})['then'](function(_0x49f5ef){if(!_[_0x1dc9('0x19')](_0x49f5ef)){throw new Error(_0x1dc9('0x24')+_0x54e31d[_0x1dc9('0xb')]+_0x1dc9('0x2e')+_0x3c9102['id']);}return _0x359eec[_0x1dc9('0x23')][_0x1dc9('0x26')]({'phone':_0x54e31d[_0x1dc9('0xb')],'ContactId':_0x54e31d['id'],'ListId':_0x54e31d['ListId'],'priority':_0x54e31d[_0x1dc9('0x27')]?_0x54e31d['priority']:0x2,'scheduledat':_0x54e31d[_0x1dc9('0x17')]?_0x54e31d[_0x1dc9('0x17')]:moment()[_0x1dc9('0x18')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x54e31d[_0x1dc9('0x28')]?!![]:![],'callbackuniqueid':_0x54e31d['callbackUniqueid']?_0x54e31d['callbackUniqueid']:undefined,'callbackat':_0x54e31d['callbackUniqueid']?moment()[_0x1dc9('0x18')](_0x1dc9('0x21')):undefined,'CampaignId':_0x3c9102['id']});})['catch'](function(_0x2b1699){_0x1b8da5(_0x2b1699);});});});};var _0x2c346b=function(_0x1a1d7e){return new BPromise(function(_0x6a7a4d,_0x21082d){_0x2fff97(_0x1a1d7e,_0x54e31d)['then'](function(_0x502f51){_0x54e31d[_0x1dc9('0x17')]=_0x502f51[_0x1dc9('0x22')];_0x359eec['CmHopper']['findOne']({'where':{'phone':_0x54e31d[_0x1dc9('0xb')],'CampaignId':_0x1a1d7e['id']}})[_0x1dc9('0x1d')](function(_0x416a14){if(!_[_0x1dc9('0x19')](_0x416a14)){throw new Error(_0x1dc9('0x24')+_0x54e31d[_0x1dc9('0xb')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0x1a1d7e['id']);}return _0x359eec[_0x1dc9('0x2f')][_0x1dc9('0x1c')]({'where':{'calleridnum':_0x54e31d[_0x1dc9('0xb')],'CampaignId':_0x1a1d7e['id']}});})[_0x1dc9('0x1d')](function(_0x30b504){if(!_[_0x1dc9('0x19')](_0x30b504)){throw new Error(_0x1dc9('0x30')+_0x54e31d[_0x1dc9('0xb')]+_0x1dc9('0x31')+_0x1a1d7e['id']);}return _0x359eec[_0x1dc9('0x23')]['create']({'phone':_0x54e31d[_0x1dc9('0xb')],'ContactId':_0x54e31d['id'],'ListId':_0x54e31d[_0x1dc9('0x32')],'priority':_0x54e31d[_0x1dc9('0x27')]?_0x54e31d[_0x1dc9('0x27')]:0x2,'scheduledat':_0x54e31d[_0x1dc9('0x17')]?_0x54e31d['scheduledat']:moment()[_0x1dc9('0x18')](_0x1dc9('0x21')),'callback':_0x54e31d[_0x1dc9('0x28')]?!![]:![],'callbackuniqueid':_0x54e31d[_0x1dc9('0x28')]?_0x54e31d[_0x1dc9('0x28')]:undefined,'callbackat':_0x54e31d[_0x1dc9('0x28')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x1a1d7e['id']});})[_0x1dc9('0x29')](function(_0x513149){_0x21082d(_0x513149);});});});};if(_0x54e31d['ListId']){_0x359eec[_0x1dc9('0x1b')]['findAll']({'where':{'type':_0x1dc9('0x33')},'attributes':['id',_0x1dc9('0x34'),_0x1dc9('0x1a')],'include':[{'model':_0x359eec[_0x1dc9('0x35')],'as':'Lists','where':{'id':_0x54e31d[_0x1dc9('0x32')]}}]})[_0x1dc9('0x1d')](function(_0x371e94){if(_0x371e94){var _0x4696b8=[];for(var _0x447467=0x0,_0x2b24af;_0x447467<_0x371e94[_0x1dc9('0x36')];_0x447467+=0x1){_0x2b24af=_0x371e94[_0x447467][_0x1dc9('0x37')]({'plain':!![]});switch(_0x2b24af[_0x1dc9('0x34')]){case _0x1dc9('0x38'):_0x13fe05(_0x2b24af)['catch'](_0x3ec5a7());break;case _0x1dc9('0x39'):_0x5806a4(_0x2b24af)[_0x1dc9('0x29')](_0x3ec5a7());break;default:_0x2fff97(_0x2b24af,_0x54e31d)['then'](function(_0x287ef4){_0x54e31d['scheduledat']=_0x287ef4[_0x1dc9('0x22')];_0x359eec[_0x1dc9('0x23')][_0x1dc9('0x26')]({'phone':_0x54e31d[_0x1dc9('0xb')],'ContactId':_0x54e31d['id'],'ListId':_0x54e31d[_0x1dc9('0x32')],'scheduledat':_0x54e31d[_0x1dc9('0x17')]?_0x54e31d[_0x1dc9('0x17')]:moment()[_0x1dc9('0x18')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x54e31d['priority']?_0x54e31d[_0x1dc9('0x27')]:0x2,'callback':_0x54e31d[_0x1dc9('0x28')]?!![]:![],'callbackuniqueid':_0x54e31d[_0x1dc9('0x28')]?_0x54e31d[_0x1dc9('0x28')]:undefined,'callbackat':_0x54e31d[_0x1dc9('0x28')]?moment()[_0x1dc9('0x18')](_0x1dc9('0x21')):undefined,'VoiceQueueId':_0x2b24af['id']})[_0x1dc9('0x29')](_0x3ec5a7());});}}}})[_0x1dc9('0x1d')](function(){return _0x359eec[_0x1dc9('0x1b')][_0x1dc9('0x3a')]({'where':{'type':_0x1dc9('0x33')},'attributes':['id'],'include':[{'model':_0x359eec[_0x1dc9('0x35')],'as':'BlackLists','where':{'id':_0x54e31d[_0x1dc9('0x32')]}}]})[_0x1dc9('0x1d')](function(_0x4ef7db){if(_0x4ef7db){var _0x4faa59=[];for(var _0x3da1f0=0x0,_0x491a12;_0x3da1f0<_0x4ef7db[_0x1dc9('0x36')];_0x3da1f0+=0x1){_0x491a12=_0x4ef7db[_0x3da1f0][_0x1dc9('0x37')]({'plain':!![]});_0x359eec['CmHopperBlack']['create']({'phone':_0x54e31d[_0x1dc9('0xb')],'ContactId':_0x54e31d['id'],'ListId':_0x54e31d[_0x1dc9('0x32')],'VoiceQueueId':_0x491a12['id']})[_0x1dc9('0x29')](function(_0x15df94){logger[_0x1dc9('0x13')](_0x1dc9('0x3b'),_0x1dc9('0x15'),_0x15df94['message']);});}}});})['then'](function(){return _0x359eec['Campaign'][_0x1dc9('0x3a')]({'attributes':['id','dialCheckDuplicateType',_0x1dc9('0x1a')],'include':[{'model':_0x359eec[_0x1dc9('0x35')],'as':_0x1dc9('0x3c'),'where':{'id':_0x54e31d['ListId']}}]})['then'](function(_0x54068f){if(_0x54068f){var _0x3ae429=[];for(var _0x22318f=0x0,_0x390f1b;_0x22318f<_0x54068f[_0x1dc9('0x36')];_0x22318f+=0x1){_0x390f1b=_0x54068f[_0x22318f][_0x1dc9('0x37')]({'plain':!![]});switch(_0x390f1b[_0x1dc9('0x34')]){case'always':_0x2c346b(_0x390f1b)[_0x1dc9('0x29')](_0x1add3f());break;case _0x1dc9('0x39'):_0x66a0f3(_0x390f1b)['catch'](_0x1add3f());break;default:_0x359eec['CmHopper'][_0x1dc9('0x26')]({'phone':_0x54e31d[_0x1dc9('0xb')],'ContactId':_0x54e31d['id'],'ListId':_0x54e31d['ListId'],'scheduledat':_0x54e31d[_0x1dc9('0x17')]?_0x54e31d[_0x1dc9('0x17')]:moment()[_0x1dc9('0x18')](_0x1dc9('0x21')),'priority':_0x54e31d[_0x1dc9('0x27')]?_0x54e31d[_0x1dc9('0x27')]:0x2,'callback':_0x54e31d[_0x1dc9('0x28')]?!![]:![],'callbackuniqueid':_0x54e31d[_0x1dc9('0x28')]?_0x54e31d['callbackUniqueid']:undefined,'callbackat':_0x54e31d[_0x1dc9('0x28')]?moment()[_0x1dc9('0x18')](_0x1dc9('0x21')):undefined,'CampaignId':_0x390f1b['id']})[_0x1dc9('0x29')](_0x1add3f());}}}});})[_0x1dc9('0x1d')](function(){return _0x359eec[_0x1dc9('0x2c')][_0x1dc9('0x3a')]({'attributes':['id'],'include':[{'model':_0x359eec['CmList'],'as':_0x1dc9('0x3d'),'where':{'id':_0x54e31d[_0x1dc9('0x32')]}}]})[_0x1dc9('0x1d')](function(_0x3f764e){if(_0x3f764e){var _0x15036d=[];for(var _0x599906=0x0,_0x277eae;_0x599906<_0x3f764e[_0x1dc9('0x36')];_0x599906+=0x1){_0x277eae=_0x3f764e[_0x599906][_0x1dc9('0x37')]({'plain':!![]});_0x359eec[_0x1dc9('0x3e')]['create']({'phone':_0x54e31d[_0x1dc9('0xb')],'ContactId':_0x54e31d['id'],'ListId':_0x54e31d['ListId'],'CampaignId':_0x277eae['id']})[_0x1dc9('0x29')](function(_0x4b54f4){logger[_0x1dc9('0x13')]('cmContact,\x20%s,\x20%s',_0x1dc9('0x15'),_0x4b54f4[_0x1dc9('0x3f')]);});}}});})[_0x1dc9('0x1d')](function(){_0x47acc3();})[_0x1dc9('0x29')](function(_0x10cfff){logger[_0x1dc9('0x13')](_0x1dc9('0x3b'),_0x1dc9('0x15'),_0x10cfff[_0x1dc9('0x3f')]);_0x47acc3(_0x10cfff);});}else{_0x47acc3(new Error(_0x1dc9('0x40')));}},'afterDestroy':function(_0x459663,_0x5c5a9f,_0x56df68){var _0x6534fd=_0x43c736['models'];var _0x753746=_0x459663[_0x1dc9('0x37')]({'plain':!![]});return _0x6534fd[_0x1dc9('0x23')][_0x1dc9('0x3a')]({'raw':!![],'where':{'ListId':_0x753746[_0x1dc9('0x32')],'ContactId':_0x753746['id']}})['then'](function(_0x1ddf0c){if(!_[_0x1dc9('0x41')](_0x1ddf0c)){var _0x197736=[];for(var _0x17522c=0x0;_0x17522c<_0x1ddf0c['length'];_0x17522c+=0x1){var _0x36314e=_0x6534fd['CmHopper'][_0x1dc9('0x42')]({'where':{'ListId':_0x1ddf0c[_0x17522c]['ListId'],'ContactId':_0x1ddf0c[_0x17522c]['ContactId'],'VoiceQueueId':_0x1ddf0c[_0x17522c]['VoiceQueueId'],'CampaignId':_0x1ddf0c[_0x17522c][_0x1dc9('0x43')]}});_0x197736[_0x1dc9('0x44')](_0x36314e);}return BPromise[_0x1dc9('0x45')](_0x197736);}})['then'](function(_0x4251ea){logger[_0x1dc9('0x46')]('[CmContact][afterDestroy][Succesfull]',util[_0x1dc9('0x16')](_0x4251ea,{'showHidden':![],'depth':null}));_0x56df68();})['catch'](function(_0x3d5c0c){logger[_0x1dc9('0x13')]('[CmContact][afterDestroy][Error]',util['inspect'](_0x3d5c0c,{'showHidden':![],'depth':null}));_0x56df68(_0x3d5c0c);});}}});}; \ No newline at end of file +var _0x1ec3=['findOne','isNil','dialTimezone','timezones','utcOffset','scheduledat','then','ret','CmHopper','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','ListId','priority','callbackUniqueid','catch','cmContact,\x20afterCreate\x20','\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','create','error','Campaign','add','minutes','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','outbound','dialCheckDuplicateType','CmList','Lists','length','always','onlyIfOpen','BlackLists','get','cmContact,\x20%s,\x20%s','message','findAll','CmHopperBlack','List\x20not\x20found','destroy','ContactId','CampaignId','push','info','[CmContact][afterDestroy][Succesfull]','inspect','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../config/environment/shared','./cmContact.attributes','exports','define','CmContact','cm_contacts','phone','fti_cm_contacts','firstName','mobile','fax','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','models','cmContact','afterCreate','format','YYYY-MM-DD\x20HH:mm:ss','VoiceQueue'];(function(_0x4ca188,_0x1b1b05){var _0x54626c=function(_0x58626d){while(--_0x58626d){_0x4ca188['push'](_0x4ca188['shift']());}};_0x54626c(++_0x1b1b05);}(_0x1ec3,0x7e));var _0x31ec=function(_0x2cf412,_0xeb2361){_0x2cf412=_0x2cf412-0x0;var _0x4bb8c9=_0x1ec3[_0x2cf412];return _0x4bb8c9;};'use strict';var _=require(_0x31ec('0x0'));var util=require(_0x31ec('0x1'));var logger=require(_0x31ec('0x2'))(_0x31ec('0x3'));var moment=require(_0x31ec('0x4'));var BPromise=require(_0x31ec('0x5'));var rp=require(_0x31ec('0x6'));var fs=require('fs');var path=require(_0x31ec('0x7'));var rimraf=require(_0x31ec('0x8'));var config=require(_0x31ec('0x9'));var shared=require(_0x31ec('0xa'));var attributes=require(_0x31ec('0xb'));module[_0x31ec('0xc')]=function(_0xa44fad,_0x27a673){return _0xa44fad[_0x31ec('0xd')](_0x31ec('0xe'),attributes,{'tableName':_0x31ec('0xf'),'paranoid':!![],'indexes':[{'name':_0x31ec('0x10'),'fields':['phone']},{'name':_0x31ec('0x11'),'fields':[_0x31ec('0x12'),'lastName',_0x31ec('0x10'),_0x31ec('0x13'),_0x31ec('0x14'),'email'],'type':_0x31ec('0x15')}],'timestamps':!![],'charset':_0x31ec('0x16'),'collate':_0x31ec('0x17'),'hooks':{'afterCreate':function(_0x111807,_0x51164e,_0x591f36){var _0x380619=_0xa44fad[_0x31ec('0x18')];var _0x512908=_0x111807['get']({'plain':!![]});function _0x137e18(){return function(_0x2508ee){logger['error'](_0x31ec('0x19'),_0x31ec('0x1a'),util['inspect'](_0x2508ee,{'showHidden':![],'depth':null}));};}function _0x4c00b8(_0x4ae2b4,_0x20e7a2){var _0x3fde5d=_0x20e7a2['scheduledat']?_0x20e7a2['scheduledat']:moment()[_0x31ec('0x1b')](_0x31ec('0x1c'));return new BPromise(function(_0x1414f7,_0x53a563){if(_['isNil'](_0x20e7a2['dialTimezone'])){_0x1414f7({'ret':_0x3fde5d});}else{_0x380619[_0x31ec('0x1d')][_0x31ec('0x1e')]({'where':{'id':_0x4ae2b4['id']}})['then'](function(_0x1f68e9){if(!_[_0x31ec('0x1f')](_0x1f68e9)){var _0x3bd34d=_0x1f68e9[_0x31ec('0x20')];if(!_[_0x31ec('0x1f')](_0x3bd34d)){var _0x5d3712=shared[_0x31ec('0x21')];var _0x598e24=_0x5d3712[_0x3bd34d];var _0x2b9852=_0x5d3712[_0x20e7a2[_0x31ec('0x20')]];if(!_[_0x31ec('0x1f')](_0x598e24)&&!_[_0x31ec('0x1f')](_0x2b9852)){var _0x145f58=_0x598e24[_0x31ec('0x22')]-_0x2b9852[_0x31ec('0x22')];_0x3fde5d=_0x20e7a2[_0x31ec('0x23')]?_0x20e7a2[_0x31ec('0x23')]:moment();var _0xd2cff1=moment(_0x3fde5d)['add'](_0x145f58,'minutes');_0x1414f7({'ret':_0xd2cff1['format']('YYYY-MM-DD\x20HH:mm:ss')});}else _0x1414f7({'ret':_0x3fde5d});}else _0x1414f7({'ret':_0x3fde5d});}else{_0x1414f7({'ret':_0x3fde5d});}});}});return 0xa;}var _0x486614=function(_0x1863cf){return new BPromise(function(_0xde1ff5,_0x25962b){_0x4c00b8(_0x1863cf,_0x512908)[_0x31ec('0x24')](function(_0x190c90){_0x512908['scheduledat']=_0x190c90[_0x31ec('0x25')];_0x380619[_0x31ec('0x26')][_0x31ec('0x1e')]({'where':{'phone':_0x512908[_0x31ec('0x10')],'VoiceQueueId':_0x1863cf['id']}})[_0x31ec('0x24')](function(_0x299e7a){if(!_['isNil'](_0x299e7a)){throw new Error('cmContact,\x20afterCreate\x20'+_0x512908[_0x31ec('0x10')]+_0x31ec('0x27')+_0x1863cf['id']);}return _0x380619[_0x31ec('0x26')]['create']({'phone':_0x512908[_0x31ec('0x10')],'ContactId':_0x512908['id'],'ListId':_0x512908[_0x31ec('0x28')],'priority':_0x512908[_0x31ec('0x29')]?_0x512908[_0x31ec('0x29')]:0x2,'scheduledat':_0x512908[_0x31ec('0x23')]?_0x512908[_0x31ec('0x23')]:moment()[_0x31ec('0x1b')](_0x31ec('0x1c')),'callback':_0x512908['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x512908['callbackUniqueid']?_0x512908[_0x31ec('0x2a')]:undefined,'callbackat':_0x512908[_0x31ec('0x2a')]?moment()['format'](_0x31ec('0x1c')):undefined,'VoiceQueueId':_0x1863cf['id']});})[_0x31ec('0x2b')](function(_0x150b92){_0x25962b(_0x150b92);});});});};var _0xf71dad=function(_0x3793ce){return new BPromise(function(_0x569338,_0x25f5b1){_0x4c00b8(_0x3793ce,_0x512908)[_0x31ec('0x24')](function(_0x51772c){_0x512908[_0x31ec('0x23')]=_0x51772c[_0x31ec('0x25')];_0x380619[_0x31ec('0x26')][_0x31ec('0x1e')]({'where':{'phone':_0x512908[_0x31ec('0x10')],'VoiceQueueId':_0x3793ce['id']}})['then'](function(_0x824b62){if(!_[_0x31ec('0x1f')](_0x824b62)){throw new Error(_0x31ec('0x2c')+_0x512908[_0x31ec('0x10')]+_0x31ec('0x2d')+_0x3793ce['id']);}return _0x380619[_0x31ec('0x2e')][_0x31ec('0x1e')]({'where':{'calleridnum':_0x512908[_0x31ec('0x10')],'VoiceQueueId':_0x3793ce['id']}});})[_0x31ec('0x24')](function(_0x18724c){if(!_[_0x31ec('0x1f')](_0x18724c)){throw new Error(_0x31ec('0x2f')+_0x512908[_0x31ec('0x10')]+_0x31ec('0x30')+_0x3793ce['id']);}return _0x380619[_0x31ec('0x26')][_0x31ec('0x31')]({'phone':_0x512908['phone'],'ContactId':_0x512908['id'],'ListId':_0x512908[_0x31ec('0x28')],'priority':_0x512908[_0x31ec('0x29')]?_0x512908[_0x31ec('0x29')]:0x2,'scheduledat':_0x512908[_0x31ec('0x23')]?_0x512908[_0x31ec('0x23')]:moment()[_0x31ec('0x1b')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x512908[_0x31ec('0x2a')]?!![]:![],'callbackuniqueid':_0x512908['callbackUniqueid']?_0x512908[_0x31ec('0x2a')]:undefined,'callbackat':_0x512908[_0x31ec('0x2a')]?moment()[_0x31ec('0x1b')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x3793ce['id']});})[_0x31ec('0x2b')](function(_0x4f6af8){_0x25f5b1(_0x4f6af8);});});});};function _0x360480(){return function(_0x206bb6){logger[_0x31ec('0x32')](_0x31ec('0x19'),'afterCreate',util['inspect'](_0x206bb6,{'showHidden':![],'depth':null}));};}function _0x4a6a35(_0x334959,_0x5b328d){var _0x5c96b0=_0x5b328d[_0x31ec('0x23')]?_0x5b328d[_0x31ec('0x23')]:moment()[_0x31ec('0x1b')](_0x31ec('0x1c'));return new BPromise(function(_0x1a3f38,_0x26cb68){if(_[_0x31ec('0x1f')](_0x5b328d[_0x31ec('0x20')])){_0x1a3f38({'ret':_0x5c96b0});}else{_0x380619[_0x31ec('0x33')][_0x31ec('0x1e')]({'where':{'id':_0x334959['id']}})[_0x31ec('0x24')](function(_0x512b81){if(!_['isNil'](_0x512b81)){var _0x18efe8=_0x512b81[_0x31ec('0x20')];if(!_['isNil'](_0x18efe8)){var _0x5b4208=shared[_0x31ec('0x21')];var _0x2d628d=_0x5b4208[_0x18efe8];var _0x229251=_0x5b4208[_0x5b328d[_0x31ec('0x20')]];if(!_['isNil'](_0x2d628d)&&!_[_0x31ec('0x1f')](_0x229251)){var _0x59f826=_0x2d628d[_0x31ec('0x22')]-_0x229251[_0x31ec('0x22')];_0x5c96b0=_0x5b328d['scheduledat']?_0x5b328d[_0x31ec('0x23')]:moment();var _0x257a08=moment(_0x5c96b0)[_0x31ec('0x34')](_0x59f826,_0x31ec('0x35'));_0x1a3f38({'ret':_0x257a08[_0x31ec('0x1b')](_0x31ec('0x1c'))});}else _0x1a3f38({'ret':_0x5c96b0});}else _0x1a3f38({'ret':_0x5c96b0});}else{_0x1a3f38({'ret':_0x5c96b0});}});}});return 0xa;}var _0x4f40ac=function(_0x178f44){return new BPromise(function(_0x123e17,_0x30ccef){_0x4a6a35(_0x178f44,_0x512908)['then'](function(_0x27e1ab){_0x512908[_0x31ec('0x23')]=_0x27e1ab['ret'];_0x380619[_0x31ec('0x26')][_0x31ec('0x1e')]({'where':{'phone':_0x512908[_0x31ec('0x10')],'CampaignId':_0x178f44['id']}})[_0x31ec('0x24')](function(_0x31fa8c){if(!_[_0x31ec('0x1f')](_0x31fa8c)){throw new Error(_0x31ec('0x2c')+_0x512908['phone']+_0x31ec('0x36')+_0x178f44['id']);}return _0x380619[_0x31ec('0x26')]['create']({'phone':_0x512908[_0x31ec('0x10')],'ContactId':_0x512908['id'],'ListId':_0x512908['ListId'],'priority':_0x512908[_0x31ec('0x29')]?_0x512908['priority']:0x2,'scheduledat':_0x512908[_0x31ec('0x23')]?_0x512908[_0x31ec('0x23')]:moment()[_0x31ec('0x1b')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x512908[_0x31ec('0x2a')]?!![]:![],'callbackuniqueid':_0x512908['callbackUniqueid']?_0x512908['callbackUniqueid']:undefined,'callbackat':_0x512908[_0x31ec('0x2a')]?moment()[_0x31ec('0x1b')](_0x31ec('0x1c')):undefined,'CampaignId':_0x178f44['id']});})[_0x31ec('0x2b')](function(_0xbe0638){_0x30ccef(_0xbe0638);});});});};var _0x30127a=function(_0x4eaa6a){return new BPromise(function(_0xb01edd,_0x57ac07){_0x4a6a35(_0x4eaa6a,_0x512908)[_0x31ec('0x24')](function(_0x5e1267){_0x512908[_0x31ec('0x23')]=_0x5e1267[_0x31ec('0x25')];_0x380619[_0x31ec('0x26')]['findOne']({'where':{'phone':_0x512908[_0x31ec('0x10')],'CampaignId':_0x4eaa6a['id']}})[_0x31ec('0x24')](function(_0x474dbb){if(!_[_0x31ec('0x1f')](_0x474dbb)){throw new Error(_0x31ec('0x2c')+_0x512908['phone']+_0x31ec('0x37')+_0x4eaa6a['id']);}return _0x380619[_0x31ec('0x2e')]['findOne']({'where':{'calleridnum':_0x512908[_0x31ec('0x10')],'CampaignId':_0x4eaa6a['id']}});})[_0x31ec('0x24')](function(_0x4bc560){if(!_[_0x31ec('0x1f')](_0x4bc560)){throw new Error(_0x31ec('0x2f')+_0x512908[_0x31ec('0x10')]+_0x31ec('0x38')+_0x4eaa6a['id']);}return _0x380619[_0x31ec('0x26')][_0x31ec('0x31')]({'phone':_0x512908[_0x31ec('0x10')],'ContactId':_0x512908['id'],'ListId':_0x512908[_0x31ec('0x28')],'priority':_0x512908[_0x31ec('0x29')]?_0x512908[_0x31ec('0x29')]:0x2,'scheduledat':_0x512908[_0x31ec('0x23')]?_0x512908[_0x31ec('0x23')]:moment()[_0x31ec('0x1b')](_0x31ec('0x1c')),'callback':_0x512908[_0x31ec('0x2a')]?!![]:![],'callbackuniqueid':_0x512908[_0x31ec('0x2a')]?_0x512908[_0x31ec('0x2a')]:undefined,'callbackat':_0x512908[_0x31ec('0x2a')]?moment()[_0x31ec('0x1b')](_0x31ec('0x1c')):undefined,'CampaignId':_0x4eaa6a['id']});})[_0x31ec('0x2b')](function(_0x2567c6){_0x57ac07(_0x2567c6);});});});};if(_0x512908[_0x31ec('0x28')]){_0x380619[_0x31ec('0x1d')]['findAll']({'where':{'type':_0x31ec('0x39')},'attributes':['id',_0x31ec('0x3a'),_0x31ec('0x20')],'include':[{'model':_0x380619[_0x31ec('0x3b')],'as':_0x31ec('0x3c'),'where':{'id':_0x512908[_0x31ec('0x28')]}}]})[_0x31ec('0x24')](function(_0x12b24a){if(_0x12b24a){var _0x4b2014=[];for(var _0xf650cc=0x0,_0x6c8397;_0xf650cc<_0x12b24a[_0x31ec('0x3d')];_0xf650cc+=0x1){_0x6c8397=_0x12b24a[_0xf650cc]['get']({'plain':!![]});switch(_0x6c8397[_0x31ec('0x3a')]){case _0x31ec('0x3e'):_0xf71dad(_0x6c8397)['catch'](_0x137e18());break;case _0x31ec('0x3f'):_0x486614(_0x6c8397)[_0x31ec('0x2b')](_0x137e18());break;default:_0x4a6a35(_0x6c8397,_0x512908)[_0x31ec('0x24')](function(_0x9d2bc){_0x512908['scheduledat']=_0x9d2bc[_0x31ec('0x25')];_0x380619['CmHopper'][_0x31ec('0x31')]({'phone':_0x512908[_0x31ec('0x10')],'ContactId':_0x512908['id'],'ListId':_0x512908['ListId'],'scheduledat':_0x512908[_0x31ec('0x23')]?_0x512908[_0x31ec('0x23')]:moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x512908['priority']?_0x512908['priority']:0x2,'callback':_0x512908[_0x31ec('0x2a')]?!![]:![],'callbackuniqueid':_0x512908[_0x31ec('0x2a')]?_0x512908[_0x31ec('0x2a')]:undefined,'callbackat':_0x512908[_0x31ec('0x2a')]?moment()['format'](_0x31ec('0x1c')):undefined,'VoiceQueueId':_0x6c8397['id']})[_0x31ec('0x2b')](_0x137e18());});}}}})[_0x31ec('0x24')](function(){return _0x380619['VoiceQueue']['findAll']({'where':{'type':_0x31ec('0x39')},'attributes':['id'],'include':[{'model':_0x380619[_0x31ec('0x3b')],'as':_0x31ec('0x40'),'where':{'id':_0x512908['ListId']}}]})['then'](function(_0x1941a6){if(_0x1941a6){var _0x357fef=[];for(var _0x5d9d68=0x0,_0x3e2408;_0x5d9d68<_0x1941a6[_0x31ec('0x3d')];_0x5d9d68+=0x1){_0x3e2408=_0x1941a6[_0x5d9d68][_0x31ec('0x41')]({'plain':!![]});_0x380619['CmHopperBlack'][_0x31ec('0x31')]({'phone':_0x512908[_0x31ec('0x10')],'ContactId':_0x512908['id'],'ListId':_0x512908['ListId'],'VoiceQueueId':_0x3e2408['id']})[_0x31ec('0x2b')](function(_0x47f204){logger['error'](_0x31ec('0x42'),_0x31ec('0x1a'),_0x47f204[_0x31ec('0x43')]);});}}});})[_0x31ec('0x24')](function(){return _0x380619[_0x31ec('0x33')][_0x31ec('0x44')]({'attributes':['id',_0x31ec('0x3a'),'dialTimezone'],'include':[{'model':_0x380619['CmList'],'as':_0x31ec('0x3c'),'where':{'id':_0x512908[_0x31ec('0x28')]}}]})[_0x31ec('0x24')](function(_0x2d691c){if(_0x2d691c){var _0x1d1c55=[];for(var _0xa74f05=0x0,_0x39239b;_0xa74f05<_0x2d691c[_0x31ec('0x3d')];_0xa74f05+=0x1){_0x39239b=_0x2d691c[_0xa74f05][_0x31ec('0x41')]({'plain':!![]});switch(_0x39239b[_0x31ec('0x3a')]){case'always':_0x30127a(_0x39239b)[_0x31ec('0x2b')](_0x360480());break;case _0x31ec('0x3f'):_0x4f40ac(_0x39239b)[_0x31ec('0x2b')](_0x360480());break;default:_0x380619[_0x31ec('0x26')]['create']({'phone':_0x512908['phone'],'ContactId':_0x512908['id'],'ListId':_0x512908[_0x31ec('0x28')],'scheduledat':_0x512908[_0x31ec('0x23')]?_0x512908[_0x31ec('0x23')]:moment()[_0x31ec('0x1b')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x512908[_0x31ec('0x29')]?_0x512908[_0x31ec('0x29')]:0x2,'callback':_0x512908[_0x31ec('0x2a')]?!![]:![],'callbackuniqueid':_0x512908[_0x31ec('0x2a')]?_0x512908[_0x31ec('0x2a')]:undefined,'callbackat':_0x512908[_0x31ec('0x2a')]?moment()[_0x31ec('0x1b')](_0x31ec('0x1c')):undefined,'CampaignId':_0x39239b['id']})[_0x31ec('0x2b')](_0x360480());}}}});})[_0x31ec('0x24')](function(){return _0x380619['Campaign'][_0x31ec('0x44')]({'attributes':['id'],'include':[{'model':_0x380619[_0x31ec('0x3b')],'as':_0x31ec('0x40'),'where':{'id':_0x512908[_0x31ec('0x28')]}}]})[_0x31ec('0x24')](function(_0x27e3c3){if(_0x27e3c3){var _0x3028a5=[];for(var _0x29565b=0x0,_0x169ac5;_0x29565b<_0x27e3c3[_0x31ec('0x3d')];_0x29565b+=0x1){_0x169ac5=_0x27e3c3[_0x29565b]['get']({'plain':!![]});_0x380619[_0x31ec('0x45')][_0x31ec('0x31')]({'phone':_0x512908[_0x31ec('0x10')],'ContactId':_0x512908['id'],'ListId':_0x512908[_0x31ec('0x28')],'CampaignId':_0x169ac5['id']})['catch'](function(_0x122b22){logger[_0x31ec('0x32')](_0x31ec('0x42'),'afterCreate',_0x122b22[_0x31ec('0x43')]);});}}});})[_0x31ec('0x24')](function(){_0x591f36();})['catch'](function(_0x50849a){logger[_0x31ec('0x32')](_0x31ec('0x42'),_0x31ec('0x1a'),_0x50849a['message']);_0x591f36(_0x50849a);});}else{_0x591f36(new Error(_0x31ec('0x46')));}},'afterDestroy':function(_0x294870,_0x474c6e,_0x5006b3){var _0x3c4fe0=_0xa44fad[_0x31ec('0x18')];var _0x172d32=_0x294870[_0x31ec('0x41')]({'plain':!![]});return _0x3c4fe0['CmHopper'][_0x31ec('0x44')]({'raw':!![],'where':{'ListId':_0x172d32[_0x31ec('0x28')],'ContactId':_0x172d32['id']}})[_0x31ec('0x24')](function(_0x64524d){if(!_['isEmpty'](_0x64524d)){var _0x48dd38=[];for(var _0x2a69d2=0x0;_0x2a69d2<_0x64524d[_0x31ec('0x3d')];_0x2a69d2+=0x1){var _0x575828=_0x3c4fe0[_0x31ec('0x26')][_0x31ec('0x47')]({'where':{'ListId':_0x64524d[_0x2a69d2][_0x31ec('0x28')],'ContactId':_0x64524d[_0x2a69d2][_0x31ec('0x48')],'VoiceQueueId':_0x64524d[_0x2a69d2]['VoiceQueueId'],'CampaignId':_0x64524d[_0x2a69d2][_0x31ec('0x49')]}});_0x48dd38[_0x31ec('0x4a')](_0x575828);}return BPromise['all'](_0x48dd38);}})[_0x31ec('0x24')](function(_0x2b12af){logger[_0x31ec('0x4b')](_0x31ec('0x4c'),util[_0x31ec('0x4d')](_0x2b12af,{'showHidden':![],'depth':null}));_0x5006b3();})['catch'](function(_0x1dcb32){logger['error']('[CmContact][afterDestroy][Error]',util[_0x31ec('0x4d')](_0x1dcb32,{'showHidden':![],'depth':null}));_0x5006b3(_0x1dcb32);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index 702fe94..ba91861 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(_0x46acf9,_0x333a48){var _0x245e63=function(_0x5592a0){while(--_0x5592a0){_0x46acf9['push'](_0x46acf9['shift']());}};_0x245e63(++_0x333a48);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var 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(_0x3db7fd,_0x2cb46a){var _0x301ef8=function(_0x3d633d){while(--_0x3d633d){_0x3db7fd['push'](_0x3db7fd['shift']());}};_0x301ef8(++_0x2cb46a);}(_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['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 254c4e3..c500aec 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 _0x3657=['STRING','PHONE','sequelize','exports','INTEGER'];(function(_0x274dd7,_0x2e6051){var _0x148829=function(_0x4cec98){while(--_0x4cec98){_0x274dd7['push'](_0x274dd7['shift']());}};_0x148829(++_0x2e6051);}(_0x3657,0x183));var _0x7365=function(_0x3dd0b9,_0x1d6c92){_0x3dd0b9=_0x3dd0b9-0x0;var _0x4c0351=_0x3657[_0x3dd0b9];return _0x4c0351;};'use strict';var Sequelize=require(_0x7365('0x0'));module[_0x7365('0x1')]={'CmContactId':{'type':Sequelize[_0x7365('0x2')],'primaryKey':!![]},'item':{'type':Sequelize['STRING'],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x7365('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x7365('0x3')],'defaultValue':_0x7365('0x4')},'OrderBy':{'type':Sequelize[_0x7365('0x2')],'defaultValue':null},'description':{'type':Sequelize['STRING'],'defaultValue':null}}; \ No newline at end of file +var _0x502a=['sequelize','exports','STRING','INTEGER'];(function(_0x1f90e4,_0x1a192d){var _0x5cc8d2=function(_0x242918){while(--_0x242918){_0x1f90e4['push'](_0x1f90e4['shift']());}};_0x5cc8d2(++_0x1a192d);}(_0x502a,0xd8));var _0xa502=function(_0x5ab928,_0x988025){_0x5ab928=_0x5ab928-0x0;var _0x297c7a=_0x502a[_0x5ab928];return _0x297c7a;};'use strict';var Sequelize=require(_0xa502('0x0'));module[_0xa502('0x1')]={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize[_0xa502('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xa502('0x3')],'defaultValue':null},'ItemClass':{'type':Sequelize['STRING'],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize[_0xa502('0x3')],'defaultValue':null},'description':{'type':Sequelize['STRING'],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index 04b4186..af16624 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 _0x1aa6=['sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../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','count','set','Content-Range','reject','update','then','destroy','get','CmContactHasItems','UserProfileResource','sendStatus','error','stack','name','send','index','CmContactHasItem','rawAttributes','type','key','query','filters','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','map','VIRTUAL','filter','merge','includeAll','include','rows','catch','params','intersection','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x30f07a,_0x98341){var _0xb38461=function(_0x7b287a){while(--_0x7b287a){_0x30f07a['push'](_0x30f07a['shift']());}};_0xb38461(++_0x98341);}(_0x1aa6,0xa1));var _0x61aa=function(_0x2ac71a,_0x1d2a02){_0x2ac71a=_0x2ac71a-0x0;var _0x3ee904=_0x1aa6[_0x2ac71a];return _0x3ee904;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x61aa('0x0'));var rp=require(_0x61aa('0x1'));var moment=require(_0x61aa('0x2'));var BPromise=require(_0x61aa('0x3'));var Mustache=require(_0x61aa('0x4'));var util=require(_0x61aa('0x5'));var path=require(_0x61aa('0x6'));var sox=require(_0x61aa('0x7'));var csv=require(_0x61aa('0x8'));var ejs=require(_0x61aa('0x9'));var fs=require('fs');var fs_extra=require(_0x61aa('0xa'));var _=require(_0x61aa('0xb'));var squel=require(_0x61aa('0xc'));var crypto=require(_0x61aa('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x61aa('0x8'));var querystring=require(_0x61aa('0xe'));var Papa=require(_0x61aa('0xf'));var Redis=require('ioredis');var authService=require(_0x61aa('0x10'));var qs=require(_0x61aa('0x11'));var as=require(_0x61aa('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x61aa('0x13'))(_0x61aa('0x14'));var utils=require(_0x61aa('0x15'));var config=require(_0x61aa('0x16'));var licenseUtil=require(_0x61aa('0x17'));var db=require(_0x61aa('0x18'))['db'];function respondWithStatusCode(_0xcd386f,_0x77114f){_0x77114f=_0x77114f||0xcc;return function(_0x44a375){if(_0x44a375){return _0xcd386f['sendStatus'](_0x77114f);}return _0xcd386f[_0x61aa('0x19')](_0x77114f)[_0x61aa('0x1a')]();};}function respondWithResult(_0x2313d4,_0xae4713){_0xae4713=_0xae4713||0xc8;return function(_0x3307aa){if(_0x3307aa){return _0x2313d4[_0x61aa('0x19')](_0xae4713)[_0x61aa('0x1b')](_0x3307aa);}};}function respondWithFilteredResult(_0xff4c4b,_0x152741){return function(_0x63cde4){if(_0x63cde4){var _0x202c99=typeof _0x152741[_0x61aa('0x1c')]==='undefined'&&typeof _0x152741['limit']===_0x61aa('0x1d');var _0x13a688=_0x63cde4['count'];var _0x591ba2=_0x202c99?0x0:_0x152741[_0x61aa('0x1c')];var _0x51f39a=_0x202c99?_0x63cde4[_0x61aa('0x1e')]:_0x152741[_0x61aa('0x1c')]+_0x152741['limit'];var _0x36dc91;if(_0x51f39a>=_0x13a688){_0x51f39a=_0x13a688;_0x36dc91=0xc8;}else{_0x36dc91=0xce;}_0xff4c4b[_0x61aa('0x19')](_0x36dc91);return _0xff4c4b[_0x61aa('0x1f')](_0x61aa('0x20'),_0x591ba2+'-'+_0x51f39a+'/'+_0x13a688)[_0x61aa('0x1b')](_0x63cde4);}return null;};}function patchUpdates(_0x39bc99){return function(_0xb740f8){try{jsonpatch['apply'](_0xb740f8,_0x39bc99,!![]);}catch(_0x1620a1){return BPromise[_0x61aa('0x21')](_0x1620a1);}return _0xb740f8['save']();};}function saveUpdates(_0x41ca55,_0x78e94b){return function(_0x1fd77a){if(_0x1fd77a){return _0x1fd77a[_0x61aa('0x22')](_0x41ca55)[_0x61aa('0x23')](function(_0x2cce7c){return _0x2cce7c;});}return null;};}function removeEntity(_0x59ec66,_0x3b052c){return function(_0x24363f){if(_0x24363f){return _0x24363f[_0x61aa('0x24')]()[_0x61aa('0x23')](function(){var _0x5f34cc=_0x24363f[_0x61aa('0x25')]({'plain':!![]});var _0x4e0974=_0x61aa('0x26');return db[_0x61aa('0x27')]['destroy']({'where':{'type':_0x4e0974,'resourceId':_0x5f34cc['id']}})[_0x61aa('0x23')](function(){return _0x24363f;});})[_0x61aa('0x23')](function(){_0x59ec66['status'](0xcc)[_0x61aa('0x1a')]();});}};}function handleEntityNotFound(_0x149de4,_0x3d0e64){return function(_0x449883){if(!_0x449883){_0x149de4[_0x61aa('0x28')](0x194);}return _0x449883;};}function handleError(_0x14ba4b,_0x3578c4){_0x3578c4=_0x3578c4||0x1f4;return function(_0x169278){logger[_0x61aa('0x29')](_0x169278[_0x61aa('0x2a')]);if(_0x169278[_0x61aa('0x2b')]){delete _0x169278[_0x61aa('0x2b')];}_0x14ba4b[_0x61aa('0x19')](_0x3578c4)[_0x61aa('0x2c')](_0x169278);};}exports[_0x61aa('0x2d')]=function(_0x4494c8,_0x5bea49){var _0x42b74b={},_0x1a5a91={},_0x50afa4={'count':0x0,'rows':[]};var _0xac3e74=_['map'](db[_0x61aa('0x2e')][_0x61aa('0x2f')],function(_0x237379){return{'name':_0x237379['fieldName'],'type':_0x237379[_0x61aa('0x30')][_0x61aa('0x31')]};});_0x1a5a91['model']=_['map'](_0xac3e74,_0x61aa('0x2b'));_0x1a5a91[_0x61aa('0x32')]=_['keys'](_0x4494c8['query']);_0x1a5a91[_0x61aa('0x33')]=_['intersection'](_0x1a5a91[_0x61aa('0x34')],_0x1a5a91[_0x61aa('0x32')]);_0x42b74b[_0x61aa('0x35')]=_['intersection'](_0x1a5a91['model'],qs[_0x61aa('0x36')](_0x4494c8[_0x61aa('0x32')]['fields']));_0x42b74b[_0x61aa('0x35')]=_0x42b74b[_0x61aa('0x35')][_0x61aa('0x37')]?_0x42b74b[_0x61aa('0x35')]:_0x1a5a91['model'];if(!_0x4494c8[_0x61aa('0x32')][_0x61aa('0x38')](_0x61aa('0x39'))){_0x42b74b[_0x61aa('0x3a')]=qs['limit'](_0x4494c8[_0x61aa('0x32')][_0x61aa('0x3a')]);_0x42b74b['offset']=qs[_0x61aa('0x1c')](_0x4494c8[_0x61aa('0x32')]['offset']);}_0x42b74b[_0x61aa('0x3b')]=qs['sort'](_0x4494c8[_0x61aa('0x32')][_0x61aa('0x3c')]);_0x42b74b[_0x61aa('0x3d')]=qs[_0x61aa('0x33')](_[_0x61aa('0x3e')](_0x4494c8['query'],_0x1a5a91[_0x61aa('0x33')]),_0xac3e74);if(_0x4494c8['query']['filter']){_0x42b74b[_0x61aa('0x3d')]=_['merge'](_0x42b74b[_0x61aa('0x3d')],{'$or':_[_0x61aa('0x3f')](_0xac3e74,function(_0xc0b185){if(_0xc0b185[_0x61aa('0x30')]!==_0x61aa('0x40')){var _0x450e5c={};_0x450e5c[_0xc0b185[_0x61aa('0x2b')]]={'$like':'%'+_0x4494c8[_0x61aa('0x32')][_0x61aa('0x41')]+'%'};return _0x450e5c;}})});}_0x42b74b=_[_0x61aa('0x42')]({},_0x42b74b,_0x4494c8['options']);var _0x334912={'where':_0x42b74b['where']};return db[_0x61aa('0x2e')][_0x61aa('0x1e')](_0x334912)[_0x61aa('0x23')](function(_0x4f79dc){_0x50afa4['count']=_0x4f79dc;if(_0x4494c8['query'][_0x61aa('0x43')]){_0x42b74b[_0x61aa('0x44')]=[{'all':!![]}];}return db['CmContactHasItem']['findAll'](_0x42b74b);})[_0x61aa('0x23')](function(_0x56c5ee){_0x50afa4[_0x61aa('0x45')]=_0x56c5ee;return _0x50afa4;})[_0x61aa('0x23')](respondWithFilteredResult(_0x5bea49,_0x42b74b))[_0x61aa('0x46')](handleError(_0x5bea49,null));};exports['show']=function(_0x1ba3af,_0x3779ea){var _0x3bf7a4={'raw':!![],'where':{'id':_0x1ba3af[_0x61aa('0x47')]['id']}},_0x25b5a2={};_0x25b5a2[_0x61aa('0x34')]=_['keys'](db[_0x61aa('0x2e')][_0x61aa('0x2f')]);_0x25b5a2[_0x61aa('0x32')]=_['keys'](_0x1ba3af['query']);_0x25b5a2[_0x61aa('0x33')]=_['intersection'](_0x25b5a2[_0x61aa('0x34')],_0x25b5a2[_0x61aa('0x32')]);_0x3bf7a4[_0x61aa('0x35')]=_[_0x61aa('0x48')](_0x25b5a2[_0x61aa('0x34')],qs[_0x61aa('0x36')](_0x1ba3af[_0x61aa('0x32')][_0x61aa('0x36')]));_0x3bf7a4[_0x61aa('0x35')]=_0x3bf7a4['attributes']['length']?_0x3bf7a4[_0x61aa('0x35')]:_0x25b5a2[_0x61aa('0x34')];if(_0x1ba3af[_0x61aa('0x32')][_0x61aa('0x43')]){_0x3bf7a4['include']=[{'all':!![]}];}_0x3bf7a4=_[_0x61aa('0x42')]({},_0x3bf7a4,_0x1ba3af[_0x61aa('0x49')]);return db[_0x61aa('0x2e')][_0x61aa('0x4a')](_0x3bf7a4)[_0x61aa('0x23')](handleEntityNotFound(_0x3779ea,null))['then'](respondWithResult(_0x3779ea,null))['catch'](handleError(_0x3779ea,null));};exports[_0x61aa('0x4b')]=function(_0x211fdf,_0x212586){return db[_0x61aa('0x2e')]['create'](_0x211fdf[_0x61aa('0x4c')],{})['then'](function(_0x1b9d36){var _0xf2d6e5=_0x211fdf[_0x61aa('0x4d')][_0x61aa('0x25')]({'plain':!![]});if(!_0xf2d6e5)throw new Error(_0x61aa('0x4e'));if(_0xf2d6e5[_0x61aa('0x4f')]===_0x61aa('0x4d')){var _0xf4e3da=_0x1b9d36['get']({'plain':!![]});var _0xe7ec55=_0x61aa('0x26');return db[_0x61aa('0x50')]['find']({'where':{'name':_0xe7ec55,'userProfileId':_0xf2d6e5[_0x61aa('0x51')]},'raw':!![]})[_0x61aa('0x23')](function(_0x5e57bd){if(_0x5e57bd&&_0x5e57bd[_0x61aa('0x52')]===0x0){return db[_0x61aa('0x27')][_0x61aa('0x4b')]({'name':_0xf4e3da[_0x61aa('0x2b')],'resourceId':_0xf4e3da['id'],'type':_0x5e57bd[_0x61aa('0x2b')],'sectionId':_0x5e57bd['id']},{})['then'](function(){return _0x1b9d36;});}else{return _0x1b9d36;}})[_0x61aa('0x46')](function(_0xafcfd7){logger[_0x61aa('0x29')](_0x61aa('0x53'),_0xafcfd7);throw _0xafcfd7;});}return _0x1b9d36;})['then'](respondWithResult(_0x212586,0xc9))[_0x61aa('0x46')](handleError(_0x212586,null));};exports['update']=function(_0x1b5926,_0x3c3182){if(_0x1b5926['body']['id']){delete _0x1b5926[_0x61aa('0x4c')]['id'];}return db[_0x61aa('0x2e')][_0x61aa('0x4a')]({'where':{'id':_0x1b5926[_0x61aa('0x47')]['id']}})['then'](handleEntityNotFound(_0x3c3182,null))[_0x61aa('0x23')](saveUpdates(_0x1b5926['body'],null))[_0x61aa('0x23')](respondWithResult(_0x3c3182,null))['catch'](handleError(_0x3c3182,null));};exports['destroy']=function(_0x31d440,_0x82d206){return db['CmContactHasItem']['find']({'where':{'id':_0x31d440[_0x61aa('0x47')]['id']}})[_0x61aa('0x23')](handleEntityNotFound(_0x82d206,null))[_0x61aa('0x23')](removeEntity(_0x82d206,null))[_0x61aa('0x46')](handleError(_0x82d206,null));}; \ No newline at end of file +var _0xa393=['sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','fields','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/utils','../../config/license/util','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','reject','save','then','destroy','CmContactHasItems','UserProfileResource','error','stack','send','index','map','CmContactHasItem','rawAttributes','fieldName','type','model','name','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order'];(function(_0x584a8f,_0x374ca4){var _0x464df9=function(_0x3630c9){while(--_0x3630c9){_0x584a8f['push'](_0x584a8f['shift']());}};_0x464df9(++_0x374ca4);}(_0xa393,0x107));var _0x3a39=function(_0xda464c,_0x26e47d){_0xda464c=_0xda464c-0x0;var _0x19e222=_0xa393[_0xda464c];return _0x19e222;};'use strict';var emlformat=require(_0x3a39('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3a39('0x1'));var jsonpatch=require(_0x3a39('0x2'));var rp=require(_0x3a39('0x3'));var moment=require(_0x3a39('0x4'));var BPromise=require(_0x3a39('0x5'));var Mustache=require(_0x3a39('0x6'));var util=require('util');var path=require(_0x3a39('0x7'));var sox=require('sox');var csv=require(_0x3a39('0x8'));var ejs=require(_0x3a39('0x9'));var fs=require('fs');var fs_extra=require(_0x3a39('0xa'));var _=require(_0x3a39('0xb'));var squel=require(_0x3a39('0xc'));var crypto=require(_0x3a39('0xd'));var jsforce=require(_0x3a39('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3a39('0xf'));var Papa=require(_0x3a39('0x10'));var Redis=require(_0x3a39('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3a39('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x3a39('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x3a39('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x27b8f4,_0x3e8d77){_0x3e8d77=_0x3e8d77||0xcc;return function(_0x5db9af){if(_0x5db9af){return _0x27b8f4[_0x3a39('0x15')](_0x3e8d77);}return _0x27b8f4[_0x3a39('0x16')](_0x3e8d77)[_0x3a39('0x17')]();};}function respondWithResult(_0x1346a0,_0x1f85e5){_0x1f85e5=_0x1f85e5||0xc8;return function(_0x2a1194){if(_0x2a1194){return _0x1346a0[_0x3a39('0x16')](_0x1f85e5)['json'](_0x2a1194);}};}function respondWithFilteredResult(_0x4e9ceb,_0x2a7afa){return function(_0x14242c){if(_0x14242c){var _0x46fa9c=typeof _0x2a7afa[_0x3a39('0x18')]==='undefined'&&typeof _0x2a7afa[_0x3a39('0x19')]===_0x3a39('0x1a');var _0x52026d=_0x14242c[_0x3a39('0x1b')];var _0x227b80=_0x46fa9c?0x0:_0x2a7afa[_0x3a39('0x18')];var _0x38e072=_0x46fa9c?_0x14242c['count']:_0x2a7afa[_0x3a39('0x18')]+_0x2a7afa[_0x3a39('0x19')];var _0x526cdc;if(_0x38e072>=_0x52026d){_0x38e072=_0x52026d;_0x526cdc=0xc8;}else{_0x526cdc=0xce;}_0x4e9ceb[_0x3a39('0x16')](_0x526cdc);return _0x4e9ceb[_0x3a39('0x1c')](_0x3a39('0x1d'),_0x227b80+'-'+_0x38e072+'/'+_0x52026d)[_0x3a39('0x1e')](_0x14242c);}return null;};}function patchUpdates(_0x288ac3){return function(_0x5df108){try{jsonpatch['apply'](_0x5df108,_0x288ac3,!![]);}catch(_0xc7024){return BPromise[_0x3a39('0x1f')](_0xc7024);}return _0x5df108[_0x3a39('0x20')]();};}function saveUpdates(_0xdbf579,_0x18ddd3){return function(_0x4e47a2){if(_0x4e47a2){return _0x4e47a2['update'](_0xdbf579)[_0x3a39('0x21')](function(_0x59e243){return _0x59e243;});}return null;};}function removeEntity(_0x4e8eb1,_0x5bfb94){return function(_0x360e21){if(_0x360e21){return _0x360e21[_0x3a39('0x22')]()['then'](function(){var _0x1f0190=_0x360e21['get']({'plain':!![]});var _0x4c7562=_0x3a39('0x23');return db[_0x3a39('0x24')]['destroy']({'where':{'type':_0x4c7562,'resourceId':_0x1f0190['id']}})['then'](function(){return _0x360e21;});})['then'](function(){_0x4e8eb1[_0x3a39('0x16')](0xcc)[_0x3a39('0x17')]();});}};}function handleEntityNotFound(_0x51c48a,_0x5906a2){return function(_0x22538f){if(!_0x22538f){_0x51c48a[_0x3a39('0x15')](0x194);}return _0x22538f;};}function handleError(_0x55d6e9,_0x58597){_0x58597=_0x58597||0x1f4;return function(_0x522653){logger[_0x3a39('0x25')](_0x522653[_0x3a39('0x26')]);if(_0x522653['name']){delete _0x522653['name'];}_0x55d6e9[_0x3a39('0x16')](_0x58597)[_0x3a39('0x27')](_0x522653);};}exports[_0x3a39('0x28')]=function(_0x2fd321,_0xb7f56d){var _0x249b14={},_0x2a54d0={},_0x5bd5f7={'count':0x0,'rows':[]};var _0x4104be=_[_0x3a39('0x29')](db[_0x3a39('0x2a')][_0x3a39('0x2b')],function(_0x3e8ba8){return{'name':_0x3e8ba8[_0x3a39('0x2c')],'type':_0x3e8ba8[_0x3a39('0x2d')]['key']};});_0x2a54d0[_0x3a39('0x2e')]=_[_0x3a39('0x29')](_0x4104be,_0x3a39('0x2f'));_0x2a54d0['query']=_[_0x3a39('0x30')](_0x2fd321[_0x3a39('0x31')]);_0x2a54d0[_0x3a39('0x32')]=_[_0x3a39('0x33')](_0x2a54d0['model'],_0x2a54d0[_0x3a39('0x31')]);_0x249b14['attributes']=_[_0x3a39('0x33')](_0x2a54d0[_0x3a39('0x2e')],qs['fields'](_0x2fd321['query']['fields']));_0x249b14['attributes']=_0x249b14[_0x3a39('0x34')][_0x3a39('0x35')]?_0x249b14[_0x3a39('0x34')]:_0x2a54d0[_0x3a39('0x2e')];if(!_0x2fd321[_0x3a39('0x31')][_0x3a39('0x36')](_0x3a39('0x37'))){_0x249b14[_0x3a39('0x19')]=qs[_0x3a39('0x19')](_0x2fd321[_0x3a39('0x31')][_0x3a39('0x19')]);_0x249b14[_0x3a39('0x18')]=qs[_0x3a39('0x18')](_0x2fd321[_0x3a39('0x31')]['offset']);}_0x249b14[_0x3a39('0x38')]=qs['sort'](_0x2fd321[_0x3a39('0x31')][_0x3a39('0x39')]);_0x249b14[_0x3a39('0x3a')]=qs[_0x3a39('0x32')](_['pick'](_0x2fd321['query'],_0x2a54d0[_0x3a39('0x32')]),_0x4104be);if(_0x2fd321[_0x3a39('0x31')][_0x3a39('0x3b')]){_0x249b14[_0x3a39('0x3a')]=_[_0x3a39('0x3c')](_0x249b14[_0x3a39('0x3a')],{'$or':_['map'](_0x4104be,function(_0x50b168){if(_0x50b168[_0x3a39('0x2d')]!==_0x3a39('0x3d')){var _0x5ee126={};_0x5ee126[_0x50b168[_0x3a39('0x2f')]]={'$like':'%'+_0x2fd321['query'][_0x3a39('0x3b')]+'%'};return _0x5ee126;}})});}_0x249b14=_[_0x3a39('0x3c')]({},_0x249b14,_0x2fd321[_0x3a39('0x3e')]);var _0x279b37={'where':_0x249b14[_0x3a39('0x3a')]};return db[_0x3a39('0x2a')][_0x3a39('0x1b')](_0x279b37)['then'](function(_0x340467){_0x5bd5f7[_0x3a39('0x1b')]=_0x340467;if(_0x2fd321['query'][_0x3a39('0x3f')]){_0x249b14[_0x3a39('0x40')]=[{'all':!![]}];}return db['CmContactHasItem']['findAll'](_0x249b14);})['then'](function(_0x1ae433){_0x5bd5f7[_0x3a39('0x41')]=_0x1ae433;return _0x5bd5f7;})['then'](respondWithFilteredResult(_0xb7f56d,_0x249b14))[_0x3a39('0x42')](handleError(_0xb7f56d,null));};exports[_0x3a39('0x43')]=function(_0x1ee862,_0x2a5f96){var _0x2572bb={'raw':!![],'where':{'id':_0x1ee862[_0x3a39('0x44')]['id']}},_0x11b93a={};_0x11b93a[_0x3a39('0x2e')]=_['keys'](db[_0x3a39('0x2a')]['rawAttributes']);_0x11b93a[_0x3a39('0x31')]=_[_0x3a39('0x30')](_0x1ee862[_0x3a39('0x31')]);_0x11b93a[_0x3a39('0x32')]=_['intersection'](_0x11b93a[_0x3a39('0x2e')],_0x11b93a[_0x3a39('0x31')]);_0x2572bb[_0x3a39('0x34')]=_['intersection'](_0x11b93a[_0x3a39('0x2e')],qs['fields'](_0x1ee862[_0x3a39('0x31')][_0x3a39('0x45')]));_0x2572bb[_0x3a39('0x34')]=_0x2572bb[_0x3a39('0x34')][_0x3a39('0x35')]?_0x2572bb[_0x3a39('0x34')]:_0x11b93a['model'];if(_0x1ee862[_0x3a39('0x31')][_0x3a39('0x3f')]){_0x2572bb['include']=[{'all':!![]}];}_0x2572bb=_[_0x3a39('0x3c')]({},_0x2572bb,_0x1ee862[_0x3a39('0x3e')]);return db[_0x3a39('0x2a')][_0x3a39('0x46')](_0x2572bb)[_0x3a39('0x21')](handleEntityNotFound(_0x2a5f96,null))['then'](respondWithResult(_0x2a5f96,null))['catch'](handleError(_0x2a5f96,null));};exports['create']=function(_0x16b435,_0x291f46){return db['CmContactHasItem'][_0x3a39('0x47')](_0x16b435[_0x3a39('0x48')],{})[_0x3a39('0x21')](function(_0x18c31e){var _0x54e7d6=_0x16b435[_0x3a39('0x49')]['get']({'plain':!![]});if(!_0x54e7d6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x54e7d6[_0x3a39('0x4a')]==='user'){var _0x1fd91e=_0x18c31e['get']({'plain':!![]});var _0x410904=_0x3a39('0x23');return db[_0x3a39('0x4b')][_0x3a39('0x46')]({'where':{'name':_0x410904,'userProfileId':_0x54e7d6[_0x3a39('0x4c')]},'raw':!![]})[_0x3a39('0x21')](function(_0x413beb){if(_0x413beb&&_0x413beb[_0x3a39('0x4d')]===0x0){return db[_0x3a39('0x24')][_0x3a39('0x47')]({'name':_0x1fd91e['name'],'resourceId':_0x1fd91e['id'],'type':_0x413beb[_0x3a39('0x2f')],'sectionId':_0x413beb['id']},{})[_0x3a39('0x21')](function(){return _0x18c31e;});}else{return _0x18c31e;}})['catch'](function(_0x4d762e){logger[_0x3a39('0x25')](_0x3a39('0x4e'),_0x4d762e);throw _0x4d762e;});}return _0x18c31e;})[_0x3a39('0x21')](respondWithResult(_0x291f46,0xc9))[_0x3a39('0x42')](handleError(_0x291f46,null));};exports[_0x3a39('0x4f')]=function(_0x41d146,_0x26b3b7){if(_0x41d146['body']['id']){delete _0x41d146[_0x3a39('0x48')]['id'];}return db[_0x3a39('0x2a')][_0x3a39('0x46')]({'where':{'id':_0x41d146[_0x3a39('0x44')]['id']}})[_0x3a39('0x21')](handleEntityNotFound(_0x26b3b7,null))[_0x3a39('0x21')](saveUpdates(_0x41d146[_0x3a39('0x48')],null))[_0x3a39('0x21')](respondWithResult(_0x26b3b7,null))[_0x3a39('0x42')](handleError(_0x26b3b7,null));};exports[_0x3a39('0x22')]=function(_0x10a538,_0x572a57){return db[_0x3a39('0x2a')][_0x3a39('0x46')]({'where':{'id':_0x10a538[_0x3a39('0x44')]['id']}})['then'](handleEntityNotFound(_0x572a57,null))[_0x3a39('0x21')](removeEntity(_0x572a57,null))[_0x3a39('0x42')](handleError(_0x572a57,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 1baec39..189dbfc 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 _0x791a=['define','cm_contact_has_items','lodash','../../config/logger','api','moment','request-promise','./cmContactHasItem.attributes','exports'];(function(_0x3b7c5a,_0x58219b){var _0x458bcf=function(_0x26f322){while(--_0x26f322){_0x3b7c5a['push'](_0x3b7c5a['shift']());}};_0x458bcf(++_0x58219b);}(_0x791a,0x6e));var _0xa791=function(_0x2c04f8,_0x18907e){_0x2c04f8=_0x2c04f8-0x0;var _0x5ede64=_0x791a[_0x2c04f8];return _0x5ede64;};'use strict';var _=require(_0xa791('0x0'));var util=require('util');var logger=require(_0xa791('0x1'))(_0xa791('0x2'));var moment=require(_0xa791('0x3'));var BPromise=require('bluebird');var rp=require(_0xa791('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa791('0x5'));module[_0xa791('0x6')]=function(_0x1e3803,_0x4b58ab){return _0x1e3803[_0xa791('0x7')]('CmContactHasItem',attributes,{'tableName':_0xa791('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf074=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./cmContactHasItem.attributes','define','CmContactHasItem','cm_contact_has_items','lodash'];(function(_0xe45118,_0x5dffbc){var _0x15e15d=function(_0x17eaec){while(--_0x17eaec){_0xe45118['push'](_0xe45118['shift']());}};_0x15e15d(++_0x5dffbc);}(_0xf074,0x173));var _0x4f07=function(_0x3f5880,_0x2beec0){_0x3f5880=_0x3f5880-0x0;var _0x1cc879=_0xf074[_0x3f5880];return _0x1cc879;};'use strict';var _=require(_0x4f07('0x0'));var util=require(_0x4f07('0x1'));var logger=require(_0x4f07('0x2'))(_0x4f07('0x3'));var moment=require(_0x4f07('0x4'));var BPromise=require(_0x4f07('0x5'));var rp=require(_0x4f07('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4f07('0x7'));var config=require('../../config/environment');var attributes=require(_0x4f07('0x8'));module['exports']=function(_0xc09ebb,_0x4ab6d7){return _0xc09ebb[_0x4f07('0x9')](_0x4f07('0xa'),attributes,{'tableName':_0x4f07('0xb'),'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 77dad17..38da63f 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 _0x34f0=['request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','http','request','info','CmContactHasItem,\x20%s,\x20%s'];(function(_0x9b0976,_0x40dab4){var _0x5362d5=function(_0xb5fde1){while(--_0xb5fde1){_0x9b0976['push'](_0x9b0976['shift']());}};_0x5362d5(++_0x40dab4);}(_0x34f0,0xfb));var _0x034f=function(_0x25bacf,_0x1f9cc3){_0x25bacf=_0x25bacf-0x0;var _0x3849f0=_0x34f0[_0x25bacf];return _0x3849f0;};'use strict';var _=require(_0x034f('0x0'));var util=require(_0x034f('0x1'));var moment=require(_0x034f('0x2'));var BPromise=require(_0x034f('0x3'));var rs=require(_0x034f('0x4'));var fs=require('fs');var Redis=require(_0x034f('0x5'));var db=require(_0x034f('0x6'))['db'];var utils=require(_0x034f('0x7'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x034f('0x8'));var client=jayson['client'][_0x034f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x14d8f8,_0x38d7bf,_0x415908){return new BPromise(function(_0xfbbb7a,_0x4d3cc8){return client[_0x034f('0xa')](_0x14d8f8,_0x415908)['then'](function(_0x3c66e7){logger[_0x034f('0xb')](_0x034f('0xc'),_0x38d7bf,_0x034f('0xd'));logger[_0x034f('0xe')](_0x034f('0xf'),_0x38d7bf,_0x034f('0xd'),JSON[_0x034f('0x10')](_0x3c66e7));if(_0x3c66e7[_0x034f('0x11')]){if(_0x3c66e7[_0x034f('0x11')][_0x034f('0x12')]===0x1f4){logger[_0x034f('0x11')](_0x034f('0xc'),_0x38d7bf,_0x3c66e7['error'][_0x034f('0x13')]);return _0x4d3cc8(_0x3c66e7[_0x034f('0x11')][_0x034f('0x13')]);}logger['error'](_0x034f('0xc'),_0x38d7bf,_0x3c66e7[_0x034f('0x11')][_0x034f('0x13')]);return _0xfbbb7a(_0x3c66e7['error']['message']);}else{logger[_0x034f('0xb')]('CmContactHasItem,\x20%s,\x20%s',_0x38d7bf,_0x034f('0xd'));_0xfbbb7a(_0x3c66e7[_0x034f('0x14')][_0x034f('0x13')]);}})[_0x034f('0x15')](function(_0x33ec97){logger[_0x034f('0x11')]('CmContactHasItem,\x20%s,\x20%s',_0x38d7bf,_0x33ec97);_0x4d3cc8(_0x33ec97);});});} \ No newline at end of file +var _0xd7df=['moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util'];(function(_0x3abaf8,_0x23f1ad){var _0x136180=function(_0x1a9ed1){while(--_0x1a9ed1){_0x3abaf8['push'](_0x3abaf8['shift']());}};_0x136180(++_0x23f1ad);}(_0xd7df,0xda));var _0xfd7d=function(_0x5a120d,_0x3fbb52){_0x5a120d=_0x5a120d-0x0;var _0x31713c=_0xd7df[_0x5a120d];return _0x31713c;};'use strict';var _=require(_0xfd7d('0x0'));var util=require(_0xfd7d('0x1'));var moment=require(_0xfd7d('0x2'));var BPromise=require('bluebird');var rs=require(_0xfd7d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfd7d('0x4'))['db'];var utils=require(_0xfd7d('0x5'));var logger=require(_0xfd7d('0x6'))(_0xfd7d('0x7'));var config=require(_0xfd7d('0x8'));var jayson=require(_0xfd7d('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x40a8fc,_0x34244f,_0x26703e){return new BPromise(function(_0x82fed4,_0x1b5f69){return client[_0xfd7d('0xa')](_0x40a8fc,_0x26703e)[_0xfd7d('0xb')](function(_0x5386f3){logger[_0xfd7d('0xc')](_0xfd7d('0xd'),_0x34244f,_0xfd7d('0xe'));logger[_0xfd7d('0xf')](_0xfd7d('0x10'),_0x34244f,'request\x20sent',JSON[_0xfd7d('0x11')](_0x5386f3));if(_0x5386f3['error']){if(_0x5386f3[_0xfd7d('0x12')]['code']===0x1f4){logger[_0xfd7d('0x12')](_0xfd7d('0xd'),_0x34244f,_0x5386f3['error'][_0xfd7d('0x13')]);return _0x1b5f69(_0x5386f3[_0xfd7d('0x12')][_0xfd7d('0x13')]);}logger[_0xfd7d('0x12')](_0xfd7d('0xd'),_0x34244f,_0x5386f3['error'][_0xfd7d('0x13')]);return _0x82fed4(_0x5386f3['error'][_0xfd7d('0x13')]);}else{logger[_0xfd7d('0xc')](_0xfd7d('0xd'),_0x34244f,_0xfd7d('0xe'));_0x82fed4(_0x5386f3[_0xfd7d('0x14')][_0xfd7d('0x13')]);}})[_0xfd7d('0x15')](function(_0x3e9d00){logger['error'](_0xfd7d('0xd'),_0x34244f,_0x3e9d00);_0x1b5f69(_0x3e9d00);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index d73ba5a..36c952a 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 _0xe64e=['../../config/environment','./cmContactHasItem.controller','isAuthenticated','index','get','/:id','show','post','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x55ff3e,_0x41077f){var _0x2709eb=function(_0x45563a){while(--_0x45563a){_0x55ff3e['push'](_0x55ff3e['shift']());}};_0x2709eb(++_0x41077f);}(_0xe64e,0x1b0));var _0xee64=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe64e[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xee64('0x0'));var util=require(_0xee64('0x1'));var path=require(_0xee64('0x2'));var timeout=require(_0xee64('0x3'));var express=require(_0xee64('0x4'));var router=express[_0xee64('0x5')]();var fs_extra=require(_0xee64('0x6'));var auth=require(_0xee64('0x7'));var interaction=require(_0xee64('0x8'));var config=require(_0xee64('0x9'));var controller=require(_0xee64('0xa'));router['get']('/',auth[_0xee64('0xb')](),controller[_0xee64('0xc')]);router[_0xee64('0xd')](_0xee64('0xe'),auth[_0xee64('0xb')](),controller[_0xee64('0xf')]);router[_0xee64('0x10')]('/',auth[_0xee64('0xb')](),controller['create']);router[_0xee64('0x11')](_0xee64('0xe'),auth[_0xee64('0xb')](),controller[_0xee64('0x12')]);router['delete'](_0xee64('0xe'),auth[_0xee64('0xb')](),controller[_0xee64('0x13')]);module[_0xee64('0x14')]=router; \ No newline at end of file +var _0x4991=['create','/:id','update','delete','destroy','util','path','express','Router','../../components/interaction/service','./cmContactHasItem.controller','isAuthenticated','index','get','show','post'];(function(_0x58236d,_0x365c03){var _0x322688=function(_0x11a225){while(--_0x11a225){_0x58236d['push'](_0x58236d['shift']());}};_0x322688(++_0x365c03);}(_0x4991,0xa5));var _0x1499=function(_0x1e9e25,_0x5c2dac){_0x1e9e25=_0x1e9e25-0x0;var _0x522c28=_0x4991[_0x1e9e25];return _0x522c28;};'use strict';var multer=require('multer');var util=require(_0x1499('0x0'));var path=require(_0x1499('0x1'));var timeout=require('connect-timeout');var express=require(_0x1499('0x2'));var router=express[_0x1499('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x1499('0x4'));var config=require('../../config/environment');var controller=require(_0x1499('0x5'));router['get']('/',auth[_0x1499('0x6')](),controller[_0x1499('0x7')]);router[_0x1499('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x1499('0x9')]);router[_0x1499('0xa')]('/',auth['isAuthenticated'](),controller[_0x1499('0xb')]);router['put'](_0x1499('0xc'),auth[_0x1499('0x6')](),controller[_0x1499('0xd')]);router[_0x1499('0xe')](_0x1499('0xc'),auth['isAuthenticated'](),controller[_0x1499('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index aaa2426..7b5ff35 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 _0x9de2=['exports','VIRTUAL','getDataValue','alias','STRING','setDataValue','name','TEXT','long','type','select','parse','values','isArray','stringify','BOOLEAN','ENUM','voice'];(function(_0x5018bd,_0x24b200){var _0x5cb7c7=function(_0x3a5d84){while(--_0x3a5d84){_0x5018bd['push'](_0x5018bd['shift']());}};_0x5cb7c7(++_0x24b200);}(_0x9de2,0xa2));var _0x29de=function(_0x2ea36d,_0x30f614){_0x2ea36d=_0x2ea36d-0x0;var _0x40d7a1=_0x9de2[_0x2ea36d];return _0x40d7a1;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');module[_0x29de('0x0')]={'name':{'type':Sequelize[_0x29de('0x1')],'get':function(_0x5b6bcb){return this[_0x29de('0x2')](_0x29de('0x3'));}},'alias':{'type':Sequelize[_0x29de('0x4')],'allowNull':![],'set':function(_0x4b87c5){this[_0x29de('0x5')](_0x29de('0x3'),_0x4b87c5?_0x4b87c5:this[_0x29de('0x2')](_0x29de('0x6')));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize[_0x29de('0x7')](_0x29de('0x8')),'get':function(){if(this[_0x29de('0x2')](_0x29de('0x9'))===_0x29de('0xa')){return JSON[_0x29de('0xb')](this[_0x29de('0x2')]('values'));}else{return this[_0x29de('0x2')](_0x29de('0xc'));}},'set':function(_0x5d724c){if(Array[_0x29de('0xd')](_0x5d724c)){this['setDataValue'](_0x29de('0xc'),JSON[_0x29de('0xe')](_0x5d724c));}else{this[_0x29de('0x5')]('values',_0x5d724c);}}},'required':{'type':Sequelize[_0x29de('0xf')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x29de('0xf')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x29de('0x10')](_0x29de('0x11'))}}; \ No newline at end of file +var _0x3761=['VIRTUAL','getDataValue','alias','STRING','setDataValue','long','type','select','parse','values','voice','sequelize','lodash','exports'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x3761,0x1d9));var _0x1376=function(_0x483e1d,_0xfeab58){_0x483e1d=_0x483e1d-0x0;var _0x10cd26=_0x3761[_0x483e1d];return _0x10cd26;};'use strict';var Sequelize=require(_0x1376('0x0'));var _=require(_0x1376('0x1'));module[_0x1376('0x2')]={'name':{'type':Sequelize[_0x1376('0x3')],'get':function(_0x2c64c0){return this[_0x1376('0x4')](_0x1376('0x5'));}},'alias':{'type':Sequelize[_0x1376('0x6')],'allowNull':![],'set':function(_0x27d256){this[_0x1376('0x7')]('alias',_0x27d256?_0x27d256:this[_0x1376('0x4')]('name'));}},'type':{'type':Sequelize[_0x1376('0x6')],'allowNull':![]},'values':{'type':Sequelize['TEXT'](_0x1376('0x8')),'get':function(){if(this[_0x1376('0x4')](_0x1376('0x9'))===_0x1376('0xa')){return JSON[_0x1376('0xb')](this[_0x1376('0x4')](_0x1376('0xc')));}else{return this[_0x1376('0x4')](_0x1376('0xc'));}},'set':function(_0x4cd49f){if(Array['isArray'](_0x4cd49f)){this[_0x1376('0x7')](_0x1376('0xc'),JSON['stringify'](_0x4cd49f));}else{this[_0x1376('0x7')]('values',_0x4cd49f);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM'](_0x1376('0xd'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index d14a714..dc33f6d 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 _0x6309=['limit','count','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','stack','name','send','index','map','CmCustomField','rawAttributes','fieldName','key','differenceBy','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','body','create','sequelize','transaction','Sequelize','TEXT','type','text','number','INTEGER','BOOLEAN','defaultValue','addColumn','cm_contacts','format','cf_%d','zip-dir','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined'];(function(_0xdf52f3,_0x428a42){var _0x58d932=function(_0x495b25){while(--_0x495b25){_0xdf52f3['push'](_0xdf52f3['shift']());}};_0x58d932(++_0x428a42);}(_0x6309,0xe8));var _0x9630=function(_0x56b138,_0x2396d6){_0x56b138=_0x56b138-0x0;var _0x3df878=_0x6309[_0x56b138];return _0x3df878;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9630('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9630('0x1'));var Mustache=require('mustache');var util=require(_0x9630('0x2'));var path=require(_0x9630('0x3'));var sox=require(_0x9630('0x4'));var csv=require(_0x9630('0x5'));var ejs=require(_0x9630('0x6'));var fs=require('fs');var fs_extra=require(_0x9630('0x7'));var _=require('lodash');var squel=require(_0x9630('0x8'));var crypto=require('crypto');var jsforce=require(_0x9630('0x9'));var deskjs=require(_0x9630('0xa'));var toCsv=require(_0x9630('0x5'));var querystring=require(_0x9630('0xb'));var Papa=require(_0x9630('0xc'));var Redis=require(_0x9630('0xd'));var authService=require(_0x9630('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9630('0xf'));var logger=require(_0x9630('0x10'))('api');var utils=require(_0x9630('0x11'));var config=require(_0x9630('0x12'));var licenseUtil=require(_0x9630('0x13'));var db=require(_0x9630('0x14'))['db'];function respondWithStatusCode(_0x4f65d1,_0x554288){_0x554288=_0x554288||0xcc;return function(_0x2b1ec7){if(_0x2b1ec7){return _0x4f65d1['sendStatus'](_0x554288);}return _0x4f65d1[_0x9630('0x15')](_0x554288)[_0x9630('0x16')]();};}function respondWithResult(_0x556cdb,_0x158acd){_0x158acd=_0x158acd||0xc8;return function(_0x436b2e){if(_0x436b2e){return _0x556cdb[_0x9630('0x15')](_0x158acd)[_0x9630('0x17')](_0x436b2e);}};}function respondWithFilteredResult(_0x354c19,_0x32c55c){return function(_0x25e334){if(_0x25e334){var _0x49a09a=typeof _0x32c55c[_0x9630('0x18')]===_0x9630('0x19')&&typeof _0x32c55c[_0x9630('0x1a')]===_0x9630('0x19');var _0x2ad8d6=_0x25e334['count'];var _0x4afc1f=_0x49a09a?0x0:_0x32c55c[_0x9630('0x18')];var _0x42cab3=_0x49a09a?_0x25e334[_0x9630('0x1b')]:_0x32c55c[_0x9630('0x18')]+_0x32c55c['limit'];var _0x3a1289;if(_0x42cab3>=_0x2ad8d6){_0x42cab3=_0x2ad8d6;_0x3a1289=0xc8;}else{_0x3a1289=0xce;}_0x354c19[_0x9630('0x15')](_0x3a1289);return _0x354c19[_0x9630('0x1c')](_0x9630('0x1d'),_0x4afc1f+'-'+_0x42cab3+'/'+_0x2ad8d6)['json'](_0x25e334);}return null;};}function patchUpdates(_0x205716){return function(_0x38492f){try{jsonpatch[_0x9630('0x1e')](_0x38492f,_0x205716,!![]);}catch(_0x4f7dd2){return BPromise[_0x9630('0x1f')](_0x4f7dd2);}return _0x38492f[_0x9630('0x20')]();};}function saveUpdates(_0xb6a26a,_0x381ec8){return function(_0x3188fd){if(_0x3188fd){return _0x3188fd[_0x9630('0x21')](_0xb6a26a)['then'](function(_0x3ffc96){return _0x3ffc96;});}return null;};}function removeEntity(_0x29f984,_0x1f9cfe){return function(_0x127c91){if(_0x127c91){return _0x127c91[_0x9630('0x22')]()[_0x9630('0x23')](function(){_0x29f984[_0x9630('0x15')](0xcc)[_0x9630('0x16')]();});}};}function handleEntityNotFound(_0xfdef7e,_0x3bd32a){return function(_0x454127){if(!_0x454127){_0xfdef7e[_0x9630('0x24')](0x194);}return _0x454127;};}function handleError(_0x117549,_0x558efe){_0x558efe=_0x558efe||0x1f4;return function(_0x49de86){logger['error'](_0x49de86[_0x9630('0x25')]);if(_0x49de86[_0x9630('0x26')]){delete _0x49de86[_0x9630('0x26')];}_0x117549[_0x9630('0x15')](_0x558efe)[_0x9630('0x27')](_0x49de86);};}exports[_0x9630('0x28')]=function(_0x23aa5e,_0x526991){var _0x50bb46={},_0xe471bb={},_0x15c2e5={'count':0x0,'rows':[]};var _0x304cc5=_[_0x9630('0x29')](db[_0x9630('0x2a')][_0x9630('0x2b')],function(_0x45dfac){return{'name':_0x45dfac[_0x9630('0x2c')],'type':_0x45dfac['type'][_0x9630('0x2d')]};});_0xe471bb['model']=_[_0x9630('0x2e')](_['map'](_0x304cc5,_0x9630('0x26')),[_0x9630('0x26')]);_0xe471bb[_0x9630('0x2f')]=_[_0x9630('0x30')](_0x23aa5e['query']);_0xe471bb[_0x9630('0x31')]=_[_0x9630('0x32')](_0xe471bb[_0x9630('0x33')],_0xe471bb['query']);_0x50bb46[_0x9630('0x34')]=_[_0x9630('0x32')](_0xe471bb[_0x9630('0x33')],qs[_0x9630('0x35')](_0x23aa5e[_0x9630('0x2f')][_0x9630('0x35')]));_0x50bb46[_0x9630('0x34')]=_0x50bb46[_0x9630('0x34')][_0x9630('0x36')]?_0x50bb46['attributes']:_0xe471bb[_0x9630('0x33')];if(!_0x23aa5e[_0x9630('0x2f')][_0x9630('0x37')](_0x9630('0x38'))){_0x50bb46['limit']=qs[_0x9630('0x1a')](_0x23aa5e['query'][_0x9630('0x1a')]);_0x50bb46[_0x9630('0x18')]=qs[_0x9630('0x18')](_0x23aa5e[_0x9630('0x2f')]['offset']);}_0x50bb46['order']=qs['sort'](_0x23aa5e[_0x9630('0x2f')]['sort']);_0x50bb46[_0x9630('0x39')]=qs['filters'](_[_0x9630('0x3a')](_0x23aa5e['query'],_0xe471bb[_0x9630('0x31')]),_0x304cc5);if(_0x23aa5e['query'][_0x9630('0x3b')]){_0x50bb46['where']=_[_0x9630('0x3c')](_0x50bb46['where'],{'$or':_[_0x9630('0x29')](_0x304cc5,function(_0xe22907){if(_0xe22907['type']!==_0x9630('0x3d')){var _0x7177b5={};_0x7177b5[_0xe22907['name']]={'$like':'%'+_0x23aa5e[_0x9630('0x2f')][_0x9630('0x3b')]+'%'};return _0x7177b5;}})});}_0x50bb46=_[_0x9630('0x3c')]({},_0x50bb46,_0x23aa5e[_0x9630('0x3e')]);var _0x2e1ce9={'where':_0x50bb46[_0x9630('0x39')]};return db[_0x9630('0x2a')][_0x9630('0x1b')](_0x2e1ce9)['then'](function(_0xc783e7){_0x15c2e5[_0x9630('0x1b')]=_0xc783e7;if(_0x23aa5e[_0x9630('0x2f')][_0x9630('0x3f')]){_0x50bb46[_0x9630('0x40')]=[{'all':!![]}];}return db[_0x9630('0x2a')][_0x9630('0x41')](_0x50bb46);})[_0x9630('0x23')](function(_0x12e7c8){_0x15c2e5[_0x9630('0x42')]=_0x12e7c8;return _0x15c2e5;})[_0x9630('0x23')](respondWithFilteredResult(_0x526991,_0x50bb46))[_0x9630('0x43')](handleError(_0x526991,null));};exports['show']=function(_0x1bce31,_0x465a66){var _0xfb605d={'raw':!![],'where':{'id':_0x1bce31[_0x9630('0x44')]['id']}},_0xb5accd={};_0xb5accd[_0x9630('0x33')]=_[_0x9630('0x30')](db[_0x9630('0x2a')]['rawAttributes']);_0xb5accd[_0x9630('0x2f')]=_[_0x9630('0x30')](_0x1bce31[_0x9630('0x2f')]);_0xb5accd['filters']=_['intersection'](_0xb5accd[_0x9630('0x33')],_0xb5accd[_0x9630('0x2f')]);_0xfb605d[_0x9630('0x34')]=_[_0x9630('0x32')](_0xb5accd[_0x9630('0x33')],qs[_0x9630('0x35')](_0x1bce31['query'][_0x9630('0x35')]));_0xfb605d[_0x9630('0x34')]=_0xfb605d[_0x9630('0x34')]['length']?_0xfb605d[_0x9630('0x34')]:_0xb5accd['model'];if(_0x1bce31[_0x9630('0x2f')]['includeAll']){_0xfb605d[_0x9630('0x40')]=[{'all':!![]}];}_0xfb605d=_['merge']({},_0xfb605d,_0x1bce31[_0x9630('0x3e')]);return db[_0x9630('0x2a')][_0x9630('0x45')](_0xfb605d)[_0x9630('0x23')](handleEntityNotFound(_0x465a66,null))[_0x9630('0x23')](respondWithResult(_0x465a66,null))[_0x9630('0x43')](handleError(_0x465a66,null));};exports[_0x9630('0x21')]=function(_0x293d16,_0xfe126a){if(_0x293d16[_0x9630('0x46')]['id']){delete _0x293d16['body']['id'];}return db[_0x9630('0x2a')][_0x9630('0x45')]({'where':{'id':_0x293d16['params']['id']}})[_0x9630('0x23')](handleEntityNotFound(_0xfe126a,null))[_0x9630('0x23')](saveUpdates(_0x293d16[_0x9630('0x46')],null))[_0x9630('0x23')](respondWithResult(_0xfe126a,null))[_0x9630('0x43')](handleError(_0xfe126a,null));};exports[_0x9630('0x22')]=function(_0x57f390,_0x1e315c){return db[_0x9630('0x2a')][_0x9630('0x45')]({'where':{'id':_0x57f390['params']['id']}})[_0x9630('0x23')](handleEntityNotFound(_0x1e315c,null))['then'](removeEntity(_0x1e315c,null))[_0x9630('0x43')](handleError(_0x1e315c,null));};exports[_0x9630('0x47')]=function(_0x2e343f,_0x4324e9){var _0x1bd580;return db[_0x9630('0x48')][_0x9630('0x49')](function(_0x53eded){return db[_0x9630('0x2a')][_0x9630('0x47')](_0x2e343f['body'],{'transaction':_0x53eded})[_0x9630('0x23')](function(_0x3cbe3c){_0x1bd580=_0x3cbe3c;var _0x30defd={'type':db[_0x9630('0x4a')][_0x9630('0x4b')],'transaction':_0x53eded};switch(_0x2e343f[_0x9630('0x46')][_0x9630('0x4c')]){case _0x9630('0x4d'):_0x30defd[_0x9630('0x4c')]=db[_0x9630('0x4a')][_0x9630('0x4b')];break;case _0x9630('0x4e'):_0x30defd[_0x9630('0x4c')]=db['Sequelize'][_0x9630('0x4f')];break;case'switch':_0x30defd[_0x9630('0x4c')]=db[_0x9630('0x4a')][_0x9630('0x50')];_0x30defd[_0x9630('0x51')]=![];break;default:}return db[_0x9630('0x48')]['queryInterface'][_0x9630('0x52')](_0x9630('0x53'),util[_0x9630('0x54')](_0x9630('0x55'),_0x1bd580['id']),_0x30defd);})[_0x9630('0x23')](function(){return _0x1bd580;});})[_0x9630('0x23')](respondWithResult(_0x4324e9,0xc9))[_0x9630('0x43')](handleError(_0x4324e9,null));}; \ No newline at end of file +var _0xcc61=['json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','end','error','stack','name','send','index','rawAttributes','fieldName','model','differenceBy','map','query','filters','intersection','attributes','fields','nolimit','sort','where','pick','filter','merge','CmCustomField','includeAll','include','findAll','rows','catch','show','params','keys','length','options','find','body','destroy','create','sequelize','transaction','Sequelize','TEXT','type','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','format','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status'];(function(_0x7a8e71,_0x2acaa6){var _0x1792a4=function(_0x398d73){while(--_0x398d73){_0x7a8e71['push'](_0x7a8e71['shift']());}};_0x1792a4(++_0x2acaa6);}(_0xcc61,0x94));var _0x1cc6=function(_0x2aa397,_0x58bcd2){_0x2aa397=_0x2aa397-0x0;var _0x229797=_0xcc61[_0x2aa397];return _0x229797;};'use strict';var emlformat=require(_0x1cc6('0x0'));var rimraf=require(_0x1cc6('0x1'));var zipdir=require(_0x1cc6('0x2'));var jsonpatch=require(_0x1cc6('0x3'));var rp=require(_0x1cc6('0x4'));var moment=require('moment');var BPromise=require(_0x1cc6('0x5'));var Mustache=require(_0x1cc6('0x6'));var util=require(_0x1cc6('0x7'));var path=require('path');var sox=require(_0x1cc6('0x8'));var csv=require(_0x1cc6('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1cc6('0xa'));var _=require(_0x1cc6('0xb'));var squel=require(_0x1cc6('0xc'));var crypto=require(_0x1cc6('0xd'));var jsforce=require(_0x1cc6('0xe'));var deskjs=require(_0x1cc6('0xf'));var toCsv=require(_0x1cc6('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1cc6('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x1cc6('0x11'));var as=require(_0x1cc6('0x12'));var hardwareService=require(_0x1cc6('0x13'));var logger=require('../../config/logger')(_0x1cc6('0x14'));var utils=require(_0x1cc6('0x15'));var config=require(_0x1cc6('0x16'));var licenseUtil=require(_0x1cc6('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x23399a,_0x439f1d){_0x439f1d=_0x439f1d||0xcc;return function(_0x1119f0){if(_0x1119f0){return _0x23399a[_0x1cc6('0x18')](_0x439f1d);}return _0x23399a[_0x1cc6('0x19')](_0x439f1d)['end']();};}function respondWithResult(_0x41fcc5,_0x4cf916){_0x4cf916=_0x4cf916||0xc8;return function(_0x50dbae){if(_0x50dbae){return _0x41fcc5[_0x1cc6('0x19')](_0x4cf916)[_0x1cc6('0x1a')](_0x50dbae);}};}function respondWithFilteredResult(_0x12b1da,_0xbe1f79){return function(_0x390448){if(_0x390448){var _0x33d3f4=typeof _0xbe1f79[_0x1cc6('0x1b')]===_0x1cc6('0x1c')&&typeof _0xbe1f79[_0x1cc6('0x1d')]===_0x1cc6('0x1c');var _0x368cf6=_0x390448[_0x1cc6('0x1e')];var _0x477401=_0x33d3f4?0x0:_0xbe1f79[_0x1cc6('0x1b')];var _0x486165=_0x33d3f4?_0x390448[_0x1cc6('0x1e')]:_0xbe1f79['offset']+_0xbe1f79[_0x1cc6('0x1d')];var _0x107ba5;if(_0x486165>=_0x368cf6){_0x486165=_0x368cf6;_0x107ba5=0xc8;}else{_0x107ba5=0xce;}_0x12b1da[_0x1cc6('0x19')](_0x107ba5);return _0x12b1da[_0x1cc6('0x1f')](_0x1cc6('0x20'),_0x477401+'-'+_0x486165+'/'+_0x368cf6)['json'](_0x390448);}return null;};}function patchUpdates(_0x427b5b){return function(_0x4b540b){try{jsonpatch[_0x1cc6('0x21')](_0x4b540b,_0x427b5b,!![]);}catch(_0x45e98d){return BPromise[_0x1cc6('0x22')](_0x45e98d);}return _0x4b540b[_0x1cc6('0x23')]();};}function saveUpdates(_0x5db4c6,_0x429403){return function(_0x35597c){if(_0x35597c){return _0x35597c[_0x1cc6('0x24')](_0x5db4c6)[_0x1cc6('0x25')](function(_0x2b469b){return _0x2b469b;});}return null;};}function removeEntity(_0x419eb1,_0x3ebde0){return function(_0x608c4c){if(_0x608c4c){return _0x608c4c['destroy']()['then'](function(){_0x419eb1[_0x1cc6('0x19')](0xcc)[_0x1cc6('0x26')]();});}};}function handleEntityNotFound(_0x3d54ce,_0x57c218){return function(_0x563ef7){if(!_0x563ef7){_0x3d54ce['sendStatus'](0x194);}return _0x563ef7;};}function handleError(_0x2f7074,_0x5511e7){_0x5511e7=_0x5511e7||0x1f4;return function(_0x514fa5){logger[_0x1cc6('0x27')](_0x514fa5[_0x1cc6('0x28')]);if(_0x514fa5[_0x1cc6('0x29')]){delete _0x514fa5[_0x1cc6('0x29')];}_0x2f7074[_0x1cc6('0x19')](_0x5511e7)[_0x1cc6('0x2a')](_0x514fa5);};}exports[_0x1cc6('0x2b')]=function(_0x12c0d5,_0x308539){var _0x5c8484={},_0xc8052b={},_0x1a909c={'count':0x0,'rows':[]};var _0x25180f=_['map'](db['CmCustomField'][_0x1cc6('0x2c')],function(_0x57aaab){return{'name':_0x57aaab[_0x1cc6('0x2d')],'type':_0x57aaab['type']['key']};});_0xc8052b[_0x1cc6('0x2e')]=_[_0x1cc6('0x2f')](_[_0x1cc6('0x30')](_0x25180f,_0x1cc6('0x29')),[_0x1cc6('0x29')]);_0xc8052b['query']=_['keys'](_0x12c0d5[_0x1cc6('0x31')]);_0xc8052b[_0x1cc6('0x32')]=_[_0x1cc6('0x33')](_0xc8052b[_0x1cc6('0x2e')],_0xc8052b[_0x1cc6('0x31')]);_0x5c8484[_0x1cc6('0x34')]=_[_0x1cc6('0x33')](_0xc8052b[_0x1cc6('0x2e')],qs[_0x1cc6('0x35')](_0x12c0d5[_0x1cc6('0x31')]['fields']));_0x5c8484[_0x1cc6('0x34')]=_0x5c8484['attributes']['length']?_0x5c8484['attributes']:_0xc8052b[_0x1cc6('0x2e')];if(!_0x12c0d5[_0x1cc6('0x31')]['hasOwnProperty'](_0x1cc6('0x36'))){_0x5c8484[_0x1cc6('0x1d')]=qs[_0x1cc6('0x1d')](_0x12c0d5[_0x1cc6('0x31')][_0x1cc6('0x1d')]);_0x5c8484[_0x1cc6('0x1b')]=qs[_0x1cc6('0x1b')](_0x12c0d5[_0x1cc6('0x31')][_0x1cc6('0x1b')]);}_0x5c8484['order']=qs[_0x1cc6('0x37')](_0x12c0d5[_0x1cc6('0x31')]['sort']);_0x5c8484[_0x1cc6('0x38')]=qs[_0x1cc6('0x32')](_[_0x1cc6('0x39')](_0x12c0d5[_0x1cc6('0x31')],_0xc8052b['filters']),_0x25180f);if(_0x12c0d5[_0x1cc6('0x31')][_0x1cc6('0x3a')]){_0x5c8484['where']=_[_0x1cc6('0x3b')](_0x5c8484[_0x1cc6('0x38')],{'$or':_[_0x1cc6('0x30')](_0x25180f,function(_0x28b2f1){if(_0x28b2f1['type']!=='VIRTUAL'){var _0x495b70={};_0x495b70[_0x28b2f1[_0x1cc6('0x29')]]={'$like':'%'+_0x12c0d5['query'][_0x1cc6('0x3a')]+'%'};return _0x495b70;}})});}_0x5c8484=_[_0x1cc6('0x3b')]({},_0x5c8484,_0x12c0d5['options']);var _0x5d175c={'where':_0x5c8484['where']};return db[_0x1cc6('0x3c')][_0x1cc6('0x1e')](_0x5d175c)[_0x1cc6('0x25')](function(_0x217102){_0x1a909c[_0x1cc6('0x1e')]=_0x217102;if(_0x12c0d5['query'][_0x1cc6('0x3d')]){_0x5c8484[_0x1cc6('0x3e')]=[{'all':!![]}];}return db[_0x1cc6('0x3c')][_0x1cc6('0x3f')](_0x5c8484);})['then'](function(_0x2c6f71){_0x1a909c[_0x1cc6('0x40')]=_0x2c6f71;return _0x1a909c;})[_0x1cc6('0x25')](respondWithFilteredResult(_0x308539,_0x5c8484))[_0x1cc6('0x41')](handleError(_0x308539,null));};exports[_0x1cc6('0x42')]=function(_0x5565f1,_0x4d9f2e){var _0x40299c={'raw':!![],'where':{'id':_0x5565f1[_0x1cc6('0x43')]['id']}},_0x1a2529={};_0x1a2529[_0x1cc6('0x2e')]=_[_0x1cc6('0x44')](db['CmCustomField'][_0x1cc6('0x2c')]);_0x1a2529['query']=_[_0x1cc6('0x44')](_0x5565f1[_0x1cc6('0x31')]);_0x1a2529[_0x1cc6('0x32')]=_[_0x1cc6('0x33')](_0x1a2529[_0x1cc6('0x2e')],_0x1a2529[_0x1cc6('0x31')]);_0x40299c[_0x1cc6('0x34')]=_['intersection'](_0x1a2529[_0x1cc6('0x2e')],qs[_0x1cc6('0x35')](_0x5565f1['query'][_0x1cc6('0x35')]));_0x40299c['attributes']=_0x40299c['attributes'][_0x1cc6('0x45')]?_0x40299c[_0x1cc6('0x34')]:_0x1a2529[_0x1cc6('0x2e')];if(_0x5565f1[_0x1cc6('0x31')][_0x1cc6('0x3d')]){_0x40299c[_0x1cc6('0x3e')]=[{'all':!![]}];}_0x40299c=_[_0x1cc6('0x3b')]({},_0x40299c,_0x5565f1[_0x1cc6('0x46')]);return db[_0x1cc6('0x3c')][_0x1cc6('0x47')](_0x40299c)['then'](handleEntityNotFound(_0x4d9f2e,null))['then'](respondWithResult(_0x4d9f2e,null))[_0x1cc6('0x41')](handleError(_0x4d9f2e,null));};exports['update']=function(_0x53d13c,_0x5be937){if(_0x53d13c[_0x1cc6('0x48')]['id']){delete _0x53d13c['body']['id'];}return db[_0x1cc6('0x3c')][_0x1cc6('0x47')]({'where':{'id':_0x53d13c[_0x1cc6('0x43')]['id']}})[_0x1cc6('0x25')](handleEntityNotFound(_0x5be937,null))[_0x1cc6('0x25')](saveUpdates(_0x53d13c['body'],null))[_0x1cc6('0x25')](respondWithResult(_0x5be937,null))[_0x1cc6('0x41')](handleError(_0x5be937,null));};exports[_0x1cc6('0x49')]=function(_0x204a4e,_0x1f533d){return db['CmCustomField'][_0x1cc6('0x47')]({'where':{'id':_0x204a4e[_0x1cc6('0x43')]['id']}})[_0x1cc6('0x25')](handleEntityNotFound(_0x1f533d,null))[_0x1cc6('0x25')](removeEntity(_0x1f533d,null))[_0x1cc6('0x41')](handleError(_0x1f533d,null));};exports[_0x1cc6('0x4a')]=function(_0xf6fc60,_0x33b1b1){var _0x292964;return db[_0x1cc6('0x4b')][_0x1cc6('0x4c')](function(_0x45e5d0){return db[_0x1cc6('0x3c')][_0x1cc6('0x4a')](_0xf6fc60[_0x1cc6('0x48')],{'transaction':_0x45e5d0})['then'](function(_0x4bab08){_0x292964=_0x4bab08;var _0x4870b6={'type':db[_0x1cc6('0x4d')][_0x1cc6('0x4e')],'transaction':_0x45e5d0};switch(_0xf6fc60['body'][_0x1cc6('0x4f')]){case'text':_0x4870b6[_0x1cc6('0x4f')]=db[_0x1cc6('0x4d')][_0x1cc6('0x4e')];break;case'number':_0x4870b6[_0x1cc6('0x4f')]=db[_0x1cc6('0x4d')][_0x1cc6('0x50')];break;case _0x1cc6('0x51'):_0x4870b6[_0x1cc6('0x4f')]=db[_0x1cc6('0x4d')][_0x1cc6('0x52')];_0x4870b6[_0x1cc6('0x53')]=![];break;default:}return db[_0x1cc6('0x4b')][_0x1cc6('0x54')]['addColumn']('cm_contacts',util[_0x1cc6('0x55')](_0x1cc6('0x56'),_0x292964['id']),_0x4870b6);})['then'](function(){return _0x292964;});})['then'](respondWithResult(_0x33b1b1,0xc9))[_0x1cc6('0x41')](handleError(_0x33b1b1,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index b00da2d..646fe0a 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 _0x69db=['exports','define','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./cmCustomField.attributes'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x69db,0x157));var _0xb69d=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x69db[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0xb69d('0x0'));var util=require(_0xb69d('0x1'));var logger=require(_0xb69d('0x2'))(_0xb69d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb69d('0x4'));var fs=require('fs');var path=require(_0xb69d('0x5'));var rimraf=require(_0xb69d('0x6'));var config=require(_0xb69d('0x7'));var attributes=require(_0xb69d('0x8'));module[_0xb69d('0x9')]=function(_0x3c436d,_0x5c656d){return _0x3c436d[_0xb69d('0xa')]('CmCustomField',attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x54fd=['bluebird','request-promise','path','../../config/environment','./cmCustomField.attributes','exports','define','cm_custom_fields','lodash','../../config/logger','api','moment'];(function(_0x4ec69a,_0x2826de){var _0x280921=function(_0x57a021){while(--_0x57a021){_0x4ec69a['push'](_0x4ec69a['shift']());}};_0x280921(++_0x2826de);}(_0x54fd,0xd4));var _0xd54f=function(_0x8e86f2,_0x339a9b){_0x8e86f2=_0x8e86f2-0x0;var _0x55583c=_0x54fd[_0x8e86f2];return _0x55583c;};'use strict';var _=require(_0xd54f('0x0'));var util=require('util');var logger=require(_0xd54f('0x1'))(_0xd54f('0x2'));var moment=require(_0xd54f('0x3'));var BPromise=require(_0xd54f('0x4'));var rp=require(_0xd54f('0x5'));var fs=require('fs');var path=require(_0xd54f('0x6'));var rimraf=require('rimraf');var config=require(_0xd54f('0x7'));var attributes=require(_0xd54f('0x8'));module[_0xd54f('0x9')]=function(_0xf05f40,_0x5695f0){return _0xf05f40[_0xd54f('0xa')]('CmCustomField',attributes,{'tableName':_0xd54f('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index cca4aec..d17780f 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 _0x8259=['CmCustomField,\x20%s,\x20%s','message','catch','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','CmCustomField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x247ad6,_0xe07448){var _0x3f5c36=function(_0x20f3a5){while(--_0x20f3a5){_0x247ad6['push'](_0x247ad6['shift']());}};_0x3f5c36(++_0xe07448);}(_0x8259,0xd5));var _0x9825=function(_0xbb7573,_0x151b2d){_0xbb7573=_0xbb7573-0x0;var _0x22069e=_0x8259[_0xbb7573];return _0x22069e;};'use strict';var _=require('lodash');var util=require(_0x9825('0x0'));var moment=require('moment');var BPromise=require(_0x9825('0x1'));var rs=require(_0x9825('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9825('0x3'));var logger=require(_0x9825('0x4'))(_0x9825('0x5'));var config=require(_0x9825('0x6'));var jayson=require(_0x9825('0x7'));var client=jayson['client'][_0x9825('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d8757,_0x30d1b1,_0x96884e){return new BPromise(function(_0x9ea8e0,_0x24ffc2){return client[_0x9825('0x9')](_0x1d8757,_0x96884e)[_0x9825('0xa')](function(_0x29ef93){logger[_0x9825('0xb')]('CmCustomField,\x20%s,\x20%s',_0x30d1b1,'request\x20sent');logger[_0x9825('0xc')](_0x9825('0xd'),_0x30d1b1,_0x9825('0xe'),JSON[_0x9825('0xf')](_0x29ef93));if(_0x29ef93[_0x9825('0x10')]){if(_0x29ef93['error'][_0x9825('0x11')]===0x1f4){logger[_0x9825('0x10')](_0x9825('0x12'),_0x30d1b1,_0x29ef93['error']['message']);return _0x24ffc2(_0x29ef93[_0x9825('0x10')][_0x9825('0x13')]);}logger[_0x9825('0x10')](_0x9825('0x12'),_0x30d1b1,_0x29ef93[_0x9825('0x10')]['message']);return _0x9ea8e0(_0x29ef93[_0x9825('0x10')][_0x9825('0x13')]);}else{logger['info']('CmCustomField,\x20%s,\x20%s',_0x30d1b1,_0x9825('0xe'));_0x9ea8e0(_0x29ef93['result']['message']);}})[_0x9825('0x14')](function(_0x32cf9f){logger[_0x9825('0x10')]('CmCustomField,\x20%s,\x20%s',_0x30d1b1,_0x32cf9f);_0x24ffc2(_0x32cf9f);});});} \ No newline at end of file +var _0xa1ac=['info','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0xce0a55,_0xa2d909){var _0x302e4a=function(_0x5c5386){while(--_0x5c5386){_0xce0a55['push'](_0xce0a55['shift']());}};_0x302e4a(++_0xa2d909);}(_0xa1ac,0xde));var _0xca1a=function(_0x2f88cc,_0x29800f){_0x2f88cc=_0x2f88cc-0x0;var _0x3c8e1f=_0xa1ac[_0x2f88cc];return _0x3c8e1f;};'use strict';var _=require(_0xca1a('0x0'));var util=require('util');var moment=require(_0xca1a('0x1'));var BPromise=require(_0xca1a('0x2'));var rs=require(_0xca1a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xca1a('0x4'))['db'];var utils=require(_0xca1a('0x5'));var logger=require(_0xca1a('0x6'))(_0xca1a('0x7'));var config=require(_0xca1a('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xca1a('0x9')][_0xca1a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5903af,_0x56d151,_0x5b8132){return new BPromise(function(_0x146519,_0x16624a){return client[_0xca1a('0xb')](_0x5903af,_0x5b8132)[_0xca1a('0xc')](function(_0x114e4b){logger['info'](_0xca1a('0xd'),_0x56d151,_0xca1a('0xe'));logger[_0xca1a('0xf')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x56d151,_0xca1a('0xe'),JSON[_0xca1a('0x10')](_0x114e4b));if(_0x114e4b[_0xca1a('0x11')]){if(_0x114e4b[_0xca1a('0x11')][_0xca1a('0x12')]===0x1f4){logger[_0xca1a('0x11')](_0xca1a('0xd'),_0x56d151,_0x114e4b[_0xca1a('0x11')][_0xca1a('0x13')]);return _0x16624a(_0x114e4b['error']['message']);}logger['error']('CmCustomField,\x20%s,\x20%s',_0x56d151,_0x114e4b[_0xca1a('0x11')][_0xca1a('0x13')]);return _0x146519(_0x114e4b[_0xca1a('0x11')][_0xca1a('0x13')]);}else{logger[_0xca1a('0x14')](_0xca1a('0xd'),_0x56d151,_0xca1a('0xe'));_0x146519(_0x114e4b[_0xca1a('0x15')]['message']);}})['catch'](function(_0x476ee4){logger[_0xca1a('0x11')](_0xca1a('0xd'),_0x56d151,_0x476ee4);_0x16624a(_0x476ee4);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index ba96350..61783ac 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 _0xe364=['put','update','delete','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','/:id','post'];(function(_0x5f0025,_0x262b05){var _0x1b2407=function(_0x4bd1e8){while(--_0x4bd1e8){_0x5f0025['push'](_0x5f0025['shift']());}};_0x1b2407(++_0x262b05);}(_0xe364,0x1c3));var _0x4e36=function(_0x1283d4,_0x36b6f1){_0x1283d4=_0x1283d4-0x0;var _0x433643=_0xe364[_0x1283d4];return _0x433643;};'use strict';var multer=require('multer');var util=require(_0x4e36('0x0'));var path=require(_0x4e36('0x1'));var timeout=require('connect-timeout');var express=require(_0x4e36('0x2'));var router=express['Router']();var fs_extra=require(_0x4e36('0x3'));var auth=require(_0x4e36('0x4'));var interaction=require(_0x4e36('0x5'));var config=require(_0x4e36('0x6'));var controller=require(_0x4e36('0x7'));router[_0x4e36('0x8')]('/',auth[_0x4e36('0x9')](),controller[_0x4e36('0xa')]);router[_0x4e36('0x8')](_0x4e36('0xb'),auth[_0x4e36('0x9')](),controller['show']);router[_0x4e36('0xc')]('/',auth[_0x4e36('0x9')](),controller['create']);router[_0x4e36('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x4e36('0xe')]);router[_0x4e36('0xf')](_0x4e36('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x455d=['exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','show','create','put','/:id','update','delete','destroy'];(function(_0x523122,_0x422301){var _0x5af5eb=function(_0x522850){while(--_0x522850){_0x523122['push'](_0x523122['shift']());}};_0x5af5eb(++_0x422301);}(_0x455d,0x190));var _0xd455=function(_0x54ae5f,_0x5b501e){_0x54ae5f=_0x54ae5f-0x0;var _0x45527c=_0x455d[_0x54ae5f];return _0x45527c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd455('0x0'));var timeout=require(_0xd455('0x1'));var express=require(_0xd455('0x2'));var router=express['Router']();var fs_extra=require(_0xd455('0x3'));var auth=require(_0xd455('0x4'));var interaction=require(_0xd455('0x5'));var config=require(_0xd455('0x6'));var controller=require(_0xd455('0x7'));router[_0xd455('0x8')]('/',auth[_0xd455('0x9')](),controller[_0xd455('0xa')]);router[_0xd455('0x8')]('/:id',auth[_0xd455('0x9')](),controller[_0xd455('0xb')]);router['post']('/',auth[_0xd455('0x9')](),controller[_0xd455('0xc')]);router[_0xd455('0xd')](_0xd455('0xe'),auth['isAuthenticated'](),controller[_0xd455('0xf')]);router[_0xd455('0x10')]('/:id',auth[_0xd455('0x9')](),controller[_0xd455('0x11')]);module[_0xd455('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 5c157c0..1b600c9 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 _0xcf4d=['STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','BOOLEAN','UNSIGNED','contactListQueue','moment','exports'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xcf4d,0x9e));var _0xdcf4=function(_0x1ca38f,_0x544100){_0x1ca38f=_0x1ca38f-0x0;var _0x5a1901=_0xcf4d[_0x1ca38f];return _0x5a1901;};'use strict';var moment=require(_0xdcf4('0x0'));var Sequelize=require('sequelize');module[_0xdcf4('0x1')]={'phone':{'type':Sequelize[_0xdcf4('0x2')],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xdcf4('0x3')],'defaultValue':moment()[_0xdcf4('0x4')](_0xdcf4('0x5'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xdcf4('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xdcf4('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xdcf4('0x7')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xdcf4('0x3')]},'priority':{'type':Sequelize[_0xdcf4('0x6')](0x2)[_0xdcf4('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xdcf4('0x7')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xdcf4('0x6')],'unique':_0xdcf4('0x9')},'ListId':{'type':Sequelize[_0xdcf4('0x6')],'unique':_0xdcf4('0x9')},'UserId':{'type':Sequelize[_0xdcf4('0x6')]},'VoiceQueueId':{'type':Sequelize[_0xdcf4('0x6')],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0xdcf4('0x6')]},'countnosuchnumberretry':{'type':Sequelize[_0xdcf4('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xdcf4('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0xdcf4('0x6')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']},'recallmeNotifiedDate':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0xa858=['INTEGER','BOOLEAN','UNSIGNED','contactListQueue','sequelize','exports','DATE','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x1b0e20,_0x55749f){var _0x5b34d6=function(_0x1db03d){while(--_0x1db03d){_0x1b0e20['push'](_0x1b0e20['shift']());}};_0x5b34d6(++_0x55749f);}(_0xa858,0x1a2));var _0x8a85=function(_0xf751b7,_0x384650){_0xf751b7=_0xf751b7-0x0;var _0x241dfc=_0xa858[_0xf751b7];return _0x241dfc;};'use strict';var moment=require('moment');var Sequelize=require(_0x8a85('0x0'));module[_0x8a85('0x1')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x8a85('0x2')],'defaultValue':moment()[_0x8a85('0x3')](_0x8a85('0x4'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x8a85('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0x8a85('0x6')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x8a85('0x2')]},'priority':{'type':Sequelize[_0x8a85('0x5')](0x2)[_0x8a85('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x8a85('0x6')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x8a85('0x5')],'unique':_0x8a85('0x8')},'ListId':{'type':Sequelize[_0x8a85('0x5')],'unique':_0x8a85('0x8')},'UserId':{'type':Sequelize[_0x8a85('0x5')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x8a85('0x8')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0x8a85('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x8a85('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x8a85('0x5')],'defaultValue':0x0},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']},'recallmeNotifiedDate':{'type':Sequelize[_0x8a85('0x2')],'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 9e23b64..e0cc86e 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 _0x98d3=['concat','$or','$gt','$ne','$eq','$not','$between','$notBetween','$in','$notIn','$like','$iLike','$overlap','$contains','$any','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','VoiceQueueId','CampaignId','Campaign','omit','createdAt','updatedAt','state','statedesc','user','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','getPreview','getVoiceQueues','outbound','dialOrderByScheduledAt','dialPreviewAutoRecallMe','transaction','value','direction','prev','isEmpty','hopperIds','scheduledAt','ASC','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','LOCK','UPDATE','Contact','Company','CmList','List','VoiceQueue','Queue','dialActive','sequelize','recallme','CmCompany','getOpenContacts','preview','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','getTimezones','timezones','push','utcOffset','getTimezone','moment','lodash','../../config/logger','../../config/environment','json','offset','undefined','limit','count','set','Content-Range','update','then','error','stack','name','status','index','CmHopper','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection'];(function(_0x59e501,_0x5ba25c){var _0x5a2170=function(_0x3695c9){while(--_0x3695c9){_0x59e501['push'](_0x59e501['shift']());}};_0x5a2170(++_0x5ba25c);}(_0x98d3,0x173));var _0x398d=function(_0x43828c,_0x119bd2){_0x43828c=_0x43828c-0x0;var _0x5d0d46=_0x98d3[_0x43828c];return _0x5d0d46;};'use strict';var moment=require(_0x398d('0x0'));var _=require(_0x398d('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x398d('0x2'))('api');var shared=require(_0x398d('0x3'));var db=require('../../mysqldb')['db'];function respondWithResult(_0x465d4a,_0x41f57c){_0x41f57c=_0x41f57c||0xc8;return function(_0x4f7a58){if(_0x4f7a58){return _0x465d4a['status'](_0x41f57c)[_0x398d('0x4')](_0x4f7a58);}};}function respondWithFilteredResult(_0x25d38f,_0x2c3c4c){return function(_0x502652){if(_0x502652){var _0x4ba1a3=typeof _0x2c3c4c[_0x398d('0x5')]===_0x398d('0x6')&&typeof _0x2c3c4c[_0x398d('0x7')]===_0x398d('0x6');var _0x54c349=_0x502652[_0x398d('0x8')];var _0x147aec=_0x4ba1a3?0x0:_0x2c3c4c[_0x398d('0x5')];var _0x3841e6=_0x4ba1a3?_0x502652[_0x398d('0x8')]:_0x2c3c4c[_0x398d('0x5')]+_0x2c3c4c[_0x398d('0x7')];var _0x101bfc;if(_0x3841e6>=_0x54c349){_0x3841e6=_0x54c349;_0x101bfc=0xc8;}else{_0x101bfc=0xce;}_0x25d38f['status'](_0x101bfc);return _0x25d38f[_0x398d('0x9')](_0x398d('0xa'),_0x147aec+'-'+_0x3841e6+'/'+_0x54c349)[_0x398d('0x4')](_0x502652);}return null;};}function saveUpdates(_0x12eb91,_0x15a424){return function(_0x91619e){if(_0x91619e){return _0x91619e[_0x398d('0xb')](_0x12eb91)[_0x398d('0xc')](function(_0x3bf2a2){return _0x3bf2a2;});}return null;};}function handleEntityNotFound(_0x396015,_0x1fc998){return function(_0x537bb6){if(!_0x537bb6){_0x396015['sendStatus'](0x194);}return _0x537bb6;};}function handleError(_0x3d424f,_0x36cde2){_0x36cde2=_0x36cde2||0x1f4;return function(_0x347508){logger[_0x398d('0xd')](_0x347508[_0x398d('0xe')]);if(_0x347508[_0x398d('0xf')]){delete _0x347508[_0x398d('0xf')];}_0x3d424f[_0x398d('0x10')](_0x36cde2)['send'](_0x347508);};}exports[_0x398d('0x11')]=function(_0x54e717,_0x673840){var _0x476c36={},_0x297768={},_0x5de1be={'count':0x0,'rows':[]};var _0x4c5c9d=_['map'](db[_0x398d('0x12')][_0x398d('0x13')],function(_0x117baa){return{'name':_0x117baa[_0x398d('0x14')],'type':_0x117baa[_0x398d('0x15')][_0x398d('0x16')]};});_0x297768[_0x398d('0x17')]=_['map'](_0x4c5c9d,'name');_0x297768['query']=_[_0x398d('0x18')](_0x54e717[_0x398d('0x19')]);_0x297768[_0x398d('0x1a')]=_[_0x398d('0x1b')](_0x297768[_0x398d('0x17')],_0x297768['query']);_0x297768['filters']=_[_0x398d('0x1c')](_0x297768[_0x398d('0x1a')],['$and',_0x398d('0x1d'),_0x398d('0x1e'),'$gte','$lt','$lte',_0x398d('0x1f'),_0x398d('0x20'),_0x398d('0x21'),_0x398d('0x22'),_0x398d('0x23'),_0x398d('0x24'),_0x398d('0x25'),_0x398d('0x26'),'$notLike',_0x398d('0x27'),'$notILike','$like',_0x398d('0x28'),_0x398d('0x29'),'$contained',_0x398d('0x2a')]);_0x476c36['attributes']=_[_0x398d('0x1b')](_0x297768[_0x398d('0x17')],qs['fields'](_0x54e717['query'][_0x398d('0x2b')]));_0x476c36[_0x398d('0x2c')]=_0x476c36['attributes'][_0x398d('0x2d')]?_0x476c36[_0x398d('0x2c')]:_0x297768[_0x398d('0x17')];if(!_0x54e717[_0x398d('0x19')][_0x398d('0x2e')](_0x398d('0x2f'))){_0x476c36['limit']=qs['limit'](_0x54e717[_0x398d('0x19')][_0x398d('0x7')]);_0x476c36[_0x398d('0x5')]=qs[_0x398d('0x5')](_0x54e717[_0x398d('0x19')][_0x398d('0x5')]);}_0x476c36[_0x398d('0x30')]=qs[_0x398d('0x31')](_0x54e717[_0x398d('0x19')]['sort']);_0x476c36[_0x398d('0x32')]=qs[_0x398d('0x1a')](_[_0x398d('0x33')](_0x54e717['query'],_0x297768['filters']),_0x4c5c9d);if(_0x54e717[_0x398d('0x19')][_0x398d('0x34')]){_0x476c36[_0x398d('0x32')]=_[_0x398d('0x35')](_0x476c36[_0x398d('0x32')],{'$or':_[_0x398d('0x36')](_0x4c5c9d,function(_0x324d76){if(_0x324d76[_0x398d('0x15')]!==_0x398d('0x37')){var _0x2a95bc={};_0x2a95bc[_0x324d76[_0x398d('0xf')]]={'$like':'%'+_0x54e717[_0x398d('0x19')][_0x398d('0x34')]+'%'};return _0x2a95bc;}})});}_0x476c36=_[_0x398d('0x35')]({},_0x476c36,_0x54e717[_0x398d('0x38')]);var _0x302314={'where':_0x476c36[_0x398d('0x32')]};return db[_0x398d('0x12')][_0x398d('0x8')](_0x302314)['then'](function(_0x244512){_0x5de1be[_0x398d('0x8')]=_0x244512;if(_0x54e717[_0x398d('0x19')][_0x398d('0x39')]){_0x476c36[_0x398d('0x3a')]=[{'all':!![]}];}return db[_0x398d('0x12')][_0x398d('0x3b')](_0x476c36);})['then'](function(_0x17976b){_0x5de1be[_0x398d('0x3c')]=_0x17976b;return _0x5de1be;})[_0x398d('0xc')](respondWithFilteredResult(_0x673840,_0x476c36))[_0x398d('0x3d')](handleError(_0x673840,null));};exports[_0x398d('0x3e')]=function(_0x219651,_0x4d57cc){var _0x3dddcf={'raw':!![],'where':{'id':_0x219651[_0x398d('0x3f')]['id']}},_0x518e7c={};_0x518e7c[_0x398d('0x17')]=_[_0x398d('0x18')](db[_0x398d('0x12')][_0x398d('0x13')]);_0x518e7c['query']=_[_0x398d('0x18')](_0x219651[_0x398d('0x19')]);_0x518e7c['filters']=_[_0x398d('0x1b')](_0x518e7c[_0x398d('0x17')],_0x518e7c[_0x398d('0x19')]);_0x3dddcf[_0x398d('0x2c')]=_[_0x398d('0x1b')](_0x518e7c[_0x398d('0x17')],qs[_0x398d('0x2b')](_0x219651[_0x398d('0x19')][_0x398d('0x2b')]));_0x3dddcf['attributes']=_0x3dddcf[_0x398d('0x2c')][_0x398d('0x2d')]?_0x3dddcf[_0x398d('0x2c')]:_0x518e7c[_0x398d('0x17')];if(_0x219651[_0x398d('0x19')][_0x398d('0x39')]){_0x3dddcf['include']=[{'all':!![]}];}_0x3dddcf=_[_0x398d('0x35')]({},_0x3dddcf,_0x219651[_0x398d('0x38')]);return db['CmHopper'][_0x398d('0x40')](_0x3dddcf)[_0x398d('0xc')](handleEntityNotFound(_0x4d57cc,null))[_0x398d('0xc')](respondWithResult(_0x4d57cc,null))['catch'](handleError(_0x4d57cc,null));};exports[_0x398d('0x41')]=function(_0x19dabb,_0x1b3e1a){return db[_0x398d('0x12')][_0x398d('0x41')](_0x19dabb['body'],{})[_0x398d('0xc')](respondWithResult(_0x1b3e1a,0xc9))[_0x398d('0x3d')](handleError(_0x1b3e1a,null));};exports[_0x398d('0xb')]=function(_0x532aaa,_0x2e4acb){if(_0x532aaa[_0x398d('0x42')]['id']){delete _0x532aaa['body']['id'];}return db[_0x398d('0x12')][_0x398d('0x40')]({'where':{'id':_0x532aaa[_0x398d('0x3f')]['id']}})[_0x398d('0xc')](handleEntityNotFound(_0x2e4acb,null))[_0x398d('0xc')](saveUpdates(_0x532aaa[_0x398d('0x42')],null))[_0x398d('0xc')](respondWithResult(_0x2e4acb,null))[_0x398d('0x3d')](handleError(_0x2e4acb,null));};exports['describe']=function(_0x34c0fc,_0x3f146c){return db['CmHopper']['describe']()[_0x398d('0xc')](respondWithResult(_0x3f146c,null))[_0x398d('0x3d')](handleError(_0x3f146c,null));};exports[_0x398d('0x43')]=function(_0x35d260,_0x49a6de){var _0x40418d;var _0x4826b2=_0x35d260[_0x398d('0x3f')]['id'];return db['CmHopper'][_0x398d('0x40')]({'where':{'id':_0x35d260['params']['id']}})['then'](handleEntityNotFound(_0x49a6de,null))['then'](function(_0x38604a){if(_0x38604a){return _0x38604a[_0x398d('0x43')]()[_0x398d('0xc')](function(_0x3fa030){return _0x3fa030;});}})['then'](function(_0x5d864a){_0x40418d=_0x5d864a;if(_0x5d864a){if(_0x5d864a[_0x398d('0x44')]||_0x5d864a[_0x398d('0x45')]){return db[_0x5d864a[_0x398d('0x44')]?'VoiceQueue':_0x398d('0x46')][_0x398d('0x40')]({'where':{'id':_0x5d864a[_0x398d('0x44')]?_0x5d864a[_0x398d('0x44')]:_0x5d864a[_0x398d('0x45')]},'attributes':['id',_0x398d('0xf')],'raw':!![]});}}})['then'](function(_0x158828){var _0xfb9f18={};if(_0x158828){_[_0x398d('0x35')](_0xfb9f18,_[_0x398d('0x47')](_0x40418d['dataValues'],[_0x398d('0x48'),_0x398d('0x49'),'id']));_0xfb9f18[_0x398d('0x4a')]=0x15;_0xfb9f18[_0x398d('0x4b')]='deleted';_0xfb9f18['campaign']=_0x158828[_0x398d('0xf')];_0xfb9f18['membername']=_0x35d260[_0x398d('0x4c')][_0x398d('0xf')];_0xfb9f18['UserId']=_0x35d260[_0x398d('0x4c')]['id'];_0xfb9f18['deleted']=!![];_0xfb9f18[_0x398d('0x4d')]=moment()[_0x398d('0x4e')](_0x398d('0x4f'));_0xfb9f18[_0x398d('0x50')]=_0x40418d[_0x398d('0x51')];_0xfb9f18[_0x398d('0x52')]=_0x40418d[_0x398d('0x44')]?_0x398d('0x53'):_0x398d('0x54');return db[_0x398d('0x55')][_0x398d('0x40')]({'where':{'id':_0xfb9f18[_0x398d('0x56')]},'attributes':[_0x398d('0x57'),_0x398d('0x58')]})[_0x398d('0xc')](function(_0x3f3108){if(!_[_0x398d('0x59')](_0x49a6de)&&!_[_0x398d('0x59')](_0x3f3108[_0x398d('0x57')])){_0xfb9f18[_0x398d('0x5a')]=_0x3f3108[_0x398d('0x57')];if(!_[_0x398d('0x59')](_0x3f3108['lastName'])){_0xfb9f18[_0x398d('0x5a')]+='\x20'+_0x3f3108[_0x398d('0x58')];}}})[_0x398d('0x5b')](function(){return db[_0x398d('0x5c')][_0x398d('0x41')](_0xfb9f18);});}})[_0x398d('0xc')](function(_0x22d30a){return db[_0x398d('0x5d')][_0x398d('0x43')]({'where':{'CmHopperId':_0x4826b2}});})[_0x398d('0xc')](function(){return _0x49a6de[_0x398d('0x10')](0xcc)['end']();})[_0x398d('0x3d')](handleError(_0x49a6de,null));};exports[_0x398d('0x5e')]=function(_0x545a5d,_0x362471){var _0x548a8a=[];return db['CmContact']['describe']()[_0x398d('0xc')](function(_0x38970c){_0x548a8a=_['keys'](_0x38970c);return _0x545a5d[_0x398d('0x4c')][_0x398d('0x5f')]({'where':{'type':_0x398d('0x60'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0x398d('0x61'),_0x398d('0x62')],'raw':!![]});})[_0x398d('0xc')](function(_0x5dcb9c){if(_0x5dcb9c&&_0x5dcb9c[_0x398d('0x2d')]){return db['sequelize'][_0x398d('0x63')](function(_0x5a7de6){var _0x4501a9={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x398d('0x4f'))},'VoiceQueueId':{'$in':_[_0x398d('0x36')](_0x5dcb9c,'id')},'$or':[{'UserId':null},{'UserId':_0x545a5d[_0x398d('0x4c')]['id']}]};var _0x322eec={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x5dcb9c)[_0x398d('0x34')](['dialPreviewAutoRecallMe',0x0])[_0x398d('0x36')]('id')[_0x398d('0x64')]()},'$or':[{'UserId':null},{'UserId':_0x545a5d[_0x398d('0x4c')]['id']}]};var _0x4f6cff={'$or':[_0x4501a9,_0x322eec]};var _0x21026=[];if(_0x545a5d[_0x398d('0x42')][_0x398d('0x65')]&&_0x545a5d['body'][_0x398d('0x65')]===_0x398d('0x66')){if(!_[_0x398d('0x67')](_0x545a5d['body']['hopperIds'])){_0x4f6cff['id']={'$in':_0x545a5d[_0x398d('0x42')][_0x398d('0x68')]};}_0x21026=[['priority','ASC'],[_0x398d('0x69'),_0x5dcb9c[0x0]['dialOrderByScheduledAt']===_0x398d('0x6a')?'DESC':_0x398d('0x6a')],db['sequelize']['literal']('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0x398d('0x6b')]];}else{if(!_[_0x398d('0x67')](_0x545a5d[_0x398d('0x42')][_0x398d('0x68')])){_0x4f6cff['id']={'$notIn':_0x545a5d[_0x398d('0x42')]['hopperIds']};}_0x21026=[['priority','DESC'],['scheduledAt',_0x5dcb9c[0x0][_0x398d('0x61')]],db['sequelize'][_0x398d('0x6c')](_0x398d('0x6d')),['id',_0x398d('0x6a')]];}return db[_0x398d('0x12')][_0x398d('0x6e')]({'attributes':['id',_0x398d('0x6f'),'phone','recallme'],'where':_0x4f6cff,'order':_0x21026,'transaction':_0x5a7de6,'lock':_0x5a7de6[_0x398d('0x70')][_0x398d('0x71')],'include':[{'model':db['CmContact'],'as':_0x398d('0x72'),'attributes':_0x548a8a,'include':[{'model':db['CmCompany'],'as':_0x398d('0x73'),'attributes':['id',_0x398d('0xf')]}]},{'model':db[_0x398d('0x74')],'as':_0x398d('0x75'),'attributes':['id','name']},{'model':db[_0x398d('0x76')],'as':_0x398d('0x77'),'attributes':['id',_0x398d('0xf'),_0x398d('0x78')]}]})[_0x398d('0xc')](function(_0x550d71){if(_0x550d71){return _0x550d71[_0x398d('0xb')]({'UserId':_0x545a5d['user']['id']},{'transaction':_0x5a7de6});}});});}})[_0x398d('0xc')](handleEntityNotFound(_0x362471,null))[_0x398d('0xc')](respondWithResult(_0x362471,null))[_0x398d('0x3d')](handleError(_0x362471,null));};exports['getPreviewRecall']=function(_0x135d5d,_0x15be8d,_0x5492b6){var _0x37c9e2=[];var _0x36801f=_0x135d5d[_0x398d('0x3f')]['id'];var _0x4eeee5=_0x135d5d['user']['id'];return db['CmContact']['describe']()[_0x398d('0xc')](function(_0x56fc73){_0x37c9e2=_[_0x398d('0x18')](_0x56fc73);return db[_0x398d('0x79')][_0x398d('0x63')](function(_0x1ccd23){const _0x19f1c6={'id':_0x36801f};return db[_0x398d('0x12')]['findOne']({'attributes':['id',_0x398d('0x6f'),_0x398d('0x7a')],'where':_0x19f1c6,'transaction':_0x1ccd23,'lock':_0x1ccd23['LOCK'][_0x398d('0x71')],'include':[{'model':db[_0x398d('0x55')],'as':_0x398d('0x72'),'attributes':_0x37c9e2,'include':[{'model':db[_0x398d('0x7b')],'as':_0x398d('0x73'),'attributes':['id',_0x398d('0xf')]}]},{'model':db[_0x398d('0x74')],'as':_0x398d('0x75'),'attributes':['id',_0x398d('0xf')]},{'model':db[_0x398d('0x76')],'as':'Queue','attributes':['id',_0x398d('0xf'),_0x398d('0x78')]}]})[_0x398d('0xc')](function(_0x5bd2cf){if(_0x5bd2cf){return _0x5bd2cf[_0x398d('0xb')]({'UserId':_0x4eeee5},{'transaction':_0x1ccd23});}});});})[_0x398d('0xc')](handleEntityNotFound(_0x15be8d,null))[_0x398d('0xc')](respondWithResult(_0x15be8d,null))[_0x398d('0x3d')](handleError(_0x15be8d,null));};exports[_0x398d('0x7c')]=function(_0x2ba660,_0x2f9fba){return _0x2ba660[_0x398d('0x4c')]['getVoiceQueues']({'where':{'type':_0x398d('0x60'),'dialActive':!![],'dialMethod':_0x398d('0x7d')},'attributes':['id'],'raw':!![]})[_0x398d('0xc')](function(_0x46e7e0){if(_0x46e7e0&&_0x46e7e0[_0x398d('0x2d')]){return db[_0x398d('0x12')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x398d('0x4f'))},'VoiceQueueId':{'$in':_[_0x398d('0x36')](_0x46e7e0,'id')},'$or':[{'UserId':null},{'UserId':_0x2ba660[_0x398d('0x4c')]['id']}]}});}return 0x0;})[_0x398d('0xc')](function(_0x59f6a0){if(!_['isNil'](_0x59f6a0)&&_[_0x398d('0x7e')](_0x59f6a0)){return _0x2f9fba[_0x398d('0x10')](0xc8)[_0x398d('0x4')]({'contacts':_0x59f6a0});}else{logger[_0x398d('0xd')](_0x398d('0x7f'),'getOpenContacts',0x194,'entity\x20not\x20found');_0x2f9fba['sendStatus'](0x194);}})[_0x398d('0x3d')](handleError(_0x2f9fba,null));};exports[_0x398d('0x80')]=function(_0x23d8b6,_0xc6066a){var _0x2bed67=shared[_0x398d('0x81')];var _0x444c98=[];_[_0x398d('0x36')](_0x2bed67,function(_0x37cf92){_0x444c98[_0x398d('0x82')]({'id':_0x37cf92[_0x398d('0xf')],'name':_0x37cf92[_0x398d('0xf')],'utcOffset':_0x37cf92[_0x398d('0x83')]});});return _0xc6066a[_0x398d('0x10')](0xc8)[_0x398d('0x4')]({'tz':_0x444c98});};exports[_0x398d('0x84')]=function(_0x35a491,_0x34142f){var _0x551b72=shared['timezones'];var _0x34d8bd={};if(!_[_0x398d('0x59')](_0x551b72[_0x35a491[_0x398d('0x42')]['id']]))_0x34d8bd=_0x551b72[_0x35a491['body']['id']];return _0x34142f[_0x398d('0x10')](0xc8)[_0x398d('0x4')](_0x34d8bd);}; \ No newline at end of file +var _0xde64=['where','pick','filter','merge','VIRTUAL','options','count','include','findAll','rows','catch','show','includeAll','find','create','body','params','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','dataValues','state','statedesc','deleted','campaign','membername','user','deletedat','format','calleridnum','phone','queue','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','end','getPreview','getVoiceQueues','outbound','dialOrderByScheduledAt','dialPreviewAutoRecallMe','length','YYYY-MM-DD\x20HH:mm:ss','value','direction','prev','isEmpty','hopperIds','ASC','scheduledAt','DESC','sequelize','literal','priority','findOne','scheduledat','recallme','LOCK','UPDATE','Contact','CmCompany','CmList','List','Queue','dialActive','getPreviewRecall','transaction','Company','preview','isNumber','error','CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts','entity\x20not\x20found','getTimezones','push','utcOffset','getTimezone','timezones','moment','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','json','offset','undefined','limit','status','set','update','then','sendStatus','name','send','index','map','CmHopper','rawAttributes','fieldName','type','key','query','keys','intersection','filters','concat','$and','$or','$gt','$gte','$lt','$lte','$ne','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','$contained','$any','attributes','model','fields','nolimit','order','sort'];(function(_0x4cf0b7,_0x560029){var _0x545f10=function(_0x993533){while(--_0x993533){_0x4cf0b7['push'](_0x4cf0b7['shift']());}};_0x545f10(++_0x560029);}(_0xde64,0x17c));var _0x4de6=function(_0x7ed5c,_0x2291af){_0x7ed5c=_0x7ed5c-0x0;var _0x3ca005=_0xde64[_0x7ed5c];return _0x3ca005;};'use strict';var moment=require(_0x4de6('0x0'));var _=require(_0x4de6('0x1'));var qs=require(_0x4de6('0x2'));var logger=require(_0x4de6('0x3'))(_0x4de6('0x4'));var shared=require(_0x4de6('0x5'));var db=require('../../mysqldb')['db'];function respondWithResult(_0x3c4b91,_0x3bd290){_0x3bd290=_0x3bd290||0xc8;return function(_0x5a5c5a){if(_0x5a5c5a){return _0x3c4b91['status'](_0x3bd290)[_0x4de6('0x6')](_0x5a5c5a);}};}function respondWithFilteredResult(_0x45867b,_0x4da17f){return function(_0x568496){if(_0x568496){var _0x24edef=typeof _0x4da17f[_0x4de6('0x7')]===_0x4de6('0x8')&&typeof _0x4da17f[_0x4de6('0x9')]===_0x4de6('0x8');var _0x202cdc=_0x568496['count'];var _0x267c1a=_0x24edef?0x0:_0x4da17f[_0x4de6('0x7')];var _0x1dbeed=_0x24edef?_0x568496['count']:_0x4da17f[_0x4de6('0x7')]+_0x4da17f[_0x4de6('0x9')];var _0x2e205b;if(_0x1dbeed>=_0x202cdc){_0x1dbeed=_0x202cdc;_0x2e205b=0xc8;}else{_0x2e205b=0xce;}_0x45867b[_0x4de6('0xa')](_0x2e205b);return _0x45867b[_0x4de6('0xb')]('Content-Range',_0x267c1a+'-'+_0x1dbeed+'/'+_0x202cdc)[_0x4de6('0x6')](_0x568496);}return null;};}function saveUpdates(_0x3baa31,_0xb8e256){return function(_0x509002){if(_0x509002){return _0x509002[_0x4de6('0xc')](_0x3baa31)[_0x4de6('0xd')](function(_0x27c108){return _0x27c108;});}return null;};}function handleEntityNotFound(_0x2bd121,_0x58b0c1){return function(_0x1ccfee){if(!_0x1ccfee){_0x2bd121[_0x4de6('0xe')](0x194);}return _0x1ccfee;};}function handleError(_0x43d59b,_0x4dd3b5){_0x4dd3b5=_0x4dd3b5||0x1f4;return function(_0x33fd67){logger['error'](_0x33fd67['stack']);if(_0x33fd67[_0x4de6('0xf')]){delete _0x33fd67[_0x4de6('0xf')];}_0x43d59b[_0x4de6('0xa')](_0x4dd3b5)[_0x4de6('0x10')](_0x33fd67);};}exports[_0x4de6('0x11')]=function(_0x279278,_0x324202){var _0x5aacb4={},_0x420f7c={},_0xea1610={'count':0x0,'rows':[]};var _0x2c7e57=_[_0x4de6('0x12')](db[_0x4de6('0x13')][_0x4de6('0x14')],function(_0x20855f){return{'name':_0x20855f[_0x4de6('0x15')],'type':_0x20855f[_0x4de6('0x16')][_0x4de6('0x17')]};});_0x420f7c['model']=_[_0x4de6('0x12')](_0x2c7e57,'name');_0x420f7c[_0x4de6('0x18')]=_[_0x4de6('0x19')](_0x279278[_0x4de6('0x18')]);_0x420f7c['filters']=_[_0x4de6('0x1a')](_0x420f7c['model'],_0x420f7c[_0x4de6('0x18')]);_0x420f7c[_0x4de6('0x1b')]=_[_0x4de6('0x1c')](_0x420f7c['filters'],[_0x4de6('0x1d'),_0x4de6('0x1e'),_0x4de6('0x1f'),_0x4de6('0x20'),_0x4de6('0x21'),_0x4de6('0x22'),_0x4de6('0x23'),'$eq',_0x4de6('0x24'),_0x4de6('0x25'),_0x4de6('0x26'),_0x4de6('0x27'),_0x4de6('0x28'),_0x4de6('0x29'),_0x4de6('0x2a'),_0x4de6('0x2b'),_0x4de6('0x2c'),'$like',_0x4de6('0x2d'),_0x4de6('0x2e'),_0x4de6('0x2f'),_0x4de6('0x30')]);_0x5aacb4[_0x4de6('0x31')]=_['intersection'](_0x420f7c[_0x4de6('0x32')],qs['fields'](_0x279278[_0x4de6('0x18')][_0x4de6('0x33')]));_0x5aacb4[_0x4de6('0x31')]=_0x5aacb4[_0x4de6('0x31')]['length']?_0x5aacb4['attributes']:_0x420f7c['model'];if(!_0x279278['query']['hasOwnProperty'](_0x4de6('0x34'))){_0x5aacb4[_0x4de6('0x9')]=qs[_0x4de6('0x9')](_0x279278[_0x4de6('0x18')][_0x4de6('0x9')]);_0x5aacb4[_0x4de6('0x7')]=qs[_0x4de6('0x7')](_0x279278[_0x4de6('0x18')][_0x4de6('0x7')]);}_0x5aacb4[_0x4de6('0x35')]=qs[_0x4de6('0x36')](_0x279278[_0x4de6('0x18')][_0x4de6('0x36')]);_0x5aacb4[_0x4de6('0x37')]=qs[_0x4de6('0x1b')](_[_0x4de6('0x38')](_0x279278[_0x4de6('0x18')],_0x420f7c[_0x4de6('0x1b')]),_0x2c7e57);if(_0x279278[_0x4de6('0x18')][_0x4de6('0x39')]){_0x5aacb4[_0x4de6('0x37')]=_[_0x4de6('0x3a')](_0x5aacb4[_0x4de6('0x37')],{'$or':_[_0x4de6('0x12')](_0x2c7e57,function(_0x1aab6e){if(_0x1aab6e[_0x4de6('0x16')]!==_0x4de6('0x3b')){var _0x12d20e={};_0x12d20e[_0x1aab6e[_0x4de6('0xf')]]={'$like':'%'+_0x279278['query'][_0x4de6('0x39')]+'%'};return _0x12d20e;}})});}_0x5aacb4=_[_0x4de6('0x3a')]({},_0x5aacb4,_0x279278[_0x4de6('0x3c')]);var _0x3bf31f={'where':_0x5aacb4['where']};return db[_0x4de6('0x13')][_0x4de6('0x3d')](_0x3bf31f)[_0x4de6('0xd')](function(_0x122493){_0xea1610['count']=_0x122493;if(_0x279278[_0x4de6('0x18')]['includeAll']){_0x5aacb4[_0x4de6('0x3e')]=[{'all':!![]}];}return db[_0x4de6('0x13')][_0x4de6('0x3f')](_0x5aacb4);})[_0x4de6('0xd')](function(_0x37feb0){_0xea1610[_0x4de6('0x40')]=_0x37feb0;return _0xea1610;})[_0x4de6('0xd')](respondWithFilteredResult(_0x324202,_0x5aacb4))[_0x4de6('0x41')](handleError(_0x324202,null));};exports[_0x4de6('0x42')]=function(_0xdfa5ed,_0x85581b){var _0x1f0262={'raw':!![],'where':{'id':_0xdfa5ed['params']['id']}},_0x551440={};_0x551440[_0x4de6('0x32')]=_[_0x4de6('0x19')](db[_0x4de6('0x13')][_0x4de6('0x14')]);_0x551440['query']=_['keys'](_0xdfa5ed[_0x4de6('0x18')]);_0x551440['filters']=_[_0x4de6('0x1a')](_0x551440['model'],_0x551440[_0x4de6('0x18')]);_0x1f0262['attributes']=_[_0x4de6('0x1a')](_0x551440[_0x4de6('0x32')],qs[_0x4de6('0x33')](_0xdfa5ed[_0x4de6('0x18')]['fields']));_0x1f0262[_0x4de6('0x31')]=_0x1f0262[_0x4de6('0x31')]['length']?_0x1f0262['attributes']:_0x551440[_0x4de6('0x32')];if(_0xdfa5ed['query'][_0x4de6('0x43')]){_0x1f0262[_0x4de6('0x3e')]=[{'all':!![]}];}_0x1f0262=_[_0x4de6('0x3a')]({},_0x1f0262,_0xdfa5ed[_0x4de6('0x3c')]);return db[_0x4de6('0x13')][_0x4de6('0x44')](_0x1f0262)[_0x4de6('0xd')](handleEntityNotFound(_0x85581b,null))[_0x4de6('0xd')](respondWithResult(_0x85581b,null))[_0x4de6('0x41')](handleError(_0x85581b,null));};exports[_0x4de6('0x45')]=function(_0x2cb079,_0x90ad4f){return db['CmHopper']['create'](_0x2cb079['body'],{})[_0x4de6('0xd')](respondWithResult(_0x90ad4f,0xc9))[_0x4de6('0x41')](handleError(_0x90ad4f,null));};exports['update']=function(_0x57fb2f,_0x16a12d){if(_0x57fb2f['body']['id']){delete _0x57fb2f[_0x4de6('0x46')]['id'];}return db[_0x4de6('0x13')]['find']({'where':{'id':_0x57fb2f[_0x4de6('0x47')]['id']}})[_0x4de6('0xd')](handleEntityNotFound(_0x16a12d,null))[_0x4de6('0xd')](saveUpdates(_0x57fb2f[_0x4de6('0x46')],null))[_0x4de6('0xd')](respondWithResult(_0x16a12d,null))['catch'](handleError(_0x16a12d,null));};exports[_0x4de6('0x48')]=function(_0x388b78,_0x2e23ad){return db[_0x4de6('0x13')][_0x4de6('0x48')]()[_0x4de6('0xd')](respondWithResult(_0x2e23ad,null))[_0x4de6('0x41')](handleError(_0x2e23ad,null));};exports[_0x4de6('0x49')]=function(_0x698dcb,_0x3126f1){var _0x367c8f;var _0x35df53=_0x698dcb[_0x4de6('0x47')]['id'];return db[_0x4de6('0x13')][_0x4de6('0x44')]({'where':{'id':_0x698dcb[_0x4de6('0x47')]['id']}})[_0x4de6('0xd')](handleEntityNotFound(_0x3126f1,null))['then'](function(_0x5eab19){if(_0x5eab19){return _0x5eab19[_0x4de6('0x49')]()[_0x4de6('0xd')](function(_0x524807){return _0x524807;});}})[_0x4de6('0xd')](function(_0x191f93){_0x367c8f=_0x191f93;if(_0x191f93){if(_0x191f93[_0x4de6('0x4a')]||_0x191f93[_0x4de6('0x4b')]){return db[_0x191f93[_0x4de6('0x4a')]?_0x4de6('0x4c'):_0x4de6('0x4d')]['find']({'where':{'id':_0x191f93[_0x4de6('0x4a')]?_0x191f93['VoiceQueueId']:_0x191f93[_0x4de6('0x4b')]},'attributes':['id',_0x4de6('0xf')],'raw':!![]});}}})[_0x4de6('0xd')](function(_0xb8b798){var _0x3326ad={};if(_0xb8b798){_[_0x4de6('0x3a')](_0x3326ad,_[_0x4de6('0x4e')](_0x367c8f[_0x4de6('0x4f')],['createdAt','updatedAt','id']));_0x3326ad[_0x4de6('0x50')]=0x15;_0x3326ad[_0x4de6('0x51')]=_0x4de6('0x52');_0x3326ad[_0x4de6('0x53')]=_0xb8b798['name'];_0x3326ad[_0x4de6('0x54')]=_0x698dcb[_0x4de6('0x55')][_0x4de6('0xf')];_0x3326ad['UserId']=_0x698dcb[_0x4de6('0x55')]['id'];_0x3326ad['deleted']=!![];_0x3326ad[_0x4de6('0x56')]=moment()[_0x4de6('0x57')]('YYYY-MM-DD\x20HH:mm:ss');_0x3326ad[_0x4de6('0x58')]=_0x367c8f[_0x4de6('0x59')];_0x3326ad['campaigntype']=_0x367c8f[_0x4de6('0x4a')]?_0x4de6('0x5a'):_0x4de6('0x5b');return db[_0x4de6('0x5c')][_0x4de6('0x44')]({'where':{'id':_0x3326ad[_0x4de6('0x5d')]},'attributes':[_0x4de6('0x5e'),_0x4de6('0x5f')]})[_0x4de6('0xd')](function(_0x46b82f){if(!_[_0x4de6('0x60')](_0x3126f1)&&!_['isNil'](_0x46b82f[_0x4de6('0x5e')])){_0x3326ad[_0x4de6('0x61')]=_0x46b82f[_0x4de6('0x5e')];if(!_['isNil'](_0x46b82f[_0x4de6('0x5f')])){_0x3326ad[_0x4de6('0x61')]+='\x20'+_0x46b82f['lastName'];}}})[_0x4de6('0x62')](function(){return db[_0x4de6('0x63')][_0x4de6('0x45')](_0x3326ad);});}})[_0x4de6('0xd')](function(_0x49b8c2){return db[_0x4de6('0x64')][_0x4de6('0x49')]({'where':{'CmHopperId':_0x35df53}});})[_0x4de6('0xd')](function(){return _0x3126f1['status'](0xcc)[_0x4de6('0x65')]();})[_0x4de6('0x41')](handleError(_0x3126f1,null));};exports[_0x4de6('0x66')]=function(_0x34065e,_0x1e4dc2){var _0x358faa=[];return db[_0x4de6('0x5c')][_0x4de6('0x48')]()[_0x4de6('0xd')](function(_0x2e748a){_0x358faa=_[_0x4de6('0x19')](_0x2e748a);return _0x34065e[_0x4de6('0x55')][_0x4de6('0x67')]({'where':{'type':_0x4de6('0x68'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0x4de6('0x69'),_0x4de6('0x6a')],'raw':!![]});})['then'](function(_0x2f68e2){if(_0x2f68e2&&_0x2f68e2[_0x4de6('0x6b')]){return db['sequelize']['transaction'](function(_0x5b4fe9){var _0x4ebcd3={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x4de6('0x57')](_0x4de6('0x6c'))},'VoiceQueueId':{'$in':_[_0x4de6('0x12')](_0x2f68e2,'id')},'$or':[{'UserId':null},{'UserId':_0x34065e[_0x4de6('0x55')]['id']}]};var _0x3b3a3c={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x2f68e2)[_0x4de6('0x39')]([_0x4de6('0x6a'),0x0])[_0x4de6('0x12')]('id')[_0x4de6('0x6d')]()},'$or':[{'UserId':null},{'UserId':_0x34065e['user']['id']}]};var _0x5e400b={'$or':[_0x4ebcd3,_0x3b3a3c]};var _0x1dae3a=[];if(_0x34065e[_0x4de6('0x46')]['direction']&&_0x34065e[_0x4de6('0x46')][_0x4de6('0x6e')]===_0x4de6('0x6f')){if(!_[_0x4de6('0x70')](_0x34065e[_0x4de6('0x46')][_0x4de6('0x71')])){_0x5e400b['id']={'$in':_0x34065e[_0x4de6('0x46')][_0x4de6('0x71')]};}_0x1dae3a=[['priority',_0x4de6('0x72')],[_0x4de6('0x73'),_0x2f68e2[0x0]['dialOrderByScheduledAt']==='ASC'?_0x4de6('0x74'):_0x4de6('0x72')],db[_0x4de6('0x75')][_0x4de6('0x76')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0x4de6('0x74')]];}else{if(!_['isEmpty'](_0x34065e['body'][_0x4de6('0x71')])){_0x5e400b['id']={'$notIn':_0x34065e['body']['hopperIds']};}_0x1dae3a=[[_0x4de6('0x77'),_0x4de6('0x74')],['scheduledAt',_0x2f68e2[0x0][_0x4de6('0x69')]],db[_0x4de6('0x75')][_0x4de6('0x76')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id','ASC']];}return db['CmHopper'][_0x4de6('0x78')]({'attributes':['id',_0x4de6('0x79'),_0x4de6('0x59'),_0x4de6('0x7a')],'where':_0x5e400b,'order':_0x1dae3a,'transaction':_0x5b4fe9,'lock':_0x5b4fe9[_0x4de6('0x7b')][_0x4de6('0x7c')],'include':[{'model':db['CmContact'],'as':_0x4de6('0x7d'),'attributes':_0x358faa,'include':[{'model':db[_0x4de6('0x7e')],'as':'Company','attributes':['id','name']}]},{'model':db[_0x4de6('0x7f')],'as':_0x4de6('0x80'),'attributes':['id','name']},{'model':db[_0x4de6('0x4c')],'as':_0x4de6('0x81'),'attributes':['id',_0x4de6('0xf'),_0x4de6('0x82')]}]})['then'](function(_0x1b5b36){if(_0x1b5b36){return _0x1b5b36[_0x4de6('0xc')]({'UserId':_0x34065e['user']['id']},{'transaction':_0x5b4fe9});}});});}})[_0x4de6('0xd')](handleEntityNotFound(_0x1e4dc2,null))[_0x4de6('0xd')](respondWithResult(_0x1e4dc2,null))[_0x4de6('0x41')](handleError(_0x1e4dc2,null));};exports[_0x4de6('0x83')]=function(_0x7efb2,_0x3129cb,_0xeaf72e){var _0x5f3afe=[];var _0x318caa=_0x7efb2[_0x4de6('0x47')]['id'];var _0x43380a=_0x7efb2[_0x4de6('0x55')]['id'];return db[_0x4de6('0x5c')][_0x4de6('0x48')]()['then'](function(_0x1eca16){_0x5f3afe=_[_0x4de6('0x19')](_0x1eca16);return db[_0x4de6('0x75')][_0x4de6('0x84')](function(_0x17519a){const _0x1d504f={'id':_0x318caa};return db[_0x4de6('0x13')][_0x4de6('0x78')]({'attributes':['id',_0x4de6('0x79'),_0x4de6('0x7a')],'where':_0x1d504f,'transaction':_0x17519a,'lock':_0x17519a[_0x4de6('0x7b')][_0x4de6('0x7c')],'include':[{'model':db[_0x4de6('0x5c')],'as':_0x4de6('0x7d'),'attributes':_0x5f3afe,'include':[{'model':db[_0x4de6('0x7e')],'as':_0x4de6('0x85'),'attributes':['id',_0x4de6('0xf')]}]},{'model':db['CmList'],'as':_0x4de6('0x80'),'attributes':['id',_0x4de6('0xf')]},{'model':db[_0x4de6('0x4c')],'as':_0x4de6('0x81'),'attributes':['id','name',_0x4de6('0x82')]}]})['then'](function(_0x3d6e0d){if(_0x3d6e0d){return _0x3d6e0d[_0x4de6('0xc')]({'UserId':_0x43380a},{'transaction':_0x17519a});}});});})[_0x4de6('0xd')](handleEntityNotFound(_0x3129cb,null))[_0x4de6('0xd')](respondWithResult(_0x3129cb,null))[_0x4de6('0x41')](handleError(_0x3129cb,null));};exports['getOpenContacts']=function(_0x104b48,_0x58e78c){return _0x104b48[_0x4de6('0x55')][_0x4de6('0x67')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x4de6('0x86')},'attributes':['id'],'raw':!![]})['then'](function(_0x4d0cde){if(_0x4d0cde&&_0x4d0cde['length']){return db[_0x4de6('0x13')][_0x4de6('0x3d')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x4de6('0x57')](_0x4de6('0x6c'))},'VoiceQueueId':{'$in':_[_0x4de6('0x12')](_0x4d0cde,'id')},'$or':[{'UserId':null},{'UserId':_0x104b48[_0x4de6('0x55')]['id']}]}});}return 0x0;})[_0x4de6('0xd')](function(_0x43bd4b){if(!_['isNil'](_0x43bd4b)&&_[_0x4de6('0x87')](_0x43bd4b)){return _0x58e78c[_0x4de6('0xa')](0xc8)[_0x4de6('0x6')]({'contacts':_0x43bd4b});}else{logger[_0x4de6('0x88')](_0x4de6('0x89'),_0x4de6('0x8a'),0x194,_0x4de6('0x8b'));_0x58e78c[_0x4de6('0xe')](0x194);}})[_0x4de6('0x41')](handleError(_0x58e78c,null));};exports[_0x4de6('0x8c')]=function(_0x261539,_0x1582be){var _0x4cfe36=shared['timezones'];var _0x2060da=[];_[_0x4de6('0x12')](_0x4cfe36,function(_0x117272){_0x2060da[_0x4de6('0x8d')]({'id':_0x117272[_0x4de6('0xf')],'name':_0x117272[_0x4de6('0xf')],'utcOffset':_0x117272[_0x4de6('0x8e')]});});return _0x1582be['status'](0xc8)['json']({'tz':_0x2060da});};exports[_0x4de6('0x8f')]=function(_0xd3fe83,_0x427a2b){var _0x556bd4=shared[_0x4de6('0x90')];var _0x874c1f={};if(!_[_0x4de6('0x60')](_0x556bd4[_0xd3fe83[_0x4de6('0x46')]['id']]))_0x874c1f=_0x556bd4[_0xd3fe83[_0x4de6('0x46')]['id']];return _0x427a2b[_0x4de6('0xa')](0xc8)[_0x4de6('0x6')](_0x874c1f);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index a2580ba..0ae7297 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 _0x01d9=['define','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','exports'];(function(_0x391df0,_0x51b2dc){var _0x30bec6=function(_0x2899b1){while(--_0x2899b1){_0x391df0['push'](_0x391df0['shift']());}};_0x30bec6(++_0x51b2dc);}(_0x01d9,0x6c));var _0x901d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x01d9[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x901d('0x0'));var util=require(_0x901d('0x1'));var logger=require(_0x901d('0x2'))(_0x901d('0x3'));var moment=require('moment');var BPromise=require(_0x901d('0x4'));var rp=require(_0x901d('0x5'));var fs=require('fs');var path=require(_0x901d('0x6'));var rimraf=require(_0x901d('0x7'));var config=require(_0x901d('0x8'));var attributes=require(_0x901d('0x9'));module[_0x901d('0xa')]=function(_0x4e7842,_0x1e5d7d){return _0x4e7842[_0x901d('0xb')](_0x901d('0xc'),attributes,{'tableName':_0x901d('0xd'),'paranoid':![],'indexes':[{'name':_0x901d('0xe'),'fields':[_0x901d('0xe')]},{'name':_0x901d('0xf'),'fields':[_0x901d('0xf')]},{'name':_0x901d('0x10'),'fields':[_0x901d('0x10')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2ef3=['path','rimraf','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3b150c,_0x2f93f8){var _0x5cd414=function(_0x26305e){while(--_0x26305e){_0x3b150c['push'](_0x3b150c['shift']());}};_0x5cd414(++_0x2f93f8);}(_0x2ef3,0xba));var _0x32ef=function(_0x508496,_0x341b95){_0x508496=_0x508496-0x0;var _0x401074=_0x2ef3[_0x508496];return _0x401074;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var logger=require(_0x32ef('0x2'))(_0x32ef('0x3'));var moment=require(_0x32ef('0x4'));var BPromise=require(_0x32ef('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x32ef('0x6'));var rimraf=require(_0x32ef('0x7'));var config=require('../../config/environment');var attributes=require(_0x32ef('0x8'));module[_0x32ef('0x9')]=function(_0x4c8104,_0x5dfa09){return _0x4c8104[_0x32ef('0xa')](_0x32ef('0xb'),attributes,{'tableName':_0x32ef('0xc'),'paranoid':![],'indexes':[{'name':_0x32ef('0xd'),'fields':[_0x32ef('0xd')]},{'name':_0x32ef('0xe'),'fields':[_0x32ef('0xe')]},{'name':_0x32ef('0xf'),'fields':[_0x32ef('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 5222342..f0ed810 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 _0xccc1=['push','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','active','MoveContactManagedDialer','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','UserId','GetContactRecallMe','GetCmHopperPreview','GetContactByPhone','findOne','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','User','name','CmList','List','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','include','map','model','then','info','debug','stringify','catch','error','message','find','ShowCmHopper','CreateCmHopper','create','UpdateCmHopper','update','limit','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','body','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','transaction','order','LOCK','UPDATE','Contact','Agent','voicePause','length','includes'];(function(_0x120123,_0x4eff59){var _0x3bec4c=function(_0x182818){while(--_0x182818){_0x120123['push'](_0x120123['shift']());}};_0x3bec4c(++_0x4eff59);}(_0xccc1,0x73));var _0x1ccc=function(_0x30853f,_0x4aa320){_0x30853f=_0x30853f-0x0;var _0x3c416d=_0xccc1[_0x30853f];return _0x3c416d;};'use strict';var _=require(_0x1ccc('0x0'));var util=require(_0x1ccc('0x1'));var moment=require(_0x1ccc('0x2'));var BPromise=require(_0x1ccc('0x3'));var db=require(_0x1ccc('0x4'))['db'];var logger=require(_0x1ccc('0x5'))('rpc');exports[_0x1ccc('0x6')]=function(_0x3e4859){var _0x2dff08=this;return new Promise(function(_0x5a2d63,_0x659afd){return db[_0x1ccc('0x7')][_0x1ccc('0x8')]({'raw':_0x3e4859[_0x1ccc('0x9')]?_0x3e4859[_0x1ccc('0x9')][_0x1ccc('0xa')]===undefined?!![]:![]:!![],'where':_0x3e4859[_0x1ccc('0x9')]?_0x3e4859[_0x1ccc('0x9')][_0x1ccc('0xb')]||null:null,'attributes':_0x3e4859[_0x1ccc('0x9')]?_0x3e4859[_0x1ccc('0x9')][_0x1ccc('0xc')]||null:null,'limit':_0x3e4859[_0x1ccc('0x9')]?_0x3e4859[_0x1ccc('0x9')]['limit']||null:null,'include':_0x3e4859['options']?_0x3e4859['options'][_0x1ccc('0xd')]?_[_0x1ccc('0xe')](_0x3e4859[_0x1ccc('0x9')][_0x1ccc('0xd')],function(_0x45e6ac){return{'model':db[_0x45e6ac[_0x1ccc('0xf')]],'as':_0x45e6ac['as'],'attributes':_0x45e6ac[_0x1ccc('0xc')],'include':_0x45e6ac['include']?_[_0x1ccc('0xe')](_0x45e6ac[_0x1ccc('0xd')],function(_0x10ba62){return{'model':db[_0x10ba62[_0x1ccc('0xf')]],'as':_0x10ba62['as'],'attributes':_0x10ba62[_0x1ccc('0xc')],'include':_0x10ba62['include']?_['map'](_0x10ba62[_0x1ccc('0xd')],function(_0xe3c4f){return{'model':db[_0xe3c4f[_0x1ccc('0xf')]],'as':_0xe3c4f['as'],'attributes':_0xe3c4f['attributes']};}):[]};}):[]};}):[]:[]})[_0x1ccc('0x10')](function(_0x473b2e){logger[_0x1ccc('0x11')]('GetCmHopper',_0x3e4859);logger[_0x1ccc('0x12')](_0x1ccc('0x6'),_0x3e4859,JSON[_0x1ccc('0x13')](_0x473b2e));_0x5a2d63(_0x473b2e);})[_0x1ccc('0x14')](function(_0x16833e){logger[_0x1ccc('0x15')]('GetCmHopper',_0x16833e[_0x1ccc('0x16')],_0x3e4859);_0x659afd(_0x2dff08[_0x1ccc('0x15')](0x1f4,_0x16833e[_0x1ccc('0x16')]));});});};exports['ShowCmHopper']=function(_0x11888a){var _0x29f0f9=this;return new Promise(function(_0x477316,_0x53c12d){return db[_0x1ccc('0x7')][_0x1ccc('0x17')]({'raw':_0x11888a[_0x1ccc('0x9')]?_0x11888a[_0x1ccc('0x9')][_0x1ccc('0xa')]===undefined?!![]:![]:!![],'where':_0x11888a[_0x1ccc('0x9')]?_0x11888a[_0x1ccc('0x9')][_0x1ccc('0xb')]||null:null,'attributes':_0x11888a[_0x1ccc('0x9')]?_0x11888a['options']['attributes']||null:null,'include':_0x11888a[_0x1ccc('0x9')]?_0x11888a[_0x1ccc('0x9')][_0x1ccc('0xd')]?_[_0x1ccc('0xe')](_0x11888a[_0x1ccc('0x9')][_0x1ccc('0xd')],function(_0x3dc557){return{'model':db[_0x3dc557['model']],'as':_0x3dc557['as'],'attributes':_0x3dc557['attributes'],'include':_0x3dc557[_0x1ccc('0xd')]?_[_0x1ccc('0xe')](_0x3dc557[_0x1ccc('0xd')],function(_0x33cc41){return{'model':db[_0x33cc41[_0x1ccc('0xf')]],'as':_0x33cc41['as'],'attributes':_0x33cc41[_0x1ccc('0xc')],'include':_0x33cc41[_0x1ccc('0xd')]?_['map'](_0x33cc41[_0x1ccc('0xd')],function(_0x363ea1){return{'model':db[_0x363ea1[_0x1ccc('0xf')]],'as':_0x363ea1['as'],'attributes':_0x363ea1[_0x1ccc('0xc')]};}):[]};}):[]};}):[]:[]})[_0x1ccc('0x10')](function(_0x5e7ab0){logger['info'](_0x1ccc('0x18'),_0x11888a);logger['debug'](_0x1ccc('0x18'),_0x11888a,JSON['stringify'](_0x5e7ab0));_0x477316(_0x5e7ab0);})[_0x1ccc('0x14')](function(_0x4ad51d){logger['error'](_0x1ccc('0x18'),_0x4ad51d[_0x1ccc('0x16')],_0x11888a);_0x53c12d(_0x29f0f9['error'](0x1f4,_0x4ad51d[_0x1ccc('0x16')]));});});};exports[_0x1ccc('0x19')]=function(_0x5f0072){var _0x59d472=this;return new Promise(function(_0x1b385e,_0x2d7421){return db['CmHopper'][_0x1ccc('0x1a')](_0x5f0072['body'],{'raw':_0x5f0072[_0x1ccc('0x9')]?_0x5f0072[_0x1ccc('0x9')]['raw']===undefined?!![]:![]:!![]})[_0x1ccc('0x10')](function(_0x43ae67){logger['info'](_0x1ccc('0x19'),_0x5f0072);logger[_0x1ccc('0x12')](_0x1ccc('0x19'),_0x5f0072,JSON['stringify'](_0x43ae67));_0x1b385e(_0x43ae67);})[_0x1ccc('0x14')](function(_0x23a563){logger[_0x1ccc('0x15')](_0x1ccc('0x19'),_0x23a563[_0x1ccc('0x16')],_0x5f0072);_0x2d7421(_0x59d472[_0x1ccc('0x15')](0x1f4,_0x23a563[_0x1ccc('0x16')]));});});};exports[_0x1ccc('0x1b')]=function(_0x530c41){var _0x554c0e=this;return new Promise(function(_0x553bb3,_0x538f96){return db[_0x1ccc('0x7')][_0x1ccc('0x1c')](_0x530c41['body'],{'raw':_0x530c41[_0x1ccc('0x9')]?_0x530c41[_0x1ccc('0x9')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x530c41[_0x1ccc('0x9')]?_0x530c41['options'][_0x1ccc('0xb')]||null:null,'attributes':_0x530c41[_0x1ccc('0x9')]?_0x530c41[_0x1ccc('0x9')][_0x1ccc('0xc')]||null:null,'limit':_0x530c41['options']?_0x530c41[_0x1ccc('0x9')][_0x1ccc('0x1d')]||null:null})[_0x1ccc('0x10')](function(_0x3734d5){logger['info'](_0x1ccc('0x1b'),_0x530c41);logger['info'](_0x1ccc('0x1e'),JSON[_0x1ccc('0x13')](_0x530c41[_0x1ccc('0x9')][_0x1ccc('0xb')]),_0x530c41[_0x1ccc('0x1f')]['active']);logger[_0x1ccc('0x12')](_0x1ccc('0x1b'),_0x530c41,JSON['stringify'](_0x3734d5));_0x553bb3(_0x3734d5);})[_0x1ccc('0x14')](function(_0x1218e6){logger['error'](_0x1ccc('0x1b'),_0x1218e6[_0x1ccc('0x16')],_0x530c41);_0x538f96(_0x554c0e[_0x1ccc('0x15')](0x1f4,_0x1218e6[_0x1ccc('0x16')]));});});};exports[_0x1ccc('0x20')]=function(_0x5c9aa9){var _0x542ff1=this;return new Promise(function(_0x1de82a,_0x280cd3){return db['CmHopper'][_0x1ccc('0x21')]({'where':_0x5c9aa9[_0x1ccc('0x9')]?_0x5c9aa9[_0x1ccc('0x9')][_0x1ccc('0xb')]||null:null})[_0x1ccc('0x10')](function(_0xbd731f){logger[_0x1ccc('0x11')](_0x1ccc('0x20'),_0x5c9aa9);logger['debug'](_0x1ccc('0x20'),_0x5c9aa9,JSON[_0x1ccc('0x13')](_0xbd731f));_0x1de82a(_0xbd731f);})[_0x1ccc('0x14')](function(_0x1d3bdd){logger['error']('DestroyCmHopper',_0x1d3bdd[_0x1ccc('0x16')],_0x5c9aa9);_0x280cd3(_0x542ff1[_0x1ccc('0x15')](0x1f4,_0x1d3bdd[_0x1ccc('0x16')]));});});};exports[_0x1ccc('0x22')]=function(_0x33c1d5){var _0x513670=this;return new Promise(function(_0x4bb549,_0x4d34c2){return db[_0x1ccc('0x23')][_0x1ccc('0x24')]()['then'](function(_0x2ffdf3){return db[_0x1ccc('0x25')][_0x1ccc('0x26')](function(_0x139691){return db[_0x1ccc('0x7')][_0x1ccc('0x8')]({'where':_0x33c1d5[_0x1ccc('0x9')]?_0x33c1d5[_0x1ccc('0x9')][_0x1ccc('0xb')]||null:null,'attributes':_0x33c1d5['options']?_0x33c1d5[_0x1ccc('0x9')][_0x1ccc('0xc')]||null:null,'limit':_0x33c1d5[_0x1ccc('0x9')]?_0x33c1d5[_0x1ccc('0x9')][_0x1ccc('0x1d')]||null:null,'order':_0x33c1d5[_0x1ccc('0x9')]?_0x33c1d5[_0x1ccc('0x9')][_0x1ccc('0x27')]||null:null,'transaction':_0x139691,'lock':_0x139691[_0x1ccc('0x28')][_0x1ccc('0x29')],'include':[{'model':db[_0x1ccc('0x23')],'as':_0x1ccc('0x2a'),'attributes':_['keys'](_0x2ffdf3)},{'model':db['User'],'as':_0x1ccc('0x2b'),'attributes':['id','name',_0x1ccc('0x2c')]}]})[_0x1ccc('0x10')](function(_0x32f37c){var _0x1c7642=[];var _0x188dcb=[];for(var _0x264b5c=0x0;_0x264b5c<_0x32f37c[_0x1ccc('0x2d')];_0x264b5c+=0x1){var _0x26430d=_0x32f37c[_0x264b5c]['UserId'];if(_0x26430d===null){_0x1c7642['push'](_0x32f37c[_0x264b5c][_0x1ccc('0x1c')](_0x33c1d5[_0x1ccc('0x1f')],{'transaction':_0x139691}));}else if(!_0x188dcb[_0x1ccc('0x2e')](_0x26430d)){_0x188dcb[_0x1ccc('0x2f')](_0x26430d);_0x1c7642[_0x1ccc('0x2f')](_0x32f37c[_0x264b5c][_0x1ccc('0x1c')](_0x33c1d5[_0x1ccc('0x1f')],{'transaction':_0x139691}));}}return BPromise[_0x1ccc('0x30')](_0x1c7642);});})[_0x1ccc('0x10')](function(_0x2c8c19){logger[_0x1ccc('0x11')](_0x1ccc('0x22'),_0x33c1d5);if(_0x2c8c19[_0x1ccc('0x2d')]>0x0){logger[_0x1ccc('0x11')](_0x1ccc('0x31'),_0x2c8c19[0x0][_0x1ccc('0x32')]['id'],_0x2c8c19[0x0][_0x1ccc('0x32')][_0x1ccc('0x33')],_0x2c8c19[0x0]['dataValues'][_0x1ccc('0x34')]);}logger[_0x1ccc('0x12')](_0x1ccc('0x22'),_0x33c1d5,JSON[_0x1ccc('0x13')](_0x2c8c19));_0x4bb549(_0x2c8c19);})[_0x1ccc('0x14')](function(_0x3fd201){logger[_0x1ccc('0x15')]('GetContactDialer',_0x3fd201[_0x1ccc('0x16')],_0x33c1d5);_0x4d34c2(_0x513670['error'](0x1f4,_0x3fd201[_0x1ccc('0x16')]));});});});};exports[_0x1ccc('0x35')]=function(_0x18b274){var _0xd44f49=this;return new Promise(function(_0x52481f,_0x157f64){return db[_0x1ccc('0x25')]['transaction'](function(_0x430d39){return db['CmHopperFinal'][_0x1ccc('0x1a')](_0x18b274['body'],{'raw':_0x18b274['options']?_0x18b274['options'][_0x1ccc('0xa')]===undefined?!![]:![]:!![],'transaction':_0x430d39})[_0x1ccc('0x10')](function(){logger[_0x1ccc('0x11')]('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0x1ccc('0x13')](_0x18b274[_0x1ccc('0x9')][_0x1ccc('0xb')]),_0x18b274[_0x1ccc('0x9')][_0x1ccc('0xb')][_0x1ccc('0x34')]);return db[_0x1ccc('0x7')][_0x1ccc('0x21')]({'where':_0x18b274['options']?_0x18b274[_0x1ccc('0x9')][_0x1ccc('0xb')]||null:null,'transaction':_0x430d39});});})[_0x1ccc('0x10')](function(_0x186660){logger['info'](_0x1ccc('0x35'),_0x18b274);logger[_0x1ccc('0x12')](_0x1ccc('0x35'),_0x18b274,JSON['stringify'](_0x186660));_0x52481f(_0x186660);})[_0x1ccc('0x14')](function(_0x1ec3eb){logger[_0x1ccc('0x15')](_0x1ccc('0x35'),_0x1ec3eb[_0x1ccc('0x16')],_0x18b274);_0x157f64(_0xd44f49[_0x1ccc('0x15')](0x1f4,_0x1ec3eb[_0x1ccc('0x16')]));});});};exports[_0x1ccc('0x36')]=function(_0x54aaae){var _0x15ee6e=this;return new Promise(function(_0x5a608a,_0x2ad22a){return db['CmHopper']['findAll']({'raw':_0x54aaae['options']?_0x54aaae[_0x1ccc('0x9')][_0x1ccc('0xa')]===undefined?!![]:![]:!![],'where':_0x54aaae[_0x1ccc('0x9')]?_0x54aaae['options'][_0x1ccc('0xb')]||null:null,'attributes':[[db[_0x1ccc('0x25')]['fn'](_0x1ccc('0x37'),db[_0x1ccc('0x25')]['fn']('IF',db[_0x1ccc('0x25')][_0x1ccc('0x38')](_0x1ccc('0x39')+util['format']('\x22%s\x22',moment()[_0x1ccc('0x3a')](_0x1ccc('0x3b')))+_0x1ccc('0x3c')))),_0x1ccc('0x3d')]]})[_0x1ccc('0x10')](function(_0x4ba1d5){logger[_0x1ccc('0x11')](_0x1ccc('0x36'),_0x54aaae);logger[_0x1ccc('0x12')](_0x1ccc('0x36'),_0x54aaae,JSON[_0x1ccc('0x13')](_0x4ba1d5));_0x5a608a(_0x4ba1d5);})[_0x1ccc('0x14')](function(_0x2b5149){logger[_0x1ccc('0x15')](_0x1ccc('0x36'),_0x2b5149[_0x1ccc('0x16')],_0x54aaae);_0x2ad22a(_0x15ee6e[_0x1ccc('0x15')](0x1f4,_0x2b5149['message']));});});};exports['GetContactRecallMe']=function(_0x17960d){var _0x487f59=this;return new Promise(function(_0x19cdfd,_0x54628e){return db['CmContact'][_0x1ccc('0x24')]()[_0x1ccc('0x10')](function(){return db[_0x1ccc('0x25')][_0x1ccc('0x26')](function(_0x341ed8){return db[_0x1ccc('0x7')]['findAll']({'where':_0x17960d[_0x1ccc('0x9')]?_0x17960d[_0x1ccc('0x9')]['where']||null:null,'attributes':_0x17960d[_0x1ccc('0x9')]?_0x17960d[_0x1ccc('0x9')][_0x1ccc('0xc')]||null:null,'limit':0x1,'order':_0x17960d[_0x1ccc('0x9')]?_0x17960d[_0x1ccc('0x9')][_0x1ccc('0x27')]||null:null,'group':db[_0x1ccc('0x7')][_0x1ccc('0x3e')],'transaction':_0x341ed8,'lock':_0x341ed8[_0x1ccc('0x28')][_0x1ccc('0x29')],'include':_0x17960d[_0x1ccc('0x9')]?_0x17960d['options'][_0x1ccc('0xd')]?_[_0x1ccc('0xe')](_0x17960d[_0x1ccc('0x9')][_0x1ccc('0xd')],function(_0x1d16c5){return{'model':db[_0x1d16c5[_0x1ccc('0xf')]],'as':_0x1d16c5['as'],'attributes':_0x1d16c5[_0x1ccc('0xc')],'include':_0x1d16c5[_0x1ccc('0xd')]?_[_0x1ccc('0xe')](_0x1d16c5[_0x1ccc('0xd')],function(_0x2ce005){return{'model':db[_0x2ce005['model']],'as':_0x2ce005['as'],'attributes':_0x2ce005['attributes'],'include':_0x2ce005[_0x1ccc('0xd')]?_[_0x1ccc('0xe')](_0x2ce005[_0x1ccc('0xd')],function(_0x175231){return{'model':db[_0x175231[_0x1ccc('0xf')]],'as':_0x175231['as'],'attributes':_0x175231['attributes']};}):[]};}):[]};}):[]:[]})[_0x1ccc('0x10')](function(_0x252892){var _0x16f71a=[];for(var _0x3319c5=0x0;_0x3319c5<_0x252892['length'];_0x3319c5+=0x1){_0x16f71a['push'](_0x252892[_0x3319c5][_0x1ccc('0x1c')](_0x17960d['body'],{'transaction':_0x341ed8}));}return BPromise['all'](_0x16f71a);});})[_0x1ccc('0x10')](function(_0x348aa7){logger[_0x1ccc('0x11')](_0x1ccc('0x3f'),_0x17960d);logger[_0x1ccc('0x12')]('GetContactRecallMe',_0x17960d,JSON['stringify'](_0x348aa7));_0x19cdfd(_0x348aa7);})[_0x1ccc('0x14')](function(_0x21db6d){logger[_0x1ccc('0x15')](_0x1ccc('0x3f'),_0x21db6d['message'],_0x17960d);_0x54628e(_0x487f59['error'](0x1f4,_0x21db6d[_0x1ccc('0x16')]));});});});};exports[_0x1ccc('0x40')]=function(_0x3eb848){var _0x3d5ff5=this;return new Promise(function(_0xb3daa7,_0x4b2019){db[_0x1ccc('0x23')][_0x1ccc('0x24')]()[_0x1ccc('0x10')](function(_0x35f00a){return db[_0x1ccc('0x7')][_0x1ccc('0x8')]({'raw':_0x3eb848[_0x1ccc('0x9')]?_0x3eb848['options'][_0x1ccc('0xa')]===undefined?!![]:![]:!![],'where':_0x3eb848[_0x1ccc('0x9')]?_0x3eb848[_0x1ccc('0x9')][_0x1ccc('0xb')]||null:null,'attributes':_0x3eb848['options']?_0x3eb848[_0x1ccc('0x9')][_0x1ccc('0xc')]||null:null,'limit':_0x3eb848['options']?_0x3eb848[_0x1ccc('0x9')]['limit']||null:null,'include':_0x3eb848['options']?_0x3eb848[_0x1ccc('0x9')]['include']?_[_0x1ccc('0xe')](_0x3eb848[_0x1ccc('0x9')][_0x1ccc('0xd')],function(_0x5cad3b){return{'model':db[_0x5cad3b[_0x1ccc('0xf')]],'as':_0x5cad3b['as'],'attributes':_0x5cad3b['as']==='Contact'?_['keys'](_0x35f00a):_0x5cad3b[_0x1ccc('0xc')],'include':_0x5cad3b[_0x1ccc('0xd')]?_[_0x1ccc('0xe')](_0x5cad3b[_0x1ccc('0xd')],function(_0x3ef6fe){return{'model':db[_0x3ef6fe[_0x1ccc('0xf')]],'as':_0x3ef6fe['as'],'attributes':_0x3ef6fe[_0x1ccc('0xc')],'include':_0x3ef6fe[_0x1ccc('0xd')]?_[_0x1ccc('0xe')](_0x3ef6fe[_0x1ccc('0xd')],function(_0x492bd6){return{'model':db[_0x492bd6[_0x1ccc('0xf')]],'as':_0x492bd6['as'],'attributes':_0x492bd6['attributes']};}):[]};}):[]};}):[]:[]})[_0x1ccc('0x10')](function(_0x291f7e){logger[_0x1ccc('0x11')](_0x1ccc('0x6'),_0x3eb848);logger['debug'](_0x1ccc('0x6'),_0x3eb848,JSON[_0x1ccc('0x13')](_0x291f7e));_0xb3daa7(_0x291f7e);})['catch'](function(_0x4ed4a2){logger[_0x1ccc('0x15')]('GetCmHopper',_0x4ed4a2['message'],_0x3eb848);_0x4b2019(_0x3d5ff5['error'](0x1f4,_0x4ed4a2['message']));});});});};exports[_0x1ccc('0x41')]=function(_0x202d1a){var _0x46b743=this;return new Promise(function(_0x2473c6,_0x175e12){return db[_0x1ccc('0x23')][_0x1ccc('0x42')]({'raw':!![],'where':{'phone':_0x202d1a[_0x1ccc('0x9')]['where'][_0x1ccc('0x43')]},'attributes':['id',_0x1ccc('0x44')],'order':[['id',_0x1ccc('0x45')]]})['then'](function(_0x559f60){logger[_0x1ccc('0x11')](_0x1ccc('0x46'),_0x202d1a);logger[_0x1ccc('0x12')]('getContactByPhone',_0x202d1a,JSON[_0x1ccc('0x13')](_0x559f60));_0x2473c6(_0x559f60);})[_0x1ccc('0x14')](function(_0x40e3ba){logger[_0x1ccc('0x15')](_0x1ccc('0x46'),_0x40e3ba[_0x1ccc('0x16')],_0x202d1a);_0x175e12(_0x46b743[_0x1ccc('0x15')](0x1f4,_0x40e3ba[_0x1ccc('0x16')]));});});};exports[_0x1ccc('0x47')]=function(_0x5e78ac){var _0xcca807=this;return new Promise(function(_0x2ad62b,_0x887829){return db[_0x1ccc('0x25')][_0x1ccc('0x26')](function(_0x5eee37){var _0x469845=_0x5e78ac[_0x1ccc('0x9')]&&_0x5e78ac['options'][_0x1ccc('0xb')]?_0x5e78ac['options'][_0x1ccc('0xb')]:{};return db[_0x1ccc('0x7')][_0x1ccc('0x1c')](_0x5e78ac[_0x1ccc('0x1f')],{'where':_0x469845,'transaction':_0x5eee37})[_0x1ccc('0x10')](function(_0x2aed98){logger['info'](_0x1ccc('0x47'),_0x5e78ac);logger[_0x1ccc('0x12')](_0x1ccc('0x47'),_0x5e78ac,JSON['stringify'](_0x2aed98));_0x2ad62b(_0x2aed98);})[_0x1ccc('0x14')](function(_0x47fddc){logger[_0x1ccc('0x15')](_0x1ccc('0x47'),_0x47fddc['message'],_0x5e78ac);_0x887829(_0xcca807[_0x1ccc('0x15')](0x1f4,_0x47fddc[_0x1ccc('0x16')]));});});});};exports[_0x1ccc('0x48')]=function(_0x304963){var _0x41611a=this;var _0x4a1938=_0x304963[_0x1ccc('0x1f')][_0x1ccc('0xb')]['voiceQueueIds'];var _0xe7859e=_0x304963[_0x1ccc('0x1f')][_0x1ccc('0xb')]['interval'];var _0x46d200=_0x304963[_0x1ccc('0x1f')]['where'][_0x1ccc('0x49')];return new Promise(function(_0x35239f,_0x119642){return db[_0x1ccc('0x7')]['findAll']({'where':{'voiceQueueId':{'$in':_0x4a1938},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db['sequelize'][_0x1ccc('0x38')](_0x1ccc('0x4a')+_0xe7859e+_0x1ccc('0x4b')),'$gt':db[_0x1ccc('0x25')][_0x1ccc('0x38')](_0x1ccc('0x4c'))}},'UserId':{'$in':_0x46d200}},'include':[{'model':db['CmContact'],'as':_0x1ccc('0x2a')},{'model':db[_0x1ccc('0x4d')],'as':_0x1ccc('0x2b'),'attributes':['id',_0x1ccc('0x4e'),_0x1ccc('0x2c')]},{'model':db[_0x1ccc('0x4f')],'as':_0x1ccc('0x50')}]})['then'](function(_0x5d8882){if(_0x5d8882[_0x1ccc('0x2d')]>0x0){return db[_0x1ccc('0x25')][_0x1ccc('0x26')](function(_0x2a32c8){return db[_0x1ccc('0x7')]['update']({'recallmeNotifiedDate':db[_0x1ccc('0x25')][_0x1ccc('0x38')](_0x1ccc('0x4c'))},{'where':{'id':{'$in':_[_0x1ccc('0xe')](_0x5d8882,'id')}},'transaction':_0x2a32c8})[_0x1ccc('0x10')](function(){_0x35239f(_0x5d8882);})['catch'](function(_0x16ce3b){logger[_0x1ccc('0x15')](_0x1ccc('0x48'),_0x16ce3b[_0x1ccc('0x16')],_0x304963);_0x119642(_0x41611a['error'](0x1f4,_0x16ce3b[_0x1ccc('0x16')]));});})['catch'](function(_0x206d6d){logger[_0x1ccc('0x15')](_0x1ccc('0x48'),_0x206d6d[_0x1ccc('0x16')],_0x304963);_0x119642(_0x41611a[_0x1ccc('0x15')](0x1f4,_0x206d6d[_0x1ccc('0x16')]));});}else{_0x35239f(_0x5d8882);}});});}; \ No newline at end of file +var _0x79ad=['DestroyCmHopper','destroy','describe','sequelize','findAll','order','UPDATE','CmContact','Contact','keys','User','Agent','name','UserId','push','includes','length','dataValues','ContactId','GetContactDialer','MoveContactManagedDialer','transaction','create','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','GetContactRecallMe','LOCK','all','GetCmHopperPreview','GetContactByPhone','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','voicePause','CmList','NOW()','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','GetCmHopper','options','where','attributes','include','map','model','then','debug','stringify','message','error','ShowCmHopper','CmHopper','find','raw','info','catch','CreateCmHopper','body','UpdateCmHopper','update','limit','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]'];(function(_0x5cb84c,_0x2ab0ad){var _0x2cc1d6=function(_0x343585){while(--_0x343585){_0x5cb84c['push'](_0x5cb84c['shift']());}};_0x2cc1d6(++_0x2ab0ad);}(_0x79ad,0xd7));var _0xd79a=function(_0x5e72a2,_0x261050){_0x5e72a2=_0x5e72a2-0x0;var _0x4c3b18=_0x79ad[_0x5e72a2];return _0x4c3b18;};'use strict';var _=require(_0xd79a('0x0'));var util=require(_0xd79a('0x1'));var moment=require(_0xd79a('0x2'));var BPromise=require(_0xd79a('0x3'));var db=require(_0xd79a('0x4'))['db'];var logger=require(_0xd79a('0x5'))(_0xd79a('0x6'));exports[_0xd79a('0x7')]=function(_0x1bfd75){var _0x17f261=this;return new Promise(function(_0x3e60f1,_0x563f76){return db['CmHopper']['findAll']({'raw':_0x1bfd75[_0xd79a('0x8')]?_0x1bfd75[_0xd79a('0x8')]['raw']===undefined?!![]:![]:!![],'where':_0x1bfd75[_0xd79a('0x8')]?_0x1bfd75[_0xd79a('0x8')][_0xd79a('0x9')]||null:null,'attributes':_0x1bfd75['options']?_0x1bfd75[_0xd79a('0x8')][_0xd79a('0xa')]||null:null,'limit':_0x1bfd75[_0xd79a('0x8')]?_0x1bfd75[_0xd79a('0x8')]['limit']||null:null,'include':_0x1bfd75[_0xd79a('0x8')]?_0x1bfd75[_0xd79a('0x8')][_0xd79a('0xb')]?_[_0xd79a('0xc')](_0x1bfd75[_0xd79a('0x8')][_0xd79a('0xb')],function(_0x3ce5cc){return{'model':db[_0x3ce5cc['model']],'as':_0x3ce5cc['as'],'attributes':_0x3ce5cc[_0xd79a('0xa')],'include':_0x3ce5cc[_0xd79a('0xb')]?_[_0xd79a('0xc')](_0x3ce5cc['include'],function(_0x20c859){return{'model':db[_0x20c859[_0xd79a('0xd')]],'as':_0x20c859['as'],'attributes':_0x20c859[_0xd79a('0xa')],'include':_0x20c859[_0xd79a('0xb')]?_[_0xd79a('0xc')](_0x20c859['include'],function(_0x5e7c17){return{'model':db[_0x5e7c17[_0xd79a('0xd')]],'as':_0x5e7c17['as'],'attributes':_0x5e7c17[_0xd79a('0xa')]};}):[]};}):[]};}):[]:[]})[_0xd79a('0xe')](function(_0x11a02c){logger['info'](_0xd79a('0x7'),_0x1bfd75);logger[_0xd79a('0xf')]('GetCmHopper',_0x1bfd75,JSON[_0xd79a('0x10')](_0x11a02c));_0x3e60f1(_0x11a02c);})['catch'](function(_0x2fca94){logger['error'](_0xd79a('0x7'),_0x2fca94[_0xd79a('0x11')],_0x1bfd75);_0x563f76(_0x17f261[_0xd79a('0x12')](0x1f4,_0x2fca94[_0xd79a('0x11')]));});});};exports[_0xd79a('0x13')]=function(_0x23280a){var _0x52071a=this;return new Promise(function(_0x4623dd,_0x1a9d4a){return db[_0xd79a('0x14')][_0xd79a('0x15')]({'raw':_0x23280a[_0xd79a('0x8')]?_0x23280a[_0xd79a('0x8')][_0xd79a('0x16')]===undefined?!![]:![]:!![],'where':_0x23280a[_0xd79a('0x8')]?_0x23280a[_0xd79a('0x8')][_0xd79a('0x9')]||null:null,'attributes':_0x23280a[_0xd79a('0x8')]?_0x23280a[_0xd79a('0x8')][_0xd79a('0xa')]||null:null,'include':_0x23280a['options']?_0x23280a[_0xd79a('0x8')][_0xd79a('0xb')]?_[_0xd79a('0xc')](_0x23280a['options']['include'],function(_0x3cb270){return{'model':db[_0x3cb270[_0xd79a('0xd')]],'as':_0x3cb270['as'],'attributes':_0x3cb270['attributes'],'include':_0x3cb270['include']?_['map'](_0x3cb270[_0xd79a('0xb')],function(_0xc9528){return{'model':db[_0xc9528[_0xd79a('0xd')]],'as':_0xc9528['as'],'attributes':_0xc9528[_0xd79a('0xa')],'include':_0xc9528['include']?_[_0xd79a('0xc')](_0xc9528['include'],function(_0x285992){return{'model':db[_0x285992['model']],'as':_0x285992['as'],'attributes':_0x285992[_0xd79a('0xa')]};}):[]};}):[]};}):[]:[]})[_0xd79a('0xe')](function(_0x3d7d63){logger[_0xd79a('0x17')](_0xd79a('0x13'),_0x23280a);logger[_0xd79a('0xf')](_0xd79a('0x13'),_0x23280a,JSON['stringify'](_0x3d7d63));_0x4623dd(_0x3d7d63);})[_0xd79a('0x18')](function(_0x25c167){logger[_0xd79a('0x12')]('ShowCmHopper',_0x25c167[_0xd79a('0x11')],_0x23280a);_0x1a9d4a(_0x52071a[_0xd79a('0x12')](0x1f4,_0x25c167[_0xd79a('0x11')]));});});};exports[_0xd79a('0x19')]=function(_0x56bb25){var _0x2c3c6b=this;return new Promise(function(_0x833c81,_0x5cbb68){return db[_0xd79a('0x14')]['create'](_0x56bb25[_0xd79a('0x1a')],{'raw':_0x56bb25['options']?_0x56bb25[_0xd79a('0x8')][_0xd79a('0x16')]===undefined?!![]:![]:!![]})[_0xd79a('0xe')](function(_0x47d578){logger[_0xd79a('0x17')]('CreateCmHopper',_0x56bb25);logger['debug'](_0xd79a('0x19'),_0x56bb25,JSON[_0xd79a('0x10')](_0x47d578));_0x833c81(_0x47d578);})['catch'](function(_0x610c62){logger[_0xd79a('0x12')]('CreateCmHopper',_0x610c62[_0xd79a('0x11')],_0x56bb25);_0x5cbb68(_0x2c3c6b[_0xd79a('0x12')](0x1f4,_0x610c62[_0xd79a('0x11')]));});});};exports[_0xd79a('0x1b')]=function(_0x5ae035){var _0x4d83ce=this;return new Promise(function(_0x4ba51e,_0x2e2534){return db[_0xd79a('0x14')][_0xd79a('0x1c')](_0x5ae035[_0xd79a('0x1a')],{'raw':_0x5ae035['options']?_0x5ae035[_0xd79a('0x8')][_0xd79a('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5ae035[_0xd79a('0x8')]?_0x5ae035[_0xd79a('0x8')][_0xd79a('0x9')]||null:null,'attributes':_0x5ae035[_0xd79a('0x8')]?_0x5ae035['options'][_0xd79a('0xa')]||null:null,'limit':_0x5ae035[_0xd79a('0x8')]?_0x5ae035[_0xd79a('0x8')][_0xd79a('0x1d')]||null:null})['then'](function(_0x1e06c4){logger[_0xd79a('0x17')](_0xd79a('0x1b'),_0x5ae035);logger[_0xd79a('0x17')](_0xd79a('0x1e'),JSON[_0xd79a('0x10')](_0x5ae035[_0xd79a('0x8')][_0xd79a('0x9')]),_0x5ae035[_0xd79a('0x1a')]['active']);logger[_0xd79a('0xf')](_0xd79a('0x1b'),_0x5ae035,JSON[_0xd79a('0x10')](_0x1e06c4));_0x4ba51e(_0x1e06c4);})[_0xd79a('0x18')](function(_0x27b1ed){logger[_0xd79a('0x12')](_0xd79a('0x1b'),_0x27b1ed[_0xd79a('0x11')],_0x5ae035);_0x2e2534(_0x4d83ce[_0xd79a('0x12')](0x1f4,_0x27b1ed[_0xd79a('0x11')]));});});};exports[_0xd79a('0x1f')]=function(_0x218179){var _0x347b05=this;return new Promise(function(_0x4384e5,_0x288130){return db['CmHopper'][_0xd79a('0x20')]({'where':_0x218179[_0xd79a('0x8')]?_0x218179['options'][_0xd79a('0x9')]||null:null})[_0xd79a('0xe')](function(_0x589b79){logger['info']('DestroyCmHopper',_0x218179);logger[_0xd79a('0xf')](_0xd79a('0x1f'),_0x218179,JSON[_0xd79a('0x10')](_0x589b79));_0x4384e5(_0x589b79);})[_0xd79a('0x18')](function(_0x1d72a7){logger['error']('DestroyCmHopper',_0x1d72a7[_0xd79a('0x11')],_0x218179);_0x288130(_0x347b05[_0xd79a('0x12')](0x1f4,_0x1d72a7[_0xd79a('0x11')]));});});};exports['GetContactDialer']=function(_0x1b4d50){var _0x15a0b6=this;return new Promise(function(_0x449657,_0x3a91f3){return db['CmContact'][_0xd79a('0x21')]()[_0xd79a('0xe')](function(_0x3ef295){return db[_0xd79a('0x22')]['transaction'](function(_0x4418a0){return db[_0xd79a('0x14')][_0xd79a('0x23')]({'where':_0x1b4d50['options']?_0x1b4d50[_0xd79a('0x8')][_0xd79a('0x9')]||null:null,'attributes':_0x1b4d50[_0xd79a('0x8')]?_0x1b4d50[_0xd79a('0x8')]['attributes']||null:null,'limit':_0x1b4d50[_0xd79a('0x8')]?_0x1b4d50[_0xd79a('0x8')][_0xd79a('0x1d')]||null:null,'order':_0x1b4d50['options']?_0x1b4d50[_0xd79a('0x8')][_0xd79a('0x24')]||null:null,'transaction':_0x4418a0,'lock':_0x4418a0['LOCK'][_0xd79a('0x25')],'include':[{'model':db[_0xd79a('0x26')],'as':_0xd79a('0x27'),'attributes':_[_0xd79a('0x28')](_0x3ef295)},{'model':db[_0xd79a('0x29')],'as':_0xd79a('0x2a'),'attributes':['id',_0xd79a('0x2b'),'voicePause']}]})[_0xd79a('0xe')](function(_0x2ff476){var _0x2fffa8=[];var _0x1eeaf2=[];for(var _0x4bb3aa=0x0;_0x4bb3aa<_0x2ff476['length'];_0x4bb3aa+=0x1){var _0x16390a=_0x2ff476[_0x4bb3aa][_0xd79a('0x2c')];if(_0x16390a===null){_0x2fffa8[_0xd79a('0x2d')](_0x2ff476[_0x4bb3aa][_0xd79a('0x1c')](_0x1b4d50[_0xd79a('0x1a')],{'transaction':_0x4418a0}));}else if(!_0x1eeaf2[_0xd79a('0x2e')](_0x16390a)){_0x1eeaf2[_0xd79a('0x2d')](_0x16390a);_0x2fffa8[_0xd79a('0x2d')](_0x2ff476[_0x4bb3aa][_0xd79a('0x1c')](_0x1b4d50[_0xd79a('0x1a')],{'transaction':_0x4418a0}));}}return BPromise['all'](_0x2fffa8);});})[_0xd79a('0xe')](function(_0x26227e){logger[_0xd79a('0x17')]('GetContactDialer',_0x1b4d50);if(_0x26227e[_0xd79a('0x2f')]>0x0){logger[_0xd79a('0x17')]('GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]',_0x26227e[0x0]['dataValues']['id'],_0x26227e[0x0][_0xd79a('0x30')][_0xd79a('0x31')],_0x26227e[0x0][_0xd79a('0x30')]['active']);}logger['debug'](_0xd79a('0x32'),_0x1b4d50,JSON['stringify'](_0x26227e));_0x449657(_0x26227e);})[_0xd79a('0x18')](function(_0x52ca74){logger[_0xd79a('0x12')](_0xd79a('0x32'),_0x52ca74[_0xd79a('0x11')],_0x1b4d50);_0x3a91f3(_0x15a0b6[_0xd79a('0x12')](0x1f4,_0x52ca74['message']));});});});};exports[_0xd79a('0x33')]=function(_0x3b8867){var _0x3c9f6b=this;return new Promise(function(_0x4cde3c,_0x3a9029){return db[_0xd79a('0x22')][_0xd79a('0x34')](function(_0x5b5a5b){return db['CmHopperFinal'][_0xd79a('0x35')](_0x3b8867[_0xd79a('0x1a')],{'raw':_0x3b8867[_0xd79a('0x8')]?_0x3b8867[_0xd79a('0x8')][_0xd79a('0x16')]===undefined?!![]:![]:!![],'transaction':_0x5b5a5b})[_0xd79a('0xe')](function(){logger[_0xd79a('0x17')](_0xd79a('0x36'),JSON[_0xd79a('0x10')](_0x3b8867[_0xd79a('0x8')][_0xd79a('0x9')]),_0x3b8867[_0xd79a('0x8')]['where'][_0xd79a('0x37')]);return db[_0xd79a('0x14')][_0xd79a('0x20')]({'where':_0x3b8867[_0xd79a('0x8')]?_0x3b8867[_0xd79a('0x8')][_0xd79a('0x9')]||null:null,'transaction':_0x5b5a5b});});})[_0xd79a('0xe')](function(_0x4f32b6){logger[_0xd79a('0x17')]('MoveContactManagedDialer',_0x3b8867);logger[_0xd79a('0xf')]('MoveContactManagedDialer',_0x3b8867,JSON['stringify'](_0x4f32b6));_0x4cde3c(_0x4f32b6);})[_0xd79a('0x18')](function(_0x4856f7){logger[_0xd79a('0x12')](_0xd79a('0x33'),_0x4856f7['message'],_0x3b8867);_0x3a9029(_0x3c9f6b[_0xd79a('0x12')](0x1f4,_0x4856f7['message']));});});};exports[_0xd79a('0x38')]=function(_0x87f1a8){var _0x20142a=this;return new Promise(function(_0x4fbb93,_0x1cf287){return db['CmHopper'][_0xd79a('0x23')]({'raw':_0x87f1a8[_0xd79a('0x8')]?_0x87f1a8[_0xd79a('0x8')][_0xd79a('0x16')]===undefined?!![]:![]:!![],'where':_0x87f1a8[_0xd79a('0x8')]?_0x87f1a8[_0xd79a('0x8')][_0xd79a('0x9')]||null:null,'attributes':[[db[_0xd79a('0x22')]['fn'](_0xd79a('0x39'),db['sequelize']['fn']('IF',db[_0xd79a('0x22')][_0xd79a('0x3a')](_0xd79a('0x3b')+util[_0xd79a('0x3c')](_0xd79a('0x3d'),moment()['format'](_0xd79a('0x3e')))+_0xd79a('0x3f')))),'contactsRescheduled']]})[_0xd79a('0xe')](function(_0xde8b0f){logger[_0xd79a('0x17')](_0xd79a('0x38'),_0x87f1a8);logger['debug']('CountReScheduled',_0x87f1a8,JSON[_0xd79a('0x10')](_0xde8b0f));_0x4fbb93(_0xde8b0f);})[_0xd79a('0x18')](function(_0x48df59){logger[_0xd79a('0x12')](_0xd79a('0x38'),_0x48df59['message'],_0x87f1a8);_0x1cf287(_0x20142a[_0xd79a('0x12')](0x1f4,_0x48df59['message']));});});};exports[_0xd79a('0x40')]=function(_0x2bc00b){var _0x1b5092=this;return new Promise(function(_0x234c73,_0x529d97){return db[_0xd79a('0x26')][_0xd79a('0x21')]()[_0xd79a('0xe')](function(){return db[_0xd79a('0x22')][_0xd79a('0x34')](function(_0x12ec6c){return db[_0xd79a('0x14')][_0xd79a('0x23')]({'where':_0x2bc00b[_0xd79a('0x8')]?_0x2bc00b[_0xd79a('0x8')][_0xd79a('0x9')]||null:null,'attributes':_0x2bc00b[_0xd79a('0x8')]?_0x2bc00b[_0xd79a('0x8')]['attributes']||null:null,'limit':0x1,'order':_0x2bc00b[_0xd79a('0x8')]?_0x2bc00b['options'][_0xd79a('0x24')]||null:null,'group':db[_0xd79a('0x14')][_0xd79a('0x2c')],'transaction':_0x12ec6c,'lock':_0x12ec6c[_0xd79a('0x41')]['UPDATE'],'include':_0x2bc00b['options']?_0x2bc00b[_0xd79a('0x8')][_0xd79a('0xb')]?_['map'](_0x2bc00b[_0xd79a('0x8')][_0xd79a('0xb')],function(_0x120b7c){return{'model':db[_0x120b7c[_0xd79a('0xd')]],'as':_0x120b7c['as'],'attributes':_0x120b7c[_0xd79a('0xa')],'include':_0x120b7c['include']?_[_0xd79a('0xc')](_0x120b7c['include'],function(_0x2c47e7){return{'model':db[_0x2c47e7[_0xd79a('0xd')]],'as':_0x2c47e7['as'],'attributes':_0x2c47e7[_0xd79a('0xa')],'include':_0x2c47e7['include']?_[_0xd79a('0xc')](_0x2c47e7[_0xd79a('0xb')],function(_0x3de8f2){return{'model':db[_0x3de8f2['model']],'as':_0x3de8f2['as'],'attributes':_0x3de8f2[_0xd79a('0xa')]};}):[]};}):[]};}):[]:[]})[_0xd79a('0xe')](function(_0x590e36){var _0x17d73b=[];for(var _0x31be8e=0x0;_0x31be8e<_0x590e36[_0xd79a('0x2f')];_0x31be8e+=0x1){_0x17d73b['push'](_0x590e36[_0x31be8e][_0xd79a('0x1c')](_0x2bc00b['body'],{'transaction':_0x12ec6c}));}return BPromise[_0xd79a('0x42')](_0x17d73b);});})[_0xd79a('0xe')](function(_0x2d68d4){logger[_0xd79a('0x17')]('GetContactRecallMe',_0x2bc00b);logger[_0xd79a('0xf')](_0xd79a('0x40'),_0x2bc00b,JSON[_0xd79a('0x10')](_0x2d68d4));_0x234c73(_0x2d68d4);})[_0xd79a('0x18')](function(_0x31d6f0){logger[_0xd79a('0x12')](_0xd79a('0x40'),_0x31d6f0[_0xd79a('0x11')],_0x2bc00b);_0x529d97(_0x1b5092[_0xd79a('0x12')](0x1f4,_0x31d6f0[_0xd79a('0x11')]));});});});};exports[_0xd79a('0x43')]=function(_0x69f4de){var _0xaf78ec=this;return new Promise(function(_0x47523f,_0xaeab9d){db[_0xd79a('0x26')][_0xd79a('0x21')]()['then'](function(_0x57e828){return db[_0xd79a('0x14')][_0xd79a('0x23')]({'raw':_0x69f4de[_0xd79a('0x8')]?_0x69f4de[_0xd79a('0x8')]['raw']===undefined?!![]:![]:!![],'where':_0x69f4de[_0xd79a('0x8')]?_0x69f4de['options'][_0xd79a('0x9')]||null:null,'attributes':_0x69f4de[_0xd79a('0x8')]?_0x69f4de[_0xd79a('0x8')][_0xd79a('0xa')]||null:null,'limit':_0x69f4de[_0xd79a('0x8')]?_0x69f4de[_0xd79a('0x8')]['limit']||null:null,'include':_0x69f4de[_0xd79a('0x8')]?_0x69f4de[_0xd79a('0x8')]['include']?_['map'](_0x69f4de[_0xd79a('0x8')][_0xd79a('0xb')],function(_0x592ae2){return{'model':db[_0x592ae2[_0xd79a('0xd')]],'as':_0x592ae2['as'],'attributes':_0x592ae2['as']===_0xd79a('0x27')?_['keys'](_0x57e828):_0x592ae2[_0xd79a('0xa')],'include':_0x592ae2[_0xd79a('0xb')]?_[_0xd79a('0xc')](_0x592ae2[_0xd79a('0xb')],function(_0x2c456c){return{'model':db[_0x2c456c['model']],'as':_0x2c456c['as'],'attributes':_0x2c456c[_0xd79a('0xa')],'include':_0x2c456c[_0xd79a('0xb')]?_[_0xd79a('0xc')](_0x2c456c['include'],function(_0x424644){return{'model':db[_0x424644[_0xd79a('0xd')]],'as':_0x424644['as'],'attributes':_0x424644[_0xd79a('0xa')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x398fa1){logger['info'](_0xd79a('0x7'),_0x69f4de);logger[_0xd79a('0xf')](_0xd79a('0x7'),_0x69f4de,JSON['stringify'](_0x398fa1));_0x47523f(_0x398fa1);})[_0xd79a('0x18')](function(_0xa78164){logger['error'](_0xd79a('0x7'),_0xa78164[_0xd79a('0x11')],_0x69f4de);_0xaeab9d(_0xaf78ec[_0xd79a('0x12')](0x1f4,_0xa78164[_0xd79a('0x11')]));});});});};exports[_0xd79a('0x44')]=function(_0x281053){var _0x1dc487=this;return new Promise(function(_0x47ccc5,_0x7a9cdc){return db[_0xd79a('0x26')]['findOne']({'raw':!![],'where':{'phone':_0x281053[_0xd79a('0x8')][_0xd79a('0x9')][_0xd79a('0x45')]},'attributes':['id',_0xd79a('0x46')],'order':[['id',_0xd79a('0x47')]]})[_0xd79a('0xe')](function(_0x587bd6){logger[_0xd79a('0x17')](_0xd79a('0x48'),_0x281053);logger[_0xd79a('0xf')](_0xd79a('0x48'),_0x281053,JSON[_0xd79a('0x10')](_0x587bd6));_0x47ccc5(_0x587bd6);})[_0xd79a('0x18')](function(_0x4a8ed3){logger[_0xd79a('0x12')](_0xd79a('0x48'),_0x4a8ed3[_0xd79a('0x11')],_0x281053);_0x7a9cdc(_0x1dc487[_0xd79a('0x12')](0x1f4,_0x4a8ed3[_0xd79a('0x11')]));});});};exports[_0xd79a('0x49')]=function(_0x124e1b){var _0x3d6b71=this;return new Promise(function(_0x59b66e,_0x5b7c60){return db[_0xd79a('0x22')]['transaction'](function(_0x538ffa){var _0xb4aa62=_0x124e1b[_0xd79a('0x8')]&&_0x124e1b[_0xd79a('0x8')][_0xd79a('0x9')]?_0x124e1b['options']['where']:{};return db[_0xd79a('0x14')][_0xd79a('0x1c')](_0x124e1b[_0xd79a('0x1a')],{'where':_0xb4aa62,'transaction':_0x538ffa})[_0xd79a('0xe')](function(_0x59b318){logger['info'](_0xd79a('0x49'),_0x124e1b);logger[_0xd79a('0xf')](_0xd79a('0x49'),_0x124e1b,JSON[_0xd79a('0x10')](_0x59b318));_0x59b66e(_0x59b318);})[_0xd79a('0x18')](function(_0x38551d){logger[_0xd79a('0x12')]('ResetActiveCalls',_0x38551d['message'],_0x124e1b);_0x5b7c60(_0x3d6b71[_0xd79a('0x12')](0x1f4,_0x38551d[_0xd79a('0x11')]));});});});};exports[_0xd79a('0x4a')]=function(_0x2a0cc3){var _0x4e2aed=this;var _0x31ed24=_0x2a0cc3[_0xd79a('0x1a')]['where'][_0xd79a('0x4b')];var _0x1dcb86=_0x2a0cc3[_0xd79a('0x1a')][_0xd79a('0x9')][_0xd79a('0x4c')];var _0x5d97e2=_0x2a0cc3['body'][_0xd79a('0x9')]['availableAgentsIds'];return new Promise(function(_0xa9768,_0xb69b8f){return db[_0xd79a('0x14')][_0xd79a('0x23')]({'where':{'voiceQueueId':{'$in':_0x31ed24},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0xd79a('0x22')]['literal'](_0xd79a('0x4d')+_0x1dcb86+_0xd79a('0x4e')),'$gt':db['sequelize'][_0xd79a('0x3a')]('NOW()')}},'UserId':{'$in':_0x5d97e2}},'include':[{'model':db[_0xd79a('0x26')],'as':_0xd79a('0x27')},{'model':db[_0xd79a('0x29')],'as':_0xd79a('0x2a'),'attributes':['id',_0xd79a('0x2b'),_0xd79a('0x4f')]},{'model':db[_0xd79a('0x50')],'as':'List'}]})['then'](function(_0x44ca39){if(_0x44ca39[_0xd79a('0x2f')]>0x0){return db[_0xd79a('0x22')][_0xd79a('0x34')](function(_0x4d16e3){return db[_0xd79a('0x14')]['update']({'recallmeNotifiedDate':db[_0xd79a('0x22')][_0xd79a('0x3a')](_0xd79a('0x51'))},{'where':{'id':{'$in':_['map'](_0x44ca39,'id')}},'transaction':_0x4d16e3})['then'](function(){_0xa9768(_0x44ca39);})[_0xd79a('0x18')](function(_0x5316a0){logger[_0xd79a('0x12')]('CmHopperHandlePreviewRecallNotifications',_0x5316a0['message'],_0x2a0cc3);_0xb69b8f(_0x4e2aed['error'](0x1f4,_0x5316a0[_0xd79a('0x11')]));});})[_0xd79a('0x18')](function(_0x4d1b62){logger[_0xd79a('0x12')](_0xd79a('0x4a'),_0x4d1b62['message'],_0x2a0cc3);_0xb69b8f(_0x4e2aed[_0xd79a('0x12')](0x1f4,_0x4d1b62[_0xd79a('0x11')]));});}else{_0xa9768(_0x44ca39);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index b985754..b9b6444 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 _0x6091=['getOpenContacts','/timezones','/:id','show','getPreviewRecall','post','create','/preview','getPreview','put','update','delete','destroy','Router','../../components/auth/service','./cmHopper.controller','get','index','isAuthenticated','describe','/opencontacts'];(function(_0x28d231,_0x55888a){var _0x3814c5=function(_0x55a0a1){while(--_0x55a0a1){_0x28d231['push'](_0x28d231['shift']());}};_0x3814c5(++_0x55888a);}(_0x6091,0xf4));var _0x1609=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x6091[_0x311c35];return _0x5cc50c;};'use strict';var express=require('express');var router=express[_0x1609('0x0')]();var auth=require(_0x1609('0x1'));var controller=require(_0x1609('0x2'));router[_0x1609('0x3')]('/',auth['isAuthenticated'](),controller[_0x1609('0x4')]);router[_0x1609('0x3')]('/describe',auth[_0x1609('0x5')](),controller[_0x1609('0x6')]);router['get'](_0x1609('0x7'),auth['isAuthenticated'](),controller[_0x1609('0x8')]);router[_0x1609('0x3')](_0x1609('0x9'),auth[_0x1609('0x5')](),controller['getTimezones']);router['get'](_0x1609('0xa'),auth[_0x1609('0x5')](),controller[_0x1609('0xb')]);router['get']('/:id/previewrecall',auth[_0x1609('0x5')](),controller[_0x1609('0xc')]);router[_0x1609('0xd')]('/',auth[_0x1609('0x5')](),controller[_0x1609('0xe')]);router[_0x1609('0xd')](_0x1609('0xf'),auth[_0x1609('0x5')](),controller[_0x1609('0x10')]);router[_0x1609('0xd')]('/timezone',auth[_0x1609('0x5')](),controller['getTimezone']);router[_0x1609('0x11')](_0x1609('0xa'),auth[_0x1609('0x5')](),controller[_0x1609('0x12')]);router[_0x1609('0x13')]('/:id',auth[_0x1609('0x5')](),controller[_0x1609('0x14')]);module['exports']=router; \ No newline at end of file +var _0x754a=['destroy','exports','Router','../../components/auth/service','./cmHopper.controller','get','index','/describe','isAuthenticated','describe','/opencontacts','/timezones','/:id','show','/:id/previewrecall','post','create','getPreview','/timezone','getTimezone','put','update','delete'];(function(_0x1a24e2,_0x354636){var _0x184e12=function(_0x1196c4){while(--_0x1196c4){_0x1a24e2['push'](_0x1a24e2['shift']());}};_0x184e12(++_0x354636);}(_0x754a,0x8c));var _0xa754=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x754a[_0x5f09c5];return _0x426ad9;};'use strict';var express=require('express');var router=express[_0xa754('0x0')]();var auth=require(_0xa754('0x1'));var controller=require(_0xa754('0x2'));router[_0xa754('0x3')]('/',auth['isAuthenticated'](),controller[_0xa754('0x4')]);router[_0xa754('0x3')](_0xa754('0x5'),auth[_0xa754('0x6')](),controller[_0xa754('0x7')]);router['get'](_0xa754('0x8'),auth[_0xa754('0x6')](),controller['getOpenContacts']);router['get'](_0xa754('0x9'),auth[_0xa754('0x6')](),controller['getTimezones']);router[_0xa754('0x3')](_0xa754('0xa'),auth[_0xa754('0x6')](),controller[_0xa754('0xb')]);router[_0xa754('0x3')](_0xa754('0xc'),auth[_0xa754('0x6')](),controller['getPreviewRecall']);router[_0xa754('0xd')]('/',auth['isAuthenticated'](),controller[_0xa754('0xe')]);router[_0xa754('0xd')]('/preview',auth[_0xa754('0x6')](),controller[_0xa754('0xf')]);router[_0xa754('0xd')](_0xa754('0x10'),auth['isAuthenticated'](),controller[_0xa754('0x11')]);router[_0xa754('0x12')]('/:id',auth[_0xa754('0x6')](),controller[_0xa754('0x13')]);router[_0xa754('0x14')]('/:id',auth[_0xa754('0x6')](),controller[_0xa754('0x15')]);module[_0xa754('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 86d0376..5b5922a 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 _0xf578=['INTEGER','STRING','format','YYYY-MM-DD\x20HH:mm:ss','exports'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0xf578,0x103));var _0x8f57=function(_0x59b2a1,_0x1f631f){_0x59b2a1=_0x59b2a1-0x0;var _0x4908d1=_0xf578[_0x59b2a1];return _0x4908d1;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x8f57('0x0')]={'CmHopperId':{'type':Sequelize[_0x8f57('0x1')]},'phone':{'type':Sequelize[_0x8f57('0x2')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x8f57('0x1')],'defaultValue':0x0},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x8f57('0x3')](_0x8f57('0x4'))},'countbusyretry':{'type':Sequelize[_0x8f57('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x8f57('0x1')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x8f57('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x8f57('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x8f57('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x8f57('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xed2b=['YYYY-MM-DD\x20HH:mm:ss','moment','exports','INTEGER','DATE','format'];(function(_0xbeaae9,_0x17b5a6){var _0x21e17d=function(_0x2770bb){while(--_0x2770bb){_0xbeaae9['push'](_0xbeaae9['shift']());}};_0x21e17d(++_0x17b5a6);}(_0xed2b,0xaf));var _0xbed2=function(_0x1cd51f,_0x297954){_0x1cd51f=_0x1cd51f-0x0;var _0x54208a=_0xed2b[_0x1cd51f];return _0x54208a;};'use strict';var moment=require(_0xbed2('0x0'));var Sequelize=require('sequelize');module[_0xbed2('0x1')]={'CmHopperId':{'type':Sequelize[_0xbed2('0x2')]},'phone':{'type':Sequelize['STRING'],'allowNull':![]},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0xbed2('0x3')],'defaultValue':moment()[_0xbed2('0x4')](_0xbed2('0x5'))},'countbusyretry':{'type':Sequelize[_0xbed2('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xbed2('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xbed2('0x2')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0xbed2('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xbed2('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xbed2('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index 2adecb7..54531ea 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 _0xde01=['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','json','offset','undefined','limit','set','Content-Range','reject','update','destroy','then','get','UserProfileResource','end','error','send','index','map','CmHopperAdditionalPhone','rawAttributes','fieldName','type','key','model','name','query','keys','intersection','attributes','length','hasOwnProperty','sort','where','filters','pick','filter','VIRTUAL','merge','options','count','includeAll','include','findAll','show','params','fields','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','CmHopperAdditionalPhones','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x2d639b,_0x5767e8){var _0x1016ec=function(_0x180f92){while(--_0x180f92){_0x2d639b['push'](_0x2d639b['shift']());}};_0x1016ec(++_0x5767e8);}(_0xde01,0x190));var _0x1de0=function(_0x29e620,_0x17687d){_0x29e620=_0x29e620-0x0;var _0x170958=_0xde01[_0x29e620];return _0x170958;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1de0('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1de0('0x1'));var rp=require(_0x1de0('0x2'));var moment=require(_0x1de0('0x3'));var BPromise=require(_0x1de0('0x4'));var Mustache=require(_0x1de0('0x5'));var util=require(_0x1de0('0x6'));var path=require(_0x1de0('0x7'));var sox=require(_0x1de0('0x8'));var csv=require(_0x1de0('0x9'));var ejs=require(_0x1de0('0xa'));var fs=require('fs');var fs_extra=require(_0x1de0('0xb'));var _=require(_0x1de0('0xc'));var squel=require(_0x1de0('0xd'));var crypto=require(_0x1de0('0xe'));var jsforce=require(_0x1de0('0xf'));var deskjs=require(_0x1de0('0x10'));var toCsv=require(_0x1de0('0x9'));var querystring=require(_0x1de0('0x11'));var Papa=require('papaparse');var Redis=require(_0x1de0('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x1de0('0x13'));var as=require(_0x1de0('0x14'));var hardwareService=require(_0x1de0('0x15'));var logger=require(_0x1de0('0x16'))(_0x1de0('0x17'));var utils=require('../../config/utils');var config=require(_0x1de0('0x18'));var licenseUtil=require(_0x1de0('0x19'));var db=require(_0x1de0('0x1a'))['db'];function respondWithStatusCode(_0x443d82,_0x4a06ca){_0x4a06ca=_0x4a06ca||0xcc;return function(_0x4c9429){if(_0x4c9429){return _0x443d82[_0x1de0('0x1b')](_0x4a06ca);}return _0x443d82[_0x1de0('0x1c')](_0x4a06ca)['end']();};}function respondWithResult(_0x5624cf,_0x19403c){_0x19403c=_0x19403c||0xc8;return function(_0x1e9758){if(_0x1e9758){return _0x5624cf[_0x1de0('0x1c')](_0x19403c)[_0x1de0('0x1d')](_0x1e9758);}};}function respondWithFilteredResult(_0x45f839,_0x1968c2){return function(_0x1bd4a7){if(_0x1bd4a7){var _0x1ff58e=typeof _0x1968c2[_0x1de0('0x1e')]===_0x1de0('0x1f')&&typeof _0x1968c2['limit']===_0x1de0('0x1f');var _0x18b575=_0x1bd4a7['count'];var _0x24c9b6=_0x1ff58e?0x0:_0x1968c2[_0x1de0('0x1e')];var _0x1ed246=_0x1ff58e?_0x1bd4a7['count']:_0x1968c2[_0x1de0('0x1e')]+_0x1968c2[_0x1de0('0x20')];var _0x5a6f4f;if(_0x1ed246>=_0x18b575){_0x1ed246=_0x18b575;_0x5a6f4f=0xc8;}else{_0x5a6f4f=0xce;}_0x45f839['status'](_0x5a6f4f);return _0x45f839[_0x1de0('0x21')](_0x1de0('0x22'),_0x24c9b6+'-'+_0x1ed246+'/'+_0x18b575)['json'](_0x1bd4a7);}return null;};}function patchUpdates(_0x451a72){return function(_0x5c3313){try{jsonpatch['apply'](_0x5c3313,_0x451a72,!![]);}catch(_0x1a534b){return BPromise[_0x1de0('0x23')](_0x1a534b);}return _0x5c3313['save']();};}function saveUpdates(_0x13142c,_0x29c855){return function(_0x251421){if(_0x251421){return _0x251421[_0x1de0('0x24')](_0x13142c)['then'](function(_0x1eaaac){return _0x1eaaac;});}return null;};}function removeEntity(_0x4b22be,_0xae0251){return function(_0x110438){if(_0x110438){return _0x110438[_0x1de0('0x25')]()[_0x1de0('0x26')](function(){var _0x4a0433=_0x110438[_0x1de0('0x27')]({'plain':!![]});var _0xca53cd='CmHopperAdditionalPhones';return db[_0x1de0('0x28')][_0x1de0('0x25')]({'where':{'type':_0xca53cd,'resourceId':_0x4a0433['id']}})['then'](function(){return _0x110438;});})['then'](function(){_0x4b22be['status'](0xcc)[_0x1de0('0x29')]();});}};}function handleEntityNotFound(_0x174984,_0x3be2b5){return function(_0xecd6b0){if(!_0xecd6b0){_0x174984[_0x1de0('0x1b')](0x194);}return _0xecd6b0;};}function handleError(_0x26fa1c,_0x3e32e7){_0x3e32e7=_0x3e32e7||0x1f4;return function(_0x5d8549){logger[_0x1de0('0x2a')](_0x5d8549['stack']);if(_0x5d8549['name']){delete _0x5d8549['name'];}_0x26fa1c[_0x1de0('0x1c')](_0x3e32e7)[_0x1de0('0x2b')](_0x5d8549);};}exports[_0x1de0('0x2c')]=function(_0x1744ec,_0x8aeb53){var _0x1bbe79={},_0x45e555={},_0x1b5292={'count':0x0,'rows':[]};var _0x51ea76=_[_0x1de0('0x2d')](db[_0x1de0('0x2e')][_0x1de0('0x2f')],function(_0x54b2bb){return{'name':_0x54b2bb[_0x1de0('0x30')],'type':_0x54b2bb[_0x1de0('0x31')][_0x1de0('0x32')]};});_0x45e555[_0x1de0('0x33')]=_[_0x1de0('0x2d')](_0x51ea76,_0x1de0('0x34'));_0x45e555[_0x1de0('0x35')]=_[_0x1de0('0x36')](_0x1744ec[_0x1de0('0x35')]);_0x45e555['filters']=_[_0x1de0('0x37')](_0x45e555[_0x1de0('0x33')],_0x45e555[_0x1de0('0x35')]);_0x1bbe79[_0x1de0('0x38')]=_['intersection'](_0x45e555[_0x1de0('0x33')],qs['fields'](_0x1744ec[_0x1de0('0x35')]['fields']));_0x1bbe79[_0x1de0('0x38')]=_0x1bbe79['attributes'][_0x1de0('0x39')]?_0x1bbe79['attributes']:_0x45e555[_0x1de0('0x33')];if(!_0x1744ec[_0x1de0('0x35')][_0x1de0('0x3a')]('nolimit')){_0x1bbe79['limit']=qs[_0x1de0('0x20')](_0x1744ec['query'][_0x1de0('0x20')]);_0x1bbe79[_0x1de0('0x1e')]=qs['offset'](_0x1744ec[_0x1de0('0x35')]['offset']);}_0x1bbe79['order']=qs[_0x1de0('0x3b')](_0x1744ec[_0x1de0('0x35')]['sort']);_0x1bbe79[_0x1de0('0x3c')]=qs[_0x1de0('0x3d')](_[_0x1de0('0x3e')](_0x1744ec[_0x1de0('0x35')],_0x45e555['filters']),_0x51ea76);if(_0x1744ec[_0x1de0('0x35')][_0x1de0('0x3f')]){_0x1bbe79[_0x1de0('0x3c')]=_['merge'](_0x1bbe79[_0x1de0('0x3c')],{'$or':_['map'](_0x51ea76,function(_0x50e49a){if(_0x50e49a[_0x1de0('0x31')]!==_0x1de0('0x40')){var _0x4557a8={};_0x4557a8[_0x50e49a[_0x1de0('0x34')]]={'$like':'%'+_0x1744ec['query'][_0x1de0('0x3f')]+'%'};return _0x4557a8;}})});}_0x1bbe79=_[_0x1de0('0x41')]({},_0x1bbe79,_0x1744ec[_0x1de0('0x42')]);var _0x2f5211={'where':_0x1bbe79[_0x1de0('0x3c')]};return db[_0x1de0('0x2e')]['count'](_0x2f5211)[_0x1de0('0x26')](function(_0x159fcd){_0x1b5292[_0x1de0('0x43')]=_0x159fcd;if(_0x1744ec['query'][_0x1de0('0x44')]){_0x1bbe79[_0x1de0('0x45')]=[{'all':!![]}];}return db[_0x1de0('0x2e')][_0x1de0('0x46')](_0x1bbe79);})[_0x1de0('0x26')](function(_0x3dbf6b){_0x1b5292['rows']=_0x3dbf6b;return _0x1b5292;})[_0x1de0('0x26')](respondWithFilteredResult(_0x8aeb53,_0x1bbe79))['catch'](handleError(_0x8aeb53,null));};exports[_0x1de0('0x47')]=function(_0x4c0a72,_0x155e9){var _0x3ce57a={'raw':!![],'where':{'id':_0x4c0a72[_0x1de0('0x48')]['id']}},_0x32e084={};_0x32e084['model']=_[_0x1de0('0x36')](db[_0x1de0('0x2e')][_0x1de0('0x2f')]);_0x32e084[_0x1de0('0x35')]=_[_0x1de0('0x36')](_0x4c0a72[_0x1de0('0x35')]);_0x32e084[_0x1de0('0x3d')]=_[_0x1de0('0x37')](_0x32e084[_0x1de0('0x33')],_0x32e084[_0x1de0('0x35')]);_0x3ce57a[_0x1de0('0x38')]=_[_0x1de0('0x37')](_0x32e084[_0x1de0('0x33')],qs[_0x1de0('0x49')](_0x4c0a72[_0x1de0('0x35')][_0x1de0('0x49')]));_0x3ce57a['attributes']=_0x3ce57a['attributes'][_0x1de0('0x39')]?_0x3ce57a[_0x1de0('0x38')]:_0x32e084['model'];if(_0x4c0a72['query'][_0x1de0('0x44')]){_0x3ce57a[_0x1de0('0x45')]=[{'all':!![]}];}_0x3ce57a=_[_0x1de0('0x41')]({},_0x3ce57a,_0x4c0a72[_0x1de0('0x42')]);return db[_0x1de0('0x2e')][_0x1de0('0x4a')](_0x3ce57a)[_0x1de0('0x26')](handleEntityNotFound(_0x155e9,null))[_0x1de0('0x26')](respondWithResult(_0x155e9,null))['catch'](handleError(_0x155e9,null));};exports[_0x1de0('0x4b')]=function(_0x2ea1dc,_0xa9a1e5){return db['CmHopperAdditionalPhone'][_0x1de0('0x4b')](_0x2ea1dc[_0x1de0('0x4c')],{})[_0x1de0('0x26')](function(_0x5d14a3){var _0x4b6910=_0x2ea1dc['user'][_0x1de0('0x27')]({'plain':!![]});if(!_0x4b6910)throw new Error(_0x1de0('0x4d'));if(_0x4b6910[_0x1de0('0x4e')]===_0x1de0('0x4f')){var _0xa509f0=_0x5d14a3[_0x1de0('0x27')]({'plain':!![]});var _0x43dae9=_0x1de0('0x50');return db['UserProfileSection']['find']({'where':{'name':_0x43dae9,'userProfileId':_0x4b6910['userProfileId']},'raw':!![]})['then'](function(_0x3690a4){if(_0x3690a4&&_0x3690a4['autoAssociation']===0x0){return db[_0x1de0('0x28')][_0x1de0('0x4b')]({'name':_0xa509f0['name'],'resourceId':_0xa509f0['id'],'type':_0x3690a4[_0x1de0('0x34')],'sectionId':_0x3690a4['id']},{})['then'](function(){return _0x5d14a3;});}else{return _0x5d14a3;}})[_0x1de0('0x51')](function(_0x257696){logger[_0x1de0('0x2a')](_0x1de0('0x52'),_0x257696);throw _0x257696;});}return _0x5d14a3;})[_0x1de0('0x26')](respondWithResult(_0xa9a1e5,0xc9))['catch'](handleError(_0xa9a1e5,null));};exports[_0x1de0('0x24')]=function(_0xc385ec,_0x197d8e){if(_0xc385ec[_0x1de0('0x4c')]['id']){delete _0xc385ec['body']['id'];}return db['CmHopperAdditionalPhone']['find']({'where':{'id':_0xc385ec[_0x1de0('0x48')]['id']}})[_0x1de0('0x26')](handleEntityNotFound(_0x197d8e,null))['then'](saveUpdates(_0xc385ec[_0x1de0('0x4c')],null))[_0x1de0('0x26')](respondWithResult(_0x197d8e,null))['catch'](handleError(_0x197d8e,null));};exports[_0x1de0('0x25')]=function(_0x33ed73,_0x45f106){return db[_0x1de0('0x2e')][_0x1de0('0x4a')]({'where':{'id':_0x33ed73['params']['id']}})[_0x1de0('0x26')](handleEntityNotFound(_0x45f106,null))[_0x1de0('0x26')](removeEntity(_0x45f106,null))[_0x1de0('0x51')](handleError(_0x45f106,null));}; \ No newline at end of file +var _0xa893=['autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','CmHopperAdditionalPhones','UserProfileResource','destroy','then','error','stack','name','send','index','map','CmHopperAdditionalPhone','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','where','VIRTUAL','filter','options','catch','show','params','includeAll','include','merge','find','create','body','user','get','UserProfileSection'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa893,0x192));var _0x3a89=function(_0x2a1579,_0x16b8e6){_0x2a1579=_0x2a1579-0x0;var _0x452d61=_0xa893[_0x2a1579];return _0x452d61;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3a89('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3a89('0x1'));var rp=require(_0x3a89('0x2'));var moment=require(_0x3a89('0x3'));var BPromise=require(_0x3a89('0x4'));var Mustache=require(_0x3a89('0x5'));var util=require('util');var path=require(_0x3a89('0x6'));var sox=require(_0x3a89('0x7'));var csv=require(_0x3a89('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3a89('0x9'));var _=require(_0x3a89('0xa'));var squel=require(_0x3a89('0xb'));var crypto=require(_0x3a89('0xc'));var jsforce=require(_0x3a89('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3a89('0xe'));var Papa=require(_0x3a89('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3a89('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3a89('0x11'));var utils=require(_0x3a89('0x12'));var config=require(_0x3a89('0x13'));var licenseUtil=require(_0x3a89('0x14'));var db=require(_0x3a89('0x15'))['db'];function respondWithStatusCode(_0x51eda5,_0x499139){_0x499139=_0x499139||0xcc;return function(_0x4d0f60){if(_0x4d0f60){return _0x51eda5[_0x3a89('0x16')](_0x499139);}return _0x51eda5[_0x3a89('0x17')](_0x499139)[_0x3a89('0x18')]();};}function respondWithResult(_0x426a9d,_0xa3dac1){_0xa3dac1=_0xa3dac1||0xc8;return function(_0x24e0f8){if(_0x24e0f8){return _0x426a9d[_0x3a89('0x17')](_0xa3dac1)[_0x3a89('0x19')](_0x24e0f8);}};}function respondWithFilteredResult(_0x9ce54c,_0x3abfd2){return function(_0x5a05b7){if(_0x5a05b7){var _0xee45e7=typeof _0x3abfd2['offset']===_0x3a89('0x1a')&&typeof _0x3abfd2['limit']===_0x3a89('0x1a');var _0x4df0be=_0x5a05b7[_0x3a89('0x1b')];var _0x1619d4=_0xee45e7?0x0:_0x3abfd2[_0x3a89('0x1c')];var _0x454587=_0xee45e7?_0x5a05b7[_0x3a89('0x1b')]:_0x3abfd2['offset']+_0x3abfd2[_0x3a89('0x1d')];var _0x25c86c;if(_0x454587>=_0x4df0be){_0x454587=_0x4df0be;_0x25c86c=0xc8;}else{_0x25c86c=0xce;}_0x9ce54c[_0x3a89('0x17')](_0x25c86c);return _0x9ce54c[_0x3a89('0x1e')](_0x3a89('0x1f'),_0x1619d4+'-'+_0x454587+'/'+_0x4df0be)['json'](_0x5a05b7);}return null;};}function patchUpdates(_0xaea686){return function(_0x1f4b7e){try{jsonpatch[_0x3a89('0x20')](_0x1f4b7e,_0xaea686,!![]);}catch(_0x5e79e7){return BPromise[_0x3a89('0x21')](_0x5e79e7);}return _0x1f4b7e[_0x3a89('0x22')]();};}function saveUpdates(_0x475d56,_0x2ef5a3){return function(_0xe513f5){if(_0xe513f5){return _0xe513f5[_0x3a89('0x23')](_0x475d56)['then'](function(_0x520440){return _0x520440;});}return null;};}function removeEntity(_0x5ecbe1,_0x1d6248){return function(_0x2ec666){if(_0x2ec666){return _0x2ec666['destroy']()['then'](function(){var _0x1f3eb6=_0x2ec666['get']({'plain':!![]});var _0x1b5ca3=_0x3a89('0x24');return db[_0x3a89('0x25')][_0x3a89('0x26')]({'where':{'type':_0x1b5ca3,'resourceId':_0x1f3eb6['id']}})[_0x3a89('0x27')](function(){return _0x2ec666;});})[_0x3a89('0x27')](function(){_0x5ecbe1[_0x3a89('0x17')](0xcc)[_0x3a89('0x18')]();});}};}function handleEntityNotFound(_0x10c448,_0x92dbff){return function(_0x482487){if(!_0x482487){_0x10c448[_0x3a89('0x16')](0x194);}return _0x482487;};}function handleError(_0x5cab9f,_0x311460){_0x311460=_0x311460||0x1f4;return function(_0x4accbb){logger[_0x3a89('0x28')](_0x4accbb[_0x3a89('0x29')]);if(_0x4accbb['name']){delete _0x4accbb[_0x3a89('0x2a')];}_0x5cab9f[_0x3a89('0x17')](_0x311460)[_0x3a89('0x2b')](_0x4accbb);};}exports[_0x3a89('0x2c')]=function(_0xfd13b7,_0x245765){var _0x50b5f6={},_0x19fdbd={},_0x7a3c1f={'count':0x0,'rows':[]};var _0x287c6b=_[_0x3a89('0x2d')](db[_0x3a89('0x2e')][_0x3a89('0x2f')],function(_0x490d40){return{'name':_0x490d40[_0x3a89('0x30')],'type':_0x490d40[_0x3a89('0x31')]['key']};});_0x19fdbd['model']=_[_0x3a89('0x2d')](_0x287c6b,_0x3a89('0x2a'));_0x19fdbd[_0x3a89('0x32')]=_[_0x3a89('0x33')](_0xfd13b7[_0x3a89('0x32')]);_0x19fdbd[_0x3a89('0x34')]=_[_0x3a89('0x35')](_0x19fdbd[_0x3a89('0x36')],_0x19fdbd[_0x3a89('0x32')]);_0x50b5f6[_0x3a89('0x37')]=_[_0x3a89('0x35')](_0x19fdbd[_0x3a89('0x36')],qs[_0x3a89('0x38')](_0xfd13b7['query']['fields']));_0x50b5f6[_0x3a89('0x37')]=_0x50b5f6[_0x3a89('0x37')][_0x3a89('0x39')]?_0x50b5f6[_0x3a89('0x37')]:_0x19fdbd[_0x3a89('0x36')];if(!_0xfd13b7[_0x3a89('0x32')][_0x3a89('0x3a')](_0x3a89('0x3b'))){_0x50b5f6[_0x3a89('0x1d')]=qs[_0x3a89('0x1d')](_0xfd13b7[_0x3a89('0x32')][_0x3a89('0x1d')]);_0x50b5f6['offset']=qs['offset'](_0xfd13b7[_0x3a89('0x32')][_0x3a89('0x1c')]);}_0x50b5f6['order']=qs['sort'](_0xfd13b7[_0x3a89('0x32')][_0x3a89('0x3c')]);_0x50b5f6['where']=qs[_0x3a89('0x34')](_[_0x3a89('0x3d')](_0xfd13b7[_0x3a89('0x32')],_0x19fdbd['filters']),_0x287c6b);if(_0xfd13b7['query']['filter']){_0x50b5f6['where']=_['merge'](_0x50b5f6[_0x3a89('0x3e')],{'$or':_[_0x3a89('0x2d')](_0x287c6b,function(_0x19c581){if(_0x19c581[_0x3a89('0x31')]!==_0x3a89('0x3f')){var _0x1633a4={};_0x1633a4[_0x19c581[_0x3a89('0x2a')]]={'$like':'%'+_0xfd13b7[_0x3a89('0x32')][_0x3a89('0x40')]+'%'};return _0x1633a4;}})});}_0x50b5f6=_['merge']({},_0x50b5f6,_0xfd13b7[_0x3a89('0x41')]);var _0x132d87={'where':_0x50b5f6[_0x3a89('0x3e')]};return db[_0x3a89('0x2e')][_0x3a89('0x1b')](_0x132d87)[_0x3a89('0x27')](function(_0x147b1f){_0x7a3c1f['count']=_0x147b1f;if(_0xfd13b7[_0x3a89('0x32')]['includeAll']){_0x50b5f6['include']=[{'all':!![]}];}return db['CmHopperAdditionalPhone']['findAll'](_0x50b5f6);})['then'](function(_0x469dea){_0x7a3c1f['rows']=_0x469dea;return _0x7a3c1f;})[_0x3a89('0x27')](respondWithFilteredResult(_0x245765,_0x50b5f6))[_0x3a89('0x42')](handleError(_0x245765,null));};exports[_0x3a89('0x43')]=function(_0x47d141,_0x21e455){var _0x4e8fc5={'raw':!![],'where':{'id':_0x47d141[_0x3a89('0x44')]['id']}},_0x308a37={};_0x308a37[_0x3a89('0x36')]=_[_0x3a89('0x33')](db[_0x3a89('0x2e')][_0x3a89('0x2f')]);_0x308a37[_0x3a89('0x32')]=_['keys'](_0x47d141['query']);_0x308a37[_0x3a89('0x34')]=_[_0x3a89('0x35')](_0x308a37[_0x3a89('0x36')],_0x308a37[_0x3a89('0x32')]);_0x4e8fc5[_0x3a89('0x37')]=_['intersection'](_0x308a37[_0x3a89('0x36')],qs[_0x3a89('0x38')](_0x47d141[_0x3a89('0x32')][_0x3a89('0x38')]));_0x4e8fc5[_0x3a89('0x37')]=_0x4e8fc5[_0x3a89('0x37')][_0x3a89('0x39')]?_0x4e8fc5[_0x3a89('0x37')]:_0x308a37[_0x3a89('0x36')];if(_0x47d141[_0x3a89('0x32')][_0x3a89('0x45')]){_0x4e8fc5[_0x3a89('0x46')]=[{'all':!![]}];}_0x4e8fc5=_[_0x3a89('0x47')]({},_0x4e8fc5,_0x47d141[_0x3a89('0x41')]);return db[_0x3a89('0x2e')][_0x3a89('0x48')](_0x4e8fc5)[_0x3a89('0x27')](handleEntityNotFound(_0x21e455,null))[_0x3a89('0x27')](respondWithResult(_0x21e455,null))[_0x3a89('0x42')](handleError(_0x21e455,null));};exports[_0x3a89('0x49')]=function(_0x3d610e,_0x44dcb0){return db[_0x3a89('0x2e')][_0x3a89('0x49')](_0x3d610e[_0x3a89('0x4a')],{})[_0x3a89('0x27')](function(_0x11b84f){var _0x5ae6a6=_0x3d610e[_0x3a89('0x4b')][_0x3a89('0x4c')]({'plain':!![]});if(!_0x5ae6a6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5ae6a6['role']===_0x3a89('0x4b')){var _0x2fa962=_0x11b84f[_0x3a89('0x4c')]({'plain':!![]});var _0x179f3d=_0x3a89('0x24');return db[_0x3a89('0x4d')][_0x3a89('0x48')]({'where':{'name':_0x179f3d,'userProfileId':_0x5ae6a6['userProfileId']},'raw':!![]})[_0x3a89('0x27')](function(_0x54e737){if(_0x54e737&&_0x54e737[_0x3a89('0x4e')]===0x0){return db['UserProfileResource'][_0x3a89('0x49')]({'name':_0x2fa962[_0x3a89('0x2a')],'resourceId':_0x2fa962['id'],'type':_0x54e737[_0x3a89('0x2a')],'sectionId':_0x54e737['id']},{})[_0x3a89('0x27')](function(){return _0x11b84f;});}else{return _0x11b84f;}})['catch'](function(_0x1877dc){logger['error'](_0x3a89('0x4f'),_0x1877dc);throw _0x1877dc;});}return _0x11b84f;})[_0x3a89('0x27')](respondWithResult(_0x44dcb0,0xc9))['catch'](handleError(_0x44dcb0,null));};exports[_0x3a89('0x23')]=function(_0x576b8d,_0xbf6fea){if(_0x576b8d[_0x3a89('0x4a')]['id']){delete _0x576b8d['body']['id'];}return db[_0x3a89('0x2e')]['find']({'where':{'id':_0x576b8d[_0x3a89('0x44')]['id']}})['then'](handleEntityNotFound(_0xbf6fea,null))[_0x3a89('0x27')](saveUpdates(_0x576b8d[_0x3a89('0x4a')],null))[_0x3a89('0x27')](respondWithResult(_0xbf6fea,null))[_0x3a89('0x42')](handleError(_0xbf6fea,null));};exports['destroy']=function(_0x1d761d,_0x28472e){return db[_0x3a89('0x2e')]['find']({'where':{'id':_0x1d761d['params']['id']}})['then'](handleEntityNotFound(_0x28472e,null))[_0x3a89('0x27')](removeEntity(_0x28472e,null))[_0x3a89('0x42')](handleError(_0x28472e,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 9cf644a..b635a36 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 _0x758f=['CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define'];(function(_0x3d7364,_0x12cb1c){var _0x24361e=function(_0x471992){while(--_0x471992){_0x3d7364['push'](_0x3d7364['shift']());}};_0x24361e(++_0x12cb1c);}(_0x758f,0x183));var _0xf758=function(_0x618644,_0x24242b){_0x618644=_0x618644-0x0;var _0x401623=_0x758f[_0x618644];return _0x401623;};'use strict';var _=require(_0xf758('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf758('0x1'));var moment=require(_0xf758('0x2'));var BPromise=require(_0xf758('0x3'));var rp=require(_0xf758('0x4'));var fs=require('fs');var path=require(_0xf758('0x5'));var rimraf=require(_0xf758('0x6'));var config=require(_0xf758('0x7'));var attributes=require('./cmHopperAdditionalPhone.attributes');module['exports']=function(_0x2cdf65,_0x5344eb){return _0x2cdf65[_0xf758('0x8')](_0xf758('0x9'),attributes,{'tableName':_0xf758('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5bb8=['./cmHopperAdditionalPhone.attributes','define','CmHopperAdditionalPhone','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4ecb8f,_0x1d2fe2){var _0x1973d1=function(_0x1cae15){while(--_0x1cae15){_0x4ecb8f['push'](_0x4ecb8f['shift']());}};_0x1973d1(++_0x1d2fe2);}(_0x5bb8,0x158));var _0x85bb=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x5bb8[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x85bb('0x0'));var util=require(_0x85bb('0x1'));var logger=require(_0x85bb('0x2'))('api');var moment=require('moment');var BPromise=require(_0x85bb('0x3'));var rp=require(_0x85bb('0x4'));var fs=require('fs');var path=require(_0x85bb('0x5'));var rimraf=require(_0x85bb('0x6'));var config=require(_0x85bb('0x7'));var attributes=require(_0x85bb('0x8'));module['exports']=function(_0x1a6268,_0x2f4e99){return _0x1a6268[_0x85bb('0x9')](_0x85bb('0xa'),attributes,{'tableName':'cm_hopper_additional_phones','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 39b6395..6934f50 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 _0xad72=['countmachineretry','dialGlobalMaxRetry','countnosuchnumberretry','VerifyAdditionalPhones','CmHopper','CampaignId','waitTime','duration','isNil','scheduledat','add','minutes','phone','countnoanswerretry','countagentrejectretry','createdAt','updatedAt','sequelize','transaction','update','activateAdditionalPhone','IncrementPreviewCounters','field','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','request','then','info','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','error','code','CmHopperAdditionalPhone,\x20%s,\x20%s','message','result','catch','findOne','body','ContactId','ListId','VoiceQueueId','CmHopperAdditionalPhone','OrderBy','ASC','countbusyretry','countcongestionretry','countdropretry','countabandonedretry'];(function(_0x1b7e39,_0x3a94b5){var _0x5e9922=function(_0x18ea10){while(--_0x18ea10){_0x1b7e39['push'](_0x1b7e39['shift']());}};_0x5e9922(++_0x3a94b5);}(_0xad72,0x198));var _0x2ad7=function(_0xff99ea,_0x63915){_0xff99ea=_0xff99ea-0x0;var _0x47a615=_0xad72[_0xff99ea];return _0x47a615;};'use strict';var _=require(_0x2ad7('0x0'));var util=require(_0x2ad7('0x1'));var moment=require(_0x2ad7('0x2'));var BPromise=require('bluebird');var rs=require(_0x2ad7('0x3'));var fs=require('fs');var Redis=require(_0x2ad7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2ad7('0x5'));var logger=require(_0x2ad7('0x6'))('rpc');var config=require(_0x2ad7('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x22f6ef,_0x104cf0,_0x8df5e0){return new BPromise(function(_0x228130,_0x408063){return client[_0x2ad7('0x8')](_0x22f6ef,_0x8df5e0)[_0x2ad7('0x9')](function(_0x58dad0){logger[_0x2ad7('0xa')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x104cf0,_0x2ad7('0xb'));logger[_0x2ad7('0xc')](_0x2ad7('0xd'),_0x104cf0,_0x2ad7('0xb'),JSON['stringify'](_0x58dad0));if(_0x58dad0[_0x2ad7('0xe')]){if(_0x58dad0['error'][_0x2ad7('0xf')]===0x1f4){logger[_0x2ad7('0xe')](_0x2ad7('0x10'),_0x104cf0,_0x58dad0[_0x2ad7('0xe')][_0x2ad7('0x11')]);return _0x408063(_0x58dad0[_0x2ad7('0xe')][_0x2ad7('0x11')]);}logger['error'](_0x2ad7('0x10'),_0x104cf0,_0x58dad0[_0x2ad7('0xe')][_0x2ad7('0x11')]);return _0x228130(_0x58dad0['error'][_0x2ad7('0x11')]);}else{logger['info'](_0x2ad7('0x10'),_0x104cf0,_0x2ad7('0xb'));_0x228130(_0x58dad0[_0x2ad7('0x12')]['message']);}})[_0x2ad7('0x13')](function(_0x5e3bb7){logger['error'](_0x2ad7('0x10'),_0x104cf0,_0x5e3bb7);_0x408063(_0x5e3bb7);});});}exports['VerifyAdditionalPhones']=function(_0x462919){var _0xb61f06=this;return new Promise(function(_0x3d4d10,_0x173a92){return db['CmHopper'][_0x2ad7('0x14')]({'raw':!![],'where':{'ContactId':_0x462919[_0x2ad7('0x15')][_0x2ad7('0x16')],'ListId':_0x462919[_0x2ad7('0x15')][_0x2ad7('0x17')],'VoiceQueueId':_0x462919['body'][_0x2ad7('0x18')]===undefined?null:_0x462919[_0x2ad7('0x15')][_0x2ad7('0x18')],'CampaignId':_0x462919[_0x2ad7('0x15')]['CampaignId']===undefined?null:_0x462919[_0x2ad7('0x15')]['CampaignId']}})[_0x2ad7('0x9')](function(_0x21321b){if(_0x21321b!=null){return db[_0x2ad7('0x19')][_0x2ad7('0x14')]({'raw':!![],'where':{'CmHopperId':_0x21321b['id'],'OrderBy':{'$gt':_0x21321b[_0x2ad7('0x1a')]}},'order':[[_0x2ad7('0x1a'),_0x2ad7('0x1b')]]})[_0x2ad7('0x9')](function(_0x1547a6){var _0x2147a=0x0;if(_0x1547a6){if(_0x1547a6[_0x2ad7('0x1c')]+_0x1547a6[_0x2ad7('0x1d')]+_0x1547a6['countnoanswerretry']+_0x1547a6['countnosuchnumberretry']+_0x1547a6[_0x2ad7('0x1e')]+_0x1547a6[_0x2ad7('0x1f')]+_0x1547a6[_0x2ad7('0x20')]+_0x1547a6['countagentrejectretry']<_0x462919['entity'][_0x2ad7('0x21')])_0x2147a=0x1;_0x3d4d10({'additional':_0x2147a});}else{return db[_0x2ad7('0x19')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x21321b['id']},'order':[[_0x2ad7('0x1a'),_0x2ad7('0x1b')]]})[_0x2ad7('0x9')](function(_0xc014c2){var _0x3fea5d=0x0;if(_0xc014c2){if(_0xc014c2[_0x2ad7('0x1c')]+_0xc014c2['countcongestionretry']+_0xc014c2['countnoanswerretry']+_0xc014c2[_0x2ad7('0x22')]+_0xc014c2['countdropretry']+_0xc014c2['countabandonedretry']+_0xc014c2[_0x2ad7('0x20')]+_0xc014c2['countagentrejectretry']<_0x462919['entity']['dialGlobalMaxRetry'])_0x3fea5d=0x1;_0x3d4d10({'additional':_0x3fea5d});}else{_0x3d4d10({'additional':0x0});}})[_0x2ad7('0x13')](function(_0x5ece61){logger[_0x2ad7('0xe')](_0x2ad7('0x23'),_0x5ece61['message']);_0x173a92(_0xb61f06['error'](0x1f4,_0x5ece61['message']));});}})[_0x2ad7('0x13')](function(_0x4857d9){logger[_0x2ad7('0xe')](_0x2ad7('0x23'),_0x4857d9[_0x2ad7('0x11')]);_0x173a92(_0xb61f06[_0x2ad7('0xe')](0x1f4,_0x4857d9[_0x2ad7('0x11')]));});}else _0x3d4d10({'additional':0x0});});});};exports['SwapAdditionalPhones']=function(_0x380109){var _0x2396d5=this;return new Promise(function(_0x521e05,_0x389721){return db[_0x2ad7('0x24')]['findOne']({'raw':!![],'where':{'ContactId':_0x380109[_0x2ad7('0x15')]['ContactId'],'ListId':_0x380109[_0x2ad7('0x15')]['ListId'],'VoiceQueueId':_0x380109['body'][_0x2ad7('0x18')]===undefined?null:_0x380109[_0x2ad7('0x15')][_0x2ad7('0x18')],'CampaignId':_0x380109[_0x2ad7('0x15')][_0x2ad7('0x25')]===undefined?null:_0x380109[_0x2ad7('0x15')][_0x2ad7('0x25')]}})[_0x2ad7('0x9')](function(_0x4dac1b){if(_0x4dac1b!=null){return db[_0x2ad7('0x19')][_0x2ad7('0x14')]({'raw':!![],'where':{'CmHopperId':_0x4dac1b['id'],'OrderBy':{'$gte':_0x4dac1b[_0x2ad7('0x1a')]}},'order':[[_0x2ad7('0x1a'),'ASC']]})['then'](function(_0x3be8c8){if(_0x3be8c8)return activateAdditionalPhone(_0x4dac1b,_0x380109[_0x2ad7('0x15')],_0x3be8c8,_0x380109['duration'],_0x380109[_0x2ad7('0x26')])[_0x2ad7('0x9')](function(_0x9ae3e1){_0x521e05(_0x9ae3e1);});else{return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x4dac1b['id']},'order':[[_0x2ad7('0x1a'),_0x2ad7('0x1b')]]})[_0x2ad7('0x9')](function(_0x5dad23){if(_0x5dad23)return activateAdditionalPhone(_0x4dac1b,_0x380109['body'],_0x5dad23,_0x380109[_0x2ad7('0x27')],_0x380109[_0x2ad7('0x26')])['then'](function(_0x1ffbd5){_0x521e05(_0x1ffbd5);});else{_0x521e05({'id':_0x4dac1b['id'],'phone':''});}})[_0x2ad7('0x13')](function(_0x1b7ef3){logger['error'](_0x2ad7('0x23'),_0x1b7ef3[_0x2ad7('0x11')]);_0x389721(_0x2396d5['error'](0x1f4,_0x1b7ef3[_0x2ad7('0x11')]));});}})[_0x2ad7('0x13')](function(_0x7d2196){logger['error'](_0x2ad7('0x23'),_0x7d2196[_0x2ad7('0x11')]);_0x389721(_0x2396d5[_0x2ad7('0xe')](0x1f4,_0x7d2196[_0x2ad7('0x11')]));});}else _0x521e05(0x1);});});};function activateAdditionalPhone(_0x23c4cb,_0x4e3392,_0x114eda,_0x3fffe1,_0x346b22){return new Promise(function(_0x4b6815,_0x17a31b){var _0x27d502;if(_[_0x2ad7('0x28')](_0x114eda[_0x2ad7('0x29')])){_0x114eda[_0x2ad7('0x29')]=moment();}if(moment()>moment(_0x114eda[_0x2ad7('0x29')])){_0x27d502=moment()[_0x2ad7('0x2a')](_0x346b22||0x3,_0x2ad7('0x2b'));}else{if(_0x114eda[_0x2ad7('0x1a')]==0x0){_0x27d502=moment(_0x114eda[_0x2ad7('0x29')]);}else{_0x27d502=moment()[_0x2ad7('0x2a')](_0x346b22||0x3,'minutes');}}if(_[_0x2ad7('0x28')](_0x27d502)){_0x27d502=moment()[_0x2ad7('0x2a')](_0x346b22||0x3,_0x2ad7('0x2b'));}var _0x27a3c7={'phone':_0x23c4cb[_0x2ad7('0x2c')],'active':0x0,'OrderBy':_[_0x2ad7('0x28')](_0x23c4cb[_0x2ad7('0x1a')])?0x0:_0x23c4cb[_0x2ad7('0x1a')],'scheduledat':moment()[_0x2ad7('0x2a')](_0x3fffe1||0x1,_0x2ad7('0x2b')),'countbusyretry':_0x4e3392[_0x2ad7('0x1c')],'countcongestionretry':_0x4e3392[_0x2ad7('0x1d')],'countnoanswerretry':_0x4e3392[_0x2ad7('0x2d')],'countnosuchnumberretry':_0x4e3392[_0x2ad7('0x22')],'countdropretry':_0x4e3392[_0x2ad7('0x1e')],'countabandonedretry':_0x4e3392[_0x2ad7('0x1f')],'countmachineretry':_0x4e3392[_0x2ad7('0x20')],'countagentrejectretry':_0x4e3392[_0x2ad7('0x2e')],'createdAt':_0x4e3392[_0x2ad7('0x2f')],'updatedAt':_0x4e3392[_0x2ad7('0x30')]};var _0x4e37af={'CmHopperId':_0x23c4cb['id'],'phone':_0x114eda[_0x2ad7('0x2c')],'active':0x0,'OrderBy':_[_0x2ad7('0x28')](_0x114eda[_0x2ad7('0x1a')])?0x0:_0x114eda[_0x2ad7('0x1a')],'scheduledat':_0x27d502,'countbusyretry':_0x114eda[_0x2ad7('0x1c')],'countcongestionretry':_0x114eda['countcongestionretry'],'countnoanswerretry':_0x114eda[_0x2ad7('0x2d')],'countnosuchnumberretry':_0x114eda[_0x2ad7('0x22')],'countdropretry':_0x114eda['countdropretry'],'countabandonedretry':_0x114eda[_0x2ad7('0x1f')],'countmachineretry':_0x114eda[_0x2ad7('0x20')],'countagentrejectretry':_0x114eda[_0x2ad7('0x2e')],'createdAt':_0x114eda[_0x2ad7('0x2f')],'updatedAt':_0x114eda[_0x2ad7('0x30')]};return db[_0x2ad7('0x31')][_0x2ad7('0x32')](function(_0x2f80e1){return db[_0x2ad7('0x19')][_0x2ad7('0x33')](_0x27a3c7,{'where':{'id':_0x114eda['id']}},{'transaction':_0x2f80e1})['then'](function(){return db[_0x2ad7('0x24')][_0x2ad7('0x33')](_0x4e37af,{'where':{'id':_0x23c4cb['id']}},{'transaction':_0x2f80e1});});})[_0x2ad7('0x9')](function(_0xf448f0){_0x4b6815({'id':_0x23c4cb['id'],'phone':_0x114eda[_0x2ad7('0x2c')]});})[_0x2ad7('0x13')](function(_0x36fc92){logger[_0x2ad7('0xe')](_0x2ad7('0x34'),_0x36fc92['message']);_0x17a31b({'error':_0x36fc92[_0x2ad7('0x11')]});});});}exports[_0x2ad7('0x35')]=function(_0x452839){var _0x351ca6=this;return new Promise(function(_0x238a40,_0x16f38c){return db['CmHopper'][_0x2ad7('0x33')](_0x452839['body'][_0x2ad7('0x36')],{'where':{'id':_0x452839[_0x2ad7('0x15')]['id']}})[_0x2ad7('0x9')](function(_0x40effd){_0x238a40(_0x40effd);})[_0x2ad7('0x13')](function(_0x2f8a2f){logger['error'](_0x2ad7('0x35'),_0x2f8a2f['message']);_0x16f38c(_0x351ca6['error'](0x1f4,_0x2f8a2f[_0x2ad7('0x11')]));});});}; \ No newline at end of file +var _0x004d=['IncrementPreviewCounters','field','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','then','info','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','error','code','CmHopperAdditionalPhone,\x20%s,\x20%s','message','result','catch','VerifyAdditionalPhones','CmHopper','body','ContactId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','findOne','OrderBy','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','entity','dialGlobalMaxRetry','SwapAdditionalPhones','duration','waitTime','ASC','isNil','scheduledat','add','minutes','phone','countmachineretry','createdAt','updatedAt','sequelize','update','activateAdditionalPhone'];(function(_0x321e72,_0x23dfcc){var _0xb956bd=function(_0x39e18e){while(--_0x39e18e){_0x321e72['push'](_0x321e72['shift']());}};_0xb956bd(++_0x23dfcc);}(_0x004d,0x183));var _0xd004=function(_0x22081d,_0x279080){_0x22081d=_0x22081d-0x0;var _0x555642=_0x004d[_0x22081d];return _0x555642;};'use strict';var _=require('lodash');var util=require(_0xd004('0x0'));var moment=require('moment');var BPromise=require(_0xd004('0x1'));var rs=require(_0xd004('0x2'));var fs=require('fs');var Redis=require(_0xd004('0x3'));var db=require(_0xd004('0x4'))['db'];var utils=require(_0xd004('0x5'));var logger=require('../../config/logger')(_0xd004('0x6'));var config=require(_0xd004('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd004('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5825b2,_0x243c8b,_0x582262){return new BPromise(function(_0x1f9d98,_0x10d51e){return client['request'](_0x5825b2,_0x582262)[_0xd004('0x9')](function(_0x296746){logger[_0xd004('0xa')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x243c8b,_0xd004('0xb'));logger[_0xd004('0xc')](_0xd004('0xd'),_0x243c8b,_0xd004('0xb'),JSON['stringify'](_0x296746));if(_0x296746[_0xd004('0xe')]){if(_0x296746[_0xd004('0xe')][_0xd004('0xf')]===0x1f4){logger[_0xd004('0xe')](_0xd004('0x10'),_0x243c8b,_0x296746['error']['message']);return _0x10d51e(_0x296746[_0xd004('0xe')][_0xd004('0x11')]);}logger[_0xd004('0xe')](_0xd004('0x10'),_0x243c8b,_0x296746[_0xd004('0xe')][_0xd004('0x11')]);return _0x1f9d98(_0x296746[_0xd004('0xe')][_0xd004('0x11')]);}else{logger[_0xd004('0xa')](_0xd004('0x10'),_0x243c8b,_0xd004('0xb'));_0x1f9d98(_0x296746[_0xd004('0x12')]['message']);}})[_0xd004('0x13')](function(_0x21fc25){logger[_0xd004('0xe')](_0xd004('0x10'),_0x243c8b,_0x21fc25);_0x10d51e(_0x21fc25);});});}exports[_0xd004('0x14')]=function(_0x10383e){var _0x2281d1=this;return new Promise(function(_0x17b48e,_0x3c4a46){return db[_0xd004('0x15')]['findOne']({'raw':!![],'where':{'ContactId':_0x10383e[_0xd004('0x16')][_0xd004('0x17')],'ListId':_0x10383e['body']['ListId'],'VoiceQueueId':_0x10383e[_0xd004('0x16')][_0xd004('0x18')]===undefined?null:_0x10383e[_0xd004('0x16')][_0xd004('0x18')],'CampaignId':_0x10383e[_0xd004('0x16')]['CampaignId']===undefined?null:_0x10383e[_0xd004('0x16')][_0xd004('0x19')]}})['then'](function(_0x1e1443){if(_0x1e1443!=null){return db[_0xd004('0x1a')][_0xd004('0x1b')]({'raw':!![],'where':{'CmHopperId':_0x1e1443['id'],'OrderBy':{'$gt':_0x1e1443[_0xd004('0x1c')]}},'order':[[_0xd004('0x1c'),'ASC']]})['then'](function(_0x495515){var _0x3142bc=0x0;if(_0x495515){if(_0x495515[_0xd004('0x1d')]+_0x495515[_0xd004('0x1e')]+_0x495515[_0xd004('0x1f')]+_0x495515[_0xd004('0x20')]+_0x495515[_0xd004('0x21')]+_0x495515[_0xd004('0x22')]+_0x495515['countmachineretry']+_0x495515[_0xd004('0x23')]<_0x10383e[_0xd004('0x24')][_0xd004('0x25')])_0x3142bc=0x1;_0x17b48e({'additional':_0x3142bc});}else{return db[_0xd004('0x1a')][_0xd004('0x1b')]({'raw':!![],'where':{'CmHopperId':_0x1e1443['id']},'order':[[_0xd004('0x1c'),'ASC']]})[_0xd004('0x9')](function(_0x1a682){var _0xf3ad94=0x0;if(_0x1a682){if(_0x1a682[_0xd004('0x1d')]+_0x1a682['countcongestionretry']+_0x1a682['countnoanswerretry']+_0x1a682[_0xd004('0x20')]+_0x1a682[_0xd004('0x21')]+_0x1a682['countabandonedretry']+_0x1a682['countmachineretry']+_0x1a682['countagentrejectretry']<_0x10383e['entity']['dialGlobalMaxRetry'])_0xf3ad94=0x1;_0x17b48e({'additional':_0xf3ad94});}else{_0x17b48e({'additional':0x0});}})[_0xd004('0x13')](function(_0x1e5ed7){logger[_0xd004('0xe')](_0xd004('0x14'),_0x1e5ed7['message']);_0x3c4a46(_0x2281d1[_0xd004('0xe')](0x1f4,_0x1e5ed7[_0xd004('0x11')]));});}})[_0xd004('0x13')](function(_0x60bf28){logger[_0xd004('0xe')]('VerifyAdditionalPhones',_0x60bf28['message']);_0x3c4a46(_0x2281d1['error'](0x1f4,_0x60bf28['message']));});}else _0x17b48e({'additional':0x0});});});};exports[_0xd004('0x26')]=function(_0x2443b7){var _0x2d5ac1=this;return new Promise(function(_0x23c520,_0xcfef84){return db[_0xd004('0x15')][_0xd004('0x1b')]({'raw':!![],'where':{'ContactId':_0x2443b7['body']['ContactId'],'ListId':_0x2443b7[_0xd004('0x16')]['ListId'],'VoiceQueueId':_0x2443b7[_0xd004('0x16')][_0xd004('0x18')]===undefined?null:_0x2443b7['body']['VoiceQueueId'],'CampaignId':_0x2443b7['body']['CampaignId']===undefined?null:_0x2443b7[_0xd004('0x16')][_0xd004('0x19')]}})[_0xd004('0x9')](function(_0x52ea61){if(_0x52ea61!=null){return db[_0xd004('0x1a')][_0xd004('0x1b')]({'raw':!![],'where':{'CmHopperId':_0x52ea61['id'],'OrderBy':{'$gte':_0x52ea61[_0xd004('0x1c')]}},'order':[[_0xd004('0x1c'),'ASC']]})[_0xd004('0x9')](function(_0x12f048){if(_0x12f048)return activateAdditionalPhone(_0x52ea61,_0x2443b7[_0xd004('0x16')],_0x12f048,_0x2443b7[_0xd004('0x27')],_0x2443b7[_0xd004('0x28')])[_0xd004('0x9')](function(_0x5ccedc){_0x23c520(_0x5ccedc);});else{return db['CmHopperAdditionalPhone'][_0xd004('0x1b')]({'raw':!![],'where':{'CmHopperId':_0x52ea61['id']},'order':[[_0xd004('0x1c'),_0xd004('0x29')]]})['then'](function(_0x4dc20e){if(_0x4dc20e)return activateAdditionalPhone(_0x52ea61,_0x2443b7[_0xd004('0x16')],_0x4dc20e,_0x2443b7['duration'],_0x2443b7[_0xd004('0x28')])[_0xd004('0x9')](function(_0x183cd0){_0x23c520(_0x183cd0);});else{_0x23c520({'id':_0x52ea61['id'],'phone':''});}})['catch'](function(_0x4bb7ff){logger[_0xd004('0xe')](_0xd004('0x14'),_0x4bb7ff[_0xd004('0x11')]);_0xcfef84(_0x2d5ac1[_0xd004('0xe')](0x1f4,_0x4bb7ff[_0xd004('0x11')]));});}})['catch'](function(_0x41b7c9){logger[_0xd004('0xe')](_0xd004('0x14'),_0x41b7c9[_0xd004('0x11')]);_0xcfef84(_0x2d5ac1[_0xd004('0xe')](0x1f4,_0x41b7c9[_0xd004('0x11')]));});}else _0x23c520(0x1);});});};function activateAdditionalPhone(_0x13f33f,_0xc12836,_0x2f467b,_0x63d239,_0x5bba30){return new Promise(function(_0x57ee2e,_0x2cdcc6){var _0x5da4d0;if(_[_0xd004('0x2a')](_0x2f467b['scheduledat'])){_0x2f467b[_0xd004('0x2b')]=moment();}if(moment()>moment(_0x2f467b[_0xd004('0x2b')])){_0x5da4d0=moment()[_0xd004('0x2c')](_0x5bba30||0x3,'minutes');}else{if(_0x2f467b['OrderBy']==0x0){_0x5da4d0=moment(_0x2f467b[_0xd004('0x2b')]);}else{_0x5da4d0=moment()[_0xd004('0x2c')](_0x5bba30||0x3,_0xd004('0x2d'));}}if(_[_0xd004('0x2a')](_0x5da4d0)){_0x5da4d0=moment()[_0xd004('0x2c')](_0x5bba30||0x3,_0xd004('0x2d'));}var _0x270df6={'phone':_0x13f33f[_0xd004('0x2e')],'active':0x0,'OrderBy':_[_0xd004('0x2a')](_0x13f33f[_0xd004('0x1c')])?0x0:_0x13f33f['OrderBy'],'scheduledat':moment()[_0xd004('0x2c')](_0x63d239||0x1,_0xd004('0x2d')),'countbusyretry':_0xc12836[_0xd004('0x1d')],'countcongestionretry':_0xc12836[_0xd004('0x1e')],'countnoanswerretry':_0xc12836[_0xd004('0x1f')],'countnosuchnumberretry':_0xc12836['countnosuchnumberretry'],'countdropretry':_0xc12836[_0xd004('0x21')],'countabandonedretry':_0xc12836[_0xd004('0x22')],'countmachineretry':_0xc12836[_0xd004('0x2f')],'countagentrejectretry':_0xc12836[_0xd004('0x23')],'createdAt':_0xc12836[_0xd004('0x30')],'updatedAt':_0xc12836[_0xd004('0x31')]};var _0x4966c5={'CmHopperId':_0x13f33f['id'],'phone':_0x2f467b['phone'],'active':0x0,'OrderBy':_[_0xd004('0x2a')](_0x2f467b[_0xd004('0x1c')])?0x0:_0x2f467b[_0xd004('0x1c')],'scheduledat':_0x5da4d0,'countbusyretry':_0x2f467b[_0xd004('0x1d')],'countcongestionretry':_0x2f467b[_0xd004('0x1e')],'countnoanswerretry':_0x2f467b['countnoanswerretry'],'countnosuchnumberretry':_0x2f467b[_0xd004('0x20')],'countdropretry':_0x2f467b[_0xd004('0x21')],'countabandonedretry':_0x2f467b[_0xd004('0x22')],'countmachineretry':_0x2f467b[_0xd004('0x2f')],'countagentrejectretry':_0x2f467b[_0xd004('0x23')],'createdAt':_0x2f467b[_0xd004('0x30')],'updatedAt':_0x2f467b[_0xd004('0x31')]};return db[_0xd004('0x32')]['transaction'](function(_0x530a39){return db[_0xd004('0x1a')][_0xd004('0x33')](_0x270df6,{'where':{'id':_0x2f467b['id']}},{'transaction':_0x530a39})[_0xd004('0x9')](function(){return db[_0xd004('0x15')][_0xd004('0x33')](_0x4966c5,{'where':{'id':_0x13f33f['id']}},{'transaction':_0x530a39});});})[_0xd004('0x9')](function(_0x2dd774){_0x57ee2e({'id':_0x13f33f['id'],'phone':_0x2f467b[_0xd004('0x2e')]});})['catch'](function(_0x43efab){logger[_0xd004('0xe')](_0xd004('0x34'),_0x43efab[_0xd004('0x11')]);_0x2cdcc6({'error':_0x43efab[_0xd004('0x11')]});});});}exports[_0xd004('0x35')]=function(_0x488b49){var _0x19cfef=this;return new Promise(function(_0x143000,_0x5bdc6f){return db['CmHopper']['update'](_0x488b49[_0xd004('0x16')][_0xd004('0x36')],{'where':{'id':_0x488b49['body']['id']}})[_0xd004('0x9')](function(_0x3d8b5c){_0x143000(_0x3d8b5c);})[_0xd004('0x13')](function(_0x3af3b4){logger['error'](_0xd004('0x35'),_0x3af3b4['message']);_0x5bdc6f(_0x19cfef[_0xd004('0xe')](0x1f4,_0x3af3b4[_0xd004('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 7f72425..c7dcc90 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 _0x1808=['show','update','delete','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','index','/:id','isAuthenticated'];(function(_0x197115,_0x14d69a){var _0x19d830=function(_0x1f59c5){while(--_0x1f59c5){_0x197115['push'](_0x197115['shift']());}};_0x19d830(++_0x14d69a);}(_0x1808,0xe2));var _0x8180=function(_0x4e6090,_0x50fa28){_0x4e6090=_0x4e6090-0x0;var _0x108ca1=_0x1808[_0x4e6090];return _0x108ca1;};'use strict';var multer=require(_0x8180('0x0'));var util=require(_0x8180('0x1'));var path=require('path');var timeout=require(_0x8180('0x2'));var express=require(_0x8180('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8180('0x4'));var interaction=require(_0x8180('0x5'));var config=require(_0x8180('0x6'));var controller=require(_0x8180('0x7'));router[_0x8180('0x8')]('/',auth['isAuthenticated'](),controller[_0x8180('0x9')]);router[_0x8180('0x8')](_0x8180('0xa'),auth[_0x8180('0xb')](),controller[_0x8180('0xc')]);router['post']('/',auth[_0x8180('0xb')](),controller['create']);router['put'](_0x8180('0xa'),auth[_0x8180('0xb')](),controller[_0x8180('0xd')]);router[_0x8180('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x8180('0xf')]);module[_0x8180('0x10')]=router; \ No newline at end of file +var _0x6e20=['destroy','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete'];(function(_0x3d1ecd,_0x246892){var _0x509e93=function(_0x4d85af){while(--_0x4d85af){_0x3d1ecd['push'](_0x3d1ecd['shift']());}};_0x509e93(++_0x246892);}(_0x6e20,0x1e1));var _0x06e2=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x6e20[_0x2b10c6];return _0x3789d2;};'use strict';var multer=require(_0x06e2('0x0'));var util=require(_0x06e2('0x1'));var path=require(_0x06e2('0x2'));var timeout=require('connect-timeout');var express=require(_0x06e2('0x3'));var router=express['Router']();var fs_extra=require(_0x06e2('0x4'));var auth=require(_0x06e2('0x5'));var interaction=require(_0x06e2('0x6'));var config=require(_0x06e2('0x7'));var controller=require(_0x06e2('0x8'));router[_0x06e2('0x9')]('/',auth[_0x06e2('0xa')](),controller[_0x06e2('0xb')]);router[_0x06e2('0x9')](_0x06e2('0xc'),auth['isAuthenticated'](),controller[_0x06e2('0xd')]);router[_0x06e2('0xe')]('/',auth[_0x06e2('0xa')](),controller[_0x06e2('0xf')]);router[_0x06e2('0x10')](_0x06e2('0xc'),auth[_0x06e2('0xa')](),controller[_0x06e2('0x11')]);router[_0x06e2('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x06e2('0x13')]);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 9a64077..9d2203b 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 _0xbbbd=['INTEGER','contactListQueue','moment','sequelize','exports','STRING'];(function(_0xeb2a00,_0x247bf6){var _0x7d01a9=function(_0x3baaa9){while(--_0x3baaa9){_0xeb2a00['push'](_0xeb2a00['shift']());}};_0x7d01a9(++_0x247bf6);}(_0xbbbd,0x86));var _0xdbbb=function(_0x31ced5,_0x5d5415){_0x31ced5=_0x31ced5-0x0;var _0x10d9e5=_0xbbbd[_0x31ced5];return _0x10d9e5;};'use strict';var moment=require(_0xdbbb('0x0'));var Sequelize=require(_0xdbbb('0x1'));module[_0xdbbb('0x2')]={'phone':{'type':Sequelize[_0xdbbb('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xdbbb('0x4')],'unique':_0xdbbb('0x5')},'ListId':{'type':Sequelize[_0xdbbb('0x4')],'unique':_0xdbbb('0x5')},'VoiceQueueId':{'type':Sequelize[_0xdbbb('0x4')],'unique':_0xdbbb('0x5')}}; \ No newline at end of file +var _0x67d1=['INTEGER','moment','sequelize','exports','STRING','contactListQueue'];(function(_0x41cd12,_0x3b5de6){var _0x177f59=function(_0xdcba87){while(--_0xdcba87){_0x41cd12['push'](_0x41cd12['shift']());}};_0x177f59(++_0x3b5de6);}(_0x67d1,0xdf));var _0x167d=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x67d1[_0x27af45];return _0x18df21;};'use strict';var moment=require(_0x167d('0x0'));var Sequelize=require(_0x167d('0x1'));module[_0x167d('0x2')]={'phone':{'type':Sequelize[_0x167d('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x167d('0x4')},'ListId':{'type':Sequelize[_0x167d('0x5')],'unique':_0x167d('0x4')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 6c8daea..2b1f416 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 _0x2d8f=['model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch','params','rawAttributes','fields','includeAll','find','body','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','update','then','error','stack','name','map','CmHopperBlack','fieldName','type','key'];(function(_0x4c6d6f,_0x291557){var _0x2d4478=function(_0x106946){while(--_0x106946){_0x4c6d6f['push'](_0x4c6d6f['shift']());}};_0x2d4478(++_0x291557);}(_0x2d8f,0x140));var _0xf2d8=function(_0xf230c7,_0x50fb7c){_0xf230c7=_0xf230c7-0x0;var _0x5a47f6=_0x2d8f[_0xf230c7];return _0x5a47f6;};'use strict';var emlformat=require(_0xf2d8('0x0'));var rimraf=require(_0xf2d8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf2d8('0x2'));var rp=require(_0xf2d8('0x3'));var moment=require('moment');var BPromise=require(_0xf2d8('0x4'));var Mustache=require(_0xf2d8('0x5'));var util=require(_0xf2d8('0x6'));var path=require(_0xf2d8('0x7'));var sox=require(_0xf2d8('0x8'));var csv=require('to-csv');var ejs=require(_0xf2d8('0x9'));var fs=require('fs');var fs_extra=require(_0xf2d8('0xa'));var _=require(_0xf2d8('0xb'));var squel=require(_0xf2d8('0xc'));var crypto=require('crypto');var jsforce=require(_0xf2d8('0xd'));var deskjs=require(_0xf2d8('0xe'));var toCsv=require(_0xf2d8('0xf'));var querystring=require(_0xf2d8('0x10'));var Papa=require(_0xf2d8('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf2d8('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf2d8('0x13'));var logger=require(_0xf2d8('0x14'))(_0xf2d8('0x15'));var utils=require(_0xf2d8('0x16'));var config=require(_0xf2d8('0x17'));var licenseUtil=require(_0xf2d8('0x18'));var db=require(_0xf2d8('0x19'))['db'];function respondWithStatusCode(_0x173f05,_0x52d6c0){_0x52d6c0=_0x52d6c0||0xcc;return function(_0x1de652){if(_0x1de652){return _0x173f05[_0xf2d8('0x1a')](_0x52d6c0);}return _0x173f05[_0xf2d8('0x1b')](_0x52d6c0)[_0xf2d8('0x1c')]();};}function respondWithResult(_0x508c25,_0x428443){_0x428443=_0x428443||0xc8;return function(_0x2eded6){if(_0x2eded6){return _0x508c25[_0xf2d8('0x1b')](_0x428443)[_0xf2d8('0x1d')](_0x2eded6);}};}function respondWithFilteredResult(_0x2b3b1b,_0x1c7869){return function(_0x4dbeb1){if(_0x4dbeb1){var _0x379d4d=typeof _0x1c7869[_0xf2d8('0x1e')]===_0xf2d8('0x1f')&&typeof _0x1c7869[_0xf2d8('0x20')]===_0xf2d8('0x1f');var _0x127f97=_0x4dbeb1[_0xf2d8('0x21')];var _0x20a3ab=_0x379d4d?0x0:_0x1c7869[_0xf2d8('0x1e')];var _0x2ebc84=_0x379d4d?_0x4dbeb1[_0xf2d8('0x21')]:_0x1c7869[_0xf2d8('0x1e')]+_0x1c7869[_0xf2d8('0x20')];var _0xf1a38d;if(_0x2ebc84>=_0x127f97){_0x2ebc84=_0x127f97;_0xf1a38d=0xc8;}else{_0xf1a38d=0xce;}_0x2b3b1b[_0xf2d8('0x1b')](_0xf1a38d);return _0x2b3b1b['set'](_0xf2d8('0x22'),_0x20a3ab+'-'+_0x2ebc84+'/'+_0x127f97)[_0xf2d8('0x1d')](_0x4dbeb1);}return null;};}function patchUpdates(_0x14eefd){return function(_0x131142){try{jsonpatch['apply'](_0x131142,_0x14eefd,!![]);}catch(_0x55499e){return BPromise['reject'](_0x55499e);}return _0x131142['save']();};}function saveUpdates(_0x447beb,_0x7c5ea9){return function(_0x5e7a9d){if(_0x5e7a9d){return _0x5e7a9d[_0xf2d8('0x23')](_0x447beb)[_0xf2d8('0x24')](function(_0xdded90){return _0xdded90;});}return null;};}function removeEntity(_0x38885f,_0x2bb4fb){return function(_0x419777){if(_0x419777){return _0x419777['destroy']()[_0xf2d8('0x24')](function(){_0x38885f[_0xf2d8('0x1b')](0xcc)[_0xf2d8('0x1c')]();});}};}function handleEntityNotFound(_0x4ea222,_0x34da2d){return function(_0x527451){if(!_0x527451){_0x4ea222[_0xf2d8('0x1a')](0x194);}return _0x527451;};}function handleError(_0x28f65d,_0x2ca743){_0x2ca743=_0x2ca743||0x1f4;return function(_0x51b6ba){logger[_0xf2d8('0x25')](_0x51b6ba[_0xf2d8('0x26')]);if(_0x51b6ba[_0xf2d8('0x27')]){delete _0x51b6ba['name'];}_0x28f65d[_0xf2d8('0x1b')](_0x2ca743)['send'](_0x51b6ba);};}exports['index']=function(_0x4987bb,_0x47b14a){var _0x23fa09={},_0x2ceedf={},_0x1ca5c8={'count':0x0,'rows':[]};var _0x106b98=_[_0xf2d8('0x28')](db[_0xf2d8('0x29')]['rawAttributes'],function(_0x221a68){return{'name':_0x221a68[_0xf2d8('0x2a')],'type':_0x221a68[_0xf2d8('0x2b')][_0xf2d8('0x2c')]};});_0x2ceedf[_0xf2d8('0x2d')]=_[_0xf2d8('0x28')](_0x106b98,_0xf2d8('0x27'));_0x2ceedf[_0xf2d8('0x2e')]=_[_0xf2d8('0x2f')](_0x4987bb[_0xf2d8('0x2e')]);_0x2ceedf['filters']=_[_0xf2d8('0x30')](_0x2ceedf[_0xf2d8('0x2d')],_0x2ceedf[_0xf2d8('0x2e')]);_0x23fa09['attributes']=_[_0xf2d8('0x30')](_0x2ceedf[_0xf2d8('0x2d')],qs['fields'](_0x4987bb[_0xf2d8('0x2e')]['fields']));_0x23fa09[_0xf2d8('0x31')]=_0x23fa09['attributes'][_0xf2d8('0x32')]?_0x23fa09[_0xf2d8('0x31')]:_0x2ceedf[_0xf2d8('0x2d')];if(!_0x4987bb['query'][_0xf2d8('0x33')](_0xf2d8('0x34'))){_0x23fa09[_0xf2d8('0x20')]=qs[_0xf2d8('0x20')](_0x4987bb[_0xf2d8('0x2e')][_0xf2d8('0x20')]);_0x23fa09[_0xf2d8('0x1e')]=qs[_0xf2d8('0x1e')](_0x4987bb[_0xf2d8('0x2e')]['offset']);}_0x23fa09[_0xf2d8('0x35')]=qs[_0xf2d8('0x36')](_0x4987bb['query']['sort']);_0x23fa09[_0xf2d8('0x37')]=qs[_0xf2d8('0x38')](_[_0xf2d8('0x39')](_0x4987bb[_0xf2d8('0x2e')],_0x2ceedf[_0xf2d8('0x38')]),_0x106b98);if(_0x4987bb['query']['filter']){_0x23fa09[_0xf2d8('0x37')]=_[_0xf2d8('0x3a')](_0x23fa09[_0xf2d8('0x37')],{'$or':_[_0xf2d8('0x28')](_0x106b98,function(_0x4da561){if(_0x4da561[_0xf2d8('0x2b')]!==_0xf2d8('0x3b')){var _0x4613a3={};_0x4613a3[_0x4da561['name']]={'$like':'%'+_0x4987bb[_0xf2d8('0x2e')][_0xf2d8('0x3c')]+'%'};return _0x4613a3;}})});}_0x23fa09=_[_0xf2d8('0x3a')]({},_0x23fa09,_0x4987bb[_0xf2d8('0x3d')]);var _0x4b386c={'where':_0x23fa09[_0xf2d8('0x37')]};return db[_0xf2d8('0x29')][_0xf2d8('0x21')](_0x4b386c)['then'](function(_0x161ff6){_0x1ca5c8[_0xf2d8('0x21')]=_0x161ff6;if(_0x4987bb[_0xf2d8('0x2e')]['includeAll']){_0x23fa09[_0xf2d8('0x3e')]=[{'all':!![]}];}return db[_0xf2d8('0x29')][_0xf2d8('0x3f')](_0x23fa09);})['then'](function(_0x70d39a){_0x1ca5c8[_0xf2d8('0x40')]=_0x70d39a;return _0x1ca5c8;})[_0xf2d8('0x24')](respondWithFilteredResult(_0x47b14a,_0x23fa09))[_0xf2d8('0x41')](handleError(_0x47b14a,null));};exports['show']=function(_0x894f68,_0x47aefc){var _0x550f5a={'raw':!![],'where':{'id':_0x894f68[_0xf2d8('0x42')]['id']}},_0x445dd2={};_0x445dd2[_0xf2d8('0x2d')]=_[_0xf2d8('0x2f')](db[_0xf2d8('0x29')][_0xf2d8('0x43')]);_0x445dd2[_0xf2d8('0x2e')]=_[_0xf2d8('0x2f')](_0x894f68[_0xf2d8('0x2e')]);_0x445dd2[_0xf2d8('0x38')]=_[_0xf2d8('0x30')](_0x445dd2[_0xf2d8('0x2d')],_0x445dd2[_0xf2d8('0x2e')]);_0x550f5a[_0xf2d8('0x31')]=_['intersection'](_0x445dd2[_0xf2d8('0x2d')],qs[_0xf2d8('0x44')](_0x894f68[_0xf2d8('0x2e')]['fields']));_0x550f5a[_0xf2d8('0x31')]=_0x550f5a[_0xf2d8('0x31')][_0xf2d8('0x32')]?_0x550f5a[_0xf2d8('0x31')]:_0x445dd2[_0xf2d8('0x2d')];if(_0x894f68['query'][_0xf2d8('0x45')]){_0x550f5a[_0xf2d8('0x3e')]=[{'all':!![]}];}_0x550f5a=_[_0xf2d8('0x3a')]({},_0x550f5a,_0x894f68['options']);return db['CmHopperBlack'][_0xf2d8('0x46')](_0x550f5a)[_0xf2d8('0x24')](handleEntityNotFound(_0x47aefc,null))[_0xf2d8('0x24')](respondWithResult(_0x47aefc,null))[_0xf2d8('0x41')](handleError(_0x47aefc,null));};exports[_0xf2d8('0x23')]=function(_0x2aaed8,_0x4488c1){if(_0x2aaed8[_0xf2d8('0x47')]['id']){delete _0x2aaed8[_0xf2d8('0x47')]['id'];}return db[_0xf2d8('0x29')][_0xf2d8('0x46')]({'where':{'id':_0x2aaed8[_0xf2d8('0x42')]['id']}})[_0xf2d8('0x24')](handleEntityNotFound(_0x4488c1,null))[_0xf2d8('0x24')](saveUpdates(_0x2aaed8[_0xf2d8('0x47')],null))[_0xf2d8('0x24')](respondWithResult(_0x4488c1,null))[_0xf2d8('0x41')](handleError(_0x4488c1,null));};exports['destroy']=function(_0x280761,_0x4b5932){return db['CmHopperBlack']['find']({'where':{'id':_0x280761[_0xf2d8('0x42')]['id']}})['then'](handleEntityNotFound(_0x4b5932,null))[_0xf2d8('0x24')](removeEntity(_0x4b5932,null))[_0xf2d8('0x41')](handleError(_0x4b5932,null));};exports[_0xf2d8('0x48')]=function(_0x349951,_0xb0b768){return db[_0xf2d8('0x29')][_0xf2d8('0x48')]()[_0xf2d8('0x24')](respondWithResult(_0xb0b768,null))['catch'](handleError(_0xb0b768,null));}; \ No newline at end of file +var _0xe375=['jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','name','send','index','map','rawAttributes','type','key','keys','query','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','filter','merge','options','CmHopperBlack','includeAll','include','findAll','catch','params','length','find','body','describe','eml-format','rimraf','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x47c5d9,_0xbcc612){var _0x198c60=function(_0x3263d4){while(--_0x3263d4){_0x47c5d9['push'](_0x47c5d9['shift']());}};_0x198c60(++_0xbcc612);}(_0xe375,0x7e));var _0x5e37=function(_0x333617,_0x275a5e){_0x333617=_0x333617-0x0;var _0x4c3d69=_0xe375[_0x333617];return _0x4c3d69;};'use strict';var emlformat=require(_0x5e37('0x0'));var rimraf=require(_0x5e37('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5e37('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5e37('0x3'));var path=require(_0x5e37('0x4'));var sox=require(_0x5e37('0x5'));var csv=require(_0x5e37('0x6'));var ejs=require(_0x5e37('0x7'));var fs=require('fs');var fs_extra=require(_0x5e37('0x8'));var _=require(_0x5e37('0x9'));var squel=require(_0x5e37('0xa'));var crypto=require(_0x5e37('0xb'));var jsforce=require(_0x5e37('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5e37('0xd'));var Papa=require(_0x5e37('0xe'));var Redis=require('ioredis');var authService=require(_0x5e37('0xf'));var qs=require(_0x5e37('0x10'));var as=require(_0x5e37('0x11'));var hardwareService=require(_0x5e37('0x12'));var logger=require(_0x5e37('0x13'))('api');var utils=require(_0x5e37('0x14'));var config=require(_0x5e37('0x15'));var licenseUtil=require(_0x5e37('0x16'));var db=require(_0x5e37('0x17'))['db'];function respondWithStatusCode(_0x38b53a,_0x337669){_0x337669=_0x337669||0xcc;return function(_0x430e0f){if(_0x430e0f){return _0x38b53a['sendStatus'](_0x337669);}return _0x38b53a['status'](_0x337669)[_0x5e37('0x18')]();};}function respondWithResult(_0x37667a,_0x307e0f){_0x307e0f=_0x307e0f||0xc8;return function(_0xde205b){if(_0xde205b){return _0x37667a[_0x5e37('0x19')](_0x307e0f)[_0x5e37('0x1a')](_0xde205b);}};}function respondWithFilteredResult(_0x557854,_0x9c17ac){return function(_0x302095){if(_0x302095){var _0x152d5f=typeof _0x9c17ac['offset']===_0x5e37('0x1b')&&typeof _0x9c17ac['limit']==='undefined';var _0x490fab=_0x302095[_0x5e37('0x1c')];var _0x152d96=_0x152d5f?0x0:_0x9c17ac[_0x5e37('0x1d')];var _0xc4405c=_0x152d5f?_0x302095['count']:_0x9c17ac[_0x5e37('0x1d')]+_0x9c17ac[_0x5e37('0x1e')];var _0x566e11;if(_0xc4405c>=_0x490fab){_0xc4405c=_0x490fab;_0x566e11=0xc8;}else{_0x566e11=0xce;}_0x557854[_0x5e37('0x19')](_0x566e11);return _0x557854[_0x5e37('0x1f')](_0x5e37('0x20'),_0x152d96+'-'+_0xc4405c+'/'+_0x490fab)[_0x5e37('0x1a')](_0x302095);}return null;};}function patchUpdates(_0x55ce05){return function(_0x455312){try{jsonpatch[_0x5e37('0x21')](_0x455312,_0x55ce05,!![]);}catch(_0x370448){return BPromise[_0x5e37('0x22')](_0x370448);}return _0x455312['save']();};}function saveUpdates(_0x180b1d,_0x2e99c1){return function(_0x23518b){if(_0x23518b){return _0x23518b[_0x5e37('0x23')](_0x180b1d)[_0x5e37('0x24')](function(_0x46c161){return _0x46c161;});}return null;};}function removeEntity(_0x57634a,_0x10314d){return function(_0x5c937a){if(_0x5c937a){return _0x5c937a[_0x5e37('0x25')]()['then'](function(){_0x57634a['status'](0xcc)[_0x5e37('0x18')]();});}};}function handleEntityNotFound(_0x18b8a0,_0x504518){return function(_0x692aec){if(!_0x692aec){_0x18b8a0['sendStatus'](0x194);}return _0x692aec;};}function handleError(_0x92424c,_0x5a11c0){_0x5a11c0=_0x5a11c0||0x1f4;return function(_0x1eb73f){logger['error'](_0x1eb73f['stack']);if(_0x1eb73f[_0x5e37('0x26')]){delete _0x1eb73f['name'];}_0x92424c[_0x5e37('0x19')](_0x5a11c0)[_0x5e37('0x27')](_0x1eb73f);};}exports[_0x5e37('0x28')]=function(_0x4a32cd,_0x3a97da){var _0x42fb4e={},_0x3fa561={},_0x4c26ee={'count':0x0,'rows':[]};var _0xa15e64=_[_0x5e37('0x29')](db['CmHopperBlack'][_0x5e37('0x2a')],function(_0x5d36b3){return{'name':_0x5d36b3['fieldName'],'type':_0x5d36b3[_0x5e37('0x2b')][_0x5e37('0x2c')]};});_0x3fa561['model']=_['map'](_0xa15e64,_0x5e37('0x26'));_0x3fa561['query']=_[_0x5e37('0x2d')](_0x4a32cd[_0x5e37('0x2e')]);_0x3fa561[_0x5e37('0x2f')]=_['intersection'](_0x3fa561[_0x5e37('0x30')],_0x3fa561[_0x5e37('0x2e')]);_0x42fb4e[_0x5e37('0x31')]=_[_0x5e37('0x32')](_0x3fa561[_0x5e37('0x30')],qs['fields'](_0x4a32cd[_0x5e37('0x2e')][_0x5e37('0x33')]));_0x42fb4e['attributes']=_0x42fb4e[_0x5e37('0x31')]['length']?_0x42fb4e[_0x5e37('0x31')]:_0x3fa561[_0x5e37('0x30')];if(!_0x4a32cd[_0x5e37('0x2e')][_0x5e37('0x34')](_0x5e37('0x35'))){_0x42fb4e[_0x5e37('0x1e')]=qs[_0x5e37('0x1e')](_0x4a32cd[_0x5e37('0x2e')]['limit']);_0x42fb4e[_0x5e37('0x1d')]=qs['offset'](_0x4a32cd['query'][_0x5e37('0x1d')]);}_0x42fb4e['order']=qs['sort'](_0x4a32cd[_0x5e37('0x2e')][_0x5e37('0x36')]);_0x42fb4e[_0x5e37('0x37')]=qs['filters'](_['pick'](_0x4a32cd['query'],_0x3fa561['filters']),_0xa15e64);if(_0x4a32cd[_0x5e37('0x2e')][_0x5e37('0x38')]){_0x42fb4e[_0x5e37('0x37')]=_['merge'](_0x42fb4e['where'],{'$or':_['map'](_0xa15e64,function(_0xa1b4c2){if(_0xa1b4c2[_0x5e37('0x2b')]!=='VIRTUAL'){var _0x602be9={};_0x602be9[_0xa1b4c2[_0x5e37('0x26')]]={'$like':'%'+_0x4a32cd['query'][_0x5e37('0x38')]+'%'};return _0x602be9;}})});}_0x42fb4e=_[_0x5e37('0x39')]({},_0x42fb4e,_0x4a32cd[_0x5e37('0x3a')]);var _0x1de4d7={'where':_0x42fb4e[_0x5e37('0x37')]};return db[_0x5e37('0x3b')][_0x5e37('0x1c')](_0x1de4d7)[_0x5e37('0x24')](function(_0x2e128d){_0x4c26ee['count']=_0x2e128d;if(_0x4a32cd[_0x5e37('0x2e')][_0x5e37('0x3c')]){_0x42fb4e[_0x5e37('0x3d')]=[{'all':!![]}];}return db[_0x5e37('0x3b')][_0x5e37('0x3e')](_0x42fb4e);})[_0x5e37('0x24')](function(_0xcda16a){_0x4c26ee['rows']=_0xcda16a;return _0x4c26ee;})[_0x5e37('0x24')](respondWithFilteredResult(_0x3a97da,_0x42fb4e))[_0x5e37('0x3f')](handleError(_0x3a97da,null));};exports['show']=function(_0x4d9869,_0x5a1341){var _0x20926a={'raw':!![],'where':{'id':_0x4d9869[_0x5e37('0x40')]['id']}},_0x4c8764={};_0x4c8764[_0x5e37('0x30')]=_[_0x5e37('0x2d')](db['CmHopperBlack']['rawAttributes']);_0x4c8764['query']=_['keys'](_0x4d9869[_0x5e37('0x2e')]);_0x4c8764[_0x5e37('0x2f')]=_[_0x5e37('0x32')](_0x4c8764[_0x5e37('0x30')],_0x4c8764[_0x5e37('0x2e')]);_0x20926a[_0x5e37('0x31')]=_[_0x5e37('0x32')](_0x4c8764[_0x5e37('0x30')],qs[_0x5e37('0x33')](_0x4d9869['query'][_0x5e37('0x33')]));_0x20926a['attributes']=_0x20926a[_0x5e37('0x31')][_0x5e37('0x41')]?_0x20926a[_0x5e37('0x31')]:_0x4c8764[_0x5e37('0x30')];if(_0x4d9869[_0x5e37('0x2e')][_0x5e37('0x3c')]){_0x20926a['include']=[{'all':!![]}];}_0x20926a=_[_0x5e37('0x39')]({},_0x20926a,_0x4d9869['options']);return db['CmHopperBlack'][_0x5e37('0x42')](_0x20926a)[_0x5e37('0x24')](handleEntityNotFound(_0x5a1341,null))[_0x5e37('0x24')](respondWithResult(_0x5a1341,null))[_0x5e37('0x3f')](handleError(_0x5a1341,null));};exports[_0x5e37('0x23')]=function(_0x3e1c65,_0x39fa4a){if(_0x3e1c65[_0x5e37('0x43')]['id']){delete _0x3e1c65[_0x5e37('0x43')]['id'];}return db[_0x5e37('0x3b')][_0x5e37('0x42')]({'where':{'id':_0x3e1c65[_0x5e37('0x40')]['id']}})[_0x5e37('0x24')](handleEntityNotFound(_0x39fa4a,null))[_0x5e37('0x24')](saveUpdates(_0x3e1c65[_0x5e37('0x43')],null))[_0x5e37('0x24')](respondWithResult(_0x39fa4a,null))['catch'](handleError(_0x39fa4a,null));};exports[_0x5e37('0x25')]=function(_0x5eae88,_0x19208d){return db[_0x5e37('0x3b')][_0x5e37('0x42')]({'where':{'id':_0x5eae88[_0x5e37('0x40')]['id']}})[_0x5e37('0x24')](handleEntityNotFound(_0x19208d,null))[_0x5e37('0x24')](removeEntity(_0x19208d,null))[_0x5e37('0x3f')](handleError(_0x19208d,null));};exports[_0x5e37('0x44')]=function(_0x1ec93c,_0x345970){return db[_0x5e37('0x3b')][_0x5e37('0x44')]()[_0x5e37('0x24')](respondWithResult(_0x345970,null))[_0x5e37('0x3f')](handleError(_0x345970,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 76049f4..014c0c3 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 _0x817b=['rimraf','../../config/environment','./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black','../../config/logger','api','moment'];(function(_0x5aa17c,_0x5892b1){var _0x1d886b=function(_0x2f5bf7){while(--_0x2f5bf7){_0x5aa17c['push'](_0x5aa17c['shift']());}};_0x1d886b(++_0x5892b1);}(_0x817b,0x165));var _0xb817=function(_0x556745,_0x4f66fe){_0x556745=_0x556745-0x0;var _0x440901=_0x817b[_0x556745];return _0x440901;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb817('0x0'))(_0xb817('0x1'));var moment=require(_0xb817('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb817('0x3'));var config=require(_0xb817('0x4'));var attributes=require(_0xb817('0x5'));module[_0xb817('0x6')]=function(_0x451b92,_0x2f407c){return _0x451b92[_0xb817('0x7')](_0xb817('0x8'),attributes,{'tableName':_0xb817('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3ab3=['CmHopperBlack','cm_hopper_black','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperBlack.attributes','exports'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x3ab3,0x1ee));var _0x33ab=function(_0x31dde9,_0x12e816){_0x31dde9=_0x31dde9-0x0;var _0x1fbf2d=_0x3ab3[_0x31dde9];return _0x1fbf2d;};'use strict';var _=require('lodash');var util=require(_0x33ab('0x0'));var logger=require(_0x33ab('0x1'))(_0x33ab('0x2'));var moment=require('moment');var BPromise=require(_0x33ab('0x3'));var rp=require(_0x33ab('0x4'));var fs=require('fs');var path=require(_0x33ab('0x5'));var rimraf=require(_0x33ab('0x6'));var config=require(_0x33ab('0x7'));var attributes=require(_0x33ab('0x8'));module[_0x33ab('0x9')]=function(_0x3dd30f,_0x57a92){return _0x3dd30f['define'](_0x33ab('0xa'),attributes,{'tableName':_0x33ab('0xb'),'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 fa80af0..3ddd1db 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 _0x5264=['attributes','limit','include','map','model','then','UpdateCmHopperBlack','update','body','DestroyCmHopperBlack','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','client','request','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetCmHopperBlack','CmHopperBlack','options','raw','where'];(function(_0x4ef3fb,_0x5a124d){var _0x5a1bb8=function(_0x2ab120){while(--_0x2ab120){_0x4ef3fb['push'](_0x4ef3fb['shift']());}};_0x5a1bb8(++_0x5a124d);}(_0x5264,0xbe));var _0x4526=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x5264[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x4526('0x0'));var util=require(_0x4526('0x1'));var moment=require(_0x4526('0x2'));var BPromise=require(_0x4526('0x3'));var rs=require(_0x4526('0x4'));var fs=require('fs');var Redis=require(_0x4526('0x5'));var db=require(_0x4526('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4526('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4526('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5947cb,_0x4caa0e,_0x69266b){return new BPromise(function(_0x2ca651,_0x55ad29){return client[_0x4526('0x9')](_0x5947cb,_0x69266b)['then'](function(_0x3f3fa6){logger['info'](_0x4526('0xa'),_0x4caa0e,_0x4526('0xb'));logger[_0x4526('0xc')](_0x4526('0xd'),_0x4caa0e,_0x4526('0xb'),JSON[_0x4526('0xe')](_0x3f3fa6));if(_0x3f3fa6[_0x4526('0xf')]){if(_0x3f3fa6['error'][_0x4526('0x10')]===0x1f4){logger[_0x4526('0xf')](_0x4526('0xa'),_0x4caa0e,_0x3f3fa6[_0x4526('0xf')][_0x4526('0x11')]);return _0x55ad29(_0x3f3fa6[_0x4526('0xf')][_0x4526('0x11')]);}logger[_0x4526('0xf')](_0x4526('0xa'),_0x4caa0e,_0x3f3fa6[_0x4526('0xf')]['message']);return _0x2ca651(_0x3f3fa6[_0x4526('0xf')][_0x4526('0x11')]);}else{logger[_0x4526('0x12')]('CmHopperBlack,\x20%s,\x20%s',_0x4caa0e,_0x4526('0xb'));_0x2ca651(_0x3f3fa6[_0x4526('0x13')][_0x4526('0x11')]);}})[_0x4526('0x14')](function(_0x566e36){logger['error'](_0x4526('0xa'),_0x4caa0e,_0x566e36);_0x55ad29(_0x566e36);});});}exports[_0x4526('0x15')]=function(_0x2236c7){var _0x4750a9=this;return new Promise(function(_0x2a1f9c,_0x1e474b){return db[_0x4526('0x16')]['findAll']({'raw':_0x2236c7[_0x4526('0x17')]?_0x2236c7[_0x4526('0x17')][_0x4526('0x18')]===undefined?!![]:![]:!![],'where':_0x2236c7[_0x4526('0x17')]?_0x2236c7[_0x4526('0x17')][_0x4526('0x19')]||null:null,'attributes':_0x2236c7[_0x4526('0x17')]?_0x2236c7['options'][_0x4526('0x1a')]||null:null,'limit':_0x2236c7[_0x4526('0x17')]?_0x2236c7[_0x4526('0x17')][_0x4526('0x1b')]||null:null,'include':_0x2236c7[_0x4526('0x17')]?_0x2236c7[_0x4526('0x17')]['include']?_['map'](_0x2236c7[_0x4526('0x17')][_0x4526('0x1c')],function(_0x20c369){return{'model':db[_0x20c369['model']],'as':_0x20c369['as'],'attributes':_0x20c369[_0x4526('0x1a')],'include':_0x20c369[_0x4526('0x1c')]?_[_0x4526('0x1d')](_0x20c369[_0x4526('0x1c')],function(_0x4a7b7c){return{'model':db[_0x4a7b7c[_0x4526('0x1e')]],'as':_0x4a7b7c['as'],'attributes':_0x4a7b7c[_0x4526('0x1a')],'include':_0x4a7b7c[_0x4526('0x1c')]?_[_0x4526('0x1d')](_0x4a7b7c[_0x4526('0x1c')],function(_0x2cbbf3){return{'model':db[_0x2cbbf3[_0x4526('0x1e')]],'as':_0x2cbbf3['as'],'attributes':_0x2cbbf3['attributes']};}):[]};}):[]};}):[]:[]})[_0x4526('0x1f')](function(_0x30b235){logger[_0x4526('0x12')](_0x4526('0x15'),_0x2236c7);logger[_0x4526('0xc')](_0x4526('0x15'),_0x2236c7,JSON[_0x4526('0xe')](_0x30b235));_0x2a1f9c(_0x30b235);})['catch'](function(_0x55efaa){logger['error'](_0x4526('0x15'),_0x55efaa[_0x4526('0x11')],_0x2236c7);_0x1e474b(_0x4750a9[_0x4526('0xf')](0x1f4,_0x55efaa[_0x4526('0x11')]));});});};exports[_0x4526('0x20')]=function(_0x219fb4){var _0x2a3fef=this;return new Promise(function(_0x59e314,_0x4890ae){return db['CmHopperBlack'][_0x4526('0x21')](_0x219fb4[_0x4526('0x22')],{'raw':_0x219fb4[_0x4526('0x17')]?_0x219fb4[_0x4526('0x17')][_0x4526('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x219fb4['options']?_0x219fb4[_0x4526('0x17')][_0x4526('0x19')]||null:null,'attributes':_0x219fb4[_0x4526('0x17')]?_0x219fb4[_0x4526('0x17')][_0x4526('0x1a')]||null:null,'limit':_0x219fb4[_0x4526('0x17')]?_0x219fb4[_0x4526('0x17')][_0x4526('0x1b')]||null:null})[_0x4526('0x1f')](function(_0xd6beb6){logger[_0x4526('0x12')](_0x4526('0x20'),_0x219fb4);logger['debug'](_0x4526('0x20'),_0x219fb4,JSON['stringify'](_0xd6beb6));_0x59e314(_0xd6beb6);})[_0x4526('0x14')](function(_0x669939){logger[_0x4526('0xf')](_0x4526('0x20'),_0x669939[_0x4526('0x11')],_0x219fb4);_0x4890ae(_0x2a3fef[_0x4526('0xf')](0x1f4,_0x669939[_0x4526('0x11')]));});});};exports['DestroyCmHopperBlack']=function(_0x100997){var _0x25bf87=this;return new Promise(function(_0x22cafa,_0x107a13){return db[_0x4526('0x16')]['destroy']({'where':_0x100997['options']?_0x100997[_0x4526('0x17')][_0x4526('0x19')]||null:null})[_0x4526('0x1f')](function(_0x3c0815){logger['info'](_0x4526('0x23'),_0x100997);logger['debug']('DestroyCmHopperBlack',_0x100997,JSON[_0x4526('0xe')](_0x3c0815));_0x22cafa(_0x3c0815);})[_0x4526('0x14')](function(_0x1d70c5){logger[_0x4526('0xf')]('DestroyCmHopperBlack',_0x1d70c5[_0x4526('0x11')],_0x100997);_0x107a13(_0x25bf87[_0x4526('0xf')](0x1f4,_0x1d70c5[_0x4526('0x11')]));});});}; \ No newline at end of file +var _0xeacb=['randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','then','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetCmHopperBlack','findAll','options','raw','where','attributes','limit','include','map','model','UpdateCmHopperBlack','CmHopperBlack','update','destroy','DestroyCmHopperBlack','lodash','util','moment','bluebird'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xeacb,0x1a9));var _0xbeac=function(_0x51b4e3,_0x2f06c3){_0x51b4e3=_0x51b4e3-0x0;var _0x183070=_0xeacb[_0x51b4e3];return _0x183070;};'use strict';var _=require(_0xbeac('0x0'));var util=require(_0xbeac('0x1'));var moment=require(_0xbeac('0x2'));var BPromise=require(_0xbeac('0x3'));var rs=require(_0xbeac('0x4'));var fs=require('fs');var Redis=require(_0xbeac('0x5'));var db=require(_0xbeac('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xbeac('0x7'));var config=require(_0xbeac('0x8'));var jayson=require(_0xbeac('0x9'));var client=jayson[_0xbeac('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x435e63,_0x59dd0b,_0x550bd7){return new BPromise(function(_0x3ba3f6,_0x53e7c9){return client[_0xbeac('0xb')](_0x435e63,_0x550bd7)[_0xbeac('0xc')](function(_0x32c425){logger['info'](_0xbeac('0xd'),_0x59dd0b,_0xbeac('0xe'));logger[_0xbeac('0xf')](_0xbeac('0x10'),_0x59dd0b,_0xbeac('0xe'),JSON[_0xbeac('0x11')](_0x32c425));if(_0x32c425[_0xbeac('0x12')]){if(_0x32c425[_0xbeac('0x12')][_0xbeac('0x13')]===0x1f4){logger['error'](_0xbeac('0xd'),_0x59dd0b,_0x32c425[_0xbeac('0x12')][_0xbeac('0x14')]);return _0x53e7c9(_0x32c425[_0xbeac('0x12')][_0xbeac('0x14')]);}logger[_0xbeac('0x12')](_0xbeac('0xd'),_0x59dd0b,_0x32c425[_0xbeac('0x12')][_0xbeac('0x14')]);return _0x3ba3f6(_0x32c425[_0xbeac('0x12')][_0xbeac('0x14')]);}else{logger[_0xbeac('0x15')](_0xbeac('0xd'),_0x59dd0b,'request\x20sent');_0x3ba3f6(_0x32c425[_0xbeac('0x16')]['message']);}})[_0xbeac('0x17')](function(_0x3220e6){logger[_0xbeac('0x12')](_0xbeac('0xd'),_0x59dd0b,_0x3220e6);_0x53e7c9(_0x3220e6);});});}exports[_0xbeac('0x18')]=function(_0x59af87){var _0x15e7ae=this;return new Promise(function(_0x44c769,_0x5bb8e2){return db['CmHopperBlack'][_0xbeac('0x19')]({'raw':_0x59af87[_0xbeac('0x1a')]?_0x59af87[_0xbeac('0x1a')][_0xbeac('0x1b')]===undefined?!![]:![]:!![],'where':_0x59af87[_0xbeac('0x1a')]?_0x59af87[_0xbeac('0x1a')][_0xbeac('0x1c')]||null:null,'attributes':_0x59af87[_0xbeac('0x1a')]?_0x59af87[_0xbeac('0x1a')][_0xbeac('0x1d')]||null:null,'limit':_0x59af87[_0xbeac('0x1a')]?_0x59af87[_0xbeac('0x1a')][_0xbeac('0x1e')]||null:null,'include':_0x59af87['options']?_0x59af87[_0xbeac('0x1a')][_0xbeac('0x1f')]?_[_0xbeac('0x20')](_0x59af87['options'][_0xbeac('0x1f')],function(_0x5a9ca3){return{'model':db[_0x5a9ca3[_0xbeac('0x21')]],'as':_0x5a9ca3['as'],'attributes':_0x5a9ca3[_0xbeac('0x1d')],'include':_0x5a9ca3[_0xbeac('0x1f')]?_[_0xbeac('0x20')](_0x5a9ca3[_0xbeac('0x1f')],function(_0x567853){return{'model':db[_0x567853[_0xbeac('0x21')]],'as':_0x567853['as'],'attributes':_0x567853[_0xbeac('0x1d')],'include':_0x567853['include']?_[_0xbeac('0x20')](_0x567853[_0xbeac('0x1f')],function(_0x3b706e){return{'model':db[_0x3b706e[_0xbeac('0x21')]],'as':_0x3b706e['as'],'attributes':_0x3b706e['attributes']};}):[]};}):[]};}):[]:[]})[_0xbeac('0xc')](function(_0x30cb65){logger[_0xbeac('0x15')]('GetCmHopperBlack',_0x59af87);logger['debug']('GetCmHopperBlack',_0x59af87,JSON['stringify'](_0x30cb65));_0x44c769(_0x30cb65);})['catch'](function(_0x82cea7){logger['error'](_0xbeac('0x18'),_0x82cea7[_0xbeac('0x14')],_0x59af87);_0x5bb8e2(_0x15e7ae[_0xbeac('0x12')](0x1f4,_0x82cea7['message']));});});};exports[_0xbeac('0x22')]=function(_0x187482){var _0x5128ec=this;return new Promise(function(_0x2041d6,_0x15af33){return db[_0xbeac('0x23')][_0xbeac('0x24')](_0x187482['body'],{'raw':_0x187482[_0xbeac('0x1a')]?_0x187482[_0xbeac('0x1a')][_0xbeac('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x187482[_0xbeac('0x1a')]?_0x187482[_0xbeac('0x1a')]['where']||null:null,'attributes':_0x187482[_0xbeac('0x1a')]?_0x187482[_0xbeac('0x1a')][_0xbeac('0x1d')]||null:null,'limit':_0x187482[_0xbeac('0x1a')]?_0x187482[_0xbeac('0x1a')]['limit']||null:null})['then'](function(_0x2075bf){logger[_0xbeac('0x15')](_0xbeac('0x22'),_0x187482);logger[_0xbeac('0xf')]('UpdateCmHopperBlack',_0x187482,JSON['stringify'](_0x2075bf));_0x2041d6(_0x2075bf);})[_0xbeac('0x17')](function(_0x35c003){logger[_0xbeac('0x12')](_0xbeac('0x22'),_0x35c003[_0xbeac('0x14')],_0x187482);_0x15af33(_0x5128ec[_0xbeac('0x12')](0x1f4,_0x35c003[_0xbeac('0x14')]));});});};exports['DestroyCmHopperBlack']=function(_0x4b2c26){var _0x124036=this;return new Promise(function(_0x297dee,_0x4b304e){return db[_0xbeac('0x23')][_0xbeac('0x25')]({'where':_0x4b2c26['options']?_0x4b2c26[_0xbeac('0x1a')][_0xbeac('0x1c')]||null:null})[_0xbeac('0xc')](function(_0x2e8ef8){logger[_0xbeac('0x15')](_0xbeac('0x26'),_0x4b2c26);logger['debug']('DestroyCmHopperBlack',_0x4b2c26,JSON[_0xbeac('0x11')](_0x2e8ef8));_0x297dee(_0x2e8ef8);})[_0xbeac('0x17')](function(_0x42113b){logger['error'](_0xbeac('0x26'),_0x42113b[_0xbeac('0x14')],_0x4b2c26);_0x4b304e(_0x124036['error'](0x1f4,_0x42113b['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 7511b27..956ed25 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 _0x9a5a=['put','/:id','update','delete','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','index','/describe','isAuthenticated','describe','show'];(function(_0x4a09b3,_0x348a2a){var _0x4e9967=function(_0x271824){while(--_0x271824){_0x4a09b3['push'](_0x4a09b3['shift']());}};_0x4e9967(++_0x348a2a);}(_0x9a5a,0x194));var _0xa9a5=function(_0x3aa04b,_0x203c8b){_0x3aa04b=_0x3aa04b-0x0;var _0x27e0c5=_0x9a5a[_0x3aa04b];return _0x27e0c5;};'use strict';var multer=require(_0xa9a5('0x0'));var util=require(_0xa9a5('0x1'));var path=require(_0xa9a5('0x2'));var timeout=require(_0xa9a5('0x3'));var express=require(_0xa9a5('0x4'));var router=express['Router']();var fs_extra=require(_0xa9a5('0x5'));var auth=require(_0xa9a5('0x6'));var interaction=require(_0xa9a5('0x7'));var config=require(_0xa9a5('0x8'));var controller=require(_0xa9a5('0x9'));router[_0xa9a5('0xa')]('/',auth['isAuthenticated'](),controller[_0xa9a5('0xb')]);router[_0xa9a5('0xa')](_0xa9a5('0xc'),auth[_0xa9a5('0xd')](),controller[_0xa9a5('0xe')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xa9a5('0xf')]);router[_0xa9a5('0x10')](_0xa9a5('0x11'),auth[_0xa9a5('0xd')](),controller[_0xa9a5('0x12')]);router[_0xa9a5('0x13')](_0xa9a5('0x11'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xd101=['update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','put'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xd101,0xc1));var _0x1d10=function(_0x516cb5,_0x37d386){_0x516cb5=_0x516cb5-0x0;var _0x1dce9d=_0xd101[_0x516cb5];return _0x1dce9d;};'use strict';var multer=require(_0x1d10('0x0'));var util=require('util');var path=require(_0x1d10('0x1'));var timeout=require(_0x1d10('0x2'));var express=require(_0x1d10('0x3'));var router=express[_0x1d10('0x4')]();var fs_extra=require(_0x1d10('0x5'));var auth=require(_0x1d10('0x6'));var interaction=require(_0x1d10('0x7'));var config=require(_0x1d10('0x8'));var controller=require('./cmHopperBlack.controller');router[_0x1d10('0x9')]('/',auth[_0x1d10('0xa')](),controller[_0x1d10('0xb')]);router[_0x1d10('0x9')](_0x1d10('0xc'),auth[_0x1d10('0xa')](),controller[_0x1d10('0xd')]);router[_0x1d10('0x9')](_0x1d10('0xe'),auth[_0x1d10('0xa')](),controller[_0x1d10('0xf')]);router[_0x1d10('0x10')](_0x1d10('0xe'),auth[_0x1d10('0xa')](),controller[_0x1d10('0x11')]);router[_0x1d10('0x12')](_0x1d10('0xe'),auth['isAuthenticated'](),controller[_0x1d10('0x13')]);module[_0x1d10('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index cb9fcad..23ba00d 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 _0x9a6d=['DATE','endtime','diff','seconds','BOOLEAN','sequelize','moment','exports','INTEGER','STRING'];(function(_0xe58e1a,_0x441052){var _0x5ccf80=function(_0x1f28fb){while(--_0x1f28fb){_0xe58e1a['push'](_0xe58e1a['shift']());}};_0x5ccf80(++_0x441052);}(_0x9a6d,0x131));var _0xd9a6=function(_0x459238,_0xfff5e7){_0x459238=_0x459238-0x0;var _0x541d65=_0x9a6d[_0x459238];return _0x541d65;};'use strict';var Sequelize=require(_0xd9a6('0x0'));var moment=require(_0xd9a6('0x1'));module[_0xd9a6('0x2')]={'state':{'type':Sequelize[_0xd9a6('0x3')](0x2)},'statedesc':{'type':Sequelize[_0xd9a6('0x4')]},'scheduledat':{'type':Sequelize[_0xd9a6('0x5')]},'countbusyretry':{'type':Sequelize[_0xd9a6('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0xd9a6('0x4')]},'originatecalleridname':{'type':Sequelize[_0xd9a6('0x4')]},'calleridnum':{'type':Sequelize[_0xd9a6('0x4')]},'calleridname':{'type':Sequelize[_0xd9a6('0x4')]},'starttime':{'type':Sequelize[_0xd9a6('0x5')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xd9a6('0x5')]},'droptime':{'type':Sequelize[_0xd9a6('0x5')]},'endtime':{'type':Sequelize[_0xd9a6('0x5')]},'ringtime':{'type':Sequelize[_0xd9a6('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xd9a6('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xd9a6('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xd9a6('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0xd9a6('0x4')]},'campaigntype':{'type':Sequelize[_0xd9a6('0x4')]},'membername':{'type':Sequelize[_0xd9a6('0x4')]},'reason':{'type':Sequelize[_0xd9a6('0x4')]},'disposition':{'type':Sequelize[_0xd9a6('0x4')]},'secondDisposition':{'type':Sequelize[_0xd9a6('0x4')]},'thirdDisposition':{'type':Sequelize[_0xd9a6('0x4')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x1050a8){var _0x3cf641=this['getDataValue'](_0xd9a6('0x6'));if(_0x3cf641&&_0x1050a8){this['setDataValue']('followuptime',moment(_0x1050a8)[_0xd9a6('0x7')](moment(_0x3cf641),_0xd9a6('0x8')));}}},'amd':{'type':Sequelize[_0xd9a6('0x9')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xd9a6('0x9')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xd9a6('0x9')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xd9a6('0x5')]},'callback':{'type':Sequelize[_0xd9a6('0x9')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xd9a6('0x5')]},'deleted':{'type':Sequelize[_0xd9a6('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xd9a6('0x5')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xd9a6('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0xd9a6('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xd9a6('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x440d=['diff','seconds','BOOLEAN','sequelize','exports','INTEGER','STRING','DATE','getDataValue','endtime','setDataValue','followuptime'];(function(_0x1f74b7,_0x25fb39){var _0x2cde03=function(_0x41c07b){while(--_0x41c07b){_0x1f74b7['push'](_0x1f74b7['shift']());}};_0x2cde03(++_0x25fb39);}(_0x440d,0x1e3));var _0xd440=function(_0x59e903,_0x303626){_0x59e903=_0x59e903-0x0;var _0x21e3f6=_0x440d[_0x59e903];return _0x21e3f6;};'use strict';var Sequelize=require(_0xd440('0x0'));var moment=require('moment');module[_0xd440('0x1')]={'state':{'type':Sequelize[_0xd440('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xd440('0x3')]},'scheduledat':{'type':Sequelize[_0xd440('0x4')]},'countbusyretry':{'type':Sequelize[_0xd440('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xd440('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xd440('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xd440('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0xd440('0x3')]},'calleridnum':{'type':Sequelize[_0xd440('0x3')]},'calleridname':{'type':Sequelize[_0xd440('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xd440('0x4')]},'droptime':{'type':Sequelize[_0xd440('0x4')]},'endtime':{'type':Sequelize[_0xd440('0x4')]},'ringtime':{'type':Sequelize[_0xd440('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xd440('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xd440('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xd440('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xd440('0x3')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xd440('0x3')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0xd440('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xd440('0x3')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0xcb2b22){var _0x321150=this[_0xd440('0x5')](_0xd440('0x6'));if(_0x321150&&_0xcb2b22){this[_0xd440('0x7')](_0xd440('0x8'),moment(_0xcb2b22)[_0xd440('0x9')](moment(_0x321150),_0xd440('0xa')));}}},'amd':{'type':Sequelize[_0xd440('0xb')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xd440('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xd440('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xd440('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0xd440('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xd440('0x4')]},'recallme':{'type':Sequelize[_0xd440('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0xd440('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xd440('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xd440('0x2')],'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 ba9e403..a4670f3 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 _0x2ef3=['params','keys','describe','uniqueid','body','find','countContactsQueueCampaignHopperFinal','sequelize','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','COUNT','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','countContactsIvrCampaignHopperFinal','noAnswerContacts','busyContacts','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','answeringMachine','VoiceQueue','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','createdAt','updatedAt','field','NOW()','VoiceQueueId','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','select','from','calleridnum','state\x20=\x204','group','Campaign','ListId','CampaignId','ANY_VALUE(calleridnum)','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','CampaignId\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','CmHopper','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','CmHopperFinal','then','includeAll','include','findAll','catch','show'];(function(_0x13d01b,_0x4782a5){var _0x23b996=function(_0x5ddd38){while(--_0x5ddd38){_0x13d01b['push'](_0x13d01b['shift']());}};_0x23b996(++_0x4782a5);}(_0x2ef3,0xba));var _0x32ef=function(_0x105abf,_0x268b5d){_0x105abf=_0x105abf-0x0;var _0x201ec0=_0x2ef3[_0x105abf];return _0x201ec0;};'use strict';var emlformat=require(_0x32ef('0x0'));var rimraf=require(_0x32ef('0x1'));var zipdir=require(_0x32ef('0x2'));var jsonpatch=require(_0x32ef('0x3'));var rp=require(_0x32ef('0x4'));var moment=require(_0x32ef('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x32ef('0x6'));var util=require(_0x32ef('0x7'));var path=require('path');var sox=require(_0x32ef('0x8'));var csv=require(_0x32ef('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0x9'));var querystring=require(_0x32ef('0xf'));var Papa=require(_0x32ef('0x10'));var Redis=require(_0x32ef('0x11'));var authService=require(_0x32ef('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x13'));var logger=require(_0x32ef('0x14'))(_0x32ef('0x15'));var utils=require(_0x32ef('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x32ef('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a5106,_0x49d590){_0x49d590=_0x49d590||0xcc;return function(_0x3e98df){if(_0x3e98df){return _0x1a5106[_0x32ef('0x18')](_0x49d590);}return _0x1a5106['status'](_0x49d590)['end']();};}function respondWithResult(_0x19ce1,_0x4d8009){_0x4d8009=_0x4d8009||0xc8;return function(_0x326fce){if(_0x326fce){return _0x19ce1[_0x32ef('0x19')](_0x4d8009)[_0x32ef('0x1a')](_0x326fce);}};}function respondWithFilteredResult(_0x54c7f5,_0x57aff1){return function(_0x55bf0b){if(_0x55bf0b){var _0x531e30=typeof _0x57aff1[_0x32ef('0x1b')]===_0x32ef('0x1c')&&typeof _0x57aff1[_0x32ef('0x1d')]==='undefined';var _0x5d559b=_0x55bf0b[_0x32ef('0x1e')];var _0x1a9476=_0x531e30?0x0:_0x57aff1[_0x32ef('0x1b')];var _0x57863c=_0x531e30?_0x55bf0b[_0x32ef('0x1e')]:_0x57aff1[_0x32ef('0x1b')]+_0x57aff1['limit'];var _0x304505;if(_0x57863c>=_0x5d559b){_0x57863c=_0x5d559b;_0x304505=0xc8;}else{_0x304505=0xce;}_0x54c7f5[_0x32ef('0x19')](_0x304505);return _0x54c7f5[_0x32ef('0x1f')](_0x32ef('0x20'),_0x1a9476+'-'+_0x57863c+'/'+_0x5d559b)[_0x32ef('0x1a')](_0x55bf0b);}return null;};}function patchUpdates(_0x3aec05){return function(_0x4de441){try{jsonpatch[_0x32ef('0x21')](_0x4de441,_0x3aec05,!![]);}catch(_0x5cc3ef){return BPromise[_0x32ef('0x22')](_0x5cc3ef);}return _0x4de441[_0x32ef('0x23')]();};}function saveUpdates(_0x49f2d8,_0x1af371){return function(_0x97780){if(_0x97780){return _0x97780[_0x32ef('0x24')](_0x49f2d8)['then'](function(_0x57f5e5){return _0x57f5e5;});}return null;};}function removeEntity(_0x22f2d7,_0xb30fab){return function(_0x225feb){if(_0x225feb){return _0x225feb['destroy']()['then'](function(){_0x22f2d7[_0x32ef('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51a412,_0x278495){return function(_0x14d4b3){if(!_0x14d4b3){_0x51a412[_0x32ef('0x18')](0x194);}return _0x14d4b3;};}function handleError(_0x1dbe98,_0x15ce54){_0x15ce54=_0x15ce54||0x1f4;return function(_0x234175){logger[_0x32ef('0x25')](_0x234175[_0x32ef('0x26')]);if(_0x234175[_0x32ef('0x27')]){delete _0x234175[_0x32ef('0x27')];}_0x1dbe98[_0x32ef('0x19')](_0x15ce54)[_0x32ef('0x28')](_0x234175);};}exports['index']=function(_0xd65fde,_0x2f5d06){var _0x5a04cd={},_0x12de1a={},_0x3c569d={'count':0x0,'rows':[]};var _0x30b250=_[_0x32ef('0x29')](db['CmHopperFinal'][_0x32ef('0x2a')],function(_0x22bf86){return{'name':_0x22bf86[_0x32ef('0x2b')],'type':_0x22bf86[_0x32ef('0x2c')][_0x32ef('0x2d')]};});_0x12de1a[_0x32ef('0x2e')]=_[_0x32ef('0x29')](_0x30b250,'name');_0x12de1a[_0x32ef('0x2f')]=_['keys'](_0xd65fde[_0x32ef('0x2f')]);_0x12de1a[_0x32ef('0x30')]=_['intersection'](_0x12de1a[_0x32ef('0x2e')],_0x12de1a[_0x32ef('0x2f')]);_0x5a04cd[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x12de1a[_0x32ef('0x2e')],qs['fields'](_0xd65fde['query'][_0x32ef('0x33')]));_0x5a04cd['attributes']=_0x5a04cd[_0x32ef('0x31')][_0x32ef('0x34')]?_0x5a04cd[_0x32ef('0x31')]:_0x12de1a[_0x32ef('0x2e')];if(!_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x35')]('nolimit')){_0x5a04cd['limit']=qs['limit'](_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x1d')]);_0x5a04cd[_0x32ef('0x1b')]=qs['offset'](_0xd65fde['query'][_0x32ef('0x1b')]);}_0x5a04cd[_0x32ef('0x36')]=qs[_0x32ef('0x37')](_0xd65fde['query']['sort']);_0x5a04cd[_0x32ef('0x38')]=qs[_0x32ef('0x30')](_[_0x32ef('0x39')](_0xd65fde[_0x32ef('0x2f')],_0x12de1a[_0x32ef('0x30')]),_0x30b250);if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]){_0x5a04cd[_0x32ef('0x38')]=_[_0x32ef('0x3b')](_0x5a04cd['where'],{'$or':_[_0x32ef('0x29')](_0x30b250,function(_0x36e374){if(_0x36e374[_0x32ef('0x2c')]!=='VIRTUAL'){var _0x365125={};_0x365125[_0x36e374[_0x32ef('0x27')]]={'$like':'%'+_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]+'%'};return _0x365125;}})});}_0x5a04cd=_[_0x32ef('0x3b')]({},_0x5a04cd,_0xd65fde[_0x32ef('0x3c')]);var _0x256c40={'where':_0x5a04cd[_0x32ef('0x38')]};return db[_0x32ef('0x3d')][_0x32ef('0x1e')](_0x256c40)[_0x32ef('0x3e')](function(_0x4615b4){_0x3c569d['count']=_0x4615b4;if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5a04cd[_0x32ef('0x40')]=[{'all':!![]}];}return db[_0x32ef('0x3d')][_0x32ef('0x41')](_0x5a04cd);})[_0x32ef('0x3e')](function(_0x3c0e44){_0x3c569d['rows']=_0x3c0e44;return _0x3c569d;})['then'](respondWithFilteredResult(_0x2f5d06,_0x5a04cd))[_0x32ef('0x42')](handleError(_0x2f5d06,null));};exports[_0x32ef('0x43')]=function(_0x2a33dd,_0x765c63){var _0x5dca14={'raw':!![],'where':{'id':_0x2a33dd[_0x32ef('0x44')]['id']}},_0x2901a1={};_0x2901a1['model']=_[_0x32ef('0x45')](db['CmHopperFinal'][_0x32ef('0x2a')]);_0x2901a1[_0x32ef('0x2f')]=_[_0x32ef('0x45')](_0x2a33dd[_0x32ef('0x2f')]);_0x2901a1[_0x32ef('0x30')]=_[_0x32ef('0x32')](_0x2901a1[_0x32ef('0x2e')],_0x2901a1[_0x32ef('0x2f')]);_0x5dca14[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x2901a1['model'],qs[_0x32ef('0x33')](_0x2a33dd['query'][_0x32ef('0x33')]));_0x5dca14[_0x32ef('0x31')]=_0x5dca14[_0x32ef('0x31')]['length']?_0x5dca14[_0x32ef('0x31')]:_0x2901a1[_0x32ef('0x2e')];if(_0x2a33dd[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5dca14[_0x32ef('0x40')]=[{'all':!![]}];}_0x5dca14=_[_0x32ef('0x3b')]({},_0x5dca14,_0x2a33dd[_0x32ef('0x3c')]);return db['CmHopperFinal']['find'](_0x5dca14)[_0x32ef('0x3e')](handleEntityNotFound(_0x765c63,null))[_0x32ef('0x3e')](respondWithResult(_0x765c63,null))[_0x32ef('0x42')](handleError(_0x765c63,null));};exports[_0x32ef('0x46')]=function(_0x209361,_0xd67dc9){return db[_0x32ef('0x3d')][_0x32ef('0x46')]()[_0x32ef('0x3e')](respondWithResult(_0xd67dc9,null))[_0x32ef('0x42')](handleError(_0xd67dc9,null));};exports[_0x32ef('0x24')]=function(_0x30ad49,_0x36a65c){if(_0x30ad49['body'][_0x32ef('0x47')]){delete _0x30ad49[_0x32ef('0x48')][_0x32ef('0x47')];}return db[_0x32ef('0x3d')][_0x32ef('0x49')]({'where':{'uniqueid':_0x30ad49[_0x32ef('0x44')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x36a65c,null))[_0x32ef('0x3e')](saveUpdates(_0x30ad49[_0x32ef('0x48')],null))[_0x32ef('0x3e')](respondWithResult(_0x36a65c,null))[_0x32ef('0x42')](handleError(_0x36a65c,null));};exports[_0x32ef('0x4a')]=function(_0x272377,_0x326445,_0x307ac8){return db[_0x32ef('0x3d')][_0x32ef('0x41')]({'raw':![],'where':{'VoiceQueueId':_0x272377[_0x32ef('0x44')]['id']},'attributes':[[db['sequelize']['fn']('COUNT',db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')][_0x32ef('0x4c')](_0x32ef('0x4d')))),_0x32ef('0x4e')],[db[_0x32ef('0x4b')]['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')][_0x32ef('0x4c')](_0x32ef('0x50')))),'noAnswerContacts'],[db[_0x32ef('0x4b')]['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')][_0x32ef('0x4c')](_0x32ef('0x51')))),'busyContacts'],[db[_0x32ef('0x4b')]['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db['sequelize'][_0x32ef('0x4c')]('`state`\x20=\x208,\x201,\x20null'))),_0x32ef('0x52')],[db[_0x32ef('0x4b')]['fn']('COUNT',db[_0x32ef('0x4b')]['fn']('IF',db['sequelize'][_0x32ef('0x4c')](_0x32ef('0x53')))),_0x32ef('0x54')],[db[_0x32ef('0x4b')]['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x32ef('0x55')],[db['sequelize']['fn']('COUNT',db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')][_0x32ef('0x4c')](_0x32ef('0x56')))),_0x32ef('0x57')],[db[_0x32ef('0x4b')]['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')][_0x32ef('0x4c')]('`state`\x20=\x2019,\x201,\x20null'))),'answeringMachine']]})[_0x32ef('0x3e')](handleEntityNotFound(_0x326445,null))[_0x32ef('0x3e')](respondWithResult(_0x326445,null))['catch'](handleError(_0x326445,null));};exports[_0x32ef('0x58')]=function(_0x12e1ef,_0x2b5703,_0x49c245){return db[_0x32ef('0x3d')][_0x32ef('0x41')]({'raw':![],'where':{'CampaignId':_0x12e1ef[_0x32ef('0x44')]['id']},'attributes':[[db['sequelize']['fn']('COUNT',db[_0x32ef('0x4b')]['fn']('IF',db['sequelize'][_0x32ef('0x4c')]('`state`\x20=\x200,\x201,\x20null'))),'noSuchContacts'],[db[_0x32ef('0x4b')]['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db['sequelize'][_0x32ef('0x4c')](_0x32ef('0x50')))),_0x32ef('0x59')],[db['sequelize']['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db['sequelize']['literal'](_0x32ef('0x51')))),_0x32ef('0x5a')],[db[_0x32ef('0x4b')]['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')]['literal'](_0x32ef('0x5b')))),_0x32ef('0x52')],[db[_0x32ef('0x4b')]['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')][_0x32ef('0x4c')](_0x32ef('0x53')))),_0x32ef('0x54')],[db['sequelize']['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')][_0x32ef('0x4c')](_0x32ef('0x5c')))),'abandonedContacts'],[db['sequelize']['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')][_0x32ef('0x4c')](_0x32ef('0x56')))),'reCallContacts'],[db[_0x32ef('0x4b')]['fn']('COUNT',db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')]['literal']('`state`\x20=\x2019,\x201,\x20null'))),_0x32ef('0x5d')]]})[_0x32ef('0x3e')](handleEntityNotFound(_0x2b5703,null))[_0x32ef('0x3e')](respondWithResult(_0x2b5703,null))['catch'](handleError(_0x2b5703,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x3b4a8e,_0x5edd29,_0x7d2c3a){return db[_0x32ef('0x5e')]['find']({'where':{'id':_0x3b4a8e[_0x32ef('0x44')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x5edd29,null))[_0x32ef('0x3e')](function(_0xd7a78){var _0x9df27c;if(_0xd7a78){_0x9df27c=squel[_0x32ef('0x5f')]()[_0x32ef('0x60')](_0x32ef('0x61'))[_0x32ef('0x62')]([_0x32ef('0x63'),_0x32ef('0x64'),_0x32ef('0x65'),'ListId','VoiceQueueId',_0x32ef('0x66'),_0x32ef('0x67')],squel['select']()[_0x32ef('0x68')]('ANY_VALUE(calleridnum)',_0x32ef('0x63'))[_0x32ef('0x68')](_0x32ef('0x69'),'scheduledAt')[_0x32ef('0x68')]('ANY_VALUE(ContactId)',_0x32ef('0x65'))[_0x32ef('0x68')]('ANY_VALUE(ListId)','ListId')[_0x32ef('0x68')]('ANY_VALUE(VoiceQueueId)',_0x32ef('0x6a'))['field'](_0x32ef('0x69'),_0x32ef('0x66'))[_0x32ef('0x68')]('NOW()','updatedAt')['from'](_0x32ef('0x6b'))['where'](_0x32ef('0x6c'),_0x3b4a8e[_0x32ef('0x44')]['id'][_0x32ef('0x6d')]())[_0x32ef('0x38')](_0x32ef('0x6e'),_0x3b4a8e[_0x32ef('0x48')]['state'][_0x32ef('0x6d')]())['where']('calleridnum\x20IS\x20NOT\x20NULL')[_0x32ef('0x38')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x32ef('0x6f')]()[_0x32ef('0x68')]('phone')[_0x32ef('0x70')](_0x32ef('0x61'))[_0x32ef('0x38')](_0x32ef('0x6c'),_0x3b4a8e[_0x32ef('0x44')]['id'][_0x32ef('0x6d')]()))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x32ef('0x6f')]()['field'](_0x32ef('0x71'))[_0x32ef('0x70')](_0x32ef('0x6b'))[_0x32ef('0x38')](_0x32ef('0x6c'),_0x3b4a8e[_0x32ef('0x44')]['id']['toString']())[_0x32ef('0x38')](_0x32ef('0x72')))[_0x32ef('0x73')](_0x32ef('0x65')))[_0x32ef('0x6d')]();return db['sequelize']['query'](_0x9df27c);}return[];})[_0x32ef('0x3e')](respondWithResult(_0x5edd29,null))[_0x32ef('0x42')](handleError(_0x5edd29,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x211fb1,_0x2e333d,_0x338578){return db[_0x32ef('0x74')][_0x32ef('0x49')]({'where':{'id':_0x211fb1[_0x32ef('0x44')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x2e333d,null))[_0x32ef('0x3e')](function(_0x353641){var _0x54e65d;if(_0x353641){_0x54e65d=squel[_0x32ef('0x5f')]()[_0x32ef('0x60')]('cm_hopper')[_0x32ef('0x62')](['phone',_0x32ef('0x64'),'ContactId',_0x32ef('0x75'),_0x32ef('0x76'),_0x32ef('0x66'),_0x32ef('0x67')],squel['select']()[_0x32ef('0x68')](_0x32ef('0x77'),_0x32ef('0x63'))['field']('NOW()','scheduledAt')[_0x32ef('0x68')](_0x32ef('0x78'),_0x32ef('0x65'))[_0x32ef('0x68')](_0x32ef('0x79'),'ListId')[_0x32ef('0x68')]('ANY_VALUE(CampaignId)',_0x32ef('0x76'))[_0x32ef('0x68')](_0x32ef('0x69'),'createdAt')[_0x32ef('0x68')](_0x32ef('0x69'),_0x32ef('0x67'))[_0x32ef('0x70')](_0x32ef('0x6b'))['where'](_0x32ef('0x7a'),_0x211fb1['params']['id'][_0x32ef('0x6d')]())[_0x32ef('0x38')]('state\x20=\x20?',_0x211fb1['body'][_0x32ef('0x7b')][_0x32ef('0x6d')]())[_0x32ef('0x38')](_0x32ef('0x7c'))['where'](_0x32ef('0x7d'),squel['select']()['field'](_0x32ef('0x63'))['from'](_0x32ef('0x61'))[_0x32ef('0x38')](_0x32ef('0x7a'),_0x211fb1['params']['id']['toString']()))[_0x32ef('0x38')](_0x32ef('0x7d'),squel[_0x32ef('0x6f')]()[_0x32ef('0x68')](_0x32ef('0x71'))[_0x32ef('0x70')](_0x32ef('0x6b'))['where'](_0x32ef('0x7a'),_0x211fb1[_0x32ef('0x44')]['id'][_0x32ef('0x6d')]())[_0x32ef('0x38')]('state\x20=\x204'))['group'](_0x32ef('0x65')))['toString']();return db[_0x32ef('0x4b')][_0x32ef('0x2f')](_0x54e65d);}return[];})['then'](respondWithResult(_0x2e333d,null))['catch'](handleError(_0x2e333d,null));};exports['checkContactHopper']=function(_0x201675,_0x33f6c3,_0xa53375){return db[_0x32ef('0x7e')]['findOne']({'where':{'VoiceQueueId':_0x201675[_0x32ef('0x48')][_0x32ef('0x6a')],'CampaignId':_0x201675[_0x32ef('0x48')]['CampaignId'],'ContactId':_0x201675[_0x32ef('0x48')]['ContactId']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x33f6c3,null))[_0x32ef('0x3e')](function(_0x5f4890){if(_0x5f4890){return _0x5f4890;}return null;})['then'](respondWithResult(_0x33f6c3,null))[_0x32ef('0x42')](handleError(_0x33f6c3,null));}; \ No newline at end of file +var _0xd117=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/license/util','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','reject','then','destroy','error','stack','name','send','CmHopperFinal','fieldName','type','map','keys','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','count','findAll','rows','catch','show','params','rawAttributes','includeAll','find','describe','update','body','uniqueid','countContactsQueueCampaignHopperFinal','COUNT','sequelize','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','answeringMachine','moveContactsQueueCampaignHopperFinal','VoiceQueue','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','ANY_VALUE(calleridnum)','field','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','insert','CampaignId','ANY_VALUE(ListId)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','state\x20=\x20?','checkContactHopper','CmHopper','findOne','eml-format'];(function(_0x4ad068,_0x49a3ce){var _0x266af5=function(_0x2c1847){while(--_0x2c1847){_0x4ad068['push'](_0x4ad068['shift']());}};_0x266af5(++_0x49a3ce);}(_0xd117,0x182));var _0x7d11=function(_0x536256,_0x237fb5){_0x536256=_0x536256-0x0;var _0x1675f7=_0xd117[_0x536256];return _0x1675f7;};'use strict';var emlformat=require(_0x7d11('0x0'));var rimraf=require(_0x7d11('0x1'));var zipdir=require(_0x7d11('0x2'));var jsonpatch=require(_0x7d11('0x3'));var rp=require(_0x7d11('0x4'));var moment=require(_0x7d11('0x5'));var BPromise=require(_0x7d11('0x6'));var Mustache=require(_0x7d11('0x7'));var util=require(_0x7d11('0x8'));var path=require(_0x7d11('0x9'));var sox=require(_0x7d11('0xa'));var csv=require(_0x7d11('0xb'));var ejs=require(_0x7d11('0xc'));var fs=require('fs');var fs_extra=require(_0x7d11('0xd'));var _=require(_0x7d11('0xe'));var squel=require(_0x7d11('0xf'));var crypto=require('crypto');var jsforce=require(_0x7d11('0x10'));var deskjs=require(_0x7d11('0x11'));var toCsv=require(_0x7d11('0xb'));var querystring=require('querystring');var Papa=require(_0x7d11('0x12'));var Redis=require(_0x7d11('0x13'));var authService=require(_0x7d11('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x7d11('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7d11('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7d11('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4767d5,_0x471f46){_0x471f46=_0x471f46||0xcc;return function(_0x5ee572){if(_0x5ee572){return _0x4767d5[_0x7d11('0x18')](_0x471f46);}return _0x4767d5[_0x7d11('0x19')](_0x471f46)['end']();};}function respondWithResult(_0x324de5,_0x16949d){_0x16949d=_0x16949d||0xc8;return function(_0x20a2df){if(_0x20a2df){return _0x324de5[_0x7d11('0x19')](_0x16949d)[_0x7d11('0x1a')](_0x20a2df);}};}function respondWithFilteredResult(_0xeae744,_0x2a269e){return function(_0xb1669e){if(_0xb1669e){var _0x4aa795=typeof _0x2a269e[_0x7d11('0x1b')]===_0x7d11('0x1c')&&typeof _0x2a269e[_0x7d11('0x1d')]===_0x7d11('0x1c');var _0x45f916=_0xb1669e['count'];var _0x456cb9=_0x4aa795?0x0:_0x2a269e[_0x7d11('0x1b')];var _0x4d1306=_0x4aa795?_0xb1669e['count']:_0x2a269e[_0x7d11('0x1b')]+_0x2a269e['limit'];var _0x1f9990;if(_0x4d1306>=_0x45f916){_0x4d1306=_0x45f916;_0x1f9990=0xc8;}else{_0x1f9990=0xce;}_0xeae744['status'](_0x1f9990);return _0xeae744[_0x7d11('0x1e')](_0x7d11('0x1f'),_0x456cb9+'-'+_0x4d1306+'/'+_0x45f916)[_0x7d11('0x1a')](_0xb1669e);}return null;};}function patchUpdates(_0x46f662){return function(_0x30df70){try{jsonpatch[_0x7d11('0x20')](_0x30df70,_0x46f662,!![]);}catch(_0x4297f8){return BPromise[_0x7d11('0x21')](_0x4297f8);}return _0x30df70['save']();};}function saveUpdates(_0x441917,_0x4a34f4){return function(_0x58455b){if(_0x58455b){return _0x58455b['update'](_0x441917)[_0x7d11('0x22')](function(_0x3545dc){return _0x3545dc;});}return null;};}function removeEntity(_0x44476c,_0x1a7853){return function(_0x355d14){if(_0x355d14){return _0x355d14[_0x7d11('0x23')]()[_0x7d11('0x22')](function(){_0x44476c[_0x7d11('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x36c2b4,_0x577ca9){return function(_0x4bfa76){if(!_0x4bfa76){_0x36c2b4['sendStatus'](0x194);}return _0x4bfa76;};}function handleError(_0x3ba092,_0x59cdba){_0x59cdba=_0x59cdba||0x1f4;return function(_0x180e1e){logger[_0x7d11('0x24')](_0x180e1e[_0x7d11('0x25')]);if(_0x180e1e['name']){delete _0x180e1e[_0x7d11('0x26')];}_0x3ba092[_0x7d11('0x19')](_0x59cdba)[_0x7d11('0x27')](_0x180e1e);};}exports['index']=function(_0x601650,_0x35a789){var _0x18c049={},_0x38f1be={},_0x4c7d6a={'count':0x0,'rows':[]};var _0x1a7745=_['map'](db[_0x7d11('0x28')]['rawAttributes'],function(_0x31866d){return{'name':_0x31866d[_0x7d11('0x29')],'type':_0x31866d[_0x7d11('0x2a')]['key']};});_0x38f1be['model']=_[_0x7d11('0x2b')](_0x1a7745,_0x7d11('0x26'));_0x38f1be['query']=_[_0x7d11('0x2c')](_0x601650[_0x7d11('0x2d')]);_0x38f1be[_0x7d11('0x2e')]=_['intersection'](_0x38f1be[_0x7d11('0x2f')],_0x38f1be['query']);_0x18c049['attributes']=_[_0x7d11('0x30')](_0x38f1be['model'],qs[_0x7d11('0x31')](_0x601650[_0x7d11('0x2d')][_0x7d11('0x31')]));_0x18c049[_0x7d11('0x32')]=_0x18c049['attributes'][_0x7d11('0x33')]?_0x18c049[_0x7d11('0x32')]:_0x38f1be['model'];if(!_0x601650['query'][_0x7d11('0x34')](_0x7d11('0x35'))){_0x18c049['limit']=qs[_0x7d11('0x1d')](_0x601650['query']['limit']);_0x18c049[_0x7d11('0x1b')]=qs['offset'](_0x601650['query'][_0x7d11('0x1b')]);}_0x18c049[_0x7d11('0x36')]=qs[_0x7d11('0x37')](_0x601650[_0x7d11('0x2d')][_0x7d11('0x37')]);_0x18c049[_0x7d11('0x38')]=qs[_0x7d11('0x2e')](_[_0x7d11('0x39')](_0x601650[_0x7d11('0x2d')],_0x38f1be[_0x7d11('0x2e')]),_0x1a7745);if(_0x601650[_0x7d11('0x2d')][_0x7d11('0x3a')]){_0x18c049['where']=_[_0x7d11('0x3b')](_0x18c049['where'],{'$or':_[_0x7d11('0x2b')](_0x1a7745,function(_0x111e26){if(_0x111e26[_0x7d11('0x2a')]!==_0x7d11('0x3c')){var _0x4f8fd2={};_0x4f8fd2[_0x111e26[_0x7d11('0x26')]]={'$like':'%'+_0x601650[_0x7d11('0x2d')][_0x7d11('0x3a')]+'%'};return _0x4f8fd2;}})});}_0x18c049=_[_0x7d11('0x3b')]({},_0x18c049,_0x601650['options']);var _0x22730e={'where':_0x18c049['where']};return db[_0x7d11('0x28')]['count'](_0x22730e)[_0x7d11('0x22')](function(_0x622725){_0x4c7d6a[_0x7d11('0x3d')]=_0x622725;if(_0x601650[_0x7d11('0x2d')]['includeAll']){_0x18c049['include']=[{'all':!![]}];}return db[_0x7d11('0x28')][_0x7d11('0x3e')](_0x18c049);})['then'](function(_0x1caef9){_0x4c7d6a[_0x7d11('0x3f')]=_0x1caef9;return _0x4c7d6a;})[_0x7d11('0x22')](respondWithFilteredResult(_0x35a789,_0x18c049))[_0x7d11('0x40')](handleError(_0x35a789,null));};exports[_0x7d11('0x41')]=function(_0x2e1647,_0x47e968){var _0x25b73b={'raw':!![],'where':{'id':_0x2e1647[_0x7d11('0x42')]['id']}},_0x5cf6a6={};_0x5cf6a6[_0x7d11('0x2f')]=_[_0x7d11('0x2c')](db[_0x7d11('0x28')][_0x7d11('0x43')]);_0x5cf6a6[_0x7d11('0x2d')]=_['keys'](_0x2e1647['query']);_0x5cf6a6['filters']=_[_0x7d11('0x30')](_0x5cf6a6[_0x7d11('0x2f')],_0x5cf6a6[_0x7d11('0x2d')]);_0x25b73b[_0x7d11('0x32')]=_[_0x7d11('0x30')](_0x5cf6a6['model'],qs[_0x7d11('0x31')](_0x2e1647[_0x7d11('0x2d')]['fields']));_0x25b73b[_0x7d11('0x32')]=_0x25b73b[_0x7d11('0x32')][_0x7d11('0x33')]?_0x25b73b['attributes']:_0x5cf6a6[_0x7d11('0x2f')];if(_0x2e1647[_0x7d11('0x2d')][_0x7d11('0x44')]){_0x25b73b['include']=[{'all':!![]}];}_0x25b73b=_[_0x7d11('0x3b')]({},_0x25b73b,_0x2e1647['options']);return db[_0x7d11('0x28')][_0x7d11('0x45')](_0x25b73b)[_0x7d11('0x22')](handleEntityNotFound(_0x47e968,null))[_0x7d11('0x22')](respondWithResult(_0x47e968,null))[_0x7d11('0x40')](handleError(_0x47e968,null));};exports[_0x7d11('0x46')]=function(_0x161213,_0x193631){return db[_0x7d11('0x28')]['describe']()['then'](respondWithResult(_0x193631,null))['catch'](handleError(_0x193631,null));};exports[_0x7d11('0x47')]=function(_0x1e5bb5,_0x20297a){if(_0x1e5bb5[_0x7d11('0x48')][_0x7d11('0x49')]){delete _0x1e5bb5[_0x7d11('0x48')][_0x7d11('0x49')];}return db[_0x7d11('0x28')][_0x7d11('0x45')]({'where':{'uniqueid':_0x1e5bb5[_0x7d11('0x42')]['id']}})[_0x7d11('0x22')](handleEntityNotFound(_0x20297a,null))[_0x7d11('0x22')](saveUpdates(_0x1e5bb5['body'],null))[_0x7d11('0x22')](respondWithResult(_0x20297a,null))[_0x7d11('0x40')](handleError(_0x20297a,null));};exports[_0x7d11('0x4a')]=function(_0x553a03,_0x503ebc,_0x14db1c){return db[_0x7d11('0x28')][_0x7d11('0x3e')]({'raw':![],'where':{'VoiceQueueId':_0x553a03['params']['id']},'attributes':[[db['sequelize']['fn'](_0x7d11('0x4b'),db[_0x7d11('0x4c')]['fn']('IF',db['sequelize'][_0x7d11('0x4d')](_0x7d11('0x4e')))),_0x7d11('0x4f')],[db[_0x7d11('0x4c')]['fn']('COUNT',db[_0x7d11('0x4c')]['fn']('IF',db[_0x7d11('0x4c')][_0x7d11('0x4d')]('`state`\x20=\x203,\x201,\x20null'))),'noAnswerContacts'],[db[_0x7d11('0x4c')]['fn'](_0x7d11('0x4b'),db[_0x7d11('0x4c')]['fn']('IF',db[_0x7d11('0x4c')][_0x7d11('0x4d')]('`state`\x20=\x205,\x201,\x20null'))),_0x7d11('0x50')],[db[_0x7d11('0x4c')]['fn'](_0x7d11('0x4b'),db[_0x7d11('0x4c')]['fn']('IF',db['sequelize']['literal'](_0x7d11('0x51')))),_0x7d11('0x52')],[db[_0x7d11('0x4c')]['fn'](_0x7d11('0x4b'),db[_0x7d11('0x4c')]['fn']('IF',db[_0x7d11('0x4c')][_0x7d11('0x4d')](_0x7d11('0x53')))),_0x7d11('0x54')],[db[_0x7d11('0x4c')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x7d11('0x4d')](_0x7d11('0x55')))),_0x7d11('0x56')],[db['sequelize']['fn'](_0x7d11('0x4b'),db[_0x7d11('0x4c')]['fn']('IF',db[_0x7d11('0x4c')][_0x7d11('0x4d')](_0x7d11('0x57')))),_0x7d11('0x58')],[db['sequelize']['fn'](_0x7d11('0x4b'),db[_0x7d11('0x4c')]['fn']('IF',db[_0x7d11('0x4c')]['literal']('`state`\x20=\x2019,\x201,\x20null'))),'answeringMachine']]})['then'](handleEntityNotFound(_0x503ebc,null))[_0x7d11('0x22')](respondWithResult(_0x503ebc,null))['catch'](handleError(_0x503ebc,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x52d62d,_0x32c551,_0x12f05b){return db[_0x7d11('0x28')][_0x7d11('0x3e')]({'raw':![],'where':{'CampaignId':_0x52d62d[_0x7d11('0x42')]['id']},'attributes':[[db[_0x7d11('0x4c')]['fn']('COUNT',db[_0x7d11('0x4c')]['fn']('IF',db['sequelize'][_0x7d11('0x4d')]('`state`\x20=\x200,\x201,\x20null'))),_0x7d11('0x4f')],[db[_0x7d11('0x4c')]['fn']('COUNT',db[_0x7d11('0x4c')]['fn']('IF',db[_0x7d11('0x4c')][_0x7d11('0x4d')](_0x7d11('0x59')))),'noAnswerContacts'],[db['sequelize']['fn'](_0x7d11('0x4b'),db[_0x7d11('0x4c')]['fn']('IF',db[_0x7d11('0x4c')][_0x7d11('0x4d')](_0x7d11('0x5a')))),'busyContacts'],[db[_0x7d11('0x4c')]['fn']('COUNT',db[_0x7d11('0x4c')]['fn']('IF',db[_0x7d11('0x4c')][_0x7d11('0x4d')](_0x7d11('0x51')))),'congestionContacts'],[db[_0x7d11('0x4c')]['fn']('COUNT',db[_0x7d11('0x4c')]['fn']('IF',db[_0x7d11('0x4c')][_0x7d11('0x4d')](_0x7d11('0x53')))),_0x7d11('0x54')],[db[_0x7d11('0x4c')]['fn'](_0x7d11('0x4b'),db[_0x7d11('0x4c')]['fn']('IF',db[_0x7d11('0x4c')][_0x7d11('0x4d')](_0x7d11('0x55')))),_0x7d11('0x56')],[db[_0x7d11('0x4c')]['fn'](_0x7d11('0x4b'),db['sequelize']['fn']('IF',db[_0x7d11('0x4c')]['literal'](_0x7d11('0x57')))),'reCallContacts'],[db[_0x7d11('0x4c')]['fn'](_0x7d11('0x4b'),db[_0x7d11('0x4c')]['fn']('IF',db[_0x7d11('0x4c')]['literal']('`state`\x20=\x2019,\x201,\x20null'))),_0x7d11('0x5b')]]})[_0x7d11('0x22')](handleEntityNotFound(_0x32c551,null))[_0x7d11('0x22')](respondWithResult(_0x32c551,null))['catch'](handleError(_0x32c551,null));};exports[_0x7d11('0x5c')]=function(_0x3c656b,_0x31cb39,_0x1b89de){return db[_0x7d11('0x5d')][_0x7d11('0x45')]({'where':{'id':_0x3c656b['params']['id']}})[_0x7d11('0x22')](handleEntityNotFound(_0x31cb39,null))['then'](function(_0x1fd598){var _0x4c88c6;if(_0x1fd598){_0x4c88c6=squel['insert']()[_0x7d11('0x5e')](_0x7d11('0x5f'))[_0x7d11('0x60')]([_0x7d11('0x61'),_0x7d11('0x62'),_0x7d11('0x63'),_0x7d11('0x64'),_0x7d11('0x65'),_0x7d11('0x66'),_0x7d11('0x67')],squel[_0x7d11('0x68')]()['field'](_0x7d11('0x69'),'phone')[_0x7d11('0x6a')](_0x7d11('0x6b'),_0x7d11('0x62'))[_0x7d11('0x6a')](_0x7d11('0x6c'),_0x7d11('0x63'))[_0x7d11('0x6a')]('ANY_VALUE(ListId)','ListId')[_0x7d11('0x6a')](_0x7d11('0x6d'),_0x7d11('0x65'))[_0x7d11('0x6a')](_0x7d11('0x6b'),'createdAt')[_0x7d11('0x6a')]('NOW()',_0x7d11('0x67'))[_0x7d11('0x6e')](_0x7d11('0x6f'))[_0x7d11('0x38')](_0x7d11('0x70'),_0x3c656b[_0x7d11('0x42')]['id'][_0x7d11('0x71')]())[_0x7d11('0x38')]('state\x20=\x20?',_0x3c656b['body'][_0x7d11('0x72')][_0x7d11('0x71')]())[_0x7d11('0x38')]('calleridnum\x20IS\x20NOT\x20NULL')['where'](_0x7d11('0x73'),squel['select']()[_0x7d11('0x6a')](_0x7d11('0x61'))[_0x7d11('0x6e')](_0x7d11('0x5f'))['where'](_0x7d11('0x70'),_0x3c656b[_0x7d11('0x42')]['id'][_0x7d11('0x71')]()))[_0x7d11('0x38')](_0x7d11('0x73'),squel[_0x7d11('0x68')]()[_0x7d11('0x6a')](_0x7d11('0x74'))['from'](_0x7d11('0x6f'))[_0x7d11('0x38')](_0x7d11('0x70'),_0x3c656b[_0x7d11('0x42')]['id'][_0x7d11('0x71')]())['where'](_0x7d11('0x75')))[_0x7d11('0x76')](_0x7d11('0x63')))[_0x7d11('0x71')]();return db[_0x7d11('0x4c')]['query'](_0x4c88c6);}return[];})['then'](respondWithResult(_0x31cb39,null))['catch'](handleError(_0x31cb39,null));};exports[_0x7d11('0x77')]=function(_0x4c15e9,_0x2a9e92,_0x5459d1){return db['Campaign'][_0x7d11('0x45')]({'where':{'id':_0x4c15e9[_0x7d11('0x42')]['id']}})[_0x7d11('0x22')](handleEntityNotFound(_0x2a9e92,null))[_0x7d11('0x22')](function(_0x345fb3){var _0x32a17a;if(_0x345fb3){_0x32a17a=squel[_0x7d11('0x78')]()[_0x7d11('0x5e')](_0x7d11('0x5f'))[_0x7d11('0x60')](['phone',_0x7d11('0x62'),_0x7d11('0x63'),'ListId',_0x7d11('0x79'),_0x7d11('0x66'),_0x7d11('0x67')],squel[_0x7d11('0x68')]()['field']('ANY_VALUE(calleridnum)',_0x7d11('0x61'))['field'](_0x7d11('0x6b'),_0x7d11('0x62'))[_0x7d11('0x6a')](_0x7d11('0x6c'),_0x7d11('0x63'))[_0x7d11('0x6a')](_0x7d11('0x7a'),'ListId')[_0x7d11('0x6a')](_0x7d11('0x7b'),_0x7d11('0x79'))[_0x7d11('0x6a')]('NOW()',_0x7d11('0x66'))[_0x7d11('0x6a')]('NOW()',_0x7d11('0x67'))[_0x7d11('0x6e')](_0x7d11('0x6f'))['where'](_0x7d11('0x7c'),_0x4c15e9[_0x7d11('0x42')]['id']['toString']())[_0x7d11('0x38')](_0x7d11('0x7d'),_0x4c15e9['body'][_0x7d11('0x72')]['toString']())['where']('calleridnum\x20IS\x20NOT\x20NULL')['where'](_0x7d11('0x73'),squel[_0x7d11('0x68')]()[_0x7d11('0x6a')](_0x7d11('0x61'))[_0x7d11('0x6e')](_0x7d11('0x5f'))[_0x7d11('0x38')](_0x7d11('0x7c'),_0x4c15e9[_0x7d11('0x42')]['id'][_0x7d11('0x71')]()))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x7d11('0x68')]()[_0x7d11('0x6a')]('calleridnum')['from'](_0x7d11('0x6f'))[_0x7d11('0x38')](_0x7d11('0x7c'),_0x4c15e9[_0x7d11('0x42')]['id']['toString']())['where']('state\x20=\x204'))[_0x7d11('0x76')](_0x7d11('0x63')))[_0x7d11('0x71')]();return db['sequelize'][_0x7d11('0x2d')](_0x32a17a);}return[];})[_0x7d11('0x22')](respondWithResult(_0x2a9e92,null))['catch'](handleError(_0x2a9e92,null));};exports[_0x7d11('0x7e')]=function(_0x1cb457,_0x59f0db,_0x5e5faf){return db[_0x7d11('0x7f')][_0x7d11('0x80')]({'where':{'VoiceQueueId':_0x1cb457['body']['VoiceQueueId'],'CampaignId':_0x1cb457[_0x7d11('0x48')][_0x7d11('0x79')],'ContactId':_0x1cb457[_0x7d11('0x48')][_0x7d11('0x63')]}})['then'](handleEntityNotFound(_0x59f0db,null))[_0x7d11('0x22')](function(_0x2cfa77){if(_0x2cfa77){return _0x2cfa77;}return null;})[_0x7d11('0x22')](respondWithResult(_0x59f0db,null))[_0x7d11('0x40')](handleError(_0x59f0db,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 4bc4c08..694a841 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 _0x3abb=['api','moment','bluebird','request-promise','../../config/environment','./cmHopperFinal.attributes','exports','cm_hopper_final','calleridnum','uniqueid','util','../../config/logger'];(function(_0x250162,_0x4874a5){var _0x563676=function(_0x118f6b){while(--_0x118f6b){_0x250162['push'](_0x250162['shift']());}};_0x563676(++_0x4874a5);}(_0x3abb,0x17e));var _0xb3ab=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0x3abb[_0x24f31b];return _0x488401;};'use strict';var _=require('lodash');var util=require(_0xb3ab('0x0'));var logger=require(_0xb3ab('0x1'))(_0xb3ab('0x2'));var moment=require(_0xb3ab('0x3'));var BPromise=require(_0xb3ab('0x4'));var rp=require(_0xb3ab('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb3ab('0x6'));var attributes=require(_0xb3ab('0x7'));module[_0xb3ab('0x8')]=function(_0x34a6c3,_0x32ff9d){return _0x34a6c3['define']('CmHopperFinal',attributes,{'tableName':_0xb3ab('0x9'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0xb3ab('0xa')]},{'name':_0xb3ab('0xb'),'fields':[_0xb3ab('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb984=['uniqueid','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes','define','CmHopperFinal','cm_hopper_final','calleridnum'];(function(_0x160425,_0x2983aa){var _0x455b67=function(_0x1e964a){while(--_0x1e964a){_0x160425['push'](_0x160425['shift']());}};_0x455b67(++_0x2983aa);}(_0xb984,0x7f));var _0x4b98=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xb984[_0x92c450];return _0x2a9599;};'use strict';var _=require(_0x4b98('0x0'));var util=require(_0x4b98('0x1'));var logger=require('../../config/logger')(_0x4b98('0x2'));var moment=require(_0x4b98('0x3'));var BPromise=require('bluebird');var rp=require(_0x4b98('0x4'));var fs=require('fs');var path=require(_0x4b98('0x5'));var rimraf=require(_0x4b98('0x6'));var config=require(_0x4b98('0x7'));var attributes=require(_0x4b98('0x8'));module['exports']=function(_0x43e300,_0x9392a6){return _0x43e300[_0x4b98('0x9')](_0x4b98('0xa'),attributes,{'tableName':_0x4b98('0xb'),'paranoid':![],'indexes':[{'name':_0x4b98('0xc'),'fields':[_0x4b98('0xc')]},{'name':_0x4b98('0xd'),'fields':[_0x4b98('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 0213753..6bfe68e 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x36a343,_0xcfc30a){var _0x738d5b=function(_0x49d40f){while(--_0x49d40f){_0x36a343['push'](_0x36a343['shift']());}};_0x738d5b(++_0xcfc30a);}(_0x7a54,0x106));var _0x47a5=function(_0x45785a,_0xef9bac){_0x45785a=_0x45785a-0x0;var _0x494ee5=_0x7a54[_0x45785a];return _0x494ee5;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x2bb543,_0x296258){var _0x30e860=function(_0xf5bbc){while(--_0xf5bbc){_0x2bb543['push'](_0x2bb543['shift']());}};_0x30e860(++_0x296258);}(_0xb10b,0x12a));var _0xbb10=function(_0x118749,_0x50e848){_0x118749=_0x118749-0x0;var _0x20d489=_0xb10b[_0x118749];return _0x20d489;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index bd38e65..32320e4 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 _0x09cb=['isAuthenticated','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','/checkContactHopper','put','/:id','update','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','index','describe'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0x09cb,0xdd));var _0xb09c=function(_0x1224d6,_0x54ac2a){_0x1224d6=_0x1224d6-0x0;var _0x1b3845=_0x09cb[_0x1224d6];return _0x1b3845;};'use strict';var multer=require(_0xb09c('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb09c('0x1'));var express=require(_0xb09c('0x2'));var router=express[_0xb09c('0x3')]();var fs_extra=require(_0xb09c('0x4'));var auth=require(_0xb09c('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./cmHopperFinal.controller');router[_0xb09c('0x6')]('/',auth['isAuthenticated'](),controller[_0xb09c('0x7')]);router[_0xb09c('0x6')]('/describe',auth['isAuthenticated'](),controller[_0xb09c('0x8')]);router['get']('/:id',auth[_0xb09c('0x9')](),controller[_0xb09c('0xa')]);router[_0xb09c('0x6')](_0xb09c('0xb'),auth[_0xb09c('0x9')](),controller[_0xb09c('0xc')]);router[_0xb09c('0x6')](_0xb09c('0xd'),auth['isAuthenticated'](),controller[_0xb09c('0xe')]);router[_0xb09c('0xf')]('/voice/queue/moveContacts/:id',auth['isAuthenticated'](),controller[_0xb09c('0x10')]);router[_0xb09c('0xf')](_0xb09c('0x11'),auth[_0xb09c('0x9')](),controller['moveContactsIvrCampaignHopperFinal']);router[_0xb09c('0xf')](_0xb09c('0x12'),auth[_0xb09c('0x9')](),controller['checkContactHopper']);router[_0xb09c('0x13')](_0xb09c('0x14'),auth['isAuthenticated'](),controller[_0xb09c('0x15')]);module[_0xb09c('0x16')]=router; \ No newline at end of file +var _0x25e7=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','/describe','describe','get','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','countContactsIvrCampaignHopperFinal','post','moveContactsQueueCampaignHopperFinal','moveContactsIvrCampaignHopperFinal','checkContactHopper','put','update','multer','util','path','connect-timeout','express'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x25e7,0x1d6));var _0x725e=function(_0x5b311b,_0x3e0280){_0x5b311b=_0x5b311b-0x0;var _0x4fa0de=_0x25e7[_0x5b311b];return _0x4fa0de;};'use strict';var multer=require(_0x725e('0x0'));var util=require(_0x725e('0x1'));var path=require(_0x725e('0x2'));var timeout=require(_0x725e('0x3'));var express=require(_0x725e('0x4'));var router=express[_0x725e('0x5')]();var fs_extra=require(_0x725e('0x6'));var auth=require(_0x725e('0x7'));var interaction=require(_0x725e('0x8'));var config=require(_0x725e('0x9'));var controller=require('./cmHopperFinal.controller');router['get']('/',auth[_0x725e('0xa')](),controller['index']);router['get'](_0x725e('0xb'),auth[_0x725e('0xa')](),controller[_0x725e('0xc')]);router[_0x725e('0xd')](_0x725e('0xe'),auth[_0x725e('0xa')](),controller[_0x725e('0xf')]);router[_0x725e('0xd')](_0x725e('0x10'),auth[_0x725e('0xa')](),controller[_0x725e('0x11')]);router[_0x725e('0xd')]('/campaign/countAttributes/:id',auth['isAuthenticated'](),controller[_0x725e('0x12')]);router[_0x725e('0x13')]('/voice/queue/moveContacts/:id',auth['isAuthenticated'](),controller[_0x725e('0x14')]);router[_0x725e('0x13')]('/voice/campaign/moveContacts/:id',auth[_0x725e('0xa')](),controller[_0x725e('0x15')]);router[_0x725e('0x13')]('/checkContactHopper',auth[_0x725e('0xa')](),controller[_0x725e('0x16')]);router[_0x725e('0x17')](_0x725e('0xe'),auth[_0x725e('0xa')](),controller[_0x725e('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index b05cd73..9cb3b59 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 _0x884d=['STRING','BOOLEAN','sequelize','INTEGER','DATE'];(function(_0x2d364e,_0x301c5e){var _0x1b9312=function(_0x1b05bb){while(--_0x1b05bb){_0x2d364e['push'](_0x2d364e['shift']());}};_0x1b9312(++_0x301c5e);}(_0x884d,0xb6));var _0xd884=function(_0x4fbae5,_0x2f8228){_0x4fbae5=_0x4fbae5-0x0;var _0x52e0ab=_0x884d[_0x4fbae5];return _0x52e0ab;};'use strict';var Sequelize=require(_0xd884('0x0'));module['exports']={'state':{'type':Sequelize[_0xd884('0x1')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xd884('0x2')]},'countbusyretry':{'type':Sequelize[_0xd884('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xd884('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xd884('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xd884('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xd884('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xd884('0x3')]},'originatecalleridname':{'type':Sequelize[_0xd884('0x3')]},'calleridnum':{'type':Sequelize[_0xd884('0x3')]},'calleridname':{'type':Sequelize[_0xd884('0x3')]},'starttime':{'type':Sequelize[_0xd884('0x2')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0xd884('0x2')]},'endtime':{'type':Sequelize[_0xd884('0x2')]},'ringtime':{'type':Sequelize[_0xd884('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xd884('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xd884('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xd884('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xd884('0x3')]},'campaign':{'type':Sequelize[_0xd884('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0xd884('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0xd884('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xd884('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xd884('0x2')]},'recallme':{'type':Sequelize[_0xd884('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0xd884('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xd884('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xd884('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xd884('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xd884('0x1')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xd884('0x3')]}}; \ No newline at end of file +var _0x2e57=['INTEGER','STRING','DATE','BOOLEAN','sequelize','exports'];(function(_0x461e12,_0x5885e6){var _0xa162ad=function(_0xd805f8){while(--_0xd805f8){_0x461e12['push'](_0x461e12['shift']());}};_0xa162ad(++_0x5885e6);}(_0x2e57,0x1cc));var _0x72e5=function(_0x4ac8d0,_0x8f2a8f){_0x4ac8d0=_0x4ac8d0-0x0;var _0x4e6c54=_0x2e57[_0x4ac8d0];return _0x4e6c54;};'use strict';var Sequelize=require(_0x72e5('0x0'));module[_0x72e5('0x1')]={'state':{'type':Sequelize[_0x72e5('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x72e5('0x3')]},'scheduledat':{'type':Sequelize[_0x72e5('0x4')]},'countbusyretry':{'type':Sequelize[_0x72e5('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x72e5('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x72e5('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x72e5('0x3')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x72e5('0x3')]},'calleridname':{'type':Sequelize[_0x72e5('0x3')]},'starttime':{'type':Sequelize[_0x72e5('0x4')]},'responsetime':{'type':Sequelize[_0x72e5('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x72e5('0x4')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x72e5('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x72e5('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x72e5('0x3')]},'campaign':{'type':Sequelize[_0x72e5('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x72e5('0x3')]},'reason':{'type':Sequelize[_0x72e5('0x3')]},'amd':{'type':Sequelize[_0x72e5('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x72e5('0x5')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x72e5('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x72e5('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x72e5('0x4')]},'edited':{'type':Sequelize[_0x72e5('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x72e5('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x72e5('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x72e5('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x72e5('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x72e5('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x72e5('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 552edde..45848a1 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 _0x839c=['includeAll','include','findAll','rows','catch','length','find','create','body','uniqueid','params','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','CmHopperHistory','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options'];(function(_0x381c15,_0xccafcd){var _0x3d9436=function(_0x27725a){while(--_0x27725a){_0x381c15['push'](_0x381c15['shift']());}};_0x3d9436(++_0xccafcd);}(_0x839c,0x1e5));var _0xc839=function(_0x36c5be,_0x1032d6){_0x36c5be=_0x36c5be-0x0;var _0x28d11e=_0x839c[_0x36c5be];return _0x28d11e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc839('0x0'));var jsonpatch=require(_0xc839('0x1'));var rp=require(_0xc839('0x2'));var moment=require(_0xc839('0x3'));var BPromise=require(_0xc839('0x4'));var Mustache=require(_0xc839('0x5'));var util=require('util');var path=require(_0xc839('0x6'));var sox=require(_0xc839('0x7'));var csv=require(_0xc839('0x8'));var ejs=require(_0xc839('0x9'));var fs=require('fs');var fs_extra=require(_0xc839('0xa'));var _=require(_0xc839('0xb'));var squel=require(_0xc839('0xc'));var crypto=require(_0xc839('0xd'));var jsforce=require(_0xc839('0xe'));var deskjs=require(_0xc839('0xf'));var toCsv=require(_0xc839('0x8'));var querystring=require(_0xc839('0x10'));var Papa=require(_0xc839('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc839('0x12'));var as=require(_0xc839('0x13'));var hardwareService=require(_0xc839('0x14'));var logger=require(_0xc839('0x15'))(_0xc839('0x16'));var utils=require('../../config/utils');var config=require(_0xc839('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xc839('0x18'))['db'];function respondWithStatusCode(_0x599d24,_0xc0d405){_0xc0d405=_0xc0d405||0xcc;return function(_0x4dddc2){if(_0x4dddc2){return _0x599d24[_0xc839('0x19')](_0xc0d405);}return _0x599d24[_0xc839('0x1a')](_0xc0d405)[_0xc839('0x1b')]();};}function respondWithResult(_0x2802e0,_0x32f326){_0x32f326=_0x32f326||0xc8;return function(_0x192b12){if(_0x192b12){return _0x2802e0[_0xc839('0x1a')](_0x32f326)[_0xc839('0x1c')](_0x192b12);}};}function respondWithFilteredResult(_0x3c16e7,_0x2528b0){return function(_0x526c14){if(_0x526c14){var _0x592bd8=typeof _0x2528b0[_0xc839('0x1d')]===_0xc839('0x1e')&&typeof _0x2528b0[_0xc839('0x1f')]===_0xc839('0x1e');var _0x2ce4ba=_0x526c14[_0xc839('0x20')];var _0x2fbd53=_0x592bd8?0x0:_0x2528b0[_0xc839('0x1d')];var _0x3c8399=_0x592bd8?_0x526c14[_0xc839('0x20')]:_0x2528b0[_0xc839('0x1d')]+_0x2528b0[_0xc839('0x1f')];var _0x4bfbd2;if(_0x3c8399>=_0x2ce4ba){_0x3c8399=_0x2ce4ba;_0x4bfbd2=0xc8;}else{_0x4bfbd2=0xce;}_0x3c16e7[_0xc839('0x1a')](_0x4bfbd2);return _0x3c16e7[_0xc839('0x21')](_0xc839('0x22'),_0x2fbd53+'-'+_0x3c8399+'/'+_0x2ce4ba)[_0xc839('0x1c')](_0x526c14);}return null;};}function patchUpdates(_0x1b7383){return function(_0x5978f4){try{jsonpatch[_0xc839('0x23')](_0x5978f4,_0x1b7383,!![]);}catch(_0x30a1e3){return BPromise[_0xc839('0x24')](_0x30a1e3);}return _0x5978f4[_0xc839('0x25')]();};}function saveUpdates(_0x1e93a1,_0x548c3a){return function(_0x5a636d){if(_0x5a636d){return _0x5a636d[_0xc839('0x26')](_0x1e93a1)[_0xc839('0x27')](function(_0x52414d){return _0x52414d;});}return null;};}function removeEntity(_0x86a3e2,_0xde7669){return function(_0x68d8cd){if(_0x68d8cd){return _0x68d8cd[_0xc839('0x28')]()[_0xc839('0x27')](function(){_0x86a3e2[_0xc839('0x1a')](0xcc)[_0xc839('0x1b')]();});}};}function handleEntityNotFound(_0xdfd77b,_0xfe3ce3){return function(_0x4b1aab){if(!_0x4b1aab){_0xdfd77b[_0xc839('0x19')](0x194);}return _0x4b1aab;};}function handleError(_0x2e6da4,_0x5e4603){_0x5e4603=_0x5e4603||0x1f4;return function(_0x5703d5){logger[_0xc839('0x29')](_0x5703d5[_0xc839('0x2a')]);if(_0x5703d5[_0xc839('0x2b')]){delete _0x5703d5[_0xc839('0x2b')];}_0x2e6da4[_0xc839('0x1a')](_0x5e4603)[_0xc839('0x2c')](_0x5703d5);};}exports['index']=function(_0x2610f6,_0x32f0fd){var _0xa22a04={},_0x2c48d6={},_0x3c7b4a={'count':0x0,'rows':[]};var _0x483110=_[_0xc839('0x2d')](db[_0xc839('0x2e')][_0xc839('0x2f')],function(_0x48fea3){return{'name':_0x48fea3[_0xc839('0x30')],'type':_0x48fea3['type'][_0xc839('0x31')]};});_0x2c48d6[_0xc839('0x32')]=_[_0xc839('0x2d')](_0x483110,_0xc839('0x2b'));_0x2c48d6[_0xc839('0x33')]=_[_0xc839('0x34')](_0x2610f6[_0xc839('0x33')]);_0x2c48d6[_0xc839('0x35')]=_[_0xc839('0x36')](_0x2c48d6[_0xc839('0x32')],_0x2c48d6[_0xc839('0x33')]);_0xa22a04[_0xc839('0x37')]=_['intersection'](_0x2c48d6[_0xc839('0x32')],qs[_0xc839('0x38')](_0x2610f6[_0xc839('0x33')][_0xc839('0x38')]));_0xa22a04[_0xc839('0x37')]=_0xa22a04[_0xc839('0x37')]['length']?_0xa22a04[_0xc839('0x37')]:_0x2c48d6[_0xc839('0x32')];if(!_0x2610f6[_0xc839('0x33')][_0xc839('0x39')](_0xc839('0x3a'))){_0xa22a04[_0xc839('0x1f')]=qs[_0xc839('0x1f')](_0x2610f6['query']['limit']);_0xa22a04[_0xc839('0x1d')]=qs['offset'](_0x2610f6[_0xc839('0x33')][_0xc839('0x1d')]);}_0xa22a04[_0xc839('0x3b')]=qs[_0xc839('0x3c')](_0x2610f6[_0xc839('0x33')][_0xc839('0x3c')]);_0xa22a04[_0xc839('0x3d')]=qs[_0xc839('0x35')](_[_0xc839('0x3e')](_0x2610f6['query'],_0x2c48d6['filters']),_0x483110);if(_0x2610f6[_0xc839('0x33')][_0xc839('0x3f')]){_0xa22a04[_0xc839('0x3d')]=_[_0xc839('0x40')](_0xa22a04[_0xc839('0x3d')],{'$or':_[_0xc839('0x2d')](_0x483110,function(_0x3a80b3){if(_0x3a80b3[_0xc839('0x41')]!==_0xc839('0x42')){var _0x3e5cf1={};_0x3e5cf1[_0x3a80b3[_0xc839('0x2b')]]={'$like':'%'+_0x2610f6[_0xc839('0x33')][_0xc839('0x3f')]+'%'};return _0x3e5cf1;}})});}_0xa22a04=_[_0xc839('0x40')]({},_0xa22a04,_0x2610f6[_0xc839('0x43')]);var _0x138187={'where':_0xa22a04[_0xc839('0x3d')]};return db['CmHopperHistory'][_0xc839('0x20')](_0x138187)[_0xc839('0x27')](function(_0x5b9321){_0x3c7b4a[_0xc839('0x20')]=_0x5b9321;if(_0x2610f6[_0xc839('0x33')][_0xc839('0x44')]){_0xa22a04[_0xc839('0x45')]=[{'all':!![]}];}return db['CmHopperHistory'][_0xc839('0x46')](_0xa22a04);})[_0xc839('0x27')](function(_0x3c325d){_0x3c7b4a[_0xc839('0x47')]=_0x3c325d;return _0x3c7b4a;})['then'](respondWithFilteredResult(_0x32f0fd,_0xa22a04))[_0xc839('0x48')](handleError(_0x32f0fd,null));};exports['show']=function(_0x4612bb,_0x13d345){var _0x540f2a={'raw':!![],'where':{'id':_0x4612bb['params']['id']}},_0x47577f={};_0x47577f[_0xc839('0x32')]=_[_0xc839('0x34')](db[_0xc839('0x2e')][_0xc839('0x2f')]);_0x47577f['query']=_['keys'](_0x4612bb['query']);_0x47577f['filters']=_[_0xc839('0x36')](_0x47577f[_0xc839('0x32')],_0x47577f['query']);_0x540f2a[_0xc839('0x37')]=_['intersection'](_0x47577f[_0xc839('0x32')],qs[_0xc839('0x38')](_0x4612bb[_0xc839('0x33')][_0xc839('0x38')]));_0x540f2a['attributes']=_0x540f2a['attributes'][_0xc839('0x49')]?_0x540f2a[_0xc839('0x37')]:_0x47577f[_0xc839('0x32')];if(_0x4612bb[_0xc839('0x33')][_0xc839('0x44')]){_0x540f2a[_0xc839('0x45')]=[{'all':!![]}];}_0x540f2a=_[_0xc839('0x40')]({},_0x540f2a,_0x4612bb[_0xc839('0x43')]);return db['CmHopperHistory'][_0xc839('0x4a')](_0x540f2a)[_0xc839('0x27')](handleEntityNotFound(_0x13d345,null))[_0xc839('0x27')](respondWithResult(_0x13d345,null))['catch'](handleError(_0x13d345,null));};exports[_0xc839('0x4b')]=function(_0x2dc7db,_0x59bb43){return db['CmHopperHistory']['create'](_0x2dc7db[_0xc839('0x4c')],{})[_0xc839('0x27')](respondWithResult(_0x59bb43,0xc9))[_0xc839('0x48')](handleError(_0x59bb43,null));};exports['describe']=function(_0x4c3d1b,_0x1e697c){return db['CmHopperHistory']['describe']()[_0xc839('0x27')](respondWithResult(_0x1e697c,null))[_0xc839('0x48')](handleError(_0x1e697c,null));};exports['update']=function(_0x168421,_0x417e7a){if(_0x168421[_0xc839('0x4c')][_0xc839('0x4d')]){delete _0x168421['body']['uniqueid'];}return db['CmHopperHistory'][_0xc839('0x4a')]({'where':{'uniqueid':_0x168421[_0xc839('0x4e')]['id']}})['then'](handleEntityNotFound(_0x417e7a,null))[_0xc839('0x27')](saveUpdates(_0x168421[_0xc839('0x4c')],null))[_0xc839('0x27')](respondWithResult(_0x417e7a,null))['catch'](handleError(_0x417e7a,null));}; \ No newline at end of file +var _0xcfd5=['crypto','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','error','stack','name','send','index','map','CmHopperHistory','rawAttributes','fieldName','type','key','model','query','keys','filters','fields','attributes','length','hasOwnProperty','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','params','intersection','options','find','body','catch','describe','uniqueid','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x4f39de,_0x595d15){var _0xe8eeb9=function(_0x4cd423){while(--_0x4cd423){_0x4f39de['push'](_0x4f39de['shift']());}};_0xe8eeb9(++_0x595d15);}(_0xcfd5,0x112));var _0x5cfd=function(_0xde9c14,_0x5947d4){_0xde9c14=_0xde9c14-0x0;var _0x14fedd=_0xcfd5[_0xde9c14];return _0x14fedd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5cfd('0x0'));var zipdir=require(_0x5cfd('0x1'));var jsonpatch=require(_0x5cfd('0x2'));var rp=require(_0x5cfd('0x3'));var moment=require(_0x5cfd('0x4'));var BPromise=require(_0x5cfd('0x5'));var Mustache=require('mustache');var util=require(_0x5cfd('0x6'));var path=require(_0x5cfd('0x7'));var sox=require(_0x5cfd('0x8'));var csv=require(_0x5cfd('0x9'));var ejs=require(_0x5cfd('0xa'));var fs=require('fs');var fs_extra=require(_0x5cfd('0xb'));var _=require(_0x5cfd('0xc'));var squel=require(_0x5cfd('0xd'));var crypto=require(_0x5cfd('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5cfd('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x5cfd('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x5cfd('0x10'));var hardwareService=require(_0x5cfd('0x11'));var logger=require(_0x5cfd('0x12'))(_0x5cfd('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5cfd('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4c0309,_0x14d3bf){_0x14d3bf=_0x14d3bf||0xcc;return function(_0x54d648){if(_0x54d648){return _0x4c0309[_0x5cfd('0x15')](_0x14d3bf);}return _0x4c0309[_0x5cfd('0x16')](_0x14d3bf)[_0x5cfd('0x17')]();};}function respondWithResult(_0x56b4d4,_0x1f218a){_0x1f218a=_0x1f218a||0xc8;return function(_0x38959b){if(_0x38959b){return _0x56b4d4[_0x5cfd('0x16')](_0x1f218a)[_0x5cfd('0x18')](_0x38959b);}};}function respondWithFilteredResult(_0x46b050,_0x1da81e){return function(_0x10da32){if(_0x10da32){var _0x10d1fe=typeof _0x1da81e['offset']===_0x5cfd('0x19')&&typeof _0x1da81e[_0x5cfd('0x1a')]===_0x5cfd('0x19');var _0x5a78ff=_0x10da32[_0x5cfd('0x1b')];var _0x53754d=_0x10d1fe?0x0:_0x1da81e[_0x5cfd('0x1c')];var _0xb25381=_0x10d1fe?_0x10da32['count']:_0x1da81e['offset']+_0x1da81e[_0x5cfd('0x1a')];var _0x2a2798;if(_0xb25381>=_0x5a78ff){_0xb25381=_0x5a78ff;_0x2a2798=0xc8;}else{_0x2a2798=0xce;}_0x46b050[_0x5cfd('0x16')](_0x2a2798);return _0x46b050[_0x5cfd('0x1d')](_0x5cfd('0x1e'),_0x53754d+'-'+_0xb25381+'/'+_0x5a78ff)[_0x5cfd('0x18')](_0x10da32);}return null;};}function patchUpdates(_0x385a49){return function(_0x34245d){try{jsonpatch[_0x5cfd('0x1f')](_0x34245d,_0x385a49,!![]);}catch(_0x43a142){return BPromise['reject'](_0x43a142);}return _0x34245d[_0x5cfd('0x20')]();};}function saveUpdates(_0x3b0e13,_0x470f29){return function(_0x1eb528){if(_0x1eb528){return _0x1eb528[_0x5cfd('0x21')](_0x3b0e13)[_0x5cfd('0x22')](function(_0x46fe71){return _0x46fe71;});}return null;};}function removeEntity(_0x1c111a,_0x5a914c){return function(_0x2be2d1){if(_0x2be2d1){return _0x2be2d1['destroy']()[_0x5cfd('0x22')](function(){_0x1c111a[_0x5cfd('0x16')](0xcc)[_0x5cfd('0x17')]();});}};}function handleEntityNotFound(_0x5c847f,_0x358f9c){return function(_0x1efd35){if(!_0x1efd35){_0x5c847f[_0x5cfd('0x15')](0x194);}return _0x1efd35;};}function handleError(_0x5cf553,_0x5633db){_0x5633db=_0x5633db||0x1f4;return function(_0x3dbe62){logger[_0x5cfd('0x23')](_0x3dbe62[_0x5cfd('0x24')]);if(_0x3dbe62[_0x5cfd('0x25')]){delete _0x3dbe62[_0x5cfd('0x25')];}_0x5cf553[_0x5cfd('0x16')](_0x5633db)[_0x5cfd('0x26')](_0x3dbe62);};}exports[_0x5cfd('0x27')]=function(_0x410ae7,_0x239a96){var _0x24b586={},_0x12b719={},_0x2f1b50={'count':0x0,'rows':[]};var _0x8b7fa0=_[_0x5cfd('0x28')](db[_0x5cfd('0x29')][_0x5cfd('0x2a')],function(_0x63d80f){return{'name':_0x63d80f[_0x5cfd('0x2b')],'type':_0x63d80f[_0x5cfd('0x2c')][_0x5cfd('0x2d')]};});_0x12b719[_0x5cfd('0x2e')]=_[_0x5cfd('0x28')](_0x8b7fa0,'name');_0x12b719[_0x5cfd('0x2f')]=_[_0x5cfd('0x30')](_0x410ae7[_0x5cfd('0x2f')]);_0x12b719[_0x5cfd('0x31')]=_['intersection'](_0x12b719['model'],_0x12b719[_0x5cfd('0x2f')]);_0x24b586['attributes']=_['intersection'](_0x12b719[_0x5cfd('0x2e')],qs[_0x5cfd('0x32')](_0x410ae7[_0x5cfd('0x2f')]['fields']));_0x24b586[_0x5cfd('0x33')]=_0x24b586[_0x5cfd('0x33')][_0x5cfd('0x34')]?_0x24b586[_0x5cfd('0x33')]:_0x12b719['model'];if(!_0x410ae7[_0x5cfd('0x2f')][_0x5cfd('0x35')]('nolimit')){_0x24b586['limit']=qs[_0x5cfd('0x1a')](_0x410ae7[_0x5cfd('0x2f')][_0x5cfd('0x1a')]);_0x24b586[_0x5cfd('0x1c')]=qs['offset'](_0x410ae7[_0x5cfd('0x2f')][_0x5cfd('0x1c')]);}_0x24b586['order']=qs[_0x5cfd('0x36')](_0x410ae7[_0x5cfd('0x2f')][_0x5cfd('0x36')]);_0x24b586[_0x5cfd('0x37')]=qs[_0x5cfd('0x31')](_[_0x5cfd('0x38')](_0x410ae7[_0x5cfd('0x2f')],_0x12b719[_0x5cfd('0x31')]),_0x8b7fa0);if(_0x410ae7[_0x5cfd('0x2f')]['filter']){_0x24b586['where']=_[_0x5cfd('0x39')](_0x24b586['where'],{'$or':_[_0x5cfd('0x28')](_0x8b7fa0,function(_0x28e9ee){if(_0x28e9ee[_0x5cfd('0x2c')]!==_0x5cfd('0x3a')){var _0x447184={};_0x447184[_0x28e9ee['name']]={'$like':'%'+_0x410ae7[_0x5cfd('0x2f')][_0x5cfd('0x3b')]+'%'};return _0x447184;}})});}_0x24b586=_[_0x5cfd('0x39')]({},_0x24b586,_0x410ae7['options']);var _0x51218d={'where':_0x24b586[_0x5cfd('0x37')]};return db[_0x5cfd('0x29')][_0x5cfd('0x1b')](_0x51218d)[_0x5cfd('0x22')](function(_0x3d6bba){_0x2f1b50['count']=_0x3d6bba;if(_0x410ae7['query'][_0x5cfd('0x3c')]){_0x24b586[_0x5cfd('0x3d')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x5cfd('0x3e')](_0x24b586);})[_0x5cfd('0x22')](function(_0x59eae3){_0x2f1b50[_0x5cfd('0x3f')]=_0x59eae3;return _0x2f1b50;})['then'](respondWithFilteredResult(_0x239a96,_0x24b586))['catch'](handleError(_0x239a96,null));};exports['show']=function(_0x3785,_0x1ab837){var _0x1ee2ad={'raw':!![],'where':{'id':_0x3785[_0x5cfd('0x40')]['id']}},_0x2edf9e={};_0x2edf9e['model']=_[_0x5cfd('0x30')](db['CmHopperHistory']['rawAttributes']);_0x2edf9e[_0x5cfd('0x2f')]=_[_0x5cfd('0x30')](_0x3785[_0x5cfd('0x2f')]);_0x2edf9e[_0x5cfd('0x31')]=_[_0x5cfd('0x41')](_0x2edf9e['model'],_0x2edf9e[_0x5cfd('0x2f')]);_0x1ee2ad[_0x5cfd('0x33')]=_[_0x5cfd('0x41')](_0x2edf9e[_0x5cfd('0x2e')],qs[_0x5cfd('0x32')](_0x3785[_0x5cfd('0x2f')][_0x5cfd('0x32')]));_0x1ee2ad[_0x5cfd('0x33')]=_0x1ee2ad[_0x5cfd('0x33')][_0x5cfd('0x34')]?_0x1ee2ad['attributes']:_0x2edf9e[_0x5cfd('0x2e')];if(_0x3785[_0x5cfd('0x2f')][_0x5cfd('0x3c')]){_0x1ee2ad[_0x5cfd('0x3d')]=[{'all':!![]}];}_0x1ee2ad=_['merge']({},_0x1ee2ad,_0x3785[_0x5cfd('0x42')]);return db['CmHopperHistory'][_0x5cfd('0x43')](_0x1ee2ad)['then'](handleEntityNotFound(_0x1ab837,null))['then'](respondWithResult(_0x1ab837,null))['catch'](handleError(_0x1ab837,null));};exports['create']=function(_0x212ad4,_0x421c57){return db['CmHopperHistory']['create'](_0x212ad4[_0x5cfd('0x44')],{})[_0x5cfd('0x22')](respondWithResult(_0x421c57,0xc9))[_0x5cfd('0x45')](handleError(_0x421c57,null));};exports[_0x5cfd('0x46')]=function(_0x29476c,_0x3b021e){return db[_0x5cfd('0x29')][_0x5cfd('0x46')]()[_0x5cfd('0x22')](respondWithResult(_0x3b021e,null))[_0x5cfd('0x45')](handleError(_0x3b021e,null));};exports[_0x5cfd('0x21')]=function(_0x320078,_0x2d968b){if(_0x320078[_0x5cfd('0x44')][_0x5cfd('0x47')]){delete _0x320078['body']['uniqueid'];}return db['CmHopperHistory']['find']({'where':{'uniqueid':_0x320078[_0x5cfd('0x40')]['id']}})[_0x5cfd('0x22')](handleEntityNotFound(_0x2d968b,null))['then'](saveUpdates(_0x320078[_0x5cfd('0x44')],null))[_0x5cfd('0x22')](respondWithResult(_0x2d968b,null))[_0x5cfd('0x45')](handleError(_0x2d968b,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index b61c5aa..f5cf6ed 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 _0xe2fe=['endtime','uniqueid','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','CmHopperHistory'];(function(_0x254a19,_0x7b092b){var _0xba020a=function(_0x231bb3){while(--_0x231bb3){_0x254a19['push'](_0x254a19['shift']());}};_0xba020a(++_0x7b092b);}(_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 logger=require('../../config/logger')(_0xee2f('0x1'));var moment=require('moment');var BPromise=require(_0xee2f('0x2'));var rp=require(_0xee2f('0x3'));var fs=require('fs');var path=require(_0xee2f('0x4'));var rimraf=require(_0xee2f('0x5'));var config=require(_0xee2f('0x6'));var attributes=require('./cmHopperHistory.attributes');module[_0xee2f('0x7')]=function(_0x2b7e7c,_0x49926b){return _0x2b7e7c[_0xee2f('0x8')](_0xee2f('0x9'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0xee2f('0xa'),'fields':['endtime']},{'name':_0xee2f('0xb'),'fields':[_0xee2f('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa413=['CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','../../config/logger','moment','bluebird','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','define'];(function(_0x3b5fab,_0x7a34b7){var _0x5a7060=function(_0x484b79){while(--_0x484b79){_0x3b5fab['push'](_0x3b5fab['shift']());}};_0x5a7060(++_0x7a34b7);}(_0xa413,0x1e5));var _0x3a41=function(_0x2c7ce1,_0x4e1887){_0x2c7ce1=_0x2c7ce1-0x0;var _0x39ed87=_0xa413[_0x2c7ce1];return _0x39ed87;};'use strict';var _=require(_0x3a41('0x0'));var util=require('util');var logger=require(_0x3a41('0x1'))('api');var moment=require(_0x3a41('0x2'));var BPromise=require(_0x3a41('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3a41('0x4'));var config=require(_0x3a41('0x5'));var attributes=require(_0x3a41('0x6'));module[_0x3a41('0x7')]=function(_0x25d3e0,_0x1af004){return _0x25d3e0[_0x3a41('0x8')](_0x3a41('0x9'),attributes,{'tableName':_0x3a41('0xa'),'paranoid':![],'indexes':[{'name':_0x3a41('0xb'),'fields':[_0x3a41('0xb')]},{'name':'uniqueid','fields':[_0x3a41('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index d183cfa..c63f32d 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 _0x502a=['outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayCallersExit','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','`state`\x20=\x2020,\x201,\x20null','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','findAll','raw','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','debug','AvgHandleTime','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','where','campaign','name','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x502a,0xd8));var _0xa502=function(_0x495a42,_0x4c3390){_0x495a42=_0x495a42-0x0;var _0xd2f46=_0x502a[_0x495a42];return _0xd2f46;};'use strict';var _=require(_0xa502('0x0'));var util=require(_0xa502('0x1'));var moment=require('moment');var BPromise=require(_0xa502('0x2'));var rs=require(_0xa502('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa502('0x4'));var logger=require('../../config/logger')(_0xa502('0x5'));var config=require(_0xa502('0x6'));var jayson=require(_0xa502('0x7'));var client=jayson[_0xa502('0x8')][_0xa502('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x489407,_0x329022,_0x29fb03){return new BPromise(function(_0x4d30f2,_0x4e4e5d){return client[_0xa502('0xa')](_0x489407,_0x29fb03)[_0xa502('0xb')](function(_0x5251fa){logger[_0xa502('0xc')](_0xa502('0xd'),_0x329022,_0xa502('0xe'));logger['debug'](_0xa502('0xf'),_0x329022,_0xa502('0xe'),JSON[_0xa502('0x10')](_0x5251fa));if(_0x5251fa['error']){if(_0x5251fa[_0xa502('0x11')][_0xa502('0x12')]===0x1f4){logger['error'](_0xa502('0xd'),_0x329022,_0x5251fa[_0xa502('0x11')]['message']);return _0x4e4e5d(_0x5251fa[_0xa502('0x11')][_0xa502('0x13')]);}logger[_0xa502('0x11')]('CmHopperHistory,\x20%s,\x20%s',_0x329022,_0x5251fa[_0xa502('0x11')][_0xa502('0x13')]);return _0x4d30f2(_0x5251fa[_0xa502('0x11')]['message']);}else{logger[_0xa502('0xc')](_0xa502('0xd'),_0x329022,_0xa502('0xe'));_0x4d30f2(_0x5251fa[_0xa502('0x14')][_0xa502('0x13')]);}})[_0xa502('0x15')](function(_0x3107a0){logger[_0xa502('0x11')](_0xa502('0xd'),_0x329022,_0x3107a0);_0x4e4e5d(_0x3107a0);});});}exports[_0xa502('0x16')]=function(_0x1445ec){var _0x315455=this;return new Promise(function(_0x1d2f3d,_0x166453){return db[_0xa502('0x17')][_0xa502('0x18')](_0x1445ec[_0xa502('0x19')],{'raw':_0x1445ec[_0xa502('0x1a')]?_0x1445ec['options']['raw']===undefined?!![]:![]:!![]})[_0xa502('0xb')](function(_0x331d55){logger[_0xa502('0xc')](_0xa502('0x16'),_0x1445ec);logger[_0xa502('0x1b')](_0xa502('0x16'),_0x1445ec,JSON[_0xa502('0x10')](_0x331d55));_0x1d2f3d(_0x331d55);})[_0xa502('0x15')](function(_0x287f03){logger[_0xa502('0x11')](_0xa502('0x16'),_0x287f03[_0xa502('0x13')],_0x1445ec);_0x166453(_0x315455['error'](0x1f4,_0x287f03[_0xa502('0x13')]));});});};exports[_0xa502('0x1c')]=function(_0x28bc20){var _0x1fd61d=this;return new Promise(function(_0x570f23,_0x10f7e8){return db[_0xa502('0x17')]['findAll']({'raw':_0x28bc20['options']?_0x28bc20[_0xa502('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x28bc20[_0xa502('0x1a')]?_0x28bc20[_0xa502('0x1a')]['where']||null:null,'attributes':[[db[_0xa502('0x1d')]['fn'](_0xa502('0x1e'),db['sequelize'][_0xa502('0x1f')]('id')),_0xa502('0x20')],[db[_0xa502('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0xa502('0x21')](_0xa502('0x22')))),'predictiveIntervalAnsweredCalls'],[db['sequelize']['fn'](_0xa502('0x1e'),db[_0xa502('0x1d')]['fn']('IF',db['sequelize'][_0xa502('0x21')](_0xa502('0x23')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0xa502('0x1d')]['fn'](_0xa502('0x1e'),db[_0xa502('0x1d')]['fn']('IF',db[_0xa502('0x1d')]['literal']('`state`\x20=\x2011,\x201,\x20null'))),_0xa502('0x24')],[db[_0xa502('0x1d')]['fn'](_0xa502('0x25'),db[_0xa502('0x1d')]['fn']('IF',db[_0xa502('0x1d')][_0xa502('0x21')](_0xa502('0x26')))),'predictiveIntervalAvgHoldtime'],[db['sequelize']['fn'](_0xa502('0x25'),db['sequelize']['fn']('IF',db[_0xa502('0x1d')][_0xa502('0x21')](_0xa502('0x27')))),_0xa502('0x28')]]})['then'](function(_0x4c60fa){logger[_0xa502('0xc')](_0xa502('0x1c'),_0x28bc20);logger[_0xa502('0x1b')]('AvgHandleTime',_0x28bc20,JSON['stringify'](_0x4c60fa));_0x570f23(_0x4c60fa);})[_0xa502('0x15')](function(_0x1a3ef1){logger[_0xa502('0x11')](_0xa502('0x1c'),_0x1a3ef1['message'],_0x28bc20);_0x10f7e8(_0x1fd61d[_0xa502('0x11')](0x1f4,_0x1a3ef1[_0xa502('0x13')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x53a38a){var _0x367bb0=this;return new Promise(function(_0x4be5c2,_0x254bbc){return db[_0xa502('0x17')]['findAll']({'raw':_0x53a38a[_0xa502('0x1a')]?_0x53a38a['options']['raw']===undefined?!![]:![]:!![],'where':_0x53a38a[_0xa502('0x1a')]?_0x53a38a[_0xa502('0x1a')][_0xa502('0x29')]||null:null,'attributes':[[_0xa502('0x2a'),_0xa502('0x2b')],[db['sequelize']['fn'](_0xa502('0x1e'),db[_0xa502('0x1d')]['fn']('IF',db[_0xa502('0x1d')][_0xa502('0x21')]('`state`\x20=\x200,\x201,\x20null'))),_0xa502('0x2c')],[db[_0xa502('0x1d')]['fn'](_0xa502('0x1e'),db[_0xa502('0x1d')]['fn']('IF',db['sequelize']['literal'](_0xa502('0x2d')))),_0xa502('0x2e')],[db[_0xa502('0x1d')]['fn']('COUNT',db[_0xa502('0x1d')]['fn']('IF',db['sequelize']['literal'](_0xa502('0x22')))),_0xa502('0x2f')],[db[_0xa502('0x1d')]['fn'](_0xa502('0x1e'),db[_0xa502('0x1d')]['fn']('IF',db[_0xa502('0x1d')]['literal']('`state`\x20=\x205,\x201,\x20null'))),_0xa502('0x30')],[db[_0xa502('0x1d')]['fn'](_0xa502('0x1e'),db['sequelize']['fn']('IF',db['sequelize'][_0xa502('0x21')](_0xa502('0x31')))),_0xa502('0x32')],[db[_0xa502('0x1d')]['fn'](_0xa502('0x1e'),db['sequelize']['fn']('IF',db[_0xa502('0x1d')]['literal'](_0xa502('0x33')))),'outboundDropCallsDayTimeout'],[db[_0xa502('0x1d')]['fn'](_0xa502('0x1e'),db[_0xa502('0x1d')]['fn']('IF',db[_0xa502('0x1d')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xa502('0x34')],[db[_0xa502('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xa502('0x1d')][_0xa502('0x21')]('`state`\x20=\x2012,\x201,\x20null'))),_0xa502('0x35')],[db[_0xa502('0x1d')]['fn']('COUNT',db[_0xa502('0x1d')]['fn']('IF',db[_0xa502('0x1d')][_0xa502('0x21')](_0xa502('0x36')))),_0xa502('0x37')],[db['sequelize']['fn'](_0xa502('0x1e'),db[_0xa502('0x1d')]['fn']('IF',db[_0xa502('0x1d')]['literal']('`state`\x20=\x2014,\x201,\x20null'))),'outboundOriginateFailureCallsDay'],[db[_0xa502('0x1d')]['fn'](_0xa502('0x1e'),db[_0xa502('0x1d')]['fn']('IF',db[_0xa502('0x1d')]['literal'](_0xa502('0x38')))),_0xa502('0x39')],[db[_0xa502('0x1d')]['fn'](_0xa502('0x1e'),db[_0xa502('0x1d')]['fn']('IF',db['sequelize'][_0xa502('0x21')](_0xa502('0x3a')))),'outboundAnswerAgiCallsDay'],[db[_0xa502('0x1d')]['fn']('COUNT',db[_0xa502('0x1d')]['fn']('IF',db[_0xa502('0x1d')][_0xa502('0x21')](_0xa502('0x3b')))),_0xa502('0x39')],[db[_0xa502('0x1d')]['fn'](_0xa502('0x1e'),db[_0xa502('0x1d')]['fn']('IF',db[_0xa502('0x1d')]['literal']('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),'outboundReCallsDay']],'group':[_0xa502('0x2a')]})['then'](function(_0x18df02){logger[_0xa502('0xc')]('GetVoiceQueueHopperHistory',_0x53a38a);logger[_0xa502('0x1b')](_0xa502('0x3c'),_0x53a38a,JSON[_0xa502('0x10')](_0x18df02));_0x4be5c2(_0x18df02);})[_0xa502('0x15')](function(_0x108221){logger[_0xa502('0x11')](_0xa502('0x3c'),_0x108221[_0xa502('0x13')],_0x53a38a);_0x254bbc(_0x367bb0[_0xa502('0x11')](0x1f4,_0x108221[_0xa502('0x13')]));});});};exports[_0xa502('0x3d')]=function(_0x2b524d){var _0x513331=this;return new Promise(function(_0x950af0,_0x4d9b3a){return db[_0xa502('0x17')][_0xa502('0x3e')]({'raw':_0x2b524d[_0xa502('0x1a')]?_0x2b524d['options'][_0xa502('0x3f')]===undefined?!![]:![]:!![],'where':_0x2b524d[_0xa502('0x1a')]?_0x2b524d[_0xa502('0x1a')][_0xa502('0x29')]||null:null,'attributes':[[_0xa502('0x2a'),_0xa502('0x2b')],[db[_0xa502('0x1d')]['fn'](_0xa502('0x1e'),db[_0xa502('0x1d')]['col']('id')),_0xa502('0x40')],[db[_0xa502('0x1d')]['fn'](_0xa502('0x1e'),db[_0xa502('0x1d')]['fn']('IF',db[_0xa502('0x1d')][_0xa502('0x21')](_0xa502('0x22')))),_0xa502('0x41')]],'group':[_0xa502('0x2a')]})['then'](function(_0x4c9f2c){logger['info'](_0xa502('0x3d'),_0x2b524d);logger[_0xa502('0x1b')](_0xa502('0x3d'),_0x2b524d,JSON['stringify'](_0x4c9f2c));_0x950af0(_0x4c9f2c);})[_0xa502('0x15')](function(_0x3e5463){logger[_0xa502('0x11')](_0xa502('0x3d'),_0x3e5463[_0xa502('0x13')],_0x2b524d);_0x4d9b3a(_0x513331[_0xa502('0x11')](0x1f4,_0x3e5463[_0xa502('0x13')]));});});}; \ No newline at end of file +var _0xa9e0=['util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','CmHopperHistory','create','body','options','raw','then','CreateCmHopperHistory','stringify','AvgHandleTime','findAll','where','COUNT','col','sequelize','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','campaign','name','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','`state`\x20=\x2014,\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','outboundReCallsDay','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','lodash'];(function(_0x28d6b3,_0x56a647){var _0x5001a5=function(_0x160b84){while(--_0x160b84){_0x28d6b3['push'](_0x28d6b3['shift']());}};_0x5001a5(++_0x56a647);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['CreateCmHopperHistory']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')](_0x459eb1[_0x0a9e('0x16')],{'raw':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')][_0x0a9e('0x18')]===undefined?!![]:![]:!![]})[_0x0a9e('0x19')](function(_0x105080){logger['info'](_0x0a9e('0x1a'),_0x459eb1);logger[_0x0a9e('0xd')]('CreateCmHopperHistory',_0x459eb1,JSON[_0x0a9e('0x1b')](_0x105080));_0x106033(_0x105080);})['catch'](function(_0x588269){logger[_0x0a9e('0x10')](_0x0a9e('0x1a'),_0x588269[_0x0a9e('0x11')],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x588269['message']));});});};exports[_0x0a9e('0x1c')]=function(_0x2fb0e4){var _0x3b45bc=this;return new Promise(function(_0x4d00e6,_0x370d86){return db[_0x0a9e('0x14')][_0x0a9e('0x1d')]({'raw':_0x2fb0e4['options']?_0x2fb0e4['options'][_0x0a9e('0x18')]===undefined?!![]:![]:!![],'where':_0x2fb0e4[_0x0a9e('0x17')]?_0x2fb0e4[_0x0a9e('0x17')][_0x0a9e('0x1e')]||null:null,'attributes':[[db['sequelize']['fn'](_0x0a9e('0x1f'),db['sequelize'][_0x0a9e('0x20')]('id')),'predictiveIntervalTotalCalls'],[db[_0x0a9e('0x21')]['fn'](_0x0a9e('0x1f'),db[_0x0a9e('0x21')]['fn']('IF',db[_0x0a9e('0x21')][_0x0a9e('0x22')](_0x0a9e('0x23')))),_0x0a9e('0x24')],[db[_0x0a9e('0x21')]['fn']('COUNT',db[_0x0a9e('0x21')]['fn']('IF',db[_0x0a9e('0x21')][_0x0a9e('0x22')](_0x0a9e('0x25')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0x0a9e('0x21')]['fn'](_0x0a9e('0x1f'),db[_0x0a9e('0x21')]['fn']('IF',db[_0x0a9e('0x21')][_0x0a9e('0x22')](_0x0a9e('0x26')))),_0x0a9e('0x27')],[db[_0x0a9e('0x21')]['fn'](_0x0a9e('0x28'),db['sequelize']['fn']('IF',db[_0x0a9e('0x21')]['literal'](_0x0a9e('0x29')))),_0x0a9e('0x2a')],[db[_0x0a9e('0x21')]['fn'](_0x0a9e('0x28'),db[_0x0a9e('0x21')]['fn']('IF',db['sequelize'][_0x0a9e('0x22')](_0x0a9e('0x2b')))),_0x0a9e('0x2c')]]})[_0x0a9e('0x19')](function(_0x2b45ea){logger[_0x0a9e('0xa')](_0x0a9e('0x1c'),_0x2fb0e4);logger[_0x0a9e('0xd')]('AvgHandleTime',_0x2fb0e4,JSON[_0x0a9e('0x1b')](_0x2b45ea));_0x4d00e6(_0x2b45ea);})['catch'](function(_0x2cc7a0){logger[_0x0a9e('0x10')](_0x0a9e('0x1c'),_0x2cc7a0[_0x0a9e('0x11')],_0x2fb0e4);_0x370d86(_0x3b45bc['error'](0x1f4,_0x2cc7a0[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x2d')]=function(_0x1fa90d){var _0x15de0e=this;return new Promise(function(_0x4853b1,_0x54135e){return db[_0x0a9e('0x14')]['findAll']({'raw':_0x1fa90d[_0x0a9e('0x17')]?_0x1fa90d[_0x0a9e('0x17')][_0x0a9e('0x18')]===undefined?!![]:![]:!![],'where':_0x1fa90d[_0x0a9e('0x17')]?_0x1fa90d['options'][_0x0a9e('0x1e')]||null:null,'attributes':[[_0x0a9e('0x2e'),_0x0a9e('0x2f')],[db['sequelize']['fn'](_0x0a9e('0x1f'),db[_0x0a9e('0x21')]['fn']('IF',db[_0x0a9e('0x21')]['literal']('`state`\x20=\x200,\x201,\x20null'))),_0x0a9e('0x30')],[db[_0x0a9e('0x21')]['fn']('COUNT',db[_0x0a9e('0x21')]['fn']('IF',db[_0x0a9e('0x21')][_0x0a9e('0x22')](_0x0a9e('0x31')))),'outboundNoAnswerCallsDay'],[db['sequelize']['fn'](_0x0a9e('0x1f'),db[_0x0a9e('0x21')]['fn']('IF',db['sequelize'][_0x0a9e('0x22')](_0x0a9e('0x23')))),_0x0a9e('0x32')],[db['sequelize']['fn'](_0x0a9e('0x1f'),db[_0x0a9e('0x21')]['fn']('IF',db[_0x0a9e('0x21')][_0x0a9e('0x22')](_0x0a9e('0x33')))),_0x0a9e('0x34')],[db[_0x0a9e('0x21')]['fn'](_0x0a9e('0x1f'),db[_0x0a9e('0x21')]['fn']('IF',db[_0x0a9e('0x21')][_0x0a9e('0x22')](_0x0a9e('0x35')))),_0x0a9e('0x36')],[db[_0x0a9e('0x21')]['fn'](_0x0a9e('0x1f'),db['sequelize']['fn']('IF',db['sequelize'][_0x0a9e('0x22')](_0x0a9e('0x37')))),_0x0a9e('0x38')],[db[_0x0a9e('0x21')]['fn'](_0x0a9e('0x1f'),db[_0x0a9e('0x21')]['fn']('IF',db[_0x0a9e('0x21')][_0x0a9e('0x22')](_0x0a9e('0x39')))),_0x0a9e('0x3a')],[db[_0x0a9e('0x21')]['fn'](_0x0a9e('0x1f'),db['sequelize']['fn']('IF',db[_0x0a9e('0x21')][_0x0a9e('0x22')](_0x0a9e('0x3b')))),_0x0a9e('0x3c')],[db[_0x0a9e('0x21')]['fn'](_0x0a9e('0x1f'),db[_0x0a9e('0x21')]['fn']('IF',db[_0x0a9e('0x21')]['literal'](_0x0a9e('0x3d')))),'outboundBlacklistCallsDay'],[db[_0x0a9e('0x21')]['fn'](_0x0a9e('0x1f'),db[_0x0a9e('0x21')]['fn']('IF',db['sequelize'][_0x0a9e('0x22')](_0x0a9e('0x3e')))),_0x0a9e('0x3f')],[db[_0x0a9e('0x21')]['fn'](_0x0a9e('0x1f'),db[_0x0a9e('0x21')]['fn']('IF',db[_0x0a9e('0x21')]['literal'](_0x0a9e('0x40')))),_0x0a9e('0x41')],[db[_0x0a9e('0x21')]['fn'](_0x0a9e('0x1f'),db[_0x0a9e('0x21')]['fn']('IF',db[_0x0a9e('0x21')][_0x0a9e('0x22')](_0x0a9e('0x42')))),_0x0a9e('0x43')],[db['sequelize']['fn'](_0x0a9e('0x1f'),db[_0x0a9e('0x21')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2020,\x201,\x20null'))),_0x0a9e('0x41')],[db[_0x0a9e('0x21')]['fn'](_0x0a9e('0x1f'),db[_0x0a9e('0x21')]['fn']('IF',db[_0x0a9e('0x21')][_0x0a9e('0x22')](_0x0a9e('0x44')))),_0x0a9e('0x45')]],'group':['campaign']})['then'](function(_0x53975a){logger[_0x0a9e('0xa')](_0x0a9e('0x2d'),_0x1fa90d);logger[_0x0a9e('0xd')]('GetVoiceQueueHopperHistory',_0x1fa90d,JSON[_0x0a9e('0x1b')](_0x53975a));_0x4853b1(_0x53975a);})[_0x0a9e('0x13')](function(_0x53d113){logger['error'](_0x0a9e('0x2d'),_0x53d113['message'],_0x1fa90d);_0x54135e(_0x15de0e[_0x0a9e('0x10')](0x1f4,_0x53d113['message']));});});};exports[_0x0a9e('0x46')]=function(_0x3c20b2){var _0x439340=this;return new Promise(function(_0x53613a,_0x2f82da){return db[_0x0a9e('0x14')]['findAll']({'raw':_0x3c20b2['options']?_0x3c20b2[_0x0a9e('0x17')][_0x0a9e('0x18')]===undefined?!![]:![]:!![],'where':_0x3c20b2['options']?_0x3c20b2[_0x0a9e('0x17')]['where']||null:null,'attributes':[[_0x0a9e('0x2e'),'name'],[db[_0x0a9e('0x21')]['fn']('COUNT',db['sequelize']['col']('id')),_0x0a9e('0x47')],[db['sequelize']['fn'](_0x0a9e('0x1f'),db[_0x0a9e('0x21')]['fn']('IF',db[_0x0a9e('0x21')][_0x0a9e('0x22')](_0x0a9e('0x23')))),_0x0a9e('0x48')]],'group':[_0x0a9e('0x2e')]})[_0x0a9e('0x19')](function(_0x4e67ab){logger[_0x0a9e('0xa')](_0x0a9e('0x46'),_0x3c20b2);logger[_0x0a9e('0xd')](_0x0a9e('0x46'),_0x3c20b2,JSON[_0x0a9e('0x1b')](_0x4e67ab));_0x53613a(_0x4e67ab);})[_0x0a9e('0x13')](function(_0x5d86e9){logger[_0x0a9e('0x10')](_0x0a9e('0x46'),_0x5d86e9['message'],_0x3c20b2);_0x2f82da(_0x439340[_0x0a9e('0x10')](0x1f4,_0x5d86e9['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 5877690..2739173 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 _0xcbfa=['/describe','describe','/:id','show','post','create','put','update','exports','multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated'];(function(_0x1b8a0e,_0x10c37a){var _0x3b750e=function(_0x559eef){while(--_0x559eef){_0x1b8a0e['push'](_0x1b8a0e['shift']());}};_0x3b750e(++_0x10c37a);}(_0xcbfa,0x172));var _0xacbf=function(_0x5f0ea6,_0x4245c7){_0x5f0ea6=_0x5f0ea6-0x0;var _0x324271=_0xcbfa[_0x5f0ea6];return _0x324271;};'use strict';var multer=require(_0xacbf('0x0'));var util=require('util');var path=require(_0xacbf('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xacbf('0x2')]();var fs_extra=require(_0xacbf('0x3'));var auth=require(_0xacbf('0x4'));var interaction=require(_0xacbf('0x5'));var config=require(_0xacbf('0x6'));var controller=require(_0xacbf('0x7'));router[_0xacbf('0x8')]('/',auth[_0xacbf('0x9')](),controller['index']);router[_0xacbf('0x8')](_0xacbf('0xa'),auth[_0xacbf('0x9')](),controller[_0xacbf('0xb')]);router['get'](_0xacbf('0xc'),auth[_0xacbf('0x9')](),controller[_0xacbf('0xd')]);router[_0xacbf('0xe')]('/',auth[_0xacbf('0x9')](),controller[_0xacbf('0xf')]);router[_0xacbf('0x10')](_0xacbf('0xc'),auth[_0xacbf('0x9')](),controller[_0xacbf('0x11')]);module[_0xacbf('0x12')]=router; \ No newline at end of file +var _0xe883=['post','create','update','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopperHistory.controller','get','isAuthenticated','index','describe','/:id','show'];(function(_0x11b68e,_0x3ed50f){var _0x563ee0=function(_0x193ef9){while(--_0x193ef9){_0x11b68e['push'](_0x11b68e['shift']());}};_0x563ee0(++_0x3ed50f);}(_0xe883,0x10e));var _0x3e88=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0xe883[_0x12fc8d];return _0x3f9d04;};'use strict';var multer=require(_0x3e88('0x0'));var util=require(_0x3e88('0x1'));var path=require('path');var timeout=require(_0x3e88('0x2'));var express=require(_0x3e88('0x3'));var router=express[_0x3e88('0x4')]();var fs_extra=require(_0x3e88('0x5'));var auth=require(_0x3e88('0x6'));var interaction=require(_0x3e88('0x7'));var config=require('../../config/environment');var controller=require(_0x3e88('0x8'));router[_0x3e88('0x9')]('/',auth[_0x3e88('0xa')](),controller[_0x3e88('0xb')]);router[_0x3e88('0x9')]('/describe',auth[_0x3e88('0xa')](),controller[_0x3e88('0xc')]);router[_0x3e88('0x9')](_0x3e88('0xd'),auth['isAuthenticated'](),controller[_0x3e88('0xe')]);router[_0x3e88('0xf')]('/',auth[_0x3e88('0xa')](),controller[_0x3e88('0x10')]);router['put'](_0x3e88('0xd'),auth[_0x3e88('0xa')](),controller[_0x3e88('0x11')]);module[_0x3e88('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 71c5613..248d4a3 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 _0xa37e=['name','STRING'];(function(_0x227dae,_0x45fd74){var _0x999afe=function(_0x1299fe){while(--_0x1299fe){_0x227dae['push'](_0x227dae['shift']());}};_0x999afe(++_0x45fd74);}(_0xa37e,0x97));var _0xea37=function(_0x12ba90,_0x52f1d0){_0x12ba90=_0x12ba90-0x0;var _0x5ca68e=_0xa37e[_0x12ba90];return _0x5ca68e;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xea37('0x0')],'unique':_0xea37('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xea37('0x0')]},'dialPrefix':{'type':Sequelize[_0xea37('0x0')]}}; \ No newline at end of file +var _0xa44a=['STRING','sequelize','name'];(function(_0x114151,_0x163761){var _0x138bc8=function(_0x54ddc2){while(--_0x54ddc2){_0x114151['push'](_0x114151['shift']());}};_0x138bc8(++_0x163761);}(_0xa44a,0x9a));var _0xaa44=function(_0x1e0f75,_0x497973){_0x1e0f75=_0x1e0f75-0x0;var _0x422d75=_0xa44a[_0x1e0f75];return _0x422d75;};'use strict';var Sequelize=require(_0xaa44('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xaa44('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xaa44('0x2')]},'dialPrefix':{'type':Sequelize[_0xaa44('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 06ea9f4..b894806 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 _0x0cb9=['select','cm_contacts','c.ListId\x20=\x20?','distinct','field','c.cf_','customField_','alias','item','from','cm_contact_has_items','ItemTypeId\x20=\x20?','additionalPhone_','description','CmContactId\x20=\x20c.id','toString','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','addCustomField','sequelize','addCustomFields','Sequelize','TEXT','text','number','INTEGER','switch','defaultValue','queryInterface','addColumn','cf_%s','getCustomFields','findAndCountAll','getGlobalCustomFields','addAgents','omit','spread','userCmList:save','removeAgents','isArray','userCmList:remove','emit','getAgents','User','info','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','fs-extra','lodash','crypto','desk.js','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','get','Lists','UserProfileResource','error','stack','name','send','index','map','CmList','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','filter','merge','options','where','includeAll','rows','params','fields','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','Disposition','getDispositions','findOne','pick','include','removeDispositions','ids','addContacts','CmContact','tags','join','ListId','push','each','success','dataValues','errors','message','Malformed\x20request\x20syntax','CustomFields','concat','format','cf_%d','raw','getContactsCsv','ContactItemType','OrderBy','CmCustomField','findAll'];(function(_0x132b04,_0x5ce854){var _0x42dfcd=function(_0x107047){while(--_0x107047){_0x132b04['push'](_0x132b04['shift']());}};_0x42dfcd(++_0x5ce854);}(_0x0cb9,0xdc));var _0x90cb=function(_0x12f4eb,_0x15a8c0){_0x12f4eb=_0x12f4eb-0x0;var _0x2e2011=_0x0cb9[_0x12f4eb];return _0x2e2011;};'use strict';var emlformat=require(_0x90cb('0x0'));var rimraf=require(_0x90cb('0x1'));var zipdir=require(_0x90cb('0x2'));var jsonpatch=require(_0x90cb('0x3'));var rp=require(_0x90cb('0x4'));var moment=require(_0x90cb('0x5'));var BPromise=require(_0x90cb('0x6'));var Mustache=require(_0x90cb('0x7'));var util=require('util');var path=require(_0x90cb('0x8'));var sox=require(_0x90cb('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x90cb('0xa'));var _=require(_0x90cb('0xb'));var squel=require('squel');var crypto=require(_0x90cb('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x90cb('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x90cb('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x90cb('0xf'))(_0x90cb('0x10'));var utils=require(_0x90cb('0x11'));var config=require(_0x90cb('0x12'));var licenseUtil=require(_0x90cb('0x13'));var db=require(_0x90cb('0x14'))['db'];var csv_results;config[_0x90cb('0x15')]=_['defaults'](config[_0x90cb('0x15')],{'host':_0x90cb('0x16'),'port':0x18eb});var socket=require(_0x90cb('0x17'))(new Redis(config[_0x90cb('0x15')]));require(_0x90cb('0x18'))[_0x90cb('0x19')](socket);function respondWithStatusCode(_0x232f4b,_0x2ceda6){_0x2ceda6=_0x2ceda6||0xcc;return function(_0x59158b){if(_0x59158b){return _0x232f4b[_0x90cb('0x1a')](_0x2ceda6);}return _0x232f4b[_0x90cb('0x1b')](_0x2ceda6)[_0x90cb('0x1c')]();};}function respondWithResult(_0x293c02,_0x3e5e93){_0x3e5e93=_0x3e5e93||0xc8;return function(_0xf2e30b){if(_0xf2e30b){return _0x293c02[_0x90cb('0x1b')](_0x3e5e93)[_0x90cb('0x1d')](_0xf2e30b);}};}function respondWithFilteredResult(_0x4bbdcf,_0x535d44){return function(_0x525bb9){if(_0x525bb9){var _0x5f3e40=typeof _0x535d44[_0x90cb('0x1e')]===_0x90cb('0x1f')&&typeof _0x535d44[_0x90cb('0x20')]==='undefined';var _0x8ec09c=_0x525bb9[_0x90cb('0x21')];var _0x2b15a5=_0x5f3e40?0x0:_0x535d44[_0x90cb('0x1e')];var _0x5d100f=_0x5f3e40?_0x525bb9[_0x90cb('0x21')]:_0x535d44[_0x90cb('0x1e')]+_0x535d44[_0x90cb('0x20')];var _0x69d470;if(_0x5d100f>=_0x8ec09c){_0x5d100f=_0x8ec09c;_0x69d470=0xc8;}else{_0x69d470=0xce;}_0x4bbdcf[_0x90cb('0x1b')](_0x69d470);return _0x4bbdcf[_0x90cb('0x22')](_0x90cb('0x23'),_0x2b15a5+'-'+_0x5d100f+'/'+_0x8ec09c)[_0x90cb('0x1d')](_0x525bb9);}return null;};}function patchUpdates(_0x4d330e){return function(_0x468125){try{jsonpatch[_0x90cb('0x24')](_0x468125,_0x4d330e,!![]);}catch(_0x211f90){return BPromise[_0x90cb('0x25')](_0x211f90);}return _0x468125[_0x90cb('0x26')]();};}function saveUpdates(_0x405a98,_0x462a76){return function(_0x31fed4){if(_0x31fed4){return _0x31fed4['update'](_0x405a98)[_0x90cb('0x27')](function(_0x264222){return _0x264222;});}return null;};}function removeEntity(_0x56991d,_0x11dfe3){return function(_0x362f0a){if(_0x362f0a){return _0x362f0a[_0x90cb('0x28')]()['then'](function(){var _0x4827f2=_0x362f0a[_0x90cb('0x29')]({'plain':!![]});var _0x421927=_0x90cb('0x2a');return db[_0x90cb('0x2b')][_0x90cb('0x28')]({'where':{'type':_0x421927,'resourceId':_0x4827f2['id']}})[_0x90cb('0x27')](function(){return _0x362f0a;});})[_0x90cb('0x27')](function(){_0x56991d['status'](0xcc)[_0x90cb('0x1c')]();});}};}function handleEntityNotFound(_0xaae570,_0x5c6610){return function(_0x106cdc){if(!_0x106cdc){_0xaae570['sendStatus'](0x194);}return _0x106cdc;};}function handleError(_0x58b6bd,_0x2cb4c2){_0x2cb4c2=_0x2cb4c2||0x1f4;return function(_0x51da21){logger[_0x90cb('0x2c')](_0x51da21[_0x90cb('0x2d')]);if(_0x51da21[_0x90cb('0x2e')]){delete _0x51da21[_0x90cb('0x2e')];}_0x58b6bd[_0x90cb('0x1b')](_0x2cb4c2)[_0x90cb('0x2f')](_0x51da21);};}exports[_0x90cb('0x30')]=function(_0x306f4f,_0x160924){var _0x337822={},_0x16cef0={},_0x564d85={'count':0x0,'rows':[]};var _0x59d917=_[_0x90cb('0x31')](db[_0x90cb('0x32')][_0x90cb('0x33')],function(_0x3b5a4c){return{'name':_0x3b5a4c[_0x90cb('0x34')],'type':_0x3b5a4c[_0x90cb('0x35')]['key']};});_0x16cef0[_0x90cb('0x36')]=_[_0x90cb('0x31')](_0x59d917,_0x90cb('0x2e'));_0x16cef0[_0x90cb('0x37')]=_[_0x90cb('0x38')](_0x306f4f['query']);_0x16cef0[_0x90cb('0x39')]=_[_0x90cb('0x3a')](_0x16cef0[_0x90cb('0x36')],_0x16cef0['query']);_0x337822['attributes']=_['intersection'](_0x16cef0[_0x90cb('0x36')],qs['fields'](_0x306f4f[_0x90cb('0x37')]['fields']));_0x337822[_0x90cb('0x3b')]=_0x337822[_0x90cb('0x3b')][_0x90cb('0x3c')]?_0x337822['attributes']:_0x16cef0[_0x90cb('0x36')];if(!_0x306f4f[_0x90cb('0x37')][_0x90cb('0x3d')](_0x90cb('0x3e'))){_0x337822[_0x90cb('0x20')]=qs[_0x90cb('0x20')](_0x306f4f[_0x90cb('0x37')]['limit']);_0x337822[_0x90cb('0x1e')]=qs[_0x90cb('0x1e')](_0x306f4f[_0x90cb('0x37')][_0x90cb('0x1e')]);}_0x337822[_0x90cb('0x3f')]=qs[_0x90cb('0x40')](_0x306f4f[_0x90cb('0x37')][_0x90cb('0x40')]);_0x337822['where']=qs[_0x90cb('0x39')](_['pick'](_0x306f4f[_0x90cb('0x37')],_0x16cef0[_0x90cb('0x39')]),_0x59d917);if(_0x306f4f[_0x90cb('0x37')][_0x90cb('0x41')]){_0x337822['where']=_[_0x90cb('0x42')](_0x337822['where'],{'$or':_[_0x90cb('0x31')](_0x59d917,function(_0x3ad9d4){if(_0x3ad9d4[_0x90cb('0x35')]!=='VIRTUAL'){var _0x185d16={};_0x185d16[_0x3ad9d4[_0x90cb('0x2e')]]={'$like':'%'+_0x306f4f['query']['filter']+'%'};return _0x185d16;}})});}_0x337822=_[_0x90cb('0x42')]({},_0x337822,_0x306f4f[_0x90cb('0x43')]);var _0x3c09b6={'where':_0x337822[_0x90cb('0x44')]};return db['CmList']['count'](_0x3c09b6)['then'](function(_0x4485c5){_0x564d85[_0x90cb('0x21')]=_0x4485c5;if(_0x306f4f[_0x90cb('0x37')][_0x90cb('0x45')]){_0x337822['include']=[{'all':!![]}];}return db[_0x90cb('0x32')]['findAll'](_0x337822);})[_0x90cb('0x27')](function(_0x3b8ab8){_0x564d85[_0x90cb('0x46')]=_0x3b8ab8;return _0x564d85;})[_0x90cb('0x27')](respondWithFilteredResult(_0x160924,_0x337822))['catch'](handleError(_0x160924,null));};exports['show']=function(_0x10d698,_0x3843e0){var _0x5b3605={'raw':![],'where':{'id':_0x10d698[_0x90cb('0x47')]['id']}},_0x9de902={};_0x9de902[_0x90cb('0x36')]=_[_0x90cb('0x38')](db[_0x90cb('0x32')][_0x90cb('0x33')]);_0x9de902['query']=_[_0x90cb('0x38')](_0x10d698[_0x90cb('0x37')]);_0x9de902[_0x90cb('0x39')]=_[_0x90cb('0x3a')](_0x9de902[_0x90cb('0x36')],_0x9de902[_0x90cb('0x37')]);_0x5b3605[_0x90cb('0x3b')]=_['intersection'](_0x9de902[_0x90cb('0x36')],qs[_0x90cb('0x48')](_0x10d698[_0x90cb('0x37')][_0x90cb('0x48')]));_0x5b3605['attributes']=_0x5b3605[_0x90cb('0x3b')][_0x90cb('0x3c')]?_0x5b3605[_0x90cb('0x3b')]:_0x9de902[_0x90cb('0x36')];if(_0x10d698[_0x90cb('0x37')]['includeAll']){_0x5b3605['include']=[{'all':!![]}];}_0x5b3605=_['merge']({},_0x5b3605,_0x10d698['options']);return db['CmList'][_0x90cb('0x49')](_0x5b3605)[_0x90cb('0x27')](handleEntityNotFound(_0x3843e0,null))['then'](respondWithResult(_0x3843e0,null))[_0x90cb('0x4a')](handleError(_0x3843e0,null));};exports['create']=function(_0x46a2a4,_0x4eae27){return db[_0x90cb('0x32')][_0x90cb('0x4b')](_0x46a2a4[_0x90cb('0x4c')],{})[_0x90cb('0x27')](function(_0xfec3ff){var _0x214626=_0x46a2a4[_0x90cb('0x4d')][_0x90cb('0x29')]({'plain':!![]});if(!_0x214626)throw new Error(_0x90cb('0x4e'));if(_0x214626[_0x90cb('0x4f')]===_0x90cb('0x4d')){var _0x2535aa=_0xfec3ff[_0x90cb('0x29')]({'plain':!![]});var _0x229d5d='Lists';return db[_0x90cb('0x50')][_0x90cb('0x49')]({'where':{'name':_0x229d5d,'userProfileId':_0x214626['userProfileId']},'raw':!![]})['then'](function(_0xe95fd8){if(_0xe95fd8&&_0xe95fd8[_0x90cb('0x51')]===0x0){return db['UserProfileResource']['create']({'name':_0x2535aa[_0x90cb('0x2e')],'resourceId':_0x2535aa['id'],'type':_0xe95fd8[_0x90cb('0x2e')],'sectionId':_0xe95fd8['id']},{})['then'](function(){return _0xfec3ff;});}else{return _0xfec3ff;}})[_0x90cb('0x4a')](function(_0xa7fcb6){logger[_0x90cb('0x2c')](_0x90cb('0x52'),_0xa7fcb6);throw _0xa7fcb6;});}return _0xfec3ff;})[_0x90cb('0x27')](respondWithResult(_0x4eae27,0xc9))[_0x90cb('0x4a')](handleError(_0x4eae27,null));};exports['update']=function(_0x131dd8,_0xf199af){if(_0x131dd8[_0x90cb('0x4c')]['id']){delete _0x131dd8[_0x90cb('0x4c')]['id'];}return db[_0x90cb('0x32')][_0x90cb('0x49')]({'where':{'id':_0x131dd8['params']['id']}})['then'](handleEntityNotFound(_0xf199af,null))[_0x90cb('0x27')](saveUpdates(_0x131dd8[_0x90cb('0x4c')],null))['then'](respondWithResult(_0xf199af,null))[_0x90cb('0x4a')](handleError(_0xf199af,null));};exports[_0x90cb('0x28')]=function(_0x4c4ad9,_0x6a6e54){return db[_0x90cb('0x32')][_0x90cb('0x49')]({'where':{'id':_0x4c4ad9[_0x90cb('0x47')]['id']}})['then'](handleEntityNotFound(_0x6a6e54,null))[_0x90cb('0x27')](removeEntity(_0x6a6e54,null))[_0x90cb('0x4a')](handleError(_0x6a6e54,null));};exports[_0x90cb('0x53')]=function(_0x45c7fd,_0x5a73f4){return db[_0x90cb('0x32')]['describe']()[_0x90cb('0x27')](respondWithResult(_0x5a73f4,null))[_0x90cb('0x4a')](handleError(_0x5a73f4,null));};exports[_0x90cb('0x54')]=function(_0x2dffa3,_0x2dda43,_0x5e7fc0){if(_0x2dffa3['body']['id']){delete _0x2dffa3['body']['id'];}return db[_0x90cb('0x32')][_0x90cb('0x49')]({'where':{'id':_0x2dffa3['params']['id']}})[_0x90cb('0x27')](handleEntityNotFound(_0x2dda43,null))[_0x90cb('0x27')](function(_0x50ce4e){if(_0x50ce4e){_0x2dffa3['body']['ListId']=_0x50ce4e['id'];return db[_0x90cb('0x55')][_0x90cb('0x4b')](_0x2dffa3[_0x90cb('0x4c')]);}})[_0x90cb('0x27')](respondWithResult(_0x2dda43,null))[_0x90cb('0x4a')](handleError(_0x2dda43,null));};exports[_0x90cb('0x56')]=function(_0x1c2855,_0x522858,_0x259434){var _0x3b2550={'raw':![],'where':{}};var _0x4c1a07={};var _0x96bb1e={'count':0x0,'rows':[]};return db[_0x90cb('0x32')][_0x90cb('0x57')]({'where':{'id':_0x1c2855[_0x90cb('0x47')]['id']}})['then'](handleEntityNotFound(_0x522858,null))[_0x90cb('0x27')](function(_0x5b3b41){if(_0x5b3b41){_0x4c1a07['model']=_[_0x90cb('0x38')](db[_0x90cb('0x55')][_0x90cb('0x33')]);_0x4c1a07[_0x90cb('0x37')]=_[_0x90cb('0x38')](_0x1c2855['query']);_0x4c1a07['filters']=_[_0x90cb('0x3a')](_0x4c1a07['model'],_0x4c1a07[_0x90cb('0x37')]);_0x3b2550[_0x90cb('0x3b')]=_[_0x90cb('0x3a')](_0x4c1a07['model'],qs[_0x90cb('0x48')](_0x1c2855[_0x90cb('0x37')]['fields']));_0x3b2550[_0x90cb('0x3b')]=_0x3b2550[_0x90cb('0x3b')][_0x90cb('0x3c')]?_0x3b2550[_0x90cb('0x3b')]:_0x4c1a07[_0x90cb('0x36')];if(!_0x1c2855[_0x90cb('0x37')][_0x90cb('0x3d')](_0x90cb('0x3e'))){_0x3b2550[_0x90cb('0x20')]=qs[_0x90cb('0x20')](_0x1c2855[_0x90cb('0x37')][_0x90cb('0x20')]);_0x3b2550[_0x90cb('0x1e')]=qs[_0x90cb('0x1e')](_0x1c2855['query']['offset']);}_0x3b2550['order']=qs[_0x90cb('0x40')](_0x1c2855['query'][_0x90cb('0x40')]);_0x3b2550[_0x90cb('0x44')]=qs[_0x90cb('0x39')](_[_0x90cb('0x58')](_0x1c2855[_0x90cb('0x37')],_0x4c1a07[_0x90cb('0x39')]));_0x3b2550['where']['ListId']=_0x5b3b41['id'];if(_0x1c2855[_0x90cb('0x37')][_0x90cb('0x41')]){_0x3b2550[_0x90cb('0x44')]=_[_0x90cb('0x42')](_0x3b2550[_0x90cb('0x44')],{'$or':_[_0x90cb('0x31')](_0x3b2550[_0x90cb('0x3b')],function(_0x6a290b){var _0x5e1f7b={};_0x5e1f7b[_0x6a290b]={'$like':'%'+_0x1c2855[_0x90cb('0x37')][_0x90cb('0x41')]+'%'};return _0x5e1f7b;})});}_0x3b2550=_[_0x90cb('0x42')]({},_0x3b2550,_0x1c2855[_0x90cb('0x43')]);return db[_0x90cb('0x55')]['count']({'where':_0x3b2550[_0x90cb('0x44')]})['then'](function(_0x2fe107){_0x96bb1e[_0x90cb('0x21')]=_0x2fe107;if(_0x1c2855['query'][_0x90cb('0x45')]){_0x3b2550[_0x90cb('0x59')]=[{'all':!![]}];}return db[_0x90cb('0x55')]['findAll'](_0x3b2550);})[_0x90cb('0x27')](function(_0x2598e6){_0x96bb1e[_0x90cb('0x46')]=_0x2598e6;return _0x96bb1e;});}})[_0x90cb('0x27')](respondWithFilteredResult(_0x522858,_0x3b2550))[_0x90cb('0x4a')](handleError(_0x522858,null));};exports[_0x90cb('0x5a')]=function(_0x4a2eaf,_0x5ceb2c,_0x6c7571){return db[_0x90cb('0x32')]['find']({'where':{'id':_0x4a2eaf[_0x90cb('0x47')]['id']}})[_0x90cb('0x27')](handleEntityNotFound(_0x5ceb2c,null))[_0x90cb('0x27')](function(_0x8bd39c){if(_0x8bd39c){return _0x8bd39c[_0x90cb('0x5a')](_0x4a2eaf[_0x90cb('0x37')][_0x90cb('0x5b')]);}})['then'](respondWithStatusCode(_0x5ceb2c,null))[_0x90cb('0x4a')](handleError(_0x5ceb2c,null));};exports[_0x90cb('0x5c')]=function(_0xa20166,_0x5d74bd,_0x2bb003){return db[_0x90cb('0x32')][_0x90cb('0x49')]({'where':{'id':_0xa20166[_0x90cb('0x47')]['id']}})[_0x90cb('0x27')](handleEntityNotFound(_0x5d74bd,null))[_0x90cb('0x27')](function(_0x147239){if(_0x147239){var _0x2a1c68=[];var _0x160c40={'success':[],'errors':[]};return db[_0x90cb('0x5d')][_0x90cb('0x53')]()[_0x90cb('0x27')](function(_0x5b6b95){if(_0xa20166[_0x90cb('0x4c')]['tags']&&_['isArray'](_0xa20166[_0x90cb('0x4c')][_0x90cb('0x5e')])){if(_0xa20166[_0x90cb('0x4c')][_0x90cb('0x5e')][_0x90cb('0x3c')]){_0xa20166['body'][_0x90cb('0x5e')]=_0xa20166['body']['tags'][_0x90cb('0x5f')](';')+';';}else{_0xa20166['body'][_0x90cb('0x5e')]=null;}}else{_0xa20166[_0x90cb('0x4c')][_0x90cb('0x5e')]=null;}if(_0xa20166[_0x90cb('0x4c')]&&_['isArray'](_0xa20166[_0x90cb('0x4c')])){for(var _0x238b01=0x0;_0x238b01<_0xa20166[_0x90cb('0x4c')]['length'];_0x238b01+=0x1){_0xa20166[_0x90cb('0x4c')][_0x238b01][_0x90cb('0x60')]=_0xa20166[_0x90cb('0x47')]['id'];_0x2a1c68[_0x90cb('0x61')](_0xa20166[_0x90cb('0x4c')][_0x238b01]);}return BPromise[_0x90cb('0x62')](_0x2a1c68,function(_0x395aa4){return db[_0x90cb('0x5d')][_0x90cb('0x4b')](_['omit'](_0x395aa4,[_0x90cb('0x5b'),'id'])||{},{'fields':_['keys'](_0x5b6b95),'raw':!![]})['then'](function(_0x4084dd){_0x160c40[_0x90cb('0x63')][_0x90cb('0x61')](_0x4084dd[_0x90cb('0x64')]);})[_0x90cb('0x4a')](function(_0x42ecb4){_0x160c40[_0x90cb('0x65')][_0x90cb('0x61')]({'data':_0x395aa4,'error':_0x42ecb4[_0x90cb('0x66')]});});})[_0x90cb('0x27')](function(_0x14b87f){return _0x160c40;})[_0x90cb('0x4a')](function(_0x3f78b3){return _0x3f78b3;});}else{_0x5d74bd[_0x90cb('0x1b')](0x190)[_0x90cb('0x1d')]({'message':_0x90cb('0x67')});}});}})[_0x90cb('0x27')](respondWithResult(_0x5d74bd,null))[_0x90cb('0x4a')](handleError(_0x5d74bd,null));};exports['getContacts']=function(_0x90e7d5,_0x3579fc,_0x5f1fd4){var _0x5c9ad9;return db[_0x90cb('0x32')][_0x90cb('0x49')]({'where':{'id':_0x90e7d5[_0x90cb('0x47')]['id']},'include':[{'model':db['CmCustomField'],'as':_0x90cb('0x68')}]})[_0x90cb('0x27')](handleEntityNotFound(_0x3579fc,null))[_0x90cb('0x27')](function(_0x574081){if(_0x574081){_0x5c9ad9=_0x574081;return db[_0x90cb('0x5d')][_0x90cb('0x33')];}})[_0x90cb('0x27')](function(_0x3afc55){if(_0x3afc55){var _0x375082={};var _0x3a83f0={};_0x3a83f0[_0x90cb('0x36')]=_[_0x90cb('0x69')](_[_0x90cb('0x38')](_0x3afc55),_[_0x90cb('0x31')](_0x5c9ad9['CustomFields'],function(_0x40ac8a){return util[_0x90cb('0x6a')](_0x90cb('0x6b'),_0x40ac8a['id']);}));_0x3a83f0[_0x90cb('0x37')]=_[_0x90cb('0x38')](_0x90e7d5[_0x90cb('0x37')]);_0x3a83f0[_0x90cb('0x39')]=_[_0x90cb('0x3a')](_0x3a83f0['model'],_0x3a83f0['query']);_0x375082[_0x90cb('0x3b')]=_[_0x90cb('0x3a')](_0x3a83f0['model'],qs[_0x90cb('0x48')](_0x90e7d5[_0x90cb('0x37')][_0x90cb('0x48')]));_0x375082[_0x90cb('0x3b')]=_0x375082[_0x90cb('0x3b')]['length']?_0x375082['attributes']:_0x3a83f0[_0x90cb('0x36')];if(!_0x90e7d5['query'][_0x90cb('0x3d')](_0x90cb('0x3e'))){_0x375082[_0x90cb('0x20')]=qs[_0x90cb('0x20')](_0x90e7d5[_0x90cb('0x37')][_0x90cb('0x20')]);_0x375082[_0x90cb('0x1e')]=qs[_0x90cb('0x1e')](_0x90e7d5[_0x90cb('0x37')][_0x90cb('0x1e')]);}_0x375082[_0x90cb('0x3f')]=qs['sort'](_0x90e7d5['query'][_0x90cb('0x40')]);_0x375082[_0x90cb('0x44')]=qs['filters'](_[_0x90cb('0x58')](_0x90e7d5['query'],_0x3a83f0['filters']));_0x375082[_0x90cb('0x6c')]=!![];if(_0x90e7d5['query']['filter']){_0x375082[_0x90cb('0x44')]=_[_0x90cb('0x42')](_0x375082['where'],{'$or':_[_0x90cb('0x31')](_0x375082[_0x90cb('0x3b')],function(_0xa47bd8){var _0x55c376={};_0x55c376[_0xa47bd8]={'$like':'%'+_0x90e7d5[_0x90cb('0x37')][_0x90cb('0x41')]+'%'};return _0x55c376;})});}_0x375082=_[_0x90cb('0x42')]({},_0x375082,_0x90e7d5[_0x90cb('0x43')]);return _0x5c9ad9['getContacts'](_0x375082);}})['then'](respondWithResult(_0x3579fc,null))['catch'](handleError(_0x3579fc,null));};exports[_0x90cb('0x6d')]=function(_0x3c81b2,_0x55cb00,_0x153f29){var _0x38dc0f;var _0x96b026;var _0x5722b9;var _0x40fcd6=_0x3c81b2[_0x90cb('0x47')]['id'];csv_results=[];return db[_0x90cb('0x6e')]['findAll']({'attributes':['id','name'],'raw':!![],'order':[_0x90cb('0x6f')]})[_0x90cb('0x27')](function(_0x93e128){_0x38dc0f=_0x93e128;var _0xe5abf3=_['keys'](db[_0x90cb('0x5d')]['rawAttributes']);return db[_0x90cb('0x70')][_0x90cb('0x71')]({'raw':!![],'attributes':['id','alias']})[_0x90cb('0x27')](function(_0x86dd50){_0x96b026=_0x86dd50;var _0x37d639=squel[_0x90cb('0x72')]()['fields'](_0xe5abf3)['from'](_0x90cb('0x73'),'c')[_0x90cb('0x44')](_0x90cb('0x74'),_0x40fcd6)[_0x90cb('0x44')]('c.deletedAt\x20is\x20null')[_0x90cb('0x75')]();for(var _0xa67c49=0x0;_0xa67c49<_0x96b026[_0x90cb('0x3c')];_0xa67c49++){_0x37d639[_0x90cb('0x76')](_0x90cb('0x77')+_0x96b026[_0xa67c49]['id'],_0x90cb('0x78')+_0x96b026[_0xa67c49][_0x90cb('0x79')]);}for(var _0xa67c49=0x0;_0xa67c49<_0x38dc0f[_0x90cb('0x3c')];_0xa67c49++){_0x37d639['field'](squel[_0x90cb('0x72')]()[_0x90cb('0x76')](_0x90cb('0x7a'))[_0x90cb('0x7b')](_0x90cb('0x7c'))[_0x90cb('0x44')](_0x90cb('0x7d'),_0x38dc0f[_0xa67c49]['id'])['where']('CmContactId\x20=\x20c.id'),_0x90cb('0x7e')+_0x38dc0f[_0xa67c49][_0x90cb('0x2e')]);_0x37d639[_0x90cb('0x76')](squel[_0x90cb('0x72')]()[_0x90cb('0x76')](_0x90cb('0x7f'))[_0x90cb('0x7b')]('cm_contact_has_items')[_0x90cb('0x44')](_0x90cb('0x7d'),_0x38dc0f[_0xa67c49]['id'])[_0x90cb('0x44')](_0x90cb('0x80')),'description_additionalPhone_'+_0x38dc0f[_0xa67c49][_0x90cb('0x2e')]);}var _0x5d270a=[];_0x5d270a['push'](_0x37d639[_0x90cb('0x81')]());BPromise['each'](_0x5d270a,handleQuery)[_0x90cb('0x27')](function(_0x49baac){handleQuery(_0x37d639[_0x90cb('0x81')]());var _0x1b04d7=csv_results[0x0];if(!_[_0x90cb('0x82')](_0x1b04d7)){var _0x203a03=toCsv(_0x1b04d7);var _0x1d9976=Date[_0x90cb('0x83')]();fs[_0x90cb('0x84')](util['format'](_0x90cb('0x85'),_0x40fcd6,_0x1d9976),_0x203a03);_0x55cb00[_0x90cb('0x86')](_0x90cb('0x87'),_0x90cb('0x88')+util[_0x90cb('0x6a')](_0x90cb('0x89'),_0x40fcd6,_0x1d9976));_0x55cb00[_0x90cb('0x86')](_0x90cb('0x8a'),_0x90cb('0x8b'));return _0x55cb00['download'](util[_0x90cb('0x6a')](_0x90cb('0x85'),_0x40fcd6,_0x1d9976));}else{return _0x55cb00[_0x90cb('0x1a')](0xcc);}});});});};exports[_0x90cb('0x8c')]=function(_0x8cf5d7,_0x585fae,_0xe607d3){var _0xd829cd;delete _0x8cf5d7['body']['id'];return db['CmList'][_0x90cb('0x57')]({'where':{'id':_0x8cf5d7[_0x90cb('0x47')]['id']}})[_0x90cb('0x27')](handleEntityNotFound(_0x585fae,null))[_0x90cb('0x27')](function(_0x52b24a){if(_0x52b24a){return db[_0x90cb('0x8d')]['transaction'](function(_0x2b81fb){return db['CmCustomField']['create'](_0x8cf5d7['body'],{'transaction':_0x2b81fb})[_0x90cb('0x27')](function(_0x4aa237){_0xd829cd=_0x4aa237;return _0x52b24a[_0x90cb('0x8e')](_0x4aa237,{'transaction':_0x2b81fb});})[_0x90cb('0x27')](function(){var _0x7582a4={'type':db[_0x90cb('0x8f')][_0x90cb('0x90')],'transaction':_0x2b81fb};switch(_0x8cf5d7[_0x90cb('0x4c')][_0x90cb('0x35')]){case _0x90cb('0x91'):_0x7582a4['type']=db[_0x90cb('0x8f')][_0x90cb('0x90')];break;case _0x90cb('0x92'):_0x7582a4[_0x90cb('0x35')]=db[_0x90cb('0x8f')][_0x90cb('0x93')];break;case _0x90cb('0x94'):_0x7582a4['type']=db[_0x90cb('0x8f')]['BOOLEAN'];_0x7582a4[_0x90cb('0x95')]=![];break;default:}return db[_0x90cb('0x8d')][_0x90cb('0x96')][_0x90cb('0x97')](_0x90cb('0x73'),util[_0x90cb('0x6a')](_0x90cb('0x98'),_0xd829cd['id']),_0x7582a4);})[_0x90cb('0x27')](function(){return _0xd829cd;});});}})[_0x90cb('0x27')](respondWithResult(_0x585fae,null))[_0x90cb('0x4a')](handleError(_0x585fae,null));};exports[_0x90cb('0x99')]=function(_0x2f807d,_0x3c7bd7,_0x35ec60){var _0x365f0d={};var _0x478e59={};var _0x507120;var _0x37a3f7;return db[_0x90cb('0x32')][_0x90cb('0x57')]({'where':{'id':_0x2f807d[_0x90cb('0x47')]['id']}})['then'](handleEntityNotFound(_0x3c7bd7,null))[_0x90cb('0x27')](function(_0x213106){if(_0x213106){_0x507120=_0x213106;_0x478e59[_0x90cb('0x36')]=_['keys'](db[_0x90cb('0x70')]['rawAttributes']);_0x478e59['query']=_[_0x90cb('0x38')](_0x2f807d[_0x90cb('0x37')]);_0x478e59[_0x90cb('0x39')]=_[_0x90cb('0x3a')](_0x478e59[_0x90cb('0x36')],_0x478e59[_0x90cb('0x37')]);_0x365f0d[_0x90cb('0x3b')]=_[_0x90cb('0x3a')](_0x478e59[_0x90cb('0x36')],qs[_0x90cb('0x48')](_0x2f807d[_0x90cb('0x37')][_0x90cb('0x48')]));_0x365f0d[_0x90cb('0x3b')]=_0x365f0d['attributes']['length']?_0x365f0d['attributes']:_0x478e59[_0x90cb('0x36')];_0x365f0d[_0x90cb('0x3f')]=qs['sort'](_0x2f807d[_0x90cb('0x37')][_0x90cb('0x40')]);_0x365f0d[_0x90cb('0x44')]=qs['filters'](_[_0x90cb('0x58')](_0x2f807d['query'],_0x478e59[_0x90cb('0x39')]));_0x365f0d[_0x90cb('0x44')]=_[_0x90cb('0x42')](_0x365f0d[_0x90cb('0x44')],{'$or':[{'ListId':_0x213106['id']},{'ListId':null}]});if(_0x2f807d['query'][_0x90cb('0x41')]){_0x365f0d[_0x90cb('0x44')]=_[_0x90cb('0x42')](_0x365f0d['where'],{'$or':_[_0x90cb('0x31')](_0x365f0d['attributes'],function(_0xea845a){var _0x4d0c7a={};_0x4d0c7a[_0xea845a]={'$like':'%'+_0x2f807d[_0x90cb('0x37')][_0x90cb('0x41')]+'%'};return _0x4d0c7a;})});}_0x365f0d=_['merge']({},_0x365f0d,_0x2f807d[_0x90cb('0x43')]);return db[_0x90cb('0x70')][_0x90cb('0x9a')](_0x365f0d);}})[_0x90cb('0x27')](respondWithResult(_0x3c7bd7,null))[_0x90cb('0x4a')](handleError(_0x3c7bd7,null));};exports[_0x90cb('0x9b')]=function(_0x38baaa,_0x2dc7c8){return db[_0x90cb('0x70')][_0x90cb('0x9a')]({'where':{'ListId':null}})[_0x90cb('0x27')](handleEntityNotFound(_0x2dc7c8,null))[_0x90cb('0x27')](function(_0x4bc634){return _0x4bc634;})[_0x90cb('0x27')](respondWithResult(_0x2dc7c8,null))[_0x90cb('0x4a')](handleError(_0x2dc7c8,null));};exports[_0x90cb('0x9c')]=function(_0x27cec9,_0x187972,_0x15b231){return db[_0x90cb('0x32')][_0x90cb('0x49')]({'where':{'id':_0x27cec9[_0x90cb('0x47')]['id']}})['then'](handleEntityNotFound(_0x187972,null))['then'](function(_0x16022c){if(_0x16022c){return _0x16022c['addAgents'](_0x27cec9[_0x90cb('0x4c')]['ids'],_[_0x90cb('0x9d')](_0x27cec9[_0x90cb('0x4c')],[_0x90cb('0x5b'),'id'])||{})[_0x90cb('0x9e')](function(_0x3114d2){for(var _0x321942=0x0;_0x321942<_0x27cec9[_0x90cb('0x4c')][_0x90cb('0x5b')]['length'];_0x321942+=0x1){socket['emit'](_0x90cb('0x9f'),{'UserId':Number(_0x27cec9[_0x90cb('0x4c')][_0x90cb('0x5b')][_0x321942]),'CmListId':Number(_0x27cec9[_0x90cb('0x47')]['id'])});}return _0x3114d2;});}})[_0x90cb('0x27')](respondWithResult(_0x187972,null))['catch'](handleError(_0x187972,null));};exports[_0x90cb('0xa0')]=function(_0x18ec10,_0x1b2eb7,_0x12bbbe){return db[_0x90cb('0x32')][_0x90cb('0x49')]({'where':{'id':_0x18ec10[_0x90cb('0x47')]['id']}})[_0x90cb('0x27')](handleEntityNotFound(_0x1b2eb7,null))['then'](function(_0x43159e){if(_0x43159e){return _0x43159e[_0x90cb('0xa0')](_0x18ec10[_0x90cb('0x37')][_0x90cb('0x5b')])[_0x90cb('0x27')](function(){if(_[_0x90cb('0xa1')](_0x18ec10[_0x90cb('0x37')][_0x90cb('0x5b')])){for(var _0xf93758=0x0;_0xf93758<_0x18ec10[_0x90cb('0x37')][_0x90cb('0x5b')][_0x90cb('0x3c')];_0xf93758+=0x1){socket['emit'](_0x90cb('0xa2'),{'UserId':Number(_0x18ec10['query'][_0x90cb('0x5b')][_0xf93758]),'CmListId':Number(_0x18ec10['params']['id'])});}}else{socket[_0x90cb('0xa3')](_0x90cb('0xa2'),{'UserId':Number(_0x18ec10['query'][_0x90cb('0x5b')]),'CmListId':Number(_0x18ec10[_0x90cb('0x47')]['id'])});}});}})[_0x90cb('0x27')](respondWithStatusCode(_0x1b2eb7,null))[_0x90cb('0x4a')](handleError(_0x1b2eb7,null));};exports[_0x90cb('0xa4')]=function(_0x317078,_0x37b902,_0x8485c4){var _0x205404={};var _0x581c03={};var _0x59a2f6;var _0x15105a;return db[_0x90cb('0x32')]['findOne']({'where':{'id':_0x317078[_0x90cb('0x47')]['id']}})[_0x90cb('0x27')](handleEntityNotFound(_0x37b902,null))['then'](function(_0x3c6ff6){if(_0x3c6ff6){_0x59a2f6=_0x3c6ff6;_0x581c03[_0x90cb('0x36')]=_['keys'](db[_0x90cb('0xa5')][_0x90cb('0x33')]);_0x581c03['query']=_[_0x90cb('0x38')](_0x317078[_0x90cb('0x37')]);_0x581c03[_0x90cb('0x39')]=_['intersection'](_0x581c03['model'],_0x581c03[_0x90cb('0x37')]);_0x205404[_0x90cb('0x3b')]=_[_0x90cb('0x3a')](_0x581c03[_0x90cb('0x36')],qs['fields'](_0x317078[_0x90cb('0x37')]['fields']));_0x205404[_0x90cb('0x3b')]=_0x205404[_0x90cb('0x3b')][_0x90cb('0x3c')]?_0x205404['attributes']:_0x581c03['model'];_0x205404[_0x90cb('0x3f')]=qs[_0x90cb('0x40')](_0x317078[_0x90cb('0x37')][_0x90cb('0x40')]);_0x205404[_0x90cb('0x44')]=qs[_0x90cb('0x39')](_[_0x90cb('0x58')](_0x317078['query'],_0x581c03[_0x90cb('0x39')]));if(_0x317078[_0x90cb('0x37')][_0x90cb('0x41')]){_0x205404[_0x90cb('0x44')]=_['merge'](_0x205404[_0x90cb('0x44')],{'$or':_[_0x90cb('0x31')](_0x205404[_0x90cb('0x3b')],function(_0x3221e4){var _0x2fdf0b={};_0x2fdf0b[_0x3221e4]={'$like':'%'+_0x317078[_0x90cb('0x37')]['filter']+'%'};return _0x2fdf0b;})});}_0x205404=_['merge']({},_0x205404,_0x317078[_0x90cb('0x43')]);return _0x59a2f6[_0x90cb('0xa4')](_0x205404);}})[_0x90cb('0x27')](function(_0x50d5d8){if(_0x50d5d8){_0x15105a=_0x50d5d8[_0x90cb('0x3c')];if(!_0x317078[_0x90cb('0x37')][_0x90cb('0x3d')](_0x90cb('0x3e'))){_0x205404[_0x90cb('0x20')]=qs[_0x90cb('0x20')](_0x317078['query'][_0x90cb('0x20')]);_0x205404[_0x90cb('0x1e')]=qs[_0x90cb('0x1e')](_0x317078['query'][_0x90cb('0x1e')]);}return _0x59a2f6[_0x90cb('0xa4')](_0x205404);}})[_0x90cb('0x27')](function(_0x41171e){if(_0x41171e){return _0x41171e?{'count':_0x15105a,'rows':_0x41171e}:null;}})[_0x90cb('0x27')](respondWithResult(_0x37b902,null))['catch'](handleError(_0x37b902,null));};function handleQuery(_0x443766){logger[_0x90cb('0xa6')](_0x443766);return db[_0x90cb('0x8d')][_0x90cb('0x37')](_0x443766)[_0x90cb('0x9e')](function(_0x2cb580){csv_results[_0x90cb('0x61')](_0x2cb580);})[_0x90cb('0x4a')](function(_0x133f43){logger[_0x90cb('0x2c')](_0x133f43[_0x90cb('0x66')]);});} \ No newline at end of file +var _0x0796=['getGlobalCustomFields','addAgents','spread','emit','userCmList:save','userCmList:remove','getAgents','User','rimraf','request-promise','mustache','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./cmList.socket','register','status','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','UserProfileResource','end','sendStatus','stack','name','send','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','filter','merge','options','includeAll','include','CmList','findAll','params','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','Lists','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','addDisposition','ListId','Disposition','getDispositions','findOne','rawAttributes','length','hasOwnProperty','pick','rows','removeDispositions','ids','addContacts','tags','isArray','join','push','each','CmContact','success','dataValues','errors','message','json','Malformed\x20request\x20syntax','getContacts','CustomFields','concat','cf_%d','ContactItemType','CmCustomField','alias','from','cm_contacts','c.ListId\x20=\x20?','distinct','field','c.cf_','customField_','select','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','description','description_additionalPhone_','toString','isEmpty','writeFileSync','format','/tmp/list_%d_%s.csv','setHeader','Content-disposition','Content-type','text/csv','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT','number','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cf_%s','getCustomFields','findAndCountAll'];(function(_0x2ee83c,_0x220f7d){var _0x1734d8=function(_0x5dfb10){while(--_0x5dfb10){_0x2ee83c['push'](_0x2ee83c['shift']());}};_0x1734d8(++_0x220f7d);}(_0x0796,0x148));var _0x6079=function(_0x45c1f7,_0x4ede39){_0x45c1f7=_0x45c1f7-0x0;var _0x4659cd=_0x0796[_0x45c1f7];return _0x4659cd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6079('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6079('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6079('0x2'));var util=require('util');var path=require('path');var sox=require(_0x6079('0x3'));var csv=require('to-csv');var ejs=require(_0x6079('0x4'));var fs=require('fs');var fs_extra=require(_0x6079('0x5'));var _=require(_0x6079('0x6'));var squel=require(_0x6079('0x7'));var crypto=require(_0x6079('0x8'));var jsforce=require(_0x6079('0x9'));var deskjs=require(_0x6079('0xa'));var toCsv=require(_0x6079('0xb'));var querystring=require(_0x6079('0xc'));var Papa=require(_0x6079('0xd'));var Redis=require(_0x6079('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x6079('0xf'));var as=require(_0x6079('0x10'));var hardwareService=require(_0x6079('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x6079('0x12'));var config=require(_0x6079('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x6079('0x14'))['db'];var csv_results;config[_0x6079('0x15')]=_[_0x6079('0x16')](config[_0x6079('0x15')],{'host':_0x6079('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6079('0x15')]));require(_0x6079('0x18'))[_0x6079('0x19')](socket);function respondWithStatusCode(_0x23186e,_0x438b4e){_0x438b4e=_0x438b4e||0xcc;return function(_0xf1336c){if(_0xf1336c){return _0x23186e['sendStatus'](_0x438b4e);}return _0x23186e[_0x6079('0x1a')](_0x438b4e)['end']();};}function respondWithResult(_0xf1b783,_0x54095b){_0x54095b=_0x54095b||0xc8;return function(_0x16adfd){if(_0x16adfd){return _0xf1b783[_0x6079('0x1a')](_0x54095b)['json'](_0x16adfd);}};}function respondWithFilteredResult(_0x1909bd,_0x34dbd9){return function(_0x4e58d4){if(_0x4e58d4){var _0x2f1f44=typeof _0x34dbd9[_0x6079('0x1b')]===_0x6079('0x1c')&&typeof _0x34dbd9[_0x6079('0x1d')]===_0x6079('0x1c');var _0x26706c=_0x4e58d4[_0x6079('0x1e')];var _0xd82cef=_0x2f1f44?0x0:_0x34dbd9[_0x6079('0x1b')];var _0x27e9c7=_0x2f1f44?_0x4e58d4[_0x6079('0x1e')]:_0x34dbd9[_0x6079('0x1b')]+_0x34dbd9[_0x6079('0x1d')];var _0x40f3cd;if(_0x27e9c7>=_0x26706c){_0x27e9c7=_0x26706c;_0x40f3cd=0xc8;}else{_0x40f3cd=0xce;}_0x1909bd[_0x6079('0x1a')](_0x40f3cd);return _0x1909bd[_0x6079('0x1f')](_0x6079('0x20'),_0xd82cef+'-'+_0x27e9c7+'/'+_0x26706c)['json'](_0x4e58d4);}return null;};}function patchUpdates(_0x547f0d){return function(_0x5b64a7){try{jsonpatch['apply'](_0x5b64a7,_0x547f0d,!![]);}catch(_0x42f9cf){return BPromise[_0x6079('0x21')](_0x42f9cf);}return _0x5b64a7[_0x6079('0x22')]();};}function saveUpdates(_0x1e12af,_0x1f9a62){return function(_0x3a3096){if(_0x3a3096){return _0x3a3096['update'](_0x1e12af)[_0x6079('0x23')](function(_0x1117aa){return _0x1117aa;});}return null;};}function removeEntity(_0x1ff094,_0x45b159){return function(_0x213585){if(_0x213585){return _0x213585[_0x6079('0x24')]()[_0x6079('0x23')](function(){var _0x1f7bff=_0x213585['get']({'plain':!![]});var _0x2c2464='Lists';return db[_0x6079('0x25')][_0x6079('0x24')]({'where':{'type':_0x2c2464,'resourceId':_0x1f7bff['id']}})[_0x6079('0x23')](function(){return _0x213585;});})[_0x6079('0x23')](function(){_0x1ff094[_0x6079('0x1a')](0xcc)[_0x6079('0x26')]();});}};}function handleEntityNotFound(_0x2b06d9,_0x228c8b){return function(_0x1758a5){if(!_0x1758a5){_0x2b06d9[_0x6079('0x27')](0x194);}return _0x1758a5;};}function handleError(_0x4c7fef,_0x1cd1c6){_0x1cd1c6=_0x1cd1c6||0x1f4;return function(_0x4ac078){logger['error'](_0x4ac078[_0x6079('0x28')]);if(_0x4ac078['name']){delete _0x4ac078[_0x6079('0x29')];}_0x4c7fef[_0x6079('0x1a')](_0x1cd1c6)[_0x6079('0x2a')](_0x4ac078);};}exports['index']=function(_0x42f87b,_0x303753){var _0x2f9122={},_0x41d750={},_0x347a91={'count':0x0,'rows':[]};var _0x576d50=_['map'](db['CmList']['rawAttributes'],function(_0x4911b7){return{'name':_0x4911b7[_0x6079('0x2b')],'type':_0x4911b7[_0x6079('0x2c')][_0x6079('0x2d')]};});_0x41d750[_0x6079('0x2e')]=_[_0x6079('0x2f')](_0x576d50,_0x6079('0x29'));_0x41d750[_0x6079('0x30')]=_[_0x6079('0x31')](_0x42f87b['query']);_0x41d750[_0x6079('0x32')]=_[_0x6079('0x33')](_0x41d750[_0x6079('0x2e')],_0x41d750[_0x6079('0x30')]);_0x2f9122[_0x6079('0x34')]=_['intersection'](_0x41d750[_0x6079('0x2e')],qs[_0x6079('0x35')](_0x42f87b[_0x6079('0x30')]['fields']));_0x2f9122[_0x6079('0x34')]=_0x2f9122[_0x6079('0x34')]['length']?_0x2f9122[_0x6079('0x34')]:_0x41d750['model'];if(!_0x42f87b[_0x6079('0x30')]['hasOwnProperty'](_0x6079('0x36'))){_0x2f9122[_0x6079('0x1d')]=qs[_0x6079('0x1d')](_0x42f87b[_0x6079('0x30')]['limit']);_0x2f9122[_0x6079('0x1b')]=qs[_0x6079('0x1b')](_0x42f87b[_0x6079('0x30')]['offset']);}_0x2f9122[_0x6079('0x37')]=qs[_0x6079('0x38')](_0x42f87b[_0x6079('0x30')][_0x6079('0x38')]);_0x2f9122[_0x6079('0x39')]=qs[_0x6079('0x32')](_['pick'](_0x42f87b[_0x6079('0x30')],_0x41d750['filters']),_0x576d50);if(_0x42f87b[_0x6079('0x30')][_0x6079('0x3a')]){_0x2f9122['where']=_[_0x6079('0x3b')](_0x2f9122[_0x6079('0x39')],{'$or':_[_0x6079('0x2f')](_0x576d50,function(_0x4f15ad){if(_0x4f15ad[_0x6079('0x2c')]!=='VIRTUAL'){var _0xdff935={};_0xdff935[_0x4f15ad[_0x6079('0x29')]]={'$like':'%'+_0x42f87b['query'][_0x6079('0x3a')]+'%'};return _0xdff935;}})});}_0x2f9122=_[_0x6079('0x3b')]({},_0x2f9122,_0x42f87b[_0x6079('0x3c')]);var _0x3e6efa={'where':_0x2f9122['where']};return db['CmList']['count'](_0x3e6efa)['then'](function(_0x3b7b41){_0x347a91[_0x6079('0x1e')]=_0x3b7b41;if(_0x42f87b['query'][_0x6079('0x3d')]){_0x2f9122[_0x6079('0x3e')]=[{'all':!![]}];}return db[_0x6079('0x3f')][_0x6079('0x40')](_0x2f9122);})[_0x6079('0x23')](function(_0xfb1914){_0x347a91['rows']=_0xfb1914;return _0x347a91;})[_0x6079('0x23')](respondWithFilteredResult(_0x303753,_0x2f9122))['catch'](handleError(_0x303753,null));};exports['show']=function(_0x3f3e1c,_0x48e8b8){var _0x3fbf6a={'raw':![],'where':{'id':_0x3f3e1c[_0x6079('0x41')]['id']}},_0x313d95={};_0x313d95['model']=_[_0x6079('0x31')](db[_0x6079('0x3f')]['rawAttributes']);_0x313d95['query']=_[_0x6079('0x31')](_0x3f3e1c[_0x6079('0x30')]);_0x313d95['filters']=_[_0x6079('0x33')](_0x313d95[_0x6079('0x2e')],_0x313d95['query']);_0x3fbf6a[_0x6079('0x34')]=_[_0x6079('0x33')](_0x313d95[_0x6079('0x2e')],qs[_0x6079('0x35')](_0x3f3e1c['query']['fields']));_0x3fbf6a[_0x6079('0x34')]=_0x3fbf6a[_0x6079('0x34')]['length']?_0x3fbf6a['attributes']:_0x313d95['model'];if(_0x3f3e1c['query']['includeAll']){_0x3fbf6a[_0x6079('0x3e')]=[{'all':!![]}];}_0x3fbf6a=_[_0x6079('0x3b')]({},_0x3fbf6a,_0x3f3e1c[_0x6079('0x3c')]);return db[_0x6079('0x3f')][_0x6079('0x42')](_0x3fbf6a)[_0x6079('0x23')](handleEntityNotFound(_0x48e8b8,null))[_0x6079('0x23')](respondWithResult(_0x48e8b8,null))[_0x6079('0x43')](handleError(_0x48e8b8,null));};exports[_0x6079('0x44')]=function(_0x576259,_0x2a93a4){return db['CmList'][_0x6079('0x44')](_0x576259['body'],{})['then'](function(_0x366d1a){var _0x5a92d7=_0x576259[_0x6079('0x45')]['get']({'plain':!![]});if(!_0x5a92d7)throw new Error(_0x6079('0x46'));if(_0x5a92d7[_0x6079('0x47')]===_0x6079('0x45')){var _0x122b18=_0x366d1a[_0x6079('0x48')]({'plain':!![]});var _0x2ee823=_0x6079('0x49');return db[_0x6079('0x4a')]['find']({'where':{'name':_0x2ee823,'userProfileId':_0x5a92d7[_0x6079('0x4b')]},'raw':!![]})['then'](function(_0x2d6cbb){if(_0x2d6cbb&&_0x2d6cbb[_0x6079('0x4c')]===0x0){return db[_0x6079('0x25')]['create']({'name':_0x122b18['name'],'resourceId':_0x122b18['id'],'type':_0x2d6cbb[_0x6079('0x29')],'sectionId':_0x2d6cbb['id']},{})[_0x6079('0x23')](function(){return _0x366d1a;});}else{return _0x366d1a;}})[_0x6079('0x43')](function(_0x4dfedb){logger[_0x6079('0x4d')](_0x6079('0x4e'),_0x4dfedb);throw _0x4dfedb;});}return _0x366d1a;})[_0x6079('0x23')](respondWithResult(_0x2a93a4,0xc9))[_0x6079('0x43')](handleError(_0x2a93a4,null));};exports[_0x6079('0x4f')]=function(_0x1dfc1d,_0x30413d){if(_0x1dfc1d[_0x6079('0x50')]['id']){delete _0x1dfc1d[_0x6079('0x50')]['id'];}return db[_0x6079('0x3f')][_0x6079('0x42')]({'where':{'id':_0x1dfc1d[_0x6079('0x41')]['id']}})[_0x6079('0x23')](handleEntityNotFound(_0x30413d,null))[_0x6079('0x23')](saveUpdates(_0x1dfc1d[_0x6079('0x50')],null))[_0x6079('0x23')](respondWithResult(_0x30413d,null))[_0x6079('0x43')](handleError(_0x30413d,null));};exports[_0x6079('0x24')]=function(_0x287702,_0x125f75){return db['CmList']['find']({'where':{'id':_0x287702[_0x6079('0x41')]['id']}})[_0x6079('0x23')](handleEntityNotFound(_0x125f75,null))[_0x6079('0x23')](removeEntity(_0x125f75,null))[_0x6079('0x43')](handleError(_0x125f75,null));};exports[_0x6079('0x51')]=function(_0x5e1497,_0x3f65cc){return db[_0x6079('0x3f')][_0x6079('0x51')]()[_0x6079('0x23')](respondWithResult(_0x3f65cc,null))[_0x6079('0x43')](handleError(_0x3f65cc,null));};exports[_0x6079('0x52')]=function(_0x46b153,_0x5b9b32,_0x1c8cc1){if(_0x46b153[_0x6079('0x50')]['id']){delete _0x46b153[_0x6079('0x50')]['id'];}return db[_0x6079('0x3f')][_0x6079('0x42')]({'where':{'id':_0x46b153[_0x6079('0x41')]['id']}})[_0x6079('0x23')](handleEntityNotFound(_0x5b9b32,null))[_0x6079('0x23')](function(_0x1bfa38){if(_0x1bfa38){_0x46b153['body'][_0x6079('0x53')]=_0x1bfa38['id'];return db[_0x6079('0x54')][_0x6079('0x44')](_0x46b153[_0x6079('0x50')]);}})['then'](respondWithResult(_0x5b9b32,null))['catch'](handleError(_0x5b9b32,null));};exports[_0x6079('0x55')]=function(_0x173abc,_0x99ea99,_0x23c33a){var _0xd2e5dd={'raw':![],'where':{}};var _0x487847={};var _0x579456={'count':0x0,'rows':[]};return db[_0x6079('0x3f')][_0x6079('0x56')]({'where':{'id':_0x173abc['params']['id']}})[_0x6079('0x23')](handleEntityNotFound(_0x99ea99,null))[_0x6079('0x23')](function(_0x3d9be8){if(_0x3d9be8){_0x487847[_0x6079('0x2e')]=_[_0x6079('0x31')](db[_0x6079('0x54')][_0x6079('0x57')]);_0x487847[_0x6079('0x30')]=_['keys'](_0x173abc['query']);_0x487847[_0x6079('0x32')]=_['intersection'](_0x487847[_0x6079('0x2e')],_0x487847[_0x6079('0x30')]);_0xd2e5dd[_0x6079('0x34')]=_[_0x6079('0x33')](_0x487847[_0x6079('0x2e')],qs[_0x6079('0x35')](_0x173abc[_0x6079('0x30')][_0x6079('0x35')]));_0xd2e5dd['attributes']=_0xd2e5dd[_0x6079('0x34')][_0x6079('0x58')]?_0xd2e5dd[_0x6079('0x34')]:_0x487847['model'];if(!_0x173abc[_0x6079('0x30')][_0x6079('0x59')](_0x6079('0x36'))){_0xd2e5dd[_0x6079('0x1d')]=qs[_0x6079('0x1d')](_0x173abc[_0x6079('0x30')]['limit']);_0xd2e5dd[_0x6079('0x1b')]=qs[_0x6079('0x1b')](_0x173abc[_0x6079('0x30')][_0x6079('0x1b')]);}_0xd2e5dd[_0x6079('0x37')]=qs['sort'](_0x173abc[_0x6079('0x30')]['sort']);_0xd2e5dd[_0x6079('0x39')]=qs[_0x6079('0x32')](_[_0x6079('0x5a')](_0x173abc['query'],_0x487847[_0x6079('0x32')]));_0xd2e5dd[_0x6079('0x39')][_0x6079('0x53')]=_0x3d9be8['id'];if(_0x173abc['query'][_0x6079('0x3a')]){_0xd2e5dd[_0x6079('0x39')]=_['merge'](_0xd2e5dd[_0x6079('0x39')],{'$or':_[_0x6079('0x2f')](_0xd2e5dd[_0x6079('0x34')],function(_0x4a6f56){var _0x506ebc={};_0x506ebc[_0x4a6f56]={'$like':'%'+_0x173abc[_0x6079('0x30')][_0x6079('0x3a')]+'%'};return _0x506ebc;})});}_0xd2e5dd=_[_0x6079('0x3b')]({},_0xd2e5dd,_0x173abc[_0x6079('0x3c')]);return db[_0x6079('0x54')][_0x6079('0x1e')]({'where':_0xd2e5dd[_0x6079('0x39')]})['then'](function(_0xd7ea7a){_0x579456[_0x6079('0x1e')]=_0xd7ea7a;if(_0x173abc['query'][_0x6079('0x3d')]){_0xd2e5dd[_0x6079('0x3e')]=[{'all':!![]}];}return db[_0x6079('0x54')]['findAll'](_0xd2e5dd);})[_0x6079('0x23')](function(_0x140f87){_0x579456[_0x6079('0x5b')]=_0x140f87;return _0x579456;});}})[_0x6079('0x23')](respondWithFilteredResult(_0x99ea99,_0xd2e5dd))['catch'](handleError(_0x99ea99,null));};exports['removeDispositions']=function(_0x24bcc5,_0x5814f9,_0x541d29){return db[_0x6079('0x3f')][_0x6079('0x42')]({'where':{'id':_0x24bcc5['params']['id']}})[_0x6079('0x23')](handleEntityNotFound(_0x5814f9,null))[_0x6079('0x23')](function(_0xccc422){if(_0xccc422){return _0xccc422[_0x6079('0x5c')](_0x24bcc5[_0x6079('0x30')][_0x6079('0x5d')]);}})[_0x6079('0x23')](respondWithStatusCode(_0x5814f9,null))[_0x6079('0x43')](handleError(_0x5814f9,null));};exports[_0x6079('0x5e')]=function(_0x1e0322,_0x322789,_0x4adb49){return db['CmList']['find']({'where':{'id':_0x1e0322[_0x6079('0x41')]['id']}})[_0x6079('0x23')](handleEntityNotFound(_0x322789,null))[_0x6079('0x23')](function(_0x2d05c6){if(_0x2d05c6){var _0x56eda2=[];var _0x1becff={'success':[],'errors':[]};return db['CmContact'][_0x6079('0x51')]()[_0x6079('0x23')](function(_0x3f1c71){if(_0x1e0322[_0x6079('0x50')][_0x6079('0x5f')]&&_[_0x6079('0x60')](_0x1e0322[_0x6079('0x50')]['tags'])){if(_0x1e0322[_0x6079('0x50')][_0x6079('0x5f')][_0x6079('0x58')]){_0x1e0322[_0x6079('0x50')]['tags']=_0x1e0322[_0x6079('0x50')][_0x6079('0x5f')][_0x6079('0x61')](';')+';';}else{_0x1e0322[_0x6079('0x50')][_0x6079('0x5f')]=null;}}else{_0x1e0322[_0x6079('0x50')][_0x6079('0x5f')]=null;}if(_0x1e0322[_0x6079('0x50')]&&_[_0x6079('0x60')](_0x1e0322[_0x6079('0x50')])){for(var _0xc30440=0x0;_0xc30440<_0x1e0322[_0x6079('0x50')][_0x6079('0x58')];_0xc30440+=0x1){_0x1e0322[_0x6079('0x50')][_0xc30440]['ListId']=_0x1e0322['params']['id'];_0x56eda2[_0x6079('0x62')](_0x1e0322[_0x6079('0x50')][_0xc30440]);}return BPromise[_0x6079('0x63')](_0x56eda2,function(_0x532254){return db[_0x6079('0x64')][_0x6079('0x44')](_['omit'](_0x532254,['ids','id'])||{},{'fields':_[_0x6079('0x31')](_0x3f1c71),'raw':!![]})[_0x6079('0x23')](function(_0x6a3d28){_0x1becff[_0x6079('0x65')][_0x6079('0x62')](_0x6a3d28[_0x6079('0x66')]);})[_0x6079('0x43')](function(_0x499bc1){_0x1becff[_0x6079('0x67')][_0x6079('0x62')]({'data':_0x532254,'error':_0x499bc1[_0x6079('0x68')]});});})[_0x6079('0x23')](function(_0x2d0b8f){return _0x1becff;})[_0x6079('0x43')](function(_0x686c05){return _0x686c05;});}else{_0x322789[_0x6079('0x1a')](0x190)[_0x6079('0x69')]({'message':_0x6079('0x6a')});}});}})[_0x6079('0x23')](respondWithResult(_0x322789,null))[_0x6079('0x43')](handleError(_0x322789,null));};exports[_0x6079('0x6b')]=function(_0x5def84,_0x15136b,_0x1524ac){var _0x513881;return db[_0x6079('0x3f')][_0x6079('0x42')]({'where':{'id':_0x5def84['params']['id']},'include':[{'model':db['CmCustomField'],'as':_0x6079('0x6c')}]})[_0x6079('0x23')](handleEntityNotFound(_0x15136b,null))[_0x6079('0x23')](function(_0x4b7cd5){if(_0x4b7cd5){_0x513881=_0x4b7cd5;return db[_0x6079('0x64')][_0x6079('0x57')];}})[_0x6079('0x23')](function(_0x30ccc6){if(_0x30ccc6){var _0x56d03c={};var _0x36ebee={};_0x36ebee[_0x6079('0x2e')]=_[_0x6079('0x6d')](_['keys'](_0x30ccc6),_[_0x6079('0x2f')](_0x513881[_0x6079('0x6c')],function(_0x2fa04d){return util['format'](_0x6079('0x6e'),_0x2fa04d['id']);}));_0x36ebee[_0x6079('0x30')]=_[_0x6079('0x31')](_0x5def84[_0x6079('0x30')]);_0x36ebee[_0x6079('0x32')]=_['intersection'](_0x36ebee['model'],_0x36ebee[_0x6079('0x30')]);_0x56d03c[_0x6079('0x34')]=_[_0x6079('0x33')](_0x36ebee[_0x6079('0x2e')],qs[_0x6079('0x35')](_0x5def84['query'][_0x6079('0x35')]));_0x56d03c[_0x6079('0x34')]=_0x56d03c[_0x6079('0x34')][_0x6079('0x58')]?_0x56d03c['attributes']:_0x36ebee[_0x6079('0x2e')];if(!_0x5def84[_0x6079('0x30')][_0x6079('0x59')](_0x6079('0x36'))){_0x56d03c[_0x6079('0x1d')]=qs['limit'](_0x5def84[_0x6079('0x30')][_0x6079('0x1d')]);_0x56d03c[_0x6079('0x1b')]=qs[_0x6079('0x1b')](_0x5def84[_0x6079('0x30')][_0x6079('0x1b')]);}_0x56d03c['order']=qs['sort'](_0x5def84[_0x6079('0x30')][_0x6079('0x38')]);_0x56d03c[_0x6079('0x39')]=qs['filters'](_[_0x6079('0x5a')](_0x5def84[_0x6079('0x30')],_0x36ebee[_0x6079('0x32')]));_0x56d03c['raw']=!![];if(_0x5def84['query']['filter']){_0x56d03c[_0x6079('0x39')]=_[_0x6079('0x3b')](_0x56d03c[_0x6079('0x39')],{'$or':_[_0x6079('0x2f')](_0x56d03c[_0x6079('0x34')],function(_0x5393ac){var _0x5cec7a={};_0x5cec7a[_0x5393ac]={'$like':'%'+_0x5def84[_0x6079('0x30')][_0x6079('0x3a')]+'%'};return _0x5cec7a;})});}_0x56d03c=_['merge']({},_0x56d03c,_0x5def84[_0x6079('0x3c')]);return _0x513881['getContacts'](_0x56d03c);}})[_0x6079('0x23')](respondWithResult(_0x15136b,null))[_0x6079('0x43')](handleError(_0x15136b,null));};exports['getContactsCsv']=function(_0x4b58ed,_0x59bd95,_0x235d2c){var _0x556b25;var _0x508faa;var _0x29aea8;var _0x138519=_0x4b58ed['params']['id'];csv_results=[];return db[_0x6079('0x6f')][_0x6079('0x40')]({'attributes':['id',_0x6079('0x29')],'raw':!![],'order':['OrderBy']})[_0x6079('0x23')](function(_0x57bd12){_0x556b25=_0x57bd12;var _0x1a55e3=_['keys'](db[_0x6079('0x64')]['rawAttributes']);return db[_0x6079('0x70')][_0x6079('0x40')]({'raw':!![],'attributes':['id',_0x6079('0x71')]})[_0x6079('0x23')](function(_0x214a0a){_0x508faa=_0x214a0a;var _0x29d58f=squel['select']()[_0x6079('0x35')](_0x1a55e3)[_0x6079('0x72')](_0x6079('0x73'),'c')[_0x6079('0x39')](_0x6079('0x74'),_0x138519)[_0x6079('0x39')]('c.deletedAt\x20is\x20null')[_0x6079('0x75')]();for(var _0x490e01=0x0;_0x490e01<_0x508faa[_0x6079('0x58')];_0x490e01++){_0x29d58f[_0x6079('0x76')](_0x6079('0x77')+_0x508faa[_0x490e01]['id'],_0x6079('0x78')+_0x508faa[_0x490e01][_0x6079('0x71')]);}for(var _0x490e01=0x0;_0x490e01<_0x556b25[_0x6079('0x58')];_0x490e01++){_0x29d58f[_0x6079('0x76')](squel[_0x6079('0x79')]()[_0x6079('0x76')]('item')[_0x6079('0x72')](_0x6079('0x7a'))[_0x6079('0x39')](_0x6079('0x7b'),_0x556b25[_0x490e01]['id'])[_0x6079('0x39')](_0x6079('0x7c')),_0x6079('0x7d')+_0x556b25[_0x490e01][_0x6079('0x29')]);_0x29d58f[_0x6079('0x76')](squel[_0x6079('0x79')]()[_0x6079('0x76')](_0x6079('0x7e'))[_0x6079('0x72')](_0x6079('0x7a'))[_0x6079('0x39')](_0x6079('0x7b'),_0x556b25[_0x490e01]['id'])[_0x6079('0x39')]('CmContactId\x20=\x20c.id'),_0x6079('0x7f')+_0x556b25[_0x490e01][_0x6079('0x29')]);}var _0x12a790=[];_0x12a790[_0x6079('0x62')](_0x29d58f[_0x6079('0x80')]());BPromise[_0x6079('0x63')](_0x12a790,handleQuery)[_0x6079('0x23')](function(_0x31f85){handleQuery(_0x29d58f['toString']());var _0x4b0b29=csv_results[0x0];if(!_[_0x6079('0x81')](_0x4b0b29)){var _0x5975d9=toCsv(_0x4b0b29);var _0x505f4f=Date['now']();fs[_0x6079('0x82')](util[_0x6079('0x83')](_0x6079('0x84'),_0x138519,_0x505f4f),_0x5975d9);_0x59bd95[_0x6079('0x85')](_0x6079('0x86'),'attachment;\x20filename='+util[_0x6079('0x83')]('list_%d_%s.csv',_0x138519,_0x505f4f));_0x59bd95[_0x6079('0x85')](_0x6079('0x87'),_0x6079('0x88'));return _0x59bd95['download'](util[_0x6079('0x83')](_0x6079('0x84'),_0x138519,_0x505f4f));}else{return _0x59bd95[_0x6079('0x27')](0xcc);}});});});};exports[_0x6079('0x89')]=function(_0x33c970,_0x2f98c9,_0x30beca){var _0x3391b2;delete _0x33c970['body']['id'];return db['CmList'][_0x6079('0x56')]({'where':{'id':_0x33c970[_0x6079('0x41')]['id']}})['then'](handleEntityNotFound(_0x2f98c9,null))['then'](function(_0x2acf96){if(_0x2acf96){return db[_0x6079('0x8a')][_0x6079('0x8b')](function(_0x3f5850){return db[_0x6079('0x70')][_0x6079('0x44')](_0x33c970['body'],{'transaction':_0x3f5850})[_0x6079('0x23')](function(_0x15513c){_0x3391b2=_0x15513c;return _0x2acf96[_0x6079('0x8c')](_0x15513c,{'transaction':_0x3f5850});})['then'](function(){var _0x454598={'type':db[_0x6079('0x8d')][_0x6079('0x8e')],'transaction':_0x3f5850};switch(_0x33c970[_0x6079('0x50')]['type']){case'text':_0x454598[_0x6079('0x2c')]=db[_0x6079('0x8d')]['TEXT'];break;case _0x6079('0x8f'):_0x454598[_0x6079('0x2c')]=db[_0x6079('0x8d')]['INTEGER'];break;case _0x6079('0x90'):_0x454598[_0x6079('0x2c')]=db[_0x6079('0x8d')][_0x6079('0x91')];_0x454598[_0x6079('0x92')]=![];break;default:}return db[_0x6079('0x8a')][_0x6079('0x93')][_0x6079('0x94')](_0x6079('0x73'),util['format'](_0x6079('0x95'),_0x3391b2['id']),_0x454598);})[_0x6079('0x23')](function(){return _0x3391b2;});});}})[_0x6079('0x23')](respondWithResult(_0x2f98c9,null))['catch'](handleError(_0x2f98c9,null));};exports[_0x6079('0x96')]=function(_0x28486f,_0x578f19,_0x10f56c){var _0x264b41={};var _0x357c0e={};var _0x367a62;var _0x3295e6;return db[_0x6079('0x3f')][_0x6079('0x56')]({'where':{'id':_0x28486f[_0x6079('0x41')]['id']}})[_0x6079('0x23')](handleEntityNotFound(_0x578f19,null))[_0x6079('0x23')](function(_0x3a0f51){if(_0x3a0f51){_0x367a62=_0x3a0f51;_0x357c0e[_0x6079('0x2e')]=_[_0x6079('0x31')](db[_0x6079('0x70')]['rawAttributes']);_0x357c0e['query']=_[_0x6079('0x31')](_0x28486f[_0x6079('0x30')]);_0x357c0e[_0x6079('0x32')]=_[_0x6079('0x33')](_0x357c0e[_0x6079('0x2e')],_0x357c0e[_0x6079('0x30')]);_0x264b41[_0x6079('0x34')]=_[_0x6079('0x33')](_0x357c0e[_0x6079('0x2e')],qs['fields'](_0x28486f[_0x6079('0x30')]['fields']));_0x264b41[_0x6079('0x34')]=_0x264b41[_0x6079('0x34')][_0x6079('0x58')]?_0x264b41['attributes']:_0x357c0e[_0x6079('0x2e')];_0x264b41[_0x6079('0x37')]=qs[_0x6079('0x38')](_0x28486f[_0x6079('0x30')][_0x6079('0x38')]);_0x264b41[_0x6079('0x39')]=qs[_0x6079('0x32')](_[_0x6079('0x5a')](_0x28486f['query'],_0x357c0e[_0x6079('0x32')]));_0x264b41['where']=_[_0x6079('0x3b')](_0x264b41[_0x6079('0x39')],{'$or':[{'ListId':_0x3a0f51['id']},{'ListId':null}]});if(_0x28486f['query'][_0x6079('0x3a')]){_0x264b41[_0x6079('0x39')]=_['merge'](_0x264b41[_0x6079('0x39')],{'$or':_[_0x6079('0x2f')](_0x264b41[_0x6079('0x34')],function(_0x2e78c6){var _0x26156e={};_0x26156e[_0x2e78c6]={'$like':'%'+_0x28486f[_0x6079('0x30')][_0x6079('0x3a')]+'%'};return _0x26156e;})});}_0x264b41=_[_0x6079('0x3b')]({},_0x264b41,_0x28486f[_0x6079('0x3c')]);return db[_0x6079('0x70')][_0x6079('0x97')](_0x264b41);}})['then'](respondWithResult(_0x578f19,null))[_0x6079('0x43')](handleError(_0x578f19,null));};exports[_0x6079('0x98')]=function(_0xc3ddf5,_0x131149){return db[_0x6079('0x70')][_0x6079('0x97')]({'where':{'ListId':null}})[_0x6079('0x23')](handleEntityNotFound(_0x131149,null))[_0x6079('0x23')](function(_0x4265bc){return _0x4265bc;})[_0x6079('0x23')](respondWithResult(_0x131149,null))['catch'](handleError(_0x131149,null));};exports[_0x6079('0x99')]=function(_0x592510,_0x24d5c6,_0x103e04){return db[_0x6079('0x3f')][_0x6079('0x42')]({'where':{'id':_0x592510['params']['id']}})['then'](handleEntityNotFound(_0x24d5c6,null))[_0x6079('0x23')](function(_0x2f5a40){if(_0x2f5a40){return _0x2f5a40['addAgents'](_0x592510['body'][_0x6079('0x5d')],_['omit'](_0x592510[_0x6079('0x50')],[_0x6079('0x5d'),'id'])||{})[_0x6079('0x9a')](function(_0x4a09d2){for(var _0x3aea5f=0x0;_0x3aea5f<_0x592510['body'][_0x6079('0x5d')][_0x6079('0x58')];_0x3aea5f+=0x1){socket[_0x6079('0x9b')](_0x6079('0x9c'),{'UserId':Number(_0x592510[_0x6079('0x50')][_0x6079('0x5d')][_0x3aea5f]),'CmListId':Number(_0x592510['params']['id'])});}return _0x4a09d2;});}})[_0x6079('0x23')](respondWithResult(_0x24d5c6,null))['catch'](handleError(_0x24d5c6,null));};exports['removeAgents']=function(_0x309852,_0x40c7ff,_0x19f8b7){return db[_0x6079('0x3f')]['find']({'where':{'id':_0x309852[_0x6079('0x41')]['id']}})[_0x6079('0x23')](handleEntityNotFound(_0x40c7ff,null))['then'](function(_0xa7ad3a){if(_0xa7ad3a){return _0xa7ad3a['removeAgents'](_0x309852[_0x6079('0x30')]['ids'])[_0x6079('0x23')](function(){if(_[_0x6079('0x60')](_0x309852['query'][_0x6079('0x5d')])){for(var _0x504980=0x0;_0x504980<_0x309852[_0x6079('0x30')][_0x6079('0x5d')][_0x6079('0x58')];_0x504980+=0x1){socket['emit']('userCmList:remove',{'UserId':Number(_0x309852[_0x6079('0x30')]['ids'][_0x504980]),'CmListId':Number(_0x309852[_0x6079('0x41')]['id'])});}}else{socket[_0x6079('0x9b')](_0x6079('0x9d'),{'UserId':Number(_0x309852['query'][_0x6079('0x5d')]),'CmListId':Number(_0x309852[_0x6079('0x41')]['id'])});}});}})[_0x6079('0x23')](respondWithStatusCode(_0x40c7ff,null))[_0x6079('0x43')](handleError(_0x40c7ff,null));};exports[_0x6079('0x9e')]=function(_0x12fce1,_0x413ac9,_0x56eeb4){var _0x5e121c={};var _0x366809={};var _0x58bd14;var _0x7652c9;return db[_0x6079('0x3f')][_0x6079('0x56')]({'where':{'id':_0x12fce1[_0x6079('0x41')]['id']}})['then'](handleEntityNotFound(_0x413ac9,null))[_0x6079('0x23')](function(_0x545ae6){if(_0x545ae6){_0x58bd14=_0x545ae6;_0x366809[_0x6079('0x2e')]=_[_0x6079('0x31')](db[_0x6079('0x9f')][_0x6079('0x57')]);_0x366809[_0x6079('0x30')]=_['keys'](_0x12fce1[_0x6079('0x30')]);_0x366809[_0x6079('0x32')]=_[_0x6079('0x33')](_0x366809[_0x6079('0x2e')],_0x366809[_0x6079('0x30')]);_0x5e121c[_0x6079('0x34')]=_[_0x6079('0x33')](_0x366809[_0x6079('0x2e')],qs[_0x6079('0x35')](_0x12fce1[_0x6079('0x30')][_0x6079('0x35')]));_0x5e121c['attributes']=_0x5e121c[_0x6079('0x34')]['length']?_0x5e121c[_0x6079('0x34')]:_0x366809['model'];_0x5e121c[_0x6079('0x37')]=qs['sort'](_0x12fce1[_0x6079('0x30')][_0x6079('0x38')]);_0x5e121c[_0x6079('0x39')]=qs[_0x6079('0x32')](_[_0x6079('0x5a')](_0x12fce1[_0x6079('0x30')],_0x366809[_0x6079('0x32')]));if(_0x12fce1[_0x6079('0x30')]['filter']){_0x5e121c[_0x6079('0x39')]=_[_0x6079('0x3b')](_0x5e121c['where'],{'$or':_[_0x6079('0x2f')](_0x5e121c[_0x6079('0x34')],function(_0xd80c7d){var _0x1aba94={};_0x1aba94[_0xd80c7d]={'$like':'%'+_0x12fce1['query'][_0x6079('0x3a')]+'%'};return _0x1aba94;})});}_0x5e121c=_[_0x6079('0x3b')]({},_0x5e121c,_0x12fce1[_0x6079('0x3c')]);return _0x58bd14[_0x6079('0x9e')](_0x5e121c);}})['then'](function(_0x505288){if(_0x505288){_0x7652c9=_0x505288[_0x6079('0x58')];if(!_0x12fce1['query'][_0x6079('0x59')]('nolimit')){_0x5e121c[_0x6079('0x1d')]=qs['limit'](_0x12fce1[_0x6079('0x30')][_0x6079('0x1d')]);_0x5e121c['offset']=qs['offset'](_0x12fce1[_0x6079('0x30')][_0x6079('0x1b')]);}return _0x58bd14['getAgents'](_0x5e121c);}})[_0x6079('0x23')](function(_0x4abe33){if(_0x4abe33){return _0x4abe33?{'count':_0x7652c9,'rows':_0x4abe33}:null;}})[_0x6079('0x23')](respondWithResult(_0x413ac9,null))[_0x6079('0x43')](handleError(_0x413ac9,null));};function handleQuery(_0x48f632){logger['info'](_0x48f632);return db['sequelize']['query'](_0x48f632)[_0x6079('0x9a')](function(_0xdac2c){csv_results[_0x6079('0x62')](_0xdac2c);})[_0x6079('0x43')](function(_0x3af5b0){logger['error'](_0x3af5b0['message']);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index d048a15..2e72965 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 _0x55ca=['events','../../mysqldb','update','remove','emit','hasOwnProperty','hook'];(function(_0x503950,_0x5022eb){var _0x1657a9=function(_0x4c1e8f){while(--_0x4c1e8f){_0x503950['push'](_0x503950['shift']());}};_0x1657a9(++_0x5022eb);}(_0x55ca,0x126));var _0xa55c=function(_0x1d3e3f,_0x495ec1){_0x1d3e3f=_0x1d3e3f-0x0;var _0x3879fa=_0x55ca[_0x1d3e3f];return _0x3879fa;};'use strict';var EventEmitter=require(_0xa55c('0x0'));var CmList=require(_0xa55c('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa55c('0x2'),'afterDestroy':_0xa55c('0x3')};function emitEvent(_0x5dc716){return function(_0x3b478a,_0x2db02a,_0xcb02e3){CmListEvents[_0xa55c('0x4')](_0x5dc716+':'+_0x3b478a['id'],_0x3b478a);CmListEvents[_0xa55c('0x4')](_0x5dc716,_0x3b478a);_0xcb02e3(null);};}for(var e in events){if(events[_0xa55c('0x5')](e)){var event=events[e];CmList[_0xa55c('0x6')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file +var _0x814b=['update','emit','hook','exports','events','../../mysqldb','CmList','setMaxListeners','save'];(function(_0x39cdb8,_0x15ee98){var _0x44bbc9=function(_0x395338){while(--_0x395338){_0x39cdb8['push'](_0x39cdb8['shift']());}};_0x44bbc9(++_0x15ee98);}(_0x814b,0x1a2));var _0xb814=function(_0x37a0ce,_0x28dc04){_0x37a0ce=_0x37a0ce-0x0;var _0x569f4e=_0x814b[_0x37a0ce];return _0x569f4e;};'use strict';var EventEmitter=require(_0xb814('0x0'));var CmList=require(_0xb814('0x1'))['db'][_0xb814('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0xb814('0x3')](0x0);var events={'afterCreate':_0xb814('0x4'),'afterUpdate':_0xb814('0x5'),'afterDestroy':'remove'};function emitEvent(_0x38c21a){return function(_0x3e1e9,_0x258866,_0x4237bc){CmListEvents[_0xb814('0x6')](_0x38c21a+':'+_0x3e1e9['id'],_0x3e1e9);CmListEvents[_0xb814('0x6')](_0x38c21a,_0x3e1e9);_0x4237bc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0xb814('0x7')](e,emitEvent(event));}}module[_0xb814('0x8')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index c389a82..8a58037 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 _0x5b02=['define','CmList','lodash','util','../../config/logger','api','request-promise','rimraf','../../config/environment','./cmList.attributes','exports'];(function(_0x19fb00,_0x1f81c8){var _0x30bfe7=function(_0x1f85ae){while(--_0x1f85ae){_0x19fb00['push'](_0x19fb00['shift']());}};_0x30bfe7(++_0x1f81c8);}(_0x5b02,0xe9));var _0x25b0=function(_0x413114,_0x20a211){_0x413114=_0x413114-0x0;var _0x434a73=_0x5b02[_0x413114];return _0x434a73;};'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':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x54ef=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmList.attributes','define','CmList','lodash','util'];(function(_0x4516e0,_0x6cf9e2){var _0x3b9399=function(_0x5594ca){while(--_0x5594ca){_0x4516e0['push'](_0x4516e0['shift']());}};_0x3b9399(++_0x6cf9e2);}(_0x54ef,0x112));var _0xf54e=function(_0xe2b530,_0x21978c){_0xe2b530=_0xe2b530-0x0;var _0x42b81d=_0x54ef[_0xe2b530];return _0x42b81d;};'use strict';var _=require(_0xf54e('0x0'));var util=require(_0xf54e('0x1'));var logger=require(_0xf54e('0x2'))('api');var moment=require(_0xf54e('0x3'));var BPromise=require(_0xf54e('0x4'));var rp=require(_0xf54e('0x5'));var fs=require('fs');var path=require(_0xf54e('0x6'));var rimraf=require(_0xf54e('0x7'));var config=require(_0xf54e('0x8'));var attributes=require(_0xf54e('0x9'));module['exports']=function(_0x55e611,_0x18e84e){return _0x55e611[_0xf54e('0xa')](_0xf54e('0xb'),attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index ef28520..d658c84 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 _0xed80=['util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','then','info','CmList,\x20%s,\x20%s','request\x20sent','CmList,\x20%s,\x20%s,\x20%s','error','message'];(function(_0xd8d20d,_0x50a133){var _0x59ad3a=function(_0x3e64a5){while(--_0x3e64a5){_0xd8d20d['push'](_0xd8d20d['shift']());}};_0x59ad3a(++_0x50a133);}(_0xed80,0x1ce));var _0x0ed8=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xed80[_0x40a045];return _0x1a687c;};'use strict';var _=require('lodash');var util=require(_0x0ed8('0x0'));var moment=require(_0x0ed8('0x1'));var BPromise=require(_0x0ed8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0ed8('0x3'));var db=require(_0x0ed8('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0ed8('0x5'))(_0x0ed8('0x6'));var config=require('../../config/environment');var jayson=require(_0x0ed8('0x7'));var client=jayson['client'][_0x0ed8('0x8')]({'port':0x232a});config[_0x0ed8('0x9')]=_[_0x0ed8('0xa')](config[_0x0ed8('0x9')],{'host':_0x0ed8('0xb'),'port':0x18eb});var socket=require(_0x0ed8('0xc'))(new Redis(config['redis']));require('./cmList.socket')[_0x0ed8('0xd')](socket);function respondWithRpcPromise(_0x5cc585,_0xb5a975,_0x3f9eac){return new BPromise(function(_0x33afb2,_0x8d309e){return client['request'](_0x5cc585,_0x3f9eac)[_0x0ed8('0xe')](function(_0x406d25){logger[_0x0ed8('0xf')](_0x0ed8('0x10'),_0xb5a975,_0x0ed8('0x11'));logger['debug'](_0x0ed8('0x12'),_0xb5a975,'request\x20sent',JSON['stringify'](_0x406d25));if(_0x406d25['error']){if(_0x406d25['error']['code']===0x1f4){logger[_0x0ed8('0x13')](_0x0ed8('0x10'),_0xb5a975,_0x406d25[_0x0ed8('0x13')]['message']);return _0x8d309e(_0x406d25[_0x0ed8('0x13')]['message']);}logger[_0x0ed8('0x13')]('CmList,\x20%s,\x20%s',_0xb5a975,_0x406d25[_0x0ed8('0x13')][_0x0ed8('0x14')]);return _0x33afb2(_0x406d25[_0x0ed8('0x13')]['message']);}else{logger[_0x0ed8('0xf')](_0x0ed8('0x10'),_0xb5a975,_0x0ed8('0x11'));_0x33afb2(_0x406d25['result'][_0x0ed8('0x14')]);}})['catch'](function(_0x305b45){logger['error']('CmList,\x20%s,\x20%s',_0xb5a975,_0x305b45);_0x8d309e(_0x305b45);});});} \ No newline at end of file +var _0x580b=['request\x20sent','CmList,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./cmList.socket','request','then','info','CmList,\x20%s,\x20%s'];(function(_0x195c7d,_0x1b273c){var _0x587986=function(_0x266fb4){while(--_0x266fb4){_0x195c7d['push'](_0x195c7d['shift']());}};_0x587986(++_0x1b273c);}(_0x580b,0x8e));var _0xb580=function(_0x3e0c1e,_0x2fd01f){_0x3e0c1e=_0x3e0c1e-0x0;var _0x657a71=_0x580b[_0x3e0c1e];return _0x657a71;};'use strict';var _=require(_0xb580('0x0'));var util=require('util');var moment=require(_0xb580('0x1'));var BPromise=require('bluebird');var rs=require(_0xb580('0x2'));var fs=require('fs');var Redis=require(_0xb580('0x3'));var db=require(_0xb580('0x4'))['db'];var utils=require(_0xb580('0x5'));var logger=require(_0xb580('0x6'))(_0xb580('0x7'));var config=require(_0xb580('0x8'));var jayson=require(_0xb580('0x9'));var client=jayson[_0xb580('0xa')][_0xb580('0xb')]({'port':0x232a});config[_0xb580('0xc')]=_[_0xb580('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xb580('0xe'))(new Redis(config[_0xb580('0xc')]));require(_0xb580('0xf'))['register'](socket);function respondWithRpcPromise(_0x17c1ff,_0x152528,_0x3f6e1c){return new BPromise(function(_0x25f91a,_0x3be67a){return client[_0xb580('0x10')](_0x17c1ff,_0x3f6e1c)[_0xb580('0x11')](function(_0x3d0ea7){logger[_0xb580('0x12')](_0xb580('0x13'),_0x152528,_0xb580('0x14'));logger['debug'](_0xb580('0x15'),_0x152528,_0xb580('0x14'),JSON['stringify'](_0x3d0ea7));if(_0x3d0ea7[_0xb580('0x16')]){if(_0x3d0ea7[_0xb580('0x16')][_0xb580('0x17')]===0x1f4){logger['error']('CmList,\x20%s,\x20%s',_0x152528,_0x3d0ea7[_0xb580('0x16')]['message']);return _0x3be67a(_0x3d0ea7['error'][_0xb580('0x18')]);}logger[_0xb580('0x16')](_0xb580('0x13'),_0x152528,_0x3d0ea7[_0xb580('0x16')]['message']);return _0x25f91a(_0x3d0ea7[_0xb580('0x16')][_0xb580('0x18')]);}else{logger[_0xb580('0x12')](_0xb580('0x13'),_0x152528,_0xb580('0x14'));_0x25f91a(_0x3d0ea7[_0xb580('0x19')][_0xb580('0x18')]);}})[_0xb580('0x1a')](function(_0x3f9526){logger['error'](_0xb580('0x13'),_0x152528,_0x3f9526);_0x3be67a(_0x3f9526);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 3ceb37e..2271d61 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 _0xe4fd=['register','length','save','remove','emit','removeListener'];(function(_0x23c73d,_0x357b21){var _0x36ba47=function(_0x317b8e){while(--_0x317b8e){_0x23c73d['push'](_0x23c73d['shift']());}};_0x36ba47(++_0x357b21);}(_0xe4fd,0x1f4));var _0xde4f=function(_0x1fbbdf,_0xe4fe0f){_0x1fbbdf=_0x1fbbdf-0x0;var _0x1b3255=_0xe4fd[_0x1fbbdf];return _0x1b3255;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0xde4f('0x0'),_0xde4f('0x1'),'update'];function createListener(_0xd919fb,_0x27b69e){return function(_0x1b4ae4){_0x27b69e[_0xde4f('0x2')](_0xd919fb,_0x1b4ae4);};}function removeListener(_0x245262,_0x3e5e63){return function(){CmListEvents[_0xde4f('0x3')](_0x245262,_0x3e5e63);};}exports[_0xde4f('0x4')]=function(_0x518b54){for(var _0x329302=0x0,_0x38a9ec=events[_0xde4f('0x5')];_0x329302<_0x38a9ec;_0x329302++){var _0x24d7f6=events[_0x329302];var _0x559d35=createListener('cmList:'+_0x24d7f6,_0x518b54);CmListEvents['on'](_0x24d7f6,_0x559d35);}}; \ No newline at end of file +var _0x4940=['register','./cmList.events','remove','update','emit','removeListener'];(function(_0x2dc57c,_0x4a243c){var _0x5a86e0=function(_0x4042ca){while(--_0x4042ca){_0x2dc57c['push'](_0x2dc57c['shift']());}};_0x5a86e0(++_0x4a243c);}(_0x4940,0xeb));var _0x0494=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x4940[_0x36c5b0];return _0xf19333;};'use strict';var CmListEvents=require(_0x0494('0x0'));var events=['save',_0x0494('0x1'),_0x0494('0x2')];function createListener(_0x4c4537,_0x34e1d9){return function(_0x501b82){_0x34e1d9[_0x0494('0x3')](_0x4c4537,_0x501b82);};}function removeListener(_0xedff,_0x9b24df){return function(){CmListEvents[_0x0494('0x4')](_0xedff,_0x9b24df);};}exports[_0x0494('0x5')]=function(_0x39e650){for(var _0x53f986=0x0,_0x4aa528=events['length'];_0x53f986<_0x4aa528;_0x53f986++){var _0x51a18a=events[_0x53f986];var _0x325741=createListener('cmList:'+_0x51a18a,_0x39e650);CmListEvents['on'](_0x51a18a,_0x325741);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 472505e..b79ba95 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 _0x7662=['../../config/environment','./cmList.controller','get','isAuthenticated','index','/describe','getGlobalCustomFields','/:id/dispositions','getDispositions','getContacts','/:id/contacts/csv','getContactsCsv','getCustomFields','post','addDisposition','addContacts','/:id/fields','addAgents','put','/:id','update','delete','/:id/users','removeAgents','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7662,0xd2));var _0x2766=function(_0x3380a2,_0x444dcd){_0x3380a2=_0x3380a2-0x0;var _0x222c22=_0x7662[_0x3380a2];return _0x222c22;};'use strict';var multer=require(_0x2766('0x0'));var util=require(_0x2766('0x1'));var path=require(_0x2766('0x2'));var timeout=require('connect-timeout');var express=require(_0x2766('0x3'));var router=express[_0x2766('0x4')]();var fs_extra=require(_0x2766('0x5'));var auth=require(_0x2766('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2766('0x7'));var controller=require(_0x2766('0x8'));router[_0x2766('0x9')]('/',auth[_0x2766('0xa')](),controller[_0x2766('0xb')]);router[_0x2766('0x9')](_0x2766('0xc'),auth[_0x2766('0xa')](),controller['describe']);router[_0x2766('0x9')]('/global_fields',auth['isAuthenticated'](),controller[_0x2766('0xd')]);router[_0x2766('0x9')]('/:id',auth[_0x2766('0xa')](),controller['show']);router[_0x2766('0x9')](_0x2766('0xe'),auth['isAuthenticated'](),controller[_0x2766('0xf')]);router[_0x2766('0x9')]('/:id/contacts',auth['isAuthenticated'](),controller[_0x2766('0x10')]);router[_0x2766('0x9')](_0x2766('0x11'),auth[_0x2766('0xa')](),controller[_0x2766('0x12')]);router['get']('/:id/fields',auth[_0x2766('0xa')](),controller[_0x2766('0x13')]);router[_0x2766('0x9')]('/:id/users',auth[_0x2766('0xa')](),controller['getAgents']);router['post']('/',auth[_0x2766('0xa')](),controller['create']);router[_0x2766('0x14')](_0x2766('0xe'),auth['isAuthenticated'](),controller[_0x2766('0x15')]);router[_0x2766('0x14')]('/:id/contacts',auth[_0x2766('0xa')](),controller[_0x2766('0x16')]);router['post'](_0x2766('0x17'),auth[_0x2766('0xa')](),controller['addCustomField']);router[_0x2766('0x14')]('/:id/users',auth[_0x2766('0xa')](),controller[_0x2766('0x18')]);router[_0x2766('0x19')](_0x2766('0x1a'),auth['isAuthenticated'](),controller[_0x2766('0x1b')]);router[_0x2766('0x1c')]('/:id',auth[_0x2766('0xa')](),controller['destroy']);router[_0x2766('0x1c')]('/:id/dispositions',auth[_0x2766('0xa')](),controller['removeDispositions']);router[_0x2766('0x1c')](_0x2766('0x1d'),auth[_0x2766('0xa')](),controller[_0x2766('0x1e')]);module['exports']=router; \ No newline at end of file +var _0x20a2=['delete','destroy','removeDispositions','/:id/users','removeAgents','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmList.controller','get','isAuthenticated','index','/describe','/global_fields','getGlobalCustomFields','/:id','show','/:id/dispositions','getDispositions','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','getAgents','create','addDisposition','post','addAgents','put','update'];(function(_0x5442b7,_0x421f89){var _0xd17318=function(_0x7b53eb){while(--_0x7b53eb){_0x5442b7['push'](_0x5442b7['shift']());}};_0xd17318(++_0x421f89);}(_0x20a2,0x102));var _0x220a=function(_0x2f1114,_0x4561f1){_0x2f1114=_0x2f1114-0x0;var _0x2fe856=_0x20a2[_0x2f1114];return _0x2fe856;};'use strict';var multer=require(_0x220a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x220a('0x1'));var express=require(_0x220a('0x2'));var router=express[_0x220a('0x3')]();var fs_extra=require(_0x220a('0x4'));var auth=require(_0x220a('0x5'));var interaction=require(_0x220a('0x6'));var config=require('../../config/environment');var controller=require(_0x220a('0x7'));router[_0x220a('0x8')]('/',auth[_0x220a('0x9')](),controller[_0x220a('0xa')]);router[_0x220a('0x8')](_0x220a('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x220a('0x8')](_0x220a('0xc'),auth[_0x220a('0x9')](),controller[_0x220a('0xd')]);router[_0x220a('0x8')](_0x220a('0xe'),auth[_0x220a('0x9')](),controller[_0x220a('0xf')]);router['get'](_0x220a('0x10'),auth['isAuthenticated'](),controller[_0x220a('0x11')]);router['get']('/:id/contacts',auth[_0x220a('0x9')](),controller[_0x220a('0x12')]);router['get'](_0x220a('0x13'),auth['isAuthenticated'](),controller[_0x220a('0x14')]);router[_0x220a('0x8')](_0x220a('0x15'),auth[_0x220a('0x9')](),controller[_0x220a('0x16')]);router[_0x220a('0x8')]('/:id/users',auth['isAuthenticated'](),controller[_0x220a('0x17')]);router['post']('/',auth[_0x220a('0x9')](),controller[_0x220a('0x18')]);router['post']('/:id/dispositions',auth[_0x220a('0x9')](),controller[_0x220a('0x19')]);router[_0x220a('0x1a')]('/:id/contacts',auth['isAuthenticated'](),controller['addContacts']);router[_0x220a('0x1a')](_0x220a('0x15'),auth['isAuthenticated'](),controller['addCustomField']);router[_0x220a('0x1a')]('/:id/users',auth[_0x220a('0x9')](),controller[_0x220a('0x1b')]);router[_0x220a('0x1c')](_0x220a('0xe'),auth[_0x220a('0x9')](),controller[_0x220a('0x1d')]);router[_0x220a('0x1e')]('/:id',auth['isAuthenticated'](),controller[_0x220a('0x1f')]);router[_0x220a('0x1e')](_0x220a('0x10'),auth['isAuthenticated'](),controller[_0x220a('0x20')]);router[_0x220a('0x1e')](_0x220a('0x21'),auth[_0x220a('0x9')](),controller[_0x220a('0x22')]);module[_0x220a('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 bf61c1b..dc917af 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 _0x3954=['VIRTUAL','getDataValue','STRING','sequelize'];(function(_0x2f1651,_0x10b559){var _0xedeb1=function(_0x3f8e4b){while(--_0x3f8e4b){_0x2f1651['push'](_0x2f1651['shift']());}};_0xedeb1(++_0x10b559);}(_0x3954,0x8f));var _0x4395=function(_0x351651,_0xf69974){_0x351651=_0x351651-0x0;var _0x3a2037=_0x3954[_0x351651];return _0x3a2037;};'use strict';var Sequelize=require(_0x4395('0x0'));module['exports']={'name':{'type':Sequelize[_0x4395('0x1')],'get':function(_0x304065){return this[_0x4395('0x2')]('field');}},'field':{'type':Sequelize[_0x4395('0x3')],'allowNull':![]},'operator':{'type':Sequelize[_0x4395('0x3')],'allowNull':![]},'value':{'type':Sequelize[_0x4395('0x3')],'allowNull':![]}}; \ No newline at end of file +var _0x0bb8=['exports','VIRTUAL','getDataValue','field','STRING','sequelize'];(function(_0xe4bb3d,_0x21e87e){var _0xd9e51=function(_0x1f732b){while(--_0x1f732b){_0xe4bb3d['push'](_0xe4bb3d['shift']());}};_0xd9e51(++_0x21e87e);}(_0x0bb8,0x191));var _0x80bb=function(_0x182518,_0x4e06d9){_0x182518=_0x182518-0x0;var _0x40cd26=_0x0bb8[_0x182518];return _0x40cd26;};'use strict';var Sequelize=require(_0x80bb('0x0'));module[_0x80bb('0x1')]={'name':{'type':Sequelize[_0x80bb('0x2')],'get':function(_0x42545e){return this[_0x80bb('0x3')](_0x80bb('0x4'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x80bb('0x5')],'allowNull':![]},'value':{'type':Sequelize[_0x80bb('0x5')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index a61e232..ee1afff 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(_0x589e82,_0x1fae30){var _0x264e90=function(_0x201b08){while(--_0x201b08){_0x589e82['push'](_0x589e82['shift']());}};_0x264e90(++_0x1fae30);}(_0x7a54,0x106));var _0x47a5=function(_0x4f3206,_0x481e9e){_0x4f3206=_0x4f3206-0x0;var _0x159106=_0x7a54[_0x4f3206];return _0x159106;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file +var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x4d26ce,_0x54d976){var _0xa4d970=function(_0x4161a8){while(--_0x4161a8){_0x4d26ce['push'](_0x4d26ce['shift']());}};_0xa4d970(++_0x54d976);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 7c1221d..934a6c7 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 _0x645b=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','Condition','tools_conditions','lodash','util'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0x645b,0x1c1));var _0xb645=function(_0x5cba3c,_0x325b3c){_0x5cba3c=_0x5cba3c-0x0;var _0xc82156=_0x645b[_0x5cba3c];return _0xc82156;};'use strict';var _=require(_0xb645('0x0'));var util=require(_0xb645('0x1'));var logger=require(_0xb645('0x2'))(_0xb645('0x3'));var moment=require('moment');var BPromise=require(_0xb645('0x4'));var rp=require(_0xb645('0x5'));var fs=require('fs');var path=require(_0xb645('0x6'));var rimraf=require(_0xb645('0x7'));var config=require(_0xb645('0x8'));var attributes=require('./condition.attributes');module['exports']=function(_0x59481e,_0x218f7d){return _0x59481e['define'](_0xb645('0x9'),attributes,{'tableName':_0xb645('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd97a=['./condition.attributes','exports','define','Condition','tools_conditions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x2206e2,_0x12b4f1){var _0x4f8b5d=function(_0x5255d7){while(--_0x5255d7){_0x2206e2['push'](_0x2206e2['shift']());}};_0x4f8b5d(++_0x12b4f1);}(_0xd97a,0x139));var _0xad97=function(_0x5be62f,_0x3d6279){_0x5be62f=_0x5be62f-0x0;var _0x1e0356=_0xd97a[_0x5be62f];return _0x1e0356;};'use strict';var _=require(_0xad97('0x0'));var util=require(_0xad97('0x1'));var logger=require(_0xad97('0x2'))(_0xad97('0x3'));var moment=require(_0xad97('0x4'));var BPromise=require(_0xad97('0x5'));var rp=require(_0xad97('0x6'));var fs=require('fs');var path=require(_0xad97('0x7'));var rimraf=require(_0xad97('0x8'));var config=require('../../config/environment');var attributes=require(_0xad97('0x9'));module[_0xad97('0xa')]=function(_0x2b1196,_0x229765){return _0x2b1196[_0xad97('0xb')](_0xad97('0xc'),attributes,{'tableName':_0xad97('0xd'),'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 67f01ad..e311491 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 _0x203e=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','lodash','util','moment','bluebird'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x203e,0x96));var _0xe203=function(_0x561c8e,_0x43bc60){_0x561c8e=_0x561c8e-0x0;var _0x345697=_0x203e[_0x561c8e];return _0x345697;};'use strict';var _=require(_0xe203('0x0'));var util=require(_0xe203('0x1'));var moment=require(_0xe203('0x2'));var BPromise=require(_0xe203('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe203('0x4'));var db=require(_0xe203('0x5'))['db'];var utils=require(_0xe203('0x6'));var logger=require(_0xe203('0x7'))('rpc');var config=require(_0xe203('0x8'));var jayson=require(_0xe203('0x9'));var client=jayson[_0xe203('0xa')][_0xe203('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xd68c6b,_0xa8f92d,_0x149fa3){return new BPromise(function(_0x155918,_0x4f8597){return client[_0xe203('0xc')](_0xd68c6b,_0x149fa3)[_0xe203('0xd')](function(_0x11fdc9){logger[_0xe203('0xe')](_0xe203('0xf'),_0xa8f92d,_0xe203('0x10'));logger[_0xe203('0x11')]('Condition,\x20%s,\x20%s,\x20%s',_0xa8f92d,_0xe203('0x10'),JSON[_0xe203('0x12')](_0x11fdc9));if(_0x11fdc9[_0xe203('0x13')]){if(_0x11fdc9[_0xe203('0x13')]['code']===0x1f4){logger[_0xe203('0x13')](_0xe203('0xf'),_0xa8f92d,_0x11fdc9[_0xe203('0x13')][_0xe203('0x14')]);return _0x4f8597(_0x11fdc9[_0xe203('0x13')][_0xe203('0x14')]);}logger[_0xe203('0x13')](_0xe203('0xf'),_0xa8f92d,_0x11fdc9[_0xe203('0x13')][_0xe203('0x14')]);return _0x155918(_0x11fdc9[_0xe203('0x13')][_0xe203('0x14')]);}else{logger[_0xe203('0xe')](_0xe203('0xf'),_0xa8f92d,_0xe203('0x10'));_0x155918(_0x11fdc9['result'][_0xe203('0x14')]);}})[_0xe203('0x15')](function(_0x4f69ed){logger['error'](_0xe203('0xf'),_0xa8f92d,_0x4f69ed);_0x4f8597(_0x4f69ed);});});} \ No newline at end of file +var _0x8fe7=['debug','Condition,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Condition,\x20%s,\x20%s','request\x20sent'];(function(_0x31ca46,_0x1aaabd){var _0x46d55d=function(_0x31e536){while(--_0x31e536){_0x31ca46['push'](_0x31ca46['shift']());}};_0x46d55d(++_0x1aaabd);}(_0x8fe7,0x1e7));var _0x78fe=function(_0x56e4ba,_0x55da3e){_0x56e4ba=_0x56e4ba-0x0;var _0x5a501f=_0x8fe7[_0x56e4ba];return _0x5a501f;};'use strict';var _=require(_0x78fe('0x0'));var util=require(_0x78fe('0x1'));var moment=require(_0x78fe('0x2'));var BPromise=require(_0x78fe('0x3'));var rs=require(_0x78fe('0x4'));var fs=require('fs');var Redis=require(_0x78fe('0x5'));var db=require(_0x78fe('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x78fe('0x7'))(_0x78fe('0x8'));var config=require(_0x78fe('0x9'));var jayson=require(_0x78fe('0xa'));var client=jayson[_0x78fe('0xb')][_0x78fe('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x21ee9d,_0x3632eb,_0x30ee33){return new BPromise(function(_0x1d53a9,_0x9b2dc6){return client['request'](_0x21ee9d,_0x30ee33)[_0x78fe('0xd')](function(_0xced216){logger[_0x78fe('0xe')](_0x78fe('0xf'),_0x3632eb,_0x78fe('0x10'));logger[_0x78fe('0x11')](_0x78fe('0x12'),_0x3632eb,_0x78fe('0x10'),JSON['stringify'](_0xced216));if(_0xced216[_0x78fe('0x13')]){if(_0xced216[_0x78fe('0x13')][_0x78fe('0x14')]===0x1f4){logger['error'](_0x78fe('0xf'),_0x3632eb,_0xced216['error'][_0x78fe('0x15')]);return _0x9b2dc6(_0xced216[_0x78fe('0x13')][_0x78fe('0x15')]);}logger[_0x78fe('0x13')]('Condition,\x20%s,\x20%s',_0x3632eb,_0xced216['error'][_0x78fe('0x15')]);return _0x1d53a9(_0xced216[_0x78fe('0x13')][_0x78fe('0x15')]);}else{logger['info'](_0x78fe('0xf'),_0x3632eb,_0x78fe('0x10'));_0x1d53a9(_0xced216[_0x78fe('0x16')]['message']);}})[_0x78fe('0x17')](function(_0xc3ab52){logger['error']('Condition,\x20%s,\x20%s',_0x3632eb,_0xc3ab52);_0x9b2dc6(_0xc3ab52);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 80cf2a4..939c2cd 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 _0x1961=['/:id','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./condition.controller','isAuthenticated','update','delete'];(function(_0x5c5c52,_0x36d085){var _0x4229ff=function(_0x3806df){while(--_0x3806df){_0x5c5c52['push'](_0x5c5c52['shift']());}};_0x4229ff(++_0x36d085);}(_0x1961,0x92));var _0x1196=function(_0x55e63d,_0x2b42fc){_0x55e63d=_0x55e63d-0x0;var _0x2f0f4c=_0x1961[_0x55e63d];return _0x2f0f4c;};'use strict';var multer=require(_0x1196('0x0'));var util=require(_0x1196('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1196('0x2')]();var fs_extra=require(_0x1196('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x1196('0x4'));var config=require(_0x1196('0x5'));var controller=require(_0x1196('0x6'));router['put']('/:id',auth[_0x1196('0x7')](),controller[_0x1196('0x8')]);router[_0x1196('0x9')](_0x1196('0xa'),auth[_0x1196('0x7')](),controller['destroy']);module[_0x1196('0xb')]=router; \ No newline at end of file +var _0x3806=['isAuthenticated','update','delete','/:id','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','put'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3806,0x164));var _0x6380=function(_0x2635da,_0x2ed017){_0x2635da=_0x2635da-0x0;var _0x1d2977=_0x3806[_0x2635da];return _0x1d2977;};'use strict';var multer=require(_0x6380('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6380('0x1'));var express=require(_0x6380('0x2'));var router=express[_0x6380('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6380('0x4'));var interaction=require(_0x6380('0x5'));var config=require(_0x6380('0x6'));var controller=require('./condition.controller');router[_0x6380('0x7')]('/:id',auth[_0x6380('0x8')](),controller[_0x6380('0x9')]);router[_0x6380('0xa')](_0x6380('0xb'),auth[_0x6380('0x8')](),controller[_0x6380('0xc')]);module[_0x6380('0xd')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 2340af2..a7b2c36 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 _0xddce=['exports','STRING','name','INTEGER','sequelize'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xddce,0x1b7));var _0xeddc=function(_0x565635,_0x5299fb){_0x565635=_0x565635-0x0;var _0x148ce8=_0xddce[_0x565635];return _0x148ce8;};'use strict';var Sequelize=require(_0xeddc('0x0'));module[_0xeddc('0x1')]={'name':{'type':Sequelize[_0xeddc('0x2')],'allowNull':![],'unique':_0xeddc('0x3')},'OrderBy':{'type':Sequelize[_0xeddc('0x4')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xeddc('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xdf7e=['exports','STRING','name','sequelize'];(function(_0x5c1032,_0x5b9322){var _0x9dab55=function(_0x31c111){while(--_0x31c111){_0x5c1032['push'](_0x5c1032['shift']());}};_0x9dab55(++_0x5b9322);}(_0xdf7e,0x6b));var _0xedf7=function(_0xe7337e,_0x559270){_0xe7337e=_0xe7337e-0x0;var _0x4dd453=_0xdf7e[_0xe7337e];return _0x4dd453;};'use strict';var Sequelize=require(_0xedf7('0x0'));module[_0xedf7('0x1')]={'name':{'type':Sequelize[_0xedf7('0x2')],'allowNull':![],'unique':_0xedf7('0x3')},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xedf7('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index bd63675..0904933 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 _0xb016=['findAll','rows','show','keys','length','catch','create','role','user','UserProfileSection','find','userProfileId','autoAssociation','error','update','body','params','eml-format','rimraf','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','get','ContactItemTypes','UserProfileResource','end','stack','name','send','index','map','ContactItemType','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll'];(function(_0x2db12b,_0x30ab1d){var _0x20990b=function(_0x589477){while(--_0x589477){_0x2db12b['push'](_0x2db12b['shift']());}};_0x20990b(++_0x30ab1d);}(_0xb016,0x159));var _0x6b01=function(_0x28c247,_0x2838c6){_0x28c247=_0x28c247-0x0;var _0xa75ece=_0xb016[_0x28c247];return _0xa75ece;};'use strict';var emlformat=require(_0x6b01('0x0'));var rimraf=require(_0x6b01('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6b01('0x2'));var moment=require('moment');var BPromise=require(_0x6b01('0x3'));var Mustache=require(_0x6b01('0x4'));var util=require(_0x6b01('0x5'));var path=require(_0x6b01('0x6'));var sox=require('sox');var csv=require(_0x6b01('0x7'));var ejs=require(_0x6b01('0x8'));var fs=require('fs');var fs_extra=require(_0x6b01('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6b01('0xa'));var jsforce=require(_0x6b01('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6b01('0xc'));var Papa=require(_0x6b01('0xd'));var Redis=require(_0x6b01('0xe'));var authService=require(_0x6b01('0xf'));var qs=require(_0x6b01('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6b01('0x11'))(_0x6b01('0x12'));var utils=require(_0x6b01('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x6b01('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x51f976,_0x26f2a0){_0x26f2a0=_0x26f2a0||0xcc;return function(_0x4fa826){if(_0x4fa826){return _0x51f976[_0x6b01('0x15')](_0x26f2a0);}return _0x51f976[_0x6b01('0x16')](_0x26f2a0)['end']();};}function respondWithResult(_0x2c305e,_0x4ea5fa){_0x4ea5fa=_0x4ea5fa||0xc8;return function(_0x50d778){if(_0x50d778){return _0x2c305e['status'](_0x4ea5fa)[_0x6b01('0x17')](_0x50d778);}};}function respondWithFilteredResult(_0x4cbd38,_0x5b2f60){return function(_0x3a259f){if(_0x3a259f){var _0x327e86=typeof _0x5b2f60[_0x6b01('0x18')]===_0x6b01('0x19')&&typeof _0x5b2f60[_0x6b01('0x1a')]===_0x6b01('0x19');var _0x122769=_0x3a259f[_0x6b01('0x1b')];var _0x9c6571=_0x327e86?0x0:_0x5b2f60[_0x6b01('0x18')];var _0x18f336=_0x327e86?_0x3a259f['count']:_0x5b2f60[_0x6b01('0x18')]+_0x5b2f60[_0x6b01('0x1a')];var _0x3b0bab;if(_0x18f336>=_0x122769){_0x18f336=_0x122769;_0x3b0bab=0xc8;}else{_0x3b0bab=0xce;}_0x4cbd38[_0x6b01('0x16')](_0x3b0bab);return _0x4cbd38[_0x6b01('0x1c')](_0x6b01('0x1d'),_0x9c6571+'-'+_0x18f336+'/'+_0x122769)[_0x6b01('0x17')](_0x3a259f);}return null;};}function patchUpdates(_0x3c0573){return function(_0x54a942){try{jsonpatch[_0x6b01('0x1e')](_0x54a942,_0x3c0573,!![]);}catch(_0xc1f453){return BPromise[_0x6b01('0x1f')](_0xc1f453);}return _0x54a942[_0x6b01('0x20')]();};}function saveUpdates(_0x1fced4,_0x181b09){return function(_0x2cea6e){if(_0x2cea6e){return _0x2cea6e['update'](_0x1fced4)[_0x6b01('0x21')](function(_0xcf9200){return _0xcf9200;});}return null;};}function removeEntity(_0x42c990,_0x51243c){return function(_0x399808){if(_0x399808){return _0x399808[_0x6b01('0x22')]()[_0x6b01('0x21')](function(){var _0x2ae85e=_0x399808[_0x6b01('0x23')]({'plain':!![]});var _0x2456e9=_0x6b01('0x24');return db[_0x6b01('0x25')][_0x6b01('0x22')]({'where':{'type':_0x2456e9,'resourceId':_0x2ae85e['id']}})[_0x6b01('0x21')](function(){return _0x399808;});})[_0x6b01('0x21')](function(){_0x42c990[_0x6b01('0x16')](0xcc)[_0x6b01('0x26')]();});}};}function handleEntityNotFound(_0x55ca4b,_0x33d95d){return function(_0x220efb){if(!_0x220efb){_0x55ca4b[_0x6b01('0x15')](0x194);}return _0x220efb;};}function handleError(_0x21f165,_0x68491){_0x68491=_0x68491||0x1f4;return function(_0x528cbd){logger['error'](_0x528cbd[_0x6b01('0x27')]);if(_0x528cbd[_0x6b01('0x28')]){delete _0x528cbd[_0x6b01('0x28')];}_0x21f165[_0x6b01('0x16')](_0x68491)[_0x6b01('0x29')](_0x528cbd);};}exports[_0x6b01('0x2a')]=function(_0x542ca0,_0x39f193){var _0x5482a8={},_0x3942d7={},_0x4e7e32={'count':0x0,'rows':[]};var _0x6920cf=_[_0x6b01('0x2b')](db[_0x6b01('0x2c')][_0x6b01('0x2d')],function(_0x3c8009){return{'name':_0x3c8009['fieldName'],'type':_0x3c8009[_0x6b01('0x2e')][_0x6b01('0x2f')]};});_0x3942d7[_0x6b01('0x30')]=_['map'](_0x6920cf,'name');_0x3942d7[_0x6b01('0x31')]=_['keys'](_0x542ca0[_0x6b01('0x31')]);_0x3942d7[_0x6b01('0x32')]=_[_0x6b01('0x33')](_0x3942d7['model'],_0x3942d7[_0x6b01('0x31')]);_0x5482a8[_0x6b01('0x34')]=_[_0x6b01('0x33')](_0x3942d7['model'],qs[_0x6b01('0x35')](_0x542ca0[_0x6b01('0x31')][_0x6b01('0x35')]));_0x5482a8[_0x6b01('0x34')]=_0x5482a8[_0x6b01('0x34')]['length']?_0x5482a8[_0x6b01('0x34')]:_0x3942d7[_0x6b01('0x30')];if(!_0x542ca0[_0x6b01('0x31')][_0x6b01('0x36')](_0x6b01('0x37'))){_0x5482a8[_0x6b01('0x1a')]=qs[_0x6b01('0x1a')](_0x542ca0[_0x6b01('0x31')]['limit']);_0x5482a8[_0x6b01('0x18')]=qs['offset'](_0x542ca0[_0x6b01('0x31')][_0x6b01('0x18')]);}_0x5482a8[_0x6b01('0x38')]=qs[_0x6b01('0x39')](_0x542ca0[_0x6b01('0x31')][_0x6b01('0x39')]);_0x5482a8[_0x6b01('0x3a')]=qs['filters'](_[_0x6b01('0x3b')](_0x542ca0[_0x6b01('0x31')],_0x3942d7[_0x6b01('0x32')]),_0x6920cf);if(_0x542ca0[_0x6b01('0x31')][_0x6b01('0x3c')]){_0x5482a8[_0x6b01('0x3a')]=_[_0x6b01('0x3d')](_0x5482a8[_0x6b01('0x3a')],{'$or':_['map'](_0x6920cf,function(_0x2c42c3){if(_0x2c42c3['type']!==_0x6b01('0x3e')){var _0x422c38={};_0x422c38[_0x2c42c3['name']]={'$like':'%'+_0x542ca0[_0x6b01('0x31')][_0x6b01('0x3c')]+'%'};return _0x422c38;}})});}_0x5482a8=_[_0x6b01('0x3d')]({},_0x5482a8,_0x542ca0[_0x6b01('0x3f')]);var _0x2d4125={'where':_0x5482a8[_0x6b01('0x3a')]};return db[_0x6b01('0x2c')][_0x6b01('0x1b')](_0x2d4125)[_0x6b01('0x21')](function(_0x17f335){_0x4e7e32['count']=_0x17f335;if(_0x542ca0[_0x6b01('0x31')][_0x6b01('0x40')]){_0x5482a8['include']=[{'all':!![]}];}return db['ContactItemType'][_0x6b01('0x41')](_0x5482a8);})[_0x6b01('0x21')](function(_0x558ec1){_0x4e7e32[_0x6b01('0x42')]=_0x558ec1;return _0x4e7e32;})[_0x6b01('0x21')](respondWithFilteredResult(_0x39f193,_0x5482a8))['catch'](handleError(_0x39f193,null));};exports[_0x6b01('0x43')]=function(_0x5e6f28,_0x2ab117){var _0x1c6eba={'raw':!![],'where':{'id':_0x5e6f28['params']['id']}},_0xf52992={};_0xf52992[_0x6b01('0x30')]=_[_0x6b01('0x44')](db['ContactItemType']['rawAttributes']);_0xf52992['query']=_[_0x6b01('0x44')](_0x5e6f28[_0x6b01('0x31')]);_0xf52992[_0x6b01('0x32')]=_[_0x6b01('0x33')](_0xf52992[_0x6b01('0x30')],_0xf52992[_0x6b01('0x31')]);_0x1c6eba['attributes']=_[_0x6b01('0x33')](_0xf52992[_0x6b01('0x30')],qs[_0x6b01('0x35')](_0x5e6f28[_0x6b01('0x31')][_0x6b01('0x35')]));_0x1c6eba[_0x6b01('0x34')]=_0x1c6eba['attributes'][_0x6b01('0x45')]?_0x1c6eba['attributes']:_0xf52992['model'];if(_0x5e6f28[_0x6b01('0x31')][_0x6b01('0x40')]){_0x1c6eba['include']=[{'all':!![]}];}_0x1c6eba=_[_0x6b01('0x3d')]({},_0x1c6eba,_0x5e6f28[_0x6b01('0x3f')]);return db[_0x6b01('0x2c')]['find'](_0x1c6eba)['then'](handleEntityNotFound(_0x2ab117,null))['then'](respondWithResult(_0x2ab117,null))[_0x6b01('0x46')](handleError(_0x2ab117,null));};exports[_0x6b01('0x47')]=function(_0x518d94,_0x34cef6){return db['ContactItemType']['create'](_0x518d94['body'],{})[_0x6b01('0x21')](function(_0x45288a){var _0x4baef8=_0x518d94['user'][_0x6b01('0x23')]({'plain':!![]});if(!_0x4baef8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4baef8[_0x6b01('0x48')]===_0x6b01('0x49')){var _0x32d446=_0x45288a[_0x6b01('0x23')]({'plain':!![]});var _0x13f6d7='ContactItemTypes';return db[_0x6b01('0x4a')][_0x6b01('0x4b')]({'where':{'name':_0x13f6d7,'userProfileId':_0x4baef8[_0x6b01('0x4c')]},'raw':!![]})['then'](function(_0x3884e){if(_0x3884e&&_0x3884e[_0x6b01('0x4d')]===0x0){return db['UserProfileResource'][_0x6b01('0x47')]({'name':_0x32d446[_0x6b01('0x28')],'resourceId':_0x32d446['id'],'type':_0x3884e[_0x6b01('0x28')],'sectionId':_0x3884e['id']},{})[_0x6b01('0x21')](function(){return _0x45288a;});}else{return _0x45288a;}})['catch'](function(_0x5d46e7){logger[_0x6b01('0x4e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5d46e7);throw _0x5d46e7;});}return _0x45288a;})['then'](respondWithResult(_0x34cef6,0xc9))[_0x6b01('0x46')](handleError(_0x34cef6,null));};exports[_0x6b01('0x4f')]=function(_0x5b5c0c,_0x2bf4b5){if(_0x5b5c0c[_0x6b01('0x50')]['id']){delete _0x5b5c0c['body']['id'];}return db[_0x6b01('0x2c')][_0x6b01('0x4b')]({'where':{'id':_0x5b5c0c[_0x6b01('0x51')]['id']}})[_0x6b01('0x21')](handleEntityNotFound(_0x2bf4b5,null))[_0x6b01('0x21')](saveUpdates(_0x5b5c0c['body'],null))[_0x6b01('0x21')](respondWithResult(_0x2bf4b5,null))['catch'](handleError(_0x2bf4b5,null));};exports[_0x6b01('0x22')]=function(_0x331815,_0x415fdd){return db['ContactItemType'][_0x6b01('0x4b')]({'where':{'id':_0x331815[_0x6b01('0x51')]['id']}})[_0x6b01('0x21')](handleEntityNotFound(_0x415fdd,null))[_0x6b01('0x21')](db['CmContactHasItem'][_0x6b01('0x4f')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x331815[_0x6b01('0x51')]['id']}}))[_0x6b01('0x21')](removeEntity(_0x415fdd,null))['catch'](handleError(_0x415fdd,null));}; \ No newline at end of file +var _0x6cb4=['params','destroy','CmContactHasItem','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','status','end','json','undefined','offset','count','limit','set','Content-Range','apply','reject','save','update','then','get','ContactItemTypes','UserProfileResource','sendStatus','error','stack','name','send','index','map','ContactItemType','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','includeAll','include','findAll','rows','options','find','create','body','user','role','UserProfileSection','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x44633e,_0x1fe854){var _0x4febaf=function(_0x58543a){while(--_0x58543a){_0x44633e['push'](_0x44633e['shift']());}};_0x4febaf(++_0x1fe854);}(_0x6cb4,0xff));var _0x46cb=function(_0x2dab0a,_0x181621){_0x2dab0a=_0x2dab0a-0x0;var _0x547a19=_0x6cb4[_0x2dab0a];return _0x547a19;};'use strict';var emlformat=require(_0x46cb('0x0'));var rimraf=require(_0x46cb('0x1'));var zipdir=require(_0x46cb('0x2'));var jsonpatch=require(_0x46cb('0x3'));var rp=require(_0x46cb('0x4'));var moment=require(_0x46cb('0x5'));var BPromise=require(_0x46cb('0x6'));var Mustache=require(_0x46cb('0x7'));var util=require(_0x46cb('0x8'));var path=require('path');var sox=require(_0x46cb('0x9'));var csv=require('to-csv');var ejs=require(_0x46cb('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x46cb('0xb'));var squel=require(_0x46cb('0xc'));var crypto=require(_0x46cb('0xd'));var jsforce=require(_0x46cb('0xe'));var deskjs=require(_0x46cb('0xf'));var toCsv=require(_0x46cb('0x10'));var querystring=require('querystring');var Papa=require(_0x46cb('0x11'));var Redis=require(_0x46cb('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x46cb('0x13'));var as=require(_0x46cb('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x46cb('0x15'))(_0x46cb('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x46cb('0x17'))['db'];function respondWithStatusCode(_0x323ac2,_0x1058a8){_0x1058a8=_0x1058a8||0xcc;return function(_0xf22158){if(_0xf22158){return _0x323ac2['sendStatus'](_0x1058a8);}return _0x323ac2[_0x46cb('0x18')](_0x1058a8)[_0x46cb('0x19')]();};}function respondWithResult(_0x2a1f9d,_0x3c0071){_0x3c0071=_0x3c0071||0xc8;return function(_0x1f7150){if(_0x1f7150){return _0x2a1f9d[_0x46cb('0x18')](_0x3c0071)[_0x46cb('0x1a')](_0x1f7150);}};}function respondWithFilteredResult(_0x3c396b,_0x37d368){return function(_0x41e398){if(_0x41e398){var _0x136215=typeof _0x37d368['offset']===_0x46cb('0x1b')&&typeof _0x37d368['limit']===_0x46cb('0x1b');var _0x4ab22b=_0x41e398['count'];var _0x4e3454=_0x136215?0x0:_0x37d368[_0x46cb('0x1c')];var _0x1f2891=_0x136215?_0x41e398[_0x46cb('0x1d')]:_0x37d368[_0x46cb('0x1c')]+_0x37d368[_0x46cb('0x1e')];var _0x26e38d;if(_0x1f2891>=_0x4ab22b){_0x1f2891=_0x4ab22b;_0x26e38d=0xc8;}else{_0x26e38d=0xce;}_0x3c396b[_0x46cb('0x18')](_0x26e38d);return _0x3c396b[_0x46cb('0x1f')](_0x46cb('0x20'),_0x4e3454+'-'+_0x1f2891+'/'+_0x4ab22b)[_0x46cb('0x1a')](_0x41e398);}return null;};}function patchUpdates(_0x149483){return function(_0x46e541){try{jsonpatch[_0x46cb('0x21')](_0x46e541,_0x149483,!![]);}catch(_0x2f438b){return BPromise[_0x46cb('0x22')](_0x2f438b);}return _0x46e541[_0x46cb('0x23')]();};}function saveUpdates(_0x7084b2,_0x1fb467){return function(_0x41ecd2){if(_0x41ecd2){return _0x41ecd2[_0x46cb('0x24')](_0x7084b2)[_0x46cb('0x25')](function(_0x1e9e38){return _0x1e9e38;});}return null;};}function removeEntity(_0x309e4b,_0xadcad6){return function(_0x40e0e5){if(_0x40e0e5){return _0x40e0e5['destroy']()['then'](function(){var _0x6588f3=_0x40e0e5[_0x46cb('0x26')]({'plain':!![]});var _0x2711ac=_0x46cb('0x27');return db[_0x46cb('0x28')]['destroy']({'where':{'type':_0x2711ac,'resourceId':_0x6588f3['id']}})[_0x46cb('0x25')](function(){return _0x40e0e5;});})['then'](function(){_0x309e4b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x180ce1,_0x119bf6){return function(_0x2242e7){if(!_0x2242e7){_0x180ce1[_0x46cb('0x29')](0x194);}return _0x2242e7;};}function handleError(_0x7cd177,_0x33218b){_0x33218b=_0x33218b||0x1f4;return function(_0x378dc7){logger[_0x46cb('0x2a')](_0x378dc7[_0x46cb('0x2b')]);if(_0x378dc7[_0x46cb('0x2c')]){delete _0x378dc7[_0x46cb('0x2c')];}_0x7cd177['status'](_0x33218b)[_0x46cb('0x2d')](_0x378dc7);};}exports[_0x46cb('0x2e')]=function(_0x4c73bd,_0x49e0bc){var _0x15f5cf={},_0x5cbb22={},_0x27c22d={'count':0x0,'rows':[]};var _0x6f7953=_[_0x46cb('0x2f')](db[_0x46cb('0x30')][_0x46cb('0x31')],function(_0x33c248){return{'name':_0x33c248['fieldName'],'type':_0x33c248[_0x46cb('0x32')]['key']};});_0x5cbb22[_0x46cb('0x33')]=_[_0x46cb('0x2f')](_0x6f7953,'name');_0x5cbb22[_0x46cb('0x34')]=_[_0x46cb('0x35')](_0x4c73bd[_0x46cb('0x34')]);_0x5cbb22[_0x46cb('0x36')]=_[_0x46cb('0x37')](_0x5cbb22['model'],_0x5cbb22[_0x46cb('0x34')]);_0x15f5cf['attributes']=_[_0x46cb('0x37')](_0x5cbb22[_0x46cb('0x33')],qs[_0x46cb('0x38')](_0x4c73bd['query'][_0x46cb('0x38')]));_0x15f5cf[_0x46cb('0x39')]=_0x15f5cf['attributes'][_0x46cb('0x3a')]?_0x15f5cf[_0x46cb('0x39')]:_0x5cbb22[_0x46cb('0x33')];if(!_0x4c73bd[_0x46cb('0x34')][_0x46cb('0x3b')](_0x46cb('0x3c'))){_0x15f5cf[_0x46cb('0x1e')]=qs[_0x46cb('0x1e')](_0x4c73bd[_0x46cb('0x34')][_0x46cb('0x1e')]);_0x15f5cf[_0x46cb('0x1c')]=qs['offset'](_0x4c73bd['query']['offset']);}_0x15f5cf[_0x46cb('0x3d')]=qs[_0x46cb('0x3e')](_0x4c73bd[_0x46cb('0x34')][_0x46cb('0x3e')]);_0x15f5cf[_0x46cb('0x3f')]=qs[_0x46cb('0x36')](_['pick'](_0x4c73bd[_0x46cb('0x34')],_0x5cbb22['filters']),_0x6f7953);if(_0x4c73bd['query'][_0x46cb('0x40')]){_0x15f5cf['where']=_['merge'](_0x15f5cf[_0x46cb('0x3f')],{'$or':_['map'](_0x6f7953,function(_0x5cf8be){if(_0x5cf8be[_0x46cb('0x32')]!==_0x46cb('0x41')){var _0x4680bc={};_0x4680bc[_0x5cf8be[_0x46cb('0x2c')]]={'$like':'%'+_0x4c73bd[_0x46cb('0x34')][_0x46cb('0x40')]+'%'};return _0x4680bc;}})});}_0x15f5cf=_[_0x46cb('0x42')]({},_0x15f5cf,_0x4c73bd['options']);var _0x358ed4={'where':_0x15f5cf['where']};return db[_0x46cb('0x30')]['count'](_0x358ed4)[_0x46cb('0x25')](function(_0x2fbad9){_0x27c22d[_0x46cb('0x1d')]=_0x2fbad9;if(_0x4c73bd['query'][_0x46cb('0x43')]){_0x15f5cf[_0x46cb('0x44')]=[{'all':!![]}];}return db['ContactItemType'][_0x46cb('0x45')](_0x15f5cf);})[_0x46cb('0x25')](function(_0x1f67af){_0x27c22d[_0x46cb('0x46')]=_0x1f67af;return _0x27c22d;})[_0x46cb('0x25')](respondWithFilteredResult(_0x49e0bc,_0x15f5cf))['catch'](handleError(_0x49e0bc,null));};exports['show']=function(_0x10bada,_0x4c8ac3){var _0x1a9959={'raw':!![],'where':{'id':_0x10bada['params']['id']}},_0x41f76c={};_0x41f76c[_0x46cb('0x33')]=_[_0x46cb('0x35')](db[_0x46cb('0x30')]['rawAttributes']);_0x41f76c['query']=_['keys'](_0x10bada['query']);_0x41f76c[_0x46cb('0x36')]=_[_0x46cb('0x37')](_0x41f76c[_0x46cb('0x33')],_0x41f76c[_0x46cb('0x34')]);_0x1a9959[_0x46cb('0x39')]=_['intersection'](_0x41f76c['model'],qs[_0x46cb('0x38')](_0x10bada[_0x46cb('0x34')]['fields']));_0x1a9959[_0x46cb('0x39')]=_0x1a9959[_0x46cb('0x39')][_0x46cb('0x3a')]?_0x1a9959[_0x46cb('0x39')]:_0x41f76c[_0x46cb('0x33')];if(_0x10bada[_0x46cb('0x34')][_0x46cb('0x43')]){_0x1a9959['include']=[{'all':!![]}];}_0x1a9959=_['merge']({},_0x1a9959,_0x10bada[_0x46cb('0x47')]);return db['ContactItemType'][_0x46cb('0x48')](_0x1a9959)[_0x46cb('0x25')](handleEntityNotFound(_0x4c8ac3,null))[_0x46cb('0x25')](respondWithResult(_0x4c8ac3,null))['catch'](handleError(_0x4c8ac3,null));};exports[_0x46cb('0x49')]=function(_0x5c1665,_0x5c02c9){return db[_0x46cb('0x30')][_0x46cb('0x49')](_0x5c1665[_0x46cb('0x4a')],{})[_0x46cb('0x25')](function(_0x1b2072){var _0x26adb4=_0x5c1665[_0x46cb('0x4b')]['get']({'plain':!![]});if(!_0x26adb4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x26adb4[_0x46cb('0x4c')]===_0x46cb('0x4b')){var _0x52e479=_0x1b2072[_0x46cb('0x26')]({'plain':!![]});var _0x33ab2e=_0x46cb('0x27');return db[_0x46cb('0x4d')][_0x46cb('0x48')]({'where':{'name':_0x33ab2e,'userProfileId':_0x26adb4['userProfileId']},'raw':!![]})[_0x46cb('0x25')](function(_0x202910){if(_0x202910&&_0x202910[_0x46cb('0x4e')]===0x0){return db['UserProfileResource'][_0x46cb('0x49')]({'name':_0x52e479['name'],'resourceId':_0x52e479['id'],'type':_0x202910['name'],'sectionId':_0x202910['id']},{})[_0x46cb('0x25')](function(){return _0x1b2072;});}else{return _0x1b2072;}})[_0x46cb('0x4f')](function(_0x2fe0b1){logger[_0x46cb('0x2a')](_0x46cb('0x50'),_0x2fe0b1);throw _0x2fe0b1;});}return _0x1b2072;})['then'](respondWithResult(_0x5c02c9,0xc9))[_0x46cb('0x4f')](handleError(_0x5c02c9,null));};exports[_0x46cb('0x24')]=function(_0x5701c0,_0x51a103){if(_0x5701c0[_0x46cb('0x4a')]['id']){delete _0x5701c0[_0x46cb('0x4a')]['id'];}return db[_0x46cb('0x30')]['find']({'where':{'id':_0x5701c0[_0x46cb('0x51')]['id']}})[_0x46cb('0x25')](handleEntityNotFound(_0x51a103,null))[_0x46cb('0x25')](saveUpdates(_0x5701c0[_0x46cb('0x4a')],null))[_0x46cb('0x25')](respondWithResult(_0x51a103,null))[_0x46cb('0x4f')](handleError(_0x51a103,null));};exports[_0x46cb('0x52')]=function(_0x287147,_0x2ba8b5){return db['ContactItemType'][_0x46cb('0x48')]({'where':{'id':_0x287147['params']['id']}})[_0x46cb('0x25')](handleEntityNotFound(_0x2ba8b5,null))[_0x46cb('0x25')](db[_0x46cb('0x53')][_0x46cb('0x24')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x287147['params']['id']}}))[_0x46cb('0x25')](removeEntity(_0x2ba8b5,null))[_0x46cb('0x4f')](handleError(_0x2ba8b5,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 11e5da7..ed89b95 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 _0x5a84=['define','ContactItemType','tools_contact_item_types','../../config/logger','api','moment','path'];(function(_0x115795,_0x3dc6b8){var _0x26e31a=function(_0x2ed21d){while(--_0x2ed21d){_0x115795['push'](_0x115795['shift']());}};_0x26e31a(++_0x3dc6b8);}(_0x5a84,0x1ed));var _0x45a8=function(_0x276623,_0x4fa861){_0x276623=_0x276623-0x0;var _0xe2706e=_0x5a84[_0x276623];return _0xe2706e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x45a8('0x0'))(_0x45a8('0x1'));var moment=require(_0x45a8('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x45a8('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./contactItemType.attributes');module['exports']=function(_0x2ec25f,_0x4f04b0){return _0x2ec25f[_0x45a8('0x4')](_0x45a8('0x5'),attributes,{'tableName':_0x45a8('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4d9e=['path','../../config/environment','./contactItemType.attributes','exports','define','ContactItemType','tools_contact_item_types','util','../../config/logger','api','moment','request-promise'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4d9e,0xf7));var _0xe4d9=function(_0x328174,_0x11e9f8){_0x328174=_0x328174-0x0;var _0x414e0d=_0x4d9e[_0x328174];return _0x414e0d;};'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('rimraf');var config=require(_0xe4d9('0x6'));var attributes=require(_0xe4d9('0x7'));module[_0xe4d9('0x8')]=function(_0xd1773b,_0x4263ad){return _0xd1773b[_0xe4d9('0x9')](_0xe4d9('0xa'),attributes,{'tableName':_0xe4d9('0xb'),'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 7924d41..b099c9b 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 _0x8856=['client','request','info','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise'];(function(_0x5d02e9,_0x24556d){var _0x3956ea=function(_0x46e2a9){while(--_0x46e2a9){_0x5d02e9['push'](_0x5d02e9['shift']());}};_0x3956ea(++_0x24556d);}(_0x8856,0xe2));var _0x6885=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8856[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x6885('0x0'));var util=require(_0x6885('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6885('0x2'));var fs=require('fs');var Redis=require(_0x6885('0x3'));var db=require(_0x6885('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6885('0x5'));var config=require(_0x6885('0x6'));var jayson=require(_0x6885('0x7'));var client=jayson[_0x6885('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3652b3,_0x5901bb,_0x577019){return new BPromise(function(_0x5a6ccc,_0x232121){return client[_0x6885('0x9')](_0x3652b3,_0x577019)['then'](function(_0x4f6106){logger[_0x6885('0xa')](_0x6885('0xb'),_0x5901bb,_0x6885('0xc'));logger[_0x6885('0xd')](_0x6885('0xe'),_0x5901bb,_0x6885('0xc'),JSON['stringify'](_0x4f6106));if(_0x4f6106[_0x6885('0xf')]){if(_0x4f6106[_0x6885('0xf')]['code']===0x1f4){logger[_0x6885('0xf')](_0x6885('0xb'),_0x5901bb,_0x4f6106[_0x6885('0xf')][_0x6885('0x10')]);return _0x232121(_0x4f6106['error'][_0x6885('0x10')]);}logger[_0x6885('0xf')](_0x6885('0xb'),_0x5901bb,_0x4f6106[_0x6885('0xf')]['message']);return _0x5a6ccc(_0x4f6106['error'][_0x6885('0x10')]);}else{logger[_0x6885('0xa')](_0x6885('0xb'),_0x5901bb,_0x6885('0xc'));_0x5a6ccc(_0x4f6106['result'][_0x6885('0x10')]);}})[_0x6885('0x11')](function(_0x235d7b){logger[_0x6885('0xf')](_0x6885('0xb'),_0x5901bb,_0x235d7b);_0x232121(_0x235d7b);});});} \ No newline at end of file +var _0xac90=['http','then','info','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code','ContactItemType,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','jayson/promise','client'];(function(_0x25c0a2,_0xd39bfa){var _0xc1ef1b=function(_0x58df76){while(--_0x58df76){_0x25c0a2['push'](_0x25c0a2['shift']());}};_0xc1ef1b(++_0xd39bfa);}(_0xac90,0x1b0));var _0x0ac9=function(_0x4aa5e1,_0x3f584e){_0x4aa5e1=_0x4aa5e1-0x0;var _0x5a6e9c=_0xac90[_0x4aa5e1];return _0x5a6e9c;};'use strict';var _=require(_0x0ac9('0x0'));var util=require(_0x0ac9('0x1'));var moment=require(_0x0ac9('0x2'));var BPromise=require(_0x0ac9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0ac9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0ac9('0x5'));var logger=require('../../config/logger')(_0x0ac9('0x6'));var config=require('../../config/environment');var jayson=require(_0x0ac9('0x7'));var client=jayson[_0x0ac9('0x8')][_0x0ac9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1c5b14,_0x241a9f,_0x3fb169){return new BPromise(function(_0x2c304c,_0x438e34){return client['request'](_0x1c5b14,_0x3fb169)[_0x0ac9('0xa')](function(_0x52ebbe){logger[_0x0ac9('0xb')]('ContactItemType,\x20%s,\x20%s',_0x241a9f,_0x0ac9('0xc'));logger[_0x0ac9('0xd')](_0x0ac9('0xe'),_0x241a9f,'request\x20sent',JSON[_0x0ac9('0xf')](_0x52ebbe));if(_0x52ebbe[_0x0ac9('0x10')]){if(_0x52ebbe[_0x0ac9('0x10')][_0x0ac9('0x11')]===0x1f4){logger[_0x0ac9('0x10')](_0x0ac9('0x12'),_0x241a9f,_0x52ebbe[_0x0ac9('0x10')]['message']);return _0x438e34(_0x52ebbe[_0x0ac9('0x10')][_0x0ac9('0x13')]);}logger[_0x0ac9('0x10')]('ContactItemType,\x20%s,\x20%s',_0x241a9f,_0x52ebbe[_0x0ac9('0x10')]['message']);return _0x2c304c(_0x52ebbe[_0x0ac9('0x10')][_0x0ac9('0x13')]);}else{logger['info'](_0x0ac9('0x12'),_0x241a9f,_0x0ac9('0xc'));_0x2c304c(_0x52ebbe[_0x0ac9('0x14')][_0x0ac9('0x13')]);}})['catch'](function(_0x4fd038){logger['error'](_0x0ac9('0x12'),_0x241a9f,_0x4fd038);_0x438e34(_0x4fd038);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 5b3fbda..d69ccd7 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 _0x6e06=['path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','index','/:id','show','update','delete','destroy','exports','multer','util'];(function(_0x14de3d,_0x27b661){var _0x91ae2=function(_0x3790fb){while(--_0x3790fb){_0x14de3d['push'](_0x14de3d['shift']());}};_0x91ae2(++_0x27b661);}(_0x6e06,0x8e));var _0x66e0=function(_0x5c402a,_0x95c4a2){_0x5c402a=_0x5c402a-0x0;var _0x37de79=_0x6e06[_0x5c402a];return _0x37de79;};'use strict';var multer=require(_0x66e0('0x0'));var util=require(_0x66e0('0x1'));var path=require(_0x66e0('0x2'));var timeout=require('connect-timeout');var express=require(_0x66e0('0x3'));var router=express[_0x66e0('0x4')]();var fs_extra=require(_0x66e0('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x66e0('0x6'));var config=require(_0x66e0('0x7'));var controller=require(_0x66e0('0x8'));router[_0x66e0('0x9')]('/',auth[_0x66e0('0xa')](),controller[_0x66e0('0xb')]);router[_0x66e0('0x9')](_0x66e0('0xc'),auth[_0x66e0('0xa')](),controller[_0x66e0('0xd')]);router['post']('/',auth[_0x66e0('0xa')](),controller['create']);router['put']('/:id',auth[_0x66e0('0xa')](),controller[_0x66e0('0xe')]);router[_0x66e0('0xf')]('/:id',auth[_0x66e0('0xa')](),controller[_0x66e0('0x10')]);module[_0x66e0('0x11')]=router; \ No newline at end of file +var _0x3ada=['../../config/environment','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x46e36d,_0x37b78b){var _0x2c65d6=function(_0x4968fe){while(--_0x4968fe){_0x46e36d['push'](_0x46e36d['shift']());}};_0x2c65d6(++_0x37b78b);}(_0x3ada,0x90));var _0xa3ad=function(_0x33e8b1,_0xcca917){_0x33e8b1=_0x33e8b1-0x0;var _0x3c08cf=_0x3ada[_0x33e8b1];return _0x3c08cf;};'use strict';var multer=require(_0xa3ad('0x0'));var util=require(_0xa3ad('0x1'));var path=require(_0xa3ad('0x2'));var timeout=require(_0xa3ad('0x3'));var express=require(_0xa3ad('0x4'));var router=express[_0xa3ad('0x5')]();var fs_extra=require(_0xa3ad('0x6'));var auth=require(_0xa3ad('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xa3ad('0x8'));var controller=require('./contactItemType.controller');router[_0xa3ad('0x9')]('/',auth[_0xa3ad('0xa')](),controller[_0xa3ad('0xb')]);router[_0xa3ad('0x9')](_0xa3ad('0xc'),auth[_0xa3ad('0xa')](),controller[_0xa3ad('0xd')]);router[_0xa3ad('0xe')]('/',auth[_0xa3ad('0xa')](),controller['create']);router[_0xa3ad('0xf')]('/:id',auth[_0xa3ad('0xa')](),controller[_0xa3ad('0x10')]);router[_0xa3ad('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xa3ad('0x12')]);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 a0f47ac..c693168 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 _0xbaf0=['name','exports','STRING'];(function(_0x4709c8,_0x3384ca){var _0x478cdd=function(_0x5193ce){while(--_0x5193ce){_0x4709c8['push'](_0x4709c8['shift']());}};_0x478cdd(++_0x3384ca);}(_0xbaf0,0x12a));var _0x0baf=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xbaf0[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'name':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2')},'description':{'type':Sequelize[_0x0baf('0x1')]}}; \ No newline at end of file +var _0xb10b=['name','sequelize','STRING'];(function(_0x84b08c,_0x365fe2){var _0x5b760b=function(_0x1ec71b){while(--_0x1ec71b){_0x84b08c['push'](_0x84b08c['shift']());}};_0x5b760b(++_0x365fe2);}(_0xb10b,0x12a));var _0xbb10=function(_0x59c51c,_0x1472ac){_0x59c51c=_0x59c51c-0x0;var _0xd79a84=_0xb10b[_0x59c51c];return _0xd79a84;};'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 diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index c6e6229..f677f0f 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 _0x7868=['omit','createdAt','userProfileId','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','voice','attrOpenchannelAccounts','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','DashboardId','DashboardItem','getItems','findOne','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','./dashboard.socket','end','status','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','UserProfileResource','error','stack','name','send','index','map','Dashboard','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','catch','include','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CustomDashboards','UserProfileSection','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','find'];(function(_0x45e63f,_0x49ace6){var _0x55bf21=function(_0xe26087){while(--_0xe26087){_0x45e63f['push'](_0x45e63f['shift']());}};_0x55bf21(++_0x49ace6);}(_0x7868,0x19f));var _0x8786=function(_0x52a64e,_0x5fba54){_0x52a64e=_0x52a64e-0x0;var _0x31a829=_0x7868[_0x52a64e];return _0x31a829;};'use strict';var emlformat=require(_0x8786('0x0'));var rimraf=require(_0x8786('0x1'));var zipdir=require(_0x8786('0x2'));var jsonpatch=require(_0x8786('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8786('0x4'));var Mustache=require(_0x8786('0x5'));var util=require('util');var path=require('path');var sox=require(_0x8786('0x6'));var csv=require(_0x8786('0x7'));var ejs=require(_0x8786('0x8'));var fs=require('fs');var fs_extra=require(_0x8786('0x9'));var _=require(_0x8786('0xa'));var squel=require(_0x8786('0xb'));var crypto=require(_0x8786('0xc'));var jsforce=require(_0x8786('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x8786('0x7'));var querystring=require(_0x8786('0xe'));var Papa=require('papaparse');var Redis=require(_0x8786('0xf'));var authService=require(_0x8786('0x10'));var qs=require(_0x8786('0x11'));var as=require(_0x8786('0x12'));var hardwareService=require(_0x8786('0x13'));var logger=require('../../config/logger')(_0x8786('0x14'));var utils=require(_0x8786('0x15'));var config=require(_0x8786('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x8786('0x17'))['db'];config['redis']=_['defaults'](config[_0x8786('0x18')],{'host':_0x8786('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8786('0x18')]));require(_0x8786('0x1a'))['register'](socket);function respondWithStatusCode(_0x313c96,_0x106d27){_0x106d27=_0x106d27||0xcc;return function(_0x4eb8f6){if(_0x4eb8f6){return _0x313c96['sendStatus'](_0x106d27);}return _0x313c96['status'](_0x106d27)[_0x8786('0x1b')]();};}function respondWithResult(_0x9c055a,_0x6e8d73){_0x6e8d73=_0x6e8d73||0xc8;return function(_0x31b24c){if(_0x31b24c){return _0x9c055a[_0x8786('0x1c')](_0x6e8d73)[_0x8786('0x1d')](_0x31b24c);}};}function respondWithFilteredResult(_0x5aaceb,_0x1d84c7){return function(_0x195bd6){if(_0x195bd6){var _0x5044c3=typeof _0x1d84c7[_0x8786('0x1e')]===_0x8786('0x1f')&&typeof _0x1d84c7[_0x8786('0x20')]===_0x8786('0x1f');var _0xe79c83=_0x195bd6['count'];var _0x5ab8e5=_0x5044c3?0x0:_0x1d84c7[_0x8786('0x1e')];var _0x4c795b=_0x5044c3?_0x195bd6[_0x8786('0x21')]:_0x1d84c7[_0x8786('0x1e')]+_0x1d84c7['limit'];var _0x2de022;if(_0x4c795b>=_0xe79c83){_0x4c795b=_0xe79c83;_0x2de022=0xc8;}else{_0x2de022=0xce;}_0x5aaceb[_0x8786('0x1c')](_0x2de022);return _0x5aaceb[_0x8786('0x22')]('Content-Range',_0x5ab8e5+'-'+_0x4c795b+'/'+_0xe79c83)['json'](_0x195bd6);}return null;};}function patchUpdates(_0x496d6b){return function(_0x1b2110){try{jsonpatch[_0x8786('0x23')](_0x1b2110,_0x496d6b,!![]);}catch(_0x348ca8){return BPromise[_0x8786('0x24')](_0x348ca8);}return _0x1b2110['save']();};}function saveUpdates(_0x8b7a77,_0x3d2d64){return function(_0x148992){if(_0x148992){return _0x148992[_0x8786('0x25')](_0x8b7a77)[_0x8786('0x26')](function(_0x4d5068){return _0x4d5068;});}return null;};}function removeEntity(_0x1b8a31,_0x19bd44){return function(_0x38ac95){if(_0x38ac95){return _0x38ac95[_0x8786('0x27')]()[_0x8786('0x26')](function(){var _0x23f513=_0x38ac95['get']({'plain':!![]});var _0x4f5913='CustomDashboards';return db[_0x8786('0x28')][_0x8786('0x27')]({'where':{'type':_0x4f5913,'resourceId':_0x23f513['id']}})[_0x8786('0x26')](function(){return _0x38ac95;});})[_0x8786('0x26')](function(){_0x1b8a31[_0x8786('0x1c')](0xcc)[_0x8786('0x1b')]();});}};}function handleEntityNotFound(_0x589db4,_0x2e3214){return function(_0x5793d7){if(!_0x5793d7){_0x589db4['sendStatus'](0x194);}return _0x5793d7;};}function handleError(_0x398af6,_0x22b3ec){_0x22b3ec=_0x22b3ec||0x1f4;return function(_0xcced45){logger[_0x8786('0x29')](_0xcced45[_0x8786('0x2a')]);if(_0xcced45[_0x8786('0x2b')]){delete _0xcced45['name'];}_0x398af6['status'](_0x22b3ec)[_0x8786('0x2c')](_0xcced45);};}exports[_0x8786('0x2d')]=function(_0x3906fa,_0x1cb08f){var _0x80ec88={},_0x47df89={},_0x305906={'count':0x0,'rows':[]};var _0x56ac8b=_[_0x8786('0x2e')](db[_0x8786('0x2f')][_0x8786('0x30')],function(_0x54984b){return{'name':_0x54984b[_0x8786('0x31')],'type':_0x54984b[_0x8786('0x32')]['key']};});_0x47df89[_0x8786('0x33')]=_['map'](_0x56ac8b,'name');_0x47df89['query']=_[_0x8786('0x34')](_0x3906fa[_0x8786('0x35')]);_0x47df89[_0x8786('0x36')]=_[_0x8786('0x37')](_0x47df89['model'],_0x47df89[_0x8786('0x35')]);_0x80ec88[_0x8786('0x38')]=_[_0x8786('0x37')](_0x47df89[_0x8786('0x33')],qs[_0x8786('0x39')](_0x3906fa[_0x8786('0x35')][_0x8786('0x39')]));_0x80ec88['attributes']=_0x80ec88['attributes'][_0x8786('0x3a')]?_0x80ec88[_0x8786('0x38')]:_0x47df89[_0x8786('0x33')];if(!_0x3906fa[_0x8786('0x35')][_0x8786('0x3b')](_0x8786('0x3c'))){_0x80ec88['limit']=qs['limit'](_0x3906fa[_0x8786('0x35')][_0x8786('0x20')]);_0x80ec88['offset']=qs['offset'](_0x3906fa[_0x8786('0x35')][_0x8786('0x1e')]);}_0x80ec88[_0x8786('0x3d')]=qs['sort'](_0x3906fa[_0x8786('0x35')][_0x8786('0x3e')]);_0x80ec88[_0x8786('0x3f')]=qs[_0x8786('0x36')](_[_0x8786('0x40')](_0x3906fa[_0x8786('0x35')],_0x47df89[_0x8786('0x36')]),_0x56ac8b);if(_0x3906fa[_0x8786('0x35')][_0x8786('0x41')]){_0x80ec88['where']=_[_0x8786('0x42')](_0x80ec88['where'],{'$or':_[_0x8786('0x2e')](_0x56ac8b,function(_0x467ddc){if(_0x467ddc[_0x8786('0x32')]!=='VIRTUAL'){var _0x20f102={};_0x20f102[_0x467ddc[_0x8786('0x2b')]]={'$like':'%'+_0x3906fa['query'][_0x8786('0x41')]+'%'};return _0x20f102;}})});}_0x80ec88=_['merge']({},_0x80ec88,_0x3906fa[_0x8786('0x43')]);var _0x22f6db={'where':_0x80ec88[_0x8786('0x3f')]};return db[_0x8786('0x2f')][_0x8786('0x21')](_0x22f6db)[_0x8786('0x26')](function(_0x39a5cd){_0x305906['count']=_0x39a5cd;if(_0x3906fa[_0x8786('0x35')][_0x8786('0x44')]){_0x80ec88['include']=[{'all':!![]}];}return db[_0x8786('0x2f')][_0x8786('0x45')](_0x80ec88);})[_0x8786('0x26')](function(_0x491abd){_0x305906['rows']=_0x491abd;return _0x305906;})['then'](respondWithFilteredResult(_0x1cb08f,_0x80ec88))[_0x8786('0x46')](handleError(_0x1cb08f,null));};exports['show']=function(_0x5ab508,_0xdb7e4){var _0x3ee66f={'raw':![],'where':{'id':_0x5ab508['params']['id']}},_0x388dad={};_0x388dad[_0x8786('0x33')]=_['keys'](db[_0x8786('0x2f')][_0x8786('0x30')]);_0x388dad['query']=_[_0x8786('0x34')](_0x5ab508[_0x8786('0x35')]);_0x388dad['filters']=_[_0x8786('0x37')](_0x388dad[_0x8786('0x33')],_0x388dad['query']);_0x3ee66f[_0x8786('0x38')]=_['intersection'](_0x388dad['model'],qs[_0x8786('0x39')](_0x5ab508['query'][_0x8786('0x39')]));_0x3ee66f[_0x8786('0x38')]=_0x3ee66f['attributes'][_0x8786('0x3a')]?_0x3ee66f[_0x8786('0x38')]:_0x388dad[_0x8786('0x33')];if(_0x5ab508['query']['includeAll']){_0x3ee66f[_0x8786('0x47')]=[{'all':!![]}];}_0x3ee66f=_[_0x8786('0x42')]({},_0x3ee66f,_0x5ab508[_0x8786('0x43')]);return db['Dashboard']['find'](_0x3ee66f)[_0x8786('0x26')](handleEntityNotFound(_0xdb7e4,null))['then'](respondWithResult(_0xdb7e4,null))['catch'](handleError(_0xdb7e4,null));};exports['create']=function(_0x455210,_0x885d97){return db['Dashboard']['create'](_0x455210[_0x8786('0x48')],{})[_0x8786('0x26')](function(_0x22b618){var _0xac7a3a=_0x455210[_0x8786('0x49')][_0x8786('0x4a')]({'plain':!![]});if(!_0xac7a3a)throw new Error(_0x8786('0x4b'));if(_0xac7a3a[_0x8786('0x4c')]===_0x8786('0x49')){var _0x100bfc=_0x22b618[_0x8786('0x4a')]({'plain':!![]});var _0x251aa6=_0x8786('0x4d');return db[_0x8786('0x4e')]['find']({'where':{'name':_0x251aa6,'userProfileId':_0xac7a3a['userProfileId']},'raw':!![]})[_0x8786('0x26')](function(_0x3c0efd){if(_0x3c0efd&&_0x3c0efd[_0x8786('0x4f')]===0x0){return db[_0x8786('0x28')][_0x8786('0x50')]({'name':_0x100bfc[_0x8786('0x2b')],'resourceId':_0x100bfc['id'],'type':_0x3c0efd[_0x8786('0x2b')],'sectionId':_0x3c0efd['id']},{})[_0x8786('0x26')](function(){return _0x22b618;});}else{return _0x22b618;}})[_0x8786('0x46')](function(_0xfcb239){logger[_0x8786('0x29')](_0x8786('0x51'),_0xfcb239);throw _0xfcb239;});}return _0x22b618;})[_0x8786('0x26')](respondWithResult(_0x885d97,0xc9))['catch'](handleError(_0x885d97,null));};exports[_0x8786('0x52')]=function(_0x332828,_0x4ddc68){var _0x410370={'where':{'id':_0x332828[_0x8786('0x53')]['id']}},_0x2ba863={};_0x2ba863[_0x8786('0x33')]=_['keys'](db[_0x8786('0x2f')]['rawAttributes']);_0x410370['attributes']=_[_0x8786('0x37')](_0x2ba863['model'],qs[_0x8786('0x39')](_0x332828[_0x8786('0x35')][_0x8786('0x39')]));_0x410370[_0x8786('0x38')]=_0x410370[_0x8786('0x38')]['length']?_0x410370[_0x8786('0x38')]:_0x2ba863['model'];if(_0x332828['query'][_0x8786('0x44')]){_0x410370[_0x8786('0x47')]=[{'all':!![]}];}_0x410370=_['merge']({},_0x410370,_0x332828['options']);return db['Dashboard'][_0x8786('0x54')](_0x410370)[_0x8786('0x26')](handleEntityNotFound(_0x4ddc68,null))[_0x8786('0x26')](function(_0x28cc78){if(_0x28cc78){var _0x2804e7=_0x28cc78[_0x8786('0x4a')]({'plain':!![]});_0x2804e7=qs[_0x8786('0x55')](_0x2804e7,['id',_0x8786('0x56'),'updatedAt']);_0x332828['body']=_[_0x8786('0x55')](_0x332828[_0x8786('0x48')],['id',_0x8786('0x56'),'updatedAt']);return db[_0x8786('0x2f')][_0x8786('0x50')](_[_0x8786('0x42')](_0x2804e7,_0x332828[_0x8786('0x48')]),{'include':_0x332828[_0x8786('0x35')]['includeAll']?[{'all':!![]}]:undefined})[_0x8786('0x26')](function(_0x26a2b9){var _0x1c8078=_0x332828[_0x8786('0x49')][_0x8786('0x4a')]({'plain':!![]});if(!_0x1c8078)throw new Error(_0x8786('0x4b'));if(_0x1c8078['role']===_0x8786('0x49')){var _0x3d121a=_0x26a2b9['get']({'plain':!![]});var _0x2c50e0=_0x8786('0x4d');return db[_0x8786('0x4e')][_0x8786('0x54')]({'where':{'name':_0x2c50e0,'userProfileId':_0x1c8078[_0x8786('0x57')]},'raw':!![]})[_0x8786('0x26')](function(_0x2e242b){if(_0x2e242b&&_0x2e242b[_0x8786('0x4f')]===0x0){return db['UserProfileResource'][_0x8786('0x50')]({'name':_0x3d121a[_0x8786('0x2b')],'resourceId':_0x3d121a['id'],'type':_0x2e242b[_0x8786('0x2b')],'sectionId':_0x2e242b['id']},{})[_0x8786('0x26')](function(){return _0x26a2b9;});}else{return _0x26a2b9;}})['catch'](function(_0x2ec1c2){logger['error'](_0x8786('0x51'),_0x2ec1c2);throw _0x2ec1c2;});}return _0x26a2b9;});}})[_0x8786('0x26')](respondWithResult(_0x4ddc68,0xc9))[_0x8786('0x46')](handleError(_0x4ddc68,null));};exports['update']=function(_0x2cdd4e,_0x50b396){if(_0x2cdd4e[_0x8786('0x48')]['id']){delete _0x2cdd4e[_0x8786('0x48')]['id'];}return db[_0x8786('0x2f')]['find']({'where':{'id':_0x2cdd4e[_0x8786('0x53')]['id']}})[_0x8786('0x26')](handleEntityNotFound(_0x50b396,null))[_0x8786('0x26')](saveUpdates(_0x2cdd4e[_0x8786('0x48')],null))[_0x8786('0x26')](respondWithResult(_0x50b396,null))[_0x8786('0x46')](handleError(_0x50b396,null));};exports[_0x8786('0x27')]=function(_0x228dd9,_0x3e5b1a){return db[_0x8786('0x2f')][_0x8786('0x54')]({'where':{'id':_0x228dd9[_0x8786('0x53')]['id']}})[_0x8786('0x26')](handleEntityNotFound(_0x3e5b1a,null))[_0x8786('0x26')](removeEntity(_0x3e5b1a,null))['catch'](handleError(_0x3e5b1a,null));};function widgetAttributes(_0x4fb263){try{switch(_0x4fb263[_0x8786('0x32')]){case'iframe':return[{'name':_0x8786('0x58'),'value':_0x4fb263[_0x8786('0x58')]||(_0x4fb263['attrs']&&_0x4fb263[_0x8786('0x59')][0x0]?_0x4fb263[_0x8786('0x59')][0x0][_0x8786('0x5a')]:undefined)||_0x8786('0x5b')}];case _0x8786('0x5c'):return[{'name':'attrPath','value':_0x4fb263[_0x8786('0x5d')]||(_0x4fb263[_0x8786('0x59')]&&_0x4fb263['attrs'][0x0]?_0x4fb263[_0x8786('0x59')][0x0]['value']:undefined)||''}];case _0x8786('0x5e'):return[{'name':'attrHourFormat','value':_0x4fb263[_0x8786('0x5f')]||(_0x4fb263['attrs']&&_0x4fb263[_0x8786('0x59')][0x0]?_0x4fb263[_0x8786('0x59')][0x0][_0x8786('0x5a')]:undefined)||_0x8786('0x60')},{'name':_0x8786('0x61'),'value':_0x4fb263['attrTimezone']||(_0x4fb263[_0x8786('0x59')]&&_0x4fb263[_0x8786('0x59')][0x1]?_0x4fb263[_0x8786('0x59')][0x1]['value']:undefined)||'0.00'},{'name':_0x8786('0x62'),'value':_0x4fb263['attrFontSize']||(_0x4fb263[_0x8786('0x59')]&&_0x4fb263['attrs'][0x2]?_0x4fb263[_0x8786('0x59')][0x2][_0x8786('0x5a')]:undefined)||0xc}];case _0x8786('0x63'):return[{'name':_0x8786('0x64'),'value':_0x4fb263['attrMetric']||(_0x4fb263['attrs']&&_0x4fb263[_0x8786('0x59')][0x0]?_0x4fb263[_0x8786('0x59')][0x0][_0x8786('0x5a')]:undefined)||_0x8786('0x65')},{'name':_0x8786('0x66'),'value':_0x4fb263[_0x8786('0x66')]||(_0x4fb263[_0x8786('0x59')]&&_0x4fb263[_0x8786('0x59')][0x1]?_0x4fb263[_0x8786('0x59')][0x1][_0x8786('0x5a')]:undefined)||[]},{'name':_0x8786('0x62'),'value':_0x4fb263[_0x8786('0x62')]||(_0x4fb263[_0x8786('0x59')]&&_0x4fb263[_0x8786('0x59')][0x2]?_0x4fb263[_0x8786('0x59')][0x2]['value']:undefined)||0x14},{'name':_0x8786('0x67'),'value':_0x4fb263['attrChannel']||(_0x4fb263[_0x8786('0x59')]&&_0x4fb263[_0x8786('0x59')][0x3]?_0x4fb263['attrs'][0x3][_0x8786('0x5a')]:undefined)||'voice'},{'name':_0x8786('0x68'),'value':_0x4fb263[_0x8786('0x68')]||(_0x4fb263[_0x8786('0x59')]&&_0x4fb263[_0x8786('0x59')][0x4]?_0x4fb263[_0x8786('0x59')][0x4]['value']:undefined)||''},{'name':_0x8786('0x69'),'value':_0x4fb263[_0x8786('0x69')]||(_0x4fb263['attrs']&&_0x4fb263[_0x8786('0x59')][0x5]?_0x4fb263[_0x8786('0x59')][0x5]['value']:undefined)||''},{'name':_0x8786('0x6a'),'value':_0x4fb263[_0x8786('0x6a')]||(_0x4fb263['attrs']&&_0x4fb263[_0x8786('0x59')][0x6]?_0x4fb263[_0x8786('0x59')][0x6]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x4fb263['attrOpenchannelAccounts']||(_0x4fb263[_0x8786('0x59')]&&_0x4fb263[_0x8786('0x59')][0x7]?_0x4fb263[_0x8786('0x59')][0x7][_0x8786('0x5a')]:undefined)||''},{'name':_0x8786('0x6b'),'value':_0x4fb263[_0x8786('0x6b')]||(_0x4fb263['attrs']&&_0x4fb263[_0x8786('0x59')][0x8]?_0x4fb263[_0x8786('0x59')][0x8][_0x8786('0x5a')]:undefined)||''},{'name':'attrChatWebsites','value':_0x4fb263[_0x8786('0x6c')]||(_0x4fb263[_0x8786('0x59')]&&_0x4fb263[_0x8786('0x59')][0x9]?_0x4fb263[_0x8786('0x59')][0x9][_0x8786('0x5a')]:undefined)||''}];case _0x8786('0x6d'):case _0x8786('0x6e'):return[{'name':_0x8786('0x6f'),'value':_0x4fb263[_0x8786('0x6f')]||(_0x4fb263[_0x8786('0x59')]&&_0x4fb263['attrs'][0x0]?_0x4fb263[_0x8786('0x59')][0x0][_0x8786('0x5a')]:undefined)||'total'},{'name':_0x8786('0x70'),'value':_0x4fb263[_0x8786('0x70')]||(_0x4fb263[_0x8786('0x59')]&&_0x4fb263[_0x8786('0x59')][0x1]?_0x4fb263['attrs'][0x1]['value']:undefined)||null},{'name':_0x8786('0x71'),'value':_0x4fb263[_0x8786('0x71')]||(_0x4fb263[_0x8786('0x59')]&&_0x4fb263['attrs'][0x2]?_0x4fb263['attrs'][0x2]['value']:undefined)||null},{'name':_0x8786('0x66'),'value':_0x4fb263['attrVoiceQueues']||(_0x4fb263['attrs']&&_0x4fb263['attrs'][0x3]?_0x4fb263['attrs'][0x3][_0x8786('0x5a')]:undefined)||[]},{'name':_0x8786('0x67'),'value':_0x4fb263[_0x8786('0x67')]||(_0x4fb263[_0x8786('0x59')]&&_0x4fb263['attrs'][0x4]?_0x4fb263[_0x8786('0x59')][0x4][_0x8786('0x5a')]:undefined)||_0x8786('0x72')},{'name':_0x8786('0x68'),'value':_0x4fb263['attrEmailAccounts']||(_0x4fb263[_0x8786('0x59')]&&_0x4fb263[_0x8786('0x59')][0x5]?_0x4fb263[_0x8786('0x59')][0x5]['value']:undefined)||''},{'name':_0x8786('0x69'),'value':_0x4fb263[_0x8786('0x69')]||(_0x4fb263['attrs']&&_0x4fb263[_0x8786('0x59')][0x6]?_0x4fb263['attrs'][0x6][_0x8786('0x5a')]:undefined)||''},{'name':_0x8786('0x6a'),'value':_0x4fb263[_0x8786('0x6a')]||(_0x4fb263[_0x8786('0x59')]&&_0x4fb263['attrs'][0x7]?_0x4fb263[_0x8786('0x59')][0x7][_0x8786('0x5a')]:undefined)||''},{'name':_0x8786('0x73'),'value':_0x4fb263[_0x8786('0x73')]||(_0x4fb263['attrs']&&_0x4fb263[_0x8786('0x59')][0x8]?_0x4fb263[_0x8786('0x59')][0x8][_0x8786('0x5a')]:undefined)||''},{'name':_0x8786('0x6b'),'value':_0x4fb263['attrWhatsappAccounts']||(_0x4fb263['attrs']&&_0x4fb263[_0x8786('0x59')][0x9]?_0x4fb263[_0x8786('0x59')][0x9][_0x8786('0x5a')]:undefined)||''},{'name':_0x8786('0x6c'),'value':_0x4fb263[_0x8786('0x6c')]||(_0x4fb263[_0x8786('0x59')]&&_0x4fb263['attrs'][0xa]?_0x4fb263[_0x8786('0x59')][0xa][_0x8786('0x5a')]:undefined)||''}];case'web-report':return[{'name':_0x8786('0x74'),'type':_0x4fb263[_0x8786('0x75')]||(_0x4fb263[_0x8786('0x59')]&&_0x4fb263[_0x8786('0x59')][0x0]?_0x4fb263[_0x8786('0x59')][0x0][_0x8786('0x32')]:undefined)||null,'value':_0x4fb263[_0x8786('0x74')]||(_0x4fb263[_0x8786('0x59')]&&_0x4fb263[_0x8786('0x59')][0x0]?_0x4fb263[_0x8786('0x59')][0x0][_0x8786('0x5a')]:undefined)||null},{'name':_0x8786('0x76'),'value':_0x4fb263[_0x8786('0x76')]||(_0x4fb263[_0x8786('0x59')]&&_0x4fb263[_0x8786('0x59')][0x1]?_0x4fb263[_0x8786('0x59')][0x1][_0x8786('0x5a')]:undefined)||0x0}];default:return[];}}catch(_0x40eaaf){logger[_0x8786('0x29')](_0x8786('0x77'),JSON[_0x8786('0x78')](_0x40eaaf));return[];}}exports['addItem']=function(_0xd5a8a7,_0x2e6498,_0x2a32ff){if(_0xd5a8a7[_0x8786('0x48')]['id']){delete _0xd5a8a7[_0x8786('0x48')]['id'];}return db['Dashboard'][_0x8786('0x54')]({'where':{'id':_0xd5a8a7[_0x8786('0x53')]['id']}})[_0x8786('0x26')](handleEntityNotFound(_0x2e6498,null))[_0x8786('0x26')](function(_0x3f5653){if(_0x3f5653){_0xd5a8a7['body'][_0x8786('0x79')]=_0x3f5653['id'];_0xd5a8a7[_0x8786('0x48')][_0x8786('0x59')]=widgetAttributes(_0xd5a8a7['body']);return db[_0x8786('0x7a')][_0x8786('0x50')](_0xd5a8a7[_0x8786('0x48')]);}})[_0x8786('0x26')](respondWithResult(_0x2e6498,null))[_0x8786('0x46')](handleError(_0x2e6498,null));};exports[_0x8786('0x7b')]=function(_0x2e4aa2,_0x14274f,_0x4ec558){var _0x23c88d={};var _0x159092={};var _0x3b2c6e;var _0x11a33a;return db['Dashboard'][_0x8786('0x7c')]({'where':{'id':_0x2e4aa2['params']['id']}})['then'](handleEntityNotFound(_0x14274f,null))['then'](function(_0x2f8d07){if(_0x2f8d07){_0x3b2c6e=_0x2f8d07;_0x159092[_0x8786('0x33')]=_['keys'](db['DashboardItem'][_0x8786('0x30')]);_0x159092[_0x8786('0x35')]=_[_0x8786('0x34')](_0x2e4aa2[_0x8786('0x35')]);_0x159092[_0x8786('0x36')]=_[_0x8786('0x37')](_0x159092['model'],_0x159092[_0x8786('0x35')]);_0x23c88d[_0x8786('0x38')]=_[_0x8786('0x37')](_0x159092[_0x8786('0x33')],qs[_0x8786('0x39')](_0x2e4aa2[_0x8786('0x35')][_0x8786('0x39')]));_0x23c88d['attributes']=_0x23c88d['attributes'][_0x8786('0x3a')]?_0x23c88d[_0x8786('0x38')]:_0x159092[_0x8786('0x33')];_0x23c88d['order']=qs[_0x8786('0x3e')](_0x2e4aa2[_0x8786('0x35')][_0x8786('0x3e')]);_0x23c88d[_0x8786('0x3f')]=qs[_0x8786('0x36')](_['pick'](_0x2e4aa2['query'],_0x159092[_0x8786('0x36')]));if(_0x2e4aa2['query'][_0x8786('0x41')]){_0x23c88d[_0x8786('0x3f')]=_[_0x8786('0x42')](_0x23c88d[_0x8786('0x3f')],{'$or':_[_0x8786('0x2e')](_0x23c88d[_0x8786('0x38')],function(_0x3d5dc1){var _0x1bbf0c={};_0x1bbf0c[_0x3d5dc1]={'$like':'%'+_0x2e4aa2[_0x8786('0x35')][_0x8786('0x41')]+'%'};return _0x1bbf0c;})});}_0x23c88d=_[_0x8786('0x42')]({},_0x23c88d,_0x2e4aa2['options']);return _0x3b2c6e[_0x8786('0x7b')](_0x23c88d);}})['then'](function(_0x1e9057){if(_0x1e9057){_0x11a33a=_0x1e9057['length'];if(!_0x2e4aa2['query']['hasOwnProperty']('nolimit')){_0x23c88d[_0x8786('0x20')]=qs[_0x8786('0x20')](_0x2e4aa2[_0x8786('0x35')][_0x8786('0x20')]);_0x23c88d[_0x8786('0x1e')]=qs[_0x8786('0x1e')](_0x2e4aa2[_0x8786('0x35')]['offset']);}return _0x3b2c6e[_0x8786('0x7b')](_0x23c88d);}})[_0x8786('0x26')](function(_0x5692ee){if(_0x5692ee){return _0x5692ee?{'count':_0x11a33a,'rows':_0x5692ee}:null;}})[_0x8786('0x26')](respondWithResult(_0x14274f,null))[_0x8786('0x46')](handleError(_0x14274f,null));}; \ No newline at end of file +var _0xa170=['send','index','map','Dashboard','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','body','updatedAt','role','UserProfileSection','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','stringify','addItem','DashboardId','DashboardItem','getItems','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','get','CustomDashboards','UserProfileResource','destroy','sendStatus','error','stack','name'];(function(_0x594323,_0x127c43){var _0x51a1f2=function(_0x469efb){while(--_0x469efb){_0x594323['push'](_0x594323['shift']());}};_0x51a1f2(++_0x127c43);}(_0xa170,0x1e1));var _0x0a17=function(_0x30c563,_0x5aac74){_0x30c563=_0x30c563-0x0;var _0x1289aa=_0xa170[_0x30c563];return _0x1289aa;};'use strict';var emlformat=require(_0x0a17('0x0'));var rimraf=require(_0x0a17('0x1'));var zipdir=require(_0x0a17('0x2'));var jsonpatch=require(_0x0a17('0x3'));var rp=require(_0x0a17('0x4'));var moment=require(_0x0a17('0x5'));var BPromise=require(_0x0a17('0x6'));var Mustache=require(_0x0a17('0x7'));var util=require(_0x0a17('0x8'));var path=require(_0x0a17('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0a17('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0a17('0xb'));var squel=require(_0x0a17('0xc'));var crypto=require(_0x0a17('0xd'));var jsforce=require(_0x0a17('0xe'));var deskjs=require(_0x0a17('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0a17('0x10'));var Papa=require(_0x0a17('0x11'));var Redis=require(_0x0a17('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x0a17('0x13'));var as=require(_0x0a17('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0a17('0x15'));var utils=require(_0x0a17('0x16'));var config=require(_0x0a17('0x17'));var licenseUtil=require(_0x0a17('0x18'));var db=require(_0x0a17('0x19'))['db'];config[_0x0a17('0x1a')]=_[_0x0a17('0x1b')](config[_0x0a17('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x0a17('0x1c'))(new Redis(config[_0x0a17('0x1a')]));require('./dashboard.socket')[_0x0a17('0x1d')](socket);function respondWithStatusCode(_0x541f25,_0x501277){_0x501277=_0x501277||0xcc;return function(_0x51b225){if(_0x51b225){return _0x541f25['sendStatus'](_0x501277);}return _0x541f25[_0x0a17('0x1e')](_0x501277)[_0x0a17('0x1f')]();};}function respondWithResult(_0x47ea65,_0x3ceec5){_0x3ceec5=_0x3ceec5||0xc8;return function(_0xb12577){if(_0xb12577){return _0x47ea65[_0x0a17('0x1e')](_0x3ceec5)[_0x0a17('0x20')](_0xb12577);}};}function respondWithFilteredResult(_0x4f81ee,_0x4309d2){return function(_0x4bb558){if(_0x4bb558){var _0x460eca=typeof _0x4309d2['offset']===_0x0a17('0x21')&&typeof _0x4309d2[_0x0a17('0x22')]===_0x0a17('0x21');var _0x1e636b=_0x4bb558[_0x0a17('0x23')];var _0x5a3adb=_0x460eca?0x0:_0x4309d2[_0x0a17('0x24')];var _0x191b4a=_0x460eca?_0x4bb558[_0x0a17('0x23')]:_0x4309d2[_0x0a17('0x24')]+_0x4309d2[_0x0a17('0x22')];var _0x3565f6;if(_0x191b4a>=_0x1e636b){_0x191b4a=_0x1e636b;_0x3565f6=0xc8;}else{_0x3565f6=0xce;}_0x4f81ee['status'](_0x3565f6);return _0x4f81ee[_0x0a17('0x25')](_0x0a17('0x26'),_0x5a3adb+'-'+_0x191b4a+'/'+_0x1e636b)[_0x0a17('0x20')](_0x4bb558);}return null;};}function patchUpdates(_0x368a0c){return function(_0x1b5f99){try{jsonpatch[_0x0a17('0x27')](_0x1b5f99,_0x368a0c,!![]);}catch(_0x35d7c0){return BPromise['reject'](_0x35d7c0);}return _0x1b5f99[_0x0a17('0x28')]();};}function saveUpdates(_0x406deb,_0x4b45c4){return function(_0x5711f3){if(_0x5711f3){return _0x5711f3[_0x0a17('0x29')](_0x406deb)[_0x0a17('0x2a')](function(_0x2bac9b){return _0x2bac9b;});}return null;};}function removeEntity(_0x1240fc,_0x3bceb8){return function(_0x1797a3){if(_0x1797a3){return _0x1797a3['destroy']()[_0x0a17('0x2a')](function(){var _0x23f9e0=_0x1797a3[_0x0a17('0x2b')]({'plain':!![]});var _0x6b0e42=_0x0a17('0x2c');return db[_0x0a17('0x2d')][_0x0a17('0x2e')]({'where':{'type':_0x6b0e42,'resourceId':_0x23f9e0['id']}})[_0x0a17('0x2a')](function(){return _0x1797a3;});})['then'](function(){_0x1240fc[_0x0a17('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x271b9c,_0x787325){return function(_0x2417fd){if(!_0x2417fd){_0x271b9c[_0x0a17('0x2f')](0x194);}return _0x2417fd;};}function handleError(_0x515c5a,_0x788d5d){_0x788d5d=_0x788d5d||0x1f4;return function(_0x57470f){logger[_0x0a17('0x30')](_0x57470f[_0x0a17('0x31')]);if(_0x57470f['name']){delete _0x57470f[_0x0a17('0x32')];}_0x515c5a[_0x0a17('0x1e')](_0x788d5d)[_0x0a17('0x33')](_0x57470f);};}exports[_0x0a17('0x34')]=function(_0x3c74de,_0x3cd00c){var _0x3b7c1a={},_0x55d95c={},_0x435181={'count':0x0,'rows':[]};var _0x327d0a=_[_0x0a17('0x35')](db[_0x0a17('0x36')][_0x0a17('0x37')],function(_0x2a4b15){return{'name':_0x2a4b15[_0x0a17('0x38')],'type':_0x2a4b15[_0x0a17('0x39')]['key']};});_0x55d95c[_0x0a17('0x3a')]=_['map'](_0x327d0a,'name');_0x55d95c[_0x0a17('0x3b')]=_[_0x0a17('0x3c')](_0x3c74de[_0x0a17('0x3b')]);_0x55d95c[_0x0a17('0x3d')]=_['intersection'](_0x55d95c[_0x0a17('0x3a')],_0x55d95c[_0x0a17('0x3b')]);_0x3b7c1a[_0x0a17('0x3e')]=_[_0x0a17('0x3f')](_0x55d95c['model'],qs[_0x0a17('0x40')](_0x3c74de[_0x0a17('0x3b')]['fields']));_0x3b7c1a[_0x0a17('0x3e')]=_0x3b7c1a[_0x0a17('0x3e')][_0x0a17('0x41')]?_0x3b7c1a[_0x0a17('0x3e')]:_0x55d95c[_0x0a17('0x3a')];if(!_0x3c74de[_0x0a17('0x3b')][_0x0a17('0x42')](_0x0a17('0x43'))){_0x3b7c1a[_0x0a17('0x22')]=qs['limit'](_0x3c74de[_0x0a17('0x3b')]['limit']);_0x3b7c1a[_0x0a17('0x24')]=qs['offset'](_0x3c74de['query'][_0x0a17('0x24')]);}_0x3b7c1a[_0x0a17('0x44')]=qs[_0x0a17('0x45')](_0x3c74de[_0x0a17('0x3b')]['sort']);_0x3b7c1a[_0x0a17('0x46')]=qs[_0x0a17('0x3d')](_[_0x0a17('0x47')](_0x3c74de[_0x0a17('0x3b')],_0x55d95c[_0x0a17('0x3d')]),_0x327d0a);if(_0x3c74de[_0x0a17('0x3b')][_0x0a17('0x48')]){_0x3b7c1a[_0x0a17('0x46')]=_['merge'](_0x3b7c1a['where'],{'$or':_['map'](_0x327d0a,function(_0x375ef7){if(_0x375ef7[_0x0a17('0x39')]!==_0x0a17('0x49')){var _0xe7b864={};_0xe7b864[_0x375ef7[_0x0a17('0x32')]]={'$like':'%'+_0x3c74de[_0x0a17('0x3b')][_0x0a17('0x48')]+'%'};return _0xe7b864;}})});}_0x3b7c1a=_[_0x0a17('0x4a')]({},_0x3b7c1a,_0x3c74de[_0x0a17('0x4b')]);var _0x958089={'where':_0x3b7c1a['where']};return db[_0x0a17('0x36')][_0x0a17('0x23')](_0x958089)['then'](function(_0x9c2f63){_0x435181[_0x0a17('0x23')]=_0x9c2f63;if(_0x3c74de[_0x0a17('0x3b')][_0x0a17('0x4c')]){_0x3b7c1a[_0x0a17('0x4d')]=[{'all':!![]}];}return db[_0x0a17('0x36')][_0x0a17('0x4e')](_0x3b7c1a);})[_0x0a17('0x2a')](function(_0x4aa150){_0x435181[_0x0a17('0x4f')]=_0x4aa150;return _0x435181;})[_0x0a17('0x2a')](respondWithFilteredResult(_0x3cd00c,_0x3b7c1a))[_0x0a17('0x50')](handleError(_0x3cd00c,null));};exports[_0x0a17('0x51')]=function(_0x44d07d,_0x5563e3){var _0x45b00e={'raw':![],'where':{'id':_0x44d07d[_0x0a17('0x52')]['id']}},_0xc8d06d={};_0xc8d06d[_0x0a17('0x3a')]=_[_0x0a17('0x3c')](db[_0x0a17('0x36')][_0x0a17('0x37')]);_0xc8d06d['query']=_[_0x0a17('0x3c')](_0x44d07d['query']);_0xc8d06d[_0x0a17('0x3d')]=_[_0x0a17('0x3f')](_0xc8d06d[_0x0a17('0x3a')],_0xc8d06d[_0x0a17('0x3b')]);_0x45b00e['attributes']=_[_0x0a17('0x3f')](_0xc8d06d[_0x0a17('0x3a')],qs['fields'](_0x44d07d[_0x0a17('0x3b')]['fields']));_0x45b00e[_0x0a17('0x3e')]=_0x45b00e[_0x0a17('0x3e')][_0x0a17('0x41')]?_0x45b00e[_0x0a17('0x3e')]:_0xc8d06d[_0x0a17('0x3a')];if(_0x44d07d[_0x0a17('0x3b')][_0x0a17('0x4c')]){_0x45b00e[_0x0a17('0x4d')]=[{'all':!![]}];}_0x45b00e=_[_0x0a17('0x4a')]({},_0x45b00e,_0x44d07d[_0x0a17('0x4b')]);return db[_0x0a17('0x36')][_0x0a17('0x53')](_0x45b00e)[_0x0a17('0x2a')](handleEntityNotFound(_0x5563e3,null))['then'](respondWithResult(_0x5563e3,null))['catch'](handleError(_0x5563e3,null));};exports[_0x0a17('0x54')]=function(_0x4c1876,_0x73bfee){return db['Dashboard'][_0x0a17('0x54')](_0x4c1876['body'],{})['then'](function(_0x508ddb){var _0x414a33=_0x4c1876['user'][_0x0a17('0x2b')]({'plain':!![]});if(!_0x414a33)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x414a33['role']===_0x0a17('0x55')){var _0x10e885=_0x508ddb[_0x0a17('0x2b')]({'plain':!![]});var _0x56f29f=_0x0a17('0x2c');return db['UserProfileSection'][_0x0a17('0x53')]({'where':{'name':_0x56f29f,'userProfileId':_0x414a33[_0x0a17('0x56')]},'raw':!![]})[_0x0a17('0x2a')](function(_0x1e49e0){if(_0x1e49e0&&_0x1e49e0[_0x0a17('0x57')]===0x0){return db['UserProfileResource'][_0x0a17('0x54')]({'name':_0x10e885[_0x0a17('0x32')],'resourceId':_0x10e885['id'],'type':_0x1e49e0['name'],'sectionId':_0x1e49e0['id']},{})['then'](function(){return _0x508ddb;});}else{return _0x508ddb;}})[_0x0a17('0x50')](function(_0x1a2e7b){logger[_0x0a17('0x30')](_0x0a17('0x58'),_0x1a2e7b);throw _0x1a2e7b;});}return _0x508ddb;})[_0x0a17('0x2a')](respondWithResult(_0x73bfee,0xc9))[_0x0a17('0x50')](handleError(_0x73bfee,null));};exports[_0x0a17('0x59')]=function(_0x876f0f,_0x109bfd){var _0x13b5c1={'where':{'id':_0x876f0f[_0x0a17('0x52')]['id']}},_0x2c7a68={};_0x2c7a68[_0x0a17('0x3a')]=_[_0x0a17('0x3c')](db[_0x0a17('0x36')][_0x0a17('0x37')]);_0x13b5c1[_0x0a17('0x3e')]=_[_0x0a17('0x3f')](_0x2c7a68[_0x0a17('0x3a')],qs[_0x0a17('0x40')](_0x876f0f[_0x0a17('0x3b')][_0x0a17('0x40')]));_0x13b5c1[_0x0a17('0x3e')]=_0x13b5c1['attributes'][_0x0a17('0x41')]?_0x13b5c1['attributes']:_0x2c7a68[_0x0a17('0x3a')];if(_0x876f0f[_0x0a17('0x3b')][_0x0a17('0x4c')]){_0x13b5c1['include']=[{'all':!![]}];}_0x13b5c1=_[_0x0a17('0x4a')]({},_0x13b5c1,_0x876f0f[_0x0a17('0x4b')]);return db[_0x0a17('0x36')]['find'](_0x13b5c1)[_0x0a17('0x2a')](handleEntityNotFound(_0x109bfd,null))[_0x0a17('0x2a')](function(_0x208dae){if(_0x208dae){var _0x589106=_0x208dae[_0x0a17('0x2b')]({'plain':!![]});_0x589106=qs[_0x0a17('0x5a')](_0x589106,['id',_0x0a17('0x5b'),'updatedAt']);_0x876f0f['body']=_[_0x0a17('0x5a')](_0x876f0f[_0x0a17('0x5c')],['id',_0x0a17('0x5b'),_0x0a17('0x5d')]);return db[_0x0a17('0x36')]['create'](_[_0x0a17('0x4a')](_0x589106,_0x876f0f[_0x0a17('0x5c')]),{'include':_0x876f0f[_0x0a17('0x3b')][_0x0a17('0x4c')]?[{'all':!![]}]:undefined})[_0x0a17('0x2a')](function(_0x2b5abf){var _0x5566fd=_0x876f0f[_0x0a17('0x55')][_0x0a17('0x2b')]({'plain':!![]});if(!_0x5566fd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5566fd[_0x0a17('0x5e')]===_0x0a17('0x55')){var _0x451fba=_0x2b5abf[_0x0a17('0x2b')]({'plain':!![]});var _0x3d99cc=_0x0a17('0x2c');return db[_0x0a17('0x5f')][_0x0a17('0x53')]({'where':{'name':_0x3d99cc,'userProfileId':_0x5566fd[_0x0a17('0x56')]},'raw':!![]})[_0x0a17('0x2a')](function(_0x7591bc){if(_0x7591bc&&_0x7591bc['autoAssociation']===0x0){return db[_0x0a17('0x2d')]['create']({'name':_0x451fba[_0x0a17('0x32')],'resourceId':_0x451fba['id'],'type':_0x7591bc[_0x0a17('0x32')],'sectionId':_0x7591bc['id']},{})[_0x0a17('0x2a')](function(){return _0x2b5abf;});}else{return _0x2b5abf;}})['catch'](function(_0x42d212){logger[_0x0a17('0x30')](_0x0a17('0x58'),_0x42d212);throw _0x42d212;});}return _0x2b5abf;});}})[_0x0a17('0x2a')](respondWithResult(_0x109bfd,0xc9))[_0x0a17('0x50')](handleError(_0x109bfd,null));};exports[_0x0a17('0x29')]=function(_0x40ad38,_0x5425e3){if(_0x40ad38[_0x0a17('0x5c')]['id']){delete _0x40ad38[_0x0a17('0x5c')]['id'];}return db[_0x0a17('0x36')][_0x0a17('0x53')]({'where':{'id':_0x40ad38[_0x0a17('0x52')]['id']}})['then'](handleEntityNotFound(_0x5425e3,null))['then'](saveUpdates(_0x40ad38[_0x0a17('0x5c')],null))[_0x0a17('0x2a')](respondWithResult(_0x5425e3,null))[_0x0a17('0x50')](handleError(_0x5425e3,null));};exports[_0x0a17('0x2e')]=function(_0x15c5ec,_0x499f95){return db[_0x0a17('0x36')]['find']({'where':{'id':_0x15c5ec[_0x0a17('0x52')]['id']}})[_0x0a17('0x2a')](handleEntityNotFound(_0x499f95,null))[_0x0a17('0x2a')](removeEntity(_0x499f95,null))['catch'](handleError(_0x499f95,null));};function widgetAttributes(_0x248b05){try{switch(_0x248b05[_0x0a17('0x39')]){case _0x0a17('0x60'):return[{'name':_0x0a17('0x61'),'value':_0x248b05[_0x0a17('0x61')]||(_0x248b05[_0x0a17('0x62')]&&_0x248b05[_0x0a17('0x62')][0x0]?_0x248b05[_0x0a17('0x62')][0x0][_0x0a17('0x63')]:undefined)||_0x0a17('0x64')}];case _0x0a17('0x65'):return[{'name':_0x0a17('0x66'),'value':_0x248b05[_0x0a17('0x66')]||(_0x248b05[_0x0a17('0x62')]&&_0x248b05[_0x0a17('0x62')][0x0]?_0x248b05[_0x0a17('0x62')][0x0]['value']:undefined)||''}];case _0x0a17('0x67'):return[{'name':'attrHourFormat','value':_0x248b05['attrHourFormat']||(_0x248b05['attrs']&&_0x248b05[_0x0a17('0x62')][0x0]?_0x248b05[_0x0a17('0x62')][0x0][_0x0a17('0x63')]:undefined)||_0x0a17('0x68')},{'name':'attrTimezone','value':_0x248b05[_0x0a17('0x69')]||(_0x248b05[_0x0a17('0x62')]&&_0x248b05['attrs'][0x1]?_0x248b05[_0x0a17('0x62')][0x1][_0x0a17('0x63')]:undefined)||_0x0a17('0x6a')},{'name':_0x0a17('0x6b'),'value':_0x248b05[_0x0a17('0x6b')]||(_0x248b05[_0x0a17('0x62')]&&_0x248b05[_0x0a17('0x62')][0x2]?_0x248b05[_0x0a17('0x62')][0x2]['value']:undefined)||0xc}];case _0x0a17('0x6c'):return[{'name':_0x0a17('0x6d'),'value':_0x248b05['attrMetric']||(_0x248b05[_0x0a17('0x62')]&&_0x248b05[_0x0a17('0x62')][0x0]?_0x248b05[_0x0a17('0x62')][0x0][_0x0a17('0x63')]:undefined)||'total'},{'name':_0x0a17('0x6e'),'value':_0x248b05[_0x0a17('0x6e')]||(_0x248b05[_0x0a17('0x62')]&&_0x248b05[_0x0a17('0x62')][0x1]?_0x248b05[_0x0a17('0x62')][0x1][_0x0a17('0x63')]:undefined)||[]},{'name':_0x0a17('0x6b'),'value':_0x248b05['attrFontSize']||(_0x248b05[_0x0a17('0x62')]&&_0x248b05[_0x0a17('0x62')][0x2]?_0x248b05['attrs'][0x2]['value']:undefined)||0x14},{'name':_0x0a17('0x6f'),'value':_0x248b05[_0x0a17('0x6f')]||(_0x248b05[_0x0a17('0x62')]&&_0x248b05[_0x0a17('0x62')][0x3]?_0x248b05['attrs'][0x3][_0x0a17('0x63')]:undefined)||_0x0a17('0x70')},{'name':_0x0a17('0x71'),'value':_0x248b05[_0x0a17('0x71')]||(_0x248b05[_0x0a17('0x62')]&&_0x248b05[_0x0a17('0x62')][0x4]?_0x248b05[_0x0a17('0x62')][0x4][_0x0a17('0x63')]:undefined)||''},{'name':_0x0a17('0x72'),'value':_0x248b05[_0x0a17('0x72')]||(_0x248b05['attrs']&&_0x248b05[_0x0a17('0x62')][0x5]?_0x248b05[_0x0a17('0x62')][0x5][_0x0a17('0x63')]:undefined)||''},{'name':_0x0a17('0x73'),'value':_0x248b05['attrSmsAccounts']||(_0x248b05[_0x0a17('0x62')]&&_0x248b05[_0x0a17('0x62')][0x6]?_0x248b05[_0x0a17('0x62')][0x6][_0x0a17('0x63')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x248b05[_0x0a17('0x74')]||(_0x248b05[_0x0a17('0x62')]&&_0x248b05['attrs'][0x7]?_0x248b05[_0x0a17('0x62')][0x7][_0x0a17('0x63')]:undefined)||''},{'name':_0x0a17('0x75'),'value':_0x248b05['attrWhatsappAccounts']||(_0x248b05[_0x0a17('0x62')]&&_0x248b05[_0x0a17('0x62')][0x8]?_0x248b05[_0x0a17('0x62')][0x8]['value']:undefined)||''},{'name':_0x0a17('0x76'),'value':_0x248b05['attrChatWebsites']||(_0x248b05[_0x0a17('0x62')]&&_0x248b05[_0x0a17('0x62')][0x9]?_0x248b05[_0x0a17('0x62')][0x9]['value']:undefined)||''}];case'multibar-chart':case _0x0a17('0x77'):return[{'name':_0x0a17('0x78'),'value':_0x248b05[_0x0a17('0x78')]||(_0x248b05['attrs']&&_0x248b05['attrs'][0x0]?_0x248b05[_0x0a17('0x62')][0x0][_0x0a17('0x63')]:undefined)||_0x0a17('0x79')},{'name':_0x0a17('0x7a'),'value':_0x248b05[_0x0a17('0x7a')]||(_0x248b05[_0x0a17('0x62')]&&_0x248b05[_0x0a17('0x62')][0x1]?_0x248b05[_0x0a17('0x62')][0x1]['value']:undefined)||null},{'name':_0x0a17('0x7b'),'value':_0x248b05[_0x0a17('0x7b')]||(_0x248b05['attrs']&&_0x248b05['attrs'][0x2]?_0x248b05[_0x0a17('0x62')][0x2][_0x0a17('0x63')]:undefined)||null},{'name':_0x0a17('0x6e'),'value':_0x248b05['attrVoiceQueues']||(_0x248b05[_0x0a17('0x62')]&&_0x248b05[_0x0a17('0x62')][0x3]?_0x248b05[_0x0a17('0x62')][0x3][_0x0a17('0x63')]:undefined)||[]},{'name':_0x0a17('0x6f'),'value':_0x248b05['attrChannel']||(_0x248b05['attrs']&&_0x248b05[_0x0a17('0x62')][0x4]?_0x248b05['attrs'][0x4][_0x0a17('0x63')]:undefined)||_0x0a17('0x70')},{'name':_0x0a17('0x71'),'value':_0x248b05[_0x0a17('0x71')]||(_0x248b05[_0x0a17('0x62')]&&_0x248b05[_0x0a17('0x62')][0x5]?_0x248b05[_0x0a17('0x62')][0x5][_0x0a17('0x63')]:undefined)||''},{'name':_0x0a17('0x72'),'value':_0x248b05[_0x0a17('0x72')]||(_0x248b05[_0x0a17('0x62')]&&_0x248b05[_0x0a17('0x62')][0x6]?_0x248b05[_0x0a17('0x62')][0x6]['value']:undefined)||''},{'name':'attrSmsAccounts','value':_0x248b05[_0x0a17('0x73')]||(_0x248b05[_0x0a17('0x62')]&&_0x248b05[_0x0a17('0x62')][0x7]?_0x248b05[_0x0a17('0x62')][0x7][_0x0a17('0x63')]:undefined)||''},{'name':_0x0a17('0x74'),'value':_0x248b05[_0x0a17('0x74')]||(_0x248b05[_0x0a17('0x62')]&&_0x248b05[_0x0a17('0x62')][0x8]?_0x248b05[_0x0a17('0x62')][0x8][_0x0a17('0x63')]:undefined)||''},{'name':_0x0a17('0x75'),'value':_0x248b05[_0x0a17('0x75')]||(_0x248b05['attrs']&&_0x248b05[_0x0a17('0x62')][0x9]?_0x248b05['attrs'][0x9][_0x0a17('0x63')]:undefined)||''},{'name':_0x0a17('0x76'),'value':_0x248b05[_0x0a17('0x76')]||(_0x248b05[_0x0a17('0x62')]&&_0x248b05[_0x0a17('0x62')][0xa]?_0x248b05[_0x0a17('0x62')][0xa]['value']:undefined)||''}];case _0x0a17('0x7c'):return[{'name':_0x0a17('0x7d'),'type':_0x248b05['reportType']||(_0x248b05[_0x0a17('0x62')]&&_0x248b05['attrs'][0x0]?_0x248b05[_0x0a17('0x62')][0x0][_0x0a17('0x39')]:undefined)||null,'value':_0x248b05['attrReport']||(_0x248b05['attrs']&&_0x248b05[_0x0a17('0x62')][0x0]?_0x248b05[_0x0a17('0x62')][0x0][_0x0a17('0x63')]:undefined)||null},{'name':'attrRefresh','value':_0x248b05[_0x0a17('0x7e')]||(_0x248b05[_0x0a17('0x62')]&&_0x248b05['attrs'][0x1]?_0x248b05['attrs'][0x1][_0x0a17('0x63')]:undefined)||0x0}];default:return[];}}catch(_0x37d1b8){logger[_0x0a17('0x30')]('widgetAttributes:\x20%s',JSON[_0x0a17('0x7f')](_0x37d1b8));return[];}}exports[_0x0a17('0x80')]=function(_0x2f27c6,_0x4eb54b,_0x3890f3){if(_0x2f27c6[_0x0a17('0x5c')]['id']){delete _0x2f27c6[_0x0a17('0x5c')]['id'];}return db['Dashboard'][_0x0a17('0x53')]({'where':{'id':_0x2f27c6[_0x0a17('0x52')]['id']}})['then'](handleEntityNotFound(_0x4eb54b,null))['then'](function(_0xd9be7b){if(_0xd9be7b){_0x2f27c6[_0x0a17('0x5c')][_0x0a17('0x81')]=_0xd9be7b['id'];_0x2f27c6['body']['attrs']=widgetAttributes(_0x2f27c6[_0x0a17('0x5c')]);return db[_0x0a17('0x82')][_0x0a17('0x54')](_0x2f27c6[_0x0a17('0x5c')]);}})[_0x0a17('0x2a')](respondWithResult(_0x4eb54b,null))[_0x0a17('0x50')](handleError(_0x4eb54b,null));};exports[_0x0a17('0x83')]=function(_0x32110d,_0x13e536,_0x1121a3){var _0x290136={};var _0x929cf2={};var _0x2fa94a;var _0x5f596b;return db[_0x0a17('0x36')][_0x0a17('0x84')]({'where':{'id':_0x32110d['params']['id']}})[_0x0a17('0x2a')](handleEntityNotFound(_0x13e536,null))['then'](function(_0xf0d4e7){if(_0xf0d4e7){_0x2fa94a=_0xf0d4e7;_0x929cf2[_0x0a17('0x3a')]=_[_0x0a17('0x3c')](db['DashboardItem'][_0x0a17('0x37')]);_0x929cf2[_0x0a17('0x3b')]=_[_0x0a17('0x3c')](_0x32110d[_0x0a17('0x3b')]);_0x929cf2[_0x0a17('0x3d')]=_[_0x0a17('0x3f')](_0x929cf2['model'],_0x929cf2['query']);_0x290136[_0x0a17('0x3e')]=_['intersection'](_0x929cf2[_0x0a17('0x3a')],qs[_0x0a17('0x40')](_0x32110d[_0x0a17('0x3b')][_0x0a17('0x40')]));_0x290136[_0x0a17('0x3e')]=_0x290136[_0x0a17('0x3e')][_0x0a17('0x41')]?_0x290136[_0x0a17('0x3e')]:_0x929cf2[_0x0a17('0x3a')];_0x290136[_0x0a17('0x44')]=qs[_0x0a17('0x45')](_0x32110d[_0x0a17('0x3b')][_0x0a17('0x45')]);_0x290136['where']=qs[_0x0a17('0x3d')](_[_0x0a17('0x47')](_0x32110d['query'],_0x929cf2[_0x0a17('0x3d')]));if(_0x32110d[_0x0a17('0x3b')][_0x0a17('0x48')]){_0x290136['where']=_[_0x0a17('0x4a')](_0x290136[_0x0a17('0x46')],{'$or':_[_0x0a17('0x35')](_0x290136[_0x0a17('0x3e')],function(_0x46374d){var _0x498f42={};_0x498f42[_0x46374d]={'$like':'%'+_0x32110d[_0x0a17('0x3b')]['filter']+'%'};return _0x498f42;})});}_0x290136=_[_0x0a17('0x4a')]({},_0x290136,_0x32110d[_0x0a17('0x4b')]);return _0x2fa94a['getItems'](_0x290136);}})[_0x0a17('0x2a')](function(_0x3405d6){if(_0x3405d6){_0x5f596b=_0x3405d6[_0x0a17('0x41')];if(!_0x32110d[_0x0a17('0x3b')]['hasOwnProperty'](_0x0a17('0x43'))){_0x290136['limit']=qs[_0x0a17('0x22')](_0x32110d[_0x0a17('0x3b')][_0x0a17('0x22')]);_0x290136[_0x0a17('0x24')]=qs['offset'](_0x32110d['query'][_0x0a17('0x24')]);}return _0x2fa94a[_0x0a17('0x83')](_0x290136);}})[_0x0a17('0x2a')](function(_0x262a32){if(_0x262a32){return _0x262a32?{'count':_0x5f596b,'rows':_0x262a32}:null;}})['then'](respondWithResult(_0x13e536,null))[_0x0a17('0x50')](handleError(_0x13e536,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 7366d81..defd5b8 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 _0x51db=['exports','events','../../mysqldb','Dashboard','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x1f1596,_0x402318){var _0x24e1b1=function(_0xe64c9){while(--_0xe64c9){_0x1f1596['push'](_0x1f1596['shift']());}};_0x24e1b1(++_0x402318);}(_0x51db,0xb5));var _0xb51d=function(_0x1f69bc,_0xaffd71){_0x1f69bc=_0x1f69bc-0x0;var _0x1ac3c5=_0x51db[_0x1f69bc];return _0x1ac3c5;};'use strict';var EventEmitter=require(_0xb51d('0x0'));var Dashboard=require(_0xb51d('0x1'))['db'][_0xb51d('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xb51d('0x3')](0x0);var events={'afterCreate':_0xb51d('0x4'),'afterUpdate':_0xb51d('0x5'),'afterDestroy':'remove'};function emitEvent(_0x5621ca){return function(_0x2ec883,_0x1e541a,_0x3296b5){DashboardEvents[_0xb51d('0x6')](_0x5621ca+':'+_0x2ec883['id'],_0x2ec883);DashboardEvents[_0xb51d('0x6')](_0x5621ca,_0x2ec883);_0x3296b5(null);};}for(var e in events){if(events[_0xb51d('0x7')](e)){var event=events[e];Dashboard[_0xb51d('0x8')](e,emitEvent(event));}}module[_0xb51d('0x9')]=DashboardEvents; \ No newline at end of file +var _0x061f=['Dashboard','setMaxListeners','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x061f,0x15c));var _0xf061=function(_0x8b7a13,_0x11923b){_0x8b7a13=_0x8b7a13-0x0;var _0x53425a=_0x061f[_0x8b7a13];return _0x53425a;};'use strict';var EventEmitter=require(_0xf061('0x0'));var Dashboard=require(_0xf061('0x1'))['db'][_0xf061('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xf061('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5251f1){return function(_0x12a3f7,_0x4bb872,_0x3d01a5){DashboardEvents['emit'](_0x5251f1+':'+_0x12a3f7['id'],_0x12a3f7);DashboardEvents[_0xf061('0x4')](_0x5251f1,_0x12a3f7);_0x3d01a5(null);};}for(var e in events){if(events[_0xf061('0x5')](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module[_0xf061('0x6')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 5e05fcd..e8597a0 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 _0x51a8=['path','rimraf','../../config/environment','./dashboard.attributes','exports','define','Dashboard','dashboards','lodash','util','api','bluebird'];(function(_0xc1131,_0x5ab0f3){var _0x382bd7=function(_0x15f4c1){while(--_0x15f4c1){_0xc1131['push'](_0xc1131['shift']());}};_0x382bd7(++_0x5ab0f3);}(_0x51a8,0xec));var _0x851a=function(_0x1bf54e,_0x2bbeb2){_0x1bf54e=_0x1bf54e-0x0;var _0x2e3803=_0x51a8[_0x1bf54e];return _0x2e3803;};'use strict';var _=require(_0x851a('0x0'));var util=require(_0x851a('0x1'));var logger=require('../../config/logger')(_0x851a('0x2'));var moment=require('moment');var BPromise=require(_0x851a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x851a('0x4'));var rimraf=require(_0x851a('0x5'));var config=require(_0x851a('0x6'));var attributes=require(_0x851a('0x7'));module[_0x851a('0x8')]=function(_0x58a3b6,_0x317ead){return _0x58a3b6[_0x851a('0x9')](_0x851a('0xa'),attributes,{'tableName':_0x851a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x65b1=['moment','bluebird','request-promise','path','../../config/environment','./dashboard.attributes','exports','Dashboard','dashboards','lodash','util'];(function(_0x579f9d,_0x4f83fb){var _0x5a3672=function(_0x478b06){while(--_0x478b06){_0x579f9d['push'](_0x579f9d['shift']());}};_0x5a3672(++_0x4f83fb);}(_0x65b1,0xf0));var _0x165b=function(_0x5aa7cd,_0x54aff3){_0x5aa7cd=_0x5aa7cd-0x0;var _0x31b059=_0x65b1[_0x5aa7cd];return _0x31b059;};'use strict';var _=require(_0x165b('0x0'));var util=require(_0x165b('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x165b('0x2'));var BPromise=require(_0x165b('0x3'));var rp=require(_0x165b('0x4'));var fs=require('fs');var path=require(_0x165b('0x5'));var rimraf=require('rimraf');var config=require(_0x165b('0x6'));var attributes=require(_0x165b('0x7'));module[_0x165b('0x8')]=function(_0x30c30f,_0x3de677){return _0x30c30f['define'](_0x165b('0x9'),attributes,{'tableName':_0x165b('0xa'),'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 48e7ced..57de415 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 _0x6671=['localhost','socket.io-emitter','./dashboard.socket','request','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x2d7fc7,_0x148549){var _0x265459=function(_0x8d8533){while(--_0x8d8533){_0x2d7fc7['push'](_0x2d7fc7['shift']());}};_0x265459(++_0x148549);}(_0x6671,0x7b));var _0x1667=function(_0x50d448,_0x5d15ea){_0x50d448=_0x50d448-0x0;var _0x36f76f=_0x6671[_0x50d448];return _0x36f76f;};'use strict';var _=require(_0x1667('0x0'));var util=require('util');var moment=require(_0x1667('0x1'));var BPromise=require(_0x1667('0x2'));var rs=require(_0x1667('0x3'));var fs=require('fs');var Redis=require(_0x1667('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1667('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x1667('0x6'));var jayson=require(_0x1667('0x7'));var client=jayson[_0x1667('0x8')][_0x1667('0x9')]({'port':0x232a});config[_0x1667('0xa')]=_[_0x1667('0xb')](config['redis'],{'host':_0x1667('0xc'),'port':0x18eb});var socket=require(_0x1667('0xd'))(new Redis(config['redis']));require(_0x1667('0xe'))['register'](socket);function respondWithRpcPromise(_0x5f536,_0x183b07,_0x17a1d7){return new BPromise(function(_0x231256,_0x4d79c8){return client[_0x1667('0xf')](_0x5f536,_0x17a1d7)['then'](function(_0x2c0b9a){logger[_0x1667('0x10')](_0x1667('0x11'),_0x183b07,_0x1667('0x12'));logger[_0x1667('0x13')](_0x1667('0x14'),_0x183b07,'request\x20sent',JSON[_0x1667('0x15')](_0x2c0b9a));if(_0x2c0b9a[_0x1667('0x16')]){if(_0x2c0b9a[_0x1667('0x16')][_0x1667('0x17')]===0x1f4){logger[_0x1667('0x16')]('Dashboard,\x20%s,\x20%s',_0x183b07,_0x2c0b9a[_0x1667('0x16')][_0x1667('0x18')]);return _0x4d79c8(_0x2c0b9a[_0x1667('0x16')][_0x1667('0x18')]);}logger[_0x1667('0x16')](_0x1667('0x11'),_0x183b07,_0x2c0b9a[_0x1667('0x16')]['message']);return _0x231256(_0x2c0b9a[_0x1667('0x16')][_0x1667('0x18')]);}else{logger[_0x1667('0x10')]('Dashboard,\x20%s,\x20%s',_0x183b07,_0x1667('0x12'));_0x231256(_0x2c0b9a[_0x1667('0x19')][_0x1667('0x18')]);}})[_0x1667('0x1a')](function(_0x400708){logger['error'](_0x1667('0x11'),_0x183b07,_0x400708);_0x4d79c8(_0x400708);});});} \ No newline at end of file +var _0xa03b=['../../config/environment','jayson/promise','defaults','localhost','socket.io-emitter','./dashboard.socket','request','then','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc'];(function(_0x1d9163,_0x79567d){var _0xb42197=function(_0x3818e8){while(--_0x3818e8){_0x1d9163['push'](_0x1d9163['shift']());}};_0xb42197(++_0x79567d);}(_0xa03b,0x157));var _0xba03=function(_0x26efac,_0x21ab8a){_0x26efac=_0x26efac-0x0;var _0x8482e4=_0xa03b[_0x26efac];return _0x8482e4;};'use strict';var _=require(_0xba03('0x0'));var util=require(_0xba03('0x1'));var moment=require(_0xba03('0x2'));var BPromise=require(_0xba03('0x3'));var rs=require(_0xba03('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xba03('0x5'))['db'];var utils=require(_0xba03('0x6'));var logger=require('../../config/logger')(_0xba03('0x7'));var config=require(_0xba03('0x8'));var jayson=require(_0xba03('0x9'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0xba03('0xa')](config['redis'],{'host':_0xba03('0xb'),'port':0x18eb});var socket=require(_0xba03('0xc'))(new Redis(config['redis']));require(_0xba03('0xd'))['register'](socket);function respondWithRpcPromise(_0x10394a,_0x2647da,_0x4b6e53){return new BPromise(function(_0x369128,_0x3899e0){return client[_0xba03('0xe')](_0x10394a,_0x4b6e53)[_0xba03('0xf')](function(_0x530f44){logger['info'](_0xba03('0x10'),_0x2647da,_0xba03('0x11'));logger[_0xba03('0x12')](_0xba03('0x13'),_0x2647da,_0xba03('0x11'),JSON[_0xba03('0x14')](_0x530f44));if(_0x530f44[_0xba03('0x15')]){if(_0x530f44[_0xba03('0x15')][_0xba03('0x16')]===0x1f4){logger[_0xba03('0x15')]('Dashboard,\x20%s,\x20%s',_0x2647da,_0x530f44[_0xba03('0x15')][_0xba03('0x17')]);return _0x3899e0(_0x530f44['error'][_0xba03('0x17')]);}logger[_0xba03('0x15')](_0xba03('0x10'),_0x2647da,_0x530f44[_0xba03('0x15')][_0xba03('0x17')]);return _0x369128(_0x530f44[_0xba03('0x15')]['message']);}else{logger[_0xba03('0x18')](_0xba03('0x10'),_0x2647da,_0xba03('0x11'));_0x369128(_0x530f44[_0xba03('0x19')]['message']);}})[_0xba03('0x1a')](function(_0x375a79){logger['error'](_0xba03('0x10'),_0x2647da,_0x375a79);_0x3899e0(_0x375a79);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 11f1f45..5ebc58e 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 _0x017a=['./dashboard.events','save','remove','emit','removeListener','register','length','dashboard:'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x017a,0x190));var _0xa017=function(_0x568c4b,_0x283157){_0x568c4b=_0x568c4b-0x0;var _0x910c5=_0x017a[_0x568c4b];return _0x910c5;};'use strict';var DashboardEvents=require(_0xa017('0x0'));var events=[_0xa017('0x1'),_0xa017('0x2'),'update'];function createListener(_0x456fc9,_0x5c195a){return function(_0x31022e){_0x5c195a[_0xa017('0x3')](_0x456fc9,_0x31022e);};}function removeListener(_0x577984,_0x1b261d){return function(){DashboardEvents[_0xa017('0x4')](_0x577984,_0x1b261d);};}exports[_0xa017('0x5')]=function(_0x39dc52){for(var _0x2eb923=0x0,_0x36cd0c=events[_0xa017('0x6')];_0x2eb923<_0x36cd0c;_0x2eb923++){var _0x4b7b3d=events[_0x2eb923];var _0x4dc6b9=createListener(_0xa017('0x7')+_0x4b7b3d,_0x39dc52);DashboardEvents['on'](_0x4b7b3d,_0x4dc6b9);}}; \ No newline at end of file +var _0x8144=['emit','removeListener','register','length','dashboard:','save','remove','update'];(function(_0x5bf19f,_0x25f9e2){var _0x2f3d8e=function(_0x4da48b){while(--_0x4da48b){_0x5bf19f['push'](_0x5bf19f['shift']());}};_0x2f3d8e(++_0x25f9e2);}(_0x8144,0x135));var _0x4814=function(_0x395bee,_0x9c8ed7){_0x395bee=_0x395bee-0x0;var _0xbb3085=_0x8144[_0x395bee];return _0xbb3085;};'use strict';var DashboardEvents=require('./dashboard.events');var events=[_0x4814('0x0'),_0x4814('0x1'),_0x4814('0x2')];function createListener(_0x687940,_0x129ca6){return function(_0x3bc447){_0x129ca6[_0x4814('0x3')](_0x687940,_0x3bc447);};}function removeListener(_0x148a88,_0x440202){return function(){DashboardEvents[_0x4814('0x4')](_0x148a88,_0x440202);};}exports[_0x4814('0x5')]=function(_0x4e2d10){for(var _0x153292=0x0,_0x4792bb=events[_0x4814('0x6')];_0x153292<_0x4792bb;_0x153292++){var _0x2e2d3b=events[_0x153292];var _0x2ecee3=createListener(_0x4814('0x7')+_0x2e2d3b,_0x4e2d10);DashboardEvents['on'](_0x2e2d3b,_0x2ecee3);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 5d38366..4ce5445 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 _0x45d0=['get','getItems','post','create','clone','/:id/items','update','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./dashboard.controller','isAuthenticated','index','/:id','show'];(function(_0x48051b,_0x339115){var _0x2a4f6e=function(_0x5b7756){while(--_0x5b7756){_0x48051b['push'](_0x48051b['shift']());}};_0x2a4f6e(++_0x339115);}(_0x45d0,0x81));var _0x045d=function(_0x53faff,_0x4c7b83){_0x53faff=_0x53faff-0x0;var _0x309f5b=_0x45d0[_0x53faff];return _0x309f5b;};'use strict';var multer=require(_0x045d('0x0'));var util=require('util');var path=require(_0x045d('0x1'));var timeout=require(_0x045d('0x2'));var express=require(_0x045d('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x045d('0x4'));var interaction=require(_0x045d('0x5'));var config=require('../../config/environment');var controller=require(_0x045d('0x6'));router['get']('/',auth[_0x045d('0x7')](),controller[_0x045d('0x8')]);router['get'](_0x045d('0x9'),auth['isAuthenticated'](),controller[_0x045d('0xa')]);router[_0x045d('0xb')]('/:id/items',auth['isAuthenticated'](),controller[_0x045d('0xc')]);router[_0x045d('0xd')]('/',auth[_0x045d('0x7')](),controller[_0x045d('0xe')]);router[_0x045d('0xd')]('/:id/clone',auth[_0x045d('0x7')](),controller[_0x045d('0xf')]);router['post'](_0x045d('0x10'),auth[_0x045d('0x7')](),controller['addItem']);router['put'](_0x045d('0x9'),auth['isAuthenticated'](),controller[_0x045d('0x11')]);router['delete']('/:id',auth[_0x045d('0x7')](),controller[_0x045d('0x12')]);module[_0x045d('0x13')]=router; \ No newline at end of file +var _0xef33=['create','/:id/clone','addItem','put','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/items','getItems','post'];(function(_0x49a1a5,_0x5b8f9f){var _0x37580f=function(_0x2a9306){while(--_0x2a9306){_0x49a1a5['push'](_0x49a1a5['shift']());}};_0x37580f(++_0x5b8f9f);}(_0xef33,0x1be));var _0x3ef3=function(_0x4bfc5f,_0x29c5ba){_0x4bfc5f=_0x4bfc5f-0x0;var _0x27e3a6=_0xef33[_0x4bfc5f];return _0x27e3a6;};'use strict';var multer=require(_0x3ef3('0x0'));var util=require('util');var path=require(_0x3ef3('0x1'));var timeout=require(_0x3ef3('0x2'));var express=require(_0x3ef3('0x3'));var router=express[_0x3ef3('0x4')]();var fs_extra=require(_0x3ef3('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3ef3('0x6'));var config=require(_0x3ef3('0x7'));var controller=require('./dashboard.controller');router['get']('/',auth[_0x3ef3('0x8')](),controller[_0x3ef3('0x9')]);router[_0x3ef3('0xa')](_0x3ef3('0xb'),auth[_0x3ef3('0x8')](),controller[_0x3ef3('0xc')]);router[_0x3ef3('0xa')](_0x3ef3('0xd'),auth[_0x3ef3('0x8')](),controller[_0x3ef3('0xe')]);router[_0x3ef3('0xf')]('/',auth[_0x3ef3('0x8')](),controller[_0x3ef3('0x10')]);router[_0x3ef3('0xf')](_0x3ef3('0x11'),auth[_0x3ef3('0x8')](),controller['clone']);router[_0x3ef3('0xf')](_0x3ef3('0xd'),auth[_0x3ef3('0x8')](),controller[_0x3ef3('0x12')]);router[_0x3ef3('0x13')]('/:id',auth[_0x3ef3('0x8')](),controller['update']);router[_0x3ef3('0x14')](_0x3ef3('0xb'),auth[_0x3ef3('0x8')](),controller['destroy']);module[_0x3ef3('0x15')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 46e1c37..04e6c37 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 _0x2675=['parse','attrs','setDataValue','stringify','INTEGER','sequelize','STRING','long'];(function(_0x1daf9b,_0x159ebf){var _0x530133=function(_0x3c79e1){while(--_0x3c79e1){_0x1daf9b['push'](_0x1daf9b['shift']());}};_0x530133(++_0x159ebf);}(_0x2675,0x75));var _0x5267=function(_0x4e499f,_0x495fb8){_0x4e499f=_0x4e499f-0x0;var _0x55841c=_0x2675[_0x4e499f];return _0x55841c;};'use strict';var Sequelize=require(_0x5267('0x0'));var squel=require('squel');var _=require('lodash');module['exports']={'title':{'type':Sequelize[_0x5267('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x5267('0x1')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0x5267('0x2')),'get':function(){try{return JSON[_0x5267('0x3')](this['getDataValue'](_0x5267('0x4')));}catch(_0xf2b350){return[];}},'set':function(_0x4bd042){try{this[_0x5267('0x5')](_0x5267('0x4'),JSON[_0x5267('0x6')](_0x4bd042));}catch(_0x527c16){this[_0x5267('0x5')](_0x5267('0x4'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0x5267('0x7')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x5267('0x7')]},'col':{'type':Sequelize[_0x5267('0x7')]},'background':{'type':Sequelize[_0x5267('0x1')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x5267('0x1')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x5267('0x1')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file +var _0x326f=['#2196f3','sequelize','exports','STRING','TEXT','long','parse','getDataValue','attrs','stringify','setDataValue','INTEGER','#ffffff'];(function(_0x552dae,_0x134907){var _0x2eb1df=function(_0x40bbb2){while(--_0x40bbb2){_0x552dae['push'](_0x552dae['shift']());}};_0x2eb1df(++_0x134907);}(_0x326f,0xd1));var _0xf326=function(_0xdb3fda,_0x4eba92){_0xdb3fda=_0xdb3fda-0x0;var _0x3c6b6d=_0x326f[_0xdb3fda];return _0x3c6b6d;};'use strict';var Sequelize=require(_0xf326('0x0'));var squel=require('squel');var _=require('lodash');module[_0xf326('0x1')]={'title':{'type':Sequelize[_0xf326('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xf326('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xf326('0x3')](_0xf326('0x4')),'get':function(){try{return JSON[_0xf326('0x5')](this[_0xf326('0x6')](_0xf326('0x7')));}catch(_0x1b5a56){return[];}},'set':function(_0x3ace29){try{this['setDataValue'](_0xf326('0x7'),JSON[_0xf326('0x8')](_0x3ace29));}catch(_0x165f95){this[_0xf326('0x9')]('attrs',JSON['stringify']([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xf326('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xf326('0xa')]},'col':{'type':Sequelize[_0xf326('0xa')]},'background':{'type':Sequelize[_0xf326('0x2')],'allowNull':![],'defaultValue':_0xf326('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xf326('0xc'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']},'titleFontSize':{'type':Sequelize[_0xf326('0xa')],'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 76b1f8b..3b64868 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 _0x27eb=['HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','stringify','body','create','update','find','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','localhost','redis','register','sendStatus','end','status','json','offset','undefined','limit','Content-Range','reject','save','then','destroy','error','stack','name','send','show','params','model','keys','DashboardItem','rawAttributes','query','intersection','attributes','fields','length','includeAll','include','catch','type','iframe','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat'];(function(_0x777421,_0x1f9866){var _0x2bdaa2=function(_0x500041){while(--_0x500041){_0x777421['push'](_0x777421['shift']());}};_0x2bdaa2(++_0x1f9866);}(_0x27eb,0xd0));var _0xb27e=function(_0x45d48a,_0xc2538f){_0x45d48a=_0x45d48a-0x0;var _0x93e5d0=_0x27eb[_0x45d48a];return _0x93e5d0;};'use strict';var emlformat=require(_0xb27e('0x0'));var rimraf=require(_0xb27e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb27e('0x2'));var moment=require(_0xb27e('0x3'));var BPromise=require(_0xb27e('0x4'));var Mustache=require('mustache');var util=require(_0xb27e('0x5'));var path=require(_0xb27e('0x6'));var sox=require(_0xb27e('0x7'));var csv=require(_0xb27e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb27e('0x9'));var _=require(_0xb27e('0xa'));var squel=require(_0xb27e('0xb'));var crypto=require(_0xb27e('0xc'));var jsforce=require(_0xb27e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xb27e('0x8'));var querystring=require(_0xb27e('0xe'));var Papa=require(_0xb27e('0xf'));var Redis=require(_0xb27e('0x10'));var authService=require(_0xb27e('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xb27e('0x12'));var hardwareService=require(_0xb27e('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xb27e('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xb27e('0x15'));var db=require(_0xb27e('0x16'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xb27e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb27e('0x18')]));require('./dashboardItem.socket')[_0xb27e('0x19')](socket);function respondWithStatusCode(_0x5aa86f,_0x1453e5){_0x1453e5=_0x1453e5||0xcc;return function(_0x1cb58c){if(_0x1cb58c){return _0x5aa86f[_0xb27e('0x1a')](_0x1453e5);}return _0x5aa86f['status'](_0x1453e5)[_0xb27e('0x1b')]();};}function respondWithResult(_0x1d14bb,_0x24fc3e){_0x24fc3e=_0x24fc3e||0xc8;return function(_0x188073){if(_0x188073){return _0x1d14bb[_0xb27e('0x1c')](_0x24fc3e)[_0xb27e('0x1d')](_0x188073);}};}function respondWithFilteredResult(_0x25ce70,_0x336679){return function(_0x317f4e){if(_0x317f4e){var _0x48b70f=typeof _0x336679[_0xb27e('0x1e')]===_0xb27e('0x1f')&&typeof _0x336679[_0xb27e('0x20')]==='undefined';var _0x352856=_0x317f4e['count'];var _0x517932=_0x48b70f?0x0:_0x336679[_0xb27e('0x1e')];var _0x15dc7e=_0x48b70f?_0x317f4e['count']:_0x336679[_0xb27e('0x1e')]+_0x336679[_0xb27e('0x20')];var _0x16c950;if(_0x15dc7e>=_0x352856){_0x15dc7e=_0x352856;_0x16c950=0xc8;}else{_0x16c950=0xce;}_0x25ce70[_0xb27e('0x1c')](_0x16c950);return _0x25ce70['set'](_0xb27e('0x21'),_0x517932+'-'+_0x15dc7e+'/'+_0x352856)['json'](_0x317f4e);}return null;};}function patchUpdates(_0x19c0f2){return function(_0x2b8f05){try{jsonpatch['apply'](_0x2b8f05,_0x19c0f2,!![]);}catch(_0x58fc84){return BPromise[_0xb27e('0x22')](_0x58fc84);}return _0x2b8f05[_0xb27e('0x23')]();};}function saveUpdates(_0x3703ab,_0x3c4aa2){return function(_0x1e1bb9){if(_0x1e1bb9){return _0x1e1bb9['update'](_0x3703ab)[_0xb27e('0x24')](function(_0x4cba0b){return _0x4cba0b;});}return null;};}function removeEntity(_0x3972bc,_0x1ac460){return function(_0x289bb5){if(_0x289bb5){return _0x289bb5[_0xb27e('0x25')]()[_0xb27e('0x24')](function(){_0x3972bc['status'](0xcc)[_0xb27e('0x1b')]();});}};}function handleEntityNotFound(_0x5bae7c,_0x2839cf){return function(_0x2f44f3){if(!_0x2f44f3){_0x5bae7c[_0xb27e('0x1a')](0x194);}return _0x2f44f3;};}function handleError(_0x10dfc1,_0x3da666){_0x3da666=_0x3da666||0x1f4;return function(_0x35169a){logger[_0xb27e('0x26')](_0x35169a[_0xb27e('0x27')]);if(_0x35169a[_0xb27e('0x28')]){delete _0x35169a['name'];}_0x10dfc1[_0xb27e('0x1c')](_0x3da666)[_0xb27e('0x29')](_0x35169a);};}exports[_0xb27e('0x2a')]=function(_0x41fc88,_0x58a1a9){var _0x1ba773={'raw':![],'where':{'id':_0x41fc88[_0xb27e('0x2b')]['id']}},_0x28927a={};_0x28927a[_0xb27e('0x2c')]=_[_0xb27e('0x2d')](db[_0xb27e('0x2e')][_0xb27e('0x2f')]);_0x28927a['query']=_['keys'](_0x41fc88[_0xb27e('0x30')]);_0x28927a['filters']=_[_0xb27e('0x31')](_0x28927a['model'],_0x28927a[_0xb27e('0x30')]);_0x1ba773[_0xb27e('0x32')]=_[_0xb27e('0x31')](_0x28927a[_0xb27e('0x2c')],qs[_0xb27e('0x33')](_0x41fc88[_0xb27e('0x30')]['fields']));_0x1ba773[_0xb27e('0x32')]=_0x1ba773['attributes'][_0xb27e('0x34')]?_0x1ba773['attributes']:_0x28927a[_0xb27e('0x2c')];if(_0x41fc88['query'][_0xb27e('0x35')]){_0x1ba773[_0xb27e('0x36')]=[{'all':!![]}];}_0x1ba773=_['merge']({},_0x1ba773,_0x41fc88['options']);return db[_0xb27e('0x2e')]['find'](_0x1ba773)['then'](handleEntityNotFound(_0x58a1a9,null))['then'](respondWithResult(_0x58a1a9,null))[_0xb27e('0x37')](handleError(_0x58a1a9,null));};exports[_0xb27e('0x25')]=function(_0x583414,_0xa6ff7b){return db[_0xb27e('0x2e')]['find']({'where':{'id':_0x583414['params']['id']}})[_0xb27e('0x24')](handleEntityNotFound(_0xa6ff7b,null))['then'](removeEntity(_0xa6ff7b,null))[_0xb27e('0x37')](handleError(_0xa6ff7b,null));};function widgetAttributes(_0x551038){try{switch(_0x551038[_0xb27e('0x38')]){case _0xb27e('0x39'):return[{'name':_0xb27e('0x3a'),'value':_0x551038[_0xb27e('0x3a')]||(_0x551038[_0xb27e('0x3b')]&&_0x551038[_0xb27e('0x3b')][0x0]?_0x551038[_0xb27e('0x3b')][0x0][_0xb27e('0x3c')]:undefined)||'https://'}];case _0xb27e('0x3d'):return[{'name':_0xb27e('0x3e'),'value':_0x551038[_0xb27e('0x3e')]||(_0x551038[_0xb27e('0x3b')]&&_0x551038[_0xb27e('0x3b')][0x0]?_0x551038['attrs'][0x0]['value']:undefined)||''}];case _0xb27e('0x3f'):return[{'name':_0xb27e('0x40'),'value':_0x551038[_0xb27e('0x40')]||(_0x551038['attrs']&&_0x551038[_0xb27e('0x3b')][0x0]?_0x551038[_0xb27e('0x3b')][0x0][_0xb27e('0x3c')]:undefined)||_0xb27e('0x41')},{'name':_0xb27e('0x42'),'value':_0x551038[_0xb27e('0x42')]||(_0x551038[_0xb27e('0x3b')]&&_0x551038['attrs'][0x1]?_0x551038['attrs'][0x1][_0xb27e('0x3c')]:undefined)||_0xb27e('0x43')},{'name':_0xb27e('0x44'),'value':_0x551038[_0xb27e('0x44')]||(_0x551038[_0xb27e('0x3b')]&&_0x551038[_0xb27e('0x3b')][0x2]?_0x551038[_0xb27e('0x3b')][0x2][_0xb27e('0x3c')]:undefined)||0xc}];case'counter':return[{'name':_0xb27e('0x45'),'value':_0x551038[_0xb27e('0x45')]||(_0x551038[_0xb27e('0x3b')]&&_0x551038[_0xb27e('0x3b')][0x0]?_0x551038['attrs'][0x0][_0xb27e('0x3c')]:undefined)||'total'},{'name':'attrVoiceQueues','value':_0x551038[_0xb27e('0x46')]||(_0x551038[_0xb27e('0x3b')]&&_0x551038['attrs'][0x1]?_0x551038[_0xb27e('0x3b')][0x1][_0xb27e('0x3c')]:undefined)||[]},{'name':_0xb27e('0x44'),'value':_0x551038[_0xb27e('0x44')]||(_0x551038[_0xb27e('0x3b')]&&_0x551038[_0xb27e('0x3b')][0x2]?_0x551038[_0xb27e('0x3b')][0x2]['value']:undefined)||0x14},{'name':_0xb27e('0x47'),'value':_0x551038['attrChannel']||(_0x551038[_0xb27e('0x3b')]&&_0x551038[_0xb27e('0x3b')][0x3]?_0x551038[_0xb27e('0x3b')][0x3][_0xb27e('0x3c')]:undefined)||_0xb27e('0x48')},{'name':_0xb27e('0x49'),'value':_0x551038['attrEmailAccounts']||(_0x551038['attrs']&&_0x551038[_0xb27e('0x3b')][0x4]?_0x551038[_0xb27e('0x3b')][0x4][_0xb27e('0x3c')]:undefined)||''},{'name':_0xb27e('0x4a'),'value':_0x551038[_0xb27e('0x4a')]||(_0x551038['attrs']&&_0x551038[_0xb27e('0x3b')][0x5]?_0x551038[_0xb27e('0x3b')][0x5][_0xb27e('0x3c')]:undefined)||''},{'name':_0xb27e('0x4b'),'value':_0x551038[_0xb27e('0x4b')]||(_0x551038[_0xb27e('0x3b')]&&_0x551038[_0xb27e('0x3b')][0x6]?_0x551038[_0xb27e('0x3b')][0x6][_0xb27e('0x3c')]:undefined)||''},{'name':_0xb27e('0x4c'),'value':_0x551038[_0xb27e('0x4c')]||(_0x551038['attrs']&&_0x551038[_0xb27e('0x3b')][0x7]?_0x551038['attrs'][0x7][_0xb27e('0x3c')]:undefined)||''},{'name':_0xb27e('0x4d'),'value':_0x551038[_0xb27e('0x4d')]||(_0x551038[_0xb27e('0x3b')]&&_0x551038[_0xb27e('0x3b')][0x8]?_0x551038[_0xb27e('0x3b')][0x8][_0xb27e('0x3c')]:undefined)||''},{'name':_0xb27e('0x4e'),'value':_0x551038['attrChatWebsites']||(_0x551038['attrs']&&_0x551038[_0xb27e('0x3b')][0x9]?_0x551038[_0xb27e('0x3b')][0x9][_0xb27e('0x3c')]:undefined)||''}];case'multibar-chart':case _0xb27e('0x4f'):return[{'name':'attrSerie1','value':_0x551038[_0xb27e('0x50')]||(_0x551038[_0xb27e('0x3b')]&&_0x551038[_0xb27e('0x3b')][0x0]?_0x551038['attrs'][0x0][_0xb27e('0x3c')]:undefined)||'total'},{'name':_0xb27e('0x51'),'value':_0x551038[_0xb27e('0x51')]||(_0x551038[_0xb27e('0x3b')]&&_0x551038[_0xb27e('0x3b')][0x1]?_0x551038['attrs'][0x1][_0xb27e('0x3c')]:undefined)||null},{'name':_0xb27e('0x52'),'value':_0x551038[_0xb27e('0x52')]||(_0x551038[_0xb27e('0x3b')]&&_0x551038[_0xb27e('0x3b')][0x2]?_0x551038[_0xb27e('0x3b')][0x2][_0xb27e('0x3c')]:undefined)||null},{'name':_0xb27e('0x46'),'value':_0x551038[_0xb27e('0x46')]||(_0x551038['attrs']&&_0x551038[_0xb27e('0x3b')][0x3]?_0x551038['attrs'][0x3]['value']:undefined)||[]},{'name':_0xb27e('0x47'),'value':_0x551038[_0xb27e('0x47')]||(_0x551038[_0xb27e('0x3b')]&&_0x551038[_0xb27e('0x3b')][0x4]?_0x551038[_0xb27e('0x3b')][0x4]['value']:undefined)||'voice'},{'name':_0xb27e('0x49'),'value':_0x551038[_0xb27e('0x49')]||(_0x551038[_0xb27e('0x3b')]&&_0x551038[_0xb27e('0x3b')][0x5]?_0x551038[_0xb27e('0x3b')][0x5][_0xb27e('0x3c')]:undefined)||''},{'name':_0xb27e('0x4a'),'value':_0x551038[_0xb27e('0x4a')]||(_0x551038['attrs']&&_0x551038[_0xb27e('0x3b')][0x6]?_0x551038[_0xb27e('0x3b')][0x6]['value']:undefined)||''},{'name':_0xb27e('0x4b'),'value':_0x551038[_0xb27e('0x4b')]||(_0x551038[_0xb27e('0x3b')]&&_0x551038[_0xb27e('0x3b')][0x7]?_0x551038[_0xb27e('0x3b')][0x7][_0xb27e('0x3c')]:undefined)||''},{'name':_0xb27e('0x4c'),'value':_0x551038[_0xb27e('0x4c')]||(_0x551038['attrs']&&_0x551038[_0xb27e('0x3b')][0x8]?_0x551038[_0xb27e('0x3b')][0x8][_0xb27e('0x3c')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x551038[_0xb27e('0x4d')]||(_0x551038['attrs']&&_0x551038['attrs'][0x9]?_0x551038[_0xb27e('0x3b')][0x9][_0xb27e('0x3c')]:undefined)||''},{'name':_0xb27e('0x4e'),'value':_0x551038[_0xb27e('0x4e')]||(_0x551038[_0xb27e('0x3b')]&&_0x551038['attrs'][0xa]?_0x551038[_0xb27e('0x3b')][0xa][_0xb27e('0x3c')]:undefined)||''}];case _0xb27e('0x53'):return[{'name':_0xb27e('0x54'),'type':_0x551038['reportType']||(_0x551038[_0xb27e('0x3b')]&&_0x551038[_0xb27e('0x3b')][0x0]?_0x551038[_0xb27e('0x3b')][0x0][_0xb27e('0x38')]:undefined)||null,'value':_0x551038[_0xb27e('0x54')]||(_0x551038['attrs']&&_0x551038[_0xb27e('0x3b')][0x0]?_0x551038[_0xb27e('0x3b')][0x0]['value']:undefined)||null},{'name':_0xb27e('0x55'),'value':_0x551038[_0xb27e('0x55')]||(_0x551038['attrs']&&_0x551038[_0xb27e('0x3b')][0x1]?_0x551038[_0xb27e('0x3b')][0x1][_0xb27e('0x3c')]:undefined)||0x0}];default:return[];}}catch(_0x4ede55){logger[_0xb27e('0x26')]('widgetAttributes:\x20%s',JSON[_0xb27e('0x56')](_0x4ede55));return[];}}exports['create']=function(_0x32d9ec,_0x104e8e){if(_0x32d9ec[_0xb27e('0x57')]){_0x32d9ec[_0xb27e('0x57')][_0xb27e('0x3b')]=widgetAttributes(_0x32d9ec[_0xb27e('0x57')]);}return db[_0xb27e('0x2e')][_0xb27e('0x58')](_0x32d9ec['body'],{})[_0xb27e('0x24')](respondWithResult(_0x104e8e,0xc9))['catch'](handleError(_0x104e8e,null));};exports[_0xb27e('0x59')]=function(_0x48e11b,_0x861def){if(_0x48e11b[_0xb27e('0x57')]['id']){delete _0x48e11b[_0xb27e('0x57')]['id'];}_0x48e11b[_0xb27e('0x57')][_0xb27e('0x3b')]=widgetAttributes(_0x48e11b[_0xb27e('0x57')]);return db[_0xb27e('0x2e')][_0xb27e('0x5a')]({'where':{'id':_0x48e11b['params']['id']}})[_0xb27e('0x24')](handleEntityNotFound(_0x861def,null))[_0xb27e('0x24')](saveUpdates(_0x48e11b[_0xb27e('0x57')],null))[_0xb27e('0x24')](respondWithResult(_0x861def,null))[_0xb27e('0x37')](handleError(_0x861def,null));}; \ No newline at end of file +var _0x6333=['keys','DashboardItem','rawAttributes','query','filters','attributes','intersection','includeAll','include','find','catch','iframe','attrUrl','attrs','value','https://','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','fast-json-patch','moment','bluebird','util','sox','to-csv','lodash','squel','crypto','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','status','end','offset','undefined','count','limit','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','show','params','model'];(function(_0x2bf768,_0x5692aa){var _0x521c1e=function(_0x839cd){while(--_0x839cd){_0x2bf768['push'](_0x2bf768['shift']());}};_0x521c1e(++_0x5692aa);}(_0x6333,0x83));var _0x3633=function(_0x3c0be1,_0x193384){_0x3c0be1=_0x3c0be1-0x0;var _0x3d3787=_0x6333[_0x3c0be1];return _0x3d3787;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3633('0x0'));var rp=require('request-promise');var moment=require(_0x3633('0x1'));var BPromise=require(_0x3633('0x2'));var Mustache=require('mustache');var util=require(_0x3633('0x3'));var path=require('path');var sox=require(_0x3633('0x4'));var csv=require(_0x3633('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3633('0x6'));var squel=require(_0x3633('0x7'));var crypto=require(_0x3633('0x8'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3633('0x5'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3633('0x9'));var authService=require(_0x3633('0xa'));var qs=require(_0x3633('0xb'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3633('0xc'));var logger=require(_0x3633('0xd'))('api');var utils=require('../../config/utils');var config=require(_0x3633('0xe'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x3633('0xf')]=_[_0x3633('0x10')](config[_0x3633('0xf')],{'host':_0x3633('0x11'),'port':0x18eb});var socket=require(_0x3633('0x12'))(new Redis(config['redis']));require(_0x3633('0x13'))[_0x3633('0x14')](socket);function respondWithStatusCode(_0x5bf51b,_0x57460b){_0x57460b=_0x57460b||0xcc;return function(_0x55b6cd){if(_0x55b6cd){return _0x5bf51b['sendStatus'](_0x57460b);}return _0x5bf51b[_0x3633('0x15')](_0x57460b)[_0x3633('0x16')]();};}function respondWithResult(_0x2f5eab,_0x42a894){_0x42a894=_0x42a894||0xc8;return function(_0x1acaeb){if(_0x1acaeb){return _0x2f5eab[_0x3633('0x15')](_0x42a894)['json'](_0x1acaeb);}};}function respondWithFilteredResult(_0x2d123e,_0x349ee7){return function(_0x578e08){if(_0x578e08){var _0x57961b=typeof _0x349ee7[_0x3633('0x17')]==='undefined'&&typeof _0x349ee7['limit']===_0x3633('0x18');var _0x13f7af=_0x578e08[_0x3633('0x19')];var _0x4bdb9b=_0x57961b?0x0:_0x349ee7[_0x3633('0x17')];var _0xd34aef=_0x57961b?_0x578e08[_0x3633('0x19')]:_0x349ee7['offset']+_0x349ee7[_0x3633('0x1a')];var _0x2b7f86;if(_0xd34aef>=_0x13f7af){_0xd34aef=_0x13f7af;_0x2b7f86=0xc8;}else{_0x2b7f86=0xce;}_0x2d123e[_0x3633('0x15')](_0x2b7f86);return _0x2d123e['set'](_0x3633('0x1b'),_0x4bdb9b+'-'+_0xd34aef+'/'+_0x13f7af)[_0x3633('0x1c')](_0x578e08);}return null;};}function patchUpdates(_0x4ed8e3){return function(_0x2efd9a){try{jsonpatch[_0x3633('0x1d')](_0x2efd9a,_0x4ed8e3,!![]);}catch(_0x1d5270){return BPromise[_0x3633('0x1e')](_0x1d5270);}return _0x2efd9a[_0x3633('0x1f')]();};}function saveUpdates(_0x27511a,_0x2db92e){return function(_0xedb9dc){if(_0xedb9dc){return _0xedb9dc[_0x3633('0x20')](_0x27511a)[_0x3633('0x21')](function(_0x2c781f){return _0x2c781f;});}return null;};}function removeEntity(_0x3844d5,_0x4b0ad7){return function(_0x2a1b70){if(_0x2a1b70){return _0x2a1b70[_0x3633('0x22')]()['then'](function(){_0x3844d5[_0x3633('0x15')](0xcc)[_0x3633('0x16')]();});}};}function handleEntityNotFound(_0x394c0a,_0x3c3c22){return function(_0x19df4a){if(!_0x19df4a){_0x394c0a[_0x3633('0x23')](0x194);}return _0x19df4a;};}function handleError(_0x5ef18c,_0x5b8524){_0x5b8524=_0x5b8524||0x1f4;return function(_0x9fa0fd){logger[_0x3633('0x24')](_0x9fa0fd[_0x3633('0x25')]);if(_0x9fa0fd[_0x3633('0x26')]){delete _0x9fa0fd[_0x3633('0x26')];}_0x5ef18c[_0x3633('0x15')](_0x5b8524)[_0x3633('0x27')](_0x9fa0fd);};}exports[_0x3633('0x28')]=function(_0x448aef,_0x2ceabb){var _0x4fddd5={'raw':![],'where':{'id':_0x448aef[_0x3633('0x29')]['id']}},_0x37b887={};_0x37b887[_0x3633('0x2a')]=_[_0x3633('0x2b')](db[_0x3633('0x2c')][_0x3633('0x2d')]);_0x37b887[_0x3633('0x2e')]=_['keys'](_0x448aef[_0x3633('0x2e')]);_0x37b887[_0x3633('0x2f')]=_['intersection'](_0x37b887[_0x3633('0x2a')],_0x37b887[_0x3633('0x2e')]);_0x4fddd5[_0x3633('0x30')]=_[_0x3633('0x31')](_0x37b887[_0x3633('0x2a')],qs['fields'](_0x448aef[_0x3633('0x2e')]['fields']));_0x4fddd5['attributes']=_0x4fddd5[_0x3633('0x30')]['length']?_0x4fddd5[_0x3633('0x30')]:_0x37b887[_0x3633('0x2a')];if(_0x448aef['query'][_0x3633('0x32')]){_0x4fddd5[_0x3633('0x33')]=[{'all':!![]}];}_0x4fddd5=_['merge']({},_0x4fddd5,_0x448aef['options']);return db[_0x3633('0x2c')][_0x3633('0x34')](_0x4fddd5)[_0x3633('0x21')](handleEntityNotFound(_0x2ceabb,null))[_0x3633('0x21')](respondWithResult(_0x2ceabb,null))['catch'](handleError(_0x2ceabb,null));};exports[_0x3633('0x22')]=function(_0x2ce894,_0x18ece9){return db['DashboardItem'][_0x3633('0x34')]({'where':{'id':_0x2ce894['params']['id']}})[_0x3633('0x21')](handleEntityNotFound(_0x18ece9,null))[_0x3633('0x21')](removeEntity(_0x18ece9,null))[_0x3633('0x35')](handleError(_0x18ece9,null));};function widgetAttributes(_0x1efeb8){try{switch(_0x1efeb8['type']){case _0x3633('0x36'):return[{'name':_0x3633('0x37'),'value':_0x1efeb8['attrUrl']||(_0x1efeb8[_0x3633('0x38')]&&_0x1efeb8['attrs'][0x0]?_0x1efeb8[_0x3633('0x38')][0x0][_0x3633('0x39')]:undefined)||_0x3633('0x3a')}];case'custom':return[{'name':_0x3633('0x3b'),'value':_0x1efeb8['attrPath']||(_0x1efeb8[_0x3633('0x38')]&&_0x1efeb8[_0x3633('0x38')][0x0]?_0x1efeb8[_0x3633('0x38')][0x0][_0x3633('0x39')]:undefined)||''}];case'clock':return[{'name':_0x3633('0x3c'),'value':_0x1efeb8[_0x3633('0x3c')]||(_0x1efeb8[_0x3633('0x38')]&&_0x1efeb8[_0x3633('0x38')][0x0]?_0x1efeb8[_0x3633('0x38')][0x0][_0x3633('0x39')]:undefined)||_0x3633('0x3d')},{'name':_0x3633('0x3e'),'value':_0x1efeb8['attrTimezone']||(_0x1efeb8['attrs']&&_0x1efeb8[_0x3633('0x38')][0x1]?_0x1efeb8['attrs'][0x1][_0x3633('0x39')]:undefined)||_0x3633('0x3f')},{'name':'attrFontSize','value':_0x1efeb8[_0x3633('0x40')]||(_0x1efeb8[_0x3633('0x38')]&&_0x1efeb8[_0x3633('0x38')][0x2]?_0x1efeb8[_0x3633('0x38')][0x2][_0x3633('0x39')]:undefined)||0xc}];case'counter':return[{'name':'attrMetric','value':_0x1efeb8[_0x3633('0x41')]||(_0x1efeb8[_0x3633('0x38')]&&_0x1efeb8[_0x3633('0x38')][0x0]?_0x1efeb8[_0x3633('0x38')][0x0][_0x3633('0x39')]:undefined)||_0x3633('0x42')},{'name':_0x3633('0x43'),'value':_0x1efeb8['attrVoiceQueues']||(_0x1efeb8[_0x3633('0x38')]&&_0x1efeb8[_0x3633('0x38')][0x1]?_0x1efeb8[_0x3633('0x38')][0x1]['value']:undefined)||[]},{'name':'attrFontSize','value':_0x1efeb8[_0x3633('0x40')]||(_0x1efeb8['attrs']&&_0x1efeb8[_0x3633('0x38')][0x2]?_0x1efeb8['attrs'][0x2][_0x3633('0x39')]:undefined)||0x14},{'name':_0x3633('0x44'),'value':_0x1efeb8[_0x3633('0x44')]||(_0x1efeb8[_0x3633('0x38')]&&_0x1efeb8[_0x3633('0x38')][0x3]?_0x1efeb8[_0x3633('0x38')][0x3][_0x3633('0x39')]:undefined)||_0x3633('0x45')},{'name':'attrEmailAccounts','value':_0x1efeb8['attrEmailAccounts']||(_0x1efeb8[_0x3633('0x38')]&&_0x1efeb8[_0x3633('0x38')][0x4]?_0x1efeb8['attrs'][0x4][_0x3633('0x39')]:undefined)||''},{'name':_0x3633('0x46'),'value':_0x1efeb8[_0x3633('0x46')]||(_0x1efeb8['attrs']&&_0x1efeb8['attrs'][0x5]?_0x1efeb8[_0x3633('0x38')][0x5][_0x3633('0x39')]:undefined)||''},{'name':_0x3633('0x47'),'value':_0x1efeb8[_0x3633('0x47')]||(_0x1efeb8[_0x3633('0x38')]&&_0x1efeb8[_0x3633('0x38')][0x6]?_0x1efeb8['attrs'][0x6][_0x3633('0x39')]:undefined)||''},{'name':_0x3633('0x48'),'value':_0x1efeb8[_0x3633('0x48')]||(_0x1efeb8[_0x3633('0x38')]&&_0x1efeb8[_0x3633('0x38')][0x7]?_0x1efeb8[_0x3633('0x38')][0x7][_0x3633('0x39')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x1efeb8[_0x3633('0x49')]||(_0x1efeb8['attrs']&&_0x1efeb8[_0x3633('0x38')][0x8]?_0x1efeb8[_0x3633('0x38')][0x8]['value']:undefined)||''},{'name':_0x3633('0x4a'),'value':_0x1efeb8['attrChatWebsites']||(_0x1efeb8[_0x3633('0x38')]&&_0x1efeb8[_0x3633('0x38')][0x9]?_0x1efeb8[_0x3633('0x38')][0x9][_0x3633('0x39')]:undefined)||''}];case _0x3633('0x4b'):case'pie-chart':return[{'name':_0x3633('0x4c'),'value':_0x1efeb8[_0x3633('0x4c')]||(_0x1efeb8[_0x3633('0x38')]&&_0x1efeb8['attrs'][0x0]?_0x1efeb8['attrs'][0x0][_0x3633('0x39')]:undefined)||'total'},{'name':'attrSerie2','value':_0x1efeb8[_0x3633('0x4d')]||(_0x1efeb8[_0x3633('0x38')]&&_0x1efeb8[_0x3633('0x38')][0x1]?_0x1efeb8[_0x3633('0x38')][0x1]['value']:undefined)||null},{'name':_0x3633('0x4e'),'value':_0x1efeb8[_0x3633('0x4e')]||(_0x1efeb8[_0x3633('0x38')]&&_0x1efeb8[_0x3633('0x38')][0x2]?_0x1efeb8[_0x3633('0x38')][0x2][_0x3633('0x39')]:undefined)||null},{'name':_0x3633('0x43'),'value':_0x1efeb8['attrVoiceQueues']||(_0x1efeb8['attrs']&&_0x1efeb8['attrs'][0x3]?_0x1efeb8[_0x3633('0x38')][0x3][_0x3633('0x39')]:undefined)||[]},{'name':_0x3633('0x44'),'value':_0x1efeb8['attrChannel']||(_0x1efeb8[_0x3633('0x38')]&&_0x1efeb8[_0x3633('0x38')][0x4]?_0x1efeb8['attrs'][0x4][_0x3633('0x39')]:undefined)||_0x3633('0x45')},{'name':'attrEmailAccounts','value':_0x1efeb8['attrEmailAccounts']||(_0x1efeb8['attrs']&&_0x1efeb8[_0x3633('0x38')][0x5]?_0x1efeb8[_0x3633('0x38')][0x5][_0x3633('0x39')]:undefined)||''},{'name':_0x3633('0x46'),'value':_0x1efeb8[_0x3633('0x46')]||(_0x1efeb8['attrs']&&_0x1efeb8[_0x3633('0x38')][0x6]?_0x1efeb8[_0x3633('0x38')][0x6][_0x3633('0x39')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x1efeb8[_0x3633('0x47')]||(_0x1efeb8[_0x3633('0x38')]&&_0x1efeb8['attrs'][0x7]?_0x1efeb8['attrs'][0x7][_0x3633('0x39')]:undefined)||''},{'name':_0x3633('0x48'),'value':_0x1efeb8['attrOpenchannelAccounts']||(_0x1efeb8['attrs']&&_0x1efeb8['attrs'][0x8]?_0x1efeb8[_0x3633('0x38')][0x8][_0x3633('0x39')]:undefined)||''},{'name':_0x3633('0x49'),'value':_0x1efeb8[_0x3633('0x49')]||(_0x1efeb8[_0x3633('0x38')]&&_0x1efeb8['attrs'][0x9]?_0x1efeb8[_0x3633('0x38')][0x9][_0x3633('0x39')]:undefined)||''},{'name':_0x3633('0x4a'),'value':_0x1efeb8[_0x3633('0x4a')]||(_0x1efeb8[_0x3633('0x38')]&&_0x1efeb8[_0x3633('0x38')][0xa]?_0x1efeb8['attrs'][0xa][_0x3633('0x39')]:undefined)||''}];case _0x3633('0x4f'):return[{'name':_0x3633('0x50'),'type':_0x1efeb8[_0x3633('0x51')]||(_0x1efeb8[_0x3633('0x38')]&&_0x1efeb8[_0x3633('0x38')][0x0]?_0x1efeb8[_0x3633('0x38')][0x0]['type']:undefined)||null,'value':_0x1efeb8['attrReport']||(_0x1efeb8[_0x3633('0x38')]&&_0x1efeb8[_0x3633('0x38')][0x0]?_0x1efeb8['attrs'][0x0]['value']:undefined)||null},{'name':_0x3633('0x52'),'value':_0x1efeb8['attrRefresh']||(_0x1efeb8[_0x3633('0x38')]&&_0x1efeb8[_0x3633('0x38')][0x1]?_0x1efeb8[_0x3633('0x38')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x57a449){logger['error'](_0x3633('0x53'),JSON[_0x3633('0x54')](_0x57a449));return[];}}exports['create']=function(_0xfc959a,_0x14c8e0){if(_0xfc959a['body']){_0xfc959a['body'][_0x3633('0x38')]=widgetAttributes(_0xfc959a['body']);}return db[_0x3633('0x2c')][_0x3633('0x55')](_0xfc959a[_0x3633('0x56')],{})[_0x3633('0x21')](respondWithResult(_0x14c8e0,0xc9))[_0x3633('0x35')](handleError(_0x14c8e0,null));};exports[_0x3633('0x20')]=function(_0x2e52e7,_0x49a462){if(_0x2e52e7[_0x3633('0x56')]['id']){delete _0x2e52e7[_0x3633('0x56')]['id'];}_0x2e52e7[_0x3633('0x56')][_0x3633('0x38')]=widgetAttributes(_0x2e52e7['body']);return db[_0x3633('0x2c')][_0x3633('0x34')]({'where':{'id':_0x2e52e7[_0x3633('0x29')]['id']}})[_0x3633('0x21')](handleEntityNotFound(_0x49a462,null))[_0x3633('0x21')](saveUpdates(_0x2e52e7['body'],null))[_0x3633('0x21')](respondWithResult(_0x49a462,null))[_0x3633('0x35')](handleError(_0x49a462,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 4b6da64..7eb6103 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 _0x7854=['save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x978c41,_0x51b219){var _0x33bd45=function(_0x480c09){while(--_0x480c09){_0x978c41['push'](_0x978c41['shift']());}};_0x33bd45(++_0x51b219);}(_0x7854,0x189));var _0x4785=function(_0x2e78e9,_0x42957c){_0x2e78e9=_0x2e78e9-0x0;var _0x35aad4=_0x7854[_0x2e78e9];return _0x35aad4;};'use strict';var EventEmitter=require(_0x4785('0x0'));var DashboardItem=require(_0x4785('0x1'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x4785('0x2')](0x0);var events={'afterCreate':_0x4785('0x3'),'afterUpdate':_0x4785('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3c2030){return function(_0x19f53b,_0x43389e,_0x2dc682){DashboardItemEvents[_0x4785('0x5')](_0x3c2030+':'+_0x19f53b['id'],_0x19f53b);DashboardItemEvents[_0x4785('0x5')](_0x3c2030,_0x19f53b);_0x2dc682(null);};}for(var e in events){if(events[_0x4785('0x6')](e)){var event=events[e];DashboardItem[_0x4785('0x7')](e,emitEvent(event));}}module[_0x4785('0x8')]=DashboardItemEvents; \ No newline at end of file +var _0xfdc6=['remove','emit','exports','DashboardItem','setMaxListeners','update'];(function(_0x5f05cc,_0x445ef3){var _0x2e0b68=function(_0x29f952){while(--_0x29f952){_0x5f05cc['push'](_0x5f05cc['shift']());}};_0x2e0b68(++_0x445ef3);}(_0xfdc6,0xf3));var _0x6fdc=function(_0xea1bcd,_0x465e08){_0xea1bcd=_0xea1bcd-0x0;var _0xfbe4c6=_0xfdc6[_0xea1bcd];return _0xfbe4c6;};'use strict';var EventEmitter=require('events');var DashboardItem=require('../../mysqldb')['db'][_0x6fdc('0x0')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x6fdc('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6fdc('0x2'),'afterDestroy':_0x6fdc('0x3')};function emitEvent(_0x239c81){return function(_0x339bce,_0x2be0db,_0x53235b){DashboardItemEvents[_0x6fdc('0x4')](_0x239c81+':'+_0x339bce['id'],_0x339bce);DashboardItemEvents['emit'](_0x239c81,_0x339bce);_0x53235b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module[_0x6fdc('0x5')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 4899ddc..8e2101f 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 _0x862f=['request-promise','path','./dashboardItem.attributes','exports','DashboardItem','dashboard_items','util','../../config/logger','api','moment'];(function(_0x5967e4,_0x2939ca){var _0x48b31f=function(_0x25ab53){while(--_0x25ab53){_0x5967e4['push'](_0x5967e4['shift']());}};_0x48b31f(++_0x2939ca);}(_0x862f,0xba));var _0xf862=function(_0x2b1552,_0x17993f){_0x2b1552=_0x2b1552-0x0;var _0x4cd48e=_0x862f[_0x2b1552];return _0x4cd48e;};'use strict';var _=require('lodash');var util=require(_0xf862('0x0'));var logger=require(_0xf862('0x1'))(_0xf862('0x2'));var moment=require(_0xf862('0x3'));var BPromise=require('bluebird');var rp=require(_0xf862('0x4'));var fs=require('fs');var path=require(_0xf862('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf862('0x6'));module[_0xf862('0x7')]=function(_0x6e84c9,_0x18e1f0){return _0x6e84c9['define'](_0xf862('0x8'),attributes,{'tableName':_0xf862('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x34ee=['exports','define','DashboardItem','dashboard_items','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment'];(function(_0x373279,_0x498af0){var _0x13e6a0=function(_0x25ae7d){while(--_0x25ae7d){_0x373279['push'](_0x373279['shift']());}};_0x13e6a0(++_0x498af0);}(_0x34ee,0x144));var _0xe34e=function(_0x1b9629,_0x5554b4){_0x1b9629=_0x1b9629-0x0;var _0x4ade3a=_0x34ee[_0x1b9629];return _0x4ade3a;};'use strict';var _=require(_0xe34e('0x0'));var util=require('util');var logger=require(_0xe34e('0x1'))('api');var moment=require(_0xe34e('0x2'));var BPromise=require('bluebird');var rp=require(_0xe34e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe34e('0x4'));var config=require(_0xe34e('0x5'));var attributes=require('./dashboardItem.attributes');module[_0xe34e('0x6')]=function(_0x14930d,_0x42aff0){return _0x14930d[_0xe34e('0x7')](_0xe34e('0x8'),attributes,{'tableName':_0xe34e('0x9'),'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 4b2ff34..ccb745d 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 _0x76be=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','then','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch'];(function(_0x3f263e,_0x399e91){var _0x1b7e07=function(_0x303ee3){while(--_0x303ee3){_0x3f263e['push'](_0x3f263e['shift']());}};_0x1b7e07(++_0x399e91);}(_0x76be,0xa0));var _0xe76b=function(_0x3c12d9,_0x137698){_0x3c12d9=_0x3c12d9-0x0;var _0x58e569=_0x76be[_0x3c12d9];return _0x58e569;};'use strict';var _=require(_0xe76b('0x0'));var util=require(_0xe76b('0x1'));var moment=require(_0xe76b('0x2'));var BPromise=require(_0xe76b('0x3'));var rs=require(_0xe76b('0x4'));var fs=require('fs');var Redis=require(_0xe76b('0x5'));var db=require(_0xe76b('0x6'))['db'];var utils=require(_0xe76b('0x7'));var logger=require(_0xe76b('0x8'))(_0xe76b('0x9'));var config=require(_0xe76b('0xa'));var jayson=require(_0xe76b('0xb'));var client=jayson[_0xe76b('0xc')][_0xe76b('0xd')]({'port':0x232a});config[_0xe76b('0xe')]=_[_0xe76b('0xf')](config[_0xe76b('0xe')],{'host':_0xe76b('0x10'),'port':0x18eb});var socket=require(_0xe76b('0x11'))(new Redis(config[_0xe76b('0xe')]));require(_0xe76b('0x12'))[_0xe76b('0x13')](socket);function respondWithRpcPromise(_0x301042,_0x4768f0,_0x147df8){return new BPromise(function(_0x325e22,_0x19740a){return client['request'](_0x301042,_0x147df8)[_0xe76b('0x14')](function(_0x9e4139){logger['info'](_0xe76b('0x15'),_0x4768f0,_0xe76b('0x16'));logger[_0xe76b('0x17')](_0xe76b('0x18'),_0x4768f0,_0xe76b('0x16'),JSON[_0xe76b('0x19')](_0x9e4139));if(_0x9e4139[_0xe76b('0x1a')]){if(_0x9e4139['error'][_0xe76b('0x1b')]===0x1f4){logger[_0xe76b('0x1a')](_0xe76b('0x15'),_0x4768f0,_0x9e4139['error'][_0xe76b('0x1c')]);return _0x19740a(_0x9e4139[_0xe76b('0x1a')][_0xe76b('0x1c')]);}logger['error'](_0xe76b('0x15'),_0x4768f0,_0x9e4139[_0xe76b('0x1a')][_0xe76b('0x1c')]);return _0x325e22(_0x9e4139[_0xe76b('0x1a')]['message']);}else{logger[_0xe76b('0x1d')](_0xe76b('0x15'),_0x4768f0,_0xe76b('0x16'));_0x325e22(_0x9e4139[_0xe76b('0x1e')][_0xe76b('0x1c')]);}})[_0xe76b('0x1f')](function(_0x1aa62e){logger[_0xe76b('0x1a')](_0xe76b('0x15'),_0x4768f0,_0x1aa62e);_0x19740a(_0x1aa62e);});});} \ No newline at end of file +var _0xe3d0=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','code','error','message','result','catch','lodash','util','moment','randomstring'];(function(_0x5e8606,_0x2617ff){var _0x4560d8=function(_0x503f44){while(--_0x503f44){_0x5e8606['push'](_0x5e8606['shift']());}};_0x4560d8(++_0x2617ff);}(_0xe3d0,0x175));var _0x0e3d=function(_0x576f37,_0x5d80b1){_0x576f37=_0x576f37-0x0;var _0x1f41b4=_0xe3d0[_0x576f37];return _0x1f41b4;};'use strict';var _=require(_0x0e3d('0x0'));var util=require(_0x0e3d('0x1'));var moment=require(_0x0e3d('0x2'));var BPromise=require('bluebird');var rs=require(_0x0e3d('0x3'));var fs=require('fs');var Redis=require(_0x0e3d('0x4'));var db=require(_0x0e3d('0x5'))['db'];var utils=require(_0x0e3d('0x6'));var logger=require(_0x0e3d('0x7'))('rpc');var config=require(_0x0e3d('0x8'));var jayson=require(_0x0e3d('0x9'));var client=jayson[_0x0e3d('0xa')][_0x0e3d('0xb')]({'port':0x232a});config[_0x0e3d('0xc')]=_[_0x0e3d('0xd')](config[_0x0e3d('0xc')],{'host':_0x0e3d('0xe'),'port':0x18eb});var socket=require(_0x0e3d('0xf'))(new Redis(config[_0x0e3d('0xc')]));require(_0x0e3d('0x10'))[_0x0e3d('0x11')](socket);function respondWithRpcPromise(_0x1a85cf,_0x220aab,_0x3e650d){return new BPromise(function(_0x5a8f29,_0x54d799){return client[_0x0e3d('0x12')](_0x1a85cf,_0x3e650d)[_0x0e3d('0x13')](function(_0x48224b){logger[_0x0e3d('0x14')](_0x0e3d('0x15'),_0x220aab,_0x0e3d('0x16'));logger[_0x0e3d('0x17')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x220aab,_0x0e3d('0x16'),JSON['stringify'](_0x48224b));if(_0x48224b['error']){if(_0x48224b['error'][_0x0e3d('0x18')]===0x1f4){logger[_0x0e3d('0x19')](_0x0e3d('0x15'),_0x220aab,_0x48224b[_0x0e3d('0x19')][_0x0e3d('0x1a')]);return _0x54d799(_0x48224b['error'][_0x0e3d('0x1a')]);}logger[_0x0e3d('0x19')]('DashboardItem,\x20%s,\x20%s',_0x220aab,_0x48224b['error'][_0x0e3d('0x1a')]);return _0x5a8f29(_0x48224b[_0x0e3d('0x19')][_0x0e3d('0x1a')]);}else{logger[_0x0e3d('0x14')](_0x0e3d('0x15'),_0x220aab,_0x0e3d('0x16'));_0x5a8f29(_0x48224b[_0x0e3d('0x1b')][_0x0e3d('0x1a')]);}})[_0x0e3d('0x1c')](function(_0x1f1a6d){logger[_0x0e3d('0x19')](_0x0e3d('0x15'),_0x220aab,_0x1f1a6d);_0x54d799(_0x1f1a6d);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 22d11e6..3c9a391 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 _0xedac=['remove','update','emit','removeListener','length','dashboardItem:','./dashboardItem.events','save'];(function(_0x5dbd50,_0x3d201f){var _0x5910ca=function(_0x41db17){while(--_0x41db17){_0x5dbd50['push'](_0x5dbd50['shift']());}};_0x5910ca(++_0x3d201f);}(_0xedac,0xb6));var _0xceda=function(_0x26a58d,_0x436276){_0x26a58d=_0x26a58d-0x0;var _0x2e2703=_0xedac[_0x26a58d];return _0x2e2703;};'use strict';var DashboardItemEvents=require(_0xceda('0x0'));var events=[_0xceda('0x1'),_0xceda('0x2'),_0xceda('0x3')];function createListener(_0x38ac40,_0x161eb2){return function(_0x106006){_0x161eb2[_0xceda('0x4')](_0x38ac40,_0x106006);};}function removeListener(_0x50cb6e,_0x403d6d){return function(){DashboardItemEvents[_0xceda('0x5')](_0x50cb6e,_0x403d6d);};}exports['register']=function(_0x35438d){for(var _0x245576=0x0,_0x36397b=events[_0xceda('0x6')];_0x245576<_0x36397b;_0x245576++){var _0x3adb5f=events[_0x245576];var _0xc50953=createListener(_0xceda('0x7')+_0x3adb5f,_0x35438d);DashboardItemEvents['on'](_0x3adb5f,_0xc50953);}}; \ No newline at end of file +var _0xb9d9=['dashboardItem:','./dashboardItem.events','save','update','emit','removeListener','register','length'];(function(_0x5cb8bd,_0x3d9988){var _0x5111c5=function(_0x3f5b76){while(--_0x3f5b76){_0x5cb8bd['push'](_0x5cb8bd['shift']());}};_0x5111c5(++_0x3d9988);}(_0xb9d9,0x1c1));var _0x9b9d=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xb9d9[_0x1facfa];return _0x9ec701;};'use strict';var DashboardItemEvents=require(_0x9b9d('0x0'));var events=[_0x9b9d('0x1'),'remove',_0x9b9d('0x2')];function createListener(_0x281cdb,_0x44f9ea){return function(_0xc7d24b){_0x44f9ea[_0x9b9d('0x3')](_0x281cdb,_0xc7d24b);};}function removeListener(_0x109458,_0x1dd353){return function(){DashboardItemEvents[_0x9b9d('0x4')](_0x109458,_0x1dd353);};}exports[_0x9b9d('0x5')]=function(_0x4b9bb2){for(var _0x512618=0x0,_0x2453ba=events[_0x9b9d('0x6')];_0x512618<_0x2453ba;_0x512618++){var _0x37e70b=events[_0x512618];var _0x553588=createListener(_0x9b9d('0x7')+_0x37e70b,_0x4b9bb2);DashboardItemEvents['on'](_0x37e70b,_0x553588);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 3d9f6ed..deca196 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 _0xd9bc=['get','/:id','isAuthenticated','show','post','create','put','update','delete','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./dashboardItem.controller'];(function(_0x55960f,_0x5f2689){var _0x4fadd9=function(_0x3c0703){while(--_0x3c0703){_0x55960f['push'](_0x55960f['shift']());}};_0x4fadd9(++_0x5f2689);}(_0xd9bc,0x75));var _0xcd9b=function(_0x10bfc6,_0x1e36dd){_0x10bfc6=_0x10bfc6-0x0;var _0x53c52e=_0xd9bc[_0x10bfc6];return _0x53c52e;};'use strict';var multer=require(_0xcd9b('0x0'));var util=require('util');var path=require(_0xcd9b('0x1'));var timeout=require(_0xcd9b('0x2'));var express=require(_0xcd9b('0x3'));var router=express[_0xcd9b('0x4')]();var fs_extra=require(_0xcd9b('0x5'));var auth=require(_0xcd9b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xcd9b('0x7'));var controller=require(_0xcd9b('0x8'));router[_0xcd9b('0x9')](_0xcd9b('0xa'),auth[_0xcd9b('0xb')](),controller[_0xcd9b('0xc')]);router[_0xcd9b('0xd')]('/',auth[_0xcd9b('0xb')](),controller[_0xcd9b('0xe')]);router[_0xcd9b('0xf')](_0xcd9b('0xa'),auth[_0xcd9b('0xb')](),controller[_0xcd9b('0x10')]);router[_0xcd9b('0x11')](_0xcd9b('0xa'),auth[_0xcd9b('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x3139=['exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./dashboardItem.controller','get','isAuthenticated','show','create','put','/:id','delete'];(function(_0x43b9a9,_0x457a50){var _0x5808d8=function(_0x104298){while(--_0x104298){_0x43b9a9['push'](_0x43b9a9['shift']());}};_0x5808d8(++_0x457a50);}(_0x3139,0x78));var _0x9313=function(_0x5bc529,_0x261e60){_0x5bc529=_0x5bc529-0x0;var _0x4b2d49=_0x3139[_0x5bc529];return _0x4b2d49;};'use strict';var multer=require(_0x9313('0x0'));var util=require(_0x9313('0x1'));var path=require(_0x9313('0x2'));var timeout=require('connect-timeout');var express=require(_0x9313('0x3'));var router=express[_0x9313('0x4')]();var fs_extra=require(_0x9313('0x5'));var auth=require(_0x9313('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9313('0x7'));var controller=require(_0x9313('0x8'));router[_0x9313('0x9')]('/:id',auth[_0x9313('0xa')](),controller[_0x9313('0xb')]);router['post']('/',auth[_0x9313('0xa')](),controller[_0x9313('0xc')]);router[_0x9313('0xd')](_0x9313('0xe'),auth[_0x9313('0xa')](),controller['update']);router[_0x9313('0xf')](_0x9313('0xe'),auth[_0x9313('0xa')](),controller['destroy']);module[_0x9313('0x10')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 77e77b7..fd9714d 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 _0x6bd2=['second','third','sequelize','exports','STRING','first'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0x6bd2,0xda));var _0x26bd=function(_0xd63ab7,_0xb5bb72){_0xd63ab7=_0xd63ab7-0x0;var _0x1bad90=_0x6bd2[_0xd63ab7];return _0x1bad90;};'use strict';var Sequelize=require(_0x26bd('0x0'));module[_0x26bd('0x1')]={'name':{'type':Sequelize[_0x26bd('0x2')],'allowNull':![]},'level':{'type':Sequelize['ENUM'](_0x26bd('0x3'),_0x26bd('0x4'),_0x26bd('0x5')),'allowNull':![],'defaultValue':_0x26bd('0x3')},'description':{'type':Sequelize[_0x26bd('0x2')]}}; \ No newline at end of file +var _0xc1ca=['ENUM','first','third','exports','STRING'];(function(_0xf2628e,_0x521bf7){var _0x13863a=function(_0x2b04ab){while(--_0x2b04ab){_0xf2628e['push'](_0xf2628e['shift']());}};_0x13863a(++_0x521bf7);}(_0xc1ca,0xfd));var _0xac1c=function(_0x102d30,_0x4067d7){_0x102d30=_0x102d30-0x0;var _0x110bd7=_0xc1ca[_0x102d30];return _0x110bd7;};'use strict';var Sequelize=require('sequelize');module[_0xac1c('0x0')]={'name':{'type':Sequelize[_0xac1c('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0xac1c('0x2')](_0xac1c('0x3'),'second',_0xac1c('0x4')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0xac1c('0x1')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 80d9d47..3448a5e 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 _0xd983=['send','index','map','Disposition','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','order','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','includeAll','create','user','role','UserProfileSection','find','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','end','status','json','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','error','stack','name'];(function(_0x1bcce9,_0x1b953e){var _0x4b2cbb=function(_0x3ed9ca){while(--_0x3ed9ca){_0x1bcce9['push'](_0x1bcce9['shift']());}};_0x4b2cbb(++_0x1b953e);}(_0xd983,0x7d));var _0x3d98=function(_0x198622,_0x5a611a){_0x198622=_0x198622-0x0;var _0x5a524d=_0xd983[_0x198622];return _0x5a524d;};'use strict';var emlformat=require(_0x3d98('0x0'));var rimraf=require(_0x3d98('0x1'));var zipdir=require(_0x3d98('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3d98('0x3'));var moment=require(_0x3d98('0x4'));var BPromise=require(_0x3d98('0x5'));var Mustache=require(_0x3d98('0x6'));var util=require(_0x3d98('0x7'));var path=require(_0x3d98('0x8'));var sox=require(_0x3d98('0x9'));var csv=require(_0x3d98('0xa'));var ejs=require(_0x3d98('0xb'));var fs=require('fs');var fs_extra=require(_0x3d98('0xc'));var _=require(_0x3d98('0xd'));var squel=require(_0x3d98('0xe'));var crypto=require(_0x3d98('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x3d98('0x10'));var toCsv=require(_0x3d98('0xa'));var querystring=require('querystring');var Papa=require(_0x3d98('0x11'));var Redis=require(_0x3d98('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x3d98('0x13'));var as=require(_0x3d98('0x14'));var hardwareService=require(_0x3d98('0x15'));var logger=require(_0x3d98('0x16'))(_0x3d98('0x17'));var utils=require(_0x3d98('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x3d98('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xf4f3da,_0x4209ea){_0x4209ea=_0x4209ea||0xcc;return function(_0x930427){if(_0x930427){return _0xf4f3da[_0x3d98('0x1a')](_0x4209ea);}return _0xf4f3da['status'](_0x4209ea)[_0x3d98('0x1b')]();};}function respondWithResult(_0x478da8,_0xc92387){_0xc92387=_0xc92387||0xc8;return function(_0x5bc61f){if(_0x5bc61f){return _0x478da8[_0x3d98('0x1c')](_0xc92387)[_0x3d98('0x1d')](_0x5bc61f);}};}function respondWithFilteredResult(_0x626f0b,_0xd9bea7){return function(_0x34241d){if(_0x34241d){var _0x18d737=typeof _0xd9bea7['offset']===_0x3d98('0x1e')&&typeof _0xd9bea7[_0x3d98('0x1f')]===_0x3d98('0x1e');var _0x4dfb91=_0x34241d[_0x3d98('0x20')];var _0x100ad0=_0x18d737?0x0:_0xd9bea7['offset'];var _0x5e8a24=_0x18d737?_0x34241d[_0x3d98('0x20')]:_0xd9bea7['offset']+_0xd9bea7[_0x3d98('0x1f')];var _0x3147af;if(_0x5e8a24>=_0x4dfb91){_0x5e8a24=_0x4dfb91;_0x3147af=0xc8;}else{_0x3147af=0xce;}_0x626f0b[_0x3d98('0x1c')](_0x3147af);return _0x626f0b[_0x3d98('0x21')](_0x3d98('0x22'),_0x100ad0+'-'+_0x5e8a24+'/'+_0x4dfb91)['json'](_0x34241d);}return null;};}function patchUpdates(_0x332701){return function(_0x32d9a6){try{jsonpatch[_0x3d98('0x23')](_0x32d9a6,_0x332701,!![]);}catch(_0x57b4ca){return BPromise[_0x3d98('0x24')](_0x57b4ca);}return _0x32d9a6['save']();};}function saveUpdates(_0x163b4d,_0x1953d1){return function(_0x5e33b2){if(_0x5e33b2){return _0x5e33b2[_0x3d98('0x25')](_0x163b4d)[_0x3d98('0x26')](function(_0x4e3540){return _0x4e3540;});}return null;};}function removeEntity(_0x84fc59,_0xa8f877){return function(_0x4aad7b){if(_0x4aad7b){return _0x4aad7b[_0x3d98('0x27')]()['then'](function(){var _0x324690=_0x4aad7b[_0x3d98('0x28')]({'plain':!![]});var _0x20d22f='Dispositions';return db[_0x3d98('0x29')][_0x3d98('0x27')]({'where':{'type':_0x20d22f,'resourceId':_0x324690['id']}})[_0x3d98('0x26')](function(){return _0x4aad7b;});})[_0x3d98('0x26')](function(){_0x84fc59[_0x3d98('0x1c')](0xcc)[_0x3d98('0x1b')]();});}};}function handleEntityNotFound(_0x5d77b4,_0x306400){return function(_0x3dc524){if(!_0x3dc524){_0x5d77b4[_0x3d98('0x1a')](0x194);}return _0x3dc524;};}function handleError(_0x32ac39,_0x20ee0a){_0x20ee0a=_0x20ee0a||0x1f4;return function(_0x40ba72){logger[_0x3d98('0x2a')](_0x40ba72[_0x3d98('0x2b')]);if(_0x40ba72[_0x3d98('0x2c')]){delete _0x40ba72[_0x3d98('0x2c')];}_0x32ac39[_0x3d98('0x1c')](_0x20ee0a)[_0x3d98('0x2d')](_0x40ba72);};}exports[_0x3d98('0x2e')]=function(_0x1831ee,_0x5f3969){var _0x1a50e8={},_0x5f1a17={},_0x3b2666={'count':0x0,'rows':[]};var _0xc16247=_[_0x3d98('0x2f')](db[_0x3d98('0x30')][_0x3d98('0x31')],function(_0x381101){return{'name':_0x381101[_0x3d98('0x32')],'type':_0x381101[_0x3d98('0x33')][_0x3d98('0x34')]};});_0x5f1a17[_0x3d98('0x35')]=_[_0x3d98('0x2f')](_0xc16247,_0x3d98('0x2c'));_0x5f1a17[_0x3d98('0x36')]=_[_0x3d98('0x37')](_0x1831ee['query']);_0x5f1a17[_0x3d98('0x38')]=_['intersection'](_0x5f1a17[_0x3d98('0x35')],_0x5f1a17[_0x3d98('0x36')]);_0x1a50e8[_0x3d98('0x39')]=_[_0x3d98('0x3a')](_0x5f1a17[_0x3d98('0x35')],qs[_0x3d98('0x3b')](_0x1831ee[_0x3d98('0x36')]['fields']));_0x1a50e8[_0x3d98('0x39')]=_0x1a50e8[_0x3d98('0x39')][_0x3d98('0x3c')]?_0x1a50e8['attributes']:_0x5f1a17[_0x3d98('0x35')];if(!_0x1831ee[_0x3d98('0x36')][_0x3d98('0x3d')](_0x3d98('0x3e'))){_0x1a50e8[_0x3d98('0x1f')]=qs[_0x3d98('0x1f')](_0x1831ee[_0x3d98('0x36')][_0x3d98('0x1f')]);_0x1a50e8[_0x3d98('0x3f')]=qs['offset'](_0x1831ee['query'][_0x3d98('0x3f')]);}_0x1a50e8[_0x3d98('0x40')]=qs['sort'](_0x1831ee[_0x3d98('0x36')]['sort']);_0x1a50e8[_0x3d98('0x41')]=qs[_0x3d98('0x38')](_[_0x3d98('0x42')](_0x1831ee['query'],_0x5f1a17[_0x3d98('0x38')]),_0xc16247);if(_0x1831ee['query'][_0x3d98('0x43')]){_0x1a50e8['where']=_[_0x3d98('0x44')](_0x1a50e8[_0x3d98('0x41')],{'$or':_['map'](_0xc16247,function(_0x51a44c){if(_0x51a44c[_0x3d98('0x33')]!==_0x3d98('0x45')){var _0x428ce0={};_0x428ce0[_0x51a44c[_0x3d98('0x2c')]]={'$like':'%'+_0x1831ee[_0x3d98('0x36')][_0x3d98('0x43')]+'%'};return _0x428ce0;}})});}_0x1a50e8=_[_0x3d98('0x44')]({},_0x1a50e8,_0x1831ee[_0x3d98('0x46')]);var _0x2ce389={'where':_0x1a50e8[_0x3d98('0x41')]};return db[_0x3d98('0x30')][_0x3d98('0x20')](_0x2ce389)['then'](function(_0x56da58){_0x3b2666['count']=_0x56da58;if(_0x1831ee['query']['includeAll']){_0x1a50e8[_0x3d98('0x47')]=[{'all':!![]}];}return db[_0x3d98('0x30')][_0x3d98('0x48')](_0x1a50e8);})['then'](function(_0x127b53){_0x3b2666[_0x3d98('0x49')]=_0x127b53;return _0x3b2666;})[_0x3d98('0x26')](respondWithFilteredResult(_0x5f3969,_0x1a50e8))['catch'](handleError(_0x5f3969,null));};exports[_0x3d98('0x4a')]=function(_0x2b377b,_0x53fdbb){var _0x5d8bed={'raw':!![],'where':{'id':_0x2b377b[_0x3d98('0x4b')]['id']}},_0x2428fc={};_0x2428fc[_0x3d98('0x35')]=_['keys'](db['Disposition'][_0x3d98('0x31')]);_0x2428fc[_0x3d98('0x36')]=_[_0x3d98('0x37')](_0x2b377b[_0x3d98('0x36')]);_0x2428fc[_0x3d98('0x38')]=_[_0x3d98('0x3a')](_0x2428fc[_0x3d98('0x35')],_0x2428fc[_0x3d98('0x36')]);_0x5d8bed[_0x3d98('0x39')]=_[_0x3d98('0x3a')](_0x2428fc[_0x3d98('0x35')],qs['fields'](_0x2b377b[_0x3d98('0x36')]['fields']));_0x5d8bed[_0x3d98('0x39')]=_0x5d8bed['attributes'][_0x3d98('0x3c')]?_0x5d8bed[_0x3d98('0x39')]:_0x2428fc['model'];if(_0x2b377b[_0x3d98('0x36')][_0x3d98('0x4c')]){_0x5d8bed[_0x3d98('0x47')]=[{'all':!![]}];}_0x5d8bed=_[_0x3d98('0x44')]({},_0x5d8bed,_0x2b377b[_0x3d98('0x46')]);return db[_0x3d98('0x30')]['find'](_0x5d8bed)[_0x3d98('0x26')](handleEntityNotFound(_0x53fdbb,null))[_0x3d98('0x26')](respondWithResult(_0x53fdbb,null))['catch'](handleError(_0x53fdbb,null));};exports[_0x3d98('0x4d')]=function(_0x59e851,_0x4be629){return db[_0x3d98('0x30')][_0x3d98('0x4d')](_0x59e851['body'],{})[_0x3d98('0x26')](function(_0x121cef){var _0x6d4e71=_0x59e851[_0x3d98('0x4e')][_0x3d98('0x28')]({'plain':!![]});if(!_0x6d4e71)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x6d4e71[_0x3d98('0x4f')]===_0x3d98('0x4e')){var _0x174745=_0x121cef[_0x3d98('0x28')]({'plain':!![]});var _0x1a3711='Dispositions';return db[_0x3d98('0x50')][_0x3d98('0x51')]({'where':{'name':_0x1a3711,'userProfileId':_0x6d4e71['userProfileId']},'raw':!![]})[_0x3d98('0x26')](function(_0x22c1a9){if(_0x22c1a9&&_0x22c1a9['autoAssociation']===0x0){return db[_0x3d98('0x29')][_0x3d98('0x4d')]({'name':_0x174745[_0x3d98('0x2c')],'resourceId':_0x174745['id'],'type':_0x22c1a9[_0x3d98('0x2c')],'sectionId':_0x22c1a9['id']},{})[_0x3d98('0x26')](function(){return _0x121cef;});}else{return _0x121cef;}})[_0x3d98('0x52')](function(_0x30f9f6){logger[_0x3d98('0x2a')](_0x3d98('0x53'),_0x30f9f6);throw _0x30f9f6;});}return _0x121cef;})[_0x3d98('0x26')](respondWithResult(_0x4be629,0xc9))[_0x3d98('0x52')](handleError(_0x4be629,null));};exports[_0x3d98('0x25')]=function(_0x30082b,_0x12dae4){if(_0x30082b['body']['id']){delete _0x30082b[_0x3d98('0x54')]['id'];}return db[_0x3d98('0x30')][_0x3d98('0x51')]({'where':{'id':_0x30082b[_0x3d98('0x4b')]['id']}})[_0x3d98('0x26')](handleEntityNotFound(_0x12dae4,null))[_0x3d98('0x26')](saveUpdates(_0x30082b[_0x3d98('0x54')],null))['then'](respondWithResult(_0x12dae4,null))[_0x3d98('0x52')](handleError(_0x12dae4,null));};exports['destroy']=function(_0x1ab69e,_0x1c0735){return db[_0x3d98('0x30')][_0x3d98('0x51')]({'where':{'id':_0x1ab69e['params']['id']}})['then'](handleEntityNotFound(_0x1c0735,null))[_0x3d98('0x26')](removeEntity(_0x1c0735,null))[_0x3d98('0x52')](handleError(_0x1c0735,null));}; \ No newline at end of file +var _0xe225=['send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','Disposition','includeAll','include','findAll','rows','catch','merge','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','rimraf','zip-dir','bluebird','util','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get','Dispositions','stack','name'];(function(_0x20de0e,_0xef1cd6){var _0x159bbc=function(_0x5b8850){while(--_0x5b8850){_0x20de0e['push'](_0x20de0e['shift']());}};_0x159bbc(++_0xef1cd6);}(_0xe225,0x1bd));var _0x5e22=function(_0x573a31,_0x4a76f9){_0x573a31=_0x573a31-0x0;var _0x274b73=_0xe225[_0x573a31];return _0x274b73;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5e22('0x0'));var zipdir=require(_0x5e22('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5e22('0x2'));var Mustache=require('mustache');var util=require(_0x5e22('0x3'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5e22('0x4'));var fs=require('fs');var fs_extra=require(_0x5e22('0x5'));var _=require(_0x5e22('0x6'));var squel=require(_0x5e22('0x7'));var crypto=require(_0x5e22('0x8'));var jsforce=require(_0x5e22('0x9'));var deskjs=require(_0x5e22('0xa'));var toCsv=require(_0x5e22('0xb'));var querystring=require(_0x5e22('0xc'));var Papa=require(_0x5e22('0xd'));var Redis=require(_0x5e22('0xe'));var authService=require(_0x5e22('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x5e22('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5e22('0x11'))(_0x5e22('0x12'));var utils=require(_0x5e22('0x13'));var config=require(_0x5e22('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x5e22('0x15'))['db'];function respondWithStatusCode(_0x5e8b51,_0x3f96be){_0x3f96be=_0x3f96be||0xcc;return function(_0x3dd24c){if(_0x3dd24c){return _0x5e8b51[_0x5e22('0x16')](_0x3f96be);}return _0x5e8b51[_0x5e22('0x17')](_0x3f96be)[_0x5e22('0x18')]();};}function respondWithResult(_0x598d29,_0x1eb276){_0x1eb276=_0x1eb276||0xc8;return function(_0x4795ae){if(_0x4795ae){return _0x598d29[_0x5e22('0x17')](_0x1eb276)[_0x5e22('0x19')](_0x4795ae);}};}function respondWithFilteredResult(_0x1e9eff,_0xbae23a){return function(_0x34de3d){if(_0x34de3d){var _0x32bce1=typeof _0xbae23a[_0x5e22('0x1a')]===_0x5e22('0x1b')&&typeof _0xbae23a[_0x5e22('0x1c')]===_0x5e22('0x1b');var _0x1c4b6c=_0x34de3d['count'];var _0x545723=_0x32bce1?0x0:_0xbae23a[_0x5e22('0x1a')];var _0x48c441=_0x32bce1?_0x34de3d[_0x5e22('0x1d')]:_0xbae23a[_0x5e22('0x1a')]+_0xbae23a[_0x5e22('0x1c')];var _0xe3ed1e;if(_0x48c441>=_0x1c4b6c){_0x48c441=_0x1c4b6c;_0xe3ed1e=0xc8;}else{_0xe3ed1e=0xce;}_0x1e9eff[_0x5e22('0x17')](_0xe3ed1e);return _0x1e9eff[_0x5e22('0x1e')](_0x5e22('0x1f'),_0x545723+'-'+_0x48c441+'/'+_0x1c4b6c)[_0x5e22('0x19')](_0x34de3d);}return null;};}function patchUpdates(_0x280988){return function(_0x26509c){try{jsonpatch['apply'](_0x26509c,_0x280988,!![]);}catch(_0x193a42){return BPromise[_0x5e22('0x20')](_0x193a42);}return _0x26509c[_0x5e22('0x21')]();};}function saveUpdates(_0x303f19,_0x1b5d41){return function(_0x310978){if(_0x310978){return _0x310978[_0x5e22('0x22')](_0x303f19)[_0x5e22('0x23')](function(_0x29f733){return _0x29f733;});}return null;};}function removeEntity(_0x495a17,_0x2a5411){return function(_0x5d0a07){if(_0x5d0a07){return _0x5d0a07[_0x5e22('0x24')]()[_0x5e22('0x23')](function(){var _0x290e23=_0x5d0a07[_0x5e22('0x25')]({'plain':!![]});var _0x1f0b7d=_0x5e22('0x26');return db['UserProfileResource'][_0x5e22('0x24')]({'where':{'type':_0x1f0b7d,'resourceId':_0x290e23['id']}})[_0x5e22('0x23')](function(){return _0x5d0a07;});})[_0x5e22('0x23')](function(){_0x495a17[_0x5e22('0x17')](0xcc)[_0x5e22('0x18')]();});}};}function handleEntityNotFound(_0x3ba9db,_0x218692){return function(_0x5b0c00){if(!_0x5b0c00){_0x3ba9db['sendStatus'](0x194);}return _0x5b0c00;};}function handleError(_0x3d52d0,_0xe36dc7){_0xe36dc7=_0xe36dc7||0x1f4;return function(_0x3c0561){logger['error'](_0x3c0561[_0x5e22('0x27')]);if(_0x3c0561['name']){delete _0x3c0561[_0x5e22('0x28')];}_0x3d52d0[_0x5e22('0x17')](_0xe36dc7)[_0x5e22('0x29')](_0x3c0561);};}exports['index']=function(_0x3227b4,_0x537574){var _0x5981be={},_0x490597={},_0x226fc2={'count':0x0,'rows':[]};var _0x36ab38=_[_0x5e22('0x2a')](db['Disposition'][_0x5e22('0x2b')],function(_0x223e9a){return{'name':_0x223e9a[_0x5e22('0x2c')],'type':_0x223e9a[_0x5e22('0x2d')][_0x5e22('0x2e')]};});_0x490597[_0x5e22('0x2f')]=_[_0x5e22('0x2a')](_0x36ab38,'name');_0x490597[_0x5e22('0x30')]=_[_0x5e22('0x31')](_0x3227b4[_0x5e22('0x30')]);_0x490597[_0x5e22('0x32')]=_[_0x5e22('0x33')](_0x490597[_0x5e22('0x2f')],_0x490597[_0x5e22('0x30')]);_0x5981be[_0x5e22('0x34')]=_[_0x5e22('0x33')](_0x490597['model'],qs[_0x5e22('0x35')](_0x3227b4[_0x5e22('0x30')][_0x5e22('0x35')]));_0x5981be[_0x5e22('0x34')]=_0x5981be[_0x5e22('0x34')][_0x5e22('0x36')]?_0x5981be[_0x5e22('0x34')]:_0x490597[_0x5e22('0x2f')];if(!_0x3227b4[_0x5e22('0x30')]['hasOwnProperty'](_0x5e22('0x37'))){_0x5981be[_0x5e22('0x1c')]=qs[_0x5e22('0x1c')](_0x3227b4['query'][_0x5e22('0x1c')]);_0x5981be[_0x5e22('0x1a')]=qs['offset'](_0x3227b4['query'][_0x5e22('0x1a')]);}_0x5981be[_0x5e22('0x38')]=qs[_0x5e22('0x39')](_0x3227b4[_0x5e22('0x30')][_0x5e22('0x39')]);_0x5981be[_0x5e22('0x3a')]=qs['filters'](_['pick'](_0x3227b4['query'],_0x490597[_0x5e22('0x32')]),_0x36ab38);if(_0x3227b4['query'][_0x5e22('0x3b')]){_0x5981be[_0x5e22('0x3a')]=_['merge'](_0x5981be[_0x5e22('0x3a')],{'$or':_['map'](_0x36ab38,function(_0x11176c){if(_0x11176c[_0x5e22('0x2d')]!=='VIRTUAL'){var _0x352f77={};_0x352f77[_0x11176c[_0x5e22('0x28')]]={'$like':'%'+_0x3227b4[_0x5e22('0x30')][_0x5e22('0x3b')]+'%'};return _0x352f77;}})});}_0x5981be=_['merge']({},_0x5981be,_0x3227b4['options']);var _0xd20728={'where':_0x5981be[_0x5e22('0x3a')]};return db[_0x5e22('0x3c')]['count'](_0xd20728)[_0x5e22('0x23')](function(_0x4feb13){_0x226fc2['count']=_0x4feb13;if(_0x3227b4['query'][_0x5e22('0x3d')]){_0x5981be[_0x5e22('0x3e')]=[{'all':!![]}];}return db[_0x5e22('0x3c')][_0x5e22('0x3f')](_0x5981be);})['then'](function(_0x59c399){_0x226fc2[_0x5e22('0x40')]=_0x59c399;return _0x226fc2;})[_0x5e22('0x23')](respondWithFilteredResult(_0x537574,_0x5981be))[_0x5e22('0x41')](handleError(_0x537574,null));};exports['show']=function(_0x1d36af,_0x37fedf){var _0x463770={'raw':!![],'where':{'id':_0x1d36af['params']['id']}},_0x75a4c9={};_0x75a4c9[_0x5e22('0x2f')]=_[_0x5e22('0x31')](db['Disposition']['rawAttributes']);_0x75a4c9[_0x5e22('0x30')]=_['keys'](_0x1d36af[_0x5e22('0x30')]);_0x75a4c9['filters']=_[_0x5e22('0x33')](_0x75a4c9[_0x5e22('0x2f')],_0x75a4c9[_0x5e22('0x30')]);_0x463770['attributes']=_[_0x5e22('0x33')](_0x75a4c9['model'],qs[_0x5e22('0x35')](_0x1d36af[_0x5e22('0x30')]['fields']));_0x463770['attributes']=_0x463770[_0x5e22('0x34')][_0x5e22('0x36')]?_0x463770[_0x5e22('0x34')]:_0x75a4c9['model'];if(_0x1d36af[_0x5e22('0x30')][_0x5e22('0x3d')]){_0x463770[_0x5e22('0x3e')]=[{'all':!![]}];}_0x463770=_[_0x5e22('0x42')]({},_0x463770,_0x1d36af[_0x5e22('0x43')]);return db[_0x5e22('0x3c')][_0x5e22('0x44')](_0x463770)['then'](handleEntityNotFound(_0x37fedf,null))[_0x5e22('0x23')](respondWithResult(_0x37fedf,null))[_0x5e22('0x41')](handleError(_0x37fedf,null));};exports['create']=function(_0x3cb7de,_0x5e7a90){return db[_0x5e22('0x3c')][_0x5e22('0x45')](_0x3cb7de['body'],{})[_0x5e22('0x23')](function(_0xee3f88){var _0x1fd024=_0x3cb7de[_0x5e22('0x46')][_0x5e22('0x25')]({'plain':!![]});if(!_0x1fd024)throw new Error(_0x5e22('0x47'));if(_0x1fd024[_0x5e22('0x48')]===_0x5e22('0x46')){var _0xe75dc=_0xee3f88[_0x5e22('0x25')]({'plain':!![]});var _0x57b3fa=_0x5e22('0x26');return db[_0x5e22('0x49')][_0x5e22('0x44')]({'where':{'name':_0x57b3fa,'userProfileId':_0x1fd024[_0x5e22('0x4a')]},'raw':!![]})[_0x5e22('0x23')](function(_0x5bfdf9){if(_0x5bfdf9&&_0x5bfdf9[_0x5e22('0x4b')]===0x0){return db[_0x5e22('0x4c')]['create']({'name':_0xe75dc['name'],'resourceId':_0xe75dc['id'],'type':_0x5bfdf9[_0x5e22('0x28')],'sectionId':_0x5bfdf9['id']},{})[_0x5e22('0x23')](function(){return _0xee3f88;});}else{return _0xee3f88;}})[_0x5e22('0x41')](function(_0x4d10d0){logger[_0x5e22('0x4d')](_0x5e22('0x4e'),_0x4d10d0);throw _0x4d10d0;});}return _0xee3f88;})[_0x5e22('0x23')](respondWithResult(_0x5e7a90,0xc9))[_0x5e22('0x41')](handleError(_0x5e7a90,null));};exports[_0x5e22('0x22')]=function(_0xa6cec9,_0x53794d){if(_0xa6cec9[_0x5e22('0x4f')]['id']){delete _0xa6cec9[_0x5e22('0x4f')]['id'];}return db['Disposition']['find']({'where':{'id':_0xa6cec9[_0x5e22('0x50')]['id']}})[_0x5e22('0x23')](handleEntityNotFound(_0x53794d,null))[_0x5e22('0x23')](saveUpdates(_0xa6cec9[_0x5e22('0x4f')],null))['then'](respondWithResult(_0x53794d,null))[_0x5e22('0x41')](handleError(_0x53794d,null));};exports['destroy']=function(_0x36fc00,_0x1dcd91){return db[_0x5e22('0x3c')]['find']({'where':{'id':_0x36fc00[_0x5e22('0x50')]['id']}})['then'](handleEntityNotFound(_0x1dcd91,null))['then'](removeEntity(_0x1dcd91,null))[_0x5e22('0x41')](handleError(_0x1dcd91,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 811d7ae..f3df9d6 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 _0xc7c2=['name_whatsapp','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./disposition.attributes','define','Disposition','tools_dispositions','name_voice','name','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel'];(function(_0x462bff,_0x151a16){var _0x27229a=function(_0x223b61){while(--_0x223b61){_0x462bff['push'](_0x462bff['shift']());}};_0x27229a(++_0x151a16);}(_0xc7c2,0x1b1));var _0x2c7c=function(_0x4021fa,_0x3e7714){_0x4021fa=_0x4021fa-0x0;var _0x57cb67=_0xc7c2[_0x4021fa];return _0x57cb67;};'use strict';var _=require(_0x2c7c('0x0'));var util=require(_0x2c7c('0x1'));var logger=require(_0x2c7c('0x2'))('api');var moment=require(_0x2c7c('0x3'));var BPromise=require(_0x2c7c('0x4'));var rp=require(_0x2c7c('0x5'));var fs=require('fs');var path=require(_0x2c7c('0x6'));var rimraf=require('rimraf');var config=require(_0x2c7c('0x7'));var attributes=require(_0x2c7c('0x8'));module['exports']=function(_0x4944c0,_0x73cb78){return _0x4944c0[_0x2c7c('0x9')](_0x2c7c('0xa'),attributes,{'tableName':_0x2c7c('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x2c7c('0xc'),'fields':[_0x2c7c('0xd'),'ListId']},{'unique':!![],'name':_0x2c7c('0xe'),'fields':[_0x2c7c('0xd'),_0x2c7c('0xf')]},{'unique':!![],'name':_0x2c7c('0x10'),'fields':[_0x2c7c('0xd'),_0x2c7c('0x11')]},{'unique':!![],'name':_0x2c7c('0x12'),'fields':[_0x2c7c('0xd'),_0x2c7c('0x13')]},{'unique':!![],'name':_0x2c7c('0x14'),'fields':['name',_0x2c7c('0x15')]},{'unique':!![],'name':_0x2c7c('0x16'),'fields':[_0x2c7c('0xd'),'OpenchannelAccountId']},{'unique':!![],'name':_0x2c7c('0x17'),'fields':['name','WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x998a=['Disposition','tools_dispositions','name_voice','name','ListId','ChatWebsiteId','name_mail','MailAccountId','name_sms','name_fax','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','util','api','moment','bluebird','request-promise','path','../../config/environment','./disposition.attributes','define'];(function(_0x1093fd,_0x15d51a){var _0x4490df=function(_0x35e742){while(--_0x35e742){_0x1093fd['push'](_0x1093fd['shift']());}};_0x4490df(++_0x15d51a);}(_0x998a,0xd3));var _0xa998=function(_0x436168,_0x49b287){_0x436168=_0x436168-0x0;var _0x37e9f3=_0x998a[_0x436168];return _0x37e9f3;};'use strict';var _=require('lodash');var util=require(_0xa998('0x0'));var logger=require('../../config/logger')(_0xa998('0x1'));var moment=require(_0xa998('0x2'));var BPromise=require(_0xa998('0x3'));var rp=require(_0xa998('0x4'));var fs=require('fs');var path=require(_0xa998('0x5'));var rimraf=require('rimraf');var config=require(_0xa998('0x6'));var attributes=require(_0xa998('0x7'));module['exports']=function(_0x34c0d4,_0x28064a){return _0x34c0d4[_0xa998('0x8')](_0xa998('0x9'),attributes,{'tableName':_0xa998('0xa'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xa998('0xb'),'fields':[_0xa998('0xc'),_0xa998('0xd')]},{'unique':!![],'name':'name_chat','fields':[_0xa998('0xc'),_0xa998('0xe')]},{'unique':!![],'name':_0xa998('0xf'),'fields':[_0xa998('0xc'),_0xa998('0x10')]},{'unique':!![],'name':_0xa998('0x11'),'fields':['name','SmsAccountId']},{'unique':!![],'name':_0xa998('0x12'),'fields':[_0xa998('0xc'),'FaxAccountId']},{'unique':!![],'name':'name_openchannel','fields':[_0xa998('0xc'),_0xa998('0x13')]},{'unique':!![],'name':_0xa998('0x14'),'fields':[_0xa998('0xc'),_0xa998('0x15')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 552ae68..9ce1a95 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(_0x315e48,_0x380644){var _0x204969=function(_0x38c1ed){while(--_0x38c1ed){_0x315e48['push'](_0x315e48['shift']());}};_0x204969(++_0x380644);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xa9e0[_0x1b828b];return _0x98da1a;};'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(_0x309a0d,_0x3820fb){var _0x48df6c=function(_0x119416){while(--_0x119416){_0x309a0d['push'](_0x309a0d['shift']());}};_0x48df6c(++_0x3820fb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'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 1fe0fa8..b34e708 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 _0x9491=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/:id','show','post','create','put','destroy','exports'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x9491,0x90));var _0x1949=function(_0x3cecd4,_0x34dbf8){_0x3cecd4=_0x3cecd4-0x0;var _0xca19c=_0x9491[_0x3cecd4];return _0xca19c;};'use strict';var multer=require('multer');var util=require(_0x1949('0x0'));var path=require(_0x1949('0x1'));var timeout=require(_0x1949('0x2'));var express=require(_0x1949('0x3'));var router=express[_0x1949('0x4')]();var fs_extra=require(_0x1949('0x5'));var auth=require(_0x1949('0x6'));var interaction=require(_0x1949('0x7'));var config=require('../../config/environment');var controller=require('./disposition.controller');router['get']('/',auth[_0x1949('0x8')](),controller[_0x1949('0x9')]);router[_0x1949('0xa')](_0x1949('0xb'),auth[_0x1949('0x8')](),controller[_0x1949('0xc')]);router[_0x1949('0xd')]('/',auth['isAuthenticated'](),controller[_0x1949('0xe')]);router[_0x1949('0xf')](_0x1949('0xb'),auth[_0x1949('0x8')](),controller['update']);router['delete'](_0x1949('0xb'),auth[_0x1949('0x8')](),controller[_0x1949('0x10')]);module[_0x1949('0x11')]=router; \ No newline at end of file +var _0x4f1d=['../../config/environment','isAuthenticated','index','get','show','post','create','put','/:id','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x4f1d,0x70));var _0xd4f1=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x4f1d[_0x1cc8fe];return _0x230054;};'use strict';var multer=require(_0xd4f1('0x0'));var util=require(_0xd4f1('0x1'));var path=require('path');var timeout=require(_0xd4f1('0x2'));var express=require(_0xd4f1('0x3'));var router=express[_0xd4f1('0x4')]();var fs_extra=require(_0xd4f1('0x5'));var auth=require(_0xd4f1('0x6'));var interaction=require(_0xd4f1('0x7'));var config=require(_0xd4f1('0x8'));var controller=require('./disposition.controller');router['get']('/',auth[_0xd4f1('0x9')](),controller[_0xd4f1('0xa')]);router[_0xd4f1('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xd4f1('0xc')]);router[_0xd4f1('0xd')]('/',auth['isAuthenticated'](),controller[_0xd4f1('0xe')]);router[_0xd4f1('0xf')](_0xd4f1('0x10'),auth['isAuthenticated'](),controller['update']);router[_0xd4f1('0x11')](_0xd4f1('0x10'),auth[_0xd4f1('0x9')](),controller[_0xd4f1('0x12')]);module[_0xd4f1('0x13')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index aaa9f87..37fc2b5 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 _0xea89=['BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','2400','7200','9600','14400','4800','SIP','IAX','DADHI','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x15c421,_0x6366f7){var _0x5e5ed5=function(_0x206e66){while(--_0x206e66){_0x15c421['push'](_0x15c421['shift']());}};_0x5e5ed5(++_0x6366f7);}(_0xea89,0xf6));var _0x9ea8=function(_0x2cd6f5,_0x48e394){_0x2cd6f5=_0x2cd6f5-0x0;var _0x486641=_0xea89[_0x2cd6f5];return _0x486641;};'use strict';var Sequelize=require(_0x9ea8('0x0'));module['exports']={'name':{'type':Sequelize[_0x9ea8('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize[_0x9ea8('0x2')](_0x9ea8('0x3'),'no'),'defaultValue':_0x9ea8('0x3')},'headerinfo':{'type':Sequelize[_0x9ea8('0x1')],'defaultValue':_0x9ea8('0x4')},'localstationid':{'type':Sequelize[_0x9ea8('0x1')],'unique':'localstationid'},'minrate':{'type':Sequelize[_0x9ea8('0x2')](_0x9ea8('0x5'),'4800',_0x9ea8('0x6'),_0x9ea8('0x7'),'12000',_0x9ea8('0x8')),'defaultValue':_0x9ea8('0x9')},'maxrate':{'type':Sequelize[_0x9ea8('0x2')](_0x9ea8('0x5'),_0x9ea8('0x9'),_0x9ea8('0x6'),_0x9ea8('0x7'),'12000',_0x9ea8('0x8')),'defaultValue':'14400'},'modem':{'type':Sequelize[_0x9ea8('0x1')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x9ea8('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x9ea8('0x2')](_0x9ea8('0xa'),_0x9ea8('0xb'),_0x9ea8('0xc'),'KHOMP'),'defaultValue':_0x9ea8('0xa')},'key':{'type':Sequelize[_0x9ea8('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x9ea8('0xd');}},'notificationSound':{'type':Sequelize[_0x9ea8('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x9ea8('0xe')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x9ea8('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x9ea8('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9ea8('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x9ea8('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x9ea8('0x10')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x9ea8('0x11'),'set':function(_0x22b4e5){if(!_0x22b4e5)this[_0x9ea8('0x12')](_0x9ea8('0x13'),null);this[_0x9ea8('0x12')]('mandatoryDisposition',_0x22b4e5);}}}; \ No newline at end of file +var _0x45a0=['BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','sequelize','exports','STRING','xCALLY\x20Motion\x20Fax','4800','7200','9600','12000','14400','ENUM','v17,v27,v29','SIP','IAX','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x48db8c,_0x4a1555){var _0x232929=function(_0x29e11c){while(--_0x29e11c){_0x48db8c['push'](_0x48db8c['shift']());}};_0x232929(++_0x4a1555);}(_0x45a0,0x1e8));var _0x045a=function(_0xe02e2d,_0x301fb2){_0xe02e2d=_0xe02e2d-0x0;var _0x14f0ee=_0x45a0[_0xe02e2d];return _0x14f0ee;};'use strict';var Sequelize=require(_0x045a('0x0'));module[_0x045a('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x045a('0x2')]},'ecm':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0x045a('0x2')],'defaultValue':_0x045a('0x3')},'localstationid':{'type':Sequelize[_0x045a('0x2')],'unique':'localstationid'},'minrate':{'type':Sequelize['ENUM']('2400',_0x045a('0x4'),_0x045a('0x5'),_0x045a('0x6'),_0x045a('0x7'),_0x045a('0x8')),'defaultValue':_0x045a('0x4')},'maxrate':{'type':Sequelize[_0x045a('0x9')]('2400',_0x045a('0x4'),_0x045a('0x5'),_0x045a('0x6'),_0x045a('0x7'),_0x045a('0x8')),'defaultValue':_0x045a('0x8')},'modem':{'type':Sequelize[_0x045a('0x2')],'defaultValue':_0x045a('0xa')},'gateway':{'type':Sequelize[_0x045a('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x045a('0x9')](_0x045a('0xb'),_0x045a('0xc'),'DADHI',_0x045a('0xd')),'defaultValue':_0x045a('0xb')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x045a('0xe')],'defaultValue':function(){return _0x045a('0xf');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x045a('0x10')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x045a('0x10')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x045a('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x045a('0x11')],'allowNull':!![],'defaultValue':null,'comment':_0x045a('0x12')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x68771a){if(!_0x68771a)this[_0x045a('0x13')](_0x045a('0x14'),null);this[_0x045a('0x13')]('mandatoryDisposition',_0x68771a);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index a552c11..451d9db 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 _0xac46=['../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','request','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','UserProfileResource','destroy','stack','name','send','Pause','mandatoryDispositionPause','FaxAccount','rawAttributes','fieldName','type','key','map','query','keys','model','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters','filter','VIRTUAL','merge','includeAll','include','findAll','rows','show','params','intersection','length','options','create','body','user','role','get','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','order','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','addInteraction','omit','getInteractions','FaxInteraction','CmContact','User','Owner','fullname','internal','Tag','Tags','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','getApplications','context','from-voip-provider','exten','localstationid','app','system','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','ecm','gateway','headerinfo','maxrate','minrate','modem','t38timeout','FAXOPT(','Set','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','bulkCreate','updateAccountApplications','VoiceExtension','tech','updatedAt','TrunkId','findById','getMessages','FaxMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','List','DESC','attachments','server/files/attachments','basename','CheckAfterSend','isNil','from','format','\x22%s\x22\x20<%s>','fax','Contacts','List\x20not\x20found','out','Messages','Contact\x20not\x20found','filename','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','spread','emit','userFaxAccount:save','removeAgents','userFaxAccount:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','fs-extra','lodash','squel','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x29e7fa,_0x231b9c){var _0x93b500=function(_0x23d559){while(--_0x23d559){_0x29e7fa['push'](_0x29e7fa['shift']());}};_0x93b500(++_0x231b9c);}(_0xac46,0x179));var _0x6ac4=function(_0x3df978,_0x21e423){_0x3df978=_0x3df978-0x0;var _0x5225f0=_0xac46[_0x3df978];return _0x5225f0;};'use strict';var emlformat=require(_0x6ac4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6ac4('0x1'));var jsonpatch=require(_0x6ac4('0x2'));var rp=require(_0x6ac4('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6ac4('0x4'));var util=require(_0x6ac4('0x5'));var path=require(_0x6ac4('0x6'));var sox=require(_0x6ac4('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6ac4('0x8'));var _=require(_0x6ac4('0x9'));var squel=require(_0x6ac4('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6ac4('0xb'));var toCsv=require(_0x6ac4('0xc'));var querystring=require('querystring');var Papa=require(_0x6ac4('0xd'));var Redis=require(_0x6ac4('0xe'));var authService=require(_0x6ac4('0xf'));var qs=require(_0x6ac4('0x10'));var as=require(_0x6ac4('0x11'));var hardwareService=require(_0x6ac4('0x12'));var logger=require(_0x6ac4('0x13'))(_0x6ac4('0x14'));var utils=require(_0x6ac4('0x15'));var config=require(_0x6ac4('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x6ac4('0x17'))['db'];config[_0x6ac4('0x18')]=_[_0x6ac4('0x19')](config['redis'],{'host':_0x6ac4('0x1a'),'port':0x18eb});var socket=require(_0x6ac4('0x1b'))(new Redis(config[_0x6ac4('0x18')]));require(_0x6ac4('0x1c'))[_0x6ac4('0x1d')](socket);var jayson=require(_0x6ac4('0x1e'));var client=jayson[_0x6ac4('0x1f')][_0x6ac4('0x20')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x33447f,_0x152146,_0x3cacef,_0x56d5f0){return new BPromise(function(_0x3c5751,_0x53e30c){var _0x758781=_0x56d5f0||client;return _0x758781[_0x6ac4('0x21')](_0x33447f,_0x3cacef)['then'](function(_0x5cd266){logger['info'](_0x6ac4('0x22'),_0x152146,_0x6ac4('0x23'));logger[_0x6ac4('0x24')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x152146,_0x6ac4('0x23'),JSON[_0x6ac4('0x25')](_0x5cd266));if(_0x5cd266['error']){if(_0x5cd266[_0x6ac4('0x26')][_0x6ac4('0x27')]===0x1f4){logger[_0x6ac4('0x26')](_0x6ac4('0x22'),_0x152146,_0x5cd266[_0x6ac4('0x26')][_0x6ac4('0x28')]);return _0x53e30c(_0x5cd266['error'][_0x6ac4('0x28')]);}logger[_0x6ac4('0x26')](_0x6ac4('0x22'),_0x152146,_0x5cd266[_0x6ac4('0x26')][_0x6ac4('0x28')]);return _0x3c5751(_0x5cd266[_0x6ac4('0x26')][_0x6ac4('0x28')]);}else{logger[_0x6ac4('0x29')](_0x6ac4('0x22'),_0x152146,_0x6ac4('0x23'));_0x3c5751(_0x5cd266[_0x6ac4('0x2a')]['message']);}})[_0x6ac4('0x2b')](function(_0x225ab2){logger[_0x6ac4('0x26')](_0x6ac4('0x22'),_0x152146,_0x225ab2);_0x53e30c(_0x225ab2);});});}function respondWithStatusCode(_0x12ab9e,_0x6de98){_0x6de98=_0x6de98||0xcc;return function(_0x12ae41){if(_0x12ae41){return _0x12ab9e[_0x6ac4('0x2c')](_0x6de98);}return _0x12ab9e[_0x6ac4('0x2d')](_0x6de98)[_0x6ac4('0x2e')]();};}function respondWithResult(_0x41f7d6,_0x3908e1){_0x3908e1=_0x3908e1||0xc8;return function(_0x2c5167){if(_0x2c5167){return _0x41f7d6['status'](_0x3908e1)[_0x6ac4('0x2f')](_0x2c5167);}};}function respondWithFilteredResult(_0x5e88c9,_0x52bf7e){return function(_0x43e7be){if(_0x43e7be){var _0x292487=typeof _0x52bf7e[_0x6ac4('0x30')]===_0x6ac4('0x31')&&typeof _0x52bf7e[_0x6ac4('0x32')]==='undefined';var _0x27162c=_0x43e7be[_0x6ac4('0x33')];var _0x3d3b15=_0x292487?0x0:_0x52bf7e[_0x6ac4('0x30')];var _0x404adb=_0x292487?_0x43e7be[_0x6ac4('0x33')]:_0x52bf7e[_0x6ac4('0x30')]+_0x52bf7e['limit'];var _0x378ae5;if(_0x404adb>=_0x27162c){_0x404adb=_0x27162c;_0x378ae5=0xc8;}else{_0x378ae5=0xce;}_0x5e88c9[_0x6ac4('0x2d')](_0x378ae5);return _0x5e88c9[_0x6ac4('0x34')]('Content-Range',_0x3d3b15+'-'+_0x404adb+'/'+_0x27162c)[_0x6ac4('0x2f')](_0x43e7be);}return null;};}function patchUpdates(_0x3b9081){return function(_0xd93cc9){try{jsonpatch[_0x6ac4('0x35')](_0xd93cc9,_0x3b9081,!![]);}catch(_0x4737d9){return BPromise[_0x6ac4('0x36')](_0x4737d9);}return _0xd93cc9['save']();};}function saveUpdates(_0x3d5b48,_0x3e69a2){return function(_0x116cd3){if(_0x116cd3){return _0x116cd3[_0x6ac4('0x37')](_0x3d5b48)[_0x6ac4('0x38')](function(_0xdaacd){return _0xdaacd;});}return null;};}function removeEntity(_0x5bab9e,_0x4ddf3b){return function(_0x2af374){if(_0x2af374){return _0x2af374['destroy']()['then'](function(){var _0x23c638=_0x2af374['get']({'plain':!![]});var _0x200f76='FaxAccounts';return db[_0x6ac4('0x39')][_0x6ac4('0x3a')]({'where':{'type':_0x200f76,'resourceId':_0x23c638['id']}})[_0x6ac4('0x38')](function(){return _0x2af374;});})[_0x6ac4('0x38')](function(){_0x5bab9e[_0x6ac4('0x2d')](0xcc)[_0x6ac4('0x2e')]();});}};}function handleEntityNotFound(_0x37b4b3,_0x541812){return function(_0x3f2912){if(!_0x3f2912){_0x37b4b3[_0x6ac4('0x2c')](0x194);}return _0x3f2912;};}function handleError(_0xef396e,_0x1c0759){_0x1c0759=_0x1c0759||0x1f4;return function(_0x3f7d3b){logger[_0x6ac4('0x26')](_0x3f7d3b[_0x6ac4('0x3b')]);if(_0x3f7d3b[_0x6ac4('0x3c')]){delete _0x3f7d3b[_0x6ac4('0x3c')];}_0xef396e['status'](_0x1c0759)[_0x6ac4('0x3d')](_0x3f7d3b);};}exports['index']=function(_0x67b595,_0x2a8442){var _0x421ec7={'include':[{'model':db[_0x6ac4('0x3e')],'as':_0x6ac4('0x3f')}]},_0x52798e={},_0x333619={'count':0x0,'rows':[]};var _0x2d4bd2=_['map'](db[_0x6ac4('0x40')][_0x6ac4('0x41')],function(_0x234a95){return{'name':_0x234a95[_0x6ac4('0x42')],'type':_0x234a95[_0x6ac4('0x43')][_0x6ac4('0x44')]};});_0x52798e['model']=_[_0x6ac4('0x45')](_0x2d4bd2,_0x6ac4('0x3c'));_0x52798e[_0x6ac4('0x46')]=_[_0x6ac4('0x47')](_0x67b595[_0x6ac4('0x46')]);_0x52798e['filters']=_['intersection'](_0x52798e[_0x6ac4('0x48')],_0x52798e[_0x6ac4('0x46')]);_0x421ec7[_0x6ac4('0x49')]=_['intersection'](_0x52798e[_0x6ac4('0x48')],qs[_0x6ac4('0x4a')](_0x67b595[_0x6ac4('0x46')][_0x6ac4('0x4a')]));_0x421ec7[_0x6ac4('0x49')]=_0x421ec7['attributes']['length']?_0x421ec7[_0x6ac4('0x49')]:_0x52798e[_0x6ac4('0x48')];if(!_0x67b595['query'][_0x6ac4('0x4b')](_0x6ac4('0x4c'))){_0x421ec7[_0x6ac4('0x32')]=qs['limit'](_0x67b595[_0x6ac4('0x46')][_0x6ac4('0x32')]);_0x421ec7[_0x6ac4('0x30')]=qs[_0x6ac4('0x30')](_0x67b595[_0x6ac4('0x46')]['offset']);}_0x421ec7['order']=qs['sort'](_0x67b595[_0x6ac4('0x46')][_0x6ac4('0x4d')]);_0x421ec7[_0x6ac4('0x4e')]=qs['filters'](_[_0x6ac4('0x4f')](_0x67b595['query'],_0x52798e[_0x6ac4('0x50')]),_0x2d4bd2);if(_0x67b595[_0x6ac4('0x46')][_0x6ac4('0x51')]){_0x421ec7['where']=_['merge'](_0x421ec7[_0x6ac4('0x4e')],{'$or':_[_0x6ac4('0x45')](_0x2d4bd2,function(_0x53f195){if(_0x53f195['type']!==_0x6ac4('0x52')){var _0x297ce3={};_0x297ce3[_0x53f195[_0x6ac4('0x3c')]]={'$like':'%'+_0x67b595[_0x6ac4('0x46')][_0x6ac4('0x51')]+'%'};return _0x297ce3;}})});}_0x421ec7=_[_0x6ac4('0x53')]({},_0x421ec7,_0x67b595['options']);var _0x414dc5={'where':_0x421ec7['where']};return db[_0x6ac4('0x40')]['count'](_0x414dc5)[_0x6ac4('0x38')](function(_0x2d0bed){_0x333619[_0x6ac4('0x33')]=_0x2d0bed;if(_0x67b595[_0x6ac4('0x46')][_0x6ac4('0x54')]){_0x421ec7[_0x6ac4('0x55')]=[{'all':!![]}];}return db[_0x6ac4('0x40')][_0x6ac4('0x56')](_0x421ec7);})[_0x6ac4('0x38')](function(_0x24b39c){_0x333619[_0x6ac4('0x57')]=_0x24b39c;return _0x333619;})[_0x6ac4('0x38')](respondWithFilteredResult(_0x2a8442,_0x421ec7))[_0x6ac4('0x2b')](handleError(_0x2a8442,null));};exports[_0x6ac4('0x58')]=function(_0x46ffc9,_0x253ace){var _0x21d22d={'raw':![],'where':{'id':_0x46ffc9[_0x6ac4('0x59')]['id']},'include':[{'model':db['Pause'],'as':_0x6ac4('0x3f')}]},_0x513d43={};_0x513d43[_0x6ac4('0x48')]=_[_0x6ac4('0x47')](db[_0x6ac4('0x40')][_0x6ac4('0x41')]);_0x513d43[_0x6ac4('0x46')]=_[_0x6ac4('0x47')](_0x46ffc9[_0x6ac4('0x46')]);_0x513d43[_0x6ac4('0x50')]=_[_0x6ac4('0x5a')](_0x513d43[_0x6ac4('0x48')],_0x513d43['query']);_0x21d22d[_0x6ac4('0x49')]=_[_0x6ac4('0x5a')](_0x513d43[_0x6ac4('0x48')],qs[_0x6ac4('0x4a')](_0x46ffc9[_0x6ac4('0x46')][_0x6ac4('0x4a')]));_0x21d22d[_0x6ac4('0x49')]=_0x21d22d[_0x6ac4('0x49')][_0x6ac4('0x5b')]?_0x21d22d['attributes']:_0x513d43[_0x6ac4('0x48')];if(_0x46ffc9[_0x6ac4('0x46')]['includeAll']){_0x21d22d[_0x6ac4('0x55')]=[{'all':!![]}];}_0x21d22d=_[_0x6ac4('0x53')]({},_0x21d22d,_0x46ffc9[_0x6ac4('0x5c')]);return db['FaxAccount']['find'](_0x21d22d)[_0x6ac4('0x38')](handleEntityNotFound(_0x253ace,null))[_0x6ac4('0x38')](respondWithResult(_0x253ace,null))[_0x6ac4('0x2b')](handleError(_0x253ace,null));};exports[_0x6ac4('0x5d')]=function(_0x3c3f52,_0x482ff6){return db[_0x6ac4('0x40')]['create'](_0x3c3f52[_0x6ac4('0x5e')],{})[_0x6ac4('0x38')](function(_0x7dd6c3){var _0x5392d5=_0x3c3f52[_0x6ac4('0x5f')]['get']({'plain':!![]});if(!_0x5392d5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5392d5[_0x6ac4('0x60')]===_0x6ac4('0x5f')){var _0x9d36e8=_0x7dd6c3[_0x6ac4('0x61')]({'plain':!![]});var _0x3b4f1a='FaxAccounts';return db[_0x6ac4('0x62')][_0x6ac4('0x63')]({'where':{'name':_0x3b4f1a,'userProfileId':_0x5392d5[_0x6ac4('0x64')]},'raw':!![]})['then'](function(_0x19b3ab){if(_0x19b3ab&&_0x19b3ab['autoAssociation']===0x0){return db[_0x6ac4('0x39')][_0x6ac4('0x5d')]({'name':_0x9d36e8[_0x6ac4('0x3c')],'resourceId':_0x9d36e8['id'],'type':_0x19b3ab['name'],'sectionId':_0x19b3ab['id']},{})[_0x6ac4('0x38')](function(){return _0x7dd6c3;});}else{return _0x7dd6c3;}})[_0x6ac4('0x2b')](function(_0x2228d5){logger[_0x6ac4('0x26')](_0x6ac4('0x65'),_0x2228d5);throw _0x2228d5;});}return _0x7dd6c3;})[_0x6ac4('0x38')](respondWithResult(_0x482ff6,0xc9))['catch'](handleError(_0x482ff6,null));};exports[_0x6ac4('0x37')]=function(_0xe65b7f,_0x4f3dc9){if(_0xe65b7f[_0x6ac4('0x5e')]['id']){delete _0xe65b7f[_0x6ac4('0x5e')]['id'];}return db[_0x6ac4('0x40')][_0x6ac4('0x63')]({'where':{'id':_0xe65b7f['params']['id']},'include':[{'model':db[_0x6ac4('0x3e')],'as':_0x6ac4('0x3f')}]})[_0x6ac4('0x38')](handleEntityNotFound(_0x4f3dc9,null))['then'](saveUpdates(_0xe65b7f['body'],null))[_0x6ac4('0x38')](respondWithResult(_0x4f3dc9,null))[_0x6ac4('0x2b')](handleError(_0x4f3dc9,null));};exports['destroy']=function(_0x4374e7,_0x32ee53){return db[_0x6ac4('0x40')][_0x6ac4('0x63')]({'where':{'id':_0x4374e7[_0x6ac4('0x59')]['id']}})[_0x6ac4('0x38')](handleEntityNotFound(_0x32ee53,null))[_0x6ac4('0x38')](removeEntity(_0x32ee53,null))['catch'](handleError(_0x32ee53,null));};exports['describe']=function(_0x2a275e,_0x329b0f){return db[_0x6ac4('0x40')][_0x6ac4('0x66')]()['then'](respondWithResult(_0x329b0f,null))['catch'](handleError(_0x329b0f,null));};exports[_0x6ac4('0x67')]=function(_0x3edb68,_0x3f69d2,_0x21a276){if(_0x3edb68[_0x6ac4('0x5e')]['id']){delete _0x3edb68[_0x6ac4('0x5e')]['id'];}return db['FaxAccount']['find']({'where':{'id':_0x3edb68['params']['id']}})[_0x6ac4('0x38')](handleEntityNotFound(_0x3f69d2,null))[_0x6ac4('0x38')](function(_0x202b82){if(_0x202b82){_0x3edb68['body'][_0x6ac4('0x68')]=_0x202b82['id'];return db[_0x6ac4('0x69')][_0x6ac4('0x5d')](_0x3edb68[_0x6ac4('0x5e')]);}})[_0x6ac4('0x38')](respondWithResult(_0x3f69d2,null))[_0x6ac4('0x2b')](handleError(_0x3f69d2,null));};exports[_0x6ac4('0x6a')]=function(_0x53ec27,_0x53d504,_0x4c765e){var _0x4b1e6d={'raw':![],'where':{}};var _0x42ce14={};var _0x5d1162={'count':0x0,'rows':[]};return db[_0x6ac4('0x40')][_0x6ac4('0x6b')]({'where':{'id':_0x53ec27[_0x6ac4('0x59')]['id']}})[_0x6ac4('0x38')](handleEntityNotFound(_0x53d504,null))['then'](function(_0x26262d){if(_0x26262d){_0x42ce14[_0x6ac4('0x48')]=_[_0x6ac4('0x47')](db[_0x6ac4('0x69')]['rawAttributes']);_0x42ce14[_0x6ac4('0x46')]=_['keys'](_0x53ec27[_0x6ac4('0x46')]);_0x42ce14[_0x6ac4('0x50')]=_[_0x6ac4('0x5a')](_0x42ce14[_0x6ac4('0x48')],_0x42ce14[_0x6ac4('0x46')]);_0x4b1e6d[_0x6ac4('0x49')]=_[_0x6ac4('0x5a')](_0x42ce14[_0x6ac4('0x48')],qs[_0x6ac4('0x4a')](_0x53ec27['query'][_0x6ac4('0x4a')]));_0x4b1e6d['attributes']=_0x4b1e6d['attributes']['length']?_0x4b1e6d[_0x6ac4('0x49')]:_0x42ce14[_0x6ac4('0x48')];if(!_0x53ec27[_0x6ac4('0x46')][_0x6ac4('0x4b')](_0x6ac4('0x4c'))){_0x4b1e6d[_0x6ac4('0x32')]=qs[_0x6ac4('0x32')](_0x53ec27['query']['limit']);_0x4b1e6d[_0x6ac4('0x30')]=qs['offset'](_0x53ec27[_0x6ac4('0x46')][_0x6ac4('0x30')]);}_0x4b1e6d[_0x6ac4('0x6c')]=qs[_0x6ac4('0x4d')](_0x53ec27['query'][_0x6ac4('0x4d')]);_0x4b1e6d['where']=qs[_0x6ac4('0x50')](_['pick'](_0x53ec27[_0x6ac4('0x46')],_0x42ce14['filters']));_0x4b1e6d[_0x6ac4('0x4e')][_0x6ac4('0x68')]=_0x26262d['id'];if(_0x53ec27['query'][_0x6ac4('0x51')]){_0x4b1e6d[_0x6ac4('0x4e')]=_[_0x6ac4('0x53')](_0x4b1e6d[_0x6ac4('0x4e')],{'$or':_[_0x6ac4('0x45')](_0x4b1e6d[_0x6ac4('0x49')],function(_0x39cf84){var _0x5458bb={};_0x5458bb[_0x39cf84]={'$like':'%'+_0x53ec27['query']['filter']+'%'};return _0x5458bb;})});}_0x4b1e6d=_['merge']({},_0x4b1e6d,_0x53ec27['options']);return db[_0x6ac4('0x69')][_0x6ac4('0x33')]({'where':_0x4b1e6d[_0x6ac4('0x4e')]})[_0x6ac4('0x38')](function(_0x38e587){_0x5d1162[_0x6ac4('0x33')]=_0x38e587;if(_0x53ec27[_0x6ac4('0x46')]['includeAll']){_0x4b1e6d[_0x6ac4('0x55')]=[{'all':!![]}];}return db[_0x6ac4('0x69')]['findAll'](_0x4b1e6d);})[_0x6ac4('0x38')](function(_0x1b5636){_0x5d1162[_0x6ac4('0x57')]=_0x1b5636;return _0x5d1162;});}})['then'](respondWithFilteredResult(_0x53d504,_0x4b1e6d))['catch'](handleError(_0x53d504,null));};exports['removeDispositions']=function(_0x3eeb27,_0x139f10,_0x1d4d86){return db[_0x6ac4('0x40')][_0x6ac4('0x63')]({'where':{'id':_0x3eeb27[_0x6ac4('0x59')]['id']}})[_0x6ac4('0x38')](handleEntityNotFound(_0x139f10,null))[_0x6ac4('0x38')](function(_0x59bd43){if(_0x59bd43){return _0x59bd43[_0x6ac4('0x6d')](_0x3eeb27[_0x6ac4('0x46')][_0x6ac4('0x6e')]);}})[_0x6ac4('0x38')](respondWithStatusCode(_0x139f10,null))['catch'](handleError(_0x139f10,null));};exports[_0x6ac4('0x6f')]=function(_0x2c4521,_0x4b165e,_0xf4284b){if(_0x2c4521[_0x6ac4('0x5e')]['id']){delete _0x2c4521[_0x6ac4('0x5e')]['id'];}return db[_0x6ac4('0x40')]['find']({'where':{'id':_0x2c4521[_0x6ac4('0x59')]['id']}})[_0x6ac4('0x38')](handleEntityNotFound(_0x4b165e,null))['then'](function(_0x1d1acb){if(_0x1d1acb){_0x2c4521[_0x6ac4('0x5e')][_0x6ac4('0x68')]=_0x1d1acb['id'];return db['CannedAnswer'][_0x6ac4('0x5d')](_0x2c4521[_0x6ac4('0x5e')]);}})[_0x6ac4('0x38')](respondWithResult(_0x4b165e,null))[_0x6ac4('0x2b')](handleError(_0x4b165e,null));};exports[_0x6ac4('0x70')]=function(_0x4abc5a,_0x28332b,_0x1c6aeb){var _0x383c65={'raw':![],'where':{}};var _0x55b31f={};var _0x2cb125={'count':0x0,'rows':[]};return db['FaxAccount'][_0x6ac4('0x6b')]({'where':{'id':_0x4abc5a[_0x6ac4('0x59')]['id']}})[_0x6ac4('0x38')](handleEntityNotFound(_0x28332b,null))[_0x6ac4('0x38')](function(_0x28c89a){if(_0x28c89a){_0x55b31f['model']=_['keys'](db[_0x6ac4('0x71')][_0x6ac4('0x41')]);_0x55b31f[_0x6ac4('0x46')]=_[_0x6ac4('0x47')](_0x4abc5a['query']);_0x55b31f[_0x6ac4('0x50')]=_[_0x6ac4('0x5a')](_0x55b31f[_0x6ac4('0x48')],_0x55b31f[_0x6ac4('0x46')]);_0x383c65[_0x6ac4('0x49')]=_['intersection'](_0x55b31f[_0x6ac4('0x48')],qs['fields'](_0x4abc5a[_0x6ac4('0x46')][_0x6ac4('0x4a')]));_0x383c65['attributes']=_0x383c65[_0x6ac4('0x49')][_0x6ac4('0x5b')]?_0x383c65[_0x6ac4('0x49')]:_0x55b31f[_0x6ac4('0x48')];if(!_0x4abc5a[_0x6ac4('0x46')]['hasOwnProperty']('nolimit')){_0x383c65[_0x6ac4('0x32')]=qs[_0x6ac4('0x32')](_0x4abc5a[_0x6ac4('0x46')][_0x6ac4('0x32')]);_0x383c65[_0x6ac4('0x30')]=qs[_0x6ac4('0x30')](_0x4abc5a[_0x6ac4('0x46')][_0x6ac4('0x30')]);}_0x383c65[_0x6ac4('0x6c')]=qs[_0x6ac4('0x4d')](_0x4abc5a[_0x6ac4('0x46')]['sort']);_0x383c65['where']=qs[_0x6ac4('0x50')](_['pick'](_0x4abc5a['query'],_0x55b31f['filters']));_0x383c65[_0x6ac4('0x4e')][_0x6ac4('0x68')]=_0x28c89a['id'];if(_0x4abc5a['query'][_0x6ac4('0x51')]){_0x383c65[_0x6ac4('0x4e')]=_['merge'](_0x383c65['where'],{'$or':_[_0x6ac4('0x45')](_0x383c65[_0x6ac4('0x49')],function(_0x1fb56b){var _0x5f1fd1={};_0x5f1fd1[_0x1fb56b]={'$like':'%'+_0x4abc5a['query']['filter']+'%'};return _0x5f1fd1;})});}_0x383c65=_['merge']({},_0x383c65,_0x4abc5a['options']);return db['CannedAnswer'][_0x6ac4('0x33')]({'where':_0x383c65[_0x6ac4('0x4e')]})[_0x6ac4('0x38')](function(_0x43eae3){_0x2cb125[_0x6ac4('0x33')]=_0x43eae3;if(_0x4abc5a[_0x6ac4('0x46')][_0x6ac4('0x54')]){_0x383c65[_0x6ac4('0x55')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x383c65);})['then'](function(_0x421ba4){_0x2cb125['rows']=_0x421ba4;return _0x2cb125;});}})[_0x6ac4('0x38')](respondWithFilteredResult(_0x28332b,_0x383c65))[_0x6ac4('0x2b')](handleError(_0x28332b,null));};exports[_0x6ac4('0x72')]=function(_0x5b3733,_0x32f1f4,_0x4ec94a){return db[_0x6ac4('0x40')][_0x6ac4('0x63')]({'where':{'id':_0x5b3733[_0x6ac4('0x59')]['id']}})[_0x6ac4('0x38')](handleEntityNotFound(_0x32f1f4,null))[_0x6ac4('0x38')](function(_0x4ffe17){if(_0x4ffe17){return _0x4ffe17[_0x6ac4('0x72')](_0x5b3733[_0x6ac4('0x46')][_0x6ac4('0x6e')]);}})['then'](respondWithStatusCode(_0x32f1f4,null))[_0x6ac4('0x2b')](handleError(_0x32f1f4,null));};exports[_0x6ac4('0x73')]=function(_0x51686c,_0x816186,_0x36a6e2){return db['FaxInteraction'][_0x6ac4('0x63')]({'where':{'id':_0x51686c['params']['id']}})[_0x6ac4('0x38')](handleEntityNotFound(_0x816186,null))[_0x6ac4('0x38')](function(_0x3a6b4c){if(_0x3a6b4c){return _0x3a6b4c[_0x6ac4('0x73')](_0x51686c[_0x6ac4('0x5e')][_0x6ac4('0x6e')],_[_0x6ac4('0x74')](_0x51686c[_0x6ac4('0x5e')],[_0x6ac4('0x6e'),'id'])||{});}})[_0x6ac4('0x38')](respondWithResult(_0x816186,null))['catch'](handleError(_0x816186,null));};exports[_0x6ac4('0x75')]=function(_0x4eb22c,_0x13cda7,_0x4b36a3){var _0x436834={'raw':![],'where':{}};var _0xc83aa1={};var _0x12bd14={'count':0x0,'rows':[]};return db[_0x6ac4('0x40')]['findOne']({'where':{'id':_0x4eb22c[_0x6ac4('0x59')]['id']}})[_0x6ac4('0x38')](handleEntityNotFound(_0x13cda7,null))['then'](function(_0x35ca3e){if(_0x35ca3e){_0xc83aa1[_0x6ac4('0x48')]=_[_0x6ac4('0x47')](db[_0x6ac4('0x76')]['rawAttributes']);_0xc83aa1[_0x6ac4('0x46')]=_['keys'](_0x4eb22c[_0x6ac4('0x46')]);_0xc83aa1[_0x6ac4('0x50')]=_['intersection'](_0xc83aa1[_0x6ac4('0x48')],_0xc83aa1['query']);_0x436834[_0x6ac4('0x49')]=_[_0x6ac4('0x5a')](_0xc83aa1[_0x6ac4('0x48')],qs[_0x6ac4('0x4a')](_0x4eb22c[_0x6ac4('0x46')][_0x6ac4('0x4a')]));_0x436834[_0x6ac4('0x49')]=_0x436834[_0x6ac4('0x49')]['length']?_0x436834[_0x6ac4('0x49')]:_0xc83aa1[_0x6ac4('0x48')];if(!_0x4eb22c[_0x6ac4('0x46')][_0x6ac4('0x4b')](_0x6ac4('0x4c'))){_0x436834[_0x6ac4('0x32')]=qs[_0x6ac4('0x32')](_0x4eb22c['query'][_0x6ac4('0x32')]);_0x436834['offset']=qs[_0x6ac4('0x30')](_0x4eb22c['query'][_0x6ac4('0x30')]);}_0x436834['order']=qs[_0x6ac4('0x4d')](_0x4eb22c[_0x6ac4('0x46')][_0x6ac4('0x4d')]);_0x436834[_0x6ac4('0x4e')]=qs[_0x6ac4('0x50')](_[_0x6ac4('0x4f')](_0x4eb22c[_0x6ac4('0x46')],_0xc83aa1[_0x6ac4('0x50')]));_0x436834[_0x6ac4('0x4e')]['FaxAccountId']=_0x35ca3e['id'];if(_0x4eb22c[_0x6ac4('0x46')][_0x6ac4('0x51')]){_0x436834['where']=_[_0x6ac4('0x53')](_0x436834['where'],{'$or':_[_0x6ac4('0x45')](_0x436834[_0x6ac4('0x49')],function(_0x429b13){var _0x38e94d={};_0x38e94d[_0x429b13]={'$like':'%'+_0x4eb22c[_0x6ac4('0x46')][_0x6ac4('0x51')]+'%'};return _0x38e94d;})});}_0x436834=_[_0x6ac4('0x53')]({},_0x436834,_0x4eb22c[_0x6ac4('0x5c')]);return db[_0x6ac4('0x76')][_0x6ac4('0x33')]({'where':_0x436834[_0x6ac4('0x4e')]})[_0x6ac4('0x38')](function(_0x563d11){_0x12bd14['count']=_0x563d11;if(_0x4eb22c[_0x6ac4('0x46')]['includeAll']){_0x436834[_0x6ac4('0x55')]=[{'model':db[_0x6ac4('0x77')],'as':'Contact','required':![]},{'model':db[_0x6ac4('0x78')],'as':_0x6ac4('0x79'),'attributes':['name',_0x6ac4('0x7a'),_0x6ac4('0x7b')],'required':![]},{'model':db[_0x6ac4('0x7c')],'as':_0x6ac4('0x7d'),'attributes':['id','name','color'],'where':_0x4eb22c['query'][_0x6ac4('0x7e')]?{'id':_0x4eb22c['query'][_0x6ac4('0x7e')]}:undefined,'required':_0x4eb22c['query'][_0x6ac4('0x7e')]?!![]:![]}];}return db[_0x6ac4('0x76')][_0x6ac4('0x56')](_0x436834);})['then'](function(_0x1a0365){_0x12bd14[_0x6ac4('0x57')]=_0x1a0365;return _0x12bd14;});}})['then'](respondWithFilteredResult(_0x13cda7,_0x436834))[_0x6ac4('0x2b')](handleError(_0x13cda7,null));};exports[_0x6ac4('0x7f')]=function(_0x32efbf,_0x2a68b1){var _0x4a29aa=_0x32efbf[_0x6ac4('0x59')]['id'];var _0x30768e=_0x32efbf[_0x6ac4('0x5e')];var _0x5d7a33=0xc8;var _0x144a3c=null;return db[_0x6ac4('0x80')][_0x6ac4('0x81')]({'isolationLevel':db[_0x6ac4('0x80')][_0x6ac4('0x82')][_0x6ac4('0x83')][_0x6ac4('0x84')]},function(_0x5281d6){return db[_0x6ac4('0x40')][_0x6ac4('0x6b')]({'where':{'id':_0x4a29aa},'transaction':_0x5281d6})[_0x6ac4('0x38')](function(_0x5dd1d4){if(_0x5dd1d4){return db['FaxApplication'][_0x6ac4('0x3a')]({'where':{'FaxAccountId':_0x4a29aa},'transaction':_0x5281d6})[_0x6ac4('0x38')](function(){var _0x103cf2=_['map'](_0x30768e,function(_0x26c09a){_0x26c09a[_0x6ac4('0x68')]=_0x4a29aa;return _0x26c09a;});return db['FaxApplication']['bulkCreate'](_0x103cf2,{'transaction':_0x5281d6});});}else{_0x5d7a33=0x194;_0x144a3c=[];}});})[_0x6ac4('0x38')](function(){if(_0x5d7a33!==0x194){return db[_0x6ac4('0x85')]['findAndCountAll']({'where':{'FaxAccountId':_0x4a29aa},'order':'priority'})[_0x6ac4('0x38')](function(_0x3aa8f5){_0x144a3c=_0x3aa8f5;});}})[_0x6ac4('0x2b')](function(_0x1ed4cb){_0x5d7a33=0x1f4;logger[_0x6ac4('0x26')](_0x1ed4cb[_0x6ac4('0x3b')]);if(_0x1ed4cb['name']){delete _0x1ed4cb[_0x6ac4('0x3c')];}_0x144a3c=_0x1ed4cb;})['finally'](function(){if(_0x144a3c===null){_0x2a68b1[_0x6ac4('0x2c')](_0x5d7a33);}else{if(_0x5d7a33===0x1f4){_0x2a68b1['status'](_0x5d7a33)[_0x6ac4('0x3d')](_0x144a3c);}else{_0x2a68b1[_0x6ac4('0x2d')](_0x5d7a33)['json'](_0x144a3c);}}});};exports[_0x6ac4('0x86')]=function(_0x4582ea,_0x4e81b4,_0x10cdb3){var _0x257322={};var _0x32c6ba={};var _0x28bca2;var _0x509aa3;return db[_0x6ac4('0x40')]['findOne']({'where':{'id':_0x4582ea[_0x6ac4('0x59')]['id']}})[_0x6ac4('0x38')](handleEntityNotFound(_0x4e81b4,null))[_0x6ac4('0x38')](function(_0x108c18){if(_0x108c18){_0x28bca2=_0x108c18;_0x32c6ba[_0x6ac4('0x48')]=_[_0x6ac4('0x47')](db[_0x6ac4('0x85')][_0x6ac4('0x41')]);_0x32c6ba['query']=_[_0x6ac4('0x47')](_0x4582ea['query']);_0x32c6ba['filters']=_['intersection'](_0x32c6ba[_0x6ac4('0x48')],_0x32c6ba[_0x6ac4('0x46')]);_0x257322[_0x6ac4('0x49')]=_[_0x6ac4('0x5a')](_0x32c6ba['model'],qs[_0x6ac4('0x4a')](_0x4582ea[_0x6ac4('0x46')]['fields']));_0x257322[_0x6ac4('0x49')]=_0x257322['attributes']['length']?_0x257322['attributes']:_0x32c6ba[_0x6ac4('0x48')];_0x257322[_0x6ac4('0x6c')]=qs['sort'](_0x4582ea[_0x6ac4('0x46')]['sort']);_0x257322[_0x6ac4('0x4e')]=qs[_0x6ac4('0x50')](_[_0x6ac4('0x4f')](_0x4582ea['query'],_0x32c6ba[_0x6ac4('0x50')]));if(_0x4582ea[_0x6ac4('0x46')][_0x6ac4('0x51')]){_0x257322['where']=_[_0x6ac4('0x53')](_0x257322[_0x6ac4('0x4e')],{'$or':_['map'](_0x257322[_0x6ac4('0x49')],function(_0x2f89b2){var _0x23082b={};_0x23082b[_0x2f89b2]={'$like':'%'+_0x4582ea[_0x6ac4('0x46')][_0x6ac4('0x51')]+'%'};return _0x23082b;})});}_0x257322=_['merge']({},_0x257322,_0x4582ea['options']);return _0x28bca2[_0x6ac4('0x86')](_0x257322);}})[_0x6ac4('0x38')](function(_0x2ff946){if(_0x2ff946){_0x509aa3=_0x2ff946[_0x6ac4('0x5b')];if(!_0x4582ea[_0x6ac4('0x46')][_0x6ac4('0x4b')](_0x6ac4('0x4c'))){_0x257322[_0x6ac4('0x32')]=qs[_0x6ac4('0x32')](_0x4582ea[_0x6ac4('0x46')][_0x6ac4('0x32')]);_0x257322['offset']=qs['offset'](_0x4582ea[_0x6ac4('0x46')][_0x6ac4('0x30')]);}return _0x28bca2[_0x6ac4('0x86')](_0x257322);}})[_0x6ac4('0x38')](function(_0x3db993){if(_0x3db993){return _0x3db993?{'count':_0x509aa3,'rows':_0x3db993}:null;}})[_0x6ac4('0x38')](respondWithResult(_0x4e81b4,null))[_0x6ac4('0x2b')](handleError(_0x4e81b4,null));};function Extension(_0x2ac6ae,_0x551070,_0x1a16f4,_0x2ec34a){this[_0x6ac4('0x87')]=_0x6ac4('0x88');this[_0x6ac4('0x89')]=_0x2ac6ae[_0x6ac4('0x8a')];this[_0x6ac4('0x8b')]=_0x2ec34a;this['type']=_0x6ac4('0x8c');this['description']=_0x6ac4('0x8d');this[_0x6ac4('0x68')]=_0x2ac6ae['id'];this['priority']=_0x551070;this[_0x6ac4('0x8e')]=_0x1a16f4;}function createExtensionsReciveFax(_0x42da47){var _0x1a2132=0x1;var _0x455ef4=[];_0x455ef4[_0x6ac4('0x8f')](new Extension(_0x42da47,_0x1a2132,'',_0x6ac4('0x90')));_0x1a2132+=0x1;_0x455ef4[_0x6ac4('0x8f')](new Extension(_0x42da47,_0x1a2132,_0x6ac4('0x91'),'Set'));_0x1a2132+=0x1;for(var _0x4a392c in _0x42da47){if(_0x42da47[_0x6ac4('0x4b')](_0x4a392c)&&(_0x4a392c===_0x6ac4('0x92')||_0x4a392c===_0x6ac4('0x8a')||_0x4a392c===_0x6ac4('0x93')||_0x4a392c==='faxdetect'||_0x4a392c===_0x6ac4('0x94')||_0x4a392c===_0x6ac4('0x95')||_0x4a392c===_0x6ac4('0x96')||_0x4a392c===_0x6ac4('0x97')||_0x4a392c===_0x6ac4('0x98'))){_0x455ef4[_0x6ac4('0x8f')](new Extension(_0x42da47,_0x1a2132,_0x6ac4('0x99')+_0x4a392c+')='+_0x42da47[_0x4a392c],_0x6ac4('0x9a')));_0x1a2132+=0x1;}}_0x455ef4[_0x6ac4('0x8f')](new Extension(_0x42da47,_0x1a2132,'6',_0x6ac4('0x9b')));_0x1a2132+=0x1;_0x455ef4[_0x6ac4('0x8f')](new Extension(_0x42da47,_0x1a2132,_0x6ac4('0x9c'),_0x6ac4('0x9d')));_0x1a2132=0x0;return _0x455ef4;}exports[_0x6ac4('0x9e')]=function(_0x2cb7ee,_0x594758,_0x4a03ac){var _0x1fa630;return db[_0x6ac4('0x80')][_0x6ac4('0x81')](function(_0x23c610){return db['FaxAccount'][_0x6ac4('0x5d')](_0x2cb7ee['body'],{'transaction':_0x23c610})['then'](function(_0x2a0b60){_0x1fa630=_0x2a0b60[_0x6ac4('0x61')]({'plain':!![]});return db['VoiceExtension'][_0x6ac4('0x9f')](createExtensionsReciveFax(_0x1fa630),{'transaction':_0x23c610});});})['then'](function(){return _0x1fa630;})[_0x6ac4('0x38')](respondWithResult(_0x594758,null))['catch'](handleError(_0x594758,null));};exports[_0x6ac4('0xa0')]=function(_0x4b8a05,_0x14e4ea,_0x40eb2e){var _0x4203b6;return db['sequelize'][_0x6ac4('0x81')](function(_0x38569e){return db['FaxAccount'][_0x6ac4('0x37')](_0x4b8a05[_0x6ac4('0x5e')],{'where':{'id':_0x4b8a05[_0x6ac4('0x5e')]['id']},'transaction':_0x38569e})[_0x6ac4('0x38')](function(_0x480f5d){return db[_0x6ac4('0xa1')][_0x6ac4('0x3a')]({'where':{'FaxAccountId':_0x4b8a05[_0x6ac4('0x5e')]['id']},'transaction':_0x38569e})[_0x6ac4('0x38')](function(_0x3ea974){return db[_0x6ac4('0xa1')][_0x6ac4('0x9f')](createExtensionsReciveFax(_[_0x6ac4('0x74')](_0x4b8a05[_0x6ac4('0x5e')],[_0x6ac4('0xa2'),'key','createdAt',_0x6ac4('0xa3'),_0x6ac4('0xa4'),'ListId'])),{'transaction':_0x38569e});});});})[_0x6ac4('0x38')](function(){return db['FaxAccount'][_0x6ac4('0xa5')](_0x4b8a05[_0x6ac4('0x5e')]['id']);})['then'](respondWithResult(_0x14e4ea,null))['catch'](handleError(_0x14e4ea,null));};exports[_0x6ac4('0xa6')]=function(_0x22a8ec,_0x35b27b,_0x57be6c){var _0x8d4f69={'raw':!![],'where':{}};var _0x50b014={};var _0x543750={'count':0x0,'rows':[]};return db['FaxAccount'][_0x6ac4('0x6b')]({'where':{'id':_0x22a8ec[_0x6ac4('0x59')]['id']}})[_0x6ac4('0x38')](handleEntityNotFound(_0x35b27b,null))[_0x6ac4('0x38')](function(_0x278142){if(_0x278142){_0x50b014['model']=_[_0x6ac4('0x47')](db[_0x6ac4('0xa7')][_0x6ac4('0x41')]);_0x50b014[_0x6ac4('0x46')]=_[_0x6ac4('0x47')](_0x22a8ec[_0x6ac4('0x46')]);_0x50b014[_0x6ac4('0x50')]=_[_0x6ac4('0x5a')](_0x50b014[_0x6ac4('0x48')],_0x50b014[_0x6ac4('0x46')]);_0x8d4f69['attributes']=_[_0x6ac4('0x5a')](_0x50b014[_0x6ac4('0x48')],qs[_0x6ac4('0x4a')](_0x22a8ec[_0x6ac4('0x46')][_0x6ac4('0x4a')]));_0x8d4f69[_0x6ac4('0x49')]=_0x8d4f69[_0x6ac4('0x49')][_0x6ac4('0x5b')]?_0x8d4f69[_0x6ac4('0x49')]:_0x50b014[_0x6ac4('0x48')];if(!_0x22a8ec['query'][_0x6ac4('0x4b')](_0x6ac4('0x4c'))){_0x8d4f69[_0x6ac4('0x32')]=qs[_0x6ac4('0x32')](_0x22a8ec[_0x6ac4('0x46')][_0x6ac4('0x32')]);_0x8d4f69[_0x6ac4('0x30')]=qs[_0x6ac4('0x30')](_0x22a8ec[_0x6ac4('0x46')][_0x6ac4('0x30')]);}_0x8d4f69['order']=qs[_0x6ac4('0x4d')](_0x22a8ec[_0x6ac4('0x46')][_0x6ac4('0x4d')]);_0x8d4f69[_0x6ac4('0x4e')]=qs[_0x6ac4('0x50')](_[_0x6ac4('0x4f')](_0x22a8ec[_0x6ac4('0x46')],_0x50b014['filters']));_0x8d4f69[_0x6ac4('0x4e')]['FaxAccountId']=_0x278142['id'];if(_0x22a8ec[_0x6ac4('0x46')][_0x6ac4('0x51')]){_0x8d4f69['where']=_[_0x6ac4('0x53')](_0x8d4f69[_0x6ac4('0x4e')],{'$or':_[_0x6ac4('0x45')](_0x8d4f69['attributes'],function(_0x5a2ecd){var _0x5dfe8a={};_0x5dfe8a[_0x5a2ecd]={'$like':'%'+_0x22a8ec['query']['filter']+'%'};return _0x5dfe8a;})});}if(_0x22a8ec[_0x6ac4('0x46')]['$gte']){var _0x5b6e7b=_0x22a8ec[_0x6ac4('0x46')][_0x6ac4('0xa8')][_0x6ac4('0xa9')](',');var _0x5cfdf1={};_0x5cfdf1[_0x5b6e7b[0x0]]={'$gte':moment(_0x5b6e7b[0x1])['format'](_0x6ac4('0xaa'))};_0x8d4f69[_0x6ac4('0x4e')]=_['merge'](_0x8d4f69['where'],_0x5cfdf1);}_0x8d4f69=_[_0x6ac4('0x53')]({},_0x8d4f69,_0x22a8ec[_0x6ac4('0x5c')]);return db[_0x6ac4('0xa7')][_0x6ac4('0x33')]({'where':_0x8d4f69['where']})[_0x6ac4('0x38')](function(_0x1e8033){_0x543750[_0x6ac4('0x33')]=_0x1e8033;if(_0x22a8ec['query'][_0x6ac4('0x54')]){_0x8d4f69[_0x6ac4('0x55')]=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x8d4f69);})[_0x6ac4('0x38')](function(_0x2d2a64){_0x543750[_0x6ac4('0x57')]=_0x2d2a64;return _0x543750;});}})[_0x6ac4('0x38')](respondWithFilteredResult(_0x35b27b,_0x8d4f69))['catch'](handleError(_0x35b27b,null));};exports[_0x6ac4('0x3d')]=function(_0x1f8349,_0x490511,_0x536f7a){var _0x11d403,_0x3dc544={},_0x53bfcf;if(_0x1f8349[_0x6ac4('0x5e')]['to']){_0x53bfcf=_0x1f8349['body']['to'][0x0];}return db[_0x6ac4('0x40')]['find']({'where':{'id':_0x1f8349[_0x6ac4('0x59')]['id']},'include':[{'model':db['CmList'],'as':_0x6ac4('0xab'),'include':[{'model':db[_0x6ac4('0x77')],'as':'Contacts','where':{'fax':_0x53bfcf},'limit':0x1,'order':[[_0x6ac4('0xa3'),_0x6ac4('0xac')]]}]}]})[_0x6ac4('0x38')](handleEntityNotFound(_0x490511,null))[_0x6ac4('0x38')](function(_0x476859){_0x11d403=_0x476859;if(_0x1f8349[_0x6ac4('0x5e')][_0x6ac4('0xad')]&&_0x1f8349[_0x6ac4('0x5e')][_0x6ac4('0xad')][_0x6ac4('0x5b')]){for(var _0x4f5780=0x0;_0x4f5780<_0x1f8349[_0x6ac4('0x5e')]['attachments'][_0x6ac4('0x5b')];_0x4f5780+=0x1){_0x1f8349[_0x6ac4('0x5e')]['attachments'][_0x4f5780]={'filename':_0x1f8349[_0x6ac4('0x5e')][_0x6ac4('0xad')][_0x4f5780][_0x6ac4('0x3c')],'id':_0x1f8349[_0x6ac4('0x5e')][_0x6ac4('0xad')][_0x4f5780]['id'],'path':path['join'](config['root'],_0x6ac4('0xae'),_0x1f8349[_0x6ac4('0x5e')]['attachments'][_0x4f5780][_0x6ac4('0xaf')])};}}return respondWithRpcPromise(_0x6ac4('0xb0'),'CheckAfterSend',{'FaxAccountId':_[_0x6ac4('0xb1')](_0x1f8349['params']['id'])?undefined:_0x1f8349[_0x6ac4('0x59')]['id'],'path':_[_0x6ac4('0xb1')](_0x1f8349[_0x6ac4('0x5e')][_0x6ac4('0xad')][0x0][_0x6ac4('0x6')])?undefined:_0x1f8349['body'][_0x6ac4('0xad')][0x0][_0x6ac4('0x6')],'fax':_[_0x6ac4('0xb1')](_0x1f8349[_0x6ac4('0x5e')]['to'][0x0])?undefined:_0x1f8349[_0x6ac4('0x5e')]['to'][0x0]},client9002);})[_0x6ac4('0x38')](function(){if(_0x11d403){if(_[_0x6ac4('0xb1')](_0x1f8349[_0x6ac4('0x5e')][_0x6ac4('0xb2')])){_0x1f8349[_0x6ac4('0x5e')]['from']=util[_0x6ac4('0xb3')](_0x6ac4('0xb4'),_0x11d403['name'],_0x11d403[_0x6ac4('0xb5')]);}if(_0x11d403[_0x6ac4('0xab')]){if(_0x11d403[_0x6ac4('0xab')][_0x6ac4('0xb6')][_0x6ac4('0x5b')]){return _0x11d403['List'][_0x6ac4('0xb6')][0x0];}else{return db[_0x6ac4('0x77')]['create'](_[_0x6ac4('0x19')](_0x1f8349['body'],{'firstName':_0x1f8349[_0x6ac4('0x5e')]['to'][0x0],'phone':_0x1f8349[_0x6ac4('0x5e')]['to'][0x0],'fax':_0x1f8349[_0x6ac4('0x5e')]['to'][0x0],'ListId':_0x11d403['ListId']}));}}else{throw new Error(_0x6ac4('0xb7'));}}else{throw new Error('Send\x20Fax\x20failed');}})['then'](function(_0x3bb880){if(_0x3bb880){return db[_0x6ac4('0x76')][_0x6ac4('0x63')]({'where':{'ContactId':_0x3bb880['id'],'closed':![],'FaxAccountId':_0x11d403['id']}})[_0x6ac4('0x38')](function(_0x58cdcc){if(_0x58cdcc){return[_0x58cdcc,![]];}return db[_0x6ac4('0x76')][_0x6ac4('0x5d')]({'UserId':_0x1f8349[_0x6ac4('0x5f')]['id'],'ContactId':_0x3bb880['id'],'FaxAccountId':_0x11d403['id'],'fax':_0x1f8349[_0x6ac4('0x5e')]['to'][0x0],'firstMsgDirection':_0x6ac4('0xb8'),'Messages':[_[_0x6ac4('0x53')](_0x1f8349[_0x6ac4('0x5e')],{'read':![],'body':_0x1f8349[_0x6ac4('0x5e')][_0x6ac4('0xad')][0x0]['filename'],'FaxAccountId':_0x11d403['id'],'UserId':_0x1f8349[_0x6ac4('0x5f')]['id'],'ContactId':_0x3bb880['id'],'AttachmentId':_0x1f8349[_0x6ac4('0x5e')][_0x6ac4('0xad')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0x6ac4('0xb9')}]})[_0x6ac4('0x38')](function(_0x4d67e5){return[_0x4d67e5,!![]];});});}else{throw new Error(_0x6ac4('0xba'));}})['spread'](function(_0x15f3d4,_0x6ad6d0){if(_0x6ad6d0){return _0x15f3d4;}return db['FaxMessage'][_0x6ac4('0x5d')]({'direction':_0x6ac4('0xb8'),'read':![],'body':_0x1f8349['body']['attachments'][0x0][_0x6ac4('0xbb')],'FaxAccountId':_0x11d403['id'],'FaxInteractionId':_0x15f3d4['id'],'UserId':_0x1f8349[_0x6ac4('0x5f')]['id'],'ContactId':_0x15f3d4['ContactId'],'AttachmentId':_0x1f8349[_0x6ac4('0x5e')]['attachments'][0x0]['id']})[_0x6ac4('0x38')](function(_0x1a3eef){_0x15f3d4[_0x6ac4('0xbc')][_0x6ac4('0xb9')]=[];_0x15f3d4[_0x6ac4('0xbc')][_0x6ac4('0xb9')][_0x6ac4('0x8f')](_0x1a3eef[_0x6ac4('0xbc')]);return _0x15f3d4;});})[_0x6ac4('0x38')](function(_0x4403d2){respondWithRpcPromise(_0x6ac4('0xbd'),_0x6ac4('0xbd'),{'FaxAccountId':_[_0x6ac4('0xb1')](_0x1f8349[_0x6ac4('0x59')]['id'])?undefined:_0x1f8349['params']['id'],'path':_[_0x6ac4('0xb1')](_0x1f8349[_0x6ac4('0x5e')]['attachments'][0x0]['path'])?undefined:_0x1f8349[_0x6ac4('0x5e')][_0x6ac4('0xad')][0x0]['path'],'fax':_[_0x6ac4('0xb1')](_0x1f8349[_0x6ac4('0x5e')]['to'][0x0])?undefined:_0x1f8349[_0x6ac4('0x5e')]['to'][0x0],'AttachmentId':_0x1f8349[_0x6ac4('0x5e')][_0x6ac4('0xad')][0x0]['id']},client9002)[_0x6ac4('0x38')](function(_0x23e4e2){logger[_0x6ac4('0x29')]('SendFaxRpc,\x20%s',_0x23e4e2);})[_0x6ac4('0x2b')](function(_0x2059e5){logger['info'](_0x6ac4('0xbe'),_0x2059e5);});return _0x4403d2;})[_0x6ac4('0x38')](respondWithResult(_0x490511,null))[_0x6ac4('0x2b')](handleError(_0x490511,null));};exports[_0x6ac4('0xbf')]=function(_0x38f26c,_0x57f5d3,_0x4c3826){return db[_0x6ac4('0x40')][_0x6ac4('0x63')]({'where':{'id':_0x38f26c[_0x6ac4('0x59')]['id']}})[_0x6ac4('0x38')](handleEntityNotFound(_0x57f5d3,null))[_0x6ac4('0x38')](function(_0x285d6c){if(_0x285d6c){return _0x285d6c[_0x6ac4('0xbf')](_0x38f26c[_0x6ac4('0x5e')][_0x6ac4('0x6e')],_[_0x6ac4('0x74')](_0x38f26c[_0x6ac4('0x5e')],['ids','id'])||{})[_0x6ac4('0xc0')](function(_0x3bae78){for(var _0x1922dd=0x0;_0x1922dd<_0x38f26c[_0x6ac4('0x5e')][_0x6ac4('0x6e')][_0x6ac4('0x5b')];_0x1922dd+=0x1){socket[_0x6ac4('0xc1')](_0x6ac4('0xc2'),{'UserId':Number(_0x38f26c['body'][_0x6ac4('0x6e')][_0x1922dd]),'FaxAccountId':Number(_0x38f26c[_0x6ac4('0x59')]['id'])});}return _0x3bae78;});}})['then'](respondWithResult(_0x57f5d3,null))[_0x6ac4('0x2b')](handleError(_0x57f5d3,null));};exports['removeAgents']=function(_0xb5d8a,_0x2924d7,_0x4f930b){return db['FaxAccount'][_0x6ac4('0x63')]({'where':{'id':_0xb5d8a['params']['id']}})[_0x6ac4('0x38')](handleEntityNotFound(_0x2924d7,null))[_0x6ac4('0x38')](function(_0x484181){if(_0x484181){return _0x484181[_0x6ac4('0xc3')](_0xb5d8a[_0x6ac4('0x46')]['ids'])[_0x6ac4('0x38')](function(){if(_['isArray'](_0xb5d8a[_0x6ac4('0x46')]['ids'])){for(var _0x4f5693=0x0;_0x4f5693<_0xb5d8a[_0x6ac4('0x46')][_0x6ac4('0x6e')]['length'];_0x4f5693+=0x1){socket[_0x6ac4('0xc1')](_0x6ac4('0xc4'),{'UserId':Number(_0xb5d8a[_0x6ac4('0x46')]['ids'][_0x4f5693]),'FaxAccountId':Number(_0xb5d8a[_0x6ac4('0x59')]['id'])});}}else{socket[_0x6ac4('0xc1')]('userFaxAccount:remove',{'UserId':Number(_0xb5d8a['query'][_0x6ac4('0x6e')]),'FaxAccountId':Number(_0xb5d8a['params']['id'])});}});}})[_0x6ac4('0x38')](respondWithStatusCode(_0x2924d7,null))[_0x6ac4('0x2b')](handleError(_0x2924d7,null));};exports[_0x6ac4('0xc5')]=function(_0x2f57e0,_0x54512c,_0x51ac96){var _0x3d6aa2={};var _0x3dffd9={};var _0x1d9f5a;var _0x235f0c;return db[_0x6ac4('0x40')][_0x6ac4('0x6b')]({'where':{'id':_0x2f57e0[_0x6ac4('0x59')]['id']}})[_0x6ac4('0x38')](handleEntityNotFound(_0x54512c,null))[_0x6ac4('0x38')](function(_0x2bff8e){if(_0x2bff8e){_0x1d9f5a=_0x2bff8e;_0x3dffd9[_0x6ac4('0x48')]=_[_0x6ac4('0x47')](db[_0x6ac4('0x78')][_0x6ac4('0x41')]);_0x3dffd9[_0x6ac4('0x46')]=_[_0x6ac4('0x47')](_0x2f57e0[_0x6ac4('0x46')]);_0x3dffd9[_0x6ac4('0x50')]=_[_0x6ac4('0x5a')](_0x3dffd9['model'],_0x3dffd9[_0x6ac4('0x46')]);_0x3d6aa2[_0x6ac4('0x49')]=_[_0x6ac4('0x5a')](_0x3dffd9[_0x6ac4('0x48')],qs[_0x6ac4('0x4a')](_0x2f57e0[_0x6ac4('0x46')][_0x6ac4('0x4a')]));_0x3d6aa2[_0x6ac4('0x49')]=_0x3d6aa2[_0x6ac4('0x49')][_0x6ac4('0x5b')]?_0x3d6aa2[_0x6ac4('0x49')]:_0x3dffd9['model'];_0x3d6aa2[_0x6ac4('0x6c')]=qs[_0x6ac4('0x4d')](_0x2f57e0[_0x6ac4('0x46')]['sort']);_0x3d6aa2[_0x6ac4('0x4e')]=qs[_0x6ac4('0x50')](_[_0x6ac4('0x4f')](_0x2f57e0[_0x6ac4('0x46')],_0x3dffd9['filters']));if(_0x2f57e0[_0x6ac4('0x46')]['filter']){_0x3d6aa2[_0x6ac4('0x4e')]=_[_0x6ac4('0x53')](_0x3d6aa2[_0x6ac4('0x4e')],{'$or':_[_0x6ac4('0x45')](_0x3d6aa2['attributes'],function(_0x57da19){var _0x187335={};_0x187335[_0x57da19]={'$like':'%'+_0x2f57e0[_0x6ac4('0x46')][_0x6ac4('0x51')]+'%'};return _0x187335;})});}_0x3d6aa2=_[_0x6ac4('0x53')]({},_0x3d6aa2,_0x2f57e0['options']);return _0x1d9f5a[_0x6ac4('0xc5')](_0x3d6aa2);}})[_0x6ac4('0x38')](function(_0x565fd2){if(_0x565fd2){_0x235f0c=_0x565fd2[_0x6ac4('0x5b')];if(!_0x2f57e0['query'][_0x6ac4('0x4b')](_0x6ac4('0x4c'))){_0x3d6aa2[_0x6ac4('0x32')]=qs['limit'](_0x2f57e0[_0x6ac4('0x46')][_0x6ac4('0x32')]);_0x3d6aa2[_0x6ac4('0x30')]=qs['offset'](_0x2f57e0[_0x6ac4('0x46')][_0x6ac4('0x30')]);}return _0x1d9f5a[_0x6ac4('0xc5')](_0x3d6aa2);}})['then'](function(_0x101693){if(_0x101693){return _0x101693?{'count':_0x235f0c,'rows':_0x101693}:null;}})[_0x6ac4('0x38')](respondWithResult(_0x54512c,null))['catch'](handleError(_0x54512c,null));}; \ No newline at end of file +var _0xa2a0=['../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./faxAccount.socket','register','jayson/promise','client','http','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','status','end','json','undefined','limit','count','offset','apply','reject','save','update','then','destroy','UserProfileResource','sendStatus','stack','name','Pause','mandatoryDispositionPause','fieldName','type','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','FaxAccount','includeAll','findAll','show','include','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','FaxAccounts','UserProfileSection','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','addDisposition','FaxAccountId','Disposition','getDispositions','rawAttributes','length','nolimit','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','rows','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','tag','transaction','sequelize','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','findAndCountAll','priority','finally','send','getApplications','context','from-voip-provider','exten','app','system','description','Fax\x20Extension','push','Answer','Set','ecm','localstationid','gateway','faxdetect','headerinfo','minrate','modem','t38timeout','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','VoiceExtension','bulkCreate','tech','createdAt','updatedAt','TrunkId','ListId','getMessages','FaxMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','CmList','DESC','attachments','join','root','server/files/attachments','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','List','Contacts','List\x20not\x20found','Send\x20Fax\x20failed','out','Contact\x20not\x20found','spread','ContactId','dataValues','Messages','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa2a0,0x173));var _0x0a2a=function(_0x348fc2,_0x5cbe66){_0x348fc2=_0x348fc2-0x0;var _0x815f26=_0xa2a0[_0x348fc2];return _0x815f26;};'use strict';var emlformat=require(_0x0a2a('0x0'));var rimraf=require(_0x0a2a('0x1'));var zipdir=require(_0x0a2a('0x2'));var jsonpatch=require(_0x0a2a('0x3'));var rp=require(_0x0a2a('0x4'));var moment=require(_0x0a2a('0x5'));var BPromise=require(_0x0a2a('0x6'));var Mustache=require(_0x0a2a('0x7'));var util=require(_0x0a2a('0x8'));var path=require(_0x0a2a('0x9'));var sox=require(_0x0a2a('0xa'));var csv=require(_0x0a2a('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a2a('0xc'));var _=require(_0x0a2a('0xd'));var squel=require('squel');var crypto=require(_0x0a2a('0xe'));var jsforce=require(_0x0a2a('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a2a('0x10'));var Redis=require('ioredis');var authService=require(_0x0a2a('0x11'));var qs=require(_0x0a2a('0x12'));var as=require(_0x0a2a('0x13'));var hardwareService=require(_0x0a2a('0x14'));var logger=require(_0x0a2a('0x15'))(_0x0a2a('0x16'));var utils=require(_0x0a2a('0x17'));var config=require(_0x0a2a('0x18'));var licenseUtil=require(_0x0a2a('0x19'));var db=require(_0x0a2a('0x1a'))['db'];config['redis']=_[_0x0a2a('0x1b')](config['redis'],{'host':_0x0a2a('0x1c'),'port':0x18eb});var socket=require(_0x0a2a('0x1d'))(new Redis(config[_0x0a2a('0x1e')]));require(_0x0a2a('0x1f'))[_0x0a2a('0x20')](socket);var jayson=require(_0x0a2a('0x21'));var client=jayson[_0x0a2a('0x22')][_0x0a2a('0x23')]({'port':0x232c});var client9002=jayson[_0x0a2a('0x22')][_0x0a2a('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x386a50,_0x406e70,_0x115122,_0x1b078e){return new BPromise(function(_0x1dad93,_0x3fb6a6){var _0x1bd746=_0x1b078e||client;return _0x1bd746[_0x0a2a('0x24')](_0x386a50,_0x115122)['then'](function(_0xd21580){logger[_0x0a2a('0x25')](_0x0a2a('0x26'),_0x406e70,_0x0a2a('0x27'));logger[_0x0a2a('0x28')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x406e70,_0x0a2a('0x27'),JSON['stringify'](_0xd21580));if(_0xd21580[_0x0a2a('0x29')]){if(_0xd21580['error']['code']===0x1f4){logger['error'](_0x0a2a('0x26'),_0x406e70,_0xd21580[_0x0a2a('0x29')][_0x0a2a('0x2a')]);return _0x3fb6a6(_0xd21580['error'][_0x0a2a('0x2a')]);}logger[_0x0a2a('0x29')](_0x0a2a('0x26'),_0x406e70,_0xd21580[_0x0a2a('0x29')][_0x0a2a('0x2a')]);return _0x1dad93(_0xd21580['error']['message']);}else{logger[_0x0a2a('0x25')]('FaxAccount,\x20%s,\x20%s',_0x406e70,_0x0a2a('0x27'));_0x1dad93(_0xd21580[_0x0a2a('0x2b')][_0x0a2a('0x2a')]);}})[_0x0a2a('0x2c')](function(_0x27dfdd){logger[_0x0a2a('0x29')](_0x0a2a('0x26'),_0x406e70,_0x27dfdd);_0x3fb6a6(_0x27dfdd);});});}function respondWithStatusCode(_0x2894aa,_0x4aac1b){_0x4aac1b=_0x4aac1b||0xcc;return function(_0x1a3e71){if(_0x1a3e71){return _0x2894aa['sendStatus'](_0x4aac1b);}return _0x2894aa[_0x0a2a('0x2d')](_0x4aac1b)[_0x0a2a('0x2e')]();};}function respondWithResult(_0x503a87,_0x57e1d3){_0x57e1d3=_0x57e1d3||0xc8;return function(_0x567a5d){if(_0x567a5d){return _0x503a87[_0x0a2a('0x2d')](_0x57e1d3)[_0x0a2a('0x2f')](_0x567a5d);}};}function respondWithFilteredResult(_0x33f568,_0x115236){return function(_0x499649){if(_0x499649){var _0x3cbb58=typeof _0x115236['offset']===_0x0a2a('0x30')&&typeof _0x115236[_0x0a2a('0x31')]==='undefined';var _0x33f076=_0x499649['count'];var _0x1d10c6=_0x3cbb58?0x0:_0x115236['offset'];var _0x4a6171=_0x3cbb58?_0x499649[_0x0a2a('0x32')]:_0x115236[_0x0a2a('0x33')]+_0x115236[_0x0a2a('0x31')];var _0x18ba23;if(_0x4a6171>=_0x33f076){_0x4a6171=_0x33f076;_0x18ba23=0xc8;}else{_0x18ba23=0xce;}_0x33f568[_0x0a2a('0x2d')](_0x18ba23);return _0x33f568['set']('Content-Range',_0x1d10c6+'-'+_0x4a6171+'/'+_0x33f076)[_0x0a2a('0x2f')](_0x499649);}return null;};}function patchUpdates(_0x454d53){return function(_0x1877f2){try{jsonpatch[_0x0a2a('0x34')](_0x1877f2,_0x454d53,!![]);}catch(_0x5d80dd){return BPromise[_0x0a2a('0x35')](_0x5d80dd);}return _0x1877f2[_0x0a2a('0x36')]();};}function saveUpdates(_0x3ae830,_0x55c5aa){return function(_0x6fb489){if(_0x6fb489){return _0x6fb489[_0x0a2a('0x37')](_0x3ae830)[_0x0a2a('0x38')](function(_0x2ed826){return _0x2ed826;});}return null;};}function removeEntity(_0x288f03,_0x1bce0e){return function(_0x2c8b22){if(_0x2c8b22){return _0x2c8b22[_0x0a2a('0x39')]()[_0x0a2a('0x38')](function(){var _0x144ce5=_0x2c8b22['get']({'plain':!![]});var _0x21c3e1='FaxAccounts';return db[_0x0a2a('0x3a')][_0x0a2a('0x39')]({'where':{'type':_0x21c3e1,'resourceId':_0x144ce5['id']}})['then'](function(){return _0x2c8b22;});})['then'](function(){_0x288f03[_0x0a2a('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4de383,_0x153495){return function(_0x2df0e5){if(!_0x2df0e5){_0x4de383[_0x0a2a('0x3b')](0x194);}return _0x2df0e5;};}function handleError(_0x3bc7d1,_0x471be9){_0x471be9=_0x471be9||0x1f4;return function(_0x8165e2){logger[_0x0a2a('0x29')](_0x8165e2[_0x0a2a('0x3c')]);if(_0x8165e2['name']){delete _0x8165e2[_0x0a2a('0x3d')];}_0x3bc7d1[_0x0a2a('0x2d')](_0x471be9)['send'](_0x8165e2);};}exports['index']=function(_0x2d1d5f,_0x549fdf){var _0xe2bb96={'include':[{'model':db[_0x0a2a('0x3e')],'as':_0x0a2a('0x3f')}]},_0xa2e10e={},_0x2ce2b4={'count':0x0,'rows':[]};var _0x33ce7e=_['map'](db['FaxAccount']['rawAttributes'],function(_0x56517b){return{'name':_0x56517b[_0x0a2a('0x40')],'type':_0x56517b[_0x0a2a('0x41')]['key']};});_0xa2e10e[_0x0a2a('0x42')]=_[_0x0a2a('0x43')](_0x33ce7e,_0x0a2a('0x3d'));_0xa2e10e[_0x0a2a('0x44')]=_[_0x0a2a('0x45')](_0x2d1d5f['query']);_0xa2e10e[_0x0a2a('0x46')]=_[_0x0a2a('0x47')](_0xa2e10e[_0x0a2a('0x42')],_0xa2e10e[_0x0a2a('0x44')]);_0xe2bb96['attributes']=_['intersection'](_0xa2e10e[_0x0a2a('0x42')],qs[_0x0a2a('0x48')](_0x2d1d5f[_0x0a2a('0x44')][_0x0a2a('0x48')]));_0xe2bb96[_0x0a2a('0x49')]=_0xe2bb96['attributes']['length']?_0xe2bb96[_0x0a2a('0x49')]:_0xa2e10e[_0x0a2a('0x42')];if(!_0x2d1d5f[_0x0a2a('0x44')][_0x0a2a('0x4a')]('nolimit')){_0xe2bb96[_0x0a2a('0x31')]=qs[_0x0a2a('0x31')](_0x2d1d5f['query'][_0x0a2a('0x31')]);_0xe2bb96[_0x0a2a('0x33')]=qs[_0x0a2a('0x33')](_0x2d1d5f[_0x0a2a('0x44')]['offset']);}_0xe2bb96[_0x0a2a('0x4b')]=qs[_0x0a2a('0x4c')](_0x2d1d5f['query'][_0x0a2a('0x4c')]);_0xe2bb96['where']=qs[_0x0a2a('0x46')](_[_0x0a2a('0x4d')](_0x2d1d5f[_0x0a2a('0x44')],_0xa2e10e[_0x0a2a('0x46')]),_0x33ce7e);if(_0x2d1d5f[_0x0a2a('0x44')][_0x0a2a('0x4e')]){_0xe2bb96[_0x0a2a('0x4f')]=_[_0x0a2a('0x50')](_0xe2bb96[_0x0a2a('0x4f')],{'$or':_[_0x0a2a('0x43')](_0x33ce7e,function(_0x1d3bff){if(_0x1d3bff[_0x0a2a('0x41')]!==_0x0a2a('0x51')){var _0x2cf5c7={};_0x2cf5c7[_0x1d3bff['name']]={'$like':'%'+_0x2d1d5f[_0x0a2a('0x44')][_0x0a2a('0x4e')]+'%'};return _0x2cf5c7;}})});}_0xe2bb96=_[_0x0a2a('0x50')]({},_0xe2bb96,_0x2d1d5f[_0x0a2a('0x52')]);var _0x3600ff={'where':_0xe2bb96[_0x0a2a('0x4f')]};return db[_0x0a2a('0x53')][_0x0a2a('0x32')](_0x3600ff)['then'](function(_0x3071c1){_0x2ce2b4[_0x0a2a('0x32')]=_0x3071c1;if(_0x2d1d5f['query'][_0x0a2a('0x54')]){_0xe2bb96['include']=[{'all':!![]}];}return db['FaxAccount'][_0x0a2a('0x55')](_0xe2bb96);})[_0x0a2a('0x38')](function(_0x336294){_0x2ce2b4['rows']=_0x336294;return _0x2ce2b4;})[_0x0a2a('0x38')](respondWithFilteredResult(_0x549fdf,_0xe2bb96))['catch'](handleError(_0x549fdf,null));};exports[_0x0a2a('0x56')]=function(_0x5c1b3b,_0xd9d15a){var _0x35dc54={'raw':![],'where':{'id':_0x5c1b3b['params']['id']},'include':[{'model':db[_0x0a2a('0x3e')],'as':_0x0a2a('0x3f')}]},_0x3a182d={};_0x3a182d[_0x0a2a('0x42')]=_[_0x0a2a('0x45')](db['FaxAccount']['rawAttributes']);_0x3a182d[_0x0a2a('0x44')]=_[_0x0a2a('0x45')](_0x5c1b3b[_0x0a2a('0x44')]);_0x3a182d[_0x0a2a('0x46')]=_['intersection'](_0x3a182d[_0x0a2a('0x42')],_0x3a182d[_0x0a2a('0x44')]);_0x35dc54['attributes']=_[_0x0a2a('0x47')](_0x3a182d[_0x0a2a('0x42')],qs[_0x0a2a('0x48')](_0x5c1b3b['query']['fields']));_0x35dc54[_0x0a2a('0x49')]=_0x35dc54['attributes']['length']?_0x35dc54[_0x0a2a('0x49')]:_0x3a182d['model'];if(_0x5c1b3b['query'][_0x0a2a('0x54')]){_0x35dc54[_0x0a2a('0x57')]=[{'all':!![]}];}_0x35dc54=_[_0x0a2a('0x50')]({},_0x35dc54,_0x5c1b3b['options']);return db[_0x0a2a('0x53')]['find'](_0x35dc54)[_0x0a2a('0x38')](handleEntityNotFound(_0xd9d15a,null))[_0x0a2a('0x38')](respondWithResult(_0xd9d15a,null))[_0x0a2a('0x2c')](handleError(_0xd9d15a,null));};exports[_0x0a2a('0x58')]=function(_0x212f49,_0x22739b){return db[_0x0a2a('0x53')][_0x0a2a('0x58')](_0x212f49['body'],{})[_0x0a2a('0x38')](function(_0x520137){var _0x349f8b=_0x212f49[_0x0a2a('0x59')]['get']({'plain':!![]});if(!_0x349f8b)throw new Error(_0x0a2a('0x5a'));if(_0x349f8b['role']===_0x0a2a('0x59')){var _0x25d7df=_0x520137[_0x0a2a('0x5b')]({'plain':!![]});var _0x2a5659=_0x0a2a('0x5c');return db[_0x0a2a('0x5d')][_0x0a2a('0x5e')]({'where':{'name':_0x2a5659,'userProfileId':_0x349f8b['userProfileId']},'raw':!![]})['then'](function(_0x537b24){if(_0x537b24&&_0x537b24['autoAssociation']===0x0){return db[_0x0a2a('0x3a')][_0x0a2a('0x58')]({'name':_0x25d7df['name'],'resourceId':_0x25d7df['id'],'type':_0x537b24[_0x0a2a('0x3d')],'sectionId':_0x537b24['id']},{})[_0x0a2a('0x38')](function(){return _0x520137;});}else{return _0x520137;}})[_0x0a2a('0x2c')](function(_0x4c0616){logger['error'](_0x0a2a('0x5f'),_0x4c0616);throw _0x4c0616;});}return _0x520137;})[_0x0a2a('0x38')](respondWithResult(_0x22739b,0xc9))[_0x0a2a('0x2c')](handleError(_0x22739b,null));};exports[_0x0a2a('0x37')]=function(_0x1d46df,_0x5716b7){if(_0x1d46df[_0x0a2a('0x60')]['id']){delete _0x1d46df[_0x0a2a('0x60')]['id'];}return db[_0x0a2a('0x53')][_0x0a2a('0x5e')]({'where':{'id':_0x1d46df[_0x0a2a('0x61')]['id']},'include':[{'model':db[_0x0a2a('0x3e')],'as':_0x0a2a('0x3f')}]})[_0x0a2a('0x38')](handleEntityNotFound(_0x5716b7,null))[_0x0a2a('0x38')](saveUpdates(_0x1d46df[_0x0a2a('0x60')],null))[_0x0a2a('0x38')](respondWithResult(_0x5716b7,null))[_0x0a2a('0x2c')](handleError(_0x5716b7,null));};exports[_0x0a2a('0x39')]=function(_0x5aa4a9,_0x1ff863){return db['FaxAccount']['find']({'where':{'id':_0x5aa4a9['params']['id']}})[_0x0a2a('0x38')](handleEntityNotFound(_0x1ff863,null))[_0x0a2a('0x38')](removeEntity(_0x1ff863,null))['catch'](handleError(_0x1ff863,null));};exports[_0x0a2a('0x62')]=function(_0x231b93,_0x45988e){return db[_0x0a2a('0x53')][_0x0a2a('0x62')]()[_0x0a2a('0x38')](respondWithResult(_0x45988e,null))[_0x0a2a('0x2c')](handleError(_0x45988e,null));};exports[_0x0a2a('0x63')]=function(_0x32b185,_0x17c81e,_0x26867e){if(_0x32b185[_0x0a2a('0x60')]['id']){delete _0x32b185[_0x0a2a('0x60')]['id'];}return db[_0x0a2a('0x53')][_0x0a2a('0x5e')]({'where':{'id':_0x32b185[_0x0a2a('0x61')]['id']}})[_0x0a2a('0x38')](handleEntityNotFound(_0x17c81e,null))[_0x0a2a('0x38')](function(_0x532f52){if(_0x532f52){_0x32b185[_0x0a2a('0x60')][_0x0a2a('0x64')]=_0x532f52['id'];return db[_0x0a2a('0x65')][_0x0a2a('0x58')](_0x32b185['body']);}})[_0x0a2a('0x38')](respondWithResult(_0x17c81e,null))[_0x0a2a('0x2c')](handleError(_0x17c81e,null));};exports[_0x0a2a('0x66')]=function(_0x424ee9,_0x1c8118,_0x40c96e){var _0x4ebac0={'raw':![],'where':{}};var _0x46d686={};var _0x2fab42={'count':0x0,'rows':[]};return db[_0x0a2a('0x53')]['findOne']({'where':{'id':_0x424ee9[_0x0a2a('0x61')]['id']}})[_0x0a2a('0x38')](handleEntityNotFound(_0x1c8118,null))['then'](function(_0x23311e){if(_0x23311e){_0x46d686[_0x0a2a('0x42')]=_[_0x0a2a('0x45')](db[_0x0a2a('0x65')][_0x0a2a('0x67')]);_0x46d686[_0x0a2a('0x44')]=_[_0x0a2a('0x45')](_0x424ee9['query']);_0x46d686[_0x0a2a('0x46')]=_['intersection'](_0x46d686[_0x0a2a('0x42')],_0x46d686[_0x0a2a('0x44')]);_0x4ebac0['attributes']=_[_0x0a2a('0x47')](_0x46d686[_0x0a2a('0x42')],qs[_0x0a2a('0x48')](_0x424ee9[_0x0a2a('0x44')]['fields']));_0x4ebac0['attributes']=_0x4ebac0[_0x0a2a('0x49')][_0x0a2a('0x68')]?_0x4ebac0[_0x0a2a('0x49')]:_0x46d686[_0x0a2a('0x42')];if(!_0x424ee9[_0x0a2a('0x44')]['hasOwnProperty'](_0x0a2a('0x69'))){_0x4ebac0[_0x0a2a('0x31')]=qs[_0x0a2a('0x31')](_0x424ee9[_0x0a2a('0x44')][_0x0a2a('0x31')]);_0x4ebac0['offset']=qs[_0x0a2a('0x33')](_0x424ee9[_0x0a2a('0x44')]['offset']);}_0x4ebac0[_0x0a2a('0x4b')]=qs['sort'](_0x424ee9[_0x0a2a('0x44')]['sort']);_0x4ebac0[_0x0a2a('0x4f')]=qs[_0x0a2a('0x46')](_[_0x0a2a('0x4d')](_0x424ee9[_0x0a2a('0x44')],_0x46d686['filters']));_0x4ebac0[_0x0a2a('0x4f')][_0x0a2a('0x64')]=_0x23311e['id'];if(_0x424ee9[_0x0a2a('0x44')][_0x0a2a('0x4e')]){_0x4ebac0['where']=_['merge'](_0x4ebac0[_0x0a2a('0x4f')],{'$or':_['map'](_0x4ebac0[_0x0a2a('0x49')],function(_0x28095e){var _0x27896a={};_0x27896a[_0x28095e]={'$like':'%'+_0x424ee9['query'][_0x0a2a('0x4e')]+'%'};return _0x27896a;})});}_0x4ebac0=_[_0x0a2a('0x50')]({},_0x4ebac0,_0x424ee9['options']);return db[_0x0a2a('0x65')]['count']({'where':_0x4ebac0[_0x0a2a('0x4f')]})['then'](function(_0x51864a){_0x2fab42[_0x0a2a('0x32')]=_0x51864a;if(_0x424ee9['query'][_0x0a2a('0x54')]){_0x4ebac0['include']=[{'all':!![]}];}return db['Disposition'][_0x0a2a('0x55')](_0x4ebac0);})[_0x0a2a('0x38')](function(_0x532c81){_0x2fab42['rows']=_0x532c81;return _0x2fab42;});}})[_0x0a2a('0x38')](respondWithFilteredResult(_0x1c8118,_0x4ebac0))['catch'](handleError(_0x1c8118,null));};exports[_0x0a2a('0x6a')]=function(_0x3094cf,_0x5bcede,_0x556347){return db[_0x0a2a('0x53')][_0x0a2a('0x5e')]({'where':{'id':_0x3094cf[_0x0a2a('0x61')]['id']}})['then'](handleEntityNotFound(_0x5bcede,null))['then'](function(_0x2854a9){if(_0x2854a9){return _0x2854a9[_0x0a2a('0x6a')](_0x3094cf['query'][_0x0a2a('0x6b')]);}})['then'](respondWithStatusCode(_0x5bcede,null))[_0x0a2a('0x2c')](handleError(_0x5bcede,null));};exports[_0x0a2a('0x6c')]=function(_0x260ed0,_0x30eddf,_0x3408cb){if(_0x260ed0['body']['id']){delete _0x260ed0[_0x0a2a('0x60')]['id'];}return db[_0x0a2a('0x53')][_0x0a2a('0x5e')]({'where':{'id':_0x260ed0['params']['id']}})[_0x0a2a('0x38')](handleEntityNotFound(_0x30eddf,null))[_0x0a2a('0x38')](function(_0x2d5426){if(_0x2d5426){_0x260ed0['body'][_0x0a2a('0x64')]=_0x2d5426['id'];return db[_0x0a2a('0x6d')]['create'](_0x260ed0[_0x0a2a('0x60')]);}})[_0x0a2a('0x38')](respondWithResult(_0x30eddf,null))[_0x0a2a('0x2c')](handleError(_0x30eddf,null));};exports[_0x0a2a('0x6e')]=function(_0x1a85ae,_0xb90dfd,_0x32360f){var _0x19f6d0={'raw':![],'where':{}};var _0x3fe128={};var _0x47022a={'count':0x0,'rows':[]};return db[_0x0a2a('0x53')][_0x0a2a('0x6f')]({'where':{'id':_0x1a85ae[_0x0a2a('0x61')]['id']}})[_0x0a2a('0x38')](handleEntityNotFound(_0xb90dfd,null))[_0x0a2a('0x38')](function(_0x3603eb){if(_0x3603eb){_0x3fe128[_0x0a2a('0x42')]=_[_0x0a2a('0x45')](db['CannedAnswer']['rawAttributes']);_0x3fe128['query']=_['keys'](_0x1a85ae[_0x0a2a('0x44')]);_0x3fe128['filters']=_[_0x0a2a('0x47')](_0x3fe128['model'],_0x3fe128[_0x0a2a('0x44')]);_0x19f6d0[_0x0a2a('0x49')]=_['intersection'](_0x3fe128[_0x0a2a('0x42')],qs[_0x0a2a('0x48')](_0x1a85ae['query'][_0x0a2a('0x48')]));_0x19f6d0[_0x0a2a('0x49')]=_0x19f6d0[_0x0a2a('0x49')]['length']?_0x19f6d0[_0x0a2a('0x49')]:_0x3fe128[_0x0a2a('0x42')];if(!_0x1a85ae[_0x0a2a('0x44')][_0x0a2a('0x4a')](_0x0a2a('0x69'))){_0x19f6d0[_0x0a2a('0x31')]=qs[_0x0a2a('0x31')](_0x1a85ae['query']['limit']);_0x19f6d0[_0x0a2a('0x33')]=qs[_0x0a2a('0x33')](_0x1a85ae['query'][_0x0a2a('0x33')]);}_0x19f6d0[_0x0a2a('0x4b')]=qs['sort'](_0x1a85ae[_0x0a2a('0x44')][_0x0a2a('0x4c')]);_0x19f6d0[_0x0a2a('0x4f')]=qs['filters'](_[_0x0a2a('0x4d')](_0x1a85ae[_0x0a2a('0x44')],_0x3fe128['filters']));_0x19f6d0[_0x0a2a('0x4f')][_0x0a2a('0x64')]=_0x3603eb['id'];if(_0x1a85ae[_0x0a2a('0x44')][_0x0a2a('0x4e')]){_0x19f6d0[_0x0a2a('0x4f')]=_[_0x0a2a('0x50')](_0x19f6d0[_0x0a2a('0x4f')],{'$or':_[_0x0a2a('0x43')](_0x19f6d0['attributes'],function(_0xc420b1){var _0x472cab={};_0x472cab[_0xc420b1]={'$like':'%'+_0x1a85ae[_0x0a2a('0x44')][_0x0a2a('0x4e')]+'%'};return _0x472cab;})});}_0x19f6d0=_[_0x0a2a('0x50')]({},_0x19f6d0,_0x1a85ae['options']);return db[_0x0a2a('0x6d')][_0x0a2a('0x32')]({'where':_0x19f6d0['where']})[_0x0a2a('0x38')](function(_0x421d44){_0x47022a[_0x0a2a('0x32')]=_0x421d44;if(_0x1a85ae[_0x0a2a('0x44')][_0x0a2a('0x54')]){_0x19f6d0[_0x0a2a('0x57')]=[{'all':!![]}];}return db['CannedAnswer'][_0x0a2a('0x55')](_0x19f6d0);})[_0x0a2a('0x38')](function(_0x520e18){_0x47022a[_0x0a2a('0x70')]=_0x520e18;return _0x47022a;});}})['then'](respondWithFilteredResult(_0xb90dfd,_0x19f6d0))[_0x0a2a('0x2c')](handleError(_0xb90dfd,null));};exports['removeAnswers']=function(_0x1e5214,_0x2c932a,_0x356358){return db['FaxAccount'][_0x0a2a('0x5e')]({'where':{'id':_0x1e5214[_0x0a2a('0x61')]['id']}})[_0x0a2a('0x38')](handleEntityNotFound(_0x2c932a,null))[_0x0a2a('0x38')](function(_0x10359e){if(_0x10359e){return _0x10359e[_0x0a2a('0x71')](_0x1e5214[_0x0a2a('0x44')]['ids']);}})[_0x0a2a('0x38')](respondWithStatusCode(_0x2c932a,null))[_0x0a2a('0x2c')](handleError(_0x2c932a,null));};exports[_0x0a2a('0x72')]=function(_0x5947ab,_0x455fde,_0x453f66){return db[_0x0a2a('0x73')][_0x0a2a('0x5e')]({'where':{'id':_0x5947ab[_0x0a2a('0x61')]['id']}})[_0x0a2a('0x38')](handleEntityNotFound(_0x455fde,null))['then'](function(_0x579a1b){if(_0x579a1b){return _0x579a1b[_0x0a2a('0x72')](_0x5947ab[_0x0a2a('0x60')][_0x0a2a('0x6b')],_[_0x0a2a('0x74')](_0x5947ab['body'],[_0x0a2a('0x6b'),'id'])||{});}})[_0x0a2a('0x38')](respondWithResult(_0x455fde,null))[_0x0a2a('0x2c')](handleError(_0x455fde,null));};exports[_0x0a2a('0x75')]=function(_0x3ff6cd,_0xa81e01,_0x5dcaf2){var _0x1b8615={'raw':![],'where':{}};var _0x3af30f={};var _0x68f947={'count':0x0,'rows':[]};return db[_0x0a2a('0x53')][_0x0a2a('0x6f')]({'where':{'id':_0x3ff6cd[_0x0a2a('0x61')]['id']}})[_0x0a2a('0x38')](handleEntityNotFound(_0xa81e01,null))[_0x0a2a('0x38')](function(_0x8cd24d){if(_0x8cd24d){_0x3af30f['model']=_[_0x0a2a('0x45')](db[_0x0a2a('0x73')]['rawAttributes']);_0x3af30f[_0x0a2a('0x44')]=_[_0x0a2a('0x45')](_0x3ff6cd[_0x0a2a('0x44')]);_0x3af30f[_0x0a2a('0x46')]=_['intersection'](_0x3af30f['model'],_0x3af30f[_0x0a2a('0x44')]);_0x1b8615[_0x0a2a('0x49')]=_[_0x0a2a('0x47')](_0x3af30f['model'],qs['fields'](_0x3ff6cd[_0x0a2a('0x44')][_0x0a2a('0x48')]));_0x1b8615[_0x0a2a('0x49')]=_0x1b8615[_0x0a2a('0x49')][_0x0a2a('0x68')]?_0x1b8615['attributes']:_0x3af30f[_0x0a2a('0x42')];if(!_0x3ff6cd[_0x0a2a('0x44')][_0x0a2a('0x4a')](_0x0a2a('0x69'))){_0x1b8615[_0x0a2a('0x31')]=qs[_0x0a2a('0x31')](_0x3ff6cd['query'][_0x0a2a('0x31')]);_0x1b8615['offset']=qs[_0x0a2a('0x33')](_0x3ff6cd['query'][_0x0a2a('0x33')]);}_0x1b8615[_0x0a2a('0x4b')]=qs['sort'](_0x3ff6cd[_0x0a2a('0x44')][_0x0a2a('0x4c')]);_0x1b8615['where']=qs[_0x0a2a('0x46')](_[_0x0a2a('0x4d')](_0x3ff6cd['query'],_0x3af30f['filters']));_0x1b8615['where'][_0x0a2a('0x64')]=_0x8cd24d['id'];if(_0x3ff6cd[_0x0a2a('0x44')]['filter']){_0x1b8615[_0x0a2a('0x4f')]=_['merge'](_0x1b8615['where'],{'$or':_[_0x0a2a('0x43')](_0x1b8615[_0x0a2a('0x49')],function(_0x96cb38){var _0x42bac2={};_0x42bac2[_0x96cb38]={'$like':'%'+_0x3ff6cd['query']['filter']+'%'};return _0x42bac2;})});}_0x1b8615=_[_0x0a2a('0x50')]({},_0x1b8615,_0x3ff6cd[_0x0a2a('0x52')]);return db[_0x0a2a('0x73')][_0x0a2a('0x32')]({'where':_0x1b8615[_0x0a2a('0x4f')]})[_0x0a2a('0x38')](function(_0x2989b3){_0x68f947[_0x0a2a('0x32')]=_0x2989b3;if(_0x3ff6cd[_0x0a2a('0x44')][_0x0a2a('0x54')]){_0x1b8615[_0x0a2a('0x57')]=[{'model':db[_0x0a2a('0x76')],'as':_0x0a2a('0x77'),'required':![]},{'model':db[_0x0a2a('0x78')],'as':_0x0a2a('0x79'),'attributes':[_0x0a2a('0x3d'),_0x0a2a('0x7a'),_0x0a2a('0x7b')],'required':![]},{'model':db[_0x0a2a('0x7c')],'as':_0x0a2a('0x7d'),'attributes':['id',_0x0a2a('0x3d'),'color'],'where':_0x3ff6cd['query']['tag']?{'id':_0x3ff6cd[_0x0a2a('0x44')]['tag']}:undefined,'required':_0x3ff6cd[_0x0a2a('0x44')][_0x0a2a('0x7e')]?!![]:![]}];}return db['FaxInteraction']['findAll'](_0x1b8615);})[_0x0a2a('0x38')](function(_0x188ba5){_0x68f947[_0x0a2a('0x70')]=_0x188ba5;return _0x68f947;});}})['then'](respondWithFilteredResult(_0xa81e01,_0x1b8615))[_0x0a2a('0x2c')](handleError(_0xa81e01,null));};exports['addApplications']=function(_0x14ff9f,_0x330277){var _0x18ca16=_0x14ff9f['params']['id'];var _0x58a6c7=_0x14ff9f[_0x0a2a('0x60')];var _0x288ed7=0xc8;var _0x6d0cb7=null;return db['sequelize'][_0x0a2a('0x7f')]({'isolationLevel':db[_0x0a2a('0x80')]['Transaction'][_0x0a2a('0x81')][_0x0a2a('0x82')]},function(_0x1e3a84){return db[_0x0a2a('0x53')]['findOne']({'where':{'id':_0x18ca16},'transaction':_0x1e3a84})['then'](function(_0x25acc0){if(_0x25acc0){return db['FaxApplication'][_0x0a2a('0x39')]({'where':{'FaxAccountId':_0x18ca16},'transaction':_0x1e3a84})[_0x0a2a('0x38')](function(){var _0x2da351=_[_0x0a2a('0x43')](_0x58a6c7,function(_0x17895d){_0x17895d[_0x0a2a('0x64')]=_0x18ca16;return _0x17895d;});return db['FaxApplication']['bulkCreate'](_0x2da351,{'transaction':_0x1e3a84});});}else{_0x288ed7=0x194;_0x6d0cb7=[];}});})[_0x0a2a('0x38')](function(){if(_0x288ed7!==0x194){return db[_0x0a2a('0x83')][_0x0a2a('0x84')]({'where':{'FaxAccountId':_0x18ca16},'order':_0x0a2a('0x85')})[_0x0a2a('0x38')](function(_0x2407f3){_0x6d0cb7=_0x2407f3;});}})['catch'](function(_0x1d9742){_0x288ed7=0x1f4;logger[_0x0a2a('0x29')](_0x1d9742['stack']);if(_0x1d9742[_0x0a2a('0x3d')]){delete _0x1d9742[_0x0a2a('0x3d')];}_0x6d0cb7=_0x1d9742;})[_0x0a2a('0x86')](function(){if(_0x6d0cb7===null){_0x330277[_0x0a2a('0x3b')](_0x288ed7);}else{if(_0x288ed7===0x1f4){_0x330277['status'](_0x288ed7)[_0x0a2a('0x87')](_0x6d0cb7);}else{_0x330277[_0x0a2a('0x2d')](_0x288ed7)[_0x0a2a('0x2f')](_0x6d0cb7);}}});};exports['getApplications']=function(_0x18baa5,_0x5eff23,_0x6ad9ce){var _0xd255c7={};var _0x59cc2c={};var _0x4c112d;var _0x39f7a5;return db[_0x0a2a('0x53')][_0x0a2a('0x6f')]({'where':{'id':_0x18baa5[_0x0a2a('0x61')]['id']}})[_0x0a2a('0x38')](handleEntityNotFound(_0x5eff23,null))[_0x0a2a('0x38')](function(_0x5b7300){if(_0x5b7300){_0x4c112d=_0x5b7300;_0x59cc2c[_0x0a2a('0x42')]=_[_0x0a2a('0x45')](db['FaxApplication'][_0x0a2a('0x67')]);_0x59cc2c['query']=_[_0x0a2a('0x45')](_0x18baa5['query']);_0x59cc2c[_0x0a2a('0x46')]=_['intersection'](_0x59cc2c[_0x0a2a('0x42')],_0x59cc2c[_0x0a2a('0x44')]);_0xd255c7[_0x0a2a('0x49')]=_[_0x0a2a('0x47')](_0x59cc2c[_0x0a2a('0x42')],qs['fields'](_0x18baa5[_0x0a2a('0x44')][_0x0a2a('0x48')]));_0xd255c7['attributes']=_0xd255c7[_0x0a2a('0x49')][_0x0a2a('0x68')]?_0xd255c7['attributes']:_0x59cc2c[_0x0a2a('0x42')];_0xd255c7[_0x0a2a('0x4b')]=qs['sort'](_0x18baa5[_0x0a2a('0x44')][_0x0a2a('0x4c')]);_0xd255c7[_0x0a2a('0x4f')]=qs[_0x0a2a('0x46')](_[_0x0a2a('0x4d')](_0x18baa5['query'],_0x59cc2c[_0x0a2a('0x46')]));if(_0x18baa5[_0x0a2a('0x44')]['filter']){_0xd255c7['where']=_['merge'](_0xd255c7[_0x0a2a('0x4f')],{'$or':_[_0x0a2a('0x43')](_0xd255c7['attributes'],function(_0x20b979){var _0x1ccec0={};_0x1ccec0[_0x20b979]={'$like':'%'+_0x18baa5[_0x0a2a('0x44')][_0x0a2a('0x4e')]+'%'};return _0x1ccec0;})});}_0xd255c7=_[_0x0a2a('0x50')]({},_0xd255c7,_0x18baa5[_0x0a2a('0x52')]);return _0x4c112d[_0x0a2a('0x88')](_0xd255c7);}})[_0x0a2a('0x38')](function(_0xb60b99){if(_0xb60b99){_0x39f7a5=_0xb60b99[_0x0a2a('0x68')];if(!_0x18baa5[_0x0a2a('0x44')][_0x0a2a('0x4a')]('nolimit')){_0xd255c7[_0x0a2a('0x31')]=qs[_0x0a2a('0x31')](_0x18baa5['query']['limit']);_0xd255c7[_0x0a2a('0x33')]=qs[_0x0a2a('0x33')](_0x18baa5[_0x0a2a('0x44')][_0x0a2a('0x33')]);}return _0x4c112d[_0x0a2a('0x88')](_0xd255c7);}})['then'](function(_0x4d91f7){if(_0x4d91f7){return _0x4d91f7?{'count':_0x39f7a5,'rows':_0x4d91f7}:null;}})[_0x0a2a('0x38')](respondWithResult(_0x5eff23,null))[_0x0a2a('0x2c')](handleError(_0x5eff23,null));};function Extension(_0x94d8ed,_0x2c40cf,_0x890ca9,_0x3a6ed2){this[_0x0a2a('0x89')]=_0x0a2a('0x8a');this[_0x0a2a('0x8b')]=_0x94d8ed['localstationid'];this[_0x0a2a('0x8c')]=_0x3a6ed2;this[_0x0a2a('0x41')]=_0x0a2a('0x8d');this[_0x0a2a('0x8e')]=_0x0a2a('0x8f');this[_0x0a2a('0x64')]=_0x94d8ed['id'];this['priority']=_0x2c40cf;this['appdata']=_0x890ca9;}function createExtensionsReciveFax(_0x1d8144){var _0xf20bb8=0x1;var _0x250f75=[];_0x250f75[_0x0a2a('0x90')](new Extension(_0x1d8144,_0xf20bb8,'',_0x0a2a('0x91')));_0xf20bb8+=0x1;_0x250f75[_0x0a2a('0x90')](new Extension(_0x1d8144,_0xf20bb8,'CDR(type)=inbound-fax',_0x0a2a('0x92')));_0xf20bb8+=0x1;for(var _0x2a1b38 in _0x1d8144){if(_0x1d8144[_0x0a2a('0x4a')](_0x2a1b38)&&(_0x2a1b38===_0x0a2a('0x93')||_0x2a1b38===_0x0a2a('0x94')||_0x2a1b38===_0x0a2a('0x95')||_0x2a1b38===_0x0a2a('0x96')||_0x2a1b38===_0x0a2a('0x97')||_0x2a1b38==='maxrate'||_0x2a1b38===_0x0a2a('0x98')||_0x2a1b38===_0x0a2a('0x99')||_0x2a1b38===_0x0a2a('0x9a'))){_0x250f75[_0x0a2a('0x90')](new Extension(_0x1d8144,_0xf20bb8,'FAXOPT('+_0x2a1b38+')='+_0x1d8144[_0x2a1b38],_0x0a2a('0x92')));_0xf20bb8+=0x1;}}_0x250f75[_0x0a2a('0x90')](new Extension(_0x1d8144,_0xf20bb8,'6',_0x0a2a('0x9b')));_0xf20bb8+=0x1;_0x250f75[_0x0a2a('0x90')](new Extension(_0x1d8144,_0xf20bb8,_0x0a2a('0x9c'),'ReceiveFax'));_0xf20bb8=0x0;return _0x250f75;}exports['addAccountApplications']=function(_0xb216ea,_0x6cc46e,_0x3044ef){var _0x1fdb52;return db['sequelize'][_0x0a2a('0x7f')](function(_0x34f0fe){return db['FaxAccount'][_0x0a2a('0x58')](_0xb216ea[_0x0a2a('0x60')],{'transaction':_0x34f0fe})['then'](function(_0x4e95de){_0x1fdb52=_0x4e95de['get']({'plain':!![]});return db[_0x0a2a('0x9d')][_0x0a2a('0x9e')](createExtensionsReciveFax(_0x1fdb52),{'transaction':_0x34f0fe});});})[_0x0a2a('0x38')](function(){return _0x1fdb52;})[_0x0a2a('0x38')](respondWithResult(_0x6cc46e,null))[_0x0a2a('0x2c')](handleError(_0x6cc46e,null));};exports['updateAccountApplications']=function(_0x5e2310,_0x1eefd4,_0x6e7422){var _0x3302f2;return db[_0x0a2a('0x80')][_0x0a2a('0x7f')](function(_0x43c81b){return db[_0x0a2a('0x53')][_0x0a2a('0x37')](_0x5e2310['body'],{'where':{'id':_0x5e2310[_0x0a2a('0x60')]['id']},'transaction':_0x43c81b})['then'](function(_0x40a1f7){return db[_0x0a2a('0x9d')][_0x0a2a('0x39')]({'where':{'FaxAccountId':_0x5e2310['body']['id']},'transaction':_0x43c81b})[_0x0a2a('0x38')](function(_0x2f7895){return db['VoiceExtension']['bulkCreate'](createExtensionsReciveFax(_[_0x0a2a('0x74')](_0x5e2310[_0x0a2a('0x60')],[_0x0a2a('0x9f'),'key',_0x0a2a('0xa0'),_0x0a2a('0xa1'),_0x0a2a('0xa2'),_0x0a2a('0xa3')])),{'transaction':_0x43c81b});});});})[_0x0a2a('0x38')](function(){return db[_0x0a2a('0x53')]['findById'](_0x5e2310[_0x0a2a('0x60')]['id']);})['then'](respondWithResult(_0x1eefd4,null))[_0x0a2a('0x2c')](handleError(_0x1eefd4,null));};exports[_0x0a2a('0xa4')]=function(_0x5b9bb2,_0x377a2e,_0x101374){var _0x428a25={'raw':!![],'where':{}};var _0x1773a6={};var _0x1abaac={'count':0x0,'rows':[]};return db[_0x0a2a('0x53')][_0x0a2a('0x6f')]({'where':{'id':_0x5b9bb2[_0x0a2a('0x61')]['id']}})[_0x0a2a('0x38')](handleEntityNotFound(_0x377a2e,null))[_0x0a2a('0x38')](function(_0x192f63){if(_0x192f63){_0x1773a6[_0x0a2a('0x42')]=_[_0x0a2a('0x45')](db[_0x0a2a('0xa5')]['rawAttributes']);_0x1773a6[_0x0a2a('0x44')]=_[_0x0a2a('0x45')](_0x5b9bb2[_0x0a2a('0x44')]);_0x1773a6['filters']=_[_0x0a2a('0x47')](_0x1773a6['model'],_0x1773a6[_0x0a2a('0x44')]);_0x428a25[_0x0a2a('0x49')]=_['intersection'](_0x1773a6[_0x0a2a('0x42')],qs['fields'](_0x5b9bb2['query'][_0x0a2a('0x48')]));_0x428a25[_0x0a2a('0x49')]=_0x428a25[_0x0a2a('0x49')]['length']?_0x428a25['attributes']:_0x1773a6[_0x0a2a('0x42')];if(!_0x5b9bb2[_0x0a2a('0x44')][_0x0a2a('0x4a')]('nolimit')){_0x428a25['limit']=qs[_0x0a2a('0x31')](_0x5b9bb2[_0x0a2a('0x44')]['limit']);_0x428a25[_0x0a2a('0x33')]=qs['offset'](_0x5b9bb2[_0x0a2a('0x44')][_0x0a2a('0x33')]);}_0x428a25['order']=qs[_0x0a2a('0x4c')](_0x5b9bb2[_0x0a2a('0x44')][_0x0a2a('0x4c')]);_0x428a25['where']=qs[_0x0a2a('0x46')](_[_0x0a2a('0x4d')](_0x5b9bb2[_0x0a2a('0x44')],_0x1773a6[_0x0a2a('0x46')]));_0x428a25[_0x0a2a('0x4f')][_0x0a2a('0x64')]=_0x192f63['id'];if(_0x5b9bb2['query'][_0x0a2a('0x4e')]){_0x428a25[_0x0a2a('0x4f')]=_[_0x0a2a('0x50')](_0x428a25['where'],{'$or':_['map'](_0x428a25[_0x0a2a('0x49')],function(_0x1851d5){var _0x5c9972={};_0x5c9972[_0x1851d5]={'$like':'%'+_0x5b9bb2[_0x0a2a('0x44')][_0x0a2a('0x4e')]+'%'};return _0x5c9972;})});}if(_0x5b9bb2[_0x0a2a('0x44')]['$gte']){var _0x598b0f=_0x5b9bb2['query'][_0x0a2a('0xa6')]['split'](',');var _0x39c330={};_0x39c330[_0x598b0f[0x0]]={'$gte':moment(_0x598b0f[0x1])[_0x0a2a('0xa7')](_0x0a2a('0xa8'))};_0x428a25[_0x0a2a('0x4f')]=_['merge'](_0x428a25[_0x0a2a('0x4f')],_0x39c330);}_0x428a25=_[_0x0a2a('0x50')]({},_0x428a25,_0x5b9bb2[_0x0a2a('0x52')]);return db[_0x0a2a('0xa5')][_0x0a2a('0x32')]({'where':_0x428a25[_0x0a2a('0x4f')]})[_0x0a2a('0x38')](function(_0x1c3f3d){_0x1abaac[_0x0a2a('0x32')]=_0x1c3f3d;if(_0x5b9bb2[_0x0a2a('0x44')][_0x0a2a('0x54')]){_0x428a25[_0x0a2a('0x57')]=[{'all':!![]}];}return db[_0x0a2a('0xa5')][_0x0a2a('0x55')](_0x428a25);})[_0x0a2a('0x38')](function(_0x3d4e57){_0x1abaac[_0x0a2a('0x70')]=_0x3d4e57;return _0x1abaac;});}})['then'](respondWithFilteredResult(_0x377a2e,_0x428a25))[_0x0a2a('0x2c')](handleError(_0x377a2e,null));};exports[_0x0a2a('0x87')]=function(_0x2ae1fe,_0x4eb1fd,_0x13b71b){var _0x1f0af0,_0x32822a={},_0xf6332e;if(_0x2ae1fe[_0x0a2a('0x60')]['to']){_0xf6332e=_0x2ae1fe[_0x0a2a('0x60')]['to'][0x0];}return db[_0x0a2a('0x53')]['find']({'where':{'id':_0x2ae1fe['params']['id']},'include':[{'model':db[_0x0a2a('0xa9')],'as':'List','include':[{'model':db[_0x0a2a('0x76')],'as':'Contacts','where':{'fax':_0xf6332e},'limit':0x1,'order':[[_0x0a2a('0xa1'),_0x0a2a('0xaa')]]}]}]})[_0x0a2a('0x38')](handleEntityNotFound(_0x4eb1fd,null))[_0x0a2a('0x38')](function(_0x4ebd49){_0x1f0af0=_0x4ebd49;if(_0x2ae1fe[_0x0a2a('0x60')][_0x0a2a('0xab')]&&_0x2ae1fe[_0x0a2a('0x60')]['attachments'][_0x0a2a('0x68')]){for(var _0x38c2de=0x0;_0x38c2de<_0x2ae1fe[_0x0a2a('0x60')]['attachments'][_0x0a2a('0x68')];_0x38c2de+=0x1){_0x2ae1fe[_0x0a2a('0x60')][_0x0a2a('0xab')][_0x38c2de]={'filename':_0x2ae1fe[_0x0a2a('0x60')]['attachments'][_0x38c2de][_0x0a2a('0x3d')],'id':_0x2ae1fe[_0x0a2a('0x60')][_0x0a2a('0xab')][_0x38c2de]['id'],'path':path[_0x0a2a('0xac')](config[_0x0a2a('0xad')],_0x0a2a('0xae'),_0x2ae1fe[_0x0a2a('0x60')][_0x0a2a('0xab')][_0x38c2de]['basename'])};}}return respondWithRpcPromise(_0x0a2a('0xaf'),_0x0a2a('0xaf'),{'FaxAccountId':_[_0x0a2a('0xb0')](_0x2ae1fe[_0x0a2a('0x61')]['id'])?undefined:_0x2ae1fe[_0x0a2a('0x61')]['id'],'path':_['isNil'](_0x2ae1fe[_0x0a2a('0x60')]['attachments'][0x0][_0x0a2a('0x9')])?undefined:_0x2ae1fe[_0x0a2a('0x60')][_0x0a2a('0xab')][0x0][_0x0a2a('0x9')],'fax':_[_0x0a2a('0xb0')](_0x2ae1fe[_0x0a2a('0x60')]['to'][0x0])?undefined:_0x2ae1fe[_0x0a2a('0x60')]['to'][0x0]},client9002);})['then'](function(){if(_0x1f0af0){if(_[_0x0a2a('0xb0')](_0x2ae1fe[_0x0a2a('0x60')][_0x0a2a('0xb1')])){_0x2ae1fe[_0x0a2a('0x60')]['from']=util[_0x0a2a('0xa7')](_0x0a2a('0xb2'),_0x1f0af0['name'],_0x1f0af0[_0x0a2a('0xb3')]);}if(_0x1f0af0[_0x0a2a('0xb4')]){if(_0x1f0af0['List'][_0x0a2a('0xb5')][_0x0a2a('0x68')]){return _0x1f0af0['List'][_0x0a2a('0xb5')][0x0];}else{return db[_0x0a2a('0x76')][_0x0a2a('0x58')](_[_0x0a2a('0x1b')](_0x2ae1fe[_0x0a2a('0x60')],{'firstName':_0x2ae1fe[_0x0a2a('0x60')]['to'][0x0],'phone':_0x2ae1fe['body']['to'][0x0],'fax':_0x2ae1fe['body']['to'][0x0],'ListId':_0x1f0af0['ListId']}));}}else{throw new Error(_0x0a2a('0xb6'));}}else{throw new Error(_0x0a2a('0xb7'));}})[_0x0a2a('0x38')](function(_0x4d602b){if(_0x4d602b){return db['FaxInteraction']['find']({'where':{'ContactId':_0x4d602b['id'],'closed':![],'FaxAccountId':_0x1f0af0['id']}})[_0x0a2a('0x38')](function(_0x4e490f){if(_0x4e490f){return[_0x4e490f,![]];}return db[_0x0a2a('0x73')][_0x0a2a('0x58')]({'UserId':_0x2ae1fe[_0x0a2a('0x59')]['id'],'ContactId':_0x4d602b['id'],'FaxAccountId':_0x1f0af0['id'],'fax':_0x2ae1fe[_0x0a2a('0x60')]['to'][0x0],'firstMsgDirection':_0x0a2a('0xb8'),'Messages':[_[_0x0a2a('0x50')](_0x2ae1fe[_0x0a2a('0x60')],{'read':![],'body':_0x2ae1fe[_0x0a2a('0x60')][_0x0a2a('0xab')][0x0]['filename'],'FaxAccountId':_0x1f0af0['id'],'UserId':_0x2ae1fe['user']['id'],'ContactId':_0x4d602b['id'],'AttachmentId':_0x2ae1fe[_0x0a2a('0x60')]['attachments'][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':'Messages'}]})[_0x0a2a('0x38')](function(_0x435642){return[_0x435642,!![]];});});}else{throw new Error(_0x0a2a('0xb9'));}})[_0x0a2a('0xba')](function(_0x462b34,_0x400017){if(_0x400017){return _0x462b34;}return db[_0x0a2a('0xa5')][_0x0a2a('0x58')]({'direction':_0x0a2a('0xb8'),'read':![],'body':_0x2ae1fe[_0x0a2a('0x60')][_0x0a2a('0xab')][0x0]['filename'],'FaxAccountId':_0x1f0af0['id'],'FaxInteractionId':_0x462b34['id'],'UserId':_0x2ae1fe['user']['id'],'ContactId':_0x462b34[_0x0a2a('0xbb')],'AttachmentId':_0x2ae1fe['body']['attachments'][0x0]['id']})[_0x0a2a('0x38')](function(_0x4e0790){_0x462b34[_0x0a2a('0xbc')]['Messages']=[];_0x462b34[_0x0a2a('0xbc')][_0x0a2a('0xbd')]['push'](_0x4e0790[_0x0a2a('0xbc')]);return _0x462b34;});})[_0x0a2a('0x38')](function(_0x11a91a){respondWithRpcPromise(_0x0a2a('0xbe'),_0x0a2a('0xbe'),{'FaxAccountId':_['isNil'](_0x2ae1fe['params']['id'])?undefined:_0x2ae1fe[_0x0a2a('0x61')]['id'],'path':_['isNil'](_0x2ae1fe[_0x0a2a('0x60')][_0x0a2a('0xab')][0x0][_0x0a2a('0x9')])?undefined:_0x2ae1fe[_0x0a2a('0x60')][_0x0a2a('0xab')][0x0]['path'],'fax':_['isNil'](_0x2ae1fe[_0x0a2a('0x60')]['to'][0x0])?undefined:_0x2ae1fe['body']['to'][0x0],'AttachmentId':_0x2ae1fe[_0x0a2a('0x60')]['attachments'][0x0]['id']},client9002)[_0x0a2a('0x38')](function(_0xbaf449){logger[_0x0a2a('0x25')](_0x0a2a('0xbf'),_0xbaf449);})[_0x0a2a('0x2c')](function(_0x3b1e67){logger[_0x0a2a('0x25')](_0x0a2a('0xbf'),_0x3b1e67);});return _0x11a91a;})['then'](respondWithResult(_0x4eb1fd,null))[_0x0a2a('0x2c')](handleError(_0x4eb1fd,null));};exports['addAgents']=function(_0xcae871,_0x1c0b6f,_0x11be07){return db[_0x0a2a('0x53')][_0x0a2a('0x5e')]({'where':{'id':_0xcae871[_0x0a2a('0x61')]['id']}})[_0x0a2a('0x38')](handleEntityNotFound(_0x1c0b6f,null))[_0x0a2a('0x38')](function(_0x1641c6){if(_0x1641c6){return _0x1641c6[_0x0a2a('0xc0')](_0xcae871['body'][_0x0a2a('0x6b')],_['omit'](_0xcae871[_0x0a2a('0x60')],[_0x0a2a('0x6b'),'id'])||{})[_0x0a2a('0xba')](function(_0x17ebbe){for(var _0x556067=0x0;_0x556067<_0xcae871[_0x0a2a('0x60')]['ids'][_0x0a2a('0x68')];_0x556067+=0x1){socket[_0x0a2a('0xc1')](_0x0a2a('0xc2'),{'UserId':Number(_0xcae871[_0x0a2a('0x60')][_0x0a2a('0x6b')][_0x556067]),'FaxAccountId':Number(_0xcae871[_0x0a2a('0x61')]['id'])});}return _0x17ebbe;});}})[_0x0a2a('0x38')](respondWithResult(_0x1c0b6f,null))[_0x0a2a('0x2c')](handleError(_0x1c0b6f,null));};exports[_0x0a2a('0xc3')]=function(_0x385152,_0xbaba01,_0x5618a9){return db[_0x0a2a('0x53')][_0x0a2a('0x5e')]({'where':{'id':_0x385152['params']['id']}})['then'](handleEntityNotFound(_0xbaba01,null))[_0x0a2a('0x38')](function(_0x79d06b){if(_0x79d06b){return _0x79d06b['removeAgents'](_0x385152['query']['ids'])[_0x0a2a('0x38')](function(){if(_['isArray'](_0x385152[_0x0a2a('0x44')][_0x0a2a('0x6b')])){for(var _0x56568b=0x0;_0x56568b<_0x385152[_0x0a2a('0x44')][_0x0a2a('0x6b')][_0x0a2a('0x68')];_0x56568b+=0x1){socket[_0x0a2a('0xc1')](_0x0a2a('0xc4'),{'UserId':Number(_0x385152[_0x0a2a('0x44')][_0x0a2a('0x6b')][_0x56568b]),'FaxAccountId':Number(_0x385152[_0x0a2a('0x61')]['id'])});}}else{socket[_0x0a2a('0xc1')](_0x0a2a('0xc4'),{'UserId':Number(_0x385152['query'][_0x0a2a('0x6b')]),'FaxAccountId':Number(_0x385152['params']['id'])});}});}})[_0x0a2a('0x38')](respondWithStatusCode(_0xbaba01,null))[_0x0a2a('0x2c')](handleError(_0xbaba01,null));};exports[_0x0a2a('0xc5')]=function(_0x9f8a4c,_0x350ed8,_0x129484){var _0x3e4a07={};var _0x3ce4f1={};var _0x4900df;var _0x2087f6;return db[_0x0a2a('0x53')][_0x0a2a('0x6f')]({'where':{'id':_0x9f8a4c[_0x0a2a('0x61')]['id']}})[_0x0a2a('0x38')](handleEntityNotFound(_0x350ed8,null))[_0x0a2a('0x38')](function(_0x3294ec){if(_0x3294ec){_0x4900df=_0x3294ec;_0x3ce4f1[_0x0a2a('0x42')]=_[_0x0a2a('0x45')](db['User'][_0x0a2a('0x67')]);_0x3ce4f1[_0x0a2a('0x44')]=_[_0x0a2a('0x45')](_0x9f8a4c[_0x0a2a('0x44')]);_0x3ce4f1[_0x0a2a('0x46')]=_[_0x0a2a('0x47')](_0x3ce4f1['model'],_0x3ce4f1['query']);_0x3e4a07[_0x0a2a('0x49')]=_[_0x0a2a('0x47')](_0x3ce4f1['model'],qs[_0x0a2a('0x48')](_0x9f8a4c[_0x0a2a('0x44')][_0x0a2a('0x48')]));_0x3e4a07[_0x0a2a('0x49')]=_0x3e4a07[_0x0a2a('0x49')]['length']?_0x3e4a07[_0x0a2a('0x49')]:_0x3ce4f1['model'];_0x3e4a07[_0x0a2a('0x4b')]=qs[_0x0a2a('0x4c')](_0x9f8a4c['query'][_0x0a2a('0x4c')]);_0x3e4a07[_0x0a2a('0x4f')]=qs[_0x0a2a('0x46')](_[_0x0a2a('0x4d')](_0x9f8a4c['query'],_0x3ce4f1[_0x0a2a('0x46')]));if(_0x9f8a4c[_0x0a2a('0x44')]['filter']){_0x3e4a07[_0x0a2a('0x4f')]=_[_0x0a2a('0x50')](_0x3e4a07[_0x0a2a('0x4f')],{'$or':_[_0x0a2a('0x43')](_0x3e4a07[_0x0a2a('0x49')],function(_0x176a75){var _0x26adfe={};_0x26adfe[_0x176a75]={'$like':'%'+_0x9f8a4c[_0x0a2a('0x44')][_0x0a2a('0x4e')]+'%'};return _0x26adfe;})});}_0x3e4a07=_[_0x0a2a('0x50')]({},_0x3e4a07,_0x9f8a4c['options']);return _0x4900df[_0x0a2a('0xc5')](_0x3e4a07);}})[_0x0a2a('0x38')](function(_0x271d69){if(_0x271d69){_0x2087f6=_0x271d69[_0x0a2a('0x68')];if(!_0x9f8a4c[_0x0a2a('0x44')][_0x0a2a('0x4a')](_0x0a2a('0x69'))){_0x3e4a07[_0x0a2a('0x31')]=qs[_0x0a2a('0x31')](_0x9f8a4c[_0x0a2a('0x44')][_0x0a2a('0x31')]);_0x3e4a07[_0x0a2a('0x33')]=qs[_0x0a2a('0x33')](_0x9f8a4c['query'][_0x0a2a('0x33')]);}return _0x4900df[_0x0a2a('0xc5')](_0x3e4a07);}})[_0x0a2a('0x38')](function(_0x5bb344){if(_0x5bb344){return _0x5bb344?{'count':_0x2087f6,'rows':_0x5bb344}:null;}})['then'](respondWithResult(_0x350ed8,null))[_0x0a2a('0x2c')](handleError(_0x350ed8,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index b460053..9b8101d 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 _0x73cb=['FaxAccount','setMaxListeners','remove','emit','hasOwnProperty','events','../../mysqldb'];(function(_0x295a3d,_0x56d487){var _0x23a732=function(_0x15cfc2){while(--_0x15cfc2){_0x295a3d['push'](_0x295a3d['shift']());}};_0x23a732(++_0x56d487);}(_0x73cb,0x101));var _0xb73c=function(_0x565e33,_0x352c79){_0x565e33=_0x565e33-0x0;var _0x49ab3d=_0x73cb[_0x565e33];return _0x49ab3d;};'use strict';var EventEmitter=require(_0xb73c('0x0'));var FaxAccount=require(_0xb73c('0x1'))['db'][_0xb73c('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xb73c('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xb73c('0x4')};function emitEvent(_0x52650f){return function(_0x42d885,_0x593bd6,_0x2dda00){FaxAccountEvents[_0xb73c('0x5')](_0x52650f+':'+_0x42d885['id'],_0x42d885);FaxAccountEvents['emit'](_0x52650f,_0x42d885);_0x2dda00(null);};}for(var e in events){if(events[_0xb73c('0x6')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file +var _0x8768=['exports','events','../../mysqldb','FaxAccount','setMaxListeners','save','update','remove','emit','hook'];(function(_0x4ce35c,_0x1cf5cd){var _0x554eaa=function(_0xc1ff26){while(--_0xc1ff26){_0x4ce35c['push'](_0x4ce35c['shift']());}};_0x554eaa(++_0x1cf5cd);}(_0x8768,0xa1));var _0x8876=function(_0x14dba5,_0x47d8ac){_0x14dba5=_0x14dba5-0x0;var _0x10cbc6=_0x8768[_0x14dba5];return _0x10cbc6;};'use strict';var EventEmitter=require(_0x8876('0x0'));var FaxAccount=require(_0x8876('0x1'))['db'][_0x8876('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x8876('0x3')](0x0);var events={'afterCreate':_0x8876('0x4'),'afterUpdate':_0x8876('0x5'),'afterDestroy':_0x8876('0x6')};function emitEvent(_0x1225be){return function(_0x281226,_0x3b436f,_0x270336){FaxAccountEvents[_0x8876('0x7')](_0x1225be+':'+_0x281226['id'],_0x281226);FaxAccountEvents[_0x8876('0x7')](_0x1225be,_0x281226);_0x270336(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0x8876('0x8')](e,emitEvent(event));}}module[_0x8876('0x9')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 7275be8..b875988 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 _0x2917=['bluebird','request-promise','path','../../config/environment','./faxAccount.attributes','define','FaxAccount','fax_accounts','lodash','../../config/logger','api'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2917,0x1b5));var _0x7291=function(_0x68ee8b,_0x3cc6c5){_0x68ee8b=_0x68ee8b-0x0;var _0x5148f7=_0x2917[_0x68ee8b];return _0x5148f7;};'use strict';var _=require(_0x7291('0x0'));var util=require('util');var logger=require(_0x7291('0x1'))(_0x7291('0x2'));var moment=require('moment');var BPromise=require(_0x7291('0x3'));var rp=require(_0x7291('0x4'));var fs=require('fs');var path=require(_0x7291('0x5'));var rimraf=require('rimraf');var config=require(_0x7291('0x6'));var attributes=require(_0x7291('0x7'));module['exports']=function(_0x21c861,_0x1980fb){return _0x21c861[_0x7291('0x8')](_0x7291('0x9'),attributes,{'tableName':_0x7291('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x72ee=['fax_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./faxAccount.attributes','exports'];(function(_0x94b6db,_0x4e2a54){var _0x207e5f=function(_0x261bc1){while(--_0x261bc1){_0x94b6db['push'](_0x94b6db['shift']());}};_0x207e5f(++_0x4e2a54);}(_0x72ee,0x151));var _0xe72e=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x72ee[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0xe72e('0x0'));var util=require(_0xe72e('0x1'));var logger=require(_0xe72e('0x2'))(_0xe72e('0x3'));var moment=require(_0xe72e('0x4'));var BPromise=require(_0xe72e('0x5'));var rp=require(_0xe72e('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe72e('0x7'));var config=require(_0xe72e('0x8'));var attributes=require(_0xe72e('0x9'));module[_0xe72e('0xa')]=function(_0x316769,_0xd2564f){return _0x316769['define']('FaxAccount',attributes,{'tableName':_0xe72e('0xb'),'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 0a67e5e..ee8980c 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 _0x5bc9=['find','CmList','Contacts','FaxApplication','List','get','applications','orderBy','priority','asc','account','Applications','defaults','create','FaxInteraction','Contact\x20not\x20found','spread','push','length','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','User','name','unshift','agent','Start','startRouting','util','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./faxAccount.socket','register','request','info','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetFaxAccount','FaxAccount','findAll','options','raw','where','limit','map','include','model','attributes','then','body','fax','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','keys','createdAt','updatedAt','difference','CompanyId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'];(function(_0x585d6d,_0x12e074){var _0x1636cf=function(_0x721242){while(--_0x721242){_0x585d6d['push'](_0x585d6d['shift']());}};_0x1636cf(++_0x12e074);}(_0x5bc9,0x1e9));var _0x95bc=function(_0x108f6a,_0x3f0882){_0x108f6a=_0x108f6a-0x0;var _0x5e8849=_0x5bc9[_0x108f6a];return _0x5e8849;};'use strict';var _=require('lodash');var util=require(_0x95bc('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x95bc('0x1'));var db=require(_0x95bc('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x95bc('0x3'))(_0x95bc('0x4'));var config=require(_0x95bc('0x5'));var jayson=require(_0x95bc('0x6'));var client=jayson[_0x95bc('0x7')][_0x95bc('0x8')]({'port':0x232c});config[_0x95bc('0x9')]=_['defaults'](config[_0x95bc('0x9')],{'host':_0x95bc('0xa'),'port':0x18eb});var socket=require(_0x95bc('0xb'))(new Redis(config[_0x95bc('0x9')]));require(_0x95bc('0xc'))[_0x95bc('0xd')](socket);function respondWithRpcPromise(_0x5190f,_0xb50a6f,_0xccced0){return new BPromise(function(_0x2cec0d,_0x4fd64f){return client[_0x95bc('0xe')](_0x5190f,_0xccced0)['then'](function(_0x21cf1c){logger[_0x95bc('0xf')](_0x95bc('0x10'),_0xb50a6f,'request\x20sent');logger[_0x95bc('0x11')](_0x95bc('0x12'),_0xb50a6f,_0x95bc('0x13'),JSON[_0x95bc('0x14')](_0x21cf1c));if(_0x21cf1c[_0x95bc('0x15')]){if(_0x21cf1c[_0x95bc('0x15')][_0x95bc('0x16')]===0x1f4){logger[_0x95bc('0x15')](_0x95bc('0x10'),_0xb50a6f,_0x21cf1c['error'][_0x95bc('0x17')]);return _0x4fd64f(_0x21cf1c['error'][_0x95bc('0x17')]);}logger['error'](_0x95bc('0x10'),_0xb50a6f,_0x21cf1c[_0x95bc('0x15')][_0x95bc('0x17')]);return _0x2cec0d(_0x21cf1c[_0x95bc('0x15')][_0x95bc('0x17')]);}else{logger[_0x95bc('0xf')]('FaxAccount,\x20%s,\x20%s',_0xb50a6f,_0x95bc('0x13'));_0x2cec0d(_0x21cf1c[_0x95bc('0x18')][_0x95bc('0x17')]);}})[_0x95bc('0x19')](function(_0x19bcbc){logger[_0x95bc('0x15')](_0x95bc('0x10'),_0xb50a6f,_0x19bcbc);_0x4fd64f(_0x19bcbc);});});}exports[_0x95bc('0x1a')]=function(_0x379194){var _0x2180da=this;return new Promise(function(_0x5bb802,_0x4c646a){return db[_0x95bc('0x1b')][_0x95bc('0x1c')]({'raw':_0x379194[_0x95bc('0x1d')]?_0x379194[_0x95bc('0x1d')][_0x95bc('0x1e')]===undefined?!![]:![]:!![],'where':_0x379194[_0x95bc('0x1d')]?_0x379194[_0x95bc('0x1d')][_0x95bc('0x1f')]||null:null,'attributes':_0x379194[_0x95bc('0x1d')]?_0x379194[_0x95bc('0x1d')]['attributes']||null:null,'limit':_0x379194[_0x95bc('0x1d')]?_0x379194['options'][_0x95bc('0x20')]||null:null,'include':_0x379194[_0x95bc('0x1d')]?_0x379194['options']['include']?_[_0x95bc('0x21')](_0x379194['options'][_0x95bc('0x22')],function(_0x4d0604){return{'model':db[_0x4d0604[_0x95bc('0x23')]],'as':_0x4d0604['as'],'attributes':_0x4d0604[_0x95bc('0x24')],'include':_0x4d0604[_0x95bc('0x22')]?_[_0x95bc('0x21')](_0x4d0604[_0x95bc('0x22')],function(_0x164550){return{'model':db[_0x164550['model']],'as':_0x164550['as'],'attributes':_0x164550['attributes'],'include':_0x164550[_0x95bc('0x22')]?_[_0x95bc('0x21')](_0x164550['include'],function(_0x1e0a3a){return{'model':db[_0x1e0a3a[_0x95bc('0x23')]],'as':_0x1e0a3a['as'],'attributes':_0x1e0a3a[_0x95bc('0x24')]};}):[]};}):[]};}):[]:[]})[_0x95bc('0x25')](function(_0x46ab0c){logger['info'](_0x95bc('0x1a'),_0x379194);logger['debug'](_0x95bc('0x1a'),_0x379194,JSON['stringify'](_0x46ab0c));_0x5bb802(_0x46ab0c);})['catch'](function(_0x43543c){logger[_0x95bc('0x15')](_0x95bc('0x1a'),_0x43543c[_0x95bc('0x17')],_0x379194);_0x4c646a(_0x2180da[_0x95bc('0x15')](0x1f4,_0x43543c[_0x95bc('0x17')]));});});};exports['NotifyFaxAccount']=function(_0x5a66c9,_0x5919c8,_0x48d0e9){var _0xf9b55b=this;return new Promise(function(_0x15ee81,_0x4bae69){var _0x37a598={'body':_0x5a66c9[_0x95bc('0x26')],'channel':_0x95bc('0x27')};var _0x7c32cd=[];var _0x3f3397=[];var _0x26f76f={};return db[_0x95bc('0x28')][_0x95bc('0x29')]()[_0x95bc('0x25')](function(_0x312306){if(!_0x312306){throw new db[(_0x95bc('0x2a'))][(_0x95bc('0x2b'))](_0x95bc('0x2c'));}_0x7c32cd=_['difference'](_[_0x95bc('0x2d')](_0x312306),[_0x95bc('0x2e'),_0x95bc('0x2f')]);_0x3f3397=_[_0x95bc('0x30')](_[_0x95bc('0x2d')](_0x312306),[_0x95bc('0x2e'),'updatedAt',_0x95bc('0x31'),'ListId']);if(_0x5a66c9['body']['id']){delete _0x5a66c9[_0x95bc('0x26')]['id'];}if(_[_0x95bc('0x32')](_0x5a66c9[_0x95bc('0x26')][_0x95bc('0x33')])){throw new db['Sequelize']['ValidationError'](_0x95bc('0x34'));}if(_['isNil'](_0x5a66c9[_0x95bc('0x26')]['body'])||_0x5a66c9['body']['body']===''){throw new db[(_0x95bc('0x2a'))][(_0x95bc('0x2b'))](_0x95bc('0x35'));}if(_[_0x95bc('0x32')](_0x5a66c9[_0x95bc('0x26')]['mapKey'])){throw new db[(_0x95bc('0x2a'))][(_0x95bc('0x2b'))](_0x95bc('0x36')+_0x3f3397);}if(!_['includes'](_0x3f3397,_0x5a66c9[_0x95bc('0x26')][_0x95bc('0x37')])){throw new db[(_0x95bc('0x2a'))][(_0x95bc('0x2b'))](_0x95bc('0x38')+_0x3f3397);}_0x26f76f[_0x5a66c9['body']['mapKey']]=_0x5a66c9[_0x95bc('0x26')][_0x95bc('0x33')];})['then'](function(){return db[_0x95bc('0x1b')][_0x95bc('0x39')]({'where':{'id':_0x5a66c9['account']['id']},'include':[{'model':db[_0x95bc('0x3a')],'as':'List','include':[{'model':db[_0x95bc('0x28')],'as':_0x95bc('0x3b'),'where':_0x26f76f,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x95bc('0x3c')],'as':'Applications'}]});})[_0x95bc('0x25')](function(_0x42345f){if(_0x42345f&&_0x42345f[_0x95bc('0x3d')]){var _0x34c158=_0x42345f[_0x95bc('0x3e')]({'plain':!![]});_0x37a598['account']=_0x34c158;_0x37a598[_0x95bc('0x3f')]=_0x34c158['Applications'];_0x37a598['list']=_0x34c158[_0x95bc('0x3d')];_0x37a598['applications']=_[_0x95bc('0x40')](_0x37a598[_0x95bc('0x3f')],[_0x95bc('0x41')],[_0x95bc('0x42')]);if(_0x37a598[_0x95bc('0x43')][_0x95bc('0x44')]){delete _0x37a598['account'][_0x95bc('0x44')];}if(_0x37a598[_0x95bc('0x43')][_0x95bc('0x3d')]&&_0x37a598[_0x95bc('0x43')]['List'][_0x95bc('0x3b')]['length']){return _0x37a598[_0x95bc('0x43')][_0x95bc('0x3d')][_0x95bc('0x3b')][0x0];}var _0x52e668=_[_0x95bc('0x45')](_0x5a66c9[_0x95bc('0x26')],{'firstName':_0x5a66c9[_0x95bc('0x26')]['from'],'ListId':_0x34c158['ListId']});_0x52e668[_0x5a66c9['body']['mapKey']]=_0x5a66c9['body']['from'];return db['CmContact'][_0x95bc('0x46')](_0x52e668,{'fields':_0x7c32cd,'raw':!![]});}})[_0x95bc('0x25')](function(_0x3794a0){_0x37a598['contact']=_0x3794a0;if(_0x3794a0){var _0xd0d612={'ContactId':_0x3794a0['id'],'FaxAccountId':_0x5a66c9[_0x95bc('0x43')]['id'],'fax':_0x3794a0[_0x95bc('0x27')]};return db[_0x95bc('0x47')][_0x95bc('0x39')]({'where':{'ContactId':_0x3794a0['id'],'closed':![],'FaxAccountId':_0x5a66c9[_0x95bc('0x43')]['id']}})[_0x95bc('0x25')](function(_0x3c5710){if(_0x3c5710){return[_0x3c5710,![]];}return db[_0x95bc('0x47')][_0x95bc('0x46')](_0xd0d612)[_0x95bc('0x25')](function(_0x53fa95){return[_0x53fa95,!![]];});});}else{throw new Error(_0x95bc('0x48'));}})[_0x95bc('0x49')](function(_0xc00026,_0x531e89){var _0x431a35=_0xc00026['get']({'plain':!![]});if(_0x531e89){if(_0x37a598[_0x95bc('0x43')]['autoclose']){_0x37a598['applications'][_0x95bc('0x4a')]({'id':0x0,'priority':_0x37a598[_0x95bc('0x3f')][_0x95bc('0x4b')]+0x1,'app':_0x95bc('0x4c'),'appdata':_0x95bc('0x4d'),'interval':_0x95bc('0x4e')});}_0x431a35['created']=!![];}else{_0x431a35[_0x95bc('0x4f')]=![];}_0x37a598[_0x95bc('0x50')]=_0x431a35;return db[_0x95bc('0x51')]['create']({'body':_0x5a66c9[_0x95bc('0x26')][_0x95bc('0x26')],'FaxAccountId':_0x5a66c9[_0x95bc('0x43')]['id'],'FaxInteractionId':_0xc00026['id'],'direction':'in','ContactId':_0xc00026[_0x95bc('0x52')],'AttachmentId':_0x5a66c9[_0x95bc('0x26')][_0x95bc('0x53')]});})[_0x95bc('0x25')](function(_0x2d86de){_0x37a598['message']=_0x2d86de;if(_0x37a598[_0x95bc('0x50')][_0x95bc('0x54')]){return db[_0x95bc('0x55')]['find']({'attributes':['id',_0x95bc('0x56')],'where':{'id':_0x37a598[_0x95bc('0x50')]['UserId']}})['then'](function(_0x1ede9c){if(_0x1ede9c){_0x37a598[_0x95bc('0x3f')][_0x95bc('0x57')]({'id':0x0,'priority':0x0,'app':_0x95bc('0x58'),'appdata':_0x1ede9c[_0x95bc('0x56')]+','+(_0x37a598[_0x95bc('0x43')]['waitForTheAssignedAgent']||0xa),'interval':_0x95bc('0x4e')});}return respondWithRpcPromise(_0x95bc('0x59'),_0x95bc('0x5a'),_0x37a598);});}return respondWithRpcPromise(_0x95bc('0x59'),_0x95bc('0x5a'),_0x37a598);})[_0x95bc('0x25')](function(_0xecbdb8){_0x15ee81(_0xecbdb8);})['catch'](function(_0x3c0ad9){_0x4bae69(_0xf9b55b[_0x95bc('0x15')](0x1f4,_0x3c0ad9['message']));});});}; \ No newline at end of file +var _0x40d0=['options','raw','where','attributes','limit','include','map','model','GetFaxAccount','debug','stringify','NotifyFaxAccount','fax','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','keys','updatedAt','ListId','body','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','FaxAccount','find','account','List','DESC','FaxApplication','get','applications','list','orderBy','priority','asc','Applications','length','Contacts','create','contact','FaxInteraction','Contact\x20not\x20found','spread','autoclose','push','close','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','util','moment','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','request','then','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','FaxAccount,\x20%s,\x20%s','message','info','result','catch','findAll'];(function(_0x511cb9,_0x5b4847){var _0x4927fe=function(_0x207859){while(--_0x207859){_0x511cb9['push'](_0x511cb9['shift']());}};_0x4927fe(++_0x5b4847);}(_0x40d0,0xf5));var _0x040d=function(_0x2204db,_0x5e00e5){_0x2204db=_0x2204db-0x0;var _0x30e9f6=_0x40d0[_0x2204db];return _0x30e9f6;};'use strict';var _=require('lodash');var util=require(_0x040d('0x0'));var moment=require(_0x040d('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(_0x040d('0x2'));var logger=require(_0x040d('0x3'))('rpc');var config=require(_0x040d('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x040d('0x5')][_0x040d('0x6')]({'port':0x232c});config[_0x040d('0x7')]=_[_0x040d('0x8')](config[_0x040d('0x7')],{'host':_0x040d('0x9'),'port':0x18eb});var socket=require(_0x040d('0xa'))(new Redis(config['redis']));require('./faxAccount.socket')['register'](socket);function respondWithRpcPromise(_0x41d767,_0x18a1c0,_0x489a5c){return new BPromise(function(_0x54b6c9,_0xcb39a4){return client[_0x040d('0xb')](_0x41d767,_0x489a5c)[_0x040d('0xc')](function(_0x2748dc){logger['info']('FaxAccount,\x20%s,\x20%s',_0x18a1c0,'request\x20sent');logger['debug'](_0x040d('0xd'),_0x18a1c0,_0x040d('0xe'),JSON['stringify'](_0x2748dc));if(_0x2748dc[_0x040d('0xf')]){if(_0x2748dc[_0x040d('0xf')]['code']===0x1f4){logger[_0x040d('0xf')](_0x040d('0x10'),_0x18a1c0,_0x2748dc['error']['message']);return _0xcb39a4(_0x2748dc[_0x040d('0xf')][_0x040d('0x11')]);}logger['error'](_0x040d('0x10'),_0x18a1c0,_0x2748dc[_0x040d('0xf')][_0x040d('0x11')]);return _0x54b6c9(_0x2748dc[_0x040d('0xf')][_0x040d('0x11')]);}else{logger[_0x040d('0x12')](_0x040d('0x10'),_0x18a1c0,_0x040d('0xe'));_0x54b6c9(_0x2748dc[_0x040d('0x13')]['message']);}})[_0x040d('0x14')](function(_0x4ac2d6){logger[_0x040d('0xf')](_0x040d('0x10'),_0x18a1c0,_0x4ac2d6);_0xcb39a4(_0x4ac2d6);});});}exports['GetFaxAccount']=function(_0x5dfa95){var _0x23a696=this;return new Promise(function(_0x410531,_0x591d55){return db['FaxAccount'][_0x040d('0x15')]({'raw':_0x5dfa95[_0x040d('0x16')]?_0x5dfa95[_0x040d('0x16')][_0x040d('0x17')]===undefined?!![]:![]:!![],'where':_0x5dfa95[_0x040d('0x16')]?_0x5dfa95[_0x040d('0x16')][_0x040d('0x18')]||null:null,'attributes':_0x5dfa95[_0x040d('0x16')]?_0x5dfa95[_0x040d('0x16')][_0x040d('0x19')]||null:null,'limit':_0x5dfa95['options']?_0x5dfa95[_0x040d('0x16')][_0x040d('0x1a')]||null:null,'include':_0x5dfa95[_0x040d('0x16')]?_0x5dfa95['options'][_0x040d('0x1b')]?_[_0x040d('0x1c')](_0x5dfa95[_0x040d('0x16')]['include'],function(_0x20da2f){return{'model':db[_0x20da2f[_0x040d('0x1d')]],'as':_0x20da2f['as'],'attributes':_0x20da2f[_0x040d('0x19')],'include':_0x20da2f[_0x040d('0x1b')]?_[_0x040d('0x1c')](_0x20da2f[_0x040d('0x1b')],function(_0x415e65){return{'model':db[_0x415e65[_0x040d('0x1d')]],'as':_0x415e65['as'],'attributes':_0x415e65[_0x040d('0x19')],'include':_0x415e65['include']?_[_0x040d('0x1c')](_0x415e65['include'],function(_0xe4cd3f){return{'model':db[_0xe4cd3f['model']],'as':_0xe4cd3f['as'],'attributes':_0xe4cd3f[_0x040d('0x19')]};}):[]};}):[]};}):[]:[]})[_0x040d('0xc')](function(_0x55df29){logger[_0x040d('0x12')](_0x040d('0x1e'),_0x5dfa95);logger[_0x040d('0x1f')]('GetFaxAccount',_0x5dfa95,JSON[_0x040d('0x20')](_0x55df29));_0x410531(_0x55df29);})[_0x040d('0x14')](function(_0x362c18){logger[_0x040d('0xf')](_0x040d('0x1e'),_0x362c18['message'],_0x5dfa95);_0x591d55(_0x23a696['error'](0x1f4,_0x362c18['message']));});});};exports[_0x040d('0x21')]=function(_0x587eaf,_0x44086a,_0x4a8c27){var _0x3b16be=this;return new Promise(function(_0x54ff26,_0x4d96ab){var _0x4cc488={'body':_0x587eaf['body'],'channel':_0x040d('0x22')};var _0x4189db=[];var _0x2848d9=[];var _0x515a6c={};return db[_0x040d('0x23')][_0x040d('0x24')]()[_0x040d('0xc')](function(_0x24ecc3){if(!_0x24ecc3){throw new db[(_0x040d('0x25'))][(_0x040d('0x26'))](_0x040d('0x27'));}_0x4189db=_[_0x040d('0x28')](_['keys'](_0x24ecc3),[_0x040d('0x29'),'updatedAt']);_0x2848d9=_['difference'](_[_0x040d('0x2a')](_0x24ecc3),[_0x040d('0x29'),_0x040d('0x2b'),'CompanyId',_0x040d('0x2c')]);if(_0x587eaf['body']['id']){delete _0x587eaf[_0x040d('0x2d')]['id'];}if(_['isNil'](_0x587eaf['body'][_0x040d('0x2e')])){throw new db[(_0x040d('0x25'))][(_0x040d('0x26'))](_0x040d('0x2f'));}if(_['isNil'](_0x587eaf[_0x040d('0x2d')][_0x040d('0x2d')])||_0x587eaf[_0x040d('0x2d')][_0x040d('0x2d')]===''){throw new db['Sequelize']['ValidationError'](_0x040d('0x30'));}if(_['isNil'](_0x587eaf['body'][_0x040d('0x31')])){throw new db['Sequelize'][(_0x040d('0x26'))](_0x040d('0x32')+_0x2848d9);}if(!_[_0x040d('0x33')](_0x2848d9,_0x587eaf[_0x040d('0x2d')][_0x040d('0x31')])){throw new db['Sequelize'][(_0x040d('0x26'))](_0x040d('0x34')+_0x2848d9);}_0x515a6c[_0x587eaf[_0x040d('0x2d')][_0x040d('0x31')]]=_0x587eaf[_0x040d('0x2d')][_0x040d('0x2e')];})[_0x040d('0xc')](function(){return db[_0x040d('0x35')][_0x040d('0x36')]({'where':{'id':_0x587eaf[_0x040d('0x37')]['id']},'include':[{'model':db['CmList'],'as':_0x040d('0x38'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x515a6c,'limit':0x1,'order':[['updatedAt',_0x040d('0x39')]]}]},{'model':db[_0x040d('0x3a')],'as':'Applications'}]});})['then'](function(_0x58611e){if(_0x58611e&&_0x58611e[_0x040d('0x38')]){var _0x52c49b=_0x58611e[_0x040d('0x3b')]({'plain':!![]});_0x4cc488[_0x040d('0x37')]=_0x52c49b;_0x4cc488[_0x040d('0x3c')]=_0x52c49b['Applications'];_0x4cc488[_0x040d('0x3d')]=_0x52c49b[_0x040d('0x38')];_0x4cc488[_0x040d('0x3c')]=_[_0x040d('0x3e')](_0x4cc488[_0x040d('0x3c')],[_0x040d('0x3f')],[_0x040d('0x40')]);if(_0x4cc488[_0x040d('0x37')][_0x040d('0x41')]){delete _0x4cc488[_0x040d('0x37')]['Applications'];}if(_0x4cc488[_0x040d('0x37')][_0x040d('0x38')]&&_0x4cc488['account']['List']['Contacts'][_0x040d('0x42')]){return _0x4cc488[_0x040d('0x37')][_0x040d('0x38')][_0x040d('0x43')][0x0];}var _0xe1c3df=_['defaults'](_0x587eaf[_0x040d('0x2d')],{'firstName':_0x587eaf[_0x040d('0x2d')][_0x040d('0x2e')],'ListId':_0x52c49b[_0x040d('0x2c')]});_0xe1c3df[_0x587eaf['body'][_0x040d('0x31')]]=_0x587eaf[_0x040d('0x2d')][_0x040d('0x2e')];return db['CmContact'][_0x040d('0x44')](_0xe1c3df,{'fields':_0x4189db,'raw':!![]});}})['then'](function(_0xd7b66e){_0x4cc488[_0x040d('0x45')]=_0xd7b66e;if(_0xd7b66e){var _0x511d01={'ContactId':_0xd7b66e['id'],'FaxAccountId':_0x587eaf[_0x040d('0x37')]['id'],'fax':_0xd7b66e[_0x040d('0x22')]};return db[_0x040d('0x46')][_0x040d('0x36')]({'where':{'ContactId':_0xd7b66e['id'],'closed':![],'FaxAccountId':_0x587eaf['account']['id']}})['then'](function(_0xa7fc5e){if(_0xa7fc5e){return[_0xa7fc5e,![]];}return db[_0x040d('0x46')][_0x040d('0x44')](_0x511d01)[_0x040d('0xc')](function(_0xeb4077){return[_0xeb4077,!![]];});});}else{throw new Error(_0x040d('0x47'));}})[_0x040d('0x48')](function(_0x1dba52,_0x448d78){var _0x454e6f=_0x1dba52['get']({'plain':!![]});if(_0x448d78){if(_0x4cc488[_0x040d('0x37')][_0x040d('0x49')]){_0x4cc488[_0x040d('0x3c')][_0x040d('0x4a')]({'id':0x0,'priority':_0x4cc488[_0x040d('0x3c')]['length']+0x1,'app':_0x040d('0x4b'),'appdata':'unmanaged','interval':_0x040d('0x4c')});}_0x454e6f[_0x040d('0x4d')]=!![];}else{_0x454e6f[_0x040d('0x4d')]=![];}_0x4cc488[_0x040d('0x4e')]=_0x454e6f;return db[_0x040d('0x4f')][_0x040d('0x44')]({'body':_0x587eaf[_0x040d('0x2d')][_0x040d('0x2d')],'FaxAccountId':_0x587eaf['account']['id'],'FaxInteractionId':_0x1dba52['id'],'direction':'in','ContactId':_0x1dba52[_0x040d('0x50')],'AttachmentId':_0x587eaf[_0x040d('0x2d')][_0x040d('0x51')]});})[_0x040d('0xc')](function(_0x4e14a9){_0x4cc488['message']=_0x4e14a9;if(_0x4cc488[_0x040d('0x4e')][_0x040d('0x52')]){return db[_0x040d('0x53')][_0x040d('0x36')]({'attributes':['id','name'],'where':{'id':_0x4cc488[_0x040d('0x4e')]['UserId']}})['then'](function(_0x11b983){if(_0x11b983){_0x4cc488[_0x040d('0x3c')][_0x040d('0x54')]({'id':0x0,'priority':0x0,'app':_0x040d('0x55'),'appdata':_0x11b983['name']+','+(_0x4cc488[_0x040d('0x37')][_0x040d('0x56')]||0xa),'interval':_0x040d('0x4c')});}return respondWithRpcPromise(_0x040d('0x57'),_0x040d('0x58'),_0x4cc488);});}return respondWithRpcPromise(_0x040d('0x57'),_0x040d('0x58'),_0x4cc488);})[_0x040d('0xc')](function(_0xd8116d){_0x54ff26(_0xd8116d);})[_0x040d('0x14')](function(_0xb8500){_0x4d96ab(_0x3b16be[_0x040d('0xf')](0x1f4,_0xb8500[_0x040d('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index d46ed05..0a71179 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 _0x60c8=['remove','update','emit','removeListener','register','length','./faxAccount.events','save'];(function(_0x5293a1,_0x351c64){var _0x5085aa=function(_0x3c3bd8){while(--_0x3c3bd8){_0x5293a1['push'](_0x5293a1['shift']());}};_0x5085aa(++_0x351c64);}(_0x60c8,0x196));var _0x860c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x60c8[_0x14add3];return _0x4a174f;};'use strict';var FaxAccountEvents=require(_0x860c('0x0'));var events=[_0x860c('0x1'),_0x860c('0x2'),_0x860c('0x3')];function createListener(_0x52ce16,_0x4bc8ff){return function(_0x5c5cc5){_0x4bc8ff[_0x860c('0x4')](_0x52ce16,_0x5c5cc5);};}function removeListener(_0x267b8e,_0x57479f){return function(){FaxAccountEvents[_0x860c('0x5')](_0x267b8e,_0x57479f);};}exports[_0x860c('0x6')]=function(_0x6506c4){for(var _0x1a0dc6=0x0,_0x500a0e=events[_0x860c('0x7')];_0x1a0dc6<_0x500a0e;_0x1a0dc6++){var _0x4f41dd=events[_0x1a0dc6];var _0x1f64fb=createListener('faxAccount:'+_0x4f41dd,_0x6506c4);FaxAccountEvents['on'](_0x4f41dd,_0x1f64fb);}}; \ No newline at end of file +var _0x3071=['save','remove','emit','removeListener','register','length','faxAccount:','./faxAccount.events'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0x3071,0x1cf));var _0x1307=function(_0x47b15f,_0x103e93){_0x47b15f=_0x47b15f-0x0;var _0x55bf25=_0x3071[_0x47b15f];return _0x55bf25;};'use strict';var FaxAccountEvents=require(_0x1307('0x0'));var events=[_0x1307('0x1'),_0x1307('0x2'),'update'];function createListener(_0xfbde1f,_0x6d0cee){return function(_0xcd0c77){_0x6d0cee[_0x1307('0x3')](_0xfbde1f,_0xcd0c77);};}function removeListener(_0x260b72,_0x68ffb6){return function(){FaxAccountEvents[_0x1307('0x4')](_0x260b72,_0x68ffb6);};}exports[_0x1307('0x5')]=function(_0x5bcf0b){for(var _0x42ebe4=0x0,_0x3803a2=events[_0x1307('0x6')];_0x42ebe4<_0x3803a2;_0x42ebe4++){var _0xaa0063=events[_0x42ebe4];var _0x368791=createListener(_0x1307('0x7')+_0xaa0063,_0x5bcf0b);FaxAccountEvents['on'](_0xaa0063,_0x368791);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 7cb6bd2..ba4298c 100644 --- a/server/api/faxAccount/index.js +++ b/server/api/faxAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0x2ac105,_0x3527f9){var _0xd2ff6f=function(_0x2b3a75){while(--_0x2b3a75){_0x2ac105['push'](_0x2ac105['shift']());}};_0xd2ff6f(++_0x3527f9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0x9becf1,_0xd30b8){var _0x19ac7c=function(_0x220916){while(--_0x220916){_0x9becf1['push'](_0x9becf1['shift']());}};_0x19ac7c(++_0xd30b8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index cd18196..671159c 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 _0xf06e=['STRING','*,*,*,*','sequelize','INTEGER'];(function(_0x1d592d,_0xaa238b){var _0x26d8e1=function(_0x4c7633){while(--_0x4c7633){_0x1d592d['push'](_0x1d592d['shift']());}};_0x26d8e1(++_0xaa238b);}(_0xf06e,0x1ca));var _0xef06=function(_0x59014a,_0x3e6dd8){_0x59014a=_0x59014a-0x0;var _0x5ccb49=_0xf06e[_0x59014a];return _0x5ccb49;};'use strict';var Sequelize=require(_0xef06('0x0'));module['exports']={'priority':{'type':Sequelize[_0xef06('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xef06('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xef06('0x2')]},'interval':{'type':Sequelize[_0xef06('0x2')],'defaultValue':_0xef06('0x3')}}; \ No newline at end of file +var _0x1240=['sequelize','exports','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1240,0x150));var _0x0124=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x1240[_0xbd08b4];return _0x314f1e;};'use strict';var Sequelize=require(_0x0124('0x0'));module[_0x0124('0x1')]={'priority':{'type':Sequelize[_0x0124('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x0124('0x3')],'allowNull':![],'defaultValue':_0x0124('0x4')},'appdata':{'type':Sequelize[_0x0124('0x5')]()},'description':{'type':Sequelize[_0x0124('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x0124('0x6')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 0a5a932..3b6adb6 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 _0x98e9=['destroy','error','stack','name','send','index','map','FaxApplication','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../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','update','then'];(function(_0x56f835,_0x17a238){var _0x13053f=function(_0x1c27f7){while(--_0x1c27f7){_0x56f835['push'](_0x56f835['shift']());}};_0x13053f(++_0x17a238);}(_0x98e9,0x147));var _0x998e=function(_0x2a622c,_0x292665){_0x2a622c=_0x2a622c-0x0;var _0x5817ee=_0x98e9[_0x2a622c];return _0x5817ee;};'use strict';var emlformat=require(_0x998e('0x0'));var rimraf=require(_0x998e('0x1'));var zipdir=require(_0x998e('0x2'));var jsonpatch=require(_0x998e('0x3'));var rp=require(_0x998e('0x4'));var moment=require(_0x998e('0x5'));var BPromise=require(_0x998e('0x6'));var Mustache=require(_0x998e('0x7'));var util=require(_0x998e('0x8'));var path=require(_0x998e('0x9'));var sox=require(_0x998e('0xa'));var csv=require(_0x998e('0xb'));var ejs=require(_0x998e('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x998e('0xd'));var jsforce=require(_0x998e('0xe'));var deskjs=require(_0x998e('0xf'));var toCsv=require(_0x998e('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x998e('0x10'));var authService=require(_0x998e('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x998e('0x12'));var logger=require('../../config/logger')(_0x998e('0x13'));var utils=require(_0x998e('0x14'));var config=require(_0x998e('0x15'));var licenseUtil=require(_0x998e('0x16'));var db=require(_0x998e('0x17'))['db'];function respondWithStatusCode(_0xa140a3,_0x5b8ef7){_0x5b8ef7=_0x5b8ef7||0xcc;return function(_0x1c5b58){if(_0x1c5b58){return _0xa140a3[_0x998e('0x18')](_0x5b8ef7);}return _0xa140a3[_0x998e('0x19')](_0x5b8ef7)[_0x998e('0x1a')]();};}function respondWithResult(_0x5dea62,_0xd73a3a){_0xd73a3a=_0xd73a3a||0xc8;return function(_0x1dd7f7){if(_0x1dd7f7){return _0x5dea62[_0x998e('0x19')](_0xd73a3a)[_0x998e('0x1b')](_0x1dd7f7);}};}function respondWithFilteredResult(_0x5755da,_0x3ff91a){return function(_0x3027da){if(_0x3027da){var _0x109cbe=typeof _0x3ff91a[_0x998e('0x1c')]===_0x998e('0x1d')&&typeof _0x3ff91a[_0x998e('0x1e')]===_0x998e('0x1d');var _0x19e370=_0x3027da['count'];var _0x26a067=_0x109cbe?0x0:_0x3ff91a[_0x998e('0x1c')];var _0x3eec5d=_0x109cbe?_0x3027da[_0x998e('0x1f')]:_0x3ff91a[_0x998e('0x1c')]+_0x3ff91a[_0x998e('0x1e')];var _0x2f3397;if(_0x3eec5d>=_0x19e370){_0x3eec5d=_0x19e370;_0x2f3397=0xc8;}else{_0x2f3397=0xce;}_0x5755da[_0x998e('0x19')](_0x2f3397);return _0x5755da[_0x998e('0x20')](_0x998e('0x21'),_0x26a067+'-'+_0x3eec5d+'/'+_0x19e370)[_0x998e('0x1b')](_0x3027da);}return null;};}function patchUpdates(_0x41efcc){return function(_0x1a88ef){try{jsonpatch[_0x998e('0x22')](_0x1a88ef,_0x41efcc,!![]);}catch(_0x128a66){return BPromise[_0x998e('0x23')](_0x128a66);}return _0x1a88ef['save']();};}function saveUpdates(_0x1e7f2c,_0x538efd){return function(_0xc3e807){if(_0xc3e807){return _0xc3e807[_0x998e('0x24')](_0x1e7f2c)[_0x998e('0x25')](function(_0x18086e){return _0x18086e;});}return null;};}function removeEntity(_0x40b463,_0x44e152){return function(_0x30f97d){if(_0x30f97d){return _0x30f97d[_0x998e('0x26')]()[_0x998e('0x25')](function(){_0x40b463[_0x998e('0x19')](0xcc)[_0x998e('0x1a')]();});}};}function handleEntityNotFound(_0x57f533,_0x51780f){return function(_0x3eff86){if(!_0x3eff86){_0x57f533[_0x998e('0x18')](0x194);}return _0x3eff86;};}function handleError(_0x4720e4,_0x465adf){_0x465adf=_0x465adf||0x1f4;return function(_0x4d67bc){logger[_0x998e('0x27')](_0x4d67bc[_0x998e('0x28')]);if(_0x4d67bc['name']){delete _0x4d67bc[_0x998e('0x29')];}_0x4720e4[_0x998e('0x19')](_0x465adf)[_0x998e('0x2a')](_0x4d67bc);};}exports[_0x998e('0x2b')]=function(_0x2ca7af,_0x1077f0){var _0x591e84={},_0x5ee78d={},_0x34ba33={'count':0x0,'rows':[]};var _0x5c4f92=_[_0x998e('0x2c')](db[_0x998e('0x2d')][_0x998e('0x2e')],function(_0x2499b3){return{'name':_0x2499b3['fieldName'],'type':_0x2499b3[_0x998e('0x2f')]['key']};});_0x5ee78d[_0x998e('0x30')]=_[_0x998e('0x2c')](_0x5c4f92,'name');_0x5ee78d[_0x998e('0x31')]=_[_0x998e('0x32')](_0x2ca7af[_0x998e('0x31')]);_0x5ee78d[_0x998e('0x33')]=_[_0x998e('0x34')](_0x5ee78d[_0x998e('0x30')],_0x5ee78d[_0x998e('0x31')]);_0x591e84[_0x998e('0x35')]=_[_0x998e('0x34')](_0x5ee78d[_0x998e('0x30')],qs[_0x998e('0x36')](_0x2ca7af[_0x998e('0x31')][_0x998e('0x36')]));_0x591e84['attributes']=_0x591e84[_0x998e('0x35')][_0x998e('0x37')]?_0x591e84[_0x998e('0x35')]:_0x5ee78d[_0x998e('0x30')];if(!_0x2ca7af[_0x998e('0x31')][_0x998e('0x38')]('nolimit')){_0x591e84[_0x998e('0x1e')]=qs[_0x998e('0x1e')](_0x2ca7af[_0x998e('0x31')][_0x998e('0x1e')]);_0x591e84['offset']=qs['offset'](_0x2ca7af[_0x998e('0x31')]['offset']);}_0x591e84[_0x998e('0x39')]=qs['sort'](_0x2ca7af[_0x998e('0x31')]['sort']);_0x591e84['where']=qs[_0x998e('0x33')](_[_0x998e('0x3a')](_0x2ca7af[_0x998e('0x31')],_0x5ee78d[_0x998e('0x33')]),_0x5c4f92);if(_0x2ca7af['query'][_0x998e('0x3b')]){_0x591e84[_0x998e('0x3c')]=_[_0x998e('0x3d')](_0x591e84[_0x998e('0x3c')],{'$or':_[_0x998e('0x2c')](_0x5c4f92,function(_0x196d88){if(_0x196d88[_0x998e('0x2f')]!==_0x998e('0x3e')){var _0x401051={};_0x401051[_0x196d88[_0x998e('0x29')]]={'$like':'%'+_0x2ca7af[_0x998e('0x31')][_0x998e('0x3b')]+'%'};return _0x401051;}})});}_0x591e84=_['merge']({},_0x591e84,_0x2ca7af[_0x998e('0x3f')]);var _0x2be90f={'where':_0x591e84['where']};return db[_0x998e('0x2d')][_0x998e('0x1f')](_0x2be90f)[_0x998e('0x25')](function(_0xb4c654){_0x34ba33['count']=_0xb4c654;if(_0x2ca7af[_0x998e('0x31')][_0x998e('0x40')]){_0x591e84[_0x998e('0x41')]=[{'all':!![]}];}return db[_0x998e('0x2d')]['findAll'](_0x591e84);})['then'](function(_0x174aab){_0x34ba33[_0x998e('0x42')]=_0x174aab;return _0x34ba33;})[_0x998e('0x25')](respondWithFilteredResult(_0x1077f0,_0x591e84))[_0x998e('0x43')](handleError(_0x1077f0,null));};exports[_0x998e('0x44')]=function(_0x1b2118,_0x3433ac){var _0x2a999d={'raw':!![],'where':{'id':_0x1b2118['params']['id']}},_0x5e0506={};_0x5e0506[_0x998e('0x30')]=_[_0x998e('0x32')](db[_0x998e('0x2d')][_0x998e('0x2e')]);_0x5e0506['query']=_[_0x998e('0x32')](_0x1b2118['query']);_0x5e0506[_0x998e('0x33')]=_[_0x998e('0x34')](_0x5e0506[_0x998e('0x30')],_0x5e0506[_0x998e('0x31')]);_0x2a999d['attributes']=_[_0x998e('0x34')](_0x5e0506[_0x998e('0x30')],qs[_0x998e('0x36')](_0x1b2118['query'][_0x998e('0x36')]));_0x2a999d['attributes']=_0x2a999d[_0x998e('0x35')]['length']?_0x2a999d[_0x998e('0x35')]:_0x5e0506[_0x998e('0x30')];if(_0x1b2118[_0x998e('0x31')][_0x998e('0x40')]){_0x2a999d[_0x998e('0x41')]=[{'all':!![]}];}_0x2a999d=_['merge']({},_0x2a999d,_0x1b2118[_0x998e('0x3f')]);return db[_0x998e('0x2d')][_0x998e('0x45')](_0x2a999d)['then'](handleEntityNotFound(_0x3433ac,null))[_0x998e('0x25')](respondWithResult(_0x3433ac,null))['catch'](handleError(_0x3433ac,null));};exports[_0x998e('0x46')]=function(_0x1f7a9f,_0x760a0f){return db['FaxApplication'][_0x998e('0x46')](_0x1f7a9f[_0x998e('0x47')],{})[_0x998e('0x25')](respondWithResult(_0x760a0f,0xc9))[_0x998e('0x43')](handleError(_0x760a0f,null));};exports[_0x998e('0x24')]=function(_0x45e906,_0xbc8b33){if(_0x45e906[_0x998e('0x47')]['id']){delete _0x45e906[_0x998e('0x47')]['id'];}return db[_0x998e('0x2d')][_0x998e('0x45')]({'where':{'id':_0x45e906[_0x998e('0x48')]['id']}})['then'](handleEntityNotFound(_0xbc8b33,null))[_0x998e('0x25')](saveUpdates(_0x45e906[_0x998e('0x47')],null))[_0x998e('0x25')](respondWithResult(_0xbc8b33,null))[_0x998e('0x43')](handleError(_0xbc8b33,null));};exports[_0x998e('0x26')]=function(_0x1fc6ff,_0x35e0c9){return db[_0x998e('0x2d')][_0x998e('0x45')]({'where':{'id':_0x1fc6ff[_0x998e('0x48')]['id']}})['then'](handleEntityNotFound(_0x35e0c9,null))[_0x998e('0x25')](removeEntity(_0x35e0c9,null))[_0x998e('0x43')](handleError(_0x35e0c9,null));}; \ No newline at end of file +var _0x341c=['undefined','limit','count','set','Content-Range','apply','save','end','stack','name','send','FaxApplication','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','then','includeAll','findAll','rows','catch','params','include','find','body','destroy','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset'];(function(_0x582e59,_0x5380ce){var _0x5e4c8f=function(_0x1fe890){while(--_0x1fe890){_0x582e59['push'](_0x582e59['shift']());}};_0x5e4c8f(++_0x5380ce);}(_0x341c,0xb7));var _0xc341=function(_0x33b986,_0x40da5f){_0x33b986=_0x33b986-0x0;var _0x4ddaca=_0x341c[_0x33b986];return _0x4ddaca;};'use strict';var emlformat=require(_0xc341('0x0'));var rimraf=require(_0xc341('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc341('0x2'));var rp=require(_0xc341('0x3'));var moment=require(_0xc341('0x4'));var BPromise=require(_0xc341('0x5'));var Mustache=require('mustache');var util=require(_0xc341('0x6'));var path=require(_0xc341('0x7'));var sox=require(_0xc341('0x8'));var csv=require('to-csv');var ejs=require(_0xc341('0x9'));var fs=require('fs');var fs_extra=require(_0xc341('0xa'));var _=require(_0xc341('0xb'));var squel=require(_0xc341('0xc'));var crypto=require(_0xc341('0xd'));var jsforce=require(_0xc341('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc341('0xf'));var Papa=require(_0xc341('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc341('0x11'));var as=require(_0xc341('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc341('0x13'))(_0xc341('0x14'));var utils=require(_0xc341('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc341('0x16'))['db'];function respondWithStatusCode(_0x1a87ef,_0x412cb9){_0x412cb9=_0x412cb9||0xcc;return function(_0x3adee9){if(_0x3adee9){return _0x1a87ef[_0xc341('0x17')](_0x412cb9);}return _0x1a87ef['status'](_0x412cb9)['end']();};}function respondWithResult(_0x2c49c2,_0x19aecf){_0x19aecf=_0x19aecf||0xc8;return function(_0xeb68f0){if(_0xeb68f0){return _0x2c49c2[_0xc341('0x18')](_0x19aecf)[_0xc341('0x19')](_0xeb68f0);}};}function respondWithFilteredResult(_0x558688,_0x1e9e8f){return function(_0x4083d1){if(_0x4083d1){var _0x459a6b=typeof _0x1e9e8f[_0xc341('0x1a')]===_0xc341('0x1b')&&typeof _0x1e9e8f[_0xc341('0x1c')]===_0xc341('0x1b');var _0x3581d3=_0x4083d1['count'];var _0x35b0b0=_0x459a6b?0x0:_0x1e9e8f['offset'];var _0x3df42e=_0x459a6b?_0x4083d1[_0xc341('0x1d')]:_0x1e9e8f['offset']+_0x1e9e8f[_0xc341('0x1c')];var _0x2c1c90;if(_0x3df42e>=_0x3581d3){_0x3df42e=_0x3581d3;_0x2c1c90=0xc8;}else{_0x2c1c90=0xce;}_0x558688['status'](_0x2c1c90);return _0x558688[_0xc341('0x1e')](_0xc341('0x1f'),_0x35b0b0+'-'+_0x3df42e+'/'+_0x3581d3)[_0xc341('0x19')](_0x4083d1);}return null;};}function patchUpdates(_0x14735b){return function(_0x1f6fa9){try{jsonpatch[_0xc341('0x20')](_0x1f6fa9,_0x14735b,!![]);}catch(_0x208ea6){return BPromise['reject'](_0x208ea6);}return _0x1f6fa9[_0xc341('0x21')]();};}function saveUpdates(_0x10c9fe,_0x3f1e21){return function(_0x2f027e){if(_0x2f027e){return _0x2f027e['update'](_0x10c9fe)['then'](function(_0x3e603b){return _0x3e603b;});}return null;};}function removeEntity(_0x4fcf33,_0x186afd){return function(_0x1e11f7){if(_0x1e11f7){return _0x1e11f7['destroy']()['then'](function(){_0x4fcf33['status'](0xcc)[_0xc341('0x22')]();});}};}function handleEntityNotFound(_0x39af48,_0x15d28a){return function(_0x137a22){if(!_0x137a22){_0x39af48[_0xc341('0x17')](0x194);}return _0x137a22;};}function handleError(_0x28c494,_0x561bd9){_0x561bd9=_0x561bd9||0x1f4;return function(_0x1f6bc0){logger['error'](_0x1f6bc0[_0xc341('0x23')]);if(_0x1f6bc0['name']){delete _0x1f6bc0[_0xc341('0x24')];}_0x28c494[_0xc341('0x18')](_0x561bd9)[_0xc341('0x25')](_0x1f6bc0);};}exports['index']=function(_0xe5823d,_0x48e68f){var _0x56c26e={},_0x27b40e={},_0x1ae420={'count':0x0,'rows':[]};var _0x4b27ab=_['map'](db[_0xc341('0x26')]['rawAttributes'],function(_0x41b163){return{'name':_0x41b163[_0xc341('0x27')],'type':_0x41b163[_0xc341('0x28')][_0xc341('0x29')]};});_0x27b40e['model']=_['map'](_0x4b27ab,_0xc341('0x24'));_0x27b40e['query']=_[_0xc341('0x2a')](_0xe5823d[_0xc341('0x2b')]);_0x27b40e[_0xc341('0x2c')]=_[_0xc341('0x2d')](_0x27b40e[_0xc341('0x2e')],_0x27b40e[_0xc341('0x2b')]);_0x56c26e[_0xc341('0x2f')]=_[_0xc341('0x2d')](_0x27b40e['model'],qs[_0xc341('0x30')](_0xe5823d[_0xc341('0x2b')][_0xc341('0x30')]));_0x56c26e[_0xc341('0x2f')]=_0x56c26e['attributes'][_0xc341('0x31')]?_0x56c26e['attributes']:_0x27b40e[_0xc341('0x2e')];if(!_0xe5823d['query'][_0xc341('0x32')](_0xc341('0x33'))){_0x56c26e[_0xc341('0x1c')]=qs[_0xc341('0x1c')](_0xe5823d[_0xc341('0x2b')][_0xc341('0x1c')]);_0x56c26e[_0xc341('0x1a')]=qs['offset'](_0xe5823d[_0xc341('0x2b')][_0xc341('0x1a')]);}_0x56c26e[_0xc341('0x34')]=qs['sort'](_0xe5823d[_0xc341('0x2b')][_0xc341('0x35')]);_0x56c26e[_0xc341('0x36')]=qs['filters'](_[_0xc341('0x37')](_0xe5823d[_0xc341('0x2b')],_0x27b40e[_0xc341('0x2c')]),_0x4b27ab);if(_0xe5823d[_0xc341('0x2b')][_0xc341('0x38')]){_0x56c26e['where']=_['merge'](_0x56c26e[_0xc341('0x36')],{'$or':_['map'](_0x4b27ab,function(_0x338bfa){if(_0x338bfa[_0xc341('0x28')]!==_0xc341('0x39')){var _0x1e9312={};_0x1e9312[_0x338bfa[_0xc341('0x24')]]={'$like':'%'+_0xe5823d['query'][_0xc341('0x38')]+'%'};return _0x1e9312;}})});}_0x56c26e=_[_0xc341('0x3a')]({},_0x56c26e,_0xe5823d[_0xc341('0x3b')]);var _0x17786a={'where':_0x56c26e[_0xc341('0x36')]};return db['FaxApplication'][_0xc341('0x1d')](_0x17786a)[_0xc341('0x3c')](function(_0x25f97c){_0x1ae420['count']=_0x25f97c;if(_0xe5823d[_0xc341('0x2b')][_0xc341('0x3d')]){_0x56c26e['include']=[{'all':!![]}];}return db['FaxApplication'][_0xc341('0x3e')](_0x56c26e);})[_0xc341('0x3c')](function(_0x4e34cc){_0x1ae420[_0xc341('0x3f')]=_0x4e34cc;return _0x1ae420;})[_0xc341('0x3c')](respondWithFilteredResult(_0x48e68f,_0x56c26e))[_0xc341('0x40')](handleError(_0x48e68f,null));};exports['show']=function(_0x4d2788,_0x1734a4){var _0x565b94={'raw':!![],'where':{'id':_0x4d2788[_0xc341('0x41')]['id']}},_0x500036={};_0x500036[_0xc341('0x2e')]=_[_0xc341('0x2a')](db[_0xc341('0x26')]['rawAttributes']);_0x500036['query']=_[_0xc341('0x2a')](_0x4d2788[_0xc341('0x2b')]);_0x500036[_0xc341('0x2c')]=_[_0xc341('0x2d')](_0x500036[_0xc341('0x2e')],_0x500036[_0xc341('0x2b')]);_0x565b94[_0xc341('0x2f')]=_[_0xc341('0x2d')](_0x500036[_0xc341('0x2e')],qs[_0xc341('0x30')](_0x4d2788[_0xc341('0x2b')][_0xc341('0x30')]));_0x565b94[_0xc341('0x2f')]=_0x565b94['attributes'][_0xc341('0x31')]?_0x565b94[_0xc341('0x2f')]:_0x500036['model'];if(_0x4d2788[_0xc341('0x2b')]['includeAll']){_0x565b94[_0xc341('0x42')]=[{'all':!![]}];}_0x565b94=_[_0xc341('0x3a')]({},_0x565b94,_0x4d2788[_0xc341('0x3b')]);return db[_0xc341('0x26')][_0xc341('0x43')](_0x565b94)[_0xc341('0x3c')](handleEntityNotFound(_0x1734a4,null))[_0xc341('0x3c')](respondWithResult(_0x1734a4,null))['catch'](handleError(_0x1734a4,null));};exports['create']=function(_0x1a85c1,_0x222285){return db[_0xc341('0x26')]['create'](_0x1a85c1[_0xc341('0x44')],{})[_0xc341('0x3c')](respondWithResult(_0x222285,0xc9))[_0xc341('0x40')](handleError(_0x222285,null));};exports['update']=function(_0x26dd39,_0x180616){if(_0x26dd39[_0xc341('0x44')]['id']){delete _0x26dd39[_0xc341('0x44')]['id'];}return db['FaxApplication']['find']({'where':{'id':_0x26dd39[_0xc341('0x41')]['id']}})['then'](handleEntityNotFound(_0x180616,null))[_0xc341('0x3c')](saveUpdates(_0x26dd39[_0xc341('0x44')],null))['then'](respondWithResult(_0x180616,null))[_0xc341('0x40')](handleError(_0x180616,null));};exports[_0xc341('0x45')]=function(_0x5eaa3c,_0x2dc3cf){return db[_0xc341('0x26')][_0xc341('0x43')]({'where':{'id':_0x5eaa3c['params']['id']}})['then'](handleEntityNotFound(_0x2dc3cf,null))[_0xc341('0x3c')](removeEntity(_0x2dc3cf,null))[_0xc341('0x40')](handleError(_0x2dc3cf,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 00b8249..7c4a4bc 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 _0x3a55=['path','rimraf','../../config/environment','./faxApplication.attributes','exports','define','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','request-promise'];(function(_0x2ccf6d,_0x1fa30d){var _0x3f8790=function(_0xb95d2){while(--_0xb95d2){_0x2ccf6d['push'](_0x2ccf6d['shift']());}};_0x3f8790(++_0x1fa30d);}(_0x3a55,0x91));var _0x53a5=function(_0x43f687,_0x1d9e90){_0x43f687=_0x43f687-0x0;var _0x4596c9=_0x3a55[_0x43f687];return _0x4596c9;};'use strict';var _=require('lodash');var util=require(_0x53a5('0x0'));var logger=require(_0x53a5('0x1'))(_0x53a5('0x2'));var moment=require(_0x53a5('0x3'));var BPromise=require('bluebird');var rp=require(_0x53a5('0x4'));var fs=require('fs');var path=require(_0x53a5('0x5'));var rimraf=require(_0x53a5('0x6'));var config=require(_0x53a5('0x7'));var attributes=require(_0x53a5('0x8'));module[_0x53a5('0x9')]=function(_0x52143f,_0x54b6a8){return _0x52143f[_0x53a5('0xa')](_0x53a5('0xb'),attributes,{'tableName':_0x53a5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x53a5('0xd'),'collate':_0x53a5('0xe')});}; \ No newline at end of file +var _0xf272=['../../config/logger','moment','bluebird','path','rimraf','exports','define','FaxApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0xf272,0x196));var _0x2f27=function(_0x9633a1,_0x4b19b8){_0x9633a1=_0x9633a1-0x0;var _0x24b005=_0xf272[_0x9633a1];return _0x24b005;};'use strict';var _=require(_0x2f27('0x0'));var util=require(_0x2f27('0x1'));var logger=require(_0x2f27('0x2'))('api');var moment=require(_0x2f27('0x3'));var BPromise=require(_0x2f27('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2f27('0x5'));var rimraf=require(_0x2f27('0x6'));var config=require('../../config/environment');var attributes=require('./faxApplication.attributes');module[_0x2f27('0x7')]=function(_0x3ef060,_0x44777e){return _0x3ef060[_0x2f27('0x8')](_0x2f27('0x9'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2f27('0xa'),'collate':_0x2f27('0xb')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 8fd6697..2f18763 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 _0x5d08=['request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','error','message','FaxApplication,\x20%s,\x20%s','result','UpdateFaxApplication','FaxApplication','body','raw','options','where','attributes','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0xeed9aa,_0x3ee97a){var _0x18dd67=function(_0x5c01fb){while(--_0x5c01fb){_0xeed9aa['push'](_0xeed9aa['shift']());}};_0x18dd67(++_0x3ee97a);}(_0x5d08,0x1e0));var _0x85d0=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x5d08[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x85d0('0x0'));var util=require(_0x85d0('0x1'));var moment=require(_0x85d0('0x2'));var BPromise=require('bluebird');var rs=require(_0x85d0('0x3'));var fs=require('fs');var Redis=require(_0x85d0('0x4'));var db=require(_0x85d0('0x5'))['db'];var utils=require(_0x85d0('0x6'));var logger=require(_0x85d0('0x7'))(_0x85d0('0x8'));var config=require(_0x85d0('0x9'));var jayson=require(_0x85d0('0xa'));var client=jayson[_0x85d0('0xb')][_0x85d0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5f4663,_0x23c2ba,_0x2e4326){return new BPromise(function(_0x306803,_0x3c6270){return client[_0x85d0('0xd')](_0x5f4663,_0x2e4326)[_0x85d0('0xe')](function(_0xd17356){logger[_0x85d0('0xf')]('FaxApplication,\x20%s,\x20%s',_0x23c2ba,_0x85d0('0x10'));logger[_0x85d0('0x11')](_0x85d0('0x12'),_0x23c2ba,_0x85d0('0x10'),JSON['stringify'](_0xd17356));if(_0xd17356[_0x85d0('0x13')]){if(_0xd17356['error']['code']===0x1f4){logger[_0x85d0('0x13')]('FaxApplication,\x20%s,\x20%s',_0x23c2ba,_0xd17356[_0x85d0('0x13')][_0x85d0('0x14')]);return _0x3c6270(_0xd17356['error'][_0x85d0('0x14')]);}logger[_0x85d0('0x13')](_0x85d0('0x15'),_0x23c2ba,_0xd17356[_0x85d0('0x13')][_0x85d0('0x14')]);return _0x306803(_0xd17356[_0x85d0('0x13')][_0x85d0('0x14')]);}else{logger[_0x85d0('0xf')](_0x85d0('0x15'),_0x23c2ba,_0x85d0('0x10'));_0x306803(_0xd17356[_0x85d0('0x16')][_0x85d0('0x14')]);}})['catch'](function(_0x4539e9){logger[_0x85d0('0x13')](_0x85d0('0x15'),_0x23c2ba,_0x4539e9);_0x3c6270(_0x4539e9);});});}exports[_0x85d0('0x17')]=function(_0x2df1b6){var _0x1a5c49=this;return new Promise(function(_0x9d880,_0x196537){return db[_0x85d0('0x18')]['update'](_0x2df1b6[_0x85d0('0x19')],{'raw':_0x2df1b6['options']?_0x2df1b6['options'][_0x85d0('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2df1b6[_0x85d0('0x1b')]?_0x2df1b6['options'][_0x85d0('0x1c')]||null:null,'attributes':_0x2df1b6[_0x85d0('0x1b')]?_0x2df1b6['options'][_0x85d0('0x1d')]||null:null,'limit':_0x2df1b6[_0x85d0('0x1b')]?_0x2df1b6[_0x85d0('0x1b')]['limit']||null:null})[_0x85d0('0xe')](function(_0x17f41f){logger['info'](_0x85d0('0x17'),_0x2df1b6);logger['debug']('UpdateFaxApplication',_0x2df1b6,JSON[_0x85d0('0x1e')](_0x17f41f));_0x9d880(_0x17f41f);})['catch'](function(_0x2c5d70){logger[_0x85d0('0x13')](_0x85d0('0x17'),_0x2c5d70[_0x85d0('0x14')],_0x2df1b6);_0x196537(_0x1a5c49[_0x85d0('0x13')](0x1f4,_0x2c5d70[_0x85d0('0x14')]));});});}; \ No newline at end of file +var _0x8e82=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateFaxApplication','FaxApplication','update','body','options','raw','where','limit','then','lodash','util','moment','randomstring'];(function(_0x1ad1be,_0x440ad){var _0x279e73=function(_0x4292f3){while(--_0x4292f3){_0x1ad1be['push'](_0x1ad1be['shift']());}};_0x279e73(++_0x440ad);}(_0x8e82,0xb0));var _0x28e8=function(_0x55f15e,_0x2fa3ac){_0x55f15e=_0x55f15e-0x0;var _0x21d019=_0x8e82[_0x55f15e];return _0x21d019;};'use strict';var _=require(_0x28e8('0x0'));var util=require(_0x28e8('0x1'));var moment=require(_0x28e8('0x2'));var BPromise=require('bluebird');var rs=require(_0x28e8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x28e8('0x4'))['db'];var utils=require(_0x28e8('0x5'));var logger=require(_0x28e8('0x6'))(_0x28e8('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x28e8('0x8')][_0x28e8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x555c5d,_0x2696bd,_0x336041){return new BPromise(function(_0x23acf5,_0x43d28e){return client[_0x28e8('0xa')](_0x555c5d,_0x336041)['then'](function(_0x3145b4){logger[_0x28e8('0xb')](_0x28e8('0xc'),_0x2696bd,_0x28e8('0xd'));logger[_0x28e8('0xe')](_0x28e8('0xf'),_0x2696bd,_0x28e8('0xd'),JSON[_0x28e8('0x10')](_0x3145b4));if(_0x3145b4[_0x28e8('0x11')]){if(_0x3145b4[_0x28e8('0x11')]['code']===0x1f4){logger['error'](_0x28e8('0xc'),_0x2696bd,_0x3145b4[_0x28e8('0x11')]['message']);return _0x43d28e(_0x3145b4[_0x28e8('0x11')][_0x28e8('0x12')]);}logger[_0x28e8('0x11')](_0x28e8('0xc'),_0x2696bd,_0x3145b4[_0x28e8('0x11')][_0x28e8('0x12')]);return _0x23acf5(_0x3145b4['error'][_0x28e8('0x12')]);}else{logger[_0x28e8('0xb')](_0x28e8('0xc'),_0x2696bd,_0x28e8('0xd'));_0x23acf5(_0x3145b4[_0x28e8('0x13')][_0x28e8('0x12')]);}})[_0x28e8('0x14')](function(_0x230ad0){logger[_0x28e8('0x11')](_0x28e8('0xc'),_0x2696bd,_0x230ad0);_0x43d28e(_0x230ad0);});});}exports[_0x28e8('0x15')]=function(_0x1064f8){var _0x2eb23c=this;return new Promise(function(_0x31d4ad,_0x5d996f){return db[_0x28e8('0x16')][_0x28e8('0x17')](_0x1064f8[_0x28e8('0x18')],{'raw':_0x1064f8[_0x28e8('0x19')]?_0x1064f8['options'][_0x28e8('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1064f8['options']?_0x1064f8[_0x28e8('0x19')][_0x28e8('0x1b')]||null:null,'attributes':_0x1064f8['options']?_0x1064f8[_0x28e8('0x19')]['attributes']||null:null,'limit':_0x1064f8['options']?_0x1064f8[_0x28e8('0x19')][_0x28e8('0x1c')]||null:null})[_0x28e8('0x1d')](function(_0x999094){logger[_0x28e8('0xb')](_0x28e8('0x15'),_0x1064f8);logger[_0x28e8('0xe')]('UpdateFaxApplication',_0x1064f8,JSON['stringify'](_0x999094));_0x31d4ad(_0x999094);})['catch'](function(_0x4fcaa6){logger['error'](_0x28e8('0x15'),_0x4fcaa6['message'],_0x1064f8);_0x5d996f(_0x2eb23c['error'](0x1f4,_0x4fcaa6[_0x28e8('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 96f81c8..2fa2265 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(_0x5c7dcf,_0x2b36e3){var _0x3156f6=function(_0x5e7681){while(--_0x5e7681){_0x5c7dcf['push'](_0x5c7dcf['shift']());}};_0x3156f6(++_0x2b36e3);}(_0x4024,0x89));var _0x4402=function(_0x2bbcd4,_0x18ac4c){_0x2bbcd4=_0x2bbcd4-0x0;var _0x4172d2=_0x4024[_0x2bbcd4];return _0x4172d2;};'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 _0xe5b5=['../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x421eb2,_0x2393de){var _0x2b5e00=function(_0xb9957d){while(--_0xb9957d){_0x421eb2['push'](_0x421eb2['shift']());}};_0x2b5e00(++_0x2393de);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x581960,_0x1232ff){_0x581960=_0x581960-0x0;var _0x4ee892=_0xe5b5[_0x581960];return _0x4ee892;};'use strict';var multer=require(_0x5e5b('0x0'));var util=require(_0x5e5b('0x1'));var path=require(_0x5e5b('0x2'));var timeout=require(_0x5e5b('0x3'));var express=require(_0x5e5b('0x4'));var router=express[_0x5e5b('0x5')]();var fs_extra=require(_0x5e5b('0x6'));var auth=require(_0x5e5b('0x7'));var interaction=require(_0x5e5b('0x8'));var config=require(_0x5e5b('0x9'));var controller=require(_0x5e5b('0xa'));router[_0x5e5b('0xb')]('/',auth[_0x5e5b('0xc')](),controller[_0x5e5b('0xd')]);router[_0x5e5b('0xb')](_0x5e5b('0xe'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0xf')]);router[_0x5e5b('0x10')]('/',auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x11')]);router[_0x5e5b('0x12')](_0x5e5b('0xe'),auth['isAuthenticated'](),controller[_0x5e5b('0x13')]);router['delete'](_0x5e5b('0xe'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x14')]);module[_0x5e5b('0x15')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 2ed9000..192238a 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 _0x2e78=['DATE','STRING','ENUM','out','sequelize','exports','BOOLEAN'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2e78,0x1af));var _0x82e7=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x2e78[_0x6131cd];return _0x47e916;};'use strict';var Sequelize=require(_0x82e7('0x0'));module[_0x82e7('0x1')]={'closed':{'type':Sequelize[_0x82e7('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x82e7('0x3')]},'disposition':{'type':Sequelize[_0x82e7('0x4')]},'secondDisposition':{'type':Sequelize[_0x82e7('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x82e7('0x4')]},'read1stAt':{'type':Sequelize[_0x82e7('0x3')]},'fax':{'type':Sequelize[_0x82e7('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x82e7('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x82e7('0x5')]('in',_0x82e7('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xae7e=['DATE','STRING','out','ENUM','sequelize','BOOLEAN'];(function(_0x559fe3,_0x3340bc){var _0xf915f6=function(_0x427b81){while(--_0x427b81){_0x559fe3['push'](_0x559fe3['shift']());}};_0xf915f6(++_0x3340bc);}(_0xae7e,0x19c));var _0xeae7=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xae7e[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0xeae7('0x0'));module['exports']={'closed':{'type':Sequelize[_0xeae7('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xeae7('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xeae7('0x3')]},'thirdDisposition':{'type':Sequelize[_0xeae7('0x3')]},'note':{'type':Sequelize[_0xeae7('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0xeae7('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xeae7('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xeae7('0x5')]('in',_0xeae7('0x4')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index c13e97f..ae1759b 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 _0x6dff=['body','find','describe','addMessage','FaxMessage','ids','omit','getMessages','findOne','hasOwnProperty','nolimit','sort','where','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','include','rows','addTags','spread','Tag','color','faxInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','tmp','attachments','push','Attachment','Messages','get','mkdirSync','createReadStream','pipe','basename','resolve','log','unlinkSync','moment','bluebird','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','localhost','./faxInteraction.socket','register','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','getOptions','findAll','fax','query','user','catch','show','params','model','keys','FaxInteraction','filters','intersection','fields','attributes','length','includeAll','merge','options','create'];(function(_0x1867e3,_0x589b2d){var _0x4b22aa=function(_0x36a685){while(--_0x36a685){_0x1867e3['push'](_0x1867e3['shift']());}};_0x4b22aa(++_0x589b2d);}(_0x6dff,0xf7));var _0xf6df=function(_0x23bcd6,_0x3ee6eb){_0x23bcd6=_0x23bcd6-0x0;var _0x805d85=_0x6dff[_0x23bcd6];return _0x805d85;};'use strict';var rimraf=require('rimraf');var zipdir=require('zip-dir');var moment=require(_0xf6df('0x0'));var BPromise=require(_0xf6df('0x1'));var util=require('util');var path=require(_0xf6df('0x2'));var fs=require('fs');var _=require(_0xf6df('0x3'));var Redis=require(_0xf6df('0x4'));var interaction=require(_0xf6df('0x5'));var qs=require(_0xf6df('0x6'));var logger=require('../../config/logger')(_0xf6df('0x7'));var config=require(_0xf6df('0x8'));var db=require(_0xf6df('0x9'))['db'];config[_0xf6df('0xa')]=_['defaults'](config['redis'],{'host':_0xf6df('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf6df('0xa')]));require(_0xf6df('0xc'))[_0xf6df('0xd')](socket);function respondWithStatusCode(_0x50e027,_0x33f686){_0x33f686=_0x33f686||0xcc;return function(_0x5ea244){if(_0x5ea244){return _0x50e027[_0xf6df('0xe')](_0x33f686);}return _0x50e027[_0xf6df('0xf')](_0x33f686)[_0xf6df('0x10')]();};}function respondWithResult(_0x35316b,_0x406edb){_0x406edb=_0x406edb||0xc8;return function(_0x9ef351){if(_0x9ef351){return _0x35316b[_0xf6df('0xf')](_0x406edb)['json'](_0x9ef351);}};}function respondWithFilteredResult(_0x4a7930,_0x2ae29b){return function(_0xd0a45d){if(_0xd0a45d){var _0xf65b=typeof _0x2ae29b[_0xf6df('0x11')]===_0xf6df('0x12')&&typeof _0x2ae29b['limit']===_0xf6df('0x12');var _0x13efb4=_0xd0a45d[_0xf6df('0x13')];var _0x17c039=_0xf65b?0x0:_0x2ae29b[_0xf6df('0x11')];var _0x4a9d43=_0xf65b?_0xd0a45d['count']:_0x2ae29b['offset']+_0x2ae29b[_0xf6df('0x14')];var _0x893b2c;if(_0x4a9d43>=_0x13efb4){_0x4a9d43=_0x13efb4;_0x893b2c=0xc8;}else{_0x893b2c=0xce;}_0x4a7930[_0xf6df('0xf')](_0x893b2c);return _0x4a7930[_0xf6df('0x15')](_0xf6df('0x16'),_0x17c039+'-'+_0x4a9d43+'/'+_0x13efb4)['json'](_0xd0a45d);}return null;};}function saveUpdates(_0xd02cf2){return function(_0x24e728){if(_0x24e728){return _0x24e728[_0xf6df('0x17')](_0xd02cf2)[_0xf6df('0x18')](function(_0x5b9566){return _0x5b9566;});}return null;};}function removeEntity(_0x808e5f){return function(_0x1fa0f2){if(_0x1fa0f2){return _0x1fa0f2[_0xf6df('0x19')]()[_0xf6df('0x18')](function(){_0x808e5f[_0xf6df('0xf')](0xcc)[_0xf6df('0x10')]();});}};}function handleEntityNotFound(_0x1f540b){return function(_0x1dc656){if(!_0x1dc656){_0x1f540b[_0xf6df('0xe')](0x194);}return _0x1dc656;};}function handleError(_0x5bc210,_0x418831){_0x418831=_0x418831||0x1f4;return function(_0x17ea06){logger[_0xf6df('0x1a')](_0x17ea06[_0xf6df('0x1b')]);if(_0x17ea06[_0xf6df('0x1c')]){delete _0x17ea06['name'];}_0x5bc210['status'](_0x418831)[_0xf6df('0x1d')](_0x17ea06);};}exports[_0xf6df('0x1e')]=function(_0x154276,_0x2d30b5){var _0x18c654={};var _0x458243=_[_0xf6df('0x1f')](db['FaxInteraction'][_0xf6df('0x20')],function(_0x4be9a0){return{'name':_0x4be9a0[_0xf6df('0x21')],'type':_0x4be9a0[_0xf6df('0x22')][_0xf6df('0x23')]};});_0x18c654=qs[_0xf6df('0x24')](_0x458243,_0x154276);return interaction[_0xf6df('0x25')](_0xf6df('0x26'),_0x154276[_0xf6df('0x27')],_0x154276[_0xf6df('0x28')],_0x18c654,_0x458243)[_0xf6df('0x18')](respondWithFilteredResult(_0x2d30b5,_0x18c654))[_0xf6df('0x29')](handleError(_0x2d30b5,null));};exports[_0xf6df('0x2a')]=function(_0x455e27,_0x404d01){var _0x12d7a1={'raw':![],'where':{'id':_0x455e27[_0xf6df('0x2b')]['id']}},_0x28bfaf={};_0x28bfaf[_0xf6df('0x2c')]=_[_0xf6df('0x2d')](db[_0xf6df('0x2e')][_0xf6df('0x20')]);_0x28bfaf['query']=_['keys'](_0x455e27[_0xf6df('0x27')]);_0x28bfaf[_0xf6df('0x2f')]=_['intersection'](_0x28bfaf[_0xf6df('0x2c')],_0x28bfaf[_0xf6df('0x27')]);_0x12d7a1['attributes']=_[_0xf6df('0x30')](_0x28bfaf[_0xf6df('0x2c')],qs[_0xf6df('0x31')](_0x455e27[_0xf6df('0x27')][_0xf6df('0x31')]));_0x12d7a1[_0xf6df('0x32')]=_0x12d7a1[_0xf6df('0x32')][_0xf6df('0x33')]?_0x12d7a1[_0xf6df('0x32')]:_0x28bfaf[_0xf6df('0x2c')];if(_0x455e27['query'][_0xf6df('0x34')]){_0x12d7a1['include']=[{'all':!![]}];}_0x12d7a1=_[_0xf6df('0x35')]({},_0x12d7a1,_0x455e27[_0xf6df('0x36')]);return db['FaxInteraction']['find'](_0x12d7a1)['then'](handleEntityNotFound(_0x404d01,null))[_0xf6df('0x18')](respondWithResult(_0x404d01,null))[_0xf6df('0x29')](handleError(_0x404d01,null));};exports[_0xf6df('0x37')]=function(_0x4730eb,_0x52a083){return db[_0xf6df('0x2e')]['create'](_0x4730eb[_0xf6df('0x38')],{})[_0xf6df('0x18')](respondWithResult(_0x52a083,0xc9))[_0xf6df('0x29')](handleError(_0x52a083,null));};exports[_0xf6df('0x17')]=function(_0x2b5182,_0x29d5f6){if(_0x2b5182[_0xf6df('0x38')]['id']){delete _0x2b5182[_0xf6df('0x38')]['id'];}return db[_0xf6df('0x2e')][_0xf6df('0x39')]({'where':{'id':_0x2b5182[_0xf6df('0x2b')]['id']}})[_0xf6df('0x18')](handleEntityNotFound(_0x29d5f6,null))[_0xf6df('0x18')](saveUpdates(_0x2b5182[_0xf6df('0x38')],null))[_0xf6df('0x18')](respondWithResult(_0x29d5f6,null))[_0xf6df('0x29')](handleError(_0x29d5f6,null));};exports['destroy']=function(_0x48d8ab,_0x464c14){return db[_0xf6df('0x2e')]['find']({'where':{'id':_0x48d8ab['params']['id']}})[_0xf6df('0x18')](handleEntityNotFound(_0x464c14,null))[_0xf6df('0x18')](removeEntity(_0x464c14,null))[_0xf6df('0x29')](handleError(_0x464c14,null));};exports[_0xf6df('0x3a')]=function(_0xb43d8b,_0x1e102d){return db[_0xf6df('0x2e')][_0xf6df('0x3a')]()[_0xf6df('0x18')](respondWithResult(_0x1e102d,null))[_0xf6df('0x29')](handleError(_0x1e102d,null));};exports[_0xf6df('0x3b')]=function(_0x1d2e4f,_0xb2387a){return db[_0xf6df('0x3c')][_0xf6df('0x39')]({'where':{'id':_0x1d2e4f[_0xf6df('0x2b')]['id']}})[_0xf6df('0x18')](handleEntityNotFound(_0xb2387a,null))[_0xf6df('0x18')](function(_0x571e6e){if(_0x571e6e){return _0x571e6e['addMessage'](_0x1d2e4f[_0xf6df('0x38')][_0xf6df('0x3d')],_[_0xf6df('0x3e')](_0x1d2e4f['body'],[_0xf6df('0x3d'),'id'])||{});}})[_0xf6df('0x18')](respondWithResult(_0xb2387a,null))['catch'](handleError(_0xb2387a,null));};exports[_0xf6df('0x3f')]=function(_0x1e72c1,_0x3c951a){var _0x375bf1={'raw':![],'where':{}};var _0x64dee1={};var _0x590327={'count':0x0,'rows':[]};return db[_0xf6df('0x2e')][_0xf6df('0x40')]({'where':{'id':_0x1e72c1[_0xf6df('0x2b')]['id']}})[_0xf6df('0x18')](handleEntityNotFound(_0x3c951a,null))[_0xf6df('0x18')](function(_0x5f20cf){if(_0x5f20cf){_0x64dee1[_0xf6df('0x2c')]=_[_0xf6df('0x2d')](db[_0xf6df('0x3c')][_0xf6df('0x20')]);_0x64dee1['query']=_[_0xf6df('0x2d')](_0x1e72c1[_0xf6df('0x27')]);_0x64dee1['filters']=_[_0xf6df('0x30')](_0x64dee1['model'],_0x64dee1['query']);_0x375bf1[_0xf6df('0x32')]=_[_0xf6df('0x30')](_0x64dee1[_0xf6df('0x2c')],qs['fields'](_0x1e72c1[_0xf6df('0x27')][_0xf6df('0x31')]));_0x375bf1[_0xf6df('0x32')]=_0x375bf1[_0xf6df('0x32')]['length']?_0x375bf1[_0xf6df('0x32')]:_0x64dee1['model'];if(!_0x1e72c1[_0xf6df('0x27')][_0xf6df('0x41')](_0xf6df('0x42'))){_0x375bf1[_0xf6df('0x14')]=qs['limit'](_0x1e72c1[_0xf6df('0x27')]['limit']);_0x375bf1[_0xf6df('0x11')]=qs[_0xf6df('0x11')](_0x1e72c1[_0xf6df('0x27')][_0xf6df('0x11')]);}_0x375bf1['order']=qs[_0xf6df('0x43')](_0x1e72c1[_0xf6df('0x27')]['sort']);_0x375bf1[_0xf6df('0x44')]=qs['filters'](_['pick'](_0x1e72c1[_0xf6df('0x27')],_0x64dee1[_0xf6df('0x2f')]));_0x375bf1['where']['FaxInteractionId']=_0x5f20cf['id'];if(_0x1e72c1['query'][_0xf6df('0x45')]){_0x375bf1['where']=_[_0xf6df('0x35')](_0x375bf1['where'],{'$or':_[_0xf6df('0x1f')](_0x375bf1[_0xf6df('0x32')],function(_0x1df84d){var _0x594f65={};_0x594f65[_0x1df84d]={'$like':'%'+_0x1e72c1[_0xf6df('0x27')][_0xf6df('0x45')]+'%'};return _0x594f65;})});}if(_0x1e72c1[_0xf6df('0x27')]['$gte']){var _0x532587=_0x1e72c1['query'][_0xf6df('0x46')]['split'](',');var _0x1f3352={};_0x1f3352[_0x532587[0x0]]={'$gte':moment(_0x532587[0x1])[_0xf6df('0x47')](_0xf6df('0x48'))};_0x375bf1['where']=_[_0xf6df('0x35')](_0x375bf1[_0xf6df('0x44')],_0x1f3352);}_0x375bf1=_['merge']({},_0x375bf1,_0x1e72c1['options']);return db[_0xf6df('0x3c')][_0xf6df('0x13')]({'where':_0x375bf1[_0xf6df('0x44')]})[_0xf6df('0x18')](function(_0x21d5c2){_0x590327['count']=_0x21d5c2;if(_0x1e72c1[_0xf6df('0x27')]['includeAll']){_0x375bf1[_0xf6df('0x49')]=[{'all':!![]}];}return db[_0xf6df('0x3c')][_0xf6df('0x25')](_0x375bf1);})[_0xf6df('0x18')](function(_0x1f996e){_0x590327[_0xf6df('0x4a')]=_0x1f996e;return _0x590327;});}})[_0xf6df('0x18')](respondWithFilteredResult(_0x3c951a,_0x375bf1))[_0xf6df('0x29')](handleError(_0x3c951a,null));};exports[_0xf6df('0x4b')]=function(_0x18145a,_0x20d785){return db[_0xf6df('0x2e')][_0xf6df('0x39')]({'where':{'id':_0x18145a[_0xf6df('0x2b')]['id']}})[_0xf6df('0x18')](handleEntityNotFound(_0x20d785,null))[_0xf6df('0x18')](function(_0xe56ffb){if(_0xe56ffb){return _0xe56ffb['setTags'](_0x18145a[_0xf6df('0x38')][_0xf6df('0x3d')],_['omit'](_0x18145a[_0xf6df('0x38')],['ids','id'])||{})[_0xf6df('0x4c')](function(){return db[_0xf6df('0x4d')][_0xf6df('0x25')]({'attributes':['id',_0xf6df('0x1c'),_0xf6df('0x4e')],'where':{'id':_0x18145a[_0xf6df('0x38')][_0xf6df('0x3d')]}});})[_0xf6df('0x18')](function(_0xf6a8f4){socket['emit'](_0xf6df('0x4f'),{'id':Number(_0x18145a[_0xf6df('0x2b')]['id']),'tags':_0xf6a8f4||[]});return{'id':Number(_0x18145a[_0xf6df('0x2b')]['id']),'tags':_0xf6a8f4||[]};});}})[_0xf6df('0x18')](respondWithResult(_0x20d785,null))[_0xf6df('0x29')](handleError(_0x20d785,null));};exports[_0xf6df('0x50')]=function(_0x7c2777,_0x1bb2cb){return db[_0xf6df('0x2e')][_0xf6df('0x39')]({'where':{'id':_0x7c2777[_0xf6df('0x2b')]['id']}})[_0xf6df('0x18')](handleEntityNotFound(_0x1bb2cb,null))[_0xf6df('0x18')](function(_0x3dbcac){if(_0x3dbcac){return _0x3dbcac[_0xf6df('0x50')](_0x7c2777[_0xf6df('0x27')][_0xf6df('0x3d')]);}})[_0xf6df('0x18')](respondWithStatusCode(_0x1bb2cb,null))['catch'](handleError(_0x1bb2cb,null));};exports[_0xf6df('0x51')]=function(_0x4351f4,_0x2844df){var _0x1f374d=moment()[_0xf6df('0x52')]()[_0xf6df('0x53')]();var _0x1e23f4=path[_0xf6df('0x54')](config[_0xf6df('0x55')],_0xf6df('0x56'),_0xf6df('0x57'),_0xf6df('0x58'));var _0xa893b4=path[_0xf6df('0x54')](config[_0xf6df('0x55')],_0xf6df('0x56'),_0xf6df('0x57'),_0xf6df('0x59'));var _0xe30bc3=path[_0xf6df('0x54')](_0x1e23f4,_0x1f374d);var _0x4c77db=util[_0xf6df('0x47')]('transcript-%d-%s.zip',_0x4351f4['params']['id'],_0x1f374d);var _0x36c233=path['join'](_0x1e23f4,_0x4c77db);var _0x1882c=[];_0x1882c[_0xf6df('0x5a')]({'model':db[_0xf6df('0x5b')],'as':'Attachment','raw':!![]});var _0xf1325f=[{'model':db[_0xf6df('0x3c')],'as':_0xf6df('0x5c'),'attributes':['id',_0xf6df('0x38'),'createdAt'],'include':_0x1882c}];return db[_0xf6df('0x2e')]['find']({'where':{'id':_0x4351f4['params']['id']},'include':_0xf1325f})[_0xf6df('0x18')](handleEntityNotFound(_0x2844df,null))[_0xf6df('0x18')](function(_0x2d10e2){if(_0x2d10e2&&_0x2d10e2[_0xf6df('0x5c')]){var _0x504e23=_0x2d10e2[_0xf6df('0x5d')]({'plain':!![]});fs[_0xf6df('0x5e')](_0xe30bc3);for(var _0x15d142=0x0;_0x15d142<_0x504e23[_0xf6df('0x5c')][_0xf6df('0x33')];_0x15d142++){var _0x2efc70=_0x504e23[_0xf6df('0x5c')][_0x15d142][_0xf6df('0x5b')];if(_0x2efc70){var _0x205845=path['join'](_0xa893b4,_0x2efc70['basename']);if(fs['existsSync'](_0x205845)){fs[_0xf6df('0x5f')](_0x205845)[_0xf6df('0x60')](fs['createWriteStream'](path[_0xf6df('0x54')](_0xe30bc3,_0x2efc70[_0xf6df('0x61')])));}}}return BPromise[_0xf6df('0x62')]()['then'](function(){return new BPromise(function(_0x3e1234,_0x578bf4){zipdir(_0xe30bc3,{'saveTo':_0x36c233},function(_0x344672,_0x74223b){if(_0x344672)return _0x578bf4(_0x344672);return _0x3e1234(_0x74223b);});})[_0xf6df('0x18')](function(){return new BPromise(function(_0xa58851,_0x4e0526){rimraf(_0xe30bc3,function(_0x4429ad){if(_0x4429ad)_0x4e0526(_0x4429ad);return _0xa58851();});});})[_0xf6df('0x18')](function(){return _0x2844df[_0xf6df('0x51')](_0x36c233,_0x4c77db,function(_0x9b5e27){if(_0x9b5e27){console[_0xf6df('0x63')]('err',_0x9b5e27);}else{fs[_0xf6df('0x64')](_0x36c233);}});});});}else{return _0x2844df[_0xf6df('0xe')](0xc8);}})[_0xf6df('0x29')](handleError(_0x2844df,null));}; \ No newline at end of file +var _0xdc2f=['socket.io-emitter','./faxInteraction.socket','register','status','end','json','offset','undefined','count','limit','set','update','then','sendStatus','error','stack','name','send','map','FaxInteraction','rawAttributes','fieldName','type','findAll','fax','user','catch','show','params','keys','query','intersection','attributes','model','fields','length','includeAll','include','options','find','create','body','destroy','describe','addMessage','FaxMessage','omit','ids','getMessages','filters','hasOwnProperty','sort','where','pick','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','merge','rows','addTags','setTags','Tag','color','emit','faxInteractionTags:save','removeTags','download','unix','join','root','files','tmp','server','attachments','transcript-%d-%s.zip','Attachment','Messages','createdAt','mkdirSync','existsSync','createReadStream','pipe','createWriteStream','basename','resolve','log','err','unlinkSync','rimraf','zip-dir','moment','util','path','lodash','../../components/interaction/service','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost'];(function(_0x14e55c,_0x422443){var _0x45d284=function(_0x1e28ca){while(--_0x1e28ca){_0x14e55c['push'](_0x14e55c['shift']());}};_0x45d284(++_0x422443);}(_0xdc2f,0x192));var _0xfdc2=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0xdc2f[_0x1caf6a];return _0x1bf493;};'use strict';var rimraf=require(_0xfdc2('0x0'));var zipdir=require(_0xfdc2('0x1'));var moment=require(_0xfdc2('0x2'));var BPromise=require('bluebird');var util=require(_0xfdc2('0x3'));var path=require(_0xfdc2('0x4'));var fs=require('fs');var _=require(_0xfdc2('0x5'));var Redis=require('ioredis');var interaction=require(_0xfdc2('0x6'));var qs=require('../../components/parsers/qs');var logger=require(_0xfdc2('0x7'))(_0xfdc2('0x8'));var config=require(_0xfdc2('0x9'));var db=require(_0xfdc2('0xa'))['db'];config[_0xfdc2('0xb')]=_[_0xfdc2('0xc')](config[_0xfdc2('0xb')],{'host':_0xfdc2('0xd'),'port':0x18eb});var socket=require(_0xfdc2('0xe'))(new Redis(config[_0xfdc2('0xb')]));require(_0xfdc2('0xf'))[_0xfdc2('0x10')](socket);function respondWithStatusCode(_0x2592ec,_0x3ba7be){_0x3ba7be=_0x3ba7be||0xcc;return function(_0x364ab9){if(_0x364ab9){return _0x2592ec['sendStatus'](_0x3ba7be);}return _0x2592ec[_0xfdc2('0x11')](_0x3ba7be)[_0xfdc2('0x12')]();};}function respondWithResult(_0x1b1f67,_0x2ea555){_0x2ea555=_0x2ea555||0xc8;return function(_0x2920a4){if(_0x2920a4){return _0x1b1f67['status'](_0x2ea555)[_0xfdc2('0x13')](_0x2920a4);}};}function respondWithFilteredResult(_0x25a6ce,_0x1bb59b){return function(_0x313546){if(_0x313546){var _0x3b3fb4=typeof _0x1bb59b[_0xfdc2('0x14')]===_0xfdc2('0x15')&&typeof _0x1bb59b['limit']==='undefined';var _0x45b291=_0x313546['count'];var _0x4e83d8=_0x3b3fb4?0x0:_0x1bb59b[_0xfdc2('0x14')];var _0x4f2cc5=_0x3b3fb4?_0x313546[_0xfdc2('0x16')]:_0x1bb59b[_0xfdc2('0x14')]+_0x1bb59b[_0xfdc2('0x17')];var _0x36eef9;if(_0x4f2cc5>=_0x45b291){_0x4f2cc5=_0x45b291;_0x36eef9=0xc8;}else{_0x36eef9=0xce;}_0x25a6ce[_0xfdc2('0x11')](_0x36eef9);return _0x25a6ce[_0xfdc2('0x18')]('Content-Range',_0x4e83d8+'-'+_0x4f2cc5+'/'+_0x45b291)['json'](_0x313546);}return null;};}function saveUpdates(_0x152149){return function(_0x7f0260){if(_0x7f0260){return _0x7f0260[_0xfdc2('0x19')](_0x152149)[_0xfdc2('0x1a')](function(_0x3cbf6f){return _0x3cbf6f;});}return null;};}function removeEntity(_0x250e0f){return function(_0x295f51){if(_0x295f51){return _0x295f51['destroy']()[_0xfdc2('0x1a')](function(){_0x250e0f[_0xfdc2('0x11')](0xcc)['end']();});}};}function handleEntityNotFound(_0x183480){return function(_0x12bed8){if(!_0x12bed8){_0x183480[_0xfdc2('0x1b')](0x194);}return _0x12bed8;};}function handleError(_0x5ad234,_0x45f51f){_0x45f51f=_0x45f51f||0x1f4;return function(_0x5788a9){logger[_0xfdc2('0x1c')](_0x5788a9[_0xfdc2('0x1d')]);if(_0x5788a9[_0xfdc2('0x1e')]){delete _0x5788a9[_0xfdc2('0x1e')];}_0x5ad234['status'](_0x45f51f)[_0xfdc2('0x1f')](_0x5788a9);};}exports['index']=function(_0x3290f3,_0x3c0813){var _0x165420={};var _0x4c2822=_[_0xfdc2('0x20')](db[_0xfdc2('0x21')][_0xfdc2('0x22')],function(_0xdaf65f){return{'name':_0xdaf65f[_0xfdc2('0x23')],'type':_0xdaf65f[_0xfdc2('0x24')]['key']};});_0x165420=qs['getOptions'](_0x4c2822,_0x3290f3);return interaction[_0xfdc2('0x25')](_0xfdc2('0x26'),_0x3290f3['query'],_0x3290f3[_0xfdc2('0x27')],_0x165420,_0x4c2822)[_0xfdc2('0x1a')](respondWithFilteredResult(_0x3c0813,_0x165420))[_0xfdc2('0x28')](handleError(_0x3c0813,null));};exports[_0xfdc2('0x29')]=function(_0xc7ef62,_0x596dc1){var _0x36c5ed={'raw':![],'where':{'id':_0xc7ef62[_0xfdc2('0x2a')]['id']}},_0x4057ed={};_0x4057ed['model']=_['keys'](db['FaxInteraction']['rawAttributes']);_0x4057ed['query']=_[_0xfdc2('0x2b')](_0xc7ef62[_0xfdc2('0x2c')]);_0x4057ed['filters']=_[_0xfdc2('0x2d')](_0x4057ed['model'],_0x4057ed[_0xfdc2('0x2c')]);_0x36c5ed[_0xfdc2('0x2e')]=_[_0xfdc2('0x2d')](_0x4057ed[_0xfdc2('0x2f')],qs[_0xfdc2('0x30')](_0xc7ef62[_0xfdc2('0x2c')]['fields']));_0x36c5ed[_0xfdc2('0x2e')]=_0x36c5ed['attributes'][_0xfdc2('0x31')]?_0x36c5ed['attributes']:_0x4057ed[_0xfdc2('0x2f')];if(_0xc7ef62[_0xfdc2('0x2c')][_0xfdc2('0x32')]){_0x36c5ed[_0xfdc2('0x33')]=[{'all':!![]}];}_0x36c5ed=_['merge']({},_0x36c5ed,_0xc7ef62[_0xfdc2('0x34')]);return db[_0xfdc2('0x21')][_0xfdc2('0x35')](_0x36c5ed)[_0xfdc2('0x1a')](handleEntityNotFound(_0x596dc1,null))[_0xfdc2('0x1a')](respondWithResult(_0x596dc1,null))[_0xfdc2('0x28')](handleError(_0x596dc1,null));};exports[_0xfdc2('0x36')]=function(_0x5cee24,_0x1826dd){return db[_0xfdc2('0x21')][_0xfdc2('0x36')](_0x5cee24[_0xfdc2('0x37')],{})['then'](respondWithResult(_0x1826dd,0xc9))['catch'](handleError(_0x1826dd,null));};exports[_0xfdc2('0x19')]=function(_0x5788e8,_0x29bb33){if(_0x5788e8[_0xfdc2('0x37')]['id']){delete _0x5788e8[_0xfdc2('0x37')]['id'];}return db[_0xfdc2('0x21')][_0xfdc2('0x35')]({'where':{'id':_0x5788e8['params']['id']}})[_0xfdc2('0x1a')](handleEntityNotFound(_0x29bb33,null))[_0xfdc2('0x1a')](saveUpdates(_0x5788e8['body'],null))[_0xfdc2('0x1a')](respondWithResult(_0x29bb33,null))[_0xfdc2('0x28')](handleError(_0x29bb33,null));};exports[_0xfdc2('0x38')]=function(_0x5a4521,_0x359840){return db['FaxInteraction'][_0xfdc2('0x35')]({'where':{'id':_0x5a4521['params']['id']}})[_0xfdc2('0x1a')](handleEntityNotFound(_0x359840,null))[_0xfdc2('0x1a')](removeEntity(_0x359840,null))[_0xfdc2('0x28')](handleError(_0x359840,null));};exports[_0xfdc2('0x39')]=function(_0x3dfd5e,_0x43005b){return db['FaxInteraction'][_0xfdc2('0x39')]()['then'](respondWithResult(_0x43005b,null))[_0xfdc2('0x28')](handleError(_0x43005b,null));};exports[_0xfdc2('0x3a')]=function(_0x4685d0,_0x335e65){return db[_0xfdc2('0x3b')]['find']({'where':{'id':_0x4685d0['params']['id']}})['then'](handleEntityNotFound(_0x335e65,null))[_0xfdc2('0x1a')](function(_0x5d15c3){if(_0x5d15c3){return _0x5d15c3[_0xfdc2('0x3a')](_0x4685d0[_0xfdc2('0x37')]['ids'],_[_0xfdc2('0x3c')](_0x4685d0[_0xfdc2('0x37')],[_0xfdc2('0x3d'),'id'])||{});}})[_0xfdc2('0x1a')](respondWithResult(_0x335e65,null))['catch'](handleError(_0x335e65,null));};exports[_0xfdc2('0x3e')]=function(_0x17fbdf,_0x5e94f3){var _0x3b1828={'raw':![],'where':{}};var _0x5dea8f={};var _0x1c0283={'count':0x0,'rows':[]};return db[_0xfdc2('0x21')]['findOne']({'where':{'id':_0x17fbdf['params']['id']}})[_0xfdc2('0x1a')](handleEntityNotFound(_0x5e94f3,null))[_0xfdc2('0x1a')](function(_0xa15678){if(_0xa15678){_0x5dea8f['model']=_[_0xfdc2('0x2b')](db[_0xfdc2('0x3b')][_0xfdc2('0x22')]);_0x5dea8f[_0xfdc2('0x2c')]=_[_0xfdc2('0x2b')](_0x17fbdf[_0xfdc2('0x2c')]);_0x5dea8f[_0xfdc2('0x3f')]=_[_0xfdc2('0x2d')](_0x5dea8f['model'],_0x5dea8f['query']);_0x3b1828[_0xfdc2('0x2e')]=_[_0xfdc2('0x2d')](_0x5dea8f['model'],qs['fields'](_0x17fbdf[_0xfdc2('0x2c')]['fields']));_0x3b1828[_0xfdc2('0x2e')]=_0x3b1828[_0xfdc2('0x2e')][_0xfdc2('0x31')]?_0x3b1828[_0xfdc2('0x2e')]:_0x5dea8f[_0xfdc2('0x2f')];if(!_0x17fbdf['query'][_0xfdc2('0x40')]('nolimit')){_0x3b1828[_0xfdc2('0x17')]=qs[_0xfdc2('0x17')](_0x17fbdf['query'][_0xfdc2('0x17')]);_0x3b1828[_0xfdc2('0x14')]=qs['offset'](_0x17fbdf[_0xfdc2('0x2c')]['offset']);}_0x3b1828['order']=qs[_0xfdc2('0x41')](_0x17fbdf['query']['sort']);_0x3b1828[_0xfdc2('0x42')]=qs[_0xfdc2('0x3f')](_[_0xfdc2('0x43')](_0x17fbdf[_0xfdc2('0x2c')],_0x5dea8f[_0xfdc2('0x3f')]));_0x3b1828[_0xfdc2('0x42')]['FaxInteractionId']=_0xa15678['id'];if(_0x17fbdf[_0xfdc2('0x2c')]['filter']){_0x3b1828[_0xfdc2('0x42')]=_['merge'](_0x3b1828['where'],{'$or':_['map'](_0x3b1828['attributes'],function(_0x54080d){var _0x535f1c={};_0x535f1c[_0x54080d]={'$like':'%'+_0x17fbdf[_0xfdc2('0x2c')][_0xfdc2('0x44')]+'%'};return _0x535f1c;})});}if(_0x17fbdf[_0xfdc2('0x2c')][_0xfdc2('0x45')]){var _0x512cc9=_0x17fbdf[_0xfdc2('0x2c')][_0xfdc2('0x45')][_0xfdc2('0x46')](',');var _0x363535={};_0x363535[_0x512cc9[0x0]]={'$gte':moment(_0x512cc9[0x1])[_0xfdc2('0x47')](_0xfdc2('0x48'))};_0x3b1828[_0xfdc2('0x42')]=_[_0xfdc2('0x49')](_0x3b1828[_0xfdc2('0x42')],_0x363535);}_0x3b1828=_[_0xfdc2('0x49')]({},_0x3b1828,_0x17fbdf['options']);return db[_0xfdc2('0x3b')][_0xfdc2('0x16')]({'where':_0x3b1828[_0xfdc2('0x42')]})[_0xfdc2('0x1a')](function(_0x13df4e){_0x1c0283[_0xfdc2('0x16')]=_0x13df4e;if(_0x17fbdf[_0xfdc2('0x2c')][_0xfdc2('0x32')]){_0x3b1828['include']=[{'all':!![]}];}return db[_0xfdc2('0x3b')][_0xfdc2('0x25')](_0x3b1828);})['then'](function(_0x53670e){_0x1c0283[_0xfdc2('0x4a')]=_0x53670e;return _0x1c0283;});}})[_0xfdc2('0x1a')](respondWithFilteredResult(_0x5e94f3,_0x3b1828))[_0xfdc2('0x28')](handleError(_0x5e94f3,null));};exports[_0xfdc2('0x4b')]=function(_0x3394b9,_0x2a2736){return db[_0xfdc2('0x21')][_0xfdc2('0x35')]({'where':{'id':_0x3394b9[_0xfdc2('0x2a')]['id']}})[_0xfdc2('0x1a')](handleEntityNotFound(_0x2a2736,null))[_0xfdc2('0x1a')](function(_0x431067){if(_0x431067){return _0x431067[_0xfdc2('0x4c')](_0x3394b9['body'][_0xfdc2('0x3d')],_['omit'](_0x3394b9['body'],[_0xfdc2('0x3d'),'id'])||{})['spread'](function(){return db[_0xfdc2('0x4d')]['findAll']({'attributes':['id',_0xfdc2('0x1e'),_0xfdc2('0x4e')],'where':{'id':_0x3394b9[_0xfdc2('0x37')][_0xfdc2('0x3d')]}});})[_0xfdc2('0x1a')](function(_0x4af9fe){socket[_0xfdc2('0x4f')](_0xfdc2('0x50'),{'id':Number(_0x3394b9[_0xfdc2('0x2a')]['id']),'tags':_0x4af9fe||[]});return{'id':Number(_0x3394b9['params']['id']),'tags':_0x4af9fe||[]};});}})['then'](respondWithResult(_0x2a2736,null))[_0xfdc2('0x28')](handleError(_0x2a2736,null));};exports[_0xfdc2('0x51')]=function(_0x23be4a,_0x5939ef){return db['FaxInteraction']['find']({'where':{'id':_0x23be4a[_0xfdc2('0x2a')]['id']}})[_0xfdc2('0x1a')](handleEntityNotFound(_0x5939ef,null))[_0xfdc2('0x1a')](function(_0xebb0ab){if(_0xebb0ab){return _0xebb0ab[_0xfdc2('0x51')](_0x23be4a['query'][_0xfdc2('0x3d')]);}})[_0xfdc2('0x1a')](respondWithStatusCode(_0x5939ef,null))['catch'](handleError(_0x5939ef,null));};exports[_0xfdc2('0x52')]=function(_0x1ef7bd,_0x5daf46){var _0x1ab5a1=moment()[_0xfdc2('0x53')]()['toString']();var _0x3f252b=path[_0xfdc2('0x54')](config[_0xfdc2('0x55')],'server',_0xfdc2('0x56'),_0xfdc2('0x57'));var _0xed577f=path[_0xfdc2('0x54')](config[_0xfdc2('0x55')],_0xfdc2('0x58'),_0xfdc2('0x56'),_0xfdc2('0x59'));var _0x394c52=path[_0xfdc2('0x54')](_0x3f252b,_0x1ab5a1);var _0x43ad4c=util[_0xfdc2('0x47')](_0xfdc2('0x5a'),_0x1ef7bd[_0xfdc2('0x2a')]['id'],_0x1ab5a1);var _0x282deb=path[_0xfdc2('0x54')](_0x3f252b,_0x43ad4c);var _0x98fc94=[];_0x98fc94['push']({'model':db[_0xfdc2('0x5b')],'as':'Attachment','raw':!![]});var _0x39b1b8=[{'model':db[_0xfdc2('0x3b')],'as':_0xfdc2('0x5c'),'attributes':['id','body',_0xfdc2('0x5d')],'include':_0x98fc94}];return db[_0xfdc2('0x21')][_0xfdc2('0x35')]({'where':{'id':_0x1ef7bd[_0xfdc2('0x2a')]['id']},'include':_0x39b1b8})[_0xfdc2('0x1a')](handleEntityNotFound(_0x5daf46,null))[_0xfdc2('0x1a')](function(_0x3b839f){if(_0x3b839f&&_0x3b839f['Messages']){var _0x4e823a=_0x3b839f['get']({'plain':!![]});fs[_0xfdc2('0x5e')](_0x394c52);for(var _0x155490=0x0;_0x155490<_0x4e823a[_0xfdc2('0x5c')]['length'];_0x155490++){var _0x2bc7f9=_0x4e823a[_0xfdc2('0x5c')][_0x155490]['Attachment'];if(_0x2bc7f9){var _0x1277d1=path[_0xfdc2('0x54')](_0xed577f,_0x2bc7f9['basename']);if(fs[_0xfdc2('0x5f')](_0x1277d1)){fs[_0xfdc2('0x60')](_0x1277d1)[_0xfdc2('0x61')](fs[_0xfdc2('0x62')](path[_0xfdc2('0x54')](_0x394c52,_0x2bc7f9[_0xfdc2('0x63')])));}}}return BPromise[_0xfdc2('0x64')]()[_0xfdc2('0x1a')](function(){return new BPromise(function(_0x313f1b,_0x5afe08){zipdir(_0x394c52,{'saveTo':_0x282deb},function(_0x11dd5,_0x2fce71){if(_0x11dd5)return _0x5afe08(_0x11dd5);return _0x313f1b(_0x2fce71);});})[_0xfdc2('0x1a')](function(){return new BPromise(function(_0x4314cd,_0xbdb360){rimraf(_0x394c52,function(_0x12a5bf){if(_0x12a5bf)_0xbdb360(_0x12a5bf);return _0x4314cd();});});})['then'](function(){return _0x5daf46[_0xfdc2('0x52')](_0x282deb,_0x43ad4c,function(_0x2799e0){if(_0x2799e0){console[_0xfdc2('0x65')](_0xfdc2('0x66'),_0x2799e0);}else{fs[_0xfdc2('0x67')](_0x282deb);}});});});}else{return _0x5daf46[_0xfdc2('0x1b')](0xc8);}})['catch'](handleError(_0x5daf46,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 273ea11..ad34acb 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 _0xe8e1=['findAll','unreadMessages','length','hasOwnProperty','hook','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','update','remove','then','setDataValue','Users','map'];(function(_0x56186d,_0x5257fd){var _0x5e03d7=function(_0x2e6206){while(--_0x2e6206){_0x56186d['push'](_0x56186d['shift']());}};_0x5e03d7(++_0x5257fd);}(_0xe8e1,0x14a));var _0x1e8e=function(_0x5bb437,_0x8ba96c){_0x5bb437=_0x5bb437-0x0;var _0x3e24a3=_0xe8e1[_0x5bb437];return _0x3e24a3;};'use strict';var EventEmitter=require(_0x1e8e('0x0'));var FaxInteraction=require(_0x1e8e('0x1'))['db'][_0x1e8e('0x2')];var FaxMessage=require(_0x1e8e('0x1'))['db'][_0x1e8e('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x1e8e('0x4')](0x0);var events={'afterCreate':_0x1e8e('0x5'),'afterUpdate':_0x1e8e('0x6'),'afterDestroy':_0x1e8e('0x7')};function emitEvent(_0x461e1f){return function(_0x480de0,_0xf4a2e7,_0x1393b1){_0x480de0['getUsers']({'attributes':['id'],'raw':!![]})[_0x1e8e('0x8')](function(_0x451189){_0x480de0[_0x1e8e('0x9')](_0x1e8e('0xa'),_0x451189[_0x1e8e('0xb')](function(_0x5bb518){return{'id':_0x5bb518['id']};}));return FaxMessage[_0x1e8e('0xc')]({'where':{'FaxInteractionId':_0x480de0['id'],'direction':'in','read':![]},'raw':!![]});})[_0x1e8e('0x8')](function(_0x5f48db){_0x480de0['setDataValue'](_0x1e8e('0xd'),_0x5f48db[_0x1e8e('0xe')]);FaxInteractionEvents['emit'](_0x461e1f+':'+_0x480de0['id'],_0x480de0);FaxInteractionEvents['emit'](_0x461e1f,_0x480de0);_0x1393b1(null);})['catch'](_0x1393b1(null));};}for(var e in events){if(events[_0x1e8e('0xf')](e)){var event=events[e];FaxInteraction[_0x1e8e('0x10')](e,emitEvent(event));}}module[_0x1e8e('0x11')]=FaxInteractionEvents; \ No newline at end of file +var _0x599b=['remove','getUsers','setDataValue','map','findAll','then','unreadMessages','emit','catch','events','../../mysqldb','FaxMessage','update'];(function(_0x2bcf3b,_0x2443d7){var _0x1d2898=function(_0x328100){while(--_0x328100){_0x2bcf3b['push'](_0x2bcf3b['shift']());}};_0x1d2898(++_0x2443d7);}(_0x599b,0x10d));var _0xb599=function(_0x33eb41,_0x3ede30){_0x33eb41=_0x33eb41-0x0;var _0x194797=_0x599b[_0x33eb41];return _0x194797;};'use strict';var EventEmitter=require(_0xb599('0x0'));var FaxInteraction=require('../../mysqldb')['db']['FaxInteraction'];var FaxMessage=require(_0xb599('0x1'))['db'][_0xb599('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xb599('0x3'),'afterDestroy':_0xb599('0x4')};function emitEvent(_0xef0020){return function(_0x327e42,_0x549288,_0x278ef2){_0x327e42[_0xb599('0x5')]({'attributes':['id'],'raw':!![]})['then'](function(_0x2c37db){_0x327e42[_0xb599('0x6')]('Users',_0x2c37db[_0xb599('0x7')](function(_0x192f70){return{'id':_0x192f70['id']};}));return FaxMessage[_0xb599('0x8')]({'where':{'FaxInteractionId':_0x327e42['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb599('0x9')](function(_0x53a3f3){_0x327e42[_0xb599('0x6')](_0xb599('0xa'),_0x53a3f3['length']);FaxInteractionEvents[_0xb599('0xb')](_0xef0020+':'+_0x327e42['id'],_0x327e42);FaxInteractionEvents[_0xb599('0xb')](_0xef0020,_0x327e42);_0x278ef2(null);})[_0xb599('0xc')](_0x278ef2(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 4756304..eaad9e1 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 _0x82d8=['changed','closedAt','format','lodash','../../config/logger','bluebird','path','./faxInteraction.attributes','exports','define','FaxInteraction','fax_interactions'];(function(_0x2a8b30,_0x254c0d){var _0x5bd692=function(_0xbfc503){while(--_0xbfc503){_0x2a8b30['push'](_0x2a8b30['shift']());}};_0x5bd692(++_0x254c0d);}(_0x82d8,0xff));var _0x882d=function(_0x2116ae,_0x2c75b6){_0x2116ae=_0x2116ae-0x0;var _0x3bf252=_0x82d8[_0x2116ae];return _0x3bf252;};'use strict';var _=require(_0x882d('0x0'));var util=require('util');var logger=require(_0x882d('0x1'))('api');var moment=require('moment');var BPromise=require(_0x882d('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x882d('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x882d('0x4'));module[_0x882d('0x5')]=function(_0x19f644,_0xa928f7){return _0x19f644[_0x882d('0x6')](_0x882d('0x7'),attributes,{'tableName':_0x882d('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4ea710,_0x4035ba,_0x3fe0bf){if(_0x4ea710[_0x882d('0x9')]('closed')){_0x4ea710[_0x882d('0xa')]=moment()[_0x882d('0xb')]('YYYY-MM-DD\x20HH:mm:ss');}_0x3fe0bf(null,_0x4ea710);}}});}; \ No newline at end of file +var _0x53e1=['format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','bluebird','path','rimraf','define','FaxInteraction','fax_interactions','changed','closed','closedAt'];(function(_0x5466ab,_0x227b13){var _0x40751a=function(_0x477f9e){while(--_0x477f9e){_0x5466ab['push'](_0x5466ab['shift']());}};_0x40751a(++_0x227b13);}(_0x53e1,0x8e));var _0x153e=function(_0x3cf5a3,_0x5a4492){_0x3cf5a3=_0x3cf5a3-0x0;var _0x39ba2d=_0x53e1[_0x3cf5a3];return _0x39ba2d;};'use strict';var _=require(_0x153e('0x0'));var util=require('util');var logger=require(_0x153e('0x1'))(_0x153e('0x2'));var moment=require('moment');var BPromise=require(_0x153e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x153e('0x4'));var rimraf=require(_0x153e('0x5'));var config=require('../../config/environment');var attributes=require('./faxInteraction.attributes');module['exports']=function(_0x3bc691,_0x100ab5){return _0x3bc691[_0x153e('0x6')](_0x153e('0x7'),attributes,{'tableName':_0x153e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xb5eb2c,_0x190bd2,_0x496c0e){if(_0xb5eb2c[_0x153e('0x9')](_0x153e('0xa'))){_0xb5eb2c[_0x153e('0xb')]=moment()[_0x153e('0xc')](_0x153e('0xd'));}_0x496c0e(null,_0xb5eb2c);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 5deed50..4aaa2af 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 _0xb043=['stringify','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./faxInteraction.socket','request','info','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','error','code','FaxInteraction,\x20%s,\x20%s','message','result','catch','UpdateFaxInteraction','update','options','raw','where','attributes','then','AddTagsToFaxInteraction','find','addTags','body','ids','omit','spread','AddTags'];(function(_0x113400,_0x41e19b){var _0x1fa1e4=function(_0x51e8ae){while(--_0x51e8ae){_0x113400['push'](_0x113400['shift']());}};_0x1fa1e4(++_0x41e19b);}(_0xb043,0x159));var _0x3b04=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0xb043[_0x1deb03];return _0x189fe7;};'use strict';var _=require('lodash');var util=require(_0x3b04('0x0'));var moment=require(_0x3b04('0x1'));var BPromise=require(_0x3b04('0x2'));var rs=require(_0x3b04('0x3'));var fs=require('fs');var Redis=require(_0x3b04('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3b04('0x5'));var logger=require(_0x3b04('0x6'))(_0x3b04('0x7'));var config=require(_0x3b04('0x8'));var jayson=require(_0x3b04('0x9'));var client=jayson[_0x3b04('0xa')][_0x3b04('0xb')]({'port':0x232a});config[_0x3b04('0xc')]=_['defaults'](config[_0x3b04('0xc')],{'host':_0x3b04('0xd'),'port':0x18eb});var socket=require(_0x3b04('0xe'))(new Redis(config['redis']));require(_0x3b04('0xf'))['register'](socket);function respondWithRpcPromise(_0x2ed95e,_0xcc32c3,_0x2e9dd2){return new BPromise(function(_0x2f4003,_0x1c3706){return client[_0x3b04('0x10')](_0x2ed95e,_0x2e9dd2)['then'](function(_0x1f5ed9){logger[_0x3b04('0x11')]('FaxInteraction,\x20%s,\x20%s',_0xcc32c3,_0x3b04('0x12'));logger[_0x3b04('0x13')](_0x3b04('0x14'),_0xcc32c3,_0x3b04('0x12'),JSON['stringify'](_0x1f5ed9));if(_0x1f5ed9[_0x3b04('0x15')]){if(_0x1f5ed9[_0x3b04('0x15')][_0x3b04('0x16')]===0x1f4){logger['error'](_0x3b04('0x17'),_0xcc32c3,_0x1f5ed9[_0x3b04('0x15')][_0x3b04('0x18')]);return _0x1c3706(_0x1f5ed9[_0x3b04('0x15')][_0x3b04('0x18')]);}logger[_0x3b04('0x15')]('FaxInteraction,\x20%s,\x20%s',_0xcc32c3,_0x1f5ed9[_0x3b04('0x15')][_0x3b04('0x18')]);return _0x2f4003(_0x1f5ed9['error'][_0x3b04('0x18')]);}else{logger[_0x3b04('0x11')](_0x3b04('0x17'),_0xcc32c3,'request\x20sent');_0x2f4003(_0x1f5ed9[_0x3b04('0x19')]['message']);}})[_0x3b04('0x1a')](function(_0x581b8d){logger[_0x3b04('0x15')]('FaxInteraction,\x20%s,\x20%s',_0xcc32c3,_0x581b8d);_0x1c3706(_0x581b8d);});});}exports[_0x3b04('0x1b')]=function(_0x1b8ae4){var _0x469a06=this;return new Promise(function(_0x405d2a,_0x5f044e){return db['FaxInteraction'][_0x3b04('0x1c')](_0x1b8ae4['body'],{'raw':_0x1b8ae4[_0x3b04('0x1d')]?_0x1b8ae4[_0x3b04('0x1d')][_0x3b04('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b8ae4[_0x3b04('0x1d')]?_0x1b8ae4['options'][_0x3b04('0x1f')]||null:null,'attributes':_0x1b8ae4[_0x3b04('0x1d')]?_0x1b8ae4[_0x3b04('0x1d')][_0x3b04('0x20')]||null:null,'limit':_0x1b8ae4[_0x3b04('0x1d')]?_0x1b8ae4[_0x3b04('0x1d')]['limit']||null:null})[_0x3b04('0x21')](function(_0x2ffc0f){logger[_0x3b04('0x11')](_0x3b04('0x1b'),_0x1b8ae4);logger[_0x3b04('0x13')](_0x3b04('0x1b'),_0x1b8ae4,JSON['stringify'](_0x2ffc0f));_0x405d2a(_0x2ffc0f);})[_0x3b04('0x1a')](function(_0x457b0b){logger['error'](_0x3b04('0x1b'),_0x457b0b[_0x3b04('0x18')],_0x1b8ae4);_0x5f044e(_0x469a06[_0x3b04('0x15')](0x1f4,_0x457b0b[_0x3b04('0x18')]));});});};exports[_0x3b04('0x22')]=function(_0x1c1d74){return new Promise(function(_0x398ea8,_0x1b7c08){return db['FaxInteraction'][_0x3b04('0x23')]({'where':_0x1c1d74['options']?_0x1c1d74[_0x3b04('0x1d')][_0x3b04('0x1f')]||null:null})['then'](function(_0x3e8c1a){if(_0x3e8c1a){return _0x3e8c1a[_0x3b04('0x24')](_0x1c1d74[_0x3b04('0x25')][_0x3b04('0x26')],_[_0x3b04('0x27')](_0x1c1d74[_0x3b04('0x25')],[_0x3b04('0x26'),'id'])||{});}})[_0x3b04('0x28')](function(_0xf76fb8){logger['info'](_0x3b04('0x29'),_0x1c1d74);logger[_0x3b04('0x13')](_0x3b04('0x29'),_0x1c1d74,JSON[_0x3b04('0x2a')](_0xf76fb8));_0x398ea8(_0xf76fb8);})[_0x3b04('0x1a')](function(_0x1e7b4b){logger[_0x3b04('0x15')]('AddTags',_0x1e7b4b[_0x3b04('0x18')],_0x1c1d74);_0x1b7c08(_this[_0x3b04('0x15')](0x1f4,_0x1e7b4b[_0x3b04('0x18')]));});});}; \ No newline at end of file +var _0x97ad=['message','result','catch','UpdateFaxInteraction','update','options','raw','where','attributes','AddTagsToFaxInteraction','FaxInteraction','find','then','addTags','body','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','localhost','./faxInteraction.socket','register','request','info','debug','request\x20sent','stringify','error','code','FaxInteraction,\x20%s,\x20%s'];(function(_0x176dde,_0x3d11f0){var _0x1592ca=function(_0x1727fd){while(--_0x1727fd){_0x176dde['push'](_0x176dde['shift']());}};_0x1592ca(++_0x3d11f0);}(_0x97ad,0x1ec));var _0xd97a=function(_0x544c6d,_0x3fb5e6){_0x544c6d=_0x544c6d-0x0;var _0x1b3d17=_0x97ad[_0x544c6d];return _0x1b3d17;};'use strict';var _=require(_0xd97a('0x0'));var util=require(_0xd97a('0x1'));var moment=require(_0xd97a('0x2'));var BPromise=require(_0xd97a('0x3'));var rs=require(_0xd97a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd97a('0x5'))['db'];var utils=require(_0xd97a('0x6'));var logger=require('../../config/logger')(_0xd97a('0x7'));var config=require('../../config/environment');var jayson=require(_0xd97a('0x8'));var client=jayson[_0xd97a('0x9')][_0xd97a('0xa')]({'port':0x232a});config[_0xd97a('0xb')]=_[_0xd97a('0xc')](config[_0xd97a('0xb')],{'host':_0xd97a('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xd97a('0xe'))[_0xd97a('0xf')](socket);function respondWithRpcPromise(_0x1c19c4,_0x50854d,_0x22ee2e){return new BPromise(function(_0x18d515,_0x549e0f){return client[_0xd97a('0x10')](_0x1c19c4,_0x22ee2e)['then'](function(_0x7ca1ac){logger[_0xd97a('0x11')]('FaxInteraction,\x20%s,\x20%s',_0x50854d,'request\x20sent');logger[_0xd97a('0x12')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x50854d,_0xd97a('0x13'),JSON[_0xd97a('0x14')](_0x7ca1ac));if(_0x7ca1ac[_0xd97a('0x15')]){if(_0x7ca1ac['error'][_0xd97a('0x16')]===0x1f4){logger['error'](_0xd97a('0x17'),_0x50854d,_0x7ca1ac[_0xd97a('0x15')]['message']);return _0x549e0f(_0x7ca1ac[_0xd97a('0x15')][_0xd97a('0x18')]);}logger[_0xd97a('0x15')](_0xd97a('0x17'),_0x50854d,_0x7ca1ac[_0xd97a('0x15')]['message']);return _0x18d515(_0x7ca1ac[_0xd97a('0x15')]['message']);}else{logger[_0xd97a('0x11')](_0xd97a('0x17'),_0x50854d,_0xd97a('0x13'));_0x18d515(_0x7ca1ac[_0xd97a('0x19')]['message']);}})[_0xd97a('0x1a')](function(_0x487431){logger[_0xd97a('0x15')](_0xd97a('0x17'),_0x50854d,_0x487431);_0x549e0f(_0x487431);});});}exports[_0xd97a('0x1b')]=function(_0x32a7cc){var _0x38ee66=this;return new Promise(function(_0xb31aa1,_0xf64894){return db['FaxInteraction'][_0xd97a('0x1c')](_0x32a7cc['body'],{'raw':_0x32a7cc[_0xd97a('0x1d')]?_0x32a7cc[_0xd97a('0x1d')][_0xd97a('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x32a7cc[_0xd97a('0x1d')]?_0x32a7cc[_0xd97a('0x1d')][_0xd97a('0x1f')]||null:null,'attributes':_0x32a7cc[_0xd97a('0x1d')]?_0x32a7cc['options'][_0xd97a('0x20')]||null:null,'limit':_0x32a7cc['options']?_0x32a7cc[_0xd97a('0x1d')]['limit']||null:null})['then'](function(_0xbb0101){logger[_0xd97a('0x11')](_0xd97a('0x1b'),_0x32a7cc);logger['debug'](_0xd97a('0x1b'),_0x32a7cc,JSON['stringify'](_0xbb0101));_0xb31aa1(_0xbb0101);})[_0xd97a('0x1a')](function(_0x16262c){logger['error']('UpdateFaxInteraction',_0x16262c[_0xd97a('0x18')],_0x32a7cc);_0xf64894(_0x38ee66['error'](0x1f4,_0x16262c[_0xd97a('0x18')]));});});};exports[_0xd97a('0x21')]=function(_0x263d1a){return new Promise(function(_0x55f4cd,_0x30324e){return db[_0xd97a('0x22')][_0xd97a('0x23')]({'where':_0x263d1a[_0xd97a('0x1d')]?_0x263d1a[_0xd97a('0x1d')][_0xd97a('0x1f')]||null:null})[_0xd97a('0x24')](function(_0x193f96){if(_0x193f96){return _0x193f96[_0xd97a('0x25')](_0x263d1a[_0xd97a('0x26')][_0xd97a('0x27')],_[_0xd97a('0x28')](_0x263d1a[_0xd97a('0x26')],[_0xd97a('0x27'),'id'])||{});}})[_0xd97a('0x29')](function(_0x4a78d0){logger[_0xd97a('0x11')](_0xd97a('0x2a'),_0x263d1a);logger[_0xd97a('0x12')](_0xd97a('0x2a'),_0x263d1a,JSON['stringify'](_0x4a78d0));_0x55f4cd(_0x4a78d0);})[_0xd97a('0x1a')](function(_0x5f1d5a){logger[_0xd97a('0x15')](_0xd97a('0x2a'),_0x5f1d5a[_0xd97a('0x18')],_0x263d1a);_0x30324e(_this[_0xd97a('0x15')](0x1f4,_0x5f1d5a[_0xd97a('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index c58bdea..d6e04a8 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 _0x37fa=['length','./faxInteraction.events','save','remove','update','removeListener'];(function(_0x11a72e,_0x1f95b9){var _0x32df28=function(_0x4751d8){while(--_0x4751d8){_0x11a72e['push'](_0x11a72e['shift']());}};_0x32df28(++_0x1f95b9);}(_0x37fa,0x1db));var _0xa37f=function(_0x2b68fc,_0x10362e){_0x2b68fc=_0x2b68fc-0x0;var _0x2e3490=_0x37fa[_0x2b68fc];return _0x2e3490;};'use strict';var FaxInteractionEvents=require(_0xa37f('0x0'));var events=[_0xa37f('0x1'),_0xa37f('0x2'),_0xa37f('0x3')];function createListener(_0x2fb4f9,_0x27c415){return function(_0x2e3282){_0x27c415['emit'](_0x2fb4f9,_0x2e3282);};}function removeListener(_0x2f95b5,_0x2a8841){return function(){FaxInteractionEvents[_0xa37f('0x4')](_0x2f95b5,_0x2a8841);};}exports['register']=function(_0x14be03){for(var _0x128c45=0x0,_0x345f83=events[_0xa37f('0x5')];_0x128c45<_0x345f83;_0x128c45++){var _0x46993a=events[_0x128c45];var _0x505209=createListener('faxInteraction:'+_0x46993a,_0x14be03);FaxInteractionEvents['on'](_0x46993a,_0x505209);}}; \ No newline at end of file +var _0xfe29=['length','faxInteraction:','./faxInteraction.events','save','remove','update','emit','removeListener','register'];(function(_0x558ba2,_0x567a31){var _0x3fbf83=function(_0x526f48){while(--_0x526f48){_0x558ba2['push'](_0x558ba2['shift']());}};_0x3fbf83(++_0x567a31);}(_0xfe29,0xd1));var _0x9fe2=function(_0x366c86,_0xd00023){_0x366c86=_0x366c86-0x0;var _0x402ec5=_0xfe29[_0x366c86];return _0x402ec5;};'use strict';var FaxInteractionEvents=require(_0x9fe2('0x0'));var events=[_0x9fe2('0x1'),_0x9fe2('0x2'),_0x9fe2('0x3')];function createListener(_0x34ca11,_0x3c87a7){return function(_0x4de74){_0x3c87a7[_0x9fe2('0x4')](_0x34ca11,_0x4de74);};}function removeListener(_0x20c05a,_0x31dd1b){return function(){FaxInteractionEvents[_0x9fe2('0x5')](_0x20c05a,_0x31dd1b);};}exports[_0x9fe2('0x6')]=function(_0x254595){for(var _0x1d9db7=0x0,_0x251b87=events[_0x9fe2('0x7')];_0x1d9db7<_0x251b87;_0x1d9db7++){var _0x324a44=events[_0x1d9db7];var _0x7e5072=createListener(_0x9fe2('0x8')+_0x324a44,_0x254595);FaxInteractionEvents['on'](_0x324a44,_0x7e5072);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 643e2aa..bdca70d 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 _0x9e75=['/describe','isAuthenticated','describe','show','getMessages','/:id/download','download','post','create','/:id/messages','addMessage','/:id/tags','tracked','faxinteraction:addtags','addTags','put','/:id','fax','faxinteraction:update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./faxInteraction.controller','index','get'];(function(_0x3696f3,_0x3c512e){var _0x504a06=function(_0x489b06){while(--_0x489b06){_0x3696f3['push'](_0x3696f3['shift']());}};_0x504a06(++_0x3c512e);}(_0x9e75,0xb5));var _0x59e7=function(_0x3c94a3,_0x108c39){_0x3c94a3=_0x3c94a3-0x0;var _0x19e9d7=_0x9e75[_0x3c94a3];return _0x19e9d7;};'use strict';var multer=require(_0x59e7('0x0'));var util=require(_0x59e7('0x1'));var path=require('path');var timeout=require(_0x59e7('0x2'));var express=require(_0x59e7('0x3'));var router=express[_0x59e7('0x4')]();var fs_extra=require(_0x59e7('0x5'));var auth=require(_0x59e7('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x59e7('0x7'));var controller=require(_0x59e7('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x59e7('0x9')]);router[_0x59e7('0xa')](_0x59e7('0xb'),auth[_0x59e7('0xc')](),controller[_0x59e7('0xd')]);router[_0x59e7('0xa')]('/:id',auth[_0x59e7('0xc')](),controller[_0x59e7('0xe')]);router[_0x59e7('0xa')]('/:id/messages',auth[_0x59e7('0xc')](),controller[_0x59e7('0xf')]);router[_0x59e7('0xa')](_0x59e7('0x10'),auth[_0x59e7('0xc')](),controller[_0x59e7('0x11')]);router[_0x59e7('0x12')]('/',auth[_0x59e7('0xc')](),controller[_0x59e7('0x13')]);router[_0x59e7('0x12')](_0x59e7('0x14'),auth['isAuthenticated'](),controller[_0x59e7('0x15')]);router[_0x59e7('0x12')](_0x59e7('0x16'),auth[_0x59e7('0xc')](),interaction[_0x59e7('0x17')]('fax',_0x59e7('0x18')),controller[_0x59e7('0x19')]);router[_0x59e7('0x1a')](_0x59e7('0x1b'),auth[_0x59e7('0xc')](),interaction['tracked'](_0x59e7('0x1c'),_0x59e7('0x1d')),controller['update']);router[_0x59e7('0x1e')](_0x59e7('0x1b'),auth['isAuthenticated'](),interaction[_0x59e7('0x17')](_0x59e7('0x1c'),'faxinteraction:destroy'),controller[_0x59e7('0x1f')]);router[_0x59e7('0x1e')]('/:id/tags',auth['isAuthenticated'](),controller['removeTags']);module['exports']=router; \ No newline at end of file +var _0x6f3a=['post','create','addMessage','/:id/tags','tracked','fax','put','/:id','faxinteraction:update','update','delete','faxinteraction:destroy','removeTags','exports','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','/describe','describe','show','/:id/messages','getMessages','/:id/download','download'];(function(_0x369151,_0x179f72){var _0x4292d5=function(_0x330422){while(--_0x330422){_0x369151['push'](_0x369151['shift']());}};_0x4292d5(++_0x179f72);}(_0x6f3a,0xe7));var _0xa6f3=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x6f3a[_0x4a9fb1];return _0x348672;};'use strict';var multer=require('multer');var util=require(_0xa6f3('0x0'));var path=require(_0xa6f3('0x1'));var timeout=require('connect-timeout');var express=require(_0xa6f3('0x2'));var router=express['Router']();var fs_extra=require(_0xa6f3('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa6f3('0x4'));var config=require(_0xa6f3('0x5'));var controller=require(_0xa6f3('0x6'));router[_0xa6f3('0x7')]('/',auth[_0xa6f3('0x8')](),controller[_0xa6f3('0x9')]);router['get'](_0xa6f3('0xa'),auth[_0xa6f3('0x8')](),controller[_0xa6f3('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xa6f3('0xc')]);router['get'](_0xa6f3('0xd'),auth[_0xa6f3('0x8')](),controller[_0xa6f3('0xe')]);router[_0xa6f3('0x7')](_0xa6f3('0xf'),auth['isAuthenticated'](),controller[_0xa6f3('0x10')]);router[_0xa6f3('0x11')]('/',auth[_0xa6f3('0x8')](),controller[_0xa6f3('0x12')]);router['post'](_0xa6f3('0xd'),auth[_0xa6f3('0x8')](),controller[_0xa6f3('0x13')]);router[_0xa6f3('0x11')](_0xa6f3('0x14'),auth[_0xa6f3('0x8')](),interaction[_0xa6f3('0x15')](_0xa6f3('0x16'),'faxinteraction:addtags'),controller['addTags']);router[_0xa6f3('0x17')](_0xa6f3('0x18'),auth[_0xa6f3('0x8')](),interaction[_0xa6f3('0x15')](_0xa6f3('0x16'),_0xa6f3('0x19')),controller[_0xa6f3('0x1a')]);router[_0xa6f3('0x1b')](_0xa6f3('0x18'),auth[_0xa6f3('0x8')](),interaction[_0xa6f3('0x15')](_0xa6f3('0x16'),_0xa6f3('0x1c')),controller['destroy']);router[_0xa6f3('0x1b')](_0xa6f3('0x14'),auth[_0xa6f3('0x8')](),controller[_0xa6f3('0x1d')]);module[_0xa6f3('0x1e')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 68de367..95b2ec1 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 _0x6f7f=['BOOLEAN','ENUM','out','DATE','exports','TEXT','medium'];(function(_0x2ca9d4,_0x51d5c6){var _0x258956=function(_0x47a0e5){while(--_0x47a0e5){_0x2ca9d4['push'](_0x2ca9d4['shift']());}};_0x258956(++_0x51d5c6);}(_0x6f7f,0x177));var _0xf6f7=function(_0x1f85db,_0x2d5687){_0x1f85db=_0x1f85db-0x0;var _0x5897ad=_0x6f7f[_0x1f85db];return _0x5897ad;};'use strict';var Sequelize=require('sequelize');module[_0xf6f7('0x0')]={'body':{'type':Sequelize[_0xf6f7('0x1')](_0xf6f7('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xf6f7('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xf6f7('0x4')]('in','out'),'defaultValue':_0xf6f7('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0xf6f7('0x6')]}}; \ No newline at end of file +var _0x4fef=['medium','ENUM','out','TEXT','DATE','sequelize','exports'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x4fef,0x10f));var _0xf4fe=function(_0x10ffde,_0x3cc141){_0x10ffde=_0x10ffde-0x0;var _0x19241e=_0x4fef[_0x10ffde];return _0x19241e;};'use strict';var Sequelize=require(_0xf4fe('0x0'));module[_0xf4fe('0x1')]={'body':{'type':Sequelize['TEXT'](_0xf4fe('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xf4fe('0x3')]('in',_0xf4fe('0x4')),'defaultValue':_0xf4fe('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xf4fe('0x5')],'defaultValue':null},'readAt':{'type':Sequelize[_0xf4fe('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index f401a3b..a83ff88 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 _0x08e5=['ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','destroy','stack','name','send','index','map','FaxMessage','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','where','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','show','rawAttributes','find','body','params','describe','fax-interactions','accept','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','FaxInteraction','FaxInteractionId','isNil','read1stAt','interaction','get','role','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','User','email','internal','manual','SIP/%s','channel','motionChannel','event','EventManager','reject','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','contact','fullname','interface','rejectmessage','create','CmContact','findOne','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','download','join','root','server','files','attachments','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','to-csv'];(function(_0x19c27a,_0x539b42){var _0x220da9=function(_0x3e954b){while(--_0x3e954b){_0x19c27a['push'](_0x19c27a['shift']());}};_0x220da9(++_0x539b42);}(_0x08e5,0x1a9));var _0x508e=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x08e5[_0x2064e5];return _0x21a233;};'use strict';var emlformat=require(_0x508e('0x0'));var rimraf=require(_0x508e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x508e('0x2'));var rp=require(_0x508e('0x3'));var moment=require(_0x508e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x508e('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x508e('0x6'));var ejs=require(_0x508e('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x508e('0x8'));var squel=require(_0x508e('0x9'));var crypto=require(_0x508e('0xa'));var jsforce=require(_0x508e('0xb'));var deskjs=require(_0x508e('0xc'));var toCsv=require(_0x508e('0x6'));var querystring=require(_0x508e('0xd'));var Papa=require(_0x508e('0xe'));var Redis=require(_0x508e('0xf'));var authService=require(_0x508e('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x508e('0x11'))(_0x508e('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x508e('0x13'));var db=require('../../mysqldb')['db'];config[_0x508e('0x14')]=_[_0x508e('0x15')](config[_0x508e('0x14')],{'host':_0x508e('0x16'),'port':0x18eb});var socket=require(_0x508e('0x17'))(new Redis(config[_0x508e('0x14')]));require(_0x508e('0x18'))[_0x508e('0x19')](socket);var jayson=require(_0x508e('0x1a'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x508e('0x1b')][_0x508e('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x53a40a,_0x5b665b,_0x32d74a,_0x1c65a3){return new BPromise(function(_0x2c7d75,_0x4662bb){var _0x5afc02=_0x1c65a3||client;return _0x5afc02[_0x508e('0x1d')](_0x53a40a,_0x32d74a)[_0x508e('0x1e')](function(_0x5900ab){logger[_0x508e('0x1f')](_0x508e('0x20'),_0x5b665b,_0x508e('0x21'));logger[_0x508e('0x22')](_0x508e('0x23'),_0x5b665b,_0x508e('0x21'),JSON['stringify'](_0x5900ab));if(_0x5900ab[_0x508e('0x24')]){if(_0x5900ab[_0x508e('0x24')]['code']===0x1f4){logger[_0x508e('0x24')]('FaxMessage,\x20%s,\x20%s',_0x5b665b,_0x5900ab[_0x508e('0x24')][_0x508e('0x25')]);return _0x4662bb(_0x5900ab[_0x508e('0x24')][_0x508e('0x25')]);}logger[_0x508e('0x24')](_0x508e('0x20'),_0x5b665b,_0x5900ab[_0x508e('0x24')][_0x508e('0x25')]);return _0x2c7d75(_0x5900ab['error'][_0x508e('0x25')]);}else{logger[_0x508e('0x1f')]('FaxMessage,\x20%s,\x20%s',_0x5b665b,_0x508e('0x21'));_0x2c7d75(_0x5900ab[_0x508e('0x26')]['message']);}})[_0x508e('0x27')](function(_0xbfbdf4){logger['error'](_0x508e('0x20'),_0x5b665b,_0xbfbdf4);_0x4662bb(_0xbfbdf4);});});}function respondWithStatusCode(_0x56da9d,_0x3a22f4){_0x3a22f4=_0x3a22f4||0xcc;return function(_0x45158e){if(_0x45158e){return _0x56da9d[_0x508e('0x28')](_0x3a22f4);}return _0x56da9d[_0x508e('0x29')](_0x3a22f4)[_0x508e('0x2a')]();};}function respondWithResult(_0x4e343f,_0x249828){_0x249828=_0x249828||0xc8;return function(_0x12fc81){if(_0x12fc81){return _0x4e343f[_0x508e('0x29')](_0x249828)[_0x508e('0x2b')](_0x12fc81);}};}function respondWithFilteredResult(_0x5a1bff,_0x88b461){return function(_0x825603){if(_0x825603){var _0x1f17ff=typeof _0x88b461[_0x508e('0x2c')]===_0x508e('0x2d')&&typeof _0x88b461[_0x508e('0x2e')]===_0x508e('0x2d');var _0x421878=_0x825603[_0x508e('0x2f')];var _0xa35c9d=_0x1f17ff?0x0:_0x88b461[_0x508e('0x2c')];var _0x5b4dfc=_0x1f17ff?_0x825603[_0x508e('0x2f')]:_0x88b461[_0x508e('0x2c')]+_0x88b461[_0x508e('0x2e')];var _0x35b749;if(_0x5b4dfc>=_0x421878){_0x5b4dfc=_0x421878;_0x35b749=0xc8;}else{_0x35b749=0xce;}_0x5a1bff[_0x508e('0x29')](_0x35b749);return _0x5a1bff[_0x508e('0x30')](_0x508e('0x31'),_0xa35c9d+'-'+_0x5b4dfc+'/'+_0x421878)[_0x508e('0x2b')](_0x825603);}return null;};}function patchUpdates(_0x34539c){return function(_0x177d8c){try{jsonpatch[_0x508e('0x32')](_0x177d8c,_0x34539c,!![]);}catch(_0x64a595){return BPromise['reject'](_0x64a595);}return _0x177d8c['save']();};}function saveUpdates(_0x2ed527,_0xae2896){return function(_0x5e355e){if(_0x5e355e){return _0x5e355e[_0x508e('0x33')](_0x2ed527)[_0x508e('0x1e')](function(_0x8b983c){return _0x8b983c;});}return null;};}function removeEntity(_0x599921,_0x40a8b2){return function(_0x5288f6){if(_0x5288f6){return _0x5288f6[_0x508e('0x34')]()['then'](function(){_0x599921[_0x508e('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x523c3d,_0x4de0ad){return function(_0x336248){if(!_0x336248){_0x523c3d['sendStatus'](0x194);}return _0x336248;};}function handleError(_0x34b0fb,_0x420a9a){_0x420a9a=_0x420a9a||0x1f4;return function(_0x7fff20){logger[_0x508e('0x24')](_0x7fff20[_0x508e('0x35')]);if(_0x7fff20['name']){delete _0x7fff20[_0x508e('0x36')];}_0x34b0fb['status'](_0x420a9a)[_0x508e('0x37')](_0x7fff20);};}exports[_0x508e('0x38')]=function(_0x413716,_0x34b531){var _0x1e9842={},_0x26bcd3={},_0x712c7={'count':0x0,'rows':[]};var _0x10b7de=_[_0x508e('0x39')](db[_0x508e('0x3a')]['rawAttributes'],function(_0x5c6ce0){return{'name':_0x5c6ce0[_0x508e('0x3b')],'type':_0x5c6ce0[_0x508e('0x3c')][_0x508e('0x3d')]};});_0x26bcd3[_0x508e('0x3e')]=_['map'](_0x10b7de,_0x508e('0x36'));_0x26bcd3[_0x508e('0x3f')]=_[_0x508e('0x40')](_0x413716[_0x508e('0x3f')]);_0x26bcd3[_0x508e('0x41')]=_[_0x508e('0x42')](_0x26bcd3['model'],_0x26bcd3['query']);_0x1e9842[_0x508e('0x43')]=_[_0x508e('0x42')](_0x26bcd3[_0x508e('0x3e')],qs[_0x508e('0x44')](_0x413716[_0x508e('0x3f')][_0x508e('0x44')]));_0x1e9842[_0x508e('0x43')]=_0x1e9842[_0x508e('0x43')][_0x508e('0x45')]?_0x1e9842['attributes']:_0x26bcd3[_0x508e('0x3e')];if(!_0x413716[_0x508e('0x3f')]['hasOwnProperty'](_0x508e('0x46'))){_0x1e9842[_0x508e('0x2e')]=qs[_0x508e('0x2e')](_0x413716[_0x508e('0x3f')]['limit']);_0x1e9842['offset']=qs[_0x508e('0x2c')](_0x413716[_0x508e('0x3f')][_0x508e('0x2c')]);}_0x1e9842[_0x508e('0x47')]=qs['sort'](_0x413716[_0x508e('0x3f')]['sort']);_0x1e9842[_0x508e('0x48')]=qs[_0x508e('0x41')](_['pick'](_0x413716[_0x508e('0x3f')],_0x26bcd3[_0x508e('0x41')]),_0x10b7de);if(_0x413716[_0x508e('0x3f')]['filter']){_0x1e9842[_0x508e('0x48')]=_['merge'](_0x1e9842['where'],{'$or':_[_0x508e('0x39')](_0x10b7de,function(_0x55ff3d){if(_0x55ff3d[_0x508e('0x3c')]!==_0x508e('0x49')){var _0x13156d={};_0x13156d[_0x55ff3d[_0x508e('0x36')]]={'$like':'%'+_0x413716['query'][_0x508e('0x4a')]+'%'};return _0x13156d;}})});}_0x1e9842=_[_0x508e('0x4b')]({},_0x1e9842,_0x413716[_0x508e('0x4c')]);var _0x387dc9={'where':_0x1e9842['where']};return db[_0x508e('0x3a')]['count'](_0x387dc9)['then'](function(_0x10e7ae){_0x712c7[_0x508e('0x2f')]=_0x10e7ae;if(_0x413716[_0x508e('0x3f')][_0x508e('0x4d')]){_0x1e9842[_0x508e('0x4e')]=[{'all':!![]}];}return db['FaxMessage'][_0x508e('0x4f')](_0x1e9842);})[_0x508e('0x1e')](function(_0x3f9c21){_0x712c7[_0x508e('0x50')]=_0x3f9c21;return _0x712c7;})['then'](respondWithFilteredResult(_0x34b531,_0x1e9842))[_0x508e('0x27')](handleError(_0x34b531,null));};exports[_0x508e('0x51')]=function(_0xb5dab9,_0x1a21c4){var _0x4f160d={'raw':!![],'where':{'id':_0xb5dab9['params']['id']}},_0x1824d3={};_0x1824d3[_0x508e('0x3e')]=_[_0x508e('0x40')](db[_0x508e('0x3a')][_0x508e('0x52')]);_0x1824d3[_0x508e('0x3f')]=_[_0x508e('0x40')](_0xb5dab9[_0x508e('0x3f')]);_0x1824d3[_0x508e('0x41')]=_['intersection'](_0x1824d3[_0x508e('0x3e')],_0x1824d3['query']);_0x4f160d[_0x508e('0x43')]=_[_0x508e('0x42')](_0x1824d3[_0x508e('0x3e')],qs[_0x508e('0x44')](_0xb5dab9[_0x508e('0x3f')][_0x508e('0x44')]));_0x4f160d[_0x508e('0x43')]=_0x4f160d[_0x508e('0x43')][_0x508e('0x45')]?_0x4f160d[_0x508e('0x43')]:_0x1824d3['model'];if(_0xb5dab9[_0x508e('0x3f')]['includeAll']){_0x4f160d[_0x508e('0x4e')]=[{'all':!![]}];}_0x4f160d=_[_0x508e('0x4b')]({},_0x4f160d,_0xb5dab9[_0x508e('0x4c')]);return db['FaxMessage'][_0x508e('0x53')](_0x4f160d)[_0x508e('0x1e')](handleEntityNotFound(_0x1a21c4,null))[_0x508e('0x1e')](respondWithResult(_0x1a21c4,null))[_0x508e('0x27')](handleError(_0x1a21c4,null));};exports[_0x508e('0x33')]=function(_0x20299e,_0x3cbb22){if(_0x20299e[_0x508e('0x54')]['id']){delete _0x20299e[_0x508e('0x54')]['id'];}return db['FaxMessage'][_0x508e('0x53')]({'where':{'id':_0x20299e[_0x508e('0x55')]['id']}})['then'](handleEntityNotFound(_0x3cbb22,null))[_0x508e('0x1e')](saveUpdates(_0x20299e[_0x508e('0x54')],null))['then'](respondWithResult(_0x3cbb22,null))['catch'](handleError(_0x3cbb22,null));};exports['destroy']=function(_0x2b0cb6,_0x4c8f06){return db[_0x508e('0x3a')]['find']({'where':{'id':_0x2b0cb6['params']['id']}})[_0x508e('0x1e')](handleEntityNotFound(_0x4c8f06,null))[_0x508e('0x1e')](removeEntity(_0x4c8f06,null))[_0x508e('0x27')](handleError(_0x4c8f06,null));};exports[_0x508e('0x56')]=function(_0x147a19,_0x50e645){return db[_0x508e('0x3a')][_0x508e('0x56')]()[_0x508e('0x1e')](respondWithResult(_0x50e645,null))['catch'](handleError(_0x50e645,null));};var interaction_log=require(_0x508e('0x11'))(_0x508e('0x57'));exports[_0x508e('0x58')]=function(_0x450f16,_0x3ee8c3,_0xa6cd46){var _0x3b9982={'agent':{},'channel':_0x508e('0x59')};if(_0x450f16[_0x508e('0x54')]['id']){delete _0x450f16['body']['id'];}_0x450f16['body'][_0x508e('0x5a')]=!![];_0x450f16[_0x508e('0x54')][_0x508e('0x5b')]=moment()[_0x508e('0x5c')](_0x508e('0x5d'));_0x450f16['body'][_0x508e('0x5e')]=_0x450f16[_0x508e('0x54')][_0x508e('0x5e')]||_0x450f16[_0x508e('0x5f')]['id'];_0x3b9982[_0x508e('0x60')]['id']=_0x450f16[_0x508e('0x54')][_0x508e('0x5e')];return db[_0x508e('0x3a')][_0x508e('0x53')]({'where':{'id':_0x450f16[_0x508e('0x55')]['id'],'UserId':null}})[_0x508e('0x1e')](handleEntityNotFound(_0x3ee8c3,null))[_0x508e('0x1e')](saveUpdates(_0x450f16[_0x508e('0x54')],null))[_0x508e('0x1e')](function(_0x5172ab){if(_0x5172ab){_0x3b9982[_0x508e('0x25')]=_0x5172ab['get']({'plain':!![]});return db[_0x508e('0x61')][_0x508e('0x53')]({'where':{'id':_0x5172ab[_0x508e('0x62')]}});}return null;})[_0x508e('0x1e')](handleEntityNotFound(_0x3ee8c3,null))['then'](function(_0xd036b){if(_0xd036b){return _0xd036b[_0x508e('0x33')]({'UserId':_0x450f16[_0x508e('0x54')][_0x508e('0x5e')],'read1stAt':_[_0x508e('0x63')](_0xd036b[_0x508e('0x64')])?moment()[_0x508e('0x5c')](_0x508e('0x5d')):undefined});}return null;})[_0x508e('0x1e')](function(_0x2d764d){if(_0x2d764d){_0x3b9982[_0x508e('0x65')]=_0x2d764d[_0x508e('0x66')]({'plain':!![]});interaction_log[_0x508e('0x1f')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x450f16['user']['id'],_0x450f16[_0x508e('0x5f')][_0x508e('0x36')],_0x450f16['user'][_0x508e('0x67')],_0x3b9982['interaction']['id'],_0x450f16['body']?JSON[_0x508e('0x68')](_0x450f16[_0x508e('0x54')]):_0x508e('0x69'));return respondWithRpcPromise(_0x508e('0x6a'),_0x508e('0x6b'),_0x3b9982);}return null;})[_0x508e('0x1e')](function(_0x11330d){var _0x1a91bf=_0x508e('0x6c')+_0x11330d[_0x508e('0x25')][_0x508e('0x6d')];return db[_0x508e('0x6e')][_0x508e('0x3f')](_0x1a91bf,{'type':db['Sequelize'][_0x508e('0x6f')][_0x508e('0x70')],'raw':!![]})[_0x508e('0x1e')](function(_0x2320a0){return _0x2320a0;});})[_0x508e('0x1e')](function(_0x2c63c3){if(_0x2c63c3){_0x3b9982[_0x508e('0x25')]['contact']=_0x2c63c3[0x0];if(!_0x450f16[_0x508e('0x54')][_0x508e('0x5e')])return;return db[_0x508e('0x71')][_0x508e('0x53')]({'where':{'id':_0x450f16['body'][_0x508e('0x5e')],'role':'agent'},'attributes':['id',_0x508e('0x36'),'fullname',_0x508e('0x72'),_0x508e('0x73')],'raw':!![]});}return null;})[_0x508e('0x1e')](function(_0x2a07f9){if(!_0x2a07f9)return null;_0x3b9982['message'][_0x508e('0x60')]=_0x2a07f9;return _0x3b9982;})[_0x508e('0x1e')](function(_0x3ce1e2){if(_0x3ce1e2){if(_0x450f16[_0x508e('0x54')][_0x508e('0x74')]){_0x3b9982[_0x508e('0x25')]['interface']=util[_0x508e('0x5c')](_0x508e('0x75'),_0x450f16[_0x508e('0x5f')][_0x508e('0x36')]);_0x3b9982[_0x508e('0x25')][_0x508e('0x76')]=_0x3b9982[_0x508e('0x76')];_0x3b9982[_0x508e('0x25')][_0x508e('0x77')]=_0x3b9982[_0x508e('0x76')];_0x3b9982['message'][_0x508e('0x78')]=_0x508e('0x58');return respondWithRpcPromise(_0x508e('0x79'),_0x508e('0x79'),{'event':'acceptmessage','message':_0x3b9982['message']},client9002)[_0x508e('0x1e')](function(){return _0x3b9982;});}return _0x3b9982;}return null;})[_0x508e('0x1e')](respondWithResult(_0x3ee8c3,null))[_0x508e('0x27')](handleError(_0x3ee8c3,null));};var interaction_log=require(_0x508e('0x11'))(_0x508e('0x57'));exports[_0x508e('0x7a')]=function(_0x1f2f3c,_0x84ad6e,_0x5317be){var _0x577d5a={'agent':{},'channel':_0x508e('0x59')};if(_0x1f2f3c[_0x508e('0x54')]['id']){delete _0x1f2f3c[_0x508e('0x54')]['id'];}_0x1f2f3c[_0x508e('0x54')][_0x508e('0x5e')]=_0x1f2f3c[_0x508e('0x54')][_0x508e('0x5e')]||_0x1f2f3c[_0x508e('0x5f')]['id'];_0x577d5a['agent']['id']=_0x1f2f3c['body'][_0x508e('0x5e')];return db[_0x508e('0x3a')]['find']({'where':{'id':_0x1f2f3c[_0x508e('0x55')]['id'],'UserId':null}})[_0x508e('0x1e')](handleEntityNotFound(_0x84ad6e,null))[_0x508e('0x1e')](function(_0x33eb48){if(_0x33eb48){_0x577d5a['message']=_0x33eb48[_0x508e('0x66')]({'plain':!![]});return db['FaxInteraction'][_0x508e('0x53')]({'where':{'id':_0x33eb48[_0x508e('0x62')]}});}return null;})[_0x508e('0x1e')](handleEntityNotFound(_0x84ad6e,null))[_0x508e('0x1e')](function(_0x4899be){if(_0x4899be){_0x577d5a[_0x508e('0x65')]=_0x4899be[_0x508e('0x66')]({'plain':!![]});interaction_log[_0x508e('0x1f')](_0x508e('0x7b'),_0x1f2f3c[_0x508e('0x5f')]['id'],_0x1f2f3c[_0x508e('0x5f')][_0x508e('0x36')],_0x1f2f3c[_0x508e('0x5f')][_0x508e('0x67')],_0x577d5a[_0x508e('0x65')]['id'],_0x1f2f3c['body']?JSON[_0x508e('0x68')](_0x1f2f3c[_0x508e('0x54')]):_0x508e('0x69'));return respondWithRpcPromise(_0x508e('0x7c'),_0x508e('0x7d'),_0x577d5a);}return null;})['then'](function(_0x5ca6d7){var _0x17025c=_0x508e('0x6c')+_0x5ca6d7[_0x508e('0x25')]['ContactId'];return db[_0x508e('0x6e')]['query'](_0x17025c,{'type':db['Sequelize'][_0x508e('0x6f')][_0x508e('0x70')],'raw':!![]})['then'](function(_0x48785f){return _0x48785f;});})[_0x508e('0x1e')](function(_0x35746e){if(_0x35746e){_0x577d5a['message'][_0x508e('0x7e')]=_0x35746e[0x0];if(!_0x1f2f3c['body'][_0x508e('0x5e')])return;return db[_0x508e('0x71')][_0x508e('0x53')]({'where':{'id':_0x1f2f3c[_0x508e('0x54')]['UserId'],'role':_0x508e('0x60')},'attributes':['id',_0x508e('0x36'),_0x508e('0x7f'),_0x508e('0x72'),_0x508e('0x73')],'raw':!![]});}return null;})['then'](function(_0x2c8d10){if(!_0x2c8d10)return null;_0x577d5a[_0x508e('0x25')][_0x508e('0x60')]=_0x2c8d10;return _0x577d5a;})['then'](function(_0x1ca7cb){if(_0x1ca7cb){_0x1ca7cb['message'][_0x508e('0x80')]=util['format']('SIP/%s',_0x1f2f3c[_0x508e('0x5f')][_0x508e('0x36')]);_0x1ca7cb[_0x508e('0x25')][_0x508e('0x76')]=_0x577d5a['channel'];_0x1ca7cb[_0x508e('0x25')][_0x508e('0x77')]=_0x577d5a[_0x508e('0x76')];_0x1ca7cb['message'][_0x508e('0x78')]=_0x508e('0x7a');respondWithRpcPromise(_0x508e('0x79'),_0x508e('0x79'),{'event':_0x508e('0x81'),'message':_0x1ca7cb[_0x508e('0x25')]},client9002);return _0x577d5a;}return null;})[_0x508e('0x1e')](respondWithResult(_0x84ad6e,null))[_0x508e('0x27')](handleError(_0x84ad6e,null));};exports[_0x508e('0x82')]=function(_0x48e5ec,_0x19da63){var _0x12d0da;return db[_0x508e('0x3a')][_0x508e('0x82')](_0x48e5ec['body'],{})[_0x508e('0x1e')](function(_0x24628a){_0x12d0da=_0x24628a;return db[_0x508e('0x83')][_0x508e('0x84')]({'where':{'id':_0x12d0da[_0x508e('0x6d')]}});})['then'](function(_0x1e4e76){if(_['isNil'](_0x1e4e76)){return;}else{_0x12d0da[_0x508e('0x59')]=_0x1e4e76[_0x508e('0x59')];return db[_0x508e('0x85')][_0x508e('0x84')]({'where':{'id':_0x12d0da[_0x508e('0x86')]}});}})['then'](function(_0x4c8936){return respondWithRpcPromise('SendFax',_0x508e('0x87'),{'FaxAccountId':_[_0x508e('0x63')](_0x48e5ec[_0x508e('0x54')])?undefined:_0x48e5ec[_0x508e('0x54')][_0x508e('0x88')],'path':_[_0x508e('0x63')](_0x4c8936)?undefined:util[_0x508e('0x5c')](_0x508e('0x89'),_0x4c8936['basename']),'fax':_[_0x508e('0x63')](_0x12d0da[_0x508e('0x59')])?undefined:_0x12d0da['fax'],'AttachmentId':_0x12d0da[_0x508e('0x86')]},client9002);})['then'](respondWithResult(_0x19da63,0xc9))['catch'](handleError(_0x19da63,null));};exports[_0x508e('0x8a')]=function(_0x5097fd,_0x3fd6dd){var _0x15380c=path[_0x508e('0x8b')](config[_0x508e('0x8c')],_0x508e('0x8d'),_0x508e('0x8e'),_0x508e('0x8f'));return db['FaxMessage']['find']({'where':{'id':_0x5097fd[_0x508e('0x55')]['id']},'include':[{'model':db[_0x508e('0x85')],'as':_0x508e('0x85')}]})[_0x508e('0x1e')](handleEntityNotFound(_0x3fd6dd,null))['then'](function(_0x333a1d){if(_0x333a1d){return _0x3fd6dd[_0x508e('0x8a')](path[_0x508e('0x8b')](_0x15380c,_0x333a1d[_0x508e('0x85')]['basename']));}})[_0x508e('0x27')](handleError(_0x3fd6dd,null));}; \ No newline at end of file +var _0xb7d0=['QueryTypes','SELECT','contact','User','agent','fullname','email','internal','interface','SIP/%s','channel','event','EventManager','fax','FaxInteractionId','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','ContactId','CmContact','findOne','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','root','server','files','attachments','join','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','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','redis','defaults','./faxMessage.socket','client','http','then','info','debug','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','request\x20sent','result','catch','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','destroy','end','stack','name','send','index','rawAttributes','fieldName','type','key','map','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','options','FaxMessage','includeAll','include','findAll','rows','params','merge','body','find','describe','accept','readAt','format','UserId','get','isNil','YYYY-MM-DD\x20HH:mm:ss','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xb7d0,0xab));var _0x0b7d=function(_0x417955,_0x4ed8c8){_0x417955=_0x417955-0x0;var _0x3a94ef=_0xb7d0[_0x417955];return _0x3a94ef;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0b7d('0x0'));var zipdir=require(_0x0b7d('0x1'));var jsonpatch=require(_0x0b7d('0x2'));var rp=require('request-promise');var moment=require(_0x0b7d('0x3'));var BPromise=require(_0x0b7d('0x4'));var Mustache=require(_0x0b7d('0x5'));var util=require(_0x0b7d('0x6'));var path=require(_0x0b7d('0x7'));var sox=require(_0x0b7d('0x8'));var csv=require('to-csv');var ejs=require(_0x0b7d('0x9'));var fs=require('fs');var fs_extra=require(_0x0b7d('0xa'));var _=require(_0x0b7d('0xb'));var squel=require(_0x0b7d('0xc'));var crypto=require('crypto');var jsforce=require(_0x0b7d('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0b7d('0xe'));var Papa=require(_0x0b7d('0xf'));var Redis=require('ioredis');var authService=require(_0x0b7d('0x10'));var qs=require(_0x0b7d('0x11'));var as=require(_0x0b7d('0x12'));var hardwareService=require(_0x0b7d('0x13'));var logger=require(_0x0b7d('0x14'))(_0x0b7d('0x15'));var utils=require(_0x0b7d('0x16'));var config=require(_0x0b7d('0x17'));var licenseUtil=require(_0x0b7d('0x18'));var db=require(_0x0b7d('0x19'))['db'];config[_0x0b7d('0x1a')]=_[_0x0b7d('0x1b')](config[_0x0b7d('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0b7d('0x1c'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x0b7d('0x1d')][_0x0b7d('0x1e')]({'port':0x232c});var client9002=jayson[_0x0b7d('0x1d')][_0x0b7d('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x893369,_0x21812c,_0x367246,_0x2d941f){return new BPromise(function(_0x3cdefb,_0x2857fd){var _0x41a9e5=_0x2d941f||client;return _0x41a9e5['request'](_0x893369,_0x367246)[_0x0b7d('0x1f')](function(_0x74fbfe){logger[_0x0b7d('0x20')]('FaxMessage,\x20%s,\x20%s',_0x21812c,'request\x20sent');logger[_0x0b7d('0x21')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x21812c,'request\x20sent',JSON[_0x0b7d('0x22')](_0x74fbfe));if(_0x74fbfe[_0x0b7d('0x23')]){if(_0x74fbfe['error'][_0x0b7d('0x24')]===0x1f4){logger[_0x0b7d('0x23')](_0x0b7d('0x25'),_0x21812c,_0x74fbfe[_0x0b7d('0x23')][_0x0b7d('0x26')]);return _0x2857fd(_0x74fbfe[_0x0b7d('0x23')][_0x0b7d('0x26')]);}logger['error'](_0x0b7d('0x25'),_0x21812c,_0x74fbfe[_0x0b7d('0x23')][_0x0b7d('0x26')]);return _0x3cdefb(_0x74fbfe[_0x0b7d('0x23')][_0x0b7d('0x26')]);}else{logger[_0x0b7d('0x20')](_0x0b7d('0x25'),_0x21812c,_0x0b7d('0x27'));_0x3cdefb(_0x74fbfe[_0x0b7d('0x28')][_0x0b7d('0x26')]);}})[_0x0b7d('0x29')](function(_0x266a86){logger['error'](_0x0b7d('0x25'),_0x21812c,_0x266a86);_0x2857fd(_0x266a86);});});}function respondWithStatusCode(_0x54978a,_0x455d5c){_0x455d5c=_0x455d5c||0xcc;return function(_0x5b1946){if(_0x5b1946){return _0x54978a[_0x0b7d('0x2a')](_0x455d5c);}return _0x54978a[_0x0b7d('0x2b')](_0x455d5c)['end']();};}function respondWithResult(_0x29a350,_0xb2f851){_0xb2f851=_0xb2f851||0xc8;return function(_0x16e487){if(_0x16e487){return _0x29a350[_0x0b7d('0x2b')](_0xb2f851)[_0x0b7d('0x2c')](_0x16e487);}};}function respondWithFilteredResult(_0x51c35b,_0x1eeb1f){return function(_0x162247){if(_0x162247){var _0x342611=typeof _0x1eeb1f['offset']==='undefined'&&typeof _0x1eeb1f[_0x0b7d('0x2d')]===_0x0b7d('0x2e');var _0x1b3586=_0x162247[_0x0b7d('0x2f')];var _0x2b32b9=_0x342611?0x0:_0x1eeb1f['offset'];var _0x3e0dba=_0x342611?_0x162247[_0x0b7d('0x2f')]:_0x1eeb1f[_0x0b7d('0x30')]+_0x1eeb1f[_0x0b7d('0x2d')];var _0x21a947;if(_0x3e0dba>=_0x1b3586){_0x3e0dba=_0x1b3586;_0x21a947=0xc8;}else{_0x21a947=0xce;}_0x51c35b[_0x0b7d('0x2b')](_0x21a947);return _0x51c35b[_0x0b7d('0x31')](_0x0b7d('0x32'),_0x2b32b9+'-'+_0x3e0dba+'/'+_0x1b3586)[_0x0b7d('0x2c')](_0x162247);}return null;};}function patchUpdates(_0xa01217){return function(_0x5c0c65){try{jsonpatch[_0x0b7d('0x33')](_0x5c0c65,_0xa01217,!![]);}catch(_0xbf4428){return BPromise[_0x0b7d('0x34')](_0xbf4428);}return _0x5c0c65[_0x0b7d('0x35')]();};}function saveUpdates(_0x73f7db,_0x5d3e2e){return function(_0x4241ba){if(_0x4241ba){return _0x4241ba[_0x0b7d('0x36')](_0x73f7db)[_0x0b7d('0x1f')](function(_0x3da54d){return _0x3da54d;});}return null;};}function removeEntity(_0x154524,_0x14d943){return function(_0x41e685){if(_0x41e685){return _0x41e685[_0x0b7d('0x37')]()[_0x0b7d('0x1f')](function(){_0x154524['status'](0xcc)[_0x0b7d('0x38')]();});}};}function handleEntityNotFound(_0x388ee6,_0x392da6){return function(_0x1a8569){if(!_0x1a8569){_0x388ee6['sendStatus'](0x194);}return _0x1a8569;};}function handleError(_0x111176,_0x6296be){_0x6296be=_0x6296be||0x1f4;return function(_0x20def9){logger[_0x0b7d('0x23')](_0x20def9[_0x0b7d('0x39')]);if(_0x20def9[_0x0b7d('0x3a')]){delete _0x20def9[_0x0b7d('0x3a')];}_0x111176['status'](_0x6296be)[_0x0b7d('0x3b')](_0x20def9);};}exports[_0x0b7d('0x3c')]=function(_0x546dae,_0x17a28c){var _0x59098d={},_0x3f3442={},_0x2ebd2c={'count':0x0,'rows':[]};var _0x3c04c1=_['map'](db['FaxMessage'][_0x0b7d('0x3d')],function(_0x479884){return{'name':_0x479884[_0x0b7d('0x3e')],'type':_0x479884[_0x0b7d('0x3f')][_0x0b7d('0x40')]};});_0x3f3442['model']=_[_0x0b7d('0x41')](_0x3c04c1,_0x0b7d('0x3a'));_0x3f3442[_0x0b7d('0x42')]=_[_0x0b7d('0x43')](_0x546dae['query']);_0x3f3442[_0x0b7d('0x44')]=_['intersection'](_0x3f3442[_0x0b7d('0x45')],_0x3f3442[_0x0b7d('0x42')]);_0x59098d[_0x0b7d('0x46')]=_[_0x0b7d('0x47')](_0x3f3442['model'],qs['fields'](_0x546dae[_0x0b7d('0x42')][_0x0b7d('0x48')]));_0x59098d[_0x0b7d('0x46')]=_0x59098d[_0x0b7d('0x46')][_0x0b7d('0x49')]?_0x59098d['attributes']:_0x3f3442['model'];if(!_0x546dae[_0x0b7d('0x42')][_0x0b7d('0x4a')]('nolimit')){_0x59098d[_0x0b7d('0x2d')]=qs['limit'](_0x546dae[_0x0b7d('0x42')][_0x0b7d('0x2d')]);_0x59098d['offset']=qs[_0x0b7d('0x30')](_0x546dae['query'][_0x0b7d('0x30')]);}_0x59098d[_0x0b7d('0x4b')]=qs[_0x0b7d('0x4c')](_0x546dae[_0x0b7d('0x42')]['sort']);_0x59098d['where']=qs[_0x0b7d('0x44')](_[_0x0b7d('0x4d')](_0x546dae[_0x0b7d('0x42')],_0x3f3442[_0x0b7d('0x44')]),_0x3c04c1);if(_0x546dae['query'][_0x0b7d('0x4e')]){_0x59098d[_0x0b7d('0x4f')]=_['merge'](_0x59098d[_0x0b7d('0x4f')],{'$or':_['map'](_0x3c04c1,function(_0x41b012){if(_0x41b012['type']!==_0x0b7d('0x50')){var _0x10e3c6={};_0x10e3c6[_0x41b012[_0x0b7d('0x3a')]]={'$like':'%'+_0x546dae[_0x0b7d('0x42')]['filter']+'%'};return _0x10e3c6;}})});}_0x59098d=_['merge']({},_0x59098d,_0x546dae[_0x0b7d('0x51')]);var _0x12d810={'where':_0x59098d[_0x0b7d('0x4f')]};return db[_0x0b7d('0x52')][_0x0b7d('0x2f')](_0x12d810)[_0x0b7d('0x1f')](function(_0x5d9803){_0x2ebd2c[_0x0b7d('0x2f')]=_0x5d9803;if(_0x546dae['query'][_0x0b7d('0x53')]){_0x59098d[_0x0b7d('0x54')]=[{'all':!![]}];}return db[_0x0b7d('0x52')][_0x0b7d('0x55')](_0x59098d);})[_0x0b7d('0x1f')](function(_0x343c2c){_0x2ebd2c[_0x0b7d('0x56')]=_0x343c2c;return _0x2ebd2c;})['then'](respondWithFilteredResult(_0x17a28c,_0x59098d))[_0x0b7d('0x29')](handleError(_0x17a28c,null));};exports['show']=function(_0x195c2c,_0x29d76b){var _0x36d34f={'raw':!![],'where':{'id':_0x195c2c[_0x0b7d('0x57')]['id']}},_0x17557b={};_0x17557b['model']=_[_0x0b7d('0x43')](db[_0x0b7d('0x52')][_0x0b7d('0x3d')]);_0x17557b['query']=_['keys'](_0x195c2c[_0x0b7d('0x42')]);_0x17557b['filters']=_[_0x0b7d('0x47')](_0x17557b[_0x0b7d('0x45')],_0x17557b[_0x0b7d('0x42')]);_0x36d34f[_0x0b7d('0x46')]=_[_0x0b7d('0x47')](_0x17557b[_0x0b7d('0x45')],qs[_0x0b7d('0x48')](_0x195c2c[_0x0b7d('0x42')][_0x0b7d('0x48')]));_0x36d34f[_0x0b7d('0x46')]=_0x36d34f[_0x0b7d('0x46')]['length']?_0x36d34f[_0x0b7d('0x46')]:_0x17557b[_0x0b7d('0x45')];if(_0x195c2c[_0x0b7d('0x42')][_0x0b7d('0x53')]){_0x36d34f[_0x0b7d('0x54')]=[{'all':!![]}];}_0x36d34f=_[_0x0b7d('0x58')]({},_0x36d34f,_0x195c2c['options']);return db[_0x0b7d('0x52')]['find'](_0x36d34f)['then'](handleEntityNotFound(_0x29d76b,null))[_0x0b7d('0x1f')](respondWithResult(_0x29d76b,null))[_0x0b7d('0x29')](handleError(_0x29d76b,null));};exports[_0x0b7d('0x36')]=function(_0xc83ef1,_0x3c7bfb){if(_0xc83ef1[_0x0b7d('0x59')]['id']){delete _0xc83ef1[_0x0b7d('0x59')]['id'];}return db[_0x0b7d('0x52')][_0x0b7d('0x5a')]({'where':{'id':_0xc83ef1[_0x0b7d('0x57')]['id']}})[_0x0b7d('0x1f')](handleEntityNotFound(_0x3c7bfb,null))[_0x0b7d('0x1f')](saveUpdates(_0xc83ef1[_0x0b7d('0x59')],null))['then'](respondWithResult(_0x3c7bfb,null))[_0x0b7d('0x29')](handleError(_0x3c7bfb,null));};exports[_0x0b7d('0x37')]=function(_0x1c8c58,_0x731c61){return db[_0x0b7d('0x52')]['find']({'where':{'id':_0x1c8c58['params']['id']}})[_0x0b7d('0x1f')](handleEntityNotFound(_0x731c61,null))[_0x0b7d('0x1f')](removeEntity(_0x731c61,null))[_0x0b7d('0x29')](handleError(_0x731c61,null));};exports[_0x0b7d('0x5b')]=function(_0x11191e,_0x494601){return db['FaxMessage']['describe']()[_0x0b7d('0x1f')](respondWithResult(_0x494601,null))[_0x0b7d('0x29')](handleError(_0x494601,null));};var interaction_log=require(_0x0b7d('0x14'))('fax-interactions');exports[_0x0b7d('0x5c')]=function(_0x42d045,_0x107809,_0x1a534b){var _0x13a71b={'agent':{},'channel':'fax'};if(_0x42d045[_0x0b7d('0x59')]['id']){delete _0x42d045[_0x0b7d('0x59')]['id'];}_0x42d045[_0x0b7d('0x59')]['read']=!![];_0x42d045['body'][_0x0b7d('0x5d')]=moment()[_0x0b7d('0x5e')]('YYYY-MM-DD\x20HH:mm:ss');_0x42d045[_0x0b7d('0x59')][_0x0b7d('0x5f')]=_0x42d045['body'][_0x0b7d('0x5f')]||_0x42d045['user']['id'];_0x13a71b['agent']['id']=_0x42d045[_0x0b7d('0x59')][_0x0b7d('0x5f')];return db[_0x0b7d('0x52')]['find']({'where':{'id':_0x42d045[_0x0b7d('0x57')]['id'],'UserId':null}})[_0x0b7d('0x1f')](handleEntityNotFound(_0x107809,null))['then'](saveUpdates(_0x42d045['body'],null))[_0x0b7d('0x1f')](function(_0x50f481){if(_0x50f481){_0x13a71b['message']=_0x50f481[_0x0b7d('0x60')]({'plain':!![]});return db['FaxInteraction'][_0x0b7d('0x5a')]({'where':{'id':_0x50f481['FaxInteractionId']}});}return null;})[_0x0b7d('0x1f')](handleEntityNotFound(_0x107809,null))[_0x0b7d('0x1f')](function(_0x34c038){if(_0x34c038){return _0x34c038[_0x0b7d('0x36')]({'UserId':_0x42d045[_0x0b7d('0x59')]['UserId'],'read1stAt':_[_0x0b7d('0x61')](_0x34c038['read1stAt'])?moment()[_0x0b7d('0x5e')](_0x0b7d('0x62')):undefined});}return null;})[_0x0b7d('0x1f')](function(_0x3546a9){if(_0x3546a9){_0x13a71b[_0x0b7d('0x63')]=_0x3546a9[_0x0b7d('0x60')]({'plain':!![]});interaction_log[_0x0b7d('0x20')](_0x0b7d('0x64'),_0x42d045[_0x0b7d('0x65')]['id'],_0x42d045[_0x0b7d('0x65')][_0x0b7d('0x3a')],_0x42d045[_0x0b7d('0x65')]['role'],_0x13a71b['interaction']['id'],_0x42d045[_0x0b7d('0x59')]?JSON['stringify'](_0x42d045['body']):_0x0b7d('0x66'));return respondWithRpcPromise('AcceptMessage',_0x0b7d('0x67'),_0x13a71b);}return null;})['then'](function(_0x4dc0ed){var _0x56695b=_0x0b7d('0x68')+_0x4dc0ed[_0x0b7d('0x26')]['ContactId'];return db[_0x0b7d('0x69')]['query'](_0x56695b,{'type':db[_0x0b7d('0x6a')][_0x0b7d('0x6b')][_0x0b7d('0x6c')],'raw':!![]})[_0x0b7d('0x1f')](function(_0x3a0a90){return _0x3a0a90;});})[_0x0b7d('0x1f')](function(_0x8f11f5){if(_0x8f11f5){_0x13a71b[_0x0b7d('0x26')][_0x0b7d('0x6d')]=_0x8f11f5[0x0];if(!_0x42d045[_0x0b7d('0x59')][_0x0b7d('0x5f')])return;return db[_0x0b7d('0x6e')]['find']({'where':{'id':_0x42d045['body'][_0x0b7d('0x5f')],'role':_0x0b7d('0x6f')},'attributes':['id',_0x0b7d('0x3a'),_0x0b7d('0x70'),_0x0b7d('0x71'),_0x0b7d('0x72')],'raw':!![]});}return null;})[_0x0b7d('0x1f')](function(_0x5b6c40){if(!_0x5b6c40)return null;_0x13a71b['message'][_0x0b7d('0x6f')]=_0x5b6c40;return _0x13a71b;})[_0x0b7d('0x1f')](function(_0x368b5a){if(_0x368b5a){if(_0x42d045[_0x0b7d('0x59')]['manual']){_0x13a71b[_0x0b7d('0x26')][_0x0b7d('0x73')]=util['format'](_0x0b7d('0x74'),_0x42d045[_0x0b7d('0x65')][_0x0b7d('0x3a')]);_0x13a71b['message'][_0x0b7d('0x75')]=_0x13a71b[_0x0b7d('0x75')];_0x13a71b['message']['motionChannel']=_0x13a71b['channel'];_0x13a71b[_0x0b7d('0x26')][_0x0b7d('0x76')]=_0x0b7d('0x5c');return respondWithRpcPromise(_0x0b7d('0x77'),'EventManager',{'event':'acceptmessage','message':_0x13a71b[_0x0b7d('0x26')]},client9002)[_0x0b7d('0x1f')](function(){return _0x13a71b;});}return _0x13a71b;}return null;})[_0x0b7d('0x1f')](respondWithResult(_0x107809,null))[_0x0b7d('0x29')](handleError(_0x107809,null));};var interaction_log=require(_0x0b7d('0x14'))('fax-interactions');exports[_0x0b7d('0x34')]=function(_0x53b563,_0x4930c0,_0x2de5fa){var _0x12671e={'agent':{},'channel':_0x0b7d('0x78')};if(_0x53b563['body']['id']){delete _0x53b563[_0x0b7d('0x59')]['id'];}_0x53b563[_0x0b7d('0x59')][_0x0b7d('0x5f')]=_0x53b563[_0x0b7d('0x59')][_0x0b7d('0x5f')]||_0x53b563[_0x0b7d('0x65')]['id'];_0x12671e[_0x0b7d('0x6f')]['id']=_0x53b563[_0x0b7d('0x59')][_0x0b7d('0x5f')];return db[_0x0b7d('0x52')]['find']({'where':{'id':_0x53b563[_0x0b7d('0x57')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4930c0,null))[_0x0b7d('0x1f')](function(_0xbb080f){if(_0xbb080f){_0x12671e[_0x0b7d('0x26')]=_0xbb080f[_0x0b7d('0x60')]({'plain':!![]});return db['FaxInteraction'][_0x0b7d('0x5a')]({'where':{'id':_0xbb080f[_0x0b7d('0x79')]}});}return null;})[_0x0b7d('0x1f')](handleEntityNotFound(_0x4930c0,null))['then'](function(_0x4066e9){if(_0x4066e9){_0x12671e['interaction']=_0x4066e9[_0x0b7d('0x60')]({'plain':!![]});interaction_log[_0x0b7d('0x20')](_0x0b7d('0x7a'),_0x53b563[_0x0b7d('0x65')]['id'],_0x53b563['user'][_0x0b7d('0x3a')],_0x53b563[_0x0b7d('0x65')][_0x0b7d('0x7b')],_0x12671e[_0x0b7d('0x63')]['id'],_0x53b563[_0x0b7d('0x59')]?JSON[_0x0b7d('0x22')](_0x53b563[_0x0b7d('0x59')]):_0x0b7d('0x66'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x12671e);}return null;})[_0x0b7d('0x1f')](function(_0x131c7b){var _0x119350=_0x0b7d('0x68')+_0x131c7b[_0x0b7d('0x26')][_0x0b7d('0x7c')];return db[_0x0b7d('0x69')]['query'](_0x119350,{'type':db[_0x0b7d('0x6a')][_0x0b7d('0x6b')][_0x0b7d('0x6c')],'raw':!![]})[_0x0b7d('0x1f')](function(_0x3862ef){return _0x3862ef;});})[_0x0b7d('0x1f')](function(_0x56aab3){if(_0x56aab3){_0x12671e[_0x0b7d('0x26')]['contact']=_0x56aab3[0x0];if(!_0x53b563[_0x0b7d('0x59')][_0x0b7d('0x5f')])return;return db[_0x0b7d('0x6e')][_0x0b7d('0x5a')]({'where':{'id':_0x53b563[_0x0b7d('0x59')]['UserId'],'role':_0x0b7d('0x6f')},'attributes':['id','name',_0x0b7d('0x70'),_0x0b7d('0x71'),_0x0b7d('0x72')],'raw':!![]});}return null;})[_0x0b7d('0x1f')](function(_0x4caee4){if(!_0x4caee4)return null;_0x12671e[_0x0b7d('0x26')][_0x0b7d('0x6f')]=_0x4caee4;return _0x12671e;})[_0x0b7d('0x1f')](function(_0x27a493){if(_0x27a493){_0x27a493[_0x0b7d('0x26')]['interface']=util[_0x0b7d('0x5e')](_0x0b7d('0x74'),_0x53b563[_0x0b7d('0x65')][_0x0b7d('0x3a')]);_0x27a493['message'][_0x0b7d('0x75')]=_0x12671e[_0x0b7d('0x75')];_0x27a493[_0x0b7d('0x26')]['motionChannel']=_0x12671e['channel'];_0x27a493[_0x0b7d('0x26')][_0x0b7d('0x76')]='reject';respondWithRpcPromise(_0x0b7d('0x77'),_0x0b7d('0x77'),{'event':'rejectmessage','message':_0x27a493['message']},client9002);return _0x12671e;}return null;})[_0x0b7d('0x1f')](respondWithResult(_0x4930c0,null))[_0x0b7d('0x29')](handleError(_0x4930c0,null));};exports['create']=function(_0x2b1780,_0x487f2c){var _0x44600f;return db[_0x0b7d('0x52')]['create'](_0x2b1780['body'],{})['then'](function(_0x55671a){_0x44600f=_0x55671a;return db[_0x0b7d('0x7d')][_0x0b7d('0x7e')]({'where':{'id':_0x44600f[_0x0b7d('0x7c')]}});})['then'](function(_0x3f9069){if(_[_0x0b7d('0x61')](_0x3f9069)){return;}else{_0x44600f[_0x0b7d('0x78')]=_0x3f9069[_0x0b7d('0x78')];return db[_0x0b7d('0x7f')]['findOne']({'where':{'id':_0x44600f[_0x0b7d('0x80')]}});}})['then'](function(_0x5b81af){return respondWithRpcPromise(_0x0b7d('0x81'),_0x0b7d('0x81'),{'FaxAccountId':_[_0x0b7d('0x61')](_0x2b1780[_0x0b7d('0x59')])?undefined:_0x2b1780[_0x0b7d('0x59')][_0x0b7d('0x82')],'path':_[_0x0b7d('0x61')](_0x5b81af)?undefined:util[_0x0b7d('0x5e')](_0x0b7d('0x83'),_0x5b81af[_0x0b7d('0x84')]),'fax':_[_0x0b7d('0x61')](_0x44600f['fax'])?undefined:_0x44600f[_0x0b7d('0x78')],'AttachmentId':_0x44600f['AttachmentId']},client9002);})[_0x0b7d('0x1f')](respondWithResult(_0x487f2c,0xc9))[_0x0b7d('0x29')](handleError(_0x487f2c,null));};exports[_0x0b7d('0x85')]=function(_0x545558,_0x2a812b){var _0x57d89b=path['join'](config[_0x0b7d('0x86')],_0x0b7d('0x87'),_0x0b7d('0x88'),_0x0b7d('0x89'));return db[_0x0b7d('0x52')]['find']({'where':{'id':_0x545558[_0x0b7d('0x57')]['id']},'include':[{'model':db[_0x0b7d('0x7f')],'as':_0x0b7d('0x7f')}]})[_0x0b7d('0x1f')](handleEntityNotFound(_0x2a812b,null))[_0x0b7d('0x1f')](function(_0x50b88d){if(_0x50b88d){return _0x2a812b['download'](path[_0x0b7d('0x8a')](_0x57d89b,_0x50b88d[_0x0b7d('0x7f')][_0x0b7d('0x84')]));}})[_0x0b7d('0x29')](handleError(_0x2a812b,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 93b7d7a..6583e32 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 _0x0755=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','FaxMessage','setMaxListeners','save','update'];(function(_0x5433ed,_0x2220db){var _0x3780c9=function(_0x45a1b7){while(--_0x45a1b7){_0x5433ed['push'](_0x5433ed['shift']());}};_0x3780c9(++_0x2220db);}(_0x0755,0x7c));var _0x5075=function(_0x389f57,_0x57b6e0){_0x389f57=_0x389f57-0x0;var _0x15c578=_0x0755[_0x389f57];return _0x15c578;};'use strict';var EventEmitter=require(_0x5075('0x0'));var FaxMessage=require(_0x5075('0x1'))['db'][_0x5075('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x5075('0x3')](0x0);var events={'afterCreate':_0x5075('0x4'),'afterUpdate':_0x5075('0x5'),'afterDestroy':_0x5075('0x6')};function emitEvent(_0x87c82d){return function(_0x348813,_0x23cb87,_0x48f487){FaxMessageEvents[_0x5075('0x7')](_0x87c82d+':'+_0x348813['id'],_0x348813);FaxMessageEvents[_0x5075('0x7')](_0x87c82d,_0x348813);_0x48f487(null);};}for(var e in events){if(events[_0x5075('0x8')](e)){var event=events[e];FaxMessage[_0x5075('0x9')](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file +var _0x687b=['setMaxListeners','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxMessage'];(function(_0x2b0bcc,_0x2d8cd0){var _0x16402b=function(_0x55a84e){while(--_0x55a84e){_0x2b0bcc['push'](_0x2b0bcc['shift']());}};_0x16402b(++_0x2d8cd0);}(_0x687b,0x14a));var _0xb687=function(_0x23da4d,_0x63498c){_0x23da4d=_0x23da4d-0x0;var _0x4ae55=_0x687b[_0x23da4d];return _0x4ae55;};'use strict';var EventEmitter=require(_0xb687('0x0'));var FaxMessage=require(_0xb687('0x1'))['db'][_0xb687('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xb687('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xb687('0x4')};function emitEvent(_0x2a4a7c){return function(_0x36c468,_0x31bd0d,_0x46e5b3){FaxMessageEvents[_0xb687('0x5')](_0x2a4a7c+':'+_0x36c468['id'],_0x36c468);FaxMessageEvents[_0xb687('0x5')](_0x2a4a7c,_0x36c468);_0x46e5b3(null);};}for(var e in events){if(events[_0xb687('0x6')](e)){var event=events[e];FaxMessage[_0xb687('0x7')](e,emitEvent(event));}}module[_0xb687('0x8')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index fd16a9a..087d0ae 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 _0x4acd=['get','toLowerCase','direction','out','UserId','findOne','FaxInteractionId','update','createdAt','error','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','exports','define','FaxMessage','fax_messages','fti_fax_messages','body','models'];(function(_0x910c0d,_0x4e8521){var _0x5d3b32=function(_0x4a0f76){while(--_0x4a0f76){_0x910c0d['push'](_0x910c0d['shift']());}};_0x5d3b32(++_0x4e8521);}(_0x4acd,0x1b3));var _0xd4ac=function(_0x999b85,_0x1edc2b){_0x999b85=_0x999b85-0x0;var _0x1d7124=_0x4acd[_0x999b85];return _0x1d7124;};'use strict';var _=require(_0xd4ac('0x0'));var util=require(_0xd4ac('0x1'));var logger=require(_0xd4ac('0x2'))(_0xd4ac('0x3'));var moment=require(_0xd4ac('0x4'));var BPromise=require('bluebird');var rp=require(_0xd4ac('0x5'));var fs=require('fs');var path=require(_0xd4ac('0x6'));var rimraf=require('rimraf');var config=require(_0xd4ac('0x7'));var attributes=require('./faxMessage.attributes');module[_0xd4ac('0x8')]=function(_0x9370ae,_0x32d8f9){return _0x9370ae[_0xd4ac('0x9')](_0xd4ac('0xa'),attributes,{'tableName':_0xd4ac('0xb'),'paranoid':![],'indexes':[{'name':_0xd4ac('0xc'),'fields':[_0xd4ac('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5195d6,_0x2e358f,_0x331774){var _0x3061f2=_0x9370ae[_0xd4ac('0xe')];var _0x3649fc=_0x5195d6[_0xd4ac('0xf')]({'plain':!![]});if(_0x3649fc['direction'][_0xd4ac('0x10')]()==='in'||_0x3649fc[_0xd4ac('0x11')][_0xd4ac('0x10')]()===_0xd4ac('0x12')&&!_0x3649fc['secret']&&!_['isNil'](_0x3649fc[_0xd4ac('0x13')])){_0x3061f2['FaxInteraction'][_0xd4ac('0x14')]({'where':{'id':_0x3649fc[_0xd4ac('0x15')]}})['then'](function(_0x28130d){if(_0x28130d){_0x28130d[_0xd4ac('0x16')]({'lastMsgAt':_0x3649fc[_0xd4ac('0x17')],'lastMsgDirection':_0x3649fc[_0xd4ac('0x11')][_0xd4ac('0x10')]()});}})['catch'](function(_0x3bdadd){console[_0xd4ac('0x18')](_0x3bdadd);});}_0x331774();}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x53eb=['request-promise','path','rimraf','../../config/environment','exports','FaxMessage','fax_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','FaxInteraction','FaxInteractionId','then','update','createdAt','lodash','util','moment','bluebird'];(function(_0x566420,_0x10818b){var _0x399b9e=function(_0x45b45c){while(--_0x45b45c){_0x566420['push'](_0x566420['shift']());}};_0x399b9e(++_0x10818b);}(_0x53eb,0x168));var _0xb53e=function(_0x3cec1c,_0x1b99e1){_0x3cec1c=_0x3cec1c-0x0;var _0x20b7a9=_0x53eb[_0x3cec1c];return _0x20b7a9;};'use strict';var _=require(_0xb53e('0x0'));var util=require(_0xb53e('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xb53e('0x2'));var BPromise=require(_0xb53e('0x3'));var rp=require(_0xb53e('0x4'));var fs=require('fs');var path=require(_0xb53e('0x5'));var rimraf=require(_0xb53e('0x6'));var config=require(_0xb53e('0x7'));var attributes=require('./faxMessage.attributes');module[_0xb53e('0x8')]=function(_0x391a63,_0x15eb28){return _0x391a63['define'](_0xb53e('0x9'),attributes,{'tableName':_0xb53e('0xa'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0xb53e('0xb')],'type':_0xb53e('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x27eb2d,_0x49ee53,_0x29ced7){var _0x8b6957=_0x391a63[_0xb53e('0xd')];var _0x4db888=_0x27eb2d[_0xb53e('0xe')]({'plain':!![]});if(_0x4db888[_0xb53e('0xf')][_0xb53e('0x10')]()==='in'||_0x4db888[_0xb53e('0xf')][_0xb53e('0x10')]()===_0xb53e('0x11')&&!_0x4db888[_0xb53e('0x12')]&&!_[_0xb53e('0x13')](_0x4db888[_0xb53e('0x14')])){_0x8b6957[_0xb53e('0x15')]['findOne']({'where':{'id':_0x4db888[_0xb53e('0x16')]}})[_0xb53e('0x17')](function(_0x29f1fb){if(_0x29f1fb){_0x29f1fb[_0xb53e('0x18')]({'lastMsgAt':_0x4db888[_0xb53e('0x19')],'lastMsgDirection':_0x4db888[_0xb53e('0xf')][_0xb53e('0x10')]()});}})['catch'](function(_0x40943c){console['error'](_0x40943c);});}_0x29ced7();}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 0223a13..cdc2556 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 _0x34e8=['request\x20sent','result','catch','CreateFaxMessage','FaxMessage','create','options','raw','update','body','attributes','limit','UpdateFaxMessage','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./faxMessage.socket','register','request','then','info','FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3e4a60,_0x22f5a6){var _0xd9605=function(_0x4c50b8){while(--_0x4c50b8){_0x3e4a60['push'](_0x3e4a60['shift']());}};_0xd9605(++_0x22f5a6);}(_0x34e8,0x12c));var _0x834e=function(_0x36f655,_0x1792d3){_0x36f655=_0x36f655-0x0;var _0x48d583=_0x34e8[_0x36f655];return _0x48d583;};'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});config['redis']=_[_0x834e('0xc')](config[_0x834e('0xd')],{'host':_0x834e('0xe'),'port':0x18eb});var socket=require(_0x834e('0xf'))(new Redis(config[_0x834e('0xd')]));require(_0x834e('0x10'))[_0x834e('0x11')](socket);function respondWithRpcPromise(_0x1af45a,_0x3bdda9,_0x186b3b){return new BPromise(function(_0x1e41fe,_0x36e124){return client[_0x834e('0x12')](_0x1af45a,_0x186b3b)[_0x834e('0x13')](function(_0x293514){logger[_0x834e('0x14')](_0x834e('0x15'),_0x3bdda9,'request\x20sent');logger[_0x834e('0x16')](_0x834e('0x17'),_0x3bdda9,'request\x20sent',JSON[_0x834e('0x18')](_0x293514));if(_0x293514[_0x834e('0x19')]){if(_0x293514[_0x834e('0x19')][_0x834e('0x1a')]===0x1f4){logger['error'](_0x834e('0x15'),_0x3bdda9,_0x293514[_0x834e('0x19')]['message']);return _0x36e124(_0x293514[_0x834e('0x19')]['message']);}logger[_0x834e('0x19')](_0x834e('0x15'),_0x3bdda9,_0x293514['error'][_0x834e('0x1b')]);return _0x1e41fe(_0x293514[_0x834e('0x19')][_0x834e('0x1b')]);}else{logger['info'](_0x834e('0x15'),_0x3bdda9,_0x834e('0x1c'));_0x1e41fe(_0x293514[_0x834e('0x1d')][_0x834e('0x1b')]);}})[_0x834e('0x1e')](function(_0x254677){logger[_0x834e('0x19')]('FaxMessage,\x20%s,\x20%s',_0x3bdda9,_0x254677);_0x36e124(_0x254677);});});}exports[_0x834e('0x1f')]=function(_0x1fd2c6){var _0x113ff4=this;return new Promise(function(_0x325a99,_0x4ab05d){return db[_0x834e('0x20')][_0x834e('0x21')](_0x1fd2c6['body'],{'raw':_0x1fd2c6[_0x834e('0x22')]?_0x1fd2c6[_0x834e('0x22')][_0x834e('0x23')]===undefined?!![]:![]:!![]})['then'](function(_0x4e3f48){logger[_0x834e('0x14')](_0x834e('0x1f'),_0x1fd2c6);logger['debug'](_0x834e('0x1f'),_0x1fd2c6,JSON[_0x834e('0x18')](_0x4e3f48));_0x325a99(_0x4e3f48);})['catch'](function(_0x3bc4f7){logger[_0x834e('0x19')](_0x834e('0x1f'),_0x3bc4f7['message'],_0x1fd2c6);_0x4ab05d(_0x113ff4[_0x834e('0x19')](0x1f4,_0x3bc4f7[_0x834e('0x1b')]));});});};exports['UpdateFaxMessage']=function(_0x5bef62){var _0x1e713a=this;return new Promise(function(_0x508a1d,_0x2826ec){return db[_0x834e('0x20')][_0x834e('0x24')](_0x5bef62[_0x834e('0x25')],{'raw':_0x5bef62[_0x834e('0x22')]?_0x5bef62[_0x834e('0x22')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5bef62['options']?_0x5bef62['options']['where']||null:null,'attributes':_0x5bef62[_0x834e('0x22')]?_0x5bef62[_0x834e('0x22')][_0x834e('0x26')]||null:null,'limit':_0x5bef62['options']?_0x5bef62[_0x834e('0x22')][_0x834e('0x27')]||null:null})[_0x834e('0x13')](function(_0x1e026a){logger[_0x834e('0x14')](_0x834e('0x28'),_0x5bef62);logger[_0x834e('0x16')](_0x834e('0x28'),_0x5bef62,JSON[_0x834e('0x18')](_0x1e026a));_0x508a1d(_0x1e026a);})['catch'](function(_0xef9ec2){logger['error'](_0x834e('0x28'),_0xef9ec2[_0x834e('0x1b')],_0x5bef62);_0x2826ec(_0x1e713a[_0x834e('0x19')](0x1f4,_0xef9ec2[_0x834e('0x1b')]));});});}; \ No newline at end of file +var _0x98a8=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','socket.io-emitter','./faxMessage.socket','register','then','info','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','code','FaxMessage,\x20%s,\x20%s','message','result','catch','CreateFaxMessage','FaxMessage','create','body','options','UpdateFaxMessage','update','raw','attributes','limit','stringify','lodash','util','moment','bluebird'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x98a8,0x12c));var _0x898a=function(_0x463aec,_0x371e04){_0x463aec=_0x463aec-0x0;var _0x376ae6=_0x98a8[_0x463aec];return _0x376ae6;};'use strict';var _=require(_0x898a('0x0'));var util=require(_0x898a('0x1'));var moment=require(_0x898a('0x2'));var BPromise=require(_0x898a('0x3'));var rs=require(_0x898a('0x4'));var fs=require('fs');var Redis=require(_0x898a('0x5'));var db=require(_0x898a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x898a('0x7'))(_0x898a('0x8'));var config=require(_0x898a('0x9'));var jayson=require(_0x898a('0xa'));var client=jayson[_0x898a('0xb')]['http']({'port':0x232a});config[_0x898a('0xc')]=_['defaults'](config[_0x898a('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x898a('0xd'))(new Redis(config[_0x898a('0xc')]));require(_0x898a('0xe'))[_0x898a('0xf')](socket);function respondWithRpcPromise(_0x3150df,_0x388a47,_0x42faa4){return new BPromise(function(_0x1a92de,_0x3806cb){return client['request'](_0x3150df,_0x42faa4)[_0x898a('0x10')](function(_0x502e95){logger[_0x898a('0x11')]('FaxMessage,\x20%s,\x20%s',_0x388a47,_0x898a('0x12'));logger[_0x898a('0x13')](_0x898a('0x14'),_0x388a47,'request\x20sent',JSON['stringify'](_0x502e95));if(_0x502e95['error']){if(_0x502e95[_0x898a('0x15')][_0x898a('0x16')]===0x1f4){logger[_0x898a('0x15')](_0x898a('0x17'),_0x388a47,_0x502e95[_0x898a('0x15')][_0x898a('0x18')]);return _0x3806cb(_0x502e95['error'][_0x898a('0x18')]);}logger['error'](_0x898a('0x17'),_0x388a47,_0x502e95['error'][_0x898a('0x18')]);return _0x1a92de(_0x502e95['error'][_0x898a('0x18')]);}else{logger['info'](_0x898a('0x17'),_0x388a47,_0x898a('0x12'));_0x1a92de(_0x502e95[_0x898a('0x19')]['message']);}})[_0x898a('0x1a')](function(_0x5960e0){logger['error'](_0x898a('0x17'),_0x388a47,_0x5960e0);_0x3806cb(_0x5960e0);});});}exports[_0x898a('0x1b')]=function(_0x58c3ab){var _0x4d374b=this;return new Promise(function(_0x12bc0f,_0x26449a){return db[_0x898a('0x1c')][_0x898a('0x1d')](_0x58c3ab[_0x898a('0x1e')],{'raw':_0x58c3ab[_0x898a('0x1f')]?_0x58c3ab[_0x898a('0x1f')]['raw']===undefined?!![]:![]:!![]})[_0x898a('0x10')](function(_0x50718e){logger[_0x898a('0x11')](_0x898a('0x1b'),_0x58c3ab);logger[_0x898a('0x13')](_0x898a('0x1b'),_0x58c3ab,JSON['stringify'](_0x50718e));_0x12bc0f(_0x50718e);})[_0x898a('0x1a')](function(_0x16c318){logger[_0x898a('0x15')](_0x898a('0x1b'),_0x16c318[_0x898a('0x18')],_0x58c3ab);_0x26449a(_0x4d374b[_0x898a('0x15')](0x1f4,_0x16c318['message']));});});};exports[_0x898a('0x20')]=function(_0x51d501){var _0x513c6b=this;return new Promise(function(_0x53ddb2,_0x3678be){return db[_0x898a('0x1c')][_0x898a('0x21')](_0x51d501[_0x898a('0x1e')],{'raw':_0x51d501[_0x898a('0x1f')]?_0x51d501[_0x898a('0x1f')][_0x898a('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x51d501[_0x898a('0x1f')]?_0x51d501[_0x898a('0x1f')]['where']||null:null,'attributes':_0x51d501['options']?_0x51d501['options'][_0x898a('0x23')]||null:null,'limit':_0x51d501[_0x898a('0x1f')]?_0x51d501[_0x898a('0x1f')][_0x898a('0x24')]||null:null})[_0x898a('0x10')](function(_0x560000){logger[_0x898a('0x11')](_0x898a('0x20'),_0x51d501);logger[_0x898a('0x13')](_0x898a('0x20'),_0x51d501,JSON[_0x898a('0x25')](_0x560000));_0x53ddb2(_0x560000);})[_0x898a('0x1a')](function(_0x494127){logger[_0x898a('0x15')](_0x898a('0x20'),_0x494127[_0x898a('0x18')],_0x51d501);_0x3678be(_0x513c6b[_0x898a('0x15')](0x1f4,_0x494127[_0x898a('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index c2f8b07..5b8855b 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 _0x1c2e=['save','remove','emit','removeListener','register','length','faxMessage:','./faxMessage.events'];(function(_0x8ebeef,_0x19fa18){var _0x2a856d=function(_0x3f8bec){while(--_0x3f8bec){_0x8ebeef['push'](_0x8ebeef['shift']());}};_0x2a856d(++_0x19fa18);}(_0x1c2e,0x137));var _0xe1c2=function(_0x5b1280,_0x5b6ab1){_0x5b1280=_0x5b1280-0x0;var _0x528f4c=_0x1c2e[_0x5b1280];return _0x528f4c;};'use strict';var FaxMessageEvents=require(_0xe1c2('0x0'));var events=[_0xe1c2('0x1'),_0xe1c2('0x2'),'update'];function createListener(_0x46d36b,_0x5c469d){return function(_0x349a5a){_0x5c469d[_0xe1c2('0x3')](_0x46d36b,_0x349a5a);};}function removeListener(_0x5c803b,_0x167038){return function(){FaxMessageEvents[_0xe1c2('0x4')](_0x5c803b,_0x167038);};}exports[_0xe1c2('0x5')]=function(_0x299bf6){for(var _0x2bfbca=0x0,_0x22fdce=events[_0xe1c2('0x6')];_0x2bfbca<_0x22fdce;_0x2bfbca++){var _0x265f53=events[_0x2bfbca];var _0x408cd6=createListener(_0xe1c2('0x7')+_0x265f53,_0x299bf6);FaxMessageEvents['on'](_0x265f53,_0x408cd6);}}; \ No newline at end of file +var _0x9c1c=['./faxMessage.events','save','remove','update','removeListener','register','length'];(function(_0x1f9f5f,_0x509fb7){var _0x51d649=function(_0x4a5285){while(--_0x4a5285){_0x1f9f5f['push'](_0x1f9f5f['shift']());}};_0x51d649(++_0x509fb7);}(_0x9c1c,0x70));var _0xc9c1=function(_0x14363e,_0x4f0e0d){_0x14363e=_0x14363e-0x0;var _0x17c56d=_0x9c1c[_0x14363e];return _0x17c56d;};'use strict';var FaxMessageEvents=require(_0xc9c1('0x0'));var events=[_0xc9c1('0x1'),_0xc9c1('0x2'),_0xc9c1('0x3')];function createListener(_0x3ac3ba,_0x5df6ce){return function(_0x148842){_0x5df6ce['emit'](_0x3ac3ba,_0x148842);};}function removeListener(_0x149459,_0x28a8a8){return function(){FaxMessageEvents[_0xc9c1('0x4')](_0x149459,_0x28a8a8);};}exports[_0xc9c1('0x5')]=function(_0x2c3940){for(var _0x1b3864=0x0,_0x3d3a50=events[_0xc9c1('0x6')];_0x1b3864<_0x3d3a50;_0x1b3864++){var _0x16e8ab=events[_0x1b3864];var _0x2aabf3=createListener('faxMessage:'+_0x16e8ab,_0x2c3940);FaxMessageEvents['on'](_0x16e8ab,_0x2aabf3);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 0ce75b3..ee9c695 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 _0xae60=['/:id/reject','reject','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','/:id/download','download','post','tracked','fax','faxmessage:create','create','put','/:id','update','/:id/accept'];(function(_0x41559d,_0x1998b3){var _0x3ae997=function(_0x5842f5){while(--_0x5842f5){_0x41559d['push'](_0x41559d['shift']());}};_0x3ae997(++_0x1998b3);}(_0xae60,0x1c7));var _0x0ae6=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xae60[_0x57b54c];return _0x59cc19;};'use strict';var multer=require(_0x0ae6('0x0'));var util=require(_0x0ae6('0x1'));var path=require(_0x0ae6('0x2'));var timeout=require('connect-timeout');var express=require(_0x0ae6('0x3'));var router=express[_0x0ae6('0x4')]();var fs_extra=require(_0x0ae6('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0ae6('0x6'));var config=require(_0x0ae6('0x7'));var controller=require('./faxMessage.controller');router[_0x0ae6('0x8')]('/',auth[_0x0ae6('0x9')](),controller[_0x0ae6('0xa')]);router[_0x0ae6('0x8')](_0x0ae6('0xb'),auth[_0x0ae6('0x9')](),controller[_0x0ae6('0xc')]);router[_0x0ae6('0x8')]('/:id',auth[_0x0ae6('0x9')](),controller[_0x0ae6('0xd')]);router[_0x0ae6('0x8')](_0x0ae6('0xe'),auth['isAuthenticated'](),controller[_0x0ae6('0xf')]);router[_0x0ae6('0x10')]('/',auth[_0x0ae6('0x9')](),interaction[_0x0ae6('0x11')](_0x0ae6('0x12'),_0x0ae6('0x13')),controller[_0x0ae6('0x14')]);router[_0x0ae6('0x15')](_0x0ae6('0x16'),auth[_0x0ae6('0x9')](),controller[_0x0ae6('0x17')]);router[_0x0ae6('0x15')](_0x0ae6('0x18'),auth[_0x0ae6('0x9')](),controller['accept']);router[_0x0ae6('0x15')](_0x0ae6('0x19'),auth[_0x0ae6('0x9')](),controller[_0x0ae6('0x1a')]);router[_0x0ae6('0x1b')](_0x0ae6('0x16'),auth[_0x0ae6('0x9')](),controller[_0x0ae6('0x1c')]);module[_0x0ae6('0x1d')]=router; \ No newline at end of file +var _0x750a=['../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/describe','/:id','show','download','tracked','faxmessage:create','create','update','/:id/accept','accept','put','/:id/reject','delete','exports','util','express','Router','fs-extra','../../components/auth/service'];(function(_0x2a6cc8,_0x43c17d){var _0x35d29a=function(_0x570a4d){while(--_0x570a4d){_0x2a6cc8['push'](_0x2a6cc8['shift']());}};_0x35d29a(++_0x43c17d);}(_0x750a,0x140));var _0xa750=function(_0x38042e,_0x336135){_0x38042e=_0x38042e-0x0;var _0x3de5f6=_0x750a[_0x38042e];return _0x3de5f6;};'use strict';var multer=require('multer');var util=require(_0xa750('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa750('0x1'));var router=express[_0xa750('0x2')]();var fs_extra=require(_0xa750('0x3'));var auth=require(_0xa750('0x4'));var interaction=require(_0xa750('0x5'));var config=require(_0xa750('0x6'));var controller=require(_0xa750('0x7'));router[_0xa750('0x8')]('/',auth[_0xa750('0x9')](),controller[_0xa750('0xa')]);router[_0xa750('0x8')](_0xa750('0xb'),auth[_0xa750('0x9')](),controller['describe']);router['get'](_0xa750('0xc'),auth['isAuthenticated'](),controller[_0xa750('0xd')]);router[_0xa750('0x8')]('/:id/download',auth[_0xa750('0x9')](),controller[_0xa750('0xe')]);router['post']('/',auth['isAuthenticated'](),interaction[_0xa750('0xf')]('fax',_0xa750('0x10')),controller[_0xa750('0x11')]);router['put'](_0xa750('0xc'),auth[_0xa750('0x9')](),controller[_0xa750('0x12')]);router['put'](_0xa750('0x13'),auth[_0xa750('0x9')](),controller[_0xa750('0x14')]);router[_0xa750('0x15')](_0xa750('0x16'),auth[_0xa750('0x9')](),controller['reject']);router[_0xa750('0x17')](_0xa750('0xc'),auth[_0xa750('0x9')](),controller['destroy']);module[_0xa750('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 d0c1758..5e5526f 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 _0x4404=['ENUM','rrmemory','beepall','sequelize','STRING','name','INTEGER'];(function(_0xd32261,_0x1912da){var _0x592420=function(_0x450bdc){while(--_0x450bdc){_0xd32261['push'](_0xd32261['shift']());}};_0x592420(++_0x1912da);}(_0x4404,0x15a));var _0x4440=function(_0x5a0517,_0x188438){_0x5a0517=_0x5a0517-0x0;var _0x395ea7=_0x4404[_0x5a0517];return _0x395ea7;};'use strict';var Sequelize=require(_0x4440('0x0'));module['exports']={'name':{'type':Sequelize[_0x4440('0x1')],'unique':_0x4440('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x4440('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4440('0x4')](_0x4440('0x5'),_0x4440('0x6'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x4440('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x737c=['INTEGER','ENUM','rrmemory','beepall','sequelize','STRING','name'];(function(_0x4ba5d6,_0x930e94){var _0x289dd7=function(_0x32344d){while(--_0x32344d){_0x4ba5d6['push'](_0x4ba5d6['shift']());}};_0x289dd7(++_0x930e94);}(_0x737c,0x1d2));var _0xc737=function(_0x46ff43,_0x231145){_0x46ff43=_0x46ff43-0x0;var _0x1a6fb9=_0x737c[_0x46ff43];return _0x1a6fb9;};'use strict';var Sequelize=require(_0xc737('0x0'));module['exports']={'name':{'type':Sequelize[_0xc737('0x1')],'unique':_0xc737('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xc737('0x1')]},'timeout':{'type':Sequelize[_0xc737('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc737('0x4')](_0xc737('0x5'),_0xc737('0x6'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xc737('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index 8c28afc..c4496d0 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 _0x9f15=['voicePause','interface','sequelize','transaction','each','findOrCreate','forEach','emit','userFaxQueue:save','select','field','tq.TeamId','team_has_fax_queues','join','ut.UserId\x20=\x20?','push','toString','SELECT','every','all','union','value','removeTeams','removeAgents','userFaxQueue:remove','addAgents','omit','spread','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','./faxQueue.socket','register','sendStatus','status','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','get','FaxQueues','UserProfileResource','error','stack','name','index','map','FaxQueue','rawAttributes','fieldName','type','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','keys','include','find','catch','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserFaxQueue','nolimit','pick','User','UserId','faxPause','format','%s/%s','SIP','createdAt','updatedAt','getTeams','addTeams','ids','Team','Agents'];(function(_0xe73080,_0x24c56d){var _0x12cbc4=function(_0x1377e2){while(--_0x1377e2){_0xe73080['push'](_0xe73080['shift']());}};_0x12cbc4(++_0x24c56d);}(_0x9f15,0xa5));var _0x59f1=function(_0x54dcad,_0x554f46){_0x54dcad=_0x54dcad-0x0;var _0x537c56=_0x9f15[_0x54dcad];return _0x537c56;};'use strict';var emlformat=require(_0x59f1('0x0'));var rimraf=require(_0x59f1('0x1'));var zipdir=require(_0x59f1('0x2'));var jsonpatch=require(_0x59f1('0x3'));var rp=require('request-promise');var moment=require(_0x59f1('0x4'));var BPromise=require(_0x59f1('0x5'));var Mustache=require(_0x59f1('0x6'));var util=require(_0x59f1('0x7'));var path=require(_0x59f1('0x8'));var sox=require(_0x59f1('0x9'));var csv=require('to-csv');var ejs=require(_0x59f1('0xa'));var fs=require('fs');var fs_extra=require(_0x59f1('0xb'));var _=require(_0x59f1('0xc'));var squel=require(_0x59f1('0xd'));var crypto=require('crypto');var jsforce=require(_0x59f1('0xe'));var deskjs=require(_0x59f1('0xf'));var toCsv=require(_0x59f1('0x10'));var querystring=require(_0x59f1('0x11'));var Papa=require(_0x59f1('0x12'));var Redis=require('ioredis');var authService=require(_0x59f1('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x59f1('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x59f1('0x15'))(_0x59f1('0x16'));var utils=require(_0x59f1('0x17'));var config=require(_0x59f1('0x18'));var licenseUtil=require(_0x59f1('0x19'));var db=require(_0x59f1('0x1a'))['db'];config['redis']=_[_0x59f1('0x1b')](config[_0x59f1('0x1c')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x59f1('0x1c')]));require(_0x59f1('0x1d'))[_0x59f1('0x1e')](socket);function respondWithStatusCode(_0x4cb7b7,_0x390cfb){_0x390cfb=_0x390cfb||0xcc;return function(_0x398fa5){if(_0x398fa5){return _0x4cb7b7[_0x59f1('0x1f')](_0x390cfb);}return _0x4cb7b7[_0x59f1('0x20')](_0x390cfb)['end']();};}function respondWithResult(_0x255cf8,_0x33cd93){_0x33cd93=_0x33cd93||0xc8;return function(_0x2d00a6){if(_0x2d00a6){return _0x255cf8['status'](_0x33cd93)[_0x59f1('0x21')](_0x2d00a6);}};}function respondWithFilteredResult(_0x14e8f9,_0x257e40){return function(_0x1eded6){if(_0x1eded6){var _0x1f03df=typeof _0x257e40[_0x59f1('0x22')]===_0x59f1('0x23')&&typeof _0x257e40['limit']===_0x59f1('0x23');var _0x1b6cde=_0x1eded6[_0x59f1('0x24')];var _0x46a13b=_0x1f03df?0x0:_0x257e40[_0x59f1('0x22')];var _0x21be2e=_0x1f03df?_0x1eded6['count']:_0x257e40[_0x59f1('0x22')]+_0x257e40[_0x59f1('0x25')];var _0x242cc9;if(_0x21be2e>=_0x1b6cde){_0x21be2e=_0x1b6cde;_0x242cc9=0xc8;}else{_0x242cc9=0xce;}_0x14e8f9[_0x59f1('0x20')](_0x242cc9);return _0x14e8f9[_0x59f1('0x26')]('Content-Range',_0x46a13b+'-'+_0x21be2e+'/'+_0x1b6cde)[_0x59f1('0x21')](_0x1eded6);}return null;};}function patchUpdates(_0x4b7ef4){return function(_0x7927e1){try{jsonpatch[_0x59f1('0x27')](_0x7927e1,_0x4b7ef4,!![]);}catch(_0x217f62){return BPromise[_0x59f1('0x28')](_0x217f62);}return _0x7927e1[_0x59f1('0x29')]();};}function saveUpdates(_0x3c74dc,_0x2ebce9){return function(_0x22384c){if(_0x22384c){return _0x22384c[_0x59f1('0x2a')](_0x3c74dc)[_0x59f1('0x2b')](function(_0x3ce977){return _0x3ce977;});}return null;};}function removeEntity(_0x1478e5,_0x104e64){return function(_0x1494cb){if(_0x1494cb){return _0x1494cb[_0x59f1('0x2c')]()[_0x59f1('0x2b')](function(){var _0x27ab92=_0x1494cb[_0x59f1('0x2d')]({'plain':!![]});var _0x4d7d5e=_0x59f1('0x2e');return db[_0x59f1('0x2f')][_0x59f1('0x2c')]({'where':{'type':_0x4d7d5e,'resourceId':_0x27ab92['id']}})[_0x59f1('0x2b')](function(){return _0x1494cb;});})[_0x59f1('0x2b')](function(){_0x1478e5[_0x59f1('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x32da94,_0x1e4500){return function(_0x154c55){if(!_0x154c55){_0x32da94['sendStatus'](0x194);}return _0x154c55;};}function handleError(_0x2bf544,_0x44cd1b){_0x44cd1b=_0x44cd1b||0x1f4;return function(_0x538530){logger[_0x59f1('0x30')](_0x538530[_0x59f1('0x31')]);if(_0x538530[_0x59f1('0x32')]){delete _0x538530[_0x59f1('0x32')];}_0x2bf544[_0x59f1('0x20')](_0x44cd1b)['send'](_0x538530);};}exports[_0x59f1('0x33')]=function(_0x56d4cb,_0x34b58a){var _0x156c55={},_0x334ed={},_0x43cf4e={'count':0x0,'rows':[]};var _0x4dd4e6=_[_0x59f1('0x34')](db[_0x59f1('0x35')][_0x59f1('0x36')],function(_0x3c0582){return{'name':_0x3c0582[_0x59f1('0x37')],'type':_0x3c0582[_0x59f1('0x38')]['key']};});_0x334ed['model']=_[_0x59f1('0x34')](_0x4dd4e6,_0x59f1('0x32'));_0x334ed['query']=_['keys'](_0x56d4cb[_0x59f1('0x39')]);_0x334ed[_0x59f1('0x3a')]=_[_0x59f1('0x3b')](_0x334ed[_0x59f1('0x3c')],_0x334ed[_0x59f1('0x39')]);_0x156c55[_0x59f1('0x3d')]=_[_0x59f1('0x3b')](_0x334ed[_0x59f1('0x3c')],qs[_0x59f1('0x3e')](_0x56d4cb['query'][_0x59f1('0x3e')]));_0x156c55[_0x59f1('0x3d')]=_0x156c55[_0x59f1('0x3d')][_0x59f1('0x3f')]?_0x156c55[_0x59f1('0x3d')]:_0x334ed[_0x59f1('0x3c')];if(!_0x56d4cb[_0x59f1('0x39')][_0x59f1('0x40')]('nolimit')){_0x156c55['limit']=qs[_0x59f1('0x25')](_0x56d4cb[_0x59f1('0x39')][_0x59f1('0x25')]);_0x156c55[_0x59f1('0x22')]=qs[_0x59f1('0x22')](_0x56d4cb[_0x59f1('0x39')][_0x59f1('0x22')]);}_0x156c55[_0x59f1('0x41')]=qs[_0x59f1('0x42')](_0x56d4cb[_0x59f1('0x39')][_0x59f1('0x42')]);_0x156c55[_0x59f1('0x43')]=qs[_0x59f1('0x3a')](_['pick'](_0x56d4cb[_0x59f1('0x39')],_0x334ed[_0x59f1('0x3a')]),_0x4dd4e6);if(_0x56d4cb[_0x59f1('0x39')][_0x59f1('0x44')]){_0x156c55[_0x59f1('0x43')]=_[_0x59f1('0x45')](_0x156c55[_0x59f1('0x43')],{'$or':_[_0x59f1('0x34')](_0x4dd4e6,function(_0x3e9435){if(_0x3e9435['type']!==_0x59f1('0x46')){var _0x37de29={};_0x37de29[_0x3e9435[_0x59f1('0x32')]]={'$like':'%'+_0x56d4cb[_0x59f1('0x39')][_0x59f1('0x44')]+'%'};return _0x37de29;}})});}_0x156c55=_[_0x59f1('0x45')]({},_0x156c55,_0x56d4cb[_0x59f1('0x47')]);var _0x365cb3={'where':_0x156c55[_0x59f1('0x43')]};return db[_0x59f1('0x35')][_0x59f1('0x24')](_0x365cb3)[_0x59f1('0x2b')](function(_0x5b04a4){_0x43cf4e[_0x59f1('0x24')]=_0x5b04a4;if(_0x56d4cb[_0x59f1('0x39')][_0x59f1('0x48')]){_0x156c55['include']=[{'all':!![]}];}return db[_0x59f1('0x35')][_0x59f1('0x49')](_0x156c55);})[_0x59f1('0x2b')](function(_0x2d4369){_0x43cf4e[_0x59f1('0x4a')]=_0x2d4369;return _0x43cf4e;})[_0x59f1('0x2b')](respondWithFilteredResult(_0x34b58a,_0x156c55))['catch'](handleError(_0x34b58a,null));};exports[_0x59f1('0x4b')]=function(_0x58c182,_0x35662a){var _0x447b2a={'raw':!![],'where':{'id':_0x58c182[_0x59f1('0x4c')]['id']}},_0x44f836={};_0x44f836[_0x59f1('0x3c')]=_[_0x59f1('0x4d')](db[_0x59f1('0x35')][_0x59f1('0x36')]);_0x44f836[_0x59f1('0x39')]=_[_0x59f1('0x4d')](_0x58c182[_0x59f1('0x39')]);_0x44f836['filters']=_[_0x59f1('0x3b')](_0x44f836['model'],_0x44f836['query']);_0x447b2a[_0x59f1('0x3d')]=_[_0x59f1('0x3b')](_0x44f836[_0x59f1('0x3c')],qs[_0x59f1('0x3e')](_0x58c182[_0x59f1('0x39')]['fields']));_0x447b2a[_0x59f1('0x3d')]=_0x447b2a[_0x59f1('0x3d')][_0x59f1('0x3f')]?_0x447b2a[_0x59f1('0x3d')]:_0x44f836[_0x59f1('0x3c')];if(_0x58c182[_0x59f1('0x39')][_0x59f1('0x48')]){_0x447b2a[_0x59f1('0x4e')]=[{'all':!![]}];}_0x447b2a=_[_0x59f1('0x45')]({},_0x447b2a,_0x58c182[_0x59f1('0x47')]);return db['FaxQueue'][_0x59f1('0x4f')](_0x447b2a)[_0x59f1('0x2b')](handleEntityNotFound(_0x35662a,null))[_0x59f1('0x2b')](respondWithResult(_0x35662a,null))[_0x59f1('0x50')](handleError(_0x35662a,null));};exports[_0x59f1('0x51')]=function(_0x3f9fd2,_0x58c801){return db[_0x59f1('0x35')][_0x59f1('0x51')](_0x3f9fd2[_0x59f1('0x52')],{})[_0x59f1('0x2b')](function(_0xcc6a14){var _0x362b7d=_0x3f9fd2[_0x59f1('0x53')]['get']({'plain':!![]});if(!_0x362b7d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x362b7d[_0x59f1('0x54')]===_0x59f1('0x53')){var _0x103f4a=_0xcc6a14['get']({'plain':!![]});var _0x39fed1=_0x59f1('0x2e');return db[_0x59f1('0x55')]['find']({'where':{'name':_0x39fed1,'userProfileId':_0x362b7d[_0x59f1('0x56')]},'raw':!![]})['then'](function(_0x4e23fb){if(_0x4e23fb&&_0x4e23fb[_0x59f1('0x57')]===0x0){return db[_0x59f1('0x2f')]['create']({'name':_0x103f4a[_0x59f1('0x32')],'resourceId':_0x103f4a['id'],'type':_0x4e23fb['name'],'sectionId':_0x4e23fb['id']},{})[_0x59f1('0x2b')](function(){return _0xcc6a14;});}else{return _0xcc6a14;}})[_0x59f1('0x50')](function(_0x211c27){logger[_0x59f1('0x30')](_0x59f1('0x58'),_0x211c27);throw _0x211c27;});}return _0xcc6a14;})[_0x59f1('0x2b')](respondWithResult(_0x58c801,0xc9))[_0x59f1('0x50')](handleError(_0x58c801,null));};exports[_0x59f1('0x2a')]=function(_0x544cd0,_0x3ede88){if(_0x544cd0[_0x59f1('0x52')]['id']){delete _0x544cd0[_0x59f1('0x52')]['id'];}return db['FaxQueue'][_0x59f1('0x4f')]({'where':{'id':_0x544cd0['params']['id']}})[_0x59f1('0x2b')](handleEntityNotFound(_0x3ede88,null))[_0x59f1('0x2b')](saveUpdates(_0x544cd0['body'],null))[_0x59f1('0x2b')](respondWithResult(_0x3ede88,null))[_0x59f1('0x50')](handleError(_0x3ede88,null));};exports[_0x59f1('0x2c')]=function(_0x5e8c1c,_0x408e93){return db['FaxQueue']['find']({'where':{'id':_0x5e8c1c[_0x59f1('0x4c')]['id']}})[_0x59f1('0x2b')](handleEntityNotFound(_0x408e93,null))['then'](removeEntity(_0x408e93,null))['catch'](handleError(_0x408e93,null));};exports['describe']=function(_0x200f47,_0x15b523){return db[_0x59f1('0x35')][_0x59f1('0x59')]()[_0x59f1('0x2b')](respondWithResult(_0x15b523,null))[_0x59f1('0x50')](handleError(_0x15b523,null));};exports['getMembers']=function(_0x1500a0,_0x55add8,_0x580952){var _0x433250={'raw':!![],'where':{}},_0x11c13c={},_0x5756ce;return db[_0x59f1('0x35')][_0x59f1('0x5a')]({'where':{'id':_0x1500a0[_0x59f1('0x4c')]['id']}})[_0x59f1('0x2b')](handleEntityNotFound(_0x55add8,null))[_0x59f1('0x2b')](function(_0x51f96b){if(_0x51f96b){_0x5756ce=_0x51f96b['get']({'plain':!![]});_0x11c13c['model']=_[_0x59f1('0x4d')](db[_0x59f1('0x5b')][_0x59f1('0x36')]);_0x11c13c[_0x59f1('0x39')]=_['keys'](_0x1500a0[_0x59f1('0x39')]);_0x11c13c['filters']=_['intersection'](_0x11c13c[_0x59f1('0x3c')],_0x11c13c[_0x59f1('0x39')]);_0x433250[_0x59f1('0x3d')]=_[_0x59f1('0x3b')](_0x11c13c[_0x59f1('0x3c')],qs['fields'](_0x1500a0[_0x59f1('0x39')]['fields']));_0x433250['attributes']=_0x433250[_0x59f1('0x3d')][_0x59f1('0x3f')]?_0x433250[_0x59f1('0x3d')]:_0x11c13c[_0x59f1('0x3c')];if(!_0x1500a0['query'][_0x59f1('0x40')](_0x59f1('0x5c'))){_0x433250[_0x59f1('0x25')]=qs[_0x59f1('0x25')](_0x1500a0['query']['limit']);_0x433250['offset']=qs[_0x59f1('0x22')](_0x1500a0[_0x59f1('0x39')][_0x59f1('0x22')]);}_0x433250['order']=qs[_0x59f1('0x42')](_0x1500a0['query'][_0x59f1('0x42')]);_0x433250[_0x59f1('0x43')]=qs['filters'](_[_0x59f1('0x5d')](_0x1500a0['query'],_0x11c13c['filters']));_0x433250[_0x59f1('0x43')]['FaxQueueId']=_0x51f96b['id'];if(_0x1500a0[_0x59f1('0x39')][_0x59f1('0x44')]){_0x433250[_0x59f1('0x43')]=_['merge'](_0x433250['where'],{'$or':_[_0x59f1('0x34')](_0x433250['attributes'],function(_0x3e94a1){var _0x3969ba={};_0x3969ba[_0x3e94a1]={'$like':'%'+_0x1500a0[_0x59f1('0x39')][_0x59f1('0x44')]+'%'};return _0x3969ba;})});}_0x433250=_[_0x59f1('0x45')]({},_0x433250,_0x1500a0['options']);return db['UserFaxQueue'][_0x59f1('0x49')](_0x433250);}})[_0x59f1('0x2b')](function(_0x4cc052){if(_0x4cc052){return db[_0x59f1('0x5e')]['findAndCountAll']({'where':{'id':_[_0x59f1('0x34')](_0x4cc052,_0x59f1('0x5f')),'role':'agent'},'attributes':['id',_0x59f1('0x32'),_0x59f1('0x60'),'updatedAt','createdAt']});}})[_0x59f1('0x2b')](function(_0x18e44b){if(_0x18e44b){return{'count':_0x18e44b['count'],'rows':_[_0x59f1('0x34')](_0x18e44b[_0x59f1('0x4a')],function(_0x5e0f1e){return{'membername':_0x5e0f1e[_0x59f1('0x32')],'UserId':_0x5e0f1e['id'],'queue_name':_0x5756ce[_0x59f1('0x32')],'FaxQueueId':_0x5756ce['id'],'interface':util[_0x59f1('0x61')](_0x59f1('0x62'),_0x59f1('0x63'),_0x5e0f1e['name']),'penalty':0x0,'paused':_0x5e0f1e[_0x59f1('0x60')],'createdAt':_0x5e0f1e[_0x59f1('0x64')],'updatedAt':_0x5e0f1e[_0x59f1('0x65')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x59f1('0x2b')](respondWithFilteredResult(_0x55add8,_0x433250))[_0x59f1('0x50')](handleError(_0x55add8,null));};exports['getTeams']=function(_0x80d7e7,_0x2b060e,_0x4f403b){var _0x37e4ff={};var _0x179144={};var _0x454d16;var _0x378f5e;return db[_0x59f1('0x35')][_0x59f1('0x5a')]({'where':{'id':_0x80d7e7[_0x59f1('0x4c')]['id']}})[_0x59f1('0x2b')](handleEntityNotFound(_0x2b060e,null))[_0x59f1('0x2b')](function(_0x4bd4d4){if(_0x4bd4d4){_0x454d16=_0x4bd4d4;_0x179144[_0x59f1('0x3c')]=_[_0x59f1('0x4d')](db['Team']['rawAttributes']);_0x179144[_0x59f1('0x39')]=_[_0x59f1('0x4d')](_0x80d7e7[_0x59f1('0x39')]);_0x179144['filters']=_[_0x59f1('0x3b')](_0x179144[_0x59f1('0x3c')],_0x179144[_0x59f1('0x39')]);_0x37e4ff['attributes']=_[_0x59f1('0x3b')](_0x179144['model'],qs['fields'](_0x80d7e7[_0x59f1('0x39')][_0x59f1('0x3e')]));_0x37e4ff[_0x59f1('0x3d')]=_0x37e4ff[_0x59f1('0x3d')][_0x59f1('0x3f')]?_0x37e4ff[_0x59f1('0x3d')]:_0x179144[_0x59f1('0x3c')];_0x37e4ff[_0x59f1('0x41')]=qs['sort'](_0x80d7e7[_0x59f1('0x39')]['sort']);_0x37e4ff['where']=qs['filters'](_[_0x59f1('0x5d')](_0x80d7e7[_0x59f1('0x39')],_0x179144[_0x59f1('0x3a')]));if(_0x80d7e7[_0x59f1('0x39')][_0x59f1('0x44')]){_0x37e4ff['where']=_['merge'](_0x37e4ff[_0x59f1('0x43')],{'$or':_[_0x59f1('0x34')](_0x37e4ff['attributes'],function(_0x17aa20){var _0x5a363d={};_0x5a363d[_0x17aa20]={'$like':'%'+_0x80d7e7[_0x59f1('0x39')]['filter']+'%'};return _0x5a363d;})});}_0x37e4ff=_[_0x59f1('0x45')]({},_0x37e4ff,_0x80d7e7[_0x59f1('0x47')]);return _0x454d16[_0x59f1('0x66')](_0x37e4ff);}})[_0x59f1('0x2b')](function(_0x2c1a05){if(_0x2c1a05){_0x378f5e=_0x2c1a05[_0x59f1('0x3f')];if(!_0x80d7e7[_0x59f1('0x39')][_0x59f1('0x40')](_0x59f1('0x5c'))){_0x37e4ff[_0x59f1('0x25')]=qs[_0x59f1('0x25')](_0x80d7e7[_0x59f1('0x39')][_0x59f1('0x25')]);_0x37e4ff[_0x59f1('0x22')]=qs[_0x59f1('0x22')](_0x80d7e7[_0x59f1('0x39')]['offset']);}return _0x454d16[_0x59f1('0x66')](_0x37e4ff);}})[_0x59f1('0x2b')](function(_0x6a2d22){if(_0x6a2d22){return _0x6a2d22?{'count':_0x378f5e,'rows':_0x6a2d22}:null;}})[_0x59f1('0x2b')](respondWithResult(_0x2b060e,null))[_0x59f1('0x50')](handleError(_0x2b060e,null));};exports[_0x59f1('0x67')]=function(_0xcc057d,_0x465a65,_0x3ddcc5){var _0x26b534=_0xcc057d['body'][_0x59f1('0x68')];return db[_0x59f1('0x69')]['findAll']({'where':{'id':_0x26b534},'attributes':['id'],'include':[{'model':db[_0x59f1('0x5e')],'as':_0x59f1('0x6a'),'attributes':['id',_0x59f1('0x32'),'online',_0x59f1('0x6b'),_0x59f1('0x6c')],'raw':!![]}]})[_0x59f1('0x2b')](function(_0x18288b){if(_0x18288b){var _0x59b6dc=_['flatMap'](_0x18288b,function(_0x32905c){var _0x123fec=_0x32905c[_0x59f1('0x2d')]({'plain':!![]});return _0x123fec['Agents'];});return db[_0x59f1('0x35')][_0x59f1('0x4f')]({'where':{'id':_0xcc057d[_0x59f1('0x4c')]['id']}})[_0x59f1('0x2b')](function(_0x165df1){return db[_0x59f1('0x6d')][_0x59f1('0x6e')](function(_0x337ddd){return _0x165df1[_0x59f1('0x67')](_0x26b534,{'transaction':_0x337ddd})[_0x59f1('0x2b')](function(){return BPromise[_0x59f1('0x6f')](_0x59b6dc,function(_0x4d0599){return db[_0x59f1('0x5b')][_0x59f1('0x70')]({'where':{'UserId':_0x4d0599['id'],'FaxQueueId':_0xcc057d[_0x59f1('0x4c')]['id']},'transaction':_0x337ddd});});})[_0x59f1('0x2b')](function(){_0x59b6dc[_0x59f1('0x71')](function(_0x5d0f80){socket[_0x59f1('0x72')](_0x59f1('0x73'),{'UserId':_0x5d0f80['id'],'FaxQueueId':_0x165df1['id']});});});});});}})[_0x59f1('0x2b')](respondWithStatusCode(_0x465a65,null))[_0x59f1('0x50')](handleError(_0x465a65,null));};exports['removeTeams']=function(_0x515f3e,_0x16090e,_0x55f886){return db[_0x59f1('0x69')][_0x59f1('0x49')]({'where':{'id':_0x515f3e[_0x59f1('0x39')][_0x59f1('0x68')]},'attributes':['id'],'include':[{'model':db[_0x59f1('0x5e')],'as':_0x59f1('0x6a'),'attributes':['id'],'raw':!![]}]})[_0x59f1('0x2b')](handleEntityNotFound(_0x16090e,null))['then'](function(_0x4e4988){var _0x482cf6=_['map'](_0x4e4988,'id');var _0x503864=[];var _0x458a9a=[];var _0x2cd15b=squel[_0x59f1('0x74')]();_0x2cd15b[_0x59f1('0x75')](_0x59f1('0x76'))['from'](_0x59f1('0x77'),'tq')[_0x59f1('0x78')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x59f1('0x43')]('FaxQueueId\x20=\x20?',_0x515f3e[_0x59f1('0x4c')]['id']);for(var _0x14fee0=0x0;_0x14fee0<_0x4e4988[_0x59f1('0x3f')];_0x14fee0+=0x1){let _0x30b716=_0x4e4988[_0x14fee0];for(var _0x19d53b=0x0;_0x19d53b<_0x30b716[_0x59f1('0x6a')][_0x59f1('0x3f')];_0x19d53b+=0x1){let _0xd48fd8=_0x30b716['Agents'][_0x19d53b];var _0x573861=_0x2cd15b['clone']();_0x573861['where'](_0x59f1('0x79'),_0xd48fd8['id']);_0x458a9a[_0x59f1('0x7a')](db['sequelize'][_0x59f1('0x39')](_0x573861[_0x59f1('0x7b')](),{'type':db[_0x59f1('0x6d')]['QueryTypes'][_0x59f1('0x7c')]})[_0x59f1('0x2b')](function(_0x451a8e){if(_0x451a8e[_0x59f1('0x3f')]===0x1){return _0xd48fd8['id'];}else{var _0x1c7777=_[_0x59f1('0x7d')](_[_0x59f1('0x34')](_0x451a8e,'TeamId'),function(_0x39b6b2){return _['includes'](_0x482cf6,_0x39b6b2);});if(_0x1c7777){return _0xd48fd8['id'];}}}));}}return BPromise[_0x59f1('0x7e')](_0x458a9a)[_0x59f1('0x2b')](function(_0x47d432){_0x503864=_(_0x503864)[_0x59f1('0x7f')](_0x47d432)['compact']()[_0x59f1('0x80')]();return db['FaxQueue'][_0x59f1('0x4f')]({'where':{'id':_0x515f3e[_0x59f1('0x4c')]['id']}})[_0x59f1('0x2b')](function(_0x552e15){return db[_0x59f1('0x6d')][_0x59f1('0x6e')](function(_0x5b4500){return _0x552e15[_0x59f1('0x81')](_0x515f3e[_0x59f1('0x39')][_0x59f1('0x68')],{'transaction':_0x5b4500})['then'](function(){if(!_['isEmpty'](_0x503864)){return _0x552e15[_0x59f1('0x82')](_0x503864,{'transaction':_0x5b4500});}})['then'](function(){_0x503864['forEach'](function(_0x62a629){socket[_0x59f1('0x72')](_0x59f1('0x83'),{'UserId':_0x62a629,'FaxQueueId':_0x552e15['id']});});});});});});})[_0x59f1('0x2b')](respondWithStatusCode(_0x16090e,null))[_0x59f1('0x50')](handleError(_0x16090e,null));};exports[_0x59f1('0x84')]=function(_0xee3860,_0x2a0492,_0x4c50e3){return db[_0x59f1('0x35')][_0x59f1('0x4f')]({'where':{'id':_0xee3860[_0x59f1('0x4c')]['id']}})[_0x59f1('0x2b')](handleEntityNotFound(_0x2a0492,null))[_0x59f1('0x2b')](function(_0x313210){if(_0x313210){return _0x313210[_0x59f1('0x84')](_0xee3860['body'][_0x59f1('0x68')],_[_0x59f1('0x85')](_0xee3860[_0x59f1('0x52')],['ids','id'])||{})[_0x59f1('0x86')](function(_0x322ee7){for(var _0x2c0441=0x0;_0x2c0441<_0xee3860[_0x59f1('0x52')]['ids'][_0x59f1('0x3f')];_0x2c0441+=0x1){socket['emit'](_0x59f1('0x73'),{'UserId':Number(_0xee3860[_0x59f1('0x52')]['ids'][_0x2c0441]),'FaxQueueId':Number(_0xee3860[_0x59f1('0x4c')]['id'])});}return _0x322ee7;});}})[_0x59f1('0x2b')](respondWithResult(_0x2a0492,null))['catch'](handleError(_0x2a0492,null));};exports[_0x59f1('0x82')]=function(_0x3bc61c,_0x4962db,_0x5bca88){return db[_0x59f1('0x35')]['find']({'where':{'id':_0x3bc61c[_0x59f1('0x4c')]['id']}})[_0x59f1('0x2b')](handleEntityNotFound(_0x4962db,null))[_0x59f1('0x2b')](function(_0x2c2065){if(_0x2c2065){return _0x2c2065[_0x59f1('0x82')](_0x3bc61c[_0x59f1('0x39')][_0x59f1('0x68')])['then'](function(){if(_['isArray'](_0x3bc61c[_0x59f1('0x39')][_0x59f1('0x68')])){for(var _0x14af74=0x0;_0x14af74<_0x3bc61c[_0x59f1('0x39')][_0x59f1('0x68')][_0x59f1('0x3f')];_0x14af74+=0x1){socket[_0x59f1('0x72')]('userFaxQueue:remove',{'UserId':Number(_0x3bc61c['query'][_0x59f1('0x68')][_0x14af74]),'FaxQueueId':Number(_0x3bc61c[_0x59f1('0x4c')]['id'])});}}else{socket[_0x59f1('0x72')](_0x59f1('0x83'),{'UserId':Number(_0x3bc61c[_0x59f1('0x39')][_0x59f1('0x68')]),'FaxQueueId':Number(_0x3bc61c[_0x59f1('0x4c')]['id'])});}});}})[_0x59f1('0x2b')](respondWithStatusCode(_0x4962db,null))[_0x59f1('0x50')](handleError(_0x4962db,null));};exports[_0x59f1('0x87')]=function(_0x43a4ac,_0x2ed924,_0x50b82c){var _0x48aaa8={};var _0x57787e={};var _0x2a405a;var _0xcedbe9;return db[_0x59f1('0x35')][_0x59f1('0x5a')]({'where':{'id':_0x43a4ac[_0x59f1('0x4c')]['id']}})[_0x59f1('0x2b')](handleEntityNotFound(_0x2ed924,null))[_0x59f1('0x2b')](function(_0x4a0e62){if(_0x4a0e62){_0x2a405a=_0x4a0e62;_0x57787e[_0x59f1('0x3c')]=_['keys'](db[_0x59f1('0x5e')]['rawAttributes']);_0x57787e[_0x59f1('0x39')]=_[_0x59f1('0x4d')](_0x43a4ac[_0x59f1('0x39')]);_0x57787e[_0x59f1('0x3a')]=_[_0x59f1('0x3b')](_0x57787e[_0x59f1('0x3c')],_0x57787e[_0x59f1('0x39')]);_0x48aaa8[_0x59f1('0x3d')]=_[_0x59f1('0x3b')](_0x57787e[_0x59f1('0x3c')],qs[_0x59f1('0x3e')](_0x43a4ac[_0x59f1('0x39')][_0x59f1('0x3e')]));_0x48aaa8[_0x59f1('0x3d')]=_0x48aaa8[_0x59f1('0x3d')][_0x59f1('0x3f')]?_0x48aaa8[_0x59f1('0x3d')]:_0x57787e[_0x59f1('0x3c')];_0x48aaa8[_0x59f1('0x41')]=qs[_0x59f1('0x42')](_0x43a4ac[_0x59f1('0x39')]['sort']);_0x48aaa8[_0x59f1('0x43')]=qs[_0x59f1('0x3a')](_[_0x59f1('0x5d')](_0x43a4ac[_0x59f1('0x39')],_0x57787e[_0x59f1('0x3a')]));if(_0x43a4ac[_0x59f1('0x39')][_0x59f1('0x44')]){_0x48aaa8['where']=_['merge'](_0x48aaa8[_0x59f1('0x43')],{'$or':_[_0x59f1('0x34')](_0x48aaa8[_0x59f1('0x3d')],function(_0x19513e){var _0x97299c={};_0x97299c[_0x19513e]={'$like':'%'+_0x43a4ac[_0x59f1('0x39')]['filter']+'%'};return _0x97299c;})});}_0x48aaa8=_['merge']({},_0x48aaa8,_0x43a4ac[_0x59f1('0x47')]);return _0x2a405a[_0x59f1('0x87')](_0x48aaa8);}})['then'](function(_0x2c626c){if(_0x2c626c){_0xcedbe9=_0x2c626c[_0x59f1('0x3f')];if(!_0x43a4ac[_0x59f1('0x39')][_0x59f1('0x40')](_0x59f1('0x5c'))){_0x48aaa8[_0x59f1('0x25')]=qs[_0x59f1('0x25')](_0x43a4ac[_0x59f1('0x39')][_0x59f1('0x25')]);_0x48aaa8['offset']=qs[_0x59f1('0x22')](_0x43a4ac[_0x59f1('0x39')][_0x59f1('0x22')]);}return _0x2a405a[_0x59f1('0x87')](_0x48aaa8);}})['then'](function(_0x4334b2){if(_0x4334b2){return _0x4334b2?{'count':_0xcedbe9,'rows':_0x4334b2}:null;}})[_0x59f1('0x2b')](respondWithResult(_0x2ed924,null))[_0x59f1('0x50')](handleError(_0x2ed924,null));}; \ No newline at end of file +var _0x9da2=['crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','sendStatus','status','end','json','undefined','count','offset','limit','apply','reject','save','update','destroy','then','get','FaxQueues','UserProfileResource','stack','name','index','FaxQueue','type','key','map','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','rawAttributes','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','UserFaxQueue','nolimit','order','FaxQueueId','findAll','User','findAndCountAll','UserId','agent','faxPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','body','online','voicePause','interface','flatMap','Agents','addTeams','each','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','field','tq.TeamId','from','team_has_fax_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','TeamId','includes','all','value','transaction','ids','removeAgents','userFaxQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','path','sox','to-csv','ejs','lodash','squel'];(function(_0x4b6804,_0x301b24){var _0x11b4f1=function(_0x31e66c){while(--_0x31e66c){_0x4b6804['push'](_0x4b6804['shift']());}};_0x11b4f1(++_0x301b24);}(_0x9da2,0x82));var _0x29da=function(_0x1996fd,_0x505a8d){_0x1996fd=_0x1996fd-0x0;var _0x5ead98=_0x9da2[_0x1996fd];return _0x5ead98;};'use strict';var emlformat=require(_0x29da('0x0'));var rimraf=require(_0x29da('0x1'));var zipdir=require(_0x29da('0x2'));var jsonpatch=require(_0x29da('0x3'));var rp=require('request-promise');var moment=require(_0x29da('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x29da('0x5'));var sox=require(_0x29da('0x6'));var csv=require(_0x29da('0x7'));var ejs=require(_0x29da('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x29da('0x9'));var squel=require(_0x29da('0xa'));var crypto=require(_0x29da('0xb'));var jsforce=require(_0x29da('0xc'));var deskjs=require(_0x29da('0xd'));var toCsv=require(_0x29da('0x7'));var querystring=require(_0x29da('0xe'));var Papa=require('papaparse');var Redis=require(_0x29da('0xf'));var authService=require(_0x29da('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x29da('0x11'));var logger=require(_0x29da('0x12'))(_0x29da('0x13'));var utils=require('../../config/utils');var config=require(_0x29da('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x29da('0x15')]=_[_0x29da('0x16')](config[_0x29da('0x15')],{'host':_0x29da('0x17'),'port':0x18eb});var socket=require(_0x29da('0x18'))(new Redis(config[_0x29da('0x15')]));require(_0x29da('0x19'))['register'](socket);function respondWithStatusCode(_0x238141,_0x42a9fb){_0x42a9fb=_0x42a9fb||0xcc;return function(_0x3bc3b0){if(_0x3bc3b0){return _0x238141[_0x29da('0x1a')](_0x42a9fb);}return _0x238141[_0x29da('0x1b')](_0x42a9fb)[_0x29da('0x1c')]();};}function respondWithResult(_0x5a897b,_0x23e088){_0x23e088=_0x23e088||0xc8;return function(_0x5cc31d){if(_0x5cc31d){return _0x5a897b[_0x29da('0x1b')](_0x23e088)[_0x29da('0x1d')](_0x5cc31d);}};}function respondWithFilteredResult(_0x5637f9,_0x2e6d22){return function(_0x37db5b){if(_0x37db5b){var _0x59499e=typeof _0x2e6d22['offset']===_0x29da('0x1e')&&typeof _0x2e6d22['limit']===_0x29da('0x1e');var _0x189eb6=_0x37db5b['count'];var _0x1e9f23=_0x59499e?0x0:_0x2e6d22['offset'];var _0x39eb65=_0x59499e?_0x37db5b[_0x29da('0x1f')]:_0x2e6d22[_0x29da('0x20')]+_0x2e6d22[_0x29da('0x21')];var _0x4b86c0;if(_0x39eb65>=_0x189eb6){_0x39eb65=_0x189eb6;_0x4b86c0=0xc8;}else{_0x4b86c0=0xce;}_0x5637f9['status'](_0x4b86c0);return _0x5637f9['set']('Content-Range',_0x1e9f23+'-'+_0x39eb65+'/'+_0x189eb6)[_0x29da('0x1d')](_0x37db5b);}return null;};}function patchUpdates(_0x23577c){return function(_0x2cd6d6){try{jsonpatch[_0x29da('0x22')](_0x2cd6d6,_0x23577c,!![]);}catch(_0x2a473f){return BPromise[_0x29da('0x23')](_0x2a473f);}return _0x2cd6d6[_0x29da('0x24')]();};}function saveUpdates(_0x4fe527,_0x477991){return function(_0x5bd2ad){if(_0x5bd2ad){return _0x5bd2ad[_0x29da('0x25')](_0x4fe527)['then'](function(_0x340a7f){return _0x340a7f;});}return null;};}function removeEntity(_0x14d2f8,_0x5b01bd){return function(_0x311d78){if(_0x311d78){return _0x311d78[_0x29da('0x26')]()[_0x29da('0x27')](function(){var _0x264016=_0x311d78[_0x29da('0x28')]({'plain':!![]});var _0x1457f2=_0x29da('0x29');return db[_0x29da('0x2a')][_0x29da('0x26')]({'where':{'type':_0x1457f2,'resourceId':_0x264016['id']}})[_0x29da('0x27')](function(){return _0x311d78;});})[_0x29da('0x27')](function(){_0x14d2f8[_0x29da('0x1b')](0xcc)[_0x29da('0x1c')]();});}};}function handleEntityNotFound(_0x2493d0,_0x3e46b8){return function(_0x40fbbb){if(!_0x40fbbb){_0x2493d0[_0x29da('0x1a')](0x194);}return _0x40fbbb;};}function handleError(_0x20da29,_0x158dc8){_0x158dc8=_0x158dc8||0x1f4;return function(_0x2f5294){logger['error'](_0x2f5294[_0x29da('0x2b')]);if(_0x2f5294[_0x29da('0x2c')]){delete _0x2f5294[_0x29da('0x2c')];}_0x20da29[_0x29da('0x1b')](_0x158dc8)['send'](_0x2f5294);};}exports[_0x29da('0x2d')]=function(_0x14478c,_0x56638e){var _0x2012d7={},_0x1fb950={},_0x331379={'count':0x0,'rows':[]};var _0x329d3a=_['map'](db[_0x29da('0x2e')]['rawAttributes'],function(_0x3fdb5a){return{'name':_0x3fdb5a['fieldName'],'type':_0x3fdb5a[_0x29da('0x2f')][_0x29da('0x30')]};});_0x1fb950['model']=_[_0x29da('0x31')](_0x329d3a,'name');_0x1fb950[_0x29da('0x32')]=_[_0x29da('0x33')](_0x14478c['query']);_0x1fb950[_0x29da('0x34')]=_[_0x29da('0x35')](_0x1fb950[_0x29da('0x36')],_0x1fb950[_0x29da('0x32')]);_0x2012d7[_0x29da('0x37')]=_['intersection'](_0x1fb950[_0x29da('0x36')],qs['fields'](_0x14478c[_0x29da('0x32')][_0x29da('0x38')]));_0x2012d7['attributes']=_0x2012d7[_0x29da('0x37')]['length']?_0x2012d7['attributes']:_0x1fb950[_0x29da('0x36')];if(!_0x14478c[_0x29da('0x32')][_0x29da('0x39')]('nolimit')){_0x2012d7['limit']=qs[_0x29da('0x21')](_0x14478c[_0x29da('0x32')][_0x29da('0x21')]);_0x2012d7['offset']=qs[_0x29da('0x20')](_0x14478c['query'][_0x29da('0x20')]);}_0x2012d7['order']=qs[_0x29da('0x3a')](_0x14478c[_0x29da('0x32')]['sort']);_0x2012d7[_0x29da('0x3b')]=qs['filters'](_[_0x29da('0x3c')](_0x14478c['query'],_0x1fb950[_0x29da('0x34')]),_0x329d3a);if(_0x14478c[_0x29da('0x32')][_0x29da('0x3d')]){_0x2012d7[_0x29da('0x3b')]=_[_0x29da('0x3e')](_0x2012d7[_0x29da('0x3b')],{'$or':_[_0x29da('0x31')](_0x329d3a,function(_0x490f0e){if(_0x490f0e[_0x29da('0x2f')]!==_0x29da('0x3f')){var _0x5ae46d={};_0x5ae46d[_0x490f0e[_0x29da('0x2c')]]={'$like':'%'+_0x14478c['query'][_0x29da('0x3d')]+'%'};return _0x5ae46d;}})});}_0x2012d7=_[_0x29da('0x3e')]({},_0x2012d7,_0x14478c[_0x29da('0x40')]);var _0x57855f={'where':_0x2012d7[_0x29da('0x3b')]};return db[_0x29da('0x2e')][_0x29da('0x1f')](_0x57855f)[_0x29da('0x27')](function(_0x365314){_0x331379[_0x29da('0x1f')]=_0x365314;if(_0x14478c[_0x29da('0x32')][_0x29da('0x41')]){_0x2012d7[_0x29da('0x42')]=[{'all':!![]}];}return db['FaxQueue']['findAll'](_0x2012d7);})[_0x29da('0x27')](function(_0x4b6feb){_0x331379[_0x29da('0x43')]=_0x4b6feb;return _0x331379;})[_0x29da('0x27')](respondWithFilteredResult(_0x56638e,_0x2012d7))[_0x29da('0x44')](handleError(_0x56638e,null));};exports[_0x29da('0x45')]=function(_0x33dbb0,_0x3db24a){var _0x5892d7={'raw':!![],'where':{'id':_0x33dbb0['params']['id']}},_0x474e74={};_0x474e74['model']=_[_0x29da('0x33')](db[_0x29da('0x2e')][_0x29da('0x46')]);_0x474e74[_0x29da('0x32')]=_[_0x29da('0x33')](_0x33dbb0[_0x29da('0x32')]);_0x474e74[_0x29da('0x34')]=_[_0x29da('0x35')](_0x474e74[_0x29da('0x36')],_0x474e74[_0x29da('0x32')]);_0x5892d7[_0x29da('0x37')]=_[_0x29da('0x35')](_0x474e74['model'],qs[_0x29da('0x38')](_0x33dbb0[_0x29da('0x32')][_0x29da('0x38')]));_0x5892d7['attributes']=_0x5892d7[_0x29da('0x37')][_0x29da('0x47')]?_0x5892d7[_0x29da('0x37')]:_0x474e74[_0x29da('0x36')];if(_0x33dbb0[_0x29da('0x32')][_0x29da('0x41')]){_0x5892d7[_0x29da('0x42')]=[{'all':!![]}];}_0x5892d7=_[_0x29da('0x3e')]({},_0x5892d7,_0x33dbb0[_0x29da('0x40')]);return db[_0x29da('0x2e')][_0x29da('0x48')](_0x5892d7)[_0x29da('0x27')](handleEntityNotFound(_0x3db24a,null))[_0x29da('0x27')](respondWithResult(_0x3db24a,null))[_0x29da('0x44')](handleError(_0x3db24a,null));};exports['create']=function(_0x54721c,_0x5d5228){return db[_0x29da('0x2e')][_0x29da('0x49')](_0x54721c['body'],{})['then'](function(_0x126abc){var _0x1d81ec=_0x54721c[_0x29da('0x4a')][_0x29da('0x28')]({'plain':!![]});if(!_0x1d81ec)throw new Error(_0x29da('0x4b'));if(_0x1d81ec[_0x29da('0x4c')]==='user'){var _0x402faf=_0x126abc['get']({'plain':!![]});var _0x52bdf7=_0x29da('0x29');return db['UserProfileSection']['find']({'where':{'name':_0x52bdf7,'userProfileId':_0x1d81ec['userProfileId']},'raw':!![]})[_0x29da('0x27')](function(_0x38863a){if(_0x38863a&&_0x38863a[_0x29da('0x4d')]===0x0){return db['UserProfileResource'][_0x29da('0x49')]({'name':_0x402faf[_0x29da('0x2c')],'resourceId':_0x402faf['id'],'type':_0x38863a['name'],'sectionId':_0x38863a['id']},{})[_0x29da('0x27')](function(){return _0x126abc;});}else{return _0x126abc;}})['catch'](function(_0x50407d){logger[_0x29da('0x4e')](_0x29da('0x4f'),_0x50407d);throw _0x50407d;});}return _0x126abc;})[_0x29da('0x27')](respondWithResult(_0x5d5228,0xc9))[_0x29da('0x44')](handleError(_0x5d5228,null));};exports[_0x29da('0x25')]=function(_0xdaa1c,_0x18594f){if(_0xdaa1c['body']['id']){delete _0xdaa1c['body']['id'];}return db[_0x29da('0x2e')][_0x29da('0x48')]({'where':{'id':_0xdaa1c[_0x29da('0x50')]['id']}})[_0x29da('0x27')](handleEntityNotFound(_0x18594f,null))[_0x29da('0x27')](saveUpdates(_0xdaa1c['body'],null))['then'](respondWithResult(_0x18594f,null))['catch'](handleError(_0x18594f,null));};exports['destroy']=function(_0x482a0f,_0x27299c){return db['FaxQueue'][_0x29da('0x48')]({'where':{'id':_0x482a0f[_0x29da('0x50')]['id']}})[_0x29da('0x27')](handleEntityNotFound(_0x27299c,null))['then'](removeEntity(_0x27299c,null))[_0x29da('0x44')](handleError(_0x27299c,null));};exports[_0x29da('0x51')]=function(_0x52e6da,_0x2b2229){return db[_0x29da('0x2e')]['describe']()[_0x29da('0x27')](respondWithResult(_0x2b2229,null))[_0x29da('0x44')](handleError(_0x2b2229,null));};exports[_0x29da('0x52')]=function(_0x1ba3a9,_0x478349,_0x414708){var _0x2441a9={'raw':!![],'where':{}},_0x30a811={},_0x51b63c;return db[_0x29da('0x2e')][_0x29da('0x53')]({'where':{'id':_0x1ba3a9[_0x29da('0x50')]['id']}})[_0x29da('0x27')](handleEntityNotFound(_0x478349,null))[_0x29da('0x27')](function(_0x5cbaaf){if(_0x5cbaaf){_0x51b63c=_0x5cbaaf[_0x29da('0x28')]({'plain':!![]});_0x30a811[_0x29da('0x36')]=_[_0x29da('0x33')](db[_0x29da('0x54')][_0x29da('0x46')]);_0x30a811[_0x29da('0x32')]=_['keys'](_0x1ba3a9[_0x29da('0x32')]);_0x30a811['filters']=_[_0x29da('0x35')](_0x30a811[_0x29da('0x36')],_0x30a811[_0x29da('0x32')]);_0x2441a9[_0x29da('0x37')]=_[_0x29da('0x35')](_0x30a811[_0x29da('0x36')],qs['fields'](_0x1ba3a9[_0x29da('0x32')][_0x29da('0x38')]));_0x2441a9['attributes']=_0x2441a9[_0x29da('0x37')][_0x29da('0x47')]?_0x2441a9[_0x29da('0x37')]:_0x30a811[_0x29da('0x36')];if(!_0x1ba3a9['query'][_0x29da('0x39')](_0x29da('0x55'))){_0x2441a9[_0x29da('0x21')]=qs[_0x29da('0x21')](_0x1ba3a9[_0x29da('0x32')]['limit']);_0x2441a9[_0x29da('0x20')]=qs['offset'](_0x1ba3a9['query'][_0x29da('0x20')]);}_0x2441a9[_0x29da('0x56')]=qs[_0x29da('0x3a')](_0x1ba3a9['query'][_0x29da('0x3a')]);_0x2441a9[_0x29da('0x3b')]=qs['filters'](_[_0x29da('0x3c')](_0x1ba3a9['query'],_0x30a811['filters']));_0x2441a9[_0x29da('0x3b')][_0x29da('0x57')]=_0x5cbaaf['id'];if(_0x1ba3a9[_0x29da('0x32')]['filter']){_0x2441a9[_0x29da('0x3b')]=_[_0x29da('0x3e')](_0x2441a9['where'],{'$or':_[_0x29da('0x31')](_0x2441a9[_0x29da('0x37')],function(_0x4c60eb){var _0x14d931={};_0x14d931[_0x4c60eb]={'$like':'%'+_0x1ba3a9[_0x29da('0x32')][_0x29da('0x3d')]+'%'};return _0x14d931;})});}_0x2441a9=_[_0x29da('0x3e')]({},_0x2441a9,_0x1ba3a9[_0x29da('0x40')]);return db[_0x29da('0x54')][_0x29da('0x58')](_0x2441a9);}})['then'](function(_0x1d4fdc){if(_0x1d4fdc){return db[_0x29da('0x59')][_0x29da('0x5a')]({'where':{'id':_[_0x29da('0x31')](_0x1d4fdc,_0x29da('0x5b')),'role':_0x29da('0x5c')},'attributes':['id',_0x29da('0x2c'),_0x29da('0x5d'),_0x29da('0x5e'),_0x29da('0x5f')]});}})[_0x29da('0x27')](function(_0x2feb79){if(_0x2feb79){return{'count':_0x2feb79['count'],'rows':_[_0x29da('0x31')](_0x2feb79[_0x29da('0x43')],function(_0x11837f){return{'membername':_0x11837f[_0x29da('0x2c')],'UserId':_0x11837f['id'],'queue_name':_0x51b63c[_0x29da('0x2c')],'FaxQueueId':_0x51b63c['id'],'interface':util[_0x29da('0x60')](_0x29da('0x61'),_0x29da('0x62'),_0x11837f[_0x29da('0x2c')]),'penalty':0x0,'paused':_0x11837f[_0x29da('0x5d')],'createdAt':_0x11837f[_0x29da('0x5f')],'updatedAt':_0x11837f[_0x29da('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x478349,_0x2441a9))[_0x29da('0x44')](handleError(_0x478349,null));};exports[_0x29da('0x63')]=function(_0x496b29,_0x2d0095,_0xbf7f0f){var _0x338c0e={};var _0x57d1f6={};var _0x39a91f;var _0x38cf04;return db[_0x29da('0x2e')]['findOne']({'where':{'id':_0x496b29[_0x29da('0x50')]['id']}})[_0x29da('0x27')](handleEntityNotFound(_0x2d0095,null))[_0x29da('0x27')](function(_0x185ee2){if(_0x185ee2){_0x39a91f=_0x185ee2;_0x57d1f6[_0x29da('0x36')]=_[_0x29da('0x33')](db[_0x29da('0x64')]['rawAttributes']);_0x57d1f6[_0x29da('0x32')]=_[_0x29da('0x33')](_0x496b29[_0x29da('0x32')]);_0x57d1f6[_0x29da('0x34')]=_[_0x29da('0x35')](_0x57d1f6[_0x29da('0x36')],_0x57d1f6[_0x29da('0x32')]);_0x338c0e[_0x29da('0x37')]=_[_0x29da('0x35')](_0x57d1f6[_0x29da('0x36')],qs[_0x29da('0x38')](_0x496b29[_0x29da('0x32')]['fields']));_0x338c0e[_0x29da('0x37')]=_0x338c0e[_0x29da('0x37')][_0x29da('0x47')]?_0x338c0e[_0x29da('0x37')]:_0x57d1f6['model'];_0x338c0e[_0x29da('0x56')]=qs[_0x29da('0x3a')](_0x496b29[_0x29da('0x32')]['sort']);_0x338c0e['where']=qs['filters'](_[_0x29da('0x3c')](_0x496b29[_0x29da('0x32')],_0x57d1f6[_0x29da('0x34')]));if(_0x496b29[_0x29da('0x32')]['filter']){_0x338c0e[_0x29da('0x3b')]=_[_0x29da('0x3e')](_0x338c0e[_0x29da('0x3b')],{'$or':_[_0x29da('0x31')](_0x338c0e[_0x29da('0x37')],function(_0x2d1746){var _0x2b3970={};_0x2b3970[_0x2d1746]={'$like':'%'+_0x496b29[_0x29da('0x32')][_0x29da('0x3d')]+'%'};return _0x2b3970;})});}_0x338c0e=_[_0x29da('0x3e')]({},_0x338c0e,_0x496b29[_0x29da('0x40')]);return _0x39a91f[_0x29da('0x63')](_0x338c0e);}})[_0x29da('0x27')](function(_0x164f7a){if(_0x164f7a){_0x38cf04=_0x164f7a[_0x29da('0x47')];if(!_0x496b29['query'][_0x29da('0x39')]('nolimit')){_0x338c0e[_0x29da('0x21')]=qs[_0x29da('0x21')](_0x496b29[_0x29da('0x32')][_0x29da('0x21')]);_0x338c0e[_0x29da('0x20')]=qs[_0x29da('0x20')](_0x496b29[_0x29da('0x32')][_0x29da('0x20')]);}return _0x39a91f[_0x29da('0x63')](_0x338c0e);}})['then'](function(_0x1084d4){if(_0x1084d4){return _0x1084d4?{'count':_0x38cf04,'rows':_0x1084d4}:null;}})[_0x29da('0x27')](respondWithResult(_0x2d0095,null))[_0x29da('0x44')](handleError(_0x2d0095,null));};exports['addTeams']=function(_0x31f7e3,_0x4dc761,_0x351855){var _0x1d0b1a=_0x31f7e3[_0x29da('0x65')]['ids'];return db[_0x29da('0x64')][_0x29da('0x58')]({'where':{'id':_0x1d0b1a},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id','name',_0x29da('0x66'),_0x29da('0x67'),_0x29da('0x68')],'raw':!![]}]})[_0x29da('0x27')](function(_0xd80205){if(_0xd80205){var _0x5436f0=_[_0x29da('0x69')](_0xd80205,function(_0x127c7a){var _0x545ec3=_0x127c7a['get']({'plain':!![]});return _0x545ec3[_0x29da('0x6a')];});return db[_0x29da('0x2e')][_0x29da('0x48')]({'where':{'id':_0x31f7e3[_0x29da('0x50')]['id']}})[_0x29da('0x27')](function(_0xda7739){return db['sequelize']['transaction'](function(_0x121204){return _0xda7739[_0x29da('0x6b')](_0x1d0b1a,{'transaction':_0x121204})[_0x29da('0x27')](function(){return BPromise[_0x29da('0x6c')](_0x5436f0,function(_0x3b2c95){return db[_0x29da('0x54')][_0x29da('0x6d')]({'where':{'UserId':_0x3b2c95['id'],'FaxQueueId':_0x31f7e3['params']['id']},'transaction':_0x121204});});})[_0x29da('0x27')](function(){_0x5436f0[_0x29da('0x6e')](function(_0x59ed0b){socket[_0x29da('0x6f')](_0x29da('0x70'),{'UserId':_0x59ed0b['id'],'FaxQueueId':_0xda7739['id']});});});});});}})[_0x29da('0x27')](respondWithStatusCode(_0x4dc761,null))[_0x29da('0x44')](handleError(_0x4dc761,null));};exports[_0x29da('0x71')]=function(_0x57cf9e,_0x3f5fd4,_0x4f8094){return db[_0x29da('0x64')][_0x29da('0x58')]({'where':{'id':_0x57cf9e[_0x29da('0x32')]['ids']},'attributes':['id'],'include':[{'model':db[_0x29da('0x59')],'as':_0x29da('0x6a'),'attributes':['id'],'raw':!![]}]})[_0x29da('0x27')](handleEntityNotFound(_0x3f5fd4,null))[_0x29da('0x27')](function(_0x40c5fe){var _0x3e41ed=_[_0x29da('0x31')](_0x40c5fe,'id');var _0x40df32=[];var _0x530824=[];var _0x37e941=squel['select']();_0x37e941[_0x29da('0x72')](_0x29da('0x73'))[_0x29da('0x74')](_0x29da('0x75'),'tq')['join'](_0x29da('0x76'),'ut',_0x29da('0x77'))[_0x29da('0x3b')](_0x29da('0x78'),_0x57cf9e[_0x29da('0x50')]['id']);for(var _0x165b55=0x0;_0x165b55<_0x40c5fe[_0x29da('0x47')];_0x165b55+=0x1){let _0x161f57=_0x40c5fe[_0x165b55];for(var _0x4f20a9=0x0;_0x4f20a9<_0x161f57[_0x29da('0x6a')][_0x29da('0x47')];_0x4f20a9+=0x1){let _0x38768c=_0x161f57[_0x29da('0x6a')][_0x4f20a9];var _0x2fc1a2=_0x37e941[_0x29da('0x79')]();_0x2fc1a2[_0x29da('0x3b')](_0x29da('0x7a'),_0x38768c['id']);_0x530824[_0x29da('0x7b')](db[_0x29da('0x7c')][_0x29da('0x32')](_0x2fc1a2[_0x29da('0x7d')](),{'type':db[_0x29da('0x7c')][_0x29da('0x7e')][_0x29da('0x7f')]})['then'](function(_0x16d71a){if(_0x16d71a[_0x29da('0x47')]===0x1){return _0x38768c['id'];}else{var _0x5c93d1=_['every'](_[_0x29da('0x31')](_0x16d71a,_0x29da('0x80')),function(_0xdebca5){return _[_0x29da('0x81')](_0x3e41ed,_0xdebca5);});if(_0x5c93d1){return _0x38768c['id'];}}}));}}return BPromise[_0x29da('0x82')](_0x530824)[_0x29da('0x27')](function(_0xd52b0f){_0x40df32=_(_0x40df32)['union'](_0xd52b0f)['compact']()[_0x29da('0x83')]();return db[_0x29da('0x2e')][_0x29da('0x48')]({'where':{'id':_0x57cf9e[_0x29da('0x50')]['id']}})[_0x29da('0x27')](function(_0x37e59b){return db[_0x29da('0x7c')][_0x29da('0x84')](function(_0x4f13e2){return _0x37e59b[_0x29da('0x71')](_0x57cf9e['query'][_0x29da('0x85')],{'transaction':_0x4f13e2})[_0x29da('0x27')](function(){if(!_['isEmpty'](_0x40df32)){return _0x37e59b[_0x29da('0x86')](_0x40df32,{'transaction':_0x4f13e2});}})[_0x29da('0x27')](function(){_0x40df32[_0x29da('0x6e')](function(_0x587561){socket[_0x29da('0x6f')](_0x29da('0x87'),{'UserId':_0x587561,'FaxQueueId':_0x37e59b['id']});});});});});});})[_0x29da('0x27')](respondWithStatusCode(_0x3f5fd4,null))[_0x29da('0x44')](handleError(_0x3f5fd4,null));};exports[_0x29da('0x88')]=function(_0x5b197f,_0x10cb55,_0x182091){return db['FaxQueue'][_0x29da('0x48')]({'where':{'id':_0x5b197f[_0x29da('0x50')]['id']}})[_0x29da('0x27')](handleEntityNotFound(_0x10cb55,null))['then'](function(_0x258740){if(_0x258740){return _0x258740[_0x29da('0x88')](_0x5b197f[_0x29da('0x65')][_0x29da('0x85')],_[_0x29da('0x89')](_0x5b197f[_0x29da('0x65')],[_0x29da('0x85'),'id'])||{})[_0x29da('0x8a')](function(_0xe72bda){for(var _0x5bc217=0x0;_0x5bc217<_0x5b197f[_0x29da('0x65')][_0x29da('0x85')][_0x29da('0x47')];_0x5bc217+=0x1){socket[_0x29da('0x6f')]('userFaxQueue:save',{'UserId':Number(_0x5b197f[_0x29da('0x65')]['ids'][_0x5bc217]),'FaxQueueId':Number(_0x5b197f[_0x29da('0x50')]['id'])});}return _0xe72bda;});}})[_0x29da('0x27')](respondWithResult(_0x10cb55,null))['catch'](handleError(_0x10cb55,null));};exports[_0x29da('0x86')]=function(_0x468a18,_0xd2d05e,_0x31e495){return db[_0x29da('0x2e')]['find']({'where':{'id':_0x468a18[_0x29da('0x50')]['id']}})[_0x29da('0x27')](handleEntityNotFound(_0xd2d05e,null))[_0x29da('0x27')](function(_0x2b398c){if(_0x2b398c){return _0x2b398c['removeAgents'](_0x468a18[_0x29da('0x32')]['ids'])[_0x29da('0x27')](function(){if(_[_0x29da('0x8b')](_0x468a18['query'][_0x29da('0x85')])){for(var _0x6d529=0x0;_0x6d529<_0x468a18[_0x29da('0x32')][_0x29da('0x85')]['length'];_0x6d529+=0x1){socket[_0x29da('0x6f')](_0x29da('0x87'),{'UserId':Number(_0x468a18['query'][_0x29da('0x85')][_0x6d529]),'FaxQueueId':Number(_0x468a18[_0x29da('0x50')]['id'])});}}else{socket[_0x29da('0x6f')](_0x29da('0x87'),{'UserId':Number(_0x468a18[_0x29da('0x32')][_0x29da('0x85')]),'FaxQueueId':Number(_0x468a18[_0x29da('0x50')]['id'])});}});}})[_0x29da('0x27')](respondWithStatusCode(_0xd2d05e,null))['catch'](handleError(_0xd2d05e,null));};exports[_0x29da('0x8c')]=function(_0x2b67b4,_0xc9adaf,_0x3ff667){var _0x5daef6={};var _0x130c0d={};var _0x200b5a;var _0x4169f1;return db[_0x29da('0x2e')][_0x29da('0x53')]({'where':{'id':_0x2b67b4[_0x29da('0x50')]['id']}})[_0x29da('0x27')](handleEntityNotFound(_0xc9adaf,null))[_0x29da('0x27')](function(_0x19e085){if(_0x19e085){_0x200b5a=_0x19e085;_0x130c0d['model']=_[_0x29da('0x33')](db[_0x29da('0x59')][_0x29da('0x46')]);_0x130c0d['query']=_[_0x29da('0x33')](_0x2b67b4[_0x29da('0x32')]);_0x130c0d[_0x29da('0x34')]=_[_0x29da('0x35')](_0x130c0d[_0x29da('0x36')],_0x130c0d['query']);_0x5daef6[_0x29da('0x37')]=_['intersection'](_0x130c0d[_0x29da('0x36')],qs[_0x29da('0x38')](_0x2b67b4[_0x29da('0x32')][_0x29da('0x38')]));_0x5daef6[_0x29da('0x37')]=_0x5daef6['attributes'][_0x29da('0x47')]?_0x5daef6['attributes']:_0x130c0d[_0x29da('0x36')];_0x5daef6[_0x29da('0x56')]=qs[_0x29da('0x3a')](_0x2b67b4[_0x29da('0x32')][_0x29da('0x3a')]);_0x5daef6[_0x29da('0x3b')]=qs[_0x29da('0x34')](_[_0x29da('0x3c')](_0x2b67b4[_0x29da('0x32')],_0x130c0d[_0x29da('0x34')]));if(_0x2b67b4[_0x29da('0x32')][_0x29da('0x3d')]){_0x5daef6[_0x29da('0x3b')]=_[_0x29da('0x3e')](_0x5daef6[_0x29da('0x3b')],{'$or':_[_0x29da('0x31')](_0x5daef6[_0x29da('0x37')],function(_0x112c2f){var _0xc0b301={};_0xc0b301[_0x112c2f]={'$like':'%'+_0x2b67b4[_0x29da('0x32')][_0x29da('0x3d')]+'%'};return _0xc0b301;})});}_0x5daef6=_[_0x29da('0x3e')]({},_0x5daef6,_0x2b67b4[_0x29da('0x40')]);return _0x200b5a[_0x29da('0x8c')](_0x5daef6);}})[_0x29da('0x27')](function(_0x11d4c9){if(_0x11d4c9){_0x4169f1=_0x11d4c9['length'];if(!_0x2b67b4[_0x29da('0x32')][_0x29da('0x39')](_0x29da('0x55'))){_0x5daef6[_0x29da('0x21')]=qs['limit'](_0x2b67b4['query'][_0x29da('0x21')]);_0x5daef6[_0x29da('0x20')]=qs[_0x29da('0x20')](_0x2b67b4[_0x29da('0x32')][_0x29da('0x20')]);}return _0x200b5a[_0x29da('0x8c')](_0x5daef6);}})[_0x29da('0x27')](function(_0x30fc88){if(_0x30fc88){return _0x30fc88?{'count':_0x4169f1,'rows':_0x30fc88}:null;}})['then'](respondWithResult(_0xc9adaf,null))[_0x29da('0x44')](handleError(_0xc9adaf,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index bd85919..7471e61 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 _0x8bdd=['update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxQueue','setMaxListeners'];(function(_0x271281,_0x120ede){var _0xb95f53=function(_0x287295){while(--_0x287295){_0x271281['push'](_0x271281['shift']());}};_0xb95f53(++_0x120ede);}(_0x8bdd,0xf8));var _0xd8bd=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x8bdd[_0xa464c9];return _0x3d73c4;};'use strict';var EventEmitter=require(_0xd8bd('0x0'));var FaxQueue=require(_0xd8bd('0x1'))['db'][_0xd8bd('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xd8bd('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd8bd('0x4'),'afterDestroy':'remove'};function emitEvent(_0x183cda){return function(_0x36676a,_0x3f341f,_0x3002fb){FaxQueueEvents[_0xd8bd('0x5')](_0x183cda+':'+_0x36676a['id'],_0x36676a);FaxQueueEvents['emit'](_0x183cda,_0x36676a);_0x3002fb(null);};}for(var e in events){if(events[_0xd8bd('0x6')](e)){var event=events[e];FaxQueue[_0xd8bd('0x7')](e,emitEvent(event));}}module[_0xd8bd('0x8')]=FaxQueueEvents; \ No newline at end of file +var _0xf5b9=['hasOwnProperty','exports','events','../../mysqldb','FaxQueue','save','remove','emit'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xf5b9,0x10a));var _0x9f5b=function(_0x44a593,_0x2e7a9f){_0x44a593=_0x44a593-0x0;var _0x10ffe0=_0xf5b9[_0x44a593];return _0x10ffe0;};'use strict';var EventEmitter=require(_0x9f5b('0x0'));var FaxQueue=require(_0x9f5b('0x1'))['db'][_0x9f5b('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9f5b('0x3'),'afterUpdate':'update','afterDestroy':_0x9f5b('0x4')};function emitEvent(_0x321df7){return function(_0x13c571,_0x466b93,_0xb78e5d){FaxQueueEvents[_0x9f5b('0x5')](_0x321df7+':'+_0x13c571['id'],_0x13c571);FaxQueueEvents[_0x9f5b('0x5')](_0x321df7,_0x13c571);_0xb78e5d(null);};}for(var e in events){if(events[_0x9f5b('0x6')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0x9f5b('0x7')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 43ea0fb..12985e6 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 _0x66e7=['request-promise','rimraf','../../config/environment','./faxQueue.attributes','exports','define','FaxQueue','fax_queues','lodash','api','moment'];(function(_0x4ae965,_0x305476){var _0x365add=function(_0x4ba4a6){while(--_0x4ba4a6){_0x4ae965['push'](_0x4ae965['shift']());}};_0x365add(++_0x305476);}(_0x66e7,0x110));var _0x766e=function(_0x1b4b23,_0x5dd6d6){_0x1b4b23=_0x1b4b23-0x0;var _0x2a325b=_0x66e7[_0x1b4b23];return _0x2a325b;};'use strict';var _=require(_0x766e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x766e('0x1'));var moment=require(_0x766e('0x2'));var BPromise=require('bluebird');var rp=require(_0x766e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x766e('0x4'));var config=require(_0x766e('0x5'));var attributes=require(_0x766e('0x6'));module[_0x766e('0x7')]=function(_0x454775,_0x3c9614){return _0x454775[_0x766e('0x8')](_0x766e('0x9'),attributes,{'tableName':_0x766e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5f4f=['../../config/environment','./faxQueue.attributes','exports','FaxQueue','fax_queues','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x5391af,_0x3f1f3d){var _0xda66b0=function(_0x32be99){while(--_0x32be99){_0x5391af['push'](_0x5391af['shift']());}};_0xda66b0(++_0x3f1f3d);}(_0x5f4f,0x71));var _0xf5f4=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x5f4f[_0x122096];return _0x3d1966;};'use strict';var _=require(_0xf5f4('0x0'));var util=require('util');var logger=require(_0xf5f4('0x1'))('api');var moment=require(_0xf5f4('0x2'));var BPromise=require(_0xf5f4('0x3'));var rp=require(_0xf5f4('0x4'));var fs=require('fs');var path=require(_0xf5f4('0x5'));var rimraf=require(_0xf5f4('0x6'));var config=require(_0xf5f4('0x7'));var attributes=require(_0xf5f4('0x8'));module[_0xf5f4('0x9')]=function(_0x4585ca,_0x1de195){return _0x4585ca['define'](_0xf5f4('0xa'),attributes,{'tableName':_0xf5f4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index dedbd82..ad48382 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 _0x6183=['findAll','options','where','attributes','limit','include','map','model','stringify','find','raw','ShowFaxQueue','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./faxQueue.socket','register','request','then','info','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','error','code','FaxQueue,\x20%s,\x20%s','message','result','catch','GetFaxQueue','FaxQueue'];(function(_0x5debd6,_0x554e98){var _0x458cb2=function(_0x2f64ee){while(--_0x2f64ee){_0x5debd6['push'](_0x5debd6['shift']());}};_0x458cb2(++_0x554e98);}(_0x6183,0x186));var _0x3618=function(_0x591a90,_0x5525b0){_0x591a90=_0x591a90-0x0;var _0x551587=_0x6183[_0x591a90];return _0x551587;};'use strict';var _=require(_0x3618('0x0'));var util=require(_0x3618('0x1'));var moment=require(_0x3618('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3618('0x3'));var db=require(_0x3618('0x4'))['db'];var utils=require(_0x3618('0x5'));var logger=require('../../config/logger')(_0x3618('0x6'));var config=require(_0x3618('0x7'));var jayson=require(_0x3618('0x8'));var client=jayson[_0x3618('0x9')][_0x3618('0xa')]({'port':0x232a});config['redis']=_[_0x3618('0xb')](config[_0x3618('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x3618('0xd'))(new Redis(config[_0x3618('0xc')]));require(_0x3618('0xe'))[_0x3618('0xf')](socket);function respondWithRpcPromise(_0x57c424,_0x345a52,_0x3b937f){return new BPromise(function(_0x2b6316,_0x5a97e7){return client[_0x3618('0x10')](_0x57c424,_0x3b937f)[_0x3618('0x11')](function(_0x4b31ca){logger[_0x3618('0x12')]('FaxQueue,\x20%s,\x20%s',_0x345a52,_0x3618('0x13'));logger[_0x3618('0x14')](_0x3618('0x15'),_0x345a52,_0x3618('0x13'),JSON['stringify'](_0x4b31ca));if(_0x4b31ca[_0x3618('0x16')]){if(_0x4b31ca[_0x3618('0x16')][_0x3618('0x17')]===0x1f4){logger['error'](_0x3618('0x18'),_0x345a52,_0x4b31ca[_0x3618('0x16')][_0x3618('0x19')]);return _0x5a97e7(_0x4b31ca[_0x3618('0x16')]['message']);}logger['error'](_0x3618('0x18'),_0x345a52,_0x4b31ca['error'][_0x3618('0x19')]);return _0x2b6316(_0x4b31ca[_0x3618('0x16')][_0x3618('0x19')]);}else{logger['info'](_0x3618('0x18'),_0x345a52,_0x3618('0x13'));_0x2b6316(_0x4b31ca[_0x3618('0x1a')][_0x3618('0x19')]);}})[_0x3618('0x1b')](function(_0x257242){logger['error'](_0x3618('0x18'),_0x345a52,_0x257242);_0x5a97e7(_0x257242);});});}exports[_0x3618('0x1c')]=function(_0x2b379e){var _0x445f52=this;return new Promise(function(_0x1021c4,_0x371bc8){return db[_0x3618('0x1d')][_0x3618('0x1e')]({'raw':_0x2b379e[_0x3618('0x1f')]?_0x2b379e[_0x3618('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x2b379e[_0x3618('0x1f')]?_0x2b379e[_0x3618('0x1f')][_0x3618('0x20')]||null:null,'attributes':_0x2b379e[_0x3618('0x1f')]?_0x2b379e[_0x3618('0x1f')][_0x3618('0x21')]||null:null,'limit':_0x2b379e[_0x3618('0x1f')]?_0x2b379e[_0x3618('0x1f')][_0x3618('0x22')]||null:null,'include':_0x2b379e[_0x3618('0x1f')]?_0x2b379e[_0x3618('0x1f')][_0x3618('0x23')]?_[_0x3618('0x24')](_0x2b379e[_0x3618('0x1f')]['include'],function(_0x361ea6){return{'model':db[_0x361ea6[_0x3618('0x25')]],'as':_0x361ea6['as'],'attributes':_0x361ea6['attributes'],'include':_0x361ea6[_0x3618('0x23')]?_[_0x3618('0x24')](_0x361ea6[_0x3618('0x23')],function(_0xefa437){return{'model':db[_0xefa437[_0x3618('0x25')]],'as':_0xefa437['as'],'attributes':_0xefa437[_0x3618('0x21')],'include':_0xefa437['include']?_[_0x3618('0x24')](_0xefa437[_0x3618('0x23')],function(_0x3c9e55){return{'model':db[_0x3c9e55[_0x3618('0x25')]],'as':_0x3c9e55['as'],'attributes':_0x3c9e55[_0x3618('0x21')]};}):[]};}):[]};}):[]:[]})[_0x3618('0x11')](function(_0x5d95eb){logger[_0x3618('0x12')](_0x3618('0x1c'),_0x2b379e);logger[_0x3618('0x14')](_0x3618('0x1c'),_0x2b379e,JSON[_0x3618('0x26')](_0x5d95eb));_0x1021c4(_0x5d95eb);})[_0x3618('0x1b')](function(_0x2464fa){logger['error'](_0x3618('0x1c'),_0x2464fa['message'],_0x2b379e);_0x371bc8(_0x445f52[_0x3618('0x16')](0x1f4,_0x2464fa[_0x3618('0x19')]));});});};exports['ShowFaxQueue']=function(_0x3873d6){var _0x16a7b1=this;return new Promise(function(_0x31a06d,_0x310b32){return db[_0x3618('0x1d')][_0x3618('0x27')]({'raw':_0x3873d6[_0x3618('0x1f')]?_0x3873d6['options'][_0x3618('0x28')]===undefined?!![]:![]:!![],'where':_0x3873d6[_0x3618('0x1f')]?_0x3873d6[_0x3618('0x1f')][_0x3618('0x20')]||null:null,'attributes':_0x3873d6['options']?_0x3873d6[_0x3618('0x1f')][_0x3618('0x21')]||null:null,'include':_0x3873d6['options']?_0x3873d6[_0x3618('0x1f')][_0x3618('0x23')]?_['map'](_0x3873d6[_0x3618('0x1f')][_0x3618('0x23')],function(_0x1b00ad){return{'model':db[_0x1b00ad[_0x3618('0x25')]],'as':_0x1b00ad['as'],'attributes':_0x1b00ad[_0x3618('0x21')],'include':_0x1b00ad[_0x3618('0x23')]?_[_0x3618('0x24')](_0x1b00ad[_0x3618('0x23')],function(_0x39baed){return{'model':db[_0x39baed[_0x3618('0x25')]],'as':_0x39baed['as'],'attributes':_0x39baed['attributes'],'include':_0x39baed[_0x3618('0x23')]?_[_0x3618('0x24')](_0x39baed[_0x3618('0x23')],function(_0x5aed39){return{'model':db[_0x5aed39[_0x3618('0x25')]],'as':_0x5aed39['as'],'attributes':_0x5aed39[_0x3618('0x21')]};}):[]};}):[]};}):[]:[]})[_0x3618('0x11')](function(_0x1c00bc){logger[_0x3618('0x12')](_0x3618('0x29'),_0x3873d6);logger[_0x3618('0x14')](_0x3618('0x29'),_0x3873d6,JSON['stringify'](_0x1c00bc));_0x31a06d(_0x1c00bc);})[_0x3618('0x1b')](function(_0xa87bf5){logger[_0x3618('0x16')](_0x3618('0x29'),_0xa87bf5['message'],_0x3873d6);_0x310b32(_0x16a7b1[_0x3618('0x16')](0x1f4,_0xa87bf5[_0x3618('0x19')]));});});}; \ No newline at end of file +var _0xc2af=['../../config/utils','rpc','jayson/promise','client','redis','localhost','socket.io-emitter','./faxQueue.socket','register','FaxQueue,\x20%s,\x20%s','request\x20sent','FaxQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','options','raw','where','limit','include','model','map','attributes','GetFaxQueue','debug','stringify','ShowFaxQueue','FaxQueue','then','util','moment','bluebird','randomstring','ioredis'];(function(_0x20c512,_0x36c198){var _0x25236e=function(_0x418ec3){while(--_0x418ec3){_0x20c512['push'](_0x20c512['shift']());}};_0x25236e(++_0x36c198);}(_0xc2af,0x123));var _0xfc2a=function(_0x10d8bc,_0x1d7a93){_0x10d8bc=_0x10d8bc-0x0;var _0x4879d0=_0xc2af[_0x10d8bc];return _0x4879d0;};'use strict';var _=require('lodash');var util=require(_0xfc2a('0x0'));var moment=require(_0xfc2a('0x1'));var BPromise=require(_0xfc2a('0x2'));var rs=require(_0xfc2a('0x3'));var fs=require('fs');var Redis=require(_0xfc2a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xfc2a('0x5'));var logger=require('../../config/logger')(_0xfc2a('0x6'));var config=require('../../config/environment');var jayson=require(_0xfc2a('0x7'));var client=jayson[_0xfc2a('0x8')]['http']({'port':0x232a});config[_0xfc2a('0x9')]=_['defaults'](config[_0xfc2a('0x9')],{'host':_0xfc2a('0xa'),'port':0x18eb});var socket=require(_0xfc2a('0xb'))(new Redis(config[_0xfc2a('0x9')]));require(_0xfc2a('0xc'))[_0xfc2a('0xd')](socket);function respondWithRpcPromise(_0x25723e,_0x536aa6,_0x337e47){return new BPromise(function(_0x1f0695,_0x53f0e0){return client['request'](_0x25723e,_0x337e47)['then'](function(_0x26953f){logger['info'](_0xfc2a('0xe'),_0x536aa6,_0xfc2a('0xf'));logger['debug'](_0xfc2a('0x10'),_0x536aa6,_0xfc2a('0xf'),JSON['stringify'](_0x26953f));if(_0x26953f[_0xfc2a('0x11')]){if(_0x26953f[_0xfc2a('0x11')][_0xfc2a('0x12')]===0x1f4){logger[_0xfc2a('0x11')](_0xfc2a('0xe'),_0x536aa6,_0x26953f[_0xfc2a('0x11')][_0xfc2a('0x13')]);return _0x53f0e0(_0x26953f[_0xfc2a('0x11')][_0xfc2a('0x13')]);}logger['error'](_0xfc2a('0xe'),_0x536aa6,_0x26953f['error'][_0xfc2a('0x13')]);return _0x1f0695(_0x26953f['error'][_0xfc2a('0x13')]);}else{logger[_0xfc2a('0x14')](_0xfc2a('0xe'),_0x536aa6,_0xfc2a('0xf'));_0x1f0695(_0x26953f[_0xfc2a('0x15')]['message']);}})[_0xfc2a('0x16')](function(_0x435ea8){logger[_0xfc2a('0x11')](_0xfc2a('0xe'),_0x536aa6,_0x435ea8);_0x53f0e0(_0x435ea8);});});}exports['GetFaxQueue']=function(_0x1d68a8){var _0x4a93e2=this;return new Promise(function(_0x131619,_0x53a50a){return db['FaxQueue']['findAll']({'raw':_0x1d68a8[_0xfc2a('0x17')]?_0x1d68a8[_0xfc2a('0x17')][_0xfc2a('0x18')]===undefined?!![]:![]:!![],'where':_0x1d68a8[_0xfc2a('0x17')]?_0x1d68a8[_0xfc2a('0x17')][_0xfc2a('0x19')]||null:null,'attributes':_0x1d68a8[_0xfc2a('0x17')]?_0x1d68a8[_0xfc2a('0x17')]['attributes']||null:null,'limit':_0x1d68a8['options']?_0x1d68a8[_0xfc2a('0x17')][_0xfc2a('0x1a')]||null:null,'include':_0x1d68a8[_0xfc2a('0x17')]?_0x1d68a8['options']['include']?_['map'](_0x1d68a8[_0xfc2a('0x17')][_0xfc2a('0x1b')],function(_0xa97b50){return{'model':db[_0xa97b50[_0xfc2a('0x1c')]],'as':_0xa97b50['as'],'attributes':_0xa97b50['attributes'],'include':_0xa97b50[_0xfc2a('0x1b')]?_[_0xfc2a('0x1d')](_0xa97b50[_0xfc2a('0x1b')],function(_0x3427e4){return{'model':db[_0x3427e4['model']],'as':_0x3427e4['as'],'attributes':_0x3427e4['attributes'],'include':_0x3427e4['include']?_[_0xfc2a('0x1d')](_0x3427e4['include'],function(_0x2fe7b7){return{'model':db[_0x2fe7b7[_0xfc2a('0x1c')]],'as':_0x2fe7b7['as'],'attributes':_0x2fe7b7[_0xfc2a('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x295c87){logger['info'](_0xfc2a('0x1f'),_0x1d68a8);logger[_0xfc2a('0x20')](_0xfc2a('0x1f'),_0x1d68a8,JSON[_0xfc2a('0x21')](_0x295c87));_0x131619(_0x295c87);})[_0xfc2a('0x16')](function(_0x38448c){logger[_0xfc2a('0x11')](_0xfc2a('0x1f'),_0x38448c[_0xfc2a('0x13')],_0x1d68a8);_0x53a50a(_0x4a93e2[_0xfc2a('0x11')](0x1f4,_0x38448c[_0xfc2a('0x13')]));});});};exports[_0xfc2a('0x22')]=function(_0x581d62){var _0x5c0118=this;return new Promise(function(_0x592c83,_0x576a17){return db[_0xfc2a('0x23')]['find']({'raw':_0x581d62['options']?_0x581d62[_0xfc2a('0x17')][_0xfc2a('0x18')]===undefined?!![]:![]:!![],'where':_0x581d62[_0xfc2a('0x17')]?_0x581d62[_0xfc2a('0x17')][_0xfc2a('0x19')]||null:null,'attributes':_0x581d62[_0xfc2a('0x17')]?_0x581d62[_0xfc2a('0x17')]['attributes']||null:null,'include':_0x581d62['options']?_0x581d62[_0xfc2a('0x17')][_0xfc2a('0x1b')]?_[_0xfc2a('0x1d')](_0x581d62[_0xfc2a('0x17')]['include'],function(_0x914866){return{'model':db[_0x914866['model']],'as':_0x914866['as'],'attributes':_0x914866[_0xfc2a('0x1e')],'include':_0x914866[_0xfc2a('0x1b')]?_['map'](_0x914866[_0xfc2a('0x1b')],function(_0x11d0fd){return{'model':db[_0x11d0fd[_0xfc2a('0x1c')]],'as':_0x11d0fd['as'],'attributes':_0x11d0fd['attributes'],'include':_0x11d0fd[_0xfc2a('0x1b')]?_[_0xfc2a('0x1d')](_0x11d0fd[_0xfc2a('0x1b')],function(_0xf47fb0){return{'model':db[_0xf47fb0[_0xfc2a('0x1c')]],'as':_0xf47fb0['as'],'attributes':_0xf47fb0[_0xfc2a('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xfc2a('0x24')](function(_0x4c4910){logger['info']('ShowFaxQueue',_0x581d62);logger[_0xfc2a('0x20')](_0xfc2a('0x22'),_0x581d62,JSON[_0xfc2a('0x21')](_0x4c4910));_0x592c83(_0x4c4910);})['catch'](function(_0x4ba76d){logger[_0xfc2a('0x11')](_0xfc2a('0x22'),_0x4ba76d[_0xfc2a('0x13')],_0x581d62);_0x576a17(_0x5c0118['error'](0x1f4,_0x4ba76d['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index ab1ce63..9c109d3 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 _0x17ed=['faxQueue:','save','remove','update','removeListener','register'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x17ed,0xeb));var _0xd17e=function(_0x118360,_0x5e31bf){_0x118360=_0x118360-0x0;var _0x29e3be=_0x17ed[_0x118360];return _0x29e3be;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0xd17e('0x0'),_0xd17e('0x1'),_0xd17e('0x2')];function createListener(_0x30dcc8,_0x3a51a7){return function(_0x19fce1){_0x3a51a7['emit'](_0x30dcc8,_0x19fce1);};}function removeListener(_0x20eaab,_0x3345e2){return function(){FaxQueueEvents[_0xd17e('0x3')](_0x20eaab,_0x3345e2);};}exports[_0xd17e('0x4')]=function(_0x4abb54){for(var _0x5bb4d6=0x0,_0x12f82c=events['length'];_0x5bb4d6<_0x12f82c;_0x5bb4d6++){var _0xaecd96=events[_0x5bb4d6];var _0x2b6d0f=createListener(_0xd17e('0x5')+_0xaecd96,_0x4abb54);FaxQueueEvents['on'](_0xaecd96,_0x2b6d0f);}}; \ No newline at end of file +var _0x5aa1=['length','faxQueue:','./faxQueue.events','save','remove','update','emit','removeListener','register'];(function(_0x2e8a34,_0x224b5c){var _0x1d853d=function(_0x2cfa57){while(--_0x2cfa57){_0x2e8a34['push'](_0x2e8a34['shift']());}};_0x1d853d(++_0x224b5c);}(_0x5aa1,0x158));var _0x15aa=function(_0x525833,_0xe65722){_0x525833=_0x525833-0x0;var _0x2dc53e=_0x5aa1[_0x525833];return _0x2dc53e;};'use strict';var FaxQueueEvents=require(_0x15aa('0x0'));var events=[_0x15aa('0x1'),_0x15aa('0x2'),_0x15aa('0x3')];function createListener(_0x17bceb,_0x59900f){return function(_0x42916f){_0x59900f[_0x15aa('0x4')](_0x17bceb,_0x42916f);};}function removeListener(_0x4c8d14,_0x1970a5){return function(){FaxQueueEvents[_0x15aa('0x5')](_0x4c8d14,_0x1970a5);};}exports[_0x15aa('0x6')]=function(_0x21b0ed){for(var _0x4cc83a=0x0,_0xd6a173=events[_0x15aa('0x7')];_0x4cc83a<_0xd6a173;_0x4cc83a++){var _0x59e364=events[_0x4cc83a];var _0x38ea20=createListener(_0x15aa('0x8')+_0x59e364,_0x21b0ed);FaxQueueEvents['on'](_0x59e364,_0x38ea20);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index ff618d1..25980c2 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 _0xeda8=['get','isAuthenticated','index','describe','/:id','getMembers','/:id/users','getAgents','post','create','addTeams','addAgents','put','delete','/:id/teams','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller'];(function(_0x4a0bc2,_0x5a3343){var _0x351ac6=function(_0x45ad9a){while(--_0x45ad9a){_0x4a0bc2['push'](_0x4a0bc2['shift']());}};_0x351ac6(++_0x5a3343);}(_0xeda8,0x104));var _0x8eda=function(_0x1a07c8,_0x2d56e2){_0x1a07c8=_0x1a07c8-0x0;var _0x598da1=_0xeda8[_0x1a07c8];return _0x598da1;};'use strict';var multer=require(_0x8eda('0x0'));var util=require(_0x8eda('0x1'));var path=require('path');var timeout=require(_0x8eda('0x2'));var express=require(_0x8eda('0x3'));var router=express[_0x8eda('0x4')]();var fs_extra=require(_0x8eda('0x5'));var auth=require(_0x8eda('0x6'));var interaction=require(_0x8eda('0x7'));var config=require(_0x8eda('0x8'));var controller=require(_0x8eda('0x9'));router[_0x8eda('0xa')]('/',auth[_0x8eda('0xb')](),controller[_0x8eda('0xc')]);router[_0x8eda('0xa')]('/describe',auth[_0x8eda('0xb')](),controller[_0x8eda('0xd')]);router[_0x8eda('0xa')](_0x8eda('0xe'),auth['isAuthenticated'](),controller['show']);router['get']('/:id/members',auth[_0x8eda('0xb')](),controller[_0x8eda('0xf')]);router[_0x8eda('0xa')]('/:id/teams',auth[_0x8eda('0xb')](),controller['getTeams']);router[_0x8eda('0xa')](_0x8eda('0x10'),auth[_0x8eda('0xb')](),controller[_0x8eda('0x11')]);router[_0x8eda('0x12')]('/',auth[_0x8eda('0xb')](),controller[_0x8eda('0x13')]);router[_0x8eda('0x12')]('/:id/teams',auth['isAuthenticated'](),controller[_0x8eda('0x14')]);router[_0x8eda('0x12')]('/:id/users',auth[_0x8eda('0xb')](),controller[_0x8eda('0x15')]);router[_0x8eda('0x16')]('/:id',auth[_0x8eda('0xb')](),controller['update']);router[_0x8eda('0x17')]('/:id',auth[_0x8eda('0xb')](),controller['destroy']);router[_0x8eda('0x17')](_0x8eda('0x18'),auth['isAuthenticated'](),controller['removeTeams']);router[_0x8eda('0x17')](_0x8eda('0x10'),auth[_0x8eda('0xb')](),controller[_0x8eda('0x19')]);module[_0x8eda('0x1a')]=router; \ No newline at end of file +var _0x6b1b=['../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id/teams','getAgents','post','create','addTeams','/:id/users','addAgents','delete','/:id','destroy','removeAgents','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x363ef8,_0x4ecb1a){var _0x148822=function(_0x232634){while(--_0x232634){_0x363ef8['push'](_0x363ef8['shift']());}};_0x148822(++_0x4ecb1a);}(_0x6b1b,0x1e7));var _0xb6b1=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0x6b1b[_0x521929];return _0x632436;};'use strict';var multer=require('multer');var util=require(_0xb6b1('0x0'));var path=require(_0xb6b1('0x1'));var timeout=require(_0xb6b1('0x2'));var express=require('express');var router=express[_0xb6b1('0x3')]();var fs_extra=require(_0xb6b1('0x4'));var auth=require(_0xb6b1('0x5'));var interaction=require(_0xb6b1('0x6'));var config=require(_0xb6b1('0x7'));var controller=require(_0xb6b1('0x8'));router[_0xb6b1('0x9')]('/',auth[_0xb6b1('0xa')](),controller[_0xb6b1('0xb')]);router[_0xb6b1('0x9')](_0xb6b1('0xc'),auth['isAuthenticated'](),controller[_0xb6b1('0xd')]);router['get']('/:id',auth[_0xb6b1('0xa')](),controller['show']);router[_0xb6b1('0x9')]('/:id/members',auth['isAuthenticated'](),controller['getMembers']);router['get'](_0xb6b1('0xe'),auth[_0xb6b1('0xa')](),controller['getTeams']);router[_0xb6b1('0x9')]('/:id/users',auth['isAuthenticated'](),controller[_0xb6b1('0xf')]);router[_0xb6b1('0x10')]('/',auth[_0xb6b1('0xa')](),controller[_0xb6b1('0x11')]);router[_0xb6b1('0x10')](_0xb6b1('0xe'),auth[_0xb6b1('0xa')](),controller[_0xb6b1('0x12')]);router[_0xb6b1('0x10')](_0xb6b1('0x13'),auth[_0xb6b1('0xa')](),controller[_0xb6b1('0x14')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xb6b1('0x15')](_0xb6b1('0x16'),auth[_0xb6b1('0xa')](),controller[_0xb6b1('0x17')]);router[_0xb6b1('0x15')](_0xb6b1('0xe'),auth['isAuthenticated'](),controller['removeTeams']);router[_0xb6b1('0x15')](_0xb6b1('0x13'),auth[_0xb6b1('0xa')](),controller[_0xb6b1('0x18')]);module[_0xb6b1('0x19')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 9257ed9..f3d834b 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 _0xf430=['exports','STRING','DATE'];(function(_0x2d34d6,_0x397ff9){var _0x1d3d12=function(_0x558800){while(--_0x558800){_0x2d34d6['push'](_0x2d34d6['shift']());}};_0x1d3d12(++_0x397ff9);}(_0xf430,0x102));var _0x0f43=function(_0x52e68e,_0x309912){_0x52e68e=_0x52e68e-0x0;var _0x3211a4=_0xf430[_0x52e68e];return _0x3211a4;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x0f43('0x0')]={'uniqueid':{'type':Sequelize[_0x0f43('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x0f43('0x1')]},'joinAt':{'type':Sequelize[_0x0f43('0x2')]},'leaveAt':{'type':Sequelize[_0x0f43('0x2')]},'acceptAt':{'type':Sequelize[_0x0f43('0x2')]},'exitAt':{'type':Sequelize[_0x0f43('0x2')]},'reason':{'type':Sequelize[_0x0f43('0x1')]}}; \ No newline at end of file +var _0x5f58=['STRING','DATE','moment','exports'];(function(_0x1914f7,_0x2d6ae0){var _0x6b2881=function(_0x4132f5){while(--_0x4132f5){_0x1914f7['push'](_0x1914f7['shift']());}};_0x6b2881(++_0x2d6ae0);}(_0x5f58,0x1a6));var _0x85f5=function(_0x13a0d6,_0x9a1972){_0x13a0d6=_0x13a0d6-0x0;var _0x241df1=_0x5f58[_0x13a0d6];return _0x241df1;};'use strict';var moment=require(_0x85f5('0x0'));var Sequelize=require('sequelize');module[_0x85f5('0x1')]={'uniqueid':{'type':Sequelize[_0x85f5('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x85f5('0x2')]},'joinAt':{'type':Sequelize[_0x85f5('0x3')]},'leaveAt':{'type':Sequelize[_0x85f5('0x3')]},'acceptAt':{'type':Sequelize[_0x85f5('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x85f5('0x2')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 9a63f3a..8bbc5de 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 _0x6c63=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','stack','name','map','FaxQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','filter','where','options','include','rows','catch','params','merge','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','papaparse'];(function(_0x3c7697,_0x2fd59b){var _0x67e596=function(_0x113103){while(--_0x113103){_0x3c7697['push'](_0x3c7697['shift']());}};_0x67e596(++_0x2fd59b);}(_0x6c63,0x1ee));var _0x36c6=function(_0x14b887,_0x501e41){_0x14b887=_0x14b887-0x0;var _0x2aa1c5=_0x6c63[_0x14b887];return _0x2aa1c5;};'use strict';var emlformat=require(_0x36c6('0x0'));var rimraf=require(_0x36c6('0x1'));var zipdir=require(_0x36c6('0x2'));var jsonpatch=require(_0x36c6('0x3'));var rp=require(_0x36c6('0x4'));var moment=require(_0x36c6('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x36c6('0x6'));var util=require(_0x36c6('0x7'));var path=require(_0x36c6('0x8'));var sox=require(_0x36c6('0x9'));var csv=require(_0x36c6('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x36c6('0xb'));var _=require(_0x36c6('0xc'));var squel=require(_0x36c6('0xd'));var crypto=require(_0x36c6('0xe'));var jsforce=require(_0x36c6('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x36c6('0xa'));var querystring=require('querystring');var Papa=require(_0x36c6('0x10'));var Redis=require('ioredis');var authService=require(_0x36c6('0x11'));var qs=require(_0x36c6('0x12'));var as=require(_0x36c6('0x13'));var hardwareService=require(_0x36c6('0x14'));var logger=require(_0x36c6('0x15'))(_0x36c6('0x16'));var utils=require(_0x36c6('0x17'));var config=require(_0x36c6('0x18'));var licenseUtil=require(_0x36c6('0x19'));var db=require(_0x36c6('0x1a'))['db'];function respondWithStatusCode(_0x1e5a00,_0x1bbb1b){_0x1bbb1b=_0x1bbb1b||0xcc;return function(_0x20213a){if(_0x20213a){return _0x1e5a00[_0x36c6('0x1b')](_0x1bbb1b);}return _0x1e5a00['status'](_0x1bbb1b)[_0x36c6('0x1c')]();};}function respondWithResult(_0x1a2391,_0x1f9de1){_0x1f9de1=_0x1f9de1||0xc8;return function(_0x531c09){if(_0x531c09){return _0x1a2391[_0x36c6('0x1d')](_0x1f9de1)[_0x36c6('0x1e')](_0x531c09);}};}function respondWithFilteredResult(_0x3c5623,_0x25b30e){return function(_0x9e4cb6){if(_0x9e4cb6){var _0x56b28b=typeof _0x25b30e[_0x36c6('0x1f')]===_0x36c6('0x20')&&typeof _0x25b30e[_0x36c6('0x21')]===_0x36c6('0x20');var _0x5bac6c=_0x9e4cb6[_0x36c6('0x22')];var _0x499c50=_0x56b28b?0x0:_0x25b30e[_0x36c6('0x1f')];var _0x59ab0c=_0x56b28b?_0x9e4cb6[_0x36c6('0x22')]:_0x25b30e[_0x36c6('0x1f')]+_0x25b30e[_0x36c6('0x21')];var _0x539791;if(_0x59ab0c>=_0x5bac6c){_0x59ab0c=_0x5bac6c;_0x539791=0xc8;}else{_0x539791=0xce;}_0x3c5623[_0x36c6('0x1d')](_0x539791);return _0x3c5623[_0x36c6('0x23')](_0x36c6('0x24'),_0x499c50+'-'+_0x59ab0c+'/'+_0x5bac6c)[_0x36c6('0x1e')](_0x9e4cb6);}return null;};}function patchUpdates(_0x4097b1){return function(_0x6daa60){try{jsonpatch[_0x36c6('0x25')](_0x6daa60,_0x4097b1,!![]);}catch(_0x55898b){return BPromise['reject'](_0x55898b);}return _0x6daa60[_0x36c6('0x26')]();};}function saveUpdates(_0x32093d,_0x53911e){return function(_0x597570){if(_0x597570){return _0x597570[_0x36c6('0x27')](_0x32093d)[_0x36c6('0x28')](function(_0x3112af){return _0x3112af;});}return null;};}function removeEntity(_0xdd6931,_0x2e12f7){return function(_0x77240f){if(_0x77240f){return _0x77240f[_0x36c6('0x29')]()[_0x36c6('0x28')](function(){_0xdd6931['status'](0xcc)[_0x36c6('0x1c')]();});}};}function handleEntityNotFound(_0x3c5195,_0x13c266){return function(_0x599db1){if(!_0x599db1){_0x3c5195[_0x36c6('0x1b')](0x194);}return _0x599db1;};}function handleError(_0x41f46e,_0x2cfcdf){_0x2cfcdf=_0x2cfcdf||0x1f4;return function(_0x83612d){logger['error'](_0x83612d[_0x36c6('0x2a')]);if(_0x83612d['name']){delete _0x83612d[_0x36c6('0x2b')];}_0x41f46e[_0x36c6('0x1d')](_0x2cfcdf)['send'](_0x83612d);};}exports['index']=function(_0x539d99,_0x294c9b){var _0x26f4d4={},_0x4eae9a={},_0x50b21b={'count':0x0,'rows':[]};var _0x1df244=_[_0x36c6('0x2c')](db[_0x36c6('0x2d')][_0x36c6('0x2e')],function(_0x27d433){return{'name':_0x27d433[_0x36c6('0x2f')],'type':_0x27d433[_0x36c6('0x30')][_0x36c6('0x31')]};});_0x4eae9a[_0x36c6('0x32')]=_[_0x36c6('0x2c')](_0x1df244,_0x36c6('0x2b'));_0x4eae9a[_0x36c6('0x33')]=_[_0x36c6('0x34')](_0x539d99['query']);_0x4eae9a[_0x36c6('0x35')]=_[_0x36c6('0x36')](_0x4eae9a['model'],_0x4eae9a[_0x36c6('0x33')]);_0x26f4d4[_0x36c6('0x37')]=_[_0x36c6('0x36')](_0x4eae9a['model'],qs['fields'](_0x539d99['query'][_0x36c6('0x38')]));_0x26f4d4[_0x36c6('0x37')]=_0x26f4d4[_0x36c6('0x37')][_0x36c6('0x39')]?_0x26f4d4[_0x36c6('0x37')]:_0x4eae9a[_0x36c6('0x32')];if(!_0x539d99[_0x36c6('0x33')][_0x36c6('0x3a')]('nolimit')){_0x26f4d4['limit']=qs[_0x36c6('0x21')](_0x539d99[_0x36c6('0x33')][_0x36c6('0x21')]);_0x26f4d4[_0x36c6('0x1f')]=qs['offset'](_0x539d99[_0x36c6('0x33')]['offset']);}_0x26f4d4[_0x36c6('0x3b')]=qs['sort'](_0x539d99[_0x36c6('0x33')][_0x36c6('0x3c')]);_0x26f4d4['where']=qs[_0x36c6('0x35')](_['pick'](_0x539d99[_0x36c6('0x33')],_0x4eae9a[_0x36c6('0x35')]),_0x1df244);if(_0x539d99[_0x36c6('0x33')][_0x36c6('0x3d')]){_0x26f4d4[_0x36c6('0x3e')]=_['merge'](_0x26f4d4[_0x36c6('0x3e')],{'$or':_['map'](_0x1df244,function(_0x271499){if(_0x271499[_0x36c6('0x30')]!=='VIRTUAL'){var _0x44c811={};_0x44c811[_0x271499[_0x36c6('0x2b')]]={'$like':'%'+_0x539d99[_0x36c6('0x33')]['filter']+'%'};return _0x44c811;}})});}_0x26f4d4=_['merge']({},_0x26f4d4,_0x539d99[_0x36c6('0x3f')]);var _0x2de4a9={'where':_0x26f4d4[_0x36c6('0x3e')]};return db[_0x36c6('0x2d')][_0x36c6('0x22')](_0x2de4a9)['then'](function(_0x356ef1){_0x50b21b[_0x36c6('0x22')]=_0x356ef1;if(_0x539d99[_0x36c6('0x33')]['includeAll']){_0x26f4d4[_0x36c6('0x40')]=[{'all':!![]}];}return db[_0x36c6('0x2d')]['findAll'](_0x26f4d4);})[_0x36c6('0x28')](function(_0x481ab8){_0x50b21b[_0x36c6('0x41')]=_0x481ab8;return _0x50b21b;})['then'](respondWithFilteredResult(_0x294c9b,_0x26f4d4))[_0x36c6('0x42')](handleError(_0x294c9b,null));};exports['show']=function(_0x535df0,_0x328fac){var _0x247574={'raw':!![],'where':{'id':_0x535df0[_0x36c6('0x43')]['id']}},_0x76c618={};_0x76c618[_0x36c6('0x32')]=_[_0x36c6('0x34')](db[_0x36c6('0x2d')][_0x36c6('0x2e')]);_0x76c618[_0x36c6('0x33')]=_['keys'](_0x535df0[_0x36c6('0x33')]);_0x76c618[_0x36c6('0x35')]=_[_0x36c6('0x36')](_0x76c618[_0x36c6('0x32')],_0x76c618[_0x36c6('0x33')]);_0x247574[_0x36c6('0x37')]=_[_0x36c6('0x36')](_0x76c618['model'],qs['fields'](_0x535df0[_0x36c6('0x33')][_0x36c6('0x38')]));_0x247574['attributes']=_0x247574['attributes'][_0x36c6('0x39')]?_0x247574[_0x36c6('0x37')]:_0x76c618[_0x36c6('0x32')];if(_0x535df0[_0x36c6('0x33')]['includeAll']){_0x247574['include']=[{'all':!![]}];}_0x247574=_[_0x36c6('0x44')]({},_0x247574,_0x535df0[_0x36c6('0x3f')]);return db[_0x36c6('0x2d')][_0x36c6('0x45')](_0x247574)['then'](handleEntityNotFound(_0x328fac,null))['then'](respondWithResult(_0x328fac,null))[_0x36c6('0x42')](handleError(_0x328fac,null));};exports[_0x36c6('0x46')]=function(_0x2c5024,_0x1fc75f){return db[_0x36c6('0x2d')][_0x36c6('0x46')](_0x2c5024[_0x36c6('0x47')],{})['then'](respondWithResult(_0x1fc75f,0xc9))[_0x36c6('0x42')](handleError(_0x1fc75f,null));};exports[_0x36c6('0x27')]=function(_0x46b982,_0xa940f){if(_0x46b982[_0x36c6('0x47')]['id']){delete _0x46b982[_0x36c6('0x47')]['id'];}return db[_0x36c6('0x2d')]['find']({'where':{'id':_0x46b982[_0x36c6('0x43')]['id']}})['then'](handleEntityNotFound(_0xa940f,null))[_0x36c6('0x28')](saveUpdates(_0x46b982['body'],null))[_0x36c6('0x28')](respondWithResult(_0xa940f,null))[_0x36c6('0x42')](handleError(_0xa940f,null));};exports[_0x36c6('0x29')]=function(_0xca6c8b,_0x5a2473){return db[_0x36c6('0x2d')][_0x36c6('0x45')]({'where':{'id':_0xca6c8b[_0x36c6('0x43')]['id']}})[_0x36c6('0x28')](handleEntityNotFound(_0x5a2473,null))[_0x36c6('0x28')](removeEntity(_0x5a2473,null))['catch'](handleError(_0x5a2473,null));};exports[_0x36c6('0x48')]=function(_0x512a85,_0x14751c){return db[_0x36c6('0x2d')]['describe']()[_0x36c6('0x28')](respondWithResult(_0x14751c,null))['catch'](handleError(_0x14751c,null));}; \ No newline at end of file +var _0x8868=['sox','fs-extra','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','FaxQueueReport','rawAttributes','fieldName','type','key','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','findAll','rows','catch','show','keys','includeAll','options','find','create','body','params','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x3073d6,_0xfb5ecd){var _0x4db147=function(_0x38f212){while(--_0x38f212){_0x3073d6['push'](_0x3073d6['shift']());}};_0x4db147(++_0xfb5ecd);}(_0x8868,0x1ca));var _0x8886=function(_0xf62d6c,_0x1cbb05){_0xf62d6c=_0xf62d6c-0x0;var _0x31ab1e=_0x8868[_0xf62d6c];return _0x31ab1e;};'use strict';var emlformat=require(_0x8886('0x0'));var rimraf=require(_0x8886('0x1'));var zipdir=require(_0x8886('0x2'));var jsonpatch=require(_0x8886('0x3'));var rp=require(_0x8886('0x4'));var moment=require(_0x8886('0x5'));var BPromise=require(_0x8886('0x6'));var Mustache=require(_0x8886('0x7'));var util=require(_0x8886('0x8'));var path=require(_0x8886('0x9'));var sox=require(_0x8886('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8886('0xb'));var _=require(_0x8886('0xc'));var squel=require('squel');var crypto=require(_0x8886('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x8886('0xe'));var toCsv=require(_0x8886('0xf'));var querystring=require(_0x8886('0x10'));var Papa=require(_0x8886('0x11'));var Redis=require(_0x8886('0x12'));var authService=require(_0x8886('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x8886('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8886('0x15'));var utils=require('../../config/utils');var config=require(_0x8886('0x16'));var licenseUtil=require(_0x8886('0x17'));var db=require(_0x8886('0x18'))['db'];function respondWithStatusCode(_0x2a154d,_0x54cbc9){_0x54cbc9=_0x54cbc9||0xcc;return function(_0x29fa59){if(_0x29fa59){return _0x2a154d[_0x8886('0x19')](_0x54cbc9);}return _0x2a154d['status'](_0x54cbc9)[_0x8886('0x1a')]();};}function respondWithResult(_0x5ef48a,_0x4a339){_0x4a339=_0x4a339||0xc8;return function(_0x1110fd){if(_0x1110fd){return _0x5ef48a[_0x8886('0x1b')](_0x4a339)[_0x8886('0x1c')](_0x1110fd);}};}function respondWithFilteredResult(_0x57e00c,_0x5b6f4b){return function(_0x31dad3){if(_0x31dad3){var _0x11905e=typeof _0x5b6f4b['offset']==='undefined'&&typeof _0x5b6f4b['limit']==='undefined';var _0x438f1a=_0x31dad3[_0x8886('0x1d')];var _0x1d47a6=_0x11905e?0x0:_0x5b6f4b[_0x8886('0x1e')];var _0xb13c62=_0x11905e?_0x31dad3[_0x8886('0x1d')]:_0x5b6f4b[_0x8886('0x1e')]+_0x5b6f4b[_0x8886('0x1f')];var _0xbf4367;if(_0xb13c62>=_0x438f1a){_0xb13c62=_0x438f1a;_0xbf4367=0xc8;}else{_0xbf4367=0xce;}_0x57e00c[_0x8886('0x1b')](_0xbf4367);return _0x57e00c[_0x8886('0x20')](_0x8886('0x21'),_0x1d47a6+'-'+_0xb13c62+'/'+_0x438f1a)[_0x8886('0x1c')](_0x31dad3);}return null;};}function patchUpdates(_0x19f0ef){return function(_0x5103f9){try{jsonpatch[_0x8886('0x22')](_0x5103f9,_0x19f0ef,!![]);}catch(_0x595f45){return BPromise[_0x8886('0x23')](_0x595f45);}return _0x5103f9[_0x8886('0x24')]();};}function saveUpdates(_0x48ec2e,_0x3894a0){return function(_0x17163e){if(_0x17163e){return _0x17163e[_0x8886('0x25')](_0x48ec2e)[_0x8886('0x26')](function(_0x19a78f){return _0x19a78f;});}return null;};}function removeEntity(_0x1c4485,_0x4d8d5e){return function(_0x3df299){if(_0x3df299){return _0x3df299['destroy']()[_0x8886('0x26')](function(){_0x1c4485[_0x8886('0x1b')](0xcc)[_0x8886('0x1a')]();});}};}function handleEntityNotFound(_0x48280f,_0x31e239){return function(_0x5b966b){if(!_0x5b966b){_0x48280f[_0x8886('0x19')](0x194);}return _0x5b966b;};}function handleError(_0x127fc9,_0x27ba7d){_0x27ba7d=_0x27ba7d||0x1f4;return function(_0x337007){logger[_0x8886('0x27')](_0x337007[_0x8886('0x28')]);if(_0x337007[_0x8886('0x29')]){delete _0x337007['name'];}_0x127fc9['status'](_0x27ba7d)[_0x8886('0x2a')](_0x337007);};}exports[_0x8886('0x2b')]=function(_0x4a37ca,_0xc02082){var _0x45b714={},_0x15cc33={},_0x4aa414={'count':0x0,'rows':[]};var _0x5084a4=_[_0x8886('0x2c')](db[_0x8886('0x2d')][_0x8886('0x2e')],function(_0x381bce){return{'name':_0x381bce[_0x8886('0x2f')],'type':_0x381bce[_0x8886('0x30')][_0x8886('0x31')]};});_0x15cc33['model']=_[_0x8886('0x2c')](_0x5084a4,_0x8886('0x29'));_0x15cc33[_0x8886('0x32')]=_['keys'](_0x4a37ca[_0x8886('0x32')]);_0x15cc33['filters']=_[_0x8886('0x33')](_0x15cc33[_0x8886('0x34')],_0x15cc33['query']);_0x45b714[_0x8886('0x35')]=_[_0x8886('0x33')](_0x15cc33[_0x8886('0x34')],qs[_0x8886('0x36')](_0x4a37ca[_0x8886('0x32')][_0x8886('0x36')]));_0x45b714[_0x8886('0x35')]=_0x45b714['attributes'][_0x8886('0x37')]?_0x45b714[_0x8886('0x35')]:_0x15cc33[_0x8886('0x34')];if(!_0x4a37ca[_0x8886('0x32')][_0x8886('0x38')](_0x8886('0x39'))){_0x45b714['limit']=qs[_0x8886('0x1f')](_0x4a37ca[_0x8886('0x32')][_0x8886('0x1f')]);_0x45b714[_0x8886('0x1e')]=qs[_0x8886('0x1e')](_0x4a37ca['query'][_0x8886('0x1e')]);}_0x45b714[_0x8886('0x3a')]=qs[_0x8886('0x3b')](_0x4a37ca[_0x8886('0x32')][_0x8886('0x3b')]);_0x45b714[_0x8886('0x3c')]=qs[_0x8886('0x3d')](_['pick'](_0x4a37ca[_0x8886('0x32')],_0x15cc33[_0x8886('0x3d')]),_0x5084a4);if(_0x4a37ca['query']['filter']){_0x45b714[_0x8886('0x3c')]=_[_0x8886('0x3e')](_0x45b714['where'],{'$or':_['map'](_0x5084a4,function(_0xed02f4){if(_0xed02f4[_0x8886('0x30')]!==_0x8886('0x3f')){var _0x2125cd={};_0x2125cd[_0xed02f4[_0x8886('0x29')]]={'$like':'%'+_0x4a37ca[_0x8886('0x32')][_0x8886('0x40')]+'%'};return _0x2125cd;}})});}_0x45b714=_[_0x8886('0x3e')]({},_0x45b714,_0x4a37ca['options']);var _0x21422b={'where':_0x45b714[_0x8886('0x3c')]};return db['FaxQueueReport'][_0x8886('0x1d')](_0x21422b)[_0x8886('0x26')](function(_0x5b03ea){_0x4aa414[_0x8886('0x1d')]=_0x5b03ea;if(_0x4a37ca[_0x8886('0x32')]['includeAll']){_0x45b714['include']=[{'all':!![]}];}return db['FaxQueueReport'][_0x8886('0x41')](_0x45b714);})[_0x8886('0x26')](function(_0x16d70c){_0x4aa414[_0x8886('0x42')]=_0x16d70c;return _0x4aa414;})[_0x8886('0x26')](respondWithFilteredResult(_0xc02082,_0x45b714))[_0x8886('0x43')](handleError(_0xc02082,null));};exports[_0x8886('0x44')]=function(_0x52dc2c,_0x56c006){var _0x524353={'raw':!![],'where':{'id':_0x52dc2c['params']['id']}},_0x59e3ba={};_0x59e3ba[_0x8886('0x34')]=_[_0x8886('0x45')](db[_0x8886('0x2d')][_0x8886('0x2e')]);_0x59e3ba[_0x8886('0x32')]=_[_0x8886('0x45')](_0x52dc2c[_0x8886('0x32')]);_0x59e3ba[_0x8886('0x3d')]=_['intersection'](_0x59e3ba[_0x8886('0x34')],_0x59e3ba[_0x8886('0x32')]);_0x524353[_0x8886('0x35')]=_[_0x8886('0x33')](_0x59e3ba[_0x8886('0x34')],qs['fields'](_0x52dc2c[_0x8886('0x32')]['fields']));_0x524353[_0x8886('0x35')]=_0x524353[_0x8886('0x35')][_0x8886('0x37')]?_0x524353[_0x8886('0x35')]:_0x59e3ba[_0x8886('0x34')];if(_0x52dc2c[_0x8886('0x32')][_0x8886('0x46')]){_0x524353['include']=[{'all':!![]}];}_0x524353=_['merge']({},_0x524353,_0x52dc2c[_0x8886('0x47')]);return db[_0x8886('0x2d')][_0x8886('0x48')](_0x524353)[_0x8886('0x26')](handleEntityNotFound(_0x56c006,null))[_0x8886('0x26')](respondWithResult(_0x56c006,null))[_0x8886('0x43')](handleError(_0x56c006,null));};exports[_0x8886('0x49')]=function(_0x445484,_0x40c34b){return db[_0x8886('0x2d')][_0x8886('0x49')](_0x445484[_0x8886('0x4a')],{})['then'](respondWithResult(_0x40c34b,0xc9))[_0x8886('0x43')](handleError(_0x40c34b,null));};exports[_0x8886('0x25')]=function(_0x2679bf,_0x5775ff){if(_0x2679bf[_0x8886('0x4a')]['id']){delete _0x2679bf[_0x8886('0x4a')]['id'];}return db[_0x8886('0x2d')]['find']({'where':{'id':_0x2679bf[_0x8886('0x4b')]['id']}})[_0x8886('0x26')](handleEntityNotFound(_0x5775ff,null))[_0x8886('0x26')](saveUpdates(_0x2679bf['body'],null))[_0x8886('0x26')](respondWithResult(_0x5775ff,null))['catch'](handleError(_0x5775ff,null));};exports[_0x8886('0x4c')]=function(_0x73cd93,_0x4ceb13){return db[_0x8886('0x2d')]['find']({'where':{'id':_0x73cd93['params']['id']}})[_0x8886('0x26')](handleEntityNotFound(_0x4ceb13,null))[_0x8886('0x26')](removeEntity(_0x4ceb13,null))[_0x8886('0x43')](handleError(_0x4ceb13,null));};exports[_0x8886('0x4d')]=function(_0x3e6f6d,_0x1062ba){return db['FaxQueueReport'][_0x8886('0x4d')]()[_0x8886('0x26')](respondWithResult(_0x1062ba,null))[_0x8886('0x43')](handleError(_0x1062ba,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 765d349..d3112fb 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(_0x5a0393,_0x47ad1b){var _0x584784=function(_0x5798b8){while(--_0x5798b8){_0x5a0393['push'](_0x5a0393['shift']());}};_0x584784(++_0x47ad1b);}(_0xf494,0x1c6));var _0x4f49=function(_0x5da9ab,_0x5b4956){_0x5da9ab=_0x5da9ab-0x0;var _0x441f9c=_0xf494[_0x5da9ab];return _0x441f9c;};'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 _0x7fbe=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','uniqueid','../../config/logger','api'];(function(_0x5714e5,_0x4df1a3){var _0xd3cae6=function(_0x5c06a5){while(--_0x5c06a5){_0x5714e5['push'](_0x5714e5['shift']());}};_0xd3cae6(++_0x4df1a3);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x3a3b9e,_0xc59037){_0x3a3b9e=_0x3a3b9e-0x0;var _0x148103=_0x7fbe[_0x3a3b9e];return _0x148103;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe7fb('0x0'))(_0xe7fb('0x1'));var moment=require(_0xe7fb('0x2'));var BPromise=require(_0xe7fb('0x3'));var rp=require(_0xe7fb('0x4'));var fs=require('fs');var path=require(_0xe7fb('0x5'));var rimraf=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var attributes=require(_0xe7fb('0x8'));module[_0xe7fb('0x9')]=function(_0x290172,_0x12d1b0){return _0x290172[_0xe7fb('0xa')](_0xe7fb('0xb'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0xe7fb('0xc'),'fields':[_0xe7fb('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 9aaacff..894d7c4 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 _0x7e13=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','catch','update','where','attributes','limit','UpdateFaxQueueReport','lodash','util','moment'];(function(_0x673722,_0x275d7e){var _0x21249c=function(_0x25b4e7){while(--_0x25b4e7){_0x673722['push'](_0x673722['shift']());}};_0x21249c(++_0x275d7e);}(_0x7e13,0x1c4));var _0x37e1=function(_0x986e33,_0x1f7cae){_0x986e33=_0x986e33-0x0;var _0x17257f=_0x7e13[_0x986e33];return _0x17257f;};'use strict';var _=require(_0x37e1('0x0'));var util=require(_0x37e1('0x1'));var moment=require(_0x37e1('0x2'));var BPromise=require(_0x37e1('0x3'));var rs=require(_0x37e1('0x4'));var fs=require('fs');var Redis=require(_0x37e1('0x5'));var db=require(_0x37e1('0x6'))['db'];var utils=require(_0x37e1('0x7'));var logger=require(_0x37e1('0x8'))(_0x37e1('0x9'));var config=require(_0x37e1('0xa'));var jayson=require(_0x37e1('0xb'));var client=jayson['client'][_0x37e1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1a1b3a,_0x4adafd,_0x29f4c4){return new BPromise(function(_0x5a9955,_0x438835){return client[_0x37e1('0xd')](_0x1a1b3a,_0x29f4c4)[_0x37e1('0xe')](function(_0x66506a){logger[_0x37e1('0xf')](_0x37e1('0x10'),_0x4adafd,_0x37e1('0x11'));logger[_0x37e1('0x12')](_0x37e1('0x13'),_0x4adafd,_0x37e1('0x11'),JSON[_0x37e1('0x14')](_0x66506a));if(_0x66506a[_0x37e1('0x15')]){if(_0x66506a['error']['code']===0x1f4){logger[_0x37e1('0x15')]('FaxQueueReport,\x20%s,\x20%s',_0x4adafd,_0x66506a[_0x37e1('0x15')][_0x37e1('0x16')]);return _0x438835(_0x66506a['error'][_0x37e1('0x16')]);}logger[_0x37e1('0x15')](_0x37e1('0x10'),_0x4adafd,_0x66506a[_0x37e1('0x15')][_0x37e1('0x16')]);return _0x5a9955(_0x66506a[_0x37e1('0x15')][_0x37e1('0x16')]);}else{logger[_0x37e1('0xf')](_0x37e1('0x10'),_0x4adafd,_0x37e1('0x11'));_0x5a9955(_0x66506a['result'][_0x37e1('0x16')]);}})['catch'](function(_0x561499){logger[_0x37e1('0x15')](_0x37e1('0x10'),_0x4adafd,_0x561499);_0x438835(_0x561499);});});}exports[_0x37e1('0x17')]=function(_0x134249){var _0x183ae4=this;return new Promise(function(_0x9de87c,_0x146992){return db[_0x37e1('0x18')][_0x37e1('0x19')](_0x134249[_0x37e1('0x1a')],{'raw':_0x134249[_0x37e1('0x1b')]?_0x134249[_0x37e1('0x1b')][_0x37e1('0x1c')]===undefined?!![]:![]:!![]})[_0x37e1('0xe')](function(_0x233287){logger['info'](_0x37e1('0x17'),_0x134249);logger[_0x37e1('0x12')](_0x37e1('0x17'),_0x134249,JSON[_0x37e1('0x14')](_0x233287));_0x9de87c(_0x233287);})[_0x37e1('0x1d')](function(_0x5e989a){logger[_0x37e1('0x15')](_0x37e1('0x17'),_0x5e989a[_0x37e1('0x16')],_0x134249);_0x146992(_0x183ae4[_0x37e1('0x15')](0x1f4,_0x5e989a[_0x37e1('0x16')]));});});};exports['UpdateFaxQueueReport']=function(_0x53fe3e){var _0x4330d9=this;return new Promise(function(_0x67d9f7,_0x30cfb3){return db[_0x37e1('0x18')][_0x37e1('0x1e')](_0x53fe3e[_0x37e1('0x1a')],{'raw':_0x53fe3e['options']?_0x53fe3e[_0x37e1('0x1b')][_0x37e1('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x53fe3e['options']?_0x53fe3e[_0x37e1('0x1b')][_0x37e1('0x1f')]||null:null,'attributes':_0x53fe3e['options']?_0x53fe3e[_0x37e1('0x1b')][_0x37e1('0x20')]||null:null,'limit':_0x53fe3e[_0x37e1('0x1b')]?_0x53fe3e['options'][_0x37e1('0x21')]||null:null})[_0x37e1('0xe')](function(_0x3b4211){logger['info'](_0x37e1('0x22'),_0x53fe3e);logger[_0x37e1('0x12')]('UpdateFaxQueueReport',_0x53fe3e,JSON['stringify'](_0x3b4211));_0x67d9f7(_0x3b4211);})['catch'](function(_0x2cb38e){logger[_0x37e1('0x15')](_0x37e1('0x22'),_0x2cb38e[_0x37e1('0x16')],_0x53fe3e);_0x30cfb3(_0x4330d9[_0x37e1('0x15')](0x1f4,_0x2cb38e[_0x37e1('0x16')]));});});}; \ No newline at end of file +var _0x9c82=['debug','catch','UpdateFaxQueueReport','update','where','attributes','limit','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','CreateFaxQueueReport','FaxQueueReport','body','options','raw'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x9c82,0xe0));var _0x29c8=function(_0x2ec7e6,_0x3c0eed){_0x2ec7e6=_0x2ec7e6-0x0;var _0x3778c1=_0x9c82[_0x2ec7e6];return _0x3778c1;};'use strict';var _=require(_0x29c8('0x0'));var util=require(_0x29c8('0x1'));var moment=require(_0x29c8('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x29c8('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x29c8('0x4'));var logger=require(_0x29c8('0x5'))(_0x29c8('0x6'));var config=require(_0x29c8('0x7'));var jayson=require(_0x29c8('0x8'));var client=jayson[_0x29c8('0x9')][_0x29c8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b5e22,_0x1630f3,_0xf0ac9e){return new BPromise(function(_0x3b24b5,_0xf4706f){return client[_0x29c8('0xb')](_0x2b5e22,_0xf0ac9e)[_0x29c8('0xc')](function(_0x32bda5){logger[_0x29c8('0xd')](_0x29c8('0xe'),_0x1630f3,_0x29c8('0xf'));logger['debug']('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x1630f3,_0x29c8('0xf'),JSON[_0x29c8('0x10')](_0x32bda5));if(_0x32bda5[_0x29c8('0x11')]){if(_0x32bda5[_0x29c8('0x11')]['code']===0x1f4){logger[_0x29c8('0x11')](_0x29c8('0xe'),_0x1630f3,_0x32bda5[_0x29c8('0x11')]['message']);return _0xf4706f(_0x32bda5['error'][_0x29c8('0x12')]);}logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x1630f3,_0x32bda5[_0x29c8('0x11')][_0x29c8('0x12')]);return _0x3b24b5(_0x32bda5[_0x29c8('0x11')]['message']);}else{logger[_0x29c8('0xd')]('FaxQueueReport,\x20%s,\x20%s',_0x1630f3,_0x29c8('0xf'));_0x3b24b5(_0x32bda5['result']['message']);}})['catch'](function(_0x214133){logger['error'](_0x29c8('0xe'),_0x1630f3,_0x214133);_0xf4706f(_0x214133);});});}exports[_0x29c8('0x13')]=function(_0x3be284){var _0x4b6adf=this;return new Promise(function(_0x59d8fb,_0x2142bd){return db[_0x29c8('0x14')]['create'](_0x3be284[_0x29c8('0x15')],{'raw':_0x3be284[_0x29c8('0x16')]?_0x3be284['options'][_0x29c8('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0xf76fb5){logger[_0x29c8('0xd')](_0x29c8('0x13'),_0x3be284);logger[_0x29c8('0x18')](_0x29c8('0x13'),_0x3be284,JSON[_0x29c8('0x10')](_0xf76fb5));_0x59d8fb(_0xf76fb5);})[_0x29c8('0x19')](function(_0x1efff5){logger[_0x29c8('0x11')](_0x29c8('0x13'),_0x1efff5[_0x29c8('0x12')],_0x3be284);_0x2142bd(_0x4b6adf['error'](0x1f4,_0x1efff5['message']));});});};exports[_0x29c8('0x1a')]=function(_0x356cb3){var _0x317be3=this;return new Promise(function(_0xd3adbc,_0xe95a00){return db['FaxQueueReport'][_0x29c8('0x1b')](_0x356cb3['body'],{'raw':_0x356cb3[_0x29c8('0x16')]?_0x356cb3['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x356cb3['options']?_0x356cb3[_0x29c8('0x16')][_0x29c8('0x1c')]||null:null,'attributes':_0x356cb3[_0x29c8('0x16')]?_0x356cb3[_0x29c8('0x16')][_0x29c8('0x1d')]||null:null,'limit':_0x356cb3[_0x29c8('0x16')]?_0x356cb3[_0x29c8('0x16')][_0x29c8('0x1e')]||null:null})['then'](function(_0x18af1c){logger['info'](_0x29c8('0x1a'),_0x356cb3);logger[_0x29c8('0x18')](_0x29c8('0x1a'),_0x356cb3,JSON[_0x29c8('0x10')](_0x18af1c));_0xd3adbc(_0x18af1c);})[_0x29c8('0x19')](function(_0x5f2851){logger[_0x29c8('0x11')](_0x29c8('0x1a'),_0x5f2851[_0x29c8('0x12')],_0x356cb3);_0xe95a00(_0x317be3[_0x29c8('0x11')](0x1f4,_0x5f2851[_0x29c8('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 250c48f..7178d98 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 _0x451c=['/:id','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./faxQueueReport.controller','get','isAuthenticated','index','/describe'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x451c,0x16f));var _0xc451=function(_0x426799,_0x21a06b){_0x426799=_0x426799-0x0;var _0xf6741e=_0x451c[_0x426799];return _0xf6741e;};'use strict';var multer=require(_0xc451('0x0'));var util=require(_0xc451('0x1'));var path=require(_0xc451('0x2'));var timeout=require(_0xc451('0x3'));var express=require(_0xc451('0x4'));var router=express[_0xc451('0x5')]();var fs_extra=require(_0xc451('0x6'));var auth=require(_0xc451('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc451('0x8'));router[_0xc451('0x9')]('/',auth[_0xc451('0xa')](),controller[_0xc451('0xb')]);router['get'](_0xc451('0xc'),auth[_0xc451('0xa')](),controller['describe']);router[_0xc451('0x9')](_0xc451('0xd'),auth[_0xc451('0xa')](),controller['show']);router[_0xc451('0xe')]('/',auth['isAuthenticated'](),controller[_0xc451('0xf')]);router[_0xc451('0x10')](_0xc451('0xd'),auth[_0xc451('0xa')](),controller['update']);router[_0xc451('0x11')](_0xc451('0xd'),auth[_0xc451('0xa')](),controller[_0xc451('0x12')]);module[_0xc451('0x13')]=router; \ No newline at end of file +var _0x45f5=['Router','fs-extra','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','index','get','/describe','isAuthenticated','describe','/:id','post','create','update','delete','destroy','exports','util','connect-timeout','express'];(function(_0x56cd58,_0x47f4af){var _0x120f45=function(_0x149e7a){while(--_0x149e7a){_0x56cd58['push'](_0x56cd58['shift']());}};_0x120f45(++_0x47f4af);}(_0x45f5,0x1a1));var _0x545f=function(_0x5a8315,_0x9ef47d){_0x5a8315=_0x5a8315-0x0;var _0x5cc037=_0x45f5[_0x5a8315];return _0x5cc037;};'use strict';var multer=require('multer');var util=require(_0x545f('0x0'));var path=require('path');var timeout=require(_0x545f('0x1'));var express=require(_0x545f('0x2'));var router=express[_0x545f('0x3')]();var fs_extra=require(_0x545f('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x545f('0x5'));var config=require(_0x545f('0x6'));var controller=require(_0x545f('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x545f('0x8')]);router[_0x545f('0x9')](_0x545f('0xa'),auth[_0x545f('0xb')](),controller[_0x545f('0xc')]);router[_0x545f('0x9')](_0x545f('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x545f('0xe')]('/',auth[_0x545f('0xb')](),controller[_0x545f('0xf')]);router['put'](_0x545f('0xd'),auth[_0x545f('0xb')](),controller[_0x545f('0x10')]);router[_0x545f('0x11')](_0x545f('0xd'),auth[_0x545f('0xb')](),controller[_0x545f('0x12')]);module[_0x545f('0x13')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 87bf28b..6d61128 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 _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x3ceb54,_0x5bddfd){var _0x26d8a6=function(_0x32e484){while(--_0x32e484){_0x3ceb54['push'](_0x3ceb54['shift']());}};_0x26d8a6(++_0x5bddfd);}(_0x9bde,0xe1));var _0xe9bd=function(_0x2e2a76,_0x30e8bd){_0x2e2a76=_0x2e2a76-0x0;var _0x444ccc=_0x9bde[_0x2e2a76];return _0x444ccc;};'use strict';var moment=require('moment');var Sequelize=require(_0xe9bd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe9bd('0x2'),_0xe9bd('0x3'),_0xe9bd('0x4')),'allowNull':![],'defaultValue':_0xe9bd('0x4')},'transferredAt':{'type':Sequelize[_0xe9bd('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xe9bd('0x6')]}}; \ No newline at end of file +var _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x318410,_0x451962){var _0x2898a3=function(_0x58e572){while(--_0x58e572){_0x318410['push'](_0x318410['shift']());}};_0x2898a3(++_0x451962);}(_0xb43b,0x1b2));var _0xbb43=function(_0x8f9306,_0x59ac79){_0x8f9306=_0x8f9306-0x0;var _0x4fd32e=_0xb43b[_0x8f9306];return _0x4fd32e;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index b45452e..c6b53dc 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 _0x81a7=['length','includeAll','body','update','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','then','destroy','sendStatus','error','stack','name','send','map','FaxTransferReport','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch'];(function(_0x2f3419,_0x412c79){var _0x7e8c61=function(_0x4d6a3e){while(--_0x4d6a3e){_0x2f3419['push'](_0x2f3419['shift']());}};_0x7e8c61(++_0x412c79);}(_0x81a7,0xa9));var _0x781a=function(_0x3c7714,_0x3e96ee){_0x3c7714=_0x3c7714-0x0;var _0x384ef8=_0x81a7[_0x3c7714];return _0x384ef8;};'use strict';var emlformat=require(_0x781a('0x0'));var rimraf=require(_0x781a('0x1'));var zipdir=require(_0x781a('0x2'));var jsonpatch=require(_0x781a('0x3'));var rp=require(_0x781a('0x4'));var moment=require(_0x781a('0x5'));var BPromise=require(_0x781a('0x6'));var Mustache=require('mustache');var util=require(_0x781a('0x7'));var path=require(_0x781a('0x8'));var sox=require(_0x781a('0x9'));var csv=require('to-csv');var ejs=require(_0x781a('0xa'));var fs=require('fs');var fs_extra=require(_0x781a('0xb'));var _=require('lodash');var squel=require(_0x781a('0xc'));var crypto=require(_0x781a('0xd'));var jsforce=require(_0x781a('0xe'));var deskjs=require(_0x781a('0xf'));var toCsv=require(_0x781a('0x10'));var querystring=require(_0x781a('0x11'));var Papa=require(_0x781a('0x12'));var Redis=require(_0x781a('0x13'));var authService=require(_0x781a('0x14'));var qs=require(_0x781a('0x15'));var as=require(_0x781a('0x16'));var hardwareService=require(_0x781a('0x17'));var logger=require(_0x781a('0x18'))(_0x781a('0x19'));var utils=require(_0x781a('0x1a'));var config=require(_0x781a('0x1b'));var licenseUtil=require(_0x781a('0x1c'));var db=require(_0x781a('0x1d'))['db'];function respondWithStatusCode(_0x66c2d5,_0x3341a1){_0x3341a1=_0x3341a1||0xcc;return function(_0x22c29d){if(_0x22c29d){return _0x66c2d5['sendStatus'](_0x3341a1);}return _0x66c2d5[_0x781a('0x1e')](_0x3341a1)[_0x781a('0x1f')]();};}function respondWithResult(_0x50b9ae,_0x4c4f78){_0x4c4f78=_0x4c4f78||0xc8;return function(_0x458ed6){if(_0x458ed6){return _0x50b9ae[_0x781a('0x1e')](_0x4c4f78)[_0x781a('0x20')](_0x458ed6);}};}function respondWithFilteredResult(_0x1bd016,_0x555f3b){return function(_0x2e54fd){if(_0x2e54fd){var _0x5dae41=typeof _0x555f3b[_0x781a('0x21')]==='undefined'&&typeof _0x555f3b[_0x781a('0x22')]===_0x781a('0x23');var _0x22a459=_0x2e54fd['count'];var _0x716abb=_0x5dae41?0x0:_0x555f3b[_0x781a('0x21')];var _0x1add27=_0x5dae41?_0x2e54fd[_0x781a('0x24')]:_0x555f3b['offset']+_0x555f3b[_0x781a('0x22')];var _0x3e68c6;if(_0x1add27>=_0x22a459){_0x1add27=_0x22a459;_0x3e68c6=0xc8;}else{_0x3e68c6=0xce;}_0x1bd016['status'](_0x3e68c6);return _0x1bd016[_0x781a('0x25')](_0x781a('0x26'),_0x716abb+'-'+_0x1add27+'/'+_0x22a459)['json'](_0x2e54fd);}return null;};}function patchUpdates(_0x147dff){return function(_0x579e83){try{jsonpatch['apply'](_0x579e83,_0x147dff,!![]);}catch(_0x48f1f5){return BPromise[_0x781a('0x27')](_0x48f1f5);}return _0x579e83[_0x781a('0x28')]();};}function saveUpdates(_0x394d24,_0xe6972){return function(_0x43c956){if(_0x43c956){return _0x43c956['update'](_0x394d24)[_0x781a('0x29')](function(_0x596b54){return _0x596b54;});}return null;};}function removeEntity(_0x5590a7,_0x359be2){return function(_0x3de4cb){if(_0x3de4cb){return _0x3de4cb[_0x781a('0x2a')]()[_0x781a('0x29')](function(){_0x5590a7['status'](0xcc)[_0x781a('0x1f')]();});}};}function handleEntityNotFound(_0x59a80b,_0x369b21){return function(_0x12cacb){if(!_0x12cacb){_0x59a80b[_0x781a('0x2b')](0x194);}return _0x12cacb;};}function handleError(_0x5aa235,_0x478dfd){_0x478dfd=_0x478dfd||0x1f4;return function(_0x3daf6e){logger[_0x781a('0x2c')](_0x3daf6e[_0x781a('0x2d')]);if(_0x3daf6e['name']){delete _0x3daf6e[_0x781a('0x2e')];}_0x5aa235[_0x781a('0x1e')](_0x478dfd)[_0x781a('0x2f')](_0x3daf6e);};}exports['index']=function(_0xc00205,_0x17869e){var _0x53deba={},_0x308a05={},_0x13f928={'count':0x0,'rows':[]};var _0x29e8e0=_[_0x781a('0x30')](db[_0x781a('0x31')][_0x781a('0x32')],function(_0x28b958){return{'name':_0x28b958[_0x781a('0x33')],'type':_0x28b958['type'][_0x781a('0x34')]};});_0x308a05['model']=_['map'](_0x29e8e0,_0x781a('0x2e'));_0x308a05[_0x781a('0x35')]=_[_0x781a('0x36')](_0xc00205[_0x781a('0x35')]);_0x308a05['filters']=_[_0x781a('0x37')](_0x308a05[_0x781a('0x38')],_0x308a05[_0x781a('0x35')]);_0x53deba[_0x781a('0x39')]=_[_0x781a('0x37')](_0x308a05[_0x781a('0x38')],qs[_0x781a('0x3a')](_0xc00205[_0x781a('0x35')][_0x781a('0x3a')]));_0x53deba['attributes']=_0x53deba[_0x781a('0x39')]['length']?_0x53deba['attributes']:_0x308a05[_0x781a('0x38')];if(!_0xc00205[_0x781a('0x35')][_0x781a('0x3b')]('nolimit')){_0x53deba[_0x781a('0x22')]=qs[_0x781a('0x22')](_0xc00205[_0x781a('0x35')]['limit']);_0x53deba[_0x781a('0x21')]=qs['offset'](_0xc00205[_0x781a('0x35')][_0x781a('0x21')]);}_0x53deba[_0x781a('0x3c')]=qs['sort'](_0xc00205[_0x781a('0x35')][_0x781a('0x3d')]);_0x53deba[_0x781a('0x3e')]=qs[_0x781a('0x3f')](_[_0x781a('0x40')](_0xc00205[_0x781a('0x35')],_0x308a05[_0x781a('0x3f')]),_0x29e8e0);if(_0xc00205[_0x781a('0x35')][_0x781a('0x41')]){_0x53deba[_0x781a('0x3e')]=_[_0x781a('0x42')](_0x53deba[_0x781a('0x3e')],{'$or':_[_0x781a('0x30')](_0x29e8e0,function(_0xf0d9c8){if(_0xf0d9c8[_0x781a('0x43')]!==_0x781a('0x44')){var _0x24f5f2={};_0x24f5f2[_0xf0d9c8[_0x781a('0x2e')]]={'$like':'%'+_0xc00205['query']['filter']+'%'};return _0x24f5f2;}})});}_0x53deba=_[_0x781a('0x42')]({},_0x53deba,_0xc00205[_0x781a('0x45')]);var _0x1417e0={'where':_0x53deba[_0x781a('0x3e')]};return db[_0x781a('0x31')]['count'](_0x1417e0)['then'](function(_0xe57b4){_0x13f928[_0x781a('0x24')]=_0xe57b4;if(_0xc00205[_0x781a('0x35')]['includeAll']){_0x53deba[_0x781a('0x46')]=[{'all':!![]}];}return db[_0x781a('0x31')][_0x781a('0x47')](_0x53deba);})[_0x781a('0x29')](function(_0x32731a){_0x13f928[_0x781a('0x48')]=_0x32731a;return _0x13f928;})[_0x781a('0x29')](respondWithFilteredResult(_0x17869e,_0x53deba))[_0x781a('0x49')](handleError(_0x17869e,null));};exports['show']=function(_0x4b1386,_0xab1552){var _0x340bd8={'raw':!![],'where':{'id':_0x4b1386['params']['id']}},_0x4b8369={};_0x4b8369['model']=_[_0x781a('0x36')](db['FaxTransferReport']['rawAttributes']);_0x4b8369[_0x781a('0x35')]=_[_0x781a('0x36')](_0x4b1386['query']);_0x4b8369[_0x781a('0x3f')]=_[_0x781a('0x37')](_0x4b8369[_0x781a('0x38')],_0x4b8369[_0x781a('0x35')]);_0x340bd8[_0x781a('0x39')]=_[_0x781a('0x37')](_0x4b8369[_0x781a('0x38')],qs[_0x781a('0x3a')](_0x4b1386[_0x781a('0x35')][_0x781a('0x3a')]));_0x340bd8[_0x781a('0x39')]=_0x340bd8[_0x781a('0x39')][_0x781a('0x4a')]?_0x340bd8[_0x781a('0x39')]:_0x4b8369['model'];if(_0x4b1386[_0x781a('0x35')][_0x781a('0x4b')]){_0x340bd8[_0x781a('0x46')]=[{'all':!![]}];}_0x340bd8=_['merge']({},_0x340bd8,_0x4b1386[_0x781a('0x45')]);return db[_0x781a('0x31')]['find'](_0x340bd8)['then'](handleEntityNotFound(_0xab1552,null))['then'](respondWithResult(_0xab1552,null))[_0x781a('0x49')](handleError(_0xab1552,null));};exports['create']=function(_0x1d08bd,_0x362f70){return db['FaxTransferReport']['create'](_0x1d08bd[_0x781a('0x4c')],{})[_0x781a('0x29')](respondWithResult(_0x362f70,0xc9))[_0x781a('0x49')](handleError(_0x362f70,null));};exports[_0x781a('0x4d')]=function(_0x7e50d8,_0x2c3928){if(_0x7e50d8[_0x781a('0x4c')]['id']){delete _0x7e50d8['body']['id'];}return db[_0x781a('0x31')][_0x781a('0x4e')]({'where':{'id':_0x7e50d8[_0x781a('0x4f')]['id']}})['then'](handleEntityNotFound(_0x2c3928,null))[_0x781a('0x29')](saveUpdates(_0x7e50d8[_0x781a('0x4c')],null))[_0x781a('0x29')](respondWithResult(_0x2c3928,null))[_0x781a('0x49')](handleError(_0x2c3928,null));};exports[_0x781a('0x2a')]=function(_0x18b55c,_0x3364ee){return db[_0x781a('0x31')][_0x781a('0x4e')]({'where':{'id':_0x18b55c['params']['id']}})[_0x781a('0x29')](handleEntityNotFound(_0x3364ee,null))['then'](removeEntity(_0x3364ee,null))[_0x781a('0x49')](handleError(_0x3364ee,null));};exports[_0x781a('0x50')]=function(_0x30eb13,_0x38024e){return db[_0x781a('0x31')][_0x781a('0x50')]()[_0x781a('0x29')](respondWithResult(_0x38024e,null))[_0x781a('0x49')](handleError(_0x38024e,null));}; \ No newline at end of file +var _0x6e30=['VIRTUAL','merge','options','include','FaxTransferReport','findAll','rows','params','keys','length','includeAll','find','create','body','catch','describe','request-promise','moment','bluebird','mustache','util','path','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/environment','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter'];(function(_0x2810e2,_0xd60346){var _0x25b010=function(_0xf69d54){while(--_0xf69d54){_0x2810e2['push'](_0x2810e2['shift']());}};_0x25b010(++_0xd60346);}(_0x6e30,0x1d2));var _0x06e3=function(_0x31a938,_0x4daec6){_0x31a938=_0x31a938-0x0;var _0x1bf341=_0x6e30[_0x31a938];return _0x1bf341;};'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(_0x06e3('0x0'));var moment=require(_0x06e3('0x1'));var BPromise=require(_0x06e3('0x2'));var Mustache=require(_0x06e3('0x3'));var util=require(_0x06e3('0x4'));var path=require(_0x06e3('0x5'));var sox=require('sox');var csv=require(_0x06e3('0x6'));var ejs=require(_0x06e3('0x7'));var fs=require('fs');var fs_extra=require(_0x06e3('0x8'));var _=require(_0x06e3('0x9'));var squel=require(_0x06e3('0xa'));var crypto=require(_0x06e3('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x06e3('0xc'));var toCsv=require(_0x06e3('0x6'));var querystring=require(_0x06e3('0xd'));var Papa=require(_0x06e3('0xe'));var Redis=require(_0x06e3('0xf'));var authService=require(_0x06e3('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x06e3('0x11'));var hardwareService=require(_0x06e3('0x12'));var logger=require(_0x06e3('0x13'))(_0x06e3('0x14'));var utils=require('../../config/utils');var config=require(_0x06e3('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x554eb3,_0xe7b33a){_0xe7b33a=_0xe7b33a||0xcc;return function(_0x85ef37){if(_0x85ef37){return _0x554eb3[_0x06e3('0x16')](_0xe7b33a);}return _0x554eb3[_0x06e3('0x17')](_0xe7b33a)[_0x06e3('0x18')]();};}function respondWithResult(_0x435ee9,_0x3f5d10){_0x3f5d10=_0x3f5d10||0xc8;return function(_0x35420f){if(_0x35420f){return _0x435ee9[_0x06e3('0x17')](_0x3f5d10)[_0x06e3('0x19')](_0x35420f);}};}function respondWithFilteredResult(_0x89cecc,_0x24b081){return function(_0x4c41e2){if(_0x4c41e2){var _0x44722c=typeof _0x24b081['offset']===_0x06e3('0x1a')&&typeof _0x24b081[_0x06e3('0x1b')]===_0x06e3('0x1a');var _0x2a4ef5=_0x4c41e2[_0x06e3('0x1c')];var _0x30991d=_0x44722c?0x0:_0x24b081['offset'];var _0x135050=_0x44722c?_0x4c41e2[_0x06e3('0x1c')]:_0x24b081[_0x06e3('0x1d')]+_0x24b081['limit'];var _0x43d013;if(_0x135050>=_0x2a4ef5){_0x135050=_0x2a4ef5;_0x43d013=0xc8;}else{_0x43d013=0xce;}_0x89cecc[_0x06e3('0x17')](_0x43d013);return _0x89cecc[_0x06e3('0x1e')]('Content-Range',_0x30991d+'-'+_0x135050+'/'+_0x2a4ef5)[_0x06e3('0x19')](_0x4c41e2);}return null;};}function patchUpdates(_0x4e573b){return function(_0x439184){try{jsonpatch[_0x06e3('0x1f')](_0x439184,_0x4e573b,!![]);}catch(_0x468595){return BPromise[_0x06e3('0x20')](_0x468595);}return _0x439184[_0x06e3('0x21')]();};}function saveUpdates(_0x4dbb1b,_0x4f0ad2){return function(_0x39501e){if(_0x39501e){return _0x39501e[_0x06e3('0x22')](_0x4dbb1b)[_0x06e3('0x23')](function(_0x36efb1){return _0x36efb1;});}return null;};}function removeEntity(_0x11438e,_0xd09128){return function(_0x282985){if(_0x282985){return _0x282985[_0x06e3('0x24')]()[_0x06e3('0x23')](function(){_0x11438e[_0x06e3('0x17')](0xcc)[_0x06e3('0x18')]();});}};}function handleEntityNotFound(_0x3f157a,_0x5137e2){return function(_0x3a6cf8){if(!_0x3a6cf8){_0x3f157a[_0x06e3('0x16')](0x194);}return _0x3a6cf8;};}function handleError(_0x2a5003,_0x46a308){_0x46a308=_0x46a308||0x1f4;return function(_0x35dc6b){logger[_0x06e3('0x25')](_0x35dc6b[_0x06e3('0x26')]);if(_0x35dc6b[_0x06e3('0x27')]){delete _0x35dc6b['name'];}_0x2a5003[_0x06e3('0x17')](_0x46a308)[_0x06e3('0x28')](_0x35dc6b);};}exports[_0x06e3('0x29')]=function(_0x1b0697,_0x5c69f6){var _0x1f127d={},_0x14756e={},_0x19ec80={'count':0x0,'rows':[]};var _0xe275b=_[_0x06e3('0x2a')](db['FaxTransferReport'][_0x06e3('0x2b')],function(_0x11e718){return{'name':_0x11e718[_0x06e3('0x2c')],'type':_0x11e718[_0x06e3('0x2d')][_0x06e3('0x2e')]};});_0x14756e[_0x06e3('0x2f')]=_[_0x06e3('0x2a')](_0xe275b,'name');_0x14756e['query']=_['keys'](_0x1b0697[_0x06e3('0x30')]);_0x14756e[_0x06e3('0x31')]=_[_0x06e3('0x32')](_0x14756e[_0x06e3('0x2f')],_0x14756e[_0x06e3('0x30')]);_0x1f127d[_0x06e3('0x33')]=_['intersection'](_0x14756e['model'],qs[_0x06e3('0x34')](_0x1b0697[_0x06e3('0x30')][_0x06e3('0x34')]));_0x1f127d[_0x06e3('0x33')]=_0x1f127d[_0x06e3('0x33')]['length']?_0x1f127d['attributes']:_0x14756e[_0x06e3('0x2f')];if(!_0x1b0697[_0x06e3('0x30')][_0x06e3('0x35')](_0x06e3('0x36'))){_0x1f127d[_0x06e3('0x1b')]=qs[_0x06e3('0x1b')](_0x1b0697['query'][_0x06e3('0x1b')]);_0x1f127d['offset']=qs[_0x06e3('0x1d')](_0x1b0697[_0x06e3('0x30')][_0x06e3('0x1d')]);}_0x1f127d['order']=qs['sort'](_0x1b0697[_0x06e3('0x30')][_0x06e3('0x37')]);_0x1f127d[_0x06e3('0x38')]=qs[_0x06e3('0x31')](_[_0x06e3('0x39')](_0x1b0697[_0x06e3('0x30')],_0x14756e[_0x06e3('0x31')]),_0xe275b);if(_0x1b0697[_0x06e3('0x30')][_0x06e3('0x3a')]){_0x1f127d[_0x06e3('0x38')]=_['merge'](_0x1f127d[_0x06e3('0x38')],{'$or':_[_0x06e3('0x2a')](_0xe275b,function(_0x330a07){if(_0x330a07['type']!==_0x06e3('0x3b')){var _0x421cce={};_0x421cce[_0x330a07[_0x06e3('0x27')]]={'$like':'%'+_0x1b0697[_0x06e3('0x30')][_0x06e3('0x3a')]+'%'};return _0x421cce;}})});}_0x1f127d=_[_0x06e3('0x3c')]({},_0x1f127d,_0x1b0697[_0x06e3('0x3d')]);var _0x2a10b3={'where':_0x1f127d['where']};return db['FaxTransferReport']['count'](_0x2a10b3)['then'](function(_0x2675ec){_0x19ec80[_0x06e3('0x1c')]=_0x2675ec;if(_0x1b0697['query']['includeAll']){_0x1f127d[_0x06e3('0x3e')]=[{'all':!![]}];}return db[_0x06e3('0x3f')][_0x06e3('0x40')](_0x1f127d);})[_0x06e3('0x23')](function(_0x22a025){_0x19ec80[_0x06e3('0x41')]=_0x22a025;return _0x19ec80;})[_0x06e3('0x23')](respondWithFilteredResult(_0x5c69f6,_0x1f127d))['catch'](handleError(_0x5c69f6,null));};exports['show']=function(_0x547535,_0x2fadc0){var _0x4c4ef7={'raw':!![],'where':{'id':_0x547535[_0x06e3('0x42')]['id']}},_0x2a539a={};_0x2a539a[_0x06e3('0x2f')]=_['keys'](db[_0x06e3('0x3f')][_0x06e3('0x2b')]);_0x2a539a[_0x06e3('0x30')]=_[_0x06e3('0x43')](_0x547535[_0x06e3('0x30')]);_0x2a539a[_0x06e3('0x31')]=_[_0x06e3('0x32')](_0x2a539a[_0x06e3('0x2f')],_0x2a539a[_0x06e3('0x30')]);_0x4c4ef7[_0x06e3('0x33')]=_[_0x06e3('0x32')](_0x2a539a['model'],qs[_0x06e3('0x34')](_0x547535[_0x06e3('0x30')][_0x06e3('0x34')]));_0x4c4ef7[_0x06e3('0x33')]=_0x4c4ef7['attributes'][_0x06e3('0x44')]?_0x4c4ef7[_0x06e3('0x33')]:_0x2a539a[_0x06e3('0x2f')];if(_0x547535[_0x06e3('0x30')][_0x06e3('0x45')]){_0x4c4ef7[_0x06e3('0x3e')]=[{'all':!![]}];}_0x4c4ef7=_[_0x06e3('0x3c')]({},_0x4c4ef7,_0x547535[_0x06e3('0x3d')]);return db[_0x06e3('0x3f')][_0x06e3('0x46')](_0x4c4ef7)['then'](handleEntityNotFound(_0x2fadc0,null))[_0x06e3('0x23')](respondWithResult(_0x2fadc0,null))['catch'](handleError(_0x2fadc0,null));};exports[_0x06e3('0x47')]=function(_0x5802dd,_0x128b0c){return db[_0x06e3('0x3f')][_0x06e3('0x47')](_0x5802dd[_0x06e3('0x48')],{})[_0x06e3('0x23')](respondWithResult(_0x128b0c,0xc9))[_0x06e3('0x49')](handleError(_0x128b0c,null));};exports[_0x06e3('0x22')]=function(_0x4a7dd8,_0xf37a24){if(_0x4a7dd8[_0x06e3('0x48')]['id']){delete _0x4a7dd8[_0x06e3('0x48')]['id'];}return db[_0x06e3('0x3f')]['find']({'where':{'id':_0x4a7dd8[_0x06e3('0x42')]['id']}})[_0x06e3('0x23')](handleEntityNotFound(_0xf37a24,null))[_0x06e3('0x23')](saveUpdates(_0x4a7dd8['body'],null))[_0x06e3('0x23')](respondWithResult(_0xf37a24,null))[_0x06e3('0x49')](handleError(_0xf37a24,null));};exports[_0x06e3('0x24')]=function(_0x5e7a63,_0x13b800){return db[_0x06e3('0x3f')]['find']({'where':{'id':_0x5e7a63[_0x06e3('0x42')]['id']}})[_0x06e3('0x23')](handleEntityNotFound(_0x13b800,null))['then'](removeEntity(_0x13b800,null))[_0x06e3('0x49')](handleError(_0x13b800,null));};exports[_0x06e3('0x4a')]=function(_0x192832,_0x3809e9){return db[_0x06e3('0x3f')]['describe']()[_0x06e3('0x23')](respondWithResult(_0x3809e9,null))['catch'](handleError(_0x3809e9,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 1a55a0d..81e80d5 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 _0x7275=['./faxTransferReport.attributes','define','report_fax_transfer','uniqueid','lodash','util','../../config/logger','moment','request-promise','path','../../config/environment'];(function(_0x2d9ad9,_0x515185){var _0x1c94bc=function(_0x38aec3){while(--_0x38aec3){_0x2d9ad9['push'](_0x2d9ad9['shift']());}};_0x1c94bc(++_0x515185);}(_0x7275,0x143));var _0x5727=function(_0x5b3dfb,_0x1b629c){_0x5b3dfb=_0x5b3dfb-0x0;var _0x503711=_0x7275[_0x5b3dfb];return _0x503711;};'use strict';var _=require(_0x5727('0x0'));var util=require(_0x5727('0x1'));var logger=require(_0x5727('0x2'))('api');var moment=require(_0x5727('0x3'));var BPromise=require('bluebird');var rp=require(_0x5727('0x4'));var fs=require('fs');var path=require(_0x5727('0x5'));var rimraf=require('rimraf');var config=require(_0x5727('0x6'));var attributes=require(_0x5727('0x7'));module['exports']=function(_0x4c509e,_0x4872ba){return _0x4c509e[_0x5727('0x8')]('FaxTransferReport',attributes,{'tableName':_0x5727('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x5727('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc526=['report_fax_transfer','uniqueid','util','api','moment','bluebird','path','exports','define','FaxTransferReport'];(function(_0x43c404,_0x2ead88){var _0x5986ec=function(_0x25482c){while(--_0x25482c){_0x43c404['push'](_0x43c404['shift']());}};_0x5986ec(++_0x2ead88);}(_0xc526,0x124));var _0x6c52=function(_0x56e9b6,_0x2b69a5){_0x56e9b6=_0x56e9b6-0x0;var _0x3a8f55=_0xc526[_0x56e9b6];return _0x3a8f55;};'use strict';var _=require('lodash');var util=require(_0x6c52('0x0'));var logger=require('../../config/logger')(_0x6c52('0x1'));var moment=require(_0x6c52('0x2'));var BPromise=require(_0x6c52('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6c52('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./faxTransferReport.attributes');module[_0x6c52('0x5')]=function(_0x23e200,_0x20228a){return _0x23e200[_0x6c52('0x6')](_0x6c52('0x7'),attributes,{'tableName':_0x6c52('0x8'),'paranoid':![],'indexes':[{'name':_0x6c52('0x9'),'fields':[_0x6c52('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 cf49992..4fdbf47 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 _0x71e0=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','request','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x5c6951,_0x507abb){var _0x5ee145=function(_0x4f8b75){while(--_0x4f8b75){_0x5c6951['push'](_0x5c6951['shift']());}};_0x5ee145(++_0x507abb);}(_0x71e0,0xf6));var _0x071e=function(_0x2b4912,_0x147d1c){_0x2b4912=_0x2b4912-0x0;var _0x5a773a=_0x71e0[_0x2b4912];return _0x5a773a;};'use strict';var _=require(_0x071e('0x0'));var util=require(_0x071e('0x1'));var moment=require('moment');var BPromise=require(_0x071e('0x2'));var rs=require(_0x071e('0x3'));var fs=require('fs');var Redis=require(_0x071e('0x4'));var db=require(_0x071e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x071e('0x6'))('rpc');var config=require(_0x071e('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2f81b5,_0x3db8bb,_0x103f89){return new BPromise(function(_0x5b565d,_0x384ff4){return client[_0x071e('0x8')](_0x2f81b5,_0x103f89)['then'](function(_0x4c6bb8){logger[_0x071e('0x9')](_0x071e('0xa'),_0x3db8bb,_0x071e('0xb'));logger['debug'](_0x071e('0xc'),_0x3db8bb,'request\x20sent',JSON[_0x071e('0xd')](_0x4c6bb8));if(_0x4c6bb8['error']){if(_0x4c6bb8[_0x071e('0xe')][_0x071e('0xf')]===0x1f4){logger[_0x071e('0xe')](_0x071e('0xa'),_0x3db8bb,_0x4c6bb8[_0x071e('0xe')][_0x071e('0x10')]);return _0x384ff4(_0x4c6bb8[_0x071e('0xe')][_0x071e('0x10')]);}logger[_0x071e('0xe')](_0x071e('0xa'),_0x3db8bb,_0x4c6bb8['error'][_0x071e('0x10')]);return _0x5b565d(_0x4c6bb8[_0x071e('0xe')][_0x071e('0x10')]);}else{logger['info']('FaxTransferReport,\x20%s,\x20%s',_0x3db8bb,_0x071e('0xb'));_0x5b565d(_0x4c6bb8[_0x071e('0x11')]['message']);}})[_0x071e('0x12')](function(_0x8abac6){logger[_0x071e('0xe')](_0x071e('0xa'),_0x3db8bb,_0x8abac6);_0x384ff4(_0x8abac6);});});} \ No newline at end of file +var _0x1d05=['request\x20sent','stringify','error','code','message','FaxTransferReport,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','then','info','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x187eb1,_0x555655){var _0x40c5e6=function(_0x279df9){while(--_0x279df9){_0x187eb1['push'](_0x187eb1['shift']());}};_0x40c5e6(++_0x555655);}(_0x1d05,0x110));var _0x51d0=function(_0x12024c,_0xf2dea2){_0x12024c=_0x12024c-0x0;var _0x476198=_0x1d05[_0x12024c];return _0x476198;};'use strict';var _=require(_0x51d0('0x0'));var util=require(_0x51d0('0x1'));var moment=require(_0x51d0('0x2'));var BPromise=require(_0x51d0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x51d0('0x4'))['db'];var utils=require(_0x51d0('0x5'));var logger=require('../../config/logger')(_0x51d0('0x6'));var config=require('../../config/environment');var jayson=require(_0x51d0('0x7'));var client=jayson['client'][_0x51d0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4d4b73,_0x3433ef,_0x2380c8){return new BPromise(function(_0x26d78f,_0x28cd4c){return client[_0x51d0('0x9')](_0x4d4b73,_0x2380c8)[_0x51d0('0xa')](function(_0x24f213){logger[_0x51d0('0xb')]('FaxTransferReport,\x20%s,\x20%s',_0x3433ef,'request\x20sent');logger[_0x51d0('0xc')](_0x51d0('0xd'),_0x3433ef,_0x51d0('0xe'),JSON[_0x51d0('0xf')](_0x24f213));if(_0x24f213['error']){if(_0x24f213[_0x51d0('0x10')][_0x51d0('0x11')]===0x1f4){logger['error']('FaxTransferReport,\x20%s,\x20%s',_0x3433ef,_0x24f213[_0x51d0('0x10')]['message']);return _0x28cd4c(_0x24f213[_0x51d0('0x10')][_0x51d0('0x12')]);}logger[_0x51d0('0x10')](_0x51d0('0x13'),_0x3433ef,_0x24f213[_0x51d0('0x10')][_0x51d0('0x12')]);return _0x26d78f(_0x24f213['error'][_0x51d0('0x12')]);}else{logger[_0x51d0('0xb')](_0x51d0('0x13'),_0x3433ef,'request\x20sent');_0x26d78f(_0x24f213[_0x51d0('0x14')][_0x51d0('0x12')]);}})[_0x51d0('0x15')](function(_0x1034a2){logger[_0x51d0('0x10')](_0x51d0('0x13'),_0x3433ef,_0x1034a2);_0x28cd4c(_0x1034a2);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index f0ac003..a681c96 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 _0x9ac3=['multer','path','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','describe','/:id','show','post','create','update','delete','destroy','exports'];(function(_0x603641,_0x529e6){var _0x4e6e1b=function(_0x3b8072){while(--_0x3b8072){_0x603641['push'](_0x603641['shift']());}};_0x4e6e1b(++_0x529e6);}(_0x9ac3,0x168));var _0x39ac=function(_0x3e8270,_0x293590){_0x3e8270=_0x3e8270-0x0;var _0x1ccde9=_0x9ac3[_0x3e8270];return _0x1ccde9;};'use strict';var multer=require(_0x39ac('0x0'));var util=require('util');var path=require(_0x39ac('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x39ac('0x2')]();var fs_extra=require(_0x39ac('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x39ac('0x4'));var config=require(_0x39ac('0x5'));var controller=require(_0x39ac('0x6'));router[_0x39ac('0x7')]('/',auth[_0x39ac('0x8')](),controller['index']);router['get']('/describe',auth[_0x39ac('0x8')](),controller[_0x39ac('0x9')]);router[_0x39ac('0x7')](_0x39ac('0xa'),auth[_0x39ac('0x8')](),controller[_0x39ac('0xb')]);router[_0x39ac('0xc')]('/',auth['isAuthenticated'](),controller[_0x39ac('0xd')]);router['put'](_0x39ac('0xa'),auth[_0x39ac('0x8')](),controller[_0x39ac('0xe')]);router[_0x39ac('0xf')](_0x39ac('0xa'),auth['isAuthenticated'](),controller[_0x39ac('0x10')]);module[_0x39ac('0x11')]=router; \ No newline at end of file +var _0xc811=['describe','show','post','create','/:id','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./faxTransferReport.controller','get','isAuthenticated','/describe'];(function(_0x82d2d1,_0xbac430){var _0xb2dd3d=function(_0x2efb47){while(--_0x2efb47){_0x82d2d1['push'](_0x82d2d1['shift']());}};_0xb2dd3d(++_0xbac430);}(_0xc811,0x1d0));var _0x1c81=function(_0x599480,_0x302642){_0x599480=_0x599480-0x0;var _0x1215a4=_0xc811[_0x599480];return _0x1215a4;};'use strict';var multer=require('multer');var util=require(_0x1c81('0x0'));var path=require(_0x1c81('0x1'));var timeout=require(_0x1c81('0x2'));var express=require(_0x1c81('0x3'));var router=express[_0x1c81('0x4')]();var fs_extra=require(_0x1c81('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1c81('0x6'));var config=require('../../config/environment');var controller=require(_0x1c81('0x7'));router[_0x1c81('0x8')]('/',auth[_0x1c81('0x9')](),controller['index']);router[_0x1c81('0x8')](_0x1c81('0xa'),auth['isAuthenticated'](),controller[_0x1c81('0xb')]);router[_0x1c81('0x8')]('/:id',auth[_0x1c81('0x9')](),controller[_0x1c81('0xc')]);router[_0x1c81('0xd')]('/',auth[_0x1c81('0x9')](),controller[_0x1c81('0xe')]);router['put'](_0x1c81('0xf'),auth['isAuthenticated'](),controller[_0x1c81('0x10')]);router[_0x1c81('0x11')](_0x1c81('0xf'),auth[_0x1c81('0x9')](),controller[_0x1c81('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index ccec384..4847a44 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 _0xd9b0=['../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','create','post','addConfiguration','put','update','delete','exports','multer','util','connect-timeout','express','fs-extra'];(function(_0x2c8efe,_0x469b2c){var _0x55378f=function(_0x5c1f9a){while(--_0x5c1f9a){_0x2c8efe['push'](_0x2c8efe['shift']());}};_0x55378f(++_0x469b2c);}(_0xd9b0,0x119));var _0x0d9b=function(_0x29d2db,_0x449382){_0x29d2db=_0x29d2db-0x0;var _0x2dc0b7=_0xd9b0[_0x29d2db];return _0x2dc0b7;};'use strict';var multer=require(_0x0d9b('0x0'));var util=require(_0x0d9b('0x1'));var path=require('path');var timeout=require(_0x0d9b('0x2'));var express=require(_0x0d9b('0x3'));var router=express['Router']();var fs_extra=require(_0x0d9b('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0d9b('0x5'));var config=require(_0x0d9b('0x6'));var controller=require(_0x0d9b('0x7'));router[_0x0d9b('0x8')]('/',auth['isAuthenticated'](),controller[_0x0d9b('0x9')]);router[_0x0d9b('0x8')](_0x0d9b('0xa'),auth[_0x0d9b('0xb')](),controller[_0x0d9b('0xc')]);router[_0x0d9b('0x8')](_0x0d9b('0xd'),auth[_0x0d9b('0xb')](),controller[_0x0d9b('0xe')]);router[_0x0d9b('0x8')]('/:id/fields',auth[_0x0d9b('0xb')](),controller['getFields']);router['post']('/',auth['isAuthenticated'](),controller[_0x0d9b('0xf')]);router[_0x0d9b('0x10')](_0x0d9b('0xd'),auth[_0x0d9b('0xb')](),controller[_0x0d9b('0x11')]);router[_0x0d9b('0x12')]('/:id',auth[_0x0d9b('0xb')](),controller[_0x0d9b('0x13')]);router[_0x0d9b('0x14')](_0x0d9b('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x0d9b('0x15')]=router; \ No newline at end of file +var _0xd625=['./intDeskAccount.controller','isAuthenticated','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','put','delete','destroy','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x1653b1,_0x35b7d1){var _0x3e0b17=function(_0x5f21fc){while(--_0x5f21fc){_0x1653b1['push'](_0x1653b1['shift']());}};_0x3e0b17(++_0x35b7d1);}(_0xd625,0x7d));var _0x5d62=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xd625[_0xf50820];return _0x2a9b10;};'use strict';var multer=require(_0x5d62('0x0'));var util=require('util');var path=require(_0x5d62('0x1'));var timeout=require(_0x5d62('0x2'));var express=require(_0x5d62('0x3'));var router=express['Router']();var fs_extra=require(_0x5d62('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x5d62('0x5'));var config=require(_0x5d62('0x6'));var controller=require(_0x5d62('0x7'));router['get']('/',auth[_0x5d62('0x8')](),controller['index']);router[_0x5d62('0x9')](_0x5d62('0xa'),auth[_0x5d62('0x8')](),controller[_0x5d62('0xb')]);router[_0x5d62('0x9')](_0x5d62('0xc'),auth[_0x5d62('0x8')](),controller[_0x5d62('0xd')]);router[_0x5d62('0x9')](_0x5d62('0xe'),auth[_0x5d62('0x8')](),controller[_0x5d62('0xf')]);router['post']('/',auth[_0x5d62('0x8')](),controller[_0x5d62('0x10')]);router[_0x5d62('0x11')]('/:id/configurations',auth[_0x5d62('0x8')](),controller[_0x5d62('0x12')]);router[_0x5d62('0x13')](_0x5d62('0xa'),auth[_0x5d62('0x8')](),controller['update']);router[_0x5d62('0x14')](_0x5d62('0xa'),auth[_0x5d62('0x8')](),controller[_0x5d62('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index f33c9f7..f28b009 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 _0xd7c2=['basic','integrationTab','sequelize','exports','STRING','ENUM'];(function(_0x31991b,_0xaf75d2){var _0x307304=function(_0x2f36c5){while(--_0x2f36c5){_0x31991b['push'](_0x31991b['shift']());}};_0x307304(++_0xaf75d2);}(_0xd7c2,0xce));var _0x2d7c=function(_0x4141b6,_0x275d9e){_0x4141b6=_0x4141b6-0x0;var _0x58cb84=_0xd7c2[_0x4141b6];return _0x58cb84;};'use strict';var Sequelize=require(_0x2d7c('0x0'));module[_0x2d7c('0x1')]={'name':{'type':Sequelize[_0x2d7c('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x2d7c('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize[_0x2d7c('0x3')](_0x2d7c('0x4')),'defaultValue':_0x2d7c('0x4')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0x2d7c('0x2')]},'consumerSecret':{'type':Sequelize[_0x2d7c('0x2')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x2d7c('0x3')](_0x2d7c('0x5'),'newTab'),'defaultValue':_0x2d7c('0x5')}}; \ No newline at end of file +var _0x4ddf=['newTab','exports','STRING','ENUM','integrationTab'];(function(_0x57f8c0,_0x136cf6){var _0x117f08=function(_0x426cd4){while(--_0x426cd4){_0x57f8c0['push'](_0x57f8c0['shift']());}};_0x117f08(++_0x136cf6);}(_0x4ddf,0x105));var _0xf4dd=function(_0x4e57f2,_0x30f8b4){_0x4e57f2=_0x4e57f2-0x0;var _0x162ee2=_0x4ddf[_0x4e57f2];return _0x162ee2;};'use strict';var Sequelize=require('sequelize');module[_0xf4dd('0x0')]={'name':{'type':Sequelize[_0xf4dd('0x1')]},'description':{'type':Sequelize[_0xf4dd('0x1')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize[_0xf4dd('0x2')]('basic'),'defaultValue':'basic'},'password':{'type':Sequelize[_0xf4dd('0x1')]},'consumerKey':{'type':Sequelize[_0xf4dd('0x1')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xf4dd('0x1')]},'tokenSecret':{'type':Sequelize[_0xf4dd('0x1')]},'serverUrl':{'type':Sequelize[_0xf4dd('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xf4dd('0x3'),_0xf4dd('0x4')),'defaultValue':_0xf4dd('0x3')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index e5a6a8e..e092d11 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 _0x7f8a=['remoteUri','slice','substring','lastIndexOf','GET','application/json','basic','headers','Authorization','format','%s:%s','toString','base64','_embedded','active','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','fs-extra','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','type','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','filter','merge','includeAll','include','DeskAccount','findAll','rows','catch','show','params','rawAttributes','options','find','create','body','pick','hasOwnProperty','getConfigurations','addConfiguration','findOne','AccountId','getSubjects','Descriptions','getDescriptions','DeskConfiguration','DeskField','Subjects','priority','authType','username','password','consumerKey','token','tokenSecret'];(function(_0x454147,_0x7f04d6){var _0x3a42fd=function(_0x23847c){while(--_0x23847c){_0x454147['push'](_0x454147['shift']());}};_0x3a42fd(++_0x7f04d6);}(_0x7f8a,0x16b));var _0xa7f8=function(_0x4e62c6,_0x58adf8){_0x4e62c6=_0x4e62c6-0x0;var _0x595f8=_0x7f8a[_0x4e62c6];return _0x595f8;};'use strict';var emlformat=require(_0xa7f8('0x0'));var rimraf=require(_0xa7f8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa7f8('0x2'));var rp=require(_0xa7f8('0x3'));var moment=require(_0xa7f8('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa7f8('0x5'));var util=require(_0xa7f8('0x6'));var path=require(_0xa7f8('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa7f8('0x8'));var _=require('lodash');var squel=require(_0xa7f8('0x9'));var crypto=require(_0xa7f8('0xa'));var jsforce=require(_0xa7f8('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xa7f8('0xc'));var querystring=require(_0xa7f8('0xd'));var Papa=require(_0xa7f8('0xe'));var Redis=require(_0xa7f8('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa7f8('0x10'));var hardwareService=require(_0xa7f8('0x11'));var logger=require(_0xa7f8('0x12'))('api');var utils=require(_0xa7f8('0x13'));var config=require(_0xa7f8('0x14'));var licenseUtil=require(_0xa7f8('0x15'));var db=require(_0xa7f8('0x16'))['db'];var integrations=require(_0xa7f8('0x17'));function respondWithStatusCode(_0x287cbf,_0x3c00e0){_0x3c00e0=_0x3c00e0||0xcc;return function(_0x289407){if(_0x289407){return _0x287cbf['sendStatus'](_0x3c00e0);}return _0x287cbf[_0xa7f8('0x18')](_0x3c00e0)[_0xa7f8('0x19')]();};}function respondWithResult(_0x64f26e,_0x28605a){_0x28605a=_0x28605a||0xc8;return function(_0x49b101){if(_0x49b101){return _0x64f26e[_0xa7f8('0x18')](_0x28605a)['json'](_0x49b101);}};}function respondWithFilteredResult(_0xe370b4,_0x433722){return function(_0xff1cc3){if(_0xff1cc3){var _0x2fdb96=typeof _0x433722[_0xa7f8('0x1a')]===_0xa7f8('0x1b')&&typeof _0x433722[_0xa7f8('0x1c')]===_0xa7f8('0x1b');var _0x2f010f=_0xff1cc3[_0xa7f8('0x1d')];var _0xdda04c=_0x2fdb96?0x0:_0x433722['offset'];var _0xeec5c1=_0x2fdb96?_0xff1cc3[_0xa7f8('0x1d')]:_0x433722[_0xa7f8('0x1a')]+_0x433722[_0xa7f8('0x1c')];var _0x33cbcc;if(_0xeec5c1>=_0x2f010f){_0xeec5c1=_0x2f010f;_0x33cbcc=0xc8;}else{_0x33cbcc=0xce;}_0xe370b4[_0xa7f8('0x18')](_0x33cbcc);return _0xe370b4['set'](_0xa7f8('0x1e'),_0xdda04c+'-'+_0xeec5c1+'/'+_0x2f010f)[_0xa7f8('0x1f')](_0xff1cc3);}return null;};}function patchUpdates(_0x559f45){return function(_0x4dd3c2){try{jsonpatch[_0xa7f8('0x20')](_0x4dd3c2,_0x559f45,!![]);}catch(_0x247a41){return BPromise[_0xa7f8('0x21')](_0x247a41);}return _0x4dd3c2[_0xa7f8('0x22')]();};}function saveUpdates(_0x329b9c,_0x17b52e){return function(_0x28fd5b){if(_0x28fd5b){return _0x28fd5b[_0xa7f8('0x23')](_0x329b9c)[_0xa7f8('0x24')](function(_0x8d7311){return _0x8d7311;});}return null;};}function removeEntity(_0x37c3a0,_0x29da28){return function(_0x173115){if(_0x173115){return _0x173115[_0xa7f8('0x25')]()['then'](function(){_0x37c3a0[_0xa7f8('0x18')](0xcc)[_0xa7f8('0x19')]();});}};}function handleEntityNotFound(_0x3b9d70,_0xf02261){return function(_0x1fee2f){if(!_0x1fee2f){_0x3b9d70[_0xa7f8('0x26')](0x194);}return _0x1fee2f;};}function handleError(_0x486dd6,_0x392062){_0x392062=_0x392062||0x1f4;return function(_0x4e0f18){logger[_0xa7f8('0x27')](_0x4e0f18[_0xa7f8('0x28')]);if(_0x4e0f18[_0xa7f8('0x29')]){delete _0x4e0f18[_0xa7f8('0x29')];}_0x486dd6[_0xa7f8('0x18')](_0x392062)[_0xa7f8('0x2a')](_0x4e0f18);};}exports[_0xa7f8('0x2b')]=function(_0x3a6ab4,_0x12d33f){var _0x1cb14b={},_0x4648a9={},_0x5af2aa={'count':0x0,'rows':[]};var _0x371df6=_[_0xa7f8('0x2c')](db['DeskAccount']['rawAttributes'],function(_0x4ab429){return{'name':_0x4ab429['fieldName'],'type':_0x4ab429[_0xa7f8('0x2d')][_0xa7f8('0x2e')]};});_0x4648a9['model']=_['map'](_0x371df6,_0xa7f8('0x29'));_0x4648a9[_0xa7f8('0x2f')]=_[_0xa7f8('0x30')](_0x3a6ab4['query']);_0x4648a9[_0xa7f8('0x31')]=_[_0xa7f8('0x32')](_0x4648a9[_0xa7f8('0x33')],_0x4648a9['query']);_0x1cb14b['attributes']=_[_0xa7f8('0x32')](_0x4648a9[_0xa7f8('0x33')],qs[_0xa7f8('0x34')](_0x3a6ab4[_0xa7f8('0x2f')][_0xa7f8('0x34')]));_0x1cb14b[_0xa7f8('0x35')]=_0x1cb14b[_0xa7f8('0x35')][_0xa7f8('0x36')]?_0x1cb14b['attributes']:_0x4648a9[_0xa7f8('0x33')];if(!_0x3a6ab4['query']['hasOwnProperty'](_0xa7f8('0x37'))){_0x1cb14b[_0xa7f8('0x1c')]=qs[_0xa7f8('0x1c')](_0x3a6ab4[_0xa7f8('0x2f')][_0xa7f8('0x1c')]);_0x1cb14b[_0xa7f8('0x1a')]=qs[_0xa7f8('0x1a')](_0x3a6ab4[_0xa7f8('0x2f')]['offset']);}_0x1cb14b[_0xa7f8('0x38')]=qs[_0xa7f8('0x39')](_0x3a6ab4[_0xa7f8('0x2f')][_0xa7f8('0x39')]);_0x1cb14b[_0xa7f8('0x3a')]=qs[_0xa7f8('0x31')](_['pick'](_0x3a6ab4['query'],_0x4648a9[_0xa7f8('0x31')]),_0x371df6);if(_0x3a6ab4['query'][_0xa7f8('0x3b')]){_0x1cb14b[_0xa7f8('0x3a')]=_[_0xa7f8('0x3c')](_0x1cb14b['where'],{'$or':_[_0xa7f8('0x2c')](_0x371df6,function(_0x145844){if(_0x145844[_0xa7f8('0x2d')]!=='VIRTUAL'){var _0x40fcf2={};_0x40fcf2[_0x145844[_0xa7f8('0x29')]]={'$like':'%'+_0x3a6ab4[_0xa7f8('0x2f')]['filter']+'%'};return _0x40fcf2;}})});}_0x1cb14b=_[_0xa7f8('0x3c')]({},_0x1cb14b,_0x3a6ab4['options']);var _0x4971ff={'where':_0x1cb14b[_0xa7f8('0x3a')]};return db['DeskAccount'][_0xa7f8('0x1d')](_0x4971ff)[_0xa7f8('0x24')](function(_0x1d24f9){_0x5af2aa[_0xa7f8('0x1d')]=_0x1d24f9;if(_0x3a6ab4[_0xa7f8('0x2f')][_0xa7f8('0x3d')]){_0x1cb14b[_0xa7f8('0x3e')]=[{'all':!![]}];}return db[_0xa7f8('0x3f')][_0xa7f8('0x40')](_0x1cb14b);})[_0xa7f8('0x24')](function(_0x419577){_0x5af2aa[_0xa7f8('0x41')]=_0x419577;return _0x5af2aa;})[_0xa7f8('0x24')](respondWithFilteredResult(_0x12d33f,_0x1cb14b))[_0xa7f8('0x42')](handleError(_0x12d33f,null));};exports[_0xa7f8('0x43')]=function(_0x4c5267,_0x266a79){var _0x1be913={'raw':![],'where':{'id':_0x4c5267[_0xa7f8('0x44')]['id']}},_0x1a39b5={};_0x1a39b5['model']=_[_0xa7f8('0x30')](db[_0xa7f8('0x3f')][_0xa7f8('0x45')]);_0x1a39b5[_0xa7f8('0x2f')]=_[_0xa7f8('0x30')](_0x4c5267[_0xa7f8('0x2f')]);_0x1a39b5[_0xa7f8('0x31')]=_[_0xa7f8('0x32')](_0x1a39b5[_0xa7f8('0x33')],_0x1a39b5[_0xa7f8('0x2f')]);_0x1be913[_0xa7f8('0x35')]=_[_0xa7f8('0x32')](_0x1a39b5[_0xa7f8('0x33')],qs['fields'](_0x4c5267[_0xa7f8('0x2f')]['fields']));_0x1be913['attributes']=_0x1be913[_0xa7f8('0x35')][_0xa7f8('0x36')]?_0x1be913[_0xa7f8('0x35')]:_0x1a39b5[_0xa7f8('0x33')];if(_0x4c5267[_0xa7f8('0x2f')][_0xa7f8('0x3d')]){_0x1be913[_0xa7f8('0x3e')]=[{'all':!![]}];}_0x1be913=_[_0xa7f8('0x3c')]({},_0x1be913,_0x4c5267[_0xa7f8('0x46')]);return db[_0xa7f8('0x3f')][_0xa7f8('0x47')](_0x1be913)[_0xa7f8('0x24')](handleEntityNotFound(_0x266a79,null))[_0xa7f8('0x24')](respondWithResult(_0x266a79,null))[_0xa7f8('0x42')](handleError(_0x266a79,null));};exports[_0xa7f8('0x48')]=function(_0x37782f,_0x2ad65f){return db['DeskAccount'][_0xa7f8('0x48')](_0x37782f[_0xa7f8('0x49')],{})[_0xa7f8('0x24')](respondWithResult(_0x2ad65f,0xc9))[_0xa7f8('0x42')](handleError(_0x2ad65f,null));};exports[_0xa7f8('0x23')]=function(_0x99871b,_0x65b9e0){if(_0x99871b[_0xa7f8('0x49')]['id']){delete _0x99871b[_0xa7f8('0x49')]['id'];}return db['DeskAccount'][_0xa7f8('0x47')]({'where':{'id':_0x99871b[_0xa7f8('0x44')]['id']}})[_0xa7f8('0x24')](handleEntityNotFound(_0x65b9e0,null))[_0xa7f8('0x24')](saveUpdates(_0x99871b[_0xa7f8('0x49')],null))[_0xa7f8('0x24')](respondWithResult(_0x65b9e0,null))[_0xa7f8('0x42')](handleError(_0x65b9e0,null));};exports[_0xa7f8('0x25')]=function(_0x56016c,_0x5ba6cd){return db[_0xa7f8('0x3f')]['find']({'where':{'id':_0x56016c[_0xa7f8('0x44')]['id']}})['then'](handleEntityNotFound(_0x5ba6cd,null))['then'](removeEntity(_0x5ba6cd,null))[_0xa7f8('0x42')](handleError(_0x5ba6cd,null));};exports['getConfigurations']=function(_0x308117,_0x599512,_0x27845c){var _0x24491f={};var _0x14ac42={};var _0x3d33fe;var _0x5f3332;return db[_0xa7f8('0x3f')]['findOne']({'where':{'id':_0x308117['params']['id']}})[_0xa7f8('0x24')](handleEntityNotFound(_0x599512,null))[_0xa7f8('0x24')](function(_0x26353f){if(_0x26353f){_0x3d33fe=_0x26353f;_0x14ac42['model']=_[_0xa7f8('0x30')](db['DeskConfiguration'][_0xa7f8('0x45')]);_0x14ac42[_0xa7f8('0x2f')]=_['keys'](_0x308117[_0xa7f8('0x2f')]);_0x14ac42[_0xa7f8('0x31')]=_['intersection'](_0x14ac42[_0xa7f8('0x33')],_0x14ac42['query']);_0x24491f[_0xa7f8('0x35')]=_[_0xa7f8('0x32')](_0x14ac42[_0xa7f8('0x33')],qs[_0xa7f8('0x34')](_0x308117[_0xa7f8('0x2f')]['fields']));_0x24491f['attributes']=_0x24491f[_0xa7f8('0x35')][_0xa7f8('0x36')]?_0x24491f[_0xa7f8('0x35')]:_0x14ac42[_0xa7f8('0x33')];_0x24491f[_0xa7f8('0x38')]=qs[_0xa7f8('0x39')](_0x308117[_0xa7f8('0x2f')][_0xa7f8('0x39')]);_0x24491f[_0xa7f8('0x3a')]=qs['filters'](_[_0xa7f8('0x4a')](_0x308117['query'],_0x14ac42[_0xa7f8('0x31')]));if(_0x308117[_0xa7f8('0x2f')][_0xa7f8('0x3b')]){_0x24491f[_0xa7f8('0x3a')]=_[_0xa7f8('0x3c')](_0x24491f[_0xa7f8('0x3a')],{'$or':_[_0xa7f8('0x2c')](_0x24491f[_0xa7f8('0x35')],function(_0x2a9188){var _0x2ac119={};_0x2ac119[_0x2a9188]={'$like':'%'+_0x308117['query']['filter']+'%'};return _0x2ac119;})});}_0x24491f=_['merge']({},_0x24491f,_0x308117[_0xa7f8('0x46')]);return _0x3d33fe['getConfigurations'](_0x24491f);}})[_0xa7f8('0x24')](function(_0x4354e9){if(_0x4354e9){_0x5f3332=_0x4354e9['length'];if(!_0x308117[_0xa7f8('0x2f')][_0xa7f8('0x4b')](_0xa7f8('0x37'))){_0x24491f[_0xa7f8('0x1c')]=qs[_0xa7f8('0x1c')](_0x308117['query']['limit']);_0x24491f[_0xa7f8('0x1a')]=qs['offset'](_0x308117['query']['offset']);}return _0x3d33fe[_0xa7f8('0x4c')](_0x24491f);}})['then'](function(_0x58cef8){if(_0x58cef8){return _0x58cef8?{'count':_0x5f3332,'rows':_0x58cef8}:null;}})[_0xa7f8('0x24')](respondWithResult(_0x599512,null))[_0xa7f8('0x42')](handleError(_0x599512,null));};exports[_0xa7f8('0x4d')]=function(_0x2185a4,_0x525ee6,_0x171b34){if(_0x2185a4[_0xa7f8('0x49')]['id']){delete _0x2185a4['body']['id'];}return db[_0xa7f8('0x3f')][_0xa7f8('0x4e')]({'where':{'id':_0x2185a4[_0xa7f8('0x44')]['id']}})[_0xa7f8('0x24')](handleEntityNotFound(_0x525ee6,null))['then'](function(_0xaa71b9){if(_0xaa71b9){_0x2185a4[_0xa7f8('0x49')][_0xa7f8('0x4f')]=_0xaa71b9['id'];_0x2185a4[_0xa7f8('0x49')]['Subjects']=integrations[_0xa7f8('0x50')](_0x2185a4[_0xa7f8('0x49')]['channel'],_0x2185a4[_0xa7f8('0x49')][_0xa7f8('0x2d')]);_0x2185a4[_0xa7f8('0x49')][_0xa7f8('0x51')]=integrations[_0xa7f8('0x52')](_0x2185a4[_0xa7f8('0x49')]['channel'],_0x2185a4[_0xa7f8('0x49')][_0xa7f8('0x2d')]);return db[_0xa7f8('0x53')][_0xa7f8('0x48')](_0x2185a4['body'],{'include':[{'model':db[_0xa7f8('0x54')],'as':_0xa7f8('0x55')},{'model':db[_0xa7f8('0x54')],'as':_0xa7f8('0x51')}]});}return null;})[_0xa7f8('0x24')](respondWithResult(_0x525ee6,null))[_0xa7f8('0x42')](handleError(_0x525ee6,null));};exports['getFields']=function(_0x1d7a73,_0xab2947,_0x19f5ed){var _0x116cae=[{'name':_0xa7f8('0x56'),'label':_0xa7f8('0x56'),'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 _0x598729='';return db['DeskAccount']['findOne']({'where':{'id':_0x1d7a73[_0xa7f8('0x44')]['id']},'attributes':['id','remoteUri',_0xa7f8('0x57'),_0xa7f8('0x58'),_0xa7f8('0x59'),_0xa7f8('0x5a'),'consumerSecret',_0xa7f8('0x5b'),_0xa7f8('0x5c')]})['then'](handleEntityNotFound(_0xab2947,null))[_0xa7f8('0x24')](function(_0x16f1ee){if(_0x16f1ee){_0x598729=_0x16f1ee[_0xa7f8('0x5d')];var _0x31e575=_0x598729[_0xa7f8('0x5e')](-0x1);if(_0x31e575==='/'){_0x598729=_0x598729[_0xa7f8('0x5f')](0x0,_0x598729[_0xa7f8('0x60')](_0x31e575));}var _0x25c517={'method':_0xa7f8('0x61'),'uri':util['format']('%s/custom_fields',_0x598729),'headers':{'Content-Type':_0xa7f8('0x62'),'Accept':'application/json'},'json':!![]};if(_0x16f1ee[_0xa7f8('0x57')]===_0xa7f8('0x63')){_0x25c517[_0xa7f8('0x64')][_0xa7f8('0x65')]=util[_0xa7f8('0x66')]('Basic\x20%s',new Buffer(util[_0xa7f8('0x66')](_0xa7f8('0x67'),_0x16f1ee[_0xa7f8('0x58')],_0x16f1ee[_0xa7f8('0x59')]))[_0xa7f8('0x68')](_0xa7f8('0x69')));}return rp(_0x25c517)[_0xa7f8('0x24')](function(_0x238257){return _0x116cae['concat'](_[_0xa7f8('0x2c')](_0x238257[_0xa7f8('0x6a')]['entries'],function(_0x9c348c){return{'id':_0x9c348c['name'],'name':_0x9c348c[_0xa7f8('0x29')],'type':_0x9c348c['type'],'active':_0x9c348c[_0xa7f8('0x6b')],'label':_0x9c348c['label'],'custom':!![]};}));});}})['then'](function(_0x3e0d26){return{'count':_0x3e0d26[_0xa7f8('0x36')],'rows':_0x3e0d26};})['then'](respondWithResult(_0xab2947,null))[_0xa7f8('0x42')](function(_0x59aba3){var _0x47883d=_0x1d7a73[_0xa7f8('0x2f')][_0xa7f8('0x6c')]?0x1f4:_0x59aba3[_0xa7f8('0x6d')]||0x1f4;logger['error'](_0xa7f8('0x6e'),_0xa7f8('0x6f'),_0x47883d,JSON[_0xa7f8('0x70')](_0x59aba3));delete _0x59aba3[_0xa7f8('0x29')];if(_0x47883d===0x191){_0x47883d=0x190;}_0xab2947[_0xa7f8('0x18')](_0x47883d)['send'](_0x1d7a73['query'][_0xa7f8('0x6c')]?{'message':_0xa7f8('0x71'),'statusCode':_0x59aba3['statusCode']}:_0x59aba3);});}; \ No newline at end of file +var _0x8021=['fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','end','status','json','undefined','limit','offset','set','Content-Range','reject','save','update','then','destroy','error','name','send','index','DeskAccount','rawAttributes','type','model','map','query','keys','filters','intersection','attributes','fields','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','params','body','find','catch','getConfigurations','DeskConfiguration','length','hasOwnProperty','nolimit','findOne','Subjects','getSubjects','getDescriptions','create','DeskField','getFields','priority','remoteUri','username','password','consumerKey','token','slice','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','authType','basic','headers','Authorization','%s:%s','toString','base64','active','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs'];(function(_0x4d7379,_0x4b4e63){var _0x46d7cf=function(_0x53f5f0){while(--_0x53f5f0){_0x4d7379['push'](_0x4d7379['shift']());}};_0x46d7cf(++_0x4b4e63);}(_0x8021,0x1b2));var _0x1802=function(_0x4ae5d3,_0x3f65fe){_0x4ae5d3=_0x4ae5d3-0x0;var _0x38bb02=_0x8021[_0x4ae5d3];return _0x38bb02;};'use strict';var emlformat=require(_0x1802('0x0'));var rimraf=require(_0x1802('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1802('0x2'));var rp=require('request-promise');var moment=require(_0x1802('0x3'));var BPromise=require(_0x1802('0x4'));var Mustache=require(_0x1802('0x5'));var util=require('util');var path=require(_0x1802('0x6'));var sox=require(_0x1802('0x7'));var csv=require(_0x1802('0x8'));var ejs=require(_0x1802('0x9'));var fs=require('fs');var fs_extra=require(_0x1802('0xa'));var _=require(_0x1802('0xb'));var squel=require(_0x1802('0xc'));var crypto=require(_0x1802('0xd'));var jsforce=require(_0x1802('0xe'));var deskjs=require(_0x1802('0xf'));var toCsv=require(_0x1802('0x8'));var querystring=require(_0x1802('0x10'));var Papa=require(_0x1802('0x11'));var Redis=require(_0x1802('0x12'));var authService=require(_0x1802('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1802('0x14'));var logger=require(_0x1802('0x15'))(_0x1802('0x16'));var utils=require('../../config/utils');var config=require(_0x1802('0x17'));var licenseUtil=require(_0x1802('0x18'));var db=require(_0x1802('0x19'))['db'];var integrations=require(_0x1802('0x1a'));function respondWithStatusCode(_0x10871d,_0x304dfb){_0x304dfb=_0x304dfb||0xcc;return function(_0x460557){if(_0x460557){return _0x10871d['sendStatus'](_0x304dfb);}return _0x10871d['status'](_0x304dfb)[_0x1802('0x1b')]();};}function respondWithResult(_0x39a252,_0x5a200a){_0x5a200a=_0x5a200a||0xc8;return function(_0x7ce7c){if(_0x7ce7c){return _0x39a252[_0x1802('0x1c')](_0x5a200a)[_0x1802('0x1d')](_0x7ce7c);}};}function respondWithFilteredResult(_0x43c103,_0x229cb4){return function(_0x4bd3e0){if(_0x4bd3e0){var _0xb1618e=typeof _0x229cb4['offset']===_0x1802('0x1e')&&typeof _0x229cb4[_0x1802('0x1f')]==='undefined';var _0x48756c=_0x4bd3e0['count'];var _0x495e42=_0xb1618e?0x0:_0x229cb4[_0x1802('0x20')];var _0x2e6120=_0xb1618e?_0x4bd3e0['count']:_0x229cb4[_0x1802('0x20')]+_0x229cb4['limit'];var _0x596679;if(_0x2e6120>=_0x48756c){_0x2e6120=_0x48756c;_0x596679=0xc8;}else{_0x596679=0xce;}_0x43c103[_0x1802('0x1c')](_0x596679);return _0x43c103[_0x1802('0x21')](_0x1802('0x22'),_0x495e42+'-'+_0x2e6120+'/'+_0x48756c)[_0x1802('0x1d')](_0x4bd3e0);}return null;};}function patchUpdates(_0xa2054b){return function(_0x320da4){try{jsonpatch['apply'](_0x320da4,_0xa2054b,!![]);}catch(_0x50fb67){return BPromise[_0x1802('0x23')](_0x50fb67);}return _0x320da4[_0x1802('0x24')]();};}function saveUpdates(_0x581d22,_0x10ea7d){return function(_0x4682e7){if(_0x4682e7){return _0x4682e7[_0x1802('0x25')](_0x581d22)[_0x1802('0x26')](function(_0x3a95bb){return _0x3a95bb;});}return null;};}function removeEntity(_0xab6b50,_0x41f98d){return function(_0x1701f9){if(_0x1701f9){return _0x1701f9[_0x1802('0x27')]()[_0x1802('0x26')](function(){_0xab6b50[_0x1802('0x1c')](0xcc)[_0x1802('0x1b')]();});}};}function handleEntityNotFound(_0x5bab68,_0x397570){return function(_0x19c576){if(!_0x19c576){_0x5bab68['sendStatus'](0x194);}return _0x19c576;};}function handleError(_0x54e5b7,_0x333ea4){_0x333ea4=_0x333ea4||0x1f4;return function(_0x16cde9){logger[_0x1802('0x28')](_0x16cde9['stack']);if(_0x16cde9[_0x1802('0x29')]){delete _0x16cde9[_0x1802('0x29')];}_0x54e5b7['status'](_0x333ea4)[_0x1802('0x2a')](_0x16cde9);};}exports[_0x1802('0x2b')]=function(_0x4060b5,_0x246615){var _0x211e36={},_0x124f98={},_0x2d1b4d={'count':0x0,'rows':[]};var _0x3c0aed=_['map'](db[_0x1802('0x2c')][_0x1802('0x2d')],function(_0x5ce318){return{'name':_0x5ce318['fieldName'],'type':_0x5ce318[_0x1802('0x2e')]['key']};});_0x124f98[_0x1802('0x2f')]=_[_0x1802('0x30')](_0x3c0aed,_0x1802('0x29'));_0x124f98[_0x1802('0x31')]=_[_0x1802('0x32')](_0x4060b5[_0x1802('0x31')]);_0x124f98[_0x1802('0x33')]=_[_0x1802('0x34')](_0x124f98[_0x1802('0x2f')],_0x124f98[_0x1802('0x31')]);_0x211e36[_0x1802('0x35')]=_[_0x1802('0x34')](_0x124f98[_0x1802('0x2f')],qs['fields'](_0x4060b5[_0x1802('0x31')][_0x1802('0x36')]));_0x211e36[_0x1802('0x35')]=_0x211e36['attributes']['length']?_0x211e36[_0x1802('0x35')]:_0x124f98[_0x1802('0x2f')];if(!_0x4060b5['query']['hasOwnProperty']('nolimit')){_0x211e36['limit']=qs[_0x1802('0x1f')](_0x4060b5[_0x1802('0x31')][_0x1802('0x1f')]);_0x211e36[_0x1802('0x20')]=qs[_0x1802('0x20')](_0x4060b5[_0x1802('0x31')][_0x1802('0x20')]);}_0x211e36[_0x1802('0x37')]=qs['sort'](_0x4060b5[_0x1802('0x31')][_0x1802('0x38')]);_0x211e36[_0x1802('0x39')]=qs[_0x1802('0x33')](_[_0x1802('0x3a')](_0x4060b5[_0x1802('0x31')],_0x124f98[_0x1802('0x33')]),_0x3c0aed);if(_0x4060b5[_0x1802('0x31')][_0x1802('0x3b')]){_0x211e36['where']=_[_0x1802('0x3c')](_0x211e36['where'],{'$or':_[_0x1802('0x30')](_0x3c0aed,function(_0x13b6eb){if(_0x13b6eb[_0x1802('0x2e')]!==_0x1802('0x3d')){var _0x95a544={};_0x95a544[_0x13b6eb[_0x1802('0x29')]]={'$like':'%'+_0x4060b5['query'][_0x1802('0x3b')]+'%'};return _0x95a544;}})});}_0x211e36=_['merge']({},_0x211e36,_0x4060b5[_0x1802('0x3e')]);var _0x183bf9={'where':_0x211e36[_0x1802('0x39')]};return db['DeskAccount'][_0x1802('0x3f')](_0x183bf9)[_0x1802('0x26')](function(_0x5948d8){_0x2d1b4d[_0x1802('0x3f')]=_0x5948d8;if(_0x4060b5[_0x1802('0x31')][_0x1802('0x40')]){_0x211e36[_0x1802('0x41')]=[{'all':!![]}];}return db['DeskAccount'][_0x1802('0x42')](_0x211e36);})['then'](function(_0x424d44){_0x2d1b4d[_0x1802('0x43')]=_0x424d44;return _0x2d1b4d;})[_0x1802('0x26')](respondWithFilteredResult(_0x246615,_0x211e36))['catch'](handleError(_0x246615,null));};exports['show']=function(_0x9a5ba7,_0x52821f){var _0xec9dad={'raw':![],'where':{'id':_0x9a5ba7[_0x1802('0x44')]['id']}},_0x27e625={};_0x27e625[_0x1802('0x2f')]=_[_0x1802('0x32')](db[_0x1802('0x2c')][_0x1802('0x2d')]);_0x27e625[_0x1802('0x31')]=_['keys'](_0x9a5ba7[_0x1802('0x31')]);_0x27e625[_0x1802('0x33')]=_[_0x1802('0x34')](_0x27e625['model'],_0x27e625['query']);_0xec9dad[_0x1802('0x35')]=_[_0x1802('0x34')](_0x27e625[_0x1802('0x2f')],qs[_0x1802('0x36')](_0x9a5ba7[_0x1802('0x31')][_0x1802('0x36')]));_0xec9dad[_0x1802('0x35')]=_0xec9dad[_0x1802('0x35')]['length']?_0xec9dad['attributes']:_0x27e625[_0x1802('0x2f')];if(_0x9a5ba7[_0x1802('0x31')][_0x1802('0x40')]){_0xec9dad[_0x1802('0x41')]=[{'all':!![]}];}_0xec9dad=_[_0x1802('0x3c')]({},_0xec9dad,_0x9a5ba7['options']);return db[_0x1802('0x2c')]['find'](_0xec9dad)[_0x1802('0x26')](handleEntityNotFound(_0x52821f,null))[_0x1802('0x26')](respondWithResult(_0x52821f,null))['catch'](handleError(_0x52821f,null));};exports['create']=function(_0x37a6b8,_0x41c8c3){return db['DeskAccount']['create'](_0x37a6b8['body'],{})[_0x1802('0x26')](respondWithResult(_0x41c8c3,0xc9))['catch'](handleError(_0x41c8c3,null));};exports[_0x1802('0x25')]=function(_0x5785ad,_0x141ba4){if(_0x5785ad[_0x1802('0x45')]['id']){delete _0x5785ad[_0x1802('0x45')]['id'];}return db[_0x1802('0x2c')][_0x1802('0x46')]({'where':{'id':_0x5785ad[_0x1802('0x44')]['id']}})[_0x1802('0x26')](handleEntityNotFound(_0x141ba4,null))[_0x1802('0x26')](saveUpdates(_0x5785ad[_0x1802('0x45')],null))[_0x1802('0x26')](respondWithResult(_0x141ba4,null))[_0x1802('0x47')](handleError(_0x141ba4,null));};exports[_0x1802('0x27')]=function(_0x8edb5c,_0x2ce764){return db['DeskAccount'][_0x1802('0x46')]({'where':{'id':_0x8edb5c[_0x1802('0x44')]['id']}})[_0x1802('0x26')](handleEntityNotFound(_0x2ce764,null))['then'](removeEntity(_0x2ce764,null))[_0x1802('0x47')](handleError(_0x2ce764,null));};exports[_0x1802('0x48')]=function(_0x42c5fa,_0x4832af,_0x5969e5){var _0x4d57b9={};var _0x1117da={};var _0x402c3c;var _0x31310f;return db['DeskAccount']['findOne']({'where':{'id':_0x42c5fa['params']['id']}})['then'](handleEntityNotFound(_0x4832af,null))[_0x1802('0x26')](function(_0x25f62f){if(_0x25f62f){_0x402c3c=_0x25f62f;_0x1117da[_0x1802('0x2f')]=_[_0x1802('0x32')](db[_0x1802('0x49')][_0x1802('0x2d')]);_0x1117da[_0x1802('0x31')]=_[_0x1802('0x32')](_0x42c5fa[_0x1802('0x31')]);_0x1117da[_0x1802('0x33')]=_[_0x1802('0x34')](_0x1117da['model'],_0x1117da[_0x1802('0x31')]);_0x4d57b9[_0x1802('0x35')]=_[_0x1802('0x34')](_0x1117da['model'],qs[_0x1802('0x36')](_0x42c5fa['query'][_0x1802('0x36')]));_0x4d57b9[_0x1802('0x35')]=_0x4d57b9[_0x1802('0x35')]['length']?_0x4d57b9[_0x1802('0x35')]:_0x1117da[_0x1802('0x2f')];_0x4d57b9[_0x1802('0x37')]=qs[_0x1802('0x38')](_0x42c5fa[_0x1802('0x31')][_0x1802('0x38')]);_0x4d57b9['where']=qs[_0x1802('0x33')](_[_0x1802('0x3a')](_0x42c5fa['query'],_0x1117da[_0x1802('0x33')]));if(_0x42c5fa[_0x1802('0x31')][_0x1802('0x3b')]){_0x4d57b9[_0x1802('0x39')]=_[_0x1802('0x3c')](_0x4d57b9[_0x1802('0x39')],{'$or':_[_0x1802('0x30')](_0x4d57b9[_0x1802('0x35')],function(_0x41e711){var _0x38a9e4={};_0x38a9e4[_0x41e711]={'$like':'%'+_0x42c5fa[_0x1802('0x31')]['filter']+'%'};return _0x38a9e4;})});}_0x4d57b9=_[_0x1802('0x3c')]({},_0x4d57b9,_0x42c5fa[_0x1802('0x3e')]);return _0x402c3c[_0x1802('0x48')](_0x4d57b9);}})[_0x1802('0x26')](function(_0x5bc1bd){if(_0x5bc1bd){_0x31310f=_0x5bc1bd[_0x1802('0x4a')];if(!_0x42c5fa[_0x1802('0x31')][_0x1802('0x4b')](_0x1802('0x4c'))){_0x4d57b9[_0x1802('0x1f')]=qs[_0x1802('0x1f')](_0x42c5fa['query']['limit']);_0x4d57b9[_0x1802('0x20')]=qs[_0x1802('0x20')](_0x42c5fa[_0x1802('0x31')][_0x1802('0x20')]);}return _0x402c3c[_0x1802('0x48')](_0x4d57b9);}})[_0x1802('0x26')](function(_0x3c19b8){if(_0x3c19b8){return _0x3c19b8?{'count':_0x31310f,'rows':_0x3c19b8}:null;}})[_0x1802('0x26')](respondWithResult(_0x4832af,null))['catch'](handleError(_0x4832af,null));};exports['addConfiguration']=function(_0x4814eb,_0x2e2c37,_0x34238a){if(_0x4814eb[_0x1802('0x45')]['id']){delete _0x4814eb[_0x1802('0x45')]['id'];}return db[_0x1802('0x2c')][_0x1802('0x4d')]({'where':{'id':_0x4814eb[_0x1802('0x44')]['id']}})[_0x1802('0x26')](handleEntityNotFound(_0x2e2c37,null))[_0x1802('0x26')](function(_0x4c36b6){if(_0x4c36b6){_0x4814eb[_0x1802('0x45')]['AccountId']=_0x4c36b6['id'];_0x4814eb[_0x1802('0x45')][_0x1802('0x4e')]=integrations[_0x1802('0x4f')](_0x4814eb['body']['channel'],_0x4814eb[_0x1802('0x45')][_0x1802('0x2e')]);_0x4814eb['body']['Descriptions']=integrations[_0x1802('0x50')](_0x4814eb[_0x1802('0x45')]['channel'],_0x4814eb[_0x1802('0x45')][_0x1802('0x2e')]);return db['DeskConfiguration'][_0x1802('0x51')](_0x4814eb['body'],{'include':[{'model':db['DeskField'],'as':'Subjects'},{'model':db[_0x1802('0x52')],'as':'Descriptions'}]});}return null;})[_0x1802('0x26')](respondWithResult(_0x2e2c37,null))['catch'](handleError(_0x2e2c37,null));};exports[_0x1802('0x53')]=function(_0x3b6cbb,_0x5c611,_0x2f9cc5){var _0x2be473=[{'name':'priority','label':_0x1802('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 _0x223d4d='';return db[_0x1802('0x2c')][_0x1802('0x4d')]({'where':{'id':_0x3b6cbb[_0x1802('0x44')]['id']},'attributes':['id',_0x1802('0x55'),'authType',_0x1802('0x56'),_0x1802('0x57'),_0x1802('0x58'),'consumerSecret',_0x1802('0x59'),'tokenSecret']})[_0x1802('0x26')](handleEntityNotFound(_0x5c611,null))[_0x1802('0x26')](function(_0x28286c){if(_0x28286c){_0x223d4d=_0x28286c[_0x1802('0x55')];var _0x4ff218=_0x223d4d[_0x1802('0x5a')](-0x1);if(_0x4ff218==='/'){_0x223d4d=_0x223d4d[_0x1802('0x5b')](0x0,_0x223d4d[_0x1802('0x5c')](_0x4ff218));}var _0x6b71e={'method':_0x1802('0x5d'),'uri':util[_0x1802('0x5e')](_0x1802('0x5f'),_0x223d4d),'headers':{'Content-Type':_0x1802('0x60'),'Accept':'application/json'},'json':!![]};if(_0x28286c[_0x1802('0x61')]===_0x1802('0x62')){_0x6b71e[_0x1802('0x63')][_0x1802('0x64')]=util[_0x1802('0x5e')]('Basic\x20%s',new Buffer(util['format'](_0x1802('0x65'),_0x28286c[_0x1802('0x56')],_0x28286c[_0x1802('0x57')]))[_0x1802('0x66')](_0x1802('0x67')));}return rp(_0x6b71e)['then'](function(_0x598aa8){return _0x2be473['concat'](_[_0x1802('0x30')](_0x598aa8['_embedded']['entries'],function(_0x14c81f){return{'id':_0x14c81f[_0x1802('0x29')],'name':_0x14c81f[_0x1802('0x29')],'type':_0x14c81f['type'],'active':_0x14c81f[_0x1802('0x68')],'label':_0x14c81f[_0x1802('0x69')],'custom':!![]};}));});}})[_0x1802('0x26')](function(_0x2f0d2f){return{'count':_0x2f0d2f[_0x1802('0x4a')],'rows':_0x2f0d2f};})[_0x1802('0x26')](respondWithResult(_0x5c611,null))[_0x1802('0x47')](function(_0x33b280){var _0x180e04=_0x3b6cbb['query'][_0x1802('0x6a')]?0x1f4:_0x33b280[_0x1802('0x6b')]||0x1f4;logger[_0x1802('0x28')](_0x1802('0x6c'),_0x1802('0x53'),_0x180e04,JSON[_0x1802('0x6d')](_0x33b280));delete _0x33b280[_0x1802('0x29')];if(_0x180e04===0x191){_0x180e04=0x190;}_0x5c611['status'](_0x180e04)[_0x1802('0x2a')](_0x3b6cbb[_0x1802('0x31')][_0x1802('0x6a')]?{'message':_0x1802('0x6e'),'statusCode':_0x33b280[_0x1802('0x6b')]}:_0x33b280);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index d9a1a17..23c5dd5 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 _0x2020=['DeskAccount','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','../../components/integrations/configuration','exports'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x2020,0x6d));var _0x0202=function(_0x44c544,_0x31b339){_0x44c544=_0x44c544-0x0;var _0x840821=_0x2020[_0x44c544];return _0x840821;};'use strict';var _=require(_0x0202('0x0'));var util=require(_0x0202('0x1'));var logger=require(_0x0202('0x2'))(_0x0202('0x3'));var moment=require(_0x0202('0x4'));var BPromise=require(_0x0202('0x5'));var rp=require(_0x0202('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0202('0x7'));var config=require(_0x0202('0x8'));var attributes=require('./intDeskAccount.attributes');var integrations=require(_0x0202('0x9'));module[_0x0202('0xa')]=function(_0x3c3810,_0x4c3ee7){return _0x3c3810['define'](_0x0202('0xb'),attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1696=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','DeskAccount','int_desk_accounts','util','../../config/logger'];(function(_0x547a83,_0xd660d2){var _0x2e78ae=function(_0x30d452){while(--_0x30d452){_0x547a83['push'](_0x547a83['shift']());}};_0x2e78ae(++_0xd660d2);}(_0x1696,0x85));var _0x6169=function(_0x3cc505,_0x20616a){_0x3cc505=_0x3cc505-0x0;var _0x393d8e=_0x1696[_0x3cc505];return _0x393d8e;};'use strict';var _=require('lodash');var util=require(_0x6169('0x0'));var logger=require(_0x6169('0x1'))(_0x6169('0x2'));var moment=require(_0x6169('0x3'));var BPromise=require(_0x6169('0x4'));var rp=require(_0x6169('0x5'));var fs=require('fs');var path=require(_0x6169('0x6'));var rimraf=require(_0x6169('0x7'));var config=require(_0x6169('0x8'));var attributes=require(_0x6169('0x9'));var integrations=require(_0x6169('0xa'));module[_0x6169('0xb')]=function(_0x50f1ef,_0x470a09){return _0x50f1ef[_0x6169('0xc')](_0x6169('0xd'),attributes,{'tableName':_0x6169('0xe'),'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 ca87525..2bbe85f 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 _0xd09c=['find','raw','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','debug','DeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','DeskAccount','findAll','options','where','limit','include','map','model','attributes','GetDeskAccount','ShowDeskAccount'];(function(_0x36b037,_0x2b234e){var _0x409194=function(_0xddc9dc){while(--_0xddc9dc){_0x36b037['push'](_0x36b037['shift']());}};_0x409194(++_0x2b234e);}(_0xd09c,0x174));var _0xcd09=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd09c[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xcd09('0x0'));var rs=require(_0xcd09('0x1'));var fs=require('fs');var Redis=require(_0xcd09('0x2'));var db=require(_0xcd09('0x3'))['db'];var utils=require(_0xcd09('0x4'));var logger=require(_0xcd09('0x5'))(_0xcd09('0x6'));var config=require(_0xcd09('0x7'));var jayson=require(_0xcd09('0x8'));var client=jayson[_0xcd09('0x9')][_0xcd09('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x8b883,_0x43ab82,_0x13f3d2){return new BPromise(function(_0x4d7793,_0x2656fb){return client[_0xcd09('0xb')](_0x8b883,_0x13f3d2)[_0xcd09('0xc')](function(_0xbc15e1){logger[_0xcd09('0xd')](_0xcd09('0xe'),_0x43ab82,'request\x20sent');logger[_0xcd09('0xf')](_0xcd09('0x10'),_0x43ab82,_0xcd09('0x11'),JSON[_0xcd09('0x12')](_0xbc15e1));if(_0xbc15e1[_0xcd09('0x13')]){if(_0xbc15e1[_0xcd09('0x13')][_0xcd09('0x14')]===0x1f4){logger[_0xcd09('0x13')]('DeskAccount,\x20%s,\x20%s',_0x43ab82,_0xbc15e1[_0xcd09('0x13')][_0xcd09('0x15')]);return _0x2656fb(_0xbc15e1[_0xcd09('0x13')]['message']);}logger['error'](_0xcd09('0xe'),_0x43ab82,_0xbc15e1[_0xcd09('0x13')][_0xcd09('0x15')]);return _0x4d7793(_0xbc15e1['error']['message']);}else{logger['info'](_0xcd09('0xe'),_0x43ab82,_0xcd09('0x11'));_0x4d7793(_0xbc15e1[_0xcd09('0x16')][_0xcd09('0x15')]);}})[_0xcd09('0x17')](function(_0x5da980){logger[_0xcd09('0x13')](_0xcd09('0xe'),_0x43ab82,_0x5da980);_0x2656fb(_0x5da980);});});}exports['GetDeskAccount']=function(_0x37e5b6){var _0x1442d9=this;return new Promise(function(_0x21dd8b,_0x5dcf56){return db[_0xcd09('0x18')][_0xcd09('0x19')]({'raw':_0x37e5b6['options']?_0x37e5b6[_0xcd09('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x37e5b6[_0xcd09('0x1a')]?_0x37e5b6[_0xcd09('0x1a')][_0xcd09('0x1b')]||null:null,'attributes':_0x37e5b6[_0xcd09('0x1a')]?_0x37e5b6['options']['attributes']||null:null,'limit':_0x37e5b6[_0xcd09('0x1a')]?_0x37e5b6[_0xcd09('0x1a')][_0xcd09('0x1c')]||null:null,'include':_0x37e5b6[_0xcd09('0x1a')]?_0x37e5b6[_0xcd09('0x1a')][_0xcd09('0x1d')]?_[_0xcd09('0x1e')](_0x37e5b6[_0xcd09('0x1a')][_0xcd09('0x1d')],function(_0x27ec0f){return{'model':db[_0x27ec0f[_0xcd09('0x1f')]],'as':_0x27ec0f['as'],'attributes':_0x27ec0f[_0xcd09('0x20')],'include':_0x27ec0f[_0xcd09('0x1d')]?_[_0xcd09('0x1e')](_0x27ec0f[_0xcd09('0x1d')],function(_0x43c11a){return{'model':db[_0x43c11a[_0xcd09('0x1f')]],'as':_0x43c11a['as'],'attributes':_0x43c11a[_0xcd09('0x20')],'include':_0x43c11a[_0xcd09('0x1d')]?_[_0xcd09('0x1e')](_0x43c11a[_0xcd09('0x1d')],function(_0x5608f3){return{'model':db[_0x5608f3[_0xcd09('0x1f')]],'as':_0x5608f3['as'],'attributes':_0x5608f3[_0xcd09('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2dee2b){logger['info'](_0xcd09('0x21'),_0x37e5b6);logger[_0xcd09('0xf')](_0xcd09('0x21'),_0x37e5b6,JSON[_0xcd09('0x12')](_0x2dee2b));_0x21dd8b(_0x2dee2b);})['catch'](function(_0x10c44f){logger[_0xcd09('0x13')](_0xcd09('0x21'),_0x10c44f['message'],_0x37e5b6);_0x5dcf56(_0x1442d9['error'](0x1f4,_0x10c44f[_0xcd09('0x15')]));});});};exports[_0xcd09('0x22')]=function(_0x1b7eee){var _0x3eda85=this;return new Promise(function(_0x238724,_0x494cae){return db[_0xcd09('0x18')][_0xcd09('0x23')]({'raw':_0x1b7eee[_0xcd09('0x1a')]?_0x1b7eee['options'][_0xcd09('0x24')]===undefined?!![]:![]:!![],'where':_0x1b7eee[_0xcd09('0x1a')]?_0x1b7eee[_0xcd09('0x1a')]['where']||null:null,'attributes':_0x1b7eee[_0xcd09('0x1a')]?_0x1b7eee[_0xcd09('0x1a')][_0xcd09('0x20')]||null:null,'include':_0x1b7eee[_0xcd09('0x1a')]?_0x1b7eee[_0xcd09('0x1a')]['include']?_[_0xcd09('0x1e')](_0x1b7eee[_0xcd09('0x1a')][_0xcd09('0x1d')],function(_0x191af0){return{'model':db[_0x191af0['model']],'as':_0x191af0['as'],'attributes':_0x191af0['attributes'],'include':_0x191af0['include']?_['map'](_0x191af0[_0xcd09('0x1d')],function(_0x43285c){return{'model':db[_0x43285c[_0xcd09('0x1f')]],'as':_0x43285c['as'],'attributes':_0x43285c[_0xcd09('0x20')],'include':_0x43285c[_0xcd09('0x1d')]?_['map'](_0x43285c[_0xcd09('0x1d')],function(_0x4d08aa){return{'model':db[_0x4d08aa[_0xcd09('0x1f')]],'as':_0x4d08aa['as'],'attributes':_0x4d08aa[_0xcd09('0x20')]};}):[]};}):[]};}):[]:[]})[_0xcd09('0xc')](function(_0x233e9e){logger[_0xcd09('0xd')](_0xcd09('0x22'),_0x1b7eee);logger[_0xcd09('0xf')](_0xcd09('0x22'),_0x1b7eee,JSON[_0xcd09('0x12')](_0x233e9e));_0x238724(_0x233e9e);})['catch'](function(_0x2e02be){logger[_0xcd09('0x13')]('ShowDeskAccount',_0x2e02be[_0xcd09('0x15')],_0x1b7eee);_0x494cae(_0x3eda85[_0xcd09('0x13')](0x1f4,_0x2e02be[_0xcd09('0x15')]));});});}; \ No newline at end of file +var _0x2506=['GetDeskAccount','DeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowDeskAccount','find','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','then','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch'];(function(_0x13a18a,_0x50d904){var _0x6e827c=function(_0x7c74cb){while(--_0x7c74cb){_0x13a18a['push'](_0x13a18a['shift']());}};_0x6e827c(++_0x50d904);}(_0x2506,0xb7));var _0x6250=function(_0x4c7828,_0x4557fb){_0x4c7828=_0x4c7828-0x0;var _0x38e727=_0x2506[_0x4c7828];return _0x38e727;};'use strict';var _=require('lodash');var util=require(_0x6250('0x0'));var moment=require(_0x6250('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6250('0x2'));var db=require(_0x6250('0x3'))['db'];var utils=require(_0x6250('0x4'));var logger=require(_0x6250('0x5'))(_0x6250('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x6250('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x411c34,_0x1179ae,_0x383852){return new BPromise(function(_0x2ae42b,_0x14cab4){return client[_0x6250('0x8')](_0x411c34,_0x383852)[_0x6250('0x9')](function(_0x2611bf){logger['info'](_0x6250('0xa'),_0x1179ae,_0x6250('0xb'));logger[_0x6250('0xc')](_0x6250('0xd'),_0x1179ae,_0x6250('0xb'),JSON[_0x6250('0xe')](_0x2611bf));if(_0x2611bf[_0x6250('0xf')]){if(_0x2611bf['error'][_0x6250('0x10')]===0x1f4){logger[_0x6250('0xf')](_0x6250('0xa'),_0x1179ae,_0x2611bf[_0x6250('0xf')][_0x6250('0x11')]);return _0x14cab4(_0x2611bf['error'][_0x6250('0x11')]);}logger[_0x6250('0xf')](_0x6250('0xa'),_0x1179ae,_0x2611bf[_0x6250('0xf')][_0x6250('0x11')]);return _0x2ae42b(_0x2611bf[_0x6250('0xf')][_0x6250('0x11')]);}else{logger[_0x6250('0x12')](_0x6250('0xa'),_0x1179ae,'request\x20sent');_0x2ae42b(_0x2611bf[_0x6250('0x13')][_0x6250('0x11')]);}})[_0x6250('0x14')](function(_0x168504){logger[_0x6250('0xf')](_0x6250('0xa'),_0x1179ae,_0x168504);_0x14cab4(_0x168504);});});}exports[_0x6250('0x15')]=function(_0x50824f){var _0x47420f=this;return new Promise(function(_0x51b98d,_0x399bd3){return db[_0x6250('0x16')][_0x6250('0x17')]({'raw':_0x50824f['options']?_0x50824f[_0x6250('0x18')][_0x6250('0x19')]===undefined?!![]:![]:!![],'where':_0x50824f[_0x6250('0x18')]?_0x50824f[_0x6250('0x18')][_0x6250('0x1a')]||null:null,'attributes':_0x50824f['options']?_0x50824f[_0x6250('0x18')][_0x6250('0x1b')]||null:null,'limit':_0x50824f[_0x6250('0x18')]?_0x50824f[_0x6250('0x18')][_0x6250('0x1c')]||null:null,'include':_0x50824f['options']?_0x50824f[_0x6250('0x18')][_0x6250('0x1d')]?_[_0x6250('0x1e')](_0x50824f[_0x6250('0x18')][_0x6250('0x1d')],function(_0x344499){return{'model':db[_0x344499[_0x6250('0x1f')]],'as':_0x344499['as'],'attributes':_0x344499['attributes'],'include':_0x344499[_0x6250('0x1d')]?_['map'](_0x344499[_0x6250('0x1d')],function(_0x1cff54){return{'model':db[_0x1cff54[_0x6250('0x1f')]],'as':_0x1cff54['as'],'attributes':_0x1cff54[_0x6250('0x1b')],'include':_0x1cff54[_0x6250('0x1d')]?_[_0x6250('0x1e')](_0x1cff54['include'],function(_0x2bc81e){return{'model':db[_0x2bc81e['model']],'as':_0x2bc81e['as'],'attributes':_0x2bc81e[_0x6250('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x6250('0x9')](function(_0x271f64){logger[_0x6250('0x12')]('GetDeskAccount',_0x50824f);logger['debug'](_0x6250('0x15'),_0x50824f,JSON[_0x6250('0xe')](_0x271f64));_0x51b98d(_0x271f64);})[_0x6250('0x14')](function(_0x3877f6){logger[_0x6250('0xf')](_0x6250('0x15'),_0x3877f6['message'],_0x50824f);_0x399bd3(_0x47420f[_0x6250('0xf')](0x1f4,_0x3877f6['message']));});});};exports[_0x6250('0x20')]=function(_0x547240){var _0x127663=this;return new Promise(function(_0x5ca06b,_0x11a517){return db[_0x6250('0x16')][_0x6250('0x21')]({'raw':_0x547240[_0x6250('0x18')]?_0x547240[_0x6250('0x18')][_0x6250('0x19')]===undefined?!![]:![]:!![],'where':_0x547240[_0x6250('0x18')]?_0x547240[_0x6250('0x18')][_0x6250('0x1a')]||null:null,'attributes':_0x547240['options']?_0x547240[_0x6250('0x18')][_0x6250('0x1b')]||null:null,'include':_0x547240[_0x6250('0x18')]?_0x547240['options']['include']?_[_0x6250('0x1e')](_0x547240[_0x6250('0x18')][_0x6250('0x1d')],function(_0x19f9cb){return{'model':db[_0x19f9cb['model']],'as':_0x19f9cb['as'],'attributes':_0x19f9cb[_0x6250('0x1b')],'include':_0x19f9cb[_0x6250('0x1d')]?_['map'](_0x19f9cb[_0x6250('0x1d')],function(_0x1a0eca){return{'model':db[_0x1a0eca[_0x6250('0x1f')]],'as':_0x1a0eca['as'],'attributes':_0x1a0eca[_0x6250('0x1b')],'include':_0x1a0eca[_0x6250('0x1d')]?_[_0x6250('0x1e')](_0x1a0eca[_0x6250('0x1d')],function(_0xd6cce7){return{'model':db[_0xd6cce7[_0x6250('0x1f')]],'as':_0xd6cce7['as'],'attributes':_0xd6cce7[_0x6250('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x139f11){logger[_0x6250('0x12')](_0x6250('0x20'),_0x547240);logger['debug'](_0x6250('0x20'),_0x547240,JSON['stringify'](_0x139f11));_0x5ca06b(_0x139f11);})[_0x6250('0x14')](function(_0x4e20ee){logger[_0x6250('0xf')](_0x6250('0x20'),_0x4e20ee[_0x6250('0x11')],_0x547240);_0x11a517(_0x127663[_0x6250('0xf')](0x1f4,_0x4e20ee[_0x6250('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 1b43031..3e37eee 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 _0x9957=['/:id/subjects','getSubjects','getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields'];(function(_0x38111c,_0x222a63){var _0x2adb35=function(_0x5cea28){while(--_0x5cea28){_0x38111c['push'](_0x38111c['shift']());}};_0x2adb35(++_0x222a63);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/fields',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/descriptions',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x14')]('/:id/tags',auth['isAuthenticated'](),controller[_0x7995('0x16')]);router[_0x7995('0x17')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller['destroy']);module[_0x7995('0x1a')]=router; \ No newline at end of file +var _0xedd9=['getTags','post','create','setTags','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getSubjects','/:id/descriptions','/:id/tags'];(function(_0x1589d8,_0x38292f){var _0xf054b=function(_0x1c52f0){while(--_0x1c52f0){_0x1589d8['push'](_0x1589d8['shift']());}};_0xf054b(++_0x38292f);}(_0xedd9,0xfc));var _0x9edd=function(_0x4a6ee6,_0x58bbfa){_0x4a6ee6=_0x4a6ee6-0x0;var _0x219600=_0xedd9[_0x4a6ee6];return _0x219600;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0x9')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller['getFields']);router[_0x9edd('0x9')]('/:id/subjects',auth[_0x9edd('0xa')](),controller[_0x9edd('0xf')]);router['get'](_0x9edd('0x10'),auth[_0x9edd('0xa')](),controller['getDescriptions']);router[_0x9edd('0x9')](_0x9edd('0x11'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);router[_0x9edd('0x13')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0x14')]);router[_0x9edd('0x13')]('/:id/tags',auth[_0x9edd('0xa')](),controller[_0x9edd('0x15')]);router[_0x9edd('0x16')](_0x9edd('0xc'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x17')]);router[_0x9edd('0x18')](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0x19')]);module[_0x9edd('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index d7b4c06..1108aaa 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 _0x9f2e=['STRING','sequelize'];(function(_0x488560,_0x25ad31){var _0x4f38e1=function(_0x184686){while(--_0x184686){_0x488560['push'](_0x488560['shift']());}};_0x4f38e1(++_0x25ad31);}(_0x9f2e,0x1bb));var _0xe9f2=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x9f2e[_0x3bf83f];return _0x22c4a9;};'use strict';var Sequelize=require(_0xe9f2('0x0'));module['exports']={'name':{'type':Sequelize[_0xe9f2('0x1')]},'description':{'type':Sequelize[_0xe9f2('0x1')]}}; \ No newline at end of file +var _0x919a=['exports','sequelize'];(function(_0x22b08c,_0x191b7c){var _0xc71b1=function(_0x4a40fb){while(--_0x4a40fb){_0x22b08c['push'](_0x22b08c['shift']());}};_0xc71b1(++_0x191b7c);}(_0x919a,0x1e7));var _0xa919=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0x919a[_0x24f31b];return _0x488401;};'use strict';var Sequelize=require(_0xa919('0x0'));module[_0xa919('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 1573d66..242dfa4 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 _0x590d=['ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','reject','save','then','destroy','end','error','stack','name','send','index','map','DeskConfiguration','fieldName','key','model','query','keys','intersection','attributes','fields','length','nolimit','sort','where','pick','merge','type','filter','options','includeAll','findAll','rows','catch','show','params','filters','include','find','body','update','getFields','DeskField','rawAttributes','getSubjects','findOne','order','hasOwnProperty','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x3572f7,_0x2d0a35){var _0xaaf04b=function(_0x1202ad){while(--_0x1202ad){_0x3572f7['push'](_0x3572f7['shift']());}};_0xaaf04b(++_0x2d0a35);}(_0x590d,0x141));var _0xd590=function(_0x598b6f,_0x55690f){_0x598b6f=_0x598b6f-0x0;var _0x40959f=_0x590d[_0x598b6f];return _0x40959f;};'use strict';var emlformat=require(_0xd590('0x0'));var rimraf=require(_0xd590('0x1'));var zipdir=require(_0xd590('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd590('0x3'));var moment=require(_0xd590('0x4'));var BPromise=require(_0xd590('0x5'));var Mustache=require(_0xd590('0x6'));var util=require(_0xd590('0x7'));var path=require(_0xd590('0x8'));var sox=require(_0xd590('0x9'));var csv=require(_0xd590('0xa'));var ejs=require(_0xd590('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd590('0xc'));var squel=require(_0xd590('0xd'));var crypto=require(_0xd590('0xe'));var jsforce=require(_0xd590('0xf'));var deskjs=require(_0xd590('0x10'));var toCsv=require(_0xd590('0xa'));var querystring=require(_0xd590('0x11'));var Papa=require(_0xd590('0x12'));var Redis=require(_0xd590('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xd590('0x14'));var as=require(_0xd590('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd590('0x16'))(_0xd590('0x17'));var utils=require(_0xd590('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xd590('0x19'))['db'];function respondWithStatusCode(_0x222b41,_0x20742f){_0x20742f=_0x20742f||0xcc;return function(_0x5075f8){if(_0x5075f8){return _0x222b41[_0xd590('0x1a')](_0x20742f);}return _0x222b41[_0xd590('0x1b')](_0x20742f)['end']();};}function respondWithResult(_0x39a85c,_0x57e1e3){_0x57e1e3=_0x57e1e3||0xc8;return function(_0x45951f){if(_0x45951f){return _0x39a85c[_0xd590('0x1b')](_0x57e1e3)['json'](_0x45951f);}};}function respondWithFilteredResult(_0x21c90c,_0x584945){return function(_0x4e0bcd){if(_0x4e0bcd){var _0xdad755=typeof _0x584945[_0xd590('0x1c')]===_0xd590('0x1d')&&typeof _0x584945[_0xd590('0x1e')]==='undefined';var _0x3c23ff=_0x4e0bcd[_0xd590('0x1f')];var _0x406528=_0xdad755?0x0:_0x584945['offset'];var _0x51a950=_0xdad755?_0x4e0bcd['count']:_0x584945[_0xd590('0x1c')]+_0x584945[_0xd590('0x1e')];var _0x2b52b0;if(_0x51a950>=_0x3c23ff){_0x51a950=_0x3c23ff;_0x2b52b0=0xc8;}else{_0x2b52b0=0xce;}_0x21c90c['status'](_0x2b52b0);return _0x21c90c[_0xd590('0x20')]('Content-Range',_0x406528+'-'+_0x51a950+'/'+_0x3c23ff)['json'](_0x4e0bcd);}return null;};}function patchUpdates(_0x48693e){return function(_0x86f030){try{jsonpatch['apply'](_0x86f030,_0x48693e,!![]);}catch(_0x1ddc87){return BPromise[_0xd590('0x21')](_0x1ddc87);}return _0x86f030[_0xd590('0x22')]();};}function saveUpdates(_0xc66c6f,_0x3b31f9){return function(_0x99de68){if(_0x99de68){return _0x99de68['update'](_0xc66c6f)[_0xd590('0x23')](function(_0x13a92d){return _0x13a92d;});}return null;};}function removeEntity(_0x596104,_0x527b19){return function(_0x268c78){if(_0x268c78){return _0x268c78[_0xd590('0x24')]()[_0xd590('0x23')](function(){_0x596104['status'](0xcc)[_0xd590('0x25')]();});}};}function handleEntityNotFound(_0x457e41,_0x2ad41e){return function(_0x2b7d4c){if(!_0x2b7d4c){_0x457e41[_0xd590('0x1a')](0x194);}return _0x2b7d4c;};}function handleError(_0x44a0d7,_0x5784e7){_0x5784e7=_0x5784e7||0x1f4;return function(_0xd0633c){logger[_0xd590('0x26')](_0xd0633c[_0xd590('0x27')]);if(_0xd0633c[_0xd590('0x28')]){delete _0xd0633c['name'];}_0x44a0d7[_0xd590('0x1b')](_0x5784e7)[_0xd590('0x29')](_0xd0633c);};}exports[_0xd590('0x2a')]=function(_0x57177a,_0x344f93){var _0x47699f={},_0x542b1b={},_0x5c319a={'count':0x0,'rows':[]};var _0x544fa4=_[_0xd590('0x2b')](db[_0xd590('0x2c')]['rawAttributes'],function(_0x39f7bb){return{'name':_0x39f7bb[_0xd590('0x2d')],'type':_0x39f7bb['type'][_0xd590('0x2e')]};});_0x542b1b[_0xd590('0x2f')]=_[_0xd590('0x2b')](_0x544fa4,_0xd590('0x28'));_0x542b1b[_0xd590('0x30')]=_[_0xd590('0x31')](_0x57177a[_0xd590('0x30')]);_0x542b1b['filters']=_[_0xd590('0x32')](_0x542b1b[_0xd590('0x2f')],_0x542b1b[_0xd590('0x30')]);_0x47699f[_0xd590('0x33')]=_[_0xd590('0x32')](_0x542b1b[_0xd590('0x2f')],qs[_0xd590('0x34')](_0x57177a[_0xd590('0x30')][_0xd590('0x34')]));_0x47699f[_0xd590('0x33')]=_0x47699f['attributes'][_0xd590('0x35')]?_0x47699f[_0xd590('0x33')]:_0x542b1b[_0xd590('0x2f')];if(!_0x57177a[_0xd590('0x30')]['hasOwnProperty'](_0xd590('0x36'))){_0x47699f['limit']=qs[_0xd590('0x1e')](_0x57177a[_0xd590('0x30')]['limit']);_0x47699f[_0xd590('0x1c')]=qs[_0xd590('0x1c')](_0x57177a[_0xd590('0x30')]['offset']);}_0x47699f['order']=qs[_0xd590('0x37')](_0x57177a[_0xd590('0x30')][_0xd590('0x37')]);_0x47699f[_0xd590('0x38')]=qs['filters'](_[_0xd590('0x39')](_0x57177a[_0xd590('0x30')],_0x542b1b['filters']),_0x544fa4);if(_0x57177a['query']['filter']){_0x47699f[_0xd590('0x38')]=_[_0xd590('0x3a')](_0x47699f[_0xd590('0x38')],{'$or':_[_0xd590('0x2b')](_0x544fa4,function(_0x3076ad){if(_0x3076ad[_0xd590('0x3b')]!=='VIRTUAL'){var _0x45efec={};_0x45efec[_0x3076ad[_0xd590('0x28')]]={'$like':'%'+_0x57177a[_0xd590('0x30')][_0xd590('0x3c')]+'%'};return _0x45efec;}})});}_0x47699f=_['merge']({},_0x47699f,_0x57177a[_0xd590('0x3d')]);var _0x1900d5={'where':_0x47699f['where']};return db[_0xd590('0x2c')][_0xd590('0x1f')](_0x1900d5)[_0xd590('0x23')](function(_0x2258e1){_0x5c319a['count']=_0x2258e1;if(_0x57177a[_0xd590('0x30')][_0xd590('0x3e')]){_0x47699f['include']=[{'all':!![]}];}return db[_0xd590('0x2c')][_0xd590('0x3f')](_0x47699f);})[_0xd590('0x23')](function(_0x4b4a1a){_0x5c319a[_0xd590('0x40')]=_0x4b4a1a;return _0x5c319a;})[_0xd590('0x23')](respondWithFilteredResult(_0x344f93,_0x47699f))[_0xd590('0x41')](handleError(_0x344f93,null));};exports[_0xd590('0x42')]=function(_0xf1b6e,_0x42ff82){var _0x2284a1={'raw':![],'where':{'id':_0xf1b6e[_0xd590('0x43')]['id']}},_0x371700={};_0x371700[_0xd590('0x2f')]=_[_0xd590('0x31')](db[_0xd590('0x2c')]['rawAttributes']);_0x371700[_0xd590('0x30')]=_[_0xd590('0x31')](_0xf1b6e['query']);_0x371700[_0xd590('0x44')]=_['intersection'](_0x371700[_0xd590('0x2f')],_0x371700[_0xd590('0x30')]);_0x2284a1[_0xd590('0x33')]=_[_0xd590('0x32')](_0x371700[_0xd590('0x2f')],qs[_0xd590('0x34')](_0xf1b6e[_0xd590('0x30')][_0xd590('0x34')]));_0x2284a1['attributes']=_0x2284a1[_0xd590('0x33')]['length']?_0x2284a1['attributes']:_0x371700[_0xd590('0x2f')];if(_0xf1b6e[_0xd590('0x30')][_0xd590('0x3e')]){_0x2284a1[_0xd590('0x45')]=[{'all':!![]}];}_0x2284a1=_[_0xd590('0x3a')]({},_0x2284a1,_0xf1b6e[_0xd590('0x3d')]);return db[_0xd590('0x2c')][_0xd590('0x46')](_0x2284a1)[_0xd590('0x23')](handleEntityNotFound(_0x42ff82,null))[_0xd590('0x23')](respondWithResult(_0x42ff82,null))['catch'](handleError(_0x42ff82,null));};exports['create']=function(_0xcd8371,_0x5ddc22){return db[_0xd590('0x2c')]['create'](_0xcd8371[_0xd590('0x47')],{})[_0xd590('0x23')](respondWithResult(_0x5ddc22,0xc9))[_0xd590('0x41')](handleError(_0x5ddc22,null));};exports[_0xd590('0x48')]=function(_0x900c51,_0x3d1833){if(_0x900c51[_0xd590('0x47')]['id']){delete _0x900c51[_0xd590('0x47')]['id'];}return db[_0xd590('0x2c')][_0xd590('0x46')]({'where':{'id':_0x900c51[_0xd590('0x43')]['id']}})[_0xd590('0x23')](handleEntityNotFound(_0x3d1833,null))[_0xd590('0x23')](saveUpdates(_0x900c51[_0xd590('0x47')],null))[_0xd590('0x23')](respondWithResult(_0x3d1833,null))[_0xd590('0x41')](handleError(_0x3d1833,null));};exports[_0xd590('0x24')]=function(_0x31f39e,_0x6bf28c){return db[_0xd590('0x2c')][_0xd590('0x46')]({'where':{'id':_0x31f39e[_0xd590('0x43')]['id']}})[_0xd590('0x23')](handleEntityNotFound(_0x6bf28c,null))['then'](removeEntity(_0x6bf28c,null))[_0xd590('0x41')](handleError(_0x6bf28c,null));};exports[_0xd590('0x49')]=function(_0x110a26,_0x527234,_0x36c65c){var _0x4edc60={};var _0x498386={};var _0x3a57c5;var _0x308098;return db['DeskConfiguration']['findOne']({'where':{'id':_0x110a26['params']['id']}})['then'](handleEntityNotFound(_0x527234,null))[_0xd590('0x23')](function(_0x56b5a0){if(_0x56b5a0){_0x3a57c5=_0x56b5a0;_0x498386[_0xd590('0x2f')]=_[_0xd590('0x31')](db[_0xd590('0x4a')][_0xd590('0x4b')]);_0x498386[_0xd590('0x30')]=_[_0xd590('0x31')](_0x110a26[_0xd590('0x30')]);_0x498386['filters']=_[_0xd590('0x32')](_0x498386[_0xd590('0x2f')],_0x498386[_0xd590('0x30')]);_0x4edc60[_0xd590('0x33')]=_[_0xd590('0x32')](_0x498386['model'],qs['fields'](_0x110a26[_0xd590('0x30')][_0xd590('0x34')]));_0x4edc60[_0xd590('0x33')]=_0x4edc60[_0xd590('0x33')][_0xd590('0x35')]?_0x4edc60[_0xd590('0x33')]:_0x498386[_0xd590('0x2f')];_0x4edc60['order']=qs[_0xd590('0x37')](_0x110a26[_0xd590('0x30')][_0xd590('0x37')]);_0x4edc60[_0xd590('0x38')]=qs[_0xd590('0x44')](_['pick'](_0x110a26['query'],_0x498386['filters']));if(_0x110a26[_0xd590('0x30')][_0xd590('0x3c')]){_0x4edc60[_0xd590('0x38')]=_[_0xd590('0x3a')](_0x4edc60[_0xd590('0x38')],{'$or':_['map'](_0x4edc60[_0xd590('0x33')],function(_0x552a77){var _0x21423d={};_0x21423d[_0x552a77]={'$like':'%'+_0x110a26[_0xd590('0x30')]['filter']+'%'};return _0x21423d;})});}_0x4edc60=_[_0xd590('0x3a')]({},_0x4edc60,_0x110a26[_0xd590('0x3d')]);return _0x3a57c5[_0xd590('0x49')](_0x4edc60);}})[_0xd590('0x23')](function(_0x3c3cf3){if(_0x3c3cf3){_0x308098=_0x3c3cf3[_0xd590('0x35')];if(!_0x110a26[_0xd590('0x30')]['hasOwnProperty']('nolimit')){_0x4edc60[_0xd590('0x1e')]=qs[_0xd590('0x1e')](_0x110a26['query'][_0xd590('0x1e')]);_0x4edc60[_0xd590('0x1c')]=qs[_0xd590('0x1c')](_0x110a26[_0xd590('0x30')][_0xd590('0x1c')]);}return _0x3a57c5[_0xd590('0x49')](_0x4edc60);}})[_0xd590('0x23')](function(_0x203e00){if(_0x203e00){return _0x203e00?{'count':_0x308098,'rows':_0x203e00}:null;}})[_0xd590('0x23')](respondWithResult(_0x527234,null))[_0xd590('0x41')](handleError(_0x527234,null));};exports[_0xd590('0x4c')]=function(_0x14909f,_0x314d3e,_0x4c244a){var _0x20c73e={};var _0x4b04f9={};var _0xdab748;var _0x1e3033;return db[_0xd590('0x2c')][_0xd590('0x4d')]({'where':{'id':_0x14909f[_0xd590('0x43')]['id']}})[_0xd590('0x23')](handleEntityNotFound(_0x314d3e,null))[_0xd590('0x23')](function(_0x2adf77){if(_0x2adf77){_0xdab748=_0x2adf77;_0x4b04f9[_0xd590('0x2f')]=_[_0xd590('0x31')](db[_0xd590('0x4a')][_0xd590('0x4b')]);_0x4b04f9['query']=_[_0xd590('0x31')](_0x14909f[_0xd590('0x30')]);_0x4b04f9['filters']=_[_0xd590('0x32')](_0x4b04f9[_0xd590('0x2f')],_0x4b04f9[_0xd590('0x30')]);_0x20c73e[_0xd590('0x33')]=_['intersection'](_0x4b04f9['model'],qs['fields'](_0x14909f['query']['fields']));_0x20c73e[_0xd590('0x33')]=_0x20c73e[_0xd590('0x33')][_0xd590('0x35')]?_0x20c73e[_0xd590('0x33')]:_0x4b04f9[_0xd590('0x2f')];_0x20c73e[_0xd590('0x4e')]=qs[_0xd590('0x37')](_0x14909f[_0xd590('0x30')]['sort']);_0x20c73e[_0xd590('0x38')]=qs[_0xd590('0x44')](_[_0xd590('0x39')](_0x14909f[_0xd590('0x30')],_0x4b04f9['filters']));if(_0x14909f['query'][_0xd590('0x3c')]){_0x20c73e['where']=_[_0xd590('0x3a')](_0x20c73e[_0xd590('0x38')],{'$or':_['map'](_0x20c73e[_0xd590('0x33')],function(_0x5c95ad){var _0x54d9e6={};_0x54d9e6[_0x5c95ad]={'$like':'%'+_0x14909f[_0xd590('0x30')][_0xd590('0x3c')]+'%'};return _0x54d9e6;})});}_0x20c73e=_[_0xd590('0x3a')]({},_0x20c73e,_0x14909f['options']);return _0xdab748[_0xd590('0x4c')](_0x20c73e);}})[_0xd590('0x23')](function(_0x6f980d){if(_0x6f980d){_0x1e3033=_0x6f980d[_0xd590('0x35')];if(!_0x14909f[_0xd590('0x30')]['hasOwnProperty']('nolimit')){_0x20c73e[_0xd590('0x1e')]=qs['limit'](_0x14909f[_0xd590('0x30')][_0xd590('0x1e')]);_0x20c73e[_0xd590('0x1c')]=qs[_0xd590('0x1c')](_0x14909f[_0xd590('0x30')][_0xd590('0x1c')]);}return _0xdab748[_0xd590('0x4c')](_0x20c73e);}})['then'](function(_0x4a76c2){if(_0x4a76c2){return _0x4a76c2?{'count':_0x1e3033,'rows':_0x4a76c2}:null;}})[_0xd590('0x23')](respondWithResult(_0x314d3e,null))['catch'](handleError(_0x314d3e,null));};exports['getDescriptions']=function(_0x1840b4,_0x7cc5d5,_0x1cd884){var _0x2b72b3={};var _0x53c5d6={};var _0x4dd870;var _0x582235;return db[_0xd590('0x2c')]['findOne']({'where':{'id':_0x1840b4[_0xd590('0x43')]['id']}})['then'](handleEntityNotFound(_0x7cc5d5,null))[_0xd590('0x23')](function(_0x2928fd){if(_0x2928fd){_0x4dd870=_0x2928fd;_0x53c5d6[_0xd590('0x2f')]=_['keys'](db[_0xd590('0x4a')][_0xd590('0x4b')]);_0x53c5d6[_0xd590('0x30')]=_[_0xd590('0x31')](_0x1840b4[_0xd590('0x30')]);_0x53c5d6[_0xd590('0x44')]=_[_0xd590('0x32')](_0x53c5d6['model'],_0x53c5d6[_0xd590('0x30')]);_0x2b72b3[_0xd590('0x33')]=_[_0xd590('0x32')](_0x53c5d6[_0xd590('0x2f')],qs[_0xd590('0x34')](_0x1840b4[_0xd590('0x30')]['fields']));_0x2b72b3['attributes']=_0x2b72b3[_0xd590('0x33')][_0xd590('0x35')]?_0x2b72b3[_0xd590('0x33')]:_0x53c5d6[_0xd590('0x2f')];_0x2b72b3[_0xd590('0x4e')]=qs[_0xd590('0x37')](_0x1840b4['query'][_0xd590('0x37')]);_0x2b72b3[_0xd590('0x38')]=qs[_0xd590('0x44')](_[_0xd590('0x39')](_0x1840b4[_0xd590('0x30')],_0x53c5d6[_0xd590('0x44')]));if(_0x1840b4[_0xd590('0x30')][_0xd590('0x3c')]){_0x2b72b3[_0xd590('0x38')]=_['merge'](_0x2b72b3[_0xd590('0x38')],{'$or':_[_0xd590('0x2b')](_0x2b72b3[_0xd590('0x33')],function(_0x169b93){var _0x445252={};_0x445252[_0x169b93]={'$like':'%'+_0x1840b4[_0xd590('0x30')][_0xd590('0x3c')]+'%'};return _0x445252;})});}_0x2b72b3=_[_0xd590('0x3a')]({},_0x2b72b3,_0x1840b4[_0xd590('0x3d')]);return _0x4dd870['getDescriptions'](_0x2b72b3);}})[_0xd590('0x23')](function(_0x5187cf){if(_0x5187cf){_0x582235=_0x5187cf['length'];if(!_0x1840b4[_0xd590('0x30')][_0xd590('0x4f')](_0xd590('0x36'))){_0x2b72b3[_0xd590('0x1e')]=qs[_0xd590('0x1e')](_0x1840b4[_0xd590('0x30')][_0xd590('0x1e')]);_0x2b72b3[_0xd590('0x1c')]=qs[_0xd590('0x1c')](_0x1840b4[_0xd590('0x30')][_0xd590('0x1c')]);}return _0x4dd870[_0xd590('0x50')](_0x2b72b3);}})[_0xd590('0x23')](function(_0x17da99){if(_0x17da99){return _0x17da99?{'count':_0x582235,'rows':_0x17da99}:null;}})[_0xd590('0x23')](respondWithResult(_0x7cc5d5,null))[_0xd590('0x41')](handleError(_0x7cc5d5,null));};exports[_0xd590('0x51')]=function(_0x3ac656,_0x4c805a,_0x42bd29){var _0x424109={};var _0x2981ba={};var _0x4eb31b;var _0x29fe91;return db['DeskConfiguration'][_0xd590('0x4d')]({'where':{'id':_0x3ac656[_0xd590('0x43')]['id']}})[_0xd590('0x23')](handleEntityNotFound(_0x4c805a,null))[_0xd590('0x23')](function(_0x6ee2e8){if(_0x6ee2e8){_0x4eb31b=_0x6ee2e8;_0x2981ba[_0xd590('0x2f')]=_[_0xd590('0x31')](db[_0xd590('0x52')][_0xd590('0x4b')]);_0x2981ba[_0xd590('0x30')]=_['keys'](_0x3ac656[_0xd590('0x30')]);_0x2981ba[_0xd590('0x44')]=_[_0xd590('0x32')](_0x2981ba[_0xd590('0x2f')],_0x2981ba[_0xd590('0x30')]);_0x424109[_0xd590('0x33')]=_[_0xd590('0x32')](_0x2981ba[_0xd590('0x2f')],qs[_0xd590('0x34')](_0x3ac656['query'][_0xd590('0x34')]));_0x424109[_0xd590('0x33')]=_0x424109[_0xd590('0x33')][_0xd590('0x35')]?_0x424109[_0xd590('0x33')]:_0x2981ba[_0xd590('0x2f')];_0x424109['order']=qs[_0xd590('0x37')](_0x3ac656['query'][_0xd590('0x37')]);_0x424109[_0xd590('0x38')]=qs[_0xd590('0x44')](_[_0xd590('0x39')](_0x3ac656[_0xd590('0x30')],_0x2981ba['filters']));if(_0x3ac656[_0xd590('0x30')]['filter']){_0x424109[_0xd590('0x38')]=_['merge'](_0x424109['where'],{'$or':_[_0xd590('0x2b')](_0x424109[_0xd590('0x33')],function(_0x584cf9){var _0x3f4a38={};_0x3f4a38[_0x584cf9]={'$like':'%'+_0x3ac656[_0xd590('0x30')][_0xd590('0x3c')]+'%'};return _0x3f4a38;})});}_0x424109=_[_0xd590('0x3a')]({},_0x424109,_0x3ac656[_0xd590('0x3d')]);return _0x4eb31b[_0xd590('0x51')](_0x424109);}})[_0xd590('0x23')](function(_0x581919){if(_0x581919){_0x29fe91=_0x581919[_0xd590('0x35')];if(!_0x3ac656[_0xd590('0x30')][_0xd590('0x4f')](_0xd590('0x36'))){_0x424109['limit']=qs['limit'](_0x3ac656[_0xd590('0x30')]['limit']);_0x424109[_0xd590('0x1c')]=qs[_0xd590('0x1c')](_0x3ac656[_0xd590('0x30')][_0xd590('0x1c')]);}return _0x4eb31b[_0xd590('0x51')](_0x424109);}})['then'](function(_0x39b415){if(_0x39b415){return _0x39b415?{'count':_0x29fe91,'rows':_0x39b415}:null;}})[_0xd590('0x23')](respondWithResult(_0x4c805a,null))[_0xd590('0x41')](handleError(_0x4c805a,null));};exports[_0xd590('0x53')]=function(_0x55f8ce,_0x7a2406,_0x20d535){if(_0x55f8ce[_0xd590('0x47')]['id']){delete _0x55f8ce[_0xd590('0x47')]['id'];}return db['DeskConfiguration']['findOne']({'where':{'id':_0x55f8ce[_0xd590('0x43')]['id']}})[_0xd590('0x23')](handleEntityNotFound(_0x7a2406,null))[_0xd590('0x23')](function(_0x41f666){if(_0x41f666){return _0x41f666[_0xd590('0x53')](_0x55f8ce[_0xd590('0x47')][_0xd590('0x54')]||[]);}return null;})[_0xd590('0x23')](respondWithResult(_0x7a2406,null))[_0xd590('0x41')](handleError(_0x7a2406,null));}; \ No newline at end of file +var _0xd960=['findOne','DeskField','options','hasOwnProperty','nolimit','getSubjects','getDescriptions','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','count','set','Content-Range','save','update','destroy','then','error','stack','name','send','index','DeskConfiguration','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','length','order','sort','pick','filter','merge','where','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','getFields'];(function(_0x476bf4,_0x2a3755){var _0x788ffe=function(_0x13fa11){while(--_0x13fa11){_0x476bf4['push'](_0x476bf4['shift']());}};_0x788ffe(++_0x2a3755);}(_0xd960,0xae));var _0x0d96=function(_0x47ced9,_0x7abee9){_0x47ced9=_0x47ced9-0x0;var _0x5363db=_0xd960[_0x47ced9];return _0x5363db;};'use strict';var emlformat=require(_0x0d96('0x0'));var rimraf=require(_0x0d96('0x1'));var zipdir=require(_0x0d96('0x2'));var jsonpatch=require(_0x0d96('0x3'));var rp=require('request-promise');var moment=require(_0x0d96('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0d96('0x5'));var util=require(_0x0d96('0x6'));var path=require(_0x0d96('0x7'));var sox=require(_0x0d96('0x8'));var csv=require('to-csv');var ejs=require(_0x0d96('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0d96('0xa'));var squel=require(_0x0d96('0xb'));var crypto=require(_0x0d96('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x0d96('0xd'));var toCsv=require(_0x0d96('0xe'));var querystring=require(_0x0d96('0xf'));var Papa=require(_0x0d96('0x10'));var Redis=require('ioredis');var authService=require(_0x0d96('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0d96('0x12'));var logger=require('../../config/logger')(_0x0d96('0x13'));var utils=require(_0x0d96('0x14'));var config=require(_0x0d96('0x15'));var licenseUtil=require(_0x0d96('0x16'));var db=require(_0x0d96('0x17'))['db'];function respondWithStatusCode(_0x3be67a,_0x5029e5){_0x5029e5=_0x5029e5||0xcc;return function(_0x13077e){if(_0x13077e){return _0x3be67a['sendStatus'](_0x5029e5);}return _0x3be67a[_0x0d96('0x18')](_0x5029e5)[_0x0d96('0x19')]();};}function respondWithResult(_0x2e8ae5,_0x50259a){_0x50259a=_0x50259a||0xc8;return function(_0x708eb){if(_0x708eb){return _0x2e8ae5[_0x0d96('0x18')](_0x50259a)[_0x0d96('0x1a')](_0x708eb);}};}function respondWithFilteredResult(_0x3aa1e5,_0x1ff8b3){return function(_0x2efd60){if(_0x2efd60){var _0x447555=typeof _0x1ff8b3[_0x0d96('0x1b')]==='undefined'&&typeof _0x1ff8b3[_0x0d96('0x1c')]==='undefined';var _0x5c9635=_0x2efd60['count'];var _0x1908a4=_0x447555?0x0:_0x1ff8b3['offset'];var _0x3cd656=_0x447555?_0x2efd60[_0x0d96('0x1d')]:_0x1ff8b3[_0x0d96('0x1b')]+_0x1ff8b3[_0x0d96('0x1c')];var _0x12d5da;if(_0x3cd656>=_0x5c9635){_0x3cd656=_0x5c9635;_0x12d5da=0xc8;}else{_0x12d5da=0xce;}_0x3aa1e5[_0x0d96('0x18')](_0x12d5da);return _0x3aa1e5[_0x0d96('0x1e')](_0x0d96('0x1f'),_0x1908a4+'-'+_0x3cd656+'/'+_0x5c9635)[_0x0d96('0x1a')](_0x2efd60);}return null;};}function patchUpdates(_0x23dd5e){return function(_0x5bb9e4){try{jsonpatch['apply'](_0x5bb9e4,_0x23dd5e,!![]);}catch(_0x512a13){return BPromise['reject'](_0x512a13);}return _0x5bb9e4[_0x0d96('0x20')]();};}function saveUpdates(_0x5d5cdd,_0x4be764){return function(_0x3e2a3b){if(_0x3e2a3b){return _0x3e2a3b[_0x0d96('0x21')](_0x5d5cdd)['then'](function(_0x199f68){return _0x199f68;});}return null;};}function removeEntity(_0x1c0693,_0x27d1a1){return function(_0x3c14f4){if(_0x3c14f4){return _0x3c14f4[_0x0d96('0x22')]()[_0x0d96('0x23')](function(){_0x1c0693[_0x0d96('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x340e0f,_0x42f201){return function(_0x1e22c3){if(!_0x1e22c3){_0x340e0f['sendStatus'](0x194);}return _0x1e22c3;};}function handleError(_0x31d279,_0xe3806d){_0xe3806d=_0xe3806d||0x1f4;return function(_0x407269){logger[_0x0d96('0x24')](_0x407269[_0x0d96('0x25')]);if(_0x407269[_0x0d96('0x26')]){delete _0x407269['name'];}_0x31d279[_0x0d96('0x18')](_0xe3806d)[_0x0d96('0x27')](_0x407269);};}exports[_0x0d96('0x28')]=function(_0x32d687,_0x598982){var _0x3e6d2f={},_0x3f641c={},_0x87590={'count':0x0,'rows':[]};var _0x4333fe=_['map'](db[_0x0d96('0x29')][_0x0d96('0x2a')],function(_0x28d798){return{'name':_0x28d798[_0x0d96('0x2b')],'type':_0x28d798['type'][_0x0d96('0x2c')]};});_0x3f641c[_0x0d96('0x2d')]=_[_0x0d96('0x2e')](_0x4333fe,_0x0d96('0x26'));_0x3f641c[_0x0d96('0x2f')]=_['keys'](_0x32d687['query']);_0x3f641c[_0x0d96('0x30')]=_[_0x0d96('0x31')](_0x3f641c[_0x0d96('0x2d')],_0x3f641c['query']);_0x3e6d2f[_0x0d96('0x32')]=_[_0x0d96('0x31')](_0x3f641c[_0x0d96('0x2d')],qs[_0x0d96('0x33')](_0x32d687[_0x0d96('0x2f')][_0x0d96('0x33')]));_0x3e6d2f['attributes']=_0x3e6d2f[_0x0d96('0x32')][_0x0d96('0x34')]?_0x3e6d2f[_0x0d96('0x32')]:_0x3f641c[_0x0d96('0x2d')];if(!_0x32d687['query']['hasOwnProperty']('nolimit')){_0x3e6d2f[_0x0d96('0x1c')]=qs[_0x0d96('0x1c')](_0x32d687[_0x0d96('0x2f')]['limit']);_0x3e6d2f['offset']=qs[_0x0d96('0x1b')](_0x32d687[_0x0d96('0x2f')][_0x0d96('0x1b')]);}_0x3e6d2f[_0x0d96('0x35')]=qs[_0x0d96('0x36')](_0x32d687[_0x0d96('0x2f')][_0x0d96('0x36')]);_0x3e6d2f['where']=qs[_0x0d96('0x30')](_[_0x0d96('0x37')](_0x32d687['query'],_0x3f641c[_0x0d96('0x30')]),_0x4333fe);if(_0x32d687['query'][_0x0d96('0x38')]){_0x3e6d2f['where']=_[_0x0d96('0x39')](_0x3e6d2f[_0x0d96('0x3a')],{'$or':_['map'](_0x4333fe,function(_0x541563){if(_0x541563['type']!==_0x0d96('0x3b')){var _0x444d72={};_0x444d72[_0x541563[_0x0d96('0x26')]]={'$like':'%'+_0x32d687[_0x0d96('0x2f')][_0x0d96('0x38')]+'%'};return _0x444d72;}})});}_0x3e6d2f=_[_0x0d96('0x39')]({},_0x3e6d2f,_0x32d687['options']);var _0x23018c={'where':_0x3e6d2f[_0x0d96('0x3a')]};return db['DeskConfiguration']['count'](_0x23018c)[_0x0d96('0x23')](function(_0x2a38d6){_0x87590['count']=_0x2a38d6;if(_0x32d687[_0x0d96('0x2f')][_0x0d96('0x3c')]){_0x3e6d2f[_0x0d96('0x3d')]=[{'all':!![]}];}return db[_0x0d96('0x29')][_0x0d96('0x3e')](_0x3e6d2f);})['then'](function(_0x104c3a){_0x87590[_0x0d96('0x3f')]=_0x104c3a;return _0x87590;})[_0x0d96('0x23')](respondWithFilteredResult(_0x598982,_0x3e6d2f))[_0x0d96('0x40')](handleError(_0x598982,null));};exports[_0x0d96('0x41')]=function(_0x3d2dd4,_0x24a5c2){var _0x2c6907={'raw':![],'where':{'id':_0x3d2dd4[_0x0d96('0x42')]['id']}},_0x3d81dc={};_0x3d81dc[_0x0d96('0x2d')]=_[_0x0d96('0x43')](db[_0x0d96('0x29')]['rawAttributes']);_0x3d81dc[_0x0d96('0x2f')]=_[_0x0d96('0x43')](_0x3d2dd4[_0x0d96('0x2f')]);_0x3d81dc[_0x0d96('0x30')]=_[_0x0d96('0x31')](_0x3d81dc[_0x0d96('0x2d')],_0x3d81dc[_0x0d96('0x2f')]);_0x2c6907['attributes']=_[_0x0d96('0x31')](_0x3d81dc['model'],qs['fields'](_0x3d2dd4[_0x0d96('0x2f')][_0x0d96('0x33')]));_0x2c6907[_0x0d96('0x32')]=_0x2c6907[_0x0d96('0x32')][_0x0d96('0x34')]?_0x2c6907[_0x0d96('0x32')]:_0x3d81dc[_0x0d96('0x2d')];if(_0x3d2dd4[_0x0d96('0x2f')][_0x0d96('0x3c')]){_0x2c6907[_0x0d96('0x3d')]=[{'all':!![]}];}_0x2c6907=_[_0x0d96('0x39')]({},_0x2c6907,_0x3d2dd4['options']);return db[_0x0d96('0x29')][_0x0d96('0x44')](_0x2c6907)[_0x0d96('0x23')](handleEntityNotFound(_0x24a5c2,null))['then'](respondWithResult(_0x24a5c2,null))[_0x0d96('0x40')](handleError(_0x24a5c2,null));};exports[_0x0d96('0x45')]=function(_0x497a48,_0x2b857a){return db[_0x0d96('0x29')][_0x0d96('0x45')](_0x497a48['body'],{})[_0x0d96('0x23')](respondWithResult(_0x2b857a,0xc9))['catch'](handleError(_0x2b857a,null));};exports[_0x0d96('0x21')]=function(_0x3570ea,_0x1894ca){if(_0x3570ea[_0x0d96('0x46')]['id']){delete _0x3570ea[_0x0d96('0x46')]['id'];}return db[_0x0d96('0x29')][_0x0d96('0x44')]({'where':{'id':_0x3570ea[_0x0d96('0x42')]['id']}})[_0x0d96('0x23')](handleEntityNotFound(_0x1894ca,null))[_0x0d96('0x23')](saveUpdates(_0x3570ea[_0x0d96('0x46')],null))['then'](respondWithResult(_0x1894ca,null))['catch'](handleError(_0x1894ca,null));};exports[_0x0d96('0x22')]=function(_0x36f107,_0x4db8a3){return db['DeskConfiguration'][_0x0d96('0x44')]({'where':{'id':_0x36f107[_0x0d96('0x42')]['id']}})[_0x0d96('0x23')](handleEntityNotFound(_0x4db8a3,null))[_0x0d96('0x23')](removeEntity(_0x4db8a3,null))['catch'](handleError(_0x4db8a3,null));};exports[_0x0d96('0x47')]=function(_0x34d4a9,_0xcccdc1,_0x1d640f){var _0x2dd702={};var _0xf4dfce={};var _0x5290f8;var _0x42c100;return db[_0x0d96('0x29')][_0x0d96('0x48')]({'where':{'id':_0x34d4a9[_0x0d96('0x42')]['id']}})[_0x0d96('0x23')](handleEntityNotFound(_0xcccdc1,null))[_0x0d96('0x23')](function(_0x5abf4){if(_0x5abf4){_0x5290f8=_0x5abf4;_0xf4dfce[_0x0d96('0x2d')]=_[_0x0d96('0x43')](db[_0x0d96('0x49')][_0x0d96('0x2a')]);_0xf4dfce[_0x0d96('0x2f')]=_['keys'](_0x34d4a9[_0x0d96('0x2f')]);_0xf4dfce['filters']=_['intersection'](_0xf4dfce[_0x0d96('0x2d')],_0xf4dfce[_0x0d96('0x2f')]);_0x2dd702[_0x0d96('0x32')]=_[_0x0d96('0x31')](_0xf4dfce[_0x0d96('0x2d')],qs[_0x0d96('0x33')](_0x34d4a9['query'][_0x0d96('0x33')]));_0x2dd702[_0x0d96('0x32')]=_0x2dd702[_0x0d96('0x32')][_0x0d96('0x34')]?_0x2dd702[_0x0d96('0x32')]:_0xf4dfce[_0x0d96('0x2d')];_0x2dd702[_0x0d96('0x35')]=qs[_0x0d96('0x36')](_0x34d4a9[_0x0d96('0x2f')][_0x0d96('0x36')]);_0x2dd702[_0x0d96('0x3a')]=qs[_0x0d96('0x30')](_[_0x0d96('0x37')](_0x34d4a9[_0x0d96('0x2f')],_0xf4dfce['filters']));if(_0x34d4a9[_0x0d96('0x2f')]['filter']){_0x2dd702[_0x0d96('0x3a')]=_[_0x0d96('0x39')](_0x2dd702[_0x0d96('0x3a')],{'$or':_[_0x0d96('0x2e')](_0x2dd702[_0x0d96('0x32')],function(_0xbe88b6){var _0x577672={};_0x577672[_0xbe88b6]={'$like':'%'+_0x34d4a9[_0x0d96('0x2f')]['filter']+'%'};return _0x577672;})});}_0x2dd702=_['merge']({},_0x2dd702,_0x34d4a9[_0x0d96('0x4a')]);return _0x5290f8[_0x0d96('0x47')](_0x2dd702);}})[_0x0d96('0x23')](function(_0x42f46d){if(_0x42f46d){_0x42c100=_0x42f46d[_0x0d96('0x34')];if(!_0x34d4a9[_0x0d96('0x2f')][_0x0d96('0x4b')](_0x0d96('0x4c'))){_0x2dd702[_0x0d96('0x1c')]=qs[_0x0d96('0x1c')](_0x34d4a9[_0x0d96('0x2f')][_0x0d96('0x1c')]);_0x2dd702[_0x0d96('0x1b')]=qs['offset'](_0x34d4a9['query'][_0x0d96('0x1b')]);}return _0x5290f8[_0x0d96('0x47')](_0x2dd702);}})[_0x0d96('0x23')](function(_0x1b6ce5){if(_0x1b6ce5){return _0x1b6ce5?{'count':_0x42c100,'rows':_0x1b6ce5}:null;}})[_0x0d96('0x23')](respondWithResult(_0xcccdc1,null))[_0x0d96('0x40')](handleError(_0xcccdc1,null));};exports[_0x0d96('0x4d')]=function(_0x4b2091,_0x53d3f8,_0x537d09){var _0x4ecd4a={};var _0xa50c4a={};var _0x5b2530;var _0x522322;return db['DeskConfiguration'][_0x0d96('0x48')]({'where':{'id':_0x4b2091[_0x0d96('0x42')]['id']}})[_0x0d96('0x23')](handleEntityNotFound(_0x53d3f8,null))[_0x0d96('0x23')](function(_0x3a250b){if(_0x3a250b){_0x5b2530=_0x3a250b;_0xa50c4a[_0x0d96('0x2d')]=_[_0x0d96('0x43')](db[_0x0d96('0x49')][_0x0d96('0x2a')]);_0xa50c4a['query']=_[_0x0d96('0x43')](_0x4b2091['query']);_0xa50c4a['filters']=_[_0x0d96('0x31')](_0xa50c4a['model'],_0xa50c4a[_0x0d96('0x2f')]);_0x4ecd4a[_0x0d96('0x32')]=_['intersection'](_0xa50c4a[_0x0d96('0x2d')],qs['fields'](_0x4b2091['query'][_0x0d96('0x33')]));_0x4ecd4a[_0x0d96('0x32')]=_0x4ecd4a[_0x0d96('0x32')][_0x0d96('0x34')]?_0x4ecd4a[_0x0d96('0x32')]:_0xa50c4a[_0x0d96('0x2d')];_0x4ecd4a[_0x0d96('0x35')]=qs[_0x0d96('0x36')](_0x4b2091[_0x0d96('0x2f')][_0x0d96('0x36')]);_0x4ecd4a[_0x0d96('0x3a')]=qs[_0x0d96('0x30')](_[_0x0d96('0x37')](_0x4b2091['query'],_0xa50c4a[_0x0d96('0x30')]));if(_0x4b2091['query']['filter']){_0x4ecd4a[_0x0d96('0x3a')]=_[_0x0d96('0x39')](_0x4ecd4a[_0x0d96('0x3a')],{'$or':_['map'](_0x4ecd4a[_0x0d96('0x32')],function(_0x51904e){var _0x446b71={};_0x446b71[_0x51904e]={'$like':'%'+_0x4b2091[_0x0d96('0x2f')][_0x0d96('0x38')]+'%'};return _0x446b71;})});}_0x4ecd4a=_['merge']({},_0x4ecd4a,_0x4b2091[_0x0d96('0x4a')]);return _0x5b2530['getSubjects'](_0x4ecd4a);}})['then'](function(_0x3ae6f4){if(_0x3ae6f4){_0x522322=_0x3ae6f4[_0x0d96('0x34')];if(!_0x4b2091[_0x0d96('0x2f')]['hasOwnProperty'](_0x0d96('0x4c'))){_0x4ecd4a[_0x0d96('0x1c')]=qs['limit'](_0x4b2091[_0x0d96('0x2f')][_0x0d96('0x1c')]);_0x4ecd4a[_0x0d96('0x1b')]=qs[_0x0d96('0x1b')](_0x4b2091[_0x0d96('0x2f')][_0x0d96('0x1b')]);}return _0x5b2530[_0x0d96('0x4d')](_0x4ecd4a);}})[_0x0d96('0x23')](function(_0xac964){if(_0xac964){return _0xac964?{'count':_0x522322,'rows':_0xac964}:null;}})[_0x0d96('0x23')](respondWithResult(_0x53d3f8,null))['catch'](handleError(_0x53d3f8,null));};exports[_0x0d96('0x4e')]=function(_0x32d671,_0x3434dd,_0x9f51fc){var _0x3af2cc={};var _0x535a28={};var _0x24e059;var _0x1c2d6e;return db[_0x0d96('0x29')][_0x0d96('0x48')]({'where':{'id':_0x32d671[_0x0d96('0x42')]['id']}})['then'](handleEntityNotFound(_0x3434dd,null))['then'](function(_0x5c836c){if(_0x5c836c){_0x24e059=_0x5c836c;_0x535a28[_0x0d96('0x2d')]=_[_0x0d96('0x43')](db[_0x0d96('0x49')][_0x0d96('0x2a')]);_0x535a28['query']=_[_0x0d96('0x43')](_0x32d671[_0x0d96('0x2f')]);_0x535a28[_0x0d96('0x30')]=_[_0x0d96('0x31')](_0x535a28[_0x0d96('0x2d')],_0x535a28[_0x0d96('0x2f')]);_0x3af2cc['attributes']=_[_0x0d96('0x31')](_0x535a28['model'],qs['fields'](_0x32d671['query']['fields']));_0x3af2cc[_0x0d96('0x32')]=_0x3af2cc[_0x0d96('0x32')][_0x0d96('0x34')]?_0x3af2cc['attributes']:_0x535a28['model'];_0x3af2cc['order']=qs[_0x0d96('0x36')](_0x32d671[_0x0d96('0x2f')][_0x0d96('0x36')]);_0x3af2cc['where']=qs[_0x0d96('0x30')](_[_0x0d96('0x37')](_0x32d671[_0x0d96('0x2f')],_0x535a28[_0x0d96('0x30')]));if(_0x32d671[_0x0d96('0x2f')][_0x0d96('0x38')]){_0x3af2cc['where']=_['merge'](_0x3af2cc['where'],{'$or':_['map'](_0x3af2cc['attributes'],function(_0x13b42d){var _0x4c4a34={};_0x4c4a34[_0x13b42d]={'$like':'%'+_0x32d671['query'][_0x0d96('0x38')]+'%'};return _0x4c4a34;})});}_0x3af2cc=_[_0x0d96('0x39')]({},_0x3af2cc,_0x32d671[_0x0d96('0x4a')]);return _0x24e059[_0x0d96('0x4e')](_0x3af2cc);}})[_0x0d96('0x23')](function(_0x2cc99c){if(_0x2cc99c){_0x1c2d6e=_0x2cc99c['length'];if(!_0x32d671[_0x0d96('0x2f')][_0x0d96('0x4b')](_0x0d96('0x4c'))){_0x3af2cc[_0x0d96('0x1c')]=qs['limit'](_0x32d671[_0x0d96('0x2f')][_0x0d96('0x1c')]);_0x3af2cc[_0x0d96('0x1b')]=qs[_0x0d96('0x1b')](_0x32d671['query'][_0x0d96('0x1b')]);}return _0x24e059[_0x0d96('0x4e')](_0x3af2cc);}})[_0x0d96('0x23')](function(_0x239ff0){if(_0x239ff0){return _0x239ff0?{'count':_0x1c2d6e,'rows':_0x239ff0}:null;}})[_0x0d96('0x23')](respondWithResult(_0x3434dd,null))[_0x0d96('0x40')](handleError(_0x3434dd,null));};exports[_0x0d96('0x4f')]=function(_0x8c6043,_0x287c1a,_0x584a26){var _0x43970d={};var _0x59a2d2={};var _0x24ae74;var _0x13f023;return db[_0x0d96('0x29')][_0x0d96('0x48')]({'where':{'id':_0x8c6043[_0x0d96('0x42')]['id']}})['then'](handleEntityNotFound(_0x287c1a,null))[_0x0d96('0x23')](function(_0x58cb0e){if(_0x58cb0e){_0x24ae74=_0x58cb0e;_0x59a2d2['model']=_[_0x0d96('0x43')](db['Tag']['rawAttributes']);_0x59a2d2[_0x0d96('0x2f')]=_[_0x0d96('0x43')](_0x8c6043[_0x0d96('0x2f')]);_0x59a2d2[_0x0d96('0x30')]=_['intersection'](_0x59a2d2[_0x0d96('0x2d')],_0x59a2d2['query']);_0x43970d[_0x0d96('0x32')]=_[_0x0d96('0x31')](_0x59a2d2[_0x0d96('0x2d')],qs[_0x0d96('0x33')](_0x8c6043[_0x0d96('0x2f')]['fields']));_0x43970d[_0x0d96('0x32')]=_0x43970d[_0x0d96('0x32')][_0x0d96('0x34')]?_0x43970d[_0x0d96('0x32')]:_0x59a2d2[_0x0d96('0x2d')];_0x43970d[_0x0d96('0x35')]=qs[_0x0d96('0x36')](_0x8c6043['query']['sort']);_0x43970d['where']=qs[_0x0d96('0x30')](_[_0x0d96('0x37')](_0x8c6043[_0x0d96('0x2f')],_0x59a2d2[_0x0d96('0x30')]));if(_0x8c6043[_0x0d96('0x2f')][_0x0d96('0x38')]){_0x43970d[_0x0d96('0x3a')]=_['merge'](_0x43970d[_0x0d96('0x3a')],{'$or':_[_0x0d96('0x2e')](_0x43970d[_0x0d96('0x32')],function(_0x1219f9){var _0x17fa3b={};_0x17fa3b[_0x1219f9]={'$like':'%'+_0x8c6043[_0x0d96('0x2f')]['filter']+'%'};return _0x17fa3b;})});}_0x43970d=_[_0x0d96('0x39')]({},_0x43970d,_0x8c6043[_0x0d96('0x4a')]);return _0x24ae74[_0x0d96('0x4f')](_0x43970d);}})[_0x0d96('0x23')](function(_0x21992f){if(_0x21992f){_0x13f023=_0x21992f[_0x0d96('0x34')];if(!_0x8c6043[_0x0d96('0x2f')]['hasOwnProperty'](_0x0d96('0x4c'))){_0x43970d[_0x0d96('0x1c')]=qs[_0x0d96('0x1c')](_0x8c6043[_0x0d96('0x2f')][_0x0d96('0x1c')]);_0x43970d[_0x0d96('0x1b')]=qs[_0x0d96('0x1b')](_0x8c6043[_0x0d96('0x2f')][_0x0d96('0x1b')]);}return _0x24ae74[_0x0d96('0x4f')](_0x43970d);}})[_0x0d96('0x23')](function(_0x1731ca){if(_0x1731ca){return _0x1731ca?{'count':_0x13f023,'rows':_0x1731ca}:null;}})['then'](respondWithResult(_0x287c1a,null))[_0x0d96('0x40')](handleError(_0x287c1a,null));};exports[_0x0d96('0x50')]=function(_0x21b2a3,_0x334d0c,_0x4d207d){if(_0x21b2a3[_0x0d96('0x46')]['id']){delete _0x21b2a3['body']['id'];}return db[_0x0d96('0x29')][_0x0d96('0x48')]({'where':{'id':_0x21b2a3[_0x0d96('0x42')]['id']}})[_0x0d96('0x23')](handleEntityNotFound(_0x334d0c,null))[_0x0d96('0x23')](function(_0x27a02c){if(_0x27a02c){return _0x27a02c[_0x0d96('0x50')](_0x21b2a3[_0x0d96('0x46')][_0x0d96('0x51')]||[]);}return null;})[_0x0d96('0x23')](respondWithResult(_0x334d0c,null))[_0x0d96('0x40')](handleError(_0x334d0c,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index ef059e1..60cba60 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 _0x0b68=['DeskConfiguration','int_desk_configurations','api','moment','path','rimraf','./intDeskConfiguration.attributes','exports'];(function(_0xb4ddd,_0x26aaaa){var _0x576f22=function(_0x70c2cd){while(--_0x70c2cd){_0xb4ddd['push'](_0xb4ddd['shift']());}};_0x576f22(++_0x26aaaa);}(_0x0b68,0x72));var _0x80b6=function(_0x3addee,_0x210b0c){_0x3addee=_0x3addee-0x0;var _0xe10173=_0x0b68[_0x3addee];return _0xe10173;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x80b6('0x0'));var moment=require(_0x80b6('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x80b6('0x2'));var rimraf=require(_0x80b6('0x3'));var config=require('../../config/environment');var attributes=require(_0x80b6('0x4'));module[_0x80b6('0x5')]=function(_0x378cf3,_0x579c29){return _0x378cf3['define'](_0x80b6('0x6'),attributes,{'tableName':_0x80b6('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2a66=['lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','define','int_desk_configurations'];(function(_0x166964,_0x37e407){var _0x1cf2d2=function(_0x49db59){while(--_0x49db59){_0x166964['push'](_0x166964['shift']());}};_0x1cf2d2(++_0x37e407);}(_0x2a66,0x181));var _0x62a6=function(_0x2b2c2f,_0x645409){_0x2b2c2f=_0x2b2c2f-0x0;var _0x2984ea=_0x2a66[_0x2b2c2f];return _0x2984ea;};'use strict';var _=require(_0x62a6('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x62a6('0x1'));var moment=require('moment');var BPromise=require(_0x62a6('0x2'));var rp=require(_0x62a6('0x3'));var fs=require('fs');var path=require(_0x62a6('0x4'));var rimraf=require(_0x62a6('0x5'));var config=require(_0x62a6('0x6'));var attributes=require(_0x62a6('0x7'));module[_0x62a6('0x8')]=function(_0x24dbf3,_0x2b14a6){return _0x24dbf3[_0x62a6('0x9')]('DeskConfiguration',attributes,{'tableName':_0x62a6('0xa'),'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 1c88b3e..0fdfd91 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 _0x5b6e=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','code','DeskConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','ioredis'];(function(_0x160f75,_0x4d6e49){var _0x257d02=function(_0x27cab0){while(--_0x27cab0){_0x160f75['push'](_0x160f75['shift']());}};_0x257d02(++_0x4d6e49);}(_0x5b6e,0x14c));var _0xe5b6=function(_0x528460,_0x6f864a){_0x528460=_0x528460-0x0;var _0x6ee1d3=_0x5b6e[_0x528460];return _0x6ee1d3;};'use strict';var _=require(_0xe5b6('0x0'));var util=require(_0xe5b6('0x1'));var moment=require('moment');var BPromise=require(_0xe5b6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe5b6('0x3'));var db=require(_0xe5b6('0x4'))['db'];var utils=require(_0xe5b6('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xe5b6('0x6'));var jayson=require(_0xe5b6('0x7'));var client=jayson[_0xe5b6('0x8')][_0xe5b6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x554d53,_0x17ec5f,_0x326502){return new BPromise(function(_0x2bde31,_0x587efe){return client[_0xe5b6('0xa')](_0x554d53,_0x326502)['then'](function(_0x3f908a){logger[_0xe5b6('0xb')]('DeskConfiguration,\x20%s,\x20%s',_0x17ec5f,_0xe5b6('0xc'));logger[_0xe5b6('0xd')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x17ec5f,_0xe5b6('0xc'),JSON[_0xe5b6('0xe')](_0x3f908a));if(_0x3f908a['error']){if(_0x3f908a[_0xe5b6('0xf')][_0xe5b6('0x10')]===0x1f4){logger['error'](_0xe5b6('0x11'),_0x17ec5f,_0x3f908a[_0xe5b6('0xf')][_0xe5b6('0x12')]);return _0x587efe(_0x3f908a[_0xe5b6('0xf')][_0xe5b6('0x12')]);}logger['error'](_0xe5b6('0x11'),_0x17ec5f,_0x3f908a[_0xe5b6('0xf')][_0xe5b6('0x12')]);return _0x2bde31(_0x3f908a[_0xe5b6('0xf')][_0xe5b6('0x12')]);}else{logger[_0xe5b6('0xb')](_0xe5b6('0x11'),_0x17ec5f,_0xe5b6('0xc'));_0x2bde31(_0x3f908a[_0xe5b6('0x13')][_0xe5b6('0x12')]);}})[_0xe5b6('0x14')](function(_0x5dd731){logger[_0xe5b6('0xf')]('DeskConfiguration,\x20%s,\x20%s',_0x17ec5f,_0x5dd731);_0x587efe(_0x5dd731);});});} \ No newline at end of file +var _0xd052=['rpc','../../config/environment','client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','DeskConfiguration,\x20%s,\x20%s','message','catch','moment','randomstring','../../config/utils'];(function(_0x456c71,_0x172c75){var _0x99e1f0=function(_0x178d88){while(--_0x178d88){_0x456c71['push'](_0x456c71['shift']());}};_0x99e1f0(++_0x172c75);}(_0xd052,0x69));var _0x2d05=function(_0x4c0f63,_0x3e084e){_0x4c0f63=_0x4c0f63-0x0;var _0x23d20e=_0xd052[_0x4c0f63];return _0x23d20e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2d05('0x0'));var BPromise=require('bluebird');var rs=require(_0x2d05('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2d05('0x2'));var logger=require('../../config/logger')(_0x2d05('0x3'));var config=require(_0x2d05('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x2d05('0x5')][_0x2d05('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x2f617c,_0x18adc4,_0x2fd6ab){return new BPromise(function(_0x39fa70,_0x2a8a1c){return client[_0x2d05('0x7')](_0x2f617c,_0x2fd6ab)[_0x2d05('0x8')](function(_0x7e7e6){logger[_0x2d05('0x9')]('DeskConfiguration,\x20%s,\x20%s',_0x18adc4,'request\x20sent');logger['debug'](_0x2d05('0xa'),_0x18adc4,_0x2d05('0xb'),JSON[_0x2d05('0xc')](_0x7e7e6));if(_0x7e7e6[_0x2d05('0xd')]){if(_0x7e7e6['error'][_0x2d05('0xe')]===0x1f4){logger['error'](_0x2d05('0xf'),_0x18adc4,_0x7e7e6[_0x2d05('0xd')][_0x2d05('0x10')]);return _0x2a8a1c(_0x7e7e6['error'][_0x2d05('0x10')]);}logger[_0x2d05('0xd')](_0x2d05('0xf'),_0x18adc4,_0x7e7e6['error']['message']);return _0x39fa70(_0x7e7e6['error'][_0x2d05('0x10')]);}else{logger[_0x2d05('0x9')]('DeskConfiguration,\x20%s,\x20%s',_0x18adc4,_0x2d05('0xb'));_0x39fa70(_0x7e7e6['result']['message']);}})[_0x2d05('0x11')](function(_0x3eead7){logger['error'](_0x2d05('0xf'),_0x18adc4,_0x3eead7);_0x2a8a1c(_0x3eead7);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 281a1ed..c5b6195 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 _0xdc1b=['destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','create','put','update','delete'];(function(_0x52e547,_0x22e55b){var _0x3e53a0=function(_0x4a7bef){while(--_0x4a7bef){_0x52e547['push'](_0x52e547['shift']());}};_0x3e53a0(++_0x22e55b);}(_0xdc1b,0x1f0));var _0xbdc1=function(_0x1e03a6,_0xf0349){_0x1e03a6=_0x1e03a6-0x0;var _0x295b64=_0xdc1b[_0x1e03a6];return _0x295b64;};'use strict';var multer=require(_0xbdc1('0x0'));var util=require(_0xbdc1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbdc1('0x2'));var router=express[_0xbdc1('0x3')]();var fs_extra=require(_0xbdc1('0x4'));var auth=require(_0xbdc1('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xbdc1('0x6'));var controller=require('./intDeskField.controller');router[_0xbdc1('0x7')]('/',auth['isAuthenticated'](),controller[_0xbdc1('0x8')]);router['get'](_0xbdc1('0x9'),auth[_0xbdc1('0xa')](),controller[_0xbdc1('0xb')]);router[_0xbdc1('0xc')]('/',auth[_0xbdc1('0xa')](),controller[_0xbdc1('0xd')]);router[_0xbdc1('0xe')](_0xbdc1('0x9'),auth['isAuthenticated'](),controller[_0xbdc1('0xf')]);router[_0xbdc1('0x10')](_0xbdc1('0x9'),auth[_0xbdc1('0xa')](),controller[_0xbdc1('0x11')]);module[_0xbdc1('0x12')]=router; \ No newline at end of file +var _0x7336=['Router','fs-extra','../../components/auth/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','exports','multer','util','path'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x7336,0x141));var _0x6733=function(_0x38b7f1,_0x3e4b05){_0x38b7f1=_0x38b7f1-0x0;var _0x34e0a3=_0x7336[_0x38b7f1];return _0x34e0a3;};'use strict';var multer=require(_0x6733('0x0'));var util=require(_0x6733('0x1'));var path=require(_0x6733('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6733('0x3')]();var fs_extra=require(_0x6733('0x4'));var auth=require(_0x6733('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6733('0x6'));var controller=require(_0x6733('0x7'));router[_0x6733('0x8')]('/',auth[_0x6733('0x9')](),controller[_0x6733('0xa')]);router[_0x6733('0x8')](_0x6733('0xb'),auth[_0x6733('0x9')](),controller[_0x6733('0xc')]);router['post']('/',auth[_0x6733('0x9')](),controller[_0x6733('0xd')]);router[_0x6733('0xe')]('/:id',auth[_0x6733('0x9')](),controller[_0x6733('0xf')]);router[_0x6733('0x10')](_0x6733('0xb'),auth[_0x6733('0x9')](),controller['destroy']);module[_0x6733('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 cac1f25..2b8beb0 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 _0x5c9f=['picklist','STRING','ENUM','BOOLEAN','sequelize','string','variable','customVariable','keyValue'];(function(_0x23d7c5,_0x2a7547){var _0x350950=function(_0x26f5b6){while(--_0x26f5b6){_0x23d7c5['push'](_0x23d7c5['shift']());}};_0x350950(++_0x2a7547);}(_0x5c9f,0x124));var _0xf5c9=function(_0x4ef1a9,_0x59a5fa){_0x4ef1a9=_0x4ef1a9-0x0;var _0x23f201=_0x5c9f[_0x4ef1a9];return _0x23f201;};'use strict';var Sequelize=require(_0xf5c9('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xf5c9('0x1'),_0xf5c9('0x2'),_0xf5c9('0x3'),_0xf5c9('0x4'),_0xf5c9('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xf5c9('0x6')]},'key':{'type':Sequelize[_0xf5c9('0x6')]},'keyType':{'type':Sequelize[_0xf5c9('0x7')](_0xf5c9('0x1'),_0xf5c9('0x2'),_0xf5c9('0x3'))},'keyContent':{'type':Sequelize[_0xf5c9('0x6')]},'idField':{'type':Sequelize[_0xf5c9('0x6')]},'nameField':{'type':Sequelize[_0xf5c9('0x6')]},'customField':{'type':Sequelize[_0xf5c9('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf5c9('0x6')]}}; \ No newline at end of file +var _0xe78a=['customVariable','BOOLEAN','exports','ENUM','string','variable','keyValue','picklist','STRING'];(function(_0x46e103,_0x1cbda3){var _0x58bcac=function(_0x2f5168){while(--_0x2f5168){_0x46e103['push'](_0x46e103['shift']());}};_0x58bcac(++_0x1cbda3);}(_0xe78a,0x158));var _0xae78=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe78a[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0xae78('0x0')]={'type':{'type':Sequelize[_0xae78('0x1')](_0xae78('0x2'),_0xae78('0x3'),'customVariable',_0xae78('0x4'),_0xae78('0x5')),'defaultValue':_0xae78('0x2')},'content':{'type':Sequelize[_0xae78('0x6')]},'key':{'type':Sequelize[_0xae78('0x6')]},'keyType':{'type':Sequelize[_0xae78('0x1')](_0xae78('0x2'),_0xae78('0x3'),_0xae78('0x7'))},'keyContent':{'type':Sequelize[_0xae78('0x6')]},'idField':{'type':Sequelize[_0xae78('0x6')]},'nameField':{'type':Sequelize[_0xae78('0x6')]},'customField':{'type':Sequelize[_0xae78('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xae78('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 0fa51a9..7cf908e 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 _0x620b=['nolimit','limit','order','sort','where','pick','type','VIRTUAL','merge','includeAll','catch','show','params','include','find','create','body','update','destroy','eml-format','rimraf','zip-dir','mustache','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','end','status','json','undefined','count','offset','Content-Range','reject','then','error','stack','name','send','index','DeskField','rawAttributes','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty'];(function(_0x200827,_0x4af951){var _0x120047=function(_0x4431de){while(--_0x4431de){_0x200827['push'](_0x200827['shift']());}};_0x120047(++_0x4af951);}(_0x620b,0x167));var _0xb620=function(_0x5e52ed,_0x2d77ce){_0x5e52ed=_0x5e52ed-0x0;var _0x2cdbfb=_0x620b[_0x5e52ed];return _0x2cdbfb;};'use strict';var emlformat=require(_0xb620('0x0'));var rimraf=require(_0xb620('0x1'));var zipdir=require(_0xb620('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb620('0x3'));var util=require('util');var path=require(_0xb620('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb620('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb620('0x6'));var squel=require(_0xb620('0x7'));var crypto=require(_0xb620('0x8'));var jsforce=require(_0xb620('0x9'));var deskjs=require(_0xb620('0xa'));var toCsv=require(_0xb620('0xb'));var querystring=require(_0xb620('0xc'));var Papa=require(_0xb620('0xd'));var Redis=require('ioredis');var authService=require(_0xb620('0xe'));var qs=require(_0xb620('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb620('0x10'));var logger=require(_0xb620('0x11'))(_0xb620('0x12'));var utils=require(_0xb620('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xb620('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4536bb,_0x41208f){_0x41208f=_0x41208f||0xcc;return function(_0x10aa83){if(_0x10aa83){return _0x4536bb[_0xb620('0x15')](_0x41208f);}return _0x4536bb['status'](_0x41208f)[_0xb620('0x16')]();};}function respondWithResult(_0x4f7b72,_0x25af57){_0x25af57=_0x25af57||0xc8;return function(_0x11ed01){if(_0x11ed01){return _0x4f7b72[_0xb620('0x17')](_0x25af57)[_0xb620('0x18')](_0x11ed01);}};}function respondWithFilteredResult(_0x314a0b,_0xa715af){return function(_0x192423){if(_0x192423){var _0x3f3177=typeof _0xa715af['offset']===_0xb620('0x19')&&typeof _0xa715af['limit']===_0xb620('0x19');var _0xa2bf8a=_0x192423[_0xb620('0x1a')];var _0x82e276=_0x3f3177?0x0:_0xa715af[_0xb620('0x1b')];var _0x842f04=_0x3f3177?_0x192423[_0xb620('0x1a')]:_0xa715af['offset']+_0xa715af['limit'];var _0x1924b2;if(_0x842f04>=_0xa2bf8a){_0x842f04=_0xa2bf8a;_0x1924b2=0xc8;}else{_0x1924b2=0xce;}_0x314a0b[_0xb620('0x17')](_0x1924b2);return _0x314a0b['set'](_0xb620('0x1c'),_0x82e276+'-'+_0x842f04+'/'+_0xa2bf8a)[_0xb620('0x18')](_0x192423);}return null;};}function patchUpdates(_0x3446de){return function(_0x238960){try{jsonpatch['apply'](_0x238960,_0x3446de,!![]);}catch(_0x2fa1ca){return BPromise[_0xb620('0x1d')](_0x2fa1ca);}return _0x238960['save']();};}function saveUpdates(_0x2ee8fc,_0x556e20){return function(_0x3abf95){if(_0x3abf95){return _0x3abf95['update'](_0x2ee8fc)[_0xb620('0x1e')](function(_0x3dd0c6){return _0x3dd0c6;});}return null;};}function removeEntity(_0x48d87f,_0x23c9d8){return function(_0x506203){if(_0x506203){return _0x506203['destroy']()[_0xb620('0x1e')](function(){_0x48d87f[_0xb620('0x17')](0xcc)[_0xb620('0x16')]();});}};}function handleEntityNotFound(_0x1b64b7,_0x3fb9ad){return function(_0x51ae42){if(!_0x51ae42){_0x1b64b7[_0xb620('0x15')](0x194);}return _0x51ae42;};}function handleError(_0x16f137,_0x593e48){_0x593e48=_0x593e48||0x1f4;return function(_0x4bba7b){logger[_0xb620('0x1f')](_0x4bba7b[_0xb620('0x20')]);if(_0x4bba7b[_0xb620('0x21')]){delete _0x4bba7b[_0xb620('0x21')];}_0x16f137[_0xb620('0x17')](_0x593e48)[_0xb620('0x22')](_0x4bba7b);};}exports[_0xb620('0x23')]=function(_0xa138bd,_0x597100){var _0x41af1a={},_0x1ef1cb={},_0x51b9b5={'count':0x0,'rows':[]};var _0x19275d=_['map'](db[_0xb620('0x24')][_0xb620('0x25')],function(_0x5997e6){return{'name':_0x5997e6['fieldName'],'type':_0x5997e6['type'][_0xb620('0x26')]};});_0x1ef1cb[_0xb620('0x27')]=_[_0xb620('0x28')](_0x19275d,_0xb620('0x21'));_0x1ef1cb[_0xb620('0x29')]=_[_0xb620('0x2a')](_0xa138bd[_0xb620('0x29')]);_0x1ef1cb[_0xb620('0x2b')]=_[_0xb620('0x2c')](_0x1ef1cb[_0xb620('0x27')],_0x1ef1cb[_0xb620('0x29')]);_0x41af1a['attributes']=_['intersection'](_0x1ef1cb['model'],qs[_0xb620('0x2d')](_0xa138bd[_0xb620('0x29')]['fields']));_0x41af1a[_0xb620('0x2e')]=_0x41af1a[_0xb620('0x2e')][_0xb620('0x2f')]?_0x41af1a[_0xb620('0x2e')]:_0x1ef1cb[_0xb620('0x27')];if(!_0xa138bd[_0xb620('0x29')][_0xb620('0x30')](_0xb620('0x31'))){_0x41af1a[_0xb620('0x32')]=qs[_0xb620('0x32')](_0xa138bd[_0xb620('0x29')]['limit']);_0x41af1a[_0xb620('0x1b')]=qs[_0xb620('0x1b')](_0xa138bd['query'][_0xb620('0x1b')]);}_0x41af1a[_0xb620('0x33')]=qs[_0xb620('0x34')](_0xa138bd['query'][_0xb620('0x34')]);_0x41af1a[_0xb620('0x35')]=qs[_0xb620('0x2b')](_[_0xb620('0x36')](_0xa138bd['query'],_0x1ef1cb['filters']),_0x19275d);if(_0xa138bd[_0xb620('0x29')]['filter']){_0x41af1a['where']=_['merge'](_0x41af1a['where'],{'$or':_['map'](_0x19275d,function(_0x5cbf21){if(_0x5cbf21[_0xb620('0x37')]!==_0xb620('0x38')){var _0x773bce={};_0x773bce[_0x5cbf21['name']]={'$like':'%'+_0xa138bd['query']['filter']+'%'};return _0x773bce;}})});}_0x41af1a=_[_0xb620('0x39')]({},_0x41af1a,_0xa138bd['options']);var _0x183c1b={'where':_0x41af1a[_0xb620('0x35')]};return db[_0xb620('0x24')][_0xb620('0x1a')](_0x183c1b)['then'](function(_0x4e903c){_0x51b9b5['count']=_0x4e903c;if(_0xa138bd['query'][_0xb620('0x3a')]){_0x41af1a['include']=[{'all':!![]}];}return db[_0xb620('0x24')]['findAll'](_0x41af1a);})[_0xb620('0x1e')](function(_0x425f33){_0x51b9b5['rows']=_0x425f33;return _0x51b9b5;})['then'](respondWithFilteredResult(_0x597100,_0x41af1a))[_0xb620('0x3b')](handleError(_0x597100,null));};exports[_0xb620('0x3c')]=function(_0x43d1e7,_0x42e0ce){var _0x54a790={'raw':!![],'where':{'id':_0x43d1e7[_0xb620('0x3d')]['id']}},_0x19ea7a={};_0x19ea7a['model']=_[_0xb620('0x2a')](db[_0xb620('0x24')][_0xb620('0x25')]);_0x19ea7a[_0xb620('0x29')]=_[_0xb620('0x2a')](_0x43d1e7[_0xb620('0x29')]);_0x19ea7a[_0xb620('0x2b')]=_[_0xb620('0x2c')](_0x19ea7a[_0xb620('0x27')],_0x19ea7a['query']);_0x54a790['attributes']=_['intersection'](_0x19ea7a[_0xb620('0x27')],qs[_0xb620('0x2d')](_0x43d1e7[_0xb620('0x29')]['fields']));_0x54a790[_0xb620('0x2e')]=_0x54a790[_0xb620('0x2e')][_0xb620('0x2f')]?_0x54a790['attributes']:_0x19ea7a[_0xb620('0x27')];if(_0x43d1e7['query'][_0xb620('0x3a')]){_0x54a790[_0xb620('0x3e')]=[{'all':!![]}];}_0x54a790=_['merge']({},_0x54a790,_0x43d1e7['options']);return db[_0xb620('0x24')][_0xb620('0x3f')](_0x54a790)[_0xb620('0x1e')](handleEntityNotFound(_0x42e0ce,null))[_0xb620('0x1e')](respondWithResult(_0x42e0ce,null))[_0xb620('0x3b')](handleError(_0x42e0ce,null));};exports[_0xb620('0x40')]=function(_0xe4ec48,_0x252fe4){return db[_0xb620('0x24')]['create'](_0xe4ec48[_0xb620('0x41')],{})[_0xb620('0x1e')](respondWithResult(_0x252fe4,0xc9))[_0xb620('0x3b')](handleError(_0x252fe4,null));};exports[_0xb620('0x42')]=function(_0x5d96e4,_0x1f45a3){if(_0x5d96e4[_0xb620('0x41')]['id']){delete _0x5d96e4[_0xb620('0x41')]['id'];}return db[_0xb620('0x24')][_0xb620('0x3f')]({'where':{'id':_0x5d96e4['params']['id']}})[_0xb620('0x1e')](handleEntityNotFound(_0x1f45a3,null))[_0xb620('0x1e')](saveUpdates(_0x5d96e4[_0xb620('0x41')],null))[_0xb620('0x1e')](respondWithResult(_0x1f45a3,null))[_0xb620('0x3b')](handleError(_0x1f45a3,null));};exports[_0xb620('0x43')]=function(_0x3e3d9b,_0x3990c2){return db[_0xb620('0x24')][_0xb620('0x3f')]({'where':{'id':_0x3e3d9b[_0xb620('0x3d')]['id']}})[_0xb620('0x1e')](handleEntityNotFound(_0x3990c2,null))['then'](removeEntity(_0x3990c2,null))[_0xb620('0x3b')](handleError(_0x3990c2,null));}; \ No newline at end of file +var _0xa751=['zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','end','status','limit','undefined','count','offset','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','DeskField','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','rows','catch','show','params','keys','includeAll','include','find','create','body','eml-format','rimraf'];(function(_0x42407f,_0x656ee){var _0x27796c=function(_0x236694){while(--_0x236694){_0x42407f['push'](_0x42407f['shift']());}};_0x27796c(++_0x656ee);}(_0xa751,0x175));var _0x1a75=function(_0x1af810,_0x198f97){_0x1af810=_0x1af810-0x0;var _0x3ab948=_0xa751[_0x1af810];return _0x3ab948;};'use strict';var emlformat=require(_0x1a75('0x0'));var rimraf=require(_0x1a75('0x1'));var zipdir=require(_0x1a75('0x2'));var jsonpatch=require(_0x1a75('0x3'));var rp=require('request-promise');var moment=require(_0x1a75('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1a75('0x5'));var util=require(_0x1a75('0x6'));var path=require(_0x1a75('0x7'));var sox=require('sox');var csv=require(_0x1a75('0x8'));var ejs=require(_0x1a75('0x9'));var fs=require('fs');var fs_extra=require(_0x1a75('0xa'));var _=require(_0x1a75('0xb'));var squel=require(_0x1a75('0xc'));var crypto=require(_0x1a75('0xd'));var jsforce=require(_0x1a75('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1a75('0xf'));var Redis=require(_0x1a75('0x10'));var authService=require(_0x1a75('0x11'));var qs=require(_0x1a75('0x12'));var as=require(_0x1a75('0x13'));var hardwareService=require(_0x1a75('0x14'));var logger=require(_0x1a75('0x15'))(_0x1a75('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1a75('0x17'))['db'];function respondWithStatusCode(_0x24e8dc,_0xae1af0){_0xae1af0=_0xae1af0||0xcc;return function(_0x1220e4){if(_0x1220e4){return _0x24e8dc['sendStatus'](_0xae1af0);}return _0x24e8dc['status'](_0xae1af0)[_0x1a75('0x18')]();};}function respondWithResult(_0xf4a616,_0x48577b){_0x48577b=_0x48577b||0xc8;return function(_0x1c84d3){if(_0x1c84d3){return _0xf4a616[_0x1a75('0x19')](_0x48577b)['json'](_0x1c84d3);}};}function respondWithFilteredResult(_0x1f3c38,_0xb4a245){return function(_0x15a1ec){if(_0x15a1ec){var _0x5883df=typeof _0xb4a245['offset']==='undefined'&&typeof _0xb4a245[_0x1a75('0x1a')]===_0x1a75('0x1b');var _0x2b6f3d=_0x15a1ec[_0x1a75('0x1c')];var _0x1b1af2=_0x5883df?0x0:_0xb4a245[_0x1a75('0x1d')];var _0x47f384=_0x5883df?_0x15a1ec[_0x1a75('0x1c')]:_0xb4a245['offset']+_0xb4a245['limit'];var _0x42df2c;if(_0x47f384>=_0x2b6f3d){_0x47f384=_0x2b6f3d;_0x42df2c=0xc8;}else{_0x42df2c=0xce;}_0x1f3c38[_0x1a75('0x19')](_0x42df2c);return _0x1f3c38['set'](_0x1a75('0x1e'),_0x1b1af2+'-'+_0x47f384+'/'+_0x2b6f3d)['json'](_0x15a1ec);}return null;};}function patchUpdates(_0x4699c9){return function(_0x3e3549){try{jsonpatch[_0x1a75('0x1f')](_0x3e3549,_0x4699c9,!![]);}catch(_0x340750){return BPromise[_0x1a75('0x20')](_0x340750);}return _0x3e3549[_0x1a75('0x21')]();};}function saveUpdates(_0x5a0ad7,_0x3ed5e9){return function(_0x4dc595){if(_0x4dc595){return _0x4dc595[_0x1a75('0x22')](_0x5a0ad7)[_0x1a75('0x23')](function(_0x320413){return _0x320413;});}return null;};}function removeEntity(_0x59e3da,_0x443ff8){return function(_0x5e6617){if(_0x5e6617){return _0x5e6617[_0x1a75('0x24')]()[_0x1a75('0x23')](function(){_0x59e3da[_0x1a75('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9fe9fe,_0x126f40){return function(_0x4dec82){if(!_0x4dec82){_0x9fe9fe[_0x1a75('0x25')](0x194);}return _0x4dec82;};}function handleError(_0x399dae,_0x5a6acc){_0x5a6acc=_0x5a6acc||0x1f4;return function(_0x168e06){logger[_0x1a75('0x26')](_0x168e06[_0x1a75('0x27')]);if(_0x168e06[_0x1a75('0x28')]){delete _0x168e06['name'];}_0x399dae[_0x1a75('0x19')](_0x5a6acc)[_0x1a75('0x29')](_0x168e06);};}exports[_0x1a75('0x2a')]=function(_0x2f5ac9,_0xf33870){var _0x9e66b9={},_0x3b6e1d={},_0x38e885={'count':0x0,'rows':[]};var _0x5518ed=_['map'](db[_0x1a75('0x2b')][_0x1a75('0x2c')],function(_0x1a0359){return{'name':_0x1a0359[_0x1a75('0x2d')],'type':_0x1a0359[_0x1a75('0x2e')][_0x1a75('0x2f')]};});_0x3b6e1d[_0x1a75('0x30')]=_[_0x1a75('0x31')](_0x5518ed,'name');_0x3b6e1d['query']=_['keys'](_0x2f5ac9[_0x1a75('0x32')]);_0x3b6e1d[_0x1a75('0x33')]=_[_0x1a75('0x34')](_0x3b6e1d[_0x1a75('0x30')],_0x3b6e1d['query']);_0x9e66b9['attributes']=_['intersection'](_0x3b6e1d[_0x1a75('0x30')],qs[_0x1a75('0x35')](_0x2f5ac9['query']['fields']));_0x9e66b9[_0x1a75('0x36')]=_0x9e66b9['attributes'][_0x1a75('0x37')]?_0x9e66b9[_0x1a75('0x36')]:_0x3b6e1d[_0x1a75('0x30')];if(!_0x2f5ac9['query']['hasOwnProperty'](_0x1a75('0x38'))){_0x9e66b9[_0x1a75('0x1a')]=qs[_0x1a75('0x1a')](_0x2f5ac9[_0x1a75('0x32')][_0x1a75('0x1a')]);_0x9e66b9[_0x1a75('0x1d')]=qs[_0x1a75('0x1d')](_0x2f5ac9[_0x1a75('0x32')][_0x1a75('0x1d')]);}_0x9e66b9[_0x1a75('0x39')]=qs[_0x1a75('0x3a')](_0x2f5ac9[_0x1a75('0x32')][_0x1a75('0x3a')]);_0x9e66b9[_0x1a75('0x3b')]=qs[_0x1a75('0x33')](_[_0x1a75('0x3c')](_0x2f5ac9['query'],_0x3b6e1d[_0x1a75('0x33')]),_0x5518ed);if(_0x2f5ac9['query']['filter']){_0x9e66b9[_0x1a75('0x3b')]=_[_0x1a75('0x3d')](_0x9e66b9[_0x1a75('0x3b')],{'$or':_[_0x1a75('0x31')](_0x5518ed,function(_0x2842d4){if(_0x2842d4['type']!==_0x1a75('0x3e')){var _0xc88c40={};_0xc88c40[_0x2842d4[_0x1a75('0x28')]]={'$like':'%'+_0x2f5ac9[_0x1a75('0x32')][_0x1a75('0x3f')]+'%'};return _0xc88c40;}})});}_0x9e66b9=_['merge']({},_0x9e66b9,_0x2f5ac9[_0x1a75('0x40')]);var _0x481bfe={'where':_0x9e66b9[_0x1a75('0x3b')]};return db[_0x1a75('0x2b')][_0x1a75('0x1c')](_0x481bfe)[_0x1a75('0x23')](function(_0x269ed6){_0x38e885[_0x1a75('0x1c')]=_0x269ed6;if(_0x2f5ac9[_0x1a75('0x32')]['includeAll']){_0x9e66b9['include']=[{'all':!![]}];}return db[_0x1a75('0x2b')]['findAll'](_0x9e66b9);})[_0x1a75('0x23')](function(_0x14abcf){_0x38e885[_0x1a75('0x41')]=_0x14abcf;return _0x38e885;})['then'](respondWithFilteredResult(_0xf33870,_0x9e66b9))[_0x1a75('0x42')](handleError(_0xf33870,null));};exports[_0x1a75('0x43')]=function(_0x21bfae,_0x5a2c51){var _0x292cbc={'raw':!![],'where':{'id':_0x21bfae[_0x1a75('0x44')]['id']}},_0x15fe49={};_0x15fe49[_0x1a75('0x30')]=_[_0x1a75('0x45')](db[_0x1a75('0x2b')][_0x1a75('0x2c')]);_0x15fe49['query']=_[_0x1a75('0x45')](_0x21bfae[_0x1a75('0x32')]);_0x15fe49[_0x1a75('0x33')]=_[_0x1a75('0x34')](_0x15fe49[_0x1a75('0x30')],_0x15fe49['query']);_0x292cbc[_0x1a75('0x36')]=_[_0x1a75('0x34')](_0x15fe49['model'],qs[_0x1a75('0x35')](_0x21bfae['query'][_0x1a75('0x35')]));_0x292cbc['attributes']=_0x292cbc[_0x1a75('0x36')][_0x1a75('0x37')]?_0x292cbc[_0x1a75('0x36')]:_0x15fe49[_0x1a75('0x30')];if(_0x21bfae[_0x1a75('0x32')][_0x1a75('0x46')]){_0x292cbc[_0x1a75('0x47')]=[{'all':!![]}];}_0x292cbc=_['merge']({},_0x292cbc,_0x21bfae[_0x1a75('0x40')]);return db['DeskField'][_0x1a75('0x48')](_0x292cbc)[_0x1a75('0x23')](handleEntityNotFound(_0x5a2c51,null))[_0x1a75('0x23')](respondWithResult(_0x5a2c51,null))[_0x1a75('0x42')](handleError(_0x5a2c51,null));};exports[_0x1a75('0x49')]=function(_0x1bf8a0,_0x2cfacf){return db[_0x1a75('0x2b')]['create'](_0x1bf8a0[_0x1a75('0x4a')],{})[_0x1a75('0x23')](respondWithResult(_0x2cfacf,0xc9))[_0x1a75('0x42')](handleError(_0x2cfacf,null));};exports[_0x1a75('0x22')]=function(_0x385382,_0x1b76d){if(_0x385382[_0x1a75('0x4a')]['id']){delete _0x385382[_0x1a75('0x4a')]['id'];}return db[_0x1a75('0x2b')][_0x1a75('0x48')]({'where':{'id':_0x385382[_0x1a75('0x44')]['id']}})[_0x1a75('0x23')](handleEntityNotFound(_0x1b76d,null))[_0x1a75('0x23')](saveUpdates(_0x385382[_0x1a75('0x4a')],null))[_0x1a75('0x23')](respondWithResult(_0x1b76d,null))['catch'](handleError(_0x1b76d,null));};exports[_0x1a75('0x24')]=function(_0xa20c25,_0x1ae0cb){return db[_0x1a75('0x2b')][_0x1a75('0x48')]({'where':{'id':_0xa20c25[_0x1a75('0x44')]['id']}})[_0x1a75('0x23')](handleEntityNotFound(_0x1ae0cb,null))[_0x1a75('0x23')](removeEntity(_0x1ae0cb,null))['catch'](handleError(_0x1ae0cb,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index ca0440d..ca353cd 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 _0x87f0=['util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','exports','define','DeskField','int_desk_fields','desk_unique_index','idField','FieldId','lodash'];(function(_0x1602ef,_0x447aba){var _0x5870ee=function(_0x4d94e7){while(--_0x4d94e7){_0x1602ef['push'](_0x1602ef['shift']());}};_0x5870ee(++_0x447aba);}(_0x87f0,0x167));var _0x087f=function(_0x2f89d4,_0x55357d){_0x2f89d4=_0x2f89d4-0x0;var _0x7d2dc2=_0x87f0[_0x2f89d4];return _0x7d2dc2;};'use strict';var _=require(_0x087f('0x0'));var util=require(_0x087f('0x1'));var logger=require(_0x087f('0x2'))(_0x087f('0x3'));var moment=require('moment');var BPromise=require(_0x087f('0x4'));var rp=require(_0x087f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x087f('0x6'));var config=require(_0x087f('0x7'));var attributes=require('./intDeskField.attributes');module[_0x087f('0x8')]=function(_0x1469df,_0x58426a){return _0x1469df[_0x087f('0x9')](_0x087f('0xa'),attributes,{'tableName':_0x087f('0xb'),'paranoid':![],'indexes':[{'name':_0x087f('0xc'),'fields':[_0x087f('0xd'),_0x087f('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd71a=['desk_unique_index','FieldId','util','../../config/logger','request-promise','rimraf','../../config/environment','exports','define','DeskField','int_desk_fields'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xd71a,0x18e));var _0xad71=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xd71a[_0x40a045];return _0x1a687c;};'use strict';var _=require('lodash');var util=require(_0xad71('0x0'));var logger=require(_0xad71('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xad71('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xad71('0x3'));var config=require(_0xad71('0x4'));var attributes=require('./intDeskField.attributes');module[_0xad71('0x5')]=function(_0x41dbac,_0x5a17b4){return _0x41dbac[_0xad71('0x6')](_0xad71('0x7'),attributes,{'tableName':_0xad71('0x8'),'paranoid':![],'indexes':[{'name':_0xad71('0x9'),'fields':['idField',_0xad71('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 24c62c7..df19dc1 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 _0x4212=['debug','error','message','result','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent'];(function(_0x3a9635,_0x1ab817){var _0x10d08c=function(_0x222242){while(--_0x222242){_0x3a9635['push'](_0x3a9635['shift']());}};_0x10d08c(++_0x1ab817);}(_0x4212,0x15b));var _0x2421=function(_0x102ff9,_0x907658){_0x102ff9=_0x102ff9-0x0;var _0x24fa97=_0x4212[_0x102ff9];return _0x24fa97;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2421('0x0'));var BPromise=require(_0x2421('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2421('0x2'));var db=require(_0x2421('0x3'))['db'];var utils=require(_0x2421('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x2421('0x5'));var jayson=require(_0x2421('0x6'));var client=jayson[_0x2421('0x7')][_0x2421('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x88c841,_0xcf2640,_0x39be85){return new BPromise(function(_0x168dc9,_0x306c39){return client[_0x2421('0x9')](_0x88c841,_0x39be85)[_0x2421('0xa')](function(_0x5054d8){logger[_0x2421('0xb')](_0x2421('0xc'),_0xcf2640,_0x2421('0xd'));logger[_0x2421('0xe')]('DeskField,\x20%s,\x20%s,\x20%s',_0xcf2640,_0x2421('0xd'),JSON['stringify'](_0x5054d8));if(_0x5054d8[_0x2421('0xf')]){if(_0x5054d8[_0x2421('0xf')]['code']===0x1f4){logger[_0x2421('0xf')](_0x2421('0xc'),_0xcf2640,_0x5054d8['error'][_0x2421('0x10')]);return _0x306c39(_0x5054d8[_0x2421('0xf')][_0x2421('0x10')]);}logger[_0x2421('0xf')]('DeskField,\x20%s,\x20%s',_0xcf2640,_0x5054d8[_0x2421('0xf')]['message']);return _0x168dc9(_0x5054d8[_0x2421('0xf')][_0x2421('0x10')]);}else{logger['info'](_0x2421('0xc'),_0xcf2640,'request\x20sent');_0x168dc9(_0x5054d8[_0x2421('0x11')][_0x2421('0x10')]);}})[_0x2421('0x12')](function(_0x2dd49b){logger['error'](_0x2421('0xc'),_0xcf2640,_0x2dd49b);_0x306c39(_0x2dd49b);});});} \ No newline at end of file +var _0x7841=['then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','jayson/promise','client','http','request'];(function(_0x32b8b9,_0x5552fa){var _0x4e999c=function(_0xd3c239){while(--_0xd3c239){_0x32b8b9['push'](_0x32b8b9['shift']());}};_0x4e999c(++_0x5552fa);}(_0x7841,0x197));var _0x1784=function(_0x33f1f1,_0x3f2a10){_0x33f1f1=_0x33f1f1-0x0;var _0x3052d4=_0x7841[_0x33f1f1];return _0x3052d4;};'use strict';var _=require(_0x1784('0x0'));var util=require(_0x1784('0x1'));var moment=require(_0x1784('0x2'));var BPromise=require(_0x1784('0x3'));var rs=require(_0x1784('0x4'));var fs=require('fs');var Redis=require(_0x1784('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1784('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x1784('0x7'));var client=jayson[_0x1784('0x8')][_0x1784('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1850be,_0x55a374,_0x21068f){return new BPromise(function(_0x2911a0,_0x2a0e4a){return client[_0x1784('0xa')](_0x1850be,_0x21068f)[_0x1784('0xb')](function(_0x2ba0b9){logger[_0x1784('0xc')](_0x1784('0xd'),_0x55a374,_0x1784('0xe'));logger[_0x1784('0xf')](_0x1784('0x10'),_0x55a374,_0x1784('0xe'),JSON[_0x1784('0x11')](_0x2ba0b9));if(_0x2ba0b9['error']){if(_0x2ba0b9[_0x1784('0x12')][_0x1784('0x13')]===0x1f4){logger[_0x1784('0x12')](_0x1784('0xd'),_0x55a374,_0x2ba0b9[_0x1784('0x12')]['message']);return _0x2a0e4a(_0x2ba0b9['error'][_0x1784('0x14')]);}logger['error']('DeskField,\x20%s,\x20%s',_0x55a374,_0x2ba0b9[_0x1784('0x12')][_0x1784('0x14')]);return _0x2911a0(_0x2ba0b9[_0x1784('0x12')][_0x1784('0x14')]);}else{logger[_0x1784('0xc')](_0x1784('0xd'),_0x55a374,_0x1784('0xe'));_0x2911a0(_0x2ba0b9[_0x1784('0x15')][_0x1784('0x14')]);}})['catch'](function(_0x28d4ac){logger[_0x1784('0x12')](_0x1784('0xd'),_0x55a374,_0x28d4ac);_0x2a0e4a(_0x28d4ac);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 8515613..9ef327c 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 _0x9ad9=['get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','update','delete','destroy','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller'];(function(_0x5f5167,_0x11774b){var _0x4bcbf2=function(_0x1ac352){while(--_0x1ac352){_0x5f5167['push'](_0x5f5167['shift']());}};_0x4bcbf2(++_0x11774b);}(_0x9ad9,0x1f2));var _0x99ad=function(_0x5857a7,_0x3f8601){_0x5857a7=_0x5857a7-0x0;var _0x2c35e4=_0x9ad9[_0x5857a7];return _0x2c35e4;};'use strict';var multer=require(_0x99ad('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x99ad('0x1'));var express=require(_0x99ad('0x2'));var router=express['Router']();var fs_extra=require(_0x99ad('0x3'));var auth=require(_0x99ad('0x4'));var interaction=require(_0x99ad('0x5'));var config=require(_0x99ad('0x6'));var controller=require(_0x99ad('0x7'));router[_0x99ad('0x8')]('/',auth[_0x99ad('0x9')](),controller[_0x99ad('0xa')]);router[_0x99ad('0x8')](_0x99ad('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x99ad('0x8')](_0x99ad('0xc'),auth['isAuthenticated'](),controller[_0x99ad('0xd')]);router[_0x99ad('0x8')](_0x99ad('0xe'),auth[_0x99ad('0x9')](),controller['getFields']);router[_0x99ad('0xf')]('/',auth[_0x99ad('0x9')](),controller[_0x99ad('0x10')]);router[_0x99ad('0xf')](_0x99ad('0xc'),auth['isAuthenticated'](),controller[_0x99ad('0x11')]);router[_0x99ad('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x99ad('0x13')]);router[_0x99ad('0x14')](_0x99ad('0xb'),auth[_0x99ad('0x9')](),controller[_0x99ad('0x15')]);module['exports']=router; \ No newline at end of file +var _0x2929=['/:id/fields','isAuthenticated','post','addConfiguration','update','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','index','/:id','show','/:id/configurations','getConfigurations'];(function(_0x163c92,_0x294789){var _0x42560d=function(_0x21c7d0){while(--_0x21c7d0){_0x163c92['push'](_0x163c92['shift']());}};_0x42560d(++_0x294789);}(_0x2929,0x18e));var _0x9292=function(_0x287187,_0x32af64){_0x287187=_0x287187-0x0;var _0xfaf05d=_0x2929[_0x287187];return _0xfaf05d;};'use strict';var multer=require(_0x9292('0x0'));var util=require('util');var path=require(_0x9292('0x1'));var timeout=require(_0x9292('0x2'));var express=require(_0x9292('0x3'));var router=express[_0x9292('0x4')]();var fs_extra=require(_0x9292('0x5'));var auth=require(_0x9292('0x6'));var interaction=require(_0x9292('0x7'));var config=require(_0x9292('0x8'));var controller=require(_0x9292('0x9'));router[_0x9292('0xa')]('/',auth['isAuthenticated'](),controller[_0x9292('0xb')]);router[_0x9292('0xa')](_0x9292('0xc'),auth['isAuthenticated'](),controller[_0x9292('0xd')]);router['get'](_0x9292('0xe'),auth['isAuthenticated'](),controller[_0x9292('0xf')]);router['get'](_0x9292('0x10'),auth[_0x9292('0x11')](),controller['getFields']);router['post']('/',auth[_0x9292('0x11')](),controller['create']);router[_0x9292('0x12')](_0x9292('0xe'),auth[_0x9292('0x11')](),controller[_0x9292('0x13')]);router['put'](_0x9292('0xc'),auth[_0x9292('0x11')](),controller[_0x9292('0x14')]);router['delete'](_0x9292('0xc'),auth['isAuthenticated'](),controller[_0x9292('0x15')]);module[_0x9292('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 ad344ec..29bd0d4 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 _0xea1c=['BOOLEAN','STRING'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xea1c,0x117));var _0xcea1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xea1c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xcea1('0x0')]},'username':{'type':Sequelize[_0xcea1('0x0')]},'password':{'type':Sequelize[_0xcea1('0x0')]},'remoteUri':{'type':Sequelize[_0xcea1('0x0')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xcea1('0x0')]},'clientSecret':{'type':Sequelize[_0xcea1('0x0')]},'serverUrl':{'type':Sequelize[_0xcea1('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0xcea1('0x0')]},'modernAuthentication':{'type':Sequelize[_0xcea1('0x1')],'defaultValue':!![]}}; \ No newline at end of file +var _0xdded=['STRING','BOOLEAN','sequelize','exports'];(function(_0x4e8ae8,_0x2b87ed){var _0x2effc1=function(_0x1722ff){while(--_0x1722ff){_0x4e8ae8['push'](_0x4e8ae8['shift']());}};_0x2effc1(++_0x2b87ed);}(_0xdded,0x17a));var _0xddde=function(_0x2af9ad,_0x37a309){_0x2af9ad=_0x2af9ad-0x0;var _0x374367=_0xdded[_0x2af9ad];return _0x374367;};'use strict';var Sequelize=require(_0xddde('0x0'));module[_0xddde('0x1')]={'name':{'type':Sequelize[_0xddde('0x2')]},'username':{'type':Sequelize[_0xddde('0x2')]},'password':{'type':Sequelize[_0xddde('0x2')]},'remoteUri':{'type':Sequelize[_0xddde('0x2')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xddde('0x2')]},'clientSecret':{'type':Sequelize[_0xddde('0x2')]},'serverUrl':{'type':Sequelize[_0xddde('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xddde('0x2')]},'modernAuthentication':{'type':Sequelize[_0xddde('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 8436bfe..ce73ba9 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 _0x100e=['/oauth2/token','username','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','GET',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','LogicalName','@odata.type','lastIndexOf','PicklistAttributeMetadata','push','all','forEach','isNil','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','test','statusCode','EntityDefinitions(',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value','TrueOption','true','FalseOption','?$select=DisplayName,LogicalName','DisplayName','util','lodash','../../components/parsers/qs','../../config/logger','../../mysqldb','status','offset','undefined','limit','set','Content-Range','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','Dynamics365Account','rawAttributes','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','count','includeAll','include','findAll','catch','params','options','create','body','find','getConfigurations','findOne','Dynamics365Configuration','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','Dynamics365Field','slice','substring','format','%s/api/data/v9.0/','ticketType','Incident','description','customerid','ownerid','phonenumber','regardingobjectid','directioncode','accountidname','accountidyominame','actualserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridyominame','emailaddress','entityimage_timestamp','escalatedon','exchangerate','firstresponsebykpiidname','followupby','kbarticleidname','lastonholdtime','masteridname','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','subjectidname','ticketnumber','timezoneruleversionnumber','versionnumber','concat','password','clientId','modernAuthentication','CloudProvider','access_token'];(function(_0x5b1c9c,_0x47981a){var _0x977fd3=function(_0x41e449){while(--_0x41e449){_0x5b1c9c['push'](_0x5b1c9c['shift']());}};_0x977fd3(++_0x47981a);}(_0x100e,0xdf));var _0xe100=function(_0x333fed,_0x3d2122){_0x333fed=_0x333fed-0x0;var _0x12cac2=_0x100e[_0x333fed];return _0x12cac2;};'use strict';var rp=require('request-promise');var util=require(_0xe100('0x0'));var _=require(_0xe100('0x1'));var qs=require(_0xe100('0x2'));var logger=require(_0xe100('0x3'))('api');var db=require(_0xe100('0x4'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithResult(_0x5d4f4d,_0x9a95ad){_0x9a95ad=_0x9a95ad||0xc8;return function(_0x302f38){if(_0x302f38){return _0x5d4f4d[_0xe100('0x5')](_0x9a95ad)['json'](_0x302f38);}};}function respondWithFilteredResult(_0xdac11e,_0x402bfa){return function(_0x32d97c){if(_0x32d97c){var _0xd8e3ca=typeof _0x402bfa[_0xe100('0x6')]===_0xe100('0x7')&&typeof _0x402bfa[_0xe100('0x8')]===_0xe100('0x7');var _0x3dd51d=_0x32d97c['count'];var _0x32e5d9=_0xd8e3ca?0x0:_0x402bfa[_0xe100('0x6')];var _0x4ce315=_0xd8e3ca?_0x32d97c['count']:_0x402bfa[_0xe100('0x6')]+_0x402bfa[_0xe100('0x8')];var _0x13f87;if(_0x4ce315>=_0x3dd51d){_0x4ce315=_0x3dd51d;_0x13f87=0xc8;}else{_0x13f87=0xce;}_0xdac11e[_0xe100('0x5')](_0x13f87);return _0xdac11e[_0xe100('0x9')](_0xe100('0xa'),_0x32e5d9+'-'+_0x4ce315+'/'+_0x3dd51d)['json'](_0x32d97c);}return null;};}function saveUpdates(_0x549155){return function(_0x5c5ee0){if(_0x5c5ee0){return _0x5c5ee0[_0xe100('0xb')](_0x549155)[_0xe100('0xc')](function(_0x3e3688){return _0x3e3688;});}return null;};}function removeEntity(_0x237536){return function(_0x5afd00){if(_0x5afd00){return _0x5afd00[_0xe100('0xd')]()['then'](function(){_0x237536[_0xe100('0x5')](0xcc)[_0xe100('0xe')]();});}};}function handleEntityNotFound(_0x412732){return function(_0x1b3a37){if(!_0x1b3a37){_0x412732[_0xe100('0xf')](0x194);}return _0x1b3a37;};}function handleError(_0x37ce36,_0x4a5171){_0x4a5171=_0x4a5171||0x1f4;return function(_0x18c3af){logger[_0xe100('0x10')](_0x18c3af[_0xe100('0x11')]);if(_0x18c3af['name']){delete _0x18c3af[_0xe100('0x12')];}_0x37ce36[_0xe100('0x5')](_0x4a5171)[_0xe100('0x13')](_0x18c3af);};}exports[_0xe100('0x14')]=function(_0x3b0aae,_0x1fd8db){var _0x27796c={},_0x382994={},_0x2c8278={'count':0x0,'rows':[]};var _0x9cea9a=_[_0xe100('0x15')](db[_0xe100('0x16')][_0xe100('0x17')],function(_0x14c62e){return{'name':_0x14c62e['fieldName'],'type':_0x14c62e[_0xe100('0x18')]['key']};});_0x382994['model']=_[_0xe100('0x15')](_0x9cea9a,_0xe100('0x12'));_0x382994[_0xe100('0x19')]=_[_0xe100('0x1a')](_0x3b0aae[_0xe100('0x19')]);_0x382994[_0xe100('0x1b')]=_[_0xe100('0x1c')](_0x382994[_0xe100('0x1d')],_0x382994['query']);_0x27796c[_0xe100('0x1e')]=_[_0xe100('0x1c')](_0x382994[_0xe100('0x1d')],qs[_0xe100('0x1f')](_0x3b0aae[_0xe100('0x19')][_0xe100('0x1f')]));_0x27796c[_0xe100('0x1e')]=_0x27796c[_0xe100('0x1e')][_0xe100('0x20')]?_0x27796c[_0xe100('0x1e')]:_0x382994[_0xe100('0x1d')];if(!_0x3b0aae[_0xe100('0x19')][_0xe100('0x21')](_0xe100('0x22'))){_0x27796c[_0xe100('0x8')]=qs[_0xe100('0x8')](_0x3b0aae['query'][_0xe100('0x8')]);_0x27796c['offset']=qs['offset'](_0x3b0aae['query'][_0xe100('0x6')]);}_0x27796c[_0xe100('0x23')]=qs[_0xe100('0x24')](_0x3b0aae[_0xe100('0x19')][_0xe100('0x24')]);_0x27796c[_0xe100('0x25')]=qs[_0xe100('0x1b')](_[_0xe100('0x26')](_0x3b0aae[_0xe100('0x19')],_0x382994['filters']),_0x9cea9a);if(_0x3b0aae[_0xe100('0x19')]['filter']){_0x27796c[_0xe100('0x25')]=_['merge'](_0x27796c['where'],{'$or':_[_0xe100('0x15')](_0x9cea9a,function(_0x355192){if(_0x355192['type']!==_0xe100('0x27')){var _0x530007={};_0x530007[_0x355192[_0xe100('0x12')]]={'$like':'%'+_0x3b0aae[_0xe100('0x19')][_0xe100('0x28')]+'%'};return _0x530007;}})});}_0x27796c=_[_0xe100('0x29')]({},_0x27796c,_0x3b0aae['options']);var _0x4d2293={'where':_0x27796c[_0xe100('0x25')]};return db[_0xe100('0x16')][_0xe100('0x2a')](_0x4d2293)['then'](function(_0x518449){_0x2c8278['count']=_0x518449;if(_0x3b0aae[_0xe100('0x19')][_0xe100('0x2b')]){_0x27796c[_0xe100('0x2c')]=[{'all':!![]}];}return db[_0xe100('0x16')][_0xe100('0x2d')](_0x27796c);})[_0xe100('0xc')](function(_0x908e4a){_0x2c8278['rows']=_0x908e4a;return _0x2c8278;})[_0xe100('0xc')](respondWithFilteredResult(_0x1fd8db,_0x27796c))[_0xe100('0x2e')](handleError(_0x1fd8db,null));};exports['show']=function(_0x3bd391,_0x407ff7){var _0x2ba51f={'raw':![],'where':{'id':_0x3bd391[_0xe100('0x2f')]['id']}},_0x3c2f90={};_0x3c2f90[_0xe100('0x1d')]=_[_0xe100('0x1a')](db[_0xe100('0x16')][_0xe100('0x17')]);_0x3c2f90['query']=_[_0xe100('0x1a')](_0x3bd391[_0xe100('0x19')]);_0x3c2f90[_0xe100('0x1b')]=_[_0xe100('0x1c')](_0x3c2f90[_0xe100('0x1d')],_0x3c2f90[_0xe100('0x19')]);_0x2ba51f['attributes']=_['intersection'](_0x3c2f90[_0xe100('0x1d')],qs[_0xe100('0x1f')](_0x3bd391[_0xe100('0x19')][_0xe100('0x1f')]));_0x2ba51f[_0xe100('0x1e')]=_0x2ba51f[_0xe100('0x1e')][_0xe100('0x20')]?_0x2ba51f['attributes']:_0x3c2f90['model'];if(_0x3bd391[_0xe100('0x19')][_0xe100('0x2b')]){_0x2ba51f[_0xe100('0x2c')]=[{'all':!![]}];}_0x2ba51f=_[_0xe100('0x29')]({},_0x2ba51f,_0x3bd391[_0xe100('0x30')]);return db[_0xe100('0x16')]['find'](_0x2ba51f)['then'](handleEntityNotFound(_0x407ff7,null))[_0xe100('0xc')](respondWithResult(_0x407ff7,null))['catch'](handleError(_0x407ff7,null));};exports['create']=function(_0x165fea,_0x843abd){return db[_0xe100('0x16')][_0xe100('0x31')](_0x165fea[_0xe100('0x32')],{})[_0xe100('0xc')](respondWithResult(_0x843abd,0xc9))['catch'](handleError(_0x843abd,null));};exports[_0xe100('0xb')]=function(_0x533d27,_0x3b8842){if(_0x533d27[_0xe100('0x32')]['id']){delete _0x533d27[_0xe100('0x32')]['id'];}return db[_0xe100('0x16')][_0xe100('0x33')]({'where':{'id':_0x533d27[_0xe100('0x2f')]['id']}})[_0xe100('0xc')](handleEntityNotFound(_0x3b8842,null))['then'](saveUpdates(_0x533d27[_0xe100('0x32')],null))['then'](respondWithResult(_0x3b8842,null))['catch'](handleError(_0x3b8842,null));};exports[_0xe100('0xd')]=function(_0x3cdb22,_0x371fee){return db[_0xe100('0x16')][_0xe100('0x33')]({'where':{'id':_0x3cdb22['params']['id']}})[_0xe100('0xc')](handleEntityNotFound(_0x371fee,null))[_0xe100('0xc')](removeEntity(_0x371fee,null))[_0xe100('0x2e')](handleError(_0x371fee,null));};exports[_0xe100('0x34')]=function(_0x2f50d9,_0x273d55){var _0x1bd896={};var _0x4e8244={};var _0x6a831d;var _0x4972e1;return db[_0xe100('0x16')][_0xe100('0x35')]({'where':{'id':_0x2f50d9[_0xe100('0x2f')]['id']}})[_0xe100('0xc')](handleEntityNotFound(_0x273d55,null))[_0xe100('0xc')](function(_0x5d0172){if(_0x5d0172){_0x6a831d=_0x5d0172;_0x4e8244[_0xe100('0x1d')]=_[_0xe100('0x1a')](db[_0xe100('0x36')]['rawAttributes']);_0x4e8244[_0xe100('0x19')]=_['keys'](_0x2f50d9[_0xe100('0x19')]);_0x4e8244[_0xe100('0x1b')]=_['intersection'](_0x4e8244[_0xe100('0x1d')],_0x4e8244[_0xe100('0x19')]);_0x1bd896[_0xe100('0x1e')]=_[_0xe100('0x1c')](_0x4e8244[_0xe100('0x1d')],qs[_0xe100('0x1f')](_0x2f50d9[_0xe100('0x19')][_0xe100('0x1f')]));_0x1bd896[_0xe100('0x1e')]=_0x1bd896[_0xe100('0x1e')][_0xe100('0x20')]?_0x1bd896['attributes']:_0x4e8244['model'];_0x1bd896[_0xe100('0x23')]=qs[_0xe100('0x24')](_0x2f50d9[_0xe100('0x19')][_0xe100('0x24')]);_0x1bd896[_0xe100('0x25')]=qs['filters'](_['pick'](_0x2f50d9[_0xe100('0x19')],_0x4e8244[_0xe100('0x1b')]));if(_0x2f50d9[_0xe100('0x19')][_0xe100('0x28')]){_0x1bd896[_0xe100('0x25')]=_[_0xe100('0x29')](_0x1bd896[_0xe100('0x25')],{'$or':_[_0xe100('0x15')](_0x1bd896[_0xe100('0x1e')],function(_0x171055){var _0x2c884c={};_0x2c884c[_0x171055]={'$like':'%'+_0x2f50d9[_0xe100('0x19')][_0xe100('0x28')]+'%'};return _0x2c884c;})});}_0x1bd896=_[_0xe100('0x29')]({},_0x1bd896,_0x2f50d9[_0xe100('0x30')]);return _0x6a831d[_0xe100('0x34')](_0x1bd896);}})[_0xe100('0xc')](function(_0x40853b){if(_0x40853b){_0x4972e1=_0x40853b[_0xe100('0x20')];if(!_0x2f50d9[_0xe100('0x19')]['hasOwnProperty'](_0xe100('0x22'))){_0x1bd896[_0xe100('0x8')]=qs['limit'](_0x2f50d9[_0xe100('0x19')][_0xe100('0x8')]);_0x1bd896['offset']=qs[_0xe100('0x6')](_0x2f50d9['query'][_0xe100('0x6')]);}return _0x6a831d['getConfigurations'](_0x1bd896);}})['then'](function(_0x1fb004){if(_0x1fb004){return _0x1fb004?{'count':_0x4972e1,'rows':_0x1fb004}:null;}})[_0xe100('0xc')](respondWithResult(_0x273d55,null))[_0xe100('0x2e')](handleError(_0x273d55,null));};exports[_0xe100('0x37')]=function(_0x3dbc76,_0x3750e2){if(_0x3dbc76['body']['id']){delete _0x3dbc76[_0xe100('0x32')]['id'];}return db[_0xe100('0x16')]['findOne']({'where':{'id':_0x3dbc76[_0xe100('0x2f')]['id']}})[_0xe100('0xc')](handleEntityNotFound(_0x3750e2,null))[_0xe100('0xc')](function(_0x16b00c){if(_0x16b00c){_0x3dbc76[_0xe100('0x32')][_0xe100('0x38')]=_0x16b00c['id'];_0x3dbc76[_0xe100('0x32')][_0xe100('0x39')]=integrations[_0xe100('0x3a')](_0x3dbc76['body']['channel'],_0x3dbc76[_0xe100('0x32')][_0xe100('0x18')]);_0x3dbc76[_0xe100('0x32')][_0xe100('0x3b')]=integrations[_0xe100('0x3c')](_0x3dbc76[_0xe100('0x32')][_0xe100('0x3d')],_0x3dbc76[_0xe100('0x32')][_0xe100('0x18')]);return db[_0xe100('0x36')]['create'](_0x3dbc76[_0xe100('0x32')],{'include':[{'model':db[_0xe100('0x3e')],'as':_0xe100('0x39')},{'model':db[_0xe100('0x3e')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x3750e2,null))[_0xe100('0x2e')](handleError(_0x3750e2,null));};function sanitizeRemoteUri(_0x5b6e13){var _0x544e41=_0x5b6e13[_0xe100('0x3f')](-0x1);if(_0x544e41==='/')return _0x5b6e13[_0xe100('0x40')](0x0,_0x5b6e13['lastIndexOf'](_0x544e41));return _0x5b6e13;}function getWebApiUrl(_0xc4a738){return util[_0xe100('0x41')](_0xe100('0x42'),_0xc4a738);}exports['getFields']=function(_0x3867c0,_0x1ce4b0){var _0xca1f8e=_0x3867c0[_0xe100('0x19')][_0xe100('0x43')];var _0x5264e6=_0xca1f8e==='incident'?_0xe100('0x44'):'PhoneCall';var _0x48a072='';var _0x4cadc6='';var _0x161b06='';var _0x1678e2='';var _0x562b1c='';var _0x20bcf8='';var _0x5ec32c='';var _0x126ee5='';var _0xad1fb8=['title',_0xe100('0x45'),_0xe100('0x46'),_0xe100('0x47'),'caseorigincode','subject',_0xe100('0x48'),_0xe100('0x49'),_0xe100('0x4a'),'phonecall_activity_parties'];var _0x4156ee=[_0xe100('0x4b'),_0xe100('0x4c'),_0xe100('0x4d'),'billedserviceunits',_0xe100('0x4e'),_0xe100('0x4f'),_0xe100('0x50'),_0xe100('0x51'),'createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname',_0xe100('0x52'),_0xe100('0x53'),_0xe100('0x54'),_0xe100('0x55'),_0xe100('0x56'),'customeridtype',_0xe100('0x57'),_0xe100('0x58'),'entitlementidname',_0xe100('0x59'),'entityimage_url',_0xe100('0x5a'),_0xe100('0x5b'),_0xe100('0x5c'),_0xe100('0x5d'),'importsequencenumber','influencescore',_0xe100('0x5e'),_0xe100('0x5f'),_0xe100('0x60'),'modifiedbyexternalpartyname','modifiedbyexternalpartyyominame',_0xe100('0x61'),_0xe100('0x62'),_0xe100('0x63'),_0xe100('0x64'),_0xe100('0x65'),_0xe100('0x66'),_0xe100('0x67'),_0xe100('0x68'),'onholdtime',_0xe100('0x69'),_0xe100('0x6a'),_0xe100('0x6b'),_0xe100('0x6c'),_0xe100('0x6d'),_0xe100('0x6e'),_0xe100('0x6f'),'prioritycodename',_0xe100('0x70'),_0xe100('0x71'),_0xe100('0x72'),_0xe100('0x73'),_0xe100('0x74'),'responsiblecontactidname',_0xe100('0x75'),_0xe100('0x76'),_0xe100('0x77'),_0xe100('0x78'),_0xe100('0x79'),_0xe100('0x7a'),'statuscode',_0xe100('0x7b'),_0xe100('0x7c'),_0xe100('0x7d'),'transactioncurrencyidname','traversedpath','utcconversiontimezonecode',_0xe100('0x7e')];var _0x2d2428=_0xad1fb8[_0xe100('0x7f')](_0x4156ee);return db['Dynamics365Account'][_0xe100('0x35')]({'where':{'id':_0x3867c0[_0xe100('0x2f')]['id']},'attributes':['id','username',_0xe100('0x80'),'remoteUri','tenantId',_0xe100('0x81'),'clientSecret',_0xe100('0x82')],'include':[{'model':db[_0xe100('0x83')],'as':_0xe100('0x83'),'attributes':['id','data5','data7']}]})[_0xe100('0xc')](handleEntityNotFound(_0x1ce4b0,null))[_0xe100('0xc')](function(_0x4bed01){if(_0x4bed01){if(_0x4bed01[_0xe100('0x82')]){_0x4bed01[_0xe100('0x84')]=_0x4bed01['CloudProvider']['data5'];_0x126ee5=sanitizeRemoteUri(_0x4bed01[_0xe100('0x83')]['data7']);_0x5ec32c=getWebApiUrl(_0x126ee5);return _0x4bed01;}_0x126ee5=sanitizeRemoteUri(_0x4bed01['remoteUri']);_0x5ec32c=getWebApiUrl(_0x126ee5);var _0x34fe15={'method':'POST','uri':'https://login.microsoftonline.com/'+_0x4bed01['tenantId']+_0xe100('0x85'),'form':{'client_id':_0x4bed01['clientId'],'resource':_0x126ee5,'username':_0x4bed01[_0xe100('0x86')],'password':_0x4bed01[_0xe100('0x80')],'grant_type':_0xe100('0x80'),'client_secret':_0x4bed01['clientSecret']},'json':!![]};return rp(_0x34fe15);}})[_0xe100('0xc')](function(_0x4794e6){_0x20bcf8=_0x4794e6['access_token'];var _0x1e9d31={'method':'GET','uri':encodeURI(_0x5ec32c+_0xe100('0x87')+_0x5264e6+'\x27'),'headers':{'Authorization':_0xe100('0x88')+_0x20bcf8,'If-None-Match':null,'OData-Version':_0xe100('0x89')},'json':!![]};return rp(_0x1e9d31);})['then'](function(_0x4bbb5e){var _0x177f48=_0x4bbb5e[_0xe100('0x8a')][0x0];var _0x27ea87=_0x177f48[_0xe100('0x8b')];var _0x28c287={'method':_0xe100('0x8c'),'uri':_0x5ec32c+'EntityDefinitions('+_0x27ea87+_0xe100('0x8d'),'headers':{'Authorization':_0xe100('0x88')+_0x20bcf8,'If-None-Match':null,'OData-Version':_0xe100('0x89')},'json':!![]};return rp(_0x28c287);})[_0xe100('0xc')](function(_0x35bb25){_0x48a072=_0x35bb25;_0x4cadc6=_0x48a072[_0xe100('0x8e')];_0x4cadc6=_[_0xe100('0x8f')](_0x4cadc6,function(_0x3fe74f){return!_0x2d2428['includes'](_0x3fe74f[_0xe100('0x90')]);});var _0x72e992=[];var _0x118664=[];_0x4cadc6['forEach'](function(_0x159bf5){if(_0x159bf5['@odata.type']){var _0x4c535e=_0x159bf5['@odata.type']['substring'](_0x159bf5[_0xe100('0x91')][_0xe100('0x92')]('.')+0x1);if(_0x4c535e===_0xe100('0x93')){_0x72e992[_0xe100('0x94')](getSelectList(_0x5ec32c,_0xca1f8e,_0x118664,_0x48a072[_0xe100('0x8b')],_0x159bf5[_0xe100('0x8b')],_0x20bcf8));}}});return Promise[_0xe100('0x95')](_0x72e992);})[_0xe100('0xc')](function(_0x30b32e){_0x161b06=_0x30b32e[0x0];var _0x1c3de2=[];var _0x176a43=[];_0x4cadc6[_0xe100('0x96')](function(_0xfa8c02){if(!_[_0xe100('0x97')](_0xfa8c02[_0xe100('0x91')])){var _0x4f9e67=_0xfa8c02[_0xe100('0x91')][_0xe100('0x40')](_0xfa8c02[_0xe100('0x91')][_0xe100('0x92')]('.')+0x1);if(_0x4f9e67===_0xe100('0x98')){_0x1c3de2[_0xe100('0x94')](getBooleanList(_0x5ec32c,_0xca1f8e,_0x176a43,_0x48a072[_0xe100('0x8b')],_0xfa8c02[_0xe100('0x8b')],_0x20bcf8));}}});return Promise['all'](_0x1c3de2);})['then'](function(_0x40499d){_0x1678e2=_0x40499d[0x0];var _0x306479=[];var _0x264a57=[];_0x4cadc6[_0xe100('0x96')](function(_0x154dbe){if(_0x154dbe[_0xe100('0x91')]){var _0x210ac1=_0x154dbe[_0xe100('0x91')]['substring'](_0x154dbe[_0xe100('0x91')][_0xe100('0x92')]('.')+0x1);if(_0x210ac1===_0xe100('0x99')||_0x210ac1===_0xe100('0x9a')||_0x210ac1===_0xe100('0x9b')||_0x210ac1===_0xe100('0x9c')||_0x210ac1===_0xe100('0x9d')||_0x210ac1===_0xe100('0x9e')||_0x210ac1===_0xe100('0x9f')||_0x210ac1===_0xe100('0xa0')||_0x210ac1===_0xe100('0xa1')||_0x210ac1==='DecimalAttributeMetadata'){_0x306479['push'](getInputList(_0x5ec32c,_0xca1f8e,_0x210ac1,_0x264a57,_0x48a072['MetadataId'],_0x154dbe[_0xe100('0x8b')],_0x20bcf8));}}});return Promise[_0xe100('0x95')](_0x306479);})['then'](function(_0x3c2363){_0x562b1c=_0x3c2363[0x0];var _0x36f171=_0x161b06[_0xe100('0x7f')](_0x1678e2)['concat'](_0x562b1c);var _0x591dd0={'count':_0x36f171[_0xe100('0x20')],'rows':_0x36f171};return _0x591dd0;})['then'](respondWithResult(_0x1ce4b0,null))[_0xe100('0x2e')](function(_0x242f6e){var _0x3e415b=_0x3867c0[_0xe100('0x19')][_0xe100('0xa2')]?0x1f4:_0x242f6e['statusCode']||0x1f4;logger[_0xe100('0x10')](_0x242f6e[_0xe100('0x11')]);delete _0x242f6e['name'];if(_0x3e415b===0x191){_0x3e415b=0x190;}_0x1ce4b0[_0xe100('0x5')](_0x3e415b)[_0xe100('0x13')](_0x3867c0[_0xe100('0x19')][_0xe100('0xa2')]?{'message':'Wrong\x20credentials','statusCode':_0x242f6e[_0xe100('0xa3')]}:_0x242f6e);});};function getSelectList(_0x41fe08,_0x376d73,_0x45c0d2,_0x148661,_0x4a76a8,_0x57b495){var _0x2f534a={'method':'GET','uri':_0x41fe08+_0xe100('0xa4')+_0x148661+_0xe100('0xa5')+_0x4a76a8+_0xe100('0xa6')+_0xe100('0xa7'),'headers':{'Authorization':_0xe100('0x88')+_0x57b495,'If-None-Match':null,'OData-Version':_0xe100('0x89')},'json':!![]};return rp(_0x2f534a)['then'](function(_0x24fa8e){var _0x51519d=[];var _0x65adbb=_0x24fa8e[_0xe100('0xa8')][_0xe100('0xa9')];_0x65adbb[_0xe100('0x96')](function(_0x3a103){_0x51519d['push']({'name':_0x3a103[_0xe100('0xaa')][_0xe100('0xab')][_0xe100('0xaa')],'value':String(_0x3a103[_0xe100('0xac')])});});var _0x55c15c={'id':_0x376d73+'_'+_0x24fa8e[_0xe100('0x90')],'name':_0x24fa8e['DisplayName'][_0xe100('0xab')][_0xe100('0xaa')],'custom':![],'options':_0x51519d};_0x45c0d2[_0xe100('0x94')](_0x55c15c);return _0x45c0d2;});}function getBooleanList(_0x4289aa,_0x4d8aff,_0x46a116,_0x58b1ba,_0x5cd3e5,_0x53291c){var _0x476557={'method':_0xe100('0x8c'),'uri':_0x4289aa+_0xe100('0xa4')+_0x58b1ba+_0xe100('0xa5')+_0x5cd3e5+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0xe100('0x88')+_0x53291c,'If-None-Match':null,'OData-Version':_0xe100('0x89')},'json':!![]};return rp(_0x476557)['then'](function(_0x4e9ecd){var _0x243a7f=[];_0x243a7f[_0xe100('0x94')]({'name':_0x4e9ecd[_0xe100('0xa8')][_0xe100('0xad')][_0xe100('0xaa')][_0xe100('0xab')][_0xe100('0xaa')],'value':_0xe100('0xae')},{'name':_0x4e9ecd[_0xe100('0xa8')][_0xe100('0xaf')][_0xe100('0xaa')]['UserLocalizedLabel'][_0xe100('0xaa')],'value':'false'});var _0x53606f={'id':_0x4d8aff+'_'+_0x4e9ecd[_0xe100('0x90')],'name':_0x4e9ecd['DisplayName'][_0xe100('0xab')][_0xe100('0xaa')],'custom':![],'options':_0x243a7f};_0x46a116[_0xe100('0x94')](_0x53606f);return _0x46a116;});}function getInputList(_0x1a0efa,_0x277620,_0x64c683,_0x1b56f1,_0x3846b3,_0x98575d,_0x8154cf){var _0x12e2fd={'method':_0xe100('0x8c'),'uri':_0x1a0efa+_0xe100('0xa4')+_0x3846b3+_0xe100('0xa5')+_0x98575d+')/Microsoft.Dynamics.CRM.'+_0x64c683+_0xe100('0xb0'),'headers':{'Authorization':_0xe100('0x88')+_0x8154cf,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x12e2fd)[_0xe100('0xc')](function(_0xe3fcb6){var _0x423838={'id':_0x277620+'_'+_0xe3fcb6[_0xe100('0x90')],'name':_0xe3fcb6[_0xe100('0xb1')]['UserLocalizedLabel']?_0xe3fcb6[_0xe100('0xb1')]['UserLocalizedLabel'][_0xe100('0xaa')]:_0xe3fcb6[_0xe100('0x90')],'custom':![],'options':[]};_0x1b56f1[_0xe100('0x94')](_0x423838);return _0x1b56f1;});} \ No newline at end of file +var _0x2458=['name','send','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','Dynamics365Account','includeAll','include','findAll','rows','catch','params','rawAttributes','length','find','create','body','getConfigurations','findOne','Dynamics365Configuration','sort','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','Dynamics365Field','substring','lastIndexOf','format','%s/api/data/v9.0/','getFields','incident','PhoneCall','customerid','ownerid','caseorigincode','subject','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedonbehalfbyname','msdyn_incidenttypename','msdyn_iotalertname','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidyominame','prioritycodename','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidyominame','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','subjectidname','timezoneruleversionnumber','traversedpath','utcconversiontimezonecode','concat','username','password','remoteUri','tenantId','clientId','modernAuthentication','CloudProvider','data7','access_token','data5','POST','https://login.microsoftonline.com/','GET','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(','Attributes','remove','includes','forEach','@odata.type','PicklistAttributeMetadata','push','all','BooleanAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','statusCode','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','UserLocalizedLabel','Value','LogicalName','Label',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','true','FalseOption','false','DisplayName',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','util','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','limit','count','set','update','then','destroy','end','sendStatus','stack'];(function(_0x416eed,_0x3a2a24){var _0x325487=function(_0x45656c){while(--_0x45656c){_0x416eed['push'](_0x416eed['shift']());}};_0x325487(++_0x3a2a24);}(_0x2458,0x167));var _0x8245=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x2458[_0x46e363];return _0x3fb059;};'use strict';var rp=require(_0x8245('0x0'));var util=require(_0x8245('0x1'));var _=require(_0x8245('0x2'));var qs=require(_0x8245('0x3'));var logger=require(_0x8245('0x4'))(_0x8245('0x5'));var db=require(_0x8245('0x6'))['db'];var integrations=require(_0x8245('0x7'));function respondWithResult(_0x2b141c,_0x649754){_0x649754=_0x649754||0xc8;return function(_0x3743d7){if(_0x3743d7){return _0x2b141c[_0x8245('0x8')](_0x649754)[_0x8245('0x9')](_0x3743d7);}};}function respondWithFilteredResult(_0x2b9d09,_0x49cf90){return function(_0x574b07){if(_0x574b07){var _0x499d46=typeof _0x49cf90[_0x8245('0xa')]===_0x8245('0xb')&&typeof _0x49cf90[_0x8245('0xc')]===_0x8245('0xb');var _0x349c19=_0x574b07['count'];var _0xc32767=_0x499d46?0x0:_0x49cf90[_0x8245('0xa')];var _0x23dec7=_0x499d46?_0x574b07[_0x8245('0xd')]:_0x49cf90[_0x8245('0xa')]+_0x49cf90[_0x8245('0xc')];var _0x1659bc;if(_0x23dec7>=_0x349c19){_0x23dec7=_0x349c19;_0x1659bc=0xc8;}else{_0x1659bc=0xce;}_0x2b9d09['status'](_0x1659bc);return _0x2b9d09[_0x8245('0xe')]('Content-Range',_0xc32767+'-'+_0x23dec7+'/'+_0x349c19)[_0x8245('0x9')](_0x574b07);}return null;};}function saveUpdates(_0x31b13f){return function(_0x78b7a9){if(_0x78b7a9){return _0x78b7a9[_0x8245('0xf')](_0x31b13f)[_0x8245('0x10')](function(_0x14f06c){return _0x14f06c;});}return null;};}function removeEntity(_0x285095){return function(_0x1281db){if(_0x1281db){return _0x1281db[_0x8245('0x11')]()[_0x8245('0x10')](function(){_0x285095[_0x8245('0x8')](0xcc)[_0x8245('0x12')]();});}};}function handleEntityNotFound(_0x4757a9){return function(_0x585de0){if(!_0x585de0){_0x4757a9[_0x8245('0x13')](0x194);}return _0x585de0;};}function handleError(_0x2a2257,_0x233da7){_0x233da7=_0x233da7||0x1f4;return function(_0x2d5659){logger['error'](_0x2d5659[_0x8245('0x14')]);if(_0x2d5659[_0x8245('0x15')]){delete _0x2d5659[_0x8245('0x15')];}_0x2a2257['status'](_0x233da7)[_0x8245('0x16')](_0x2d5659);};}exports['index']=function(_0x51c7fa,_0x2154a9){var _0x25e7a7={},_0x50d929={},_0x1e4f98={'count':0x0,'rows':[]};var _0x3f1691=_['map'](db['Dynamics365Account']['rawAttributes'],function(_0x35da46){return{'name':_0x35da46[_0x8245('0x17')],'type':_0x35da46[_0x8245('0x18')][_0x8245('0x19')]};});_0x50d929['model']=_[_0x8245('0x1a')](_0x3f1691,'name');_0x50d929[_0x8245('0x1b')]=_[_0x8245('0x1c')](_0x51c7fa[_0x8245('0x1b')]);_0x50d929[_0x8245('0x1d')]=_[_0x8245('0x1e')](_0x50d929[_0x8245('0x1f')],_0x50d929[_0x8245('0x1b')]);_0x25e7a7[_0x8245('0x20')]=_['intersection'](_0x50d929[_0x8245('0x1f')],qs[_0x8245('0x21')](_0x51c7fa['query'][_0x8245('0x21')]));_0x25e7a7[_0x8245('0x20')]=_0x25e7a7['attributes']['length']?_0x25e7a7[_0x8245('0x20')]:_0x50d929[_0x8245('0x1f')];if(!_0x51c7fa[_0x8245('0x1b')][_0x8245('0x22')](_0x8245('0x23'))){_0x25e7a7[_0x8245('0xc')]=qs[_0x8245('0xc')](_0x51c7fa[_0x8245('0x1b')]['limit']);_0x25e7a7[_0x8245('0xa')]=qs[_0x8245('0xa')](_0x51c7fa[_0x8245('0x1b')]['offset']);}_0x25e7a7[_0x8245('0x24')]=qs['sort'](_0x51c7fa['query']['sort']);_0x25e7a7[_0x8245('0x25')]=qs[_0x8245('0x1d')](_[_0x8245('0x26')](_0x51c7fa[_0x8245('0x1b')],_0x50d929['filters']),_0x3f1691);if(_0x51c7fa[_0x8245('0x1b')][_0x8245('0x27')]){_0x25e7a7[_0x8245('0x25')]=_[_0x8245('0x28')](_0x25e7a7['where'],{'$or':_[_0x8245('0x1a')](_0x3f1691,function(_0x2fb43d){if(_0x2fb43d['type']!==_0x8245('0x29')){var _0x59a868={};_0x59a868[_0x2fb43d[_0x8245('0x15')]]={'$like':'%'+_0x51c7fa[_0x8245('0x1b')]['filter']+'%'};return _0x59a868;}})});}_0x25e7a7=_[_0x8245('0x28')]({},_0x25e7a7,_0x51c7fa[_0x8245('0x2a')]);var _0x3c9688={'where':_0x25e7a7[_0x8245('0x25')]};return db[_0x8245('0x2b')]['count'](_0x3c9688)[_0x8245('0x10')](function(_0x5c3c83){_0x1e4f98[_0x8245('0xd')]=_0x5c3c83;if(_0x51c7fa[_0x8245('0x1b')][_0x8245('0x2c')]){_0x25e7a7[_0x8245('0x2d')]=[{'all':!![]}];}return db[_0x8245('0x2b')][_0x8245('0x2e')](_0x25e7a7);})['then'](function(_0x12b025){_0x1e4f98[_0x8245('0x2f')]=_0x12b025;return _0x1e4f98;})['then'](respondWithFilteredResult(_0x2154a9,_0x25e7a7))[_0x8245('0x30')](handleError(_0x2154a9,null));};exports['show']=function(_0x331c58,_0x3fbda3){var _0x44b84f={'raw':![],'where':{'id':_0x331c58[_0x8245('0x31')]['id']}},_0xf2d939={};_0xf2d939[_0x8245('0x1f')]=_[_0x8245('0x1c')](db[_0x8245('0x2b')][_0x8245('0x32')]);_0xf2d939[_0x8245('0x1b')]=_[_0x8245('0x1c')](_0x331c58['query']);_0xf2d939[_0x8245('0x1d')]=_['intersection'](_0xf2d939[_0x8245('0x1f')],_0xf2d939[_0x8245('0x1b')]);_0x44b84f[_0x8245('0x20')]=_['intersection'](_0xf2d939[_0x8245('0x1f')],qs[_0x8245('0x21')](_0x331c58[_0x8245('0x1b')][_0x8245('0x21')]));_0x44b84f[_0x8245('0x20')]=_0x44b84f['attributes'][_0x8245('0x33')]?_0x44b84f[_0x8245('0x20')]:_0xf2d939['model'];if(_0x331c58[_0x8245('0x1b')][_0x8245('0x2c')]){_0x44b84f[_0x8245('0x2d')]=[{'all':!![]}];}_0x44b84f=_['merge']({},_0x44b84f,_0x331c58[_0x8245('0x2a')]);return db[_0x8245('0x2b')][_0x8245('0x34')](_0x44b84f)[_0x8245('0x10')](handleEntityNotFound(_0x3fbda3,null))['then'](respondWithResult(_0x3fbda3,null))[_0x8245('0x30')](handleError(_0x3fbda3,null));};exports['create']=function(_0x1bb23f,_0x8a8cf9){return db[_0x8245('0x2b')][_0x8245('0x35')](_0x1bb23f[_0x8245('0x36')],{})['then'](respondWithResult(_0x8a8cf9,0xc9))[_0x8245('0x30')](handleError(_0x8a8cf9,null));};exports[_0x8245('0xf')]=function(_0xf4616d,_0x15f81b){if(_0xf4616d[_0x8245('0x36')]['id']){delete _0xf4616d[_0x8245('0x36')]['id'];}return db[_0x8245('0x2b')][_0x8245('0x34')]({'where':{'id':_0xf4616d[_0x8245('0x31')]['id']}})[_0x8245('0x10')](handleEntityNotFound(_0x15f81b,null))[_0x8245('0x10')](saveUpdates(_0xf4616d[_0x8245('0x36')],null))[_0x8245('0x10')](respondWithResult(_0x15f81b,null))[_0x8245('0x30')](handleError(_0x15f81b,null));};exports[_0x8245('0x11')]=function(_0x457568,_0xc9ee2b){return db[_0x8245('0x2b')][_0x8245('0x34')]({'where':{'id':_0x457568[_0x8245('0x31')]['id']}})[_0x8245('0x10')](handleEntityNotFound(_0xc9ee2b,null))['then'](removeEntity(_0xc9ee2b,null))[_0x8245('0x30')](handleError(_0xc9ee2b,null));};exports[_0x8245('0x37')]=function(_0x2e7e38,_0x81043d){var _0x138683={};var _0x3ee0c4={};var _0x48bcf8;var _0x40199f;return db[_0x8245('0x2b')][_0x8245('0x38')]({'where':{'id':_0x2e7e38[_0x8245('0x31')]['id']}})[_0x8245('0x10')](handleEntityNotFound(_0x81043d,null))[_0x8245('0x10')](function(_0x1bcc35){if(_0x1bcc35){_0x48bcf8=_0x1bcc35;_0x3ee0c4['model']=_[_0x8245('0x1c')](db[_0x8245('0x39')][_0x8245('0x32')]);_0x3ee0c4[_0x8245('0x1b')]=_[_0x8245('0x1c')](_0x2e7e38['query']);_0x3ee0c4[_0x8245('0x1d')]=_[_0x8245('0x1e')](_0x3ee0c4[_0x8245('0x1f')],_0x3ee0c4[_0x8245('0x1b')]);_0x138683[_0x8245('0x20')]=_[_0x8245('0x1e')](_0x3ee0c4[_0x8245('0x1f')],qs[_0x8245('0x21')](_0x2e7e38[_0x8245('0x1b')][_0x8245('0x21')]));_0x138683[_0x8245('0x20')]=_0x138683[_0x8245('0x20')][_0x8245('0x33')]?_0x138683[_0x8245('0x20')]:_0x3ee0c4[_0x8245('0x1f')];_0x138683['order']=qs[_0x8245('0x3a')](_0x2e7e38[_0x8245('0x1b')]['sort']);_0x138683[_0x8245('0x25')]=qs['filters'](_[_0x8245('0x26')](_0x2e7e38[_0x8245('0x1b')],_0x3ee0c4[_0x8245('0x1d')]));if(_0x2e7e38[_0x8245('0x1b')][_0x8245('0x27')]){_0x138683[_0x8245('0x25')]=_[_0x8245('0x28')](_0x138683[_0x8245('0x25')],{'$or':_['map'](_0x138683[_0x8245('0x20')],function(_0x3bf6fa){var _0x55dbe8={};_0x55dbe8[_0x3bf6fa]={'$like':'%'+_0x2e7e38[_0x8245('0x1b')][_0x8245('0x27')]+'%'};return _0x55dbe8;})});}_0x138683=_[_0x8245('0x28')]({},_0x138683,_0x2e7e38['options']);return _0x48bcf8['getConfigurations'](_0x138683);}})[_0x8245('0x10')](function(_0x2dd00d){if(_0x2dd00d){_0x40199f=_0x2dd00d[_0x8245('0x33')];if(!_0x2e7e38[_0x8245('0x1b')][_0x8245('0x22')](_0x8245('0x23'))){_0x138683[_0x8245('0xc')]=qs[_0x8245('0xc')](_0x2e7e38[_0x8245('0x1b')][_0x8245('0xc')]);_0x138683['offset']=qs['offset'](_0x2e7e38['query'][_0x8245('0xa')]);}return _0x48bcf8[_0x8245('0x37')](_0x138683);}})[_0x8245('0x10')](function(_0x6caaa3){if(_0x6caaa3){return _0x6caaa3?{'count':_0x40199f,'rows':_0x6caaa3}:null;}})[_0x8245('0x10')](respondWithResult(_0x81043d,null))[_0x8245('0x30')](handleError(_0x81043d,null));};exports[_0x8245('0x3b')]=function(_0x58853a,_0x2c95c9){if(_0x58853a['body']['id']){delete _0x58853a[_0x8245('0x36')]['id'];}return db[_0x8245('0x2b')][_0x8245('0x38')]({'where':{'id':_0x58853a['params']['id']}})[_0x8245('0x10')](handleEntityNotFound(_0x2c95c9,null))['then'](function(_0xb33850){if(_0xb33850){_0x58853a[_0x8245('0x36')][_0x8245('0x3c')]=_0xb33850['id'];_0x58853a[_0x8245('0x36')][_0x8245('0x3d')]=integrations[_0x8245('0x3e')](_0x58853a[_0x8245('0x36')][_0x8245('0x3f')],_0x58853a[_0x8245('0x36')]['type']);_0x58853a[_0x8245('0x36')][_0x8245('0x40')]=integrations['getDescriptions'](_0x58853a['body']['channel'],_0x58853a['body'][_0x8245('0x18')]);return db['Dynamics365Configuration'][_0x8245('0x35')](_0x58853a[_0x8245('0x36')],{'include':[{'model':db[_0x8245('0x41')],'as':'Subjects'},{'model':db['Dynamics365Field'],'as':_0x8245('0x40')}]});}return null;})[_0x8245('0x10')](respondWithResult(_0x2c95c9,null))[_0x8245('0x30')](handleError(_0x2c95c9,null));};function sanitizeRemoteUri(_0xedcfa1){var _0xc90dff=_0xedcfa1['slice'](-0x1);if(_0xc90dff==='/')return _0xedcfa1[_0x8245('0x42')](0x0,_0xedcfa1[_0x8245('0x43')](_0xc90dff));return _0xedcfa1;}function getWebApiUrl(_0x502368){return util[_0x8245('0x44')](_0x8245('0x45'),_0x502368);}exports[_0x8245('0x46')]=function(_0x47ac56,_0x4009e7){var _0x27a7c7=_0x47ac56[_0x8245('0x1b')]['ticketType'];var _0x3ccae9=_0x27a7c7===_0x8245('0x47')?'Incident':_0x8245('0x48');var _0x55353e='';var _0x2a7c93='';var _0x34b9f4='';var _0xd49624='';var _0x326f41='';var _0x5c0b56='';var _0x56ca66='';var _0x13990c='';var _0x1eb14e=['title','description',_0x8245('0x49'),_0x8245('0x4a'),_0x8245('0x4b'),_0x8245('0x4c'),'phonenumber',_0x8245('0x4d'),_0x8245('0x4e'),_0x8245('0x4f')];var _0x21a457=[_0x8245('0x50'),_0x8245('0x51'),_0x8245('0x52'),_0x8245('0x53'),_0x8245('0x54'),'contactidyominame',_0x8245('0x55'),_0x8245('0x56'),_0x8245('0x57'),_0x8245('0x58'),_0x8245('0x59'),'createdbyyominame','createdon',_0x8245('0x5a'),_0x8245('0x5b'),_0x8245('0x5c'),_0x8245('0x5d'),_0x8245('0x5e'),_0x8245('0x5f'),_0x8245('0x60'),_0x8245('0x61'),_0x8245('0x62'),_0x8245('0x63'),_0x8245('0x64'),_0x8245('0x65'),_0x8245('0x66'),_0x8245('0x67'),_0x8245('0x68'),_0x8245('0x69'),'lastonholdtime',_0x8245('0x6a'),_0x8245('0x6b'),_0x8245('0x6c'),_0x8245('0x6d'),_0x8245('0x6e'),'modifiedon',_0x8245('0x6f'),'modifiedonbehalfbyyominame',_0x8245('0x70'),_0x8245('0x71'),'numberofchildincidents',_0x8245('0x72'),_0x8245('0x73'),_0x8245('0x74'),_0x8245('0x75'),_0x8245('0x76'),_0x8245('0x77'),'primarycontactidname',_0x8245('0x78'),_0x8245('0x79'),'productidname',_0x8245('0x7a'),_0x8245('0x7b'),_0x8245('0x7c'),_0x8245('0x7d'),'responsiblecontactidname',_0x8245('0x7e'),'sentimentvalue',_0x8245('0x7f'),_0x8245('0x80'),_0x8245('0x81'),_0x8245('0x82'),_0x8245('0x83'),_0x8245('0x84'),'ticketnumber',_0x8245('0x85'),'transactioncurrencyidname',_0x8245('0x86'),_0x8245('0x87'),'versionnumber'];var _0x2fb7ee=_0x1eb14e[_0x8245('0x88')](_0x21a457);return db['Dynamics365Account'][_0x8245('0x38')]({'where':{'id':_0x47ac56[_0x8245('0x31')]['id']},'attributes':['id',_0x8245('0x89'),_0x8245('0x8a'),_0x8245('0x8b'),_0x8245('0x8c'),_0x8245('0x8d'),'clientSecret',_0x8245('0x8e')],'include':[{'model':db[_0x8245('0x8f')],'as':'CloudProvider','attributes':['id','data5',_0x8245('0x90')]}]})[_0x8245('0x10')](handleEntityNotFound(_0x4009e7,null))['then'](function(_0x14fcbb){if(_0x14fcbb){if(_0x14fcbb[_0x8245('0x8e')]){_0x14fcbb[_0x8245('0x91')]=_0x14fcbb[_0x8245('0x8f')][_0x8245('0x92')];_0x13990c=sanitizeRemoteUri(_0x14fcbb[_0x8245('0x8f')]['data7']);_0x56ca66=getWebApiUrl(_0x13990c);return _0x14fcbb;}_0x13990c=sanitizeRemoteUri(_0x14fcbb[_0x8245('0x8b')]);_0x56ca66=getWebApiUrl(_0x13990c);var _0x2f249d={'method':_0x8245('0x93'),'uri':_0x8245('0x94')+_0x14fcbb['tenantId']+'/oauth2/token','form':{'client_id':_0x14fcbb[_0x8245('0x8d')],'resource':_0x13990c,'username':_0x14fcbb[_0x8245('0x89')],'password':_0x14fcbb[_0x8245('0x8a')],'grant_type':_0x8245('0x8a'),'client_secret':_0x14fcbb['clientSecret']},'json':!![]};return rp(_0x2f249d);}})[_0x8245('0x10')](function(_0x1ec88e){_0x5c0b56=_0x1ec88e[_0x8245('0x91')];var _0x52a44f={'method':_0x8245('0x95'),'uri':encodeURI(_0x56ca66+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x3ccae9+'\x27'),'headers':{'Authorization':_0x8245('0x96')+_0x5c0b56,'If-None-Match':null,'OData-Version':_0x8245('0x97')},'json':!![]};return rp(_0x52a44f);})[_0x8245('0x10')](function(_0x5d5b88){var _0x48998f=_0x5d5b88[_0x8245('0x98')][0x0];var _0x141e98=_0x48998f[_0x8245('0x99')];var _0x16b8e0={'method':'GET','uri':_0x56ca66+_0x8245('0x9a')+_0x141e98+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':'Bearer\x20'+_0x5c0b56,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x16b8e0);})[_0x8245('0x10')](function(_0x200dd0){_0x55353e=_0x200dd0;_0x2a7c93=_0x55353e[_0x8245('0x9b')];_0x2a7c93=_[_0x8245('0x9c')](_0x2a7c93,function(_0x4f8a58){return!_0x2fb7ee[_0x8245('0x9d')](_0x4f8a58['LogicalName']);});var _0x1e21c6=[];var _0x7fb3a2=[];_0x2a7c93[_0x8245('0x9e')](function(_0x58e1d2){if(_0x58e1d2[_0x8245('0x9f')]){var _0x202bdd=_0x58e1d2[_0x8245('0x9f')][_0x8245('0x42')](_0x58e1d2[_0x8245('0x9f')]['lastIndexOf']('.')+0x1);if(_0x202bdd===_0x8245('0xa0')){_0x1e21c6[_0x8245('0xa1')](getSelectList(_0x56ca66,_0x27a7c7,_0x7fb3a2,_0x55353e[_0x8245('0x99')],_0x58e1d2['MetadataId'],_0x5c0b56));}}});return Promise[_0x8245('0xa2')](_0x1e21c6);})[_0x8245('0x10')](function(_0x86cc82){_0x34b9f4=_0x86cc82[0x0];var _0x20487c=[];var _0x1a54d7=[];_0x2a7c93[_0x8245('0x9e')](function(_0xe5b93b){if(!_['isNil'](_0xe5b93b[_0x8245('0x9f')])){var _0x4a90f3=_0xe5b93b[_0x8245('0x9f')][_0x8245('0x42')](_0xe5b93b['@odata.type'][_0x8245('0x43')]('.')+0x1);if(_0x4a90f3===_0x8245('0xa3')){_0x20487c[_0x8245('0xa1')](getBooleanList(_0x56ca66,_0x27a7c7,_0x1a54d7,_0x55353e['MetadataId'],_0xe5b93b['MetadataId'],_0x5c0b56));}}});return Promise['all'](_0x20487c);})[_0x8245('0x10')](function(_0x4d2c13){_0xd49624=_0x4d2c13[0x0];var _0x428240=[];var _0x55c153=[];_0x2a7c93[_0x8245('0x9e')](function(_0x540b5e){if(_0x540b5e[_0x8245('0x9f')]){var _0x12d6e9=_0x540b5e['@odata.type'][_0x8245('0x42')](_0x540b5e[_0x8245('0x9f')][_0x8245('0x43')]('.')+0x1);if(_0x12d6e9==='StringAttributeMetadata'||_0x12d6e9===_0x8245('0xa4')||_0x12d6e9===_0x8245('0xa5')||_0x12d6e9===_0x8245('0xa6')||_0x12d6e9===_0x8245('0xa7')||_0x12d6e9===_0x8245('0xa8')||_0x12d6e9==='StatusAttributeMetadata'||_0x12d6e9==='EntityNameAttributeMetadata'||_0x12d6e9===_0x8245('0xa9')||_0x12d6e9===_0x8245('0xaa')){_0x428240['push'](getInputList(_0x56ca66,_0x27a7c7,_0x12d6e9,_0x55c153,_0x55353e[_0x8245('0x99')],_0x540b5e[_0x8245('0x99')],_0x5c0b56));}}});return Promise['all'](_0x428240);})[_0x8245('0x10')](function(_0x372fba){_0x326f41=_0x372fba[0x0];var _0xcb852e=_0x34b9f4[_0x8245('0x88')](_0xd49624)[_0x8245('0x88')](_0x326f41);var _0x2c0f1c={'count':_0xcb852e[_0x8245('0x33')],'rows':_0xcb852e};return _0x2c0f1c;})['then'](respondWithResult(_0x4009e7,null))[_0x8245('0x30')](function(_0x19ae90){var _0x1c34d4=_0x47ac56[_0x8245('0x1b')][_0x8245('0xab')]?0x1f4:_0x19ae90[_0x8245('0xac')]||0x1f4;logger['error'](_0x19ae90[_0x8245('0x14')]);delete _0x19ae90[_0x8245('0x15')];if(_0x1c34d4===0x191){_0x1c34d4=0x190;}_0x4009e7['status'](_0x1c34d4)[_0x8245('0x16')](_0x47ac56[_0x8245('0x1b')][_0x8245('0xab')]?{'message':_0x8245('0xad'),'statusCode':_0x19ae90[_0x8245('0xac')]}:_0x19ae90);});};function getSelectList(_0x286f0a,_0x5459b4,_0x7c58ed,_0x258011,_0x1a91c0,_0x10f1e9){var _0x340d5d={'method':_0x8245('0x95'),'uri':_0x286f0a+_0x8245('0x9a')+_0x258011+_0x8245('0xae')+_0x1a91c0+_0x8245('0xaf')+_0x8245('0xb0'),'headers':{'Authorization':_0x8245('0x96')+_0x10f1e9,'If-None-Match':null,'OData-Version':_0x8245('0x97')},'json':!![]};return rp(_0x340d5d)[_0x8245('0x10')](function(_0x4785b5){var _0x8964ca=[];var _0x36f1e3=_0x4785b5[_0x8245('0xb1')][_0x8245('0xb2')];_0x36f1e3[_0x8245('0x9e')](function(_0xe3d1e0){_0x8964ca[_0x8245('0xa1')]({'name':_0xe3d1e0['Label'][_0x8245('0xb3')]['Label'],'value':String(_0xe3d1e0[_0x8245('0xb4')])});});var _0x5cbb7b={'id':_0x5459b4+'_'+_0x4785b5[_0x8245('0xb5')],'name':_0x4785b5['DisplayName']['UserLocalizedLabel'][_0x8245('0xb6')],'custom':![],'options':_0x8964ca};_0x7c58ed['push'](_0x5cbb7b);return _0x7c58ed;});}function getBooleanList(_0x3a9f39,_0x236625,_0x2782e6,_0x2278ec,_0x4674e9,_0x1aeb82){var _0x126665={'method':_0x8245('0x95'),'uri':_0x3a9f39+_0x8245('0x9a')+_0x2278ec+_0x8245('0xae')+_0x4674e9+_0x8245('0xb7'),'headers':{'Authorization':_0x8245('0x96')+_0x1aeb82,'If-None-Match':null,'OData-Version':_0x8245('0x97')},'json':!![]};return rp(_0x126665)[_0x8245('0x10')](function(_0x20cd13){var _0x31dc7b=[];_0x31dc7b[_0x8245('0xa1')]({'name':_0x20cd13[_0x8245('0xb1')]['TrueOption'][_0x8245('0xb6')][_0x8245('0xb3')][_0x8245('0xb6')],'value':_0x8245('0xb8')},{'name':_0x20cd13[_0x8245('0xb1')][_0x8245('0xb9')][_0x8245('0xb6')]['UserLocalizedLabel'][_0x8245('0xb6')],'value':_0x8245('0xba')});var _0x1f5891={'id':_0x236625+'_'+_0x20cd13[_0x8245('0xb5')],'name':_0x20cd13[_0x8245('0xbb')]['UserLocalizedLabel'][_0x8245('0xb6')],'custom':![],'options':_0x31dc7b};_0x2782e6[_0x8245('0xa1')](_0x1f5891);return _0x2782e6;});}function getInputList(_0x4da163,_0x144395,_0x5a8df4,_0x5626db,_0x191a25,_0x3fbd93,_0x4a3151){var _0x3404e8={'method':_0x8245('0x95'),'uri':_0x4da163+_0x8245('0x9a')+_0x191a25+_0x8245('0xae')+_0x3fbd93+_0x8245('0xbc')+_0x5a8df4+_0x8245('0xbd'),'headers':{'Authorization':_0x8245('0x96')+_0x4a3151,'If-None-Match':null,'OData-Version':_0x8245('0x97')},'json':!![]};return rp(_0x3404e8)[_0x8245('0x10')](function(_0x346ae0){var _0x3f0e63={'id':_0x144395+'_'+_0x346ae0['LogicalName'],'name':_0x346ae0[_0x8245('0xbb')][_0x8245('0xb3')]?_0x346ae0[_0x8245('0xbb')][_0x8245('0xb3')][_0x8245('0xb6')]:_0x346ae0[_0x8245('0xb5')],'custom':![],'options':[]};_0x5626db['push'](_0x3f0e63);return _0x5626db;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 098318d..41c84b7 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.model.js +++ b/server/api/intDynamics365Account/intDynamics365Account.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['define','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration'];(function(_0x176051,_0x540ee0){var _0x5f2f78=function(_0x3841c5){while(--_0x3841c5){_0x176051['push'](_0x176051['shift']());}};_0x5f2f78(++_0x540ee0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));var integrations=require(_0x0a9e('0x8'));module['exports']=function(_0x219af0,_0x441e3a){return _0x219af0[_0x0a9e('0x9')]('Dynamics365Account',attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbaf0=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','util'];(function(_0x105fd6,_0x13c11f){var _0x4a5714=function(_0x595391){while(--_0x595391){_0x105fd6['push'](_0x105fd6['shift']());}};_0x4a5714(++_0x13c11f);}(_0xbaf0,0x12a));var _0x0baf=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbaf0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));var integrations=require(_0x0baf('0x9'));module[_0x0baf('0xa')]=function(_0x335e24,_0x1a10b1){return _0x335e24[_0x0baf('0xb')](_0x0baf('0xc'),attributes,{'tableName':'int_dynamics365_accounts','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 5891fae..543e4e6 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 _0xe844=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','attributes','limit','map','include','model','ShowDynamics365Account','lodash','moment'];(function(_0x1ca3e0,_0x5c07ae){var _0x3d9c2f=function(_0x4d228f){while(--_0x4d228f){_0x1ca3e0['push'](_0x1ca3e0['shift']());}};_0x3d9c2f(++_0x5c07ae);}(_0xe844,0xc4));var _0x4e84=function(_0x2d86e8,_0x591d0d){_0x2d86e8=_0x2d86e8-0x0;var _0x2cab30=_0xe844[_0x2d86e8];return _0x2cab30;};'use strict';var _=require(_0x4e84('0x0'));var util=require('util');var moment=require(_0x4e84('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4e84('0x2'));var db=require(_0x4e84('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x4e84('0x4'))(_0x4e84('0x5'));var config=require(_0x4e84('0x6'));var jayson=require(_0x4e84('0x7'));var client=jayson[_0x4e84('0x8')][_0x4e84('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x564cfc,_0x15eb26,_0x142159){return new BPromise(function(_0x576ea2,_0x547c0a){return client[_0x4e84('0xa')](_0x564cfc,_0x142159)[_0x4e84('0xb')](function(_0x224d28){logger[_0x4e84('0xc')](_0x4e84('0xd'),_0x15eb26,_0x4e84('0xe'));logger[_0x4e84('0xf')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x15eb26,'request\x20sent',JSON[_0x4e84('0x10')](_0x224d28));if(_0x224d28['error']){if(_0x224d28[_0x4e84('0x11')]['code']===0x1f4){logger[_0x4e84('0x11')]('Dynamics365Account,\x20%s,\x20%s',_0x15eb26,_0x224d28[_0x4e84('0x11')][_0x4e84('0x12')]);return _0x547c0a(_0x224d28[_0x4e84('0x11')][_0x4e84('0x12')]);}logger[_0x4e84('0x11')](_0x4e84('0xd'),_0x15eb26,_0x224d28[_0x4e84('0x11')][_0x4e84('0x12')]);return _0x576ea2(_0x224d28['error'][_0x4e84('0x12')]);}else{logger[_0x4e84('0xc')]('Dynamics365Account,\x20%s,\x20%s',_0x15eb26,_0x4e84('0xe'));_0x576ea2(_0x224d28[_0x4e84('0x13')][_0x4e84('0x12')]);}})[_0x4e84('0x14')](function(_0x15efc3){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x15eb26,_0x15efc3);_0x547c0a(_0x15efc3);});});}exports[_0x4e84('0x15')]=function(_0x25b6eb){var _0x4b59f8=this;return new Promise(function(_0x1d926d,_0x2b9c2b){return db[_0x4e84('0x16')][_0x4e84('0x17')]({'raw':_0x25b6eb[_0x4e84('0x18')]?_0x25b6eb['options'][_0x4e84('0x19')]===undefined?!![]:![]:!![],'where':_0x25b6eb[_0x4e84('0x18')]?_0x25b6eb[_0x4e84('0x18')][_0x4e84('0x1a')]||null:null,'attributes':_0x25b6eb[_0x4e84('0x18')]?_0x25b6eb[_0x4e84('0x18')][_0x4e84('0x1b')]||null:null,'limit':_0x25b6eb[_0x4e84('0x18')]?_0x25b6eb['options'][_0x4e84('0x1c')]||null:null,'include':_0x25b6eb[_0x4e84('0x18')]?_0x25b6eb[_0x4e84('0x18')]['include']?_[_0x4e84('0x1d')](_0x25b6eb[_0x4e84('0x18')][_0x4e84('0x1e')],function(_0x2457b9){return{'model':db[_0x2457b9[_0x4e84('0x1f')]],'as':_0x2457b9['as'],'attributes':_0x2457b9['attributes'],'include':_0x2457b9['include']?_[_0x4e84('0x1d')](_0x2457b9[_0x4e84('0x1e')],function(_0x54a388){return{'model':db[_0x54a388[_0x4e84('0x1f')]],'as':_0x54a388['as'],'attributes':_0x54a388[_0x4e84('0x1b')],'include':_0x54a388['include']?_[_0x4e84('0x1d')](_0x54a388[_0x4e84('0x1e')],function(_0xd018ea){return{'model':db[_0xd018ea[_0x4e84('0x1f')]],'as':_0xd018ea['as'],'attributes':_0xd018ea['attributes']};}):[]};}):[]};}):[]:[]})[_0x4e84('0xb')](function(_0x1eec8e){logger[_0x4e84('0xc')]('GetDynamics365Account',_0x25b6eb);logger[_0x4e84('0xf')](_0x4e84('0x15'),_0x25b6eb,JSON[_0x4e84('0x10')](_0x1eec8e));_0x1d926d(_0x1eec8e);})['catch'](function(_0x291e4f){logger[_0x4e84('0x11')](_0x4e84('0x15'),_0x291e4f[_0x4e84('0x12')],_0x25b6eb);_0x2b9c2b(_0x4b59f8[_0x4e84('0x11')](0x1f4,_0x291e4f['message']));});});};exports[_0x4e84('0x20')]=function(_0x49febb){var _0x5664cd=this;return new Promise(function(_0x465441,_0xc97c9f){return db[_0x4e84('0x16')]['find']({'raw':_0x49febb['options']?_0x49febb[_0x4e84('0x18')][_0x4e84('0x19')]===undefined?!![]:![]:!![],'where':_0x49febb['options']?_0x49febb[_0x4e84('0x18')]['where']||null:null,'attributes':_0x49febb['options']?_0x49febb[_0x4e84('0x18')][_0x4e84('0x1b')]||null:null,'include':_0x49febb[_0x4e84('0x18')]?_0x49febb[_0x4e84('0x18')][_0x4e84('0x1e')]?_[_0x4e84('0x1d')](_0x49febb[_0x4e84('0x18')]['include'],function(_0x425c76){return{'model':db[_0x425c76[_0x4e84('0x1f')]],'as':_0x425c76['as'],'attributes':_0x425c76[_0x4e84('0x1b')],'include':_0x425c76['include']?_['map'](_0x425c76['include'],function(_0x255cb7){return{'model':db[_0x255cb7[_0x4e84('0x1f')]],'as':_0x255cb7['as'],'attributes':_0x255cb7[_0x4e84('0x1b')],'include':_0x255cb7[_0x4e84('0x1e')]?_['map'](_0x255cb7[_0x4e84('0x1e')],function(_0x34a34a){return{'model':db[_0x34a34a['model']],'as':_0x34a34a['as'],'attributes':_0x34a34a[_0x4e84('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x4e84('0xb')](function(_0x228ad3){logger['info'](_0x4e84('0x20'),_0x49febb);logger[_0x4e84('0xf')](_0x4e84('0x20'),_0x49febb,JSON['stringify'](_0x228ad3));_0x465441(_0x228ad3);})[_0x4e84('0x14')](function(_0x2511b0){logger[_0x4e84('0x11')]('ShowDynamics365Account',_0x2511b0[_0x4e84('0x12')],_0x49febb);_0xc97c9f(_0x5664cd[_0x4e84('0x11')](0x1f4,_0x2511b0[_0x4e84('0x12')]));});});}; \ No newline at end of file +var _0xfde3=['catch','find','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','code','error','Dynamics365Account,\x20%s,\x20%s','message','result','Dynamics365Account','findAll','options','raw','where','attributes','limit','include','map','model','GetDynamics365Account'];(function(_0x2b789f,_0x344732){var _0x4e12eb=function(_0x559a32){while(--_0x559a32){_0x2b789f['push'](_0x2b789f['shift']());}};_0x4e12eb(++_0x344732);}(_0xfde3,0xf7));var _0x3fde=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xfde3[_0x126558];return _0x1f6d14;};'use strict';var _=require(_0x3fde('0x0'));var util=require('util');var moment=require(_0x3fde('0x1'));var BPromise=require('bluebird');var rs=require(_0x3fde('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3fde('0x3'))['db'];var utils=require(_0x3fde('0x4'));var logger=require(_0x3fde('0x5'))('rpc');var config=require(_0x3fde('0x6'));var jayson=require(_0x3fde('0x7'));var client=jayson[_0x3fde('0x8')][_0x3fde('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x208584,_0x4df9ec,_0x10b09a){return new BPromise(function(_0x1bd4e3,_0x208483){return client[_0x3fde('0xa')](_0x208584,_0x10b09a)[_0x3fde('0xb')](function(_0x30512f){logger[_0x3fde('0xc')]('Dynamics365Account,\x20%s,\x20%s',_0x4df9ec,_0x3fde('0xd'));logger[_0x3fde('0xe')](_0x3fde('0xf'),_0x4df9ec,'request\x20sent',JSON[_0x3fde('0x10')](_0x30512f));if(_0x30512f['error']){if(_0x30512f['error'][_0x3fde('0x11')]===0x1f4){logger[_0x3fde('0x12')](_0x3fde('0x13'),_0x4df9ec,_0x30512f[_0x3fde('0x12')]['message']);return _0x208483(_0x30512f['error'][_0x3fde('0x14')]);}logger[_0x3fde('0x12')](_0x3fde('0x13'),_0x4df9ec,_0x30512f[_0x3fde('0x12')][_0x3fde('0x14')]);return _0x1bd4e3(_0x30512f['error']['message']);}else{logger[_0x3fde('0xc')](_0x3fde('0x13'),_0x4df9ec,_0x3fde('0xd'));_0x1bd4e3(_0x30512f[_0x3fde('0x15')][_0x3fde('0x14')]);}})['catch'](function(_0x316010){logger['error'](_0x3fde('0x13'),_0x4df9ec,_0x316010);_0x208483(_0x316010);});});}exports['GetDynamics365Account']=function(_0x3b5cb1){var _0x376b67=this;return new Promise(function(_0x1dc973,_0x25378e){return db[_0x3fde('0x16')][_0x3fde('0x17')]({'raw':_0x3b5cb1['options']?_0x3b5cb1[_0x3fde('0x18')][_0x3fde('0x19')]===undefined?!![]:![]:!![],'where':_0x3b5cb1[_0x3fde('0x18')]?_0x3b5cb1['options'][_0x3fde('0x1a')]||null:null,'attributes':_0x3b5cb1[_0x3fde('0x18')]?_0x3b5cb1[_0x3fde('0x18')][_0x3fde('0x1b')]||null:null,'limit':_0x3b5cb1[_0x3fde('0x18')]?_0x3b5cb1[_0x3fde('0x18')][_0x3fde('0x1c')]||null:null,'include':_0x3b5cb1[_0x3fde('0x18')]?_0x3b5cb1[_0x3fde('0x18')][_0x3fde('0x1d')]?_[_0x3fde('0x1e')](_0x3b5cb1[_0x3fde('0x18')][_0x3fde('0x1d')],function(_0x397a25){return{'model':db[_0x397a25[_0x3fde('0x1f')]],'as':_0x397a25['as'],'attributes':_0x397a25[_0x3fde('0x1b')],'include':_0x397a25[_0x3fde('0x1d')]?_[_0x3fde('0x1e')](_0x397a25['include'],function(_0x228689){return{'model':db[_0x228689[_0x3fde('0x1f')]],'as':_0x228689['as'],'attributes':_0x228689['attributes'],'include':_0x228689[_0x3fde('0x1d')]?_[_0x3fde('0x1e')](_0x228689['include'],function(_0x62b755){return{'model':db[_0x62b755[_0x3fde('0x1f')]],'as':_0x62b755['as'],'attributes':_0x62b755[_0x3fde('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x3fde('0xb')](function(_0x40475a){logger['info'](_0x3fde('0x20'),_0x3b5cb1);logger[_0x3fde('0xe')](_0x3fde('0x20'),_0x3b5cb1,JSON[_0x3fde('0x10')](_0x40475a));_0x1dc973(_0x40475a);})[_0x3fde('0x21')](function(_0x11caec){logger['error'](_0x3fde('0x20'),_0x11caec[_0x3fde('0x14')],_0x3b5cb1);_0x25378e(_0x376b67[_0x3fde('0x12')](0x1f4,_0x11caec[_0x3fde('0x14')]));});});};exports['ShowDynamics365Account']=function(_0x2362e3){var _0x4842a8=this;return new Promise(function(_0x11781c,_0x441102){return db[_0x3fde('0x16')][_0x3fde('0x22')]({'raw':_0x2362e3[_0x3fde('0x18')]?_0x2362e3[_0x3fde('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x2362e3[_0x3fde('0x18')]?_0x2362e3[_0x3fde('0x18')]['where']||null:null,'attributes':_0x2362e3[_0x3fde('0x18')]?_0x2362e3[_0x3fde('0x18')][_0x3fde('0x1b')]||null:null,'include':_0x2362e3[_0x3fde('0x18')]?_0x2362e3[_0x3fde('0x18')][_0x3fde('0x1d')]?_[_0x3fde('0x1e')](_0x2362e3['options']['include'],function(_0x41b03d){return{'model':db[_0x41b03d['model']],'as':_0x41b03d['as'],'attributes':_0x41b03d[_0x3fde('0x1b')],'include':_0x41b03d[_0x3fde('0x1d')]?_[_0x3fde('0x1e')](_0x41b03d[_0x3fde('0x1d')],function(_0x36cc8f){return{'model':db[_0x36cc8f[_0x3fde('0x1f')]],'as':_0x36cc8f['as'],'attributes':_0x36cc8f['attributes'],'include':_0x36cc8f[_0x3fde('0x1d')]?_['map'](_0x36cc8f['include'],function(_0x27d886){return{'model':db[_0x27d886['model']],'as':_0x27d886['as'],'attributes':_0x27d886[_0x3fde('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x3fde('0xb')](function(_0x30da77){logger[_0x3fde('0xc')]('ShowDynamics365Account',_0x2362e3);logger[_0x3fde('0xe')]('ShowDynamics365Account',_0x2362e3,JSON[_0x3fde('0x10')](_0x30da77));_0x11781c(_0x30da77);})[_0x3fde('0x21')](function(_0x35a57b){logger['error']('ShowDynamics365Account',_0x35a57b[_0x3fde('0x14')],_0x2362e3);_0x441102(_0x4842a8[_0x3fde('0x12')](0x1f4,_0x35a57b[_0x3fde('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 21c84de..feea949 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 _0x693f=['index','isAuthenticated','getFields','getSubjects','/:id/descriptions','getDescriptions','post','/:id','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get'];(function(_0x48f8ef,_0x1a5cf8){var _0x4edc9b=function(_0x132512){while(--_0x132512){_0x48f8ef['push'](_0x48f8ef['shift']());}};_0x4edc9b(++_0x1a5cf8);}(_0x693f,0x9d));var _0xf693=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x693f[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xf693('0x0'));var util=require(_0xf693('0x1'));var path=require(_0xf693('0x2'));var timeout=require(_0xf693('0x3'));var express=require('express');var router=express[_0xf693('0x4')]();var fs_extra=require(_0xf693('0x5'));var auth=require(_0xf693('0x6'));var interaction=require(_0xf693('0x7'));var config=require(_0xf693('0x8'));var controller=require(_0xf693('0x9'));router[_0xf693('0xa')]('/',auth['isAuthenticated'](),controller[_0xf693('0xb')]);router[_0xf693('0xa')]('/:id',auth[_0xf693('0xc')](),controller['show']);router[_0xf693('0xa')]('/:id/fields',auth[_0xf693('0xc')](),controller[_0xf693('0xd')]);router['get']('/:id/subjects',auth['isAuthenticated'](),controller[_0xf693('0xe')]);router['get'](_0xf693('0xf'),auth[_0xf693('0xc')](),controller[_0xf693('0x10')]);router[_0xf693('0x11')]('/',auth[_0xf693('0xc')](),controller['create']);router['put'](_0xf693('0x12'),auth[_0xf693('0xc')](),controller['update']);router[_0xf693('0x13')](_0xf693('0x12'),auth['isAuthenticated'](),controller['destroy']);module[_0xf693('0x14')]=router; \ No newline at end of file +var _0xf4af=['destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','put','/:id','update','delete'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xf4af,0x7a));var _0xff4a=function(_0x4b48e5,_0xc3c425){_0x4b48e5=_0x4b48e5-0x0;var _0x210b17=_0xf4af[_0x4b48e5];return _0x210b17;};'use strict';var multer=require('multer');var util=require(_0xff4a('0x0'));var path=require(_0xff4a('0x1'));var timeout=require(_0xff4a('0x2'));var express=require(_0xff4a('0x3'));var router=express['Router']();var fs_extra=require(_0xff4a('0x4'));var auth=require(_0xff4a('0x5'));var interaction=require(_0xff4a('0x6'));var config=require(_0xff4a('0x7'));var controller=require('./intDynamics365Configuration.controller');router[_0xff4a('0x8')]('/',auth[_0xff4a('0x9')](),controller[_0xff4a('0xa')]);router['get']('/:id',auth[_0xff4a('0x9')](),controller[_0xff4a('0xb')]);router[_0xff4a('0x8')](_0xff4a('0xc'),auth[_0xff4a('0x9')](),controller[_0xff4a('0xd')]);router[_0xff4a('0x8')](_0xff4a('0xe'),auth[_0xff4a('0x9')](),controller['getSubjects']);router[_0xff4a('0x8')](_0xff4a('0xf'),auth[_0xff4a('0x9')](),controller[_0xff4a('0x10')]);router[_0xff4a('0x11')]('/',auth[_0xff4a('0x9')](),controller['create']);router[_0xff4a('0x12')](_0xff4a('0x13'),auth['isAuthenticated'](),controller[_0xff4a('0x14')]);router[_0xff4a('0x15')](_0xff4a('0x13'),auth[_0xff4a('0x9')](),controller[_0xff4a('0x16')]);module[_0xff4a('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 99256e1..1214c4d 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 _0xb2d7=['phonecall','incident','ENUM','contact','BOOLEAN','sequelize','STRING'];(function(_0x261c53,_0x497f83){var _0xa39042=function(_0x2673fb){while(--_0x2673fb){_0x261c53['push'](_0x261c53['shift']());}};_0xa39042(++_0x497f83);}(_0xb2d7,0xb4));var _0x7b2d=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xb2d7[_0x46aff0];return _0x9d78cf;};'use strict';var Sequelize=require(_0x7b2d('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b2d('0x1')]},'description':{'type':Sequelize[_0x7b2d('0x1')]},'ticketType':{'type':Sequelize['ENUM']('incident',_0x7b2d('0x2')),'defaultValue':_0x7b2d('0x3')},'moduleCreate':{'type':Sequelize[_0x7b2d('0x4')](_0x7b2d('0x5'),'nothing'),'defaultValue':'contact','allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x7b2d('0x1')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x7b2d('0x6')],'defaultValue':!![]}}; \ No newline at end of file +var _0xdb35=['exports','STRING','ENUM','incident','phonecall','contact','nothing','BOOLEAN','sequelize'];(function(_0x35c66d,_0x269cef){var _0x5a6636=function(_0x2e504a){while(--_0x2e504a){_0x35c66d['push'](_0x35c66d['shift']());}};_0x5a6636(++_0x269cef);}(_0xdb35,0x15e));var _0x5db3=function(_0x58332b,_0x158d5d){_0x58332b=_0x58332b-0x0;var _0x2376af=_0xdb35[_0x58332b];return _0x2376af;};'use strict';var Sequelize=require(_0x5db3('0x0'));module[_0x5db3('0x1')]={'name':{'type':Sequelize[_0x5db3('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x5db3('0x3')](_0x5db3('0x4'),_0x5db3('0x5')),'defaultValue':_0x5db3('0x4')},'moduleCreate':{'type':Sequelize['ENUM'](_0x5db3('0x6'),_0x5db3('0x7')),'defaultValue':_0x5db3('0x6'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x5db3('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x5db3('0x8')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index a675ae1..7de2919 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 _0x2e09=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','undefined','offset','limit','set','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','index','map','Dynamics365Configuration','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','count','include','findAll','catch','show','params','includeAll','find','body','getFields','findOne','Dynamics365Field','hasOwnProperty','order','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring'];(function(_0x12bfcd,_0x37864a){var _0x2b2c31=function(_0x464634){while(--_0x464634){_0x12bfcd['push'](_0x12bfcd['shift']());}};_0x2b2c31(++_0x37864a);}(_0x2e09,0x1e7));var _0x92e0=function(_0xd42315,_0x5cf89a){_0xd42315=_0xd42315-0x0;var _0x311ad8=_0x2e09[_0xd42315];return _0x311ad8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x92e0('0x0'));var zipdir=require(_0x92e0('0x1'));var jsonpatch=require(_0x92e0('0x2'));var rp=require(_0x92e0('0x3'));var moment=require(_0x92e0('0x4'));var BPromise=require(_0x92e0('0x5'));var Mustache=require(_0x92e0('0x6'));var util=require(_0x92e0('0x7'));var path=require(_0x92e0('0x8'));var sox=require(_0x92e0('0x9'));var csv=require(_0x92e0('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x92e0('0xb'));var _=require(_0x92e0('0xc'));var squel=require(_0x92e0('0xd'));var crypto=require(_0x92e0('0xe'));var jsforce=require(_0x92e0('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x92e0('0xa'));var querystring=require(_0x92e0('0x10'));var Papa=require(_0x92e0('0x11'));var Redis=require(_0x92e0('0x12'));var authService=require(_0x92e0('0x13'));var qs=require(_0x92e0('0x14'));var as=require(_0x92e0('0x15'));var hardwareService=require(_0x92e0('0x16'));var logger=require(_0x92e0('0x17'))(_0x92e0('0x18'));var utils=require(_0x92e0('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x92e0('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x402174,_0x926001){_0x926001=_0x926001||0xcc;return function(_0x214806){if(_0x214806){return _0x402174[_0x92e0('0x1b')](_0x926001);}return _0x402174[_0x92e0('0x1c')](_0x926001)[_0x92e0('0x1d')]();};}function respondWithResult(_0x455fc5,_0x27b0a5){_0x27b0a5=_0x27b0a5||0xc8;return function(_0x3f4fdf){if(_0x3f4fdf){return _0x455fc5[_0x92e0('0x1c')](_0x27b0a5)['json'](_0x3f4fdf);}};}function respondWithFilteredResult(_0x548dd9,_0x574396){return function(_0x1cee0f){if(_0x1cee0f){var _0x1adf11=typeof _0x574396['offset']==='undefined'&&typeof _0x574396['limit']===_0x92e0('0x1e');var _0x100c1e=_0x1cee0f['count'];var _0x14a355=_0x1adf11?0x0:_0x574396[_0x92e0('0x1f')];var _0x1f3bd=_0x1adf11?_0x1cee0f['count']:_0x574396[_0x92e0('0x1f')]+_0x574396[_0x92e0('0x20')];var _0x438744;if(_0x1f3bd>=_0x100c1e){_0x1f3bd=_0x100c1e;_0x438744=0xc8;}else{_0x438744=0xce;}_0x548dd9[_0x92e0('0x1c')](_0x438744);return _0x548dd9[_0x92e0('0x21')](_0x92e0('0x22'),_0x14a355+'-'+_0x1f3bd+'/'+_0x100c1e)[_0x92e0('0x23')](_0x1cee0f);}return null;};}function patchUpdates(_0xc1833b){return function(_0x32b588){try{jsonpatch[_0x92e0('0x24')](_0x32b588,_0xc1833b,!![]);}catch(_0x17dfe6){return BPromise['reject'](_0x17dfe6);}return _0x32b588[_0x92e0('0x25')]();};}function saveUpdates(_0x27b9cf,_0x49aa14){return function(_0x1d8758){if(_0x1d8758){return _0x1d8758[_0x92e0('0x26')](_0x27b9cf)[_0x92e0('0x27')](function(_0x205501){return _0x205501;});}return null;};}function removeEntity(_0x2c953c,_0x5e8fc0){return function(_0x148de4){if(_0x148de4){return _0x148de4[_0x92e0('0x28')]()['then'](function(){_0x2c953c[_0x92e0('0x1c')](0xcc)[_0x92e0('0x1d')]();});}};}function handleEntityNotFound(_0x31b5ca,_0x54e96f){return function(_0x37e8c7){if(!_0x37e8c7){_0x31b5ca['sendStatus'](0x194);}return _0x37e8c7;};}function handleError(_0x1815bc,_0x299788){_0x299788=_0x299788||0x1f4;return function(_0x32d72a){logger[_0x92e0('0x29')](_0x32d72a[_0x92e0('0x2a')]);if(_0x32d72a['name']){delete _0x32d72a[_0x92e0('0x2b')];}_0x1815bc[_0x92e0('0x1c')](_0x299788)[_0x92e0('0x2c')](_0x32d72a);};}exports[_0x92e0('0x2d')]=function(_0x273e59,_0x23b4e3){var _0x2f0eee={},_0x265f6c={},_0x305ed5={'count':0x0,'rows':[]};var _0xb538ed=_[_0x92e0('0x2e')](db[_0x92e0('0x2f')][_0x92e0('0x30')],function(_0x2b83b2){return{'name':_0x2b83b2[_0x92e0('0x31')],'type':_0x2b83b2[_0x92e0('0x32')][_0x92e0('0x33')]};});_0x265f6c['model']=_[_0x92e0('0x2e')](_0xb538ed,_0x92e0('0x2b'));_0x265f6c[_0x92e0('0x34')]=_[_0x92e0('0x35')](_0x273e59[_0x92e0('0x34')]);_0x265f6c[_0x92e0('0x36')]=_[_0x92e0('0x37')](_0x265f6c['model'],_0x265f6c[_0x92e0('0x34')]);_0x2f0eee[_0x92e0('0x38')]=_[_0x92e0('0x37')](_0x265f6c[_0x92e0('0x39')],qs[_0x92e0('0x3a')](_0x273e59['query'][_0x92e0('0x3a')]));_0x2f0eee['attributes']=_0x2f0eee[_0x92e0('0x38')][_0x92e0('0x3b')]?_0x2f0eee['attributes']:_0x265f6c[_0x92e0('0x39')];if(!_0x273e59['query']['hasOwnProperty'](_0x92e0('0x3c'))){_0x2f0eee[_0x92e0('0x20')]=qs[_0x92e0('0x20')](_0x273e59['query'][_0x92e0('0x20')]);_0x2f0eee[_0x92e0('0x1f')]=qs[_0x92e0('0x1f')](_0x273e59['query'][_0x92e0('0x1f')]);}_0x2f0eee['order']=qs[_0x92e0('0x3d')](_0x273e59[_0x92e0('0x34')]['sort']);_0x2f0eee[_0x92e0('0x3e')]=qs[_0x92e0('0x36')](_[_0x92e0('0x3f')](_0x273e59['query'],_0x265f6c[_0x92e0('0x36')]),_0xb538ed);if(_0x273e59[_0x92e0('0x34')][_0x92e0('0x40')]){_0x2f0eee[_0x92e0('0x3e')]=_[_0x92e0('0x41')](_0x2f0eee[_0x92e0('0x3e')],{'$or':_[_0x92e0('0x2e')](_0xb538ed,function(_0x154f9f){if(_0x154f9f[_0x92e0('0x32')]!==_0x92e0('0x42')){var _0x20a02a={};_0x20a02a[_0x154f9f['name']]={'$like':'%'+_0x273e59['query'][_0x92e0('0x40')]+'%'};return _0x20a02a;}})});}_0x2f0eee=_[_0x92e0('0x41')]({},_0x2f0eee,_0x273e59[_0x92e0('0x43')]);var _0x8504b4={'where':_0x2f0eee[_0x92e0('0x3e')]};return db['Dynamics365Configuration'][_0x92e0('0x44')](_0x8504b4)[_0x92e0('0x27')](function(_0x9cdb85){_0x305ed5[_0x92e0('0x44')]=_0x9cdb85;if(_0x273e59[_0x92e0('0x34')]['includeAll']){_0x2f0eee[_0x92e0('0x45')]=[{'all':!![]}];}return db[_0x92e0('0x2f')][_0x92e0('0x46')](_0x2f0eee);})[_0x92e0('0x27')](function(_0x4d0bd5){_0x305ed5['rows']=_0x4d0bd5;return _0x305ed5;})[_0x92e0('0x27')](respondWithFilteredResult(_0x23b4e3,_0x2f0eee))[_0x92e0('0x47')](handleError(_0x23b4e3,null));};exports[_0x92e0('0x48')]=function(_0x37d4b7,_0x3777b5){var _0x3b2c85={'raw':![],'where':{'id':_0x37d4b7[_0x92e0('0x49')]['id']}},_0x315074={};_0x315074[_0x92e0('0x39')]=_[_0x92e0('0x35')](db['Dynamics365Configuration'][_0x92e0('0x30')]);_0x315074['query']=_[_0x92e0('0x35')](_0x37d4b7['query']);_0x315074['filters']=_[_0x92e0('0x37')](_0x315074[_0x92e0('0x39')],_0x315074['query']);_0x3b2c85[_0x92e0('0x38')]=_[_0x92e0('0x37')](_0x315074['model'],qs[_0x92e0('0x3a')](_0x37d4b7[_0x92e0('0x34')][_0x92e0('0x3a')]));_0x3b2c85[_0x92e0('0x38')]=_0x3b2c85['attributes']['length']?_0x3b2c85[_0x92e0('0x38')]:_0x315074[_0x92e0('0x39')];if(_0x37d4b7[_0x92e0('0x34')][_0x92e0('0x4a')]){_0x3b2c85[_0x92e0('0x45')]=[{'all':!![]}];}_0x3b2c85=_[_0x92e0('0x41')]({},_0x3b2c85,_0x37d4b7[_0x92e0('0x43')]);return db['Dynamics365Configuration'][_0x92e0('0x4b')](_0x3b2c85)['then'](handleEntityNotFound(_0x3777b5,null))['then'](respondWithResult(_0x3777b5,null))[_0x92e0('0x47')](handleError(_0x3777b5,null));};exports['create']=function(_0xc867a0,_0x43f4f2){return db[_0x92e0('0x2f')]['create'](_0xc867a0[_0x92e0('0x4c')],{})[_0x92e0('0x27')](respondWithResult(_0x43f4f2,0xc9))['catch'](handleError(_0x43f4f2,null));};exports[_0x92e0('0x26')]=function(_0x4ce76a,_0x4f07b9){if(_0x4ce76a[_0x92e0('0x4c')]['id']){delete _0x4ce76a['body']['id'];}return db['Dynamics365Configuration'][_0x92e0('0x4b')]({'where':{'id':_0x4ce76a[_0x92e0('0x49')]['id']}})['then'](handleEntityNotFound(_0x4f07b9,null))[_0x92e0('0x27')](saveUpdates(_0x4ce76a[_0x92e0('0x4c')],null))[_0x92e0('0x27')](respondWithResult(_0x4f07b9,null))[_0x92e0('0x47')](handleError(_0x4f07b9,null));};exports[_0x92e0('0x28')]=function(_0x2e67c1,_0x1bad55){return db[_0x92e0('0x2f')][_0x92e0('0x4b')]({'where':{'id':_0x2e67c1[_0x92e0('0x49')]['id']}})[_0x92e0('0x27')](handleEntityNotFound(_0x1bad55,null))[_0x92e0('0x27')](removeEntity(_0x1bad55,null))['catch'](handleError(_0x1bad55,null));};exports[_0x92e0('0x4d')]=function(_0x7c5f72,_0x5042a6,_0x1f7be4){var _0x395c70={};var _0x403115={};var _0x3c8909;var _0x22fa60;return db[_0x92e0('0x2f')][_0x92e0('0x4e')]({'where':{'id':_0x7c5f72[_0x92e0('0x49')]['id']}})['then'](handleEntityNotFound(_0x5042a6,null))[_0x92e0('0x27')](function(_0x285aab){if(_0x285aab){_0x3c8909=_0x285aab;_0x403115[_0x92e0('0x39')]=_[_0x92e0('0x35')](db[_0x92e0('0x4f')][_0x92e0('0x30')]);_0x403115[_0x92e0('0x34')]=_[_0x92e0('0x35')](_0x7c5f72[_0x92e0('0x34')]);_0x403115['filters']=_[_0x92e0('0x37')](_0x403115[_0x92e0('0x39')],_0x403115['query']);_0x395c70[_0x92e0('0x38')]=_[_0x92e0('0x37')](_0x403115[_0x92e0('0x39')],qs['fields'](_0x7c5f72[_0x92e0('0x34')][_0x92e0('0x3a')]));_0x395c70[_0x92e0('0x38')]=_0x395c70[_0x92e0('0x38')][_0x92e0('0x3b')]?_0x395c70['attributes']:_0x403115[_0x92e0('0x39')];_0x395c70['order']=qs[_0x92e0('0x3d')](_0x7c5f72[_0x92e0('0x34')][_0x92e0('0x3d')]);_0x395c70[_0x92e0('0x3e')]=qs[_0x92e0('0x36')](_[_0x92e0('0x3f')](_0x7c5f72[_0x92e0('0x34')],_0x403115[_0x92e0('0x36')]));if(_0x7c5f72['query'][_0x92e0('0x40')]){_0x395c70['where']=_[_0x92e0('0x41')](_0x395c70[_0x92e0('0x3e')],{'$or':_[_0x92e0('0x2e')](_0x395c70[_0x92e0('0x38')],function(_0x5a8806){var _0x3a6982={};_0x3a6982[_0x5a8806]={'$like':'%'+_0x7c5f72[_0x92e0('0x34')]['filter']+'%'};return _0x3a6982;})});}_0x395c70=_[_0x92e0('0x41')]({},_0x395c70,_0x7c5f72[_0x92e0('0x43')]);return _0x3c8909[_0x92e0('0x4d')](_0x395c70);}})['then'](function(_0x294205){if(_0x294205){_0x22fa60=_0x294205[_0x92e0('0x3b')];if(!_0x7c5f72['query'][_0x92e0('0x50')]('nolimit')){_0x395c70['limit']=qs[_0x92e0('0x20')](_0x7c5f72[_0x92e0('0x34')][_0x92e0('0x20')]);_0x395c70[_0x92e0('0x1f')]=qs[_0x92e0('0x1f')](_0x7c5f72[_0x92e0('0x34')][_0x92e0('0x1f')]);}return _0x3c8909[_0x92e0('0x4d')](_0x395c70);}})[_0x92e0('0x27')](function(_0x243d45){if(_0x243d45){return _0x243d45?{'count':_0x22fa60,'rows':_0x243d45}:null;}})[_0x92e0('0x27')](respondWithResult(_0x5042a6,null))['catch'](handleError(_0x5042a6,null));};exports['getSubjects']=function(_0x679ba2,_0x2ee6d2,_0x4aa40a){var _0x795aa5={};var _0x25dbb1={};var _0x546ca6;var _0x2eb834;return db['Dynamics365Configuration'][_0x92e0('0x4e')]({'where':{'id':_0x679ba2[_0x92e0('0x49')]['id']}})['then'](handleEntityNotFound(_0x2ee6d2,null))['then'](function(_0x94f1){if(_0x94f1){_0x546ca6=_0x94f1;_0x25dbb1[_0x92e0('0x39')]=_['keys'](db[_0x92e0('0x4f')]['rawAttributes']);_0x25dbb1[_0x92e0('0x34')]=_[_0x92e0('0x35')](_0x679ba2[_0x92e0('0x34')]);_0x25dbb1[_0x92e0('0x36')]=_[_0x92e0('0x37')](_0x25dbb1['model'],_0x25dbb1[_0x92e0('0x34')]);_0x795aa5[_0x92e0('0x38')]=_[_0x92e0('0x37')](_0x25dbb1[_0x92e0('0x39')],qs['fields'](_0x679ba2[_0x92e0('0x34')][_0x92e0('0x3a')]));_0x795aa5['attributes']=_0x795aa5[_0x92e0('0x38')]['length']?_0x795aa5[_0x92e0('0x38')]:_0x25dbb1['model'];_0x795aa5[_0x92e0('0x51')]=qs[_0x92e0('0x3d')](_0x679ba2[_0x92e0('0x34')][_0x92e0('0x3d')]);_0x795aa5['where']=qs['filters'](_[_0x92e0('0x3f')](_0x679ba2[_0x92e0('0x34')],_0x25dbb1[_0x92e0('0x36')]));if(_0x679ba2['query'][_0x92e0('0x40')]){_0x795aa5['where']=_['merge'](_0x795aa5[_0x92e0('0x3e')],{'$or':_[_0x92e0('0x2e')](_0x795aa5[_0x92e0('0x38')],function(_0x59a0a6){var _0x3c42c6={};_0x3c42c6[_0x59a0a6]={'$like':'%'+_0x679ba2[_0x92e0('0x34')][_0x92e0('0x40')]+'%'};return _0x3c42c6;})});}_0x795aa5=_[_0x92e0('0x41')]({},_0x795aa5,_0x679ba2['options']);return _0x546ca6[_0x92e0('0x52')](_0x795aa5);}})[_0x92e0('0x27')](function(_0x5015f3){if(_0x5015f3){_0x2eb834=_0x5015f3[_0x92e0('0x3b')];if(!_0x679ba2[_0x92e0('0x34')]['hasOwnProperty']('nolimit')){_0x795aa5['limit']=qs[_0x92e0('0x20')](_0x679ba2[_0x92e0('0x34')]['limit']);_0x795aa5[_0x92e0('0x1f')]=qs[_0x92e0('0x1f')](_0x679ba2[_0x92e0('0x34')][_0x92e0('0x1f')]);}return _0x546ca6[_0x92e0('0x52')](_0x795aa5);}})[_0x92e0('0x27')](function(_0x27173d){if(_0x27173d){return _0x27173d?{'count':_0x2eb834,'rows':_0x27173d}:null;}})[_0x92e0('0x27')](respondWithResult(_0x2ee6d2,null))[_0x92e0('0x47')](handleError(_0x2ee6d2,null));};exports[_0x92e0('0x53')]=function(_0x45c652,_0x279e4b,_0x1dc99f){var _0x128ae4={};var _0x3bf6c1={};var _0x56e378;var _0xf1b2b1;return db[_0x92e0('0x2f')][_0x92e0('0x4e')]({'where':{'id':_0x45c652[_0x92e0('0x49')]['id']}})[_0x92e0('0x27')](handleEntityNotFound(_0x279e4b,null))[_0x92e0('0x27')](function(_0x33dcb5){if(_0x33dcb5){_0x56e378=_0x33dcb5;_0x3bf6c1[_0x92e0('0x39')]=_[_0x92e0('0x35')](db['Dynamics365Field']['rawAttributes']);_0x3bf6c1[_0x92e0('0x34')]=_[_0x92e0('0x35')](_0x45c652[_0x92e0('0x34')]);_0x3bf6c1[_0x92e0('0x36')]=_[_0x92e0('0x37')](_0x3bf6c1[_0x92e0('0x39')],_0x3bf6c1[_0x92e0('0x34')]);_0x128ae4[_0x92e0('0x38')]=_[_0x92e0('0x37')](_0x3bf6c1[_0x92e0('0x39')],qs['fields'](_0x45c652['query']['fields']));_0x128ae4[_0x92e0('0x38')]=_0x128ae4[_0x92e0('0x38')][_0x92e0('0x3b')]?_0x128ae4[_0x92e0('0x38')]:_0x3bf6c1[_0x92e0('0x39')];_0x128ae4[_0x92e0('0x51')]=qs['sort'](_0x45c652[_0x92e0('0x34')][_0x92e0('0x3d')]);_0x128ae4['where']=qs['filters'](_[_0x92e0('0x3f')](_0x45c652[_0x92e0('0x34')],_0x3bf6c1[_0x92e0('0x36')]));if(_0x45c652[_0x92e0('0x34')][_0x92e0('0x40')]){_0x128ae4[_0x92e0('0x3e')]=_['merge'](_0x128ae4[_0x92e0('0x3e')],{'$or':_['map'](_0x128ae4['attributes'],function(_0x24a90a){var _0xb19862={};_0xb19862[_0x24a90a]={'$like':'%'+_0x45c652['query'][_0x92e0('0x40')]+'%'};return _0xb19862;})});}_0x128ae4=_[_0x92e0('0x41')]({},_0x128ae4,_0x45c652[_0x92e0('0x43')]);return _0x56e378['getDescriptions'](_0x128ae4);}})['then'](function(_0x594a7e){if(_0x594a7e){_0xf1b2b1=_0x594a7e[_0x92e0('0x3b')];if(!_0x45c652[_0x92e0('0x34')][_0x92e0('0x50')](_0x92e0('0x3c'))){_0x128ae4[_0x92e0('0x20')]=qs['limit'](_0x45c652[_0x92e0('0x34')][_0x92e0('0x20')]);_0x128ae4[_0x92e0('0x1f')]=qs[_0x92e0('0x1f')](_0x45c652[_0x92e0('0x34')][_0x92e0('0x1f')]);}return _0x56e378[_0x92e0('0x53')](_0x128ae4);}})[_0x92e0('0x27')](function(_0x3880dd){if(_0x3880dd){return _0x3880dd?{'count':_0xf1b2b1,'rows':_0x3880dd}:null;}})['then'](respondWithResult(_0x279e4b,null))[_0x92e0('0x47')](handleError(_0x279e4b,null));}; \ No newline at end of file +var _0x3c8b=['where','filters','pick','filter','merge','VIRTUAL','name','options','count','then','includeAll','include','findAll','rows','catch','show','params','create','body','find','getFields','findOne','Dynamics365Field','hasOwnProperty','getSubjects','getDescriptions','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','limit','undefined','Content-Range','json','apply','reject','save','update','destroy','end','stack','map','Dynamics365Configuration','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort'];(function(_0x159235,_0x6c7f91){var _0x5345de=function(_0xf7aa28){while(--_0xf7aa28){_0x159235['push'](_0x159235['shift']());}};_0x5345de(++_0x6c7f91);}(_0x3c8b,0x67));var _0xb3c8=function(_0x152c79,_0x521f52){_0x152c79=_0x152c79-0x0;var _0x5d08eb=_0x3c8b[_0x152c79];return _0x5d08eb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb3c8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb3c8('0x1'));var rp=require(_0xb3c8('0x2'));var moment=require(_0xb3c8('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb3c8('0x4'));var util=require(_0xb3c8('0x5'));var path=require(_0xb3c8('0x6'));var sox=require(_0xb3c8('0x7'));var csv=require(_0xb3c8('0x8'));var ejs=require(_0xb3c8('0x9'));var fs=require('fs');var fs_extra=require(_0xb3c8('0xa'));var _=require(_0xb3c8('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb3c8('0xc'));var Papa=require(_0xb3c8('0xd'));var Redis=require('ioredis');var authService=require(_0xb3c8('0xe'));var qs=require(_0xb3c8('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb3c8('0x10'));var logger=require('../../config/logger')(_0xb3c8('0x11'));var utils=require(_0xb3c8('0x12'));var config=require(_0xb3c8('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xb3c8('0x14'))['db'];function respondWithStatusCode(_0x898559,_0x1eb167){_0x1eb167=_0x1eb167||0xcc;return function(_0x3938d8){if(_0x3938d8){return _0x898559[_0xb3c8('0x15')](_0x1eb167);}return _0x898559[_0xb3c8('0x16')](_0x1eb167)['end']();};}function respondWithResult(_0x4f7b73,_0x165c61){_0x165c61=_0x165c61||0xc8;return function(_0x32844f){if(_0x32844f){return _0x4f7b73[_0xb3c8('0x16')](_0x165c61)['json'](_0x32844f);}};}function respondWithFilteredResult(_0x25b426,_0x2c4a8d){return function(_0x175116){if(_0x175116){var _0x43dfc2=typeof _0x2c4a8d[_0xb3c8('0x17')]==='undefined'&&typeof _0x2c4a8d[_0xb3c8('0x18')]===_0xb3c8('0x19');var _0x13bb07=_0x175116['count'];var _0xaf0822=_0x43dfc2?0x0:_0x2c4a8d[_0xb3c8('0x17')];var _0x305fae=_0x43dfc2?_0x175116['count']:_0x2c4a8d[_0xb3c8('0x17')]+_0x2c4a8d[_0xb3c8('0x18')];var _0x437327;if(_0x305fae>=_0x13bb07){_0x305fae=_0x13bb07;_0x437327=0xc8;}else{_0x437327=0xce;}_0x25b426[_0xb3c8('0x16')](_0x437327);return _0x25b426['set'](_0xb3c8('0x1a'),_0xaf0822+'-'+_0x305fae+'/'+_0x13bb07)[_0xb3c8('0x1b')](_0x175116);}return null;};}function patchUpdates(_0x40b886){return function(_0x26be5f){try{jsonpatch[_0xb3c8('0x1c')](_0x26be5f,_0x40b886,!![]);}catch(_0x4d1c58){return BPromise[_0xb3c8('0x1d')](_0x4d1c58);}return _0x26be5f[_0xb3c8('0x1e')]();};}function saveUpdates(_0x311de6,_0xbce116){return function(_0x4d1b5c){if(_0x4d1b5c){return _0x4d1b5c[_0xb3c8('0x1f')](_0x311de6)['then'](function(_0x31b032){return _0x31b032;});}return null;};}function removeEntity(_0x30ff0d,_0x588c24){return function(_0x50a7df){if(_0x50a7df){return _0x50a7df[_0xb3c8('0x20')]()['then'](function(){_0x30ff0d['status'](0xcc)[_0xb3c8('0x21')]();});}};}function handleEntityNotFound(_0x57607b,_0xa80aaa){return function(_0x267001){if(!_0x267001){_0x57607b['sendStatus'](0x194);}return _0x267001;};}function handleError(_0x4aec78,_0x247c17){_0x247c17=_0x247c17||0x1f4;return function(_0x2180ab){logger['error'](_0x2180ab[_0xb3c8('0x22')]);if(_0x2180ab['name']){delete _0x2180ab['name'];}_0x4aec78[_0xb3c8('0x16')](_0x247c17)['send'](_0x2180ab);};}exports['index']=function(_0xc95642,_0x2a57b2){var _0x54ede1={},_0x34c34b={},_0x597ff0={'count':0x0,'rows':[]};var _0x1d3699=_[_0xb3c8('0x23')](db[_0xb3c8('0x24')][_0xb3c8('0x25')],function(_0x472787){return{'name':_0x472787[_0xb3c8('0x26')],'type':_0x472787[_0xb3c8('0x27')][_0xb3c8('0x28')]};});_0x34c34b[_0xb3c8('0x29')]=_['map'](_0x1d3699,'name');_0x34c34b[_0xb3c8('0x2a')]=_[_0xb3c8('0x2b')](_0xc95642[_0xb3c8('0x2a')]);_0x34c34b['filters']=_[_0xb3c8('0x2c')](_0x34c34b[_0xb3c8('0x29')],_0x34c34b[_0xb3c8('0x2a')]);_0x54ede1[_0xb3c8('0x2d')]=_[_0xb3c8('0x2c')](_0x34c34b[_0xb3c8('0x29')],qs[_0xb3c8('0x2e')](_0xc95642[_0xb3c8('0x2a')][_0xb3c8('0x2e')]));_0x54ede1[_0xb3c8('0x2d')]=_0x54ede1[_0xb3c8('0x2d')][_0xb3c8('0x2f')]?_0x54ede1[_0xb3c8('0x2d')]:_0x34c34b[_0xb3c8('0x29')];if(!_0xc95642[_0xb3c8('0x2a')]['hasOwnProperty'](_0xb3c8('0x30'))){_0x54ede1[_0xb3c8('0x18')]=qs[_0xb3c8('0x18')](_0xc95642[_0xb3c8('0x2a')][_0xb3c8('0x18')]);_0x54ede1[_0xb3c8('0x17')]=qs['offset'](_0xc95642[_0xb3c8('0x2a')][_0xb3c8('0x17')]);}_0x54ede1[_0xb3c8('0x31')]=qs['sort'](_0xc95642['query'][_0xb3c8('0x32')]);_0x54ede1[_0xb3c8('0x33')]=qs[_0xb3c8('0x34')](_[_0xb3c8('0x35')](_0xc95642[_0xb3c8('0x2a')],_0x34c34b[_0xb3c8('0x34')]),_0x1d3699);if(_0xc95642[_0xb3c8('0x2a')][_0xb3c8('0x36')]){_0x54ede1[_0xb3c8('0x33')]=_[_0xb3c8('0x37')](_0x54ede1['where'],{'$or':_['map'](_0x1d3699,function(_0x27d11d){if(_0x27d11d[_0xb3c8('0x27')]!==_0xb3c8('0x38')){var _0x435e90={};_0x435e90[_0x27d11d[_0xb3c8('0x39')]]={'$like':'%'+_0xc95642[_0xb3c8('0x2a')][_0xb3c8('0x36')]+'%'};return _0x435e90;}})});}_0x54ede1=_[_0xb3c8('0x37')]({},_0x54ede1,_0xc95642[_0xb3c8('0x3a')]);var _0x4183e5={'where':_0x54ede1['where']};return db['Dynamics365Configuration'][_0xb3c8('0x3b')](_0x4183e5)[_0xb3c8('0x3c')](function(_0x10e460){_0x597ff0[_0xb3c8('0x3b')]=_0x10e460;if(_0xc95642['query'][_0xb3c8('0x3d')]){_0x54ede1[_0xb3c8('0x3e')]=[{'all':!![]}];}return db[_0xb3c8('0x24')][_0xb3c8('0x3f')](_0x54ede1);})[_0xb3c8('0x3c')](function(_0x5ddaaa){_0x597ff0[_0xb3c8('0x40')]=_0x5ddaaa;return _0x597ff0;})['then'](respondWithFilteredResult(_0x2a57b2,_0x54ede1))[_0xb3c8('0x41')](handleError(_0x2a57b2,null));};exports[_0xb3c8('0x42')]=function(_0x1f9e5e,_0x3b414d){var _0x304e74={'raw':![],'where':{'id':_0x1f9e5e[_0xb3c8('0x43')]['id']}},_0x425ffd={};_0x425ffd[_0xb3c8('0x29')]=_[_0xb3c8('0x2b')](db[_0xb3c8('0x24')]['rawAttributes']);_0x425ffd[_0xb3c8('0x2a')]=_['keys'](_0x1f9e5e[_0xb3c8('0x2a')]);_0x425ffd[_0xb3c8('0x34')]=_[_0xb3c8('0x2c')](_0x425ffd[_0xb3c8('0x29')],_0x425ffd[_0xb3c8('0x2a')]);_0x304e74['attributes']=_['intersection'](_0x425ffd[_0xb3c8('0x29')],qs[_0xb3c8('0x2e')](_0x1f9e5e[_0xb3c8('0x2a')][_0xb3c8('0x2e')]));_0x304e74['attributes']=_0x304e74[_0xb3c8('0x2d')][_0xb3c8('0x2f')]?_0x304e74[_0xb3c8('0x2d')]:_0x425ffd[_0xb3c8('0x29')];if(_0x1f9e5e[_0xb3c8('0x2a')][_0xb3c8('0x3d')]){_0x304e74[_0xb3c8('0x3e')]=[{'all':!![]}];}_0x304e74=_[_0xb3c8('0x37')]({},_0x304e74,_0x1f9e5e[_0xb3c8('0x3a')]);return db[_0xb3c8('0x24')]['find'](_0x304e74)[_0xb3c8('0x3c')](handleEntityNotFound(_0x3b414d,null))['then'](respondWithResult(_0x3b414d,null))[_0xb3c8('0x41')](handleError(_0x3b414d,null));};exports['create']=function(_0x5b94cf,_0x24dfa0){return db[_0xb3c8('0x24')][_0xb3c8('0x44')](_0x5b94cf[_0xb3c8('0x45')],{})[_0xb3c8('0x3c')](respondWithResult(_0x24dfa0,0xc9))[_0xb3c8('0x41')](handleError(_0x24dfa0,null));};exports[_0xb3c8('0x1f')]=function(_0x182d38,_0x56302e){if(_0x182d38[_0xb3c8('0x45')]['id']){delete _0x182d38['body']['id'];}return db['Dynamics365Configuration'][_0xb3c8('0x46')]({'where':{'id':_0x182d38[_0xb3c8('0x43')]['id']}})[_0xb3c8('0x3c')](handleEntityNotFound(_0x56302e,null))['then'](saveUpdates(_0x182d38['body'],null))[_0xb3c8('0x3c')](respondWithResult(_0x56302e,null))[_0xb3c8('0x41')](handleError(_0x56302e,null));};exports['destroy']=function(_0x134653,_0x39a972){return db[_0xb3c8('0x24')][_0xb3c8('0x46')]({'where':{'id':_0x134653[_0xb3c8('0x43')]['id']}})['then'](handleEntityNotFound(_0x39a972,null))[_0xb3c8('0x3c')](removeEntity(_0x39a972,null))['catch'](handleError(_0x39a972,null));};exports[_0xb3c8('0x47')]=function(_0x336a80,_0x243641,_0x1b2b6d){var _0x373e9c={};var _0x1d3e76={};var _0x3b3db4;var _0xc6797c;return db[_0xb3c8('0x24')][_0xb3c8('0x48')]({'where':{'id':_0x336a80[_0xb3c8('0x43')]['id']}})[_0xb3c8('0x3c')](handleEntityNotFound(_0x243641,null))[_0xb3c8('0x3c')](function(_0x35d238){if(_0x35d238){_0x3b3db4=_0x35d238;_0x1d3e76['model']=_[_0xb3c8('0x2b')](db[_0xb3c8('0x49')]['rawAttributes']);_0x1d3e76[_0xb3c8('0x2a')]=_[_0xb3c8('0x2b')](_0x336a80[_0xb3c8('0x2a')]);_0x1d3e76[_0xb3c8('0x34')]=_['intersection'](_0x1d3e76['model'],_0x1d3e76['query']);_0x373e9c[_0xb3c8('0x2d')]=_[_0xb3c8('0x2c')](_0x1d3e76[_0xb3c8('0x29')],qs[_0xb3c8('0x2e')](_0x336a80['query'][_0xb3c8('0x2e')]));_0x373e9c[_0xb3c8('0x2d')]=_0x373e9c[_0xb3c8('0x2d')][_0xb3c8('0x2f')]?_0x373e9c[_0xb3c8('0x2d')]:_0x1d3e76['model'];_0x373e9c[_0xb3c8('0x31')]=qs['sort'](_0x336a80[_0xb3c8('0x2a')][_0xb3c8('0x32')]);_0x373e9c[_0xb3c8('0x33')]=qs[_0xb3c8('0x34')](_[_0xb3c8('0x35')](_0x336a80[_0xb3c8('0x2a')],_0x1d3e76[_0xb3c8('0x34')]));if(_0x336a80[_0xb3c8('0x2a')][_0xb3c8('0x36')]){_0x373e9c['where']=_[_0xb3c8('0x37')](_0x373e9c[_0xb3c8('0x33')],{'$or':_[_0xb3c8('0x23')](_0x373e9c[_0xb3c8('0x2d')],function(_0xe7166e){var _0xfdd074={};_0xfdd074[_0xe7166e]={'$like':'%'+_0x336a80['query'][_0xb3c8('0x36')]+'%'};return _0xfdd074;})});}_0x373e9c=_[_0xb3c8('0x37')]({},_0x373e9c,_0x336a80[_0xb3c8('0x3a')]);return _0x3b3db4[_0xb3c8('0x47')](_0x373e9c);}})[_0xb3c8('0x3c')](function(_0x47c111){if(_0x47c111){_0xc6797c=_0x47c111['length'];if(!_0x336a80['query'][_0xb3c8('0x4a')]('nolimit')){_0x373e9c[_0xb3c8('0x18')]=qs[_0xb3c8('0x18')](_0x336a80[_0xb3c8('0x2a')][_0xb3c8('0x18')]);_0x373e9c['offset']=qs[_0xb3c8('0x17')](_0x336a80[_0xb3c8('0x2a')][_0xb3c8('0x17')]);}return _0x3b3db4[_0xb3c8('0x47')](_0x373e9c);}})['then'](function(_0x12e6fd){if(_0x12e6fd){return _0x12e6fd?{'count':_0xc6797c,'rows':_0x12e6fd}:null;}})['then'](respondWithResult(_0x243641,null))[_0xb3c8('0x41')](handleError(_0x243641,null));};exports[_0xb3c8('0x4b')]=function(_0x1e14a1,_0x37ae5e,_0x58c4e3){var _0x26f433={};var _0x24b984={};var _0x21c556;var _0x367cee;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0x1e14a1[_0xb3c8('0x43')]['id']}})[_0xb3c8('0x3c')](handleEntityNotFound(_0x37ae5e,null))[_0xb3c8('0x3c')](function(_0x4f1f8c){if(_0x4f1f8c){_0x21c556=_0x4f1f8c;_0x24b984[_0xb3c8('0x29')]=_['keys'](db['Dynamics365Field'][_0xb3c8('0x25')]);_0x24b984[_0xb3c8('0x2a')]=_['keys'](_0x1e14a1[_0xb3c8('0x2a')]);_0x24b984[_0xb3c8('0x34')]=_[_0xb3c8('0x2c')](_0x24b984[_0xb3c8('0x29')],_0x24b984[_0xb3c8('0x2a')]);_0x26f433[_0xb3c8('0x2d')]=_['intersection'](_0x24b984[_0xb3c8('0x29')],qs['fields'](_0x1e14a1[_0xb3c8('0x2a')][_0xb3c8('0x2e')]));_0x26f433[_0xb3c8('0x2d')]=_0x26f433[_0xb3c8('0x2d')][_0xb3c8('0x2f')]?_0x26f433[_0xb3c8('0x2d')]:_0x24b984['model'];_0x26f433['order']=qs[_0xb3c8('0x32')](_0x1e14a1['query'][_0xb3c8('0x32')]);_0x26f433[_0xb3c8('0x33')]=qs[_0xb3c8('0x34')](_[_0xb3c8('0x35')](_0x1e14a1[_0xb3c8('0x2a')],_0x24b984['filters']));if(_0x1e14a1[_0xb3c8('0x2a')][_0xb3c8('0x36')]){_0x26f433[_0xb3c8('0x33')]=_[_0xb3c8('0x37')](_0x26f433['where'],{'$or':_['map'](_0x26f433['attributes'],function(_0x4a499e){var _0x1071dd={};_0x1071dd[_0x4a499e]={'$like':'%'+_0x1e14a1['query'][_0xb3c8('0x36')]+'%'};return _0x1071dd;})});}_0x26f433=_[_0xb3c8('0x37')]({},_0x26f433,_0x1e14a1[_0xb3c8('0x3a')]);return _0x21c556[_0xb3c8('0x4b')](_0x26f433);}})[_0xb3c8('0x3c')](function(_0x2999c4){if(_0x2999c4){_0x367cee=_0x2999c4['length'];if(!_0x1e14a1['query'][_0xb3c8('0x4a')](_0xb3c8('0x30'))){_0x26f433[_0xb3c8('0x18')]=qs[_0xb3c8('0x18')](_0x1e14a1[_0xb3c8('0x2a')][_0xb3c8('0x18')]);_0x26f433['offset']=qs['offset'](_0x1e14a1[_0xb3c8('0x2a')][_0xb3c8('0x17')]);}return _0x21c556[_0xb3c8('0x4b')](_0x26f433);}})[_0xb3c8('0x3c')](function(_0x520054){if(_0x520054){return _0x520054?{'count':_0x367cee,'rows':_0x520054}:null;}})[_0xb3c8('0x3c')](respondWithResult(_0x37ae5e,null))[_0xb3c8('0x41')](handleError(_0x37ae5e,null));};exports[_0xb3c8('0x4c')]=function(_0x3184d5,_0x5acd43,_0x47cc90){var _0x39cb2c={};var _0x56095f={};var _0x35b358;var _0x39298f;return db[_0xb3c8('0x24')][_0xb3c8('0x48')]({'where':{'id':_0x3184d5[_0xb3c8('0x43')]['id']}})[_0xb3c8('0x3c')](handleEntityNotFound(_0x5acd43,null))[_0xb3c8('0x3c')](function(_0x59d097){if(_0x59d097){_0x35b358=_0x59d097;_0x56095f[_0xb3c8('0x29')]=_[_0xb3c8('0x2b')](db['Dynamics365Field']['rawAttributes']);_0x56095f[_0xb3c8('0x2a')]=_[_0xb3c8('0x2b')](_0x3184d5[_0xb3c8('0x2a')]);_0x56095f[_0xb3c8('0x34')]=_[_0xb3c8('0x2c')](_0x56095f[_0xb3c8('0x29')],_0x56095f[_0xb3c8('0x2a')]);_0x39cb2c[_0xb3c8('0x2d')]=_[_0xb3c8('0x2c')](_0x56095f[_0xb3c8('0x29')],qs[_0xb3c8('0x2e')](_0x3184d5[_0xb3c8('0x2a')][_0xb3c8('0x2e')]));_0x39cb2c[_0xb3c8('0x2d')]=_0x39cb2c[_0xb3c8('0x2d')][_0xb3c8('0x2f')]?_0x39cb2c[_0xb3c8('0x2d')]:_0x56095f['model'];_0x39cb2c[_0xb3c8('0x31')]=qs[_0xb3c8('0x32')](_0x3184d5[_0xb3c8('0x2a')]['sort']);_0x39cb2c[_0xb3c8('0x33')]=qs[_0xb3c8('0x34')](_['pick'](_0x3184d5['query'],_0x56095f[_0xb3c8('0x34')]));if(_0x3184d5[_0xb3c8('0x2a')][_0xb3c8('0x36')]){_0x39cb2c[_0xb3c8('0x33')]=_[_0xb3c8('0x37')](_0x39cb2c[_0xb3c8('0x33')],{'$or':_[_0xb3c8('0x23')](_0x39cb2c[_0xb3c8('0x2d')],function(_0x5db6d7){var _0x51ef5b={};_0x51ef5b[_0x5db6d7]={'$like':'%'+_0x3184d5[_0xb3c8('0x2a')][_0xb3c8('0x36')]+'%'};return _0x51ef5b;})});}_0x39cb2c=_[_0xb3c8('0x37')]({},_0x39cb2c,_0x3184d5['options']);return _0x35b358[_0xb3c8('0x4c')](_0x39cb2c);}})[_0xb3c8('0x3c')](function(_0x353823){if(_0x353823){_0x39298f=_0x353823[_0xb3c8('0x2f')];if(!_0x3184d5[_0xb3c8('0x2a')][_0xb3c8('0x4a')](_0xb3c8('0x30'))){_0x39cb2c[_0xb3c8('0x18')]=qs[_0xb3c8('0x18')](_0x3184d5[_0xb3c8('0x2a')]['limit']);_0x39cb2c[_0xb3c8('0x17')]=qs['offset'](_0x3184d5[_0xb3c8('0x2a')][_0xb3c8('0x17')]);}return _0x35b358[_0xb3c8('0x4c')](_0x39cb2c);}})[_0xb3c8('0x3c')](function(_0x1928d5){if(_0x1928d5){return _0x1928d5?{'count':_0x39298f,'rows':_0x1928d5}:null;}})['then'](respondWithResult(_0x5acd43,null))[_0xb3c8('0x41')](handleError(_0x5acd43,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 2637326..0a81359 100644 --- a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js +++ b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd6d6=['path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','int_dynamics365_configurations','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x103ded,_0x21ad32){var _0x4a77d4=function(_0x124e3b){while(--_0x124e3b){_0x103ded['push'](_0x103ded['shift']());}};_0x4a77d4(++_0x21ad32);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x5a9c9b,_0x423c47){_0x5a9c9b=_0x5a9c9b-0x0;var _0x53535a=_0xd6d6[_0x5a9c9b];return _0x53535a;};'use strict';var _=require(_0x6d6d('0x0'));var util=require(_0x6d6d('0x1'));var logger=require(_0x6d6d('0x2'))(_0x6d6d('0x3'));var moment=require('moment');var BPromise=require(_0x6d6d('0x4'));var rp=require(_0x6d6d('0x5'));var fs=require('fs');var path=require(_0x6d6d('0x6'));var rimraf=require(_0x6d6d('0x7'));var config=require(_0x6d6d('0x8'));var attributes=require(_0x6d6d('0x9'));module[_0x6d6d('0xa')]=function(_0x5702dc,_0x210ff7){return _0x5702dc[_0x6d6d('0xb')](_0x6d6d('0xc'),attributes,{'tableName':_0x6d6d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb821=['rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','int_dynamics365_configurations','util','../../config/logger','bluebird'];(function(_0x545163,_0x5420b6){var _0x3c1558=function(_0x8bf5a6){while(--_0x8bf5a6){_0x545163['push'](_0x545163['shift']());}};_0x3c1558(++_0x5420b6);}(_0xb821,0xa7));var _0x1b82=function(_0xbd23f8,_0xd4239f){_0xbd23f8=_0xbd23f8-0x0;var _0x2d207c=_0xb821[_0xbd23f8];return _0x2d207c;};'use strict';var _=require('lodash');var util=require(_0x1b82('0x0'));var logger=require(_0x1b82('0x1'))('api');var moment=require('moment');var BPromise=require(_0x1b82('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1b82('0x3'));var config=require(_0x1b82('0x4'));var attributes=require(_0x1b82('0x5'));module[_0x1b82('0x6')]=function(_0x597ca7,_0x3e27c4){return _0x597ca7[_0x1b82('0x7')](_0x1b82('0x8'),attributes,{'tableName':_0x1b82('0x9'),'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 7d324f5..823f52a 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 _0x7823=['client','http','then','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0xa87b83,_0x3e69ce){var _0x330e75=function(_0x3affac){while(--_0x3affac){_0xa87b83['push'](_0xa87b83['shift']());}};_0x330e75(++_0x3e69ce);}(_0x7823,0xd3));var _0x3782=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x7823[_0xbca1b1];return _0x4e1686;};'use strict';var _=require('lodash');var util=require(_0x3782('0x0'));var moment=require(_0x3782('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3782('0x2'));var db=require(_0x3782('0x3'))['db'];var utils=require(_0x3782('0x4'));var logger=require(_0x3782('0x5'))(_0x3782('0x6'));var config=require(_0x3782('0x7'));var jayson=require(_0x3782('0x8'));var client=jayson[_0x3782('0x9')][_0x3782('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3c30c6,_0x58b99f,_0x1bf0cc){return new BPromise(function(_0x233029,_0x363681){return client['request'](_0x3c30c6,_0x1bf0cc)[_0x3782('0xb')](function(_0x1f1c83){logger['info'](_0x3782('0xc'),_0x58b99f,_0x3782('0xd'));logger[_0x3782('0xe')](_0x3782('0xf'),_0x58b99f,_0x3782('0xd'),JSON[_0x3782('0x10')](_0x1f1c83));if(_0x1f1c83[_0x3782('0x11')]){if(_0x1f1c83[_0x3782('0x11')][_0x3782('0x12')]===0x1f4){logger[_0x3782('0x11')]('Dynamics365Configuration,\x20%s,\x20%s',_0x58b99f,_0x1f1c83[_0x3782('0x11')][_0x3782('0x13')]);return _0x363681(_0x1f1c83[_0x3782('0x11')][_0x3782('0x13')]);}logger[_0x3782('0x11')](_0x3782('0xc'),_0x58b99f,_0x1f1c83[_0x3782('0x11')]['message']);return _0x233029(_0x1f1c83[_0x3782('0x11')]['message']);}else{logger['info'](_0x3782('0xc'),_0x58b99f,_0x3782('0xd'));_0x233029(_0x1f1c83[_0x3782('0x14')][_0x3782('0x13')]);}})[_0x3782('0x15')](function(_0x31c468){logger[_0x3782('0x11')](_0x3782('0xc'),_0x58b99f,_0x31c468);_0x363681(_0x31c468);});});} \ No newline at end of file +var _0x460c=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','info','Dynamics365Configuration,\x20%s,\x20%s','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x5561d8,_0x2861fe){var _0x1d8f71=function(_0x425b2d){while(--_0x425b2d){_0x5561d8['push'](_0x5561d8['shift']());}};_0x1d8f71(++_0x2861fe);}(_0x460c,0x7a));var _0xc460=function(_0x2be05d,_0x1c69aa){_0x2be05d=_0x2be05d-0x0;var _0x3d5f7a=_0x460c[_0x2be05d];return _0x3d5f7a;};'use strict';var _=require(_0xc460('0x0'));var util=require(_0xc460('0x1'));var moment=require(_0xc460('0x2'));var BPromise=require(_0xc460('0x3'));var rs=require(_0xc460('0x4'));var fs=require('fs');var Redis=require(_0xc460('0x5'));var db=require(_0xc460('0x6'))['db'];var utils=require(_0xc460('0x7'));var logger=require(_0xc460('0x8'))(_0xc460('0x9'));var config=require(_0xc460('0xa'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x15bac0,_0x3417b9,_0x4a0617){return new BPromise(function(_0x355d63,_0x3aa0e9){return client[_0xc460('0xb')](_0x15bac0,_0x4a0617)['then'](function(_0x113fca){logger[_0xc460('0xc')](_0xc460('0xd'),_0x3417b9,'request\x20sent');logger['debug'](_0xc460('0xe'),_0x3417b9,_0xc460('0xf'),JSON['stringify'](_0x113fca));if(_0x113fca['error']){if(_0x113fca[_0xc460('0x10')][_0xc460('0x11')]===0x1f4){logger[_0xc460('0x10')](_0xc460('0xd'),_0x3417b9,_0x113fca[_0xc460('0x10')][_0xc460('0x12')]);return _0x3aa0e9(_0x113fca[_0xc460('0x10')][_0xc460('0x12')]);}logger[_0xc460('0x10')](_0xc460('0xd'),_0x3417b9,_0x113fca[_0xc460('0x10')]['message']);return _0x355d63(_0x113fca[_0xc460('0x10')]['message']);}else{logger[_0xc460('0xc')]('Dynamics365Configuration,\x20%s,\x20%s',_0x3417b9,_0xc460('0xf'));_0x355d63(_0x113fca[_0xc460('0x13')][_0xc460('0x12')]);}})[_0xc460('0x14')](function(_0x46526b){logger[_0xc460('0x10')](_0xc460('0xd'),_0x3417b9,_0x46526b);_0x3aa0e9(_0x46526b);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 48e282b..eacf99c 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 _0x96af=['exports','util','express','Router','fs-extra','../../components/auth/service','./intDynamics365Field.controller','isAuthenticated','index','get','show','post','create','put','/:id','delete','destroy'];(function(_0x5ab225,_0x421905){var _0x22eb59=function(_0x122516){while(--_0x122516){_0x5ab225['push'](_0x5ab225['shift']());}};_0x22eb59(++_0x421905);}(_0x96af,0x166));var _0xf96a=function(_0x2f87cd,_0xcaf299){_0x2f87cd=_0x2f87cd-0x0;var _0x5d7eda=_0x96af[_0x2f87cd];return _0x5d7eda;};'use strict';var multer=require('multer');var util=require(_0xf96a('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf96a('0x1'));var router=express[_0xf96a('0x2')]();var fs_extra=require(_0xf96a('0x3'));var auth=require(_0xf96a('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf96a('0x5'));router['get']('/',auth[_0xf96a('0x6')](),controller[_0xf96a('0x7')]);router[_0xf96a('0x8')]('/:id',auth[_0xf96a('0x6')](),controller[_0xf96a('0x9')]);router[_0xf96a('0xa')]('/',auth['isAuthenticated'](),controller[_0xf96a('0xb')]);router[_0xf96a('0xc')](_0xf96a('0xd'),auth[_0xf96a('0x6')](),controller['update']);router[_0xf96a('0xe')](_0xf96a('0xd'),auth['isAuthenticated'](),controller[_0xf96a('0xf')]);module[_0xf96a('0x10')]=router; \ No newline at end of file +var _0x2ffb=['show','post','put','/:id','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x432a5d,_0x5f564e){var _0x1e938d=function(_0x3b1770){while(--_0x3b1770){_0x432a5d['push'](_0x432a5d['shift']());}};_0x1e938d(++_0x5f564e);}(_0x2ffb,0x1da));var _0xb2ff=function(_0x2d3df2,_0x2f9498){_0x2d3df2=_0x2d3df2-0x0;var _0x347bda=_0x2ffb[_0x2d3df2];return _0x347bda;};'use strict';var multer=require(_0xb2ff('0x0'));var util=require(_0xb2ff('0x1'));var path=require(_0xb2ff('0x2'));var timeout=require(_0xb2ff('0x3'));var express=require(_0xb2ff('0x4'));var router=express[_0xb2ff('0x5')]();var fs_extra=require(_0xb2ff('0x6'));var auth=require(_0xb2ff('0x7'));var interaction=require(_0xb2ff('0x8'));var config=require(_0xb2ff('0x9'));var controller=require('./intDynamics365Field.controller');router[_0xb2ff('0xa')]('/',auth[_0xb2ff('0xb')](),controller['index']);router[_0xb2ff('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xb2ff('0xc')]);router[_0xb2ff('0xd')]('/',auth[_0xb2ff('0xb')](),controller['create']);router[_0xb2ff('0xe')](_0xb2ff('0xf'),auth[_0xb2ff('0xb')](),controller[_0xb2ff('0x10')]);router['delete'](_0xb2ff('0xf'),auth[_0xb2ff('0xb')](),controller[_0xb2ff('0x11')]);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 2dbeecc..f6aa274 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 _0xb3fa=['STRING','variable','sequelize','exports','ENUM','customVariable','keyValue','picklist','string'];(function(_0x5a59a9,_0x324bda){var _0xbbafe1=function(_0x9a2fe){while(--_0x9a2fe){_0x5a59a9['push'](_0x5a59a9['shift']());}};_0xbbafe1(++_0x324bda);}(_0xb3fa,0x1bb));var _0xab3f=function(_0x1d53e8,_0x562837){_0x1d53e8=_0x1d53e8-0x0;var _0x2ab38b=_0xb3fa[_0x1d53e8];return _0x2ab38b;};'use strict';var Sequelize=require(_0xab3f('0x0'));module[_0xab3f('0x1')]={'type':{'type':Sequelize[_0xab3f('0x2')]('string','variable',_0xab3f('0x3'),_0xab3f('0x4'),_0xab3f('0x5')),'defaultValue':_0xab3f('0x6')},'content':{'type':Sequelize[_0xab3f('0x7')]},'key':{'type':Sequelize[_0xab3f('0x7')]},'keyType':{'type':Sequelize[_0xab3f('0x2')](_0xab3f('0x6'),_0xab3f('0x8'),_0xab3f('0x3'))},'keyContent':{'type':Sequelize[_0xab3f('0x7')]},'idField':{'type':Sequelize[_0xab3f('0x7')]},'nameField':{'type':Sequelize[_0xab3f('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xab3f('0x7')]}}; \ No newline at end of file +var _0x4e9c=['picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x2482a0,_0x92f113){var _0x50e1f5=function(_0x2a6154){while(--_0x2a6154){_0x2482a0['push'](_0x2482a0['shift']());}};_0x50e1f5(++_0x92f113);}(_0x4e9c,0x1c5));var _0xc4e9=function(_0x48549a,_0x3780d1){_0x48549a=_0x48549a-0x0;var _0x19492c=_0x4e9c[_0x48549a];return _0x19492c;};'use strict';var Sequelize=require(_0xc4e9('0x0'));module[_0xc4e9('0x1')]={'type':{'type':Sequelize[_0xc4e9('0x2')](_0xc4e9('0x3'),_0xc4e9('0x4'),_0xc4e9('0x5'),'keyValue',_0xc4e9('0x6')),'defaultValue':_0xc4e9('0x3')},'content':{'type':Sequelize[_0xc4e9('0x7')]},'key':{'type':Sequelize[_0xc4e9('0x7')]},'keyType':{'type':Sequelize[_0xc4e9('0x2')](_0xc4e9('0x3'),_0xc4e9('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0xc4e9('0x7')]},'idField':{'type':Sequelize[_0xc4e9('0x7')]},'nameField':{'type':Sequelize[_0xc4e9('0x7')]},'customField':{'type':Sequelize[_0xc4e9('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc4e9('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 2fc3041..2a336a5 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 _0x5f5f=['rimraf','fast-json-patch','request-promise','util','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/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','include','rows','catch','show','params','Dynamics365Field','length','create','body','update','find','eml-format'];(function(_0x2663b9,_0x20875a){var _0xd03a24=function(_0x419244){while(--_0x419244){_0x2663b9['push'](_0x2663b9['shift']());}};_0xd03a24(++_0x20875a);}(_0x5f5f,0x1c1));var _0xf5f5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5f5f[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xf5f5('0x0'));var rimraf=require(_0xf5f5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf5f5('0x2'));var rp=require(_0xf5f5('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf5f5('0x4'));var path=require(_0xf5f5('0x5'));var sox=require(_0xf5f5('0x6'));var csv=require(_0xf5f5('0x7'));var ejs=require(_0xf5f5('0x8'));var fs=require('fs');var fs_extra=require(_0xf5f5('0x9'));var _=require(_0xf5f5('0xa'));var squel=require(_0xf5f5('0xb'));var crypto=require(_0xf5f5('0xc'));var jsforce=require(_0xf5f5('0xd'));var deskjs=require(_0xf5f5('0xe'));var toCsv=require(_0xf5f5('0x7'));var querystring=require(_0xf5f5('0xf'));var Papa=require(_0xf5f5('0x10'));var Redis=require('ioredis');var authService=require(_0xf5f5('0x11'));var qs=require(_0xf5f5('0x12'));var as=require(_0xf5f5('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf5f5('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xf5f5('0x15'));var licenseUtil=require(_0xf5f5('0x16'));var db=require(_0xf5f5('0x17'))['db'];function respondWithStatusCode(_0x3fed29,_0x383672){_0x383672=_0x383672||0xcc;return function(_0x4dea4f){if(_0x4dea4f){return _0x3fed29[_0xf5f5('0x18')](_0x383672);}return _0x3fed29[_0xf5f5('0x19')](_0x383672)[_0xf5f5('0x1a')]();};}function respondWithResult(_0x331955,_0x5c9f25){_0x5c9f25=_0x5c9f25||0xc8;return function(_0x2586de){if(_0x2586de){return _0x331955['status'](_0x5c9f25)[_0xf5f5('0x1b')](_0x2586de);}};}function respondWithFilteredResult(_0x10ccac,_0x482842){return function(_0x2beb28){if(_0x2beb28){var _0x5ced13=typeof _0x482842[_0xf5f5('0x1c')]===_0xf5f5('0x1d')&&typeof _0x482842[_0xf5f5('0x1e')]===_0xf5f5('0x1d');var _0x26394b=_0x2beb28[_0xf5f5('0x1f')];var _0x570dcd=_0x5ced13?0x0:_0x482842['offset'];var _0x5da14b=_0x5ced13?_0x2beb28[_0xf5f5('0x1f')]:_0x482842[_0xf5f5('0x1c')]+_0x482842['limit'];var _0x4aebd1;if(_0x5da14b>=_0x26394b){_0x5da14b=_0x26394b;_0x4aebd1=0xc8;}else{_0x4aebd1=0xce;}_0x10ccac[_0xf5f5('0x19')](_0x4aebd1);return _0x10ccac['set'](_0xf5f5('0x20'),_0x570dcd+'-'+_0x5da14b+'/'+_0x26394b)[_0xf5f5('0x1b')](_0x2beb28);}return null;};}function patchUpdates(_0x5d1dfb){return function(_0x10736d){try{jsonpatch[_0xf5f5('0x21')](_0x10736d,_0x5d1dfb,!![]);}catch(_0x163989){return BPromise[_0xf5f5('0x22')](_0x163989);}return _0x10736d[_0xf5f5('0x23')]();};}function saveUpdates(_0x2f3741,_0x50a83a){return function(_0x1e9001){if(_0x1e9001){return _0x1e9001['update'](_0x2f3741)[_0xf5f5('0x24')](function(_0xdf7f34){return _0xdf7f34;});}return null;};}function removeEntity(_0x53e6b3,_0x487fd7){return function(_0x5eb3e8){if(_0x5eb3e8){return _0x5eb3e8[_0xf5f5('0x25')]()[_0xf5f5('0x24')](function(){_0x53e6b3[_0xf5f5('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x582e72,_0x27d6bd){return function(_0x1815a1){if(!_0x1815a1){_0x582e72[_0xf5f5('0x18')](0x194);}return _0x1815a1;};}function handleError(_0x1fdbdd,_0x22d309){_0x22d309=_0x22d309||0x1f4;return function(_0x460da8){logger[_0xf5f5('0x26')](_0x460da8['stack']);if(_0x460da8[_0xf5f5('0x27')]){delete _0x460da8[_0xf5f5('0x27')];}_0x1fdbdd[_0xf5f5('0x19')](_0x22d309)[_0xf5f5('0x28')](_0x460da8);};}exports[_0xf5f5('0x29')]=function(_0x112ca5,_0x2044b5){var _0xc369fc={},_0x2a919f={},_0x542542={'count':0x0,'rows':[]};var _0x41885a=_[_0xf5f5('0x2a')](db['Dynamics365Field'][_0xf5f5('0x2b')],function(_0x2b5466){return{'name':_0x2b5466[_0xf5f5('0x2c')],'type':_0x2b5466[_0xf5f5('0x2d')][_0xf5f5('0x2e')]};});_0x2a919f[_0xf5f5('0x2f')]=_['map'](_0x41885a,_0xf5f5('0x27'));_0x2a919f[_0xf5f5('0x30')]=_[_0xf5f5('0x31')](_0x112ca5[_0xf5f5('0x30')]);_0x2a919f['filters']=_[_0xf5f5('0x32')](_0x2a919f[_0xf5f5('0x2f')],_0x2a919f[_0xf5f5('0x30')]);_0xc369fc['attributes']=_[_0xf5f5('0x32')](_0x2a919f[_0xf5f5('0x2f')],qs['fields'](_0x112ca5[_0xf5f5('0x30')][_0xf5f5('0x33')]));_0xc369fc['attributes']=_0xc369fc[_0xf5f5('0x34')]['length']?_0xc369fc[_0xf5f5('0x34')]:_0x2a919f[_0xf5f5('0x2f')];if(!_0x112ca5[_0xf5f5('0x30')][_0xf5f5('0x35')](_0xf5f5('0x36'))){_0xc369fc[_0xf5f5('0x1e')]=qs[_0xf5f5('0x1e')](_0x112ca5[_0xf5f5('0x30')][_0xf5f5('0x1e')]);_0xc369fc['offset']=qs[_0xf5f5('0x1c')](_0x112ca5[_0xf5f5('0x30')][_0xf5f5('0x1c')]);}_0xc369fc[_0xf5f5('0x37')]=qs[_0xf5f5('0x38')](_0x112ca5['query']['sort']);_0xc369fc[_0xf5f5('0x39')]=qs[_0xf5f5('0x3a')](_[_0xf5f5('0x3b')](_0x112ca5['query'],_0x2a919f['filters']),_0x41885a);if(_0x112ca5[_0xf5f5('0x30')]['filter']){_0xc369fc['where']=_[_0xf5f5('0x3c')](_0xc369fc['where'],{'$or':_[_0xf5f5('0x2a')](_0x41885a,function(_0x2502d5){if(_0x2502d5['type']!==_0xf5f5('0x3d')){var _0x152a6a={};_0x152a6a[_0x2502d5['name']]={'$like':'%'+_0x112ca5['query'][_0xf5f5('0x3e')]+'%'};return _0x152a6a;}})});}_0xc369fc=_[_0xf5f5('0x3c')]({},_0xc369fc,_0x112ca5[_0xf5f5('0x3f')]);var _0x2c9b73={'where':_0xc369fc[_0xf5f5('0x39')]};return db['Dynamics365Field']['count'](_0x2c9b73)[_0xf5f5('0x24')](function(_0x3275c2){_0x542542[_0xf5f5('0x1f')]=_0x3275c2;if(_0x112ca5[_0xf5f5('0x30')]['includeAll']){_0xc369fc[_0xf5f5('0x40')]=[{'all':!![]}];}return db['Dynamics365Field']['findAll'](_0xc369fc);})['then'](function(_0x297a17){_0x542542[_0xf5f5('0x41')]=_0x297a17;return _0x542542;})['then'](respondWithFilteredResult(_0x2044b5,_0xc369fc))[_0xf5f5('0x42')](handleError(_0x2044b5,null));};exports[_0xf5f5('0x43')]=function(_0x28fd37,_0x3c1fa1){var _0xdb2143={'raw':!![],'where':{'id':_0x28fd37[_0xf5f5('0x44')]['id']}},_0x24578f={};_0x24578f[_0xf5f5('0x2f')]=_['keys'](db[_0xf5f5('0x45')][_0xf5f5('0x2b')]);_0x24578f[_0xf5f5('0x30')]=_[_0xf5f5('0x31')](_0x28fd37[_0xf5f5('0x30')]);_0x24578f[_0xf5f5('0x3a')]=_[_0xf5f5('0x32')](_0x24578f['model'],_0x24578f[_0xf5f5('0x30')]);_0xdb2143[_0xf5f5('0x34')]=_[_0xf5f5('0x32')](_0x24578f['model'],qs['fields'](_0x28fd37[_0xf5f5('0x30')][_0xf5f5('0x33')]));_0xdb2143[_0xf5f5('0x34')]=_0xdb2143[_0xf5f5('0x34')][_0xf5f5('0x46')]?_0xdb2143[_0xf5f5('0x34')]:_0x24578f[_0xf5f5('0x2f')];if(_0x28fd37['query']['includeAll']){_0xdb2143[_0xf5f5('0x40')]=[{'all':!![]}];}_0xdb2143=_['merge']({},_0xdb2143,_0x28fd37[_0xf5f5('0x3f')]);return db[_0xf5f5('0x45')]['find'](_0xdb2143)[_0xf5f5('0x24')](handleEntityNotFound(_0x3c1fa1,null))['then'](respondWithResult(_0x3c1fa1,null))[_0xf5f5('0x42')](handleError(_0x3c1fa1,null));};exports[_0xf5f5('0x47')]=function(_0x459e2e,_0x8232e0){return db[_0xf5f5('0x45')][_0xf5f5('0x47')](_0x459e2e[_0xf5f5('0x48')],{})[_0xf5f5('0x24')](respondWithResult(_0x8232e0,0xc9))[_0xf5f5('0x42')](handleError(_0x8232e0,null));};exports[_0xf5f5('0x49')]=function(_0x36ed9f,_0xcdda68){if(_0x36ed9f[_0xf5f5('0x48')]['id']){delete _0x36ed9f['body']['id'];}return db[_0xf5f5('0x45')][_0xf5f5('0x4a')]({'where':{'id':_0x36ed9f[_0xf5f5('0x44')]['id']}})[_0xf5f5('0x24')](handleEntityNotFound(_0xcdda68,null))['then'](saveUpdates(_0x36ed9f[_0xf5f5('0x48')],null))['then'](respondWithResult(_0xcdda68,null))[_0xf5f5('0x42')](handleError(_0xcdda68,null));};exports[_0xf5f5('0x25')]=function(_0x2bd703,_0x12da87){return db[_0xf5f5('0x45')][_0xf5f5('0x4a')]({'where':{'id':_0x2bd703[_0xf5f5('0x44')]['id']}})[_0xf5f5('0x24')](handleEntityNotFound(_0x12da87,null))['then'](removeEntity(_0x12da87,null))[_0xf5f5('0x42')](handleError(_0x12da87,null));}; \ No newline at end of file +var _0x688b=['findAll','rows','catch','find','create','body','params','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','error','stack','name','send','index','Dynamics365Field','rawAttributes','fieldName','type','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','pick','where','merge','filter','options','includeAll','include'];(function(_0x4138b6,_0x4ba4f2){var _0x48c0cb=function(_0x4211d2){while(--_0x4211d2){_0x4138b6['push'](_0x4138b6['shift']());}};_0x48c0cb(++_0x4ba4f2);}(_0x688b,0x10f));var _0xb688=function(_0x5dee2a,_0x47d02a){_0x5dee2a=_0x5dee2a-0x0;var _0x31e98e=_0x688b[_0x5dee2a];return _0x31e98e;};'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(_0xb688('0x0'));var moment=require(_0xb688('0x1'));var BPromise=require(_0xb688('0x2'));var Mustache=require(_0xb688('0x3'));var util=require(_0xb688('0x4'));var path=require(_0xb688('0x5'));var sox=require(_0xb688('0x6'));var csv=require(_0xb688('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb688('0x8'));var _=require('lodash');var squel=require(_0xb688('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb688('0xa'));var toCsv=require(_0xb688('0x7'));var querystring=require(_0xb688('0xb'));var Papa=require(_0xb688('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb688('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb688('0xe'))(_0xb688('0xf'));var utils=require('../../config/utils');var config=require(_0xb688('0x10'));var licenseUtil=require('../../config/license/util');var db=require(_0xb688('0x11'))['db'];function respondWithStatusCode(_0x4c548c,_0x557755){_0x557755=_0x557755||0xcc;return function(_0x3b11ef){if(_0x3b11ef){return _0x4c548c[_0xb688('0x12')](_0x557755);}return _0x4c548c[_0xb688('0x13')](_0x557755)[_0xb688('0x14')]();};}function respondWithResult(_0x4010a5,_0x5c7be7){_0x5c7be7=_0x5c7be7||0xc8;return function(_0x16a845){if(_0x16a845){return _0x4010a5[_0xb688('0x13')](_0x5c7be7)[_0xb688('0x15')](_0x16a845);}};}function respondWithFilteredResult(_0x1cd194,_0x55936c){return function(_0x22a67a){if(_0x22a67a){var _0x101a5a=typeof _0x55936c[_0xb688('0x16')]===_0xb688('0x17')&&typeof _0x55936c[_0xb688('0x18')]===_0xb688('0x17');var _0x126116=_0x22a67a['count'];var _0x3085bf=_0x101a5a?0x0:_0x55936c[_0xb688('0x16')];var _0x5c8dea=_0x101a5a?_0x22a67a[_0xb688('0x19')]:_0x55936c[_0xb688('0x16')]+_0x55936c['limit'];var _0x50842f;if(_0x5c8dea>=_0x126116){_0x5c8dea=_0x126116;_0x50842f=0xc8;}else{_0x50842f=0xce;}_0x1cd194[_0xb688('0x13')](_0x50842f);return _0x1cd194[_0xb688('0x1a')](_0xb688('0x1b'),_0x3085bf+'-'+_0x5c8dea+'/'+_0x126116)[_0xb688('0x15')](_0x22a67a);}return null;};}function patchUpdates(_0x51c4c0){return function(_0x3ae520){try{jsonpatch[_0xb688('0x1c')](_0x3ae520,_0x51c4c0,!![]);}catch(_0x1eaa15){return BPromise['reject'](_0x1eaa15);}return _0x3ae520['save']();};}function saveUpdates(_0x243d3d,_0x311c87){return function(_0x463eb5){if(_0x463eb5){return _0x463eb5[_0xb688('0x1d')](_0x243d3d)[_0xb688('0x1e')](function(_0x47e9b6){return _0x47e9b6;});}return null;};}function removeEntity(_0x242c8d,_0x8cb9ea){return function(_0x8c07f6){if(_0x8c07f6){return _0x8c07f6[_0xb688('0x1f')]()[_0xb688('0x1e')](function(){_0x242c8d[_0xb688('0x13')](0xcc)[_0xb688('0x14')]();});}};}function handleEntityNotFound(_0x34e65d,_0x518b64){return function(_0x51b0a0){if(!_0x51b0a0){_0x34e65d[_0xb688('0x12')](0x194);}return _0x51b0a0;};}function handleError(_0x23e095,_0x356744){_0x356744=_0x356744||0x1f4;return function(_0x4d8b19){logger[_0xb688('0x20')](_0x4d8b19[_0xb688('0x21')]);if(_0x4d8b19[_0xb688('0x22')]){delete _0x4d8b19[_0xb688('0x22')];}_0x23e095[_0xb688('0x13')](_0x356744)[_0xb688('0x23')](_0x4d8b19);};}exports[_0xb688('0x24')]=function(_0xd5d25d,_0x463630){var _0x323ad5={},_0x235d6c={},_0x549de8={'count':0x0,'rows':[]};var _0xf0f4c8=_['map'](db[_0xb688('0x25')][_0xb688('0x26')],function(_0x32d255){return{'name':_0x32d255[_0xb688('0x27')],'type':_0x32d255[_0xb688('0x28')]['key']};});_0x235d6c[_0xb688('0x29')]=_[_0xb688('0x2a')](_0xf0f4c8,_0xb688('0x22'));_0x235d6c['query']=_[_0xb688('0x2b')](_0xd5d25d[_0xb688('0x2c')]);_0x235d6c[_0xb688('0x2d')]=_[_0xb688('0x2e')](_0x235d6c[_0xb688('0x29')],_0x235d6c['query']);_0x323ad5[_0xb688('0x2f')]=_[_0xb688('0x2e')](_0x235d6c['model'],qs[_0xb688('0x30')](_0xd5d25d[_0xb688('0x2c')]['fields']));_0x323ad5[_0xb688('0x2f')]=_0x323ad5['attributes'][_0xb688('0x31')]?_0x323ad5[_0xb688('0x2f')]:_0x235d6c[_0xb688('0x29')];if(!_0xd5d25d['query'][_0xb688('0x32')](_0xb688('0x33'))){_0x323ad5[_0xb688('0x18')]=qs[_0xb688('0x18')](_0xd5d25d[_0xb688('0x2c')][_0xb688('0x18')]);_0x323ad5['offset']=qs[_0xb688('0x16')](_0xd5d25d[_0xb688('0x2c')][_0xb688('0x16')]);}_0x323ad5['order']=qs['sort'](_0xd5d25d[_0xb688('0x2c')]['sort']);_0x323ad5['where']=qs['filters'](_[_0xb688('0x34')](_0xd5d25d['query'],_0x235d6c[_0xb688('0x2d')]),_0xf0f4c8);if(_0xd5d25d['query']['filter']){_0x323ad5[_0xb688('0x35')]=_[_0xb688('0x36')](_0x323ad5[_0xb688('0x35')],{'$or':_[_0xb688('0x2a')](_0xf0f4c8,function(_0xef195b){if(_0xef195b[_0xb688('0x28')]!=='VIRTUAL'){var _0x21f77d={};_0x21f77d[_0xef195b['name']]={'$like':'%'+_0xd5d25d['query'][_0xb688('0x37')]+'%'};return _0x21f77d;}})});}_0x323ad5=_[_0xb688('0x36')]({},_0x323ad5,_0xd5d25d[_0xb688('0x38')]);var _0x217133={'where':_0x323ad5[_0xb688('0x35')]};return db[_0xb688('0x25')][_0xb688('0x19')](_0x217133)[_0xb688('0x1e')](function(_0x21eb19){_0x549de8[_0xb688('0x19')]=_0x21eb19;if(_0xd5d25d[_0xb688('0x2c')][_0xb688('0x39')]){_0x323ad5[_0xb688('0x3a')]=[{'all':!![]}];}return db[_0xb688('0x25')][_0xb688('0x3b')](_0x323ad5);})[_0xb688('0x1e')](function(_0x266533){_0x549de8[_0xb688('0x3c')]=_0x266533;return _0x549de8;})[_0xb688('0x1e')](respondWithFilteredResult(_0x463630,_0x323ad5))[_0xb688('0x3d')](handleError(_0x463630,null));};exports['show']=function(_0x518202,_0x147dcc){var _0x6a30b0={'raw':!![],'where':{'id':_0x518202['params']['id']}},_0x21700f={};_0x21700f[_0xb688('0x29')]=_[_0xb688('0x2b')](db[_0xb688('0x25')][_0xb688('0x26')]);_0x21700f[_0xb688('0x2c')]=_[_0xb688('0x2b')](_0x518202[_0xb688('0x2c')]);_0x21700f['filters']=_[_0xb688('0x2e')](_0x21700f[_0xb688('0x29')],_0x21700f[_0xb688('0x2c')]);_0x6a30b0[_0xb688('0x2f')]=_['intersection'](_0x21700f[_0xb688('0x29')],qs[_0xb688('0x30')](_0x518202[_0xb688('0x2c')][_0xb688('0x30')]));_0x6a30b0['attributes']=_0x6a30b0['attributes'][_0xb688('0x31')]?_0x6a30b0[_0xb688('0x2f')]:_0x21700f[_0xb688('0x29')];if(_0x518202[_0xb688('0x2c')][_0xb688('0x39')]){_0x6a30b0[_0xb688('0x3a')]=[{'all':!![]}];}_0x6a30b0=_['merge']({},_0x6a30b0,_0x518202[_0xb688('0x38')]);return db[_0xb688('0x25')][_0xb688('0x3e')](_0x6a30b0)[_0xb688('0x1e')](handleEntityNotFound(_0x147dcc,null))[_0xb688('0x1e')](respondWithResult(_0x147dcc,null))[_0xb688('0x3d')](handleError(_0x147dcc,null));};exports[_0xb688('0x3f')]=function(_0x1b1697,_0x3e62f7){return db[_0xb688('0x25')][_0xb688('0x3f')](_0x1b1697[_0xb688('0x40')],{})[_0xb688('0x1e')](respondWithResult(_0x3e62f7,0xc9))[_0xb688('0x3d')](handleError(_0x3e62f7,null));};exports[_0xb688('0x1d')]=function(_0x4ef5e4,_0x540070){if(_0x4ef5e4['body']['id']){delete _0x4ef5e4[_0xb688('0x40')]['id'];}return db[_0xb688('0x25')][_0xb688('0x3e')]({'where':{'id':_0x4ef5e4[_0xb688('0x41')]['id']}})[_0xb688('0x1e')](handleEntityNotFound(_0x540070,null))[_0xb688('0x1e')](saveUpdates(_0x4ef5e4['body'],null))[_0xb688('0x1e')](respondWithResult(_0x540070,null))[_0xb688('0x3d')](handleError(_0x540070,null));};exports['destroy']=function(_0x5b2534,_0xbab770){return db[_0xb688('0x25')][_0xb688('0x3e')]({'where':{'id':_0x5b2534[_0xb688('0x41')]['id']}})['then'](handleEntityNotFound(_0xbab770,null))['then'](removeEntity(_0xbab770,null))[_0xb688('0x3d')](handleError(_0xbab770,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 2fa6701..7538891 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 _0xf56e=['./intDynamics365Field.attributes','exports','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0xf56e,0x166));var _0xef56=function(_0x4826f7,_0x14ab8b){_0x4826f7=_0x4826f7-0x0;var _0x88cdac=_0xf56e[_0x4826f7];return _0x88cdac;};'use strict';var _=require(_0xef56('0x0'));var util=require(_0xef56('0x1'));var logger=require(_0xef56('0x2'))(_0xef56('0x3'));var moment=require(_0xef56('0x4'));var BPromise=require(_0xef56('0x5'));var rp=require(_0xef56('0x6'));var fs=require('fs');var path=require(_0xef56('0x7'));var rimraf=require(_0xef56('0x8'));var config=require(_0xef56('0x9'));var attributes=require(_0xef56('0xa'));module[_0xef56('0xb')]=function(_0x5169dc,_0x5333e0){return _0x5169dc['define'](_0xef56('0xc'),attributes,{'tableName':_0xef56('0xd'),'paranoid':![],'indexes':[{'name':_0xef56('0xe'),'fields':[_0xef56('0xf'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdc5e=['define','Dynamics365Field','int_dynamics365_fields','FieldId','../../config/logger','api','moment','rimraf','../../config/environment','./intDynamics365Field.attributes','exports'];(function(_0x32e264,_0x41cee8){var _0x1d7175=function(_0x5913d9){while(--_0x5913d9){_0x32e264['push'](_0x32e264['shift']());}};_0x1d7175(++_0x41cee8);}(_0xdc5e,0x185));var _0xedc5=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xdc5e[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xedc5('0x0'))(_0xedc5('0x1'));var moment=require(_0xedc5('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xedc5('0x3'));var config=require(_0xedc5('0x4'));var attributes=require(_0xedc5('0x5'));module[_0xedc5('0x6')]=function(_0x1429bd,_0x54072a){return _0x1429bd[_0xedc5('0x7')](_0xedc5('0x8'),attributes,{'tableName':_0xedc5('0x9'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':['idField',_0xedc5('0xa')],'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 d077254..04a771c 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 _0xf8b0=['message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','Dynamics365Field,\x20%s,\x20%s,\x20%s','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf8b0,0x136));var _0x0f8b=function(_0x4f576b,_0x4d4158){_0x4f576b=_0x4f576b-0x0;var _0x4fcf1c=_0xf8b0[_0x4f576b];return _0x4fcf1c;};'use strict';var _=require(_0x0f8b('0x0'));var util=require(_0x0f8b('0x1'));var moment=require(_0x0f8b('0x2'));var BPromise=require(_0x0f8b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0f8b('0x4'));var db=require(_0x0f8b('0x5'))['db'];var utils=require(_0x0f8b('0x6'));var logger=require(_0x0f8b('0x7'))(_0x0f8b('0x8'));var config=require(_0x0f8b('0x9'));var jayson=require(_0x0f8b('0xa'));var client=jayson[_0x0f8b('0xb')][_0x0f8b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x215150,_0xcf7b92,_0x21c935){return new BPromise(function(_0x4d3c78,_0x28ceb2){return client[_0x0f8b('0xd')](_0x215150,_0x21c935)[_0x0f8b('0xe')](function(_0x41ab55){logger[_0x0f8b('0xf')](_0x0f8b('0x10'),_0xcf7b92,_0x0f8b('0x11'));logger['debug'](_0x0f8b('0x12'),_0xcf7b92,_0x0f8b('0x11'),JSON['stringify'](_0x41ab55));if(_0x41ab55[_0x0f8b('0x13')]){if(_0x41ab55['error']['code']===0x1f4){logger[_0x0f8b('0x13')](_0x0f8b('0x10'),_0xcf7b92,_0x41ab55[_0x0f8b('0x13')][_0x0f8b('0x14')]);return _0x28ceb2(_0x41ab55['error'][_0x0f8b('0x14')]);}logger[_0x0f8b('0x13')](_0x0f8b('0x10'),_0xcf7b92,_0x41ab55[_0x0f8b('0x13')][_0x0f8b('0x14')]);return _0x4d3c78(_0x41ab55[_0x0f8b('0x13')][_0x0f8b('0x14')]);}else{logger['info'](_0x0f8b('0x10'),_0xcf7b92,_0x0f8b('0x11'));_0x4d3c78(_0x41ab55[_0x0f8b('0x15')]['message']);}})['catch'](function(_0xd3ba26){logger[_0x0f8b('0x13')](_0x0f8b('0x10'),_0xcf7b92,_0xd3ba26);_0x28ceb2(_0xd3ba26);});});} \ No newline at end of file +var _0xf551=['code','Dynamics365Field,\x20%s,\x20%s','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','error'];(function(_0x546ed7,_0x454dbb){var _0x4d289d=function(_0x1d7328){while(--_0x1d7328){_0x546ed7['push'](_0x546ed7['shift']());}};_0x4d289d(++_0x454dbb);}(_0xf551,0xf5));var _0x1f55=function(_0x27cdc2,_0x1e62df){_0x27cdc2=_0x27cdc2-0x0;var _0x10cc1a=_0xf551[_0x27cdc2];return _0x10cc1a;};'use strict';var _=require(_0x1f55('0x0'));var util=require('util');var moment=require(_0x1f55('0x1'));var BPromise=require('bluebird');var rs=require(_0x1f55('0x2'));var fs=require('fs');var Redis=require(_0x1f55('0x3'));var db=require(_0x1f55('0x4'))['db'];var utils=require(_0x1f55('0x5'));var logger=require(_0x1f55('0x6'))('rpc');var config=require(_0x1f55('0x7'));var jayson=require(_0x1f55('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x584593,_0x4eeb85,_0x2596db){return new BPromise(function(_0x4eaa99,_0x3fb131){return client[_0x1f55('0x9')](_0x584593,_0x2596db)[_0x1f55('0xa')](function(_0x32b98c){logger['info']('Dynamics365Field,\x20%s,\x20%s',_0x4eeb85,_0x1f55('0xb'));logger[_0x1f55('0xc')](_0x1f55('0xd'),_0x4eeb85,_0x1f55('0xb'),JSON['stringify'](_0x32b98c));if(_0x32b98c['error']){if(_0x32b98c[_0x1f55('0xe')][_0x1f55('0xf')]===0x1f4){logger[_0x1f55('0xe')](_0x1f55('0x10'),_0x4eeb85,_0x32b98c['error'][_0x1f55('0x11')]);return _0x3fb131(_0x32b98c[_0x1f55('0xe')][_0x1f55('0x11')]);}logger[_0x1f55('0xe')](_0x1f55('0x10'),_0x4eeb85,_0x32b98c[_0x1f55('0xe')]['message']);return _0x4eaa99(_0x32b98c['error'][_0x1f55('0x11')]);}else{logger['info'](_0x1f55('0x10'),_0x4eeb85,_0x1f55('0xb'));_0x4eaa99(_0x32b98c[_0x1f55('0x12')]['message']);}})[_0x1f55('0x13')](function(_0x5b7827){logger['error'](_0x1f55('0x10'),_0x4eeb85,_0x5b7827);_0x3fb131(_0x5b7827);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 674a946..3745e01 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 _0xfe7a=['../../config/environment','./intFreshdeskAccount.controller','/:id','isAuthenticated','show','get','/:id/configurations','getConfigurations','/:id/fields','getFields','create','addConfiguration','put','update','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0xfe7a,0x17f));var _0xafe7=function(_0x1eda08,_0x38d31a){_0x1eda08=_0x1eda08-0x0;var _0x100b9e=_0xfe7a[_0x1eda08];return _0x100b9e;};'use strict';var multer=require(_0xafe7('0x0'));var util=require(_0xafe7('0x1'));var path=require(_0xafe7('0x2'));var timeout=require(_0xafe7('0x3'));var express=require(_0xafe7('0x4'));var router=express[_0xafe7('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xafe7('0x6'));var interaction=require(_0xafe7('0x7'));var config=require(_0xafe7('0x8'));var controller=require(_0xafe7('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xafe7('0xa'),auth[_0xafe7('0xb')](),controller[_0xafe7('0xc')]);router[_0xafe7('0xd')](_0xafe7('0xe'),auth[_0xafe7('0xb')](),controller[_0xafe7('0xf')]);router[_0xafe7('0xd')](_0xafe7('0x10'),auth[_0xafe7('0xb')](),controller[_0xafe7('0x11')]);router['post']('/',auth[_0xafe7('0xb')](),controller[_0xafe7('0x12')]);router['post'](_0xafe7('0xe'),auth[_0xafe7('0xb')](),controller[_0xafe7('0x13')]);router[_0xafe7('0x14')](_0xafe7('0xa'),auth[_0xafe7('0xb')](),controller[_0xafe7('0x15')]);router['delete'](_0xafe7('0xa'),auth['isAuthenticated'](),controller[_0xafe7('0x16')]);module['exports']=router; \ No newline at end of file +var _0x7ef8=['../../components/interaction/service','./intFreshdeskAccount.controller','isAuthenticated','index','/:id','show','get','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x4adae3,_0x3ef08e){var _0x9bc234=function(_0x4eb60b){while(--_0x4eb60b){_0x4adae3['push'](_0x4adae3['shift']());}};_0x9bc234(++_0x3ef08e);}(_0x7ef8,0x1af));var _0x87ef=function(_0xb85fd5,_0x3362ae){_0xb85fd5=_0xb85fd5-0x0;var _0x34228e=_0x7ef8[_0xb85fd5];return _0x34228e;};'use strict';var multer=require(_0x87ef('0x0'));var util=require(_0x87ef('0x1'));var path=require('path');var timeout=require(_0x87ef('0x2'));var express=require('express');var router=express[_0x87ef('0x3')]();var fs_extra=require(_0x87ef('0x4'));var auth=require(_0x87ef('0x5'));var interaction=require(_0x87ef('0x6'));var config=require('../../config/environment');var controller=require(_0x87ef('0x7'));router['get']('/',auth[_0x87ef('0x8')](),controller[_0x87ef('0x9')]);router['get'](_0x87ef('0xa'),auth['isAuthenticated'](),controller[_0x87ef('0xb')]);router[_0x87ef('0xc')](_0x87ef('0xd'),auth[_0x87ef('0x8')](),controller['getConfigurations']);router[_0x87ef('0xc')](_0x87ef('0xe'),auth['isAuthenticated'](),controller[_0x87ef('0xf')]);router[_0x87ef('0x10')]('/',auth['isAuthenticated'](),controller[_0x87ef('0x11')]);router[_0x87ef('0x10')](_0x87ef('0xd'),auth[_0x87ef('0x8')](),controller[_0x87ef('0x12')]);router[_0x87ef('0x13')](_0x87ef('0xa'),auth['isAuthenticated'](),controller[_0x87ef('0x14')]);router[_0x87ef('0x15')](_0x87ef('0xa'),auth[_0x87ef('0x8')](),controller[_0x87ef('0x16')]);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 7a45920..19fb65b 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 _0x77d4=['exports','STRING','username'];(function(_0x5d1d99,_0x10ca23){var _0x2957ec=function(_0x4f4ba){while(--_0x4f4ba){_0x5d1d99['push'](_0x5d1d99['shift']());}};_0x2957ec(++_0x10ca23);}(_0x77d4,0x108));var _0x477d=function(_0xeb5ddc,_0x47cac9){_0xeb5ddc=_0xeb5ddc-0x0;var _0xfe6f47=_0x77d4[_0xeb5ddc];return _0xfe6f47;};'use strict';var Sequelize=require('sequelize');module[_0x477d('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x477d('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x477d('0x2')},'apiKey':{'type':Sequelize[_0x477d('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x477d('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xb145=['STRING','username','remoteUri','exports'];(function(_0x361078,_0x283dcb){var _0x22d9e8=function(_0x140b4b){while(--_0x140b4b){_0x361078['push'](_0x361078['shift']());}};_0x22d9e8(++_0x283dcb);}(_0xb145,0xa3));var _0x5b14=function(_0x5c5640,_0x15ca15){_0x5c5640=_0x5c5640-0x0;var _0x373343=_0xb145[_0x5c5640];return _0x373343;};'use strict';var Sequelize=require('sequelize');module[_0x5b14('0x0')]={'name':{'type':Sequelize[_0x5b14('0x1')]},'description':{'type':Sequelize[_0x5b14('0x1')]},'username':{'type':Sequelize[_0x5b14('0x1')],'unique':_0x5b14('0x2')},'apiKey':{'type':Sequelize[_0x5b14('0x1')]},'remoteUri':{'type':Sequelize[_0x5b14('0x1')],'unique':_0x5b14('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index fca78ba..0ebde78 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 _0x7ec2=['lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','set','apply','reject','update','destroy','stack','name','send','index','map','FreshdeskAccount','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','then','rows','catch','show','keys','find','create','body','params','getConfigurations','findOne','FreshdeskConfiguration','addConfiguration','Subjects','channel','FreshdeskField','Descriptions','apiKey','remoteUri','slice','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','toString','requester','subject','agent','description','priority','group','source','ticket_type','remove','includes','default','custom_dropdown','label','choices','capitalize','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x2f3304,_0x3620fe){var _0x5b9917=function(_0x32e2df){while(--_0x32e2df){_0x2f3304['push'](_0x2f3304['shift']());}};_0x5b9917(++_0x3620fe);}(_0x7ec2,0x15c));var _0x27ec=function(_0x3a984c,_0x1698c0){_0x3a984c=_0x3a984c-0x0;var _0x388a63=_0x7ec2[_0x3a984c];return _0x388a63;};'use strict';var emlformat=require(_0x27ec('0x0'));var rimraf=require(_0x27ec('0x1'));var zipdir=require(_0x27ec('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x27ec('0x3'));var moment=require(_0x27ec('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x27ec('0x5'));var util=require(_0x27ec('0x6'));var path=require(_0x27ec('0x7'));var sox=require(_0x27ec('0x8'));var csv=require(_0x27ec('0x9'));var ejs=require(_0x27ec('0xa'));var fs=require('fs');var fs_extra=require(_0x27ec('0xb'));var _=require(_0x27ec('0xc'));var squel=require(_0x27ec('0xd'));var crypto=require(_0x27ec('0xe'));var jsforce=require(_0x27ec('0xf'));var deskjs=require(_0x27ec('0x10'));var toCsv=require(_0x27ec('0x9'));var querystring=require(_0x27ec('0x11'));var Papa=require(_0x27ec('0x12'));var Redis=require(_0x27ec('0x13'));var authService=require(_0x27ec('0x14'));var qs=require(_0x27ec('0x15'));var as=require(_0x27ec('0x16'));var hardwareService=require(_0x27ec('0x17'));var logger=require(_0x27ec('0x18'))('api');var utils=require(_0x27ec('0x19'));var config=require(_0x27ec('0x1a'));var licenseUtil=require(_0x27ec('0x1b'));var db=require(_0x27ec('0x1c'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x472020,_0x4efa3d){_0x4efa3d=_0x4efa3d||0xcc;return function(_0xf77f61){if(_0xf77f61){return _0x472020[_0x27ec('0x1d')](_0x4efa3d);}return _0x472020[_0x27ec('0x1e')](_0x4efa3d)[_0x27ec('0x1f')]();};}function respondWithResult(_0x29174c,_0x14cde9){_0x14cde9=_0x14cde9||0xc8;return function(_0x46f5a0){if(_0x46f5a0){return _0x29174c['status'](_0x14cde9)[_0x27ec('0x20')](_0x46f5a0);}};}function respondWithFilteredResult(_0x1d75b1,_0x486dae){return function(_0x56bf7d){if(_0x56bf7d){var _0x26f35a=typeof _0x486dae['offset']===_0x27ec('0x21')&&typeof _0x486dae[_0x27ec('0x22')]===_0x27ec('0x21');var _0x2dec35=_0x56bf7d['count'];var _0x24b9be=_0x26f35a?0x0:_0x486dae[_0x27ec('0x23')];var _0x3ce529=_0x26f35a?_0x56bf7d['count']:_0x486dae[_0x27ec('0x23')]+_0x486dae[_0x27ec('0x22')];var _0x5e5c49;if(_0x3ce529>=_0x2dec35){_0x3ce529=_0x2dec35;_0x5e5c49=0xc8;}else{_0x5e5c49=0xce;}_0x1d75b1[_0x27ec('0x1e')](_0x5e5c49);return _0x1d75b1[_0x27ec('0x24')]('Content-Range',_0x24b9be+'-'+_0x3ce529+'/'+_0x2dec35)['json'](_0x56bf7d);}return null;};}function patchUpdates(_0x2ad3be){return function(_0x1ee6cb){try{jsonpatch[_0x27ec('0x25')](_0x1ee6cb,_0x2ad3be,!![]);}catch(_0x80891d){return BPromise[_0x27ec('0x26')](_0x80891d);}return _0x1ee6cb['save']();};}function saveUpdates(_0x19fe3f,_0x1ba9c8){return function(_0x448d62){if(_0x448d62){return _0x448d62[_0x27ec('0x27')](_0x19fe3f)['then'](function(_0x4eba78){return _0x4eba78;});}return null;};}function removeEntity(_0x217036,_0x5d5fbe){return function(_0x3dc396){if(_0x3dc396){return _0x3dc396[_0x27ec('0x28')]()['then'](function(){_0x217036[_0x27ec('0x1e')](0xcc)[_0x27ec('0x1f')]();});}};}function handleEntityNotFound(_0x9c612f,_0x5b8262){return function(_0x47db40){if(!_0x47db40){_0x9c612f[_0x27ec('0x1d')](0x194);}return _0x47db40;};}function handleError(_0x5e4f41,_0x4a0ed2){_0x4a0ed2=_0x4a0ed2||0x1f4;return function(_0x486550){logger['error'](_0x486550[_0x27ec('0x29')]);if(_0x486550[_0x27ec('0x2a')]){delete _0x486550[_0x27ec('0x2a')];}_0x5e4f41[_0x27ec('0x1e')](_0x4a0ed2)[_0x27ec('0x2b')](_0x486550);};}exports[_0x27ec('0x2c')]=function(_0x33346f,_0x471a9b){var _0x52d906={},_0x3c8fd2={},_0x2fd45d={'count':0x0,'rows':[]};var _0x5c8947=_[_0x27ec('0x2d')](db[_0x27ec('0x2e')][_0x27ec('0x2f')],function(_0x34138d){return{'name':_0x34138d[_0x27ec('0x30')],'type':_0x34138d[_0x27ec('0x31')][_0x27ec('0x32')]};});_0x3c8fd2[_0x27ec('0x33')]=_[_0x27ec('0x2d')](_0x5c8947,_0x27ec('0x2a'));_0x3c8fd2[_0x27ec('0x34')]=_['keys'](_0x33346f[_0x27ec('0x34')]);_0x3c8fd2['filters']=_['intersection'](_0x3c8fd2[_0x27ec('0x33')],_0x3c8fd2[_0x27ec('0x34')]);_0x52d906['attributes']=_[_0x27ec('0x35')](_0x3c8fd2[_0x27ec('0x33')],qs['fields'](_0x33346f['query'][_0x27ec('0x36')]));_0x52d906[_0x27ec('0x37')]=_0x52d906['attributes'][_0x27ec('0x38')]?_0x52d906['attributes']:_0x3c8fd2[_0x27ec('0x33')];if(!_0x33346f['query'][_0x27ec('0x39')](_0x27ec('0x3a'))){_0x52d906['limit']=qs[_0x27ec('0x22')](_0x33346f['query'][_0x27ec('0x22')]);_0x52d906[_0x27ec('0x23')]=qs[_0x27ec('0x23')](_0x33346f[_0x27ec('0x34')][_0x27ec('0x23')]);}_0x52d906[_0x27ec('0x3b')]=qs[_0x27ec('0x3c')](_0x33346f['query'][_0x27ec('0x3c')]);_0x52d906[_0x27ec('0x3d')]=qs[_0x27ec('0x3e')](_[_0x27ec('0x3f')](_0x33346f[_0x27ec('0x34')],_0x3c8fd2[_0x27ec('0x3e')]),_0x5c8947);if(_0x33346f[_0x27ec('0x34')][_0x27ec('0x40')]){_0x52d906[_0x27ec('0x3d')]=_[_0x27ec('0x41')](_0x52d906[_0x27ec('0x3d')],{'$or':_[_0x27ec('0x2d')](_0x5c8947,function(_0x336c18){if(_0x336c18[_0x27ec('0x31')]!==_0x27ec('0x42')){var _0x316e1f={};_0x316e1f[_0x336c18['name']]={'$like':'%'+_0x33346f[_0x27ec('0x34')]['filter']+'%'};return _0x316e1f;}})});}_0x52d906=_[_0x27ec('0x41')]({},_0x52d906,_0x33346f[_0x27ec('0x43')]);var _0x57927d={'where':_0x52d906['where']};return db[_0x27ec('0x2e')][_0x27ec('0x44')](_0x57927d)['then'](function(_0x14379d){_0x2fd45d[_0x27ec('0x44')]=_0x14379d;if(_0x33346f[_0x27ec('0x34')][_0x27ec('0x45')]){_0x52d906[_0x27ec('0x46')]=[{'all':!![]}];}return db[_0x27ec('0x2e')][_0x27ec('0x47')](_0x52d906);})[_0x27ec('0x48')](function(_0x1a7cb9){_0x2fd45d[_0x27ec('0x49')]=_0x1a7cb9;return _0x2fd45d;})[_0x27ec('0x48')](respondWithFilteredResult(_0x471a9b,_0x52d906))[_0x27ec('0x4a')](handleError(_0x471a9b,null));};exports[_0x27ec('0x4b')]=function(_0x2908bc,_0x4bd067){var _0x4ce322={'raw':![],'where':{'id':_0x2908bc['params']['id']}},_0x43596e={};_0x43596e[_0x27ec('0x33')]=_[_0x27ec('0x4c')](db[_0x27ec('0x2e')][_0x27ec('0x2f')]);_0x43596e[_0x27ec('0x34')]=_[_0x27ec('0x4c')](_0x2908bc[_0x27ec('0x34')]);_0x43596e[_0x27ec('0x3e')]=_['intersection'](_0x43596e[_0x27ec('0x33')],_0x43596e[_0x27ec('0x34')]);_0x4ce322[_0x27ec('0x37')]=_[_0x27ec('0x35')](_0x43596e[_0x27ec('0x33')],qs[_0x27ec('0x36')](_0x2908bc['query'][_0x27ec('0x36')]));_0x4ce322[_0x27ec('0x37')]=_0x4ce322[_0x27ec('0x37')]['length']?_0x4ce322[_0x27ec('0x37')]:_0x43596e[_0x27ec('0x33')];if(_0x2908bc[_0x27ec('0x34')][_0x27ec('0x45')]){_0x4ce322['include']=[{'all':!![]}];}_0x4ce322=_[_0x27ec('0x41')]({},_0x4ce322,_0x2908bc[_0x27ec('0x43')]);return db['FreshdeskAccount'][_0x27ec('0x4d')](_0x4ce322)[_0x27ec('0x48')](handleEntityNotFound(_0x4bd067,null))['then'](respondWithResult(_0x4bd067,null))[_0x27ec('0x4a')](handleError(_0x4bd067,null));};exports[_0x27ec('0x4e')]=function(_0x2d6f7c,_0x327a3e){return db[_0x27ec('0x2e')][_0x27ec('0x4e')](_0x2d6f7c[_0x27ec('0x4f')],{})[_0x27ec('0x48')](respondWithResult(_0x327a3e,0xc9))[_0x27ec('0x4a')](handleError(_0x327a3e,null));};exports[_0x27ec('0x27')]=function(_0x59e890,_0x2b412f){if(_0x59e890[_0x27ec('0x4f')]['id']){delete _0x59e890[_0x27ec('0x4f')]['id'];}return db[_0x27ec('0x2e')][_0x27ec('0x4d')]({'where':{'id':_0x59e890[_0x27ec('0x50')]['id']}})[_0x27ec('0x48')](handleEntityNotFound(_0x2b412f,null))[_0x27ec('0x48')](saveUpdates(_0x59e890[_0x27ec('0x4f')],null))[_0x27ec('0x48')](respondWithResult(_0x2b412f,null))[_0x27ec('0x4a')](handleError(_0x2b412f,null));};exports[_0x27ec('0x28')]=function(_0x474252,_0x4890a7){return db[_0x27ec('0x2e')][_0x27ec('0x4d')]({'where':{'id':_0x474252[_0x27ec('0x50')]['id']}})[_0x27ec('0x48')](handleEntityNotFound(_0x4890a7,null))[_0x27ec('0x48')](removeEntity(_0x4890a7,null))[_0x27ec('0x4a')](handleError(_0x4890a7,null));};exports[_0x27ec('0x51')]=function(_0x4068e7,_0x4ec2c9,_0x4b1250){var _0x59ac36={};var _0x5aa872={};var _0x17db18;var _0x4d0205;return db[_0x27ec('0x2e')][_0x27ec('0x52')]({'where':{'id':_0x4068e7[_0x27ec('0x50')]['id']}})[_0x27ec('0x48')](handleEntityNotFound(_0x4ec2c9,null))[_0x27ec('0x48')](function(_0x20977d){if(_0x20977d){_0x17db18=_0x20977d;_0x5aa872[_0x27ec('0x33')]=_[_0x27ec('0x4c')](db[_0x27ec('0x53')][_0x27ec('0x2f')]);_0x5aa872[_0x27ec('0x34')]=_['keys'](_0x4068e7[_0x27ec('0x34')]);_0x5aa872[_0x27ec('0x3e')]=_[_0x27ec('0x35')](_0x5aa872[_0x27ec('0x33')],_0x5aa872['query']);_0x59ac36[_0x27ec('0x37')]=_[_0x27ec('0x35')](_0x5aa872['model'],qs[_0x27ec('0x36')](_0x4068e7[_0x27ec('0x34')]['fields']));_0x59ac36[_0x27ec('0x37')]=_0x59ac36[_0x27ec('0x37')][_0x27ec('0x38')]?_0x59ac36[_0x27ec('0x37')]:_0x5aa872[_0x27ec('0x33')];_0x59ac36[_0x27ec('0x3b')]=qs[_0x27ec('0x3c')](_0x4068e7[_0x27ec('0x34')][_0x27ec('0x3c')]);_0x59ac36[_0x27ec('0x3d')]=qs['filters'](_[_0x27ec('0x3f')](_0x4068e7[_0x27ec('0x34')],_0x5aa872[_0x27ec('0x3e')]));if(_0x4068e7[_0x27ec('0x34')]['filter']){_0x59ac36[_0x27ec('0x3d')]=_[_0x27ec('0x41')](_0x59ac36[_0x27ec('0x3d')],{'$or':_[_0x27ec('0x2d')](_0x59ac36[_0x27ec('0x37')],function(_0x594e85){var _0xc3b0cc={};_0xc3b0cc[_0x594e85]={'$like':'%'+_0x4068e7['query'][_0x27ec('0x40')]+'%'};return _0xc3b0cc;})});}_0x59ac36=_[_0x27ec('0x41')]({},_0x59ac36,_0x4068e7[_0x27ec('0x43')]);return _0x17db18[_0x27ec('0x51')](_0x59ac36);}})[_0x27ec('0x48')](function(_0x3c7431){if(_0x3c7431){_0x4d0205=_0x3c7431[_0x27ec('0x38')];if(!_0x4068e7[_0x27ec('0x34')][_0x27ec('0x39')](_0x27ec('0x3a'))){_0x59ac36[_0x27ec('0x22')]=qs[_0x27ec('0x22')](_0x4068e7[_0x27ec('0x34')][_0x27ec('0x22')]);_0x59ac36[_0x27ec('0x23')]=qs[_0x27ec('0x23')](_0x4068e7['query'][_0x27ec('0x23')]);}return _0x17db18[_0x27ec('0x51')](_0x59ac36);}})[_0x27ec('0x48')](function(_0x2a6720){if(_0x2a6720){return _0x2a6720?{'count':_0x4d0205,'rows':_0x2a6720}:null;}})['then'](respondWithResult(_0x4ec2c9,null))[_0x27ec('0x4a')](handleError(_0x4ec2c9,null));};exports[_0x27ec('0x54')]=function(_0x26e610,_0x5cd377,_0x4797bb){if(_0x26e610[_0x27ec('0x4f')]['id']){delete _0x26e610[_0x27ec('0x4f')]['id'];}return db['FreshdeskAccount'][_0x27ec('0x52')]({'where':{'id':_0x26e610[_0x27ec('0x50')]['id']}})[_0x27ec('0x48')](handleEntityNotFound(_0x5cd377,null))['then'](function(_0x1978cb){if(_0x1978cb){_0x26e610[_0x27ec('0x4f')]['AccountId']=_0x1978cb['id'];_0x26e610[_0x27ec('0x4f')][_0x27ec('0x55')]=integrations['getSubjects'](_0x26e610[_0x27ec('0x4f')][_0x27ec('0x56')],_0x26e610[_0x27ec('0x4f')][_0x27ec('0x31')]);_0x26e610[_0x27ec('0x4f')]['Descriptions']=integrations['getDescriptions'](_0x26e610[_0x27ec('0x4f')][_0x27ec('0x56')],_0x26e610[_0x27ec('0x4f')]['type']);return db['FreshdeskConfiguration'][_0x27ec('0x4e')](_0x26e610[_0x27ec('0x4f')],{'include':[{'model':db[_0x27ec('0x57')],'as':_0x27ec('0x55')},{'model':db[_0x27ec('0x57')],'as':_0x27ec('0x58')}]});}return null;})[_0x27ec('0x48')](respondWithResult(_0x5cd377,null))[_0x27ec('0x4a')](handleError(_0x5cd377,null));};exports['getFields']=function(_0x45aa21,_0x1e0ae9,_0x192789){var _0x5ae69d='';return db['FreshdeskAccount'][_0x27ec('0x52')]({'where':{'id':_0x45aa21['params']['id']},'attributes':['id','remoteUri',_0x27ec('0x59')]})['then'](handleEntityNotFound(_0x1e0ae9,null))[_0x27ec('0x48')](function(_0x24f970){if(_0x24f970){_0x5ae69d=_0x24f970[_0x27ec('0x5a')];var _0xbd1caf=_0x5ae69d[_0x27ec('0x5b')](-0x1);if(_0xbd1caf==='/'){_0x5ae69d=_0x5ae69d['substring'](0x0,_0x5ae69d[_0x27ec('0x5c')](_0xbd1caf));}return rp({'method':_0x27ec('0x5d'),'uri':util[_0x27ec('0x5e')](_0x27ec('0x5f'),_0x5ae69d,_0x27ec('0x60')),'headers':{'Authorization':util[_0x27ec('0x5e')](_0x27ec('0x61'),new Buffer(util[_0x27ec('0x5e')]('%s:X',_0x24f970[_0x27ec('0x59')]))[_0x27ec('0x62')]('base64'))},'json':!![]});}})[_0x27ec('0x48')](function(_0x5b6542){if(_0x5b6542){var _0x50e202=[_0x27ec('0x63'),_0x27ec('0x64'),_0x27ec('0x65'),_0x27ec('0x66'),_0x27ec('0x1e'),_0x27ec('0x67'),_0x27ec('0x68'),_0x27ec('0x69'),_0x27ec('0x6a'),_0x27ec('0x68'),'company'];_[_0x27ec('0x6b')](_0x5b6542,function(_0x52a263){return _0x50e202[_0x27ec('0x6c')](_0x52a263[_0x27ec('0x2a')])||!_0x52a263[_0x27ec('0x6d')]&&_0x52a263[_0x27ec('0x31')]!=='custom_text'&&_0x52a263['type']!==_0x27ec('0x6e');});return{'count':_0x5b6542['length'],'rows':_[_0x27ec('0x2d')](_0x5b6542,function(_0x20f698){return{'id':_0x20f698['name'],'name':_0x20f698[_0x27ec('0x6f')],'custom':!_0x20f698[_0x27ec('0x6d')],'options':_0x20f698[_0x27ec('0x70')]?_['map'](_0x20f698[_0x27ec('0x70')],function(_0x507bf5){return{'name':_[_0x27ec('0x71')](_0x507bf5),'value':_0x507bf5};}):[]};})};}})['then'](respondWithResult(_0x1e0ae9,null))[_0x27ec('0x4a')](function(_0x7c4998){var _0x1dda46=_0x45aa21[_0x27ec('0x34')][_0x27ec('0x72')]?0x1f4:_0x7c4998[_0x27ec('0x73')]||0x1f4;logger[_0x27ec('0x74')](_0x27ec('0x75'),'getFields',_0x1dda46,JSON[_0x27ec('0x76')](_0x7c4998));delete _0x7c4998['name'];if(_0x1dda46===0x191){_0x1dda46=0x190;}_0x1e0ae9['status'](_0x1dda46)[_0x27ec('0x2b')](_0x45aa21['query'][_0x27ec('0x72')]?{'message':_0x27ec('0x77'),'statusCode':_0x7c4998[_0x27ec('0x73')]}:_0x7c4998);});}; \ No newline at end of file +var _0x50a8=['../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','save','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','FreshdeskAccount','includeAll','include','findAll','rows','show','params','keys','length','catch','create','find','getConfigurations','findOne','FreshdeskConfiguration','filter','body','AccountId','getSubjects','Descriptions','getDescriptions','Subjects','FreshdeskField','apiKey','remoteUri','slice','substring','GET','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','base64','requester','subject','agent','group','source','company','remove','includes','default','custom_text','custom_dropdown','choices','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','eml-format','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x50a8,0x198));var _0x850a=function(_0x41aaa5,_0x5d880b){_0x41aaa5=_0x41aaa5-0x0;var _0x35c60f=_0x50a8[_0x41aaa5];return _0x35c60f;};'use strict';var emlformat=require(_0x850a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x850a('0x1'));var moment=require('moment');var BPromise=require(_0x850a('0x2'));var Mustache=require(_0x850a('0x3'));var util=require(_0x850a('0x4'));var path=require(_0x850a('0x5'));var sox=require(_0x850a('0x6'));var csv=require(_0x850a('0x7'));var ejs=require(_0x850a('0x8'));var fs=require('fs');var fs_extra=require(_0x850a('0x9'));var _=require(_0x850a('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x850a('0xb'));var deskjs=require(_0x850a('0xc'));var toCsv=require(_0x850a('0x7'));var querystring=require(_0x850a('0xd'));var Papa=require('papaparse');var Redis=require(_0x850a('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x850a('0xf'));var hardwareService=require(_0x850a('0x10'));var logger=require(_0x850a('0x11'))(_0x850a('0x12'));var utils=require(_0x850a('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x850a('0x14'));function respondWithStatusCode(_0x4d591d,_0x45cd78){_0x45cd78=_0x45cd78||0xcc;return function(_0x21d324){if(_0x21d324){return _0x4d591d[_0x850a('0x15')](_0x45cd78);}return _0x4d591d[_0x850a('0x16')](_0x45cd78)[_0x850a('0x17')]();};}function respondWithResult(_0x50c199,_0x355a31){_0x355a31=_0x355a31||0xc8;return function(_0x59f778){if(_0x59f778){return _0x50c199['status'](_0x355a31)['json'](_0x59f778);}};}function respondWithFilteredResult(_0x4c0156,_0x3e6e81){return function(_0x5e0fbe){if(_0x5e0fbe){var _0x657067=typeof _0x3e6e81[_0x850a('0x18')]===_0x850a('0x19')&&typeof _0x3e6e81[_0x850a('0x1a')]===_0x850a('0x19');var _0x1a987c=_0x5e0fbe[_0x850a('0x1b')];var _0x419ae6=_0x657067?0x0:_0x3e6e81['offset'];var _0x432a28=_0x657067?_0x5e0fbe['count']:_0x3e6e81['offset']+_0x3e6e81['limit'];var _0x5acf31;if(_0x432a28>=_0x1a987c){_0x432a28=_0x1a987c;_0x5acf31=0xc8;}else{_0x5acf31=0xce;}_0x4c0156[_0x850a('0x16')](_0x5acf31);return _0x4c0156[_0x850a('0x1c')](_0x850a('0x1d'),_0x419ae6+'-'+_0x432a28+'/'+_0x1a987c)['json'](_0x5e0fbe);}return null;};}function patchUpdates(_0x17eadb){return function(_0x6221f6){try{jsonpatch[_0x850a('0x1e')](_0x6221f6,_0x17eadb,!![]);}catch(_0x484b13){return BPromise['reject'](_0x484b13);}return _0x6221f6[_0x850a('0x1f')]();};}function saveUpdates(_0x285ef4,_0x5758af){return function(_0xf4655a){if(_0xf4655a){return _0xf4655a['update'](_0x285ef4)['then'](function(_0x561fde){return _0x561fde;});}return null;};}function removeEntity(_0x4363d4,_0x47d527){return function(_0x3ad545){if(_0x3ad545){return _0x3ad545[_0x850a('0x20')]()[_0x850a('0x21')](function(){_0x4363d4['status'](0xcc)[_0x850a('0x17')]();});}};}function handleEntityNotFound(_0xc52e71,_0x33327e){return function(_0x59bc52){if(!_0x59bc52){_0xc52e71[_0x850a('0x15')](0x194);}return _0x59bc52;};}function handleError(_0xe46a27,_0x4d715c){_0x4d715c=_0x4d715c||0x1f4;return function(_0x21e34d){logger[_0x850a('0x22')](_0x21e34d[_0x850a('0x23')]);if(_0x21e34d[_0x850a('0x24')]){delete _0x21e34d[_0x850a('0x24')];}_0xe46a27[_0x850a('0x16')](_0x4d715c)[_0x850a('0x25')](_0x21e34d);};}exports[_0x850a('0x26')]=function(_0x3a228f,_0x177dd6){var _0x44fb58={},_0x1e8632={},_0x3f1efc={'count':0x0,'rows':[]};var _0x7af273=_[_0x850a('0x27')](db['FreshdeskAccount'][_0x850a('0x28')],function(_0x5cbab3){return{'name':_0x5cbab3[_0x850a('0x29')],'type':_0x5cbab3[_0x850a('0x2a')][_0x850a('0x2b')]};});_0x1e8632['model']=_['map'](_0x7af273,'name');_0x1e8632[_0x850a('0x2c')]=_['keys'](_0x3a228f[_0x850a('0x2c')]);_0x1e8632[_0x850a('0x2d')]=_[_0x850a('0x2e')](_0x1e8632[_0x850a('0x2f')],_0x1e8632['query']);_0x44fb58[_0x850a('0x30')]=_[_0x850a('0x2e')](_0x1e8632[_0x850a('0x2f')],qs[_0x850a('0x31')](_0x3a228f[_0x850a('0x2c')]['fields']));_0x44fb58['attributes']=_0x44fb58[_0x850a('0x30')]['length']?_0x44fb58[_0x850a('0x30')]:_0x1e8632[_0x850a('0x2f')];if(!_0x3a228f[_0x850a('0x2c')][_0x850a('0x32')](_0x850a('0x33'))){_0x44fb58[_0x850a('0x1a')]=qs[_0x850a('0x1a')](_0x3a228f[_0x850a('0x2c')][_0x850a('0x1a')]);_0x44fb58[_0x850a('0x18')]=qs['offset'](_0x3a228f[_0x850a('0x2c')][_0x850a('0x18')]);}_0x44fb58[_0x850a('0x34')]=qs[_0x850a('0x35')](_0x3a228f[_0x850a('0x2c')]['sort']);_0x44fb58[_0x850a('0x36')]=qs[_0x850a('0x2d')](_['pick'](_0x3a228f[_0x850a('0x2c')],_0x1e8632[_0x850a('0x2d')]),_0x7af273);if(_0x3a228f[_0x850a('0x2c')]['filter']){_0x44fb58['where']=_[_0x850a('0x37')](_0x44fb58[_0x850a('0x36')],{'$or':_[_0x850a('0x27')](_0x7af273,function(_0x387dd8){if(_0x387dd8[_0x850a('0x2a')]!==_0x850a('0x38')){var _0x5425df={};_0x5425df[_0x387dd8['name']]={'$like':'%'+_0x3a228f['query']['filter']+'%'};return _0x5425df;}})});}_0x44fb58=_['merge']({},_0x44fb58,_0x3a228f[_0x850a('0x39')]);var _0xb8b012={'where':_0x44fb58[_0x850a('0x36')]};return db[_0x850a('0x3a')][_0x850a('0x1b')](_0xb8b012)['then'](function(_0x1c5c37){_0x3f1efc[_0x850a('0x1b')]=_0x1c5c37;if(_0x3a228f['query'][_0x850a('0x3b')]){_0x44fb58[_0x850a('0x3c')]=[{'all':!![]}];}return db[_0x850a('0x3a')][_0x850a('0x3d')](_0x44fb58);})[_0x850a('0x21')](function(_0x23418d){_0x3f1efc[_0x850a('0x3e')]=_0x23418d;return _0x3f1efc;})[_0x850a('0x21')](respondWithFilteredResult(_0x177dd6,_0x44fb58))['catch'](handleError(_0x177dd6,null));};exports[_0x850a('0x3f')]=function(_0x13ea8b,_0x1e5d20){var _0x4a0a41={'raw':![],'where':{'id':_0x13ea8b[_0x850a('0x40')]['id']}},_0x15f04e={};_0x15f04e[_0x850a('0x2f')]=_[_0x850a('0x41')](db[_0x850a('0x3a')][_0x850a('0x28')]);_0x15f04e[_0x850a('0x2c')]=_[_0x850a('0x41')](_0x13ea8b[_0x850a('0x2c')]);_0x15f04e[_0x850a('0x2d')]=_[_0x850a('0x2e')](_0x15f04e[_0x850a('0x2f')],_0x15f04e[_0x850a('0x2c')]);_0x4a0a41['attributes']=_[_0x850a('0x2e')](_0x15f04e[_0x850a('0x2f')],qs[_0x850a('0x31')](_0x13ea8b[_0x850a('0x2c')][_0x850a('0x31')]));_0x4a0a41['attributes']=_0x4a0a41[_0x850a('0x30')][_0x850a('0x42')]?_0x4a0a41['attributes']:_0x15f04e[_0x850a('0x2f')];if(_0x13ea8b[_0x850a('0x2c')][_0x850a('0x3b')]){_0x4a0a41[_0x850a('0x3c')]=[{'all':!![]}];}_0x4a0a41=_[_0x850a('0x37')]({},_0x4a0a41,_0x13ea8b['options']);return db[_0x850a('0x3a')]['find'](_0x4a0a41)[_0x850a('0x21')](handleEntityNotFound(_0x1e5d20,null))[_0x850a('0x21')](respondWithResult(_0x1e5d20,null))[_0x850a('0x43')](handleError(_0x1e5d20,null));};exports[_0x850a('0x44')]=function(_0x2c4439,_0x9f9f15){return db[_0x850a('0x3a')]['create'](_0x2c4439['body'],{})[_0x850a('0x21')](respondWithResult(_0x9f9f15,0xc9))[_0x850a('0x43')](handleError(_0x9f9f15,null));};exports['update']=function(_0x4e669c,_0x500d17){if(_0x4e669c['body']['id']){delete _0x4e669c['body']['id'];}return db['FreshdeskAccount'][_0x850a('0x45')]({'where':{'id':_0x4e669c[_0x850a('0x40')]['id']}})[_0x850a('0x21')](handleEntityNotFound(_0x500d17,null))[_0x850a('0x21')](saveUpdates(_0x4e669c['body'],null))[_0x850a('0x21')](respondWithResult(_0x500d17,null))[_0x850a('0x43')](handleError(_0x500d17,null));};exports['destroy']=function(_0x3e712c,_0x463e17){return db[_0x850a('0x3a')]['find']({'where':{'id':_0x3e712c['params']['id']}})[_0x850a('0x21')](handleEntityNotFound(_0x463e17,null))['then'](removeEntity(_0x463e17,null))[_0x850a('0x43')](handleError(_0x463e17,null));};exports[_0x850a('0x46')]=function(_0x3b3e68,_0x5a61f9,_0x3dd882){var _0x42b85c={};var _0x501031={};var _0x5d817a;var _0x3247a8;return db[_0x850a('0x3a')][_0x850a('0x47')]({'where':{'id':_0x3b3e68[_0x850a('0x40')]['id']}})['then'](handleEntityNotFound(_0x5a61f9,null))[_0x850a('0x21')](function(_0x41f9dc){if(_0x41f9dc){_0x5d817a=_0x41f9dc;_0x501031[_0x850a('0x2f')]=_['keys'](db[_0x850a('0x48')][_0x850a('0x28')]);_0x501031[_0x850a('0x2c')]=_['keys'](_0x3b3e68[_0x850a('0x2c')]);_0x501031['filters']=_[_0x850a('0x2e')](_0x501031[_0x850a('0x2f')],_0x501031[_0x850a('0x2c')]);_0x42b85c['attributes']=_['intersection'](_0x501031['model'],qs[_0x850a('0x31')](_0x3b3e68[_0x850a('0x2c')][_0x850a('0x31')]));_0x42b85c[_0x850a('0x30')]=_0x42b85c['attributes'][_0x850a('0x42')]?_0x42b85c[_0x850a('0x30')]:_0x501031[_0x850a('0x2f')];_0x42b85c[_0x850a('0x34')]=qs[_0x850a('0x35')](_0x3b3e68['query'][_0x850a('0x35')]);_0x42b85c['where']=qs[_0x850a('0x2d')](_['pick'](_0x3b3e68[_0x850a('0x2c')],_0x501031['filters']));if(_0x3b3e68[_0x850a('0x2c')][_0x850a('0x49')]){_0x42b85c[_0x850a('0x36')]=_[_0x850a('0x37')](_0x42b85c[_0x850a('0x36')],{'$or':_[_0x850a('0x27')](_0x42b85c[_0x850a('0x30')],function(_0x3fb0d5){var _0x71e746={};_0x71e746[_0x3fb0d5]={'$like':'%'+_0x3b3e68[_0x850a('0x2c')][_0x850a('0x49')]+'%'};return _0x71e746;})});}_0x42b85c=_[_0x850a('0x37')]({},_0x42b85c,_0x3b3e68[_0x850a('0x39')]);return _0x5d817a[_0x850a('0x46')](_0x42b85c);}})[_0x850a('0x21')](function(_0x284e62){if(_0x284e62){_0x3247a8=_0x284e62['length'];if(!_0x3b3e68[_0x850a('0x2c')]['hasOwnProperty'](_0x850a('0x33'))){_0x42b85c['limit']=qs[_0x850a('0x1a')](_0x3b3e68[_0x850a('0x2c')][_0x850a('0x1a')]);_0x42b85c['offset']=qs['offset'](_0x3b3e68['query'][_0x850a('0x18')]);}return _0x5d817a['getConfigurations'](_0x42b85c);}})['then'](function(_0x1103ac){if(_0x1103ac){return _0x1103ac?{'count':_0x3247a8,'rows':_0x1103ac}:null;}})[_0x850a('0x21')](respondWithResult(_0x5a61f9,null))[_0x850a('0x43')](handleError(_0x5a61f9,null));};exports['addConfiguration']=function(_0x18aa12,_0x4c25fa,_0xb3c661){if(_0x18aa12[_0x850a('0x4a')]['id']){delete _0x18aa12[_0x850a('0x4a')]['id'];}return db[_0x850a('0x3a')]['findOne']({'where':{'id':_0x18aa12[_0x850a('0x40')]['id']}})[_0x850a('0x21')](handleEntityNotFound(_0x4c25fa,null))[_0x850a('0x21')](function(_0x9bb156){if(_0x9bb156){_0x18aa12[_0x850a('0x4a')][_0x850a('0x4b')]=_0x9bb156['id'];_0x18aa12['body']['Subjects']=integrations[_0x850a('0x4c')](_0x18aa12['body']['channel'],_0x18aa12[_0x850a('0x4a')]['type']);_0x18aa12[_0x850a('0x4a')][_0x850a('0x4d')]=integrations[_0x850a('0x4e')](_0x18aa12[_0x850a('0x4a')]['channel'],_0x18aa12['body'][_0x850a('0x2a')]);return db['FreshdeskConfiguration'][_0x850a('0x44')](_0x18aa12['body'],{'include':[{'model':db['FreshdeskField'],'as':_0x850a('0x4f')},{'model':db[_0x850a('0x50')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x4c25fa,null))['catch'](handleError(_0x4c25fa,null));};exports['getFields']=function(_0x3c183a,_0x29ba64,_0x4b5842){var _0x3768b4='';return db[_0x850a('0x3a')][_0x850a('0x47')]({'where':{'id':_0x3c183a[_0x850a('0x40')]['id']},'attributes':['id','remoteUri',_0x850a('0x51')]})[_0x850a('0x21')](handleEntityNotFound(_0x29ba64,null))[_0x850a('0x21')](function(_0x20fddf){if(_0x20fddf){_0x3768b4=_0x20fddf[_0x850a('0x52')];var _0x43a920=_0x3768b4[_0x850a('0x53')](-0x1);if(_0x43a920==='/'){_0x3768b4=_0x3768b4[_0x850a('0x54')](0x0,_0x3768b4['lastIndexOf'](_0x43a920));}return rp({'method':_0x850a('0x55'),'uri':util['format'](_0x850a('0x56'),_0x3768b4,_0x850a('0x57')),'headers':{'Authorization':util['format'](_0x850a('0x58'),new Buffer(util['format'](_0x850a('0x59'),_0x20fddf[_0x850a('0x51')]))['toString'](_0x850a('0x5a')))},'json':!![]});}})[_0x850a('0x21')](function(_0x1c56d5){if(_0x1c56d5){var _0x48b3f3=[_0x850a('0x5b'),_0x850a('0x5c'),_0x850a('0x5d'),'description','status','priority',_0x850a('0x5e'),_0x850a('0x5f'),'ticket_type',_0x850a('0x5e'),_0x850a('0x60')];_[_0x850a('0x61')](_0x1c56d5,function(_0x3d6862){return _0x48b3f3[_0x850a('0x62')](_0x3d6862[_0x850a('0x24')])||!_0x3d6862[_0x850a('0x63')]&&_0x3d6862['type']!==_0x850a('0x64')&&_0x3d6862[_0x850a('0x2a')]!==_0x850a('0x65');});return{'count':_0x1c56d5[_0x850a('0x42')],'rows':_['map'](_0x1c56d5,function(_0xc05dac){return{'id':_0xc05dac[_0x850a('0x24')],'name':_0xc05dac['label'],'custom':!_0xc05dac[_0x850a('0x63')],'options':_0xc05dac[_0x850a('0x66')]?_[_0x850a('0x27')](_0xc05dac['choices'],function(_0x516e4d){return{'name':_['capitalize'](_0x516e4d),'value':_0x516e4d};}):[]};})};}})[_0x850a('0x21')](respondWithResult(_0x29ba64,null))[_0x850a('0x43')](function(_0x5d81d1){var _0x12d1c2=_0x3c183a['query'][_0x850a('0x67')]?0x1f4:_0x5d81d1[_0x850a('0x68')]||0x1f4;logger[_0x850a('0x22')](_0x850a('0x69'),_0x850a('0x6a'),_0x12d1c2,JSON['stringify'](_0x5d81d1));delete _0x5d81d1['name'];if(_0x12d1c2===0x191){_0x12d1c2=0x190;}_0x29ba64[_0x850a('0x16')](_0x12d1c2)[_0x850a('0x25')](_0x3c183a[_0x850a('0x2c')][_0x850a('0x67')]?{'message':'Wrong\x20credentials','statusCode':_0x5d81d1[_0x850a('0x68')]}:_0x5d81d1);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 37205a1..2af2a0e 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 _0xc3e7=['bluebird','request-promise','path','rimraf','./intFreshdeskAccount.attributes','../../components/integrations/configuration','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger','moment'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xc3e7,0x15b));var _0x7c3e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xc3e7[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x7c3e('0x0'));var util=require(_0x7c3e('0x1'));var logger=require(_0x7c3e('0x2'))('api');var moment=require(_0x7c3e('0x3'));var BPromise=require(_0x7c3e('0x4'));var rp=require(_0x7c3e('0x5'));var fs=require('fs');var path=require(_0x7c3e('0x6'));var rimraf=require(_0x7c3e('0x7'));var config=require('../../config/environment');var attributes=require(_0x7c3e('0x8'));var integrations=require(_0x7c3e('0x9'));module['exports']=function(_0x26ab77,_0x2074a2){return _0x26ab77[_0x7c3e('0xa')](_0x7c3e('0xb'),attributes,{'tableName':_0x7c3e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x04a5=['FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define'];(function(_0x1fc122,_0x5e2c17){var _0xa2cb13=function(_0x263b13){while(--_0x263b13){_0x1fc122['push'](_0x1fc122['shift']());}};_0xa2cb13(++_0x5e2c17);}(_0x04a5,0x1a2));var _0x504a=function(_0x5c9f56,_0x42c9ad){_0x5c9f56=_0x5c9f56-0x0;var _0x2a726b=_0x04a5[_0x5c9f56];return _0x2a726b;};'use strict';var _=require(_0x504a('0x0'));var util=require(_0x504a('0x1'));var logger=require(_0x504a('0x2'))('api');var moment=require(_0x504a('0x3'));var BPromise=require(_0x504a('0x4'));var rp=require(_0x504a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x504a('0x6'));var config=require('../../config/environment');var attributes=require(_0x504a('0x7'));var integrations=require(_0x504a('0x8'));module[_0x504a('0x9')]=function(_0x390e16,_0x4c14b9){return _0x390e16[_0x504a('0xa')](_0x504a('0xb'),attributes,{'tableName':_0x504a('0xc'),'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 50dcc28..6ced320 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 _0xb2d5=['request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetFreshdeskAccount','findAll','options','raw','where','limit','include','map','model','attributes','FreshdeskAccount','find','ShowFreshdeskAccount','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x4e7d25,_0x58285f){var _0x526fe6=function(_0x4f0aec){while(--_0x4f0aec){_0x4e7d25['push'](_0x4e7d25['shift']());}};_0x526fe6(++_0x58285f);}(_0xb2d5,0x11c));var _0x5b2d=function(_0x189a98,_0x5d5dd6){_0x189a98=_0x189a98-0x0;var _0x40239d=_0xb2d5[_0x189a98];return _0x40239d;};'use strict';var _=require(_0x5b2d('0x0'));var util=require('util');var moment=require(_0x5b2d('0x1'));var BPromise=require(_0x5b2d('0x2'));var rs=require(_0x5b2d('0x3'));var fs=require('fs');var Redis=require(_0x5b2d('0x4'));var db=require(_0x5b2d('0x5'))['db'];var utils=require(_0x5b2d('0x6'));var logger=require('../../config/logger')(_0x5b2d('0x7'));var config=require(_0x5b2d('0x8'));var jayson=require(_0x5b2d('0x9'));var client=jayson[_0x5b2d('0xa')][_0x5b2d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1c9bdc,_0x276dd2,_0x11fd58){return new BPromise(function(_0xbd6dd7,_0x2f8849){return client[_0x5b2d('0xc')](_0x1c9bdc,_0x11fd58)[_0x5b2d('0xd')](function(_0x2d94fa){logger[_0x5b2d('0xe')](_0x5b2d('0xf'),_0x276dd2,_0x5b2d('0x10'));logger[_0x5b2d('0x11')](_0x5b2d('0x12'),_0x276dd2,_0x5b2d('0x10'),JSON[_0x5b2d('0x13')](_0x2d94fa));if(_0x2d94fa[_0x5b2d('0x14')]){if(_0x2d94fa[_0x5b2d('0x14')]['code']===0x1f4){logger[_0x5b2d('0x14')](_0x5b2d('0xf'),_0x276dd2,_0x2d94fa['error'][_0x5b2d('0x15')]);return _0x2f8849(_0x2d94fa[_0x5b2d('0x14')][_0x5b2d('0x15')]);}logger['error'](_0x5b2d('0xf'),_0x276dd2,_0x2d94fa[_0x5b2d('0x14')][_0x5b2d('0x15')]);return _0xbd6dd7(_0x2d94fa[_0x5b2d('0x14')][_0x5b2d('0x15')]);}else{logger[_0x5b2d('0xe')]('FreshdeskAccount,\x20%s,\x20%s',_0x276dd2,_0x5b2d('0x10'));_0xbd6dd7(_0x2d94fa[_0x5b2d('0x16')][_0x5b2d('0x15')]);}})[_0x5b2d('0x17')](function(_0x1230ea){logger[_0x5b2d('0x14')](_0x5b2d('0xf'),_0x276dd2,_0x1230ea);_0x2f8849(_0x1230ea);});});}exports[_0x5b2d('0x18')]=function(_0x2cb83b){var _0xe28196=this;return new Promise(function(_0x9f31ca,_0x35137d){return db['FreshdeskAccount'][_0x5b2d('0x19')]({'raw':_0x2cb83b[_0x5b2d('0x1a')]?_0x2cb83b[_0x5b2d('0x1a')][_0x5b2d('0x1b')]===undefined?!![]:![]:!![],'where':_0x2cb83b[_0x5b2d('0x1a')]?_0x2cb83b[_0x5b2d('0x1a')][_0x5b2d('0x1c')]||null:null,'attributes':_0x2cb83b['options']?_0x2cb83b['options']['attributes']||null:null,'limit':_0x2cb83b[_0x5b2d('0x1a')]?_0x2cb83b[_0x5b2d('0x1a')][_0x5b2d('0x1d')]||null:null,'include':_0x2cb83b[_0x5b2d('0x1a')]?_0x2cb83b[_0x5b2d('0x1a')][_0x5b2d('0x1e')]?_[_0x5b2d('0x1f')](_0x2cb83b[_0x5b2d('0x1a')][_0x5b2d('0x1e')],function(_0x2574d6){return{'model':db[_0x2574d6[_0x5b2d('0x20')]],'as':_0x2574d6['as'],'attributes':_0x2574d6[_0x5b2d('0x21')],'include':_0x2574d6['include']?_['map'](_0x2574d6[_0x5b2d('0x1e')],function(_0x3aba2a){return{'model':db[_0x3aba2a[_0x5b2d('0x20')]],'as':_0x3aba2a['as'],'attributes':_0x3aba2a[_0x5b2d('0x21')],'include':_0x3aba2a[_0x5b2d('0x1e')]?_['map'](_0x3aba2a[_0x5b2d('0x1e')],function(_0x40bb26){return{'model':db[_0x40bb26[_0x5b2d('0x20')]],'as':_0x40bb26['as'],'attributes':_0x40bb26[_0x5b2d('0x21')]};}):[]};}):[]};}):[]:[]})[_0x5b2d('0xd')](function(_0x5faa9c){logger['info'](_0x5b2d('0x18'),_0x2cb83b);logger['debug'](_0x5b2d('0x18'),_0x2cb83b,JSON['stringify'](_0x5faa9c));_0x9f31ca(_0x5faa9c);})[_0x5b2d('0x17')](function(_0x42ae72){logger['error'](_0x5b2d('0x18'),_0x42ae72[_0x5b2d('0x15')],_0x2cb83b);_0x35137d(_0xe28196['error'](0x1f4,_0x42ae72[_0x5b2d('0x15')]));});});};exports['ShowFreshdeskAccount']=function(_0x15407f){var _0xd211c7=this;return new Promise(function(_0x2fe1af,_0x579680){return db[_0x5b2d('0x22')][_0x5b2d('0x23')]({'raw':_0x15407f[_0x5b2d('0x1a')]?_0x15407f[_0x5b2d('0x1a')][_0x5b2d('0x1b')]===undefined?!![]:![]:!![],'where':_0x15407f['options']?_0x15407f['options'][_0x5b2d('0x1c')]||null:null,'attributes':_0x15407f[_0x5b2d('0x1a')]?_0x15407f[_0x5b2d('0x1a')][_0x5b2d('0x21')]||null:null,'include':_0x15407f[_0x5b2d('0x1a')]?_0x15407f[_0x5b2d('0x1a')][_0x5b2d('0x1e')]?_[_0x5b2d('0x1f')](_0x15407f[_0x5b2d('0x1a')][_0x5b2d('0x1e')],function(_0x1a64a8){return{'model':db[_0x1a64a8[_0x5b2d('0x20')]],'as':_0x1a64a8['as'],'attributes':_0x1a64a8['attributes'],'include':_0x1a64a8[_0x5b2d('0x1e')]?_[_0x5b2d('0x1f')](_0x1a64a8[_0x5b2d('0x1e')],function(_0x27f199){return{'model':db[_0x27f199['model']],'as':_0x27f199['as'],'attributes':_0x27f199[_0x5b2d('0x21')],'include':_0x27f199[_0x5b2d('0x1e')]?_['map'](_0x27f199[_0x5b2d('0x1e')],function(_0x448834){return{'model':db[_0x448834[_0x5b2d('0x20')]],'as':_0x448834['as'],'attributes':_0x448834[_0x5b2d('0x21')]};}):[]};}):[]};}):[]:[]})[_0x5b2d('0xd')](function(_0x2aeca4){logger['info'](_0x5b2d('0x24'),_0x15407f);logger[_0x5b2d('0x11')](_0x5b2d('0x24'),_0x15407f,JSON['stringify'](_0x2aeca4));_0x2fe1af(_0x2aeca4);})[_0x5b2d('0x17')](function(_0x597f89){logger[_0x5b2d('0x14')](_0x5b2d('0x24'),_0x597f89['message'],_0x15407f);_0x579680(_0xd211c7[_0x5b2d('0x14')](0x1f4,_0x597f89['message']));});});}; \ No newline at end of file +var _0xc818=['http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFreshdeskAccount','findAll','options','where','attributes','limit','include','map','model','debug','ShowFreshdeskAccount','FreshdeskAccount','find','raw','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x397a02,_0x4accff){var _0x28dd05=function(_0xee9680){while(--_0xee9680){_0x397a02['push'](_0x397a02['shift']());}};_0x28dd05(++_0x4accff);}(_0xc818,0x1e3));var _0x8c81=function(_0x3531c7,_0x3140d9){_0x3531c7=_0x3531c7-0x0;var _0x167195=_0xc818[_0x3531c7];return _0x167195;};'use strict';var _=require(_0x8c81('0x0'));var util=require(_0x8c81('0x1'));var moment=require(_0x8c81('0x2'));var BPromise=require(_0x8c81('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8c81('0x4'));var db=require(_0x8c81('0x5'))['db'];var utils=require(_0x8c81('0x6'));var logger=require(_0x8c81('0x7'))(_0x8c81('0x8'));var config=require(_0x8c81('0x9'));var jayson=require(_0x8c81('0xa'));var client=jayson['client'][_0x8c81('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3d663e,_0x32cf31,_0x43d142){return new BPromise(function(_0x501240,_0x1173cf){return client[_0x8c81('0xc')](_0x3d663e,_0x43d142)[_0x8c81('0xd')](function(_0x15ebff){logger[_0x8c81('0xe')](_0x8c81('0xf'),_0x32cf31,_0x8c81('0x10'));logger['debug'](_0x8c81('0x11'),_0x32cf31,_0x8c81('0x10'),JSON[_0x8c81('0x12')](_0x15ebff));if(_0x15ebff[_0x8c81('0x13')]){if(_0x15ebff['error'][_0x8c81('0x14')]===0x1f4){logger[_0x8c81('0x13')](_0x8c81('0xf'),_0x32cf31,_0x15ebff[_0x8c81('0x13')][_0x8c81('0x15')]);return _0x1173cf(_0x15ebff[_0x8c81('0x13')][_0x8c81('0x15')]);}logger[_0x8c81('0x13')](_0x8c81('0xf'),_0x32cf31,_0x15ebff['error']['message']);return _0x501240(_0x15ebff[_0x8c81('0x13')][_0x8c81('0x15')]);}else{logger[_0x8c81('0xe')](_0x8c81('0xf'),_0x32cf31,_0x8c81('0x10'));_0x501240(_0x15ebff[_0x8c81('0x16')]['message']);}})[_0x8c81('0x17')](function(_0x29ccb0){logger[_0x8c81('0x13')](_0x8c81('0xf'),_0x32cf31,_0x29ccb0);_0x1173cf(_0x29ccb0);});});}exports[_0x8c81('0x18')]=function(_0x5c09f3){var _0x31069a=this;return new Promise(function(_0x4d0b75,_0x492d24){return db['FreshdeskAccount'][_0x8c81('0x19')]({'raw':_0x5c09f3[_0x8c81('0x1a')]?_0x5c09f3[_0x8c81('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x5c09f3[_0x8c81('0x1a')]?_0x5c09f3[_0x8c81('0x1a')][_0x8c81('0x1b')]||null:null,'attributes':_0x5c09f3['options']?_0x5c09f3[_0x8c81('0x1a')][_0x8c81('0x1c')]||null:null,'limit':_0x5c09f3['options']?_0x5c09f3[_0x8c81('0x1a')][_0x8c81('0x1d')]||null:null,'include':_0x5c09f3['options']?_0x5c09f3['options'][_0x8c81('0x1e')]?_[_0x8c81('0x1f')](_0x5c09f3[_0x8c81('0x1a')]['include'],function(_0x8c399c){return{'model':db[_0x8c399c[_0x8c81('0x20')]],'as':_0x8c399c['as'],'attributes':_0x8c399c[_0x8c81('0x1c')],'include':_0x8c399c[_0x8c81('0x1e')]?_[_0x8c81('0x1f')](_0x8c399c[_0x8c81('0x1e')],function(_0x2fcf75){return{'model':db[_0x2fcf75[_0x8c81('0x20')]],'as':_0x2fcf75['as'],'attributes':_0x2fcf75['attributes'],'include':_0x2fcf75['include']?_[_0x8c81('0x1f')](_0x2fcf75[_0x8c81('0x1e')],function(_0x2b9df6){return{'model':db[_0x2b9df6[_0x8c81('0x20')]],'as':_0x2b9df6['as'],'attributes':_0x2b9df6[_0x8c81('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8c81('0xd')](function(_0x2e7ba2){logger[_0x8c81('0xe')](_0x8c81('0x18'),_0x5c09f3);logger[_0x8c81('0x21')](_0x8c81('0x18'),_0x5c09f3,JSON[_0x8c81('0x12')](_0x2e7ba2));_0x4d0b75(_0x2e7ba2);})[_0x8c81('0x17')](function(_0x59c7e8){logger[_0x8c81('0x13')](_0x8c81('0x18'),_0x59c7e8[_0x8c81('0x15')],_0x5c09f3);_0x492d24(_0x31069a[_0x8c81('0x13')](0x1f4,_0x59c7e8[_0x8c81('0x15')]));});});};exports[_0x8c81('0x22')]=function(_0xdf2029){var _0x2266fd=this;return new Promise(function(_0x2f419f,_0x54ca62){return db[_0x8c81('0x23')][_0x8c81('0x24')]({'raw':_0xdf2029[_0x8c81('0x1a')]?_0xdf2029[_0x8c81('0x1a')][_0x8c81('0x25')]===undefined?!![]:![]:!![],'where':_0xdf2029['options']?_0xdf2029[_0x8c81('0x1a')][_0x8c81('0x1b')]||null:null,'attributes':_0xdf2029[_0x8c81('0x1a')]?_0xdf2029[_0x8c81('0x1a')][_0x8c81('0x1c')]||null:null,'include':_0xdf2029['options']?_0xdf2029['options'][_0x8c81('0x1e')]?_[_0x8c81('0x1f')](_0xdf2029[_0x8c81('0x1a')]['include'],function(_0x3c8a5d){return{'model':db[_0x3c8a5d[_0x8c81('0x20')]],'as':_0x3c8a5d['as'],'attributes':_0x3c8a5d[_0x8c81('0x1c')],'include':_0x3c8a5d[_0x8c81('0x1e')]?_['map'](_0x3c8a5d[_0x8c81('0x1e')],function(_0x32dfaa){return{'model':db[_0x32dfaa['model']],'as':_0x32dfaa['as'],'attributes':_0x32dfaa[_0x8c81('0x1c')],'include':_0x32dfaa['include']?_['map'](_0x32dfaa[_0x8c81('0x1e')],function(_0x3f8dde){return{'model':db[_0x3f8dde[_0x8c81('0x20')]],'as':_0x3f8dde['as'],'attributes':_0x3f8dde[_0x8c81('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x30fa19){logger[_0x8c81('0xe')](_0x8c81('0x22'),_0xdf2029);logger['debug']('ShowFreshdeskAccount',_0xdf2029,JSON[_0x8c81('0x12')](_0x30fa19));_0x2f419f(_0x30fa19);})[_0x8c81('0x17')](function(_0x4373ce){logger['error'](_0x8c81('0x22'),_0x4373ce['message'],_0xdf2029);_0x54ca62(_0x2266fd['error'](0x1f4,_0x4373ce['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 78de710..5e87934 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 _0x1aa6=['../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','getTags','post','setTags','put','update','delete','destroy','exports','util','path','express','Router','../../components/interaction/service'];(function(_0x3cd0d5,_0xd3aa57){var _0x18bcf1=function(_0x49f9c7){while(--_0x49f9c7){_0x3cd0d5['push'](_0x3cd0d5['shift']());}};_0x18bcf1(++_0xd3aa57);}(_0x1aa6,0x1f3));var _0x61aa=function(_0x104e21,_0x2ea86f){_0x104e21=_0x104e21-0x0;var _0x605b37=_0x1aa6[_0x104e21];return _0x605b37;};'use strict';var multer=require('multer');var util=require(_0x61aa('0x0'));var path=require(_0x61aa('0x1'));var timeout=require('connect-timeout');var express=require(_0x61aa('0x2'));var router=express[_0x61aa('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x61aa('0x4'));var config=require(_0x61aa('0x5'));var controller=require(_0x61aa('0x6'));router[_0x61aa('0x7')]('/',auth[_0x61aa('0x8')](),controller[_0x61aa('0x9')]);router[_0x61aa('0x7')](_0x61aa('0xa'),auth[_0x61aa('0x8')](),controller['show']);router[_0x61aa('0x7')](_0x61aa('0xb'),auth['isAuthenticated'](),controller[_0x61aa('0xc')]);router[_0x61aa('0x7')](_0x61aa('0xd'),auth['isAuthenticated'](),controller[_0x61aa('0xe')]);router[_0x61aa('0x7')]('/:id/descriptions',auth[_0x61aa('0x8')](),controller[_0x61aa('0xf')]);router['get']('/:id/tags',auth['isAuthenticated'](),controller[_0x61aa('0x10')]);router[_0x61aa('0x11')]('/',auth[_0x61aa('0x8')](),controller['create']);router['post']('/:id/tags',auth['isAuthenticated'](),controller[_0x61aa('0x12')]);router[_0x61aa('0x13')]('/:id',auth[_0x61aa('0x8')](),controller[_0x61aa('0x14')]);router[_0x61aa('0x15')](_0x61aa('0xa'),auth[_0x61aa('0x8')](),controller[_0x61aa('0x16')]);module[_0x61aa('0x17')]=router; \ No newline at end of file +var _0x40a6=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','getFields','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','exports','multer','util','path'];(function(_0x485327,_0x228b0a){var _0x1af72a=function(_0x56ff4f){while(--_0x56ff4f){_0x485327['push'](_0x485327['shift']());}};_0x1af72a(++_0x228b0a);}(_0x40a6,0x18d));var _0x640a=function(_0x1bfc9d,_0x172eda){_0x1bfc9d=_0x1bfc9d-0x0;var _0x1a3994=_0x40a6[_0x1bfc9d];return _0x1a3994;};'use strict';var multer=require(_0x640a('0x0'));var util=require(_0x640a('0x1'));var path=require(_0x640a('0x2'));var timeout=require('connect-timeout');var express=require(_0x640a('0x3'));var router=express[_0x640a('0x4')]();var fs_extra=require(_0x640a('0x5'));var auth=require(_0x640a('0x6'));var interaction=require(_0x640a('0x7'));var config=require('../../config/environment');var controller=require('./intFreshdeskConfiguration.controller');router[_0x640a('0x8')]('/',auth[_0x640a('0x9')](),controller[_0x640a('0xa')]);router['get'](_0x640a('0xb'),auth['isAuthenticated'](),controller[_0x640a('0xc')]);router[_0x640a('0x8')]('/:id/fields',auth[_0x640a('0x9')](),controller[_0x640a('0xd')]);router[_0x640a('0x8')]('/:id/subjects',auth[_0x640a('0x9')](),controller[_0x640a('0xe')]);router[_0x640a('0x8')](_0x640a('0xf'),auth[_0x640a('0x9')](),controller[_0x640a('0x10')]);router[_0x640a('0x8')](_0x640a('0x11'),auth[_0x640a('0x9')](),controller[_0x640a('0x12')]);router[_0x640a('0x13')]('/',auth[_0x640a('0x9')](),controller[_0x640a('0x14')]);router[_0x640a('0x13')](_0x640a('0x11'),auth[_0x640a('0x9')](),controller[_0x640a('0x15')]);router[_0x640a('0x16')](_0x640a('0xb'),auth[_0x640a('0x9')](),controller[_0x640a('0x17')]);router['delete']('/:id',auth[_0x640a('0x9')](),controller['destroy']);module[_0x640a('0x18')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index d86d096..66da238 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 _0x3fb8=['STRING'];(function(_0x38b555,_0x4dfd21){var _0x2a933f=function(_0x416f42){while(--_0x416f42){_0x38b555['push'](_0x38b555['shift']());}};_0x2a933f(++_0x4dfd21);}(_0x3fb8,0xf9));var _0x83fb=function(_0x334201,_0x39f06f){_0x334201=_0x334201-0x0;var _0x134700=_0x3fb8[_0x334201];return _0x134700;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x83fb('0x0')]},'description':{'type':Sequelize[_0x83fb('0x0')]}}; \ No newline at end of file +var _0x65e3=['sequelize','exports','STRING'];(function(_0x539fd7,_0x1b34ea){var _0x116e82=function(_0x3cb6b9){while(--_0x3cb6b9){_0x539fd7['push'](_0x539fd7['shift']());}};_0x116e82(++_0x1b34ea);}(_0x65e3,0x1b0));var _0x365e=function(_0x3d60e4,_0x2a4db3){_0x3d60e4=_0x3d60e4-0x0;var _0x5c927d=_0x65e3[_0x3d60e4];return _0x5c927d;};'use strict';var Sequelize=require(_0x365e('0x0'));module[_0x365e('0x1')]={'name':{'type':Sequelize[_0x365e('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 5933c52..fecd9f9 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 _0x05e1=['status','json','offset','undefined','count','limit','set','apply','reject','save','update','then','end','error','name','send','index','map','FreshdeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','show','params','find','create','body','destroy','FreshdeskField','order','pick','getFields','catch','getSubjects','getDescriptions','findOne','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x4f3f9f,_0x15d9f6){var _0x1eef50=function(_0x4eec5b){while(--_0x4eec5b){_0x4f3f9f['push'](_0x4f3f9f['shift']());}};_0x1eef50(++_0x15d9f6);}(_0x05e1,0x196));var _0x105e=function(_0x84ca8,_0x92c588){_0x84ca8=_0x84ca8-0x0;var _0x430e10=_0x05e1[_0x84ca8];return _0x430e10;};'use strict';var emlformat=require(_0x105e('0x0'));var rimraf=require(_0x105e('0x1'));var zipdir=require(_0x105e('0x2'));var jsonpatch=require(_0x105e('0x3'));var rp=require(_0x105e('0x4'));var moment=require(_0x105e('0x5'));var BPromise=require(_0x105e('0x6'));var Mustache=require(_0x105e('0x7'));var util=require(_0x105e('0x8'));var path=require(_0x105e('0x9'));var sox=require(_0x105e('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x105e('0xb'));var _=require('lodash');var squel=require(_0x105e('0xc'));var crypto=require(_0x105e('0xd'));var jsforce=require(_0x105e('0xe'));var deskjs=require(_0x105e('0xf'));var toCsv=require(_0x105e('0x10'));var querystring=require(_0x105e('0x11'));var Papa=require('papaparse');var Redis=require(_0x105e('0x12'));var authService=require(_0x105e('0x13'));var qs=require(_0x105e('0x14'));var as=require(_0x105e('0x15'));var hardwareService=require(_0x105e('0x16'));var logger=require(_0x105e('0x17'))(_0x105e('0x18'));var utils=require('../../config/utils');var config=require(_0x105e('0x19'));var licenseUtil=require(_0x105e('0x1a'));var db=require(_0x105e('0x1b'))['db'];function respondWithStatusCode(_0x2c867d,_0x5b0483){_0x5b0483=_0x5b0483||0xcc;return function(_0x26998e){if(_0x26998e){return _0x2c867d[_0x105e('0x1c')](_0x5b0483);}return _0x2c867d[_0x105e('0x1d')](_0x5b0483)['end']();};}function respondWithResult(_0x577f53,_0x1347ce){_0x1347ce=_0x1347ce||0xc8;return function(_0x5956b0){if(_0x5956b0){return _0x577f53[_0x105e('0x1d')](_0x1347ce)[_0x105e('0x1e')](_0x5956b0);}};}function respondWithFilteredResult(_0x4b4b58,_0x1eddd6){return function(_0xbb2a96){if(_0xbb2a96){var _0x1c4bfb=typeof _0x1eddd6[_0x105e('0x1f')]===_0x105e('0x20')&&typeof _0x1eddd6['limit']===_0x105e('0x20');var _0x3e043f=_0xbb2a96[_0x105e('0x21')];var _0x5218ed=_0x1c4bfb?0x0:_0x1eddd6[_0x105e('0x1f')];var _0x1b9b29=_0x1c4bfb?_0xbb2a96['count']:_0x1eddd6[_0x105e('0x1f')]+_0x1eddd6[_0x105e('0x22')];var _0x5627cb;if(_0x1b9b29>=_0x3e043f){_0x1b9b29=_0x3e043f;_0x5627cb=0xc8;}else{_0x5627cb=0xce;}_0x4b4b58[_0x105e('0x1d')](_0x5627cb);return _0x4b4b58[_0x105e('0x23')]('Content-Range',_0x5218ed+'-'+_0x1b9b29+'/'+_0x3e043f)[_0x105e('0x1e')](_0xbb2a96);}return null;};}function patchUpdates(_0x21e1c9){return function(_0x25701e){try{jsonpatch[_0x105e('0x24')](_0x25701e,_0x21e1c9,!![]);}catch(_0x4e7ac7){return BPromise[_0x105e('0x25')](_0x4e7ac7);}return _0x25701e[_0x105e('0x26')]();};}function saveUpdates(_0x5021f3,_0x3746df){return function(_0x3b4a15){if(_0x3b4a15){return _0x3b4a15[_0x105e('0x27')](_0x5021f3)[_0x105e('0x28')](function(_0x541ab5){return _0x541ab5;});}return null;};}function removeEntity(_0xab96e7,_0x41c2e8){return function(_0xb79e72){if(_0xb79e72){return _0xb79e72['destroy']()[_0x105e('0x28')](function(){_0xab96e7[_0x105e('0x1d')](0xcc)[_0x105e('0x29')]();});}};}function handleEntityNotFound(_0x5bc278,_0x2917d1){return function(_0x569ea6){if(!_0x569ea6){_0x5bc278[_0x105e('0x1c')](0x194);}return _0x569ea6;};}function handleError(_0x19a70a,_0x2ae6ac){_0x2ae6ac=_0x2ae6ac||0x1f4;return function(_0x4748b9){logger[_0x105e('0x2a')](_0x4748b9['stack']);if(_0x4748b9[_0x105e('0x2b')]){delete _0x4748b9[_0x105e('0x2b')];}_0x19a70a[_0x105e('0x1d')](_0x2ae6ac)[_0x105e('0x2c')](_0x4748b9);};}exports[_0x105e('0x2d')]=function(_0x1135b4,_0x3cc2a0){var _0x2ffd63={},_0x3ac26e={},_0x174532={'count':0x0,'rows':[]};var _0x47de54=_[_0x105e('0x2e')](db[_0x105e('0x2f')][_0x105e('0x30')],function(_0x1368a7){return{'name':_0x1368a7[_0x105e('0x31')],'type':_0x1368a7[_0x105e('0x32')][_0x105e('0x33')]};});_0x3ac26e[_0x105e('0x34')]=_[_0x105e('0x2e')](_0x47de54,'name');_0x3ac26e[_0x105e('0x35')]=_[_0x105e('0x36')](_0x1135b4[_0x105e('0x35')]);_0x3ac26e[_0x105e('0x37')]=_[_0x105e('0x38')](_0x3ac26e[_0x105e('0x34')],_0x3ac26e[_0x105e('0x35')]);_0x2ffd63[_0x105e('0x39')]=_[_0x105e('0x38')](_0x3ac26e['model'],qs[_0x105e('0x3a')](_0x1135b4[_0x105e('0x35')][_0x105e('0x3a')]));_0x2ffd63['attributes']=_0x2ffd63[_0x105e('0x39')][_0x105e('0x3b')]?_0x2ffd63['attributes']:_0x3ac26e[_0x105e('0x34')];if(!_0x1135b4[_0x105e('0x35')][_0x105e('0x3c')](_0x105e('0x3d'))){_0x2ffd63['limit']=qs[_0x105e('0x22')](_0x1135b4[_0x105e('0x35')][_0x105e('0x22')]);_0x2ffd63[_0x105e('0x1f')]=qs[_0x105e('0x1f')](_0x1135b4[_0x105e('0x35')][_0x105e('0x1f')]);}_0x2ffd63['order']=qs[_0x105e('0x3e')](_0x1135b4[_0x105e('0x35')][_0x105e('0x3e')]);_0x2ffd63[_0x105e('0x3f')]=qs[_0x105e('0x37')](_['pick'](_0x1135b4[_0x105e('0x35')],_0x3ac26e[_0x105e('0x37')]),_0x47de54);if(_0x1135b4[_0x105e('0x35')][_0x105e('0x40')]){_0x2ffd63[_0x105e('0x3f')]=_[_0x105e('0x41')](_0x2ffd63['where'],{'$or':_[_0x105e('0x2e')](_0x47de54,function(_0x5b49a0){if(_0x5b49a0[_0x105e('0x32')]!==_0x105e('0x42')){var _0x13dd79={};_0x13dd79[_0x5b49a0[_0x105e('0x2b')]]={'$like':'%'+_0x1135b4[_0x105e('0x35')][_0x105e('0x40')]+'%'};return _0x13dd79;}})});}_0x2ffd63=_[_0x105e('0x41')]({},_0x2ffd63,_0x1135b4[_0x105e('0x43')]);var _0x299f06={'where':_0x2ffd63[_0x105e('0x3f')]};return db[_0x105e('0x2f')][_0x105e('0x21')](_0x299f06)['then'](function(_0xcd4fba){_0x174532[_0x105e('0x21')]=_0xcd4fba;if(_0x1135b4['query'][_0x105e('0x44')]){_0x2ffd63[_0x105e('0x45')]=[{'all':!![]}];}return db['FreshdeskConfiguration']['findAll'](_0x2ffd63);})[_0x105e('0x28')](function(_0x107dc1){_0x174532['rows']=_0x107dc1;return _0x174532;})[_0x105e('0x28')](respondWithFilteredResult(_0x3cc2a0,_0x2ffd63))['catch'](handleError(_0x3cc2a0,null));};exports[_0x105e('0x46')]=function(_0x3690ad,_0x49e502){var _0x5a70cd={'raw':![],'where':{'id':_0x3690ad[_0x105e('0x47')]['id']}},_0x786678={};_0x786678[_0x105e('0x34')]=_[_0x105e('0x36')](db[_0x105e('0x2f')][_0x105e('0x30')]);_0x786678[_0x105e('0x35')]=_[_0x105e('0x36')](_0x3690ad[_0x105e('0x35')]);_0x786678[_0x105e('0x37')]=_['intersection'](_0x786678[_0x105e('0x34')],_0x786678[_0x105e('0x35')]);_0x5a70cd[_0x105e('0x39')]=_[_0x105e('0x38')](_0x786678[_0x105e('0x34')],qs[_0x105e('0x3a')](_0x3690ad['query'][_0x105e('0x3a')]));_0x5a70cd[_0x105e('0x39')]=_0x5a70cd[_0x105e('0x39')][_0x105e('0x3b')]?_0x5a70cd['attributes']:_0x786678[_0x105e('0x34')];if(_0x3690ad[_0x105e('0x35')][_0x105e('0x44')]){_0x5a70cd['include']=[{'all':!![]}];}_0x5a70cd=_[_0x105e('0x41')]({},_0x5a70cd,_0x3690ad['options']);return db[_0x105e('0x2f')][_0x105e('0x48')](_0x5a70cd)[_0x105e('0x28')](handleEntityNotFound(_0x49e502,null))[_0x105e('0x28')](respondWithResult(_0x49e502,null))['catch'](handleError(_0x49e502,null));};exports[_0x105e('0x49')]=function(_0x4901b4,_0x5ae9e8){return db[_0x105e('0x2f')][_0x105e('0x49')](_0x4901b4[_0x105e('0x4a')],{})['then'](respondWithResult(_0x5ae9e8,0xc9))['catch'](handleError(_0x5ae9e8,null));};exports[_0x105e('0x27')]=function(_0xc03aa9,_0x48dd8e){if(_0xc03aa9[_0x105e('0x4a')]['id']){delete _0xc03aa9[_0x105e('0x4a')]['id'];}return db['FreshdeskConfiguration'][_0x105e('0x48')]({'where':{'id':_0xc03aa9[_0x105e('0x47')]['id']}})['then'](handleEntityNotFound(_0x48dd8e,null))[_0x105e('0x28')](saveUpdates(_0xc03aa9[_0x105e('0x4a')],null))['then'](respondWithResult(_0x48dd8e,null))['catch'](handleError(_0x48dd8e,null));};exports[_0x105e('0x4b')]=function(_0x5ec899,_0xfffd7d){return db[_0x105e('0x2f')][_0x105e('0x48')]({'where':{'id':_0x5ec899['params']['id']}})[_0x105e('0x28')](handleEntityNotFound(_0xfffd7d,null))[_0x105e('0x28')](removeEntity(_0xfffd7d,null))['catch'](handleError(_0xfffd7d,null));};exports['getFields']=function(_0x589def,_0x36ddd6,_0x215a6a){var _0xbf373f={};var _0x341b2f={};var _0x1a1a97;var _0x2d4b92;return db[_0x105e('0x2f')]['findOne']({'where':{'id':_0x589def['params']['id']}})[_0x105e('0x28')](handleEntityNotFound(_0x36ddd6,null))[_0x105e('0x28')](function(_0x3cc84f){if(_0x3cc84f){_0x1a1a97=_0x3cc84f;_0x341b2f[_0x105e('0x34')]=_[_0x105e('0x36')](db[_0x105e('0x4c')]['rawAttributes']);_0x341b2f[_0x105e('0x35')]=_[_0x105e('0x36')](_0x589def[_0x105e('0x35')]);_0x341b2f['filters']=_[_0x105e('0x38')](_0x341b2f[_0x105e('0x34')],_0x341b2f[_0x105e('0x35')]);_0xbf373f['attributes']=_['intersection'](_0x341b2f[_0x105e('0x34')],qs['fields'](_0x589def[_0x105e('0x35')][_0x105e('0x3a')]));_0xbf373f[_0x105e('0x39')]=_0xbf373f[_0x105e('0x39')][_0x105e('0x3b')]?_0xbf373f[_0x105e('0x39')]:_0x341b2f[_0x105e('0x34')];_0xbf373f[_0x105e('0x4d')]=qs['sort'](_0x589def[_0x105e('0x35')][_0x105e('0x3e')]);_0xbf373f[_0x105e('0x3f')]=qs[_0x105e('0x37')](_[_0x105e('0x4e')](_0x589def[_0x105e('0x35')],_0x341b2f[_0x105e('0x37')]));if(_0x589def[_0x105e('0x35')][_0x105e('0x40')]){_0xbf373f[_0x105e('0x3f')]=_[_0x105e('0x41')](_0xbf373f['where'],{'$or':_[_0x105e('0x2e')](_0xbf373f['attributes'],function(_0x26a288){var _0xe3d7e3={};_0xe3d7e3[_0x26a288]={'$like':'%'+_0x589def[_0x105e('0x35')]['filter']+'%'};return _0xe3d7e3;})});}_0xbf373f=_[_0x105e('0x41')]({},_0xbf373f,_0x589def[_0x105e('0x43')]);return _0x1a1a97[_0x105e('0x4f')](_0xbf373f);}})[_0x105e('0x28')](function(_0x1472cf){if(_0x1472cf){_0x2d4b92=_0x1472cf['length'];if(!_0x589def['query'][_0x105e('0x3c')](_0x105e('0x3d'))){_0xbf373f[_0x105e('0x22')]=qs[_0x105e('0x22')](_0x589def['query'][_0x105e('0x22')]);_0xbf373f[_0x105e('0x1f')]=qs[_0x105e('0x1f')](_0x589def['query'][_0x105e('0x1f')]);}return _0x1a1a97[_0x105e('0x4f')](_0xbf373f);}})[_0x105e('0x28')](function(_0x276b35){if(_0x276b35){return _0x276b35?{'count':_0x2d4b92,'rows':_0x276b35}:null;}})[_0x105e('0x28')](respondWithResult(_0x36ddd6,null))[_0x105e('0x50')](handleError(_0x36ddd6,null));};exports[_0x105e('0x51')]=function(_0x251227,_0x52c68c,_0x4d843d){var _0x3f643b={};var _0x29bf91={};var _0x4323e9;var _0x1e2935;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x251227[_0x105e('0x47')]['id']}})[_0x105e('0x28')](handleEntityNotFound(_0x52c68c,null))[_0x105e('0x28')](function(_0x55a737){if(_0x55a737){_0x4323e9=_0x55a737;_0x29bf91[_0x105e('0x34')]=_[_0x105e('0x36')](db[_0x105e('0x4c')][_0x105e('0x30')]);_0x29bf91['query']=_['keys'](_0x251227[_0x105e('0x35')]);_0x29bf91[_0x105e('0x37')]=_[_0x105e('0x38')](_0x29bf91['model'],_0x29bf91['query']);_0x3f643b[_0x105e('0x39')]=_[_0x105e('0x38')](_0x29bf91['model'],qs[_0x105e('0x3a')](_0x251227['query']['fields']));_0x3f643b['attributes']=_0x3f643b[_0x105e('0x39')][_0x105e('0x3b')]?_0x3f643b[_0x105e('0x39')]:_0x29bf91[_0x105e('0x34')];_0x3f643b[_0x105e('0x4d')]=qs[_0x105e('0x3e')](_0x251227[_0x105e('0x35')][_0x105e('0x3e')]);_0x3f643b[_0x105e('0x3f')]=qs[_0x105e('0x37')](_['pick'](_0x251227[_0x105e('0x35')],_0x29bf91[_0x105e('0x37')]));if(_0x251227[_0x105e('0x35')]['filter']){_0x3f643b[_0x105e('0x3f')]=_['merge'](_0x3f643b[_0x105e('0x3f')],{'$or':_[_0x105e('0x2e')](_0x3f643b[_0x105e('0x39')],function(_0x257c31){var _0x34aca9={};_0x34aca9[_0x257c31]={'$like':'%'+_0x251227[_0x105e('0x35')][_0x105e('0x40')]+'%'};return _0x34aca9;})});}_0x3f643b=_['merge']({},_0x3f643b,_0x251227['options']);return _0x4323e9['getSubjects'](_0x3f643b);}})[_0x105e('0x28')](function(_0x4e1dd9){if(_0x4e1dd9){_0x1e2935=_0x4e1dd9[_0x105e('0x3b')];if(!_0x251227[_0x105e('0x35')][_0x105e('0x3c')](_0x105e('0x3d'))){_0x3f643b[_0x105e('0x22')]=qs[_0x105e('0x22')](_0x251227[_0x105e('0x35')][_0x105e('0x22')]);_0x3f643b[_0x105e('0x1f')]=qs[_0x105e('0x1f')](_0x251227[_0x105e('0x35')][_0x105e('0x1f')]);}return _0x4323e9[_0x105e('0x51')](_0x3f643b);}})[_0x105e('0x28')](function(_0x236f99){if(_0x236f99){return _0x236f99?{'count':_0x1e2935,'rows':_0x236f99}:null;}})[_0x105e('0x28')](respondWithResult(_0x52c68c,null))['catch'](handleError(_0x52c68c,null));};exports[_0x105e('0x52')]=function(_0xcb3379,_0x3d8675,_0x956026){var _0x18bedf={};var _0x57e86c={};var _0x10ecc3;var _0x437ea5;return db[_0x105e('0x2f')][_0x105e('0x53')]({'where':{'id':_0xcb3379['params']['id']}})[_0x105e('0x28')](handleEntityNotFound(_0x3d8675,null))[_0x105e('0x28')](function(_0x5bb26e){if(_0x5bb26e){_0x10ecc3=_0x5bb26e;_0x57e86c[_0x105e('0x34')]=_['keys'](db[_0x105e('0x4c')][_0x105e('0x30')]);_0x57e86c[_0x105e('0x35')]=_['keys'](_0xcb3379[_0x105e('0x35')]);_0x57e86c['filters']=_[_0x105e('0x38')](_0x57e86c[_0x105e('0x34')],_0x57e86c[_0x105e('0x35')]);_0x18bedf[_0x105e('0x39')]=_[_0x105e('0x38')](_0x57e86c['model'],qs[_0x105e('0x3a')](_0xcb3379[_0x105e('0x35')][_0x105e('0x3a')]));_0x18bedf[_0x105e('0x39')]=_0x18bedf[_0x105e('0x39')][_0x105e('0x3b')]?_0x18bedf[_0x105e('0x39')]:_0x57e86c[_0x105e('0x34')];_0x18bedf[_0x105e('0x4d')]=qs[_0x105e('0x3e')](_0xcb3379[_0x105e('0x35')]['sort']);_0x18bedf[_0x105e('0x3f')]=qs[_0x105e('0x37')](_[_0x105e('0x4e')](_0xcb3379[_0x105e('0x35')],_0x57e86c[_0x105e('0x37')]));if(_0xcb3379[_0x105e('0x35')][_0x105e('0x40')]){_0x18bedf['where']=_[_0x105e('0x41')](_0x18bedf['where'],{'$or':_[_0x105e('0x2e')](_0x18bedf['attributes'],function(_0x41e268){var _0x3d59b2={};_0x3d59b2[_0x41e268]={'$like':'%'+_0xcb3379[_0x105e('0x35')][_0x105e('0x40')]+'%'};return _0x3d59b2;})});}_0x18bedf=_[_0x105e('0x41')]({},_0x18bedf,_0xcb3379[_0x105e('0x43')]);return _0x10ecc3[_0x105e('0x52')](_0x18bedf);}})[_0x105e('0x28')](function(_0x7706d1){if(_0x7706d1){_0x437ea5=_0x7706d1[_0x105e('0x3b')];if(!_0xcb3379[_0x105e('0x35')][_0x105e('0x3c')](_0x105e('0x3d'))){_0x18bedf[_0x105e('0x22')]=qs[_0x105e('0x22')](_0xcb3379[_0x105e('0x35')][_0x105e('0x22')]);_0x18bedf[_0x105e('0x1f')]=qs[_0x105e('0x1f')](_0xcb3379[_0x105e('0x35')][_0x105e('0x1f')]);}return _0x10ecc3[_0x105e('0x52')](_0x18bedf);}})[_0x105e('0x28')](function(_0x49651b){if(_0x49651b){return _0x49651b?{'count':_0x437ea5,'rows':_0x49651b}:null;}})[_0x105e('0x28')](respondWithResult(_0x3d8675,null))[_0x105e('0x50')](handleError(_0x3d8675,null));};exports[_0x105e('0x54')]=function(_0x111e97,_0x5ba430,_0x347179){var _0x4dd11d={};var _0x95449b={};var _0xc83d03;var _0x307526;return db[_0x105e('0x2f')][_0x105e('0x53')]({'where':{'id':_0x111e97[_0x105e('0x47')]['id']}})[_0x105e('0x28')](handleEntityNotFound(_0x5ba430,null))['then'](function(_0x460313){if(_0x460313){_0xc83d03=_0x460313;_0x95449b[_0x105e('0x34')]=_['keys'](db['Tag'][_0x105e('0x30')]);_0x95449b[_0x105e('0x35')]=_[_0x105e('0x36')](_0x111e97['query']);_0x95449b['filters']=_[_0x105e('0x38')](_0x95449b['model'],_0x95449b[_0x105e('0x35')]);_0x4dd11d[_0x105e('0x39')]=_['intersection'](_0x95449b[_0x105e('0x34')],qs['fields'](_0x111e97['query'][_0x105e('0x3a')]));_0x4dd11d[_0x105e('0x39')]=_0x4dd11d[_0x105e('0x39')][_0x105e('0x3b')]?_0x4dd11d[_0x105e('0x39')]:_0x95449b['model'];_0x4dd11d[_0x105e('0x4d')]=qs[_0x105e('0x3e')](_0x111e97[_0x105e('0x35')][_0x105e('0x3e')]);_0x4dd11d['where']=qs[_0x105e('0x37')](_[_0x105e('0x4e')](_0x111e97[_0x105e('0x35')],_0x95449b[_0x105e('0x37')]));if(_0x111e97[_0x105e('0x35')]['filter']){_0x4dd11d[_0x105e('0x3f')]=_[_0x105e('0x41')](_0x4dd11d[_0x105e('0x3f')],{'$or':_[_0x105e('0x2e')](_0x4dd11d[_0x105e('0x39')],function(_0xf797e6){var _0x594aaf={};_0x594aaf[_0xf797e6]={'$like':'%'+_0x111e97['query']['filter']+'%'};return _0x594aaf;})});}_0x4dd11d=_['merge']({},_0x4dd11d,_0x111e97[_0x105e('0x43')]);return _0xc83d03[_0x105e('0x54')](_0x4dd11d);}})[_0x105e('0x28')](function(_0x46eecb){if(_0x46eecb){_0x307526=_0x46eecb[_0x105e('0x3b')];if(!_0x111e97[_0x105e('0x35')]['hasOwnProperty'](_0x105e('0x3d'))){_0x4dd11d[_0x105e('0x22')]=qs[_0x105e('0x22')](_0x111e97['query'][_0x105e('0x22')]);_0x4dd11d['offset']=qs[_0x105e('0x1f')](_0x111e97[_0x105e('0x35')][_0x105e('0x1f')]);}return _0xc83d03[_0x105e('0x54')](_0x4dd11d);}})[_0x105e('0x28')](function(_0x26e087){if(_0x26e087){return _0x26e087?{'count':_0x307526,'rows':_0x26e087}:null;}})[_0x105e('0x28')](respondWithResult(_0x5ba430,null))[_0x105e('0x50')](handleError(_0x5ba430,null));};exports[_0x105e('0x55')]=function(_0x5d7ab6,_0x337da2,_0x19ea63){if(_0x5d7ab6[_0x105e('0x4a')]['id']){delete _0x5d7ab6[_0x105e('0x4a')]['id'];}return db['FreshdeskConfiguration'][_0x105e('0x53')]({'where':{'id':_0x5d7ab6['params']['id']}})[_0x105e('0x28')](handleEntityNotFound(_0x337da2,null))[_0x105e('0x28')](function(_0x1b5c08){if(_0x1b5c08){return _0x1b5c08['setTags'](_0x5d7ab6[_0x105e('0x4a')][_0x105e('0x56')]||[]);}return null;})[_0x105e('0x28')](respondWithResult(_0x337da2,null))[_0x105e('0x50')](handleError(_0x337da2,null));}; \ No newline at end of file +var _0x6dcc=['findOne','FreshdeskField','order','getTags','setTags','ids','eml-format','rimraf','zip-dir','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy','sendStatus','error','name','map','FreshdeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filters','filter','merge','where','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','getFields','getSubjects'];(function(_0x2a868f,_0x49fb1a){var _0x2991ef=function(_0x38d6f5){while(--_0x38d6f5){_0x2a868f['push'](_0x2a868f['shift']());}};_0x2991ef(++_0x49fb1a);}(_0x6dcc,0xf9));var _0xc6dc=function(_0x483ff3,_0x4f8272){_0x483ff3=_0x483ff3-0x0;var _0x502723=_0x6dcc[_0x483ff3];return _0x502723;};'use strict';var emlformat=require(_0xc6dc('0x0'));var rimraf=require(_0xc6dc('0x1'));var zipdir=require(_0xc6dc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc6dc('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xc6dc('0x4'));var util=require(_0xc6dc('0x5'));var path=require('path');var sox=require(_0xc6dc('0x6'));var csv=require(_0xc6dc('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc6dc('0x8'));var squel=require(_0xc6dc('0x9'));var crypto=require(_0xc6dc('0xa'));var jsforce=require(_0xc6dc('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc6dc('0xc'));var Papa=require(_0xc6dc('0xd'));var Redis=require(_0xc6dc('0xe'));var authService=require(_0xc6dc('0xf'));var qs=require(_0xc6dc('0x10'));var as=require(_0xc6dc('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc6dc('0x12'))(_0xc6dc('0x13'));var utils=require(_0xc6dc('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xc6dc('0x15'));var db=require(_0xc6dc('0x16'))['db'];function respondWithStatusCode(_0xce6ab5,_0x33cb38){_0x33cb38=_0x33cb38||0xcc;return function(_0x1cb1c2){if(_0x1cb1c2){return _0xce6ab5['sendStatus'](_0x33cb38);}return _0xce6ab5[_0xc6dc('0x17')](_0x33cb38)[_0xc6dc('0x18')]();};}function respondWithResult(_0x4a8c5c,_0x3c218b){_0x3c218b=_0x3c218b||0xc8;return function(_0x4322ec){if(_0x4322ec){return _0x4a8c5c[_0xc6dc('0x17')](_0x3c218b)['json'](_0x4322ec);}};}function respondWithFilteredResult(_0x1d8459,_0x4cff5c){return function(_0x1f77ce){if(_0x1f77ce){var _0x5eb41f=typeof _0x4cff5c[_0xc6dc('0x19')]===_0xc6dc('0x1a')&&typeof _0x4cff5c[_0xc6dc('0x1b')]===_0xc6dc('0x1a');var _0x4f3e01=_0x1f77ce[_0xc6dc('0x1c')];var _0xf916ea=_0x5eb41f?0x0:_0x4cff5c[_0xc6dc('0x19')];var _0x51d262=_0x5eb41f?_0x1f77ce[_0xc6dc('0x1c')]:_0x4cff5c['offset']+_0x4cff5c[_0xc6dc('0x1b')];var _0x5c3951;if(_0x51d262>=_0x4f3e01){_0x51d262=_0x4f3e01;_0x5c3951=0xc8;}else{_0x5c3951=0xce;}_0x1d8459[_0xc6dc('0x17')](_0x5c3951);return _0x1d8459[_0xc6dc('0x1d')](_0xc6dc('0x1e'),_0xf916ea+'-'+_0x51d262+'/'+_0x4f3e01)[_0xc6dc('0x1f')](_0x1f77ce);}return null;};}function patchUpdates(_0x134cc8){return function(_0x169377){try{jsonpatch['apply'](_0x169377,_0x134cc8,!![]);}catch(_0x5af645){return BPromise[_0xc6dc('0x20')](_0x5af645);}return _0x169377[_0xc6dc('0x21')]();};}function saveUpdates(_0x253f95,_0x28933b){return function(_0x216564){if(_0x216564){return _0x216564[_0xc6dc('0x22')](_0x253f95)[_0xc6dc('0x23')](function(_0x36ef9c){return _0x36ef9c;});}return null;};}function removeEntity(_0x22f725,_0x14733a){return function(_0x2ec2cb){if(_0x2ec2cb){return _0x2ec2cb[_0xc6dc('0x24')]()[_0xc6dc('0x23')](function(){_0x22f725[_0xc6dc('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x32fe18,_0x69354b){return function(_0x471f3){if(!_0x471f3){_0x32fe18[_0xc6dc('0x25')](0x194);}return _0x471f3;};}function handleError(_0x539243,_0x26c85c){_0x26c85c=_0x26c85c||0x1f4;return function(_0x433988){logger[_0xc6dc('0x26')](_0x433988['stack']);if(_0x433988[_0xc6dc('0x27')]){delete _0x433988[_0xc6dc('0x27')];}_0x539243[_0xc6dc('0x17')](_0x26c85c)['send'](_0x433988);};}exports['index']=function(_0x5a825d,_0x4f0399){var _0x2c46a3={},_0x3b5293={},_0x39b1f4={'count':0x0,'rows':[]};var _0x5ba666=_[_0xc6dc('0x28')](db[_0xc6dc('0x29')][_0xc6dc('0x2a')],function(_0x466b8a){return{'name':_0x466b8a[_0xc6dc('0x2b')],'type':_0x466b8a[_0xc6dc('0x2c')][_0xc6dc('0x2d')]};});_0x3b5293[_0xc6dc('0x2e')]=_[_0xc6dc('0x28')](_0x5ba666,_0xc6dc('0x27'));_0x3b5293[_0xc6dc('0x2f')]=_[_0xc6dc('0x30')](_0x5a825d[_0xc6dc('0x2f')]);_0x3b5293['filters']=_[_0xc6dc('0x31')](_0x3b5293[_0xc6dc('0x2e')],_0x3b5293[_0xc6dc('0x2f')]);_0x2c46a3[_0xc6dc('0x32')]=_['intersection'](_0x3b5293[_0xc6dc('0x2e')],qs['fields'](_0x5a825d['query'][_0xc6dc('0x33')]));_0x2c46a3[_0xc6dc('0x32')]=_0x2c46a3[_0xc6dc('0x32')][_0xc6dc('0x34')]?_0x2c46a3[_0xc6dc('0x32')]:_0x3b5293[_0xc6dc('0x2e')];if(!_0x5a825d[_0xc6dc('0x2f')][_0xc6dc('0x35')](_0xc6dc('0x36'))){_0x2c46a3[_0xc6dc('0x1b')]=qs['limit'](_0x5a825d[_0xc6dc('0x2f')][_0xc6dc('0x1b')]);_0x2c46a3[_0xc6dc('0x19')]=qs['offset'](_0x5a825d[_0xc6dc('0x2f')][_0xc6dc('0x19')]);}_0x2c46a3['order']=qs[_0xc6dc('0x37')](_0x5a825d[_0xc6dc('0x2f')][_0xc6dc('0x37')]);_0x2c46a3['where']=qs['filters'](_[_0xc6dc('0x38')](_0x5a825d['query'],_0x3b5293[_0xc6dc('0x39')]),_0x5ba666);if(_0x5a825d['query'][_0xc6dc('0x3a')]){_0x2c46a3['where']=_[_0xc6dc('0x3b')](_0x2c46a3[_0xc6dc('0x3c')],{'$or':_['map'](_0x5ba666,function(_0x5c5da6){if(_0x5c5da6[_0xc6dc('0x2c')]!==_0xc6dc('0x3d')){var _0x6ee938={};_0x6ee938[_0x5c5da6[_0xc6dc('0x27')]]={'$like':'%'+_0x5a825d['query']['filter']+'%'};return _0x6ee938;}})});}_0x2c46a3=_[_0xc6dc('0x3b')]({},_0x2c46a3,_0x5a825d[_0xc6dc('0x3e')]);var _0x356d8a={'where':_0x2c46a3['where']};return db[_0xc6dc('0x29')][_0xc6dc('0x1c')](_0x356d8a)[_0xc6dc('0x23')](function(_0x482dc9){_0x39b1f4[_0xc6dc('0x1c')]=_0x482dc9;if(_0x5a825d[_0xc6dc('0x2f')]['includeAll']){_0x2c46a3[_0xc6dc('0x3f')]=[{'all':!![]}];}return db[_0xc6dc('0x29')][_0xc6dc('0x40')](_0x2c46a3);})[_0xc6dc('0x23')](function(_0x1de69c){_0x39b1f4[_0xc6dc('0x41')]=_0x1de69c;return _0x39b1f4;})['then'](respondWithFilteredResult(_0x4f0399,_0x2c46a3))[_0xc6dc('0x42')](handleError(_0x4f0399,null));};exports[_0xc6dc('0x43')]=function(_0x82a2cb,_0x24f3df){var _0x28020b={'raw':![],'where':{'id':_0x82a2cb[_0xc6dc('0x44')]['id']}},_0xaae51f={};_0xaae51f[_0xc6dc('0x2e')]=_[_0xc6dc('0x30')](db[_0xc6dc('0x29')]['rawAttributes']);_0xaae51f[_0xc6dc('0x2f')]=_['keys'](_0x82a2cb[_0xc6dc('0x2f')]);_0xaae51f[_0xc6dc('0x39')]=_['intersection'](_0xaae51f[_0xc6dc('0x2e')],_0xaae51f[_0xc6dc('0x2f')]);_0x28020b[_0xc6dc('0x32')]=_[_0xc6dc('0x31')](_0xaae51f[_0xc6dc('0x2e')],qs['fields'](_0x82a2cb[_0xc6dc('0x2f')][_0xc6dc('0x33')]));_0x28020b[_0xc6dc('0x32')]=_0x28020b['attributes'][_0xc6dc('0x34')]?_0x28020b[_0xc6dc('0x32')]:_0xaae51f[_0xc6dc('0x2e')];if(_0x82a2cb['query'][_0xc6dc('0x45')]){_0x28020b[_0xc6dc('0x3f')]=[{'all':!![]}];}_0x28020b=_[_0xc6dc('0x3b')]({},_0x28020b,_0x82a2cb[_0xc6dc('0x3e')]);return db['FreshdeskConfiguration'][_0xc6dc('0x46')](_0x28020b)['then'](handleEntityNotFound(_0x24f3df,null))[_0xc6dc('0x23')](respondWithResult(_0x24f3df,null))[_0xc6dc('0x42')](handleError(_0x24f3df,null));};exports[_0xc6dc('0x47')]=function(_0x6b26eb,_0x5b71f1){return db['FreshdeskConfiguration']['create'](_0x6b26eb['body'],{})[_0xc6dc('0x23')](respondWithResult(_0x5b71f1,0xc9))[_0xc6dc('0x42')](handleError(_0x5b71f1,null));};exports[_0xc6dc('0x22')]=function(_0x12a1a1,_0x2055b7){if(_0x12a1a1[_0xc6dc('0x48')]['id']){delete _0x12a1a1[_0xc6dc('0x48')]['id'];}return db[_0xc6dc('0x29')][_0xc6dc('0x46')]({'where':{'id':_0x12a1a1['params']['id']}})[_0xc6dc('0x23')](handleEntityNotFound(_0x2055b7,null))[_0xc6dc('0x23')](saveUpdates(_0x12a1a1[_0xc6dc('0x48')],null))['then'](respondWithResult(_0x2055b7,null))['catch'](handleError(_0x2055b7,null));};exports[_0xc6dc('0x24')]=function(_0x28320b,_0x49b94a){return db[_0xc6dc('0x29')]['find']({'where':{'id':_0x28320b[_0xc6dc('0x44')]['id']}})[_0xc6dc('0x23')](handleEntityNotFound(_0x49b94a,null))[_0xc6dc('0x23')](removeEntity(_0x49b94a,null))[_0xc6dc('0x42')](handleError(_0x49b94a,null));};exports[_0xc6dc('0x49')]=function(_0x1fc075,_0x3d1178,_0x15493b){var _0x39cfac={};var _0x3572b8={};var _0x4e9457;var _0x4215a1;return db[_0xc6dc('0x29')]['findOne']({'where':{'id':_0x1fc075[_0xc6dc('0x44')]['id']}})[_0xc6dc('0x23')](handleEntityNotFound(_0x3d1178,null))[_0xc6dc('0x23')](function(_0x49892d){if(_0x49892d){_0x4e9457=_0x49892d;_0x3572b8[_0xc6dc('0x2e')]=_[_0xc6dc('0x30')](db['FreshdeskField'][_0xc6dc('0x2a')]);_0x3572b8[_0xc6dc('0x2f')]=_[_0xc6dc('0x30')](_0x1fc075[_0xc6dc('0x2f')]);_0x3572b8[_0xc6dc('0x39')]=_['intersection'](_0x3572b8[_0xc6dc('0x2e')],_0x3572b8[_0xc6dc('0x2f')]);_0x39cfac['attributes']=_[_0xc6dc('0x31')](_0x3572b8[_0xc6dc('0x2e')],qs[_0xc6dc('0x33')](_0x1fc075['query']['fields']));_0x39cfac[_0xc6dc('0x32')]=_0x39cfac[_0xc6dc('0x32')][_0xc6dc('0x34')]?_0x39cfac[_0xc6dc('0x32')]:_0x3572b8[_0xc6dc('0x2e')];_0x39cfac['order']=qs['sort'](_0x1fc075[_0xc6dc('0x2f')]['sort']);_0x39cfac[_0xc6dc('0x3c')]=qs['filters'](_['pick'](_0x1fc075[_0xc6dc('0x2f')],_0x3572b8['filters']));if(_0x1fc075[_0xc6dc('0x2f')][_0xc6dc('0x3a')]){_0x39cfac['where']=_['merge'](_0x39cfac[_0xc6dc('0x3c')],{'$or':_[_0xc6dc('0x28')](_0x39cfac[_0xc6dc('0x32')],function(_0x2e4ab5){var _0x320514={};_0x320514[_0x2e4ab5]={'$like':'%'+_0x1fc075[_0xc6dc('0x2f')][_0xc6dc('0x3a')]+'%'};return _0x320514;})});}_0x39cfac=_[_0xc6dc('0x3b')]({},_0x39cfac,_0x1fc075[_0xc6dc('0x3e')]);return _0x4e9457[_0xc6dc('0x49')](_0x39cfac);}})[_0xc6dc('0x23')](function(_0x420379){if(_0x420379){_0x4215a1=_0x420379[_0xc6dc('0x34')];if(!_0x1fc075['query'][_0xc6dc('0x35')](_0xc6dc('0x36'))){_0x39cfac[_0xc6dc('0x1b')]=qs[_0xc6dc('0x1b')](_0x1fc075[_0xc6dc('0x2f')][_0xc6dc('0x1b')]);_0x39cfac[_0xc6dc('0x19')]=qs[_0xc6dc('0x19')](_0x1fc075[_0xc6dc('0x2f')][_0xc6dc('0x19')]);}return _0x4e9457[_0xc6dc('0x49')](_0x39cfac);}})[_0xc6dc('0x23')](function(_0x1b092c){if(_0x1b092c){return _0x1b092c?{'count':_0x4215a1,'rows':_0x1b092c}:null;}})[_0xc6dc('0x23')](respondWithResult(_0x3d1178,null))['catch'](handleError(_0x3d1178,null));};exports[_0xc6dc('0x4a')]=function(_0x49d84f,_0x3f19e2,_0xf40b94){var _0x54af9d={};var _0x91ee1f={};var _0x3784ef;var _0x1b391c;return db[_0xc6dc('0x29')][_0xc6dc('0x4b')]({'where':{'id':_0x49d84f['params']['id']}})[_0xc6dc('0x23')](handleEntityNotFound(_0x3f19e2,null))[_0xc6dc('0x23')](function(_0x1820cd){if(_0x1820cd){_0x3784ef=_0x1820cd;_0x91ee1f[_0xc6dc('0x2e')]=_[_0xc6dc('0x30')](db[_0xc6dc('0x4c')][_0xc6dc('0x2a')]);_0x91ee1f[_0xc6dc('0x2f')]=_[_0xc6dc('0x30')](_0x49d84f[_0xc6dc('0x2f')]);_0x91ee1f[_0xc6dc('0x39')]=_[_0xc6dc('0x31')](_0x91ee1f['model'],_0x91ee1f[_0xc6dc('0x2f')]);_0x54af9d[_0xc6dc('0x32')]=_[_0xc6dc('0x31')](_0x91ee1f[_0xc6dc('0x2e')],qs[_0xc6dc('0x33')](_0x49d84f['query']['fields']));_0x54af9d[_0xc6dc('0x32')]=_0x54af9d[_0xc6dc('0x32')][_0xc6dc('0x34')]?_0x54af9d['attributes']:_0x91ee1f[_0xc6dc('0x2e')];_0x54af9d[_0xc6dc('0x4d')]=qs[_0xc6dc('0x37')](_0x49d84f[_0xc6dc('0x2f')]['sort']);_0x54af9d[_0xc6dc('0x3c')]=qs[_0xc6dc('0x39')](_['pick'](_0x49d84f[_0xc6dc('0x2f')],_0x91ee1f[_0xc6dc('0x39')]));if(_0x49d84f[_0xc6dc('0x2f')][_0xc6dc('0x3a')]){_0x54af9d[_0xc6dc('0x3c')]=_[_0xc6dc('0x3b')](_0x54af9d[_0xc6dc('0x3c')],{'$or':_['map'](_0x54af9d[_0xc6dc('0x32')],function(_0x5d996e){var _0x16c350={};_0x16c350[_0x5d996e]={'$like':'%'+_0x49d84f[_0xc6dc('0x2f')][_0xc6dc('0x3a')]+'%'};return _0x16c350;})});}_0x54af9d=_['merge']({},_0x54af9d,_0x49d84f[_0xc6dc('0x3e')]);return _0x3784ef[_0xc6dc('0x4a')](_0x54af9d);}})['then'](function(_0x1904c4){if(_0x1904c4){_0x1b391c=_0x1904c4['length'];if(!_0x49d84f['query'][_0xc6dc('0x35')]('nolimit')){_0x54af9d[_0xc6dc('0x1b')]=qs[_0xc6dc('0x1b')](_0x49d84f[_0xc6dc('0x2f')][_0xc6dc('0x1b')]);_0x54af9d[_0xc6dc('0x19')]=qs[_0xc6dc('0x19')](_0x49d84f['query'][_0xc6dc('0x19')]);}return _0x3784ef['getSubjects'](_0x54af9d);}})['then'](function(_0x373862){if(_0x373862){return _0x373862?{'count':_0x1b391c,'rows':_0x373862}:null;}})[_0xc6dc('0x23')](respondWithResult(_0x3f19e2,null))[_0xc6dc('0x42')](handleError(_0x3f19e2,null));};exports['getDescriptions']=function(_0x4f7642,_0x252835,_0x2ce078){var _0x220bd6={};var _0x2a6ac6={};var _0x6a71eb;var _0x4616b0;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x4f7642[_0xc6dc('0x44')]['id']}})[_0xc6dc('0x23')](handleEntityNotFound(_0x252835,null))['then'](function(_0x942f5d){if(_0x942f5d){_0x6a71eb=_0x942f5d;_0x2a6ac6[_0xc6dc('0x2e')]=_['keys'](db[_0xc6dc('0x4c')][_0xc6dc('0x2a')]);_0x2a6ac6[_0xc6dc('0x2f')]=_[_0xc6dc('0x30')](_0x4f7642['query']);_0x2a6ac6[_0xc6dc('0x39')]=_['intersection'](_0x2a6ac6[_0xc6dc('0x2e')],_0x2a6ac6['query']);_0x220bd6[_0xc6dc('0x32')]=_['intersection'](_0x2a6ac6['model'],qs[_0xc6dc('0x33')](_0x4f7642[_0xc6dc('0x2f')][_0xc6dc('0x33')]));_0x220bd6[_0xc6dc('0x32')]=_0x220bd6['attributes'][_0xc6dc('0x34')]?_0x220bd6[_0xc6dc('0x32')]:_0x2a6ac6[_0xc6dc('0x2e')];_0x220bd6['order']=qs[_0xc6dc('0x37')](_0x4f7642['query'][_0xc6dc('0x37')]);_0x220bd6[_0xc6dc('0x3c')]=qs[_0xc6dc('0x39')](_['pick'](_0x4f7642[_0xc6dc('0x2f')],_0x2a6ac6['filters']));if(_0x4f7642[_0xc6dc('0x2f')][_0xc6dc('0x3a')]){_0x220bd6[_0xc6dc('0x3c')]=_[_0xc6dc('0x3b')](_0x220bd6[_0xc6dc('0x3c')],{'$or':_[_0xc6dc('0x28')](_0x220bd6['attributes'],function(_0x3210a8){var _0x16428d={};_0x16428d[_0x3210a8]={'$like':'%'+_0x4f7642['query'][_0xc6dc('0x3a')]+'%'};return _0x16428d;})});}_0x220bd6=_[_0xc6dc('0x3b')]({},_0x220bd6,_0x4f7642['options']);return _0x6a71eb['getDescriptions'](_0x220bd6);}})['then'](function(_0x32e322){if(_0x32e322){_0x4616b0=_0x32e322[_0xc6dc('0x34')];if(!_0x4f7642[_0xc6dc('0x2f')][_0xc6dc('0x35')](_0xc6dc('0x36'))){_0x220bd6[_0xc6dc('0x1b')]=qs['limit'](_0x4f7642['query']['limit']);_0x220bd6[_0xc6dc('0x19')]=qs['offset'](_0x4f7642['query'][_0xc6dc('0x19')]);}return _0x6a71eb['getDescriptions'](_0x220bd6);}})[_0xc6dc('0x23')](function(_0xe45f11){if(_0xe45f11){return _0xe45f11?{'count':_0x4616b0,'rows':_0xe45f11}:null;}})[_0xc6dc('0x23')](respondWithResult(_0x252835,null))[_0xc6dc('0x42')](handleError(_0x252835,null));};exports[_0xc6dc('0x4e')]=function(_0x16b642,_0x1919ca,_0x16c8b2){var _0x27e4d6={};var _0xcbe9f6={};var _0x1e4420;var _0x2c7a66;return db[_0xc6dc('0x29')][_0xc6dc('0x4b')]({'where':{'id':_0x16b642[_0xc6dc('0x44')]['id']}})['then'](handleEntityNotFound(_0x1919ca,null))[_0xc6dc('0x23')](function(_0x3ba5a9){if(_0x3ba5a9){_0x1e4420=_0x3ba5a9;_0xcbe9f6[_0xc6dc('0x2e')]=_[_0xc6dc('0x30')](db['Tag'][_0xc6dc('0x2a')]);_0xcbe9f6[_0xc6dc('0x2f')]=_[_0xc6dc('0x30')](_0x16b642[_0xc6dc('0x2f')]);_0xcbe9f6['filters']=_[_0xc6dc('0x31')](_0xcbe9f6[_0xc6dc('0x2e')],_0xcbe9f6['query']);_0x27e4d6[_0xc6dc('0x32')]=_[_0xc6dc('0x31')](_0xcbe9f6['model'],qs[_0xc6dc('0x33')](_0x16b642['query'][_0xc6dc('0x33')]));_0x27e4d6[_0xc6dc('0x32')]=_0x27e4d6[_0xc6dc('0x32')][_0xc6dc('0x34')]?_0x27e4d6[_0xc6dc('0x32')]:_0xcbe9f6[_0xc6dc('0x2e')];_0x27e4d6[_0xc6dc('0x4d')]=qs['sort'](_0x16b642['query']['sort']);_0x27e4d6[_0xc6dc('0x3c')]=qs[_0xc6dc('0x39')](_[_0xc6dc('0x38')](_0x16b642[_0xc6dc('0x2f')],_0xcbe9f6[_0xc6dc('0x39')]));if(_0x16b642['query']['filter']){_0x27e4d6[_0xc6dc('0x3c')]=_[_0xc6dc('0x3b')](_0x27e4d6[_0xc6dc('0x3c')],{'$or':_[_0xc6dc('0x28')](_0x27e4d6[_0xc6dc('0x32')],function(_0x18bc4d){var _0x274afb={};_0x274afb[_0x18bc4d]={'$like':'%'+_0x16b642[_0xc6dc('0x2f')]['filter']+'%'};return _0x274afb;})});}_0x27e4d6=_[_0xc6dc('0x3b')]({},_0x27e4d6,_0x16b642[_0xc6dc('0x3e')]);return _0x1e4420[_0xc6dc('0x4e')](_0x27e4d6);}})[_0xc6dc('0x23')](function(_0x336e36){if(_0x336e36){_0x2c7a66=_0x336e36[_0xc6dc('0x34')];if(!_0x16b642[_0xc6dc('0x2f')]['hasOwnProperty'](_0xc6dc('0x36'))){_0x27e4d6['limit']=qs[_0xc6dc('0x1b')](_0x16b642['query']['limit']);_0x27e4d6[_0xc6dc('0x19')]=qs[_0xc6dc('0x19')](_0x16b642['query'][_0xc6dc('0x19')]);}return _0x1e4420[_0xc6dc('0x4e')](_0x27e4d6);}})[_0xc6dc('0x23')](function(_0x12e2f4){if(_0x12e2f4){return _0x12e2f4?{'count':_0x2c7a66,'rows':_0x12e2f4}:null;}})[_0xc6dc('0x23')](respondWithResult(_0x1919ca,null))[_0xc6dc('0x42')](handleError(_0x1919ca,null));};exports[_0xc6dc('0x4f')]=function(_0xaa3433,_0x2bb7d9,_0x861e2f){if(_0xaa3433[_0xc6dc('0x48')]['id']){delete _0xaa3433[_0xc6dc('0x48')]['id'];}return db[_0xc6dc('0x29')][_0xc6dc('0x4b')]({'where':{'id':_0xaa3433[_0xc6dc('0x44')]['id']}})[_0xc6dc('0x23')](handleEntityNotFound(_0x2bb7d9,null))['then'](function(_0x5346ef){if(_0x5346ef){return _0x5346ef[_0xc6dc('0x4f')](_0xaa3433[_0xc6dc('0x48')][_0xc6dc('0x50')]||[]);}return null;})[_0xc6dc('0x23')](respondWithResult(_0x2bb7d9,null))[_0xc6dc('0x42')](handleError(_0x2bb7d9,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 79ae261..3cfbdbe 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 _0xbd05=['api','moment','request-promise','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbd05,0x169));var _0x5bd0=function(_0x71b765,_0x3053f8){_0x71b765=_0x71b765-0x0;var _0x34cb24=_0xbd05[_0x71b765];return _0x34cb24;};'use strict';var _=require(_0x5bd0('0x0'));var util=require('util');var logger=require(_0x5bd0('0x1'))(_0x5bd0('0x2'));var moment=require(_0x5bd0('0x3'));var BPromise=require('bluebird');var rp=require(_0x5bd0('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5bd0('0x5'));var config=require(_0x5bd0('0x6'));var attributes=require(_0x5bd0('0x7'));module['exports']=function(_0x4db1de,_0x303f91){return _0x4db1de[_0x5bd0('0x8')](_0x5bd0('0x9'),attributes,{'tableName':_0x5bd0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x81bc=['FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','api','bluebird','path','rimraf','../../config/environment','exports','define'];(function(_0x150f83,_0x4a9796){var _0x2bfb48=function(_0x375670){while(--_0x375670){_0x150f83['push'](_0x150f83['shift']());}};_0x2bfb48(++_0x4a9796);}(_0x81bc,0x1af));var _0xc81b=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x81bc[_0x2c7618];return _0x5ce3f0;};'use strict';var _=require(_0xc81b('0x0'));var util=require(_0xc81b('0x1'));var logger=require('../../config/logger')(_0xc81b('0x2'));var moment=require('moment');var BPromise=require(_0xc81b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc81b('0x4'));var rimraf=require(_0xc81b('0x5'));var config=require(_0xc81b('0x6'));var attributes=require('./intFreshdeskConfiguration.attributes');module[_0xc81b('0x7')]=function(_0x100ad3,_0x4749d8){return _0x100ad3[_0xc81b('0x8')](_0xc81b('0x9'),attributes,{'tableName':_0xc81b('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 a3d2c5e..79a50db 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 _0xe562=['request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','info','FreshdeskConfiguration,\x20%s,\x20%s'];(function(_0x18afca,_0x4219d9){var _0x11603f=function(_0x21d5d1){while(--_0x21d5d1){_0x18afca['push'](_0x18afca['shift']());}};_0x11603f(++_0x4219d9);}(_0xe562,0xf9));var _0x2e56=function(_0x1991ef,_0x54d37a){_0x1991ef=_0x1991ef-0x0;var _0x4662d0=_0xe562[_0x1991ef];return _0x4662d0;};'use strict';var _=require(_0x2e56('0x0'));var util=require(_0x2e56('0x1'));var moment=require(_0x2e56('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2e56('0x3'));var db=require(_0x2e56('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2e56('0x5'))(_0x2e56('0x6'));var config=require('../../config/environment');var jayson=require(_0x2e56('0x7'));var client=jayson['client'][_0x2e56('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x41879e,_0x11bd81,_0x59e024){return new BPromise(function(_0xc7b3b9,_0x8cf6cf){return client['request'](_0x41879e,_0x59e024)['then'](function(_0x4c80cd){logger[_0x2e56('0x9')](_0x2e56('0xa'),_0x11bd81,_0x2e56('0xb'));logger[_0x2e56('0xc')](_0x2e56('0xd'),_0x11bd81,_0x2e56('0xb'),JSON[_0x2e56('0xe')](_0x4c80cd));if(_0x4c80cd[_0x2e56('0xf')]){if(_0x4c80cd[_0x2e56('0xf')][_0x2e56('0x10')]===0x1f4){logger[_0x2e56('0xf')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x11bd81,_0x4c80cd[_0x2e56('0xf')][_0x2e56('0x11')]);return _0x8cf6cf(_0x4c80cd[_0x2e56('0xf')][_0x2e56('0x11')]);}logger['error'](_0x2e56('0xa'),_0x11bd81,_0x4c80cd[_0x2e56('0xf')][_0x2e56('0x11')]);return _0xc7b3b9(_0x4c80cd[_0x2e56('0xf')][_0x2e56('0x11')]);}else{logger['info'](_0x2e56('0xa'),_0x11bd81,_0x2e56('0xb'));_0xc7b3b9(_0x4c80cd[_0x2e56('0x12')][_0x2e56('0x11')]);}})[_0x2e56('0x13')](function(_0x273cb6){logger[_0x2e56('0xf')](_0x2e56('0xa'),_0x11bd81,_0x273cb6);_0x8cf6cf(_0x273cb6);});});} \ No newline at end of file +var _0xfe7d=['jayson/promise','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment'];(function(_0x4dc7b9,_0x319d5a){var _0x3ab114=function(_0x51a9df){while(--_0x51a9df){_0x4dc7b9['push'](_0x4dc7b9['shift']());}};_0x3ab114(++_0x319d5a);}(_0xfe7d,0x66));var _0xdfe7=function(_0x8afdd0,_0x548ad1){_0x8afdd0=_0x8afdd0-0x0;var _0x3de7ac=_0xfe7d[_0x8afdd0];return _0x3de7ac;};'use strict';var _=require('lodash');var util=require(_0xdfe7('0x0'));var moment=require(_0xdfe7('0x1'));var BPromise=require(_0xdfe7('0x2'));var rs=require(_0xdfe7('0x3'));var fs=require('fs');var Redis=require(_0xdfe7('0x4'));var db=require(_0xdfe7('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdfe7('0x6'));var config=require(_0xdfe7('0x7'));var jayson=require(_0xdfe7('0x8'));var client=jayson['client'][_0xdfe7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5ab2cd,_0x273107,_0x1a1b2d){return new BPromise(function(_0x491bf2,_0x48260e){return client[_0xdfe7('0xa')](_0x5ab2cd,_0x1a1b2d)[_0xdfe7('0xb')](function(_0xafeb6b){logger[_0xdfe7('0xc')](_0xdfe7('0xd'),_0x273107,_0xdfe7('0xe'));logger['debug'](_0xdfe7('0xf'),_0x273107,'request\x20sent',JSON[_0xdfe7('0x10')](_0xafeb6b));if(_0xafeb6b[_0xdfe7('0x11')]){if(_0xafeb6b[_0xdfe7('0x11')][_0xdfe7('0x12')]===0x1f4){logger[_0xdfe7('0x11')](_0xdfe7('0xd'),_0x273107,_0xafeb6b['error'][_0xdfe7('0x13')]);return _0x48260e(_0xafeb6b[_0xdfe7('0x11')][_0xdfe7('0x13')]);}logger[_0xdfe7('0x11')](_0xdfe7('0xd'),_0x273107,_0xafeb6b[_0xdfe7('0x11')][_0xdfe7('0x13')]);return _0x491bf2(_0xafeb6b['error'][_0xdfe7('0x13')]);}else{logger[_0xdfe7('0xc')](_0xdfe7('0xd'),_0x273107,'request\x20sent');_0x491bf2(_0xafeb6b[_0xdfe7('0x14')]['message']);}})[_0xdfe7('0x15')](function(_0x40805f){logger[_0xdfe7('0x11')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x273107,_0x40805f);_0x48260e(_0x40805f);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 4aa3607..6c4cf1d 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 _0xc74f=['delete','destroy','multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','create','put','/:id','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc74f,0xb6));var _0xfc74=function(_0x6c7687,_0xa2355e){_0x6c7687=_0x6c7687-0x0;var _0x22edc0=_0xc74f[_0x6c7687];return _0x22edc0;};'use strict';var multer=require(_0xfc74('0x0'));var util=require('util');var path=require(_0xfc74('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xfc74('0x2')]();var fs_extra=require(_0xfc74('0x3'));var auth=require(_0xfc74('0x4'));var interaction=require(_0xfc74('0x5'));var config=require('../../config/environment');var controller=require('./intFreshdeskField.controller');router[_0xfc74('0x6')]('/',auth[_0xfc74('0x7')](),controller[_0xfc74('0x8')]);router[_0xfc74('0x6')]('/:id',auth[_0xfc74('0x7')](),controller['show']);router['post']('/',auth[_0xfc74('0x7')](),controller[_0xfc74('0x9')]);router[_0xfc74('0xa')](_0xfc74('0xb'),auth[_0xfc74('0x7')](),controller[_0xfc74('0xc')]);router[_0xfc74('0xd')](_0xfc74('0xb'),auth['isAuthenticated'](),controller[_0xfc74('0xe')]);module['exports']=router; \ No newline at end of file +var _0xaeca=['../../config/environment','./intFreshdeskField.controller','get','index','/:id','isAuthenticated','show','post','create','put','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x1ff6d1,_0x52f903){var _0x1554cd=function(_0x233f9d){while(--_0x233f9d){_0x1ff6d1['push'](_0x1ff6d1['shift']());}};_0x1554cd(++_0x52f903);}(_0xaeca,0xfc));var _0xaaec=function(_0x258d6e,_0x54387b){_0x258d6e=_0x258d6e-0x0;var _0x1654f2=_0xaeca[_0x258d6e];return _0x1654f2;};'use strict';var multer=require(_0xaaec('0x0'));var util=require(_0xaaec('0x1'));var path=require(_0xaaec('0x2'));var timeout=require(_0xaaec('0x3'));var express=require(_0xaaec('0x4'));var router=express[_0xaaec('0x5')]();var fs_extra=require(_0xaaec('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xaaec('0x7'));var config=require(_0xaaec('0x8'));var controller=require(_0xaaec('0x9'));router[_0xaaec('0xa')]('/',auth['isAuthenticated'](),controller[_0xaaec('0xb')]);router[_0xaaec('0xa')](_0xaaec('0xc'),auth[_0xaaec('0xd')](),controller[_0xaaec('0xe')]);router[_0xaaec('0xf')]('/',auth[_0xaaec('0xd')](),controller[_0xaaec('0x10')]);router[_0xaaec('0x11')](_0xaaec('0xc'),auth[_0xaaec('0xd')](),controller['update']);router[_0xaaec('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xaaec('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 7158347..cb278a0 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 _0x715e=['customVariable','keyValue','picklist','STRING','BOOLEAN','exports','ENUM','string','variable'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x715e,0xe6));var _0xe715=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x715e[_0x13b02f];return _0x12e9a6;};'use strict';var Sequelize=require('sequelize');module[_0xe715('0x0')]={'type':{'type':Sequelize[_0xe715('0x1')](_0xe715('0x2'),_0xe715('0x3'),_0xe715('0x4'),_0xe715('0x5'),_0xe715('0x6')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xe715('0x7')]},'keyType':{'type':Sequelize[_0xe715('0x1')](_0xe715('0x2'),_0xe715('0x3'),_0xe715('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xe715('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe715('0x7')]}}; \ No newline at end of file +var _0x874c=['exports','string','variable','customVariable','keyValue','STRING','ENUM','BOOLEAN','sequelize'];(function(_0x3908c5,_0x42c467){var _0x3f0aa9=function(_0x58c714){while(--_0x58c714){_0x3908c5['push'](_0x3908c5['shift']());}};_0x3f0aa9(++_0x42c467);}(_0x874c,0xaa));var _0xc874=function(_0xc7e2be,_0xee14bf){_0xc7e2be=_0xc7e2be-0x0;var _0x5d6289=_0x874c[_0xc7e2be];return _0x5d6289;};'use strict';var Sequelize=require(_0xc874('0x0'));module[_0xc874('0x1')]={'type':{'type':Sequelize['ENUM'](_0xc874('0x2'),_0xc874('0x3'),_0xc874('0x4'),_0xc874('0x5'),'picklist'),'defaultValue':_0xc874('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xc874('0x6')]},'keyType':{'type':Sequelize[_0xc874('0x7')]('string',_0xc874('0x3'),_0xc874('0x4'))},'keyContent':{'type':Sequelize[_0xc874('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xc874('0x6')]},'customField':{'type':Sequelize[_0xc874('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc874('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index e6bcb33..c79ea41 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 _0xe706=['merge','VIRTUAL','options','includeAll','rows','catch','include','find','body','params','destroy','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','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','apply','save','update','then','end','name','send','index','map','FreshdeskField','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter'];(function(_0x368a41,_0x1017f7){var _0x2e7825=function(_0x4db58b){while(--_0x4db58b){_0x368a41['push'](_0x368a41['shift']());}};_0x2e7825(++_0x1017f7);}(_0xe706,0xa3));var _0x6e70=function(_0x5f1431,_0x49bea0){_0x5f1431=_0x5f1431-0x0;var _0x165500=_0xe706[_0x5f1431];return _0x165500;};'use strict';var emlformat=require(_0x6e70('0x0'));var rimraf=require(_0x6e70('0x1'));var zipdir=require(_0x6e70('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6e70('0x3'));var moment=require(_0x6e70('0x4'));var BPromise=require(_0x6e70('0x5'));var Mustache=require(_0x6e70('0x6'));var util=require(_0x6e70('0x7'));var path=require(_0x6e70('0x8'));var sox=require(_0x6e70('0x9'));var csv=require(_0x6e70('0xa'));var ejs=require(_0x6e70('0xb'));var fs=require('fs');var fs_extra=require(_0x6e70('0xc'));var _=require(_0x6e70('0xd'));var squel=require(_0x6e70('0xe'));var crypto=require(_0x6e70('0xf'));var jsforce=require(_0x6e70('0x10'));var deskjs=require(_0x6e70('0x11'));var toCsv=require(_0x6e70('0xa'));var querystring=require(_0x6e70('0x12'));var Papa=require(_0x6e70('0x13'));var Redis=require(_0x6e70('0x14'));var authService=require(_0x6e70('0x15'));var qs=require(_0x6e70('0x16'));var as=require(_0x6e70('0x17'));var hardwareService=require(_0x6e70('0x18'));var logger=require(_0x6e70('0x19'))('api');var utils=require('../../config/utils');var config=require(_0x6e70('0x1a'));var licenseUtil=require(_0x6e70('0x1b'));var db=require(_0x6e70('0x1c'))['db'];function respondWithStatusCode(_0x27dd9b,_0x3b38f3){_0x3b38f3=_0x3b38f3||0xcc;return function(_0x310eb7){if(_0x310eb7){return _0x27dd9b[_0x6e70('0x1d')](_0x3b38f3);}return _0x27dd9b[_0x6e70('0x1e')](_0x3b38f3)['end']();};}function respondWithResult(_0x52737e,_0x48bc72){_0x48bc72=_0x48bc72||0xc8;return function(_0x257e81){if(_0x257e81){return _0x52737e['status'](_0x48bc72)['json'](_0x257e81);}};}function respondWithFilteredResult(_0x304716,_0x22c50c){return function(_0x5d9263){if(_0x5d9263){var _0x24f3ac=typeof _0x22c50c['offset']===_0x6e70('0x1f')&&typeof _0x22c50c[_0x6e70('0x20')]==='undefined';var _0x49029f=_0x5d9263[_0x6e70('0x21')];var _0x5ea7a5=_0x24f3ac?0x0:_0x22c50c[_0x6e70('0x22')];var _0x173afe=_0x24f3ac?_0x5d9263['count']:_0x22c50c['offset']+_0x22c50c[_0x6e70('0x20')];var _0x208e21;if(_0x173afe>=_0x49029f){_0x173afe=_0x49029f;_0x208e21=0xc8;}else{_0x208e21=0xce;}_0x304716[_0x6e70('0x1e')](_0x208e21);return _0x304716[_0x6e70('0x23')](_0x6e70('0x24'),_0x5ea7a5+'-'+_0x173afe+'/'+_0x49029f)[_0x6e70('0x25')](_0x5d9263);}return null;};}function patchUpdates(_0x1b2453){return function(_0x44a49f){try{jsonpatch[_0x6e70('0x26')](_0x44a49f,_0x1b2453,!![]);}catch(_0xb29a2a){return BPromise['reject'](_0xb29a2a);}return _0x44a49f[_0x6e70('0x27')]();};}function saveUpdates(_0x344b65,_0x27b294){return function(_0x502b2d){if(_0x502b2d){return _0x502b2d[_0x6e70('0x28')](_0x344b65)[_0x6e70('0x29')](function(_0x3337a6){return _0x3337a6;});}return null;};}function removeEntity(_0x50da2c,_0x10fc91){return function(_0x538b9c){if(_0x538b9c){return _0x538b9c['destroy']()['then'](function(){_0x50da2c[_0x6e70('0x1e')](0xcc)[_0x6e70('0x2a')]();});}};}function handleEntityNotFound(_0x51d292,_0x3ecdf1){return function(_0x1196ed){if(!_0x1196ed){_0x51d292['sendStatus'](0x194);}return _0x1196ed;};}function handleError(_0x338ad6,_0x67fb43){_0x67fb43=_0x67fb43||0x1f4;return function(_0x2bb231){logger['error'](_0x2bb231['stack']);if(_0x2bb231[_0x6e70('0x2b')]){delete _0x2bb231[_0x6e70('0x2b')];}_0x338ad6[_0x6e70('0x1e')](_0x67fb43)[_0x6e70('0x2c')](_0x2bb231);};}exports[_0x6e70('0x2d')]=function(_0x5d772a,_0x1952ea){var _0x406f29={},_0xecf336={},_0x2864a0={'count':0x0,'rows':[]};var _0x396a67=_[_0x6e70('0x2e')](db[_0x6e70('0x2f')][_0x6e70('0x30')],function(_0x3a0821){return{'name':_0x3a0821[_0x6e70('0x31')],'type':_0x3a0821['type'][_0x6e70('0x32')]};});_0xecf336['model']=_[_0x6e70('0x2e')](_0x396a67,'name');_0xecf336[_0x6e70('0x33')]=_[_0x6e70('0x34')](_0x5d772a[_0x6e70('0x33')]);_0xecf336['filters']=_[_0x6e70('0x35')](_0xecf336[_0x6e70('0x36')],_0xecf336['query']);_0x406f29[_0x6e70('0x37')]=_[_0x6e70('0x35')](_0xecf336['model'],qs[_0x6e70('0x38')](_0x5d772a[_0x6e70('0x33')][_0x6e70('0x38')]));_0x406f29[_0x6e70('0x37')]=_0x406f29[_0x6e70('0x37')][_0x6e70('0x39')]?_0x406f29[_0x6e70('0x37')]:_0xecf336[_0x6e70('0x36')];if(!_0x5d772a[_0x6e70('0x33')][_0x6e70('0x3a')]('nolimit')){_0x406f29[_0x6e70('0x20')]=qs['limit'](_0x5d772a[_0x6e70('0x33')][_0x6e70('0x20')]);_0x406f29[_0x6e70('0x22')]=qs[_0x6e70('0x22')](_0x5d772a[_0x6e70('0x33')][_0x6e70('0x22')]);}_0x406f29[_0x6e70('0x3b')]=qs[_0x6e70('0x3c')](_0x5d772a[_0x6e70('0x33')][_0x6e70('0x3c')]);_0x406f29[_0x6e70('0x3d')]=qs[_0x6e70('0x3e')](_[_0x6e70('0x3f')](_0x5d772a['query'],_0xecf336['filters']),_0x396a67);if(_0x5d772a['query'][_0x6e70('0x40')]){_0x406f29[_0x6e70('0x3d')]=_[_0x6e70('0x41')](_0x406f29[_0x6e70('0x3d')],{'$or':_[_0x6e70('0x2e')](_0x396a67,function(_0x3bdd87){if(_0x3bdd87['type']!==_0x6e70('0x42')){var _0x9e7ad2={};_0x9e7ad2[_0x3bdd87[_0x6e70('0x2b')]]={'$like':'%'+_0x5d772a[_0x6e70('0x33')][_0x6e70('0x40')]+'%'};return _0x9e7ad2;}})});}_0x406f29=_[_0x6e70('0x41')]({},_0x406f29,_0x5d772a[_0x6e70('0x43')]);var _0x16fc7d={'where':_0x406f29['where']};return db[_0x6e70('0x2f')][_0x6e70('0x21')](_0x16fc7d)[_0x6e70('0x29')](function(_0x31cad2){_0x2864a0[_0x6e70('0x21')]=_0x31cad2;if(_0x5d772a[_0x6e70('0x33')][_0x6e70('0x44')]){_0x406f29['include']=[{'all':!![]}];}return db['FreshdeskField']['findAll'](_0x406f29);})[_0x6e70('0x29')](function(_0x2b63cc){_0x2864a0[_0x6e70('0x45')]=_0x2b63cc;return _0x2864a0;})[_0x6e70('0x29')](respondWithFilteredResult(_0x1952ea,_0x406f29))[_0x6e70('0x46')](handleError(_0x1952ea,null));};exports['show']=function(_0x225d44,_0x2a58d7){var _0x2a2aca={'raw':!![],'where':{'id':_0x225d44['params']['id']}},_0x52b197={};_0x52b197['model']=_[_0x6e70('0x34')](db['FreshdeskField'][_0x6e70('0x30')]);_0x52b197[_0x6e70('0x33')]=_[_0x6e70('0x34')](_0x225d44[_0x6e70('0x33')]);_0x52b197['filters']=_[_0x6e70('0x35')](_0x52b197['model'],_0x52b197[_0x6e70('0x33')]);_0x2a2aca[_0x6e70('0x37')]=_[_0x6e70('0x35')](_0x52b197[_0x6e70('0x36')],qs['fields'](_0x225d44[_0x6e70('0x33')][_0x6e70('0x38')]));_0x2a2aca[_0x6e70('0x37')]=_0x2a2aca[_0x6e70('0x37')][_0x6e70('0x39')]?_0x2a2aca[_0x6e70('0x37')]:_0x52b197[_0x6e70('0x36')];if(_0x225d44['query'][_0x6e70('0x44')]){_0x2a2aca[_0x6e70('0x47')]=[{'all':!![]}];}_0x2a2aca=_[_0x6e70('0x41')]({},_0x2a2aca,_0x225d44[_0x6e70('0x43')]);return db[_0x6e70('0x2f')][_0x6e70('0x48')](_0x2a2aca)[_0x6e70('0x29')](handleEntityNotFound(_0x2a58d7,null))['then'](respondWithResult(_0x2a58d7,null))[_0x6e70('0x46')](handleError(_0x2a58d7,null));};exports['create']=function(_0x11794e,_0x3836e4){return db['FreshdeskField']['create'](_0x11794e[_0x6e70('0x49')],{})[_0x6e70('0x29')](respondWithResult(_0x3836e4,0xc9))[_0x6e70('0x46')](handleError(_0x3836e4,null));};exports['update']=function(_0x4af9b1,_0x238ebb){if(_0x4af9b1[_0x6e70('0x49')]['id']){delete _0x4af9b1[_0x6e70('0x49')]['id'];}return db[_0x6e70('0x2f')][_0x6e70('0x48')]({'where':{'id':_0x4af9b1[_0x6e70('0x4a')]['id']}})['then'](handleEntityNotFound(_0x238ebb,null))[_0x6e70('0x29')](saveUpdates(_0x4af9b1[_0x6e70('0x49')],null))[_0x6e70('0x29')](respondWithResult(_0x238ebb,null))[_0x6e70('0x46')](handleError(_0x238ebb,null));};exports[_0x6e70('0x4b')]=function(_0x4b354e,_0x4ae901){return db[_0x6e70('0x2f')][_0x6e70('0x48')]({'where':{'id':_0x4b354e[_0x6e70('0x4a')]['id']}})[_0x6e70('0x29')](handleEntityNotFound(_0x4ae901,null))[_0x6e70('0x29')](removeEntity(_0x4ae901,null))['catch'](handleError(_0x4ae901,null));}; \ No newline at end of file +var _0x54f3=['show','params','keys','includeAll','find','create','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','Content-Range','json','apply','save','update','then','stack','name','send','map','FreshdeskField','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','include','findAll','rows','catch'];(function(_0x2b3ff1,_0x1024a8){var _0x18cd66=function(_0x512586){while(--_0x512586){_0x2b3ff1['push'](_0x2b3ff1['shift']());}};_0x18cd66(++_0x1024a8);}(_0x54f3,0x120));var _0x354f=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x54f3[_0x4a9fb1];return _0x348672;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x354f('0x0'));var zipdir=require(_0x354f('0x1'));var jsonpatch=require(_0x354f('0x2'));var rp=require(_0x354f('0x3'));var moment=require(_0x354f('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x354f('0x5'));var path=require(_0x354f('0x6'));var sox=require(_0x354f('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x354f('0x8'));var _=require('lodash');var squel=require(_0x354f('0x9'));var crypto=require(_0x354f('0xa'));var jsforce=require(_0x354f('0xb'));var deskjs=require(_0x354f('0xc'));var toCsv=require('to-csv');var querystring=require(_0x354f('0xd'));var Papa=require('papaparse');var Redis=require(_0x354f('0xe'));var authService=require(_0x354f('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x354f('0x10'));var logger=require(_0x354f('0x11'))('api');var utils=require(_0x354f('0x12'));var config=require(_0x354f('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x354f('0x14'))['db'];function respondWithStatusCode(_0x824bf4,_0x13d871){_0x13d871=_0x13d871||0xcc;return function(_0x97c0da){if(_0x97c0da){return _0x824bf4[_0x354f('0x15')](_0x13d871);}return _0x824bf4[_0x354f('0x16')](_0x13d871)[_0x354f('0x17')]();};}function respondWithResult(_0x4ff8e7,_0xf2e013){_0xf2e013=_0xf2e013||0xc8;return function(_0x4b811d){if(_0x4b811d){return _0x4ff8e7[_0x354f('0x16')](_0xf2e013)['json'](_0x4b811d);}};}function respondWithFilteredResult(_0x103388,_0x234484){return function(_0x18cf66){if(_0x18cf66){var _0x4cc0e9=typeof _0x234484['offset']===_0x354f('0x18')&&typeof _0x234484[_0x354f('0x19')]===_0x354f('0x18');var _0x2ef866=_0x18cf66[_0x354f('0x1a')];var _0x36402d=_0x4cc0e9?0x0:_0x234484[_0x354f('0x1b')];var _0x598777=_0x4cc0e9?_0x18cf66[_0x354f('0x1a')]:_0x234484[_0x354f('0x1b')]+_0x234484[_0x354f('0x19')];var _0x4b87dd;if(_0x598777>=_0x2ef866){_0x598777=_0x2ef866;_0x4b87dd=0xc8;}else{_0x4b87dd=0xce;}_0x103388[_0x354f('0x16')](_0x4b87dd);return _0x103388['set'](_0x354f('0x1c'),_0x36402d+'-'+_0x598777+'/'+_0x2ef866)[_0x354f('0x1d')](_0x18cf66);}return null;};}function patchUpdates(_0x5e930c){return function(_0x14c4be){try{jsonpatch[_0x354f('0x1e')](_0x14c4be,_0x5e930c,!![]);}catch(_0x4ef4f1){return BPromise['reject'](_0x4ef4f1);}return _0x14c4be[_0x354f('0x1f')]();};}function saveUpdates(_0x574753,_0x52e7cb){return function(_0xa6050f){if(_0xa6050f){return _0xa6050f[_0x354f('0x20')](_0x574753)[_0x354f('0x21')](function(_0x2f4277){return _0x2f4277;});}return null;};}function removeEntity(_0xc0d4ca,_0x158117){return function(_0x273603){if(_0x273603){return _0x273603['destroy']()[_0x354f('0x21')](function(){_0xc0d4ca['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x22594b,_0x4c9b18){return function(_0x4b1820){if(!_0x4b1820){_0x22594b[_0x354f('0x15')](0x194);}return _0x4b1820;};}function handleError(_0x4e2ad6,_0x3f0bfe){_0x3f0bfe=_0x3f0bfe||0x1f4;return function(_0x393622){logger['error'](_0x393622[_0x354f('0x22')]);if(_0x393622[_0x354f('0x23')]){delete _0x393622[_0x354f('0x23')];}_0x4e2ad6['status'](_0x3f0bfe)[_0x354f('0x24')](_0x393622);};}exports['index']=function(_0x227d9b,_0x26373d){var _0x16a376={},_0x2816cf={},_0x596b48={'count':0x0,'rows':[]};var _0x21c121=_[_0x354f('0x25')](db[_0x354f('0x26')][_0x354f('0x27')],function(_0x223464){return{'name':_0x223464['fieldName'],'type':_0x223464['type'][_0x354f('0x28')]};});_0x2816cf[_0x354f('0x29')]=_[_0x354f('0x25')](_0x21c121,_0x354f('0x23'));_0x2816cf['query']=_['keys'](_0x227d9b[_0x354f('0x2a')]);_0x2816cf[_0x354f('0x2b')]=_[_0x354f('0x2c')](_0x2816cf[_0x354f('0x29')],_0x2816cf['query']);_0x16a376[_0x354f('0x2d')]=_[_0x354f('0x2c')](_0x2816cf[_0x354f('0x29')],qs[_0x354f('0x2e')](_0x227d9b['query']['fields']));_0x16a376[_0x354f('0x2d')]=_0x16a376[_0x354f('0x2d')][_0x354f('0x2f')]?_0x16a376[_0x354f('0x2d')]:_0x2816cf[_0x354f('0x29')];if(!_0x227d9b[_0x354f('0x2a')][_0x354f('0x30')](_0x354f('0x31'))){_0x16a376[_0x354f('0x19')]=qs[_0x354f('0x19')](_0x227d9b[_0x354f('0x2a')]['limit']);_0x16a376[_0x354f('0x1b')]=qs['offset'](_0x227d9b[_0x354f('0x2a')][_0x354f('0x1b')]);}_0x16a376[_0x354f('0x32')]=qs[_0x354f('0x33')](_0x227d9b[_0x354f('0x2a')][_0x354f('0x33')]);_0x16a376['where']=qs[_0x354f('0x2b')](_[_0x354f('0x34')](_0x227d9b['query'],_0x2816cf[_0x354f('0x2b')]),_0x21c121);if(_0x227d9b[_0x354f('0x2a')][_0x354f('0x35')]){_0x16a376['where']=_[_0x354f('0x36')](_0x16a376[_0x354f('0x37')],{'$or':_[_0x354f('0x25')](_0x21c121,function(_0x389f82){if(_0x389f82['type']!==_0x354f('0x38')){var _0x4db9a4={};_0x4db9a4[_0x389f82[_0x354f('0x23')]]={'$like':'%'+_0x227d9b[_0x354f('0x2a')][_0x354f('0x35')]+'%'};return _0x4db9a4;}})});}_0x16a376=_[_0x354f('0x36')]({},_0x16a376,_0x227d9b[_0x354f('0x39')]);var _0x589c69={'where':_0x16a376['where']};return db[_0x354f('0x26')][_0x354f('0x1a')](_0x589c69)[_0x354f('0x21')](function(_0x327fb2){_0x596b48[_0x354f('0x1a')]=_0x327fb2;if(_0x227d9b[_0x354f('0x2a')]['includeAll']){_0x16a376[_0x354f('0x3a')]=[{'all':!![]}];}return db[_0x354f('0x26')][_0x354f('0x3b')](_0x16a376);})[_0x354f('0x21')](function(_0x512592){_0x596b48[_0x354f('0x3c')]=_0x512592;return _0x596b48;})[_0x354f('0x21')](respondWithFilteredResult(_0x26373d,_0x16a376))[_0x354f('0x3d')](handleError(_0x26373d,null));};exports[_0x354f('0x3e')]=function(_0x1da53d,_0x344666){var _0x5f33b2={'raw':!![],'where':{'id':_0x1da53d[_0x354f('0x3f')]['id']}},_0x66b4cc={};_0x66b4cc[_0x354f('0x29')]=_['keys'](db['FreshdeskField'][_0x354f('0x27')]);_0x66b4cc[_0x354f('0x2a')]=_[_0x354f('0x40')](_0x1da53d[_0x354f('0x2a')]);_0x66b4cc[_0x354f('0x2b')]=_[_0x354f('0x2c')](_0x66b4cc[_0x354f('0x29')],_0x66b4cc[_0x354f('0x2a')]);_0x5f33b2['attributes']=_[_0x354f('0x2c')](_0x66b4cc[_0x354f('0x29')],qs[_0x354f('0x2e')](_0x1da53d[_0x354f('0x2a')][_0x354f('0x2e')]));_0x5f33b2[_0x354f('0x2d')]=_0x5f33b2[_0x354f('0x2d')][_0x354f('0x2f')]?_0x5f33b2[_0x354f('0x2d')]:_0x66b4cc['model'];if(_0x1da53d[_0x354f('0x2a')][_0x354f('0x41')]){_0x5f33b2['include']=[{'all':!![]}];}_0x5f33b2=_['merge']({},_0x5f33b2,_0x1da53d[_0x354f('0x39')]);return db[_0x354f('0x26')][_0x354f('0x42')](_0x5f33b2)[_0x354f('0x21')](handleEntityNotFound(_0x344666,null))[_0x354f('0x21')](respondWithResult(_0x344666,null))[_0x354f('0x3d')](handleError(_0x344666,null));};exports['create']=function(_0x558332,_0x178313){return db[_0x354f('0x26')][_0x354f('0x43')](_0x558332[_0x354f('0x44')],{})[_0x354f('0x21')](respondWithResult(_0x178313,0xc9))[_0x354f('0x3d')](handleError(_0x178313,null));};exports['update']=function(_0x55f2c9,_0x6b7a2c){if(_0x55f2c9['body']['id']){delete _0x55f2c9[_0x354f('0x44')]['id'];}return db[_0x354f('0x26')][_0x354f('0x42')]({'where':{'id':_0x55f2c9['params']['id']}})['then'](handleEntityNotFound(_0x6b7a2c,null))[_0x354f('0x21')](saveUpdates(_0x55f2c9[_0x354f('0x44')],null))['then'](respondWithResult(_0x6b7a2c,null))[_0x354f('0x3d')](handleError(_0x6b7a2c,null));};exports[_0x354f('0x45')]=function(_0xf71a4f,_0x2dd012){return db[_0x354f('0x26')][_0x354f('0x42')]({'where':{'id':_0xf71a4f[_0x354f('0x3f')]['id']}})['then'](handleEntityNotFound(_0x2dd012,null))[_0x354f('0x21')](removeEntity(_0x2dd012,null))[_0x354f('0x3d')](handleError(_0x2dd012,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 1b2f551..330c56f 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 _0x9dbc=['lodash','util','api','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','FieldId'];(function(_0x5758d3,_0x4e3d2f){var _0x2f1012=function(_0x143f98){while(--_0x143f98){_0x5758d3['push'](_0x5758d3['shift']());}};_0x2f1012(++_0x4e3d2f);}(_0x9dbc,0x15e));var _0xc9db=function(_0x466885,_0x256fd9){_0x466885=_0x466885-0x0;var _0x3a58e0=_0x9dbc[_0x466885];return _0x3a58e0;};'use strict';var _=require(_0xc9db('0x0'));var util=require(_0xc9db('0x1'));var logger=require('../../config/logger')(_0xc9db('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc9db('0x3'));var fs=require('fs');var path=require(_0xc9db('0x4'));var rimraf=require(_0xc9db('0x5'));var config=require(_0xc9db('0x6'));var attributes=require(_0xc9db('0x7'));module[_0xc9db('0x8')]=function(_0x29087b,_0x5ac03e){return _0x29087b[_0xc9db('0x9')](_0xc9db('0xa'),attributes,{'tableName':_0xc9db('0xb'),'paranoid':![],'indexes':[{'name':_0xc9db('0xc'),'fields':['idField',_0xc9db('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x81f8=['FreshdeskField','int_freshdesk_fields','FieldId','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports'];(function(_0x5717f9,_0x4dbe8e){var _0x48c89e=function(_0x52b313){while(--_0x52b313){_0x5717f9['push'](_0x5717f9['shift']());}};_0x48c89e(++_0x4dbe8e);}(_0x81f8,0x17d));var _0x881f=function(_0x211486,_0x268764){_0x211486=_0x211486-0x0;var _0xd0d227=_0x81f8[_0x211486];return _0xd0d227;};'use strict';var _=require(_0x881f('0x0'));var util=require(_0x881f('0x1'));var logger=require('../../config/logger')(_0x881f('0x2'));var moment=require(_0x881f('0x3'));var BPromise=require(_0x881f('0x4'));var rp=require(_0x881f('0x5'));var fs=require('fs');var path=require(_0x881f('0x6'));var rimraf=require(_0x881f('0x7'));var config=require(_0x881f('0x8'));var attributes=require(_0x881f('0x9'));module[_0x881f('0xa')]=function(_0x1fc793,_0x427e31){return _0x1fc793['define'](_0x881f('0xb'),attributes,{'tableName':_0x881f('0xc'),'paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':['idField',_0x881f('0xd')],'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 81f1e5f..9b671bc 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 _0x7d06=['FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','info'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x7d06,0x158));var _0x67d0=function(_0x4387e8,_0x48b338){_0x4387e8=_0x4387e8-0x0;var _0x56cf39=_0x7d06[_0x4387e8];return _0x56cf39;};'use strict';var _=require(_0x67d0('0x0'));var util=require(_0x67d0('0x1'));var moment=require(_0x67d0('0x2'));var BPromise=require(_0x67d0('0x3'));var rs=require(_0x67d0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x67d0('0x5'))['db'];var utils=require(_0x67d0('0x6'));var logger=require(_0x67d0('0x7'))('rpc');var config=require(_0x67d0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x67d0('0x9')][_0x67d0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x367f1d,_0xe4789b,_0x3c9976){return new BPromise(function(_0x481a08,_0x358986){return client['request'](_0x367f1d,_0x3c9976)[_0x67d0('0xb')](function(_0x5916d0){logger[_0x67d0('0xc')](_0x67d0('0xd'),_0xe4789b,_0x67d0('0xe'));logger[_0x67d0('0xf')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0xe4789b,_0x67d0('0xe'),JSON['stringify'](_0x5916d0));if(_0x5916d0['error']){if(_0x5916d0[_0x67d0('0x10')][_0x67d0('0x11')]===0x1f4){logger['error'](_0x67d0('0xd'),_0xe4789b,_0x5916d0[_0x67d0('0x10')]['message']);return _0x358986(_0x5916d0[_0x67d0('0x10')]['message']);}logger[_0x67d0('0x10')](_0x67d0('0xd'),_0xe4789b,_0x5916d0[_0x67d0('0x10')][_0x67d0('0x12')]);return _0x481a08(_0x5916d0[_0x67d0('0x10')][_0x67d0('0x12')]);}else{logger[_0x67d0('0xc')](_0x67d0('0xd'),_0xe4789b,_0x67d0('0xe'));_0x481a08(_0x5916d0[_0x67d0('0x13')]['message']);}})[_0x67d0('0x14')](function(_0xa1b889){logger['error'](_0x67d0('0xd'),_0xe4789b,_0xa1b889);_0x358986(_0xa1b889);});});} \ No newline at end of file +var _0xaa77=['request\x20sent','debug','stringify','error','message','result','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','then','info','FreshdeskField,\x20%s,\x20%s'];(function(_0x5bb1e9,_0x15f025){var _0x262c24=function(_0x553d41){while(--_0x553d41){_0x5bb1e9['push'](_0x5bb1e9['shift']());}};_0x262c24(++_0x15f025);}(_0xaa77,0x1a8));var _0x7aa7=function(_0x18c7a0,_0x464635){_0x18c7a0=_0x18c7a0-0x0;var _0x5b3f8d=_0xaa77[_0x18c7a0];return _0x5b3f8d;};'use strict';var _=require('lodash');var util=require(_0x7aa7('0x0'));var moment=require(_0x7aa7('0x1'));var BPromise=require(_0x7aa7('0x2'));var rs=require(_0x7aa7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7aa7('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7aa7('0x5'))(_0x7aa7('0x6'));var config=require(_0x7aa7('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7aa7('0x8')][_0x7aa7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x47b659,_0x4c5214,_0x401e37){return new BPromise(function(_0x360d96,_0x370048){return client['request'](_0x47b659,_0x401e37)[_0x7aa7('0xa')](function(_0x1af7c1){logger[_0x7aa7('0xb')](_0x7aa7('0xc'),_0x4c5214,_0x7aa7('0xd'));logger[_0x7aa7('0xe')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x4c5214,_0x7aa7('0xd'),JSON[_0x7aa7('0xf')](_0x1af7c1));if(_0x1af7c1[_0x7aa7('0x10')]){if(_0x1af7c1[_0x7aa7('0x10')]['code']===0x1f4){logger['error']('FreshdeskField,\x20%s,\x20%s',_0x4c5214,_0x1af7c1['error']['message']);return _0x370048(_0x1af7c1[_0x7aa7('0x10')][_0x7aa7('0x11')]);}logger[_0x7aa7('0x10')](_0x7aa7('0xc'),_0x4c5214,_0x1af7c1[_0x7aa7('0x10')][_0x7aa7('0x11')]);return _0x360d96(_0x1af7c1['error'][_0x7aa7('0x11')]);}else{logger['info'](_0x7aa7('0xc'),_0x4c5214,'request\x20sent');_0x360d96(_0x1af7c1[_0x7aa7('0x12')]['message']);}})['catch'](function(_0x21bc04){logger['error'](_0x7aa7('0xc'),_0x4c5214,_0x21bc04);_0x370048(_0x21bc04);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index d2d6f15..4e87b44 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 _0x9c00=['create','/:id/configurations','addConfiguration','put','update','delete','destroy','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','/:id','isAuthenticated','show','getConfigurations','/:id/fields','getFields','post'];(function(_0x403c14,_0x313b7c){var _0x281da0=function(_0x5e136f){while(--_0x5e136f){_0x403c14['push'](_0x403c14['shift']());}};_0x281da0(++_0x313b7c);}(_0x9c00,0x1a0));var _0x09c0=function(_0x29632e,_0x40f63f){_0x29632e=_0x29632e-0x0;var _0xda5a7e=_0x9c00[_0x29632e];return _0xda5a7e;};'use strict';var multer=require(_0x09c0('0x0'));var util=require(_0x09c0('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x09c0('0x2'));var router=express[_0x09c0('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x09c0('0x4'));var interaction=require(_0x09c0('0x5'));var config=require(_0x09c0('0x6'));var controller=require(_0x09c0('0x7'));router[_0x09c0('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x09c0('0x8')](_0x09c0('0x9'),auth[_0x09c0('0xa')](),controller[_0x09c0('0xb')]);router[_0x09c0('0x8')]('/:id/configurations',auth[_0x09c0('0xa')](),controller[_0x09c0('0xc')]);router[_0x09c0('0x8')](_0x09c0('0xd'),auth[_0x09c0('0xa')](),controller[_0x09c0('0xe')]);router[_0x09c0('0xf')]('/',auth[_0x09c0('0xa')](),controller[_0x09c0('0x10')]);router[_0x09c0('0xf')](_0x09c0('0x11'),auth[_0x09c0('0xa')](),controller[_0x09c0('0x12')]);router[_0x09c0('0x13')](_0x09c0('0x9'),auth[_0x09c0('0xa')](),controller[_0x09c0('0x14')]);router[_0x09c0('0x15')](_0x09c0('0x9'),auth[_0x09c0('0xa')](),controller[_0x09c0('0x16')]);module[_0x09c0('0x17')]=router; \ No newline at end of file +var _0x69d3=['path','express','Router','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','create','post','addConfiguration','put','update','delete','multer','util'];(function(_0xe51a4a,_0x33ddc5){var _0x132f95=function(_0x16789a){while(--_0x16789a){_0xe51a4a['push'](_0xe51a4a['shift']());}};_0x132f95(++_0x33ddc5);}(_0x69d3,0xda));var _0x369d=function(_0xb2b7f,_0x38e95b){_0xb2b7f=_0xb2b7f-0x0;var _0x2cf453=_0x69d3[_0xb2b7f];return _0x2cf453;};'use strict';var multer=require(_0x369d('0x0'));var util=require(_0x369d('0x1'));var path=require(_0x369d('0x2'));var timeout=require('connect-timeout');var express=require(_0x369d('0x3'));var router=express[_0x369d('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x369d('0x5'));var config=require('../../config/environment');var controller=require('./intFreshsalesAccount.controller');router[_0x369d('0x6')]('/',auth[_0x369d('0x7')](),controller[_0x369d('0x8')]);router[_0x369d('0x6')](_0x369d('0x9'),auth[_0x369d('0x7')](),controller[_0x369d('0xa')]);router[_0x369d('0x6')](_0x369d('0xb'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x369d('0x6')](_0x369d('0xc'),auth[_0x369d('0x7')](),controller[_0x369d('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x369d('0xe')]);router[_0x369d('0xf')](_0x369d('0xb'),auth[_0x369d('0x7')](),controller[_0x369d('0x10')]);router[_0x369d('0x11')]('/:id',auth[_0x369d('0x7')](),controller[_0x369d('0x12')]);router[_0x369d('0x13')](_0x369d('0x9'),auth[_0x369d('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index d7d8cb5..6f61b96 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 _0x896e=['exports','STRING','username','remoteUri','sequelize'];(function(_0x10a467,_0x4f75be){var _0x39bcbb=function(_0x1359ec){while(--_0x1359ec){_0x10a467['push'](_0x10a467['shift']());}};_0x39bcbb(++_0x4f75be);}(_0x896e,0x1e9));var _0xe896=function(_0x305b05,_0x314508){_0x305b05=_0x305b05-0x0;var _0x26476a=_0x896e[_0x305b05];return _0x26476a;};'use strict';var Sequelize=require(_0xe896('0x0'));module[_0xe896('0x1')]={'name':{'type':Sequelize[_0xe896('0x2')]},'description':{'type':Sequelize[_0xe896('0x2')]},'username':{'type':Sequelize[_0xe896('0x2')],'unique':_0xe896('0x3')},'apiKey':{'type':Sequelize[_0xe896('0x2')]},'remoteUri':{'type':Sequelize[_0xe896('0x2')],'unique':_0xe896('0x4')},'serverUrl':{'type':Sequelize[_0xe896('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x33af=['exports','STRING','username','remoteUri'];(function(_0x5ad2c9,_0x8e8eb4){var _0x15305e=function(_0x569a24){while(--_0x569a24){_0x5ad2c9['push'](_0x5ad2c9['shift']());}};_0x15305e(++_0x8e8eb4);}(_0x33af,0xec));var _0xf33a=function(_0x487e2d,_0x1fe8ba){_0x487e2d=_0x487e2d-0x0;var _0xe4457c=_0x33af[_0x487e2d];return _0xe4457c;};'use strict';var Sequelize=require('sequelize');module[_0xf33a('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf33a('0x1')]},'username':{'type':Sequelize[_0xf33a('0x1')],'unique':_0xf33a('0x2')},'apiKey':{'type':Sequelize[_0xf33a('0x1')]},'remoteUri':{'type':Sequelize[_0xf33a('0x1')],'unique':_0xf33a('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 3b66d0a..38feb75 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 _0x35ef=['json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','error','name','send','FreshsalesAccount','rawAttributes','fieldName','type','key','model','map','filters','intersection','query','fields','attributes','length','nolimit','sort','filter','where','merge','VIRTUAL','includeAll','include','rows','catch','show','params','keys','options','find','body','destroy','findOne','FreshsalesConfiguration','pick','hasOwnProperty','addConfiguration','Subjects','getSubjects','channel','create','FreshsalesField','Descriptions','getFields','username','remoteUri','apiKey','slice','substring','GET','format','%s%s','Token\x20token=','users','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x20714a,_0x7de591){var _0x15e877=function(_0x3f9f8d){while(--_0x3f9f8d){_0x20714a['push'](_0x20714a['shift']());}};_0x15e877(++_0x7de591);}(_0x35ef,0x16a));var _0xf35e=function(_0x69d07b,_0x1aa0c5){_0x69d07b=_0x69d07b-0x0;var _0x40b5da=_0x35ef[_0x69d07b];return _0x40b5da;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf35e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf35e('0x1'));var rp=require(_0xf35e('0x2'));var moment=require(_0xf35e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf35e('0x4'));var util=require(_0xf35e('0x5'));var path=require(_0xf35e('0x6'));var sox=require(_0xf35e('0x7'));var csv=require(_0xf35e('0x8'));var ejs=require(_0xf35e('0x9'));var fs=require('fs');var fs_extra=require(_0xf35e('0xa'));var _=require('lodash');var squel=require(_0xf35e('0xb'));var crypto=require(_0xf35e('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xf35e('0xd'));var toCsv=require('to-csv');var querystring=require(_0xf35e('0xe'));var Papa=require(_0xf35e('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf35e('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf35e('0x11'));var logger=require(_0xf35e('0x12'))(_0xf35e('0x13'));var utils=require(_0xf35e('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xf35e('0x15'));var db=require(_0xf35e('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x20752c,_0x2e81c5){_0x2e81c5=_0x2e81c5||0xcc;return function(_0x4e9ca0){if(_0x4e9ca0){return _0x20752c[_0xf35e('0x17')](_0x2e81c5);}return _0x20752c[_0xf35e('0x18')](_0x2e81c5)[_0xf35e('0x19')]();};}function respondWithResult(_0x11ef3a,_0x5391c8){_0x5391c8=_0x5391c8||0xc8;return function(_0x579298){if(_0x579298){return _0x11ef3a[_0xf35e('0x18')](_0x5391c8)[_0xf35e('0x1a')](_0x579298);}};}function respondWithFilteredResult(_0x1ce36c,_0x56b108){return function(_0x43318b){if(_0x43318b){var _0x1ffa72=typeof _0x56b108[_0xf35e('0x1b')]===_0xf35e('0x1c')&&typeof _0x56b108[_0xf35e('0x1d')]===_0xf35e('0x1c');var _0x1cc08a=_0x43318b[_0xf35e('0x1e')];var _0x5b75a0=_0x1ffa72?0x0:_0x56b108['offset'];var _0x5e9dcc=_0x1ffa72?_0x43318b[_0xf35e('0x1e')]:_0x56b108[_0xf35e('0x1b')]+_0x56b108[_0xf35e('0x1d')];var _0x639a06;if(_0x5e9dcc>=_0x1cc08a){_0x5e9dcc=_0x1cc08a;_0x639a06=0xc8;}else{_0x639a06=0xce;}_0x1ce36c[_0xf35e('0x18')](_0x639a06);return _0x1ce36c[_0xf35e('0x1f')](_0xf35e('0x20'),_0x5b75a0+'-'+_0x5e9dcc+'/'+_0x1cc08a)[_0xf35e('0x1a')](_0x43318b);}return null;};}function patchUpdates(_0x2d90a2){return function(_0x1a696d){try{jsonpatch[_0xf35e('0x21')](_0x1a696d,_0x2d90a2,!![]);}catch(_0x38598d){return BPromise[_0xf35e('0x22')](_0x38598d);}return _0x1a696d[_0xf35e('0x23')]();};}function saveUpdates(_0x4cea5e,_0x240b27){return function(_0x1b9523){if(_0x1b9523){return _0x1b9523['update'](_0x4cea5e)[_0xf35e('0x24')](function(_0x84ebcf){return _0x84ebcf;});}return null;};}function removeEntity(_0x1ada30,_0x527a3e){return function(_0x1e920b){if(_0x1e920b){return _0x1e920b['destroy']()[_0xf35e('0x24')](function(){_0x1ada30['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x82f750,_0x200b14){return function(_0x395dae){if(!_0x395dae){_0x82f750[_0xf35e('0x17')](0x194);}return _0x395dae;};}function handleError(_0x2d753d,_0x19c6f7){_0x19c6f7=_0x19c6f7||0x1f4;return function(_0x50d1f3){logger[_0xf35e('0x25')](_0x50d1f3['stack']);if(_0x50d1f3[_0xf35e('0x26')]){delete _0x50d1f3[_0xf35e('0x26')];}_0x2d753d[_0xf35e('0x18')](_0x19c6f7)[_0xf35e('0x27')](_0x50d1f3);};}exports['index']=function(_0xfa20a1,_0x49de90){var _0x2107a5={},_0x1e7707={},_0x561c34={'count':0x0,'rows':[]};var _0x449638=_['map'](db[_0xf35e('0x28')][_0xf35e('0x29')],function(_0x176e20){return{'name':_0x176e20[_0xf35e('0x2a')],'type':_0x176e20[_0xf35e('0x2b')][_0xf35e('0x2c')]};});_0x1e7707[_0xf35e('0x2d')]=_[_0xf35e('0x2e')](_0x449638,_0xf35e('0x26'));_0x1e7707['query']=_['keys'](_0xfa20a1['query']);_0x1e7707[_0xf35e('0x2f')]=_[_0xf35e('0x30')](_0x1e7707[_0xf35e('0x2d')],_0x1e7707[_0xf35e('0x31')]);_0x2107a5['attributes']=_[_0xf35e('0x30')](_0x1e7707['model'],qs[_0xf35e('0x32')](_0xfa20a1[_0xf35e('0x31')]['fields']));_0x2107a5[_0xf35e('0x33')]=_0x2107a5['attributes'][_0xf35e('0x34')]?_0x2107a5[_0xf35e('0x33')]:_0x1e7707[_0xf35e('0x2d')];if(!_0xfa20a1[_0xf35e('0x31')]['hasOwnProperty'](_0xf35e('0x35'))){_0x2107a5[_0xf35e('0x1d')]=qs[_0xf35e('0x1d')](_0xfa20a1['query'][_0xf35e('0x1d')]);_0x2107a5[_0xf35e('0x1b')]=qs[_0xf35e('0x1b')](_0xfa20a1[_0xf35e('0x31')]['offset']);}_0x2107a5['order']=qs[_0xf35e('0x36')](_0xfa20a1[_0xf35e('0x31')]['sort']);_0x2107a5['where']=qs[_0xf35e('0x2f')](_['pick'](_0xfa20a1[_0xf35e('0x31')],_0x1e7707[_0xf35e('0x2f')]),_0x449638);if(_0xfa20a1[_0xf35e('0x31')][_0xf35e('0x37')]){_0x2107a5[_0xf35e('0x38')]=_[_0xf35e('0x39')](_0x2107a5['where'],{'$or':_['map'](_0x449638,function(_0x3a3cbe){if(_0x3a3cbe[_0xf35e('0x2b')]!==_0xf35e('0x3a')){var _0x51bbcd={};_0x51bbcd[_0x3a3cbe[_0xf35e('0x26')]]={'$like':'%'+_0xfa20a1['query'][_0xf35e('0x37')]+'%'};return _0x51bbcd;}})});}_0x2107a5=_[_0xf35e('0x39')]({},_0x2107a5,_0xfa20a1['options']);var _0x3a0f07={'where':_0x2107a5[_0xf35e('0x38')]};return db[_0xf35e('0x28')]['count'](_0x3a0f07)[_0xf35e('0x24')](function(_0x8aa8e9){_0x561c34[_0xf35e('0x1e')]=_0x8aa8e9;if(_0xfa20a1[_0xf35e('0x31')][_0xf35e('0x3b')]){_0x2107a5[_0xf35e('0x3c')]=[{'all':!![]}];}return db[_0xf35e('0x28')]['findAll'](_0x2107a5);})[_0xf35e('0x24')](function(_0x828ea9){_0x561c34[_0xf35e('0x3d')]=_0x828ea9;return _0x561c34;})[_0xf35e('0x24')](respondWithFilteredResult(_0x49de90,_0x2107a5))[_0xf35e('0x3e')](handleError(_0x49de90,null));};exports[_0xf35e('0x3f')]=function(_0x55313b,_0x3d305a){var _0xcf7507={'raw':![],'where':{'id':_0x55313b[_0xf35e('0x40')]['id']}},_0x101beb={};_0x101beb[_0xf35e('0x2d')]=_[_0xf35e('0x41')](db[_0xf35e('0x28')][_0xf35e('0x29')]);_0x101beb[_0xf35e('0x31')]=_[_0xf35e('0x41')](_0x55313b[_0xf35e('0x31')]);_0x101beb[_0xf35e('0x2f')]=_[_0xf35e('0x30')](_0x101beb[_0xf35e('0x2d')],_0x101beb[_0xf35e('0x31')]);_0xcf7507[_0xf35e('0x33')]=_[_0xf35e('0x30')](_0x101beb['model'],qs[_0xf35e('0x32')](_0x55313b[_0xf35e('0x31')][_0xf35e('0x32')]));_0xcf7507[_0xf35e('0x33')]=_0xcf7507[_0xf35e('0x33')][_0xf35e('0x34')]?_0xcf7507[_0xf35e('0x33')]:_0x101beb['model'];if(_0x55313b['query'][_0xf35e('0x3b')]){_0xcf7507[_0xf35e('0x3c')]=[{'all':!![]}];}_0xcf7507=_[_0xf35e('0x39')]({},_0xcf7507,_0x55313b[_0xf35e('0x42')]);return db[_0xf35e('0x28')][_0xf35e('0x43')](_0xcf7507)['then'](handleEntityNotFound(_0x3d305a,null))[_0xf35e('0x24')](respondWithResult(_0x3d305a,null))[_0xf35e('0x3e')](handleError(_0x3d305a,null));};exports['create']=function(_0x1f9587,_0x14ffc5){return db['FreshsalesAccount']['create'](_0x1f9587[_0xf35e('0x44')],{})[_0xf35e('0x24')](respondWithResult(_0x14ffc5,0xc9))[_0xf35e('0x3e')](handleError(_0x14ffc5,null));};exports['update']=function(_0x5acb21,_0x329963){if(_0x5acb21[_0xf35e('0x44')]['id']){delete _0x5acb21['body']['id'];}return db['FreshsalesAccount'][_0xf35e('0x43')]({'where':{'id':_0x5acb21[_0xf35e('0x40')]['id']}})[_0xf35e('0x24')](handleEntityNotFound(_0x329963,null))[_0xf35e('0x24')](saveUpdates(_0x5acb21[_0xf35e('0x44')],null))[_0xf35e('0x24')](respondWithResult(_0x329963,null))[_0xf35e('0x3e')](handleError(_0x329963,null));};exports[_0xf35e('0x45')]=function(_0x2d2aa9,_0x54a51f){return db['FreshsalesAccount'][_0xf35e('0x43')]({'where':{'id':_0x2d2aa9[_0xf35e('0x40')]['id']}})[_0xf35e('0x24')](handleEntityNotFound(_0x54a51f,null))[_0xf35e('0x24')](removeEntity(_0x54a51f,null))[_0xf35e('0x3e')](handleError(_0x54a51f,null));};exports['getConfigurations']=function(_0x30df7a,_0x3a5d0c,_0x4936bf){var _0x90021c={};var _0x55dace={};var _0x20b53e;var _0x1972b1;return db[_0xf35e('0x28')][_0xf35e('0x46')]({'where':{'id':_0x30df7a[_0xf35e('0x40')]['id']}})[_0xf35e('0x24')](handleEntityNotFound(_0x3a5d0c,null))[_0xf35e('0x24')](function(_0x326f40){if(_0x326f40){_0x20b53e=_0x326f40;_0x55dace[_0xf35e('0x2d')]=_['keys'](db[_0xf35e('0x47')]['rawAttributes']);_0x55dace[_0xf35e('0x31')]=_[_0xf35e('0x41')](_0x30df7a[_0xf35e('0x31')]);_0x55dace[_0xf35e('0x2f')]=_['intersection'](_0x55dace['model'],_0x55dace[_0xf35e('0x31')]);_0x90021c[_0xf35e('0x33')]=_[_0xf35e('0x30')](_0x55dace[_0xf35e('0x2d')],qs[_0xf35e('0x32')](_0x30df7a[_0xf35e('0x31')][_0xf35e('0x32')]));_0x90021c['attributes']=_0x90021c[_0xf35e('0x33')][_0xf35e('0x34')]?_0x90021c[_0xf35e('0x33')]:_0x55dace['model'];_0x90021c['order']=qs['sort'](_0x30df7a[_0xf35e('0x31')]['sort']);_0x90021c[_0xf35e('0x38')]=qs['filters'](_[_0xf35e('0x48')](_0x30df7a[_0xf35e('0x31')],_0x55dace['filters']));if(_0x30df7a[_0xf35e('0x31')][_0xf35e('0x37')]){_0x90021c[_0xf35e('0x38')]=_[_0xf35e('0x39')](_0x90021c[_0xf35e('0x38')],{'$or':_[_0xf35e('0x2e')](_0x90021c[_0xf35e('0x33')],function(_0x3b8d93){var _0x160b73={};_0x160b73[_0x3b8d93]={'$like':'%'+_0x30df7a[_0xf35e('0x31')]['filter']+'%'};return _0x160b73;})});}_0x90021c=_[_0xf35e('0x39')]({},_0x90021c,_0x30df7a['options']);return _0x20b53e['getConfigurations'](_0x90021c);}})[_0xf35e('0x24')](function(_0x43d885){if(_0x43d885){_0x1972b1=_0x43d885[_0xf35e('0x34')];if(!_0x30df7a[_0xf35e('0x31')][_0xf35e('0x49')]('nolimit')){_0x90021c[_0xf35e('0x1d')]=qs[_0xf35e('0x1d')](_0x30df7a[_0xf35e('0x31')][_0xf35e('0x1d')]);_0x90021c[_0xf35e('0x1b')]=qs[_0xf35e('0x1b')](_0x30df7a[_0xf35e('0x31')][_0xf35e('0x1b')]);}return _0x20b53e['getConfigurations'](_0x90021c);}})[_0xf35e('0x24')](function(_0x53b94f){if(_0x53b94f){return _0x53b94f?{'count':_0x1972b1,'rows':_0x53b94f}:null;}})[_0xf35e('0x24')](respondWithResult(_0x3a5d0c,null))[_0xf35e('0x3e')](handleError(_0x3a5d0c,null));};exports[_0xf35e('0x4a')]=function(_0x227a8b,_0x5190ab,_0x27ff18){if(_0x227a8b[_0xf35e('0x44')]['id']){delete _0x227a8b['body']['id'];}return db[_0xf35e('0x28')][_0xf35e('0x46')]({'where':{'id':_0x227a8b[_0xf35e('0x40')]['id']}})[_0xf35e('0x24')](handleEntityNotFound(_0x5190ab,null))[_0xf35e('0x24')](function(_0x16a305){if(_0x16a305){_0x227a8b['body']['AccountId']=_0x16a305['id'];_0x227a8b[_0xf35e('0x44')][_0xf35e('0x4b')]=integrations[_0xf35e('0x4c')](_0x227a8b['body'][_0xf35e('0x4d')],_0x227a8b[_0xf35e('0x44')][_0xf35e('0x2b')]);_0x227a8b['body']['Descriptions']=integrations['getDescriptions'](_0x227a8b['body'][_0xf35e('0x4d')],_0x227a8b[_0xf35e('0x44')]['type']);return db['FreshsalesConfiguration'][_0xf35e('0x4e')](_0x227a8b[_0xf35e('0x44')],{'include':[{'model':db['FreshsalesField'],'as':_0xf35e('0x4b')},{'model':db[_0xf35e('0x4f')],'as':_0xf35e('0x50')}]});}return null;})['then'](respondWithResult(_0x5190ab,null))[_0xf35e('0x3e')](handleError(_0x5190ab,null));};exports[_0xf35e('0x51')]=function(_0x41f973,_0xe7fc4a,_0x328065){var _0x54fc2b='';var _0x49f88a='';return db[_0xf35e('0x28')][_0xf35e('0x46')]({'where':{'id':_0x41f973[_0xf35e('0x40')]['id']},'attributes':['id',_0xf35e('0x52'),_0xf35e('0x53'),_0xf35e('0x54')]})[_0xf35e('0x24')](handleEntityNotFound(_0xe7fc4a,null))[_0xf35e('0x24')](function(_0x18c689){if(_0x18c689){_0x49f88a=_0x18c689['username'];_0x54fc2b=_0x18c689[_0xf35e('0x53')];var _0x4325f4=_0x18c689[_0xf35e('0x53')][_0xf35e('0x55')](-0x1);if(_0x4325f4==='/'){_0x54fc2b=_0x54fc2b[_0xf35e('0x56')](0x0,_0x54fc2b['lastIndexOf'](_0x4325f4));}return rp({'method':_0xf35e('0x57'),'uri':util[_0xf35e('0x58')](_0xf35e('0x59'),_0x54fc2b,'/api/selector/owners'),'headers':{'Authorization':_0xf35e('0x5a')+_0x18c689['apiKey']},'json':!![]});}})[_0xf35e('0x24')](function(_0x3231ec){if(_0x3231ec){var _0x3efec9=_0x3231ec[_0xf35e('0x5b')];var _0x1bab93=![];var _0x2b8328=null;for(_0x2b8328=0x0;_0x2b8328<_0x3efec9['length'];_0x2b8328++){if(_0x3efec9[_0x2b8328]['email']===_0x49f88a){_0x1bab93=!![];}}if(_0x1bab93){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xf35e('0x5c')});}}})[_0xf35e('0x24')](respondWithResult(_0xe7fc4a,null))[_0xf35e('0x3e')](function(_0x225c4c){var _0x5c7fe7=_0x41f973[_0xf35e('0x31')][_0xf35e('0x5d')]?0x1f4:_0x225c4c[_0xf35e('0x5e')]||0x1f4;logger[_0xf35e('0x25')](_0xf35e('0x5f'),'getFields',_0x5c7fe7,JSON['stringify'](_0x225c4c));delete _0x225c4c[_0xf35e('0x26')];if(_0x5c7fe7===0x191){_0x5c7fe7=0x190;}_0xe7fc4a['status'](_0x5c7fe7)[_0xf35e('0x27')](_0x41f973[_0xf35e('0x31')][_0xf35e('0x5d')]?{'message':_0xf35e('0x60'),'statusCode':_0x225c4c['statusCode']}:_0x225c4c);});}; \ No newline at end of file +var _0x92ba=['/api/selector/owners','Token\x20token=','apiKey','users','email','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','index','FreshsalesAccount','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filters','filter','merge','options','include','findAll','rows','catch','show','includeAll','find','create','body','params','getConfigurations','FreshsalesConfiguration','nolimit','Subjects','getSubjects','channel','Descriptions','FreshsalesField','findOne','username','remoteUri','slice','substring','lastIndexOf','GET','%s%s'];(function(_0x315ce0,_0x28b265){var _0x33a0f0=function(_0x38fa51){while(--_0x38fa51){_0x315ce0['push'](_0x315ce0['shift']());}};_0x33a0f0(++_0x28b265);}(_0x92ba,0x71));var _0xa92b=function(_0x56b0a0,_0x3852fe){_0x56b0a0=_0x56b0a0-0x0;var _0x47f934=_0x92ba[_0x56b0a0];return _0x47f934;};'use strict';var emlformat=require(_0xa92b('0x0'));var rimraf=require(_0xa92b('0x1'));var zipdir=require(_0xa92b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa92b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa92b('0x4'));var util=require(_0xa92b('0x5'));var path=require(_0xa92b('0x6'));var sox=require('sox');var csv=require(_0xa92b('0x7'));var ejs=require(_0xa92b('0x8'));var fs=require('fs');var fs_extra=require(_0xa92b('0x9'));var _=require(_0xa92b('0xa'));var squel=require(_0xa92b('0xb'));var crypto=require(_0xa92b('0xc'));var jsforce=require(_0xa92b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xa92b('0x7'));var querystring=require(_0xa92b('0xe'));var Papa=require(_0xa92b('0xf'));var Redis=require(_0xa92b('0x10'));var authService=require(_0xa92b('0x11'));var qs=require(_0xa92b('0x12'));var as=require(_0xa92b('0x13'));var hardwareService=require(_0xa92b('0x14'));var logger=require(_0xa92b('0x15'))(_0xa92b('0x16'));var utils=require(_0xa92b('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xa92b('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0xa92b('0x19'));function respondWithStatusCode(_0x4c1a01,_0x4cb01e){_0x4cb01e=_0x4cb01e||0xcc;return function(_0x5cae09){if(_0x5cae09){return _0x4c1a01[_0xa92b('0x1a')](_0x4cb01e);}return _0x4c1a01[_0xa92b('0x1b')](_0x4cb01e)[_0xa92b('0x1c')]();};}function respondWithResult(_0x4b0b02,_0xa2330b){_0xa2330b=_0xa2330b||0xc8;return function(_0x2edb44){if(_0x2edb44){return _0x4b0b02['status'](_0xa2330b)[_0xa92b('0x1d')](_0x2edb44);}};}function respondWithFilteredResult(_0x4c49ca,_0x142962){return function(_0x167dd6){if(_0x167dd6){var _0x10845d=typeof _0x142962[_0xa92b('0x1e')]==='undefined'&&typeof _0x142962[_0xa92b('0x1f')]===_0xa92b('0x20');var _0x4a0d3d=_0x167dd6[_0xa92b('0x21')];var _0x2ac856=_0x10845d?0x0:_0x142962[_0xa92b('0x1e')];var _0x238ae1=_0x10845d?_0x167dd6['count']:_0x142962[_0xa92b('0x1e')]+_0x142962[_0xa92b('0x1f')];var _0x545830;if(_0x238ae1>=_0x4a0d3d){_0x238ae1=_0x4a0d3d;_0x545830=0xc8;}else{_0x545830=0xce;}_0x4c49ca[_0xa92b('0x1b')](_0x545830);return _0x4c49ca[_0xa92b('0x22')](_0xa92b('0x23'),_0x2ac856+'-'+_0x238ae1+'/'+_0x4a0d3d)[_0xa92b('0x1d')](_0x167dd6);}return null;};}function patchUpdates(_0x48f2fa){return function(_0x50927a){try{jsonpatch[_0xa92b('0x24')](_0x50927a,_0x48f2fa,!![]);}catch(_0x38b7ce){return BPromise[_0xa92b('0x25')](_0x38b7ce);}return _0x50927a['save']();};}function saveUpdates(_0x3f175e,_0x3e870d){return function(_0xdcccae){if(_0xdcccae){return _0xdcccae[_0xa92b('0x26')](_0x3f175e)[_0xa92b('0x27')](function(_0x5f3ff6){return _0x5f3ff6;});}return null;};}function removeEntity(_0x596b23,_0xa6f1b8){return function(_0x403420){if(_0x403420){return _0x403420[_0xa92b('0x28')]()[_0xa92b('0x27')](function(){_0x596b23[_0xa92b('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d633c,_0x31d7fe){return function(_0x36b83f){if(!_0x36b83f){_0x2d633c['sendStatus'](0x194);}return _0x36b83f;};}function handleError(_0x11e159,_0x2e926b){_0x2e926b=_0x2e926b||0x1f4;return function(_0x17e89a){logger[_0xa92b('0x29')](_0x17e89a[_0xa92b('0x2a')]);if(_0x17e89a[_0xa92b('0x2b')]){delete _0x17e89a[_0xa92b('0x2b')];}_0x11e159[_0xa92b('0x1b')](_0x2e926b)['send'](_0x17e89a);};}exports[_0xa92b('0x2c')]=function(_0x4723d1,_0xb120df){var _0x54d6b7={},_0x30ef9c={},_0x418db9={'count':0x0,'rows':[]};var _0x34f25d=_['map'](db[_0xa92b('0x2d')][_0xa92b('0x2e')],function(_0x4b7e77){return{'name':_0x4b7e77[_0xa92b('0x2f')],'type':_0x4b7e77[_0xa92b('0x30')][_0xa92b('0x31')]};});_0x30ef9c[_0xa92b('0x32')]=_[_0xa92b('0x33')](_0x34f25d,_0xa92b('0x2b'));_0x30ef9c[_0xa92b('0x34')]=_[_0xa92b('0x35')](_0x4723d1['query']);_0x30ef9c['filters']=_[_0xa92b('0x36')](_0x30ef9c[_0xa92b('0x32')],_0x30ef9c['query']);_0x54d6b7[_0xa92b('0x37')]=_[_0xa92b('0x36')](_0x30ef9c[_0xa92b('0x32')],qs[_0xa92b('0x38')](_0x4723d1['query'][_0xa92b('0x38')]));_0x54d6b7[_0xa92b('0x37')]=_0x54d6b7[_0xa92b('0x37')][_0xa92b('0x39')]?_0x54d6b7[_0xa92b('0x37')]:_0x30ef9c[_0xa92b('0x32')];if(!_0x4723d1[_0xa92b('0x34')][_0xa92b('0x3a')]('nolimit')){_0x54d6b7[_0xa92b('0x1f')]=qs[_0xa92b('0x1f')](_0x4723d1[_0xa92b('0x34')]['limit']);_0x54d6b7['offset']=qs[_0xa92b('0x1e')](_0x4723d1[_0xa92b('0x34')][_0xa92b('0x1e')]);}_0x54d6b7[_0xa92b('0x3b')]=qs[_0xa92b('0x3c')](_0x4723d1['query'][_0xa92b('0x3c')]);_0x54d6b7[_0xa92b('0x3d')]=qs['filters'](_[_0xa92b('0x3e')](_0x4723d1[_0xa92b('0x34')],_0x30ef9c[_0xa92b('0x3f')]),_0x34f25d);if(_0x4723d1[_0xa92b('0x34')][_0xa92b('0x40')]){_0x54d6b7[_0xa92b('0x3d')]=_[_0xa92b('0x41')](_0x54d6b7[_0xa92b('0x3d')],{'$or':_[_0xa92b('0x33')](_0x34f25d,function(_0x26e172){if(_0x26e172[_0xa92b('0x30')]!=='VIRTUAL'){var _0x512c1c={};_0x512c1c[_0x26e172[_0xa92b('0x2b')]]={'$like':'%'+_0x4723d1[_0xa92b('0x34')][_0xa92b('0x40')]+'%'};return _0x512c1c;}})});}_0x54d6b7=_[_0xa92b('0x41')]({},_0x54d6b7,_0x4723d1[_0xa92b('0x42')]);var _0x416ed9={'where':_0x54d6b7[_0xa92b('0x3d')]};return db[_0xa92b('0x2d')][_0xa92b('0x21')](_0x416ed9)['then'](function(_0x2bc4a0){_0x418db9[_0xa92b('0x21')]=_0x2bc4a0;if(_0x4723d1[_0xa92b('0x34')]['includeAll']){_0x54d6b7[_0xa92b('0x43')]=[{'all':!![]}];}return db['FreshsalesAccount'][_0xa92b('0x44')](_0x54d6b7);})[_0xa92b('0x27')](function(_0x233d49){_0x418db9[_0xa92b('0x45')]=_0x233d49;return _0x418db9;})[_0xa92b('0x27')](respondWithFilteredResult(_0xb120df,_0x54d6b7))[_0xa92b('0x46')](handleError(_0xb120df,null));};exports[_0xa92b('0x47')]=function(_0x13c50e,_0x4d09b0){var _0x16b7a6={'raw':![],'where':{'id':_0x13c50e['params']['id']}},_0x2b7089={};_0x2b7089['model']=_[_0xa92b('0x35')](db[_0xa92b('0x2d')][_0xa92b('0x2e')]);_0x2b7089[_0xa92b('0x34')]=_[_0xa92b('0x35')](_0x13c50e[_0xa92b('0x34')]);_0x2b7089[_0xa92b('0x3f')]=_['intersection'](_0x2b7089[_0xa92b('0x32')],_0x2b7089[_0xa92b('0x34')]);_0x16b7a6[_0xa92b('0x37')]=_[_0xa92b('0x36')](_0x2b7089[_0xa92b('0x32')],qs[_0xa92b('0x38')](_0x13c50e[_0xa92b('0x34')]['fields']));_0x16b7a6[_0xa92b('0x37')]=_0x16b7a6[_0xa92b('0x37')]['length']?_0x16b7a6[_0xa92b('0x37')]:_0x2b7089['model'];if(_0x13c50e[_0xa92b('0x34')][_0xa92b('0x48')]){_0x16b7a6[_0xa92b('0x43')]=[{'all':!![]}];}_0x16b7a6=_['merge']({},_0x16b7a6,_0x13c50e['options']);return db[_0xa92b('0x2d')][_0xa92b('0x49')](_0x16b7a6)[_0xa92b('0x27')](handleEntityNotFound(_0x4d09b0,null))['then'](respondWithResult(_0x4d09b0,null))[_0xa92b('0x46')](handleError(_0x4d09b0,null));};exports[_0xa92b('0x4a')]=function(_0x1596f5,_0x58b687){return db[_0xa92b('0x2d')][_0xa92b('0x4a')](_0x1596f5[_0xa92b('0x4b')],{})[_0xa92b('0x27')](respondWithResult(_0x58b687,0xc9))['catch'](handleError(_0x58b687,null));};exports[_0xa92b('0x26')]=function(_0x367e22,_0x162f60){if(_0x367e22[_0xa92b('0x4b')]['id']){delete _0x367e22['body']['id'];}return db[_0xa92b('0x2d')][_0xa92b('0x49')]({'where':{'id':_0x367e22[_0xa92b('0x4c')]['id']}})[_0xa92b('0x27')](handleEntityNotFound(_0x162f60,null))[_0xa92b('0x27')](saveUpdates(_0x367e22[_0xa92b('0x4b')],null))['then'](respondWithResult(_0x162f60,null))[_0xa92b('0x46')](handleError(_0x162f60,null));};exports[_0xa92b('0x28')]=function(_0x50050e,_0x534f2b){return db[_0xa92b('0x2d')]['find']({'where':{'id':_0x50050e['params']['id']}})['then'](handleEntityNotFound(_0x534f2b,null))['then'](removeEntity(_0x534f2b,null))[_0xa92b('0x46')](handleError(_0x534f2b,null));};exports[_0xa92b('0x4d')]=function(_0x1f064a,_0x2e1778,_0x580127){var _0x55c73c={};var _0x423e52={};var _0x4386d9;var _0x4d0f1b;return db[_0xa92b('0x2d')]['findOne']({'where':{'id':_0x1f064a['params']['id']}})[_0xa92b('0x27')](handleEntityNotFound(_0x2e1778,null))[_0xa92b('0x27')](function(_0x1ffaa8){if(_0x1ffaa8){_0x4386d9=_0x1ffaa8;_0x423e52['model']=_['keys'](db[_0xa92b('0x4e')][_0xa92b('0x2e')]);_0x423e52[_0xa92b('0x34')]=_[_0xa92b('0x35')](_0x1f064a['query']);_0x423e52[_0xa92b('0x3f')]=_['intersection'](_0x423e52[_0xa92b('0x32')],_0x423e52[_0xa92b('0x34')]);_0x55c73c[_0xa92b('0x37')]=_[_0xa92b('0x36')](_0x423e52[_0xa92b('0x32')],qs['fields'](_0x1f064a['query'][_0xa92b('0x38')]));_0x55c73c[_0xa92b('0x37')]=_0x55c73c['attributes']['length']?_0x55c73c['attributes']:_0x423e52['model'];_0x55c73c[_0xa92b('0x3b')]=qs[_0xa92b('0x3c')](_0x1f064a[_0xa92b('0x34')][_0xa92b('0x3c')]);_0x55c73c[_0xa92b('0x3d')]=qs[_0xa92b('0x3f')](_[_0xa92b('0x3e')](_0x1f064a[_0xa92b('0x34')],_0x423e52[_0xa92b('0x3f')]));if(_0x1f064a[_0xa92b('0x34')][_0xa92b('0x40')]){_0x55c73c['where']=_['merge'](_0x55c73c[_0xa92b('0x3d')],{'$or':_[_0xa92b('0x33')](_0x55c73c[_0xa92b('0x37')],function(_0xe74135){var _0x370d25={};_0x370d25[_0xe74135]={'$like':'%'+_0x1f064a[_0xa92b('0x34')][_0xa92b('0x40')]+'%'};return _0x370d25;})});}_0x55c73c=_[_0xa92b('0x41')]({},_0x55c73c,_0x1f064a[_0xa92b('0x42')]);return _0x4386d9[_0xa92b('0x4d')](_0x55c73c);}})[_0xa92b('0x27')](function(_0x5caa1b){if(_0x5caa1b){_0x4d0f1b=_0x5caa1b['length'];if(!_0x1f064a[_0xa92b('0x34')][_0xa92b('0x3a')](_0xa92b('0x4f'))){_0x55c73c[_0xa92b('0x1f')]=qs['limit'](_0x1f064a[_0xa92b('0x34')]['limit']);_0x55c73c['offset']=qs[_0xa92b('0x1e')](_0x1f064a[_0xa92b('0x34')][_0xa92b('0x1e')]);}return _0x4386d9[_0xa92b('0x4d')](_0x55c73c);}})[_0xa92b('0x27')](function(_0x15c3b8){if(_0x15c3b8){return _0x15c3b8?{'count':_0x4d0f1b,'rows':_0x15c3b8}:null;}})[_0xa92b('0x27')](respondWithResult(_0x2e1778,null))[_0xa92b('0x46')](handleError(_0x2e1778,null));};exports['addConfiguration']=function(_0x42e8e7,_0x556c41,_0x585c33){if(_0x42e8e7[_0xa92b('0x4b')]['id']){delete _0x42e8e7[_0xa92b('0x4b')]['id'];}return db[_0xa92b('0x2d')]['findOne']({'where':{'id':_0x42e8e7[_0xa92b('0x4c')]['id']}})[_0xa92b('0x27')](handleEntityNotFound(_0x556c41,null))[_0xa92b('0x27')](function(_0x9cfd63){if(_0x9cfd63){_0x42e8e7[_0xa92b('0x4b')]['AccountId']=_0x9cfd63['id'];_0x42e8e7[_0xa92b('0x4b')][_0xa92b('0x50')]=integrations[_0xa92b('0x51')](_0x42e8e7['body'][_0xa92b('0x52')],_0x42e8e7[_0xa92b('0x4b')][_0xa92b('0x30')]);_0x42e8e7[_0xa92b('0x4b')][_0xa92b('0x53')]=integrations['getDescriptions'](_0x42e8e7[_0xa92b('0x4b')][_0xa92b('0x52')],_0x42e8e7[_0xa92b('0x4b')]['type']);return db[_0xa92b('0x4e')][_0xa92b('0x4a')](_0x42e8e7[_0xa92b('0x4b')],{'include':[{'model':db[_0xa92b('0x54')],'as':_0xa92b('0x50')},{'model':db[_0xa92b('0x54')],'as':_0xa92b('0x53')}]});}return null;})[_0xa92b('0x27')](respondWithResult(_0x556c41,null))[_0xa92b('0x46')](handleError(_0x556c41,null));};exports['getFields']=function(_0x23f263,_0x9fdad2,_0x1d1e8c){var _0x1174cc='';var _0x456d6e='';return db['FreshsalesAccount'][_0xa92b('0x55')]({'where':{'id':_0x23f263['params']['id']},'attributes':['id',_0xa92b('0x56'),_0xa92b('0x57'),'apiKey']})[_0xa92b('0x27')](handleEntityNotFound(_0x9fdad2,null))['then'](function(_0x265191){if(_0x265191){_0x456d6e=_0x265191[_0xa92b('0x56')];_0x1174cc=_0x265191[_0xa92b('0x57')];var _0xd11ace=_0x265191[_0xa92b('0x57')][_0xa92b('0x58')](-0x1);if(_0xd11ace==='/'){_0x1174cc=_0x1174cc[_0xa92b('0x59')](0x0,_0x1174cc[_0xa92b('0x5a')](_0xd11ace));}return rp({'method':_0xa92b('0x5b'),'uri':util['format'](_0xa92b('0x5c'),_0x1174cc,_0xa92b('0x5d')),'headers':{'Authorization':_0xa92b('0x5e')+_0x265191[_0xa92b('0x5f')]},'json':!![]});}})[_0xa92b('0x27')](function(_0x51026e){if(_0x51026e){var _0x188fbe=_0x51026e[_0xa92b('0x60')];var _0x108d43=![];var _0x4eebe4=null;for(_0x4eebe4=0x0;_0x4eebe4<_0x188fbe[_0xa92b('0x39')];_0x4eebe4++){if(_0x188fbe[_0x4eebe4][_0xa92b('0x61')]===_0x456d6e){_0x108d43=!![];}}if(_0x108d43){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0xa92b('0x27')](respondWithResult(_0x9fdad2,null))[_0xa92b('0x46')](function(_0x2578c6){var _0x231ae2=_0x23f263[_0xa92b('0x34')]['test']?0x1f4:_0x2578c6[_0xa92b('0x62')]||0x1f4;logger['error'](_0xa92b('0x63'),'getFields',_0x231ae2,JSON[_0xa92b('0x64')](_0x2578c6));delete _0x2578c6[_0xa92b('0x2b')];if(_0x231ae2===0x191){_0x231ae2=0x190;}_0x9fdad2['status'](_0x231ae2)[_0xa92b('0x65')](_0x23f263[_0xa92b('0x34')]['test']?{'message':_0xa92b('0x66'),'statusCode':_0x2578c6['statusCode']}:_0x2578c6);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index cea5edb..bad6411 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 _0x33af=['request-promise','path','rimraf','./intFreshsalesAccount.attributes','../../components/integrations/configuration','define','FreshsalesAccount','int_freshsales_accounts','util','api','moment','bluebird'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x33af,0xec));var _0xf33a=function(_0x52e94f,_0x22e52d){_0x52e94f=_0x52e94f-0x0;var _0x127d43=_0x33af[_0x52e94f];return _0x127d43;};'use strict';var _=require('lodash');var util=require(_0xf33a('0x0'));var logger=require('../../config/logger')(_0xf33a('0x1'));var moment=require(_0xf33a('0x2'));var BPromise=require(_0xf33a('0x3'));var rp=require(_0xf33a('0x4'));var fs=require('fs');var path=require(_0xf33a('0x5'));var rimraf=require(_0xf33a('0x6'));var config=require('../../config/environment');var attributes=require(_0xf33a('0x7'));var integrations=require(_0xf33a('0x8'));module['exports']=function(_0xc0dd13,_0x384b14){return _0xc0dd13[_0xf33a('0x9')](_0xf33a('0xa'),attributes,{'tableName':_0xf33a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbff5=['FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../components/integrations/configuration','exports','define'];(function(_0x170ab3,_0x124655){var _0x54cfde=function(_0x4d35c9){while(--_0x4d35c9){_0x170ab3['push'](_0x170ab3['shift']());}};_0x54cfde(++_0x124655);}(_0xbff5,0x1bc));var _0x5bff=function(_0x217a49,_0xbe25d2){_0x217a49=_0x217a49-0x0;var _0x4b48e1=_0xbff5[_0x217a49];return _0x4b48e1;};'use strict';var _=require(_0x5bff('0x0'));var util=require(_0x5bff('0x1'));var logger=require(_0x5bff('0x2'))(_0x5bff('0x3'));var moment=require(_0x5bff('0x4'));var BPromise=require(_0x5bff('0x5'));var rp=require(_0x5bff('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5bff('0x7'));var config=require('../../config/environment');var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0x5bff('0x8'));module[_0x5bff('0x9')]=function(_0x151add,_0xa54c57){return _0x151add[_0x5bff('0xa')](_0x5bff('0xb'),attributes,{'tableName':_0x5bff('0xc'),'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 bf5ffc7..e7e72f2 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 _0x4991=['where','attributes','limit','include','map','model','catch','ShowFreshsalesAccount','find','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshsalesAccount,\x20%s,\x20%s','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetFreshsalesAccount','findAll','options','raw'];(function(_0x35439d,_0x5c3183){var _0x42d38f=function(_0x1fba0d){while(--_0x1fba0d){_0x35439d['push'](_0x35439d['shift']());}};_0x42d38f(++_0x5c3183);}(_0x4991,0xf7));var _0x1499=function(_0x12250b,_0x2b6765){_0x12250b=_0x12250b-0x0;var _0x22ca44=_0x4991[_0x12250b];return _0x22ca44;};'use strict';var _=require(_0x1499('0x0'));var util=require('util');var moment=require(_0x1499('0x1'));var BPromise=require('bluebird');var rs=require(_0x1499('0x2'));var fs=require('fs');var Redis=require(_0x1499('0x3'));var db=require(_0x1499('0x4'))['db'];var utils=require(_0x1499('0x5'));var logger=require(_0x1499('0x6'))(_0x1499('0x7'));var config=require(_0x1499('0x8'));var jayson=require(_0x1499('0x9'));var client=jayson['client'][_0x1499('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c3bd7,_0x1c65c3,_0x33b261){return new BPromise(function(_0x133bae,_0x380e48){return client[_0x1499('0xb')](_0x1c3bd7,_0x33b261)[_0x1499('0xc')](function(_0x48d2ca){logger[_0x1499('0xd')](_0x1499('0xe'),_0x1c65c3,'request\x20sent');logger[_0x1499('0xf')](_0x1499('0x10'),_0x1c65c3,'request\x20sent',JSON[_0x1499('0x11')](_0x48d2ca));if(_0x48d2ca[_0x1499('0x12')]){if(_0x48d2ca['error']['code']===0x1f4){logger['error'](_0x1499('0xe'),_0x1c65c3,_0x48d2ca[_0x1499('0x12')][_0x1499('0x13')]);return _0x380e48(_0x48d2ca[_0x1499('0x12')][_0x1499('0x13')]);}logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x1c65c3,_0x48d2ca[_0x1499('0x12')]['message']);return _0x133bae(_0x48d2ca[_0x1499('0x12')][_0x1499('0x13')]);}else{logger[_0x1499('0xd')](_0x1499('0xe'),_0x1c65c3,'request\x20sent');_0x133bae(_0x48d2ca[_0x1499('0x14')][_0x1499('0x13')]);}})['catch'](function(_0x25164c){logger[_0x1499('0x12')](_0x1499('0xe'),_0x1c65c3,_0x25164c);_0x380e48(_0x25164c);});});}exports[_0x1499('0x15')]=function(_0x1e45a9){var _0x27e533=this;return new Promise(function(_0x5b9859,_0x541477){return db['FreshsalesAccount'][_0x1499('0x16')]({'raw':_0x1e45a9[_0x1499('0x17')]?_0x1e45a9['options'][_0x1499('0x18')]===undefined?!![]:![]:!![],'where':_0x1e45a9[_0x1499('0x17')]?_0x1e45a9[_0x1499('0x17')][_0x1499('0x19')]||null:null,'attributes':_0x1e45a9[_0x1499('0x17')]?_0x1e45a9[_0x1499('0x17')][_0x1499('0x1a')]||null:null,'limit':_0x1e45a9[_0x1499('0x17')]?_0x1e45a9[_0x1499('0x17')][_0x1499('0x1b')]||null:null,'include':_0x1e45a9[_0x1499('0x17')]?_0x1e45a9[_0x1499('0x17')][_0x1499('0x1c')]?_[_0x1499('0x1d')](_0x1e45a9[_0x1499('0x17')][_0x1499('0x1c')],function(_0x2c7f57){return{'model':db[_0x2c7f57['model']],'as':_0x2c7f57['as'],'attributes':_0x2c7f57[_0x1499('0x1a')],'include':_0x2c7f57[_0x1499('0x1c')]?_[_0x1499('0x1d')](_0x2c7f57[_0x1499('0x1c')],function(_0x3968e0){return{'model':db[_0x3968e0[_0x1499('0x1e')]],'as':_0x3968e0['as'],'attributes':_0x3968e0['attributes'],'include':_0x3968e0['include']?_[_0x1499('0x1d')](_0x3968e0[_0x1499('0x1c')],function(_0x3b9259){return{'model':db[_0x3b9259[_0x1499('0x1e')]],'as':_0x3b9259['as'],'attributes':_0x3b9259[_0x1499('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3e5ed1){logger['info']('GetFreshsalesAccount',_0x1e45a9);logger['debug'](_0x1499('0x15'),_0x1e45a9,JSON[_0x1499('0x11')](_0x3e5ed1));_0x5b9859(_0x3e5ed1);})[_0x1499('0x1f')](function(_0x1b460b){logger[_0x1499('0x12')](_0x1499('0x15'),_0x1b460b[_0x1499('0x13')],_0x1e45a9);_0x541477(_0x27e533['error'](0x1f4,_0x1b460b[_0x1499('0x13')]));});});};exports[_0x1499('0x20')]=function(_0x39995b){var _0x5b59ea=this;return new Promise(function(_0x2dae84,_0x16466c){return db['FreshsalesAccount'][_0x1499('0x21')]({'raw':_0x39995b[_0x1499('0x17')]?_0x39995b['options'][_0x1499('0x18')]===undefined?!![]:![]:!![],'where':_0x39995b[_0x1499('0x17')]?_0x39995b[_0x1499('0x17')][_0x1499('0x19')]||null:null,'attributes':_0x39995b[_0x1499('0x17')]?_0x39995b[_0x1499('0x17')][_0x1499('0x1a')]||null:null,'include':_0x39995b[_0x1499('0x17')]?_0x39995b[_0x1499('0x17')][_0x1499('0x1c')]?_[_0x1499('0x1d')](_0x39995b[_0x1499('0x17')][_0x1499('0x1c')],function(_0x3f4c1a){return{'model':db[_0x3f4c1a[_0x1499('0x1e')]],'as':_0x3f4c1a['as'],'attributes':_0x3f4c1a[_0x1499('0x1a')],'include':_0x3f4c1a[_0x1499('0x1c')]?_[_0x1499('0x1d')](_0x3f4c1a[_0x1499('0x1c')],function(_0x29e89e){return{'model':db[_0x29e89e['model']],'as':_0x29e89e['as'],'attributes':_0x29e89e[_0x1499('0x1a')],'include':_0x29e89e[_0x1499('0x1c')]?_[_0x1499('0x1d')](_0x29e89e[_0x1499('0x1c')],function(_0x31251c){return{'model':db[_0x31251c[_0x1499('0x1e')]],'as':_0x31251c['as'],'attributes':_0x31251c[_0x1499('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x1499('0xc')](function(_0x12cf93){logger[_0x1499('0xd')](_0x1499('0x20'),_0x39995b);logger['debug']('ShowFreshsalesAccount',_0x39995b,JSON[_0x1499('0x11')](_0x12cf93));_0x2dae84(_0x12cf93);})['catch'](function(_0x29bb8f){logger['error'](_0x1499('0x20'),_0x29bb8f[_0x1499('0x13')],_0x39995b);_0x16466c(_0x5b59ea[_0x1499('0x12')](0x1f4,_0x29bb8f[_0x1499('0x13')]));});});}; \ No newline at end of file +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(_0x1b8e82,_0x51c541){var _0x482153=function(_0x3278c5){while(--_0x3278c5){_0x1b8e82['push'](_0x1b8e82['shift']());}};_0x482153(++_0x51c541);}(_0xc2c7,0x134));var _0x7c2c=function(_0x26c122,_0x5bd0dd){_0x26c122=_0x26c122-0x0;var _0x17e204=_0xc2c7[_0x26c122];return _0x17e204;};'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 diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 93dbd61..85944da 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 _0x8c5c=['isAuthenticated','show','/:id/subjects','/:id/descriptions','/:id/fields','getFields','post','put','update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','index','/:id'];(function(_0x19087c,_0x571125){var _0x478a6f=function(_0x4534d0){while(--_0x4534d0){_0x19087c['push'](_0x19087c['shift']());}};_0x478a6f(++_0x571125);}(_0x8c5c,0x95));var _0xc8c5=function(_0x56c65c,_0x29da3d){_0x56c65c=_0x56c65c-0x0;var _0x27d6c1=_0x8c5c[_0x56c65c];return _0x27d6c1;};'use strict';var multer=require(_0xc8c5('0x0'));var util=require(_0xc8c5('0x1'));var path=require(_0xc8c5('0x2'));var timeout=require(_0xc8c5('0x3'));var express=require('express');var router=express[_0xc8c5('0x4')]();var fs_extra=require(_0xc8c5('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc8c5('0x6'));var config=require(_0xc8c5('0x7'));var controller=require(_0xc8c5('0x8'));router[_0xc8c5('0x9')]('/',auth['isAuthenticated'](),controller[_0xc8c5('0xa')]);router[_0xc8c5('0x9')](_0xc8c5('0xb'),auth[_0xc8c5('0xc')](),controller[_0xc8c5('0xd')]);router[_0xc8c5('0x9')](_0xc8c5('0xe'),auth[_0xc8c5('0xc')](),controller['getSubjects']);router[_0xc8c5('0x9')](_0xc8c5('0xf'),auth['isAuthenticated'](),controller['getDescriptions']);router['get'](_0xc8c5('0x10'),auth[_0xc8c5('0xc')](),controller[_0xc8c5('0x11')]);router[_0xc8c5('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc8c5('0x13')](_0xc8c5('0xb'),auth['isAuthenticated'](),controller[_0xc8c5('0x14')]);router[_0xc8c5('0x15')](_0xc8c5('0xb'),auth[_0xc8c5('0xc')](),controller[_0xc8c5('0x16')]);module['exports']=router; \ No newline at end of file +var _0x1e42=['show','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','index','/:id','isAuthenticated'];(function(_0x456fb1,_0x859a1d){var _0x4083d6=function(_0xe1d0f2){while(--_0xe1d0f2){_0x456fb1['push'](_0x456fb1['shift']());}};_0x4083d6(++_0x859a1d);}(_0x1e42,0x193));var _0x21e4=function(_0xb5bd7f,_0x5e50b0){_0xb5bd7f=_0xb5bd7f-0x0;var _0x13cd94=_0x1e42[_0xb5bd7f];return _0x13cd94;};'use strict';var multer=require(_0x21e4('0x0'));var util=require(_0x21e4('0x1'));var path=require(_0x21e4('0x2'));var timeout=require(_0x21e4('0x3'));var express=require('express');var router=express[_0x21e4('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x21e4('0x5'));var interaction=require(_0x21e4('0x6'));var config=require(_0x21e4('0x7'));var controller=require(_0x21e4('0x8'));router[_0x21e4('0x9')]('/',auth['isAuthenticated'](),controller[_0x21e4('0xa')]);router['get'](_0x21e4('0xb'),auth[_0x21e4('0xc')](),controller[_0x21e4('0xd')]);router[_0x21e4('0x9')]('/:id/subjects',auth[_0x21e4('0xc')](),controller[_0x21e4('0xe')]);router[_0x21e4('0x9')](_0x21e4('0xf'),auth[_0x21e4('0xc')](),controller[_0x21e4('0x10')]);router[_0x21e4('0x9')](_0x21e4('0x11'),auth[_0x21e4('0xc')](),controller[_0x21e4('0x12')]);router[_0x21e4('0x13')]('/',auth[_0x21e4('0xc')](),controller[_0x21e4('0x14')]);router[_0x21e4('0x15')](_0x21e4('0xb'),auth[_0x21e4('0xc')](),controller[_0x21e4('0x16')]);router[_0x21e4('0x17')]('/:id',auth['isAuthenticated'](),controller[_0x21e4('0x18')]);module[_0x21e4('0x19')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 38bf44c..048ca5e 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 _0x6721=['STRING','sequelize'];(function(_0x24087a,_0x21d11d){var _0x2c1ebe=function(_0x3927f9){while(--_0x3927f9){_0x24087a['push'](_0x24087a['shift']());}};_0x2c1ebe(++_0x21d11d);}(_0x6721,0x169));var _0x1672=function(_0x48695e,_0x3ac9a8){_0x48695e=_0x48695e-0x0;var _0x4f9f2b=_0x6721[_0x48695e];return _0x4f9f2b;};'use strict';var Sequelize=require(_0x1672('0x0'));module['exports']={'name':{'type':Sequelize[_0x1672('0x1')]},'description':{'type':Sequelize[_0x1672('0x1')]}}; \ No newline at end of file +var _0x8920=['STRING','sequelize','exports'];(function(_0x5e21c3,_0x379637){var _0x5852b8=function(_0x196588){while(--_0x196588){_0x5e21c3['push'](_0x5e21c3['shift']());}};_0x5852b8(++_0x379637);}(_0x8920,0x17e));var _0x0892=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x8920[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0x0892('0x0'));module[_0x0892('0x1')]={'name':{'type':Sequelize[_0x0892('0x2')]},'description':{'type':Sequelize[_0x0892('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 90fabb0..9da272a 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 _0xa6db=['catch','show','params','keys','include','find','create','body','getSubjects','FreshsalesField','order','sort','filter','getDescriptions','findOne','options','getFields','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','apply','reject','update','then','destroy','error','name','send','index','map','rawAttributes','fieldName','type','key','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','filters','pick','where','merge','VIRTUAL','includeAll','FreshsalesConfiguration','findAll','rows'];(function(_0x15af0f,_0x5454ce){var _0x2bd1cb=function(_0x593818){while(--_0x593818){_0x15af0f['push'](_0x15af0f['shift']());}};_0x2bd1cb(++_0x5454ce);}(_0xa6db,0x104));var _0xba6d=function(_0x121253,_0xbc6511){_0x121253=_0x121253-0x0;var _0x45dced=_0xa6db[_0x121253];return _0x45dced;};'use strict';var emlformat=require(_0xba6d('0x0'));var rimraf=require(_0xba6d('0x1'));var zipdir=require(_0xba6d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xba6d('0x3'));var moment=require(_0xba6d('0x4'));var BPromise=require(_0xba6d('0x5'));var Mustache=require('mustache');var util=require(_0xba6d('0x6'));var path=require('path');var sox=require(_0xba6d('0x7'));var csv=require('to-csv');var ejs=require(_0xba6d('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xba6d('0x9'));var squel=require(_0xba6d('0xa'));var crypto=require(_0xba6d('0xb'));var jsforce=require(_0xba6d('0xc'));var deskjs=require(_0xba6d('0xd'));var toCsv=require(_0xba6d('0xe'));var querystring=require(_0xba6d('0xf'));var Papa=require(_0xba6d('0x10'));var Redis=require(_0xba6d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xba6d('0x12'));var as=require(_0xba6d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xba6d('0x14'))(_0xba6d('0x15'));var utils=require(_0xba6d('0x16'));var config=require(_0xba6d('0x17'));var licenseUtil=require(_0xba6d('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3cce70,_0x5ab5e5){_0x5ab5e5=_0x5ab5e5||0xcc;return function(_0x2e82f8){if(_0x2e82f8){return _0x3cce70[_0xba6d('0x19')](_0x5ab5e5);}return _0x3cce70[_0xba6d('0x1a')](_0x5ab5e5)[_0xba6d('0x1b')]();};}function respondWithResult(_0x1e831f,_0x4b4d99){_0x4b4d99=_0x4b4d99||0xc8;return function(_0x314362){if(_0x314362){return _0x1e831f[_0xba6d('0x1a')](_0x4b4d99)[_0xba6d('0x1c')](_0x314362);}};}function respondWithFilteredResult(_0x17dfc5,_0x981580){return function(_0x2461a7){if(_0x2461a7){var _0x2669a9=typeof _0x981580[_0xba6d('0x1d')]===_0xba6d('0x1e')&&typeof _0x981580['limit']===_0xba6d('0x1e');var _0x27bda9=_0x2461a7[_0xba6d('0x1f')];var _0x512127=_0x2669a9?0x0:_0x981580['offset'];var _0x5c056f=_0x2669a9?_0x2461a7['count']:_0x981580[_0xba6d('0x1d')]+_0x981580['limit'];var _0x32ad38;if(_0x5c056f>=_0x27bda9){_0x5c056f=_0x27bda9;_0x32ad38=0xc8;}else{_0x32ad38=0xce;}_0x17dfc5[_0xba6d('0x1a')](_0x32ad38);return _0x17dfc5['set']('Content-Range',_0x512127+'-'+_0x5c056f+'/'+_0x27bda9)[_0xba6d('0x1c')](_0x2461a7);}return null;};}function patchUpdates(_0x117564){return function(_0x18c42f){try{jsonpatch[_0xba6d('0x20')](_0x18c42f,_0x117564,!![]);}catch(_0x240824){return BPromise[_0xba6d('0x21')](_0x240824);}return _0x18c42f['save']();};}function saveUpdates(_0x5955a4,_0x40d1ec){return function(_0x3184d0){if(_0x3184d0){return _0x3184d0[_0xba6d('0x22')](_0x5955a4)[_0xba6d('0x23')](function(_0x5e5696){return _0x5e5696;});}return null;};}function removeEntity(_0x1d3daa,_0x189c4b){return function(_0x18271f){if(_0x18271f){return _0x18271f[_0xba6d('0x24')]()[_0xba6d('0x23')](function(){_0x1d3daa[_0xba6d('0x1a')](0xcc)[_0xba6d('0x1b')]();});}};}function handleEntityNotFound(_0x4518c1,_0x556f88){return function(_0x4f1d74){if(!_0x4f1d74){_0x4518c1[_0xba6d('0x19')](0x194);}return _0x4f1d74;};}function handleError(_0x2a434b,_0x169968){_0x169968=_0x169968||0x1f4;return function(_0x55f740){logger[_0xba6d('0x25')](_0x55f740['stack']);if(_0x55f740[_0xba6d('0x26')]){delete _0x55f740[_0xba6d('0x26')];}_0x2a434b[_0xba6d('0x1a')](_0x169968)[_0xba6d('0x27')](_0x55f740);};}exports[_0xba6d('0x28')]=function(_0x15e979,_0x120695){var _0x5b2cb2={},_0x154e9a={},_0x436f40={'count':0x0,'rows':[]};var _0x90a871=_[_0xba6d('0x29')](db['FreshsalesConfiguration'][_0xba6d('0x2a')],function(_0x269bd9){return{'name':_0x269bd9[_0xba6d('0x2b')],'type':_0x269bd9[_0xba6d('0x2c')][_0xba6d('0x2d')]};});_0x154e9a['model']=_[_0xba6d('0x29')](_0x90a871,'name');_0x154e9a[_0xba6d('0x2e')]=_['keys'](_0x15e979[_0xba6d('0x2e')]);_0x154e9a['filters']=_[_0xba6d('0x2f')](_0x154e9a[_0xba6d('0x30')],_0x154e9a[_0xba6d('0x2e')]);_0x5b2cb2[_0xba6d('0x31')]=_[_0xba6d('0x2f')](_0x154e9a[_0xba6d('0x30')],qs[_0xba6d('0x32')](_0x15e979[_0xba6d('0x2e')][_0xba6d('0x32')]));_0x5b2cb2[_0xba6d('0x31')]=_0x5b2cb2[_0xba6d('0x31')][_0xba6d('0x33')]?_0x5b2cb2[_0xba6d('0x31')]:_0x154e9a[_0xba6d('0x30')];if(!_0x15e979[_0xba6d('0x2e')][_0xba6d('0x34')](_0xba6d('0x35'))){_0x5b2cb2['limit']=qs[_0xba6d('0x36')](_0x15e979[_0xba6d('0x2e')]['limit']);_0x5b2cb2[_0xba6d('0x1d')]=qs[_0xba6d('0x1d')](_0x15e979[_0xba6d('0x2e')]['offset']);}_0x5b2cb2['order']=qs['sort'](_0x15e979[_0xba6d('0x2e')]['sort']);_0x5b2cb2['where']=qs[_0xba6d('0x37')](_[_0xba6d('0x38')](_0x15e979[_0xba6d('0x2e')],_0x154e9a['filters']),_0x90a871);if(_0x15e979[_0xba6d('0x2e')]['filter']){_0x5b2cb2[_0xba6d('0x39')]=_[_0xba6d('0x3a')](_0x5b2cb2[_0xba6d('0x39')],{'$or':_[_0xba6d('0x29')](_0x90a871,function(_0x542e38){if(_0x542e38[_0xba6d('0x2c')]!==_0xba6d('0x3b')){var _0x5108ba={};_0x5108ba[_0x542e38[_0xba6d('0x26')]]={'$like':'%'+_0x15e979[_0xba6d('0x2e')]['filter']+'%'};return _0x5108ba;}})});}_0x5b2cb2=_[_0xba6d('0x3a')]({},_0x5b2cb2,_0x15e979['options']);var _0x44fb8a={'where':_0x5b2cb2[_0xba6d('0x39')]};return db['FreshsalesConfiguration']['count'](_0x44fb8a)['then'](function(_0x2fa936){_0x436f40[_0xba6d('0x1f')]=_0x2fa936;if(_0x15e979[_0xba6d('0x2e')][_0xba6d('0x3c')]){_0x5b2cb2['include']=[{'all':!![]}];}return db[_0xba6d('0x3d')][_0xba6d('0x3e')](_0x5b2cb2);})[_0xba6d('0x23')](function(_0x2fb698){_0x436f40[_0xba6d('0x3f')]=_0x2fb698;return _0x436f40;})[_0xba6d('0x23')](respondWithFilteredResult(_0x120695,_0x5b2cb2))[_0xba6d('0x40')](handleError(_0x120695,null));};exports[_0xba6d('0x41')]=function(_0x1c97c0,_0x4ed779){var _0xcdbf62={'raw':![],'where':{'id':_0x1c97c0[_0xba6d('0x42')]['id']}},_0x3bed52={};_0x3bed52[_0xba6d('0x30')]=_[_0xba6d('0x43')](db[_0xba6d('0x3d')][_0xba6d('0x2a')]);_0x3bed52[_0xba6d('0x2e')]=_[_0xba6d('0x43')](_0x1c97c0['query']);_0x3bed52[_0xba6d('0x37')]=_[_0xba6d('0x2f')](_0x3bed52['model'],_0x3bed52['query']);_0xcdbf62[_0xba6d('0x31')]=_[_0xba6d('0x2f')](_0x3bed52['model'],qs[_0xba6d('0x32')](_0x1c97c0[_0xba6d('0x2e')][_0xba6d('0x32')]));_0xcdbf62[_0xba6d('0x31')]=_0xcdbf62[_0xba6d('0x31')]['length']?_0xcdbf62[_0xba6d('0x31')]:_0x3bed52['model'];if(_0x1c97c0[_0xba6d('0x2e')][_0xba6d('0x3c')]){_0xcdbf62[_0xba6d('0x44')]=[{'all':!![]}];}_0xcdbf62=_[_0xba6d('0x3a')]({},_0xcdbf62,_0x1c97c0['options']);return db['FreshsalesConfiguration'][_0xba6d('0x45')](_0xcdbf62)[_0xba6d('0x23')](handleEntityNotFound(_0x4ed779,null))[_0xba6d('0x23')](respondWithResult(_0x4ed779,null))[_0xba6d('0x40')](handleError(_0x4ed779,null));};exports['create']=function(_0x376779,_0x5cf6c4){return db[_0xba6d('0x3d')][_0xba6d('0x46')](_0x376779[_0xba6d('0x47')],{})[_0xba6d('0x23')](respondWithResult(_0x5cf6c4,0xc9))['catch'](handleError(_0x5cf6c4,null));};exports[_0xba6d('0x22')]=function(_0x15aa89,_0x425c94){if(_0x15aa89[_0xba6d('0x47')]['id']){delete _0x15aa89[_0xba6d('0x47')]['id'];}return db[_0xba6d('0x3d')]['find']({'where':{'id':_0x15aa89['params']['id']}})['then'](handleEntityNotFound(_0x425c94,null))[_0xba6d('0x23')](saveUpdates(_0x15aa89[_0xba6d('0x47')],null))['then'](respondWithResult(_0x425c94,null))[_0xba6d('0x40')](handleError(_0x425c94,null));};exports[_0xba6d('0x24')]=function(_0x41f4df,_0x1d6ed0){return db[_0xba6d('0x3d')][_0xba6d('0x45')]({'where':{'id':_0x41f4df[_0xba6d('0x42')]['id']}})[_0xba6d('0x23')](handleEntityNotFound(_0x1d6ed0,null))['then'](removeEntity(_0x1d6ed0,null))[_0xba6d('0x40')](handleError(_0x1d6ed0,null));};exports[_0xba6d('0x48')]=function(_0x1ff541,_0xfafe40,_0x3cf6bb){var _0x5e2900={};var _0x1adcf0={};var _0x51b71d;var _0x4f646d;return db['FreshsalesConfiguration']['findOne']({'where':{'id':_0x1ff541['params']['id']}})[_0xba6d('0x23')](handleEntityNotFound(_0xfafe40,null))['then'](function(_0x34606b){if(_0x34606b){_0x51b71d=_0x34606b;_0x1adcf0[_0xba6d('0x30')]=_[_0xba6d('0x43')](db[_0xba6d('0x49')][_0xba6d('0x2a')]);_0x1adcf0[_0xba6d('0x2e')]=_[_0xba6d('0x43')](_0x1ff541[_0xba6d('0x2e')]);_0x1adcf0[_0xba6d('0x37')]=_['intersection'](_0x1adcf0[_0xba6d('0x30')],_0x1adcf0[_0xba6d('0x2e')]);_0x5e2900[_0xba6d('0x31')]=_['intersection'](_0x1adcf0[_0xba6d('0x30')],qs[_0xba6d('0x32')](_0x1ff541['query'][_0xba6d('0x32')]));_0x5e2900['attributes']=_0x5e2900[_0xba6d('0x31')]['length']?_0x5e2900['attributes']:_0x1adcf0[_0xba6d('0x30')];_0x5e2900[_0xba6d('0x4a')]=qs['sort'](_0x1ff541[_0xba6d('0x2e')][_0xba6d('0x4b')]);_0x5e2900[_0xba6d('0x39')]=qs['filters'](_[_0xba6d('0x38')](_0x1ff541['query'],_0x1adcf0['filters']));if(_0x1ff541['query'][_0xba6d('0x4c')]){_0x5e2900[_0xba6d('0x39')]=_[_0xba6d('0x3a')](_0x5e2900[_0xba6d('0x39')],{'$or':_[_0xba6d('0x29')](_0x5e2900[_0xba6d('0x31')],function(_0x3772a4){var _0x3e058f={};_0x3e058f[_0x3772a4]={'$like':'%'+_0x1ff541['query'][_0xba6d('0x4c')]+'%'};return _0x3e058f;})});}_0x5e2900=_['merge']({},_0x5e2900,_0x1ff541['options']);return _0x51b71d[_0xba6d('0x48')](_0x5e2900);}})['then'](function(_0x3b5c30){if(_0x3b5c30){_0x4f646d=_0x3b5c30[_0xba6d('0x33')];if(!_0x1ff541[_0xba6d('0x2e')][_0xba6d('0x34')](_0xba6d('0x35'))){_0x5e2900[_0xba6d('0x36')]=qs[_0xba6d('0x36')](_0x1ff541['query'][_0xba6d('0x36')]);_0x5e2900[_0xba6d('0x1d')]=qs[_0xba6d('0x1d')](_0x1ff541['query'][_0xba6d('0x1d')]);}return _0x51b71d[_0xba6d('0x48')](_0x5e2900);}})[_0xba6d('0x23')](function(_0x232b14){if(_0x232b14){return _0x232b14?{'count':_0x4f646d,'rows':_0x232b14}:null;}})[_0xba6d('0x23')](respondWithResult(_0xfafe40,null))['catch'](handleError(_0xfafe40,null));};exports[_0xba6d('0x4d')]=function(_0x417fa3,_0x55637d,_0xf48f12){var _0xc50708={};var _0x33b5db={};var _0x14d121;var _0x219efd;return db['FreshsalesConfiguration'][_0xba6d('0x4e')]({'where':{'id':_0x417fa3['params']['id']}})[_0xba6d('0x23')](handleEntityNotFound(_0x55637d,null))['then'](function(_0x4b0448){if(_0x4b0448){_0x14d121=_0x4b0448;_0x33b5db['model']=_[_0xba6d('0x43')](db['FreshsalesField'][_0xba6d('0x2a')]);_0x33b5db[_0xba6d('0x2e')]=_[_0xba6d('0x43')](_0x417fa3[_0xba6d('0x2e')]);_0x33b5db[_0xba6d('0x37')]=_['intersection'](_0x33b5db[_0xba6d('0x30')],_0x33b5db['query']);_0xc50708[_0xba6d('0x31')]=_[_0xba6d('0x2f')](_0x33b5db[_0xba6d('0x30')],qs[_0xba6d('0x32')](_0x417fa3[_0xba6d('0x2e')][_0xba6d('0x32')]));_0xc50708[_0xba6d('0x31')]=_0xc50708[_0xba6d('0x31')][_0xba6d('0x33')]?_0xc50708[_0xba6d('0x31')]:_0x33b5db[_0xba6d('0x30')];_0xc50708['order']=qs[_0xba6d('0x4b')](_0x417fa3[_0xba6d('0x2e')][_0xba6d('0x4b')]);_0xc50708['where']=qs['filters'](_[_0xba6d('0x38')](_0x417fa3[_0xba6d('0x2e')],_0x33b5db[_0xba6d('0x37')]));if(_0x417fa3[_0xba6d('0x2e')][_0xba6d('0x4c')]){_0xc50708['where']=_[_0xba6d('0x3a')](_0xc50708[_0xba6d('0x39')],{'$or':_[_0xba6d('0x29')](_0xc50708[_0xba6d('0x31')],function(_0x5d02a7){var _0x1205e4={};_0x1205e4[_0x5d02a7]={'$like':'%'+_0x417fa3[_0xba6d('0x2e')][_0xba6d('0x4c')]+'%'};return _0x1205e4;})});}_0xc50708=_[_0xba6d('0x3a')]({},_0xc50708,_0x417fa3[_0xba6d('0x4f')]);return _0x14d121[_0xba6d('0x4d')](_0xc50708);}})['then'](function(_0x301b32){if(_0x301b32){_0x219efd=_0x301b32['length'];if(!_0x417fa3[_0xba6d('0x2e')][_0xba6d('0x34')]('nolimit')){_0xc50708['limit']=qs['limit'](_0x417fa3['query']['limit']);_0xc50708[_0xba6d('0x1d')]=qs[_0xba6d('0x1d')](_0x417fa3[_0xba6d('0x2e')][_0xba6d('0x1d')]);}return _0x14d121[_0xba6d('0x4d')](_0xc50708);}})[_0xba6d('0x23')](function(_0x14e71f){if(_0x14e71f){return _0x14e71f?{'count':_0x219efd,'rows':_0x14e71f}:null;}})[_0xba6d('0x23')](respondWithResult(_0x55637d,null))[_0xba6d('0x40')](handleError(_0x55637d,null));};exports[_0xba6d('0x50')]=function(_0x4c1647,_0x231aec,_0x19cb3a){var _0x40aeb8={};var _0x42929f={};var _0x3fbf68;var _0x4bed92;return db[_0xba6d('0x3d')][_0xba6d('0x4e')]({'where':{'id':_0x4c1647['params']['id']}})[_0xba6d('0x23')](handleEntityNotFound(_0x231aec,null))['then'](function(_0xeee192){if(_0xeee192){_0x3fbf68=_0xeee192;_0x42929f[_0xba6d('0x30')]=_[_0xba6d('0x43')](db['FreshsalesField'][_0xba6d('0x2a')]);_0x42929f[_0xba6d('0x2e')]=_['keys'](_0x4c1647['query']);_0x42929f[_0xba6d('0x37')]=_['intersection'](_0x42929f[_0xba6d('0x30')],_0x42929f[_0xba6d('0x2e')]);_0x40aeb8[_0xba6d('0x31')]=_['intersection'](_0x42929f[_0xba6d('0x30')],qs[_0xba6d('0x32')](_0x4c1647['query'][_0xba6d('0x32')]));_0x40aeb8[_0xba6d('0x31')]=_0x40aeb8[_0xba6d('0x31')][_0xba6d('0x33')]?_0x40aeb8[_0xba6d('0x31')]:_0x42929f['model'];_0x40aeb8[_0xba6d('0x4a')]=qs['sort'](_0x4c1647[_0xba6d('0x2e')][_0xba6d('0x4b')]);_0x40aeb8[_0xba6d('0x39')]=qs[_0xba6d('0x37')](_['pick'](_0x4c1647[_0xba6d('0x2e')],_0x42929f[_0xba6d('0x37')]));if(_0x4c1647[_0xba6d('0x2e')][_0xba6d('0x4c')]){_0x40aeb8[_0xba6d('0x39')]=_['merge'](_0x40aeb8[_0xba6d('0x39')],{'$or':_['map'](_0x40aeb8['attributes'],function(_0x4763b7){var _0x46e78a={};_0x46e78a[_0x4763b7]={'$like':'%'+_0x4c1647[_0xba6d('0x2e')][_0xba6d('0x4c')]+'%'};return _0x46e78a;})});}_0x40aeb8=_['merge']({},_0x40aeb8,_0x4c1647[_0xba6d('0x4f')]);return _0x3fbf68[_0xba6d('0x50')](_0x40aeb8);}})[_0xba6d('0x23')](function(_0x14a3df){if(_0x14a3df){_0x4bed92=_0x14a3df[_0xba6d('0x33')];if(!_0x4c1647[_0xba6d('0x2e')][_0xba6d('0x34')](_0xba6d('0x35'))){_0x40aeb8[_0xba6d('0x36')]=qs[_0xba6d('0x36')](_0x4c1647[_0xba6d('0x2e')][_0xba6d('0x36')]);_0x40aeb8[_0xba6d('0x1d')]=qs[_0xba6d('0x1d')](_0x4c1647['query'][_0xba6d('0x1d')]);}return _0x3fbf68[_0xba6d('0x50')](_0x40aeb8);}})['then'](function(_0x1986f5){if(_0x1986f5){return _0x1986f5?{'count':_0x4bed92,'rows':_0x1986f5}:null;}})[_0xba6d('0x23')](respondWithResult(_0x231aec,null))[_0xba6d('0x40')](handleError(_0x231aec,null));}; \ No newline at end of file +var _0x47b5=['util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','then','destroy','error','stack','name','index','map','FreshsalesConfiguration','rawAttributes','fieldName','type','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','filters','filter','merge','options','includeAll','include','findAll','catch','show','params','keys','find','create','body','update','findOne','FreshsalesField','sort','getSubjects','getDescriptions','getFields','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache'];(function(_0x43f8ff,_0x43374a){var _0x3768cb=function(_0x22e6e6){while(--_0x22e6e6){_0x43f8ff['push'](_0x43f8ff['shift']());}};_0x3768cb(++_0x43374a);}(_0x47b5,0xed));var _0x547b=function(_0x3aa616,_0x172c2f){_0x3aa616=_0x3aa616-0x0;var _0x5fa4e9=_0x47b5[_0x3aa616];return _0x5fa4e9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x547b('0x0'));var zipdir=require(_0x547b('0x1'));var jsonpatch=require(_0x547b('0x2'));var rp=require(_0x547b('0x3'));var moment=require('moment');var BPromise=require(_0x547b('0x4'));var Mustache=require(_0x547b('0x5'));var util=require(_0x547b('0x6'));var path=require(_0x547b('0x7'));var sox=require(_0x547b('0x8'));var csv=require(_0x547b('0x9'));var ejs=require(_0x547b('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x547b('0xb'));var squel=require(_0x547b('0xc'));var crypto=require(_0x547b('0xd'));var jsforce=require(_0x547b('0xe'));var deskjs=require(_0x547b('0xf'));var toCsv=require(_0x547b('0x9'));var querystring=require(_0x547b('0x10'));var Papa=require(_0x547b('0x11'));var Redis=require(_0x547b('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x547b('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x547b('0x14'));var logger=require(_0x547b('0x15'))(_0x547b('0x16'));var utils=require(_0x547b('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x547b('0x18'));var db=require(_0x547b('0x19'))['db'];function respondWithStatusCode(_0x2f727c,_0x1b265e){_0x1b265e=_0x1b265e||0xcc;return function(_0x19f199){if(_0x19f199){return _0x2f727c[_0x547b('0x1a')](_0x1b265e);}return _0x2f727c['status'](_0x1b265e)[_0x547b('0x1b')]();};}function respondWithResult(_0x41e491,_0x41ccc9){_0x41ccc9=_0x41ccc9||0xc8;return function(_0x57e728){if(_0x57e728){return _0x41e491[_0x547b('0x1c')](_0x41ccc9)[_0x547b('0x1d')](_0x57e728);}};}function respondWithFilteredResult(_0x5d4c06,_0x50516b){return function(_0x3d0094){if(_0x3d0094){var _0x3d810d=typeof _0x50516b['offset']===_0x547b('0x1e')&&typeof _0x50516b[_0x547b('0x1f')]===_0x547b('0x1e');var _0xc5d6aa=_0x3d0094[_0x547b('0x20')];var _0x3e596b=_0x3d810d?0x0:_0x50516b['offset'];var _0x1ba344=_0x3d810d?_0x3d0094[_0x547b('0x20')]:_0x50516b[_0x547b('0x21')]+_0x50516b[_0x547b('0x1f')];var _0xd85ebf;if(_0x1ba344>=_0xc5d6aa){_0x1ba344=_0xc5d6aa;_0xd85ebf=0xc8;}else{_0xd85ebf=0xce;}_0x5d4c06[_0x547b('0x1c')](_0xd85ebf);return _0x5d4c06[_0x547b('0x22')](_0x547b('0x23'),_0x3e596b+'-'+_0x1ba344+'/'+_0xc5d6aa)[_0x547b('0x1d')](_0x3d0094);}return null;};}function patchUpdates(_0x2500cd){return function(_0x466f60){try{jsonpatch[_0x547b('0x24')](_0x466f60,_0x2500cd,!![]);}catch(_0x424bb0){return BPromise[_0x547b('0x25')](_0x424bb0);}return _0x466f60['save']();};}function saveUpdates(_0x16ac92,_0x2d4311){return function(_0x1501d0){if(_0x1501d0){return _0x1501d0['update'](_0x16ac92)[_0x547b('0x26')](function(_0x24beb3){return _0x24beb3;});}return null;};}function removeEntity(_0x3775cb,_0x385d8f){return function(_0xfd95f2){if(_0xfd95f2){return _0xfd95f2[_0x547b('0x27')]()[_0x547b('0x26')](function(){_0x3775cb[_0x547b('0x1c')](0xcc)[_0x547b('0x1b')]();});}};}function handleEntityNotFound(_0x36eb12,_0x55fbb5){return function(_0x14e9be){if(!_0x14e9be){_0x36eb12['sendStatus'](0x194);}return _0x14e9be;};}function handleError(_0x4ddce7,_0x55a478){_0x55a478=_0x55a478||0x1f4;return function(_0xde3a0){logger[_0x547b('0x28')](_0xde3a0[_0x547b('0x29')]);if(_0xde3a0[_0x547b('0x2a')]){delete _0xde3a0[_0x547b('0x2a')];}_0x4ddce7[_0x547b('0x1c')](_0x55a478)['send'](_0xde3a0);};}exports[_0x547b('0x2b')]=function(_0x15e9e5,_0x3c94ce){var _0x32ed30={},_0x2ec67d={},_0x1152c4={'count':0x0,'rows':[]};var _0x42c250=_[_0x547b('0x2c')](db[_0x547b('0x2d')][_0x547b('0x2e')],function(_0x1a7585){return{'name':_0x1a7585[_0x547b('0x2f')],'type':_0x1a7585[_0x547b('0x30')]['key']};});_0x2ec67d[_0x547b('0x31')]=_[_0x547b('0x2c')](_0x42c250,_0x547b('0x2a'));_0x2ec67d[_0x547b('0x32')]=_['keys'](_0x15e9e5[_0x547b('0x32')]);_0x2ec67d['filters']=_[_0x547b('0x33')](_0x2ec67d[_0x547b('0x31')],_0x2ec67d[_0x547b('0x32')]);_0x32ed30['attributes']=_[_0x547b('0x33')](_0x2ec67d[_0x547b('0x31')],qs[_0x547b('0x34')](_0x15e9e5[_0x547b('0x32')]['fields']));_0x32ed30[_0x547b('0x35')]=_0x32ed30[_0x547b('0x35')][_0x547b('0x36')]?_0x32ed30[_0x547b('0x35')]:_0x2ec67d[_0x547b('0x31')];if(!_0x15e9e5[_0x547b('0x32')][_0x547b('0x37')](_0x547b('0x38'))){_0x32ed30['limit']=qs[_0x547b('0x1f')](_0x15e9e5[_0x547b('0x32')][_0x547b('0x1f')]);_0x32ed30[_0x547b('0x21')]=qs[_0x547b('0x21')](_0x15e9e5[_0x547b('0x32')][_0x547b('0x21')]);}_0x32ed30[_0x547b('0x39')]=qs['sort'](_0x15e9e5['query']['sort']);_0x32ed30[_0x547b('0x3a')]=qs['filters'](_[_0x547b('0x3b')](_0x15e9e5[_0x547b('0x32')],_0x2ec67d[_0x547b('0x3c')]),_0x42c250);if(_0x15e9e5[_0x547b('0x32')][_0x547b('0x3d')]){_0x32ed30[_0x547b('0x3a')]=_[_0x547b('0x3e')](_0x32ed30[_0x547b('0x3a')],{'$or':_['map'](_0x42c250,function(_0x575fb5){if(_0x575fb5[_0x547b('0x30')]!=='VIRTUAL'){var _0xf02736={};_0xf02736[_0x575fb5[_0x547b('0x2a')]]={'$like':'%'+_0x15e9e5[_0x547b('0x32')][_0x547b('0x3d')]+'%'};return _0xf02736;}})});}_0x32ed30=_[_0x547b('0x3e')]({},_0x32ed30,_0x15e9e5[_0x547b('0x3f')]);var _0x3f77fe={'where':_0x32ed30[_0x547b('0x3a')]};return db[_0x547b('0x2d')][_0x547b('0x20')](_0x3f77fe)[_0x547b('0x26')](function(_0x4c8d5f){_0x1152c4['count']=_0x4c8d5f;if(_0x15e9e5[_0x547b('0x32')][_0x547b('0x40')]){_0x32ed30[_0x547b('0x41')]=[{'all':!![]}];}return db[_0x547b('0x2d')][_0x547b('0x42')](_0x32ed30);})[_0x547b('0x26')](function(_0x1ae373){_0x1152c4['rows']=_0x1ae373;return _0x1152c4;})[_0x547b('0x26')](respondWithFilteredResult(_0x3c94ce,_0x32ed30))[_0x547b('0x43')](handleError(_0x3c94ce,null));};exports[_0x547b('0x44')]=function(_0x4be153,_0xb59fbb){var _0x173dc3={'raw':![],'where':{'id':_0x4be153[_0x547b('0x45')]['id']}},_0x57277b={};_0x57277b['model']=_[_0x547b('0x46')](db[_0x547b('0x2d')][_0x547b('0x2e')]);_0x57277b[_0x547b('0x32')]=_[_0x547b('0x46')](_0x4be153[_0x547b('0x32')]);_0x57277b[_0x547b('0x3c')]=_[_0x547b('0x33')](_0x57277b[_0x547b('0x31')],_0x57277b[_0x547b('0x32')]);_0x173dc3['attributes']=_['intersection'](_0x57277b[_0x547b('0x31')],qs[_0x547b('0x34')](_0x4be153['query'][_0x547b('0x34')]));_0x173dc3[_0x547b('0x35')]=_0x173dc3['attributes'][_0x547b('0x36')]?_0x173dc3[_0x547b('0x35')]:_0x57277b[_0x547b('0x31')];if(_0x4be153[_0x547b('0x32')][_0x547b('0x40')]){_0x173dc3[_0x547b('0x41')]=[{'all':!![]}];}_0x173dc3=_['merge']({},_0x173dc3,_0x4be153[_0x547b('0x3f')]);return db[_0x547b('0x2d')][_0x547b('0x47')](_0x173dc3)['then'](handleEntityNotFound(_0xb59fbb,null))[_0x547b('0x26')](respondWithResult(_0xb59fbb,null))[_0x547b('0x43')](handleError(_0xb59fbb,null));};exports[_0x547b('0x48')]=function(_0x581666,_0x1e3757){return db[_0x547b('0x2d')][_0x547b('0x48')](_0x581666[_0x547b('0x49')],{})[_0x547b('0x26')](respondWithResult(_0x1e3757,0xc9))['catch'](handleError(_0x1e3757,null));};exports[_0x547b('0x4a')]=function(_0x33ca65,_0x2d367c){if(_0x33ca65[_0x547b('0x49')]['id']){delete _0x33ca65[_0x547b('0x49')]['id'];}return db[_0x547b('0x2d')]['find']({'where':{'id':_0x33ca65[_0x547b('0x45')]['id']}})[_0x547b('0x26')](handleEntityNotFound(_0x2d367c,null))[_0x547b('0x26')](saveUpdates(_0x33ca65[_0x547b('0x49')],null))['then'](respondWithResult(_0x2d367c,null))['catch'](handleError(_0x2d367c,null));};exports[_0x547b('0x27')]=function(_0x1c683f,_0xbbab8e){return db[_0x547b('0x2d')][_0x547b('0x47')]({'where':{'id':_0x1c683f['params']['id']}})['then'](handleEntityNotFound(_0xbbab8e,null))['then'](removeEntity(_0xbbab8e,null))[_0x547b('0x43')](handleError(_0xbbab8e,null));};exports['getSubjects']=function(_0x43a9dc,_0x3d3119,_0x57eeb6){var _0x394d90={};var _0x2ab8ba={};var _0x248c6a;var _0x1e553f;return db['FreshsalesConfiguration'][_0x547b('0x4b')]({'where':{'id':_0x43a9dc[_0x547b('0x45')]['id']}})[_0x547b('0x26')](handleEntityNotFound(_0x3d3119,null))[_0x547b('0x26')](function(_0x15d142){if(_0x15d142){_0x248c6a=_0x15d142;_0x2ab8ba['model']=_[_0x547b('0x46')](db[_0x547b('0x4c')][_0x547b('0x2e')]);_0x2ab8ba['query']=_[_0x547b('0x46')](_0x43a9dc[_0x547b('0x32')]);_0x2ab8ba[_0x547b('0x3c')]=_['intersection'](_0x2ab8ba[_0x547b('0x31')],_0x2ab8ba[_0x547b('0x32')]);_0x394d90['attributes']=_[_0x547b('0x33')](_0x2ab8ba[_0x547b('0x31')],qs['fields'](_0x43a9dc[_0x547b('0x32')][_0x547b('0x34')]));_0x394d90['attributes']=_0x394d90['attributes'][_0x547b('0x36')]?_0x394d90[_0x547b('0x35')]:_0x2ab8ba['model'];_0x394d90['order']=qs[_0x547b('0x4d')](_0x43a9dc[_0x547b('0x32')][_0x547b('0x4d')]);_0x394d90[_0x547b('0x3a')]=qs[_0x547b('0x3c')](_[_0x547b('0x3b')](_0x43a9dc[_0x547b('0x32')],_0x2ab8ba['filters']));if(_0x43a9dc[_0x547b('0x32')][_0x547b('0x3d')]){_0x394d90[_0x547b('0x3a')]=_[_0x547b('0x3e')](_0x394d90['where'],{'$or':_[_0x547b('0x2c')](_0x394d90[_0x547b('0x35')],function(_0x4f1783){var _0x5c7e0a={};_0x5c7e0a[_0x4f1783]={'$like':'%'+_0x43a9dc[_0x547b('0x32')][_0x547b('0x3d')]+'%'};return _0x5c7e0a;})});}_0x394d90=_[_0x547b('0x3e')]({},_0x394d90,_0x43a9dc['options']);return _0x248c6a[_0x547b('0x4e')](_0x394d90);}})[_0x547b('0x26')](function(_0x43075d){if(_0x43075d){_0x1e553f=_0x43075d[_0x547b('0x36')];if(!_0x43a9dc['query']['hasOwnProperty']('nolimit')){_0x394d90[_0x547b('0x1f')]=qs[_0x547b('0x1f')](_0x43a9dc[_0x547b('0x32')][_0x547b('0x1f')]);_0x394d90[_0x547b('0x21')]=qs[_0x547b('0x21')](_0x43a9dc[_0x547b('0x32')][_0x547b('0x21')]);}return _0x248c6a[_0x547b('0x4e')](_0x394d90);}})[_0x547b('0x26')](function(_0x44129d){if(_0x44129d){return _0x44129d?{'count':_0x1e553f,'rows':_0x44129d}:null;}})[_0x547b('0x26')](respondWithResult(_0x3d3119,null))[_0x547b('0x43')](handleError(_0x3d3119,null));};exports[_0x547b('0x4f')]=function(_0x5bc884,_0x4b9bf1,_0x12ec6e){var _0x18d029={};var _0x5e711e={};var _0x4c7288;var _0x2da77c;return db[_0x547b('0x2d')][_0x547b('0x4b')]({'where':{'id':_0x5bc884[_0x547b('0x45')]['id']}})['then'](handleEntityNotFound(_0x4b9bf1,null))['then'](function(_0x2d10a0){if(_0x2d10a0){_0x4c7288=_0x2d10a0;_0x5e711e[_0x547b('0x31')]=_['keys'](db[_0x547b('0x4c')]['rawAttributes']);_0x5e711e[_0x547b('0x32')]=_[_0x547b('0x46')](_0x5bc884[_0x547b('0x32')]);_0x5e711e['filters']=_[_0x547b('0x33')](_0x5e711e[_0x547b('0x31')],_0x5e711e[_0x547b('0x32')]);_0x18d029[_0x547b('0x35')]=_[_0x547b('0x33')](_0x5e711e['model'],qs['fields'](_0x5bc884['query'][_0x547b('0x34')]));_0x18d029[_0x547b('0x35')]=_0x18d029['attributes'][_0x547b('0x36')]?_0x18d029[_0x547b('0x35')]:_0x5e711e[_0x547b('0x31')];_0x18d029['order']=qs['sort'](_0x5bc884[_0x547b('0x32')][_0x547b('0x4d')]);_0x18d029[_0x547b('0x3a')]=qs[_0x547b('0x3c')](_[_0x547b('0x3b')](_0x5bc884[_0x547b('0x32')],_0x5e711e[_0x547b('0x3c')]));if(_0x5bc884['query'][_0x547b('0x3d')]){_0x18d029['where']=_[_0x547b('0x3e')](_0x18d029[_0x547b('0x3a')],{'$or':_[_0x547b('0x2c')](_0x18d029[_0x547b('0x35')],function(_0x1643c4){var _0x5a2355={};_0x5a2355[_0x1643c4]={'$like':'%'+_0x5bc884[_0x547b('0x32')]['filter']+'%'};return _0x5a2355;})});}_0x18d029=_['merge']({},_0x18d029,_0x5bc884[_0x547b('0x3f')]);return _0x4c7288['getDescriptions'](_0x18d029);}})[_0x547b('0x26')](function(_0x4122b1){if(_0x4122b1){_0x2da77c=_0x4122b1[_0x547b('0x36')];if(!_0x5bc884[_0x547b('0x32')][_0x547b('0x37')](_0x547b('0x38'))){_0x18d029['limit']=qs[_0x547b('0x1f')](_0x5bc884[_0x547b('0x32')]['limit']);_0x18d029[_0x547b('0x21')]=qs[_0x547b('0x21')](_0x5bc884['query'][_0x547b('0x21')]);}return _0x4c7288[_0x547b('0x4f')](_0x18d029);}})[_0x547b('0x26')](function(_0x362e61){if(_0x362e61){return _0x362e61?{'count':_0x2da77c,'rows':_0x362e61}:null;}})[_0x547b('0x26')](respondWithResult(_0x4b9bf1,null))[_0x547b('0x43')](handleError(_0x4b9bf1,null));};exports['getFields']=function(_0x20f4bd,_0x366b1c,_0x183419){var _0x4d5b3d={};var _0x441bd7={};var _0x12fc23;var _0x3df3d6;return db[_0x547b('0x2d')][_0x547b('0x4b')]({'where':{'id':_0x20f4bd['params']['id']}})[_0x547b('0x26')](handleEntityNotFound(_0x366b1c,null))['then'](function(_0x4c4e19){if(_0x4c4e19){_0x12fc23=_0x4c4e19;_0x441bd7['model']=_[_0x547b('0x46')](db[_0x547b('0x4c')][_0x547b('0x2e')]);_0x441bd7[_0x547b('0x32')]=_[_0x547b('0x46')](_0x20f4bd[_0x547b('0x32')]);_0x441bd7[_0x547b('0x3c')]=_['intersection'](_0x441bd7[_0x547b('0x31')],_0x441bd7[_0x547b('0x32')]);_0x4d5b3d['attributes']=_[_0x547b('0x33')](_0x441bd7['model'],qs[_0x547b('0x34')](_0x20f4bd[_0x547b('0x32')]['fields']));_0x4d5b3d[_0x547b('0x35')]=_0x4d5b3d['attributes'][_0x547b('0x36')]?_0x4d5b3d[_0x547b('0x35')]:_0x441bd7[_0x547b('0x31')];_0x4d5b3d[_0x547b('0x39')]=qs[_0x547b('0x4d')](_0x20f4bd[_0x547b('0x32')][_0x547b('0x4d')]);_0x4d5b3d[_0x547b('0x3a')]=qs[_0x547b('0x3c')](_[_0x547b('0x3b')](_0x20f4bd[_0x547b('0x32')],_0x441bd7[_0x547b('0x3c')]));if(_0x20f4bd[_0x547b('0x32')][_0x547b('0x3d')]){_0x4d5b3d['where']=_[_0x547b('0x3e')](_0x4d5b3d[_0x547b('0x3a')],{'$or':_[_0x547b('0x2c')](_0x4d5b3d[_0x547b('0x35')],function(_0x598fdd){var _0x28a7b4={};_0x28a7b4[_0x598fdd]={'$like':'%'+_0x20f4bd[_0x547b('0x32')][_0x547b('0x3d')]+'%'};return _0x28a7b4;})});}_0x4d5b3d=_[_0x547b('0x3e')]({},_0x4d5b3d,_0x20f4bd[_0x547b('0x3f')]);return _0x12fc23['getFields'](_0x4d5b3d);}})[_0x547b('0x26')](function(_0x193857){if(_0x193857){_0x3df3d6=_0x193857[_0x547b('0x36')];if(!_0x20f4bd[_0x547b('0x32')]['hasOwnProperty']('nolimit')){_0x4d5b3d[_0x547b('0x1f')]=qs[_0x547b('0x1f')](_0x20f4bd[_0x547b('0x32')][_0x547b('0x1f')]);_0x4d5b3d[_0x547b('0x21')]=qs[_0x547b('0x21')](_0x20f4bd[_0x547b('0x32')][_0x547b('0x21')]);}return _0x12fc23[_0x547b('0x50')](_0x4d5b3d);}})[_0x547b('0x26')](function(_0xb433b4){if(_0xb433b4){return _0xb433b4?{'count':_0x3df3d6,'rows':_0xb433b4}:null;}})[_0x547b('0x26')](respondWithResult(_0x366b1c,null))[_0x547b('0x43')](handleError(_0x366b1c,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 6deea7b..44fdc44 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 _0x5864=['../../config/environment','exports','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x4d8a8f,_0x2afd4c){var _0xfc4adc=function(_0xb89886){while(--_0xb89886){_0x4d8a8f['push'](_0x4d8a8f['shift']());}};_0xfc4adc(++_0x2afd4c);}(_0x5864,0xae));var _0x4586=function(_0x347db9,_0x12ed5b){_0x347db9=_0x347db9-0x0;var _0xee67ab=_0x5864[_0x347db9];return _0xee67ab;};'use strict';var _=require(_0x4586('0x0'));var util=require('util');var logger=require(_0x4586('0x1'))(_0x4586('0x2'));var moment=require(_0x4586('0x3'));var BPromise=require(_0x4586('0x4'));var rp=require(_0x4586('0x5'));var fs=require('fs');var path=require(_0x4586('0x6'));var rimraf=require(_0x4586('0x7'));var config=require(_0x4586('0x8'));var attributes=require('./intFreshsalesConfiguration.attributes');module[_0x4586('0x9')]=function(_0x3f7ba2,_0x34f78e){return _0x3f7ba2[_0x4586('0xa')](_0x4586('0xb'),attributes,{'tableName':_0x4586('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xad64=['FreshsalesConfiguration','int_freshsales_configurations','../../config/logger','moment','request-promise','../../config/environment','./intFreshsalesConfiguration.attributes','define'];(function(_0x3b5345,_0x372b39){var _0x3ba618=function(_0x5b5cc4){while(--_0x5b5cc4){_0x3b5345['push'](_0x3b5345['shift']());}};_0x3ba618(++_0x372b39);}(_0xad64,0x142));var _0x4ad6=function(_0x100095,_0x2fe3de){_0x100095=_0x100095-0x0;var _0x5935e2=_0xad64[_0x100095];return _0x5935e2;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4ad6('0x0'))('api');var moment=require(_0x4ad6('0x1'));var BPromise=require('bluebird');var rp=require(_0x4ad6('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4ad6('0x3'));var attributes=require(_0x4ad6('0x4'));module['exports']=function(_0x417179,_0x11fe46){return _0x417179[_0x4ad6('0x5')](_0x4ad6('0x6'),attributes,{'tableName':_0x4ad6('0x7'),'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 233f77c..f606448 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 _0x3335=['code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','FreshsalesConfiguration,\x20%s,\x20%s','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x292ba9,_0x4786d4){var _0x1547a5=function(_0x58522e){while(--_0x58522e){_0x292ba9['push'](_0x292ba9['shift']());}};_0x1547a5(++_0x4786d4);}(_0x3335,0x1e7));var _0x5333=function(_0x1cd674,_0x8d3638){_0x1cd674=_0x1cd674-0x0;var _0x27928f=_0x3335[_0x1cd674];return _0x27928f;};'use strict';var _=require(_0x5333('0x0'));var util=require('util');var moment=require(_0x5333('0x1'));var BPromise=require(_0x5333('0x2'));var rs=require(_0x5333('0x3'));var fs=require('fs');var Redis=require(_0x5333('0x4'));var db=require(_0x5333('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5333('0x6'))(_0x5333('0x7'));var config=require(_0x5333('0x8'));var jayson=require(_0x5333('0x9'));var client=jayson[_0x5333('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x47132a,_0x2b3b95,_0x4d377d){return new BPromise(function(_0x453e34,_0x33f8d2){return client[_0x5333('0xb')](_0x47132a,_0x4d377d)['then'](function(_0x37afb9){logger[_0x5333('0xc')](_0x5333('0xd'),_0x2b3b95,'request\x20sent');logger[_0x5333('0xe')](_0x5333('0xf'),_0x2b3b95,_0x5333('0x10'),JSON[_0x5333('0x11')](_0x37afb9));if(_0x37afb9[_0x5333('0x12')]){if(_0x37afb9[_0x5333('0x12')][_0x5333('0x13')]===0x1f4){logger[_0x5333('0x12')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x2b3b95,_0x37afb9[_0x5333('0x12')][_0x5333('0x14')]);return _0x33f8d2(_0x37afb9[_0x5333('0x12')][_0x5333('0x14')]);}logger[_0x5333('0x12')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x2b3b95,_0x37afb9[_0x5333('0x12')][_0x5333('0x14')]);return _0x453e34(_0x37afb9[_0x5333('0x12')]['message']);}else{logger[_0x5333('0xc')](_0x5333('0xd'),_0x2b3b95,_0x5333('0x10'));_0x453e34(_0x37afb9[_0x5333('0x15')]['message']);}})[_0x5333('0x16')](function(_0x5d1ae3){logger['error'](_0x5333('0xd'),_0x2b3b95,_0x5d1ae3);_0x33f8d2(_0x5d1ae3);});});} \ No newline at end of file +var _0xee5e=['then','info','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','FreshsalesConfiguration,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','jayson/promise','client','request'];(function(_0x765d7c,_0x36ffe7){var _0x464fc0=function(_0xf6ed7b){while(--_0xf6ed7b){_0x765d7c['push'](_0x765d7c['shift']());}};_0x464fc0(++_0x36ffe7);}(_0xee5e,0x14c));var _0xeee5=function(_0x338674,_0x559333){_0x338674=_0x338674-0x0;var _0x5a7931=_0xee5e[_0x338674];return _0x5a7931;};'use strict';var _=require(_0xeee5('0x0'));var util=require(_0xeee5('0x1'));var moment=require(_0xeee5('0x2'));var BPromise=require(_0xeee5('0x3'));var rs=require(_0xeee5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xeee5('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xeee5('0x6'));var config=require('../../config/environment');var jayson=require(_0xeee5('0x7'));var client=jayson[_0xeee5('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x46279a,_0x3d743e,_0x3d23e9){return new BPromise(function(_0x4ee637,_0x15b690){return client[_0xeee5('0x9')](_0x46279a,_0x3d23e9)[_0xeee5('0xa')](function(_0x47708e){logger[_0xeee5('0xb')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x3d743e,'request\x20sent');logger['debug'](_0xeee5('0xc'),_0x3d743e,_0xeee5('0xd'),JSON[_0xeee5('0xe')](_0x47708e));if(_0x47708e[_0xeee5('0xf')]){if(_0x47708e[_0xeee5('0xf')][_0xeee5('0x10')]===0x1f4){logger[_0xeee5('0xf')](_0xeee5('0x11'),_0x3d743e,_0x47708e[_0xeee5('0xf')][_0xeee5('0x12')]);return _0x15b690(_0x47708e[_0xeee5('0xf')][_0xeee5('0x12')]);}logger['error'](_0xeee5('0x11'),_0x3d743e,_0x47708e[_0xeee5('0xf')][_0xeee5('0x12')]);return _0x4ee637(_0x47708e[_0xeee5('0xf')][_0xeee5('0x12')]);}else{logger[_0xeee5('0xb')](_0xeee5('0x11'),_0x3d743e,_0xeee5('0xd'));_0x4ee637(_0x47708e['result'][_0xeee5('0x12')]);}})['catch'](function(_0x310d85){logger[_0xeee5('0xf')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x3d743e,_0x310d85);_0x15b690(_0x310d85);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index cf1c900..b5c23d6 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 _0x3d9c=['destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','/:id','show','create','put','update'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3d9c,0x134));var _0xc3d9=function(_0xb59b0e,_0x177e7d){_0xb59b0e=_0xb59b0e-0x0;var _0x39b727=_0x3d9c[_0xb59b0e];return _0x39b727;};'use strict';var multer=require(_0xc3d9('0x0'));var util=require('util');var path=require(_0xc3d9('0x1'));var timeout=require(_0xc3d9('0x2'));var express=require(_0xc3d9('0x3'));var router=express['Router']();var fs_extra=require(_0xc3d9('0x4'));var auth=require(_0xc3d9('0x5'));var interaction=require(_0xc3d9('0x6'));var config=require(_0xc3d9('0x7'));var controller=require(_0xc3d9('0x8'));router[_0xc3d9('0x9')]('/',auth[_0xc3d9('0xa')](),controller['index']);router[_0xc3d9('0x9')](_0xc3d9('0xb'),auth['isAuthenticated'](),controller[_0xc3d9('0xc')]);router['post']('/',auth[_0xc3d9('0xa')](),controller[_0xc3d9('0xd')]);router[_0xc3d9('0xe')]('/:id',auth[_0xc3d9('0xa')](),controller[_0xc3d9('0xf')]);router['delete'](_0xc3d9('0xb'),auth[_0xc3d9('0xa')](),controller[_0xc3d9('0x10')]);module[_0xc3d9('0x11')]=router; \ No newline at end of file +var _0x261b=['./intFreshsalesField.controller','isAuthenticated','index','get','/:id','show','post','create','update','delete','multer','util','fs-extra','../../components/interaction/service'];(function(_0x12d351,_0x52a9ee){var _0x212971=function(_0x47899b){while(--_0x47899b){_0x12d351['push'](_0x12d351['shift']());}};_0x212971(++_0x52a9ee);}(_0x261b,0x15a));var _0xb261=function(_0x395d0b,_0x12bb0a){_0x395d0b=_0x395d0b-0x0;var _0x255c55=_0x261b[_0x395d0b];return _0x255c55;};'use strict';var multer=require(_0xb261('0x0'));var util=require(_0xb261('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xb261('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xb261('0x3'));var config=require('../../config/environment');var controller=require(_0xb261('0x4'));router['get']('/',auth[_0xb261('0x5')](),controller[_0xb261('0x6')]);router[_0xb261('0x7')](_0xb261('0x8'),auth['isAuthenticated'](),controller[_0xb261('0x9')]);router[_0xb261('0xa')]('/',auth[_0xb261('0x5')](),controller[_0xb261('0xb')]);router['put'](_0xb261('0x8'),auth[_0xb261('0x5')](),controller[_0xb261('0xc')]);router[_0xb261('0xd')](_0xb261('0x8'),auth[_0xb261('0x5')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 5996dec..e7e0446 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 _0xb5df=['BOOLEAN','sequelize','exports','ENUM','string','STRING','variable','customVariable'];(function(_0x417f98,_0x3af1af){var _0x10dd0b=function(_0x15e16d){while(--_0x15e16d){_0x417f98['push'](_0x417f98['shift']());}};_0x10dd0b(++_0x3af1af);}(_0xb5df,0x1e1));var _0xfb5d=function(_0x5f3828,_0x42e4e4){_0x5f3828=_0x5f3828-0x0;var _0x1fac55=_0xb5df[_0x5f3828];return _0x1fac55;};'use strict';var Sequelize=require(_0xfb5d('0x0'));module[_0xfb5d('0x1')]={'type':{'type':Sequelize[_0xfb5d('0x2')](_0xfb5d('0x3'),'variable','customVariable','keyValue','picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0xfb5d('0x4')]},'key':{'type':Sequelize[_0xfb5d('0x4')]},'keyType':{'type':Sequelize[_0xfb5d('0x2')](_0xfb5d('0x3'),_0xfb5d('0x5'),_0xfb5d('0x6'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xfb5d('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe96f=['picklist','STRING','variable','customVariable','sequelize','exports','ENUM','string','keyValue'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xe96f,0xca));var _0xfe96=function(_0x25f4a8,_0x31b75c){_0x25f4a8=_0x25f4a8-0x0;var _0x434e2e=_0xe96f[_0x25f4a8];return _0x434e2e;};'use strict';var Sequelize=require(_0xfe96('0x0'));module[_0xfe96('0x1')]={'type':{'type':Sequelize[_0xfe96('0x2')](_0xfe96('0x3'),'variable','customVariable',_0xfe96('0x4'),_0xfe96('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xfe96('0x6')]},'key':{'type':Sequelize[_0xfe96('0x6')]},'keyType':{'type':Sequelize[_0xfe96('0x2')]('string',_0xfe96('0x7'),_0xfe96('0x8'))},'keyContent':{'type':Sequelize[_0xfe96('0x6')]},'idField':{'type':Sequelize[_0xfe96('0x6')]},'nameField':{'type':Sequelize[_0xfe96('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index e2ba26e..9cb8df8 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 _0x5f06=['status','end','json','offset','undefined','limit','count','set','apply','update','then','destroy','error','stack','name','send','index','map','FreshsalesField','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','options','include','rows','catch','show','keys','rawAttributes','includeAll','find','create','body','params','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x2828b3,_0x2bb499){var _0x3ddbce=function(_0x424ced){while(--_0x424ced){_0x2828b3['push'](_0x2828b3['shift']());}};_0x3ddbce(++_0x2bb499);}(_0x5f06,0x193));var _0x65f0=function(_0x231421,_0x576cd2){_0x231421=_0x231421-0x0;var _0x5b4a53=_0x5f06[_0x231421];return _0x5b4a53;};'use strict';var emlformat=require(_0x65f0('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x65f0('0x1'));var rp=require(_0x65f0('0x2'));var moment=require(_0x65f0('0x3'));var BPromise=require(_0x65f0('0x4'));var Mustache=require(_0x65f0('0x5'));var util=require('util');var path=require(_0x65f0('0x6'));var sox=require('sox');var csv=require(_0x65f0('0x7'));var ejs=require(_0x65f0('0x8'));var fs=require('fs');var fs_extra=require(_0x65f0('0x9'));var _=require(_0x65f0('0xa'));var squel=require(_0x65f0('0xb'));var crypto=require(_0x65f0('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x65f0('0xd'));var toCsv=require('to-csv');var querystring=require(_0x65f0('0xe'));var Papa=require(_0x65f0('0xf'));var Redis=require('ioredis');var authService=require(_0x65f0('0x10'));var qs=require(_0x65f0('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x65f0('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x65f0('0x13'));var config=require(_0x65f0('0x14'));var licenseUtil=require(_0x65f0('0x15'));var db=require(_0x65f0('0x16'))['db'];function respondWithStatusCode(_0x275b8b,_0x17e5a3){_0x17e5a3=_0x17e5a3||0xcc;return function(_0x444ef0){if(_0x444ef0){return _0x275b8b['sendStatus'](_0x17e5a3);}return _0x275b8b[_0x65f0('0x17')](_0x17e5a3)[_0x65f0('0x18')]();};}function respondWithResult(_0x131608,_0xd02844){_0xd02844=_0xd02844||0xc8;return function(_0x3f0e2e){if(_0x3f0e2e){return _0x131608['status'](_0xd02844)[_0x65f0('0x19')](_0x3f0e2e);}};}function respondWithFilteredResult(_0x44dd1c,_0x7d52bd){return function(_0x25c9fd){if(_0x25c9fd){var _0x5ccf6e=typeof _0x7d52bd[_0x65f0('0x1a')]===_0x65f0('0x1b')&&typeof _0x7d52bd[_0x65f0('0x1c')]===_0x65f0('0x1b');var _0x77b1b9=_0x25c9fd[_0x65f0('0x1d')];var _0x1caab8=_0x5ccf6e?0x0:_0x7d52bd[_0x65f0('0x1a')];var _0x25f64c=_0x5ccf6e?_0x25c9fd['count']:_0x7d52bd[_0x65f0('0x1a')]+_0x7d52bd['limit'];var _0x18c747;if(_0x25f64c>=_0x77b1b9){_0x25f64c=_0x77b1b9;_0x18c747=0xc8;}else{_0x18c747=0xce;}_0x44dd1c[_0x65f0('0x17')](_0x18c747);return _0x44dd1c[_0x65f0('0x1e')]('Content-Range',_0x1caab8+'-'+_0x25f64c+'/'+_0x77b1b9)[_0x65f0('0x19')](_0x25c9fd);}return null;};}function patchUpdates(_0x7094e4){return function(_0x1c2f94){try{jsonpatch[_0x65f0('0x1f')](_0x1c2f94,_0x7094e4,!![]);}catch(_0x709d82){return BPromise['reject'](_0x709d82);}return _0x1c2f94['save']();};}function saveUpdates(_0x43eab6,_0x1cfd5c){return function(_0x433534){if(_0x433534){return _0x433534[_0x65f0('0x20')](_0x43eab6)[_0x65f0('0x21')](function(_0x225268){return _0x225268;});}return null;};}function removeEntity(_0x831773,_0x1821d6){return function(_0x3f7a25){if(_0x3f7a25){return _0x3f7a25[_0x65f0('0x22')]()[_0x65f0('0x21')](function(){_0x831773['status'](0xcc)[_0x65f0('0x18')]();});}};}function handleEntityNotFound(_0x294223,_0xf5f9f6){return function(_0x319629){if(!_0x319629){_0x294223['sendStatus'](0x194);}return _0x319629;};}function handleError(_0x225d39,_0x3fc491){_0x3fc491=_0x3fc491||0x1f4;return function(_0x7d4b31){logger[_0x65f0('0x23')](_0x7d4b31[_0x65f0('0x24')]);if(_0x7d4b31[_0x65f0('0x25')]){delete _0x7d4b31[_0x65f0('0x25')];}_0x225d39[_0x65f0('0x17')](_0x3fc491)[_0x65f0('0x26')](_0x7d4b31);};}exports[_0x65f0('0x27')]=function(_0xd2e3a9,_0x181143){var _0x3c5c01={},_0x35d48c={},_0x37d287={'count':0x0,'rows':[]};var _0x279a9d=_[_0x65f0('0x28')](db[_0x65f0('0x29')]['rawAttributes'],function(_0x40587d){return{'name':_0x40587d[_0x65f0('0x2a')],'type':_0x40587d[_0x65f0('0x2b')][_0x65f0('0x2c')]};});_0x35d48c[_0x65f0('0x2d')]=_[_0x65f0('0x28')](_0x279a9d,_0x65f0('0x25'));_0x35d48c[_0x65f0('0x2e')]=_['keys'](_0xd2e3a9['query']);_0x35d48c['filters']=_[_0x65f0('0x2f')](_0x35d48c[_0x65f0('0x2d')],_0x35d48c['query']);_0x3c5c01[_0x65f0('0x30')]=_[_0x65f0('0x2f')](_0x35d48c[_0x65f0('0x2d')],qs['fields'](_0xd2e3a9[_0x65f0('0x2e')][_0x65f0('0x31')]));_0x3c5c01[_0x65f0('0x30')]=_0x3c5c01[_0x65f0('0x30')][_0x65f0('0x32')]?_0x3c5c01[_0x65f0('0x30')]:_0x35d48c[_0x65f0('0x2d')];if(!_0xd2e3a9['query'][_0x65f0('0x33')](_0x65f0('0x34'))){_0x3c5c01['limit']=qs[_0x65f0('0x1c')](_0xd2e3a9[_0x65f0('0x2e')][_0x65f0('0x1c')]);_0x3c5c01[_0x65f0('0x1a')]=qs[_0x65f0('0x1a')](_0xd2e3a9[_0x65f0('0x2e')][_0x65f0('0x1a')]);}_0x3c5c01[_0x65f0('0x35')]=qs[_0x65f0('0x36')](_0xd2e3a9[_0x65f0('0x2e')][_0x65f0('0x36')]);_0x3c5c01[_0x65f0('0x37')]=qs[_0x65f0('0x38')](_['pick'](_0xd2e3a9['query'],_0x35d48c[_0x65f0('0x38')]),_0x279a9d);if(_0xd2e3a9[_0x65f0('0x2e')][_0x65f0('0x39')]){_0x3c5c01[_0x65f0('0x37')]=_[_0x65f0('0x3a')](_0x3c5c01[_0x65f0('0x37')],{'$or':_[_0x65f0('0x28')](_0x279a9d,function(_0x8e699){if(_0x8e699[_0x65f0('0x2b')]!=='VIRTUAL'){var _0x370ded={};_0x370ded[_0x8e699[_0x65f0('0x25')]]={'$like':'%'+_0xd2e3a9[_0x65f0('0x2e')][_0x65f0('0x39')]+'%'};return _0x370ded;}})});}_0x3c5c01=_['merge']({},_0x3c5c01,_0xd2e3a9[_0x65f0('0x3b')]);var _0x3e8f3f={'where':_0x3c5c01[_0x65f0('0x37')]};return db[_0x65f0('0x29')][_0x65f0('0x1d')](_0x3e8f3f)[_0x65f0('0x21')](function(_0x3f682b){_0x37d287['count']=_0x3f682b;if(_0xd2e3a9[_0x65f0('0x2e')]['includeAll']){_0x3c5c01[_0x65f0('0x3c')]=[{'all':!![]}];}return db[_0x65f0('0x29')]['findAll'](_0x3c5c01);})[_0x65f0('0x21')](function(_0x3575b7){_0x37d287[_0x65f0('0x3d')]=_0x3575b7;return _0x37d287;})['then'](respondWithFilteredResult(_0x181143,_0x3c5c01))[_0x65f0('0x3e')](handleError(_0x181143,null));};exports[_0x65f0('0x3f')]=function(_0x14de05,_0x304a86){var _0x2f9e0b={'raw':!![],'where':{'id':_0x14de05['params']['id']}},_0x41ca50={};_0x41ca50[_0x65f0('0x2d')]=_[_0x65f0('0x40')](db[_0x65f0('0x29')][_0x65f0('0x41')]);_0x41ca50[_0x65f0('0x2e')]=_[_0x65f0('0x40')](_0x14de05['query']);_0x41ca50['filters']=_[_0x65f0('0x2f')](_0x41ca50[_0x65f0('0x2d')],_0x41ca50[_0x65f0('0x2e')]);_0x2f9e0b['attributes']=_[_0x65f0('0x2f')](_0x41ca50[_0x65f0('0x2d')],qs[_0x65f0('0x31')](_0x14de05['query'][_0x65f0('0x31')]));_0x2f9e0b['attributes']=_0x2f9e0b[_0x65f0('0x30')][_0x65f0('0x32')]?_0x2f9e0b[_0x65f0('0x30')]:_0x41ca50[_0x65f0('0x2d')];if(_0x14de05[_0x65f0('0x2e')][_0x65f0('0x42')]){_0x2f9e0b[_0x65f0('0x3c')]=[{'all':!![]}];}_0x2f9e0b=_[_0x65f0('0x3a')]({},_0x2f9e0b,_0x14de05['options']);return db[_0x65f0('0x29')][_0x65f0('0x43')](_0x2f9e0b)[_0x65f0('0x21')](handleEntityNotFound(_0x304a86,null))[_0x65f0('0x21')](respondWithResult(_0x304a86,null))['catch'](handleError(_0x304a86,null));};exports[_0x65f0('0x44')]=function(_0x3ebb62,_0x3c84b7){return db['FreshsalesField']['create'](_0x3ebb62[_0x65f0('0x45')],{})['then'](respondWithResult(_0x3c84b7,0xc9))['catch'](handleError(_0x3c84b7,null));};exports[_0x65f0('0x20')]=function(_0x4cbd52,_0x59d246){if(_0x4cbd52[_0x65f0('0x45')]['id']){delete _0x4cbd52[_0x65f0('0x45')]['id'];}return db[_0x65f0('0x29')]['find']({'where':{'id':_0x4cbd52['params']['id']}})[_0x65f0('0x21')](handleEntityNotFound(_0x59d246,null))[_0x65f0('0x21')](saveUpdates(_0x4cbd52[_0x65f0('0x45')],null))[_0x65f0('0x21')](respondWithResult(_0x59d246,null))[_0x65f0('0x3e')](handleError(_0x59d246,null));};exports['destroy']=function(_0x30b8b3,_0x353d5d){return db[_0x65f0('0x29')][_0x65f0('0x43')]({'where':{'id':_0x30b8b3[_0x65f0('0x46')]['id']}})[_0x65f0('0x21')](handleEntityNotFound(_0x353d5d,null))[_0x65f0('0x21')](removeEntity(_0x353d5d,null))[_0x65f0('0x3e')](handleError(_0x353d5d,null));}; \ No newline at end of file +var _0x5bea=['name','index','map','FreshsalesField','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','filter','where','merge','includeAll','include','findAll','rows','catch','show','params','intersection','length','options','find','create','body','destroy','rimraf','request-promise','moment','bluebird','sox','to-csv','ejs','fs-extra','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','reject','save','update','then','stack'];(function(_0x2aefb6,_0x1bd384){var _0x202772=function(_0x507d3f){while(--_0x507d3f){_0x2aefb6['push'](_0x2aefb6['shift']());}};_0x202772(++_0x1bd384);}(_0x5bea,0xad));var _0xa5be=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x5bea[_0x4e676e];return _0x336a3c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa5be('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa5be('0x1'));var moment=require(_0xa5be('0x2'));var BPromise=require(_0xa5be('0x3'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xa5be('0x4'));var csv=require(_0xa5be('0x5'));var ejs=require(_0xa5be('0x6'));var fs=require('fs');var fs_extra=require(_0xa5be('0x7'));var _=require('lodash');var squel=require(_0xa5be('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa5be('0x9'));var toCsv=require(_0xa5be('0x5'));var querystring=require(_0xa5be('0xa'));var Papa=require(_0xa5be('0xb'));var Redis=require(_0xa5be('0xc'));var authService=require(_0xa5be('0xd'));var qs=require(_0xa5be('0xe'));var as=require(_0xa5be('0xf'));var hardwareService=require(_0xa5be('0x10'));var logger=require(_0xa5be('0x11'))(_0xa5be('0x12'));var utils=require(_0xa5be('0x13'));var config=require(_0xa5be('0x14'));var licenseUtil=require(_0xa5be('0x15'));var db=require(_0xa5be('0x16'))['db'];function respondWithStatusCode(_0x4cf114,_0x1b8654){_0x1b8654=_0x1b8654||0xcc;return function(_0x350750){if(_0x350750){return _0x4cf114[_0xa5be('0x17')](_0x1b8654);}return _0x4cf114[_0xa5be('0x18')](_0x1b8654)[_0xa5be('0x19')]();};}function respondWithResult(_0x5b82a7,_0x17431e){_0x17431e=_0x17431e||0xc8;return function(_0x16e8da){if(_0x16e8da){return _0x5b82a7[_0xa5be('0x18')](_0x17431e)['json'](_0x16e8da);}};}function respondWithFilteredResult(_0x510d09,_0x2ce2f4){return function(_0x544067){if(_0x544067){var _0x506bc5=typeof _0x2ce2f4[_0xa5be('0x1a')]===_0xa5be('0x1b')&&typeof _0x2ce2f4[_0xa5be('0x1c')]==='undefined';var _0x5aa752=_0x544067[_0xa5be('0x1d')];var _0x16e0bd=_0x506bc5?0x0:_0x2ce2f4[_0xa5be('0x1a')];var _0xf4413=_0x506bc5?_0x544067['count']:_0x2ce2f4['offset']+_0x2ce2f4['limit'];var _0x58bde8;if(_0xf4413>=_0x5aa752){_0xf4413=_0x5aa752;_0x58bde8=0xc8;}else{_0x58bde8=0xce;}_0x510d09[_0xa5be('0x18')](_0x58bde8);return _0x510d09[_0xa5be('0x1e')]('Content-Range',_0x16e0bd+'-'+_0xf4413+'/'+_0x5aa752)[_0xa5be('0x1f')](_0x544067);}return null;};}function patchUpdates(_0x1185ab){return function(_0x2d7310){try{jsonpatch['apply'](_0x2d7310,_0x1185ab,!![]);}catch(_0x51bc04){return BPromise[_0xa5be('0x20')](_0x51bc04);}return _0x2d7310[_0xa5be('0x21')]();};}function saveUpdates(_0x26ea72,_0x3fb757){return function(_0x12fd9c){if(_0x12fd9c){return _0x12fd9c[_0xa5be('0x22')](_0x26ea72)[_0xa5be('0x23')](function(_0x1f504c){return _0x1f504c;});}return null;};}function removeEntity(_0x418ac2,_0x3fa5f8){return function(_0x3ca51d){if(_0x3ca51d){return _0x3ca51d['destroy']()['then'](function(){_0x418ac2[_0xa5be('0x18')](0xcc)[_0xa5be('0x19')]();});}};}function handleEntityNotFound(_0x18d76d,_0x451f4b){return function(_0x5b4a7b){if(!_0x5b4a7b){_0x18d76d[_0xa5be('0x17')](0x194);}return _0x5b4a7b;};}function handleError(_0x5d0dad,_0x39ee88){_0x39ee88=_0x39ee88||0x1f4;return function(_0x3662ab){logger['error'](_0x3662ab[_0xa5be('0x24')]);if(_0x3662ab['name']){delete _0x3662ab[_0xa5be('0x25')];}_0x5d0dad['status'](_0x39ee88)['send'](_0x3662ab);};}exports[_0xa5be('0x26')]=function(_0x10c53f,_0x365c15){var _0x460393={},_0x288ee3={},_0x40e714={'count':0x0,'rows':[]};var _0x3dc6a9=_[_0xa5be('0x27')](db[_0xa5be('0x28')][_0xa5be('0x29')],function(_0x33da18){return{'name':_0x33da18[_0xa5be('0x2a')],'type':_0x33da18[_0xa5be('0x2b')][_0xa5be('0x2c')]};});_0x288ee3[_0xa5be('0x2d')]=_['map'](_0x3dc6a9,'name');_0x288ee3[_0xa5be('0x2e')]=_[_0xa5be('0x2f')](_0x10c53f[_0xa5be('0x2e')]);_0x288ee3[_0xa5be('0x30')]=_['intersection'](_0x288ee3['model'],_0x288ee3[_0xa5be('0x2e')]);_0x460393[_0xa5be('0x31')]=_['intersection'](_0x288ee3[_0xa5be('0x2d')],qs['fields'](_0x10c53f[_0xa5be('0x2e')][_0xa5be('0x32')]));_0x460393[_0xa5be('0x31')]=_0x460393['attributes']['length']?_0x460393['attributes']:_0x288ee3['model'];if(!_0x10c53f['query'][_0xa5be('0x33')](_0xa5be('0x34'))){_0x460393['limit']=qs[_0xa5be('0x1c')](_0x10c53f[_0xa5be('0x2e')][_0xa5be('0x1c')]);_0x460393[_0xa5be('0x1a')]=qs['offset'](_0x10c53f[_0xa5be('0x2e')]['offset']);}_0x460393['order']=qs['sort'](_0x10c53f['query']['sort']);_0x460393['where']=qs['filters'](_['pick'](_0x10c53f[_0xa5be('0x2e')],_0x288ee3['filters']),_0x3dc6a9);if(_0x10c53f[_0xa5be('0x2e')][_0xa5be('0x35')]){_0x460393[_0xa5be('0x36')]=_[_0xa5be('0x37')](_0x460393[_0xa5be('0x36')],{'$or':_[_0xa5be('0x27')](_0x3dc6a9,function(_0x23a84d){if(_0x23a84d[_0xa5be('0x2b')]!=='VIRTUAL'){var _0x4b2f57={};_0x4b2f57[_0x23a84d[_0xa5be('0x25')]]={'$like':'%'+_0x10c53f[_0xa5be('0x2e')]['filter']+'%'};return _0x4b2f57;}})});}_0x460393=_['merge']({},_0x460393,_0x10c53f['options']);var _0x3a9216={'where':_0x460393[_0xa5be('0x36')]};return db['FreshsalesField'][_0xa5be('0x1d')](_0x3a9216)[_0xa5be('0x23')](function(_0x23d4a1){_0x40e714[_0xa5be('0x1d')]=_0x23d4a1;if(_0x10c53f[_0xa5be('0x2e')][_0xa5be('0x38')]){_0x460393[_0xa5be('0x39')]=[{'all':!![]}];}return db[_0xa5be('0x28')][_0xa5be('0x3a')](_0x460393);})[_0xa5be('0x23')](function(_0x3a9997){_0x40e714[_0xa5be('0x3b')]=_0x3a9997;return _0x40e714;})[_0xa5be('0x23')](respondWithFilteredResult(_0x365c15,_0x460393))[_0xa5be('0x3c')](handleError(_0x365c15,null));};exports[_0xa5be('0x3d')]=function(_0x2bb560,_0x1105cb){var _0x5c3400={'raw':!![],'where':{'id':_0x2bb560[_0xa5be('0x3e')]['id']}},_0x223c3a={};_0x223c3a[_0xa5be('0x2d')]=_['keys'](db['FreshsalesField'][_0xa5be('0x29')]);_0x223c3a[_0xa5be('0x2e')]=_[_0xa5be('0x2f')](_0x2bb560[_0xa5be('0x2e')]);_0x223c3a['filters']=_['intersection'](_0x223c3a[_0xa5be('0x2d')],_0x223c3a[_0xa5be('0x2e')]);_0x5c3400['attributes']=_[_0xa5be('0x3f')](_0x223c3a[_0xa5be('0x2d')],qs[_0xa5be('0x32')](_0x2bb560['query']['fields']));_0x5c3400[_0xa5be('0x31')]=_0x5c3400[_0xa5be('0x31')][_0xa5be('0x40')]?_0x5c3400['attributes']:_0x223c3a[_0xa5be('0x2d')];if(_0x2bb560[_0xa5be('0x2e')]['includeAll']){_0x5c3400['include']=[{'all':!![]}];}_0x5c3400=_[_0xa5be('0x37')]({},_0x5c3400,_0x2bb560[_0xa5be('0x41')]);return db[_0xa5be('0x28')][_0xa5be('0x42')](_0x5c3400)[_0xa5be('0x23')](handleEntityNotFound(_0x1105cb,null))[_0xa5be('0x23')](respondWithResult(_0x1105cb,null))[_0xa5be('0x3c')](handleError(_0x1105cb,null));};exports[_0xa5be('0x43')]=function(_0x1b0109,_0x1749ad){return db[_0xa5be('0x28')][_0xa5be('0x43')](_0x1b0109[_0xa5be('0x44')],{})[_0xa5be('0x23')](respondWithResult(_0x1749ad,0xc9))[_0xa5be('0x3c')](handleError(_0x1749ad,null));};exports[_0xa5be('0x22')]=function(_0x1a5126,_0x632320){if(_0x1a5126[_0xa5be('0x44')]['id']){delete _0x1a5126[_0xa5be('0x44')]['id'];}return db[_0xa5be('0x28')][_0xa5be('0x42')]({'where':{'id':_0x1a5126['params']['id']}})[_0xa5be('0x23')](handleEntityNotFound(_0x632320,null))[_0xa5be('0x23')](saveUpdates(_0x1a5126['body'],null))['then'](respondWithResult(_0x632320,null))[_0xa5be('0x3c')](handleError(_0x632320,null));};exports[_0xa5be('0x45')]=function(_0x3bdc7b,_0x4686da){return db[_0xa5be('0x28')]['find']({'where':{'id':_0x3bdc7b[_0xa5be('0x3e')]['id']}})[_0xa5be('0x23')](handleEntityNotFound(_0x4686da,null))[_0xa5be('0x23')](removeEntity(_0x4686da,null))[_0xa5be('0x3c')](handleError(_0x4686da,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 0f5e92c..36f928b 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 _0xc00b=['FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','FieldId','lodash','moment','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x160148,_0x5c0639){var _0x5d4a2c=function(_0x4e4317){while(--_0x4e4317){_0x160148['push'](_0x160148['shift']());}};_0x5d4a2c(++_0x5c0639);}(_0xc00b,0x1e5));var _0xbc00=function(_0x37a3f3,_0x663b49){_0x37a3f3=_0x37a3f3-0x0;var _0x4da923=_0xc00b[_0x37a3f3];return _0x4da923;};'use strict';var _=require(_0xbc00('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xbc00('0x1'));var BPromise=require('bluebird');var rp=require(_0xbc00('0x2'));var fs=require('fs');var path=require(_0xbc00('0x3'));var rimraf=require(_0xbc00('0x4'));var config=require(_0xbc00('0x5'));var attributes=require('./intFreshsalesField.attributes');module[_0xbc00('0x6')]=function(_0x5b47bf,_0x1cc85f){return _0x5b47bf['define'](_0xbc00('0x7'),attributes,{'tableName':_0xbc00('0x8'),'paranoid':![],'indexes':[{'name':_0xbc00('0x9'),'fields':[_0xbc00('0xa'),_0xbc00('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0e21=['api','bluebird','request-promise','path','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','util','../../config/logger'];(function(_0x2c4293,_0xe10ec4){var _0x126bda=function(_0x21df6){while(--_0x21df6){_0x2c4293['push'](_0x2c4293['shift']());}};_0x126bda(++_0xe10ec4);}(_0x0e21,0xe8));var _0x10e2=function(_0x5eb7b1,_0x124f3f){_0x5eb7b1=_0x5eb7b1-0x0;var _0x4673ef=_0x0e21[_0x5eb7b1];return _0x4673ef;};'use strict';var _=require('lodash');var util=require(_0x10e2('0x0'));var logger=require(_0x10e2('0x1'))(_0x10e2('0x2'));var moment=require('moment');var BPromise=require(_0x10e2('0x3'));var rp=require(_0x10e2('0x4'));var fs=require('fs');var path=require(_0x10e2('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x10e2('0x6'));module[_0x10e2('0x7')]=function(_0x2fb9e4,_0x44e30e){return _0x2fb9e4[_0x10e2('0x8')](_0x10e2('0x9'),attributes,{'tableName':_0x10e2('0xa'),'paranoid':![],'indexes':[{'name':_0x10e2('0xb'),'fields':[_0x10e2('0xc'),'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 d36de01..3e00e28 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 _0xbd51=['FreshsalesField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/environment','jayson/promise','client','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x31b702,_0x45394c){_0x31b702=_0x31b702-0x0;var _0x3b4a44=_0xbd51[_0x31b702];return _0x3b4a44;};'use strict';var _=require(_0x1bd5('0x0'));var util=require('util');var moment=require(_0x1bd5('0x1'));var BPromise=require(_0x1bd5('0x2'));var rs=require(_0x1bd5('0x3'));var fs=require('fs');var Redis=require(_0x1bd5('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x1bd5('0x5'));var jayson=require(_0x1bd5('0x6'));var client=jayson[_0x1bd5('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x29abea,_0x30a385,_0x19077c){return new BPromise(function(_0x27d58f,_0xd8418f){return client['request'](_0x29abea,_0x19077c)[_0x1bd5('0x8')](function(_0x5c8e0d){logger[_0x1bd5('0x9')](_0x1bd5('0xa'),_0x30a385,_0x1bd5('0xb'));logger[_0x1bd5('0xc')](_0x1bd5('0xd'),_0x30a385,_0x1bd5('0xb'),JSON['stringify'](_0x5c8e0d));if(_0x5c8e0d[_0x1bd5('0xe')]){if(_0x5c8e0d['error'][_0x1bd5('0xf')]===0x1f4){logger[_0x1bd5('0xe')](_0x1bd5('0xa'),_0x30a385,_0x5c8e0d[_0x1bd5('0xe')][_0x1bd5('0x10')]);return _0xd8418f(_0x5c8e0d[_0x1bd5('0xe')][_0x1bd5('0x10')]);}logger['error']('FreshsalesField,\x20%s,\x20%s',_0x30a385,_0x5c8e0d[_0x1bd5('0xe')][_0x1bd5('0x10')]);return _0x27d58f(_0x5c8e0d[_0x1bd5('0xe')][_0x1bd5('0x10')]);}else{logger['info']('FreshsalesField,\x20%s,\x20%s',_0x30a385,_0x1bd5('0xb'));_0x27d58f(_0x5c8e0d[_0x1bd5('0x11')][_0x1bd5('0x10')]);}})[_0x1bd5('0x12')](function(_0x43ea3e){logger[_0x1bd5('0xe')](_0x1bd5('0xa'),_0x30a385,_0x43ea3e);_0xd8418f(_0x43ea3e);});});} \ No newline at end of file +var _0xf494=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','FreshsalesField,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xf494,0x1c6));var _0x4f49=function(_0x4105f9,_0x480c1c){_0x4105f9=_0x4105f9-0x0;var _0x5d60e1=_0xf494[_0x4105f9];return _0x5d60e1;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var moment=require(_0x4f49('0x2'));var BPromise=require('bluebird');var rs=require(_0x4f49('0x3'));var fs=require('fs');var Redis=require(_0x4f49('0x4'));var db=require(_0x4f49('0x5'))['db'];var utils=require(_0x4f49('0x6'));var logger=require(_0x4f49('0x7'))(_0x4f49('0x8'));var config=require(_0x4f49('0x9'));var jayson=require(_0x4f49('0xa'));var client=jayson[_0x4f49('0xb')][_0x4f49('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x42b0e8,_0x5eb186,_0x58e9a0){return new BPromise(function(_0x169c95,_0x327bd5){return client[_0x4f49('0xd')](_0x42b0e8,_0x58e9a0)[_0x4f49('0xe')](function(_0x185174){logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,_0x4f49('0x11'));logger['debug'](_0x4f49('0x12'),_0x5eb186,_0x4f49('0x11'),JSON['stringify'](_0x185174));if(_0x185174[_0x4f49('0x13')]){if(_0x185174['error']['code']===0x1f4){logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174['error'][_0x4f49('0x14')]);return _0x327bd5(_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);}logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);return _0x169c95(_0x185174['error'][_0x4f49('0x14')]);}else{logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,'request\x20sent');_0x169c95(_0x185174['result'][_0x4f49('0x14')]);}})[_0x4f49('0x15')](function(_0x74886e){logger['error'](_0x4f49('0x10'),_0x5eb186,_0x74886e);_0x327bd5(_0x74886e);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 2aa3567..2402a0f 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(_0x2bc745,_0x527838){var _0x5aa0d4=function(_0x2f4927){while(--_0x2f4927){_0x2bc745['push'](_0x2bc745['shift']());}};_0x5aa0d4(++_0x527838);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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(_0x59900f,_0x1eed47){var _0x495ca3=function(_0x2ae5b9){while(--_0x2ae5b9){_0x59900f['push'](_0x59900f['shift']());}};_0x495ca3(++_0x1eed47);}(_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/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 cedadd7..c474e20 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 _0x4c4a=['ENUM','integrationTab','sequelize','exports','STRING','username'];(function(_0x1a2fe6,_0x2d6e5a){var _0x3a6762=function(_0x3eda87){while(--_0x3eda87){_0x1a2fe6['push'](_0x1a2fe6['shift']());}};_0x3a6762(++_0x2d6e5a);}(_0x4c4a,0x1d0));var _0xa4c4=function(_0x4681e4,_0x5d1bb8){_0x4681e4=_0x4681e4-0x0;var _0x146246=_0x4c4a[_0x4681e4];return _0x146246;};'use strict';var Sequelize=require(_0xa4c4('0x0'));module[_0xa4c4('0x1')]={'name':{'type':Sequelize[_0xa4c4('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xa4c4('0x2')],'unique':_0xa4c4('0x3')},'remoteUri':{'type':Sequelize[_0xa4c4('0x2')]},'password':{'type':Sequelize[_0xa4c4('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xa4c4('0x2')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xa4c4('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xa4c4('0x4')]('integrationTab','newTab'),'defaultValue':_0xa4c4('0x5')}}; \ No newline at end of file +var _0x88f8=['integrationTab','newTab','exports','STRING','ENUM'];(function(_0x588292,_0x5f56de){var _0x47f713=function(_0x192594){while(--_0x192594){_0x588292['push'](_0x588292['shift']());}};_0x47f713(++_0x5f56de);}(_0x88f8,0xd4));var _0x888f=function(_0x459ce9,_0x487ddf){_0x459ce9=_0x459ce9-0x0;var _0x2e2227=_0x88f8[_0x459ce9];return _0x2e2227;};'use strict';var Sequelize=require('sequelize');module[_0x888f('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x888f('0x1')]},'username':{'type':Sequelize[_0x888f('0x1')],'unique':'username'},'remoteUri':{'type':Sequelize[_0x888f('0x1')]},'password':{'type':Sequelize[_0x888f('0x1')]},'clientId':{'type':Sequelize[_0x888f('0x1')]},'clientSecret':{'type':Sequelize[_0x888f('0x1')]},'securityToken':{'type':Sequelize[_0x888f('0x1')]},'serverUrl':{'type':Sequelize[_0x888f('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x888f('0x2')](_0x888f('0x3'),_0x888f('0x4')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 807016d..1582f91 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 _0xd687=['fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','end','status','limit','undefined','count','offset','set','json','apply','reject','update','then','error','name','send','rawAttributes','fieldName','type','map','keys','query','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','SalesforceAccount','include','findAll','rows','catch','show','params','length','includeAll','create','body','find','getConfigurations','findOne','addConfiguration','Subjects','getSubjects','getDescriptions','channel','SalesforceConfiguration','SalesforceField','Descriptions','Task','remoteUri','clientId','clientSecret','password','slice','substring','lastIndexOf','login','securityToken','isNil','ticketType','describe','OwnerId','IsReminderSet','IsRecurrence','Subject','Description','string','int','picklist','boolean','email','textarea','remove','includes','picklistValues','value','True','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','rimraf','zip-dir'];(function(_0x469393,_0x247969){var _0x5f720d=function(_0x40aeb3){while(--_0x40aeb3){_0x469393['push'](_0x469393['shift']());}};_0x5f720d(++_0x247969);}(_0xd687,0xec));var _0x7d68=function(_0x3d5fdc,_0x12bdfc){_0x3d5fdc=_0x3d5fdc-0x0;var _0x2a0a34=_0xd687[_0x3d5fdc];return _0x2a0a34;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7d68('0x0'));var zipdir=require(_0x7d68('0x1'));var jsonpatch=require(_0x7d68('0x2'));var rp=require(_0x7d68('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7d68('0x4'));var util=require(_0x7d68('0x5'));var path=require('path');var sox=require(_0x7d68('0x6'));var csv=require(_0x7d68('0x7'));var ejs=require(_0x7d68('0x8'));var fs=require('fs');var fs_extra=require(_0x7d68('0x9'));var _=require(_0x7d68('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7d68('0xb'));var deskjs=require(_0x7d68('0xc'));var toCsv=require(_0x7d68('0x7'));var querystring=require(_0x7d68('0xd'));var Papa=require(_0x7d68('0xe'));var Redis=require(_0x7d68('0xf'));var authService=require(_0x7d68('0x10'));var qs=require(_0x7d68('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7d68('0x12'));var logger=require(_0x7d68('0x13'))(_0x7d68('0x14'));var utils=require(_0x7d68('0x15'));var config=require(_0x7d68('0x16'));var licenseUtil=require(_0x7d68('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x7d68('0x18'));function respondWithStatusCode(_0x5bb4f8,_0x3e3530){_0x3e3530=_0x3e3530||0xcc;return function(_0x3cb16e){if(_0x3cb16e){return _0x5bb4f8['sendStatus'](_0x3e3530);}return _0x5bb4f8['status'](_0x3e3530)[_0x7d68('0x19')]();};}function respondWithResult(_0x177434,_0x3a4e3b){_0x3a4e3b=_0x3a4e3b||0xc8;return function(_0x2fdd7f){if(_0x2fdd7f){return _0x177434[_0x7d68('0x1a')](_0x3a4e3b)['json'](_0x2fdd7f);}};}function respondWithFilteredResult(_0x4c01fe,_0x277d22){return function(_0x15b6f9){if(_0x15b6f9){var _0x188aaa=typeof _0x277d22['offset']==='undefined'&&typeof _0x277d22[_0x7d68('0x1b')]===_0x7d68('0x1c');var _0x292086=_0x15b6f9[_0x7d68('0x1d')];var _0xb3c6dc=_0x188aaa?0x0:_0x277d22[_0x7d68('0x1e')];var _0x1501e2=_0x188aaa?_0x15b6f9[_0x7d68('0x1d')]:_0x277d22[_0x7d68('0x1e')]+_0x277d22[_0x7d68('0x1b')];var _0x7b98ae;if(_0x1501e2>=_0x292086){_0x1501e2=_0x292086;_0x7b98ae=0xc8;}else{_0x7b98ae=0xce;}_0x4c01fe[_0x7d68('0x1a')](_0x7b98ae);return _0x4c01fe[_0x7d68('0x1f')]('Content-Range',_0xb3c6dc+'-'+_0x1501e2+'/'+_0x292086)[_0x7d68('0x20')](_0x15b6f9);}return null;};}function patchUpdates(_0x1262d0){return function(_0x7946d){try{jsonpatch[_0x7d68('0x21')](_0x7946d,_0x1262d0,!![]);}catch(_0x59caf3){return BPromise[_0x7d68('0x22')](_0x59caf3);}return _0x7946d['save']();};}function saveUpdates(_0x34c76e,_0x59096e){return function(_0x4467a5){if(_0x4467a5){return _0x4467a5[_0x7d68('0x23')](_0x34c76e)[_0x7d68('0x24')](function(_0x4443dc){return _0x4443dc;});}return null;};}function removeEntity(_0x4d12d7,_0x2962c7){return function(_0x3409c0){if(_0x3409c0){return _0x3409c0['destroy']()[_0x7d68('0x24')](function(){_0x4d12d7[_0x7d68('0x1a')](0xcc)[_0x7d68('0x19')]();});}};}function handleEntityNotFound(_0xd741fb,_0x1f1b80){return function(_0x51c8b0){if(!_0x51c8b0){_0xd741fb['sendStatus'](0x194);}return _0x51c8b0;};}function handleError(_0x514f31,_0x351740){_0x351740=_0x351740||0x1f4;return function(_0x36ff5d){logger[_0x7d68('0x25')](_0x36ff5d['stack']);if(_0x36ff5d[_0x7d68('0x26')]){delete _0x36ff5d[_0x7d68('0x26')];}_0x514f31['status'](_0x351740)[_0x7d68('0x27')](_0x36ff5d);};}exports['index']=function(_0x138b47,_0x143560){var _0x359a0a={},_0x1ff3cd={},_0x17af0f={'count':0x0,'rows':[]};var _0x4bfa01=_['map'](db['SalesforceAccount'][_0x7d68('0x28')],function(_0x36e258){return{'name':_0x36e258[_0x7d68('0x29')],'type':_0x36e258[_0x7d68('0x2a')]['key']};});_0x1ff3cd['model']=_[_0x7d68('0x2b')](_0x4bfa01,_0x7d68('0x26'));_0x1ff3cd['query']=_[_0x7d68('0x2c')](_0x138b47[_0x7d68('0x2d')]);_0x1ff3cd['filters']=_[_0x7d68('0x2e')](_0x1ff3cd[_0x7d68('0x2f')],_0x1ff3cd[_0x7d68('0x2d')]);_0x359a0a[_0x7d68('0x30')]=_[_0x7d68('0x2e')](_0x1ff3cd['model'],qs['fields'](_0x138b47['query'][_0x7d68('0x31')]));_0x359a0a['attributes']=_0x359a0a[_0x7d68('0x30')]['length']?_0x359a0a[_0x7d68('0x30')]:_0x1ff3cd[_0x7d68('0x2f')];if(!_0x138b47[_0x7d68('0x2d')][_0x7d68('0x32')](_0x7d68('0x33'))){_0x359a0a[_0x7d68('0x1b')]=qs['limit'](_0x138b47[_0x7d68('0x2d')][_0x7d68('0x1b')]);_0x359a0a['offset']=qs[_0x7d68('0x1e')](_0x138b47[_0x7d68('0x2d')]['offset']);}_0x359a0a[_0x7d68('0x34')]=qs[_0x7d68('0x35')](_0x138b47['query'][_0x7d68('0x35')]);_0x359a0a[_0x7d68('0x36')]=qs[_0x7d68('0x37')](_[_0x7d68('0x38')](_0x138b47[_0x7d68('0x2d')],_0x1ff3cd[_0x7d68('0x37')]),_0x4bfa01);if(_0x138b47['query'][_0x7d68('0x39')]){_0x359a0a[_0x7d68('0x36')]=_[_0x7d68('0x3a')](_0x359a0a[_0x7d68('0x36')],{'$or':_[_0x7d68('0x2b')](_0x4bfa01,function(_0x3d42ea){if(_0x3d42ea['type']!==_0x7d68('0x3b')){var _0x8db6be={};_0x8db6be[_0x3d42ea[_0x7d68('0x26')]]={'$like':'%'+_0x138b47['query'][_0x7d68('0x39')]+'%'};return _0x8db6be;}})});}_0x359a0a=_[_0x7d68('0x3a')]({},_0x359a0a,_0x138b47[_0x7d68('0x3c')]);var _0x5224b7={'where':_0x359a0a['where']};return db[_0x7d68('0x3d')][_0x7d68('0x1d')](_0x5224b7)[_0x7d68('0x24')](function(_0x43c330){_0x17af0f['count']=_0x43c330;if(_0x138b47['query']['includeAll']){_0x359a0a[_0x7d68('0x3e')]=[{'all':!![]}];}return db['SalesforceAccount'][_0x7d68('0x3f')](_0x359a0a);})['then'](function(_0x5d490d){_0x17af0f[_0x7d68('0x40')]=_0x5d490d;return _0x17af0f;})[_0x7d68('0x24')](respondWithFilteredResult(_0x143560,_0x359a0a))[_0x7d68('0x41')](handleError(_0x143560,null));};exports[_0x7d68('0x42')]=function(_0x10eb90,_0x582258){var _0x1c346b={'raw':![],'where':{'id':_0x10eb90[_0x7d68('0x43')]['id']}},_0x26977b={};_0x26977b[_0x7d68('0x2f')]=_['keys'](db[_0x7d68('0x3d')][_0x7d68('0x28')]);_0x26977b['query']=_[_0x7d68('0x2c')](_0x10eb90['query']);_0x26977b['filters']=_[_0x7d68('0x2e')](_0x26977b[_0x7d68('0x2f')],_0x26977b[_0x7d68('0x2d')]);_0x1c346b[_0x7d68('0x30')]=_[_0x7d68('0x2e')](_0x26977b['model'],qs[_0x7d68('0x31')](_0x10eb90[_0x7d68('0x2d')]['fields']));_0x1c346b['attributes']=_0x1c346b[_0x7d68('0x30')][_0x7d68('0x44')]?_0x1c346b[_0x7d68('0x30')]:_0x26977b['model'];if(_0x10eb90['query'][_0x7d68('0x45')]){_0x1c346b['include']=[{'all':!![]}];}_0x1c346b=_[_0x7d68('0x3a')]({},_0x1c346b,_0x10eb90[_0x7d68('0x3c')]);return db['SalesforceAccount']['find'](_0x1c346b)[_0x7d68('0x24')](handleEntityNotFound(_0x582258,null))[_0x7d68('0x24')](respondWithResult(_0x582258,null))['catch'](handleError(_0x582258,null));};exports[_0x7d68('0x46')]=function(_0x166fe3,_0x27926f){return db['SalesforceAccount']['create'](_0x166fe3[_0x7d68('0x47')],{})['then'](respondWithResult(_0x27926f,0xc9))[_0x7d68('0x41')](handleError(_0x27926f,null));};exports['update']=function(_0x28affc,_0x140b69){if(_0x28affc[_0x7d68('0x47')]['id']){delete _0x28affc['body']['id'];}return db[_0x7d68('0x3d')]['find']({'where':{'id':_0x28affc[_0x7d68('0x43')]['id']}})[_0x7d68('0x24')](handleEntityNotFound(_0x140b69,null))[_0x7d68('0x24')](saveUpdates(_0x28affc[_0x7d68('0x47')],null))[_0x7d68('0x24')](respondWithResult(_0x140b69,null))[_0x7d68('0x41')](handleError(_0x140b69,null));};exports['destroy']=function(_0x335335,_0x286bac){return db[_0x7d68('0x3d')][_0x7d68('0x48')]({'where':{'id':_0x335335['params']['id']}})['then'](handleEntityNotFound(_0x286bac,null))['then'](removeEntity(_0x286bac,null))[_0x7d68('0x41')](handleError(_0x286bac,null));};exports[_0x7d68('0x49')]=function(_0x1bf42c,_0x37dbf3,_0x27dfb2){var _0x56d3eb={};var _0x3a0962={};var _0x33e90a;var _0x515006;return db[_0x7d68('0x3d')][_0x7d68('0x4a')]({'where':{'id':_0x1bf42c[_0x7d68('0x43')]['id']}})[_0x7d68('0x24')](handleEntityNotFound(_0x37dbf3,null))[_0x7d68('0x24')](function(_0x363e08){if(_0x363e08){_0x33e90a=_0x363e08;_0x3a0962['model']=_[_0x7d68('0x2c')](db['SalesforceConfiguration']['rawAttributes']);_0x3a0962['query']=_[_0x7d68('0x2c')](_0x1bf42c[_0x7d68('0x2d')]);_0x3a0962['filters']=_[_0x7d68('0x2e')](_0x3a0962[_0x7d68('0x2f')],_0x3a0962[_0x7d68('0x2d')]);_0x56d3eb['attributes']=_['intersection'](_0x3a0962[_0x7d68('0x2f')],qs['fields'](_0x1bf42c['query'][_0x7d68('0x31')]));_0x56d3eb[_0x7d68('0x30')]=_0x56d3eb['attributes'][_0x7d68('0x44')]?_0x56d3eb[_0x7d68('0x30')]:_0x3a0962[_0x7d68('0x2f')];_0x56d3eb[_0x7d68('0x34')]=qs[_0x7d68('0x35')](_0x1bf42c['query'][_0x7d68('0x35')]);_0x56d3eb[_0x7d68('0x36')]=qs[_0x7d68('0x37')](_[_0x7d68('0x38')](_0x1bf42c[_0x7d68('0x2d')],_0x3a0962[_0x7d68('0x37')]));if(_0x1bf42c[_0x7d68('0x2d')][_0x7d68('0x39')]){_0x56d3eb[_0x7d68('0x36')]=_[_0x7d68('0x3a')](_0x56d3eb[_0x7d68('0x36')],{'$or':_[_0x7d68('0x2b')](_0x56d3eb[_0x7d68('0x30')],function(_0x53fe27){var _0x5630b2={};_0x5630b2[_0x53fe27]={'$like':'%'+_0x1bf42c['query']['filter']+'%'};return _0x5630b2;})});}_0x56d3eb=_[_0x7d68('0x3a')]({},_0x56d3eb,_0x1bf42c[_0x7d68('0x3c')]);return _0x33e90a[_0x7d68('0x49')](_0x56d3eb);}})[_0x7d68('0x24')](function(_0x5b56d3){if(_0x5b56d3){_0x515006=_0x5b56d3['length'];if(!_0x1bf42c['query'][_0x7d68('0x32')](_0x7d68('0x33'))){_0x56d3eb['limit']=qs[_0x7d68('0x1b')](_0x1bf42c[_0x7d68('0x2d')][_0x7d68('0x1b')]);_0x56d3eb['offset']=qs['offset'](_0x1bf42c[_0x7d68('0x2d')][_0x7d68('0x1e')]);}return _0x33e90a[_0x7d68('0x49')](_0x56d3eb);}})[_0x7d68('0x24')](function(_0x130803){if(_0x130803){return _0x130803?{'count':_0x515006,'rows':_0x130803}:null;}})[_0x7d68('0x24')](respondWithResult(_0x37dbf3,null))[_0x7d68('0x41')](handleError(_0x37dbf3,null));};exports[_0x7d68('0x4b')]=function(_0x36fa3f,_0x3962b6,_0x12054b){if(_0x36fa3f[_0x7d68('0x47')]['id']){delete _0x36fa3f[_0x7d68('0x47')]['id'];}return db[_0x7d68('0x3d')][_0x7d68('0x4a')]({'where':{'id':_0x36fa3f['params']['id']}})[_0x7d68('0x24')](handleEntityNotFound(_0x3962b6,null))['then'](function(_0x31533d){if(_0x31533d){_0x36fa3f[_0x7d68('0x47')]['AccountId']=_0x31533d['id'];_0x36fa3f['body'][_0x7d68('0x4c')]=integrations[_0x7d68('0x4d')](_0x36fa3f[_0x7d68('0x47')]['channel'],_0x36fa3f[_0x7d68('0x47')][_0x7d68('0x2a')]);_0x36fa3f['body']['Descriptions']=integrations[_0x7d68('0x4e')](_0x36fa3f[_0x7d68('0x47')][_0x7d68('0x4f')],_0x36fa3f['body'][_0x7d68('0x2a')]);return db[_0x7d68('0x50')]['create'](_0x36fa3f[_0x7d68('0x47')],{'include':[{'model':db[_0x7d68('0x51')],'as':'Subjects'},{'model':db[_0x7d68('0x51')],'as':_0x7d68('0x52')}]});}return null;})['then'](respondWithResult(_0x3962b6,null))['catch'](handleError(_0x3962b6,null));};exports['getFields']=function(_0x5e0ab9,_0x4b3e01,_0x23d9d4){var _0x4fed31;var _0x52c90b='';var _0x2b5f05=_0x7d68('0x53');return db['SalesforceAccount'][_0x7d68('0x4a')]({'where':{'id':_0x5e0ab9[_0x7d68('0x43')]['id']},'attributes':['id',_0x7d68('0x54'),_0x7d68('0x55'),_0x7d68('0x56'),'username',_0x7d68('0x57'),'securityToken']})[_0x7d68('0x24')](handleEntityNotFound(_0x4b3e01,null))['then'](function(_0x17a9d5){if(_0x17a9d5){_0x52c90b=_0x17a9d5[_0x7d68('0x54')];var _0x40fb35=_0x52c90b[_0x7d68('0x58')](-0x1);if(_0x40fb35==='/'){_0x52c90b=_0x52c90b[_0x7d68('0x59')](0x0,_0x52c90b[_0x7d68('0x5a')](_0x40fb35));}_0x4fed31=new jsforce['Connection']({'oauth2':{'loginUrl':_0x52c90b,'clientId':_0x17a9d5['clientId'],'clientSecret':_0x17a9d5[_0x7d68('0x56')]}});return _0x4fed31[_0x7d68('0x5b')](_0x17a9d5['username'],_0x17a9d5[_0x7d68('0x57')]['concat'](_0x17a9d5[_0x7d68('0x5c')]));}})[_0x7d68('0x24')](function(_0x2e6727){if(_0x2e6727){if(!_[_0x7d68('0x5d')](_0x5e0ab9[_0x7d68('0x2d')][_0x7d68('0x5e')])){_0x2b5f05=_0x5e0ab9[_0x7d68('0x2d')]['ticketType'];}return _0x4fed31['sobject'](_0x2b5f05)[_0x7d68('0x5f')]();}})[_0x7d68('0x24')](function(_0x2611b9){var _0x5cf696=[_0x7d68('0x60'),'ActivityDate',_0x7d68('0x61'),_0x7d68('0x62'),_0x7d68('0x63'),_0x7d68('0x64')];var _0xd9fe74=[_0x7d68('0x65'),_0x7d68('0x66'),_0x7d68('0x67'),_0x7d68('0x68'),_0x7d68('0x69'),_0x7d68('0x6a'),'phone'];if(_0x2611b9){_[_0x7d68('0x6b')](_0x2611b9[_0x7d68('0x31')],function(_0x3134a1){return _0x5cf696[_0x7d68('0x6c')](_0x3134a1['name'])||!_0xd9fe74[_0x7d68('0x6c')](_0x3134a1['type']);});return{'count':_0x2611b9[_0x7d68('0x31')][_0x7d68('0x44')],'rows':_[_0x7d68('0x2b')](_0x2611b9[_0x7d68('0x31')],function(_0x23162a){return{'id':_0x23162a[_0x7d68('0x26')],'name':_0x23162a['label'],'custom':_0x23162a['custom'],'options':_0x23162a['picklistValues'][_0x7d68('0x44')]>0x0?_['map'](_0x23162a[_0x7d68('0x6d')],function(_0x2e0a38){return{'name':_0x2e0a38['label'],'value':_0x2e0a38[_0x7d68('0x6e')]};}):_0x23162a[_0x7d68('0x2a')]==_0x7d68('0x68')?[{'name':_0x7d68('0x6f'),'value':'true'},{'name':_0x7d68('0x70'),'value':_0x7d68('0x71')}]:[]};})};}})[_0x7d68('0x24')](respondWithResult(_0x4b3e01,null))['catch'](function(_0x2856c6){var _0x24287b=_0x5e0ab9[_0x7d68('0x2d')][_0x7d68('0x72')]?0x1f4:_0x2856c6[_0x7d68('0x73')]||0x1f4;logger[_0x7d68('0x25')](_0x7d68('0x74'),'getFields',_0x24287b,JSON[_0x7d68('0x75')](_0x2856c6));delete _0x2856c6['name'];if(_0x24287b===0x191){_0x24287b=0x190;}_0x4b3e01[_0x7d68('0x1a')](_0x24287b)['send'](_0x5e0ab9['query'][_0x7d68('0x72')]?{'message':_0x7d68('0x76'),'statusCode':_0x2856c6[_0x7d68('0x73')]}:_0x2856c6);});}; \ No newline at end of file +var _0x39ae=['papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','offset','undefined','count','limit','apply','save','update','destroy','then','sendStatus','error','stack','name','send','index','map','SalesforceAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','length','includeAll','find','body','findOne','SalesforceConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','create','SalesforceField','getFields','Task','remoteUri','clientId','clientSecret','username','password','securityToken','slice','substring','lastIndexOf','Connection','login','concat','isNil','ticketType','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','string','picklist','boolean','email','remove','includes','label','picklistValues','value','True','true','False','false','test','statusCode','stringify','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x39ae,0x1e4));var _0xe39a=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x39ae[_0x36c5b0];return _0xf19333;};'use strict';var emlformat=require(_0xe39a('0x0'));var rimraf=require(_0xe39a('0x1'));var zipdir=require(_0xe39a('0x2'));var jsonpatch=require(_0xe39a('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe39a('0x4'));var Mustache=require(_0xe39a('0x5'));var util=require(_0xe39a('0x6'));var path=require(_0xe39a('0x7'));var sox=require(_0xe39a('0x8'));var csv=require(_0xe39a('0x9'));var ejs=require(_0xe39a('0xa'));var fs=require('fs');var fs_extra=require(_0xe39a('0xb'));var _=require(_0xe39a('0xc'));var squel=require('squel');var crypto=require(_0xe39a('0xd'));var jsforce=require(_0xe39a('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xe39a('0x9'));var querystring=require(_0xe39a('0xf'));var Papa=require(_0xe39a('0x10'));var Redis=require(_0xe39a('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xe39a('0x12'));var as=require(_0xe39a('0x13'));var hardwareService=require(_0xe39a('0x14'));var logger=require(_0xe39a('0x15'))(_0xe39a('0x16'));var utils=require('../../config/utils');var config=require(_0xe39a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xe39a('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x709de0,_0x98b508){_0x98b508=_0x98b508||0xcc;return function(_0x37bc99){if(_0x37bc99){return _0x709de0['sendStatus'](_0x98b508);}return _0x709de0[_0xe39a('0x19')](_0x98b508)[_0xe39a('0x1a')]();};}function respondWithResult(_0x586cf5,_0x464916){_0x464916=_0x464916||0xc8;return function(_0x4c7e7e){if(_0x4c7e7e){return _0x586cf5[_0xe39a('0x19')](_0x464916)['json'](_0x4c7e7e);}};}function respondWithFilteredResult(_0x457bb4,_0x10b766){return function(_0x58156b){if(_0x58156b){var _0x596bb3=typeof _0x10b766[_0xe39a('0x1b')]===_0xe39a('0x1c')&&typeof _0x10b766['limit']==='undefined';var _0x4b6724=_0x58156b[_0xe39a('0x1d')];var _0x45989b=_0x596bb3?0x0:_0x10b766[_0xe39a('0x1b')];var _0x1164ec=_0x596bb3?_0x58156b[_0xe39a('0x1d')]:_0x10b766[_0xe39a('0x1b')]+_0x10b766[_0xe39a('0x1e')];var _0x895b1b;if(_0x1164ec>=_0x4b6724){_0x1164ec=_0x4b6724;_0x895b1b=0xc8;}else{_0x895b1b=0xce;}_0x457bb4[_0xe39a('0x19')](_0x895b1b);return _0x457bb4['set']('Content-Range',_0x45989b+'-'+_0x1164ec+'/'+_0x4b6724)['json'](_0x58156b);}return null;};}function patchUpdates(_0x41033f){return function(_0x43be16){try{jsonpatch[_0xe39a('0x1f')](_0x43be16,_0x41033f,!![]);}catch(_0x499343){return BPromise['reject'](_0x499343);}return _0x43be16[_0xe39a('0x20')]();};}function saveUpdates(_0x252c0c,_0x409f02){return function(_0x326916){if(_0x326916){return _0x326916[_0xe39a('0x21')](_0x252c0c)['then'](function(_0xda32ea){return _0xda32ea;});}return null;};}function removeEntity(_0x1ca1fe,_0x222004){return function(_0x46c145){if(_0x46c145){return _0x46c145[_0xe39a('0x22')]()[_0xe39a('0x23')](function(){_0x1ca1fe[_0xe39a('0x19')](0xcc)[_0xe39a('0x1a')]();});}};}function handleEntityNotFound(_0x5d75cf,_0x23e5d0){return function(_0x3bb8b3){if(!_0x3bb8b3){_0x5d75cf[_0xe39a('0x24')](0x194);}return _0x3bb8b3;};}function handleError(_0x3ff1c9,_0xd22065){_0xd22065=_0xd22065||0x1f4;return function(_0x28a164){logger[_0xe39a('0x25')](_0x28a164[_0xe39a('0x26')]);if(_0x28a164[_0xe39a('0x27')]){delete _0x28a164[_0xe39a('0x27')];}_0x3ff1c9[_0xe39a('0x19')](_0xd22065)[_0xe39a('0x28')](_0x28a164);};}exports[_0xe39a('0x29')]=function(_0x55d8a1,_0x5b6caa){var _0x36db29={},_0x1286ca={},_0x382695={'count':0x0,'rows':[]};var _0x3f785b=_[_0xe39a('0x2a')](db[_0xe39a('0x2b')][_0xe39a('0x2c')],function(_0x50354d){return{'name':_0x50354d[_0xe39a('0x2d')],'type':_0x50354d[_0xe39a('0x2e')][_0xe39a('0x2f')]};});_0x1286ca['model']=_[_0xe39a('0x2a')](_0x3f785b,_0xe39a('0x27'));_0x1286ca[_0xe39a('0x30')]=_[_0xe39a('0x31')](_0x55d8a1[_0xe39a('0x30')]);_0x1286ca[_0xe39a('0x32')]=_[_0xe39a('0x33')](_0x1286ca[_0xe39a('0x34')],_0x1286ca['query']);_0x36db29[_0xe39a('0x35')]=_['intersection'](_0x1286ca[_0xe39a('0x34')],qs['fields'](_0x55d8a1[_0xe39a('0x30')][_0xe39a('0x36')]));_0x36db29['attributes']=_0x36db29[_0xe39a('0x35')]['length']?_0x36db29[_0xe39a('0x35')]:_0x1286ca[_0xe39a('0x34')];if(!_0x55d8a1[_0xe39a('0x30')][_0xe39a('0x37')](_0xe39a('0x38'))){_0x36db29[_0xe39a('0x1e')]=qs[_0xe39a('0x1e')](_0x55d8a1[_0xe39a('0x30')][_0xe39a('0x1e')]);_0x36db29[_0xe39a('0x1b')]=qs[_0xe39a('0x1b')](_0x55d8a1[_0xe39a('0x30')]['offset']);}_0x36db29[_0xe39a('0x39')]=qs[_0xe39a('0x3a')](_0x55d8a1[_0xe39a('0x30')][_0xe39a('0x3a')]);_0x36db29[_0xe39a('0x3b')]=qs[_0xe39a('0x32')](_[_0xe39a('0x3c')](_0x55d8a1['query'],_0x1286ca[_0xe39a('0x32')]),_0x3f785b);if(_0x55d8a1[_0xe39a('0x30')]['filter']){_0x36db29['where']=_[_0xe39a('0x3d')](_0x36db29[_0xe39a('0x3b')],{'$or':_[_0xe39a('0x2a')](_0x3f785b,function(_0x30d231){if(_0x30d231['type']!==_0xe39a('0x3e')){var _0x5e6eb8={};_0x5e6eb8[_0x30d231[_0xe39a('0x27')]]={'$like':'%'+_0x55d8a1['query'][_0xe39a('0x3f')]+'%'};return _0x5e6eb8;}})});}_0x36db29=_[_0xe39a('0x3d')]({},_0x36db29,_0x55d8a1[_0xe39a('0x40')]);var _0x229291={'where':_0x36db29['where']};return db[_0xe39a('0x2b')]['count'](_0x229291)[_0xe39a('0x23')](function(_0x308480){_0x382695[_0xe39a('0x1d')]=_0x308480;if(_0x55d8a1[_0xe39a('0x30')]['includeAll']){_0x36db29[_0xe39a('0x41')]=[{'all':!![]}];}return db[_0xe39a('0x2b')][_0xe39a('0x42')](_0x36db29);})['then'](function(_0x353902){_0x382695[_0xe39a('0x43')]=_0x353902;return _0x382695;})[_0xe39a('0x23')](respondWithFilteredResult(_0x5b6caa,_0x36db29))[_0xe39a('0x44')](handleError(_0x5b6caa,null));};exports[_0xe39a('0x45')]=function(_0xf5b2ac,_0x5cbea0){var _0x5e004={'raw':![],'where':{'id':_0xf5b2ac[_0xe39a('0x46')]['id']}},_0x4c8e2d={};_0x4c8e2d[_0xe39a('0x34')]=_[_0xe39a('0x31')](db[_0xe39a('0x2b')][_0xe39a('0x2c')]);_0x4c8e2d['query']=_[_0xe39a('0x31')](_0xf5b2ac['query']);_0x4c8e2d[_0xe39a('0x32')]=_[_0xe39a('0x33')](_0x4c8e2d['model'],_0x4c8e2d['query']);_0x5e004['attributes']=_[_0xe39a('0x33')](_0x4c8e2d[_0xe39a('0x34')],qs[_0xe39a('0x36')](_0xf5b2ac[_0xe39a('0x30')][_0xe39a('0x36')]));_0x5e004['attributes']=_0x5e004[_0xe39a('0x35')][_0xe39a('0x47')]?_0x5e004[_0xe39a('0x35')]:_0x4c8e2d[_0xe39a('0x34')];if(_0xf5b2ac['query'][_0xe39a('0x48')]){_0x5e004[_0xe39a('0x41')]=[{'all':!![]}];}_0x5e004=_[_0xe39a('0x3d')]({},_0x5e004,_0xf5b2ac[_0xe39a('0x40')]);return db[_0xe39a('0x2b')][_0xe39a('0x49')](_0x5e004)[_0xe39a('0x23')](handleEntityNotFound(_0x5cbea0,null))[_0xe39a('0x23')](respondWithResult(_0x5cbea0,null))['catch'](handleError(_0x5cbea0,null));};exports['create']=function(_0x288132,_0x374d34){return db['SalesforceAccount']['create'](_0x288132[_0xe39a('0x4a')],{})[_0xe39a('0x23')](respondWithResult(_0x374d34,0xc9))[_0xe39a('0x44')](handleError(_0x374d34,null));};exports['update']=function(_0x14e2af,_0x43613d){if(_0x14e2af[_0xe39a('0x4a')]['id']){delete _0x14e2af['body']['id'];}return db[_0xe39a('0x2b')][_0xe39a('0x49')]({'where':{'id':_0x14e2af['params']['id']}})[_0xe39a('0x23')](handleEntityNotFound(_0x43613d,null))[_0xe39a('0x23')](saveUpdates(_0x14e2af['body'],null))[_0xe39a('0x23')](respondWithResult(_0x43613d,null))[_0xe39a('0x44')](handleError(_0x43613d,null));};exports[_0xe39a('0x22')]=function(_0x4227d2,_0x24ef64){return db[_0xe39a('0x2b')][_0xe39a('0x49')]({'where':{'id':_0x4227d2[_0xe39a('0x46')]['id']}})[_0xe39a('0x23')](handleEntityNotFound(_0x24ef64,null))['then'](removeEntity(_0x24ef64,null))[_0xe39a('0x44')](handleError(_0x24ef64,null));};exports['getConfigurations']=function(_0x3ab2fe,_0x402aa6,_0x3b6f98){var _0x53e0e3={};var _0x4113c7={};var _0x561ab2;var _0xf0efb1;return db[_0xe39a('0x2b')][_0xe39a('0x4b')]({'where':{'id':_0x3ab2fe[_0xe39a('0x46')]['id']}})[_0xe39a('0x23')](handleEntityNotFound(_0x402aa6,null))[_0xe39a('0x23')](function(_0x257862){if(_0x257862){_0x561ab2=_0x257862;_0x4113c7['model']=_[_0xe39a('0x31')](db[_0xe39a('0x4c')][_0xe39a('0x2c')]);_0x4113c7[_0xe39a('0x30')]=_[_0xe39a('0x31')](_0x3ab2fe[_0xe39a('0x30')]);_0x4113c7[_0xe39a('0x32')]=_[_0xe39a('0x33')](_0x4113c7['model'],_0x4113c7[_0xe39a('0x30')]);_0x53e0e3['attributes']=_[_0xe39a('0x33')](_0x4113c7[_0xe39a('0x34')],qs['fields'](_0x3ab2fe[_0xe39a('0x30')][_0xe39a('0x36')]));_0x53e0e3[_0xe39a('0x35')]=_0x53e0e3[_0xe39a('0x35')][_0xe39a('0x47')]?_0x53e0e3[_0xe39a('0x35')]:_0x4113c7[_0xe39a('0x34')];_0x53e0e3['order']=qs[_0xe39a('0x3a')](_0x3ab2fe[_0xe39a('0x30')][_0xe39a('0x3a')]);_0x53e0e3[_0xe39a('0x3b')]=qs[_0xe39a('0x32')](_[_0xe39a('0x3c')](_0x3ab2fe[_0xe39a('0x30')],_0x4113c7[_0xe39a('0x32')]));if(_0x3ab2fe['query'][_0xe39a('0x3f')]){_0x53e0e3['where']=_['merge'](_0x53e0e3['where'],{'$or':_[_0xe39a('0x2a')](_0x53e0e3[_0xe39a('0x35')],function(_0xbb3bed){var _0x20b58d={};_0x20b58d[_0xbb3bed]={'$like':'%'+_0x3ab2fe['query'][_0xe39a('0x3f')]+'%'};return _0x20b58d;})});}_0x53e0e3=_[_0xe39a('0x3d')]({},_0x53e0e3,_0x3ab2fe[_0xe39a('0x40')]);return _0x561ab2[_0xe39a('0x4d')](_0x53e0e3);}})['then'](function(_0x4545ad){if(_0x4545ad){_0xf0efb1=_0x4545ad[_0xe39a('0x47')];if(!_0x3ab2fe[_0xe39a('0x30')]['hasOwnProperty'](_0xe39a('0x38'))){_0x53e0e3[_0xe39a('0x1e')]=qs[_0xe39a('0x1e')](_0x3ab2fe[_0xe39a('0x30')][_0xe39a('0x1e')]);_0x53e0e3[_0xe39a('0x1b')]=qs['offset'](_0x3ab2fe[_0xe39a('0x30')][_0xe39a('0x1b')]);}return _0x561ab2['getConfigurations'](_0x53e0e3);}})['then'](function(_0x120b2e){if(_0x120b2e){return _0x120b2e?{'count':_0xf0efb1,'rows':_0x120b2e}:null;}})[_0xe39a('0x23')](respondWithResult(_0x402aa6,null))['catch'](handleError(_0x402aa6,null));};exports[_0xe39a('0x4e')]=function(_0x4e0372,_0x3d102a,_0x437077){if(_0x4e0372[_0xe39a('0x4a')]['id']){delete _0x4e0372[_0xe39a('0x4a')]['id'];}return db['SalesforceAccount'][_0xe39a('0x4b')]({'where':{'id':_0x4e0372[_0xe39a('0x46')]['id']}})[_0xe39a('0x23')](handleEntityNotFound(_0x3d102a,null))[_0xe39a('0x23')](function(_0x1f54b1){if(_0x1f54b1){_0x4e0372[_0xe39a('0x4a')][_0xe39a('0x4f')]=_0x1f54b1['id'];_0x4e0372['body'][_0xe39a('0x50')]=integrations[_0xe39a('0x51')](_0x4e0372[_0xe39a('0x4a')][_0xe39a('0x52')],_0x4e0372[_0xe39a('0x4a')][_0xe39a('0x2e')]);_0x4e0372['body'][_0xe39a('0x53')]=integrations[_0xe39a('0x54')](_0x4e0372[_0xe39a('0x4a')]['channel'],_0x4e0372[_0xe39a('0x4a')][_0xe39a('0x2e')]);return db[_0xe39a('0x4c')][_0xe39a('0x55')](_0x4e0372[_0xe39a('0x4a')],{'include':[{'model':db[_0xe39a('0x56')],'as':_0xe39a('0x50')},{'model':db[_0xe39a('0x56')],'as':_0xe39a('0x53')}]});}return null;})[_0xe39a('0x23')](respondWithResult(_0x3d102a,null))[_0xe39a('0x44')](handleError(_0x3d102a,null));};exports[_0xe39a('0x57')]=function(_0x261c02,_0x209e31,_0x3caebd){var _0x178254;var _0x4ce052='';var _0xb9e761=_0xe39a('0x58');return db[_0xe39a('0x2b')]['findOne']({'where':{'id':_0x261c02[_0xe39a('0x46')]['id']},'attributes':['id',_0xe39a('0x59'),_0xe39a('0x5a'),_0xe39a('0x5b'),_0xe39a('0x5c'),_0xe39a('0x5d'),_0xe39a('0x5e')]})[_0xe39a('0x23')](handleEntityNotFound(_0x209e31,null))[_0xe39a('0x23')](function(_0x41b867){if(_0x41b867){_0x4ce052=_0x41b867[_0xe39a('0x59')];var _0x26ce3b=_0x4ce052[_0xe39a('0x5f')](-0x1);if(_0x26ce3b==='/'){_0x4ce052=_0x4ce052[_0xe39a('0x60')](0x0,_0x4ce052[_0xe39a('0x61')](_0x26ce3b));}_0x178254=new jsforce[(_0xe39a('0x62'))]({'oauth2':{'loginUrl':_0x4ce052,'clientId':_0x41b867[_0xe39a('0x5a')],'clientSecret':_0x41b867[_0xe39a('0x5b')]}});return _0x178254[_0xe39a('0x63')](_0x41b867[_0xe39a('0x5c')],_0x41b867['password'][_0xe39a('0x64')](_0x41b867['securityToken']));}})[_0xe39a('0x23')](function(_0x478713){if(_0x478713){if(!_[_0xe39a('0x65')](_0x261c02[_0xe39a('0x30')][_0xe39a('0x66')])){_0xb9e761=_0x261c02[_0xe39a('0x30')]['ticketType'];}return _0x178254['sobject'](_0xb9e761)['describe']();}})['then'](function(_0x388a87){var _0xa68253=[_0xe39a('0x67'),_0xe39a('0x68'),_0xe39a('0x69'),_0xe39a('0x6a'),_0xe39a('0x6b'),_0xe39a('0x6c')];var _0x1922e5=[_0xe39a('0x6d'),'int',_0xe39a('0x6e'),_0xe39a('0x6f'),_0xe39a('0x70'),'textarea','phone'];if(_0x388a87){_[_0xe39a('0x71')](_0x388a87[_0xe39a('0x36')],function(_0x31ff17){return _0xa68253['includes'](_0x31ff17[_0xe39a('0x27')])||!_0x1922e5[_0xe39a('0x72')](_0x31ff17['type']);});return{'count':_0x388a87[_0xe39a('0x36')]['length'],'rows':_[_0xe39a('0x2a')](_0x388a87[_0xe39a('0x36')],function(_0x538812){return{'id':_0x538812[_0xe39a('0x27')],'name':_0x538812[_0xe39a('0x73')],'custom':_0x538812['custom'],'options':_0x538812[_0xe39a('0x74')]['length']>0x0?_[_0xe39a('0x2a')](_0x538812['picklistValues'],function(_0x4edc6a){return{'name':_0x4edc6a[_0xe39a('0x73')],'value':_0x4edc6a[_0xe39a('0x75')]};}):_0x538812[_0xe39a('0x2e')]==_0xe39a('0x6f')?[{'name':_0xe39a('0x76'),'value':_0xe39a('0x77')},{'name':_0xe39a('0x78'),'value':_0xe39a('0x79')}]:[]};})};}})[_0xe39a('0x23')](respondWithResult(_0x209e31,null))[_0xe39a('0x44')](function(_0xb4ef69){var _0x2db076=_0x261c02[_0xe39a('0x30')][_0xe39a('0x7a')]?0x1f4:_0xb4ef69[_0xe39a('0x7b')]||0x1f4;logger[_0xe39a('0x25')]('getFields,\x20%s,\x20%s,\x20%s',_0xe39a('0x57'),_0x2db076,JSON[_0xe39a('0x7c')](_0xb4ef69));delete _0xb4ef69['name'];if(_0x2db076===0x191){_0x2db076=0x190;}_0x209e31[_0xe39a('0x19')](_0x2db076)[_0xe39a('0x28')](_0x261c02[_0xe39a('0x30')][_0xe39a('0x7a')]?{'message':'Wrong\x20credentials','statusCode':_0xb4ef69[_0xe39a('0x7b')]}:_0xb4ef69);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 5667bf7..347b5fe 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 _0xf54b=['api','moment','request-promise','path','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','SalesforceAccount','int_salesforce_accounts','util','../../config/logger'];(function(_0x58c2d6,_0x23898b){var _0x1930fd=function(_0x360714){while(--_0x360714){_0x58c2d6['push'](_0x58c2d6['shift']());}};_0x1930fd(++_0x23898b);}(_0xf54b,0xa6));var _0xbf54=function(_0x1b964a,_0x40fdc2){_0x1b964a=_0x1b964a-0x0;var _0x2559fa=_0xf54b[_0x1b964a];return _0x2559fa;};'use strict';var _=require('lodash');var util=require(_0xbf54('0x0'));var logger=require(_0xbf54('0x1'))(_0xbf54('0x2'));var moment=require(_0xbf54('0x3'));var BPromise=require('bluebird');var rp=require(_0xbf54('0x4'));var fs=require('fs');var path=require(_0xbf54('0x5'));var rimraf=require('rimraf');var config=require(_0xbf54('0x6'));var attributes=require(_0xbf54('0x7'));var integrations=require(_0xbf54('0x8'));module[_0xbf54('0x9')]=function(_0x1bdc8a,_0x4a1cc4){return _0x1bdc8a['define'](_0xbf54('0xa'),attributes,{'tableName':_0xbf54('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x68c0=['moment','bluebird','request-promise','path','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','int_salesforce_accounts','lodash','util','api'];(function(_0x155b18,_0x1b209c){var _0x52aeac=function(_0x3ce7fc){while(--_0x3ce7fc){_0x155b18['push'](_0x155b18['shift']());}};_0x52aeac(++_0x1b209c);}(_0x68c0,0x1c5));var _0x068c=function(_0x590726,_0x2905a9){_0x590726=_0x590726-0x0;var _0x39fc01=_0x68c0[_0x590726];return _0x39fc01;};'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'));var integrations=require(_0x068c('0x8'));module[_0x068c('0x9')]=function(_0x1681b8,_0x13c65c){return _0x1681b8[_0x068c('0xa')]('SalesforceAccount',attributes,{'tableName':_0x068c('0xb'),'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 52b7429..7a89905 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 _0x50b6=['SalesforceAccount,\x20%s,\x20%s','message','result','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','where','attributes','limit','include','map','model','catch','ShowSalesforceAccount','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x50b6,0xc5));var _0x650b=function(_0x4c5300,_0x1f9217){_0x4c5300=_0x4c5300-0x0;var _0x5caef9=_0x50b6[_0x4c5300];return _0x5caef9;};'use strict';var _=require(_0x650b('0x0'));var util=require(_0x650b('0x1'));var moment=require(_0x650b('0x2'));var BPromise=require('bluebird');var rs=require(_0x650b('0x3'));var fs=require('fs');var Redis=require(_0x650b('0x4'));var db=require(_0x650b('0x5'))['db'];var utils=require(_0x650b('0x6'));var logger=require(_0x650b('0x7'))(_0x650b('0x8'));var config=require('../../config/environment');var jayson=require(_0x650b('0x9'));var client=jayson[_0x650b('0xa')][_0x650b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x207d5a,_0xc4362a,_0x48c3b4){return new BPromise(function(_0x25093d,_0x2936d8){return client['request'](_0x207d5a,_0x48c3b4)[_0x650b('0xc')](function(_0x5ae280){logger[_0x650b('0xd')]('SalesforceAccount,\x20%s,\x20%s',_0xc4362a,_0x650b('0xe'));logger[_0x650b('0xf')](_0x650b('0x10'),_0xc4362a,_0x650b('0xe'),JSON[_0x650b('0x11')](_0x5ae280));if(_0x5ae280['error']){if(_0x5ae280[_0x650b('0x12')]['code']===0x1f4){logger[_0x650b('0x12')](_0x650b('0x13'),_0xc4362a,_0x5ae280[_0x650b('0x12')][_0x650b('0x14')]);return _0x2936d8(_0x5ae280[_0x650b('0x12')]['message']);}logger['error'](_0x650b('0x13'),_0xc4362a,_0x5ae280[_0x650b('0x12')][_0x650b('0x14')]);return _0x25093d(_0x5ae280[_0x650b('0x12')][_0x650b('0x14')]);}else{logger[_0x650b('0xd')](_0x650b('0x13'),_0xc4362a,_0x650b('0xe'));_0x25093d(_0x5ae280[_0x650b('0x15')][_0x650b('0x14')]);}})['catch'](function(_0x494012){logger[_0x650b('0x12')](_0x650b('0x13'),_0xc4362a,_0x494012);_0x2936d8(_0x494012);});});}exports[_0x650b('0x16')]=function(_0x5cbb85){var _0x3a170b=this;return new Promise(function(_0x3342c2,_0x1c481e){return db[_0x650b('0x17')][_0x650b('0x18')]({'raw':_0x5cbb85['options']?_0x5cbb85[_0x650b('0x19')][_0x650b('0x1a')]===undefined?!![]:![]:!![],'where':_0x5cbb85[_0x650b('0x19')]?_0x5cbb85['options'][_0x650b('0x1b')]||null:null,'attributes':_0x5cbb85[_0x650b('0x19')]?_0x5cbb85[_0x650b('0x19')][_0x650b('0x1c')]||null:null,'limit':_0x5cbb85[_0x650b('0x19')]?_0x5cbb85['options'][_0x650b('0x1d')]||null:null,'include':_0x5cbb85['options']?_0x5cbb85[_0x650b('0x19')][_0x650b('0x1e')]?_[_0x650b('0x1f')](_0x5cbb85[_0x650b('0x19')][_0x650b('0x1e')],function(_0x11d194){return{'model':db[_0x11d194['model']],'as':_0x11d194['as'],'attributes':_0x11d194[_0x650b('0x1c')],'include':_0x11d194['include']?_['map'](_0x11d194['include'],function(_0x1ccb41){return{'model':db[_0x1ccb41[_0x650b('0x20')]],'as':_0x1ccb41['as'],'attributes':_0x1ccb41[_0x650b('0x1c')],'include':_0x1ccb41['include']?_[_0x650b('0x1f')](_0x1ccb41[_0x650b('0x1e')],function(_0x5e1873){return{'model':db[_0x5e1873[_0x650b('0x20')]],'as':_0x5e1873['as'],'attributes':_0x5e1873[_0x650b('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x650b('0xc')](function(_0x455c8a){logger['info'](_0x650b('0x16'),_0x5cbb85);logger['debug'](_0x650b('0x16'),_0x5cbb85,JSON[_0x650b('0x11')](_0x455c8a));_0x3342c2(_0x455c8a);})[_0x650b('0x21')](function(_0x25eb51){logger[_0x650b('0x12')](_0x650b('0x16'),_0x25eb51['message'],_0x5cbb85);_0x1c481e(_0x3a170b[_0x650b('0x12')](0x1f4,_0x25eb51[_0x650b('0x14')]));});});};exports[_0x650b('0x22')]=function(_0x479ad3){var _0x3caeb9=this;return new Promise(function(_0x5cec9b,_0x19f70b){return db['SalesforceAccount'][_0x650b('0x23')]({'raw':_0x479ad3[_0x650b('0x19')]?_0x479ad3['options'][_0x650b('0x1a')]===undefined?!![]:![]:!![],'where':_0x479ad3[_0x650b('0x19')]?_0x479ad3[_0x650b('0x19')][_0x650b('0x1b')]||null:null,'attributes':_0x479ad3[_0x650b('0x19')]?_0x479ad3[_0x650b('0x19')][_0x650b('0x1c')]||null:null,'include':_0x479ad3['options']?_0x479ad3[_0x650b('0x19')]['include']?_['map'](_0x479ad3[_0x650b('0x19')]['include'],function(_0x2b53c6){return{'model':db[_0x2b53c6[_0x650b('0x20')]],'as':_0x2b53c6['as'],'attributes':_0x2b53c6[_0x650b('0x1c')],'include':_0x2b53c6[_0x650b('0x1e')]?_[_0x650b('0x1f')](_0x2b53c6[_0x650b('0x1e')],function(_0x3868ad){return{'model':db[_0x3868ad['model']],'as':_0x3868ad['as'],'attributes':_0x3868ad[_0x650b('0x1c')],'include':_0x3868ad[_0x650b('0x1e')]?_[_0x650b('0x1f')](_0x3868ad[_0x650b('0x1e')],function(_0x3cc887){return{'model':db[_0x3cc887[_0x650b('0x20')]],'as':_0x3cc887['as'],'attributes':_0x3cc887[_0x650b('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x305e0d){logger[_0x650b('0xd')](_0x650b('0x22'),_0x479ad3);logger['debug'](_0x650b('0x22'),_0x479ad3,JSON['stringify'](_0x305e0d));_0x5cec9b(_0x305e0d);})['catch'](function(_0xcfeaa3){logger[_0x650b('0x12')](_0x650b('0x22'),_0xcfeaa3['message'],_0x479ad3);_0x19f70b(_0x3caeb9[_0x650b('0x12')](0x1f4,_0xcfeaa3['message']));});});}; \ No newline at end of file +var _0x6c90=['debug','ShowSalesforceAccount','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceAccount,\x20%s,\x20%s','message','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','where','attributes','limit','map','include','model'];(function(_0x580b15,_0x28afa4){var _0x1adb1b=function(_0x47a01f){while(--_0x47a01f){_0x580b15['push'](_0x580b15['shift']());}};_0x1adb1b(++_0x28afa4);}(_0x6c90,0x1de));var _0x06c9=function(_0x598b81,_0x340b88){_0x598b81=_0x598b81-0x0;var _0x28e2eb=_0x6c90[_0x598b81];return _0x28e2eb;};'use strict';var _=require('lodash');var util=require(_0x06c9('0x0'));var moment=require(_0x06c9('0x1'));var BPromise=require('bluebird');var rs=require(_0x06c9('0x2'));var fs=require('fs');var Redis=require(_0x06c9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x06c9('0x4'));var logger=require(_0x06c9('0x5'))(_0x06c9('0x6'));var config=require(_0x06c9('0x7'));var jayson=require(_0x06c9('0x8'));var client=jayson[_0x06c9('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x260685,_0x324c04,_0x552b68){return new BPromise(function(_0x3b3354,_0x1aae91){return client[_0x06c9('0xa')](_0x260685,_0x552b68)[_0x06c9('0xb')](function(_0x2d57d8){logger[_0x06c9('0xc')]('SalesforceAccount,\x20%s,\x20%s',_0x324c04,_0x06c9('0xd'));logger['debug'](_0x06c9('0xe'),_0x324c04,_0x06c9('0xd'),JSON[_0x06c9('0xf')](_0x2d57d8));if(_0x2d57d8[_0x06c9('0x10')]){if(_0x2d57d8[_0x06c9('0x10')][_0x06c9('0x11')]===0x1f4){logger['error'](_0x06c9('0x12'),_0x324c04,_0x2d57d8[_0x06c9('0x10')]['message']);return _0x1aae91(_0x2d57d8[_0x06c9('0x10')]['message']);}logger[_0x06c9('0x10')]('SalesforceAccount,\x20%s,\x20%s',_0x324c04,_0x2d57d8[_0x06c9('0x10')][_0x06c9('0x13')]);return _0x3b3354(_0x2d57d8['error']['message']);}else{logger[_0x06c9('0xc')]('SalesforceAccount,\x20%s,\x20%s',_0x324c04,_0x06c9('0xd'));_0x3b3354(_0x2d57d8['result'][_0x06c9('0x13')]);}})[_0x06c9('0x14')](function(_0xd26f45){logger[_0x06c9('0x10')](_0x06c9('0x12'),_0x324c04,_0xd26f45);_0x1aae91(_0xd26f45);});});}exports[_0x06c9('0x15')]=function(_0x1e875a){var _0x4bbc30=this;return new Promise(function(_0x5dc4b1,_0x6fc3ee){return db[_0x06c9('0x16')][_0x06c9('0x17')]({'raw':_0x1e875a[_0x06c9('0x18')]?_0x1e875a[_0x06c9('0x18')][_0x06c9('0x19')]===undefined?!![]:![]:!![],'where':_0x1e875a[_0x06c9('0x18')]?_0x1e875a[_0x06c9('0x18')][_0x06c9('0x1a')]||null:null,'attributes':_0x1e875a[_0x06c9('0x18')]?_0x1e875a['options'][_0x06c9('0x1b')]||null:null,'limit':_0x1e875a[_0x06c9('0x18')]?_0x1e875a[_0x06c9('0x18')][_0x06c9('0x1c')]||null:null,'include':_0x1e875a[_0x06c9('0x18')]?_0x1e875a[_0x06c9('0x18')]['include']?_[_0x06c9('0x1d')](_0x1e875a[_0x06c9('0x18')][_0x06c9('0x1e')],function(_0x13a0d3){return{'model':db[_0x13a0d3['model']],'as':_0x13a0d3['as'],'attributes':_0x13a0d3['attributes'],'include':_0x13a0d3[_0x06c9('0x1e')]?_['map'](_0x13a0d3['include'],function(_0x5aeb4a){return{'model':db[_0x5aeb4a[_0x06c9('0x1f')]],'as':_0x5aeb4a['as'],'attributes':_0x5aeb4a[_0x06c9('0x1b')],'include':_0x5aeb4a['include']?_['map'](_0x5aeb4a[_0x06c9('0x1e')],function(_0x4d5279){return{'model':db[_0x4d5279['model']],'as':_0x4d5279['as'],'attributes':_0x4d5279[_0x06c9('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1490a4){logger['info'](_0x06c9('0x15'),_0x1e875a);logger[_0x06c9('0x20')](_0x06c9('0x15'),_0x1e875a,JSON[_0x06c9('0xf')](_0x1490a4));_0x5dc4b1(_0x1490a4);})[_0x06c9('0x14')](function(_0x22aabc){logger[_0x06c9('0x10')](_0x06c9('0x15'),_0x22aabc[_0x06c9('0x13')],_0x1e875a);_0x6fc3ee(_0x4bbc30[_0x06c9('0x10')](0x1f4,_0x22aabc[_0x06c9('0x13')]));});});};exports['ShowSalesforceAccount']=function(_0x1533aa){var _0x46a6b8=this;return new Promise(function(_0x1ee6ab,_0x37c90c){return db[_0x06c9('0x16')]['find']({'raw':_0x1533aa[_0x06c9('0x18')]?_0x1533aa['options'][_0x06c9('0x19')]===undefined?!![]:![]:!![],'where':_0x1533aa[_0x06c9('0x18')]?_0x1533aa[_0x06c9('0x18')][_0x06c9('0x1a')]||null:null,'attributes':_0x1533aa[_0x06c9('0x18')]?_0x1533aa[_0x06c9('0x18')][_0x06c9('0x1b')]||null:null,'include':_0x1533aa['options']?_0x1533aa['options']['include']?_[_0x06c9('0x1d')](_0x1533aa[_0x06c9('0x18')]['include'],function(_0xcbb3d5){return{'model':db[_0xcbb3d5[_0x06c9('0x1f')]],'as':_0xcbb3d5['as'],'attributes':_0xcbb3d5[_0x06c9('0x1b')],'include':_0xcbb3d5[_0x06c9('0x1e')]?_['map'](_0xcbb3d5['include'],function(_0x249fba){return{'model':db[_0x249fba['model']],'as':_0x249fba['as'],'attributes':_0x249fba[_0x06c9('0x1b')],'include':_0x249fba['include']?_[_0x06c9('0x1d')](_0x249fba['include'],function(_0x4a9235){return{'model':db[_0x4a9235[_0x06c9('0x1f')]],'as':_0x4a9235['as'],'attributes':_0x4a9235[_0x06c9('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x06c9('0xb')](function(_0x515ff9){logger[_0x06c9('0xc')](_0x06c9('0x21'),_0x1533aa);logger[_0x06c9('0x20')](_0x06c9('0x21'),_0x1533aa,JSON[_0x06c9('0xf')](_0x515ff9));_0x1ee6ab(_0x515ff9);})[_0x06c9('0x14')](function(_0x13b0a5){logger[_0x06c9('0x10')]('ShowSalesforceAccount',_0x13b0a5['message'],_0x1533aa);_0x37c90c(_0x46a6b8[_0x06c9('0x10')](0x1f4,_0x13b0a5[_0x06c9('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 7f9b3e5..972c68a 100644 --- a/server/api/intSalesforceConfiguration/index.js +++ b/server/api/intSalesforceConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intSalesforceConfiguration.controller','get','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','exports','multer','util','path'];(function(_0x5279e5,_0xbad10d){var _0x1e8738=function(_0x11a6ab){while(--_0x11a6ab){_0x5279e5['push'](_0x5279e5['shift']());}};_0x1e8738(++_0xbad10d);}(_0x2ef3,0xba));var _0x32ef=function(_0x51bc3e,_0x58f56b){_0x51bc3e=_0x51bc3e-0x0;var _0x5628bf=_0x2ef3[_0x51bc3e];return _0x5628bf;};'use strict';var multer=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var path=require(_0x32ef('0x2'));var timeout=require(_0x32ef('0x3'));var express=require(_0x32ef('0x4'));var router=express[_0x32ef('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x32ef('0x6'));var interaction=require(_0x32ef('0x7'));var config=require('../../config/environment');var controller=require(_0x32ef('0x8'));router[_0x32ef('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x32ef('0x9')](_0x32ef('0xa'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x9')](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xe')]);router[_0x32ef('0x9')](_0x32ef('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x32ef('0x9')](_0x32ef('0x10'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x11')]);router['post']('/',auth[_0x32ef('0xb')](),controller['create']);router[_0x32ef('0x12')]('/:id',auth[_0x32ef('0xb')](),controller[_0x32ef('0x13')]);router['delete']('/:id',auth[_0x32ef('0xb')](),controller['destroy']);module[_0x32ef('0x14')]=router; \ No newline at end of file +var _0xadb5=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','delete','destroy','exports','util','connect-timeout','express'];(function(_0xcf43f,_0xd3a945){var _0x204adf=function(_0x10161b){while(--_0x10161b){_0xcf43f['push'](_0xcf43f['shift']());}};_0x204adf(++_0xd3a945);}(_0xadb5,0xad));var _0x5adb=function(_0x242f8a,_0x3f0c61){_0x242f8a=_0x242f8a-0x0;var _0x5944d1=_0xadb5[_0x242f8a];return _0x5944d1;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5adb('0x4'));var interaction=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var controller=require('./intSalesforceConfiguration.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0x7')](_0x5adb('0xe'),auth[_0x5adb('0x8')](),controller['getSubjects']);router['get'](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x10')]);router['post']('/',auth[_0x5adb('0x8')](),controller['create']);router[_0x5adb('0x11')]('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x12')]);router[_0x5adb('0x13')]('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x14')]);module[_0x5adb('0x15')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 9e5bc6e..b2ae4f3 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 _0xc412=['lead','account_contact_lead','account','nothing','sequelize','exports','STRING','Task','Case','ENUM','contact_lead','contact'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0xc412,0x70));var _0x2c41=function(_0x4807d6,_0x15ff54){_0x4807d6=_0x4807d6-0x0;var _0x446117=_0xc412[_0x4807d6];return _0x446117;};'use strict';var Sequelize=require(_0x2c41('0x0'));module[_0x2c41('0x1')]={'name':{'type':Sequelize[_0x2c41('0x2')]},'description':{'type':Sequelize[_0x2c41('0x2')]},'ticketType':{'type':Sequelize['ENUM'](_0x2c41('0x3'),_0x2c41('0x4')),'defaultValue':_0x2c41('0x3')},'moduleSearch':{'type':Sequelize[_0x2c41('0x5')](_0x2c41('0x6'),_0x2c41('0x7'),_0x2c41('0x8'),_0x2c41('0x9'),_0x2c41('0xa')),'defaultValue':_0x2c41('0x6')},'moduleCreate':{'type':Sequelize[_0x2c41('0x5')](_0x2c41('0xb'),_0x2c41('0x7'),'lead',_0x2c41('0xa')),'defaultValue':_0x2c41('0x8')},'leadId':{'type':Sequelize[_0x2c41('0x2')]},'additionalSearchAccount':{'type':Sequelize['STRING']},'additionalSearchContact':{'type':Sequelize[_0x2c41('0x2')]},'additionalSearchLead':{'type':Sequelize[_0x2c41('0x2')]}}; \ No newline at end of file +var _0x806a=['ENUM','Task','Case','contact_lead','contact','account_contact_lead','nothing','account','sequelize','STRING'];(function(_0x18d2fa,_0x10c1f3){var _0x21184f=function(_0x5406ea){while(--_0x5406ea){_0x18d2fa['push'](_0x18d2fa['shift']());}};_0x21184f(++_0x10c1f3);}(_0x806a,0x6c));var _0xa806=function(_0x4dd9c1,_0xbf690b){_0x4dd9c1=_0x4dd9c1-0x0;var _0x488da2=_0x806a[_0x4dd9c1];return _0x488da2;};'use strict';var Sequelize=require(_0xa806('0x0'));module['exports']={'name':{'type':Sequelize[_0xa806('0x1')]},'description':{'type':Sequelize[_0xa806('0x1')]},'ticketType':{'type':Sequelize[_0xa806('0x2')](_0xa806('0x3'),_0xa806('0x4')),'defaultValue':_0xa806('0x3')},'moduleSearch':{'type':Sequelize[_0xa806('0x2')](_0xa806('0x5'),_0xa806('0x6'),'lead',_0xa806('0x7'),'account'),'defaultValue':_0xa806('0x5')},'moduleCreate':{'type':Sequelize[_0xa806('0x2')](_0xa806('0x8'),_0xa806('0x6'),'lead',_0xa806('0x9')),'defaultValue':'lead'},'leadId':{'type':Sequelize[_0xa806('0x1')]},'additionalSearchAccount':{'type':Sequelize[_0xa806('0x1')]},'additionalSearchContact':{'type':Sequelize[_0xa806('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 c5926f9..67a582f 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 _0x81c9=['findOne','SalesforceField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','sendStatus','json','undefined','limit','count','offset','status','set','Content-Range','apply','save','update','then','destroy','end','error','stack','name','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','length','find','create','body','getFields'];(function(_0x468030,_0x56744d){var _0x434140=function(_0x3795a0){while(--_0x3795a0){_0x468030['push'](_0x468030['shift']());}};_0x434140(++_0x56744d);}(_0x81c9,0x1de));var _0x981c=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x81c9[_0x126558];return _0x1f6d14;};'use strict';var emlformat=require(_0x981c('0x0'));var rimraf=require(_0x981c('0x1'));var zipdir=require(_0x981c('0x2'));var jsonpatch=require(_0x981c('0x3'));var rp=require('request-promise');var moment=require(_0x981c('0x4'));var BPromise=require(_0x981c('0x5'));var Mustache=require(_0x981c('0x6'));var util=require('util');var path=require(_0x981c('0x7'));var sox=require(_0x981c('0x8'));var csv=require(_0x981c('0x9'));var ejs=require(_0x981c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x981c('0xb'));var squel=require('squel');var crypto=require(_0x981c('0xc'));var jsforce=require(_0x981c('0xd'));var deskjs=require(_0x981c('0xe'));var toCsv=require(_0x981c('0x9'));var querystring=require(_0x981c('0xf'));var Papa=require(_0x981c('0x10'));var Redis=require(_0x981c('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x981c('0x12'));var as=require(_0x981c('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x981c('0x14'));var utils=require(_0x981c('0x15'));var config=require(_0x981c('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x218f07,_0x592d0b){_0x592d0b=_0x592d0b||0xcc;return function(_0x2f9e03){if(_0x2f9e03){return _0x218f07[_0x981c('0x17')](_0x592d0b);}return _0x218f07['status'](_0x592d0b)['end']();};}function respondWithResult(_0x112933,_0x2263dc){_0x2263dc=_0x2263dc||0xc8;return function(_0x577bc8){if(_0x577bc8){return _0x112933['status'](_0x2263dc)[_0x981c('0x18')](_0x577bc8);}};}function respondWithFilteredResult(_0x2787b6,_0x37e070){return function(_0x1eff46){if(_0x1eff46){var _0x302e62=typeof _0x37e070['offset']===_0x981c('0x19')&&typeof _0x37e070[_0x981c('0x1a')]===_0x981c('0x19');var _0x4e69e0=_0x1eff46[_0x981c('0x1b')];var _0xe7371b=_0x302e62?0x0:_0x37e070[_0x981c('0x1c')];var _0x2dde92=_0x302e62?_0x1eff46[_0x981c('0x1b')]:_0x37e070[_0x981c('0x1c')]+_0x37e070[_0x981c('0x1a')];var _0x1f8f0f;if(_0x2dde92>=_0x4e69e0){_0x2dde92=_0x4e69e0;_0x1f8f0f=0xc8;}else{_0x1f8f0f=0xce;}_0x2787b6[_0x981c('0x1d')](_0x1f8f0f);return _0x2787b6[_0x981c('0x1e')](_0x981c('0x1f'),_0xe7371b+'-'+_0x2dde92+'/'+_0x4e69e0)['json'](_0x1eff46);}return null;};}function patchUpdates(_0x483af4){return function(_0x35f251){try{jsonpatch[_0x981c('0x20')](_0x35f251,_0x483af4,!![]);}catch(_0x1c3c1e){return BPromise['reject'](_0x1c3c1e);}return _0x35f251[_0x981c('0x21')]();};}function saveUpdates(_0x48d676,_0x35ec94){return function(_0x4bfbfc){if(_0x4bfbfc){return _0x4bfbfc[_0x981c('0x22')](_0x48d676)[_0x981c('0x23')](function(_0x3d1c78){return _0x3d1c78;});}return null;};}function removeEntity(_0x25000b,_0x2464c9){return function(_0x4a5905){if(_0x4a5905){return _0x4a5905[_0x981c('0x24')]()['then'](function(){_0x25000b[_0x981c('0x1d')](0xcc)[_0x981c('0x25')]();});}};}function handleEntityNotFound(_0x31a4a7,_0x460415){return function(_0x5ebe29){if(!_0x5ebe29){_0x31a4a7[_0x981c('0x17')](0x194);}return _0x5ebe29;};}function handleError(_0x50acd9,_0x3dfa17){_0x3dfa17=_0x3dfa17||0x1f4;return function(_0x3848d9){logger[_0x981c('0x26')](_0x3848d9[_0x981c('0x27')]);if(_0x3848d9[_0x981c('0x28')]){delete _0x3848d9['name'];}_0x50acd9[_0x981c('0x1d')](_0x3dfa17)['send'](_0x3848d9);};}exports[_0x981c('0x29')]=function(_0x1606b4,_0xae4fb6){var _0x5786a8={},_0x94ef9f={},_0x3d0eac={'count':0x0,'rows':[]};var _0x4709b2=_[_0x981c('0x2a')](db[_0x981c('0x2b')][_0x981c('0x2c')],function(_0x4b8a63){return{'name':_0x4b8a63[_0x981c('0x2d')],'type':_0x4b8a63[_0x981c('0x2e')]['key']};});_0x94ef9f[_0x981c('0x2f')]=_[_0x981c('0x2a')](_0x4709b2,'name');_0x94ef9f[_0x981c('0x30')]=_[_0x981c('0x31')](_0x1606b4[_0x981c('0x30')]);_0x94ef9f['filters']=_[_0x981c('0x32')](_0x94ef9f['model'],_0x94ef9f['query']);_0x5786a8[_0x981c('0x33')]=_[_0x981c('0x32')](_0x94ef9f[_0x981c('0x2f')],qs['fields'](_0x1606b4[_0x981c('0x30')][_0x981c('0x34')]));_0x5786a8[_0x981c('0x33')]=_0x5786a8[_0x981c('0x33')]['length']?_0x5786a8[_0x981c('0x33')]:_0x94ef9f[_0x981c('0x2f')];if(!_0x1606b4[_0x981c('0x30')][_0x981c('0x35')](_0x981c('0x36'))){_0x5786a8[_0x981c('0x1a')]=qs[_0x981c('0x1a')](_0x1606b4[_0x981c('0x30')][_0x981c('0x1a')]);_0x5786a8[_0x981c('0x1c')]=qs[_0x981c('0x1c')](_0x1606b4[_0x981c('0x30')][_0x981c('0x1c')]);}_0x5786a8[_0x981c('0x37')]=qs[_0x981c('0x38')](_0x1606b4[_0x981c('0x30')][_0x981c('0x38')]);_0x5786a8[_0x981c('0x39')]=qs[_0x981c('0x3a')](_[_0x981c('0x3b')](_0x1606b4[_0x981c('0x30')],_0x94ef9f['filters']),_0x4709b2);if(_0x1606b4[_0x981c('0x30')][_0x981c('0x3c')]){_0x5786a8[_0x981c('0x39')]=_[_0x981c('0x3d')](_0x5786a8[_0x981c('0x39')],{'$or':_['map'](_0x4709b2,function(_0x403b36){if(_0x403b36[_0x981c('0x2e')]!==_0x981c('0x3e')){var _0x3fd9c6={};_0x3fd9c6[_0x403b36[_0x981c('0x28')]]={'$like':'%'+_0x1606b4[_0x981c('0x30')][_0x981c('0x3c')]+'%'};return _0x3fd9c6;}})});}_0x5786a8=_[_0x981c('0x3d')]({},_0x5786a8,_0x1606b4[_0x981c('0x3f')]);var _0x3f4355={'where':_0x5786a8[_0x981c('0x39')]};return db[_0x981c('0x2b')]['count'](_0x3f4355)[_0x981c('0x23')](function(_0x25fdcf){_0x3d0eac[_0x981c('0x1b')]=_0x25fdcf;if(_0x1606b4[_0x981c('0x30')][_0x981c('0x40')]){_0x5786a8[_0x981c('0x41')]=[{'all':!![]}];}return db[_0x981c('0x2b')][_0x981c('0x42')](_0x5786a8);})[_0x981c('0x23')](function(_0x3da148){_0x3d0eac[_0x981c('0x43')]=_0x3da148;return _0x3d0eac;})['then'](respondWithFilteredResult(_0xae4fb6,_0x5786a8))[_0x981c('0x44')](handleError(_0xae4fb6,null));};exports['show']=function(_0x21b3f3,_0x1ccaca){var _0xc3c5dd={'raw':![],'where':{'id':_0x21b3f3[_0x981c('0x45')]['id']}},_0x4045b1={};_0x4045b1[_0x981c('0x2f')]=_[_0x981c('0x31')](db[_0x981c('0x2b')][_0x981c('0x2c')]);_0x4045b1['query']=_['keys'](_0x21b3f3[_0x981c('0x30')]);_0x4045b1[_0x981c('0x3a')]=_[_0x981c('0x32')](_0x4045b1[_0x981c('0x2f')],_0x4045b1[_0x981c('0x30')]);_0xc3c5dd[_0x981c('0x33')]=_['intersection'](_0x4045b1['model'],qs[_0x981c('0x34')](_0x21b3f3[_0x981c('0x30')][_0x981c('0x34')]));_0xc3c5dd[_0x981c('0x33')]=_0xc3c5dd[_0x981c('0x33')][_0x981c('0x46')]?_0xc3c5dd[_0x981c('0x33')]:_0x4045b1[_0x981c('0x2f')];if(_0x21b3f3['query'][_0x981c('0x40')]){_0xc3c5dd[_0x981c('0x41')]=[{'all':!![]}];}_0xc3c5dd=_[_0x981c('0x3d')]({},_0xc3c5dd,_0x21b3f3['options']);return db['SalesforceConfiguration'][_0x981c('0x47')](_0xc3c5dd)['then'](handleEntityNotFound(_0x1ccaca,null))[_0x981c('0x23')](respondWithResult(_0x1ccaca,null))[_0x981c('0x44')](handleError(_0x1ccaca,null));};exports[_0x981c('0x48')]=function(_0x732f9e,_0x28f871){return db['SalesforceConfiguration'][_0x981c('0x48')](_0x732f9e[_0x981c('0x49')],{})[_0x981c('0x23')](respondWithResult(_0x28f871,0xc9))[_0x981c('0x44')](handleError(_0x28f871,null));};exports[_0x981c('0x22')]=function(_0x29b59e,_0x30b13b){if(_0x29b59e[_0x981c('0x49')]['id']){delete _0x29b59e['body']['id'];}return db[_0x981c('0x2b')][_0x981c('0x47')]({'where':{'id':_0x29b59e[_0x981c('0x45')]['id']}})[_0x981c('0x23')](handleEntityNotFound(_0x30b13b,null))['then'](saveUpdates(_0x29b59e[_0x981c('0x49')],null))['then'](respondWithResult(_0x30b13b,null))[_0x981c('0x44')](handleError(_0x30b13b,null));};exports['destroy']=function(_0x4efcb7,_0xe0c27c){return db[_0x981c('0x2b')]['find']({'where':{'id':_0x4efcb7[_0x981c('0x45')]['id']}})[_0x981c('0x23')](handleEntityNotFound(_0xe0c27c,null))[_0x981c('0x23')](removeEntity(_0xe0c27c,null))[_0x981c('0x44')](handleError(_0xe0c27c,null));};exports[_0x981c('0x4a')]=function(_0x5d8a8f,_0x11410b,_0xfda88d){var _0x201b52={};var _0x158ca2={};var _0x1809c8;var _0x3de46a;return db[_0x981c('0x2b')][_0x981c('0x4b')]({'where':{'id':_0x5d8a8f['params']['id']}})['then'](handleEntityNotFound(_0x11410b,null))[_0x981c('0x23')](function(_0x206d08){if(_0x206d08){_0x1809c8=_0x206d08;_0x158ca2[_0x981c('0x2f')]=_['keys'](db[_0x981c('0x4c')][_0x981c('0x2c')]);_0x158ca2['query']=_[_0x981c('0x31')](_0x5d8a8f[_0x981c('0x30')]);_0x158ca2['filters']=_[_0x981c('0x32')](_0x158ca2[_0x981c('0x2f')],_0x158ca2[_0x981c('0x30')]);_0x201b52[_0x981c('0x33')]=_[_0x981c('0x32')](_0x158ca2[_0x981c('0x2f')],qs[_0x981c('0x34')](_0x5d8a8f[_0x981c('0x30')][_0x981c('0x34')]));_0x201b52[_0x981c('0x33')]=_0x201b52[_0x981c('0x33')][_0x981c('0x46')]?_0x201b52[_0x981c('0x33')]:_0x158ca2[_0x981c('0x2f')];_0x201b52[_0x981c('0x37')]=qs[_0x981c('0x38')](_0x5d8a8f[_0x981c('0x30')]['sort']);_0x201b52[_0x981c('0x39')]=qs[_0x981c('0x3a')](_['pick'](_0x5d8a8f[_0x981c('0x30')],_0x158ca2[_0x981c('0x3a')]));if(_0x5d8a8f[_0x981c('0x30')][_0x981c('0x3c')]){_0x201b52[_0x981c('0x39')]=_['merge'](_0x201b52[_0x981c('0x39')],{'$or':_[_0x981c('0x2a')](_0x201b52[_0x981c('0x33')],function(_0x3e6868){var _0x3e6410={};_0x3e6410[_0x3e6868]={'$like':'%'+_0x5d8a8f['query'][_0x981c('0x3c')]+'%'};return _0x3e6410;})});}_0x201b52=_[_0x981c('0x3d')]({},_0x201b52,_0x5d8a8f[_0x981c('0x3f')]);return _0x1809c8[_0x981c('0x4a')](_0x201b52);}})[_0x981c('0x23')](function(_0x42850b){if(_0x42850b){_0x3de46a=_0x42850b[_0x981c('0x46')];if(!_0x5d8a8f['query'][_0x981c('0x35')](_0x981c('0x36'))){_0x201b52[_0x981c('0x1a')]=qs[_0x981c('0x1a')](_0x5d8a8f[_0x981c('0x30')][_0x981c('0x1a')]);_0x201b52[_0x981c('0x1c')]=qs[_0x981c('0x1c')](_0x5d8a8f[_0x981c('0x30')]['offset']);}return _0x1809c8[_0x981c('0x4a')](_0x201b52);}})[_0x981c('0x23')](function(_0x5d8533){if(_0x5d8533){return _0x5d8533?{'count':_0x3de46a,'rows':_0x5d8533}:null;}})[_0x981c('0x23')](respondWithResult(_0x11410b,null))[_0x981c('0x44')](handleError(_0x11410b,null));};exports['getSubjects']=function(_0x498d37,_0x3697eb,_0x153511){var _0x52df0c={};var _0x4f0de1={};var _0x49edf5;var _0x27b8af;return db[_0x981c('0x2b')][_0x981c('0x4b')]({'where':{'id':_0x498d37[_0x981c('0x45')]['id']}})[_0x981c('0x23')](handleEntityNotFound(_0x3697eb,null))['then'](function(_0x1dcafd){if(_0x1dcafd){_0x49edf5=_0x1dcafd;_0x4f0de1[_0x981c('0x2f')]=_[_0x981c('0x31')](db[_0x981c('0x4c')][_0x981c('0x2c')]);_0x4f0de1['query']=_[_0x981c('0x31')](_0x498d37[_0x981c('0x30')]);_0x4f0de1['filters']=_[_0x981c('0x32')](_0x4f0de1[_0x981c('0x2f')],_0x4f0de1[_0x981c('0x30')]);_0x52df0c['attributes']=_['intersection'](_0x4f0de1[_0x981c('0x2f')],qs[_0x981c('0x34')](_0x498d37[_0x981c('0x30')][_0x981c('0x34')]));_0x52df0c['attributes']=_0x52df0c[_0x981c('0x33')]['length']?_0x52df0c[_0x981c('0x33')]:_0x4f0de1[_0x981c('0x2f')];_0x52df0c['order']=qs['sort'](_0x498d37[_0x981c('0x30')][_0x981c('0x38')]);_0x52df0c[_0x981c('0x39')]=qs[_0x981c('0x3a')](_[_0x981c('0x3b')](_0x498d37[_0x981c('0x30')],_0x4f0de1[_0x981c('0x3a')]));if(_0x498d37['query'][_0x981c('0x3c')]){_0x52df0c[_0x981c('0x39')]=_[_0x981c('0x3d')](_0x52df0c['where'],{'$or':_[_0x981c('0x2a')](_0x52df0c[_0x981c('0x33')],function(_0x33e71f){var _0x2dcc7f={};_0x2dcc7f[_0x33e71f]={'$like':'%'+_0x498d37[_0x981c('0x30')][_0x981c('0x3c')]+'%'};return _0x2dcc7f;})});}_0x52df0c=_['merge']({},_0x52df0c,_0x498d37['options']);return _0x49edf5[_0x981c('0x4d')](_0x52df0c);}})[_0x981c('0x23')](function(_0x400907){if(_0x400907){_0x27b8af=_0x400907['length'];if(!_0x498d37['query'][_0x981c('0x35')](_0x981c('0x36'))){_0x52df0c[_0x981c('0x1a')]=qs[_0x981c('0x1a')](_0x498d37[_0x981c('0x30')]['limit']);_0x52df0c[_0x981c('0x1c')]=qs[_0x981c('0x1c')](_0x498d37[_0x981c('0x30')]['offset']);}return _0x49edf5[_0x981c('0x4d')](_0x52df0c);}})['then'](function(_0x299128){if(_0x299128){return _0x299128?{'count':_0x27b8af,'rows':_0x299128}:null;}})['then'](respondWithResult(_0x3697eb,null))[_0x981c('0x44')](handleError(_0x3697eb,null));};exports['getDescriptions']=function(_0x58855e,_0x24e465,_0x23e891){var _0x29f789={};var _0x55676d={};var _0x15fbaf;var _0x1c3d7f;return db['SalesforceConfiguration'][_0x981c('0x4b')]({'where':{'id':_0x58855e[_0x981c('0x45')]['id']}})[_0x981c('0x23')](handleEntityNotFound(_0x24e465,null))[_0x981c('0x23')](function(_0x384248){if(_0x384248){_0x15fbaf=_0x384248;_0x55676d[_0x981c('0x2f')]=_[_0x981c('0x31')](db[_0x981c('0x4c')][_0x981c('0x2c')]);_0x55676d['query']=_['keys'](_0x58855e[_0x981c('0x30')]);_0x55676d[_0x981c('0x3a')]=_['intersection'](_0x55676d[_0x981c('0x2f')],_0x55676d[_0x981c('0x30')]);_0x29f789[_0x981c('0x33')]=_['intersection'](_0x55676d[_0x981c('0x2f')],qs[_0x981c('0x34')](_0x58855e[_0x981c('0x30')][_0x981c('0x34')]));_0x29f789[_0x981c('0x33')]=_0x29f789[_0x981c('0x33')]['length']?_0x29f789[_0x981c('0x33')]:_0x55676d[_0x981c('0x2f')];_0x29f789['order']=qs[_0x981c('0x38')](_0x58855e[_0x981c('0x30')][_0x981c('0x38')]);_0x29f789['where']=qs[_0x981c('0x3a')](_[_0x981c('0x3b')](_0x58855e[_0x981c('0x30')],_0x55676d['filters']));if(_0x58855e[_0x981c('0x30')][_0x981c('0x3c')]){_0x29f789[_0x981c('0x39')]=_['merge'](_0x29f789['where'],{'$or':_['map'](_0x29f789[_0x981c('0x33')],function(_0x29b497){var _0x5abe62={};_0x5abe62[_0x29b497]={'$like':'%'+_0x58855e[_0x981c('0x30')][_0x981c('0x3c')]+'%'};return _0x5abe62;})});}_0x29f789=_[_0x981c('0x3d')]({},_0x29f789,_0x58855e[_0x981c('0x3f')]);return _0x15fbaf[_0x981c('0x4e')](_0x29f789);}})[_0x981c('0x23')](function(_0x35f21c){if(_0x35f21c){_0x1c3d7f=_0x35f21c[_0x981c('0x46')];if(!_0x58855e[_0x981c('0x30')]['hasOwnProperty'](_0x981c('0x36'))){_0x29f789['limit']=qs['limit'](_0x58855e['query']['limit']);_0x29f789[_0x981c('0x1c')]=qs[_0x981c('0x1c')](_0x58855e[_0x981c('0x30')][_0x981c('0x1c')]);}return _0x15fbaf[_0x981c('0x4e')](_0x29f789);}})[_0x981c('0x23')](function(_0x34f844){if(_0x34f844){return _0x34f844?{'count':_0x1c3d7f,'rows':_0x34f844}:null;}})['then'](respondWithResult(_0x24e465,null))[_0x981c('0x44')](handleError(_0x24e465,null));}; \ No newline at end of file +var _0xf51e=['sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','then','stack','name','send','map','fieldName','type','key','model','query','intersection','fields','attributes','length','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','SalesforceConfiguration','includeAll','include','findAll','rows','catch','show','params','keys','create','body','find','destroy','getFields','findOne','SalesforceField','hasOwnProperty','getSubjects','rawAttributes','nolimit','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path'];(function(_0x1193e8,_0x311c15){var _0x190145=function(_0x361923){while(--_0x361923){_0x1193e8['push'](_0x1193e8['shift']());}};_0x190145(++_0x311c15);}(_0xf51e,0x9a));var _0xef51=function(_0x40d395,_0x2995d6){_0x40d395=_0x40d395-0x0;var _0x239f1a=_0xf51e[_0x40d395];return _0x239f1a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xef51('0x0'));var zipdir=require(_0xef51('0x1'));var jsonpatch=require(_0xef51('0x2'));var rp=require(_0xef51('0x3'));var moment=require(_0xef51('0x4'));var BPromise=require(_0xef51('0x5'));var Mustache=require(_0xef51('0x6'));var util=require('util');var path=require(_0xef51('0x7'));var sox=require(_0xef51('0x8'));var csv=require(_0xef51('0x9'));var ejs=require(_0xef51('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xef51('0xb'));var squel=require(_0xef51('0xc'));var crypto=require('crypto');var jsforce=require(_0xef51('0xd'));var deskjs=require(_0xef51('0xe'));var toCsv=require(_0xef51('0x9'));var querystring=require(_0xef51('0xf'));var Papa=require(_0xef51('0x10'));var Redis=require('ioredis');var authService=require(_0xef51('0x11'));var qs=require(_0xef51('0x12'));var as=require(_0xef51('0x13'));var hardwareService=require(_0xef51('0x14'));var logger=require(_0xef51('0x15'))(_0xef51('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xef51('0x17'));var db=require(_0xef51('0x18'))['db'];function respondWithStatusCode(_0x25a3ca,_0x31d5d0){_0x31d5d0=_0x31d5d0||0xcc;return function(_0x151806){if(_0x151806){return _0x25a3ca[_0xef51('0x19')](_0x31d5d0);}return _0x25a3ca[_0xef51('0x1a')](_0x31d5d0)[_0xef51('0x1b')]();};}function respondWithResult(_0x9efe16,_0x3fa2b4){_0x3fa2b4=_0x3fa2b4||0xc8;return function(_0x3d0ab6){if(_0x3d0ab6){return _0x9efe16[_0xef51('0x1a')](_0x3fa2b4)[_0xef51('0x1c')](_0x3d0ab6);}};}function respondWithFilteredResult(_0x5f10a7,_0x5a10f5){return function(_0x508aa2){if(_0x508aa2){var _0x4d21f7=typeof _0x5a10f5[_0xef51('0x1d')]===_0xef51('0x1e')&&typeof _0x5a10f5['limit']===_0xef51('0x1e');var _0x439174=_0x508aa2[_0xef51('0x1f')];var _0x1d1bfe=_0x4d21f7?0x0:_0x5a10f5[_0xef51('0x1d')];var _0x484d87=_0x4d21f7?_0x508aa2['count']:_0x5a10f5[_0xef51('0x1d')]+_0x5a10f5[_0xef51('0x20')];var _0x36624d;if(_0x484d87>=_0x439174){_0x484d87=_0x439174;_0x36624d=0xc8;}else{_0x36624d=0xce;}_0x5f10a7[_0xef51('0x1a')](_0x36624d);return _0x5f10a7[_0xef51('0x21')](_0xef51('0x22'),_0x1d1bfe+'-'+_0x484d87+'/'+_0x439174)[_0xef51('0x1c')](_0x508aa2);}return null;};}function patchUpdates(_0x17ae69){return function(_0xaf54b3){try{jsonpatch['apply'](_0xaf54b3,_0x17ae69,!![]);}catch(_0x3847cd){return BPromise[_0xef51('0x23')](_0x3847cd);}return _0xaf54b3[_0xef51('0x24')]();};}function saveUpdates(_0x58b927,_0x830b0c){return function(_0x148b19){if(_0x148b19){return _0x148b19['update'](_0x58b927)['then'](function(_0x105e14){return _0x105e14;});}return null;};}function removeEntity(_0x44e05b,_0x1d06b7){return function(_0x442b9d){if(_0x442b9d){return _0x442b9d['destroy']()[_0xef51('0x25')](function(){_0x44e05b[_0xef51('0x1a')](0xcc)[_0xef51('0x1b')]();});}};}function handleEntityNotFound(_0x402a58,_0x3534ce){return function(_0x42667b){if(!_0x42667b){_0x402a58[_0xef51('0x19')](0x194);}return _0x42667b;};}function handleError(_0x350565,_0x20e8af){_0x20e8af=_0x20e8af||0x1f4;return function(_0x2e9ad7){logger['error'](_0x2e9ad7[_0xef51('0x26')]);if(_0x2e9ad7[_0xef51('0x27')]){delete _0x2e9ad7['name'];}_0x350565['status'](_0x20e8af)[_0xef51('0x28')](_0x2e9ad7);};}exports['index']=function(_0x11ba57,_0x3cb7c1){var _0x4e1cf0={},_0x546e1c={},_0x2a9996={'count':0x0,'rows':[]};var _0x316407=_[_0xef51('0x29')](db['SalesforceConfiguration']['rawAttributes'],function(_0xdc824){return{'name':_0xdc824[_0xef51('0x2a')],'type':_0xdc824[_0xef51('0x2b')][_0xef51('0x2c')]};});_0x546e1c[_0xef51('0x2d')]=_['map'](_0x316407,_0xef51('0x27'));_0x546e1c['query']=_['keys'](_0x11ba57[_0xef51('0x2e')]);_0x546e1c['filters']=_['intersection'](_0x546e1c[_0xef51('0x2d')],_0x546e1c[_0xef51('0x2e')]);_0x4e1cf0['attributes']=_[_0xef51('0x2f')](_0x546e1c[_0xef51('0x2d')],qs['fields'](_0x11ba57[_0xef51('0x2e')][_0xef51('0x30')]));_0x4e1cf0[_0xef51('0x31')]=_0x4e1cf0['attributes'][_0xef51('0x32')]?_0x4e1cf0['attributes']:_0x546e1c[_0xef51('0x2d')];if(!_0x11ba57[_0xef51('0x2e')]['hasOwnProperty']('nolimit')){_0x4e1cf0[_0xef51('0x20')]=qs[_0xef51('0x20')](_0x11ba57[_0xef51('0x2e')][_0xef51('0x20')]);_0x4e1cf0[_0xef51('0x1d')]=qs[_0xef51('0x1d')](_0x11ba57[_0xef51('0x2e')][_0xef51('0x1d')]);}_0x4e1cf0[_0xef51('0x33')]=qs['sort'](_0x11ba57[_0xef51('0x2e')][_0xef51('0x34')]);_0x4e1cf0[_0xef51('0x35')]=qs['filters'](_[_0xef51('0x36')](_0x11ba57['query'],_0x546e1c[_0xef51('0x37')]),_0x316407);if(_0x11ba57[_0xef51('0x2e')][_0xef51('0x38')]){_0x4e1cf0[_0xef51('0x35')]=_[_0xef51('0x39')](_0x4e1cf0[_0xef51('0x35')],{'$or':_[_0xef51('0x29')](_0x316407,function(_0x56db30){if(_0x56db30[_0xef51('0x2b')]!==_0xef51('0x3a')){var _0x425aba={};_0x425aba[_0x56db30[_0xef51('0x27')]]={'$like':'%'+_0x11ba57[_0xef51('0x2e')][_0xef51('0x38')]+'%'};return _0x425aba;}})});}_0x4e1cf0=_['merge']({},_0x4e1cf0,_0x11ba57[_0xef51('0x3b')]);var _0x1d1559={'where':_0x4e1cf0[_0xef51('0x35')]};return db[_0xef51('0x3c')][_0xef51('0x1f')](_0x1d1559)[_0xef51('0x25')](function(_0x406907){_0x2a9996[_0xef51('0x1f')]=_0x406907;if(_0x11ba57[_0xef51('0x2e')][_0xef51('0x3d')]){_0x4e1cf0[_0xef51('0x3e')]=[{'all':!![]}];}return db[_0xef51('0x3c')][_0xef51('0x3f')](_0x4e1cf0);})[_0xef51('0x25')](function(_0x426ad5){_0x2a9996[_0xef51('0x40')]=_0x426ad5;return _0x2a9996;})[_0xef51('0x25')](respondWithFilteredResult(_0x3cb7c1,_0x4e1cf0))[_0xef51('0x41')](handleError(_0x3cb7c1,null));};exports[_0xef51('0x42')]=function(_0x1fd71,_0x34068a){var _0x30b606={'raw':![],'where':{'id':_0x1fd71[_0xef51('0x43')]['id']}},_0x4da9f2={};_0x4da9f2[_0xef51('0x2d')]=_['keys'](db[_0xef51('0x3c')]['rawAttributes']);_0x4da9f2[_0xef51('0x2e')]=_[_0xef51('0x44')](_0x1fd71[_0xef51('0x2e')]);_0x4da9f2[_0xef51('0x37')]=_[_0xef51('0x2f')](_0x4da9f2[_0xef51('0x2d')],_0x4da9f2[_0xef51('0x2e')]);_0x30b606[_0xef51('0x31')]=_[_0xef51('0x2f')](_0x4da9f2[_0xef51('0x2d')],qs[_0xef51('0x30')](_0x1fd71[_0xef51('0x2e')][_0xef51('0x30')]));_0x30b606[_0xef51('0x31')]=_0x30b606['attributes'][_0xef51('0x32')]?_0x30b606['attributes']:_0x4da9f2[_0xef51('0x2d')];if(_0x1fd71['query'][_0xef51('0x3d')]){_0x30b606[_0xef51('0x3e')]=[{'all':!![]}];}_0x30b606=_['merge']({},_0x30b606,_0x1fd71['options']);return db['SalesforceConfiguration']['find'](_0x30b606)[_0xef51('0x25')](handleEntityNotFound(_0x34068a,null))[_0xef51('0x25')](respondWithResult(_0x34068a,null))['catch'](handleError(_0x34068a,null));};exports[_0xef51('0x45')]=function(_0x5b9fed,_0x173a50){return db[_0xef51('0x3c')][_0xef51('0x45')](_0x5b9fed[_0xef51('0x46')],{})[_0xef51('0x25')](respondWithResult(_0x173a50,0xc9))['catch'](handleError(_0x173a50,null));};exports['update']=function(_0x329f1d,_0x3b8e5d){if(_0x329f1d['body']['id']){delete _0x329f1d[_0xef51('0x46')]['id'];}return db[_0xef51('0x3c')][_0xef51('0x47')]({'where':{'id':_0x329f1d[_0xef51('0x43')]['id']}})[_0xef51('0x25')](handleEntityNotFound(_0x3b8e5d,null))['then'](saveUpdates(_0x329f1d[_0xef51('0x46')],null))[_0xef51('0x25')](respondWithResult(_0x3b8e5d,null))[_0xef51('0x41')](handleError(_0x3b8e5d,null));};exports[_0xef51('0x48')]=function(_0x45c9b9,_0x4b9ca3){return db[_0xef51('0x3c')][_0xef51('0x47')]({'where':{'id':_0x45c9b9['params']['id']}})['then'](handleEntityNotFound(_0x4b9ca3,null))['then'](removeEntity(_0x4b9ca3,null))['catch'](handleError(_0x4b9ca3,null));};exports[_0xef51('0x49')]=function(_0xc45337,_0x10c063,_0x474e55){var _0x4fc820={};var _0x535f2d={};var _0x18d5fa;var _0xfb05b0;return db['SalesforceConfiguration'][_0xef51('0x4a')]({'where':{'id':_0xc45337[_0xef51('0x43')]['id']}})[_0xef51('0x25')](handleEntityNotFound(_0x10c063,null))[_0xef51('0x25')](function(_0x2d676c){if(_0x2d676c){_0x18d5fa=_0x2d676c;_0x535f2d[_0xef51('0x2d')]=_['keys'](db[_0xef51('0x4b')]['rawAttributes']);_0x535f2d[_0xef51('0x2e')]=_[_0xef51('0x44')](_0xc45337[_0xef51('0x2e')]);_0x535f2d[_0xef51('0x37')]=_['intersection'](_0x535f2d['model'],_0x535f2d[_0xef51('0x2e')]);_0x4fc820['attributes']=_[_0xef51('0x2f')](_0x535f2d['model'],qs[_0xef51('0x30')](_0xc45337['query']['fields']));_0x4fc820['attributes']=_0x4fc820[_0xef51('0x31')][_0xef51('0x32')]?_0x4fc820[_0xef51('0x31')]:_0x535f2d[_0xef51('0x2d')];_0x4fc820[_0xef51('0x33')]=qs[_0xef51('0x34')](_0xc45337[_0xef51('0x2e')][_0xef51('0x34')]);_0x4fc820[_0xef51('0x35')]=qs[_0xef51('0x37')](_[_0xef51('0x36')](_0xc45337[_0xef51('0x2e')],_0x535f2d[_0xef51('0x37')]));if(_0xc45337['query'][_0xef51('0x38')]){_0x4fc820['where']=_[_0xef51('0x39')](_0x4fc820[_0xef51('0x35')],{'$or':_[_0xef51('0x29')](_0x4fc820[_0xef51('0x31')],function(_0x1d66e6){var _0x447114={};_0x447114[_0x1d66e6]={'$like':'%'+_0xc45337['query'][_0xef51('0x38')]+'%'};return _0x447114;})});}_0x4fc820=_[_0xef51('0x39')]({},_0x4fc820,_0xc45337[_0xef51('0x3b')]);return _0x18d5fa[_0xef51('0x49')](_0x4fc820);}})['then'](function(_0x3de2b7){if(_0x3de2b7){_0xfb05b0=_0x3de2b7[_0xef51('0x32')];if(!_0xc45337[_0xef51('0x2e')][_0xef51('0x4c')]('nolimit')){_0x4fc820[_0xef51('0x20')]=qs[_0xef51('0x20')](_0xc45337[_0xef51('0x2e')][_0xef51('0x20')]);_0x4fc820['offset']=qs[_0xef51('0x1d')](_0xc45337[_0xef51('0x2e')][_0xef51('0x1d')]);}return _0x18d5fa[_0xef51('0x49')](_0x4fc820);}})[_0xef51('0x25')](function(_0x4b6fb7){if(_0x4b6fb7){return _0x4b6fb7?{'count':_0xfb05b0,'rows':_0x4b6fb7}:null;}})['then'](respondWithResult(_0x10c063,null))[_0xef51('0x41')](handleError(_0x10c063,null));};exports[_0xef51('0x4d')]=function(_0x417bcc,_0x292e1b,_0xe28e54){var _0x36ee3e={};var _0x8f0fd4={};var _0x5db19b;var _0x3c96c5;return db[_0xef51('0x3c')]['findOne']({'where':{'id':_0x417bcc[_0xef51('0x43')]['id']}})[_0xef51('0x25')](handleEntityNotFound(_0x292e1b,null))[_0xef51('0x25')](function(_0x166a50){if(_0x166a50){_0x5db19b=_0x166a50;_0x8f0fd4[_0xef51('0x2d')]=_[_0xef51('0x44')](db[_0xef51('0x4b')][_0xef51('0x4e')]);_0x8f0fd4[_0xef51('0x2e')]=_[_0xef51('0x44')](_0x417bcc[_0xef51('0x2e')]);_0x8f0fd4[_0xef51('0x37')]=_['intersection'](_0x8f0fd4['model'],_0x8f0fd4[_0xef51('0x2e')]);_0x36ee3e[_0xef51('0x31')]=_[_0xef51('0x2f')](_0x8f0fd4['model'],qs['fields'](_0x417bcc['query'][_0xef51('0x30')]));_0x36ee3e[_0xef51('0x31')]=_0x36ee3e[_0xef51('0x31')]['length']?_0x36ee3e['attributes']:_0x8f0fd4[_0xef51('0x2d')];_0x36ee3e[_0xef51('0x33')]=qs[_0xef51('0x34')](_0x417bcc[_0xef51('0x2e')][_0xef51('0x34')]);_0x36ee3e[_0xef51('0x35')]=qs['filters'](_[_0xef51('0x36')](_0x417bcc['query'],_0x8f0fd4[_0xef51('0x37')]));if(_0x417bcc['query'][_0xef51('0x38')]){_0x36ee3e[_0xef51('0x35')]=_[_0xef51('0x39')](_0x36ee3e[_0xef51('0x35')],{'$or':_['map'](_0x36ee3e[_0xef51('0x31')],function(_0x203771){var _0x520d8a={};_0x520d8a[_0x203771]={'$like':'%'+_0x417bcc[_0xef51('0x2e')][_0xef51('0x38')]+'%'};return _0x520d8a;})});}_0x36ee3e=_['merge']({},_0x36ee3e,_0x417bcc[_0xef51('0x3b')]);return _0x5db19b['getSubjects'](_0x36ee3e);}})['then'](function(_0x4fc9dd){if(_0x4fc9dd){_0x3c96c5=_0x4fc9dd[_0xef51('0x32')];if(!_0x417bcc[_0xef51('0x2e')][_0xef51('0x4c')](_0xef51('0x4f'))){_0x36ee3e[_0xef51('0x20')]=qs['limit'](_0x417bcc[_0xef51('0x2e')][_0xef51('0x20')]);_0x36ee3e['offset']=qs['offset'](_0x417bcc['query'][_0xef51('0x1d')]);}return _0x5db19b[_0xef51('0x4d')](_0x36ee3e);}})['then'](function(_0x473bf5){if(_0x473bf5){return _0x473bf5?{'count':_0x3c96c5,'rows':_0x473bf5}:null;}})[_0xef51('0x25')](respondWithResult(_0x292e1b,null))[_0xef51('0x41')](handleError(_0x292e1b,null));};exports[_0xef51('0x50')]=function(_0x43fe65,_0x574b24,_0x347821){var _0x2e1b06={};var _0x124ea1={};var _0x563166;var _0x4816a8;return db[_0xef51('0x3c')]['findOne']({'where':{'id':_0x43fe65[_0xef51('0x43')]['id']}})[_0xef51('0x25')](handleEntityNotFound(_0x574b24,null))['then'](function(_0x3b2268){if(_0x3b2268){_0x563166=_0x3b2268;_0x124ea1[_0xef51('0x2d')]=_[_0xef51('0x44')](db[_0xef51('0x4b')][_0xef51('0x4e')]);_0x124ea1[_0xef51('0x2e')]=_['keys'](_0x43fe65['query']);_0x124ea1['filters']=_[_0xef51('0x2f')](_0x124ea1[_0xef51('0x2d')],_0x124ea1[_0xef51('0x2e')]);_0x2e1b06[_0xef51('0x31')]=_['intersection'](_0x124ea1[_0xef51('0x2d')],qs[_0xef51('0x30')](_0x43fe65['query'][_0xef51('0x30')]));_0x2e1b06['attributes']=_0x2e1b06[_0xef51('0x31')][_0xef51('0x32')]?_0x2e1b06[_0xef51('0x31')]:_0x124ea1[_0xef51('0x2d')];_0x2e1b06[_0xef51('0x33')]=qs[_0xef51('0x34')](_0x43fe65['query']['sort']);_0x2e1b06[_0xef51('0x35')]=qs[_0xef51('0x37')](_['pick'](_0x43fe65[_0xef51('0x2e')],_0x124ea1['filters']));if(_0x43fe65[_0xef51('0x2e')][_0xef51('0x38')]){_0x2e1b06[_0xef51('0x35')]=_['merge'](_0x2e1b06[_0xef51('0x35')],{'$or':_[_0xef51('0x29')](_0x2e1b06[_0xef51('0x31')],function(_0x5e7e08){var _0x102121={};_0x102121[_0x5e7e08]={'$like':'%'+_0x43fe65['query']['filter']+'%'};return _0x102121;})});}_0x2e1b06=_['merge']({},_0x2e1b06,_0x43fe65[_0xef51('0x3b')]);return _0x563166['getDescriptions'](_0x2e1b06);}})[_0xef51('0x25')](function(_0x274f15){if(_0x274f15){_0x4816a8=_0x274f15[_0xef51('0x32')];if(!_0x43fe65[_0xef51('0x2e')][_0xef51('0x4c')](_0xef51('0x4f'))){_0x2e1b06[_0xef51('0x20')]=qs[_0xef51('0x20')](_0x43fe65[_0xef51('0x2e')]['limit']);_0x2e1b06['offset']=qs[_0xef51('0x1d')](_0x43fe65['query'][_0xef51('0x1d')]);}return _0x563166[_0xef51('0x50')](_0x2e1b06);}})['then'](function(_0x557c20){if(_0x557c20){return _0x557c20?{'count':_0x4816a8,'rows':_0x557c20}:null;}})[_0xef51('0x25')](respondWithResult(_0x574b24,null))[_0xef51('0x41')](handleError(_0x574b24,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index dc05705..d546f58 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 _0xceaa=['define','SalesforceConfiguration','int_salesforce_configurations','lodash','util','../../config/logger','api','bluebird','path','../../config/environment','./intSalesforceConfiguration.attributes','exports'];(function(_0x596284,_0x1cd02b){var _0x5313c6=function(_0x77db49){while(--_0x77db49){_0x596284['push'](_0x596284['shift']());}};_0x5313c6(++_0x1cd02b);}(_0xceaa,0x117));var _0xacea=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xceaa[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xacea('0x0'));var util=require(_0xacea('0x1'));var logger=require(_0xacea('0x2'))(_0xacea('0x3'));var moment=require('moment');var BPromise=require(_0xacea('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xacea('0x5'));var rimraf=require('rimraf');var config=require(_0xacea('0x6'));var attributes=require(_0xacea('0x7'));module[_0xacea('0x8')]=function(_0x3adf43,_0x35deac){return _0x3adf43[_0xacea('0x9')](_0xacea('0xa'),attributes,{'tableName':_0xacea('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4e87=['moment','bluebird','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash','util','api'];(function(_0x1ad926,_0x3e1fed){var _0x1b81dc=function(_0x506f83){while(--_0x506f83){_0x1ad926['push'](_0x1ad926['shift']());}};_0x1b81dc(++_0x3e1fed);}(_0x4e87,0x7f));var _0x74e8=function(_0x208ecc,_0x45c0a4){_0x208ecc=_0x208ecc-0x0;var _0x326b28=_0x4e87[_0x208ecc];return _0x326b28;};'use strict';var _=require(_0x74e8('0x0'));var util=require(_0x74e8('0x1'));var logger=require('../../config/logger')(_0x74e8('0x2'));var moment=require(_0x74e8('0x3'));var BPromise=require(_0x74e8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x74e8('0x5'));var rimraf=require(_0x74e8('0x6'));var config=require(_0x74e8('0x7'));var attributes=require(_0x74e8('0x8'));module[_0x74e8('0x9')]=function(_0x2e0507,_0x227ec5){return _0x2e0507[_0x74e8('0xa')](_0x74e8('0xb'),attributes,{'tableName':_0x74e8('0xc'),'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 ec3cb87..89e9743 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 _0xc2f3=['client','http','info','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','code','SalesforceConfiguration,\x20%s,\x20%s','message','result','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise'];(function(_0x57add2,_0x4f2b7d){var _0x4e3670=function(_0x3311b){while(--_0x3311b){_0x57add2['push'](_0x57add2['shift']());}};_0x4e3670(++_0x4f2b7d);}(_0xc2f3,0x1d3));var _0x3c2f=function(_0x522df1,_0x4ffa8d){_0x522df1=_0x522df1-0x0;var _0x87ead3=_0xc2f3[_0x522df1];return _0x87ead3;};'use strict';var _=require(_0x3c2f('0x0'));var util=require(_0x3c2f('0x1'));var moment=require('moment');var BPromise=require(_0x3c2f('0x2'));var rs=require(_0x3c2f('0x3'));var fs=require('fs');var Redis=require(_0x3c2f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3c2f('0x5'));var logger=require(_0x3c2f('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3c2f('0x7'));var client=jayson[_0x3c2f('0x8')][_0x3c2f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1dd74d,_0x3dfc69,_0x182782){return new BPromise(function(_0x5aa4ad,_0x38c439){return client['request'](_0x1dd74d,_0x182782)['then'](function(_0x5827ea){logger[_0x3c2f('0xa')]('SalesforceConfiguration,\x20%s,\x20%s',_0x3dfc69,_0x3c2f('0xb'));logger[_0x3c2f('0xc')](_0x3c2f('0xd'),_0x3dfc69,'request\x20sent',JSON['stringify'](_0x5827ea));if(_0x5827ea[_0x3c2f('0xe')]){if(_0x5827ea[_0x3c2f('0xe')][_0x3c2f('0xf')]===0x1f4){logger['error'](_0x3c2f('0x10'),_0x3dfc69,_0x5827ea[_0x3c2f('0xe')][_0x3c2f('0x11')]);return _0x38c439(_0x5827ea[_0x3c2f('0xe')][_0x3c2f('0x11')]);}logger[_0x3c2f('0xe')](_0x3c2f('0x10'),_0x3dfc69,_0x5827ea['error'][_0x3c2f('0x11')]);return _0x5aa4ad(_0x5827ea[_0x3c2f('0xe')][_0x3c2f('0x11')]);}else{logger[_0x3c2f('0xa')]('SalesforceConfiguration,\x20%s,\x20%s',_0x3dfc69,'request\x20sent');_0x5aa4ad(_0x5827ea[_0x3c2f('0x12')]['message']);}})['catch'](function(_0x1e6e7b){logger[_0x3c2f('0xe')](_0x3c2f('0x10'),_0x3dfc69,_0x1e6e7b);_0x38c439(_0x1e6e7b);});});} \ No newline at end of file +var _0x8b88=['request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','SalesforceConfiguration,\x20%s,\x20%s'];(function(_0x26ce83,_0x15eee3){var _0x17c81c=function(_0x5e00fa){while(--_0x5e00fa){_0x26ce83['push'](_0x26ce83['shift']());}};_0x17c81c(++_0x15eee3);}(_0x8b88,0x1d1));var _0x88b8=function(_0x5285aa,_0x1bf371){_0x5285aa=_0x5285aa-0x0;var _0x26a4d6=_0x8b88[_0x5285aa];return _0x26a4d6;};'use strict';var _=require(_0x88b8('0x0'));var util=require(_0x88b8('0x1'));var moment=require(_0x88b8('0x2'));var BPromise=require(_0x88b8('0x3'));var rs=require(_0x88b8('0x4'));var fs=require('fs');var Redis=require(_0x88b8('0x5'));var db=require(_0x88b8('0x6'))['db'];var utils=require(_0x88b8('0x7'));var logger=require('../../config/logger')(_0x88b8('0x8'));var config=require('../../config/environment');var jayson=require(_0x88b8('0x9'));var client=jayson[_0x88b8('0xa')][_0x88b8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x33f708,_0x3880e7,_0x35597a){return new BPromise(function(_0x1552e5,_0x40801b){return client[_0x88b8('0xc')](_0x33f708,_0x35597a)[_0x88b8('0xd')](function(_0x518711){logger['info'](_0x88b8('0xe'),_0x3880e7,_0x88b8('0xf'));logger[_0x88b8('0x10')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x3880e7,_0x88b8('0xf'),JSON[_0x88b8('0x11')](_0x518711));if(_0x518711[_0x88b8('0x12')]){if(_0x518711[_0x88b8('0x12')][_0x88b8('0x13')]===0x1f4){logger[_0x88b8('0x12')](_0x88b8('0xe'),_0x3880e7,_0x518711[_0x88b8('0x12')][_0x88b8('0x14')]);return _0x40801b(_0x518711[_0x88b8('0x12')][_0x88b8('0x14')]);}logger[_0x88b8('0x12')](_0x88b8('0xe'),_0x3880e7,_0x518711[_0x88b8('0x12')][_0x88b8('0x14')]);return _0x1552e5(_0x518711[_0x88b8('0x12')][_0x88b8('0x14')]);}else{logger[_0x88b8('0x15')](_0x88b8('0xe'),_0x3880e7,'request\x20sent');_0x1552e5(_0x518711[_0x88b8('0x16')]['message']);}})[_0x88b8('0x17')](function(_0x252b03){logger[_0x88b8('0x12')](_0x88b8('0xe'),_0x3880e7,_0x252b03);_0x40801b(_0x252b03);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index bfc5d9c..bf2c9cb 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 _0x4eb1=['show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../config/environment','./intSalesforceField.controller','isAuthenticated','/:id'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x4eb1,0x1a0));var _0x14eb=function(_0x24e2c3,_0x11d26a){_0x24e2c3=_0x24e2c3-0x0;var _0x36733a=_0x4eb1[_0x24e2c3];return _0x36733a;};'use strict';var multer=require(_0x14eb('0x0'));var util=require(_0x14eb('0x1'));var path=require('path');var timeout=require(_0x14eb('0x2'));var express=require('express');var router=express[_0x14eb('0x3')]();var fs_extra=require(_0x14eb('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x14eb('0x5'));var controller=require(_0x14eb('0x6'));router['get']('/',auth[_0x14eb('0x7')](),controller['index']);router['get'](_0x14eb('0x8'),auth['isAuthenticated'](),controller[_0x14eb('0x9')]);router[_0x14eb('0xa')]('/',auth[_0x14eb('0x7')](),controller[_0x14eb('0xb')]);router[_0x14eb('0xc')](_0x14eb('0x8'),auth[_0x14eb('0x7')](),controller[_0x14eb('0xd')]);router[_0x14eb('0xe')]('/:id',auth[_0x14eb('0x7')](),controller[_0x14eb('0xf')]);module[_0x14eb('0x10')]=router; \ No newline at end of file +var _0x3d8c=['create','put','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','/:id','post'];(function(_0x533bb7,_0x4a8675){var _0x5957b8=function(_0xccce11){while(--_0xccce11){_0x533bb7['push'](_0x533bb7['shift']());}};_0x5957b8(++_0x4a8675);}(_0x3d8c,0x126));var _0xc3d8=function(_0x786e9,_0x1a029){_0x786e9=_0x786e9-0x0;var _0x1f891b=_0x3d8c[_0x786e9];return _0x1f891b;};'use strict';var multer=require('multer');var util=require(_0xc3d8('0x0'));var path=require(_0xc3d8('0x1'));var timeout=require('connect-timeout');var express=require(_0xc3d8('0x2'));var router=express[_0xc3d8('0x3')]();var fs_extra=require(_0xc3d8('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xc3d8('0x5'));var config=require(_0xc3d8('0x6'));var controller=require(_0xc3d8('0x7'));router[_0xc3d8('0x8')]('/',auth[_0xc3d8('0x9')](),controller['index']);router[_0xc3d8('0x8')](_0xc3d8('0xa'),auth[_0xc3d8('0x9')](),controller['show']);router[_0xc3d8('0xb')]('/',auth['isAuthenticated'](),controller[_0xc3d8('0xc')]);router[_0xc3d8('0xd')](_0xc3d8('0xa'),auth[_0xc3d8('0x9')](),controller['update']);router[_0xc3d8('0xe')](_0xc3d8('0xa'),auth['isAuthenticated'](),controller[_0xc3d8('0xf')]);module[_0xc3d8('0x10')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 19239b0..28099fe 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 _0x8474=['exports','customVariable','keyValue','picklist','string','STRING','variable','sequelize'];(function(_0xa5946f,_0x382696){var _0x2ed14b=function(_0x1d17e4){while(--_0x1d17e4){_0xa5946f['push'](_0xa5946f['shift']());}};_0x2ed14b(++_0x382696);}(_0x8474,0xb7));var _0x4847=function(_0x23368e,_0x141667){_0x23368e=_0x23368e-0x0;var _0x138af0=_0x8474[_0x23368e];return _0x138af0;};'use strict';var Sequelize=require(_0x4847('0x0'));module[_0x4847('0x1')]={'type':{'type':Sequelize['ENUM']('string','variable',_0x4847('0x2'),_0x4847('0x3'),_0x4847('0x4')),'defaultValue':_0x4847('0x5')},'content':{'type':Sequelize[_0x4847('0x6')]},'key':{'type':Sequelize[_0x4847('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x4847('0x5'),_0x4847('0x7'),_0x4847('0x2'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0x4847('0x6')]}}; \ No newline at end of file +var _0xc650=['keyValue','picklist','STRING','customVariable','sequelize','exports','ENUM','string','variable'];(function(_0x445c98,_0x132bf7){var _0x2fe913=function(_0x32e864){while(--_0x32e864){_0x445c98['push'](_0x445c98['shift']());}};_0x2fe913(++_0x132bf7);}(_0xc650,0x1e1));var _0x0c65=function(_0x518bc3,_0x1bc5d6){_0x518bc3=_0x518bc3-0x0;var _0x3e1594=_0xc650[_0x518bc3];return _0x3e1594;};'use strict';var Sequelize=require(_0x0c65('0x0'));module[_0x0c65('0x1')]={'type':{'type':Sequelize[_0x0c65('0x2')](_0x0c65('0x3'),_0x0c65('0x4'),'customVariable',_0x0c65('0x5'),_0x0c65('0x6')),'defaultValue':_0x0c65('0x3')},'content':{'type':Sequelize[_0x0c65('0x7')]},'key':{'type':Sequelize[_0x0c65('0x7')]},'keyType':{'type':Sequelize[_0x0c65('0x2')](_0x0c65('0x3'),_0x0c65('0x4'),_0x0c65('0x8'))},'keyContent':{'type':Sequelize[_0x0c65('0x7')]},'idField':{'type':Sequelize[_0x0c65('0x7')]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 2b52607..c26be0e 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 _0x6477=['params','length','body','find','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','update','then','destroy','error','name','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','SalesforceField','findAll','rows','catch','show'];(function(_0x5c2ae0,_0x57ca47){var _0x50d6d8=function(_0x164e4f){while(--_0x164e4f){_0x5c2ae0['push'](_0x5c2ae0['shift']());}};_0x50d6d8(++_0x57ca47);}(_0x6477,0xd3));var _0x7647=function(_0x14f89e,_0x139fce){_0x14f89e=_0x14f89e-0x0;var _0x26092d=_0x6477[_0x14f89e];return _0x26092d;};'use strict';var emlformat=require(_0x7647('0x0'));var rimraf=require(_0x7647('0x1'));var zipdir=require(_0x7647('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7647('0x3'));var moment=require(_0x7647('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7647('0x5'));var util=require(_0x7647('0x6'));var path=require(_0x7647('0x7'));var sox=require(_0x7647('0x8'));var csv=require(_0x7647('0x9'));var ejs=require(_0x7647('0xa'));var fs=require('fs');var fs_extra=require(_0x7647('0xb'));var _=require(_0x7647('0xc'));var squel=require('squel');var crypto=require(_0x7647('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7647('0xe'));var Redis=require('ioredis');var authService=require(_0x7647('0xf'));var qs=require(_0x7647('0x10'));var as=require(_0x7647('0x11'));var hardwareService=require(_0x7647('0x12'));var logger=require(_0x7647('0x13'))(_0x7647('0x14'));var utils=require(_0x7647('0x15'));var config=require(_0x7647('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x38b595,_0x47be1a){_0x47be1a=_0x47be1a||0xcc;return function(_0x4dce5d){if(_0x4dce5d){return _0x38b595[_0x7647('0x17')](_0x47be1a);}return _0x38b595[_0x7647('0x18')](_0x47be1a)[_0x7647('0x19')]();};}function respondWithResult(_0x216d72,_0x3d8c6f){_0x3d8c6f=_0x3d8c6f||0xc8;return function(_0x4c311f){if(_0x4c311f){return _0x216d72[_0x7647('0x18')](_0x3d8c6f)[_0x7647('0x1a')](_0x4c311f);}};}function respondWithFilteredResult(_0x10ae95,_0x1dfab3){return function(_0xef1424){if(_0xef1424){var _0x3a4229=typeof _0x1dfab3[_0x7647('0x1b')]==='undefined'&&typeof _0x1dfab3['limit']===_0x7647('0x1c');var _0x3fab5d=_0xef1424[_0x7647('0x1d')];var _0x1ed196=_0x3a4229?0x0:_0x1dfab3[_0x7647('0x1b')];var _0x23e27f=_0x3a4229?_0xef1424[_0x7647('0x1d')]:_0x1dfab3[_0x7647('0x1b')]+_0x1dfab3[_0x7647('0x1e')];var _0x4bc0f3;if(_0x23e27f>=_0x3fab5d){_0x23e27f=_0x3fab5d;_0x4bc0f3=0xc8;}else{_0x4bc0f3=0xce;}_0x10ae95[_0x7647('0x18')](_0x4bc0f3);return _0x10ae95['set']('Content-Range',_0x1ed196+'-'+_0x23e27f+'/'+_0x3fab5d)[_0x7647('0x1a')](_0xef1424);}return null;};}function patchUpdates(_0x3383e9){return function(_0x1495f3){try{jsonpatch['apply'](_0x1495f3,_0x3383e9,!![]);}catch(_0x36593d){return BPromise['reject'](_0x36593d);}return _0x1495f3['save']();};}function saveUpdates(_0x367f10,_0x35292f){return function(_0x249d9e){if(_0x249d9e){return _0x249d9e[_0x7647('0x1f')](_0x367f10)[_0x7647('0x20')](function(_0x47925a){return _0x47925a;});}return null;};}function removeEntity(_0x6bcd60,_0x140046){return function(_0xb5bc52){if(_0xb5bc52){return _0xb5bc52[_0x7647('0x21')]()['then'](function(){_0x6bcd60[_0x7647('0x18')](0xcc)[_0x7647('0x19')]();});}};}function handleEntityNotFound(_0x1be1d4,_0x3789e1){return function(_0x481161){if(!_0x481161){_0x1be1d4['sendStatus'](0x194);}return _0x481161;};}function handleError(_0x292278,_0x1051bf){_0x1051bf=_0x1051bf||0x1f4;return function(_0x2b1423){logger[_0x7647('0x22')](_0x2b1423['stack']);if(_0x2b1423['name']){delete _0x2b1423[_0x7647('0x23')];}_0x292278[_0x7647('0x18')](_0x1051bf)['send'](_0x2b1423);};}exports['index']=function(_0x2fc5f0,_0x519e10){var _0x40eaa6={},_0x13b3ef={},_0x457bf1={'count':0x0,'rows':[]};var _0x55359f=_['map'](db['SalesforceField'][_0x7647('0x24')],function(_0x49c0f5){return{'name':_0x49c0f5[_0x7647('0x25')],'type':_0x49c0f5[_0x7647('0x26')][_0x7647('0x27')]};});_0x13b3ef['model']=_[_0x7647('0x28')](_0x55359f,_0x7647('0x23'));_0x13b3ef[_0x7647('0x29')]=_[_0x7647('0x2a')](_0x2fc5f0[_0x7647('0x29')]);_0x13b3ef[_0x7647('0x2b')]=_[_0x7647('0x2c')](_0x13b3ef[_0x7647('0x2d')],_0x13b3ef[_0x7647('0x29')]);_0x40eaa6[_0x7647('0x2e')]=_[_0x7647('0x2c')](_0x13b3ef['model'],qs[_0x7647('0x2f')](_0x2fc5f0['query']['fields']));_0x40eaa6[_0x7647('0x2e')]=_0x40eaa6['attributes']['length']?_0x40eaa6[_0x7647('0x2e')]:_0x13b3ef[_0x7647('0x2d')];if(!_0x2fc5f0['query'][_0x7647('0x30')](_0x7647('0x31'))){_0x40eaa6[_0x7647('0x1e')]=qs[_0x7647('0x1e')](_0x2fc5f0[_0x7647('0x29')]['limit']);_0x40eaa6[_0x7647('0x1b')]=qs[_0x7647('0x1b')](_0x2fc5f0['query'][_0x7647('0x1b')]);}_0x40eaa6[_0x7647('0x32')]=qs[_0x7647('0x33')](_0x2fc5f0[_0x7647('0x29')][_0x7647('0x33')]);_0x40eaa6[_0x7647('0x34')]=qs[_0x7647('0x2b')](_[_0x7647('0x35')](_0x2fc5f0[_0x7647('0x29')],_0x13b3ef['filters']),_0x55359f);if(_0x2fc5f0['query']['filter']){_0x40eaa6[_0x7647('0x34')]=_[_0x7647('0x36')](_0x40eaa6['where'],{'$or':_['map'](_0x55359f,function(_0x3a50f5){if(_0x3a50f5[_0x7647('0x26')]!==_0x7647('0x37')){var _0x5536bf={};_0x5536bf[_0x3a50f5['name']]={'$like':'%'+_0x2fc5f0[_0x7647('0x29')][_0x7647('0x38')]+'%'};return _0x5536bf;}})});}_0x40eaa6=_[_0x7647('0x36')]({},_0x40eaa6,_0x2fc5f0[_0x7647('0x39')]);var _0x20f1ff={'where':_0x40eaa6[_0x7647('0x34')]};return db['SalesforceField'][_0x7647('0x1d')](_0x20f1ff)[_0x7647('0x20')](function(_0xb06a4a){_0x457bf1['count']=_0xb06a4a;if(_0x2fc5f0[_0x7647('0x29')][_0x7647('0x3a')]){_0x40eaa6[_0x7647('0x3b')]=[{'all':!![]}];}return db[_0x7647('0x3c')][_0x7647('0x3d')](_0x40eaa6);})[_0x7647('0x20')](function(_0x3262bf){_0x457bf1[_0x7647('0x3e')]=_0x3262bf;return _0x457bf1;})['then'](respondWithFilteredResult(_0x519e10,_0x40eaa6))[_0x7647('0x3f')](handleError(_0x519e10,null));};exports[_0x7647('0x40')]=function(_0x38f70a,_0x26dd0c){var _0x33506a={'raw':!![],'where':{'id':_0x38f70a[_0x7647('0x41')]['id']}},_0x216c5b={};_0x216c5b[_0x7647('0x2d')]=_['keys'](db[_0x7647('0x3c')][_0x7647('0x24')]);_0x216c5b[_0x7647('0x29')]=_[_0x7647('0x2a')](_0x38f70a['query']);_0x216c5b['filters']=_[_0x7647('0x2c')](_0x216c5b[_0x7647('0x2d')],_0x216c5b[_0x7647('0x29')]);_0x33506a[_0x7647('0x2e')]=_[_0x7647('0x2c')](_0x216c5b['model'],qs[_0x7647('0x2f')](_0x38f70a[_0x7647('0x29')][_0x7647('0x2f')]));_0x33506a[_0x7647('0x2e')]=_0x33506a[_0x7647('0x2e')][_0x7647('0x42')]?_0x33506a[_0x7647('0x2e')]:_0x216c5b[_0x7647('0x2d')];if(_0x38f70a[_0x7647('0x29')][_0x7647('0x3a')]){_0x33506a[_0x7647('0x3b')]=[{'all':!![]}];}_0x33506a=_[_0x7647('0x36')]({},_0x33506a,_0x38f70a[_0x7647('0x39')]);return db[_0x7647('0x3c')]['find'](_0x33506a)[_0x7647('0x20')](handleEntityNotFound(_0x26dd0c,null))[_0x7647('0x20')](respondWithResult(_0x26dd0c,null))[_0x7647('0x3f')](handleError(_0x26dd0c,null));};exports['create']=function(_0x6d9ae1,_0x5cb1bf){return db[_0x7647('0x3c')]['create'](_0x6d9ae1[_0x7647('0x43')],{})[_0x7647('0x20')](respondWithResult(_0x5cb1bf,0xc9))[_0x7647('0x3f')](handleError(_0x5cb1bf,null));};exports[_0x7647('0x1f')]=function(_0x154672,_0x22aa0d){if(_0x154672[_0x7647('0x43')]['id']){delete _0x154672[_0x7647('0x43')]['id'];}return db['SalesforceField']['find']({'where':{'id':_0x154672[_0x7647('0x41')]['id']}})[_0x7647('0x20')](handleEntityNotFound(_0x22aa0d,null))['then'](saveUpdates(_0x154672['body'],null))['then'](respondWithResult(_0x22aa0d,null))[_0x7647('0x3f')](handleError(_0x22aa0d,null));};exports[_0x7647('0x21')]=function(_0x3a11e1,_0x560458){return db[_0x7647('0x3c')][_0x7647('0x44')]({'where':{'id':_0x3a11e1[_0x7647('0x41')]['id']}})[_0x7647('0x20')](handleEntityNotFound(_0x560458,null))['then'](removeEntity(_0x560458,null))[_0x7647('0x3f')](handleError(_0x560458,null));}; \ No newline at end of file +var _0x9111=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','show','keys','include','find','catch','create','body','params','destroy','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','end','stack','name','index','map','SalesforceField','rawAttributes','fieldName','type','model','query','filters','intersection'];(function(_0x2324b9,_0x16c9fc){var _0x4fbc6a=function(_0x26b0c6){while(--_0x26b0c6){_0x2324b9['push'](_0x2324b9['shift']());}};_0x4fbc6a(++_0x16c9fc);}(_0x9111,0xb9));var _0x1911=function(_0x1c8a3f,_0x3f2b40){_0x1c8a3f=_0x1c8a3f-0x0;var _0x348141=_0x9111[_0x1c8a3f];return _0x348141;};'use strict';var emlformat=require(_0x1911('0x0'));var rimraf=require(_0x1911('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1911('0x2'));var rp=require(_0x1911('0x3'));var moment=require(_0x1911('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1911('0x5'));var util=require(_0x1911('0x6'));var path=require(_0x1911('0x7'));var sox=require(_0x1911('0x8'));var csv=require(_0x1911('0x9'));var ejs=require(_0x1911('0xa'));var fs=require('fs');var fs_extra=require(_0x1911('0xb'));var _=require(_0x1911('0xc'));var squel=require('squel');var crypto=require(_0x1911('0xd'));var jsforce=require(_0x1911('0xe'));var deskjs=require(_0x1911('0xf'));var toCsv=require(_0x1911('0x9'));var querystring=require(_0x1911('0x10'));var Papa=require(_0x1911('0x11'));var Redis=require(_0x1911('0x12'));var authService=require(_0x1911('0x13'));var qs=require(_0x1911('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1911('0x15'));var logger=require(_0x1911('0x16'))(_0x1911('0x17'));var utils=require(_0x1911('0x18'));var config=require(_0x1911('0x19'));var licenseUtil=require(_0x1911('0x1a'));var db=require(_0x1911('0x1b'))['db'];function respondWithStatusCode(_0x3fe786,_0x301c6d){_0x301c6d=_0x301c6d||0xcc;return function(_0x41db8c){if(_0x41db8c){return _0x3fe786[_0x1911('0x1c')](_0x301c6d);}return _0x3fe786[_0x1911('0x1d')](_0x301c6d)['end']();};}function respondWithResult(_0x50daff,_0xcb2425){_0xcb2425=_0xcb2425||0xc8;return function(_0x30b479){if(_0x30b479){return _0x50daff[_0x1911('0x1d')](_0xcb2425)[_0x1911('0x1e')](_0x30b479);}};}function respondWithFilteredResult(_0x37b5a3,_0x187d41){return function(_0x20607a){if(_0x20607a){var _0x2835bc=typeof _0x187d41[_0x1911('0x1f')]===_0x1911('0x20')&&typeof _0x187d41[_0x1911('0x21')]===_0x1911('0x20');var _0x265691=_0x20607a[_0x1911('0x22')];var _0x17ef6a=_0x2835bc?0x0:_0x187d41[_0x1911('0x1f')];var _0x1a04da=_0x2835bc?_0x20607a['count']:_0x187d41[_0x1911('0x1f')]+_0x187d41[_0x1911('0x21')];var _0x37f24b;if(_0x1a04da>=_0x265691){_0x1a04da=_0x265691;_0x37f24b=0xc8;}else{_0x37f24b=0xce;}_0x37b5a3['status'](_0x37f24b);return _0x37b5a3[_0x1911('0x23')](_0x1911('0x24'),_0x17ef6a+'-'+_0x1a04da+'/'+_0x265691)['json'](_0x20607a);}return null;};}function patchUpdates(_0x5740d6){return function(_0x43bd4e){try{jsonpatch[_0x1911('0x25')](_0x43bd4e,_0x5740d6,!![]);}catch(_0xe748fe){return BPromise[_0x1911('0x26')](_0xe748fe);}return _0x43bd4e[_0x1911('0x27')]();};}function saveUpdates(_0x2b82c5,_0x18bf36){return function(_0x319926){if(_0x319926){return _0x319926[_0x1911('0x28')](_0x2b82c5)[_0x1911('0x29')](function(_0x32481b){return _0x32481b;});}return null;};}function removeEntity(_0x1f8824,_0x1c8d6c){return function(_0xd0e782){if(_0xd0e782){return _0xd0e782['destroy']()[_0x1911('0x29')](function(){_0x1f8824[_0x1911('0x1d')](0xcc)[_0x1911('0x2a')]();});}};}function handleEntityNotFound(_0x139175,_0x5501e5){return function(_0x95d3d8){if(!_0x95d3d8){_0x139175[_0x1911('0x1c')](0x194);}return _0x95d3d8;};}function handleError(_0x46f4fd,_0x42b674){_0x42b674=_0x42b674||0x1f4;return function(_0x2c80a9){logger['error'](_0x2c80a9[_0x1911('0x2b')]);if(_0x2c80a9[_0x1911('0x2c')]){delete _0x2c80a9[_0x1911('0x2c')];}_0x46f4fd[_0x1911('0x1d')](_0x42b674)['send'](_0x2c80a9);};}exports[_0x1911('0x2d')]=function(_0x2b0dab,_0x22d3ec){var _0x4a812a={},_0x525a28={},_0x4f807a={'count':0x0,'rows':[]};var _0x3301c2=_[_0x1911('0x2e')](db[_0x1911('0x2f')][_0x1911('0x30')],function(_0x2abefb){return{'name':_0x2abefb[_0x1911('0x31')],'type':_0x2abefb[_0x1911('0x32')]['key']};});_0x525a28[_0x1911('0x33')]=_[_0x1911('0x2e')](_0x3301c2,'name');_0x525a28[_0x1911('0x34')]=_['keys'](_0x2b0dab[_0x1911('0x34')]);_0x525a28[_0x1911('0x35')]=_[_0x1911('0x36')](_0x525a28[_0x1911('0x33')],_0x525a28[_0x1911('0x34')]);_0x4a812a[_0x1911('0x37')]=_[_0x1911('0x36')](_0x525a28[_0x1911('0x33')],qs[_0x1911('0x38')](_0x2b0dab[_0x1911('0x34')][_0x1911('0x38')]));_0x4a812a[_0x1911('0x37')]=_0x4a812a[_0x1911('0x37')][_0x1911('0x39')]?_0x4a812a[_0x1911('0x37')]:_0x525a28['model'];if(!_0x2b0dab[_0x1911('0x34')][_0x1911('0x3a')](_0x1911('0x3b'))){_0x4a812a['limit']=qs[_0x1911('0x21')](_0x2b0dab['query'][_0x1911('0x21')]);_0x4a812a[_0x1911('0x1f')]=qs[_0x1911('0x1f')](_0x2b0dab[_0x1911('0x34')][_0x1911('0x1f')]);}_0x4a812a[_0x1911('0x3c')]=qs[_0x1911('0x3d')](_0x2b0dab['query'][_0x1911('0x3d')]);_0x4a812a[_0x1911('0x3e')]=qs[_0x1911('0x35')](_[_0x1911('0x3f')](_0x2b0dab[_0x1911('0x34')],_0x525a28[_0x1911('0x35')]),_0x3301c2);if(_0x2b0dab[_0x1911('0x34')][_0x1911('0x40')]){_0x4a812a[_0x1911('0x3e')]=_['merge'](_0x4a812a[_0x1911('0x3e')],{'$or':_[_0x1911('0x2e')](_0x3301c2,function(_0xabe921){if(_0xabe921['type']!==_0x1911('0x41')){var _0x4546e2={};_0x4546e2[_0xabe921[_0x1911('0x2c')]]={'$like':'%'+_0x2b0dab[_0x1911('0x34')][_0x1911('0x40')]+'%'};return _0x4546e2;}})});}_0x4a812a=_[_0x1911('0x42')]({},_0x4a812a,_0x2b0dab[_0x1911('0x43')]);var _0x51cb5a={'where':_0x4a812a['where']};return db[_0x1911('0x2f')][_0x1911('0x22')](_0x51cb5a)['then'](function(_0x2ae262){_0x4f807a['count']=_0x2ae262;if(_0x2b0dab[_0x1911('0x34')][_0x1911('0x44')]){_0x4a812a['include']=[{'all':!![]}];}return db['SalesforceField'][_0x1911('0x45')](_0x4a812a);})[_0x1911('0x29')](function(_0x53cebf){_0x4f807a[_0x1911('0x46')]=_0x53cebf;return _0x4f807a;})[_0x1911('0x29')](respondWithFilteredResult(_0x22d3ec,_0x4a812a))['catch'](handleError(_0x22d3ec,null));};exports[_0x1911('0x47')]=function(_0x2518ff,_0x245e38){var _0x3f0e53={'raw':!![],'where':{'id':_0x2518ff['params']['id']}},_0x5a6d74={};_0x5a6d74['model']=_['keys'](db[_0x1911('0x2f')][_0x1911('0x30')]);_0x5a6d74[_0x1911('0x34')]=_[_0x1911('0x48')](_0x2518ff[_0x1911('0x34')]);_0x5a6d74[_0x1911('0x35')]=_['intersection'](_0x5a6d74['model'],_0x5a6d74[_0x1911('0x34')]);_0x3f0e53[_0x1911('0x37')]=_[_0x1911('0x36')](_0x5a6d74[_0x1911('0x33')],qs[_0x1911('0x38')](_0x2518ff[_0x1911('0x34')]['fields']));_0x3f0e53[_0x1911('0x37')]=_0x3f0e53[_0x1911('0x37')][_0x1911('0x39')]?_0x3f0e53['attributes']:_0x5a6d74[_0x1911('0x33')];if(_0x2518ff[_0x1911('0x34')]['includeAll']){_0x3f0e53[_0x1911('0x49')]=[{'all':!![]}];}_0x3f0e53=_['merge']({},_0x3f0e53,_0x2518ff['options']);return db[_0x1911('0x2f')][_0x1911('0x4a')](_0x3f0e53)[_0x1911('0x29')](handleEntityNotFound(_0x245e38,null))['then'](respondWithResult(_0x245e38,null))[_0x1911('0x4b')](handleError(_0x245e38,null));};exports[_0x1911('0x4c')]=function(_0x3527ef,_0x17c352){return db[_0x1911('0x2f')][_0x1911('0x4c')](_0x3527ef[_0x1911('0x4d')],{})[_0x1911('0x29')](respondWithResult(_0x17c352,0xc9))[_0x1911('0x4b')](handleError(_0x17c352,null));};exports[_0x1911('0x28')]=function(_0x44051a,_0x54b3fc){if(_0x44051a[_0x1911('0x4d')]['id']){delete _0x44051a['body']['id'];}return db[_0x1911('0x2f')][_0x1911('0x4a')]({'where':{'id':_0x44051a[_0x1911('0x4e')]['id']}})[_0x1911('0x29')](handleEntityNotFound(_0x54b3fc,null))['then'](saveUpdates(_0x44051a[_0x1911('0x4d')],null))['then'](respondWithResult(_0x54b3fc,null))[_0x1911('0x4b')](handleError(_0x54b3fc,null));};exports[_0x1911('0x4f')]=function(_0x2a0219,_0x2e7c9a){return db[_0x1911('0x2f')][_0x1911('0x4a')]({'where':{'id':_0x2a0219['params']['id']}})[_0x1911('0x29')](handleEntityNotFound(_0x2e7c9a,null))[_0x1911('0x29')](removeEntity(_0x2e7c9a,null))[_0x1911('0x4b')](handleError(_0x2e7c9a,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 08f8ed3..936bec1 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 _0x693a=['int_salesforce_fields','salesforce_unique_index','idField','FieldId','lodash','util','../../config/logger','api','bluebird','rimraf','../../config/environment','./intSalesforceField.attributes','exports','SalesforceField'];(function(_0x41e8de,_0x280ea3){var _0x532b7b=function(_0x50672b){while(--_0x50672b){_0x41e8de['push'](_0x41e8de['shift']());}};_0x532b7b(++_0x280ea3);}(_0x693a,0x74));var _0xa693=function(_0x190ff6,_0x515cfd){_0x190ff6=_0x190ff6-0x0;var _0x5356d2=_0x693a[_0x190ff6];return _0x5356d2;};'use strict';var _=require(_0xa693('0x0'));var util=require(_0xa693('0x1'));var logger=require(_0xa693('0x2'))(_0xa693('0x3'));var moment=require('moment');var BPromise=require(_0xa693('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa693('0x5'));var config=require(_0xa693('0x6'));var attributes=require(_0xa693('0x7'));module[_0xa693('0x8')]=function(_0x58e46a,_0x54e18e){return _0x58e46a['define'](_0xa693('0x9'),attributes,{'tableName':_0xa693('0xa'),'paranoid':![],'indexes':[{'name':_0xa693('0xb'),'fields':[_0xa693('0xc'),_0xa693('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1e1d=['rimraf','./intSalesforceField.attributes','SalesforceField','int_salesforce_fields','salesforce_unique_index','FieldId','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x208a7c,_0x266eda){var _0x2744e3=function(_0x50eae6){while(--_0x50eae6){_0x208a7c['push'](_0x208a7c['shift']());}};_0x2744e3(++_0x266eda);}(_0x1e1d,0x165));var _0xd1e1=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0x1e1d[_0x4b2863];return _0x567d67;};'use strict';var _=require(_0xd1e1('0x0'));var util=require(_0xd1e1('0x1'));var logger=require(_0xd1e1('0x2'))(_0xd1e1('0x3'));var moment=require(_0xd1e1('0x4'));var BPromise=require(_0xd1e1('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd1e1('0x6'));var rimraf=require(_0xd1e1('0x7'));var config=require('../../config/environment');var attributes=require(_0xd1e1('0x8'));module['exports']=function(_0x41249d,_0x52ec31){return _0x41249d['define'](_0xd1e1('0x9'),attributes,{'tableName':_0xd1e1('0xa'),'paranoid':![],'indexes':[{'name':_0xd1e1('0xb'),'fields':['idField',_0xd1e1('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index fcbb84b..f54caf6 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 _0xac61=['code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','jayson/promise','client','http','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x144ac8,_0x543991){var _0x47cd12=function(_0x145da1){while(--_0x145da1){_0x144ac8['push'](_0x144ac8['shift']());}};_0x47cd12(++_0x543991);}(_0xac61,0x76));var _0x1ac6=function(_0x14c152,_0x47cda4){_0x14c152=_0x14c152-0x0;var _0x5ca764=_0xac61[_0x14c152];return _0x5ca764;};'use strict';var _=require(_0x1ac6('0x0'));var util=require(_0x1ac6('0x1'));var moment=require(_0x1ac6('0x2'));var BPromise=require(_0x1ac6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1ac6('0x4'))['db'];var utils=require(_0x1ac6('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x1ac6('0x6'));var client=jayson[_0x1ac6('0x7')][_0x1ac6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x520245,_0x26b3b5,_0x5799d2){return new BPromise(function(_0x12c1c1,_0x288465){return client['request'](_0x520245,_0x5799d2)[_0x1ac6('0x9')](function(_0x35511d){logger[_0x1ac6('0xa')](_0x1ac6('0xb'),_0x26b3b5,_0x1ac6('0xc'));logger['debug']('SalesforceField,\x20%s,\x20%s,\x20%s',_0x26b3b5,_0x1ac6('0xc'),JSON[_0x1ac6('0xd')](_0x35511d));if(_0x35511d['error']){if(_0x35511d[_0x1ac6('0xe')][_0x1ac6('0xf')]===0x1f4){logger[_0x1ac6('0xe')](_0x1ac6('0xb'),_0x26b3b5,_0x35511d['error'][_0x1ac6('0x10')]);return _0x288465(_0x35511d[_0x1ac6('0xe')]['message']);}logger[_0x1ac6('0xe')](_0x1ac6('0xb'),_0x26b3b5,_0x35511d[_0x1ac6('0xe')][_0x1ac6('0x10')]);return _0x12c1c1(_0x35511d[_0x1ac6('0xe')][_0x1ac6('0x10')]);}else{logger[_0x1ac6('0xa')](_0x1ac6('0xb'),_0x26b3b5,_0x1ac6('0xc'));_0x12c1c1(_0x35511d[_0x1ac6('0x11')][_0x1ac6('0x10')]);}})[_0x1ac6('0x12')](function(_0x9ad8f8){logger[_0x1ac6('0xe')](_0x1ac6('0xb'),_0x26b3b5,_0x9ad8f8);_0x288465(_0x9ad8f8);});});} \ No newline at end of file +var _0xa05e=['request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','SalesforceField,\x20%s,\x20%s'];(function(_0x525054,_0x22c12e){var _0x3a2c61=function(_0x462ed5){while(--_0x462ed5){_0x525054['push'](_0x525054['shift']());}};_0x3a2c61(++_0x22c12e);}(_0xa05e,0x1a9));var _0xea05=function(_0x54ac4a,_0x463bce){_0x54ac4a=_0x54ac4a-0x0;var _0x1eeeb4=_0xa05e[_0x54ac4a];return _0x1eeeb4;};'use strict';var _=require(_0xea05('0x0'));var util=require(_0xea05('0x1'));var moment=require(_0xea05('0x2'));var BPromise=require(_0xea05('0x3'));var rs=require(_0xea05('0x4'));var fs=require('fs');var Redis=require(_0xea05('0x5'));var db=require(_0xea05('0x6'))['db'];var utils=require(_0xea05('0x7'));var logger=require(_0xea05('0x8'))(_0xea05('0x9'));var config=require('../../config/environment');var jayson=require(_0xea05('0xa'));var client=jayson[_0xea05('0xb')][_0xea05('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5d1e17,_0x532cd0,_0x27b0da){return new BPromise(function(_0x1434a4,_0x8cfb76){return client[_0xea05('0xd')](_0x5d1e17,_0x27b0da)[_0xea05('0xe')](function(_0x275a80){logger[_0xea05('0xf')](_0xea05('0x10'),_0x532cd0,_0xea05('0x11'));logger[_0xea05('0x12')](_0xea05('0x13'),_0x532cd0,_0xea05('0x11'),JSON[_0xea05('0x14')](_0x275a80));if(_0x275a80[_0xea05('0x15')]){if(_0x275a80['error'][_0xea05('0x16')]===0x1f4){logger[_0xea05('0x15')](_0xea05('0x10'),_0x532cd0,_0x275a80[_0xea05('0x15')][_0xea05('0x17')]);return _0x8cfb76(_0x275a80[_0xea05('0x15')][_0xea05('0x17')]);}logger[_0xea05('0x15')](_0xea05('0x10'),_0x532cd0,_0x275a80[_0xea05('0x15')]['message']);return _0x1434a4(_0x275a80[_0xea05('0x15')][_0xea05('0x17')]);}else{logger['info'](_0xea05('0x10'),_0x532cd0,'request\x20sent');_0x1434a4(_0x275a80[_0xea05('0x18')][_0xea05('0x17')]);}})[_0xea05('0x19')](function(_0x33b4dd){logger['error'](_0xea05('0x10'),_0x532cd0,_0x33b4dd);_0x8cfb76(_0x33b4dd);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 957df83..0e515c1 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 _0x3140=['get','isAuthenticated','index','/:id','/:id/configurations','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller'];(function(_0x5e1b91,_0x236f17){var _0x59b52f=function(_0x5c05ed){while(--_0x5c05ed){_0x5e1b91['push'](_0x5e1b91['shift']());}};_0x59b52f(++_0x236f17);}(_0x3140,0xaf));var _0x0314=function(_0x3fad5a,_0x2d3b02){_0x3fad5a=_0x3fad5a-0x0;var _0x4ca713=_0x3140[_0x3fad5a];return _0x4ca713;};'use strict';var multer=require(_0x0314('0x0'));var util=require(_0x0314('0x1'));var path=require(_0x0314('0x2'));var timeout=require(_0x0314('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x0314('0x4'));var auth=require(_0x0314('0x5'));var interaction=require(_0x0314('0x6'));var config=require(_0x0314('0x7'));var controller=require(_0x0314('0x8'));router[_0x0314('0x9')]('/',auth[_0x0314('0xa')](),controller[_0x0314('0xb')]);router[_0x0314('0x9')](_0x0314('0xc'),auth[_0x0314('0xa')](),controller['show']);router[_0x0314('0x9')](_0x0314('0xd'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x0314('0x9')]('/:id/fields',auth[_0x0314('0xa')](),controller[_0x0314('0xe')]);router[_0x0314('0xf')]('/',auth[_0x0314('0xa')](),controller[_0x0314('0x10')]);router[_0x0314('0xf')]('/:id/configurations',auth[_0x0314('0xa')](),controller[_0x0314('0x11')]);router[_0x0314('0x12')](_0x0314('0xc'),auth[_0x0314('0xa')](),controller[_0x0314('0x13')]);router[_0x0314('0x14')]('/:id',auth[_0x0314('0xa')](),controller[_0x0314('0x15')]);module[_0x0314('0x16')]=router; \ No newline at end of file +var _0xaa5f=['show','/:id/configurations','/:id/fields','getFields','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x2d7d66,_0x113a47){var _0x5af7dc=function(_0x5416c4){while(--_0x5416c4){_0x2d7d66['push'](_0x2d7d66['shift']());}};_0x5af7dc(++_0x113a47);}(_0xaa5f,0xb3));var _0xfaa5=function(_0x1c17f7,_0x4a178f){_0x1c17f7=_0x1c17f7-0x0;var _0x256a84=_0xaa5f[_0x1c17f7];return _0x256a84;};'use strict';var multer=require(_0xfaa5('0x0'));var util=require(_0xfaa5('0x1'));var path=require(_0xfaa5('0x2'));var timeout=require(_0xfaa5('0x3'));var express=require(_0xfaa5('0x4'));var router=express[_0xfaa5('0x5')]();var fs_extra=require(_0xfaa5('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xfaa5('0x7'));var config=require(_0xfaa5('0x8'));var controller=require('./intServicenowAccount.controller');router[_0xfaa5('0x9')]('/',auth[_0xfaa5('0xa')](),controller[_0xfaa5('0xb')]);router['get'](_0xfaa5('0xc'),auth[_0xfaa5('0xa')](),controller[_0xfaa5('0xd')]);router[_0xfaa5('0x9')](_0xfaa5('0xe'),auth[_0xfaa5('0xa')](),controller['getConfigurations']);router[_0xfaa5('0x9')](_0xfaa5('0xf'),auth['isAuthenticated'](),controller[_0xfaa5('0x10')]);router[_0xfaa5('0x11')]('/',auth[_0xfaa5('0xa')](),controller[_0xfaa5('0x12')]);router[_0xfaa5('0x11')](_0xfaa5('0xe'),auth[_0xfaa5('0xa')](),controller['addConfiguration']);router[_0xfaa5('0x13')](_0xfaa5('0xc'),auth['isAuthenticated'](),controller[_0xfaa5('0x14')]);router[_0xfaa5('0x15')](_0xfaa5('0xc'),auth['isAuthenticated'](),controller[_0xfaa5('0x16')]);module[_0xfaa5('0x17')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index be3d548..286ebad 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 _0x24f9=['STRING','username','remoteUri'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x24f9,0x11d));var _0x924f=function(_0x455d23,_0x6c46ba){_0x455d23=_0x455d23-0x0;var _0x1e55a4=_0x24f9[_0x455d23];return _0x1e55a4;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x924f('0x0')]},'description':{'type':Sequelize[_0x924f('0x0')]},'username':{'type':Sequelize[_0x924f('0x0')],'unique':_0x924f('0x1')},'password':{'type':Sequelize[_0x924f('0x0')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x924f('0x0')],'unique':_0x924f('0x2')},'serverUrl':{'type':Sequelize[_0x924f('0x0')],'allowNull':![]}}; \ No newline at end of file +var _0x5f52=['username','exports','STRING'];(function(_0x374c3c,_0x2bb048){var _0x493b30=function(_0x2f169f){while(--_0x2f169f){_0x374c3c['push'](_0x374c3c['shift']());}};_0x493b30(++_0x2bb048);}(_0x5f52,0x199));var _0x25f5=function(_0x263a2f,_0x1e81e3){_0x263a2f=_0x263a2f-0x0;var _0x8020e8=_0x5f52[_0x263a2f];return _0x8020e8;};'use strict';var Sequelize=require('sequelize');module[_0x25f5('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x25f5('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x25f5('0x2')},'password':{'type':Sequelize[_0x25f5('0x1')]},'email':{'type':Sequelize[_0x25f5('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'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 f9e80d2..c448e1a 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 _0x3cba=['Subjects','ServicenowField','Descriptions','made_sla','knowledge','close_code','notify','severity','category','parent','watch_list','upon_reject','sys_updated_on','child_incidents','hold_reason','resolved_by','sys_updated_by','opened_by','sys_created_on','sys_domain','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','impact','active','work_notes_list','business_service','priority','sys_domain_path','rfc','time_worked','expected_start','business_duration','group_list','reopened_time','caller_id','work_notes','short_description','correlation_display','delivery_task','assignment_group','business_stc','additional_assignee_list','sys_class_name','close_notes','closed_by','parent_incident','contact_type','incident_state','urgency','company','reassignment_count','activity_due','comments','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','escalation','upon_approval','correlation_id','location','username','remoteUri','format','%s/api/now/doc/table/schema/','%s/api/now/table/','password','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','includes','forEach','internalType','label','push','all','TCL:\x20_object','remove','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','test','Wrong\x20credentials','statusCode','boolean','True','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','eml-format','rimraf','moment','bluebird','mustache','sox','ejs','lodash','squel','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','rawAttributes','fieldName','type','map','keys','query','intersection','attributes','model','length','hasOwnProperty','order','sort','where','filters','filter','merge','options','ServicenowAccount','include','findAll','catch','show','fields','includeAll','find','create','body','params','destroy','findOne','ServicenowConfiguration','pick','getConfigurations','nolimit','AccountId','getSubjects','channel','getDescriptions'];(function(_0x3757cb,_0x3b38c7){var _0x1a9e6f=function(_0x4b91b3){while(--_0x4b91b3){_0x3757cb['push'](_0x3757cb['shift']());}};_0x1a9e6f(++_0x3b38c7);}(_0x3cba,0x10e));var _0xa3cb=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0x3cba[_0x1a36a5];return _0x746243;};'use strict';var emlformat=require(_0xa3cb('0x0'));var rimraf=require(_0xa3cb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa3cb('0x2'));var BPromise=require(_0xa3cb('0x3'));var Mustache=require(_0xa3cb('0x4'));var util=require('util');var path=require('path');var sox=require(_0xa3cb('0x5'));var csv=require('to-csv');var ejs=require(_0xa3cb('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa3cb('0x7'));var squel=require(_0xa3cb('0x8'));var crypto=require('crypto');var jsforce=require(_0xa3cb('0x9'));var deskjs=require('desk.js');var toCsv=require(_0xa3cb('0xa'));var querystring=require(_0xa3cb('0xb'));var Papa=require(_0xa3cb('0xc'));var Redis=require('ioredis');var authService=require(_0xa3cb('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa3cb('0xe'));var logger=require('../../config/logger')(_0xa3cb('0xf'));var utils=require(_0xa3cb('0x10'));var config=require(_0xa3cb('0x11'));var licenseUtil=require(_0xa3cb('0x12'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x449289,_0x201ed1){_0x201ed1=_0x201ed1||0xcc;return function(_0x59a2a1){if(_0x59a2a1){return _0x449289[_0xa3cb('0x13')](_0x201ed1);}return _0x449289[_0xa3cb('0x14')](_0x201ed1)[_0xa3cb('0x15')]();};}function respondWithResult(_0x2d5252,_0x3436c6){_0x3436c6=_0x3436c6||0xc8;return function(_0x34fc81){if(_0x34fc81){return _0x2d5252[_0xa3cb('0x14')](_0x3436c6)[_0xa3cb('0x16')](_0x34fc81);}};}function respondWithFilteredResult(_0x41db8b,_0x29c3de){return function(_0x448a53){if(_0x448a53){var _0x9bf25=typeof _0x29c3de['offset']===_0xa3cb('0x17')&&typeof _0x29c3de[_0xa3cb('0x18')]===_0xa3cb('0x17');var _0x21f71d=_0x448a53[_0xa3cb('0x19')];var _0x49ac86=_0x9bf25?0x0:_0x29c3de[_0xa3cb('0x1a')];var _0x4e21d2=_0x9bf25?_0x448a53[_0xa3cb('0x19')]:_0x29c3de['offset']+_0x29c3de[_0xa3cb('0x18')];var _0x55ec7f;if(_0x4e21d2>=_0x21f71d){_0x4e21d2=_0x21f71d;_0x55ec7f=0xc8;}else{_0x55ec7f=0xce;}_0x41db8b[_0xa3cb('0x14')](_0x55ec7f);return _0x41db8b[_0xa3cb('0x1b')](_0xa3cb('0x1c'),_0x49ac86+'-'+_0x4e21d2+'/'+_0x21f71d)['json'](_0x448a53);}return null;};}function patchUpdates(_0x2cf7a6){return function(_0xd5f48b){try{jsonpatch[_0xa3cb('0x1d')](_0xd5f48b,_0x2cf7a6,!![]);}catch(_0x1732ab){return BPromise[_0xa3cb('0x1e')](_0x1732ab);}return _0xd5f48b[_0xa3cb('0x1f')]();};}function saveUpdates(_0x615902,_0x383c91){return function(_0x1676b9){if(_0x1676b9){return _0x1676b9[_0xa3cb('0x20')](_0x615902)[_0xa3cb('0x21')](function(_0x439ec5){return _0x439ec5;});}return null;};}function removeEntity(_0x330cff,_0xfa87cf){return function(_0x59cb66){if(_0x59cb66){return _0x59cb66['destroy']()[_0xa3cb('0x21')](function(){_0x330cff[_0xa3cb('0x14')](0xcc)[_0xa3cb('0x15')]();});}};}function handleEntityNotFound(_0x1c6895,_0x425d64){return function(_0xf759fe){if(!_0xf759fe){_0x1c6895['sendStatus'](0x194);}return _0xf759fe;};}function handleError(_0x8122ac,_0xf6e420){_0xf6e420=_0xf6e420||0x1f4;return function(_0x556f73){logger[_0xa3cb('0x22')](_0x556f73[_0xa3cb('0x23')]);if(_0x556f73[_0xa3cb('0x24')]){delete _0x556f73[_0xa3cb('0x24')];}_0x8122ac[_0xa3cb('0x14')](_0xf6e420)[_0xa3cb('0x25')](_0x556f73);};}exports[_0xa3cb('0x26')]=function(_0x4847b9,_0x1226c){var _0x31e480={},_0x1fc0b7={},_0x9a691b={'count':0x0,'rows':[]};var _0x326cc1=_['map'](db['ServicenowAccount'][_0xa3cb('0x27')],function(_0x2459bc){return{'name':_0x2459bc[_0xa3cb('0x28')],'type':_0x2459bc[_0xa3cb('0x29')]['key']};});_0x1fc0b7['model']=_[_0xa3cb('0x2a')](_0x326cc1,_0xa3cb('0x24'));_0x1fc0b7['query']=_[_0xa3cb('0x2b')](_0x4847b9[_0xa3cb('0x2c')]);_0x1fc0b7['filters']=_[_0xa3cb('0x2d')](_0x1fc0b7['model'],_0x1fc0b7[_0xa3cb('0x2c')]);_0x31e480[_0xa3cb('0x2e')]=_['intersection'](_0x1fc0b7[_0xa3cb('0x2f')],qs['fields'](_0x4847b9[_0xa3cb('0x2c')]['fields']));_0x31e480[_0xa3cb('0x2e')]=_0x31e480[_0xa3cb('0x2e')][_0xa3cb('0x30')]?_0x31e480[_0xa3cb('0x2e')]:_0x1fc0b7['model'];if(!_0x4847b9[_0xa3cb('0x2c')][_0xa3cb('0x31')]('nolimit')){_0x31e480[_0xa3cb('0x18')]=qs[_0xa3cb('0x18')](_0x4847b9[_0xa3cb('0x2c')]['limit']);_0x31e480['offset']=qs[_0xa3cb('0x1a')](_0x4847b9[_0xa3cb('0x2c')][_0xa3cb('0x1a')]);}_0x31e480[_0xa3cb('0x32')]=qs[_0xa3cb('0x33')](_0x4847b9['query'][_0xa3cb('0x33')]);_0x31e480[_0xa3cb('0x34')]=qs['filters'](_['pick'](_0x4847b9['query'],_0x1fc0b7[_0xa3cb('0x35')]),_0x326cc1);if(_0x4847b9[_0xa3cb('0x2c')][_0xa3cb('0x36')]){_0x31e480['where']=_[_0xa3cb('0x37')](_0x31e480[_0xa3cb('0x34')],{'$or':_[_0xa3cb('0x2a')](_0x326cc1,function(_0x11d090){if(_0x11d090[_0xa3cb('0x29')]!=='VIRTUAL'){var _0x3c099c={};_0x3c099c[_0x11d090[_0xa3cb('0x24')]]={'$like':'%'+_0x4847b9[_0xa3cb('0x2c')][_0xa3cb('0x36')]+'%'};return _0x3c099c;}})});}_0x31e480=_[_0xa3cb('0x37')]({},_0x31e480,_0x4847b9[_0xa3cb('0x38')]);var _0x2c6a55={'where':_0x31e480[_0xa3cb('0x34')]};return db[_0xa3cb('0x39')]['count'](_0x2c6a55)['then'](function(_0x39e4d0){_0x9a691b[_0xa3cb('0x19')]=_0x39e4d0;if(_0x4847b9['query']['includeAll']){_0x31e480[_0xa3cb('0x3a')]=[{'all':!![]}];}return db['ServicenowAccount'][_0xa3cb('0x3b')](_0x31e480);})[_0xa3cb('0x21')](function(_0x58e409){_0x9a691b['rows']=_0x58e409;return _0x9a691b;})[_0xa3cb('0x21')](respondWithFilteredResult(_0x1226c,_0x31e480))[_0xa3cb('0x3c')](handleError(_0x1226c,null));};exports[_0xa3cb('0x3d')]=function(_0x2bd7de,_0x56398f){var _0x151f73={'raw':![],'where':{'id':_0x2bd7de['params']['id']}},_0x2e0e6b={};_0x2e0e6b[_0xa3cb('0x2f')]=_[_0xa3cb('0x2b')](db[_0xa3cb('0x39')][_0xa3cb('0x27')]);_0x2e0e6b['query']=_[_0xa3cb('0x2b')](_0x2bd7de['query']);_0x2e0e6b[_0xa3cb('0x35')]=_[_0xa3cb('0x2d')](_0x2e0e6b['model'],_0x2e0e6b[_0xa3cb('0x2c')]);_0x151f73['attributes']=_[_0xa3cb('0x2d')](_0x2e0e6b['model'],qs['fields'](_0x2bd7de[_0xa3cb('0x2c')][_0xa3cb('0x3e')]));_0x151f73['attributes']=_0x151f73[_0xa3cb('0x2e')][_0xa3cb('0x30')]?_0x151f73[_0xa3cb('0x2e')]:_0x2e0e6b[_0xa3cb('0x2f')];if(_0x2bd7de[_0xa3cb('0x2c')][_0xa3cb('0x3f')]){_0x151f73['include']=[{'all':!![]}];}_0x151f73=_[_0xa3cb('0x37')]({},_0x151f73,_0x2bd7de[_0xa3cb('0x38')]);return db[_0xa3cb('0x39')][_0xa3cb('0x40')](_0x151f73)[_0xa3cb('0x21')](handleEntityNotFound(_0x56398f,null))[_0xa3cb('0x21')](respondWithResult(_0x56398f,null))[_0xa3cb('0x3c')](handleError(_0x56398f,null));};exports[_0xa3cb('0x41')]=function(_0x4012de,_0x351084){return db[_0xa3cb('0x39')][_0xa3cb('0x41')](_0x4012de[_0xa3cb('0x42')],{})['then'](respondWithResult(_0x351084,0xc9))[_0xa3cb('0x3c')](handleError(_0x351084,null));};exports['update']=function(_0x267358,_0x30e296){if(_0x267358[_0xa3cb('0x42')]['id']){delete _0x267358[_0xa3cb('0x42')]['id'];}return db[_0xa3cb('0x39')][_0xa3cb('0x40')]({'where':{'id':_0x267358[_0xa3cb('0x43')]['id']}})[_0xa3cb('0x21')](handleEntityNotFound(_0x30e296,null))[_0xa3cb('0x21')](saveUpdates(_0x267358[_0xa3cb('0x42')],null))['then'](respondWithResult(_0x30e296,null))['catch'](handleError(_0x30e296,null));};exports[_0xa3cb('0x44')]=function(_0x3ba62e,_0x2ffa94){return db[_0xa3cb('0x39')][_0xa3cb('0x40')]({'where':{'id':_0x3ba62e['params']['id']}})[_0xa3cb('0x21')](handleEntityNotFound(_0x2ffa94,null))['then'](removeEntity(_0x2ffa94,null))[_0xa3cb('0x3c')](handleError(_0x2ffa94,null));};exports['getConfigurations']=function(_0x415fc4,_0x425f12,_0x2c9815){var _0x186137={};var _0x7c3741={};var _0x538a21;var _0x35d9be;return db[_0xa3cb('0x39')][_0xa3cb('0x45')]({'where':{'id':_0x415fc4['params']['id']}})[_0xa3cb('0x21')](handleEntityNotFound(_0x425f12,null))[_0xa3cb('0x21')](function(_0x409b19){if(_0x409b19){_0x538a21=_0x409b19;_0x7c3741[_0xa3cb('0x2f')]=_[_0xa3cb('0x2b')](db[_0xa3cb('0x46')][_0xa3cb('0x27')]);_0x7c3741[_0xa3cb('0x2c')]=_[_0xa3cb('0x2b')](_0x415fc4[_0xa3cb('0x2c')]);_0x7c3741[_0xa3cb('0x35')]=_[_0xa3cb('0x2d')](_0x7c3741[_0xa3cb('0x2f')],_0x7c3741[_0xa3cb('0x2c')]);_0x186137[_0xa3cb('0x2e')]=_['intersection'](_0x7c3741[_0xa3cb('0x2f')],qs[_0xa3cb('0x3e')](_0x415fc4[_0xa3cb('0x2c')]['fields']));_0x186137[_0xa3cb('0x2e')]=_0x186137[_0xa3cb('0x2e')][_0xa3cb('0x30')]?_0x186137[_0xa3cb('0x2e')]:_0x7c3741[_0xa3cb('0x2f')];_0x186137[_0xa3cb('0x32')]=qs[_0xa3cb('0x33')](_0x415fc4['query'][_0xa3cb('0x33')]);_0x186137[_0xa3cb('0x34')]=qs['filters'](_[_0xa3cb('0x47')](_0x415fc4[_0xa3cb('0x2c')],_0x7c3741['filters']));if(_0x415fc4['query'][_0xa3cb('0x36')]){_0x186137[_0xa3cb('0x34')]=_[_0xa3cb('0x37')](_0x186137[_0xa3cb('0x34')],{'$or':_[_0xa3cb('0x2a')](_0x186137[_0xa3cb('0x2e')],function(_0x121d9d){var _0x5bddae={};_0x5bddae[_0x121d9d]={'$like':'%'+_0x415fc4['query'][_0xa3cb('0x36')]+'%'};return _0x5bddae;})});}_0x186137=_[_0xa3cb('0x37')]({},_0x186137,_0x415fc4[_0xa3cb('0x38')]);return _0x538a21[_0xa3cb('0x48')](_0x186137);}})[_0xa3cb('0x21')](function(_0x92fca4){if(_0x92fca4){_0x35d9be=_0x92fca4['length'];if(!_0x415fc4[_0xa3cb('0x2c')][_0xa3cb('0x31')](_0xa3cb('0x49'))){_0x186137[_0xa3cb('0x18')]=qs[_0xa3cb('0x18')](_0x415fc4[_0xa3cb('0x2c')][_0xa3cb('0x18')]);_0x186137[_0xa3cb('0x1a')]=qs[_0xa3cb('0x1a')](_0x415fc4[_0xa3cb('0x2c')][_0xa3cb('0x1a')]);}return _0x538a21[_0xa3cb('0x48')](_0x186137);}})['then'](function(_0x5d5bd0){if(_0x5d5bd0){return _0x5d5bd0?{'count':_0x35d9be,'rows':_0x5d5bd0}:null;}})[_0xa3cb('0x21')](respondWithResult(_0x425f12,null))[_0xa3cb('0x3c')](handleError(_0x425f12,null));};exports['addConfiguration']=function(_0xe15847,_0x184cad,_0x53ad3b){if(_0xe15847[_0xa3cb('0x42')]['id']){delete _0xe15847[_0xa3cb('0x42')]['id'];}return db['ServicenowAccount']['findOne']({'where':{'id':_0xe15847['params']['id']}})[_0xa3cb('0x21')](handleEntityNotFound(_0x184cad,null))[_0xa3cb('0x21')](function(_0x4ec46e){if(_0x4ec46e){_0xe15847[_0xa3cb('0x42')][_0xa3cb('0x4a')]=_0x4ec46e['id'];_0xe15847['body']['Subjects']=integrations[_0xa3cb('0x4b')](_0xe15847[_0xa3cb('0x42')][_0xa3cb('0x4c')],_0xe15847[_0xa3cb('0x42')][_0xa3cb('0x29')]);_0xe15847[_0xa3cb('0x42')]['Descriptions']=integrations[_0xa3cb('0x4d')](_0xe15847['body'][_0xa3cb('0x4c')],_0xe15847[_0xa3cb('0x42')][_0xa3cb('0x29')]);return db[_0xa3cb('0x46')][_0xa3cb('0x41')](_0xe15847[_0xa3cb('0x42')],{'include':[{'model':db['ServicenowField'],'as':_0xa3cb('0x4e')},{'model':db[_0xa3cb('0x4f')],'as':_0xa3cb('0x50')}]});}return null;})['then'](respondWithResult(_0x184cad,null))['catch'](handleError(_0x184cad,null));};exports['getFields']=function(_0x51224f,_0x160382,_0x3f5c64){var _0x3d4bd7=[_0xa3cb('0x51'),'hold_reason',_0xa3cb('0x52'),'subcategory',_0xa3cb('0x53'),_0xa3cb('0x54'),'incident_state',_0xa3cb('0x55'),_0xa3cb('0x56')];var _0x1278ab=[_0xa3cb('0x57'),_0xa3cb('0x51'),'caused_by',_0xa3cb('0x58'),_0xa3cb('0x59'),_0xa3cb('0x5a'),_0xa3cb('0x5b'),_0xa3cb('0x5c'),'approval_history','number',_0xa3cb('0x5d'),_0xa3cb('0x5e'),_0xa3cb('0x5f'),'user_input',_0xa3cb('0x60'),_0xa3cb('0x61'),_0xa3cb('0x62'),_0xa3cb('0x63'),_0xa3cb('0x52'),_0xa3cb('0x32'),_0xa3cb('0x64'),_0xa3cb('0x65'),_0xa3cb('0x66'),'delivery_plan',_0xa3cb('0x67'),_0xa3cb('0x68'),_0xa3cb('0x69'),_0xa3cb('0x6a'),_0xa3cb('0x6b'),_0xa3cb('0x6c'),_0xa3cb('0x6d'),_0xa3cb('0x6e'),_0xa3cb('0x6f'),'opened_at',_0xa3cb('0x70'),_0xa3cb('0x71'),'work_end',_0xa3cb('0x72'),'resolved_at',_0xa3cb('0x73'),'approval_set','subcategory',_0xa3cb('0x74'),_0xa3cb('0x75'),'close_code',_0xa3cb('0x76'),_0xa3cb('0x77'),'work_start',_0xa3cb('0x78'),_0xa3cb('0x79'),_0xa3cb('0x7a'),'description','calendar_duration',_0xa3cb('0x54'),_0xa3cb('0x7b'),_0xa3cb('0x7c'),_0xa3cb('0x7d'),'follow_up',_0xa3cb('0x7e'),'sys_id',_0xa3cb('0x7f'),'reopened_by',_0xa3cb('0x80'),_0xa3cb('0x81'),'problem_id',_0xa3cb('0x82'),_0xa3cb('0x83'),_0xa3cb('0x84'),'assigned_to',_0xa3cb('0x55'),_0xa3cb('0x85'),'sla_due',_0xa3cb('0x86'),_0xa3cb('0x87'),_0xa3cb('0x88'),_0xa3cb('0x89'),_0xa3cb('0x8a'),'sys_tags',_0xa3cb('0x8b'),_0xa3cb('0x8c'),_0xa3cb('0x8d'),_0xa3cb('0x8e'),_0xa3cb('0x56')];var _0x42f1af='';var _0x14bbe1='';var _0x59680d=[];var _0x1f060e='';var _0x5de273='';var _0x34b009=[];var _0x2013bc='';var _0x26218d='';var _0x5ed15a={};var _0x18c31c='';return db['ServicenowAccount'][_0xa3cb('0x45')]({'where':{'id':_0x51224f[_0xa3cb('0x43')]['id']},'attributes':['id',_0xa3cb('0x8f'),'password','email',_0xa3cb('0x90'),'serverUrl']})[_0xa3cb('0x21')](handleEntityNotFound(_0x160382,null))['then'](function(_0xb6cf1e){if(_0xb6cf1e){_0x18c31c=_0xb6cf1e[_0xa3cb('0x90')];var _0x5ee5ca=_0x18c31c['slice'](-0x1);if(_0x5ee5ca==='/'){_0x18c31c=_0x18c31c['substring'](0x0,_0x18c31c['lastIndexOf'](_0x5ee5ca));}_0x26218d=util[_0xa3cb('0x91')](_0xa3cb('0x92'),_0x18c31c);_0x2013bc=util[_0xa3cb('0x91')](_0xa3cb('0x93'),_0x18c31c);_0x5ed15a={'user':_0xb6cf1e[_0xa3cb('0x8f')],'pass':_0xb6cf1e[_0xa3cb('0x94')]};var _0xc40787={'method':_0xa3cb('0x95'),'uri':_0x26218d+_0xa3cb('0x96'),'auth':_0x5ed15a,'json':!![]};return rp(_0xc40787);}})[_0xa3cb('0x21')](function(_0x3c3bae){if(_0x3c3bae[_0xa3cb('0x97')][_0xa3cb('0x30')]>0x0){_0x42f1af=_0x3c3bae[_0xa3cb('0x97')];}console[_0xa3cb('0x98')](_0xa3cb('0x99'),_0x42f1af);_0x34b009=[];_0x14bbe1=Object[_0xa3cb('0x9a')]([],_0x42f1af);_['remove'](_0x14bbe1,function(_0x44fd6a){return!_0x3d4bd7[_0xa3cb('0x9b')](_0x44fd6a[_0xa3cb('0x24')]);});_0x14bbe1[_0xa3cb('0x9c')](function(_0xabb123){var _0x5e39a7=createFieldObject(_0x2013bc,_0x5ed15a,_0xabb123[_0xa3cb('0x9d')],_0xabb123['name'],_0xabb123[_0xa3cb('0x9e')],![]);_0x34b009[_0xa3cb('0x9f')](_0x5e39a7);});return Promise[_0xa3cb('0xa0')](_0x34b009);})[_0xa3cb('0x21')](function(_0x35c11d){_0x59680d=_0x35c11d;_0x1f060e=Object[_0xa3cb('0x9a')]([],_0x42f1af);console[_0xa3cb('0x98')](_0xa3cb('0xa1'),_0x42f1af);_[_0xa3cb('0xa2')](_0x1f060e,function(_0x36b57f){return _0x1278ab[_0xa3cb('0x9b')](_0x36b57f[_0xa3cb('0x24')]);});console[_0xa3cb('0x98')](_0xa3cb('0xa3'),_0x1f060e);_0x34b009=[];_0x1f060e['forEach'](function(_0x1f17dd){var _0x409f4e=createFieldObject(_0x2013bc,_0x5ed15a,_0x1f17dd[_0xa3cb('0x9d')],_0x1f17dd[_0xa3cb('0x24')],_0x1f17dd[_0xa3cb('0x9e')],!![]);_0x34b009[_0xa3cb('0x9f')](_0x409f4e);});return Promise[_0xa3cb('0xa0')](_0x34b009);})['then'](function(_0x4349e3){_0x5de273=_0x4349e3;var _0x260de6=_0x59680d[_0xa3cb('0xa4')](_0x5de273);return{'count':_0x260de6[_0xa3cb('0x30')],'rows':_0x260de6};})[_0xa3cb('0x21')](respondWithResult(_0x160382,null))['catch'](function(_0x591daa){console['log']('ServiceNow\x20error:\x20'+_0x591daa);var _0x1cb7dd=_0x51224f[_0xa3cb('0x2c')][_0xa3cb('0xa5')]?0x1f4:_0x591daa['statusCode']||0x1f4;logger[_0xa3cb('0x22')](_0x591daa[_0xa3cb('0x23')]);delete _0x591daa[_0xa3cb('0x24')];if(_0x1cb7dd===0x191){_0x1cb7dd=0x190;}_0x160382[_0xa3cb('0x14')](_0x1cb7dd)[_0xa3cb('0x25')](_0x51224f['query'][_0xa3cb('0xa5')]?{'message':_0xa3cb('0xa6'),'statusCode':_0x591daa[_0xa3cb('0xa7')]}:_0x591daa);});};function createFieldObject(_0x2c68ca,_0x2c1a62,_0x24fc6d,_0x31a363,_0x2f6369,_0x28607c){return new Promise(function(_0x52fb2c,_0x125810){var _0x2302e2={'id':_0x31a363,'name':_0x2f6369,'custom':_0x28607c};if(_0x24fc6d===_0xa3cb('0xa8')){_0x2302e2[_0xa3cb('0x38')]=[{'name':_0xa3cb('0xa9'),'value':'true'},{'name':'False','value':_0xa3cb('0xaa')}];_0x52fb2c(_0x2302e2);}else{var _0x2c3db5={'method':'GET','uri':_0x2c68ca+_0xa3cb('0xab')+_0x31a363,'auth':_0x2c1a62,'json':!![]};return rp(_0x2c3db5)[_0xa3cb('0x21')](function(_0x4ea8e7){var _0x3ed1da=[];if(_0x4ea8e7['result'][_0xa3cb('0x30')]>0x0){_0x4ea8e7[_0xa3cb('0x97')]['forEach'](function(_0x51c207){if(_0x51c207[_0xa3cb('0xac')]===_0xa3cb('0xaa')){var _0x389748={'name':_0x51c207[_0xa3cb('0x9e')],'value':_0x51c207[_0xa3cb('0xad')]};_0x3ed1da[_0xa3cb('0x9f')](_0x389748);}});}_0x2302e2['options']=_0x3ed1da;if(_0x2302e2[_0xa3cb('0x38')][_0xa3cb('0x30')]>0x0){_0x52fb2c(_0x2302e2);}else{if(_0x28607c==![]){_0x52fb2c();}else{_0x52fb2c(_0x2302e2);}}});}});} \ No newline at end of file +var _0xf8c7=['problem_id','reassignment_count','activity_due','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','sys_tags','escalation','location','username','remoteUri','slice','substring','format','%s/api/now/doc/table/schema/','password','result','log','assign','remove','includes','label','push','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','forEach','internalType','concat','ServiceNow\x20error:\x20','test','statusCode','error','Wrong\x20credentials','boolean','True','true','False','false','inactive','value','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','end','stack','name','send','index','map','ServicenowAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','include','create','body','update','find','params','destroy','findOne','getConfigurations','hasOwnProperty','addConfiguration','AccountId','Subjects','channel','getDescriptions','ServicenowConfiguration','Descriptions','getFields','hold_reason','knowledge','close_code','notify','incident_state','severity','category','parent','made_sla','watch_list','upon_reject','sys_updated_on','approval_history','number','sys_updated_by','user_input','sys_created_on','sys_domain','state','sys_created_by','closed_at','cmdb_ci','delivery_plan','active','work_notes_list','priority','sys_domain_path','rfc','time_worked','expected_start','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','work_notes','short_description','correlation_display','work_start','assignment_group','business_stc','additional_assignee_list','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','sys_id','reopened_by','urgency'];(function(_0x2ef16e,_0x5b1018){var _0x5787b9=function(_0xdfe85e){while(--_0xdfe85e){_0x2ef16e['push'](_0x2ef16e['shift']());}};_0x5787b9(++_0x5b1018);}(_0xf8c7,0x19e));var _0x7f8c=function(_0x3256ca,_0x49677d){_0x3256ca=_0x3256ca-0x0;var _0x323732=_0xf8c7[_0x3256ca];return _0x323732;};'use strict';var emlformat=require(_0x7f8c('0x0'));var rimraf=require(_0x7f8c('0x1'));var zipdir=require(_0x7f8c('0x2'));var jsonpatch=require(_0x7f8c('0x3'));var rp=require(_0x7f8c('0x4'));var moment=require(_0x7f8c('0x5'));var BPromise=require(_0x7f8c('0x6'));var Mustache=require(_0x7f8c('0x7'));var util=require(_0x7f8c('0x8'));var path=require(_0x7f8c('0x9'));var sox=require('sox');var csv=require(_0x7f8c('0xa'));var ejs=require(_0x7f8c('0xb'));var fs=require('fs');var fs_extra=require(_0x7f8c('0xc'));var _=require('lodash');var squel=require(_0x7f8c('0xd'));var crypto=require(_0x7f8c('0xe'));var jsforce=require(_0x7f8c('0xf'));var deskjs=require(_0x7f8c('0x10'));var toCsv=require('to-csv');var querystring=require(_0x7f8c('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7f8c('0x12'));var qs=require(_0x7f8c('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7f8c('0x14'))(_0x7f8c('0x15'));var utils=require(_0x7f8c('0x16'));var config=require(_0x7f8c('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x7f8c('0x18'))['db'];var integrations=require(_0x7f8c('0x19'));function respondWithStatusCode(_0x152400,_0x2d5545){_0x2d5545=_0x2d5545||0xcc;return function(_0x3acf3c){if(_0x3acf3c){return _0x152400[_0x7f8c('0x1a')](_0x2d5545);}return _0x152400['status'](_0x2d5545)['end']();};}function respondWithResult(_0x46d976,_0x51995c){_0x51995c=_0x51995c||0xc8;return function(_0x44306a){if(_0x44306a){return _0x46d976[_0x7f8c('0x1b')](_0x51995c)[_0x7f8c('0x1c')](_0x44306a);}};}function respondWithFilteredResult(_0x1c1fff,_0x391b32){return function(_0x5350d1){if(_0x5350d1){var _0x544d88=typeof _0x391b32[_0x7f8c('0x1d')]==='undefined'&&typeof _0x391b32[_0x7f8c('0x1e')]===_0x7f8c('0x1f');var _0x2d4e50=_0x5350d1[_0x7f8c('0x20')];var _0xa33e78=_0x544d88?0x0:_0x391b32[_0x7f8c('0x1d')];var _0x3b7150=_0x544d88?_0x5350d1[_0x7f8c('0x20')]:_0x391b32['offset']+_0x391b32[_0x7f8c('0x1e')];var _0x5c0f11;if(_0x3b7150>=_0x2d4e50){_0x3b7150=_0x2d4e50;_0x5c0f11=0xc8;}else{_0x5c0f11=0xce;}_0x1c1fff['status'](_0x5c0f11);return _0x1c1fff[_0x7f8c('0x21')](_0x7f8c('0x22'),_0xa33e78+'-'+_0x3b7150+'/'+_0x2d4e50)[_0x7f8c('0x1c')](_0x5350d1);}return null;};}function patchUpdates(_0x18ac75){return function(_0x466a03){try{jsonpatch[_0x7f8c('0x23')](_0x466a03,_0x18ac75,!![]);}catch(_0x5aabef){return BPromise[_0x7f8c('0x24')](_0x5aabef);}return _0x466a03[_0x7f8c('0x25')]();};}function saveUpdates(_0x46baae,_0x3402ba){return function(_0x3717b2){if(_0x3717b2){return _0x3717b2['update'](_0x46baae)[_0x7f8c('0x26')](function(_0x5344e9){return _0x5344e9;});}return null;};}function removeEntity(_0x2e3514,_0x31d4a3){return function(_0x2eee59){if(_0x2eee59){return _0x2eee59['destroy']()[_0x7f8c('0x26')](function(){_0x2e3514[_0x7f8c('0x1b')](0xcc)[_0x7f8c('0x27')]();});}};}function handleEntityNotFound(_0x2e365e,_0x47b0c4){return function(_0x512418){if(!_0x512418){_0x2e365e[_0x7f8c('0x1a')](0x194);}return _0x512418;};}function handleError(_0x53bd4f,_0x243ed8){_0x243ed8=_0x243ed8||0x1f4;return function(_0x4ff59f){logger['error'](_0x4ff59f[_0x7f8c('0x28')]);if(_0x4ff59f[_0x7f8c('0x29')]){delete _0x4ff59f[_0x7f8c('0x29')];}_0x53bd4f[_0x7f8c('0x1b')](_0x243ed8)[_0x7f8c('0x2a')](_0x4ff59f);};}exports[_0x7f8c('0x2b')]=function(_0x3c5db9,_0x584918){var _0xb528d={},_0x200746={},_0x5010d1={'count':0x0,'rows':[]};var _0x588ce1=_[_0x7f8c('0x2c')](db[_0x7f8c('0x2d')][_0x7f8c('0x2e')],function(_0x38797a){return{'name':_0x38797a[_0x7f8c('0x2f')],'type':_0x38797a[_0x7f8c('0x30')][_0x7f8c('0x31')]};});_0x200746[_0x7f8c('0x32')]=_[_0x7f8c('0x2c')](_0x588ce1,_0x7f8c('0x29'));_0x200746['query']=_[_0x7f8c('0x33')](_0x3c5db9[_0x7f8c('0x34')]);_0x200746[_0x7f8c('0x35')]=_[_0x7f8c('0x36')](_0x200746[_0x7f8c('0x32')],_0x200746[_0x7f8c('0x34')]);_0xb528d['attributes']=_[_0x7f8c('0x36')](_0x200746[_0x7f8c('0x32')],qs['fields'](_0x3c5db9[_0x7f8c('0x34')][_0x7f8c('0x37')]));_0xb528d[_0x7f8c('0x38')]=_0xb528d['attributes'][_0x7f8c('0x39')]?_0xb528d[_0x7f8c('0x38')]:_0x200746[_0x7f8c('0x32')];if(!_0x3c5db9[_0x7f8c('0x34')]['hasOwnProperty'](_0x7f8c('0x3a'))){_0xb528d['limit']=qs[_0x7f8c('0x1e')](_0x3c5db9[_0x7f8c('0x34')][_0x7f8c('0x1e')]);_0xb528d[_0x7f8c('0x1d')]=qs['offset'](_0x3c5db9[_0x7f8c('0x34')][_0x7f8c('0x1d')]);}_0xb528d[_0x7f8c('0x3b')]=qs[_0x7f8c('0x3c')](_0x3c5db9[_0x7f8c('0x34')][_0x7f8c('0x3c')]);_0xb528d[_0x7f8c('0x3d')]=qs['filters'](_[_0x7f8c('0x3e')](_0x3c5db9['query'],_0x200746[_0x7f8c('0x35')]),_0x588ce1);if(_0x3c5db9['query'][_0x7f8c('0x3f')]){_0xb528d[_0x7f8c('0x3d')]=_['merge'](_0xb528d[_0x7f8c('0x3d')],{'$or':_[_0x7f8c('0x2c')](_0x588ce1,function(_0x169bc5){if(_0x169bc5['type']!==_0x7f8c('0x40')){var _0x350e1a={};_0x350e1a[_0x169bc5[_0x7f8c('0x29')]]={'$like':'%'+_0x3c5db9[_0x7f8c('0x34')][_0x7f8c('0x3f')]+'%'};return _0x350e1a;}})});}_0xb528d=_[_0x7f8c('0x41')]({},_0xb528d,_0x3c5db9[_0x7f8c('0x42')]);var _0x31df41={'where':_0xb528d[_0x7f8c('0x3d')]};return db[_0x7f8c('0x2d')][_0x7f8c('0x20')](_0x31df41)[_0x7f8c('0x26')](function(_0x28c66){_0x5010d1[_0x7f8c('0x20')]=_0x28c66;if(_0x3c5db9[_0x7f8c('0x34')][_0x7f8c('0x43')]){_0xb528d['include']=[{'all':!![]}];}return db[_0x7f8c('0x2d')][_0x7f8c('0x44')](_0xb528d);})['then'](function(_0xf1159a){_0x5010d1[_0x7f8c('0x45')]=_0xf1159a;return _0x5010d1;})[_0x7f8c('0x26')](respondWithFilteredResult(_0x584918,_0xb528d))[_0x7f8c('0x46')](handleError(_0x584918,null));};exports[_0x7f8c('0x47')]=function(_0x48791d,_0x2427d8){var _0x43490d={'raw':![],'where':{'id':_0x48791d['params']['id']}},_0xfabc3f={};_0xfabc3f[_0x7f8c('0x32')]=_[_0x7f8c('0x33')](db[_0x7f8c('0x2d')]['rawAttributes']);_0xfabc3f['query']=_[_0x7f8c('0x33')](_0x48791d[_0x7f8c('0x34')]);_0xfabc3f['filters']=_[_0x7f8c('0x36')](_0xfabc3f[_0x7f8c('0x32')],_0xfabc3f['query']);_0x43490d['attributes']=_[_0x7f8c('0x36')](_0xfabc3f[_0x7f8c('0x32')],qs[_0x7f8c('0x37')](_0x48791d[_0x7f8c('0x34')]['fields']));_0x43490d['attributes']=_0x43490d['attributes'][_0x7f8c('0x39')]?_0x43490d[_0x7f8c('0x38')]:_0xfabc3f['model'];if(_0x48791d[_0x7f8c('0x34')][_0x7f8c('0x43')]){_0x43490d[_0x7f8c('0x48')]=[{'all':!![]}];}_0x43490d=_['merge']({},_0x43490d,_0x48791d['options']);return db[_0x7f8c('0x2d')]['find'](_0x43490d)[_0x7f8c('0x26')](handleEntityNotFound(_0x2427d8,null))[_0x7f8c('0x26')](respondWithResult(_0x2427d8,null))[_0x7f8c('0x46')](handleError(_0x2427d8,null));};exports[_0x7f8c('0x49')]=function(_0x1985ae,_0x3bd80f){return db[_0x7f8c('0x2d')][_0x7f8c('0x49')](_0x1985ae[_0x7f8c('0x4a')],{})['then'](respondWithResult(_0x3bd80f,0xc9))[_0x7f8c('0x46')](handleError(_0x3bd80f,null));};exports[_0x7f8c('0x4b')]=function(_0x1ea94a,_0x548923){if(_0x1ea94a[_0x7f8c('0x4a')]['id']){delete _0x1ea94a[_0x7f8c('0x4a')]['id'];}return db[_0x7f8c('0x2d')][_0x7f8c('0x4c')]({'where':{'id':_0x1ea94a[_0x7f8c('0x4d')]['id']}})['then'](handleEntityNotFound(_0x548923,null))[_0x7f8c('0x26')](saveUpdates(_0x1ea94a[_0x7f8c('0x4a')],null))[_0x7f8c('0x26')](respondWithResult(_0x548923,null))[_0x7f8c('0x46')](handleError(_0x548923,null));};exports[_0x7f8c('0x4e')]=function(_0x2367d8,_0x3332ea){return db[_0x7f8c('0x2d')]['find']({'where':{'id':_0x2367d8[_0x7f8c('0x4d')]['id']}})[_0x7f8c('0x26')](handleEntityNotFound(_0x3332ea,null))[_0x7f8c('0x26')](removeEntity(_0x3332ea,null))[_0x7f8c('0x46')](handleError(_0x3332ea,null));};exports['getConfigurations']=function(_0x2b3dfa,_0x519768,_0x309b28){var _0x9d9a53={};var _0x542b7f={};var _0x3884d2;var _0x8c3a79;return db[_0x7f8c('0x2d')][_0x7f8c('0x4f')]({'where':{'id':_0x2b3dfa[_0x7f8c('0x4d')]['id']}})[_0x7f8c('0x26')](handleEntityNotFound(_0x519768,null))[_0x7f8c('0x26')](function(_0x142d1c){if(_0x142d1c){_0x3884d2=_0x142d1c;_0x542b7f[_0x7f8c('0x32')]=_[_0x7f8c('0x33')](db['ServicenowConfiguration'][_0x7f8c('0x2e')]);_0x542b7f['query']=_[_0x7f8c('0x33')](_0x2b3dfa[_0x7f8c('0x34')]);_0x542b7f[_0x7f8c('0x35')]=_['intersection'](_0x542b7f[_0x7f8c('0x32')],_0x542b7f[_0x7f8c('0x34')]);_0x9d9a53[_0x7f8c('0x38')]=_[_0x7f8c('0x36')](_0x542b7f['model'],qs[_0x7f8c('0x37')](_0x2b3dfa['query']['fields']));_0x9d9a53[_0x7f8c('0x38')]=_0x9d9a53[_0x7f8c('0x38')][_0x7f8c('0x39')]?_0x9d9a53[_0x7f8c('0x38')]:_0x542b7f[_0x7f8c('0x32')];_0x9d9a53[_0x7f8c('0x3b')]=qs['sort'](_0x2b3dfa['query'][_0x7f8c('0x3c')]);_0x9d9a53['where']=qs[_0x7f8c('0x35')](_[_0x7f8c('0x3e')](_0x2b3dfa['query'],_0x542b7f[_0x7f8c('0x35')]));if(_0x2b3dfa[_0x7f8c('0x34')]['filter']){_0x9d9a53[_0x7f8c('0x3d')]=_[_0x7f8c('0x41')](_0x9d9a53[_0x7f8c('0x3d')],{'$or':_[_0x7f8c('0x2c')](_0x9d9a53['attributes'],function(_0x44cdeb){var _0x1cb63d={};_0x1cb63d[_0x44cdeb]={'$like':'%'+_0x2b3dfa[_0x7f8c('0x34')][_0x7f8c('0x3f')]+'%'};return _0x1cb63d;})});}_0x9d9a53=_[_0x7f8c('0x41')]({},_0x9d9a53,_0x2b3dfa['options']);return _0x3884d2[_0x7f8c('0x50')](_0x9d9a53);}})['then'](function(_0x21bdd1){if(_0x21bdd1){_0x8c3a79=_0x21bdd1['length'];if(!_0x2b3dfa[_0x7f8c('0x34')][_0x7f8c('0x51')](_0x7f8c('0x3a'))){_0x9d9a53[_0x7f8c('0x1e')]=qs[_0x7f8c('0x1e')](_0x2b3dfa['query'][_0x7f8c('0x1e')]);_0x9d9a53[_0x7f8c('0x1d')]=qs[_0x7f8c('0x1d')](_0x2b3dfa[_0x7f8c('0x34')]['offset']);}return _0x3884d2[_0x7f8c('0x50')](_0x9d9a53);}})['then'](function(_0x4be3b6){if(_0x4be3b6){return _0x4be3b6?{'count':_0x8c3a79,'rows':_0x4be3b6}:null;}})[_0x7f8c('0x26')](respondWithResult(_0x519768,null))[_0x7f8c('0x46')](handleError(_0x519768,null));};exports[_0x7f8c('0x52')]=function(_0x16d700,_0x34f249,_0x551c47){if(_0x16d700[_0x7f8c('0x4a')]['id']){delete _0x16d700[_0x7f8c('0x4a')]['id'];}return db[_0x7f8c('0x2d')][_0x7f8c('0x4f')]({'where':{'id':_0x16d700[_0x7f8c('0x4d')]['id']}})[_0x7f8c('0x26')](handleEntityNotFound(_0x34f249,null))['then'](function(_0x4c0961){if(_0x4c0961){_0x16d700[_0x7f8c('0x4a')][_0x7f8c('0x53')]=_0x4c0961['id'];_0x16d700[_0x7f8c('0x4a')][_0x7f8c('0x54')]=integrations['getSubjects'](_0x16d700[_0x7f8c('0x4a')][_0x7f8c('0x55')],_0x16d700[_0x7f8c('0x4a')][_0x7f8c('0x30')]);_0x16d700[_0x7f8c('0x4a')]['Descriptions']=integrations[_0x7f8c('0x56')](_0x16d700['body'][_0x7f8c('0x55')],_0x16d700[_0x7f8c('0x4a')][_0x7f8c('0x30')]);return db[_0x7f8c('0x57')]['create'](_0x16d700[_0x7f8c('0x4a')],{'include':[{'model':db['ServicenowField'],'as':_0x7f8c('0x54')},{'model':db['ServicenowField'],'as':_0x7f8c('0x58')}]});}return null;})['then'](respondWithResult(_0x34f249,null))['catch'](handleError(_0x34f249,null));};exports[_0x7f8c('0x59')]=function(_0x26a0e5,_0x8059c1,_0xf9535){var _0x556b16=['made_sla',_0x7f8c('0x5a'),_0x7f8c('0x5b'),'subcategory',_0x7f8c('0x5c'),_0x7f8c('0x5d'),_0x7f8c('0x5e'),_0x7f8c('0x5f'),_0x7f8c('0x60')];var _0x103d63=[_0x7f8c('0x61'),_0x7f8c('0x62'),'caused_by',_0x7f8c('0x63'),_0x7f8c('0x64'),_0x7f8c('0x65'),'child_incidents',_0x7f8c('0x5a'),_0x7f8c('0x66'),_0x7f8c('0x67'),'resolved_by',_0x7f8c('0x68'),'opened_by',_0x7f8c('0x69'),_0x7f8c('0x6a'),_0x7f8c('0x6b'),_0x7f8c('0x6c'),_0x7f8c('0x6d'),_0x7f8c('0x5b'),'order','calendar_stc',_0x7f8c('0x6e'),_0x7f8c('0x6f'),_0x7f8c('0x70'),'impact',_0x7f8c('0x71'),_0x7f8c('0x72'),'business_service',_0x7f8c('0x73'),_0x7f8c('0x74'),_0x7f8c('0x75'),_0x7f8c('0x76'),_0x7f8c('0x77'),'opened_at','business_duration',_0x7f8c('0x78'),_0x7f8c('0x79'),_0x7f8c('0x7a'),_0x7f8c('0x7b'),_0x7f8c('0x7c'),_0x7f8c('0x7d'),'subcategory',_0x7f8c('0x7e'),_0x7f8c('0x7f'),_0x7f8c('0x5c'),_0x7f8c('0x80'),'delivery_task',_0x7f8c('0x81'),_0x7f8c('0x82'),_0x7f8c('0x83'),_0x7f8c('0x84'),'description',_0x7f8c('0x85'),_0x7f8c('0x5d'),_0x7f8c('0x86'),_0x7f8c('0x87'),_0x7f8c('0x88'),_0x7f8c('0x89'),'parent_incident',_0x7f8c('0x8a'),'contact_type',_0x7f8c('0x8b'),_0x7f8c('0x5e'),_0x7f8c('0x8c'),_0x7f8c('0x8d'),'company',_0x7f8c('0x8e'),_0x7f8c('0x8f'),'assigned_to',_0x7f8c('0x5f'),_0x7f8c('0x90'),_0x7f8c('0x91'),_0x7f8c('0x92'),_0x7f8c('0x93'),_0x7f8c('0x94'),_0x7f8c('0x95'),'reopen_count',_0x7f8c('0x96'),_0x7f8c('0x97'),'upon_approval','correlation_id',_0x7f8c('0x98'),_0x7f8c('0x60')];var _0x58afb8='';var _0x584ac8='';var _0x1b9b34=[];var _0x18a278='';var _0x3644c0='';var _0x2f52c1=[];var _0x1000f6='';var _0x4e4402='';var _0x26f3e6={};var _0x4d8b63='';return db[_0x7f8c('0x2d')][_0x7f8c('0x4f')]({'where':{'id':_0x26a0e5['params']['id']},'attributes':['id',_0x7f8c('0x99'),'password','email',_0x7f8c('0x9a'),'serverUrl']})[_0x7f8c('0x26')](handleEntityNotFound(_0x8059c1,null))['then'](function(_0x15b36a){if(_0x15b36a){_0x4d8b63=_0x15b36a[_0x7f8c('0x9a')];var _0x3d1935=_0x4d8b63[_0x7f8c('0x9b')](-0x1);if(_0x3d1935==='/'){_0x4d8b63=_0x4d8b63[_0x7f8c('0x9c')](0x0,_0x4d8b63['lastIndexOf'](_0x3d1935));}_0x4e4402=util[_0x7f8c('0x9d')](_0x7f8c('0x9e'),_0x4d8b63);_0x1000f6=util[_0x7f8c('0x9d')]('%s/api/now/table/',_0x4d8b63);_0x26f3e6={'user':_0x15b36a[_0x7f8c('0x99')],'pass':_0x15b36a[_0x7f8c('0x9f')]};var _0x37d3a0={'method':'GET','uri':_0x4e4402+'incident?sysparm_display_value=all','auth':_0x26f3e6,'json':!![]};return rp(_0x37d3a0);}})['then'](function(_0x41d9ec){if(_0x41d9ec['result'][_0x7f8c('0x39')]>0x0){_0x58afb8=_0x41d9ec[_0x7f8c('0xa0')];}console[_0x7f8c('0xa1')]('incident\x20table\x20objects',_0x58afb8);_0x2f52c1=[];_0x584ac8=Object[_0x7f8c('0xa2')]([],_0x58afb8);_[_0x7f8c('0xa3')](_0x584ac8,function(_0x3e2c6d){return!_0x556b16[_0x7f8c('0xa4')](_0x3e2c6d[_0x7f8c('0x29')]);});_0x584ac8['forEach'](function(_0x2af368){var _0x3ef84b=createFieldObject(_0x1000f6,_0x26f3e6,_0x2af368['internalType'],_0x2af368[_0x7f8c('0x29')],_0x2af368[_0x7f8c('0xa5')],![]);_0x2f52c1[_0x7f8c('0xa6')](_0x3ef84b);});return Promise[_0x7f8c('0xa7')](_0x2f52c1);})[_0x7f8c('0x26')](function(_0x284ea2){_0x1b9b34=_0x284ea2;_0x18a278=Object[_0x7f8c('0xa2')]([],_0x58afb8);console[_0x7f8c('0xa1')](_0x7f8c('0xa8'),_0x58afb8);_['remove'](_0x18a278,function(_0x25f15f){return _0x103d63[_0x7f8c('0xa4')](_0x25f15f[_0x7f8c('0x29')]);});console[_0x7f8c('0xa1')](_0x7f8c('0xa9'),_0x18a278);_0x2f52c1=[];_0x18a278[_0x7f8c('0xaa')](function(_0x274243){var _0x15a98e=createFieldObject(_0x1000f6,_0x26f3e6,_0x274243[_0x7f8c('0xab')],_0x274243[_0x7f8c('0x29')],_0x274243[_0x7f8c('0xa5')],!![]);_0x2f52c1[_0x7f8c('0xa6')](_0x15a98e);});return Promise[_0x7f8c('0xa7')](_0x2f52c1);})[_0x7f8c('0x26')](function(_0x51e0d4){_0x3644c0=_0x51e0d4;var _0x596553=_0x1b9b34[_0x7f8c('0xac')](_0x3644c0);return{'count':_0x596553['length'],'rows':_0x596553};})[_0x7f8c('0x26')](respondWithResult(_0x8059c1,null))['catch'](function(_0x189689){console['log'](_0x7f8c('0xad')+_0x189689);var _0x442ea0=_0x26a0e5['query'][_0x7f8c('0xae')]?0x1f4:_0x189689[_0x7f8c('0xaf')]||0x1f4;logger[_0x7f8c('0xb0')](_0x189689[_0x7f8c('0x28')]);delete _0x189689[_0x7f8c('0x29')];if(_0x442ea0===0x191){_0x442ea0=0x190;}_0x8059c1[_0x7f8c('0x1b')](_0x442ea0)['send'](_0x26a0e5[_0x7f8c('0x34')][_0x7f8c('0xae')]?{'message':_0x7f8c('0xb1'),'statusCode':_0x189689[_0x7f8c('0xaf')]}:_0x189689);});};function createFieldObject(_0x2ebc28,_0xb95faf,_0x42e645,_0x1b4245,_0x251ee6,_0x204853){return new Promise(function(_0x21f90c,_0x42e0db){var _0x2a2568={'id':_0x1b4245,'name':_0x251ee6,'custom':_0x204853};if(_0x42e645===_0x7f8c('0xb2')){_0x2a2568[_0x7f8c('0x42')]=[{'name':_0x7f8c('0xb3'),'value':_0x7f8c('0xb4')},{'name':_0x7f8c('0xb5'),'value':_0x7f8c('0xb6')}];_0x21f90c(_0x2a2568);}else{var _0x96c888={'method':'GET','uri':_0x2ebc28+'sys_choice?sysparm_query=name=incident^element='+_0x1b4245,'auth':_0xb95faf,'json':!![]};return rp(_0x96c888)[_0x7f8c('0x26')](function(_0x298a04){var _0x2e68ba=[];if(_0x298a04['result'][_0x7f8c('0x39')]>0x0){_0x298a04[_0x7f8c('0xa0')][_0x7f8c('0xaa')](function(_0x3acf14){if(_0x3acf14[_0x7f8c('0xb7')]===_0x7f8c('0xb6')){var _0x12dd5e={'name':_0x3acf14[_0x7f8c('0xa5')],'value':_0x3acf14[_0x7f8c('0xb8')]};_0x2e68ba[_0x7f8c('0xa6')](_0x12dd5e);}});}_0x2a2568['options']=_0x2e68ba;if(_0x2a2568[_0x7f8c('0x42')][_0x7f8c('0x39')]>0x0){_0x21f90c(_0x2a2568);}else{if(_0x204853==![]){_0x21f90c();}else{_0x21f90c(_0x2a2568);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 0a08dc3..eb48493 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 _0x7c09=['rimraf','../../config/environment','./intServicenowAccount.attributes','define','ServicenowAccount','int_servicenow_accounts','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0xafdec6,_0x3d94df){var _0x372bdb=function(_0x5b3fd6){while(--_0x5b3fd6){_0xafdec6['push'](_0xafdec6['shift']());}};_0x372bdb(++_0x3d94df);}(_0x7c09,0x102));var _0x97c0=function(_0x541e57,_0x1a2277){_0x541e57=_0x541e57-0x0;var _0x11f3be=_0x7c09[_0x541e57];return _0x11f3be;};'use strict';var _=require('lodash');var util=require(_0x97c0('0x0'));var logger=require(_0x97c0('0x1'))('api');var moment=require(_0x97c0('0x2'));var BPromise=require(_0x97c0('0x3'));var rp=require(_0x97c0('0x4'));var fs=require('fs');var path=require(_0x97c0('0x5'));var rimraf=require(_0x97c0('0x6'));var config=require(_0x97c0('0x7'));var attributes=require(_0x97c0('0x8'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x590368,_0x46fdd9){return _0x590368[_0x97c0('0x9')](_0x97c0('0xa'),attributes,{'tableName':_0x97c0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x687b=['./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','int_servicenow_accounts','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x406b85,_0x2cdb3a){var _0x130b26=function(_0x3f542a){while(--_0x3f542a){_0x406b85['push'](_0x406b85['shift']());}};_0x130b26(++_0x2cdb3a);}(_0x687b,0x14a));var _0xb687=function(_0x36aa05,_0x3117cc){_0x36aa05=_0x36aa05-0x0;var _0x293263=_0x687b[_0x36aa05];return _0x293263;};'use strict';var _=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var logger=require(_0xb687('0x2'))(_0xb687('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb687('0x4'));var fs=require('fs');var path=require(_0xb687('0x5'));var rimraf=require(_0xb687('0x6'));var config=require(_0xb687('0x7'));var attributes=require(_0xb687('0x8'));var integrations=require(_0xb687('0x9'));module[_0xb687('0xa')]=function(_0xf43a1f,_0x47ffea){return _0xf43a1f[_0xb687('0xb')]('ServicenowAccount',attributes,{'tableName':_0xb687('0xc'),'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 14e5d32..85422d8 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 _0x52c1=['error','message','catch','options','raw','where','attributes','limit','include','model','map','GetServicenowAccount','find','ShowServicenowAccount','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','code','ServicenowAccount,\x20%s,\x20%s'];(function(_0x49a70c,_0x23f76b){var _0x254a31=function(_0x1a9fc7){while(--_0x1a9fc7){_0x49a70c['push'](_0x49a70c['shift']());}};_0x254a31(++_0x23f76b);}(_0x52c1,0xce));var _0x152c=function(_0x36ddc1,_0x1f0eaa){_0x36ddc1=_0x36ddc1-0x0;var _0x160ec4=_0x52c1[_0x36ddc1];return _0x160ec4;};'use strict';var _=require(_0x152c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x152c('0x1'));var rs=require(_0x152c('0x2'));var fs=require('fs');var Redis=require(_0x152c('0x3'));var db=require(_0x152c('0x4'))['db'];var utils=require(_0x152c('0x5'));var logger=require(_0x152c('0x6'))(_0x152c('0x7'));var config=require(_0x152c('0x8'));var jayson=require(_0x152c('0x9'));var client=jayson[_0x152c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x507c6f,_0x11a673,_0x43217b){return new BPromise(function(_0x4f032e,_0x255a67){return client[_0x152c('0xb')](_0x507c6f,_0x43217b)[_0x152c('0xc')](function(_0x395099){logger[_0x152c('0xd')]('ServicenowAccount,\x20%s,\x20%s',_0x11a673,_0x152c('0xe'));logger[_0x152c('0xf')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x11a673,_0x152c('0xe'),JSON['stringify'](_0x395099));if(_0x395099['error']){if(_0x395099['error'][_0x152c('0x10')]===0x1f4){logger['error'](_0x152c('0x11'),_0x11a673,_0x395099[_0x152c('0x12')][_0x152c('0x13')]);return _0x255a67(_0x395099[_0x152c('0x12')][_0x152c('0x13')]);}logger[_0x152c('0x12')]('ServicenowAccount,\x20%s,\x20%s',_0x11a673,_0x395099[_0x152c('0x12')][_0x152c('0x13')]);return _0x4f032e(_0x395099[_0x152c('0x12')]['message']);}else{logger[_0x152c('0xd')](_0x152c('0x11'),_0x11a673,_0x152c('0xe'));_0x4f032e(_0x395099['result']['message']);}})[_0x152c('0x14')](function(_0x1dfbe4){logger[_0x152c('0x12')]('ServicenowAccount,\x20%s,\x20%s',_0x11a673,_0x1dfbe4);_0x255a67(_0x1dfbe4);});});}exports['GetServicenowAccount']=function(_0x2d2216){var _0x2cd0bb=this;return new Promise(function(_0x2a8c33,_0x563be4){return db['ServicenowAccount']['findAll']({'raw':_0x2d2216[_0x152c('0x15')]?_0x2d2216['options'][_0x152c('0x16')]===undefined?!![]:![]:!![],'where':_0x2d2216[_0x152c('0x15')]?_0x2d2216['options'][_0x152c('0x17')]||null:null,'attributes':_0x2d2216['options']?_0x2d2216[_0x152c('0x15')][_0x152c('0x18')]||null:null,'limit':_0x2d2216[_0x152c('0x15')]?_0x2d2216[_0x152c('0x15')][_0x152c('0x19')]||null:null,'include':_0x2d2216[_0x152c('0x15')]?_0x2d2216[_0x152c('0x15')][_0x152c('0x1a')]?_['map'](_0x2d2216[_0x152c('0x15')][_0x152c('0x1a')],function(_0x47406e){return{'model':db[_0x47406e[_0x152c('0x1b')]],'as':_0x47406e['as'],'attributes':_0x47406e[_0x152c('0x18')],'include':_0x47406e[_0x152c('0x1a')]?_[_0x152c('0x1c')](_0x47406e['include'],function(_0x1dac80){return{'model':db[_0x1dac80[_0x152c('0x1b')]],'as':_0x1dac80['as'],'attributes':_0x1dac80[_0x152c('0x18')],'include':_0x1dac80[_0x152c('0x1a')]?_[_0x152c('0x1c')](_0x1dac80[_0x152c('0x1a')],function(_0x59b635){return{'model':db[_0x59b635[_0x152c('0x1b')]],'as':_0x59b635['as'],'attributes':_0x59b635[_0x152c('0x18')]};}):[]};}):[]};}):[]:[]})[_0x152c('0xc')](function(_0x2c6976){logger[_0x152c('0xd')](_0x152c('0x1d'),_0x2d2216);logger[_0x152c('0xf')](_0x152c('0x1d'),_0x2d2216,JSON['stringify'](_0x2c6976));_0x2a8c33(_0x2c6976);})[_0x152c('0x14')](function(_0x2456b6){logger[_0x152c('0x12')](_0x152c('0x1d'),_0x2456b6[_0x152c('0x13')],_0x2d2216);_0x563be4(_0x2cd0bb['error'](0x1f4,_0x2456b6[_0x152c('0x13')]));});});};exports['ShowServicenowAccount']=function(_0x1c8200){var _0x1ef8a7=this;return new Promise(function(_0x3edf83,_0x3cf7f1){return db['ServicenowAccount'][_0x152c('0x1e')]({'raw':_0x1c8200['options']?_0x1c8200[_0x152c('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x1c8200[_0x152c('0x15')]?_0x1c8200[_0x152c('0x15')][_0x152c('0x17')]||null:null,'attributes':_0x1c8200[_0x152c('0x15')]?_0x1c8200[_0x152c('0x15')][_0x152c('0x18')]||null:null,'include':_0x1c8200[_0x152c('0x15')]?_0x1c8200[_0x152c('0x15')][_0x152c('0x1a')]?_[_0x152c('0x1c')](_0x1c8200[_0x152c('0x15')][_0x152c('0x1a')],function(_0x5c2a58){return{'model':db[_0x5c2a58[_0x152c('0x1b')]],'as':_0x5c2a58['as'],'attributes':_0x5c2a58[_0x152c('0x18')],'include':_0x5c2a58['include']?_['map'](_0x5c2a58[_0x152c('0x1a')],function(_0x1f694c){return{'model':db[_0x1f694c[_0x152c('0x1b')]],'as':_0x1f694c['as'],'attributes':_0x1f694c['attributes'],'include':_0x1f694c[_0x152c('0x1a')]?_[_0x152c('0x1c')](_0x1f694c[_0x152c('0x1a')],function(_0x5320e3){return{'model':db[_0x5320e3[_0x152c('0x1b')]],'as':_0x5320e3['as'],'attributes':_0x5320e3[_0x152c('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xa6c0bd){logger[_0x152c('0xd')](_0x152c('0x1f'),_0x1c8200);logger[_0x152c('0xf')](_0x152c('0x1f'),_0x1c8200,JSON['stringify'](_0xa6c0bd));_0x3edf83(_0xa6c0bd);})['catch'](function(_0x20723d){logger[_0x152c('0x12')](_0x152c('0x1f'),_0x20723d[_0x152c('0x13')],_0x1c8200);_0x3cf7f1(_0x1ef8a7['error'](0x1f4,_0x20723d['message']));});});}; \ No newline at end of file +var _0x9446=['include','model','attributes','map','GetServicenowAccount','ShowServicenowAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','ServicenowAccount','findAll','options','raw','where','limit'];(function(_0x1b9a50,_0x2c0b39){var _0x2041af=function(_0x27a4c1){while(--_0x27a4c1){_0x1b9a50['push'](_0x1b9a50['shift']());}};_0x2041af(++_0x2c0b39);}(_0x9446,0x187));var _0x6944=function(_0x4e4fc8,_0x45a5b6){_0x4e4fc8=_0x4e4fc8-0x0;var _0x576f8a=_0x9446[_0x4e4fc8];return _0x576f8a;};'use strict';var _=require(_0x6944('0x0'));var util=require(_0x6944('0x1'));var moment=require(_0x6944('0x2'));var BPromise=require(_0x6944('0x3'));var rs=require(_0x6944('0x4'));var fs=require('fs');var Redis=require(_0x6944('0x5'));var db=require(_0x6944('0x6'))['db'];var utils=require(_0x6944('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x6944('0x8'));var jayson=require(_0x6944('0x9'));var client=jayson[_0x6944('0xa')][_0x6944('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3424d8,_0x3343f0,_0x3ca976){return new BPromise(function(_0x1ca8e7,_0x10caa9){return client[_0x6944('0xc')](_0x3424d8,_0x3ca976)[_0x6944('0xd')](function(_0x20f276){logger['info'](_0x6944('0xe'),_0x3343f0,_0x6944('0xf'));logger[_0x6944('0x10')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x3343f0,_0x6944('0xf'),JSON[_0x6944('0x11')](_0x20f276));if(_0x20f276[_0x6944('0x12')]){if(_0x20f276['error'][_0x6944('0x13')]===0x1f4){logger[_0x6944('0x12')](_0x6944('0xe'),_0x3343f0,_0x20f276[_0x6944('0x12')]['message']);return _0x10caa9(_0x20f276[_0x6944('0x12')][_0x6944('0x14')]);}logger[_0x6944('0x12')](_0x6944('0xe'),_0x3343f0,_0x20f276[_0x6944('0x12')]['message']);return _0x1ca8e7(_0x20f276[_0x6944('0x12')][_0x6944('0x14')]);}else{logger[_0x6944('0x15')](_0x6944('0xe'),_0x3343f0,'request\x20sent');_0x1ca8e7(_0x20f276['result'][_0x6944('0x14')]);}})[_0x6944('0x16')](function(_0x5d3092){logger[_0x6944('0x12')](_0x6944('0xe'),_0x3343f0,_0x5d3092);_0x10caa9(_0x5d3092);});});}exports['GetServicenowAccount']=function(_0x1c63a9){var _0x42942c=this;return new Promise(function(_0x55549a,_0x4c0baa){return db[_0x6944('0x17')][_0x6944('0x18')]({'raw':_0x1c63a9[_0x6944('0x19')]?_0x1c63a9['options'][_0x6944('0x1a')]===undefined?!![]:![]:!![],'where':_0x1c63a9['options']?_0x1c63a9[_0x6944('0x19')][_0x6944('0x1b')]||null:null,'attributes':_0x1c63a9[_0x6944('0x19')]?_0x1c63a9[_0x6944('0x19')]['attributes']||null:null,'limit':_0x1c63a9[_0x6944('0x19')]?_0x1c63a9['options'][_0x6944('0x1c')]||null:null,'include':_0x1c63a9[_0x6944('0x19')]?_0x1c63a9[_0x6944('0x19')][_0x6944('0x1d')]?_['map'](_0x1c63a9['options'][_0x6944('0x1d')],function(_0x436d0f){return{'model':db[_0x436d0f[_0x6944('0x1e')]],'as':_0x436d0f['as'],'attributes':_0x436d0f[_0x6944('0x1f')],'include':_0x436d0f[_0x6944('0x1d')]?_[_0x6944('0x20')](_0x436d0f['include'],function(_0x345bab){return{'model':db[_0x345bab['model']],'as':_0x345bab['as'],'attributes':_0x345bab['attributes'],'include':_0x345bab['include']?_[_0x6944('0x20')](_0x345bab['include'],function(_0x31c103){return{'model':db[_0x31c103[_0x6944('0x1e')]],'as':_0x31c103['as'],'attributes':_0x31c103[_0x6944('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x6944('0xd')](function(_0x49ab2f){logger[_0x6944('0x15')](_0x6944('0x21'),_0x1c63a9);logger['debug'](_0x6944('0x21'),_0x1c63a9,JSON[_0x6944('0x11')](_0x49ab2f));_0x55549a(_0x49ab2f);})[_0x6944('0x16')](function(_0xc609b2){logger[_0x6944('0x12')](_0x6944('0x21'),_0xc609b2[_0x6944('0x14')],_0x1c63a9);_0x4c0baa(_0x42942c[_0x6944('0x12')](0x1f4,_0xc609b2[_0x6944('0x14')]));});});};exports[_0x6944('0x22')]=function(_0x4f8fa4){var _0x368034=this;return new Promise(function(_0x43542d,_0x5dfe78){return db[_0x6944('0x17')]['find']({'raw':_0x4f8fa4[_0x6944('0x19')]?_0x4f8fa4['options'][_0x6944('0x1a')]===undefined?!![]:![]:!![],'where':_0x4f8fa4[_0x6944('0x19')]?_0x4f8fa4[_0x6944('0x19')][_0x6944('0x1b')]||null:null,'attributes':_0x4f8fa4['options']?_0x4f8fa4['options'][_0x6944('0x1f')]||null:null,'include':_0x4f8fa4[_0x6944('0x19')]?_0x4f8fa4[_0x6944('0x19')][_0x6944('0x1d')]?_[_0x6944('0x20')](_0x4f8fa4[_0x6944('0x19')]['include'],function(_0x1f4b0a){return{'model':db[_0x1f4b0a['model']],'as':_0x1f4b0a['as'],'attributes':_0x1f4b0a[_0x6944('0x1f')],'include':_0x1f4b0a[_0x6944('0x1d')]?_[_0x6944('0x20')](_0x1f4b0a[_0x6944('0x1d')],function(_0x5ce0ae){return{'model':db[_0x5ce0ae[_0x6944('0x1e')]],'as':_0x5ce0ae['as'],'attributes':_0x5ce0ae[_0x6944('0x1f')],'include':_0x5ce0ae[_0x6944('0x1d')]?_[_0x6944('0x20')](_0x5ce0ae[_0x6944('0x1d')],function(_0x4b1288){return{'model':db[_0x4b1288['model']],'as':_0x4b1288['as'],'attributes':_0x4b1288[_0x6944('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x6944('0xd')](function(_0x4ecf0e){logger[_0x6944('0x15')](_0x6944('0x22'),_0x4f8fa4);logger[_0x6944('0x10')]('ShowServicenowAccount',_0x4f8fa4,JSON[_0x6944('0x11')](_0x4ecf0e));_0x43542d(_0x4ecf0e);})[_0x6944('0x16')](function(_0x91f3e8){logger[_0x6944('0x12')](_0x6944('0x22'),_0x91f3e8[_0x6944('0x14')],_0x4f8fa4);_0x5dfe78(_0x368034[_0x6944('0x12')](0x1f4,_0x91f3e8[_0x6944('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index ef390ec..a9da0a4 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 _0xaa37=['getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','delete','destroy','exports','multer','path','express','fs-extra','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields'];(function(_0x3f266c,_0x373b2f){var _0x5f13c5=function(_0x257f85){while(--_0x257f85){_0x3f266c['push'](_0x3f266c['shift']());}};_0x5f13c5(++_0x373b2f);}(_0xaa37,0x129));var _0x7aa3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaa37[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x7aa3('0x0'));var util=require('util');var path=require(_0x7aa3('0x1'));var timeout=require('connect-timeout');var express=require(_0x7aa3('0x2'));var router=express['Router']();var fs_extra=require(_0x7aa3('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7aa3('0x4'));var controller=require('./intServicenowConfiguration.controller');router[_0x7aa3('0x5')]('/',auth[_0x7aa3('0x6')](),controller[_0x7aa3('0x7')]);router[_0x7aa3('0x5')](_0x7aa3('0x8'),auth[_0x7aa3('0x6')](),controller[_0x7aa3('0x9')]);router[_0x7aa3('0x5')](_0x7aa3('0xa'),auth[_0x7aa3('0x6')](),controller[_0x7aa3('0xb')]);router['get'](_0x7aa3('0xc'),auth[_0x7aa3('0x6')](),controller[_0x7aa3('0xd')]);router[_0x7aa3('0x5')](_0x7aa3('0xe'),auth[_0x7aa3('0x6')](),controller[_0x7aa3('0xf')]);router[_0x7aa3('0x10')]('/',auth[_0x7aa3('0x6')](),controller[_0x7aa3('0x11')]);router[_0x7aa3('0x12')](_0x7aa3('0x8'),auth[_0x7aa3('0x6')](),controller['update']);router[_0x7aa3('0x13')](_0x7aa3('0x8'),auth[_0x7aa3('0x6')](),controller[_0x7aa3('0x14')]);module[_0x7aa3('0x15')]=router; \ No newline at end of file +var _0x11bc=['getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intServicenowConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields'];(function(_0x2bc979,_0x594534){var _0x449e4e=function(_0x2347d1){while(--_0x2347d1){_0x2bc979['push'](_0x2bc979['shift']());}};_0x449e4e(++_0x594534);}(_0x11bc,0x6e));var _0xc11b=function(_0x2158d8,_0x5f4e7c){_0x2158d8=_0x2158d8-0x0;var _0x14fe4f=_0x11bc[_0x2158d8];return _0x14fe4f;};'use strict';var multer=require(_0xc11b('0x0'));var util=require(_0xc11b('0x1'));var path=require('path');var timeout=require(_0xc11b('0x2'));var express=require(_0xc11b('0x3'));var router=express[_0xc11b('0x4')]();var fs_extra=require(_0xc11b('0x5'));var auth=require(_0xc11b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc11b('0x7'));var controller=require(_0xc11b('0x8'));router[_0xc11b('0x9')]('/',auth['isAuthenticated'](),controller[_0xc11b('0xa')]);router[_0xc11b('0x9')](_0xc11b('0xb'),auth[_0xc11b('0xc')](),controller[_0xc11b('0xd')]);router[_0xc11b('0x9')](_0xc11b('0xe'),auth[_0xc11b('0xc')](),controller[_0xc11b('0xf')]);router[_0xc11b('0x9')](_0xc11b('0x10'),auth[_0xc11b('0xc')](),controller['getSubjects']);router[_0xc11b('0x9')](_0xc11b('0x11'),auth[_0xc11b('0xc')](),controller[_0xc11b('0x12')]);router[_0xc11b('0x13')]('/',auth[_0xc11b('0xc')](),controller['create']);router[_0xc11b('0x14')](_0xc11b('0xb'),auth[_0xc11b('0xc')](),controller[_0xc11b('0x15')]);router[_0xc11b('0x16')](_0xc11b('0xb'),auth[_0xc11b('0xc')](),controller[_0xc11b('0x17')]);module[_0xc11b('0x18')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index b57907f..6e34ad8 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 _0xc509=['exports','STRING','sequelize'];(function(_0x27e811,_0x20137c){var _0x1627fa=function(_0x4498ca){while(--_0x4498ca){_0x27e811['push'](_0x27e811['shift']());}};_0x1627fa(++_0x20137c);}(_0xc509,0xaa));var _0x9c50=function(_0x3bd91b,_0x31edbb){_0x3bd91b=_0x3bd91b-0x0;var _0xd238b8=_0xc509[_0x3bd91b];return _0xd238b8;};'use strict';var Sequelize=require(_0x9c50('0x0'));module[_0x9c50('0x1')]={'name':{'type':Sequelize[_0x9c50('0x2')]},'description':{'type':Sequelize[_0x9c50('0x2')]}}; \ No newline at end of file +var _0x6402=['exports','STRING','sequelize'];(function(_0x3f4dd9,_0xe0b819){var _0x31c54a=function(_0x25e6c6){while(--_0x25e6c6){_0x3f4dd9['push'](_0x3f4dd9['shift']());}};_0x31c54a(++_0xe0b819);}(_0x6402,0x17c));var _0x2640=function(_0x16f7c3,_0x7cc6bd){_0x16f7c3=_0x16f7c3-0x0;var _0x259a52=_0x6402[_0x16f7c3];return _0x259a52;};'use strict';var Sequelize=require(_0x2640('0x0'));module[_0x2640('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2640('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index a4cae9e..b56ce93 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 _0xd796=['../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','then','destroy','end','error','name','send','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','length','find','catch','create','body','update','params','ServicenowField','getFields','hasOwnProperty','findOne','getSubjects','getDescriptions','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment'];(function(_0x2d126e,_0x1e8257){var _0xcb04d3=function(_0x19a2d9){while(--_0x19a2d9){_0x2d126e['push'](_0x2d126e['shift']());}};_0xcb04d3(++_0x1e8257);}(_0xd796,0x134));var _0x6d79=function(_0x129b6b,_0x4faf08){_0x129b6b=_0x129b6b-0x0;var _0x24d8df=_0xd796[_0x129b6b];return _0x24d8df;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6d79('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6d79('0x1'));var rp=require(_0x6d79('0x2'));var moment=require(_0x6d79('0x3'));var BPromise=require(_0x6d79('0x4'));var Mustache=require(_0x6d79('0x5'));var util=require(_0x6d79('0x6'));var path=require(_0x6d79('0x7'));var sox=require(_0x6d79('0x8'));var csv=require(_0x6d79('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6d79('0xa'));var _=require(_0x6d79('0xb'));var squel=require(_0x6d79('0xc'));var crypto=require(_0x6d79('0xd'));var jsforce=require(_0x6d79('0xe'));var deskjs=require(_0x6d79('0xf'));var toCsv=require('to-csv');var querystring=require(_0x6d79('0x10'));var Papa=require(_0x6d79('0x11'));var Redis=require(_0x6d79('0x12'));var authService=require(_0x6d79('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6d79('0x14'));var logger=require(_0x6d79('0x15'))(_0x6d79('0x16'));var utils=require('../../config/utils');var config=require(_0x6d79('0x17'));var licenseUtil=require(_0x6d79('0x18'));var db=require(_0x6d79('0x19'))['db'];function respondWithStatusCode(_0x5cb06e,_0x2d0861){_0x2d0861=_0x2d0861||0xcc;return function(_0x427dc5){if(_0x427dc5){return _0x5cb06e[_0x6d79('0x1a')](_0x2d0861);}return _0x5cb06e[_0x6d79('0x1b')](_0x2d0861)['end']();};}function respondWithResult(_0x5126c8,_0x3ab7a8){_0x3ab7a8=_0x3ab7a8||0xc8;return function(_0x361e13){if(_0x361e13){return _0x5126c8[_0x6d79('0x1b')](_0x3ab7a8)[_0x6d79('0x1c')](_0x361e13);}};}function respondWithFilteredResult(_0xbdc473,_0x3e7349){return function(_0x317731){if(_0x317731){var _0x2ee89e=typeof _0x3e7349['offset']===_0x6d79('0x1d')&&typeof _0x3e7349[_0x6d79('0x1e')]===_0x6d79('0x1d');var _0x191fc0=_0x317731[_0x6d79('0x1f')];var _0x114d1f=_0x2ee89e?0x0:_0x3e7349[_0x6d79('0x20')];var _0x93dd2a=_0x2ee89e?_0x317731[_0x6d79('0x1f')]:_0x3e7349['offset']+_0x3e7349[_0x6d79('0x1e')];var _0x5e5945;if(_0x93dd2a>=_0x191fc0){_0x93dd2a=_0x191fc0;_0x5e5945=0xc8;}else{_0x5e5945=0xce;}_0xbdc473[_0x6d79('0x1b')](_0x5e5945);return _0xbdc473['set'](_0x6d79('0x21'),_0x114d1f+'-'+_0x93dd2a+'/'+_0x191fc0)[_0x6d79('0x1c')](_0x317731);}return null;};}function patchUpdates(_0x3f9cf9){return function(_0x2b0845){try{jsonpatch[_0x6d79('0x22')](_0x2b0845,_0x3f9cf9,!![]);}catch(_0x29c148){return BPromise[_0x6d79('0x23')](_0x29c148);}return _0x2b0845[_0x6d79('0x24')]();};}function saveUpdates(_0x164a9b,_0x541e24){return function(_0x5aebfd){if(_0x5aebfd){return _0x5aebfd['update'](_0x164a9b)[_0x6d79('0x25')](function(_0x541c2b){return _0x541c2b;});}return null;};}function removeEntity(_0x57329a,_0x121a49){return function(_0x5d3876){if(_0x5d3876){return _0x5d3876[_0x6d79('0x26')]()[_0x6d79('0x25')](function(){_0x57329a[_0x6d79('0x1b')](0xcc)[_0x6d79('0x27')]();});}};}function handleEntityNotFound(_0x183e32,_0xc64a31){return function(_0x28eb28){if(!_0x28eb28){_0x183e32['sendStatus'](0x194);}return _0x28eb28;};}function handleError(_0x329160,_0x373e15){_0x373e15=_0x373e15||0x1f4;return function(_0x43b017){logger[_0x6d79('0x28')](_0x43b017['stack']);if(_0x43b017[_0x6d79('0x29')]){delete _0x43b017[_0x6d79('0x29')];}_0x329160[_0x6d79('0x1b')](_0x373e15)[_0x6d79('0x2a')](_0x43b017);};}exports[_0x6d79('0x2b')]=function(_0x1380c5,_0x5ed8fd){var _0x34dd6a={},_0x2506a8={},_0x14e0a0={'count':0x0,'rows':[]};var _0x20abc0=_[_0x6d79('0x2c')](db[_0x6d79('0x2d')][_0x6d79('0x2e')],function(_0x54f9a0){return{'name':_0x54f9a0[_0x6d79('0x2f')],'type':_0x54f9a0[_0x6d79('0x30')][_0x6d79('0x31')]};});_0x2506a8[_0x6d79('0x32')]=_[_0x6d79('0x2c')](_0x20abc0,_0x6d79('0x29'));_0x2506a8[_0x6d79('0x33')]=_[_0x6d79('0x34')](_0x1380c5[_0x6d79('0x33')]);_0x2506a8['filters']=_['intersection'](_0x2506a8[_0x6d79('0x32')],_0x2506a8[_0x6d79('0x33')]);_0x34dd6a['attributes']=_[_0x6d79('0x35')](_0x2506a8['model'],qs[_0x6d79('0x36')](_0x1380c5[_0x6d79('0x33')]['fields']));_0x34dd6a[_0x6d79('0x37')]=_0x34dd6a[_0x6d79('0x37')]['length']?_0x34dd6a[_0x6d79('0x37')]:_0x2506a8['model'];if(!_0x1380c5[_0x6d79('0x33')]['hasOwnProperty'](_0x6d79('0x38'))){_0x34dd6a[_0x6d79('0x1e')]=qs[_0x6d79('0x1e')](_0x1380c5['query']['limit']);_0x34dd6a['offset']=qs[_0x6d79('0x20')](_0x1380c5[_0x6d79('0x33')][_0x6d79('0x20')]);}_0x34dd6a[_0x6d79('0x39')]=qs['sort'](_0x1380c5['query'][_0x6d79('0x3a')]);_0x34dd6a[_0x6d79('0x3b')]=qs[_0x6d79('0x3c')](_[_0x6d79('0x3d')](_0x1380c5[_0x6d79('0x33')],_0x2506a8[_0x6d79('0x3c')]),_0x20abc0);if(_0x1380c5[_0x6d79('0x33')][_0x6d79('0x3e')]){_0x34dd6a[_0x6d79('0x3b')]=_[_0x6d79('0x3f')](_0x34dd6a[_0x6d79('0x3b')],{'$or':_[_0x6d79('0x2c')](_0x20abc0,function(_0xf6e20e){if(_0xf6e20e[_0x6d79('0x30')]!==_0x6d79('0x40')){var _0x2c5f28={};_0x2c5f28[_0xf6e20e[_0x6d79('0x29')]]={'$like':'%'+_0x1380c5[_0x6d79('0x33')]['filter']+'%'};return _0x2c5f28;}})});}_0x34dd6a=_[_0x6d79('0x3f')]({},_0x34dd6a,_0x1380c5[_0x6d79('0x41')]);var _0x14cf6a={'where':_0x34dd6a[_0x6d79('0x3b')]};return db[_0x6d79('0x2d')]['count'](_0x14cf6a)[_0x6d79('0x25')](function(_0xcc1270){_0x14e0a0[_0x6d79('0x1f')]=_0xcc1270;if(_0x1380c5[_0x6d79('0x33')][_0x6d79('0x42')]){_0x34dd6a[_0x6d79('0x43')]=[{'all':!![]}];}return db[_0x6d79('0x2d')][_0x6d79('0x44')](_0x34dd6a);})['then'](function(_0x27c377){_0x14e0a0[_0x6d79('0x45')]=_0x27c377;return _0x14e0a0;})[_0x6d79('0x25')](respondWithFilteredResult(_0x5ed8fd,_0x34dd6a))['catch'](handleError(_0x5ed8fd,null));};exports['show']=function(_0x3fc60a,_0x4f862a){var _0x5d195f={'raw':![],'where':{'id':_0x3fc60a['params']['id']}},_0x394fe7={};_0x394fe7[_0x6d79('0x32')]=_['keys'](db[_0x6d79('0x2d')][_0x6d79('0x2e')]);_0x394fe7['query']=_['keys'](_0x3fc60a[_0x6d79('0x33')]);_0x394fe7[_0x6d79('0x3c')]=_[_0x6d79('0x35')](_0x394fe7['model'],_0x394fe7[_0x6d79('0x33')]);_0x5d195f[_0x6d79('0x37')]=_[_0x6d79('0x35')](_0x394fe7[_0x6d79('0x32')],qs['fields'](_0x3fc60a[_0x6d79('0x33')][_0x6d79('0x36')]));_0x5d195f['attributes']=_0x5d195f[_0x6d79('0x37')][_0x6d79('0x46')]?_0x5d195f[_0x6d79('0x37')]:_0x394fe7[_0x6d79('0x32')];if(_0x3fc60a['query'][_0x6d79('0x42')]){_0x5d195f[_0x6d79('0x43')]=[{'all':!![]}];}_0x5d195f=_[_0x6d79('0x3f')]({},_0x5d195f,_0x3fc60a[_0x6d79('0x41')]);return db[_0x6d79('0x2d')][_0x6d79('0x47')](_0x5d195f)[_0x6d79('0x25')](handleEntityNotFound(_0x4f862a,null))[_0x6d79('0x25')](respondWithResult(_0x4f862a,null))[_0x6d79('0x48')](handleError(_0x4f862a,null));};exports['create']=function(_0x4aa985,_0x50fb50){return db[_0x6d79('0x2d')][_0x6d79('0x49')](_0x4aa985[_0x6d79('0x4a')],{})[_0x6d79('0x25')](respondWithResult(_0x50fb50,0xc9))[_0x6d79('0x48')](handleError(_0x50fb50,null));};exports[_0x6d79('0x4b')]=function(_0x159d25,_0x4674e5){if(_0x159d25[_0x6d79('0x4a')]['id']){delete _0x159d25['body']['id'];}return db[_0x6d79('0x2d')][_0x6d79('0x47')]({'where':{'id':_0x159d25[_0x6d79('0x4c')]['id']}})[_0x6d79('0x25')](handleEntityNotFound(_0x4674e5,null))['then'](saveUpdates(_0x159d25[_0x6d79('0x4a')],null))[_0x6d79('0x25')](respondWithResult(_0x4674e5,null))[_0x6d79('0x48')](handleError(_0x4674e5,null));};exports[_0x6d79('0x26')]=function(_0x1c7bb3,_0xe3ee88){return db[_0x6d79('0x2d')][_0x6d79('0x47')]({'where':{'id':_0x1c7bb3['params']['id']}})[_0x6d79('0x25')](handleEntityNotFound(_0xe3ee88,null))[_0x6d79('0x25')](removeEntity(_0xe3ee88,null))[_0x6d79('0x48')](handleError(_0xe3ee88,null));};exports['getFields']=function(_0x51f0cd,_0x55ed1d,_0x38dbe5){var _0x3db622={};var _0x4e75e2={};var _0x2192ad;var _0x3544a3;return db[_0x6d79('0x2d')]['findOne']({'where':{'id':_0x51f0cd[_0x6d79('0x4c')]['id']}})['then'](handleEntityNotFound(_0x55ed1d,null))[_0x6d79('0x25')](function(_0x201162){if(_0x201162){_0x2192ad=_0x201162;_0x4e75e2[_0x6d79('0x32')]=_[_0x6d79('0x34')](db[_0x6d79('0x4d')]['rawAttributes']);_0x4e75e2[_0x6d79('0x33')]=_['keys'](_0x51f0cd[_0x6d79('0x33')]);_0x4e75e2[_0x6d79('0x3c')]=_['intersection'](_0x4e75e2[_0x6d79('0x32')],_0x4e75e2[_0x6d79('0x33')]);_0x3db622['attributes']=_[_0x6d79('0x35')](_0x4e75e2[_0x6d79('0x32')],qs['fields'](_0x51f0cd[_0x6d79('0x33')][_0x6d79('0x36')]));_0x3db622[_0x6d79('0x37')]=_0x3db622['attributes'][_0x6d79('0x46')]?_0x3db622[_0x6d79('0x37')]:_0x4e75e2[_0x6d79('0x32')];_0x3db622[_0x6d79('0x39')]=qs[_0x6d79('0x3a')](_0x51f0cd['query'][_0x6d79('0x3a')]);_0x3db622[_0x6d79('0x3b')]=qs[_0x6d79('0x3c')](_[_0x6d79('0x3d')](_0x51f0cd['query'],_0x4e75e2[_0x6d79('0x3c')]));if(_0x51f0cd[_0x6d79('0x33')][_0x6d79('0x3e')]){_0x3db622['where']=_[_0x6d79('0x3f')](_0x3db622[_0x6d79('0x3b')],{'$or':_[_0x6d79('0x2c')](_0x3db622[_0x6d79('0x37')],function(_0x25d605){var _0x252b49={};_0x252b49[_0x25d605]={'$like':'%'+_0x51f0cd[_0x6d79('0x33')][_0x6d79('0x3e')]+'%'};return _0x252b49;})});}_0x3db622=_[_0x6d79('0x3f')]({},_0x3db622,_0x51f0cd[_0x6d79('0x41')]);return _0x2192ad[_0x6d79('0x4e')](_0x3db622);}})[_0x6d79('0x25')](function(_0x2243cf){if(_0x2243cf){_0x3544a3=_0x2243cf[_0x6d79('0x46')];if(!_0x51f0cd['query'][_0x6d79('0x4f')](_0x6d79('0x38'))){_0x3db622[_0x6d79('0x1e')]=qs[_0x6d79('0x1e')](_0x51f0cd[_0x6d79('0x33')]['limit']);_0x3db622[_0x6d79('0x20')]=qs['offset'](_0x51f0cd['query'][_0x6d79('0x20')]);}return _0x2192ad[_0x6d79('0x4e')](_0x3db622);}})[_0x6d79('0x25')](function(_0x392c03){if(_0x392c03){return _0x392c03?{'count':_0x3544a3,'rows':_0x392c03}:null;}})[_0x6d79('0x25')](respondWithResult(_0x55ed1d,null))[_0x6d79('0x48')](handleError(_0x55ed1d,null));};exports['getSubjects']=function(_0x59006d,_0x45daee,_0x1dbde3){var _0x520946={};var _0x49e083={};var _0x56d8ec;var _0x447fd2;return db[_0x6d79('0x2d')][_0x6d79('0x50')]({'where':{'id':_0x59006d[_0x6d79('0x4c')]['id']}})[_0x6d79('0x25')](handleEntityNotFound(_0x45daee,null))[_0x6d79('0x25')](function(_0x12943c){if(_0x12943c){_0x56d8ec=_0x12943c;_0x49e083['model']=_[_0x6d79('0x34')](db[_0x6d79('0x4d')][_0x6d79('0x2e')]);_0x49e083[_0x6d79('0x33')]=_[_0x6d79('0x34')](_0x59006d['query']);_0x49e083['filters']=_['intersection'](_0x49e083[_0x6d79('0x32')],_0x49e083['query']);_0x520946[_0x6d79('0x37')]=_[_0x6d79('0x35')](_0x49e083['model'],qs[_0x6d79('0x36')](_0x59006d[_0x6d79('0x33')][_0x6d79('0x36')]));_0x520946[_0x6d79('0x37')]=_0x520946[_0x6d79('0x37')][_0x6d79('0x46')]?_0x520946['attributes']:_0x49e083['model'];_0x520946['order']=qs[_0x6d79('0x3a')](_0x59006d[_0x6d79('0x33')][_0x6d79('0x3a')]);_0x520946['where']=qs[_0x6d79('0x3c')](_[_0x6d79('0x3d')](_0x59006d['query'],_0x49e083[_0x6d79('0x3c')]));if(_0x59006d[_0x6d79('0x33')]['filter']){_0x520946[_0x6d79('0x3b')]=_[_0x6d79('0x3f')](_0x520946[_0x6d79('0x3b')],{'$or':_['map'](_0x520946['attributes'],function(_0x134e54){var _0x38f417={};_0x38f417[_0x134e54]={'$like':'%'+_0x59006d[_0x6d79('0x33')]['filter']+'%'};return _0x38f417;})});}_0x520946=_[_0x6d79('0x3f')]({},_0x520946,_0x59006d[_0x6d79('0x41')]);return _0x56d8ec[_0x6d79('0x51')](_0x520946);}})[_0x6d79('0x25')](function(_0x2d7481){if(_0x2d7481){_0x447fd2=_0x2d7481['length'];if(!_0x59006d[_0x6d79('0x33')][_0x6d79('0x4f')](_0x6d79('0x38'))){_0x520946[_0x6d79('0x1e')]=qs[_0x6d79('0x1e')](_0x59006d[_0x6d79('0x33')]['limit']);_0x520946[_0x6d79('0x20')]=qs['offset'](_0x59006d[_0x6d79('0x33')][_0x6d79('0x20')]);}return _0x56d8ec['getSubjects'](_0x520946);}})[_0x6d79('0x25')](function(_0x22a1f2){if(_0x22a1f2){return _0x22a1f2?{'count':_0x447fd2,'rows':_0x22a1f2}:null;}})[_0x6d79('0x25')](respondWithResult(_0x45daee,null))[_0x6d79('0x48')](handleError(_0x45daee,null));};exports[_0x6d79('0x52')]=function(_0x5aae2e,_0x1d963c,_0x593855){var _0x51f9d5={};var _0xf08c90={};var _0x2e314e;var _0x37aa75;return db[_0x6d79('0x2d')][_0x6d79('0x50')]({'where':{'id':_0x5aae2e['params']['id']}})[_0x6d79('0x25')](handleEntityNotFound(_0x1d963c,null))[_0x6d79('0x25')](function(_0x25ac1f){if(_0x25ac1f){_0x2e314e=_0x25ac1f;_0xf08c90[_0x6d79('0x32')]=_[_0x6d79('0x34')](db['ServicenowField']['rawAttributes']);_0xf08c90[_0x6d79('0x33')]=_['keys'](_0x5aae2e[_0x6d79('0x33')]);_0xf08c90[_0x6d79('0x3c')]=_[_0x6d79('0x35')](_0xf08c90[_0x6d79('0x32')],_0xf08c90[_0x6d79('0x33')]);_0x51f9d5[_0x6d79('0x37')]=_['intersection'](_0xf08c90[_0x6d79('0x32')],qs[_0x6d79('0x36')](_0x5aae2e['query'][_0x6d79('0x36')]));_0x51f9d5[_0x6d79('0x37')]=_0x51f9d5[_0x6d79('0x37')][_0x6d79('0x46')]?_0x51f9d5[_0x6d79('0x37')]:_0xf08c90['model'];_0x51f9d5[_0x6d79('0x39')]=qs['sort'](_0x5aae2e['query'][_0x6d79('0x3a')]);_0x51f9d5[_0x6d79('0x3b')]=qs[_0x6d79('0x3c')](_[_0x6d79('0x3d')](_0x5aae2e[_0x6d79('0x33')],_0xf08c90[_0x6d79('0x3c')]));if(_0x5aae2e[_0x6d79('0x33')]['filter']){_0x51f9d5[_0x6d79('0x3b')]=_[_0x6d79('0x3f')](_0x51f9d5[_0x6d79('0x3b')],{'$or':_['map'](_0x51f9d5[_0x6d79('0x37')],function(_0x3051c4){var _0x307961={};_0x307961[_0x3051c4]={'$like':'%'+_0x5aae2e[_0x6d79('0x33')][_0x6d79('0x3e')]+'%'};return _0x307961;})});}_0x51f9d5=_[_0x6d79('0x3f')]({},_0x51f9d5,_0x5aae2e[_0x6d79('0x41')]);return _0x2e314e[_0x6d79('0x52')](_0x51f9d5);}})[_0x6d79('0x25')](function(_0x268d99){if(_0x268d99){_0x37aa75=_0x268d99[_0x6d79('0x46')];if(!_0x5aae2e[_0x6d79('0x33')][_0x6d79('0x4f')]('nolimit')){_0x51f9d5[_0x6d79('0x1e')]=qs[_0x6d79('0x1e')](_0x5aae2e[_0x6d79('0x33')][_0x6d79('0x1e')]);_0x51f9d5[_0x6d79('0x20')]=qs[_0x6d79('0x20')](_0x5aae2e[_0x6d79('0x33')][_0x6d79('0x20')]);}return _0x2e314e[_0x6d79('0x52')](_0x51f9d5);}})[_0x6d79('0x25')](function(_0x17924d){if(_0x17924d){return _0x17924d?{'count':_0x37aa75,'rows':_0x17924d}:null;}})['then'](respondWithResult(_0x1d963c,null))[_0x6d79('0x48')](handleError(_0x1d963c,null));}; \ No newline at end of file +var _0xfc43=['filter','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','getFields','findOne','ServicenowField','merge','hasOwnProperty','getSubjects','getDescriptions','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','status','end','json','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','ServicenowConfiguration','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','VIRTUAL'];(function(_0x51551d,_0x374eda){var _0x5957aa=function(_0x4c0b9b){while(--_0x4c0b9b){_0x51551d['push'](_0x51551d['shift']());}};_0x5957aa(++_0x374eda);}(_0xfc43,0x147));var _0x3fc4=function(_0x5020b0,_0x218f95){_0x5020b0=_0x5020b0-0x0;var _0x1b88a8=_0xfc43[_0x5020b0];return _0x1b88a8;};'use strict';var emlformat=require(_0x3fc4('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3fc4('0x1'));var rp=require(_0x3fc4('0x2'));var moment=require(_0x3fc4('0x3'));var BPromise=require(_0x3fc4('0x4'));var Mustache=require('mustache');var util=require(_0x3fc4('0x5'));var path=require(_0x3fc4('0x6'));var sox=require('sox');var csv=require(_0x3fc4('0x7'));var ejs=require(_0x3fc4('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3fc4('0x9'));var squel=require(_0x3fc4('0xa'));var crypto=require(_0x3fc4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x3fc4('0xc'));var toCsv=require(_0x3fc4('0x7'));var querystring=require('querystring');var Papa=require(_0x3fc4('0xd'));var Redis=require(_0x3fc4('0xe'));var authService=require(_0x3fc4('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x3fc4('0x10'));var hardwareService=require(_0x3fc4('0x11'));var logger=require('../../config/logger')(_0x3fc4('0x12'));var utils=require('../../config/utils');var config=require(_0x3fc4('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x3fc4('0x14'))['db'];function respondWithStatusCode(_0x35c28f,_0x4dc807){_0x4dc807=_0x4dc807||0xcc;return function(_0x513a6c){if(_0x513a6c){return _0x35c28f['sendStatus'](_0x4dc807);}return _0x35c28f[_0x3fc4('0x15')](_0x4dc807)[_0x3fc4('0x16')]();};}function respondWithResult(_0x12a698,_0x1511b2){_0x1511b2=_0x1511b2||0xc8;return function(_0x3f8afa){if(_0x3f8afa){return _0x12a698[_0x3fc4('0x15')](_0x1511b2)[_0x3fc4('0x17')](_0x3f8afa);}};}function respondWithFilteredResult(_0x1b00d8,_0x1261f4){return function(_0x497973){if(_0x497973){var _0x3560a0=typeof _0x1261f4['offset']==='undefined'&&typeof _0x1261f4[_0x3fc4('0x18')]==='undefined';var _0x49fdd4=_0x497973['count'];var _0x482606=_0x3560a0?0x0:_0x1261f4[_0x3fc4('0x19')];var _0x475b88=_0x3560a0?_0x497973[_0x3fc4('0x1a')]:_0x1261f4[_0x3fc4('0x19')]+_0x1261f4[_0x3fc4('0x18')];var _0x5c9deb;if(_0x475b88>=_0x49fdd4){_0x475b88=_0x49fdd4;_0x5c9deb=0xc8;}else{_0x5c9deb=0xce;}_0x1b00d8[_0x3fc4('0x15')](_0x5c9deb);return _0x1b00d8[_0x3fc4('0x1b')](_0x3fc4('0x1c'),_0x482606+'-'+_0x475b88+'/'+_0x49fdd4)['json'](_0x497973);}return null;};}function patchUpdates(_0xe0a8c0){return function(_0x23c948){try{jsonpatch[_0x3fc4('0x1d')](_0x23c948,_0xe0a8c0,!![]);}catch(_0x53c4c9){return BPromise[_0x3fc4('0x1e')](_0x53c4c9);}return _0x23c948[_0x3fc4('0x1f')]();};}function saveUpdates(_0x43ee91,_0x2cac6b){return function(_0x2b3979){if(_0x2b3979){return _0x2b3979[_0x3fc4('0x20')](_0x43ee91)[_0x3fc4('0x21')](function(_0x515ff2){return _0x515ff2;});}return null;};}function removeEntity(_0x26704c,_0x3d13d1){return function(_0x1ec83c){if(_0x1ec83c){return _0x1ec83c[_0x3fc4('0x22')]()[_0x3fc4('0x21')](function(){_0x26704c[_0x3fc4('0x15')](0xcc)[_0x3fc4('0x16')]();});}};}function handleEntityNotFound(_0x37aa5b,_0x275353){return function(_0x205cfd){if(!_0x205cfd){_0x37aa5b[_0x3fc4('0x23')](0x194);}return _0x205cfd;};}function handleError(_0x52dc8a,_0x46ba49){_0x46ba49=_0x46ba49||0x1f4;return function(_0x5737f5){logger[_0x3fc4('0x24')](_0x5737f5[_0x3fc4('0x25')]);if(_0x5737f5[_0x3fc4('0x26')]){delete _0x5737f5[_0x3fc4('0x26')];}_0x52dc8a[_0x3fc4('0x15')](_0x46ba49)['send'](_0x5737f5);};}exports[_0x3fc4('0x27')]=function(_0x1bf990,_0x51f1fe){var _0xca57d1={},_0x1dc822={},_0x13b626={'count':0x0,'rows':[]};var _0x504a6c=_[_0x3fc4('0x28')](db[_0x3fc4('0x29')]['rawAttributes'],function(_0x40f575){return{'name':_0x40f575[_0x3fc4('0x2a')],'type':_0x40f575[_0x3fc4('0x2b')]['key']};});_0x1dc822['model']=_[_0x3fc4('0x28')](_0x504a6c,'name');_0x1dc822[_0x3fc4('0x2c')]=_[_0x3fc4('0x2d')](_0x1bf990['query']);_0x1dc822[_0x3fc4('0x2e')]=_[_0x3fc4('0x2f')](_0x1dc822[_0x3fc4('0x30')],_0x1dc822[_0x3fc4('0x2c')]);_0xca57d1['attributes']=_['intersection'](_0x1dc822['model'],qs[_0x3fc4('0x31')](_0x1bf990['query'][_0x3fc4('0x31')]));_0xca57d1[_0x3fc4('0x32')]=_0xca57d1[_0x3fc4('0x32')][_0x3fc4('0x33')]?_0xca57d1[_0x3fc4('0x32')]:_0x1dc822[_0x3fc4('0x30')];if(!_0x1bf990[_0x3fc4('0x2c')]['hasOwnProperty'](_0x3fc4('0x34'))){_0xca57d1['limit']=qs[_0x3fc4('0x18')](_0x1bf990[_0x3fc4('0x2c')][_0x3fc4('0x18')]);_0xca57d1['offset']=qs[_0x3fc4('0x19')](_0x1bf990[_0x3fc4('0x2c')][_0x3fc4('0x19')]);}_0xca57d1[_0x3fc4('0x35')]=qs[_0x3fc4('0x36')](_0x1bf990[_0x3fc4('0x2c')][_0x3fc4('0x36')]);_0xca57d1[_0x3fc4('0x37')]=qs['filters'](_[_0x3fc4('0x38')](_0x1bf990[_0x3fc4('0x2c')],_0x1dc822[_0x3fc4('0x2e')]),_0x504a6c);if(_0x1bf990[_0x3fc4('0x2c')]['filter']){_0xca57d1[_0x3fc4('0x37')]=_['merge'](_0xca57d1[_0x3fc4('0x37')],{'$or':_[_0x3fc4('0x28')](_0x504a6c,function(_0x1f743d){if(_0x1f743d[_0x3fc4('0x2b')]!==_0x3fc4('0x39')){var _0x29403a={};_0x29403a[_0x1f743d[_0x3fc4('0x26')]]={'$like':'%'+_0x1bf990[_0x3fc4('0x2c')][_0x3fc4('0x3a')]+'%'};return _0x29403a;}})});}_0xca57d1=_['merge']({},_0xca57d1,_0x1bf990[_0x3fc4('0x3b')]);var _0x48d02e={'where':_0xca57d1[_0x3fc4('0x37')]};return db[_0x3fc4('0x29')][_0x3fc4('0x1a')](_0x48d02e)['then'](function(_0x4db801){_0x13b626[_0x3fc4('0x1a')]=_0x4db801;if(_0x1bf990[_0x3fc4('0x2c')][_0x3fc4('0x3c')]){_0xca57d1[_0x3fc4('0x3d')]=[{'all':!![]}];}return db['ServicenowConfiguration'][_0x3fc4('0x3e')](_0xca57d1);})[_0x3fc4('0x21')](function(_0x463d61){_0x13b626['rows']=_0x463d61;return _0x13b626;})[_0x3fc4('0x21')](respondWithFilteredResult(_0x51f1fe,_0xca57d1))[_0x3fc4('0x3f')](handleError(_0x51f1fe,null));};exports[_0x3fc4('0x40')]=function(_0x3c00ab,_0x5471d8){var _0x3cd9f5={'raw':![],'where':{'id':_0x3c00ab[_0x3fc4('0x41')]['id']}},_0x781bd6={};_0x781bd6[_0x3fc4('0x30')]=_[_0x3fc4('0x2d')](db[_0x3fc4('0x29')][_0x3fc4('0x42')]);_0x781bd6[_0x3fc4('0x2c')]=_[_0x3fc4('0x2d')](_0x3c00ab[_0x3fc4('0x2c')]);_0x781bd6[_0x3fc4('0x2e')]=_[_0x3fc4('0x2f')](_0x781bd6[_0x3fc4('0x30')],_0x781bd6[_0x3fc4('0x2c')]);_0x3cd9f5['attributes']=_[_0x3fc4('0x2f')](_0x781bd6['model'],qs['fields'](_0x3c00ab['query']['fields']));_0x3cd9f5[_0x3fc4('0x32')]=_0x3cd9f5['attributes'][_0x3fc4('0x33')]?_0x3cd9f5[_0x3fc4('0x32')]:_0x781bd6[_0x3fc4('0x30')];if(_0x3c00ab[_0x3fc4('0x2c')][_0x3fc4('0x3c')]){_0x3cd9f5[_0x3fc4('0x3d')]=[{'all':!![]}];}_0x3cd9f5=_['merge']({},_0x3cd9f5,_0x3c00ab[_0x3fc4('0x3b')]);return db[_0x3fc4('0x29')][_0x3fc4('0x43')](_0x3cd9f5)[_0x3fc4('0x21')](handleEntityNotFound(_0x5471d8,null))[_0x3fc4('0x21')](respondWithResult(_0x5471d8,null))['catch'](handleError(_0x5471d8,null));};exports['create']=function(_0x44deee,_0xd46648){return db[_0x3fc4('0x29')][_0x3fc4('0x44')](_0x44deee[_0x3fc4('0x45')],{})[_0x3fc4('0x21')](respondWithResult(_0xd46648,0xc9))[_0x3fc4('0x3f')](handleError(_0xd46648,null));};exports[_0x3fc4('0x20')]=function(_0x3e6276,_0x450319){if(_0x3e6276[_0x3fc4('0x45')]['id']){delete _0x3e6276[_0x3fc4('0x45')]['id'];}return db[_0x3fc4('0x29')][_0x3fc4('0x43')]({'where':{'id':_0x3e6276[_0x3fc4('0x41')]['id']}})['then'](handleEntityNotFound(_0x450319,null))[_0x3fc4('0x21')](saveUpdates(_0x3e6276[_0x3fc4('0x45')],null))[_0x3fc4('0x21')](respondWithResult(_0x450319,null))[_0x3fc4('0x3f')](handleError(_0x450319,null));};exports[_0x3fc4('0x22')]=function(_0x7c8987,_0x47d6b2){return db[_0x3fc4('0x29')][_0x3fc4('0x43')]({'where':{'id':_0x7c8987['params']['id']}})['then'](handleEntityNotFound(_0x47d6b2,null))['then'](removeEntity(_0x47d6b2,null))[_0x3fc4('0x3f')](handleError(_0x47d6b2,null));};exports[_0x3fc4('0x46')]=function(_0x511f16,_0x452cbc,_0x53a772){var _0x16ea96={};var _0x308a5e={};var _0x43f4c2;var _0x4e3206;return db['ServicenowConfiguration'][_0x3fc4('0x47')]({'where':{'id':_0x511f16[_0x3fc4('0x41')]['id']}})[_0x3fc4('0x21')](handleEntityNotFound(_0x452cbc,null))[_0x3fc4('0x21')](function(_0xa84ace){if(_0xa84ace){_0x43f4c2=_0xa84ace;_0x308a5e[_0x3fc4('0x30')]=_['keys'](db[_0x3fc4('0x48')][_0x3fc4('0x42')]);_0x308a5e[_0x3fc4('0x2c')]=_[_0x3fc4('0x2d')](_0x511f16[_0x3fc4('0x2c')]);_0x308a5e['filters']=_[_0x3fc4('0x2f')](_0x308a5e[_0x3fc4('0x30')],_0x308a5e[_0x3fc4('0x2c')]);_0x16ea96['attributes']=_[_0x3fc4('0x2f')](_0x308a5e[_0x3fc4('0x30')],qs[_0x3fc4('0x31')](_0x511f16[_0x3fc4('0x2c')]['fields']));_0x16ea96[_0x3fc4('0x32')]=_0x16ea96[_0x3fc4('0x32')][_0x3fc4('0x33')]?_0x16ea96[_0x3fc4('0x32')]:_0x308a5e[_0x3fc4('0x30')];_0x16ea96[_0x3fc4('0x35')]=qs[_0x3fc4('0x36')](_0x511f16[_0x3fc4('0x2c')]['sort']);_0x16ea96[_0x3fc4('0x37')]=qs[_0x3fc4('0x2e')](_[_0x3fc4('0x38')](_0x511f16[_0x3fc4('0x2c')],_0x308a5e[_0x3fc4('0x2e')]));if(_0x511f16[_0x3fc4('0x2c')][_0x3fc4('0x3a')]){_0x16ea96[_0x3fc4('0x37')]=_['merge'](_0x16ea96[_0x3fc4('0x37')],{'$or':_[_0x3fc4('0x28')](_0x16ea96['attributes'],function(_0xd8f023){var _0x26bd61={};_0x26bd61[_0xd8f023]={'$like':'%'+_0x511f16['query']['filter']+'%'};return _0x26bd61;})});}_0x16ea96=_[_0x3fc4('0x49')]({},_0x16ea96,_0x511f16[_0x3fc4('0x3b')]);return _0x43f4c2[_0x3fc4('0x46')](_0x16ea96);}})[_0x3fc4('0x21')](function(_0x3e50f9){if(_0x3e50f9){_0x4e3206=_0x3e50f9[_0x3fc4('0x33')];if(!_0x511f16[_0x3fc4('0x2c')][_0x3fc4('0x4a')]('nolimit')){_0x16ea96[_0x3fc4('0x18')]=qs[_0x3fc4('0x18')](_0x511f16[_0x3fc4('0x2c')][_0x3fc4('0x18')]);_0x16ea96[_0x3fc4('0x19')]=qs[_0x3fc4('0x19')](_0x511f16[_0x3fc4('0x2c')][_0x3fc4('0x19')]);}return _0x43f4c2[_0x3fc4('0x46')](_0x16ea96);}})[_0x3fc4('0x21')](function(_0x5070bf){if(_0x5070bf){return _0x5070bf?{'count':_0x4e3206,'rows':_0x5070bf}:null;}})[_0x3fc4('0x21')](respondWithResult(_0x452cbc,null))[_0x3fc4('0x3f')](handleError(_0x452cbc,null));};exports['getSubjects']=function(_0x3466a7,_0x41469c,_0x16c974){var _0x148d6c={};var _0xda4f24={};var _0x18cf79;var _0x1dec72;return db['ServicenowConfiguration']['findOne']({'where':{'id':_0x3466a7['params']['id']}})['then'](handleEntityNotFound(_0x41469c,null))[_0x3fc4('0x21')](function(_0x113ce8){if(_0x113ce8){_0x18cf79=_0x113ce8;_0xda4f24[_0x3fc4('0x30')]=_[_0x3fc4('0x2d')](db['ServicenowField'][_0x3fc4('0x42')]);_0xda4f24[_0x3fc4('0x2c')]=_[_0x3fc4('0x2d')](_0x3466a7['query']);_0xda4f24['filters']=_[_0x3fc4('0x2f')](_0xda4f24[_0x3fc4('0x30')],_0xda4f24[_0x3fc4('0x2c')]);_0x148d6c[_0x3fc4('0x32')]=_['intersection'](_0xda4f24[_0x3fc4('0x30')],qs[_0x3fc4('0x31')](_0x3466a7[_0x3fc4('0x2c')]['fields']));_0x148d6c['attributes']=_0x148d6c[_0x3fc4('0x32')]['length']?_0x148d6c[_0x3fc4('0x32')]:_0xda4f24['model'];_0x148d6c[_0x3fc4('0x35')]=qs['sort'](_0x3466a7[_0x3fc4('0x2c')][_0x3fc4('0x36')]);_0x148d6c[_0x3fc4('0x37')]=qs[_0x3fc4('0x2e')](_[_0x3fc4('0x38')](_0x3466a7[_0x3fc4('0x2c')],_0xda4f24[_0x3fc4('0x2e')]));if(_0x3466a7[_0x3fc4('0x2c')][_0x3fc4('0x3a')]){_0x148d6c['where']=_[_0x3fc4('0x49')](_0x148d6c['where'],{'$or':_[_0x3fc4('0x28')](_0x148d6c[_0x3fc4('0x32')],function(_0x3e901b){var _0xffd4f0={};_0xffd4f0[_0x3e901b]={'$like':'%'+_0x3466a7[_0x3fc4('0x2c')]['filter']+'%'};return _0xffd4f0;})});}_0x148d6c=_[_0x3fc4('0x49')]({},_0x148d6c,_0x3466a7['options']);return _0x18cf79['getSubjects'](_0x148d6c);}})['then'](function(_0x2af9ad){if(_0x2af9ad){_0x1dec72=_0x2af9ad[_0x3fc4('0x33')];if(!_0x3466a7[_0x3fc4('0x2c')][_0x3fc4('0x4a')](_0x3fc4('0x34'))){_0x148d6c[_0x3fc4('0x18')]=qs[_0x3fc4('0x18')](_0x3466a7['query'][_0x3fc4('0x18')]);_0x148d6c['offset']=qs['offset'](_0x3466a7[_0x3fc4('0x2c')][_0x3fc4('0x19')]);}return _0x18cf79[_0x3fc4('0x4b')](_0x148d6c);}})['then'](function(_0x491e5b){if(_0x491e5b){return _0x491e5b?{'count':_0x1dec72,'rows':_0x491e5b}:null;}})[_0x3fc4('0x21')](respondWithResult(_0x41469c,null))[_0x3fc4('0x3f')](handleError(_0x41469c,null));};exports[_0x3fc4('0x4c')]=function(_0x53b0b7,_0x4692d6,_0x3bcc21){var _0x367d24={};var _0x4684e3={};var _0x14aa77;var _0x4f116d;return db[_0x3fc4('0x29')][_0x3fc4('0x47')]({'where':{'id':_0x53b0b7['params']['id']}})[_0x3fc4('0x21')](handleEntityNotFound(_0x4692d6,null))[_0x3fc4('0x21')](function(_0x7c59c8){if(_0x7c59c8){_0x14aa77=_0x7c59c8;_0x4684e3[_0x3fc4('0x30')]=_[_0x3fc4('0x2d')](db[_0x3fc4('0x48')]['rawAttributes']);_0x4684e3['query']=_['keys'](_0x53b0b7['query']);_0x4684e3['filters']=_[_0x3fc4('0x2f')](_0x4684e3[_0x3fc4('0x30')],_0x4684e3[_0x3fc4('0x2c')]);_0x367d24['attributes']=_['intersection'](_0x4684e3['model'],qs[_0x3fc4('0x31')](_0x53b0b7[_0x3fc4('0x2c')]['fields']));_0x367d24[_0x3fc4('0x32')]=_0x367d24[_0x3fc4('0x32')][_0x3fc4('0x33')]?_0x367d24[_0x3fc4('0x32')]:_0x4684e3[_0x3fc4('0x30')];_0x367d24[_0x3fc4('0x35')]=qs[_0x3fc4('0x36')](_0x53b0b7[_0x3fc4('0x2c')][_0x3fc4('0x36')]);_0x367d24[_0x3fc4('0x37')]=qs[_0x3fc4('0x2e')](_['pick'](_0x53b0b7[_0x3fc4('0x2c')],_0x4684e3[_0x3fc4('0x2e')]));if(_0x53b0b7[_0x3fc4('0x2c')][_0x3fc4('0x3a')]){_0x367d24[_0x3fc4('0x37')]=_[_0x3fc4('0x49')](_0x367d24[_0x3fc4('0x37')],{'$or':_['map'](_0x367d24['attributes'],function(_0x489b83){var _0x5a32e0={};_0x5a32e0[_0x489b83]={'$like':'%'+_0x53b0b7[_0x3fc4('0x2c')]['filter']+'%'};return _0x5a32e0;})});}_0x367d24=_[_0x3fc4('0x49')]({},_0x367d24,_0x53b0b7['options']);return _0x14aa77[_0x3fc4('0x4c')](_0x367d24);}})[_0x3fc4('0x21')](function(_0x1ada18){if(_0x1ada18){_0x4f116d=_0x1ada18[_0x3fc4('0x33')];if(!_0x53b0b7[_0x3fc4('0x2c')][_0x3fc4('0x4a')](_0x3fc4('0x34'))){_0x367d24['limit']=qs[_0x3fc4('0x18')](_0x53b0b7[_0x3fc4('0x2c')][_0x3fc4('0x18')]);_0x367d24[_0x3fc4('0x19')]=qs[_0x3fc4('0x19')](_0x53b0b7[_0x3fc4('0x2c')]['offset']);}return _0x14aa77[_0x3fc4('0x4c')](_0x367d24);}})[_0x3fc4('0x21')](function(_0x4a2f3d){if(_0x4a2f3d){return _0x4a2f3d?{'count':_0x4f116d,'rows':_0x4a2f3d}:null;}})[_0x3fc4('0x21')](respondWithResult(_0x4692d6,null))[_0x3fc4('0x3f')](handleError(_0x4692d6,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index cc1c0ea..9011fbe 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 _0x3070=['bluebird','request-promise','path','rimraf','exports','define','int_servicenow_configurations','util','api','moment'];(function(_0x4a04de,_0x2e342c){var _0xbbe018=function(_0x39639c){while(--_0x39639c){_0x4a04de['push'](_0x4a04de['shift']());}};_0xbbe018(++_0x2e342c);}(_0x3070,0x75));var _0x0307=function(_0x7552a5,_0x15bb08){_0x7552a5=_0x7552a5-0x0;var _0x53feef=_0x3070[_0x7552a5];return _0x53feef;};'use strict';var _=require('lodash');var util=require(_0x0307('0x0'));var logger=require('../../config/logger')(_0x0307('0x1'));var moment=require(_0x0307('0x2'));var BPromise=require(_0x0307('0x3'));var rp=require(_0x0307('0x4'));var fs=require('fs');var path=require(_0x0307('0x5'));var rimraf=require(_0x0307('0x6'));var config=require('../../config/environment');var attributes=require('./intServicenowConfiguration.attributes');module[_0x0307('0x7')]=function(_0x1d3d56,_0xf9f4c0){return _0x1d3d56[_0x0307('0x8')]('ServicenowConfiguration',attributes,{'tableName':_0x0307('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5b12=['int_servicenow_configurations','lodash','util','../../config/logger','moment','request-promise','path','../../config/environment','ServicenowConfiguration'];(function(_0x54e1b1,_0x394502){var _0x3fff20=function(_0x1571f0){while(--_0x1571f0){_0x54e1b1['push'](_0x54e1b1['shift']());}};_0x3fff20(++_0x394502);}(_0x5b12,0xa3));var _0x25b1=function(_0x38de93,_0x3ad1d2){_0x38de93=_0x38de93-0x0;var _0x25941b=_0x5b12[_0x38de93];return _0x25941b;};'use strict';var _=require(_0x25b1('0x0'));var util=require(_0x25b1('0x1'));var logger=require(_0x25b1('0x2'))('api');var moment=require(_0x25b1('0x3'));var BPromise=require('bluebird');var rp=require(_0x25b1('0x4'));var fs=require('fs');var path=require(_0x25b1('0x5'));var rimraf=require('rimraf');var config=require(_0x25b1('0x6'));var attributes=require('./intServicenowConfiguration.attributes');module['exports']=function(_0x35d90b,_0x5523c9){return _0x35d90b['define'](_0x25b1('0x7'),attributes,{'tableName':_0x25b1('0x8'),'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 43c6cf7..b8931c5 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 _0xd047=['error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x478d51,_0x100592){var _0x55d56c=function(_0x3614fd){while(--_0x3614fd){_0x478d51['push'](_0x478d51['shift']());}};_0x55d56c(++_0x100592);}(_0xd047,0x77));var _0x7d04=function(_0x572539,_0x327994){_0x572539=_0x572539-0x0;var _0x4feb80=_0xd047[_0x572539];return _0x4feb80;};'use strict';var _=require(_0x7d04('0x0'));var util=require('util');var moment=require(_0x7d04('0x1'));var BPromise=require(_0x7d04('0x2'));var rs=require(_0x7d04('0x3'));var fs=require('fs');var Redis=require(_0x7d04('0x4'));var db=require(_0x7d04('0x5'))['db'];var utils=require(_0x7d04('0x6'));var logger=require(_0x7d04('0x7'))(_0x7d04('0x8'));var config=require(_0x7d04('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7d04('0xa')][_0x7d04('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x242f1c,_0x1d8e86,_0x24e069){return new BPromise(function(_0x42eebf,_0xfd607e){return client[_0x7d04('0xc')](_0x242f1c,_0x24e069)[_0x7d04('0xd')](function(_0xacbf44){logger[_0x7d04('0xe')](_0x7d04('0xf'),_0x1d8e86,_0x7d04('0x10'));logger[_0x7d04('0x11')](_0x7d04('0x12'),_0x1d8e86,_0x7d04('0x10'),JSON['stringify'](_0xacbf44));if(_0xacbf44[_0x7d04('0x13')]){if(_0xacbf44[_0x7d04('0x13')][_0x7d04('0x14')]===0x1f4){logger['error'](_0x7d04('0xf'),_0x1d8e86,_0xacbf44['error'][_0x7d04('0x15')]);return _0xfd607e(_0xacbf44[_0x7d04('0x13')][_0x7d04('0x15')]);}logger['error'](_0x7d04('0xf'),_0x1d8e86,_0xacbf44[_0x7d04('0x13')][_0x7d04('0x15')]);return _0x42eebf(_0xacbf44['error'][_0x7d04('0x15')]);}else{logger[_0x7d04('0xe')](_0x7d04('0xf'),_0x1d8e86,'request\x20sent');_0x42eebf(_0xacbf44['result']['message']);}})[_0x7d04('0x16')](function(_0x22f5e7){logger[_0x7d04('0x13')](_0x7d04('0xf'),_0x1d8e86,_0x22f5e7);_0xfd607e(_0x22f5e7);});});} \ No newline at end of file +var _0xdcbb=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash'];(function(_0x4dd72b,_0x43a1e1){var _0x2a595a=function(_0x4145f7){while(--_0x4145f7){_0x4dd72b['push'](_0x4dd72b['shift']());}};_0x2a595a(++_0x43a1e1);}(_0xdcbb,0x164));var _0xbdcb=function(_0x2f1a41,_0x3f9ea2){_0x2f1a41=_0x2f1a41-0x0;var _0x2b2f1b=_0xdcbb[_0x2f1a41];return _0x2b2f1b;};'use strict';var _=require(_0xbdcb('0x0'));var util=require(_0xbdcb('0x1'));var moment=require(_0xbdcb('0x2'));var BPromise=require(_0xbdcb('0x3'));var rs=require(_0xbdcb('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbdcb('0x5'))['db'];var utils=require(_0xbdcb('0x6'));var logger=require(_0xbdcb('0x7'))(_0xbdcb('0x8'));var config=require('../../config/environment');var jayson=require(_0xbdcb('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5bd9a8,_0x3e92cb,_0x8b6d0b){return new BPromise(function(_0x5b2560,_0x51a6c4){return client[_0xbdcb('0xa')](_0x5bd9a8,_0x8b6d0b)[_0xbdcb('0xb')](function(_0x367007){logger[_0xbdcb('0xc')](_0xbdcb('0xd'),_0x3e92cb,_0xbdcb('0xe'));logger[_0xbdcb('0xf')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x3e92cb,_0xbdcb('0xe'),JSON[_0xbdcb('0x10')](_0x367007));if(_0x367007[_0xbdcb('0x11')]){if(_0x367007[_0xbdcb('0x11')][_0xbdcb('0x12')]===0x1f4){logger[_0xbdcb('0x11')]('ServicenowConfiguration,\x20%s,\x20%s',_0x3e92cb,_0x367007[_0xbdcb('0x11')][_0xbdcb('0x13')]);return _0x51a6c4(_0x367007[_0xbdcb('0x11')][_0xbdcb('0x13')]);}logger[_0xbdcb('0x11')](_0xbdcb('0xd'),_0x3e92cb,_0x367007[_0xbdcb('0x11')][_0xbdcb('0x13')]);return _0x5b2560(_0x367007['error'][_0xbdcb('0x13')]);}else{logger['info']('ServicenowConfiguration,\x20%s,\x20%s',_0x3e92cb,_0xbdcb('0xe'));_0x5b2560(_0x367007['result']['message']);}})[_0xbdcb('0x14')](function(_0xee03c5){logger[_0xbdcb('0x11')]('ServicenowConfiguration,\x20%s,\x20%s',_0x3e92cb,_0xee03c5);_0x51a6c4(_0xee03c5);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 9b9b9ba..dc93c25 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 _0x7357=['post','update','delete','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show'];(function(_0x3d617f,_0x16599a){var _0x9aa921=function(_0x5cca7e){while(--_0x5cca7e){_0x3d617f['push'](_0x3d617f['shift']());}};_0x9aa921(++_0x16599a);}(_0x7357,0x1a7));var _0x7735=function(_0x2dc143,_0x49b678){_0x2dc143=_0x2dc143-0x0;var _0xcdcfe3=_0x7357[_0x2dc143];return _0xcdcfe3;};'use strict';var multer=require(_0x7735('0x0'));var util=require(_0x7735('0x1'));var path=require('path');var timeout=require(_0x7735('0x2'));var express=require(_0x7735('0x3'));var router=express[_0x7735('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7735('0x5'));var interaction=require(_0x7735('0x6'));var config=require(_0x7735('0x7'));var controller=require('./intServicenowField.controller');router[_0x7735('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x7735('0x9'),auth[_0x7735('0xa')](),controller[_0x7735('0xb')]);router[_0x7735('0xc')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x7735('0x9'),auth[_0x7735('0xa')](),controller[_0x7735('0xd')]);router[_0x7735('0xe')](_0x7735('0x9'),auth[_0x7735('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xda09=['../../config/environment','./intServicenowField.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','destroy','exports','util','path','connect-timeout','Router','fs-extra'];(function(_0x1f19f,_0xb86953){var _0x5a728e=function(_0x5cb437){while(--_0x5cb437){_0x1f19f['push'](_0x1f19f['shift']());}};_0x5a728e(++_0xb86953);}(_0xda09,0xaf));var _0x9da0=function(_0x3a739e,_0x503035){_0x3a739e=_0x3a739e-0x0;var _0x1e7eb8=_0xda09[_0x3a739e];return _0x1e7eb8;};'use strict';var multer=require('multer');var util=require(_0x9da0('0x0'));var path=require(_0x9da0('0x1'));var timeout=require(_0x9da0('0x2'));var express=require('express');var router=express[_0x9da0('0x3')]();var fs_extra=require(_0x9da0('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9da0('0x5'));var controller=require(_0x9da0('0x6'));router[_0x9da0('0x7')]('/',auth['isAuthenticated'](),controller[_0x9da0('0x8')]);router[_0x9da0('0x7')](_0x9da0('0x9'),auth[_0x9da0('0xa')](),controller[_0x9da0('0xb')]);router[_0x9da0('0xc')]('/',auth[_0x9da0('0xa')](),controller[_0x9da0('0xd')]);router[_0x9da0('0xe')](_0x9da0('0x9'),auth['isAuthenticated'](),controller[_0x9da0('0xf')]);router['delete'](_0x9da0('0x9'),auth[_0x9da0('0xa')](),controller[_0x9da0('0x10')]);module[_0x9da0('0x11')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index a34f858..e710260 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 _0x00d0=['variable','customVariable','picklist','STRING','BOOLEAN','sequelize','exports'];(function(_0x11e30d,_0x5584aa){var _0x2d4e29=function(_0x2486ce){while(--_0x2486ce){_0x11e30d['push'](_0x11e30d['shift']());}};_0x2d4e29(++_0x5584aa);}(_0x00d0,0x67));var _0x000d=function(_0x1140b5,_0x38a731){_0x1140b5=_0x1140b5-0x0;var _0x209140=_0x00d0[_0x1140b5];return _0x209140;};'use strict';var Sequelize=require(_0x000d('0x0'));module[_0x000d('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x000d('0x2'),_0x000d('0x3'),'keyValue',_0x000d('0x4')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x000d('0x5')]},'keyType':{'type':Sequelize['ENUM']('string',_0x000d('0x2'),_0x000d('0x3'))},'keyContent':{'type':Sequelize[_0x000d('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x000d('0x5')]},'customField':{'type':Sequelize[_0x000d('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x000d('0x5')]}}; \ No newline at end of file +var _0xf1f1=['keyValue','STRING','string','BOOLEAN','sequelize','exports','ENUM','variable','customVariable'];(function(_0x8c1da7,_0x446097){var _0x9327d8=function(_0x48f922){while(--_0x48f922){_0x8c1da7['push'](_0x8c1da7['shift']());}};_0x9327d8(++_0x446097);}(_0xf1f1,0x1d8));var _0x1f1f=function(_0x198d29,_0x297f77){_0x198d29=_0x198d29-0x0;var _0x1f1109=_0xf1f1[_0x198d29];return _0x1f1109;};'use strict';var Sequelize=require(_0x1f1f('0x0'));module[_0x1f1f('0x1')]={'type':{'type':Sequelize[_0x1f1f('0x2')]('string',_0x1f1f('0x3'),_0x1f1f('0x4'),_0x1f1f('0x5'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x1f1f('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x1f1f('0x2')](_0x1f1f('0x7'),_0x1f1f('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x1f1f('0x6')]},'idField':{'type':Sequelize[_0x1f1f('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x1f1f('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1f1f('0x6')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index d85ab06..ab2bd75 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 _0xbe40=['end','stack','name','send','map','ServicenowField','rawAttributes','key','model','keys','intersection','query','attributes','fields','length','sort','filters','pick','filter','where','type','merge','options','include','rows','show','params','includeAll','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then'];(function(_0x358f87,_0x5a4d20){var _0x4b2fdb=function(_0x384222){while(--_0x384222){_0x358f87['push'](_0x358f87['shift']());}};_0x4b2fdb(++_0x5a4d20);}(_0xbe40,0x69));var _0x0be4=function(_0x32b316,_0x26d2be){_0x32b316=_0x32b316-0x0;var _0x5a5e1c=_0xbe40[_0x32b316];return _0x5a5e1c;};'use strict';var emlformat=require(_0x0be4('0x0'));var rimraf=require(_0x0be4('0x1'));var zipdir=require(_0x0be4('0x2'));var jsonpatch=require(_0x0be4('0x3'));var rp=require(_0x0be4('0x4'));var moment=require(_0x0be4('0x5'));var BPromise=require(_0x0be4('0x6'));var Mustache=require(_0x0be4('0x7'));var util=require('util');var path=require(_0x0be4('0x8'));var sox=require(_0x0be4('0x9'));var csv=require(_0x0be4('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0be4('0xb'));var _=require(_0x0be4('0xc'));var squel=require(_0x0be4('0xd'));var crypto=require(_0x0be4('0xe'));var jsforce=require(_0x0be4('0xf'));var deskjs=require(_0x0be4('0x10'));var toCsv=require(_0x0be4('0xa'));var querystring=require('querystring');var Papa=require(_0x0be4('0x11'));var Redis=require(_0x0be4('0x12'));var authService=require(_0x0be4('0x13'));var qs=require(_0x0be4('0x14'));var as=require(_0x0be4('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0be4('0x16'))(_0x0be4('0x17'));var utils=require(_0x0be4('0x18'));var config=require(_0x0be4('0x19'));var licenseUtil=require(_0x0be4('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1f5adf,_0x159b9b){_0x159b9b=_0x159b9b||0xcc;return function(_0x7161a7){if(_0x7161a7){return _0x1f5adf[_0x0be4('0x1b')](_0x159b9b);}return _0x1f5adf[_0x0be4('0x1c')](_0x159b9b)['end']();};}function respondWithResult(_0x170b54,_0x26b06b){_0x26b06b=_0x26b06b||0xc8;return function(_0x33a06f){if(_0x33a06f){return _0x170b54[_0x0be4('0x1c')](_0x26b06b)[_0x0be4('0x1d')](_0x33a06f);}};}function respondWithFilteredResult(_0x4b8db6,_0xcee9e9){return function(_0xbaaeda){if(_0xbaaeda){var _0x4fccd1=typeof _0xcee9e9[_0x0be4('0x1e')]===_0x0be4('0x1f')&&typeof _0xcee9e9[_0x0be4('0x20')]===_0x0be4('0x1f');var _0x2ac5ab=_0xbaaeda[_0x0be4('0x21')];var _0x5257fa=_0x4fccd1?0x0:_0xcee9e9[_0x0be4('0x1e')];var _0x172b43=_0x4fccd1?_0xbaaeda[_0x0be4('0x21')]:_0xcee9e9['offset']+_0xcee9e9[_0x0be4('0x20')];var _0x35c709;if(_0x172b43>=_0x2ac5ab){_0x172b43=_0x2ac5ab;_0x35c709=0xc8;}else{_0x35c709=0xce;}_0x4b8db6[_0x0be4('0x1c')](_0x35c709);return _0x4b8db6[_0x0be4('0x22')](_0x0be4('0x23'),_0x5257fa+'-'+_0x172b43+'/'+_0x2ac5ab)[_0x0be4('0x1d')](_0xbaaeda);}return null;};}function patchUpdates(_0x3f93d7){return function(_0x3ba1e2){try{jsonpatch['apply'](_0x3ba1e2,_0x3f93d7,!![]);}catch(_0x31a0a7){return BPromise[_0x0be4('0x24')](_0x31a0a7);}return _0x3ba1e2[_0x0be4('0x25')]();};}function saveUpdates(_0x13c96e,_0x276d5f){return function(_0x14d66e){if(_0x14d66e){return _0x14d66e[_0x0be4('0x26')](_0x13c96e)['then'](function(_0x355957){return _0x355957;});}return null;};}function removeEntity(_0x4fc4e7,_0x1ad114){return function(_0x9c07be){if(_0x9c07be){return _0x9c07be[_0x0be4('0x27')]()[_0x0be4('0x28')](function(){_0x4fc4e7['status'](0xcc)[_0x0be4('0x29')]();});}};}function handleEntityNotFound(_0x388e75,_0x545d04){return function(_0x1a907a){if(!_0x1a907a){_0x388e75[_0x0be4('0x1b')](0x194);}return _0x1a907a;};}function handleError(_0xee2514,_0x471b20){_0x471b20=_0x471b20||0x1f4;return function(_0x407999){logger['error'](_0x407999[_0x0be4('0x2a')]);if(_0x407999[_0x0be4('0x2b')]){delete _0x407999['name'];}_0xee2514[_0x0be4('0x1c')](_0x471b20)[_0x0be4('0x2c')](_0x407999);};}exports['index']=function(_0x219bc7,_0x44d12c){var _0x55e045={},_0x2e7909={},_0x43c9c5={'count':0x0,'rows':[]};var _0x26ce8d=_[_0x0be4('0x2d')](db[_0x0be4('0x2e')][_0x0be4('0x2f')],function(_0x1c12c3){return{'name':_0x1c12c3['fieldName'],'type':_0x1c12c3['type'][_0x0be4('0x30')]};});_0x2e7909[_0x0be4('0x31')]=_[_0x0be4('0x2d')](_0x26ce8d,_0x0be4('0x2b'));_0x2e7909['query']=_[_0x0be4('0x32')](_0x219bc7['query']);_0x2e7909['filters']=_[_0x0be4('0x33')](_0x2e7909[_0x0be4('0x31')],_0x2e7909[_0x0be4('0x34')]);_0x55e045[_0x0be4('0x35')]=_[_0x0be4('0x33')](_0x2e7909['model'],qs['fields'](_0x219bc7[_0x0be4('0x34')][_0x0be4('0x36')]));_0x55e045[_0x0be4('0x35')]=_0x55e045[_0x0be4('0x35')][_0x0be4('0x37')]?_0x55e045[_0x0be4('0x35')]:_0x2e7909[_0x0be4('0x31')];if(!_0x219bc7[_0x0be4('0x34')]['hasOwnProperty']('nolimit')){_0x55e045[_0x0be4('0x20')]=qs['limit'](_0x219bc7[_0x0be4('0x34')][_0x0be4('0x20')]);_0x55e045['offset']=qs[_0x0be4('0x1e')](_0x219bc7[_0x0be4('0x34')]['offset']);}_0x55e045['order']=qs['sort'](_0x219bc7[_0x0be4('0x34')][_0x0be4('0x38')]);_0x55e045['where']=qs[_0x0be4('0x39')](_[_0x0be4('0x3a')](_0x219bc7[_0x0be4('0x34')],_0x2e7909[_0x0be4('0x39')]),_0x26ce8d);if(_0x219bc7['query'][_0x0be4('0x3b')]){_0x55e045[_0x0be4('0x3c')]=_['merge'](_0x55e045[_0x0be4('0x3c')],{'$or':_[_0x0be4('0x2d')](_0x26ce8d,function(_0x260342){if(_0x260342[_0x0be4('0x3d')]!=='VIRTUAL'){var _0x47c7dc={};_0x47c7dc[_0x260342[_0x0be4('0x2b')]]={'$like':'%'+_0x219bc7[_0x0be4('0x34')]['filter']+'%'};return _0x47c7dc;}})});}_0x55e045=_[_0x0be4('0x3e')]({},_0x55e045,_0x219bc7[_0x0be4('0x3f')]);var _0x47ba91={'where':_0x55e045[_0x0be4('0x3c')]};return db[_0x0be4('0x2e')][_0x0be4('0x21')](_0x47ba91)[_0x0be4('0x28')](function(_0x48acb0){_0x43c9c5['count']=_0x48acb0;if(_0x219bc7[_0x0be4('0x34')]['includeAll']){_0x55e045[_0x0be4('0x40')]=[{'all':!![]}];}return db[_0x0be4('0x2e')]['findAll'](_0x55e045);})[_0x0be4('0x28')](function(_0x560d59){_0x43c9c5[_0x0be4('0x41')]=_0x560d59;return _0x43c9c5;})[_0x0be4('0x28')](respondWithFilteredResult(_0x44d12c,_0x55e045))['catch'](handleError(_0x44d12c,null));};exports[_0x0be4('0x42')]=function(_0x1f1481,_0x34f69){var _0x25d976={'raw':!![],'where':{'id':_0x1f1481[_0x0be4('0x43')]['id']}},_0x199c56={};_0x199c56[_0x0be4('0x31')]=_[_0x0be4('0x32')](db['ServicenowField'][_0x0be4('0x2f')]);_0x199c56[_0x0be4('0x34')]=_['keys'](_0x1f1481[_0x0be4('0x34')]);_0x199c56[_0x0be4('0x39')]=_[_0x0be4('0x33')](_0x199c56[_0x0be4('0x31')],_0x199c56[_0x0be4('0x34')]);_0x25d976['attributes']=_[_0x0be4('0x33')](_0x199c56['model'],qs[_0x0be4('0x36')](_0x1f1481[_0x0be4('0x34')][_0x0be4('0x36')]));_0x25d976[_0x0be4('0x35')]=_0x25d976[_0x0be4('0x35')][_0x0be4('0x37')]?_0x25d976['attributes']:_0x199c56[_0x0be4('0x31')];if(_0x1f1481['query'][_0x0be4('0x44')]){_0x25d976[_0x0be4('0x40')]=[{'all':!![]}];}_0x25d976=_['merge']({},_0x25d976,_0x1f1481[_0x0be4('0x3f')]);return db[_0x0be4('0x2e')][_0x0be4('0x45')](_0x25d976)[_0x0be4('0x28')](handleEntityNotFound(_0x34f69,null))['then'](respondWithResult(_0x34f69,null))[_0x0be4('0x46')](handleError(_0x34f69,null));};exports[_0x0be4('0x47')]=function(_0x2bc6dd,_0x61b8ed){return db[_0x0be4('0x2e')][_0x0be4('0x47')](_0x2bc6dd[_0x0be4('0x48')],{})[_0x0be4('0x28')](respondWithResult(_0x61b8ed,0xc9))[_0x0be4('0x46')](handleError(_0x61b8ed,null));};exports[_0x0be4('0x26')]=function(_0xe06ef5,_0x9709c4){if(_0xe06ef5[_0x0be4('0x48')]['id']){delete _0xe06ef5[_0x0be4('0x48')]['id'];}return db['ServicenowField'][_0x0be4('0x45')]({'where':{'id':_0xe06ef5[_0x0be4('0x43')]['id']}})[_0x0be4('0x28')](handleEntityNotFound(_0x9709c4,null))[_0x0be4('0x28')](saveUpdates(_0xe06ef5['body'],null))[_0x0be4('0x28')](respondWithResult(_0x9709c4,null))[_0x0be4('0x46')](handleError(_0x9709c4,null));};exports[_0x0be4('0x27')]=function(_0x52e3cd,_0x44126d){return db[_0x0be4('0x2e')][_0x0be4('0x45')]({'where':{'id':_0x52e3cd[_0x0be4('0x43')]['id']}})[_0x0be4('0x28')](handleEntityNotFound(_0x44126d,null))['then'](removeEntity(_0x44126d,null))['catch'](handleError(_0x44126d,null));}; \ No newline at end of file +var _0xdad6=['rows','catch','show','params','keys','options','find','create','body','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','end','error','stack','name','send','map','ServicenowField','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll'];(function(_0x20ca12,_0x137790){var _0x432fc8=function(_0x16fd10){while(--_0x16fd10){_0x20ca12['push'](_0x20ca12['shift']());}};_0x432fc8(++_0x137790);}(_0xdad6,0x1b3));var _0x6dad=function(_0x4ac5be,_0x3aa7f1){_0x4ac5be=_0x4ac5be-0x0;var _0x3b3187=_0xdad6[_0x4ac5be];return _0x3b3187;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6dad('0x0'));var zipdir=require(_0x6dad('0x1'));var jsonpatch=require(_0x6dad('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6dad('0x3'));var Mustache=require(_0x6dad('0x4'));var util=require(_0x6dad('0x5'));var path=require('path');var sox=require(_0x6dad('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6dad('0x7'));var _=require(_0x6dad('0x8'));var squel=require(_0x6dad('0x9'));var crypto=require('crypto');var jsforce=require(_0x6dad('0xa'));var deskjs=require(_0x6dad('0xb'));var toCsv=require(_0x6dad('0xc'));var querystring=require('querystring');var Papa=require(_0x6dad('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6dad('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6dad('0xf'));var logger=require(_0x6dad('0x10'))(_0x6dad('0x11'));var utils=require(_0x6dad('0x12'));var config=require(_0x6dad('0x13'));var licenseUtil=require(_0x6dad('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5b5fa7,_0x977ce1){_0x977ce1=_0x977ce1||0xcc;return function(_0x25604e){if(_0x25604e){return _0x5b5fa7[_0x6dad('0x15')](_0x977ce1);}return _0x5b5fa7[_0x6dad('0x16')](_0x977ce1)['end']();};}function respondWithResult(_0x54bfec,_0x50a783){_0x50a783=_0x50a783||0xc8;return function(_0x293573){if(_0x293573){return _0x54bfec[_0x6dad('0x16')](_0x50a783)[_0x6dad('0x17')](_0x293573);}};}function respondWithFilteredResult(_0x586236,_0x5acf49){return function(_0x2ba831){if(_0x2ba831){var _0x5d76d8=typeof _0x5acf49['offset']===_0x6dad('0x18')&&typeof _0x5acf49['limit']===_0x6dad('0x18');var _0x4e8475=_0x2ba831[_0x6dad('0x19')];var _0x461ecd=_0x5d76d8?0x0:_0x5acf49[_0x6dad('0x1a')];var _0x3ec802=_0x5d76d8?_0x2ba831[_0x6dad('0x19')]:_0x5acf49[_0x6dad('0x1a')]+_0x5acf49[_0x6dad('0x1b')];var _0x25abea;if(_0x3ec802>=_0x4e8475){_0x3ec802=_0x4e8475;_0x25abea=0xc8;}else{_0x25abea=0xce;}_0x586236[_0x6dad('0x16')](_0x25abea);return _0x586236[_0x6dad('0x1c')](_0x6dad('0x1d'),_0x461ecd+'-'+_0x3ec802+'/'+_0x4e8475)[_0x6dad('0x17')](_0x2ba831);}return null;};}function patchUpdates(_0x32cce6){return function(_0xfe1d80){try{jsonpatch[_0x6dad('0x1e')](_0xfe1d80,_0x32cce6,!![]);}catch(_0x41befb){return BPromise['reject'](_0x41befb);}return _0xfe1d80[_0x6dad('0x1f')]();};}function saveUpdates(_0x510df5,_0x548189){return function(_0x182b01){if(_0x182b01){return _0x182b01[_0x6dad('0x20')](_0x510df5)[_0x6dad('0x21')](function(_0x35c02b){return _0x35c02b;});}return null;};}function removeEntity(_0x5a996f,_0xf712a6){return function(_0x167259){if(_0x167259){return _0x167259[_0x6dad('0x22')]()[_0x6dad('0x21')](function(){_0x5a996f['status'](0xcc)[_0x6dad('0x23')]();});}};}function handleEntityNotFound(_0x27c338,_0x331254){return function(_0x327489){if(!_0x327489){_0x27c338[_0x6dad('0x15')](0x194);}return _0x327489;};}function handleError(_0x536e91,_0x3f3261){_0x3f3261=_0x3f3261||0x1f4;return function(_0x5607a1){logger[_0x6dad('0x24')](_0x5607a1[_0x6dad('0x25')]);if(_0x5607a1[_0x6dad('0x26')]){delete _0x5607a1[_0x6dad('0x26')];}_0x536e91[_0x6dad('0x16')](_0x3f3261)[_0x6dad('0x27')](_0x5607a1);};}exports['index']=function(_0x59b746,_0x2d96f0){var _0x400af4={},_0x37fcdb={},_0x49f4ad={'count':0x0,'rows':[]};var _0x403071=_[_0x6dad('0x28')](db[_0x6dad('0x29')][_0x6dad('0x2a')],function(_0x2d2cd8){return{'name':_0x2d2cd8[_0x6dad('0x2b')],'type':_0x2d2cd8[_0x6dad('0x2c')]['key']};});_0x37fcdb[_0x6dad('0x2d')]=_[_0x6dad('0x28')](_0x403071,_0x6dad('0x26'));_0x37fcdb[_0x6dad('0x2e')]=_['keys'](_0x59b746['query']);_0x37fcdb[_0x6dad('0x2f')]=_[_0x6dad('0x30')](_0x37fcdb[_0x6dad('0x2d')],_0x37fcdb[_0x6dad('0x2e')]);_0x400af4[_0x6dad('0x31')]=_[_0x6dad('0x30')](_0x37fcdb[_0x6dad('0x2d')],qs[_0x6dad('0x32')](_0x59b746[_0x6dad('0x2e')]['fields']));_0x400af4[_0x6dad('0x31')]=_0x400af4[_0x6dad('0x31')][_0x6dad('0x33')]?_0x400af4[_0x6dad('0x31')]:_0x37fcdb[_0x6dad('0x2d')];if(!_0x59b746[_0x6dad('0x2e')][_0x6dad('0x34')]('nolimit')){_0x400af4[_0x6dad('0x1b')]=qs[_0x6dad('0x1b')](_0x59b746[_0x6dad('0x2e')][_0x6dad('0x1b')]);_0x400af4['offset']=qs[_0x6dad('0x1a')](_0x59b746['query'][_0x6dad('0x1a')]);}_0x400af4['order']=qs[_0x6dad('0x35')](_0x59b746['query']['sort']);_0x400af4[_0x6dad('0x36')]=qs[_0x6dad('0x2f')](_[_0x6dad('0x37')](_0x59b746[_0x6dad('0x2e')],_0x37fcdb[_0x6dad('0x2f')]),_0x403071);if(_0x59b746[_0x6dad('0x2e')][_0x6dad('0x38')]){_0x400af4[_0x6dad('0x36')]=_[_0x6dad('0x39')](_0x400af4['where'],{'$or':_[_0x6dad('0x28')](_0x403071,function(_0xf53414){if(_0xf53414[_0x6dad('0x2c')]!==_0x6dad('0x3a')){var _0x123208={};_0x123208[_0xf53414[_0x6dad('0x26')]]={'$like':'%'+_0x59b746[_0x6dad('0x2e')][_0x6dad('0x38')]+'%'};return _0x123208;}})});}_0x400af4=_[_0x6dad('0x39')]({},_0x400af4,_0x59b746['options']);var _0x27bf5d={'where':_0x400af4[_0x6dad('0x36')]};return db[_0x6dad('0x29')][_0x6dad('0x19')](_0x27bf5d)[_0x6dad('0x21')](function(_0x43ff4b){_0x49f4ad[_0x6dad('0x19')]=_0x43ff4b;if(_0x59b746[_0x6dad('0x2e')][_0x6dad('0x3b')]){_0x400af4[_0x6dad('0x3c')]=[{'all':!![]}];}return db[_0x6dad('0x29')][_0x6dad('0x3d')](_0x400af4);})[_0x6dad('0x21')](function(_0x1746ae){_0x49f4ad[_0x6dad('0x3e')]=_0x1746ae;return _0x49f4ad;})[_0x6dad('0x21')](respondWithFilteredResult(_0x2d96f0,_0x400af4))[_0x6dad('0x3f')](handleError(_0x2d96f0,null));};exports[_0x6dad('0x40')]=function(_0x3324c0,_0x30eb9a){var _0x1451c5={'raw':!![],'where':{'id':_0x3324c0[_0x6dad('0x41')]['id']}},_0x454334={};_0x454334['model']=_[_0x6dad('0x42')](db[_0x6dad('0x29')][_0x6dad('0x2a')]);_0x454334['query']=_['keys'](_0x3324c0[_0x6dad('0x2e')]);_0x454334[_0x6dad('0x2f')]=_[_0x6dad('0x30')](_0x454334[_0x6dad('0x2d')],_0x454334[_0x6dad('0x2e')]);_0x1451c5['attributes']=_['intersection'](_0x454334[_0x6dad('0x2d')],qs[_0x6dad('0x32')](_0x3324c0['query']['fields']));_0x1451c5[_0x6dad('0x31')]=_0x1451c5[_0x6dad('0x31')][_0x6dad('0x33')]?_0x1451c5[_0x6dad('0x31')]:_0x454334['model'];if(_0x3324c0[_0x6dad('0x2e')][_0x6dad('0x3b')]){_0x1451c5['include']=[{'all':!![]}];}_0x1451c5=_[_0x6dad('0x39')]({},_0x1451c5,_0x3324c0[_0x6dad('0x43')]);return db[_0x6dad('0x29')][_0x6dad('0x44')](_0x1451c5)[_0x6dad('0x21')](handleEntityNotFound(_0x30eb9a,null))[_0x6dad('0x21')](respondWithResult(_0x30eb9a,null))[_0x6dad('0x3f')](handleError(_0x30eb9a,null));};exports[_0x6dad('0x45')]=function(_0x6cfb0e,_0x5c462e){return db[_0x6dad('0x29')][_0x6dad('0x45')](_0x6cfb0e['body'],{})[_0x6dad('0x21')](respondWithResult(_0x5c462e,0xc9))[_0x6dad('0x3f')](handleError(_0x5c462e,null));};exports[_0x6dad('0x20')]=function(_0x5c8b5b,_0x43cc6f){if(_0x5c8b5b[_0x6dad('0x46')]['id']){delete _0x5c8b5b[_0x6dad('0x46')]['id'];}return db[_0x6dad('0x29')]['find']({'where':{'id':_0x5c8b5b[_0x6dad('0x41')]['id']}})[_0x6dad('0x21')](handleEntityNotFound(_0x43cc6f,null))[_0x6dad('0x21')](saveUpdates(_0x5c8b5b[_0x6dad('0x46')],null))[_0x6dad('0x21')](respondWithResult(_0x43cc6f,null))[_0x6dad('0x3f')](handleError(_0x43cc6f,null));};exports[_0x6dad('0x22')]=function(_0x2d7b4e,_0x5e8e98){return db[_0x6dad('0x29')]['find']({'where':{'id':_0x2d7b4e[_0x6dad('0x41')]['id']}})[_0x6dad('0x21')](handleEntityNotFound(_0x5e8e98,null))['then'](removeEntity(_0x5e8e98,null))['catch'](handleError(_0x5e8e98,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 65c17fe..df394a6 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 _0x8542=['path','rimraf','ServicenowField','int_servicenow_fields','servicenow_unique_index','moment','bluebird'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x8542,0x67));var _0x2854=function(_0x513cd4,_0x471276){_0x513cd4=_0x513cd4-0x0;var _0x3e3f8a=_0x8542[_0x513cd4];return _0x3e3f8a;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x2854('0x0'));var BPromise=require(_0x2854('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2854('0x2'));var rimraf=require(_0x2854('0x3'));var config=require('../../config/environment');var attributes=require('./intServicenowField.attributes');module['exports']=function(_0x36bfdb,_0x3722ee){return _0x36bfdb['define'](_0x2854('0x4'),attributes,{'tableName':_0x2854('0x5'),'paranoid':![],'indexes':[{'name':_0x2854('0x6'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6f22=['ServicenowField','int_servicenow_fields','servicenow_unique_index','FieldId','lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x381379,_0x3f3b86){var _0x3e1063=function(_0x4c282d){while(--_0x4c282d){_0x381379['push'](_0x381379['shift']());}};_0x3e1063(++_0x3f3b86);}(_0x6f22,0x88));var _0x26f2=function(_0x2bc0f5,_0x44f336){_0x2bc0f5=_0x2bc0f5-0x0;var _0x42c6ac=_0x6f22[_0x2bc0f5];return _0x42c6ac;};'use strict';var _=require(_0x26f2('0x0'));var util=require('util');var logger=require(_0x26f2('0x1'))('api');var moment=require(_0x26f2('0x2'));var BPromise=require('bluebird');var rp=require(_0x26f2('0x3'));var fs=require('fs');var path=require(_0x26f2('0x4'));var rimraf=require(_0x26f2('0x5'));var config=require(_0x26f2('0x6'));var attributes=require('./intServicenowField.attributes');module[_0x26f2('0x7')]=function(_0x30cf73,_0x28c480){return _0x30cf73['define'](_0x26f2('0x8'),attributes,{'tableName':_0x26f2('0x9'),'paranoid':![],'indexes':[{'name':_0x26f2('0xa'),'fields':['idField',_0x26f2('0xb')],'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 b87d2ed..0449420 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 _0xbdb7=['request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','info','ServicenowField,\x20%s,\x20%s'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x45870a,_0x5c6ff0){_0x45870a=_0x45870a-0x0;var _0x4ec553=_0xbdb7[_0x45870a];return _0x4ec553;};'use strict';var _=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var moment=require(_0x7bdb('0x2'));var BPromise=require(_0x7bdb('0x3'));var rs=require(_0x7bdb('0x4'));var fs=require('fs');var Redis=require(_0x7bdb('0x5'));var db=require(_0x7bdb('0x6'))['db'];var utils=require(_0x7bdb('0x7'));var logger=require(_0x7bdb('0x8'))('rpc');var config=require(_0x7bdb('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7bdb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e23a3,_0x493bde,_0x513cba){return new BPromise(function(_0x468041,_0x11a877){return client['request'](_0x1e23a3,_0x513cba)['then'](function(_0xdc2ffc){logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));logger[_0x7bdb('0xe')](_0x7bdb('0xf'),_0x493bde,_0x7bdb('0xd'),JSON[_0x7bdb('0x10')](_0xdc2ffc));if(_0xdc2ffc['error']){if(_0xdc2ffc['error']['code']===0x1f4){logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error'][_0x7bdb('0x12')]);return _0x11a877(_0xdc2ffc['error']['message']);}logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error']['message']);return _0x468041(_0xdc2ffc['error'][_0x7bdb('0x12')]);}else{logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));_0x468041(_0xdc2ffc[_0x7bdb('0x13')][_0x7bdb('0x12')]);}})[_0x7bdb('0x14')](function(_0x1b2d9b){logger['error'](_0x7bdb('0xc'),_0x493bde,_0x1b2d9b);_0x11a877(_0x1b2d9b);});});} \ No newline at end of file +var _0xd8b0=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 4ee77d8..482a441 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(_0x407de2,_0x8e72e7){var _0xa4cedc=function(_0x2a0ffe){while(--_0x2a0ffe){_0x407de2['push'](_0x407de2['shift']());}};_0xa4cedc(++_0x8e72e7);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x2360f1,_0x1f83f6){var _0x4ea891=function(_0xf53bb1){while(--_0xf53bb1){_0x2360f1['push'](_0x2360f1['shift']());}};_0x4ea891(++_0x1f83f6);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 700f6a1..9207437 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(_0x190c4f,_0x5ce70e){var _0x2054cc=function(_0x4bde93){while(--_0x4bde93){_0x190c4f['push'](_0x190c4f['shift']());}};_0x2054cc(++_0x5ce70e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'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(_0x295b14,_0x2f9605){var _0x22d74b=function(_0x1f6be3){while(--_0x1f6be3){_0x295b14['push'](_0x295b14['shift']());}};_0x22d74b(++_0x2f9605);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'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 424a434..ddf930a 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 _0xd9db=['username','password','remoteUri','slice','lastIndexOf','POST','%s%s','/service/v4_1/rest.php','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Password\x20Expired','format','get_module_fields','Calls','values','module_fields','remove','includes','endsWith','value','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','eml-format','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','limit','set','reject','save','update','then','destroy','stack','name','send','index','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filter','merge','map','options','SugarcrmAccount','rows','params','includeAll','include','find','catch','create','body','getConfigurations','findOne','SugarcrmConfiguration','nolimit','addConfiguration','AccountId','channel','Descriptions','getDescriptions','SugarcrmField','Subjects','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_name'];(function(_0x15b380,_0x1a3c5f){var _0x232c5c=function(_0x12f8e0){while(--_0x12f8e0){_0x15b380['push'](_0x15b380['shift']());}};_0x232c5c(++_0x1a3c5f);}(_0xd9db,0x1ec));var _0xbd9d=function(_0x4aaa68,_0x1adf58){_0x4aaa68=_0x4aaa68-0x0;var _0xf628dc=_0xd9db[_0x4aaa68];return _0xf628dc;};'use strict';var emlformat=require(_0xbd9d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xbd9d('0x1'));var rp=require('request-promise');var moment=require(_0xbd9d('0x2'));var BPromise=require(_0xbd9d('0x3'));var Mustache=require(_0xbd9d('0x4'));var util=require('util');var path=require(_0xbd9d('0x5'));var sox=require(_0xbd9d('0x6'));var csv=require(_0xbd9d('0x7'));var ejs=require(_0xbd9d('0x8'));var fs=require('fs');var fs_extra=require(_0xbd9d('0x9'));var _=require(_0xbd9d('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xbd9d('0xb'));var deskjs=require(_0xbd9d('0xc'));var toCsv=require('to-csv');var querystring=require(_0xbd9d('0xd'));var Papa=require(_0xbd9d('0xe'));var Redis=require(_0xbd9d('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xbd9d('0x10'));var as=require(_0xbd9d('0x11'));var hardwareService=require(_0xbd9d('0x12'));var logger=require(_0xbd9d('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xbd9d('0x14'));var db=require(_0xbd9d('0x15'))['db'];var integrations=require(_0xbd9d('0x16'));function respondWithStatusCode(_0x555d65,_0x3d5418){_0x3d5418=_0x3d5418||0xcc;return function(_0x501516){if(_0x501516){return _0x555d65[_0xbd9d('0x17')](_0x3d5418);}return _0x555d65[_0xbd9d('0x18')](_0x3d5418)[_0xbd9d('0x19')]();};}function respondWithResult(_0x4f16f0,_0x570134){_0x570134=_0x570134||0xc8;return function(_0x2a3cef){if(_0x2a3cef){return _0x4f16f0[_0xbd9d('0x18')](_0x570134)[_0xbd9d('0x1a')](_0x2a3cef);}};}function respondWithFilteredResult(_0x203d5e,_0x2d50ae){return function(_0x13cfa6){if(_0x13cfa6){var _0x31bc30=typeof _0x2d50ae[_0xbd9d('0x1b')]===_0xbd9d('0x1c')&&typeof _0x2d50ae['limit']==='undefined';var _0x128e5e=_0x13cfa6[_0xbd9d('0x1d')];var _0x24076d=_0x31bc30?0x0:_0x2d50ae['offset'];var _0x6eb59a=_0x31bc30?_0x13cfa6['count']:_0x2d50ae[_0xbd9d('0x1b')]+_0x2d50ae[_0xbd9d('0x1e')];var _0x21adba;if(_0x6eb59a>=_0x128e5e){_0x6eb59a=_0x128e5e;_0x21adba=0xc8;}else{_0x21adba=0xce;}_0x203d5e['status'](_0x21adba);return _0x203d5e[_0xbd9d('0x1f')]('Content-Range',_0x24076d+'-'+_0x6eb59a+'/'+_0x128e5e)['json'](_0x13cfa6);}return null;};}function patchUpdates(_0x43550f){return function(_0xc9d4c){try{jsonpatch['apply'](_0xc9d4c,_0x43550f,!![]);}catch(_0x3f3623){return BPromise[_0xbd9d('0x20')](_0x3f3623);}return _0xc9d4c[_0xbd9d('0x21')]();};}function saveUpdates(_0x3d2b0d,_0x43245b){return function(_0xfe38af){if(_0xfe38af){return _0xfe38af[_0xbd9d('0x22')](_0x3d2b0d)[_0xbd9d('0x23')](function(_0x4d0aa7){return _0x4d0aa7;});}return null;};}function removeEntity(_0x17b81e,_0x2d6c07){return function(_0x54ad1a){if(_0x54ad1a){return _0x54ad1a[_0xbd9d('0x24')]()[_0xbd9d('0x23')](function(){_0x17b81e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x29ace8,_0x253946){return function(_0x484d03){if(!_0x484d03){_0x29ace8[_0xbd9d('0x17')](0x194);}return _0x484d03;};}function handleError(_0x17fdbc,_0x12b21a){_0x12b21a=_0x12b21a||0x1f4;return function(_0xd1607){logger['error'](_0xd1607[_0xbd9d('0x25')]);if(_0xd1607[_0xbd9d('0x26')]){delete _0xd1607['name'];}_0x17fdbc[_0xbd9d('0x18')](_0x12b21a)[_0xbd9d('0x27')](_0xd1607);};}exports[_0xbd9d('0x28')]=function(_0x2fd6de,_0x2e934d){var _0x98c7cc={},_0x41170c={},_0x112323={'count':0x0,'rows':[]};var _0x1a2a38=_['map'](db['SugarcrmAccount'][_0xbd9d('0x29')],function(_0x3a56e2){return{'name':_0x3a56e2[_0xbd9d('0x2a')],'type':_0x3a56e2['type'][_0xbd9d('0x2b')]};});_0x41170c[_0xbd9d('0x2c')]=_['map'](_0x1a2a38,_0xbd9d('0x26'));_0x41170c[_0xbd9d('0x2d')]=_[_0xbd9d('0x2e')](_0x2fd6de['query']);_0x41170c[_0xbd9d('0x2f')]=_[_0xbd9d('0x30')](_0x41170c[_0xbd9d('0x2c')],_0x41170c['query']);_0x98c7cc['attributes']=_[_0xbd9d('0x30')](_0x41170c[_0xbd9d('0x2c')],qs[_0xbd9d('0x31')](_0x2fd6de[_0xbd9d('0x2d')][_0xbd9d('0x31')]));_0x98c7cc['attributes']=_0x98c7cc[_0xbd9d('0x32')][_0xbd9d('0x33')]?_0x98c7cc[_0xbd9d('0x32')]:_0x41170c[_0xbd9d('0x2c')];if(!_0x2fd6de[_0xbd9d('0x2d')][_0xbd9d('0x34')]('nolimit')){_0x98c7cc[_0xbd9d('0x1e')]=qs[_0xbd9d('0x1e')](_0x2fd6de[_0xbd9d('0x2d')]['limit']);_0x98c7cc[_0xbd9d('0x1b')]=qs[_0xbd9d('0x1b')](_0x2fd6de['query'][_0xbd9d('0x1b')]);}_0x98c7cc[_0xbd9d('0x35')]=qs[_0xbd9d('0x36')](_0x2fd6de[_0xbd9d('0x2d')]['sort']);_0x98c7cc[_0xbd9d('0x37')]=qs[_0xbd9d('0x2f')](_['pick'](_0x2fd6de[_0xbd9d('0x2d')],_0x41170c[_0xbd9d('0x2f')]),_0x1a2a38);if(_0x2fd6de['query'][_0xbd9d('0x38')]){_0x98c7cc[_0xbd9d('0x37')]=_[_0xbd9d('0x39')](_0x98c7cc['where'],{'$or':_[_0xbd9d('0x3a')](_0x1a2a38,function(_0x38c9c6){if(_0x38c9c6['type']!=='VIRTUAL'){var _0xb9c039={};_0xb9c039[_0x38c9c6['name']]={'$like':'%'+_0x2fd6de[_0xbd9d('0x2d')][_0xbd9d('0x38')]+'%'};return _0xb9c039;}})});}_0x98c7cc=_[_0xbd9d('0x39')]({},_0x98c7cc,_0x2fd6de[_0xbd9d('0x3b')]);var _0x879f50={'where':_0x98c7cc[_0xbd9d('0x37')]};return db[_0xbd9d('0x3c')][_0xbd9d('0x1d')](_0x879f50)[_0xbd9d('0x23')](function(_0x1331c3){_0x112323[_0xbd9d('0x1d')]=_0x1331c3;if(_0x2fd6de[_0xbd9d('0x2d')]['includeAll']){_0x98c7cc['include']=[{'all':!![]}];}return db[_0xbd9d('0x3c')]['findAll'](_0x98c7cc);})[_0xbd9d('0x23')](function(_0x1b9c55){_0x112323[_0xbd9d('0x3d')]=_0x1b9c55;return _0x112323;})['then'](respondWithFilteredResult(_0x2e934d,_0x98c7cc))['catch'](handleError(_0x2e934d,null));};exports['show']=function(_0x140683,_0x3193a7){var _0x5a1556={'raw':![],'where':{'id':_0x140683[_0xbd9d('0x3e')]['id']}},_0x4afd79={};_0x4afd79[_0xbd9d('0x2c')]=_['keys'](db['SugarcrmAccount'][_0xbd9d('0x29')]);_0x4afd79['query']=_['keys'](_0x140683[_0xbd9d('0x2d')]);_0x4afd79[_0xbd9d('0x2f')]=_['intersection'](_0x4afd79[_0xbd9d('0x2c')],_0x4afd79['query']);_0x5a1556[_0xbd9d('0x32')]=_['intersection'](_0x4afd79[_0xbd9d('0x2c')],qs[_0xbd9d('0x31')](_0x140683[_0xbd9d('0x2d')][_0xbd9d('0x31')]));_0x5a1556[_0xbd9d('0x32')]=_0x5a1556['attributes']['length']?_0x5a1556[_0xbd9d('0x32')]:_0x4afd79[_0xbd9d('0x2c')];if(_0x140683[_0xbd9d('0x2d')][_0xbd9d('0x3f')]){_0x5a1556[_0xbd9d('0x40')]=[{'all':!![]}];}_0x5a1556=_[_0xbd9d('0x39')]({},_0x5a1556,_0x140683['options']);return db['SugarcrmAccount'][_0xbd9d('0x41')](_0x5a1556)['then'](handleEntityNotFound(_0x3193a7,null))[_0xbd9d('0x23')](respondWithResult(_0x3193a7,null))[_0xbd9d('0x42')](handleError(_0x3193a7,null));};exports[_0xbd9d('0x43')]=function(_0x48f760,_0x1ba7ec){return db[_0xbd9d('0x3c')][_0xbd9d('0x43')](_0x48f760[_0xbd9d('0x44')],{})[_0xbd9d('0x23')](respondWithResult(_0x1ba7ec,0xc9))[_0xbd9d('0x42')](handleError(_0x1ba7ec,null));};exports[_0xbd9d('0x22')]=function(_0x8bd8f5,_0x341b7d){if(_0x8bd8f5['body']['id']){delete _0x8bd8f5['body']['id'];}return db[_0xbd9d('0x3c')][_0xbd9d('0x41')]({'where':{'id':_0x8bd8f5['params']['id']}})[_0xbd9d('0x23')](handleEntityNotFound(_0x341b7d,null))['then'](saveUpdates(_0x8bd8f5['body'],null))[_0xbd9d('0x23')](respondWithResult(_0x341b7d,null))[_0xbd9d('0x42')](handleError(_0x341b7d,null));};exports[_0xbd9d('0x24')]=function(_0x4d8234,_0x2d44f4){return db['SugarcrmAccount'][_0xbd9d('0x41')]({'where':{'id':_0x4d8234['params']['id']}})[_0xbd9d('0x23')](handleEntityNotFound(_0x2d44f4,null))[_0xbd9d('0x23')](removeEntity(_0x2d44f4,null))['catch'](handleError(_0x2d44f4,null));};exports[_0xbd9d('0x45')]=function(_0x2c11c5,_0x3e6d7a,_0x2f2a60){var _0x28a390={};var _0x12bff2={};var _0x5cd149;var _0x88a88e;return db['SugarcrmAccount'][_0xbd9d('0x46')]({'where':{'id':_0x2c11c5[_0xbd9d('0x3e')]['id']}})['then'](handleEntityNotFound(_0x3e6d7a,null))[_0xbd9d('0x23')](function(_0x906dc0){if(_0x906dc0){_0x5cd149=_0x906dc0;_0x12bff2[_0xbd9d('0x2c')]=_['keys'](db[_0xbd9d('0x47')]['rawAttributes']);_0x12bff2['query']=_[_0xbd9d('0x2e')](_0x2c11c5[_0xbd9d('0x2d')]);_0x12bff2[_0xbd9d('0x2f')]=_['intersection'](_0x12bff2['model'],_0x12bff2['query']);_0x28a390[_0xbd9d('0x32')]=_['intersection'](_0x12bff2['model'],qs['fields'](_0x2c11c5[_0xbd9d('0x2d')][_0xbd9d('0x31')]));_0x28a390[_0xbd9d('0x32')]=_0x28a390['attributes']['length']?_0x28a390['attributes']:_0x12bff2[_0xbd9d('0x2c')];_0x28a390[_0xbd9d('0x35')]=qs[_0xbd9d('0x36')](_0x2c11c5[_0xbd9d('0x2d')][_0xbd9d('0x36')]);_0x28a390[_0xbd9d('0x37')]=qs['filters'](_['pick'](_0x2c11c5[_0xbd9d('0x2d')],_0x12bff2[_0xbd9d('0x2f')]));if(_0x2c11c5[_0xbd9d('0x2d')][_0xbd9d('0x38')]){_0x28a390['where']=_['merge'](_0x28a390[_0xbd9d('0x37')],{'$or':_[_0xbd9d('0x3a')](_0x28a390['attributes'],function(_0x587b83){var _0x1acddb={};_0x1acddb[_0x587b83]={'$like':'%'+_0x2c11c5['query'][_0xbd9d('0x38')]+'%'};return _0x1acddb;})});}_0x28a390=_[_0xbd9d('0x39')]({},_0x28a390,_0x2c11c5[_0xbd9d('0x3b')]);return _0x5cd149[_0xbd9d('0x45')](_0x28a390);}})[_0xbd9d('0x23')](function(_0x390cb4){if(_0x390cb4){_0x88a88e=_0x390cb4[_0xbd9d('0x33')];if(!_0x2c11c5[_0xbd9d('0x2d')][_0xbd9d('0x34')](_0xbd9d('0x48'))){_0x28a390[_0xbd9d('0x1e')]=qs[_0xbd9d('0x1e')](_0x2c11c5[_0xbd9d('0x2d')][_0xbd9d('0x1e')]);_0x28a390[_0xbd9d('0x1b')]=qs['offset'](_0x2c11c5[_0xbd9d('0x2d')]['offset']);}return _0x5cd149[_0xbd9d('0x45')](_0x28a390);}})['then'](function(_0x55a2dd){if(_0x55a2dd){return _0x55a2dd?{'count':_0x88a88e,'rows':_0x55a2dd}:null;}})[_0xbd9d('0x23')](respondWithResult(_0x3e6d7a,null))[_0xbd9d('0x42')](handleError(_0x3e6d7a,null));};exports[_0xbd9d('0x49')]=function(_0x1fe92b,_0x1430d1,_0x1c55e4){if(_0x1fe92b[_0xbd9d('0x44')]['id']){delete _0x1fe92b[_0xbd9d('0x44')]['id'];}return db['SugarcrmAccount']['findOne']({'where':{'id':_0x1fe92b[_0xbd9d('0x3e')]['id']}})[_0xbd9d('0x23')](handleEntityNotFound(_0x1430d1,null))[_0xbd9d('0x23')](function(_0x5ce72){if(_0x5ce72){_0x1fe92b[_0xbd9d('0x44')][_0xbd9d('0x4a')]=_0x5ce72['id'];_0x1fe92b[_0xbd9d('0x44')]['Subjects']=integrations['getSubjects'](_0x1fe92b[_0xbd9d('0x44')][_0xbd9d('0x4b')],_0x1fe92b[_0xbd9d('0x44')]['type']);_0x1fe92b[_0xbd9d('0x44')][_0xbd9d('0x4c')]=integrations[_0xbd9d('0x4d')](_0x1fe92b['body']['channel'],_0x1fe92b[_0xbd9d('0x44')]['type']);return db[_0xbd9d('0x47')][_0xbd9d('0x43')](_0x1fe92b[_0xbd9d('0x44')],{'include':[{'model':db[_0xbd9d('0x4e')],'as':_0xbd9d('0x4f')},{'model':db[_0xbd9d('0x4e')],'as':_0xbd9d('0x4c')}]});}return null;})['then'](respondWithResult(_0x1430d1,null))[_0xbd9d('0x42')](handleError(_0x1430d1,null));};exports['getFields']=function(_0x21cbd2,_0x333d1b,_0x33e18c){var _0x4ea4c6='';var _0x50128a=['id',_0xbd9d('0x26'),_0xbd9d('0x50'),_0xbd9d('0x51'),_0xbd9d('0x52'),_0xbd9d('0x53'),_0xbd9d('0x54'),_0xbd9d('0x55'),_0xbd9d('0x56'),'parent_type',_0xbd9d('0x57'),'direction'];return db[_0xbd9d('0x3c')][_0xbd9d('0x46')]({'where':{'id':_0x21cbd2[_0xbd9d('0x3e')]['id']},'attributes':['id',_0xbd9d('0x58'),_0xbd9d('0x59'),_0xbd9d('0x5a')]})['then'](handleEntityNotFound(_0x333d1b,null))[_0xbd9d('0x23')](function(_0x2ccb99){if(_0x2ccb99){_0x4ea4c6=_0x2ccb99['remoteUri'];var _0xe57a91=_0x4ea4c6[_0xbd9d('0x5b')](-0x1);if(_0xe57a91==='/'){_0x4ea4c6=_0x4ea4c6['substring'](0x0,_0x4ea4c6[_0xbd9d('0x5c')](_0xe57a91));}return rp({'method':_0xbd9d('0x5d'),'uri':util['format'](_0xbd9d('0x5e'),_0x4ea4c6,_0xbd9d('0x5f')),'json':!![],'form':{'method':'login','input_type':'JSON','response_type':_0xbd9d('0x60'),'rest_data':JSON[_0xbd9d('0x61')]({'user_auth':{'user_name':_0x2ccb99['username'],'password':_0x2ccb99['password'],'encryption':_0xbd9d('0x62')},'application':_0xbd9d('0x63')})}});}})['then'](function(_0x9bf1b){if(_0x9bf1b&&_0x9bf1b['name']!=='Invalid\x20Login'&&_0x9bf1b[_0xbd9d('0x26')]!==_0xbd9d('0x64')){return rp({'method':'POST','uri':util[_0xbd9d('0x65')](_0xbd9d('0x5e'),_0x4ea4c6,_0xbd9d('0x5f')),'json':!![],'form':{'method':_0xbd9d('0x66'),'input_type':_0xbd9d('0x60'),'response_type':_0xbd9d('0x60'),'rest_data':JSON[_0xbd9d('0x61')]({'session':_0x9bf1b['id'],'module_name':_0xbd9d('0x67')})}})[_0xbd9d('0x23')](function(_0x319ac5){if(_0x319ac5){var _0x56058f=_[_0xbd9d('0x68')](_0x319ac5[_0xbd9d('0x69')]);_[_0xbd9d('0x6a')](_0x56058f,function(_0x20e449){return _0x50128a[_0xbd9d('0x6b')](_0x20e449[_0xbd9d('0x26')]);});return{'count':_0x56058f[_0xbd9d('0x33')],'rows':_['map'](_0x56058f,function(_0x55219e){return{'id':_0x55219e[_0xbd9d('0x26')],'name':_0x55219e['label'],'custom':_[_0xbd9d('0x6c')](_0x55219e[_0xbd9d('0x26')],'_c')?!![]:![],'options':_0x55219e[_0xbd9d('0x3b')]?_['map'](_[_0xbd9d('0x68')](_0x55219e[_0xbd9d('0x3b')]),function(_0x3827fc){return{'name':_0x3827fc[_0xbd9d('0x6d')],'value':_0x3827fc[_0xbd9d('0x26')]};}):[]};})};}})[_0xbd9d('0x23')](respondWithResult(_0x333d1b,null))[_0xbd9d('0x42')](function(_0x320bee){var _0x38dce5=_0x21cbd2[_0xbd9d('0x2d')][_0xbd9d('0x6e')]?0x1f4:_0x320bee[_0xbd9d('0x6f')]||0x1f4;logger[_0xbd9d('0x70')](_0xbd9d('0x71'),_0xbd9d('0x72'),_0x38dce5,JSON['stringify'](_0x320bee));delete _0x320bee[_0xbd9d('0x26')];if(_0x38dce5===0x191){_0x38dce5=0x190;}_0x333d1b[_0xbd9d('0x18')](_0x38dce5)['send'](_0x21cbd2['query'][_0xbd9d('0x6e')]?{'message':'Wrong\x20credentials','statusCode':_0x320bee['statusCode']}:_0x320bee);});}else{var _0x5436dc=0x1f4;_0x333d1b[_0xbd9d('0x18')](_0x5436dc)[_0xbd9d('0x27')]({'message':_0xbd9d('0x73'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x5ad0=['get_module_fields','stringify','Calls','values','module_fields','remove','includes','label','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','count','offset','limit','set','apply','save','then','destroy','error','stack','name','index','map','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','pick','filters','filter','merge','type','VIRTUAL','SugarcrmAccount','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','create','body','update','getConfigurations','findOne','order','sort','addConfiguration','AccountId','Subjects','getSubjects','getDescriptions','Descriptions','getFields','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_name','direction','username','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','password','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login'];(function(_0x6925fa,_0x4e6100){var _0x56d211=function(_0x59fe6d){while(--_0x59fe6d){_0x6925fa['push'](_0x6925fa['shift']());}};_0x56d211(++_0x4e6100);}(_0x5ad0,0x180));var _0x05ad=function(_0x73cc50,_0xad8fea){_0x73cc50=_0x73cc50-0x0;var _0x56859f=_0x5ad0[_0x73cc50];return _0x56859f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x05ad('0x0'));var zipdir=require(_0x05ad('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x05ad('0x2'));var moment=require(_0x05ad('0x3'));var BPromise=require(_0x05ad('0x4'));var Mustache=require(_0x05ad('0x5'));var util=require(_0x05ad('0x6'));var path=require(_0x05ad('0x7'));var sox=require('sox');var csv=require(_0x05ad('0x8'));var ejs=require(_0x05ad('0x9'));var fs=require('fs');var fs_extra=require(_0x05ad('0xa'));var _=require(_0x05ad('0xb'));var squel=require(_0x05ad('0xc'));var crypto=require(_0x05ad('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x05ad('0xe'));var toCsv=require(_0x05ad('0x8'));var querystring=require(_0x05ad('0xf'));var Papa=require(_0x05ad('0x10'));var Redis=require(_0x05ad('0x11'));var authService=require(_0x05ad('0x12'));var qs=require(_0x05ad('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x05ad('0x14'));var logger=require(_0x05ad('0x15'))(_0x05ad('0x16'));var utils=require(_0x05ad('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x05ad('0x18'));var db=require(_0x05ad('0x19'))['db'];var integrations=require(_0x05ad('0x1a'));function respondWithStatusCode(_0xf53f0d,_0x1d176c){_0x1d176c=_0x1d176c||0xcc;return function(_0x43981b){if(_0x43981b){return _0xf53f0d[_0x05ad('0x1b')](_0x1d176c);}return _0xf53f0d[_0x05ad('0x1c')](_0x1d176c)[_0x05ad('0x1d')]();};}function respondWithResult(_0x1dc69e,_0x1b233f){_0x1b233f=_0x1b233f||0xc8;return function(_0x1b0335){if(_0x1b0335){return _0x1dc69e[_0x05ad('0x1c')](_0x1b233f)[_0x05ad('0x1e')](_0x1b0335);}};}function respondWithFilteredResult(_0x217fb6,_0x4c0fd8){return function(_0x20adfa){if(_0x20adfa){var _0x312493=typeof _0x4c0fd8['offset']===_0x05ad('0x1f')&&typeof _0x4c0fd8['limit']===_0x05ad('0x1f');var _0x46f97c=_0x20adfa[_0x05ad('0x20')];var _0x539203=_0x312493?0x0:_0x4c0fd8[_0x05ad('0x21')];var _0x2d820f=_0x312493?_0x20adfa[_0x05ad('0x20')]:_0x4c0fd8[_0x05ad('0x21')]+_0x4c0fd8[_0x05ad('0x22')];var _0x20d204;if(_0x2d820f>=_0x46f97c){_0x2d820f=_0x46f97c;_0x20d204=0xc8;}else{_0x20d204=0xce;}_0x217fb6[_0x05ad('0x1c')](_0x20d204);return _0x217fb6[_0x05ad('0x23')]('Content-Range',_0x539203+'-'+_0x2d820f+'/'+_0x46f97c)[_0x05ad('0x1e')](_0x20adfa);}return null;};}function patchUpdates(_0x236ab8){return function(_0x550534){try{jsonpatch[_0x05ad('0x24')](_0x550534,_0x236ab8,!![]);}catch(_0x231a2f){return BPromise['reject'](_0x231a2f);}return _0x550534[_0x05ad('0x25')]();};}function saveUpdates(_0x67b7c4,_0xfc86d4){return function(_0x3baf30){if(_0x3baf30){return _0x3baf30['update'](_0x67b7c4)[_0x05ad('0x26')](function(_0x56be3d){return _0x56be3d;});}return null;};}function removeEntity(_0x449b0f,_0x5a4806){return function(_0x4fdbc1){if(_0x4fdbc1){return _0x4fdbc1[_0x05ad('0x27')]()[_0x05ad('0x26')](function(){_0x449b0f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c5fd1,_0x5ebfd9){return function(_0x97ea61){if(!_0x97ea61){_0x5c5fd1[_0x05ad('0x1b')](0x194);}return _0x97ea61;};}function handleError(_0x52a10a,_0xa76b7){_0xa76b7=_0xa76b7||0x1f4;return function(_0x52fa0a){logger[_0x05ad('0x28')](_0x52fa0a[_0x05ad('0x29')]);if(_0x52fa0a[_0x05ad('0x2a')]){delete _0x52fa0a['name'];}_0x52a10a['status'](_0xa76b7)['send'](_0x52fa0a);};}exports[_0x05ad('0x2b')]=function(_0x22b071,_0x5b653c){var _0x1d769c={},_0x11ee81={},_0x577d01={'count':0x0,'rows':[]};var _0x5b5ff7=_[_0x05ad('0x2c')](db['SugarcrmAccount']['rawAttributes'],function(_0x29b021){return{'name':_0x29b021[_0x05ad('0x2d')],'type':_0x29b021['type'][_0x05ad('0x2e')]};});_0x11ee81[_0x05ad('0x2f')]=_[_0x05ad('0x2c')](_0x5b5ff7,_0x05ad('0x2a'));_0x11ee81[_0x05ad('0x30')]=_[_0x05ad('0x31')](_0x22b071[_0x05ad('0x30')]);_0x11ee81['filters']=_[_0x05ad('0x32')](_0x11ee81['model'],_0x11ee81['query']);_0x1d769c[_0x05ad('0x33')]=_[_0x05ad('0x32')](_0x11ee81['model'],qs['fields'](_0x22b071[_0x05ad('0x30')][_0x05ad('0x34')]));_0x1d769c['attributes']=_0x1d769c[_0x05ad('0x33')][_0x05ad('0x35')]?_0x1d769c[_0x05ad('0x33')]:_0x11ee81['model'];if(!_0x22b071[_0x05ad('0x30')][_0x05ad('0x36')](_0x05ad('0x37'))){_0x1d769c[_0x05ad('0x22')]=qs[_0x05ad('0x22')](_0x22b071[_0x05ad('0x30')][_0x05ad('0x22')]);_0x1d769c[_0x05ad('0x21')]=qs['offset'](_0x22b071[_0x05ad('0x30')][_0x05ad('0x21')]);}_0x1d769c['order']=qs['sort'](_0x22b071[_0x05ad('0x30')]['sort']);_0x1d769c[_0x05ad('0x38')]=qs['filters'](_[_0x05ad('0x39')](_0x22b071['query'],_0x11ee81[_0x05ad('0x3a')]),_0x5b5ff7);if(_0x22b071[_0x05ad('0x30')][_0x05ad('0x3b')]){_0x1d769c['where']=_[_0x05ad('0x3c')](_0x1d769c[_0x05ad('0x38')],{'$or':_['map'](_0x5b5ff7,function(_0x19f8c3){if(_0x19f8c3[_0x05ad('0x3d')]!==_0x05ad('0x3e')){var _0x1f1f51={};_0x1f1f51[_0x19f8c3['name']]={'$like':'%'+_0x22b071[_0x05ad('0x30')][_0x05ad('0x3b')]+'%'};return _0x1f1f51;}})});}_0x1d769c=_[_0x05ad('0x3c')]({},_0x1d769c,_0x22b071['options']);var _0x17655f={'where':_0x1d769c[_0x05ad('0x38')]};return db[_0x05ad('0x3f')][_0x05ad('0x20')](_0x17655f)['then'](function(_0x59b5b2){_0x577d01[_0x05ad('0x20')]=_0x59b5b2;if(_0x22b071[_0x05ad('0x30')][_0x05ad('0x40')]){_0x1d769c[_0x05ad('0x41')]=[{'all':!![]}];}return db[_0x05ad('0x3f')][_0x05ad('0x42')](_0x1d769c);})[_0x05ad('0x26')](function(_0x4a41a8){_0x577d01[_0x05ad('0x43')]=_0x4a41a8;return _0x577d01;})[_0x05ad('0x26')](respondWithFilteredResult(_0x5b653c,_0x1d769c))[_0x05ad('0x44')](handleError(_0x5b653c,null));};exports[_0x05ad('0x45')]=function(_0x4d196d,_0x36c199){var _0x4c05d8={'raw':![],'where':{'id':_0x4d196d[_0x05ad('0x46')]['id']}},_0x2f6f2a={};_0x2f6f2a[_0x05ad('0x2f')]=_['keys'](db[_0x05ad('0x3f')][_0x05ad('0x47')]);_0x2f6f2a[_0x05ad('0x30')]=_['keys'](_0x4d196d[_0x05ad('0x30')]);_0x2f6f2a[_0x05ad('0x3a')]=_[_0x05ad('0x32')](_0x2f6f2a[_0x05ad('0x2f')],_0x2f6f2a[_0x05ad('0x30')]);_0x4c05d8[_0x05ad('0x33')]=_[_0x05ad('0x32')](_0x2f6f2a[_0x05ad('0x2f')],qs['fields'](_0x4d196d[_0x05ad('0x30')]['fields']));_0x4c05d8['attributes']=_0x4c05d8[_0x05ad('0x33')][_0x05ad('0x35')]?_0x4c05d8['attributes']:_0x2f6f2a['model'];if(_0x4d196d['query']['includeAll']){_0x4c05d8[_0x05ad('0x41')]=[{'all':!![]}];}_0x4c05d8=_[_0x05ad('0x3c')]({},_0x4c05d8,_0x4d196d[_0x05ad('0x48')]);return db[_0x05ad('0x3f')][_0x05ad('0x49')](_0x4c05d8)['then'](handleEntityNotFound(_0x36c199,null))[_0x05ad('0x26')](respondWithResult(_0x36c199,null))[_0x05ad('0x44')](handleError(_0x36c199,null));};exports[_0x05ad('0x4a')]=function(_0x4cdac0,_0x204b27){return db[_0x05ad('0x3f')][_0x05ad('0x4a')](_0x4cdac0[_0x05ad('0x4b')],{})['then'](respondWithResult(_0x204b27,0xc9))[_0x05ad('0x44')](handleError(_0x204b27,null));};exports[_0x05ad('0x4c')]=function(_0x3c6bb6,_0xdd10c2){if(_0x3c6bb6[_0x05ad('0x4b')]['id']){delete _0x3c6bb6[_0x05ad('0x4b')]['id'];}return db['SugarcrmAccount']['find']({'where':{'id':_0x3c6bb6[_0x05ad('0x46')]['id']}})[_0x05ad('0x26')](handleEntityNotFound(_0xdd10c2,null))[_0x05ad('0x26')](saveUpdates(_0x3c6bb6[_0x05ad('0x4b')],null))[_0x05ad('0x26')](respondWithResult(_0xdd10c2,null))[_0x05ad('0x44')](handleError(_0xdd10c2,null));};exports[_0x05ad('0x27')]=function(_0x342482,_0x14cb81){return db[_0x05ad('0x3f')][_0x05ad('0x49')]({'where':{'id':_0x342482[_0x05ad('0x46')]['id']}})[_0x05ad('0x26')](handleEntityNotFound(_0x14cb81,null))['then'](removeEntity(_0x14cb81,null))[_0x05ad('0x44')](handleError(_0x14cb81,null));};exports[_0x05ad('0x4d')]=function(_0x4f924d,_0x35b4de,_0x4b1416){var _0x32044c={};var _0x266768={};var _0x1f7a30;var _0x42d153;return db[_0x05ad('0x3f')][_0x05ad('0x4e')]({'where':{'id':_0x4f924d[_0x05ad('0x46')]['id']}})[_0x05ad('0x26')](handleEntityNotFound(_0x35b4de,null))[_0x05ad('0x26')](function(_0x5a756d){if(_0x5a756d){_0x1f7a30=_0x5a756d;_0x266768['model']=_[_0x05ad('0x31')](db['SugarcrmConfiguration'][_0x05ad('0x47')]);_0x266768[_0x05ad('0x30')]=_[_0x05ad('0x31')](_0x4f924d[_0x05ad('0x30')]);_0x266768['filters']=_[_0x05ad('0x32')](_0x266768['model'],_0x266768['query']);_0x32044c[_0x05ad('0x33')]=_[_0x05ad('0x32')](_0x266768[_0x05ad('0x2f')],qs[_0x05ad('0x34')](_0x4f924d[_0x05ad('0x30')][_0x05ad('0x34')]));_0x32044c['attributes']=_0x32044c[_0x05ad('0x33')]['length']?_0x32044c[_0x05ad('0x33')]:_0x266768[_0x05ad('0x2f')];_0x32044c[_0x05ad('0x4f')]=qs[_0x05ad('0x50')](_0x4f924d[_0x05ad('0x30')][_0x05ad('0x50')]);_0x32044c[_0x05ad('0x38')]=qs[_0x05ad('0x3a')](_[_0x05ad('0x39')](_0x4f924d['query'],_0x266768[_0x05ad('0x3a')]));if(_0x4f924d[_0x05ad('0x30')][_0x05ad('0x3b')]){_0x32044c[_0x05ad('0x38')]=_[_0x05ad('0x3c')](_0x32044c[_0x05ad('0x38')],{'$or':_[_0x05ad('0x2c')](_0x32044c[_0x05ad('0x33')],function(_0x5dc4f1){var _0x581688={};_0x581688[_0x5dc4f1]={'$like':'%'+_0x4f924d[_0x05ad('0x30')]['filter']+'%'};return _0x581688;})});}_0x32044c=_[_0x05ad('0x3c')]({},_0x32044c,_0x4f924d[_0x05ad('0x48')]);return _0x1f7a30[_0x05ad('0x4d')](_0x32044c);}})[_0x05ad('0x26')](function(_0x80b2bd){if(_0x80b2bd){_0x42d153=_0x80b2bd[_0x05ad('0x35')];if(!_0x4f924d[_0x05ad('0x30')][_0x05ad('0x36')]('nolimit')){_0x32044c[_0x05ad('0x22')]=qs[_0x05ad('0x22')](_0x4f924d['query'][_0x05ad('0x22')]);_0x32044c['offset']=qs[_0x05ad('0x21')](_0x4f924d['query']['offset']);}return _0x1f7a30[_0x05ad('0x4d')](_0x32044c);}})[_0x05ad('0x26')](function(_0x5838df){if(_0x5838df){return _0x5838df?{'count':_0x42d153,'rows':_0x5838df}:null;}})['then'](respondWithResult(_0x35b4de,null))[_0x05ad('0x44')](handleError(_0x35b4de,null));};exports[_0x05ad('0x51')]=function(_0x5d4928,_0x27da03,_0x4b63e7){if(_0x5d4928['body']['id']){delete _0x5d4928[_0x05ad('0x4b')]['id'];}return db[_0x05ad('0x3f')][_0x05ad('0x4e')]({'where':{'id':_0x5d4928['params']['id']}})[_0x05ad('0x26')](handleEntityNotFound(_0x27da03,null))[_0x05ad('0x26')](function(_0x33601a){if(_0x33601a){_0x5d4928['body'][_0x05ad('0x52')]=_0x33601a['id'];_0x5d4928[_0x05ad('0x4b')][_0x05ad('0x53')]=integrations[_0x05ad('0x54')](_0x5d4928[_0x05ad('0x4b')]['channel'],_0x5d4928[_0x05ad('0x4b')][_0x05ad('0x3d')]);_0x5d4928[_0x05ad('0x4b')]['Descriptions']=integrations[_0x05ad('0x55')](_0x5d4928[_0x05ad('0x4b')]['channel'],_0x5d4928[_0x05ad('0x4b')][_0x05ad('0x3d')]);return db['SugarcrmConfiguration']['create'](_0x5d4928['body'],{'include':[{'model':db['SugarcrmField'],'as':_0x05ad('0x53')},{'model':db['SugarcrmField'],'as':_0x05ad('0x56')}]});}return null;})[_0x05ad('0x26')](respondWithResult(_0x27da03,null))[_0x05ad('0x44')](handleError(_0x27da03,null));};exports[_0x05ad('0x57')]=function(_0x2a5d42,_0x3ad660,_0x2a1e77){var _0x24d4b5='';var _0xeeedc0=['id',_0x05ad('0x2a'),_0x05ad('0x58'),_0x05ad('0x59'),_0x05ad('0x5a'),_0x05ad('0x5b'),_0x05ad('0x5c'),_0x05ad('0x5d'),_0x05ad('0x5e'),'parent_type',_0x05ad('0x5f'),_0x05ad('0x60')];return db[_0x05ad('0x3f')][_0x05ad('0x4e')]({'where':{'id':_0x2a5d42['params']['id']},'attributes':['id',_0x05ad('0x61'),'password','remoteUri']})[_0x05ad('0x26')](handleEntityNotFound(_0x3ad660,null))[_0x05ad('0x26')](function(_0x5a0cb5){if(_0x5a0cb5){_0x24d4b5=_0x5a0cb5[_0x05ad('0x62')];var _0xfa71c9=_0x24d4b5[_0x05ad('0x63')](-0x1);if(_0xfa71c9==='/'){_0x24d4b5=_0x24d4b5[_0x05ad('0x64')](0x0,_0x24d4b5[_0x05ad('0x65')](_0xfa71c9));}return rp({'method':_0x05ad('0x66'),'uri':util[_0x05ad('0x67')](_0x05ad('0x68'),_0x24d4b5,_0x05ad('0x69')),'json':!![],'form':{'method':_0x05ad('0x6a'),'input_type':'JSON','response_type':_0x05ad('0x6b'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x5a0cb5['username'],'password':_0x5a0cb5[_0x05ad('0x6c')],'encryption':_0x05ad('0x6d')},'application':_0x05ad('0x6e')})}});}})[_0x05ad('0x26')](function(_0x536895){if(_0x536895&&_0x536895[_0x05ad('0x2a')]!==_0x05ad('0x6f')&&_0x536895['name']!=='Password\x20Expired'){return rp({'method':'POST','uri':util[_0x05ad('0x67')](_0x05ad('0x68'),_0x24d4b5,_0x05ad('0x69')),'json':!![],'form':{'method':_0x05ad('0x70'),'input_type':_0x05ad('0x6b'),'response_type':_0x05ad('0x6b'),'rest_data':JSON[_0x05ad('0x71')]({'session':_0x536895['id'],'module_name':_0x05ad('0x72')})}})[_0x05ad('0x26')](function(_0x2039ba){if(_0x2039ba){var _0x49b089=_[_0x05ad('0x73')](_0x2039ba[_0x05ad('0x74')]);_[_0x05ad('0x75')](_0x49b089,function(_0x471a6f){return _0xeeedc0[_0x05ad('0x76')](_0x471a6f[_0x05ad('0x2a')]);});return{'count':_0x49b089[_0x05ad('0x35')],'rows':_[_0x05ad('0x2c')](_0x49b089,function(_0x174f68){return{'id':_0x174f68['name'],'name':_0x174f68[_0x05ad('0x77')],'custom':_['endsWith'](_0x174f68[_0x05ad('0x2a')],'_c')?!![]:![],'options':_0x174f68[_0x05ad('0x48')]?_[_0x05ad('0x2c')](_[_0x05ad('0x73')](_0x174f68[_0x05ad('0x48')]),function(_0x4e2994){return{'name':_0x4e2994['value'],'value':_0x4e2994[_0x05ad('0x2a')]};}):[]};})};}})[_0x05ad('0x26')](respondWithResult(_0x3ad660,null))[_0x05ad('0x44')](function(_0x2d32aa){var _0xa45d80=_0x2a5d42[_0x05ad('0x30')]['test']?0x1f4:_0x2d32aa[_0x05ad('0x78')]||0x1f4;logger['error'](_0x05ad('0x79'),_0x05ad('0x57'),_0xa45d80,JSON[_0x05ad('0x71')](_0x2d32aa));delete _0x2d32aa[_0x05ad('0x2a')];if(_0xa45d80===0x191){_0xa45d80=0x190;}_0x3ad660[_0x05ad('0x1c')](_0xa45d80)[_0x05ad('0x7a')](_0x2a5d42['query']['test']?{'message':'Wrong\x20credentials','statusCode':_0x2d32aa[_0x05ad('0x78')]}:_0x2d32aa);});}else{var _0xb1f42d=0x1f4;_0x3ad660[_0x05ad('0x1c')](_0xb1f42d)[_0x05ad('0x7a')]({'message':_0x05ad('0x7b'),'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 d266dec..841ce73 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 _0x7717=['int_sugarcrm_accounts','lodash','util','moment','bluebird','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','exports','define'];(function(_0x475a51,_0x4e97c9){var _0x298441=function(_0x449dc4){while(--_0x449dc4){_0x475a51['push'](_0x475a51['shift']());}};_0x298441(++_0x4e97c9);}(_0x7717,0x6f));var _0x7771=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x7717[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x7771('0x0'));var util=require(_0x7771('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x7771('0x2'));var BPromise=require(_0x7771('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7771('0x4'));var rimraf=require(_0x7771('0x5'));var config=require(_0x7771('0x6'));var attributes=require(_0x7771('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x7771('0x8')]=function(_0x55c2de,_0x42e621){return _0x55c2de[_0x7771('0x9')]('SugarcrmAccount',attributes,{'tableName':_0x7771('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6c79=['moment','request-promise','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','../../config/logger','api'];(function(_0x3a8663,_0x380b97){var _0x1f6818=function(_0x3e5ada){while(--_0x3e5ada){_0x3a8663['push'](_0x3a8663['shift']());}};_0x1f6818(++_0x380b97);}(_0x6c79,0x184));var _0x96c7=function(_0x2fb7b2,_0x9f61a4){_0x2fb7b2=_0x2fb7b2-0x0;var _0x4db80e=_0x6c79[_0x2fb7b2];return _0x4db80e;};'use strict';var _=require(_0x96c7('0x0'));var util=require(_0x96c7('0x1'));var logger=require(_0x96c7('0x2'))(_0x96c7('0x3'));var moment=require(_0x96c7('0x4'));var BPromise=require('bluebird');var rp=require(_0x96c7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x96c7('0x6'));var config=require(_0x96c7('0x7'));var attributes=require(_0x96c7('0x8'));var integrations=require(_0x96c7('0x9'));module[_0x96c7('0xa')]=function(_0x487fd6,_0x2dac6b){return _0x487fd6[_0x96c7('0xb')](_0x96c7('0xc'),attributes,{'tableName':_0x96c7('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 99e9e8d..c0f6640 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 _0xf690=['ShowSugarcrmAccount','where','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','raw','options','attributes','limit','include','map','model'];(function(_0x4d22af,_0x2da329){var _0x1aa3f4=function(_0x58538c){while(--_0x58538c){_0x4d22af['push'](_0x4d22af['shift']());}};_0x1aa3f4(++_0x2da329);}(_0xf690,0xd4));var _0x0f69=function(_0x17c8cc,_0x5e5647){_0x17c8cc=_0x17c8cc-0x0;var _0x3db4eb=_0xf690[_0x17c8cc];return _0x3db4eb;};'use strict';var _=require(_0x0f69('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0f69('0x1'));var rs=require(_0x0f69('0x2'));var fs=require('fs');var Redis=require(_0x0f69('0x3'));var db=require(_0x0f69('0x4'))['db'];var utils=require(_0x0f69('0x5'));var logger=require(_0x0f69('0x6'))(_0x0f69('0x7'));var config=require('../../config/environment');var jayson=require(_0x0f69('0x8'));var client=jayson[_0x0f69('0x9')][_0x0f69('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x58a0d7,_0x1b0aae,_0x1b3e50){return new BPromise(function(_0x59d997,_0x2c81a7){return client['request'](_0x58a0d7,_0x1b3e50)[_0x0f69('0xb')](function(_0x1696e0){logger[_0x0f69('0xc')](_0x0f69('0xd'),_0x1b0aae,_0x0f69('0xe'));logger[_0x0f69('0xf')](_0x0f69('0x10'),_0x1b0aae,_0x0f69('0xe'),JSON[_0x0f69('0x11')](_0x1696e0));if(_0x1696e0[_0x0f69('0x12')]){if(_0x1696e0[_0x0f69('0x12')][_0x0f69('0x13')]===0x1f4){logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x1b0aae,_0x1696e0[_0x0f69('0x12')][_0x0f69('0x14')]);return _0x2c81a7(_0x1696e0[_0x0f69('0x12')][_0x0f69('0x14')]);}logger[_0x0f69('0x12')]('SugarcrmAccount,\x20%s,\x20%s',_0x1b0aae,_0x1696e0['error'][_0x0f69('0x14')]);return _0x59d997(_0x1696e0[_0x0f69('0x12')]['message']);}else{logger['info']('SugarcrmAccount,\x20%s,\x20%s',_0x1b0aae,_0x0f69('0xe'));_0x59d997(_0x1696e0[_0x0f69('0x15')][_0x0f69('0x14')]);}})[_0x0f69('0x16')](function(_0x4b8bb3){logger['error'](_0x0f69('0xd'),_0x1b0aae,_0x4b8bb3);_0x2c81a7(_0x4b8bb3);});});}exports[_0x0f69('0x17')]=function(_0x1ecde0){var _0x9466c1=this;return new Promise(function(_0x54de41,_0x340ffa){return db[_0x0f69('0x18')][_0x0f69('0x19')]({'raw':_0x1ecde0['options']?_0x1ecde0['options'][_0x0f69('0x1a')]===undefined?!![]:![]:!![],'where':_0x1ecde0[_0x0f69('0x1b')]?_0x1ecde0[_0x0f69('0x1b')]['where']||null:null,'attributes':_0x1ecde0['options']?_0x1ecde0[_0x0f69('0x1b')][_0x0f69('0x1c')]||null:null,'limit':_0x1ecde0[_0x0f69('0x1b')]?_0x1ecde0[_0x0f69('0x1b')][_0x0f69('0x1d')]||null:null,'include':_0x1ecde0[_0x0f69('0x1b')]?_0x1ecde0[_0x0f69('0x1b')][_0x0f69('0x1e')]?_[_0x0f69('0x1f')](_0x1ecde0[_0x0f69('0x1b')]['include'],function(_0x2d7f42){return{'model':db[_0x2d7f42[_0x0f69('0x20')]],'as':_0x2d7f42['as'],'attributes':_0x2d7f42[_0x0f69('0x1c')],'include':_0x2d7f42[_0x0f69('0x1e')]?_[_0x0f69('0x1f')](_0x2d7f42[_0x0f69('0x1e')],function(_0x2e669d){return{'model':db[_0x2e669d[_0x0f69('0x20')]],'as':_0x2e669d['as'],'attributes':_0x2e669d[_0x0f69('0x1c')],'include':_0x2e669d[_0x0f69('0x1e')]?_[_0x0f69('0x1f')](_0x2e669d[_0x0f69('0x1e')],function(_0x53b36a){return{'model':db[_0x53b36a[_0x0f69('0x20')]],'as':_0x53b36a['as'],'attributes':_0x53b36a[_0x0f69('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x0f69('0xb')](function(_0x318d29){logger[_0x0f69('0xc')](_0x0f69('0x17'),_0x1ecde0);logger[_0x0f69('0xf')](_0x0f69('0x17'),_0x1ecde0,JSON[_0x0f69('0x11')](_0x318d29));_0x54de41(_0x318d29);})[_0x0f69('0x16')](function(_0x176c6e){logger[_0x0f69('0x12')](_0x0f69('0x17'),_0x176c6e[_0x0f69('0x14')],_0x1ecde0);_0x340ffa(_0x9466c1[_0x0f69('0x12')](0x1f4,_0x176c6e[_0x0f69('0x14')]));});});};exports[_0x0f69('0x21')]=function(_0xa13506){var _0x5a6cd7=this;return new Promise(function(_0x16cb17,_0x1375da){return db[_0x0f69('0x18')]['find']({'raw':_0xa13506[_0x0f69('0x1b')]?_0xa13506[_0x0f69('0x1b')][_0x0f69('0x1a')]===undefined?!![]:![]:!![],'where':_0xa13506['options']?_0xa13506[_0x0f69('0x1b')][_0x0f69('0x22')]||null:null,'attributes':_0xa13506[_0x0f69('0x1b')]?_0xa13506[_0x0f69('0x1b')][_0x0f69('0x1c')]||null:null,'include':_0xa13506['options']?_0xa13506['options']['include']?_[_0x0f69('0x1f')](_0xa13506[_0x0f69('0x1b')][_0x0f69('0x1e')],function(_0x56e4d9){return{'model':db[_0x56e4d9[_0x0f69('0x20')]],'as':_0x56e4d9['as'],'attributes':_0x56e4d9[_0x0f69('0x1c')],'include':_0x56e4d9[_0x0f69('0x1e')]?_[_0x0f69('0x1f')](_0x56e4d9[_0x0f69('0x1e')],function(_0x23eb35){return{'model':db[_0x23eb35['model']],'as':_0x23eb35['as'],'attributes':_0x23eb35[_0x0f69('0x1c')],'include':_0x23eb35[_0x0f69('0x1e')]?_['map'](_0x23eb35[_0x0f69('0x1e')],function(_0x24711d){return{'model':db[_0x24711d[_0x0f69('0x20')]],'as':_0x24711d['as'],'attributes':_0x24711d[_0x0f69('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x0f69('0xb')](function(_0x438ca6){logger[_0x0f69('0xc')](_0x0f69('0x21'),_0xa13506);logger[_0x0f69('0xf')](_0x0f69('0x21'),_0xa13506,JSON[_0x0f69('0x11')](_0x438ca6));_0x16cb17(_0x438ca6);})['catch'](function(_0x34b6e7){logger['error'](_0x0f69('0x21'),_0x34b6e7[_0x0f69('0x14')],_0xa13506);_0x1375da(_0x5a6cd7[_0x0f69('0x12')](0x1f4,_0x34b6e7[_0x0f69('0x14')]));});});}; \ No newline at end of file +var _0x5e8b=['attributes','model','ShowSugarcrmAccount','find','then','util','bluebird','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetSugarcrmAccount','SugarcrmAccount','raw','options','where','limit','include','map'];(function(_0x1bf0ed,_0x256e68){var _0x638868=function(_0x34634c){while(--_0x34634c){_0x1bf0ed['push'](_0x1bf0ed['shift']());}};_0x638868(++_0x256e68);}(_0x5e8b,0x145));var _0xb5e8=function(_0x1e8991,_0x4d53fa){_0x1e8991=_0x1e8991-0x0;var _0x401f7d=_0x5e8b[_0x1e8991];return _0x401f7d;};'use strict';var _=require('lodash');var util=require(_0xb5e8('0x0'));var moment=require('moment');var BPromise=require(_0xb5e8('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb5e8('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xb5e8('0x3'));var logger=require(_0xb5e8('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb5e8('0x5'));var client=jayson[_0xb5e8('0x6')][_0xb5e8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3d01ea,_0xa81b88,_0x12cb82){return new BPromise(function(_0x2392cb,_0x62f960){return client['request'](_0x3d01ea,_0x12cb82)['then'](function(_0x216296){logger['info'](_0xb5e8('0x8'),_0xa81b88,_0xb5e8('0x9'));logger[_0xb5e8('0xa')](_0xb5e8('0xb'),_0xa81b88,'request\x20sent',JSON[_0xb5e8('0xc')](_0x216296));if(_0x216296['error']){if(_0x216296[_0xb5e8('0xd')][_0xb5e8('0xe')]===0x1f4){logger[_0xb5e8('0xd')](_0xb5e8('0x8'),_0xa81b88,_0x216296[_0xb5e8('0xd')][_0xb5e8('0xf')]);return _0x62f960(_0x216296[_0xb5e8('0xd')][_0xb5e8('0xf')]);}logger[_0xb5e8('0xd')](_0xb5e8('0x8'),_0xa81b88,_0x216296['error'][_0xb5e8('0xf')]);return _0x2392cb(_0x216296[_0xb5e8('0xd')]['message']);}else{logger[_0xb5e8('0x10')](_0xb5e8('0x8'),_0xa81b88,_0xb5e8('0x9'));_0x2392cb(_0x216296[_0xb5e8('0x11')][_0xb5e8('0xf')]);}})[_0xb5e8('0x12')](function(_0x37b106){logger[_0xb5e8('0xd')]('SugarcrmAccount,\x20%s,\x20%s',_0xa81b88,_0x37b106);_0x62f960(_0x37b106);});});}exports[_0xb5e8('0x13')]=function(_0x113d5c){var _0x5c01ed=this;return new Promise(function(_0x3f2dcc,_0x1caae2){return db[_0xb5e8('0x14')]['findAll']({'raw':_0x113d5c['options']?_0x113d5c['options'][_0xb5e8('0x15')]===undefined?!![]:![]:!![],'where':_0x113d5c[_0xb5e8('0x16')]?_0x113d5c[_0xb5e8('0x16')][_0xb5e8('0x17')]||null:null,'attributes':_0x113d5c[_0xb5e8('0x16')]?_0x113d5c[_0xb5e8('0x16')]['attributes']||null:null,'limit':_0x113d5c[_0xb5e8('0x16')]?_0x113d5c[_0xb5e8('0x16')][_0xb5e8('0x18')]||null:null,'include':_0x113d5c['options']?_0x113d5c[_0xb5e8('0x16')][_0xb5e8('0x19')]?_[_0xb5e8('0x1a')](_0x113d5c[_0xb5e8('0x16')][_0xb5e8('0x19')],function(_0x2e2709){return{'model':db[_0x2e2709['model']],'as':_0x2e2709['as'],'attributes':_0x2e2709[_0xb5e8('0x1b')],'include':_0x2e2709['include']?_[_0xb5e8('0x1a')](_0x2e2709[_0xb5e8('0x19')],function(_0x5d3467){return{'model':db[_0x5d3467[_0xb5e8('0x1c')]],'as':_0x5d3467['as'],'attributes':_0x5d3467[_0xb5e8('0x1b')],'include':_0x5d3467[_0xb5e8('0x19')]?_['map'](_0x5d3467['include'],function(_0x175d0e){return{'model':db[_0x175d0e['model']],'as':_0x175d0e['as'],'attributes':_0x175d0e['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xe4d5c0){logger[_0xb5e8('0x10')]('GetSugarcrmAccount',_0x113d5c);logger['debug'](_0xb5e8('0x13'),_0x113d5c,JSON[_0xb5e8('0xc')](_0xe4d5c0));_0x3f2dcc(_0xe4d5c0);})[_0xb5e8('0x12')](function(_0x555855){logger[_0xb5e8('0xd')](_0xb5e8('0x13'),_0x555855[_0xb5e8('0xf')],_0x113d5c);_0x1caae2(_0x5c01ed[_0xb5e8('0xd')](0x1f4,_0x555855[_0xb5e8('0xf')]));});});};exports[_0xb5e8('0x1d')]=function(_0x1cfb17){var _0x177fc2=this;return new Promise(function(_0xe363e,_0x48a841){return db[_0xb5e8('0x14')][_0xb5e8('0x1e')]({'raw':_0x1cfb17['options']?_0x1cfb17[_0xb5e8('0x16')][_0xb5e8('0x15')]===undefined?!![]:![]:!![],'where':_0x1cfb17[_0xb5e8('0x16')]?_0x1cfb17[_0xb5e8('0x16')][_0xb5e8('0x17')]||null:null,'attributes':_0x1cfb17[_0xb5e8('0x16')]?_0x1cfb17['options'][_0xb5e8('0x1b')]||null:null,'include':_0x1cfb17[_0xb5e8('0x16')]?_0x1cfb17[_0xb5e8('0x16')]['include']?_[_0xb5e8('0x1a')](_0x1cfb17[_0xb5e8('0x16')][_0xb5e8('0x19')],function(_0x34ab79){return{'model':db[_0x34ab79[_0xb5e8('0x1c')]],'as':_0x34ab79['as'],'attributes':_0x34ab79[_0xb5e8('0x1b')],'include':_0x34ab79[_0xb5e8('0x19')]?_['map'](_0x34ab79[_0xb5e8('0x19')],function(_0x5efdf8){return{'model':db[_0x5efdf8[_0xb5e8('0x1c')]],'as':_0x5efdf8['as'],'attributes':_0x5efdf8['attributes'],'include':_0x5efdf8['include']?_[_0xb5e8('0x1a')](_0x5efdf8['include'],function(_0xe1a4a3){return{'model':db[_0xe1a4a3[_0xb5e8('0x1c')]],'as':_0xe1a4a3['as'],'attributes':_0xe1a4a3['attributes']};}):[]};}):[]};}):[]:[]})[_0xb5e8('0x1f')](function(_0xa97242){logger[_0xb5e8('0x10')]('ShowSugarcrmAccount',_0x1cfb17);logger[_0xb5e8('0xa')](_0xb5e8('0x1d'),_0x1cfb17,JSON[_0xb5e8('0xc')](_0xa97242));_0xe363e(_0xa97242);})['catch'](function(_0x515873){logger[_0xb5e8('0xd')](_0xb5e8('0x1d'),_0x515873[_0xb5e8('0xf')],_0x1cfb17);_0x48a841(_0x177fc2[_0xb5e8('0xd')](0x1f4,_0x515873['message']));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index a6956a9..d4b1ed2 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 _0x95f7=['../../components/auth/service','../../config/environment','./intSugarcrmConfiguration.controller','get','/:id','show','/:id/fields','isAuthenticated','getFields','getSubjects','getDescriptions','post','create','put','update','delete','exports','path','connect-timeout','Router'];(function(_0x387583,_0x127b08){var _0x45d2f9=function(_0x1d82ac){while(--_0x1d82ac){_0x387583['push'](_0x387583['shift']());}};_0x45d2f9(++_0x127b08);}(_0x95f7,0x1f1));var _0x795f=function(_0xd94319,_0x8e982e){_0xd94319=_0xd94319-0x0;var _0xc44d5d=_0x95f7[_0xd94319];return _0xc44d5d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x795f('0x0'));var timeout=require(_0x795f('0x1'));var express=require('express');var router=express[_0x795f('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x795f('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x795f('0x4'));var controller=require(_0x795f('0x5'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x795f('0x6')](_0x795f('0x7'),auth['isAuthenticated'](),controller[_0x795f('0x8')]);router[_0x795f('0x6')](_0x795f('0x9'),auth[_0x795f('0xa')](),controller[_0x795f('0xb')]);router[_0x795f('0x6')]('/:id/subjects',auth[_0x795f('0xa')](),controller[_0x795f('0xc')]);router[_0x795f('0x6')]('/:id/descriptions',auth[_0x795f('0xa')](),controller[_0x795f('0xd')]);router[_0x795f('0xe')]('/',auth[_0x795f('0xa')](),controller[_0x795f('0xf')]);router[_0x795f('0x10')](_0x795f('0x7'),auth[_0x795f('0xa')](),controller[_0x795f('0x11')]);router[_0x795f('0x12')]('/:id',auth[_0x795f('0xa')](),controller['destroy']);module[_0x795f('0x13')]=router; \ No newline at end of file +var _0x84dc=['../../config/environment','get','index','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','delete','/:id','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x5a9e8d,_0x10c258){var _0x3a575c=function(_0x50cf63){while(--_0x50cf63){_0x5a9e8d['push'](_0x5a9e8d['shift']());}};_0x3a575c(++_0x10c258);}(_0x84dc,0x19e));var _0xc84d=function(_0x718b91,_0x37ed71){_0x718b91=_0x718b91-0x0;var _0x4d8a66=_0x84dc[_0x718b91];return _0x4d8a66;};'use strict';var multer=require(_0xc84d('0x0'));var util=require(_0xc84d('0x1'));var path=require(_0xc84d('0x2'));var timeout=require(_0xc84d('0x3'));var express=require(_0xc84d('0x4'));var router=express[_0xc84d('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc84d('0x6'));var controller=require('./intSugarcrmConfiguration.controller');router[_0xc84d('0x7')]('/',auth['isAuthenticated'](),controller[_0xc84d('0x8')]);router['get']('/:id',auth[_0xc84d('0x9')](),controller[_0xc84d('0xa')]);router['get'](_0xc84d('0xb'),auth['isAuthenticated'](),controller[_0xc84d('0xc')]);router['get'](_0xc84d('0xd'),auth[_0xc84d('0x9')](),controller[_0xc84d('0xe')]);router[_0xc84d('0x7')](_0xc84d('0xf'),auth[_0xc84d('0x9')](),controller[_0xc84d('0x10')]);router[_0xc84d('0x11')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0xc84d('0x9')](),controller['update']);router[_0xc84d('0x12')](_0xc84d('0x13'),auth[_0xc84d('0x9')](),controller['destroy']);module[_0xc84d('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 468f4d2..909139e 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 _0x551a=['STRING','sequelize','exports'];(function(_0x3da0d1,_0x41bb47){var _0x278c28=function(_0x4cfb35){while(--_0x4cfb35){_0x3da0d1['push'](_0x3da0d1['shift']());}};_0x278c28(++_0x41bb47);}(_0x551a,0x1a2));var _0xa551=function(_0x1abfbd,_0x1471f6){_0x1abfbd=_0x1abfbd-0x0;var _0x45df1b=_0x551a[_0x1abfbd];return _0x45df1b;};'use strict';var Sequelize=require(_0xa551('0x0'));module[_0xa551('0x1')]={'name':{'type':Sequelize[_0xa551('0x2')]},'description':{'type':Sequelize[_0xa551('0x2')]}}; \ No newline at end of file +var _0x280e=['STRING','sequelize','exports'];(function(_0x5da27f,_0x504b76){var _0x54a3fb=function(_0x3b65a8){while(--_0x3b65a8){_0x5da27f['push'](_0x5da27f['shift']());}};_0x54a3fb(++_0x504b76);}(_0x280e,0x160));var _0xe280=function(_0x4e5552,_0x19ec4e){_0x4e5552=_0x4e5552-0x0;var _0x60a338=_0x280e[_0x4e5552];return _0x60a338;};'use strict';var Sequelize=require(_0xe280('0x0'));module[_0xe280('0x1')]={'name':{'type':Sequelize[_0xe280('0x2')]},'description':{'type':Sequelize[_0xe280('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index fdd974c..b1a6a48 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 _0x9740=['path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','find','catch','create','body','destroy','params','getFields','findOne','SugarcrmField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache'];(function(_0x4e9fcd,_0x4a7e47){var _0x349716=function(_0x4ade71){while(--_0x4ade71){_0x4e9fcd['push'](_0x4e9fcd['shift']());}};_0x349716(++_0x4a7e47);}(_0x9740,0x198));var _0x0974=function(_0xf69a5,_0x562ba9){_0xf69a5=_0xf69a5-0x0;var _0x387e9d=_0x9740[_0xf69a5];return _0x387e9d;};'use strict';var emlformat=require(_0x0974('0x0'));var rimraf=require(_0x0974('0x1'));var zipdir=require(_0x0974('0x2'));var jsonpatch=require(_0x0974('0x3'));var rp=require('request-promise');var moment=require(_0x0974('0x4'));var BPromise=require(_0x0974('0x5'));var Mustache=require(_0x0974('0x6'));var util=require('util');var path=require(_0x0974('0x7'));var sox=require(_0x0974('0x8'));var csv=require(_0x0974('0x9'));var ejs=require(_0x0974('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0974('0xb'));var squel=require(_0x0974('0xc'));var crypto=require(_0x0974('0xd'));var jsforce=require(_0x0974('0xe'));var deskjs=require(_0x0974('0xf'));var toCsv=require(_0x0974('0x9'));var querystring=require(_0x0974('0x10'));var Papa=require('papaparse');var Redis=require(_0x0974('0x11'));var authService=require(_0x0974('0x12'));var qs=require(_0x0974('0x13'));var as=require(_0x0974('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0974('0x15'));var utils=require(_0x0974('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x0974('0x17'));var db=require(_0x0974('0x18'))['db'];function respondWithStatusCode(_0x4f77e0,_0x5ec0cd){_0x5ec0cd=_0x5ec0cd||0xcc;return function(_0x2a0a84){if(_0x2a0a84){return _0x4f77e0[_0x0974('0x19')](_0x5ec0cd);}return _0x4f77e0[_0x0974('0x1a')](_0x5ec0cd)[_0x0974('0x1b')]();};}function respondWithResult(_0x485522,_0x5b89fa){_0x5b89fa=_0x5b89fa||0xc8;return function(_0x4c6a89){if(_0x4c6a89){return _0x485522[_0x0974('0x1a')](_0x5b89fa)[_0x0974('0x1c')](_0x4c6a89);}};}function respondWithFilteredResult(_0x2f6b49,_0x3f0643){return function(_0x282b30){if(_0x282b30){var _0x3a6039=typeof _0x3f0643[_0x0974('0x1d')]===_0x0974('0x1e')&&typeof _0x3f0643[_0x0974('0x1f')]===_0x0974('0x1e');var _0x1ad69c=_0x282b30[_0x0974('0x20')];var _0x54f97b=_0x3a6039?0x0:_0x3f0643[_0x0974('0x1d')];var _0x3e1921=_0x3a6039?_0x282b30[_0x0974('0x20')]:_0x3f0643[_0x0974('0x1d')]+_0x3f0643['limit'];var _0x10519d;if(_0x3e1921>=_0x1ad69c){_0x3e1921=_0x1ad69c;_0x10519d=0xc8;}else{_0x10519d=0xce;}_0x2f6b49['status'](_0x10519d);return _0x2f6b49[_0x0974('0x21')](_0x0974('0x22'),_0x54f97b+'-'+_0x3e1921+'/'+_0x1ad69c)[_0x0974('0x1c')](_0x282b30);}return null;};}function patchUpdates(_0x38fe62){return function(_0x112e56){try{jsonpatch[_0x0974('0x23')](_0x112e56,_0x38fe62,!![]);}catch(_0x284ee8){return BPromise[_0x0974('0x24')](_0x284ee8);}return _0x112e56[_0x0974('0x25')]();};}function saveUpdates(_0x85468f,_0x329890){return function(_0x10ce97){if(_0x10ce97){return _0x10ce97[_0x0974('0x26')](_0x85468f)[_0x0974('0x27')](function(_0x476bb8){return _0x476bb8;});}return null;};}function removeEntity(_0x2e2b90,_0x572a66){return function(_0x3c2860){if(_0x3c2860){return _0x3c2860['destroy']()[_0x0974('0x27')](function(){_0x2e2b90['status'](0xcc)[_0x0974('0x1b')]();});}};}function handleEntityNotFound(_0x2fe307,_0x1ae9de){return function(_0x333896){if(!_0x333896){_0x2fe307['sendStatus'](0x194);}return _0x333896;};}function handleError(_0x2637ee,_0xf756db){_0xf756db=_0xf756db||0x1f4;return function(_0x36d2fa){logger[_0x0974('0x28')](_0x36d2fa[_0x0974('0x29')]);if(_0x36d2fa[_0x0974('0x2a')]){delete _0x36d2fa['name'];}_0x2637ee['status'](_0xf756db)[_0x0974('0x2b')](_0x36d2fa);};}exports[_0x0974('0x2c')]=function(_0x782d52,_0x577052){var _0x1518f9={},_0x1a1ebd={},_0x16dc38={'count':0x0,'rows':[]};var _0xf5c12b=_[_0x0974('0x2d')](db[_0x0974('0x2e')][_0x0974('0x2f')],function(_0x73ce20){return{'name':_0x73ce20[_0x0974('0x30')],'type':_0x73ce20[_0x0974('0x31')][_0x0974('0x32')]};});_0x1a1ebd[_0x0974('0x33')]=_[_0x0974('0x2d')](_0xf5c12b,_0x0974('0x2a'));_0x1a1ebd[_0x0974('0x34')]=_[_0x0974('0x35')](_0x782d52[_0x0974('0x34')]);_0x1a1ebd[_0x0974('0x36')]=_[_0x0974('0x37')](_0x1a1ebd[_0x0974('0x33')],_0x1a1ebd[_0x0974('0x34')]);_0x1518f9[_0x0974('0x38')]=_[_0x0974('0x37')](_0x1a1ebd[_0x0974('0x33')],qs['fields'](_0x782d52['query'][_0x0974('0x39')]));_0x1518f9['attributes']=_0x1518f9[_0x0974('0x38')][_0x0974('0x3a')]?_0x1518f9[_0x0974('0x38')]:_0x1a1ebd['model'];if(!_0x782d52[_0x0974('0x34')][_0x0974('0x3b')](_0x0974('0x3c'))){_0x1518f9[_0x0974('0x1f')]=qs['limit'](_0x782d52[_0x0974('0x34')][_0x0974('0x1f')]);_0x1518f9[_0x0974('0x1d')]=qs[_0x0974('0x1d')](_0x782d52['query'][_0x0974('0x1d')]);}_0x1518f9[_0x0974('0x3d')]=qs[_0x0974('0x3e')](_0x782d52[_0x0974('0x34')][_0x0974('0x3e')]);_0x1518f9[_0x0974('0x3f')]=qs[_0x0974('0x36')](_[_0x0974('0x40')](_0x782d52['query'],_0x1a1ebd[_0x0974('0x36')]),_0xf5c12b);if(_0x782d52[_0x0974('0x34')][_0x0974('0x41')]){_0x1518f9['where']=_[_0x0974('0x42')](_0x1518f9[_0x0974('0x3f')],{'$or':_[_0x0974('0x2d')](_0xf5c12b,function(_0x56a22d){if(_0x56a22d['type']!==_0x0974('0x43')){var _0x2b91ba={};_0x2b91ba[_0x56a22d['name']]={'$like':'%'+_0x782d52[_0x0974('0x34')][_0x0974('0x41')]+'%'};return _0x2b91ba;}})});}_0x1518f9=_[_0x0974('0x42')]({},_0x1518f9,_0x782d52[_0x0974('0x44')]);var _0xac41ca={'where':_0x1518f9[_0x0974('0x3f')]};return db[_0x0974('0x2e')][_0x0974('0x20')](_0xac41ca)['then'](function(_0x1d8f7a){_0x16dc38[_0x0974('0x20')]=_0x1d8f7a;if(_0x782d52[_0x0974('0x34')][_0x0974('0x45')]){_0x1518f9[_0x0974('0x46')]=[{'all':!![]}];}return db['SugarcrmConfiguration'][_0x0974('0x47')](_0x1518f9);})['then'](function(_0x58049a){_0x16dc38['rows']=_0x58049a;return _0x16dc38;})[_0x0974('0x27')](respondWithFilteredResult(_0x577052,_0x1518f9))['catch'](handleError(_0x577052,null));};exports['show']=function(_0x4c49cf,_0x5c924b){var _0xe2a4a0={'raw':![],'where':{'id':_0x4c49cf['params']['id']}},_0x5b648a={};_0x5b648a[_0x0974('0x33')]=_['keys'](db[_0x0974('0x2e')][_0x0974('0x2f')]);_0x5b648a[_0x0974('0x34')]=_['keys'](_0x4c49cf['query']);_0x5b648a[_0x0974('0x36')]=_[_0x0974('0x37')](_0x5b648a[_0x0974('0x33')],_0x5b648a[_0x0974('0x34')]);_0xe2a4a0[_0x0974('0x38')]=_[_0x0974('0x37')](_0x5b648a['model'],qs[_0x0974('0x39')](_0x4c49cf['query'][_0x0974('0x39')]));_0xe2a4a0[_0x0974('0x38')]=_0xe2a4a0[_0x0974('0x38')][_0x0974('0x3a')]?_0xe2a4a0['attributes']:_0x5b648a[_0x0974('0x33')];if(_0x4c49cf[_0x0974('0x34')]['includeAll']){_0xe2a4a0[_0x0974('0x46')]=[{'all':!![]}];}_0xe2a4a0=_['merge']({},_0xe2a4a0,_0x4c49cf[_0x0974('0x44')]);return db[_0x0974('0x2e')][_0x0974('0x48')](_0xe2a4a0)[_0x0974('0x27')](handleEntityNotFound(_0x5c924b,null))['then'](respondWithResult(_0x5c924b,null))[_0x0974('0x49')](handleError(_0x5c924b,null));};exports[_0x0974('0x4a')]=function(_0x374c99,_0x428dcb){return db[_0x0974('0x2e')][_0x0974('0x4a')](_0x374c99[_0x0974('0x4b')],{})['then'](respondWithResult(_0x428dcb,0xc9))['catch'](handleError(_0x428dcb,null));};exports[_0x0974('0x26')]=function(_0x20cc24,_0x713a3){if(_0x20cc24[_0x0974('0x4b')]['id']){delete _0x20cc24[_0x0974('0x4b')]['id'];}return db['SugarcrmConfiguration'][_0x0974('0x48')]({'where':{'id':_0x20cc24['params']['id']}})[_0x0974('0x27')](handleEntityNotFound(_0x713a3,null))[_0x0974('0x27')](saveUpdates(_0x20cc24[_0x0974('0x4b')],null))[_0x0974('0x27')](respondWithResult(_0x713a3,null))[_0x0974('0x49')](handleError(_0x713a3,null));};exports[_0x0974('0x4c')]=function(_0x11f60d,_0x37cb64){return db[_0x0974('0x2e')][_0x0974('0x48')]({'where':{'id':_0x11f60d[_0x0974('0x4d')]['id']}})[_0x0974('0x27')](handleEntityNotFound(_0x37cb64,null))[_0x0974('0x27')](removeEntity(_0x37cb64,null))[_0x0974('0x49')](handleError(_0x37cb64,null));};exports[_0x0974('0x4e')]=function(_0x29d8d6,_0x14bd26,_0x11abce){var _0x205dcd={};var _0x505adc={};var _0x569d79;var _0x168071;return db[_0x0974('0x2e')][_0x0974('0x4f')]({'where':{'id':_0x29d8d6['params']['id']}})[_0x0974('0x27')](handleEntityNotFound(_0x14bd26,null))['then'](function(_0x24215b){if(_0x24215b){_0x569d79=_0x24215b;_0x505adc[_0x0974('0x33')]=_[_0x0974('0x35')](db[_0x0974('0x50')][_0x0974('0x2f')]);_0x505adc[_0x0974('0x34')]=_[_0x0974('0x35')](_0x29d8d6[_0x0974('0x34')]);_0x505adc[_0x0974('0x36')]=_[_0x0974('0x37')](_0x505adc[_0x0974('0x33')],_0x505adc[_0x0974('0x34')]);_0x205dcd[_0x0974('0x38')]=_[_0x0974('0x37')](_0x505adc[_0x0974('0x33')],qs['fields'](_0x29d8d6[_0x0974('0x34')][_0x0974('0x39')]));_0x205dcd[_0x0974('0x38')]=_0x205dcd['attributes'][_0x0974('0x3a')]?_0x205dcd['attributes']:_0x505adc[_0x0974('0x33')];_0x205dcd[_0x0974('0x3d')]=qs[_0x0974('0x3e')](_0x29d8d6[_0x0974('0x34')][_0x0974('0x3e')]);_0x205dcd[_0x0974('0x3f')]=qs[_0x0974('0x36')](_['pick'](_0x29d8d6[_0x0974('0x34')],_0x505adc['filters']));if(_0x29d8d6[_0x0974('0x34')][_0x0974('0x41')]){_0x205dcd[_0x0974('0x3f')]=_[_0x0974('0x42')](_0x205dcd[_0x0974('0x3f')],{'$or':_[_0x0974('0x2d')](_0x205dcd['attributes'],function(_0x3ac83d){var _0x34cd6d={};_0x34cd6d[_0x3ac83d]={'$like':'%'+_0x29d8d6['query']['filter']+'%'};return _0x34cd6d;})});}_0x205dcd=_['merge']({},_0x205dcd,_0x29d8d6['options']);return _0x569d79[_0x0974('0x4e')](_0x205dcd);}})[_0x0974('0x27')](function(_0x405cbc){if(_0x405cbc){_0x168071=_0x405cbc[_0x0974('0x3a')];if(!_0x29d8d6[_0x0974('0x34')][_0x0974('0x3b')](_0x0974('0x3c'))){_0x205dcd['limit']=qs['limit'](_0x29d8d6['query'][_0x0974('0x1f')]);_0x205dcd['offset']=qs['offset'](_0x29d8d6[_0x0974('0x34')]['offset']);}return _0x569d79[_0x0974('0x4e')](_0x205dcd);}})[_0x0974('0x27')](function(_0x3f4268){if(_0x3f4268){return _0x3f4268?{'count':_0x168071,'rows':_0x3f4268}:null;}})[_0x0974('0x27')](respondWithResult(_0x14bd26,null))['catch'](handleError(_0x14bd26,null));};exports['getSubjects']=function(_0x2ce15e,_0x33529e,_0x398f7a){var _0x3ce302={};var _0x220252={};var _0x1cac18;var _0x3de55c;return db[_0x0974('0x2e')][_0x0974('0x4f')]({'where':{'id':_0x2ce15e['params']['id']}})[_0x0974('0x27')](handleEntityNotFound(_0x33529e,null))[_0x0974('0x27')](function(_0x449d9b){if(_0x449d9b){_0x1cac18=_0x449d9b;_0x220252['model']=_[_0x0974('0x35')](db['SugarcrmField'][_0x0974('0x2f')]);_0x220252['query']=_[_0x0974('0x35')](_0x2ce15e[_0x0974('0x34')]);_0x220252[_0x0974('0x36')]=_[_0x0974('0x37')](_0x220252[_0x0974('0x33')],_0x220252[_0x0974('0x34')]);_0x3ce302[_0x0974('0x38')]=_[_0x0974('0x37')](_0x220252[_0x0974('0x33')],qs[_0x0974('0x39')](_0x2ce15e[_0x0974('0x34')]['fields']));_0x3ce302[_0x0974('0x38')]=_0x3ce302['attributes'][_0x0974('0x3a')]?_0x3ce302[_0x0974('0x38')]:_0x220252[_0x0974('0x33')];_0x3ce302[_0x0974('0x3d')]=qs[_0x0974('0x3e')](_0x2ce15e[_0x0974('0x34')][_0x0974('0x3e')]);_0x3ce302['where']=qs[_0x0974('0x36')](_[_0x0974('0x40')](_0x2ce15e['query'],_0x220252[_0x0974('0x36')]));if(_0x2ce15e[_0x0974('0x34')][_0x0974('0x41')]){_0x3ce302[_0x0974('0x3f')]=_[_0x0974('0x42')](_0x3ce302[_0x0974('0x3f')],{'$or':_[_0x0974('0x2d')](_0x3ce302[_0x0974('0x38')],function(_0x54df02){var _0x367821={};_0x367821[_0x54df02]={'$like':'%'+_0x2ce15e[_0x0974('0x34')][_0x0974('0x41')]+'%'};return _0x367821;})});}_0x3ce302=_[_0x0974('0x42')]({},_0x3ce302,_0x2ce15e[_0x0974('0x44')]);return _0x1cac18[_0x0974('0x51')](_0x3ce302);}})['then'](function(_0x4aad10){if(_0x4aad10){_0x3de55c=_0x4aad10['length'];if(!_0x2ce15e[_0x0974('0x34')]['hasOwnProperty'](_0x0974('0x3c'))){_0x3ce302[_0x0974('0x1f')]=qs[_0x0974('0x1f')](_0x2ce15e['query'][_0x0974('0x1f')]);_0x3ce302['offset']=qs[_0x0974('0x1d')](_0x2ce15e[_0x0974('0x34')]['offset']);}return _0x1cac18[_0x0974('0x51')](_0x3ce302);}})[_0x0974('0x27')](function(_0x4b863d){if(_0x4b863d){return _0x4b863d?{'count':_0x3de55c,'rows':_0x4b863d}:null;}})[_0x0974('0x27')](respondWithResult(_0x33529e,null))['catch'](handleError(_0x33529e,null));};exports[_0x0974('0x52')]=function(_0x2fda43,_0x3dd86e,_0x141790){var _0x450e60={};var _0x28f707={};var _0x51243e;var _0x1c096a;return db[_0x0974('0x2e')]['findOne']({'where':{'id':_0x2fda43[_0x0974('0x4d')]['id']}})[_0x0974('0x27')](handleEntityNotFound(_0x3dd86e,null))[_0x0974('0x27')](function(_0x18dbdd){if(_0x18dbdd){_0x51243e=_0x18dbdd;_0x28f707[_0x0974('0x33')]=_[_0x0974('0x35')](db['SugarcrmField'][_0x0974('0x2f')]);_0x28f707[_0x0974('0x34')]=_[_0x0974('0x35')](_0x2fda43[_0x0974('0x34')]);_0x28f707[_0x0974('0x36')]=_[_0x0974('0x37')](_0x28f707[_0x0974('0x33')],_0x28f707[_0x0974('0x34')]);_0x450e60[_0x0974('0x38')]=_['intersection'](_0x28f707['model'],qs[_0x0974('0x39')](_0x2fda43[_0x0974('0x34')][_0x0974('0x39')]));_0x450e60[_0x0974('0x38')]=_0x450e60[_0x0974('0x38')][_0x0974('0x3a')]?_0x450e60[_0x0974('0x38')]:_0x28f707[_0x0974('0x33')];_0x450e60[_0x0974('0x3d')]=qs['sort'](_0x2fda43[_0x0974('0x34')][_0x0974('0x3e')]);_0x450e60[_0x0974('0x3f')]=qs[_0x0974('0x36')](_[_0x0974('0x40')](_0x2fda43[_0x0974('0x34')],_0x28f707[_0x0974('0x36')]));if(_0x2fda43[_0x0974('0x34')][_0x0974('0x41')]){_0x450e60['where']=_[_0x0974('0x42')](_0x450e60[_0x0974('0x3f')],{'$or':_['map'](_0x450e60[_0x0974('0x38')],function(_0x3b983c){var _0x4fb9ec={};_0x4fb9ec[_0x3b983c]={'$like':'%'+_0x2fda43[_0x0974('0x34')][_0x0974('0x41')]+'%'};return _0x4fb9ec;})});}_0x450e60=_[_0x0974('0x42')]({},_0x450e60,_0x2fda43[_0x0974('0x44')]);return _0x51243e['getDescriptions'](_0x450e60);}})[_0x0974('0x27')](function(_0x1ab469){if(_0x1ab469){_0x1c096a=_0x1ab469[_0x0974('0x3a')];if(!_0x2fda43[_0x0974('0x34')][_0x0974('0x3b')](_0x0974('0x3c'))){_0x450e60[_0x0974('0x1f')]=qs[_0x0974('0x1f')](_0x2fda43[_0x0974('0x34')][_0x0974('0x1f')]);_0x450e60[_0x0974('0x1d')]=qs[_0x0974('0x1d')](_0x2fda43[_0x0974('0x34')][_0x0974('0x1d')]);}return _0x51243e[_0x0974('0x52')](_0x450e60);}})[_0x0974('0x27')](function(_0x218e7c){if(_0x218e7c){return _0x218e7c?{'count':_0x1c096a,'rows':_0x218e7c}:null;}})['then'](respondWithResult(_0x3dd86e,null))['catch'](handleError(_0x3dd86e,null));}; \ No newline at end of file +var _0x9611=['find','create','body','catch','update','params','getFields','findOne','SugarcrmField','order','sort','getSubjects','hasOwnProperty','getDescriptions','eml-format','fast-json-patch','request-promise','moment','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','index','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','where','pick','merge','VIRTUAL','filter','options','includeAll','include','show'];(function(_0x2c8ee2,_0x589253){var _0x576b05=function(_0x2b3e40){while(--_0x2b3e40){_0x2c8ee2['push'](_0x2c8ee2['shift']());}};_0x576b05(++_0x589253);}(_0x9611,0xfe));var _0x1961=function(_0x1d2995,_0x46bc69){_0x1d2995=_0x1d2995-0x0;var _0x4c0b63=_0x9611[_0x1d2995];return _0x4c0b63;};'use strict';var emlformat=require(_0x1961('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1961('0x1'));var rp=require(_0x1961('0x2'));var moment=require(_0x1961('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x1961('0x4'));var sox=require(_0x1961('0x5'));var csv=require(_0x1961('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1961('0x7'));var _=require(_0x1961('0x8'));var squel=require(_0x1961('0x9'));var crypto=require('crypto');var jsforce=require(_0x1961('0xa'));var deskjs=require(_0x1961('0xb'));var toCsv=require(_0x1961('0x6'));var querystring=require(_0x1961('0xc'));var Papa=require(_0x1961('0xd'));var Redis=require(_0x1961('0xe'));var authService=require(_0x1961('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x1961('0x10'));var hardwareService=require(_0x1961('0x11'));var logger=require('../../config/logger')(_0x1961('0x12'));var utils=require(_0x1961('0x13'));var config=require(_0x1961('0x14'));var licenseUtil=require(_0x1961('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4a5786,_0x29144a){_0x29144a=_0x29144a||0xcc;return function(_0x281fc4){if(_0x281fc4){return _0x4a5786[_0x1961('0x16')](_0x29144a);}return _0x4a5786[_0x1961('0x17')](_0x29144a)[_0x1961('0x18')]();};}function respondWithResult(_0x26e88d,_0x358aed){_0x358aed=_0x358aed||0xc8;return function(_0x4954f0){if(_0x4954f0){return _0x26e88d[_0x1961('0x17')](_0x358aed)[_0x1961('0x19')](_0x4954f0);}};}function respondWithFilteredResult(_0x4bc43b,_0x154cb2){return function(_0x34dfd1){if(_0x34dfd1){var _0x2f2918=typeof _0x154cb2[_0x1961('0x1a')]===_0x1961('0x1b')&&typeof _0x154cb2[_0x1961('0x1c')]===_0x1961('0x1b');var _0x4c7e94=_0x34dfd1[_0x1961('0x1d')];var _0x20dc06=_0x2f2918?0x0:_0x154cb2[_0x1961('0x1a')];var _0x3b5220=_0x2f2918?_0x34dfd1['count']:_0x154cb2[_0x1961('0x1a')]+_0x154cb2[_0x1961('0x1c')];var _0x5d07d1;if(_0x3b5220>=_0x4c7e94){_0x3b5220=_0x4c7e94;_0x5d07d1=0xc8;}else{_0x5d07d1=0xce;}_0x4bc43b[_0x1961('0x17')](_0x5d07d1);return _0x4bc43b[_0x1961('0x1e')](_0x1961('0x1f'),_0x20dc06+'-'+_0x3b5220+'/'+_0x4c7e94)[_0x1961('0x19')](_0x34dfd1);}return null;};}function patchUpdates(_0x268aa0){return function(_0x3966ce){try{jsonpatch[_0x1961('0x20')](_0x3966ce,_0x268aa0,!![]);}catch(_0x7680e9){return BPromise[_0x1961('0x21')](_0x7680e9);}return _0x3966ce[_0x1961('0x22')]();};}function saveUpdates(_0x1d7395,_0x4ee5f0){return function(_0x16af75){if(_0x16af75){return _0x16af75['update'](_0x1d7395)['then'](function(_0x54f8ac){return _0x54f8ac;});}return null;};}function removeEntity(_0x2065c9,_0x4daedb){return function(_0x1f371e){if(_0x1f371e){return _0x1f371e[_0x1961('0x23')]()[_0x1961('0x24')](function(){_0x2065c9[_0x1961('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x497f37,_0x3035f9){return function(_0x1c0dfd){if(!_0x1c0dfd){_0x497f37[_0x1961('0x16')](0x194);}return _0x1c0dfd;};}function handleError(_0x293080,_0x2382f9){_0x2382f9=_0x2382f9||0x1f4;return function(_0x31aee9){logger[_0x1961('0x25')](_0x31aee9[_0x1961('0x26')]);if(_0x31aee9[_0x1961('0x27')]){delete _0x31aee9[_0x1961('0x27')];}_0x293080[_0x1961('0x17')](_0x2382f9)[_0x1961('0x28')](_0x31aee9);};}exports[_0x1961('0x29')]=function(_0x3315dd,_0x277ee8){var _0x1462dc={},_0x1bc5e9={},_0x426904={'count':0x0,'rows':[]};var _0x21ab91=_[_0x1961('0x2a')](db[_0x1961('0x2b')][_0x1961('0x2c')],function(_0x5e9da6){return{'name':_0x5e9da6[_0x1961('0x2d')],'type':_0x5e9da6[_0x1961('0x2e')][_0x1961('0x2f')]};});_0x1bc5e9['model']=_[_0x1961('0x2a')](_0x21ab91,_0x1961('0x27'));_0x1bc5e9[_0x1961('0x30')]=_[_0x1961('0x31')](_0x3315dd['query']);_0x1bc5e9[_0x1961('0x32')]=_[_0x1961('0x33')](_0x1bc5e9[_0x1961('0x34')],_0x1bc5e9[_0x1961('0x30')]);_0x1462dc['attributes']=_[_0x1961('0x33')](_0x1bc5e9[_0x1961('0x34')],qs['fields'](_0x3315dd['query'][_0x1961('0x35')]));_0x1462dc[_0x1961('0x36')]=_0x1462dc[_0x1961('0x36')][_0x1961('0x37')]?_0x1462dc[_0x1961('0x36')]:_0x1bc5e9['model'];if(!_0x3315dd[_0x1961('0x30')]['hasOwnProperty'](_0x1961('0x38'))){_0x1462dc[_0x1961('0x1c')]=qs[_0x1961('0x1c')](_0x3315dd[_0x1961('0x30')][_0x1961('0x1c')]);_0x1462dc[_0x1961('0x1a')]=qs['offset'](_0x3315dd['query']['offset']);}_0x1462dc['order']=qs['sort'](_0x3315dd[_0x1961('0x30')]['sort']);_0x1462dc[_0x1961('0x39')]=qs[_0x1961('0x32')](_[_0x1961('0x3a')](_0x3315dd[_0x1961('0x30')],_0x1bc5e9[_0x1961('0x32')]),_0x21ab91);if(_0x3315dd[_0x1961('0x30')]['filter']){_0x1462dc['where']=_[_0x1961('0x3b')](_0x1462dc[_0x1961('0x39')],{'$or':_['map'](_0x21ab91,function(_0xacc886){if(_0xacc886[_0x1961('0x2e')]!==_0x1961('0x3c')){var _0x2aa669={};_0x2aa669[_0xacc886[_0x1961('0x27')]]={'$like':'%'+_0x3315dd[_0x1961('0x30')][_0x1961('0x3d')]+'%'};return _0x2aa669;}})});}_0x1462dc=_[_0x1961('0x3b')]({},_0x1462dc,_0x3315dd[_0x1961('0x3e')]);var _0x2b723a={'where':_0x1462dc['where']};return db[_0x1961('0x2b')][_0x1961('0x1d')](_0x2b723a)[_0x1961('0x24')](function(_0x513089){_0x426904[_0x1961('0x1d')]=_0x513089;if(_0x3315dd[_0x1961('0x30')][_0x1961('0x3f')]){_0x1462dc[_0x1961('0x40')]=[{'all':!![]}];}return db[_0x1961('0x2b')]['findAll'](_0x1462dc);})[_0x1961('0x24')](function(_0x47e093){_0x426904['rows']=_0x47e093;return _0x426904;})[_0x1961('0x24')](respondWithFilteredResult(_0x277ee8,_0x1462dc))['catch'](handleError(_0x277ee8,null));};exports[_0x1961('0x41')]=function(_0x3abd49,_0x2b90cb){var _0x54f0f2={'raw':![],'where':{'id':_0x3abd49['params']['id']}},_0x353194={};_0x353194[_0x1961('0x34')]=_[_0x1961('0x31')](db[_0x1961('0x2b')]['rawAttributes']);_0x353194[_0x1961('0x30')]=_['keys'](_0x3abd49['query']);_0x353194[_0x1961('0x32')]=_[_0x1961('0x33')](_0x353194[_0x1961('0x34')],_0x353194[_0x1961('0x30')]);_0x54f0f2[_0x1961('0x36')]=_['intersection'](_0x353194['model'],qs['fields'](_0x3abd49[_0x1961('0x30')][_0x1961('0x35')]));_0x54f0f2[_0x1961('0x36')]=_0x54f0f2[_0x1961('0x36')][_0x1961('0x37')]?_0x54f0f2[_0x1961('0x36')]:_0x353194[_0x1961('0x34')];if(_0x3abd49[_0x1961('0x30')][_0x1961('0x3f')]){_0x54f0f2[_0x1961('0x40')]=[{'all':!![]}];}_0x54f0f2=_[_0x1961('0x3b')]({},_0x54f0f2,_0x3abd49[_0x1961('0x3e')]);return db[_0x1961('0x2b')][_0x1961('0x42')](_0x54f0f2)[_0x1961('0x24')](handleEntityNotFound(_0x2b90cb,null))[_0x1961('0x24')](respondWithResult(_0x2b90cb,null))['catch'](handleError(_0x2b90cb,null));};exports[_0x1961('0x43')]=function(_0x55b393,_0x370d66){return db[_0x1961('0x2b')][_0x1961('0x43')](_0x55b393[_0x1961('0x44')],{})['then'](respondWithResult(_0x370d66,0xc9))[_0x1961('0x45')](handleError(_0x370d66,null));};exports[_0x1961('0x46')]=function(_0x46facc,_0x18d346){if(_0x46facc[_0x1961('0x44')]['id']){delete _0x46facc['body']['id'];}return db['SugarcrmConfiguration'][_0x1961('0x42')]({'where':{'id':_0x46facc[_0x1961('0x47')]['id']}})[_0x1961('0x24')](handleEntityNotFound(_0x18d346,null))[_0x1961('0x24')](saveUpdates(_0x46facc[_0x1961('0x44')],null))[_0x1961('0x24')](respondWithResult(_0x18d346,null))['catch'](handleError(_0x18d346,null));};exports[_0x1961('0x23')]=function(_0x5020c7,_0x43fe5b){return db[_0x1961('0x2b')]['find']({'where':{'id':_0x5020c7['params']['id']}})['then'](handleEntityNotFound(_0x43fe5b,null))[_0x1961('0x24')](removeEntity(_0x43fe5b,null))[_0x1961('0x45')](handleError(_0x43fe5b,null));};exports[_0x1961('0x48')]=function(_0x120c11,_0x4de91a,_0x3b010a){var _0x212bf7={};var _0xe7ac25={};var _0x40e8c4;var _0x1d424c;return db[_0x1961('0x2b')][_0x1961('0x49')]({'where':{'id':_0x120c11['params']['id']}})[_0x1961('0x24')](handleEntityNotFound(_0x4de91a,null))[_0x1961('0x24')](function(_0x503a5c){if(_0x503a5c){_0x40e8c4=_0x503a5c;_0xe7ac25[_0x1961('0x34')]=_[_0x1961('0x31')](db[_0x1961('0x4a')][_0x1961('0x2c')]);_0xe7ac25[_0x1961('0x30')]=_[_0x1961('0x31')](_0x120c11[_0x1961('0x30')]);_0xe7ac25[_0x1961('0x32')]=_['intersection'](_0xe7ac25[_0x1961('0x34')],_0xe7ac25['query']);_0x212bf7[_0x1961('0x36')]=_['intersection'](_0xe7ac25[_0x1961('0x34')],qs[_0x1961('0x35')](_0x120c11[_0x1961('0x30')][_0x1961('0x35')]));_0x212bf7[_0x1961('0x36')]=_0x212bf7['attributes']['length']?_0x212bf7[_0x1961('0x36')]:_0xe7ac25[_0x1961('0x34')];_0x212bf7[_0x1961('0x4b')]=qs[_0x1961('0x4c')](_0x120c11[_0x1961('0x30')][_0x1961('0x4c')]);_0x212bf7['where']=qs[_0x1961('0x32')](_[_0x1961('0x3a')](_0x120c11[_0x1961('0x30')],_0xe7ac25[_0x1961('0x32')]));if(_0x120c11[_0x1961('0x30')][_0x1961('0x3d')]){_0x212bf7[_0x1961('0x39')]=_['merge'](_0x212bf7['where'],{'$or':_[_0x1961('0x2a')](_0x212bf7[_0x1961('0x36')],function(_0x3d60d3){var _0x391844={};_0x391844[_0x3d60d3]={'$like':'%'+_0x120c11['query'][_0x1961('0x3d')]+'%'};return _0x391844;})});}_0x212bf7=_[_0x1961('0x3b')]({},_0x212bf7,_0x120c11[_0x1961('0x3e')]);return _0x40e8c4[_0x1961('0x48')](_0x212bf7);}})[_0x1961('0x24')](function(_0x3d89c9){if(_0x3d89c9){_0x1d424c=_0x3d89c9[_0x1961('0x37')];if(!_0x120c11['query']['hasOwnProperty'](_0x1961('0x38'))){_0x212bf7[_0x1961('0x1c')]=qs[_0x1961('0x1c')](_0x120c11['query'][_0x1961('0x1c')]);_0x212bf7[_0x1961('0x1a')]=qs[_0x1961('0x1a')](_0x120c11[_0x1961('0x30')]['offset']);}return _0x40e8c4[_0x1961('0x48')](_0x212bf7);}})['then'](function(_0x29cb40){if(_0x29cb40){return _0x29cb40?{'count':_0x1d424c,'rows':_0x29cb40}:null;}})[_0x1961('0x24')](respondWithResult(_0x4de91a,null))[_0x1961('0x45')](handleError(_0x4de91a,null));};exports[_0x1961('0x4d')]=function(_0x593ebc,_0x5b8965,_0x523366){var _0x3aa1b4={};var _0x2ecd7b={};var _0x520c42;var _0x2e56e5;return db['SugarcrmConfiguration'][_0x1961('0x49')]({'where':{'id':_0x593ebc['params']['id']}})[_0x1961('0x24')](handleEntityNotFound(_0x5b8965,null))[_0x1961('0x24')](function(_0xf470da){if(_0xf470da){_0x520c42=_0xf470da;_0x2ecd7b[_0x1961('0x34')]=_[_0x1961('0x31')](db['SugarcrmField'][_0x1961('0x2c')]);_0x2ecd7b[_0x1961('0x30')]=_[_0x1961('0x31')](_0x593ebc['query']);_0x2ecd7b[_0x1961('0x32')]=_[_0x1961('0x33')](_0x2ecd7b['model'],_0x2ecd7b['query']);_0x3aa1b4[_0x1961('0x36')]=_[_0x1961('0x33')](_0x2ecd7b[_0x1961('0x34')],qs[_0x1961('0x35')](_0x593ebc[_0x1961('0x30')]['fields']));_0x3aa1b4[_0x1961('0x36')]=_0x3aa1b4[_0x1961('0x36')]['length']?_0x3aa1b4[_0x1961('0x36')]:_0x2ecd7b['model'];_0x3aa1b4[_0x1961('0x4b')]=qs[_0x1961('0x4c')](_0x593ebc[_0x1961('0x30')]['sort']);_0x3aa1b4[_0x1961('0x39')]=qs['filters'](_[_0x1961('0x3a')](_0x593ebc[_0x1961('0x30')],_0x2ecd7b['filters']));if(_0x593ebc[_0x1961('0x30')]['filter']){_0x3aa1b4[_0x1961('0x39')]=_['merge'](_0x3aa1b4['where'],{'$or':_[_0x1961('0x2a')](_0x3aa1b4[_0x1961('0x36')],function(_0x4d5495){var _0x53062c={};_0x53062c[_0x4d5495]={'$like':'%'+_0x593ebc[_0x1961('0x30')][_0x1961('0x3d')]+'%'};return _0x53062c;})});}_0x3aa1b4=_[_0x1961('0x3b')]({},_0x3aa1b4,_0x593ebc[_0x1961('0x3e')]);return _0x520c42[_0x1961('0x4d')](_0x3aa1b4);}})[_0x1961('0x24')](function(_0x311f8d){if(_0x311f8d){_0x2e56e5=_0x311f8d['length'];if(!_0x593ebc[_0x1961('0x30')][_0x1961('0x4e')](_0x1961('0x38'))){_0x3aa1b4[_0x1961('0x1c')]=qs[_0x1961('0x1c')](_0x593ebc[_0x1961('0x30')][_0x1961('0x1c')]);_0x3aa1b4['offset']=qs[_0x1961('0x1a')](_0x593ebc[_0x1961('0x30')][_0x1961('0x1a')]);}return _0x520c42[_0x1961('0x4d')](_0x3aa1b4);}})[_0x1961('0x24')](function(_0x259b20){if(_0x259b20){return _0x259b20?{'count':_0x2e56e5,'rows':_0x259b20}:null;}})['then'](respondWithResult(_0x5b8965,null))[_0x1961('0x45')](handleError(_0x5b8965,null));};exports[_0x1961('0x4f')]=function(_0x4108f7,_0x1d4194,_0x52dea0){var _0x51d347={};var _0x46115e={};var _0x5e98ca;var _0x19f592;return db[_0x1961('0x2b')]['findOne']({'where':{'id':_0x4108f7['params']['id']}})['then'](handleEntityNotFound(_0x1d4194,null))[_0x1961('0x24')](function(_0x24b0a){if(_0x24b0a){_0x5e98ca=_0x24b0a;_0x46115e[_0x1961('0x34')]=_[_0x1961('0x31')](db[_0x1961('0x4a')][_0x1961('0x2c')]);_0x46115e['query']=_['keys'](_0x4108f7[_0x1961('0x30')]);_0x46115e[_0x1961('0x32')]=_[_0x1961('0x33')](_0x46115e[_0x1961('0x34')],_0x46115e[_0x1961('0x30')]);_0x51d347[_0x1961('0x36')]=_['intersection'](_0x46115e[_0x1961('0x34')],qs[_0x1961('0x35')](_0x4108f7[_0x1961('0x30')][_0x1961('0x35')]));_0x51d347[_0x1961('0x36')]=_0x51d347[_0x1961('0x36')][_0x1961('0x37')]?_0x51d347['attributes']:_0x46115e[_0x1961('0x34')];_0x51d347[_0x1961('0x4b')]=qs[_0x1961('0x4c')](_0x4108f7['query']['sort']);_0x51d347[_0x1961('0x39')]=qs['filters'](_['pick'](_0x4108f7[_0x1961('0x30')],_0x46115e['filters']));if(_0x4108f7[_0x1961('0x30')][_0x1961('0x3d')]){_0x51d347['where']=_[_0x1961('0x3b')](_0x51d347[_0x1961('0x39')],{'$or':_[_0x1961('0x2a')](_0x51d347[_0x1961('0x36')],function(_0x58d867){var _0x4b53f6={};_0x4b53f6[_0x58d867]={'$like':'%'+_0x4108f7[_0x1961('0x30')][_0x1961('0x3d')]+'%'};return _0x4b53f6;})});}_0x51d347=_[_0x1961('0x3b')]({},_0x51d347,_0x4108f7[_0x1961('0x3e')]);return _0x5e98ca[_0x1961('0x4f')](_0x51d347);}})[_0x1961('0x24')](function(_0x1a605e){if(_0x1a605e){_0x19f592=_0x1a605e[_0x1961('0x37')];if(!_0x4108f7['query'][_0x1961('0x4e')]('nolimit')){_0x51d347['limit']=qs[_0x1961('0x1c')](_0x4108f7[_0x1961('0x30')][_0x1961('0x1c')]);_0x51d347[_0x1961('0x1a')]=qs[_0x1961('0x1a')](_0x4108f7[_0x1961('0x30')][_0x1961('0x1a')]);}return _0x5e98ca[_0x1961('0x4f')](_0x51d347);}})[_0x1961('0x24')](function(_0xcb649f){if(_0xcb649f){return _0xcb649f?{'count':_0x19f592,'rows':_0xcb649f}:null;}})[_0x1961('0x24')](respondWithResult(_0x1d4194,null))[_0x1961('0x45')](handleError(_0x1d4194,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 92b4d2d..b051a9f 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 _0xfcd3=['util','../../config/logger','api','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations'];(function(_0x759f0e,_0x2ee735){var _0x20c198=function(_0x52bc55){while(--_0x52bc55){_0x759f0e['push'](_0x759f0e['shift']());}};_0x20c198(++_0x2ee735);}(_0xfcd3,0xdc));var _0x3fcd=function(_0x5ac84c,_0x287781){_0x5ac84c=_0x5ac84c-0x0;var _0x3c53d2=_0xfcd3[_0x5ac84c];return _0x3c53d2;};'use strict';var _=require('lodash');var util=require(_0x3fcd('0x0'));var logger=require(_0x3fcd('0x1'))(_0x3fcd('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3fcd('0x3'));var config=require(_0x3fcd('0x4'));var attributes=require(_0x3fcd('0x5'));module[_0x3fcd('0x6')]=function(_0x548bb6,_0x4e7531){return _0x548bb6[_0x3fcd('0x7')](_0x3fcd('0x8'),attributes,{'tableName':_0x3fcd('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2ab8=['rimraf','./intSugarcrmConfiguration.attributes','exports','define','int_sugarcrm_configurations','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x469e94,_0x2392a6){var _0x396e2f=function(_0x4b93f6){while(--_0x4b93f6){_0x469e94['push'](_0x469e94['shift']());}};_0x396e2f(++_0x2392a6);}(_0x2ab8,0x170));var _0x82ab=function(_0x5971e1,_0x5357f1){_0x5971e1=_0x5971e1-0x0;var _0x3a95cd=_0x2ab8[_0x5971e1];return _0x3a95cd;};'use strict';var _=require(_0x82ab('0x0'));var util=require(_0x82ab('0x1'));var logger=require(_0x82ab('0x2'))('api');var moment=require(_0x82ab('0x3'));var BPromise=require(_0x82ab('0x4'));var rp=require(_0x82ab('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x82ab('0x6'));var config=require('../../config/environment');var attributes=require(_0x82ab('0x7'));module[_0x82ab('0x8')]=function(_0x5af2b8,_0x31cfbd){return _0x5af2b8[_0x82ab('0x9')]('SugarcrmConfiguration',attributes,{'tableName':_0x82ab('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 78e423c..9cb9daa 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 _0x394c=['result','lodash','moment','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','SugarcrmConfiguration,\x20%s,\x20%s','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x18bf6c,_0x40cce4){var _0x4030b1=function(_0x12b75e){while(--_0x12b75e){_0x18bf6c['push'](_0x18bf6c['shift']());}};_0x4030b1(++_0x40cce4);}(_0x394c,0x100));var _0xc394=function(_0xdd2bfa,_0x5bd304){_0xdd2bfa=_0xdd2bfa-0x0;var _0x55397e=_0x394c[_0xdd2bfa];return _0x55397e;};'use strict';var _=require(_0xc394('0x0'));var util=require('util');var moment=require(_0xc394('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc394('0x2'))['db'];var utils=require(_0xc394('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0xc394('0x4'));var jayson=require(_0xc394('0x5'));var client=jayson[_0xc394('0x6')][_0xc394('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x56ae8d,_0x533a3c,_0x424919){return new BPromise(function(_0x20e4c0,_0x5eca60){return client['request'](_0x56ae8d,_0x424919)[_0xc394('0x8')](function(_0x663ce){logger[_0xc394('0x9')](_0xc394('0xa'),_0x533a3c,'request\x20sent');logger[_0xc394('0xb')](_0xc394('0xc'),_0x533a3c,'request\x20sent',JSON['stringify'](_0x663ce));if(_0x663ce[_0xc394('0xd')]){if(_0x663ce[_0xc394('0xd')][_0xc394('0xe')]===0x1f4){logger[_0xc394('0xd')](_0xc394('0xa'),_0x533a3c,_0x663ce[_0xc394('0xd')][_0xc394('0xf')]);return _0x5eca60(_0x663ce[_0xc394('0xd')][_0xc394('0xf')]);}logger[_0xc394('0xd')](_0xc394('0xa'),_0x533a3c,_0x663ce['error'][_0xc394('0xf')]);return _0x20e4c0(_0x663ce['error'][_0xc394('0xf')]);}else{logger[_0xc394('0x9')](_0xc394('0xa'),_0x533a3c,'request\x20sent');_0x20e4c0(_0x663ce[_0xc394('0x10')][_0xc394('0xf')]);}})['catch'](function(_0x57acd4){logger['error'](_0xc394('0xa'),_0x533a3c,_0x57acd4);_0x5eca60(_0x57acd4);});});} \ No newline at end of file +var _0x5955=['../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','stringify','error','SugarcrmConfiguration,\x20%s,\x20%s','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x5955,0xf5));var _0x5595=function(_0x128450,_0x5869ba){_0x128450=_0x128450-0x0;var _0x4d80ed=_0x5955[_0x128450];return _0x4d80ed;};'use strict';var _=require(_0x5595('0x0'));var util=require('util');var moment=require(_0x5595('0x1'));var BPromise=require('bluebird');var rs=require(_0x5595('0x2'));var fs=require('fs');var Redis=require(_0x5595('0x3'));var db=require(_0x5595('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5595('0x5'))(_0x5595('0x6'));var config=require(_0x5595('0x7'));var jayson=require(_0x5595('0x8'));var client=jayson[_0x5595('0x9')][_0x5595('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x48414f,_0x1e7ed7,_0x5e64aa){return new BPromise(function(_0x1456d1,_0x53697b){return client[_0x5595('0xb')](_0x48414f,_0x5e64aa)[_0x5595('0xc')](function(_0x1097af){logger[_0x5595('0xd')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x1e7ed7,_0x5595('0xe'));logger['debug']('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x1e7ed7,'request\x20sent',JSON[_0x5595('0xf')](_0x1097af));if(_0x1097af['error']){if(_0x1097af[_0x5595('0x10')]['code']===0x1f4){logger['error'](_0x5595('0x11'),_0x1e7ed7,_0x1097af[_0x5595('0x10')][_0x5595('0x12')]);return _0x53697b(_0x1097af[_0x5595('0x10')][_0x5595('0x12')]);}logger[_0x5595('0x10')](_0x5595('0x11'),_0x1e7ed7,_0x1097af[_0x5595('0x10')][_0x5595('0x12')]);return _0x1456d1(_0x1097af[_0x5595('0x10')][_0x5595('0x12')]);}else{logger[_0x5595('0xd')](_0x5595('0x11'),_0x1e7ed7,'request\x20sent');_0x1456d1(_0x1097af[_0x5595('0x13')][_0x5595('0x12')]);}})[_0x5595('0x14')](function(_0x4f2ed8){logger['error'](_0x5595('0x11'),_0x1e7ed7,_0x4f2ed8);_0x53697b(_0x4f2ed8);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index c663445..c25a85c 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 _0xeba7=['/:id','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intSugarcrmField.controller','get','index','post','isAuthenticated','put','update'];(function(_0x24d0d2,_0x26aad8){var _0xbdebcc=function(_0x31d619){while(--_0x31d619){_0x24d0d2['push'](_0x24d0d2['shift']());}};_0xbdebcc(++_0x26aad8);}(_0xeba7,0x155));var _0x7eba=function(_0x1df5b9,_0x149d6b){_0x1df5b9=_0x1df5b9-0x0;var _0x24c9c2=_0xeba7[_0x1df5b9];return _0x24c9c2;};'use strict';var multer=require(_0x7eba('0x0'));var util=require(_0x7eba('0x1'));var path=require(_0x7eba('0x2'));var timeout=require(_0x7eba('0x3'));var express=require(_0x7eba('0x4'));var router=express[_0x7eba('0x5')]();var fs_extra=require(_0x7eba('0x6'));var auth=require(_0x7eba('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x7eba('0x8'));var controller=require(_0x7eba('0x9'));router[_0x7eba('0xa')]('/',auth['isAuthenticated'](),controller[_0x7eba('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x7eba('0xc')]('/',auth[_0x7eba('0xd')](),controller['create']);router[_0x7eba('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x7eba('0xf')]);router['delete'](_0x7eba('0x10'),auth[_0x7eba('0xd')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x70a5=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','index','/:id','isAuthenticated','show','post','put','update','delete','destroy','exports','util','path','express','Router'];(function(_0x161ac3,_0x142e49){var _0x3bb837=function(_0x269c7c){while(--_0x269c7c){_0x161ac3['push'](_0x161ac3['shift']());}};_0x3bb837(++_0x142e49);}(_0x70a5,0x1ea));var _0x570a=function(_0x2d4193,_0x409c52){_0x2d4193=_0x2d4193-0x0;var _0x2754f5=_0x70a5[_0x2d4193];return _0x2754f5;};'use strict';var multer=require('multer');var util=require(_0x570a('0x0'));var path=require(_0x570a('0x1'));var timeout=require('connect-timeout');var express=require(_0x570a('0x2'));var router=express[_0x570a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x570a('0x4'));var interaction=require(_0x570a('0x5'));var config=require(_0x570a('0x6'));var controller=require(_0x570a('0x7'));router[_0x570a('0x8')]('/',auth['isAuthenticated'](),controller[_0x570a('0x9')]);router[_0x570a('0x8')](_0x570a('0xa'),auth[_0x570a('0xb')](),controller[_0x570a('0xc')]);router[_0x570a('0xd')]('/',auth[_0x570a('0xb')](),controller['create']);router[_0x570a('0xe')]('/:id',auth[_0x570a('0xb')](),controller[_0x570a('0xf')]);router[_0x570a('0x10')]('/:id',auth[_0x570a('0xb')](),controller[_0x570a('0x11')]);module[_0x570a('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 749401a..447c5e6 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 _0x3054=['string','STRING','customVariable','BOOLEAN','sequelize','exports','ENUM','variable','keyValue','picklist'];(function(_0x52bfa5,_0x42cf21){var _0x26f80b=function(_0x73c5b0){while(--_0x73c5b0){_0x52bfa5['push'](_0x52bfa5['shift']());}};_0x26f80b(++_0x42cf21);}(_0x3054,0x108));var _0x4305=function(_0x1a5ef4,_0x217617){_0x1a5ef4=_0x1a5ef4-0x0;var _0x14c73d=_0x3054[_0x1a5ef4];return _0x14c73d;};'use strict';var Sequelize=require(_0x4305('0x0'));module[_0x4305('0x1')]={'type':{'type':Sequelize[_0x4305('0x2')]('string',_0x4305('0x3'),'customVariable',_0x4305('0x4'),_0x4305('0x5')),'defaultValue':_0x4305('0x6')},'content':{'type':Sequelize[_0x4305('0x7')]},'key':{'type':Sequelize[_0x4305('0x7')]},'keyType':{'type':Sequelize[_0x4305('0x2')](_0x4305('0x6'),_0x4305('0x3'),_0x4305('0x8'))},'keyContent':{'type':Sequelize[_0x4305('0x7')]},'idField':{'type':Sequelize[_0x4305('0x7')]},'nameField':{'type':Sequelize[_0x4305('0x7')]},'customField':{'type':Sequelize[_0x4305('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4305('0x7')]}}; \ No newline at end of file +var _0xbbb9=['sequelize','exports','ENUM','customVariable','string','STRING','variable'];(function(_0x323430,_0x3d2b6d){var _0x9eecd1=function(_0xab855a){while(--_0xab855a){_0x323430['push'](_0x323430['shift']());}};_0x9eecd1(++_0x3d2b6d);}(_0xbbb9,0x118));var _0x9bbb=function(_0x16a403,_0x38ad56){_0x16a403=_0x16a403-0x0;var _0x300a34=_0xbbb9[_0x16a403];return _0x300a34;};'use strict';var Sequelize=require(_0x9bbb('0x0'));module[_0x9bbb('0x1')]={'type':{'type':Sequelize[_0x9bbb('0x2')]('string','variable',_0x9bbb('0x3'),'keyValue','picklist'),'defaultValue':_0x9bbb('0x4')},'content':{'type':Sequelize[_0x9bbb('0x5')]},'key':{'type':Sequelize[_0x9bbb('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0x9bbb('0x4'),_0x9bbb('0x6'),_0x9bbb('0x3'))},'keyContent':{'type':Sequelize[_0x9bbb('0x5')]},'idField':{'type':Sequelize[_0x9bbb('0x5')]},'nameField':{'type':Sequelize[_0x9bbb('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'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 75eba64..4f477ec 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 _0x28c8=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','index','SugarcrmField','fieldName','type','model','map','query','intersection','attributes','fields','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','catch','params','keys','filters','length','find','create','body','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','ejs','squel','querystring'];(function(_0x54363f,_0x20c05b){var _0x1fa7b9=function(_0x285f07){while(--_0x285f07){_0x54363f['push'](_0x54363f['shift']());}};_0x1fa7b9(++_0x20c05b);}(_0x28c8,0xf9));var _0x828c=function(_0x5caf7e,_0x52e1bc){_0x5caf7e=_0x5caf7e-0x0;var _0x5c3435=_0x28c8[_0x5caf7e];return _0x5c3435;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x828c('0x0'));var zipdir=require(_0x828c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x828c('0x2'));var moment=require('moment');var BPromise=require(_0x828c('0x3'));var Mustache=require(_0x828c('0x4'));var util=require(_0x828c('0x5'));var path=require(_0x828c('0x6'));var sox=require('sox');var csv=require(_0x828c('0x7'));var ejs=require(_0x828c('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x828c('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x828c('0xa'));var Papa=require(_0x828c('0xb'));var Redis=require(_0x828c('0xc'));var authService=require(_0x828c('0xd'));var qs=require(_0x828c('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x828c('0xf'));var logger=require(_0x828c('0x10'))('api');var utils=require(_0x828c('0x11'));var config=require(_0x828c('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x828c('0x13'))['db'];function respondWithStatusCode(_0x3bc037,_0xb5279a){_0xb5279a=_0xb5279a||0xcc;return function(_0xf445ba){if(_0xf445ba){return _0x3bc037[_0x828c('0x14')](_0xb5279a);}return _0x3bc037[_0x828c('0x15')](_0xb5279a)[_0x828c('0x16')]();};}function respondWithResult(_0xd82223,_0x5492c5){_0x5492c5=_0x5492c5||0xc8;return function(_0x46cd15){if(_0x46cd15){return _0xd82223[_0x828c('0x15')](_0x5492c5)[_0x828c('0x17')](_0x46cd15);}};}function respondWithFilteredResult(_0x4b803c,_0x225e39){return function(_0x5e869b){if(_0x5e869b){var _0x133cf9=typeof _0x225e39[_0x828c('0x18')]===_0x828c('0x19')&&typeof _0x225e39['limit']===_0x828c('0x19');var _0x5aa3f9=_0x5e869b['count'];var _0x53539f=_0x133cf9?0x0:_0x225e39[_0x828c('0x18')];var _0x3ec04b=_0x133cf9?_0x5e869b[_0x828c('0x1a')]:_0x225e39[_0x828c('0x18')]+_0x225e39[_0x828c('0x1b')];var _0x21b2ea;if(_0x3ec04b>=_0x5aa3f9){_0x3ec04b=_0x5aa3f9;_0x21b2ea=0xc8;}else{_0x21b2ea=0xce;}_0x4b803c[_0x828c('0x15')](_0x21b2ea);return _0x4b803c[_0x828c('0x1c')](_0x828c('0x1d'),_0x53539f+'-'+_0x3ec04b+'/'+_0x5aa3f9)[_0x828c('0x17')](_0x5e869b);}return null;};}function patchUpdates(_0x685f2d){return function(_0x497f29){try{jsonpatch[_0x828c('0x1e')](_0x497f29,_0x685f2d,!![]);}catch(_0x270c4f){return BPromise[_0x828c('0x1f')](_0x270c4f);}return _0x497f29[_0x828c('0x20')]();};}function saveUpdates(_0x130b65,_0x225dd7){return function(_0xa3f9b3){if(_0xa3f9b3){return _0xa3f9b3[_0x828c('0x21')](_0x130b65)['then'](function(_0x1e73e5){return _0x1e73e5;});}return null;};}function removeEntity(_0x3c3000,_0x1bd56e){return function(_0x5c4d5e){if(_0x5c4d5e){return _0x5c4d5e[_0x828c('0x22')]()[_0x828c('0x23')](function(){_0x3c3000[_0x828c('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0xdf5cb8,_0x4d2025){return function(_0x5f2fa5){if(!_0x5f2fa5){_0xdf5cb8[_0x828c('0x14')](0x194);}return _0x5f2fa5;};}function handleError(_0x3639e9,_0x46bd3e){_0x46bd3e=_0x46bd3e||0x1f4;return function(_0x16a12e){logger['error'](_0x16a12e[_0x828c('0x24')]);if(_0x16a12e[_0x828c('0x25')]){delete _0x16a12e[_0x828c('0x25')];}_0x3639e9[_0x828c('0x15')](_0x46bd3e)['send'](_0x16a12e);};}exports[_0x828c('0x26')]=function(_0x3c060b,_0x363f99){var _0x507e5e={},_0x2b8cd0={},_0x58919e={'count':0x0,'rows':[]};var _0x565e88=_['map'](db[_0x828c('0x27')]['rawAttributes'],function(_0xbf7048){return{'name':_0xbf7048[_0x828c('0x28')],'type':_0xbf7048[_0x828c('0x29')]['key']};});_0x2b8cd0[_0x828c('0x2a')]=_[_0x828c('0x2b')](_0x565e88,_0x828c('0x25'));_0x2b8cd0[_0x828c('0x2c')]=_['keys'](_0x3c060b[_0x828c('0x2c')]);_0x2b8cd0['filters']=_[_0x828c('0x2d')](_0x2b8cd0[_0x828c('0x2a')],_0x2b8cd0['query']);_0x507e5e[_0x828c('0x2e')]=_['intersection'](_0x2b8cd0[_0x828c('0x2a')],qs[_0x828c('0x2f')](_0x3c060b[_0x828c('0x2c')][_0x828c('0x2f')]));_0x507e5e['attributes']=_0x507e5e[_0x828c('0x2e')]['length']?_0x507e5e[_0x828c('0x2e')]:_0x2b8cd0[_0x828c('0x2a')];if(!_0x3c060b[_0x828c('0x2c')]['hasOwnProperty']('nolimit')){_0x507e5e[_0x828c('0x1b')]=qs[_0x828c('0x1b')](_0x3c060b['query'][_0x828c('0x1b')]);_0x507e5e[_0x828c('0x18')]=qs['offset'](_0x3c060b[_0x828c('0x2c')][_0x828c('0x18')]);}_0x507e5e[_0x828c('0x30')]=qs[_0x828c('0x31')](_0x3c060b[_0x828c('0x2c')][_0x828c('0x31')]);_0x507e5e[_0x828c('0x32')]=qs['filters'](_['pick'](_0x3c060b[_0x828c('0x2c')],_0x2b8cd0['filters']),_0x565e88);if(_0x3c060b[_0x828c('0x2c')][_0x828c('0x33')]){_0x507e5e[_0x828c('0x32')]=_[_0x828c('0x34')](_0x507e5e['where'],{'$or':_['map'](_0x565e88,function(_0x39bb13){if(_0x39bb13[_0x828c('0x29')]!==_0x828c('0x35')){var _0x155882={};_0x155882[_0x39bb13['name']]={'$like':'%'+_0x3c060b[_0x828c('0x2c')]['filter']+'%'};return _0x155882;}})});}_0x507e5e=_[_0x828c('0x34')]({},_0x507e5e,_0x3c060b[_0x828c('0x36')]);var _0x20c03d={'where':_0x507e5e[_0x828c('0x32')]};return db[_0x828c('0x27')][_0x828c('0x1a')](_0x20c03d)['then'](function(_0x460ba2){_0x58919e[_0x828c('0x1a')]=_0x460ba2;if(_0x3c060b[_0x828c('0x2c')]['includeAll']){_0x507e5e[_0x828c('0x37')]=[{'all':!![]}];}return db[_0x828c('0x27')][_0x828c('0x38')](_0x507e5e);})[_0x828c('0x23')](function(_0xc50bcd){_0x58919e['rows']=_0xc50bcd;return _0x58919e;})[_0x828c('0x23')](respondWithFilteredResult(_0x363f99,_0x507e5e))[_0x828c('0x39')](handleError(_0x363f99,null));};exports['show']=function(_0x3bd913,_0x35f3bf){var _0x257497={'raw':!![],'where':{'id':_0x3bd913[_0x828c('0x3a')]['id']}},_0x5694ed={};_0x5694ed[_0x828c('0x2a')]=_[_0x828c('0x3b')](db[_0x828c('0x27')]['rawAttributes']);_0x5694ed['query']=_[_0x828c('0x3b')](_0x3bd913['query']);_0x5694ed[_0x828c('0x3c')]=_[_0x828c('0x2d')](_0x5694ed[_0x828c('0x2a')],_0x5694ed[_0x828c('0x2c')]);_0x257497[_0x828c('0x2e')]=_[_0x828c('0x2d')](_0x5694ed['model'],qs['fields'](_0x3bd913[_0x828c('0x2c')]['fields']));_0x257497[_0x828c('0x2e')]=_0x257497['attributes'][_0x828c('0x3d')]?_0x257497[_0x828c('0x2e')]:_0x5694ed['model'];if(_0x3bd913['query']['includeAll']){_0x257497['include']=[{'all':!![]}];}_0x257497=_[_0x828c('0x34')]({},_0x257497,_0x3bd913[_0x828c('0x36')]);return db[_0x828c('0x27')][_0x828c('0x3e')](_0x257497)[_0x828c('0x23')](handleEntityNotFound(_0x35f3bf,null))['then'](respondWithResult(_0x35f3bf,null))[_0x828c('0x39')](handleError(_0x35f3bf,null));};exports[_0x828c('0x3f')]=function(_0x273f9e,_0xed7d64){return db[_0x828c('0x27')][_0x828c('0x3f')](_0x273f9e[_0x828c('0x40')],{})[_0x828c('0x23')](respondWithResult(_0xed7d64,0xc9))[_0x828c('0x39')](handleError(_0xed7d64,null));};exports[_0x828c('0x21')]=function(_0x20caa1,_0x6c0dd1){if(_0x20caa1['body']['id']){delete _0x20caa1[_0x828c('0x40')]['id'];}return db['SugarcrmField'][_0x828c('0x3e')]({'where':{'id':_0x20caa1[_0x828c('0x3a')]['id']}})[_0x828c('0x23')](handleEntityNotFound(_0x6c0dd1,null))['then'](saveUpdates(_0x20caa1[_0x828c('0x40')],null))[_0x828c('0x23')](respondWithResult(_0x6c0dd1,null))[_0x828c('0x39')](handleError(_0x6c0dd1,null));};exports['destroy']=function(_0x1553b1,_0x5352bb){return db[_0x828c('0x27')][_0x828c('0x3e')]({'where':{'id':_0x1553b1[_0x828c('0x3a')]['id']}})[_0x828c('0x23')](handleEntityNotFound(_0x5352bb,null))['then'](removeEntity(_0x5352bb,null))[_0x828c('0x39')](handleError(_0x5352bb,null));}; \ No newline at end of file +var _0xffae=['reject','save','then','destroy','name','send','index','rawAttributes','fieldName','key','query','filters','model','fields','attributes','length','nolimit','sort','where','pick','merge','type','VIRTUAL','options','SugarcrmField','includeAll','include','findAll','rows','catch','show','params','keys','intersection','create','body','update','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','jsforce','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json'];(function(_0x16e57d,_0x2cb7ba){var _0x40239c=function(_0x3cc8f0){while(--_0x3cc8f0){_0x16e57d['push'](_0x16e57d['shift']());}};_0x40239c(++_0x2cb7ba);}(_0xffae,0x189));var _0xeffa=function(_0x53df84,_0x5eca44){_0x53df84=_0x53df84-0x0;var _0xb89ebc=_0xffae[_0x53df84];return _0xb89ebc;};'use strict';var emlformat=require(_0xeffa('0x0'));var rimraf=require(_0xeffa('0x1'));var zipdir=require(_0xeffa('0x2'));var jsonpatch=require(_0xeffa('0x3'));var rp=require(_0xeffa('0x4'));var moment=require(_0xeffa('0x5'));var BPromise=require(_0xeffa('0x6'));var Mustache=require('mustache');var util=require(_0xeffa('0x7'));var path=require('path');var sox=require(_0xeffa('0x8'));var csv=require(_0xeffa('0x9'));var ejs=require(_0xeffa('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeffa('0xb'));var squel=require(_0xeffa('0xc'));var crypto=require('crypto');var jsforce=require(_0xeffa('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xeffa('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xeffa('0xe'));var authService=require(_0xeffa('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xeffa('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xeffa('0x11'))(_0xeffa('0x12'));var utils=require(_0xeffa('0x13'));var config=require(_0xeffa('0x14'));var licenseUtil=require(_0xeffa('0x15'));var db=require(_0xeffa('0x16'))['db'];function respondWithStatusCode(_0x4e20bd,_0x37013e){_0x37013e=_0x37013e||0xcc;return function(_0x57dad3){if(_0x57dad3){return _0x4e20bd[_0xeffa('0x17')](_0x37013e);}return _0x4e20bd[_0xeffa('0x18')](_0x37013e)[_0xeffa('0x19')]();};}function respondWithResult(_0x20cdd0,_0x15bfbc){_0x15bfbc=_0x15bfbc||0xc8;return function(_0x39d112){if(_0x39d112){return _0x20cdd0[_0xeffa('0x18')](_0x15bfbc)['json'](_0x39d112);}};}function respondWithFilteredResult(_0x1b1e60,_0x4475e8){return function(_0x5c01a3){if(_0x5c01a3){var _0x2e2d8d=typeof _0x4475e8[_0xeffa('0x1a')]==='undefined'&&typeof _0x4475e8[_0xeffa('0x1b')]===_0xeffa('0x1c');var _0x5049a4=_0x5c01a3[_0xeffa('0x1d')];var _0x514ab1=_0x2e2d8d?0x0:_0x4475e8[_0xeffa('0x1a')];var _0x1e8495=_0x2e2d8d?_0x5c01a3[_0xeffa('0x1d')]:_0x4475e8['offset']+_0x4475e8[_0xeffa('0x1b')];var _0x5a1862;if(_0x1e8495>=_0x5049a4){_0x1e8495=_0x5049a4;_0x5a1862=0xc8;}else{_0x5a1862=0xce;}_0x1b1e60[_0xeffa('0x18')](_0x5a1862);return _0x1b1e60[_0xeffa('0x1e')](_0xeffa('0x1f'),_0x514ab1+'-'+_0x1e8495+'/'+_0x5049a4)[_0xeffa('0x20')](_0x5c01a3);}return null;};}function patchUpdates(_0x46ce0f){return function(_0x4ddd7e){try{jsonpatch['apply'](_0x4ddd7e,_0x46ce0f,!![]);}catch(_0x51ec90){return BPromise[_0xeffa('0x21')](_0x51ec90);}return _0x4ddd7e[_0xeffa('0x22')]();};}function saveUpdates(_0x419bbf,_0x3f0194){return function(_0x5b274a){if(_0x5b274a){return _0x5b274a['update'](_0x419bbf)[_0xeffa('0x23')](function(_0x21cc06){return _0x21cc06;});}return null;};}function removeEntity(_0x129e23,_0x21faac){return function(_0x57eaa5){if(_0x57eaa5){return _0x57eaa5[_0xeffa('0x24')]()[_0xeffa('0x23')](function(){_0x129e23[_0xeffa('0x18')](0xcc)[_0xeffa('0x19')]();});}};}function handleEntityNotFound(_0x30955b,_0xe58ca){return function(_0x5b18f5){if(!_0x5b18f5){_0x30955b[_0xeffa('0x17')](0x194);}return _0x5b18f5;};}function handleError(_0x4a7135,_0x2c8f5f){_0x2c8f5f=_0x2c8f5f||0x1f4;return function(_0x2c2293){logger['error'](_0x2c2293['stack']);if(_0x2c2293[_0xeffa('0x25')]){delete _0x2c2293['name'];}_0x4a7135[_0xeffa('0x18')](_0x2c8f5f)[_0xeffa('0x26')](_0x2c2293);};}exports[_0xeffa('0x27')]=function(_0x43ce1e,_0x3910d1){var _0x2eb2cc={},_0x48b1cd={},_0x373ff8={'count':0x0,'rows':[]};var _0x15a7e9=_['map'](db['SugarcrmField'][_0xeffa('0x28')],function(_0x5bfa27){return{'name':_0x5bfa27[_0xeffa('0x29')],'type':_0x5bfa27['type'][_0xeffa('0x2a')]};});_0x48b1cd['model']=_['map'](_0x15a7e9,_0xeffa('0x25'));_0x48b1cd[_0xeffa('0x2b')]=_['keys'](_0x43ce1e[_0xeffa('0x2b')]);_0x48b1cd[_0xeffa('0x2c')]=_['intersection'](_0x48b1cd[_0xeffa('0x2d')],_0x48b1cd[_0xeffa('0x2b')]);_0x2eb2cc['attributes']=_['intersection'](_0x48b1cd[_0xeffa('0x2d')],qs[_0xeffa('0x2e')](_0x43ce1e[_0xeffa('0x2b')][_0xeffa('0x2e')]));_0x2eb2cc['attributes']=_0x2eb2cc[_0xeffa('0x2f')][_0xeffa('0x30')]?_0x2eb2cc['attributes']:_0x48b1cd[_0xeffa('0x2d')];if(!_0x43ce1e['query']['hasOwnProperty'](_0xeffa('0x31'))){_0x2eb2cc['limit']=qs[_0xeffa('0x1b')](_0x43ce1e[_0xeffa('0x2b')][_0xeffa('0x1b')]);_0x2eb2cc['offset']=qs[_0xeffa('0x1a')](_0x43ce1e['query'][_0xeffa('0x1a')]);}_0x2eb2cc['order']=qs[_0xeffa('0x32')](_0x43ce1e['query']['sort']);_0x2eb2cc[_0xeffa('0x33')]=qs[_0xeffa('0x2c')](_[_0xeffa('0x34')](_0x43ce1e[_0xeffa('0x2b')],_0x48b1cd[_0xeffa('0x2c')]),_0x15a7e9);if(_0x43ce1e[_0xeffa('0x2b')]['filter']){_0x2eb2cc['where']=_[_0xeffa('0x35')](_0x2eb2cc['where'],{'$or':_['map'](_0x15a7e9,function(_0x18d999){if(_0x18d999[_0xeffa('0x36')]!==_0xeffa('0x37')){var _0x39c4a2={};_0x39c4a2[_0x18d999[_0xeffa('0x25')]]={'$like':'%'+_0x43ce1e[_0xeffa('0x2b')]['filter']+'%'};return _0x39c4a2;}})});}_0x2eb2cc=_['merge']({},_0x2eb2cc,_0x43ce1e[_0xeffa('0x38')]);var _0x3cb538={'where':_0x2eb2cc['where']};return db[_0xeffa('0x39')]['count'](_0x3cb538)[_0xeffa('0x23')](function(_0x7e337d){_0x373ff8[_0xeffa('0x1d')]=_0x7e337d;if(_0x43ce1e['query'][_0xeffa('0x3a')]){_0x2eb2cc[_0xeffa('0x3b')]=[{'all':!![]}];}return db['SugarcrmField'][_0xeffa('0x3c')](_0x2eb2cc);})[_0xeffa('0x23')](function(_0x5c0cc1){_0x373ff8[_0xeffa('0x3d')]=_0x5c0cc1;return _0x373ff8;})['then'](respondWithFilteredResult(_0x3910d1,_0x2eb2cc))[_0xeffa('0x3e')](handleError(_0x3910d1,null));};exports[_0xeffa('0x3f')]=function(_0x4607c9,_0x7a388){var _0x198a77={'raw':!![],'where':{'id':_0x4607c9[_0xeffa('0x40')]['id']}},_0x31e0c6={};_0x31e0c6[_0xeffa('0x2d')]=_['keys'](db[_0xeffa('0x39')][_0xeffa('0x28')]);_0x31e0c6[_0xeffa('0x2b')]=_[_0xeffa('0x41')](_0x4607c9[_0xeffa('0x2b')]);_0x31e0c6['filters']=_['intersection'](_0x31e0c6['model'],_0x31e0c6[_0xeffa('0x2b')]);_0x198a77[_0xeffa('0x2f')]=_[_0xeffa('0x42')](_0x31e0c6['model'],qs[_0xeffa('0x2e')](_0x4607c9['query']['fields']));_0x198a77['attributes']=_0x198a77['attributes'][_0xeffa('0x30')]?_0x198a77[_0xeffa('0x2f')]:_0x31e0c6[_0xeffa('0x2d')];if(_0x4607c9[_0xeffa('0x2b')]['includeAll']){_0x198a77['include']=[{'all':!![]}];}_0x198a77=_['merge']({},_0x198a77,_0x4607c9[_0xeffa('0x38')]);return db['SugarcrmField']['find'](_0x198a77)['then'](handleEntityNotFound(_0x7a388,null))[_0xeffa('0x23')](respondWithResult(_0x7a388,null))[_0xeffa('0x3e')](handleError(_0x7a388,null));};exports['create']=function(_0xa370b4,_0x3f7e7d){return db['SugarcrmField'][_0xeffa('0x43')](_0xa370b4[_0xeffa('0x44')],{})['then'](respondWithResult(_0x3f7e7d,0xc9))[_0xeffa('0x3e')](handleError(_0x3f7e7d,null));};exports[_0xeffa('0x45')]=function(_0x14beb4,_0x4e2590){if(_0x14beb4[_0xeffa('0x44')]['id']){delete _0x14beb4[_0xeffa('0x44')]['id'];}return db['SugarcrmField'][_0xeffa('0x46')]({'where':{'id':_0x14beb4[_0xeffa('0x40')]['id']}})[_0xeffa('0x23')](handleEntityNotFound(_0x4e2590,null))[_0xeffa('0x23')](saveUpdates(_0x14beb4['body'],null))['then'](respondWithResult(_0x4e2590,null))['catch'](handleError(_0x4e2590,null));};exports[_0xeffa('0x24')]=function(_0x35b82b,_0xaf17ef){return db['SugarcrmField'][_0xeffa('0x46')]({'where':{'id':_0x35b82b[_0xeffa('0x40')]['id']}})[_0xeffa('0x23')](handleEntityNotFound(_0xaf17ef,null))['then'](removeEntity(_0xaf17ef,null))[_0xeffa('0x3e')](handleError(_0xaf17ef,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 93c66ce..14ab338 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 _0x8b9e=['exports','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','FieldId','lodash','util','moment','request-promise','path','rimraf','../../config/environment','./intSugarcrmField.attributes'];(function(_0x277107,_0x3420dc){var _0x1da046=function(_0x47122d){while(--_0x47122d){_0x277107['push'](_0x277107['shift']());}};_0x1da046(++_0x3420dc);}(_0x8b9e,0x7a));var _0xe8b9=function(_0x1aa011,_0x16332d){_0x1aa011=_0x1aa011-0x0;var _0x4d66e4=_0x8b9e[_0x1aa011];return _0x4d66e4;};'use strict';var _=require(_0xe8b9('0x0'));var util=require(_0xe8b9('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xe8b9('0x2'));var BPromise=require('bluebird');var rp=require(_0xe8b9('0x3'));var fs=require('fs');var path=require(_0xe8b9('0x4'));var rimraf=require(_0xe8b9('0x5'));var config=require(_0xe8b9('0x6'));var attributes=require(_0xe8b9('0x7'));module[_0xe8b9('0x8')]=function(_0x3dbbac,_0x55f2d4){return _0x3dbbac['define'](_0xe8b9('0x9'),attributes,{'tableName':_0xe8b9('0xa'),'paranoid':![],'indexes':[{'name':_0xe8b9('0xb'),'fields':['idField',_0xe8b9('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0b7a=['int_sugarcrm_fields','sugarcrm_unique_index','idField','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./intSugarcrmField.attributes','define','SugarcrmField'];(function(_0x7bd093,_0x44c0a7){var _0x3671ac=function(_0x53a843){while(--_0x53a843){_0x7bd093['push'](_0x7bd093['shift']());}};_0x3671ac(++_0x44c0a7);}(_0x0b7a,0x1df));var _0xa0b7=function(_0xaae91e,_0x571a4e){_0xaae91e=_0xaae91e-0x0;var _0x2967fd=_0x0b7a[_0xaae91e];return _0x2967fd;};'use strict';var _=require(_0xa0b7('0x0'));var util=require(_0xa0b7('0x1'));var logger=require(_0xa0b7('0x2'))('api');var moment=require(_0xa0b7('0x3'));var BPromise=require(_0xa0b7('0x4'));var rp=require(_0xa0b7('0x5'));var fs=require('fs');var path=require(_0xa0b7('0x6'));var rimraf=require(_0xa0b7('0x7'));var config=require('../../config/environment');var attributes=require(_0xa0b7('0x8'));module['exports']=function(_0x1f0b11,_0x286d8e){return _0x1f0b11[_0xa0b7('0x9')](_0xa0b7('0xa'),attributes,{'tableName':_0xa0b7('0xb'),'paranoid':![],'indexes':[{'name':_0xa0b7('0xc'),'fields':[_0xa0b7('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index 02e6e2f..9ed8778 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 _0xcbbb=['moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','code','error','message','util'];(function(_0x338b2b,_0x566a28){var _0x2f7ce1=function(_0x70c935){while(--_0x70c935){_0x338b2b['push'](_0x338b2b['shift']());}};_0x2f7ce1(++_0x566a28);}(_0xcbbb,0x14f));var _0xbcbb=function(_0x3203a1,_0x46c498){_0x3203a1=_0x3203a1-0x0;var _0x24215e=_0xcbbb[_0x3203a1];return _0x24215e;};'use strict';var _=require('lodash');var util=require(_0xbcbb('0x0'));var moment=require(_0xbcbb('0x1'));var BPromise=require(_0xbcbb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbcbb('0x3'));var db=require(_0xbcbb('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xbcbb('0x5'))(_0xbcbb('0x6'));var config=require(_0xbcbb('0x7'));var jayson=require(_0xbcbb('0x8'));var client=jayson[_0xbcbb('0x9')][_0xbcbb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ccdb4,_0x3995c9,_0x2189ab){return new BPromise(function(_0x39a3bb,_0x25694e){return client[_0xbcbb('0xb')](_0x5ccdb4,_0x2189ab)['then'](function(_0x1de3e2){logger[_0xbcbb('0xc')](_0xbcbb('0xd'),_0x3995c9,_0xbcbb('0xe'));logger[_0xbcbb('0xf')](_0xbcbb('0x10'),_0x3995c9,'request\x20sent',JSON[_0xbcbb('0x11')](_0x1de3e2));if(_0x1de3e2['error']){if(_0x1de3e2['error'][_0xbcbb('0x12')]===0x1f4){logger[_0xbcbb('0x13')]('SugarcrmField,\x20%s,\x20%s',_0x3995c9,_0x1de3e2[_0xbcbb('0x13')][_0xbcbb('0x14')]);return _0x25694e(_0x1de3e2[_0xbcbb('0x13')][_0xbcbb('0x14')]);}logger['error'](_0xbcbb('0xd'),_0x3995c9,_0x1de3e2[_0xbcbb('0x13')][_0xbcbb('0x14')]);return _0x39a3bb(_0x1de3e2[_0xbcbb('0x13')][_0xbcbb('0x14')]);}else{logger['info'](_0xbcbb('0xd'),_0x3995c9,_0xbcbb('0xe'));_0x39a3bb(_0x1de3e2['result']['message']);}})['catch'](function(_0x32ae1d){logger['error'](_0xbcbb('0xd'),_0x3995c9,_0x32ae1d);_0x25694e(_0x32ae1d);});});} \ No newline at end of file +var _0xf50f=['info','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message'];(function(_0x1227bc,_0x398a69){var _0x14688a=function(_0x4b90b5){while(--_0x4b90b5){_0x1227bc['push'](_0x1227bc['shift']());}};_0x14688a(++_0x398a69);}(_0xf50f,0xde));var _0xff50=function(_0x3c907d,_0x4642f0){_0x3c907d=_0x3c907d-0x0;var _0x66a576=_0xf50f[_0x3c907d];return _0x66a576;};'use strict';var _=require(_0xff50('0x0'));var util=require('util');var moment=require(_0xff50('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xff50('0x2'));var db=require(_0xff50('0x3'))['db'];var utils=require(_0xff50('0x4'));var logger=require(_0xff50('0x5'))(_0xff50('0x6'));var config=require(_0xff50('0x7'));var jayson=require(_0xff50('0x8'));var client=jayson[_0xff50('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2bfc21,_0x11e7c5,_0x31966a){return new BPromise(function(_0x34ada0,_0x1f4ca3){return client[_0xff50('0xa')](_0x2bfc21,_0x31966a)[_0xff50('0xb')](function(_0x2c227a){logger['info'](_0xff50('0xc'),_0x11e7c5,_0xff50('0xd'));logger[_0xff50('0xe')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x11e7c5,_0xff50('0xd'),JSON[_0xff50('0xf')](_0x2c227a));if(_0x2c227a[_0xff50('0x10')]){if(_0x2c227a[_0xff50('0x10')]['code']===0x1f4){logger[_0xff50('0x10')](_0xff50('0xc'),_0x11e7c5,_0x2c227a['error']['message']);return _0x1f4ca3(_0x2c227a['error'][_0xff50('0x11')]);}logger[_0xff50('0x10')](_0xff50('0xc'),_0x11e7c5,_0x2c227a['error'][_0xff50('0x11')]);return _0x34ada0(_0x2c227a[_0xff50('0x10')][_0xff50('0x11')]);}else{logger[_0xff50('0x12')](_0xff50('0xc'),_0x11e7c5,_0xff50('0xd'));_0x34ada0(_0x2c227a['result'][_0xff50('0x11')]);}})[_0xff50('0x13')](function(_0x429cd8){logger[_0xff50('0x10')](_0xff50('0xc'),_0x11e7c5,_0x429cd8);_0x1f4ca3(_0x429cd8);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 78307a7..7a7a255 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 _0x8c39=['fs-extra','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','isAuthenticated','index','/:id','show','get','/:id/fields','post','create','/:id/configurations','put','update','delete','exports','multer','path','connect-timeout','express','Router'];(function(_0x50fb37,_0x30e9d5){var _0x995c5e=function(_0x449b03){while(--_0x449b03){_0x50fb37['push'](_0x50fb37['shift']());}};_0x995c5e(++_0x30e9d5);}(_0x8c39,0x1df));var _0x98c3=function(_0x224c8d,_0x2cc9dd){_0x224c8d=_0x224c8d-0x0;var _0xacf452=_0x8c39[_0x224c8d];return _0xacf452;};'use strict';var multer=require(_0x98c3('0x0'));var util=require('util');var path=require(_0x98c3('0x1'));var timeout=require(_0x98c3('0x2'));var express=require(_0x98c3('0x3'));var router=express[_0x98c3('0x4')]();var fs_extra=require(_0x98c3('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x98c3('0x6'));var config=require(_0x98c3('0x7'));var controller=require(_0x98c3('0x8'));router['get']('/',auth[_0x98c3('0x9')](),controller[_0x98c3('0xa')]);router['get'](_0x98c3('0xb'),auth['isAuthenticated'](),controller[_0x98c3('0xc')]);router[_0x98c3('0xd')]('/:id/configurations',auth[_0x98c3('0x9')](),controller['getConfigurations']);router['get'](_0x98c3('0xe'),auth[_0x98c3('0x9')](),controller['getFields']);router[_0x98c3('0xf')]('/',auth[_0x98c3('0x9')](),controller[_0x98c3('0x10')]);router[_0x98c3('0xf')](_0x98c3('0x11'),auth[_0x98c3('0x9')](),controller['addConfiguration']);router[_0x98c3('0x12')]('/:id',auth[_0x98c3('0x9')](),controller[_0x98c3('0x13')]);router[_0x98c3('0x14')](_0x98c3('0xb'),auth[_0x98c3('0x9')](),controller['destroy']);module[_0x98c3('0x15')]=router; \ No newline at end of file +var _0x046b=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put','update','exports','util','path','connect-timeout'];(function(_0x334574,_0x1b7eb7){var _0x282909=function(_0x12a2c0){while(--_0x12a2c0){_0x334574['push'](_0x334574['shift']());}};_0x282909(++_0x1b7eb7);}(_0x046b,0x147));var _0xb046=function(_0x49a141,_0x201be4){_0x49a141=_0x49a141-0x0;var _0xc3c314=_0x046b[_0x49a141];return _0xc3c314;};'use strict';var multer=require('multer');var util=require(_0xb046('0x0'));var path=require(_0xb046('0x1'));var timeout=require(_0xb046('0x2'));var express=require(_0xb046('0x3'));var router=express[_0xb046('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb046('0x5'));var interaction=require(_0xb046('0x6'));var config=require(_0xb046('0x7'));var controller=require(_0xb046('0x8'));router[_0xb046('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb046('0x9')](_0xb046('0xa'),auth[_0xb046('0xb')](),controller[_0xb046('0xc')]);router[_0xb046('0x9')](_0xb046('0xd'),auth[_0xb046('0xb')](),controller[_0xb046('0xe')]);router['get'](_0xb046('0xf'),auth['isAuthenticated'](),controller[_0xb046('0x10')]);router[_0xb046('0x11')]('/',auth[_0xb046('0xb')](),controller[_0xb046('0x12')]);router[_0xb046('0x11')]('/:id/configurations',auth['isAuthenticated'](),controller['addConfiguration']);router[_0xb046('0x13')](_0xb046('0xa'),auth['isAuthenticated'](),controller[_0xb046('0x14')]);router['delete'](_0xb046('0xa'),auth[_0xb046('0xb')](),controller['destroy']);module[_0xb046('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 4145bbc..08eb028 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 _0xc02f=['exports','STRING','sequelize'];(function(_0x28ee74,_0x289441){var _0x6cc80c=function(_0x16ee15){while(--_0x16ee15){_0x28ee74['push'](_0x28ee74['shift']());}};_0x6cc80c(++_0x289441);}(_0xc02f,0x15b));var _0xfc02=function(_0x2b266e,_0x2d514a){_0x2b266e=_0x2b266e-0x0;var _0x56b23f=_0xc02f[_0x2b266e];return _0x56b23f;};'use strict';var Sequelize=require(_0xfc02('0x0'));module[_0xfc02('0x1')]={'name':{'type':Sequelize[_0xfc02('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xfc02('0x2')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0xfc02('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xfc02('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0xfc02('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x3478=['exports','STRING','sequelize'];(function(_0x2333b7,_0x54f91e){var _0x54695b=function(_0x40e8c8){while(--_0x40e8c8){_0x2333b7['push'](_0x2333b7['shift']());}};_0x54695b(++_0x54f91e);}(_0x3478,0x68));var _0x8347=function(_0x2ce6a7,_0x4d5a8e){_0x2ce6a7=_0x2ce6a7-0x0;var _0xd1d644=_0x3478[_0x2ce6a7];return _0xd1d644;};'use strict';var Sequelize=require(_0x8347('0x0'));module[_0x8347('0x1')]={'name':{'type':Sequelize[_0x8347('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x8347('0x2')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0x8347('0x2')],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x8347('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x8347('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 6dcb59d..5eb0b61 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 _0xfac3=['getchallenge','success','POST','login','result','token','describe','autogenerated','reference','editable','label','startsWith','cf_','picklistValues','value','vTiger\x20error:\x20','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','save','update','then','destroy','stack','name','index','rawAttributes','fieldName','type','key','query','keys','model','attributes','fields','length','nolimit','limit','order','sort','where','filters','pick','filter','merge','map','VIRTUAL','options','includeAll','include','VtigerAccount','show','intersection','find','create','body','params','catch','getConfigurations','findOne','VtigerConfiguration','hasOwnProperty','addConfiguration','AccountId','Subjects','channel','getDescriptions','VtigerField','Descriptions','md5','username','description','moduleName','remoteUri','serverUrl','accessKey','substring','lastIndexOf','%s/webservice.php','GET'];(function(_0x3e5445,_0x65567){var _0x1b49b6=function(_0x1a8126){while(--_0x1a8126){_0x3e5445['push'](_0x3e5445['shift']());}};_0x1b49b6(++_0x65567);}(_0xfac3,0x8c));var _0x3fac=function(_0x55c491,_0x40c252){_0x55c491=_0x55c491-0x0;var _0x1496f6=_0xfac3[_0x55c491];return _0x1496f6;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3fac('0x0'));var rp=require(_0x3fac('0x1'));var moment=require('moment');var BPromise=require(_0x3fac('0x2'));var Mustache=require(_0x3fac('0x3'));var util=require('util');var path=require(_0x3fac('0x4'));var sox=require(_0x3fac('0x5'));var csv=require(_0x3fac('0x6'));var ejs=require(_0x3fac('0x7'));var fs=require('fs');var fs_extra=require(_0x3fac('0x8'));var _=require(_0x3fac('0x9'));var squel=require('squel');var crypto=require(_0x3fac('0xa'));var jsforce=require(_0x3fac('0xb'));var deskjs=require(_0x3fac('0xc'));var toCsv=require(_0x3fac('0x6'));var querystring=require(_0x3fac('0xd'));var Papa=require(_0x3fac('0xe'));var Redis=require(_0x3fac('0xf'));var authService=require(_0x3fac('0x10'));var qs=require(_0x3fac('0x11'));var as=require(_0x3fac('0x12'));var hardwareService=require(_0x3fac('0x13'));var logger=require(_0x3fac('0x14'))(_0x3fac('0x15'));var utils=require(_0x3fac('0x16'));var config=require(_0x3fac('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x3fac('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x2ab8b4,_0x57063b){_0x57063b=_0x57063b||0xcc;return function(_0x147880){if(_0x147880){return _0x2ab8b4[_0x3fac('0x19')](_0x57063b);}return _0x2ab8b4[_0x3fac('0x1a')](_0x57063b)[_0x3fac('0x1b')]();};}function respondWithResult(_0x403b58,_0x2cbb21){_0x2cbb21=_0x2cbb21||0xc8;return function(_0x2719af){if(_0x2719af){return _0x403b58[_0x3fac('0x1a')](_0x2cbb21)[_0x3fac('0x1c')](_0x2719af);}};}function respondWithFilteredResult(_0x2fc870,_0x2a3e23){return function(_0x4d30d1){if(_0x4d30d1){var _0x5ad68e=typeof _0x2a3e23[_0x3fac('0x1d')]===_0x3fac('0x1e')&&typeof _0x2a3e23['limit']===_0x3fac('0x1e');var _0x123d16=_0x4d30d1['count'];var _0x3e3dc1=_0x5ad68e?0x0:_0x2a3e23['offset'];var _0x3594a2=_0x5ad68e?_0x4d30d1[_0x3fac('0x1f')]:_0x2a3e23['offset']+_0x2a3e23['limit'];var _0x312402;if(_0x3594a2>=_0x123d16){_0x3594a2=_0x123d16;_0x312402=0xc8;}else{_0x312402=0xce;}_0x2fc870[_0x3fac('0x1a')](_0x312402);return _0x2fc870[_0x3fac('0x20')](_0x3fac('0x21'),_0x3e3dc1+'-'+_0x3594a2+'/'+_0x123d16)[_0x3fac('0x1c')](_0x4d30d1);}return null;};}function patchUpdates(_0x48b882){return function(_0x139779){try{jsonpatch[_0x3fac('0x22')](_0x139779,_0x48b882,!![]);}catch(_0x55e474){return BPromise['reject'](_0x55e474);}return _0x139779[_0x3fac('0x23')]();};}function saveUpdates(_0x46b8c6,_0x5dddf8){return function(_0x2ffc52){if(_0x2ffc52){return _0x2ffc52[_0x3fac('0x24')](_0x46b8c6)[_0x3fac('0x25')](function(_0x57be93){return _0x57be93;});}return null;};}function removeEntity(_0xf0a810,_0x246a0e){return function(_0x201e65){if(_0x201e65){return _0x201e65[_0x3fac('0x26')]()['then'](function(){_0xf0a810[_0x3fac('0x1a')](0xcc)[_0x3fac('0x1b')]();});}};}function handleEntityNotFound(_0x30ed36,_0x3aacde){return function(_0xad21){if(!_0xad21){_0x30ed36[_0x3fac('0x19')](0x194);}return _0xad21;};}function handleError(_0x27a2ec,_0x4809ef){_0x4809ef=_0x4809ef||0x1f4;return function(_0x35c779){logger['error'](_0x35c779[_0x3fac('0x27')]);if(_0x35c779[_0x3fac('0x28')]){delete _0x35c779[_0x3fac('0x28')];}_0x27a2ec['status'](_0x4809ef)['send'](_0x35c779);};}exports[_0x3fac('0x29')]=function(_0x210b36,_0x2d6c04){var _0xa48a0={},_0x3ec8be={},_0x2c8749={'count':0x0,'rows':[]};var _0x462f4e=_['map'](db['VtigerAccount'][_0x3fac('0x2a')],function(_0x1a1d2e){return{'name':_0x1a1d2e[_0x3fac('0x2b')],'type':_0x1a1d2e[_0x3fac('0x2c')][_0x3fac('0x2d')]};});_0x3ec8be['model']=_['map'](_0x462f4e,_0x3fac('0x28'));_0x3ec8be[_0x3fac('0x2e')]=_[_0x3fac('0x2f')](_0x210b36[_0x3fac('0x2e')]);_0x3ec8be['filters']=_['intersection'](_0x3ec8be[_0x3fac('0x30')],_0x3ec8be[_0x3fac('0x2e')]);_0xa48a0[_0x3fac('0x31')]=_['intersection'](_0x3ec8be[_0x3fac('0x30')],qs[_0x3fac('0x32')](_0x210b36[_0x3fac('0x2e')][_0x3fac('0x32')]));_0xa48a0['attributes']=_0xa48a0[_0x3fac('0x31')][_0x3fac('0x33')]?_0xa48a0['attributes']:_0x3ec8be[_0x3fac('0x30')];if(!_0x210b36['query']['hasOwnProperty'](_0x3fac('0x34'))){_0xa48a0[_0x3fac('0x35')]=qs[_0x3fac('0x35')](_0x210b36[_0x3fac('0x2e')][_0x3fac('0x35')]);_0xa48a0[_0x3fac('0x1d')]=qs[_0x3fac('0x1d')](_0x210b36[_0x3fac('0x2e')][_0x3fac('0x1d')]);}_0xa48a0[_0x3fac('0x36')]=qs[_0x3fac('0x37')](_0x210b36[_0x3fac('0x2e')]['sort']);_0xa48a0[_0x3fac('0x38')]=qs[_0x3fac('0x39')](_[_0x3fac('0x3a')](_0x210b36[_0x3fac('0x2e')],_0x3ec8be[_0x3fac('0x39')]),_0x462f4e);if(_0x210b36[_0x3fac('0x2e')][_0x3fac('0x3b')]){_0xa48a0['where']=_[_0x3fac('0x3c')](_0xa48a0[_0x3fac('0x38')],{'$or':_[_0x3fac('0x3d')](_0x462f4e,function(_0x39aa29){if(_0x39aa29[_0x3fac('0x2c')]!==_0x3fac('0x3e')){var _0x3460ee={};_0x3460ee[_0x39aa29['name']]={'$like':'%'+_0x210b36[_0x3fac('0x2e')][_0x3fac('0x3b')]+'%'};return _0x3460ee;}})});}_0xa48a0=_[_0x3fac('0x3c')]({},_0xa48a0,_0x210b36[_0x3fac('0x3f')]);var _0x355386={'where':_0xa48a0['where']};return db['VtigerAccount'][_0x3fac('0x1f')](_0x355386)[_0x3fac('0x25')](function(_0x2771eb){_0x2c8749[_0x3fac('0x1f')]=_0x2771eb;if(_0x210b36[_0x3fac('0x2e')][_0x3fac('0x40')]){_0xa48a0[_0x3fac('0x41')]=[{'all':!![]}];}return db[_0x3fac('0x42')]['findAll'](_0xa48a0);})[_0x3fac('0x25')](function(_0x1c0e44){_0x2c8749['rows']=_0x1c0e44;return _0x2c8749;})[_0x3fac('0x25')](respondWithFilteredResult(_0x2d6c04,_0xa48a0))['catch'](handleError(_0x2d6c04,null));};exports[_0x3fac('0x43')]=function(_0x34d170,_0x425f56){var _0x43c255={'raw':![],'where':{'id':_0x34d170['params']['id']}},_0x368a28={};_0x368a28[_0x3fac('0x30')]=_[_0x3fac('0x2f')](db['VtigerAccount'][_0x3fac('0x2a')]);_0x368a28[_0x3fac('0x2e')]=_[_0x3fac('0x2f')](_0x34d170[_0x3fac('0x2e')]);_0x368a28[_0x3fac('0x39')]=_[_0x3fac('0x44')](_0x368a28['model'],_0x368a28[_0x3fac('0x2e')]);_0x43c255[_0x3fac('0x31')]=_[_0x3fac('0x44')](_0x368a28[_0x3fac('0x30')],qs[_0x3fac('0x32')](_0x34d170['query'][_0x3fac('0x32')]));_0x43c255['attributes']=_0x43c255[_0x3fac('0x31')]['length']?_0x43c255[_0x3fac('0x31')]:_0x368a28[_0x3fac('0x30')];if(_0x34d170[_0x3fac('0x2e')][_0x3fac('0x40')]){_0x43c255[_0x3fac('0x41')]=[{'all':!![]}];}_0x43c255=_[_0x3fac('0x3c')]({},_0x43c255,_0x34d170['options']);return db['VtigerAccount'][_0x3fac('0x45')](_0x43c255)[_0x3fac('0x25')](handleEntityNotFound(_0x425f56,null))[_0x3fac('0x25')](respondWithResult(_0x425f56,null))['catch'](handleError(_0x425f56,null));};exports['create']=function(_0x361c0b,_0x3bf06a){return db[_0x3fac('0x42')][_0x3fac('0x46')](_0x361c0b[_0x3fac('0x47')],{})[_0x3fac('0x25')](respondWithResult(_0x3bf06a,0xc9))['catch'](handleError(_0x3bf06a,null));};exports['update']=function(_0x54b70c,_0x166323){if(_0x54b70c[_0x3fac('0x47')]['id']){delete _0x54b70c[_0x3fac('0x47')]['id'];}return db[_0x3fac('0x42')]['find']({'where':{'id':_0x54b70c[_0x3fac('0x48')]['id']}})[_0x3fac('0x25')](handleEntityNotFound(_0x166323,null))[_0x3fac('0x25')](saveUpdates(_0x54b70c[_0x3fac('0x47')],null))[_0x3fac('0x25')](respondWithResult(_0x166323,null))[_0x3fac('0x49')](handleError(_0x166323,null));};exports[_0x3fac('0x26')]=function(_0x25ed0a,_0x219122){return db[_0x3fac('0x42')][_0x3fac('0x45')]({'where':{'id':_0x25ed0a['params']['id']}})[_0x3fac('0x25')](handleEntityNotFound(_0x219122,null))['then'](removeEntity(_0x219122,null))[_0x3fac('0x49')](handleError(_0x219122,null));};exports[_0x3fac('0x4a')]=function(_0xa8bf12,_0x56e80a,_0x2605ae){var _0x4e1120={};var _0x452d24={};var _0x3870a1;var _0x9bd570;return db['VtigerAccount'][_0x3fac('0x4b')]({'where':{'id':_0xa8bf12[_0x3fac('0x48')]['id']}})[_0x3fac('0x25')](handleEntityNotFound(_0x56e80a,null))['then'](function(_0x73684f){if(_0x73684f){_0x3870a1=_0x73684f;_0x452d24[_0x3fac('0x30')]=_[_0x3fac('0x2f')](db[_0x3fac('0x4c')][_0x3fac('0x2a')]);_0x452d24[_0x3fac('0x2e')]=_[_0x3fac('0x2f')](_0xa8bf12[_0x3fac('0x2e')]);_0x452d24[_0x3fac('0x39')]=_[_0x3fac('0x44')](_0x452d24['model'],_0x452d24['query']);_0x4e1120['attributes']=_['intersection'](_0x452d24[_0x3fac('0x30')],qs[_0x3fac('0x32')](_0xa8bf12[_0x3fac('0x2e')][_0x3fac('0x32')]));_0x4e1120['attributes']=_0x4e1120[_0x3fac('0x31')][_0x3fac('0x33')]?_0x4e1120[_0x3fac('0x31')]:_0x452d24[_0x3fac('0x30')];_0x4e1120[_0x3fac('0x36')]=qs['sort'](_0xa8bf12[_0x3fac('0x2e')][_0x3fac('0x37')]);_0x4e1120['where']=qs[_0x3fac('0x39')](_[_0x3fac('0x3a')](_0xa8bf12['query'],_0x452d24[_0x3fac('0x39')]));if(_0xa8bf12[_0x3fac('0x2e')]['filter']){_0x4e1120[_0x3fac('0x38')]=_['merge'](_0x4e1120[_0x3fac('0x38')],{'$or':_[_0x3fac('0x3d')](_0x4e1120[_0x3fac('0x31')],function(_0x53e0e6){var _0x1b6730={};_0x1b6730[_0x53e0e6]={'$like':'%'+_0xa8bf12[_0x3fac('0x2e')]['filter']+'%'};return _0x1b6730;})});}_0x4e1120=_['merge']({},_0x4e1120,_0xa8bf12[_0x3fac('0x3f')]);return _0x3870a1[_0x3fac('0x4a')](_0x4e1120);}})[_0x3fac('0x25')](function(_0x2c45ff){if(_0x2c45ff){_0x9bd570=_0x2c45ff[_0x3fac('0x33')];if(!_0xa8bf12[_0x3fac('0x2e')][_0x3fac('0x4d')](_0x3fac('0x34'))){_0x4e1120[_0x3fac('0x35')]=qs[_0x3fac('0x35')](_0xa8bf12[_0x3fac('0x2e')][_0x3fac('0x35')]);_0x4e1120[_0x3fac('0x1d')]=qs[_0x3fac('0x1d')](_0xa8bf12[_0x3fac('0x2e')][_0x3fac('0x1d')]);}return _0x3870a1[_0x3fac('0x4a')](_0x4e1120);}})[_0x3fac('0x25')](function(_0x3e9fb7){if(_0x3e9fb7){return _0x3e9fb7?{'count':_0x9bd570,'rows':_0x3e9fb7}:null;}})[_0x3fac('0x25')](respondWithResult(_0x56e80a,null))[_0x3fac('0x49')](handleError(_0x56e80a,null));};exports[_0x3fac('0x4e')]=function(_0x1669fd,_0xa3d7d9,_0x25c325){if(_0x1669fd[_0x3fac('0x47')]['id']){delete _0x1669fd[_0x3fac('0x47')]['id'];}return db[_0x3fac('0x42')][_0x3fac('0x4b')]({'where':{'id':_0x1669fd[_0x3fac('0x48')]['id']}})[_0x3fac('0x25')](handleEntityNotFound(_0xa3d7d9,null))['then'](function(_0x3d11e3){if(_0x3d11e3){_0x1669fd[_0x3fac('0x47')][_0x3fac('0x4f')]=_0x3d11e3['id'];_0x1669fd[_0x3fac('0x47')][_0x3fac('0x50')]=integrations['getSubjects'](_0x1669fd[_0x3fac('0x47')][_0x3fac('0x51')],_0x1669fd['body'][_0x3fac('0x2c')]);_0x1669fd[_0x3fac('0x47')]['Descriptions']=integrations[_0x3fac('0x52')](_0x1669fd['body'][_0x3fac('0x51')],_0x1669fd[_0x3fac('0x47')][_0x3fac('0x2c')]);return db[_0x3fac('0x4c')][_0x3fac('0x46')](_0x1669fd[_0x3fac('0x47')],{'include':[{'model':db[_0x3fac('0x53')],'as':_0x3fac('0x50')},{'model':db[_0x3fac('0x53')],'as':_0x3fac('0x54')}]});}return null;})[_0x3fac('0x25')](respondWithResult(_0xa3d7d9,null))[_0x3fac('0x49')](handleError(_0xa3d7d9,null));};var md5=require(_0x3fac('0x55'));exports['getFields']=function(_0x2cb831,_0x498429,_0x5c97f7){var _0x526299=null;var _0x58ee17=null;var _0x3ae8d5=null;var _0x5e7d85=null;var _0x7a3ac0='';return db[_0x3fac('0x42')][_0x3fac('0x4b')]({'where':{'id':_0x2cb831['params']['id']},'attributes':['id',_0x3fac('0x28'),_0x3fac('0x56'),_0x3fac('0x57'),_0x3fac('0x58'),_0x3fac('0x59'),_0x3fac('0x5a'),_0x3fac('0x5b')]})[_0x3fac('0x25')](handleEntityNotFound(_0x498429,null))[_0x3fac('0x25')](function(_0x4ad4b6){if(_0x4ad4b6){_0x526299=_0x4ad4b6[_0x3fac('0x56')];_0x58ee17=_0x4ad4b6[_0x3fac('0x5b')];_0x3ae8d5=_0x4ad4b6['moduleName'];_0x7a3ac0=_0x4ad4b6[_0x3fac('0x59')];var _0x2ec174=_0x7a3ac0['slice'](-0x1);if(_0x2ec174==='/'){_0x7a3ac0=_0x7a3ac0[_0x3fac('0x5c')](0x0,_0x7a3ac0[_0x3fac('0x5d')](_0x2ec174));}_0x5e7d85=util['format'](_0x3fac('0x5e'),_0x7a3ac0);var _0x57e336={'method':_0x3fac('0x5f'),'uri':_0x5e7d85,'qs':{'operation':_0x3fac('0x60'),'username':_0x4ad4b6[_0x3fac('0x56')]},'json':!![]};return rp(_0x57e336);}})['then'](function(_0x33c8b1){if(_0x33c8b1[_0x3fac('0x61')]){var _0x30fe5b={'method':_0x3fac('0x62'),'uri':_0x5e7d85,'form':{'operation':_0x3fac('0x63'),'username':_0x526299,'accessKey':md5(_0x33c8b1[_0x3fac('0x64')][_0x3fac('0x65')]+_0x58ee17)},'json':!![]};return rp(_0x30fe5b);}})[_0x3fac('0x25')](function(_0x29d5e6){if(_0x29d5e6[_0x3fac('0x61')]){var _0x481104={'method':_0x3fac('0x5f'),'uri':_0x5e7d85,'qs':{'operation':_0x3fac('0x66'),'username':_0x526299,'sessionName':_0x29d5e6['result']['sessionName'],'elementType':_0x3ae8d5},'json':!![]};return rp(_0x481104);}})[_0x3fac('0x25')](function(_0x264818){if(_0x264818['success']){var _0x24745d=[_0x3fac('0x67'),_0x3fac('0x68'),'owner'];_['remove'](_0x264818[_0x3fac('0x64')][_0x3fac('0x32')],function(_0x31f5a1){return _0x24745d['includes'](_0x31f5a1[_0x3fac('0x2c')][_0x3fac('0x28')]);});_['remove'](_0x264818[_0x3fac('0x64')][_0x3fac('0x32')],function(_0x1e1d27){return _0x1e1d27[_0x3fac('0x69')]==='false';});return{'count':_0x264818[_0x3fac('0x64')][_0x3fac('0x32')]['length'],'rows':_[_0x3fac('0x3d')](_0x264818[_0x3fac('0x64')][_0x3fac('0x32')],function(_0x209bf0){return{'id':_0x209bf0['name'],'name':_0x209bf0[_0x3fac('0x6a')],'custom':_[_0x3fac('0x6b')](_0x209bf0[_0x3fac('0x28')],_0x3fac('0x6c'))?!![]:![],'options':_0x209bf0['type'][_0x3fac('0x28')]==='picklist'&&_0x209bf0[_0x3fac('0x2c')][_0x3fac('0x6d')][_0x3fac('0x33')]>0x0?_[_0x3fac('0x3d')](_0x209bf0[_0x3fac('0x2c')][_0x3fac('0x6d')],function(_0x1206f3){return{'name':_0x1206f3[_0x3fac('0x6a')],'value':_0x1206f3[_0x3fac('0x6e')]};}):[]};})};}})[_0x3fac('0x25')](respondWithResult(_0x498429,null))[_0x3fac('0x49')](function(_0x2403ac){console['log'](_0x3fac('0x6f')+_0x2403ac);var _0x4f426b=_0x2cb831['query'][_0x3fac('0x70')]?0x1f4:_0x2403ac[_0x3fac('0x71')]||0x1f4;logger[_0x3fac('0x72')](_0x3fac('0x73'),_0x3fac('0x74'),_0x4f426b,JSON[_0x3fac('0x75')](_0x2403ac));delete _0x2403ac['name'];if(_0x4f426b===0x191){_0x4f426b=0x190;}_0x498429['status'](_0x4f426b)['send'](_0x2cb831['query'][_0x3fac('0x70')]?{'message':'Wrong\x20credentials','statusCode':_0x2403ac['statusCode']}:_0x2403ac);});}; \ No newline at end of file +var _0x6490=['options','find','create','body','findOne','VtigerConfiguration','order','getConfigurations','addConfiguration','Subjects','getSubjects','VtigerField','Descriptions','md5','getFields','username','description','moduleName','serverUrl','accessKey','remoteUri','slice','substring','lastIndexOf','%s/webservice.php','GET','success','POST','login','result','token','describe','sessionName','autogenerated','owner','remove','editable','false','cf_','picklist','picklistValues','label','value','log','vTiger\x20error:\x20','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','VtigerAccount','includeAll','include','findAll','rows','catch','params'];(function(_0x57baa6,_0x3af298){var _0x303fbf=function(_0x24c318){while(--_0x24c318){_0x57baa6['push'](_0x57baa6['shift']());}};_0x303fbf(++_0x3af298);}(_0x6490,0xac));var _0x0649=function(_0x285800,_0x26765e){_0x285800=_0x285800-0x0;var _0x4b809e=_0x6490[_0x285800];return _0x4b809e;};'use strict';var emlformat=require(_0x0649('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0649('0x1'));var jsonpatch=require(_0x0649('0x2'));var rp=require(_0x0649('0x3'));var moment=require(_0x0649('0x4'));var BPromise=require(_0x0649('0x5'));var Mustache=require(_0x0649('0x6'));var util=require('util');var path=require(_0x0649('0x7'));var sox=require('sox');var csv=require(_0x0649('0x8'));var ejs=require(_0x0649('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0649('0xa'));var squel=require(_0x0649('0xb'));var crypto=require('crypto');var jsforce=require(_0x0649('0xc'));var deskjs=require(_0x0649('0xd'));var toCsv=require(_0x0649('0x8'));var querystring=require(_0x0649('0xe'));var Papa=require(_0x0649('0xf'));var Redis=require(_0x0649('0x10'));var authService=require(_0x0649('0x11'));var qs=require(_0x0649('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0649('0x13'));var logger=require(_0x0649('0x14'))(_0x0649('0x15'));var utils=require(_0x0649('0x16'));var config=require(_0x0649('0x17'));var licenseUtil=require(_0x0649('0x18'));var db=require(_0x0649('0x19'))['db'];var integrations=require(_0x0649('0x1a'));function respondWithStatusCode(_0x55262f,_0x3b4317){_0x3b4317=_0x3b4317||0xcc;return function(_0x277d28){if(_0x277d28){return _0x55262f[_0x0649('0x1b')](_0x3b4317);}return _0x55262f[_0x0649('0x1c')](_0x3b4317)[_0x0649('0x1d')]();};}function respondWithResult(_0x55369e,_0x35a2dc){_0x35a2dc=_0x35a2dc||0xc8;return function(_0xe60342){if(_0xe60342){return _0x55369e[_0x0649('0x1c')](_0x35a2dc)[_0x0649('0x1e')](_0xe60342);}};}function respondWithFilteredResult(_0x5d9bbe,_0xa68961){return function(_0x561662){if(_0x561662){var _0x45d6f8=typeof _0xa68961['offset']===_0x0649('0x1f')&&typeof _0xa68961[_0x0649('0x20')]==='undefined';var _0xfc8548=_0x561662['count'];var _0x4183ac=_0x45d6f8?0x0:_0xa68961[_0x0649('0x21')];var _0x3d48bb=_0x45d6f8?_0x561662[_0x0649('0x22')]:_0xa68961[_0x0649('0x21')]+_0xa68961['limit'];var _0x5d54f2;if(_0x3d48bb>=_0xfc8548){_0x3d48bb=_0xfc8548;_0x5d54f2=0xc8;}else{_0x5d54f2=0xce;}_0x5d9bbe[_0x0649('0x1c')](_0x5d54f2);return _0x5d9bbe[_0x0649('0x23')](_0x0649('0x24'),_0x4183ac+'-'+_0x3d48bb+'/'+_0xfc8548)[_0x0649('0x1e')](_0x561662);}return null;};}function patchUpdates(_0x9cb2bc){return function(_0x3041cc){try{jsonpatch[_0x0649('0x25')](_0x3041cc,_0x9cb2bc,!![]);}catch(_0x2a15b6){return BPromise[_0x0649('0x26')](_0x2a15b6);}return _0x3041cc[_0x0649('0x27')]();};}function saveUpdates(_0x29eb39,_0x1d6eab){return function(_0x5856aa){if(_0x5856aa){return _0x5856aa[_0x0649('0x28')](_0x29eb39)['then'](function(_0x3397fd){return _0x3397fd;});}return null;};}function removeEntity(_0x44ccdd,_0x29f4b9){return function(_0x5ecabe){if(_0x5ecabe){return _0x5ecabe[_0x0649('0x29')]()[_0x0649('0x2a')](function(){_0x44ccdd['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x255558,_0x1611a6){return function(_0x37a60d){if(!_0x37a60d){_0x255558[_0x0649('0x1b')](0x194);}return _0x37a60d;};}function handleError(_0x43c4e1,_0x2ad48a){_0x2ad48a=_0x2ad48a||0x1f4;return function(_0x377776){logger[_0x0649('0x2b')](_0x377776[_0x0649('0x2c')]);if(_0x377776[_0x0649('0x2d')]){delete _0x377776['name'];}_0x43c4e1[_0x0649('0x1c')](_0x2ad48a)['send'](_0x377776);};}exports['index']=function(_0x2e497e,_0x5ac1bc){var _0x258b94={},_0x394247={},_0x2e848c={'count':0x0,'rows':[]};var _0x4c11a5=_[_0x0649('0x2e')](db['VtigerAccount'][_0x0649('0x2f')],function(_0x2f70a5){return{'name':_0x2f70a5[_0x0649('0x30')],'type':_0x2f70a5[_0x0649('0x31')][_0x0649('0x32')]};});_0x394247[_0x0649('0x33')]=_['map'](_0x4c11a5,_0x0649('0x2d'));_0x394247[_0x0649('0x34')]=_[_0x0649('0x35')](_0x2e497e[_0x0649('0x34')]);_0x394247[_0x0649('0x36')]=_[_0x0649('0x37')](_0x394247[_0x0649('0x33')],_0x394247[_0x0649('0x34')]);_0x258b94[_0x0649('0x38')]=_[_0x0649('0x37')](_0x394247[_0x0649('0x33')],qs['fields'](_0x2e497e[_0x0649('0x34')][_0x0649('0x39')]));_0x258b94['attributes']=_0x258b94['attributes'][_0x0649('0x3a')]?_0x258b94[_0x0649('0x38')]:_0x394247[_0x0649('0x33')];if(!_0x2e497e[_0x0649('0x34')][_0x0649('0x3b')](_0x0649('0x3c'))){_0x258b94['limit']=qs[_0x0649('0x20')](_0x2e497e[_0x0649('0x34')][_0x0649('0x20')]);_0x258b94['offset']=qs[_0x0649('0x21')](_0x2e497e[_0x0649('0x34')][_0x0649('0x21')]);}_0x258b94['order']=qs[_0x0649('0x3d')](_0x2e497e[_0x0649('0x34')][_0x0649('0x3d')]);_0x258b94['where']=qs['filters'](_[_0x0649('0x3e')](_0x2e497e['query'],_0x394247[_0x0649('0x36')]),_0x4c11a5);if(_0x2e497e['query'][_0x0649('0x3f')]){_0x258b94[_0x0649('0x40')]=_[_0x0649('0x41')](_0x258b94['where'],{'$or':_[_0x0649('0x2e')](_0x4c11a5,function(_0x5854d3){if(_0x5854d3[_0x0649('0x31')]!==_0x0649('0x42')){var _0x4f8a27={};_0x4f8a27[_0x5854d3['name']]={'$like':'%'+_0x2e497e['query'][_0x0649('0x3f')]+'%'};return _0x4f8a27;}})});}_0x258b94=_[_0x0649('0x41')]({},_0x258b94,_0x2e497e['options']);var _0x565c1a={'where':_0x258b94[_0x0649('0x40')]};return db[_0x0649('0x43')][_0x0649('0x22')](_0x565c1a)['then'](function(_0x543353){_0x2e848c[_0x0649('0x22')]=_0x543353;if(_0x2e497e[_0x0649('0x34')][_0x0649('0x44')]){_0x258b94[_0x0649('0x45')]=[{'all':!![]}];}return db[_0x0649('0x43')][_0x0649('0x46')](_0x258b94);})[_0x0649('0x2a')](function(_0x34da8e){_0x2e848c[_0x0649('0x47')]=_0x34da8e;return _0x2e848c;})[_0x0649('0x2a')](respondWithFilteredResult(_0x5ac1bc,_0x258b94))[_0x0649('0x48')](handleError(_0x5ac1bc,null));};exports['show']=function(_0x5731f3,_0x1374d1){var _0x5651a5={'raw':![],'where':{'id':_0x5731f3[_0x0649('0x49')]['id']}},_0x4b12ba={};_0x4b12ba[_0x0649('0x33')]=_[_0x0649('0x35')](db['VtigerAccount'][_0x0649('0x2f')]);_0x4b12ba['query']=_[_0x0649('0x35')](_0x5731f3[_0x0649('0x34')]);_0x4b12ba['filters']=_['intersection'](_0x4b12ba[_0x0649('0x33')],_0x4b12ba[_0x0649('0x34')]);_0x5651a5[_0x0649('0x38')]=_[_0x0649('0x37')](_0x4b12ba[_0x0649('0x33')],qs['fields'](_0x5731f3[_0x0649('0x34')][_0x0649('0x39')]));_0x5651a5[_0x0649('0x38')]=_0x5651a5[_0x0649('0x38')][_0x0649('0x3a')]?_0x5651a5[_0x0649('0x38')]:_0x4b12ba[_0x0649('0x33')];if(_0x5731f3[_0x0649('0x34')][_0x0649('0x44')]){_0x5651a5['include']=[{'all':!![]}];}_0x5651a5=_['merge']({},_0x5651a5,_0x5731f3[_0x0649('0x4a')]);return db[_0x0649('0x43')][_0x0649('0x4b')](_0x5651a5)[_0x0649('0x2a')](handleEntityNotFound(_0x1374d1,null))['then'](respondWithResult(_0x1374d1,null))[_0x0649('0x48')](handleError(_0x1374d1,null));};exports['create']=function(_0x1223a1,_0x796205){return db['VtigerAccount'][_0x0649('0x4c')](_0x1223a1['body'],{})[_0x0649('0x2a')](respondWithResult(_0x796205,0xc9))[_0x0649('0x48')](handleError(_0x796205,null));};exports[_0x0649('0x28')]=function(_0x10e467,_0x3f663c){if(_0x10e467['body']['id']){delete _0x10e467[_0x0649('0x4d')]['id'];}return db[_0x0649('0x43')][_0x0649('0x4b')]({'where':{'id':_0x10e467[_0x0649('0x49')]['id']}})[_0x0649('0x2a')](handleEntityNotFound(_0x3f663c,null))[_0x0649('0x2a')](saveUpdates(_0x10e467[_0x0649('0x4d')],null))[_0x0649('0x2a')](respondWithResult(_0x3f663c,null))['catch'](handleError(_0x3f663c,null));};exports[_0x0649('0x29')]=function(_0x5f3c77,_0x486d80){return db[_0x0649('0x43')][_0x0649('0x4b')]({'where':{'id':_0x5f3c77[_0x0649('0x49')]['id']}})[_0x0649('0x2a')](handleEntityNotFound(_0x486d80,null))[_0x0649('0x2a')](removeEntity(_0x486d80,null))[_0x0649('0x48')](handleError(_0x486d80,null));};exports['getConfigurations']=function(_0x3dd8d5,_0x47c8ca,_0x464911){var _0x579f22={};var _0x3d4246={};var _0x1c76ac;var _0x34daa7;return db[_0x0649('0x43')][_0x0649('0x4e')]({'where':{'id':_0x3dd8d5[_0x0649('0x49')]['id']}})[_0x0649('0x2a')](handleEntityNotFound(_0x47c8ca,null))['then'](function(_0x5caf09){if(_0x5caf09){_0x1c76ac=_0x5caf09;_0x3d4246[_0x0649('0x33')]=_['keys'](db[_0x0649('0x4f')]['rawAttributes']);_0x3d4246['query']=_['keys'](_0x3dd8d5[_0x0649('0x34')]);_0x3d4246[_0x0649('0x36')]=_[_0x0649('0x37')](_0x3d4246[_0x0649('0x33')],_0x3d4246[_0x0649('0x34')]);_0x579f22[_0x0649('0x38')]=_[_0x0649('0x37')](_0x3d4246[_0x0649('0x33')],qs[_0x0649('0x39')](_0x3dd8d5[_0x0649('0x34')][_0x0649('0x39')]));_0x579f22['attributes']=_0x579f22['attributes']['length']?_0x579f22['attributes']:_0x3d4246[_0x0649('0x33')];_0x579f22[_0x0649('0x50')]=qs[_0x0649('0x3d')](_0x3dd8d5[_0x0649('0x34')]['sort']);_0x579f22[_0x0649('0x40')]=qs[_0x0649('0x36')](_[_0x0649('0x3e')](_0x3dd8d5['query'],_0x3d4246[_0x0649('0x36')]));if(_0x3dd8d5[_0x0649('0x34')][_0x0649('0x3f')]){_0x579f22[_0x0649('0x40')]=_[_0x0649('0x41')](_0x579f22['where'],{'$or':_['map'](_0x579f22['attributes'],function(_0x365337){var _0x26cd80={};_0x26cd80[_0x365337]={'$like':'%'+_0x3dd8d5['query']['filter']+'%'};return _0x26cd80;})});}_0x579f22=_['merge']({},_0x579f22,_0x3dd8d5[_0x0649('0x4a')]);return _0x1c76ac[_0x0649('0x51')](_0x579f22);}})[_0x0649('0x2a')](function(_0x1ab911){if(_0x1ab911){_0x34daa7=_0x1ab911[_0x0649('0x3a')];if(!_0x3dd8d5[_0x0649('0x34')][_0x0649('0x3b')](_0x0649('0x3c'))){_0x579f22[_0x0649('0x20')]=qs['limit'](_0x3dd8d5[_0x0649('0x34')]['limit']);_0x579f22[_0x0649('0x21')]=qs['offset'](_0x3dd8d5['query'][_0x0649('0x21')]);}return _0x1c76ac[_0x0649('0x51')](_0x579f22);}})[_0x0649('0x2a')](function(_0x3bf63b){if(_0x3bf63b){return _0x3bf63b?{'count':_0x34daa7,'rows':_0x3bf63b}:null;}})[_0x0649('0x2a')](respondWithResult(_0x47c8ca,null))[_0x0649('0x48')](handleError(_0x47c8ca,null));};exports[_0x0649('0x52')]=function(_0xde2a82,_0x2f9e0c,_0x2fbf24){if(_0xde2a82[_0x0649('0x4d')]['id']){delete _0xde2a82[_0x0649('0x4d')]['id'];}return db[_0x0649('0x43')]['findOne']({'where':{'id':_0xde2a82[_0x0649('0x49')]['id']}})['then'](handleEntityNotFound(_0x2f9e0c,null))[_0x0649('0x2a')](function(_0x2d86a8){if(_0x2d86a8){_0xde2a82[_0x0649('0x4d')]['AccountId']=_0x2d86a8['id'];_0xde2a82[_0x0649('0x4d')][_0x0649('0x53')]=integrations[_0x0649('0x54')](_0xde2a82[_0x0649('0x4d')]['channel'],_0xde2a82[_0x0649('0x4d')][_0x0649('0x31')]);_0xde2a82['body']['Descriptions']=integrations['getDescriptions'](_0xde2a82['body']['channel'],_0xde2a82[_0x0649('0x4d')][_0x0649('0x31')]);return db['VtigerConfiguration'][_0x0649('0x4c')](_0xde2a82[_0x0649('0x4d')],{'include':[{'model':db[_0x0649('0x55')],'as':_0x0649('0x53')},{'model':db[_0x0649('0x55')],'as':_0x0649('0x56')}]});}return null;})[_0x0649('0x2a')](respondWithResult(_0x2f9e0c,null))[_0x0649('0x48')](handleError(_0x2f9e0c,null));};var md5=require(_0x0649('0x57'));exports[_0x0649('0x58')]=function(_0x577f18,_0x2f6545,_0xd8dbdc){var _0x403e5a=null;var _0x13e23d=null;var _0x5798c0=null;var _0x154139=null;var _0x5b959a='';return db['VtigerAccount'][_0x0649('0x4e')]({'where':{'id':_0x577f18[_0x0649('0x49')]['id']},'attributes':['id','name',_0x0649('0x59'),_0x0649('0x5a'),_0x0649('0x5b'),'remoteUri',_0x0649('0x5c'),_0x0649('0x5d')]})[_0x0649('0x2a')](handleEntityNotFound(_0x2f6545,null))[_0x0649('0x2a')](function(_0x2af2e1){if(_0x2af2e1){_0x403e5a=_0x2af2e1[_0x0649('0x59')];_0x13e23d=_0x2af2e1['accessKey'];_0x5798c0=_0x2af2e1[_0x0649('0x5b')];_0x5b959a=_0x2af2e1[_0x0649('0x5e')];var _0x3c6f72=_0x5b959a[_0x0649('0x5f')](-0x1);if(_0x3c6f72==='/'){_0x5b959a=_0x5b959a[_0x0649('0x60')](0x0,_0x5b959a[_0x0649('0x61')](_0x3c6f72));}_0x154139=util['format'](_0x0649('0x62'),_0x5b959a);var _0x2eb02c={'method':_0x0649('0x63'),'uri':_0x154139,'qs':{'operation':'getchallenge','username':_0x2af2e1['username']},'json':!![]};return rp(_0x2eb02c);}})[_0x0649('0x2a')](function(_0x12ad33){if(_0x12ad33[_0x0649('0x64')]){var _0x3f868a={'method':_0x0649('0x65'),'uri':_0x154139,'form':{'operation':_0x0649('0x66'),'username':_0x403e5a,'accessKey':md5(_0x12ad33[_0x0649('0x67')][_0x0649('0x68')]+_0x13e23d)},'json':!![]};return rp(_0x3f868a);}})['then'](function(_0x56c5da){if(_0x56c5da[_0x0649('0x64')]){var _0x36637d={'method':_0x0649('0x63'),'uri':_0x154139,'qs':{'operation':_0x0649('0x69'),'username':_0x403e5a,'sessionName':_0x56c5da[_0x0649('0x67')][_0x0649('0x6a')],'elementType':_0x5798c0},'json':!![]};return rp(_0x36637d);}})[_0x0649('0x2a')](function(_0x1c2f11){if(_0x1c2f11[_0x0649('0x64')]){var _0x4e392c=[_0x0649('0x6b'),'reference',_0x0649('0x6c')];_[_0x0649('0x6d')](_0x1c2f11[_0x0649('0x67')][_0x0649('0x39')],function(_0x5a4c07){return _0x4e392c['includes'](_0x5a4c07[_0x0649('0x31')][_0x0649('0x2d')]);});_[_0x0649('0x6d')](_0x1c2f11['result'][_0x0649('0x39')],function(_0x286dac){return _0x286dac[_0x0649('0x6e')]===_0x0649('0x6f');});return{'count':_0x1c2f11['result']['fields']['length'],'rows':_['map'](_0x1c2f11[_0x0649('0x67')][_0x0649('0x39')],function(_0x200d8f){return{'id':_0x200d8f[_0x0649('0x2d')],'name':_0x200d8f['label'],'custom':_['startsWith'](_0x200d8f[_0x0649('0x2d')],_0x0649('0x70'))?!![]:![],'options':_0x200d8f[_0x0649('0x31')][_0x0649('0x2d')]===_0x0649('0x71')&&_0x200d8f[_0x0649('0x31')][_0x0649('0x72')][_0x0649('0x3a')]>0x0?_[_0x0649('0x2e')](_0x200d8f['type'][_0x0649('0x72')],function(_0x3e3fa7){return{'name':_0x3e3fa7[_0x0649('0x73')],'value':_0x3e3fa7[_0x0649('0x74')]};}):[]};})};}})[_0x0649('0x2a')](respondWithResult(_0x2f6545,null))[_0x0649('0x48')](function(_0x13e378){console[_0x0649('0x75')](_0x0649('0x76')+_0x13e378);var _0x2ed43a=_0x577f18[_0x0649('0x34')]['test']?0x1f4:_0x13e378[_0x0649('0x77')]||0x1f4;logger[_0x0649('0x2b')](_0x0649('0x78'),_0x0649('0x58'),_0x2ed43a,JSON['stringify'](_0x13e378));delete _0x13e378[_0x0649('0x2d')];if(_0x2ed43a===0x191){_0x2ed43a=0x190;}_0x2f6545[_0x0649('0x1c')](_0x2ed43a)[_0x0649('0x79')](_0x577f18[_0x0649('0x34')]['test']?{'message':_0x0649('0x7a'),'statusCode':_0x13e378[_0x0649('0x77')]}:_0x13e378);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index f5447cf..4db0dcb 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 _0x47ed=['rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','VtigerAccount','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x4050c5,_0x57e81e){var _0x47c84d=function(_0x9d87b1){while(--_0x9d87b1){_0x4050c5['push'](_0x4050c5['shift']());}};_0x47c84d(++_0x57e81e);}(_0x47ed,0xf5));var _0xd47e=function(_0x1972f4,_0x1231ff){_0x1972f4=_0x1972f4-0x0;var _0x42159b=_0x47ed[_0x1972f4];return _0x42159b;};'use strict';var _=require('lodash');var util=require(_0xd47e('0x0'));var logger=require(_0xd47e('0x1'))(_0xd47e('0x2'));var moment=require(_0xd47e('0x3'));var BPromise=require(_0xd47e('0x4'));var rp=require(_0xd47e('0x5'));var fs=require('fs');var path=require(_0xd47e('0x6'));var rimraf=require(_0xd47e('0x7'));var config=require(_0xd47e('0x8'));var attributes=require(_0xd47e('0x9'));var integrations=require(_0xd47e('0xa'));module['exports']=function(_0x494f13,_0x5b0b1f){return _0x494f13['define'](_0xd47e('0xb'),attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe302=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','define','VtigerAccount'];(function(_0x47a349,_0x4699d9){var _0x18ab75=function(_0x210796){while(--_0x210796){_0x47a349['push'](_0x47a349['shift']());}};_0x18ab75(++_0x4699d9);}(_0xe302,0x108));var _0x2e30=function(_0x15a37c,_0x26e782){_0x15a37c=_0x15a37c-0x0;var _0x2f8ae6=_0xe302[_0x15a37c];return _0x2f8ae6;};'use strict';var _=require(_0x2e30('0x0'));var util=require(_0x2e30('0x1'));var logger=require(_0x2e30('0x2'))(_0x2e30('0x3'));var moment=require(_0x2e30('0x4'));var BPromise=require('bluebird');var rp=require(_0x2e30('0x5'));var fs=require('fs');var path=require(_0x2e30('0x6'));var rimraf=require(_0x2e30('0x7'));var config=require(_0x2e30('0x8'));var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0x2e30('0x9'));module['exports']=function(_0x3b8112,_0xabdab){return _0x3b8112[_0x2e30('0xa')](_0x2e30('0xb'),attributes,{'tableName':'int_vtiger_accounts','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 36fd10f..d7f9a85 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 _0xa5fa=['jayson/promise','client','http','request','info','debug','stringify','error','code','VtigerAccount,\x20%s,\x20%s','message','request\x20sent','result','catch','GetVtigerAccount','VtigerAccount','findAll','options','raw','where','attributes','include','map','model','then','ShowVtigerAccount','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x36b1d4,_0x83cc16){var _0x39fd6f=function(_0x5db348){while(--_0x5db348){_0x36b1d4['push'](_0x36b1d4['shift']());}};_0x39fd6f(++_0x83cc16);}(_0xa5fa,0xc4));var _0xaa5f=function(_0x5a852b,_0x1694c2){_0x5a852b=_0x5a852b-0x0;var _0xd74d84=_0xa5fa[_0x5a852b];return _0xd74d84;};'use strict';var _=require('lodash');var util=require(_0xaa5f('0x0'));var moment=require(_0xaa5f('0x1'));var BPromise=require(_0xaa5f('0x2'));var rs=require(_0xaa5f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaa5f('0x4'))['db'];var utils=require(_0xaa5f('0x5'));var logger=require('../../config/logger')(_0xaa5f('0x6'));var config=require(_0xaa5f('0x7'));var jayson=require(_0xaa5f('0x8'));var client=jayson[_0xaa5f('0x9')][_0xaa5f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13b606,_0x302138,_0xc326df){return new BPromise(function(_0x74f64f,_0x3f550e){return client[_0xaa5f('0xb')](_0x13b606,_0xc326df)['then'](function(_0x1674c2){logger[_0xaa5f('0xc')]('VtigerAccount,\x20%s,\x20%s',_0x302138,'request\x20sent');logger[_0xaa5f('0xd')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x302138,'request\x20sent',JSON[_0xaa5f('0xe')](_0x1674c2));if(_0x1674c2['error']){if(_0x1674c2[_0xaa5f('0xf')][_0xaa5f('0x10')]===0x1f4){logger[_0xaa5f('0xf')](_0xaa5f('0x11'),_0x302138,_0x1674c2[_0xaa5f('0xf')]['message']);return _0x3f550e(_0x1674c2[_0xaa5f('0xf')]['message']);}logger[_0xaa5f('0xf')](_0xaa5f('0x11'),_0x302138,_0x1674c2[_0xaa5f('0xf')][_0xaa5f('0x12')]);return _0x74f64f(_0x1674c2[_0xaa5f('0xf')]['message']);}else{logger['info'](_0xaa5f('0x11'),_0x302138,_0xaa5f('0x13'));_0x74f64f(_0x1674c2[_0xaa5f('0x14')][_0xaa5f('0x12')]);}})[_0xaa5f('0x15')](function(_0x1fa36a){logger[_0xaa5f('0xf')](_0xaa5f('0x11'),_0x302138,_0x1fa36a);_0x3f550e(_0x1fa36a);});});}exports[_0xaa5f('0x16')]=function(_0x3d874f){var _0x22175f=this;return new Promise(function(_0x1019e8,_0x4f4cd5){return db[_0xaa5f('0x17')][_0xaa5f('0x18')]({'raw':_0x3d874f[_0xaa5f('0x19')]?_0x3d874f[_0xaa5f('0x19')][_0xaa5f('0x1a')]===undefined?!![]:![]:!![],'where':_0x3d874f[_0xaa5f('0x19')]?_0x3d874f[_0xaa5f('0x19')][_0xaa5f('0x1b')]||null:null,'attributes':_0x3d874f[_0xaa5f('0x19')]?_0x3d874f[_0xaa5f('0x19')][_0xaa5f('0x1c')]||null:null,'limit':_0x3d874f[_0xaa5f('0x19')]?_0x3d874f[_0xaa5f('0x19')]['limit']||null:null,'include':_0x3d874f[_0xaa5f('0x19')]?_0x3d874f['options'][_0xaa5f('0x1d')]?_[_0xaa5f('0x1e')](_0x3d874f['options'][_0xaa5f('0x1d')],function(_0x1032ce){return{'model':db[_0x1032ce['model']],'as':_0x1032ce['as'],'attributes':_0x1032ce[_0xaa5f('0x1c')],'include':_0x1032ce[_0xaa5f('0x1d')]?_[_0xaa5f('0x1e')](_0x1032ce[_0xaa5f('0x1d')],function(_0x1f66c0){return{'model':db[_0x1f66c0[_0xaa5f('0x1f')]],'as':_0x1f66c0['as'],'attributes':_0x1f66c0[_0xaa5f('0x1c')],'include':_0x1f66c0[_0xaa5f('0x1d')]?_['map'](_0x1f66c0[_0xaa5f('0x1d')],function(_0x3a66e8){return{'model':db[_0x3a66e8[_0xaa5f('0x1f')]],'as':_0x3a66e8['as'],'attributes':_0x3a66e8['attributes']};}):[]};}):[]};}):[]:[]})[_0xaa5f('0x20')](function(_0x269209){logger[_0xaa5f('0xc')]('GetVtigerAccount',_0x3d874f);logger[_0xaa5f('0xd')]('GetVtigerAccount',_0x3d874f,JSON['stringify'](_0x269209));_0x1019e8(_0x269209);})[_0xaa5f('0x15')](function(_0x50998f){logger[_0xaa5f('0xf')]('GetVtigerAccount',_0x50998f['message'],_0x3d874f);_0x4f4cd5(_0x22175f['error'](0x1f4,_0x50998f[_0xaa5f('0x12')]));});});};exports['ShowVtigerAccount']=function(_0x310828){var _0xc0bb03=this;return new Promise(function(_0x555876,_0x58f608){return db[_0xaa5f('0x17')]['find']({'raw':_0x310828[_0xaa5f('0x19')]?_0x310828[_0xaa5f('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x310828[_0xaa5f('0x19')]?_0x310828[_0xaa5f('0x19')][_0xaa5f('0x1b')]||null:null,'attributes':_0x310828['options']?_0x310828[_0xaa5f('0x19')][_0xaa5f('0x1c')]||null:null,'include':_0x310828['options']?_0x310828['options']['include']?_['map'](_0x310828[_0xaa5f('0x19')][_0xaa5f('0x1d')],function(_0x2a6015){return{'model':db[_0x2a6015[_0xaa5f('0x1f')]],'as':_0x2a6015['as'],'attributes':_0x2a6015[_0xaa5f('0x1c')],'include':_0x2a6015[_0xaa5f('0x1d')]?_[_0xaa5f('0x1e')](_0x2a6015['include'],function(_0x1ab07f){return{'model':db[_0x1ab07f[_0xaa5f('0x1f')]],'as':_0x1ab07f['as'],'attributes':_0x1ab07f[_0xaa5f('0x1c')],'include':_0x1ab07f[_0xaa5f('0x1d')]?_[_0xaa5f('0x1e')](_0x1ab07f[_0xaa5f('0x1d')],function(_0x49442c){return{'model':db[_0x49442c[_0xaa5f('0x1f')]],'as':_0x49442c['as'],'attributes':_0x49442c[_0xaa5f('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xaa5f('0x20')](function(_0x2ac0f8){logger[_0xaa5f('0xc')]('ShowVtigerAccount',_0x310828);logger['debug'](_0xaa5f('0x21'),_0x310828,JSON[_0xaa5f('0xe')](_0x2ac0f8));_0x555876(_0x2ac0f8);})[_0xaa5f('0x15')](function(_0x964105){logger['error'](_0xaa5f('0x21'),_0x964105[_0xaa5f('0x12')],_0x310828);_0x58f608(_0xc0bb03[_0xaa5f('0xf')](0x1f4,_0x964105[_0xaa5f('0x12')]));});});}; \ No newline at end of file +var _0x1be1=['../../config/environment','jayson/promise','client','request','then','info','VtigerAccount,\x20%s,\x20%s','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetVtigerAccount','options','raw','where','attributes','limit','include','map','model','VtigerAccount','find','ShowVtigerAccount','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x231677,_0x31b8be){var _0x5a8498=function(_0x548bd8){while(--_0x548bd8){_0x231677['push'](_0x231677['shift']());}};_0x5a8498(++_0x31b8be);}(_0x1be1,0x192));var _0x11be=function(_0x59a2f2,_0x489846){_0x59a2f2=_0x59a2f2-0x0;var _0x4952e6=_0x1be1[_0x59a2f2];return _0x4952e6;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x11be('0x0'));var BPromise=require(_0x11be('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x11be('0x2'));var db=require(_0x11be('0x3'))['db'];var utils=require(_0x11be('0x4'));var logger=require(_0x11be('0x5'))('rpc');var config=require(_0x11be('0x6'));var jayson=require(_0x11be('0x7'));var client=jayson[_0x11be('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xfe8c62,_0x497730,_0x18f661){return new BPromise(function(_0x11fc15,_0x246772){return client[_0x11be('0x9')](_0xfe8c62,_0x18f661)[_0x11be('0xa')](function(_0x5f3d04){logger[_0x11be('0xb')](_0x11be('0xc'),_0x497730,'request\x20sent');logger[_0x11be('0xd')](_0x11be('0xe'),_0x497730,_0x11be('0xf'),JSON[_0x11be('0x10')](_0x5f3d04));if(_0x5f3d04['error']){if(_0x5f3d04[_0x11be('0x11')][_0x11be('0x12')]===0x1f4){logger[_0x11be('0x11')]('VtigerAccount,\x20%s,\x20%s',_0x497730,_0x5f3d04[_0x11be('0x11')][_0x11be('0x13')]);return _0x246772(_0x5f3d04['error'][_0x11be('0x13')]);}logger['error']('VtigerAccount,\x20%s,\x20%s',_0x497730,_0x5f3d04['error']['message']);return _0x11fc15(_0x5f3d04['error']['message']);}else{logger['info'](_0x11be('0xc'),_0x497730,'request\x20sent');_0x11fc15(_0x5f3d04[_0x11be('0x14')][_0x11be('0x13')]);}})[_0x11be('0x15')](function(_0x216b8c){logger['error'](_0x11be('0xc'),_0x497730,_0x216b8c);_0x246772(_0x216b8c);});});}exports[_0x11be('0x16')]=function(_0x56ab61){var _0x299f45=this;return new Promise(function(_0xc3263c,_0x23aa5f){return db['VtigerAccount']['findAll']({'raw':_0x56ab61[_0x11be('0x17')]?_0x56ab61[_0x11be('0x17')][_0x11be('0x18')]===undefined?!![]:![]:!![],'where':_0x56ab61[_0x11be('0x17')]?_0x56ab61['options'][_0x11be('0x19')]||null:null,'attributes':_0x56ab61[_0x11be('0x17')]?_0x56ab61[_0x11be('0x17')][_0x11be('0x1a')]||null:null,'limit':_0x56ab61[_0x11be('0x17')]?_0x56ab61[_0x11be('0x17')][_0x11be('0x1b')]||null:null,'include':_0x56ab61[_0x11be('0x17')]?_0x56ab61[_0x11be('0x17')][_0x11be('0x1c')]?_['map'](_0x56ab61[_0x11be('0x17')][_0x11be('0x1c')],function(_0x2fe43c){return{'model':db[_0x2fe43c['model']],'as':_0x2fe43c['as'],'attributes':_0x2fe43c['attributes'],'include':_0x2fe43c[_0x11be('0x1c')]?_[_0x11be('0x1d')](_0x2fe43c[_0x11be('0x1c')],function(_0x4cb27f){return{'model':db[_0x4cb27f[_0x11be('0x1e')]],'as':_0x4cb27f['as'],'attributes':_0x4cb27f['attributes'],'include':_0x4cb27f[_0x11be('0x1c')]?_['map'](_0x4cb27f[_0x11be('0x1c')],function(_0xb11f3d){return{'model':db[_0xb11f3d['model']],'as':_0xb11f3d['as'],'attributes':_0xb11f3d[_0x11be('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x11be('0xa')](function(_0x1d3b5c){logger[_0x11be('0xb')](_0x11be('0x16'),_0x56ab61);logger[_0x11be('0xd')](_0x11be('0x16'),_0x56ab61,JSON[_0x11be('0x10')](_0x1d3b5c));_0xc3263c(_0x1d3b5c);})[_0x11be('0x15')](function(_0x5966c5){logger[_0x11be('0x11')]('GetVtigerAccount',_0x5966c5[_0x11be('0x13')],_0x56ab61);_0x23aa5f(_0x299f45[_0x11be('0x11')](0x1f4,_0x5966c5['message']));});});};exports['ShowVtigerAccount']=function(_0x49fd5c){var _0x265fc9=this;return new Promise(function(_0x5e8f9a,_0x66316d){return db[_0x11be('0x1f')][_0x11be('0x20')]({'raw':_0x49fd5c[_0x11be('0x17')]?_0x49fd5c[_0x11be('0x17')][_0x11be('0x18')]===undefined?!![]:![]:!![],'where':_0x49fd5c['options']?_0x49fd5c[_0x11be('0x17')][_0x11be('0x19')]||null:null,'attributes':_0x49fd5c[_0x11be('0x17')]?_0x49fd5c[_0x11be('0x17')][_0x11be('0x1a')]||null:null,'include':_0x49fd5c[_0x11be('0x17')]?_0x49fd5c['options'][_0x11be('0x1c')]?_[_0x11be('0x1d')](_0x49fd5c[_0x11be('0x17')][_0x11be('0x1c')],function(_0x228bd3){return{'model':db[_0x228bd3['model']],'as':_0x228bd3['as'],'attributes':_0x228bd3[_0x11be('0x1a')],'include':_0x228bd3[_0x11be('0x1c')]?_[_0x11be('0x1d')](_0x228bd3['include'],function(_0x2c6fb2){return{'model':db[_0x2c6fb2['model']],'as':_0x2c6fb2['as'],'attributes':_0x2c6fb2['attributes'],'include':_0x2c6fb2['include']?_['map'](_0x2c6fb2[_0x11be('0x1c')],function(_0x2c5715){return{'model':db[_0x2c5715[_0x11be('0x1e')]],'as':_0x2c5715['as'],'attributes':_0x2c5715['attributes']};}):[]};}):[]};}):[]:[]})[_0x11be('0xa')](function(_0x1866d8){logger['info'](_0x11be('0x21'),_0x49fd5c);logger['debug'](_0x11be('0x21'),_0x49fd5c,JSON['stringify'](_0x1866d8));_0x5e8f9a(_0x1866d8);})[_0x11be('0x15')](function(_0xa6d724){logger[_0x11be('0x11')](_0x11be('0x21'),_0xa6d724['message'],_0x49fd5c);_0x66316d(_0x265fc9[_0x11be('0x11')](0x1f4,_0xa6d724[_0x11be('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 52ddd48..5745354 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 _0x024a=['getDescriptions','post','create','put','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/subjects','/:id/descriptions'];(function(_0x2feb15,_0x26241b){var _0x42272e=function(_0x41e24f){while(--_0x41e24f){_0x2feb15['push'](_0x2feb15['shift']());}};_0x42272e(++_0x26241b);}(_0x024a,0x160));var _0xa024=function(_0x57862e,_0x106cb5){_0x57862e=_0x57862e-0x0;var _0x2b6223=_0x024a[_0x57862e];return _0x2b6223;};'use strict';var multer=require(_0xa024('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xa024('0x1'));var express=require(_0xa024('0x2'));var router=express[_0xa024('0x3')]();var fs_extra=require(_0xa024('0x4'));var auth=require(_0xa024('0x5'));var interaction=require(_0xa024('0x6'));var config=require(_0xa024('0x7'));var controller=require(_0xa024('0x8'));router[_0xa024('0x9')]('/',auth['isAuthenticated'](),controller[_0xa024('0xa')]);router['get'](_0xa024('0xb'),auth[_0xa024('0xc')](),controller[_0xa024('0xd')]);router[_0xa024('0x9')]('/:id/fields',auth[_0xa024('0xc')](),controller['getFields']);router[_0xa024('0x9')](_0xa024('0xe'),auth[_0xa024('0xc')](),controller['getSubjects']);router[_0xa024('0x9')](_0xa024('0xf'),auth[_0xa024('0xc')](),controller[_0xa024('0x10')]);router[_0xa024('0x11')]('/',auth[_0xa024('0xc')](),controller[_0xa024('0x12')]);router[_0xa024('0x13')](_0xa024('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xa024('0x14')](_0xa024('0xb'),auth[_0xa024('0xc')](),controller[_0xa024('0x15')]);module[_0xa024('0x16')]=router; \ No newline at end of file +var _0x4a68=['delete','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','update'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x4a68,0x178));var _0x84a6=function(_0x5d4887,_0xef1c71){_0x5d4887=_0x5d4887-0x0;var _0x255855=_0x4a68[_0x5d4887];return _0x255855;};'use strict';var multer=require('multer');var util=require(_0x84a6('0x0'));var path=require(_0x84a6('0x1'));var timeout=require('connect-timeout');var express=require(_0x84a6('0x2'));var router=express[_0x84a6('0x3')]();var fs_extra=require(_0x84a6('0x4'));var auth=require(_0x84a6('0x5'));var interaction=require(_0x84a6('0x6'));var config=require(_0x84a6('0x7'));var controller=require('./intVtigerConfiguration.controller');router[_0x84a6('0x8')]('/',auth['isAuthenticated'](),controller[_0x84a6('0x9')]);router[_0x84a6('0x8')](_0x84a6('0xa'),auth[_0x84a6('0xb')](),controller['show']);router['get'](_0x84a6('0xc'),auth[_0x84a6('0xb')](),controller[_0x84a6('0xd')]);router[_0x84a6('0x8')](_0x84a6('0xe'),auth[_0x84a6('0xb')](),controller['getSubjects']);router[_0x84a6('0x8')](_0x84a6('0xf'),auth['isAuthenticated'](),controller[_0x84a6('0x10')]);router[_0x84a6('0x11')]('/',auth['isAuthenticated'](),controller[_0x84a6('0x12')]);router['put'](_0x84a6('0xa'),auth['isAuthenticated'](),controller[_0x84a6('0x13')]);router[_0x84a6('0x14')](_0x84a6('0xa'),auth[_0x84a6('0xb')](),controller['destroy']);module[_0x84a6('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 18360ea..b3c15a1 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 _0x5a82=['exports','STRING','sequelize'];(function(_0x2981b6,_0x4300c6){var _0x2529e8=function(_0x1ddd77){while(--_0x1ddd77){_0x2981b6['push'](_0x2981b6['shift']());}};_0x2529e8(++_0x4300c6);}(_0x5a82,0x188));var _0x25a8=function(_0x2a2880,_0x37bb41){_0x2a2880=_0x2a2880-0x0;var _0x3b8a2b=_0x5a82[_0x2a2880];return _0x3b8a2b;};'use strict';var Sequelize=require(_0x25a8('0x0'));module[_0x25a8('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x25a8('0x2')]}}; \ No newline at end of file +var _0x8152=['exports','STRING'];(function(_0x177591,_0x33f0fe){var _0x16db71=function(_0xd0abf3){while(--_0xd0abf3){_0x177591['push'](_0x177591['shift']());}};_0x16db71(++_0x33f0fe);}(_0x8152,0x19e));var _0x2815=function(_0x2ddeb2,_0x426a65){_0x2ddeb2=_0x2ddeb2-0x0;var _0x51c6fc=_0x8152[_0x2ddeb2];return _0x51c6fc;};'use strict';var Sequelize=require('sequelize');module[_0x2815('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2815('0x1')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 74fa36e..cc1eb78 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 _0x478e=['filters','filter','where','merge','type','VIRTUAL','options','include','findAll','rows','params','includeAll','find','catch','create','body','getFields','findOne','VtigerField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','papaparse','../../components/auth/service','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','status','send','index','map','VtigerConfiguration','rawAttributes','key','keys','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick'];(function(_0x48f1d1,_0x3be80f){var _0xa82c75=function(_0x5e126e){while(--_0x5e126e){_0x48f1d1['push'](_0x48f1d1['shift']());}};_0xa82c75(++_0x3be80f);}(_0x478e,0x1e9));var _0xe478=function(_0x30bd4d,_0x50eb60){_0x30bd4d=_0x30bd4d-0x0;var _0x306915=_0x478e[_0x30bd4d];return _0x306915;};'use strict';var emlformat=require(_0xe478('0x0'));var rimraf=require(_0xe478('0x1'));var zipdir=require(_0xe478('0x2'));var jsonpatch=require(_0xe478('0x3'));var rp=require(_0xe478('0x4'));var moment=require(_0xe478('0x5'));var BPromise=require(_0xe478('0x6'));var Mustache=require(_0xe478('0x7'));var util=require('util');var path=require(_0xe478('0x8'));var sox=require(_0xe478('0x9'));var csv=require(_0xe478('0xa'));var ejs=require(_0xe478('0xb'));var fs=require('fs');var fs_extra=require(_0xe478('0xc'));var _=require(_0xe478('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe478('0xa'));var querystring=require('querystring');var Papa=require(_0xe478('0xe'));var Redis=require('ioredis');var authService=require(_0xe478('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe478('0x10'))('api');var utils=require(_0xe478('0x11'));var config=require(_0xe478('0x12'));var licenseUtil=require(_0xe478('0x13'));var db=require(_0xe478('0x14'))['db'];function respondWithStatusCode(_0x4c5f5c,_0x5a1b00){_0x5a1b00=_0x5a1b00||0xcc;return function(_0x59bfc3){if(_0x59bfc3){return _0x4c5f5c[_0xe478('0x15')](_0x5a1b00);}return _0x4c5f5c['status'](_0x5a1b00)[_0xe478('0x16')]();};}function respondWithResult(_0x380de8,_0x5337b1){_0x5337b1=_0x5337b1||0xc8;return function(_0x472bac){if(_0x472bac){return _0x380de8['status'](_0x5337b1)[_0xe478('0x17')](_0x472bac);}};}function respondWithFilteredResult(_0x1a0059,_0x456add){return function(_0x1297be){if(_0x1297be){var _0x226998=typeof _0x456add['offset']===_0xe478('0x18')&&typeof _0x456add[_0xe478('0x19')]===_0xe478('0x18');var _0x1386f1=_0x1297be['count'];var _0x3b19d8=_0x226998?0x0:_0x456add[_0xe478('0x1a')];var _0x84ee0e=_0x226998?_0x1297be[_0xe478('0x1b')]:_0x456add['offset']+_0x456add[_0xe478('0x19')];var _0x427f43;if(_0x84ee0e>=_0x1386f1){_0x84ee0e=_0x1386f1;_0x427f43=0xc8;}else{_0x427f43=0xce;}_0x1a0059['status'](_0x427f43);return _0x1a0059[_0xe478('0x1c')](_0xe478('0x1d'),_0x3b19d8+'-'+_0x84ee0e+'/'+_0x1386f1)[_0xe478('0x17')](_0x1297be);}return null;};}function patchUpdates(_0x1af903){return function(_0x3f8e11){try{jsonpatch[_0xe478('0x1e')](_0x3f8e11,_0x1af903,!![]);}catch(_0x1fb882){return BPromise[_0xe478('0x1f')](_0x1fb882);}return _0x3f8e11[_0xe478('0x20')]();};}function saveUpdates(_0x7cab3f,_0x4f1be6){return function(_0x807303){if(_0x807303){return _0x807303[_0xe478('0x21')](_0x7cab3f)[_0xe478('0x22')](function(_0x35e06f){return _0x35e06f;});}return null;};}function removeEntity(_0x2cf46e,_0x1c22ab){return function(_0x51aff7){if(_0x51aff7){return _0x51aff7[_0xe478('0x23')]()[_0xe478('0x22')](function(){_0x2cf46e['status'](0xcc)[_0xe478('0x16')]();});}};}function handleEntityNotFound(_0x5aab2d,_0x48a6c0){return function(_0x4b51ec){if(!_0x4b51ec){_0x5aab2d[_0xe478('0x15')](0x194);}return _0x4b51ec;};}function handleError(_0xad4874,_0x427708){_0x427708=_0x427708||0x1f4;return function(_0x5e2fe6){logger[_0xe478('0x24')](_0x5e2fe6['stack']);if(_0x5e2fe6[_0xe478('0x25')]){delete _0x5e2fe6['name'];}_0xad4874[_0xe478('0x26')](_0x427708)[_0xe478('0x27')](_0x5e2fe6);};}exports[_0xe478('0x28')]=function(_0x43e52c,_0x4b1435){var _0x5fe35c={},_0x43d93f={},_0x569319={'count':0x0,'rows':[]};var _0x3e00e5=_[_0xe478('0x29')](db[_0xe478('0x2a')][_0xe478('0x2b')],function(_0x19a4bc){return{'name':_0x19a4bc['fieldName'],'type':_0x19a4bc['type'][_0xe478('0x2c')]};});_0x43d93f['model']=_[_0xe478('0x29')](_0x3e00e5,_0xe478('0x25'));_0x43d93f['query']=_[_0xe478('0x2d')](_0x43e52c[_0xe478('0x2e')]);_0x43d93f['filters']=_['intersection'](_0x43d93f[_0xe478('0x2f')],_0x43d93f[_0xe478('0x2e')]);_0x5fe35c[_0xe478('0x30')]=_[_0xe478('0x31')](_0x43d93f[_0xe478('0x2f')],qs[_0xe478('0x32')](_0x43e52c[_0xe478('0x2e')]['fields']));_0x5fe35c['attributes']=_0x5fe35c[_0xe478('0x30')][_0xe478('0x33')]?_0x5fe35c[_0xe478('0x30')]:_0x43d93f['model'];if(!_0x43e52c[_0xe478('0x2e')][_0xe478('0x34')](_0xe478('0x35'))){_0x5fe35c['limit']=qs['limit'](_0x43e52c[_0xe478('0x2e')][_0xe478('0x19')]);_0x5fe35c[_0xe478('0x1a')]=qs[_0xe478('0x1a')](_0x43e52c[_0xe478('0x2e')][_0xe478('0x1a')]);}_0x5fe35c[_0xe478('0x36')]=qs['sort'](_0x43e52c[_0xe478('0x2e')][_0xe478('0x37')]);_0x5fe35c['where']=qs['filters'](_[_0xe478('0x38')](_0x43e52c[_0xe478('0x2e')],_0x43d93f[_0xe478('0x39')]),_0x3e00e5);if(_0x43e52c[_0xe478('0x2e')][_0xe478('0x3a')]){_0x5fe35c[_0xe478('0x3b')]=_[_0xe478('0x3c')](_0x5fe35c[_0xe478('0x3b')],{'$or':_['map'](_0x3e00e5,function(_0x4637f2){if(_0x4637f2[_0xe478('0x3d')]!==_0xe478('0x3e')){var _0x353b49={};_0x353b49[_0x4637f2['name']]={'$like':'%'+_0x43e52c[_0xe478('0x2e')][_0xe478('0x3a')]+'%'};return _0x353b49;}})});}_0x5fe35c=_['merge']({},_0x5fe35c,_0x43e52c[_0xe478('0x3f')]);var _0xe75cf9={'where':_0x5fe35c[_0xe478('0x3b')]};return db[_0xe478('0x2a')][_0xe478('0x1b')](_0xe75cf9)[_0xe478('0x22')](function(_0x5abccb){_0x569319[_0xe478('0x1b')]=_0x5abccb;if(_0x43e52c['query']['includeAll']){_0x5fe35c[_0xe478('0x40')]=[{'all':!![]}];}return db['VtigerConfiguration'][_0xe478('0x41')](_0x5fe35c);})[_0xe478('0x22')](function(_0x26a305){_0x569319[_0xe478('0x42')]=_0x26a305;return _0x569319;})[_0xe478('0x22')](respondWithFilteredResult(_0x4b1435,_0x5fe35c))['catch'](handleError(_0x4b1435,null));};exports['show']=function(_0x467218,_0x5d0a92){var _0x27b7a4={'raw':![],'where':{'id':_0x467218[_0xe478('0x43')]['id']}},_0x3753c8={};_0x3753c8[_0xe478('0x2f')]=_[_0xe478('0x2d')](db[_0xe478('0x2a')]['rawAttributes']);_0x3753c8[_0xe478('0x2e')]=_[_0xe478('0x2d')](_0x467218['query']);_0x3753c8['filters']=_[_0xe478('0x31')](_0x3753c8[_0xe478('0x2f')],_0x3753c8['query']);_0x27b7a4[_0xe478('0x30')]=_[_0xe478('0x31')](_0x3753c8['model'],qs[_0xe478('0x32')](_0x467218[_0xe478('0x2e')]['fields']));_0x27b7a4[_0xe478('0x30')]=_0x27b7a4[_0xe478('0x30')][_0xe478('0x33')]?_0x27b7a4['attributes']:_0x3753c8['model'];if(_0x467218[_0xe478('0x2e')][_0xe478('0x44')]){_0x27b7a4[_0xe478('0x40')]=[{'all':!![]}];}_0x27b7a4=_[_0xe478('0x3c')]({},_0x27b7a4,_0x467218[_0xe478('0x3f')]);return db['VtigerConfiguration'][_0xe478('0x45')](_0x27b7a4)[_0xe478('0x22')](handleEntityNotFound(_0x5d0a92,null))[_0xe478('0x22')](respondWithResult(_0x5d0a92,null))[_0xe478('0x46')](handleError(_0x5d0a92,null));};exports['create']=function(_0x16a913,_0x4a95d0){return db[_0xe478('0x2a')][_0xe478('0x47')](_0x16a913[_0xe478('0x48')],{})[_0xe478('0x22')](respondWithResult(_0x4a95d0,0xc9))[_0xe478('0x46')](handleError(_0x4a95d0,null));};exports[_0xe478('0x21')]=function(_0x39db1f,_0x180234){if(_0x39db1f[_0xe478('0x48')]['id']){delete _0x39db1f[_0xe478('0x48')]['id'];}return db['VtigerConfiguration'][_0xe478('0x45')]({'where':{'id':_0x39db1f['params']['id']}})['then'](handleEntityNotFound(_0x180234,null))[_0xe478('0x22')](saveUpdates(_0x39db1f['body'],null))['then'](respondWithResult(_0x180234,null))['catch'](handleError(_0x180234,null));};exports[_0xe478('0x23')]=function(_0x48ab32,_0x1e5930){return db[_0xe478('0x2a')][_0xe478('0x45')]({'where':{'id':_0x48ab32['params']['id']}})[_0xe478('0x22')](handleEntityNotFound(_0x1e5930,null))[_0xe478('0x22')](removeEntity(_0x1e5930,null))[_0xe478('0x46')](handleError(_0x1e5930,null));};exports[_0xe478('0x49')]=function(_0x25047b,_0x448149,_0x946f8c){var _0x5b0da6={};var _0x5c83b3={};var _0xe77586;var _0x367d84;return db[_0xe478('0x2a')][_0xe478('0x4a')]({'where':{'id':_0x25047b['params']['id']}})[_0xe478('0x22')](handleEntityNotFound(_0x448149,null))['then'](function(_0x3c8e06){if(_0x3c8e06){_0xe77586=_0x3c8e06;_0x5c83b3['model']=_[_0xe478('0x2d')](db[_0xe478('0x4b')][_0xe478('0x2b')]);_0x5c83b3[_0xe478('0x2e')]=_[_0xe478('0x2d')](_0x25047b['query']);_0x5c83b3[_0xe478('0x39')]=_[_0xe478('0x31')](_0x5c83b3[_0xe478('0x2f')],_0x5c83b3[_0xe478('0x2e')]);_0x5b0da6[_0xe478('0x30')]=_[_0xe478('0x31')](_0x5c83b3[_0xe478('0x2f')],qs[_0xe478('0x32')](_0x25047b[_0xe478('0x2e')][_0xe478('0x32')]));_0x5b0da6[_0xe478('0x30')]=_0x5b0da6[_0xe478('0x30')][_0xe478('0x33')]?_0x5b0da6['attributes']:_0x5c83b3[_0xe478('0x2f')];_0x5b0da6['order']=qs[_0xe478('0x37')](_0x25047b[_0xe478('0x2e')][_0xe478('0x37')]);_0x5b0da6[_0xe478('0x3b')]=qs[_0xe478('0x39')](_[_0xe478('0x38')](_0x25047b['query'],_0x5c83b3[_0xe478('0x39')]));if(_0x25047b[_0xe478('0x2e')]['filter']){_0x5b0da6['where']=_['merge'](_0x5b0da6[_0xe478('0x3b')],{'$or':_['map'](_0x5b0da6[_0xe478('0x30')],function(_0x3df614){var _0x14a998={};_0x14a998[_0x3df614]={'$like':'%'+_0x25047b[_0xe478('0x2e')]['filter']+'%'};return _0x14a998;})});}_0x5b0da6=_[_0xe478('0x3c')]({},_0x5b0da6,_0x25047b[_0xe478('0x3f')]);return _0xe77586[_0xe478('0x49')](_0x5b0da6);}})[_0xe478('0x22')](function(_0x346ba3){if(_0x346ba3){_0x367d84=_0x346ba3[_0xe478('0x33')];if(!_0x25047b[_0xe478('0x2e')][_0xe478('0x34')]('nolimit')){_0x5b0da6[_0xe478('0x19')]=qs[_0xe478('0x19')](_0x25047b[_0xe478('0x2e')][_0xe478('0x19')]);_0x5b0da6[_0xe478('0x1a')]=qs[_0xe478('0x1a')](_0x25047b[_0xe478('0x2e')][_0xe478('0x1a')]);}return _0xe77586[_0xe478('0x49')](_0x5b0da6);}})['then'](function(_0x317c9f){if(_0x317c9f){return _0x317c9f?{'count':_0x367d84,'rows':_0x317c9f}:null;}})[_0xe478('0x22')](respondWithResult(_0x448149,null))[_0xe478('0x46')](handleError(_0x448149,null));};exports[_0xe478('0x4c')]=function(_0x569554,_0xff60e8,_0x2ac836){var _0x594789={};var _0x3b96b3={};var _0x135f5a;var _0x36b2c9;return db[_0xe478('0x2a')][_0xe478('0x4a')]({'where':{'id':_0x569554['params']['id']}})[_0xe478('0x22')](handleEntityNotFound(_0xff60e8,null))[_0xe478('0x22')](function(_0x3a839e){if(_0x3a839e){_0x135f5a=_0x3a839e;_0x3b96b3[_0xe478('0x2f')]=_[_0xe478('0x2d')](db[_0xe478('0x4b')]['rawAttributes']);_0x3b96b3[_0xe478('0x2e')]=_['keys'](_0x569554[_0xe478('0x2e')]);_0x3b96b3[_0xe478('0x39')]=_[_0xe478('0x31')](_0x3b96b3['model'],_0x3b96b3[_0xe478('0x2e')]);_0x594789[_0xe478('0x30')]=_[_0xe478('0x31')](_0x3b96b3['model'],qs[_0xe478('0x32')](_0x569554[_0xe478('0x2e')][_0xe478('0x32')]));_0x594789['attributes']=_0x594789[_0xe478('0x30')][_0xe478('0x33')]?_0x594789['attributes']:_0x3b96b3[_0xe478('0x2f')];_0x594789[_0xe478('0x36')]=qs[_0xe478('0x37')](_0x569554[_0xe478('0x2e')]['sort']);_0x594789[_0xe478('0x3b')]=qs[_0xe478('0x39')](_[_0xe478('0x38')](_0x569554[_0xe478('0x2e')],_0x3b96b3[_0xe478('0x39')]));if(_0x569554[_0xe478('0x2e')][_0xe478('0x3a')]){_0x594789['where']=_[_0xe478('0x3c')](_0x594789['where'],{'$or':_[_0xe478('0x29')](_0x594789[_0xe478('0x30')],function(_0x57b275){var _0xd38d1c={};_0xd38d1c[_0x57b275]={'$like':'%'+_0x569554['query'][_0xe478('0x3a')]+'%'};return _0xd38d1c;})});}_0x594789=_[_0xe478('0x3c')]({},_0x594789,_0x569554[_0xe478('0x3f')]);return _0x135f5a[_0xe478('0x4c')](_0x594789);}})[_0xe478('0x22')](function(_0x2c1803){if(_0x2c1803){_0x36b2c9=_0x2c1803['length'];if(!_0x569554[_0xe478('0x2e')][_0xe478('0x34')](_0xe478('0x35'))){_0x594789[_0xe478('0x19')]=qs[_0xe478('0x19')](_0x569554['query'][_0xe478('0x19')]);_0x594789[_0xe478('0x1a')]=qs['offset'](_0x569554[_0xe478('0x2e')]['offset']);}return _0x135f5a[_0xe478('0x4c')](_0x594789);}})[_0xe478('0x22')](function(_0x4070dc){if(_0x4070dc){return _0x4070dc?{'count':_0x36b2c9,'rows':_0x4070dc}:null;}})[_0xe478('0x22')](respondWithResult(_0xff60e8,null))[_0xe478('0x46')](handleError(_0xff60e8,null));};exports[_0xe478('0x4d')]=function(_0x3cd72b,_0x1bd4d8,_0x2b1cc9){var _0x4c8726={};var _0x1d22ed={};var _0x3ae5c9;var _0x564e7c;return db[_0xe478('0x2a')][_0xe478('0x4a')]({'where':{'id':_0x3cd72b[_0xe478('0x43')]['id']}})['then'](handleEntityNotFound(_0x1bd4d8,null))[_0xe478('0x22')](function(_0x4816ed){if(_0x4816ed){_0x3ae5c9=_0x4816ed;_0x1d22ed['model']=_[_0xe478('0x2d')](db[_0xe478('0x4b')][_0xe478('0x2b')]);_0x1d22ed['query']=_[_0xe478('0x2d')](_0x3cd72b[_0xe478('0x2e')]);_0x1d22ed[_0xe478('0x39')]=_[_0xe478('0x31')](_0x1d22ed['model'],_0x1d22ed[_0xe478('0x2e')]);_0x4c8726[_0xe478('0x30')]=_[_0xe478('0x31')](_0x1d22ed[_0xe478('0x2f')],qs[_0xe478('0x32')](_0x3cd72b[_0xe478('0x2e')][_0xe478('0x32')]));_0x4c8726['attributes']=_0x4c8726[_0xe478('0x30')][_0xe478('0x33')]?_0x4c8726[_0xe478('0x30')]:_0x1d22ed[_0xe478('0x2f')];_0x4c8726[_0xe478('0x36')]=qs[_0xe478('0x37')](_0x3cd72b[_0xe478('0x2e')][_0xe478('0x37')]);_0x4c8726[_0xe478('0x3b')]=qs['filters'](_[_0xe478('0x38')](_0x3cd72b[_0xe478('0x2e')],_0x1d22ed['filters']));if(_0x3cd72b[_0xe478('0x2e')][_0xe478('0x3a')]){_0x4c8726[_0xe478('0x3b')]=_[_0xe478('0x3c')](_0x4c8726[_0xe478('0x3b')],{'$or':_[_0xe478('0x29')](_0x4c8726[_0xe478('0x30')],function(_0x1d1bfe){var _0x5f2559={};_0x5f2559[_0x1d1bfe]={'$like':'%'+_0x3cd72b[_0xe478('0x2e')][_0xe478('0x3a')]+'%'};return _0x5f2559;})});}_0x4c8726=_[_0xe478('0x3c')]({},_0x4c8726,_0x3cd72b[_0xe478('0x3f')]);return _0x3ae5c9[_0xe478('0x4d')](_0x4c8726);}})['then'](function(_0x564430){if(_0x564430){_0x564e7c=_0x564430[_0xe478('0x33')];if(!_0x3cd72b[_0xe478('0x2e')][_0xe478('0x34')](_0xe478('0x35'))){_0x4c8726[_0xe478('0x19')]=qs[_0xe478('0x19')](_0x3cd72b['query']['limit']);_0x4c8726[_0xe478('0x1a')]=qs['offset'](_0x3cd72b[_0xe478('0x2e')]['offset']);}return _0x3ae5c9['getDescriptions'](_0x4c8726);}})[_0xe478('0x22')](function(_0x3f9100){if(_0x3f9100){return _0x3f9100?{'count':_0x564e7c,'rows':_0x3f9100}:null;}})[_0xe478('0x22')](respondWithResult(_0x1bd4d8,null))['catch'](handleError(_0x1bd4d8,null));}; \ No newline at end of file +var _0x9dc3=['rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','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','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','end','error','name','send','index','VtigerConfiguration','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','include','rows','catch','show','params','rawAttributes','includeAll','find','create','body','getFields','findOne','VtigerField','getSubjects','getDescriptions','eml-format'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x9dc3,0xa5));var _0x39dc=function(_0x4c6736,_0x568075){_0x4c6736=_0x4c6736-0x0;var _0x3b9469=_0x9dc3[_0x4c6736];return _0x3b9469;};'use strict';var emlformat=require(_0x39dc('0x0'));var rimraf=require(_0x39dc('0x1'));var zipdir=require(_0x39dc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x39dc('0x3'));var BPromise=require(_0x39dc('0x4'));var Mustache=require(_0x39dc('0x5'));var util=require(_0x39dc('0x6'));var path=require(_0x39dc('0x7'));var sox=require(_0x39dc('0x8'));var csv=require('to-csv');var ejs=require(_0x39dc('0x9'));var fs=require('fs');var fs_extra=require(_0x39dc('0xa'));var _=require(_0x39dc('0xb'));var squel=require(_0x39dc('0xc'));var crypto=require(_0x39dc('0xd'));var jsforce=require(_0x39dc('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x39dc('0xf'));var Redis=require(_0x39dc('0x10'));var authService=require(_0x39dc('0x11'));var qs=require(_0x39dc('0x12'));var as=require(_0x39dc('0x13'));var hardwareService=require(_0x39dc('0x14'));var logger=require(_0x39dc('0x15'))(_0x39dc('0x16'));var utils=require('../../config/utils');var config=require(_0x39dc('0x17'));var licenseUtil=require(_0x39dc('0x18'));var db=require(_0x39dc('0x19'))['db'];function respondWithStatusCode(_0x3e06e8,_0x563407){_0x563407=_0x563407||0xcc;return function(_0x2827d6){if(_0x2827d6){return _0x3e06e8[_0x39dc('0x1a')](_0x563407);}return _0x3e06e8[_0x39dc('0x1b')](_0x563407)['end']();};}function respondWithResult(_0x3ded19,_0x2ca172){_0x2ca172=_0x2ca172||0xc8;return function(_0x2b5712){if(_0x2b5712){return _0x3ded19[_0x39dc('0x1b')](_0x2ca172)[_0x39dc('0x1c')](_0x2b5712);}};}function respondWithFilteredResult(_0x4bcc35,_0x3f2265){return function(_0x286350){if(_0x286350){var _0x258601=typeof _0x3f2265[_0x39dc('0x1d')]===_0x39dc('0x1e')&&typeof _0x3f2265[_0x39dc('0x1f')]===_0x39dc('0x1e');var _0x489b4d=_0x286350[_0x39dc('0x20')];var _0x41e960=_0x258601?0x0:_0x3f2265['offset'];var _0x4ef125=_0x258601?_0x286350[_0x39dc('0x20')]:_0x3f2265[_0x39dc('0x1d')]+_0x3f2265[_0x39dc('0x1f')];var _0x341f0e;if(_0x4ef125>=_0x489b4d){_0x4ef125=_0x489b4d;_0x341f0e=0xc8;}else{_0x341f0e=0xce;}_0x4bcc35['status'](_0x341f0e);return _0x4bcc35[_0x39dc('0x21')]('Content-Range',_0x41e960+'-'+_0x4ef125+'/'+_0x489b4d)['json'](_0x286350);}return null;};}function patchUpdates(_0x25c951){return function(_0x1acf94){try{jsonpatch[_0x39dc('0x22')](_0x1acf94,_0x25c951,!![]);}catch(_0x2a6ec3){return BPromise[_0x39dc('0x23')](_0x2a6ec3);}return _0x1acf94[_0x39dc('0x24')]();};}function saveUpdates(_0x43920e,_0x301470){return function(_0x52cc7d){if(_0x52cc7d){return _0x52cc7d[_0x39dc('0x25')](_0x43920e)['then'](function(_0x5226de){return _0x5226de;});}return null;};}function removeEntity(_0x44b1f7,_0x5c124c){return function(_0x20e065){if(_0x20e065){return _0x20e065[_0x39dc('0x26')]()[_0x39dc('0x27')](function(){_0x44b1f7[_0x39dc('0x1b')](0xcc)[_0x39dc('0x28')]();});}};}function handleEntityNotFound(_0x421696,_0x3e998b){return function(_0xaeb89){if(!_0xaeb89){_0x421696['sendStatus'](0x194);}return _0xaeb89;};}function handleError(_0x485e9f,_0x56fff2){_0x56fff2=_0x56fff2||0x1f4;return function(_0x490802){logger[_0x39dc('0x29')](_0x490802['stack']);if(_0x490802[_0x39dc('0x2a')]){delete _0x490802[_0x39dc('0x2a')];}_0x485e9f[_0x39dc('0x1b')](_0x56fff2)[_0x39dc('0x2b')](_0x490802);};}exports[_0x39dc('0x2c')]=function(_0x9ecec,_0x3d7c9c){var _0x880d29={},_0x239eca={},_0x36405a={'count':0x0,'rows':[]};var _0x4196d6=_['map'](db[_0x39dc('0x2d')]['rawAttributes'],function(_0x3ac89f){return{'name':_0x3ac89f[_0x39dc('0x2e')],'type':_0x3ac89f[_0x39dc('0x2f')][_0x39dc('0x30')]};});_0x239eca[_0x39dc('0x31')]=_[_0x39dc('0x32')](_0x4196d6,'name');_0x239eca[_0x39dc('0x33')]=_[_0x39dc('0x34')](_0x9ecec[_0x39dc('0x33')]);_0x239eca[_0x39dc('0x35')]=_[_0x39dc('0x36')](_0x239eca[_0x39dc('0x31')],_0x239eca[_0x39dc('0x33')]);_0x880d29[_0x39dc('0x37')]=_[_0x39dc('0x36')](_0x239eca['model'],qs[_0x39dc('0x38')](_0x9ecec[_0x39dc('0x33')][_0x39dc('0x38')]));_0x880d29['attributes']=_0x880d29[_0x39dc('0x37')][_0x39dc('0x39')]?_0x880d29['attributes']:_0x239eca[_0x39dc('0x31')];if(!_0x9ecec[_0x39dc('0x33')][_0x39dc('0x3a')](_0x39dc('0x3b'))){_0x880d29[_0x39dc('0x1f')]=qs['limit'](_0x9ecec[_0x39dc('0x33')]['limit']);_0x880d29[_0x39dc('0x1d')]=qs[_0x39dc('0x1d')](_0x9ecec[_0x39dc('0x33')]['offset']);}_0x880d29[_0x39dc('0x3c')]=qs[_0x39dc('0x3d')](_0x9ecec['query'][_0x39dc('0x3d')]);_0x880d29['where']=qs[_0x39dc('0x35')](_[_0x39dc('0x3e')](_0x9ecec['query'],_0x239eca[_0x39dc('0x35')]),_0x4196d6);if(_0x9ecec[_0x39dc('0x33')][_0x39dc('0x3f')]){_0x880d29[_0x39dc('0x40')]=_['merge'](_0x880d29[_0x39dc('0x40')],{'$or':_[_0x39dc('0x32')](_0x4196d6,function(_0xd2c966){if(_0xd2c966['type']!==_0x39dc('0x41')){var _0x570749={};_0x570749[_0xd2c966['name']]={'$like':'%'+_0x9ecec['query'][_0x39dc('0x3f')]+'%'};return _0x570749;}})});}_0x880d29=_[_0x39dc('0x42')]({},_0x880d29,_0x9ecec[_0x39dc('0x43')]);var _0x5e1fc9={'where':_0x880d29[_0x39dc('0x40')]};return db[_0x39dc('0x2d')][_0x39dc('0x20')](_0x5e1fc9)[_0x39dc('0x27')](function(_0x1dd1a7){_0x36405a[_0x39dc('0x20')]=_0x1dd1a7;if(_0x9ecec['query']['includeAll']){_0x880d29[_0x39dc('0x44')]=[{'all':!![]}];}return db['VtigerConfiguration']['findAll'](_0x880d29);})['then'](function(_0x16843a){_0x36405a[_0x39dc('0x45')]=_0x16843a;return _0x36405a;})[_0x39dc('0x27')](respondWithFilteredResult(_0x3d7c9c,_0x880d29))[_0x39dc('0x46')](handleError(_0x3d7c9c,null));};exports[_0x39dc('0x47')]=function(_0x289e01,_0x1326c9){var _0x2dd593={'raw':![],'where':{'id':_0x289e01[_0x39dc('0x48')]['id']}},_0x411c3e={};_0x411c3e[_0x39dc('0x31')]=_[_0x39dc('0x34')](db['VtigerConfiguration'][_0x39dc('0x49')]);_0x411c3e[_0x39dc('0x33')]=_['keys'](_0x289e01['query']);_0x411c3e['filters']=_[_0x39dc('0x36')](_0x411c3e['model'],_0x411c3e['query']);_0x2dd593[_0x39dc('0x37')]=_[_0x39dc('0x36')](_0x411c3e[_0x39dc('0x31')],qs['fields'](_0x289e01[_0x39dc('0x33')][_0x39dc('0x38')]));_0x2dd593[_0x39dc('0x37')]=_0x2dd593['attributes'][_0x39dc('0x39')]?_0x2dd593[_0x39dc('0x37')]:_0x411c3e[_0x39dc('0x31')];if(_0x289e01[_0x39dc('0x33')][_0x39dc('0x4a')]){_0x2dd593['include']=[{'all':!![]}];}_0x2dd593=_[_0x39dc('0x42')]({},_0x2dd593,_0x289e01[_0x39dc('0x43')]);return db['VtigerConfiguration'][_0x39dc('0x4b')](_0x2dd593)[_0x39dc('0x27')](handleEntityNotFound(_0x1326c9,null))[_0x39dc('0x27')](respondWithResult(_0x1326c9,null))[_0x39dc('0x46')](handleError(_0x1326c9,null));};exports[_0x39dc('0x4c')]=function(_0x4b47e9,_0x4e1af8){return db[_0x39dc('0x2d')][_0x39dc('0x4c')](_0x4b47e9[_0x39dc('0x4d')],{})[_0x39dc('0x27')](respondWithResult(_0x4e1af8,0xc9))[_0x39dc('0x46')](handleError(_0x4e1af8,null));};exports['update']=function(_0x50f89c,_0x2a91c5){if(_0x50f89c[_0x39dc('0x4d')]['id']){delete _0x50f89c[_0x39dc('0x4d')]['id'];}return db[_0x39dc('0x2d')][_0x39dc('0x4b')]({'where':{'id':_0x50f89c[_0x39dc('0x48')]['id']}})[_0x39dc('0x27')](handleEntityNotFound(_0x2a91c5,null))[_0x39dc('0x27')](saveUpdates(_0x50f89c['body'],null))[_0x39dc('0x27')](respondWithResult(_0x2a91c5,null))[_0x39dc('0x46')](handleError(_0x2a91c5,null));};exports['destroy']=function(_0x7ca27f,_0x25bb0f){return db[_0x39dc('0x2d')][_0x39dc('0x4b')]({'where':{'id':_0x7ca27f['params']['id']}})[_0x39dc('0x27')](handleEntityNotFound(_0x25bb0f,null))['then'](removeEntity(_0x25bb0f,null))['catch'](handleError(_0x25bb0f,null));};exports[_0x39dc('0x4e')]=function(_0x5c8597,_0x5b6683,_0x53a0d6){var _0x372f73={};var _0x449b30={};var _0x44eadd;var _0x3bb350;return db[_0x39dc('0x2d')][_0x39dc('0x4f')]({'where':{'id':_0x5c8597['params']['id']}})[_0x39dc('0x27')](handleEntityNotFound(_0x5b6683,null))['then'](function(_0x66e08d){if(_0x66e08d){_0x44eadd=_0x66e08d;_0x449b30[_0x39dc('0x31')]=_[_0x39dc('0x34')](db[_0x39dc('0x50')][_0x39dc('0x49')]);_0x449b30[_0x39dc('0x33')]=_['keys'](_0x5c8597[_0x39dc('0x33')]);_0x449b30[_0x39dc('0x35')]=_[_0x39dc('0x36')](_0x449b30[_0x39dc('0x31')],_0x449b30[_0x39dc('0x33')]);_0x372f73[_0x39dc('0x37')]=_['intersection'](_0x449b30[_0x39dc('0x31')],qs['fields'](_0x5c8597['query'][_0x39dc('0x38')]));_0x372f73[_0x39dc('0x37')]=_0x372f73[_0x39dc('0x37')]['length']?_0x372f73[_0x39dc('0x37')]:_0x449b30[_0x39dc('0x31')];_0x372f73[_0x39dc('0x3c')]=qs[_0x39dc('0x3d')](_0x5c8597['query'][_0x39dc('0x3d')]);_0x372f73[_0x39dc('0x40')]=qs[_0x39dc('0x35')](_[_0x39dc('0x3e')](_0x5c8597[_0x39dc('0x33')],_0x449b30['filters']));if(_0x5c8597[_0x39dc('0x33')]['filter']){_0x372f73[_0x39dc('0x40')]=_[_0x39dc('0x42')](_0x372f73[_0x39dc('0x40')],{'$or':_[_0x39dc('0x32')](_0x372f73['attributes'],function(_0x50385f){var _0x52a215={};_0x52a215[_0x50385f]={'$like':'%'+_0x5c8597['query']['filter']+'%'};return _0x52a215;})});}_0x372f73=_['merge']({},_0x372f73,_0x5c8597['options']);return _0x44eadd['getFields'](_0x372f73);}})['then'](function(_0x254299){if(_0x254299){_0x3bb350=_0x254299['length'];if(!_0x5c8597[_0x39dc('0x33')][_0x39dc('0x3a')](_0x39dc('0x3b'))){_0x372f73['limit']=qs[_0x39dc('0x1f')](_0x5c8597['query'][_0x39dc('0x1f')]);_0x372f73['offset']=qs[_0x39dc('0x1d')](_0x5c8597['query']['offset']);}return _0x44eadd[_0x39dc('0x4e')](_0x372f73);}})[_0x39dc('0x27')](function(_0x158a21){if(_0x158a21){return _0x158a21?{'count':_0x3bb350,'rows':_0x158a21}:null;}})['then'](respondWithResult(_0x5b6683,null))[_0x39dc('0x46')](handleError(_0x5b6683,null));};exports['getSubjects']=function(_0x1ba0f0,_0x397e65,_0x447f10){var _0x223f59={};var _0x52a8fc={};var _0x445e73;var _0x261337;return db[_0x39dc('0x2d')][_0x39dc('0x4f')]({'where':{'id':_0x1ba0f0[_0x39dc('0x48')]['id']}})['then'](handleEntityNotFound(_0x397e65,null))[_0x39dc('0x27')](function(_0x47251f){if(_0x47251f){_0x445e73=_0x47251f;_0x52a8fc[_0x39dc('0x31')]=_[_0x39dc('0x34')](db['VtigerField'][_0x39dc('0x49')]);_0x52a8fc[_0x39dc('0x33')]=_[_0x39dc('0x34')](_0x1ba0f0[_0x39dc('0x33')]);_0x52a8fc[_0x39dc('0x35')]=_[_0x39dc('0x36')](_0x52a8fc[_0x39dc('0x31')],_0x52a8fc[_0x39dc('0x33')]);_0x223f59[_0x39dc('0x37')]=_[_0x39dc('0x36')](_0x52a8fc[_0x39dc('0x31')],qs[_0x39dc('0x38')](_0x1ba0f0['query'][_0x39dc('0x38')]));_0x223f59[_0x39dc('0x37')]=_0x223f59['attributes'][_0x39dc('0x39')]?_0x223f59[_0x39dc('0x37')]:_0x52a8fc[_0x39dc('0x31')];_0x223f59[_0x39dc('0x3c')]=qs[_0x39dc('0x3d')](_0x1ba0f0[_0x39dc('0x33')]['sort']);_0x223f59[_0x39dc('0x40')]=qs['filters'](_[_0x39dc('0x3e')](_0x1ba0f0[_0x39dc('0x33')],_0x52a8fc[_0x39dc('0x35')]));if(_0x1ba0f0[_0x39dc('0x33')]['filter']){_0x223f59[_0x39dc('0x40')]=_['merge'](_0x223f59[_0x39dc('0x40')],{'$or':_[_0x39dc('0x32')](_0x223f59[_0x39dc('0x37')],function(_0x536740){var _0x5760d6={};_0x5760d6[_0x536740]={'$like':'%'+_0x1ba0f0[_0x39dc('0x33')][_0x39dc('0x3f')]+'%'};return _0x5760d6;})});}_0x223f59=_[_0x39dc('0x42')]({},_0x223f59,_0x1ba0f0[_0x39dc('0x43')]);return _0x445e73[_0x39dc('0x51')](_0x223f59);}})[_0x39dc('0x27')](function(_0x1703d0){if(_0x1703d0){_0x261337=_0x1703d0[_0x39dc('0x39')];if(!_0x1ba0f0[_0x39dc('0x33')]['hasOwnProperty']('nolimit')){_0x223f59[_0x39dc('0x1f')]=qs[_0x39dc('0x1f')](_0x1ba0f0[_0x39dc('0x33')]['limit']);_0x223f59['offset']=qs['offset'](_0x1ba0f0[_0x39dc('0x33')][_0x39dc('0x1d')]);}return _0x445e73[_0x39dc('0x51')](_0x223f59);}})[_0x39dc('0x27')](function(_0x3bd21e){if(_0x3bd21e){return _0x3bd21e?{'count':_0x261337,'rows':_0x3bd21e}:null;}})[_0x39dc('0x27')](respondWithResult(_0x397e65,null))['catch'](handleError(_0x397e65,null));};exports[_0x39dc('0x52')]=function(_0x27c565,_0x589ed3,_0x384f20){var _0x14e38f={};var _0x2d87cb={};var _0x32a286;var _0x178380;return db[_0x39dc('0x2d')][_0x39dc('0x4f')]({'where':{'id':_0x27c565['params']['id']}})[_0x39dc('0x27')](handleEntityNotFound(_0x589ed3,null))[_0x39dc('0x27')](function(_0x26cbef){if(_0x26cbef){_0x32a286=_0x26cbef;_0x2d87cb['model']=_[_0x39dc('0x34')](db[_0x39dc('0x50')][_0x39dc('0x49')]);_0x2d87cb[_0x39dc('0x33')]=_['keys'](_0x27c565[_0x39dc('0x33')]);_0x2d87cb['filters']=_[_0x39dc('0x36')](_0x2d87cb[_0x39dc('0x31')],_0x2d87cb[_0x39dc('0x33')]);_0x14e38f[_0x39dc('0x37')]=_[_0x39dc('0x36')](_0x2d87cb['model'],qs[_0x39dc('0x38')](_0x27c565[_0x39dc('0x33')][_0x39dc('0x38')]));_0x14e38f[_0x39dc('0x37')]=_0x14e38f[_0x39dc('0x37')]['length']?_0x14e38f['attributes']:_0x2d87cb[_0x39dc('0x31')];_0x14e38f[_0x39dc('0x3c')]=qs[_0x39dc('0x3d')](_0x27c565['query'][_0x39dc('0x3d')]);_0x14e38f[_0x39dc('0x40')]=qs[_0x39dc('0x35')](_[_0x39dc('0x3e')](_0x27c565['query'],_0x2d87cb['filters']));if(_0x27c565[_0x39dc('0x33')]['filter']){_0x14e38f['where']=_[_0x39dc('0x42')](_0x14e38f[_0x39dc('0x40')],{'$or':_['map'](_0x14e38f[_0x39dc('0x37')],function(_0x13db36){var _0x427e8d={};_0x427e8d[_0x13db36]={'$like':'%'+_0x27c565[_0x39dc('0x33')][_0x39dc('0x3f')]+'%'};return _0x427e8d;})});}_0x14e38f=_[_0x39dc('0x42')]({},_0x14e38f,_0x27c565[_0x39dc('0x43')]);return _0x32a286[_0x39dc('0x52')](_0x14e38f);}})['then'](function(_0x3d4e9f){if(_0x3d4e9f){_0x178380=_0x3d4e9f[_0x39dc('0x39')];if(!_0x27c565['query'][_0x39dc('0x3a')]('nolimit')){_0x14e38f[_0x39dc('0x1f')]=qs[_0x39dc('0x1f')](_0x27c565[_0x39dc('0x33')][_0x39dc('0x1f')]);_0x14e38f[_0x39dc('0x1d')]=qs[_0x39dc('0x1d')](_0x27c565['query']['offset']);}return _0x32a286[_0x39dc('0x52')](_0x14e38f);}})['then'](function(_0x161035){if(_0x161035){return _0x161035?{'count':_0x178380,'rows':_0x161035}:null;}})[_0x39dc('0x27')](respondWithResult(_0x589ed3,null))[_0x39dc('0x46')](handleError(_0x589ed3,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 3e29857..a1db9ba 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 _0xcc7a=['api','moment','bluebird','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','define','lodash','../../config/logger'];(function(_0x200aa5,_0x197802){var _0x458200=function(_0x594959){while(--_0x594959){_0x200aa5['push'](_0x200aa5['shift']());}};_0x458200(++_0x197802);}(_0xcc7a,0xd0));var _0xacc7=function(_0x1b25c1,_0x2c6ce6){_0x1b25c1=_0x1b25c1-0x0;var _0x1e4447=_0xcc7a[_0x1b25c1];return _0x1e4447;};'use strict';var _=require(_0xacc7('0x0'));var util=require('util');var logger=require(_0xacc7('0x1'))(_0xacc7('0x2'));var moment=require(_0xacc7('0x3'));var BPromise=require(_0xacc7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xacc7('0x5'));var config=require(_0xacc7('0x6'));var attributes=require(_0xacc7('0x7'));module[_0xacc7('0x8')]=function(_0x48abb8,_0x5c2fa9){return _0x48abb8[_0xacc7('0x9')]('VtigerConfiguration',attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x755f=['int_vtiger_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration'];(function(_0xd7926d,_0x36ac32){var _0xb0d332=function(_0x447b36){while(--_0x447b36){_0xd7926d['push'](_0xd7926d['shift']());}};_0xb0d332(++_0x36ac32);}(_0x755f,0x79));var _0xf755=function(_0x1f094d,_0x4dc478){_0x1f094d=_0x1f094d-0x0;var _0x597ecd=_0x755f[_0x1f094d];return _0x597ecd;};'use strict';var _=require(_0xf755('0x0'));var util=require(_0xf755('0x1'));var logger=require(_0xf755('0x2'))(_0xf755('0x3'));var moment=require(_0xf755('0x4'));var BPromise=require(_0xf755('0x5'));var rp=require(_0xf755('0x6'));var fs=require('fs');var path=require(_0xf755('0x7'));var rimraf=require(_0xf755('0x8'));var config=require(_0xf755('0x9'));var attributes=require(_0xf755('0xa'));module[_0xf755('0xb')]=function(_0x4ea2e0,_0x210bb3){return _0x4ea2e0[_0xf755('0xc')](_0xf755('0xd'),attributes,{'tableName':_0xf755('0xe'),'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 0094ab5..fd4b556 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 _0xbd83=['../../config/utils','rpc','jayson/promise','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x2d8efc,_0x58e635){var _0x4a7f2d=function(_0x5404e7){while(--_0x5404e7){_0x2d8efc['push'](_0x2d8efc['shift']());}};_0x4a7f2d(++_0x58e635);}(_0xbd83,0x180));var _0x3bd8=function(_0x38aeea,_0x57522a){_0x38aeea=_0x38aeea-0x0;var _0x5e8d2c=_0xbd83[_0x38aeea];return _0x5e8d2c;};'use strict';var _=require(_0x3bd8('0x0'));var util=require(_0x3bd8('0x1'));var moment=require(_0x3bd8('0x2'));var BPromise=require(_0x3bd8('0x3'));var rs=require(_0x3bd8('0x4'));var fs=require('fs');var Redis=require(_0x3bd8('0x5'));var db=require(_0x3bd8('0x6'))['db'];var utils=require(_0x3bd8('0x7'));var logger=require('../../config/logger')(_0x3bd8('0x8'));var config=require('../../config/environment');var jayson=require(_0x3bd8('0x9'));var client=jayson['client'][_0x3bd8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x355d45,_0x16431c,_0x51ea32){return new BPromise(function(_0xd5becd,_0x495348){return client[_0x3bd8('0xb')](_0x355d45,_0x51ea32)[_0x3bd8('0xc')](function(_0x44b60b){logger[_0x3bd8('0xd')](_0x3bd8('0xe'),_0x16431c,_0x3bd8('0xf'));logger[_0x3bd8('0x10')](_0x3bd8('0x11'),_0x16431c,_0x3bd8('0xf'),JSON['stringify'](_0x44b60b));if(_0x44b60b[_0x3bd8('0x12')]){if(_0x44b60b[_0x3bd8('0x12')][_0x3bd8('0x13')]===0x1f4){logger[_0x3bd8('0x12')](_0x3bd8('0xe'),_0x16431c,_0x44b60b['error'][_0x3bd8('0x14')]);return _0x495348(_0x44b60b['error'][_0x3bd8('0x14')]);}logger[_0x3bd8('0x12')](_0x3bd8('0xe'),_0x16431c,_0x44b60b[_0x3bd8('0x12')][_0x3bd8('0x14')]);return _0xd5becd(_0x44b60b[_0x3bd8('0x12')]['message']);}else{logger[_0x3bd8('0xd')](_0x3bd8('0xe'),_0x16431c,_0x3bd8('0xf'));_0xd5becd(_0x44b60b[_0x3bd8('0x15')][_0x3bd8('0x14')]);}})[_0x3bd8('0x16')](function(_0x1e30cb){logger[_0x3bd8('0x12')](_0x3bd8('0xe'),_0x16431c,_0x1e30cb);_0x495348(_0x1e30cb);});});} \ No newline at end of file +var _0x9a7f=['error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x290612,_0x264e17){var _0x44aade=function(_0x3358d9){while(--_0x3358d9){_0x290612['push'](_0x290612['shift']());}};_0x44aade(++_0x264e17);}(_0x9a7f,0xea));var _0xf9a7=function(_0x52aec5,_0x49e60d){_0x52aec5=_0x52aec5-0x0;var _0x4c23dd=_0x9a7f[_0x52aec5];return _0x4c23dd;};'use strict';var _=require(_0xf9a7('0x0'));var util=require(_0xf9a7('0x1'));var moment=require(_0xf9a7('0x2'));var BPromise=require(_0xf9a7('0x3'));var rs=require(_0xf9a7('0x4'));var fs=require('fs');var Redis=require(_0xf9a7('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf9a7('0x6'))('rpc');var config=require(_0xf9a7('0x7'));var jayson=require(_0xf9a7('0x8'));var client=jayson[_0xf9a7('0x9')][_0xf9a7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4d5b50,_0x371edb,_0x18d92c){return new BPromise(function(_0x4d9a72,_0x2e6a69){return client[_0xf9a7('0xb')](_0x4d5b50,_0x18d92c)[_0xf9a7('0xc')](function(_0x1851e6){logger[_0xf9a7('0xd')](_0xf9a7('0xe'),_0x371edb,'request\x20sent');logger[_0xf9a7('0xf')](_0xf9a7('0x10'),_0x371edb,_0xf9a7('0x11'),JSON[_0xf9a7('0x12')](_0x1851e6));if(_0x1851e6[_0xf9a7('0x13')]){if(_0x1851e6[_0xf9a7('0x13')][_0xf9a7('0x14')]===0x1f4){logger[_0xf9a7('0x13')](_0xf9a7('0xe'),_0x371edb,_0x1851e6['error']['message']);return _0x2e6a69(_0x1851e6['error'][_0xf9a7('0x15')]);}logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x371edb,_0x1851e6[_0xf9a7('0x13')][_0xf9a7('0x15')]);return _0x4d9a72(_0x1851e6[_0xf9a7('0x13')][_0xf9a7('0x15')]);}else{logger['info'](_0xf9a7('0xe'),_0x371edb,_0xf9a7('0x11'));_0x4d9a72(_0x1851e6[_0xf9a7('0x16')]['message']);}})['catch'](function(_0x1eea25){logger[_0xf9a7('0x13')](_0xf9a7('0xe'),_0x371edb,_0x1eea25);_0x2e6a69(_0x1eea25);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 6fea687..8d7f1a1 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 _0x3ead=['post','create','put','update','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','index','/:id','show'];(function(_0x2307fa,_0x266e5e){var _0x496486=function(_0x53466e){while(--_0x53466e){_0x2307fa['push'](_0x2307fa['shift']());}};_0x496486(++_0x266e5e);}(_0x3ead,0x15b));var _0xd3ea=function(_0x1635fe,_0x5f1d9f){_0x1635fe=_0x1635fe-0x0;var _0x3c512a=_0x3ead[_0x1635fe];return _0x3c512a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd3ea('0x0'));var timeout=require(_0xd3ea('0x1'));var express=require(_0xd3ea('0x2'));var router=express[_0xd3ea('0x3')]();var fs_extra=require(_0xd3ea('0x4'));var auth=require(_0xd3ea('0x5'));var interaction=require(_0xd3ea('0x6'));var config=require(_0xd3ea('0x7'));var controller=require(_0xd3ea('0x8'));router[_0xd3ea('0x9')]('/',auth[_0xd3ea('0xa')](),controller[_0xd3ea('0xb')]);router[_0xd3ea('0x9')](_0xd3ea('0xc'),auth[_0xd3ea('0xa')](),controller[_0xd3ea('0xd')]);router[_0xd3ea('0xe')]('/',auth[_0xd3ea('0xa')](),controller[_0xd3ea('0xf')]);router[_0xd3ea('0x10')](_0xd3ea('0xc'),auth[_0xd3ea('0xa')](),controller[_0xd3ea('0x11')]);router['delete'](_0xd3ea('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xd3ea('0x12')]=router; \ No newline at end of file +var _0xbc1c=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./intVtigerField.controller','isAuthenticated','index','get','/:id','show','post','create','put','delete','exports','multer','util','path'];(function(_0x3a0d89,_0x4256f8){var _0x51c8f1=function(_0x965c3){while(--_0x965c3){_0x3a0d89['push'](_0x3a0d89['shift']());}};_0x51c8f1(++_0x4256f8);}(_0xbc1c,0x140));var _0xcbc1=function(_0x4fd82a,_0x29d9d5){_0x4fd82a=_0x4fd82a-0x0;var _0x21d2a8=_0xbc1c[_0x4fd82a];return _0x21d2a8;};'use strict';var multer=require(_0xcbc1('0x0'));var util=require(_0xcbc1('0x1'));var path=require(_0xcbc1('0x2'));var timeout=require('connect-timeout');var express=require(_0xcbc1('0x3'));var router=express[_0xcbc1('0x4')]();var fs_extra=require(_0xcbc1('0x5'));var auth=require(_0xcbc1('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xcbc1('0x7'));var controller=require(_0xcbc1('0x8'));router['get']('/',auth[_0xcbc1('0x9')](),controller[_0xcbc1('0xa')]);router[_0xcbc1('0xb')](_0xcbc1('0xc'),auth[_0xcbc1('0x9')](),controller[_0xcbc1('0xd')]);router[_0xcbc1('0xe')]('/',auth[_0xcbc1('0x9')](),controller[_0xcbc1('0xf')]);router[_0xcbc1('0x10')]('/:id',auth[_0xcbc1('0x9')](),controller['update']);router[_0xcbc1('0x11')](_0xcbc1('0xc'),auth[_0xcbc1('0x9')](),controller['destroy']);module[_0xcbc1('0x12')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index f498d0d..6c711bf 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 _0xba51=['string','variable','customVariable','keyValue','STRING','ENUM','BOOLEAN','sequelize','exports'];(function(_0xbc6e84,_0x5259c5){var _0x33f728=function(_0x56da96){while(--_0x56da96){_0xbc6e84['push'](_0xbc6e84['shift']());}};_0x33f728(++_0x5259c5);}(_0xba51,0xa9));var _0x1ba5=function(_0x1fe507,_0x59bc05){_0x1fe507=_0x1fe507-0x0;var _0x448e33=_0xba51[_0x1fe507];return _0x448e33;};'use strict';var Sequelize=require(_0x1ba5('0x0'));module[_0x1ba5('0x1')]={'type':{'type':Sequelize['ENUM'](_0x1ba5('0x2'),_0x1ba5('0x3'),_0x1ba5('0x4'),_0x1ba5('0x5'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x1ba5('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x1ba5('0x7')](_0x1ba5('0x2'),_0x1ba5('0x3'),_0x1ba5('0x4'))},'keyContent':{'type':Sequelize[_0x1ba5('0x6')]},'idField':{'type':Sequelize[_0x1ba5('0x6')]},'nameField':{'type':Sequelize[_0x1ba5('0x6')]},'customField':{'type':Sequelize[_0x1ba5('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1ba5('0x6')]}}; \ No newline at end of file +var _0xec0e=['STRING','BOOLEAN','sequelize','exports','ENUM','string','customVariable','picklist'];(function(_0x31c0c5,_0x3fb9c0){var _0x2eec85=function(_0xab4431){while(--_0xab4431){_0x31c0c5['push'](_0x31c0c5['shift']());}};_0x2eec85(++_0x3fb9c0);}(_0xec0e,0x1ca));var _0xeec0=function(_0x243bba,_0x1ea69f){_0x243bba=_0x243bba-0x0;var _0x12e696=_0xec0e[_0x243bba];return _0x12e696;};'use strict';var Sequelize=require(_0xeec0('0x0'));module[_0xeec0('0x1')]={'type':{'type':Sequelize[_0xeec0('0x2')](_0xeec0('0x3'),'variable',_0xeec0('0x4'),'keyValue',_0xeec0('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xeec0('0x6')]},'key':{'type':Sequelize[_0xeec0('0x6')]},'keyType':{'type':Sequelize[_0xeec0('0x2')]('string','variable',_0xeec0('0x4'))},'keyContent':{'type':Sequelize[_0xeec0('0x6')]},'idField':{'type':Sequelize[_0xeec0('0x6')]},'nameField':{'type':Sequelize[_0xeec0('0x6')]},'customField':{'type':Sequelize[_0xeec0('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xeec0('0x6')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 9645a0d..7d4f6aa 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 _0x77a4=['sendStatus','status','json','offset','limit','undefined','count','set','apply','save','then','end','error','name','send','index','map','VtigerField','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','update','destroy','eml-format','rimraf','zip-dir','moment','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','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x4fd7ba,_0x2f5e2e){var _0x484da9=function(_0x3e920d){while(--_0x3e920d){_0x4fd7ba['push'](_0x4fd7ba['shift']());}};_0x484da9(++_0x2f5e2e);}(_0x77a4,0x155));var _0x477a=function(_0x4d7379,_0x4b4e63){_0x4d7379=_0x4d7379-0x0;var _0x46d7cf=_0x77a4[_0x4d7379];return _0x46d7cf;};'use strict';var emlformat=require(_0x477a('0x0'));var rimraf=require(_0x477a('0x1'));var zipdir=require(_0x477a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x477a('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x477a('0x4'));var path=require(_0x477a('0x5'));var sox=require('sox');var csv=require(_0x477a('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x477a('0x7'));var _=require(_0x477a('0x8'));var squel=require(_0x477a('0x9'));var crypto=require(_0x477a('0xa'));var jsforce=require(_0x477a('0xb'));var deskjs=require(_0x477a('0xc'));var toCsv=require(_0x477a('0x6'));var querystring=require(_0x477a('0xd'));var Papa=require('papaparse');var Redis=require(_0x477a('0xe'));var authService=require(_0x477a('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x477a('0x10'));var hardwareService=require(_0x477a('0x11'));var logger=require(_0x477a('0x12'))(_0x477a('0x13'));var utils=require(_0x477a('0x14'));var config=require(_0x477a('0x15'));var licenseUtil=require(_0x477a('0x16'));var db=require(_0x477a('0x17'))['db'];function respondWithStatusCode(_0x1d43da,_0x9f501c){_0x9f501c=_0x9f501c||0xcc;return function(_0x5eaa0c){if(_0x5eaa0c){return _0x1d43da[_0x477a('0x18')](_0x9f501c);}return _0x1d43da[_0x477a('0x19')](_0x9f501c)['end']();};}function respondWithResult(_0x55db6e,_0x2eac09){_0x2eac09=_0x2eac09||0xc8;return function(_0x1975fc){if(_0x1975fc){return _0x55db6e[_0x477a('0x19')](_0x2eac09)[_0x477a('0x1a')](_0x1975fc);}};}function respondWithFilteredResult(_0xb713e6,_0x203aa1){return function(_0x747289){if(_0x747289){var _0x213f7f=typeof _0x203aa1[_0x477a('0x1b')]==='undefined'&&typeof _0x203aa1[_0x477a('0x1c')]===_0x477a('0x1d');var _0x592182=_0x747289[_0x477a('0x1e')];var _0x49fe97=_0x213f7f?0x0:_0x203aa1['offset'];var _0x4de171=_0x213f7f?_0x747289[_0x477a('0x1e')]:_0x203aa1[_0x477a('0x1b')]+_0x203aa1[_0x477a('0x1c')];var _0xbd0525;if(_0x4de171>=_0x592182){_0x4de171=_0x592182;_0xbd0525=0xc8;}else{_0xbd0525=0xce;}_0xb713e6[_0x477a('0x19')](_0xbd0525);return _0xb713e6[_0x477a('0x1f')]('Content-Range',_0x49fe97+'-'+_0x4de171+'/'+_0x592182)[_0x477a('0x1a')](_0x747289);}return null;};}function patchUpdates(_0x29490c){return function(_0x152184){try{jsonpatch[_0x477a('0x20')](_0x152184,_0x29490c,!![]);}catch(_0x5487dc){return BPromise['reject'](_0x5487dc);}return _0x152184[_0x477a('0x21')]();};}function saveUpdates(_0x15c71c,_0x489d6b){return function(_0x2ec562){if(_0x2ec562){return _0x2ec562['update'](_0x15c71c)[_0x477a('0x22')](function(_0x5800c8){return _0x5800c8;});}return null;};}function removeEntity(_0x8de66f,_0x35765b){return function(_0x5c8d2d){if(_0x5c8d2d){return _0x5c8d2d['destroy']()[_0x477a('0x22')](function(){_0x8de66f['status'](0xcc)[_0x477a('0x23')]();});}};}function handleEntityNotFound(_0x221195,_0x17a8f8){return function(_0x4176ba){if(!_0x4176ba){_0x221195[_0x477a('0x18')](0x194);}return _0x4176ba;};}function handleError(_0x26fe40,_0x6e9655){_0x6e9655=_0x6e9655||0x1f4;return function(_0x33e441){logger[_0x477a('0x24')](_0x33e441['stack']);if(_0x33e441[_0x477a('0x25')]){delete _0x33e441[_0x477a('0x25')];}_0x26fe40[_0x477a('0x19')](_0x6e9655)[_0x477a('0x26')](_0x33e441);};}exports[_0x477a('0x27')]=function(_0x4c0749,_0x4b192e){var _0xd04f72={},_0x1ec3c1={},_0x2d2940={'count':0x0,'rows':[]};var _0x477c3c=_[_0x477a('0x28')](db[_0x477a('0x29')][_0x477a('0x2a')],function(_0x1a72de){return{'name':_0x1a72de[_0x477a('0x2b')],'type':_0x1a72de['type'][_0x477a('0x2c')]};});_0x1ec3c1[_0x477a('0x2d')]=_[_0x477a('0x28')](_0x477c3c,'name');_0x1ec3c1[_0x477a('0x2e')]=_[_0x477a('0x2f')](_0x4c0749[_0x477a('0x2e')]);_0x1ec3c1[_0x477a('0x30')]=_[_0x477a('0x31')](_0x1ec3c1[_0x477a('0x2d')],_0x1ec3c1[_0x477a('0x2e')]);_0xd04f72['attributes']=_[_0x477a('0x31')](_0x1ec3c1[_0x477a('0x2d')],qs[_0x477a('0x32')](_0x4c0749[_0x477a('0x2e')][_0x477a('0x32')]));_0xd04f72[_0x477a('0x33')]=_0xd04f72['attributes'][_0x477a('0x34')]?_0xd04f72[_0x477a('0x33')]:_0x1ec3c1[_0x477a('0x2d')];if(!_0x4c0749[_0x477a('0x2e')][_0x477a('0x35')](_0x477a('0x36'))){_0xd04f72[_0x477a('0x1c')]=qs[_0x477a('0x1c')](_0x4c0749[_0x477a('0x2e')][_0x477a('0x1c')]);_0xd04f72[_0x477a('0x1b')]=qs[_0x477a('0x1b')](_0x4c0749[_0x477a('0x2e')]['offset']);}_0xd04f72[_0x477a('0x37')]=qs['sort'](_0x4c0749[_0x477a('0x2e')][_0x477a('0x38')]);_0xd04f72[_0x477a('0x39')]=qs['filters'](_['pick'](_0x4c0749['query'],_0x1ec3c1[_0x477a('0x30')]),_0x477c3c);if(_0x4c0749[_0x477a('0x2e')][_0x477a('0x3a')]){_0xd04f72[_0x477a('0x39')]=_[_0x477a('0x3b')](_0xd04f72[_0x477a('0x39')],{'$or':_[_0x477a('0x28')](_0x477c3c,function(_0x1e0e83){if(_0x1e0e83['type']!==_0x477a('0x3c')){var _0x4b637c={};_0x4b637c[_0x1e0e83[_0x477a('0x25')]]={'$like':'%'+_0x4c0749[_0x477a('0x2e')]['filter']+'%'};return _0x4b637c;}})});}_0xd04f72=_['merge']({},_0xd04f72,_0x4c0749[_0x477a('0x3d')]);var _0x28b2f9={'where':_0xd04f72[_0x477a('0x39')]};return db['VtigerField'][_0x477a('0x1e')](_0x28b2f9)[_0x477a('0x22')](function(_0x13f121){_0x2d2940[_0x477a('0x1e')]=_0x13f121;if(_0x4c0749['query'][_0x477a('0x3e')]){_0xd04f72[_0x477a('0x3f')]=[{'all':!![]}];}return db['VtigerField']['findAll'](_0xd04f72);})[_0x477a('0x22')](function(_0x2cbb16){_0x2d2940[_0x477a('0x40')]=_0x2cbb16;return _0x2d2940;})['then'](respondWithFilteredResult(_0x4b192e,_0xd04f72))[_0x477a('0x41')](handleError(_0x4b192e,null));};exports[_0x477a('0x42')]=function(_0x342d06,_0x34b42c){var _0x4247e3={'raw':!![],'where':{'id':_0x342d06[_0x477a('0x43')]['id']}},_0x4c67e4={};_0x4c67e4[_0x477a('0x2d')]=_[_0x477a('0x2f')](db[_0x477a('0x29')][_0x477a('0x2a')]);_0x4c67e4['query']=_['keys'](_0x342d06[_0x477a('0x2e')]);_0x4c67e4[_0x477a('0x30')]=_[_0x477a('0x31')](_0x4c67e4['model'],_0x4c67e4[_0x477a('0x2e')]);_0x4247e3[_0x477a('0x33')]=_[_0x477a('0x31')](_0x4c67e4['model'],qs[_0x477a('0x32')](_0x342d06[_0x477a('0x2e')][_0x477a('0x32')]));_0x4247e3['attributes']=_0x4247e3['attributes'][_0x477a('0x34')]?_0x4247e3[_0x477a('0x33')]:_0x4c67e4[_0x477a('0x2d')];if(_0x342d06['query']['includeAll']){_0x4247e3['include']=[{'all':!![]}];}_0x4247e3=_['merge']({},_0x4247e3,_0x342d06[_0x477a('0x3d')]);return db['VtigerField'][_0x477a('0x44')](_0x4247e3)[_0x477a('0x22')](handleEntityNotFound(_0x34b42c,null))[_0x477a('0x22')](respondWithResult(_0x34b42c,null))[_0x477a('0x41')](handleError(_0x34b42c,null));};exports['create']=function(_0x2745b9,_0x42c687){return db[_0x477a('0x29')][_0x477a('0x45')](_0x2745b9[_0x477a('0x46')],{})[_0x477a('0x22')](respondWithResult(_0x42c687,0xc9))[_0x477a('0x41')](handleError(_0x42c687,null));};exports[_0x477a('0x47')]=function(_0x5aa721,_0x35213d){if(_0x5aa721[_0x477a('0x46')]['id']){delete _0x5aa721[_0x477a('0x46')]['id'];}return db['VtigerField'][_0x477a('0x44')]({'where':{'id':_0x5aa721[_0x477a('0x43')]['id']}})[_0x477a('0x22')](handleEntityNotFound(_0x35213d,null))[_0x477a('0x22')](saveUpdates(_0x5aa721[_0x477a('0x46')],null))[_0x477a('0x22')](respondWithResult(_0x35213d,null))[_0x477a('0x41')](handleError(_0x35213d,null));};exports[_0x477a('0x48')]=function(_0x3b8022,_0x187da4){return db[_0x477a('0x29')][_0x477a('0x44')]({'where':{'id':_0x3b8022[_0x477a('0x43')]['id']}})[_0x477a('0x22')](handleEntityNotFound(_0x187da4,null))[_0x477a('0x22')](removeEntity(_0x187da4,null))[_0x477a('0x41')](handleError(_0x187da4,null));}; \ No newline at end of file +var _0xcf18=['moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','then','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','filter','merge','options','VtigerField','includeAll','include','findAll','rows','catch','show','params','create','update','body','find','destroy','eml-format','rimraf','fast-json-patch','request-promise'];(function(_0x22ed4b,_0x20609c){var _0x4e9cf6=function(_0x3a2de1){while(--_0x3a2de1){_0x22ed4b['push'](_0x22ed4b['shift']());}};_0x4e9cf6(++_0x20609c);}(_0xcf18,0x128));var _0x8cf1=function(_0x1579bc,_0x13365b){_0x1579bc=_0x1579bc-0x0;var _0x3c5732=_0xcf18[_0x1579bc];return _0x3c5732;};'use strict';var emlformat=require(_0x8cf1('0x0'));var rimraf=require(_0x8cf1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8cf1('0x2'));var rp=require(_0x8cf1('0x3'));var moment=require(_0x8cf1('0x4'));var BPromise=require(_0x8cf1('0x5'));var Mustache=require(_0x8cf1('0x6'));var util=require('util');var path=require(_0x8cf1('0x7'));var sox=require(_0x8cf1('0x8'));var csv=require(_0x8cf1('0x9'));var ejs=require(_0x8cf1('0xa'));var fs=require('fs');var fs_extra=require(_0x8cf1('0xb'));var _=require(_0x8cf1('0xc'));var squel=require(_0x8cf1('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8cf1('0x9'));var querystring=require(_0x8cf1('0xe'));var Papa=require(_0x8cf1('0xf'));var Redis=require(_0x8cf1('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x8cf1('0x11'));var as=require(_0x8cf1('0x12'));var hardwareService=require(_0x8cf1('0x13'));var logger=require(_0x8cf1('0x14'))('api');var utils=require(_0x8cf1('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x8cf1('0x16'));var db=require(_0x8cf1('0x17'))['db'];function respondWithStatusCode(_0x5781cc,_0x5907f3){_0x5907f3=_0x5907f3||0xcc;return function(_0x4e1581){if(_0x4e1581){return _0x5781cc[_0x8cf1('0x18')](_0x5907f3);}return _0x5781cc[_0x8cf1('0x19')](_0x5907f3)[_0x8cf1('0x1a')]();};}function respondWithResult(_0xd6da4,_0xc46aa2){_0xc46aa2=_0xc46aa2||0xc8;return function(_0x3c6d81){if(_0x3c6d81){return _0xd6da4[_0x8cf1('0x19')](_0xc46aa2)[_0x8cf1('0x1b')](_0x3c6d81);}};}function respondWithFilteredResult(_0x393207,_0x1162d5){return function(_0x4c44f7){if(_0x4c44f7){var _0x3f2ea8=typeof _0x1162d5['offset']===_0x8cf1('0x1c')&&typeof _0x1162d5[_0x8cf1('0x1d')]===_0x8cf1('0x1c');var _0x963b50=_0x4c44f7['count'];var _0x24067c=_0x3f2ea8?0x0:_0x1162d5[_0x8cf1('0x1e')];var _0x1a7295=_0x3f2ea8?_0x4c44f7[_0x8cf1('0x1f')]:_0x1162d5[_0x8cf1('0x1e')]+_0x1162d5['limit'];var _0x44a3c6;if(_0x1a7295>=_0x963b50){_0x1a7295=_0x963b50;_0x44a3c6=0xc8;}else{_0x44a3c6=0xce;}_0x393207['status'](_0x44a3c6);return _0x393207[_0x8cf1('0x20')](_0x8cf1('0x21'),_0x24067c+'-'+_0x1a7295+'/'+_0x963b50)[_0x8cf1('0x1b')](_0x4c44f7);}return null;};}function patchUpdates(_0x29bfd3){return function(_0x5e22b4){try{jsonpatch[_0x8cf1('0x22')](_0x5e22b4,_0x29bfd3,!![]);}catch(_0x11a2fb){return BPromise[_0x8cf1('0x23')](_0x11a2fb);}return _0x5e22b4[_0x8cf1('0x24')]();};}function saveUpdates(_0x4f4506,_0x3a4140){return function(_0x25029f){if(_0x25029f){return _0x25029f['update'](_0x4f4506)[_0x8cf1('0x25')](function(_0x223df3){return _0x223df3;});}return null;};}function removeEntity(_0x2ad00e,_0x199c8e){return function(_0x17dc9d){if(_0x17dc9d){return _0x17dc9d['destroy']()[_0x8cf1('0x25')](function(){_0x2ad00e[_0x8cf1('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d024a,_0x23f2ae){return function(_0x375ba2){if(!_0x375ba2){_0x4d024a['sendStatus'](0x194);}return _0x375ba2;};}function handleError(_0x5c526c,_0x4a54bf){_0x4a54bf=_0x4a54bf||0x1f4;return function(_0x319a13){logger[_0x8cf1('0x26')](_0x319a13['stack']);if(_0x319a13[_0x8cf1('0x27')]){delete _0x319a13[_0x8cf1('0x27')];}_0x5c526c[_0x8cf1('0x19')](_0x4a54bf)[_0x8cf1('0x28')](_0x319a13);};}exports[_0x8cf1('0x29')]=function(_0x2df65a,_0x592bf9){var _0x459753={},_0x5a57dc={},_0x5c0c9b={'count':0x0,'rows':[]};var _0xef5e69=_[_0x8cf1('0x2a')](db['VtigerField'][_0x8cf1('0x2b')],function(_0x289bf3){return{'name':_0x289bf3[_0x8cf1('0x2c')],'type':_0x289bf3[_0x8cf1('0x2d')][_0x8cf1('0x2e')]};});_0x5a57dc[_0x8cf1('0x2f')]=_['map'](_0xef5e69,'name');_0x5a57dc[_0x8cf1('0x30')]=_[_0x8cf1('0x31')](_0x2df65a[_0x8cf1('0x30')]);_0x5a57dc['filters']=_[_0x8cf1('0x32')](_0x5a57dc[_0x8cf1('0x2f')],_0x5a57dc['query']);_0x459753[_0x8cf1('0x33')]=_[_0x8cf1('0x32')](_0x5a57dc[_0x8cf1('0x2f')],qs[_0x8cf1('0x34')](_0x2df65a[_0x8cf1('0x30')][_0x8cf1('0x34')]));_0x459753['attributes']=_0x459753[_0x8cf1('0x33')][_0x8cf1('0x35')]?_0x459753[_0x8cf1('0x33')]:_0x5a57dc[_0x8cf1('0x2f')];if(!_0x2df65a[_0x8cf1('0x30')]['hasOwnProperty'](_0x8cf1('0x36'))){_0x459753[_0x8cf1('0x1d')]=qs[_0x8cf1('0x1d')](_0x2df65a[_0x8cf1('0x30')][_0x8cf1('0x1d')]);_0x459753['offset']=qs[_0x8cf1('0x1e')](_0x2df65a['query']['offset']);}_0x459753[_0x8cf1('0x37')]=qs['sort'](_0x2df65a['query'][_0x8cf1('0x38')]);_0x459753[_0x8cf1('0x39')]=qs[_0x8cf1('0x3a')](_['pick'](_0x2df65a['query'],_0x5a57dc[_0x8cf1('0x3a')]),_0xef5e69);if(_0x2df65a[_0x8cf1('0x30')][_0x8cf1('0x3b')]){_0x459753[_0x8cf1('0x39')]=_[_0x8cf1('0x3c')](_0x459753[_0x8cf1('0x39')],{'$or':_[_0x8cf1('0x2a')](_0xef5e69,function(_0x2e349c){if(_0x2e349c[_0x8cf1('0x2d')]!=='VIRTUAL'){var _0x3e6ab0={};_0x3e6ab0[_0x2e349c['name']]={'$like':'%'+_0x2df65a[_0x8cf1('0x30')][_0x8cf1('0x3b')]+'%'};return _0x3e6ab0;}})});}_0x459753=_['merge']({},_0x459753,_0x2df65a[_0x8cf1('0x3d')]);var _0x5d9725={'where':_0x459753[_0x8cf1('0x39')]};return db[_0x8cf1('0x3e')][_0x8cf1('0x1f')](_0x5d9725)['then'](function(_0x5c86ab){_0x5c0c9b['count']=_0x5c86ab;if(_0x2df65a[_0x8cf1('0x30')][_0x8cf1('0x3f')]){_0x459753[_0x8cf1('0x40')]=[{'all':!![]}];}return db[_0x8cf1('0x3e')][_0x8cf1('0x41')](_0x459753);})[_0x8cf1('0x25')](function(_0x29de37){_0x5c0c9b[_0x8cf1('0x42')]=_0x29de37;return _0x5c0c9b;})['then'](respondWithFilteredResult(_0x592bf9,_0x459753))[_0x8cf1('0x43')](handleError(_0x592bf9,null));};exports[_0x8cf1('0x44')]=function(_0x2c690d,_0x2b91a8){var _0x222207={'raw':!![],'where':{'id':_0x2c690d[_0x8cf1('0x45')]['id']}},_0x44ec5a={};_0x44ec5a[_0x8cf1('0x2f')]=_['keys'](db[_0x8cf1('0x3e')][_0x8cf1('0x2b')]);_0x44ec5a[_0x8cf1('0x30')]=_[_0x8cf1('0x31')](_0x2c690d['query']);_0x44ec5a[_0x8cf1('0x3a')]=_[_0x8cf1('0x32')](_0x44ec5a[_0x8cf1('0x2f')],_0x44ec5a['query']);_0x222207[_0x8cf1('0x33')]=_[_0x8cf1('0x32')](_0x44ec5a['model'],qs[_0x8cf1('0x34')](_0x2c690d[_0x8cf1('0x30')][_0x8cf1('0x34')]));_0x222207[_0x8cf1('0x33')]=_0x222207[_0x8cf1('0x33')][_0x8cf1('0x35')]?_0x222207['attributes']:_0x44ec5a['model'];if(_0x2c690d[_0x8cf1('0x30')]['includeAll']){_0x222207[_0x8cf1('0x40')]=[{'all':!![]}];}_0x222207=_[_0x8cf1('0x3c')]({},_0x222207,_0x2c690d[_0x8cf1('0x3d')]);return db['VtigerField']['find'](_0x222207)[_0x8cf1('0x25')](handleEntityNotFound(_0x2b91a8,null))[_0x8cf1('0x25')](respondWithResult(_0x2b91a8,null))[_0x8cf1('0x43')](handleError(_0x2b91a8,null));};exports[_0x8cf1('0x46')]=function(_0x596bce,_0x5981ff){return db[_0x8cf1('0x3e')][_0x8cf1('0x46')](_0x596bce['body'],{})[_0x8cf1('0x25')](respondWithResult(_0x5981ff,0xc9))['catch'](handleError(_0x5981ff,null));};exports[_0x8cf1('0x47')]=function(_0x5c7351,_0xa886ed){if(_0x5c7351[_0x8cf1('0x48')]['id']){delete _0x5c7351['body']['id'];}return db[_0x8cf1('0x3e')][_0x8cf1('0x49')]({'where':{'id':_0x5c7351[_0x8cf1('0x45')]['id']}})[_0x8cf1('0x25')](handleEntityNotFound(_0xa886ed,null))['then'](saveUpdates(_0x5c7351[_0x8cf1('0x48')],null))['then'](respondWithResult(_0xa886ed,null))[_0x8cf1('0x43')](handleError(_0xa886ed,null));};exports[_0x8cf1('0x4a')]=function(_0x14c1a7,_0x25641f){return db[_0x8cf1('0x3e')]['find']({'where':{'id':_0x14c1a7[_0x8cf1('0x45')]['id']}})[_0x8cf1('0x25')](handleEntityNotFound(_0x25641f,null))[_0x8cf1('0x25')](removeEntity(_0x25641f,null))[_0x8cf1('0x43')](handleError(_0x25641f,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index b727d50..fa3656d 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 _0x67ae=['./intVtigerField.attributes','exports','VtigerField','int_vtiger_fields','vtiger_unique_index','idField','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x151a79,_0x2aad33){var _0x58893e=function(_0x27bb78){while(--_0x27bb78){_0x151a79['push'](_0x151a79['shift']());}};_0x58893e(++_0x2aad33);}(_0x67ae,0xc9));var _0xe67a=function(_0x5dbfbe,_0x205730){_0x5dbfbe=_0x5dbfbe-0x0;var _0x2b3af6=_0x67ae[_0x5dbfbe];return _0x2b3af6;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe67a('0x0'))(_0xe67a('0x1'));var moment=require('moment');var BPromise=require(_0xe67a('0x2'));var rp=require(_0xe67a('0x3'));var fs=require('fs');var path=require(_0xe67a('0x4'));var rimraf=require(_0xe67a('0x5'));var config=require(_0xe67a('0x6'));var attributes=require(_0xe67a('0x7'));module[_0xe67a('0x8')]=function(_0x2013b6,_0x3b2898){return _0x2013b6['define'](_0xe67a('0x9'),attributes,{'tableName':_0xe67a('0xa'),'paranoid':![],'indexes':[{'name':_0xe67a('0xb'),'fields':[_0xe67a('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x104a=['define','VtigerField','int_vtiger_fields','vtiger_unique_index','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerField.attributes'];(function(_0x217b3d,_0x235ef2){var _0x2c2730=function(_0x2707d1){while(--_0x2707d1){_0x217b3d['push'](_0x217b3d['shift']());}};_0x2c2730(++_0x235ef2);}(_0x104a,0x95));var _0xa104=function(_0x374ada,_0x27b3a5){_0x374ada=_0x374ada-0x0;var _0x449ed8=_0x104a[_0x374ada];return _0x449ed8;};'use strict';var _=require(_0xa104('0x0'));var util=require(_0xa104('0x1'));var logger=require(_0xa104('0x2'))(_0xa104('0x3'));var moment=require(_0xa104('0x4'));var BPromise=require(_0xa104('0x5'));var rp=require(_0xa104('0x6'));var fs=require('fs');var path=require(_0xa104('0x7'));var rimraf=require(_0xa104('0x8'));var config=require(_0xa104('0x9'));var attributes=require(_0xa104('0xa'));module['exports']=function(_0xe107a7,_0x9d1b5d){return _0xe107a7[_0xa104('0xb')](_0xa104('0xc'),attributes,{'tableName':_0xa104('0xd'),'paranoid':![],'indexes':[{'name':_0xa104('0xe'),'fields':['idField',_0xa104('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index b541f92..04f3967 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 _0x45c2=['jayson/promise','http','request','then','info','request\x20sent','VtigerField,\x20%s,\x20%s,\x20%s','error','code','VtigerField,\x20%s,\x20%s','message','result','catch','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0xc82c7a,_0x8389f7){var _0x24be40=function(_0x4d3c39){while(--_0x4d3c39){_0xc82c7a['push'](_0xc82c7a['shift']());}};_0x24be40(++_0x8389f7);}(_0x45c2,0x111));var _0x245c=function(_0x6ea81a,_0x5c03ed){_0x6ea81a=_0x6ea81a-0x0;var _0x371747=_0x45c2[_0x6ea81a];return _0x371747;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x245c('0x0'));var BPromise=require(_0x245c('0x1'));var rs=require(_0x245c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x245c('0x3'))['db'];var utils=require(_0x245c('0x4'));var logger=require(_0x245c('0x5'))(_0x245c('0x6'));var config=require('../../config/environment');var jayson=require(_0x245c('0x7'));var client=jayson['client'][_0x245c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x55bbeb,_0xfe98e6,_0x5f09db){return new BPromise(function(_0x24657c,_0x228779){return client[_0x245c('0x9')](_0x55bbeb,_0x5f09db)[_0x245c('0xa')](function(_0x20ec94){logger[_0x245c('0xb')]('VtigerField,\x20%s,\x20%s',_0xfe98e6,_0x245c('0xc'));logger['debug'](_0x245c('0xd'),_0xfe98e6,'request\x20sent',JSON['stringify'](_0x20ec94));if(_0x20ec94['error']){if(_0x20ec94[_0x245c('0xe')][_0x245c('0xf')]===0x1f4){logger[_0x245c('0xe')](_0x245c('0x10'),_0xfe98e6,_0x20ec94[_0x245c('0xe')][_0x245c('0x11')]);return _0x228779(_0x20ec94['error']['message']);}logger[_0x245c('0xe')](_0x245c('0x10'),_0xfe98e6,_0x20ec94[_0x245c('0xe')][_0x245c('0x11')]);return _0x24657c(_0x20ec94[_0x245c('0xe')][_0x245c('0x11')]);}else{logger[_0x245c('0xb')](_0x245c('0x10'),_0xfe98e6,'request\x20sent');_0x24657c(_0x20ec94[_0x245c('0x12')]['message']);}})[_0x245c('0x13')](function(_0x531a3e){logger[_0x245c('0xe')](_0x245c('0x10'),_0xfe98e6,_0x531a3e);_0x228779(_0x531a3e);});});} \ No newline at end of file +var _0x13e7=['debug','VtigerField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent'];(function(_0x5dad73,_0x3baac8){var _0x538654=function(_0x340cd6){while(--_0x340cd6){_0x5dad73['push'](_0x5dad73['shift']());}};_0x538654(++_0x3baac8);}(_0x13e7,0x133));var _0x713e=function(_0x16e57d,_0x2cb7ba){_0x16e57d=_0x16e57d-0x0;var _0x40239c=_0x13e7[_0x16e57d];return _0x40239c;};'use strict';var _=require(_0x713e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x713e('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x713e('0x2'));var logger=require('../../config/logger')(_0x713e('0x3'));var config=require(_0x713e('0x4'));var jayson=require(_0x713e('0x5'));var client=jayson[_0x713e('0x6')][_0x713e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x47c066,_0x419663,_0x4e9844){return new BPromise(function(_0x4c62a9,_0x2522f4){return client[_0x713e('0x8')](_0x47c066,_0x4e9844)[_0x713e('0x9')](function(_0x283e88){logger[_0x713e('0xa')](_0x713e('0xb'),_0x419663,_0x713e('0xc'));logger[_0x713e('0xd')](_0x713e('0xe'),_0x419663,'request\x20sent',JSON['stringify'](_0x283e88));if(_0x283e88['error']){if(_0x283e88[_0x713e('0xf')][_0x713e('0x10')]===0x1f4){logger['error'](_0x713e('0xb'),_0x419663,_0x283e88['error'][_0x713e('0x11')]);return _0x2522f4(_0x283e88[_0x713e('0xf')][_0x713e('0x11')]);}logger[_0x713e('0xf')](_0x713e('0xb'),_0x419663,_0x283e88[_0x713e('0xf')][_0x713e('0x11')]);return _0x4c62a9(_0x283e88[_0x713e('0xf')]['message']);}else{logger['info'](_0x713e('0xb'),_0x419663,_0x713e('0xc'));_0x4c62a9(_0x283e88[_0x713e('0x12')][_0x713e('0x11')]);}})[_0x713e('0x13')](function(_0x322278){logger['error']('VtigerField,\x20%s,\x20%s',_0x419663,_0x322278);_0x2522f4(_0x322278);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 028d93e..e2b7683 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 _0x7e47=['isAuthenticated','/:id','show','getConfigurations','/:id/fields','getFields','create','/:id/configurations','addConfiguration','put','delete','destroy','exports','util','path','connect-timeout','express','Router','../../config/environment','get'];(function(_0x1cf9c3,_0x134961){var _0x2fa596=function(_0x1b8c4c){while(--_0x1b8c4c){_0x1cf9c3['push'](_0x1cf9c3['shift']());}};_0x2fa596(++_0x134961);}(_0x7e47,0x19d));var _0x77e4=function(_0x14a197,_0x1356d1){_0x14a197=_0x14a197-0x0;var _0x7dd648=_0x7e47[_0x14a197];return _0x7dd648;};'use strict';var multer=require('multer');var util=require(_0x77e4('0x0'));var path=require(_0x77e4('0x1'));var timeout=require(_0x77e4('0x2'));var express=require(_0x77e4('0x3'));var router=express[_0x77e4('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x77e4('0x5'));var controller=require('./intZendeskAccount.controller');router[_0x77e4('0x6')]('/',auth[_0x77e4('0x7')](),controller['index']);router['get'](_0x77e4('0x8'),auth[_0x77e4('0x7')](),controller[_0x77e4('0x9')]);router[_0x77e4('0x6')]('/:id/configurations',auth[_0x77e4('0x7')](),controller[_0x77e4('0xa')]);router['get'](_0x77e4('0xb'),auth[_0x77e4('0x7')](),controller[_0x77e4('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x77e4('0xd')]);router['post'](_0x77e4('0xe'),auth[_0x77e4('0x7')](),controller[_0x77e4('0xf')]);router[_0x77e4('0x10')](_0x77e4('0x8'),auth[_0x77e4('0x7')](),controller['update']);router[_0x77e4('0x11')](_0x77e4('0x8'),auth['isAuthenticated'](),controller[_0x77e4('0x12')]);module[_0x77e4('0x13')]=router; \ No newline at end of file +var _0x6233=['../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x597e32,_0x86108e){var _0x9daffe=function(_0x5354ba){while(--_0x5354ba){_0x597e32['push'](_0x597e32['shift']());}};_0x9daffe(++_0x86108e);}(_0x6233,0xba));var _0x3623=function(_0x3fbc11,_0x42df10){_0x3fbc11=_0x3fbc11-0x0;var _0x5f0696=_0x6233[_0x3fbc11];return _0x5f0696;};'use strict';var multer=require(_0x3623('0x0'));var util=require('util');var path=require(_0x3623('0x1'));var timeout=require('connect-timeout');var express=require(_0x3623('0x2'));var router=express[_0x3623('0x3')]();var fs_extra=require(_0x3623('0x4'));var auth=require(_0x3623('0x5'));var interaction=require(_0x3623('0x6'));var config=require(_0x3623('0x7'));var controller=require(_0x3623('0x8'));router[_0x3623('0x9')]('/',auth[_0x3623('0xa')](),controller['index']);router['get'](_0x3623('0xb'),auth['isAuthenticated'](),controller[_0x3623('0xc')]);router[_0x3623('0x9')](_0x3623('0xd'),auth[_0x3623('0xa')](),controller[_0x3623('0xe')]);router[_0x3623('0x9')](_0x3623('0xf'),auth[_0x3623('0xa')](),controller[_0x3623('0x10')]);router[_0x3623('0x11')]('/',auth[_0x3623('0xa')](),controller[_0x3623('0x12')]);router[_0x3623('0x11')](_0x3623('0xd'),auth[_0x3623('0xa')](),controller[_0x3623('0x13')]);router[_0x3623('0x14')](_0x3623('0xb'),auth['isAuthenticated'](),controller[_0x3623('0x15')]);router[_0x3623('0x16')]('/:id',auth[_0x3623('0xa')](),controller[_0x3623('0x17')]);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 6b7b7a6..416e99f 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 _0x741c=['STRING','username','ENUM','password','token','integrationTab','sequelize','exports'];(function(_0x40d3c6,_0x215e66){var _0x54fb5e=function(_0x19904f){while(--_0x19904f){_0x40d3c6['push'](_0x40d3c6['shift']());}};_0x54fb5e(++_0x215e66);}(_0x741c,0x196));var _0xc741=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x741c[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xc741('0x0'));module[_0xc741('0x1')]={'name':{'type':Sequelize[_0xc741('0x2')]},'description':{'type':Sequelize[_0xc741('0x2')]},'username':{'type':Sequelize[_0xc741('0x2')],'unique':_0xc741('0x3')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xc741('0x2')],'unique':'remoteUri'},'authType':{'type':Sequelize[_0xc741('0x4')](_0xc741('0x5'),_0xc741('0x6')),'defaultValue':_0xc741('0x5')},'serverUrl':{'type':Sequelize[_0xc741('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xc741('0x4')](_0xc741('0x7'),'newTab'),'defaultValue':_0xc741('0x7')}}; \ No newline at end of file +var _0xfb0b=['password','token','newTab','integrationTab','sequelize','exports','STRING','username','ENUM'];(function(_0x43a173,_0x4129f2){var _0x35a454=function(_0x187239){while(--_0x187239){_0x43a173['push'](_0x43a173['shift']());}};_0x35a454(++_0x4129f2);}(_0xfb0b,0x94));var _0xbfb0=function(_0x1faa67,_0x306e21){_0x1faa67=_0x1faa67-0x0;var _0x306fae=_0xfb0b[_0x1faa67];return _0x306fae;};'use strict';var Sequelize=require(_0xbfb0('0x0'));module[_0xbfb0('0x1')]={'name':{'type':Sequelize[_0xbfb0('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xbfb0('0x2')],'unique':_0xbfb0('0x3')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xbfb0('0x2')],'unique':'remoteUri'},'authType':{'type':Sequelize[_0xbfb0('0x4')](_0xbfb0('0x5'),_0xbfb0('0x6')),'defaultValue':_0xbfb0('0x5')},'serverUrl':{'type':Sequelize[_0xbfb0('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbfb0('0x4')]('integrationTab',_0xbfb0('0x7')),'defaultValue':_0xbfb0('0x8')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index f8710fe..f2cd909 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 _0xb10b=['sort','where','merge','map','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','getConfigurations','findOne','ZendeskConfiguration','rawAttributes','pick','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZendeskField','getFields','username','token','authType','remoteUri','slice','substring','lastIndexOf','GET','format','ticket_fields','Basic\x20%s','%s:%s','password','headers','toString','base64','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','includes','position','system_field_options','custom_field_options','test','statusCode','stringify','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','update','then','destroy','error','stack','name','send','ZendeskAccount','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order'];(function(_0x123c1c,_0x373cb5){var _0x5c086a=function(_0x29d787){while(--_0x29d787){_0x123c1c['push'](_0x123c1c['shift']());}};_0x5c086a(++_0x373cb5);}(_0xb10b,0x12a));var _0xbb10=function(_0x5efbd0,_0x299553){_0x5efbd0=_0x5efbd0-0x0;var _0x475ec9=_0xb10b[_0x5efbd0];return _0x475ec9;};'use strict';var emlformat=require(_0xbb10('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb10('0x1'));var jsonpatch=require(_0xbb10('0x2'));var rp=require(_0xbb10('0x3'));var moment=require('moment');var BPromise=require(_0xbb10('0x4'));var Mustache=require(_0xbb10('0x5'));var util=require(_0xbb10('0x6'));var path=require(_0xbb10('0x7'));var sox=require(_0xbb10('0x8'));var csv=require(_0xbb10('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb10('0xa'));var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0x9'));var querystring=require(_0xbb10('0xf'));var Papa=require(_0xbb10('0x10'));var Redis=require(_0xbb10('0x11'));var authService=require(_0xbb10('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb10('0x13'));var logger=require(_0xbb10('0x14'))(_0xbb10('0x15'));var utils=require('../../config/utils');var config=require(_0xbb10('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xbb10('0x17'))['db'];var integrations=require(_0xbb10('0x18'));function respondWithStatusCode(_0x285009,_0x193a27){_0x193a27=_0x193a27||0xcc;return function(_0x442548){if(_0x442548){return _0x285009[_0xbb10('0x19')](_0x193a27);}return _0x285009['status'](_0x193a27)[_0xbb10('0x1a')]();};}function respondWithResult(_0x42d7e4,_0x45b9d6){_0x45b9d6=_0x45b9d6||0xc8;return function(_0x17fd46){if(_0x17fd46){return _0x42d7e4[_0xbb10('0x1b')](_0x45b9d6)[_0xbb10('0x1c')](_0x17fd46);}};}function respondWithFilteredResult(_0x24a57b,_0x36b5e8){return function(_0x3e26f4){if(_0x3e26f4){var _0x2b184e=typeof _0x36b5e8['offset']===_0xbb10('0x1d')&&typeof _0x36b5e8[_0xbb10('0x1e')]===_0xbb10('0x1d');var _0x42db98=_0x3e26f4[_0xbb10('0x1f')];var _0x1682a4=_0x2b184e?0x0:_0x36b5e8[_0xbb10('0x20')];var _0x30efc6=_0x2b184e?_0x3e26f4[_0xbb10('0x1f')]:_0x36b5e8[_0xbb10('0x20')]+_0x36b5e8['limit'];var _0x5ff0cf;if(_0x30efc6>=_0x42db98){_0x30efc6=_0x42db98;_0x5ff0cf=0xc8;}else{_0x5ff0cf=0xce;}_0x24a57b[_0xbb10('0x1b')](_0x5ff0cf);return _0x24a57b[_0xbb10('0x21')](_0xbb10('0x22'),_0x1682a4+'-'+_0x30efc6+'/'+_0x42db98)[_0xbb10('0x1c')](_0x3e26f4);}return null;};}function patchUpdates(_0x44e563){return function(_0x4deb49){try{jsonpatch[_0xbb10('0x23')](_0x4deb49,_0x44e563,!![]);}catch(_0x12ef77){return BPromise['reject'](_0x12ef77);}return _0x4deb49['save']();};}function saveUpdates(_0x8e2b97,_0x311abe){return function(_0x2e911d){if(_0x2e911d){return _0x2e911d[_0xbb10('0x24')](_0x8e2b97)[_0xbb10('0x25')](function(_0x1824b7){return _0x1824b7;});}return null;};}function removeEntity(_0x407cb4,_0x436104){return function(_0x7f2377){if(_0x7f2377){return _0x7f2377[_0xbb10('0x26')]()[_0xbb10('0x25')](function(){_0x407cb4[_0xbb10('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fedac,_0x4fb5e0){return function(_0xc93a04){if(!_0xc93a04){_0x4fedac[_0xbb10('0x19')](0x194);}return _0xc93a04;};}function handleError(_0x2c89b9,_0x4e25ff){_0x4e25ff=_0x4e25ff||0x1f4;return function(_0x2fdde9){logger[_0xbb10('0x27')](_0x2fdde9[_0xbb10('0x28')]);if(_0x2fdde9[_0xbb10('0x29')]){delete _0x2fdde9[_0xbb10('0x29')];}_0x2c89b9[_0xbb10('0x1b')](_0x4e25ff)[_0xbb10('0x2a')](_0x2fdde9);};}exports['index']=function(_0x3796c7,_0x21ac54){var _0xfc3595={},_0x2e0249={},_0x1d30aa={'count':0x0,'rows':[]};var _0x2ff4c1=_['map'](db[_0xbb10('0x2b')]['rawAttributes'],function(_0x448d5c){return{'name':_0x448d5c['fieldName'],'type':_0x448d5c[_0xbb10('0x2c')][_0xbb10('0x2d')]};});_0x2e0249[_0xbb10('0x2e')]=_['map'](_0x2ff4c1,'name');_0x2e0249[_0xbb10('0x2f')]=_[_0xbb10('0x30')](_0x3796c7['query']);_0x2e0249[_0xbb10('0x31')]=_[_0xbb10('0x32')](_0x2e0249[_0xbb10('0x2e')],_0x2e0249[_0xbb10('0x2f')]);_0xfc3595[_0xbb10('0x33')]=_[_0xbb10('0x32')](_0x2e0249[_0xbb10('0x2e')],qs['fields'](_0x3796c7[_0xbb10('0x2f')][_0xbb10('0x34')]));_0xfc3595[_0xbb10('0x33')]=_0xfc3595[_0xbb10('0x33')][_0xbb10('0x35')]?_0xfc3595[_0xbb10('0x33')]:_0x2e0249[_0xbb10('0x2e')];if(!_0x3796c7[_0xbb10('0x2f')][_0xbb10('0x36')]('nolimit')){_0xfc3595[_0xbb10('0x1e')]=qs[_0xbb10('0x1e')](_0x3796c7[_0xbb10('0x2f')][_0xbb10('0x1e')]);_0xfc3595['offset']=qs[_0xbb10('0x20')](_0x3796c7['query']['offset']);}_0xfc3595[_0xbb10('0x37')]=qs[_0xbb10('0x38')](_0x3796c7[_0xbb10('0x2f')][_0xbb10('0x38')]);_0xfc3595[_0xbb10('0x39')]=qs[_0xbb10('0x31')](_['pick'](_0x3796c7[_0xbb10('0x2f')],_0x2e0249[_0xbb10('0x31')]),_0x2ff4c1);if(_0x3796c7['query']['filter']){_0xfc3595['where']=_[_0xbb10('0x3a')](_0xfc3595[_0xbb10('0x39')],{'$or':_[_0xbb10('0x3b')](_0x2ff4c1,function(_0x4d5a9b){if(_0x4d5a9b[_0xbb10('0x2c')]!==_0xbb10('0x3c')){var _0x4345f3={};_0x4345f3[_0x4d5a9b['name']]={'$like':'%'+_0x3796c7[_0xbb10('0x2f')][_0xbb10('0x3d')]+'%'};return _0x4345f3;}})});}_0xfc3595=_[_0xbb10('0x3a')]({},_0xfc3595,_0x3796c7[_0xbb10('0x3e')]);var _0x4f1cdd={'where':_0xfc3595[_0xbb10('0x39')]};return db[_0xbb10('0x2b')]['count'](_0x4f1cdd)[_0xbb10('0x25')](function(_0x2e3214){_0x1d30aa[_0xbb10('0x1f')]=_0x2e3214;if(_0x3796c7[_0xbb10('0x2f')][_0xbb10('0x3f')]){_0xfc3595[_0xbb10('0x40')]=[{'all':!![]}];}return db['ZendeskAccount'][_0xbb10('0x41')](_0xfc3595);})[_0xbb10('0x25')](function(_0x3e7b4c){_0x1d30aa[_0xbb10('0x42')]=_0x3e7b4c;return _0x1d30aa;})['then'](respondWithFilteredResult(_0x21ac54,_0xfc3595))[_0xbb10('0x43')](handleError(_0x21ac54,null));};exports[_0xbb10('0x44')]=function(_0x23dc18,_0x403beb){var _0x5e2cfa={'raw':![],'where':{'id':_0x23dc18[_0xbb10('0x45')]['id']}},_0x351484={};_0x351484['model']=_['keys'](db[_0xbb10('0x2b')]['rawAttributes']);_0x351484[_0xbb10('0x2f')]=_[_0xbb10('0x30')](_0x23dc18['query']);_0x351484[_0xbb10('0x31')]=_[_0xbb10('0x32')](_0x351484[_0xbb10('0x2e')],_0x351484['query']);_0x5e2cfa[_0xbb10('0x33')]=_[_0xbb10('0x32')](_0x351484[_0xbb10('0x2e')],qs[_0xbb10('0x34')](_0x23dc18[_0xbb10('0x2f')][_0xbb10('0x34')]));_0x5e2cfa[_0xbb10('0x33')]=_0x5e2cfa[_0xbb10('0x33')][_0xbb10('0x35')]?_0x5e2cfa[_0xbb10('0x33')]:_0x351484[_0xbb10('0x2e')];if(_0x23dc18[_0xbb10('0x2f')]['includeAll']){_0x5e2cfa[_0xbb10('0x40')]=[{'all':!![]}];}_0x5e2cfa=_[_0xbb10('0x3a')]({},_0x5e2cfa,_0x23dc18['options']);return db[_0xbb10('0x2b')][_0xbb10('0x46')](_0x5e2cfa)[_0xbb10('0x25')](handleEntityNotFound(_0x403beb,null))[_0xbb10('0x25')](respondWithResult(_0x403beb,null))[_0xbb10('0x43')](handleError(_0x403beb,null));};exports[_0xbb10('0x47')]=function(_0x3e06b0,_0x5be85e){return db['ZendeskAccount'][_0xbb10('0x47')](_0x3e06b0[_0xbb10('0x48')],{})[_0xbb10('0x25')](respondWithResult(_0x5be85e,0xc9))['catch'](handleError(_0x5be85e,null));};exports['update']=function(_0x3cd6f3,_0x34cf4e){if(_0x3cd6f3[_0xbb10('0x48')]['id']){delete _0x3cd6f3[_0xbb10('0x48')]['id'];}return db[_0xbb10('0x2b')][_0xbb10('0x46')]({'where':{'id':_0x3cd6f3[_0xbb10('0x45')]['id']}})[_0xbb10('0x25')](handleEntityNotFound(_0x34cf4e,null))[_0xbb10('0x25')](saveUpdates(_0x3cd6f3[_0xbb10('0x48')],null))['then'](respondWithResult(_0x34cf4e,null))['catch'](handleError(_0x34cf4e,null));};exports[_0xbb10('0x26')]=function(_0x467dba,_0x36ab7d){return db[_0xbb10('0x2b')][_0xbb10('0x46')]({'where':{'id':_0x467dba[_0xbb10('0x45')]['id']}})[_0xbb10('0x25')](handleEntityNotFound(_0x36ab7d,null))[_0xbb10('0x25')](removeEntity(_0x36ab7d,null))[_0xbb10('0x43')](handleError(_0x36ab7d,null));};exports[_0xbb10('0x49')]=function(_0x19ca3e,_0x20e18a,_0x61e689){var _0x2e6fd9={};var _0x1d15f4={};var _0x547a7a;var _0x124052;return db['ZendeskAccount'][_0xbb10('0x4a')]({'where':{'id':_0x19ca3e[_0xbb10('0x45')]['id']}})[_0xbb10('0x25')](handleEntityNotFound(_0x20e18a,null))[_0xbb10('0x25')](function(_0x26e66e){if(_0x26e66e){_0x547a7a=_0x26e66e;_0x1d15f4[_0xbb10('0x2e')]=_[_0xbb10('0x30')](db[_0xbb10('0x4b')][_0xbb10('0x4c')]);_0x1d15f4[_0xbb10('0x2f')]=_[_0xbb10('0x30')](_0x19ca3e[_0xbb10('0x2f')]);_0x1d15f4[_0xbb10('0x31')]=_[_0xbb10('0x32')](_0x1d15f4[_0xbb10('0x2e')],_0x1d15f4['query']);_0x2e6fd9[_0xbb10('0x33')]=_[_0xbb10('0x32')](_0x1d15f4[_0xbb10('0x2e')],qs[_0xbb10('0x34')](_0x19ca3e[_0xbb10('0x2f')][_0xbb10('0x34')]));_0x2e6fd9['attributes']=_0x2e6fd9[_0xbb10('0x33')][_0xbb10('0x35')]?_0x2e6fd9[_0xbb10('0x33')]:_0x1d15f4[_0xbb10('0x2e')];_0x2e6fd9[_0xbb10('0x37')]=qs[_0xbb10('0x38')](_0x19ca3e[_0xbb10('0x2f')][_0xbb10('0x38')]);_0x2e6fd9[_0xbb10('0x39')]=qs[_0xbb10('0x31')](_[_0xbb10('0x4d')](_0x19ca3e[_0xbb10('0x2f')],_0x1d15f4[_0xbb10('0x31')]));if(_0x19ca3e['query']['filter']){_0x2e6fd9[_0xbb10('0x39')]=_[_0xbb10('0x3a')](_0x2e6fd9[_0xbb10('0x39')],{'$or':_[_0xbb10('0x3b')](_0x2e6fd9['attributes'],function(_0x506498){var _0x79411e={};_0x79411e[_0x506498]={'$like':'%'+_0x19ca3e[_0xbb10('0x2f')][_0xbb10('0x3d')]+'%'};return _0x79411e;})});}_0x2e6fd9=_[_0xbb10('0x3a')]({},_0x2e6fd9,_0x19ca3e[_0xbb10('0x3e')]);return _0x547a7a[_0xbb10('0x49')](_0x2e6fd9);}})[_0xbb10('0x25')](function(_0x4a5fb9){if(_0x4a5fb9){_0x124052=_0x4a5fb9[_0xbb10('0x35')];if(!_0x19ca3e[_0xbb10('0x2f')]['hasOwnProperty']('nolimit')){_0x2e6fd9['limit']=qs[_0xbb10('0x1e')](_0x19ca3e[_0xbb10('0x2f')][_0xbb10('0x1e')]);_0x2e6fd9['offset']=qs['offset'](_0x19ca3e['query'][_0xbb10('0x20')]);}return _0x547a7a[_0xbb10('0x49')](_0x2e6fd9);}})[_0xbb10('0x25')](function(_0x4e9fbd){if(_0x4e9fbd){return _0x4e9fbd?{'count':_0x124052,'rows':_0x4e9fbd}:null;}})[_0xbb10('0x25')](respondWithResult(_0x20e18a,null))[_0xbb10('0x43')](handleError(_0x20e18a,null));};exports['addConfiguration']=function(_0x4a560c,_0x27d7b9,_0x308896){if(_0x4a560c[_0xbb10('0x48')]['id']){delete _0x4a560c[_0xbb10('0x48')]['id'];}return db['ZendeskAccount'][_0xbb10('0x4a')]({'where':{'id':_0x4a560c[_0xbb10('0x45')]['id']}})[_0xbb10('0x25')](handleEntityNotFound(_0x27d7b9,null))['then'](function(_0x402a01){if(_0x402a01){_0x4a560c[_0xbb10('0x48')][_0xbb10('0x4e')]=_0x402a01['id'];_0x4a560c['body'][_0xbb10('0x4f')]=integrations[_0xbb10('0x50')](_0x4a560c[_0xbb10('0x48')][_0xbb10('0x51')],_0x4a560c['body'][_0xbb10('0x2c')]);_0x4a560c[_0xbb10('0x48')][_0xbb10('0x52')]=integrations[_0xbb10('0x53')](_0x4a560c['body'][_0xbb10('0x51')],_0x4a560c[_0xbb10('0x48')][_0xbb10('0x2c')]);return db[_0xbb10('0x4b')][_0xbb10('0x47')](_0x4a560c[_0xbb10('0x48')],{'include':[{'model':db[_0xbb10('0x54')],'as':'Subjects'},{'model':db['ZendeskField'],'as':'Descriptions'}]});}return null;})[_0xbb10('0x25')](respondWithResult(_0x27d7b9,null))[_0xbb10('0x43')](handleError(_0x27d7b9,null));};exports[_0xbb10('0x55')]=function(_0x5c9afc,_0x5cd089,_0x46f462){var _0x1b11c0='';return db[_0xbb10('0x2b')][_0xbb10('0x4a')]({'where':{'id':_0x5c9afc[_0xbb10('0x45')]['id']},'attributes':['id',_0xbb10('0x56'),'password',_0xbb10('0x57'),_0xbb10('0x58'),_0xbb10('0x59')]})[_0xbb10('0x25')](handleEntityNotFound(_0x5cd089,null))[_0xbb10('0x25')](function(_0x5bfc68){if(_0x5bfc68){_0x1b11c0=_0x5bfc68['remoteUri'];var _0x5ad6ad=_0x1b11c0[_0xbb10('0x5a')](-0x1);if(_0x5ad6ad==='/'){_0x1b11c0=_0x1b11c0[_0xbb10('0x5b')](0x0,_0x1b11c0[_0xbb10('0x5c')](_0x5ad6ad));}var _0x21459e={'method':_0xbb10('0x5d'),'uri':util[_0xbb10('0x5e')]('%s/%s',_0x1b11c0,_0xbb10('0x5f')),'json':!![]};switch(_0x5bfc68['authType']){case'password':_0x21459e['headers']={'Authorization':util[_0xbb10('0x5e')](_0xbb10('0x60'),new Buffer(util[_0xbb10('0x5e')](_0xbb10('0x61'),_0x5bfc68['username'],_0x5bfc68[_0xbb10('0x62')]))['toString']('base64'))};break;case _0xbb10('0x57'):_0x21459e[_0xbb10('0x63')]={'Authorization':util[_0xbb10('0x5e')](_0xbb10('0x60'),new Buffer(util[_0xbb10('0x5e')]('%s/token:%s',_0x5bfc68[_0xbb10('0x56')],_0x5bfc68[_0xbb10('0x57')]))[_0xbb10('0x64')](_0xbb10('0x65')))};break;default:throw new db[(_0xbb10('0x66'))][(_0xbb10('0x67'))](_0xbb10('0x68'));}return rp(_0x21459e);}})['then'](function(_0x387b10){if(_0x387b10){var _0x1f648a=[_0xbb10('0x69'),_0xbb10('0x6a'),_0xbb10('0x6b'),_0xbb10('0x6c')];_[_0xbb10('0x6d')](_0x387b10[_0xbb10('0x5f')],function(_0x5a4429){return _0x1f648a[_0xbb10('0x6e')](_0x5a4429[_0xbb10('0x2c')]);});return{'count':_0x387b10[_0xbb10('0x5f')]['length'],'rows':_['map'](_0x387b10['ticket_fields'],function(_0x23286d){return{'id':_0x23286d['id'],'name':_0x23286d['position']>0x7?_0x23286d['title']:_0x23286d[_0xbb10('0x2c')],'custom':_0x23286d[_0xbb10('0x6f')]>0x7?!![]:![],'options':_0x23286d[_0xbb10('0x70')]?_0x23286d[_0xbb10('0x70')]:_0x23286d[_0xbb10('0x71')]?_0x23286d[_0xbb10('0x71')]:[]};})};}})[_0xbb10('0x25')](respondWithResult(_0x5cd089,null))[_0xbb10('0x43')](function(_0x188b97){var _0x5206e1=_0x5c9afc[_0xbb10('0x2f')][_0xbb10('0x72')]?0x1f4:_0x188b97[_0xbb10('0x73')]||0x1f4;logger[_0xbb10('0x27')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x5206e1,JSON[_0xbb10('0x74')](_0x188b97));delete _0x188b97[_0xbb10('0x29')];if(_0x5206e1===0x191){_0x5206e1=0x190;}_0x5cd089[_0xbb10('0x1b')](_0x5206e1)[_0xbb10('0x2a')](_0x5c9afc['query'][_0xbb10('0x72')]?{'message':_0xbb10('0x75'),'statusCode':_0x188b97[_0xbb10('0x73')]}:_0x188b97);});}; \ No newline at end of file +var _0x6e6c=['name','send','index','map','ZendeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','include','options','find','create','body','getConfigurations','ZendeskConfiguration','sort','addConfiguration','AccountId','channel','Descriptions','ZendeskField','Subjects','getFields','username','password','token','authType','remoteUri','slice','lastIndexOf','format','ticket_fields','headers','Basic\x20%s','%s:%s','base64','%s/token:%s','toString','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','group','assignee','remove','includes','position','title','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','mustache','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','json','reject','save','update','then','error','stack'];(function(_0x11a5f0,_0x279d5c){var _0x25fa99=function(_0x3ca6a8){while(--_0x3ca6a8){_0x11a5f0['push'](_0x11a5f0['shift']());}};_0x25fa99(++_0x279d5c);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x6e6c[_0x501510];return _0x1e6ee5;};'use strict';var emlformat=require(_0xc6e6('0x0'));var rimraf=require(_0xc6e6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc6e6('0x2'));var rp=require(_0xc6e6('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc6e6('0x4'));var util=require('util');var path=require(_0xc6e6('0x5'));var sox=require('sox');var csv=require(_0xc6e6('0x6'));var ejs=require(_0xc6e6('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc6e6('0x8'));var squel=require(_0xc6e6('0x9'));var crypto=require('crypto');var jsforce=require(_0xc6e6('0xa'));var deskjs=require(_0xc6e6('0xb'));var toCsv=require('to-csv');var querystring=require(_0xc6e6('0xc'));var Papa=require('papaparse');var Redis=require(_0xc6e6('0xd'));var authService=require(_0xc6e6('0xe'));var qs=require(_0xc6e6('0xf'));var as=require(_0xc6e6('0x10'));var hardwareService=require(_0xc6e6('0x11'));var logger=require(_0xc6e6('0x12'))(_0xc6e6('0x13'));var utils=require(_0xc6e6('0x14'));var config=require(_0xc6e6('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xc6e6('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x3a30ce,_0x314d0f){_0x314d0f=_0x314d0f||0xcc;return function(_0x33aea0){if(_0x33aea0){return _0x3a30ce[_0xc6e6('0x17')](_0x314d0f);}return _0x3a30ce['status'](_0x314d0f)[_0xc6e6('0x18')]();};}function respondWithResult(_0x2bfe7d,_0x13be73){_0x13be73=_0x13be73||0xc8;return function(_0x1b6ca9){if(_0x1b6ca9){return _0x2bfe7d[_0xc6e6('0x19')](_0x13be73)['json'](_0x1b6ca9);}};}function respondWithFilteredResult(_0x413cf8,_0x178b34){return function(_0x569474){if(_0x569474){var _0x2f11b0=typeof _0x178b34[_0xc6e6('0x1a')]===_0xc6e6('0x1b')&&typeof _0x178b34['limit']==='undefined';var _0x5867bf=_0x569474[_0xc6e6('0x1c')];var _0x554262=_0x2f11b0?0x0:_0x178b34[_0xc6e6('0x1a')];var _0x2069e4=_0x2f11b0?_0x569474[_0xc6e6('0x1c')]:_0x178b34[_0xc6e6('0x1a')]+_0x178b34[_0xc6e6('0x1d')];var _0x3a0d83;if(_0x2069e4>=_0x5867bf){_0x2069e4=_0x5867bf;_0x3a0d83=0xc8;}else{_0x3a0d83=0xce;}_0x413cf8[_0xc6e6('0x19')](_0x3a0d83);return _0x413cf8[_0xc6e6('0x1e')](_0xc6e6('0x1f'),_0x554262+'-'+_0x2069e4+'/'+_0x5867bf)[_0xc6e6('0x20')](_0x569474);}return null;};}function patchUpdates(_0x4a36b6){return function(_0x428401){try{jsonpatch['apply'](_0x428401,_0x4a36b6,!![]);}catch(_0x1c34cc){return BPromise[_0xc6e6('0x21')](_0x1c34cc);}return _0x428401[_0xc6e6('0x22')]();};}function saveUpdates(_0x2f69f1,_0x4f1d68){return function(_0x35253d){if(_0x35253d){return _0x35253d[_0xc6e6('0x23')](_0x2f69f1)[_0xc6e6('0x24')](function(_0x36ebfa){return _0x36ebfa;});}return null;};}function removeEntity(_0x107561,_0x4c35ae){return function(_0x41fe96){if(_0x41fe96){return _0x41fe96['destroy']()[_0xc6e6('0x24')](function(){_0x107561[_0xc6e6('0x19')](0xcc)[_0xc6e6('0x18')]();});}};}function handleEntityNotFound(_0x64e1dc,_0x53a1bf){return function(_0x3ff8a4){if(!_0x3ff8a4){_0x64e1dc['sendStatus'](0x194);}return _0x3ff8a4;};}function handleError(_0x28577b,_0x534745){_0x534745=_0x534745||0x1f4;return function(_0x267c6a){logger[_0xc6e6('0x25')](_0x267c6a[_0xc6e6('0x26')]);if(_0x267c6a[_0xc6e6('0x27')]){delete _0x267c6a[_0xc6e6('0x27')];}_0x28577b['status'](_0x534745)[_0xc6e6('0x28')](_0x267c6a);};}exports[_0xc6e6('0x29')]=function(_0x166313,_0x1af05c){var _0x4d1284={},_0x34ae96={},_0x50b735={'count':0x0,'rows':[]};var _0x29411c=_[_0xc6e6('0x2a')](db[_0xc6e6('0x2b')][_0xc6e6('0x2c')],function(_0xd3b63){return{'name':_0xd3b63[_0xc6e6('0x2d')],'type':_0xd3b63[_0xc6e6('0x2e')][_0xc6e6('0x2f')]};});_0x34ae96[_0xc6e6('0x30')]=_[_0xc6e6('0x2a')](_0x29411c,_0xc6e6('0x27'));_0x34ae96[_0xc6e6('0x31')]=_[_0xc6e6('0x32')](_0x166313[_0xc6e6('0x31')]);_0x34ae96[_0xc6e6('0x33')]=_[_0xc6e6('0x34')](_0x34ae96[_0xc6e6('0x30')],_0x34ae96['query']);_0x4d1284[_0xc6e6('0x35')]=_[_0xc6e6('0x34')](_0x34ae96['model'],qs['fields'](_0x166313[_0xc6e6('0x31')][_0xc6e6('0x36')]));_0x4d1284[_0xc6e6('0x35')]=_0x4d1284[_0xc6e6('0x35')][_0xc6e6('0x37')]?_0x4d1284[_0xc6e6('0x35')]:_0x34ae96['model'];if(!_0x166313[_0xc6e6('0x31')][_0xc6e6('0x38')](_0xc6e6('0x39'))){_0x4d1284['limit']=qs['limit'](_0x166313[_0xc6e6('0x31')][_0xc6e6('0x1d')]);_0x4d1284[_0xc6e6('0x1a')]=qs[_0xc6e6('0x1a')](_0x166313['query']['offset']);}_0x4d1284[_0xc6e6('0x3a')]=qs['sort'](_0x166313[_0xc6e6('0x31')]['sort']);_0x4d1284[_0xc6e6('0x3b')]=qs[_0xc6e6('0x33')](_[_0xc6e6('0x3c')](_0x166313[_0xc6e6('0x31')],_0x34ae96['filters']),_0x29411c);if(_0x166313['query'][_0xc6e6('0x3d')]){_0x4d1284[_0xc6e6('0x3b')]=_[_0xc6e6('0x3e')](_0x4d1284[_0xc6e6('0x3b')],{'$or':_['map'](_0x29411c,function(_0x4cbdcf){if(_0x4cbdcf[_0xc6e6('0x2e')]!==_0xc6e6('0x3f')){var _0x3a9104={};_0x3a9104[_0x4cbdcf[_0xc6e6('0x27')]]={'$like':'%'+_0x166313['query'][_0xc6e6('0x3d')]+'%'};return _0x3a9104;}})});}_0x4d1284=_[_0xc6e6('0x3e')]({},_0x4d1284,_0x166313['options']);var _0x500b7e={'where':_0x4d1284[_0xc6e6('0x3b')]};return db['ZendeskAccount'][_0xc6e6('0x1c')](_0x500b7e)[_0xc6e6('0x24')](function(_0x53d313){_0x50b735[_0xc6e6('0x1c')]=_0x53d313;if(_0x166313['query'][_0xc6e6('0x40')]){_0x4d1284['include']=[{'all':!![]}];}return db[_0xc6e6('0x2b')][_0xc6e6('0x41')](_0x4d1284);})[_0xc6e6('0x24')](function(_0x2f7af9){_0x50b735[_0xc6e6('0x42')]=_0x2f7af9;return _0x50b735;})[_0xc6e6('0x24')](respondWithFilteredResult(_0x1af05c,_0x4d1284))[_0xc6e6('0x43')](handleError(_0x1af05c,null));};exports[_0xc6e6('0x44')]=function(_0x5ecf6c,_0x5722db){var _0x3e3da6={'raw':![],'where':{'id':_0x5ecf6c[_0xc6e6('0x45')]['id']}},_0x2b494f={};_0x2b494f[_0xc6e6('0x30')]=_['keys'](db[_0xc6e6('0x2b')][_0xc6e6('0x2c')]);_0x2b494f[_0xc6e6('0x31')]=_[_0xc6e6('0x32')](_0x5ecf6c['query']);_0x2b494f[_0xc6e6('0x33')]=_[_0xc6e6('0x34')](_0x2b494f[_0xc6e6('0x30')],_0x2b494f[_0xc6e6('0x31')]);_0x3e3da6[_0xc6e6('0x35')]=_['intersection'](_0x2b494f[_0xc6e6('0x30')],qs['fields'](_0x5ecf6c[_0xc6e6('0x31')]['fields']));_0x3e3da6[_0xc6e6('0x35')]=_0x3e3da6[_0xc6e6('0x35')][_0xc6e6('0x37')]?_0x3e3da6[_0xc6e6('0x35')]:_0x2b494f[_0xc6e6('0x30')];if(_0x5ecf6c[_0xc6e6('0x31')][_0xc6e6('0x40')]){_0x3e3da6[_0xc6e6('0x46')]=[{'all':!![]}];}_0x3e3da6=_['merge']({},_0x3e3da6,_0x5ecf6c[_0xc6e6('0x47')]);return db[_0xc6e6('0x2b')][_0xc6e6('0x48')](_0x3e3da6)['then'](handleEntityNotFound(_0x5722db,null))[_0xc6e6('0x24')](respondWithResult(_0x5722db,null))[_0xc6e6('0x43')](handleError(_0x5722db,null));};exports[_0xc6e6('0x49')]=function(_0x42ed90,_0x7ba471){return db[_0xc6e6('0x2b')][_0xc6e6('0x49')](_0x42ed90[_0xc6e6('0x4a')],{})[_0xc6e6('0x24')](respondWithResult(_0x7ba471,0xc9))[_0xc6e6('0x43')](handleError(_0x7ba471,null));};exports[_0xc6e6('0x23')]=function(_0x470167,_0x3e0117){if(_0x470167[_0xc6e6('0x4a')]['id']){delete _0x470167['body']['id'];}return db[_0xc6e6('0x2b')]['find']({'where':{'id':_0x470167[_0xc6e6('0x45')]['id']}})[_0xc6e6('0x24')](handleEntityNotFound(_0x3e0117,null))['then'](saveUpdates(_0x470167['body'],null))['then'](respondWithResult(_0x3e0117,null))['catch'](handleError(_0x3e0117,null));};exports['destroy']=function(_0x3edc16,_0x40bbe9){return db[_0xc6e6('0x2b')][_0xc6e6('0x48')]({'where':{'id':_0x3edc16[_0xc6e6('0x45')]['id']}})['then'](handleEntityNotFound(_0x40bbe9,null))['then'](removeEntity(_0x40bbe9,null))[_0xc6e6('0x43')](handleError(_0x40bbe9,null));};exports[_0xc6e6('0x4b')]=function(_0x1aa872,_0x48ba2e,_0x577840){var _0x120a00={};var _0x467e9b={};var _0x286dc1;var _0x286dcf;return db[_0xc6e6('0x2b')]['findOne']({'where':{'id':_0x1aa872[_0xc6e6('0x45')]['id']}})[_0xc6e6('0x24')](handleEntityNotFound(_0x48ba2e,null))[_0xc6e6('0x24')](function(_0x5113e3){if(_0x5113e3){_0x286dc1=_0x5113e3;_0x467e9b[_0xc6e6('0x30')]=_[_0xc6e6('0x32')](db[_0xc6e6('0x4c')][_0xc6e6('0x2c')]);_0x467e9b[_0xc6e6('0x31')]=_['keys'](_0x1aa872[_0xc6e6('0x31')]);_0x467e9b[_0xc6e6('0x33')]=_[_0xc6e6('0x34')](_0x467e9b[_0xc6e6('0x30')],_0x467e9b[_0xc6e6('0x31')]);_0x120a00['attributes']=_['intersection'](_0x467e9b['model'],qs[_0xc6e6('0x36')](_0x1aa872[_0xc6e6('0x31')][_0xc6e6('0x36')]));_0x120a00[_0xc6e6('0x35')]=_0x120a00[_0xc6e6('0x35')][_0xc6e6('0x37')]?_0x120a00['attributes']:_0x467e9b[_0xc6e6('0x30')];_0x120a00['order']=qs[_0xc6e6('0x4d')](_0x1aa872[_0xc6e6('0x31')][_0xc6e6('0x4d')]);_0x120a00['where']=qs[_0xc6e6('0x33')](_['pick'](_0x1aa872[_0xc6e6('0x31')],_0x467e9b['filters']));if(_0x1aa872['query'][_0xc6e6('0x3d')]){_0x120a00['where']=_['merge'](_0x120a00[_0xc6e6('0x3b')],{'$or':_[_0xc6e6('0x2a')](_0x120a00[_0xc6e6('0x35')],function(_0x20c4cf){var _0x414bc4={};_0x414bc4[_0x20c4cf]={'$like':'%'+_0x1aa872[_0xc6e6('0x31')][_0xc6e6('0x3d')]+'%'};return _0x414bc4;})});}_0x120a00=_[_0xc6e6('0x3e')]({},_0x120a00,_0x1aa872['options']);return _0x286dc1[_0xc6e6('0x4b')](_0x120a00);}})[_0xc6e6('0x24')](function(_0x35b43f){if(_0x35b43f){_0x286dcf=_0x35b43f[_0xc6e6('0x37')];if(!_0x1aa872['query'][_0xc6e6('0x38')](_0xc6e6('0x39'))){_0x120a00[_0xc6e6('0x1d')]=qs['limit'](_0x1aa872['query'][_0xc6e6('0x1d')]);_0x120a00['offset']=qs['offset'](_0x1aa872[_0xc6e6('0x31')][_0xc6e6('0x1a')]);}return _0x286dc1[_0xc6e6('0x4b')](_0x120a00);}})[_0xc6e6('0x24')](function(_0x269f63){if(_0x269f63){return _0x269f63?{'count':_0x286dcf,'rows':_0x269f63}:null;}})[_0xc6e6('0x24')](respondWithResult(_0x48ba2e,null))[_0xc6e6('0x43')](handleError(_0x48ba2e,null));};exports[_0xc6e6('0x4e')]=function(_0x8bfc70,_0x1956be,_0x15404a){if(_0x8bfc70['body']['id']){delete _0x8bfc70['body']['id'];}return db[_0xc6e6('0x2b')]['findOne']({'where':{'id':_0x8bfc70['params']['id']}})[_0xc6e6('0x24')](handleEntityNotFound(_0x1956be,null))[_0xc6e6('0x24')](function(_0x27c5f0){if(_0x27c5f0){_0x8bfc70['body'][_0xc6e6('0x4f')]=_0x27c5f0['id'];_0x8bfc70[_0xc6e6('0x4a')]['Subjects']=integrations['getSubjects'](_0x8bfc70[_0xc6e6('0x4a')][_0xc6e6('0x50')],_0x8bfc70[_0xc6e6('0x4a')][_0xc6e6('0x2e')]);_0x8bfc70[_0xc6e6('0x4a')][_0xc6e6('0x51')]=integrations['getDescriptions'](_0x8bfc70[_0xc6e6('0x4a')][_0xc6e6('0x50')],_0x8bfc70[_0xc6e6('0x4a')][_0xc6e6('0x2e')]);return db[_0xc6e6('0x4c')]['create'](_0x8bfc70[_0xc6e6('0x4a')],{'include':[{'model':db[_0xc6e6('0x52')],'as':_0xc6e6('0x53')},{'model':db[_0xc6e6('0x52')],'as':_0xc6e6('0x51')}]});}return null;})[_0xc6e6('0x24')](respondWithResult(_0x1956be,null))['catch'](handleError(_0x1956be,null));};exports[_0xc6e6('0x54')]=function(_0x4c4985,_0x46c3df,_0x5c2cfc){var _0x55cec5='';return db[_0xc6e6('0x2b')]['findOne']({'where':{'id':_0x4c4985[_0xc6e6('0x45')]['id']},'attributes':['id',_0xc6e6('0x55'),_0xc6e6('0x56'),_0xc6e6('0x57'),_0xc6e6('0x58'),'remoteUri']})[_0xc6e6('0x24')](handleEntityNotFound(_0x46c3df,null))['then'](function(_0x4bdac6){if(_0x4bdac6){_0x55cec5=_0x4bdac6[_0xc6e6('0x59')];var _0xc38c57=_0x55cec5[_0xc6e6('0x5a')](-0x1);if(_0xc38c57==='/'){_0x55cec5=_0x55cec5['substring'](0x0,_0x55cec5[_0xc6e6('0x5b')](_0xc38c57));}var _0x4ec143={'method':'GET','uri':util[_0xc6e6('0x5c')]('%s/%s',_0x55cec5,_0xc6e6('0x5d')),'json':!![]};switch(_0x4bdac6[_0xc6e6('0x58')]){case _0xc6e6('0x56'):_0x4ec143[_0xc6e6('0x5e')]={'Authorization':util['format'](_0xc6e6('0x5f'),new Buffer(util[_0xc6e6('0x5c')](_0xc6e6('0x60'),_0x4bdac6[_0xc6e6('0x55')],_0x4bdac6[_0xc6e6('0x56')]))['toString'](_0xc6e6('0x61')))};break;case _0xc6e6('0x57'):_0x4ec143[_0xc6e6('0x5e')]={'Authorization':util[_0xc6e6('0x5c')]('Basic\x20%s',new Buffer(util['format'](_0xc6e6('0x62'),_0x4bdac6[_0xc6e6('0x55')],_0x4bdac6[_0xc6e6('0x57')]))[_0xc6e6('0x63')](_0xc6e6('0x61')))};break;default:throw new db[(_0xc6e6('0x64'))][(_0xc6e6('0x65'))](_0xc6e6('0x66'));}return rp(_0x4ec143);}})[_0xc6e6('0x24')](function(_0x4bbe4c){if(_0x4bbe4c){var _0x506679=[_0xc6e6('0x67'),'description',_0xc6e6('0x68'),_0xc6e6('0x69')];_[_0xc6e6('0x6a')](_0x4bbe4c['ticket_fields'],function(_0x5b0c3b){return _0x506679[_0xc6e6('0x6b')](_0x5b0c3b['type']);});return{'count':_0x4bbe4c[_0xc6e6('0x5d')]['length'],'rows':_[_0xc6e6('0x2a')](_0x4bbe4c[_0xc6e6('0x5d')],function(_0x5d867e){return{'id':_0x5d867e['id'],'name':_0x5d867e[_0xc6e6('0x6c')]>0x7?_0x5d867e[_0xc6e6('0x6d')]:_0x5d867e[_0xc6e6('0x2e')],'custom':_0x5d867e['position']>0x7?!![]:![],'options':_0x5d867e[_0xc6e6('0x6e')]?_0x5d867e[_0xc6e6('0x6e')]:_0x5d867e[_0xc6e6('0x6f')]?_0x5d867e['custom_field_options']:[]};})};}})[_0xc6e6('0x24')](respondWithResult(_0x46c3df,null))[_0xc6e6('0x43')](function(_0x4e7b05){var _0x4e0add=_0x4c4985['query'][_0xc6e6('0x70')]?0x1f4:_0x4e7b05[_0xc6e6('0x71')]||0x1f4;logger[_0xc6e6('0x25')](_0xc6e6('0x72'),_0xc6e6('0x54'),_0x4e0add,JSON[_0xc6e6('0x73')](_0x4e7b05));delete _0x4e7b05['name'];if(_0x4e0add===0x191){_0x4e0add=0x190;}_0x46c3df[_0xc6e6('0x19')](_0x4e0add)['send'](_0x4c4985[_0xc6e6('0x31')][_0xc6e6('0x70')]?{'message':_0xc6e6('0x74'),'statusCode':_0x4e7b05['statusCode']}:_0x4e7b05);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index d637335..06933f0 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 _0xf78a=['ZendeskAccount','int_zendesk_accounts','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intZendeskAccount.attributes','define'];(function(_0x29a73d,_0x4cc946){var _0x4bfd6e=function(_0x16590f){while(--_0x16590f){_0x29a73d['push'](_0x29a73d['shift']());}};_0x4bfd6e(++_0x4cc946);}(_0xf78a,0x199));var _0xaf78=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0xf78a[_0x122096];return _0x3d1966;};'use strict';var _=require('lodash');var util=require(_0xaf78('0x0'));var logger=require('../../config/logger')(_0xaf78('0x1'));var moment=require(_0xaf78('0x2'));var BPromise=require(_0xaf78('0x3'));var rp=require(_0xaf78('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaf78('0x5'));var config=require(_0xaf78('0x6'));var attributes=require(_0xaf78('0x7'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x3437db,_0x3c492d){return _0x3437db[_0xaf78('0x8')](_0xaf78('0x9'),attributes,{'tableName':_0xaf78('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x909d=['moment','bluebird','path','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','ZendeskAccount','int_zendesk_accounts','lodash','util','api'];(function(_0x52a23f,_0x467b97){var _0x14c953=function(_0x53eba4){while(--_0x53eba4){_0x52a23f['push'](_0x52a23f['shift']());}};_0x14c953(++_0x467b97);}(_0x909d,0x177));var _0xd909=function(_0x485b5a,_0x2b289b){_0x485b5a=_0x485b5a-0x0;var _0xd2b34d=_0x909d[_0x485b5a];return _0xd2b34d;};'use strict';var _=require(_0xd909('0x0'));var util=require(_0xd909('0x1'));var logger=require('../../config/logger')(_0xd909('0x2'));var moment=require(_0xd909('0x3'));var BPromise=require(_0xd909('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd909('0x5'));var rimraf=require(_0xd909('0x6'));var config=require(_0xd909('0x7'));var attributes=require(_0xd909('0x8'));var integrations=require(_0xd909('0x9'));module[_0xd909('0xa')]=function(_0x1f2ba2,_0x5a920a){return _0x1f2ba2[_0xd909('0xb')](_0xd909('0xc'),attributes,{'tableName':_0xd909('0xd'),'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 cdb9249..0221d85 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 _0x7bc0=['include','map','model','then','ShowZendeskAccount','find','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ZendeskAccount','findAll','raw','options','where','attributes','limit'];(function(_0xe2c50e,_0x32d774){var _0x1b3233=function(_0x2cb0ef){while(--_0x2cb0ef){_0xe2c50e['push'](_0xe2c50e['shift']());}};_0x1b3233(++_0x32d774);}(_0x7bc0,0xa1));var _0x07bc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7bc0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x07bc('0x0'));var moment=require(_0x07bc('0x1'));var BPromise=require(_0x07bc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x07bc('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x07bc('0x4'));var logger=require('../../config/logger')(_0x07bc('0x5'));var config=require(_0x07bc('0x6'));var jayson=require(_0x07bc('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x46b719,_0x50373c,_0x4c0460){return new BPromise(function(_0x57708e,_0x451cee){return client['request'](_0x46b719,_0x4c0460)['then'](function(_0x3f2276){logger[_0x07bc('0x8')](_0x07bc('0x9'),_0x50373c,_0x07bc('0xa'));logger[_0x07bc('0xb')](_0x07bc('0xc'),_0x50373c,_0x07bc('0xa'),JSON[_0x07bc('0xd')](_0x3f2276));if(_0x3f2276[_0x07bc('0xe')]){if(_0x3f2276[_0x07bc('0xe')]['code']===0x1f4){logger[_0x07bc('0xe')](_0x07bc('0x9'),_0x50373c,_0x3f2276[_0x07bc('0xe')][_0x07bc('0xf')]);return _0x451cee(_0x3f2276[_0x07bc('0xe')]['message']);}logger[_0x07bc('0xe')]('ZendeskAccount,\x20%s,\x20%s',_0x50373c,_0x3f2276['error'][_0x07bc('0xf')]);return _0x57708e(_0x3f2276['error'][_0x07bc('0xf')]);}else{logger[_0x07bc('0x8')](_0x07bc('0x9'),_0x50373c,_0x07bc('0xa'));_0x57708e(_0x3f2276[_0x07bc('0x10')][_0x07bc('0xf')]);}})[_0x07bc('0x11')](function(_0x139227){logger[_0x07bc('0xe')](_0x07bc('0x9'),_0x50373c,_0x139227);_0x451cee(_0x139227);});});}exports['GetZendeskAccount']=function(_0x37c2f3){var _0x186999=this;return new Promise(function(_0x1c9dcf,_0x27ba64){return db[_0x07bc('0x12')][_0x07bc('0x13')]({'raw':_0x37c2f3['options']?_0x37c2f3['options'][_0x07bc('0x14')]===undefined?!![]:![]:!![],'where':_0x37c2f3[_0x07bc('0x15')]?_0x37c2f3[_0x07bc('0x15')][_0x07bc('0x16')]||null:null,'attributes':_0x37c2f3['options']?_0x37c2f3['options'][_0x07bc('0x17')]||null:null,'limit':_0x37c2f3[_0x07bc('0x15')]?_0x37c2f3[_0x07bc('0x15')][_0x07bc('0x18')]||null:null,'include':_0x37c2f3['options']?_0x37c2f3[_0x07bc('0x15')][_0x07bc('0x19')]?_[_0x07bc('0x1a')](_0x37c2f3[_0x07bc('0x15')][_0x07bc('0x19')],function(_0x9bc960){return{'model':db[_0x9bc960['model']],'as':_0x9bc960['as'],'attributes':_0x9bc960[_0x07bc('0x17')],'include':_0x9bc960[_0x07bc('0x19')]?_[_0x07bc('0x1a')](_0x9bc960['include'],function(_0x350ff1){return{'model':db[_0x350ff1[_0x07bc('0x1b')]],'as':_0x350ff1['as'],'attributes':_0x350ff1[_0x07bc('0x17')],'include':_0x350ff1['include']?_['map'](_0x350ff1[_0x07bc('0x19')],function(_0x159559){return{'model':db[_0x159559['model']],'as':_0x159559['as'],'attributes':_0x159559[_0x07bc('0x17')]};}):[]};}):[]};}):[]:[]})[_0x07bc('0x1c')](function(_0x1651c6){logger[_0x07bc('0x8')]('GetZendeskAccount',_0x37c2f3);logger[_0x07bc('0xb')]('GetZendeskAccount',_0x37c2f3,JSON[_0x07bc('0xd')](_0x1651c6));_0x1c9dcf(_0x1651c6);})[_0x07bc('0x11')](function(_0x1a8a4c){logger['error']('GetZendeskAccount',_0x1a8a4c[_0x07bc('0xf')],_0x37c2f3);_0x27ba64(_0x186999['error'](0x1f4,_0x1a8a4c[_0x07bc('0xf')]));});});};exports[_0x07bc('0x1d')]=function(_0x87c68f){var _0x255cc6=this;return new Promise(function(_0x1b7440,_0x357a52){return db[_0x07bc('0x12')][_0x07bc('0x1e')]({'raw':_0x87c68f[_0x07bc('0x15')]?_0x87c68f[_0x07bc('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x87c68f[_0x07bc('0x15')]?_0x87c68f[_0x07bc('0x15')]['where']||null:null,'attributes':_0x87c68f[_0x07bc('0x15')]?_0x87c68f['options']['attributes']||null:null,'include':_0x87c68f['options']?_0x87c68f[_0x07bc('0x15')][_0x07bc('0x19')]?_['map'](_0x87c68f[_0x07bc('0x15')][_0x07bc('0x19')],function(_0x170f25){return{'model':db[_0x170f25['model']],'as':_0x170f25['as'],'attributes':_0x170f25[_0x07bc('0x17')],'include':_0x170f25['include']?_[_0x07bc('0x1a')](_0x170f25[_0x07bc('0x19')],function(_0x57acb3){return{'model':db[_0x57acb3[_0x07bc('0x1b')]],'as':_0x57acb3['as'],'attributes':_0x57acb3[_0x07bc('0x17')],'include':_0x57acb3[_0x07bc('0x19')]?_[_0x07bc('0x1a')](_0x57acb3[_0x07bc('0x19')],function(_0x130cfc){return{'model':db[_0x130cfc[_0x07bc('0x1b')]],'as':_0x130cfc['as'],'attributes':_0x130cfc[_0x07bc('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x41bcab){logger[_0x07bc('0x8')](_0x07bc('0x1d'),_0x87c68f);logger['debug'](_0x07bc('0x1d'),_0x87c68f,JSON[_0x07bc('0xd')](_0x41bcab));_0x1b7440(_0x41bcab);})[_0x07bc('0x11')](function(_0x4e0b7f){logger[_0x07bc('0xe')](_0x07bc('0x1d'),_0x4e0b7f[_0x07bc('0xf')],_0x87c68f);_0x357a52(_0x255cc6[_0x07bc('0xe')](0x1f4,_0x4e0b7f[_0x07bc('0xf')]));});});}; \ No newline at end of file +var _0x7fd6=['then','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','GetZendeskAccount','findAll','options','where','attributes','limit','include','map','model','catch','ShowZendeskAccount','ZendeskAccount','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','request'];(function(_0xdc37e9,_0x5576a5){var _0x597472=function(_0x3514a9){while(--_0x3514a9){_0xdc37e9['push'](_0xdc37e9['shift']());}};_0x597472(++_0x5576a5);}(_0x7fd6,0x157));var _0x67fd=function(_0x598e6c,_0x2cbd68){_0x598e6c=_0x598e6c-0x0;var _0x3d671e=_0x7fd6[_0x598e6c];return _0x3d671e;};'use strict';var _=require(_0x67fd('0x0'));var util=require('util');var moment=require(_0x67fd('0x1'));var BPromise=require(_0x67fd('0x2'));var rs=require(_0x67fd('0x3'));var fs=require('fs');var Redis=require(_0x67fd('0x4'));var db=require(_0x67fd('0x5'))['db'];var utils=require(_0x67fd('0x6'));var logger=require('../../config/logger')(_0x67fd('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x440518,_0x23e1d6,_0x21d7b1){return new BPromise(function(_0x1bbae4,_0x74be46){return client[_0x67fd('0x8')](_0x440518,_0x21d7b1)[_0x67fd('0x9')](function(_0x3d233d){logger['info'](_0x67fd('0xa'),_0x23e1d6,_0x67fd('0xb'));logger[_0x67fd('0xc')](_0x67fd('0xd'),_0x23e1d6,_0x67fd('0xb'),JSON[_0x67fd('0xe')](_0x3d233d));if(_0x3d233d['error']){if(_0x3d233d[_0x67fd('0xf')][_0x67fd('0x10')]===0x1f4){logger[_0x67fd('0xf')](_0x67fd('0xa'),_0x23e1d6,_0x3d233d[_0x67fd('0xf')][_0x67fd('0x11')]);return _0x74be46(_0x3d233d[_0x67fd('0xf')][_0x67fd('0x11')]);}logger[_0x67fd('0xf')](_0x67fd('0xa'),_0x23e1d6,_0x3d233d[_0x67fd('0xf')]['message']);return _0x1bbae4(_0x3d233d[_0x67fd('0xf')][_0x67fd('0x11')]);}else{logger[_0x67fd('0x12')](_0x67fd('0xa'),_0x23e1d6,'request\x20sent');_0x1bbae4(_0x3d233d[_0x67fd('0x13')][_0x67fd('0x11')]);}})['catch'](function(_0x285828){logger[_0x67fd('0xf')](_0x67fd('0xa'),_0x23e1d6,_0x285828);_0x74be46(_0x285828);});});}exports[_0x67fd('0x14')]=function(_0x412a1c){var _0x30cb2c=this;return new Promise(function(_0x1f019e,_0xf21e09){return db['ZendeskAccount'][_0x67fd('0x15')]({'raw':_0x412a1c['options']?_0x412a1c[_0x67fd('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x412a1c[_0x67fd('0x16')]?_0x412a1c[_0x67fd('0x16')][_0x67fd('0x17')]||null:null,'attributes':_0x412a1c['options']?_0x412a1c[_0x67fd('0x16')][_0x67fd('0x18')]||null:null,'limit':_0x412a1c['options']?_0x412a1c[_0x67fd('0x16')][_0x67fd('0x19')]||null:null,'include':_0x412a1c[_0x67fd('0x16')]?_0x412a1c[_0x67fd('0x16')][_0x67fd('0x1a')]?_[_0x67fd('0x1b')](_0x412a1c[_0x67fd('0x16')][_0x67fd('0x1a')],function(_0x311c1d){return{'model':db[_0x311c1d[_0x67fd('0x1c')]],'as':_0x311c1d['as'],'attributes':_0x311c1d['attributes'],'include':_0x311c1d[_0x67fd('0x1a')]?_[_0x67fd('0x1b')](_0x311c1d['include'],function(_0x5ce47b){return{'model':db[_0x5ce47b[_0x67fd('0x1c')]],'as':_0x5ce47b['as'],'attributes':_0x5ce47b[_0x67fd('0x18')],'include':_0x5ce47b[_0x67fd('0x1a')]?_[_0x67fd('0x1b')](_0x5ce47b[_0x67fd('0x1a')],function(_0x8d4eff){return{'model':db[_0x8d4eff['model']],'as':_0x8d4eff['as'],'attributes':_0x8d4eff[_0x67fd('0x18')]};}):[]};}):[]};}):[]:[]})[_0x67fd('0x9')](function(_0x157640){logger['info']('GetZendeskAccount',_0x412a1c);logger[_0x67fd('0xc')](_0x67fd('0x14'),_0x412a1c,JSON[_0x67fd('0xe')](_0x157640));_0x1f019e(_0x157640);})[_0x67fd('0x1d')](function(_0x383ef){logger[_0x67fd('0xf')]('GetZendeskAccount',_0x383ef[_0x67fd('0x11')],_0x412a1c);_0xf21e09(_0x30cb2c['error'](0x1f4,_0x383ef[_0x67fd('0x11')]));});});};exports[_0x67fd('0x1e')]=function(_0x4b2c5c){var _0x184629=this;return new Promise(function(_0x497291,_0x50679e){return db[_0x67fd('0x1f')]['find']({'raw':_0x4b2c5c[_0x67fd('0x16')]?_0x4b2c5c['options']['raw']===undefined?!![]:![]:!![],'where':_0x4b2c5c[_0x67fd('0x16')]?_0x4b2c5c[_0x67fd('0x16')][_0x67fd('0x17')]||null:null,'attributes':_0x4b2c5c[_0x67fd('0x16')]?_0x4b2c5c[_0x67fd('0x16')][_0x67fd('0x18')]||null:null,'include':_0x4b2c5c[_0x67fd('0x16')]?_0x4b2c5c['options']['include']?_[_0x67fd('0x1b')](_0x4b2c5c[_0x67fd('0x16')]['include'],function(_0x4b1ce8){return{'model':db[_0x4b1ce8[_0x67fd('0x1c')]],'as':_0x4b1ce8['as'],'attributes':_0x4b1ce8[_0x67fd('0x18')],'include':_0x4b1ce8[_0x67fd('0x1a')]?_[_0x67fd('0x1b')](_0x4b1ce8[_0x67fd('0x1a')],function(_0x1045a4){return{'model':db[_0x1045a4[_0x67fd('0x1c')]],'as':_0x1045a4['as'],'attributes':_0x1045a4[_0x67fd('0x18')],'include':_0x1045a4[_0x67fd('0x1a')]?_[_0x67fd('0x1b')](_0x1045a4[_0x67fd('0x1a')],function(_0x48ffb9){return{'model':db[_0x48ffb9[_0x67fd('0x1c')]],'as':_0x48ffb9['as'],'attributes':_0x48ffb9[_0x67fd('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x526489){logger[_0x67fd('0x12')]('ShowZendeskAccount',_0x4b2c5c);logger[_0x67fd('0xc')](_0x67fd('0x1e'),_0x4b2c5c,JSON['stringify'](_0x526489));_0x497291(_0x526489);})[_0x67fd('0x1d')](function(_0x2faef2){logger[_0x67fd('0xf')](_0x67fd('0x1e'),_0x2faef2[_0x67fd('0x11')],_0x4b2c5c);_0x50679e(_0x184629[_0x67fd('0xf')](0x1f4,_0x2faef2[_0x67fd('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 2ad7348..97e691d 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 _0xf4eb=['put','update','delete','/:id','destroy','exports','multer','Router','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/tags','getTags','create','post','setTags'];(function(_0x597258,_0x293d8b){var _0x1f1142=function(_0x300a61){while(--_0x300a61){_0x597258['push'](_0x597258['shift']());}};_0x1f1142(++_0x293d8b);}(_0xf4eb,0xec));var _0xbf4e=function(_0x3e5cc7,_0x4525b7){_0x3e5cc7=_0x3e5cc7-0x0;var _0x515f37=_0xf4eb[_0x3e5cc7];return _0x515f37;};'use strict';var multer=require(_0xbf4e('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbf4e('0x1')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xbf4e('0x2'));var config=require(_0xbf4e('0x3'));var controller=require(_0xbf4e('0x4'));router[_0xbf4e('0x5')]('/',auth[_0xbf4e('0x6')](),controller[_0xbf4e('0x7')]);router[_0xbf4e('0x5')]('/:id',auth[_0xbf4e('0x6')](),controller['show']);router['get'](_0xbf4e('0x8'),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0x9')]);router[_0xbf4e('0x5')](_0xbf4e('0xa'),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0xb')]);router['get']('/:id/descriptions',auth[_0xbf4e('0x6')](),controller['getDescriptions']);router[_0xbf4e('0x5')](_0xbf4e('0xc'),auth['isAuthenticated'](),controller[_0xbf4e('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xbf4e('0xe')]);router[_0xbf4e('0xf')](_0xbf4e('0xc'),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0x10')]);router[_0xbf4e('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xbf4e('0x12')]);router[_0xbf4e('0x13')](_0xbf4e('0x14'),auth['isAuthenticated'](),controller[_0xbf4e('0x15')]);module[_0xbf4e('0x16')]=router; \ No newline at end of file +var _0x153f=['/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./intZendeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects','getSubjects'];(function(_0x42e98c,_0x1c6bb9){var _0x59803e=function(_0x3a587e){while(--_0x3a587e){_0x42e98c['push'](_0x42e98c['shift']());}};_0x59803e(++_0x1c6bb9);}(_0x153f,0x15b));var _0xf153=function(_0x57b21c,_0x5e5e78){_0x57b21c=_0x57b21c-0x0;var _0xdc0f5f=_0x153f[_0x57b21c];return _0xdc0f5f;};'use strict';var multer=require(_0xf153('0x0'));var util=require(_0xf153('0x1'));var path=require(_0xf153('0x2'));var timeout=require(_0xf153('0x3'));var express=require(_0xf153('0x4'));var router=express[_0xf153('0x5')]();var fs_extra=require(_0xf153('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xf153('0x7'));var config=require('../../config/environment');var controller=require(_0xf153('0x8'));router[_0xf153('0x9')]('/',auth[_0xf153('0xa')](),controller[_0xf153('0xb')]);router[_0xf153('0x9')]('/:id',auth[_0xf153('0xa')](),controller[_0xf153('0xc')]);router[_0xf153('0x9')](_0xf153('0xd'),auth[_0xf153('0xa')](),controller[_0xf153('0xe')]);router[_0xf153('0x9')](_0xf153('0xf'),auth[_0xf153('0xa')](),controller[_0xf153('0x10')]);router['get'](_0xf153('0x11'),auth[_0xf153('0xa')](),controller[_0xf153('0x12')]);router['get'](_0xf153('0x13'),auth[_0xf153('0xa')](),controller[_0xf153('0x14')]);router[_0xf153('0x15')]('/',auth[_0xf153('0xa')](),controller[_0xf153('0x16')]);router[_0xf153('0x15')](_0xf153('0x13'),auth[_0xf153('0xa')](),controller['setTags']);router[_0xf153('0x17')](_0xf153('0x18'),auth[_0xf153('0xa')](),controller[_0xf153('0x19')]);router[_0xf153('0x1a')](_0xf153('0x18'),auth[_0xf153('0xa')](),controller[_0xf153('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 6e2ae3f..06f843b 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 _0xc1d9=['exports'];(function(_0x32b734,_0x368370){var _0x456d3a=function(_0x50760e){while(--_0x50760e){_0x32b734['push'](_0x32b734['shift']());}};_0x456d3a(++_0x368370);}(_0xc1d9,0x193));var _0x9c1d=function(_0x38472f,_0x56d3fd){_0x38472f=_0x38472f-0x0;var _0x192537=_0xc1d9[_0x38472f];return _0x192537;};'use strict';var Sequelize=require('sequelize');module[_0x9c1d('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9848=['STRING','sequelize','exports'];(function(_0x1bcc2e,_0x1b91d0){var _0x1096c6=function(_0x3b63b3){while(--_0x3b63b3){_0x1bcc2e['push'](_0x1bcc2e['shift']());}};_0x1096c6(++_0x1b91d0);}(_0x9848,0x1ea));var _0x8984=function(_0x5d23d6,_0x27151d){_0x5d23d6=_0x5d23d6-0x0;var _0x183d5b=_0x9848[_0x5d23d6];return _0x183d5b;};'use strict';var Sequelize=require(_0x8984('0x0'));module[_0x8984('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8984('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index e77aeb3..ea643b5 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 _0xf6b0=['sort','where','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','params','keys','intersection','options','find','create','body','getFields','findOne','length','order','pick','getSubjects','getDescriptions','ZendeskField','getTags','Tag','setTags','ids','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','ZendeskConfiguration','rawAttributes','fieldName','key','model','query','filters','attributes','fields','hasOwnProperty','nolimit'];(function(_0x5875aa,_0x58ed40){var _0x1a0641=function(_0x46d440){while(--_0x46d440){_0x5875aa['push'](_0x5875aa['shift']());}};_0x1a0641(++_0x58ed40);}(_0xf6b0,0x126));var _0x0f6b=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0xf6b0[_0x4b2863];return _0x567d67;};'use strict';var emlformat=require(_0x0f6b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0f6b('0x1'));var jsonpatch=require(_0x0f6b('0x2'));var rp=require(_0x0f6b('0x3'));var moment=require(_0x0f6b('0x4'));var BPromise=require(_0x0f6b('0x5'));var Mustache=require(_0x0f6b('0x6'));var util=require('util');var path=require(_0x0f6b('0x7'));var sox=require(_0x0f6b('0x8'));var csv=require(_0x0f6b('0x9'));var ejs=require(_0x0f6b('0xa'));var fs=require('fs');var fs_extra=require(_0x0f6b('0xb'));var _=require(_0x0f6b('0xc'));var squel=require(_0x0f6b('0xd'));var crypto=require(_0x0f6b('0xe'));var jsforce=require(_0x0f6b('0xf'));var deskjs=require(_0x0f6b('0x10'));var toCsv=require(_0x0f6b('0x9'));var querystring=require(_0x0f6b('0x11'));var Papa=require('papaparse');var Redis=require(_0x0f6b('0x12'));var authService=require(_0x0f6b('0x13'));var qs=require(_0x0f6b('0x14'));var as=require(_0x0f6b('0x15'));var hardwareService=require(_0x0f6b('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x0f6b('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x0f6b('0x18'));var db=require(_0x0f6b('0x19'))['db'];function respondWithStatusCode(_0x95de3a,_0x1fa86a){_0x1fa86a=_0x1fa86a||0xcc;return function(_0xd77b12){if(_0xd77b12){return _0x95de3a['sendStatus'](_0x1fa86a);}return _0x95de3a[_0x0f6b('0x1a')](_0x1fa86a)[_0x0f6b('0x1b')]();};}function respondWithResult(_0x21030a,_0x2921fe){_0x2921fe=_0x2921fe||0xc8;return function(_0x1041af){if(_0x1041af){return _0x21030a['status'](_0x2921fe)[_0x0f6b('0x1c')](_0x1041af);}};}function respondWithFilteredResult(_0x344720,_0x25cda3){return function(_0x6ffbf2){if(_0x6ffbf2){var _0x29ef65=typeof _0x25cda3[_0x0f6b('0x1d')]==='undefined'&&typeof _0x25cda3[_0x0f6b('0x1e')]===_0x0f6b('0x1f');var _0x4f69d6=_0x6ffbf2[_0x0f6b('0x20')];var _0x1db326=_0x29ef65?0x0:_0x25cda3[_0x0f6b('0x1d')];var _0x595c70=_0x29ef65?_0x6ffbf2[_0x0f6b('0x20')]:_0x25cda3[_0x0f6b('0x1d')]+_0x25cda3[_0x0f6b('0x1e')];var _0x40fdb8;if(_0x595c70>=_0x4f69d6){_0x595c70=_0x4f69d6;_0x40fdb8=0xc8;}else{_0x40fdb8=0xce;}_0x344720['status'](_0x40fdb8);return _0x344720[_0x0f6b('0x21')](_0x0f6b('0x22'),_0x1db326+'-'+_0x595c70+'/'+_0x4f69d6)[_0x0f6b('0x1c')](_0x6ffbf2);}return null;};}function patchUpdates(_0x52c8b6){return function(_0x450dd3){try{jsonpatch['apply'](_0x450dd3,_0x52c8b6,!![]);}catch(_0x56f0ca){return BPromise[_0x0f6b('0x23')](_0x56f0ca);}return _0x450dd3[_0x0f6b('0x24')]();};}function saveUpdates(_0x157ceb,_0x102692){return function(_0x5c2c6b){if(_0x5c2c6b){return _0x5c2c6b[_0x0f6b('0x25')](_0x157ceb)[_0x0f6b('0x26')](function(_0x502165){return _0x502165;});}return null;};}function removeEntity(_0x1aef09,_0x41fa49){return function(_0x175ff0){if(_0x175ff0){return _0x175ff0[_0x0f6b('0x27')]()['then'](function(){_0x1aef09['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x250c8f,_0xd4f9b8){return function(_0x388f0e){if(!_0x388f0e){_0x250c8f[_0x0f6b('0x28')](0x194);}return _0x388f0e;};}function handleError(_0x31817b,_0x31c489){_0x31c489=_0x31c489||0x1f4;return function(_0x37fd01){logger[_0x0f6b('0x29')](_0x37fd01[_0x0f6b('0x2a')]);if(_0x37fd01[_0x0f6b('0x2b')]){delete _0x37fd01[_0x0f6b('0x2b')];}_0x31817b[_0x0f6b('0x1a')](_0x31c489)[_0x0f6b('0x2c')](_0x37fd01);};}exports[_0x0f6b('0x2d')]=function(_0x2a5793,_0x107214){var _0x28a97d={},_0x1d2469={},_0x872253={'count':0x0,'rows':[]};var _0x206ee8=_[_0x0f6b('0x2e')](db[_0x0f6b('0x2f')][_0x0f6b('0x30')],function(_0x1e5644){return{'name':_0x1e5644[_0x0f6b('0x31')],'type':_0x1e5644['type'][_0x0f6b('0x32')]};});_0x1d2469[_0x0f6b('0x33')]=_[_0x0f6b('0x2e')](_0x206ee8,'name');_0x1d2469[_0x0f6b('0x34')]=_['keys'](_0x2a5793[_0x0f6b('0x34')]);_0x1d2469[_0x0f6b('0x35')]=_['intersection'](_0x1d2469[_0x0f6b('0x33')],_0x1d2469[_0x0f6b('0x34')]);_0x28a97d[_0x0f6b('0x36')]=_['intersection'](_0x1d2469[_0x0f6b('0x33')],qs['fields'](_0x2a5793[_0x0f6b('0x34')][_0x0f6b('0x37')]));_0x28a97d[_0x0f6b('0x36')]=_0x28a97d[_0x0f6b('0x36')]['length']?_0x28a97d['attributes']:_0x1d2469[_0x0f6b('0x33')];if(!_0x2a5793[_0x0f6b('0x34')][_0x0f6b('0x38')](_0x0f6b('0x39'))){_0x28a97d[_0x0f6b('0x1e')]=qs[_0x0f6b('0x1e')](_0x2a5793['query'][_0x0f6b('0x1e')]);_0x28a97d['offset']=qs[_0x0f6b('0x1d')](_0x2a5793['query'][_0x0f6b('0x1d')]);}_0x28a97d['order']=qs[_0x0f6b('0x3a')](_0x2a5793[_0x0f6b('0x34')][_0x0f6b('0x3a')]);_0x28a97d[_0x0f6b('0x3b')]=qs[_0x0f6b('0x35')](_['pick'](_0x2a5793[_0x0f6b('0x34')],_0x1d2469[_0x0f6b('0x35')]),_0x206ee8);if(_0x2a5793[_0x0f6b('0x34')][_0x0f6b('0x3c')]){_0x28a97d[_0x0f6b('0x3b')]=_[_0x0f6b('0x3d')](_0x28a97d[_0x0f6b('0x3b')],{'$or':_[_0x0f6b('0x2e')](_0x206ee8,function(_0x3b0a98){if(_0x3b0a98[_0x0f6b('0x3e')]!==_0x0f6b('0x3f')){var _0x2398f0={};_0x2398f0[_0x3b0a98[_0x0f6b('0x2b')]]={'$like':'%'+_0x2a5793[_0x0f6b('0x34')]['filter']+'%'};return _0x2398f0;}})});}_0x28a97d=_['merge']({},_0x28a97d,_0x2a5793['options']);var _0xd21b84={'where':_0x28a97d[_0x0f6b('0x3b')]};return db['ZendeskConfiguration'][_0x0f6b('0x20')](_0xd21b84)[_0x0f6b('0x26')](function(_0x50c518){_0x872253[_0x0f6b('0x20')]=_0x50c518;if(_0x2a5793[_0x0f6b('0x34')][_0x0f6b('0x40')]){_0x28a97d[_0x0f6b('0x41')]=[{'all':!![]}];}return db[_0x0f6b('0x2f')][_0x0f6b('0x42')](_0x28a97d);})[_0x0f6b('0x26')](function(_0x21c90d){_0x872253[_0x0f6b('0x43')]=_0x21c90d;return _0x872253;})['then'](respondWithFilteredResult(_0x107214,_0x28a97d))[_0x0f6b('0x44')](handleError(_0x107214,null));};exports['show']=function(_0x5d8a80,_0x3ec782){var _0x48e437={'raw':![],'where':{'id':_0x5d8a80[_0x0f6b('0x45')]['id']}},_0x5306e0={};_0x5306e0[_0x0f6b('0x33')]=_[_0x0f6b('0x46')](db['ZendeskConfiguration'][_0x0f6b('0x30')]);_0x5306e0[_0x0f6b('0x34')]=_[_0x0f6b('0x46')](_0x5d8a80['query']);_0x5306e0[_0x0f6b('0x35')]=_[_0x0f6b('0x47')](_0x5306e0[_0x0f6b('0x33')],_0x5306e0['query']);_0x48e437['attributes']=_['intersection'](_0x5306e0['model'],qs[_0x0f6b('0x37')](_0x5d8a80[_0x0f6b('0x34')][_0x0f6b('0x37')]));_0x48e437[_0x0f6b('0x36')]=_0x48e437[_0x0f6b('0x36')]['length']?_0x48e437[_0x0f6b('0x36')]:_0x5306e0[_0x0f6b('0x33')];if(_0x5d8a80['query'][_0x0f6b('0x40')]){_0x48e437['include']=[{'all':!![]}];}_0x48e437=_[_0x0f6b('0x3d')]({},_0x48e437,_0x5d8a80[_0x0f6b('0x48')]);return db[_0x0f6b('0x2f')][_0x0f6b('0x49')](_0x48e437)['then'](handleEntityNotFound(_0x3ec782,null))[_0x0f6b('0x26')](respondWithResult(_0x3ec782,null))[_0x0f6b('0x44')](handleError(_0x3ec782,null));};exports[_0x0f6b('0x4a')]=function(_0x1d2fdf,_0x46f19d){return db[_0x0f6b('0x2f')][_0x0f6b('0x4a')](_0x1d2fdf[_0x0f6b('0x4b')],{})[_0x0f6b('0x26')](respondWithResult(_0x46f19d,0xc9))['catch'](handleError(_0x46f19d,null));};exports['update']=function(_0xeb5fa4,_0x2b7cb1){if(_0xeb5fa4['body']['id']){delete _0xeb5fa4[_0x0f6b('0x4b')]['id'];}return db['ZendeskConfiguration'][_0x0f6b('0x49')]({'where':{'id':_0xeb5fa4[_0x0f6b('0x45')]['id']}})[_0x0f6b('0x26')](handleEntityNotFound(_0x2b7cb1,null))[_0x0f6b('0x26')](saveUpdates(_0xeb5fa4[_0x0f6b('0x4b')],null))[_0x0f6b('0x26')](respondWithResult(_0x2b7cb1,null))[_0x0f6b('0x44')](handleError(_0x2b7cb1,null));};exports[_0x0f6b('0x27')]=function(_0x52e1b2,_0x2af630){return db[_0x0f6b('0x2f')][_0x0f6b('0x49')]({'where':{'id':_0x52e1b2[_0x0f6b('0x45')]['id']}})[_0x0f6b('0x26')](handleEntityNotFound(_0x2af630,null))['then'](removeEntity(_0x2af630,null))[_0x0f6b('0x44')](handleError(_0x2af630,null));};exports[_0x0f6b('0x4c')]=function(_0x4b85b3,_0x4932fb,_0x1aaf3c){var _0x4460d6={};var _0x25fccb={};var _0x5c3fb0;var _0x2021d8;return db[_0x0f6b('0x2f')][_0x0f6b('0x4d')]({'where':{'id':_0x4b85b3[_0x0f6b('0x45')]['id']}})[_0x0f6b('0x26')](handleEntityNotFound(_0x4932fb,null))[_0x0f6b('0x26')](function(_0x483555){if(_0x483555){_0x5c3fb0=_0x483555;_0x25fccb[_0x0f6b('0x33')]=_['keys'](db['ZendeskField'][_0x0f6b('0x30')]);_0x25fccb['query']=_[_0x0f6b('0x46')](_0x4b85b3[_0x0f6b('0x34')]);_0x25fccb[_0x0f6b('0x35')]=_[_0x0f6b('0x47')](_0x25fccb[_0x0f6b('0x33')],_0x25fccb[_0x0f6b('0x34')]);_0x4460d6[_0x0f6b('0x36')]=_[_0x0f6b('0x47')](_0x25fccb[_0x0f6b('0x33')],qs[_0x0f6b('0x37')](_0x4b85b3[_0x0f6b('0x34')][_0x0f6b('0x37')]));_0x4460d6[_0x0f6b('0x36')]=_0x4460d6[_0x0f6b('0x36')][_0x0f6b('0x4e')]?_0x4460d6[_0x0f6b('0x36')]:_0x25fccb[_0x0f6b('0x33')];_0x4460d6[_0x0f6b('0x4f')]=qs['sort'](_0x4b85b3[_0x0f6b('0x34')]['sort']);_0x4460d6[_0x0f6b('0x3b')]=qs[_0x0f6b('0x35')](_[_0x0f6b('0x50')](_0x4b85b3[_0x0f6b('0x34')],_0x25fccb['filters']));if(_0x4b85b3[_0x0f6b('0x34')][_0x0f6b('0x3c')]){_0x4460d6[_0x0f6b('0x3b')]=_[_0x0f6b('0x3d')](_0x4460d6[_0x0f6b('0x3b')],{'$or':_['map'](_0x4460d6['attributes'],function(_0x235483){var _0x230b52={};_0x230b52[_0x235483]={'$like':'%'+_0x4b85b3[_0x0f6b('0x34')]['filter']+'%'};return _0x230b52;})});}_0x4460d6=_[_0x0f6b('0x3d')]({},_0x4460d6,_0x4b85b3[_0x0f6b('0x48')]);return _0x5c3fb0['getFields'](_0x4460d6);}})[_0x0f6b('0x26')](function(_0xd4799){if(_0xd4799){_0x2021d8=_0xd4799[_0x0f6b('0x4e')];if(!_0x4b85b3[_0x0f6b('0x34')]['hasOwnProperty']('nolimit')){_0x4460d6[_0x0f6b('0x1e')]=qs[_0x0f6b('0x1e')](_0x4b85b3[_0x0f6b('0x34')]['limit']);_0x4460d6[_0x0f6b('0x1d')]=qs[_0x0f6b('0x1d')](_0x4b85b3[_0x0f6b('0x34')][_0x0f6b('0x1d')]);}return _0x5c3fb0[_0x0f6b('0x4c')](_0x4460d6);}})[_0x0f6b('0x26')](function(_0x5429cc){if(_0x5429cc){return _0x5429cc?{'count':_0x2021d8,'rows':_0x5429cc}:null;}})['then'](respondWithResult(_0x4932fb,null))[_0x0f6b('0x44')](handleError(_0x4932fb,null));};exports[_0x0f6b('0x51')]=function(_0x13192a,_0x48308c,_0x5dba47){var _0x2edf51={};var _0x29c67a={};var _0x1b0c50;var _0x5aa6fc;return db['ZendeskConfiguration'][_0x0f6b('0x4d')]({'where':{'id':_0x13192a[_0x0f6b('0x45')]['id']}})[_0x0f6b('0x26')](handleEntityNotFound(_0x48308c,null))[_0x0f6b('0x26')](function(_0x234244){if(_0x234244){_0x1b0c50=_0x234244;_0x29c67a[_0x0f6b('0x33')]=_['keys'](db['ZendeskField'][_0x0f6b('0x30')]);_0x29c67a[_0x0f6b('0x34')]=_['keys'](_0x13192a[_0x0f6b('0x34')]);_0x29c67a[_0x0f6b('0x35')]=_['intersection'](_0x29c67a[_0x0f6b('0x33')],_0x29c67a[_0x0f6b('0x34')]);_0x2edf51[_0x0f6b('0x36')]=_[_0x0f6b('0x47')](_0x29c67a[_0x0f6b('0x33')],qs[_0x0f6b('0x37')](_0x13192a['query'][_0x0f6b('0x37')]));_0x2edf51[_0x0f6b('0x36')]=_0x2edf51[_0x0f6b('0x36')][_0x0f6b('0x4e')]?_0x2edf51[_0x0f6b('0x36')]:_0x29c67a[_0x0f6b('0x33')];_0x2edf51[_0x0f6b('0x4f')]=qs[_0x0f6b('0x3a')](_0x13192a[_0x0f6b('0x34')][_0x0f6b('0x3a')]);_0x2edf51[_0x0f6b('0x3b')]=qs[_0x0f6b('0x35')](_[_0x0f6b('0x50')](_0x13192a[_0x0f6b('0x34')],_0x29c67a[_0x0f6b('0x35')]));if(_0x13192a['query'][_0x0f6b('0x3c')]){_0x2edf51[_0x0f6b('0x3b')]=_['merge'](_0x2edf51[_0x0f6b('0x3b')],{'$or':_[_0x0f6b('0x2e')](_0x2edf51['attributes'],function(_0x55e5e6){var _0x54bb05={};_0x54bb05[_0x55e5e6]={'$like':'%'+_0x13192a[_0x0f6b('0x34')]['filter']+'%'};return _0x54bb05;})});}_0x2edf51=_[_0x0f6b('0x3d')]({},_0x2edf51,_0x13192a['options']);return _0x1b0c50[_0x0f6b('0x51')](_0x2edf51);}})['then'](function(_0x2d19e6){if(_0x2d19e6){_0x5aa6fc=_0x2d19e6[_0x0f6b('0x4e')];if(!_0x13192a[_0x0f6b('0x34')][_0x0f6b('0x38')](_0x0f6b('0x39'))){_0x2edf51[_0x0f6b('0x1e')]=qs[_0x0f6b('0x1e')](_0x13192a['query'][_0x0f6b('0x1e')]);_0x2edf51[_0x0f6b('0x1d')]=qs[_0x0f6b('0x1d')](_0x13192a[_0x0f6b('0x34')][_0x0f6b('0x1d')]);}return _0x1b0c50[_0x0f6b('0x51')](_0x2edf51);}})[_0x0f6b('0x26')](function(_0x556ff4){if(_0x556ff4){return _0x556ff4?{'count':_0x5aa6fc,'rows':_0x556ff4}:null;}})[_0x0f6b('0x26')](respondWithResult(_0x48308c,null))[_0x0f6b('0x44')](handleError(_0x48308c,null));};exports[_0x0f6b('0x52')]=function(_0x4c6e1c,_0x1e8c64,_0x115f0d){var _0x3496ea={};var _0x10c88c={};var _0x402de7;var _0x8f8c3b;return db[_0x0f6b('0x2f')][_0x0f6b('0x4d')]({'where':{'id':_0x4c6e1c['params']['id']}})['then'](handleEntityNotFound(_0x1e8c64,null))[_0x0f6b('0x26')](function(_0x55a755){if(_0x55a755){_0x402de7=_0x55a755;_0x10c88c[_0x0f6b('0x33')]=_[_0x0f6b('0x46')](db[_0x0f6b('0x53')][_0x0f6b('0x30')]);_0x10c88c['query']=_[_0x0f6b('0x46')](_0x4c6e1c[_0x0f6b('0x34')]);_0x10c88c[_0x0f6b('0x35')]=_['intersection'](_0x10c88c[_0x0f6b('0x33')],_0x10c88c[_0x0f6b('0x34')]);_0x3496ea['attributes']=_[_0x0f6b('0x47')](_0x10c88c['model'],qs['fields'](_0x4c6e1c[_0x0f6b('0x34')][_0x0f6b('0x37')]));_0x3496ea['attributes']=_0x3496ea[_0x0f6b('0x36')][_0x0f6b('0x4e')]?_0x3496ea['attributes']:_0x10c88c[_0x0f6b('0x33')];_0x3496ea[_0x0f6b('0x4f')]=qs[_0x0f6b('0x3a')](_0x4c6e1c['query']['sort']);_0x3496ea[_0x0f6b('0x3b')]=qs[_0x0f6b('0x35')](_[_0x0f6b('0x50')](_0x4c6e1c[_0x0f6b('0x34')],_0x10c88c[_0x0f6b('0x35')]));if(_0x4c6e1c[_0x0f6b('0x34')][_0x0f6b('0x3c')]){_0x3496ea[_0x0f6b('0x3b')]=_[_0x0f6b('0x3d')](_0x3496ea['where'],{'$or':_[_0x0f6b('0x2e')](_0x3496ea[_0x0f6b('0x36')],function(_0xb9212c){var _0x162c78={};_0x162c78[_0xb9212c]={'$like':'%'+_0x4c6e1c[_0x0f6b('0x34')][_0x0f6b('0x3c')]+'%'};return _0x162c78;})});}_0x3496ea=_[_0x0f6b('0x3d')]({},_0x3496ea,_0x4c6e1c['options']);return _0x402de7[_0x0f6b('0x52')](_0x3496ea);}})[_0x0f6b('0x26')](function(_0x1d342d){if(_0x1d342d){_0x8f8c3b=_0x1d342d[_0x0f6b('0x4e')];if(!_0x4c6e1c[_0x0f6b('0x34')][_0x0f6b('0x38')](_0x0f6b('0x39'))){_0x3496ea[_0x0f6b('0x1e')]=qs[_0x0f6b('0x1e')](_0x4c6e1c[_0x0f6b('0x34')][_0x0f6b('0x1e')]);_0x3496ea[_0x0f6b('0x1d')]=qs[_0x0f6b('0x1d')](_0x4c6e1c[_0x0f6b('0x34')]['offset']);}return _0x402de7[_0x0f6b('0x52')](_0x3496ea);}})[_0x0f6b('0x26')](function(_0x4b6296){if(_0x4b6296){return _0x4b6296?{'count':_0x8f8c3b,'rows':_0x4b6296}:null;}})[_0x0f6b('0x26')](respondWithResult(_0x1e8c64,null))[_0x0f6b('0x44')](handleError(_0x1e8c64,null));};exports[_0x0f6b('0x54')]=function(_0x23e871,_0x20ea69,_0x47720e){var _0x58c393={};var _0x68427b={};var _0x577254;var _0x508282;return db[_0x0f6b('0x2f')][_0x0f6b('0x4d')]({'where':{'id':_0x23e871[_0x0f6b('0x45')]['id']}})[_0x0f6b('0x26')](handleEntityNotFound(_0x20ea69,null))['then'](function(_0x49b7ea){if(_0x49b7ea){_0x577254=_0x49b7ea;_0x68427b[_0x0f6b('0x33')]=_[_0x0f6b('0x46')](db[_0x0f6b('0x55')][_0x0f6b('0x30')]);_0x68427b[_0x0f6b('0x34')]=_[_0x0f6b('0x46')](_0x23e871['query']);_0x68427b[_0x0f6b('0x35')]=_[_0x0f6b('0x47')](_0x68427b[_0x0f6b('0x33')],_0x68427b[_0x0f6b('0x34')]);_0x58c393[_0x0f6b('0x36')]=_['intersection'](_0x68427b[_0x0f6b('0x33')],qs[_0x0f6b('0x37')](_0x23e871[_0x0f6b('0x34')][_0x0f6b('0x37')]));_0x58c393['attributes']=_0x58c393[_0x0f6b('0x36')][_0x0f6b('0x4e')]?_0x58c393[_0x0f6b('0x36')]:_0x68427b[_0x0f6b('0x33')];_0x58c393['order']=qs[_0x0f6b('0x3a')](_0x23e871[_0x0f6b('0x34')][_0x0f6b('0x3a')]);_0x58c393['where']=qs['filters'](_[_0x0f6b('0x50')](_0x23e871[_0x0f6b('0x34')],_0x68427b[_0x0f6b('0x35')]));if(_0x23e871[_0x0f6b('0x34')][_0x0f6b('0x3c')]){_0x58c393[_0x0f6b('0x3b')]=_[_0x0f6b('0x3d')](_0x58c393[_0x0f6b('0x3b')],{'$or':_[_0x0f6b('0x2e')](_0x58c393[_0x0f6b('0x36')],function(_0x2815b8){var _0x362efc={};_0x362efc[_0x2815b8]={'$like':'%'+_0x23e871[_0x0f6b('0x34')][_0x0f6b('0x3c')]+'%'};return _0x362efc;})});}_0x58c393=_[_0x0f6b('0x3d')]({},_0x58c393,_0x23e871['options']);return _0x577254[_0x0f6b('0x54')](_0x58c393);}})[_0x0f6b('0x26')](function(_0x212548){if(_0x212548){_0x508282=_0x212548[_0x0f6b('0x4e')];if(!_0x23e871['query']['hasOwnProperty']('nolimit')){_0x58c393['limit']=qs[_0x0f6b('0x1e')](_0x23e871['query'][_0x0f6b('0x1e')]);_0x58c393[_0x0f6b('0x1d')]=qs[_0x0f6b('0x1d')](_0x23e871['query']['offset']);}return _0x577254[_0x0f6b('0x54')](_0x58c393);}})[_0x0f6b('0x26')](function(_0x5a51a3){if(_0x5a51a3){return _0x5a51a3?{'count':_0x508282,'rows':_0x5a51a3}:null;}})[_0x0f6b('0x26')](respondWithResult(_0x20ea69,null))[_0x0f6b('0x44')](handleError(_0x20ea69,null));};exports[_0x0f6b('0x56')]=function(_0x18d952,_0x335246,_0x53ae62){if(_0x18d952[_0x0f6b('0x4b')]['id']){delete _0x18d952[_0x0f6b('0x4b')]['id'];}return db[_0x0f6b('0x2f')]['findOne']({'where':{'id':_0x18d952[_0x0f6b('0x45')]['id']}})['then'](handleEntityNotFound(_0x335246,null))[_0x0f6b('0x26')](function(_0x194448){if(_0x194448){return _0x194448['setTags'](_0x18d952['body'][_0x0f6b('0x57')]||[]);}return null;})[_0x0f6b('0x26')](respondWithResult(_0x335246,null))[_0x0f6b('0x44')](handleError(_0x335246,null));}; \ No newline at end of file +var _0xff86=['stack','name','send','index','map','ZendeskConfiguration','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','fields','include','merge','find','create','body','ZendeskField','order','pick','getFields','findOne','getSubjects','getDescriptions','getTags','Tag','setTags','eml-format','fast-json-patch','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','sendStatus'];(function(_0x5dff0c,_0x2bdeb4){var _0x15615f=function(_0x22956e){while(--_0x22956e){_0x5dff0c['push'](_0x5dff0c['shift']());}};_0x15615f(++_0x2bdeb4);}(_0xff86,0x129));var _0x6ff8=function(_0x16b606,_0x49f3ab){_0x16b606=_0x16b606-0x0;var _0xbd122c=_0xff86[_0x16b606];return _0xbd122c;};'use strict';var emlformat=require(_0x6ff8('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6ff8('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6ff8('0x2'));var Mustache=require(_0x6ff8('0x3'));var util=require(_0x6ff8('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x6ff8('0x5'));var ejs=require(_0x6ff8('0x6'));var fs=require('fs');var fs_extra=require(_0x6ff8('0x7'));var _=require(_0x6ff8('0x8'));var squel=require(_0x6ff8('0x9'));var crypto=require(_0x6ff8('0xa'));var jsforce=require(_0x6ff8('0xb'));var deskjs=require(_0x6ff8('0xc'));var toCsv=require(_0x6ff8('0x5'));var querystring=require(_0x6ff8('0xd'));var Papa=require(_0x6ff8('0xe'));var Redis=require(_0x6ff8('0xf'));var authService=require(_0x6ff8('0x10'));var qs=require(_0x6ff8('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6ff8('0x12'));var logger=require('../../config/logger')(_0x6ff8('0x13'));var utils=require(_0x6ff8('0x14'));var config=require(_0x6ff8('0x15'));var licenseUtil=require(_0x6ff8('0x16'));var db=require(_0x6ff8('0x17'))['db'];function respondWithStatusCode(_0x303cc8,_0x5191b7){_0x5191b7=_0x5191b7||0xcc;return function(_0x304495){if(_0x304495){return _0x303cc8['sendStatus'](_0x5191b7);}return _0x303cc8[_0x6ff8('0x18')](_0x5191b7)[_0x6ff8('0x19')]();};}function respondWithResult(_0xf4afa3,_0x42da82){_0x42da82=_0x42da82||0xc8;return function(_0x4b2a99){if(_0x4b2a99){return _0xf4afa3[_0x6ff8('0x18')](_0x42da82)[_0x6ff8('0x1a')](_0x4b2a99);}};}function respondWithFilteredResult(_0x4b1c68,_0x13ed0c){return function(_0x331456){if(_0x331456){var _0x3bfc39=typeof _0x13ed0c[_0x6ff8('0x1b')]===_0x6ff8('0x1c')&&typeof _0x13ed0c['limit']===_0x6ff8('0x1c');var _0xb5c285=_0x331456[_0x6ff8('0x1d')];var _0x58b05e=_0x3bfc39?0x0:_0x13ed0c[_0x6ff8('0x1b')];var _0x337333=_0x3bfc39?_0x331456[_0x6ff8('0x1d')]:_0x13ed0c[_0x6ff8('0x1b')]+_0x13ed0c[_0x6ff8('0x1e')];var _0x6cb150;if(_0x337333>=_0xb5c285){_0x337333=_0xb5c285;_0x6cb150=0xc8;}else{_0x6cb150=0xce;}_0x4b1c68[_0x6ff8('0x18')](_0x6cb150);return _0x4b1c68[_0x6ff8('0x1f')](_0x6ff8('0x20'),_0x58b05e+'-'+_0x337333+'/'+_0xb5c285)['json'](_0x331456);}return null;};}function patchUpdates(_0x3ce5ab){return function(_0x38f58c){try{jsonpatch['apply'](_0x38f58c,_0x3ce5ab,!![]);}catch(_0x48323d){return BPromise[_0x6ff8('0x21')](_0x48323d);}return _0x38f58c[_0x6ff8('0x22')]();};}function saveUpdates(_0x53ffe7,_0x10c0a4){return function(_0xbcd13e){if(_0xbcd13e){return _0xbcd13e[_0x6ff8('0x23')](_0x53ffe7)[_0x6ff8('0x24')](function(_0x359b63){return _0x359b63;});}return null;};}function removeEntity(_0x3dd12f,_0x572e4e){return function(_0x5e366a){if(_0x5e366a){return _0x5e366a[_0x6ff8('0x25')]()['then'](function(){_0x3dd12f[_0x6ff8('0x18')](0xcc)[_0x6ff8('0x19')]();});}};}function handleEntityNotFound(_0x20163c,_0x48c336){return function(_0x31dbd0){if(!_0x31dbd0){_0x20163c[_0x6ff8('0x26')](0x194);}return _0x31dbd0;};}function handleError(_0x168279,_0x10a468){_0x10a468=_0x10a468||0x1f4;return function(_0xea1003){logger['error'](_0xea1003[_0x6ff8('0x27')]);if(_0xea1003[_0x6ff8('0x28')]){delete _0xea1003[_0x6ff8('0x28')];}_0x168279['status'](_0x10a468)[_0x6ff8('0x29')](_0xea1003);};}exports[_0x6ff8('0x2a')]=function(_0x84d93,_0x28fb94){var _0xf8f9c5={},_0xe9163={},_0x3057d8={'count':0x0,'rows':[]};var _0x3fdfdc=_[_0x6ff8('0x2b')](db[_0x6ff8('0x2c')][_0x6ff8('0x2d')],function(_0x19315e){return{'name':_0x19315e['fieldName'],'type':_0x19315e[_0x6ff8('0x2e')][_0x6ff8('0x2f')]};});_0xe9163[_0x6ff8('0x30')]=_[_0x6ff8('0x2b')](_0x3fdfdc,_0x6ff8('0x28'));_0xe9163['query']=_[_0x6ff8('0x31')](_0x84d93[_0x6ff8('0x32')]);_0xe9163[_0x6ff8('0x33')]=_[_0x6ff8('0x34')](_0xe9163['model'],_0xe9163[_0x6ff8('0x32')]);_0xf8f9c5[_0x6ff8('0x35')]=_[_0x6ff8('0x34')](_0xe9163[_0x6ff8('0x30')],qs['fields'](_0x84d93[_0x6ff8('0x32')]['fields']));_0xf8f9c5['attributes']=_0xf8f9c5['attributes'][_0x6ff8('0x36')]?_0xf8f9c5[_0x6ff8('0x35')]:_0xe9163[_0x6ff8('0x30')];if(!_0x84d93[_0x6ff8('0x32')][_0x6ff8('0x37')](_0x6ff8('0x38'))){_0xf8f9c5[_0x6ff8('0x1e')]=qs['limit'](_0x84d93[_0x6ff8('0x32')]['limit']);_0xf8f9c5[_0x6ff8('0x1b')]=qs[_0x6ff8('0x1b')](_0x84d93[_0x6ff8('0x32')]['offset']);}_0xf8f9c5['order']=qs[_0x6ff8('0x39')](_0x84d93[_0x6ff8('0x32')]['sort']);_0xf8f9c5[_0x6ff8('0x3a')]=qs[_0x6ff8('0x33')](_['pick'](_0x84d93[_0x6ff8('0x32')],_0xe9163['filters']),_0x3fdfdc);if(_0x84d93[_0x6ff8('0x32')][_0x6ff8('0x3b')]){_0xf8f9c5[_0x6ff8('0x3a')]=_['merge'](_0xf8f9c5['where'],{'$or':_[_0x6ff8('0x2b')](_0x3fdfdc,function(_0x34541f){if(_0x34541f[_0x6ff8('0x2e')]!==_0x6ff8('0x3c')){var _0x5ac535={};_0x5ac535[_0x34541f[_0x6ff8('0x28')]]={'$like':'%'+_0x84d93[_0x6ff8('0x32')]['filter']+'%'};return _0x5ac535;}})});}_0xf8f9c5=_['merge']({},_0xf8f9c5,_0x84d93[_0x6ff8('0x3d')]);var _0x19144e={'where':_0xf8f9c5[_0x6ff8('0x3a')]};return db[_0x6ff8('0x2c')][_0x6ff8('0x1d')](_0x19144e)['then'](function(_0x3cb535){_0x3057d8[_0x6ff8('0x1d')]=_0x3cb535;if(_0x84d93[_0x6ff8('0x32')][_0x6ff8('0x3e')]){_0xf8f9c5['include']=[{'all':!![]}];}return db[_0x6ff8('0x2c')][_0x6ff8('0x3f')](_0xf8f9c5);})[_0x6ff8('0x24')](function(_0x476390){_0x3057d8[_0x6ff8('0x40')]=_0x476390;return _0x3057d8;})['then'](respondWithFilteredResult(_0x28fb94,_0xf8f9c5))[_0x6ff8('0x41')](handleError(_0x28fb94,null));};exports[_0x6ff8('0x42')]=function(_0x41c8ad,_0x26badd){var _0x57767b={'raw':![],'where':{'id':_0x41c8ad[_0x6ff8('0x43')]['id']}},_0x4f2208={};_0x4f2208[_0x6ff8('0x30')]=_[_0x6ff8('0x31')](db[_0x6ff8('0x2c')][_0x6ff8('0x2d')]);_0x4f2208[_0x6ff8('0x32')]=_[_0x6ff8('0x31')](_0x41c8ad[_0x6ff8('0x32')]);_0x4f2208[_0x6ff8('0x33')]=_[_0x6ff8('0x34')](_0x4f2208[_0x6ff8('0x30')],_0x4f2208[_0x6ff8('0x32')]);_0x57767b[_0x6ff8('0x35')]=_['intersection'](_0x4f2208[_0x6ff8('0x30')],qs[_0x6ff8('0x44')](_0x41c8ad[_0x6ff8('0x32')][_0x6ff8('0x44')]));_0x57767b[_0x6ff8('0x35')]=_0x57767b[_0x6ff8('0x35')][_0x6ff8('0x36')]?_0x57767b[_0x6ff8('0x35')]:_0x4f2208[_0x6ff8('0x30')];if(_0x41c8ad[_0x6ff8('0x32')][_0x6ff8('0x3e')]){_0x57767b[_0x6ff8('0x45')]=[{'all':!![]}];}_0x57767b=_[_0x6ff8('0x46')]({},_0x57767b,_0x41c8ad[_0x6ff8('0x3d')]);return db[_0x6ff8('0x2c')][_0x6ff8('0x47')](_0x57767b)[_0x6ff8('0x24')](handleEntityNotFound(_0x26badd,null))['then'](respondWithResult(_0x26badd,null))[_0x6ff8('0x41')](handleError(_0x26badd,null));};exports[_0x6ff8('0x48')]=function(_0xbf46c4,_0x5be820){return db['ZendeskConfiguration'][_0x6ff8('0x48')](_0xbf46c4[_0x6ff8('0x49')],{})[_0x6ff8('0x24')](respondWithResult(_0x5be820,0xc9))[_0x6ff8('0x41')](handleError(_0x5be820,null));};exports[_0x6ff8('0x23')]=function(_0x6b89be,_0x30969b){if(_0x6b89be[_0x6ff8('0x49')]['id']){delete _0x6b89be['body']['id'];}return db['ZendeskConfiguration'][_0x6ff8('0x47')]({'where':{'id':_0x6b89be[_0x6ff8('0x43')]['id']}})[_0x6ff8('0x24')](handleEntityNotFound(_0x30969b,null))[_0x6ff8('0x24')](saveUpdates(_0x6b89be['body'],null))['then'](respondWithResult(_0x30969b,null))['catch'](handleError(_0x30969b,null));};exports['destroy']=function(_0x1dada7,_0x5158c5){return db[_0x6ff8('0x2c')]['find']({'where':{'id':_0x1dada7[_0x6ff8('0x43')]['id']}})[_0x6ff8('0x24')](handleEntityNotFound(_0x5158c5,null))['then'](removeEntity(_0x5158c5,null))[_0x6ff8('0x41')](handleError(_0x5158c5,null));};exports['getFields']=function(_0x4980fc,_0x55d229,_0x555347){var _0x13a9af={};var _0x2c3c84={};var _0x5ec69d;var _0x13b9eb;return db[_0x6ff8('0x2c')]['findOne']({'where':{'id':_0x4980fc[_0x6ff8('0x43')]['id']}})[_0x6ff8('0x24')](handleEntityNotFound(_0x55d229,null))[_0x6ff8('0x24')](function(_0x534f5c){if(_0x534f5c){_0x5ec69d=_0x534f5c;_0x2c3c84['model']=_[_0x6ff8('0x31')](db[_0x6ff8('0x4a')][_0x6ff8('0x2d')]);_0x2c3c84[_0x6ff8('0x32')]=_['keys'](_0x4980fc['query']);_0x2c3c84[_0x6ff8('0x33')]=_[_0x6ff8('0x34')](_0x2c3c84['model'],_0x2c3c84[_0x6ff8('0x32')]);_0x13a9af[_0x6ff8('0x35')]=_[_0x6ff8('0x34')](_0x2c3c84[_0x6ff8('0x30')],qs[_0x6ff8('0x44')](_0x4980fc[_0x6ff8('0x32')]['fields']));_0x13a9af[_0x6ff8('0x35')]=_0x13a9af['attributes']['length']?_0x13a9af['attributes']:_0x2c3c84['model'];_0x13a9af[_0x6ff8('0x4b')]=qs[_0x6ff8('0x39')](_0x4980fc['query'][_0x6ff8('0x39')]);_0x13a9af[_0x6ff8('0x3a')]=qs[_0x6ff8('0x33')](_[_0x6ff8('0x4c')](_0x4980fc[_0x6ff8('0x32')],_0x2c3c84[_0x6ff8('0x33')]));if(_0x4980fc[_0x6ff8('0x32')]['filter']){_0x13a9af[_0x6ff8('0x3a')]=_['merge'](_0x13a9af['where'],{'$or':_['map'](_0x13a9af[_0x6ff8('0x35')],function(_0x50d735){var _0x3829cd={};_0x3829cd[_0x50d735]={'$like':'%'+_0x4980fc['query']['filter']+'%'};return _0x3829cd;})});}_0x13a9af=_[_0x6ff8('0x46')]({},_0x13a9af,_0x4980fc['options']);return _0x5ec69d[_0x6ff8('0x4d')](_0x13a9af);}})[_0x6ff8('0x24')](function(_0x51ae7c){if(_0x51ae7c){_0x13b9eb=_0x51ae7c['length'];if(!_0x4980fc[_0x6ff8('0x32')][_0x6ff8('0x37')](_0x6ff8('0x38'))){_0x13a9af[_0x6ff8('0x1e')]=qs[_0x6ff8('0x1e')](_0x4980fc[_0x6ff8('0x32')][_0x6ff8('0x1e')]);_0x13a9af[_0x6ff8('0x1b')]=qs['offset'](_0x4980fc['query'][_0x6ff8('0x1b')]);}return _0x5ec69d['getFields'](_0x13a9af);}})['then'](function(_0x39f170){if(_0x39f170){return _0x39f170?{'count':_0x13b9eb,'rows':_0x39f170}:null;}})[_0x6ff8('0x24')](respondWithResult(_0x55d229,null))['catch'](handleError(_0x55d229,null));};exports['getSubjects']=function(_0x2516b3,_0x3db2a8,_0x4679bf){var _0x22fc49={};var _0x12540e={};var _0x14c2f1;var _0x523c84;return db['ZendeskConfiguration'][_0x6ff8('0x4e')]({'where':{'id':_0x2516b3[_0x6ff8('0x43')]['id']}})[_0x6ff8('0x24')](handleEntityNotFound(_0x3db2a8,null))[_0x6ff8('0x24')](function(_0x106321){if(_0x106321){_0x14c2f1=_0x106321;_0x12540e[_0x6ff8('0x30')]=_[_0x6ff8('0x31')](db[_0x6ff8('0x4a')][_0x6ff8('0x2d')]);_0x12540e[_0x6ff8('0x32')]=_[_0x6ff8('0x31')](_0x2516b3[_0x6ff8('0x32')]);_0x12540e[_0x6ff8('0x33')]=_[_0x6ff8('0x34')](_0x12540e[_0x6ff8('0x30')],_0x12540e[_0x6ff8('0x32')]);_0x22fc49[_0x6ff8('0x35')]=_['intersection'](_0x12540e[_0x6ff8('0x30')],qs[_0x6ff8('0x44')](_0x2516b3[_0x6ff8('0x32')][_0x6ff8('0x44')]));_0x22fc49['attributes']=_0x22fc49[_0x6ff8('0x35')][_0x6ff8('0x36')]?_0x22fc49['attributes']:_0x12540e[_0x6ff8('0x30')];_0x22fc49[_0x6ff8('0x4b')]=qs[_0x6ff8('0x39')](_0x2516b3['query'][_0x6ff8('0x39')]);_0x22fc49['where']=qs[_0x6ff8('0x33')](_[_0x6ff8('0x4c')](_0x2516b3[_0x6ff8('0x32')],_0x12540e[_0x6ff8('0x33')]));if(_0x2516b3[_0x6ff8('0x32')][_0x6ff8('0x3b')]){_0x22fc49['where']=_[_0x6ff8('0x46')](_0x22fc49[_0x6ff8('0x3a')],{'$or':_['map'](_0x22fc49[_0x6ff8('0x35')],function(_0x40fb02){var _0x581090={};_0x581090[_0x40fb02]={'$like':'%'+_0x2516b3[_0x6ff8('0x32')]['filter']+'%'};return _0x581090;})});}_0x22fc49=_[_0x6ff8('0x46')]({},_0x22fc49,_0x2516b3[_0x6ff8('0x3d')]);return _0x14c2f1[_0x6ff8('0x4f')](_0x22fc49);}})[_0x6ff8('0x24')](function(_0x25c074){if(_0x25c074){_0x523c84=_0x25c074[_0x6ff8('0x36')];if(!_0x2516b3[_0x6ff8('0x32')][_0x6ff8('0x37')](_0x6ff8('0x38'))){_0x22fc49['limit']=qs[_0x6ff8('0x1e')](_0x2516b3[_0x6ff8('0x32')][_0x6ff8('0x1e')]);_0x22fc49[_0x6ff8('0x1b')]=qs[_0x6ff8('0x1b')](_0x2516b3[_0x6ff8('0x32')][_0x6ff8('0x1b')]);}return _0x14c2f1[_0x6ff8('0x4f')](_0x22fc49);}})[_0x6ff8('0x24')](function(_0x42008a){if(_0x42008a){return _0x42008a?{'count':_0x523c84,'rows':_0x42008a}:null;}})[_0x6ff8('0x24')](respondWithResult(_0x3db2a8,null))[_0x6ff8('0x41')](handleError(_0x3db2a8,null));};exports[_0x6ff8('0x50')]=function(_0x3ebf15,_0x21b45b,_0x13dda2){var _0x4677cc={};var _0x5cb687={};var _0x2857b8;var _0x129dc3;return db[_0x6ff8('0x2c')][_0x6ff8('0x4e')]({'where':{'id':_0x3ebf15[_0x6ff8('0x43')]['id']}})[_0x6ff8('0x24')](handleEntityNotFound(_0x21b45b,null))['then'](function(_0x4d56f7){if(_0x4d56f7){_0x2857b8=_0x4d56f7;_0x5cb687['model']=_[_0x6ff8('0x31')](db[_0x6ff8('0x4a')]['rawAttributes']);_0x5cb687[_0x6ff8('0x32')]=_['keys'](_0x3ebf15['query']);_0x5cb687[_0x6ff8('0x33')]=_[_0x6ff8('0x34')](_0x5cb687[_0x6ff8('0x30')],_0x5cb687['query']);_0x4677cc[_0x6ff8('0x35')]=_[_0x6ff8('0x34')](_0x5cb687[_0x6ff8('0x30')],qs[_0x6ff8('0x44')](_0x3ebf15[_0x6ff8('0x32')]['fields']));_0x4677cc[_0x6ff8('0x35')]=_0x4677cc[_0x6ff8('0x35')]['length']?_0x4677cc['attributes']:_0x5cb687[_0x6ff8('0x30')];_0x4677cc[_0x6ff8('0x4b')]=qs[_0x6ff8('0x39')](_0x3ebf15['query']['sort']);_0x4677cc[_0x6ff8('0x3a')]=qs[_0x6ff8('0x33')](_[_0x6ff8('0x4c')](_0x3ebf15[_0x6ff8('0x32')],_0x5cb687[_0x6ff8('0x33')]));if(_0x3ebf15[_0x6ff8('0x32')][_0x6ff8('0x3b')]){_0x4677cc[_0x6ff8('0x3a')]=_[_0x6ff8('0x46')](_0x4677cc[_0x6ff8('0x3a')],{'$or':_[_0x6ff8('0x2b')](_0x4677cc[_0x6ff8('0x35')],function(_0x4b47a5){var _0x4549c8={};_0x4549c8[_0x4b47a5]={'$like':'%'+_0x3ebf15[_0x6ff8('0x32')][_0x6ff8('0x3b')]+'%'};return _0x4549c8;})});}_0x4677cc=_['merge']({},_0x4677cc,_0x3ebf15[_0x6ff8('0x3d')]);return _0x2857b8['getDescriptions'](_0x4677cc);}})['then'](function(_0x437ba3){if(_0x437ba3){_0x129dc3=_0x437ba3[_0x6ff8('0x36')];if(!_0x3ebf15[_0x6ff8('0x32')][_0x6ff8('0x37')](_0x6ff8('0x38'))){_0x4677cc[_0x6ff8('0x1e')]=qs[_0x6ff8('0x1e')](_0x3ebf15[_0x6ff8('0x32')]['limit']);_0x4677cc[_0x6ff8('0x1b')]=qs[_0x6ff8('0x1b')](_0x3ebf15[_0x6ff8('0x32')]['offset']);}return _0x2857b8[_0x6ff8('0x50')](_0x4677cc);}})['then'](function(_0x796cc){if(_0x796cc){return _0x796cc?{'count':_0x129dc3,'rows':_0x796cc}:null;}})[_0x6ff8('0x24')](respondWithResult(_0x21b45b,null))['catch'](handleError(_0x21b45b,null));};exports[_0x6ff8('0x51')]=function(_0x457610,_0x14c1e3,_0x1cd55a){var _0x3db244={};var _0x4003a5={};var _0x2c46b5;var _0x3baae6;return db['ZendeskConfiguration'][_0x6ff8('0x4e')]({'where':{'id':_0x457610[_0x6ff8('0x43')]['id']}})[_0x6ff8('0x24')](handleEntityNotFound(_0x14c1e3,null))[_0x6ff8('0x24')](function(_0x179000){if(_0x179000){_0x2c46b5=_0x179000;_0x4003a5[_0x6ff8('0x30')]=_['keys'](db[_0x6ff8('0x52')][_0x6ff8('0x2d')]);_0x4003a5[_0x6ff8('0x32')]=_[_0x6ff8('0x31')](_0x457610[_0x6ff8('0x32')]);_0x4003a5[_0x6ff8('0x33')]=_[_0x6ff8('0x34')](_0x4003a5['model'],_0x4003a5['query']);_0x3db244['attributes']=_[_0x6ff8('0x34')](_0x4003a5[_0x6ff8('0x30')],qs[_0x6ff8('0x44')](_0x457610[_0x6ff8('0x32')][_0x6ff8('0x44')]));_0x3db244[_0x6ff8('0x35')]=_0x3db244[_0x6ff8('0x35')]['length']?_0x3db244[_0x6ff8('0x35')]:_0x4003a5[_0x6ff8('0x30')];_0x3db244['order']=qs['sort'](_0x457610['query'][_0x6ff8('0x39')]);_0x3db244[_0x6ff8('0x3a')]=qs[_0x6ff8('0x33')](_[_0x6ff8('0x4c')](_0x457610[_0x6ff8('0x32')],_0x4003a5['filters']));if(_0x457610['query'][_0x6ff8('0x3b')]){_0x3db244[_0x6ff8('0x3a')]=_[_0x6ff8('0x46')](_0x3db244['where'],{'$or':_[_0x6ff8('0x2b')](_0x3db244[_0x6ff8('0x35')],function(_0x3e568f){var _0x30f6b1={};_0x30f6b1[_0x3e568f]={'$like':'%'+_0x457610[_0x6ff8('0x32')][_0x6ff8('0x3b')]+'%'};return _0x30f6b1;})});}_0x3db244=_['merge']({},_0x3db244,_0x457610[_0x6ff8('0x3d')]);return _0x2c46b5[_0x6ff8('0x51')](_0x3db244);}})[_0x6ff8('0x24')](function(_0x2ec373){if(_0x2ec373){_0x3baae6=_0x2ec373['length'];if(!_0x457610['query'][_0x6ff8('0x37')](_0x6ff8('0x38'))){_0x3db244[_0x6ff8('0x1e')]=qs[_0x6ff8('0x1e')](_0x457610[_0x6ff8('0x32')][_0x6ff8('0x1e')]);_0x3db244[_0x6ff8('0x1b')]=qs[_0x6ff8('0x1b')](_0x457610[_0x6ff8('0x32')][_0x6ff8('0x1b')]);}return _0x2c46b5['getTags'](_0x3db244);}})[_0x6ff8('0x24')](function(_0x406a6f){if(_0x406a6f){return _0x406a6f?{'count':_0x3baae6,'rows':_0x406a6f}:null;}})['then'](respondWithResult(_0x14c1e3,null))[_0x6ff8('0x41')](handleError(_0x14c1e3,null));};exports[_0x6ff8('0x53')]=function(_0x4f32e3,_0x3ca94d,_0x1e5b10){if(_0x4f32e3[_0x6ff8('0x49')]['id']){delete _0x4f32e3[_0x6ff8('0x49')]['id'];}return db[_0x6ff8('0x2c')][_0x6ff8('0x4e')]({'where':{'id':_0x4f32e3[_0x6ff8('0x43')]['id']}})[_0x6ff8('0x24')](handleEntityNotFound(_0x3ca94d,null))[_0x6ff8('0x24')](function(_0x5a596f){if(_0x5a596f){return _0x5a596f[_0x6ff8('0x53')](_0x4f32e3[_0x6ff8('0x49')]['ids']||[]);}return null;})[_0x6ff8('0x24')](respondWithResult(_0x3ca94d,null))['catch'](handleError(_0x3ca94d,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 4cfa812..f548f5d 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 _0xd4a2=['ZendeskConfiguration','int_zendesk_configurations','lodash','api','bluebird','path','../../config/environment','./intZendeskConfiguration.attributes','exports'];(function(_0x41e33c,_0x55a09c){var _0x345df8=function(_0x1ae281){while(--_0x1ae281){_0x41e33c['push'](_0x41e33c['shift']());}};_0x345df8(++_0x55a09c);}(_0xd4a2,0x173));var _0x2d4a=function(_0x36f559,_0x348478){_0x36f559=_0x36f559-0x0;var _0x553a78=_0xd4a2[_0x36f559];return _0x553a78;};'use strict';var _=require(_0x2d4a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2d4a('0x1'));var moment=require('moment');var BPromise=require(_0x2d4a('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2d4a('0x3'));var rimraf=require('rimraf');var config=require(_0x2d4a('0x4'));var attributes=require(_0x2d4a('0x5'));module[_0x2d4a('0x6')]=function(_0x3a88e2,_0x1ca10b){return _0x3a88e2['define'](_0x2d4a('0x7'),attributes,{'tableName':_0x2d4a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x065e=['moment','bluebird','request-promise','../../config/environment','./intZendeskConfiguration.attributes','define','int_zendesk_configurations','lodash'];(function(_0x213272,_0x1d9d54){var _0x2bf912=function(_0x4c4702){while(--_0x4c4702){_0x213272['push'](_0x213272['shift']());}};_0x2bf912(++_0x1d9d54);}(_0x065e,0x1a7));var _0xe065=function(_0x64c090,_0x1524c3){_0x64c090=_0x64c090-0x0;var _0x262224=_0x065e[_0x64c090];return _0x262224;};'use strict';var _=require(_0xe065('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xe065('0x1'));var BPromise=require(_0xe065('0x2'));var rp=require(_0xe065('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe065('0x4'));var attributes=require(_0xe065('0x5'));module['exports']=function(_0x10b45f,_0x1e7e69){return _0x10b45f[_0xe065('0x6')]('ZendeskConfiguration',attributes,{'tableName':_0xe065('0x7'),'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 6f7f1e8..3d459b8 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 _0x2d2f=['catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ZendeskConfiguration,\x20%s,\x20%s','message','result'];(function(_0x3b21f7,_0x278ae8){var _0x39b0da=function(_0x206036){while(--_0x206036){_0x3b21f7['push'](_0x3b21f7['shift']());}};_0x39b0da(++_0x278ae8);}(_0x2d2f,0x139));var _0xf2d2=function(_0x5966dc,_0x30e203){_0x5966dc=_0x5966dc-0x0;var _0x20d1c2=_0x2d2f[_0x5966dc];return _0x20d1c2;};'use strict';var _=require(_0xf2d2('0x0'));var util=require(_0xf2d2('0x1'));var moment=require('moment');var BPromise=require(_0xf2d2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf2d2('0x3'));var db=require(_0xf2d2('0x4'))['db'];var utils=require(_0xf2d2('0x5'));var logger=require(_0xf2d2('0x6'))(_0xf2d2('0x7'));var config=require(_0xf2d2('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf2d2('0x9')][_0xf2d2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4ae3be,_0x399681,_0x202437){return new BPromise(function(_0x47c0c7,_0x81eec5){return client[_0xf2d2('0xb')](_0x4ae3be,_0x202437)[_0xf2d2('0xc')](function(_0x425922){logger[_0xf2d2('0xd')]('ZendeskConfiguration,\x20%s,\x20%s',_0x399681,_0xf2d2('0xe'));logger[_0xf2d2('0xf')](_0xf2d2('0x10'),_0x399681,_0xf2d2('0xe'),JSON[_0xf2d2('0x11')](_0x425922));if(_0x425922['error']){if(_0x425922[_0xf2d2('0x12')][_0xf2d2('0x13')]===0x1f4){logger['error'](_0xf2d2('0x14'),_0x399681,_0x425922[_0xf2d2('0x12')]['message']);return _0x81eec5(_0x425922['error'][_0xf2d2('0x15')]);}logger[_0xf2d2('0x12')](_0xf2d2('0x14'),_0x399681,_0x425922[_0xf2d2('0x12')][_0xf2d2('0x15')]);return _0x47c0c7(_0x425922[_0xf2d2('0x12')]['message']);}else{logger[_0xf2d2('0xd')](_0xf2d2('0x14'),_0x399681,'request\x20sent');_0x47c0c7(_0x425922[_0xf2d2('0x16')]['message']);}})[_0xf2d2('0x17')](function(_0x212517){logger[_0xf2d2('0x12')](_0xf2d2('0x14'),_0x399681,_0x212517);_0x81eec5(_0x212517);});});} \ No newline at end of file +var _0x90d4=['client','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','../../config/utils','rpc','jayson/promise'];(function(_0x4de849,_0x457c93){var _0x19b024=function(_0x1ec986){while(--_0x1ec986){_0x4de849['push'](_0x4de849['shift']());}};_0x19b024(++_0x457c93);}(_0x90d4,0x139));var _0x490d=function(_0x426dcd,_0x4e7dac){_0x426dcd=_0x426dcd-0x0;var _0x288595=_0x90d4[_0x426dcd];return _0x288595;};'use strict';var _=require(_0x490d('0x0'));var util=require(_0x490d('0x1'));var moment=require(_0x490d('0x2'));var BPromise=require(_0x490d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x490d('0x4'));var logger=require('../../config/logger')(_0x490d('0x5'));var config=require('../../config/environment');var jayson=require(_0x490d('0x6'));var client=jayson[_0x490d('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5226e0,_0x19f74c,_0x28a42f){return new BPromise(function(_0x94c2da,_0x5c5cf5){return client[_0x490d('0x8')](_0x5226e0,_0x28a42f)[_0x490d('0x9')](function(_0x22b51f){logger[_0x490d('0xa')](_0x490d('0xb'),_0x19f74c,_0x490d('0xc'));logger[_0x490d('0xd')](_0x490d('0xe'),_0x19f74c,_0x490d('0xc'),JSON[_0x490d('0xf')](_0x22b51f));if(_0x22b51f['error']){if(_0x22b51f[_0x490d('0x10')][_0x490d('0x11')]===0x1f4){logger['error'](_0x490d('0xb'),_0x19f74c,_0x22b51f['error'][_0x490d('0x12')]);return _0x5c5cf5(_0x22b51f['error'][_0x490d('0x12')]);}logger[_0x490d('0x10')](_0x490d('0xb'),_0x19f74c,_0x22b51f[_0x490d('0x10')]['message']);return _0x94c2da(_0x22b51f[_0x490d('0x10')][_0x490d('0x12')]);}else{logger['info'](_0x490d('0xb'),_0x19f74c,'request\x20sent');_0x94c2da(_0x22b51f['result'][_0x490d('0x12')]);}})[_0x490d('0x13')](function(_0x2eef5a){logger[_0x490d('0x10')]('ZendeskConfiguration,\x20%s,\x20%s',_0x19f74c,_0x2eef5a);_0x5c5cf5(_0x2eef5a);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 8f207e6..5206883 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 _0x74e2=['fs-extra','../../config/environment','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','multer','connect-timeout','express','Router'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x74e2,0x65));var _0x274e=function(_0x120bb9,_0x50cf04){_0x120bb9=_0x120bb9-0x0;var _0x5c37ef=_0x74e2[_0x120bb9];return _0x5c37ef;};'use strict';var multer=require(_0x274e('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x274e('0x1'));var express=require(_0x274e('0x2'));var router=express[_0x274e('0x3')]();var fs_extra=require(_0x274e('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x274e('0x5'));var controller=require('./intZendeskField.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x274e('0x6'),auth[_0x274e('0x7')](),controller[_0x274e('0x8')]);router[_0x274e('0x9')]('/',auth[_0x274e('0x7')](),controller[_0x274e('0xa')]);router[_0x274e('0xb')]('/:id',auth[_0x274e('0x7')](),controller[_0x274e('0xc')]);router[_0x274e('0xd')](_0x274e('0x6'),auth[_0x274e('0x7')](),controller[_0x274e('0xe')]);module['exports']=router; \ No newline at end of file +var _0x746c=['../../components/auth/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','index','/:id','show','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x4ddfe9,_0x11daa8){var _0xb09fb7=function(_0x78002){while(--_0x78002){_0x4ddfe9['push'](_0x4ddfe9['shift']());}};_0xb09fb7(++_0x11daa8);}(_0x746c,0x6c));var _0xc746=function(_0xb614e8,_0x302855){_0xb614e8=_0xb614e8-0x0;var _0x1b3bb1=_0x746c[_0xb614e8];return _0x1b3bb1;};'use strict';var multer=require(_0xc746('0x0'));var util=require(_0xc746('0x1'));var path=require('path');var timeout=require(_0xc746('0x2'));var express=require(_0xc746('0x3'));var router=express[_0xc746('0x4')]();var fs_extra=require(_0xc746('0x5'));var auth=require(_0xc746('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc746('0x7'));var controller=require(_0xc746('0x8'));router[_0xc746('0x9')]('/',auth[_0xc746('0xa')](),controller[_0xc746('0xb')]);router[_0xc746('0x9')](_0xc746('0xc'),auth[_0xc746('0xa')](),controller[_0xc746('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xc746('0xe')](_0xc746('0xc'),auth[_0xc746('0xa')](),controller[_0xc746('0xf')]);router[_0xc746('0x10')](_0xc746('0xc'),auth[_0xc746('0xa')](),controller[_0xc746('0x11')]);module[_0xc746('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 06d1010..7a6cc00 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 _0x45ae=['ENUM','string','variable','picklist','STRING','customVariable','BOOLEAN','sequelize','exports'];(function(_0x5776cc,_0x110eeb){var _0x699929=function(_0x3705c1){while(--_0x3705c1){_0x5776cc['push'](_0x5776cc['shift']());}};_0x699929(++_0x110eeb);}(_0x45ae,0xdf));var _0xe45a=function(_0x150b1f,_0x137c7a){_0x150b1f=_0x150b1f-0x0;var _0x5e2005=_0x45ae[_0x150b1f];return _0x5e2005;};'use strict';var Sequelize=require(_0xe45a('0x0'));module[_0xe45a('0x1')]={'type':{'type':Sequelize[_0xe45a('0x2')](_0xe45a('0x3'),_0xe45a('0x4'),'customVariable','keyValue',_0xe45a('0x5')),'defaultValue':_0xe45a('0x3')},'content':{'type':Sequelize[_0xe45a('0x6')]},'key':{'type':Sequelize[_0xe45a('0x6')]},'keyType':{'type':Sequelize[_0xe45a('0x2')]('string','variable',_0xe45a('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xe45a('0x6')]},'nameField':{'type':Sequelize[_0xe45a('0x6')]},'customField':{'type':Sequelize[_0xe45a('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe45a('0x6')]}}; \ No newline at end of file +var _0xcd0d=['variable','keyValue','picklist','STRING','ENUM','BOOLEAN','sequelize','exports','string'];(function(_0x5108d1,_0x4971b4){var _0x598135=function(_0x4b39e6){while(--_0x4b39e6){_0x5108d1['push'](_0x5108d1['shift']());}};_0x598135(++_0x4971b4);}(_0xcd0d,0x11d));var _0xdcd0=function(_0x19688b,_0x5cae76){_0x19688b=_0x19688b-0x0;var _0x196944=_0xcd0d[_0x19688b];return _0x196944;};'use strict';var Sequelize=require(_0xdcd0('0x0'));module[_0xdcd0('0x1')]={'type':{'type':Sequelize['ENUM'](_0xdcd0('0x2'),_0xdcd0('0x3'),'customVariable',_0xdcd0('0x4'),_0xdcd0('0x5')),'defaultValue':_0xdcd0('0x2')},'content':{'type':Sequelize[_0xdcd0('0x6')]},'key':{'type':Sequelize[_0xdcd0('0x6')]},'keyType':{'type':Sequelize[_0xdcd0('0x7')](_0xdcd0('0x2'),_0xdcd0('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xdcd0('0x6')]},'nameField':{'type':Sequelize[_0xdcd0('0x6')]},'customField':{'type':Sequelize[_0xdcd0('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xdcd0('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 099a07f..4e8c5ad 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 _0x9d11=['set','Content-Range','reject','update','then','destroy','end','error','stack','name','send','index','map','ZendeskField','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','nolimit','limit','sort','filter','merge','type','VIRTUAL','options','where','includeAll','include','find','catch','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count'];(function(_0x4ec55c,_0x45e524){var _0xa5a1b1=function(_0x1eda6a){while(--_0x1eda6a){_0x4ec55c['push'](_0x4ec55c['shift']());}};_0xa5a1b1(++_0x45e524);}(_0x9d11,0xb7));var _0x19d1=function(_0x3c6ae2,_0x5c52d8){_0x3c6ae2=_0x3c6ae2-0x0;var _0x4edda=_0x9d11[_0x3c6ae2];return _0x4edda;};'use strict';var emlformat=require(_0x19d1('0x0'));var rimraf=require(_0x19d1('0x1'));var zipdir=require(_0x19d1('0x2'));var jsonpatch=require(_0x19d1('0x3'));var rp=require('request-promise');var moment=require(_0x19d1('0x4'));var BPromise=require(_0x19d1('0x5'));var Mustache=require(_0x19d1('0x6'));var util=require(_0x19d1('0x7'));var path=require(_0x19d1('0x8'));var sox=require(_0x19d1('0x9'));var csv=require('to-csv');var ejs=require(_0x19d1('0xa'));var fs=require('fs');var fs_extra=require(_0x19d1('0xb'));var _=require('lodash');var squel=require(_0x19d1('0xc'));var crypto=require(_0x19d1('0xd'));var jsforce=require(_0x19d1('0xe'));var deskjs=require(_0x19d1('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x19d1('0x10'));var Redis=require(_0x19d1('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x19d1('0x12'));var as=require(_0x19d1('0x13'));var hardwareService=require(_0x19d1('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x19d1('0x15'));var licenseUtil=require(_0x19d1('0x16'));var db=require(_0x19d1('0x17'))['db'];function respondWithStatusCode(_0x39fe71,_0x50b002){_0x50b002=_0x50b002||0xcc;return function(_0x4aed3e){if(_0x4aed3e){return _0x39fe71[_0x19d1('0x18')](_0x50b002);}return _0x39fe71['status'](_0x50b002)['end']();};}function respondWithResult(_0x1e1f02,_0x5244a2){_0x5244a2=_0x5244a2||0xc8;return function(_0x116b36){if(_0x116b36){return _0x1e1f02[_0x19d1('0x19')](_0x5244a2)[_0x19d1('0x1a')](_0x116b36);}};}function respondWithFilteredResult(_0x17ef9f,_0xfe478a){return function(_0x578764){if(_0x578764){var _0xc896b8=typeof _0xfe478a[_0x19d1('0x1b')]===_0x19d1('0x1c')&&typeof _0xfe478a['limit']===_0x19d1('0x1c');var _0x3beea5=_0x578764[_0x19d1('0x1d')];var _0x3df779=_0xc896b8?0x0:_0xfe478a[_0x19d1('0x1b')];var _0xae72c5=_0xc896b8?_0x578764['count']:_0xfe478a[_0x19d1('0x1b')]+_0xfe478a['limit'];var _0x4902c4;if(_0xae72c5>=_0x3beea5){_0xae72c5=_0x3beea5;_0x4902c4=0xc8;}else{_0x4902c4=0xce;}_0x17ef9f[_0x19d1('0x19')](_0x4902c4);return _0x17ef9f[_0x19d1('0x1e')](_0x19d1('0x1f'),_0x3df779+'-'+_0xae72c5+'/'+_0x3beea5)[_0x19d1('0x1a')](_0x578764);}return null;};}function patchUpdates(_0x120a1c){return function(_0x587e17){try{jsonpatch['apply'](_0x587e17,_0x120a1c,!![]);}catch(_0x3e89cf){return BPromise[_0x19d1('0x20')](_0x3e89cf);}return _0x587e17['save']();};}function saveUpdates(_0x5317c0,_0x3cfd8a){return function(_0x46d9df){if(_0x46d9df){return _0x46d9df[_0x19d1('0x21')](_0x5317c0)[_0x19d1('0x22')](function(_0x22820e){return _0x22820e;});}return null;};}function removeEntity(_0x34e6c2,_0x57ad20){return function(_0x19f04d){if(_0x19f04d){return _0x19f04d[_0x19d1('0x23')]()[_0x19d1('0x22')](function(){_0x34e6c2['status'](0xcc)[_0x19d1('0x24')]();});}};}function handleEntityNotFound(_0x1bb261,_0x27d3cc){return function(_0x95544d){if(!_0x95544d){_0x1bb261[_0x19d1('0x18')](0x194);}return _0x95544d;};}function handleError(_0x5305c4,_0x1245d4){_0x1245d4=_0x1245d4||0x1f4;return function(_0x2d83a6){logger[_0x19d1('0x25')](_0x2d83a6[_0x19d1('0x26')]);if(_0x2d83a6[_0x19d1('0x27')]){delete _0x2d83a6[_0x19d1('0x27')];}_0x5305c4[_0x19d1('0x19')](_0x1245d4)[_0x19d1('0x28')](_0x2d83a6);};}exports[_0x19d1('0x29')]=function(_0x12710d,_0x319234){var _0x596a2a={},_0x2b186e={},_0x1e0431={'count':0x0,'rows':[]};var _0x7df7b3=_[_0x19d1('0x2a')](db[_0x19d1('0x2b')][_0x19d1('0x2c')],function(_0x2a3a7e){return{'name':_0x2a3a7e[_0x19d1('0x2d')],'type':_0x2a3a7e['type'][_0x19d1('0x2e')]};});_0x2b186e[_0x19d1('0x2f')]=_[_0x19d1('0x2a')](_0x7df7b3,_0x19d1('0x27'));_0x2b186e['query']=_[_0x19d1('0x30')](_0x12710d[_0x19d1('0x31')]);_0x2b186e[_0x19d1('0x32')]=_[_0x19d1('0x33')](_0x2b186e[_0x19d1('0x2f')],_0x2b186e[_0x19d1('0x31')]);_0x596a2a['attributes']=_[_0x19d1('0x33')](_0x2b186e['model'],qs[_0x19d1('0x34')](_0x12710d[_0x19d1('0x31')]['fields']));_0x596a2a[_0x19d1('0x35')]=_0x596a2a[_0x19d1('0x35')][_0x19d1('0x36')]?_0x596a2a[_0x19d1('0x35')]:_0x2b186e['model'];if(!_0x12710d[_0x19d1('0x31')]['hasOwnProperty'](_0x19d1('0x37'))){_0x596a2a[_0x19d1('0x38')]=qs[_0x19d1('0x38')](_0x12710d[_0x19d1('0x31')]['limit']);_0x596a2a['offset']=qs[_0x19d1('0x1b')](_0x12710d[_0x19d1('0x31')][_0x19d1('0x1b')]);}_0x596a2a['order']=qs[_0x19d1('0x39')](_0x12710d[_0x19d1('0x31')][_0x19d1('0x39')]);_0x596a2a['where']=qs[_0x19d1('0x32')](_['pick'](_0x12710d[_0x19d1('0x31')],_0x2b186e[_0x19d1('0x32')]),_0x7df7b3);if(_0x12710d[_0x19d1('0x31')][_0x19d1('0x3a')]){_0x596a2a['where']=_[_0x19d1('0x3b')](_0x596a2a['where'],{'$or':_[_0x19d1('0x2a')](_0x7df7b3,function(_0x220c1){if(_0x220c1[_0x19d1('0x3c')]!==_0x19d1('0x3d')){var _0x488bae={};_0x488bae[_0x220c1[_0x19d1('0x27')]]={'$like':'%'+_0x12710d[_0x19d1('0x31')][_0x19d1('0x3a')]+'%'};return _0x488bae;}})});}_0x596a2a=_[_0x19d1('0x3b')]({},_0x596a2a,_0x12710d[_0x19d1('0x3e')]);var _0x7a9108={'where':_0x596a2a[_0x19d1('0x3f')]};return db[_0x19d1('0x2b')]['count'](_0x7a9108)[_0x19d1('0x22')](function(_0x37ebba){_0x1e0431['count']=_0x37ebba;if(_0x12710d[_0x19d1('0x31')][_0x19d1('0x40')]){_0x596a2a[_0x19d1('0x41')]=[{'all':!![]}];}return db[_0x19d1('0x2b')]['findAll'](_0x596a2a);})['then'](function(_0x49d777){_0x1e0431['rows']=_0x49d777;return _0x1e0431;})[_0x19d1('0x22')](respondWithFilteredResult(_0x319234,_0x596a2a))['catch'](handleError(_0x319234,null));};exports['show']=function(_0x1ddc2b,_0x3e17b5){var _0x2f17d5={'raw':!![],'where':{'id':_0x1ddc2b['params']['id']}},_0x562d9f={};_0x562d9f['model']=_[_0x19d1('0x30')](db[_0x19d1('0x2b')][_0x19d1('0x2c')]);_0x562d9f['query']=_['keys'](_0x1ddc2b[_0x19d1('0x31')]);_0x562d9f[_0x19d1('0x32')]=_[_0x19d1('0x33')](_0x562d9f['model'],_0x562d9f[_0x19d1('0x31')]);_0x2f17d5[_0x19d1('0x35')]=_[_0x19d1('0x33')](_0x562d9f['model'],qs[_0x19d1('0x34')](_0x1ddc2b[_0x19d1('0x31')][_0x19d1('0x34')]));_0x2f17d5['attributes']=_0x2f17d5[_0x19d1('0x35')][_0x19d1('0x36')]?_0x2f17d5[_0x19d1('0x35')]:_0x562d9f['model'];if(_0x1ddc2b[_0x19d1('0x31')]['includeAll']){_0x2f17d5['include']=[{'all':!![]}];}_0x2f17d5=_[_0x19d1('0x3b')]({},_0x2f17d5,_0x1ddc2b[_0x19d1('0x3e')]);return db[_0x19d1('0x2b')][_0x19d1('0x42')](_0x2f17d5)['then'](handleEntityNotFound(_0x3e17b5,null))[_0x19d1('0x22')](respondWithResult(_0x3e17b5,null))[_0x19d1('0x43')](handleError(_0x3e17b5,null));};exports['create']=function(_0x44bd5d,_0x1e5af9){return db['ZendeskField'][_0x19d1('0x44')](_0x44bd5d[_0x19d1('0x45')],{})[_0x19d1('0x22')](respondWithResult(_0x1e5af9,0xc9))[_0x19d1('0x43')](handleError(_0x1e5af9,null));};exports['update']=function(_0x2dc701,_0x2ef675){if(_0x2dc701[_0x19d1('0x45')]['id']){delete _0x2dc701[_0x19d1('0x45')]['id'];}return db[_0x19d1('0x2b')]['find']({'where':{'id':_0x2dc701['params']['id']}})['then'](handleEntityNotFound(_0x2ef675,null))['then'](saveUpdates(_0x2dc701[_0x19d1('0x45')],null))[_0x19d1('0x22')](respondWithResult(_0x2ef675,null))[_0x19d1('0x43')](handleError(_0x2ef675,null));};exports[_0x19d1('0x23')]=function(_0x54bf5c,_0x58c29f){return db[_0x19d1('0x2b')][_0x19d1('0x42')]({'where':{'id':_0x54bf5c[_0x19d1('0x46')]['id']}})['then'](handleEntityNotFound(_0x58c29f,null))['then'](removeEntity(_0x58c29f,null))[_0x19d1('0x43')](handleError(_0x58c29f,null));}; \ No newline at end of file +var _0x3d0a=['stack','name','send','index','map','ZendeskField','rawAttributes','fieldName','key','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','model','merge','find','create','body','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','ejs','fs-extra','lodash','jsforce','querystring','ioredis','../../components/parsers/qs','../../config/environment','../../config/license/util','end','status','json','offset','limit','undefined','count','Content-Range','reject','update','then','destroy','sendStatus'];(function(_0x56f7e2,_0x145392){var _0x36240b=function(_0x216ff7){while(--_0x216ff7){_0x56f7e2['push'](_0x56f7e2['shift']());}};_0x36240b(++_0x145392);}(_0x3d0a,0xa9));var _0xa3d0=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x3d0a[_0x13e741];return _0x3f8bb3;};'use strict';var emlformat=require(_0xa3d0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa3d0('0x1'));var jsonpatch=require(_0xa3d0('0x2'));var rp=require(_0xa3d0('0x3'));var moment=require(_0xa3d0('0x4'));var BPromise=require(_0xa3d0('0x5'));var Mustache=require(_0xa3d0('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa3d0('0x7'));var fs=require('fs');var fs_extra=require(_0xa3d0('0x8'));var _=require(_0xa3d0('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa3d0('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa3d0('0xb'));var Papa=require('papaparse');var Redis=require(_0xa3d0('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xa3d0('0xd'));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(_0xa3d0('0xe'));var licenseUtil=require(_0xa3d0('0xf'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d75bf,_0xc67d9b){_0xc67d9b=_0xc67d9b||0xcc;return function(_0x566891){if(_0x566891){return _0x4d75bf['sendStatus'](_0xc67d9b);}return _0x4d75bf['status'](_0xc67d9b)[_0xa3d0('0x10')]();};}function respondWithResult(_0x2c87b6,_0x3b5b82){_0x3b5b82=_0x3b5b82||0xc8;return function(_0x248438){if(_0x248438){return _0x2c87b6[_0xa3d0('0x11')](_0x3b5b82)[_0xa3d0('0x12')](_0x248438);}};}function respondWithFilteredResult(_0x20ca47,_0x5e77c0){return function(_0xb8ec3e){if(_0xb8ec3e){var _0xa7d703=typeof _0x5e77c0[_0xa3d0('0x13')]==='undefined'&&typeof _0x5e77c0[_0xa3d0('0x14')]===_0xa3d0('0x15');var _0x474ff8=_0xb8ec3e[_0xa3d0('0x16')];var _0x2e138f=_0xa7d703?0x0:_0x5e77c0[_0xa3d0('0x13')];var _0x46ff69=_0xa7d703?_0xb8ec3e[_0xa3d0('0x16')]:_0x5e77c0[_0xa3d0('0x13')]+_0x5e77c0[_0xa3d0('0x14')];var _0x872f91;if(_0x46ff69>=_0x474ff8){_0x46ff69=_0x474ff8;_0x872f91=0xc8;}else{_0x872f91=0xce;}_0x20ca47[_0xa3d0('0x11')](_0x872f91);return _0x20ca47['set'](_0xa3d0('0x17'),_0x2e138f+'-'+_0x46ff69+'/'+_0x474ff8)[_0xa3d0('0x12')](_0xb8ec3e);}return null;};}function patchUpdates(_0x466155){return function(_0x210610){try{jsonpatch['apply'](_0x210610,_0x466155,!![]);}catch(_0x42d0d4){return BPromise[_0xa3d0('0x18')](_0x42d0d4);}return _0x210610['save']();};}function saveUpdates(_0x3ee373,_0x16c7c2){return function(_0x322a17){if(_0x322a17){return _0x322a17[_0xa3d0('0x19')](_0x3ee373)[_0xa3d0('0x1a')](function(_0x2865c6){return _0x2865c6;});}return null;};}function removeEntity(_0x4b6931,_0x4482af){return function(_0x457556){if(_0x457556){return _0x457556[_0xa3d0('0x1b')]()[_0xa3d0('0x1a')](function(){_0x4b6931[_0xa3d0('0x11')](0xcc)[_0xa3d0('0x10')]();});}};}function handleEntityNotFound(_0x52b62e,_0x2a1175){return function(_0x38136f){if(!_0x38136f){_0x52b62e[_0xa3d0('0x1c')](0x194);}return _0x38136f;};}function handleError(_0x4e3272,_0x57ff94){_0x57ff94=_0x57ff94||0x1f4;return function(_0x4e52d9){logger['error'](_0x4e52d9[_0xa3d0('0x1d')]);if(_0x4e52d9[_0xa3d0('0x1e')]){delete _0x4e52d9['name'];}_0x4e3272[_0xa3d0('0x11')](_0x57ff94)[_0xa3d0('0x1f')](_0x4e52d9);};}exports[_0xa3d0('0x20')]=function(_0x168677,_0x4ec6df){var _0x2990ea={},_0x265735={},_0x15bdb7={'count':0x0,'rows':[]};var _0x582f9b=_[_0xa3d0('0x21')](db[_0xa3d0('0x22')][_0xa3d0('0x23')],function(_0x56953b){return{'name':_0x56953b[_0xa3d0('0x24')],'type':_0x56953b['type'][_0xa3d0('0x25')]};});_0x265735['model']=_[_0xa3d0('0x21')](_0x582f9b,_0xa3d0('0x1e'));_0x265735[_0xa3d0('0x26')]=_[_0xa3d0('0x27')](_0x168677[_0xa3d0('0x26')]);_0x265735['filters']=_[_0xa3d0('0x28')](_0x265735['model'],_0x265735[_0xa3d0('0x26')]);_0x2990ea[_0xa3d0('0x29')]=_[_0xa3d0('0x28')](_0x265735['model'],qs[_0xa3d0('0x2a')](_0x168677['query'][_0xa3d0('0x2a')]));_0x2990ea[_0xa3d0('0x29')]=_0x2990ea['attributes'][_0xa3d0('0x2b')]?_0x2990ea[_0xa3d0('0x29')]:_0x265735['model'];if(!_0x168677[_0xa3d0('0x26')][_0xa3d0('0x2c')](_0xa3d0('0x2d'))){_0x2990ea[_0xa3d0('0x14')]=qs[_0xa3d0('0x14')](_0x168677[_0xa3d0('0x26')][_0xa3d0('0x14')]);_0x2990ea['offset']=qs['offset'](_0x168677[_0xa3d0('0x26')][_0xa3d0('0x13')]);}_0x2990ea[_0xa3d0('0x2e')]=qs[_0xa3d0('0x2f')](_0x168677[_0xa3d0('0x26')][_0xa3d0('0x2f')]);_0x2990ea['where']=qs[_0xa3d0('0x30')](_[_0xa3d0('0x31')](_0x168677[_0xa3d0('0x26')],_0x265735['filters']),_0x582f9b);if(_0x168677[_0xa3d0('0x26')][_0xa3d0('0x32')]){_0x2990ea[_0xa3d0('0x33')]=_['merge'](_0x2990ea[_0xa3d0('0x33')],{'$or':_['map'](_0x582f9b,function(_0x2d5069){if(_0x2d5069['type']!==_0xa3d0('0x34')){var _0x22c5da={};_0x22c5da[_0x2d5069[_0xa3d0('0x1e')]]={'$like':'%'+_0x168677[_0xa3d0('0x26')][_0xa3d0('0x32')]+'%'};return _0x22c5da;}})});}_0x2990ea=_['merge']({},_0x2990ea,_0x168677[_0xa3d0('0x35')]);var _0x1a1497={'where':_0x2990ea[_0xa3d0('0x33')]};return db['ZendeskField'][_0xa3d0('0x16')](_0x1a1497)[_0xa3d0('0x1a')](function(_0x499ece){_0x15bdb7[_0xa3d0('0x16')]=_0x499ece;if(_0x168677[_0xa3d0('0x26')][_0xa3d0('0x36')]){_0x2990ea[_0xa3d0('0x37')]=[{'all':!![]}];}return db[_0xa3d0('0x22')][_0xa3d0('0x38')](_0x2990ea);})[_0xa3d0('0x1a')](function(_0xd2847e){_0x15bdb7[_0xa3d0('0x39')]=_0xd2847e;return _0x15bdb7;})[_0xa3d0('0x1a')](respondWithFilteredResult(_0x4ec6df,_0x2990ea))[_0xa3d0('0x3a')](handleError(_0x4ec6df,null));};exports[_0xa3d0('0x3b')]=function(_0x14404e,_0x476f49){var _0x1df34d={'raw':!![],'where':{'id':_0x14404e['params']['id']}},_0x1df7e6={};_0x1df7e6[_0xa3d0('0x3c')]=_[_0xa3d0('0x27')](db[_0xa3d0('0x22')][_0xa3d0('0x23')]);_0x1df7e6[_0xa3d0('0x26')]=_['keys'](_0x14404e[_0xa3d0('0x26')]);_0x1df7e6[_0xa3d0('0x30')]=_['intersection'](_0x1df7e6['model'],_0x1df7e6['query']);_0x1df34d[_0xa3d0('0x29')]=_[_0xa3d0('0x28')](_0x1df7e6['model'],qs['fields'](_0x14404e['query'][_0xa3d0('0x2a')]));_0x1df34d['attributes']=_0x1df34d[_0xa3d0('0x29')][_0xa3d0('0x2b')]?_0x1df34d[_0xa3d0('0x29')]:_0x1df7e6[_0xa3d0('0x3c')];if(_0x14404e[_0xa3d0('0x26')]['includeAll']){_0x1df34d[_0xa3d0('0x37')]=[{'all':!![]}];}_0x1df34d=_[_0xa3d0('0x3d')]({},_0x1df34d,_0x14404e[_0xa3d0('0x35')]);return db[_0xa3d0('0x22')][_0xa3d0('0x3e')](_0x1df34d)[_0xa3d0('0x1a')](handleEntityNotFound(_0x476f49,null))[_0xa3d0('0x1a')](respondWithResult(_0x476f49,null))[_0xa3d0('0x3a')](handleError(_0x476f49,null));};exports[_0xa3d0('0x3f')]=function(_0x5b845c,_0x5d787e){return db[_0xa3d0('0x22')][_0xa3d0('0x3f')](_0x5b845c[_0xa3d0('0x40')],{})[_0xa3d0('0x1a')](respondWithResult(_0x5d787e,0xc9))['catch'](handleError(_0x5d787e,null));};exports[_0xa3d0('0x19')]=function(_0x3c23f1,_0x4bb1ee){if(_0x3c23f1[_0xa3d0('0x40')]['id']){delete _0x3c23f1[_0xa3d0('0x40')]['id'];}return db[_0xa3d0('0x22')]['find']({'where':{'id':_0x3c23f1[_0xa3d0('0x41')]['id']}})[_0xa3d0('0x1a')](handleEntityNotFound(_0x4bb1ee,null))[_0xa3d0('0x1a')](saveUpdates(_0x3c23f1[_0xa3d0('0x40')],null))[_0xa3d0('0x1a')](respondWithResult(_0x4bb1ee,null))['catch'](handleError(_0x4bb1ee,null));};exports[_0xa3d0('0x1b')]=function(_0x460fa3,_0x2fc568){return db[_0xa3d0('0x22')]['find']({'where':{'id':_0x460fa3[_0xa3d0('0x41')]['id']}})[_0xa3d0('0x1a')](handleEntityNotFound(_0x2fc568,null))[_0xa3d0('0x1a')](removeEntity(_0x2fc568,null))[_0xa3d0('0x3a')](handleError(_0x2fc568,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index ae6f9ef..ab19c04 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 _0xf0e3=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intZendeskField.attributes','exports','define','ZendeskField','zendesk_unique_index','idField','FieldId'];(function(_0x2cfb58,_0x3d9412){var _0xd99951=function(_0x329afa){while(--_0x329afa){_0x2cfb58['push'](_0x2cfb58['shift']());}};_0xd99951(++_0x3d9412);}(_0xf0e3,0x1b0));var _0x3f0e=function(_0x3c7bcc,_0x2e08b2){_0x3c7bcc=_0x3c7bcc-0x0;var _0x2e4767=_0xf0e3[_0x3c7bcc];return _0x2e4767;};'use strict';var _=require(_0x3f0e('0x0'));var util=require(_0x3f0e('0x1'));var logger=require(_0x3f0e('0x2'))(_0x3f0e('0x3'));var moment=require(_0x3f0e('0x4'));var BPromise=require(_0x3f0e('0x5'));var rp=require(_0x3f0e('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3f0e('0x7'));var config=require(_0x3f0e('0x8'));var attributes=require(_0x3f0e('0x9'));module[_0x3f0e('0xa')]=function(_0x3f62ba,_0x150aa0){return _0x3f62ba[_0x3f0e('0xb')](_0x3f0e('0xc'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0x3f0e('0xd'),'fields':[_0x3f0e('0xe'),_0x3f0e('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4426=['define','ZendeskField','int_zendesk_fields','idField','FieldId','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x50aa2e,_0xfbd6f0){var _0x5e07f0=function(_0x3ed540){while(--_0x3ed540){_0x50aa2e['push'](_0x50aa2e['shift']());}};_0x5e07f0(++_0xfbd6f0);}(_0x4426,0x145));var _0x6442=function(_0xe80c36,_0x5afcce){_0xe80c36=_0xe80c36-0x0;var _0x47ff62=_0x4426[_0xe80c36];return _0x47ff62;};'use strict';var _=require(_0x6442('0x0'));var util=require('util');var logger=require(_0x6442('0x1'))('api');var moment=require(_0x6442('0x2'));var BPromise=require(_0x6442('0x3'));var rp=require(_0x6442('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intZendeskField.attributes');module['exports']=function(_0x557d30,_0x2705c3){return _0x557d30[_0x6442('0x5')](_0x6442('0x6'),attributes,{'tableName':_0x6442('0x7'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0x6442('0x8'),_0x6442('0x9')],'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 0c94969..bfd432c 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 _0x9375=['ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9375,0x110));var _0x5937=function(_0x3569f5,_0x39ea83){_0x3569f5=_0x3569f5-0x0;var _0x188282=_0x9375[_0x3569f5];return _0x188282;};'use strict';var _=require(_0x5937('0x0'));var util=require(_0x5937('0x1'));var moment=require(_0x5937('0x2'));var BPromise=require(_0x5937('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5937('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5937('0x5'))(_0x5937('0x6'));var config=require(_0x5937('0x7'));var jayson=require(_0x5937('0x8'));var client=jayson[_0x5937('0x9')][_0x5937('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a7aa2,_0x2c6ecb,_0x585e51){return new BPromise(function(_0x275d0c,_0x3740fa){return client[_0x5937('0xb')](_0x3a7aa2,_0x585e51)[_0x5937('0xc')](function(_0x575cae){logger[_0x5937('0xd')](_0x5937('0xe'),_0x2c6ecb,_0x5937('0xf'));logger[_0x5937('0x10')](_0x5937('0x11'),_0x2c6ecb,'request\x20sent',JSON['stringify'](_0x575cae));if(_0x575cae[_0x5937('0x12')]){if(_0x575cae[_0x5937('0x12')][_0x5937('0x13')]===0x1f4){logger['error'](_0x5937('0xe'),_0x2c6ecb,_0x575cae[_0x5937('0x12')][_0x5937('0x14')]);return _0x3740fa(_0x575cae[_0x5937('0x12')][_0x5937('0x14')]);}logger[_0x5937('0x12')](_0x5937('0xe'),_0x2c6ecb,_0x575cae[_0x5937('0x12')]['message']);return _0x275d0c(_0x575cae['error'][_0x5937('0x14')]);}else{logger['info']('ZendeskField,\x20%s,\x20%s',_0x2c6ecb,_0x5937('0xf'));_0x275d0c(_0x575cae['result'][_0x5937('0x14')]);}})[_0x5937('0x15')](function(_0x3158a8){logger['error'](_0x5937('0xe'),_0x2c6ecb,_0x3158a8);_0x3740fa(_0x3158a8);});});} \ No newline at end of file +var _0x1a69=['message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','info','ZendeskField,\x20%s,\x20%s','debug','ZendeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x528442,_0x3f7aed){var _0x4c42cd=function(_0x304a36){while(--_0x304a36){_0x528442['push'](_0x528442['shift']());}};_0x4c42cd(++_0x3f7aed);}(_0x1a69,0xf5));var _0x91a6=function(_0x1ea6f6,_0x415117){_0x1ea6f6=_0x1ea6f6-0x0;var _0x10fe52=_0x1a69[_0x1ea6f6];return _0x10fe52;};'use strict';var _=require('lodash');var util=require(_0x91a6('0x0'));var moment=require('moment');var BPromise=require(_0x91a6('0x1'));var rs=require(_0x91a6('0x2'));var fs=require('fs');var Redis=require(_0x91a6('0x3'));var db=require(_0x91a6('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x91a6('0x5'));var config=require(_0x91a6('0x6'));var jayson=require(_0x91a6('0x7'));var client=jayson[_0x91a6('0x8')][_0x91a6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1bccde,_0x5074b2,_0x48cba8){return new BPromise(function(_0x74cf0e,_0x43b7a3){return client[_0x91a6('0xa')](_0x1bccde,_0x48cba8)['then'](function(_0x47f170){logger[_0x91a6('0xb')](_0x91a6('0xc'),_0x5074b2,'request\x20sent');logger[_0x91a6('0xd')](_0x91a6('0xe'),_0x5074b2,_0x91a6('0xf'),JSON[_0x91a6('0x10')](_0x47f170));if(_0x47f170[_0x91a6('0x11')]){if(_0x47f170['error'][_0x91a6('0x12')]===0x1f4){logger[_0x91a6('0x11')](_0x91a6('0xc'),_0x5074b2,_0x47f170[_0x91a6('0x11')]['message']);return _0x43b7a3(_0x47f170['error']['message']);}logger[_0x91a6('0x11')](_0x91a6('0xc'),_0x5074b2,_0x47f170[_0x91a6('0x11')][_0x91a6('0x13')]);return _0x74cf0e(_0x47f170[_0x91a6('0x11')]['message']);}else{logger[_0x91a6('0xb')](_0x91a6('0xc'),_0x5074b2,_0x91a6('0xf'));_0x74cf0e(_0x47f170[_0x91a6('0x14')][_0x91a6('0x13')]);}})[_0x91a6('0x15')](function(_0x11842b){logger['error'](_0x91a6('0xc'),_0x5074b2,_0x11842b);_0x43b7a3(_0x11842b);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index de1f80e..fb0f6a3 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 _0x0347=['./intZohoAccount.controller','index','/:id','isAuthenticated','get','/:id/fields','getFields','post','create','addConfiguration','put','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x287a47,_0x2f731c){var _0x3fb726=function(_0xbedc33){while(--_0xbedc33){_0x287a47['push'](_0x287a47['shift']());}};_0x3fb726(++_0x2f731c);}(_0x0347,0x1f0));var _0x7034=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x0347[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require('multer');var util=require(_0x7034('0x0'));var path=require(_0x7034('0x1'));var timeout=require(_0x7034('0x2'));var express=require(_0x7034('0x3'));var router=express[_0x7034('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7034('0x5'));var interaction=require(_0x7034('0x6'));var config=require(_0x7034('0x7'));var controller=require(_0x7034('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x7034('0x9')]);router['get'](_0x7034('0xa'),auth[_0x7034('0xb')](),controller['show']);router[_0x7034('0xc')]('/:id/configurations',auth[_0x7034('0xb')](),controller['getConfigurations']);router['get'](_0x7034('0xd'),auth[_0x7034('0xb')](),controller[_0x7034('0xe')]);router[_0x7034('0xf')]('/',auth['isAuthenticated'](),controller[_0x7034('0x10')]);router[_0x7034('0xf')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x7034('0x11')]);router[_0x7034('0x12')](_0x7034('0xa'),auth[_0x7034('0xb')](),controller['update']);router[_0x7034('0x13')](_0x7034('0xa'),auth[_0x7034('0xb')](),controller[_0x7034('0x14')]);module['exports']=router; \ No newline at end of file +var _0x3837=['post','create','/:id/configurations','addConfiguration','put','update','delete','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','getConfigurations','/:id/fields','getFields'];(function(_0x261e29,_0x10fffd){var _0x25ef43=function(_0x21b8e7){while(--_0x21b8e7){_0x261e29['push'](_0x261e29['shift']());}};_0x25ef43(++_0x10fffd);}(_0x3837,0x1d1));var _0x7383=function(_0xaf4844,_0x2f1d73){_0xaf4844=_0xaf4844-0x0;var _0x503d5e=_0x3837[_0xaf4844];return _0x503d5e;};'use strict';var multer=require('multer');var util=require(_0x7383('0x0'));var path=require('path');var timeout=require(_0x7383('0x1'));var express=require('express');var router=express[_0x7383('0x2')]();var fs_extra=require(_0x7383('0x3'));var auth=require(_0x7383('0x4'));var interaction=require(_0x7383('0x5'));var config=require(_0x7383('0x6'));var controller=require('./intZohoAccount.controller');router['get']('/',auth[_0x7383('0x7')](),controller[_0x7383('0x8')]);router[_0x7383('0x9')](_0x7383('0xa'),auth[_0x7383('0x7')](),controller[_0x7383('0xb')]);router[_0x7383('0x9')]('/:id/configurations',auth[_0x7383('0x7')](),controller[_0x7383('0xc')]);router[_0x7383('0x9')](_0x7383('0xd'),auth[_0x7383('0x7')](),controller[_0x7383('0xe')]);router[_0x7383('0xf')]('/',auth['isAuthenticated'](),controller[_0x7383('0x10')]);router[_0x7383('0xf')](_0x7383('0x11'),auth[_0x7383('0x7')](),controller[_0x7383('0x12')]);router[_0x7383('0x13')](_0x7383('0xa'),auth[_0x7383('0x7')](),controller[_0x7383('0x14')]);router[_0x7383('0x15')](_0x7383('0xa'),auth['isAuthenticated'](),controller[_0x7383('0x16')]);module[_0x7383('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index dc78b0e..ae60072 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 _0xf3cd=['exports','STRING','sequelize'];(function(_0x518d37,_0x372c14){var _0x4356fe=function(_0x4f58b1){while(--_0x4f58b1){_0x518d37['push'](_0x518d37['shift']());}};_0x4356fe(++_0x372c14);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x493a51,_0x45128c){_0x493a51=_0x493a51-0x0;var _0xc85756=_0xf3cd[_0x493a51];return _0xc85756;};'use strict';var Sequelize=require(_0xdf3c('0x0'));module[_0xdf3c('0x1')]={'name':{'type':Sequelize[_0xdf3c('0x2')]},'description':{'type':Sequelize[_0xdf3c('0x2')]},'host':{'type':Sequelize[_0xdf3c('0x2')]},'zone':{'type':Sequelize[_0xdf3c('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xdf3c('0x2')]},'serverUrl':{'type':Sequelize[_0xdf3c('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0xdf3c('0x2')]},'refreshToken':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xaa88=['exports','STRING','sequelize'];(function(_0x1f0581,_0x2783df){var _0x5aa8db=function(_0x414ab0){while(--_0x414ab0){_0x1f0581['push'](_0x1f0581['shift']());}};_0x5aa8db(++_0x2783df);}(_0xaa88,0x137));var _0x8aa8=function(_0x3a0c4f,_0x5dd1a3){_0x3a0c4f=_0x3a0c4f-0x0;var _0x247049=_0xaa88[_0x3a0c4f];return _0x247049;};'use strict';var Sequelize=require(_0x8aa8('0x0'));module[_0x8aa8('0x1')]={'name':{'type':Sequelize[_0x8aa8('0x2')]},'description':{'type':Sequelize[_0x8aa8('0x2')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0x8aa8('0x2')]},'clientId':{'type':Sequelize[_0x8aa8('0x2')]},'clientSecret':{'type':Sequelize[_0x8aa8('0x2')]},'serverUrl':{'type':Sequelize[_0x8aa8('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0x8aa8('0x2')]},'refreshToken':{'type':Sequelize[_0x8aa8('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 828ddf7..0d23a57 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 _0xc206=['pick_list_values','test','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','statusCode','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','status','end','json','offset','limit','undefined','count','set','update','destroy','then','error','name','send','map','ZohoAccount','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','getConfigurations','findOne','addConfiguration','AccountId','Subjects','Descriptions','getDescriptions','channel','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','clientId','clientSecret','refresh_token','access_token','serverUrl','code','refreshToken','host','zoho.eu','slice','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','Owner','Subject','Description','Call_Duration','Call_Result','Call_Start_Time','Call_Type','api_name','system_mandatory','push','display_label','custom_field','picklist'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc206,0x174));var _0x6c20=function(_0x3b1b23,_0x21bccd){_0x3b1b23=_0x3b1b23-0x0;var _0x1efc85=_0xc206[_0x3b1b23];return _0x1efc85;};'use strict';var emlformat=require(_0x6c20('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6c20('0x1'));var rp=require(_0x6c20('0x2'));var moment=require(_0x6c20('0x3'));var BPromise=require(_0x6c20('0x4'));var Mustache=require(_0x6c20('0x5'));var util=require(_0x6c20('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(_0x6c20('0x7'));var _=require(_0x6c20('0x8'));var squel=require(_0x6c20('0x9'));var crypto=require('crypto');var jsforce=require(_0x6c20('0xa'));var deskjs=require(_0x6c20('0xb'));var toCsv=require(_0x6c20('0xc'));var querystring=require(_0x6c20('0xd'));var Papa=require(_0x6c20('0xe'));var Redis=require('ioredis');var authService=require(_0x6c20('0xf'));var qs=require(_0x6c20('0x10'));var as=require(_0x6c20('0x11'));var hardwareService=require(_0x6c20('0x12'));var logger=require(_0x6c20('0x13'))(_0x6c20('0x14'));var utils=require(_0x6c20('0x15'));var config=require(_0x6c20('0x16'));var licenseUtil=require(_0x6c20('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x6c20('0x18'));function respondWithStatusCode(_0x49aa0e,_0x40f61f){_0x40f61f=_0x40f61f||0xcc;return function(_0x5a0b82){if(_0x5a0b82){return _0x49aa0e['sendStatus'](_0x40f61f);}return _0x49aa0e[_0x6c20('0x19')](_0x40f61f)[_0x6c20('0x1a')]();};}function respondWithResult(_0x11c089,_0x25d8be){_0x25d8be=_0x25d8be||0xc8;return function(_0x2a9378){if(_0x2a9378){return _0x11c089[_0x6c20('0x19')](_0x25d8be)[_0x6c20('0x1b')](_0x2a9378);}};}function respondWithFilteredResult(_0x52ab90,_0x3c9f51){return function(_0x99126d){if(_0x99126d){var _0x2a9a48=typeof _0x3c9f51[_0x6c20('0x1c')]==='undefined'&&typeof _0x3c9f51[_0x6c20('0x1d')]===_0x6c20('0x1e');var _0x31ed4c=_0x99126d[_0x6c20('0x1f')];var _0xd59953=_0x2a9a48?0x0:_0x3c9f51[_0x6c20('0x1c')];var _0x377b88=_0x2a9a48?_0x99126d[_0x6c20('0x1f')]:_0x3c9f51['offset']+_0x3c9f51[_0x6c20('0x1d')];var _0xd0f11d;if(_0x377b88>=_0x31ed4c){_0x377b88=_0x31ed4c;_0xd0f11d=0xc8;}else{_0xd0f11d=0xce;}_0x52ab90[_0x6c20('0x19')](_0xd0f11d);return _0x52ab90[_0x6c20('0x20')]('Content-Range',_0xd59953+'-'+_0x377b88+'/'+_0x31ed4c)[_0x6c20('0x1b')](_0x99126d);}return null;};}function patchUpdates(_0x3deec2){return function(_0x115d5d){try{jsonpatch['apply'](_0x115d5d,_0x3deec2,!![]);}catch(_0x5ea27a){return BPromise['reject'](_0x5ea27a);}return _0x115d5d['save']();};}function saveUpdates(_0x3aa292,_0x23cba4){return function(_0x2e5b28){if(_0x2e5b28){return _0x2e5b28[_0x6c20('0x21')](_0x3aa292)['then'](function(_0x718119){return _0x718119;});}return null;};}function removeEntity(_0x3b92d6,_0x5a3d38){return function(_0x5531c8){if(_0x5531c8){return _0x5531c8[_0x6c20('0x22')]()[_0x6c20('0x23')](function(){_0x3b92d6[_0x6c20('0x19')](0xcc)[_0x6c20('0x1a')]();});}};}function handleEntityNotFound(_0x5b44b6,_0x462407){return function(_0x2760c8){if(!_0x2760c8){_0x5b44b6['sendStatus'](0x194);}return _0x2760c8;};}function handleError(_0x13f889,_0x513fa4){_0x513fa4=_0x513fa4||0x1f4;return function(_0x29fb12){logger[_0x6c20('0x24')](_0x29fb12['stack']);if(_0x29fb12[_0x6c20('0x25')]){delete _0x29fb12[_0x6c20('0x25')];}_0x13f889[_0x6c20('0x19')](_0x513fa4)[_0x6c20('0x26')](_0x29fb12);};}exports['index']=function(_0x104cbb,_0x5be8ad){var _0x1d3b59={},_0x26c0b6={},_0x362217={'count':0x0,'rows':[]};var _0x111d58=_[_0x6c20('0x27')](db[_0x6c20('0x28')]['rawAttributes'],function(_0x2e4ce8){return{'name':_0x2e4ce8['fieldName'],'type':_0x2e4ce8[_0x6c20('0x29')][_0x6c20('0x2a')]};});_0x26c0b6[_0x6c20('0x2b')]=_[_0x6c20('0x27')](_0x111d58,_0x6c20('0x25'));_0x26c0b6[_0x6c20('0x2c')]=_[_0x6c20('0x2d')](_0x104cbb[_0x6c20('0x2c')]);_0x26c0b6[_0x6c20('0x2e')]=_[_0x6c20('0x2f')](_0x26c0b6[_0x6c20('0x2b')],_0x26c0b6['query']);_0x1d3b59[_0x6c20('0x30')]=_['intersection'](_0x26c0b6['model'],qs[_0x6c20('0x31')](_0x104cbb[_0x6c20('0x2c')][_0x6c20('0x31')]));_0x1d3b59[_0x6c20('0x30')]=_0x1d3b59[_0x6c20('0x30')][_0x6c20('0x32')]?_0x1d3b59['attributes']:_0x26c0b6[_0x6c20('0x2b')];if(!_0x104cbb[_0x6c20('0x2c')][_0x6c20('0x33')]('nolimit')){_0x1d3b59[_0x6c20('0x1d')]=qs[_0x6c20('0x1d')](_0x104cbb['query'][_0x6c20('0x1d')]);_0x1d3b59[_0x6c20('0x1c')]=qs[_0x6c20('0x1c')](_0x104cbb[_0x6c20('0x2c')][_0x6c20('0x1c')]);}_0x1d3b59[_0x6c20('0x34')]=qs[_0x6c20('0x35')](_0x104cbb[_0x6c20('0x2c')][_0x6c20('0x35')]);_0x1d3b59[_0x6c20('0x36')]=qs['filters'](_[_0x6c20('0x37')](_0x104cbb[_0x6c20('0x2c')],_0x26c0b6[_0x6c20('0x2e')]),_0x111d58);if(_0x104cbb[_0x6c20('0x2c')][_0x6c20('0x38')]){_0x1d3b59['where']=_[_0x6c20('0x39')](_0x1d3b59[_0x6c20('0x36')],{'$or':_[_0x6c20('0x27')](_0x111d58,function(_0x44eb89){if(_0x44eb89[_0x6c20('0x29')]!==_0x6c20('0x3a')){var _0x27f80f={};_0x27f80f[_0x44eb89[_0x6c20('0x25')]]={'$like':'%'+_0x104cbb[_0x6c20('0x2c')]['filter']+'%'};return _0x27f80f;}})});}_0x1d3b59=_[_0x6c20('0x39')]({},_0x1d3b59,_0x104cbb[_0x6c20('0x3b')]);var _0x3577f6={'where':_0x1d3b59[_0x6c20('0x36')]};return db[_0x6c20('0x28')][_0x6c20('0x1f')](_0x3577f6)[_0x6c20('0x23')](function(_0x11ba59){_0x362217['count']=_0x11ba59;if(_0x104cbb[_0x6c20('0x2c')]['includeAll']){_0x1d3b59[_0x6c20('0x3c')]=[{'all':!![]}];}return db[_0x6c20('0x28')][_0x6c20('0x3d')](_0x1d3b59);})[_0x6c20('0x23')](function(_0x1b7940){_0x362217[_0x6c20('0x3e')]=_0x1b7940;return _0x362217;})['then'](respondWithFilteredResult(_0x5be8ad,_0x1d3b59))[_0x6c20('0x3f')](handleError(_0x5be8ad,null));};exports[_0x6c20('0x40')]=function(_0x20ce96,_0x272155){var _0x5d3e43={'raw':![],'where':{'id':_0x20ce96[_0x6c20('0x41')]['id']}},_0x1c3586={};_0x1c3586[_0x6c20('0x2b')]=_[_0x6c20('0x2d')](db[_0x6c20('0x28')][_0x6c20('0x42')]);_0x1c3586[_0x6c20('0x2c')]=_[_0x6c20('0x2d')](_0x20ce96[_0x6c20('0x2c')]);_0x1c3586[_0x6c20('0x2e')]=_[_0x6c20('0x2f')](_0x1c3586['model'],_0x1c3586[_0x6c20('0x2c')]);_0x5d3e43['attributes']=_['intersection'](_0x1c3586['model'],qs[_0x6c20('0x31')](_0x20ce96[_0x6c20('0x2c')][_0x6c20('0x31')]));_0x5d3e43[_0x6c20('0x30')]=_0x5d3e43[_0x6c20('0x30')][_0x6c20('0x32')]?_0x5d3e43[_0x6c20('0x30')]:_0x1c3586['model'];if(_0x20ce96[_0x6c20('0x2c')][_0x6c20('0x43')]){_0x5d3e43['include']=[{'all':!![]}];}_0x5d3e43=_[_0x6c20('0x39')]({},_0x5d3e43,_0x20ce96[_0x6c20('0x3b')]);return db['ZohoAccount'][_0x6c20('0x44')](_0x5d3e43)[_0x6c20('0x23')](handleEntityNotFound(_0x272155,null))[_0x6c20('0x23')](respondWithResult(_0x272155,null))[_0x6c20('0x3f')](handleError(_0x272155,null));};exports['create']=function(_0x160401,_0x205b3f){return db['ZohoAccount'][_0x6c20('0x45')](_0x160401[_0x6c20('0x46')],{})[_0x6c20('0x23')](respondWithResult(_0x205b3f,0xc9))['catch'](handleError(_0x205b3f,null));};exports['update']=function(_0x367cf4,_0x2e6299){if(_0x367cf4[_0x6c20('0x46')]['id']){delete _0x367cf4['body']['id'];}return db['ZohoAccount'][_0x6c20('0x44')]({'where':{'id':_0x367cf4[_0x6c20('0x41')]['id']}})['then'](handleEntityNotFound(_0x2e6299,null))['then'](saveUpdates(_0x367cf4['body'],null))[_0x6c20('0x23')](respondWithResult(_0x2e6299,null))[_0x6c20('0x3f')](handleError(_0x2e6299,null));};exports['destroy']=function(_0x3b655e,_0x4cc599){return db['ZohoAccount']['find']({'where':{'id':_0x3b655e[_0x6c20('0x41')]['id']}})[_0x6c20('0x23')](handleEntityNotFound(_0x4cc599,null))[_0x6c20('0x23')](removeEntity(_0x4cc599,null))[_0x6c20('0x3f')](handleError(_0x4cc599,null));};exports[_0x6c20('0x47')]=function(_0x1202d3,_0x193888,_0x2ac8e1){var _0x2ea08f={};var _0x39803e={};var _0x24d509;var _0x13a7d8;return db['ZohoAccount'][_0x6c20('0x48')]({'where':{'id':_0x1202d3[_0x6c20('0x41')]['id']}})[_0x6c20('0x23')](handleEntityNotFound(_0x193888,null))[_0x6c20('0x23')](function(_0x1557e1){if(_0x1557e1){_0x24d509=_0x1557e1;_0x39803e[_0x6c20('0x2b')]=_[_0x6c20('0x2d')](db['ZohoConfiguration'][_0x6c20('0x42')]);_0x39803e[_0x6c20('0x2c')]=_[_0x6c20('0x2d')](_0x1202d3['query']);_0x39803e[_0x6c20('0x2e')]=_[_0x6c20('0x2f')](_0x39803e[_0x6c20('0x2b')],_0x39803e[_0x6c20('0x2c')]);_0x2ea08f[_0x6c20('0x30')]=_[_0x6c20('0x2f')](_0x39803e[_0x6c20('0x2b')],qs[_0x6c20('0x31')](_0x1202d3[_0x6c20('0x2c')][_0x6c20('0x31')]));_0x2ea08f[_0x6c20('0x30')]=_0x2ea08f['attributes'][_0x6c20('0x32')]?_0x2ea08f['attributes']:_0x39803e[_0x6c20('0x2b')];_0x2ea08f[_0x6c20('0x34')]=qs[_0x6c20('0x35')](_0x1202d3[_0x6c20('0x2c')][_0x6c20('0x35')]);_0x2ea08f[_0x6c20('0x36')]=qs[_0x6c20('0x2e')](_['pick'](_0x1202d3[_0x6c20('0x2c')],_0x39803e[_0x6c20('0x2e')]));if(_0x1202d3[_0x6c20('0x2c')][_0x6c20('0x38')]){_0x2ea08f[_0x6c20('0x36')]=_[_0x6c20('0x39')](_0x2ea08f['where'],{'$or':_['map'](_0x2ea08f[_0x6c20('0x30')],function(_0x20b9c1){var _0x15a047={};_0x15a047[_0x20b9c1]={'$like':'%'+_0x1202d3[_0x6c20('0x2c')]['filter']+'%'};return _0x15a047;})});}_0x2ea08f=_[_0x6c20('0x39')]({},_0x2ea08f,_0x1202d3['options']);return _0x24d509['getConfigurations'](_0x2ea08f);}})[_0x6c20('0x23')](function(_0x40ea96){if(_0x40ea96){_0x13a7d8=_0x40ea96[_0x6c20('0x32')];if(!_0x1202d3['query'][_0x6c20('0x33')]('nolimit')){_0x2ea08f['limit']=qs[_0x6c20('0x1d')](_0x1202d3[_0x6c20('0x2c')][_0x6c20('0x1d')]);_0x2ea08f[_0x6c20('0x1c')]=qs[_0x6c20('0x1c')](_0x1202d3[_0x6c20('0x2c')]['offset']);}return _0x24d509[_0x6c20('0x47')](_0x2ea08f);}})[_0x6c20('0x23')](function(_0x4f62fd){if(_0x4f62fd){return _0x4f62fd?{'count':_0x13a7d8,'rows':_0x4f62fd}:null;}})[_0x6c20('0x23')](respondWithResult(_0x193888,null))[_0x6c20('0x3f')](handleError(_0x193888,null));};exports[_0x6c20('0x49')]=function(_0x301e89,_0x4f5f48,_0x2a5256){if(_0x301e89[_0x6c20('0x46')]['id']){delete _0x301e89['body']['id'];}return db['ZohoAccount']['findOne']({'where':{'id':_0x301e89[_0x6c20('0x41')]['id']}})[_0x6c20('0x23')](handleEntityNotFound(_0x4f5f48,null))[_0x6c20('0x23')](function(_0x457bf4){if(_0x457bf4){_0x301e89[_0x6c20('0x46')][_0x6c20('0x4a')]=_0x457bf4['id'];_0x301e89[_0x6c20('0x46')][_0x6c20('0x4b')]=integrations['getSubjects'](_0x301e89['body']['channel'],_0x301e89[_0x6c20('0x46')][_0x6c20('0x29')]);_0x301e89['body'][_0x6c20('0x4c')]=integrations[_0x6c20('0x4d')](_0x301e89[_0x6c20('0x46')][_0x6c20('0x4e')],_0x301e89[_0x6c20('0x46')]['type']);return db['ZohoConfiguration'][_0x6c20('0x45')](_0x301e89['body'],{'include':[{'model':db[_0x6c20('0x4f')],'as':'Subjects'},{'model':db[_0x6c20('0x4f')],'as':_0x6c20('0x4c')}]});}return null;})[_0x6c20('0x23')](respondWithResult(_0x4f5f48,null))[_0x6c20('0x3f')](handleError(_0x4f5f48,null));};function getAccessToken(_0x51a810){return new Promise(function(_0x47cbb8,_0x55f692){var _0x4c9783;switch(_0x51a810[_0x6c20('0x50')]){case'US':_0x4c9783=_0x6c20('0x51');break;case'AU':_0x4c9783='https://accounts.zoho.com.au';break;case'EU':_0x4c9783=_0x6c20('0x52');break;case'IN':_0x4c9783=_0x6c20('0x53');break;case'CN':_0x4c9783=_0x6c20('0x54');break;default:_0x4c9783=_0x6c20('0x52');break;}var _0x43a23d={'method':_0x6c20('0x55'),'uri':_0x4c9783+_0x6c20('0x56'),'qs':{'refresh_token':_0x51a810['refreshToken'],'client_id':_0x51a810[_0x6c20('0x57')],'client_secret':_0x51a810[_0x6c20('0x58')],'grant_type':_0x6c20('0x59')},'json':!![]};return rp(_0x43a23d)[_0x6c20('0x23')](function(_0x51d73e){if(_0x51d73e[_0x6c20('0x5a')]){_0x47cbb8(_0x51d73e[_0x6c20('0x5a')]);}else{_0x55f692('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0x6c20('0x3f')](function(_0x2f53df){_0x55f692(_0x2f53df);});});}exports['getFields']=function(_0x3efebf,_0x2d6233,_0x3a7f23){var _0x307025,_0x4055a1,_0x281066,_0x327c39,_0x350ccc;return db[_0x6c20('0x28')][_0x6c20('0x48')]({'where':{'id':_0x3efebf['params']['id']},'attributes':['id','host',_0x6c20('0x50'),'clientId',_0x6c20('0x58'),_0x6c20('0x5b'),_0x6c20('0x5c'),_0x6c20('0x5d')]})[_0x6c20('0x23')](handleEntityNotFound(_0x2d6233,null))['then'](function(_0x8d9b3e){_0x350ccc=_0x8d9b3e;_0x307025=_0x350ccc[_0x6c20('0x5e')];_0x4055a1=_0x307025===_0x6c20('0x5f')?'eu':'com';_0x281066=_0x350ccc[_0x6c20('0x5b')];var _0x1ce4dc=_0x281066[_0x6c20('0x60')](-0x1);if(_0x1ce4dc==='/'||_0x1ce4dc==='\x5c'||_0x1ce4dc===':'){_0x281066=_0x281066['substring'](0x0,_0x281066[_0x6c20('0x61')](_0x1ce4dc));}if(!_0x350ccc[_0x6c20('0x5d')]){throw new Error(_0x6c20('0x62'));}return getAccessToken(_0x350ccc);})[_0x6c20('0x23')](function(_0x38d632){if(_0x38d632){return rp({'method':'GET','uri':util['format'](_0x6c20('0x63'),_0x4055a1),'qs':{'module':_0x6c20('0x64')},'headers':{'Authorization':_0x6c20('0x65')+_0x38d632},'json':!![]});}})[_0x6c20('0x23')](function(_0xeaf326){if(_0xeaf326){if(_0xeaf326[_0x6c20('0x66')]&&_0xeaf326['response']['error']){throw new Error(_0xeaf326[_0x6c20('0x66')][_0x6c20('0x24')]['message']);}var _0x1efa24=[];var _0x24f104=[];var _0x3ca004=[_0x6c20('0x67'),_0x6c20('0x68'),_0x6c20('0x69'),'WhoId',_0x6c20('0x6a'),_0x6c20('0x6b'),_0x6c20('0x6c'),_0x6c20('0x6d')];_0x24f104=_['remove'](_0xeaf326['fields'],function(_0x47baf8){return _0x3ca004['includes'](_0x47baf8[_0x6c20('0x6e')]);});for(var _0x39b38f=0x0;_0x39b38f<_0x24f104[_0x6c20('0x32')];_0x39b38f++){if(_0x24f104[_0x39b38f][_0x6c20('0x6f')]===![]){_0x1efa24[_0x6c20('0x70')]({'id':_0x24f104[_0x39b38f]['id'],'name':_0x24f104[_0x39b38f][_0x6c20('0x71')],'custom':_0x24f104[_0x39b38f][_0x6c20('0x72')],'options':_0x24f104[_0x39b38f]['data_type']===_0x6c20('0x73')&&_0x24f104[_0x39b38f][_0x6c20('0x74')]['length']>-0x1?_[_0x6c20('0x27')](_0x24f104[_0x39b38f][_0x6c20('0x74')],function(_0xaa4558){return{'name':_0xaa4558,'value':_0xaa4558};}):[]});}}return{'count':_0x1efa24[_0x6c20('0x32')],'rows':_0x1efa24};}else{return{'count':0x0,'rows':[]};}})[_0x6c20('0x23')](respondWithResult(_0x2d6233,null))[_0x6c20('0x3f')](function(_0x243526){var _0x3d59c1=_0x3efebf[_0x6c20('0x2c')][_0x6c20('0x75')]?0x1f4:_0x243526['statusCode']||0x1f4;logger[_0x6c20('0x24')](_0x6c20('0x76'),_0x6c20('0x77'),_0x3d59c1,JSON[_0x6c20('0x78')](_0x243526));delete _0x243526[_0x6c20('0x25')];if(_0x3d59c1===0x191){_0x3d59c1=0x190;}_0x2d6233[_0x6c20('0x19')](_0x3d59c1)['send'](_0x3efebf[_0x6c20('0x2c')][_0x6c20('0x75')]?{'message':'Wrong\x20credentials','statusCode':_0x243526[_0x6c20('0x79')]}:_0x243526);});}; \ No newline at end of file +var _0xb7b0=['ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','undefined','limit','set','apply','save','update','then','destroy','sendStatus','error','stack','name','index','ZohoAccount','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','count','include','findAll','rows','catch','show','params','rawAttributes','includeAll','create','body','find','getConfigurations','findOne','ZohoConfiguration','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','channel','zone','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','serverUrl','code','host','zoho.eu','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','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','picklist','pick_list_values','test','getFields,\x20%s,\x20%s,\x20%s','stringify','statusCode','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x5251a2,_0x2423b9){var _0x24f106=function(_0x209dd1){while(--_0x209dd1){_0x5251a2['push'](_0x5251a2['shift']());}};_0x24f106(++_0x2423b9);}(_0xb7b0,0x1e5));var _0x0b7b=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0xb7b0[_0x273c39];return _0x46d6b5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0b7b('0x0'));var zipdir=require(_0x0b7b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0b7b('0x2'));var moment=require(_0x0b7b('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0b7b('0x4'));var util=require(_0x0b7b('0x5'));var path=require(_0x0b7b('0x6'));var sox=require(_0x0b7b('0x7'));var csv=require(_0x0b7b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0b7b('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x0b7b('0xa'));var jsforce=require(_0x0b7b('0xb'));var deskjs=require(_0x0b7b('0xc'));var toCsv=require(_0x0b7b('0x8'));var querystring=require(_0x0b7b('0xd'));var Papa=require(_0x0b7b('0xe'));var Redis=require(_0x0b7b('0xf'));var authService=require(_0x0b7b('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0b7b('0x11'));var logger=require(_0x0b7b('0x12'))(_0x0b7b('0x13'));var utils=require(_0x0b7b('0x14'));var config=require(_0x0b7b('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x0b7b('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x4219d3,_0x48ec50){_0x48ec50=_0x48ec50||0xcc;return function(_0x33f444){if(_0x33f444){return _0x4219d3['sendStatus'](_0x48ec50);}return _0x4219d3[_0x0b7b('0x17')](_0x48ec50)[_0x0b7b('0x18')]();};}function respondWithResult(_0x5c016b,_0x246c46){_0x246c46=_0x246c46||0xc8;return function(_0x31c8f8){if(_0x31c8f8){return _0x5c016b[_0x0b7b('0x17')](_0x246c46)['json'](_0x31c8f8);}};}function respondWithFilteredResult(_0x358a7a,_0xebb54b){return function(_0x4b602c){if(_0x4b602c){var _0xcfee4b=typeof _0xebb54b[_0x0b7b('0x19')]===_0x0b7b('0x1a')&&typeof _0xebb54b[_0x0b7b('0x1b')]==='undefined';var _0xe9f581=_0x4b602c['count'];var _0x194066=_0xcfee4b?0x0:_0xebb54b['offset'];var _0x1e1517=_0xcfee4b?_0x4b602c['count']:_0xebb54b[_0x0b7b('0x19')]+_0xebb54b['limit'];var _0x409c97;if(_0x1e1517>=_0xe9f581){_0x1e1517=_0xe9f581;_0x409c97=0xc8;}else{_0x409c97=0xce;}_0x358a7a[_0x0b7b('0x17')](_0x409c97);return _0x358a7a[_0x0b7b('0x1c')]('Content-Range',_0x194066+'-'+_0x1e1517+'/'+_0xe9f581)['json'](_0x4b602c);}return null;};}function patchUpdates(_0x11009f){return function(_0x4604fd){try{jsonpatch[_0x0b7b('0x1d')](_0x4604fd,_0x11009f,!![]);}catch(_0x136719){return BPromise['reject'](_0x136719);}return _0x4604fd[_0x0b7b('0x1e')]();};}function saveUpdates(_0x3e8c27,_0x44a9fa){return function(_0x235647){if(_0x235647){return _0x235647[_0x0b7b('0x1f')](_0x3e8c27)[_0x0b7b('0x20')](function(_0x2a9ddd){return _0x2a9ddd;});}return null;};}function removeEntity(_0x5b45e6,_0xa8aebc){return function(_0x743750){if(_0x743750){return _0x743750[_0x0b7b('0x21')]()['then'](function(){_0x5b45e6[_0x0b7b('0x17')](0xcc)[_0x0b7b('0x18')]();});}};}function handleEntityNotFound(_0x4b537d,_0xcf4647){return function(_0x3c0200){if(!_0x3c0200){_0x4b537d[_0x0b7b('0x22')](0x194);}return _0x3c0200;};}function handleError(_0x2b162c,_0x452b4e){_0x452b4e=_0x452b4e||0x1f4;return function(_0x4df60d){logger[_0x0b7b('0x23')](_0x4df60d[_0x0b7b('0x24')]);if(_0x4df60d[_0x0b7b('0x25')]){delete _0x4df60d[_0x0b7b('0x25')];}_0x2b162c[_0x0b7b('0x17')](_0x452b4e)['send'](_0x4df60d);};}exports[_0x0b7b('0x26')]=function(_0x130c52,_0x1635eb){var _0x1b92d7={},_0x3b123d={},_0x4069ab={'count':0x0,'rows':[]};var _0xe5fea8=_['map'](db[_0x0b7b('0x27')]['rawAttributes'],function(_0x47165b){return{'name':_0x47165b['fieldName'],'type':_0x47165b[_0x0b7b('0x28')][_0x0b7b('0x29')]};});_0x3b123d[_0x0b7b('0x2a')]=_[_0x0b7b('0x2b')](_0xe5fea8,_0x0b7b('0x25'));_0x3b123d[_0x0b7b('0x2c')]=_[_0x0b7b('0x2d')](_0x130c52[_0x0b7b('0x2c')]);_0x3b123d[_0x0b7b('0x2e')]=_[_0x0b7b('0x2f')](_0x3b123d[_0x0b7b('0x2a')],_0x3b123d[_0x0b7b('0x2c')]);_0x1b92d7[_0x0b7b('0x30')]=_[_0x0b7b('0x2f')](_0x3b123d[_0x0b7b('0x2a')],qs[_0x0b7b('0x31')](_0x130c52[_0x0b7b('0x2c')][_0x0b7b('0x31')]));_0x1b92d7[_0x0b7b('0x30')]=_0x1b92d7[_0x0b7b('0x30')][_0x0b7b('0x32')]?_0x1b92d7[_0x0b7b('0x30')]:_0x3b123d[_0x0b7b('0x2a')];if(!_0x130c52[_0x0b7b('0x2c')][_0x0b7b('0x33')](_0x0b7b('0x34'))){_0x1b92d7['limit']=qs[_0x0b7b('0x1b')](_0x130c52[_0x0b7b('0x2c')][_0x0b7b('0x1b')]);_0x1b92d7[_0x0b7b('0x19')]=qs['offset'](_0x130c52['query'][_0x0b7b('0x19')]);}_0x1b92d7[_0x0b7b('0x35')]=qs[_0x0b7b('0x36')](_0x130c52[_0x0b7b('0x2c')][_0x0b7b('0x36')]);_0x1b92d7[_0x0b7b('0x37')]=qs[_0x0b7b('0x2e')](_[_0x0b7b('0x38')](_0x130c52[_0x0b7b('0x2c')],_0x3b123d[_0x0b7b('0x2e')]),_0xe5fea8);if(_0x130c52[_0x0b7b('0x2c')][_0x0b7b('0x39')]){_0x1b92d7['where']=_['merge'](_0x1b92d7[_0x0b7b('0x37')],{'$or':_[_0x0b7b('0x2b')](_0xe5fea8,function(_0x3b7a34){if(_0x3b7a34[_0x0b7b('0x28')]!==_0x0b7b('0x3a')){var _0x16ae6c={};_0x16ae6c[_0x3b7a34[_0x0b7b('0x25')]]={'$like':'%'+_0x130c52[_0x0b7b('0x2c')][_0x0b7b('0x39')]+'%'};return _0x16ae6c;}})});}_0x1b92d7=_[_0x0b7b('0x3b')]({},_0x1b92d7,_0x130c52['options']);var _0x3d433a={'where':_0x1b92d7['where']};return db[_0x0b7b('0x27')][_0x0b7b('0x3c')](_0x3d433a)[_0x0b7b('0x20')](function(_0x3533fd){_0x4069ab[_0x0b7b('0x3c')]=_0x3533fd;if(_0x130c52[_0x0b7b('0x2c')]['includeAll']){_0x1b92d7[_0x0b7b('0x3d')]=[{'all':!![]}];}return db['ZohoAccount'][_0x0b7b('0x3e')](_0x1b92d7);})[_0x0b7b('0x20')](function(_0x2484a1){_0x4069ab[_0x0b7b('0x3f')]=_0x2484a1;return _0x4069ab;})[_0x0b7b('0x20')](respondWithFilteredResult(_0x1635eb,_0x1b92d7))[_0x0b7b('0x40')](handleError(_0x1635eb,null));};exports[_0x0b7b('0x41')]=function(_0x8e5d44,_0x4fc8a8){var _0x1b56d4={'raw':![],'where':{'id':_0x8e5d44[_0x0b7b('0x42')]['id']}},_0x5169c4={};_0x5169c4['model']=_[_0x0b7b('0x2d')](db[_0x0b7b('0x27')][_0x0b7b('0x43')]);_0x5169c4[_0x0b7b('0x2c')]=_[_0x0b7b('0x2d')](_0x8e5d44[_0x0b7b('0x2c')]);_0x5169c4[_0x0b7b('0x2e')]=_[_0x0b7b('0x2f')](_0x5169c4[_0x0b7b('0x2a')],_0x5169c4[_0x0b7b('0x2c')]);_0x1b56d4[_0x0b7b('0x30')]=_[_0x0b7b('0x2f')](_0x5169c4[_0x0b7b('0x2a')],qs[_0x0b7b('0x31')](_0x8e5d44[_0x0b7b('0x2c')]['fields']));_0x1b56d4[_0x0b7b('0x30')]=_0x1b56d4[_0x0b7b('0x30')][_0x0b7b('0x32')]?_0x1b56d4[_0x0b7b('0x30')]:_0x5169c4['model'];if(_0x8e5d44['query'][_0x0b7b('0x44')]){_0x1b56d4['include']=[{'all':!![]}];}_0x1b56d4=_[_0x0b7b('0x3b')]({},_0x1b56d4,_0x8e5d44['options']);return db[_0x0b7b('0x27')]['find'](_0x1b56d4)[_0x0b7b('0x20')](handleEntityNotFound(_0x4fc8a8,null))[_0x0b7b('0x20')](respondWithResult(_0x4fc8a8,null))[_0x0b7b('0x40')](handleError(_0x4fc8a8,null));};exports[_0x0b7b('0x45')]=function(_0xf9116e,_0x2d4d2c){return db[_0x0b7b('0x27')][_0x0b7b('0x45')](_0xf9116e[_0x0b7b('0x46')],{})[_0x0b7b('0x20')](respondWithResult(_0x2d4d2c,0xc9))[_0x0b7b('0x40')](handleError(_0x2d4d2c,null));};exports[_0x0b7b('0x1f')]=function(_0x5de3a8,_0x558b9a){if(_0x5de3a8[_0x0b7b('0x46')]['id']){delete _0x5de3a8[_0x0b7b('0x46')]['id'];}return db['ZohoAccount'][_0x0b7b('0x47')]({'where':{'id':_0x5de3a8['params']['id']}})[_0x0b7b('0x20')](handleEntityNotFound(_0x558b9a,null))['then'](saveUpdates(_0x5de3a8[_0x0b7b('0x46')],null))[_0x0b7b('0x20')](respondWithResult(_0x558b9a,null))[_0x0b7b('0x40')](handleError(_0x558b9a,null));};exports[_0x0b7b('0x21')]=function(_0x5cd829,_0x553cbd){return db[_0x0b7b('0x27')]['find']({'where':{'id':_0x5cd829[_0x0b7b('0x42')]['id']}})[_0x0b7b('0x20')](handleEntityNotFound(_0x553cbd,null))[_0x0b7b('0x20')](removeEntity(_0x553cbd,null))[_0x0b7b('0x40')](handleError(_0x553cbd,null));};exports[_0x0b7b('0x48')]=function(_0x11dc19,_0x433500,_0x266238){var _0x4680d4={};var _0x5c0b23={};var _0x5a7191;var _0x2c516c;return db['ZohoAccount'][_0x0b7b('0x49')]({'where':{'id':_0x11dc19[_0x0b7b('0x42')]['id']}})[_0x0b7b('0x20')](handleEntityNotFound(_0x433500,null))[_0x0b7b('0x20')](function(_0x2a14bd){if(_0x2a14bd){_0x5a7191=_0x2a14bd;_0x5c0b23[_0x0b7b('0x2a')]=_[_0x0b7b('0x2d')](db[_0x0b7b('0x4a')][_0x0b7b('0x43')]);_0x5c0b23[_0x0b7b('0x2c')]=_[_0x0b7b('0x2d')](_0x11dc19['query']);_0x5c0b23[_0x0b7b('0x2e')]=_[_0x0b7b('0x2f')](_0x5c0b23[_0x0b7b('0x2a')],_0x5c0b23['query']);_0x4680d4[_0x0b7b('0x30')]=_[_0x0b7b('0x2f')](_0x5c0b23[_0x0b7b('0x2a')],qs[_0x0b7b('0x31')](_0x11dc19[_0x0b7b('0x2c')][_0x0b7b('0x31')]));_0x4680d4[_0x0b7b('0x30')]=_0x4680d4['attributes'][_0x0b7b('0x32')]?_0x4680d4['attributes']:_0x5c0b23[_0x0b7b('0x2a')];_0x4680d4[_0x0b7b('0x35')]=qs[_0x0b7b('0x36')](_0x11dc19['query'][_0x0b7b('0x36')]);_0x4680d4['where']=qs['filters'](_[_0x0b7b('0x38')](_0x11dc19[_0x0b7b('0x2c')],_0x5c0b23[_0x0b7b('0x2e')]));if(_0x11dc19[_0x0b7b('0x2c')][_0x0b7b('0x39')]){_0x4680d4['where']=_[_0x0b7b('0x3b')](_0x4680d4[_0x0b7b('0x37')],{'$or':_[_0x0b7b('0x2b')](_0x4680d4['attributes'],function(_0x5245ec){var _0x28385a={};_0x28385a[_0x5245ec]={'$like':'%'+_0x11dc19['query'][_0x0b7b('0x39')]+'%'};return _0x28385a;})});}_0x4680d4=_[_0x0b7b('0x3b')]({},_0x4680d4,_0x11dc19['options']);return _0x5a7191['getConfigurations'](_0x4680d4);}})[_0x0b7b('0x20')](function(_0x4b21f3){if(_0x4b21f3){_0x2c516c=_0x4b21f3[_0x0b7b('0x32')];if(!_0x11dc19[_0x0b7b('0x2c')][_0x0b7b('0x33')](_0x0b7b('0x34'))){_0x4680d4['limit']=qs[_0x0b7b('0x1b')](_0x11dc19[_0x0b7b('0x2c')][_0x0b7b('0x1b')]);_0x4680d4[_0x0b7b('0x19')]=qs[_0x0b7b('0x19')](_0x11dc19[_0x0b7b('0x2c')][_0x0b7b('0x19')]);}return _0x5a7191[_0x0b7b('0x48')](_0x4680d4);}})[_0x0b7b('0x20')](function(_0x98c874){if(_0x98c874){return _0x98c874?{'count':_0x2c516c,'rows':_0x98c874}:null;}})[_0x0b7b('0x20')](respondWithResult(_0x433500,null))[_0x0b7b('0x40')](handleError(_0x433500,null));};exports[_0x0b7b('0x4b')]=function(_0x574ad7,_0x4881a6,_0x39c574){if(_0x574ad7[_0x0b7b('0x46')]['id']){delete _0x574ad7['body']['id'];}return db[_0x0b7b('0x27')]['findOne']({'where':{'id':_0x574ad7['params']['id']}})[_0x0b7b('0x20')](handleEntityNotFound(_0x4881a6,null))[_0x0b7b('0x20')](function(_0x15a31a){if(_0x15a31a){_0x574ad7[_0x0b7b('0x46')][_0x0b7b('0x4c')]=_0x15a31a['id'];_0x574ad7['body'][_0x0b7b('0x4d')]=integrations[_0x0b7b('0x4e')](_0x574ad7['body']['channel'],_0x574ad7['body']['type']);_0x574ad7['body'][_0x0b7b('0x4f')]=integrations['getDescriptions'](_0x574ad7['body'][_0x0b7b('0x50')],_0x574ad7[_0x0b7b('0x46')]['type']);return db[_0x0b7b('0x4a')][_0x0b7b('0x45')](_0x574ad7[_0x0b7b('0x46')],{'include':[{'model':db['ZohoField'],'as':_0x0b7b('0x4d')},{'model':db['ZohoField'],'as':_0x0b7b('0x4f')}]});}return null;})[_0x0b7b('0x20')](respondWithResult(_0x4881a6,null))[_0x0b7b('0x40')](handleError(_0x4881a6,null));};function getAccessToken(_0x362031){return new Promise(function(_0x133b8e,_0xa56c16){var _0x21e6ba;switch(_0x362031[_0x0b7b('0x51')]){case'US':_0x21e6ba='https://accounts.zoho.com';break;case'AU':_0x21e6ba=_0x0b7b('0x52');break;case'EU':_0x21e6ba='https://accounts.zoho.eu';break;case'IN':_0x21e6ba=_0x0b7b('0x53');break;case'CN':_0x21e6ba='https://accounts.zoho.com.cn';break;default:_0x21e6ba=_0x0b7b('0x54');break;}var _0x3eaa9e={'method':_0x0b7b('0x55'),'uri':_0x21e6ba+_0x0b7b('0x56'),'qs':{'refresh_token':_0x362031[_0x0b7b('0x57')],'client_id':_0x362031[_0x0b7b('0x58')],'client_secret':_0x362031[_0x0b7b('0x59')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x3eaa9e)['then'](function(_0x542770){if(_0x542770['access_token']){_0x133b8e(_0x542770[_0x0b7b('0x5a')]);}else{_0xa56c16(_0x0b7b('0x5b'));}})[_0x0b7b('0x40')](function(_0x5964a9){_0xa56c16(_0x5964a9);});});}exports['getFields']=function(_0xfa06a4,_0x34fece,_0x3610a0){var _0x120368,_0x4cfab9,_0x20379d,_0x4829e2,_0x5ae43d;return db[_0x0b7b('0x27')][_0x0b7b('0x49')]({'where':{'id':_0xfa06a4[_0x0b7b('0x42')]['id']},'attributes':['id','host',_0x0b7b('0x51'),'clientId','clientSecret',_0x0b7b('0x5c'),_0x0b7b('0x5d'),_0x0b7b('0x57')]})[_0x0b7b('0x20')](handleEntityNotFound(_0x34fece,null))[_0x0b7b('0x20')](function(_0x14be11){_0x5ae43d=_0x14be11;_0x120368=_0x5ae43d[_0x0b7b('0x5e')];_0x4cfab9=_0x120368===_0x0b7b('0x5f')?'eu':_0x0b7b('0x60');_0x20379d=_0x5ae43d[_0x0b7b('0x5c')];var _0x31573d=_0x20379d[_0x0b7b('0x61')](-0x1);if(_0x31573d==='/'||_0x31573d==='\x5c'||_0x31573d===':'){_0x20379d=_0x20379d[_0x0b7b('0x62')](0x0,_0x20379d[_0x0b7b('0x63')](_0x31573d));}if(!_0x5ae43d['refreshToken']){throw new Error(_0x0b7b('0x64'));}return getAccessToken(_0x5ae43d);})['then'](function(_0x3ad480){if(_0x3ad480){return rp({'method':_0x0b7b('0x65'),'uri':util[_0x0b7b('0x66')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x4cfab9),'qs':{'module':'Calls'},'headers':{'Authorization':_0x0b7b('0x67')+_0x3ad480},'json':!![]});}})[_0x0b7b('0x20')](function(_0x12efed){if(_0x12efed){if(_0x12efed[_0x0b7b('0x68')]&&_0x12efed[_0x0b7b('0x68')][_0x0b7b('0x23')]){throw new Error(_0x12efed['response'][_0x0b7b('0x23')]['message']);}var _0x5910dc=[];var _0x34056c=[];var _0x3a3548=['Owner',_0x0b7b('0x69'),_0x0b7b('0x6a'),_0x0b7b('0x6b'),_0x0b7b('0x6c'),_0x0b7b('0x6d'),_0x0b7b('0x6e'),_0x0b7b('0x6f')];_0x34056c=_[_0x0b7b('0x70')](_0x12efed[_0x0b7b('0x31')],function(_0x224ef4){return _0x3a3548[_0x0b7b('0x71')](_0x224ef4[_0x0b7b('0x72')]);});for(var _0x385224=0x0;_0x385224<_0x34056c['length'];_0x385224++){if(_0x34056c[_0x385224][_0x0b7b('0x73')]===![]){_0x5910dc[_0x0b7b('0x74')]({'id':_0x34056c[_0x385224]['id'],'name':_0x34056c[_0x385224][_0x0b7b('0x75')],'custom':_0x34056c[_0x385224][_0x0b7b('0x76')],'options':_0x34056c[_0x385224]['data_type']===_0x0b7b('0x77')&&_0x34056c[_0x385224][_0x0b7b('0x78')][_0x0b7b('0x32')]>-0x1?_[_0x0b7b('0x2b')](_0x34056c[_0x385224]['pick_list_values'],function(_0x5d301e){return{'name':_0x5d301e,'value':_0x5d301e};}):[]});}}return{'count':_0x5910dc['length'],'rows':_0x5910dc};}else{return{'count':0x0,'rows':[]};}})[_0x0b7b('0x20')](respondWithResult(_0x34fece,null))[_0x0b7b('0x40')](function(_0x225de0){var _0x1f4016=_0xfa06a4[_0x0b7b('0x2c')][_0x0b7b('0x79')]?0x1f4:_0x225de0['statusCode']||0x1f4;logger[_0x0b7b('0x23')](_0x0b7b('0x7a'),'getFields',_0x1f4016,JSON[_0x0b7b('0x7b')](_0x225de0));delete _0x225de0[_0x0b7b('0x25')];if(_0x1f4016===0x191){_0x1f4016=0x190;}_0x34fece[_0x0b7b('0x17')](_0x1f4016)['send'](_0xfa06a4['query'][_0x0b7b('0x79')]?{'message':'Wrong\x20credentials','statusCode':_0x225de0[_0x0b7b('0x7c')]}:_0x225de0);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 4de7247..eb219fe 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 _0x7537=['POST','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','info','format','name','inspect','error','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','catch','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./intZohoAccount.attributes','define','ZohoAccount','int_zoho_accounts','changed','serverUrl','clientId','clientSecret','code','host','slice','substring','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.eu'];(function(_0x4a81b8,_0x26abb9){var _0x480a76=function(_0x45c2c5){while(--_0x45c2c5){_0x4a81b8['push'](_0x4a81b8['shift']());}};_0x480a76(++_0x26abb9);}(_0x7537,0x106));var _0x7753=function(_0x1c0940,_0x589a48){_0x1c0940=_0x1c0940-0x0;var _0x147d75=_0x7537[_0x1c0940];return _0x147d75;};'use strict';var _=require(_0x7753('0x0'));var util=require(_0x7753('0x1'));var logger=require(_0x7753('0x2'))(_0x7753('0x3'));var moment=require('moment');var BPromise=require(_0x7753('0x4'));var rp=require(_0x7753('0x5'));var fs=require('fs');var path=require(_0x7753('0x6'));var rimraf=require('rimraf');var config=require(_0x7753('0x7'));var attributes=require(_0x7753('0x8'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0xaadf44,_0x2a6f9d){return _0xaadf44[_0x7753('0x9')](_0x7753('0xa'),attributes,{'tableName':_0x7753('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x528dbe,_0xb3878b,_0x1702f6){if(_0x528dbe[_0x7753('0xc')]('zone')||_0x528dbe[_0x7753('0xc')](_0x7753('0xd'))||_0x528dbe[_0x7753('0xc')](_0x7753('0xe'))||_0x528dbe['changed'](_0x7753('0xf'))||_0x528dbe[_0x7753('0xc')](_0x7753('0x10'))||_0x528dbe[_0x7753('0xc')](_0x7753('0x11'))){var _0x3a8ded,_0x5e4253;_0x3a8ded=_0x528dbe[_0x7753('0xd')];var _0x38447d=_0x3a8ded[_0x7753('0x12')](-0x1);if(_0x38447d==='/'||_0x38447d==='\x5c'||_0x38447d===':'){_0x3a8ded=_0x3a8ded[_0x7753('0x13')](0x0,_0x3a8ded['lastIndexOf'](_0x38447d));}switch(_0x528dbe[_0x7753('0x14')]){case'US':_0x5e4253=_0x7753('0x15');break;case'AU':_0x5e4253=_0x7753('0x16');break;case'IN':_0x5e4253=_0x7753('0x17');break;case'CN':_0x5e4253='https://accounts.zoho.com.cn';break;default:_0x5e4253=_0x7753('0x18');break;}var _0x50cb7b={'method':_0x7753('0x19'),'uri':_0x5e4253+_0x7753('0x1a'),'form':{'grant_type':_0x7753('0x1b'),'client_id':_0x528dbe[_0x7753('0xe')],'client_secret':_0x528dbe['clientSecret'],'redirect_uri':_0x528dbe[_0x7753('0xd')],'code':_0x528dbe[_0x7753('0x10')]},'headers':{'Content-Type':_0x7753('0x1c')}};return rp(_0x50cb7b)[_0x7753('0x1d')](function(_0x2f88a7){var _0x171c97=JSON[_0x7753('0x1e')](_0x2f88a7);if(_0x171c97[_0x7753('0x1f')]){_0x528dbe[_0x7753('0x20')]=_0x171c97[_0x7753('0x1f')];logger[_0x7753('0x21')](util['format']('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x528dbe['name'],_0x528dbe['id']));}else{logger['error'](util[_0x7753('0x22')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x528dbe[_0x7753('0x23')],_0x528dbe['id']),util[_0x7753('0x24')](_0x171c97,{'showHidden':![],'depth':null}));}return _0x1702f6(null,_0xb3878b);})['catch'](function(_0x398676){logger[_0x7753('0x25')](util[_0x7753('0x22')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x528dbe[_0x7753('0x23')],_0x528dbe['id']),util[_0x7753('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x1702f6(_0x398676);});}else{return _0x1702f6(null,_0xb3878b);}},'beforeUpdate':function(_0x5ee77e,_0xa19fec,_0x5d5925){if(_0x5ee77e['changed'](_0x7753('0x14'))||_0x5ee77e['changed'](_0x7753('0xd'))||_0x5ee77e[_0x7753('0xc')](_0x7753('0xe'))||_0x5ee77e[_0x7753('0xc')](_0x7753('0xf'))||_0x5ee77e[_0x7753('0xc')](_0x7753('0x10'))||_0x5ee77e[_0x7753('0xc')](_0x7753('0x11'))){var _0x4d08dd,_0x1cc173;_0x4d08dd=_0x5ee77e[_0x7753('0xd')];var _0x2a7c0d=_0x4d08dd[_0x7753('0x12')](-0x1);if(_0x2a7c0d==='/'||_0x2a7c0d==='\x5c'||_0x2a7c0d===':'){_0x4d08dd=_0x4d08dd['substring'](0x0,_0x4d08dd['lastIndexOf'](_0x2a7c0d));}switch(_0x5ee77e['zone']){case'US':_0x1cc173=_0x7753('0x15');break;case'AU':_0x1cc173=_0x7753('0x16');break;case'IN':_0x1cc173='https://accounts.zoho.in';break;case'CN':_0x1cc173='https://accounts.zoho.com.cn';break;default:_0x1cc173=_0x7753('0x18');break;}var _0x2808f8={'method':_0x7753('0x19'),'uri':_0x1cc173+'/oauth/v2/token','form':{'grant_type':_0x7753('0x1b'),'client_id':_0x5ee77e[_0x7753('0xe')],'client_secret':_0x5ee77e[_0x7753('0xf')],'redirect_uri':_0x5ee77e['serverUrl'],'code':_0x5ee77e[_0x7753('0x10')]},'headers':{'Content-Type':_0x7753('0x1c')}};return rp(_0x2808f8)[_0x7753('0x1d')](function(_0x328765){var _0x273ece=JSON[_0x7753('0x1e')](_0x328765);if(_0x273ece[_0x7753('0x1f')]){_0x5ee77e[_0x7753('0x20')]=_0x273ece[_0x7753('0x1f')];logger[_0x7753('0x21')](util[_0x7753('0x22')](_0x7753('0x26'),_0x5ee77e[_0x7753('0x23')],_0x5ee77e['id']));}else{logger['error'](util[_0x7753('0x22')](_0x7753('0x27'),_0x5ee77e['name'],_0x5ee77e['id']),util[_0x7753('0x24')](_0x273ece,{'showHidden':![],'depth':null}));}return _0x5d5925(null,_0xa19fec);})[_0x7753('0x28')](function(_0x50a964){logger[_0x7753('0x25')](util[_0x7753('0x22')](_0x7753('0x27'),_0x5ee77e[_0x7753('0x23')],_0x5ee77e['id']),util[_0x7753('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x5d5925(_0x50a964);});}else{return _0x5d5925(null,_0xa19fec);}}}});}; \ No newline at end of file +var _0xce5a=['https://accounts.zoho.eu','POST','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','info','format','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','name','inspect','catch','error','code','slice','lastIndexOf','/oauth/v2/token','authorization_code','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','lodash','../../config/logger','api','moment','request-promise','path','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','zone','changed','serverUrl','clientId','clientSecret','host','substring','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.com.cn'];(function(_0x5965f5,_0x446096){var _0x1faea2=function(_0x180e8a){while(--_0x180e8a){_0x5965f5['push'](_0x5965f5['shift']());}};_0x1faea2(++_0x446096);}(_0xce5a,0x141));var _0xace5=function(_0x1de4b8,_0x529b41){_0x1de4b8=_0x1de4b8-0x0;var _0x557699=_0xce5a[_0x1de4b8];return _0x557699;};'use strict';var _=require(_0xace5('0x0'));var util=require('util');var logger=require(_0xace5('0x1'))(_0xace5('0x2'));var moment=require(_0xace5('0x3'));var BPromise=require('bluebird');var rp=require(_0xace5('0x4'));var fs=require('fs');var path=require(_0xace5('0x5'));var rimraf=require('rimraf');var config=require(_0xace5('0x6'));var attributes=require(_0xace5('0x7'));var integrations=require(_0xace5('0x8'));module[_0xace5('0x9')]=function(_0x23cf53,_0x4cceca){return _0x23cf53[_0xace5('0xa')](_0xace5('0xb'),attributes,{'tableName':_0xace5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2ef11c,_0x34f25f,_0x5490ca){if(_0x2ef11c['changed'](_0xace5('0xd'))||_0x2ef11c[_0xace5('0xe')](_0xace5('0xf'))||_0x2ef11c[_0xace5('0xe')](_0xace5('0x10'))||_0x2ef11c['changed'](_0xace5('0x11'))||_0x2ef11c['changed']('code')||_0x2ef11c[_0xace5('0xe')](_0xace5('0x12'))){var _0x2cd018,_0x45c1e9;_0x2cd018=_0x2ef11c['serverUrl'];var _0x3a8856=_0x2cd018['slice'](-0x1);if(_0x3a8856==='/'||_0x3a8856==='\x5c'||_0x3a8856===':'){_0x2cd018=_0x2cd018[_0xace5('0x13')](0x0,_0x2cd018['lastIndexOf'](_0x3a8856));}switch(_0x2ef11c[_0xace5('0xd')]){case'US':_0x45c1e9=_0xace5('0x14');break;case'AU':_0x45c1e9=_0xace5('0x15');break;case'IN':_0x45c1e9='https://accounts.zoho.in';break;case'CN':_0x45c1e9=_0xace5('0x16');break;default:_0x45c1e9=_0xace5('0x17');break;}var _0x2f3a4e={'method':_0xace5('0x18'),'uri':_0x45c1e9+'/oauth/v2/token','form':{'grant_type':'authorization_code','client_id':_0x2ef11c[_0xace5('0x10')],'client_secret':_0x2ef11c[_0xace5('0x11')],'redirect_uri':_0x2ef11c[_0xace5('0xf')],'code':_0x2ef11c['code']},'headers':{'Content-Type':_0xace5('0x19')}};return rp(_0x2f3a4e)[_0xace5('0x1a')](function(_0x1dbe8d){var _0x442d7b=JSON[_0xace5('0x1b')](_0x1dbe8d);if(_0x442d7b[_0xace5('0x1c')]){_0x2ef11c[_0xace5('0x1d')]=_0x442d7b[_0xace5('0x1c')];logger[_0xace5('0x1e')](util[_0xace5('0x1f')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x2ef11c['name'],_0x2ef11c['id']));}else{logger['error'](util['format'](_0xace5('0x20'),_0x2ef11c[_0xace5('0x21')],_0x2ef11c['id']),util[_0xace5('0x22')](_0x442d7b,{'showHidden':![],'depth':null}));}return _0x5490ca(null,_0x34f25f);})[_0xace5('0x23')](function(_0x43c907){logger[_0xace5('0x24')](util[_0xace5('0x1f')](_0xace5('0x20'),_0x2ef11c[_0xace5('0x21')],_0x2ef11c['id']),util[_0xace5('0x22')](parsedResult,{'showHidden':![],'depth':null}));return _0x5490ca(_0x43c907);});}else{return _0x5490ca(null,_0x34f25f);}},'beforeUpdate':function(_0x1559ad,_0x17a4ec,_0x4d35ec){if(_0x1559ad[_0xace5('0xe')](_0xace5('0xd'))||_0x1559ad[_0xace5('0xe')](_0xace5('0xf'))||_0x1559ad['changed']('clientId')||_0x1559ad[_0xace5('0xe')](_0xace5('0x11'))||_0x1559ad[_0xace5('0xe')](_0xace5('0x25'))||_0x1559ad[_0xace5('0xe')](_0xace5('0x12'))){var _0x2e555a,_0x58b2ae;_0x2e555a=_0x1559ad['serverUrl'];var _0x3b1012=_0x2e555a[_0xace5('0x26')](-0x1);if(_0x3b1012==='/'||_0x3b1012==='\x5c'||_0x3b1012===':'){_0x2e555a=_0x2e555a[_0xace5('0x13')](0x0,_0x2e555a[_0xace5('0x27')](_0x3b1012));}switch(_0x1559ad[_0xace5('0xd')]){case'US':_0x58b2ae=_0xace5('0x14');break;case'AU':_0x58b2ae=_0xace5('0x15');break;case'IN':_0x58b2ae='https://accounts.zoho.in';break;case'CN':_0x58b2ae=_0xace5('0x16');break;default:_0x58b2ae='https://accounts.zoho.eu';break;}var _0x3579a1={'method':_0xace5('0x18'),'uri':_0x58b2ae+_0xace5('0x28'),'form':{'grant_type':_0xace5('0x29'),'client_id':_0x1559ad[_0xace5('0x10')],'client_secret':_0x1559ad[_0xace5('0x11')],'redirect_uri':_0x1559ad[_0xace5('0xf')],'code':_0x1559ad[_0xace5('0x25')]},'headers':{'Content-Type':_0xace5('0x19')}};return rp(_0x3579a1)[_0xace5('0x1a')](function(_0x48a7a0){var _0x47b4b3=JSON[_0xace5('0x1b')](_0x48a7a0);if(_0x47b4b3[_0xace5('0x1c')]){_0x1559ad[_0xace5('0x1d')]=_0x47b4b3['refresh_token'];logger[_0xace5('0x1e')](util[_0xace5('0x1f')](_0xace5('0x2a'),_0x1559ad[_0xace5('0x21')],_0x1559ad['id']));}else{logger[_0xace5('0x24')](util[_0xace5('0x1f')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x1559ad['name'],_0x1559ad['id']),util[_0xace5('0x22')](_0x47b4b3,{'showHidden':![],'depth':null}));}return _0x4d35ec(null,_0x17a4ec);})[_0xace5('0x23')](function(_0x2aefad){logger[_0xace5('0x24')](util[_0xace5('0x1f')](_0xace5('0x20'),_0x1559ad['name'],_0x1559ad['id']),util[_0xace5('0x22')](parsedResult,{'showHidden':![],'depth':null}));return _0x4d35ec(_0x2aefad);});}else{return _0x4d35ec(null,_0x17a4ec);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 481eba7..6b597e5 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 _0x6209=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetZohoAccount','ZohoAccount','findAll','options','limit','include','map','model','attributes','where','ShowZohoAccount','catch','lodash','util'];(function(_0x599570,_0x460668){var _0x3d743f=function(_0x179db6){while(--_0x179db6){_0x599570['push'](_0x599570['shift']());}};_0x3d743f(++_0x460668);}(_0x6209,0x1e8));var _0x9620=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x6209[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x9620('0x0'));var util=require(_0x9620('0x1'));var moment=require(_0x9620('0x2'));var BPromise=require(_0x9620('0x3'));var rs=require(_0x9620('0x4'));var fs=require('fs');var Redis=require(_0x9620('0x5'));var db=require(_0x9620('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9620('0x7'))(_0x9620('0x8'));var config=require(_0x9620('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9620('0xa')][_0x9620('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2bdb4e,_0x339bdc,_0x488d59){return new BPromise(function(_0x4e9082,_0x11af3d){return client['request'](_0x2bdb4e,_0x488d59)[_0x9620('0xc')](function(_0x345acb){logger[_0x9620('0xd')](_0x9620('0xe'),_0x339bdc,_0x9620('0xf'));logger[_0x9620('0x10')](_0x9620('0x11'),_0x339bdc,'request\x20sent',JSON[_0x9620('0x12')](_0x345acb));if(_0x345acb['error']){if(_0x345acb[_0x9620('0x13')][_0x9620('0x14')]===0x1f4){logger[_0x9620('0x13')](_0x9620('0xe'),_0x339bdc,_0x345acb[_0x9620('0x13')][_0x9620('0x15')]);return _0x11af3d(_0x345acb[_0x9620('0x13')][_0x9620('0x15')]);}logger[_0x9620('0x13')](_0x9620('0xe'),_0x339bdc,_0x345acb['error']['message']);return _0x4e9082(_0x345acb[_0x9620('0x13')][_0x9620('0x15')]);}else{logger['info'](_0x9620('0xe'),_0x339bdc,_0x9620('0xf'));_0x4e9082(_0x345acb[_0x9620('0x16')][_0x9620('0x15')]);}})['catch'](function(_0x2cb40e){logger[_0x9620('0x13')]('ZohoAccount,\x20%s,\x20%s',_0x339bdc,_0x2cb40e);_0x11af3d(_0x2cb40e);});});}exports[_0x9620('0x17')]=function(_0x4b81ea){var _0x10a166=this;return new Promise(function(_0x16514e,_0x2c8975){return db[_0x9620('0x18')][_0x9620('0x19')]({'raw':_0x4b81ea['options']?_0x4b81ea[_0x9620('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x4b81ea['options']?_0x4b81ea['options']['where']||null:null,'attributes':_0x4b81ea['options']?_0x4b81ea[_0x9620('0x1a')]['attributes']||null:null,'limit':_0x4b81ea[_0x9620('0x1a')]?_0x4b81ea[_0x9620('0x1a')][_0x9620('0x1b')]||null:null,'include':_0x4b81ea[_0x9620('0x1a')]?_0x4b81ea[_0x9620('0x1a')][_0x9620('0x1c')]?_[_0x9620('0x1d')](_0x4b81ea['options']['include'],function(_0x1d8665){return{'model':db[_0x1d8665[_0x9620('0x1e')]],'as':_0x1d8665['as'],'attributes':_0x1d8665['attributes'],'include':_0x1d8665[_0x9620('0x1c')]?_[_0x9620('0x1d')](_0x1d8665[_0x9620('0x1c')],function(_0x156298){return{'model':db[_0x156298[_0x9620('0x1e')]],'as':_0x156298['as'],'attributes':_0x156298[_0x9620('0x1f')],'include':_0x156298[_0x9620('0x1c')]?_[_0x9620('0x1d')](_0x156298[_0x9620('0x1c')],function(_0x30c0cf){return{'model':db[_0x30c0cf[_0x9620('0x1e')]],'as':_0x30c0cf['as'],'attributes':_0x30c0cf['attributes']};}):[]};}):[]};}):[]:[]})[_0x9620('0xc')](function(_0x3e40aa){logger[_0x9620('0xd')](_0x9620('0x17'),_0x4b81ea);logger['debug']('GetZohoAccount',_0x4b81ea,JSON[_0x9620('0x12')](_0x3e40aa));_0x16514e(_0x3e40aa);})['catch'](function(_0xf2cb11){logger['error']('GetZohoAccount',_0xf2cb11[_0x9620('0x15')],_0x4b81ea);_0x2c8975(_0x10a166[_0x9620('0x13')](0x1f4,_0xf2cb11[_0x9620('0x15')]));});});};exports['ShowZohoAccount']=function(_0x19ddaf){var _0x186b4f=this;return new Promise(function(_0x42bfe6,_0x4cc78e){return db[_0x9620('0x18')]['find']({'raw':_0x19ddaf[_0x9620('0x1a')]?_0x19ddaf[_0x9620('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x19ddaf[_0x9620('0x1a')]?_0x19ddaf[_0x9620('0x1a')][_0x9620('0x20')]||null:null,'attributes':_0x19ddaf[_0x9620('0x1a')]?_0x19ddaf['options']['attributes']||null:null,'include':_0x19ddaf['options']?_0x19ddaf['options'][_0x9620('0x1c')]?_[_0x9620('0x1d')](_0x19ddaf['options'][_0x9620('0x1c')],function(_0x3d80f9){return{'model':db[_0x3d80f9['model']],'as':_0x3d80f9['as'],'attributes':_0x3d80f9[_0x9620('0x1f')],'include':_0x3d80f9[_0x9620('0x1c')]?_['map'](_0x3d80f9[_0x9620('0x1c')],function(_0x360c64){return{'model':db[_0x360c64[_0x9620('0x1e')]],'as':_0x360c64['as'],'attributes':_0x360c64[_0x9620('0x1f')],'include':_0x360c64['include']?_[_0x9620('0x1d')](_0x360c64['include'],function(_0x908b02){return{'model':db[_0x908b02[_0x9620('0x1e')]],'as':_0x908b02['as'],'attributes':_0x908b02['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2b213f){logger[_0x9620('0xd')](_0x9620('0x21'),_0x19ddaf);logger[_0x9620('0x10')](_0x9620('0x21'),_0x19ddaf,JSON['stringify'](_0x2b213f));_0x42bfe6(_0x2b213f);})[_0x9620('0x22')](function(_0x2d87fa){logger[_0x9620('0x13')](_0x9620('0x21'),_0x2d87fa[_0x9620('0x15')],_0x19ddaf);_0x4cc78e(_0x186b4f['error'](0x1f4,_0x2d87fa[_0x9620('0x15')]));});});}; \ No newline at end of file +var _0x63a6=['ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetZohoAccount','options','where','attributes','include','map','model','ShowZohoAccount','find','raw','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','request','then'];(function(_0xc74264,_0x5a41e9){var _0x238107=function(_0x49ad5c){while(--_0x49ad5c){_0xc74264['push'](_0xc74264['shift']());}};_0x238107(++_0x5a41e9);}(_0x63a6,0x1c7));var _0x663a=function(_0x180297,_0x56bb6d){_0x180297=_0x180297-0x0;var _0x1f7aae=_0x63a6[_0x180297];return _0x1f7aae;};'use strict';var _=require('lodash');var util=require(_0x663a('0x0'));var moment=require(_0x663a('0x1'));var BPromise=require('bluebird');var rs=require(_0x663a('0x2'));var fs=require('fs');var Redis=require(_0x663a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x663a('0x4'));var logger=require(_0x663a('0x5'))(_0x663a('0x6'));var config=require(_0x663a('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x14b552,_0x20203b,_0x4b1314){return new BPromise(function(_0x4d4249,_0x326b53){return client[_0x663a('0x8')](_0x14b552,_0x4b1314)[_0x663a('0x9')](function(_0x4aa93a){logger['info'](_0x663a('0xa'),_0x20203b,_0x663a('0xb'));logger[_0x663a('0xc')](_0x663a('0xd'),_0x20203b,_0x663a('0xb'),JSON[_0x663a('0xe')](_0x4aa93a));if(_0x4aa93a['error']){if(_0x4aa93a[_0x663a('0xf')][_0x663a('0x10')]===0x1f4){logger[_0x663a('0xf')]('ZohoAccount,\x20%s,\x20%s',_0x20203b,_0x4aa93a['error'][_0x663a('0x11')]);return _0x326b53(_0x4aa93a['error']['message']);}logger[_0x663a('0xf')](_0x663a('0xa'),_0x20203b,_0x4aa93a['error'][_0x663a('0x11')]);return _0x4d4249(_0x4aa93a['error'][_0x663a('0x11')]);}else{logger[_0x663a('0x12')](_0x663a('0xa'),_0x20203b,_0x663a('0xb'));_0x4d4249(_0x4aa93a[_0x663a('0x13')]['message']);}})[_0x663a('0x14')](function(_0x5cc6ab){logger[_0x663a('0xf')](_0x663a('0xa'),_0x20203b,_0x5cc6ab);_0x326b53(_0x5cc6ab);});});}exports[_0x663a('0x15')]=function(_0x1508ab){var _0x54c5e6=this;return new Promise(function(_0x2a1f33,_0x5d7a6a){return db['ZohoAccount']['findAll']({'raw':_0x1508ab[_0x663a('0x16')]?_0x1508ab[_0x663a('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x1508ab['options']?_0x1508ab[_0x663a('0x16')][_0x663a('0x17')]||null:null,'attributes':_0x1508ab[_0x663a('0x16')]?_0x1508ab[_0x663a('0x16')][_0x663a('0x18')]||null:null,'limit':_0x1508ab[_0x663a('0x16')]?_0x1508ab[_0x663a('0x16')]['limit']||null:null,'include':_0x1508ab[_0x663a('0x16')]?_0x1508ab[_0x663a('0x16')][_0x663a('0x19')]?_[_0x663a('0x1a')](_0x1508ab[_0x663a('0x16')][_0x663a('0x19')],function(_0x5e1bd1){return{'model':db[_0x5e1bd1[_0x663a('0x1b')]],'as':_0x5e1bd1['as'],'attributes':_0x5e1bd1[_0x663a('0x18')],'include':_0x5e1bd1['include']?_[_0x663a('0x1a')](_0x5e1bd1[_0x663a('0x19')],function(_0x5463d5){return{'model':db[_0x5463d5[_0x663a('0x1b')]],'as':_0x5463d5['as'],'attributes':_0x5463d5[_0x663a('0x18')],'include':_0x5463d5['include']?_[_0x663a('0x1a')](_0x5463d5[_0x663a('0x19')],function(_0x57131d){return{'model':db[_0x57131d[_0x663a('0x1b')]],'as':_0x57131d['as'],'attributes':_0x57131d['attributes']};}):[]};}):[]};}):[]:[]})[_0x663a('0x9')](function(_0x2ab007){logger[_0x663a('0x12')](_0x663a('0x15'),_0x1508ab);logger[_0x663a('0xc')]('GetZohoAccount',_0x1508ab,JSON[_0x663a('0xe')](_0x2ab007));_0x2a1f33(_0x2ab007);})[_0x663a('0x14')](function(_0x1ab286){logger[_0x663a('0xf')](_0x663a('0x15'),_0x1ab286[_0x663a('0x11')],_0x1508ab);_0x5d7a6a(_0x54c5e6[_0x663a('0xf')](0x1f4,_0x1ab286['message']));});});};exports[_0x663a('0x1c')]=function(_0x2a0577){var _0x2cf498=this;return new Promise(function(_0x6ab5a2,_0x472e02){return db['ZohoAccount'][_0x663a('0x1d')]({'raw':_0x2a0577['options']?_0x2a0577[_0x663a('0x16')][_0x663a('0x1e')]===undefined?!![]:![]:!![],'where':_0x2a0577[_0x663a('0x16')]?_0x2a0577[_0x663a('0x16')][_0x663a('0x17')]||null:null,'attributes':_0x2a0577['options']?_0x2a0577[_0x663a('0x16')]['attributes']||null:null,'include':_0x2a0577[_0x663a('0x16')]?_0x2a0577[_0x663a('0x16')][_0x663a('0x19')]?_[_0x663a('0x1a')](_0x2a0577['options'][_0x663a('0x19')],function(_0x87a4d9){return{'model':db[_0x87a4d9[_0x663a('0x1b')]],'as':_0x87a4d9['as'],'attributes':_0x87a4d9[_0x663a('0x18')],'include':_0x87a4d9[_0x663a('0x19')]?_[_0x663a('0x1a')](_0x87a4d9[_0x663a('0x19')],function(_0x104f5c){return{'model':db[_0x104f5c['model']],'as':_0x104f5c['as'],'attributes':_0x104f5c[_0x663a('0x18')],'include':_0x104f5c[_0x663a('0x19')]?_['map'](_0x104f5c[_0x663a('0x19')],function(_0x162a38){return{'model':db[_0x162a38[_0x663a('0x1b')]],'as':_0x162a38['as'],'attributes':_0x162a38[_0x663a('0x18')]};}):[]};}):[]};}):[]:[]})[_0x663a('0x9')](function(_0x531681){logger[_0x663a('0x12')]('ShowZohoAccount',_0x2a0577);logger[_0x663a('0xc')](_0x663a('0x1c'),_0x2a0577,JSON['stringify'](_0x531681));_0x6ab5a2(_0x531681);})['catch'](function(_0x3a424e){logger[_0x663a('0xf')]('ShowZohoAccount',_0x3a424e[_0x663a('0x11')],_0x2a0577);_0x472e02(_0x2cf498[_0x663a('0xf')](0x1f4,_0x3a424e[_0x663a('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index f4e0fa3..8480cec 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 _0x99a9=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','index','isAuthenticated','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','/:id','update','destroy','exports','multer','util'];(function(_0xbc2a71,_0x36aaac){var _0x43f2ee=function(_0x32f3ff){while(--_0x32f3ff){_0xbc2a71['push'](_0xbc2a71['shift']());}};_0x43f2ee(++_0x36aaac);}(_0x99a9,0x136));var _0x999a=function(_0x13f8ce,_0x2cf439){_0x13f8ce=_0x13f8ce-0x0;var _0x1f077b=_0x99a9[_0x13f8ce];return _0x1f077b;};'use strict';var multer=require(_0x999a('0x0'));var util=require(_0x999a('0x1'));var path=require(_0x999a('0x2'));var timeout=require(_0x999a('0x3'));var express=require(_0x999a('0x4'));var router=express[_0x999a('0x5')]();var fs_extra=require(_0x999a('0x6'));var auth=require(_0x999a('0x7'));var interaction=require(_0x999a('0x8'));var config=require(_0x999a('0x9'));var controller=require(_0x999a('0xa'));router[_0x999a('0xb')]('/',auth['isAuthenticated'](),controller[_0x999a('0xc')]);router[_0x999a('0xb')]('/:id',auth[_0x999a('0xd')](),controller['show']);router[_0x999a('0xb')](_0x999a('0xe'),auth['isAuthenticated'](),controller['getFields']);router['get'](_0x999a('0xf'),auth[_0x999a('0xd')](),controller[_0x999a('0x10')]);router[_0x999a('0xb')](_0x999a('0x11'),auth['isAuthenticated'](),controller[_0x999a('0x12')]);router[_0x999a('0x13')]('/',auth[_0x999a('0xd')](),controller[_0x999a('0x14')]);router[_0x999a('0x15')](_0x999a('0x16'),auth[_0x999a('0xd')](),controller[_0x999a('0x17')]);router['delete'](_0x999a('0x16'),auth[_0x999a('0xd')](),controller[_0x999a('0x18')]);module[_0x999a('0x19')]=router; \ No newline at end of file +var _0x072a=['show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','/:id','destroy','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','get','index','isAuthenticated'];(function(_0x19c8b3,_0x56a6d8){var _0x4b232f=function(_0x3691c0){while(--_0x3691c0){_0x19c8b3['push'](_0x19c8b3['shift']());}};_0x4b232f(++_0x56a6d8);}(_0x072a,0x150));var _0xa072=function(_0x45f517,_0x18fcab){_0x45f517=_0x45f517-0x0;var _0x3be7df=_0x072a[_0x45f517];return _0x3be7df;};'use strict';var multer=require(_0xa072('0x0'));var util=require(_0xa072('0x1'));var path=require(_0xa072('0x2'));var timeout=require(_0xa072('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xa072('0x4'));var auth=require(_0xa072('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intZohoConfiguration.controller');router[_0xa072('0x6')]('/',auth['isAuthenticated'](),controller[_0xa072('0x7')]);router[_0xa072('0x6')]('/:id',auth[_0xa072('0x8')](),controller[_0xa072('0x9')]);router[_0xa072('0x6')](_0xa072('0xa'),auth['isAuthenticated'](),controller[_0xa072('0xb')]);router[_0xa072('0x6')](_0xa072('0xc'),auth[_0xa072('0x8')](),controller[_0xa072('0xd')]);router[_0xa072('0x6')](_0xa072('0xe'),auth[_0xa072('0x8')](),controller[_0xa072('0xf')]);router[_0xa072('0x10')]('/',auth[_0xa072('0x8')](),controller[_0xa072('0x11')]);router[_0xa072('0x12')]('/:id',auth[_0xa072('0x8')](),controller[_0xa072('0x13')]);router[_0xa072('0x14')](_0xa072('0x15'),auth[_0xa072('0x8')](),controller[_0xa072('0x16')]);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 6e28970..dd009d5 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 _0xa468=['ENUM','lead','contact','contact_lead','STRING'];(function(_0x58788d,_0x88b74f){var _0x58ceba=function(_0x16a416){while(--_0x16a416){_0x58788d['push'](_0x58788d['shift']());}};_0x58ceba(++_0x88b74f);}(_0xa468,0xef));var _0x8a46=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa468[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x8a46('0x0')]},'moduleCreate':{'type':Sequelize[_0x8a46('0x1')](_0x8a46('0x2'),_0x8a46('0x3'),'nothing'),'defaultValue':_0x8a46('0x2')},'moduleSearch':{'type':Sequelize[_0x8a46('0x1')]('contact_lead',_0x8a46('0x3'),_0x8a46('0x2')),'defaultValue':_0x8a46('0x4')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x85f1=['sequelize','exports','ENUM','nothing','lead','contact_lead','STRING'];(function(_0x11fb3f,_0x500f21){var _0x4d45bf=function(_0x40ca7a){while(--_0x40ca7a){_0x11fb3f['push'](_0x11fb3f['shift']());}};_0x4d45bf(++_0x500f21);}(_0x85f1,0xc4));var _0x185f=function(_0x4eec9b,_0x4aea09){_0x4eec9b=_0x4eec9b-0x0;var _0x2e3849=_0x85f1[_0x4eec9b];return _0x2e3849;};'use strict';var Sequelize=require(_0x185f('0x0'));module[_0x185f('0x1')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0x185f('0x2')]('lead','contact',_0x185f('0x3')),'defaultValue':_0x185f('0x4')},'moduleSearch':{'type':Sequelize['ENUM'](_0x185f('0x5'),'contact',_0x185f('0x4')),'defaultValue':_0x185f('0x5')},'description':{'type':Sequelize[_0x185f('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 1284fd4..5c4a61e 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 _0x4947=['order','getSubjects','getDescriptions','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','apply','reject','update','then','error','stack','name','send','map','rawAttributes','type','key','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','sort','where','pick','filter','merge','options','ZohoConfiguration','includeAll','rows','show','params','include','find','catch','create','body','destroy','getFields','findOne','ZohoField','length'];(function(_0x490fc7,_0x53d1ef){var _0x41a583=function(_0x163e55){while(--_0x163e55){_0x490fc7['push'](_0x490fc7['shift']());}};_0x41a583(++_0x53d1ef);}(_0x4947,0x1f0));var _0x7494=function(_0x568496,_0x565afd){_0x568496=_0x568496-0x0;var _0x26c5c1=_0x4947[_0x568496];return _0x26c5c1;};'use strict';var emlformat=require(_0x7494('0x0'));var rimraf=require(_0x7494('0x1'));var zipdir=require(_0x7494('0x2'));var jsonpatch=require(_0x7494('0x3'));var rp=require('request-promise');var moment=require(_0x7494('0x4'));var BPromise=require(_0x7494('0x5'));var Mustache=require(_0x7494('0x6'));var util=require(_0x7494('0x7'));var path=require(_0x7494('0x8'));var sox=require(_0x7494('0x9'));var csv=require(_0x7494('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7494('0xb'));var squel=require(_0x7494('0xc'));var crypto=require(_0x7494('0xd'));var jsforce=require(_0x7494('0xe'));var deskjs=require(_0x7494('0xf'));var toCsv=require(_0x7494('0xa'));var querystring=require('querystring');var Papa=require(_0x7494('0x10'));var Redis=require(_0x7494('0x11'));var authService=require(_0x7494('0x12'));var qs=require(_0x7494('0x13'));var as=require(_0x7494('0x14'));var hardwareService=require(_0x7494('0x15'));var logger=require(_0x7494('0x16'))(_0x7494('0x17'));var utils=require(_0x7494('0x18'));var config=require(_0x7494('0x19'));var licenseUtil=require(_0x7494('0x1a'));var db=require(_0x7494('0x1b'))['db'];function respondWithStatusCode(_0x5d2e80,_0x8f75c7){_0x8f75c7=_0x8f75c7||0xcc;return function(_0x4cf744){if(_0x4cf744){return _0x5d2e80[_0x7494('0x1c')](_0x8f75c7);}return _0x5d2e80[_0x7494('0x1d')](_0x8f75c7)[_0x7494('0x1e')]();};}function respondWithResult(_0x2743ff,_0xffa2b3){_0xffa2b3=_0xffa2b3||0xc8;return function(_0x100537){if(_0x100537){return _0x2743ff[_0x7494('0x1d')](_0xffa2b3)[_0x7494('0x1f')](_0x100537);}};}function respondWithFilteredResult(_0x417d81,_0x3bd9e1){return function(_0x33e2c9){if(_0x33e2c9){var _0x771235=typeof _0x3bd9e1['offset']==='undefined'&&typeof _0x3bd9e1[_0x7494('0x20')]===_0x7494('0x21');var _0x6a40c2=_0x33e2c9[_0x7494('0x22')];var _0x3ebfc8=_0x771235?0x0:_0x3bd9e1[_0x7494('0x23')];var _0x4478fd=_0x771235?_0x33e2c9[_0x7494('0x22')]:_0x3bd9e1['offset']+_0x3bd9e1['limit'];var _0x14b74a;if(_0x4478fd>=_0x6a40c2){_0x4478fd=_0x6a40c2;_0x14b74a=0xc8;}else{_0x14b74a=0xce;}_0x417d81[_0x7494('0x1d')](_0x14b74a);return _0x417d81[_0x7494('0x24')]('Content-Range',_0x3ebfc8+'-'+_0x4478fd+'/'+_0x6a40c2)[_0x7494('0x1f')](_0x33e2c9);}return null;};}function patchUpdates(_0x4655da){return function(_0x27e6be){try{jsonpatch[_0x7494('0x25')](_0x27e6be,_0x4655da,!![]);}catch(_0x667df2){return BPromise[_0x7494('0x26')](_0x667df2);}return _0x27e6be['save']();};}function saveUpdates(_0xdf989d,_0x35f793){return function(_0x404b2b){if(_0x404b2b){return _0x404b2b[_0x7494('0x27')](_0xdf989d)[_0x7494('0x28')](function(_0x35c44f){return _0x35c44f;});}return null;};}function removeEntity(_0x4ab852,_0x4d9208){return function(_0x1820d9){if(_0x1820d9){return _0x1820d9['destroy']()[_0x7494('0x28')](function(){_0x4ab852[_0x7494('0x1d')](0xcc)[_0x7494('0x1e')]();});}};}function handleEntityNotFound(_0x936a95,_0xcb62a8){return function(_0x14fad9){if(!_0x14fad9){_0x936a95[_0x7494('0x1c')](0x194);}return _0x14fad9;};}function handleError(_0x704d23,_0x4711e2){_0x4711e2=_0x4711e2||0x1f4;return function(_0x90f105){logger[_0x7494('0x29')](_0x90f105[_0x7494('0x2a')]);if(_0x90f105[_0x7494('0x2b')]){delete _0x90f105['name'];}_0x704d23[_0x7494('0x1d')](_0x4711e2)[_0x7494('0x2c')](_0x90f105);};}exports['index']=function(_0xf32dd7,_0x34e573){var _0x4ea80b={},_0x111c42={},_0x39610a={'count':0x0,'rows':[]};var _0x434e13=_[_0x7494('0x2d')](db['ZohoConfiguration'][_0x7494('0x2e')],function(_0x27b9c7){return{'name':_0x27b9c7['fieldName'],'type':_0x27b9c7[_0x7494('0x2f')][_0x7494('0x30')]};});_0x111c42['model']=_['map'](_0x434e13,_0x7494('0x2b'));_0x111c42[_0x7494('0x31')]=_[_0x7494('0x32')](_0xf32dd7[_0x7494('0x31')]);_0x111c42[_0x7494('0x33')]=_[_0x7494('0x34')](_0x111c42['model'],_0x111c42[_0x7494('0x31')]);_0x4ea80b[_0x7494('0x35')]=_[_0x7494('0x34')](_0x111c42[_0x7494('0x36')],qs[_0x7494('0x37')](_0xf32dd7['query'][_0x7494('0x37')]));_0x4ea80b[_0x7494('0x35')]=_0x4ea80b[_0x7494('0x35')]['length']?_0x4ea80b[_0x7494('0x35')]:_0x111c42['model'];if(!_0xf32dd7[_0x7494('0x31')][_0x7494('0x38')]('nolimit')){_0x4ea80b[_0x7494('0x20')]=qs[_0x7494('0x20')](_0xf32dd7['query'][_0x7494('0x20')]);_0x4ea80b[_0x7494('0x23')]=qs[_0x7494('0x23')](_0xf32dd7['query'][_0x7494('0x23')]);}_0x4ea80b['order']=qs[_0x7494('0x39')](_0xf32dd7[_0x7494('0x31')][_0x7494('0x39')]);_0x4ea80b[_0x7494('0x3a')]=qs[_0x7494('0x33')](_[_0x7494('0x3b')](_0xf32dd7[_0x7494('0x31')],_0x111c42['filters']),_0x434e13);if(_0xf32dd7[_0x7494('0x31')][_0x7494('0x3c')]){_0x4ea80b[_0x7494('0x3a')]=_[_0x7494('0x3d')](_0x4ea80b[_0x7494('0x3a')],{'$or':_['map'](_0x434e13,function(_0x41a7cc){if(_0x41a7cc[_0x7494('0x2f')]!=='VIRTUAL'){var _0x14b220={};_0x14b220[_0x41a7cc['name']]={'$like':'%'+_0xf32dd7['query'][_0x7494('0x3c')]+'%'};return _0x14b220;}})});}_0x4ea80b=_[_0x7494('0x3d')]({},_0x4ea80b,_0xf32dd7[_0x7494('0x3e')]);var _0x3650c5={'where':_0x4ea80b[_0x7494('0x3a')]};return db[_0x7494('0x3f')][_0x7494('0x22')](_0x3650c5)[_0x7494('0x28')](function(_0x304f1c){_0x39610a[_0x7494('0x22')]=_0x304f1c;if(_0xf32dd7[_0x7494('0x31')][_0x7494('0x40')]){_0x4ea80b['include']=[{'all':!![]}];}return db[_0x7494('0x3f')]['findAll'](_0x4ea80b);})[_0x7494('0x28')](function(_0x14d122){_0x39610a[_0x7494('0x41')]=_0x14d122;return _0x39610a;})[_0x7494('0x28')](respondWithFilteredResult(_0x34e573,_0x4ea80b))['catch'](handleError(_0x34e573,null));};exports[_0x7494('0x42')]=function(_0x4953ee,_0x40e9cd){var _0x14df1a={'raw':![],'where':{'id':_0x4953ee[_0x7494('0x43')]['id']}},_0x5ae91a={};_0x5ae91a[_0x7494('0x36')]=_[_0x7494('0x32')](db[_0x7494('0x3f')][_0x7494('0x2e')]);_0x5ae91a['query']=_[_0x7494('0x32')](_0x4953ee[_0x7494('0x31')]);_0x5ae91a['filters']=_[_0x7494('0x34')](_0x5ae91a[_0x7494('0x36')],_0x5ae91a[_0x7494('0x31')]);_0x14df1a[_0x7494('0x35')]=_[_0x7494('0x34')](_0x5ae91a['model'],qs['fields'](_0x4953ee[_0x7494('0x31')][_0x7494('0x37')]));_0x14df1a[_0x7494('0x35')]=_0x14df1a[_0x7494('0x35')]['length']?_0x14df1a['attributes']:_0x5ae91a[_0x7494('0x36')];if(_0x4953ee[_0x7494('0x31')][_0x7494('0x40')]){_0x14df1a[_0x7494('0x44')]=[{'all':!![]}];}_0x14df1a=_[_0x7494('0x3d')]({},_0x14df1a,_0x4953ee[_0x7494('0x3e')]);return db[_0x7494('0x3f')][_0x7494('0x45')](_0x14df1a)[_0x7494('0x28')](handleEntityNotFound(_0x40e9cd,null))[_0x7494('0x28')](respondWithResult(_0x40e9cd,null))[_0x7494('0x46')](handleError(_0x40e9cd,null));};exports[_0x7494('0x47')]=function(_0x50e1e4,_0x3d52a9){return db['ZohoConfiguration'][_0x7494('0x47')](_0x50e1e4[_0x7494('0x48')],{})['then'](respondWithResult(_0x3d52a9,0xc9))[_0x7494('0x46')](handleError(_0x3d52a9,null));};exports[_0x7494('0x27')]=function(_0x2a6852,_0x866d93){if(_0x2a6852['body']['id']){delete _0x2a6852['body']['id'];}return db[_0x7494('0x3f')][_0x7494('0x45')]({'where':{'id':_0x2a6852[_0x7494('0x43')]['id']}})[_0x7494('0x28')](handleEntityNotFound(_0x866d93,null))['then'](saveUpdates(_0x2a6852[_0x7494('0x48')],null))[_0x7494('0x28')](respondWithResult(_0x866d93,null))['catch'](handleError(_0x866d93,null));};exports[_0x7494('0x49')]=function(_0x420c40,_0x2d9b05){return db[_0x7494('0x3f')]['find']({'where':{'id':_0x420c40[_0x7494('0x43')]['id']}})[_0x7494('0x28')](handleEntityNotFound(_0x2d9b05,null))[_0x7494('0x28')](removeEntity(_0x2d9b05,null))['catch'](handleError(_0x2d9b05,null));};exports[_0x7494('0x4a')]=function(_0x8766c0,_0x3da62f,_0x5c220a){var _0x5b1baa={};var _0x103cf9={};var _0x274406;var _0x352473;return db[_0x7494('0x3f')][_0x7494('0x4b')]({'where':{'id':_0x8766c0['params']['id']}})[_0x7494('0x28')](handleEntityNotFound(_0x3da62f,null))[_0x7494('0x28')](function(_0x49e512){if(_0x49e512){_0x274406=_0x49e512;_0x103cf9['model']=_[_0x7494('0x32')](db[_0x7494('0x4c')][_0x7494('0x2e')]);_0x103cf9['query']=_['keys'](_0x8766c0[_0x7494('0x31')]);_0x103cf9[_0x7494('0x33')]=_['intersection'](_0x103cf9['model'],_0x103cf9[_0x7494('0x31')]);_0x5b1baa[_0x7494('0x35')]=_['intersection'](_0x103cf9['model'],qs[_0x7494('0x37')](_0x8766c0[_0x7494('0x31')][_0x7494('0x37')]));_0x5b1baa['attributes']=_0x5b1baa[_0x7494('0x35')][_0x7494('0x4d')]?_0x5b1baa[_0x7494('0x35')]:_0x103cf9[_0x7494('0x36')];_0x5b1baa[_0x7494('0x4e')]=qs[_0x7494('0x39')](_0x8766c0[_0x7494('0x31')][_0x7494('0x39')]);_0x5b1baa[_0x7494('0x3a')]=qs[_0x7494('0x33')](_[_0x7494('0x3b')](_0x8766c0[_0x7494('0x31')],_0x103cf9[_0x7494('0x33')]));if(_0x8766c0['query'][_0x7494('0x3c')]){_0x5b1baa[_0x7494('0x3a')]=_[_0x7494('0x3d')](_0x5b1baa[_0x7494('0x3a')],{'$or':_[_0x7494('0x2d')](_0x5b1baa[_0x7494('0x35')],function(_0x4fbef4){var _0xf40734={};_0xf40734[_0x4fbef4]={'$like':'%'+_0x8766c0[_0x7494('0x31')]['filter']+'%'};return _0xf40734;})});}_0x5b1baa=_[_0x7494('0x3d')]({},_0x5b1baa,_0x8766c0[_0x7494('0x3e')]);return _0x274406[_0x7494('0x4a')](_0x5b1baa);}})[_0x7494('0x28')](function(_0x5b1f4b){if(_0x5b1f4b){_0x352473=_0x5b1f4b['length'];if(!_0x8766c0[_0x7494('0x31')][_0x7494('0x38')]('nolimit')){_0x5b1baa[_0x7494('0x20')]=qs[_0x7494('0x20')](_0x8766c0[_0x7494('0x31')]['limit']);_0x5b1baa['offset']=qs[_0x7494('0x23')](_0x8766c0[_0x7494('0x31')]['offset']);}return _0x274406[_0x7494('0x4a')](_0x5b1baa);}})[_0x7494('0x28')](function(_0x49229f){if(_0x49229f){return _0x49229f?{'count':_0x352473,'rows':_0x49229f}:null;}})[_0x7494('0x28')](respondWithResult(_0x3da62f,null))[_0x7494('0x46')](handleError(_0x3da62f,null));};exports[_0x7494('0x4f')]=function(_0xa5867a,_0x482e75,_0x341e78){var _0x47bd86={};var _0x5947f2={};var _0x4b8c31;var _0x295c2a;return db[_0x7494('0x3f')][_0x7494('0x4b')]({'where':{'id':_0xa5867a[_0x7494('0x43')]['id']}})[_0x7494('0x28')](handleEntityNotFound(_0x482e75,null))[_0x7494('0x28')](function(_0x4bcc90){if(_0x4bcc90){_0x4b8c31=_0x4bcc90;_0x5947f2['model']=_[_0x7494('0x32')](db[_0x7494('0x4c')][_0x7494('0x2e')]);_0x5947f2['query']=_[_0x7494('0x32')](_0xa5867a[_0x7494('0x31')]);_0x5947f2['filters']=_[_0x7494('0x34')](_0x5947f2[_0x7494('0x36')],_0x5947f2[_0x7494('0x31')]);_0x47bd86[_0x7494('0x35')]=_['intersection'](_0x5947f2[_0x7494('0x36')],qs[_0x7494('0x37')](_0xa5867a[_0x7494('0x31')][_0x7494('0x37')]));_0x47bd86['attributes']=_0x47bd86[_0x7494('0x35')]['length']?_0x47bd86[_0x7494('0x35')]:_0x5947f2['model'];_0x47bd86[_0x7494('0x4e')]=qs[_0x7494('0x39')](_0xa5867a[_0x7494('0x31')][_0x7494('0x39')]);_0x47bd86[_0x7494('0x3a')]=qs[_0x7494('0x33')](_[_0x7494('0x3b')](_0xa5867a['query'],_0x5947f2[_0x7494('0x33')]));if(_0xa5867a[_0x7494('0x31')][_0x7494('0x3c')]){_0x47bd86[_0x7494('0x3a')]=_[_0x7494('0x3d')](_0x47bd86[_0x7494('0x3a')],{'$or':_[_0x7494('0x2d')](_0x47bd86[_0x7494('0x35')],function(_0x3c7f37){var _0x5ab0eb={};_0x5ab0eb[_0x3c7f37]={'$like':'%'+_0xa5867a['query'][_0x7494('0x3c')]+'%'};return _0x5ab0eb;})});}_0x47bd86=_['merge']({},_0x47bd86,_0xa5867a[_0x7494('0x3e')]);return _0x4b8c31[_0x7494('0x4f')](_0x47bd86);}})[_0x7494('0x28')](function(_0x263ab6){if(_0x263ab6){_0x295c2a=_0x263ab6[_0x7494('0x4d')];if(!_0xa5867a['query'][_0x7494('0x38')]('nolimit')){_0x47bd86[_0x7494('0x20')]=qs['limit'](_0xa5867a['query'][_0x7494('0x20')]);_0x47bd86[_0x7494('0x23')]=qs['offset'](_0xa5867a[_0x7494('0x31')][_0x7494('0x23')]);}return _0x4b8c31[_0x7494('0x4f')](_0x47bd86);}})[_0x7494('0x28')](function(_0x542022){if(_0x542022){return _0x542022?{'count':_0x295c2a,'rows':_0x542022}:null;}})[_0x7494('0x28')](respondWithResult(_0x482e75,null))[_0x7494('0x46')](handleError(_0x482e75,null));};exports[_0x7494('0x50')]=function(_0x2736f6,_0x56bb20,_0x3bdbc6){var _0x46485a={};var _0xb8242a={};var _0x5847e5;var _0x5affe4;return db[_0x7494('0x3f')][_0x7494('0x4b')]({'where':{'id':_0x2736f6['params']['id']}})['then'](handleEntityNotFound(_0x56bb20,null))[_0x7494('0x28')](function(_0x1dd3d4){if(_0x1dd3d4){_0x5847e5=_0x1dd3d4;_0xb8242a['model']=_['keys'](db['ZohoField'][_0x7494('0x2e')]);_0xb8242a[_0x7494('0x31')]=_[_0x7494('0x32')](_0x2736f6['query']);_0xb8242a[_0x7494('0x33')]=_[_0x7494('0x34')](_0xb8242a['model'],_0xb8242a[_0x7494('0x31')]);_0x46485a[_0x7494('0x35')]=_[_0x7494('0x34')](_0xb8242a['model'],qs[_0x7494('0x37')](_0x2736f6['query']['fields']));_0x46485a[_0x7494('0x35')]=_0x46485a[_0x7494('0x35')]['length']?_0x46485a[_0x7494('0x35')]:_0xb8242a[_0x7494('0x36')];_0x46485a[_0x7494('0x4e')]=qs[_0x7494('0x39')](_0x2736f6[_0x7494('0x31')]['sort']);_0x46485a[_0x7494('0x3a')]=qs[_0x7494('0x33')](_[_0x7494('0x3b')](_0x2736f6[_0x7494('0x31')],_0xb8242a['filters']));if(_0x2736f6[_0x7494('0x31')][_0x7494('0x3c')]){_0x46485a[_0x7494('0x3a')]=_[_0x7494('0x3d')](_0x46485a[_0x7494('0x3a')],{'$or':_[_0x7494('0x2d')](_0x46485a[_0x7494('0x35')],function(_0x2a5d4c){var _0x530508={};_0x530508[_0x2a5d4c]={'$like':'%'+_0x2736f6[_0x7494('0x31')][_0x7494('0x3c')]+'%'};return _0x530508;})});}_0x46485a=_[_0x7494('0x3d')]({},_0x46485a,_0x2736f6[_0x7494('0x3e')]);return _0x5847e5[_0x7494('0x50')](_0x46485a);}})[_0x7494('0x28')](function(_0x424f3e){if(_0x424f3e){_0x5affe4=_0x424f3e[_0x7494('0x4d')];if(!_0x2736f6['query'][_0x7494('0x38')](_0x7494('0x51'))){_0x46485a['limit']=qs[_0x7494('0x20')](_0x2736f6[_0x7494('0x31')][_0x7494('0x20')]);_0x46485a[_0x7494('0x23')]=qs[_0x7494('0x23')](_0x2736f6[_0x7494('0x31')][_0x7494('0x23')]);}return _0x5847e5[_0x7494('0x50')](_0x46485a);}})['then'](function(_0x5c4528){if(_0x5c4528){return _0x5c4528?{'count':_0x5affe4,'rows':_0x5c4528}:null;}})[_0x7494('0x28')](respondWithResult(_0x56bb20,null))[_0x7494('0x46')](handleError(_0x56bb20,null));}; \ No newline at end of file +var _0x0f02=['ZohoConfiguration','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','update','getFields','findOne','rawAttributes','getSubjects','ZohoField','getDescriptions','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','then','destroy','name','index','type','map','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options'];(function(_0x1f0bba,_0x430c51){var _0x258c06=function(_0x4b905e){while(--_0x4b905e){_0x1f0bba['push'](_0x1f0bba['shift']());}};_0x258c06(++_0x430c51);}(_0x0f02,0x19e));var _0x20f0=function(_0xbde95a,_0x2d2c76){_0xbde95a=_0xbde95a-0x0;var _0xa36c7b=_0x0f02[_0xbde95a];return _0xa36c7b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x20f0('0x0'));var zipdir=require(_0x20f0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x20f0('0x2'));var BPromise=require(_0x20f0('0x3'));var Mustache=require(_0x20f0('0x4'));var util=require(_0x20f0('0x5'));var path=require(_0x20f0('0x6'));var sox=require(_0x20f0('0x7'));var csv=require(_0x20f0('0x8'));var ejs=require(_0x20f0('0x9'));var fs=require('fs');var fs_extra=require(_0x20f0('0xa'));var _=require(_0x20f0('0xb'));var squel=require(_0x20f0('0xc'));var crypto=require(_0x20f0('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x20f0('0x8'));var querystring=require(_0x20f0('0xe'));var Papa=require(_0x20f0('0xf'));var Redis=require(_0x20f0('0x10'));var authService=require(_0x20f0('0x11'));var qs=require(_0x20f0('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x20f0('0x13'));var logger=require(_0x20f0('0x14'))(_0x20f0('0x15'));var utils=require(_0x20f0('0x16'));var config=require(_0x20f0('0x17'));var licenseUtil=require(_0x20f0('0x18'));var db=require(_0x20f0('0x19'))['db'];function respondWithStatusCode(_0x370582,_0x4b0ea8){_0x4b0ea8=_0x4b0ea8||0xcc;return function(_0x4655c7){if(_0x4655c7){return _0x370582[_0x20f0('0x1a')](_0x4b0ea8);}return _0x370582[_0x20f0('0x1b')](_0x4b0ea8)[_0x20f0('0x1c')]();};}function respondWithResult(_0x186703,_0x5eccec){_0x5eccec=_0x5eccec||0xc8;return function(_0xd46f0c){if(_0xd46f0c){return _0x186703[_0x20f0('0x1b')](_0x5eccec)[_0x20f0('0x1d')](_0xd46f0c);}};}function respondWithFilteredResult(_0x406edb,_0x2780ec){return function(_0x4e12a4){if(_0x4e12a4){var _0x1d1968=typeof _0x2780ec[_0x20f0('0x1e')]===_0x20f0('0x1f')&&typeof _0x2780ec[_0x20f0('0x20')]===_0x20f0('0x1f');var _0xa4feed=_0x4e12a4[_0x20f0('0x21')];var _0x5178bc=_0x1d1968?0x0:_0x2780ec[_0x20f0('0x1e')];var _0x5b23f9=_0x1d1968?_0x4e12a4['count']:_0x2780ec[_0x20f0('0x1e')]+_0x2780ec[_0x20f0('0x20')];var _0x3fbfd4;if(_0x5b23f9>=_0xa4feed){_0x5b23f9=_0xa4feed;_0x3fbfd4=0xc8;}else{_0x3fbfd4=0xce;}_0x406edb[_0x20f0('0x1b')](_0x3fbfd4);return _0x406edb[_0x20f0('0x22')]('Content-Range',_0x5178bc+'-'+_0x5b23f9+'/'+_0xa4feed)[_0x20f0('0x1d')](_0x4e12a4);}return null;};}function patchUpdates(_0x108d62){return function(_0x4d1325){try{jsonpatch['apply'](_0x4d1325,_0x108d62,!![]);}catch(_0xd3be3b){return BPromise[_0x20f0('0x23')](_0xd3be3b);}return _0x4d1325[_0x20f0('0x24')]();};}function saveUpdates(_0x3b7cc6,_0x52c4b3){return function(_0x3545a2){if(_0x3545a2){return _0x3545a2['update'](_0x3b7cc6)[_0x20f0('0x25')](function(_0x4cb2e8){return _0x4cb2e8;});}return null;};}function removeEntity(_0x162c0c,_0x4a04bf){return function(_0x31842d){if(_0x31842d){return _0x31842d[_0x20f0('0x26')]()[_0x20f0('0x25')](function(){_0x162c0c[_0x20f0('0x1b')](0xcc)[_0x20f0('0x1c')]();});}};}function handleEntityNotFound(_0x151a82,_0x46a585){return function(_0x1baca1){if(!_0x1baca1){_0x151a82[_0x20f0('0x1a')](0x194);}return _0x1baca1;};}function handleError(_0x11e490,_0x1186d1){_0x1186d1=_0x1186d1||0x1f4;return function(_0x44888d){logger['error'](_0x44888d['stack']);if(_0x44888d[_0x20f0('0x27')]){delete _0x44888d['name'];}_0x11e490[_0x20f0('0x1b')](_0x1186d1)['send'](_0x44888d);};}exports[_0x20f0('0x28')]=function(_0x56c8d1,_0x5a1a71){var _0x287764={},_0x175974={},_0x268b6b={'count':0x0,'rows':[]};var _0x1e4f15=_['map'](db['ZohoConfiguration']['rawAttributes'],function(_0x4f8fad){return{'name':_0x4f8fad['fieldName'],'type':_0x4f8fad[_0x20f0('0x29')]['key']};});_0x175974['model']=_[_0x20f0('0x2a')](_0x1e4f15,'name');_0x175974[_0x20f0('0x2b')]=_['keys'](_0x56c8d1['query']);_0x175974[_0x20f0('0x2c')]=_[_0x20f0('0x2d')](_0x175974[_0x20f0('0x2e')],_0x175974[_0x20f0('0x2b')]);_0x287764['attributes']=_[_0x20f0('0x2d')](_0x175974[_0x20f0('0x2e')],qs[_0x20f0('0x2f')](_0x56c8d1[_0x20f0('0x2b')][_0x20f0('0x2f')]));_0x287764[_0x20f0('0x30')]=_0x287764[_0x20f0('0x30')][_0x20f0('0x31')]?_0x287764[_0x20f0('0x30')]:_0x175974[_0x20f0('0x2e')];if(!_0x56c8d1[_0x20f0('0x2b')][_0x20f0('0x32')](_0x20f0('0x33'))){_0x287764[_0x20f0('0x20')]=qs[_0x20f0('0x20')](_0x56c8d1[_0x20f0('0x2b')][_0x20f0('0x20')]);_0x287764['offset']=qs[_0x20f0('0x1e')](_0x56c8d1[_0x20f0('0x2b')][_0x20f0('0x1e')]);}_0x287764[_0x20f0('0x34')]=qs[_0x20f0('0x35')](_0x56c8d1[_0x20f0('0x2b')][_0x20f0('0x35')]);_0x287764[_0x20f0('0x36')]=qs['filters'](_[_0x20f0('0x37')](_0x56c8d1[_0x20f0('0x2b')],_0x175974[_0x20f0('0x2c')]),_0x1e4f15);if(_0x56c8d1[_0x20f0('0x2b')][_0x20f0('0x38')]){_0x287764[_0x20f0('0x36')]=_['merge'](_0x287764[_0x20f0('0x36')],{'$or':_[_0x20f0('0x2a')](_0x1e4f15,function(_0x3b8bf1){if(_0x3b8bf1[_0x20f0('0x29')]!==_0x20f0('0x39')){var _0xaa5b0c={};_0xaa5b0c[_0x3b8bf1[_0x20f0('0x27')]]={'$like':'%'+_0x56c8d1[_0x20f0('0x2b')][_0x20f0('0x38')]+'%'};return _0xaa5b0c;}})});}_0x287764=_[_0x20f0('0x3a')]({},_0x287764,_0x56c8d1[_0x20f0('0x3b')]);var _0x482ed5={'where':_0x287764[_0x20f0('0x36')]};return db[_0x20f0('0x3c')][_0x20f0('0x21')](_0x482ed5)[_0x20f0('0x25')](function(_0x266a2c){_0x268b6b[_0x20f0('0x21')]=_0x266a2c;if(_0x56c8d1['query'][_0x20f0('0x3d')]){_0x287764[_0x20f0('0x3e')]=[{'all':!![]}];}return db[_0x20f0('0x3c')][_0x20f0('0x3f')](_0x287764);})[_0x20f0('0x25')](function(_0x23fac8){_0x268b6b[_0x20f0('0x40')]=_0x23fac8;return _0x268b6b;})[_0x20f0('0x25')](respondWithFilteredResult(_0x5a1a71,_0x287764))[_0x20f0('0x41')](handleError(_0x5a1a71,null));};exports[_0x20f0('0x42')]=function(_0x2dce51,_0x1b9a77){var _0x12908d={'raw':![],'where':{'id':_0x2dce51[_0x20f0('0x43')]['id']}},_0x423c78={};_0x423c78[_0x20f0('0x2e')]=_['keys'](db[_0x20f0('0x3c')]['rawAttributes']);_0x423c78[_0x20f0('0x2b')]=_[_0x20f0('0x44')](_0x2dce51[_0x20f0('0x2b')]);_0x423c78[_0x20f0('0x2c')]=_[_0x20f0('0x2d')](_0x423c78[_0x20f0('0x2e')],_0x423c78[_0x20f0('0x2b')]);_0x12908d['attributes']=_[_0x20f0('0x2d')](_0x423c78[_0x20f0('0x2e')],qs[_0x20f0('0x2f')](_0x2dce51[_0x20f0('0x2b')][_0x20f0('0x2f')]));_0x12908d['attributes']=_0x12908d[_0x20f0('0x30')]['length']?_0x12908d[_0x20f0('0x30')]:_0x423c78[_0x20f0('0x2e')];if(_0x2dce51[_0x20f0('0x2b')][_0x20f0('0x3d')]){_0x12908d['include']=[{'all':!![]}];}_0x12908d=_[_0x20f0('0x3a')]({},_0x12908d,_0x2dce51[_0x20f0('0x3b')]);return db[_0x20f0('0x3c')][_0x20f0('0x45')](_0x12908d)['then'](handleEntityNotFound(_0x1b9a77,null))[_0x20f0('0x25')](respondWithResult(_0x1b9a77,null))[_0x20f0('0x41')](handleError(_0x1b9a77,null));};exports[_0x20f0('0x46')]=function(_0x3a1596,_0x217552){return db[_0x20f0('0x3c')][_0x20f0('0x46')](_0x3a1596[_0x20f0('0x47')],{})['then'](respondWithResult(_0x217552,0xc9))[_0x20f0('0x41')](handleError(_0x217552,null));};exports[_0x20f0('0x48')]=function(_0x117b70,_0x3fcfb4){if(_0x117b70[_0x20f0('0x47')]['id']){delete _0x117b70[_0x20f0('0x47')]['id'];}return db[_0x20f0('0x3c')][_0x20f0('0x45')]({'where':{'id':_0x117b70[_0x20f0('0x43')]['id']}})['then'](handleEntityNotFound(_0x3fcfb4,null))['then'](saveUpdates(_0x117b70['body'],null))['then'](respondWithResult(_0x3fcfb4,null))[_0x20f0('0x41')](handleError(_0x3fcfb4,null));};exports['destroy']=function(_0x589416,_0x3f63f9){return db[_0x20f0('0x3c')]['find']({'where':{'id':_0x589416['params']['id']}})[_0x20f0('0x25')](handleEntityNotFound(_0x3f63f9,null))[_0x20f0('0x25')](removeEntity(_0x3f63f9,null))[_0x20f0('0x41')](handleError(_0x3f63f9,null));};exports[_0x20f0('0x49')]=function(_0x529902,_0x4b30dc,_0x5862de){var _0x4de8a5={};var _0x1b7dc2={};var _0x82ebc2;var _0x1b30d2;return db['ZohoConfiguration'][_0x20f0('0x4a')]({'where':{'id':_0x529902['params']['id']}})['then'](handleEntityNotFound(_0x4b30dc,null))[_0x20f0('0x25')](function(_0xcc6788){if(_0xcc6788){_0x82ebc2=_0xcc6788;_0x1b7dc2['model']=_[_0x20f0('0x44')](db['ZohoField'][_0x20f0('0x4b')]);_0x1b7dc2[_0x20f0('0x2b')]=_[_0x20f0('0x44')](_0x529902['query']);_0x1b7dc2[_0x20f0('0x2c')]=_[_0x20f0('0x2d')](_0x1b7dc2[_0x20f0('0x2e')],_0x1b7dc2['query']);_0x4de8a5[_0x20f0('0x30')]=_[_0x20f0('0x2d')](_0x1b7dc2[_0x20f0('0x2e')],qs['fields'](_0x529902[_0x20f0('0x2b')]['fields']));_0x4de8a5['attributes']=_0x4de8a5[_0x20f0('0x30')][_0x20f0('0x31')]?_0x4de8a5[_0x20f0('0x30')]:_0x1b7dc2[_0x20f0('0x2e')];_0x4de8a5[_0x20f0('0x34')]=qs[_0x20f0('0x35')](_0x529902[_0x20f0('0x2b')]['sort']);_0x4de8a5[_0x20f0('0x36')]=qs['filters'](_[_0x20f0('0x37')](_0x529902[_0x20f0('0x2b')],_0x1b7dc2[_0x20f0('0x2c')]));if(_0x529902[_0x20f0('0x2b')][_0x20f0('0x38')]){_0x4de8a5['where']=_[_0x20f0('0x3a')](_0x4de8a5[_0x20f0('0x36')],{'$or':_[_0x20f0('0x2a')](_0x4de8a5['attributes'],function(_0x47d084){var _0x4a3551={};_0x4a3551[_0x47d084]={'$like':'%'+_0x529902[_0x20f0('0x2b')][_0x20f0('0x38')]+'%'};return _0x4a3551;})});}_0x4de8a5=_[_0x20f0('0x3a')]({},_0x4de8a5,_0x529902['options']);return _0x82ebc2[_0x20f0('0x49')](_0x4de8a5);}})[_0x20f0('0x25')](function(_0x97a926){if(_0x97a926){_0x1b30d2=_0x97a926['length'];if(!_0x529902[_0x20f0('0x2b')][_0x20f0('0x32')](_0x20f0('0x33'))){_0x4de8a5[_0x20f0('0x20')]=qs['limit'](_0x529902[_0x20f0('0x2b')][_0x20f0('0x20')]);_0x4de8a5['offset']=qs[_0x20f0('0x1e')](_0x529902['query']['offset']);}return _0x82ebc2['getFields'](_0x4de8a5);}})[_0x20f0('0x25')](function(_0x2a3e7a){if(_0x2a3e7a){return _0x2a3e7a?{'count':_0x1b30d2,'rows':_0x2a3e7a}:null;}})[_0x20f0('0x25')](respondWithResult(_0x4b30dc,null))[_0x20f0('0x41')](handleError(_0x4b30dc,null));};exports[_0x20f0('0x4c')]=function(_0x35ec5a,_0x3eed3,_0x1ddf20){var _0x592eb9={};var _0x5c7fa6={};var _0x246bc6;var _0x31f754;return db[_0x20f0('0x3c')][_0x20f0('0x4a')]({'where':{'id':_0x35ec5a['params']['id']}})['then'](handleEntityNotFound(_0x3eed3,null))[_0x20f0('0x25')](function(_0x590cf2){if(_0x590cf2){_0x246bc6=_0x590cf2;_0x5c7fa6[_0x20f0('0x2e')]=_[_0x20f0('0x44')](db[_0x20f0('0x4d')][_0x20f0('0x4b')]);_0x5c7fa6[_0x20f0('0x2b')]=_[_0x20f0('0x44')](_0x35ec5a[_0x20f0('0x2b')]);_0x5c7fa6[_0x20f0('0x2c')]=_[_0x20f0('0x2d')](_0x5c7fa6['model'],_0x5c7fa6[_0x20f0('0x2b')]);_0x592eb9[_0x20f0('0x30')]=_[_0x20f0('0x2d')](_0x5c7fa6[_0x20f0('0x2e')],qs[_0x20f0('0x2f')](_0x35ec5a[_0x20f0('0x2b')][_0x20f0('0x2f')]));_0x592eb9[_0x20f0('0x30')]=_0x592eb9[_0x20f0('0x30')][_0x20f0('0x31')]?_0x592eb9[_0x20f0('0x30')]:_0x5c7fa6[_0x20f0('0x2e')];_0x592eb9['order']=qs['sort'](_0x35ec5a['query'][_0x20f0('0x35')]);_0x592eb9[_0x20f0('0x36')]=qs[_0x20f0('0x2c')](_[_0x20f0('0x37')](_0x35ec5a[_0x20f0('0x2b')],_0x5c7fa6[_0x20f0('0x2c')]));if(_0x35ec5a['query'][_0x20f0('0x38')]){_0x592eb9[_0x20f0('0x36')]=_[_0x20f0('0x3a')](_0x592eb9[_0x20f0('0x36')],{'$or':_['map'](_0x592eb9['attributes'],function(_0x33b2ac){var _0x4f33d4={};_0x4f33d4[_0x33b2ac]={'$like':'%'+_0x35ec5a[_0x20f0('0x2b')]['filter']+'%'};return _0x4f33d4;})});}_0x592eb9=_[_0x20f0('0x3a')]({},_0x592eb9,_0x35ec5a['options']);return _0x246bc6[_0x20f0('0x4c')](_0x592eb9);}})[_0x20f0('0x25')](function(_0x2a0f0d){if(_0x2a0f0d){_0x31f754=_0x2a0f0d[_0x20f0('0x31')];if(!_0x35ec5a[_0x20f0('0x2b')]['hasOwnProperty'](_0x20f0('0x33'))){_0x592eb9[_0x20f0('0x20')]=qs[_0x20f0('0x20')](_0x35ec5a[_0x20f0('0x2b')][_0x20f0('0x20')]);_0x592eb9[_0x20f0('0x1e')]=qs[_0x20f0('0x1e')](_0x35ec5a[_0x20f0('0x2b')][_0x20f0('0x1e')]);}return _0x246bc6[_0x20f0('0x4c')](_0x592eb9);}})['then'](function(_0x54e76e){if(_0x54e76e){return _0x54e76e?{'count':_0x31f754,'rows':_0x54e76e}:null;}})[_0x20f0('0x25')](respondWithResult(_0x3eed3,null))['catch'](handleError(_0x3eed3,null));};exports[_0x20f0('0x4e')]=function(_0x1ab085,_0x30c6bd,_0x16308f){var _0x227017={};var _0x5bb855={};var _0x3b793d;var _0x3360d4;return db['ZohoConfiguration'][_0x20f0('0x4a')]({'where':{'id':_0x1ab085[_0x20f0('0x43')]['id']}})['then'](handleEntityNotFound(_0x30c6bd,null))[_0x20f0('0x25')](function(_0x5493b5){if(_0x5493b5){_0x3b793d=_0x5493b5;_0x5bb855['model']=_[_0x20f0('0x44')](db[_0x20f0('0x4d')][_0x20f0('0x4b')]);_0x5bb855['query']=_['keys'](_0x1ab085['query']);_0x5bb855['filters']=_[_0x20f0('0x2d')](_0x5bb855['model'],_0x5bb855[_0x20f0('0x2b')]);_0x227017[_0x20f0('0x30')]=_[_0x20f0('0x2d')](_0x5bb855['model'],qs[_0x20f0('0x2f')](_0x1ab085['query'][_0x20f0('0x2f')]));_0x227017[_0x20f0('0x30')]=_0x227017[_0x20f0('0x30')]['length']?_0x227017['attributes']:_0x5bb855['model'];_0x227017['order']=qs['sort'](_0x1ab085[_0x20f0('0x2b')]['sort']);_0x227017[_0x20f0('0x36')]=qs[_0x20f0('0x2c')](_[_0x20f0('0x37')](_0x1ab085['query'],_0x5bb855[_0x20f0('0x2c')]));if(_0x1ab085[_0x20f0('0x2b')][_0x20f0('0x38')]){_0x227017[_0x20f0('0x36')]=_[_0x20f0('0x3a')](_0x227017[_0x20f0('0x36')],{'$or':_['map'](_0x227017[_0x20f0('0x30')],function(_0x496e54){var _0x2e147d={};_0x2e147d[_0x496e54]={'$like':'%'+_0x1ab085[_0x20f0('0x2b')][_0x20f0('0x38')]+'%'};return _0x2e147d;})});}_0x227017=_[_0x20f0('0x3a')]({},_0x227017,_0x1ab085[_0x20f0('0x3b')]);return _0x3b793d[_0x20f0('0x4e')](_0x227017);}})[_0x20f0('0x25')](function(_0x30d07c){if(_0x30d07c){_0x3360d4=_0x30d07c[_0x20f0('0x31')];if(!_0x1ab085[_0x20f0('0x2b')][_0x20f0('0x32')]('nolimit')){_0x227017[_0x20f0('0x20')]=qs[_0x20f0('0x20')](_0x1ab085[_0x20f0('0x2b')][_0x20f0('0x20')]);_0x227017[_0x20f0('0x1e')]=qs['offset'](_0x1ab085['query'][_0x20f0('0x1e')]);}return _0x3b793d[_0x20f0('0x4e')](_0x227017);}})['then'](function(_0x25a55f){if(_0x25a55f){return _0x25a55f?{'count':_0x3360d4,'rows':_0x25a55f}:null;}})[_0x20f0('0x25')](respondWithResult(_0x30c6bd,null))[_0x20f0('0x41')](handleError(_0x30c6bd,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index d5d7b87..fdd0956 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 _0xac04=['exports','ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment'];(function(_0x229764,_0x3687f1){var _0x143dea=function(_0x473a68){while(--_0x473a68){_0x229764['push'](_0x229764['shift']());}};_0x143dea(++_0x3687f1);}(_0xac04,0x1c6));var _0x4ac0=function(_0x4fee3e,_0x53e3be){_0x4fee3e=_0x4fee3e-0x0;var _0x192163=_0xac04[_0x4fee3e];return _0x192163;};'use strict';var _=require(_0x4ac0('0x0'));var util=require(_0x4ac0('0x1'));var logger=require(_0x4ac0('0x2'))(_0x4ac0('0x3'));var moment=require(_0x4ac0('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4ac0('0x5'));var rimraf=require(_0x4ac0('0x6'));var config=require(_0x4ac0('0x7'));var attributes=require('./intZohoConfiguration.attributes');module[_0x4ac0('0x8')]=function(_0x567e45,_0x56d29a){return _0x567e45['define'](_0x4ac0('0x9'),attributes,{'tableName':_0x4ac0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9096=['path','rimraf','../../config/environment','./intZohoConfiguration.attributes','define','int_zoho_configurations','lodash','util','../../config/logger','api','moment'];(function(_0x2c027b,_0x65be3c){var _0x56c2c7=function(_0x40088d){while(--_0x40088d){_0x2c027b['push'](_0x2c027b['shift']());}};_0x56c2c7(++_0x65be3c);}(_0x9096,0xab));var _0x6909=function(_0x13876b,_0x3f2908){_0x13876b=_0x13876b-0x0;var _0x39e8c7=_0x9096[_0x13876b];return _0x39e8c7;};'use strict';var _=require(_0x6909('0x0'));var util=require(_0x6909('0x1'));var logger=require(_0x6909('0x2'))(_0x6909('0x3'));var moment=require(_0x6909('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6909('0x5'));var rimraf=require(_0x6909('0x6'));var config=require(_0x6909('0x7'));var attributes=require(_0x6909('0x8'));module['exports']=function(_0xfcf8a4,_0x3268ee){return _0xfcf8a4[_0x6909('0x9')]('ZohoConfiguration',attributes,{'tableName':_0x6909('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 88fe13e..7811197 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 _0x2ad2=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoConfiguration,\x20%s,\x20%s','message','result','catch'];(function(_0x4d934b,_0x52f8e9){var _0xc0338b=function(_0x1a356c){while(--_0x1a356c){_0x4d934b['push'](_0x4d934b['shift']());}};_0xc0338b(++_0x52f8e9);}(_0x2ad2,0xe6));var _0x22ad=function(_0x55cf7a,_0x3e6bc5){_0x55cf7a=_0x55cf7a-0x0;var _0x3b79f2=_0x2ad2[_0x55cf7a];return _0x3b79f2;};'use strict';var _=require('lodash');var util=require(_0x22ad('0x0'));var moment=require('moment');var BPromise=require(_0x22ad('0x1'));var rs=require(_0x22ad('0x2'));var fs=require('fs');var Redis=require(_0x22ad('0x3'));var db=require(_0x22ad('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x22ad('0x5'))(_0x22ad('0x6'));var config=require('../../config/environment');var jayson=require(_0x22ad('0x7'));var client=jayson[_0x22ad('0x8')][_0x22ad('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4f31b7,_0x110235,_0x1744f1){return new BPromise(function(_0x448637,_0x9d847c){return client[_0x22ad('0xa')](_0x4f31b7,_0x1744f1)[_0x22ad('0xb')](function(_0x375070){logger[_0x22ad('0xc')]('ZohoConfiguration,\x20%s,\x20%s',_0x110235,_0x22ad('0xd'));logger[_0x22ad('0xe')](_0x22ad('0xf'),_0x110235,'request\x20sent',JSON[_0x22ad('0x10')](_0x375070));if(_0x375070[_0x22ad('0x11')]){if(_0x375070[_0x22ad('0x11')][_0x22ad('0x12')]===0x1f4){logger[_0x22ad('0x11')](_0x22ad('0x13'),_0x110235,_0x375070['error'][_0x22ad('0x14')]);return _0x9d847c(_0x375070[_0x22ad('0x11')][_0x22ad('0x14')]);}logger[_0x22ad('0x11')](_0x22ad('0x13'),_0x110235,_0x375070[_0x22ad('0x11')][_0x22ad('0x14')]);return _0x448637(_0x375070[_0x22ad('0x11')][_0x22ad('0x14')]);}else{logger[_0x22ad('0xc')](_0x22ad('0x13'),_0x110235,'request\x20sent');_0x448637(_0x375070[_0x22ad('0x15')]['message']);}})[_0x22ad('0x16')](function(_0x4d9a8b){logger[_0x22ad('0x11')](_0x22ad('0x13'),_0x110235,_0x4d9a8b);_0x9d847c(_0x4d9a8b);});});} \ No newline at end of file +var _0x2c24=['code','message','result','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x2c24,0xab));var _0x42c2=function(_0x4ce3ad,_0x842c57){_0x4ce3ad=_0x4ce3ad-0x0;var _0x6306d7=_0x2c24[_0x4ce3ad];return _0x6306d7;};'use strict';var _=require(_0x42c2('0x0'));var util=require(_0x42c2('0x1'));var moment=require(_0x42c2('0x2'));var BPromise=require('bluebird');var rs=require(_0x42c2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x42c2('0x4'))['db'];var utils=require(_0x42c2('0x5'));var logger=require(_0x42c2('0x6'))(_0x42c2('0x7'));var config=require(_0x42c2('0x8'));var jayson=require(_0x42c2('0x9'));var client=jayson[_0x42c2('0xa')][_0x42c2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x59c8af,_0x301b56,_0x1895b5){return new BPromise(function(_0xae2fe0,_0x4d5a96){return client[_0x42c2('0xc')](_0x59c8af,_0x1895b5)[_0x42c2('0xd')](function(_0x2dba62){logger[_0x42c2('0xe')](_0x42c2('0xf'),_0x301b56,'request\x20sent');logger[_0x42c2('0x10')](_0x42c2('0x11'),_0x301b56,_0x42c2('0x12'),JSON[_0x42c2('0x13')](_0x2dba62));if(_0x2dba62[_0x42c2('0x14')]){if(_0x2dba62[_0x42c2('0x14')][_0x42c2('0x15')]===0x1f4){logger[_0x42c2('0x14')](_0x42c2('0xf'),_0x301b56,_0x2dba62[_0x42c2('0x14')][_0x42c2('0x16')]);return _0x4d5a96(_0x2dba62[_0x42c2('0x14')][_0x42c2('0x16')]);}logger[_0x42c2('0x14')](_0x42c2('0xf'),_0x301b56,_0x2dba62[_0x42c2('0x14')][_0x42c2('0x16')]);return _0xae2fe0(_0x2dba62['error'][_0x42c2('0x16')]);}else{logger[_0x42c2('0xe')](_0x42c2('0xf'),_0x301b56,_0x42c2('0x12'));_0xae2fe0(_0x2dba62[_0x42c2('0x17')][_0x42c2('0x16')]);}})['catch'](function(_0x4ffcfe){logger[_0x42c2('0x14')](_0x42c2('0xf'),_0x301b56,_0x4ffcfe);_0x4d5a96(_0x4ffcfe);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 12f6a24..a515853 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 _0x222c=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','post','create','update','delete','destroy','exports','multer','util','path'];(function(_0x38b817,_0x14f0c3){var _0x207922=function(_0x4d8515){while(--_0x4d8515){_0x38b817['push'](_0x38b817['shift']());}};_0x207922(++_0x14f0c3);}(_0x222c,0x1d8));var _0xc222=function(_0x4af77a,_0xfebfbd){_0x4af77a=_0x4af77a-0x0;var _0x4137de=_0x222c[_0x4af77a];return _0x4137de;};'use strict';var multer=require(_0xc222('0x0'));var util=require(_0xc222('0x1'));var path=require(_0xc222('0x2'));var timeout=require(_0xc222('0x3'));var express=require(_0xc222('0x4'));var router=express[_0xc222('0x5')]();var fs_extra=require(_0xc222('0x6'));var auth=require(_0xc222('0x7'));var interaction=require(_0xc222('0x8'));var config=require(_0xc222('0x9'));var controller=require('./intZohoField.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xc222('0xa')](_0xc222('0xb'),auth[_0xc222('0xc')](),controller['show']);router[_0xc222('0xd')]('/',auth[_0xc222('0xc')](),controller[_0xc222('0xe')]);router['put'](_0xc222('0xb'),auth[_0xc222('0xc')](),controller[_0xc222('0xf')]);router[_0xc222('0x10')](_0xc222('0xb'),auth[_0xc222('0xc')](),controller[_0xc222('0x11')]);module[_0xc222('0x12')]=router; \ No newline at end of file +var _0xe862=['create','put','update','exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe862,0xf2));var _0x2e86=function(_0x5b01a9,_0x5fa86f){_0x5b01a9=_0x5b01a9-0x0;var _0x460973=_0xe862[_0x5b01a9];return _0x460973;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2e86('0x0'));var timeout=require(_0x2e86('0x1'));var express=require(_0x2e86('0x2'));var router=express['Router']();var fs_extra=require(_0x2e86('0x3'));var auth=require(_0x2e86('0x4'));var interaction=require(_0x2e86('0x5'));var config=require(_0x2e86('0x6'));var controller=require('./intZohoField.controller');router[_0x2e86('0x7')]('/',auth[_0x2e86('0x8')](),controller[_0x2e86('0x9')]);router['get'](_0x2e86('0xa'),auth[_0x2e86('0x8')](),controller[_0x2e86('0xb')]);router[_0x2e86('0xc')]('/',auth[_0x2e86('0x8')](),controller[_0x2e86('0xd')]);router[_0x2e86('0xe')]('/:id',auth[_0x2e86('0x8')](),controller[_0x2e86('0xf')]);router['delete'](_0x2e86('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x2e86('0x10')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index eba8602..dce5e44 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 _0x5326=['sequelize','ENUM','variable','customVariable','keyValue','picklist','string','STRING','BOOLEAN'];(function(_0x4cca2f,_0xa86659){var _0x25c652=function(_0x282fb3){while(--_0x282fb3){_0x4cca2f['push'](_0x4cca2f['shift']());}};_0x25c652(++_0xa86659);}(_0x5326,0x120));var _0x6532=function(_0x99e075,_0x211213){_0x99e075=_0x99e075-0x0;var _0x1a81ba=_0x5326[_0x99e075];return _0x1a81ba;};'use strict';var Sequelize=require(_0x6532('0x0'));module['exports']={'type':{'type':Sequelize[_0x6532('0x1')]('string',_0x6532('0x2'),_0x6532('0x3'),_0x6532('0x4'),_0x6532('0x5')),'defaultValue':_0x6532('0x6')},'content':{'type':Sequelize[_0x6532('0x7')]},'key':{'type':Sequelize[_0x6532('0x7')]},'keyType':{'type':Sequelize[_0x6532('0x1')](_0x6532('0x6'),_0x6532('0x2'),_0x6532('0x3'))},'keyContent':{'type':Sequelize[_0x6532('0x7')]},'idField':{'type':Sequelize[_0x6532('0x7')]},'nameField':{'type':Sequelize[_0x6532('0x7')]},'customField':{'type':Sequelize[_0x6532('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9346=['STRING','ENUM','string','variable','BOOLEAN','sequelize','exports','customVariable','keyValue','picklist'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x9346,0x87));var _0x6934=function(_0x4f7e86,_0x42c860){_0x4f7e86=_0x4f7e86-0x0;var _0x2986c3=_0x9346[_0x4f7e86];return _0x2986c3;};'use strict';var Sequelize=require(_0x6934('0x0'));module[_0x6934('0x1')]={'type':{'type':Sequelize['ENUM']('string','variable',_0x6934('0x2'),_0x6934('0x3'),_0x6934('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x6934('0x5')]},'key':{'type':Sequelize[_0x6934('0x5')]},'keyType':{'type':Sequelize[_0x6934('0x6')](_0x6934('0x7'),_0x6934('0x8'),'customVariable')},'keyContent':{'type':Sequelize[_0x6934('0x5')]},'idField':{'type':Sequelize[_0x6934('0x5')]},'nameField':{'type':Sequelize[_0x6934('0x5')]},'customField':{'type':Sequelize[_0x6934('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6934('0x5')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 81f73d7..0970e03 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 _0x5e2c=['status','json','offset','undefined','limit','count','Content-Range','reject','update','then','destroy','end','error','stack','name','send','index','map','ZohoField','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','hasOwnProperty','nolimit','pick','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','attributes','length','find','catch','create','body','eml-format','rimraf','request-promise','moment','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x92fc32,_0x5de67b){var _0x2bb0ad=function(_0x5d8767){while(--_0x5d8767){_0x92fc32['push'](_0x92fc32['shift']());}};_0x2bb0ad(++_0x5de67b);}(_0x5e2c,0x18d));var _0xc5e2=function(_0x53abe5,_0x33a9e5){_0x53abe5=_0x53abe5-0x0;var _0xc1c37e=_0x5e2c[_0x53abe5];return _0xc1c37e;};'use strict';var emlformat=require(_0xc5e2('0x0'));var rimraf=require(_0xc5e2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc5e2('0x2'));var moment=require(_0xc5e2('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc5e2('0x4'));var path=require(_0xc5e2('0x5'));var sox=require(_0xc5e2('0x6'));var csv=require(_0xc5e2('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc5e2('0x8'));var squel=require(_0xc5e2('0x9'));var crypto=require('crypto');var jsforce=require(_0xc5e2('0xa'));var deskjs=require(_0xc5e2('0xb'));var toCsv=require(_0xc5e2('0x7'));var querystring=require(_0xc5e2('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc5e2('0xd'));var qs=require(_0xc5e2('0xe'));var as=require(_0xc5e2('0xf'));var hardwareService=require(_0xc5e2('0x10'));var logger=require(_0xc5e2('0x11'))(_0xc5e2('0x12'));var utils=require('../../config/utils');var config=require(_0xc5e2('0x13'));var licenseUtil=require(_0xc5e2('0x14'));var db=require(_0xc5e2('0x15'))['db'];function respondWithStatusCode(_0x399c04,_0x15aae9){_0x15aae9=_0x15aae9||0xcc;return function(_0x4f86e6){if(_0x4f86e6){return _0x399c04[_0xc5e2('0x16')](_0x15aae9);}return _0x399c04[_0xc5e2('0x17')](_0x15aae9)['end']();};}function respondWithResult(_0x5c02c6,_0x2d343e){_0x2d343e=_0x2d343e||0xc8;return function(_0x23402){if(_0x23402){return _0x5c02c6['status'](_0x2d343e)[_0xc5e2('0x18')](_0x23402);}};}function respondWithFilteredResult(_0x367c4e,_0x34b548){return function(_0x1df32d){if(_0x1df32d){var _0x33022e=typeof _0x34b548[_0xc5e2('0x19')]===_0xc5e2('0x1a')&&typeof _0x34b548[_0xc5e2('0x1b')]===_0xc5e2('0x1a');var _0x19eb14=_0x1df32d['count'];var _0x353635=_0x33022e?0x0:_0x34b548['offset'];var _0x5857f2=_0x33022e?_0x1df32d[_0xc5e2('0x1c')]:_0x34b548['offset']+_0x34b548['limit'];var _0x14284c;if(_0x5857f2>=_0x19eb14){_0x5857f2=_0x19eb14;_0x14284c=0xc8;}else{_0x14284c=0xce;}_0x367c4e['status'](_0x14284c);return _0x367c4e['set'](_0xc5e2('0x1d'),_0x353635+'-'+_0x5857f2+'/'+_0x19eb14)['json'](_0x1df32d);}return null;};}function patchUpdates(_0x529232){return function(_0x1e8d02){try{jsonpatch['apply'](_0x1e8d02,_0x529232,!![]);}catch(_0x38cc55){return BPromise[_0xc5e2('0x1e')](_0x38cc55);}return _0x1e8d02['save']();};}function saveUpdates(_0x6b7c24,_0x5c8d3d){return function(_0x1ab00b){if(_0x1ab00b){return _0x1ab00b[_0xc5e2('0x1f')](_0x6b7c24)[_0xc5e2('0x20')](function(_0x573d74){return _0x573d74;});}return null;};}function removeEntity(_0x43698e,_0x16c23b){return function(_0x37d636){if(_0x37d636){return _0x37d636[_0xc5e2('0x21')]()[_0xc5e2('0x20')](function(){_0x43698e['status'](0xcc)[_0xc5e2('0x22')]();});}};}function handleEntityNotFound(_0x22b46c,_0x36174c){return function(_0x485c36){if(!_0x485c36){_0x22b46c[_0xc5e2('0x16')](0x194);}return _0x485c36;};}function handleError(_0x494b9d,_0x4d4c80){_0x4d4c80=_0x4d4c80||0x1f4;return function(_0x4d349a){logger[_0xc5e2('0x23')](_0x4d349a[_0xc5e2('0x24')]);if(_0x4d349a[_0xc5e2('0x25')]){delete _0x4d349a[_0xc5e2('0x25')];}_0x494b9d[_0xc5e2('0x17')](_0x4d4c80)[_0xc5e2('0x26')](_0x4d349a);};}exports[_0xc5e2('0x27')]=function(_0x5c8f69,_0x508d6f){var _0x422344={},_0x4caa10={},_0x5699c6={'count':0x0,'rows':[]};var _0x2c3a97=_[_0xc5e2('0x28')](db[_0xc5e2('0x29')][_0xc5e2('0x2a')],function(_0x2742bb){return{'name':_0x2742bb[_0xc5e2('0x2b')],'type':_0x2742bb[_0xc5e2('0x2c')]['key']};});_0x4caa10[_0xc5e2('0x2d')]=_[_0xc5e2('0x28')](_0x2c3a97,_0xc5e2('0x25'));_0x4caa10[_0xc5e2('0x2e')]=_[_0xc5e2('0x2f')](_0x5c8f69[_0xc5e2('0x2e')]);_0x4caa10[_0xc5e2('0x30')]=_[_0xc5e2('0x31')](_0x4caa10['model'],_0x4caa10['query']);_0x422344['attributes']=_[_0xc5e2('0x31')](_0x4caa10[_0xc5e2('0x2d')],qs[_0xc5e2('0x32')](_0x5c8f69[_0xc5e2('0x2e')]['fields']));_0x422344['attributes']=_0x422344['attributes']['length']?_0x422344['attributes']:_0x4caa10[_0xc5e2('0x2d')];if(!_0x5c8f69[_0xc5e2('0x2e')][_0xc5e2('0x33')](_0xc5e2('0x34'))){_0x422344[_0xc5e2('0x1b')]=qs['limit'](_0x5c8f69[_0xc5e2('0x2e')]['limit']);_0x422344['offset']=qs['offset'](_0x5c8f69[_0xc5e2('0x2e')][_0xc5e2('0x19')]);}_0x422344['order']=qs['sort'](_0x5c8f69[_0xc5e2('0x2e')]['sort']);_0x422344['where']=qs[_0xc5e2('0x30')](_[_0xc5e2('0x35')](_0x5c8f69['query'],_0x4caa10['filters']),_0x2c3a97);if(_0x5c8f69['query']['filter']){_0x422344[_0xc5e2('0x36')]=_['merge'](_0x422344['where'],{'$or':_[_0xc5e2('0x28')](_0x2c3a97,function(_0x3ab52b){if(_0x3ab52b[_0xc5e2('0x2c')]!==_0xc5e2('0x37')){var _0x12c3a5={};_0x12c3a5[_0x3ab52b['name']]={'$like':'%'+_0x5c8f69['query']['filter']+'%'};return _0x12c3a5;}})});}_0x422344=_[_0xc5e2('0x38')]({},_0x422344,_0x5c8f69[_0xc5e2('0x39')]);var _0x304180={'where':_0x422344[_0xc5e2('0x36')]};return db['ZohoField'][_0xc5e2('0x1c')](_0x304180)[_0xc5e2('0x20')](function(_0x23882f){_0x5699c6[_0xc5e2('0x1c')]=_0x23882f;if(_0x5c8f69[_0xc5e2('0x2e')][_0xc5e2('0x3a')]){_0x422344[_0xc5e2('0x3b')]=[{'all':!![]}];}return db[_0xc5e2('0x29')][_0xc5e2('0x3c')](_0x422344);})[_0xc5e2('0x20')](function(_0x1ad676){_0x5699c6[_0xc5e2('0x3d')]=_0x1ad676;return _0x5699c6;})[_0xc5e2('0x20')](respondWithFilteredResult(_0x508d6f,_0x422344))['catch'](handleError(_0x508d6f,null));};exports[_0xc5e2('0x3e')]=function(_0x5c1d5c,_0x5cecc2){var _0x56ae3f={'raw':!![],'where':{'id':_0x5c1d5c[_0xc5e2('0x3f')]['id']}},_0x226135={};_0x226135[_0xc5e2('0x2d')]=_[_0xc5e2('0x2f')](db[_0xc5e2('0x29')][_0xc5e2('0x2a')]);_0x226135[_0xc5e2('0x2e')]=_['keys'](_0x5c1d5c[_0xc5e2('0x2e')]);_0x226135['filters']=_[_0xc5e2('0x31')](_0x226135['model'],_0x226135[_0xc5e2('0x2e')]);_0x56ae3f[_0xc5e2('0x40')]=_['intersection'](_0x226135['model'],qs[_0xc5e2('0x32')](_0x5c1d5c[_0xc5e2('0x2e')][_0xc5e2('0x32')]));_0x56ae3f[_0xc5e2('0x40')]=_0x56ae3f[_0xc5e2('0x40')][_0xc5e2('0x41')]?_0x56ae3f[_0xc5e2('0x40')]:_0x226135[_0xc5e2('0x2d')];if(_0x5c1d5c['query'][_0xc5e2('0x3a')]){_0x56ae3f['include']=[{'all':!![]}];}_0x56ae3f=_[_0xc5e2('0x38')]({},_0x56ae3f,_0x5c1d5c[_0xc5e2('0x39')]);return db[_0xc5e2('0x29')][_0xc5e2('0x42')](_0x56ae3f)[_0xc5e2('0x20')](handleEntityNotFound(_0x5cecc2,null))['then'](respondWithResult(_0x5cecc2,null))[_0xc5e2('0x43')](handleError(_0x5cecc2,null));};exports[_0xc5e2('0x44')]=function(_0x35cd6a,_0x1b122c){return db[_0xc5e2('0x29')][_0xc5e2('0x44')](_0x35cd6a[_0xc5e2('0x45')],{})['then'](respondWithResult(_0x1b122c,0xc9))[_0xc5e2('0x43')](handleError(_0x1b122c,null));};exports['update']=function(_0x4b5997,_0x32317f){if(_0x4b5997[_0xc5e2('0x45')]['id']){delete _0x4b5997[_0xc5e2('0x45')]['id'];}return db[_0xc5e2('0x29')][_0xc5e2('0x42')]({'where':{'id':_0x4b5997['params']['id']}})[_0xc5e2('0x20')](handleEntityNotFound(_0x32317f,null))[_0xc5e2('0x20')](saveUpdates(_0x4b5997[_0xc5e2('0x45')],null))[_0xc5e2('0x20')](respondWithResult(_0x32317f,null))[_0xc5e2('0x43')](handleError(_0x32317f,null));};exports[_0xc5e2('0x21')]=function(_0x10d748,_0x21b405){return db[_0xc5e2('0x29')][_0xc5e2('0x42')]({'where':{'id':_0x10d748['params']['id']}})[_0xc5e2('0x20')](handleEntityNotFound(_0x21b405,null))[_0xc5e2('0x20')](removeEntity(_0x21b405,null))['catch'](handleError(_0x21b405,null));}; \ No newline at end of file +var _0xbabe=['fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','order','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','update','find','eml-format','rimraf','fast-json-patch','bluebird','util','path','to-csv','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','apply','reject','save','then','destroy','error','stack','name','ZohoField','rawAttributes'];(function(_0x15e70c,_0x5ac1d6){var _0x5f2f41=function(_0x397c9a){while(--_0x397c9a){_0x15e70c['push'](_0x15e70c['shift']());}};_0x5f2f41(++_0x5ac1d6);}(_0xbabe,0x12e));var _0xebab=function(_0x11d6a1,_0x57db5d){_0x11d6a1=_0x11d6a1-0x0;var _0x5c2e4b=_0xbabe[_0x11d6a1];return _0x5c2e4b;};'use strict';var emlformat=require(_0xebab('0x0'));var rimraf=require(_0xebab('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xebab('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xebab('0x3'));var Mustache=require('mustache');var util=require(_0xebab('0x4'));var path=require(_0xebab('0x5'));var sox=require('sox');var csv=require(_0xebab('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xebab('0x7'));var _=require(_0xebab('0x8'));var squel=require(_0xebab('0x9'));var crypto=require('crypto');var jsforce=require(_0xebab('0xa'));var deskjs=require(_0xebab('0xb'));var toCsv=require(_0xebab('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xebab('0xc'));var authService=require(_0xebab('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xebab('0xe'));var hardwareService=require(_0xebab('0xf'));var logger=require(_0xebab('0x10'))(_0xebab('0x11'));var utils=require(_0xebab('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xebab('0x13'))['db'];function respondWithStatusCode(_0x490c37,_0x22ae65){_0x22ae65=_0x22ae65||0xcc;return function(_0x2f732b){if(_0x2f732b){return _0x490c37[_0xebab('0x14')](_0x22ae65);}return _0x490c37['status'](_0x22ae65)[_0xebab('0x15')]();};}function respondWithResult(_0x254192,_0x12346f){_0x12346f=_0x12346f||0xc8;return function(_0x5e6af8){if(_0x5e6af8){return _0x254192[_0xebab('0x16')](_0x12346f)[_0xebab('0x17')](_0x5e6af8);}};}function respondWithFilteredResult(_0x43455e,_0x4725fd){return function(_0x1685c0){if(_0x1685c0){var _0xcfe2c6=typeof _0x4725fd['offset']===_0xebab('0x18')&&typeof _0x4725fd[_0xebab('0x19')]===_0xebab('0x18');var _0x45eff7=_0x1685c0[_0xebab('0x1a')];var _0x55be30=_0xcfe2c6?0x0:_0x4725fd[_0xebab('0x1b')];var _0x9e684a=_0xcfe2c6?_0x1685c0[_0xebab('0x1a')]:_0x4725fd[_0xebab('0x1b')]+_0x4725fd[_0xebab('0x19')];var _0x88ad5d;if(_0x9e684a>=_0x45eff7){_0x9e684a=_0x45eff7;_0x88ad5d=0xc8;}else{_0x88ad5d=0xce;}_0x43455e[_0xebab('0x16')](_0x88ad5d);return _0x43455e['set']('Content-Range',_0x55be30+'-'+_0x9e684a+'/'+_0x45eff7)[_0xebab('0x17')](_0x1685c0);}return null;};}function patchUpdates(_0x17b598){return function(_0x47b5e1){try{jsonpatch[_0xebab('0x1c')](_0x47b5e1,_0x17b598,!![]);}catch(_0x3aed40){return BPromise[_0xebab('0x1d')](_0x3aed40);}return _0x47b5e1[_0xebab('0x1e')]();};}function saveUpdates(_0x55f4bc,_0x35bdf6){return function(_0x5c8e43){if(_0x5c8e43){return _0x5c8e43['update'](_0x55f4bc)[_0xebab('0x1f')](function(_0x570a9d){return _0x570a9d;});}return null;};}function removeEntity(_0x5c24fa,_0x1c0c5c){return function(_0x1e746e){if(_0x1e746e){return _0x1e746e[_0xebab('0x20')]()[_0xebab('0x1f')](function(){_0x5c24fa[_0xebab('0x16')](0xcc)[_0xebab('0x15')]();});}};}function handleEntityNotFound(_0x433df3,_0x1da6b3){return function(_0x375376){if(!_0x375376){_0x433df3[_0xebab('0x14')](0x194);}return _0x375376;};}function handleError(_0xf81c17,_0x5b7673){_0x5b7673=_0x5b7673||0x1f4;return function(_0x42ea40){logger[_0xebab('0x21')](_0x42ea40[_0xebab('0x22')]);if(_0x42ea40[_0xebab('0x23')]){delete _0x42ea40[_0xebab('0x23')];}_0xf81c17[_0xebab('0x16')](_0x5b7673)['send'](_0x42ea40);};}exports['index']=function(_0x31b049,_0x6addb2){var _0x304695={},_0x43287a={},_0x3e660c={'count':0x0,'rows':[]};var _0x36b827=_['map'](db[_0xebab('0x24')][_0xebab('0x25')],function(_0x4d74fe){return{'name':_0x4d74fe[_0xebab('0x26')],'type':_0x4d74fe['type'][_0xebab('0x27')]};});_0x43287a[_0xebab('0x28')]=_[_0xebab('0x29')](_0x36b827,_0xebab('0x23'));_0x43287a[_0xebab('0x2a')]=_[_0xebab('0x2b')](_0x31b049['query']);_0x43287a[_0xebab('0x2c')]=_[_0xebab('0x2d')](_0x43287a[_0xebab('0x28')],_0x43287a[_0xebab('0x2a')]);_0x304695[_0xebab('0x2e')]=_[_0xebab('0x2d')](_0x43287a[_0xebab('0x28')],qs['fields'](_0x31b049[_0xebab('0x2a')][_0xebab('0x2f')]));_0x304695[_0xebab('0x2e')]=_0x304695['attributes'][_0xebab('0x30')]?_0x304695[_0xebab('0x2e')]:_0x43287a[_0xebab('0x28')];if(!_0x31b049[_0xebab('0x2a')]['hasOwnProperty']('nolimit')){_0x304695[_0xebab('0x19')]=qs[_0xebab('0x19')](_0x31b049['query'][_0xebab('0x19')]);_0x304695[_0xebab('0x1b')]=qs[_0xebab('0x1b')](_0x31b049[_0xebab('0x2a')][_0xebab('0x1b')]);}_0x304695[_0xebab('0x31')]=qs['sort'](_0x31b049[_0xebab('0x2a')]['sort']);_0x304695[_0xebab('0x32')]=qs[_0xebab('0x2c')](_[_0xebab('0x33')](_0x31b049[_0xebab('0x2a')],_0x43287a[_0xebab('0x2c')]),_0x36b827);if(_0x31b049[_0xebab('0x2a')][_0xebab('0x34')]){_0x304695['where']=_[_0xebab('0x35')](_0x304695[_0xebab('0x32')],{'$or':_[_0xebab('0x29')](_0x36b827,function(_0x3e5805){if(_0x3e5805[_0xebab('0x36')]!==_0xebab('0x37')){var _0x37fab9={};_0x37fab9[_0x3e5805[_0xebab('0x23')]]={'$like':'%'+_0x31b049[_0xebab('0x2a')][_0xebab('0x34')]+'%'};return _0x37fab9;}})});}_0x304695=_['merge']({},_0x304695,_0x31b049[_0xebab('0x38')]);var _0x29a1d2={'where':_0x304695[_0xebab('0x32')]};return db[_0xebab('0x24')][_0xebab('0x1a')](_0x29a1d2)[_0xebab('0x1f')](function(_0x248a17){_0x3e660c[_0xebab('0x1a')]=_0x248a17;if(_0x31b049['query'][_0xebab('0x39')]){_0x304695[_0xebab('0x3a')]=[{'all':!![]}];}return db[_0xebab('0x24')][_0xebab('0x3b')](_0x304695);})['then'](function(_0x4fbc8c){_0x3e660c[_0xebab('0x3c')]=_0x4fbc8c;return _0x3e660c;})['then'](respondWithFilteredResult(_0x6addb2,_0x304695))[_0xebab('0x3d')](handleError(_0x6addb2,null));};exports[_0xebab('0x3e')]=function(_0xad0fd4,_0x8690f6){var _0xc78304={'raw':!![],'where':{'id':_0xad0fd4[_0xebab('0x3f')]['id']}},_0x75ce3f={};_0x75ce3f[_0xebab('0x28')]=_[_0xebab('0x2b')](db[_0xebab('0x24')][_0xebab('0x25')]);_0x75ce3f[_0xebab('0x2a')]=_[_0xebab('0x2b')](_0xad0fd4[_0xebab('0x2a')]);_0x75ce3f['filters']=_['intersection'](_0x75ce3f[_0xebab('0x28')],_0x75ce3f[_0xebab('0x2a')]);_0xc78304[_0xebab('0x2e')]=_[_0xebab('0x2d')](_0x75ce3f['model'],qs[_0xebab('0x2f')](_0xad0fd4[_0xebab('0x2a')][_0xebab('0x2f')]));_0xc78304[_0xebab('0x2e')]=_0xc78304[_0xebab('0x2e')][_0xebab('0x30')]?_0xc78304['attributes']:_0x75ce3f[_0xebab('0x28')];if(_0xad0fd4['query']['includeAll']){_0xc78304[_0xebab('0x3a')]=[{'all':!![]}];}_0xc78304=_['merge']({},_0xc78304,_0xad0fd4['options']);return db[_0xebab('0x24')]['find'](_0xc78304)[_0xebab('0x1f')](handleEntityNotFound(_0x8690f6,null))['then'](respondWithResult(_0x8690f6,null))[_0xebab('0x3d')](handleError(_0x8690f6,null));};exports[_0xebab('0x40')]=function(_0x7da680,_0x5b8030){return db[_0xebab('0x24')]['create'](_0x7da680[_0xebab('0x41')],{})[_0xebab('0x1f')](respondWithResult(_0x5b8030,0xc9))[_0xebab('0x3d')](handleError(_0x5b8030,null));};exports[_0xebab('0x42')]=function(_0x5aa274,_0x54ec13){if(_0x5aa274[_0xebab('0x41')]['id']){delete _0x5aa274['body']['id'];}return db['ZohoField'][_0xebab('0x43')]({'where':{'id':_0x5aa274['params']['id']}})[_0xebab('0x1f')](handleEntityNotFound(_0x54ec13,null))[_0xebab('0x1f')](saveUpdates(_0x5aa274[_0xebab('0x41')],null))[_0xebab('0x1f')](respondWithResult(_0x54ec13,null))[_0xebab('0x3d')](handleError(_0x54ec13,null));};exports['destroy']=function(_0x1f32a3,_0x53b88f){return db[_0xebab('0x24')][_0xebab('0x43')]({'where':{'id':_0x1f32a3[_0xebab('0x3f')]['id']}})['then'](handleEntityNotFound(_0x53b88f,null))[_0xebab('0x1f')](removeEntity(_0x53b88f,null))[_0xebab('0x3d')](handleError(_0x53b88f,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 6b2a027..615dbfd 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 _0x5464=['util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./intZohoField.attributes','exports','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash'];(function(_0x1836fc,_0x4a6718){var _0x18a712=function(_0x349558){while(--_0x349558){_0x1836fc['push'](_0x1836fc['shift']());}};_0x18a712(++_0x4a6718);}(_0x5464,0x15d));var _0x4546=function(_0x28126b,_0x5b29c5){_0x28126b=_0x28126b-0x0;var _0x1351fe=_0x5464[_0x28126b];return _0x1351fe;};'use strict';var _=require(_0x4546('0x0'));var util=require(_0x4546('0x1'));var logger=require(_0x4546('0x2'))('api');var moment=require(_0x4546('0x3'));var BPromise=require('bluebird');var rp=require(_0x4546('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4546('0x5'));var config=require(_0x4546('0x6'));var attributes=require(_0x4546('0x7'));module[_0x4546('0x8')]=function(_0x54228a,_0x57391f){return _0x54228a['define'](_0x4546('0x9'),attributes,{'tableName':_0x4546('0xa'),'paranoid':![],'indexes':[{'name':_0x4546('0xb'),'fields':[_0x4546('0xc'),_0x4546('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1883=['FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','idField'];(function(_0x43c478,_0xc7e72a){var _0x5f4e0e=function(_0x371d67){while(--_0x371d67){_0x43c478['push'](_0x43c478['shift']());}};_0x5f4e0e(++_0xc7e72a);}(_0x1883,0xab));var _0x3188=function(_0x14f071,_0x3291be){_0x14f071=_0x14f071-0x0;var _0x1007d0=_0x1883[_0x14f071];return _0x1007d0;};'use strict';var _=require(_0x3188('0x0'));var util=require(_0x3188('0x1'));var logger=require(_0x3188('0x2'))(_0x3188('0x3'));var moment=require(_0x3188('0x4'));var BPromise=require(_0x3188('0x5'));var rp=require(_0x3188('0x6'));var fs=require('fs');var path=require(_0x3188('0x7'));var rimraf=require(_0x3188('0x8'));var config=require(_0x3188('0x9'));var attributes=require(_0x3188('0xa'));module[_0x3188('0xb')]=function(_0x408ae0,_0x33b62d){return _0x408ae0[_0x3188('0xc')](_0x3188('0xd'),attributes,{'tableName':_0x3188('0xe'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':[_0x3188('0xf'),_0x3188('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index 9212d56..ab52964 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 _0x3e34=['ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','ZohoField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3e34,0x15e));var _0x43e3=function(_0x3a919f,_0x29a593){_0x3a919f=_0x3a919f-0x0;var _0xc4e8f1=_0x3e34[_0x3a919f];return _0xc4e8f1;};'use strict';var _=require(_0x43e3('0x0'));var util=require(_0x43e3('0x1'));var moment=require(_0x43e3('0x2'));var BPromise=require(_0x43e3('0x3'));var rs=require(_0x43e3('0x4'));var fs=require('fs');var Redis=require(_0x43e3('0x5'));var db=require(_0x43e3('0x6'))['db'];var utils=require(_0x43e3('0x7'));var logger=require(_0x43e3('0x8'))(_0x43e3('0x9'));var config=require(_0x43e3('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x43e3('0xb')][_0x43e3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4e04ad,_0x3cd843,_0x5dff0e){return new BPromise(function(_0x2a60e8,_0x38f7ec){return client[_0x43e3('0xd')](_0x4e04ad,_0x5dff0e)[_0x43e3('0xe')](function(_0x62fb96){logger['info'](_0x43e3('0xf'),_0x3cd843,_0x43e3('0x10'));logger[_0x43e3('0x11')](_0x43e3('0x12'),_0x3cd843,_0x43e3('0x10'),JSON[_0x43e3('0x13')](_0x62fb96));if(_0x62fb96[_0x43e3('0x14')]){if(_0x62fb96[_0x43e3('0x14')]['code']===0x1f4){logger[_0x43e3('0x14')](_0x43e3('0xf'),_0x3cd843,_0x62fb96[_0x43e3('0x14')][_0x43e3('0x15')]);return _0x38f7ec(_0x62fb96[_0x43e3('0x14')][_0x43e3('0x15')]);}logger['error']('ZohoField,\x20%s,\x20%s',_0x3cd843,_0x62fb96[_0x43e3('0x14')][_0x43e3('0x15')]);return _0x2a60e8(_0x62fb96[_0x43e3('0x14')][_0x43e3('0x15')]);}else{logger['info'](_0x43e3('0xf'),_0x3cd843,_0x43e3('0x10'));_0x2a60e8(_0x62fb96[_0x43e3('0x16')][_0x43e3('0x15')]);}})['catch'](function(_0x20e742){logger[_0x43e3('0x14')](_0x43e3('0xf'),_0x3cd843,_0x20e742);_0x38f7ec(_0x20e742);});});} \ No newline at end of file +var _0x925c=['catch','lodash','randomstring','../../config/logger','../../config/environment','jayson/promise','http','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','error','code','message','ZohoField,\x20%s,\x20%s','info'];(function(_0x25d165,_0x275405){var _0x250715=function(_0x4b93e9){while(--_0x4b93e9){_0x25d165['push'](_0x25d165['shift']());}};_0x250715(++_0x275405);}(_0x925c,0x1c3));var _0xc925=function(_0xe76690,_0x1b861b){_0xe76690=_0xe76690-0x0;var _0x10314a=_0x925c[_0xe76690];return _0x10314a;};'use strict';var _=require(_0xc925('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc925('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc925('0x2'))('rpc');var config=require(_0xc925('0x3'));var jayson=require(_0xc925('0x4'));var client=jayson['client'][_0xc925('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x430af,_0x30cac7,_0x5af77c){return new BPromise(function(_0x3e589d,_0x56dd9b){return client['request'](_0x430af,_0x5af77c)['then'](function(_0x253592){logger['info']('ZohoField,\x20%s,\x20%s',_0x30cac7,_0xc925('0x6'));logger[_0xc925('0x7')](_0xc925('0x8'),_0x30cac7,'request\x20sent',JSON['stringify'](_0x253592));if(_0x253592[_0xc925('0x9')]){if(_0x253592[_0xc925('0x9')][_0xc925('0xa')]===0x1f4){logger['error']('ZohoField,\x20%s,\x20%s',_0x30cac7,_0x253592[_0xc925('0x9')]['message']);return _0x56dd9b(_0x253592[_0xc925('0x9')][_0xc925('0xb')]);}logger[_0xc925('0x9')](_0xc925('0xc'),_0x30cac7,_0x253592[_0xc925('0x9')][_0xc925('0xb')]);return _0x3e589d(_0x253592[_0xc925('0x9')][_0xc925('0xb')]);}else{logger[_0xc925('0xd')](_0xc925('0xc'),_0x30cac7,_0xc925('0x6'));_0x3e589d(_0x253592['result']['message']);}})[_0xc925('0xe')](function(_0x2f5a47){logger[_0xc925('0x9')](_0xc925('0xc'),_0x30cac7,_0x2f5a47);_0x56dd9b(_0x2f5a47);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index fb1b0dc..1b43416 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x2f524c,_0xd1a0d){var _0x4fb8b2=function(_0x50418f){while(--_0x50418f){_0x2f524c['push'](_0x2f524c['shift']());}};_0x4fb8b2(++_0xd1a0d);}(_0xedd9,0xfc));var _0x9edd=function(_0x4d4026,_0x1aff18){_0x4d4026=_0x4d4026-0x0;var _0x32896a=_0xedd9[_0x4d4026];return _0x32896a;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x2bcf8c,_0x174465){var _0x46aa85=function(_0x5f06dc){while(--_0x5f06dc){_0x2bcf8c['push'](_0x2bcf8c['shift']());}};_0x46aa85(++_0x174465);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index a275527..121341e 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 _0xd91a=['sequelize','exports','unique_name_and_version','STRING','app.js','INTEGER','BOOLEAN','state'];(function(_0x30f69d,_0xc75fdb){var _0x2bc4d4=function(_0x2034b6){while(--_0x2034b6){_0x30f69d['push'](_0x30f69d['shift']());}};_0x2bc4d4(++_0xc75fdb);}(_0xd91a,0x1d0));var _0xad91=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd91a[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xad91('0x0'));module[_0xad91('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xad91('0x2')},'version':{'type':Sequelize[_0xad91('0x3')],'allowNull':![],'unique':_0xad91('0x2')},'main':{'type':Sequelize[_0xad91('0x3')],'defaultValue':_0xad91('0x4')},'filename':{'type':Sequelize[_0xad91('0x3')]},'path':{'type':Sequelize[_0xad91('0x3')]},'type':{'type':Sequelize[_0xad91('0x3')]},'size':{'type':Sequelize[_0xad91('0x5')]},'active':{'type':Sequelize[_0xad91('0x6')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize['STRING'],'unique':_0xad91('0x7')},'description':{'type':Sequelize[_0xad91('0x3')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file +var _0x59a6=['INTEGER','BOOLEAN','state','sequelize','exports','STRING','unique_name_and_version'];(function(_0x598847,_0x58e68d){var _0x853d8d=function(_0x3d0a24){while(--_0x3d0a24){_0x598847['push'](_0x598847['shift']());}};_0x853d8d(++_0x58e68d);}(_0x59a6,0x1b5));var _0x659a=function(_0x14c9e1,_0x26ee64){_0x14c9e1=_0x14c9e1-0x0;var _0x2b1cad=_0x59a6[_0x14c9e1];return _0x2b1cad;};'use strict';var Sequelize=require(_0x659a('0x0'));module[_0x659a('0x1')]={'name':{'type':Sequelize[_0x659a('0x2')],'allowNull':![],'unique':_0x659a('0x3')},'version':{'type':Sequelize[_0x659a('0x2')],'allowNull':![],'unique':_0x659a('0x3')},'main':{'type':Sequelize[_0x659a('0x2')],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0x659a('0x2')]},'path':{'type':Sequelize[_0x659a('0x2')]},'type':{'type':Sequelize[_0x659a('0x2')]},'size':{'type':Sequelize[_0x659a('0x4')]},'active':{'type':Sequelize[_0x659a('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0x659a('0x2')]},'logo':{'type':Sequelize[_0x659a('0x2')]},'state':{'type':Sequelize[_0x659a('0x2')],'unique':_0x659a('0x6')},'description':{'type':Sequelize[_0x659a('0x2')]},'title':{'type':Sequelize[_0x659a('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0x659a('0x2')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index dc1d154..cf46960 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 _0x33af=['merge','VIRTUAL','filter','includeAll','findAll','rows','catch','show','params','length','include','create','body','find','rimraf','fast-json-patch','request-promise','moment','bluebird','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','Integration','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','order','sort','where'];(function(_0x14b75e,_0x44e219){var _0x3f49cd=function(_0x59bf1b){while(--_0x59bf1b){_0x14b75e['push'](_0x14b75e['shift']());}};_0x3f49cd(++_0x44e219);}(_0x33af,0xec));var _0xf33a=function(_0x21fbb1,_0x120f56){_0x21fbb1=_0x21fbb1-0x0;var _0x2f7b69=_0x33af[_0x21fbb1];return _0x2f7b69;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf33a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf33a('0x1'));var rp=require(_0xf33a('0x2'));var moment=require(_0xf33a('0x3'));var BPromise=require(_0xf33a('0x4'));var Mustache=require(_0xf33a('0x5'));var util=require(_0xf33a('0x6'));var path=require('path');var sox=require(_0xf33a('0x7'));var csv=require(_0xf33a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf33a('0x9'));var _=require(_0xf33a('0xa'));var squel=require(_0xf33a('0xb'));var crypto=require(_0xf33a('0xc'));var jsforce=require(_0xf33a('0xd'));var deskjs=require(_0xf33a('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf33a('0xf'));var Papa=require(_0xf33a('0x10'));var Redis=require(_0xf33a('0x11'));var authService=require(_0xf33a('0x12'));var qs=require(_0xf33a('0x13'));var as=require(_0xf33a('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf33a('0x15'));var utils=require(_0xf33a('0x16'));var config=require(_0xf33a('0x17'));var licenseUtil=require(_0xf33a('0x18'));var db=require(_0xf33a('0x19'))['db'];function respondWithStatusCode(_0x5959c9,_0x9f87bc){_0x9f87bc=_0x9f87bc||0xcc;return function(_0x21b80e){if(_0x21b80e){return _0x5959c9['sendStatus'](_0x9f87bc);}return _0x5959c9['status'](_0x9f87bc)[_0xf33a('0x1a')]();};}function respondWithResult(_0x1b3bf0,_0x17043){_0x17043=_0x17043||0xc8;return function(_0x153bda){if(_0x153bda){return _0x1b3bf0[_0xf33a('0x1b')](_0x17043)[_0xf33a('0x1c')](_0x153bda);}};}function respondWithFilteredResult(_0x45e311,_0x1f2b1b){return function(_0x507cb9){if(_0x507cb9){var _0x441f59=typeof _0x1f2b1b['offset']===_0xf33a('0x1d')&&typeof _0x1f2b1b[_0xf33a('0x1e')]==='undefined';var _0x37e76c=_0x507cb9[_0xf33a('0x1f')];var _0x524109=_0x441f59?0x0:_0x1f2b1b[_0xf33a('0x20')];var _0x23d9e2=_0x441f59?_0x507cb9[_0xf33a('0x1f')]:_0x1f2b1b[_0xf33a('0x20')]+_0x1f2b1b['limit'];var _0x11efa0;if(_0x23d9e2>=_0x37e76c){_0x23d9e2=_0x37e76c;_0x11efa0=0xc8;}else{_0x11efa0=0xce;}_0x45e311[_0xf33a('0x1b')](_0x11efa0);return _0x45e311[_0xf33a('0x21')](_0xf33a('0x22'),_0x524109+'-'+_0x23d9e2+'/'+_0x37e76c)[_0xf33a('0x1c')](_0x507cb9);}return null;};}function patchUpdates(_0x6cdf7b){return function(_0x19986f){try{jsonpatch[_0xf33a('0x23')](_0x19986f,_0x6cdf7b,!![]);}catch(_0x19055e){return BPromise[_0xf33a('0x24')](_0x19055e);}return _0x19986f['save']();};}function saveUpdates(_0x3854b4,_0x272e60){return function(_0x1bf9bc){if(_0x1bf9bc){return _0x1bf9bc[_0xf33a('0x25')](_0x3854b4)[_0xf33a('0x26')](function(_0x51d3fd){return _0x51d3fd;});}return null;};}function removeEntity(_0x44654c,_0x5882ba){return function(_0x492986){if(_0x492986){return _0x492986[_0xf33a('0x27')]()[_0xf33a('0x26')](function(){_0x44654c[_0xf33a('0x1b')](0xcc)[_0xf33a('0x1a')]();});}};}function handleEntityNotFound(_0x4b9801,_0x57cb1d){return function(_0x393005){if(!_0x393005){_0x4b9801['sendStatus'](0x194);}return _0x393005;};}function handleError(_0x4af24a,_0x16ef31){_0x16ef31=_0x16ef31||0x1f4;return function(_0x5f0a53){logger['error'](_0x5f0a53[_0xf33a('0x28')]);if(_0x5f0a53['name']){delete _0x5f0a53[_0xf33a('0x29')];}_0x4af24a['status'](_0x16ef31)[_0xf33a('0x2a')](_0x5f0a53);};}exports[_0xf33a('0x2b')]=function(_0x469741,_0x729fca){var _0x4552c9={},_0x3068a9={},_0x1d19ee={'count':0x0,'rows':[]};var _0x1246ff=_[_0xf33a('0x2c')](db[_0xf33a('0x2d')][_0xf33a('0x2e')],function(_0x8f8ddc){return{'name':_0x8f8ddc[_0xf33a('0x2f')],'type':_0x8f8ddc[_0xf33a('0x30')][_0xf33a('0x31')]};});_0x3068a9['model']=_[_0xf33a('0x2c')](_0x1246ff,_0xf33a('0x29'));_0x3068a9[_0xf33a('0x32')]=_[_0xf33a('0x33')](_0x469741['query']);_0x3068a9[_0xf33a('0x34')]=_[_0xf33a('0x35')](_0x3068a9[_0xf33a('0x36')],_0x3068a9[_0xf33a('0x32')]);_0x4552c9[_0xf33a('0x37')]=_[_0xf33a('0x35')](_0x3068a9['model'],qs[_0xf33a('0x38')](_0x469741[_0xf33a('0x32')][_0xf33a('0x38')]));_0x4552c9[_0xf33a('0x37')]=_0x4552c9[_0xf33a('0x37')]['length']?_0x4552c9['attributes']:_0x3068a9[_0xf33a('0x36')];if(!_0x469741['query']['hasOwnProperty']('nolimit')){_0x4552c9[_0xf33a('0x1e')]=qs[_0xf33a('0x1e')](_0x469741['query'][_0xf33a('0x1e')]);_0x4552c9['offset']=qs[_0xf33a('0x20')](_0x469741[_0xf33a('0x32')][_0xf33a('0x20')]);}_0x4552c9[_0xf33a('0x39')]=qs[_0xf33a('0x3a')](_0x469741[_0xf33a('0x32')]['sort']);_0x4552c9[_0xf33a('0x3b')]=qs[_0xf33a('0x34')](_['pick'](_0x469741[_0xf33a('0x32')],_0x3068a9[_0xf33a('0x34')]),_0x1246ff);if(_0x469741[_0xf33a('0x32')]['filter']){_0x4552c9[_0xf33a('0x3b')]=_[_0xf33a('0x3c')](_0x4552c9[_0xf33a('0x3b')],{'$or':_[_0xf33a('0x2c')](_0x1246ff,function(_0x3ec562){if(_0x3ec562[_0xf33a('0x30')]!==_0xf33a('0x3d')){var _0x128baf={};_0x128baf[_0x3ec562[_0xf33a('0x29')]]={'$like':'%'+_0x469741['query'][_0xf33a('0x3e')]+'%'};return _0x128baf;}})});}_0x4552c9=_[_0xf33a('0x3c')]({},_0x4552c9,_0x469741['options']);var _0x1e8800={'where':_0x4552c9['where']};return db['Integration'][_0xf33a('0x1f')](_0x1e8800)[_0xf33a('0x26')](function(_0x4dada1){_0x1d19ee[_0xf33a('0x1f')]=_0x4dada1;if(_0x469741[_0xf33a('0x32')][_0xf33a('0x3f')]){_0x4552c9['include']=[{'all':!![]}];}return db[_0xf33a('0x2d')][_0xf33a('0x40')](_0x4552c9);})['then'](function(_0x1e9748){_0x1d19ee[_0xf33a('0x41')]=_0x1e9748;return _0x1d19ee;})[_0xf33a('0x26')](respondWithFilteredResult(_0x729fca,_0x4552c9))[_0xf33a('0x42')](handleError(_0x729fca,null));};exports[_0xf33a('0x43')]=function(_0x5044f9,_0x45ae15){var _0x1722e5={'raw':![],'where':{'id':_0x5044f9[_0xf33a('0x44')]['id']}},_0x2325eb={};_0x2325eb[_0xf33a('0x36')]=_['keys'](db[_0xf33a('0x2d')][_0xf33a('0x2e')]);_0x2325eb[_0xf33a('0x32')]=_['keys'](_0x5044f9[_0xf33a('0x32')]);_0x2325eb[_0xf33a('0x34')]=_[_0xf33a('0x35')](_0x2325eb[_0xf33a('0x36')],_0x2325eb[_0xf33a('0x32')]);_0x1722e5[_0xf33a('0x37')]=_['intersection'](_0x2325eb[_0xf33a('0x36')],qs[_0xf33a('0x38')](_0x5044f9[_0xf33a('0x32')][_0xf33a('0x38')]));_0x1722e5[_0xf33a('0x37')]=_0x1722e5['attributes'][_0xf33a('0x45')]?_0x1722e5[_0xf33a('0x37')]:_0x2325eb[_0xf33a('0x36')];if(_0x5044f9['query'][_0xf33a('0x3f')]){_0x1722e5[_0xf33a('0x46')]=[{'all':!![]}];}_0x1722e5=_['merge']({},_0x1722e5,_0x5044f9['options']);return db[_0xf33a('0x2d')]['find'](_0x1722e5)[_0xf33a('0x26')](handleEntityNotFound(_0x45ae15,null))[_0xf33a('0x26')](respondWithResult(_0x45ae15,null))[_0xf33a('0x42')](handleError(_0x45ae15,null));};exports[_0xf33a('0x47')]=function(_0xecc82f,_0x1a98f9){return db[_0xf33a('0x2d')][_0xf33a('0x47')](_0xecc82f[_0xf33a('0x48')],{})[_0xf33a('0x26')](respondWithResult(_0x1a98f9,0xc9))[_0xf33a('0x42')](handleError(_0x1a98f9,null));};exports[_0xf33a('0x25')]=function(_0x190a2b,_0x6b79da){if(_0x190a2b[_0xf33a('0x48')]['id']){delete _0x190a2b[_0xf33a('0x48')]['id'];}return db[_0xf33a('0x2d')][_0xf33a('0x49')]({'where':{'id':_0x190a2b[_0xf33a('0x44')]['id']}})[_0xf33a('0x26')](handleEntityNotFound(_0x6b79da,null))[_0xf33a('0x26')](saveUpdates(_0x190a2b[_0xf33a('0x48')],null))[_0xf33a('0x26')](respondWithResult(_0x6b79da,null))[_0xf33a('0x42')](handleError(_0x6b79da,null));};exports[_0xf33a('0x27')]=function(_0x1b15a1,_0x3bab07){return db[_0xf33a('0x2d')][_0xf33a('0x49')]({'where':{'id':_0x1b15a1['params']['id']}})[_0xf33a('0x26')](handleEntityNotFound(_0x3bab07,null))[_0xf33a('0x26')](removeEntity(_0x3bab07,null))['catch'](handleError(_0x3bab07,null));}; \ No newline at end of file +var _0x4991=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','type','filter','options','Integration','includeAll','include','findAll','rows','show','params','keys','find','create','body','catch','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','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','map','rawAttributes','fieldName','key','model','query','filters'];(function(_0x23e127,_0x471ff4){var _0xefabf1=function(_0x4495aa){while(--_0x4495aa){_0x23e127['push'](_0x23e127['shift']());}};_0xefabf1(++_0x471ff4);}(_0x4991,0xf7));var _0x1499=function(_0x355c36,_0xed399a){_0x355c36=_0x355c36-0x0;var _0x37a5e5=_0x4991[_0x355c36];return _0x37a5e5;};'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'];function respondWithStatusCode(_0x3039ce,_0x274bc1){_0x274bc1=_0x274bc1||0xcc;return function(_0x34a928){if(_0x34a928){return _0x3039ce[_0x1499('0x17')](_0x274bc1);}return _0x3039ce[_0x1499('0x18')](_0x274bc1)['end']();};}function respondWithResult(_0x5f34f2,_0x308177){_0x308177=_0x308177||0xc8;return function(_0x4e5195){if(_0x4e5195){return _0x5f34f2[_0x1499('0x18')](_0x308177)[_0x1499('0x19')](_0x4e5195);}};}function respondWithFilteredResult(_0x308318,_0x3ab605){return function(_0x48f654){if(_0x48f654){var _0x1ed43b=typeof _0x3ab605[_0x1499('0x1a')]==='undefined'&&typeof _0x3ab605[_0x1499('0x1b')]===_0x1499('0x1c');var _0x46b364=_0x48f654[_0x1499('0x1d')];var _0x1e45a9=_0x1ed43b?0x0:_0x3ab605[_0x1499('0x1a')];var _0x5b9859=_0x1ed43b?_0x48f654['count']:_0x3ab605['offset']+_0x3ab605[_0x1499('0x1b')];var _0xad534b;if(_0x5b9859>=_0x46b364){_0x5b9859=_0x46b364;_0xad534b=0xc8;}else{_0xad534b=0xce;}_0x308318['status'](_0xad534b);return _0x308318[_0x1499('0x1e')](_0x1499('0x1f'),_0x1e45a9+'-'+_0x5b9859+'/'+_0x46b364)[_0x1499('0x19')](_0x48f654);}return null;};}function patchUpdates(_0x18e4a6){return function(_0x21e887){try{jsonpatch[_0x1499('0x20')](_0x21e887,_0x18e4a6,!![]);}catch(_0x2b0458){return BPromise[_0x1499('0x21')](_0x2b0458);}return _0x21e887[_0x1499('0x22')]();};}function saveUpdates(_0x15bcd4,_0x2bb71f){return function(_0x836081){if(_0x836081){return _0x836081[_0x1499('0x23')](_0x15bcd4)[_0x1499('0x24')](function(_0x4ec57a){return _0x4ec57a;});}return null;};}function removeEntity(_0x1e2c51,_0x2c7f57){return function(_0x5615b4){if(_0x5615b4){return _0x5615b4[_0x1499('0x25')]()[_0x1499('0x24')](function(){_0x1e2c51[_0x1499('0x18')](0xcc)[_0x1499('0x26')]();});}};}function handleEntityNotFound(_0x3968e0,_0x16d036){return function(_0x54f3c2){if(!_0x54f3c2){_0x3968e0['sendStatus'](0x194);}return _0x54f3c2;};}function handleError(_0x12739b,_0x3c9aca){_0x3c9aca=_0x3c9aca||0x1f4;return function(_0x3b9259){logger[_0x1499('0x27')](_0x3b9259[_0x1499('0x28')]);if(_0x3b9259['name']){delete _0x3b9259[_0x1499('0x29')];}_0x12739b['status'](_0x3c9aca)['send'](_0x3b9259);};}exports['index']=function(_0x21d204,_0x103efa){var _0x40932a={},_0x1b460b={},_0x3dad86={'count':0x0,'rows':[]};var _0x388513=_[_0x1499('0x2a')](db['Integration'][_0x1499('0x2b')],function(_0x1a2c99){return{'name':_0x1a2c99[_0x1499('0x2c')],'type':_0x1a2c99['type'][_0x1499('0x2d')]};});_0x1b460b[_0x1499('0x2e')]=_['map'](_0x388513,_0x1499('0x29'));_0x1b460b[_0x1499('0x2f')]=_['keys'](_0x21d204[_0x1499('0x2f')]);_0x1b460b[_0x1499('0x30')]=_[_0x1499('0x31')](_0x1b460b[_0x1499('0x2e')],_0x1b460b[_0x1499('0x2f')]);_0x40932a[_0x1499('0x32')]=_[_0x1499('0x31')](_0x1b460b[_0x1499('0x2e')],qs[_0x1499('0x33')](_0x21d204[_0x1499('0x2f')][_0x1499('0x33')]));_0x40932a[_0x1499('0x32')]=_0x40932a[_0x1499('0x32')][_0x1499('0x34')]?_0x40932a[_0x1499('0x32')]:_0x1b460b[_0x1499('0x2e')];if(!_0x21d204[_0x1499('0x2f')][_0x1499('0x35')](_0x1499('0x36'))){_0x40932a[_0x1499('0x1b')]=qs['limit'](_0x21d204[_0x1499('0x2f')][_0x1499('0x1b')]);_0x40932a[_0x1499('0x1a')]=qs[_0x1499('0x1a')](_0x21d204[_0x1499('0x2f')][_0x1499('0x1a')]);}_0x40932a[_0x1499('0x37')]=qs[_0x1499('0x38')](_0x21d204[_0x1499('0x2f')][_0x1499('0x38')]);_0x40932a[_0x1499('0x39')]=qs['filters'](_['pick'](_0x21d204[_0x1499('0x2f')],_0x1b460b['filters']),_0x388513);if(_0x21d204[_0x1499('0x2f')]['filter']){_0x40932a[_0x1499('0x39')]=_[_0x1499('0x3a')](_0x40932a[_0x1499('0x39')],{'$or':_[_0x1499('0x2a')](_0x388513,function(_0x531933){if(_0x531933[_0x1499('0x3b')]!=='VIRTUAL'){var _0x2f9c59={};_0x2f9c59[_0x531933[_0x1499('0x29')]]={'$like':'%'+_0x21d204[_0x1499('0x2f')][_0x1499('0x3c')]+'%'};return _0x2f9c59;}})});}_0x40932a=_['merge']({},_0x40932a,_0x21d204[_0x1499('0x3d')]);var _0x815a99={'where':_0x40932a[_0x1499('0x39')]};return db[_0x1499('0x3e')]['count'](_0x815a99)[_0x1499('0x24')](function(_0x4cc411){_0x3dad86[_0x1499('0x1d')]=_0x4cc411;if(_0x21d204[_0x1499('0x2f')][_0x1499('0x3f')]){_0x40932a[_0x1499('0x40')]=[{'all':!![]}];}return db[_0x1499('0x3e')][_0x1499('0x41')](_0x40932a);})[_0x1499('0x24')](function(_0xcb85eb){_0x3dad86[_0x1499('0x42')]=_0xcb85eb;return _0x3dad86;})[_0x1499('0x24')](respondWithFilteredResult(_0x103efa,_0x40932a))['catch'](handleError(_0x103efa,null));};exports[_0x1499('0x43')]=function(_0x5dd36c,_0x2cfdaf){var _0x1af1a1={'raw':![],'where':{'id':_0x5dd36c[_0x1499('0x44')]['id']}},_0x5646cf={};_0x5646cf[_0x1499('0x2e')]=_[_0x1499('0x45')](db[_0x1499('0x3e')][_0x1499('0x2b')]);_0x5646cf['query']=_['keys'](_0x5dd36c[_0x1499('0x2f')]);_0x5646cf[_0x1499('0x30')]=_['intersection'](_0x5646cf[_0x1499('0x2e')],_0x5646cf[_0x1499('0x2f')]);_0x1af1a1['attributes']=_['intersection'](_0x5646cf[_0x1499('0x2e')],qs[_0x1499('0x33')](_0x5dd36c[_0x1499('0x2f')]['fields']));_0x1af1a1[_0x1499('0x32')]=_0x1af1a1[_0x1499('0x32')][_0x1499('0x34')]?_0x1af1a1[_0x1499('0x32')]:_0x5646cf['model'];if(_0x5dd36c[_0x1499('0x2f')][_0x1499('0x3f')]){_0x1af1a1[_0x1499('0x40')]=[{'all':!![]}];}_0x1af1a1=_[_0x1499('0x3a')]({},_0x1af1a1,_0x5dd36c['options']);return db[_0x1499('0x3e')][_0x1499('0x46')](_0x1af1a1)[_0x1499('0x24')](handleEntityNotFound(_0x2cfdaf,null))['then'](respondWithResult(_0x2cfdaf,null))['catch'](handleError(_0x2cfdaf,null));};exports[_0x1499('0x47')]=function(_0x491777,_0x7fa101){return db[_0x1499('0x3e')][_0x1499('0x47')](_0x491777[_0x1499('0x48')],{})[_0x1499('0x24')](respondWithResult(_0x7fa101,0xc9))[_0x1499('0x49')](handleError(_0x7fa101,null));};exports[_0x1499('0x23')]=function(_0x591aa8,_0x420d16){if(_0x591aa8['body']['id']){delete _0x591aa8[_0x1499('0x48')]['id'];}return db[_0x1499('0x3e')]['find']({'where':{'id':_0x591aa8[_0x1499('0x44')]['id']}})[_0x1499('0x24')](handleEntityNotFound(_0x420d16,null))[_0x1499('0x24')](saveUpdates(_0x591aa8['body'],null))[_0x1499('0x24')](respondWithResult(_0x420d16,null))[_0x1499('0x49')](handleError(_0x420d16,null));};exports[_0x1499('0x25')]=function(_0x29ac0f,_0x305599){return db[_0x1499('0x3e')][_0x1499('0x46')]({'where':{'id':_0x29ac0f[_0x1499('0x44')]['id']}})[_0x1499('0x24')](handleEntityNotFound(_0x305599,null))[_0x1499('0x24')](removeEntity(_0x305599,null))['catch'](handleError(_0x305599,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 1181b53..67ab2c7 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 _0x37aa=['../../config/environment','define','Integration','integrations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x194f46,_0x37088d){var _0xfca9de=function(_0x6247d8){while(--_0x6247d8){_0x194f46['push'](_0x194f46['shift']());}};_0xfca9de(++_0x37088d);}(_0x37aa,0x184));var _0xa37a=function(_0x397f37,_0x3cf86d){_0x397f37=_0x397f37-0x0;var _0x31cae6=_0x37aa[_0x397f37];return _0x31cae6;};'use strict';var _=require(_0xa37a('0x0'));var util=require(_0xa37a('0x1'));var logger=require(_0xa37a('0x2'))(_0xa37a('0x3'));var moment=require(_0xa37a('0x4'));var BPromise=require(_0xa37a('0x5'));var rp=require(_0xa37a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa37a('0x7'));var config=require(_0xa37a('0x8'));var attributes=require('./integration.attributes');module['exports']=function(_0x2709fb,_0x50d99c){return _0x2709fb[_0xa37a('0x9')](_0xa37a('0xa'),attributes,{'tableName':_0xa37a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x231e=['Integration','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./integration.attributes','exports','define'];(function(_0x365e69,_0x55bc8a){var _0x166f1d=function(_0x98d01b){while(--_0x98d01b){_0x365e69['push'](_0x365e69['shift']());}};_0x166f1d(++_0x55bc8a);}(_0x231e,0x17b));var _0xe231=function(_0x43cc69,_0x401eea){_0x43cc69=_0x43cc69-0x0;var _0xde43ae=_0x231e[_0x43cc69];return _0xde43ae;};'use strict';var _=require(_0xe231('0x0'));var util=require(_0xe231('0x1'));var logger=require(_0xe231('0x2'))(_0xe231('0x3'));var moment=require(_0xe231('0x4'));var BPromise=require(_0xe231('0x5'));var rp=require(_0xe231('0x6'));var fs=require('fs');var path=require(_0xe231('0x7'));var rimraf=require(_0xe231('0x8'));var config=require(_0xe231('0x9'));var attributes=require(_0xe231('0xa'));module[_0xe231('0xb')]=function(_0x49cac7,_0xb89821){return _0x49cac7[_0xe231('0xc')](_0xe231('0xd'),attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index d1c4ead..20681ff 100644 --- a/server/api/integration/integration.rpc.js +++ b/server/api/integration/integration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc6ac=['http','request','then','info','Integration,\x20%s,\x20%s','debug','Integration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x31cdd8,_0x36ad7d){var _0x2c9413=function(_0x53c6a1){while(--_0x53c6a1){_0x31cdd8['push'](_0x31cdd8['shift']());}};_0x2c9413(++_0x36ad7d);}(_0xc6ac,0x15b));var _0xcc6a=function(_0xd9e43,_0x5b4235){_0xd9e43=_0xd9e43-0x0;var _0x581437=_0xc6ac[_0xd9e43];return _0x581437;};'use strict';var _=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var moment=require(_0xcc6a('0x2'));var BPromise=require(_0xcc6a('0x3'));var rs=require(_0xcc6a('0x4'));var fs=require('fs');var Redis=require(_0xcc6a('0x5'));var db=require(_0xcc6a('0x6'))['db'];var utils=require(_0xcc6a('0x7'));var logger=require(_0xcc6a('0x8'))(_0xcc6a('0x9'));var config=require(_0xcc6a('0xa'));var jayson=require(_0xcc6a('0xb'));var client=jayson[_0xcc6a('0xc')][_0xcc6a('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x5f3887,_0x3dd497,_0x11b919){return new BPromise(function(_0xf02261,_0x560cc4){return client[_0xcc6a('0xe')](_0x5f3887,_0x11b919)[_0xcc6a('0xf')](function(_0x7806a0){logger[_0xcc6a('0x10')](_0xcc6a('0x11'),_0x3dd497,'request\x20sent');logger[_0xcc6a('0x12')](_0xcc6a('0x13'),_0x3dd497,_0xcc6a('0x14'),JSON['stringify'](_0x7806a0));if(_0x7806a0[_0xcc6a('0x15')]){if(_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x16')]===0x1f4){logger['error']('Integration,\x20%s,\x20%s',_0x3dd497,_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);return _0x560cc4(_0x7806a0[_0xcc6a('0x15')]['message']);}logger['error'](_0xcc6a('0x11'),_0x3dd497,_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);return _0xf02261(_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);}else{logger[_0xcc6a('0x10')](_0xcc6a('0x11'),_0x3dd497,_0xcc6a('0x14'));_0xf02261(_0x7806a0['result']['message']);}})['catch'](function(_0x395a55){logger[_0xcc6a('0x15')](_0xcc6a('0x11'),_0x3dd497,_0x395a55);_0x560cc4(_0x395a55);});});} \ No newline at end of file +var _0x7a54=['info','Integration,\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(_0x5688cc,_0x12f1bb){_0x5688cc=_0x5688cc-0x0;var _0x5c0c45=_0x7a54[_0x5688cc];return _0x5c0c45;};'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')]('Integration,\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/integrationReport/index.js b/server/api/integrationReport/index.js index 0e0f78a..d0bab54 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 _0x187d=['/:id','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./integrationReport.controller','isAuthenticated','index','get','/describe','describe'];(function(_0x21aae8,_0x37d176){var _0x138b74=function(_0x30a718){while(--_0x30a718){_0x21aae8['push'](_0x21aae8['shift']());}};_0x138b74(++_0x37d176);}(_0x187d,0x93));var _0xd187=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0x187d[_0x23e7c1];return _0x1add43;};'use strict';var multer=require(_0xd187('0x0'));var util=require('util');var path=require(_0xd187('0x1'));var timeout=require(_0xd187('0x2'));var express=require(_0xd187('0x3'));var router=express[_0xd187('0x4')]();var fs_extra=require(_0xd187('0x5'));var auth=require(_0xd187('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd187('0x7'));var controller=require(_0xd187('0x8'));router['get']('/',auth[_0xd187('0x9')](),controller[_0xd187('0xa')]);router[_0xd187('0xb')](_0xd187('0xc'),auth[_0xd187('0x9')](),controller[_0xd187('0xd')]);router[_0xd187('0xb')](_0xd187('0xe'),auth['isAuthenticated'](),controller[_0xd187('0xf')]);router[_0xd187('0x10')]('/',auth[_0xd187('0x9')](),controller[_0xd187('0x11')]);router[_0xd187('0x12')](_0xd187('0xe'),auth['isAuthenticated'](),controller[_0xd187('0x13')]);router[_0xd187('0x14')](_0xd187('0xe'),auth['isAuthenticated'](),controller[_0xd187('0x15')]);module[_0xd187('0x16')]=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(_0xdd82b4,_0x5cd8b8){var _0x549bb2=function(_0x426fd9){while(--_0x426fd9){_0xdd82b4['push'](_0xdd82b4['shift']());}};_0x549bb2(++_0x5cd8b8);}(_0xd943,0x15d));var _0x3d94=function(_0x1698c2,_0x4e643b){_0x1698c2=_0x1698c2-0x0;var _0x5b7e44=_0xd943[_0x1698c2];return _0x5b7e44;};'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 cd1328d..b72ec66 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 _0x75cb=['RECEIVED','sequelize','STRING','DATE','BOOLEAN','INTEGER','TEXT','ENUM','SENT','SENDING'];(function(_0x2c1475,_0x9aac66){var _0x43c4e0=function(_0x3d8b2d){while(--_0x3d8b2d){_0x2c1475['push'](_0x2c1475['shift']());}};_0x43c4e0(++_0x9aac66);}(_0x75cb,0xd3));var _0xb75c=function(_0x3e806a,_0xa4b9fa){_0x3e806a=_0x3e806a-0x0;var _0x477105=_0x75cb[_0x3e806a];return _0x477105;};'use strict';var Sequelize=require(_0xb75c('0x0'));module['exports']={'integration':{'type':Sequelize[_0xb75c('0x1')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0xb75c('0x1')]},'ticketId':{'type':Sequelize[_0xb75c('0x1')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xb75c('0x1')]},'queue':{'type':Sequelize[_0xb75c('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xb75c('0x1')]},'agentcalledAt':{'type':Sequelize[_0xb75c('0x2')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0xb75c('0x3')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xb75c('0x2')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xb75c('0x4')]},'reason':{'type':Sequelize[_0xb75c('0x1')]},'agentringnoanswer':{'type':Sequelize[_0xb75c('0x3')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xb75c('0x2')]},'agentdump':{'type':Sequelize[_0xb75c('0x3')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xb75c('0x2')]},'lastevent':{'type':Sequelize[_0xb75c('0x1')]},'channel':{'type':Sequelize[_0xb75c('0x1')]},'channelstate':{'type':Sequelize[_0xb75c('0x4')]},'channelstatedesc':{'type':Sequelize[_0xb75c('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xb75c('0x1')]},'language':{'type':Sequelize[_0xb75c('0x1')]},'accountcode':{'type':Sequelize[_0xb75c('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xb75c('0x1')]},'priority':{'type':Sequelize[_0xb75c('0x1')]},'destchannel':{'type':Sequelize[_0xb75c('0x1')]},'destchannelstate':{'type':Sequelize[_0xb75c('0x4')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xb75c('0x1')]},'destcalleridname':{'type':Sequelize[_0xb75c('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xb75c('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xb75c('0x1')]},'destlanguage':{'type':Sequelize[_0xb75c('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xb75c('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xb75c('0x1')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0xb75c('0x1')]},'inReplyTo':{'type':Sequelize[_0xb75c('0x1')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0xb75c('0x1')]},'to':{'type':Sequelize[_0xb75c('0x1')]},'cc':{'type':Sequelize[_0xb75c('0x1')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0xb75c('0x5')]},'status':{'type':Sequelize[_0xb75c('0x6')](_0xb75c('0x7'),_0xb75c('0x8'),_0xb75c('0x9'),'FAILED')},'url':{'type':Sequelize[_0xb75c('0x1')]},'app':{'type':Sequelize[_0xb75c('0x1')]},'appdata':{'type':Sequelize[_0xb75c('0x1')]},'projectId':{'type':Sequelize[_0xb75c('0x4')]}}; \ No newline at end of file +var _0x358b=['sequelize','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','SENT','RECEIVED'];(function(_0x4c6352,_0x17c753){var _0x5ab3f6=function(_0x20363c){while(--_0x20363c){_0x4c6352['push'](_0x4c6352['shift']());}};_0x5ab3f6(++_0x17c753);}(_0x358b,0x183));var _0xb358=function(_0x4d3f94,_0x235bf3){_0x4d3f94=_0x4d3f94-0x0;var _0x552f73=_0x358b[_0x4d3f94];return _0x552f73;};'use strict';var Sequelize=require(_0xb358('0x0'));module[_0xb358('0x1')]={'integration':{'type':Sequelize[_0xb358('0x2')]},'eventChannel':{'type':Sequelize[_0xb358('0x2')]},'exitStatus':{'type':Sequelize[_0xb358('0x2')]},'ticketId':{'type':Sequelize[_0xb358('0x2')]},'integrationId':{'type':Sequelize[_0xb358('0x3')]},'contacts':{'type':Sequelize[_0xb358('0x2')]},'uniqueid':{'type':Sequelize[_0xb358('0x2')]},'calleridnum':{'type':Sequelize[_0xb358('0x2')]},'calleridname':{'type':Sequelize[_0xb358('0x2')]},'queue':{'type':Sequelize[_0xb358('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xb358('0x2')]},'agentcalledAt':{'type':Sequelize[_0xb358('0x4')]},'agentconnectAt':{'type':Sequelize[_0xb358('0x4')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0xb358('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xb358('0x4')]},'talktime':{'type':Sequelize[_0xb358('0x3')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xb358('0x3')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0xb358('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xb358('0x4')]},'agentdump':{'type':Sequelize[_0xb358('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xb358('0x4')]},'lastevent':{'type':Sequelize[_0xb358('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xb358('0x3')]},'channelstatedesc':{'type':Sequelize[_0xb358('0x2')]},'connectedlinenum':{'type':Sequelize[_0xb358('0x2')]},'connectedlinename':{'type':Sequelize[_0xb358('0x2')]},'language':{'type':Sequelize[_0xb358('0x2')]},'accountcode':{'type':Sequelize[_0xb358('0x2')]},'context':{'type':Sequelize[_0xb358('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xb358('0x2')]},'destchannelstate':{'type':Sequelize[_0xb358('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xb358('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xb358('0x2')]},'destlanguage':{'type':Sequelize[_0xb358('0x2')]},'destaccountcode':{'type':Sequelize[_0xb358('0x2')]},'destcontext':{'type':Sequelize[_0xb358('0x2')]},'destexten':{'type':Sequelize[_0xb358('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0xb358('0x2')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0xb358('0x2')]},'from':{'type':Sequelize[_0xb358('0x2')]},'to':{'type':Sequelize[_0xb358('0x2')]},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0xb358('0x6')]},'text':{'type':Sequelize[_0xb358('0x6')]},'status':{'type':Sequelize['ENUM'](_0xb358('0x7'),'SENDING',_0xb358('0x8'),'FAILED')},'url':{'type':Sequelize[_0xb358('0x2')]},'app':{'type':Sequelize[_0xb358('0x2')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0xb358('0x3')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 8edde7f..52f1f4c 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 _0xdea3=['describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','IntegrationReport','rawAttributes','fieldName','type','key','model','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','keys','include','create','body','find'];(function(_0x4e085f,_0x2576c1){var _0x1e9ef2=function(_0x292b0a){while(--_0x292b0a){_0x4e085f['push'](_0x4e085f['shift']());}};_0x1e9ef2(++_0x2576c1);}(_0xdea3,0x187));var _0x3dea=function(_0x3641e3,_0x55ffe3){_0x3641e3=_0x3641e3-0x0;var _0x49e1ff=_0xdea3[_0x3641e3];return _0x49e1ff;};'use strict';var emlformat=require(_0x3dea('0x0'));var rimraf=require(_0x3dea('0x1'));var zipdir=require(_0x3dea('0x2'));var jsonpatch=require(_0x3dea('0x3'));var rp=require(_0x3dea('0x4'));var moment=require('moment');var BPromise=require(_0x3dea('0x5'));var Mustache=require(_0x3dea('0x6'));var util=require('util');var path=require(_0x3dea('0x7'));var sox=require(_0x3dea('0x8'));var csv=require(_0x3dea('0x9'));var ejs=require(_0x3dea('0xa'));var fs=require('fs');var fs_extra=require(_0x3dea('0xb'));var _=require(_0x3dea('0xc'));var squel=require(_0x3dea('0xd'));var crypto=require(_0x3dea('0xe'));var jsforce=require(_0x3dea('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x3dea('0x9'));var querystring=require(_0x3dea('0x10'));var Papa=require('papaparse');var Redis=require(_0x3dea('0x11'));var authService=require(_0x3dea('0x12'));var qs=require(_0x3dea('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3dea('0x14'));var logger=require(_0x3dea('0x15'))('api');var utils=require(_0x3dea('0x16'));var config=require(_0x3dea('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x3dea('0x18'))['db'];function respondWithStatusCode(_0x374b3f,_0x32c6c6){_0x32c6c6=_0x32c6c6||0xcc;return function(_0x49cc0c){if(_0x49cc0c){return _0x374b3f[_0x3dea('0x19')](_0x32c6c6);}return _0x374b3f['status'](_0x32c6c6)[_0x3dea('0x1a')]();};}function respondWithResult(_0x3d268a,_0x525a90){_0x525a90=_0x525a90||0xc8;return function(_0x2af623){if(_0x2af623){return _0x3d268a[_0x3dea('0x1b')](_0x525a90)[_0x3dea('0x1c')](_0x2af623);}};}function respondWithFilteredResult(_0x32806c,_0x29248a){return function(_0x304986){if(_0x304986){var _0x29ad5e=typeof _0x29248a[_0x3dea('0x1d')]===_0x3dea('0x1e')&&typeof _0x29248a[_0x3dea('0x1f')]===_0x3dea('0x1e');var _0x4f49dc=_0x304986[_0x3dea('0x20')];var _0x30a6b1=_0x29ad5e?0x0:_0x29248a[_0x3dea('0x1d')];var _0x30bfd4=_0x29ad5e?_0x304986[_0x3dea('0x20')]:_0x29248a['offset']+_0x29248a[_0x3dea('0x1f')];var _0x5b1819;if(_0x30bfd4>=_0x4f49dc){_0x30bfd4=_0x4f49dc;_0x5b1819=0xc8;}else{_0x5b1819=0xce;}_0x32806c['status'](_0x5b1819);return _0x32806c['set']('Content-Range',_0x30a6b1+'-'+_0x30bfd4+'/'+_0x4f49dc)[_0x3dea('0x1c')](_0x304986);}return null;};}function patchUpdates(_0x219c81){return function(_0x255ba6){try{jsonpatch[_0x3dea('0x21')](_0x255ba6,_0x219c81,!![]);}catch(_0x20d10d){return BPromise[_0x3dea('0x22')](_0x20d10d);}return _0x255ba6[_0x3dea('0x23')]();};}function saveUpdates(_0x4218d3,_0x5b1102){return function(_0x32da1e){if(_0x32da1e){return _0x32da1e[_0x3dea('0x24')](_0x4218d3)['then'](function(_0xd8535c){return _0xd8535c;});}return null;};}function removeEntity(_0x455b87,_0x2dd19a){return function(_0x5ffd20){if(_0x5ffd20){return _0x5ffd20[_0x3dea('0x25')]()[_0x3dea('0x26')](function(){_0x455b87[_0x3dea('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x34939c,_0x1e5119){return function(_0x3afe50){if(!_0x3afe50){_0x34939c[_0x3dea('0x19')](0x194);}return _0x3afe50;};}function handleError(_0x2efa46,_0x2f230d){_0x2f230d=_0x2f230d||0x1f4;return function(_0x559808){logger[_0x3dea('0x27')](_0x559808[_0x3dea('0x28')]);if(_0x559808[_0x3dea('0x29')]){delete _0x559808[_0x3dea('0x29')];}_0x2efa46['status'](_0x2f230d)[_0x3dea('0x2a')](_0x559808);};}exports[_0x3dea('0x2b')]=function(_0x57863d,_0x4cf0f0){var _0x4d46bc={},_0x317c8e={},_0x2c7c3f={'count':0x0,'rows':[]};var _0x2a69c3=_[_0x3dea('0x2c')](db[_0x3dea('0x2d')][_0x3dea('0x2e')],function(_0x198fb8){return{'name':_0x198fb8[_0x3dea('0x2f')],'type':_0x198fb8[_0x3dea('0x30')][_0x3dea('0x31')]};});_0x317c8e[_0x3dea('0x32')]=_['map'](_0x2a69c3,_0x3dea('0x29'));_0x317c8e['query']=_['keys'](_0x57863d['query']);_0x317c8e['filters']=_[_0x3dea('0x33')](_0x317c8e[_0x3dea('0x32')],_0x317c8e[_0x3dea('0x34')]);_0x4d46bc[_0x3dea('0x35')]=_['intersection'](_0x317c8e[_0x3dea('0x32')],qs[_0x3dea('0x36')](_0x57863d['query'][_0x3dea('0x36')]));_0x4d46bc['attributes']=_0x4d46bc[_0x3dea('0x35')][_0x3dea('0x37')]?_0x4d46bc[_0x3dea('0x35')]:_0x317c8e['model'];if(!_0x57863d['query'][_0x3dea('0x38')](_0x3dea('0x39'))){_0x4d46bc[_0x3dea('0x1f')]=qs[_0x3dea('0x1f')](_0x57863d[_0x3dea('0x34')][_0x3dea('0x1f')]);_0x4d46bc[_0x3dea('0x1d')]=qs['offset'](_0x57863d['query'][_0x3dea('0x1d')]);}_0x4d46bc['order']=qs[_0x3dea('0x3a')](_0x57863d['query'][_0x3dea('0x3a')]);_0x4d46bc[_0x3dea('0x3b')]=qs[_0x3dea('0x3c')](_[_0x3dea('0x3d')](_0x57863d['query'],_0x317c8e[_0x3dea('0x3c')]),_0x2a69c3);if(_0x57863d[_0x3dea('0x34')]['filter']){_0x4d46bc['where']=_[_0x3dea('0x3e')](_0x4d46bc['where'],{'$or':_['map'](_0x2a69c3,function(_0x1dd483){if(_0x1dd483[_0x3dea('0x30')]!==_0x3dea('0x3f')){var _0x3e1dc9={};_0x3e1dc9[_0x1dd483[_0x3dea('0x29')]]={'$like':'%'+_0x57863d[_0x3dea('0x34')][_0x3dea('0x40')]+'%'};return _0x3e1dc9;}})});}_0x4d46bc=_[_0x3dea('0x3e')]({},_0x4d46bc,_0x57863d[_0x3dea('0x41')]);var _0xa87f72={'where':_0x4d46bc[_0x3dea('0x3b')]};return db[_0x3dea('0x2d')]['count'](_0xa87f72)[_0x3dea('0x26')](function(_0x25c6f5){_0x2c7c3f['count']=_0x25c6f5;if(_0x57863d[_0x3dea('0x34')][_0x3dea('0x42')]){_0x4d46bc['include']=[{'all':!![]}];}return db['IntegrationReport'][_0x3dea('0x43')](_0x4d46bc);})[_0x3dea('0x26')](function(_0xaa5d5c){_0x2c7c3f[_0x3dea('0x44')]=_0xaa5d5c;return _0x2c7c3f;})[_0x3dea('0x26')](respondWithFilteredResult(_0x4cf0f0,_0x4d46bc))[_0x3dea('0x45')](handleError(_0x4cf0f0,null));};exports[_0x3dea('0x46')]=function(_0x107d4f,_0x53052a){var _0x7d62b3={'raw':![],'where':{'id':_0x107d4f[_0x3dea('0x47')]['id']}},_0x244aa2={};_0x244aa2[_0x3dea('0x32')]=_[_0x3dea('0x48')](db['IntegrationReport'][_0x3dea('0x2e')]);_0x244aa2['query']=_['keys'](_0x107d4f[_0x3dea('0x34')]);_0x244aa2['filters']=_[_0x3dea('0x33')](_0x244aa2[_0x3dea('0x32')],_0x244aa2[_0x3dea('0x34')]);_0x7d62b3[_0x3dea('0x35')]=_[_0x3dea('0x33')](_0x244aa2[_0x3dea('0x32')],qs[_0x3dea('0x36')](_0x107d4f[_0x3dea('0x34')][_0x3dea('0x36')]));_0x7d62b3[_0x3dea('0x35')]=_0x7d62b3[_0x3dea('0x35')][_0x3dea('0x37')]?_0x7d62b3['attributes']:_0x244aa2[_0x3dea('0x32')];if(_0x107d4f[_0x3dea('0x34')]['includeAll']){_0x7d62b3[_0x3dea('0x49')]=[{'all':!![]}];}_0x7d62b3=_[_0x3dea('0x3e')]({},_0x7d62b3,_0x107d4f[_0x3dea('0x41')]);return db['IntegrationReport']['find'](_0x7d62b3)[_0x3dea('0x26')](handleEntityNotFound(_0x53052a,null))[_0x3dea('0x26')](respondWithResult(_0x53052a,null))[_0x3dea('0x45')](handleError(_0x53052a,null));};exports[_0x3dea('0x4a')]=function(_0x1a046b,_0x18dc1b){return db['IntegrationReport'][_0x3dea('0x4a')](_0x1a046b[_0x3dea('0x4b')],{})['then'](respondWithResult(_0x18dc1b,0xc9))['catch'](handleError(_0x18dc1b,null));};exports[_0x3dea('0x24')]=function(_0x3f5854,_0x737cfa){if(_0x3f5854['body']['id']){delete _0x3f5854[_0x3dea('0x4b')]['id'];}return db[_0x3dea('0x2d')]['find']({'where':{'id':_0x3f5854[_0x3dea('0x47')]['id']}})[_0x3dea('0x26')](handleEntityNotFound(_0x737cfa,null))[_0x3dea('0x26')](saveUpdates(_0x3f5854[_0x3dea('0x4b')],null))[_0x3dea('0x26')](respondWithResult(_0x737cfa,null))[_0x3dea('0x45')](handleError(_0x737cfa,null));};exports[_0x3dea('0x25')]=function(_0x4bae09,_0x3ffd0f){return db[_0x3dea('0x2d')][_0x3dea('0x4c')]({'where':{'id':_0x4bae09[_0x3dea('0x47')]['id']}})[_0x3dea('0x26')](handleEntityNotFound(_0x3ffd0f,null))['then'](removeEntity(_0x3ffd0f,null))['catch'](handleError(_0x3ffd0f,null));};exports[_0x3dea('0x4d')]=function(_0x39df8e,_0x9e2bed){return db[_0x3dea('0x2d')]['describe']()[_0x3dea('0x26')](respondWithResult(_0x9e2bed,null))[_0x3dea('0x45')](handleError(_0x9e2bed,null));}; \ No newline at end of file +var _0x7326=['sort','where','filters','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','keys','includeAll','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','IntegrationReport','rawAttributes','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty'];(function(_0x35534f,_0x32a7c0){var _0x2ff1c8=function(_0x36701c){while(--_0x36701c){_0x35534f['push'](_0x35534f['shift']());}};_0x2ff1c8(++_0x32a7c0);}(_0x7326,0x193));var _0x6732=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x7326[_0x3bf83f];return _0x22c4a9;};'use strict';var emlformat=require(_0x6732('0x0'));var rimraf=require(_0x6732('0x1'));var zipdir=require(_0x6732('0x2'));var jsonpatch=require(_0x6732('0x3'));var rp=require(_0x6732('0x4'));var moment=require(_0x6732('0x5'));var BPromise=require(_0x6732('0x6'));var Mustache=require(_0x6732('0x7'));var util=require(_0x6732('0x8'));var path=require(_0x6732('0x9'));var sox=require(_0x6732('0xa'));var csv=require(_0x6732('0xb'));var ejs=require(_0x6732('0xc'));var fs=require('fs');var fs_extra=require(_0x6732('0xd'));var _=require(_0x6732('0xe'));var squel=require(_0x6732('0xf'));var crypto=require(_0x6732('0x10'));var jsforce=require('jsforce');var deskjs=require(_0x6732('0x11'));var toCsv=require(_0x6732('0xb'));var querystring=require('querystring');var Papa=require(_0x6732('0x12'));var Redis=require(_0x6732('0x13'));var authService=require(_0x6732('0x14'));var qs=require(_0x6732('0x15'));var as=require(_0x6732('0x16'));var hardwareService=require(_0x6732('0x17'));var logger=require('../../config/logger')(_0x6732('0x18'));var utils=require(_0x6732('0x19'));var config=require(_0x6732('0x1a'));var licenseUtil=require(_0x6732('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x439381,_0x16cb7e){_0x16cb7e=_0x16cb7e||0xcc;return function(_0x381a99){if(_0x381a99){return _0x439381[_0x6732('0x1c')](_0x16cb7e);}return _0x439381[_0x6732('0x1d')](_0x16cb7e)[_0x6732('0x1e')]();};}function respondWithResult(_0x158b2d,_0x2f3c2e){_0x2f3c2e=_0x2f3c2e||0xc8;return function(_0x11bb24){if(_0x11bb24){return _0x158b2d['status'](_0x2f3c2e)[_0x6732('0x1f')](_0x11bb24);}};}function respondWithFilteredResult(_0x42c1f1,_0x20154b){return function(_0x5d1f15){if(_0x5d1f15){var _0x209256=typeof _0x20154b['offset']==='undefined'&&typeof _0x20154b[_0x6732('0x20')]==='undefined';var _0x9bab47=_0x5d1f15[_0x6732('0x21')];var _0x2fe19b=_0x209256?0x0:_0x20154b['offset'];var _0x233692=_0x209256?_0x5d1f15[_0x6732('0x21')]:_0x20154b[_0x6732('0x22')]+_0x20154b[_0x6732('0x20')];var _0x521381;if(_0x233692>=_0x9bab47){_0x233692=_0x9bab47;_0x521381=0xc8;}else{_0x521381=0xce;}_0x42c1f1[_0x6732('0x1d')](_0x521381);return _0x42c1f1[_0x6732('0x23')](_0x6732('0x24'),_0x2fe19b+'-'+_0x233692+'/'+_0x9bab47)[_0x6732('0x1f')](_0x5d1f15);}return null;};}function patchUpdates(_0x1a8819){return function(_0x21341e){try{jsonpatch[_0x6732('0x25')](_0x21341e,_0x1a8819,!![]);}catch(_0x4adda0){return BPromise[_0x6732('0x26')](_0x4adda0);}return _0x21341e[_0x6732('0x27')]();};}function saveUpdates(_0x19d368,_0x44f01a){return function(_0x1ff202){if(_0x1ff202){return _0x1ff202[_0x6732('0x28')](_0x19d368)[_0x6732('0x29')](function(_0x408784){return _0x408784;});}return null;};}function removeEntity(_0x1c23a4,_0x1d3785){return function(_0x4f7f3e){if(_0x4f7f3e){return _0x4f7f3e[_0x6732('0x2a')]()[_0x6732('0x29')](function(){_0x1c23a4[_0x6732('0x1d')](0xcc)[_0x6732('0x1e')]();});}};}function handleEntityNotFound(_0x331342,_0x152144){return function(_0x730eed){if(!_0x730eed){_0x331342[_0x6732('0x1c')](0x194);}return _0x730eed;};}function handleError(_0x1d4781,_0x51ce51){_0x51ce51=_0x51ce51||0x1f4;return function(_0x1b096d){logger[_0x6732('0x2b')](_0x1b096d[_0x6732('0x2c')]);if(_0x1b096d[_0x6732('0x2d')]){delete _0x1b096d['name'];}_0x1d4781[_0x6732('0x1d')](_0x51ce51)['send'](_0x1b096d);};}exports[_0x6732('0x2e')]=function(_0x45d5c1,_0x16f183){var _0x292971={},_0x29b549={},_0x147420={'count':0x0,'rows':[]};var _0x53ab06=_[_0x6732('0x2f')](db[_0x6732('0x30')][_0x6732('0x31')],function(_0x3fc173){return{'name':_0x3fc173['fieldName'],'type':_0x3fc173[_0x6732('0x32')][_0x6732('0x33')]};});_0x29b549[_0x6732('0x34')]=_['map'](_0x53ab06,_0x6732('0x2d'));_0x29b549[_0x6732('0x35')]=_['keys'](_0x45d5c1[_0x6732('0x35')]);_0x29b549['filters']=_[_0x6732('0x36')](_0x29b549[_0x6732('0x34')],_0x29b549[_0x6732('0x35')]);_0x292971['attributes']=_['intersection'](_0x29b549[_0x6732('0x34')],qs[_0x6732('0x37')](_0x45d5c1[_0x6732('0x35')][_0x6732('0x37')]));_0x292971[_0x6732('0x38')]=_0x292971[_0x6732('0x38')][_0x6732('0x39')]?_0x292971['attributes']:_0x29b549[_0x6732('0x34')];if(!_0x45d5c1[_0x6732('0x35')][_0x6732('0x3a')]('nolimit')){_0x292971[_0x6732('0x20')]=qs['limit'](_0x45d5c1[_0x6732('0x35')][_0x6732('0x20')]);_0x292971[_0x6732('0x22')]=qs[_0x6732('0x22')](_0x45d5c1[_0x6732('0x35')][_0x6732('0x22')]);}_0x292971['order']=qs['sort'](_0x45d5c1[_0x6732('0x35')][_0x6732('0x3b')]);_0x292971[_0x6732('0x3c')]=qs[_0x6732('0x3d')](_['pick'](_0x45d5c1[_0x6732('0x35')],_0x29b549[_0x6732('0x3d')]),_0x53ab06);if(_0x45d5c1[_0x6732('0x35')][_0x6732('0x3e')]){_0x292971[_0x6732('0x3c')]=_[_0x6732('0x3f')](_0x292971[_0x6732('0x3c')],{'$or':_['map'](_0x53ab06,function(_0x468cf4){if(_0x468cf4[_0x6732('0x32')]!==_0x6732('0x40')){var _0x125641={};_0x125641[_0x468cf4[_0x6732('0x2d')]]={'$like':'%'+_0x45d5c1[_0x6732('0x35')][_0x6732('0x3e')]+'%'};return _0x125641;}})});}_0x292971=_[_0x6732('0x3f')]({},_0x292971,_0x45d5c1['options']);var _0x39c871={'where':_0x292971['where']};return db['IntegrationReport'][_0x6732('0x21')](_0x39c871)['then'](function(_0x1aa7e3){_0x147420[_0x6732('0x21')]=_0x1aa7e3;if(_0x45d5c1['query']['includeAll']){_0x292971[_0x6732('0x41')]=[{'all':!![]}];}return db[_0x6732('0x30')][_0x6732('0x42')](_0x292971);})[_0x6732('0x29')](function(_0x3c8817){_0x147420[_0x6732('0x43')]=_0x3c8817;return _0x147420;})[_0x6732('0x29')](respondWithFilteredResult(_0x16f183,_0x292971))[_0x6732('0x44')](handleError(_0x16f183,null));};exports[_0x6732('0x45')]=function(_0xbaa023,_0x5a54e0){var _0x14615a={'raw':![],'where':{'id':_0xbaa023[_0x6732('0x46')]['id']}},_0x453af5={};_0x453af5[_0x6732('0x34')]=_[_0x6732('0x47')](db[_0x6732('0x30')][_0x6732('0x31')]);_0x453af5[_0x6732('0x35')]=_[_0x6732('0x47')](_0xbaa023['query']);_0x453af5[_0x6732('0x3d')]=_['intersection'](_0x453af5[_0x6732('0x34')],_0x453af5[_0x6732('0x35')]);_0x14615a[_0x6732('0x38')]=_[_0x6732('0x36')](_0x453af5[_0x6732('0x34')],qs[_0x6732('0x37')](_0xbaa023[_0x6732('0x35')][_0x6732('0x37')]));_0x14615a[_0x6732('0x38')]=_0x14615a['attributes'][_0x6732('0x39')]?_0x14615a[_0x6732('0x38')]:_0x453af5['model'];if(_0xbaa023[_0x6732('0x35')][_0x6732('0x48')]){_0x14615a[_0x6732('0x41')]=[{'all':!![]}];}_0x14615a=_[_0x6732('0x3f')]({},_0x14615a,_0xbaa023['options']);return db[_0x6732('0x30')]['find'](_0x14615a)[_0x6732('0x29')](handleEntityNotFound(_0x5a54e0,null))['then'](respondWithResult(_0x5a54e0,null))['catch'](handleError(_0x5a54e0,null));};exports[_0x6732('0x49')]=function(_0x3bf65c,_0x2c1e22){return db[_0x6732('0x30')]['create'](_0x3bf65c[_0x6732('0x4a')],{})[_0x6732('0x29')](respondWithResult(_0x2c1e22,0xc9))[_0x6732('0x44')](handleError(_0x2c1e22,null));};exports[_0x6732('0x28')]=function(_0x4214a3,_0x5a1258){if(_0x4214a3[_0x6732('0x4a')]['id']){delete _0x4214a3[_0x6732('0x4a')]['id'];}return db[_0x6732('0x30')][_0x6732('0x4b')]({'where':{'id':_0x4214a3[_0x6732('0x46')]['id']}})[_0x6732('0x29')](handleEntityNotFound(_0x5a1258,null))['then'](saveUpdates(_0x4214a3[_0x6732('0x4a')],null))[_0x6732('0x29')](respondWithResult(_0x5a1258,null))['catch'](handleError(_0x5a1258,null));};exports[_0x6732('0x2a')]=function(_0x4ec544,_0x54352d){return db[_0x6732('0x30')][_0x6732('0x4b')]({'where':{'id':_0x4ec544[_0x6732('0x46')]['id']}})[_0x6732('0x29')](handleEntityNotFound(_0x54352d,null))['then'](removeEntity(_0x54352d,null))[_0x6732('0x44')](handleError(_0x54352d,null));};exports[_0x6732('0x4c')]=function(_0x533ce5,_0x30769d){return db[_0x6732('0x30')][_0x6732('0x4c')]()[_0x6732('0x29')](respondWithResult(_0x30769d,null))[_0x6732('0x44')](handleError(_0x30769d,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index ede065f..40560c6 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 _0x0f55=['bluebird','request-promise','path','rimraf','../../config/environment','./integrationReport.attributes','IntegrationReport','report_integration','util','api'];(function(_0x27405e,_0x8bda1){var _0x25bfb3=function(_0x50f217){while(--_0x50f217){_0x27405e['push'](_0x27405e['shift']());}};_0x25bfb3(++_0x8bda1);}(_0x0f55,0xe4));var _0x50f5=function(_0x2d2e85,_0x22faa9){_0x2d2e85=_0x2d2e85-0x0;var _0x3e9f5e=_0x0f55[_0x2d2e85];return _0x3e9f5e;};'use strict';var _=require('lodash');var util=require(_0x50f5('0x0'));var logger=require('../../config/logger')(_0x50f5('0x1'));var moment=require('moment');var BPromise=require(_0x50f5('0x2'));var rp=require(_0x50f5('0x3'));var fs=require('fs');var path=require(_0x50f5('0x4'));var rimraf=require(_0x50f5('0x5'));var config=require(_0x50f5('0x6'));var attributes=require(_0x50f5('0x7'));module['exports']=function(_0x3c1cf1,_0x2f4eda){return _0x3c1cf1['define'](_0x50f5('0x8'),attributes,{'tableName':_0x50f5('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x13c4=['rimraf','./integrationReport.attributes','exports','define','IntegrationReport','util','../../config/logger','moment','bluebird','path'];(function(_0x217f24,_0x4cd621){var _0x140852=function(_0x421a4e){while(--_0x421a4e){_0x217f24['push'](_0x217f24['shift']());}};_0x140852(++_0x4cd621);}(_0x13c4,0x1e5));var _0x413c=function(_0x151ed6,_0x6e971){_0x151ed6=_0x151ed6-0x0;var _0x218a0d=_0x13c4[_0x151ed6];return _0x218a0d;};'use strict';var _=require('lodash');var util=require(_0x413c('0x0'));var logger=require(_0x413c('0x1'))('api');var moment=require(_0x413c('0x2'));var BPromise=require(_0x413c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x413c('0x4'));var rimraf=require(_0x413c('0x5'));var config=require('../../config/environment');var attributes=require(_0x413c('0x6'));module[_0x413c('0x7')]=function(_0x3fd8cb,_0x14dfc0){return _0x3fd8cb[_0x413c('0x8')](_0x413c('0x9'),attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index 9b3e583..c324238 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 _0x0295=['client','http','then','info','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','IntegrationReport,\x20%s,\x20%s','message','result','catch','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1c0df2,_0xbc0b5e){var _0x3f3c46=function(_0x2c40c7){while(--_0x2c40c7){_0x1c0df2['push'](_0x1c0df2['shift']());}};_0x3f3c46(++_0xbc0b5e);}(_0x0295,0x1f0));var _0x5029=function(_0x5cdacf,_0x7c82b1){_0x5cdacf=_0x5cdacf-0x0;var _0xa68a8b=_0x0295[_0x5cdacf];return _0xa68a8b;};'use strict';var _=require(_0x5029('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5029('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5029('0x2'))['db'];var utils=require(_0x5029('0x3'));var logger=require(_0x5029('0x4'))(_0x5029('0x5'));var config=require(_0x5029('0x6'));var jayson=require(_0x5029('0x7'));var client=jayson[_0x5029('0x8')][_0x5029('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b3cd,_0x502a62,_0x54978f){return new BPromise(function(_0x4ee867,_0xf4459b){return client['request'](_0x5b3cd,_0x54978f)[_0x5029('0xa')](function(_0x5bccfc){logger[_0x5029('0xb')]('IntegrationReport,\x20%s,\x20%s',_0x502a62,_0x5029('0xc'));logger[_0x5029('0xd')](_0x5029('0xe'),_0x502a62,'request\x20sent',JSON[_0x5029('0xf')](_0x5bccfc));if(_0x5bccfc[_0x5029('0x10')]){if(_0x5bccfc[_0x5029('0x10')]['code']===0x1f4){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc['error']['message']);return _0xf4459b(_0x5bccfc['error']['message']);}logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);return _0x4ee867(_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);}else{logger[_0x5029('0xb')](_0x5029('0x11'),_0x502a62,_0x5029('0xc'));_0x4ee867(_0x5bccfc[_0x5029('0x13')][_0x5029('0x12')]);}})[_0x5029('0x14')](function(_0x3786b5){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x3786b5);_0xf4459b(_0x3786b5);});});} \ No newline at end of file +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(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0xc2c7,0x134));var _0x7c2c=function(_0x33481f,_0x5dd9d6){_0x33481f=_0x33481f-0x0;var _0x320285=_0xc2c7[_0x33481f];return _0x320285;};'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 93dec14..8e80b71 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 _0x2df7=['Router','fs-extra','../../components/auth/service','../../config/environment','./interval.controller','get','index','show','isAuthenticated','create','post','/:id/sub_intervals','addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x296a2a,_0x3c12ed){var _0x3aa260=function(_0x1be52f){while(--_0x1be52f){_0x296a2a['push'](_0x296a2a['shift']());}};_0x3aa260(++_0x3c12ed);}(_0x2df7,0x1f4));var _0x72df=function(_0x3a2321,_0x2fbd26){_0x3a2321=_0x3a2321-0x0;var _0x20d155=_0x2df7[_0x3a2321];return _0x20d155;};'use strict';var multer=require(_0x72df('0x0'));var util=require('util');var path=require(_0x72df('0x1'));var timeout=require(_0x72df('0x2'));var express=require(_0x72df('0x3'));var router=express[_0x72df('0x4')]();var fs_extra=require(_0x72df('0x5'));var auth=require(_0x72df('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x72df('0x7'));var controller=require(_0x72df('0x8'));router[_0x72df('0x9')]('/',auth['isAuthenticated'](),controller[_0x72df('0xa')]);router[_0x72df('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x72df('0xb')]);router[_0x72df('0x9')]('/:id/sub_intervals',auth[_0x72df('0xc')](),controller['getIntervals']);router['post']('/',auth[_0x72df('0xc')](),controller[_0x72df('0xd')]);router[_0x72df('0xe')](_0x72df('0xf'),auth[_0x72df('0xc')](),controller[_0x72df('0x10')]);router[_0x72df('0xe')](_0x72df('0x11'),auth[_0x72df('0xc')](),controller[_0x72df('0x12')]);router[_0x72df('0x13')]('/:id',auth[_0x72df('0xc')](),controller[_0x72df('0x14')]);router[_0x72df('0x15')]('/:id',auth[_0x72df('0xc')](),controller[_0x72df('0x16')]);module[_0x72df('0x17')]=router; \ No newline at end of file +var _0x1e6c=['addInterval','addIntervals','put','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','show','/:id/sub_intervals','getIntervals','post','create'];(function(_0x3c2fdc,_0x172d18){var _0x14eba8=function(_0x57b64){while(--_0x57b64){_0x3c2fdc['push'](_0x3c2fdc['shift']());}};_0x14eba8(++_0x172d18);}(_0x1e6c,0x11a));var _0xc1e6=function(_0x5a27e8,_0x492a2f){_0x5a27e8=_0x5a27e8-0x0;var _0x4e38f7=_0x1e6c[_0x5a27e8];return _0x4e38f7;};'use strict';var multer=require(_0xc1e6('0x0'));var util=require('util');var path=require(_0xc1e6('0x1'));var timeout=require(_0xc1e6('0x2'));var express=require(_0xc1e6('0x3'));var router=express[_0xc1e6('0x4')]();var fs_extra=require(_0xc1e6('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc1e6('0x6'));var controller=require(_0xc1e6('0x7'));router[_0xc1e6('0x8')]('/',auth[_0xc1e6('0x9')](),controller[_0xc1e6('0xa')]);router[_0xc1e6('0x8')](_0xc1e6('0xb'),auth['isAuthenticated'](),controller[_0xc1e6('0xc')]);router['get'](_0xc1e6('0xd'),auth['isAuthenticated'](),controller[_0xc1e6('0xe')]);router[_0xc1e6('0xf')]('/',auth[_0xc1e6('0x9')](),controller[_0xc1e6('0x10')]);router['post']('/:id/sub_intervals',auth[_0xc1e6('0x9')](),controller[_0xc1e6('0x11')]);router[_0xc1e6('0xf')]('/:id/sub_intervals/create_many',auth[_0xc1e6('0x9')](),controller[_0xc1e6('0x12')]);router[_0xc1e6('0x13')](_0xc1e6('0xb'),auth[_0xc1e6('0x9')](),controller[_0xc1e6('0x14')]);router[_0xc1e6('0x15')](_0xc1e6('0xb'),auth[_0xc1e6('0x9')](),controller['destroy']);module[_0xc1e6('0x16')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index be68d34..0c5b962 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 _0x2283=['sequelize','exports','STRING'];(function(_0x564bb4,_0x4a9830){var _0x570250=function(_0x251d50){while(--_0x251d50){_0x564bb4['push'](_0x564bb4['shift']());}};_0x570250(++_0x4a9830);}(_0x2283,0x18c));var _0x3228=function(_0x479a4b,_0x3a25cd){_0x479a4b=_0x479a4b-0x0;var _0x1ac688=_0x2283[_0x479a4b];return _0x1ac688;};'use strict';var Sequelize=require(_0x3228('0x0'));module[_0x3228('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3228('0x2')]},'interval':{'type':Sequelize[_0x3228('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x68cf=['sequelize','exports','STRING'];(function(_0x3c4a7c,_0x2f4e3c){var _0xf13d1e=function(_0x24cb78){while(--_0x24cb78){_0x3c4a7c['push'](_0x3c4a7c['shift']());}};_0xf13d1e(++_0x2f4e3c);}(_0x68cf,0x165));var _0xf68c=function(_0x49c27e,_0x502add){_0x49c27e=_0x49c27e-0x0;var _0x504093=_0x68cf[_0x49c27e];return _0x504093;};'use strict';var Sequelize=require(_0xf68c('0x0'));module[_0xf68c('0x1')]={'name':{'type':Sequelize[_0xf68c('0x2')]},'description':{'type':Sequelize[_0xf68c('0x2')]},'interval':{'type':Sequelize[_0xf68c('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 6c663ab..5f6c5fe 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 _0x4712=['rows','catch','show','params','find','create','body','role','user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addInterval','getIntervals','nolimit','addIntervals','findOne','sequelize','transaction','IntervalId','bulkCreate','rimraf','request-promise','moment','bluebird','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','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','then','destroy','get','Intervals','UserProfileResource','sendStatus','stack','name','send','map','Interval','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include'];(function(_0x47a5bd,_0x508329){var _0x5c2184=function(_0x40ddea){while(--_0x40ddea){_0x47a5bd['push'](_0x47a5bd['shift']());}};_0x5c2184(++_0x508329);}(_0x4712,0xcc));var _0x2471=function(_0x2da866,_0x279d6e){_0x2da866=_0x2da866-0x0;var _0x4103f0=_0x4712[_0x2da866];return _0x4103f0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2471('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2471('0x1'));var moment=require(_0x2471('0x2'));var BPromise=require(_0x2471('0x3'));var Mustache=require('mustache');var util=require(_0x2471('0x4'));var path=require(_0x2471('0x5'));var sox=require(_0x2471('0x6'));var csv=require(_0x2471('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2471('0x8'));var _=require(_0x2471('0x9'));var squel=require(_0x2471('0xa'));var crypto=require(_0x2471('0xb'));var jsforce=require(_0x2471('0xc'));var deskjs=require(_0x2471('0xd'));var toCsv=require('to-csv');var querystring=require(_0x2471('0xe'));var Papa=require('papaparse');var Redis=require(_0x2471('0xf'));var authService=require(_0x2471('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x2471('0x11'));var hardwareService=require(_0x2471('0x12'));var logger=require('../../config/logger')(_0x2471('0x13'));var utils=require(_0x2471('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0xceef5d,_0x1cf4b5){_0x1cf4b5=_0x1cf4b5||0xcc;return function(_0x4b6151){if(_0x4b6151){return _0xceef5d['sendStatus'](_0x1cf4b5);}return _0xceef5d[_0x2471('0x15')](_0x1cf4b5)[_0x2471('0x16')]();};}function respondWithResult(_0x248bd8,_0x1aa439){_0x1aa439=_0x1aa439||0xc8;return function(_0x19b2ab){if(_0x19b2ab){return _0x248bd8[_0x2471('0x15')](_0x1aa439)[_0x2471('0x17')](_0x19b2ab);}};}function respondWithFilteredResult(_0x5d87b5,_0x5cde10){return function(_0x4f36ff){if(_0x4f36ff){var _0x1ab610=typeof _0x5cde10['offset']===_0x2471('0x18')&&typeof _0x5cde10[_0x2471('0x19')]===_0x2471('0x18');var _0x3718f6=_0x4f36ff[_0x2471('0x1a')];var _0x59423f=_0x1ab610?0x0:_0x5cde10[_0x2471('0x1b')];var _0x33a4c9=_0x1ab610?_0x4f36ff[_0x2471('0x1a')]:_0x5cde10[_0x2471('0x1b')]+_0x5cde10[_0x2471('0x19')];var _0x402d3d;if(_0x33a4c9>=_0x3718f6){_0x33a4c9=_0x3718f6;_0x402d3d=0xc8;}else{_0x402d3d=0xce;}_0x5d87b5['status'](_0x402d3d);return _0x5d87b5[_0x2471('0x1c')](_0x2471('0x1d'),_0x59423f+'-'+_0x33a4c9+'/'+_0x3718f6)[_0x2471('0x17')](_0x4f36ff);}return null;};}function patchUpdates(_0x1ceeba){return function(_0x283d46){try{jsonpatch[_0x2471('0x1e')](_0x283d46,_0x1ceeba,!![]);}catch(_0x3455bc){return BPromise[_0x2471('0x1f')](_0x3455bc);}return _0x283d46['save']();};}function saveUpdates(_0x2255fc,_0x4179c6){return function(_0xae85ce){if(_0xae85ce){return _0xae85ce['update'](_0x2255fc)[_0x2471('0x20')](function(_0x2306e2){return _0x2306e2;});}return null;};}function removeEntity(_0x2448a8,_0x5849cf){return function(_0x4f6a77){if(_0x4f6a77){return _0x4f6a77[_0x2471('0x21')]()[_0x2471('0x20')](function(){var _0x5dc6d6=_0x4f6a77[_0x2471('0x22')]({'plain':!![]});var _0x347c10=_0x2471('0x23');return db[_0x2471('0x24')][_0x2471('0x21')]({'where':{'type':_0x347c10,'resourceId':_0x5dc6d6['id']}})[_0x2471('0x20')](function(){return _0x4f6a77;});})['then'](function(){_0x2448a8[_0x2471('0x15')](0xcc)[_0x2471('0x16')]();});}};}function handleEntityNotFound(_0x4ed01d,_0x4fea93){return function(_0x46207a){if(!_0x46207a){_0x4ed01d[_0x2471('0x25')](0x194);}return _0x46207a;};}function handleError(_0xf4fb85,_0x431118){_0x431118=_0x431118||0x1f4;return function(_0x1d3f7d){logger['error'](_0x1d3f7d[_0x2471('0x26')]);if(_0x1d3f7d[_0x2471('0x27')]){delete _0x1d3f7d[_0x2471('0x27')];}_0xf4fb85[_0x2471('0x15')](_0x431118)[_0x2471('0x28')](_0x1d3f7d);};}exports['index']=function(_0x3170ab,_0x3b9dab){var _0x226b47={},_0x2145b6={},_0x4cf0df={'count':0x0,'rows':[]};var _0x27cf10=_[_0x2471('0x29')](db[_0x2471('0x2a')][_0x2471('0x2b')],function(_0x1bb45e){return{'name':_0x1bb45e[_0x2471('0x2c')],'type':_0x1bb45e[_0x2471('0x2d')][_0x2471('0x2e')]};});_0x2145b6[_0x2471('0x2f')]=_['map'](_0x27cf10,_0x2471('0x27'));_0x2145b6[_0x2471('0x30')]=_[_0x2471('0x31')](_0x3170ab[_0x2471('0x30')]);_0x2145b6['filters']=_[_0x2471('0x32')](_0x2145b6[_0x2471('0x2f')],_0x2145b6[_0x2471('0x30')]);_0x226b47['attributes']=_[_0x2471('0x32')](_0x2145b6['model'],qs[_0x2471('0x33')](_0x3170ab[_0x2471('0x30')][_0x2471('0x33')]));_0x226b47[_0x2471('0x34')]=_0x226b47[_0x2471('0x34')][_0x2471('0x35')]?_0x226b47[_0x2471('0x34')]:_0x2145b6['model'];if(!_0x3170ab[_0x2471('0x30')][_0x2471('0x36')]('nolimit')){_0x226b47[_0x2471('0x19')]=qs[_0x2471('0x19')](_0x3170ab[_0x2471('0x30')][_0x2471('0x19')]);_0x226b47[_0x2471('0x1b')]=qs['offset'](_0x3170ab[_0x2471('0x30')]['offset']);}_0x226b47[_0x2471('0x37')]=qs[_0x2471('0x38')](_0x3170ab[_0x2471('0x30')][_0x2471('0x38')]);_0x226b47[_0x2471('0x39')]=qs[_0x2471('0x3a')](_[_0x2471('0x3b')](_0x3170ab['query'],_0x2145b6['filters']),_0x27cf10);if(_0x3170ab[_0x2471('0x30')][_0x2471('0x3c')]){_0x226b47[_0x2471('0x39')]=_['merge'](_0x226b47['where'],{'$or':_[_0x2471('0x29')](_0x27cf10,function(_0x4d43a5){if(_0x4d43a5['type']!==_0x2471('0x3d')){var _0x1dbf22={};_0x1dbf22[_0x4d43a5[_0x2471('0x27')]]={'$like':'%'+_0x3170ab['query'][_0x2471('0x3c')]+'%'};return _0x1dbf22;}})});}_0x226b47=_[_0x2471('0x3e')]({},_0x226b47,_0x3170ab[_0x2471('0x3f')]);var _0x5a2881={'where':_0x226b47[_0x2471('0x39')]};return db[_0x2471('0x2a')][_0x2471('0x1a')](_0x5a2881)[_0x2471('0x20')](function(_0x4aaa37){_0x4cf0df[_0x2471('0x1a')]=_0x4aaa37;if(_0x3170ab[_0x2471('0x30')][_0x2471('0x40')]){_0x226b47[_0x2471('0x41')]=[{'all':!![]}];}return db[_0x2471('0x2a')]['findAll'](_0x226b47);})[_0x2471('0x20')](function(_0x25ca15){_0x4cf0df[_0x2471('0x42')]=_0x25ca15;return _0x4cf0df;})[_0x2471('0x20')](respondWithFilteredResult(_0x3b9dab,_0x226b47))[_0x2471('0x43')](handleError(_0x3b9dab,null));};exports[_0x2471('0x44')]=function(_0x399276,_0x5564cc){var _0x576251={'raw':!![],'where':{'id':_0x399276[_0x2471('0x45')]['id']}},_0x5af6c0={};_0x5af6c0['model']=_[_0x2471('0x31')](db[_0x2471('0x2a')][_0x2471('0x2b')]);_0x5af6c0[_0x2471('0x30')]=_[_0x2471('0x31')](_0x399276['query']);_0x5af6c0[_0x2471('0x3a')]=_['intersection'](_0x5af6c0[_0x2471('0x2f')],_0x5af6c0['query']);_0x576251[_0x2471('0x34')]=_[_0x2471('0x32')](_0x5af6c0[_0x2471('0x2f')],qs[_0x2471('0x33')](_0x399276[_0x2471('0x30')]['fields']));_0x576251[_0x2471('0x34')]=_0x576251[_0x2471('0x34')][_0x2471('0x35')]?_0x576251[_0x2471('0x34')]:_0x5af6c0[_0x2471('0x2f')];if(_0x399276[_0x2471('0x30')]['includeAll']){_0x576251[_0x2471('0x41')]=[{'all':!![]}];}_0x576251=_[_0x2471('0x3e')]({},_0x576251,_0x399276['options']);return db['Interval'][_0x2471('0x46')](_0x576251)['then'](handleEntityNotFound(_0x5564cc,null))['then'](respondWithResult(_0x5564cc,null))[_0x2471('0x43')](handleError(_0x5564cc,null));};exports[_0x2471('0x47')]=function(_0x1d4816,_0x528891){return db[_0x2471('0x2a')][_0x2471('0x47')](_0x1d4816[_0x2471('0x48')],{})[_0x2471('0x20')](function(_0xc5dd27){var _0x474442=_0x1d4816['user'][_0x2471('0x22')]({'plain':!![]});if(!_0x474442)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x474442[_0x2471('0x49')]===_0x2471('0x4a')){var _0x338d9b=_0xc5dd27[_0x2471('0x22')]({'plain':!![]});var _0x4a513c=_0x2471('0x23');return db[_0x2471('0x4b')][_0x2471('0x46')]({'where':{'name':_0x4a513c,'userProfileId':_0x474442[_0x2471('0x4c')]},'raw':!![]})[_0x2471('0x20')](function(_0x1c52e7){if(_0x1c52e7&&_0x1c52e7[_0x2471('0x4d')]===0x0){return db[_0x2471('0x24')][_0x2471('0x47')]({'name':_0x338d9b['name'],'resourceId':_0x338d9b['id'],'type':_0x1c52e7[_0x2471('0x27')],'sectionId':_0x1c52e7['id']},{})['then'](function(){return _0xc5dd27;});}else{return _0xc5dd27;}})['catch'](function(_0x3a9e44){logger[_0x2471('0x4e')](_0x2471('0x4f'),_0x3a9e44);throw _0x3a9e44;});}return _0xc5dd27;})[_0x2471('0x20')](respondWithResult(_0x528891,0xc9))[_0x2471('0x43')](handleError(_0x528891,null));};exports[_0x2471('0x50')]=function(_0x252831,_0x1f5392){if(_0x252831[_0x2471('0x48')]['id']){delete _0x252831['body']['id'];}return db['Interval'][_0x2471('0x46')]({'where':{'id':_0x252831[_0x2471('0x45')]['id']}})[_0x2471('0x20')](handleEntityNotFound(_0x1f5392,null))['then'](saveUpdates(_0x252831['body'],null))[_0x2471('0x20')](respondWithResult(_0x1f5392,null))[_0x2471('0x43')](handleError(_0x1f5392,null));};exports['destroy']=function(_0x4098c6,_0x103037){return db[_0x2471('0x2a')][_0x2471('0x46')]({'where':{'id':_0x4098c6[_0x2471('0x45')]['id']}})['then'](handleEntityNotFound(_0x103037,null))[_0x2471('0x20')](removeEntity(_0x103037,null))['catch'](handleError(_0x103037,null));};exports[_0x2471('0x51')]=function(_0x410a6b,_0x41a831,_0x5ab8f4){if(_0x410a6b['body']['id']){delete _0x410a6b['body']['id'];}return db[_0x2471('0x2a')]['find']({'where':{'id':_0x410a6b[_0x2471('0x45')]['id']}})[_0x2471('0x20')](handleEntityNotFound(_0x41a831,null))['then'](function(_0x4c42e7){if(_0x4c42e7){_0x410a6b[_0x2471('0x48')]['IntervalId']=_0x4c42e7['id'];return db[_0x2471('0x2a')][_0x2471('0x47')](_0x410a6b[_0x2471('0x48')]);}})[_0x2471('0x20')](respondWithResult(_0x41a831,null))[_0x2471('0x43')](handleError(_0x41a831,null));};exports[_0x2471('0x52')]=function(_0x3f3c65,_0x11bca1,_0xe05d42){var _0x3d8fc0={};var _0x416dbd={};var _0x3edebc;var _0x1c8501;return db[_0x2471('0x2a')]['findOne']({'where':{'id':_0x3f3c65['params']['id']}})[_0x2471('0x20')](handleEntityNotFound(_0x11bca1,null))[_0x2471('0x20')](function(_0x512bd3){if(_0x512bd3){_0x3edebc=_0x512bd3;_0x416dbd['model']=_[_0x2471('0x31')](db[_0x2471('0x2a')][_0x2471('0x2b')]);_0x416dbd[_0x2471('0x30')]=_[_0x2471('0x31')](_0x3f3c65['query']);_0x416dbd[_0x2471('0x3a')]=_['intersection'](_0x416dbd[_0x2471('0x2f')],_0x416dbd[_0x2471('0x30')]);_0x3d8fc0[_0x2471('0x34')]=_['intersection'](_0x416dbd[_0x2471('0x2f')],qs[_0x2471('0x33')](_0x3f3c65[_0x2471('0x30')]['fields']));_0x3d8fc0['attributes']=_0x3d8fc0[_0x2471('0x34')][_0x2471('0x35')]?_0x3d8fc0[_0x2471('0x34')]:_0x416dbd[_0x2471('0x2f')];_0x3d8fc0[_0x2471('0x37')]=qs['sort'](_0x3f3c65['query'][_0x2471('0x38')]);_0x3d8fc0[_0x2471('0x39')]=qs['filters'](_[_0x2471('0x3b')](_0x3f3c65[_0x2471('0x30')],_0x416dbd[_0x2471('0x3a')]));if(_0x3f3c65[_0x2471('0x30')][_0x2471('0x3c')]){_0x3d8fc0['where']=_['merge'](_0x3d8fc0[_0x2471('0x39')],{'$or':_[_0x2471('0x29')](_0x3d8fc0['attributes'],function(_0x299f35){var _0x4aefc6={};_0x4aefc6[_0x299f35]={'$like':'%'+_0x3f3c65[_0x2471('0x30')][_0x2471('0x3c')]+'%'};return _0x4aefc6;})});}_0x3d8fc0=_[_0x2471('0x3e')]({},_0x3d8fc0,_0x3f3c65[_0x2471('0x3f')]);return _0x3edebc[_0x2471('0x52')](_0x3d8fc0);}})[_0x2471('0x20')](function(_0x1ae551){if(_0x1ae551){_0x1c8501=_0x1ae551[_0x2471('0x35')];if(!_0x3f3c65[_0x2471('0x30')][_0x2471('0x36')](_0x2471('0x53'))){_0x3d8fc0[_0x2471('0x19')]=qs[_0x2471('0x19')](_0x3f3c65[_0x2471('0x30')][_0x2471('0x19')]);_0x3d8fc0[_0x2471('0x1b')]=qs['offset'](_0x3f3c65[_0x2471('0x30')][_0x2471('0x1b')]);}return _0x3edebc[_0x2471('0x52')](_0x3d8fc0);}})[_0x2471('0x20')](function(_0x158014){if(_0x158014){return _0x158014?{'count':_0x1c8501,'rows':_0x158014}:null;}})['then'](respondWithResult(_0x11bca1,null))[_0x2471('0x43')](handleError(_0x11bca1,null));};exports[_0x2471('0x54')]=function(_0x23e300,_0xcebc24,_0x435ca2){return db['Interval'][_0x2471('0x55')]({'where':{'id':_0x23e300[_0x2471('0x45')]['id']}})[_0x2471('0x20')](handleEntityNotFound(_0xcebc24,null))[_0x2471('0x20')](function(_0xc205d2){if(_0xc205d2){return db[_0x2471('0x56')][_0x2471('0x57')](function(_0x495fd9){return db[_0x2471('0x2a')][_0x2471('0x21')]({'where':{'IntervalId':_0x23e300[_0x2471('0x45')]['id']},'transaction':_0x495fd9})[_0x2471('0x20')](function(_0x5f2a69){var _0x4f523c=_[_0x2471('0x29')](_0x23e300[_0x2471('0x48')],function(_0x46fa2b){delete _0x46fa2b['id'];_0x46fa2b[_0x2471('0x58')]=_0x23e300[_0x2471('0x45')]['id'];return _0x46fa2b;});return db[_0x2471('0x2a')][_0x2471('0x59')](_0x4f523c,{'transaction':_0x495fd9});});})[_0x2471('0x20')](function(){return db[_0x2471('0x2a')]['findAll']({'where':{'IntervalId':_0x23e300[_0x2471('0x45')]['id']}});});}})[_0x2471('0x20')](respondWithResult(_0xcebc24,null))[_0x2471('0x43')](handleError(_0xcebc24,null));}; \ No newline at end of file +var _0x7773=['api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','get','UserProfileResource','name','send','index','map','Interval','rawAttributes','fieldName','key','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','then','show','params','include','find','catch','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Intervals','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','IntervalId','create','getIntervals','findOne','addIntervals','sequelize','transaction','bulkCreate','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger'];(function(_0x462da0,_0x56fcbf){var _0xccb0a3=function(_0x10032c){while(--_0x10032c){_0x462da0['push'](_0x462da0['shift']());}};_0xccb0a3(++_0x56fcbf);}(_0x7773,0x155));var _0x3777=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x7773[_0x46698a];return _0x356db0;};'use strict';var emlformat=require(_0x3777('0x0'));var rimraf=require(_0x3777('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3777('0x2'));var rp=require(_0x3777('0x3'));var moment=require(_0x3777('0x4'));var BPromise=require(_0x3777('0x5'));var Mustache=require(_0x3777('0x6'));var util=require(_0x3777('0x7'));var path=require(_0x3777('0x8'));var sox=require(_0x3777('0x9'));var csv=require(_0x3777('0xa'));var ejs=require(_0x3777('0xb'));var fs=require('fs');var fs_extra=require(_0x3777('0xc'));var _=require(_0x3777('0xd'));var squel=require(_0x3777('0xe'));var crypto=require(_0x3777('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3777('0xa'));var querystring=require(_0x3777('0x10'));var Papa=require(_0x3777('0x11'));var Redis=require(_0x3777('0x12'));var authService=require(_0x3777('0x13'));var qs=require(_0x3777('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3777('0x15'));var logger=require(_0x3777('0x16'))(_0x3777('0x17'));var utils=require(_0x3777('0x18'));var config=require(_0x3777('0x19'));var licenseUtil=require(_0x3777('0x1a'));var db=require('../../mysqldb')['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x59bdd2,_0x5abd94){_0x5abd94=_0x5abd94||0xcc;return function(_0x24c2f6){if(_0x24c2f6){return _0x59bdd2[_0x3777('0x1b')](_0x5abd94);}return _0x59bdd2[_0x3777('0x1c')](_0x5abd94)[_0x3777('0x1d')]();};}function respondWithResult(_0x551133,_0x194dea){_0x194dea=_0x194dea||0xc8;return function(_0x2aff32){if(_0x2aff32){return _0x551133[_0x3777('0x1c')](_0x194dea)[_0x3777('0x1e')](_0x2aff32);}};}function respondWithFilteredResult(_0x5c42d7,_0x3a7e2e){return function(_0x268484){if(_0x268484){var _0x4fc403=typeof _0x3a7e2e[_0x3777('0x1f')]===_0x3777('0x20')&&typeof _0x3a7e2e[_0x3777('0x21')]===_0x3777('0x20');var _0x57afc4=_0x268484[_0x3777('0x22')];var _0x23bae3=_0x4fc403?0x0:_0x3a7e2e[_0x3777('0x1f')];var _0x26dfc8=_0x4fc403?_0x268484[_0x3777('0x22')]:_0x3a7e2e[_0x3777('0x1f')]+_0x3a7e2e[_0x3777('0x21')];var _0x11e519;if(_0x26dfc8>=_0x57afc4){_0x26dfc8=_0x57afc4;_0x11e519=0xc8;}else{_0x11e519=0xce;}_0x5c42d7[_0x3777('0x1c')](_0x11e519);return _0x5c42d7[_0x3777('0x23')](_0x3777('0x24'),_0x23bae3+'-'+_0x26dfc8+'/'+_0x57afc4)['json'](_0x268484);}return null;};}function patchUpdates(_0x17ba12){return function(_0x412f6c){try{jsonpatch[_0x3777('0x25')](_0x412f6c,_0x17ba12,!![]);}catch(_0x5e354d){return BPromise[_0x3777('0x26')](_0x5e354d);}return _0x412f6c['save']();};}function saveUpdates(_0x1197b2,_0x2345be){return function(_0x2046bf){if(_0x2046bf){return _0x2046bf[_0x3777('0x27')](_0x1197b2)['then'](function(_0x324360){return _0x324360;});}return null;};}function removeEntity(_0x3444a4,_0x42cc4f){return function(_0x42d08d){if(_0x42d08d){return _0x42d08d[_0x3777('0x28')]()['then'](function(){var _0x34ad30=_0x42d08d[_0x3777('0x29')]({'plain':!![]});var _0x1b4c9e='Intervals';return db[_0x3777('0x2a')]['destroy']({'where':{'type':_0x1b4c9e,'resourceId':_0x34ad30['id']}})['then'](function(){return _0x42d08d;});})['then'](function(){_0x3444a4[_0x3777('0x1c')](0xcc)[_0x3777('0x1d')]();});}};}function handleEntityNotFound(_0x36063c,_0x4d189f){return function(_0x1e8409){if(!_0x1e8409){_0x36063c[_0x3777('0x1b')](0x194);}return _0x1e8409;};}function handleError(_0x125391,_0x7d9d98){_0x7d9d98=_0x7d9d98||0x1f4;return function(_0x526a49){logger['error'](_0x526a49['stack']);if(_0x526a49['name']){delete _0x526a49[_0x3777('0x2b')];}_0x125391[_0x3777('0x1c')](_0x7d9d98)[_0x3777('0x2c')](_0x526a49);};}exports[_0x3777('0x2d')]=function(_0x29ec22,_0x31e991){var _0x5aa5bc={},_0x5a7e4b={},_0x5188b1={'count':0x0,'rows':[]};var _0x1b2352=_[_0x3777('0x2e')](db[_0x3777('0x2f')][_0x3777('0x30')],function(_0x540377){return{'name':_0x540377[_0x3777('0x31')],'type':_0x540377['type'][_0x3777('0x32')]};});_0x5a7e4b['model']=_['map'](_0x1b2352,_0x3777('0x2b'));_0x5a7e4b[_0x3777('0x33')]=_[_0x3777('0x34')](_0x29ec22[_0x3777('0x33')]);_0x5a7e4b['filters']=_[_0x3777('0x35')](_0x5a7e4b['model'],_0x5a7e4b[_0x3777('0x33')]);_0x5aa5bc[_0x3777('0x36')]=_[_0x3777('0x35')](_0x5a7e4b[_0x3777('0x37')],qs['fields'](_0x29ec22[_0x3777('0x33')][_0x3777('0x38')]));_0x5aa5bc[_0x3777('0x36')]=_0x5aa5bc['attributes'][_0x3777('0x39')]?_0x5aa5bc[_0x3777('0x36')]:_0x5a7e4b[_0x3777('0x37')];if(!_0x29ec22[_0x3777('0x33')][_0x3777('0x3a')]('nolimit')){_0x5aa5bc[_0x3777('0x21')]=qs['limit'](_0x29ec22[_0x3777('0x33')]['limit']);_0x5aa5bc[_0x3777('0x1f')]=qs[_0x3777('0x1f')](_0x29ec22[_0x3777('0x33')][_0x3777('0x1f')]);}_0x5aa5bc[_0x3777('0x3b')]=qs[_0x3777('0x3c')](_0x29ec22[_0x3777('0x33')][_0x3777('0x3c')]);_0x5aa5bc[_0x3777('0x3d')]=qs[_0x3777('0x3e')](_[_0x3777('0x3f')](_0x29ec22['query'],_0x5a7e4b['filters']),_0x1b2352);if(_0x29ec22[_0x3777('0x33')][_0x3777('0x40')]){_0x5aa5bc[_0x3777('0x3d')]=_['merge'](_0x5aa5bc[_0x3777('0x3d')],{'$or':_['map'](_0x1b2352,function(_0x18e835){if(_0x18e835['type']!==_0x3777('0x41')){var _0x131e0a={};_0x131e0a[_0x18e835[_0x3777('0x2b')]]={'$like':'%'+_0x29ec22[_0x3777('0x33')][_0x3777('0x40')]+'%'};return _0x131e0a;}})});}_0x5aa5bc=_[_0x3777('0x42')]({},_0x5aa5bc,_0x29ec22[_0x3777('0x43')]);var _0x4c843f={'where':_0x5aa5bc[_0x3777('0x3d')]};return db['Interval'][_0x3777('0x22')](_0x4c843f)['then'](function(_0x47ac71){_0x5188b1[_0x3777('0x22')]=_0x47ac71;if(_0x29ec22['query'][_0x3777('0x44')]){_0x5aa5bc['include']=[{'all':!![]}];}return db['Interval']['findAll'](_0x5aa5bc);})['then'](function(_0x19e7c4){_0x5188b1['rows']=_0x19e7c4;return _0x5188b1;})[_0x3777('0x45')](respondWithFilteredResult(_0x31e991,_0x5aa5bc))['catch'](handleError(_0x31e991,null));};exports[_0x3777('0x46')]=function(_0x1975a5,_0x2e6d61){var _0x2a3e1f={'raw':!![],'where':{'id':_0x1975a5[_0x3777('0x47')]['id']}},_0x403f86={};_0x403f86[_0x3777('0x37')]=_[_0x3777('0x34')](db[_0x3777('0x2f')][_0x3777('0x30')]);_0x403f86[_0x3777('0x33')]=_['keys'](_0x1975a5['query']);_0x403f86[_0x3777('0x3e')]=_[_0x3777('0x35')](_0x403f86[_0x3777('0x37')],_0x403f86['query']);_0x2a3e1f[_0x3777('0x36')]=_['intersection'](_0x403f86[_0x3777('0x37')],qs[_0x3777('0x38')](_0x1975a5[_0x3777('0x33')][_0x3777('0x38')]));_0x2a3e1f[_0x3777('0x36')]=_0x2a3e1f[_0x3777('0x36')][_0x3777('0x39')]?_0x2a3e1f[_0x3777('0x36')]:_0x403f86[_0x3777('0x37')];if(_0x1975a5[_0x3777('0x33')][_0x3777('0x44')]){_0x2a3e1f[_0x3777('0x48')]=[{'all':!![]}];}_0x2a3e1f=_['merge']({},_0x2a3e1f,_0x1975a5[_0x3777('0x43')]);return db['Interval'][_0x3777('0x49')](_0x2a3e1f)['then'](handleEntityNotFound(_0x2e6d61,null))[_0x3777('0x45')](respondWithResult(_0x2e6d61,null))[_0x3777('0x4a')](handleError(_0x2e6d61,null));};exports['create']=function(_0x64174f,_0x5c88b9){return db[_0x3777('0x2f')]['create'](_0x64174f[_0x3777('0x4b')],{})[_0x3777('0x45')](function(_0x235bb1){var _0x4ab955=_0x64174f[_0x3777('0x4c')][_0x3777('0x29')]({'plain':!![]});if(!_0x4ab955)throw new Error(_0x3777('0x4d'));if(_0x4ab955['role']===_0x3777('0x4c')){var _0x2de815=_0x235bb1[_0x3777('0x29')]({'plain':!![]});var _0x21bcd4=_0x3777('0x4e');return db[_0x3777('0x4f')][_0x3777('0x49')]({'where':{'name':_0x21bcd4,'userProfileId':_0x4ab955[_0x3777('0x50')]},'raw':!![]})[_0x3777('0x45')](function(_0x1bbfae){if(_0x1bbfae&&_0x1bbfae[_0x3777('0x51')]===0x0){return db[_0x3777('0x2a')]['create']({'name':_0x2de815[_0x3777('0x2b')],'resourceId':_0x2de815['id'],'type':_0x1bbfae['name'],'sectionId':_0x1bbfae['id']},{})[_0x3777('0x45')](function(){return _0x235bb1;});}else{return _0x235bb1;}})[_0x3777('0x4a')](function(_0x57e774){logger['error'](_0x3777('0x52'),_0x57e774);throw _0x57e774;});}return _0x235bb1;})[_0x3777('0x45')](respondWithResult(_0x5c88b9,0xc9))[_0x3777('0x4a')](handleError(_0x5c88b9,null));};exports[_0x3777('0x27')]=function(_0x5da048,_0x2e54a6){if(_0x5da048[_0x3777('0x4b')]['id']){delete _0x5da048[_0x3777('0x4b')]['id'];}return db[_0x3777('0x2f')][_0x3777('0x49')]({'where':{'id':_0x5da048[_0x3777('0x47')]['id']}})['then'](handleEntityNotFound(_0x2e54a6,null))[_0x3777('0x45')](saveUpdates(_0x5da048[_0x3777('0x4b')],null))['then'](respondWithResult(_0x2e54a6,null))[_0x3777('0x4a')](handleError(_0x2e54a6,null));};exports[_0x3777('0x28')]=function(_0x5b77a7,_0x19ba23){return db['Interval']['find']({'where':{'id':_0x5b77a7[_0x3777('0x47')]['id']}})['then'](handleEntityNotFound(_0x19ba23,null))[_0x3777('0x45')](removeEntity(_0x19ba23,null))['catch'](handleError(_0x19ba23,null));};exports['addInterval']=function(_0x2f8a9b,_0x5e2ea2,_0x33e8a2){if(_0x2f8a9b['body']['id']){delete _0x2f8a9b[_0x3777('0x4b')]['id'];}return db[_0x3777('0x2f')][_0x3777('0x49')]({'where':{'id':_0x2f8a9b[_0x3777('0x47')]['id']}})[_0x3777('0x45')](handleEntityNotFound(_0x5e2ea2,null))[_0x3777('0x45')](function(_0x5e0996){if(_0x5e0996){_0x2f8a9b[_0x3777('0x4b')][_0x3777('0x53')]=_0x5e0996['id'];return db['Interval'][_0x3777('0x54')](_0x2f8a9b['body']);}})[_0x3777('0x45')](respondWithResult(_0x5e2ea2,null))[_0x3777('0x4a')](handleError(_0x5e2ea2,null));};exports[_0x3777('0x55')]=function(_0x2c9edc,_0x5351a2,_0x582cdb){var _0xae74a5={};var _0x5455b0={};var _0x3fa648;var _0x2d5852;return db[_0x3777('0x2f')][_0x3777('0x56')]({'where':{'id':_0x2c9edc[_0x3777('0x47')]['id']}})[_0x3777('0x45')](handleEntityNotFound(_0x5351a2,null))[_0x3777('0x45')](function(_0x6cbd50){if(_0x6cbd50){_0x3fa648=_0x6cbd50;_0x5455b0['model']=_[_0x3777('0x34')](db[_0x3777('0x2f')][_0x3777('0x30')]);_0x5455b0['query']=_[_0x3777('0x34')](_0x2c9edc['query']);_0x5455b0[_0x3777('0x3e')]=_[_0x3777('0x35')](_0x5455b0[_0x3777('0x37')],_0x5455b0[_0x3777('0x33')]);_0xae74a5[_0x3777('0x36')]=_['intersection'](_0x5455b0[_0x3777('0x37')],qs[_0x3777('0x38')](_0x2c9edc[_0x3777('0x33')]['fields']));_0xae74a5['attributes']=_0xae74a5['attributes'][_0x3777('0x39')]?_0xae74a5[_0x3777('0x36')]:_0x5455b0[_0x3777('0x37')];_0xae74a5[_0x3777('0x3b')]=qs[_0x3777('0x3c')](_0x2c9edc[_0x3777('0x33')][_0x3777('0x3c')]);_0xae74a5[_0x3777('0x3d')]=qs[_0x3777('0x3e')](_[_0x3777('0x3f')](_0x2c9edc[_0x3777('0x33')],_0x5455b0['filters']));if(_0x2c9edc[_0x3777('0x33')]['filter']){_0xae74a5[_0x3777('0x3d')]=_[_0x3777('0x42')](_0xae74a5['where'],{'$or':_[_0x3777('0x2e')](_0xae74a5['attributes'],function(_0x356e8a){var _0x58ed3a={};_0x58ed3a[_0x356e8a]={'$like':'%'+_0x2c9edc['query'][_0x3777('0x40')]+'%'};return _0x58ed3a;})});}_0xae74a5=_[_0x3777('0x42')]({},_0xae74a5,_0x2c9edc[_0x3777('0x43')]);return _0x3fa648[_0x3777('0x55')](_0xae74a5);}})[_0x3777('0x45')](function(_0x63a4cf){if(_0x63a4cf){_0x2d5852=_0x63a4cf[_0x3777('0x39')];if(!_0x2c9edc[_0x3777('0x33')]['hasOwnProperty']('nolimit')){_0xae74a5['limit']=qs['limit'](_0x2c9edc['query']['limit']);_0xae74a5[_0x3777('0x1f')]=qs[_0x3777('0x1f')](_0x2c9edc[_0x3777('0x33')]['offset']);}return _0x3fa648[_0x3777('0x55')](_0xae74a5);}})[_0x3777('0x45')](function(_0x465ba7){if(_0x465ba7){return _0x465ba7?{'count':_0x2d5852,'rows':_0x465ba7}:null;}})['then'](respondWithResult(_0x5351a2,null))[_0x3777('0x4a')](handleError(_0x5351a2,null));};exports[_0x3777('0x57')]=function(_0x20d1d5,_0x3429fc,_0x8f5ada){return db[_0x3777('0x2f')]['findOne']({'where':{'id':_0x20d1d5[_0x3777('0x47')]['id']}})['then'](handleEntityNotFound(_0x3429fc,null))[_0x3777('0x45')](function(_0x2dca7e){if(_0x2dca7e){return db[_0x3777('0x58')][_0x3777('0x59')](function(_0x211c92){return db[_0x3777('0x2f')][_0x3777('0x28')]({'where':{'IntervalId':_0x20d1d5[_0x3777('0x47')]['id']},'transaction':_0x211c92})[_0x3777('0x45')](function(_0x3bc051){var _0x58601e=_[_0x3777('0x2e')](_0x20d1d5['body'],function(_0x2921ef){delete _0x2921ef['id'];_0x2921ef[_0x3777('0x53')]=_0x20d1d5[_0x3777('0x47')]['id'];return _0x2921ef;});return db['Interval'][_0x3777('0x5a')](_0x58601e,{'transaction':_0x211c92});});})['then'](function(){return db[_0x3777('0x2f')]['findAll']({'where':{'IntervalId':_0x20d1d5[_0x3777('0x47')]['id']}});});}})[_0x3777('0x45')](respondWithResult(_0x3429fc,null))[_0x3777('0x4a')](handleError(_0x3429fc,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index ab08422..91c8bc6 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 _0x16e0=['getIntervals','then','all','map','ifTime','reduce','./interval.attributes','../../components/extensions/rewrite','iftime','exports','define','Interval','rewrite','interval','string'];(function(_0x12cbb4,_0x536353){var _0x356a4b=function(_0x407af3){while(--_0x407af3){_0x12cbb4['push'](_0x12cbb4['shift']());}};_0x356a4b(++_0x536353);}(_0x16e0,0xc9));var _0x016e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x16e0[_0x14add3];return _0x4a174f;};'use strict';var attributes=require(_0x016e('0x0'));var extensions=require(_0x016e('0x1'));var iftime=require('../../utils/iftime')[_0x016e('0x2')];module[_0x016e('0x3')]=function(_0x1f7937){return _0x1f7937[_0x016e('0x4')](_0x016e('0x5'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5a3185){extensions[_0x016e('0x6')](_0x1f7937,_0x5a3185);},'afterBulkCreate':function(_0x3367e6,_0xa6b706,_0x11e91a){_0x11e91a();extensions[_0x016e('0x6')](_0x1f7937,_0x3367e6[0x0]);},'afterUpdate':function(_0xbe510a){extensions['rewrite'](_0x1f7937,_0xbe510a);},'afterDestroy':function(_0x19d37a){extensions[_0x016e('0x6')](_0x1f7937,_0x19d37a);}},'instanceMethods':{'ifTime':function(_0x35cbeb=undefined,_0x3e0142=new Date()){if(typeof this[_0x016e('0x7')]===_0x016e('0x8')){return iftime(this[_0x016e('0x7')],_0x35cbeb,_0x3e0142);}else{return this[_0x016e('0x9')]()[_0x016e('0xa')](function(_0x961ffc){return Promise[_0x016e('0xb')](_0x961ffc[_0x016e('0xc')](function(_0x3acbbe){return _0x3acbbe[_0x016e('0xd')](_0x35cbeb,_0x3e0142);}));})[_0x016e('0xa')](function(_0x1b41cd){return _0x1b41cd[_0x016e('0xe')](function(_0x220ee8,_0x1c5b05){return _0x220ee8||_0x1c5b05;},![]);});}}}});}; \ No newline at end of file +var _0x745a=['iftime','exports','tools_intervals','rewrite','interval','string','getIntervals','all','ifTime','then','reduce','./interval.attributes','../../components/extensions/rewrite','../../utils/iftime'];(function(_0x3ef668,_0x12bce9){var _0x6f96d2=function(_0x2f4939){while(--_0x2f4939){_0x3ef668['push'](_0x3ef668['shift']());}};_0x6f96d2(++_0x12bce9);}(_0x745a,0x1e7));var _0xa745=function(_0x4fbfd9,_0x3ab91a){_0x4fbfd9=_0x4fbfd9-0x0;var _0x31dc94=_0x745a[_0x4fbfd9];return _0x31dc94;};'use strict';var attributes=require(_0xa745('0x0'));var extensions=require(_0xa745('0x1'));var iftime=require(_0xa745('0x2'))[_0xa745('0x3')];module[_0xa745('0x4')]=function(_0x74f7c9){return _0x74f7c9['define']('Interval',attributes,{'tableName':_0xa745('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x22d129){extensions['rewrite'](_0x74f7c9,_0x22d129);},'afterBulkCreate':function(_0x39a69b,_0xce37dd,_0x2a53dd){_0x2a53dd();extensions[_0xa745('0x6')](_0x74f7c9,_0x39a69b[0x0]);},'afterUpdate':function(_0x15fd0a){extensions[_0xa745('0x6')](_0x74f7c9,_0x15fd0a);},'afterDestroy':function(_0x29b010){extensions['rewrite'](_0x74f7c9,_0x29b010);}},'instanceMethods':{'ifTime':function(_0x5ef359=undefined,_0x39f736=new Date()){if(typeof this[_0xa745('0x7')]===_0xa745('0x8')){return iftime(this[_0xa745('0x7')],_0x5ef359,_0x39f736);}else{return this[_0xa745('0x9')]()['then'](function(_0x56af12){return Promise[_0xa745('0xa')](_0x56af12['map'](function(_0x18b1fd){return _0x18b1fd[_0xa745('0xb')](_0x5ef359,_0x39f736);}));})[_0xa745('0xc')](function(_0xd4832b){return _0xd4832b[_0xa745('0xd')](function(_0x1ced6c,_0x24f3a0){return _0x1ced6c||_0x24f3a0;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 77f3a6c..1174e66 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 _0x2066=['model','info','stringify','catch','message','error','ShowInterval','find','raw','then','all','ifTime','reduce','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','join','format','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','name','intervalIds','isArray','string','intervals','timezone','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','debug','Iftime','silly','IntervalIftime','resolve','lodash','util','../../mysqldb','../../utils/iftime','iftime','rpc','GetInterval','Interval','findAll','options','where','attributes','limit','include','map'];(function(_0x4459b8,_0x3271b8){var _0x4a4b07=function(_0x3075f8){while(--_0x3075f8){_0x4459b8['push'](_0x4459b8['shift']());}};_0x4a4b07(++_0x3271b8);}(_0x2066,0x18f));var _0x6206=function(_0x3f159f,_0x5bac3d){_0x3f159f=_0x3f159f-0x0;var _0x868f9a=_0x2066[_0x3f159f];return _0x868f9a;};'use strict';var _=require(_0x6206('0x0'));var util=require(_0x6206('0x1'));var db=require(_0x6206('0x2'))['db'];var iftime=require(_0x6206('0x3'))[_0x6206('0x4')];var logger=require('../../config/logger')(_0x6206('0x5'));exports[_0x6206('0x6')]=function(_0x3b5164){var _0x41fbc9=this;return new Promise(function(_0x363cfe,_0x2afc4a){return db[_0x6206('0x7')][_0x6206('0x8')]({'raw':_0x3b5164[_0x6206('0x9')]?_0x3b5164['options']['raw']===undefined?!![]:![]:!![],'where':_0x3b5164['options']?_0x3b5164[_0x6206('0x9')][_0x6206('0xa')]||null:null,'attributes':_0x3b5164['options']?_0x3b5164['options'][_0x6206('0xb')]||null:null,'limit':_0x3b5164[_0x6206('0x9')]?_0x3b5164[_0x6206('0x9')][_0x6206('0xc')]||null:null,'include':_0x3b5164['options']?_0x3b5164['options'][_0x6206('0xd')]?_[_0x6206('0xe')](_0x3b5164['options'][_0x6206('0xd')],function(_0x40446c){return{'model':db[_0x40446c['model']],'as':_0x40446c['as'],'attributes':_0x40446c[_0x6206('0xb')],'include':_0x40446c['include']?_[_0x6206('0xe')](_0x40446c['include'],function(_0x2a008d){return{'model':db[_0x2a008d[_0x6206('0xf')]],'as':_0x2a008d['as'],'attributes':_0x2a008d[_0x6206('0xb')],'include':_0x2a008d[_0x6206('0xd')]?_[_0x6206('0xe')](_0x2a008d[_0x6206('0xd')],function(_0x5be084){return{'model':db[_0x5be084['model']],'as':_0x5be084['as'],'attributes':_0x5be084[_0x6206('0xb')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3d28a7){logger[_0x6206('0x10')]('GetInterval',_0x3b5164);logger['debug'](_0x6206('0x6'),_0x3b5164,JSON[_0x6206('0x11')](_0x3d28a7));_0x363cfe(_0x3d28a7);})[_0x6206('0x12')](function(_0x5aaeea){logger['error'](_0x6206('0x6'),_0x5aaeea[_0x6206('0x13')],_0x3b5164);_0x2afc4a(_0x41fbc9[_0x6206('0x14')](0x1f4,_0x5aaeea['message']));});});};exports[_0x6206('0x15')]=function(_0x38debf){var _0xf22e27=this;return new Promise(function(_0x3a006a,_0x19ff7c){return db['Interval'][_0x6206('0x16')]({'raw':_0x38debf[_0x6206('0x9')]?_0x38debf['options'][_0x6206('0x17')]===undefined?!![]:![]:!![],'where':_0x38debf[_0x6206('0x9')]?_0x38debf[_0x6206('0x9')][_0x6206('0xa')]||null:null,'attributes':_0x38debf[_0x6206('0x9')]?_0x38debf[_0x6206('0x9')][_0x6206('0xb')]||null:null,'include':_0x38debf[_0x6206('0x9')]?_0x38debf[_0x6206('0x9')]['include']?_[_0x6206('0xe')](_0x38debf[_0x6206('0x9')][_0x6206('0xd')],function(_0x5b34e7){return{'model':db[_0x5b34e7[_0x6206('0xf')]],'as':_0x5b34e7['as'],'attributes':_0x5b34e7[_0x6206('0xb')],'include':_0x5b34e7[_0x6206('0xd')]?_['map'](_0x5b34e7[_0x6206('0xd')],function(_0x17718a){return{'model':db[_0x17718a[_0x6206('0xf')]],'as':_0x17718a['as'],'attributes':_0x17718a['attributes'],'include':_0x17718a[_0x6206('0xd')]?_['map'](_0x17718a[_0x6206('0xd')],function(_0x5d2b13){return{'model':db[_0x5d2b13[_0x6206('0xf')]],'as':_0x5d2b13['as'],'attributes':_0x5d2b13[_0x6206('0xb')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x25495a){logger[_0x6206('0x10')]('ShowInterval',_0x38debf);logger['debug'](_0x6206('0x15'),_0x38debf,JSON[_0x6206('0x11')](_0x25495a));_0x3a006a(_0x25495a);})[_0x6206('0x12')](function(_0x26f81b){logger['error']('ShowInterval',_0x26f81b[_0x6206('0x13')],_0x38debf);_0x19ff7c(_0xf22e27[_0x6206('0x14')](0x1f4,_0x26f81b[_0x6206('0x13')]));});});};function checkArrayOfIntervals(_0x4aabf8,_0x517e7a){var _0x4c5284=[];return db[_0x6206('0x7')][_0x6206('0x8')]({'where':{'id':_0x4aabf8}})[_0x6206('0x18')](function(_0x7b7d2){_0x4c5284=_0x7b7d2;return Promise[_0x6206('0x19')](_0x4c5284['map'](function(_0x554ec5){return _0x554ec5[_0x6206('0x1a')](_0x517e7a);}));})[_0x6206('0x18')](function(_0x291d7a){var _0x45fcf9=_0x291d7a[_0x6206('0x1b')](function(_0xe0e822,_0x434a09){return _0xe0e822||_0x434a09;},![]);logger['info'](util['format'](_0x6206('0x1c'),_0x4c5284[_0x6206('0xe')](function(_0x553760){return _0x553760['name'];})[_0x6206('0x1d')](',\x20'),_0x4c5284['map'](function(_0x109dda){return _0x109dda['id'];})[_0x6206('0x1d')](',\x20')));return _0x45fcf9;});}function checkSingleInterval(_0x3ac264,_0x293337){return db[_0x6206('0x7')]['findById'](_0x3ac264)['then'](function(_0x5b9ced){if(_0x5b9ced){logger['info'](util[_0x6206('0x1e')](_0x6206('0x1f'),_0x5b9ced[_0x6206('0x20')],_0x5b9ced['id']));return _0x5b9ced[_0x6206('0x1a')](_0x293337);}});}exports['IntervalIftime']=function(_0x5a1de5){var _0x11b270=_0x5a1de5[_0x6206('0x21')];var _0x2f9146=Array[_0x6206('0x22')](_0x5a1de5['intervals'])?_0x5a1de5['intervals']:typeof _0x5a1de5['intervals']===_0x6206('0x23')?[_0x5a1de5[_0x6206('0x24')]]:[];var _0x1c4e40=_0x5a1de5[_0x6206('0x25')]||undefined;var _0xd6e235=![];if(_0x2f9146[_0x6206('0x26')]){logger[_0x6206('0x10')](util[_0x6206('0x1e')](_0x6206('0x27'),_0x2f9146[_0x6206('0x1d')](';\x20')));}if(_0x1c4e40){logger[_0x6206('0x10')](util[_0x6206('0x1e')](_0x6206('0x28'),_0x1c4e40));}logger[_0x6206('0x29')](_0x6206('0x2a'),_0xd6e235);logger[_0x6206('0x2b')](_0x6206('0x2c'),_0x5a1de5);return Promise[_0x6206('0x2d')]()['then'](function(){if(Array[_0x6206('0x22')](_0x11b270)){return checkArrayOfIntervals(_0x11b270,_0x1c4e40);}else if(_0x11b270){return checkSingleInterval(_0x11b270,_0x1c4e40);}})[_0x6206('0x18')](function(_0xfac412){var _0x1ceb29=_0x2f9146[_0x6206('0x1b')](function(_0x3ea680,_0x2d6336){return _0x3ea680||iftime(_0x2d6336,_0x1c4e40);},![]);_0xd6e235=_0xfac412||_0x1ceb29;return _0xd6e235;})[_0x6206('0x12')](function(_0x252d41){logger['error'](_0x6206('0x2c'),_0x5a1de5,_0x252d41);throw this[_0x6206('0x14')](0x1f4,_0x252d41['message']);});}; \ No newline at end of file +var _0x9354=['resolve','lodash','util','../../mysqldb','rpc','Interval','options','where','attributes','map','include','model','then','info','debug','stringify','catch','error','message','raw','ShowInterval','ifTime','reduce','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','name','findById','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','IntervalIftime','isArray','intervals','string','timezone','join','IntervalIftime:\x20timezone\x20=\x20%s','Iftime'];(function(_0x58bcd0,_0x17d4aa){var _0x1a7310=function(_0x4f7003){while(--_0x4f7003){_0x58bcd0['push'](_0x58bcd0['shift']());}};_0x1a7310(++_0x17d4aa);}(_0x9354,0x145));var _0x4935=function(_0x4186fa,_0x26a01c){_0x4186fa=_0x4186fa-0x0;var _0x136990=_0x9354[_0x4186fa];return _0x136990;};'use strict';var _=require(_0x4935('0x0'));var util=require(_0x4935('0x1'));var db=require(_0x4935('0x2'))['db'];var iftime=require('../../utils/iftime')['iftime'];var logger=require('../../config/logger')(_0x4935('0x3'));exports['GetInterval']=function(_0x1861e6){var _0x3b3a54=this;return new Promise(function(_0xcc4f42,_0x4191a1){return db[_0x4935('0x4')]['findAll']({'raw':_0x1861e6[_0x4935('0x5')]?_0x1861e6[_0x4935('0x5')]['raw']===undefined?!![]:![]:!![],'where':_0x1861e6[_0x4935('0x5')]?_0x1861e6[_0x4935('0x5')][_0x4935('0x6')]||null:null,'attributes':_0x1861e6[_0x4935('0x5')]?_0x1861e6[_0x4935('0x5')][_0x4935('0x7')]||null:null,'limit':_0x1861e6[_0x4935('0x5')]?_0x1861e6[_0x4935('0x5')]['limit']||null:null,'include':_0x1861e6[_0x4935('0x5')]?_0x1861e6[_0x4935('0x5')]['include']?_[_0x4935('0x8')](_0x1861e6[_0x4935('0x5')][_0x4935('0x9')],function(_0x58b6f0){return{'model':db[_0x58b6f0[_0x4935('0xa')]],'as':_0x58b6f0['as'],'attributes':_0x58b6f0[_0x4935('0x7')],'include':_0x58b6f0[_0x4935('0x9')]?_[_0x4935('0x8')](_0x58b6f0[_0x4935('0x9')],function(_0x23e204){return{'model':db[_0x23e204[_0x4935('0xa')]],'as':_0x23e204['as'],'attributes':_0x23e204[_0x4935('0x7')],'include':_0x23e204[_0x4935('0x9')]?_[_0x4935('0x8')](_0x23e204[_0x4935('0x9')],function(_0x406978){return{'model':db[_0x406978[_0x4935('0xa')]],'as':_0x406978['as'],'attributes':_0x406978[_0x4935('0x7')]};}):[]};}):[]};}):[]:[]})[_0x4935('0xb')](function(_0xf9f668){logger[_0x4935('0xc')]('GetInterval',_0x1861e6);logger[_0x4935('0xd')]('GetInterval',_0x1861e6,JSON[_0x4935('0xe')](_0xf9f668));_0xcc4f42(_0xf9f668);})[_0x4935('0xf')](function(_0x381f9e){logger[_0x4935('0x10')]('GetInterval',_0x381f9e[_0x4935('0x11')],_0x1861e6);_0x4191a1(_0x3b3a54[_0x4935('0x10')](0x1f4,_0x381f9e[_0x4935('0x11')]));});});};exports['ShowInterval']=function(_0x4f19a0){var _0x4f3f20=this;return new Promise(function(_0x28c8c3,_0x951c3c){return db[_0x4935('0x4')]['find']({'raw':_0x4f19a0[_0x4935('0x5')]?_0x4f19a0['options'][_0x4935('0x12')]===undefined?!![]:![]:!![],'where':_0x4f19a0['options']?_0x4f19a0[_0x4935('0x5')]['where']||null:null,'attributes':_0x4f19a0[_0x4935('0x5')]?_0x4f19a0[_0x4935('0x5')][_0x4935('0x7')]||null:null,'include':_0x4f19a0[_0x4935('0x5')]?_0x4f19a0[_0x4935('0x5')]['include']?_[_0x4935('0x8')](_0x4f19a0['options'][_0x4935('0x9')],function(_0x274b46){return{'model':db[_0x274b46[_0x4935('0xa')]],'as':_0x274b46['as'],'attributes':_0x274b46['attributes'],'include':_0x274b46[_0x4935('0x9')]?_[_0x4935('0x8')](_0x274b46[_0x4935('0x9')],function(_0x5f4b4c){return{'model':db[_0x5f4b4c[_0x4935('0xa')]],'as':_0x5f4b4c['as'],'attributes':_0x5f4b4c[_0x4935('0x7')],'include':_0x5f4b4c[_0x4935('0x9')]?_['map'](_0x5f4b4c[_0x4935('0x9')],function(_0x2a0e85){return{'model':db[_0x2a0e85['model']],'as':_0x2a0e85['as'],'attributes':_0x2a0e85['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4ed777){logger[_0x4935('0xc')](_0x4935('0x13'),_0x4f19a0);logger[_0x4935('0xd')](_0x4935('0x13'),_0x4f19a0,JSON['stringify'](_0x4ed777));_0x28c8c3(_0x4ed777);})['catch'](function(_0x34ea29){logger[_0x4935('0x10')](_0x4935('0x13'),_0x34ea29[_0x4935('0x11')],_0x4f19a0);_0x951c3c(_0x4f3f20[_0x4935('0x10')](0x1f4,_0x34ea29[_0x4935('0x11')]));});});};function checkArrayOfIntervals(_0x3a04eb,_0x1cb8aa){var _0x57e505=[];return db['Interval']['findAll']({'where':{'id':_0x3a04eb}})[_0x4935('0xb')](function(_0x129d4d){_0x57e505=_0x129d4d;return Promise['all'](_0x57e505[_0x4935('0x8')](function(_0x57956e){return _0x57956e[_0x4935('0x14')](_0x1cb8aa);}));})[_0x4935('0xb')](function(_0x216384){var _0x3a166c=_0x216384[_0x4935('0x15')](function(_0xffc78,_0x459ffa){return _0xffc78||_0x459ffa;},![]);logger['info'](util[_0x4935('0x16')](_0x4935('0x17'),_0x57e505[_0x4935('0x8')](function(_0x399056){return _0x399056[_0x4935('0x18')];})['join'](',\x20'),_0x57e505[_0x4935('0x8')](function(_0xff08d7){return _0xff08d7['id'];})['join'](',\x20')));return _0x3a166c;});}function checkSingleInterval(_0x579baf,_0x16ef02){return db[_0x4935('0x4')][_0x4935('0x19')](_0x579baf)[_0x4935('0xb')](function(_0x9f6471){if(_0x9f6471){logger[_0x4935('0xc')](util[_0x4935('0x16')](_0x4935('0x1a'),_0x9f6471['name'],_0x9f6471['id']));return _0x9f6471['ifTime'](_0x16ef02);}});}exports[_0x4935('0x1b')]=function(_0xe9799f){var _0x3baab0=_0xe9799f['intervalIds'];var _0x386f70=Array[_0x4935('0x1c')](_0xe9799f['intervals'])?_0xe9799f[_0x4935('0x1d')]:typeof _0xe9799f[_0x4935('0x1d')]===_0x4935('0x1e')?[_0xe9799f['intervals']]:[];var _0x19e5c9=_0xe9799f[_0x4935('0x1f')]||undefined;var _0x4f5974=![];if(_0x386f70['length']){logger[_0x4935('0xc')](util[_0x4935('0x16')]('IntervalIftime:\x20interval\x20strings\x20=\x20%s',_0x386f70[_0x4935('0x20')](';\x20')));}if(_0x19e5c9){logger[_0x4935('0xc')](util['format'](_0x4935('0x21'),_0x19e5c9));}logger['debug'](_0x4935('0x22'),_0x4f5974);logger['silly'](_0x4935('0x1b'),_0xe9799f);return Promise[_0x4935('0x23')]()[_0x4935('0xb')](function(){if(Array[_0x4935('0x1c')](_0x3baab0)){return checkArrayOfIntervals(_0x3baab0,_0x19e5c9);}else if(_0x3baab0){return checkSingleInterval(_0x3baab0,_0x19e5c9);}})['then'](function(_0x481982){var _0xb74589=_0x386f70[_0x4935('0x15')](function(_0x3c2468,_0xa53e8f){return _0x3c2468||iftime(_0xa53e8f,_0x19e5c9);},![]);_0x4f5974=_0x481982||_0xb74589;return _0x4f5974;})[_0x4935('0xf')](function(_0x1e0294){logger[_0x4935('0x10')](_0x4935('0x1b'),_0xe9799f,_0x1e0294);throw this['error'](0x1f4,_0x1e0294[_0x4935('0x11')]);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 2226a0a..b5b42c6 100644 --- a/server/api/jira/index.js +++ b/server/api/jira/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller'];(function(_0xcecb71,_0x3a0fb6){var _0x1f05fc=function(_0x5da916){while(--_0x5da916){_0xcecb71['push'](_0xcecb71['shift']());}};_0x1f05fc(++_0x3a0fb6);}(_0xdb28,0x106));var _0x8db2=function(_0x3ca248,_0x3f7d42){_0x3ca248=_0x3ca248-0x0;var _0x2daf67=_0xdb28[_0x3ca248];return _0x2daf67;};'use strict';var express=require(_0x8db2('0x0'));var router=express[_0x8db2('0x1')]();var auth=require(_0x8db2('0x2'));var controller=require(_0x8db2('0x3'));router['post']('/',auth[_0x8db2('0x4')](),controller[_0x8db2('0x5')]);module[_0x8db2('0x6')]=router; \ No newline at end of file +var _0x2032=['isAuthenticated','send','Router','../../components/auth/service','./jira.controller'];(function(_0x41ae3e,_0x1db9ef){var _0x3f1ae8=function(_0x531398){while(--_0x531398){_0x41ae3e['push'](_0x41ae3e['shift']());}};_0x3f1ae8(++_0x1db9ef);}(_0x2032,0xd9));var _0x2203=function(_0x102f22,_0x4f0a97){_0x102f22=_0x102f22-0x0;var _0x2eb493=_0x2032[_0x102f22];return _0x2eb493;};'use strict';var express=require('express');var router=express[_0x2203('0x0')]();var auth=require(_0x2203('0x1'));var controller=require(_0x2203('0x2'));router['post']('/',auth[_0x2203('0x3')](),controller[_0x2203('0x4')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index e387a16..1605179 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 _0xfca2=['error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','body','headers','x-forwarded-for','connection','remoteAddress','socket','https','api','support','key','MOTGUI','summary','\x20from\x20','description','stringify','issuetype','Bug','customfield_11500','email','fields','customfield_11501','customfield_11502','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64','request','setEncoding','utf8','data','end','status','statusCode','json','parse'];(function(_0x84e165,_0x2b4cb4){var _0x2b9145=function(_0x27adc2){while(--_0x27adc2){_0x84e165['push'](_0x84e165['shift']());}};_0x2b9145(++_0x2b4cb4);}(_0xfca2,0x6e));var _0x2fca=function(_0x504f7b,_0x1ac4e0){_0x504f7b=_0x504f7b-0x0;var _0x2b0904=_0xfca2[_0x504f7b];return _0x2b0904;};'use strict';var BPromise=require('bluebird');var https=require(_0x2fca('0x0'));var logger=require('../../config/logger')(_0x2fca('0x1'));var USERNAME=_0x2fca('0x2');var PASSWORD='3eAmWpBVP0';function openIssue(_0x42dded,_0x185aa3){var _0x2fdaff={'fields':{'project':{'key':_0x42dded[_0x2fca('0x3')]||_0x2fca('0x4')},'summary':(_0x42dded[_0x2fca('0x5')]||'Report')+_0x2fca('0x6')+_0x42dded['ip'],'description':_0x42dded[_0x2fca('0x7')]||JSON[_0x2fca('0x8')](_0x42dded),'issuetype':{'name':_0x42dded[_0x2fca('0x9')]||_0x2fca('0xa')}}};_0x2fdaff['fields'][_0x2fca('0xb')]=_0x42dded[_0x2fca('0xc')];_0x2fdaff[_0x2fca('0xd')][_0x2fca('0xe')]=_0x42dded['oldToken'];_0x2fdaff['fields'][_0x2fca('0xf')]=_0x42dded['newToken'];_0x2fdaff[_0x2fca('0xd')][_0x2fca('0x10')]=_0x42dded[_0x2fca('0x11')];_0x2fdaff[_0x2fca('0xd')][_0x2fca('0x12')]=_0x42dded[_0x2fca('0x13')];_0x2fdaff['fields'][_0x2fca('0x14')]=_0x42dded['ip'];var _0x425d3c={'host':_0x2fca('0x15'),'port':0x1bb,'path':_0x2fca('0x16'),'method':_0x2fca('0x17'),'timeout':0x4e20,'headers':{'Content-Type':_0x2fca('0x18'),'Authorization':_0x2fca('0x19')+new Buffer(USERNAME+':'+PASSWORD)[_0x2fca('0x1a')](_0x2fca('0x1b'))}};var _0x3c40ec=JSON[_0x2fca('0x8')](_0x2fdaff);var _0x3822a8=https[_0x2fca('0x1c')](_0x425d3c,function(_0x1b16d6){_0x1b16d6[_0x2fca('0x1d')](_0x2fca('0x1e'));var _0x4b67dc='';_0x1b16d6['on'](_0x2fca('0x1f'),function(_0x586221){_0x4b67dc+=_0x586221;});_0x1b16d6['on'](_0x2fca('0x20'),function(){if(_0x185aa3){return _0x185aa3[_0x2fca('0x21')](_0x1b16d6[_0x2fca('0x22')])[_0x2fca('0x23')](JSON[_0x2fca('0x24')](_0x4b67dc));}});});_0x3822a8['on'](_0x2fca('0x25'),function(_0x535a7f){if(_0x185aa3){return _0x185aa3[_0x2fca('0x21')](0x1f4)[_0x2fca('0x23')]({'errors':[{'message':_0x2fca('0x26'),'type':_0x2fca('0x27')}]});}});_0x3822a8[_0x2fca('0x28')](_0x3c40ec);_0x3822a8[_0x2fca('0x20')]();}exports[_0x2fca('0x29')]=openIssue;exports[_0x2fca('0x2a')]=function(_0x519570,_0x37f271){_0x519570[_0x2fca('0x2b')]['ip']=_0x519570[_0x2fca('0x2c')][_0x2fca('0x2d')]||_0x519570[_0x2fca('0x2e')][_0x2fca('0x2f')]||_0x519570[_0x2fca('0x30')][_0x2fca('0x2f')]||_0x519570[_0x2fca('0x2e')][_0x2fca('0x30')][_0x2fca('0x2f')];return openIssue(_0x519570[_0x2fca('0x2b')],_0x37f271);}; \ No newline at end of file +var _0xd7db=['application/json','toString','base64','request','setEncoding','utf8','end','statusCode','error','status','json','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','body','headers','remoteAddress','socket','connection','https','../../config/logger','api','key','summary','Report','\x20from\x20','description','stringify','Bug','fields','customfield_11500','oldToken','newToken','customfield_11503','name','customfield_10102','track.xcallymotion.com','POST'];(function(_0x148451,_0x29c9d8){var _0xefb897=function(_0x5d3ab2){while(--_0x5d3ab2){_0x148451['push'](_0x148451['shift']());}};_0xefb897(++_0x29c9d8);}(_0xd7db,0xb5));var _0xbd7d=function(_0xf51020,_0x59619e){_0xf51020=_0xf51020-0x0;var _0x276d37=_0xd7db[_0xf51020];return _0x276d37;};'use strict';var BPromise=require('bluebird');var https=require(_0xbd7d('0x0'));var logger=require(_0xbd7d('0x1'))(_0xbd7d('0x2'));var USERNAME='support';var PASSWORD='3eAmWpBVP0';function openIssue(_0x1d5d51,_0x591ed4){var _0x507163={'fields':{'project':{'key':_0x1d5d51[_0xbd7d('0x3')]||'MOTGUI'},'summary':(_0x1d5d51[_0xbd7d('0x4')]||_0xbd7d('0x5'))+_0xbd7d('0x6')+_0x1d5d51['ip'],'description':_0x1d5d51[_0xbd7d('0x7')]||JSON[_0xbd7d('0x8')](_0x1d5d51),'issuetype':{'name':_0x1d5d51['issuetype']||_0xbd7d('0x9')}}};_0x507163[_0xbd7d('0xa')][_0xbd7d('0xb')]=_0x1d5d51['email'];_0x507163['fields']['customfield_11501']=_0x1d5d51[_0xbd7d('0xc')];_0x507163[_0xbd7d('0xa')]['customfield_11502']=_0x1d5d51[_0xbd7d('0xd')];_0x507163['fields'][_0xbd7d('0xe')]=_0x1d5d51[_0xbd7d('0xf')];_0x507163[_0xbd7d('0xa')]['customfield_11504']=_0x1d5d51['reason'];_0x507163[_0xbd7d('0xa')][_0xbd7d('0x10')]=_0x1d5d51['ip'];var _0x11c41a={'host':_0xbd7d('0x11'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0xbd7d('0x12'),'timeout':0x4e20,'headers':{'Content-Type':_0xbd7d('0x13'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0xbd7d('0x14')](_0xbd7d('0x15'))}};var _0x5e8cd7=JSON[_0xbd7d('0x8')](_0x507163);var _0x5d487f=https[_0xbd7d('0x16')](_0x11c41a,function(_0x4bae31){_0x4bae31[_0xbd7d('0x17')](_0xbd7d('0x18'));var _0x2955ab='';_0x4bae31['on']('data',function(_0x1fd9c3){_0x2955ab+=_0x1fd9c3;});_0x4bae31['on'](_0xbd7d('0x19'),function(){if(_0x591ed4){return _0x591ed4['status'](_0x4bae31[_0xbd7d('0x1a')])['json'](JSON['parse'](_0x2955ab));}});});_0x5d487f['on'](_0xbd7d('0x1b'),function(_0x17de2b){if(_0x591ed4){return _0x591ed4[_0xbd7d('0x1c')](0x1f4)[_0xbd7d('0x1d')]({'errors':[{'message':_0xbd7d('0x1e'),'type':_0xbd7d('0x1f')}]});}});_0x5d487f[_0xbd7d('0x20')](_0x5e8cd7);_0x5d487f[_0xbd7d('0x19')]();}exports[_0xbd7d('0x21')]=openIssue;exports[_0xbd7d('0x22')]=function(_0x396a8c,_0x52e6f4){_0x396a8c[_0xbd7d('0x23')]['ip']=_0x396a8c[_0xbd7d('0x24')]['x-forwarded-for']||_0x396a8c['connection'][_0xbd7d('0x25')]||_0x396a8c[_0xbd7d('0x26')][_0xbd7d('0x25')]||_0x396a8c[_0xbd7d('0x27')][_0xbd7d('0x26')][_0xbd7d('0x25')];return openIssue(_0x396a8c['body'],_0x52e6f4);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 16be85f..61d36ab 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 _0xb4e6=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','get','isAuthenticated','describe','show','post','create','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0xa053e4,_0x5f4840){var _0x34a4d9=function(_0x10fde2){while(--_0x10fde2){_0xa053e4['push'](_0xa053e4['shift']());}};_0x34a4d9(++_0x5f4840);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xb4e6[_0x1035c1];return _0x308d67;};'use strict';var multer=require(_0x6b4e('0x0'));var util=require('util');var path=require(_0x6b4e('0x1'));var timeout=require(_0x6b4e('0x2'));var express=require(_0x6b4e('0x3'));var router=express[_0x6b4e('0x4')]();var fs_extra=require(_0x6b4e('0x5'));var auth=require(_0x6b4e('0x6'));var interaction=require(_0x6b4e('0x7'));var config=require('../../config/environment');var controller=require(_0x6b4e('0x8'));router[_0x6b4e('0x9')]('/',auth[_0x6b4e('0xa')](),controller['index']);router[_0x6b4e('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x6b4e('0xb')]);router['get']('/:id',auth[_0x6b4e('0xa')](),controller[_0x6b4e('0xc')]);router[_0x6b4e('0xd')]('/',auth[_0x6b4e('0xa')](),controller[_0x6b4e('0xe')]);router[_0x6b4e('0xf')](_0x6b4e('0x10'),auth['isAuthenticated'](),controller[_0x6b4e('0x11')]);router[_0x6b4e('0x12')]('/:id',auth[_0x6b4e('0xa')](),controller[_0x6b4e('0x13')]);module[_0x6b4e('0x14')]=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(_0x2db12b,_0x30ab1d){var _0x20990b=function(_0x589477){while(--_0x589477){_0x2db12b['push'](_0x2db12b['shift']());}};_0x20990b(++_0x30ab1d);}(_0xda55,0x6d));var _0x5da5=function(_0x346df7,_0x3404ad){_0x346df7=_0x346df7-0x0;var _0x504fd8=_0xda55[_0x346df7];return _0x504fd8;};'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 4cb02fe..7691f0d 100644 --- a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js +++ b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x7a54,0x106));var _0x47a5=function(_0x44b7be,_0x5e47a3){_0x44b7be=_0x44b7be-0x0;var _0x2adb21=_0x7a54[_0x44b7be];return _0x2adb21;};'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(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x7a54,0x106));var _0x47a5=function(_0x579f36,_0x14f14c){_0x579f36=_0x579f36-0x0;var _0x5debeb=_0x7a54[_0x579f36];return _0x5debeb;};'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 5e0c38c..bc38413 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 _0xe181=['keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','findAll','rows','catch','show','params','fields','options','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','map','query'];(function(_0x1e9483,_0x1a4949){var _0x4b7e09=function(_0x3aa731){while(--_0x3aa731){_0x1e9483['push'](_0x1e9483['shift']());}};_0x4b7e09(++_0x1a4949);}(_0xe181,0x68));var _0x1e18=function(_0x26bec8,_0x2cca48){_0x26bec8=_0x26bec8-0x0;var _0x4a5d80=_0xe181[_0x26bec8];return _0x4a5d80;};'use strict';var emlformat=require(_0x1e18('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1e18('0x1'));var jsonpatch=require(_0x1e18('0x2'));var rp=require(_0x1e18('0x3'));var moment=require(_0x1e18('0x4'));var BPromise=require(_0x1e18('0x5'));var Mustache=require(_0x1e18('0x6'));var util=require(_0x1e18('0x7'));var path=require('path');var sox=require(_0x1e18('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1e18('0x9'));var _=require(_0x1e18('0xa'));var squel=require(_0x1e18('0xb'));var crypto=require(_0x1e18('0xc'));var jsforce=require(_0x1e18('0xd'));var deskjs=require(_0x1e18('0xe'));var toCsv=require('to-csv');var querystring=require(_0x1e18('0xf'));var Papa=require(_0x1e18('0x10'));var Redis=require(_0x1e18('0x11'));var authService=require(_0x1e18('0x12'));var qs=require(_0x1e18('0x13'));var as=require(_0x1e18('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1e18('0x15'))(_0x1e18('0x16'));var utils=require(_0x1e18('0x17'));var config=require(_0x1e18('0x18'));var licenseUtil=require(_0x1e18('0x19'));var db=require(_0x1e18('0x1a'))['db'];function respondWithStatusCode(_0x1743c3,_0x33a98d){_0x33a98d=_0x33a98d||0xcc;return function(_0x531e1b){if(_0x531e1b){return _0x1743c3[_0x1e18('0x1b')](_0x33a98d);}return _0x1743c3['status'](_0x33a98d)[_0x1e18('0x1c')]();};}function respondWithResult(_0x563eff,_0x404b7f){_0x404b7f=_0x404b7f||0xc8;return function(_0x36b583){if(_0x36b583){return _0x563eff[_0x1e18('0x1d')](_0x404b7f)[_0x1e18('0x1e')](_0x36b583);}};}function respondWithFilteredResult(_0x1687ba,_0x1e1ce6){return function(_0x39bc56){if(_0x39bc56){var _0x33fea1=typeof _0x1e1ce6[_0x1e18('0x1f')]===_0x1e18('0x20')&&typeof _0x1e1ce6[_0x1e18('0x21')]===_0x1e18('0x20');var _0x349f3c=_0x39bc56[_0x1e18('0x22')];var _0x21b851=_0x33fea1?0x0:_0x1e1ce6['offset'];var _0x1c91d2=_0x33fea1?_0x39bc56[_0x1e18('0x22')]:_0x1e1ce6[_0x1e18('0x1f')]+_0x1e1ce6[_0x1e18('0x21')];var _0x2834ee;if(_0x1c91d2>=_0x349f3c){_0x1c91d2=_0x349f3c;_0x2834ee=0xc8;}else{_0x2834ee=0xce;}_0x1687ba[_0x1e18('0x1d')](_0x2834ee);return _0x1687ba[_0x1e18('0x23')](_0x1e18('0x24'),_0x21b851+'-'+_0x1c91d2+'/'+_0x349f3c)[_0x1e18('0x1e')](_0x39bc56);}return null;};}function patchUpdates(_0x22baca){return function(_0x2489c3){try{jsonpatch[_0x1e18('0x25')](_0x2489c3,_0x22baca,!![]);}catch(_0x3c4fdf){return BPromise[_0x1e18('0x26')](_0x3c4fdf);}return _0x2489c3[_0x1e18('0x27')]();};}function saveUpdates(_0x975df0,_0x3fd0a7){return function(_0x5eb6b4){if(_0x5eb6b4){return _0x5eb6b4[_0x1e18('0x28')](_0x975df0)[_0x1e18('0x29')](function(_0x3e9b2c){return _0x3e9b2c;});}return null;};}function removeEntity(_0x52d5e2,_0xf74622){return function(_0xdda2ce){if(_0xdda2ce){return _0xdda2ce[_0x1e18('0x2a')]()[_0x1e18('0x29')](function(){_0x52d5e2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x6fa4db,_0x53f9d7){return function(_0x5bb03c){if(!_0x5bb03c){_0x6fa4db['sendStatus'](0x194);}return _0x5bb03c;};}function handleError(_0x32a196,_0x29cac0){_0x29cac0=_0x29cac0||0x1f4;return function(_0x41b67d){logger[_0x1e18('0x2b')](_0x41b67d[_0x1e18('0x2c')]);if(_0x41b67d[_0x1e18('0x2d')]){delete _0x41b67d[_0x1e18('0x2d')];}_0x32a196[_0x1e18('0x1d')](_0x29cac0)[_0x1e18('0x2e')](_0x41b67d);};}exports[_0x1e18('0x2f')]=function(_0x1015a3,_0x42c638){var _0x40d0af={},_0x1be225={},_0x558d01={'count':0x0,'rows':[]};var _0x57000b=_['map'](db[_0x1e18('0x30')][_0x1e18('0x31')],function(_0x1f75cd){return{'name':_0x1f75cd[_0x1e18('0x32')],'type':_0x1f75cd[_0x1e18('0x33')][_0x1e18('0x34')]};});_0x1be225[_0x1e18('0x35')]=_[_0x1e18('0x36')](_0x57000b,'name');_0x1be225[_0x1e18('0x37')]=_[_0x1e18('0x38')](_0x1015a3['query']);_0x1be225[_0x1e18('0x39')]=_[_0x1e18('0x3a')](_0x1be225[_0x1e18('0x35')],_0x1be225['query']);_0x40d0af[_0x1e18('0x3b')]=_['intersection'](_0x1be225['model'],qs['fields'](_0x1015a3[_0x1e18('0x37')]['fields']));_0x40d0af[_0x1e18('0x3b')]=_0x40d0af[_0x1e18('0x3b')][_0x1e18('0x3c')]?_0x40d0af['attributes']:_0x1be225['model'];if(!_0x1015a3[_0x1e18('0x37')][_0x1e18('0x3d')](_0x1e18('0x3e'))){_0x40d0af[_0x1e18('0x21')]=qs[_0x1e18('0x21')](_0x1015a3[_0x1e18('0x37')][_0x1e18('0x21')]);_0x40d0af[_0x1e18('0x1f')]=qs[_0x1e18('0x1f')](_0x1015a3[_0x1e18('0x37')][_0x1e18('0x1f')]);}_0x40d0af[_0x1e18('0x3f')]=qs['sort'](_0x1015a3['query'][_0x1e18('0x40')]);_0x40d0af[_0x1e18('0x41')]=qs[_0x1e18('0x39')](_['pick'](_0x1015a3[_0x1e18('0x37')],_0x1be225['filters']),_0x57000b);if(_0x1015a3[_0x1e18('0x37')]['filter']){_0x40d0af['where']=_[_0x1e18('0x42')](_0x40d0af[_0x1e18('0x41')],{'$or':_[_0x1e18('0x36')](_0x57000b,function(_0x206b44){if(_0x206b44[_0x1e18('0x33')]!==_0x1e18('0x43')){var _0x4e2ca3={};_0x4e2ca3[_0x206b44[_0x1e18('0x2d')]]={'$like':'%'+_0x1015a3[_0x1e18('0x37')][_0x1e18('0x44')]+'%'};return _0x4e2ca3;}})});}_0x40d0af=_[_0x1e18('0x42')]({},_0x40d0af,_0x1015a3['options']);var _0x11f839={'where':_0x40d0af['where']};return db[_0x1e18('0x30')][_0x1e18('0x22')](_0x11f839)['then'](function(_0x41c2bd){_0x558d01[_0x1e18('0x22')]=_0x41c2bd;if(_0x1015a3['query']['includeAll']){_0x40d0af['include']=[{'all':!![]}];}return db[_0x1e18('0x30')][_0x1e18('0x45')](_0x40d0af);})[_0x1e18('0x29')](function(_0x602a85){_0x558d01[_0x1e18('0x46')]=_0x602a85;return _0x558d01;})[_0x1e18('0x29')](respondWithFilteredResult(_0x42c638,_0x40d0af))[_0x1e18('0x47')](handleError(_0x42c638,null));};exports[_0x1e18('0x48')]=function(_0x1cae7e,_0x354832){var _0x16ee40={'raw':!![],'where':{'id':_0x1cae7e[_0x1e18('0x49')]['id']}},_0x4821f9={};_0x4821f9['model']=_[_0x1e18('0x38')](db[_0x1e18('0x30')]['rawAttributes']);_0x4821f9['query']=_['keys'](_0x1cae7e[_0x1e18('0x37')]);_0x4821f9[_0x1e18('0x39')]=_['intersection'](_0x4821f9[_0x1e18('0x35')],_0x4821f9[_0x1e18('0x37')]);_0x16ee40['attributes']=_['intersection'](_0x4821f9[_0x1e18('0x35')],qs[_0x1e18('0x4a')](_0x1cae7e[_0x1e18('0x37')][_0x1e18('0x4a')]));_0x16ee40[_0x1e18('0x3b')]=_0x16ee40[_0x1e18('0x3b')][_0x1e18('0x3c')]?_0x16ee40[_0x1e18('0x3b')]:_0x4821f9[_0x1e18('0x35')];if(_0x1cae7e[_0x1e18('0x37')]['includeAll']){_0x16ee40['include']=[{'all':!![]}];}_0x16ee40=_[_0x1e18('0x42')]({},_0x16ee40,_0x1cae7e[_0x1e18('0x4b')]);return db[_0x1e18('0x30')][_0x1e18('0x4c')](_0x16ee40)[_0x1e18('0x29')](handleEntityNotFound(_0x354832,null))[_0x1e18('0x29')](respondWithResult(_0x354832,null))[_0x1e18('0x47')](handleError(_0x354832,null));};exports['create']=function(_0x54f69b,_0x54cd71){return db[_0x1e18('0x30')][_0x1e18('0x4d')](_0x54f69b[_0x1e18('0x4e')],{})[_0x1e18('0x29')](respondWithResult(_0x54cd71,0xc9))[_0x1e18('0x47')](handleError(_0x54cd71,null));};exports[_0x1e18('0x28')]=function(_0x191c18,_0x190af4){if(_0x191c18[_0x1e18('0x4e')]['id']){delete _0x191c18[_0x1e18('0x4e')]['id'];}return db[_0x1e18('0x30')][_0x1e18('0x4c')]({'where':{'id':_0x191c18[_0x1e18('0x49')]['id']}})[_0x1e18('0x29')](handleEntityNotFound(_0x190af4,null))[_0x1e18('0x29')](saveUpdates(_0x191c18[_0x1e18('0x4e')],null))[_0x1e18('0x29')](respondWithResult(_0x190af4,null))[_0x1e18('0x47')](handleError(_0x190af4,null));};exports[_0x1e18('0x2a')]=function(_0x11d573,_0x5d4cbb){return db[_0x1e18('0x30')][_0x1e18('0x4c')]({'where':{'id':_0x11d573[_0x1e18('0x49')]['id']}})[_0x1e18('0x29')](handleEntityNotFound(_0x5d4cbb,null))[_0x1e18('0x29')](removeEntity(_0x5d4cbb,null))['catch'](handleError(_0x5d4cbb,null));};exports['describe']=function(_0x16b51a,_0x30dc06){return db['JscriptyAnswerReport'][_0x1e18('0x4f')]()[_0x1e18('0x29')](respondWithResult(_0x30dc06,null))[_0x1e18('0x47')](handleError(_0x30dc06,null));}; \ No newline at end of file +var _0x6dac=['then','destroy','error','send','index','rawAttributes','fieldName','type','key','map','name','query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','VIRTUAL','merge','options','JscriptyAnswerReport','includeAll','include','findAll','catch','show','intersection','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update'];(function(_0x473d25,_0x2a970f){var _0x5518a8=function(_0x294795){while(--_0x294795){_0x473d25['push'](_0x473d25['shift']());}};_0x5518a8(++_0x2a970f);}(_0x6dac,0x16e));var _0xc6da=function(_0x16ec0c,_0x445c75){_0x16ec0c=_0x16ec0c-0x0;var _0x3208b5=_0x6dac[_0x16ec0c];return _0x3208b5;};'use strict';var emlformat=require(_0xc6da('0x0'));var rimraf=require(_0xc6da('0x1'));var zipdir=require(_0xc6da('0x2'));var jsonpatch=require(_0xc6da('0x3'));var rp=require(_0xc6da('0x4'));var moment=require(_0xc6da('0x5'));var BPromise=require(_0xc6da('0x6'));var Mustache=require(_0xc6da('0x7'));var util=require(_0xc6da('0x8'));var path=require(_0xc6da('0x9'));var sox=require(_0xc6da('0xa'));var csv=require(_0xc6da('0xb'));var ejs=require(_0xc6da('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc6da('0xd'));var squel=require(_0xc6da('0xe'));var crypto=require(_0xc6da('0xf'));var jsforce=require(_0xc6da('0x10'));var deskjs=require(_0xc6da('0x11'));var toCsv=require(_0xc6da('0xb'));var querystring=require(_0xc6da('0x12'));var Papa=require(_0xc6da('0x13'));var Redis=require(_0xc6da('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xc6da('0x15'));var as=require(_0xc6da('0x16'));var hardwareService=require(_0xc6da('0x17'));var logger=require(_0xc6da('0x18'))(_0xc6da('0x19'));var utils=require(_0xc6da('0x1a'));var config=require(_0xc6da('0x1b'));var licenseUtil=require(_0xc6da('0x1c'));var db=require(_0xc6da('0x1d'))['db'];function respondWithStatusCode(_0x22d0e3,_0x3b8656){_0x3b8656=_0x3b8656||0xcc;return function(_0x3a3b39){if(_0x3a3b39){return _0x22d0e3[_0xc6da('0x1e')](_0x3b8656);}return _0x22d0e3['status'](_0x3b8656)[_0xc6da('0x1f')]();};}function respondWithResult(_0x18e521,_0x13d9df){_0x13d9df=_0x13d9df||0xc8;return function(_0x344b09){if(_0x344b09){return _0x18e521[_0xc6da('0x20')](_0x13d9df)[_0xc6da('0x21')](_0x344b09);}};}function respondWithFilteredResult(_0x4fa18b,_0x43e6b3){return function(_0x37767a){if(_0x37767a){var _0x287468=typeof _0x43e6b3[_0xc6da('0x22')]===_0xc6da('0x23')&&typeof _0x43e6b3['limit']===_0xc6da('0x23');var _0x4cf6c4=_0x37767a[_0xc6da('0x24')];var _0x2a63cc=_0x287468?0x0:_0x43e6b3[_0xc6da('0x22')];var _0x25737d=_0x287468?_0x37767a['count']:_0x43e6b3[_0xc6da('0x22')]+_0x43e6b3[_0xc6da('0x25')];var _0x40c346;if(_0x25737d>=_0x4cf6c4){_0x25737d=_0x4cf6c4;_0x40c346=0xc8;}else{_0x40c346=0xce;}_0x4fa18b[_0xc6da('0x20')](_0x40c346);return _0x4fa18b[_0xc6da('0x26')](_0xc6da('0x27'),_0x2a63cc+'-'+_0x25737d+'/'+_0x4cf6c4)[_0xc6da('0x21')](_0x37767a);}return null;};}function patchUpdates(_0x36ac99){return function(_0xe00c70){try{jsonpatch[_0xc6da('0x28')](_0xe00c70,_0x36ac99,!![]);}catch(_0x4deb23){return BPromise[_0xc6da('0x29')](_0x4deb23);}return _0xe00c70[_0xc6da('0x2a')]();};}function saveUpdates(_0x3c7483,_0x94bee1){return function(_0x5f070b){if(_0x5f070b){return _0x5f070b[_0xc6da('0x2b')](_0x3c7483)[_0xc6da('0x2c')](function(_0x5ddab9){return _0x5ddab9;});}return null;};}function removeEntity(_0x2a2ef9,_0x3b180c){return function(_0x1003a3){if(_0x1003a3){return _0x1003a3[_0xc6da('0x2d')]()['then'](function(){_0x2a2ef9[_0xc6da('0x20')](0xcc)[_0xc6da('0x1f')]();});}};}function handleEntityNotFound(_0x55c059,_0x67ebf9){return function(_0x89b637){if(!_0x89b637){_0x55c059[_0xc6da('0x1e')](0x194);}return _0x89b637;};}function handleError(_0x57c198,_0x4d232d){_0x4d232d=_0x4d232d||0x1f4;return function(_0x1ded21){logger[_0xc6da('0x2e')](_0x1ded21['stack']);if(_0x1ded21['name']){delete _0x1ded21['name'];}_0x57c198['status'](_0x4d232d)[_0xc6da('0x2f')](_0x1ded21);};}exports[_0xc6da('0x30')]=function(_0x33eba0,_0x579dab){var _0x32b83={},_0xda1aef={},_0x13cb9e={'count':0x0,'rows':[]};var _0x890254=_['map'](db['JscriptyAnswerReport'][_0xc6da('0x31')],function(_0x572204){return{'name':_0x572204[_0xc6da('0x32')],'type':_0x572204[_0xc6da('0x33')][_0xc6da('0x34')]};});_0xda1aef['model']=_[_0xc6da('0x35')](_0x890254,_0xc6da('0x36'));_0xda1aef[_0xc6da('0x37')]=_[_0xc6da('0x38')](_0x33eba0[_0xc6da('0x37')]);_0xda1aef[_0xc6da('0x39')]=_['intersection'](_0xda1aef[_0xc6da('0x3a')],_0xda1aef[_0xc6da('0x37')]);_0x32b83[_0xc6da('0x3b')]=_['intersection'](_0xda1aef['model'],qs[_0xc6da('0x3c')](_0x33eba0[_0xc6da('0x37')][_0xc6da('0x3c')]));_0x32b83[_0xc6da('0x3b')]=_0x32b83[_0xc6da('0x3b')][_0xc6da('0x3d')]?_0x32b83[_0xc6da('0x3b')]:_0xda1aef[_0xc6da('0x3a')];if(!_0x33eba0[_0xc6da('0x37')][_0xc6da('0x3e')](_0xc6da('0x3f'))){_0x32b83[_0xc6da('0x25')]=qs[_0xc6da('0x25')](_0x33eba0['query'][_0xc6da('0x25')]);_0x32b83['offset']=qs[_0xc6da('0x22')](_0x33eba0[_0xc6da('0x37')][_0xc6da('0x22')]);}_0x32b83['order']=qs[_0xc6da('0x40')](_0x33eba0[_0xc6da('0x37')][_0xc6da('0x40')]);_0x32b83['where']=qs[_0xc6da('0x39')](_['pick'](_0x33eba0[_0xc6da('0x37')],_0xda1aef['filters']),_0x890254);if(_0x33eba0[_0xc6da('0x37')][_0xc6da('0x41')]){_0x32b83[_0xc6da('0x42')]=_['merge'](_0x32b83['where'],{'$or':_[_0xc6da('0x35')](_0x890254,function(_0x56b071){if(_0x56b071['type']!==_0xc6da('0x43')){var _0x16b440={};_0x16b440[_0x56b071[_0xc6da('0x36')]]={'$like':'%'+_0x33eba0[_0xc6da('0x37')][_0xc6da('0x41')]+'%'};return _0x16b440;}})});}_0x32b83=_[_0xc6da('0x44')]({},_0x32b83,_0x33eba0[_0xc6da('0x45')]);var _0x3368c9={'where':_0x32b83['where']};return db[_0xc6da('0x46')][_0xc6da('0x24')](_0x3368c9)[_0xc6da('0x2c')](function(_0x4fd663){_0x13cb9e[_0xc6da('0x24')]=_0x4fd663;if(_0x33eba0[_0xc6da('0x37')][_0xc6da('0x47')]){_0x32b83[_0xc6da('0x48')]=[{'all':!![]}];}return db[_0xc6da('0x46')][_0xc6da('0x49')](_0x32b83);})[_0xc6da('0x2c')](function(_0xb5e11e){_0x13cb9e['rows']=_0xb5e11e;return _0x13cb9e;})[_0xc6da('0x2c')](respondWithFilteredResult(_0x579dab,_0x32b83))[_0xc6da('0x4a')](handleError(_0x579dab,null));};exports[_0xc6da('0x4b')]=function(_0x34e19a,_0x4f3374){var _0x4e00fc={'raw':!![],'where':{'id':_0x34e19a['params']['id']}},_0xd20888={};_0xd20888['model']=_[_0xc6da('0x38')](db[_0xc6da('0x46')][_0xc6da('0x31')]);_0xd20888[_0xc6da('0x37')]=_[_0xc6da('0x38')](_0x34e19a[_0xc6da('0x37')]);_0xd20888['filters']=_[_0xc6da('0x4c')](_0xd20888['model'],_0xd20888[_0xc6da('0x37')]);_0x4e00fc['attributes']=_[_0xc6da('0x4c')](_0xd20888[_0xc6da('0x3a')],qs[_0xc6da('0x3c')](_0x34e19a[_0xc6da('0x37')][_0xc6da('0x3c')]));_0x4e00fc[_0xc6da('0x3b')]=_0x4e00fc[_0xc6da('0x3b')][_0xc6da('0x3d')]?_0x4e00fc['attributes']:_0xd20888[_0xc6da('0x3a')];if(_0x34e19a[_0xc6da('0x37')]['includeAll']){_0x4e00fc[_0xc6da('0x48')]=[{'all':!![]}];}_0x4e00fc=_['merge']({},_0x4e00fc,_0x34e19a[_0xc6da('0x45')]);return db[_0xc6da('0x46')][_0xc6da('0x4d')](_0x4e00fc)[_0xc6da('0x2c')](handleEntityNotFound(_0x4f3374,null))['then'](respondWithResult(_0x4f3374,null))['catch'](handleError(_0x4f3374,null));};exports[_0xc6da('0x4e')]=function(_0x3b2f06,_0x4fd983){return db[_0xc6da('0x46')][_0xc6da('0x4e')](_0x3b2f06[_0xc6da('0x4f')],{})[_0xc6da('0x2c')](respondWithResult(_0x4fd983,0xc9))['catch'](handleError(_0x4fd983,null));};exports['update']=function(_0x3d7016,_0x1cd932){if(_0x3d7016[_0xc6da('0x4f')]['id']){delete _0x3d7016[_0xc6da('0x4f')]['id'];}return db['JscriptyAnswerReport'][_0xc6da('0x4d')]({'where':{'id':_0x3d7016['params']['id']}})[_0xc6da('0x2c')](handleEntityNotFound(_0x1cd932,null))[_0xc6da('0x2c')](saveUpdates(_0x3d7016[_0xc6da('0x4f')],null))[_0xc6da('0x2c')](respondWithResult(_0x1cd932,null))['catch'](handleError(_0x1cd932,null));};exports[_0xc6da('0x2d')]=function(_0x12f27b,_0x225d74){return db[_0xc6da('0x46')][_0xc6da('0x4d')]({'where':{'id':_0x12f27b[_0xc6da('0x50')]['id']}})[_0xc6da('0x2c')](handleEntityNotFound(_0x225d74,null))[_0xc6da('0x2c')](removeEntity(_0x225d74,null))[_0xc6da('0x4a')](handleError(_0x225d74,null));};exports[_0xc6da('0x51')]=function(_0x579a46,_0x5d2213){return db['JscriptyAnswerReport'][_0xc6da('0x51')]()['then'](respondWithResult(_0x5d2213,null))[_0xc6da('0x4a')](handleError(_0x5d2213,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index a40ee16..2a9ca2d 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 _0x0dcd=['JscriptyAnswerReport','report_jscripty_answers','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes'];(function(_0x2a2889,_0x3ecce5){var _0x59100f=function(_0x5e5243){while(--_0x5e5243){_0x2a2889['push'](_0x2a2889['shift']());}};_0x59100f(++_0x3ecce5);}(_0x0dcd,0x157));var _0xd0dc=function(_0x24b8eb,_0x3db7b7){_0x24b8eb=_0x24b8eb-0x0;var _0x6f2915=_0x0dcd[_0x24b8eb];return _0x6f2915;};'use strict';var _=require(_0xd0dc('0x0'));var util=require(_0xd0dc('0x1'));var logger=require(_0xd0dc('0x2'))(_0xd0dc('0x3'));var moment=require(_0xd0dc('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd0dc('0x5'));var rimraf=require(_0xd0dc('0x6'));var config=require(_0xd0dc('0x7'));var attributes=require(_0xd0dc('0x8'));module['exports']=function(_0x498cac,_0x2480da){return _0x498cac['define'](_0xd0dc('0x9'),attributes,{'tableName':_0xd0dc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbea6=['../../config/environment','JscriptyAnswerReport','report_jscripty_answers','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xbea6,0xc0));var _0x6bea=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0xbea6[_0x11005e];return _0x29338f;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x6bea('0x0'));var moment=require(_0x6bea('0x1'));var BPromise=require(_0x6bea('0x2'));var rp=require(_0x6bea('0x3'));var fs=require('fs');var path=require(_0x6bea('0x4'));var rimraf=require(_0x6bea('0x5'));var config=require(_0x6bea('0x6'));var attributes=require('./jscriptyAnswerReport.attributes');module['exports']=function(_0x55df05,_0xc8c1fa){return _0x55df05['define'](_0x6bea('0x7'),attributes,{'tableName':_0x6bea('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 ef411fc..036c0a9 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 _0x903a=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment'];(function(_0x3a9aec,_0x318f70){var _0x3e7fd6=function(_0x475604){while(--_0x475604){_0x3a9aec['push'](_0x3a9aec['shift']());}};_0x3e7fd6(++_0x318f70);}(_0x903a,0x1b7));var _0xa903=function(_0x520151,_0x312929){_0x520151=_0x520151-0x0;var _0x1a60b6=_0x903a[_0x520151];return _0x1a60b6;};'use strict';var _=require('lodash');var util=require(_0xa903('0x0'));var moment=require(_0xa903('0x1'));var BPromise=require('bluebird');var rs=require(_0xa903('0x2'));var fs=require('fs');var Redis=require(_0xa903('0x3'));var db=require(_0xa903('0x4'))['db'];var utils=require(_0xa903('0x5'));var logger=require(_0xa903('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa903('0x7')][_0xa903('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x118ef2,_0x323eea,_0x202f0c){return new BPromise(function(_0x3c6c4a,_0x1f7c8a){return client[_0xa903('0x9')](_0x118ef2,_0x202f0c)[_0xa903('0xa')](function(_0x146148){logger[_0xa903('0xb')](_0xa903('0xc'),_0x323eea,_0xa903('0xd'));logger[_0xa903('0xe')](_0xa903('0xf'),_0x323eea,'request\x20sent',JSON[_0xa903('0x10')](_0x146148));if(_0x146148[_0xa903('0x11')]){if(_0x146148[_0xa903('0x11')][_0xa903('0x12')]===0x1f4){logger[_0xa903('0x11')](_0xa903('0xc'),_0x323eea,_0x146148[_0xa903('0x11')][_0xa903('0x13')]);return _0x1f7c8a(_0x146148[_0xa903('0x11')][_0xa903('0x13')]);}logger[_0xa903('0x11')](_0xa903('0xc'),_0x323eea,_0x146148[_0xa903('0x11')]['message']);return _0x3c6c4a(_0x146148['error'][_0xa903('0x13')]);}else{logger['info']('JscriptyAnswerReport,\x20%s,\x20%s',_0x323eea,_0xa903('0xd'));_0x3c6c4a(_0x146148[_0xa903('0x14')][_0xa903('0x13')]);}})['catch'](function(_0x5b974f){logger['error'](_0xa903('0xc'),_0x323eea,_0x5b974f);_0x1f7c8a(_0x5b974f);});});} \ No newline at end of file +var _0x6baf=['../../config/environment','jayson/promise','http','then','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','error','code','JscriptyAnswerReport,\x20%s,\x20%s','message','result','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x3d9750,_0x2e3af1){var _0x1313d9=function(_0x493067){while(--_0x493067){_0x3d9750['push'](_0x3d9750['shift']());}};_0x1313d9(++_0x2e3af1);}(_0x6baf,0x19d));var _0xf6ba=function(_0x4dbc73,_0x36c1b8){_0x4dbc73=_0x4dbc73-0x0;var _0x5af468=_0x6baf[_0x4dbc73];return _0x5af468;};'use strict';var _=require(_0xf6ba('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf6ba('0x1'));var rs=require(_0xf6ba('0x2'));var fs=require('fs');var Redis=require(_0xf6ba('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf6ba('0x4'));var logger=require(_0xf6ba('0x5'))(_0xf6ba('0x6'));var config=require(_0xf6ba('0x7'));var jayson=require(_0xf6ba('0x8'));var client=jayson['client'][_0xf6ba('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2e8030,_0x5ef254,_0x4a805f){return new BPromise(function(_0x2b50fd,_0xb7e5d6){return client['request'](_0x2e8030,_0x4a805f)[_0xf6ba('0xa')](function(_0xc50d1f){logger['info']('JscriptyAnswerReport,\x20%s,\x20%s',_0x5ef254,_0xf6ba('0xb'));logger[_0xf6ba('0xc')](_0xf6ba('0xd'),_0x5ef254,_0xf6ba('0xb'),JSON['stringify'](_0xc50d1f));if(_0xc50d1f['error']){if(_0xc50d1f[_0xf6ba('0xe')][_0xf6ba('0xf')]===0x1f4){logger[_0xf6ba('0xe')](_0xf6ba('0x10'),_0x5ef254,_0xc50d1f[_0xf6ba('0xe')][_0xf6ba('0x11')]);return _0xb7e5d6(_0xc50d1f[_0xf6ba('0xe')][_0xf6ba('0x11')]);}logger[_0xf6ba('0xe')](_0xf6ba('0x10'),_0x5ef254,_0xc50d1f[_0xf6ba('0xe')][_0xf6ba('0x11')]);return _0x2b50fd(_0xc50d1f[_0xf6ba('0xe')]['message']);}else{logger['info'](_0xf6ba('0x10'),_0x5ef254,_0xf6ba('0xb'));_0x2b50fd(_0xc50d1f[_0xf6ba('0x12')][_0xf6ba('0x11')]);}})[_0xf6ba('0x13')](function(_0x4ac509){logger[_0xf6ba('0xe')](_0xf6ba('0x10'),_0x5ef254,_0x4ac509);_0xb7e5d6(_0x4ac509);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index d36842f..9b3222e 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 _0x93d7=['create','update','delete','/:id','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','show','/:id/sessions','/:id/answers','/:id/summary','30s','getSummary','post'];(function(_0x55819e,_0xfb928b){var _0x1b3e09=function(_0x4b332d){while(--_0x4b332d){_0x55819e['push'](_0x55819e['shift']());}};_0x1b3e09(++_0xfb928b);}(_0x93d7,0x156));var _0x793d=function(_0x4405d4,_0x2bd6c7){_0x4405d4=_0x4405d4-0x0;var _0x212799=_0x93d7[_0x4405d4];return _0x212799;};'use strict';var multer=require(_0x793d('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x793d('0x1'));var express=require(_0x793d('0x2'));var router=express[_0x793d('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x793d('0x4'));var interaction=require(_0x793d('0x5'));var config=require(_0x793d('0x6'));var controller=require(_0x793d('0x7'));router[_0x793d('0x8')]('/',auth[_0x793d('0x9')](),controller[_0x793d('0xa')]);router[_0x793d('0x8')]('/:id',auth[_0x793d('0x9')](),controller[_0x793d('0xb')]);router['get'](_0x793d('0xc'),auth[_0x793d('0x9')](),controller['getSessions']);router[_0x793d('0x8')](_0x793d('0xd'),auth[_0x793d('0x9')](),controller['getAnswers']);router[_0x793d('0x8')](_0x793d('0xe'),auth[_0x793d('0x9')](),timeout(_0x793d('0xf')),controller[_0x793d('0x10')]);router[_0x793d('0x11')]('/',auth[_0x793d('0x9')](),controller[_0x793d('0x12')]);router[_0x793d('0x11')]('/:id/clone',auth[_0x793d('0x9')](),controller['clone']);router['put']('/:id',auth[_0x793d('0x9')](),controller[_0x793d('0x13')]);router[_0x793d('0x14')](_0x793d('0x15'),auth[_0x793d('0x9')](),controller[_0x793d('0x16')]);module[_0x793d('0x17')]=router; \ No newline at end of file +var _0xdce3=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/sessions','getSessions','/:id/answers','/:id/summary','30s','getSummary','create','/:id/clone','clone','put','update','delete','exports','multer','path','connect-timeout','express'];(function(_0x4922d9,_0x263c9b){var _0x2e43c2=function(_0x4378b1){while(--_0x4378b1){_0x4922d9['push'](_0x4922d9['shift']());}};_0x2e43c2(++_0x263c9b);}(_0xdce3,0x1be));var _0x3dce=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xdce3[_0x4565bf];return _0x5610ba;};'use strict';var multer=require(_0x3dce('0x0'));var util=require('util');var path=require(_0x3dce('0x1'));var timeout=require(_0x3dce('0x2'));var express=require(_0x3dce('0x3'));var router=express['Router']();var fs_extra=require(_0x3dce('0x4'));var auth=require(_0x3dce('0x5'));var interaction=require(_0x3dce('0x6'));var config=require(_0x3dce('0x7'));var controller=require('./jscriptyProject.controller');router[_0x3dce('0x8')]('/',auth[_0x3dce('0x9')](),controller[_0x3dce('0xa')]);router[_0x3dce('0x8')](_0x3dce('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x3dce('0x8')](_0x3dce('0xc'),auth[_0x3dce('0x9')](),controller[_0x3dce('0xd')]);router['get'](_0x3dce('0xe'),auth[_0x3dce('0x9')](),controller['getAnswers']);router[_0x3dce('0x8')](_0x3dce('0xf'),auth[_0x3dce('0x9')](),timeout(_0x3dce('0x10')),controller[_0x3dce('0x11')]);router['post']('/',auth[_0x3dce('0x9')](),controller[_0x3dce('0x12')]);router['post'](_0x3dce('0x13'),auth[_0x3dce('0x9')](),controller[_0x3dce('0x14')]);router[_0x3dce('0x15')](_0x3dce('0xb'),auth[_0x3dce('0x9')](),controller[_0x3dce('0x16')]);router[_0x3dce('0x17')](_0x3dce('0xb'),auth[_0x3dce('0x9')](),controller['destroy']);module[_0x3dce('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 4fe7c98..802b1d1 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 _0x8f59=['name','description','BOOLEAN','sequelize','lodash','util','STRING','long','isObjectLike','setDataValue','formData','stringify','isString','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue'];(function(_0x20e283,_0x2b5a6e){var _0x199e10=function(_0xaccd3a){while(--_0xaccd3a){_0x20e283['push'](_0x20e283['shift']());}};_0x199e10(++_0x2b5a6e);}(_0x8f59,0xa8));var _0x98f5=function(_0x27c25f,_0x4ff5fe){_0x27c25f=_0x27c25f-0x0;var _0x2da4c4=_0x8f59[_0x27c25f];return _0x2da4c4;};'use strict';var Sequelize=require(_0x98f5('0x0'));var _=require(_0x98f5('0x1'));var util=require(_0x98f5('0x2'));module['exports']={'name':{'type':Sequelize[_0x98f5('0x3')],'unique':'name'},'description':{'type':Sequelize[_0x98f5('0x3')]},'formData':{'type':Sequelize['TEXT'](_0x98f5('0x4')),'set':function(_0x23d2b8){if(_[_0x98f5('0x5')](_0x23d2b8)){this[_0x98f5('0x6')](_0x98f5('0x7'),JSON[_0x98f5('0x8')](_0x23d2b8));}else if(_[_0x98f5('0x9')](_0x23d2b8)){this[_0x98f5('0x6')](_0x98f5('0x7'),_0x23d2b8);}else{this[_0x98f5('0x6')]('formData',util['format'](_0x98f5('0xa'),this[_0x98f5('0xb')](_0x98f5('0xc'))||'',this[_0x98f5('0xb')](_0x98f5('0xd'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x98f5('0xe')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x98f5('0xe')],'defaultValue':![]}}; \ No newline at end of file +var _0x7ce1=['getDataValue','BOOLEAN','sequelize','lodash','util','exports','STRING','TEXT','long','isObjectLike','setDataValue','formData','stringify','isString','format'];(function(_0x591925,_0x12ced1){var _0x52ab95=function(_0x44cff7){while(--_0x44cff7){_0x591925['push'](_0x591925['shift']());}};_0x52ab95(++_0x12ced1);}(_0x7ce1,0xa7));var _0x17ce=function(_0x37ae26,_0x2ecd70){_0x37ae26=_0x37ae26-0x0;var _0x1b1902=_0x7ce1[_0x37ae26];return _0x1b1902;};'use strict';var Sequelize=require(_0x17ce('0x0'));var _=require(_0x17ce('0x1'));var util=require(_0x17ce('0x2'));module[_0x17ce('0x3')]={'name':{'type':Sequelize[_0x17ce('0x4')],'unique':'name'},'description':{'type':Sequelize[_0x17ce('0x4')]},'formData':{'type':Sequelize[_0x17ce('0x5')](_0x17ce('0x6')),'set':function(_0x14a326){if(_[_0x17ce('0x7')](_0x14a326)){this[_0x17ce('0x8')](_0x17ce('0x9'),JSON[_0x17ce('0xa')](_0x14a326));}else if(_[_0x17ce('0xb')](_0x14a326)){this[_0x17ce('0x8')](_0x17ce('0x9'),_0x14a326);}else{this[_0x17ce('0x8')](_0x17ce('0x9'),util[_0x17ce('0xc')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this[_0x17ce('0xd')]('name')||'',this['getDataValue']('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x17ce('0xe')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index a657136..3b814a7 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 _0x51d7=['sendStatus','error','stack','name','send','index','map','JscriptyProject','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','params','keys','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','length','omit','createdAt','updatedAt','user','userProfileId','autoAssociation','getSessions','findOne','JscriptySessionReport','nolimit','ProjectId','getAnswers','JscriptyAnswerReport','number','indexOf','toString','replace','getSummary','startTime','parse','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','push','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','Content-type','text/csv','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Projects','UserProfileResource'];(function(_0x464390,_0x40db21){var _0x17e399=function(_0x3b24e2){while(--_0x3b24e2){_0x464390['push'](_0x464390['shift']());}};_0x17e399(++_0x40db21);}(_0x51d7,0xcf));var _0x751d=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x51d7[_0x199572];return _0x13cfa3;};'use strict';var emlformat=require(_0x751d('0x0'));var rimraf=require(_0x751d('0x1'));var zipdir=require(_0x751d('0x2'));var jsonpatch=require(_0x751d('0x3'));var rp=require(_0x751d('0x4'));var moment=require(_0x751d('0x5'));var BPromise=require(_0x751d('0x6'));var Mustache=require(_0x751d('0x7'));var util=require(_0x751d('0x8'));var path=require(_0x751d('0x9'));var sox=require(_0x751d('0xa'));var csv=require(_0x751d('0xb'));var ejs=require(_0x751d('0xc'));var fs=require('fs');var fs_extra=require(_0x751d('0xd'));var _=require(_0x751d('0xe'));var squel=require(_0x751d('0xf'));var crypto=require(_0x751d('0x10'));var jsforce=require(_0x751d('0x11'));var deskjs=require(_0x751d('0x12'));var toCsv=require(_0x751d('0xb'));var querystring=require(_0x751d('0x13'));var Papa=require(_0x751d('0x14'));var Redis=require(_0x751d('0x15'));var authService=require(_0x751d('0x16'));var qs=require(_0x751d('0x17'));var as=require(_0x751d('0x18'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x751d('0x19'))(_0x751d('0x1a'));var utils=require(_0x751d('0x1b'));var config=require(_0x751d('0x1c'));var licenseUtil=require(_0x751d('0x1d'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x37c863,_0xa08221){_0xa08221=_0xa08221||0xcc;return function(_0x259a1b){if(_0x259a1b){return _0x37c863['sendStatus'](_0xa08221);}return _0x37c863[_0x751d('0x1e')](_0xa08221)['end']();};}function respondWithResult(_0x15a954,_0x29ea7b){_0x29ea7b=_0x29ea7b||0xc8;return function(_0x5ee5b4){if(_0x5ee5b4){return _0x15a954[_0x751d('0x1e')](_0x29ea7b)[_0x751d('0x1f')](_0x5ee5b4);}};}function respondWithFilteredResult(_0x346cff,_0x1afabd){return function(_0x4a99ba){if(_0x4a99ba){var _0x5b7c8c=typeof _0x1afabd[_0x751d('0x20')]===_0x751d('0x21')&&typeof _0x1afabd[_0x751d('0x22')]===_0x751d('0x21');var _0x49255c=_0x4a99ba['count'];var _0x3879dc=_0x5b7c8c?0x0:_0x1afabd[_0x751d('0x20')];var _0x4e52e6=_0x5b7c8c?_0x4a99ba[_0x751d('0x23')]:_0x1afabd[_0x751d('0x20')]+_0x1afabd[_0x751d('0x22')];var _0x1ec1df;if(_0x4e52e6>=_0x49255c){_0x4e52e6=_0x49255c;_0x1ec1df=0xc8;}else{_0x1ec1df=0xce;}_0x346cff['status'](_0x1ec1df);return _0x346cff[_0x751d('0x24')](_0x751d('0x25'),_0x3879dc+'-'+_0x4e52e6+'/'+_0x49255c)[_0x751d('0x1f')](_0x4a99ba);}return null;};}function patchUpdates(_0x13a062){return function(_0x5bf9ce){try{jsonpatch[_0x751d('0x26')](_0x5bf9ce,_0x13a062,!![]);}catch(_0x2381e5){return BPromise[_0x751d('0x27')](_0x2381e5);}return _0x5bf9ce[_0x751d('0x28')]();};}function saveUpdates(_0x1087e7,_0xbe5e09){return function(_0x439e1d){if(_0x439e1d){return _0x439e1d[_0x751d('0x29')](_0x1087e7)[_0x751d('0x2a')](function(_0x837cbd){return _0x837cbd;});}return null;};}function removeEntity(_0x2395ce,_0x14a9cf){return function(_0x599263){if(_0x599263){return _0x599263[_0x751d('0x2b')]()['then'](function(){var _0x42319e=_0x599263[_0x751d('0x2c')]({'plain':!![]});var _0x1bbe5d=_0x751d('0x2d');return db[_0x751d('0x2e')][_0x751d('0x2b')]({'where':{'type':_0x1bbe5d,'resourceId':_0x42319e['id']}})[_0x751d('0x2a')](function(){return _0x599263;});})[_0x751d('0x2a')](function(){_0x2395ce['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x278015,_0x9f623a){return function(_0x2c1344){if(!_0x2c1344){_0x278015[_0x751d('0x2f')](0x194);}return _0x2c1344;};}function handleError(_0x2037ba,_0x1efd1f){_0x1efd1f=_0x1efd1f||0x1f4;return function(_0x2acfea){logger[_0x751d('0x30')](_0x2acfea[_0x751d('0x31')]);if(_0x2acfea[_0x751d('0x32')]){delete _0x2acfea[_0x751d('0x32')];}_0x2037ba['status'](_0x1efd1f)[_0x751d('0x33')](_0x2acfea);};}exports[_0x751d('0x34')]=function(_0x3cfabb,_0x228b5b){var _0x593bff={},_0x531890={},_0x31f24b={'count':0x0,'rows':[]};var _0x1a53a6=_[_0x751d('0x35')](db[_0x751d('0x36')][_0x751d('0x37')],function(_0x44d121){return{'name':_0x44d121[_0x751d('0x38')],'type':_0x44d121[_0x751d('0x39')][_0x751d('0x3a')]};});_0x531890[_0x751d('0x3b')]=_['map'](_0x1a53a6,'name');_0x531890[_0x751d('0x3c')]=_['keys'](_0x3cfabb[_0x751d('0x3c')]);_0x531890[_0x751d('0x3d')]=_[_0x751d('0x3e')](_0x531890[_0x751d('0x3b')],_0x531890[_0x751d('0x3c')]);_0x593bff[_0x751d('0x3f')]=_[_0x751d('0x3e')](_0x531890[_0x751d('0x3b')],qs[_0x751d('0x40')](_0x3cfabb[_0x751d('0x3c')]['fields']));_0x593bff[_0x751d('0x3f')]=_0x593bff[_0x751d('0x3f')]['length']?_0x593bff['attributes']:_0x531890[_0x751d('0x3b')];if(!_0x3cfabb[_0x751d('0x3c')][_0x751d('0x41')]('nolimit')){_0x593bff[_0x751d('0x22')]=qs[_0x751d('0x22')](_0x3cfabb[_0x751d('0x3c')]['limit']);_0x593bff['offset']=qs['offset'](_0x3cfabb['query'][_0x751d('0x20')]);}_0x593bff[_0x751d('0x42')]=qs[_0x751d('0x43')](_0x3cfabb[_0x751d('0x3c')][_0x751d('0x43')]);_0x593bff[_0x751d('0x44')]=qs[_0x751d('0x3d')](_[_0x751d('0x45')](_0x3cfabb[_0x751d('0x3c')],_0x531890[_0x751d('0x3d')]),_0x1a53a6);if(_0x3cfabb['query'][_0x751d('0x46')]){_0x593bff[_0x751d('0x44')]=_['merge'](_0x593bff[_0x751d('0x44')],{'$or':_[_0x751d('0x35')](_0x1a53a6,function(_0x2c24ab){if(_0x2c24ab[_0x751d('0x39')]!==_0x751d('0x47')){var _0x1a895b={};_0x1a895b[_0x2c24ab[_0x751d('0x32')]]={'$like':'%'+_0x3cfabb['query'][_0x751d('0x46')]+'%'};return _0x1a895b;}})});}_0x593bff=_[_0x751d('0x48')]({},_0x593bff,_0x3cfabb['options']);var _0xf8d64f={'where':_0x593bff[_0x751d('0x44')]};return db['JscriptyProject'][_0x751d('0x23')](_0xf8d64f)[_0x751d('0x2a')](function(_0x1beb4b){_0x31f24b[_0x751d('0x23')]=_0x1beb4b;if(_0x3cfabb[_0x751d('0x3c')][_0x751d('0x49')]){_0x593bff[_0x751d('0x4a')]=[{'all':!![]}];}return db[_0x751d('0x36')][_0x751d('0x4b')](_0x593bff);})[_0x751d('0x2a')](function(_0x37e82a){_0x31f24b[_0x751d('0x4c')]=_0x37e82a;return _0x31f24b;})[_0x751d('0x2a')](respondWithFilteredResult(_0x228b5b,_0x593bff))[_0x751d('0x4d')](handleError(_0x228b5b,null));};exports['show']=function(_0x4f65c8,_0x593552){var _0x275645={'raw':![],'where':{'id':_0x4f65c8[_0x751d('0x4e')]['id']}},_0x72886a={};_0x72886a[_0x751d('0x3b')]=_['keys'](db[_0x751d('0x36')][_0x751d('0x37')]);_0x72886a['query']=_[_0x751d('0x4f')](_0x4f65c8[_0x751d('0x3c')]);_0x72886a[_0x751d('0x3d')]=_[_0x751d('0x3e')](_0x72886a['model'],_0x72886a[_0x751d('0x3c')]);_0x275645[_0x751d('0x3f')]=_['intersection'](_0x72886a[_0x751d('0x3b')],qs['fields'](_0x4f65c8['query'][_0x751d('0x40')]));_0x275645[_0x751d('0x3f')]=_0x275645[_0x751d('0x3f')]['length']?_0x275645[_0x751d('0x3f')]:_0x72886a[_0x751d('0x3b')];if(_0x4f65c8['query'][_0x751d('0x49')]){_0x275645[_0x751d('0x4a')]=[{'all':!![]}];}_0x275645=_[_0x751d('0x48')]({},_0x275645,_0x4f65c8[_0x751d('0x50')]);return db['JscriptyProject'][_0x751d('0x51')](_0x275645)[_0x751d('0x2a')](handleEntityNotFound(_0x593552,null))['then'](respondWithResult(_0x593552,null))[_0x751d('0x4d')](handleError(_0x593552,null));};exports[_0x751d('0x52')]=function(_0x203b61,_0x3d5146){return db[_0x751d('0x36')][_0x751d('0x52')](_0x203b61[_0x751d('0x53')],{})['then'](function(_0x5a2d53){var _0x40f84b=_0x203b61['user'][_0x751d('0x2c')]({'plain':!![]});if(!_0x40f84b)throw new Error(_0x751d('0x54'));if(_0x40f84b[_0x751d('0x55')]==='user'){var _0x53cd8e=_0x5a2d53['get']({'plain':!![]});var _0x15eb9b=_0x751d('0x2d');return db[_0x751d('0x56')][_0x751d('0x51')]({'where':{'name':_0x15eb9b,'userProfileId':_0x40f84b['userProfileId']},'raw':!![]})[_0x751d('0x2a')](function(_0xb4341c){if(_0xb4341c&&_0xb4341c['autoAssociation']===0x0){return db['UserProfileResource'][_0x751d('0x52')]({'name':_0x53cd8e['name'],'resourceId':_0x53cd8e['id'],'type':_0xb4341c[_0x751d('0x32')],'sectionId':_0xb4341c['id']},{})[_0x751d('0x2a')](function(){return _0x5a2d53;});}else{return _0x5a2d53;}})['catch'](function(_0xc83f9f){logger[_0x751d('0x30')](_0x751d('0x57'),_0xc83f9f);throw _0xc83f9f;});}return _0x5a2d53;})[_0x751d('0x2a')](respondWithResult(_0x3d5146,0xc9))[_0x751d('0x4d')](handleError(_0x3d5146,null));};exports[_0x751d('0x58')]=function(_0x17aa2f,_0x4ec10b){var _0x99de8c={'where':{'id':_0x17aa2f[_0x751d('0x4e')]['id']}},_0x25acc4={};_0x25acc4[_0x751d('0x3b')]=_[_0x751d('0x4f')](db['JscriptyProject']['rawAttributes']);_0x99de8c[_0x751d('0x3f')]=_[_0x751d('0x3e')](_0x25acc4[_0x751d('0x3b')],qs[_0x751d('0x40')](_0x17aa2f['query'][_0x751d('0x40')]));_0x99de8c['attributes']=_0x99de8c[_0x751d('0x3f')][_0x751d('0x59')]?_0x99de8c['attributes']:_0x25acc4[_0x751d('0x3b')];if(_0x17aa2f[_0x751d('0x3c')][_0x751d('0x49')]){_0x99de8c[_0x751d('0x4a')]=[{'all':!![]}];}_0x99de8c=_[_0x751d('0x48')]({},_0x99de8c,_0x17aa2f[_0x751d('0x50')]);return db[_0x751d('0x36')][_0x751d('0x51')](_0x99de8c)[_0x751d('0x2a')](handleEntityNotFound(_0x4ec10b,null))[_0x751d('0x2a')](function(_0x4d4868){if(_0x4d4868){var _0x327e3a=_0x4d4868[_0x751d('0x2c')]({'plain':!![]});_0x327e3a=qs[_0x751d('0x5a')](_0x327e3a,['id','createdAt','updatedAt']);_0x17aa2f[_0x751d('0x53')]=_[_0x751d('0x5a')](_0x17aa2f[_0x751d('0x53')],['id',_0x751d('0x5b'),_0x751d('0x5c')]);return db[_0x751d('0x36')]['create'](_['merge'](_0x327e3a,_0x17aa2f[_0x751d('0x53')]),{'include':_0x17aa2f['query']['includeAll']?[{'all':!![]}]:undefined})[_0x751d('0x2a')](function(_0x406112){var _0x2a43de=_0x17aa2f[_0x751d('0x5d')][_0x751d('0x2c')]({'plain':!![]});if(!_0x2a43de)throw new Error(_0x751d('0x54'));if(_0x2a43de['role']===_0x751d('0x5d')){var _0x37e7dc=_0x406112['get']({'plain':!![]});var _0x2491c6='Projects';return db[_0x751d('0x56')][_0x751d('0x51')]({'where':{'name':_0x2491c6,'userProfileId':_0x2a43de[_0x751d('0x5e')]},'raw':!![]})[_0x751d('0x2a')](function(_0x14737e){if(_0x14737e&&_0x14737e[_0x751d('0x5f')]===0x0){return db[_0x751d('0x2e')][_0x751d('0x52')]({'name':_0x37e7dc['name'],'resourceId':_0x37e7dc['id'],'type':_0x14737e['name'],'sectionId':_0x14737e['id']},{})[_0x751d('0x2a')](function(){return _0x406112;});}else{return _0x406112;}})[_0x751d('0x4d')](function(_0x2bec94){logger['error'](_0x751d('0x57'),_0x2bec94);throw _0x2bec94;});}return _0x406112;});}})[_0x751d('0x2a')](respondWithResult(_0x4ec10b,0xc9))[_0x751d('0x4d')](handleError(_0x4ec10b,null));};exports[_0x751d('0x29')]=function(_0x239dea,_0x106b40){if(_0x239dea[_0x751d('0x53')]['id']){delete _0x239dea['body']['id'];}return db['JscriptyProject']['find']({'where':{'id':_0x239dea['params']['id']}})[_0x751d('0x2a')](handleEntityNotFound(_0x106b40,null))[_0x751d('0x2a')](saveUpdates(_0x239dea[_0x751d('0x53')],null))[_0x751d('0x2a')](respondWithResult(_0x106b40,null))[_0x751d('0x4d')](handleError(_0x106b40,null));};exports['destroy']=function(_0x146557,_0x512e7d){return db['JscriptyProject'][_0x751d('0x51')]({'where':{'id':_0x146557[_0x751d('0x4e')]['id']}})[_0x751d('0x2a')](handleEntityNotFound(_0x512e7d,null))[_0x751d('0x2a')](removeEntity(_0x512e7d,null))[_0x751d('0x4d')](handleError(_0x512e7d,null));};exports[_0x751d('0x60')]=function(_0x2f391f,_0x86618d,_0x5f5b42){var _0x735277={'raw':!![],'where':{}};var _0x408095={};var _0x2405ae={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x751d('0x61')]({'where':{'id':_0x2f391f[_0x751d('0x4e')]['id']}})['then'](handleEntityNotFound(_0x86618d,null))[_0x751d('0x2a')](function(_0x437542){if(_0x437542){_0x408095[_0x751d('0x3b')]=_['keys'](db[_0x751d('0x62')][_0x751d('0x37')]);_0x408095[_0x751d('0x3c')]=_['keys'](_0x2f391f[_0x751d('0x3c')]);_0x408095[_0x751d('0x3d')]=_[_0x751d('0x3e')](_0x408095[_0x751d('0x3b')],_0x408095['query']);_0x735277[_0x751d('0x3f')]=_['intersection'](_0x408095['model'],qs[_0x751d('0x40')](_0x2f391f['query'][_0x751d('0x40')]));_0x735277[_0x751d('0x3f')]=_0x735277[_0x751d('0x3f')][_0x751d('0x59')]?_0x735277['attributes']:_0x408095[_0x751d('0x3b')];if(!_0x2f391f[_0x751d('0x3c')][_0x751d('0x41')](_0x751d('0x63'))){_0x735277[_0x751d('0x22')]=qs[_0x751d('0x22')](_0x2f391f['query'][_0x751d('0x22')]);_0x735277[_0x751d('0x20')]=qs[_0x751d('0x20')](_0x2f391f['query']['offset']);}_0x735277[_0x751d('0x42')]=qs[_0x751d('0x43')](_0x2f391f[_0x751d('0x3c')]['sort']);_0x735277['where']=qs[_0x751d('0x3d')](_[_0x751d('0x45')](_0x2f391f[_0x751d('0x3c')],_0x408095[_0x751d('0x3d')]));_0x735277[_0x751d('0x44')][_0x751d('0x64')]=_0x437542['id'];if(_0x2f391f['query'][_0x751d('0x46')]){_0x735277[_0x751d('0x44')]=_['merge'](_0x735277['where'],{'$or':_[_0x751d('0x35')](_0x735277['attributes'],function(_0x317cb3){var _0x21190d={};_0x21190d[_0x317cb3]={'$like':'%'+_0x2f391f[_0x751d('0x3c')][_0x751d('0x46')]+'%'};return _0x21190d;})});}_0x735277=_['merge']({},_0x735277,_0x2f391f[_0x751d('0x50')]);return db[_0x751d('0x62')][_0x751d('0x23')]({'where':_0x735277['where']})[_0x751d('0x2a')](function(_0x24d4c7){_0x2405ae[_0x751d('0x23')]=_0x24d4c7;if(_0x2f391f[_0x751d('0x3c')][_0x751d('0x49')]){_0x735277[_0x751d('0x4a')]=[{'all':!![]}];}return db[_0x751d('0x62')]['findAll'](_0x735277);})[_0x751d('0x2a')](function(_0x3c13f7){_0x2405ae[_0x751d('0x4c')]=_0x3c13f7;return _0x2405ae;});}})[_0x751d('0x2a')](respondWithFilteredResult(_0x86618d,_0x735277))['catch'](handleError(_0x86618d,null));};exports[_0x751d('0x65')]=function(_0x11f2f2,_0x2cf074,_0xd53778){var _0xfc0037={'raw':!![],'where':{}};var _0x50df68={};var _0x17c7e1={'count':0x0,'rows':[]};return db[_0x751d('0x36')][_0x751d('0x61')]({'where':{'id':_0x11f2f2[_0x751d('0x4e')]['id']}})[_0x751d('0x2a')](handleEntityNotFound(_0x2cf074,null))[_0x751d('0x2a')](function(_0x410c1c){if(_0x410c1c){_0x50df68[_0x751d('0x3b')]=_[_0x751d('0x4f')](db['JscriptyAnswerReport'][_0x751d('0x37')]);_0x50df68[_0x751d('0x3c')]=_[_0x751d('0x4f')](_0x11f2f2[_0x751d('0x3c')]);_0x50df68['filters']=_['intersection'](_0x50df68[_0x751d('0x3b')],_0x50df68[_0x751d('0x3c')]);_0xfc0037[_0x751d('0x3f')]=_['intersection'](_0x50df68['model'],qs[_0x751d('0x40')](_0x11f2f2[_0x751d('0x3c')][_0x751d('0x40')]));_0xfc0037['attributes']=_0xfc0037['attributes'][_0x751d('0x59')]?_0xfc0037[_0x751d('0x3f')]:_0x50df68[_0x751d('0x3b')];if(!_0x11f2f2[_0x751d('0x3c')]['hasOwnProperty']('nolimit')){_0xfc0037['limit']=qs[_0x751d('0x22')](_0x11f2f2['query'][_0x751d('0x22')]);_0xfc0037[_0x751d('0x20')]=qs[_0x751d('0x20')](_0x11f2f2[_0x751d('0x3c')][_0x751d('0x20')]);}_0xfc0037['order']=qs[_0x751d('0x43')](_0x11f2f2[_0x751d('0x3c')][_0x751d('0x43')]);_0xfc0037['where']=qs[_0x751d('0x3d')](_[_0x751d('0x45')](_0x11f2f2[_0x751d('0x3c')],_0x50df68['filters']));_0xfc0037[_0x751d('0x44')][_0x751d('0x64')]=_0x410c1c['id'];if(_0x11f2f2[_0x751d('0x3c')][_0x751d('0x46')]){_0xfc0037['where']=_[_0x751d('0x48')](_0xfc0037['where'],{'$or':_[_0x751d('0x35')](_0xfc0037[_0x751d('0x3f')],function(_0xab3822){var _0x31dc52={};_0x31dc52[_0xab3822]={'$like':'%'+_0x11f2f2[_0x751d('0x3c')][_0x751d('0x46')]+'%'};return _0x31dc52;})});}_0xfc0037=_[_0x751d('0x48')]({},_0xfc0037,_0x11f2f2['options']);return db['JscriptyAnswerReport'][_0x751d('0x23')]({'where':_0xfc0037[_0x751d('0x44')]})[_0x751d('0x2a')](function(_0x845fec){_0x17c7e1[_0x751d('0x23')]=_0x845fec;if(_0x11f2f2[_0x751d('0x3c')][_0x751d('0x49')]){_0xfc0037[_0x751d('0x4a')]=[{'all':!![]}];}return db[_0x751d('0x66')][_0x751d('0x4b')](_0xfc0037);})[_0x751d('0x2a')](function(_0x4c67bd){_0x17c7e1[_0x751d('0x4c')]=_0x4c67bd;return _0x17c7e1;});}})[_0x751d('0x2a')](respondWithFilteredResult(_0x2cf074,_0xfc0037))[_0x751d('0x4d')](handleError(_0x2cf074,null));};function char(_0x250203){return _0x751d('0x67')===typeof _0x250203?String['fromCharCode'][_0x751d('0x26')](null,arguments):_0x250203;}function needsEncapsulation(_0x4247ed){return!!_0x4247ed&&(_0x4247ed['toString']()[_0x751d('0x68')](char(0xd))>=0x0||_0x4247ed[_0x751d('0x69')]()[_0x751d('0x68')](char(0xa))>=0x0||_0x4247ed[_0x751d('0x69')]()[_0x751d('0x68')](char(0x2c))>=0x0||_0x4247ed[_0x751d('0x69')]()[_0x751d('0x68')](char(0x22))>=0x0);}function encapsulate(_0x5c90c8){var _0xeb2e2d=char(0x22),_0x13d9b5='\x5c'+char(0x22),_0x6302c6=_0x5c90c8[_0x751d('0x69')]()[_0x751d('0x6a')](new RegExp(_0xeb2e2d,'g'),_0x13d9b5);return _0xeb2e2d+_0x6302c6+_0xeb2e2d;}exports[_0x751d('0x6b')]=function(_0x1307b3,_0x3926d9,_0x299957){var _0x46b08c,_0x434fcc;var _0x558e7e={'where':{'ProjectId':_0x1307b3[_0x751d('0x4e')]['id']}};if(_0x1307b3[_0x751d('0x3c')][_0x751d('0x6c')]){_0x558e7e[_0x751d('0x44')]['starttime']=JSON[_0x751d('0x6d')](_0x1307b3[_0x751d('0x3c')][_0x751d('0x6c')]);}return db['JscriptySessionReport'][_0x751d('0x4b')](_0x558e7e)[_0x751d('0x2a')](handleEntityNotFound(_0x3926d9,null))[_0x751d('0x2a')](function(_0x4f6765){if(_0x4f6765){_0x46b08c=_0x4f6765;return db[_0x751d('0x6e')][_0x751d('0x4b')]({'where':{'SessionId':{'$in':_[_0x751d('0x35')](_0x46b08c,'id')},'ProjectId':_0x1307b3[_0x751d('0x4e')]['id']},'order':_0x751d('0x6f')});}})[_0x751d('0x2a')](handleEntityNotFound(_0x3926d9,null))[_0x751d('0x2a')](function(_0x11cf8b){if(_0x11cf8b){_0x434fcc=_0x11cf8b;var _0x1c654c={};for(var _0x1eb96f=0x0,_0x574939=_0x434fcc[_0x751d('0x59')];_0x1eb96f<_0x574939;_0x1eb96f++){if(!_0x1c654c['hasOwnProperty'](_0x434fcc[_0x1eb96f]['questionId'])){_0x1c654c[_0x434fcc[_0x1eb96f][_0x751d('0x70')]]=needsEncapsulation(_0x434fcc[_0x1eb96f][_0x751d('0x71')])?encapsulate(_0x434fcc[_0x1eb96f][_0x751d('0x71')]):_0x434fcc[_0x1eb96f]['question'];}}var _0x37ab21=[],_0x506c51={};for(var _0x10cede=0x0,_0x55bed2=_0x46b08c[_0x751d('0x59')];_0x10cede<_0x55bed2;_0x10cede++){_0x506c51={'ProjectId':_0x1307b3[_0x751d('0x4e')]['id'],'SessionId':_0x46b08c[_0x10cede]['id'],'StartTime':moment(_0x46b08c[_0x10cede]['starttime'])[_0x751d('0x72')](_0x751d('0x73'))};for(var _0x19ec78=0x0,_0x218e2b=_0x434fcc[_0x751d('0x59')];_0x19ec78<_0x218e2b;_0x19ec78++){if(_0x434fcc[_0x19ec78][_0x751d('0x74')]==_0x46b08c[_0x10cede]['id']&&_0x1c654c[_0x751d('0x41')](_0x434fcc[_0x19ec78][_0x751d('0x70')])){_0x506c51[_0x1c654c[_0x434fcc[_0x19ec78][_0x751d('0x70')]]]=_0x434fcc[_0x19ec78]['answer'];}}for(var _0x32cb40 in _0x1c654c){if(!_0x506c51[_0x751d('0x41')](_0x1c654c[_0x32cb40])){_0x506c51[_0x1c654c[_0x32cb40]]=null;}}_0x37ab21[_0x751d('0x75')](_0x506c51);}return _0x37ab21;}})['then'](function(_0x2f9cd1){if(!_[_0x751d('0x76')](_0x2f9cd1)){var _0x40de86=toCsv(_0x2f9cd1);var _0xfb90e3=Date[_0x751d('0x77')]();fs[_0x751d('0x78')](util[_0x751d('0x72')](_0x751d('0x79'),_0x1307b3[_0x751d('0x4e')]['id'],_0xfb90e3),_0x40de86);_0x3926d9[_0x751d('0x7a')](_0x751d('0x7b'),'attachment;\x20filename='+util[_0x751d('0x72')]('Jscripty_Project_%d_Summary_%s.csv',_0x1307b3[_0x751d('0x4e')]['id'],_0xfb90e3));_0x3926d9['setHeader'](_0x751d('0x7c'),_0x751d('0x7d'));return _0x3926d9[_0x751d('0x7e')](util['format'](_0x751d('0x79'),_0x1307b3[_0x751d('0x4e')]['id'],_0xfb90e3));}else{return _0x3926d9['sendStatus'](0xcc);}})[_0x751d('0x4d')](handleError(_0x3926d9,null));}; \ No newline at end of file +var _0xdd4f=['moment','mustache','util','path','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','../../config/license/util','../../mysqldb','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','get','Projects','UserProfileResource','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','JscriptyProject','includeAll','include','rows','catch','show','params','keys','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','updatedAt','user','role','findOne','JscriptySessionReport','ProjectId','findAll','pick','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','getSummary','startTime','starttime','parse','question','format','YYYY-MM-DD\x20HH:mm:ss','questionId','push','isEmpty','writeFileSync','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','/tmp/Jscripty_Project_%d_Summary_%s.csv','eml-format','request-promise'];(function(_0x38e95b,_0x268330){var _0x2aa92b=function(_0x3aa6e4){while(--_0x3aa6e4){_0x38e95b['push'](_0x38e95b['shift']());}};_0x2aa92b(++_0x268330);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0xa3ec7c,_0x517622){_0xa3ec7c=_0xa3ec7c-0x0;var _0x3f136f=_0xdd4f[_0xa3ec7c];return _0x3f136f;};'use strict';var emlformat=require(_0xfdd4('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xfdd4('0x1'));var moment=require(_0xfdd4('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xfdd4('0x3'));var util=require(_0xfdd4('0x4'));var path=require(_0xfdd4('0x5'));var sox=require('sox');var csv=require(_0xfdd4('0x6'));var ejs=require(_0xfdd4('0x7'));var fs=require('fs');var fs_extra=require(_0xfdd4('0x8'));var _=require(_0xfdd4('0x9'));var squel=require(_0xfdd4('0xa'));var crypto=require('crypto');var jsforce=require(_0xfdd4('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xfdd4('0x6'));var querystring=require(_0xfdd4('0xc'));var Papa=require(_0xfdd4('0xd'));var Redis=require('ioredis');var authService=require(_0xfdd4('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xfdd4('0xf'));var hardwareService=require(_0xfdd4('0x10'));var logger=require(_0xfdd4('0x11'))(_0xfdd4('0x12'));var utils=require(_0xfdd4('0x13'));var config=require(_0xfdd4('0x14'));var licenseUtil=require(_0xfdd4('0x15'));var db=require(_0xfdd4('0x16'))['db'];function respondWithStatusCode(_0x3f07f1,_0x4565e6){_0x4565e6=_0x4565e6||0xcc;return function(_0x1bf37b){if(_0x1bf37b){return _0x3f07f1['sendStatus'](_0x4565e6);}return _0x3f07f1[_0xfdd4('0x17')](_0x4565e6)[_0xfdd4('0x18')]();};}function respondWithResult(_0x227099,_0x57b21f){_0x57b21f=_0x57b21f||0xc8;return function(_0x1b7da1){if(_0x1b7da1){return _0x227099['status'](_0x57b21f)[_0xfdd4('0x19')](_0x1b7da1);}};}function respondWithFilteredResult(_0x42c3a8,_0x2f34ec){return function(_0x431255){if(_0x431255){var _0x37b05f=typeof _0x2f34ec['offset']==='undefined'&&typeof _0x2f34ec['limit']===_0xfdd4('0x1a');var _0x216c7e=_0x431255[_0xfdd4('0x1b')];var _0x2ccc88=_0x37b05f?0x0:_0x2f34ec[_0xfdd4('0x1c')];var _0x33d752=_0x37b05f?_0x431255[_0xfdd4('0x1b')]:_0x2f34ec[_0xfdd4('0x1c')]+_0x2f34ec[_0xfdd4('0x1d')];var _0x52ce34;if(_0x33d752>=_0x216c7e){_0x33d752=_0x216c7e;_0x52ce34=0xc8;}else{_0x52ce34=0xce;}_0x42c3a8[_0xfdd4('0x17')](_0x52ce34);return _0x42c3a8[_0xfdd4('0x1e')](_0xfdd4('0x1f'),_0x2ccc88+'-'+_0x33d752+'/'+_0x216c7e)[_0xfdd4('0x19')](_0x431255);}return null;};}function patchUpdates(_0x1454f1){return function(_0x29cc8d){try{jsonpatch[_0xfdd4('0x20')](_0x29cc8d,_0x1454f1,!![]);}catch(_0x34dfa8){return BPromise['reject'](_0x34dfa8);}return _0x29cc8d[_0xfdd4('0x21')]();};}function saveUpdates(_0x17302b,_0x2a24e8){return function(_0x16e81b){if(_0x16e81b){return _0x16e81b[_0xfdd4('0x22')](_0x17302b)[_0xfdd4('0x23')](function(_0x451767){return _0x451767;});}return null;};}function removeEntity(_0x277ec1,_0x538b00){return function(_0x1e14da){if(_0x1e14da){return _0x1e14da[_0xfdd4('0x24')]()[_0xfdd4('0x23')](function(){var _0x53d35a=_0x1e14da[_0xfdd4('0x25')]({'plain':!![]});var _0x39b712=_0xfdd4('0x26');return db[_0xfdd4('0x27')][_0xfdd4('0x24')]({'where':{'type':_0x39b712,'resourceId':_0x53d35a['id']}})['then'](function(){return _0x1e14da;});})[_0xfdd4('0x23')](function(){_0x277ec1[_0xfdd4('0x17')](0xcc)[_0xfdd4('0x18')]();});}};}function handleEntityNotFound(_0x31e053,_0x3c6728){return function(_0x192471){if(!_0x192471){_0x31e053[_0xfdd4('0x28')](0x194);}return _0x192471;};}function handleError(_0x37b7a2,_0x5e8898){_0x5e8898=_0x5e8898||0x1f4;return function(_0xcbd1fb){logger[_0xfdd4('0x29')](_0xcbd1fb[_0xfdd4('0x2a')]);if(_0xcbd1fb[_0xfdd4('0x2b')]){delete _0xcbd1fb[_0xfdd4('0x2b')];}_0x37b7a2['status'](_0x5e8898)[_0xfdd4('0x2c')](_0xcbd1fb);};}exports[_0xfdd4('0x2d')]=function(_0xbf38b4,_0x2bb793){var _0x13cc5e={},_0x4d64ce={},_0x374e98={'count':0x0,'rows':[]};var _0x315568=_[_0xfdd4('0x2e')](db['JscriptyProject'][_0xfdd4('0x2f')],function(_0x502776){return{'name':_0x502776[_0xfdd4('0x30')],'type':_0x502776[_0xfdd4('0x31')]['key']};});_0x4d64ce['model']=_[_0xfdd4('0x2e')](_0x315568,_0xfdd4('0x2b'));_0x4d64ce['query']=_['keys'](_0xbf38b4[_0xfdd4('0x32')]);_0x4d64ce[_0xfdd4('0x33')]=_[_0xfdd4('0x34')](_0x4d64ce[_0xfdd4('0x35')],_0x4d64ce[_0xfdd4('0x32')]);_0x13cc5e[_0xfdd4('0x36')]=_[_0xfdd4('0x34')](_0x4d64ce[_0xfdd4('0x35')],qs[_0xfdd4('0x37')](_0xbf38b4[_0xfdd4('0x32')][_0xfdd4('0x37')]));_0x13cc5e[_0xfdd4('0x36')]=_0x13cc5e[_0xfdd4('0x36')][_0xfdd4('0x38')]?_0x13cc5e[_0xfdd4('0x36')]:_0x4d64ce[_0xfdd4('0x35')];if(!_0xbf38b4[_0xfdd4('0x32')][_0xfdd4('0x39')](_0xfdd4('0x3a'))){_0x13cc5e[_0xfdd4('0x1d')]=qs[_0xfdd4('0x1d')](_0xbf38b4[_0xfdd4('0x32')][_0xfdd4('0x1d')]);_0x13cc5e[_0xfdd4('0x1c')]=qs[_0xfdd4('0x1c')](_0xbf38b4[_0xfdd4('0x32')]['offset']);}_0x13cc5e[_0xfdd4('0x3b')]=qs[_0xfdd4('0x3c')](_0xbf38b4[_0xfdd4('0x32')][_0xfdd4('0x3c')]);_0x13cc5e[_0xfdd4('0x3d')]=qs[_0xfdd4('0x33')](_['pick'](_0xbf38b4[_0xfdd4('0x32')],_0x4d64ce['filters']),_0x315568);if(_0xbf38b4[_0xfdd4('0x32')][_0xfdd4('0x3e')]){_0x13cc5e[_0xfdd4('0x3d')]=_[_0xfdd4('0x3f')](_0x13cc5e['where'],{'$or':_[_0xfdd4('0x2e')](_0x315568,function(_0x3feb36){if(_0x3feb36[_0xfdd4('0x31')]!==_0xfdd4('0x40')){var _0x35b719={};_0x35b719[_0x3feb36[_0xfdd4('0x2b')]]={'$like':'%'+_0xbf38b4[_0xfdd4('0x32')][_0xfdd4('0x3e')]+'%'};return _0x35b719;}})});}_0x13cc5e=_[_0xfdd4('0x3f')]({},_0x13cc5e,_0xbf38b4[_0xfdd4('0x41')]);var _0x5bcbc8={'where':_0x13cc5e[_0xfdd4('0x3d')]};return db[_0xfdd4('0x42')][_0xfdd4('0x1b')](_0x5bcbc8)[_0xfdd4('0x23')](function(_0x5173db){_0x374e98[_0xfdd4('0x1b')]=_0x5173db;if(_0xbf38b4[_0xfdd4('0x32')][_0xfdd4('0x43')]){_0x13cc5e[_0xfdd4('0x44')]=[{'all':!![]}];}return db[_0xfdd4('0x42')]['findAll'](_0x13cc5e);})[_0xfdd4('0x23')](function(_0x23af2a){_0x374e98[_0xfdd4('0x45')]=_0x23af2a;return _0x374e98;})[_0xfdd4('0x23')](respondWithFilteredResult(_0x2bb793,_0x13cc5e))[_0xfdd4('0x46')](handleError(_0x2bb793,null));};exports[_0xfdd4('0x47')]=function(_0x3d1051,_0x484cb6){var _0x2dd3fa={'raw':![],'where':{'id':_0x3d1051[_0xfdd4('0x48')]['id']}},_0x586713={};_0x586713[_0xfdd4('0x35')]=_[_0xfdd4('0x49')](db[_0xfdd4('0x42')]['rawAttributes']);_0x586713[_0xfdd4('0x32')]=_[_0xfdd4('0x49')](_0x3d1051['query']);_0x586713[_0xfdd4('0x33')]=_[_0xfdd4('0x34')](_0x586713['model'],_0x586713[_0xfdd4('0x32')]);_0x2dd3fa['attributes']=_['intersection'](_0x586713['model'],qs[_0xfdd4('0x37')](_0x3d1051[_0xfdd4('0x32')][_0xfdd4('0x37')]));_0x2dd3fa['attributes']=_0x2dd3fa[_0xfdd4('0x36')][_0xfdd4('0x38')]?_0x2dd3fa['attributes']:_0x586713[_0xfdd4('0x35')];if(_0x3d1051[_0xfdd4('0x32')][_0xfdd4('0x43')]){_0x2dd3fa[_0xfdd4('0x44')]=[{'all':!![]}];}_0x2dd3fa=_[_0xfdd4('0x3f')]({},_0x2dd3fa,_0x3d1051[_0xfdd4('0x41')]);return db[_0xfdd4('0x42')][_0xfdd4('0x4a')](_0x2dd3fa)[_0xfdd4('0x23')](handleEntityNotFound(_0x484cb6,null))[_0xfdd4('0x23')](respondWithResult(_0x484cb6,null))[_0xfdd4('0x46')](handleError(_0x484cb6,null));};exports[_0xfdd4('0x4b')]=function(_0x300965,_0x3c0ee1){return db['JscriptyProject']['create'](_0x300965[_0xfdd4('0x4c')],{})[_0xfdd4('0x23')](function(_0x1296e6){var _0x1932ef=_0x300965['user'][_0xfdd4('0x25')]({'plain':!![]});if(!_0x1932ef)throw new Error(_0xfdd4('0x4d'));if(_0x1932ef['role']==='user'){var _0x53c66d=_0x1296e6['get']({'plain':!![]});var _0x557cb3=_0xfdd4('0x26');return db[_0xfdd4('0x4e')][_0xfdd4('0x4a')]({'where':{'name':_0x557cb3,'userProfileId':_0x1932ef[_0xfdd4('0x4f')]},'raw':!![]})[_0xfdd4('0x23')](function(_0x49bc61){if(_0x49bc61&&_0x49bc61['autoAssociation']===0x0){return db[_0xfdd4('0x27')][_0xfdd4('0x4b')]({'name':_0x53c66d[_0xfdd4('0x2b')],'resourceId':_0x53c66d['id'],'type':_0x49bc61[_0xfdd4('0x2b')],'sectionId':_0x49bc61['id']},{})['then'](function(){return _0x1296e6;});}else{return _0x1296e6;}})[_0xfdd4('0x46')](function(_0x8aa0ea){logger['error'](_0xfdd4('0x50'),_0x8aa0ea);throw _0x8aa0ea;});}return _0x1296e6;})[_0xfdd4('0x23')](respondWithResult(_0x3c0ee1,0xc9))['catch'](handleError(_0x3c0ee1,null));};exports['clone']=function(_0x2a6c16,_0x3658f7){var _0x18f071={'where':{'id':_0x2a6c16[_0xfdd4('0x48')]['id']}},_0x30ce95={};_0x30ce95[_0xfdd4('0x35')]=_[_0xfdd4('0x49')](db[_0xfdd4('0x42')]['rawAttributes']);_0x18f071[_0xfdd4('0x36')]=_['intersection'](_0x30ce95['model'],qs[_0xfdd4('0x37')](_0x2a6c16[_0xfdd4('0x32')]['fields']));_0x18f071['attributes']=_0x18f071['attributes'][_0xfdd4('0x38')]?_0x18f071[_0xfdd4('0x36')]:_0x30ce95['model'];if(_0x2a6c16[_0xfdd4('0x32')][_0xfdd4('0x43')]){_0x18f071[_0xfdd4('0x44')]=[{'all':!![]}];}_0x18f071=_[_0xfdd4('0x3f')]({},_0x18f071,_0x2a6c16[_0xfdd4('0x41')]);return db['JscriptyProject']['find'](_0x18f071)['then'](handleEntityNotFound(_0x3658f7,null))['then'](function(_0x3e5cb0){if(_0x3e5cb0){var _0x14d07e=_0x3e5cb0['get']({'plain':!![]});_0x14d07e=qs[_0xfdd4('0x51')](_0x14d07e,['id',_0xfdd4('0x52'),'updatedAt']);_0x2a6c16[_0xfdd4('0x4c')]=_[_0xfdd4('0x51')](_0x2a6c16['body'],['id',_0xfdd4('0x52'),_0xfdd4('0x53')]);return db[_0xfdd4('0x42')]['create'](_[_0xfdd4('0x3f')](_0x14d07e,_0x2a6c16[_0xfdd4('0x4c')]),{'include':_0x2a6c16[_0xfdd4('0x32')][_0xfdd4('0x43')]?[{'all':!![]}]:undefined})[_0xfdd4('0x23')](function(_0x562417){var _0x2cc3e2=_0x2a6c16[_0xfdd4('0x54')][_0xfdd4('0x25')]({'plain':!![]});if(!_0x2cc3e2)throw new Error(_0xfdd4('0x4d'));if(_0x2cc3e2[_0xfdd4('0x55')]===_0xfdd4('0x54')){var _0x413576=_0x562417[_0xfdd4('0x25')]({'plain':!![]});var _0x38b58b='Projects';return db[_0xfdd4('0x4e')][_0xfdd4('0x4a')]({'where':{'name':_0x38b58b,'userProfileId':_0x2cc3e2[_0xfdd4('0x4f')]},'raw':!![]})[_0xfdd4('0x23')](function(_0x3096fa){if(_0x3096fa&&_0x3096fa['autoAssociation']===0x0){return db[_0xfdd4('0x27')][_0xfdd4('0x4b')]({'name':_0x413576[_0xfdd4('0x2b')],'resourceId':_0x413576['id'],'type':_0x3096fa[_0xfdd4('0x2b')],'sectionId':_0x3096fa['id']},{})[_0xfdd4('0x23')](function(){return _0x562417;});}else{return _0x562417;}})[_0xfdd4('0x46')](function(_0x180ad9){logger[_0xfdd4('0x29')](_0xfdd4('0x50'),_0x180ad9);throw _0x180ad9;});}return _0x562417;});}})[_0xfdd4('0x23')](respondWithResult(_0x3658f7,0xc9))[_0xfdd4('0x46')](handleError(_0x3658f7,null));};exports[_0xfdd4('0x22')]=function(_0x1205b8,_0x527068){if(_0x1205b8[_0xfdd4('0x4c')]['id']){delete _0x1205b8['body']['id'];}return db[_0xfdd4('0x42')][_0xfdd4('0x4a')]({'where':{'id':_0x1205b8[_0xfdd4('0x48')]['id']}})[_0xfdd4('0x23')](handleEntityNotFound(_0x527068,null))[_0xfdd4('0x23')](saveUpdates(_0x1205b8[_0xfdd4('0x4c')],null))[_0xfdd4('0x23')](respondWithResult(_0x527068,null))[_0xfdd4('0x46')](handleError(_0x527068,null));};exports[_0xfdd4('0x24')]=function(_0x25f01e,_0x5e8d95){return db[_0xfdd4('0x42')]['find']({'where':{'id':_0x25f01e['params']['id']}})['then'](handleEntityNotFound(_0x5e8d95,null))[_0xfdd4('0x23')](removeEntity(_0x5e8d95,null))[_0xfdd4('0x46')](handleError(_0x5e8d95,null));};exports['getSessions']=function(_0x3a367c,_0x3f027b,_0x99d7a4){var _0x3023f8={'raw':!![],'where':{}};var _0x2a3554={};var _0x4b14bf={'count':0x0,'rows':[]};return db[_0xfdd4('0x42')][_0xfdd4('0x56')]({'where':{'id':_0x3a367c[_0xfdd4('0x48')]['id']}})['then'](handleEntityNotFound(_0x3f027b,null))[_0xfdd4('0x23')](function(_0x4e50f2){if(_0x4e50f2){_0x2a3554[_0xfdd4('0x35')]=_[_0xfdd4('0x49')](db[_0xfdd4('0x57')][_0xfdd4('0x2f')]);_0x2a3554['query']=_[_0xfdd4('0x49')](_0x3a367c[_0xfdd4('0x32')]);_0x2a3554['filters']=_[_0xfdd4('0x34')](_0x2a3554[_0xfdd4('0x35')],_0x2a3554[_0xfdd4('0x32')]);_0x3023f8['attributes']=_[_0xfdd4('0x34')](_0x2a3554[_0xfdd4('0x35')],qs[_0xfdd4('0x37')](_0x3a367c['query'][_0xfdd4('0x37')]));_0x3023f8[_0xfdd4('0x36')]=_0x3023f8[_0xfdd4('0x36')][_0xfdd4('0x38')]?_0x3023f8[_0xfdd4('0x36')]:_0x2a3554[_0xfdd4('0x35')];if(!_0x3a367c[_0xfdd4('0x32')]['hasOwnProperty'](_0xfdd4('0x3a'))){_0x3023f8[_0xfdd4('0x1d')]=qs[_0xfdd4('0x1d')](_0x3a367c[_0xfdd4('0x32')][_0xfdd4('0x1d')]);_0x3023f8[_0xfdd4('0x1c')]=qs[_0xfdd4('0x1c')](_0x3a367c[_0xfdd4('0x32')]['offset']);}_0x3023f8[_0xfdd4('0x3b')]=qs['sort'](_0x3a367c['query'][_0xfdd4('0x3c')]);_0x3023f8['where']=qs[_0xfdd4('0x33')](_['pick'](_0x3a367c[_0xfdd4('0x32')],_0x2a3554[_0xfdd4('0x33')]));_0x3023f8[_0xfdd4('0x3d')][_0xfdd4('0x58')]=_0x4e50f2['id'];if(_0x3a367c[_0xfdd4('0x32')][_0xfdd4('0x3e')]){_0x3023f8[_0xfdd4('0x3d')]=_['merge'](_0x3023f8['where'],{'$or':_[_0xfdd4('0x2e')](_0x3023f8['attributes'],function(_0x26c2be){var _0x1a82ee={};_0x1a82ee[_0x26c2be]={'$like':'%'+_0x3a367c[_0xfdd4('0x32')][_0xfdd4('0x3e')]+'%'};return _0x1a82ee;})});}_0x3023f8=_[_0xfdd4('0x3f')]({},_0x3023f8,_0x3a367c[_0xfdd4('0x41')]);return db[_0xfdd4('0x57')]['count']({'where':_0x3023f8['where']})[_0xfdd4('0x23')](function(_0x1eecb7){_0x4b14bf[_0xfdd4('0x1b')]=_0x1eecb7;if(_0x3a367c[_0xfdd4('0x32')][_0xfdd4('0x43')]){_0x3023f8[_0xfdd4('0x44')]=[{'all':!![]}];}return db[_0xfdd4('0x57')][_0xfdd4('0x59')](_0x3023f8);})[_0xfdd4('0x23')](function(_0x45c0cc){_0x4b14bf[_0xfdd4('0x45')]=_0x45c0cc;return _0x4b14bf;});}})[_0xfdd4('0x23')](respondWithFilteredResult(_0x3f027b,_0x3023f8))[_0xfdd4('0x46')](handleError(_0x3f027b,null));};exports['getAnswers']=function(_0x4bb814,_0x3761f2,_0x34760d){var _0x4db05e={'raw':!![],'where':{}};var _0x5854b9={};var _0x22cefd={'count':0x0,'rows':[]};return db[_0xfdd4('0x42')]['findOne']({'where':{'id':_0x4bb814[_0xfdd4('0x48')]['id']}})[_0xfdd4('0x23')](handleEntityNotFound(_0x3761f2,null))[_0xfdd4('0x23')](function(_0x11db43){if(_0x11db43){_0x5854b9[_0xfdd4('0x35')]=_[_0xfdd4('0x49')](db['JscriptyAnswerReport'][_0xfdd4('0x2f')]);_0x5854b9[_0xfdd4('0x32')]=_[_0xfdd4('0x49')](_0x4bb814[_0xfdd4('0x32')]);_0x5854b9[_0xfdd4('0x33')]=_[_0xfdd4('0x34')](_0x5854b9[_0xfdd4('0x35')],_0x5854b9[_0xfdd4('0x32')]);_0x4db05e['attributes']=_['intersection'](_0x5854b9[_0xfdd4('0x35')],qs['fields'](_0x4bb814[_0xfdd4('0x32')][_0xfdd4('0x37')]));_0x4db05e[_0xfdd4('0x36')]=_0x4db05e[_0xfdd4('0x36')][_0xfdd4('0x38')]?_0x4db05e['attributes']:_0x5854b9['model'];if(!_0x4bb814[_0xfdd4('0x32')]['hasOwnProperty'](_0xfdd4('0x3a'))){_0x4db05e['limit']=qs[_0xfdd4('0x1d')](_0x4bb814[_0xfdd4('0x32')][_0xfdd4('0x1d')]);_0x4db05e[_0xfdd4('0x1c')]=qs[_0xfdd4('0x1c')](_0x4bb814[_0xfdd4('0x32')][_0xfdd4('0x1c')]);}_0x4db05e[_0xfdd4('0x3b')]=qs[_0xfdd4('0x3c')](_0x4bb814[_0xfdd4('0x32')][_0xfdd4('0x3c')]);_0x4db05e['where']=qs[_0xfdd4('0x33')](_[_0xfdd4('0x5a')](_0x4bb814[_0xfdd4('0x32')],_0x5854b9[_0xfdd4('0x33')]));_0x4db05e[_0xfdd4('0x3d')][_0xfdd4('0x58')]=_0x11db43['id'];if(_0x4bb814[_0xfdd4('0x32')][_0xfdd4('0x3e')]){_0x4db05e[_0xfdd4('0x3d')]=_['merge'](_0x4db05e['where'],{'$or':_[_0xfdd4('0x2e')](_0x4db05e[_0xfdd4('0x36')],function(_0x30bd32){var _0x4a6500={};_0x4a6500[_0x30bd32]={'$like':'%'+_0x4bb814[_0xfdd4('0x32')][_0xfdd4('0x3e')]+'%'};return _0x4a6500;})});}_0x4db05e=_[_0xfdd4('0x3f')]({},_0x4db05e,_0x4bb814[_0xfdd4('0x41')]);return db['JscriptyAnswerReport']['count']({'where':_0x4db05e[_0xfdd4('0x3d')]})[_0xfdd4('0x23')](function(_0x3b75bf){_0x22cefd['count']=_0x3b75bf;if(_0x4bb814[_0xfdd4('0x32')][_0xfdd4('0x43')]){_0x4db05e[_0xfdd4('0x44')]=[{'all':!![]}];}return db[_0xfdd4('0x5b')][_0xfdd4('0x59')](_0x4db05e);})[_0xfdd4('0x23')](function(_0x524a8f){_0x22cefd['rows']=_0x524a8f;return _0x22cefd;});}})[_0xfdd4('0x23')](respondWithFilteredResult(_0x3761f2,_0x4db05e))[_0xfdd4('0x46')](handleError(_0x3761f2,null));};function char(_0x6a1410){return _0xfdd4('0x5c')===typeof _0x6a1410?String[_0xfdd4('0x5d')][_0xfdd4('0x20')](null,arguments):_0x6a1410;}function needsEncapsulation(_0x46edc9){return!!_0x46edc9&&(_0x46edc9[_0xfdd4('0x5e')]()['indexOf'](char(0xd))>=0x0||_0x46edc9[_0xfdd4('0x5e')]()['indexOf'](char(0xa))>=0x0||_0x46edc9[_0xfdd4('0x5e')]()[_0xfdd4('0x5f')](char(0x2c))>=0x0||_0x46edc9['toString']()[_0xfdd4('0x5f')](char(0x22))>=0x0);}function encapsulate(_0x221ac8){var _0x163426=char(0x22),_0x2e0001='\x5c'+char(0x22),_0x3cd7ae=_0x221ac8[_0xfdd4('0x5e')]()[_0xfdd4('0x60')](new RegExp(_0x163426,'g'),_0x2e0001);return _0x163426+_0x3cd7ae+_0x163426;}exports[_0xfdd4('0x61')]=function(_0xcc0684,_0x4824b4,_0x391a25){var _0x573bc9,_0x24c2b4;var _0x585799={'where':{'ProjectId':_0xcc0684['params']['id']}};if(_0xcc0684[_0xfdd4('0x32')][_0xfdd4('0x62')]){_0x585799[_0xfdd4('0x3d')][_0xfdd4('0x63')]=JSON[_0xfdd4('0x64')](_0xcc0684['query'][_0xfdd4('0x62')]);}return db[_0xfdd4('0x57')][_0xfdd4('0x59')](_0x585799)[_0xfdd4('0x23')](handleEntityNotFound(_0x4824b4,null))[_0xfdd4('0x23')](function(_0x1c69de){if(_0x1c69de){_0x573bc9=_0x1c69de;return db['JscriptyQuestionReport'][_0xfdd4('0x59')]({'where':{'SessionId':{'$in':_[_0xfdd4('0x2e')](_0x573bc9,'id')},'ProjectId':_0xcc0684['params']['id']},'order':'-createdAt'});}})[_0xfdd4('0x23')](handleEntityNotFound(_0x4824b4,null))[_0xfdd4('0x23')](function(_0x10a995){if(_0x10a995){_0x24c2b4=_0x10a995;var _0x4f38c0={};for(var _0x5c8ce7=0x0,_0x178f97=_0x24c2b4[_0xfdd4('0x38')];_0x5c8ce7<_0x178f97;_0x5c8ce7++){if(!_0x4f38c0[_0xfdd4('0x39')](_0x24c2b4[_0x5c8ce7]['questionId'])){_0x4f38c0[_0x24c2b4[_0x5c8ce7]['questionId']]=needsEncapsulation(_0x24c2b4[_0x5c8ce7][_0xfdd4('0x65')])?encapsulate(_0x24c2b4[_0x5c8ce7][_0xfdd4('0x65')]):_0x24c2b4[_0x5c8ce7][_0xfdd4('0x65')];}}var _0x4bfb31=[],_0x323cf9={};for(var _0x5bf1dc=0x0,_0xcc65da=_0x573bc9[_0xfdd4('0x38')];_0x5bf1dc<_0xcc65da;_0x5bf1dc++){_0x323cf9={'ProjectId':_0xcc0684[_0xfdd4('0x48')]['id'],'SessionId':_0x573bc9[_0x5bf1dc]['id'],'StartTime':moment(_0x573bc9[_0x5bf1dc]['starttime'])[_0xfdd4('0x66')](_0xfdd4('0x67'))};for(var _0x1efb08=0x0,_0xe3296c=_0x24c2b4[_0xfdd4('0x38')];_0x1efb08<_0xe3296c;_0x1efb08++){if(_0x24c2b4[_0x1efb08]['SessionId']==_0x573bc9[_0x5bf1dc]['id']&&_0x4f38c0[_0xfdd4('0x39')](_0x24c2b4[_0x1efb08][_0xfdd4('0x68')])){_0x323cf9[_0x4f38c0[_0x24c2b4[_0x1efb08][_0xfdd4('0x68')]]]=_0x24c2b4[_0x1efb08]['answer'];}}for(var _0x8dfcb3 in _0x4f38c0){if(!_0x323cf9[_0xfdd4('0x39')](_0x4f38c0[_0x8dfcb3])){_0x323cf9[_0x4f38c0[_0x8dfcb3]]=null;}}_0x4bfb31[_0xfdd4('0x69')](_0x323cf9);}return _0x4bfb31;}})[_0xfdd4('0x23')](function(_0x56e5d3){if(!_[_0xfdd4('0x6a')](_0x56e5d3)){var _0x481c65=toCsv(_0x56e5d3);var _0x4f5ca3=Date['now']();fs[_0xfdd4('0x6b')](util['format']('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0xcc0684['params']['id'],_0x4f5ca3),_0x481c65);_0x4824b4[_0xfdd4('0x6c')](_0xfdd4('0x6d'),_0xfdd4('0x6e')+util[_0xfdd4('0x66')](_0xfdd4('0x6f'),_0xcc0684[_0xfdd4('0x48')]['id'],_0x4f5ca3));_0x4824b4[_0xfdd4('0x6c')](_0xfdd4('0x70'),_0xfdd4('0x71'));return _0x4824b4[_0xfdd4('0x72')](util[_0xfdd4('0x66')](_0xfdd4('0x73'),_0xcc0684[_0xfdd4('0x48')]['id'],_0x4f5ca3));}else{return _0x4824b4[_0xfdd4('0x28')](0xcc);}})[_0xfdd4('0x46')](handleError(_0x4824b4,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 8f53403..6d8457d 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 _0x39c7=['../../config/environment','./jscriptyProject.attributes','define','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x188267,_0x1fe004){var _0xc96226=function(_0x491f20){while(--_0x491f20){_0x188267['push'](_0x188267['shift']());}};_0xc96226(++_0x1fe004);}(_0x39c7,0x85));var _0x739c=function(_0x240d8c,_0x979f5){_0x240d8c=_0x240d8c-0x0;var _0x4e0720=_0x39c7[_0x240d8c];return _0x4e0720;};'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')]('JscriptyProject',attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4a9c=['bluebird','path','rimraf','../../config/environment','define','JscriptyProject','lodash','util','../../config/logger','api','moment'];(function(_0x540c8e,_0xa9c198){var _0x128c20=function(_0x9ebe99){while(--_0x9ebe99){_0x540c8e['push'](_0x540c8e['shift']());}};_0x128c20(++_0xa9c198);}(_0x4a9c,0xcc));var _0xc4a9=function(_0x26686c,_0xaa95b5){_0x26686c=_0x26686c-0x0;var _0x2de3e6=_0x4a9c[_0x26686c];return _0x2de3e6;};'use strict';var _=require(_0xc4a9('0x0'));var util=require(_0xc4a9('0x1'));var logger=require(_0xc4a9('0x2'))(_0xc4a9('0x3'));var moment=require(_0xc4a9('0x4'));var BPromise=require(_0xc4a9('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc4a9('0x6'));var rimraf=require(_0xc4a9('0x7'));var config=require(_0xc4a9('0x8'));var attributes=require('./jscriptyProject.attributes');module['exports']=function(_0x95d3f6,_0x2f35e4){return _0x95d3f6[_0xc4a9('0x9')](_0xc4a9('0xa'),attributes,{'tableName':'jscripty_projects','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 c003964..ea6b9f1 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 _0xd8b0=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis'];(function(_0xc81f5f,_0x181205){var _0x4410dc=function(_0x3cf9a5){while(--_0x3cf9a5){_0xc81f5f['push'](_0xc81f5f['shift']());}};_0x4410dc(++_0x181205);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});} \ No newline at end of file +var _0x0713=['JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\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(_0x2c11d6,_0x481432){var _0x55bfa9=function(_0x476b10){while(--_0x476b10){_0x2c11d6['push'](_0x2c11d6['shift']());}};_0x55bfa9(++_0x481432);}(_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')]('JscriptyProject,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('JscriptyProject,\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')]('JscriptyProject,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index d053866..ed93eb7 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 _0xa5eb=['../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','update','delete','destroy','exports','util','path','express','Router','../../components/interaction/service'];(function(_0x26395c,_0x84e61){var _0x5833a4=function(_0x560a13){while(--_0x560a13){_0x26395c['push'](_0x26395c['shift']());}};_0x5833a4(++_0x84e61);}(_0xa5eb,0x163));var _0xba5e=function(_0x41feed,_0x588deb){_0x41feed=_0x41feed-0x0;var _0x2aef03=_0xa5eb[_0x41feed];return _0x2aef03;};'use strict';var multer=require('multer');var util=require(_0xba5e('0x0'));var path=require(_0xba5e('0x1'));var timeout=require('connect-timeout');var express=require(_0xba5e('0x2'));var router=express[_0xba5e('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xba5e('0x4'));var config=require(_0xba5e('0x5'));var controller=require(_0xba5e('0x6'));router[_0xba5e('0x7')]('/',auth[_0xba5e('0x8')](),controller[_0xba5e('0x9')]);router[_0xba5e('0x7')](_0xba5e('0xa'),auth['isAuthenticated'](),controller[_0xba5e('0xb')]);router[_0xba5e('0x7')]('/:id',auth[_0xba5e('0x8')](),controller[_0xba5e('0xc')]);router[_0xba5e('0xd')]('/',auth[_0xba5e('0x8')](),controller[_0xba5e('0xe')]);router[_0xba5e('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xba5e('0x10')]);router[_0xba5e('0x11')]('/:id',auth[_0xba5e('0x8')](),controller[_0xba5e('0x12')]);module[_0xba5e('0x13')]=router; \ No newline at end of file +var _0x8bc1=['isAuthenticated','describe','show','post','create','put','/:id','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x8bc1,0x1ae));var _0x18bc=function(_0x8fd62a,_0x18203d){_0x8fd62a=_0x8fd62a-0x0;var _0x2354bc=_0x8bc1[_0x8fd62a];return _0x2354bc;};'use strict';var multer=require(_0x18bc('0x0'));var util=require('util');var path=require(_0x18bc('0x1'));var timeout=require('connect-timeout');var express=require(_0x18bc('0x2'));var router=express[_0x18bc('0x3')]();var fs_extra=require(_0x18bc('0x4'));var auth=require(_0x18bc('0x5'));var interaction=require(_0x18bc('0x6'));var config=require(_0x18bc('0x7'));var controller=require('./jscriptyQuestionReport.controller');router[_0x18bc('0x8')]('/',auth['isAuthenticated'](),controller[_0x18bc('0x9')]);router[_0x18bc('0x8')]('/describe',auth[_0x18bc('0xa')](),controller[_0x18bc('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x18bc('0xc')]);router[_0x18bc('0xd')]('/',auth[_0x18bc('0xa')](),controller[_0x18bc('0xe')]);router[_0x18bc('0xf')](_0x18bc('0x10'),auth['isAuthenticated'](),controller['update']);router[_0x18bc('0x11')](_0x18bc('0x10'),auth['isAuthenticated'](),controller[_0x18bc('0x12')]);module[_0x18bc('0x13')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 998db2b..69a6e29 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(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0x7a54,0x106));var _0x47a5=function(_0x317588,_0x4298ca){_0x317588=_0x317588-0x0;var _0x288c55=_0x7a54[_0x317588];return _0x288c55;};'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(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x7a54,0x106));var _0x47a5=function(_0x52f370,_0x476754){_0x52f370=_0x52f370-0x0;var _0x3db654=_0x7a54[_0x52f370];return _0x3db654;};'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 675c0bd..d478905 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 _0x0e6c=['rawAttributes','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','JscriptyQuestionReport','count','includeAll','include','findAll','catch','show','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','Content-Range','apply','save','update','then','error','stack','name','send','index','map'];(function(_0x1b9ecf,_0x415e21){var _0xa6706e=function(_0x4b8c49){while(--_0x4b8c49){_0x1b9ecf['push'](_0x1b9ecf['shift']());}};_0xa6706e(++_0x415e21);}(_0x0e6c,0x6b));var _0xc0e6=function(_0x12db36,_0x2f535d){_0x12db36=_0x12db36-0x0;var _0x1b5d9e=_0x0e6c[_0x12db36];return _0x1b5d9e;};'use strict';var emlformat=require(_0xc0e6('0x0'));var rimraf=require(_0xc0e6('0x1'));var zipdir=require(_0xc0e6('0x2'));var jsonpatch=require(_0xc0e6('0x3'));var rp=require(_0xc0e6('0x4'));var moment=require('moment');var BPromise=require(_0xc0e6('0x5'));var Mustache=require(_0xc0e6('0x6'));var util=require(_0xc0e6('0x7'));var path=require(_0xc0e6('0x8'));var sox=require(_0xc0e6('0x9'));var csv=require(_0xc0e6('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc0e6('0xb'));var _=require(_0xc0e6('0xc'));var squel=require(_0xc0e6('0xd'));var crypto=require(_0xc0e6('0xe'));var jsforce=require(_0xc0e6('0xf'));var deskjs=require(_0xc0e6('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc0e6('0x11'));var Redis=require(_0xc0e6('0x12'));var authService=require(_0xc0e6('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xc0e6('0x14'));var hardwareService=require(_0xc0e6('0x15'));var logger=require('../../config/logger')(_0xc0e6('0x16'));var utils=require(_0xc0e6('0x17'));var config=require(_0xc0e6('0x18'));var licenseUtil=require(_0xc0e6('0x19'));var db=require(_0xc0e6('0x1a'))['db'];function respondWithStatusCode(_0x8b0171,_0x1a9950){_0x1a9950=_0x1a9950||0xcc;return function(_0xc255ce){if(_0xc255ce){return _0x8b0171[_0xc0e6('0x1b')](_0x1a9950);}return _0x8b0171[_0xc0e6('0x1c')](_0x1a9950)[_0xc0e6('0x1d')]();};}function respondWithResult(_0x320bb1,_0x27c414){_0x27c414=_0x27c414||0xc8;return function(_0x592771){if(_0x592771){return _0x320bb1[_0xc0e6('0x1c')](_0x27c414)[_0xc0e6('0x1e')](_0x592771);}};}function respondWithFilteredResult(_0x2f5aed,_0x242291){return function(_0x1c3de8){if(_0x1c3de8){var _0x4e3163=typeof _0x242291['offset']===_0xc0e6('0x1f')&&typeof _0x242291[_0xc0e6('0x20')]===_0xc0e6('0x1f');var _0x14c752=_0x1c3de8['count'];var _0x1578ce=_0x4e3163?0x0:_0x242291[_0xc0e6('0x21')];var _0x25434b=_0x4e3163?_0x1c3de8['count']:_0x242291[_0xc0e6('0x21')]+_0x242291['limit'];var _0x2c04e1;if(_0x25434b>=_0x14c752){_0x25434b=_0x14c752;_0x2c04e1=0xc8;}else{_0x2c04e1=0xce;}_0x2f5aed[_0xc0e6('0x1c')](_0x2c04e1);return _0x2f5aed['set'](_0xc0e6('0x22'),_0x1578ce+'-'+_0x25434b+'/'+_0x14c752)[_0xc0e6('0x1e')](_0x1c3de8);}return null;};}function patchUpdates(_0x159fc8){return function(_0x2231d3){try{jsonpatch[_0xc0e6('0x23')](_0x2231d3,_0x159fc8,!![]);}catch(_0x5e8772){return BPromise['reject'](_0x5e8772);}return _0x2231d3[_0xc0e6('0x24')]();};}function saveUpdates(_0x6c9d1e,_0x298423){return function(_0x2ca08a){if(_0x2ca08a){return _0x2ca08a[_0xc0e6('0x25')](_0x6c9d1e)[_0xc0e6('0x26')](function(_0x52ed32){return _0x52ed32;});}return null;};}function removeEntity(_0x1ad67a,_0x1170a3){return function(_0x3ccdd4){if(_0x3ccdd4){return _0x3ccdd4['destroy']()[_0xc0e6('0x26')](function(){_0x1ad67a[_0xc0e6('0x1c')](0xcc)[_0xc0e6('0x1d')]();});}};}function handleEntityNotFound(_0xfcd8e0,_0x47d72f){return function(_0x3bec62){if(!_0x3bec62){_0xfcd8e0[_0xc0e6('0x1b')](0x194);}return _0x3bec62;};}function handleError(_0x3bab25,_0x3bb42a){_0x3bb42a=_0x3bb42a||0x1f4;return function(_0xe0210a){logger[_0xc0e6('0x27')](_0xe0210a[_0xc0e6('0x28')]);if(_0xe0210a[_0xc0e6('0x29')]){delete _0xe0210a[_0xc0e6('0x29')];}_0x3bab25[_0xc0e6('0x1c')](_0x3bb42a)[_0xc0e6('0x2a')](_0xe0210a);};}exports[_0xc0e6('0x2b')]=function(_0x4bb7f6,_0x424d61){var _0x15bbd2={},_0x28bc53={},_0x2cd26b={'count':0x0,'rows':[]};var _0x4d14ec=_[_0xc0e6('0x2c')](db['JscriptyQuestionReport'][_0xc0e6('0x2d')],function(_0x2d8ecc){return{'name':_0x2d8ecc['fieldName'],'type':_0x2d8ecc[_0xc0e6('0x2e')]['key']};});_0x28bc53['model']=_[_0xc0e6('0x2c')](_0x4d14ec,_0xc0e6('0x29'));_0x28bc53[_0xc0e6('0x2f')]=_[_0xc0e6('0x30')](_0x4bb7f6[_0xc0e6('0x2f')]);_0x28bc53[_0xc0e6('0x31')]=_[_0xc0e6('0x32')](_0x28bc53[_0xc0e6('0x33')],_0x28bc53[_0xc0e6('0x2f')]);_0x15bbd2[_0xc0e6('0x34')]=_[_0xc0e6('0x32')](_0x28bc53[_0xc0e6('0x33')],qs['fields'](_0x4bb7f6[_0xc0e6('0x2f')][_0xc0e6('0x35')]));_0x15bbd2[_0xc0e6('0x34')]=_0x15bbd2[_0xc0e6('0x34')][_0xc0e6('0x36')]?_0x15bbd2[_0xc0e6('0x34')]:_0x28bc53[_0xc0e6('0x33')];if(!_0x4bb7f6[_0xc0e6('0x2f')][_0xc0e6('0x37')](_0xc0e6('0x38'))){_0x15bbd2[_0xc0e6('0x20')]=qs[_0xc0e6('0x20')](_0x4bb7f6[_0xc0e6('0x2f')]['limit']);_0x15bbd2['offset']=qs['offset'](_0x4bb7f6[_0xc0e6('0x2f')][_0xc0e6('0x21')]);}_0x15bbd2[_0xc0e6('0x39')]=qs[_0xc0e6('0x3a')](_0x4bb7f6[_0xc0e6('0x2f')][_0xc0e6('0x3a')]);_0x15bbd2['where']=qs[_0xc0e6('0x31')](_[_0xc0e6('0x3b')](_0x4bb7f6[_0xc0e6('0x2f')],_0x28bc53[_0xc0e6('0x31')]),_0x4d14ec);if(_0x4bb7f6['query'][_0xc0e6('0x3c')]){_0x15bbd2[_0xc0e6('0x3d')]=_[_0xc0e6('0x3e')](_0x15bbd2[_0xc0e6('0x3d')],{'$or':_[_0xc0e6('0x2c')](_0x4d14ec,function(_0x5ae516){if(_0x5ae516['type']!=='VIRTUAL'){var _0x35e5ee={};_0x35e5ee[_0x5ae516[_0xc0e6('0x29')]]={'$like':'%'+_0x4bb7f6[_0xc0e6('0x2f')][_0xc0e6('0x3c')]+'%'};return _0x35e5ee;}})});}_0x15bbd2=_[_0xc0e6('0x3e')]({},_0x15bbd2,_0x4bb7f6[_0xc0e6('0x3f')]);var _0x5a0d82={'where':_0x15bbd2[_0xc0e6('0x3d')]};return db[_0xc0e6('0x40')][_0xc0e6('0x41')](_0x5a0d82)['then'](function(_0x4f6ff7){_0x2cd26b[_0xc0e6('0x41')]=_0x4f6ff7;if(_0x4bb7f6[_0xc0e6('0x2f')][_0xc0e6('0x42')]){_0x15bbd2[_0xc0e6('0x43')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0xc0e6('0x44')](_0x15bbd2);})[_0xc0e6('0x26')](function(_0x328ed6){_0x2cd26b['rows']=_0x328ed6;return _0x2cd26b;})[_0xc0e6('0x26')](respondWithFilteredResult(_0x424d61,_0x15bbd2))[_0xc0e6('0x45')](handleError(_0x424d61,null));};exports[_0xc0e6('0x46')]=function(_0x1e29b2,_0x15bb2e){var _0x5be3e7={'raw':!![],'where':{'id':_0x1e29b2['params']['id']}},_0x4b6908={};_0x4b6908[_0xc0e6('0x33')]=_[_0xc0e6('0x30')](db[_0xc0e6('0x40')][_0xc0e6('0x2d')]);_0x4b6908[_0xc0e6('0x2f')]=_[_0xc0e6('0x30')](_0x1e29b2[_0xc0e6('0x2f')]);_0x4b6908[_0xc0e6('0x31')]=_[_0xc0e6('0x32')](_0x4b6908['model'],_0x4b6908[_0xc0e6('0x2f')]);_0x5be3e7[_0xc0e6('0x34')]=_[_0xc0e6('0x32')](_0x4b6908['model'],qs['fields'](_0x1e29b2[_0xc0e6('0x2f')][_0xc0e6('0x35')]));_0x5be3e7[_0xc0e6('0x34')]=_0x5be3e7[_0xc0e6('0x34')][_0xc0e6('0x36')]?_0x5be3e7[_0xc0e6('0x34')]:_0x4b6908[_0xc0e6('0x33')];if(_0x1e29b2[_0xc0e6('0x2f')][_0xc0e6('0x42')]){_0x5be3e7[_0xc0e6('0x43')]=[{'all':!![]}];}_0x5be3e7=_['merge']({},_0x5be3e7,_0x1e29b2[_0xc0e6('0x3f')]);return db[_0xc0e6('0x40')][_0xc0e6('0x47')](_0x5be3e7)[_0xc0e6('0x26')](handleEntityNotFound(_0x15bb2e,null))['then'](respondWithResult(_0x15bb2e,null))['catch'](handleError(_0x15bb2e,null));};exports[_0xc0e6('0x48')]=function(_0x2194d,_0x43b209){return db['JscriptyQuestionReport']['create'](_0x2194d[_0xc0e6('0x49')],{})[_0xc0e6('0x26')](respondWithResult(_0x43b209,0xc9))['catch'](handleError(_0x43b209,null));};exports['update']=function(_0x37ecef,_0x1e9d06){if(_0x37ecef[_0xc0e6('0x49')]['id']){delete _0x37ecef[_0xc0e6('0x49')]['id'];}return db[_0xc0e6('0x40')][_0xc0e6('0x47')]({'where':{'id':_0x37ecef['params']['id']}})[_0xc0e6('0x26')](handleEntityNotFound(_0x1e9d06,null))[_0xc0e6('0x26')](saveUpdates(_0x37ecef[_0xc0e6('0x49')],null))[_0xc0e6('0x26')](respondWithResult(_0x1e9d06,null))[_0xc0e6('0x45')](handleError(_0x1e9d06,null));};exports[_0xc0e6('0x4a')]=function(_0x1093e2,_0x4d8339){return db['JscriptyQuestionReport'][_0xc0e6('0x47')]({'where':{'id':_0x1093e2['params']['id']}})[_0xc0e6('0x26')](handleEntityNotFound(_0x4d8339,null))[_0xc0e6('0x26')](removeEntity(_0x4d8339,null))[_0xc0e6('0x45')](handleError(_0x4d8339,null));};exports[_0xc0e6('0x4b')]=function(_0x53e8ef,_0x462d40){return db[_0xc0e6('0x40')][_0xc0e6('0x4b')]()[_0xc0e6('0x26')](respondWithResult(_0x462d40,null))[_0xc0e6('0x45')](handleError(_0x462d40,null));}; \ No newline at end of file +var _0xc376=['ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../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','JscriptyQuestionReport','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','type','VIRTUAL','filter','merge','options','includeAll','include','findAll','show','params','rawAttributes','find','create','catch','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv'];(function(_0x3e3ecf,_0x560108){var _0x37f7c1=function(_0x46e4f2){while(--_0x46e4f2){_0x3e3ecf['push'](_0x3e3ecf['shift']());}};_0x37f7c1(++_0x560108);}(_0xc376,0x117));var _0x6c37=function(_0x239b31,_0x44a64d){_0x239b31=_0x239b31-0x0;var _0x41c8be=_0xc376[_0x239b31];return _0x41c8be;};'use strict';var emlformat=require(_0x6c37('0x0'));var rimraf=require(_0x6c37('0x1'));var zipdir=require(_0x6c37('0x2'));var jsonpatch=require(_0x6c37('0x3'));var rp=require(_0x6c37('0x4'));var moment=require(_0x6c37('0x5'));var BPromise=require(_0x6c37('0x6'));var Mustache=require(_0x6c37('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x6c37('0x8'));var ejs=require(_0x6c37('0x9'));var fs=require('fs');var fs_extra=require(_0x6c37('0xa'));var _=require(_0x6c37('0xb'));var squel=require(_0x6c37('0xc'));var crypto=require(_0x6c37('0xd'));var jsforce=require(_0x6c37('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x6c37('0x8'));var querystring=require(_0x6c37('0xf'));var Papa=require(_0x6c37('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6c37('0x11'));var hardwareService=require(_0x6c37('0x12'));var logger=require(_0x6c37('0x13'))('api');var utils=require(_0x6c37('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x6c37('0x15'));var db=require(_0x6c37('0x16'))['db'];function respondWithStatusCode(_0x4edaf0,_0x3ce3bb){_0x3ce3bb=_0x3ce3bb||0xcc;return function(_0x9f31d5){if(_0x9f31d5){return _0x4edaf0[_0x6c37('0x17')](_0x3ce3bb);}return _0x4edaf0[_0x6c37('0x18')](_0x3ce3bb)[_0x6c37('0x19')]();};}function respondWithResult(_0x46c2c4,_0x4d9f76){_0x4d9f76=_0x4d9f76||0xc8;return function(_0x5b1bf1){if(_0x5b1bf1){return _0x46c2c4[_0x6c37('0x18')](_0x4d9f76)[_0x6c37('0x1a')](_0x5b1bf1);}};}function respondWithFilteredResult(_0x5d6e4b,_0x71fb07){return function(_0x3a5f09){if(_0x3a5f09){var _0x2435ff=typeof _0x71fb07[_0x6c37('0x1b')]===_0x6c37('0x1c')&&typeof _0x71fb07[_0x6c37('0x1d')]===_0x6c37('0x1c');var _0x51ac20=_0x3a5f09[_0x6c37('0x1e')];var _0x23bcec=_0x2435ff?0x0:_0x71fb07['offset'];var _0x34423c=_0x2435ff?_0x3a5f09[_0x6c37('0x1e')]:_0x71fb07[_0x6c37('0x1b')]+_0x71fb07[_0x6c37('0x1d')];var _0x2fddee;if(_0x34423c>=_0x51ac20){_0x34423c=_0x51ac20;_0x2fddee=0xc8;}else{_0x2fddee=0xce;}_0x5d6e4b['status'](_0x2fddee);return _0x5d6e4b['set'](_0x6c37('0x1f'),_0x23bcec+'-'+_0x34423c+'/'+_0x51ac20)[_0x6c37('0x1a')](_0x3a5f09);}return null;};}function patchUpdates(_0x1a63af){return function(_0x25d7ef){try{jsonpatch[_0x6c37('0x20')](_0x25d7ef,_0x1a63af,!![]);}catch(_0x399abd){return BPromise[_0x6c37('0x21')](_0x399abd);}return _0x25d7ef[_0x6c37('0x22')]();};}function saveUpdates(_0x56734b,_0x414f70){return function(_0x1c82b9){if(_0x1c82b9){return _0x1c82b9[_0x6c37('0x23')](_0x56734b)[_0x6c37('0x24')](function(_0x3915c5){return _0x3915c5;});}return null;};}function removeEntity(_0x3bfbd1,_0x402b94){return function(_0x2bee79){if(_0x2bee79){return _0x2bee79[_0x6c37('0x25')]()[_0x6c37('0x24')](function(){_0x3bfbd1[_0x6c37('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b531f,_0x37c3de){return function(_0x2a7d0b){if(!_0x2a7d0b){_0x4b531f[_0x6c37('0x17')](0x194);}return _0x2a7d0b;};}function handleError(_0x2daf37,_0x5e269e){_0x5e269e=_0x5e269e||0x1f4;return function(_0x3eee96){logger[_0x6c37('0x26')](_0x3eee96['stack']);if(_0x3eee96[_0x6c37('0x27')]){delete _0x3eee96[_0x6c37('0x27')];}_0x2daf37['status'](_0x5e269e)[_0x6c37('0x28')](_0x3eee96);};}exports[_0x6c37('0x29')]=function(_0x40291e,_0xed2bf3){var _0x35bcf5={},_0xdf3290={},_0x16d2a0={'count':0x0,'rows':[]};var _0x5e361f=_[_0x6c37('0x2a')](db[_0x6c37('0x2b')]['rawAttributes'],function(_0x4581c8){return{'name':_0x4581c8['fieldName'],'type':_0x4581c8['type'][_0x6c37('0x2c')]};});_0xdf3290[_0x6c37('0x2d')]=_['map'](_0x5e361f,_0x6c37('0x27'));_0xdf3290[_0x6c37('0x2e')]=_[_0x6c37('0x2f')](_0x40291e[_0x6c37('0x2e')]);_0xdf3290[_0x6c37('0x30')]=_[_0x6c37('0x31')](_0xdf3290[_0x6c37('0x2d')],_0xdf3290[_0x6c37('0x2e')]);_0x35bcf5[_0x6c37('0x32')]=_['intersection'](_0xdf3290[_0x6c37('0x2d')],qs[_0x6c37('0x33')](_0x40291e['query'][_0x6c37('0x33')]));_0x35bcf5[_0x6c37('0x32')]=_0x35bcf5[_0x6c37('0x32')][_0x6c37('0x34')]?_0x35bcf5[_0x6c37('0x32')]:_0xdf3290['model'];if(!_0x40291e[_0x6c37('0x2e')]['hasOwnProperty'](_0x6c37('0x35'))){_0x35bcf5[_0x6c37('0x1d')]=qs['limit'](_0x40291e[_0x6c37('0x2e')]['limit']);_0x35bcf5[_0x6c37('0x1b')]=qs['offset'](_0x40291e[_0x6c37('0x2e')][_0x6c37('0x1b')]);}_0x35bcf5['order']=qs['sort'](_0x40291e[_0x6c37('0x2e')][_0x6c37('0x36')]);_0x35bcf5[_0x6c37('0x37')]=qs['filters'](_['pick'](_0x40291e[_0x6c37('0x2e')],_0xdf3290[_0x6c37('0x30')]),_0x5e361f);if(_0x40291e['query']['filter']){_0x35bcf5[_0x6c37('0x37')]=_['merge'](_0x35bcf5['where'],{'$or':_[_0x6c37('0x2a')](_0x5e361f,function(_0x225e03){if(_0x225e03[_0x6c37('0x38')]!==_0x6c37('0x39')){var _0x2cc2df={};_0x2cc2df[_0x225e03[_0x6c37('0x27')]]={'$like':'%'+_0x40291e['query'][_0x6c37('0x3a')]+'%'};return _0x2cc2df;}})});}_0x35bcf5=_[_0x6c37('0x3b')]({},_0x35bcf5,_0x40291e[_0x6c37('0x3c')]);var _0x634e6f={'where':_0x35bcf5[_0x6c37('0x37')]};return db[_0x6c37('0x2b')][_0x6c37('0x1e')](_0x634e6f)[_0x6c37('0x24')](function(_0x53f6bc){_0x16d2a0[_0x6c37('0x1e')]=_0x53f6bc;if(_0x40291e[_0x6c37('0x2e')][_0x6c37('0x3d')]){_0x35bcf5[_0x6c37('0x3e')]=[{'all':!![]}];}return db[_0x6c37('0x2b')][_0x6c37('0x3f')](_0x35bcf5);})[_0x6c37('0x24')](function(_0x2ed82b){_0x16d2a0['rows']=_0x2ed82b;return _0x16d2a0;})['then'](respondWithFilteredResult(_0xed2bf3,_0x35bcf5))['catch'](handleError(_0xed2bf3,null));};exports[_0x6c37('0x40')]=function(_0x43a24f,_0x2b1ba3){var _0x54453b={'raw':!![],'where':{'id':_0x43a24f[_0x6c37('0x41')]['id']}},_0x52e33={};_0x52e33[_0x6c37('0x2d')]=_[_0x6c37('0x2f')](db[_0x6c37('0x2b')][_0x6c37('0x42')]);_0x52e33[_0x6c37('0x2e')]=_['keys'](_0x43a24f[_0x6c37('0x2e')]);_0x52e33['filters']=_['intersection'](_0x52e33[_0x6c37('0x2d')],_0x52e33[_0x6c37('0x2e')]);_0x54453b[_0x6c37('0x32')]=_[_0x6c37('0x31')](_0x52e33[_0x6c37('0x2d')],qs[_0x6c37('0x33')](_0x43a24f[_0x6c37('0x2e')][_0x6c37('0x33')]));_0x54453b[_0x6c37('0x32')]=_0x54453b['attributes'][_0x6c37('0x34')]?_0x54453b[_0x6c37('0x32')]:_0x52e33[_0x6c37('0x2d')];if(_0x43a24f[_0x6c37('0x2e')][_0x6c37('0x3d')]){_0x54453b[_0x6c37('0x3e')]=[{'all':!![]}];}_0x54453b=_[_0x6c37('0x3b')]({},_0x54453b,_0x43a24f[_0x6c37('0x3c')]);return db[_0x6c37('0x2b')][_0x6c37('0x43')](_0x54453b)[_0x6c37('0x24')](handleEntityNotFound(_0x2b1ba3,null))['then'](respondWithResult(_0x2b1ba3,null))['catch'](handleError(_0x2b1ba3,null));};exports[_0x6c37('0x44')]=function(_0x1a9c1b,_0x401c8b){return db[_0x6c37('0x2b')][_0x6c37('0x44')](_0x1a9c1b['body'],{})[_0x6c37('0x24')](respondWithResult(_0x401c8b,0xc9))[_0x6c37('0x45')](handleError(_0x401c8b,null));};exports[_0x6c37('0x23')]=function(_0x32ffc0,_0x4c04ec){if(_0x32ffc0[_0x6c37('0x46')]['id']){delete _0x32ffc0['body']['id'];}return db[_0x6c37('0x2b')][_0x6c37('0x43')]({'where':{'id':_0x32ffc0['params']['id']}})[_0x6c37('0x24')](handleEntityNotFound(_0x4c04ec,null))['then'](saveUpdates(_0x32ffc0[_0x6c37('0x46')],null))[_0x6c37('0x24')](respondWithResult(_0x4c04ec,null))[_0x6c37('0x45')](handleError(_0x4c04ec,null));};exports['destroy']=function(_0x385a3c,_0x2e2f54){return db['JscriptyQuestionReport'][_0x6c37('0x43')]({'where':{'id':_0x385a3c['params']['id']}})[_0x6c37('0x24')](handleEntityNotFound(_0x2e2f54,null))['then'](removeEntity(_0x2e2f54,null))[_0x6c37('0x45')](handleError(_0x2e2f54,null));};exports[_0x6c37('0x47')]=function(_0x4fee30,_0x1e86c2){return db[_0x6c37('0x2b')][_0x6c37('0x47')]()['then'](respondWithResult(_0x1e86c2,null))[_0x6c37('0x45')](handleError(_0x1e86c2,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 988c660..7271c4a 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 _0x3755=['rimraf','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3755,0xa1));var _0x5375=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x3755[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x5375('0x0'));var util=require(_0x5375('0x1'));var logger=require(_0x5375('0x2'))(_0x5375('0x3'));var moment=require(_0x5375('0x4'));var BPromise=require(_0x5375('0x5'));var rp=require(_0x5375('0x6'));var fs=require('fs');var path=require(_0x5375('0x7'));var rimraf=require(_0x5375('0x8'));var config=require('../../config/environment');var attributes=require(_0x5375('0x9'));module[_0x5375('0xa')]=function(_0x3f8930,_0x3a10b0){return _0x3f8930[_0x5375('0xb')](_0x5375('0xc'),attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5351=['moment','request-promise','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','define','JscriptyQuestionReport','report_jscripty_questions','lodash','util','api'];(function(_0x3b2cda,_0x2257a7){var _0x59708d=function(_0x161b93){while(--_0x161b93){_0x3b2cda['push'](_0x3b2cda['shift']());}};_0x59708d(++_0x2257a7);}(_0x5351,0xad));var _0x1535=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x5351[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x1535('0x0'));var util=require(_0x1535('0x1'));var logger=require('../../config/logger')(_0x1535('0x2'));var moment=require(_0x1535('0x3'));var BPromise=require('bluebird');var rp=require(_0x1535('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1535('0x5'));var config=require(_0x1535('0x6'));var attributes=require(_0x1535('0x7'));module['exports']=function(_0x27bacb,_0x49a7ba){return _0x27bacb[_0x1535('0x8')](_0x1535('0x9'),attributes,{'tableName':_0x1535('0xa'),'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 052c762..873d619 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 _0x5fd3=['JscriptyQuestionReport,\x20%s,\x20%s','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info'];(function(_0x311470,_0x3d014e){var _0x44c498=function(_0x41bf2e){while(--_0x41bf2e){_0x311470['push'](_0x311470['shift']());}};_0x44c498(++_0x3d014e);}(_0x5fd3,0xf0));var _0x35fd=function(_0x1b661a,_0xfacbae){_0x1b661a=_0x1b661a-0x0;var _0xfced86=_0x5fd3[_0x1b661a];return _0xfced86;};'use strict';var _=require(_0x35fd('0x0'));var util=require(_0x35fd('0x1'));var moment=require(_0x35fd('0x2'));var BPromise=require('bluebird');var rs=require(_0x35fd('0x3'));var fs=require('fs');var Redis=require(_0x35fd('0x4'));var db=require(_0x35fd('0x5'))['db'];var utils=require(_0x35fd('0x6'));var logger=require(_0x35fd('0x7'))(_0x35fd('0x8'));var config=require(_0x35fd('0x9'));var jayson=require(_0x35fd('0xa'));var client=jayson[_0x35fd('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x664ccb,_0xe4b9ee,_0x1e8c0f){return new BPromise(function(_0x61c5de,_0x2102f5){return client['request'](_0x664ccb,_0x1e8c0f)['then'](function(_0x342417){logger[_0x35fd('0xc')](_0x35fd('0xd'),_0xe4b9ee,'request\x20sent');logger[_0x35fd('0xe')](_0x35fd('0xf'),_0xe4b9ee,_0x35fd('0x10'),JSON[_0x35fd('0x11')](_0x342417));if(_0x342417[_0x35fd('0x12')]){if(_0x342417[_0x35fd('0x12')][_0x35fd('0x13')]===0x1f4){logger['error']('JscriptyQuestionReport,\x20%s,\x20%s',_0xe4b9ee,_0x342417[_0x35fd('0x12')][_0x35fd('0x14')]);return _0x2102f5(_0x342417['error'][_0x35fd('0x14')]);}logger[_0x35fd('0x12')]('JscriptyQuestionReport,\x20%s,\x20%s',_0xe4b9ee,_0x342417['error'][_0x35fd('0x14')]);return _0x61c5de(_0x342417[_0x35fd('0x12')][_0x35fd('0x14')]);}else{logger[_0x35fd('0xc')](_0x35fd('0xd'),_0xe4b9ee,_0x35fd('0x10'));_0x61c5de(_0x342417[_0x35fd('0x15')][_0x35fd('0x14')]);}})[_0x35fd('0x16')](function(_0x10ab80){logger['error'](_0x35fd('0xd'),_0xe4b9ee,_0x10ab80);_0x2102f5(_0x10ab80);});});} \ No newline at end of file +var _0x1b84=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x374a6d,_0xc25ace){var _0x3acba5=function(_0x5f28b6){while(--_0x5f28b6){_0x374a6d['push'](_0x374a6d['shift']());}};_0x3acba5(++_0xc25ace);}(_0x1b84,0xf2));var _0x41b8=function(_0x598b79,_0xdd2ec9){_0x598b79=_0x598b79-0x0;var _0x201b1d=_0x1b84[_0x598b79];return _0x201b1d;};'use strict';var _=require(_0x41b8('0x0'));var util=require('util');var moment=require(_0x41b8('0x1'));var BPromise=require(_0x41b8('0x2'));var rs=require(_0x41b8('0x3'));var fs=require('fs');var Redis=require(_0x41b8('0x4'));var db=require(_0x41b8('0x5'))['db'];var utils=require(_0x41b8('0x6'));var logger=require(_0x41b8('0x7'))(_0x41b8('0x8'));var config=require(_0x41b8('0x9'));var jayson=require(_0x41b8('0xa'));var client=jayson[_0x41b8('0xb')][_0x41b8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xaf41bd,_0x31d6e2,_0x3c2009){return new BPromise(function(_0x259a20,_0x5b2fac){return client[_0x41b8('0xd')](_0xaf41bd,_0x3c2009)['then'](function(_0x269363){logger[_0x41b8('0xe')](_0x41b8('0xf'),_0x31d6e2,_0x41b8('0x10'));logger[_0x41b8('0x11')](_0x41b8('0x12'),_0x31d6e2,_0x41b8('0x10'),JSON[_0x41b8('0x13')](_0x269363));if(_0x269363['error']){if(_0x269363[_0x41b8('0x14')]['code']===0x1f4){logger[_0x41b8('0x14')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x31d6e2,_0x269363[_0x41b8('0x14')][_0x41b8('0x15')]);return _0x5b2fac(_0x269363['error'][_0x41b8('0x15')]);}logger[_0x41b8('0x14')](_0x41b8('0xf'),_0x31d6e2,_0x269363[_0x41b8('0x14')][_0x41b8('0x15')]);return _0x259a20(_0x269363[_0x41b8('0x14')][_0x41b8('0x15')]);}else{logger[_0x41b8('0xe')](_0x41b8('0xf'),_0x31d6e2,_0x41b8('0x10'));_0x259a20(_0x269363[_0x41b8('0x16')][_0x41b8('0x15')]);}})[_0x41b8('0x17')](function(_0x2c5845){logger[_0x41b8('0x14')](_0x41b8('0xf'),_0x31d6e2,_0x2c5845);_0x5b2fac(_0x2c5845);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 1e7f00b..ae75f25 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 _0x1549=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','index','/describe','describe','isAuthenticated','show','getQuestions','put','/:id','delete','destroy','exports'];(function(_0x39106e,_0x586f3d){var _0x892aec=function(_0xded1b5){while(--_0xded1b5){_0x39106e['push'](_0x39106e['shift']());}};_0x892aec(++_0x586f3d);}(_0x1549,0x93));var _0x9154=function(_0x55c979,_0x36c5f0){_0x55c979=_0x55c979-0x0;var _0x690107=_0x1549[_0x55c979];return _0x690107;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9154('0x0'));var timeout=require(_0x9154('0x1'));var express=require(_0x9154('0x2'));var router=express[_0x9154('0x3')]();var fs_extra=require(_0x9154('0x4'));var auth=require(_0x9154('0x5'));var interaction=require(_0x9154('0x6'));var config=require(_0x9154('0x7'));var controller=require(_0x9154('0x8'));router[_0x9154('0x9')]('/',auth['isAuthenticated'](),controller[_0x9154('0xa')]);router[_0x9154('0x9')](_0x9154('0xb'),auth['isAuthenticated'](),controller[_0x9154('0xc')]);router[_0x9154('0x9')]('/:id',auth[_0x9154('0xd')](),controller[_0x9154('0xe')]);router[_0x9154('0x9')]('/:id/questions',auth[_0x9154('0xd')](),controller[_0x9154('0xf')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x9154('0x10')](_0x9154('0x11'),auth[_0x9154('0xd')](),controller['update']);router[_0x9154('0x12')](_0x9154('0x11'),auth['isAuthenticated'](),controller[_0x9154('0x13')]);module[_0x9154('0x14')]=router; \ No newline at end of file +var _0x89f1=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','get','/describe','describe','show','/:id/questions','getQuestions','post','create','/:id','update','delete','destroy','exports','multer'];(function(_0x3ff69a,_0x4a224c){var _0x167484=function(_0x9fba43){while(--_0x9fba43){_0x3ff69a['push'](_0x3ff69a['shift']());}};_0x167484(++_0x4a224c);}(_0x89f1,0x1cd));var _0x189f=function(_0x5e9b23,_0x3069fd){_0x5e9b23=_0x5e9b23-0x0;var _0x27501f=_0x89f1[_0x5e9b23];return _0x27501f;};'use strict';var multer=require(_0x189f('0x0'));var util=require(_0x189f('0x1'));var path=require('path');var timeout=require(_0x189f('0x2'));var express=require(_0x189f('0x3'));var router=express[_0x189f('0x4')]();var fs_extra=require(_0x189f('0x5'));var auth=require(_0x189f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x189f('0x7'));var controller=require('./jscriptySessionReport.controller');router['get']('/',auth[_0x189f('0x8')](),controller['index']);router[_0x189f('0x9')](_0x189f('0xa'),auth[_0x189f('0x8')](),controller[_0x189f('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x189f('0xc')]);router[_0x189f('0x9')](_0x189f('0xd'),auth['isAuthenticated'](),controller[_0x189f('0xe')]);router[_0x189f('0xf')]('/',auth['isAuthenticated'](),controller[_0x189f('0x10')]);router['put'](_0x189f('0x11'),auth[_0x189f('0x8')](),controller[_0x189f('0x12')]);router[_0x189f('0x13')](_0x189f('0x11'),auth[_0x189f('0x8')](),controller[_0x189f('0x14')]);module[_0x189f('0x15')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 82d9998..28de78b 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 _0x0210=['format','STRING','BOOLEAN','moment','exports','DATE','setDataValue','starttime','endtime'];(function(_0x546ee3,_0x2b5111){var _0x258bf6=function(_0x56ef61){while(--_0x56ef61){_0x546ee3['push'](_0x546ee3['shift']());}};_0x258bf6(++_0x2b5111);}(_0x0210,0xf6));var _0x0021=function(_0x569951,_0x402f22){_0x569951=_0x569951-0x0;var _0x13553b=_0x0210[_0x569951];return _0x13553b;};'use strict';var moment=require(_0x0021('0x0'));var Sequelize=require('sequelize');module[_0x0021('0x1')]={'starttime':{'type':Sequelize[_0x0021('0x2')],'set':function(_0x539e67){this[_0x0021('0x3')](_0x0021('0x4'),_0x539e67);this[_0x0021('0x3')](_0x0021('0x5'),moment()[_0x0021('0x6')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x0021('0x7')]},'uniqueid':{'type':Sequelize[_0x0021('0x7')]},'calleridname':{'type':Sequelize[_0x0021('0x7')]},'calleridnum':{'type':Sequelize[_0x0021('0x7')]},'completed':{'type':Sequelize[_0x0021('0x8')],'defaultValue':![]}}; \ No newline at end of file +var _0x69d4=['YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','sequelize','DATE','setDataValue','format'];(function(_0x2363b6,_0x59f2b2){var _0xefed0a=function(_0x1196f4){while(--_0x1196f4){_0x2363b6['push'](_0x2363b6['shift']());}};_0xefed0a(++_0x59f2b2);}(_0x69d4,0x83));var _0x469d=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x69d4[_0x122ef9];return _0x42fba0;};'use strict';var moment=require(_0x469d('0x0'));var Sequelize=require(_0x469d('0x1'));module['exports']={'starttime':{'type':Sequelize[_0x469d('0x2')],'set':function(_0x13e72e){this[_0x469d('0x3')]('starttime',_0x13e72e);this[_0x469d('0x3')]('endtime',moment()[_0x469d('0x4')](_0x469d('0x5')));}},'endtime':{'type':Sequelize[_0x469d('0x2')]},'membername':{'type':Sequelize[_0x469d('0x6')]},'projectname':{'type':Sequelize[_0x469d('0x6')]},'queue':{'type':Sequelize[_0x469d('0x6')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x469d('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0x469d('0x7')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index bc70022..ce95444 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 _0x3ce9=['catch','create','body','find','describe','getQuestions','params','JscriptyQuestionReport','nolimit','SessionId','include','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','update','destroy','error','stack','name','index','map','JscriptySessionReport','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','then','includeAll','findAll','rows','show','rawAttributes'];(function(_0x3a58de,_0x5e7d69){var _0xfd2a28=function(_0x399de5){while(--_0x399de5){_0x3a58de['push'](_0x3a58de['shift']());}};_0xfd2a28(++_0x5e7d69);}(_0x3ce9,0xf8));var _0x93ce=function(_0x489ce5,_0x431c16){_0x489ce5=_0x489ce5-0x0;var _0x413132=_0x3ce9[_0x489ce5];return _0x413132;};'use strict';var emlformat=require(_0x93ce('0x0'));var rimraf=require(_0x93ce('0x1'));var zipdir=require(_0x93ce('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x93ce('0x3'));var moment=require(_0x93ce('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x93ce('0x5'));var util=require(_0x93ce('0x6'));var path=require(_0x93ce('0x7'));var sox=require('sox');var csv=require(_0x93ce('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x93ce('0x9'));var _=require(_0x93ce('0xa'));var squel=require(_0x93ce('0xb'));var crypto=require(_0x93ce('0xc'));var jsforce=require(_0x93ce('0xd'));var deskjs=require(_0x93ce('0xe'));var toCsv=require(_0x93ce('0x8'));var querystring=require(_0x93ce('0xf'));var Papa=require(_0x93ce('0x10'));var Redis=require(_0x93ce('0x11'));var authService=require(_0x93ce('0x12'));var qs=require(_0x93ce('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x93ce('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x93ce('0x15'));var licenseUtil=require(_0x93ce('0x16'));var db=require(_0x93ce('0x17'))['db'];function respondWithStatusCode(_0xb0b2b8,_0x160ed7){_0x160ed7=_0x160ed7||0xcc;return function(_0x3f6d43){if(_0x3f6d43){return _0xb0b2b8[_0x93ce('0x18')](_0x160ed7);}return _0xb0b2b8[_0x93ce('0x19')](_0x160ed7)[_0x93ce('0x1a')]();};}function respondWithResult(_0x1d1e26,_0x22cac0){_0x22cac0=_0x22cac0||0xc8;return function(_0x11b690){if(_0x11b690){return _0x1d1e26[_0x93ce('0x19')](_0x22cac0)[_0x93ce('0x1b')](_0x11b690);}};}function respondWithFilteredResult(_0x1228f0,_0x1625ef){return function(_0x349e92){if(_0x349e92){var _0x41bdc3=typeof _0x1625ef['offset']===_0x93ce('0x1c')&&typeof _0x1625ef[_0x93ce('0x1d')]==='undefined';var _0x2ce3bb=_0x349e92['count'];var _0x3b818a=_0x41bdc3?0x0:_0x1625ef[_0x93ce('0x1e')];var _0x25a762=_0x41bdc3?_0x349e92[_0x93ce('0x1f')]:_0x1625ef[_0x93ce('0x1e')]+_0x1625ef[_0x93ce('0x1d')];var _0x4b6d44;if(_0x25a762>=_0x2ce3bb){_0x25a762=_0x2ce3bb;_0x4b6d44=0xc8;}else{_0x4b6d44=0xce;}_0x1228f0[_0x93ce('0x19')](_0x4b6d44);return _0x1228f0[_0x93ce('0x20')](_0x93ce('0x21'),_0x3b818a+'-'+_0x25a762+'/'+_0x2ce3bb)['json'](_0x349e92);}return null;};}function patchUpdates(_0x108ef7){return function(_0x272444){try{jsonpatch[_0x93ce('0x22')](_0x272444,_0x108ef7,!![]);}catch(_0x526188){return BPromise['reject'](_0x526188);}return _0x272444['save']();};}function saveUpdates(_0x12a9e9,_0x50d89f){return function(_0x2a2274){if(_0x2a2274){return _0x2a2274[_0x93ce('0x23')](_0x12a9e9)['then'](function(_0x40d2e5){return _0x40d2e5;});}return null;};}function removeEntity(_0x218974,_0x2b21a2){return function(_0xd9992c){if(_0xd9992c){return _0xd9992c[_0x93ce('0x24')]()['then'](function(){_0x218974[_0x93ce('0x19')](0xcc)[_0x93ce('0x1a')]();});}};}function handleEntityNotFound(_0x5334cc,_0x118f08){return function(_0x436b38){if(!_0x436b38){_0x5334cc[_0x93ce('0x18')](0x194);}return _0x436b38;};}function handleError(_0x4c2666,_0x470a7a){_0x470a7a=_0x470a7a||0x1f4;return function(_0x58c00a){logger[_0x93ce('0x25')](_0x58c00a[_0x93ce('0x26')]);if(_0x58c00a[_0x93ce('0x27')]){delete _0x58c00a['name'];}_0x4c2666[_0x93ce('0x19')](_0x470a7a)['send'](_0x58c00a);};}exports[_0x93ce('0x28')]=function(_0x178dde,_0x1a6d7b){var _0x2f34bc={},_0x1b150e={},_0x5e06b0={'count':0x0,'rows':[]};var _0x203588=_[_0x93ce('0x29')](db[_0x93ce('0x2a')]['rawAttributes'],function(_0x5f2b90){return{'name':_0x5f2b90[_0x93ce('0x2b')],'type':_0x5f2b90[_0x93ce('0x2c')]['key']};});_0x1b150e[_0x93ce('0x2d')]=_['map'](_0x203588,'name');_0x1b150e[_0x93ce('0x2e')]=_[_0x93ce('0x2f')](_0x178dde[_0x93ce('0x2e')]);_0x1b150e[_0x93ce('0x30')]=_[_0x93ce('0x31')](_0x1b150e[_0x93ce('0x2d')],_0x1b150e[_0x93ce('0x2e')]);_0x2f34bc[_0x93ce('0x32')]=_['intersection'](_0x1b150e[_0x93ce('0x2d')],qs[_0x93ce('0x33')](_0x178dde['query']['fields']));_0x2f34bc[_0x93ce('0x32')]=_0x2f34bc['attributes'][_0x93ce('0x34')]?_0x2f34bc['attributes']:_0x1b150e[_0x93ce('0x2d')];if(!_0x178dde[_0x93ce('0x2e')][_0x93ce('0x35')]('nolimit')){_0x2f34bc['limit']=qs[_0x93ce('0x1d')](_0x178dde['query']['limit']);_0x2f34bc[_0x93ce('0x1e')]=qs[_0x93ce('0x1e')](_0x178dde[_0x93ce('0x2e')][_0x93ce('0x1e')]);}_0x2f34bc[_0x93ce('0x36')]=qs['sort'](_0x178dde['query'][_0x93ce('0x37')]);_0x2f34bc[_0x93ce('0x38')]=qs[_0x93ce('0x30')](_[_0x93ce('0x39')](_0x178dde[_0x93ce('0x2e')],_0x1b150e[_0x93ce('0x30')]),_0x203588);if(_0x178dde[_0x93ce('0x2e')]['filter']){_0x2f34bc[_0x93ce('0x38')]=_[_0x93ce('0x3a')](_0x2f34bc[_0x93ce('0x38')],{'$or':_[_0x93ce('0x29')](_0x203588,function(_0x30ac47){if(_0x30ac47[_0x93ce('0x2c')]!==_0x93ce('0x3b')){var _0x46bac1={};_0x46bac1[_0x30ac47[_0x93ce('0x27')]]={'$like':'%'+_0x178dde[_0x93ce('0x2e')][_0x93ce('0x3c')]+'%'};return _0x46bac1;}})});}_0x2f34bc=_[_0x93ce('0x3a')]({},_0x2f34bc,_0x178dde[_0x93ce('0x3d')]);var _0x388967={'where':_0x2f34bc[_0x93ce('0x38')]};return db['JscriptySessionReport']['count'](_0x388967)[_0x93ce('0x3e')](function(_0x2c676f){_0x5e06b0[_0x93ce('0x1f')]=_0x2c676f;if(_0x178dde[_0x93ce('0x2e')][_0x93ce('0x3f')]){_0x2f34bc['include']=[{'all':!![]}];}return db[_0x93ce('0x2a')][_0x93ce('0x40')](_0x2f34bc);})[_0x93ce('0x3e')](function(_0x316154){_0x5e06b0[_0x93ce('0x41')]=_0x316154;return _0x5e06b0;})[_0x93ce('0x3e')](respondWithFilteredResult(_0x1a6d7b,_0x2f34bc))['catch'](handleError(_0x1a6d7b,null));};exports[_0x93ce('0x42')]=function(_0x5a5c54,_0xd9e901){var _0x35ca6a={'raw':!![],'where':{'id':_0x5a5c54['params']['id']}},_0x3a3632={};_0x3a3632[_0x93ce('0x2d')]=_[_0x93ce('0x2f')](db[_0x93ce('0x2a')][_0x93ce('0x43')]);_0x3a3632[_0x93ce('0x2e')]=_[_0x93ce('0x2f')](_0x5a5c54[_0x93ce('0x2e')]);_0x3a3632[_0x93ce('0x30')]=_[_0x93ce('0x31')](_0x3a3632['model'],_0x3a3632['query']);_0x35ca6a[_0x93ce('0x32')]=_[_0x93ce('0x31')](_0x3a3632[_0x93ce('0x2d')],qs[_0x93ce('0x33')](_0x5a5c54[_0x93ce('0x2e')][_0x93ce('0x33')]));_0x35ca6a[_0x93ce('0x32')]=_0x35ca6a[_0x93ce('0x32')]['length']?_0x35ca6a[_0x93ce('0x32')]:_0x3a3632[_0x93ce('0x2d')];if(_0x5a5c54[_0x93ce('0x2e')][_0x93ce('0x3f')]){_0x35ca6a['include']=[{'all':!![]}];}_0x35ca6a=_[_0x93ce('0x3a')]({},_0x35ca6a,_0x5a5c54[_0x93ce('0x3d')]);return db[_0x93ce('0x2a')]['find'](_0x35ca6a)[_0x93ce('0x3e')](handleEntityNotFound(_0xd9e901,null))[_0x93ce('0x3e')](respondWithResult(_0xd9e901,null))[_0x93ce('0x44')](handleError(_0xd9e901,null));};exports['create']=function(_0x3d8526,_0x1a7998){return db[_0x93ce('0x2a')][_0x93ce('0x45')](_0x3d8526[_0x93ce('0x46')],{})[_0x93ce('0x3e')](respondWithResult(_0x1a7998,0xc9))[_0x93ce('0x44')](handleError(_0x1a7998,null));};exports[_0x93ce('0x23')]=function(_0x29e375,_0x13f2c3){if(_0x29e375['body']['id']){delete _0x29e375['body']['id'];}return db[_0x93ce('0x2a')][_0x93ce('0x47')]({'where':{'id':_0x29e375['params']['id']}})['then'](handleEntityNotFound(_0x13f2c3,null))[_0x93ce('0x3e')](saveUpdates(_0x29e375[_0x93ce('0x46')],null))[_0x93ce('0x3e')](respondWithResult(_0x13f2c3,null))[_0x93ce('0x44')](handleError(_0x13f2c3,null));};exports['destroy']=function(_0x1efff7,_0x2fc296){return db[_0x93ce('0x2a')][_0x93ce('0x47')]({'where':{'id':_0x1efff7['params']['id']}})['then'](handleEntityNotFound(_0x2fc296,null))[_0x93ce('0x3e')](removeEntity(_0x2fc296,null))['catch'](handleError(_0x2fc296,null));};exports[_0x93ce('0x48')]=function(_0x46fec0,_0x58d9e0){return db['JscriptySessionReport'][_0x93ce('0x48')]()['then'](respondWithResult(_0x58d9e0,null))[_0x93ce('0x44')](handleError(_0x58d9e0,null));};exports[_0x93ce('0x49')]=function(_0x252804,_0x406149,_0x13cca1){var _0x196473={'raw':!![],'where':{}};var _0x4dcbe6={};var _0x50afeb={'count':0x0,'rows':[]};return db[_0x93ce('0x2a')]['findOne']({'where':{'id':_0x252804[_0x93ce('0x4a')]['id']}})[_0x93ce('0x3e')](handleEntityNotFound(_0x406149,null))['then'](function(_0x3cddd4){if(_0x3cddd4){_0x4dcbe6[_0x93ce('0x2d')]=_[_0x93ce('0x2f')](db[_0x93ce('0x4b')][_0x93ce('0x43')]);_0x4dcbe6[_0x93ce('0x2e')]=_[_0x93ce('0x2f')](_0x252804[_0x93ce('0x2e')]);_0x4dcbe6[_0x93ce('0x30')]=_[_0x93ce('0x31')](_0x4dcbe6[_0x93ce('0x2d')],_0x4dcbe6[_0x93ce('0x2e')]);_0x196473['attributes']=_[_0x93ce('0x31')](_0x4dcbe6['model'],qs[_0x93ce('0x33')](_0x252804['query'][_0x93ce('0x33')]));_0x196473[_0x93ce('0x32')]=_0x196473[_0x93ce('0x32')][_0x93ce('0x34')]?_0x196473['attributes']:_0x4dcbe6[_0x93ce('0x2d')];if(!_0x252804[_0x93ce('0x2e')]['hasOwnProperty'](_0x93ce('0x4c'))){_0x196473['limit']=qs['limit'](_0x252804[_0x93ce('0x2e')][_0x93ce('0x1d')]);_0x196473[_0x93ce('0x1e')]=qs[_0x93ce('0x1e')](_0x252804[_0x93ce('0x2e')]['offset']);}_0x196473[_0x93ce('0x36')]=qs['sort'](_0x252804[_0x93ce('0x2e')][_0x93ce('0x37')]);_0x196473[_0x93ce('0x38')]=qs[_0x93ce('0x30')](_['pick'](_0x252804['query'],_0x4dcbe6[_0x93ce('0x30')]));_0x196473[_0x93ce('0x38')][_0x93ce('0x4d')]=_0x3cddd4['id'];if(_0x252804[_0x93ce('0x2e')]['filter']){_0x196473['where']=_[_0x93ce('0x3a')](_0x196473[_0x93ce('0x38')],{'$or':_[_0x93ce('0x29')](_0x196473['attributes'],function(_0x1fa696){var _0x53eb74={};_0x53eb74[_0x1fa696]={'$like':'%'+_0x252804['query'][_0x93ce('0x3c')]+'%'};return _0x53eb74;})});}_0x196473=_['merge']({},_0x196473,_0x252804['options']);return db[_0x93ce('0x4b')][_0x93ce('0x1f')]({'where':_0x196473[_0x93ce('0x38')]})['then'](function(_0x1aea2d){_0x50afeb[_0x93ce('0x1f')]=_0x1aea2d;if(_0x252804['query'][_0x93ce('0x3f')]){_0x196473[_0x93ce('0x4e')]=[{'all':!![]}];}return db[_0x93ce('0x4b')][_0x93ce('0x40')](_0x196473);})['then'](function(_0x5e7bec){_0x50afeb[_0x93ce('0x41')]=_0x5e7bec;return _0x50afeb;});}})[_0x93ce('0x3e')](respondWithFilteredResult(_0x406149,_0x196473))[_0x93ce('0x44')](handleError(_0x406149,null));}; \ No newline at end of file +var _0x1b70=['stack','name','map','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','type','VIRTUAL','filter','merge','options','JscriptySessionReport','include','findAll','rows','catch','show','params','includeAll','create','body','find','describe','getQuestions','findOne','SessionId','JscriptyQuestionReport','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy'];(function(_0x37c22c,_0x28a70d){var _0x119d79=function(_0x243a13){while(--_0x243a13){_0x37c22c['push'](_0x37c22c['shift']());}};_0x119d79(++_0x28a70d);}(_0x1b70,0x1a7));var _0x01b7=function(_0xc8a931,_0x260690){_0xc8a931=_0xc8a931-0x0;var _0x28bd27=_0x1b70[_0xc8a931];return _0x28bd27;};'use strict';var emlformat=require(_0x01b7('0x0'));var rimraf=require(_0x01b7('0x1'));var zipdir=require(_0x01b7('0x2'));var jsonpatch=require(_0x01b7('0x3'));var rp=require('request-promise');var moment=require(_0x01b7('0x4'));var BPromise=require(_0x01b7('0x5'));var Mustache=require(_0x01b7('0x6'));var util=require(_0x01b7('0x7'));var path=require(_0x01b7('0x8'));var sox=require(_0x01b7('0x9'));var csv=require(_0x01b7('0xa'));var ejs=require(_0x01b7('0xb'));var fs=require('fs');var fs_extra=require(_0x01b7('0xc'));var _=require(_0x01b7('0xd'));var squel=require(_0x01b7('0xe'));var crypto=require(_0x01b7('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x01b7('0x10'));var Papa=require(_0x01b7('0x11'));var Redis=require('ioredis');var authService=require(_0x01b7('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x01b7('0x13'));var hardwareService=require(_0x01b7('0x14'));var logger=require('../../config/logger')(_0x01b7('0x15'));var utils=require(_0x01b7('0x16'));var config=require(_0x01b7('0x17'));var licenseUtil=require(_0x01b7('0x18'));var db=require(_0x01b7('0x19'))['db'];function respondWithStatusCode(_0x2a5c25,_0x23ffd9){_0x23ffd9=_0x23ffd9||0xcc;return function(_0x538aea){if(_0x538aea){return _0x2a5c25['sendStatus'](_0x23ffd9);}return _0x2a5c25[_0x01b7('0x1a')](_0x23ffd9)[_0x01b7('0x1b')]();};}function respondWithResult(_0x25de48,_0x148c01){_0x148c01=_0x148c01||0xc8;return function(_0x5d20cf){if(_0x5d20cf){return _0x25de48[_0x01b7('0x1a')](_0x148c01)[_0x01b7('0x1c')](_0x5d20cf);}};}function respondWithFilteredResult(_0x354773,_0x4078bf){return function(_0x3ed0ef){if(_0x3ed0ef){var _0x253dd7=typeof _0x4078bf[_0x01b7('0x1d')]===_0x01b7('0x1e')&&typeof _0x4078bf[_0x01b7('0x1f')]===_0x01b7('0x1e');var _0x2ae70b=_0x3ed0ef[_0x01b7('0x20')];var _0x4b36f1=_0x253dd7?0x0:_0x4078bf['offset'];var _0x36ed1b=_0x253dd7?_0x3ed0ef['count']:_0x4078bf[_0x01b7('0x1d')]+_0x4078bf[_0x01b7('0x1f')];var _0x2a9347;if(_0x36ed1b>=_0x2ae70b){_0x36ed1b=_0x2ae70b;_0x2a9347=0xc8;}else{_0x2a9347=0xce;}_0x354773[_0x01b7('0x1a')](_0x2a9347);return _0x354773[_0x01b7('0x21')]('Content-Range',_0x4b36f1+'-'+_0x36ed1b+'/'+_0x2ae70b)[_0x01b7('0x1c')](_0x3ed0ef);}return null;};}function patchUpdates(_0x512a53){return function(_0x394da2){try{jsonpatch[_0x01b7('0x22')](_0x394da2,_0x512a53,!![]);}catch(_0x1a1b2d){return BPromise[_0x01b7('0x23')](_0x1a1b2d);}return _0x394da2[_0x01b7('0x24')]();};}function saveUpdates(_0x2ccdb9,_0x57449f){return function(_0x374c2a){if(_0x374c2a){return _0x374c2a['update'](_0x2ccdb9)[_0x01b7('0x25')](function(_0x11c335){return _0x11c335;});}return null;};}function removeEntity(_0x9d40ef,_0x568da7){return function(_0x2da0df){if(_0x2da0df){return _0x2da0df[_0x01b7('0x26')]()[_0x01b7('0x25')](function(){_0x9d40ef['status'](0xcc)[_0x01b7('0x1b')]();});}};}function handleEntityNotFound(_0xe90cc8,_0x2bcbe2){return function(_0x1c9c1a){if(!_0x1c9c1a){_0xe90cc8['sendStatus'](0x194);}return _0x1c9c1a;};}function handleError(_0x42da58,_0x36ca46){_0x36ca46=_0x36ca46||0x1f4;return function(_0x58a507){logger['error'](_0x58a507[_0x01b7('0x27')]);if(_0x58a507[_0x01b7('0x28')]){delete _0x58a507[_0x01b7('0x28')];}_0x42da58[_0x01b7('0x1a')](_0x36ca46)['send'](_0x58a507);};}exports['index']=function(_0x4df921,_0x4350a3){var _0x538858={},_0x1728bd={},_0x12af7f={'count':0x0,'rows':[]};var _0x559b40=_[_0x01b7('0x29')](db['JscriptySessionReport'][_0x01b7('0x2a')],function(_0x530369){return{'name':_0x530369['fieldName'],'type':_0x530369['type'][_0x01b7('0x2b')]};});_0x1728bd[_0x01b7('0x2c')]=_['map'](_0x559b40,_0x01b7('0x28'));_0x1728bd[_0x01b7('0x2d')]=_[_0x01b7('0x2e')](_0x4df921[_0x01b7('0x2d')]);_0x1728bd[_0x01b7('0x2f')]=_[_0x01b7('0x30')](_0x1728bd['model'],_0x1728bd[_0x01b7('0x2d')]);_0x538858[_0x01b7('0x31')]=_['intersection'](_0x1728bd[_0x01b7('0x2c')],qs[_0x01b7('0x32')](_0x4df921[_0x01b7('0x2d')][_0x01b7('0x32')]));_0x538858[_0x01b7('0x31')]=_0x538858[_0x01b7('0x31')][_0x01b7('0x33')]?_0x538858[_0x01b7('0x31')]:_0x1728bd[_0x01b7('0x2c')];if(!_0x4df921[_0x01b7('0x2d')][_0x01b7('0x34')](_0x01b7('0x35'))){_0x538858[_0x01b7('0x1f')]=qs[_0x01b7('0x1f')](_0x4df921[_0x01b7('0x2d')][_0x01b7('0x1f')]);_0x538858['offset']=qs[_0x01b7('0x1d')](_0x4df921[_0x01b7('0x2d')][_0x01b7('0x1d')]);}_0x538858['order']=qs[_0x01b7('0x36')](_0x4df921[_0x01b7('0x2d')]['sort']);_0x538858[_0x01b7('0x37')]=qs[_0x01b7('0x2f')](_['pick'](_0x4df921[_0x01b7('0x2d')],_0x1728bd[_0x01b7('0x2f')]),_0x559b40);if(_0x4df921[_0x01b7('0x2d')]['filter']){_0x538858[_0x01b7('0x37')]=_['merge'](_0x538858['where'],{'$or':_[_0x01b7('0x29')](_0x559b40,function(_0x4708d1){if(_0x4708d1[_0x01b7('0x38')]!==_0x01b7('0x39')){var _0x22ef64={};_0x22ef64[_0x4708d1[_0x01b7('0x28')]]={'$like':'%'+_0x4df921[_0x01b7('0x2d')][_0x01b7('0x3a')]+'%'};return _0x22ef64;}})});}_0x538858=_[_0x01b7('0x3b')]({},_0x538858,_0x4df921[_0x01b7('0x3c')]);var _0x2a1d1e={'where':_0x538858[_0x01b7('0x37')]};return db[_0x01b7('0x3d')][_0x01b7('0x20')](_0x2a1d1e)['then'](function(_0x1d9316){_0x12af7f[_0x01b7('0x20')]=_0x1d9316;if(_0x4df921['query']['includeAll']){_0x538858[_0x01b7('0x3e')]=[{'all':!![]}];}return db[_0x01b7('0x3d')][_0x01b7('0x3f')](_0x538858);})[_0x01b7('0x25')](function(_0x497a3c){_0x12af7f[_0x01b7('0x40')]=_0x497a3c;return _0x12af7f;})[_0x01b7('0x25')](respondWithFilteredResult(_0x4350a3,_0x538858))[_0x01b7('0x41')](handleError(_0x4350a3,null));};exports[_0x01b7('0x42')]=function(_0x45d166,_0x5d1687){var _0x3b4b1f={'raw':!![],'where':{'id':_0x45d166[_0x01b7('0x43')]['id']}},_0x3710ed={};_0x3710ed[_0x01b7('0x2c')]=_[_0x01b7('0x2e')](db['JscriptySessionReport']['rawAttributes']);_0x3710ed[_0x01b7('0x2d')]=_[_0x01b7('0x2e')](_0x45d166[_0x01b7('0x2d')]);_0x3710ed['filters']=_[_0x01b7('0x30')](_0x3710ed['model'],_0x3710ed[_0x01b7('0x2d')]);_0x3b4b1f[_0x01b7('0x31')]=_['intersection'](_0x3710ed['model'],qs[_0x01b7('0x32')](_0x45d166[_0x01b7('0x2d')][_0x01b7('0x32')]));_0x3b4b1f['attributes']=_0x3b4b1f[_0x01b7('0x31')][_0x01b7('0x33')]?_0x3b4b1f[_0x01b7('0x31')]:_0x3710ed['model'];if(_0x45d166[_0x01b7('0x2d')][_0x01b7('0x44')]){_0x3b4b1f[_0x01b7('0x3e')]=[{'all':!![]}];}_0x3b4b1f=_[_0x01b7('0x3b')]({},_0x3b4b1f,_0x45d166[_0x01b7('0x3c')]);return db['JscriptySessionReport']['find'](_0x3b4b1f)[_0x01b7('0x25')](handleEntityNotFound(_0x5d1687,null))[_0x01b7('0x25')](respondWithResult(_0x5d1687,null))[_0x01b7('0x41')](handleError(_0x5d1687,null));};exports[_0x01b7('0x45')]=function(_0x432f3d,_0xa97f54){return db[_0x01b7('0x3d')][_0x01b7('0x45')](_0x432f3d[_0x01b7('0x46')],{})[_0x01b7('0x25')](respondWithResult(_0xa97f54,0xc9))[_0x01b7('0x41')](handleError(_0xa97f54,null));};exports['update']=function(_0x285d96,_0x130ce9){if(_0x285d96[_0x01b7('0x46')]['id']){delete _0x285d96[_0x01b7('0x46')]['id'];}return db[_0x01b7('0x3d')][_0x01b7('0x47')]({'where':{'id':_0x285d96[_0x01b7('0x43')]['id']}})['then'](handleEntityNotFound(_0x130ce9,null))[_0x01b7('0x25')](saveUpdates(_0x285d96['body'],null))[_0x01b7('0x25')](respondWithResult(_0x130ce9,null))['catch'](handleError(_0x130ce9,null));};exports[_0x01b7('0x26')]=function(_0x100b67,_0x431577){return db[_0x01b7('0x3d')][_0x01b7('0x47')]({'where':{'id':_0x100b67[_0x01b7('0x43')]['id']}})[_0x01b7('0x25')](handleEntityNotFound(_0x431577,null))[_0x01b7('0x25')](removeEntity(_0x431577,null))['catch'](handleError(_0x431577,null));};exports[_0x01b7('0x48')]=function(_0x1a4644,_0x3e859e){return db[_0x01b7('0x3d')][_0x01b7('0x48')]()['then'](respondWithResult(_0x3e859e,null))['catch'](handleError(_0x3e859e,null));};exports[_0x01b7('0x49')]=function(_0x4d8731,_0x140e6b,_0x227b08){var _0x1bf0f8={'raw':!![],'where':{}};var _0x2dcb76={};var _0x2fbf56={'count':0x0,'rows':[]};return db[_0x01b7('0x3d')][_0x01b7('0x4a')]({'where':{'id':_0x4d8731[_0x01b7('0x43')]['id']}})['then'](handleEntityNotFound(_0x140e6b,null))[_0x01b7('0x25')](function(_0x3e9c5d){if(_0x3e9c5d){_0x2dcb76[_0x01b7('0x2c')]=_['keys'](db['JscriptyQuestionReport'][_0x01b7('0x2a')]);_0x2dcb76[_0x01b7('0x2d')]=_[_0x01b7('0x2e')](_0x4d8731[_0x01b7('0x2d')]);_0x2dcb76[_0x01b7('0x2f')]=_[_0x01b7('0x30')](_0x2dcb76['model'],_0x2dcb76[_0x01b7('0x2d')]);_0x1bf0f8[_0x01b7('0x31')]=_['intersection'](_0x2dcb76[_0x01b7('0x2c')],qs[_0x01b7('0x32')](_0x4d8731[_0x01b7('0x2d')][_0x01b7('0x32')]));_0x1bf0f8['attributes']=_0x1bf0f8[_0x01b7('0x31')]['length']?_0x1bf0f8[_0x01b7('0x31')]:_0x2dcb76['model'];if(!_0x4d8731[_0x01b7('0x2d')]['hasOwnProperty'](_0x01b7('0x35'))){_0x1bf0f8['limit']=qs[_0x01b7('0x1f')](_0x4d8731[_0x01b7('0x2d')][_0x01b7('0x1f')]);_0x1bf0f8[_0x01b7('0x1d')]=qs[_0x01b7('0x1d')](_0x4d8731[_0x01b7('0x2d')][_0x01b7('0x1d')]);}_0x1bf0f8['order']=qs[_0x01b7('0x36')](_0x4d8731['query']['sort']);_0x1bf0f8[_0x01b7('0x37')]=qs[_0x01b7('0x2f')](_['pick'](_0x4d8731[_0x01b7('0x2d')],_0x2dcb76['filters']));_0x1bf0f8[_0x01b7('0x37')][_0x01b7('0x4b')]=_0x3e9c5d['id'];if(_0x4d8731[_0x01b7('0x2d')][_0x01b7('0x3a')]){_0x1bf0f8[_0x01b7('0x37')]=_[_0x01b7('0x3b')](_0x1bf0f8[_0x01b7('0x37')],{'$or':_['map'](_0x1bf0f8['attributes'],function(_0x7becf9){var _0x38c353={};_0x38c353[_0x7becf9]={'$like':'%'+_0x4d8731[_0x01b7('0x2d')][_0x01b7('0x3a')]+'%'};return _0x38c353;})});}_0x1bf0f8=_[_0x01b7('0x3b')]({},_0x1bf0f8,_0x4d8731[_0x01b7('0x3c')]);return db[_0x01b7('0x4c')]['count']({'where':_0x1bf0f8[_0x01b7('0x37')]})[_0x01b7('0x25')](function(_0x591fc2){_0x2fbf56[_0x01b7('0x20')]=_0x591fc2;if(_0x4d8731[_0x01b7('0x2d')][_0x01b7('0x44')]){_0x1bf0f8[_0x01b7('0x3e')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x01b7('0x3f')](_0x1bf0f8);})[_0x01b7('0x25')](function(_0x464c23){_0x2fbf56[_0x01b7('0x40')]=_0x464c23;return _0x2fbf56;});}})[_0x01b7('0x25')](respondWithFilteredResult(_0x140e6b,_0x1bf0f8))[_0x01b7('0x41')](handleError(_0x140e6b,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 16a6f7a..1169fa1 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 _0xabce=['util','../../config/logger','api','moment','path','rimraf','../../config/environment','define','report_jscripty_sessions','lodash'];(function(_0xf316ab,_0x34ea48){var _0x198456=function(_0x45a98c){while(--_0x45a98c){_0xf316ab['push'](_0xf316ab['shift']());}};_0x198456(++_0x34ea48);}(_0xabce,0x103));var _0xeabc=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xabce[_0x4e1d03];return _0x362d4b;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var logger=require(_0xeabc('0x2'))(_0xeabc('0x3'));var moment=require(_0xeabc('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xeabc('0x5'));var rimraf=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var attributes=require('./jscriptySessionReport.attributes');module['exports']=function(_0x1b07a8,_0x52a4d7){return _0x1b07a8[_0xeabc('0x8')]('JscriptySessionReport',attributes,{'tableName':_0xeabc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e24=['util','../../config/logger','api','moment','request-promise','path','../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','lodash'];(function(_0x4560c3,_0xdd187f){var _0x5400a1=function(_0x27f921){while(--_0x27f921){_0x4560c3['push'](_0x4560c3['shift']());}};_0x5400a1(++_0xdd187f);}(_0x3e24,0x167));var _0x43e2=function(_0x389aff,_0x16144e){_0x389aff=_0x389aff-0x0;var _0x33d2fc=_0x3e24[_0x389aff];return _0x33d2fc;};'use strict';var _=require(_0x43e2('0x0'));var util=require(_0x43e2('0x1'));var logger=require(_0x43e2('0x2'))(_0x43e2('0x3'));var moment=require(_0x43e2('0x4'));var BPromise=require('bluebird');var rp=require(_0x43e2('0x5'));var fs=require('fs');var path=require(_0x43e2('0x6'));var rimraf=require('rimraf');var config=require(_0x43e2('0x7'));var attributes=require(_0x43e2('0x8'));module[_0x43e2('0x9')]=function(_0x28b144,_0x43b5a7){return _0x28b144[_0x43e2('0xa')](_0x43e2('0xb'),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 b38e1bd..22daf45 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 _0x57ca=['client','http','request','info','request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','error','code','JscriptySessionReport,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x434f28,_0xa28fe9){var _0x5afa83=function(_0x214454){while(--_0x214454){_0x434f28['push'](_0x434f28['shift']());}};_0x5afa83(++_0xa28fe9);}(_0x57ca,0x108));var _0xa57c=function(_0x51328b,_0x199b4f){_0x51328b=_0x51328b-0x0;var _0x20e5a3=_0x57ca[_0x51328b];return _0x20e5a3;};'use strict';var _=require('lodash');var util=require(_0xa57c('0x0'));var moment=require(_0xa57c('0x1'));var BPromise=require('bluebird');var rs=require(_0xa57c('0x2'));var fs=require('fs');var Redis=require(_0xa57c('0x3'));var db=require(_0xa57c('0x4'))['db'];var utils=require(_0xa57c('0x5'));var logger=require(_0xa57c('0x6'))('rpc');var config=require(_0xa57c('0x7'));var jayson=require(_0xa57c('0x8'));var client=jayson[_0xa57c('0x9')][_0xa57c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xbdfffb,_0x314574,_0x19e28e){return new BPromise(function(_0x271ccc,_0x5e3962){return client[_0xa57c('0xb')](_0xbdfffb,_0x19e28e)['then'](function(_0x46ba92){logger[_0xa57c('0xc')]('JscriptySessionReport,\x20%s,\x20%s',_0x314574,_0xa57c('0xd'));logger['debug'](_0xa57c('0xe'),_0x314574,_0xa57c('0xd'),JSON['stringify'](_0x46ba92));if(_0x46ba92[_0xa57c('0xf')]){if(_0x46ba92['error'][_0xa57c('0x10')]===0x1f4){logger[_0xa57c('0xf')](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x5e3962(_0x46ba92['error'][_0xa57c('0x12')]);}logger['error'](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x271ccc(_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);}else{logger[_0xa57c('0xc')](_0xa57c('0x11'),_0x314574,'request\x20sent');_0x271ccc(_0x46ba92[_0xa57c('0x13')][_0xa57c('0x12')]);}})[_0xa57c('0x14')](function(_0x5a6024){logger[_0xa57c('0xf')]('JscriptySessionReport,\x20%s,\x20%s',_0x314574,_0x5a6024);_0x5e3962(_0x5a6024);});});} \ No newline at end of file +var _0xd943=['info','request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','error','code','JscriptySessionReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','then'];(function(_0x4bd06e,_0x593701){var _0x85ebb=function(_0x26a7f2){while(--_0x26a7f2){_0x4bd06e['push'](_0x4bd06e['shift']());}};_0x85ebb(++_0x593701);}(_0xd943,0x15d));var _0x3d94=function(_0x474341,_0x50220b){_0x474341=_0x474341-0x0;var _0x1d184a=_0xd943[_0x474341];return _0x1d184a;};'use strict';var _=require(_0x3d94('0x0'));var util=require(_0x3d94('0x1'));var moment=require(_0x3d94('0x2'));var BPromise=require(_0x3d94('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d94('0x4'));var db=require(_0x3d94('0x5'))['db'];var utils=require(_0x3d94('0x6'));var logger=require(_0x3d94('0x7'))(_0x3d94('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3d94('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54e81f,_0x4d29e7,_0x20f4d1){return new BPromise(function(_0x35d36a,_0x5244c3){return client['request'](_0x54e81f,_0x20f4d1)[_0x3d94('0xa')](function(_0x27e381){logger[_0x3d94('0xb')]('JscriptySessionReport,\x20%s,\x20%s',_0x4d29e7,_0x3d94('0xc'));logger['debug'](_0x3d94('0xd'),_0x4d29e7,_0x3d94('0xc'),JSON['stringify'](_0x27e381));if(_0x27e381[_0x3d94('0xe')]){if(_0x27e381[_0x3d94('0xe')][_0x3d94('0xf')]===0x1f4){logger[_0x3d94('0xe')](_0x3d94('0x10'),_0x4d29e7,_0x27e381['error'][_0x3d94('0x11')]);return _0x5244c3(_0x27e381[_0x3d94('0xe')][_0x3d94('0x11')]);}logger['error'](_0x3d94('0x10'),_0x4d29e7,_0x27e381[_0x3d94('0xe')][_0x3d94('0x11')]);return _0x35d36a(_0x27e381['error'][_0x3d94('0x11')]);}else{logger[_0x3d94('0xb')](_0x3d94('0x10'),_0x4d29e7,_0x3d94('0xc'));_0x35d36a(_0x27e381[_0x3d94('0x12')][_0x3d94('0x11')]);}})[_0x3d94('0x13')](function(_0x9893cb){logger['error'](_0x3d94('0x10'),_0x4d29e7,_0x9893cb);_0x5244c3(_0x9893cb);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index a0c6bd0..954f2a2 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 _0x3707=['isAuthenticated','update','/download_log_file','downloadLogFile','exports','multer','express','Router','fs-extra','../../components/auth/service','get','put','/:id'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x3707,0x1e6));var _0x7370=function(_0x2328fa,_0x172999){_0x2328fa=_0x2328fa-0x0;var _0x2f254f=_0x3707[_0x2328fa];return _0x2f254f;};'use strict';var multer=require(_0x7370('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7370('0x1'));var router=express[_0x7370('0x2')]();var fs_extra=require(_0x7370('0x3'));var auth=require(_0x7370('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./license.controller');router[_0x7370('0x5')]('/',controller['index']);router[_0x7370('0x6')](_0x7370('0x7'),auth[_0x7370('0x8')](),controller[_0x7370('0x9')]);router['get'](_0x7370('0xa'),auth[_0x7370('0x8')](),controller[_0x7370('0xb')]);module[_0x7370('0xc')]=router; \ No newline at end of file +var _0x2a56=['update','isAuthenticated','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','get','put','/:id'];(function(_0x36c2df,_0x1db46d){var _0x24e7dd=function(_0x1958f5){while(--_0x1958f5){_0x36c2df['push'](_0x36c2df['shift']());}};_0x24e7dd(++_0x1db46d);}(_0x2a56,0x10d));var _0x62a5=function(_0x4c68d7,_0x1310c5){_0x4c68d7=_0x4c68d7-0x0;var _0x59c293=_0x2a56[_0x4c68d7];return _0x59c293;};'use strict';var multer=require('multer');var util=require(_0x62a5('0x0'));var path=require('path');var timeout=require(_0x62a5('0x1'));var express=require(_0x62a5('0x2'));var router=express[_0x62a5('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x62a5('0x4'));var interaction=require(_0x62a5('0x5'));var config=require(_0x62a5('0x6'));var controller=require(_0x62a5('0x7'));router[_0x62a5('0x8')]('/',controller['index']);router[_0x62a5('0x9')](_0x62a5('0xa'),auth['isAuthenticated'](),controller[_0x62a5('0xb')]);router[_0x62a5('0x8')]('/download_log_file',auth[_0x62a5('0xc')](),controller['downloadLogFile']);module[_0x62a5('0xd')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 6cbced3..0c74a20 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 _0x8b9e=['sequelize','exports','TEXT','STRING','INTEGER'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x8b9e,0x1a9));var _0xe8b9=function(_0x4b7661,_0x4374a2){_0x4b7661=_0x4b7661-0x0;var _0x335762=_0x8b9e[_0x4b7661];return _0x335762;};'use strict';var Sequelize=require(_0xe8b9('0x0'));module[_0xe8b9('0x1')]={'license':{'type':Sequelize[_0xe8b9('0x2')]},'data1':{'type':Sequelize[_0xe8b9('0x3')]},'data2':{'type':Sequelize[_0xe8b9('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0xe8b9('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7f27=['INTEGER','sequelize','STRING'];(function(_0x5a2285,_0x3212d1){var _0x48f6ed=function(_0x322127){while(--_0x322127){_0x5a2285['push'](_0x5a2285['shift']());}};_0x48f6ed(++_0x3212d1);}(_0x7f27,0x10f));var _0x77f2=function(_0x4319b1,_0x177525){_0x4319b1=_0x4319b1-0x0;var _0x3fc577=_0x7f27[_0x4319b1];return _0x3fc577;};'use strict';var Sequelize=require(_0x77f2('0x0'));module['exports']={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0x77f2('0x1')]},'data2':{'type':Sequelize[_0x77f2('0x1')]},'chatLicenseExceeded':{'type':Sequelize[_0x77f2('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index c3cc78e..d60a4d6 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 _0x1802=['api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','limit','count','offset','set','Content-Range','reject','save','then','error','name','send','index','model','License','query','keys','filters','intersection','attributes','fields','length','merge','options','getLicense','catch','update','body','find','checkLicense','demo','downloadLogFile','license-info.log','setHeader','Content-disposition','attachment;\x20filename=','text/plain','download','eml-format','zip-dir','request-promise','moment','mustache','util','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x295e84,_0x482105){var _0x49fcee=function(_0x480283){while(--_0x480283){_0x295e84['push'](_0x295e84['shift']());}};_0x49fcee(++_0x482105);}(_0x1802,0x125));var _0x2180=function(_0x205926,_0xcb0e7a){_0x205926=_0x205926-0x0;var _0x32a372=_0x1802[_0x205926];return _0x32a372;};'use strict';var emlformat=require(_0x2180('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2180('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2180('0x2'));var moment=require(_0x2180('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x2180('0x4'));var util=require(_0x2180('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x2180('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2180('0x7'));var _=require(_0x2180('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2180('0x9'));var deskjs=require(_0x2180('0xa'));var toCsv=require('to-csv');var querystring=require(_0x2180('0xb'));var Papa=require('papaparse');var Redis=require(_0x2180('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x2180('0xd'));var as=require(_0x2180('0xe'));var hardwareService=require(_0x2180('0xf'));var logger=require(_0x2180('0x10'))(_0x2180('0x11'));var utils=require('../../config/utils');var config=require(_0x2180('0x12'));var licenseUtil=require(_0x2180('0x13'));var db=require(_0x2180('0x14'))['db'];function respondWithStatusCode(_0x5cbc7d,_0x168598){_0x168598=_0x168598||0xcc;return function(_0x382139){if(_0x382139){return _0x5cbc7d[_0x2180('0x15')](_0x168598);}return _0x5cbc7d['status'](_0x168598)[_0x2180('0x16')]();};}function respondWithResult(_0x1653ce,_0x575845){_0x575845=_0x575845||0xc8;return function(_0x41db7d){if(_0x41db7d){return _0x1653ce[_0x2180('0x17')](_0x575845)[_0x2180('0x18')](_0x41db7d);}};}function respondWithFilteredResult(_0x16f9cb,_0x49f5c8){return function(_0x276e4e){if(_0x276e4e){var _0x3ad768=typeof _0x49f5c8['offset']==='undefined'&&typeof _0x49f5c8[_0x2180('0x19')]==='undefined';var _0x4d99b1=_0x276e4e['count'];var _0x260406=_0x3ad768?0x0:_0x49f5c8['offset'];var _0x11f97d=_0x3ad768?_0x276e4e[_0x2180('0x1a')]:_0x49f5c8[_0x2180('0x1b')]+_0x49f5c8[_0x2180('0x19')];var _0x1e74c9;if(_0x11f97d>=_0x4d99b1){_0x11f97d=_0x4d99b1;_0x1e74c9=0xc8;}else{_0x1e74c9=0xce;}_0x16f9cb[_0x2180('0x17')](_0x1e74c9);return _0x16f9cb[_0x2180('0x1c')](_0x2180('0x1d'),_0x260406+'-'+_0x11f97d+'/'+_0x4d99b1)[_0x2180('0x18')](_0x276e4e);}return null;};}function patchUpdates(_0x5c2841){return function(_0x4fff48){try{jsonpatch['apply'](_0x4fff48,_0x5c2841,!![]);}catch(_0x448862){return BPromise[_0x2180('0x1e')](_0x448862);}return _0x4fff48[_0x2180('0x1f')]();};}function saveUpdates(_0x3d51a6,_0x137ba9){return function(_0x3e3c63){if(_0x3e3c63){return _0x3e3c63['update'](_0x3d51a6)[_0x2180('0x20')](function(_0x3406b3){return _0x3406b3;});}return null;};}function removeEntity(_0x2aa8b7,_0x31875a){return function(_0x258fee){if(_0x258fee){return _0x258fee['destroy']()['then'](function(){_0x2aa8b7['status'](0xcc)[_0x2180('0x16')]();});}};}function handleEntityNotFound(_0x484875,_0x5677f6){return function(_0x29e3a2){if(!_0x29e3a2){_0x484875[_0x2180('0x15')](0x194);}return _0x29e3a2;};}function handleError(_0x21cf57,_0x5314be){_0x5314be=_0x5314be||0x1f4;return function(_0x4ec448){logger[_0x2180('0x21')](_0x4ec448['stack']);if(_0x4ec448[_0x2180('0x22')]){delete _0x4ec448[_0x2180('0x22')];}_0x21cf57[_0x2180('0x17')](_0x5314be)[_0x2180('0x23')](_0x4ec448);};}var utilLicense=require(_0x2180('0x13'));exports[_0x2180('0x24')]=function(_0x19a597,_0x500b7a){var _0x212666={'raw':!![],'where':{'id':0x1}},_0x4f3b1e={};_0x4f3b1e[_0x2180('0x25')]=_['keys'](db[_0x2180('0x26')]['rawAttributes']);_0x4f3b1e[_0x2180('0x27')]=_[_0x2180('0x28')](_0x19a597[_0x2180('0x27')]);_0x4f3b1e[_0x2180('0x29')]=_[_0x2180('0x2a')](_0x4f3b1e[_0x2180('0x25')],_0x4f3b1e['query']);_0x212666[_0x2180('0x2b')]=_[_0x2180('0x2a')](_0x4f3b1e['model'],qs[_0x2180('0x2c')](_0x19a597['query'][_0x2180('0x2c')]));_0x212666['attributes']=_0x212666['attributes'][_0x2180('0x2d')]?_0x212666[_0x2180('0x2b')]:_0x4f3b1e[_0x2180('0x25')];_0x212666=_[_0x2180('0x2e')]({},_0x212666,_0x19a597[_0x2180('0x2f')]);return utilLicense[_0x2180('0x30')](_0x212666)[_0x2180('0x20')](respondWithResult(_0x500b7a,null))[_0x2180('0x31')](handleError(_0x500b7a,null));};exports[_0x2180('0x32')]=function(_0x454116,_0x1c57ed){if(_0x454116[_0x2180('0x33')]['id']){delete _0x454116[_0x2180('0x33')]['id'];}return db[_0x2180('0x26')][_0x2180('0x34')]({'where':{'id':_0x454116['params']['id']}})[_0x2180('0x20')](handleEntityNotFound(_0x1c57ed,null))[_0x2180('0x20')](function(_0x97d433){var _0x175ead=_0x97d433['get']({'plain':!![]});return utilLicense[_0x2180('0x35')](_0x175ead,_0x454116[_0x2180('0x33')]['key']);})[_0x2180('0x20')](function(_0x358c01){if(!_0x358c01[_0x2180('0x36')]){return saveUpdates(_0x454116[_0x2180('0x33')],null);}return _0x358c01;})[_0x2180('0x20')](respondWithResult(_0x1c57ed,null))[_0x2180('0x31')](handleError(_0x1c57ed,null));};exports[_0x2180('0x37')]=function(_0x3f83aa,_0x34b5d7){var _0x33ec12=_0x2180('0x38');var _0xb5a9bd=path['join']('/var','log','xcally',_0x33ec12);_0x34b5d7[_0x2180('0x39')](_0x2180('0x3a'),_0x2180('0x3b')+_0x33ec12);_0x34b5d7[_0x2180('0x1c')]('Content-Type',_0x2180('0x3c'));_0x34b5d7[_0x2180('0x3d')](_0xb5a9bd);}; \ No newline at end of file +var _0xc6c2=['apply','reject','save','then','error','stack','name','send','index','model','keys','query','filters','intersection','fields','attributes','merge','getLicense','update','body','License','params','get','checkLicense','catch','downloadLogFile','license-info.log','Content-disposition','Content-Type','text/plain','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','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/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set'];(function(_0x58ed30,_0x2dae2e){var _0xfb71e9=function(_0x2ecd76){while(--_0x2ecd76){_0x58ed30['push'](_0x58ed30['shift']());}};_0xfb71e9(++_0x2dae2e);}(_0xc6c2,0x169));var _0x2c6c=function(_0x31ced5,_0x5d5415){_0x31ced5=_0x31ced5-0x0;var _0x10d9e5=_0xc6c2[_0x31ced5];return _0x10d9e5;};'use strict';var emlformat=require(_0x2c6c('0x0'));var rimraf=require(_0x2c6c('0x1'));var zipdir=require(_0x2c6c('0x2'));var jsonpatch=require(_0x2c6c('0x3'));var rp=require(_0x2c6c('0x4'));var moment=require('moment');var BPromise=require(_0x2c6c('0x5'));var Mustache=require('mustache');var util=require(_0x2c6c('0x6'));var path=require(_0x2c6c('0x7'));var sox=require(_0x2c6c('0x8'));var csv=require(_0x2c6c('0x9'));var ejs=require(_0x2c6c('0xa'));var fs=require('fs');var fs_extra=require(_0x2c6c('0xb'));var _=require(_0x2c6c('0xc'));var squel=require(_0x2c6c('0xd'));var crypto=require(_0x2c6c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x2c6c('0xf'));var toCsv=require(_0x2c6c('0x9'));var querystring=require('querystring');var Papa=require(_0x2c6c('0x10'));var Redis=require('ioredis');var authService=require(_0x2c6c('0x11'));var qs=require(_0x2c6c('0x12'));var as=require(_0x2c6c('0x13'));var hardwareService=require(_0x2c6c('0x14'));var logger=require(_0x2c6c('0x15'))(_0x2c6c('0x16'));var utils=require('../../config/utils');var config=require(_0x2c6c('0x17'));var licenseUtil=require(_0x2c6c('0x18'));var db=require(_0x2c6c('0x19'))['db'];function respondWithStatusCode(_0x5a4805,_0x4a10ab){_0x4a10ab=_0x4a10ab||0xcc;return function(_0x5d44c4){if(_0x5d44c4){return _0x5a4805[_0x2c6c('0x1a')](_0x4a10ab);}return _0x5a4805['status'](_0x4a10ab)[_0x2c6c('0x1b')]();};}function respondWithResult(_0x523557,_0xf0fd3d){_0xf0fd3d=_0xf0fd3d||0xc8;return function(_0x241f28){if(_0x241f28){return _0x523557[_0x2c6c('0x1c')](_0xf0fd3d)[_0x2c6c('0x1d')](_0x241f28);}};}function respondWithFilteredResult(_0xb996e3,_0xd5fb89){return function(_0x429057){if(_0x429057){var _0x50f266=typeof _0xd5fb89[_0x2c6c('0x1e')]===_0x2c6c('0x1f')&&typeof _0xd5fb89[_0x2c6c('0x20')]===_0x2c6c('0x1f');var _0x479d24=_0x429057['count'];var _0x2748c5=_0x50f266?0x0:_0xd5fb89[_0x2c6c('0x1e')];var _0x4977ca=_0x50f266?_0x429057[_0x2c6c('0x21')]:_0xd5fb89[_0x2c6c('0x1e')]+_0xd5fb89[_0x2c6c('0x20')];var _0x125795;if(_0x4977ca>=_0x479d24){_0x4977ca=_0x479d24;_0x125795=0xc8;}else{_0x125795=0xce;}_0xb996e3['status'](_0x125795);return _0xb996e3[_0x2c6c('0x22')]('Content-Range',_0x2748c5+'-'+_0x4977ca+'/'+_0x479d24)['json'](_0x429057);}return null;};}function patchUpdates(_0x329cc0){return function(_0x3eccd5){try{jsonpatch[_0x2c6c('0x23')](_0x3eccd5,_0x329cc0,!![]);}catch(_0x2a7650){return BPromise[_0x2c6c('0x24')](_0x2a7650);}return _0x3eccd5[_0x2c6c('0x25')]();};}function saveUpdates(_0x33c6a5,_0x129261){return function(_0x18a8a7){if(_0x18a8a7){return _0x18a8a7['update'](_0x33c6a5)[_0x2c6c('0x26')](function(_0x45e583){return _0x45e583;});}return null;};}function removeEntity(_0x3d75e9,_0xa8adb1){return function(_0x42b65a){if(_0x42b65a){return _0x42b65a['destroy']()['then'](function(){_0x3d75e9[_0x2c6c('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e4f3d,_0x15b160){return function(_0x298362){if(!_0x298362){_0x5e4f3d[_0x2c6c('0x1a')](0x194);}return _0x298362;};}function handleError(_0x2f9b7c,_0x414271){_0x414271=_0x414271||0x1f4;return function(_0xf59496){logger[_0x2c6c('0x27')](_0xf59496[_0x2c6c('0x28')]);if(_0xf59496['name']){delete _0xf59496[_0x2c6c('0x29')];}_0x2f9b7c['status'](_0x414271)[_0x2c6c('0x2a')](_0xf59496);};}var utilLicense=require(_0x2c6c('0x18'));exports[_0x2c6c('0x2b')]=function(_0x3b61b9,_0x14c9c5){var _0x2182d3={'raw':!![],'where':{'id':0x1}},_0x15ba55={};_0x15ba55[_0x2c6c('0x2c')]=_[_0x2c6c('0x2d')](db['License']['rawAttributes']);_0x15ba55['query']=_[_0x2c6c('0x2d')](_0x3b61b9[_0x2c6c('0x2e')]);_0x15ba55[_0x2c6c('0x2f')]=_[_0x2c6c('0x30')](_0x15ba55[_0x2c6c('0x2c')],_0x15ba55['query']);_0x2182d3['attributes']=_['intersection'](_0x15ba55['model'],qs[_0x2c6c('0x31')](_0x3b61b9['query']['fields']));_0x2182d3[_0x2c6c('0x32')]=_0x2182d3[_0x2c6c('0x32')]['length']?_0x2182d3[_0x2c6c('0x32')]:_0x15ba55[_0x2c6c('0x2c')];_0x2182d3=_[_0x2c6c('0x33')]({},_0x2182d3,_0x3b61b9['options']);return utilLicense[_0x2c6c('0x34')](_0x2182d3)[_0x2c6c('0x26')](respondWithResult(_0x14c9c5,null))['catch'](handleError(_0x14c9c5,null));};exports[_0x2c6c('0x35')]=function(_0x1a3775,_0x435097){if(_0x1a3775[_0x2c6c('0x36')]['id']){delete _0x1a3775[_0x2c6c('0x36')]['id'];}return db[_0x2c6c('0x37')]['find']({'where':{'id':_0x1a3775[_0x2c6c('0x38')]['id']}})[_0x2c6c('0x26')](handleEntityNotFound(_0x435097,null))[_0x2c6c('0x26')](function(_0x13a0f4){var _0x1a70f0=_0x13a0f4[_0x2c6c('0x39')]({'plain':!![]});return utilLicense[_0x2c6c('0x3a')](_0x1a70f0,_0x1a3775[_0x2c6c('0x36')]['key']);})['then'](function(_0x577b84){if(!_0x577b84['demo']){return saveUpdates(_0x1a3775[_0x2c6c('0x36')],null);}return _0x577b84;})[_0x2c6c('0x26')](respondWithResult(_0x435097,null))[_0x2c6c('0x3b')](handleError(_0x435097,null));};exports[_0x2c6c('0x3c')]=function(_0x40bf2e,_0x5a3af4){var _0x41fc69=_0x2c6c('0x3d');var _0x5c454a=path['join']('/var','log','xcally',_0x41fc69);_0x5a3af4['setHeader'](_0x2c6c('0x3e'),'attachment;\x20filename='+_0x41fc69);_0x5a3af4[_0x2c6c('0x22')](_0x2c6c('0x3f'),_0x2c6c('0x40'));_0x5a3af4[_0x2c6c('0x41')](_0x5c454a);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 5586ef3..81cf8cf 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 _0xcfec=['moment','request-promise','path','rimraf','../../config/environment','exports','define','License','license','util','api'];(function(_0x39998f,_0x4b1a9e){var _0x296d5a=function(_0x374196){while(--_0x374196){_0x39998f['push'](_0x39998f['shift']());}};_0x296d5a(++_0x4b1a9e);}(_0xcfec,0x1ed));var _0xccfe=function(_0x33e55a,_0x3d5690){_0x33e55a=_0x33e55a-0x0;var _0x542283=_0xcfec[_0x33e55a];return _0x542283;};'use strict';var _=require('lodash');var util=require(_0xccfe('0x0'));var logger=require('../../config/logger')(_0xccfe('0x1'));var moment=require(_0xccfe('0x2'));var BPromise=require('bluebird');var rp=require(_0xccfe('0x3'));var fs=require('fs');var path=require(_0xccfe('0x4'));var rimraf=require(_0xccfe('0x5'));var config=require(_0xccfe('0x6'));var attributes=require('./license.attributes');module[_0xccfe('0x7')]=function(_0x1fa600,_0x363755){return _0x1fa600[_0xccfe('0x8')](_0xccfe('0x9'),attributes,{'tableName':_0xccfe('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0323=['rimraf','./license.attributes','exports','License','license','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0xd3e0b9,_0xd80d4d){var _0x470133=function(_0x1aede8){while(--_0x1aede8){_0xd3e0b9['push'](_0xd3e0b9['shift']());}};_0x470133(++_0xd80d4d);}(_0x0323,0x102));var _0x3032=function(_0x2aa143,_0x291b67){_0x2aa143=_0x2aa143-0x0;var _0x33deb7=_0x0323[_0x2aa143];return _0x33deb7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3032('0x0'))(_0x3032('0x1'));var moment=require(_0x3032('0x2'));var BPromise=require(_0x3032('0x3'));var rp=require(_0x3032('0x4'));var fs=require('fs');var path=require(_0x3032('0x5'));var rimraf=require(_0x3032('0x6'));var config=require('../../config/environment');var attributes=require(_0x3032('0x7'));module[_0x3032('0x8')]=function(_0x24f8d7,_0xa52641){return _0x24f8d7['define'](_0x3032('0x9'),attributes,{'tableName':_0x3032('0xa'),'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 7f5a83f..16c5417 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 _0x467a=['stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s'];(function(_0x2ab365,_0xa3812e){var _0x49fef3=function(_0x29b883){while(--_0x29b883){_0x2ab365['push'](_0x2ab365['shift']());}};_0x49fef3(++_0xa3812e);}(_0x467a,0x119));var _0xa467=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x467a[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xa467('0x0'));var util=require('util');var moment=require(_0xa467('0x1'));var BPromise=require(_0xa467('0x2'));var rs=require(_0xa467('0x3'));var fs=require('fs');var Redis=require(_0xa467('0x4'));var db=require(_0xa467('0x5'))['db'];var utils=require(_0xa467('0x6'));var logger=require(_0xa467('0x7'))(_0xa467('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa467('0x9')][_0xa467('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x109198,_0x55a4e3,_0x4e2fbc){return new BPromise(function(_0x956bbf,_0x35ed8d){return client[_0xa467('0xb')](_0x109198,_0x4e2fbc)[_0xa467('0xc')](function(_0x3f8eee){logger[_0xa467('0xd')](_0xa467('0xe'),_0x55a4e3,_0xa467('0xf'));logger[_0xa467('0x10')](_0xa467('0x11'),_0x55a4e3,_0xa467('0xf'),JSON[_0xa467('0x12')](_0x3f8eee));if(_0x3f8eee[_0xa467('0x13')]){if(_0x3f8eee[_0xa467('0x13')][_0xa467('0x14')]===0x1f4){logger['error'](_0xa467('0xe'),_0x55a4e3,_0x3f8eee[_0xa467('0x13')][_0xa467('0x15')]);return _0x35ed8d(_0x3f8eee[_0xa467('0x13')][_0xa467('0x15')]);}logger[_0xa467('0x13')](_0xa467('0xe'),_0x55a4e3,_0x3f8eee[_0xa467('0x13')][_0xa467('0x15')]);return _0x956bbf(_0x3f8eee[_0xa467('0x13')][_0xa467('0x15')]);}else{logger[_0xa467('0xd')]('License,\x20%s,\x20%s',_0x55a4e3,_0xa467('0xf'));_0x956bbf(_0x3f8eee['result']['message']);}})[_0xa467('0x16')](function(_0x18e898){logger[_0xa467('0x13')](_0xa467('0xe'),_0x55a4e3,_0x18e898);_0x35ed8d(_0x18e898);});});} \ No newline at end of file +var _0x1a43=['catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','License,\x20%s,\x20%s','debug','License,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0x1a43,0xb0));var _0x31a4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1a43[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x31a4('0x0'));var util=require('util');var moment=require(_0x31a4('0x1'));var BPromise=require('bluebird');var rs=require(_0x31a4('0x2'));var fs=require('fs');var Redis=require(_0x31a4('0x3'));var db=require(_0x31a4('0x4'))['db'];var utils=require(_0x31a4('0x5'));var logger=require(_0x31a4('0x6'))(_0x31a4('0x7'));var config=require(_0x31a4('0x8'));var jayson=require(_0x31a4('0x9'));var client=jayson[_0x31a4('0xa')][_0x31a4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xe938e8,_0x22d7fc,_0x5eb35c){return new BPromise(function(_0x4ae87d,_0x2d94eb){return client[_0x31a4('0xc')](_0xe938e8,_0x5eb35c)[_0x31a4('0xd')](function(_0x4592a8){logger[_0x31a4('0xe')](_0x31a4('0xf'),_0x22d7fc,'request\x20sent');logger[_0x31a4('0x10')](_0x31a4('0x11'),_0x22d7fc,_0x31a4('0x12'),JSON[_0x31a4('0x13')](_0x4592a8));if(_0x4592a8[_0x31a4('0x14')]){if(_0x4592a8['error'][_0x31a4('0x15')]===0x1f4){logger[_0x31a4('0x14')]('License,\x20%s,\x20%s',_0x22d7fc,_0x4592a8[_0x31a4('0x14')][_0x31a4('0x16')]);return _0x2d94eb(_0x4592a8[_0x31a4('0x14')]['message']);}logger[_0x31a4('0x14')](_0x31a4('0xf'),_0x22d7fc,_0x4592a8[_0x31a4('0x14')][_0x31a4('0x16')]);return _0x4ae87d(_0x4592a8[_0x31a4('0x14')][_0x31a4('0x16')]);}else{logger[_0x31a4('0xe')](_0x31a4('0xf'),_0x22d7fc,_0x31a4('0x12'));_0x4ae87d(_0x4592a8[_0x31a4('0x17')][_0x31a4('0x16')]);}})[_0x31a4('0x18')](function(_0x5c11b3){logger['error'](_0x31a4('0xf'),_0x22d7fc,_0x5c11b3);_0x2d94eb(_0x5c11b3);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 426933d..9a362bd 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 _0x3071=['post','addDisposition','addAnswer','create','addImap','addSmtp','addInteraction','send','put','update','delete','removeDispositions','removeAnswers','removeImap','destroy','removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','/:id/messages','getMessages','/:id/verify','/:id/users','getAgents'];(function(_0x1b943f,_0x6f6e83){var _0x8b7549=function(_0x5b52d3){while(--_0x5b52d3){_0x1b943f['push'](_0x1b943f['shift']());}};_0x8b7549(++_0x6f6e83);}(_0x3071,0x6f));var _0x1307=function(_0x38ce4c,_0xfdbe8c){_0x38ce4c=_0x38ce4c-0x0;var _0x5d4544=_0x3071[_0x38ce4c];return _0x5d4544;};'use strict';var multer=require('multer');var util=require(_0x1307('0x0'));var path=require(_0x1307('0x1'));var timeout=require(_0x1307('0x2'));var express=require(_0x1307('0x3'));var router=express[_0x1307('0x4')]();var fs_extra=require(_0x1307('0x5'));var auth=require(_0x1307('0x6'));var interaction=require(_0x1307('0x7'));var config=require(_0x1307('0x8'));var controller=require('./mailAccount.controller');router['get']('/',auth[_0x1307('0x9')](),controller[_0x1307('0xa')]);router[_0x1307('0xb')](_0x1307('0xc'),auth[_0x1307('0x9')](),controller[_0x1307('0xd')]);router[_0x1307('0xb')](_0x1307('0xe'),auth[_0x1307('0x9')](),controller[_0x1307('0xf')]);router[_0x1307('0xb')](_0x1307('0x10'),auth[_0x1307('0x9')](),controller[_0x1307('0x11')]);router['get'](_0x1307('0x12'),auth['isAuthenticated'](),controller[_0x1307('0x13')]);router[_0x1307('0xb')](_0x1307('0x14'),auth[_0x1307('0x9')](),controller[_0x1307('0x15')]);router['get'](_0x1307('0x16'),auth[_0x1307('0x9')](),controller[_0x1307('0x17')]);router[_0x1307('0xb')](_0x1307('0x18'),auth[_0x1307('0x9')](),controller['getInteractions']);router[_0x1307('0xb')]('/:id/applications',auth[_0x1307('0x9')](),controller['getApplications']);router[_0x1307('0xb')](_0x1307('0x19'),auth[_0x1307('0x9')](),controller[_0x1307('0x1a')]);router[_0x1307('0xb')](_0x1307('0x1b'),auth['isAuthenticated'](),controller['verifySmtp']);router[_0x1307('0xb')](_0x1307('0x1c'),auth[_0x1307('0x9')](),controller[_0x1307('0x1d')]);router[_0x1307('0x1e')](_0x1307('0x10'),auth['isAuthenticated'](),controller[_0x1307('0x1f')]);router['post']('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x1307('0x20')]);router[_0x1307('0x1e')]('/',auth[_0x1307('0x9')](),controller[_0x1307('0x21')]);router['post'](_0x1307('0x14'),auth['isAuthenticated'](),controller[_0x1307('0x22')]);router['post'](_0x1307('0x16'),auth['isAuthenticated'](),controller[_0x1307('0x23')]);router[_0x1307('0x1e')](_0x1307('0x18'),auth[_0x1307('0x9')](),controller[_0x1307('0x24')]);router[_0x1307('0x1e')]('/:id/applications',auth[_0x1307('0x9')](),controller['addApplications']);router['post']('/:id/send',auth['isAuthenticated'](),controller[_0x1307('0x25')]);router['post'](_0x1307('0x1c'),auth[_0x1307('0x9')](),controller['addAgents']);router[_0x1307('0x26')](_0x1307('0xe'),auth[_0x1307('0x9')](),controller[_0x1307('0x27')]);router[_0x1307('0x28')](_0x1307('0x10'),auth[_0x1307('0x9')](),controller[_0x1307('0x29')]);router[_0x1307('0x28')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x1307('0x2a')]);router[_0x1307('0x28')](_0x1307('0x14'),auth[_0x1307('0x9')](),controller[_0x1307('0x2b')]);router[_0x1307('0x28')](_0x1307('0x16'),auth[_0x1307('0x9')](),controller['removeSmtp']);router[_0x1307('0x28')]('/:id',auth[_0x1307('0x9')](),controller[_0x1307('0x2c')]);router[_0x1307('0x28')]('/:id/users',auth[_0x1307('0x9')](),controller[_0x1307('0x2d')]);module[_0x1307('0x2e')]=router; \ No newline at end of file +var _0x7da7=['get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','addDisposition','post','addAnswer','addImap','addSmtp','addInteraction','/:id/send','send','addAgents','update','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller'];(function(_0x5f367e,_0x496f43){var _0x520ecf=function(_0x24ba0d){while(--_0x24ba0d){_0x5f367e['push'](_0x5f367e['shift']());}};_0x520ecf(++_0x496f43);}(_0x7da7,0xc5));var _0x77da=function(_0x1bd323,_0x1c16ab){_0x1bd323=_0x1bd323-0x0;var _0x13097b=_0x7da7[_0x1bd323];return _0x13097b;};'use strict';var multer=require(_0x77da('0x0'));var util=require(_0x77da('0x1'));var path=require(_0x77da('0x2'));var timeout=require(_0x77da('0x3'));var express=require(_0x77da('0x4'));var router=express[_0x77da('0x5')]();var fs_extra=require(_0x77da('0x6'));var auth=require(_0x77da('0x7'));var interaction=require(_0x77da('0x8'));var config=require(_0x77da('0x9'));var controller=require(_0x77da('0xa'));router[_0x77da('0xb')]('/',auth[_0x77da('0xc')](),controller[_0x77da('0xd')]);router['get'](_0x77da('0xe'),auth[_0x77da('0xc')](),controller[_0x77da('0xf')]);router['get'](_0x77da('0x10'),auth[_0x77da('0xc')](),controller[_0x77da('0x11')]);router[_0x77da('0xb')](_0x77da('0x12'),auth['isAuthenticated'](),controller[_0x77da('0x13')]);router[_0x77da('0xb')](_0x77da('0x14'),auth[_0x77da('0xc')](),controller[_0x77da('0x15')]);router[_0x77da('0xb')](_0x77da('0x16'),auth[_0x77da('0xc')](),controller['getImap']);router['get'](_0x77da('0x17'),auth['isAuthenticated'](),controller[_0x77da('0x18')]);router['get'](_0x77da('0x19'),auth[_0x77da('0xc')](),controller[_0x77da('0x1a')]);router['get'](_0x77da('0x1b'),auth[_0x77da('0xc')](),controller['getApplications']);router[_0x77da('0xb')](_0x77da('0x1c'),auth[_0x77da('0xc')](),controller[_0x77da('0x1d')]);router['get'](_0x77da('0x1e'),auth['isAuthenticated'](),controller[_0x77da('0x1f')]);router['get'](_0x77da('0x20'),auth[_0x77da('0xc')](),controller[_0x77da('0x21')]);router['post']('/:id/dispositions',auth['isAuthenticated'](),controller[_0x77da('0x22')]);router[_0x77da('0x23')]('/:id/canned_answers',auth[_0x77da('0xc')](),controller[_0x77da('0x24')]);router[_0x77da('0x23')]('/',auth[_0x77da('0xc')](),controller['create']);router[_0x77da('0x23')](_0x77da('0x16'),auth[_0x77da('0xc')](),controller[_0x77da('0x25')]);router[_0x77da('0x23')](_0x77da('0x17'),auth[_0x77da('0xc')](),controller[_0x77da('0x26')]);router[_0x77da('0x23')](_0x77da('0x19'),auth['isAuthenticated'](),controller[_0x77da('0x27')]);router[_0x77da('0x23')](_0x77da('0x1b'),auth[_0x77da('0xc')](),controller['addApplications']);router[_0x77da('0x23')](_0x77da('0x28'),auth[_0x77da('0xc')](),controller[_0x77da('0x29')]);router[_0x77da('0x23')](_0x77da('0x20'),auth[_0x77da('0xc')](),controller[_0x77da('0x2a')]);router['put'](_0x77da('0x10'),auth[_0x77da('0xc')](),controller[_0x77da('0x2b')]);router[_0x77da('0x2c')](_0x77da('0x12'),auth[_0x77da('0xc')](),controller[_0x77da('0x2d')]);router[_0x77da('0x2c')](_0x77da('0x14'),auth[_0x77da('0xc')](),controller[_0x77da('0x2e')]);router[_0x77da('0x2c')](_0x77da('0x16'),auth['isAuthenticated'](),controller[_0x77da('0x2f')]);router[_0x77da('0x2c')](_0x77da('0x17'),auth['isAuthenticated'](),controller[_0x77da('0x30')]);router[_0x77da('0x2c')](_0x77da('0x10'),auth[_0x77da('0xc')](),controller[_0x77da('0x31')]);router[_0x77da('0x2c')]('/:id/users',auth[_0x77da('0xc')](),controller[_0x77da('0x32')]);module[_0x77da('0x33')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index dd92925..b501083 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 _0x1fe1=['provider','custom','sequelize','exports','BOOLEAN','STRING','TEXT','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','ENUM','hotmail','outlook365'];(function(_0x39758d,_0x346423){var _0x44ac11=function(_0x175008){while(--_0x175008){_0x39758d['push'](_0x39758d['shift']());}};_0x44ac11(++_0x346423);}(_0x1fe1,0xa7));var _0x11fe=function(_0x58603a,_0x454b47){_0x58603a=_0x58603a-0x0;var _0x16071c=_0x1fe1[_0x58603a];return _0x16071c;};'use strict';var Sequelize=require(_0x11fe('0x0'));module[_0x11fe('0x1')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize[_0x11fe('0x2')],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0x11fe('0x3')],'allowNull':![]},'template':{'type':Sequelize[_0x11fe('0x4')]},'markAsUnread':{'type':Sequelize[_0x11fe('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0x11fe('0x5')](0x2)[_0x11fe('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x11fe('0x4')],'defaultValue':function(){return _0x11fe('0x7');}},'notificationSound':{'type':Sequelize[_0x11fe('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x11fe('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x11fe('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x11fe('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x11fe('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x11fe('0x5')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x11fe('0x2')],'defaultValue':![],'comment':_0x11fe('0x8'),'set':function(_0x571173){if(!_0x571173)this[_0x11fe('0x9')]('mandatoryDispositionPauseId',null);this[_0x11fe('0x9')]('mandatoryDisposition',_0x571173);}},'provider':{'type':Sequelize[_0x11fe('0xa')]('gmail',_0x11fe('0xb'),'yahoo',_0x11fe('0xc')),'defaultValue':null,'get':function(){if(!this['getDataValue'](_0x11fe('0xd')))return _0x11fe('0xe');return this['getDataValue'](_0x11fe('0xd'));},'set':function(_0x58f1c3){if(_0x58f1c3===_0x11fe('0xe'))_0x58f1c3=null;return this[_0x11fe('0x9')](_0x11fe('0xd'),_0x58f1c3);}}}; \ No newline at end of file +var _0xd6f1=['setDataValue','ENUM','hotmail','yahoo','outlook365','getDataValue','provider','custom','sequelize','STRING','BOOLEAN','TEXT','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xd6f1,0x15c));var _0x1d6f=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xd6f1[_0x4709c0];return _0x13348b;};'use strict';var Sequelize=require(_0x1d6f('0x0'));module['exports']={'description':{'type':Sequelize[_0x1d6f('0x1')]},'name':{'type':Sequelize[_0x1d6f('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0x1d6f('0x2')],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0x1d6f('0x3')]},'markAsUnread':{'type':Sequelize[_0x1d6f('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x1d6f('0x1')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0x1d6f('0x4')](0x2)[_0x1d6f('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x1d6f('0x3')],'defaultValue':function(){return _0x1d6f('0x6');}},'notificationSound':{'type':Sequelize[_0x1d6f('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x1d6f('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x1d6f('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1d6f('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1d6f('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x1d6f('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x1d6f('0x4')],'allowNull':!![],'defaultValue':null,'comment':_0x1d6f('0x7')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x1d6f('0x8'),'set':function(_0x52539e){if(!_0x52539e)this[_0x1d6f('0x9')]('mandatoryDispositionPauseId',null);this['setDataValue']('mandatoryDisposition',_0x52539e);}},'provider':{'type':Sequelize[_0x1d6f('0xa')]('gmail',_0x1d6f('0xb'),_0x1d6f('0xc'),_0x1d6f('0xd')),'defaultValue':null,'get':function(){if(!this[_0x1d6f('0xe')](_0x1d6f('0xf')))return _0x1d6f('0x10');return this[_0x1d6f('0xe')]('provider');},'set':function(_0x531c51){if(_0x531c51===_0x1d6f('0x10'))_0x531c51=null;return this['setDataValue']('provider',_0x531c51);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 4e5630b..b98cc47 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 _0xfc1f=['join','basename','getSmtpOptions','SendMail','List\x20not\x20found','messageId','subject','attach','out','Messages','VerifySmtp','verifySmtp','Sequelize','ValidationError','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','bluebird','util','path','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','destroy','get','MailAccounts','UserProfileResource','stack','name','gmail','yahoo','imap.mail.yahoo.com','outlook365','outlook.office365.com','smtp.gmail.com','hotmail','smtp-mail.outlook.com','smtp.office365.com','Unknown\x20email\x20service\x20provider','user','username','password','modernAuthentication','CloudProviderId','pass','host','port','secure','service','authentication','Imap','Smtp','index','MailServerIn','MailServerOut','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','params','length','include','find','body','provider','Mail\x20Account\x20not\x20found','describe','MailAccountId','Disposition','hasOwnProperty','nolimit','rows','removeDispositions','ids','addAnswer','create','getAnswers','CannedAnswer','removeAnswers','key','custom','email','ListId','isNil','active','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','findOne','addImap','removeImap','setImap','getSmtp','removeSmtp','MailInteraction','addInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','internal','Tag','color','tag','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','priority','finally','send','getApplications','getMessages','MailMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','inlineCss','CmList','List','Contacts','updatedAt','DESC','CloudProvider','from','format','%s\x20<%s>','attachments'];(function(_0x1e21a6,_0x3b097c){var _0x483f55=function(_0x462e1b){while(--_0x462e1b){_0x1e21a6['push'](_0x1e21a6['shift']());}};_0x483f55(++_0x3b097c);}(_0xfc1f,0xd6));var _0xffc1=function(_0x1ee909,_0x50ec30){_0x1ee909=_0x1ee909-0x0;var _0x256cde=_0xfc1f[_0x1ee909];return _0x256cde;};'use strict';var moment=require('moment');var BPromise=require(_0xffc1('0x0'));var util=require(_0xffc1('0x1'));var path=require(_0xffc1('0x2'));var _=require('lodash');var juice=require(_0xffc1('0x3'));var Redis=require(_0xffc1('0x4'));var qs=require(_0xffc1('0x5'));var logger=require(_0xffc1('0x6'))(_0xffc1('0x7'));var config=require(_0xffc1('0x8'));var db=require(_0xffc1('0x9'))['db'];config[_0xffc1('0xa')]=_[_0xffc1('0xb')](config[_0xffc1('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xffc1('0xc'))(new Redis(config[_0xffc1('0xa')]));require(_0xffc1('0xd'))[_0xffc1('0xe')](socket);var jayson=require(_0xffc1('0xf'));var client=jayson[_0xffc1('0x10')]['http']({'port':0x232b});function respondWithRpcPromise(_0x5d444f,_0x3e9ca2,_0x3f8b63,_0x37447c){return new BPromise(function(_0x4fc2ee,_0x1770c0){var _0x5e5086=_0x37447c||client;return _0x5e5086['request'](_0x5d444f,_0x3f8b63)[_0xffc1('0x11')](function(_0xd54200){logger[_0xffc1('0x12')](_0xffc1('0x13'),_0x3e9ca2,_0xffc1('0x14'));logger[_0xffc1('0x15')](_0xffc1('0x16'),_0x3e9ca2,_0xffc1('0x14'),JSON['stringify'](_0xd54200));if(_0xd54200[_0xffc1('0x17')]){if(_0xd54200[_0xffc1('0x17')]['code']===0x1f4){logger[_0xffc1('0x17')](_0xffc1('0x13'),_0x3e9ca2,_0xd54200[_0xffc1('0x17')]['message']);return _0x1770c0(_0xd54200[_0xffc1('0x17')]['message']);}logger['error'](_0xffc1('0x13'),_0x3e9ca2,_0xd54200[_0xffc1('0x17')][_0xffc1('0x18')]);return _0x4fc2ee(_0xd54200['error'][_0xffc1('0x18')]);}else{logger[_0xffc1('0x12')](_0xffc1('0x13'),_0x3e9ca2,_0xffc1('0x14'));_0x4fc2ee(_0xd54200[_0xffc1('0x19')][_0xffc1('0x18')]);}})[_0xffc1('0x1a')](function(_0x2607ab){logger[_0xffc1('0x17')](_0xffc1('0x13'),_0x3e9ca2,_0x2607ab);_0x1770c0(_0x2607ab);});});}function respondWithStatusCode(_0x22da22,_0x4f950e){_0x4f950e=_0x4f950e||0xcc;return function(_0x358423){if(_0x358423){return _0x22da22[_0xffc1('0x1b')](_0x4f950e);}return _0x22da22[_0xffc1('0x1c')](_0x4f950e)[_0xffc1('0x1d')]();};}function respondWithResult(_0x269c04,_0x1956b1){_0x1956b1=_0x1956b1||0xc8;return function(_0x50ba24){if(_0x50ba24){return _0x269c04['status'](_0x1956b1)[_0xffc1('0x1e')](_0x50ba24);}};}function respondWithFilteredResult(_0x459088,_0x2cf6e4){return function(_0x31d3f1){if(_0x31d3f1){var _0x216071=typeof _0x2cf6e4[_0xffc1('0x1f')]===_0xffc1('0x20')&&typeof _0x2cf6e4[_0xffc1('0x21')]===_0xffc1('0x20');var _0x34fabd=_0x31d3f1[_0xffc1('0x22')];var _0x73f815=_0x216071?0x0:_0x2cf6e4['offset'];var _0x2b2222=_0x216071?_0x31d3f1[_0xffc1('0x22')]:_0x2cf6e4['offset']+_0x2cf6e4[_0xffc1('0x21')];var _0x579cd4;if(_0x2b2222>=_0x34fabd){_0x2b2222=_0x34fabd;_0x579cd4=0xc8;}else{_0x579cd4=0xce;}_0x459088[_0xffc1('0x1c')](_0x579cd4);return _0x459088[_0xffc1('0x23')](_0xffc1('0x24'),_0x73f815+'-'+_0x2b2222+'/'+_0x34fabd)['json'](_0x31d3f1);}return null;};}function saveUpdates(_0x3f5150){return function(_0xcf7cd7){if(_0xcf7cd7){return _0xcf7cd7[_0xffc1('0x25')](_0x3f5150)[_0xffc1('0x11')](function(_0x2a71a9){return _0x2a71a9;});}return null;};}function removeEntity(_0x224f52){return function(_0x371c5c){if(_0x371c5c){return _0x371c5c[_0xffc1('0x26')]()[_0xffc1('0x11')](function(){var _0x2fe675=_0x371c5c[_0xffc1('0x27')]({'plain':!![]});var _0x3e32e7=_0xffc1('0x28');return db[_0xffc1('0x29')][_0xffc1('0x26')]({'where':{'type':_0x3e32e7,'resourceId':_0x2fe675['id']}})['then'](function(){return _0x371c5c;});})[_0xffc1('0x11')](function(){_0x224f52[_0xffc1('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a78bc){return function(_0x88dbe1){if(!_0x88dbe1){_0x3a78bc[_0xffc1('0x1b')](0x194);}return _0x88dbe1;};}function handleError(_0x496e03,_0x14e375){_0x14e375=_0x14e375||0x1f4;return function(_0x4202dc){logger[_0xffc1('0x17')](_0x4202dc[_0xffc1('0x2a')]);if(_0x4202dc[_0xffc1('0x2b')]){delete _0x4202dc[_0xffc1('0x2b')];}_0x496e03['status'](_0x14e375)['send'](_0x4202dc);};}function getImapHost(_0x5eaf10){switch(_0x5eaf10){case _0xffc1('0x2c'):return'imap.gmail.com';case _0xffc1('0x2d'):return _0xffc1('0x2e');case'hotmail':return'imap-mail.outlook.com';case _0xffc1('0x2f'):return _0xffc1('0x30');}throw new Error('Unknown\x20email\x20service\x20provider',_0x5eaf10);}function getSmtpHost(_0x5a13c4){switch(_0x5a13c4){case _0xffc1('0x2c'):return _0xffc1('0x31');case'yahoo':return'smtp.mail.yahoo.com';case _0xffc1('0x32'):return _0xffc1('0x33');case'outlook365':return _0xffc1('0x34');}throw new Error(_0xffc1('0x35'),_0x5a13c4);}function getAuthenticationOptions(_0x4cf25d,_0x338c5f){var _0xd725da={};var _0x1f0e57={};if(_0x4cf25d){_0xd725da[_0xffc1('0x36')]=_0x1f0e57[_0xffc1('0x36')]=_0x338c5f[_0xffc1('0x37')];_0xd725da[_0xffc1('0x38')]=_0x1f0e57['pass']=_0x338c5f[_0xffc1('0x38')];if(_0x338c5f[_0xffc1('0x39')]){_0xd725da[_0xffc1('0x39')]=_0x1f0e57[_0xffc1('0x39')]=!![];_0xd725da[_0xffc1('0x3a')]=_0x1f0e57[_0xffc1('0x3a')]=_0x338c5f[_0xffc1('0x3a')];_0xd725da[_0xffc1('0x38')]=_0x1f0e57[_0xffc1('0x3b')]=null;}else{_0xd725da[_0xffc1('0x3a')]=_0x1f0e57[_0xffc1('0x3a')]=null;}_0xd725da[_0xffc1('0x3c')]=getImapHost(_0x4cf25d);_0xd725da['port']=0x3e1;_0x1f0e57[_0xffc1('0x3c')]=getSmtpHost(_0x4cf25d);_0x1f0e57[_0xffc1('0x3d')]=0x24b;_0x1f0e57[_0xffc1('0x3e')]=![];_0xd725da[_0xffc1('0x3f')]=_0x1f0e57[_0xffc1('0x3f')]=null;}else{if(_0x338c5f[_0xffc1('0x40')]){_0xd725da['user']=_0x1f0e57[_0xffc1('0x36')]=_0x338c5f['username'];_0xd725da['password']=_0x1f0e57[_0xffc1('0x3b')]=_0x338c5f[_0xffc1('0x38')];}else{_0xd725da['authentication']=_0x1f0e57[_0xffc1('0x40')]=![];_0xd725da[_0xffc1('0x36')]=_0x1f0e57[_0xffc1('0x36')]=null;_0xd725da[_0xffc1('0x38')]=_0x1f0e57[_0xffc1('0x3b')]=null;}_0xd725da[_0xffc1('0x3c')]=_0x338c5f[_0xffc1('0x41')]['host'];_0xd725da[_0xffc1('0x3d')]=_0x338c5f[_0xffc1('0x41')]['port'];_0x1f0e57[_0xffc1('0x3c')]=_0x338c5f['Smtp']['host'];_0x1f0e57[_0xffc1('0x3d')]=_0x338c5f[_0xffc1('0x42')][_0xffc1('0x3d')];}return{'Imap':_0xd725da,'Smtp':_0x1f0e57};}exports[_0xffc1('0x43')]=function(_0xae40f5,_0x24d6d3){var _0x2b252f={'include':[{'model':db[_0xffc1('0x44')],'as':_0xffc1('0x41')},{'model':db[_0xffc1('0x45')],'as':'Smtp'},{'model':db[_0xffc1('0x46')],'as':_0xffc1('0x47')}]},_0x52578d={},_0x59959e={'count':0x0,'rows':[]};var _0x506c9f=_[_0xffc1('0x48')](db[_0xffc1('0x49')][_0xffc1('0x4a')],function(_0xf6454b){return{'name':_0xf6454b[_0xffc1('0x4b')],'type':_0xf6454b[_0xffc1('0x4c')]['key']};});_0x52578d[_0xffc1('0x4d')]=_[_0xffc1('0x48')](_0x506c9f,_0xffc1('0x2b'));_0x52578d[_0xffc1('0x4e')]=_[_0xffc1('0x4f')](_0xae40f5[_0xffc1('0x4e')]);_0x52578d[_0xffc1('0x50')]=_[_0xffc1('0x51')](_0x52578d['model'],_0x52578d[_0xffc1('0x4e')]);_0x2b252f[_0xffc1('0x52')]=_['intersection'](_0x52578d[_0xffc1('0x4d')],qs[_0xffc1('0x53')](_0xae40f5['query']['fields']));_0x2b252f[_0xffc1('0x52')]=_0x2b252f['attributes']['length']?_0x2b252f[_0xffc1('0x52')]:_0x52578d[_0xffc1('0x4d')];if(!_0xae40f5[_0xffc1('0x4e')]['hasOwnProperty']('nolimit')){_0x2b252f[_0xffc1('0x21')]=qs[_0xffc1('0x21')](_0xae40f5['query'][_0xffc1('0x21')]);_0x2b252f[_0xffc1('0x1f')]=qs['offset'](_0xae40f5[_0xffc1('0x4e')]['offset']);}_0x2b252f[_0xffc1('0x54')]=qs['sort'](_0xae40f5[_0xffc1('0x4e')][_0xffc1('0x55')]);_0x2b252f[_0xffc1('0x56')]=qs[_0xffc1('0x50')](_[_0xffc1('0x57')](_0xae40f5[_0xffc1('0x4e')],_0x52578d['filters']),_0x506c9f);if(_0xae40f5[_0xffc1('0x4e')][_0xffc1('0x58')]){_0x2b252f[_0xffc1('0x56')]=_[_0xffc1('0x59')](_0x2b252f[_0xffc1('0x56')],{'$or':_[_0xffc1('0x48')](_0x506c9f,function(_0x151376){if(_0x151376[_0xffc1('0x4c')]!==_0xffc1('0x5a')){var _0x453ee1={};_0x453ee1[_0x151376[_0xffc1('0x2b')]]={'$like':'%'+_0xae40f5[_0xffc1('0x4e')][_0xffc1('0x58')]+'%'};return _0x453ee1;}})});}_0x2b252f=_['merge']({},_0x2b252f,_0xae40f5[_0xffc1('0x5b')]);var _0x4dbf9c={'where':_0x2b252f['where']};return db[_0xffc1('0x49')][_0xffc1('0x22')](_0x4dbf9c)['then'](function(_0x106a64){_0x59959e[_0xffc1('0x22')]=_0x106a64;if(_0xae40f5[_0xffc1('0x4e')][_0xffc1('0x5c')]){_0x2b252f['include']=[{'all':!![]}];}return db[_0xffc1('0x49')][_0xffc1('0x5d')](_0x2b252f);})[_0xffc1('0x11')](function(_0x543bd8){_0x59959e['rows']=_0x543bd8;return _0x59959e;})['then'](respondWithFilteredResult(_0x24d6d3,_0x2b252f))[_0xffc1('0x1a')](handleError(_0x24d6d3,null));};exports['show']=function(_0x42314d,_0x254325){var _0x1c4f38={'raw':![],'where':{'id':_0x42314d[_0xffc1('0x5e')]['id']},'include':[{'model':db[_0xffc1('0x44')],'as':_0xffc1('0x41')},{'model':db[_0xffc1('0x45')],'as':_0xffc1('0x42')},{'model':db[_0xffc1('0x46')],'as':_0xffc1('0x47')}]},_0x505d76={};_0x505d76[_0xffc1('0x4d')]=_[_0xffc1('0x4f')](db[_0xffc1('0x49')][_0xffc1('0x4a')]);_0x505d76[_0xffc1('0x4e')]=_['keys'](_0x42314d['query']);_0x505d76['filters']=_[_0xffc1('0x51')](_0x505d76[_0xffc1('0x4d')],_0x505d76[_0xffc1('0x4e')]);_0x1c4f38[_0xffc1('0x52')]=_[_0xffc1('0x51')](_0x505d76[_0xffc1('0x4d')],qs[_0xffc1('0x53')](_0x42314d[_0xffc1('0x4e')][_0xffc1('0x53')]));_0x1c4f38[_0xffc1('0x52')]=_0x1c4f38['attributes'][_0xffc1('0x5f')]?_0x1c4f38[_0xffc1('0x52')]:_0x505d76['model'];if(_0x42314d[_0xffc1('0x4e')][_0xffc1('0x5c')]){_0x1c4f38[_0xffc1('0x60')]=[{'all':!![]}];}_0x1c4f38=_['merge']({},_0x1c4f38,_0x42314d['options']);return db['MailAccount'][_0xffc1('0x61')](_0x1c4f38)[_0xffc1('0x11')](handleEntityNotFound(_0x254325,null))[_0xffc1('0x11')](respondWithResult(_0x254325,null))[_0xffc1('0x1a')](handleError(_0x254325,null));};exports[_0xffc1('0x25')]=function(_0x265fff,_0x105a27){if(_0x265fff['body']['id']){delete _0x265fff[_0xffc1('0x62')]['id'];}var _0x25206b=_0x265fff[_0xffc1('0x62')]['provider']==='custom'?null:_0x265fff[_0xffc1('0x62')][_0xffc1('0x63')];var _0x10fb0c=_0x265fff[_0xffc1('0x62')][_0xffc1('0x41')]||{};var _0x1e0fc4=_0x265fff['body']['Smtp']||{};if(_0x25206b){_0x10fb0c[_0xffc1('0x3c')]=getImapHost(_0x25206b);_0x10fb0c['port']=0x3e1;_0x1e0fc4[_0xffc1('0x3c')]=getSmtpHost(_0x25206b);_0x1e0fc4['port']=0x24b;_0x1e0fc4[_0xffc1('0x3e')]=![];}if(_0x1e0fc4[_0xffc1('0x39')]){_0x1e0fc4['secure']=![];}else{_0x1e0fc4[_0xffc1('0x3a')]=null;}if(!_0x10fb0c[_0xffc1('0x39')])_0x10fb0c['CloudProviderId']=null;_0x265fff[_0xffc1('0x62')][_0xffc1('0x41')]=_0x10fb0c;_0x265fff['body'][_0xffc1('0x42')]=_0x1e0fc4;return db['MailAccount'][_0xffc1('0x61')]({'where':{'id':_0x265fff[_0xffc1('0x5e')]['id']},'include':[{'model':db[_0xffc1('0x44')],'as':_0xffc1('0x41')},{'model':db['MailServerOut'],'as':_0xffc1('0x42')},{'model':db[_0xffc1('0x46')],'as':_0xffc1('0x47')}]})['then'](handleEntityNotFound(_0x105a27,null))[_0xffc1('0x11')](function(_0x49de2f){if(!_0x49de2f)throw new Error(_0xffc1('0x64'));if(_0x49de2f[_0xffc1('0x3f')])delete _0x265fff[_0xffc1('0x62')]['Imap'];return _0x49de2f;})['then'](saveUpdates(_0x265fff[_0xffc1('0x62')],null))[_0xffc1('0x11')](function(_0x30c2ba){if(!_0x265fff['body'][_0xffc1('0x41')])return _0x30c2ba;return db[_0xffc1('0x44')][_0xffc1('0x25')](_0x265fff[_0xffc1('0x62')][_0xffc1('0x41')],{'where':{'MailAccountId':_0x30c2ba['id']}})[_0xffc1('0x11')](function(){return _0x30c2ba;});})[_0xffc1('0x11')](function(_0x29dd1e){if(!_0x265fff[_0xffc1('0x62')]['Smtp'])return _0x29dd1e;return db[_0xffc1('0x45')]['update'](_0x265fff['body'][_0xffc1('0x42')],{'where':{'MailAccountId':_0x29dd1e['id']}})[_0xffc1('0x11')](function(){return _0x29dd1e;});})['then'](respondWithResult(_0x105a27,null))[_0xffc1('0x1a')](handleError(_0x105a27,null));};exports[_0xffc1('0x65')]=function(_0x658daf,_0x4be944){return db[_0xffc1('0x49')]['describe']()[_0xffc1('0x11')](respondWithResult(_0x4be944,null))[_0xffc1('0x1a')](handleError(_0x4be944,null));};exports['addDisposition']=function(_0x492166,_0x20dbcd){if(_0x492166[_0xffc1('0x62')]['id']){delete _0x492166['body']['id'];}return db[_0xffc1('0x49')]['find']({'where':{'id':_0x492166[_0xffc1('0x5e')]['id']}})[_0xffc1('0x11')](handleEntityNotFound(_0x20dbcd,null))[_0xffc1('0x11')](function(_0xb00e74){if(_0xb00e74){_0x492166[_0xffc1('0x62')][_0xffc1('0x66')]=_0xb00e74['id'];return db['Disposition']['create'](_0x492166[_0xffc1('0x62')]);}})[_0xffc1('0x11')](respondWithResult(_0x20dbcd,null))[_0xffc1('0x1a')](handleError(_0x20dbcd,null));};exports['getDispositions']=function(_0x5f2b50,_0x155f15){var _0xad16f2={'raw':![],'where':{}};var _0x3546a8={};var _0x270ba6={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x5f2b50[_0xffc1('0x5e')]['id']}})[_0xffc1('0x11')](handleEntityNotFound(_0x155f15,null))['then'](function(_0x649ef1){if(_0x649ef1){_0x3546a8[_0xffc1('0x4d')]=_[_0xffc1('0x4f')](db[_0xffc1('0x67')][_0xffc1('0x4a')]);_0x3546a8[_0xffc1('0x4e')]=_['keys'](_0x5f2b50[_0xffc1('0x4e')]);_0x3546a8[_0xffc1('0x50')]=_[_0xffc1('0x51')](_0x3546a8[_0xffc1('0x4d')],_0x3546a8['query']);_0xad16f2[_0xffc1('0x52')]=_[_0xffc1('0x51')](_0x3546a8['model'],qs['fields'](_0x5f2b50[_0xffc1('0x4e')]['fields']));_0xad16f2[_0xffc1('0x52')]=_0xad16f2['attributes']['length']?_0xad16f2[_0xffc1('0x52')]:_0x3546a8[_0xffc1('0x4d')];if(!_0x5f2b50[_0xffc1('0x4e')][_0xffc1('0x68')](_0xffc1('0x69'))){_0xad16f2[_0xffc1('0x21')]=qs[_0xffc1('0x21')](_0x5f2b50['query']['limit']);_0xad16f2[_0xffc1('0x1f')]=qs['offset'](_0x5f2b50[_0xffc1('0x4e')][_0xffc1('0x1f')]);}_0xad16f2[_0xffc1('0x54')]=qs[_0xffc1('0x55')](_0x5f2b50['query'][_0xffc1('0x55')]);_0xad16f2[_0xffc1('0x56')]=qs[_0xffc1('0x50')](_[_0xffc1('0x57')](_0x5f2b50['query'],_0x3546a8['filters']));_0xad16f2['where'][_0xffc1('0x66')]=_0x649ef1['id'];if(_0x5f2b50[_0xffc1('0x4e')][_0xffc1('0x58')]){_0xad16f2['where']=_[_0xffc1('0x59')](_0xad16f2['where'],{'$or':_['map'](_0xad16f2[_0xffc1('0x52')],function(_0x4e1a9c){var _0x40666f={};_0x40666f[_0x4e1a9c]={'$like':'%'+_0x5f2b50[_0xffc1('0x4e')][_0xffc1('0x58')]+'%'};return _0x40666f;})});}_0xad16f2=_[_0xffc1('0x59')]({},_0xad16f2,_0x5f2b50[_0xffc1('0x5b')]);return db[_0xffc1('0x67')]['count']({'where':_0xad16f2['where']})['then'](function(_0x363bad){_0x270ba6['count']=_0x363bad;if(_0x5f2b50[_0xffc1('0x4e')][_0xffc1('0x5c')]){_0xad16f2['include']=[{'all':!![]}];}return db['Disposition'][_0xffc1('0x5d')](_0xad16f2);})[_0xffc1('0x11')](function(_0x45552e){_0x270ba6[_0xffc1('0x6a')]=_0x45552e;return _0x270ba6;});}})[_0xffc1('0x11')](respondWithFilteredResult(_0x155f15,_0xad16f2))[_0xffc1('0x1a')](handleError(_0x155f15,null));};exports[_0xffc1('0x6b')]=function(_0x2ded21,_0xb32b9b){return db[_0xffc1('0x49')][_0xffc1('0x61')]({'where':{'id':_0x2ded21[_0xffc1('0x5e')]['id']}})[_0xffc1('0x11')](handleEntityNotFound(_0xb32b9b,null))['then'](function(_0xc60a12){if(_0xc60a12){return _0xc60a12['removeDispositions'](_0x2ded21[_0xffc1('0x4e')][_0xffc1('0x6c')]);}})[_0xffc1('0x11')](respondWithStatusCode(_0xb32b9b,null))['catch'](handleError(_0xb32b9b,null));};exports[_0xffc1('0x6d')]=function(_0x4bddd7,_0x4a5764){if(_0x4bddd7[_0xffc1('0x62')]['id']){delete _0x4bddd7[_0xffc1('0x62')]['id'];}return db['MailAccount'][_0xffc1('0x61')]({'where':{'id':_0x4bddd7[_0xffc1('0x5e')]['id']}})[_0xffc1('0x11')](handleEntityNotFound(_0x4a5764,null))['then'](function(_0x291077){if(_0x291077){_0x4bddd7['body'][_0xffc1('0x66')]=_0x291077['id'];return db['CannedAnswer'][_0xffc1('0x6e')](_0x4bddd7[_0xffc1('0x62')]);}})['then'](respondWithResult(_0x4a5764,null))[_0xffc1('0x1a')](handleError(_0x4a5764,null));};exports[_0xffc1('0x6f')]=function(_0x419244,_0x5eb03f){var _0x4f1f2a={'raw':![],'where':{}};var _0xde9c9d={};var _0x39e750={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x419244[_0xffc1('0x5e')]['id']}})['then'](handleEntityNotFound(_0x5eb03f,null))['then'](function(_0x4d40e7){if(_0x4d40e7){_0xde9c9d[_0xffc1('0x4d')]=_[_0xffc1('0x4f')](db[_0xffc1('0x70')][_0xffc1('0x4a')]);_0xde9c9d[_0xffc1('0x4e')]=_['keys'](_0x419244[_0xffc1('0x4e')]);_0xde9c9d['filters']=_['intersection'](_0xde9c9d[_0xffc1('0x4d')],_0xde9c9d[_0xffc1('0x4e')]);_0x4f1f2a[_0xffc1('0x52')]=_['intersection'](_0xde9c9d[_0xffc1('0x4d')],qs['fields'](_0x419244[_0xffc1('0x4e')][_0xffc1('0x53')]));_0x4f1f2a[_0xffc1('0x52')]=_0x4f1f2a[_0xffc1('0x52')][_0xffc1('0x5f')]?_0x4f1f2a[_0xffc1('0x52')]:_0xde9c9d[_0xffc1('0x4d')];if(!_0x419244['query'][_0xffc1('0x68')](_0xffc1('0x69'))){_0x4f1f2a[_0xffc1('0x21')]=qs[_0xffc1('0x21')](_0x419244[_0xffc1('0x4e')]['limit']);_0x4f1f2a['offset']=qs['offset'](_0x419244['query']['offset']);}_0x4f1f2a[_0xffc1('0x54')]=qs[_0xffc1('0x55')](_0x419244['query']['sort']);_0x4f1f2a[_0xffc1('0x56')]=qs[_0xffc1('0x50')](_['pick'](_0x419244[_0xffc1('0x4e')],_0xde9c9d['filters']));_0x4f1f2a[_0xffc1('0x56')]['MailAccountId']=_0x4d40e7['id'];if(_0x419244['query']['filter']){_0x4f1f2a[_0xffc1('0x56')]=_[_0xffc1('0x59')](_0x4f1f2a[_0xffc1('0x56')],{'$or':_[_0xffc1('0x48')](_0x4f1f2a[_0xffc1('0x52')],function(_0x5cdab6){var _0x178916={};_0x178916[_0x5cdab6]={'$like':'%'+_0x419244['query'][_0xffc1('0x58')]+'%'};return _0x178916;})});}_0x4f1f2a=_[_0xffc1('0x59')]({},_0x4f1f2a,_0x419244[_0xffc1('0x5b')]);return db['CannedAnswer']['count']({'where':_0x4f1f2a['where']})[_0xffc1('0x11')](function(_0x4d1a6c){_0x39e750[_0xffc1('0x22')]=_0x4d1a6c;if(_0x419244[_0xffc1('0x4e')]['includeAll']){_0x4f1f2a['include']=[{'all':!![]}];}return db[_0xffc1('0x70')][_0xffc1('0x5d')](_0x4f1f2a);})[_0xffc1('0x11')](function(_0x4840ca){_0x39e750[_0xffc1('0x6a')]=_0x4840ca;return _0x39e750;});}})[_0xffc1('0x11')](respondWithFilteredResult(_0x5eb03f,_0x4f1f2a))['catch'](handleError(_0x5eb03f,null));};exports[_0xffc1('0x71')]=function(_0xd9cc3b,_0xc5de9a){return db[_0xffc1('0x49')][_0xffc1('0x61')]({'where':{'id':_0xd9cc3b[_0xffc1('0x5e')]['id']}})[_0xffc1('0x11')](handleEntityNotFound(_0xc5de9a,null))[_0xffc1('0x11')](function(_0x2396a9){if(_0x2396a9){return _0x2396a9[_0xffc1('0x71')](_0xd9cc3b[_0xffc1('0x4e')][_0xffc1('0x6c')]);}})['then'](respondWithStatusCode(_0xc5de9a,null))['catch'](handleError(_0xc5de9a,null));};exports[_0xffc1('0x6e')]=function(_0x5002d3,_0x3ac490){var _0x55b8fd={'name':_0x5002d3[_0xffc1('0x62')]['name'],'key':_0x5002d3[_0xffc1('0x62')][_0xffc1('0x72')],'provider':_0x5002d3[_0xffc1('0x62')][_0xffc1('0x63')]===_0xffc1('0x73')?null:_0x5002d3[_0xffc1('0x62')][_0xffc1('0x63')],'email':_0x5002d3['body'][_0xffc1('0x74')],'ListId':_0x5002d3[_0xffc1('0x62')][_0xffc1('0x75')],'active':!_[_0xffc1('0x76')](_0x5002d3['body'][_0xffc1('0x77')])?_0x5002d3[_0xffc1('0x62')][_0xffc1('0x77')]:!![],'description':_0x5002d3[_0xffc1('0x62')]['description']||null};var _0x4a334b=getAuthenticationOptions(_0x55b8fd[_0xffc1('0x63')],_0x5002d3[_0xffc1('0x62')]);_0x55b8fd['Imap']=_0x4a334b['Imap'];_0x55b8fd[_0xffc1('0x42')]=_0x4a334b[_0xffc1('0x42')];return db[_0xffc1('0x49')][_0xffc1('0x6e')](_0x55b8fd,{'include':[{'model':db[_0xffc1('0x45')],'as':_0xffc1('0x42')},{'model':db['MailServerIn'],'as':_0xffc1('0x41')}]})['then'](function(_0x48ba5e){var _0x39e9be=_0x5002d3['user'][_0xffc1('0x27')]({'plain':!![]});if(!_0x39e9be)throw new Error(_0xffc1('0x78'));if(_0x39e9be['role']===_0xffc1('0x36')){var _0x4f56a7=_0x48ba5e[_0xffc1('0x27')]({'plain':!![]});return db[_0xffc1('0x79')][_0xffc1('0x61')]({'where':{'name':_0xffc1('0x28'),'userProfileId':_0x39e9be['userProfileId']},'raw':!![]})['then'](function(_0x654dd7){if(_0x654dd7&&_0x654dd7[_0xffc1('0x7a')]===0x0){return db[_0xffc1('0x29')][_0xffc1('0x6e')]({'name':_0x4f56a7[_0xffc1('0x2b')],'resourceId':_0x4f56a7['id'],'type':_0x654dd7[_0xffc1('0x2b')],'sectionId':_0x654dd7['id']},{})[_0xffc1('0x11')](function(){return _0x48ba5e;});}else{return _0x48ba5e;}})[_0xffc1('0x1a')](function(_0x56ea6e){logger[_0xffc1('0x17')](_0xffc1('0x7b'),_0x56ea6e);throw _0x56ea6e;});}return _0x48ba5e;})[_0xffc1('0x11')](respondWithResult(_0x3ac490,0xc9))['catch'](handleError(_0x3ac490,null));};exports[_0xffc1('0x7c')]=function(_0x49978c,_0x4695eb){return db[_0xffc1('0x49')][_0xffc1('0x7d')]({'where':{'id':_0x49978c[_0xffc1('0x5e')]['id']}})['then'](handleEntityNotFound(_0x4695eb,null))['then'](function(_0x182dcd){if(_0x182dcd){return _0x182dcd['getImap']();}return null;})[_0xffc1('0x11')](respondWithResult(_0x4695eb,null))['catch'](handleError(_0x4695eb,null));};exports[_0xffc1('0x7e')]=function(_0x3effe4,_0x497593){if(_0x3effe4[_0xffc1('0x62')]['id']){delete _0x3effe4['body']['id'];}return db[_0xffc1('0x49')][_0xffc1('0x61')]({'where':{'id':_0x3effe4[_0xffc1('0x5e')]['id']}})[_0xffc1('0x11')](handleEntityNotFound(_0x497593,null))[_0xffc1('0x11')](function(_0x442d2d){if(_0x442d2d){_0x3effe4[_0xffc1('0x62')][_0xffc1('0x66')]=_0x442d2d['id'];return db[_0xffc1('0x44')][_0xffc1('0x6e')](_0x3effe4[_0xffc1('0x62')]);}})[_0xffc1('0x11')](respondWithResult(_0x497593,null))[_0xffc1('0x1a')](handleError(_0x497593,null));};exports[_0xffc1('0x7f')]=function(_0x1aa38b,_0x53015b){return db[_0xffc1('0x49')][_0xffc1('0x7d')]({'where':{'id':_0x1aa38b[_0xffc1('0x5e')]['id']}})[_0xffc1('0x11')](handleEntityNotFound(_0x53015b,null))[_0xffc1('0x11')](function(_0x57951d){if(_0x57951d){return _0x57951d[_0xffc1('0x80')](null);}return null;})[_0xffc1('0x11')](respondWithStatusCode(_0x53015b,null))[_0xffc1('0x1a')](handleError(_0x53015b,null));};exports[_0xffc1('0x81')]=function(_0x3a4438,_0x22a04d){return db[_0xffc1('0x49')][_0xffc1('0x7d')]({'where':{'id':_0x3a4438[_0xffc1('0x5e')]['id']}})[_0xffc1('0x11')](handleEntityNotFound(_0x22a04d,null))[_0xffc1('0x11')](function(_0x4b55f1){if(_0x4b55f1){return _0x4b55f1[_0xffc1('0x81')]();}return null;})[_0xffc1('0x11')](respondWithResult(_0x22a04d,null))['catch'](handleError(_0x22a04d,null));};exports['addSmtp']=function(_0x492fe2,_0x38dc1e){if(_0x492fe2[_0xffc1('0x62')]['id']){delete _0x492fe2[_0xffc1('0x62')]['id'];}return db[_0xffc1('0x49')][_0xffc1('0x61')]({'where':{'id':_0x492fe2[_0xffc1('0x5e')]['id']}})[_0xffc1('0x11')](handleEntityNotFound(_0x38dc1e,null))['then'](function(_0x283ff6){if(_0x283ff6){_0x492fe2[_0xffc1('0x62')][_0xffc1('0x66')]=_0x283ff6['id'];return db[_0xffc1('0x45')][_0xffc1('0x6e')](_0x492fe2['body']);}})[_0xffc1('0x11')](respondWithResult(_0x38dc1e,null))[_0xffc1('0x1a')](handleError(_0x38dc1e,null));};exports[_0xffc1('0x82')]=function(_0x7ab2ce,_0x225292){return db['MailAccount'][_0xffc1('0x7d')]({'where':{'id':_0x7ab2ce[_0xffc1('0x5e')]['id']}})['then'](handleEntityNotFound(_0x225292,null))[_0xffc1('0x11')](function(_0x43fb3c){if(_0x43fb3c){return _0x43fb3c['setSmtp'](null);}return null;})[_0xffc1('0x11')](respondWithStatusCode(_0x225292,null))[_0xffc1('0x1a')](handleError(_0x225292,null));};exports['addInteraction']=function(_0x5a6ff2,_0x3be7f0){return db[_0xffc1('0x83')][_0xffc1('0x61')]({'where':{'id':_0x5a6ff2[_0xffc1('0x5e')]['id']}})[_0xffc1('0x11')](handleEntityNotFound(_0x3be7f0,null))[_0xffc1('0x11')](function(_0x24fd73){if(_0x24fd73){return _0x24fd73[_0xffc1('0x84')](_0x5a6ff2[_0xffc1('0x62')]['ids'],_[_0xffc1('0x85')](_0x5a6ff2[_0xffc1('0x62')],[_0xffc1('0x6c'),'id'])||{});}})[_0xffc1('0x11')](respondWithResult(_0x3be7f0,null))[_0xffc1('0x1a')](handleError(_0x3be7f0,null));};exports[_0xffc1('0x86')]=function(_0x3dedda,_0x3abe2d){var _0xd3d8bd={'raw':![],'where':{}};var _0x4e6da5={};var _0x48d706={'count':0x0,'rows':[]};return db[_0xffc1('0x49')][_0xffc1('0x7d')]({'where':{'id':_0x3dedda[_0xffc1('0x5e')]['id']}})[_0xffc1('0x11')](handleEntityNotFound(_0x3abe2d,null))['then'](function(_0x2b21a7){if(_0x2b21a7){_0x4e6da5[_0xffc1('0x4d')]=_[_0xffc1('0x4f')](db[_0xffc1('0x83')][_0xffc1('0x4a')]);_0x4e6da5[_0xffc1('0x4e')]=_[_0xffc1('0x4f')](_0x3dedda[_0xffc1('0x4e')]);_0x4e6da5[_0xffc1('0x50')]=_[_0xffc1('0x51')](_0x4e6da5[_0xffc1('0x4d')],_0x4e6da5[_0xffc1('0x4e')]);_0xd3d8bd['attributes']=_[_0xffc1('0x51')](_0x4e6da5[_0xffc1('0x4d')],qs[_0xffc1('0x53')](_0x3dedda[_0xffc1('0x4e')][_0xffc1('0x53')]));_0xd3d8bd[_0xffc1('0x52')]=_0xd3d8bd[_0xffc1('0x52')][_0xffc1('0x5f')]?_0xd3d8bd[_0xffc1('0x52')]:_0x4e6da5[_0xffc1('0x4d')];if(!_0x3dedda[_0xffc1('0x4e')][_0xffc1('0x68')](_0xffc1('0x69'))){_0xd3d8bd[_0xffc1('0x21')]=qs['limit'](_0x3dedda[_0xffc1('0x4e')][_0xffc1('0x21')]);_0xd3d8bd[_0xffc1('0x1f')]=qs[_0xffc1('0x1f')](_0x3dedda['query']['offset']);}_0xd3d8bd[_0xffc1('0x54')]=qs[_0xffc1('0x55')](_0x3dedda['query'][_0xffc1('0x55')]);_0xd3d8bd[_0xffc1('0x56')]=qs[_0xffc1('0x50')](_['pick'](_0x3dedda['query'],_0x4e6da5[_0xffc1('0x50')]));_0xd3d8bd['where'][_0xffc1('0x66')]=_0x2b21a7['id'];if(_0x3dedda['query']['filter']){_0xd3d8bd[_0xffc1('0x56')]=_[_0xffc1('0x59')](_0xd3d8bd[_0xffc1('0x56')],{'$or':_[_0xffc1('0x48')](_0xd3d8bd['attributes'],function(_0x19d9b3){var _0x48111d={};_0x48111d[_0x19d9b3]={'$like':'%'+_0x3dedda['query'][_0xffc1('0x58')]+'%'};return _0x48111d;})});}_0xd3d8bd=_['merge']({},_0xd3d8bd,_0x3dedda[_0xffc1('0x5b')]);return db['MailInteraction'][_0xffc1('0x22')]({'where':_0xd3d8bd[_0xffc1('0x56')]})[_0xffc1('0x11')](function(_0x260938){_0x48d706[_0xffc1('0x22')]=_0x260938;if(_0x3dedda[_0xffc1('0x4e')][_0xffc1('0x5c')]){_0xd3d8bd[_0xffc1('0x60')]=[{'model':db[_0xffc1('0x87')],'as':_0xffc1('0x88'),'required':![]},{'model':db[_0xffc1('0x89')],'as':_0xffc1('0x8a'),'attributes':[_0xffc1('0x2b'),_0xffc1('0x8b'),_0xffc1('0x8c')],'required':![]},{'model':db[_0xffc1('0x8d')],'as':'Tags','attributes':['id',_0xffc1('0x2b'),_0xffc1('0x8e')],'where':_0x3dedda[_0xffc1('0x4e')][_0xffc1('0x8f')]?{'id':_0x3dedda[_0xffc1('0x4e')][_0xffc1('0x8f')]}:undefined,'required':_0x3dedda['query'][_0xffc1('0x8f')]?!![]:![]}];}return db[_0xffc1('0x83')][_0xffc1('0x5d')](_0xd3d8bd);})[_0xffc1('0x11')](function(_0x3d3aa9){_0x48d706[_0xffc1('0x6a')]=_0x3d3aa9;return _0x48d706;});}})['then'](respondWithFilteredResult(_0x3abe2d,_0xd3d8bd))[_0xffc1('0x1a')](handleError(_0x3abe2d,null));};exports[_0xffc1('0x90')]=function addApplications(_0x334fdd,_0x4ebdd9){var _0x50c6bd=_0x334fdd['params']['id'];var _0x245de6=_0x334fdd[_0xffc1('0x62')];var _0x29f98a=0xc8;var _0x55d1eb=null;return db[_0xffc1('0x91')][_0xffc1('0x92')]({'isolationLevel':db[_0xffc1('0x91')][_0xffc1('0x93')]['ISOLATION_LEVELS'][_0xffc1('0x94')]},function(_0x48214e){return db[_0xffc1('0x49')][_0xffc1('0x7d')]({'where':{'id':_0x50c6bd},'transaction':_0x48214e})[_0xffc1('0x11')](function(_0x122830){if(_0x122830){return db[_0xffc1('0x95')]['destroy']({'where':{'MailAccountId':_0x50c6bd},'transaction':_0x48214e})[_0xffc1('0x11')](function(){var _0x44e8e1=_[_0xffc1('0x48')](_0x245de6,function(_0xd3427b){_0xd3427b[_0xffc1('0x66')]=_0x50c6bd;return _0xd3427b;});return db['MailApplication'][_0xffc1('0x96')](_0x44e8e1,{'transaction':_0x48214e});});}else{_0x29f98a=0x194;_0x55d1eb=[];}});})[_0xffc1('0x11')](function(){if(_0x29f98a!==0x194){return db['MailApplication'][_0xffc1('0x97')]({'where':{'MailAccountId':_0x50c6bd},'order':_0xffc1('0x98')})[_0xffc1('0x11')](function(_0x48d0c2){_0x55d1eb=_0x48d0c2;});}})['catch'](function(_0x5b0901){_0x29f98a=0x1f4;logger[_0xffc1('0x17')](_0x5b0901[_0xffc1('0x2a')]);if(_0x5b0901[_0xffc1('0x2b')]){delete _0x5b0901[_0xffc1('0x2b')];}_0x55d1eb=_0x5b0901;})[_0xffc1('0x99')](function(){if(_0x55d1eb===null){_0x4ebdd9[_0xffc1('0x1b')](_0x29f98a);}else{if(_0x29f98a===0x1f4){_0x4ebdd9[_0xffc1('0x1c')](_0x29f98a)[_0xffc1('0x9a')](_0x55d1eb);}else{_0x4ebdd9[_0xffc1('0x1c')](_0x29f98a)[_0xffc1('0x1e')](_0x55d1eb);}}});};exports[_0xffc1('0x9b')]=function(_0x1f9e4b,_0x3823c3){var _0x5598ec={};var _0x3bc6f1={};var _0x199f86;var _0x365cfd;return db[_0xffc1('0x49')][_0xffc1('0x7d')]({'where':{'id':_0x1f9e4b[_0xffc1('0x5e')]['id']}})[_0xffc1('0x11')](handleEntityNotFound(_0x3823c3,null))[_0xffc1('0x11')](function(_0x161d44){if(_0x161d44){_0x199f86=_0x161d44;_0x3bc6f1['model']=_[_0xffc1('0x4f')](db['MailApplication']['rawAttributes']);_0x3bc6f1[_0xffc1('0x4e')]=_['keys'](_0x1f9e4b[_0xffc1('0x4e')]);_0x3bc6f1[_0xffc1('0x50')]=_[_0xffc1('0x51')](_0x3bc6f1[_0xffc1('0x4d')],_0x3bc6f1[_0xffc1('0x4e')]);_0x5598ec[_0xffc1('0x52')]=_['intersection'](_0x3bc6f1[_0xffc1('0x4d')],qs['fields'](_0x1f9e4b[_0xffc1('0x4e')][_0xffc1('0x53')]));_0x5598ec['attributes']=_0x5598ec[_0xffc1('0x52')][_0xffc1('0x5f')]?_0x5598ec[_0xffc1('0x52')]:_0x3bc6f1[_0xffc1('0x4d')];_0x5598ec[_0xffc1('0x54')]=qs[_0xffc1('0x55')](_0x1f9e4b[_0xffc1('0x4e')][_0xffc1('0x55')]);_0x5598ec[_0xffc1('0x56')]=qs['filters'](_[_0xffc1('0x57')](_0x1f9e4b[_0xffc1('0x4e')],_0x3bc6f1['filters']));if(_0x1f9e4b[_0xffc1('0x4e')][_0xffc1('0x58')]){_0x5598ec['where']=_[_0xffc1('0x59')](_0x5598ec[_0xffc1('0x56')],{'$or':_[_0xffc1('0x48')](_0x5598ec[_0xffc1('0x52')],function(_0x1ef123){var _0x5a0ace={};_0x5a0ace[_0x1ef123]={'$like':'%'+_0x1f9e4b[_0xffc1('0x4e')][_0xffc1('0x58')]+'%'};return _0x5a0ace;})});}_0x5598ec=_[_0xffc1('0x59')]({},_0x5598ec,_0x1f9e4b['options']);return _0x199f86['getApplications'](_0x5598ec);}})[_0xffc1('0x11')](function(_0x4454b5){if(_0x4454b5){_0x365cfd=_0x4454b5[_0xffc1('0x5f')];if(!_0x1f9e4b[_0xffc1('0x4e')][_0xffc1('0x68')](_0xffc1('0x69'))){_0x5598ec[_0xffc1('0x21')]=qs['limit'](_0x1f9e4b[_0xffc1('0x4e')][_0xffc1('0x21')]);_0x5598ec[_0xffc1('0x1f')]=qs['offset'](_0x1f9e4b[_0xffc1('0x4e')][_0xffc1('0x1f')]);}return _0x199f86[_0xffc1('0x9b')](_0x5598ec);}})[_0xffc1('0x11')](function(_0x351f6a){if(_0x351f6a){return _0x351f6a?{'count':_0x365cfd,'rows':_0x351f6a}:null;}})[_0xffc1('0x11')](respondWithResult(_0x3823c3,null))[_0xffc1('0x1a')](handleError(_0x3823c3,null));};exports[_0xffc1('0x9c')]=function(_0x1594f0,_0x5b65e5){var _0x1d5f71={'raw':!![],'where':{}};var _0x5eecd0={};var _0x3e4a48={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x1594f0[_0xffc1('0x5e')]['id']}})['then'](handleEntityNotFound(_0x5b65e5,null))['then'](function(_0x3f6961){if(_0x3f6961){_0x5eecd0[_0xffc1('0x4d')]=_[_0xffc1('0x4f')](db[_0xffc1('0x9d')][_0xffc1('0x4a')]);_0x5eecd0['query']=_['keys'](_0x1594f0[_0xffc1('0x4e')]);_0x5eecd0[_0xffc1('0x50')]=_['intersection'](_0x5eecd0['model'],_0x5eecd0['query']);_0x1d5f71['attributes']=_['intersection'](_0x5eecd0['model'],qs[_0xffc1('0x53')](_0x1594f0['query'][_0xffc1('0x53')]));_0x1d5f71[_0xffc1('0x52')]=_0x1d5f71['attributes'][_0xffc1('0x5f')]?_0x1d5f71[_0xffc1('0x52')]:_0x5eecd0['model'];if(!_0x1594f0[_0xffc1('0x4e')][_0xffc1('0x68')]('nolimit')){_0x1d5f71[_0xffc1('0x21')]=qs['limit'](_0x1594f0[_0xffc1('0x4e')][_0xffc1('0x21')]);_0x1d5f71[_0xffc1('0x1f')]=qs[_0xffc1('0x1f')](_0x1594f0[_0xffc1('0x4e')][_0xffc1('0x1f')]);}_0x1d5f71['order']=qs['sort'](_0x1594f0[_0xffc1('0x4e')][_0xffc1('0x55')]);_0x1d5f71[_0xffc1('0x56')]=qs['filters'](_[_0xffc1('0x57')](_0x1594f0[_0xffc1('0x4e')],_0x5eecd0['filters']));_0x1d5f71[_0xffc1('0x56')][_0xffc1('0x66')]=_0x3f6961['id'];if(_0x1594f0[_0xffc1('0x4e')]['filter']){_0x1d5f71[_0xffc1('0x56')]=_['merge'](_0x1d5f71[_0xffc1('0x56')],{'$or':_[_0xffc1('0x48')](_0x1d5f71[_0xffc1('0x52')],function(_0xf804d5){var _0x356dec={};_0x356dec[_0xf804d5]={'$like':'%'+_0x1594f0['query'][_0xffc1('0x58')]+'%'};return _0x356dec;})});}if(_0x1594f0[_0xffc1('0x4e')]['$gte']){var _0x1b0e37=_0x1594f0[_0xffc1('0x4e')][_0xffc1('0x9e')][_0xffc1('0x9f')](',');var _0x14f895={};_0x14f895[_0x1b0e37[0x0]]={'$gte':moment(_0x1b0e37[0x1])['format'](_0xffc1('0xa0'))};_0x1d5f71['where']=_[_0xffc1('0x59')](_0x1d5f71[_0xffc1('0x56')],_0x14f895);}_0x1d5f71=_['merge']({},_0x1d5f71,_0x1594f0[_0xffc1('0x5b')]);return db[_0xffc1('0x9d')][_0xffc1('0x22')]({'where':_0x1d5f71[_0xffc1('0x56')]})[_0xffc1('0x11')](function(_0x6d051b){_0x3e4a48['count']=_0x6d051b;if(_0x1594f0['query'][_0xffc1('0x5c')]){_0x1d5f71['include']=[{'all':!![]}];}return db[_0xffc1('0x9d')][_0xffc1('0x5d')](_0x1d5f71);})['then'](function(_0x1f5ad8){if(_0x1594f0[_0xffc1('0x4e')][_0xffc1('0xa1')]==='true'){for(var _0x251bd2=0x0;_0x251bd2<_0x1f5ad8['length'];_0x251bd2++){_0x1f5ad8[_0x251bd2][_0xffc1('0x62')]=juice(_0x1f5ad8[_0x251bd2]['body']);}}_0x3e4a48[_0xffc1('0x6a')]=_0x1f5ad8;return _0x3e4a48;});}})[_0xffc1('0x11')](respondWithFilteredResult(_0x5b65e5,_0x1d5f71))['catch'](handleError(_0x5b65e5,null));};exports['send']=function(_0x135d37,_0x196681){var _0xd21c6a,_0x281398={},_0x44f99d;if(_0x135d37['body']['to']){_0x44f99d=_0x135d37[_0xffc1('0x62')]['to'][_0xffc1('0x9f')](',')[0x0];}return db[_0xffc1('0x49')][_0xffc1('0x61')]({'where':{'id':_0x135d37[_0xffc1('0x5e')]['id']},'include':[{'model':db[_0xffc1('0xa2')],'as':_0xffc1('0xa3'),'include':[{'model':db['CmContact'],'as':_0xffc1('0xa4'),'where':{'email':_0x44f99d},'limit':0x1,'order':[[_0xffc1('0xa5'),_0xffc1('0xa6')]]}]},{'model':db[_0xffc1('0x45')],'as':_0xffc1('0x42'),'raw':!![],'include':[{'model':db[_0xffc1('0xa7')],'as':_0xffc1('0xa7'),'raw':!![]}]}]})[_0xffc1('0x11')](handleEntityNotFound(_0x196681,null))[_0xffc1('0x11')](function(_0x355166){if(!_0x355166)return;_0xd21c6a=_0x355166;if(!_0x355166[_0xffc1('0x42')])throw new Error('Smtp\x20configuration\x20not\x20found');if(_[_0xffc1('0x76')](_0x135d37[_0xffc1('0x62')]['from'])){_0x135d37[_0xffc1('0x62')][_0xffc1('0xa8')]=util[_0xffc1('0xa9')](_0xffc1('0xaa'),_0x355166[_0xffc1('0x2b')],_0x355166[_0xffc1('0x74')]||_0x355166[_0xffc1('0x42')][_0xffc1('0x36')]);}if(_0x135d37[_0xffc1('0x62')][_0xffc1('0xab')]&&_0x135d37['body']['attachments'][_0xffc1('0x5f')]){for(var _0x32b8d7=0x0;_0x32b8d7<_0x135d37[_0xffc1('0x62')][_0xffc1('0xab')][_0xffc1('0x5f')];_0x32b8d7+=0x1){_0x135d37[_0xffc1('0x62')]['attachments'][_0x32b8d7]={'filename':_0x135d37[_0xffc1('0x62')][_0xffc1('0xab')][_0x32b8d7][_0xffc1('0x2b')],'path':path[_0xffc1('0xac')](config['root'],'server/files/attachments',_0x135d37[_0xffc1('0x62')][_0xffc1('0xab')][_0x32b8d7][_0xffc1('0xad')])};}}var _0x454676=_0x355166[_0xffc1('0xae')]();return respondWithRpcPromise(_0xffc1('0xaf'),'sendMail',{'account':_0x454676,'message':_0x135d37[_0xffc1('0x62')]});})[_0xffc1('0x11')](function(_0x29c956){if(!_0x29c956)return;_0x281398=_0x29c956;if(!_0xd21c6a['List'])throw new Error(_0xffc1('0xb0'));if(_0xd21c6a[_0xffc1('0xa3')][_0xffc1('0xa4')][_0xffc1('0x5f')])return _0xd21c6a[_0xffc1('0xa3')][_0xffc1('0xa4')][0x0];return db[_0xffc1('0x87')]['create'](_[_0xffc1('0xb')](_0x135d37['body'],{'firstName':_0x135d37[_0xffc1('0x62')]['to'],'email':_0x135d37[_0xffc1('0x62')]['to'],'phone':_0x135d37[_0xffc1('0x62')]['to'],'ListId':_0xd21c6a[_0xffc1('0x75')]}));})['then'](function(_0x51b455){if(!_0x51b455)return;var _0x52ec23={'UserId':_0x135d37[_0xffc1('0x36')]['id'],'ContactId':_0x51b455['id'],'MailAccountId':_0xd21c6a['id'],'inReplyTo':_0x281398[_0xffc1('0xb1')],'to':_0x135d37['body'][_0xffc1('0xa8')],'cc':_0x135d37[_0xffc1('0x62')]['cc'],'subject':_0x135d37[_0xffc1('0x62')][_0xffc1('0xb2')],'attach':_0x135d37[_0xffc1('0x62')][_0xffc1('0xb3')],'firstMsgDirection':'out','lastMsgAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0xffc1('0xb4'),'Messages':[_[_0xffc1('0x59')](_0x135d37['body'],{'messageId':_0x281398['messageId'],'sentAt':moment()[_0xffc1('0xa9')](_0xffc1('0xa0')),'read':!![],'MailAccountId':_0xd21c6a['id'],'UserId':_0x135d37[_0xffc1('0x36')]['id'],'ContactId':_0x51b455['id']})]};if(_0x135d37[_0xffc1('0x62')]['Interaction']){_0x52ec23=_[_0xffc1('0x59')](_0x52ec23,_0x135d37[_0xffc1('0x62')]['Interaction']);}return db['MailInteraction']['create'](_0x52ec23,{'include':[{'model':db[_0xffc1('0x9d')],'as':_0xffc1('0xb5')}]});})[_0xffc1('0x11')](respondWithResult(_0x196681,null))[_0xffc1('0x1a')](handleError(_0x196681,null));};exports['verifySmtp']=function(_0x459ebd,_0x3f2c41){return db['MailAccount']['find']({'where':{'id':_0x459ebd[_0xffc1('0x5e')]['id']},'include':[{'model':db['MailServerOut'],'as':_0xffc1('0x42'),'raw':!![],'include':[{'model':db[_0xffc1('0xa7')],'as':_0xffc1('0xa7'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x3f2c41,null))['then'](function(_0x4a6fc8){if(!_0x4a6fc8[_0xffc1('0x42')])return;var _0x5ea7de=_0x4a6fc8[_0xffc1('0xae')]();return respondWithRpcPromise(_0xffc1('0xb6'),_0xffc1('0xb7'),{'account':_0x5ea7de});})[_0xffc1('0x11')](respondWithResult(_0x3f2c41,null))[_0xffc1('0x1a')](handleError(_0x3f2c41,null));};exports[_0xffc1('0x26')]=function(_0x26cdef,_0x531654){return db[_0xffc1('0x49')][_0xffc1('0x61')]({'where':{'id':_0x26cdef[_0xffc1('0x5e')]['id']}})[_0xffc1('0x11')](handleEntityNotFound(_0x531654,null))[_0xffc1('0x11')](function(_0x872a41){if(_0x872a41&&_0x872a41[_0xffc1('0x3f')]){throw new db[(_0xffc1('0xb8'))][(_0xffc1('0xb9'))]('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x872a41;})[_0xffc1('0x11')](removeEntity(_0x531654,null))['catch'](handleError(_0x531654,null));};exports['addAgents']=function(_0x3f7089,_0x169e9b){return db['MailAccount'][_0xffc1('0x61')]({'where':{'id':_0x3f7089['params']['id']}})[_0xffc1('0x11')](handleEntityNotFound(_0x169e9b,null))[_0xffc1('0x11')](function(_0xf5bd36){if(_0xf5bd36){return _0xf5bd36['addAgents'](_0x3f7089[_0xffc1('0x62')][_0xffc1('0x6c')],_[_0xffc1('0x85')](_0x3f7089[_0xffc1('0x62')],[_0xffc1('0x6c'),'id'])||{})[_0xffc1('0xba')](function(_0xe60b22){for(var _0x34eb4d=0x0;_0x34eb4d<_0x3f7089[_0xffc1('0x62')][_0xffc1('0x6c')][_0xffc1('0x5f')];_0x34eb4d+=0x1){socket[_0xffc1('0xbb')](_0xffc1('0xbc'),{'UserId':Number(_0x3f7089[_0xffc1('0x62')][_0xffc1('0x6c')][_0x34eb4d]),'MailAccountId':Number(_0x3f7089[_0xffc1('0x5e')]['id'])});}return _0xe60b22;});}})['then'](respondWithResult(_0x169e9b,null))['catch'](handleError(_0x169e9b,null));};exports[_0xffc1('0xbd')]=function(_0x278181,_0x3f2c93){return db[_0xffc1('0x49')][_0xffc1('0x61')]({'where':{'id':_0x278181[_0xffc1('0x5e')]['id']}})[_0xffc1('0x11')](handleEntityNotFound(_0x3f2c93,null))[_0xffc1('0x11')](function(_0x5ac8e6){if(_0x5ac8e6){return _0x5ac8e6[_0xffc1('0xbd')](_0x278181['query'][_0xffc1('0x6c')])[_0xffc1('0x11')](function(){if(_[_0xffc1('0xbe')](_0x278181[_0xffc1('0x4e')][_0xffc1('0x6c')])){for(var _0x587f3b=0x0;_0x587f3b<_0x278181[_0xffc1('0x4e')][_0xffc1('0x6c')][_0xffc1('0x5f')];_0x587f3b+=0x1){socket[_0xffc1('0xbb')](_0xffc1('0xbf'),{'UserId':Number(_0x278181[_0xffc1('0x4e')]['ids'][_0x587f3b]),'MailAccountId':Number(_0x278181['params']['id'])});}}else{socket[_0xffc1('0xbb')](_0xffc1('0xbf'),{'UserId':Number(_0x278181[_0xffc1('0x4e')][_0xffc1('0x6c')]),'MailAccountId':Number(_0x278181[_0xffc1('0x5e')]['id'])});}});}})[_0xffc1('0x11')](respondWithStatusCode(_0x3f2c93,null))[_0xffc1('0x1a')](handleError(_0x3f2c93,null));};exports['getAgents']=function(_0x57f054,_0x73ae71){var _0x4c45f7={};var _0x3ca59d={};var _0xcc2f17;var _0x21a81a;return db[_0xffc1('0x49')][_0xffc1('0x7d')]({'where':{'id':_0x57f054[_0xffc1('0x5e')]['id']}})[_0xffc1('0x11')](handleEntityNotFound(_0x73ae71,null))['then'](function(_0x3e3ff8){if(_0x3e3ff8){_0xcc2f17=_0x3e3ff8;_0x3ca59d[_0xffc1('0x4d')]=_[_0xffc1('0x4f')](db[_0xffc1('0x89')][_0xffc1('0x4a')]);_0x3ca59d['query']=_[_0xffc1('0x4f')](_0x57f054[_0xffc1('0x4e')]);_0x3ca59d['filters']=_[_0xffc1('0x51')](_0x3ca59d[_0xffc1('0x4d')],_0x3ca59d[_0xffc1('0x4e')]);_0x4c45f7['attributes']=_[_0xffc1('0x51')](_0x3ca59d[_0xffc1('0x4d')],qs[_0xffc1('0x53')](_0x57f054[_0xffc1('0x4e')]['fields']));_0x4c45f7[_0xffc1('0x52')]=_0x4c45f7[_0xffc1('0x52')]['length']?_0x4c45f7['attributes']:_0x3ca59d[_0xffc1('0x4d')];_0x4c45f7[_0xffc1('0x54')]=qs[_0xffc1('0x55')](_0x57f054['query']['sort']);_0x4c45f7[_0xffc1('0x56')]=qs[_0xffc1('0x50')](_[_0xffc1('0x57')](_0x57f054['query'],_0x3ca59d[_0xffc1('0x50')]));if(_0x57f054[_0xffc1('0x4e')][_0xffc1('0x58')]){_0x4c45f7[_0xffc1('0x56')]=_[_0xffc1('0x59')](_0x4c45f7[_0xffc1('0x56')],{'$or':_[_0xffc1('0x48')](_0x4c45f7['attributes'],function(_0x45776a){var _0x4d6364={};_0x4d6364[_0x45776a]={'$like':'%'+_0x57f054[_0xffc1('0x4e')][_0xffc1('0x58')]+'%'};return _0x4d6364;})});}_0x4c45f7=_[_0xffc1('0x59')]({},_0x4c45f7,_0x57f054['options']);return _0xcc2f17[_0xffc1('0xc0')](_0x4c45f7);}})[_0xffc1('0x11')](function(_0x136e46){if(_0x136e46){_0x21a81a=_0x136e46[_0xffc1('0x5f')];if(!_0x57f054[_0xffc1('0x4e')]['hasOwnProperty']('nolimit')){_0x4c45f7[_0xffc1('0x21')]=qs[_0xffc1('0x21')](_0x57f054[_0xffc1('0x4e')][_0xffc1('0x21')]);_0x4c45f7['offset']=qs['offset'](_0x57f054['query']['offset']);}return _0xcc2f17['getAgents'](_0x4c45f7);}})[_0xffc1('0x11')](function(_0xf9775b){if(_0xf9775b){return _0xf9775b?{'count':_0x21a81a,'rows':_0xf9775b}:null;}})['then'](respondWithResult(_0x73ae71,null))[_0xffc1('0x1a')](handleError(_0x73ae71,null));}; \ No newline at end of file +var _0x2200=['name','send','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','gmail','smtp.gmail.com','smtp.mail.yahoo.com','smtp.office365.com','user','password','pass','modernAuthentication','CloudProviderId','host','port','secure','service','authentication','username','Imap','Smtp','index','MailServerOut','map','rawAttributes','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','merge','where','options','MailAccount','includeAll','include','findAll','rows','catch','show','MailServerIn','Pause','mandatoryDispositionPause','keys','find','body','provider','params','update','describe','addDisposition','MailAccountId','Disposition','create','findOne','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','key','custom','ListId','isNil','active','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','setImap','getSmtp','removeSmtp','setSmtp','addInteraction','omit','getInteractions','order','MailInteraction','CmContact','Contact','User','Owner','fullname','Tag','tag','Transaction','READ_COMMITTED','MailApplication','priority','finally','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','CmList','List','Contacts','updatedAt','DESC','CloudProvider','from','%s\x20<%s>','email','attachments','join','root','server/files/attachments','basename','getSmtpOptions','SendMail','sendMail','List\x20not\x20found','messageId','out','Interaction','verifySmtp','VerifySmtp','Sequelize','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','userMailAccount:save','removeAgents','emit','userMailAccount:remove','getAgents','moment','bluebird','util','path','lodash','juice','ioredis','../../components/parsers/qs','../../config/logger','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','jayson/promise','client','request','then','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','MailAccount,\x20%s,\x20%s','message','info','result','status','end','json','offset','undefined','count','limit','set','destroy','UserProfileResource','sendStatus','stack'];(function(_0x3306c5,_0x5a99d6){var _0x33c2b3=function(_0x193f9b){while(--_0x193f9b){_0x3306c5['push'](_0x3306c5['shift']());}};_0x33c2b3(++_0x5a99d6);}(_0x2200,0x92));var _0x0220=function(_0x2265da,_0xfbbd2e){_0x2265da=_0x2265da-0x0;var _0x430c2b=_0x2200[_0x2265da];return _0x430c2b;};'use strict';var moment=require(_0x0220('0x0'));var BPromise=require(_0x0220('0x1'));var util=require(_0x0220('0x2'));var path=require(_0x0220('0x3'));var _=require(_0x0220('0x4'));var juice=require(_0x0220('0x5'));var Redis=require(_0x0220('0x6'));var qs=require(_0x0220('0x7'));var logger=require(_0x0220('0x8'))('api');var config=require('../../config/environment');var db=require(_0x0220('0x9'))['db'];config[_0x0220('0xa')]=_[_0x0220('0xb')](config[_0x0220('0xa')],{'host':_0x0220('0xc'),'port':0x18eb});var socket=require(_0x0220('0xd'))(new Redis(config[_0x0220('0xa')]));require(_0x0220('0xe'))['register'](socket);var jayson=require(_0x0220('0xf'));var client=jayson[_0x0220('0x10')]['http']({'port':0x232b});function respondWithRpcPromise(_0x339c40,_0x594b2a,_0x14e223,_0x210538){return new BPromise(function(_0x388175,_0x243868){var _0x2d3f45=_0x210538||client;return _0x2d3f45[_0x0220('0x11')](_0x339c40,_0x14e223)[_0x0220('0x12')](function(_0x2521d8){logger['info']('MailAccount,\x20%s,\x20%s',_0x594b2a,_0x0220('0x13'));logger[_0x0220('0x14')](_0x0220('0x15'),_0x594b2a,_0x0220('0x13'),JSON['stringify'](_0x2521d8));if(_0x2521d8[_0x0220('0x16')]){if(_0x2521d8['error']['code']===0x1f4){logger[_0x0220('0x16')](_0x0220('0x17'),_0x594b2a,_0x2521d8[_0x0220('0x16')]['message']);return _0x243868(_0x2521d8['error'][_0x0220('0x18')]);}logger[_0x0220('0x16')](_0x0220('0x17'),_0x594b2a,_0x2521d8[_0x0220('0x16')][_0x0220('0x18')]);return _0x388175(_0x2521d8['error']['message']);}else{logger[_0x0220('0x19')](_0x0220('0x17'),_0x594b2a,_0x0220('0x13'));_0x388175(_0x2521d8[_0x0220('0x1a')][_0x0220('0x18')]);}})['catch'](function(_0x391f4b){logger[_0x0220('0x16')](_0x0220('0x17'),_0x594b2a,_0x391f4b);_0x243868(_0x391f4b);});});}function respondWithStatusCode(_0x1ecb99,_0x799366){_0x799366=_0x799366||0xcc;return function(_0x500437){if(_0x500437){return _0x1ecb99['sendStatus'](_0x799366);}return _0x1ecb99[_0x0220('0x1b')](_0x799366)[_0x0220('0x1c')]();};}function respondWithResult(_0x38af57,_0x403f94){_0x403f94=_0x403f94||0xc8;return function(_0x253a2a){if(_0x253a2a){return _0x38af57[_0x0220('0x1b')](_0x403f94)[_0x0220('0x1d')](_0x253a2a);}};}function respondWithFilteredResult(_0x83c857,_0x5a1894){return function(_0x284b48){if(_0x284b48){var _0x1b8feb=typeof _0x5a1894[_0x0220('0x1e')]===_0x0220('0x1f')&&typeof _0x5a1894['limit']==='undefined';var _0x368c0a=_0x284b48['count'];var _0x7492fa=_0x1b8feb?0x0:_0x5a1894['offset'];var _0x42516c=_0x1b8feb?_0x284b48[_0x0220('0x20')]:_0x5a1894[_0x0220('0x1e')]+_0x5a1894[_0x0220('0x21')];var _0x10ea6e;if(_0x42516c>=_0x368c0a){_0x42516c=_0x368c0a;_0x10ea6e=0xc8;}else{_0x10ea6e=0xce;}_0x83c857[_0x0220('0x1b')](_0x10ea6e);return _0x83c857[_0x0220('0x22')]('Content-Range',_0x7492fa+'-'+_0x42516c+'/'+_0x368c0a)[_0x0220('0x1d')](_0x284b48);}return null;};}function saveUpdates(_0x457701){return function(_0x5250ce){if(_0x5250ce){return _0x5250ce['update'](_0x457701)[_0x0220('0x12')](function(_0x2388d8){return _0x2388d8;});}return null;};}function removeEntity(_0x55f201){return function(_0x138ef8){if(_0x138ef8){return _0x138ef8[_0x0220('0x23')]()[_0x0220('0x12')](function(){var _0x54ed1d=_0x138ef8['get']({'plain':!![]});var _0x583083='MailAccounts';return db[_0x0220('0x24')][_0x0220('0x23')]({'where':{'type':_0x583083,'resourceId':_0x54ed1d['id']}})[_0x0220('0x12')](function(){return _0x138ef8;});})[_0x0220('0x12')](function(){_0x55f201['status'](0xcc)[_0x0220('0x1c')]();});}};}function handleEntityNotFound(_0x174b89){return function(_0x2bbfff){if(!_0x2bbfff){_0x174b89[_0x0220('0x25')](0x194);}return _0x2bbfff;};}function handleError(_0x1c9210,_0x212daf){_0x212daf=_0x212daf||0x1f4;return function(_0x847e14){logger[_0x0220('0x16')](_0x847e14[_0x0220('0x26')]);if(_0x847e14[_0x0220('0x27')]){delete _0x847e14[_0x0220('0x27')];}_0x1c9210[_0x0220('0x1b')](_0x212daf)[_0x0220('0x28')](_0x847e14);};}function getImapHost(_0x56b9dc){switch(_0x56b9dc){case'gmail':return'imap.gmail.com';case _0x0220('0x29'):return _0x0220('0x2a');case _0x0220('0x2b'):return _0x0220('0x2c');case _0x0220('0x2d'):return _0x0220('0x2e');}throw new Error(_0x0220('0x2f'),_0x56b9dc);}function getSmtpHost(_0x1aa605){switch(_0x1aa605){case _0x0220('0x30'):return _0x0220('0x31');case _0x0220('0x29'):return _0x0220('0x32');case _0x0220('0x2b'):return'smtp-mail.outlook.com';case _0x0220('0x2d'):return _0x0220('0x33');}throw new Error(_0x0220('0x2f'),_0x1aa605);}function getAuthenticationOptions(_0x5b8b3e,_0x26ddd3){var _0x331e69={};var _0x472129={};if(_0x5b8b3e){_0x331e69[_0x0220('0x34')]=_0x472129[_0x0220('0x34')]=_0x26ddd3['username'];_0x331e69[_0x0220('0x35')]=_0x472129[_0x0220('0x36')]=_0x26ddd3[_0x0220('0x35')];if(_0x26ddd3[_0x0220('0x37')]){_0x331e69[_0x0220('0x37')]=_0x472129[_0x0220('0x37')]=!![];_0x331e69[_0x0220('0x38')]=_0x472129[_0x0220('0x38')]=_0x26ddd3['CloudProviderId'];_0x331e69[_0x0220('0x35')]=_0x472129[_0x0220('0x36')]=null;}else{_0x331e69[_0x0220('0x38')]=_0x472129[_0x0220('0x38')]=null;}_0x331e69[_0x0220('0x39')]=getImapHost(_0x5b8b3e);_0x331e69[_0x0220('0x3a')]=0x3e1;_0x472129[_0x0220('0x39')]=getSmtpHost(_0x5b8b3e);_0x472129[_0x0220('0x3a')]=0x24b;_0x472129[_0x0220('0x3b')]=![];_0x331e69['service']=_0x472129[_0x0220('0x3c')]=null;}else{if(_0x26ddd3[_0x0220('0x3d')]){_0x331e69['user']=_0x472129[_0x0220('0x34')]=_0x26ddd3[_0x0220('0x3e')];_0x331e69['password']=_0x472129[_0x0220('0x36')]=_0x26ddd3[_0x0220('0x35')];}else{_0x331e69[_0x0220('0x3d')]=_0x472129['authentication']=![];_0x331e69[_0x0220('0x34')]=_0x472129[_0x0220('0x34')]=null;_0x331e69[_0x0220('0x35')]=_0x472129[_0x0220('0x36')]=null;}_0x331e69[_0x0220('0x39')]=_0x26ddd3['Imap']['host'];_0x331e69[_0x0220('0x3a')]=_0x26ddd3[_0x0220('0x3f')][_0x0220('0x3a')];_0x472129[_0x0220('0x39')]=_0x26ddd3[_0x0220('0x40')][_0x0220('0x39')];_0x472129[_0x0220('0x3a')]=_0x26ddd3['Smtp'][_0x0220('0x3a')];}return{'Imap':_0x331e69,'Smtp':_0x472129};}exports[_0x0220('0x41')]=function(_0x4c11a0,_0x46c323){var _0x2d8827={'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db[_0x0220('0x42')],'as':_0x0220('0x40')},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x486d29={},_0x58f144={'count':0x0,'rows':[]};var _0x113e1f=_[_0x0220('0x43')](db['MailAccount'][_0x0220('0x44')],function(_0x3cf569){return{'name':_0x3cf569['fieldName'],'type':_0x3cf569[_0x0220('0x45')]['key']};});_0x486d29[_0x0220('0x46')]=_[_0x0220('0x43')](_0x113e1f,_0x0220('0x27'));_0x486d29[_0x0220('0x47')]=_['keys'](_0x4c11a0['query']);_0x486d29[_0x0220('0x48')]=_[_0x0220('0x49')](_0x486d29[_0x0220('0x46')],_0x486d29[_0x0220('0x47')]);_0x2d8827['attributes']=_['intersection'](_0x486d29[_0x0220('0x46')],qs['fields'](_0x4c11a0[_0x0220('0x47')][_0x0220('0x4a')]));_0x2d8827[_0x0220('0x4b')]=_0x2d8827[_0x0220('0x4b')][_0x0220('0x4c')]?_0x2d8827[_0x0220('0x4b')]:_0x486d29['model'];if(!_0x4c11a0['query'][_0x0220('0x4d')](_0x0220('0x4e'))){_0x2d8827['limit']=qs['limit'](_0x4c11a0['query'][_0x0220('0x21')]);_0x2d8827[_0x0220('0x1e')]=qs[_0x0220('0x1e')](_0x4c11a0[_0x0220('0x47')][_0x0220('0x1e')]);}_0x2d8827['order']=qs[_0x0220('0x4f')](_0x4c11a0['query'][_0x0220('0x4f')]);_0x2d8827['where']=qs['filters'](_[_0x0220('0x50')](_0x4c11a0[_0x0220('0x47')],_0x486d29[_0x0220('0x48')]),_0x113e1f);if(_0x4c11a0[_0x0220('0x47')][_0x0220('0x51')]){_0x2d8827['where']=_[_0x0220('0x52')](_0x2d8827[_0x0220('0x53')],{'$or':_[_0x0220('0x43')](_0x113e1f,function(_0x3c466d){if(_0x3c466d[_0x0220('0x45')]!=='VIRTUAL'){var _0x2c56a4={};_0x2c56a4[_0x3c466d[_0x0220('0x27')]]={'$like':'%'+_0x4c11a0[_0x0220('0x47')][_0x0220('0x51')]+'%'};return _0x2c56a4;}})});}_0x2d8827=_[_0x0220('0x52')]({},_0x2d8827,_0x4c11a0[_0x0220('0x54')]);var _0x3f47dd={'where':_0x2d8827['where']};return db[_0x0220('0x55')]['count'](_0x3f47dd)[_0x0220('0x12')](function(_0xf85f56){_0x58f144['count']=_0xf85f56;if(_0x4c11a0[_0x0220('0x47')][_0x0220('0x56')]){_0x2d8827[_0x0220('0x57')]=[{'all':!![]}];}return db['MailAccount'][_0x0220('0x58')](_0x2d8827);})['then'](function(_0x367fe6){_0x58f144[_0x0220('0x59')]=_0x367fe6;return _0x58f144;})[_0x0220('0x12')](respondWithFilteredResult(_0x46c323,_0x2d8827))[_0x0220('0x5a')](handleError(_0x46c323,null));};exports[_0x0220('0x5b')]=function(_0x4e9b74,_0x5c96ba){var _0x5b851b={'raw':![],'where':{'id':_0x4e9b74['params']['id']},'include':[{'model':db[_0x0220('0x5c')],'as':'Imap'},{'model':db['MailServerOut'],'as':_0x0220('0x40')},{'model':db[_0x0220('0x5d')],'as':_0x0220('0x5e')}]},_0x52e34d={};_0x52e34d[_0x0220('0x46')]=_[_0x0220('0x5f')](db[_0x0220('0x55')][_0x0220('0x44')]);_0x52e34d[_0x0220('0x47')]=_[_0x0220('0x5f')](_0x4e9b74[_0x0220('0x47')]);_0x52e34d[_0x0220('0x48')]=_['intersection'](_0x52e34d[_0x0220('0x46')],_0x52e34d[_0x0220('0x47')]);_0x5b851b['attributes']=_[_0x0220('0x49')](_0x52e34d[_0x0220('0x46')],qs[_0x0220('0x4a')](_0x4e9b74[_0x0220('0x47')][_0x0220('0x4a')]));_0x5b851b[_0x0220('0x4b')]=_0x5b851b[_0x0220('0x4b')][_0x0220('0x4c')]?_0x5b851b[_0x0220('0x4b')]:_0x52e34d[_0x0220('0x46')];if(_0x4e9b74['query'][_0x0220('0x56')]){_0x5b851b['include']=[{'all':!![]}];}_0x5b851b=_[_0x0220('0x52')]({},_0x5b851b,_0x4e9b74[_0x0220('0x54')]);return db[_0x0220('0x55')][_0x0220('0x60')](_0x5b851b)['then'](handleEntityNotFound(_0x5c96ba,null))['then'](respondWithResult(_0x5c96ba,null))['catch'](handleError(_0x5c96ba,null));};exports['update']=function(_0x3eb2bf,_0x280aef){if(_0x3eb2bf[_0x0220('0x61')]['id']){delete _0x3eb2bf[_0x0220('0x61')]['id'];}var _0x1cb627=_0x3eb2bf[_0x0220('0x61')][_0x0220('0x62')]==='custom'?null:_0x3eb2bf[_0x0220('0x61')]['provider'];var _0x4a82fd=_0x3eb2bf[_0x0220('0x61')]['Imap']||{};var _0x23273e=_0x3eb2bf[_0x0220('0x61')][_0x0220('0x40')]||{};if(_0x1cb627){_0x4a82fd['host']=getImapHost(_0x1cb627);_0x4a82fd[_0x0220('0x3a')]=0x3e1;_0x23273e[_0x0220('0x39')]=getSmtpHost(_0x1cb627);_0x23273e[_0x0220('0x3a')]=0x24b;_0x23273e[_0x0220('0x3b')]=![];}if(_0x23273e[_0x0220('0x37')]){_0x23273e[_0x0220('0x3b')]=![];}else{_0x23273e[_0x0220('0x38')]=null;}if(!_0x4a82fd[_0x0220('0x37')])_0x4a82fd[_0x0220('0x38')]=null;_0x3eb2bf['body'][_0x0220('0x3f')]=_0x4a82fd;_0x3eb2bf['body']['Smtp']=_0x23273e;return db[_0x0220('0x55')][_0x0220('0x60')]({'where':{'id':_0x3eb2bf[_0x0220('0x63')]['id']},'include':[{'model':db[_0x0220('0x5c')],'as':_0x0220('0x3f')},{'model':db[_0x0220('0x42')],'as':'Smtp'},{'model':db[_0x0220('0x5d')],'as':_0x0220('0x5e')}]})[_0x0220('0x12')](handleEntityNotFound(_0x280aef,null))[_0x0220('0x12')](function(_0x27018e){if(!_0x27018e)throw new Error('Mail\x20Account\x20not\x20found');if(_0x27018e['service'])delete _0x3eb2bf[_0x0220('0x61')][_0x0220('0x3f')];return _0x27018e;})[_0x0220('0x12')](saveUpdates(_0x3eb2bf[_0x0220('0x61')],null))[_0x0220('0x12')](function(_0x50ec65){if(!_0x3eb2bf[_0x0220('0x61')][_0x0220('0x3f')])return _0x50ec65;return db[_0x0220('0x5c')][_0x0220('0x64')](_0x3eb2bf[_0x0220('0x61')][_0x0220('0x3f')],{'where':{'MailAccountId':_0x50ec65['id']}})[_0x0220('0x12')](function(){return _0x50ec65;});})[_0x0220('0x12')](function(_0x423943){if(!_0x3eb2bf[_0x0220('0x61')][_0x0220('0x40')])return _0x423943;return db['MailServerOut']['update'](_0x3eb2bf[_0x0220('0x61')]['Smtp'],{'where':{'MailAccountId':_0x423943['id']}})[_0x0220('0x12')](function(){return _0x423943;});})['then'](respondWithResult(_0x280aef,null))[_0x0220('0x5a')](handleError(_0x280aef,null));};exports['describe']=function(_0x568ea7,_0x363254){return db['MailAccount'][_0x0220('0x65')]()['then'](respondWithResult(_0x363254,null))[_0x0220('0x5a')](handleError(_0x363254,null));};exports[_0x0220('0x66')]=function(_0x206548,_0x58c258){if(_0x206548['body']['id']){delete _0x206548[_0x0220('0x61')]['id'];}return db['MailAccount'][_0x0220('0x60')]({'where':{'id':_0x206548[_0x0220('0x63')]['id']}})['then'](handleEntityNotFound(_0x58c258,null))[_0x0220('0x12')](function(_0x56cca0){if(_0x56cca0){_0x206548[_0x0220('0x61')][_0x0220('0x67')]=_0x56cca0['id'];return db[_0x0220('0x68')][_0x0220('0x69')](_0x206548[_0x0220('0x61')]);}})['then'](respondWithResult(_0x58c258,null))[_0x0220('0x5a')](handleError(_0x58c258,null));};exports['getDispositions']=function(_0x532bca,_0x4a51ec){var _0x244195={'raw':![],'where':{}};var _0x1ee884={};var _0x6efdb6={'count':0x0,'rows':[]};return db[_0x0220('0x55')][_0x0220('0x6a')]({'where':{'id':_0x532bca['params']['id']}})[_0x0220('0x12')](handleEntityNotFound(_0x4a51ec,null))[_0x0220('0x12')](function(_0x46c659){if(_0x46c659){_0x1ee884[_0x0220('0x46')]=_[_0x0220('0x5f')](db['Disposition'][_0x0220('0x44')]);_0x1ee884['query']=_[_0x0220('0x5f')](_0x532bca['query']);_0x1ee884['filters']=_['intersection'](_0x1ee884[_0x0220('0x46')],_0x1ee884['query']);_0x244195[_0x0220('0x4b')]=_[_0x0220('0x49')](_0x1ee884[_0x0220('0x46')],qs[_0x0220('0x4a')](_0x532bca['query']['fields']));_0x244195[_0x0220('0x4b')]=_0x244195[_0x0220('0x4b')][_0x0220('0x4c')]?_0x244195[_0x0220('0x4b')]:_0x1ee884[_0x0220('0x46')];if(!_0x532bca['query']['hasOwnProperty']('nolimit')){_0x244195[_0x0220('0x21')]=qs[_0x0220('0x21')](_0x532bca[_0x0220('0x47')][_0x0220('0x21')]);_0x244195[_0x0220('0x1e')]=qs[_0x0220('0x1e')](_0x532bca[_0x0220('0x47')][_0x0220('0x1e')]);}_0x244195['order']=qs['sort'](_0x532bca[_0x0220('0x47')][_0x0220('0x4f')]);_0x244195[_0x0220('0x53')]=qs[_0x0220('0x48')](_[_0x0220('0x50')](_0x532bca['query'],_0x1ee884[_0x0220('0x48')]));_0x244195[_0x0220('0x53')][_0x0220('0x67')]=_0x46c659['id'];if(_0x532bca[_0x0220('0x47')][_0x0220('0x51')]){_0x244195[_0x0220('0x53')]=_[_0x0220('0x52')](_0x244195['where'],{'$or':_['map'](_0x244195[_0x0220('0x4b')],function(_0x38ca25){var _0x2afb07={};_0x2afb07[_0x38ca25]={'$like':'%'+_0x532bca[_0x0220('0x47')][_0x0220('0x51')]+'%'};return _0x2afb07;})});}_0x244195=_[_0x0220('0x52')]({},_0x244195,_0x532bca[_0x0220('0x54')]);return db[_0x0220('0x68')][_0x0220('0x20')]({'where':_0x244195['where']})['then'](function(_0x33c37e){_0x6efdb6[_0x0220('0x20')]=_0x33c37e;if(_0x532bca[_0x0220('0x47')][_0x0220('0x56')]){_0x244195[_0x0220('0x57')]=[{'all':!![]}];}return db[_0x0220('0x68')][_0x0220('0x58')](_0x244195);})[_0x0220('0x12')](function(_0x31d4a7){_0x6efdb6['rows']=_0x31d4a7;return _0x6efdb6;});}})[_0x0220('0x12')](respondWithFilteredResult(_0x4a51ec,_0x244195))['catch'](handleError(_0x4a51ec,null));};exports[_0x0220('0x6b')]=function(_0x2c66d4,_0x30be26){return db[_0x0220('0x55')][_0x0220('0x60')]({'where':{'id':_0x2c66d4[_0x0220('0x63')]['id']}})['then'](handleEntityNotFound(_0x30be26,null))['then'](function(_0x53ad9e){if(_0x53ad9e){return _0x53ad9e['removeDispositions'](_0x2c66d4[_0x0220('0x47')][_0x0220('0x6c')]);}})[_0x0220('0x12')](respondWithStatusCode(_0x30be26,null))[_0x0220('0x5a')](handleError(_0x30be26,null));};exports[_0x0220('0x6d')]=function(_0x2e15d6,_0x214d13){if(_0x2e15d6[_0x0220('0x61')]['id']){delete _0x2e15d6[_0x0220('0x61')]['id'];}return db['MailAccount'][_0x0220('0x60')]({'where':{'id':_0x2e15d6[_0x0220('0x63')]['id']}})[_0x0220('0x12')](handleEntityNotFound(_0x214d13,null))[_0x0220('0x12')](function(_0x372c31){if(_0x372c31){_0x2e15d6[_0x0220('0x61')][_0x0220('0x67')]=_0x372c31['id'];return db['CannedAnswer'][_0x0220('0x69')](_0x2e15d6[_0x0220('0x61')]);}})['then'](respondWithResult(_0x214d13,null))['catch'](handleError(_0x214d13,null));};exports['getAnswers']=function(_0x36c32f,_0xa8c197){var _0x591436={'raw':![],'where':{}};var _0x4a01c1={};var _0x5ae600={'count':0x0,'rows':[]};return db['MailAccount'][_0x0220('0x6a')]({'where':{'id':_0x36c32f[_0x0220('0x63')]['id']}})['then'](handleEntityNotFound(_0xa8c197,null))['then'](function(_0x27147e){if(_0x27147e){_0x4a01c1[_0x0220('0x46')]=_[_0x0220('0x5f')](db['CannedAnswer'][_0x0220('0x44')]);_0x4a01c1[_0x0220('0x47')]=_['keys'](_0x36c32f[_0x0220('0x47')]);_0x4a01c1[_0x0220('0x48')]=_[_0x0220('0x49')](_0x4a01c1[_0x0220('0x46')],_0x4a01c1[_0x0220('0x47')]);_0x591436['attributes']=_[_0x0220('0x49')](_0x4a01c1[_0x0220('0x46')],qs[_0x0220('0x4a')](_0x36c32f['query'][_0x0220('0x4a')]));_0x591436[_0x0220('0x4b')]=_0x591436[_0x0220('0x4b')][_0x0220('0x4c')]?_0x591436[_0x0220('0x4b')]:_0x4a01c1[_0x0220('0x46')];if(!_0x36c32f[_0x0220('0x47')][_0x0220('0x4d')](_0x0220('0x4e'))){_0x591436['limit']=qs[_0x0220('0x21')](_0x36c32f[_0x0220('0x47')][_0x0220('0x21')]);_0x591436[_0x0220('0x1e')]=qs[_0x0220('0x1e')](_0x36c32f['query'][_0x0220('0x1e')]);}_0x591436['order']=qs[_0x0220('0x4f')](_0x36c32f[_0x0220('0x47')][_0x0220('0x4f')]);_0x591436[_0x0220('0x53')]=qs[_0x0220('0x48')](_['pick'](_0x36c32f[_0x0220('0x47')],_0x4a01c1['filters']));_0x591436[_0x0220('0x53')]['MailAccountId']=_0x27147e['id'];if(_0x36c32f[_0x0220('0x47')]['filter']){_0x591436[_0x0220('0x53')]=_[_0x0220('0x52')](_0x591436[_0x0220('0x53')],{'$or':_[_0x0220('0x43')](_0x591436[_0x0220('0x4b')],function(_0x35de5d){var _0x4af9c6={};_0x4af9c6[_0x35de5d]={'$like':'%'+_0x36c32f['query'][_0x0220('0x51')]+'%'};return _0x4af9c6;})});}_0x591436=_[_0x0220('0x52')]({},_0x591436,_0x36c32f[_0x0220('0x54')]);return db['CannedAnswer'][_0x0220('0x20')]({'where':_0x591436[_0x0220('0x53')]})[_0x0220('0x12')](function(_0x4a1cf0){_0x5ae600[_0x0220('0x20')]=_0x4a1cf0;if(_0x36c32f[_0x0220('0x47')][_0x0220('0x56')]){_0x591436['include']=[{'all':!![]}];}return db[_0x0220('0x6e')]['findAll'](_0x591436);})[_0x0220('0x12')](function(_0x4c319e){_0x5ae600[_0x0220('0x59')]=_0x4c319e;return _0x5ae600;});}})[_0x0220('0x12')](respondWithFilteredResult(_0xa8c197,_0x591436))[_0x0220('0x5a')](handleError(_0xa8c197,null));};exports[_0x0220('0x6f')]=function(_0x29afe4,_0x3109a5){return db[_0x0220('0x55')][_0x0220('0x60')]({'where':{'id':_0x29afe4['params']['id']}})[_0x0220('0x12')](handleEntityNotFound(_0x3109a5,null))['then'](function(_0x44b305){if(_0x44b305){return _0x44b305['removeAnswers'](_0x29afe4[_0x0220('0x47')][_0x0220('0x6c')]);}})[_0x0220('0x12')](respondWithStatusCode(_0x3109a5,null))['catch'](handleError(_0x3109a5,null));};exports[_0x0220('0x69')]=function(_0x3227ef,_0xbd4535){var _0x28d2e6={'name':_0x3227ef[_0x0220('0x61')][_0x0220('0x27')],'key':_0x3227ef[_0x0220('0x61')][_0x0220('0x70')],'provider':_0x3227ef['body'][_0x0220('0x62')]===_0x0220('0x71')?null:_0x3227ef['body'][_0x0220('0x62')],'email':_0x3227ef[_0x0220('0x61')]['email'],'ListId':_0x3227ef[_0x0220('0x61')][_0x0220('0x72')],'active':!_[_0x0220('0x73')](_0x3227ef['body'][_0x0220('0x74')])?_0x3227ef[_0x0220('0x61')][_0x0220('0x74')]:!![],'description':_0x3227ef[_0x0220('0x61')]['description']||null};var _0x8795ca=getAuthenticationOptions(_0x28d2e6['provider'],_0x3227ef[_0x0220('0x61')]);_0x28d2e6[_0x0220('0x3f')]=_0x8795ca[_0x0220('0x3f')];_0x28d2e6[_0x0220('0x40')]=_0x8795ca[_0x0220('0x40')];return db['MailAccount'][_0x0220('0x69')](_0x28d2e6,{'include':[{'model':db[_0x0220('0x42')],'as':_0x0220('0x40')},{'model':db[_0x0220('0x5c')],'as':_0x0220('0x3f')}]})[_0x0220('0x12')](function(_0xb1a76c){var _0x59fa90=_0x3227ef[_0x0220('0x34')]['get']({'plain':!![]});if(!_0x59fa90)throw new Error(_0x0220('0x75'));if(_0x59fa90[_0x0220('0x76')]===_0x0220('0x34')){var _0x497f76=_0xb1a76c[_0x0220('0x77')]({'plain':!![]});return db[_0x0220('0x78')]['find']({'where':{'name':'MailAccounts','userProfileId':_0x59fa90['userProfileId']},'raw':!![]})['then'](function(_0xabf3f6){if(_0xabf3f6&&_0xabf3f6[_0x0220('0x79')]===0x0){return db[_0x0220('0x24')][_0x0220('0x69')]({'name':_0x497f76[_0x0220('0x27')],'resourceId':_0x497f76['id'],'type':_0xabf3f6['name'],'sectionId':_0xabf3f6['id']},{})[_0x0220('0x12')](function(){return _0xb1a76c;});}else{return _0xb1a76c;}})[_0x0220('0x5a')](function(_0x4ba3b4){logger[_0x0220('0x16')](_0x0220('0x7a'),_0x4ba3b4);throw _0x4ba3b4;});}return _0xb1a76c;})[_0x0220('0x12')](respondWithResult(_0xbd4535,0xc9))[_0x0220('0x5a')](handleError(_0xbd4535,null));};exports[_0x0220('0x7b')]=function(_0x21a75e,_0xd7a2c5){return db[_0x0220('0x55')][_0x0220('0x6a')]({'where':{'id':_0x21a75e[_0x0220('0x63')]['id']}})[_0x0220('0x12')](handleEntityNotFound(_0xd7a2c5,null))[_0x0220('0x12')](function(_0x64d1f){if(_0x64d1f){return _0x64d1f[_0x0220('0x7b')]();}return null;})[_0x0220('0x12')](respondWithResult(_0xd7a2c5,null))[_0x0220('0x5a')](handleError(_0xd7a2c5,null));};exports['addImap']=function(_0x12bbf5,_0x42d97b){if(_0x12bbf5[_0x0220('0x61')]['id']){delete _0x12bbf5[_0x0220('0x61')]['id'];}return db['MailAccount'][_0x0220('0x60')]({'where':{'id':_0x12bbf5[_0x0220('0x63')]['id']}})[_0x0220('0x12')](handleEntityNotFound(_0x42d97b,null))['then'](function(_0x5f0d1e){if(_0x5f0d1e){_0x12bbf5[_0x0220('0x61')]['MailAccountId']=_0x5f0d1e['id'];return db[_0x0220('0x5c')][_0x0220('0x69')](_0x12bbf5['body']);}})['then'](respondWithResult(_0x42d97b,null))[_0x0220('0x5a')](handleError(_0x42d97b,null));};exports['removeImap']=function(_0x9e807e,_0x314240){return db[_0x0220('0x55')][_0x0220('0x6a')]({'where':{'id':_0x9e807e[_0x0220('0x63')]['id']}})[_0x0220('0x12')](handleEntityNotFound(_0x314240,null))[_0x0220('0x12')](function(_0x5d0b70){if(_0x5d0b70){return _0x5d0b70[_0x0220('0x7c')](null);}return null;})['then'](respondWithStatusCode(_0x314240,null))[_0x0220('0x5a')](handleError(_0x314240,null));};exports[_0x0220('0x7d')]=function(_0x41b50a,_0x354750){return db[_0x0220('0x55')][_0x0220('0x6a')]({'where':{'id':_0x41b50a[_0x0220('0x63')]['id']}})[_0x0220('0x12')](handleEntityNotFound(_0x354750,null))[_0x0220('0x12')](function(_0x3ea3f7){if(_0x3ea3f7){return _0x3ea3f7[_0x0220('0x7d')]();}return null;})[_0x0220('0x12')](respondWithResult(_0x354750,null))[_0x0220('0x5a')](handleError(_0x354750,null));};exports['addSmtp']=function(_0x24a159,_0x2a0755){if(_0x24a159['body']['id']){delete _0x24a159[_0x0220('0x61')]['id'];}return db[_0x0220('0x55')]['find']({'where':{'id':_0x24a159[_0x0220('0x63')]['id']}})[_0x0220('0x12')](handleEntityNotFound(_0x2a0755,null))[_0x0220('0x12')](function(_0x37d9d2){if(_0x37d9d2){_0x24a159['body'][_0x0220('0x67')]=_0x37d9d2['id'];return db[_0x0220('0x42')][_0x0220('0x69')](_0x24a159[_0x0220('0x61')]);}})[_0x0220('0x12')](respondWithResult(_0x2a0755,null))['catch'](handleError(_0x2a0755,null));};exports[_0x0220('0x7e')]=function(_0x284ea7,_0xfdbfd7){return db[_0x0220('0x55')][_0x0220('0x6a')]({'where':{'id':_0x284ea7[_0x0220('0x63')]['id']}})[_0x0220('0x12')](handleEntityNotFound(_0xfdbfd7,null))[_0x0220('0x12')](function(_0x14ef70){if(_0x14ef70){return _0x14ef70[_0x0220('0x7f')](null);}return null;})[_0x0220('0x12')](respondWithStatusCode(_0xfdbfd7,null))['catch'](handleError(_0xfdbfd7,null));};exports['addInteraction']=function(_0x5f55de,_0x1d0056){return db['MailInteraction'][_0x0220('0x60')]({'where':{'id':_0x5f55de[_0x0220('0x63')]['id']}})['then'](handleEntityNotFound(_0x1d0056,null))['then'](function(_0x3e58ee){if(_0x3e58ee){return _0x3e58ee[_0x0220('0x80')](_0x5f55de[_0x0220('0x61')][_0x0220('0x6c')],_[_0x0220('0x81')](_0x5f55de[_0x0220('0x61')],[_0x0220('0x6c'),'id'])||{});}})[_0x0220('0x12')](respondWithResult(_0x1d0056,null))[_0x0220('0x5a')](handleError(_0x1d0056,null));};exports[_0x0220('0x82')]=function(_0x141ef6,_0x44a4eb){var _0x34afb0={'raw':![],'where':{}};var _0x2f5345={};var _0x4aaa83={'count':0x0,'rows':[]};return db[_0x0220('0x55')][_0x0220('0x6a')]({'where':{'id':_0x141ef6[_0x0220('0x63')]['id']}})[_0x0220('0x12')](handleEntityNotFound(_0x44a4eb,null))['then'](function(_0x2fa482){if(_0x2fa482){_0x2f5345[_0x0220('0x46')]=_[_0x0220('0x5f')](db['MailInteraction'][_0x0220('0x44')]);_0x2f5345[_0x0220('0x47')]=_[_0x0220('0x5f')](_0x141ef6[_0x0220('0x47')]);_0x2f5345['filters']=_[_0x0220('0x49')](_0x2f5345['model'],_0x2f5345[_0x0220('0x47')]);_0x34afb0['attributes']=_[_0x0220('0x49')](_0x2f5345[_0x0220('0x46')],qs[_0x0220('0x4a')](_0x141ef6[_0x0220('0x47')][_0x0220('0x4a')]));_0x34afb0[_0x0220('0x4b')]=_0x34afb0[_0x0220('0x4b')]['length']?_0x34afb0[_0x0220('0x4b')]:_0x2f5345[_0x0220('0x46')];if(!_0x141ef6[_0x0220('0x47')][_0x0220('0x4d')](_0x0220('0x4e'))){_0x34afb0['limit']=qs[_0x0220('0x21')](_0x141ef6[_0x0220('0x47')][_0x0220('0x21')]);_0x34afb0[_0x0220('0x1e')]=qs[_0x0220('0x1e')](_0x141ef6[_0x0220('0x47')][_0x0220('0x1e')]);}_0x34afb0[_0x0220('0x83')]=qs[_0x0220('0x4f')](_0x141ef6[_0x0220('0x47')][_0x0220('0x4f')]);_0x34afb0[_0x0220('0x53')]=qs[_0x0220('0x48')](_[_0x0220('0x50')](_0x141ef6[_0x0220('0x47')],_0x2f5345[_0x0220('0x48')]));_0x34afb0[_0x0220('0x53')]['MailAccountId']=_0x2fa482['id'];if(_0x141ef6[_0x0220('0x47')][_0x0220('0x51')]){_0x34afb0[_0x0220('0x53')]=_[_0x0220('0x52')](_0x34afb0['where'],{'$or':_[_0x0220('0x43')](_0x34afb0[_0x0220('0x4b')],function(_0x15cffd){var _0x17878a={};_0x17878a[_0x15cffd]={'$like':'%'+_0x141ef6[_0x0220('0x47')][_0x0220('0x51')]+'%'};return _0x17878a;})});}_0x34afb0=_[_0x0220('0x52')]({},_0x34afb0,_0x141ef6[_0x0220('0x54')]);return db[_0x0220('0x84')][_0x0220('0x20')]({'where':_0x34afb0[_0x0220('0x53')]})[_0x0220('0x12')](function(_0x1062a2){_0x4aaa83[_0x0220('0x20')]=_0x1062a2;if(_0x141ef6[_0x0220('0x47')][_0x0220('0x56')]){_0x34afb0[_0x0220('0x57')]=[{'model':db[_0x0220('0x85')],'as':_0x0220('0x86'),'required':![]},{'model':db[_0x0220('0x87')],'as':_0x0220('0x88'),'attributes':[_0x0220('0x27'),_0x0220('0x89'),'internal'],'required':![]},{'model':db[_0x0220('0x8a')],'as':'Tags','attributes':['id','name','color'],'where':_0x141ef6[_0x0220('0x47')]['tag']?{'id':_0x141ef6['query']['tag']}:undefined,'required':_0x141ef6[_0x0220('0x47')][_0x0220('0x8b')]?!![]:![]}];}return db['MailInteraction'][_0x0220('0x58')](_0x34afb0);})['then'](function(_0x417821){_0x4aaa83[_0x0220('0x59')]=_0x417821;return _0x4aaa83;});}})['then'](respondWithFilteredResult(_0x44a4eb,_0x34afb0))[_0x0220('0x5a')](handleError(_0x44a4eb,null));};exports['addApplications']=function addApplications(_0xfdad1a,_0x43ea73){var _0x5b808b=_0xfdad1a[_0x0220('0x63')]['id'];var _0x3e1fd8=_0xfdad1a[_0x0220('0x61')];var _0x1709d8=0xc8;var _0x481b9c=null;return db['sequelize']['transaction']({'isolationLevel':db['sequelize'][_0x0220('0x8c')]['ISOLATION_LEVELS'][_0x0220('0x8d')]},function(_0x3bdc05){return db[_0x0220('0x55')][_0x0220('0x6a')]({'where':{'id':_0x5b808b},'transaction':_0x3bdc05})[_0x0220('0x12')](function(_0x588ba4){if(_0x588ba4){return db[_0x0220('0x8e')][_0x0220('0x23')]({'where':{'MailAccountId':_0x5b808b},'transaction':_0x3bdc05})[_0x0220('0x12')](function(){var _0x2ccc18=_[_0x0220('0x43')](_0x3e1fd8,function(_0x22a8d2){_0x22a8d2[_0x0220('0x67')]=_0x5b808b;return _0x22a8d2;});return db['MailApplication']['bulkCreate'](_0x2ccc18,{'transaction':_0x3bdc05});});}else{_0x1709d8=0x194;_0x481b9c=[];}});})[_0x0220('0x12')](function(){if(_0x1709d8!==0x194){return db[_0x0220('0x8e')]['findAndCountAll']({'where':{'MailAccountId':_0x5b808b},'order':_0x0220('0x8f')})[_0x0220('0x12')](function(_0x55ab4b){_0x481b9c=_0x55ab4b;});}})['catch'](function(_0x2b9b04){_0x1709d8=0x1f4;logger[_0x0220('0x16')](_0x2b9b04['stack']);if(_0x2b9b04[_0x0220('0x27')]){delete _0x2b9b04[_0x0220('0x27')];}_0x481b9c=_0x2b9b04;})[_0x0220('0x90')](function(){if(_0x481b9c===null){_0x43ea73['sendStatus'](_0x1709d8);}else{if(_0x1709d8===0x1f4){_0x43ea73['status'](_0x1709d8)['send'](_0x481b9c);}else{_0x43ea73[_0x0220('0x1b')](_0x1709d8)[_0x0220('0x1d')](_0x481b9c);}}});};exports[_0x0220('0x91')]=function(_0x2b4809,_0x57f137){var _0x1d3939={};var _0x47ef8a={};var _0x45bbe3;var _0x5e6ec7;return db[_0x0220('0x55')][_0x0220('0x6a')]({'where':{'id':_0x2b4809[_0x0220('0x63')]['id']}})['then'](handleEntityNotFound(_0x57f137,null))['then'](function(_0x428872){if(_0x428872){_0x45bbe3=_0x428872;_0x47ef8a[_0x0220('0x46')]=_[_0x0220('0x5f')](db[_0x0220('0x8e')]['rawAttributes']);_0x47ef8a[_0x0220('0x47')]=_[_0x0220('0x5f')](_0x2b4809[_0x0220('0x47')]);_0x47ef8a[_0x0220('0x48')]=_[_0x0220('0x49')](_0x47ef8a['model'],_0x47ef8a[_0x0220('0x47')]);_0x1d3939[_0x0220('0x4b')]=_['intersection'](_0x47ef8a[_0x0220('0x46')],qs[_0x0220('0x4a')](_0x2b4809[_0x0220('0x47')]['fields']));_0x1d3939[_0x0220('0x4b')]=_0x1d3939[_0x0220('0x4b')]['length']?_0x1d3939[_0x0220('0x4b')]:_0x47ef8a[_0x0220('0x46')];_0x1d3939['order']=qs[_0x0220('0x4f')](_0x2b4809[_0x0220('0x47')][_0x0220('0x4f')]);_0x1d3939[_0x0220('0x53')]=qs[_0x0220('0x48')](_[_0x0220('0x50')](_0x2b4809[_0x0220('0x47')],_0x47ef8a['filters']));if(_0x2b4809[_0x0220('0x47')][_0x0220('0x51')]){_0x1d3939['where']=_['merge'](_0x1d3939[_0x0220('0x53')],{'$or':_[_0x0220('0x43')](_0x1d3939[_0x0220('0x4b')],function(_0x43ea74){var _0x2a2230={};_0x2a2230[_0x43ea74]={'$like':'%'+_0x2b4809[_0x0220('0x47')]['filter']+'%'};return _0x2a2230;})});}_0x1d3939=_[_0x0220('0x52')]({},_0x1d3939,_0x2b4809[_0x0220('0x54')]);return _0x45bbe3['getApplications'](_0x1d3939);}})[_0x0220('0x12')](function(_0x1f4237){if(_0x1f4237){_0x5e6ec7=_0x1f4237[_0x0220('0x4c')];if(!_0x2b4809[_0x0220('0x47')][_0x0220('0x4d')](_0x0220('0x4e'))){_0x1d3939[_0x0220('0x21')]=qs['limit'](_0x2b4809[_0x0220('0x47')][_0x0220('0x21')]);_0x1d3939[_0x0220('0x1e')]=qs['offset'](_0x2b4809['query'][_0x0220('0x1e')]);}return _0x45bbe3[_0x0220('0x91')](_0x1d3939);}})[_0x0220('0x12')](function(_0xa75734){if(_0xa75734){return _0xa75734?{'count':_0x5e6ec7,'rows':_0xa75734}:null;}})[_0x0220('0x12')](respondWithResult(_0x57f137,null))[_0x0220('0x5a')](handleError(_0x57f137,null));};exports[_0x0220('0x92')]=function(_0x23b795,_0x9fd4de){var _0x395425={'raw':!![],'where':{}};var _0x5584e8={};var _0x46d274={'count':0x0,'rows':[]};return db[_0x0220('0x55')][_0x0220('0x6a')]({'where':{'id':_0x23b795['params']['id']}})[_0x0220('0x12')](handleEntityNotFound(_0x9fd4de,null))['then'](function(_0x27e0cc){if(_0x27e0cc){_0x5584e8['model']=_[_0x0220('0x5f')](db[_0x0220('0x93')][_0x0220('0x44')]);_0x5584e8[_0x0220('0x47')]=_[_0x0220('0x5f')](_0x23b795[_0x0220('0x47')]);_0x5584e8['filters']=_[_0x0220('0x49')](_0x5584e8['model'],_0x5584e8[_0x0220('0x47')]);_0x395425[_0x0220('0x4b')]=_['intersection'](_0x5584e8['model'],qs['fields'](_0x23b795[_0x0220('0x47')][_0x0220('0x4a')]));_0x395425[_0x0220('0x4b')]=_0x395425[_0x0220('0x4b')][_0x0220('0x4c')]?_0x395425[_0x0220('0x4b')]:_0x5584e8[_0x0220('0x46')];if(!_0x23b795[_0x0220('0x47')]['hasOwnProperty'](_0x0220('0x4e'))){_0x395425['limit']=qs[_0x0220('0x21')](_0x23b795[_0x0220('0x47')][_0x0220('0x21')]);_0x395425[_0x0220('0x1e')]=qs[_0x0220('0x1e')](_0x23b795[_0x0220('0x47')][_0x0220('0x1e')]);}_0x395425[_0x0220('0x83')]=qs[_0x0220('0x4f')](_0x23b795['query'][_0x0220('0x4f')]);_0x395425[_0x0220('0x53')]=qs[_0x0220('0x48')](_['pick'](_0x23b795[_0x0220('0x47')],_0x5584e8['filters']));_0x395425[_0x0220('0x53')][_0x0220('0x67')]=_0x27e0cc['id'];if(_0x23b795['query']['filter']){_0x395425['where']=_[_0x0220('0x52')](_0x395425[_0x0220('0x53')],{'$or':_[_0x0220('0x43')](_0x395425[_0x0220('0x4b')],function(_0x3d6b61){var _0x28ac5a={};_0x28ac5a[_0x3d6b61]={'$like':'%'+_0x23b795[_0x0220('0x47')][_0x0220('0x51')]+'%'};return _0x28ac5a;})});}if(_0x23b795[_0x0220('0x47')][_0x0220('0x94')]){var _0x1b1a32=_0x23b795[_0x0220('0x47')][_0x0220('0x94')][_0x0220('0x95')](',');var _0xe0e261={};_0xe0e261[_0x1b1a32[0x0]]={'$gte':moment(_0x1b1a32[0x1])[_0x0220('0x96')](_0x0220('0x97'))};_0x395425['where']=_[_0x0220('0x52')](_0x395425[_0x0220('0x53')],_0xe0e261);}_0x395425=_[_0x0220('0x52')]({},_0x395425,_0x23b795['options']);return db[_0x0220('0x93')][_0x0220('0x20')]({'where':_0x395425[_0x0220('0x53')]})[_0x0220('0x12')](function(_0x533fae){_0x46d274[_0x0220('0x20')]=_0x533fae;if(_0x23b795['query'][_0x0220('0x56')]){_0x395425['include']=[{'all':!![]}];}return db[_0x0220('0x93')][_0x0220('0x58')](_0x395425);})['then'](function(_0xf58524){if(_0x23b795[_0x0220('0x47')][_0x0220('0x98')]==='true'){for(var _0x81f3cb=0x0;_0x81f3cb<_0xf58524['length'];_0x81f3cb++){_0xf58524[_0x81f3cb][_0x0220('0x61')]=juice(_0xf58524[_0x81f3cb][_0x0220('0x61')]);}}_0x46d274[_0x0220('0x59')]=_0xf58524;return _0x46d274;});}})[_0x0220('0x12')](respondWithFilteredResult(_0x9fd4de,_0x395425))[_0x0220('0x5a')](handleError(_0x9fd4de,null));};exports[_0x0220('0x28')]=function(_0x353053,_0x1acfdc){var _0x5d81ed,_0x14ae13={},_0x428c67;if(_0x353053[_0x0220('0x61')]['to']){_0x428c67=_0x353053[_0x0220('0x61')]['to']['split'](',')[0x0];}return db[_0x0220('0x55')]['find']({'where':{'id':_0x353053[_0x0220('0x63')]['id']},'include':[{'model':db[_0x0220('0x99')],'as':_0x0220('0x9a'),'include':[{'model':db[_0x0220('0x85')],'as':_0x0220('0x9b'),'where':{'email':_0x428c67},'limit':0x1,'order':[[_0x0220('0x9c'),_0x0220('0x9d')]]}]},{'model':db[_0x0220('0x42')],'as':_0x0220('0x40'),'raw':!![],'include':[{'model':db[_0x0220('0x9e')],'as':'CloudProvider','raw':!![]}]}]})[_0x0220('0x12')](handleEntityNotFound(_0x1acfdc,null))['then'](function(_0x215c1b){if(!_0x215c1b)return;_0x5d81ed=_0x215c1b;if(!_0x215c1b[_0x0220('0x40')])throw new Error('Smtp\x20configuration\x20not\x20found');if(_['isNil'](_0x353053['body'][_0x0220('0x9f')])){_0x353053[_0x0220('0x61')][_0x0220('0x9f')]=util[_0x0220('0x96')](_0x0220('0xa0'),_0x215c1b[_0x0220('0x27')],_0x215c1b[_0x0220('0xa1')]||_0x215c1b['Smtp'][_0x0220('0x34')]);}if(_0x353053[_0x0220('0x61')][_0x0220('0xa2')]&&_0x353053['body'][_0x0220('0xa2')][_0x0220('0x4c')]){for(var _0x1c24fe=0x0;_0x1c24fe<_0x353053[_0x0220('0x61')][_0x0220('0xa2')][_0x0220('0x4c')];_0x1c24fe+=0x1){_0x353053[_0x0220('0x61')][_0x0220('0xa2')][_0x1c24fe]={'filename':_0x353053[_0x0220('0x61')]['attachments'][_0x1c24fe][_0x0220('0x27')],'path':path[_0x0220('0xa3')](config[_0x0220('0xa4')],_0x0220('0xa5'),_0x353053[_0x0220('0x61')]['attachments'][_0x1c24fe][_0x0220('0xa6')])};}}var _0x259edd=_0x215c1b[_0x0220('0xa7')]();return respondWithRpcPromise(_0x0220('0xa8'),_0x0220('0xa9'),{'account':_0x259edd,'message':_0x353053['body']});})[_0x0220('0x12')](function(_0x157c59){if(!_0x157c59)return;_0x14ae13=_0x157c59;if(!_0x5d81ed[_0x0220('0x9a')])throw new Error(_0x0220('0xaa'));if(_0x5d81ed['List']['Contacts'][_0x0220('0x4c')])return _0x5d81ed[_0x0220('0x9a')][_0x0220('0x9b')][0x0];return db['CmContact'][_0x0220('0x69')](_[_0x0220('0xb')](_0x353053[_0x0220('0x61')],{'firstName':_0x353053['body']['to'],'email':_0x353053['body']['to'],'phone':_0x353053[_0x0220('0x61')]['to'],'ListId':_0x5d81ed[_0x0220('0x72')]}));})['then'](function(_0x120c8a){if(!_0x120c8a)return;var _0x59d5a4={'UserId':_0x353053['user']['id'],'ContactId':_0x120c8a['id'],'MailAccountId':_0x5d81ed['id'],'inReplyTo':_0x14ae13[_0x0220('0xab')],'to':_0x353053[_0x0220('0x61')][_0x0220('0x9f')],'cc':_0x353053[_0x0220('0x61')]['cc'],'subject':_0x353053[_0x0220('0x61')]['subject'],'attach':_0x353053[_0x0220('0x61')]['attach'],'firstMsgDirection':_0x0220('0xac'),'lastMsgAt':moment()[_0x0220('0x96')](_0x0220('0x97')),'lastMsgDirection':_0x0220('0xac'),'Messages':[_['merge'](_0x353053['body'],{'messageId':_0x14ae13['messageId'],'sentAt':moment()[_0x0220('0x96')](_0x0220('0x97')),'read':!![],'MailAccountId':_0x5d81ed['id'],'UserId':_0x353053[_0x0220('0x34')]['id'],'ContactId':_0x120c8a['id']})]};if(_0x353053['body'][_0x0220('0xad')]){_0x59d5a4=_[_0x0220('0x52')](_0x59d5a4,_0x353053[_0x0220('0x61')]['Interaction']);}return db[_0x0220('0x84')]['create'](_0x59d5a4,{'include':[{'model':db[_0x0220('0x93')],'as':'Messages'}]});})[_0x0220('0x12')](respondWithResult(_0x1acfdc,null))['catch'](handleError(_0x1acfdc,null));};exports[_0x0220('0xae')]=function(_0x19d4a7,_0x2207e1){return db[_0x0220('0x55')]['find']({'where':{'id':_0x19d4a7[_0x0220('0x63')]['id']},'include':[{'model':db[_0x0220('0x42')],'as':_0x0220('0x40'),'raw':!![],'include':[{'model':db[_0x0220('0x9e')],'as':_0x0220('0x9e'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x2207e1,null))['then'](function(_0x24547d){if(!_0x24547d[_0x0220('0x40')])return;var _0x2b2c00=_0x24547d[_0x0220('0xa7')]();return respondWithRpcPromise(_0x0220('0xaf'),_0x0220('0xae'),{'account':_0x2b2c00});})['then'](respondWithResult(_0x2207e1,null))['catch'](handleError(_0x2207e1,null));};exports['destroy']=function(_0x63d903,_0x17eff0){return db['MailAccount'][_0x0220('0x60')]({'where':{'id':_0x63d903[_0x0220('0x63')]['id']}})[_0x0220('0x12')](handleEntityNotFound(_0x17eff0,null))[_0x0220('0x12')](function(_0x173460){if(_0x173460&&_0x173460[_0x0220('0x3c')]){throw new db[(_0x0220('0xb0'))]['ValidationError'](_0x0220('0xb1'));}return _0x173460;})[_0x0220('0x12')](removeEntity(_0x17eff0,null))[_0x0220('0x5a')](handleError(_0x17eff0,null));};exports['addAgents']=function(_0x2f615b,_0x2ad740){return db[_0x0220('0x55')]['find']({'where':{'id':_0x2f615b[_0x0220('0x63')]['id']}})[_0x0220('0x12')](handleEntityNotFound(_0x2ad740,null))['then'](function(_0x54bac3){if(_0x54bac3){return _0x54bac3[_0x0220('0xb2')](_0x2f615b['body'][_0x0220('0x6c')],_[_0x0220('0x81')](_0x2f615b['body'],[_0x0220('0x6c'),'id'])||{})[_0x0220('0xb3')](function(_0x5133d8){for(var _0x36558c=0x0;_0x36558c<_0x2f615b[_0x0220('0x61')][_0x0220('0x6c')][_0x0220('0x4c')];_0x36558c+=0x1){socket['emit'](_0x0220('0xb4'),{'UserId':Number(_0x2f615b[_0x0220('0x61')][_0x0220('0x6c')][_0x36558c]),'MailAccountId':Number(_0x2f615b[_0x0220('0x63')]['id'])});}return _0x5133d8;});}})[_0x0220('0x12')](respondWithResult(_0x2ad740,null))[_0x0220('0x5a')](handleError(_0x2ad740,null));};exports[_0x0220('0xb5')]=function(_0x27668e,_0x65640e){return db[_0x0220('0x55')][_0x0220('0x60')]({'where':{'id':_0x27668e[_0x0220('0x63')]['id']}})[_0x0220('0x12')](handleEntityNotFound(_0x65640e,null))[_0x0220('0x12')](function(_0x4e0fa1){if(_0x4e0fa1){return _0x4e0fa1['removeAgents'](_0x27668e[_0x0220('0x47')][_0x0220('0x6c')])[_0x0220('0x12')](function(){if(_['isArray'](_0x27668e[_0x0220('0x47')][_0x0220('0x6c')])){for(var _0xe3b46b=0x0;_0xe3b46b<_0x27668e[_0x0220('0x47')][_0x0220('0x6c')][_0x0220('0x4c')];_0xe3b46b+=0x1){socket[_0x0220('0xb6')](_0x0220('0xb7'),{'UserId':Number(_0x27668e[_0x0220('0x47')][_0x0220('0x6c')][_0xe3b46b]),'MailAccountId':Number(_0x27668e[_0x0220('0x63')]['id'])});}}else{socket[_0x0220('0xb6')]('userMailAccount:remove',{'UserId':Number(_0x27668e['query']['ids']),'MailAccountId':Number(_0x27668e[_0x0220('0x63')]['id'])});}});}})[_0x0220('0x12')](respondWithStatusCode(_0x65640e,null))['catch'](handleError(_0x65640e,null));};exports[_0x0220('0xb8')]=function(_0xcd9637,_0x5910bf){var _0x59a633={};var _0xcca6ff={};var _0x1c6ab6;var _0x2a7165;return db[_0x0220('0x55')][_0x0220('0x6a')]({'where':{'id':_0xcd9637[_0x0220('0x63')]['id']}})['then'](handleEntityNotFound(_0x5910bf,null))[_0x0220('0x12')](function(_0x42c531){if(_0x42c531){_0x1c6ab6=_0x42c531;_0xcca6ff[_0x0220('0x46')]=_[_0x0220('0x5f')](db[_0x0220('0x87')][_0x0220('0x44')]);_0xcca6ff[_0x0220('0x47')]=_[_0x0220('0x5f')](_0xcd9637['query']);_0xcca6ff[_0x0220('0x48')]=_[_0x0220('0x49')](_0xcca6ff[_0x0220('0x46')],_0xcca6ff['query']);_0x59a633[_0x0220('0x4b')]=_[_0x0220('0x49')](_0xcca6ff[_0x0220('0x46')],qs['fields'](_0xcd9637[_0x0220('0x47')]['fields']));_0x59a633[_0x0220('0x4b')]=_0x59a633[_0x0220('0x4b')][_0x0220('0x4c')]?_0x59a633[_0x0220('0x4b')]:_0xcca6ff[_0x0220('0x46')];_0x59a633['order']=qs[_0x0220('0x4f')](_0xcd9637[_0x0220('0x47')][_0x0220('0x4f')]);_0x59a633['where']=qs[_0x0220('0x48')](_[_0x0220('0x50')](_0xcd9637['query'],_0xcca6ff['filters']));if(_0xcd9637[_0x0220('0x47')][_0x0220('0x51')]){_0x59a633[_0x0220('0x53')]=_[_0x0220('0x52')](_0x59a633[_0x0220('0x53')],{'$or':_['map'](_0x59a633['attributes'],function(_0x59472a){var _0x40ae8a={};_0x40ae8a[_0x59472a]={'$like':'%'+_0xcd9637[_0x0220('0x47')]['filter']+'%'};return _0x40ae8a;})});}_0x59a633=_[_0x0220('0x52')]({},_0x59a633,_0xcd9637[_0x0220('0x54')]);return _0x1c6ab6[_0x0220('0xb8')](_0x59a633);}})[_0x0220('0x12')](function(_0x451fcd){if(_0x451fcd){_0x2a7165=_0x451fcd[_0x0220('0x4c')];if(!_0xcd9637[_0x0220('0x47')][_0x0220('0x4d')]('nolimit')){_0x59a633['limit']=qs[_0x0220('0x21')](_0xcd9637['query'][_0x0220('0x21')]);_0x59a633[_0x0220('0x1e')]=qs['offset'](_0xcd9637[_0x0220('0x47')]['offset']);}return _0x1c6ab6[_0x0220('0xb8')](_0x59a633);}})[_0x0220('0x12')](function(_0x4de44e){if(_0x4de44e){return _0x4de44e?{'count':_0x2a7165,'rows':_0x4de44e}:null;}})[_0x0220('0x12')](respondWithResult(_0x5910bf,null))[_0x0220('0x5a')](handleError(_0x5910bf,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 0e4b4f5..721229f 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 _0x90b1=['hasOwnProperty','hook','exports','events','../../mysqldb','MailAccount','update','remove'];(function(_0x11fb70,_0x20e8e2){var _0x27500b=function(_0x522e70){while(--_0x522e70){_0x11fb70['push'](_0x11fb70['shift']());}};_0x27500b(++_0x20e8e2);}(_0x90b1,0x1bb));var _0x190b=function(_0x43314a,_0x330675){_0x43314a=_0x43314a-0x0;var _0x43201d=_0x90b1[_0x43314a];return _0x43201d;};'use strict';var EventEmitter=require(_0x190b('0x0'));var MailAccount=require(_0x190b('0x1'))['db'][_0x190b('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x190b('0x3'),'afterDestroy':_0x190b('0x4')};function emitEvent(_0xa05468){return function(_0x120ddc,_0x4fbcad,_0x4c355f){MailAccountEvents['emit'](_0xa05468+':'+_0x120ddc['id'],_0x120ddc);MailAccountEvents['emit'](_0xa05468,_0x120ddc);_0x4c355f(null);};}for(var e in events){if(events[_0x190b('0x5')](e)){var event=events[e];MailAccount[_0x190b('0x6')](e,emitEvent(event));}}module[_0x190b('0x7')]=MailAccountEvents; \ No newline at end of file +var _0x684b=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','MailAccount'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x684b,0x1a5));var _0xb684=function(_0x2bb9db,_0x5c997c){_0x2bb9db=_0x2bb9db-0x0;var _0x2a2e20=_0x684b[_0x2bb9db];return _0x2a2e20;};'use strict';var EventEmitter=require(_0xb684('0x0'));var MailAccount=require('../../mysqldb')['db'][_0xb684('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xb684('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb684('0x3'),'afterDestroy':_0xb684('0x4')};function emitEvent(_0x208615){return function(_0x217699,_0x4fb0ea,_0x11d8d7){MailAccountEvents['emit'](_0x208615+':'+_0x217699['id'],_0x217699);MailAccountEvents[_0xb684('0x5')](_0x208615,_0x217699);_0x11d8d7(null);};}for(var e in events){if(events[_0xb684('0x6')](e)){var event=events[e];MailAccount[_0xb684('0x7')](e,emitEvent(event));}}module[_0xb684('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 9c0088c..0d37c26 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 _0x713a=['MailAccount','mail_accounts','provider','custom','service','host','port','Smtp','secure','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','auth','OAuth2','user','pass','./mailAccount.attributes','define'];(function(_0x1a2906,_0x5ee08f){var _0x82a462=function(_0x3c7a12){while(--_0x3c7a12){_0x1a2906['push'](_0x1a2906['shift']());}};_0x82a462(++_0x5ee08f);}(_0x713a,0x1ae));var _0xa713=function(_0x36bfe4,_0x2166d0){_0x36bfe4=_0x36bfe4-0x0;var _0x35eece=_0x713a[_0x36bfe4];return _0x35eece;};'use strict';var attributes=require(_0xa713('0x0'));module['exports']=function(_0x8d7191){return _0x8d7191[_0xa713('0x1')](_0xa713('0x2'),attributes,{'tableName':_0xa713('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x55e57a=this;var _0x58f394={'id':_0x55e57a['id'],'tls':{'rejectUnauthorized':![]}};if(_0x55e57a[_0xa713('0x4')]!==_0xa713('0x5')){_0x58f394[_0xa713('0x6')]=_0x55e57a['provider'];}else{_0x58f394['host']=_0x55e57a['Smtp'][_0xa713('0x7')];_0x58f394[_0xa713('0x8')]=_0x55e57a[_0xa713('0x9')]['port'];_0x58f394[_0xa713('0xa')]=_0x55e57a[_0xa713('0x9')][_0xa713('0xa')];}if(_0x55e57a[_0xa713('0x9')]['authentication']){if(_0x55e57a['Smtp'][_0xa713('0xb')]){if(!_0x55e57a[_0xa713('0x9')][_0xa713('0xc')])throw new Error(_0xa713('0xd'));_0x58f394[_0xa713('0xe')]={'type':_0xa713('0xf'),'user':_0x55e57a[_0xa713('0x9')][_0xa713('0x10')],'accessToken':_0x55e57a['Smtp'][_0xa713('0xc')]['data5']};}else{_0x58f394[_0xa713('0xe')]={'user':_0x55e57a[_0xa713('0x9')][_0xa713('0x10')],'pass':_0x55e57a[_0xa713('0x9')][_0xa713('0x11')]};}}return _0x58f394;}}});}; \ No newline at end of file +var _0xd1aa=['authentication','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','OAuth2','user','auth','./mailAccount.attributes','define','mail_accounts','provider','custom','host','Smtp','port','secure'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd1aa,0x157));var _0xad1a=function(_0x4da382,_0x4cfc5d){_0x4da382=_0x4da382-0x0;var _0x10073f=_0xd1aa[_0x4da382];return _0x10073f;};'use strict';var attributes=require(_0xad1a('0x0'));module['exports']=function(_0x9c9471){return _0x9c9471[_0xad1a('0x1')]('MailAccount',attributes,{'tableName':_0xad1a('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x29e345=this;var _0x2991ed={'id':_0x29e345['id'],'tls':{'rejectUnauthorized':![]}};if(_0x29e345[_0xad1a('0x3')]!==_0xad1a('0x4')){_0x2991ed['service']=_0x29e345[_0xad1a('0x3')];}else{_0x2991ed[_0xad1a('0x5')]=_0x29e345[_0xad1a('0x6')][_0xad1a('0x5')];_0x2991ed[_0xad1a('0x7')]=_0x29e345[_0xad1a('0x6')][_0xad1a('0x7')];_0x2991ed[_0xad1a('0x8')]=_0x29e345['Smtp']['secure'];}if(_0x29e345['Smtp'][_0xad1a('0x9')]){if(_0x29e345[_0xad1a('0x6')][_0xad1a('0xa')]){if(!_0x29e345[_0xad1a('0x6')][_0xad1a('0xb')])throw new Error(_0xad1a('0xc'));_0x2991ed['auth']={'type':_0xad1a('0xd'),'user':_0x29e345['Smtp'][_0xad1a('0xe')],'accessToken':_0x29e345[_0xad1a('0x6')][_0xad1a('0xb')]['data5']};}else{_0x2991ed[_0xad1a('0xf')]={'user':_0x29e345[_0xad1a('0x6')][_0xad1a('0xe')],'pass':_0x29e345[_0xad1a('0x6')]['pass']};}}return _0x2991ed;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index c02eab5..f1ee61e 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 _0x57ca=['setDataValue','getSmtpOptions','NotifyMailAccount','body','mail','difference','keys','CmContact','createdAt','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','account','CmList','Contacts','updatedAt','DESC','MailApplication','Applications','List','omit','applications','list','orderBy','asc','push','length','close','*,*,*,*','ListId','contact','messageId','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','Messages','inReplyTo','MailInteraction','create','Contact\x20not\x20found','spread','update','interaction','get','created','originCc','bcc','Email','Attachment','Attachments','UserId','User','unshift','name','waitForTheAssignedAgent','startRouting','Start','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','then','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetMailAccount','findAll','options','raw','where','attributes','limit','include','map','model','info','ShowMailAccount','MailAccount','find'];(function(_0x2ba9b9,_0x339be3){var _0x3a1759=function(_0x93af52){while(--_0x93af52){_0x2ba9b9['push'](_0x2ba9b9['shift']());}};_0x3a1759(++_0x339be3);}(_0x57ca,0x108));var _0xa57c=function(_0x30a2af,_0x528290){_0x30a2af=_0x30a2af-0x0;var _0x4ac83d=_0x57ca[_0x30a2af];return _0x4ac83d;};'use strict';var _=require('lodash');var moment=require(_0xa57c('0x0'));var BPromise=require(_0xa57c('0x1'));var rs=require('randomstring');var Redis=require(_0xa57c('0x2'));var db=require(_0xa57c('0x3'))['db'];var logger=require(_0xa57c('0x4'))(_0xa57c('0x5'));var config=require(_0xa57c('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xa57c('0x7')][_0xa57c('0x8')]({'port':0x232c});config[_0xa57c('0x9')]=_[_0xa57c('0xa')](config[_0xa57c('0x9')],{'host':_0xa57c('0xb'),'port':0x18eb});var socket=require(_0xa57c('0xc'))(new Redis(config[_0xa57c('0x9')]));require('./mailAccount.socket')[_0xa57c('0xd')](socket);function respondWithRpcPromise(_0x4b51d8,_0x46ba92,_0x932dcc){return new BPromise(function(_0x4fa5ed,_0x156bca){return client['request'](_0x4b51d8,_0x932dcc)[_0xa57c('0xe')](function(_0x44b221){logger['info'](_0xa57c('0xf'),_0x46ba92,'request\x20sent');logger[_0xa57c('0x10')](_0xa57c('0x11'),_0x46ba92,_0xa57c('0x12'),JSON[_0xa57c('0x13')](_0x44b221));if(_0x44b221[_0xa57c('0x14')]){if(_0x44b221['error'][_0xa57c('0x15')]===0x1f4){logger['error'](_0xa57c('0xf'),_0x46ba92,_0x44b221[_0xa57c('0x14')][_0xa57c('0x16')]);return _0x156bca(_0x44b221[_0xa57c('0x14')][_0xa57c('0x16')]);}logger[_0xa57c('0x14')](_0xa57c('0xf'),_0x46ba92,_0x44b221['error'][_0xa57c('0x16')]);return _0x4fa5ed(_0x44b221[_0xa57c('0x14')][_0xa57c('0x16')]);}else{logger['info'](_0xa57c('0xf'),_0x46ba92,'request\x20sent');_0x4fa5ed(_0x44b221[_0xa57c('0x17')][_0xa57c('0x16')]);}})[_0xa57c('0x18')](function(_0xe3d505){logger[_0xa57c('0x14')](_0xa57c('0xf'),_0x46ba92,_0xe3d505);_0x156bca(_0xe3d505);});});}exports[_0xa57c('0x19')]=function(_0x595c7a){var _0x4e4399=this;return new Promise(function(_0x8a8856,_0x4a53ab){return db['MailAccount'][_0xa57c('0x1a')]({'raw':_0x595c7a[_0xa57c('0x1b')]?_0x595c7a[_0xa57c('0x1b')][_0xa57c('0x1c')]===undefined?!![]:![]:!![],'where':_0x595c7a['options']?_0x595c7a[_0xa57c('0x1b')][_0xa57c('0x1d')]||null:null,'attributes':_0x595c7a[_0xa57c('0x1b')]?_0x595c7a[_0xa57c('0x1b')][_0xa57c('0x1e')]||null:null,'limit':_0x595c7a[_0xa57c('0x1b')]?_0x595c7a[_0xa57c('0x1b')][_0xa57c('0x1f')]||null:null,'include':_0x595c7a[_0xa57c('0x1b')]?_0x595c7a[_0xa57c('0x1b')][_0xa57c('0x20')]?_[_0xa57c('0x21')](_0x595c7a[_0xa57c('0x1b')][_0xa57c('0x20')],function(_0x431bec){return{'model':db[_0x431bec['model']],'as':_0x431bec['as'],'attributes':_0x431bec[_0xa57c('0x1e')],'include':_0x431bec[_0xa57c('0x20')]?_[_0xa57c('0x21')](_0x431bec[_0xa57c('0x20')],function(_0x315ad7){return{'model':db[_0x315ad7[_0xa57c('0x22')]],'as':_0x315ad7['as'],'attributes':_0x315ad7[_0xa57c('0x1e')],'include':_0x315ad7[_0xa57c('0x20')]?_[_0xa57c('0x21')](_0x315ad7[_0xa57c('0x20')],function(_0x57ebe0){return{'model':db[_0x57ebe0[_0xa57c('0x22')]],'as':_0x57ebe0['as'],'attributes':_0x57ebe0['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x257661){logger[_0xa57c('0x23')]('GetMailAccount',_0x595c7a);logger[_0xa57c('0x10')](_0xa57c('0x19'),_0x595c7a,JSON[_0xa57c('0x13')](_0x257661));_0x8a8856(_0x257661);})['catch'](function(_0xd779f1){logger['error'](_0xa57c('0x19'),_0xd779f1['message'],_0x595c7a);_0x4a53ab(_0x4e4399[_0xa57c('0x14')](0x1f4,_0xd779f1['message']));});});};exports[_0xa57c('0x24')]=function(_0x532164){var _0x9e02bb=this;return new Promise(function(_0x1d82d9,_0x43c8f3){return db[_0xa57c('0x25')][_0xa57c('0x26')]({'raw':_0x532164[_0xa57c('0x1b')]?_0x532164[_0xa57c('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x532164[_0xa57c('0x1b')]?_0x532164['options'][_0xa57c('0x1d')]||null:null,'attributes':_0x532164[_0xa57c('0x1b')]?_0x532164[_0xa57c('0x1b')]['attributes']||null:null,'include':_0x532164[_0xa57c('0x1b')]?_0x532164['options'][_0xa57c('0x20')]?_['map'](_0x532164[_0xa57c('0x1b')]['include'],function(_0x433116){return{'model':db[_0x433116[_0xa57c('0x22')]],'as':_0x433116['as'],'attributes':_0x433116['attributes'],'include':_0x433116[_0xa57c('0x20')]?_['map'](_0x433116[_0xa57c('0x20')],function(_0x5c56d3){return{'model':db[_0x5c56d3[_0xa57c('0x22')]],'as':_0x5c56d3['as'],'attributes':_0x5c56d3[_0xa57c('0x1e')],'include':_0x5c56d3[_0xa57c('0x20')]?_[_0xa57c('0x21')](_0x5c56d3[_0xa57c('0x20')],function(_0x44350f){return{'model':db[_0x44350f['model']],'as':_0x44350f['as'],'attributes':_0x44350f['attributes']};}):[]};}):[]};}):[]:[]})[_0xa57c('0xe')](function(_0x13e390){if(_0x532164[_0xa57c('0x1b')]['smtp']===!![])_0x13e390[_0xa57c('0x27')]('smtpOptions',_0x13e390[_0xa57c('0x28')]());logger[_0xa57c('0x23')]('ShowMailAccount',_0x532164);logger['debug']('ShowMailAccount',_0x532164,JSON[_0xa57c('0x13')](_0x13e390));_0x1d82d9(_0x13e390);})[_0xa57c('0x18')](function(_0x269a19){logger[_0xa57c('0x14')](_0xa57c('0x24'),_0x269a19[_0xa57c('0x16')],_0x532164);_0x43c8f3(_0x9e02bb['error'](0x1f4,_0x269a19[_0xa57c('0x16')]));});});};exports[_0xa57c('0x29')]=function(_0x5a5490){var _0x5ed42d=this;return new Promise(function(_0x5e10b,_0x203375){var _0x5af5e9={'body':_0x5a5490[_0xa57c('0x2a')],'channel':_0xa57c('0x2b')};var _0x2112b7=_[_0xa57c('0x2c')](_[_0xa57c('0x2d')](db[_0xa57c('0x2e')]['rawAttributes']),[_0xa57c('0x2f'),'updatedAt','CompanyId','ListId']);var _0x520383=![];if(_0x5a5490['body']['id']){delete _0x5a5490[_0xa57c('0x2a')]['id'];}if(_[_0xa57c('0x30')](_0x5a5490[_0xa57c('0x2a')]['from'])){return _0x203375(_0x5ed42d['error'](0x1f4,'from\x20is\x20mandatory'));}if(_[_0xa57c('0x30')](_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x2a')])||_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x2a')]===''){return _0x203375(_0x5ed42d[_0xa57c('0x14')](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0xa57c('0x30')](_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x31')])){return _0x203375(_0x5ed42d[_0xa57c('0x14')](0x1f4,_0xa57c('0x32')+_0x2112b7));}if(!_[_0xa57c('0x33')](_0x2112b7,_0x5a5490['body'][_0xa57c('0x31')])){return _0x203375(_0x5ed42d[_0xa57c('0x14')](0x1f4,_0xa57c('0x34')+_0x2112b7));}var _0x14e943={};_0x14e943[_0x5a5490[_0xa57c('0x2a')]['mapKey']]=_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x35')];return db[_0xa57c('0x25')][_0xa57c('0x26')]({'where':{'id':_0x5a5490[_0xa57c('0x36')]['id']},'include':[{'model':db[_0xa57c('0x37')],'as':'List','include':[{'model':db[_0xa57c('0x2e')],'as':_0xa57c('0x38'),'where':_0x14e943,'limit':0x1,'order':[[_0xa57c('0x39'),_0xa57c('0x3a')]]}]},{'model':db[_0xa57c('0x3b')],'as':_0xa57c('0x3c')},{'model':db['MailServerOut'],'as':'Smtp','include':[{'model':db['CloudProvider'],'as':'CloudProvider'}]}]})[_0xa57c('0xe')](function(_0x49492f){if(_0x49492f&&_0x49492f[_0xa57c('0x3d')]){var _0xae87=_0x49492f['get']({'plain':!![]});_0x5af5e9[_0xa57c('0x36')]=_[_0xa57c('0x3e')](_0xae87,[_0xa57c('0x3c'),_0xa57c('0x3d')]);_0x5af5e9[_0xa57c('0x36')]['smtpOptions']=_0x49492f[_0xa57c('0x28')]();_0x5af5e9[_0xa57c('0x3f')]=_0xae87[_0xa57c('0x3c')];_0x5af5e9[_0xa57c('0x40')]=_0xae87[_0xa57c('0x3d')];_0x5af5e9['applications']=_[_0xa57c('0x41')](_0x5af5e9['applications'],['priority'],[_0xa57c('0x42')]);if(_0x5af5e9[_0xa57c('0x36')]&&_0x5af5e9[_0xa57c('0x36')]['autoclose']){_0x5af5e9['applications'][_0xa57c('0x43')]({'id':0x0,'priority':_0x5af5e9[_0xa57c('0x3f')][_0xa57c('0x44')]+0x1,'app':_0xa57c('0x45'),'appdata':'autoclose','interval':_0xa57c('0x46')});}if(_0x5af5e9[_0xa57c('0x36')][_0xa57c('0x3c')]){delete _0x5af5e9['account']['Applications'];}if(_0x5af5e9[_0xa57c('0x36')][_0xa57c('0x3d')]){delete _0x5af5e9['account'][_0xa57c('0x3d')];}if(_0xae87[_0xa57c('0x3d')][_0xa57c('0x38')][_0xa57c('0x44')]){return _0xae87[_0xa57c('0x3d')][_0xa57c('0x38')][0x0];}var _0x4fc413=_['defaults'](_0x5a5490['body'],{'firstName':_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x35')],'ListId':_0xae87[_0xa57c('0x47')]});_0x4fc413[_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x31')]]=_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x35')];return db[_0xa57c('0x2e')]['create'](_0x4fc413);}else{throw new Error('List\x20not\x20found');}})[_0xa57c('0xe')](function(_0x4e18ad){_0x5af5e9[_0xa57c('0x48')]=_0x4e18ad;if(_0x4e18ad){if(!_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x16')]['messageId']){_0x5a5490[_0xa57c('0x2a')]['message'][_0xa57c('0x49')]=rs['generate']()+'\x20'+_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x16')][_0xa57c('0x35')];}var _0x26a8e1={'ContactId':_0x4e18ad['id'],'MailAccountId':_0x5a5490['account']['id'],'inReplyTo':_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x16')][_0xa57c('0x49')],'to':_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x16')]['from'],'cc':_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x16')]['cc'],'subject':_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x16')][_0xa57c('0x4a')],'attach':_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x16')][_0xa57c('0x4b')],'lastMsgAt':moment()[_0xa57c('0x4c')](_0xa57c('0x4d')),'lastMsgDirection':'in'};return db['MailInteraction'][_0xa57c('0x26')]({'where':{'closed':![],'MailAccountId':_0x5a5490[_0xa57c('0x36')]['id']},'include':[{'model':db[_0xa57c('0x4e')],'as':_0xa57c('0x4f'),'attributes':[_0xa57c('0x49')],'where':{'messageId':_0x5a5490[_0xa57c('0x2a')]['message'][_0xa57c('0x50')]}}]})[_0xa57c('0xe')](function(_0x521acc){if(_0x521acc){return[_0x521acc,![]];}return db[_0xa57c('0x51')][_0xa57c('0x52')](_0x26a8e1)[_0xa57c('0xe')](function(_0xa78a75){return[_0xa78a75,!![]];});});}else{throw new Error(_0xa57c('0x53'));}})[_0xa57c('0x54')](function(_0x24efa0,_0x5e1103){if(_0x24efa0){_0x520383=_0x5e1103;if(!_0x5e1103){return _0x24efa0[_0xa57c('0x55')]({'inReplyTo':_0x5a5490['body'][_0xa57c('0x16')]['messageId'],'to':_0x5a5490[_0xa57c('0x2a')]['message'][_0xa57c('0x35')],'cc':_0x5a5490[_0xa57c('0x2a')]['message']['cc'],'subject':_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x16')][_0xa57c('0x4a')],'attach':_0x24efa0[_0xa57c('0x4b')]?_0x24efa0['attach']:_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x16')][_0xa57c('0x4b')],'substatus':null,'substatusAt':moment()[_0xa57c('0x4c')](_0xa57c('0x4d')),'lastMsgAt':moment()[_0xa57c('0x4c')](_0xa57c('0x4d')),'lastMsgDirection':'in'});}else{return _0x24efa0;}}})[_0xa57c('0xe')](function(_0x11c13e){_0x5af5e9[_0xa57c('0x56')]=_0x11c13e[_0xa57c('0x57')]({'plain':!![]});_0x5af5e9[_0xa57c('0x56')][_0xa57c('0x58')]=_0x520383;return db[_0xa57c('0x4e')][_0xa57c('0x52')]({'body':_0x5a5490[_0xa57c('0x2a')]['body'],'MailAccountId':_0x5a5490[_0xa57c('0x36')]['id'],'MailInteractionId':_0x11c13e['id'],'direction':'in','ContactId':_0x5af5e9['contact']['id'],'messageId':_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x16')][_0xa57c('0x49')],'from':_0x5a5490['body'][_0xa57c('0x16')][_0xa57c('0x35')],'to':_0x5a5490[_0xa57c('0x2a')]['message']['to'],'cc':_0x5a5490['body'][_0xa57c('0x16')]['cc'],'subject':_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x16')][_0xa57c('0x4a')],'attach':_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x16')][_0xa57c('0x4b')],'Attachments':_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x16')]['attachments'],'originTo':_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x16')]['originTo'],'originCc':_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x16')][_0xa57c('0x59')],'bcc':_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x16')][_0xa57c('0x5a')],'ChatWebsiteId':_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x16')]['ChatWebsiteId']||null,'originChannel':_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x16')]['originChannel']||_0xa57c('0x5b'),'ChatOfflineMessageId':_0x5a5490[_0xa57c('0x2a')]['message']['ChatOfflineMessageId']||null},{'include':[{'model':db[_0xa57c('0x5c')],'as':_0xa57c('0x5d')}]});})[_0xa57c('0xe')](function(_0x1604d6){_0x5af5e9[_0xa57c('0x16')]=_0x1604d6;if(_0x5af5e9['interaction'][_0xa57c('0x5e')]){return db[_0xa57c('0x5f')][_0xa57c('0x26')]({'attributes':['id','name'],'where':{'id':_0x5af5e9[_0xa57c('0x56')]['UserId']}})[_0xa57c('0xe')](function(_0x2963cb){if(_0x2963cb){_0x5af5e9[_0xa57c('0x3f')][_0xa57c('0x60')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x2963cb[_0xa57c('0x61')]+','+(_0x5af5e9[_0xa57c('0x36')][_0xa57c('0x62')]||0xa),'interval':_0xa57c('0x46')});}return respondWithRpcPromise('Start',_0xa57c('0x63'),_0x5af5e9);});}return respondWithRpcPromise(_0xa57c('0x64'),_0xa57c('0x63'),_0x5af5e9);})['then'](function(_0x3da413){_0x5e10b(_0x3da413);})[_0xa57c('0x18')](function(_0x2ed4f4){_0x203375(_0x5ed42d['error'](0x1f4,_0x2ed4f4[_0xa57c('0x16')]));});});}; \ No newline at end of file +var _0x0295=['setDataValue','smtpOptions','getSmtpOptions','stringify','NotifyMailAccount','body','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','Contacts','DESC','MailApplication','Applications','MailServerOut','Smtp','CloudProvider','get','omit','applications','priority','asc','autoclose','close','*,*,*,*','length','contact','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','Messages','inReplyTo','MailInteraction','Contact\x20not\x20found','spread','update','created','create','attachments','originTo','originCc','bcc','originChannel','Email','ChatOfflineMessageId','Attachment','Attachments','interaction','UserId','User','name','agent','Start','startRouting','lodash','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./mailAccount.socket','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','error','message','catch','GetMailAccount','MailAccount','findAll','options','attributes','limit','include','model','map','debug','ShowMailAccount','find','where','smtp'];(function(_0x2dea58,_0x59d6f0){var _0x2b23c2=function(_0x3e5c44){while(--_0x3e5c44){_0x2dea58['push'](_0x2dea58['shift']());}};_0x2b23c2(++_0x59d6f0);}(_0x0295,0x1f0));var _0x5029=function(_0xc691d8,_0x69a50a){_0xc691d8=_0xc691d8-0x0;var _0x307e60=_0x0295[_0xc691d8];return _0x307e60;};'use strict';var _=require(_0x5029('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5029('0x1'));var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var logger=require(_0x5029('0x2'))(_0x5029('0x3'));var config=require(_0x5029('0x4'));var jayson=require(_0x5029('0x5'));var client=jayson[_0x5029('0x6')][_0x5029('0x7')]({'port':0x232c});config[_0x5029('0x8')]=_[_0x5029('0x9')](config[_0x5029('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x5029('0xa'))['register'](socket);function respondWithRpcPromise(_0x1532e9,_0x5bccfc,_0x14d4ef){return new BPromise(function(_0x520bc3,_0x222ddb){return client[_0x5029('0xb')](_0x1532e9,_0x14d4ef)[_0x5029('0xc')](function(_0x52fa95){logger[_0x5029('0xd')](_0x5029('0xe'),_0x5bccfc,_0x5029('0xf'));logger['debug'](_0x5029('0x10'),_0x5bccfc,_0x5029('0xf'),JSON['stringify'](_0x52fa95));if(_0x52fa95['error']){if(_0x52fa95['error']['code']===0x1f4){logger[_0x5029('0x11')](_0x5029('0xe'),_0x5bccfc,_0x52fa95[_0x5029('0x11')][_0x5029('0x12')]);return _0x222ddb(_0x52fa95[_0x5029('0x11')][_0x5029('0x12')]);}logger[_0x5029('0x11')](_0x5029('0xe'),_0x5bccfc,_0x52fa95[_0x5029('0x11')][_0x5029('0x12')]);return _0x520bc3(_0x52fa95[_0x5029('0x11')][_0x5029('0x12')]);}else{logger[_0x5029('0xd')](_0x5029('0xe'),_0x5bccfc,_0x5029('0xf'));_0x520bc3(_0x52fa95['result'][_0x5029('0x12')]);}})[_0x5029('0x13')](function(_0x35de81){logger[_0x5029('0x11')](_0x5029('0xe'),_0x5bccfc,_0x35de81);_0x222ddb(_0x35de81);});});}exports[_0x5029('0x14')]=function(_0xaba461){var _0x4adbb3=this;return new Promise(function(_0x226a5c,_0x5696b1){return db[_0x5029('0x15')][_0x5029('0x16')]({'raw':_0xaba461[_0x5029('0x17')]?_0xaba461[_0x5029('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0xaba461['options']?_0xaba461[_0x5029('0x17')]['where']||null:null,'attributes':_0xaba461[_0x5029('0x17')]?_0xaba461[_0x5029('0x17')][_0x5029('0x18')]||null:null,'limit':_0xaba461[_0x5029('0x17')]?_0xaba461[_0x5029('0x17')][_0x5029('0x19')]||null:null,'include':_0xaba461[_0x5029('0x17')]?_0xaba461[_0x5029('0x17')][_0x5029('0x1a')]?_['map'](_0xaba461['options']['include'],function(_0x588d90){return{'model':db[_0x588d90[_0x5029('0x1b')]],'as':_0x588d90['as'],'attributes':_0x588d90['attributes'],'include':_0x588d90['include']?_[_0x5029('0x1c')](_0x588d90[_0x5029('0x1a')],function(_0x36d810){return{'model':db[_0x36d810['model']],'as':_0x36d810['as'],'attributes':_0x36d810[_0x5029('0x18')],'include':_0x36d810[_0x5029('0x1a')]?_['map'](_0x36d810[_0x5029('0x1a')],function(_0x31f0a0){return{'model':db[_0x31f0a0[_0x5029('0x1b')]],'as':_0x31f0a0['as'],'attributes':_0x31f0a0['attributes']};}):[]};}):[]};}):[]:[]})[_0x5029('0xc')](function(_0x251f99){logger[_0x5029('0xd')]('GetMailAccount',_0xaba461);logger[_0x5029('0x1d')](_0x5029('0x14'),_0xaba461,JSON['stringify'](_0x251f99));_0x226a5c(_0x251f99);})[_0x5029('0x13')](function(_0x25032b){logger[_0x5029('0x11')](_0x5029('0x14'),_0x25032b[_0x5029('0x12')],_0xaba461);_0x5696b1(_0x4adbb3[_0x5029('0x11')](0x1f4,_0x25032b[_0x5029('0x12')]));});});};exports[_0x5029('0x1e')]=function(_0x250156){var _0x22559a=this;return new Promise(function(_0x358a2b,_0x4519c8){return db['MailAccount'][_0x5029('0x1f')]({'raw':_0x250156['options']?_0x250156[_0x5029('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x250156['options']?_0x250156[_0x5029('0x17')][_0x5029('0x20')]||null:null,'attributes':_0x250156[_0x5029('0x17')]?_0x250156['options'][_0x5029('0x18')]||null:null,'include':_0x250156[_0x5029('0x17')]?_0x250156[_0x5029('0x17')][_0x5029('0x1a')]?_[_0x5029('0x1c')](_0x250156[_0x5029('0x17')][_0x5029('0x1a')],function(_0x22205e){return{'model':db[_0x22205e[_0x5029('0x1b')]],'as':_0x22205e['as'],'attributes':_0x22205e['attributes'],'include':_0x22205e[_0x5029('0x1a')]?_[_0x5029('0x1c')](_0x22205e[_0x5029('0x1a')],function(_0x1b3817){return{'model':db[_0x1b3817['model']],'as':_0x1b3817['as'],'attributes':_0x1b3817[_0x5029('0x18')],'include':_0x1b3817[_0x5029('0x1a')]?_[_0x5029('0x1c')](_0x1b3817['include'],function(_0x4904cc){return{'model':db[_0x4904cc[_0x5029('0x1b')]],'as':_0x4904cc['as'],'attributes':_0x4904cc[_0x5029('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x57784c){if(_0x250156[_0x5029('0x17')][_0x5029('0x21')]===!![])_0x57784c[_0x5029('0x22')](_0x5029('0x23'),_0x57784c[_0x5029('0x24')]());logger[_0x5029('0xd')](_0x5029('0x1e'),_0x250156);logger[_0x5029('0x1d')](_0x5029('0x1e'),_0x250156,JSON[_0x5029('0x25')](_0x57784c));_0x358a2b(_0x57784c);})[_0x5029('0x13')](function(_0xbdb3fa){logger[_0x5029('0x11')](_0x5029('0x1e'),_0xbdb3fa['message'],_0x250156);_0x4519c8(_0x22559a['error'](0x1f4,_0xbdb3fa[_0x5029('0x12')]));});});};exports[_0x5029('0x26')]=function(_0x423ed1){var _0x48c9eb=this;return new Promise(function(_0x32d8a3,_0x39b216){var _0x52572a={'body':_0x423ed1[_0x5029('0x27')],'channel':'mail'};var _0x506f0d=_['difference'](_[_0x5029('0x28')](db[_0x5029('0x29')][_0x5029('0x2a')]),[_0x5029('0x2b'),_0x5029('0x2c'),_0x5029('0x2d'),_0x5029('0x2e')]);var _0x1021ea=![];if(_0x423ed1[_0x5029('0x27')]['id']){delete _0x423ed1['body']['id'];}if(_[_0x5029('0x2f')](_0x423ed1[_0x5029('0x27')][_0x5029('0x30')])){return _0x39b216(_0x48c9eb[_0x5029('0x11')](0x1f4,_0x5029('0x31')));}if(_[_0x5029('0x2f')](_0x423ed1['body'][_0x5029('0x27')])||_0x423ed1[_0x5029('0x27')][_0x5029('0x27')]===''){return _0x39b216(_0x48c9eb[_0x5029('0x11')](0x1f4,_0x5029('0x32')));}if(_['isNil'](_0x423ed1[_0x5029('0x27')][_0x5029('0x33')])){return _0x39b216(_0x48c9eb[_0x5029('0x11')](0x1f4,_0x5029('0x34')+_0x506f0d));}if(!_[_0x5029('0x35')](_0x506f0d,_0x423ed1[_0x5029('0x27')][_0x5029('0x33')])){return _0x39b216(_0x48c9eb[_0x5029('0x11')](0x1f4,_0x5029('0x36')+_0x506f0d));}var _0x51514e={};_0x51514e[_0x423ed1[_0x5029('0x27')][_0x5029('0x33')]]=_0x423ed1[_0x5029('0x27')][_0x5029('0x30')];return db['MailAccount']['find']({'where':{'id':_0x423ed1[_0x5029('0x37')]['id']},'include':[{'model':db[_0x5029('0x38')],'as':_0x5029('0x39'),'include':[{'model':db[_0x5029('0x29')],'as':_0x5029('0x3a'),'where':_0x51514e,'limit':0x1,'order':[[_0x5029('0x2c'),_0x5029('0x3b')]]}]},{'model':db[_0x5029('0x3c')],'as':_0x5029('0x3d')},{'model':db[_0x5029('0x3e')],'as':_0x5029('0x3f'),'include':[{'model':db[_0x5029('0x40')],'as':_0x5029('0x40')}]}]})[_0x5029('0xc')](function(_0x3168bd){if(_0x3168bd&&_0x3168bd[_0x5029('0x39')]){var _0x10fc07=_0x3168bd[_0x5029('0x41')]({'plain':!![]});_0x52572a[_0x5029('0x37')]=_[_0x5029('0x42')](_0x10fc07,[_0x5029('0x3d'),'List']);_0x52572a[_0x5029('0x37')]['smtpOptions']=_0x3168bd[_0x5029('0x24')]();_0x52572a[_0x5029('0x43')]=_0x10fc07['Applications'];_0x52572a['list']=_0x10fc07[_0x5029('0x39')];_0x52572a['applications']=_['orderBy'](_0x52572a[_0x5029('0x43')],[_0x5029('0x44')],[_0x5029('0x45')]);if(_0x52572a['account']&&_0x52572a['account'][_0x5029('0x46')]){_0x52572a[_0x5029('0x43')]['push']({'id':0x0,'priority':_0x52572a[_0x5029('0x43')]['length']+0x1,'app':_0x5029('0x47'),'appdata':'autoclose','interval':_0x5029('0x48')});}if(_0x52572a[_0x5029('0x37')][_0x5029('0x3d')]){delete _0x52572a[_0x5029('0x37')][_0x5029('0x3d')];}if(_0x52572a[_0x5029('0x37')][_0x5029('0x39')]){delete _0x52572a[_0x5029('0x37')]['List'];}if(_0x10fc07[_0x5029('0x39')]['Contacts'][_0x5029('0x49')]){return _0x10fc07[_0x5029('0x39')]['Contacts'][0x0];}var _0x2a2da5=_['defaults'](_0x423ed1['body'],{'firstName':_0x423ed1['body'][_0x5029('0x30')],'ListId':_0x10fc07['ListId']});_0x2a2da5[_0x423ed1[_0x5029('0x27')][_0x5029('0x33')]]=_0x423ed1[_0x5029('0x27')]['from'];return db[_0x5029('0x29')]['create'](_0x2a2da5);}else{throw new Error('List\x20not\x20found');}})[_0x5029('0xc')](function(_0x98abd1){_0x52572a[_0x5029('0x4a')]=_0x98abd1;if(_0x98abd1){if(!_0x423ed1[_0x5029('0x27')][_0x5029('0x12')]['messageId']){_0x423ed1[_0x5029('0x27')][_0x5029('0x12')][_0x5029('0x4b')]=rs[_0x5029('0x4c')]()+'\x20'+_0x423ed1['body'][_0x5029('0x12')][_0x5029('0x30')];}var _0x4d4a2d={'ContactId':_0x98abd1['id'],'MailAccountId':_0x423ed1['account']['id'],'inReplyTo':_0x423ed1[_0x5029('0x27')][_0x5029('0x12')][_0x5029('0x4b')],'to':_0x423ed1[_0x5029('0x27')]['message'][_0x5029('0x30')],'cc':_0x423ed1[_0x5029('0x27')][_0x5029('0x12')]['cc'],'subject':_0x423ed1[_0x5029('0x27')][_0x5029('0x12')][_0x5029('0x4d')],'attach':_0x423ed1['body']['message'][_0x5029('0x4e')],'lastMsgAt':moment()[_0x5029('0x4f')](_0x5029('0x50')),'lastMsgDirection':'in'};return db['MailInteraction'][_0x5029('0x1f')]({'where':{'closed':![],'MailAccountId':_0x423ed1[_0x5029('0x37')]['id']},'include':[{'model':db[_0x5029('0x51')],'as':_0x5029('0x52'),'attributes':[_0x5029('0x4b')],'where':{'messageId':_0x423ed1['body'][_0x5029('0x12')][_0x5029('0x53')]}}]})[_0x5029('0xc')](function(_0x5bf867){if(_0x5bf867){return[_0x5bf867,![]];}return db[_0x5029('0x54')]['create'](_0x4d4a2d)[_0x5029('0xc')](function(_0x4f2f0c){return[_0x4f2f0c,!![]];});});}else{throw new Error(_0x5029('0x55'));}})[_0x5029('0x56')](function(_0x2ad2e3,_0x2f5301){if(_0x2ad2e3){_0x1021ea=_0x2f5301;if(!_0x2f5301){return _0x2ad2e3[_0x5029('0x57')]({'inReplyTo':_0x423ed1[_0x5029('0x27')]['message'][_0x5029('0x4b')],'to':_0x423ed1[_0x5029('0x27')][_0x5029('0x12')][_0x5029('0x30')],'cc':_0x423ed1[_0x5029('0x27')]['message']['cc'],'subject':_0x423ed1[_0x5029('0x27')]['message'][_0x5029('0x4d')],'attach':_0x2ad2e3['attach']?_0x2ad2e3[_0x5029('0x4e')]:_0x423ed1['body'][_0x5029('0x12')]['attach'],'substatus':null,'substatusAt':moment()['format'](_0x5029('0x50')),'lastMsgAt':moment()['format'](_0x5029('0x50')),'lastMsgDirection':'in'});}else{return _0x2ad2e3;}}})[_0x5029('0xc')](function(_0x382994){_0x52572a['interaction']=_0x382994[_0x5029('0x41')]({'plain':!![]});_0x52572a['interaction'][_0x5029('0x58')]=_0x1021ea;return db[_0x5029('0x51')][_0x5029('0x59')]({'body':_0x423ed1[_0x5029('0x27')][_0x5029('0x27')],'MailAccountId':_0x423ed1['account']['id'],'MailInteractionId':_0x382994['id'],'direction':'in','ContactId':_0x52572a[_0x5029('0x4a')]['id'],'messageId':_0x423ed1[_0x5029('0x27')]['message'][_0x5029('0x4b')],'from':_0x423ed1[_0x5029('0x27')][_0x5029('0x12')][_0x5029('0x30')],'to':_0x423ed1[_0x5029('0x27')][_0x5029('0x12')]['to'],'cc':_0x423ed1['body']['message']['cc'],'subject':_0x423ed1[_0x5029('0x27')]['message'][_0x5029('0x4d')],'attach':_0x423ed1[_0x5029('0x27')]['message'][_0x5029('0x4e')],'Attachments':_0x423ed1['body']['message'][_0x5029('0x5a')],'originTo':_0x423ed1[_0x5029('0x27')][_0x5029('0x12')][_0x5029('0x5b')],'originCc':_0x423ed1['body'][_0x5029('0x12')][_0x5029('0x5c')],'bcc':_0x423ed1['body'][_0x5029('0x12')][_0x5029('0x5d')],'ChatWebsiteId':_0x423ed1['body']['message']['ChatWebsiteId']||null,'originChannel':_0x423ed1[_0x5029('0x27')][_0x5029('0x12')][_0x5029('0x5e')]||_0x5029('0x5f'),'ChatOfflineMessageId':_0x423ed1[_0x5029('0x27')][_0x5029('0x12')][_0x5029('0x60')]||null},{'include':[{'model':db[_0x5029('0x61')],'as':_0x5029('0x62')}]});})['then'](function(_0x4bf5cf){_0x52572a[_0x5029('0x12')]=_0x4bf5cf;if(_0x52572a[_0x5029('0x63')][_0x5029('0x64')]){return db[_0x5029('0x65')][_0x5029('0x1f')]({'attributes':['id',_0x5029('0x66')],'where':{'id':_0x52572a[_0x5029('0x63')]['UserId']}})[_0x5029('0xc')](function(_0x3a0d6f){if(_0x3a0d6f){_0x52572a[_0x5029('0x43')]['unshift']({'id':0x0,'priority':0x0,'app':_0x5029('0x67'),'appdata':_0x3a0d6f[_0x5029('0x66')]+','+(_0x52572a[_0x5029('0x37')]['waitForTheAssignedAgent']||0xa),'interval':_0x5029('0x48')});}return respondWithRpcPromise(_0x5029('0x68'),_0x5029('0x69'),_0x52572a);});}return respondWithRpcPromise('Start',_0x5029('0x69'),_0x52572a);})[_0x5029('0xc')](function(_0x5a35bc){_0x32d8a3(_0x5a35bc);})[_0x5029('0x13')](function(_0x42d795){_0x39b216(_0x48c9eb[_0x5029('0x11')](0x1f4,_0x42d795[_0x5029('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index f8f9c7d..08cc744 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 _0x1735=['length','mailAccount:','./mailAccount.events','save','remove','update','removeListener'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x1735,0xb1));var _0x5173=function(_0x2e80ba,_0xe3a9f8){_0x2e80ba=_0x2e80ba-0x0;var _0x13d283=_0x1735[_0x2e80ba];return _0x13d283;};'use strict';var MailAccountEvents=require(_0x5173('0x0'));var events=[_0x5173('0x1'),_0x5173('0x2'),_0x5173('0x3')];function createListener(_0x36d422,_0x551b10){return function(_0x1c26ec){_0x551b10['emit'](_0x36d422,_0x1c26ec);};}function removeListener(_0x4018f0,_0x58e756){return function(){MailAccountEvents[_0x5173('0x4')](_0x4018f0,_0x58e756);};}exports['register']=function(_0x42d5c2){for(var _0x276a71=0x0,_0x3493cf=events[_0x5173('0x5')];_0x276a71<_0x3493cf;_0x276a71++){var _0x1d36ae=events[_0x276a71];var _0x38452d=createListener(_0x5173('0x6')+_0x1d36ae,_0x42d5c2);MailAccountEvents['on'](_0x1d36ae,_0x38452d);}}; \ No newline at end of file +var _0x7e07=['./mailAccount.events','save','remove','update','emit','removeListener','register','length','mailAccount:'];(function(_0x456b57,_0x58691a){var _0x18f49f=function(_0x1dc195){while(--_0x1dc195){_0x456b57['push'](_0x456b57['shift']());}};_0x18f49f(++_0x58691a);}(_0x7e07,0xfc));var _0x77e0=function(_0x4db263,_0x1bb363){_0x4db263=_0x4db263-0x0;var _0x5574ef=_0x7e07[_0x4db263];return _0x5574ef;};'use strict';var MailAccountEvents=require(_0x77e0('0x0'));var events=[_0x77e0('0x1'),_0x77e0('0x2'),_0x77e0('0x3')];function createListener(_0x7e41fa,_0x57ee09){return function(_0x34ff81){_0x57ee09[_0x77e0('0x4')](_0x7e41fa,_0x34ff81);};}function removeListener(_0x371c77,_0x55b1a9){return function(){MailAccountEvents[_0x77e0('0x5')](_0x371c77,_0x55b1a9);};}exports[_0x77e0('0x6')]=function(_0x53ef23){for(var _0x394c1e=0x0,_0x22af63=events[_0x77e0('0x7')];_0x394c1e<_0x22af63;_0x394c1e++){var _0x42b39f=events[_0x394c1e];var _0x43d0e2=createListener(_0x77e0('0x8')+_0x42b39f,_0x53ef23);MailAccountEvents['on'](_0x42b39f,_0x43d0e2);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 19c3240..dbaa251 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 _0xa0e2=['exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','isAuthenticated','show','put','/:id','update','destroy'];(function(_0x238bc8,_0x1d140c){var _0x48a048=function(_0x518864){while(--_0x518864){_0x238bc8['push'](_0x238bc8['shift']());}};_0x48a048(++_0x1d140c);}(_0xa0e2,0x1f1));var _0x2a0e=function(_0x37437c,_0x55dacf){_0x37437c=_0x37437c-0x0;var _0x35e1a1=_0xa0e2[_0x37437c];return _0x35e1a1;};'use strict';var multer=require(_0x2a0e('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2a0e('0x1'));var express=require(_0x2a0e('0x2'));var router=express[_0x2a0e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x2a0e('0x4'));var interaction=require(_0x2a0e('0x5'));var config=require(_0x2a0e('0x6'));var controller=require(_0x2a0e('0x7'));router[_0x2a0e('0x8')]('/:id',auth[_0x2a0e('0x9')](),controller[_0x2a0e('0xa')]);router[_0x2a0e('0xb')](_0x2a0e('0xc'),auth['isAuthenticated'](),controller[_0x2a0e('0xd')]);router['delete'](_0x2a0e('0xc'),auth[_0x2a0e('0x9')](),controller[_0x2a0e('0xe')]);module[_0x2a0e('0xf')]=router; \ No newline at end of file +var _0xa2f6=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated','put','update','delete','multer','util','path'];(function(_0x35b378,_0x35674d){var _0x592edd=function(_0x342b42){while(--_0x342b42){_0x35b378['push'](_0x35b378['shift']());}};_0x592edd(++_0x35674d);}(_0xa2f6,0x174));var _0x6a2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa2f6[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x6a2f('0x0'));var util=require(_0x6a2f('0x1'));var path=require(_0x6a2f('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6a2f('0x3')]();var fs_extra=require(_0x6a2f('0x4'));var auth=require(_0x6a2f('0x5'));var interaction=require(_0x6a2f('0x6'));var config=require(_0x6a2f('0x7'));var controller=require(_0x6a2f('0x8'));router[_0x6a2f('0x9')](_0x6a2f('0xa'),auth[_0x6a2f('0xb')](),controller['show']);router[_0x6a2f('0xc')](_0x6a2f('0xa'),auth[_0x6a2f('0xb')](),controller[_0x6a2f('0xd')]);router[_0x6a2f('0xe')](_0x6a2f('0xa'),auth[_0x6a2f('0xb')](),controller['destroy']);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 b7f4bdc..115997a 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 _0x6d8d=['exports','INTEGER','noop','TEXT','STRING','*,*,*,*','sequelize'];(function(_0x7b5cdd,_0x8c88d8){var _0x3a29ae=function(_0x17859a){while(--_0x17859a){_0x7b5cdd['push'](_0x7b5cdd['shift']());}};_0x3a29ae(++_0x8c88d8);}(_0x6d8d,0x141));var _0xd6d8=function(_0x2c3b04,_0xe54550){_0x2c3b04=_0x2c3b04-0x0;var _0xfe9959=_0x6d8d[_0x2c3b04];return _0xfe9959;};'use strict';var Sequelize=require(_0xd6d8('0x0'));module[_0xd6d8('0x1')]={'priority':{'type':Sequelize[_0xd6d8('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xd6d8('0x3')},'appdata':{'type':Sequelize[_0xd6d8('0x4')]()},'description':{'type':Sequelize[_0xd6d8('0x5')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xd6d8('0x6')}}; \ No newline at end of file +var _0xbc7b=['STRING','exports','noop','TEXT'];(function(_0x2e9be1,_0x38ba22){var _0x17d943=function(_0x5ce45e){while(--_0x5ce45e){_0x2e9be1['push'](_0x2e9be1['shift']());}};_0x17d943(++_0x38ba22);}(_0xbc7b,0x1ed));var _0xbbc7=function(_0x244d9c,_0x374abd){_0x244d9c=_0x244d9c-0x0;var _0x1c12c8=_0xbc7b[_0x244d9c];return _0x1c12c8;};'use strict';var Sequelize=require('sequelize');module[_0xbbc7('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xbbc7('0x1')},'appdata':{'type':Sequelize[_0xbbc7('0x2')]()},'description':{'type':Sequelize[_0xbbc7('0x3')]},'interval':{'type':Sequelize[_0xbbc7('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 6a66cfe..04d1bd6 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 _0xf4eb=['limit','count','Content-Range','json','apply','reject','save','then','destroy','error','name','send','params','keys','MailApplication','rawAttributes','query','filters','intersection','model','fields','attributes','includeAll','include','options','find','catch','body','eml-format','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined'];(function(_0x3b560f,_0x23279a){var _0x138cde=function(_0x161b08){while(--_0x161b08){_0x3b560f['push'](_0x3b560f['shift']());}};_0x138cde(++_0x23279a);}(_0xf4eb,0xec));var _0xbf4e=function(_0x1caa98,_0x2a6c89){_0x1caa98=_0x1caa98-0x0;var _0x11cb56=_0xf4eb[_0x1caa98];return _0x11cb56;};'use strict';var emlformat=require(_0xbf4e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbf4e('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xbf4e('0x2'));var path=require(_0xbf4e('0x3'));var sox=require(_0xbf4e('0x4'));var csv=require(_0xbf4e('0x5'));var ejs=require(_0xbf4e('0x6'));var fs=require('fs');var fs_extra=require(_0xbf4e('0x7'));var _=require(_0xbf4e('0x8'));var squel=require('squel');var crypto=require(_0xbf4e('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbf4e('0x5'));var querystring=require(_0xbf4e('0xa'));var Papa=require(_0xbf4e('0xb'));var Redis=require(_0xbf4e('0xc'));var authService=require(_0xbf4e('0xd'));var qs=require(_0xbf4e('0xe'));var as=require(_0xbf4e('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbf4e('0x10'));var utils=require('../../config/utils');var config=require(_0xbf4e('0x11'));var licenseUtil=require(_0xbf4e('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17fd01,_0x5a3035){_0x5a3035=_0x5a3035||0xcc;return function(_0x56d185){if(_0x56d185){return _0x17fd01[_0xbf4e('0x13')](_0x5a3035);}return _0x17fd01[_0xbf4e('0x14')](_0x5a3035)[_0xbf4e('0x15')]();};}function respondWithResult(_0x302841,_0x3b74bd){_0x3b74bd=_0x3b74bd||0xc8;return function(_0x61bd54){if(_0x61bd54){return _0x302841['status'](_0x3b74bd)['json'](_0x61bd54);}};}function respondWithFilteredResult(_0x180432,_0x1735ae){return function(_0x28fc6b){if(_0x28fc6b){var _0x542909=typeof _0x1735ae[_0xbf4e('0x16')]===_0xbf4e('0x17')&&typeof _0x1735ae[_0xbf4e('0x18')]===_0xbf4e('0x17');var _0x5a631e=_0x28fc6b[_0xbf4e('0x19')];var _0x577c27=_0x542909?0x0:_0x1735ae['offset'];var _0x566ec3=_0x542909?_0x28fc6b['count']:_0x1735ae[_0xbf4e('0x16')]+_0x1735ae[_0xbf4e('0x18')];var _0x1fc800;if(_0x566ec3>=_0x5a631e){_0x566ec3=_0x5a631e;_0x1fc800=0xc8;}else{_0x1fc800=0xce;}_0x180432['status'](_0x1fc800);return _0x180432['set'](_0xbf4e('0x1a'),_0x577c27+'-'+_0x566ec3+'/'+_0x5a631e)[_0xbf4e('0x1b')](_0x28fc6b);}return null;};}function patchUpdates(_0x3be138){return function(_0x3a875b){try{jsonpatch[_0xbf4e('0x1c')](_0x3a875b,_0x3be138,!![]);}catch(_0x1e2a68){return BPromise[_0xbf4e('0x1d')](_0x1e2a68);}return _0x3a875b[_0xbf4e('0x1e')]();};}function saveUpdates(_0xd09e12,_0x376832){return function(_0x30539b){if(_0x30539b){return _0x30539b['update'](_0xd09e12)[_0xbf4e('0x1f')](function(_0x2e7673){return _0x2e7673;});}return null;};}function removeEntity(_0x51648c,_0x31e3f5){return function(_0x30994d){if(_0x30994d){return _0x30994d[_0xbf4e('0x20')]()[_0xbf4e('0x1f')](function(){_0x51648c[_0xbf4e('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x90635e,_0x36688a){return function(_0x3d6863){if(!_0x3d6863){_0x90635e['sendStatus'](0x194);}return _0x3d6863;};}function handleError(_0x2fb490,_0x5e08b1){_0x5e08b1=_0x5e08b1||0x1f4;return function(_0x5bcf71){logger[_0xbf4e('0x21')](_0x5bcf71['stack']);if(_0x5bcf71[_0xbf4e('0x22')]){delete _0x5bcf71[_0xbf4e('0x22')];}_0x2fb490[_0xbf4e('0x14')](_0x5e08b1)[_0xbf4e('0x23')](_0x5bcf71);};}exports['show']=function(_0x2d4686,_0x8e0ab5){var _0x43879d={'raw':!![],'where':{'id':_0x2d4686[_0xbf4e('0x24')]['id']}},_0x4cd4a1={};_0x4cd4a1['model']=_[_0xbf4e('0x25')](db[_0xbf4e('0x26')][_0xbf4e('0x27')]);_0x4cd4a1['query']=_[_0xbf4e('0x25')](_0x2d4686[_0xbf4e('0x28')]);_0x4cd4a1[_0xbf4e('0x29')]=_[_0xbf4e('0x2a')](_0x4cd4a1[_0xbf4e('0x2b')],_0x4cd4a1[_0xbf4e('0x28')]);_0x43879d['attributes']=_[_0xbf4e('0x2a')](_0x4cd4a1[_0xbf4e('0x2b')],qs['fields'](_0x2d4686[_0xbf4e('0x28')][_0xbf4e('0x2c')]));_0x43879d['attributes']=_0x43879d[_0xbf4e('0x2d')]['length']?_0x43879d[_0xbf4e('0x2d')]:_0x4cd4a1['model'];if(_0x2d4686[_0xbf4e('0x28')][_0xbf4e('0x2e')]){_0x43879d[_0xbf4e('0x2f')]=[{'all':!![]}];}_0x43879d=_['merge']({},_0x43879d,_0x2d4686[_0xbf4e('0x30')]);return db[_0xbf4e('0x26')][_0xbf4e('0x31')](_0x43879d)[_0xbf4e('0x1f')](handleEntityNotFound(_0x8e0ab5,null))[_0xbf4e('0x1f')](respondWithResult(_0x8e0ab5,null))[_0xbf4e('0x32')](handleError(_0x8e0ab5,null));};exports['update']=function(_0x99b320,_0x3dbb2b){if(_0x99b320[_0xbf4e('0x33')]['id']){delete _0x99b320[_0xbf4e('0x33')]['id'];}return db[_0xbf4e('0x26')]['find']({'where':{'id':_0x99b320['params']['id']}})['then'](handleEntityNotFound(_0x3dbb2b,null))['then'](saveUpdates(_0x99b320[_0xbf4e('0x33')],null))[_0xbf4e('0x1f')](respondWithResult(_0x3dbb2b,null))[_0xbf4e('0x32')](handleError(_0x3dbb2b,null));};exports[_0xbf4e('0x20')]=function(_0x22ddde,_0x257b74){return db[_0xbf4e('0x26')][_0xbf4e('0x31')]({'where':{'id':_0x22ddde[_0xbf4e('0x24')]['id']}})['then'](handleEntityNotFound(_0x257b74,null))['then'](removeEntity(_0x257b74,null))[_0xbf4e('0x32')](handleError(_0x257b74,null));}; \ No newline at end of file +var _0xf4eb=['limit','count','Content-Range','json','apply','reject','save','then','destroy','error','name','send','params','keys','MailApplication','rawAttributes','query','filters','intersection','model','fields','attributes','includeAll','include','options','find','catch','body','eml-format','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined'];(function(_0x1cf719,_0x165907){var _0x14df67=function(_0x1ca762){while(--_0x1ca762){_0x1cf719['push'](_0x1cf719['shift']());}};_0x14df67(++_0x165907);}(_0xf4eb,0xec));var _0xbf4e=function(_0x3f8410,_0x5e9d1d){_0x3f8410=_0x3f8410-0x0;var _0x3165e2=_0xf4eb[_0x3f8410];return _0x3165e2;};'use strict';var emlformat=require(_0xbf4e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbf4e('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xbf4e('0x2'));var path=require(_0xbf4e('0x3'));var sox=require(_0xbf4e('0x4'));var csv=require(_0xbf4e('0x5'));var ejs=require(_0xbf4e('0x6'));var fs=require('fs');var fs_extra=require(_0xbf4e('0x7'));var _=require(_0xbf4e('0x8'));var squel=require('squel');var crypto=require(_0xbf4e('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbf4e('0x5'));var querystring=require(_0xbf4e('0xa'));var Papa=require(_0xbf4e('0xb'));var Redis=require(_0xbf4e('0xc'));var authService=require(_0xbf4e('0xd'));var qs=require(_0xbf4e('0xe'));var as=require(_0xbf4e('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbf4e('0x10'));var utils=require('../../config/utils');var config=require(_0xbf4e('0x11'));var licenseUtil=require(_0xbf4e('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17fd01,_0x5a3035){_0x5a3035=_0x5a3035||0xcc;return function(_0x56d185){if(_0x56d185){return _0x17fd01[_0xbf4e('0x13')](_0x5a3035);}return _0x17fd01[_0xbf4e('0x14')](_0x5a3035)[_0xbf4e('0x15')]();};}function respondWithResult(_0x302841,_0x3b74bd){_0x3b74bd=_0x3b74bd||0xc8;return function(_0x61bd54){if(_0x61bd54){return _0x302841['status'](_0x3b74bd)['json'](_0x61bd54);}};}function respondWithFilteredResult(_0x180432,_0x1735ae){return function(_0x28fc6b){if(_0x28fc6b){var _0x542909=typeof _0x1735ae[_0xbf4e('0x16')]===_0xbf4e('0x17')&&typeof _0x1735ae[_0xbf4e('0x18')]===_0xbf4e('0x17');var _0x5a631e=_0x28fc6b[_0xbf4e('0x19')];var _0x577c27=_0x542909?0x0:_0x1735ae['offset'];var _0x566ec3=_0x542909?_0x28fc6b['count']:_0x1735ae[_0xbf4e('0x16')]+_0x1735ae[_0xbf4e('0x18')];var _0x1fc800;if(_0x566ec3>=_0x5a631e){_0x566ec3=_0x5a631e;_0x1fc800=0xc8;}else{_0x1fc800=0xce;}_0x180432['status'](_0x1fc800);return _0x180432['set'](_0xbf4e('0x1a'),_0x577c27+'-'+_0x566ec3+'/'+_0x5a631e)[_0xbf4e('0x1b')](_0x28fc6b);}return null;};}function patchUpdates(_0x3be138){return function(_0x3a875b){try{jsonpatch[_0xbf4e('0x1c')](_0x3a875b,_0x3be138,!![]);}catch(_0x1e2a68){return BPromise[_0xbf4e('0x1d')](_0x1e2a68);}return _0x3a875b[_0xbf4e('0x1e')]();};}function saveUpdates(_0xd09e12,_0x376832){return function(_0x30539b){if(_0x30539b){return _0x30539b['update'](_0xd09e12)[_0xbf4e('0x1f')](function(_0x2e7673){return _0x2e7673;});}return null;};}function removeEntity(_0x51648c,_0x31e3f5){return function(_0x30994d){if(_0x30994d){return _0x30994d[_0xbf4e('0x20')]()[_0xbf4e('0x1f')](function(){_0x51648c[_0xbf4e('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x90635e,_0x36688a){return function(_0x3d6863){if(!_0x3d6863){_0x90635e['sendStatus'](0x194);}return _0x3d6863;};}function handleError(_0x2fb490,_0x5e08b1){_0x5e08b1=_0x5e08b1||0x1f4;return function(_0x5bcf71){logger[_0xbf4e('0x21')](_0x5bcf71['stack']);if(_0x5bcf71[_0xbf4e('0x22')]){delete _0x5bcf71[_0xbf4e('0x22')];}_0x2fb490[_0xbf4e('0x14')](_0x5e08b1)[_0xbf4e('0x23')](_0x5bcf71);};}exports['show']=function(_0x2d4686,_0x8e0ab5){var _0x43879d={'raw':!![],'where':{'id':_0x2d4686[_0xbf4e('0x24')]['id']}},_0x4cd4a1={};_0x4cd4a1['model']=_[_0xbf4e('0x25')](db[_0xbf4e('0x26')][_0xbf4e('0x27')]);_0x4cd4a1['query']=_[_0xbf4e('0x25')](_0x2d4686[_0xbf4e('0x28')]);_0x4cd4a1[_0xbf4e('0x29')]=_[_0xbf4e('0x2a')](_0x4cd4a1[_0xbf4e('0x2b')],_0x4cd4a1[_0xbf4e('0x28')]);_0x43879d['attributes']=_[_0xbf4e('0x2a')](_0x4cd4a1[_0xbf4e('0x2b')],qs['fields'](_0x2d4686[_0xbf4e('0x28')][_0xbf4e('0x2c')]));_0x43879d['attributes']=_0x43879d[_0xbf4e('0x2d')]['length']?_0x43879d[_0xbf4e('0x2d')]:_0x4cd4a1['model'];if(_0x2d4686[_0xbf4e('0x28')][_0xbf4e('0x2e')]){_0x43879d[_0xbf4e('0x2f')]=[{'all':!![]}];}_0x43879d=_['merge']({},_0x43879d,_0x2d4686[_0xbf4e('0x30')]);return db[_0xbf4e('0x26')][_0xbf4e('0x31')](_0x43879d)[_0xbf4e('0x1f')](handleEntityNotFound(_0x8e0ab5,null))[_0xbf4e('0x1f')](respondWithResult(_0x8e0ab5,null))[_0xbf4e('0x32')](handleError(_0x8e0ab5,null));};exports['update']=function(_0x99b320,_0x3dbb2b){if(_0x99b320[_0xbf4e('0x33')]['id']){delete _0x99b320[_0xbf4e('0x33')]['id'];}return db[_0xbf4e('0x26')]['find']({'where':{'id':_0x99b320['params']['id']}})['then'](handleEntityNotFound(_0x3dbb2b,null))['then'](saveUpdates(_0x99b320[_0xbf4e('0x33')],null))[_0xbf4e('0x1f')](respondWithResult(_0x3dbb2b,null))[_0xbf4e('0x32')](handleError(_0x3dbb2b,null));};exports[_0xbf4e('0x20')]=function(_0x22ddde,_0x257b74){return db[_0xbf4e('0x26')][_0xbf4e('0x31')]({'where':{'id':_0x22ddde[_0xbf4e('0x24')]['id']}})['then'](handleEntityNotFound(_0x257b74,null))['then'](removeEntity(_0x257b74,null))[_0xbf4e('0x32')](handleError(_0x257b74,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 49d1783..82445bc 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 _0xff82=['util','../../config/logger','bluebird','request-promise','../../config/environment','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x2d6598,_0x5dde5f){var _0x3413f6=function(_0x3d591b){while(--_0x3d591b){_0x2d6598['push'](_0x2d6598['shift']());}};_0x3413f6(++_0x5dde5f);}(_0xff82,0x167));var _0x2ff8=function(_0x3b41cd,_0x37eaf3){_0x3b41cd=_0x3b41cd-0x0;var _0x22bc33=_0xff82[_0x3b41cd];return _0x22bc33;};'use strict';var _=require(_0x2ff8('0x0'));var util=require(_0x2ff8('0x1'));var logger=require(_0x2ff8('0x2'))('api');var moment=require('moment');var BPromise=require(_0x2ff8('0x3'));var rp=require(_0x2ff8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2ff8('0x5'));var attributes=require('./mailApplication.attributes');module['exports']=function(_0x25f32f,_0x4e86c1){return _0x25f32f['define'](_0x2ff8('0x6'),attributes,{'tableName':_0x2ff8('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2ff8('0x8'),'collate':_0x2ff8('0x9')});}; \ No newline at end of file +var _0x3312=['MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailApplication.attributes','define'];(function(_0x4ebcd6,_0x29d13c){var _0x27b952=function(_0x5a0dfe){while(--_0x5a0dfe){_0x4ebcd6['push'](_0x4ebcd6['shift']());}};_0x27b952(++_0x29d13c);}(_0x3312,0x162));var _0x2331=function(_0x3b832c,_0x19357b){_0x3b832c=_0x3b832c-0x0;var _0x20dec0=_0x3312[_0x3b832c];return _0x20dec0;};'use strict';var _=require('lodash');var util=require(_0x2331('0x0'));var logger=require('../../config/logger')(_0x2331('0x1'));var moment=require(_0x2331('0x2'));var BPromise=require(_0x2331('0x3'));var rp=require(_0x2331('0x4'));var fs=require('fs');var path=require(_0x2331('0x5'));var rimraf=require(_0x2331('0x6'));var config=require(_0x2331('0x7'));var attributes=require(_0x2331('0x8'));module['exports']=function(_0xa4d4ad,_0x19f309){return _0xa4d4ad[_0x2331('0x9')](_0x2331('0xa'),attributes,{'tableName':_0x2331('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2331('0xc'),'collate':_0x2331('0xd')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 6832008..652e554 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 _0xfa9c=['body','options','raw','where','attributes','then','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','info','MailApplication,\x20%s,\x20%s','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','UpdateMailApplication','MailApplication'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xfa9c,0xae));var _0xcfa9=function(_0x4d3431,_0x1cd175){_0x4d3431=_0x4d3431-0x0;var _0x2d666d=_0xfa9c[_0x4d3431];return _0x2d666d;};'use strict';var _=require('lodash');var util=require(_0xcfa9('0x0'));var moment=require(_0xcfa9('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcfa9('0x2'));var db=require(_0xcfa9('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xcfa9('0x4'))(_0xcfa9('0x5'));var config=require(_0xcfa9('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xcfa9('0x7')][_0xcfa9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xac433,_0x2becbe,_0x1e6f4a){return new BPromise(function(_0xb8890e,_0x39a821){return client[_0xcfa9('0x9')](_0xac433,_0x1e6f4a)['then'](function(_0x4cf91b){logger[_0xcfa9('0xa')](_0xcfa9('0xb'),_0x2becbe,'request\x20sent');logger[_0xcfa9('0xc')](_0xcfa9('0xd'),_0x2becbe,'request\x20sent',JSON[_0xcfa9('0xe')](_0x4cf91b));if(_0x4cf91b['error']){if(_0x4cf91b[_0xcfa9('0xf')][_0xcfa9('0x10')]===0x1f4){logger[_0xcfa9('0xf')](_0xcfa9('0xb'),_0x2becbe,_0x4cf91b[_0xcfa9('0xf')]['message']);return _0x39a821(_0x4cf91b[_0xcfa9('0xf')][_0xcfa9('0x11')]);}logger[_0xcfa9('0xf')]('MailApplication,\x20%s,\x20%s',_0x2becbe,_0x4cf91b[_0xcfa9('0xf')][_0xcfa9('0x11')]);return _0xb8890e(_0x4cf91b['error'][_0xcfa9('0x11')]);}else{logger[_0xcfa9('0xa')](_0xcfa9('0xb'),_0x2becbe,_0xcfa9('0x12'));_0xb8890e(_0x4cf91b['result'][_0xcfa9('0x11')]);}})[_0xcfa9('0x13')](function(_0x5658dd){logger[_0xcfa9('0xf')](_0xcfa9('0xb'),_0x2becbe,_0x5658dd);_0x39a821(_0x5658dd);});});}exports[_0xcfa9('0x14')]=function(_0x36b3e5){var _0x148833=this;return new Promise(function(_0x4fd95a,_0x4eff69){return db[_0xcfa9('0x15')]['update'](_0x36b3e5[_0xcfa9('0x16')],{'raw':_0x36b3e5[_0xcfa9('0x17')]?_0x36b3e5['options'][_0xcfa9('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x36b3e5['options']?_0x36b3e5[_0xcfa9('0x17')][_0xcfa9('0x19')]||null:null,'attributes':_0x36b3e5['options']?_0x36b3e5[_0xcfa9('0x17')][_0xcfa9('0x1a')]||null:null,'limit':_0x36b3e5[_0xcfa9('0x17')]?_0x36b3e5[_0xcfa9('0x17')]['limit']||null:null})[_0xcfa9('0x1b')](function(_0x56c2a7){logger[_0xcfa9('0xa')]('UpdateMailApplication',_0x36b3e5);logger[_0xcfa9('0xc')](_0xcfa9('0x14'),_0x36b3e5,JSON['stringify'](_0x56c2a7));_0x4fd95a(_0x56c2a7);})[_0xcfa9('0x13')](function(_0x1849d6){logger[_0xcfa9('0xf')](_0xcfa9('0x14'),_0x1849d6[_0xcfa9('0x11')],_0x36b3e5);_0x4eff69(_0x148833[_0xcfa9('0xf')](0x1f4,_0x1849d6[_0xcfa9('0x11')]));});});}; \ No newline at end of file +var _0x5dcd=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','request','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','error','message','result','catch','UpdateMailApplication','MailApplication','update','options','raw','attributes','limit','lodash','util'];(function(_0x132926,_0x1b2010){var _0x24f710=function(_0x12fdfa){while(--_0x12fdfa){_0x132926['push'](_0x132926['shift']());}};_0x24f710(++_0x1b2010);}(_0x5dcd,0xbb));var _0xd5dc=function(_0x3e6cfb,_0x452880){_0x3e6cfb=_0x3e6cfb-0x0;var _0x72a2cd=_0x5dcd[_0x3e6cfb];return _0x72a2cd;};'use strict';var _=require(_0xd5dc('0x0'));var util=require(_0xd5dc('0x1'));var moment=require(_0xd5dc('0x2'));var BPromise=require(_0xd5dc('0x3'));var rs=require(_0xd5dc('0x4'));var fs=require('fs');var Redis=require(_0xd5dc('0x5'));var db=require(_0xd5dc('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xd5dc('0x7'));var jayson=require(_0xd5dc('0x8'));var client=jayson[_0xd5dc('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x37a458,_0x3ff3fa,_0x381386){return new BPromise(function(_0x1ff327,_0x242c31){return client[_0xd5dc('0xa')](_0x37a458,_0x381386)['then'](function(_0x450b1c){logger[_0xd5dc('0xb')](_0xd5dc('0xc'),_0x3ff3fa,_0xd5dc('0xd'));logger[_0xd5dc('0xe')](_0xd5dc('0xf'),_0x3ff3fa,_0xd5dc('0xd'),JSON['stringify'](_0x450b1c));if(_0x450b1c[_0xd5dc('0x10')]){if(_0x450b1c[_0xd5dc('0x10')]['code']===0x1f4){logger['error'](_0xd5dc('0xc'),_0x3ff3fa,_0x450b1c['error'][_0xd5dc('0x11')]);return _0x242c31(_0x450b1c[_0xd5dc('0x10')][_0xd5dc('0x11')]);}logger[_0xd5dc('0x10')]('MailApplication,\x20%s,\x20%s',_0x3ff3fa,_0x450b1c[_0xd5dc('0x10')][_0xd5dc('0x11')]);return _0x1ff327(_0x450b1c[_0xd5dc('0x10')][_0xd5dc('0x11')]);}else{logger[_0xd5dc('0xb')]('MailApplication,\x20%s,\x20%s',_0x3ff3fa,_0xd5dc('0xd'));_0x1ff327(_0x450b1c[_0xd5dc('0x12')][_0xd5dc('0x11')]);}})[_0xd5dc('0x13')](function(_0x42c58e){logger[_0xd5dc('0x10')](_0xd5dc('0xc'),_0x3ff3fa,_0x42c58e);_0x242c31(_0x42c58e);});});}exports[_0xd5dc('0x14')]=function(_0xdd4dcf){var _0x302d1e=this;return new Promise(function(_0x58a1e5,_0x88ad1a){return db[_0xd5dc('0x15')][_0xd5dc('0x16')](_0xdd4dcf['body'],{'raw':_0xdd4dcf[_0xd5dc('0x17')]?_0xdd4dcf['options'][_0xd5dc('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xdd4dcf['options']?_0xdd4dcf[_0xd5dc('0x17')]['where']||null:null,'attributes':_0xdd4dcf['options']?_0xdd4dcf[_0xd5dc('0x17')][_0xd5dc('0x19')]||null:null,'limit':_0xdd4dcf[_0xd5dc('0x17')]?_0xdd4dcf['options'][_0xd5dc('0x1a')]||null:null})['then'](function(_0xe9733a){logger[_0xd5dc('0xb')](_0xd5dc('0x14'),_0xdd4dcf);logger[_0xd5dc('0xe')](_0xd5dc('0x14'),_0xdd4dcf,JSON['stringify'](_0xe9733a));_0x58a1e5(_0xe9733a);})[_0xd5dc('0x13')](function(_0x519171){logger[_0xd5dc('0x10')](_0xd5dc('0x14'),_0x519171[_0xd5dc('0x11')],_0xdd4dcf);_0x88ad1a(_0x302d1e[_0xd5dc('0x10')](0x1f4,_0x519171[_0xd5dc('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 35a321d..051c512 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 _0x0c3d=['show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','mail','mailinteraction:addtags','addTags','put','mailinteraction:update','update','delete','mailinteraction:destroy','destroy','removeTags','exports','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','index','describe','/:id'];(function(_0x1c88f9,_0x211646){var _0x1779f7=function(_0x1dc48e){while(--_0x1dc48e){_0x1c88f9['push'](_0x1c88f9['shift']());}};_0x1779f7(++_0x211646);}(_0x0c3d,0x1a9));var _0xd0c3=function(_0x42e8f3,_0x5c8dba){_0x42e8f3=_0x42e8f3-0x0;var _0x47feab=_0x0c3d[_0x42e8f3];return _0x47feab;};'use strict';var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xd0c3('0x0'));var controller=require(_0xd0c3('0x1'));router[_0xd0c3('0x2')]('/',auth[_0xd0c3('0x3')](),controller[_0xd0c3('0x4')]);router[_0xd0c3('0x2')]('/describe',auth['isAuthenticated'](),controller[_0xd0c3('0x5')]);router[_0xd0c3('0x2')](_0xd0c3('0x6'),auth['isAuthenticated'](),controller[_0xd0c3('0x7')]);router[_0xd0c3('0x2')](_0xd0c3('0x8'),auth[_0xd0c3('0x3')](),controller[_0xd0c3('0x9')]);router['get'](_0xd0c3('0xa'),auth[_0xd0c3('0x3')](),controller[_0xd0c3('0xb')]);router[_0xd0c3('0xc')]('/',auth[_0xd0c3('0x3')](),controller[_0xd0c3('0xd')]);router[_0xd0c3('0xc')]('/:id/messages',auth[_0xd0c3('0x3')](),controller[_0xd0c3('0xe')]);router['post'](_0xd0c3('0xf'),auth['isAuthenticated'](),interaction['tracked'](_0xd0c3('0x10'),_0xd0c3('0x11')),controller[_0xd0c3('0x12')]);router[_0xd0c3('0x13')](_0xd0c3('0x6'),auth['isAuthenticated'](),interaction['tracked'](_0xd0c3('0x10'),_0xd0c3('0x14')),controller[_0xd0c3('0x15')]);router[_0xd0c3('0x16')](_0xd0c3('0x6'),auth[_0xd0c3('0x3')](),interaction['tracked'](_0xd0c3('0x10'),_0xd0c3('0x17')),controller[_0xd0c3('0x18')]);router[_0xd0c3('0x16')](_0xd0c3('0xf'),auth[_0xd0c3('0x3')](),controller[_0xd0c3('0x19')]);module[_0xd0c3('0x1a')]=router; \ No newline at end of file +var _0x45b1=['create','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags','addTags','put','update','delete','mailinteraction:destroy','destroy','removeTags','exports','express','Router','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMessages','/:id/download','download','post'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x45b1,0x16a));var _0x145b=function(_0x43c8d0,_0x5ebc0e){_0x43c8d0=_0x43c8d0-0x0;var _0x4c4946=_0x45b1[_0x43c8d0];return _0x4c4946;};'use strict';var express=require(_0x145b('0x0'));var router=express[_0x145b('0x1')]();var auth=require('../../components/auth/service');var interaction=require(_0x145b('0x2'));var controller=require(_0x145b('0x3'));router[_0x145b('0x4')]('/',auth[_0x145b('0x5')](),controller[_0x145b('0x6')]);router[_0x145b('0x4')](_0x145b('0x7'),auth[_0x145b('0x5')](),controller[_0x145b('0x8')]);router[_0x145b('0x4')](_0x145b('0x9'),auth['isAuthenticated'](),controller[_0x145b('0xa')]);router[_0x145b('0x4')]('/:id/messages',auth[_0x145b('0x5')](),controller[_0x145b('0xb')]);router['get'](_0x145b('0xc'),auth['isAuthenticated'](),controller[_0x145b('0xd')]);router[_0x145b('0xe')]('/',auth[_0x145b('0x5')](),controller[_0x145b('0xf')]);router[_0x145b('0xe')]('/:id/messages',auth['isAuthenticated'](),controller[_0x145b('0x10')]);router[_0x145b('0xe')](_0x145b('0x11'),auth[_0x145b('0x5')](),interaction[_0x145b('0x12')](_0x145b('0x13'),_0x145b('0x14')),controller[_0x145b('0x15')]);router[_0x145b('0x16')](_0x145b('0x9'),auth[_0x145b('0x5')](),interaction[_0x145b('0x12')](_0x145b('0x13'),'mailinteraction:update'),controller[_0x145b('0x17')]);router[_0x145b('0x18')](_0x145b('0x9'),auth[_0x145b('0x5')](),interaction[_0x145b('0x12')](_0x145b('0x13'),_0x145b('0x19')),controller[_0x145b('0x1a')]);router[_0x145b('0x18')](_0x145b('0x11'),auth[_0x145b('0x5')](),controller[_0x145b('0x1b')]);module[_0x145b('0x1c')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 705806e..628ee9e 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 _0x8758=['out','sequelize','iconv','exports','DATE','STRING','TEXT','long','BOOLEAN','ENUM'];(function(_0x4854d6,_0x2f1264){var _0x3885c0=function(_0x4d564d){while(--_0x4d564d){_0x4854d6['push'](_0x4854d6['shift']());}};_0x3885c0(++_0x2f1264);}(_0x8758,0x19b));var _0x8875=function(_0x4e0433,_0x562f71){_0x4e0433=_0x4e0433-0x0;var _0x42738b=_0x8758[_0x4e0433];return _0x42738b;};'use strict';var Sequelize=require(_0x8875('0x0'));var iconv=require(_0x8875('0x1'));module[_0x8875('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x8875('0x3')]},'disposition':{'type':Sequelize[_0x8875('0x4')]},'secondDisposition':{'type':Sequelize[_0x8875('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x8875('0x4')]},'inReplyTo':{'type':Sequelize[_0x8875('0x4')](0x1fe)},'to':{'type':Sequelize[_0x8875('0x4')]},'cc':{'type':Sequelize[_0x8875('0x5')](_0x8875('0x6'))},'subject':{'type':Sequelize[_0x8875('0x5')]()},'attach':{'type':Sequelize[_0x8875('0x7')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x8875('0x3')]},'substatus':{'type':Sequelize[_0x8875('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0x8875('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x8875('0x8')]('in',_0x8875('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x8875('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x8875('0x8')]('in',_0x8875('0x9')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x388e=['TEXT','ENUM','out','sequelize','iconv','exports','BOOLEAN','DATE','STRING'];(function(_0x18b34d,_0x1bd683){var _0x4ec0f3=function(_0x5cef8c){while(--_0x5cef8c){_0x18b34d['push'](_0x18b34d['shift']());}};_0x4ec0f3(++_0x1bd683);}(_0x388e,0x17d));var _0xe388=function(_0x2c9a33,_0xa46b2a){_0x2c9a33=_0x2c9a33-0x0;var _0xe66f8b=_0x388e[_0x2c9a33];return _0xe66f8b;};'use strict';var Sequelize=require(_0xe388('0x0'));var iconv=require(_0xe388('0x1'));module[_0xe388('0x2')]={'closed':{'type':Sequelize[_0xe388('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xe388('0x4')]},'disposition':{'type':Sequelize[_0xe388('0x5')]},'secondDisposition':{'type':Sequelize[_0xe388('0x5')]},'thirdDisposition':{'type':Sequelize[_0xe388('0x5')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize[_0xe388('0x5')]},'cc':{'type':Sequelize[_0xe388('0x6')]('long')},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0xe388('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xe388('0x4')]},'substatus':{'type':Sequelize[_0xe388('0x5')](0x3c)},'substatusAt':{'type':Sequelize[_0xe388('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xe388('0x7')]('in',_0xe388('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xe388('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xe388('0x7')]('in',_0xe388('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xe388('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index d3ed260..22e360f 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 _0x62e2=['mkdirSync','each','missing.recipient@your.company.com','headers','existsSync','readFileSync','writeFileSync','unlinkSync','eml-format','rimraf','zip-dir','bluebird','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','update','then','destroy','name','send','index','map','rawAttributes','fieldName','type','getOptions','mail','query','params','keys','intersection','model','fields','attributes','length','includeAll','merge','options','MailInteraction','catch','create','body','find','describe','addMessage','MailMessage','ids','omit','getMessages','findOne','filters','hasOwnProperty','nolimit','sort','where','pick','MailInteractionId','filter','$gte','format','include','inlineCss','true','rows','addTags','spread','Tag','color','emit','mailInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','push','Attachment','Attachments','Messages','from','bcc','subject','createdAt','get'];(function(_0x3cb30b,_0x504b3e){var _0x2ca717=function(_0x32a3d9){while(--_0x32a3d9){_0x3cb30b['push'](_0x3cb30b['shift']());}};_0x2ca717(++_0x504b3e);}(_0x62e2,0x158));var _0x262e=function(_0x271a4c,_0x2fbf19){_0x271a4c=_0x271a4c-0x0;var _0xd700b5=_0x62e2[_0x271a4c];return _0xd700b5;};'use strict';var emlformat=require(_0x262e('0x0'));var rimraf=require(_0x262e('0x1'));var zipdir=require(_0x262e('0x2'));var moment=require('moment');var BPromise=require(_0x262e('0x3'));var util=require(_0x262e('0x4'));var path=require(_0x262e('0x5'));var fs=require('fs');var _=require(_0x262e('0x6'));var juice=require('juice');var Redis=require(_0x262e('0x7'));var interaction=require(_0x262e('0x8'));var qs=require(_0x262e('0x9'));var logger=require(_0x262e('0xa'))(_0x262e('0xb'));var config=require('../../config/environment');var db=require(_0x262e('0xc'))['db'];var htmlEntities=require('html-entities');config[_0x262e('0xd')]=_[_0x262e('0xe')](config[_0x262e('0xd')],{'host':_0x262e('0xf'),'port':0x18eb});var socket=require(_0x262e('0x10'))(new Redis(config[_0x262e('0xd')]));require(_0x262e('0x11'))[_0x262e('0x12')](socket);function respondWithStatusCode(_0xe4ecf,_0x5e9a49){_0x5e9a49=_0x5e9a49||0xcc;return function(_0x128b1b){if(_0x128b1b){return _0xe4ecf[_0x262e('0x13')](_0x5e9a49);}return _0xe4ecf[_0x262e('0x14')](_0x5e9a49)[_0x262e('0x15')]();};}function respondWithResult(_0x5302b7,_0x5dfb0c){_0x5dfb0c=_0x5dfb0c||0xc8;return function(_0x52f294){if(_0x52f294){return _0x5302b7[_0x262e('0x14')](_0x5dfb0c)[_0x262e('0x16')](_0x52f294);}};}function respondWithFilteredResult(_0x1627d6,_0x1b6764){return function(_0x47935f){if(_0x47935f){var _0x3a9fcd=typeof _0x1b6764[_0x262e('0x17')]==='undefined'&&typeof _0x1b6764[_0x262e('0x18')]===_0x262e('0x19');var _0x3230f9=_0x47935f[_0x262e('0x1a')];var _0x482774=_0x3a9fcd?0x0:_0x1b6764[_0x262e('0x17')];var _0x1ae91a=_0x3a9fcd?_0x47935f[_0x262e('0x1a')]:_0x1b6764[_0x262e('0x17')]+_0x1b6764[_0x262e('0x18')];var _0x1f2b8a;if(_0x1ae91a>=_0x3230f9){_0x1ae91a=_0x3230f9;_0x1f2b8a=0xc8;}else{_0x1f2b8a=0xce;}_0x1627d6[_0x262e('0x14')](_0x1f2b8a);return _0x1627d6[_0x262e('0x1b')](_0x262e('0x1c'),_0x482774+'-'+_0x1ae91a+'/'+_0x3230f9)[_0x262e('0x16')](_0x47935f);}return null;};}function saveUpdates(_0x1a0c37){return function(_0x4b00b0){if(_0x4b00b0){return _0x4b00b0[_0x262e('0x1d')](_0x1a0c37)[_0x262e('0x1e')](function(_0x24312e){return _0x24312e;});}return null;};}function removeEntity(_0x82e6e8){return function(_0x235a47){if(_0x235a47){return _0x235a47[_0x262e('0x1f')]()[_0x262e('0x1e')](function(){_0x82e6e8[_0x262e('0x14')](0xcc)[_0x262e('0x15')]();});}};}function handleEntityNotFound(_0x5891bf){return function(_0x443992){if(!_0x443992){_0x5891bf[_0x262e('0x13')](0x194);}return _0x443992;};}function handleError(_0x418654,_0x39f39f){_0x39f39f=_0x39f39f||0x1f4;return function(_0x1c1b00){logger['error'](_0x1c1b00['stack']);if(_0x1c1b00[_0x262e('0x20')]){delete _0x1c1b00['name'];}_0x418654['status'](_0x39f39f)[_0x262e('0x21')](_0x1c1b00);};}exports[_0x262e('0x22')]=function(_0x590e2e,_0x129efc){var _0x1b57fb={};var _0x19e1fd=_[_0x262e('0x23')](db['MailInteraction'][_0x262e('0x24')],function(_0x1c3ca8){return{'name':_0x1c3ca8[_0x262e('0x25')],'type':_0x1c3ca8[_0x262e('0x26')]['key']};});_0x1b57fb=qs[_0x262e('0x27')](_0x19e1fd,_0x590e2e);return interaction['findAll'](_0x262e('0x28'),_0x590e2e[_0x262e('0x29')],_0x590e2e['user'],_0x1b57fb,_0x19e1fd)[_0x262e('0x1e')](respondWithFilteredResult(_0x129efc,_0x1b57fb))['catch'](handleError(_0x129efc,null));};exports['show']=function(_0x537276,_0x912e99){var _0x1ce94a={'raw':![],'where':{'id':_0x537276[_0x262e('0x2a')]['id']}},_0x4b9be8={};_0x4b9be8['model']=_['keys'](db['MailInteraction'][_0x262e('0x24')]);_0x4b9be8['query']=_[_0x262e('0x2b')](_0x537276[_0x262e('0x29')]);_0x4b9be8['filters']=_[_0x262e('0x2c')](_0x4b9be8[_0x262e('0x2d')],_0x4b9be8[_0x262e('0x29')]);_0x1ce94a['attributes']=_[_0x262e('0x2c')](_0x4b9be8[_0x262e('0x2d')],qs[_0x262e('0x2e')](_0x537276[_0x262e('0x29')][_0x262e('0x2e')]));_0x1ce94a[_0x262e('0x2f')]=_0x1ce94a[_0x262e('0x2f')][_0x262e('0x30')]?_0x1ce94a[_0x262e('0x2f')]:_0x4b9be8[_0x262e('0x2d')];if(_0x537276[_0x262e('0x29')][_0x262e('0x31')]){_0x1ce94a['include']=[{'all':!![]}];}_0x1ce94a=_[_0x262e('0x32')]({},_0x1ce94a,_0x537276[_0x262e('0x33')]);return db[_0x262e('0x34')]['find'](_0x1ce94a)['then'](handleEntityNotFound(_0x912e99,null))[_0x262e('0x1e')](respondWithResult(_0x912e99,null))[_0x262e('0x35')](handleError(_0x912e99,null));};exports['create']=function(_0x41139c,_0x2c0f7c){return db[_0x262e('0x34')][_0x262e('0x36')](_0x41139c[_0x262e('0x37')],{})['then'](respondWithResult(_0x2c0f7c,0xc9))[_0x262e('0x35')](handleError(_0x2c0f7c,null));};exports['update']=function(_0x13bb26,_0x2db6ca){if(_0x13bb26[_0x262e('0x37')]['id']){delete _0x13bb26[_0x262e('0x37')]['id'];}return db['MailInteraction'][_0x262e('0x38')]({'where':{'id':_0x13bb26[_0x262e('0x2a')]['id']}})[_0x262e('0x1e')](handleEntityNotFound(_0x2db6ca,null))['then'](saveUpdates(_0x13bb26[_0x262e('0x37')],null))[_0x262e('0x1e')](respondWithResult(_0x2db6ca,null))['catch'](handleError(_0x2db6ca,null));};exports[_0x262e('0x1f')]=function(_0x58e67c,_0x3d8bd5){return db[_0x262e('0x34')][_0x262e('0x38')]({'where':{'id':_0x58e67c[_0x262e('0x2a')]['id']}})[_0x262e('0x1e')](handleEntityNotFound(_0x3d8bd5,null))[_0x262e('0x1e')](removeEntity(_0x3d8bd5,null))[_0x262e('0x35')](handleError(_0x3d8bd5,null));};exports[_0x262e('0x39')]=function(_0x408687,_0x5efaf4){return db[_0x262e('0x34')][_0x262e('0x39')]()['then'](respondWithResult(_0x5efaf4,null))[_0x262e('0x35')](handleError(_0x5efaf4,null));};exports[_0x262e('0x3a')]=function(_0x32bd69,_0x260688){return db[_0x262e('0x3b')][_0x262e('0x38')]({'where':{'id':_0x32bd69[_0x262e('0x2a')]['id']}})['then'](handleEntityNotFound(_0x260688,null))[_0x262e('0x1e')](function(_0x3fa88c){if(_0x3fa88c){return _0x3fa88c[_0x262e('0x3a')](_0x32bd69[_0x262e('0x37')][_0x262e('0x3c')],_[_0x262e('0x3d')](_0x32bd69[_0x262e('0x37')],['ids','id'])||{});}})[_0x262e('0x1e')](respondWithResult(_0x260688,null))[_0x262e('0x35')](handleError(_0x260688,null));};exports[_0x262e('0x3e')]=function(_0x1ba6ee,_0x5f1773){var _0xe80273={'raw':![],'where':{}};var _0x2e50e8={};var _0xd9c726={'count':0x0,'rows':[]};return db[_0x262e('0x34')][_0x262e('0x3f')]({'where':{'id':_0x1ba6ee[_0x262e('0x2a')]['id']}})[_0x262e('0x1e')](handleEntityNotFound(_0x5f1773,null))[_0x262e('0x1e')](function(_0x3e32cf){if(_0x3e32cf){_0x2e50e8[_0x262e('0x2d')]=_['keys'](db['MailMessage']['rawAttributes']);_0x2e50e8[_0x262e('0x29')]=_[_0x262e('0x2b')](_0x1ba6ee[_0x262e('0x29')]);_0x2e50e8[_0x262e('0x40')]=_[_0x262e('0x2c')](_0x2e50e8[_0x262e('0x2d')],_0x2e50e8[_0x262e('0x29')]);_0xe80273[_0x262e('0x2f')]=_['intersection'](_0x2e50e8[_0x262e('0x2d')],qs[_0x262e('0x2e')](_0x1ba6ee[_0x262e('0x29')][_0x262e('0x2e')]));_0xe80273['attributes']=_0xe80273[_0x262e('0x2f')][_0x262e('0x30')]?_0xe80273[_0x262e('0x2f')]:_0x2e50e8['model'];if(!_0x1ba6ee[_0x262e('0x29')][_0x262e('0x41')](_0x262e('0x42'))){_0xe80273['limit']=qs[_0x262e('0x18')](_0x1ba6ee['query'][_0x262e('0x18')]);_0xe80273[_0x262e('0x17')]=qs[_0x262e('0x17')](_0x1ba6ee[_0x262e('0x29')][_0x262e('0x17')]);}_0xe80273['order']=qs['sort'](_0x1ba6ee[_0x262e('0x29')][_0x262e('0x43')]);_0xe80273[_0x262e('0x44')]=qs['filters'](_[_0x262e('0x45')](_0x1ba6ee['query'],_0x2e50e8['filters']));_0xe80273[_0x262e('0x44')][_0x262e('0x46')]=_0x3e32cf['id'];if(_0x1ba6ee['query'][_0x262e('0x47')]){_0xe80273[_0x262e('0x44')]=_[_0x262e('0x32')](_0xe80273[_0x262e('0x44')],{'$or':_[_0x262e('0x23')](_0xe80273['attributes'],function(_0x4fbff6){var _0x169e43={};_0x169e43[_0x4fbff6]={'$like':'%'+_0x1ba6ee[_0x262e('0x29')]['filter']+'%'};return _0x169e43;})});}if(_0x1ba6ee[_0x262e('0x29')][_0x262e('0x48')]){var _0x981016=_0x1ba6ee[_0x262e('0x29')][_0x262e('0x48')]['split'](',');var _0x23727e={};_0x23727e[_0x981016[0x0]]={'$gte':moment(_0x981016[0x1])[_0x262e('0x49')]('YYYY-MM-DD\x20HH:mm:ss')};_0xe80273['where']=_[_0x262e('0x32')](_0xe80273[_0x262e('0x44')],_0x23727e);}_0xe80273=_[_0x262e('0x32')]({},_0xe80273,_0x1ba6ee[_0x262e('0x33')]);return db[_0x262e('0x3b')][_0x262e('0x1a')]({'where':_0xe80273['where']})[_0x262e('0x1e')](function(_0x259e19){_0xd9c726[_0x262e('0x1a')]=_0x259e19;if(_0x1ba6ee['query']['includeAll']){_0xe80273[_0x262e('0x4a')]=[{'all':!![]}];}return db[_0x262e('0x3b')]['findAll'](_0xe80273);})[_0x262e('0x1e')](function(_0x58ce71){if(_0x1ba6ee[_0x262e('0x29')][_0x262e('0x4b')]===_0x262e('0x4c')){for(var _0xf74a73=0x0;_0xf74a73<_0x58ce71[_0x262e('0x30')];_0xf74a73++){_0x58ce71[_0xf74a73][_0x262e('0x37')]=juice(_0x58ce71[_0xf74a73][_0x262e('0x37')]);}}_0xd9c726[_0x262e('0x4d')]=_0x58ce71;return _0xd9c726;});}})[_0x262e('0x1e')](respondWithFilteredResult(_0x5f1773,_0xe80273))[_0x262e('0x35')](handleError(_0x5f1773,null));};exports[_0x262e('0x4e')]=function(_0x325bf7,_0xf72a43){return db[_0x262e('0x34')]['find']({'where':{'id':_0x325bf7[_0x262e('0x2a')]['id']}})['then'](handleEntityNotFound(_0xf72a43,null))[_0x262e('0x1e')](function(_0x45a19b){if(_0x45a19b){return _0x45a19b['setTags'](_0x325bf7['body'][_0x262e('0x3c')],_[_0x262e('0x3d')](_0x325bf7['body'],[_0x262e('0x3c'),'id'])||{})[_0x262e('0x4f')](function(){return db[_0x262e('0x50')]['findAll']({'attributes':['id','name',_0x262e('0x51')],'where':{'id':_0x325bf7[_0x262e('0x37')][_0x262e('0x3c')]}});})['then'](function(_0x5cc96d){socket[_0x262e('0x52')](_0x262e('0x53'),{'id':Number(_0x325bf7['params']['id']),'tags':_0x5cc96d||[]});return{'id':Number(_0x325bf7['params']['id']),'tags':_0x5cc96d||[]};});}})[_0x262e('0x1e')](respondWithResult(_0xf72a43,null))['catch'](handleError(_0xf72a43,null));};exports[_0x262e('0x54')]=function(_0x467160,_0x3210af){return db[_0x262e('0x34')]['find']({'where':{'id':_0x467160['params']['id']}})[_0x262e('0x1e')](handleEntityNotFound(_0x3210af,null))[_0x262e('0x1e')](function(_0x5af4c0){if(_0x5af4c0){return _0x5af4c0[_0x262e('0x54')](_0x467160['query'][_0x262e('0x3c')]);}})[_0x262e('0x1e')](respondWithStatusCode(_0x3210af,null))['catch'](handleError(_0x3210af,null));};exports[_0x262e('0x55')]=function(_0x215b64,_0x5d5462){var _0x3a8df4=moment()[_0x262e('0x56')]()[_0x262e('0x57')]();var _0x116816=path[_0x262e('0x58')](config[_0x262e('0x59')],_0x262e('0x5a'),_0x262e('0x5b'),_0x262e('0x5c'));var _0x4c3c09=path[_0x262e('0x58')](config['root'],_0x262e('0x5a'),'files',_0x262e('0x5d'));var _0x4f7f2d=path[_0x262e('0x58')](_0x116816,_0x3a8df4);var _0x422280=util[_0x262e('0x49')](_0x262e('0x5e'),_0x215b64[_0x262e('0x2a')]['id'],_0x3a8df4);var _0x49d47e=path[_0x262e('0x58')](_0x116816,_0x422280);var _0x120e43=[];if(_0x215b64[_0x262e('0x29')][_0x262e('0x5d')]){_0x120e43[_0x262e('0x5f')]({'model':db[_0x262e('0x60')],'as':_0x262e('0x61'),'raw':!![]});}var _0x53c25d=[{'model':db[_0x262e('0x3b')],'as':_0x262e('0x62'),'attributes':['id',_0x262e('0x37'),_0x262e('0x63'),'to','cc',_0x262e('0x64'),_0x262e('0x65'),_0x262e('0x66')],'where':{'secret':![]},'order':qs[_0x262e('0x43')]('id'),'include':_0x120e43}];return db[_0x262e('0x34')][_0x262e('0x38')]({'where':{'id':_0x215b64[_0x262e('0x2a')]['id']},'include':_0x53c25d})[_0x262e('0x1e')](handleEntityNotFound(_0x5d5462,null))['then'](function(_0x4bc8d8){if(_0x4bc8d8&&_0x4bc8d8['Messages']){var _0x5ad121=_0x4bc8d8[_0x262e('0x67')]({'plain':!![]});fs[_0x262e('0x68')](_0x4f7f2d);return BPromise[_0x262e('0x69')](_0x5ad121[_0x262e('0x62')],function(_0x3337c7,_0x1c6c84){var _0x44e443={'from':_0x3337c7['from'],'to':_0x3337c7['to']||_0x262e('0x6a'),'subject':_0x3337c7[_0x262e('0x65')],'html':htmlEntities['decode'](_0x3337c7['body']),'headers':{'Date':moment(_0x3337c7[_0x262e('0x66')])['format']('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x3337c7['cc']){_0x44e443[_0x262e('0x6b')]['Cc']=_0x3337c7['cc'];}if(_0x3337c7['bcc']){_0x44e443['headers']['Bcc']=_0x3337c7['bcc'];}return new BPromise(function(_0x2c39f7,_0x52e26f){if(_0x3337c7[_0x262e('0x61')]){for(var _0x1dc059=0x0;_0x1dc059<_0x3337c7[_0x262e('0x61')][_0x262e('0x30')];_0x1dc059++){var _0x5bb499=_0x3337c7[_0x262e('0x61')][_0x1dc059];var _0x23b6e5=path[_0x262e('0x58')](_0x4c3c09,_0x5bb499['basename']);if(fs[_0x262e('0x6c')](_0x23b6e5)){_0x44e443['attachments']['push']({'name':_0x5bb499[_0x262e('0x20')],'contentType':_0x5bb499['type'],'data':fs[_0x262e('0x6d')](_0x23b6e5)});}}}emlformat['build'](_0x44e443,function(_0x2901f6,_0xf9c277){if(_0x2901f6)return _0x52e26f(_0x2901f6);fs[_0x262e('0x6e')](path[_0x262e('0x58')](_0x4f7f2d,util[_0x262e('0x49')]('message%d.eml',_0x1c6c84)),_0xf9c277);return _0x2c39f7(_0xf9c277);});});})[_0x262e('0x1e')](function(){return new BPromise(function(_0x3be43d,_0x30fa62){zipdir(_0x4f7f2d,{'saveTo':_0x49d47e},function(_0x53b9f5,_0x20948d){if(_0x53b9f5)return _0x30fa62(_0x53b9f5);return _0x3be43d(_0x20948d);});})[_0x262e('0x1e')](function(){return new BPromise(function(_0x222632,_0x5d24cf){rimraf(_0x4f7f2d,function(_0x59e38b){if(_0x59e38b)_0x5d24cf(_0x59e38b);return _0x222632();});});})[_0x262e('0x1e')](function(){return _0x5d5462[_0x262e('0x55')](_0x49d47e,_0x422280,function(_0x5645ff){if(!_0x5645ff)fs[_0x262e('0x6f')](_0x49d47e);});});});}else{return _0x5d5462[_0x262e('0x13')](0xc8);}})[_0x262e('0x35')](handleError(_0x5d5462,null));}; \ No newline at end of file +var _0xd016=['juice','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','html-entities','defaults','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','status','end','offset','undefined','limit','set','Content-Range','json','update','then','destroy','sendStatus','error','stack','name','send','index','map','fieldName','type','key','getOptions','findAll','mail','query','user','catch','show','params','model','MailInteraction','rawAttributes','keys','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','create','body','describe','addMessage','MailMessage','ids','findOne','hasOwnProperty','order','sort','pick','filter','$gte','split','format','where','count','true','rows','addTags','setTags','spread','Tag','emit','mailInteractionTags:save','removeTags','download','unix','toString','join','root','server','tmp','attachments','transcript-%d-%s.zip','Attachments','Messages','bcc','subject','createdAt','get','mkdirSync','each','from','missing.recipient@your.company.com','decode','headers','Bcc','basename','readFileSync','build','writeFileSync','message%d.eml','unlinkSync','eml-format','rimraf','zip-dir','moment','bluebird','path','lodash'];(function(_0x15cbce,_0xda8402){var _0x257f29=function(_0x388132){while(--_0x388132){_0x15cbce['push'](_0x15cbce['shift']());}};_0x257f29(++_0xda8402);}(_0xd016,0xe3));var _0x6d01=function(_0x459d99,_0x33f980){_0x459d99=_0x459d99-0x0;var _0x449fd2=_0xd016[_0x459d99];return _0x449fd2;};'use strict';var emlformat=require(_0x6d01('0x0'));var rimraf=require(_0x6d01('0x1'));var zipdir=require(_0x6d01('0x2'));var moment=require(_0x6d01('0x3'));var BPromise=require(_0x6d01('0x4'));var util=require('util');var path=require(_0x6d01('0x5'));var fs=require('fs');var _=require(_0x6d01('0x6'));var juice=require(_0x6d01('0x7'));var Redis=require('ioredis');var interaction=require('../../components/interaction/service');var qs=require(_0x6d01('0x8'));var logger=require(_0x6d01('0x9'))(_0x6d01('0xa'));var config=require(_0x6d01('0xb'));var db=require(_0x6d01('0xc'))['db'];var htmlEntities=require(_0x6d01('0xd'));config['redis']=_[_0x6d01('0xe')](config[_0x6d01('0xf')],{'host':_0x6d01('0x10'),'port':0x18eb});var socket=require(_0x6d01('0x11'))(new Redis(config[_0x6d01('0xf')]));require(_0x6d01('0x12'))[_0x6d01('0x13')](socket);function respondWithStatusCode(_0x36ab01,_0x3ad42b){_0x3ad42b=_0x3ad42b||0xcc;return function(_0x45ad1e){if(_0x45ad1e){return _0x36ab01['sendStatus'](_0x3ad42b);}return _0x36ab01[_0x6d01('0x14')](_0x3ad42b)[_0x6d01('0x15')]();};}function respondWithResult(_0x17b947,_0xd36ca9){_0xd36ca9=_0xd36ca9||0xc8;return function(_0x19d78a){if(_0x19d78a){return _0x17b947['status'](_0xd36ca9)['json'](_0x19d78a);}};}function respondWithFilteredResult(_0x20797c,_0x2b90e7){return function(_0x110ca6){if(_0x110ca6){var _0x57ea85=typeof _0x2b90e7[_0x6d01('0x16')]===_0x6d01('0x17')&&typeof _0x2b90e7[_0x6d01('0x18')]==='undefined';var _0x273c82=_0x110ca6['count'];var _0x47ac5c=_0x57ea85?0x0:_0x2b90e7[_0x6d01('0x16')];var _0x1f230d=_0x57ea85?_0x110ca6['count']:_0x2b90e7['offset']+_0x2b90e7[_0x6d01('0x18')];var _0x5aa801;if(_0x1f230d>=_0x273c82){_0x1f230d=_0x273c82;_0x5aa801=0xc8;}else{_0x5aa801=0xce;}_0x20797c[_0x6d01('0x14')](_0x5aa801);return _0x20797c[_0x6d01('0x19')](_0x6d01('0x1a'),_0x47ac5c+'-'+_0x1f230d+'/'+_0x273c82)[_0x6d01('0x1b')](_0x110ca6);}return null;};}function saveUpdates(_0x2a52a8){return function(_0x493f14){if(_0x493f14){return _0x493f14[_0x6d01('0x1c')](_0x2a52a8)[_0x6d01('0x1d')](function(_0x8fb375){return _0x8fb375;});}return null;};}function removeEntity(_0xae9c61){return function(_0x5e0a0a){if(_0x5e0a0a){return _0x5e0a0a[_0x6d01('0x1e')]()[_0x6d01('0x1d')](function(){_0xae9c61[_0x6d01('0x14')](0xcc)[_0x6d01('0x15')]();});}};}function handleEntityNotFound(_0x44fa52){return function(_0x55aeb3){if(!_0x55aeb3){_0x44fa52[_0x6d01('0x1f')](0x194);}return _0x55aeb3;};}function handleError(_0x25b10f,_0x4ffb50){_0x4ffb50=_0x4ffb50||0x1f4;return function(_0x13ee19){logger[_0x6d01('0x20')](_0x13ee19[_0x6d01('0x21')]);if(_0x13ee19[_0x6d01('0x22')]){delete _0x13ee19[_0x6d01('0x22')];}_0x25b10f[_0x6d01('0x14')](_0x4ffb50)[_0x6d01('0x23')](_0x13ee19);};}exports[_0x6d01('0x24')]=function(_0x19f529,_0x379249){var _0x3c6c7b={};var _0x48a41f=_[_0x6d01('0x25')](db['MailInteraction']['rawAttributes'],function(_0xa9394a){return{'name':_0xa9394a[_0x6d01('0x26')],'type':_0xa9394a[_0x6d01('0x27')][_0x6d01('0x28')]};});_0x3c6c7b=qs[_0x6d01('0x29')](_0x48a41f,_0x19f529);return interaction[_0x6d01('0x2a')](_0x6d01('0x2b'),_0x19f529[_0x6d01('0x2c')],_0x19f529[_0x6d01('0x2d')],_0x3c6c7b,_0x48a41f)['then'](respondWithFilteredResult(_0x379249,_0x3c6c7b))[_0x6d01('0x2e')](handleError(_0x379249,null));};exports[_0x6d01('0x2f')]=function(_0x4ef794,_0x2d13a4){var _0x4c859f={'raw':![],'where':{'id':_0x4ef794[_0x6d01('0x30')]['id']}},_0x3c663e={};_0x3c663e[_0x6d01('0x31')]=_['keys'](db[_0x6d01('0x32')][_0x6d01('0x33')]);_0x3c663e[_0x6d01('0x2c')]=_[_0x6d01('0x34')](_0x4ef794['query']);_0x3c663e[_0x6d01('0x35')]=_[_0x6d01('0x36')](_0x3c663e[_0x6d01('0x31')],_0x3c663e[_0x6d01('0x2c')]);_0x4c859f[_0x6d01('0x37')]=_[_0x6d01('0x36')](_0x3c663e[_0x6d01('0x31')],qs['fields'](_0x4ef794[_0x6d01('0x2c')][_0x6d01('0x38')]));_0x4c859f[_0x6d01('0x37')]=_0x4c859f[_0x6d01('0x37')][_0x6d01('0x39')]?_0x4c859f[_0x6d01('0x37')]:_0x3c663e[_0x6d01('0x31')];if(_0x4ef794[_0x6d01('0x2c')][_0x6d01('0x3a')]){_0x4c859f[_0x6d01('0x3b')]=[{'all':!![]}];}_0x4c859f=_[_0x6d01('0x3c')]({},_0x4c859f,_0x4ef794[_0x6d01('0x3d')]);return db[_0x6d01('0x32')][_0x6d01('0x3e')](_0x4c859f)[_0x6d01('0x1d')](handleEntityNotFound(_0x2d13a4,null))['then'](respondWithResult(_0x2d13a4,null))[_0x6d01('0x2e')](handleError(_0x2d13a4,null));};exports['create']=function(_0x3a786e,_0x2cb692){return db[_0x6d01('0x32')][_0x6d01('0x3f')](_0x3a786e[_0x6d01('0x40')],{})[_0x6d01('0x1d')](respondWithResult(_0x2cb692,0xc9))[_0x6d01('0x2e')](handleError(_0x2cb692,null));};exports[_0x6d01('0x1c')]=function(_0xdb0b06,_0x38f58a){if(_0xdb0b06[_0x6d01('0x40')]['id']){delete _0xdb0b06[_0x6d01('0x40')]['id'];}return db[_0x6d01('0x32')][_0x6d01('0x3e')]({'where':{'id':_0xdb0b06['params']['id']}})['then'](handleEntityNotFound(_0x38f58a,null))['then'](saveUpdates(_0xdb0b06[_0x6d01('0x40')],null))[_0x6d01('0x1d')](respondWithResult(_0x38f58a,null))[_0x6d01('0x2e')](handleError(_0x38f58a,null));};exports[_0x6d01('0x1e')]=function(_0x3f3235,_0x2a5536){return db[_0x6d01('0x32')][_0x6d01('0x3e')]({'where':{'id':_0x3f3235[_0x6d01('0x30')]['id']}})[_0x6d01('0x1d')](handleEntityNotFound(_0x2a5536,null))[_0x6d01('0x1d')](removeEntity(_0x2a5536,null))['catch'](handleError(_0x2a5536,null));};exports['describe']=function(_0x436fcd,_0x56d2a0){return db[_0x6d01('0x32')][_0x6d01('0x41')]()[_0x6d01('0x1d')](respondWithResult(_0x56d2a0,null))['catch'](handleError(_0x56d2a0,null));};exports[_0x6d01('0x42')]=function(_0x49bb3b,_0x18e03d){return db[_0x6d01('0x43')][_0x6d01('0x3e')]({'where':{'id':_0x49bb3b['params']['id']}})[_0x6d01('0x1d')](handleEntityNotFound(_0x18e03d,null))[_0x6d01('0x1d')](function(_0x560108){if(_0x560108){return _0x560108[_0x6d01('0x42')](_0x49bb3b[_0x6d01('0x40')][_0x6d01('0x44')],_['omit'](_0x49bb3b[_0x6d01('0x40')],['ids','id'])||{});}})['then'](respondWithResult(_0x18e03d,null))[_0x6d01('0x2e')](handleError(_0x18e03d,null));};exports['getMessages']=function(_0x460d10,_0x2919f0){var _0x2cd165={'raw':![],'where':{}};var _0x555fcf={};var _0x3dc48d={'count':0x0,'rows':[]};return db[_0x6d01('0x32')][_0x6d01('0x45')]({'where':{'id':_0x460d10['params']['id']}})[_0x6d01('0x1d')](handleEntityNotFound(_0x2919f0,null))['then'](function(_0x223027){if(_0x223027){_0x555fcf[_0x6d01('0x31')]=_['keys'](db[_0x6d01('0x43')]['rawAttributes']);_0x555fcf['query']=_[_0x6d01('0x34')](_0x460d10[_0x6d01('0x2c')]);_0x555fcf['filters']=_[_0x6d01('0x36')](_0x555fcf['model'],_0x555fcf[_0x6d01('0x2c')]);_0x2cd165[_0x6d01('0x37')]=_[_0x6d01('0x36')](_0x555fcf['model'],qs[_0x6d01('0x38')](_0x460d10[_0x6d01('0x2c')][_0x6d01('0x38')]));_0x2cd165['attributes']=_0x2cd165[_0x6d01('0x37')]['length']?_0x2cd165['attributes']:_0x555fcf[_0x6d01('0x31')];if(!_0x460d10[_0x6d01('0x2c')][_0x6d01('0x46')]('nolimit')){_0x2cd165[_0x6d01('0x18')]=qs[_0x6d01('0x18')](_0x460d10['query'][_0x6d01('0x18')]);_0x2cd165[_0x6d01('0x16')]=qs[_0x6d01('0x16')](_0x460d10['query']['offset']);}_0x2cd165[_0x6d01('0x47')]=qs[_0x6d01('0x48')](_0x460d10[_0x6d01('0x2c')][_0x6d01('0x48')]);_0x2cd165['where']=qs[_0x6d01('0x35')](_[_0x6d01('0x49')](_0x460d10[_0x6d01('0x2c')],_0x555fcf[_0x6d01('0x35')]));_0x2cd165['where']['MailInteractionId']=_0x223027['id'];if(_0x460d10[_0x6d01('0x2c')][_0x6d01('0x4a')]){_0x2cd165['where']=_[_0x6d01('0x3c')](_0x2cd165['where'],{'$or':_[_0x6d01('0x25')](_0x2cd165[_0x6d01('0x37')],function(_0x5ab678){var _0x49643e={};_0x49643e[_0x5ab678]={'$like':'%'+_0x460d10[_0x6d01('0x2c')][_0x6d01('0x4a')]+'%'};return _0x49643e;})});}if(_0x460d10[_0x6d01('0x2c')][_0x6d01('0x4b')]){var _0x776250=_0x460d10[_0x6d01('0x2c')][_0x6d01('0x4b')][_0x6d01('0x4c')](',');var _0x515c8e={};_0x515c8e[_0x776250[0x0]]={'$gte':moment(_0x776250[0x1])[_0x6d01('0x4d')]('YYYY-MM-DD\x20HH:mm:ss')};_0x2cd165['where']=_['merge'](_0x2cd165[_0x6d01('0x4e')],_0x515c8e);}_0x2cd165=_[_0x6d01('0x3c')]({},_0x2cd165,_0x460d10[_0x6d01('0x3d')]);return db[_0x6d01('0x43')]['count']({'where':_0x2cd165[_0x6d01('0x4e')]})[_0x6d01('0x1d')](function(_0x397222){_0x3dc48d[_0x6d01('0x4f')]=_0x397222;if(_0x460d10[_0x6d01('0x2c')]['includeAll']){_0x2cd165[_0x6d01('0x3b')]=[{'all':!![]}];}return db[_0x6d01('0x43')][_0x6d01('0x2a')](_0x2cd165);})['then'](function(_0x99c9){if(_0x460d10['query']['inlineCss']===_0x6d01('0x50')){for(var _0x27a732=0x0;_0x27a732<_0x99c9[_0x6d01('0x39')];_0x27a732++){_0x99c9[_0x27a732]['body']=juice(_0x99c9[_0x27a732][_0x6d01('0x40')]);}}_0x3dc48d[_0x6d01('0x51')]=_0x99c9;return _0x3dc48d;});}})[_0x6d01('0x1d')](respondWithFilteredResult(_0x2919f0,_0x2cd165))[_0x6d01('0x2e')](handleError(_0x2919f0,null));};exports[_0x6d01('0x52')]=function(_0x265c74,_0x5ad039){return db[_0x6d01('0x32')][_0x6d01('0x3e')]({'where':{'id':_0x265c74[_0x6d01('0x30')]['id']}})['then'](handleEntityNotFound(_0x5ad039,null))['then'](function(_0xd51f55){if(_0xd51f55){return _0xd51f55[_0x6d01('0x53')](_0x265c74[_0x6d01('0x40')][_0x6d01('0x44')],_['omit'](_0x265c74['body'],[_0x6d01('0x44'),'id'])||{})[_0x6d01('0x54')](function(){return db[_0x6d01('0x55')][_0x6d01('0x2a')]({'attributes':['id',_0x6d01('0x22'),'color'],'where':{'id':_0x265c74[_0x6d01('0x40')][_0x6d01('0x44')]}});})[_0x6d01('0x1d')](function(_0x4794b6){socket[_0x6d01('0x56')](_0x6d01('0x57'),{'id':Number(_0x265c74['params']['id']),'tags':_0x4794b6||[]});return{'id':Number(_0x265c74[_0x6d01('0x30')]['id']),'tags':_0x4794b6||[]};});}})['then'](respondWithResult(_0x5ad039,null))[_0x6d01('0x2e')](handleError(_0x5ad039,null));};exports[_0x6d01('0x58')]=function(_0x4c6ef1,_0x38fdae){return db[_0x6d01('0x32')][_0x6d01('0x3e')]({'where':{'id':_0x4c6ef1[_0x6d01('0x30')]['id']}})[_0x6d01('0x1d')](handleEntityNotFound(_0x38fdae,null))[_0x6d01('0x1d')](function(_0x31b21e){if(_0x31b21e){return _0x31b21e[_0x6d01('0x58')](_0x4c6ef1[_0x6d01('0x2c')][_0x6d01('0x44')]);}})[_0x6d01('0x1d')](respondWithStatusCode(_0x38fdae,null))[_0x6d01('0x2e')](handleError(_0x38fdae,null));};exports[_0x6d01('0x59')]=function(_0x27236e,_0x1dc9e3){var _0x4b6103=moment()[_0x6d01('0x5a')]()[_0x6d01('0x5b')]();var _0x13f4ba=path[_0x6d01('0x5c')](config[_0x6d01('0x5d')],_0x6d01('0x5e'),'files',_0x6d01('0x5f'));var _0x4d3adb=path['join'](config[_0x6d01('0x5d')],_0x6d01('0x5e'),'files',_0x6d01('0x60'));var _0xbdcb0d=path[_0x6d01('0x5c')](_0x13f4ba,_0x4b6103);var _0x5430ff=util[_0x6d01('0x4d')](_0x6d01('0x61'),_0x27236e['params']['id'],_0x4b6103);var _0x596096=path['join'](_0x13f4ba,_0x5430ff);var _0x44c09c=[];if(_0x27236e[_0x6d01('0x2c')][_0x6d01('0x60')]){_0x44c09c['push']({'model':db['Attachment'],'as':_0x6d01('0x62'),'raw':!![]});}var _0x2cc50e=[{'model':db[_0x6d01('0x43')],'as':_0x6d01('0x63'),'attributes':['id',_0x6d01('0x40'),'from','to','cc',_0x6d01('0x64'),_0x6d01('0x65'),_0x6d01('0x66')],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x44c09c}];return db[_0x6d01('0x32')][_0x6d01('0x3e')]({'where':{'id':_0x27236e[_0x6d01('0x30')]['id']},'include':_0x2cc50e})[_0x6d01('0x1d')](handleEntityNotFound(_0x1dc9e3,null))[_0x6d01('0x1d')](function(_0x42ef70){if(_0x42ef70&&_0x42ef70[_0x6d01('0x63')]){var _0x291c54=_0x42ef70[_0x6d01('0x67')]({'plain':!![]});fs[_0x6d01('0x68')](_0xbdcb0d);return BPromise[_0x6d01('0x69')](_0x291c54[_0x6d01('0x63')],function(_0x44a849,_0x480fbd){var _0x278e3e={'from':_0x44a849[_0x6d01('0x6a')],'to':_0x44a849['to']||_0x6d01('0x6b'),'subject':_0x44a849[_0x6d01('0x65')],'html':htmlEntities[_0x6d01('0x6c')](_0x44a849['body']),'headers':{'Date':moment(_0x44a849[_0x6d01('0x66')])[_0x6d01('0x4d')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x44a849['cc']){_0x278e3e[_0x6d01('0x6d')]['Cc']=_0x44a849['cc'];}if(_0x44a849['bcc']){_0x278e3e['headers'][_0x6d01('0x6e')]=_0x44a849[_0x6d01('0x64')];}return new BPromise(function(_0x16116b,_0x4da838){if(_0x44a849[_0x6d01('0x62')]){for(var _0x45eb5d=0x0;_0x45eb5d<_0x44a849[_0x6d01('0x62')][_0x6d01('0x39')];_0x45eb5d++){var _0x28d6df=_0x44a849[_0x6d01('0x62')][_0x45eb5d];var _0x1680e2=path['join'](_0x4d3adb,_0x28d6df[_0x6d01('0x6f')]);if(fs['existsSync'](_0x1680e2)){_0x278e3e[_0x6d01('0x60')]['push']({'name':_0x28d6df['name'],'contentType':_0x28d6df[_0x6d01('0x27')],'data':fs[_0x6d01('0x70')](_0x1680e2)});}}}emlformat[_0x6d01('0x71')](_0x278e3e,function(_0x479c36,_0x26a430){if(_0x479c36)return _0x4da838(_0x479c36);fs[_0x6d01('0x72')](path[_0x6d01('0x5c')](_0xbdcb0d,util['format'](_0x6d01('0x73'),_0x480fbd)),_0x26a430);return _0x16116b(_0x26a430);});});})[_0x6d01('0x1d')](function(){return new BPromise(function(_0x36fbfc,_0x515816){zipdir(_0xbdcb0d,{'saveTo':_0x596096},function(_0x533e30,_0x51a1d8){if(_0x533e30)return _0x515816(_0x533e30);return _0x36fbfc(_0x51a1d8);});})[_0x6d01('0x1d')](function(){return new BPromise(function(_0x5f1085,_0x54bcce){rimraf(_0xbdcb0d,function(_0x5d8907){if(_0x5d8907)_0x54bcce(_0x5d8907);return _0x5f1085();});});})[_0x6d01('0x1d')](function(){return _0x1dc9e3[_0x6d01('0x59')](_0x596096,_0x5430ff,function(_0x24bb7d){if(!_0x24bb7d)fs[_0x6d01('0x74')](_0x596096);});});});}else{return _0x1dc9e3['sendStatus'](0xc8);}})[_0x6d01('0x2e')](handleError(_0x1dc9e3,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 86d9122..994945b 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 _0x52af=['../../mysqldb','MailMessage','setMaxListeners','update','remove','getUsers','setDataValue','Users','map','hasOwnProperty','hook','events','MailInteraction'];(function(_0x180a8d,_0x432a75){var _0xe5b5c8=function(_0x48a91d){while(--_0x48a91d){_0x180a8d['push'](_0x180a8d['shift']());}};_0xe5b5c8(++_0x432a75);}(_0x52af,0x102));var _0xf52a=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x52af[_0x1cc8fe];return _0x230054;};'use strict';var EventEmitter=require(_0xf52a('0x0'));var MailInteraction=require('../../mysqldb')['db'][_0xf52a('0x1')];var MailMessage=require(_0xf52a('0x2'))['db'][_0xf52a('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xf52a('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf52a('0x5'),'afterDestroy':_0xf52a('0x6')};function emitEvent(_0xce0c07){return function(_0x50cf54,_0xf977cb,_0x455ae8){_0x50cf54[_0xf52a('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x4c8ecc){_0x50cf54[_0xf52a('0x8')](_0xf52a('0x9'),_0x4c8ecc[_0xf52a('0xa')](function(_0x3c848c){return{'id':_0x3c848c['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x50cf54['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x2f5061){_0x50cf54[_0xf52a('0x8')]('unreadMessages',_0x2f5061['length']);MailInteractionEvents['emit'](_0xce0c07+':'+_0x50cf54['id'],_0x50cf54);MailInteractionEvents['emit'](_0xce0c07,_0x50cf54);_0x455ae8(null);})['catch'](_0x455ae8(null));};}for(var e in events){if(events[_0xf52a('0xb')](e)){var event=events[e];MailInteraction[_0xf52a('0xc')](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file +var _0xc630=['getUsers','then','setDataValue','Users','map','findAll','emit','hook','exports','events','../../mysqldb','MailInteraction','setMaxListeners','save','update'];(function(_0x2dadd3,_0x4556df){var _0x5a4221=function(_0x5b2dc8){while(--_0x5b2dc8){_0x2dadd3['push'](_0x2dadd3['shift']());}};_0x5a4221(++_0x4556df);}(_0xc630,0xea));var _0x0c63=function(_0x1e3b8c,_0x291f35){_0x1e3b8c=_0x1e3b8c-0x0;var _0x59c81e=_0xc630[_0x1e3b8c];return _0x59c81e;};'use strict';var EventEmitter=require(_0x0c63('0x0'));var MailInteraction=require(_0x0c63('0x1'))['db'][_0x0c63('0x2')];var MailMessage=require(_0x0c63('0x1'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x0c63('0x3')](0x0);var events={'afterCreate':_0x0c63('0x4'),'afterUpdate':_0x0c63('0x5'),'afterDestroy':'remove'};function emitEvent(_0x3a8aa9){return function(_0x5abd55,_0x4afcf6,_0x56c46b){_0x5abd55[_0x0c63('0x6')]({'attributes':['id'],'raw':!![]})[_0x0c63('0x7')](function(_0xa80f2f){_0x5abd55[_0x0c63('0x8')](_0x0c63('0x9'),_0xa80f2f[_0x0c63('0xa')](function(_0x48fcb9){return{'id':_0x48fcb9['id']};}));return MailMessage[_0x0c63('0xb')]({'where':{'MailInteractionId':_0x5abd55['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x3cfb3d){_0x5abd55['setDataValue']('unreadMessages',_0x3cfb3d['length']);MailInteractionEvents[_0x0c63('0xc')](_0x3a8aa9+':'+_0x5abd55['id'],_0x5abd55);MailInteractionEvents[_0x0c63('0xc')](_0x3a8aa9,_0x5abd55);_0x56c46b(null);})['catch'](_0x56c46b(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0x0c63('0xd')](e,emitEvent(event));}}module[_0x0c63('0xe')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index bd95621..c966b36 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 _0x9eff=['bluebird','request-promise','path','rimraf','MailInteraction','mail_interactions','fti_mail_interactions','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','models','get','MailMessage','update','then','catch','utf8mb4_unicode_ci','lodash','../../config/logger'];(function(_0x1be09f,_0xb732f2){var _0x1bf439=function(_0x1320c2){while(--_0x1320c2){_0x1be09f['push'](_0x1be09f['shift']());}};_0x1bf439(++_0xb732f2);}(_0x9eff,0x8e));var _0xf9ef=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x9eff[_0x178e48];return _0x440d7e;};'use strict';var _=require(_0xf9ef('0x0'));var util=require('util');var logger=require(_0xf9ef('0x1'))('api');var moment=require('moment');var BPromise=require(_0xf9ef('0x2'));var rp=require(_0xf9ef('0x3'));var fs=require('fs');var path=require(_0xf9ef('0x4'));var rimraf=require(_0xf9ef('0x5'));var config=require('../../config/environment');var attributes=require('./mailInteraction.attributes');module['exports']=function(_0x41767d,_0x2515c6){return _0x41767d['define'](_0xf9ef('0x6'),attributes,{'tableName':_0xf9ef('0x7'),'paranoid':![],'indexes':[{'name':_0xf9ef('0x8'),'fields':['subject','to'],'type':_0xf9ef('0x9')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x273ec9,_0x1f9272,_0x45cf1e){if(_0x273ec9[_0xf9ef('0xa')]){_0x273ec9[_0xf9ef('0xb')]=moment()[_0xf9ef('0xc')](_0xf9ef('0xd'));}if(_0x273ec9[_0xf9ef('0xe')]){_0x273ec9[_0xf9ef('0xf')]=moment()[_0xf9ef('0xc')](_0xf9ef('0xd'));}_0x45cf1e(null,_0x1f9272);},'beforeUpdate':function(_0x4ed7d8,_0x272584,_0x3540c4){if(_0x4ed7d8[_0xf9ef('0x10')](_0xf9ef('0xa'))){_0x4ed7d8[_0xf9ef('0xb')]=_0x4ed7d8[_0xf9ef('0xa')]?moment()[_0xf9ef('0xc')](_0xf9ef('0xd')):null;}if(_0x4ed7d8[_0xf9ef('0x10')](_0xf9ef('0xe'))){_0x4ed7d8[_0xf9ef('0xf')]=moment()[_0xf9ef('0xc')](_0xf9ef('0xd'));_0x4ed7d8[_0xf9ef('0xa')]=null;_0x4ed7d8[_0xf9ef('0xb')]=null;}_0x3540c4(null,_0x4ed7d8);},'afterUpdate':function(_0x474467,_0x1c6424,_0x523970){var _0x55acb3=_0x41767d[_0xf9ef('0x11')];var _0xde93b8=_0x474467[_0xf9ef('0x12')]({'plain':!![]});if(_0xde93b8[_0xf9ef('0xe')]){return _0x55acb3[_0xf9ef('0x13')][_0xf9ef('0x14')]({'read':!![]},{'where':{'MailInteractionId':_0xde93b8['id']}})[_0xf9ef('0x15')](function(){_0x523970();})[_0xf9ef('0x16')](function(_0x35db10){_0x523970(_0x35db10);});}else{_0x523970();}}},'charset':'utf8mb4','collate':_0xf9ef('0x17')});}; \ No newline at end of file +var _0xe961=['../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','define','MailInteraction','mail_interactions','fti_mail_interactions','FULLTEXT','substatus','substatusAt','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','models','update','catch','utf8mb4','utf8mb4_unicode_ci','util'];(function(_0x5c78d9,_0x2736c7){var _0x69ae1f=function(_0x4b31ac){while(--_0x4b31ac){_0x5c78d9['push'](_0x5c78d9['shift']());}};_0x69ae1f(++_0x2736c7);}(_0xe961,0x1af));var _0x1e96=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xe961[_0x4154a6];return _0x3b2786;};'use strict';var _=require('lodash');var util=require(_0x1e96('0x0'));var logger=require(_0x1e96('0x1'))('api');var moment=require('moment');var BPromise=require(_0x1e96('0x2'));var rp=require(_0x1e96('0x3'));var fs=require('fs');var path=require(_0x1e96('0x4'));var rimraf=require(_0x1e96('0x5'));var config=require(_0x1e96('0x6'));var attributes=require(_0x1e96('0x7'));module['exports']=function(_0x27d348,_0x3c44fd){return _0x27d348[_0x1e96('0x8')](_0x1e96('0x9'),attributes,{'tableName':_0x1e96('0xa'),'paranoid':![],'indexes':[{'name':_0x1e96('0xb'),'fields':['subject','to'],'type':_0x1e96('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x17db9d,_0x1a9e04,_0x4d86f2){if(_0x17db9d[_0x1e96('0xd')]){_0x17db9d[_0x1e96('0xe')]=moment()['format'](_0x1e96('0xf'));}if(_0x17db9d[_0x1e96('0x10')]){_0x17db9d[_0x1e96('0x11')]=moment()['format'](_0x1e96('0xf'));}_0x4d86f2(null,_0x1a9e04);},'beforeUpdate':function(_0x273e2a,_0x2bf072,_0x9c30de){if(_0x273e2a[_0x1e96('0x12')](_0x1e96('0xd'))){_0x273e2a[_0x1e96('0xe')]=_0x273e2a[_0x1e96('0xd')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x273e2a[_0x1e96('0x12')](_0x1e96('0x10'))){_0x273e2a[_0x1e96('0x11')]=moment()['format'](_0x1e96('0xf'));_0x273e2a['substatus']=null;_0x273e2a[_0x1e96('0xe')]=null;}_0x9c30de(null,_0x273e2a);},'afterUpdate':function(_0x2ff7d9,_0x1dd3a9,_0x9ef74){var _0x5d1129=_0x27d348[_0x1e96('0x13')];var _0x3bba90=_0x2ff7d9['get']({'plain':!![]});if(_0x3bba90[_0x1e96('0x10')]){return _0x5d1129['MailMessage'][_0x1e96('0x14')]({'read':!![]},{'where':{'MailInteractionId':_0x3bba90['id']}})['then'](function(){_0x9ef74();})[_0x1e96('0x15')](function(_0x12df77){_0x9ef74(_0x12df77);});}else{_0x9ef74();}}},'charset':_0x1e96('0x16'),'collate':_0x1e96('0x17')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index b55fc4c..ca71b0b 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 _0xac8f=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./mailInteraction.socket','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','error','code','message','catch','UpdateMailInteraction','MailInteraction','update','options','raw','attributes','limit','stringify','find','where','body','omit','spread','AddTags','lodash','util','moment'];(function(_0x286726,_0x20a337){var _0xcd4fe9=function(_0x4d7da6){while(--_0x4d7da6){_0x286726['push'](_0x286726['shift']());}};_0xcd4fe9(++_0x20a337);}(_0xac8f,0x1d6));var _0xfac8=function(_0x1d70db,_0x142b63){_0x1d70db=_0x1d70db-0x0;var _0x3060c6=_0xac8f[_0x1d70db];return _0x3060c6;};'use strict';var _=require(_0xfac8('0x0'));var util=require(_0xfac8('0x1'));var moment=require(_0xfac8('0x2'));var BPromise=require(_0xfac8('0x3'));var rs=require(_0xfac8('0x4'));var fs=require('fs');var Redis=require(_0xfac8('0x5'));var db=require(_0xfac8('0x6'))['db'];var utils=require(_0xfac8('0x7'));var logger=require(_0xfac8('0x8'))(_0xfac8('0x9'));var config=require(_0xfac8('0xa'));var jayson=require(_0xfac8('0xb'));var client=jayson[_0xfac8('0xc')][_0xfac8('0xd')]({'port':0x232a});config[_0xfac8('0xe')]=_[_0xfac8('0xf')](config[_0xfac8('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0xfac8('0x10'))(new Redis(config[_0xfac8('0xe')]));require(_0xfac8('0x11'))['register'](socket);function respondWithRpcPromise(_0x5f590c,_0x3afe4d,_0x361986){return new BPromise(function(_0x343e10,_0x4be757){return client[_0xfac8('0x12')](_0x5f590c,_0x361986)[_0xfac8('0x13')](function(_0x2bc6fc){logger[_0xfac8('0x14')](_0xfac8('0x15'),_0x3afe4d,_0xfac8('0x16'));logger[_0xfac8('0x17')](_0xfac8('0x18'),_0x3afe4d,_0xfac8('0x16'),JSON['stringify'](_0x2bc6fc));if(_0x2bc6fc[_0xfac8('0x19')]){if(_0x2bc6fc['error'][_0xfac8('0x1a')]===0x1f4){logger[_0xfac8('0x19')]('MailInteraction,\x20%s,\x20%s',_0x3afe4d,_0x2bc6fc['error'][_0xfac8('0x1b')]);return _0x4be757(_0x2bc6fc[_0xfac8('0x19')]['message']);}logger[_0xfac8('0x19')](_0xfac8('0x15'),_0x3afe4d,_0x2bc6fc[_0xfac8('0x19')][_0xfac8('0x1b')]);return _0x343e10(_0x2bc6fc[_0xfac8('0x19')][_0xfac8('0x1b')]);}else{logger[_0xfac8('0x14')](_0xfac8('0x15'),_0x3afe4d,_0xfac8('0x16'));_0x343e10(_0x2bc6fc['result'][_0xfac8('0x1b')]);}})[_0xfac8('0x1c')](function(_0x202b49){logger[_0xfac8('0x19')](_0xfac8('0x15'),_0x3afe4d,_0x202b49);_0x4be757(_0x202b49);});});}exports[_0xfac8('0x1d')]=function(_0x2ca3f0){var _0x1eae50=this;return new Promise(function(_0x47da57,_0x17a4f0){return db[_0xfac8('0x1e')][_0xfac8('0x1f')](_0x2ca3f0['body'],{'raw':_0x2ca3f0[_0xfac8('0x20')]?_0x2ca3f0[_0xfac8('0x20')][_0xfac8('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ca3f0[_0xfac8('0x20')]?_0x2ca3f0['options']['where']||null:null,'attributes':_0x2ca3f0[_0xfac8('0x20')]?_0x2ca3f0[_0xfac8('0x20')][_0xfac8('0x22')]||null:null,'limit':_0x2ca3f0['options']?_0x2ca3f0[_0xfac8('0x20')][_0xfac8('0x23')]||null:null})[_0xfac8('0x13')](function(_0x1491c7){logger[_0xfac8('0x14')]('UpdateMailInteraction',_0x2ca3f0);logger[_0xfac8('0x17')](_0xfac8('0x1d'),_0x2ca3f0,JSON[_0xfac8('0x24')](_0x1491c7));_0x47da57(_0x1491c7);})[_0xfac8('0x1c')](function(_0x5206e9){logger[_0xfac8('0x19')](_0xfac8('0x1d'),_0x5206e9[_0xfac8('0x1b')],_0x2ca3f0);_0x17a4f0(_0x1eae50[_0xfac8('0x19')](0x1f4,_0x5206e9[_0xfac8('0x1b')]));});});};exports['AddTagsToMailInteraction']=function(_0x5a2638){return new Promise(function(_0x54c968,_0x154d1b){return db['MailInteraction'][_0xfac8('0x25')]({'where':_0x5a2638[_0xfac8('0x20')]?_0x5a2638[_0xfac8('0x20')][_0xfac8('0x26')]||null:null})[_0xfac8('0x13')](function(_0x18ad24){if(_0x18ad24){return _0x18ad24['addTags'](_0x5a2638[_0xfac8('0x27')]['ids'],_[_0xfac8('0x28')](_0x5a2638['body'],['ids','id'])||{});}})[_0xfac8('0x29')](function(_0xe44f0b){logger[_0xfac8('0x14')]('AddTags',_0x5a2638);logger['debug'](_0xfac8('0x2a'),_0x5a2638,JSON[_0xfac8('0x24')](_0xe44f0b));_0x54c968(_0xe44f0b);})[_0xfac8('0x1c')](function(_0x21b28c){logger[_0xfac8('0x19')](_0xfac8('0x2a'),_0x21b28c[_0xfac8('0x1b')],_0x5a2638);_0x154d1b(_this['error'](0x1f4,_0x21b28c[_0xfac8('0x1b')]));});});}; \ No newline at end of file +var _0xefe2=['message','catch','UpdateMailInteraction','MailInteraction','update','body','options','raw','where','attributes','AddTagsToMailInteraction','find','addTags','ids','omit','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./mailInteraction.socket','register','then','info','MailInteraction,\x20%s,\x20%s','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','code','error'];(function(_0x172abc,_0x16b3d8){var _0x326385=function(_0x5803bd){while(--_0x5803bd){_0x172abc['push'](_0x172abc['shift']());}};_0x326385(++_0x16b3d8);}(_0xefe2,0x178));var _0x2efe=function(_0x570fff,_0x145cff){_0x570fff=_0x570fff-0x0;var _0x4b1a44=_0xefe2[_0x570fff];return _0x4b1a44;};'use strict';var _=require(_0x2efe('0x0'));var util=require(_0x2efe('0x1'));var moment=require('moment');var BPromise=require(_0x2efe('0x2'));var rs=require(_0x2efe('0x3'));var fs=require('fs');var Redis=require(_0x2efe('0x4'));var db=require(_0x2efe('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2efe('0x6'))(_0x2efe('0x7'));var config=require(_0x2efe('0x8'));var jayson=require(_0x2efe('0x9'));var client=jayson[_0x2efe('0xa')][_0x2efe('0xb')]({'port':0x232a});config[_0x2efe('0xc')]=_['defaults'](config[_0x2efe('0xc')],{'host':_0x2efe('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2efe('0xc')]));require(_0x2efe('0xe'))[_0x2efe('0xf')](socket);function respondWithRpcPromise(_0x4f3648,_0x4f402e,_0x32eca4){return new BPromise(function(_0x121fbb,_0x60f280){return client['request'](_0x4f3648,_0x32eca4)[_0x2efe('0x10')](function(_0x25e1ac){logger[_0x2efe('0x11')](_0x2efe('0x12'),_0x4f402e,'request\x20sent');logger[_0x2efe('0x13')](_0x2efe('0x14'),_0x4f402e,'request\x20sent',JSON[_0x2efe('0x15')](_0x25e1ac));if(_0x25e1ac['error']){if(_0x25e1ac['error'][_0x2efe('0x16')]===0x1f4){logger['error'](_0x2efe('0x12'),_0x4f402e,_0x25e1ac[_0x2efe('0x17')][_0x2efe('0x18')]);return _0x60f280(_0x25e1ac[_0x2efe('0x17')]['message']);}logger[_0x2efe('0x17')]('MailInteraction,\x20%s,\x20%s',_0x4f402e,_0x25e1ac[_0x2efe('0x17')]['message']);return _0x121fbb(_0x25e1ac['error'][_0x2efe('0x18')]);}else{logger[_0x2efe('0x11')](_0x2efe('0x12'),_0x4f402e,'request\x20sent');_0x121fbb(_0x25e1ac['result'][_0x2efe('0x18')]);}})[_0x2efe('0x19')](function(_0x21d12e){logger[_0x2efe('0x17')](_0x2efe('0x12'),_0x4f402e,_0x21d12e);_0x60f280(_0x21d12e);});});}exports[_0x2efe('0x1a')]=function(_0x346cad){var _0x5e11ea=this;return new Promise(function(_0x5fe657,_0x2b316b){return db[_0x2efe('0x1b')][_0x2efe('0x1c')](_0x346cad[_0x2efe('0x1d')],{'raw':_0x346cad[_0x2efe('0x1e')]?_0x346cad[_0x2efe('0x1e')][_0x2efe('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x346cad['options']?_0x346cad[_0x2efe('0x1e')][_0x2efe('0x20')]||null:null,'attributes':_0x346cad['options']?_0x346cad['options'][_0x2efe('0x21')]||null:null,'limit':_0x346cad[_0x2efe('0x1e')]?_0x346cad[_0x2efe('0x1e')]['limit']||null:null})[_0x2efe('0x10')](function(_0x400e64){logger[_0x2efe('0x11')](_0x2efe('0x1a'),_0x346cad);logger['debug'](_0x2efe('0x1a'),_0x346cad,JSON[_0x2efe('0x15')](_0x400e64));_0x5fe657(_0x400e64);})['catch'](function(_0x4a8a39){logger[_0x2efe('0x17')](_0x2efe('0x1a'),_0x4a8a39['message'],_0x346cad);_0x2b316b(_0x5e11ea[_0x2efe('0x17')](0x1f4,_0x4a8a39['message']));});});};exports[_0x2efe('0x22')]=function(_0x2db43d){return new Promise(function(_0x5ed680,_0x13bb84){return db['MailInteraction'][_0x2efe('0x23')]({'where':_0x2db43d['options']?_0x2db43d[_0x2efe('0x1e')][_0x2efe('0x20')]||null:null})[_0x2efe('0x10')](function(_0x3dfd30){if(_0x3dfd30){return _0x3dfd30[_0x2efe('0x24')](_0x2db43d[_0x2efe('0x1d')][_0x2efe('0x25')],_[_0x2efe('0x26')](_0x2db43d['body'],[_0x2efe('0x25'),'id'])||{});}})['spread'](function(_0x54aaa0){logger[_0x2efe('0x11')](_0x2efe('0x27'),_0x2db43d);logger[_0x2efe('0x13')](_0x2efe('0x27'),_0x2db43d,JSON[_0x2efe('0x15')](_0x54aaa0));_0x5ed680(_0x54aaa0);})[_0x2efe('0x19')](function(_0x24107d){logger[_0x2efe('0x17')](_0x2efe('0x27'),_0x24107d[_0x2efe('0x18')],_0x2db43d);_0x13bb84(_this[_0x2efe('0x17')](0x1f4,_0x24107d[_0x2efe('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 86c8413..38ab875 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 _0xd443=['emit','removeListener','register','length','./mailInteraction.events','save','remove','update'];(function(_0x48def,_0x4840e6){var _0x3af853=function(_0x3e6aa0){while(--_0x3e6aa0){_0x48def['push'](_0x48def['shift']());}};_0x3af853(++_0x4840e6);}(_0xd443,0x15c));var _0x3d44=function(_0x25700c,_0x543afc){_0x25700c=_0x25700c-0x0;var _0x2fb64a=_0xd443[_0x25700c];return _0x2fb64a;};'use strict';var MailInteractionEvents=require(_0x3d44('0x0'));var events=[_0x3d44('0x1'),_0x3d44('0x2'),_0x3d44('0x3')];function createListener(_0x13cf62,_0x25ed65){return function(_0x224431){_0x25ed65[_0x3d44('0x4')](_0x13cf62,_0x224431);};}function removeListener(_0x1b3a42,_0xdde386){return function(){MailInteractionEvents[_0x3d44('0x5')](_0x1b3a42,_0xdde386);};}exports[_0x3d44('0x6')]=function(_0x4e642d){for(var _0x51b529=0x0,_0x2f6e99=events[_0x3d44('0x7')];_0x51b529<_0x2f6e99;_0x51b529++){var _0xb482e2=events[_0x51b529];var _0x53b489=createListener('mailInteraction:'+_0xb482e2,_0x4e642d);MailInteractionEvents['on'](_0xb482e2,_0x53b489);}}; \ No newline at end of file +var _0x653d=['remove','update','removeListener','register','length','mailInteraction:','./mailInteraction.events'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x653d,0xdf));var _0xd653=function(_0x121336,_0x3370ea){_0x121336=_0x121336-0x0;var _0x53ff9f=_0x653d[_0x121336];return _0x53ff9f;};'use strict';var MailInteractionEvents=require(_0xd653('0x0'));var events=['save',_0xd653('0x1'),_0xd653('0x2')];function createListener(_0xd33897,_0x63efd6){return function(_0x38cce8){_0x63efd6['emit'](_0xd33897,_0x38cce8);};}function removeListener(_0x2954db,_0x3033dc){return function(){MailInteractionEvents[_0xd653('0x3')](_0x2954db,_0x3033dc);};}exports[_0xd653('0x4')]=function(_0x292ec1){for(var _0x11902a=0x0,_0xd73b50=events[_0xd653('0x5')];_0x11902a<_0xd73b50;_0x11902a++){var _0x29198b=events[_0x11902a];var _0xb4e0f7=createListener(_0xd653('0x6')+_0x29198b,_0x292ec1);MailInteractionEvents['on'](_0x29198b,_0xb4e0f7);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 3ebc746..9154f7b 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 _0x1841=['describe','/:id','show','/:id/download','download','post','tracked','mail','create','put','update','/:id/accept','accept','destroy','exports','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe'];(function(_0x3ccfea,_0x44ffb3){var _0x3a530f=function(_0x7c4323){while(--_0x7c4323){_0x3ccfea['push'](_0x3ccfea['shift']());}};_0x3a530f(++_0x44ffb3);}(_0x1841,0xdf));var _0x1184=function(_0x54300d,_0x5b8bbd){_0x54300d=_0x54300d-0x0;var _0x75eff=_0x1841[_0x54300d];return _0x75eff;};'use strict';var multer=require('multer');var util=require(_0x1184('0x0'));var path=require(_0x1184('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1184('0x2')]();var fs_extra=require(_0x1184('0x3'));var auth=require(_0x1184('0x4'));var interaction=require(_0x1184('0x5'));var config=require(_0x1184('0x6'));var controller=require('./mailMessage.controller');router[_0x1184('0x7')]('/',auth[_0x1184('0x8')](),controller[_0x1184('0x9')]);router[_0x1184('0x7')](_0x1184('0xa'),auth[_0x1184('0x8')](),controller[_0x1184('0xb')]);router[_0x1184('0x7')](_0x1184('0xc'),auth[_0x1184('0x8')](),controller[_0x1184('0xd')]);router[_0x1184('0x7')](_0x1184('0xe'),auth[_0x1184('0x8')](),controller[_0x1184('0xf')]);router[_0x1184('0x10')]('/',auth[_0x1184('0x8')](),interaction[_0x1184('0x11')](_0x1184('0x12'),'mailmessage:create'),controller[_0x1184('0x13')]);router[_0x1184('0x14')](_0x1184('0xc'),auth[_0x1184('0x8')](),controller[_0x1184('0x15')]);router['put'](_0x1184('0x16'),auth[_0x1184('0x8')](),controller[_0x1184('0x17')]);router['put']('/:id/reject',auth[_0x1184('0x8')](),controller['reject']);router['delete'](_0x1184('0xc'),auth[_0x1184('0x8')](),controller[_0x1184('0x18')]);module[_0x1184('0x19')]=router; \ No newline at end of file +var _0x8b30=['./mailMessage.controller','get','isAuthenticated','index','/describe','describe','show','/:id/download','download','post','mail','mailmessage:create','create','/:id','update','put','/:id/accept','/:id/reject','reject','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x8b30,0x1c7));var _0x08b3=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0x8b30[_0xd1d19a];return _0x52a79d;};'use strict';var multer=require(_0x08b3('0x0'));var util=require(_0x08b3('0x1'));var path=require(_0x08b3('0x2'));var timeout=require(_0x08b3('0x3'));var express=require(_0x08b3('0x4'));var router=express[_0x08b3('0x5')]();var fs_extra=require(_0x08b3('0x6'));var auth=require(_0x08b3('0x7'));var interaction=require(_0x08b3('0x8'));var config=require(_0x08b3('0x9'));var controller=require(_0x08b3('0xa'));router[_0x08b3('0xb')]('/',auth[_0x08b3('0xc')](),controller[_0x08b3('0xd')]);router['get'](_0x08b3('0xe'),auth[_0x08b3('0xc')](),controller[_0x08b3('0xf')]);router[_0x08b3('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x08b3('0x10')]);router[_0x08b3('0xb')](_0x08b3('0x11'),auth[_0x08b3('0xc')](),controller[_0x08b3('0x12')]);router[_0x08b3('0x13')]('/',auth[_0x08b3('0xc')](),interaction['tracked'](_0x08b3('0x14'),_0x08b3('0x15')),controller[_0x08b3('0x16')]);router['put'](_0x08b3('0x17'),auth[_0x08b3('0xc')](),controller[_0x08b3('0x18')]);router[_0x08b3('0x19')](_0x08b3('0x1a'),auth[_0x08b3('0xc')](),controller['accept']);router[_0x08b3('0x19')](_0x08b3('0x1b'),auth[_0x08b3('0xc')](),controller[_0x08b3('0x1c')]);router['delete']('/:id',auth[_0x08b3('0xc')](),controller[_0x08b3('0x1d')]);module[_0x08b3('0x1e')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index d5aa4ef..76d56d2 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 _0xa01e=['TEXT','medium','BOOLEAN','ENUM','out','STRING','long','DATE','Email','Chat','lodash'];(function(_0x5816c3,_0x716e32){var _0x4eb1bb=function(_0x47b97d){while(--_0x47b97d){_0x5816c3['push'](_0x5816c3['shift']());}};_0x4eb1bb(++_0x716e32);}(_0xa01e,0x175));var _0xea01=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xa01e[_0x220dbb];return _0x2b77de;};'use strict';var Sequelize=require('sequelize');var _=require(_0xea01('0x0'));module['exports']={'body':{'type':Sequelize[_0xea01('0x1')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0xea01('0x1')](_0xea01('0x2'))},'read':{'type':Sequelize[_0xea01('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xea01('0x4')]('in',_0xea01('0x5')),'defaultValue':_0xea01('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0xea01('0x6')]},'to':{'type':Sequelize[_0xea01('0x1')](_0xea01('0x7'))},'cc':{'type':Sequelize[_0xea01('0x1')](_0xea01('0x7'))},'bcc':{'type':Sequelize[_0xea01('0x1')](_0xea01('0x7'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0xea01('0x8')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0xea01('0x8')]},'originTo':{'type':Sequelize[_0xea01('0x1')]('long')},'originCc':{'type':Sequelize[_0xea01('0x1')](_0xea01('0x7'))},'originChannel':{'type':Sequelize['ENUM'](_0xea01('0x9'),_0xea01('0xa')),'defaultValue':_0xea01('0x9'),'allowNull':![]}}; \ No newline at end of file +var _0xbf11=['Chat','sequelize','exports','TEXT','long','ENUM','out','STRING','DATE','INTEGER','BOOLEAN','Email'];(function(_0x3b19ae,_0x139b7c){var _0x416e0c=function(_0x51f968){while(--_0x51f968){_0x3b19ae['push'](_0x3b19ae['shift']());}};_0x416e0c(++_0x139b7c);}(_0xbf11,0x91));var _0x1bf1=function(_0x40ce4f,_0x3cf557){_0x40ce4f=_0x40ce4f-0x0;var _0xb9b23d=_0xbf11[_0x40ce4f];return _0xb9b23d;};'use strict';var Sequelize=require(_0x1bf1('0x0'));var _=require('lodash');module[_0x1bf1('0x1')]={'body':{'type':Sequelize[_0x1bf1('0x2')](_0x1bf1('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x1bf1('0x2')]('medium')},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x1bf1('0x4')]('in','out'),'defaultValue':_0x1bf1('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x1bf1('0x6')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x1bf1('0x2')](_0x1bf1('0x3'))},'cc':{'type':Sequelize['TEXT'](_0x1bf1('0x3'))},'bcc':{'type':Sequelize[_0x1bf1('0x2')](_0x1bf1('0x3'))},'subject':{'type':Sequelize[_0x1bf1('0x2')]},'sentAt':{'type':Sequelize[_0x1bf1('0x7')]},'attach':{'type':Sequelize[_0x1bf1('0x8')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x1bf1('0x9')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x1bf1('0x7')]},'originTo':{'type':Sequelize[_0x1bf1('0x2')](_0x1bf1('0x3'))},'originCc':{'type':Sequelize[_0x1bf1('0x2')](_0x1bf1('0x3'))},'originChannel':{'type':Sequelize[_0x1bf1('0x4')](_0x1bf1('0xa'),_0x1bf1('0xb')),'defaultValue':_0x1bf1('0xa'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 8469006..31e20ac 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 _0xe963=['User','fullname','EventManager','rejectmessage','download','server','files','tmp','root','message-%s.eml','from','bcc','subject','createdAt','Attachment','Attachments','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','push','readFileSync','build','writeFileSync','unlinkSync','eml-format','moment','bluebird','util','path','lodash','../../config/logger','api','mail-interactions','../../config/environment','localhost','socket.io-emitter','redis','html-entities','register','jayson/promise','client','http','request','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','MailMessage,\x20%s,\x20%s','result','catch','json','limit','undefined','count','offset','status','set','Content-Range','update','then','end','sendStatus','stack','name','send','map','MailMessage','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','include','find','body','destroy','describe','create','direction','out','split','MailAccount','findOne','MailAccountId','CmList','CmContact','Contacts','updatedAt','DESC','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','server/files/attachments','List','defaults','List\x20not\x20found','messageId','format','accept','mail','read','readAt','UserId','user','agent','get','isNil','YYYY-MM-DD\x20HH:mm:ss','[MAILMESSAGE: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','sequelize','Sequelize','QueryTypes','SELECT','contact','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','fromString','reject','MailInteraction','MailInteractionId','rejectMessage','ContactId'];(function(_0x1daed2,_0x1eef84){var _0x510f05=function(_0x38006f){while(--_0x38006f){_0x1daed2['push'](_0x1daed2['shift']());}};_0x510f05(++_0x1eef84);}(_0xe963,0x15c));var _0x3e96=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe963[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x3e96('0x0'));var moment=require(_0x3e96('0x1'));var BPromise=require(_0x3e96('0x2'));var util=require(_0x3e96('0x3'));var path=require(_0x3e96('0x4'));var fs=require('fs');var _=require(_0x3e96('0x5'));var Redis=require('ioredis');var htmlToText=require('html-to-text');var qs=require('../../components/parsers/qs');var logger=require(_0x3e96('0x6'))(_0x3e96('0x7'));var interaction_log=require(_0x3e96('0x6'))(_0x3e96('0x8'));var config=require(_0x3e96('0x9'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x3e96('0xa'),'port':0x18eb});var socket=require(_0x3e96('0xb'))(new Redis(config[_0x3e96('0xc')]));var htmlEntities=require(_0x3e96('0xd'));require('./mailMessage.socket')[_0x3e96('0xe')](socket);var jayson=require(_0x3e96('0xf'));var client=jayson[_0x3e96('0x10')]['http']({'port':0x232c});var client9003=jayson[_0x3e96('0x10')][_0x3e96('0x11')]({'port':0x232b});var client9002=jayson[_0x3e96('0x10')][_0x3e96('0x11')]({'port':0x232a});function respondWithRpcPromise(_0xb0edbe,_0x4102e9,_0x20b0ea,_0x49ae48){return new BPromise(function(_0x20c36d,_0x663604){var _0x4c7d88=_0x49ae48||client;return _0x4c7d88[_0x3e96('0x12')](_0xb0edbe,_0x20b0ea)['then'](function(_0x2d205f){logger[_0x3e96('0x13')]('MailMessage,\x20%s,\x20%s',_0x4102e9,_0x3e96('0x14'));logger[_0x3e96('0x15')](_0x3e96('0x16'),_0x4102e9,_0x3e96('0x14'),JSON[_0x3e96('0x17')](_0x2d205f));if(_0x2d205f[_0x3e96('0x18')]){if(_0x2d205f[_0x3e96('0x18')]['code']===0x1f4){logger[_0x3e96('0x18')]('MailMessage,\x20%s,\x20%s',_0x4102e9,_0x2d205f['error'][_0x3e96('0x19')]);return _0x663604(_0x2d205f[_0x3e96('0x18')][_0x3e96('0x19')]);}logger[_0x3e96('0x18')](_0x3e96('0x1a'),_0x4102e9,_0x2d205f[_0x3e96('0x18')]['message']);return _0x20c36d(_0x2d205f[_0x3e96('0x18')][_0x3e96('0x19')]);}else{logger['info']('MailMessage,\x20%s,\x20%s',_0x4102e9,'request\x20sent');_0x20c36d(_0x2d205f[_0x3e96('0x1b')][_0x3e96('0x19')]);}})[_0x3e96('0x1c')](function(_0x3a456f){logger[_0x3e96('0x18')](_0x3e96('0x1a'),_0x4102e9,_0x3a456f);_0x663604(_0x3a456f);});});}function respondWithResult(_0x1c2071,_0x4cc9c3){_0x4cc9c3=_0x4cc9c3||0xc8;return function(_0x38ba0e){if(_0x38ba0e){return _0x1c2071['status'](_0x4cc9c3)[_0x3e96('0x1d')](_0x38ba0e);}};}function respondWithFilteredResult(_0x9ba8c4,_0x447053){return function(_0x7ca362){if(_0x7ca362){var _0x162768=typeof _0x447053['offset']==='undefined'&&typeof _0x447053[_0x3e96('0x1e')]===_0x3e96('0x1f');var _0x4d9408=_0x7ca362[_0x3e96('0x20')];var _0x485185=_0x162768?0x0:_0x447053[_0x3e96('0x21')];var _0x524f3a=_0x162768?_0x7ca362['count']:_0x447053[_0x3e96('0x21')]+_0x447053[_0x3e96('0x1e')];var _0x4fdf09;if(_0x524f3a>=_0x4d9408){_0x524f3a=_0x4d9408;_0x4fdf09=0xc8;}else{_0x4fdf09=0xce;}_0x9ba8c4[_0x3e96('0x22')](_0x4fdf09);return _0x9ba8c4[_0x3e96('0x23')](_0x3e96('0x24'),_0x485185+'-'+_0x524f3a+'/'+_0x4d9408)[_0x3e96('0x1d')](_0x7ca362);}return null;};}function saveUpdates(_0x372b80){return function(_0x13cf2b){if(_0x13cf2b){return _0x13cf2b[_0x3e96('0x25')](_0x372b80)['then'](function(_0x1a6818){return _0x1a6818;});}return null;};}function removeEntity(_0x12c72f){return function(_0x3cfe89){if(_0x3cfe89){return _0x3cfe89['destroy']()[_0x3e96('0x26')](function(){_0x12c72f[_0x3e96('0x22')](0xcc)[_0x3e96('0x27')]();});}};}function handleEntityNotFound(_0x3cb673){return function(_0x17ac9c){if(!_0x17ac9c){_0x3cb673[_0x3e96('0x28')](0x194);}return _0x17ac9c;};}function handleError(_0x35fb6b,_0x28c7cc){_0x28c7cc=_0x28c7cc||0x1f4;return function(_0x27a623){logger[_0x3e96('0x18')](_0x27a623[_0x3e96('0x29')]);if(_0x27a623[_0x3e96('0x2a')]){delete _0x27a623[_0x3e96('0x2a')];}_0x35fb6b[_0x3e96('0x22')](_0x28c7cc)[_0x3e96('0x2b')](_0x27a623);};}exports['index']=function(_0x273275,_0x390a1c){var _0x170fc4={},_0x3f97f2={},_0x82d674={'count':0x0,'rows':[]};var _0x39129f=_[_0x3e96('0x2c')](db[_0x3e96('0x2d')][_0x3e96('0x2e')],function(_0x5268f6){return{'name':_0x5268f6[_0x3e96('0x2f')],'type':_0x5268f6[_0x3e96('0x30')][_0x3e96('0x31')]};});_0x3f97f2['model']=_['map'](_0x39129f,_0x3e96('0x2a'));_0x3f97f2[_0x3e96('0x32')]=_[_0x3e96('0x33')](_0x273275['query']);_0x3f97f2[_0x3e96('0x34')]=_['intersection'](_0x3f97f2['model'],_0x3f97f2[_0x3e96('0x32')]);_0x170fc4['attributes']=_[_0x3e96('0x35')](_0x3f97f2[_0x3e96('0x36')],qs[_0x3e96('0x37')](_0x273275[_0x3e96('0x32')]['fields']));_0x170fc4[_0x3e96('0x38')]=_0x170fc4[_0x3e96('0x38')][_0x3e96('0x39')]?_0x170fc4[_0x3e96('0x38')]:_0x3f97f2['model'];if(!_0x273275[_0x3e96('0x32')][_0x3e96('0x3a')]('nolimit')){_0x170fc4[_0x3e96('0x1e')]=qs[_0x3e96('0x1e')](_0x273275['query']['limit']);_0x170fc4['offset']=qs['offset'](_0x273275[_0x3e96('0x32')][_0x3e96('0x21')]);}_0x170fc4['order']=qs[_0x3e96('0x3b')](_0x273275['query']['sort']);_0x170fc4[_0x3e96('0x3c')]=qs[_0x3e96('0x34')](_['pick'](_0x273275[_0x3e96('0x32')],_0x3f97f2[_0x3e96('0x34')]),_0x39129f);if(_0x273275[_0x3e96('0x32')][_0x3e96('0x3d')]){_0x170fc4[_0x3e96('0x3c')]=_[_0x3e96('0x3e')](_0x170fc4['where'],{'$or':_['map'](_0x39129f,function(_0x1ab00f){if(_0x1ab00f[_0x3e96('0x30')]!==_0x3e96('0x3f')){var _0x4f14ef={};_0x4f14ef[_0x1ab00f[_0x3e96('0x2a')]]={'$like':'%'+_0x273275[_0x3e96('0x32')][_0x3e96('0x3d')]+'%'};return _0x4f14ef;}})});}_0x170fc4=_[_0x3e96('0x3e')]({},_0x170fc4,_0x273275[_0x3e96('0x40')]);var _0x3bdf2e={'where':_0x170fc4[_0x3e96('0x3c')]};return db[_0x3e96('0x2d')][_0x3e96('0x20')](_0x3bdf2e)['then'](function(_0x2bad51){_0x82d674[_0x3e96('0x20')]=_0x2bad51;if(_0x273275[_0x3e96('0x32')][_0x3e96('0x41')]){_0x170fc4['include']=[{'all':!![]}];}return db['MailMessage'][_0x3e96('0x42')](_0x170fc4);})[_0x3e96('0x26')](function(_0xbbd8c1){_0x82d674[_0x3e96('0x43')]=_0xbbd8c1;return _0x82d674;})['then'](respondWithFilteredResult(_0x390a1c,_0x170fc4))['catch'](handleError(_0x390a1c,null));};exports[_0x3e96('0x44')]=function(_0x3db5ba,_0x14fe5b){var _0x4980b0={'raw':!![],'where':{'id':_0x3db5ba[_0x3e96('0x45')]['id']}},_0x466092={};_0x466092[_0x3e96('0x36')]=_[_0x3e96('0x33')](db[_0x3e96('0x2d')][_0x3e96('0x2e')]);_0x466092[_0x3e96('0x32')]=_[_0x3e96('0x33')](_0x3db5ba[_0x3e96('0x32')]);_0x466092['filters']=_[_0x3e96('0x35')](_0x466092[_0x3e96('0x36')],_0x466092[_0x3e96('0x32')]);_0x4980b0[_0x3e96('0x38')]=_[_0x3e96('0x35')](_0x466092['model'],qs[_0x3e96('0x37')](_0x3db5ba[_0x3e96('0x32')][_0x3e96('0x37')]));_0x4980b0[_0x3e96('0x38')]=_0x4980b0['attributes'][_0x3e96('0x39')]?_0x4980b0['attributes']:_0x466092[_0x3e96('0x36')];if(_0x3db5ba[_0x3e96('0x32')][_0x3e96('0x41')]){_0x4980b0[_0x3e96('0x46')]=[{'all':!![]}];}_0x4980b0=_['merge']({},_0x4980b0,_0x3db5ba['options']);return db['MailMessage'][_0x3e96('0x47')](_0x4980b0)[_0x3e96('0x26')](handleEntityNotFound(_0x14fe5b,null))[_0x3e96('0x26')](respondWithResult(_0x14fe5b,null))[_0x3e96('0x1c')](handleError(_0x14fe5b,null));};exports[_0x3e96('0x25')]=function(_0x400f13,_0x10fd91){if(_0x400f13[_0x3e96('0x48')]['id']){delete _0x400f13['body']['id'];}return db[_0x3e96('0x2d')][_0x3e96('0x47')]({'where':{'id':_0x400f13['params']['id']}})['then'](handleEntityNotFound(_0x10fd91,null))[_0x3e96('0x26')](saveUpdates(_0x400f13['body'],null))[_0x3e96('0x26')](respondWithResult(_0x10fd91,null))[_0x3e96('0x1c')](handleError(_0x10fd91,null));};exports[_0x3e96('0x49')]=function(_0x821c96,_0x37a378){return db[_0x3e96('0x2d')][_0x3e96('0x47')]({'where':{'id':_0x821c96['params']['id']}})[_0x3e96('0x26')](handleEntityNotFound(_0x37a378,null))['then'](removeEntity(_0x37a378,null))[_0x3e96('0x1c')](handleError(_0x37a378,null));};exports[_0x3e96('0x4a')]=function(_0x131d32,_0x2ef0b9){return db[_0x3e96('0x2d')][_0x3e96('0x4a')]()[_0x3e96('0x26')](respondWithResult(_0x2ef0b9,null))[_0x3e96('0x1c')](handleError(_0x2ef0b9,null));};exports[_0x3e96('0x4b')]=function(_0x33bdeb,_0x1cd578){return db[_0x3e96('0x2d')]['create'](_0x33bdeb[_0x3e96('0x48')])[_0x3e96('0x26')](function(_0x1bb005){if(_0x1bb005){if(_0x1bb005[_0x3e96('0x4c')]===_0x3e96('0x4d')&&!_0x1bb005['secret']){var _0x265451,_0xfcac81,_0x46dd7e;if(_0x33bdeb[_0x3e96('0x48')]['to']){_0xfcac81=_0x33bdeb[_0x3e96('0x48')]['to'][_0x3e96('0x4e')](',')[0x0];}return db[_0x3e96('0x4f')][_0x3e96('0x50')]({'where':{'id':_0x1bb005[_0x3e96('0x51')]},'include':[{'model':db[_0x3e96('0x52')],'as':'List','include':[{'model':db[_0x3e96('0x53')],'as':_0x3e96('0x54'),'where':{'email':_0xfcac81},'limit':0x1,'order':[[_0x3e96('0x55'),_0x3e96('0x56')]]}]},{'model':db[_0x3e96('0x57')],'as':_0x3e96('0x58'),'raw':!![],'include':[{'model':db[_0x3e96('0x59')],'as':_0x3e96('0x59'),'raw':!![]}]}]})[_0x3e96('0x26')](function(_0x4d40f9){_0x265451=_0x4d40f9;if(!_0x265451||!_0x265451[_0x3e96('0x58')])return;var _0x132be6=_0x265451[_0x3e96('0x5a')]();if(_0x33bdeb[_0x3e96('0x48')]['attachments']&&_0x33bdeb[_0x3e96('0x48')]['attachments']['length']){for(var _0x36c274=0x0;_0x36c274<_0x33bdeb[_0x3e96('0x48')][_0x3e96('0x5b')][_0x3e96('0x39')];_0x36c274+=0x1){_0x33bdeb[_0x3e96('0x48')][_0x3e96('0x5b')][_0x36c274]={'filename':_0x33bdeb[_0x3e96('0x48')][_0x3e96('0x5b')][_0x36c274][_0x3e96('0x2a')],'path':path[_0x3e96('0x5c')](config['root'],_0x3e96('0x5d'),_0x33bdeb[_0x3e96('0x48')]['attachments'][_0x36c274]['basename'])};}}_0x46dd7e={'account':_0x132be6,'message':_0x33bdeb[_0x3e96('0x48')]};return;})['then'](function(){if(_0x265451[_0x3e96('0x5e')]){if(_0x265451[_0x3e96('0x5e')]['Contacts'][_0x3e96('0x39')]){return _0x265451[_0x3e96('0x5e')][_0x3e96('0x54')][0x0];}else{return db[_0x3e96('0x53')]['create'](_[_0x3e96('0x5f')](_0x33bdeb[_0x3e96('0x48')],{'firstName':_0x33bdeb['body']['to'],'email':_0x33bdeb[_0x3e96('0x48')]['to'],'phone':_0x33bdeb[_0x3e96('0x48')]['to'],'ListId':_0x265451['ListId']}));}}else{throw new Error(_0x3e96('0x60'));}})[_0x3e96('0x26')](function(){if(_0x46dd7e){return respondWithRpcPromise('SendMail','sendMail',_0x46dd7e,client9003)[_0x3e96('0x26')](function(_0x1a4394){return _0x1bb005[_0x3e96('0x25')]({'read':!![],'messageId':_0x1a4394[_0x3e96('0x61')],'sentAt':moment()[_0x3e96('0x62')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0x3e96('0x1c')](function(_0x329222){logger[_0x3e96('0x18')]('%s',JSON[_0x3e96('0x17')](_0x329222));return _0x1bb005;});}return _0x1bb005;});}return _0x1bb005;}})[_0x3e96('0x26')](respondWithResult(_0x1cd578,0xc9))['catch'](handleError(_0x1cd578,null));};exports[_0x3e96('0x63')]=function(_0x4e9d02,_0x48a3f3){var _0x194bb4={'agent':{},'channel':_0x3e96('0x64')};if(_0x4e9d02[_0x3e96('0x48')]['id']){delete _0x4e9d02[_0x3e96('0x48')]['id'];}_0x4e9d02[_0x3e96('0x48')][_0x3e96('0x65')]=!![];_0x4e9d02['body'][_0x3e96('0x66')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x4e9d02[_0x3e96('0x48')]['UserId']=_0x4e9d02['body'][_0x3e96('0x67')]||_0x4e9d02[_0x3e96('0x68')]['id'];_0x194bb4[_0x3e96('0x69')]['id']=_0x4e9d02['body'][_0x3e96('0x67')];return db['MailMessage'][_0x3e96('0x47')]({'where':{'id':_0x4e9d02[_0x3e96('0x45')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x48a3f3,null))[_0x3e96('0x26')](saveUpdates(_0x4e9d02[_0x3e96('0x48')],null))[_0x3e96('0x26')](function(_0x24a6c9){if(_0x24a6c9){_0x194bb4[_0x3e96('0x19')]=_0x24a6c9[_0x3e96('0x6a')]({'plain':!![]});return db['MailInteraction'][_0x3e96('0x47')]({'where':{'id':_0x24a6c9['MailInteractionId']}});}return null;})[_0x3e96('0x26')](handleEntityNotFound(_0x48a3f3,null))[_0x3e96('0x26')](function(_0x4076cf){if(_0x4076cf){return _0x4076cf[_0x3e96('0x25')]({'UserId':_0x4e9d02['body']['UserId'],'read1stAt':_[_0x3e96('0x6b')](_0x4076cf['read1stAt'])?moment()[_0x3e96('0x62')](_0x3e96('0x6c')):undefined});}return null;})[_0x3e96('0x26')](function(_0x8c21c){if(_0x8c21c){_0x194bb4['interaction']=_0x8c21c['get']({'plain':!![]});interaction_log['info'](_0x3e96('0x6d'),_0x4e9d02[_0x3e96('0x68')]['id'],_0x4e9d02['user'][_0x3e96('0x2a')],_0x4e9d02[_0x3e96('0x68')][_0x3e96('0x6e')],_0x194bb4[_0x3e96('0x6f')]['id'],_0x4e9d02['body']?JSON[_0x3e96('0x17')](_0x4e9d02[_0x3e96('0x48')]):_0x3e96('0x70'));return respondWithRpcPromise(_0x3e96('0x71'),_0x3e96('0x72'),_0x194bb4);}return null;})[_0x3e96('0x26')](function(_0x30f65f){var _0x599ca2=_0x3e96('0x73')+_0x30f65f[_0x3e96('0x19')]['ContactId'];return db[_0x3e96('0x74')][_0x3e96('0x32')](_0x599ca2,{'type':db[_0x3e96('0x75')][_0x3e96('0x76')][_0x3e96('0x77')],'raw':!![]})['then'](function(_0x19c4f1){return _0x19c4f1;});})[_0x3e96('0x26')](function(_0x1bee15){if(_0x1bee15){_0x194bb4[_0x3e96('0x19')][_0x3e96('0x78')]=_0x1bee15[0x0];if(!_0x4e9d02['body'][_0x3e96('0x67')])return;return db['User'][_0x3e96('0x47')]({'where':{'id':_0x4e9d02[_0x3e96('0x48')][_0x3e96('0x67')],'role':_0x3e96('0x69')},'attributes':['id',_0x3e96('0x2a'),'fullname',_0x3e96('0x79'),_0x3e96('0x7a')],'raw':!![]});}return null;})[_0x3e96('0x26')](function(_0x5b8e4e){if(!_0x5b8e4e)return null;_0x194bb4[_0x3e96('0x19')][_0x3e96('0x69')]=_0x5b8e4e;return _0x194bb4;})[_0x3e96('0x26')](function(_0x20b37b){if(_0x20b37b){if(_0x4e9d02[_0x3e96('0x48')][_0x3e96('0x7b')]){_0x194bb4['message'][_0x3e96('0x7c')]=util[_0x3e96('0x62')](_0x3e96('0x7d'),_0x4e9d02[_0x3e96('0x68')]['name']);_0x194bb4[_0x3e96('0x19')]['channel']=_0x194bb4[_0x3e96('0x7e')];_0x194bb4['message'][_0x3e96('0x7f')]=_0x194bb4[_0x3e96('0x7e')];_0x194bb4['message'][_0x3e96('0x80')]='accept';_0x194bb4[_0x3e96('0x19')][_0x3e96('0x48')]=htmlToText[_0x3e96('0x81')](_0x194bb4[_0x3e96('0x19')][_0x3e96('0x48')]);return respondWithRpcPromise('EventManager','EventManager',{'event':'acceptmessage','message':_0x194bb4[_0x3e96('0x19')]},client9002)['then'](function(){return _0x194bb4;});}return _0x194bb4;}return null;})[_0x3e96('0x26')](respondWithResult(_0x48a3f3,null))[_0x3e96('0x1c')](handleError(_0x48a3f3,null));};exports[_0x3e96('0x82')]=function(_0x4ce0,_0x2a1c79){var _0x2159d7={'agent':{},'channel':_0x3e96('0x64')};if(_0x4ce0[_0x3e96('0x48')]['id']){delete _0x4ce0[_0x3e96('0x48')]['id'];}_0x4ce0[_0x3e96('0x48')][_0x3e96('0x67')]=_0x4ce0[_0x3e96('0x48')][_0x3e96('0x67')]||_0x4ce0[_0x3e96('0x68')]['id'];_0x2159d7[_0x3e96('0x69')]['id']=_0x4ce0[_0x3e96('0x48')]['UserId'];return db[_0x3e96('0x2d')][_0x3e96('0x47')]({'where':{'id':_0x4ce0['params']['id'],'UserId':null}})[_0x3e96('0x26')](handleEntityNotFound(_0x2a1c79,null))['then'](function(_0x1e428a){if(_0x1e428a){_0x2159d7[_0x3e96('0x19')]=_0x1e428a[_0x3e96('0x6a')]({'plain':!![]});return db[_0x3e96('0x83')][_0x3e96('0x47')]({'where':{'id':_0x1e428a[_0x3e96('0x84')]}});}return null;})[_0x3e96('0x26')](handleEntityNotFound(_0x2a1c79,null))[_0x3e96('0x26')](function(_0x5124c6){if(_0x5124c6){_0x2159d7[_0x3e96('0x6f')]=_0x5124c6[_0x3e96('0x6a')]({'plain':!![]});interaction_log[_0x3e96('0x13')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4ce0['user']['id'],_0x4ce0[_0x3e96('0x68')][_0x3e96('0x2a')],_0x4ce0[_0x3e96('0x68')][_0x3e96('0x6e')],_0x2159d7[_0x3e96('0x6f')]['id'],_0x4ce0[_0x3e96('0x48')]?JSON[_0x3e96('0x17')](_0x4ce0[_0x3e96('0x48')]):'null');return respondWithRpcPromise('RejectMessage',_0x3e96('0x85'),_0x2159d7);}return null;})[_0x3e96('0x26')](function(_0x288d2f){var _0x2cda11=_0x3e96('0x73')+_0x288d2f[_0x3e96('0x19')][_0x3e96('0x86')];return db['sequelize'][_0x3e96('0x32')](_0x2cda11,{'type':db['Sequelize'][_0x3e96('0x76')]['SELECT'],'raw':!![]})[_0x3e96('0x26')](function(_0x4dc368){return _0x4dc368;});})[_0x3e96('0x26')](function(_0x307228){if(_0x307228){_0x2159d7['message'][_0x3e96('0x78')]=_0x307228[0x0];if(!_0x4ce0['body'][_0x3e96('0x67')])return;return db[_0x3e96('0x87')][_0x3e96('0x47')]({'where':{'id':_0x4ce0[_0x3e96('0x48')][_0x3e96('0x67')],'role':_0x3e96('0x69')},'attributes':['id','name',_0x3e96('0x88'),'email',_0x3e96('0x7a')],'raw':!![]});}return null;})[_0x3e96('0x26')](function(_0x198430){if(!_0x198430)return null;_0x2159d7[_0x3e96('0x19')]['agent']=_0x198430;return _0x2159d7;})[_0x3e96('0x26')](function(_0x182a3d){if(_0x182a3d){_0x182a3d[_0x3e96('0x19')][_0x3e96('0x7c')]=util[_0x3e96('0x62')](_0x3e96('0x7d'),_0x4ce0[_0x3e96('0x68')][_0x3e96('0x2a')]);_0x182a3d[_0x3e96('0x19')][_0x3e96('0x7e')]=_0x2159d7['channel'];_0x182a3d[_0x3e96('0x19')]['motionChannel']=_0x2159d7['channel'];_0x182a3d['message'][_0x3e96('0x80')]=_0x3e96('0x82');_0x182a3d[_0x3e96('0x19')][_0x3e96('0x48')]=htmlToText[_0x3e96('0x81')](_0x2159d7[_0x3e96('0x19')][_0x3e96('0x48')]);respondWithRpcPromise('EventManager',_0x3e96('0x89'),{'event':_0x3e96('0x8a'),'message':_0x182a3d[_0x3e96('0x19')]},client9002);return _0x2159d7;}return null;})['then'](respondWithResult(_0x2a1c79,null))[_0x3e96('0x1c')](handleError(_0x2a1c79,null));};exports[_0x3e96('0x8b')]=function(_0x643fa1,_0x557b9f){var _0x541031=moment()['unix']()['toString']();var _0x392084=path[_0x3e96('0x5c')](config['root'],_0x3e96('0x8c'),_0x3e96('0x8d'),_0x3e96('0x8e'));var _0x2ec700=path['join'](config[_0x3e96('0x8f')],_0x3e96('0x8c'),_0x3e96('0x8d'),'attachments');var _0x4c9e0f=util[_0x3e96('0x62')](_0x3e96('0x90'),_0x541031);return db[_0x3e96('0x2d')][_0x3e96('0x47')]({'where':{'id':_0x643fa1[_0x3e96('0x45')]['id']},'attributes':['id','body',_0x3e96('0x91'),'to','cc',_0x3e96('0x92'),_0x3e96('0x93'),_0x3e96('0x94')],'include':_0x643fa1[_0x3e96('0x32')][_0x3e96('0x5b')]?[{'model':db[_0x3e96('0x95')],'as':_0x3e96('0x96')}]:undefined})[_0x3e96('0x26')](handleEntityNotFound(_0x557b9f,null))[_0x3e96('0x26')](function(_0x5a6e02){if(_0x5a6e02){var _0x40eab2=_0x5a6e02;var _0x1bcb16={'from':_0x40eab2[_0x3e96('0x91')],'to':_0x40eab2['to'],'subject':_0x40eab2[_0x3e96('0x93')],'html':htmlEntities[_0x3e96('0x97')](_0x40eab2[_0x3e96('0x48')]),'headers':{'Date':moment(_0x40eab2[_0x3e96('0x94')])['format'](_0x3e96('0x98'))},'attachments':[]};if(_0x5a6e02['cc']){_0x1bcb16[_0x3e96('0x99')]['Cc']=_0x5a6e02['cc'];}if(_0x5a6e02[_0x3e96('0x92')]){_0x1bcb16[_0x3e96('0x99')][_0x3e96('0x9a')]=_0x5a6e02[_0x3e96('0x92')];}return new BPromise(function(_0x3b8358,_0x15d567){if(_0x5a6e02['Attachments']){for(var _0xd4a7e=0x0;_0xd4a7e<_0x5a6e02[_0x3e96('0x96')][_0x3e96('0x39')];_0xd4a7e++){var _0x27b06a=_0x5a6e02['Attachments'][_0xd4a7e];var _0x79b1b5=path['join'](_0x2ec700,_0x27b06a['basename']);if(fs[_0x3e96('0x9b')](_0x79b1b5)){_0x1bcb16[_0x3e96('0x5b')][_0x3e96('0x9c')]({'name':_0x27b06a['name'],'contentType':_0x27b06a[_0x3e96('0x30')],'data':fs[_0x3e96('0x9d')](_0x79b1b5)});}}}emlformat[_0x3e96('0x9e')](_0x1bcb16,function(_0x35f146,_0x4c7ce6){if(_0x35f146)return _0x15d567(_0x35f146);fs[_0x3e96('0x9f')](path[_0x3e96('0x5c')](_0x392084,_0x4c9e0f),_0x4c7ce6);return _0x3b8358(_0x4c7ce6);});});}})[_0x3e96('0x26')](function(_0x2fd382){if(_0x2fd382){return _0x557b9f['download'](path[_0x3e96('0x5c')](_0x392084,_0x4c9e0f),_0x4c9e0f,function(_0xbc707c){if(!_0xbc707c)fs[_0x3e96('0xa0')](path[_0x3e96('0x5c')](_0x392084,_0x4c9e0f));});}})[_0x3e96('0x1c')](handleError(_0x557b9f,null));}; \ No newline at end of file +var _0x05d4=['get','interaction','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','RejectMessage','rejectMessage','User','email','EventManager','rejectmessage','download','unix','toString','server','files','tmp','from','subject','createdAt','Attachments','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','existsSync','readFileSync','writeFileSync','unlinkSync','eml-format','moment','bluebird','util','path','lodash','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','html-entities','./mailMessage.socket','client','http','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','json','offset','undefined','limit','count','Content-Range','destroy','stack','name','send','MailMessage','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','includeAll','findAll','rows','show','params','include','options','find','update','body','describe','create','direction','out','split','MailAccount','findOne','MailAccountId','CmList','Contacts','updatedAt','DESC','Smtp','getSmtpOptions','attachments','join','root','basename','List','ListId','sendMail','format','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','MailInteraction','MailInteractionId','read1stAt','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','fullname','internal','interface','SIP/%s','channel','motionChannel','event','reject'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x05d4,0x156));var _0x405d=function(_0x426d28,_0x287fc9){_0x426d28=_0x426d28-0x0;var _0xd1ff18=_0x05d4[_0x426d28];return _0xd1ff18;};'use strict';var emlformat=require(_0x405d('0x0'));var moment=require(_0x405d('0x1'));var BPromise=require(_0x405d('0x2'));var util=require(_0x405d('0x3'));var path=require(_0x405d('0x4'));var fs=require('fs');var _=require(_0x405d('0x5'));var Redis=require(_0x405d('0x6'));var htmlToText=require(_0x405d('0x7'));var qs=require(_0x405d('0x8'));var logger=require(_0x405d('0x9'))(_0x405d('0xa'));var interaction_log=require(_0x405d('0x9'))(_0x405d('0xb'));var config=require(_0x405d('0xc'));var db=require(_0x405d('0xd'))['db'];config[_0x405d('0xe')]=_[_0x405d('0xf')](config[_0x405d('0xe')],{'host':_0x405d('0x10'),'port':0x18eb});var socket=require(_0x405d('0x11'))(new Redis(config[_0x405d('0xe')]));var htmlEntities=require(_0x405d('0x12'));require(_0x405d('0x13'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x405d('0x14')][_0x405d('0x15')]({'port':0x232c});var client9003=jayson['client'][_0x405d('0x15')]({'port':0x232b});var client9002=jayson[_0x405d('0x14')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5872df,_0x147636,_0x57797f,_0x402bd5){return new BPromise(function(_0x2324ef,_0x2ffcfe){var _0xa00a25=_0x402bd5||client;return _0xa00a25[_0x405d('0x16')](_0x5872df,_0x57797f)[_0x405d('0x17')](function(_0x53dda8){logger[_0x405d('0x18')](_0x405d('0x19'),_0x147636,_0x405d('0x1a'));logger[_0x405d('0x1b')](_0x405d('0x1c'),_0x147636,_0x405d('0x1a'),JSON[_0x405d('0x1d')](_0x53dda8));if(_0x53dda8[_0x405d('0x1e')]){if(_0x53dda8[_0x405d('0x1e')][_0x405d('0x1f')]===0x1f4){logger[_0x405d('0x1e')](_0x405d('0x19'),_0x147636,_0x53dda8['error'][_0x405d('0x20')]);return _0x2ffcfe(_0x53dda8[_0x405d('0x1e')][_0x405d('0x20')]);}logger[_0x405d('0x1e')](_0x405d('0x19'),_0x147636,_0x53dda8[_0x405d('0x1e')][_0x405d('0x20')]);return _0x2324ef(_0x53dda8[_0x405d('0x1e')][_0x405d('0x20')]);}else{logger[_0x405d('0x18')]('MailMessage,\x20%s,\x20%s',_0x147636,_0x405d('0x1a'));_0x2324ef(_0x53dda8[_0x405d('0x21')]['message']);}})[_0x405d('0x22')](function(_0x554a3c){logger[_0x405d('0x1e')](_0x405d('0x19'),_0x147636,_0x554a3c);_0x2ffcfe(_0x554a3c);});});}function respondWithResult(_0x29a61e,_0x2c5903){_0x2c5903=_0x2c5903||0xc8;return function(_0x228507){if(_0x228507){return _0x29a61e[_0x405d('0x23')](_0x2c5903)[_0x405d('0x24')](_0x228507);}};}function respondWithFilteredResult(_0x260267,_0x38011b){return function(_0x33ba8e){if(_0x33ba8e){var _0x18bb58=typeof _0x38011b[_0x405d('0x25')]===_0x405d('0x26')&&typeof _0x38011b[_0x405d('0x27')]===_0x405d('0x26');var _0x5a2c33=_0x33ba8e[_0x405d('0x28')];var _0x2131ae=_0x18bb58?0x0:_0x38011b[_0x405d('0x25')];var _0x19ced4=_0x18bb58?_0x33ba8e[_0x405d('0x28')]:_0x38011b['offset']+_0x38011b[_0x405d('0x27')];var _0xdd3701;if(_0x19ced4>=_0x5a2c33){_0x19ced4=_0x5a2c33;_0xdd3701=0xc8;}else{_0xdd3701=0xce;}_0x260267['status'](_0xdd3701);return _0x260267['set'](_0x405d('0x29'),_0x2131ae+'-'+_0x19ced4+'/'+_0x5a2c33)['json'](_0x33ba8e);}return null;};}function saveUpdates(_0x5a47ff){return function(_0x11e310){if(_0x11e310){return _0x11e310['update'](_0x5a47ff)[_0x405d('0x17')](function(_0x96f5a6){return _0x96f5a6;});}return null;};}function removeEntity(_0x45f3c9){return function(_0x2e675e){if(_0x2e675e){return _0x2e675e[_0x405d('0x2a')]()['then'](function(){_0x45f3c9[_0x405d('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x510210){return function(_0x4ceafb){if(!_0x4ceafb){_0x510210['sendStatus'](0x194);}return _0x4ceafb;};}function handleError(_0x346810,_0x7590fc){_0x7590fc=_0x7590fc||0x1f4;return function(_0x50c827){logger[_0x405d('0x1e')](_0x50c827[_0x405d('0x2b')]);if(_0x50c827[_0x405d('0x2c')]){delete _0x50c827[_0x405d('0x2c')];}_0x346810[_0x405d('0x23')](_0x7590fc)[_0x405d('0x2d')](_0x50c827);};}exports['index']=function(_0x1078e1,_0x4f3b2d){var _0x4d0376={},_0x46dd21={},_0x5d93c5={'count':0x0,'rows':[]};var _0x756680=_['map'](db[_0x405d('0x2e')]['rawAttributes'],function(_0x1d23a7){return{'name':_0x1d23a7[_0x405d('0x2f')],'type':_0x1d23a7[_0x405d('0x30')][_0x405d('0x31')]};});_0x46dd21[_0x405d('0x32')]=_[_0x405d('0x33')](_0x756680,_0x405d('0x2c'));_0x46dd21[_0x405d('0x34')]=_[_0x405d('0x35')](_0x1078e1[_0x405d('0x34')]);_0x46dd21['filters']=_[_0x405d('0x36')](_0x46dd21['model'],_0x46dd21[_0x405d('0x34')]);_0x4d0376[_0x405d('0x37')]=_['intersection'](_0x46dd21['model'],qs['fields'](_0x1078e1[_0x405d('0x34')][_0x405d('0x38')]));_0x4d0376[_0x405d('0x37')]=_0x4d0376[_0x405d('0x37')][_0x405d('0x39')]?_0x4d0376[_0x405d('0x37')]:_0x46dd21[_0x405d('0x32')];if(!_0x1078e1[_0x405d('0x34')][_0x405d('0x3a')](_0x405d('0x3b'))){_0x4d0376[_0x405d('0x27')]=qs[_0x405d('0x27')](_0x1078e1[_0x405d('0x34')][_0x405d('0x27')]);_0x4d0376['offset']=qs[_0x405d('0x25')](_0x1078e1[_0x405d('0x34')]['offset']);}_0x4d0376[_0x405d('0x3c')]=qs[_0x405d('0x3d')](_0x1078e1[_0x405d('0x34')][_0x405d('0x3d')]);_0x4d0376[_0x405d('0x3e')]=qs[_0x405d('0x3f')](_[_0x405d('0x40')](_0x1078e1[_0x405d('0x34')],_0x46dd21[_0x405d('0x3f')]),_0x756680);if(_0x1078e1['query'][_0x405d('0x41')]){_0x4d0376[_0x405d('0x3e')]=_[_0x405d('0x42')](_0x4d0376[_0x405d('0x3e')],{'$or':_['map'](_0x756680,function(_0x44cfe6){if(_0x44cfe6[_0x405d('0x30')]!=='VIRTUAL'){var _0xba579c={};_0xba579c[_0x44cfe6[_0x405d('0x2c')]]={'$like':'%'+_0x1078e1[_0x405d('0x34')][_0x405d('0x41')]+'%'};return _0xba579c;}})});}_0x4d0376=_['merge']({},_0x4d0376,_0x1078e1['options']);var _0xe58458={'where':_0x4d0376[_0x405d('0x3e')]};return db['MailMessage'][_0x405d('0x28')](_0xe58458)['then'](function(_0x7a14ba){_0x5d93c5[_0x405d('0x28')]=_0x7a14ba;if(_0x1078e1['query'][_0x405d('0x43')]){_0x4d0376['include']=[{'all':!![]}];}return db['MailMessage'][_0x405d('0x44')](_0x4d0376);})[_0x405d('0x17')](function(_0x34bb1f){_0x5d93c5[_0x405d('0x45')]=_0x34bb1f;return _0x5d93c5;})[_0x405d('0x17')](respondWithFilteredResult(_0x4f3b2d,_0x4d0376))[_0x405d('0x22')](handleError(_0x4f3b2d,null));};exports[_0x405d('0x46')]=function(_0x434c4c,_0x406528){var _0x35866f={'raw':!![],'where':{'id':_0x434c4c[_0x405d('0x47')]['id']}},_0x403d16={};_0x403d16[_0x405d('0x32')]=_['keys'](db[_0x405d('0x2e')]['rawAttributes']);_0x403d16[_0x405d('0x34')]=_['keys'](_0x434c4c[_0x405d('0x34')]);_0x403d16['filters']=_[_0x405d('0x36')](_0x403d16[_0x405d('0x32')],_0x403d16[_0x405d('0x34')]);_0x35866f[_0x405d('0x37')]=_[_0x405d('0x36')](_0x403d16[_0x405d('0x32')],qs[_0x405d('0x38')](_0x434c4c[_0x405d('0x34')]['fields']));_0x35866f[_0x405d('0x37')]=_0x35866f['attributes'][_0x405d('0x39')]?_0x35866f[_0x405d('0x37')]:_0x403d16['model'];if(_0x434c4c[_0x405d('0x34')][_0x405d('0x43')]){_0x35866f[_0x405d('0x48')]=[{'all':!![]}];}_0x35866f=_[_0x405d('0x42')]({},_0x35866f,_0x434c4c[_0x405d('0x49')]);return db[_0x405d('0x2e')][_0x405d('0x4a')](_0x35866f)[_0x405d('0x17')](handleEntityNotFound(_0x406528,null))[_0x405d('0x17')](respondWithResult(_0x406528,null))[_0x405d('0x22')](handleError(_0x406528,null));};exports[_0x405d('0x4b')]=function(_0x4f998f,_0x416d48){if(_0x4f998f['body']['id']){delete _0x4f998f['body']['id'];}return db[_0x405d('0x2e')][_0x405d('0x4a')]({'where':{'id':_0x4f998f[_0x405d('0x47')]['id']}})['then'](handleEntityNotFound(_0x416d48,null))[_0x405d('0x17')](saveUpdates(_0x4f998f[_0x405d('0x4c')],null))['then'](respondWithResult(_0x416d48,null))[_0x405d('0x22')](handleError(_0x416d48,null));};exports['destroy']=function(_0x59bb70,_0x42a423){return db[_0x405d('0x2e')]['find']({'where':{'id':_0x59bb70[_0x405d('0x47')]['id']}})[_0x405d('0x17')](handleEntityNotFound(_0x42a423,null))[_0x405d('0x17')](removeEntity(_0x42a423,null))[_0x405d('0x22')](handleError(_0x42a423,null));};exports[_0x405d('0x4d')]=function(_0x2d8439,_0x2b9bbe){return db[_0x405d('0x2e')][_0x405d('0x4d')]()[_0x405d('0x17')](respondWithResult(_0x2b9bbe,null))[_0x405d('0x22')](handleError(_0x2b9bbe,null));};exports[_0x405d('0x4e')]=function(_0x22b2cf,_0x41dad1){return db[_0x405d('0x2e')][_0x405d('0x4e')](_0x22b2cf['body'])[_0x405d('0x17')](function(_0x1003a5){if(_0x1003a5){if(_0x1003a5[_0x405d('0x4f')]===_0x405d('0x50')&&!_0x1003a5['secret']){var _0x2164d1,_0x494793,_0x2ce027;if(_0x22b2cf[_0x405d('0x4c')]['to']){_0x494793=_0x22b2cf[_0x405d('0x4c')]['to'][_0x405d('0x51')](',')[0x0];}return db[_0x405d('0x52')][_0x405d('0x53')]({'where':{'id':_0x1003a5[_0x405d('0x54')]},'include':[{'model':db[_0x405d('0x55')],'as':'List','include':[{'model':db['CmContact'],'as':_0x405d('0x56'),'where':{'email':_0x494793},'limit':0x1,'order':[[_0x405d('0x57'),_0x405d('0x58')]]}]},{'model':db['MailServerOut'],'as':_0x405d('0x59'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]})[_0x405d('0x17')](function(_0x258f5b){_0x2164d1=_0x258f5b;if(!_0x2164d1||!_0x2164d1['Smtp'])return;var _0x496c00=_0x2164d1[_0x405d('0x5a')]();if(_0x22b2cf[_0x405d('0x4c')][_0x405d('0x5b')]&&_0x22b2cf[_0x405d('0x4c')][_0x405d('0x5b')]['length']){for(var _0x425e79=0x0;_0x425e79<_0x22b2cf[_0x405d('0x4c')]['attachments'][_0x405d('0x39')];_0x425e79+=0x1){_0x22b2cf['body']['attachments'][_0x425e79]={'filename':_0x22b2cf[_0x405d('0x4c')][_0x405d('0x5b')][_0x425e79]['name'],'path':path[_0x405d('0x5c')](config[_0x405d('0x5d')],'server/files/attachments',_0x22b2cf[_0x405d('0x4c')][_0x405d('0x5b')][_0x425e79][_0x405d('0x5e')])};}}_0x2ce027={'account':_0x496c00,'message':_0x22b2cf[_0x405d('0x4c')]};return;})['then'](function(){if(_0x2164d1['List']){if(_0x2164d1[_0x405d('0x5f')]['Contacts'][_0x405d('0x39')]){return _0x2164d1['List'][_0x405d('0x56')][0x0];}else{return db['CmContact'][_0x405d('0x4e')](_[_0x405d('0xf')](_0x22b2cf[_0x405d('0x4c')],{'firstName':_0x22b2cf[_0x405d('0x4c')]['to'],'email':_0x22b2cf[_0x405d('0x4c')]['to'],'phone':_0x22b2cf[_0x405d('0x4c')]['to'],'ListId':_0x2164d1[_0x405d('0x60')]}));}}else{throw new Error('List\x20not\x20found');}})['then'](function(){if(_0x2ce027){return respondWithRpcPromise('SendMail',_0x405d('0x61'),_0x2ce027,client9003)[_0x405d('0x17')](function(_0x4a0de2){return _0x1003a5[_0x405d('0x4b')]({'read':!![],'messageId':_0x4a0de2['messageId'],'sentAt':moment()[_0x405d('0x62')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0x405d('0x22')](function(_0x1e4f3f){logger[_0x405d('0x1e')]('%s',JSON[_0x405d('0x1d')](_0x1e4f3f));return _0x1003a5;});}return _0x1003a5;});}return _0x1003a5;}})['then'](respondWithResult(_0x41dad1,0xc9))['catch'](handleError(_0x41dad1,null));};exports[_0x405d('0x63')]=function(_0x3b7817,_0x576269){var _0x498d1b={'agent':{},'channel':'mail'};if(_0x3b7817[_0x405d('0x4c')]['id']){delete _0x3b7817[_0x405d('0x4c')]['id'];}_0x3b7817['body'][_0x405d('0x64')]=!![];_0x3b7817[_0x405d('0x4c')][_0x405d('0x65')]=moment()[_0x405d('0x62')](_0x405d('0x66'));_0x3b7817[_0x405d('0x4c')]['UserId']=_0x3b7817[_0x405d('0x4c')][_0x405d('0x67')]||_0x3b7817[_0x405d('0x68')]['id'];_0x498d1b[_0x405d('0x69')]['id']=_0x3b7817[_0x405d('0x4c')]['UserId'];return db[_0x405d('0x2e')][_0x405d('0x4a')]({'where':{'id':_0x3b7817[_0x405d('0x47')]['id'],'UserId':null}})[_0x405d('0x17')](handleEntityNotFound(_0x576269,null))['then'](saveUpdates(_0x3b7817[_0x405d('0x4c')],null))[_0x405d('0x17')](function(_0x42080e){if(_0x42080e){_0x498d1b['message']=_0x42080e['get']({'plain':!![]});return db[_0x405d('0x6a')][_0x405d('0x4a')]({'where':{'id':_0x42080e[_0x405d('0x6b')]}});}return null;})[_0x405d('0x17')](handleEntityNotFound(_0x576269,null))[_0x405d('0x17')](function(_0x2a38ee){if(_0x2a38ee){return _0x2a38ee[_0x405d('0x4b')]({'UserId':_0x3b7817[_0x405d('0x4c')][_0x405d('0x67')],'read1stAt':_['isNil'](_0x2a38ee[_0x405d('0x6c')])?moment()[_0x405d('0x62')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x89e864){if(_0x89e864){_0x498d1b['interaction']=_0x89e864['get']({'plain':!![]});interaction_log[_0x405d('0x18')](_0x405d('0x6d'),_0x3b7817['user']['id'],_0x3b7817[_0x405d('0x68')][_0x405d('0x2c')],_0x3b7817[_0x405d('0x68')]['role'],_0x498d1b['interaction']['id'],_0x3b7817[_0x405d('0x4c')]?JSON[_0x405d('0x1d')](_0x3b7817['body']):'null');return respondWithRpcPromise(_0x405d('0x6e'),'acceptMessage',_0x498d1b);}return null;})[_0x405d('0x17')](function(_0x119766){var _0x129d13=_0x405d('0x6f')+_0x119766[_0x405d('0x20')][_0x405d('0x70')];return db[_0x405d('0x71')][_0x405d('0x34')](_0x129d13,{'type':db[_0x405d('0x72')][_0x405d('0x73')][_0x405d('0x74')],'raw':!![]})['then'](function(_0x2c77cb){return _0x2c77cb;});})[_0x405d('0x17')](function(_0xedead5){if(_0xedead5){_0x498d1b[_0x405d('0x20')][_0x405d('0x75')]=_0xedead5[0x0];if(!_0x3b7817[_0x405d('0x4c')][_0x405d('0x67')])return;return db['User']['find']({'where':{'id':_0x3b7817['body'][_0x405d('0x67')],'role':'agent'},'attributes':['id',_0x405d('0x2c'),_0x405d('0x76'),'email',_0x405d('0x77')],'raw':!![]});}return null;})['then'](function(_0x42703a){if(!_0x42703a)return null;_0x498d1b[_0x405d('0x20')][_0x405d('0x69')]=_0x42703a;return _0x498d1b;})[_0x405d('0x17')](function(_0x34e944){if(_0x34e944){if(_0x3b7817[_0x405d('0x4c')]['manual']){_0x498d1b[_0x405d('0x20')][_0x405d('0x78')]=util[_0x405d('0x62')](_0x405d('0x79'),_0x3b7817[_0x405d('0x68')][_0x405d('0x2c')]);_0x498d1b[_0x405d('0x20')]['channel']=_0x498d1b[_0x405d('0x7a')];_0x498d1b[_0x405d('0x20')][_0x405d('0x7b')]=_0x498d1b['channel'];_0x498d1b['message'][_0x405d('0x7c')]=_0x405d('0x63');_0x498d1b[_0x405d('0x20')][_0x405d('0x4c')]=htmlToText['fromString'](_0x498d1b[_0x405d('0x20')][_0x405d('0x4c')]);return respondWithRpcPromise('EventManager','EventManager',{'event':'acceptmessage','message':_0x498d1b[_0x405d('0x20')]},client9002)[_0x405d('0x17')](function(){return _0x498d1b;});}return _0x498d1b;}return null;})[_0x405d('0x17')](respondWithResult(_0x576269,null))[_0x405d('0x22')](handleError(_0x576269,null));};exports[_0x405d('0x7d')]=function(_0x351f3f,_0x3c3eb5){var _0x11434d={'agent':{},'channel':'mail'};if(_0x351f3f[_0x405d('0x4c')]['id']){delete _0x351f3f[_0x405d('0x4c')]['id'];}_0x351f3f['body'][_0x405d('0x67')]=_0x351f3f['body'][_0x405d('0x67')]||_0x351f3f[_0x405d('0x68')]['id'];_0x11434d[_0x405d('0x69')]['id']=_0x351f3f[_0x405d('0x4c')][_0x405d('0x67')];return db[_0x405d('0x2e')][_0x405d('0x4a')]({'where':{'id':_0x351f3f[_0x405d('0x47')]['id'],'UserId':null}})[_0x405d('0x17')](handleEntityNotFound(_0x3c3eb5,null))[_0x405d('0x17')](function(_0x3705d2){if(_0x3705d2){_0x11434d['message']=_0x3705d2[_0x405d('0x7e')]({'plain':!![]});return db[_0x405d('0x6a')]['find']({'where':{'id':_0x3705d2['MailInteractionId']}});}return null;})[_0x405d('0x17')](handleEntityNotFound(_0x3c3eb5,null))[_0x405d('0x17')](function(_0x2373c3){if(_0x2373c3){_0x11434d[_0x405d('0x7f')]=_0x2373c3[_0x405d('0x7e')]({'plain':!![]});interaction_log[_0x405d('0x18')](_0x405d('0x80'),_0x351f3f['user']['id'],_0x351f3f[_0x405d('0x68')][_0x405d('0x2c')],_0x351f3f[_0x405d('0x68')][_0x405d('0x81')],_0x11434d[_0x405d('0x7f')]['id'],_0x351f3f[_0x405d('0x4c')]?JSON[_0x405d('0x1d')](_0x351f3f[_0x405d('0x4c')]):_0x405d('0x82'));return respondWithRpcPromise(_0x405d('0x83'),_0x405d('0x84'),_0x11434d);}return null;})[_0x405d('0x17')](function(_0x4f08b6){var _0x360ea5='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4f08b6[_0x405d('0x20')][_0x405d('0x70')];return db[_0x405d('0x71')][_0x405d('0x34')](_0x360ea5,{'type':db[_0x405d('0x72')][_0x405d('0x73')][_0x405d('0x74')],'raw':!![]})[_0x405d('0x17')](function(_0x564576){return _0x564576;});})[_0x405d('0x17')](function(_0x5cb6b7){if(_0x5cb6b7){_0x11434d['message'][_0x405d('0x75')]=_0x5cb6b7[0x0];if(!_0x351f3f[_0x405d('0x4c')][_0x405d('0x67')])return;return db[_0x405d('0x85')]['find']({'where':{'id':_0x351f3f[_0x405d('0x4c')][_0x405d('0x67')],'role':_0x405d('0x69')},'attributes':['id',_0x405d('0x2c'),_0x405d('0x76'),_0x405d('0x86'),_0x405d('0x77')],'raw':!![]});}return null;})[_0x405d('0x17')](function(_0x2c15dc){if(!_0x2c15dc)return null;_0x11434d[_0x405d('0x20')][_0x405d('0x69')]=_0x2c15dc;return _0x11434d;})[_0x405d('0x17')](function(_0x242212){if(_0x242212){_0x242212['message']['interface']=util[_0x405d('0x62')]('SIP/%s',_0x351f3f['user'][_0x405d('0x2c')]);_0x242212[_0x405d('0x20')][_0x405d('0x7a')]=_0x11434d[_0x405d('0x7a')];_0x242212['message'][_0x405d('0x7b')]=_0x11434d['channel'];_0x242212['message'][_0x405d('0x7c')]=_0x405d('0x7d');_0x242212['message']['body']=htmlToText['fromString'](_0x11434d['message'][_0x405d('0x4c')]);respondWithRpcPromise(_0x405d('0x87'),_0x405d('0x87'),{'event':_0x405d('0x88'),'message':_0x242212[_0x405d('0x20')]},client9002);return _0x11434d;}return null;})[_0x405d('0x17')](respondWithResult(_0x3c3eb5,null))['catch'](handleError(_0x3c3eb5,null));};exports[_0x405d('0x89')]=function(_0x12657b,_0x1895e1){var _0x2bc811=moment()[_0x405d('0x8a')]()[_0x405d('0x8b')]();var _0xfddc21=path['join'](config['root'],_0x405d('0x8c'),_0x405d('0x8d'),_0x405d('0x8e'));var _0x28a5ae=path[_0x405d('0x5c')](config[_0x405d('0x5d')],_0x405d('0x8c'),_0x405d('0x8d'),_0x405d('0x5b'));var _0x157242=util[_0x405d('0x62')]('message-%s.eml',_0x2bc811);return db[_0x405d('0x2e')][_0x405d('0x4a')]({'where':{'id':_0x12657b[_0x405d('0x47')]['id']},'attributes':['id',_0x405d('0x4c'),_0x405d('0x8f'),'to','cc','bcc',_0x405d('0x90'),_0x405d('0x91')],'include':_0x12657b[_0x405d('0x34')][_0x405d('0x5b')]?[{'model':db['Attachment'],'as':_0x405d('0x92')}]:undefined})[_0x405d('0x17')](handleEntityNotFound(_0x1895e1,null))['then'](function(_0x53d6e3){if(_0x53d6e3){var _0x402503=_0x53d6e3;var _0x874a13={'from':_0x402503[_0x405d('0x8f')],'to':_0x402503['to'],'subject':_0x402503[_0x405d('0x90')],'html':htmlEntities[_0x405d('0x93')](_0x402503['body']),'headers':{'Date':moment(_0x402503[_0x405d('0x91')])['format'](_0x405d('0x94'))},'attachments':[]};if(_0x53d6e3['cc']){_0x874a13[_0x405d('0x95')]['Cc']=_0x53d6e3['cc'];}if(_0x53d6e3[_0x405d('0x96')]){_0x874a13[_0x405d('0x95')][_0x405d('0x97')]=_0x53d6e3[_0x405d('0x96')];}return new BPromise(function(_0x478cca,_0x5d1174){if(_0x53d6e3['Attachments']){for(var _0x4e6c75=0x0;_0x4e6c75<_0x53d6e3[_0x405d('0x92')][_0x405d('0x39')];_0x4e6c75++){var _0x1c28d3=_0x53d6e3[_0x405d('0x92')][_0x4e6c75];var _0x48dcf8=path[_0x405d('0x5c')](_0x28a5ae,_0x1c28d3[_0x405d('0x5e')]);if(fs[_0x405d('0x98')](_0x48dcf8)){_0x874a13['attachments']['push']({'name':_0x1c28d3[_0x405d('0x2c')],'contentType':_0x1c28d3[_0x405d('0x30')],'data':fs[_0x405d('0x99')](_0x48dcf8)});}}}emlformat['build'](_0x874a13,function(_0x254976,_0x543139){if(_0x254976)return _0x5d1174(_0x254976);fs[_0x405d('0x9a')](path[_0x405d('0x5c')](_0xfddc21,_0x157242),_0x543139);return _0x478cca(_0x543139);});});}})[_0x405d('0x17')](function(_0x491e58){if(_0x491e58){return _0x1895e1[_0x405d('0x89')](path[_0x405d('0x5c')](_0xfddc21,_0x157242),_0x157242,function(_0x5ee508){if(!_0x5ee508)fs[_0x405d('0x9b')](path[_0x405d('0x5c')](_0xfddc21,_0x157242));});}})[_0x405d('0x22')](handleError(_0x1895e1,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 6ce9072..0111484 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 _0x361e=['exports','events','../../mysqldb','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x361e,0x1d9));var _0xe361=function(_0x13080d,_0x5f1876){_0x13080d=_0x13080d-0x0;var _0x4f5705=_0x361e[_0x13080d];return _0x4f5705;};'use strict';var EventEmitter=require(_0xe361('0x0'));var MailMessage=require(_0xe361('0x1'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xe361('0x2')](0x0);var events={'afterCreate':_0xe361('0x3'),'afterUpdate':'update','afterDestroy':_0xe361('0x4')};function emitEvent(_0x5d353e){return function(_0x573428,_0x3fd088,_0x53edb2){MailMessageEvents[_0xe361('0x5')](_0x5d353e+':'+_0x573428['id'],_0x573428);MailMessageEvents[_0xe361('0x5')](_0x5d353e,_0x573428);_0x53edb2(null);};}for(var e in events){if(events[_0xe361('0x6')](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module[_0xe361('0x7')]=MailMessageEvents; \ No newline at end of file +var _0x5a4b=['events','MailMessage','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x1cfa0d,_0x4391f2){var _0xe33279=function(_0x3ce7c1){while(--_0x3ce7c1){_0x1cfa0d['push'](_0x1cfa0d['shift']());}};_0xe33279(++_0x4391f2);}(_0x5a4b,0x150));var _0xb5a4=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x5a4b[_0x40a045];return _0x1a687c;};'use strict';var EventEmitter=require(_0xb5a4('0x0'));var MailMessage=require('../../mysqldb')['db'][_0xb5a4('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xb5a4('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb5a4('0x3'),'afterDestroy':_0xb5a4('0x4')};function emitEvent(_0x2dd8da){return function(_0x39d0c4,_0x33e919,_0x58547e){MailMessageEvents[_0xb5a4('0x5')](_0x2dd8da+':'+_0x39d0c4['id'],_0x39d0c4);MailMessageEvents[_0xb5a4('0x5')](_0x2dd8da,_0x39d0c4);_0x58547e(null);};}for(var e in events){if(events[_0xb5a4('0x6')](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 418e7dc..d6ab209 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 _0x7683=['request-promise','path','rimraf','../../config/environment','exports','define','MailMessage','mail_messages','messageId','fti_mail_messages','subject','body','plainBody','fromString','get','direction','toLowerCase','out','MailInteraction','findOne','MailInteractionId','then','update','createdAt','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment'];(function(_0x517877,_0x4d5a6f){var _0x2bb60a=function(_0x10c43e){while(--_0x10c43e){_0x517877['push'](_0x517877['shift']());}};_0x2bb60a(++_0x4d5a6f);}(_0x7683,0x9b));var _0x3768=function(_0x4d1ee9,_0x394a78){_0x4d1ee9=_0x4d1ee9-0x0;var _0x9a5456=_0x7683[_0x4d1ee9];return _0x9a5456;};'use strict';var _=require(_0x3768('0x0'));var util=require(_0x3768('0x1'));var logger=require(_0x3768('0x2'))(_0x3768('0x3'));var moment=require(_0x3768('0x4'));var BPromise=require('bluebird');var rp=require(_0x3768('0x5'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0x3768('0x6'));var rimraf=require(_0x3768('0x7'));var config=require(_0x3768('0x8'));var attributes=require('./mailMessage.attributes');module[_0x3768('0x9')]=function(_0x2a5f38,_0x45b2ac){return _0x2a5f38[_0x3768('0xa')](_0x3768('0xb'),attributes,{'tableName':_0x3768('0xc'),'paranoid':![],'indexes':[{'name':_0x3768('0xd'),'fields':[_0x3768('0xd')]},{'name':_0x3768('0xe'),'fields':['plainBody',_0x3768('0xf')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x281b69,_0x31209d,_0xc32e98){if(_0x281b69[_0x3768('0x10')]){_0x281b69[_0x3768('0x11')]=htmlToText[_0x3768('0x12')](_0x281b69[_0x3768('0x10')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0xc32e98(null,_0x31209d);},'afterCreate':function(_0x10e0c7,_0x26f456,_0x1222f7){var _0x16ba6a=_0x2a5f38['models'];var _0x434552=_0x10e0c7[_0x3768('0x13')]({'plain':!![]});if(_0x434552[_0x3768('0x14')][_0x3768('0x15')]()==='in'||_0x434552[_0x3768('0x14')]['toLowerCase']()===_0x3768('0x16')&&!_0x434552['secret']&&!_['isNil'](_0x434552['UserId'])){_0x16ba6a[_0x3768('0x17')][_0x3768('0x18')]({'where':{'id':_0x434552[_0x3768('0x19')]}})[_0x3768('0x1a')](function(_0x244b09){if(_0x244b09){_0x244b09[_0x3768('0x1b')]({'lastMsgAt':_0x434552[_0x3768('0x1c')],'lastMsgDirection':_0x434552[_0x3768('0x14')]['toLowerCase']()});}})[_0x3768('0x1d')](function(_0x5dbd02){console['error'](_0x5dbd02);});}_0x1222f7();}},'charset':_0x3768('0x1e'),'collate':_0x3768('0x1f')});}; \ No newline at end of file +var _0xdcc3=['MailInteraction','findOne','MailInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','html-to-text','path','rimraf','./mailMessage.attributes','define','MailMessage','mail_messages','messageId','plainBody','FULLTEXT','body','fromString','models','get','direction','toLowerCase','out','secret','isNil','UserId'];(function(_0x50c109,_0x211da2){var _0x166bdc=function(_0x3a3e73){while(--_0x3a3e73){_0x50c109['push'](_0x50c109['shift']());}};_0x166bdc(++_0x211da2);}(_0xdcc3,0x76));var _0x3dcc=function(_0x4a0e11,_0x3a468d){_0x4a0e11=_0x4a0e11-0x0;var _0x27b686=_0xdcc3[_0x4a0e11];return _0x27b686;};'use strict';var _=require('lodash');var util=require(_0x3dcc('0x0'));var logger=require(_0x3dcc('0x1'))(_0x3dcc('0x2'));var moment=require(_0x3dcc('0x3'));var BPromise=require(_0x3dcc('0x4'));var rp=require(_0x3dcc('0x5'));var htmlToText=require(_0x3dcc('0x6'));var fs=require('fs');var path=require(_0x3dcc('0x7'));var rimraf=require(_0x3dcc('0x8'));var config=require('../../config/environment');var attributes=require(_0x3dcc('0x9'));module['exports']=function(_0x1c5309,_0x122546){return _0x1c5309[_0x3dcc('0xa')](_0x3dcc('0xb'),attributes,{'tableName':_0x3dcc('0xc'),'paranoid':![],'indexes':[{'name':_0x3dcc('0xd'),'fields':[_0x3dcc('0xd')]},{'name':'fti_mail_messages','fields':[_0x3dcc('0xe'),'subject'],'type':_0x3dcc('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1cff31,_0x46156b,_0x36d734){if(_0x1cff31[_0x3dcc('0x10')]){_0x1cff31[_0x3dcc('0xe')]=htmlToText[_0x3dcc('0x11')](_0x1cff31[_0x3dcc('0x10')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x36d734(null,_0x46156b);},'afterCreate':function(_0x42aaf9,_0x5e41fa,_0x3f3c5d){var _0x49e71b=_0x1c5309[_0x3dcc('0x12')];var _0x1976f6=_0x42aaf9[_0x3dcc('0x13')]({'plain':!![]});if(_0x1976f6[_0x3dcc('0x14')][_0x3dcc('0x15')]()==='in'||_0x1976f6[_0x3dcc('0x14')]['toLowerCase']()===_0x3dcc('0x16')&&!_0x1976f6[_0x3dcc('0x17')]&&!_[_0x3dcc('0x18')](_0x1976f6[_0x3dcc('0x19')])){_0x49e71b[_0x3dcc('0x1a')][_0x3dcc('0x1b')]({'where':{'id':_0x1976f6[_0x3dcc('0x1c')]}})[_0x3dcc('0x1d')](function(_0x5d742a){if(_0x5d742a){_0x5d742a[_0x3dcc('0x1e')]({'lastMsgAt':_0x1976f6[_0x3dcc('0x1f')],'lastMsgDirection':_0x1976f6[_0x3dcc('0x14')][_0x3dcc('0x15')]()});}})[_0x3dcc('0x20')](function(_0x103266){console[_0x3dcc('0x21')](_0x103266);});}_0x3f3c5d();}},'charset':_0x3dcc('0x22'),'collate':_0x3dcc('0x23')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index cc88a1a..2cfac16 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 _0x4024=['debug','stringify','error','code','message','info','catch','CreateMailMessage','MailMessage','create','body','options','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','client','http','redis','then','MailMessage,\x20%s,\x20%s','request\x20sent'];(function(_0x3d14e7,_0x36d0e4){var _0x5b5930=function(_0x59647d){while(--_0x59647d){_0x3d14e7['push'](_0x3d14e7['shift']());}};_0x5b5930(++_0x36d0e4);}(_0x4024,0x89));var _0x4402=function(_0x528ee7,_0x569734){_0x528ee7=_0x528ee7-0x0;var _0x9ca187=_0x4024[_0x528ee7];return _0x9ca187;};'use strict';var _=require(_0x4402('0x0'));var util=require(_0x4402('0x1'));var moment=require('moment');var BPromise=require(_0x4402('0x2'));var rs=require(_0x4402('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4402('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4402('0x5'))(_0x4402('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4402('0x7')][_0x4402('0x8')]({'port':0x232a});config[_0x4402('0x9')]=_['defaults'](config[_0x4402('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4402('0x9')]));require('./mailMessage.socket')['register'](socket);function respondWithRpcPromise(_0x30fd34,_0x4f56aa,_0x1a4a47){return new BPromise(function(_0x4e1a7e,_0x34b4a6){return client['request'](_0x30fd34,_0x1a4a47)[_0x4402('0xa')](function(_0x251286){logger['info'](_0x4402('0xb'),_0x4f56aa,_0x4402('0xc'));logger[_0x4402('0xd')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x4f56aa,_0x4402('0xc'),JSON[_0x4402('0xe')](_0x251286));if(_0x251286[_0x4402('0xf')]){if(_0x251286[_0x4402('0xf')][_0x4402('0x10')]===0x1f4){logger[_0x4402('0xf')](_0x4402('0xb'),_0x4f56aa,_0x251286[_0x4402('0xf')][_0x4402('0x11')]);return _0x34b4a6(_0x251286[_0x4402('0xf')][_0x4402('0x11')]);}logger[_0x4402('0xf')](_0x4402('0xb'),_0x4f56aa,_0x251286[_0x4402('0xf')][_0x4402('0x11')]);return _0x4e1a7e(_0x251286[_0x4402('0xf')][_0x4402('0x11')]);}else{logger[_0x4402('0x12')](_0x4402('0xb'),_0x4f56aa,_0x4402('0xc'));_0x4e1a7e(_0x251286['result']['message']);}})[_0x4402('0x13')](function(_0x2a7afc){logger['error'](_0x4402('0xb'),_0x4f56aa,_0x2a7afc);_0x34b4a6(_0x2a7afc);});});}exports[_0x4402('0x14')]=function(_0x5cb0c5){var _0x38b459=this;return new Promise(function(_0x4e0340,_0x55cc8c){return db[_0x4402('0x15')][_0x4402('0x16')](_0x5cb0c5[_0x4402('0x17')],{'raw':_0x5cb0c5['options']?_0x5cb0c5[_0x4402('0x18')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x6f1f72){logger[_0x4402('0x12')](_0x4402('0x14'),_0x5cb0c5);logger[_0x4402('0xd')](_0x4402('0x14'),_0x5cb0c5,JSON[_0x4402('0xe')](_0x6f1f72));_0x4e0340(_0x6f1f72);})[_0x4402('0x13')](function(_0x6b1fc5){logger[_0x4402('0xf')]('CreateMailMessage',_0x6b1fc5[_0x4402('0x11')],_0x5cb0c5);_0x55cc8c(_0x38b459['error'](0x1f4,_0x6b1fc5[_0x4402('0x11')]));});});}; \ No newline at end of file +var _0x351d=['rpc','jayson/promise','client','http','defaults','redis','socket.io-emitter','request','then','info','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','MailMessage,\x20%s,\x20%s','message','catch','CreateMailMessage','MailMessage','create','body','options','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger'];(function(_0x1ea87b,_0x55c0ee){var _0x390318=function(_0xbed488){while(--_0xbed488){_0x1ea87b['push'](_0x1ea87b['shift']());}};_0x390318(++_0x55c0ee);}(_0x351d,0x90));var _0xd351=function(_0x451029,_0x3aa3bd){_0x451029=_0x451029-0x0;var _0x2cdf68=_0x351d[_0x451029];return _0x2cdf68;};'use strict';var _=require(_0xd351('0x0'));var util=require('util');var moment=require(_0xd351('0x1'));var BPromise=require(_0xd351('0x2'));var rs=require(_0xd351('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd351('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd351('0x5'))(_0xd351('0x6'));var config=require('../../config/environment');var jayson=require(_0xd351('0x7'));var client=jayson[_0xd351('0x8')][_0xd351('0x9')]({'port':0x232a});config['redis']=_[_0xd351('0xa')](config[_0xd351('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xd351('0xc'))(new Redis(config[_0xd351('0xb')]));require('./mailMessage.socket')['register'](socket);function respondWithRpcPromise(_0x44bf81,_0x4904b4,_0x34cfc7){return new BPromise(function(_0x39b8c8,_0x5949a4){return client[_0xd351('0xd')](_0x44bf81,_0x34cfc7)[_0xd351('0xe')](function(_0x4ebca1){logger[_0xd351('0xf')]('MailMessage,\x20%s,\x20%s',_0x4904b4,'request\x20sent');logger[_0xd351('0x10')](_0xd351('0x11'),_0x4904b4,_0xd351('0x12'),JSON[_0xd351('0x13')](_0x4ebca1));if(_0x4ebca1['error']){if(_0x4ebca1[_0xd351('0x14')][_0xd351('0x15')]===0x1f4){logger['error'](_0xd351('0x16'),_0x4904b4,_0x4ebca1[_0xd351('0x14')][_0xd351('0x17')]);return _0x5949a4(_0x4ebca1[_0xd351('0x14')][_0xd351('0x17')]);}logger['error'](_0xd351('0x16'),_0x4904b4,_0x4ebca1['error']['message']);return _0x39b8c8(_0x4ebca1[_0xd351('0x14')]['message']);}else{logger[_0xd351('0xf')](_0xd351('0x16'),_0x4904b4,_0xd351('0x12'));_0x39b8c8(_0x4ebca1['result'][_0xd351('0x17')]);}})[_0xd351('0x18')](function(_0x77985a){logger[_0xd351('0x14')]('MailMessage,\x20%s,\x20%s',_0x4904b4,_0x77985a);_0x5949a4(_0x77985a);});});}exports[_0xd351('0x19')]=function(_0x4abbed){var _0x48fa9b=this;return new Promise(function(_0x37d3ac,_0x4a427b){return db[_0xd351('0x1a')][_0xd351('0x1b')](_0x4abbed[_0xd351('0x1c')],{'raw':_0x4abbed[_0xd351('0x1d')]?_0x4abbed[_0xd351('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0xd351('0xe')](function(_0xbbc58){logger[_0xd351('0xf')]('CreateMailMessage',_0x4abbed);logger[_0xd351('0x10')](_0xd351('0x19'),_0x4abbed,JSON[_0xd351('0x13')](_0xbbc58));_0x37d3ac(_0xbbc58);})['catch'](function(_0x1ce279){logger[_0xd351('0x14')](_0xd351('0x19'),_0x1ce279[_0xd351('0x17')],_0x4abbed);_0x4a427b(_0x48fa9b['error'](0x1f4,_0x1ce279[_0xd351('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 1eb2722..e875a77 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 _0xd28a=['emit','removeListener','register','length','mailMessage:','./mailMessage.events','save','remove','update'];(function(_0xd6ac1d,_0x125e6e){var _0x3b0567=function(_0x4d1991){while(--_0x4d1991){_0xd6ac1d['push'](_0xd6ac1d['shift']());}};_0x3b0567(++_0x125e6e);}(_0xd28a,0xdd));var _0xad28=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xd28a[_0x27af45];return _0x18df21;};'use strict';var MailMessageEvents=require(_0xad28('0x0'));var events=[_0xad28('0x1'),_0xad28('0x2'),_0xad28('0x3')];function createListener(_0x5012c3,_0x3f0688){return function(_0x2092ae){_0x3f0688[_0xad28('0x4')](_0x5012c3,_0x2092ae);};}function removeListener(_0x5ed2c1,_0x3070a5){return function(){MailMessageEvents[_0xad28('0x5')](_0x5ed2c1,_0x3070a5);};}exports[_0xad28('0x6')]=function(_0x37ea25){for(var _0x41822a=0x0,_0x10b285=events[_0xad28('0x7')];_0x41822a<_0x10b285;_0x41822a++){var _0x2defb9=events[_0x41822a];var _0x55ba83=createListener(_0xad28('0x8')+_0x2defb9,_0x37ea25);MailMessageEvents['on'](_0x2defb9,_0x55ba83);}}; \ No newline at end of file +var _0x8f02=['mailMessage:','save','remove','update','emit','removeListener','register','length'];(function(_0x10f6db,_0x3eaa8c){var _0x910042=function(_0xf4975){while(--_0xf4975){_0x10f6db['push'](_0x10f6db['shift']());}};_0x910042(++_0x3eaa8c);}(_0x8f02,0xa1));var _0x28f0=function(_0x5ec9cc,_0x3e38af){_0x5ec9cc=_0x5ec9cc-0x0;var _0x4cf3ff=_0x8f02[_0x5ec9cc];return _0x4cf3ff;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0x28f0('0x0'),_0x28f0('0x1'),_0x28f0('0x2')];function createListener(_0x33372b,_0x5d73f8){return function(_0x3c6d56){_0x5d73f8[_0x28f0('0x3')](_0x33372b,_0x3c6d56);};}function removeListener(_0x1ed8cf,_0x7bf27){return function(){MailMessageEvents[_0x28f0('0x4')](_0x1ed8cf,_0x7bf27);};}exports[_0x28f0('0x5')]=function(_0x124a9c){for(var _0x81ebfd=0x0,_0x2720d1=events[_0x28f0('0x6')];_0x81ebfd<_0x2720d1;_0x81ebfd++){var _0x247669=events[_0x81ebfd];var _0x326221=createListener(_0x28f0('0x7')+_0x247669,_0x124a9c);MailMessageEvents['on'](_0x247669,_0x326221);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index f402364..914195f 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 _0xb6f3=['/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','addTeams','put','destroy','delete','removeTeams','removeAgents','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailQueue.controller','isAuthenticated','index','get','/describe','/:id','show'];(function(_0xe720ee,_0x483d99){var _0x5c3c0c=function(_0xa720a8){while(--_0xa720a8){_0xe720ee['push'](_0xe720ee['shift']());}};_0x5c3c0c(++_0x483d99);}(_0xb6f3,0x15d));var _0x3b6f=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xb6f3[_0x413feb];return _0x40ee88;};'use strict';var multer=require(_0x3b6f('0x0'));var util=require(_0x3b6f('0x1'));var path=require(_0x3b6f('0x2'));var timeout=require('connect-timeout');var express=require(_0x3b6f('0x3'));var router=express[_0x3b6f('0x4')]();var fs_extra=require(_0x3b6f('0x5'));var auth=require(_0x3b6f('0x6'));var interaction=require(_0x3b6f('0x7'));var config=require('../../config/environment');var controller=require(_0x3b6f('0x8'));router['get']('/',auth[_0x3b6f('0x9')](),controller[_0x3b6f('0xa')]);router[_0x3b6f('0xb')](_0x3b6f('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x3b6f('0xb')](_0x3b6f('0xd'),auth[_0x3b6f('0x9')](),controller[_0x3b6f('0xe')]);router[_0x3b6f('0xb')](_0x3b6f('0xf'),auth[_0x3b6f('0x9')](),controller[_0x3b6f('0x10')]);router[_0x3b6f('0xb')](_0x3b6f('0x11'),auth[_0x3b6f('0x9')](),controller[_0x3b6f('0x12')]);router[_0x3b6f('0xb')](_0x3b6f('0x13'),auth[_0x3b6f('0x9')](),controller['getAgents']);router[_0x3b6f('0x14')]('/',auth[_0x3b6f('0x9')](),controller['create']);router[_0x3b6f('0x14')](_0x3b6f('0x11'),auth[_0x3b6f('0x9')](),controller[_0x3b6f('0x15')]);router[_0x3b6f('0x14')](_0x3b6f('0x13'),auth[_0x3b6f('0x9')](),controller['addAgents']);router[_0x3b6f('0x16')](_0x3b6f('0xd'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x3b6f('0xd'),auth['isAuthenticated'](),controller[_0x3b6f('0x17')]);router[_0x3b6f('0x18')](_0x3b6f('0x11'),auth[_0x3b6f('0x9')](),controller[_0x3b6f('0x19')]);router[_0x3b6f('0x18')]('/:id/users',auth['isAuthenticated'](),controller[_0x3b6f('0x1a')]);module[_0x3b6f('0x1b')]=router; \ No newline at end of file +var _0x22bb=['update','delete','destroy','removeTeams','/:id/users','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','addTeams','put'];(function(_0x1074d5,_0x31fc44){var _0x2f162c=function(_0x214107){while(--_0x214107){_0x1074d5['push'](_0x1074d5['shift']());}};_0x2f162c(++_0x31fc44);}(_0x22bb,0x19c));var _0xb22b=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x22bb[_0x15bc81];return _0x59440e;};'use strict';var multer=require(_0xb22b('0x0'));var util=require(_0xb22b('0x1'));var path=require(_0xb22b('0x2'));var timeout=require(_0xb22b('0x3'));var express=require(_0xb22b('0x4'));var router=express[_0xb22b('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xb22b('0x6'));var config=require('../../config/environment');var controller=require('./mailQueue.controller');router[_0xb22b('0x7')]('/',auth[_0xb22b('0x8')](),controller[_0xb22b('0x9')]);router[_0xb22b('0x7')]('/describe',auth[_0xb22b('0x8')](),controller['describe']);router[_0xb22b('0x7')](_0xb22b('0xa'),auth[_0xb22b('0x8')](),controller[_0xb22b('0xb')]);router[_0xb22b('0x7')](_0xb22b('0xc'),auth[_0xb22b('0x8')](),controller[_0xb22b('0xd')]);router[_0xb22b('0x7')](_0xb22b('0xe'),auth[_0xb22b('0x8')](),controller[_0xb22b('0xf')]);router['get']('/:id/users',auth[_0xb22b('0x8')](),controller[_0xb22b('0x10')]);router[_0xb22b('0x11')]('/',auth[_0xb22b('0x8')](),controller['create']);router[_0xb22b('0x11')]('/:id/teams',auth[_0xb22b('0x8')](),controller[_0xb22b('0x12')]);router[_0xb22b('0x11')]('/:id/users',auth[_0xb22b('0x8')](),controller['addAgents']);router[_0xb22b('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xb22b('0x14')]);router[_0xb22b('0x15')]('/:id',auth['isAuthenticated'](),controller[_0xb22b('0x16')]);router[_0xb22b('0x15')](_0xb22b('0xe'),auth[_0xb22b('0x8')](),controller[_0xb22b('0x17')]);router[_0xb22b('0x15')](_0xb22b('0x18'),auth[_0xb22b('0x8')](),controller[_0xb22b('0x19')]);module[_0xb22b('0x1a')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 6de4ced..f299cc5 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 _0x8649=['exports','STRING','name','INTEGER','ENUM','beepall','roundrobin','sequelize'];(function(_0xe17e5,_0x525f85){var _0x132d1b=function(_0x4f3563){while(--_0x4f3563){_0xe17e5['push'](_0xe17e5['shift']());}};_0x132d1b(++_0x525f85);}(_0x8649,0x1af));var _0x9864=function(_0x2cd9b6,_0x1f8315){_0x2cd9b6=_0x2cd9b6-0x0;var _0x3607ab=_0x8649[_0x2cd9b6];return _0x3607ab;};'use strict';var Sequelize=require(_0x9864('0x0'));module[_0x9864('0x1')]={'name':{'type':Sequelize[_0x9864('0x2')],'unique':_0x9864('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x9864('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9864('0x5')]('rrmemory',_0x9864('0x6'),_0x9864('0x7'))}}; \ No newline at end of file +var _0x3aaf=['sequelize','STRING','ENUM','rrmemory','beepall','roundrobin'];(function(_0x2e7d3a,_0x577742){var _0x2a21cb=function(_0x428417){while(--_0x428417){_0x2e7d3a['push'](_0x2e7d3a['shift']());}};_0x2a21cb(++_0x577742);}(_0x3aaf,0x1c2));var _0xf3aa=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0x3aaf[_0x3635ce];return _0x97ecd0;};'use strict';var Sequelize=require(_0xf3aa('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xf3aa('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xf3aa('0x2')](_0xf3aa('0x3'),_0xf3aa('0x4'),_0xf3aa('0x5'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index f7ee67f..9e387b9 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 _0x8891=['rimraf','fast-json-patch','request-promise','bluebird','util','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','register','sendStatus','status','end','json','offset','limit','undefined','set','Content-Range','apply','reject','update','then','MailQueues','UserProfileResource','error','name','fieldName','key','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','MailQueue','count','include','findAll','rows','show','rawAttributes','length','find','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','destroy','describe','getMembers','findOne','MailQueueId','UserMailQueue','User','agent','mailPause','updatedAt','format','%s/%s','SIP','createdAt','getTeams','ids','Team','Agents','online','voicePause','interface','flatMap','sequelize','addTeams','each','findOrCreate','forEach','userMailQueue:save','removeTeams','field','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','includes','all','union','compact','value','transaction','isEmpty','removeAgents','emit','userMailQueue:remove','addAgents','omit','isArray','getAgents','eml-format'];(function(_0x100e36,_0x4da225){var _0x1df0c9=function(_0xe4b84f){while(--_0xe4b84f){_0x100e36['push'](_0x100e36['shift']());}};_0x1df0c9(++_0x4da225);}(_0x8891,0x119));var _0x1889=function(_0x45030e,_0x32b6b8){_0x45030e=_0x45030e-0x0;var _0x4df3be=_0x8891[_0x45030e];return _0x4df3be;};'use strict';var emlformat=require(_0x1889('0x0'));var rimraf=require(_0x1889('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1889('0x2'));var rp=require(_0x1889('0x3'));var moment=require('moment');var BPromise=require(_0x1889('0x4'));var Mustache=require('mustache');var util=require(_0x1889('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1889('0x6'));var fs=require('fs');var fs_extra=require(_0x1889('0x7'));var _=require(_0x1889('0x8'));var squel=require('squel');var crypto=require(_0x1889('0x9'));var jsforce=require(_0x1889('0xa'));var deskjs=require(_0x1889('0xb'));var toCsv=require(_0x1889('0xc'));var querystring=require(_0x1889('0xd'));var Papa=require(_0x1889('0xe'));var Redis=require(_0x1889('0xf'));var authService=require(_0x1889('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x1889('0x11'));var hardwareService=require(_0x1889('0x12'));var logger=require(_0x1889('0x13'))(_0x1889('0x14'));var utils=require(_0x1889('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1889('0x16'));var db=require(_0x1889('0x17'))['db'];config['redis']=_[_0x1889('0x18')](config[_0x1889('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1889('0x19')]));require('./mailQueue.socket')[_0x1889('0x1a')](socket);function respondWithStatusCode(_0x2297b8,_0x18d47c){_0x18d47c=_0x18d47c||0xcc;return function(_0x30be2e){if(_0x30be2e){return _0x2297b8[_0x1889('0x1b')](_0x18d47c);}return _0x2297b8[_0x1889('0x1c')](_0x18d47c)[_0x1889('0x1d')]();};}function respondWithResult(_0x1d47a0,_0x5f1d39){_0x5f1d39=_0x5f1d39||0xc8;return function(_0xb9ae39){if(_0xb9ae39){return _0x1d47a0[_0x1889('0x1c')](_0x5f1d39)[_0x1889('0x1e')](_0xb9ae39);}};}function respondWithFilteredResult(_0xa1fb2f,_0x2e04eb){return function(_0x3f8e14){if(_0x3f8e14){var _0x270c03=typeof _0x2e04eb[_0x1889('0x1f')]==='undefined'&&typeof _0x2e04eb[_0x1889('0x20')]===_0x1889('0x21');var _0x10be04=_0x3f8e14['count'];var _0x5d4135=_0x270c03?0x0:_0x2e04eb[_0x1889('0x1f')];var _0xc59e4a=_0x270c03?_0x3f8e14['count']:_0x2e04eb[_0x1889('0x1f')]+_0x2e04eb[_0x1889('0x20')];var _0x1dd099;if(_0xc59e4a>=_0x10be04){_0xc59e4a=_0x10be04;_0x1dd099=0xc8;}else{_0x1dd099=0xce;}_0xa1fb2f[_0x1889('0x1c')](_0x1dd099);return _0xa1fb2f[_0x1889('0x22')](_0x1889('0x23'),_0x5d4135+'-'+_0xc59e4a+'/'+_0x10be04)['json'](_0x3f8e14);}return null;};}function patchUpdates(_0x4e31c8){return function(_0x3ddb24){try{jsonpatch[_0x1889('0x24')](_0x3ddb24,_0x4e31c8,!![]);}catch(_0x20085a){return BPromise[_0x1889('0x25')](_0x20085a);}return _0x3ddb24['save']();};}function saveUpdates(_0xf7d9f7,_0x420e69){return function(_0x3cc627){if(_0x3cc627){return _0x3cc627[_0x1889('0x26')](_0xf7d9f7)[_0x1889('0x27')](function(_0x382b9f){return _0x382b9f;});}return null;};}function removeEntity(_0x47e387,_0x115054){return function(_0x394d0c){if(_0x394d0c){return _0x394d0c['destroy']()[_0x1889('0x27')](function(){var _0x12fd3f=_0x394d0c['get']({'plain':!![]});var _0x14e6b0=_0x1889('0x28');return db[_0x1889('0x29')]['destroy']({'where':{'type':_0x14e6b0,'resourceId':_0x12fd3f['id']}})[_0x1889('0x27')](function(){return _0x394d0c;});})[_0x1889('0x27')](function(){_0x47e387[_0x1889('0x1c')](0xcc)[_0x1889('0x1d')]();});}};}function handleEntityNotFound(_0x32bf87,_0x1e0237){return function(_0x30393c){if(!_0x30393c){_0x32bf87[_0x1889('0x1b')](0x194);}return _0x30393c;};}function handleError(_0x464a3c,_0x5730b5){_0x5730b5=_0x5730b5||0x1f4;return function(_0x17f416){logger[_0x1889('0x2a')](_0x17f416['stack']);if(_0x17f416[_0x1889('0x2b')]){delete _0x17f416[_0x1889('0x2b')];}_0x464a3c[_0x1889('0x1c')](_0x5730b5)['send'](_0x17f416);};}exports['index']=function(_0x35b571,_0x41693c){var _0x5276d6={},_0x3b223f={},_0x5ce90d={'count':0x0,'rows':[]};var _0x54e48a=_['map'](db['MailQueue']['rawAttributes'],function(_0x49babb){return{'name':_0x49babb[_0x1889('0x2c')],'type':_0x49babb['type'][_0x1889('0x2d')]};});_0x3b223f[_0x1889('0x2e')]=_[_0x1889('0x2f')](_0x54e48a,_0x1889('0x2b'));_0x3b223f[_0x1889('0x30')]=_[_0x1889('0x31')](_0x35b571[_0x1889('0x30')]);_0x3b223f[_0x1889('0x32')]=_['intersection'](_0x3b223f[_0x1889('0x2e')],_0x3b223f['query']);_0x5276d6[_0x1889('0x33')]=_[_0x1889('0x34')](_0x3b223f[_0x1889('0x2e')],qs['fields'](_0x35b571[_0x1889('0x30')][_0x1889('0x35')]));_0x5276d6[_0x1889('0x33')]=_0x5276d6['attributes']['length']?_0x5276d6['attributes']:_0x3b223f[_0x1889('0x2e')];if(!_0x35b571[_0x1889('0x30')][_0x1889('0x36')](_0x1889('0x37'))){_0x5276d6['limit']=qs['limit'](_0x35b571[_0x1889('0x30')][_0x1889('0x20')]);_0x5276d6[_0x1889('0x1f')]=qs[_0x1889('0x1f')](_0x35b571[_0x1889('0x30')][_0x1889('0x1f')]);}_0x5276d6[_0x1889('0x38')]=qs[_0x1889('0x39')](_0x35b571[_0x1889('0x30')][_0x1889('0x39')]);_0x5276d6[_0x1889('0x3a')]=qs[_0x1889('0x32')](_[_0x1889('0x3b')](_0x35b571['query'],_0x3b223f['filters']),_0x54e48a);if(_0x35b571['query'][_0x1889('0x3c')]){_0x5276d6['where']=_[_0x1889('0x3d')](_0x5276d6['where'],{'$or':_[_0x1889('0x2f')](_0x54e48a,function(_0x2b5c05){if(_0x2b5c05[_0x1889('0x3e')]!=='VIRTUAL'){var _0x4caf16={};_0x4caf16[_0x2b5c05[_0x1889('0x2b')]]={'$like':'%'+_0x35b571[_0x1889('0x30')][_0x1889('0x3c')]+'%'};return _0x4caf16;}})});}_0x5276d6=_[_0x1889('0x3d')]({},_0x5276d6,_0x35b571[_0x1889('0x3f')]);var _0x5e1def={'where':_0x5276d6['where']};return db[_0x1889('0x40')][_0x1889('0x41')](_0x5e1def)[_0x1889('0x27')](function(_0x2a15ef){_0x5ce90d[_0x1889('0x41')]=_0x2a15ef;if(_0x35b571['query']['includeAll']){_0x5276d6[_0x1889('0x42')]=[{'all':!![]}];}return db['MailQueue'][_0x1889('0x43')](_0x5276d6);})[_0x1889('0x27')](function(_0x19f1e3){_0x5ce90d[_0x1889('0x44')]=_0x19f1e3;return _0x5ce90d;})[_0x1889('0x27')](respondWithFilteredResult(_0x41693c,_0x5276d6))['catch'](handleError(_0x41693c,null));};exports[_0x1889('0x45')]=function(_0x3060d7,_0x1a4190){var _0x382d00={'raw':!![],'where':{'id':_0x3060d7['params']['id']}},_0x4fd92e={};_0x4fd92e[_0x1889('0x2e')]=_['keys'](db[_0x1889('0x40')][_0x1889('0x46')]);_0x4fd92e[_0x1889('0x30')]=_[_0x1889('0x31')](_0x3060d7[_0x1889('0x30')]);_0x4fd92e[_0x1889('0x32')]=_['intersection'](_0x4fd92e[_0x1889('0x2e')],_0x4fd92e[_0x1889('0x30')]);_0x382d00[_0x1889('0x33')]=_[_0x1889('0x34')](_0x4fd92e['model'],qs['fields'](_0x3060d7[_0x1889('0x30')]['fields']));_0x382d00[_0x1889('0x33')]=_0x382d00[_0x1889('0x33')][_0x1889('0x47')]?_0x382d00[_0x1889('0x33')]:_0x4fd92e[_0x1889('0x2e')];if(_0x3060d7['query']['includeAll']){_0x382d00[_0x1889('0x42')]=[{'all':!![]}];}_0x382d00=_[_0x1889('0x3d')]({},_0x382d00,_0x3060d7[_0x1889('0x3f')]);return db['MailQueue'][_0x1889('0x48')](_0x382d00)[_0x1889('0x27')](handleEntityNotFound(_0x1a4190,null))[_0x1889('0x27')](respondWithResult(_0x1a4190,null))[_0x1889('0x49')](handleError(_0x1a4190,null));};exports[_0x1889('0x4a')]=function(_0x47afb6,_0x2f2b18){return db[_0x1889('0x40')][_0x1889('0x4a')](_0x47afb6[_0x1889('0x4b')],{})[_0x1889('0x27')](function(_0x4f4354){var _0x9bb74d=_0x47afb6['user'][_0x1889('0x4c')]({'plain':!![]});if(!_0x9bb74d)throw new Error(_0x1889('0x4d'));if(_0x9bb74d[_0x1889('0x4e')]==='user'){var _0x409209=_0x4f4354['get']({'plain':!![]});var _0x5e90f9=_0x1889('0x28');return db[_0x1889('0x4f')][_0x1889('0x48')]({'where':{'name':_0x5e90f9,'userProfileId':_0x9bb74d[_0x1889('0x50')]},'raw':!![]})[_0x1889('0x27')](function(_0xadc408){if(_0xadc408&&_0xadc408[_0x1889('0x51')]===0x0){return db[_0x1889('0x29')][_0x1889('0x4a')]({'name':_0x409209[_0x1889('0x2b')],'resourceId':_0x409209['id'],'type':_0xadc408[_0x1889('0x2b')],'sectionId':_0xadc408['id']},{})[_0x1889('0x27')](function(){return _0x4f4354;});}else{return _0x4f4354;}})[_0x1889('0x49')](function(_0x2dd88e){logger[_0x1889('0x2a')](_0x1889('0x52'),_0x2dd88e);throw _0x2dd88e;});}return _0x4f4354;})['then'](respondWithResult(_0x2f2b18,0xc9))[_0x1889('0x49')](handleError(_0x2f2b18,null));};exports[_0x1889('0x26')]=function(_0xdb4d29,_0x54a19c){if(_0xdb4d29[_0x1889('0x4b')]['id']){delete _0xdb4d29['body']['id'];}return db[_0x1889('0x40')][_0x1889('0x48')]({'where':{'id':_0xdb4d29[_0x1889('0x53')]['id']}})[_0x1889('0x27')](handleEntityNotFound(_0x54a19c,null))[_0x1889('0x27')](saveUpdates(_0xdb4d29['body'],null))[_0x1889('0x27')](respondWithResult(_0x54a19c,null))[_0x1889('0x49')](handleError(_0x54a19c,null));};exports[_0x1889('0x54')]=function(_0x43d6b3,_0xe55d59){return db[_0x1889('0x40')][_0x1889('0x48')]({'where':{'id':_0x43d6b3['params']['id']}})[_0x1889('0x27')](handleEntityNotFound(_0xe55d59,null))[_0x1889('0x27')](removeEntity(_0xe55d59,null))[_0x1889('0x49')](handleError(_0xe55d59,null));};exports['describe']=function(_0x11fdeb,_0x5399d7){return db['MailQueue'][_0x1889('0x55')]()[_0x1889('0x27')](respondWithResult(_0x5399d7,null))[_0x1889('0x49')](handleError(_0x5399d7,null));};exports[_0x1889('0x56')]=function(_0x641e5c,_0x28b422,_0x1a06b8){var _0x247c73={'raw':!![],'where':{}},_0x5016c9={},_0x195b4b;return db['MailQueue'][_0x1889('0x57')]({'where':{'id':_0x641e5c[_0x1889('0x53')]['id']}})[_0x1889('0x27')](handleEntityNotFound(_0x28b422,null))['then'](function(_0x2d4699){if(_0x2d4699){_0x195b4b=_0x2d4699[_0x1889('0x4c')]({'plain':!![]});_0x5016c9['model']=_[_0x1889('0x31')](db['UserMailQueue'][_0x1889('0x46')]);_0x5016c9[_0x1889('0x30')]=_[_0x1889('0x31')](_0x641e5c['query']);_0x5016c9[_0x1889('0x32')]=_[_0x1889('0x34')](_0x5016c9[_0x1889('0x2e')],_0x5016c9['query']);_0x247c73['attributes']=_['intersection'](_0x5016c9[_0x1889('0x2e')],qs[_0x1889('0x35')](_0x641e5c[_0x1889('0x30')][_0x1889('0x35')]));_0x247c73['attributes']=_0x247c73[_0x1889('0x33')]['length']?_0x247c73[_0x1889('0x33')]:_0x5016c9[_0x1889('0x2e')];if(!_0x641e5c['query']['hasOwnProperty'](_0x1889('0x37'))){_0x247c73[_0x1889('0x20')]=qs[_0x1889('0x20')](_0x641e5c[_0x1889('0x30')][_0x1889('0x20')]);_0x247c73['offset']=qs['offset'](_0x641e5c['query'][_0x1889('0x1f')]);}_0x247c73[_0x1889('0x38')]=qs[_0x1889('0x39')](_0x641e5c[_0x1889('0x30')][_0x1889('0x39')]);_0x247c73['where']=qs[_0x1889('0x32')](_[_0x1889('0x3b')](_0x641e5c[_0x1889('0x30')],_0x5016c9[_0x1889('0x32')]));_0x247c73['where'][_0x1889('0x58')]=_0x2d4699['id'];if(_0x641e5c[_0x1889('0x30')]['filter']){_0x247c73[_0x1889('0x3a')]=_['merge'](_0x247c73[_0x1889('0x3a')],{'$or':_['map'](_0x247c73[_0x1889('0x33')],function(_0xf6488d){var _0x10bf2f={};_0x10bf2f[_0xf6488d]={'$like':'%'+_0x641e5c[_0x1889('0x30')][_0x1889('0x3c')]+'%'};return _0x10bf2f;})});}_0x247c73=_[_0x1889('0x3d')]({},_0x247c73,_0x641e5c['options']);return db[_0x1889('0x59')][_0x1889('0x43')](_0x247c73);}})[_0x1889('0x27')](function(_0x47ed13){if(_0x47ed13){return db[_0x1889('0x5a')]['findAndCountAll']({'where':{'id':_[_0x1889('0x2f')](_0x47ed13,'UserId'),'role':_0x1889('0x5b')},'attributes':['id','name',_0x1889('0x5c'),_0x1889('0x5d'),'createdAt']});}})[_0x1889('0x27')](function(_0xe05cf2){if(_0xe05cf2){return{'count':_0xe05cf2[_0x1889('0x41')],'rows':_[_0x1889('0x2f')](_0xe05cf2[_0x1889('0x44')],function(_0x5a0d14){return{'membername':_0x5a0d14['name'],'UserId':_0x5a0d14['id'],'queue_name':_0x195b4b[_0x1889('0x2b')],'MailQueueId':_0x195b4b['id'],'interface':util[_0x1889('0x5e')](_0x1889('0x5f'),_0x1889('0x60'),_0x5a0d14[_0x1889('0x2b')]),'penalty':0x0,'paused':_0x5a0d14[_0x1889('0x5c')],'createdAt':_0x5a0d14[_0x1889('0x61')],'updatedAt':_0x5a0d14['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x1889('0x27')](respondWithFilteredResult(_0x28b422,_0x247c73))[_0x1889('0x49')](handleError(_0x28b422,null));};exports['getTeams']=function(_0x96103,_0x512b3f,_0x24e632){var _0x2aeeda={};var _0x545786={};var _0x24bf4e;var _0x1224f9;return db[_0x1889('0x40')]['findOne']({'where':{'id':_0x96103[_0x1889('0x53')]['id']}})[_0x1889('0x27')](handleEntityNotFound(_0x512b3f,null))[_0x1889('0x27')](function(_0x393ead){if(_0x393ead){_0x24bf4e=_0x393ead;_0x545786['model']=_[_0x1889('0x31')](db['Team'][_0x1889('0x46')]);_0x545786[_0x1889('0x30')]=_[_0x1889('0x31')](_0x96103[_0x1889('0x30')]);_0x545786[_0x1889('0x32')]=_[_0x1889('0x34')](_0x545786[_0x1889('0x2e')],_0x545786[_0x1889('0x30')]);_0x2aeeda['attributes']=_[_0x1889('0x34')](_0x545786[_0x1889('0x2e')],qs[_0x1889('0x35')](_0x96103[_0x1889('0x30')]['fields']));_0x2aeeda[_0x1889('0x33')]=_0x2aeeda[_0x1889('0x33')][_0x1889('0x47')]?_0x2aeeda[_0x1889('0x33')]:_0x545786[_0x1889('0x2e')];_0x2aeeda['order']=qs['sort'](_0x96103[_0x1889('0x30')][_0x1889('0x39')]);_0x2aeeda['where']=qs[_0x1889('0x32')](_[_0x1889('0x3b')](_0x96103['query'],_0x545786[_0x1889('0x32')]));if(_0x96103[_0x1889('0x30')]['filter']){_0x2aeeda[_0x1889('0x3a')]=_['merge'](_0x2aeeda['where'],{'$or':_[_0x1889('0x2f')](_0x2aeeda['attributes'],function(_0x495e94){var _0xffb37d={};_0xffb37d[_0x495e94]={'$like':'%'+_0x96103[_0x1889('0x30')]['filter']+'%'};return _0xffb37d;})});}_0x2aeeda=_[_0x1889('0x3d')]({},_0x2aeeda,_0x96103[_0x1889('0x3f')]);return _0x24bf4e[_0x1889('0x62')](_0x2aeeda);}})['then'](function(_0x38dad1){if(_0x38dad1){_0x1224f9=_0x38dad1['length'];if(!_0x96103[_0x1889('0x30')]['hasOwnProperty'](_0x1889('0x37'))){_0x2aeeda[_0x1889('0x20')]=qs[_0x1889('0x20')](_0x96103[_0x1889('0x30')][_0x1889('0x20')]);_0x2aeeda[_0x1889('0x1f')]=qs[_0x1889('0x1f')](_0x96103[_0x1889('0x30')][_0x1889('0x1f')]);}return _0x24bf4e[_0x1889('0x62')](_0x2aeeda);}})[_0x1889('0x27')](function(_0x439339){if(_0x439339){return _0x439339?{'count':_0x1224f9,'rows':_0x439339}:null;}})['then'](respondWithResult(_0x512b3f,null))[_0x1889('0x49')](handleError(_0x512b3f,null));};exports['addTeams']=function(_0x2f8354,_0x1461a3,_0x51ea65){var _0x44a5e8=_0x2f8354[_0x1889('0x4b')][_0x1889('0x63')];return db[_0x1889('0x64')][_0x1889('0x43')]({'where':{'id':_0x44a5e8},'attributes':['id'],'include':[{'model':db[_0x1889('0x5a')],'as':_0x1889('0x65'),'attributes':['id',_0x1889('0x2b'),_0x1889('0x66'),_0x1889('0x67'),_0x1889('0x68')],'raw':!![]}]})[_0x1889('0x27')](function(_0x497150){if(_0x497150){var _0x3892b5=_[_0x1889('0x69')](_0x497150,function(_0x3aa201){var _0x386ce4=_0x3aa201[_0x1889('0x4c')]({'plain':!![]});return _0x386ce4['Agents'];});return db['MailQueue'][_0x1889('0x48')]({'where':{'id':_0x2f8354[_0x1889('0x53')]['id']}})[_0x1889('0x27')](function(_0x486770){return db[_0x1889('0x6a')]['transaction'](function(_0x1725ea){return _0x486770[_0x1889('0x6b')](_0x44a5e8,{'transaction':_0x1725ea})[_0x1889('0x27')](function(){return BPromise[_0x1889('0x6c')](_0x3892b5,function(_0x37e05b){return db[_0x1889('0x59')][_0x1889('0x6d')]({'where':{'UserId':_0x37e05b['id'],'MailQueueId':_0x2f8354[_0x1889('0x53')]['id']},'transaction':_0x1725ea});});})['then'](function(){_0x3892b5[_0x1889('0x6e')](function(_0x2785f9){socket['emit'](_0x1889('0x6f'),{'UserId':_0x2785f9['id'],'MailQueueId':_0x486770['id']});});});});});}})['then'](respondWithStatusCode(_0x1461a3,null))[_0x1889('0x49')](handleError(_0x1461a3,null));};exports[_0x1889('0x70')]=function(_0x55e209,_0x1307e6,_0x4fe94c){return db[_0x1889('0x64')][_0x1889('0x43')]({'where':{'id':_0x55e209[_0x1889('0x30')][_0x1889('0x63')]},'attributes':['id'],'include':[{'model':db[_0x1889('0x5a')],'as':_0x1889('0x65'),'attributes':['id'],'raw':!![]}]})[_0x1889('0x27')](handleEntityNotFound(_0x1307e6,null))[_0x1889('0x27')](function(_0x52b356){var _0xa7eb70=_[_0x1889('0x2f')](_0x52b356,'id');var _0x5aaf02=[];var _0x35057d=[];var _0x18e407=squel['select']();_0x18e407[_0x1889('0x71')]('tq.TeamId')[_0x1889('0x72')](_0x1889('0x73'),'tq')[_0x1889('0x74')](_0x1889('0x75'),'ut',_0x1889('0x76'))[_0x1889('0x3a')](_0x1889('0x77'),_0x55e209[_0x1889('0x53')]['id']);for(var _0x5c670e=0x0;_0x5c670e<_0x52b356[_0x1889('0x47')];_0x5c670e+=0x1){let _0x33eb1b=_0x52b356[_0x5c670e];for(var _0x24bea4=0x0;_0x24bea4<_0x33eb1b[_0x1889('0x65')][_0x1889('0x47')];_0x24bea4+=0x1){let _0x1dac98=_0x33eb1b[_0x1889('0x65')][_0x24bea4];var _0x5553ad=_0x18e407[_0x1889('0x78')]();_0x5553ad[_0x1889('0x3a')](_0x1889('0x79'),_0x1dac98['id']);_0x35057d[_0x1889('0x7a')](db['sequelize'][_0x1889('0x30')](_0x5553ad[_0x1889('0x7b')](),{'type':db['sequelize'][_0x1889('0x7c')][_0x1889('0x7d')]})[_0x1889('0x27')](function(_0x54a691){if(_0x54a691[_0x1889('0x47')]===0x1){return _0x1dac98['id'];}else{var _0x6df885=_['every'](_['map'](_0x54a691,_0x1889('0x7e')),function(_0x12a4d6){return _[_0x1889('0x7f')](_0xa7eb70,_0x12a4d6);});if(_0x6df885){return _0x1dac98['id'];}}}));}}return BPromise[_0x1889('0x80')](_0x35057d)[_0x1889('0x27')](function(_0x37c913){_0x5aaf02=_(_0x5aaf02)[_0x1889('0x81')](_0x37c913)[_0x1889('0x82')]()[_0x1889('0x83')]();return db['MailQueue'][_0x1889('0x48')]({'where':{'id':_0x55e209[_0x1889('0x53')]['id']}})[_0x1889('0x27')](function(_0x1ebc17){return db[_0x1889('0x6a')][_0x1889('0x84')](function(_0x4dd9d2){return _0x1ebc17['removeTeams'](_0x55e209[_0x1889('0x30')]['ids'],{'transaction':_0x4dd9d2})['then'](function(){if(!_[_0x1889('0x85')](_0x5aaf02)){return _0x1ebc17[_0x1889('0x86')](_0x5aaf02,{'transaction':_0x4dd9d2});}})[_0x1889('0x27')](function(){_0x5aaf02[_0x1889('0x6e')](function(_0x253050){socket[_0x1889('0x87')](_0x1889('0x88'),{'UserId':_0x253050,'MailQueueId':_0x1ebc17['id']});});});});});});})['then'](respondWithStatusCode(_0x1307e6,null))['catch'](handleError(_0x1307e6,null));};exports['addAgents']=function(_0x1aa79a,_0x4819bf,_0x3a8de1){return db[_0x1889('0x40')][_0x1889('0x48')]({'where':{'id':_0x1aa79a[_0x1889('0x53')]['id']}})[_0x1889('0x27')](handleEntityNotFound(_0x4819bf,null))[_0x1889('0x27')](function(_0x19808c){if(_0x19808c){return _0x19808c[_0x1889('0x89')](_0x1aa79a[_0x1889('0x4b')][_0x1889('0x63')],_[_0x1889('0x8a')](_0x1aa79a[_0x1889('0x4b')],['ids','id'])||{})['spread'](function(_0x3131fa){for(var _0x1c9d72=0x0;_0x1c9d72<_0x1aa79a[_0x1889('0x4b')][_0x1889('0x63')][_0x1889('0x47')];_0x1c9d72+=0x1){socket[_0x1889('0x87')]('userMailQueue:save',{'UserId':Number(_0x1aa79a[_0x1889('0x4b')][_0x1889('0x63')][_0x1c9d72]),'MailQueueId':Number(_0x1aa79a['params']['id'])});}return _0x3131fa;});}})[_0x1889('0x27')](respondWithResult(_0x4819bf,null))[_0x1889('0x49')](handleError(_0x4819bf,null));};exports['removeAgents']=function(_0x4f0c70,_0x3f8b3f,_0x22e122){return db['MailQueue']['find']({'where':{'id':_0x4f0c70[_0x1889('0x53')]['id']}})[_0x1889('0x27')](handleEntityNotFound(_0x3f8b3f,null))[_0x1889('0x27')](function(_0x15c9c6){if(_0x15c9c6){return _0x15c9c6['removeAgents'](_0x4f0c70[_0x1889('0x30')][_0x1889('0x63')])[_0x1889('0x27')](function(){if(_[_0x1889('0x8b')](_0x4f0c70[_0x1889('0x30')][_0x1889('0x63')])){for(var _0x47e772=0x0;_0x47e772<_0x4f0c70['query']['ids'][_0x1889('0x47')];_0x47e772+=0x1){socket[_0x1889('0x87')](_0x1889('0x88'),{'UserId':Number(_0x4f0c70[_0x1889('0x30')][_0x1889('0x63')][_0x47e772]),'MailQueueId':Number(_0x4f0c70[_0x1889('0x53')]['id'])});}}else{socket[_0x1889('0x87')](_0x1889('0x88'),{'UserId':Number(_0x4f0c70[_0x1889('0x30')][_0x1889('0x63')]),'MailQueueId':Number(_0x4f0c70['params']['id'])});}});}})['then'](respondWithStatusCode(_0x3f8b3f,null))[_0x1889('0x49')](handleError(_0x3f8b3f,null));};exports[_0x1889('0x8c')]=function(_0x1b86de,_0x1cf332,_0x5d0561){var _0x1d2205={};var _0x696e35={};var _0x50d928;var _0xec81a4;return db[_0x1889('0x40')]['findOne']({'where':{'id':_0x1b86de[_0x1889('0x53')]['id']}})['then'](handleEntityNotFound(_0x1cf332,null))[_0x1889('0x27')](function(_0x364e9b){if(_0x364e9b){_0x50d928=_0x364e9b;_0x696e35['model']=_[_0x1889('0x31')](db[_0x1889('0x5a')][_0x1889('0x46')]);_0x696e35[_0x1889('0x30')]=_[_0x1889('0x31')](_0x1b86de[_0x1889('0x30')]);_0x696e35[_0x1889('0x32')]=_[_0x1889('0x34')](_0x696e35[_0x1889('0x2e')],_0x696e35[_0x1889('0x30')]);_0x1d2205[_0x1889('0x33')]=_[_0x1889('0x34')](_0x696e35[_0x1889('0x2e')],qs['fields'](_0x1b86de[_0x1889('0x30')]['fields']));_0x1d2205[_0x1889('0x33')]=_0x1d2205[_0x1889('0x33')]['length']?_0x1d2205[_0x1889('0x33')]:_0x696e35[_0x1889('0x2e')];_0x1d2205[_0x1889('0x38')]=qs[_0x1889('0x39')](_0x1b86de[_0x1889('0x30')][_0x1889('0x39')]);_0x1d2205[_0x1889('0x3a')]=qs['filters'](_[_0x1889('0x3b')](_0x1b86de[_0x1889('0x30')],_0x696e35[_0x1889('0x32')]));if(_0x1b86de['query'][_0x1889('0x3c')]){_0x1d2205[_0x1889('0x3a')]=_['merge'](_0x1d2205[_0x1889('0x3a')],{'$or':_[_0x1889('0x2f')](_0x1d2205[_0x1889('0x33')],function(_0x50aa3b){var _0x5ed3b5={};_0x5ed3b5[_0x50aa3b]={'$like':'%'+_0x1b86de['query'][_0x1889('0x3c')]+'%'};return _0x5ed3b5;})});}_0x1d2205=_[_0x1889('0x3d')]({},_0x1d2205,_0x1b86de['options']);return _0x50d928['getAgents'](_0x1d2205);}})[_0x1889('0x27')](function(_0x1970a9){if(_0x1970a9){_0xec81a4=_0x1970a9[_0x1889('0x47')];if(!_0x1b86de[_0x1889('0x30')]['hasOwnProperty'](_0x1889('0x37'))){_0x1d2205['limit']=qs[_0x1889('0x20')](_0x1b86de['query']['limit']);_0x1d2205[_0x1889('0x1f')]=qs[_0x1889('0x1f')](_0x1b86de[_0x1889('0x30')][_0x1889('0x1f')]);}return _0x50d928[_0x1889('0x8c')](_0x1d2205);}})['then'](function(_0x3c5240){if(_0x3c5240){return _0x3c5240?{'count':_0xec81a4,'rows':_0x3c5240}:null;}})['then'](respondWithResult(_0x1cf332,null))['catch'](handleError(_0x1cf332,null));}; \ No newline at end of file +var _0x6b1c=['save','update','destroy','then','get','MailQueues','UserProfileResource','error','stack','name','send','index','map','MailQueue','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','getMembers','findOne','UserMailQueue','MailQueueId','filter','User','findAndCountAll','UserId','agent','mailPause','updatedAt','createdAt','%s/%s','Team','getTeams','nolimit','addTeams','ids','voicePause','interface','flatMap','Agents','sequelize','transaction','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','tq.TeamId','team_has_mail_queues','join','MailQueueId\x20=\x20?','clone','push','toString','SELECT','every','includes','all','union','compact','value','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','isArray','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6b1c,0xf3));var _0xc6b1=function(_0x2555d0,_0x4150a6){_0x2555d0=_0x2555d0-0x0;var _0x3bb486=_0x6b1c[_0x2555d0];return _0x3bb486;};'use strict';var emlformat=require(_0xc6b1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc6b1('0x1'));var jsonpatch=require(_0xc6b1('0x2'));var rp=require(_0xc6b1('0x3'));var moment=require(_0xc6b1('0x4'));var BPromise=require(_0xc6b1('0x5'));var Mustache=require(_0xc6b1('0x6'));var util=require('util');var path=require(_0xc6b1('0x7'));var sox=require('sox');var csv=require(_0xc6b1('0x8'));var ejs=require(_0xc6b1('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc6b1('0xa'));var squel=require(_0xc6b1('0xb'));var crypto=require(_0xc6b1('0xc'));var jsforce=require(_0xc6b1('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xc6b1('0x8'));var querystring=require(_0xc6b1('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc6b1('0xf'));var qs=require(_0xc6b1('0x10'));var as=require(_0xc6b1('0x11'));var hardwareService=require(_0xc6b1('0x12'));var logger=require(_0xc6b1('0x13'))(_0xc6b1('0x14'));var utils=require('../../config/utils');var config=require(_0xc6b1('0x15'));var licenseUtil=require(_0xc6b1('0x16'));var db=require(_0xc6b1('0x17'))['db'];config[_0xc6b1('0x18')]=_[_0xc6b1('0x19')](config['redis'],{'host':_0xc6b1('0x1a'),'port':0x18eb});var socket=require(_0xc6b1('0x1b'))(new Redis(config[_0xc6b1('0x18')]));require(_0xc6b1('0x1c'))['register'](socket);function respondWithStatusCode(_0x547ef4,_0x4607ee){_0x4607ee=_0x4607ee||0xcc;return function(_0x12079c){if(_0x12079c){return _0x547ef4[_0xc6b1('0x1d')](_0x4607ee);}return _0x547ef4[_0xc6b1('0x1e')](_0x4607ee)[_0xc6b1('0x1f')]();};}function respondWithResult(_0x6885bd,_0x4ba242){_0x4ba242=_0x4ba242||0xc8;return function(_0x4fbf72){if(_0x4fbf72){return _0x6885bd[_0xc6b1('0x1e')](_0x4ba242)[_0xc6b1('0x20')](_0x4fbf72);}};}function respondWithFilteredResult(_0x16ca82,_0x4c1fec){return function(_0x2c4bae){if(_0x2c4bae){var _0x40a267=typeof _0x4c1fec['offset']===_0xc6b1('0x21')&&typeof _0x4c1fec[_0xc6b1('0x22')]===_0xc6b1('0x21');var _0x4bee15=_0x2c4bae[_0xc6b1('0x23')];var _0x3fb9e8=_0x40a267?0x0:_0x4c1fec[_0xc6b1('0x24')];var _0xe1480f=_0x40a267?_0x2c4bae['count']:_0x4c1fec['offset']+_0x4c1fec[_0xc6b1('0x22')];var _0x1582a2;if(_0xe1480f>=_0x4bee15){_0xe1480f=_0x4bee15;_0x1582a2=0xc8;}else{_0x1582a2=0xce;}_0x16ca82[_0xc6b1('0x1e')](_0x1582a2);return _0x16ca82[_0xc6b1('0x25')](_0xc6b1('0x26'),_0x3fb9e8+'-'+_0xe1480f+'/'+_0x4bee15)[_0xc6b1('0x20')](_0x2c4bae);}return null;};}function patchUpdates(_0x2c17c3){return function(_0xda9ac){try{jsonpatch[_0xc6b1('0x27')](_0xda9ac,_0x2c17c3,!![]);}catch(_0x100a03){return BPromise[_0xc6b1('0x28')](_0x100a03);}return _0xda9ac[_0xc6b1('0x29')]();};}function saveUpdates(_0x279fbf,_0x9a919c){return function(_0x311b3f){if(_0x311b3f){return _0x311b3f[_0xc6b1('0x2a')](_0x279fbf)['then'](function(_0x2d2f13){return _0x2d2f13;});}return null;};}function removeEntity(_0x5afcb5,_0x2b657d){return function(_0x2b0a39){if(_0x2b0a39){return _0x2b0a39[_0xc6b1('0x2b')]()[_0xc6b1('0x2c')](function(){var _0x50e052=_0x2b0a39[_0xc6b1('0x2d')]({'plain':!![]});var _0x2942bb=_0xc6b1('0x2e');return db[_0xc6b1('0x2f')][_0xc6b1('0x2b')]({'where':{'type':_0x2942bb,'resourceId':_0x50e052['id']}})[_0xc6b1('0x2c')](function(){return _0x2b0a39;});})[_0xc6b1('0x2c')](function(){_0x5afcb5['status'](0xcc)[_0xc6b1('0x1f')]();});}};}function handleEntityNotFound(_0x16ec61,_0x284f6c){return function(_0x1dbe23){if(!_0x1dbe23){_0x16ec61[_0xc6b1('0x1d')](0x194);}return _0x1dbe23;};}function handleError(_0x10533c,_0x5979cc){_0x5979cc=_0x5979cc||0x1f4;return function(_0x2c85bf){logger[_0xc6b1('0x30')](_0x2c85bf[_0xc6b1('0x31')]);if(_0x2c85bf['name']){delete _0x2c85bf[_0xc6b1('0x32')];}_0x10533c[_0xc6b1('0x1e')](_0x5979cc)[_0xc6b1('0x33')](_0x2c85bf);};}exports[_0xc6b1('0x34')]=function(_0x4e35de,_0x4a4839){var _0x453a9c={},_0x5dc371={},_0xe55de5={'count':0x0,'rows':[]};var _0x352f0d=_[_0xc6b1('0x35')](db[_0xc6b1('0x36')][_0xc6b1('0x37')],function(_0x1bf092){return{'name':_0x1bf092[_0xc6b1('0x38')],'type':_0x1bf092[_0xc6b1('0x39')][_0xc6b1('0x3a')]};});_0x5dc371[_0xc6b1('0x3b')]=_['map'](_0x352f0d,'name');_0x5dc371[_0xc6b1('0x3c')]=_['keys'](_0x4e35de[_0xc6b1('0x3c')]);_0x5dc371[_0xc6b1('0x3d')]=_[_0xc6b1('0x3e')](_0x5dc371[_0xc6b1('0x3b')],_0x5dc371[_0xc6b1('0x3c')]);_0x453a9c[_0xc6b1('0x3f')]=_[_0xc6b1('0x3e')](_0x5dc371[_0xc6b1('0x3b')],qs[_0xc6b1('0x40')](_0x4e35de['query'][_0xc6b1('0x40')]));_0x453a9c[_0xc6b1('0x3f')]=_0x453a9c[_0xc6b1('0x3f')][_0xc6b1('0x41')]?_0x453a9c[_0xc6b1('0x3f')]:_0x5dc371[_0xc6b1('0x3b')];if(!_0x4e35de[_0xc6b1('0x3c')][_0xc6b1('0x42')]('nolimit')){_0x453a9c['limit']=qs['limit'](_0x4e35de['query'][_0xc6b1('0x22')]);_0x453a9c[_0xc6b1('0x24')]=qs[_0xc6b1('0x24')](_0x4e35de[_0xc6b1('0x3c')]['offset']);}_0x453a9c[_0xc6b1('0x43')]=qs[_0xc6b1('0x44')](_0x4e35de[_0xc6b1('0x3c')]['sort']);_0x453a9c[_0xc6b1('0x45')]=qs[_0xc6b1('0x3d')](_[_0xc6b1('0x46')](_0x4e35de[_0xc6b1('0x3c')],_0x5dc371[_0xc6b1('0x3d')]),_0x352f0d);if(_0x4e35de[_0xc6b1('0x3c')]['filter']){_0x453a9c[_0xc6b1('0x45')]=_[_0xc6b1('0x47')](_0x453a9c[_0xc6b1('0x45')],{'$or':_[_0xc6b1('0x35')](_0x352f0d,function(_0x4834a2){if(_0x4834a2[_0xc6b1('0x39')]!==_0xc6b1('0x48')){var _0x1bbb0f={};_0x1bbb0f[_0x4834a2[_0xc6b1('0x32')]]={'$like':'%'+_0x4e35de[_0xc6b1('0x3c')]['filter']+'%'};return _0x1bbb0f;}})});}_0x453a9c=_['merge']({},_0x453a9c,_0x4e35de[_0xc6b1('0x49')]);var _0x5cb75b={'where':_0x453a9c[_0xc6b1('0x45')]};return db['MailQueue'][_0xc6b1('0x23')](_0x5cb75b)[_0xc6b1('0x2c')](function(_0x29641d){_0xe55de5[_0xc6b1('0x23')]=_0x29641d;if(_0x4e35de[_0xc6b1('0x3c')][_0xc6b1('0x4a')]){_0x453a9c[_0xc6b1('0x4b')]=[{'all':!![]}];}return db[_0xc6b1('0x36')][_0xc6b1('0x4c')](_0x453a9c);})[_0xc6b1('0x2c')](function(_0x21d473){_0xe55de5[_0xc6b1('0x4d')]=_0x21d473;return _0xe55de5;})[_0xc6b1('0x2c')](respondWithFilteredResult(_0x4a4839,_0x453a9c))[_0xc6b1('0x4e')](handleError(_0x4a4839,null));};exports[_0xc6b1('0x4f')]=function(_0xefbd79,_0x517d35){var _0x38d8e3={'raw':!![],'where':{'id':_0xefbd79[_0xc6b1('0x50')]['id']}},_0x2b86b8={};_0x2b86b8[_0xc6b1('0x3b')]=_['keys'](db[_0xc6b1('0x36')]['rawAttributes']);_0x2b86b8[_0xc6b1('0x3c')]=_[_0xc6b1('0x51')](_0xefbd79[_0xc6b1('0x3c')]);_0x2b86b8[_0xc6b1('0x3d')]=_[_0xc6b1('0x3e')](_0x2b86b8['model'],_0x2b86b8[_0xc6b1('0x3c')]);_0x38d8e3[_0xc6b1('0x3f')]=_[_0xc6b1('0x3e')](_0x2b86b8[_0xc6b1('0x3b')],qs[_0xc6b1('0x40')](_0xefbd79[_0xc6b1('0x3c')][_0xc6b1('0x40')]));_0x38d8e3['attributes']=_0x38d8e3[_0xc6b1('0x3f')][_0xc6b1('0x41')]?_0x38d8e3[_0xc6b1('0x3f')]:_0x2b86b8[_0xc6b1('0x3b')];if(_0xefbd79['query'][_0xc6b1('0x4a')]){_0x38d8e3[_0xc6b1('0x4b')]=[{'all':!![]}];}_0x38d8e3=_[_0xc6b1('0x47')]({},_0x38d8e3,_0xefbd79['options']);return db['MailQueue'][_0xc6b1('0x52')](_0x38d8e3)[_0xc6b1('0x2c')](handleEntityNotFound(_0x517d35,null))[_0xc6b1('0x2c')](respondWithResult(_0x517d35,null))[_0xc6b1('0x4e')](handleError(_0x517d35,null));};exports[_0xc6b1('0x53')]=function(_0x3fb5de,_0x19037d){return db[_0xc6b1('0x36')][_0xc6b1('0x53')](_0x3fb5de[_0xc6b1('0x54')],{})[_0xc6b1('0x2c')](function(_0x5ba94b){var _0x3c4359=_0x3fb5de[_0xc6b1('0x55')][_0xc6b1('0x2d')]({'plain':!![]});if(!_0x3c4359)throw new Error(_0xc6b1('0x56'));if(_0x3c4359[_0xc6b1('0x57')]===_0xc6b1('0x55')){var _0x26b67b=_0x5ba94b[_0xc6b1('0x2d')]({'plain':!![]});var _0x5d9c88=_0xc6b1('0x2e');return db[_0xc6b1('0x58')][_0xc6b1('0x52')]({'where':{'name':_0x5d9c88,'userProfileId':_0x3c4359[_0xc6b1('0x59')]},'raw':!![]})[_0xc6b1('0x2c')](function(_0x298ccf){if(_0x298ccf&&_0x298ccf[_0xc6b1('0x5a')]===0x0){return db[_0xc6b1('0x2f')][_0xc6b1('0x53')]({'name':_0x26b67b[_0xc6b1('0x32')],'resourceId':_0x26b67b['id'],'type':_0x298ccf['name'],'sectionId':_0x298ccf['id']},{})[_0xc6b1('0x2c')](function(){return _0x5ba94b;});}else{return _0x5ba94b;}})[_0xc6b1('0x4e')](function(_0x2fb48c){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2fb48c);throw _0x2fb48c;});}return _0x5ba94b;})[_0xc6b1('0x2c')](respondWithResult(_0x19037d,0xc9))['catch'](handleError(_0x19037d,null));};exports[_0xc6b1('0x2a')]=function(_0x5c57ab,_0x490855){if(_0x5c57ab['body']['id']){delete _0x5c57ab['body']['id'];}return db['MailQueue'][_0xc6b1('0x52')]({'where':{'id':_0x5c57ab[_0xc6b1('0x50')]['id']}})[_0xc6b1('0x2c')](handleEntityNotFound(_0x490855,null))[_0xc6b1('0x2c')](saveUpdates(_0x5c57ab[_0xc6b1('0x54')],null))['then'](respondWithResult(_0x490855,null))[_0xc6b1('0x4e')](handleError(_0x490855,null));};exports[_0xc6b1('0x2b')]=function(_0x2d3597,_0x38e1e4){return db[_0xc6b1('0x36')][_0xc6b1('0x52')]({'where':{'id':_0x2d3597[_0xc6b1('0x50')]['id']}})[_0xc6b1('0x2c')](handleEntityNotFound(_0x38e1e4,null))[_0xc6b1('0x2c')](removeEntity(_0x38e1e4,null))['catch'](handleError(_0x38e1e4,null));};exports['describe']=function(_0x1879de,_0x21fc47){return db[_0xc6b1('0x36')]['describe']()[_0xc6b1('0x2c')](respondWithResult(_0x21fc47,null))[_0xc6b1('0x4e')](handleError(_0x21fc47,null));};exports[_0xc6b1('0x5b')]=function(_0x273afa,_0x1a1ae7,_0x2526f9){var _0x2ef2f2={'raw':!![],'where':{}},_0x393201={},_0x5c2db1;return db[_0xc6b1('0x36')][_0xc6b1('0x5c')]({'where':{'id':_0x273afa['params']['id']}})[_0xc6b1('0x2c')](handleEntityNotFound(_0x1a1ae7,null))['then'](function(_0x40bd6c){if(_0x40bd6c){_0x5c2db1=_0x40bd6c[_0xc6b1('0x2d')]({'plain':!![]});_0x393201[_0xc6b1('0x3b')]=_[_0xc6b1('0x51')](db[_0xc6b1('0x5d')][_0xc6b1('0x37')]);_0x393201[_0xc6b1('0x3c')]=_['keys'](_0x273afa[_0xc6b1('0x3c')]);_0x393201[_0xc6b1('0x3d')]=_['intersection'](_0x393201[_0xc6b1('0x3b')],_0x393201[_0xc6b1('0x3c')]);_0x2ef2f2['attributes']=_[_0xc6b1('0x3e')](_0x393201[_0xc6b1('0x3b')],qs[_0xc6b1('0x40')](_0x273afa[_0xc6b1('0x3c')][_0xc6b1('0x40')]));_0x2ef2f2['attributes']=_0x2ef2f2[_0xc6b1('0x3f')][_0xc6b1('0x41')]?_0x2ef2f2[_0xc6b1('0x3f')]:_0x393201[_0xc6b1('0x3b')];if(!_0x273afa[_0xc6b1('0x3c')]['hasOwnProperty']('nolimit')){_0x2ef2f2[_0xc6b1('0x22')]=qs[_0xc6b1('0x22')](_0x273afa['query']['limit']);_0x2ef2f2[_0xc6b1('0x24')]=qs['offset'](_0x273afa[_0xc6b1('0x3c')][_0xc6b1('0x24')]);}_0x2ef2f2[_0xc6b1('0x43')]=qs['sort'](_0x273afa[_0xc6b1('0x3c')][_0xc6b1('0x44')]);_0x2ef2f2[_0xc6b1('0x45')]=qs[_0xc6b1('0x3d')](_[_0xc6b1('0x46')](_0x273afa[_0xc6b1('0x3c')],_0x393201[_0xc6b1('0x3d')]));_0x2ef2f2[_0xc6b1('0x45')][_0xc6b1('0x5e')]=_0x40bd6c['id'];if(_0x273afa[_0xc6b1('0x3c')]['filter']){_0x2ef2f2['where']=_[_0xc6b1('0x47')](_0x2ef2f2[_0xc6b1('0x45')],{'$or':_[_0xc6b1('0x35')](_0x2ef2f2[_0xc6b1('0x3f')],function(_0x3bc5ab){var _0x2499fb={};_0x2499fb[_0x3bc5ab]={'$like':'%'+_0x273afa[_0xc6b1('0x3c')][_0xc6b1('0x5f')]+'%'};return _0x2499fb;})});}_0x2ef2f2=_['merge']({},_0x2ef2f2,_0x273afa[_0xc6b1('0x49')]);return db[_0xc6b1('0x5d')][_0xc6b1('0x4c')](_0x2ef2f2);}})[_0xc6b1('0x2c')](function(_0x53b94e){if(_0x53b94e){return db[_0xc6b1('0x60')][_0xc6b1('0x61')]({'where':{'id':_[_0xc6b1('0x35')](_0x53b94e,_0xc6b1('0x62')),'role':_0xc6b1('0x63')},'attributes':['id',_0xc6b1('0x32'),_0xc6b1('0x64'),_0xc6b1('0x65'),_0xc6b1('0x66')]});}})[_0xc6b1('0x2c')](function(_0x4eb966){if(_0x4eb966){return{'count':_0x4eb966[_0xc6b1('0x23')],'rows':_[_0xc6b1('0x35')](_0x4eb966[_0xc6b1('0x4d')],function(_0x2b0035){return{'membername':_0x2b0035['name'],'UserId':_0x2b0035['id'],'queue_name':_0x5c2db1[_0xc6b1('0x32')],'MailQueueId':_0x5c2db1['id'],'interface':util['format'](_0xc6b1('0x67'),'SIP',_0x2b0035['name']),'penalty':0x0,'paused':_0x2b0035[_0xc6b1('0x64')],'createdAt':_0x2b0035[_0xc6b1('0x66')],'updatedAt':_0x2b0035[_0xc6b1('0x65')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xc6b1('0x2c')](respondWithFilteredResult(_0x1a1ae7,_0x2ef2f2))[_0xc6b1('0x4e')](handleError(_0x1a1ae7,null));};exports['getTeams']=function(_0x6d16e5,_0x16137c,_0x305162){var _0x4227a8={};var _0x170259={};var _0x117ca0;var _0x6499db;return db['MailQueue']['findOne']({'where':{'id':_0x6d16e5[_0xc6b1('0x50')]['id']}})['then'](handleEntityNotFound(_0x16137c,null))[_0xc6b1('0x2c')](function(_0x20a31e){if(_0x20a31e){_0x117ca0=_0x20a31e;_0x170259[_0xc6b1('0x3b')]=_[_0xc6b1('0x51')](db[_0xc6b1('0x68')][_0xc6b1('0x37')]);_0x170259[_0xc6b1('0x3c')]=_[_0xc6b1('0x51')](_0x6d16e5[_0xc6b1('0x3c')]);_0x170259[_0xc6b1('0x3d')]=_[_0xc6b1('0x3e')](_0x170259[_0xc6b1('0x3b')],_0x170259[_0xc6b1('0x3c')]);_0x4227a8[_0xc6b1('0x3f')]=_[_0xc6b1('0x3e')](_0x170259[_0xc6b1('0x3b')],qs[_0xc6b1('0x40')](_0x6d16e5[_0xc6b1('0x3c')][_0xc6b1('0x40')]));_0x4227a8['attributes']=_0x4227a8['attributes'][_0xc6b1('0x41')]?_0x4227a8['attributes']:_0x170259[_0xc6b1('0x3b')];_0x4227a8[_0xc6b1('0x43')]=qs[_0xc6b1('0x44')](_0x6d16e5['query'][_0xc6b1('0x44')]);_0x4227a8[_0xc6b1('0x45')]=qs[_0xc6b1('0x3d')](_[_0xc6b1('0x46')](_0x6d16e5[_0xc6b1('0x3c')],_0x170259[_0xc6b1('0x3d')]));if(_0x6d16e5['query'][_0xc6b1('0x5f')]){_0x4227a8[_0xc6b1('0x45')]=_[_0xc6b1('0x47')](_0x4227a8[_0xc6b1('0x45')],{'$or':_['map'](_0x4227a8[_0xc6b1('0x3f')],function(_0x2f9f03){var _0x4f30cf={};_0x4f30cf[_0x2f9f03]={'$like':'%'+_0x6d16e5[_0xc6b1('0x3c')]['filter']+'%'};return _0x4f30cf;})});}_0x4227a8=_[_0xc6b1('0x47')]({},_0x4227a8,_0x6d16e5['options']);return _0x117ca0[_0xc6b1('0x69')](_0x4227a8);}})[_0xc6b1('0x2c')](function(_0x4534f6){if(_0x4534f6){_0x6499db=_0x4534f6['length'];if(!_0x6d16e5['query'][_0xc6b1('0x42')](_0xc6b1('0x6a'))){_0x4227a8[_0xc6b1('0x22')]=qs['limit'](_0x6d16e5['query'][_0xc6b1('0x22')]);_0x4227a8[_0xc6b1('0x24')]=qs[_0xc6b1('0x24')](_0x6d16e5['query'][_0xc6b1('0x24')]);}return _0x117ca0[_0xc6b1('0x69')](_0x4227a8);}})['then'](function(_0x458a7b){if(_0x458a7b){return _0x458a7b?{'count':_0x6499db,'rows':_0x458a7b}:null;}})[_0xc6b1('0x2c')](respondWithResult(_0x16137c,null))[_0xc6b1('0x4e')](handleError(_0x16137c,null));};exports[_0xc6b1('0x6b')]=function(_0x23a447,_0x4b80f2,_0x356de7){var _0x14b2c7=_0x23a447[_0xc6b1('0x54')][_0xc6b1('0x6c')];return db[_0xc6b1('0x68')][_0xc6b1('0x4c')]({'where':{'id':_0x14b2c7},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xc6b1('0x32'),'online',_0xc6b1('0x6d'),_0xc6b1('0x6e')],'raw':!![]}]})[_0xc6b1('0x2c')](function(_0x117938){if(_0x117938){var _0x3fe772=_[_0xc6b1('0x6f')](_0x117938,function(_0x38a33d){var _0x4594f8=_0x38a33d[_0xc6b1('0x2d')]({'plain':!![]});return _0x4594f8[_0xc6b1('0x70')];});return db[_0xc6b1('0x36')][_0xc6b1('0x52')]({'where':{'id':_0x23a447[_0xc6b1('0x50')]['id']}})[_0xc6b1('0x2c')](function(_0x57e93f){return db[_0xc6b1('0x71')][_0xc6b1('0x72')](function(_0x353ce5){return _0x57e93f[_0xc6b1('0x6b')](_0x14b2c7,{'transaction':_0x353ce5})['then'](function(){return BPromise[_0xc6b1('0x73')](_0x3fe772,function(_0x4324dc){return db['UserMailQueue'][_0xc6b1('0x74')]({'where':{'UserId':_0x4324dc['id'],'MailQueueId':_0x23a447[_0xc6b1('0x50')]['id']},'transaction':_0x353ce5});});})[_0xc6b1('0x2c')](function(){_0x3fe772[_0xc6b1('0x75')](function(_0x4cbd31){socket[_0xc6b1('0x76')](_0xc6b1('0x77'),{'UserId':_0x4cbd31['id'],'MailQueueId':_0x57e93f['id']});});});});});}})[_0xc6b1('0x2c')](respondWithStatusCode(_0x4b80f2,null))['catch'](handleError(_0x4b80f2,null));};exports[_0xc6b1('0x78')]=function(_0x2315aa,_0x847caa,_0x5b8b66){return db[_0xc6b1('0x68')]['findAll']({'where':{'id':_0x2315aa['query'][_0xc6b1('0x6c')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xc6b1('0x70'),'attributes':['id'],'raw':!![]}]})[_0xc6b1('0x2c')](handleEntityNotFound(_0x847caa,null))['then'](function(_0x1696c4){var _0x1a4d82=_[_0xc6b1('0x35')](_0x1696c4,'id');var _0x5c855b=[];var _0xdbefc7=[];var _0x2d625a=squel['select']();_0x2d625a['field'](_0xc6b1('0x79'))['from'](_0xc6b1('0x7a'),'tq')[_0xc6b1('0x7b')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0xc6b1('0x7c'),_0x2315aa[_0xc6b1('0x50')]['id']);for(var _0x5e1247=0x0;_0x5e1247<_0x1696c4[_0xc6b1('0x41')];_0x5e1247+=0x1){let _0x31270f=_0x1696c4[_0x5e1247];for(var _0x3dc660=0x0;_0x3dc660<_0x31270f[_0xc6b1('0x70')][_0xc6b1('0x41')];_0x3dc660+=0x1){let _0x13872b=_0x31270f['Agents'][_0x3dc660];var _0x221435=_0x2d625a[_0xc6b1('0x7d')]();_0x221435[_0xc6b1('0x45')]('ut.UserId\x20=\x20?',_0x13872b['id']);_0xdbefc7[_0xc6b1('0x7e')](db[_0xc6b1('0x71')][_0xc6b1('0x3c')](_0x221435[_0xc6b1('0x7f')](),{'type':db[_0xc6b1('0x71')]['QueryTypes'][_0xc6b1('0x80')]})[_0xc6b1('0x2c')](function(_0x18a196){if(_0x18a196['length']===0x1){return _0x13872b['id'];}else{var _0x267130=_[_0xc6b1('0x81')](_[_0xc6b1('0x35')](_0x18a196,'TeamId'),function(_0x128782){return _[_0xc6b1('0x82')](_0x1a4d82,_0x128782);});if(_0x267130){return _0x13872b['id'];}}}));}}return BPromise[_0xc6b1('0x83')](_0xdbefc7)[_0xc6b1('0x2c')](function(_0x213c08){_0x5c855b=_(_0x5c855b)[_0xc6b1('0x84')](_0x213c08)[_0xc6b1('0x85')]()[_0xc6b1('0x86')]();return db[_0xc6b1('0x36')][_0xc6b1('0x52')]({'where':{'id':_0x2315aa[_0xc6b1('0x50')]['id']}})[_0xc6b1('0x2c')](function(_0x542f35){return db[_0xc6b1('0x71')][_0xc6b1('0x72')](function(_0x54937b){return _0x542f35['removeTeams'](_0x2315aa[_0xc6b1('0x3c')][_0xc6b1('0x6c')],{'transaction':_0x54937b})[_0xc6b1('0x2c')](function(){if(!_[_0xc6b1('0x87')](_0x5c855b)){return _0x542f35[_0xc6b1('0x88')](_0x5c855b,{'transaction':_0x54937b});}})['then'](function(){_0x5c855b[_0xc6b1('0x75')](function(_0x3ea23e){socket['emit'](_0xc6b1('0x89'),{'UserId':_0x3ea23e,'MailQueueId':_0x542f35['id']});});});});});});})['then'](respondWithStatusCode(_0x847caa,null))['catch'](handleError(_0x847caa,null));};exports[_0xc6b1('0x8a')]=function(_0x1a2bbe,_0x1d1f69,_0x32e123){return db[_0xc6b1('0x36')]['find']({'where':{'id':_0x1a2bbe['params']['id']}})[_0xc6b1('0x2c')](handleEntityNotFound(_0x1d1f69,null))[_0xc6b1('0x2c')](function(_0x108433){if(_0x108433){return _0x108433[_0xc6b1('0x8a')](_0x1a2bbe[_0xc6b1('0x54')][_0xc6b1('0x6c')],_[_0xc6b1('0x8b')](_0x1a2bbe[_0xc6b1('0x54')],['ids','id'])||{})['spread'](function(_0x4edc41){for(var _0x38e8f9=0x0;_0x38e8f9<_0x1a2bbe[_0xc6b1('0x54')]['ids'][_0xc6b1('0x41')];_0x38e8f9+=0x1){socket[_0xc6b1('0x76')](_0xc6b1('0x77'),{'UserId':Number(_0x1a2bbe['body'][_0xc6b1('0x6c')][_0x38e8f9]),'MailQueueId':Number(_0x1a2bbe[_0xc6b1('0x50')]['id'])});}return _0x4edc41;});}})['then'](respondWithResult(_0x1d1f69,null))[_0xc6b1('0x4e')](handleError(_0x1d1f69,null));};exports[_0xc6b1('0x88')]=function(_0x25fa01,_0x3423ed,_0x2e9173){return db['MailQueue'][_0xc6b1('0x52')]({'where':{'id':_0x25fa01['params']['id']}})[_0xc6b1('0x2c')](handleEntityNotFound(_0x3423ed,null))[_0xc6b1('0x2c')](function(_0x3a479b){if(_0x3a479b){return _0x3a479b[_0xc6b1('0x88')](_0x25fa01['query'][_0xc6b1('0x6c')])[_0xc6b1('0x2c')](function(){if(_[_0xc6b1('0x8c')](_0x25fa01[_0xc6b1('0x3c')][_0xc6b1('0x6c')])){for(var _0xcd0d00=0x0;_0xcd0d00<_0x25fa01['query'][_0xc6b1('0x6c')][_0xc6b1('0x41')];_0xcd0d00+=0x1){socket[_0xc6b1('0x76')](_0xc6b1('0x89'),{'UserId':Number(_0x25fa01[_0xc6b1('0x3c')][_0xc6b1('0x6c')][_0xcd0d00]),'MailQueueId':Number(_0x25fa01[_0xc6b1('0x50')]['id'])});}}else{socket['emit'](_0xc6b1('0x89'),{'UserId':Number(_0x25fa01[_0xc6b1('0x3c')][_0xc6b1('0x6c')]),'MailQueueId':Number(_0x25fa01[_0xc6b1('0x50')]['id'])});}});}})[_0xc6b1('0x2c')](respondWithStatusCode(_0x3423ed,null))[_0xc6b1('0x4e')](handleError(_0x3423ed,null));};exports[_0xc6b1('0x8d')]=function(_0x19228f,_0xb86a87,_0x3643a7){var _0x2221af={};var _0x155944={};var _0x3fd1e7;var _0x4734d6;return db[_0xc6b1('0x36')][_0xc6b1('0x5c')]({'where':{'id':_0x19228f['params']['id']}})[_0xc6b1('0x2c')](handleEntityNotFound(_0xb86a87,null))[_0xc6b1('0x2c')](function(_0x4d8cd5){if(_0x4d8cd5){_0x3fd1e7=_0x4d8cd5;_0x155944[_0xc6b1('0x3b')]=_[_0xc6b1('0x51')](db['User'][_0xc6b1('0x37')]);_0x155944[_0xc6b1('0x3c')]=_[_0xc6b1('0x51')](_0x19228f[_0xc6b1('0x3c')]);_0x155944[_0xc6b1('0x3d')]=_[_0xc6b1('0x3e')](_0x155944[_0xc6b1('0x3b')],_0x155944[_0xc6b1('0x3c')]);_0x2221af[_0xc6b1('0x3f')]=_['intersection'](_0x155944[_0xc6b1('0x3b')],qs[_0xc6b1('0x40')](_0x19228f[_0xc6b1('0x3c')][_0xc6b1('0x40')]));_0x2221af[_0xc6b1('0x3f')]=_0x2221af[_0xc6b1('0x3f')][_0xc6b1('0x41')]?_0x2221af['attributes']:_0x155944[_0xc6b1('0x3b')];_0x2221af[_0xc6b1('0x43')]=qs[_0xc6b1('0x44')](_0x19228f['query']['sort']);_0x2221af[_0xc6b1('0x45')]=qs[_0xc6b1('0x3d')](_[_0xc6b1('0x46')](_0x19228f['query'],_0x155944[_0xc6b1('0x3d')]));if(_0x19228f[_0xc6b1('0x3c')][_0xc6b1('0x5f')]){_0x2221af[_0xc6b1('0x45')]=_[_0xc6b1('0x47')](_0x2221af['where'],{'$or':_[_0xc6b1('0x35')](_0x2221af[_0xc6b1('0x3f')],function(_0x45afac){var _0x3386b6={};_0x3386b6[_0x45afac]={'$like':'%'+_0x19228f['query']['filter']+'%'};return _0x3386b6;})});}_0x2221af=_['merge']({},_0x2221af,_0x19228f['options']);return _0x3fd1e7[_0xc6b1('0x8d')](_0x2221af);}})[_0xc6b1('0x2c')](function(_0xcfa510){if(_0xcfa510){_0x4734d6=_0xcfa510[_0xc6b1('0x41')];if(!_0x19228f[_0xc6b1('0x3c')]['hasOwnProperty'](_0xc6b1('0x6a'))){_0x2221af[_0xc6b1('0x22')]=qs[_0xc6b1('0x22')](_0x19228f[_0xc6b1('0x3c')][_0xc6b1('0x22')]);_0x2221af['offset']=qs[_0xc6b1('0x24')](_0x19228f['query'][_0xc6b1('0x24')]);}return _0x3fd1e7[_0xc6b1('0x8d')](_0x2221af);}})['then'](function(_0x2c6555){if(_0x2c6555){return _0x2c6555?{'count':_0x4734d6,'rows':_0x2c6555}:null;}})[_0xc6b1('0x2c')](respondWithResult(_0xb86a87,null))['catch'](handleError(_0xb86a87,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index efdaba8..eadd49f 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 _0xfa6f=['save','update','emit','hook','exports','../../mysqldb','MailQueue','setMaxListeners'];(function(_0x2dd154,_0x258b51){var _0x1f573f=function(_0x262f2e){while(--_0x262f2e){_0x2dd154['push'](_0x2dd154['shift']());}};_0x1f573f(++_0x258b51);}(_0xfa6f,0x75));var _0xffa6=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0xfa6f[_0x4c12ec];return _0x3ae42c;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0xffa6('0x0'))['db'][_0xffa6('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xffa6('0x2')](0x0);var events={'afterCreate':_0xffa6('0x3'),'afterUpdate':_0xffa6('0x4'),'afterDestroy':'remove'};function emitEvent(_0x485b5e){return function(_0x2bd8d6,_0x71a9a8,_0x410783){MailQueueEvents[_0xffa6('0x5')](_0x485b5e+':'+_0x2bd8d6['id'],_0x2bd8d6);MailQueueEvents[_0xffa6('0x5')](_0x485b5e,_0x2bd8d6);_0x410783(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0xffa6('0x6')](e,emitEvent(event));}}module[_0xffa6('0x7')]=MailQueueEvents; \ No newline at end of file +var _0x0888=['MailQueue','setMaxListeners','save','remove','emit','hook','exports','events'];(function(_0x329274,_0x286a29){var _0x42af70=function(_0x2d7518){while(--_0x2d7518){_0x329274['push'](_0x329274['shift']());}};_0x42af70(++_0x286a29);}(_0x0888,0x167));var _0x8088=function(_0x5a02fa,_0x24b83a){_0x5a02fa=_0x5a02fa-0x0;var _0x209272=_0x0888[_0x5a02fa];return _0x209272;};'use strict';var EventEmitter=require(_0x8088('0x0'));var MailQueue=require('../../mysqldb')['db'][_0x8088('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x8088('0x2')](0x0);var events={'afterCreate':_0x8088('0x3'),'afterUpdate':'update','afterDestroy':_0x8088('0x4')};function emitEvent(_0x4b952b){return function(_0x43e82d,_0x1b2e50,_0x350fa4){MailQueueEvents[_0x8088('0x5')](_0x4b952b+':'+_0x43e82d['id'],_0x43e82d);MailQueueEvents[_0x8088('0x5')](_0x4b952b,_0x43e82d);_0x350fa4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0x8088('0x6')](e,emitEvent(event));}}module[_0x8088('0x7')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index acff4ec..20598ca 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 _0xc2f3=['bluebird','request-promise','path','exports','define','MailQueue','mail_queues','lodash','util','moment'];(function(_0x21e23d,_0x749755){var _0x423baa=function(_0x175290){while(--_0x175290){_0x21e23d['push'](_0x21e23d['shift']());}};_0x423baa(++_0x749755);}(_0xc2f3,0x75));var _0x3c2f=function(_0x4320a0,_0x21b68b){_0x4320a0=_0x4320a0-0x0;var _0x93bb23=_0xc2f3[_0x4320a0];return _0x93bb23;};'use strict';var _=require(_0x3c2f('0x0'));var util=require(_0x3c2f('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x3c2f('0x2'));var BPromise=require(_0x3c2f('0x3'));var rp=require(_0x3c2f('0x4'));var fs=require('fs');var path=require(_0x3c2f('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./mailQueue.attributes');module[_0x3c2f('0x6')]=function(_0xb7b57e,_0x4dd91a){return _0xb7b57e[_0x3c2f('0x7')](_0x3c2f('0x8'),attributes,{'tableName':_0x3c2f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x62b2=['request-promise','rimraf','../../config/environment','./mailQueue.attributes','MailQueue','lodash','../../config/logger','api','moment','bluebird'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x62b2,0x87));var _0x262b=function(_0x5b053f,_0x22c0ba){_0x5b053f=_0x5b053f-0x0;var _0xcf62b8=_0x62b2[_0x5b053f];return _0xcf62b8;};'use strict';var _=require(_0x262b('0x0'));var util=require('util');var logger=require(_0x262b('0x1'))(_0x262b('0x2'));var moment=require(_0x262b('0x3'));var BPromise=require(_0x262b('0x4'));var rp=require(_0x262b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x262b('0x6'));var config=require(_0x262b('0x7'));var attributes=require(_0x262b('0x8'));module['exports']=function(_0xab18f9,_0x56341b){return _0xab18f9['define'](_0x262b('0x9'),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 46626c9..745150b 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 _0xbc0f=['jayson/promise','client','http','redis','localhost','socket.io-emitter','info','request\x20sent','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','MailQueue,\x20%s,\x20%s','result','catch','GetMailQueue','MailQueue','findAll','options','raw','where','attributes','limit','include','map','model','then','ShowMailQueue','find','debug','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0xeb8b1c,_0x59fee9){var _0x37fb25=function(_0x171691){while(--_0x171691){_0xeb8b1c['push'](_0xeb8b1c['shift']());}};_0x37fb25(++_0x59fee9);}(_0xbc0f,0x175));var _0xfbc0=function(_0x51c819,_0xd812db){_0x51c819=_0x51c819-0x0;var _0x15c5d2=_0xbc0f[_0x51c819];return _0x15c5d2;};'use strict';var _=require(_0xfbc0('0x0'));var util=require(_0xfbc0('0x1'));var moment=require('moment');var BPromise=require(_0xfbc0('0x2'));var rs=require(_0xfbc0('0x3'));var fs=require('fs');var Redis=require(_0xfbc0('0x4'));var db=require(_0xfbc0('0x5'))['db'];var utils=require(_0xfbc0('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xfbc0('0x7'));var client=jayson[_0xfbc0('0x8')][_0xfbc0('0x9')]({'port':0x232a});config[_0xfbc0('0xa')]=_['defaults'](config[_0xfbc0('0xa')],{'host':_0xfbc0('0xb'),'port':0x18eb});var socket=require(_0xfbc0('0xc'))(new Redis(config['redis']));require('./mailQueue.socket')['register'](socket);function respondWithRpcPromise(_0x20ce6f,_0x4e15d7,_0x2e43e9){return new BPromise(function(_0x2e7465,_0x3a96e3){return client['request'](_0x20ce6f,_0x2e43e9)['then'](function(_0x3c2762){logger[_0xfbc0('0xd')]('MailQueue,\x20%s,\x20%s',_0x4e15d7,_0xfbc0('0xe'));logger['debug'](_0xfbc0('0xf'),_0x4e15d7,_0xfbc0('0xe'),JSON[_0xfbc0('0x10')](_0x3c2762));if(_0x3c2762[_0xfbc0('0x11')]){if(_0x3c2762[_0xfbc0('0x11')][_0xfbc0('0x12')]===0x1f4){logger['error']('MailQueue,\x20%s,\x20%s',_0x4e15d7,_0x3c2762['error']['message']);return _0x3a96e3(_0x3c2762[_0xfbc0('0x11')][_0xfbc0('0x13')]);}logger[_0xfbc0('0x11')]('MailQueue,\x20%s,\x20%s',_0x4e15d7,_0x3c2762[_0xfbc0('0x11')][_0xfbc0('0x13')]);return _0x2e7465(_0x3c2762[_0xfbc0('0x11')][_0xfbc0('0x13')]);}else{logger[_0xfbc0('0xd')](_0xfbc0('0x14'),_0x4e15d7,_0xfbc0('0xe'));_0x2e7465(_0x3c2762[_0xfbc0('0x15')][_0xfbc0('0x13')]);}})[_0xfbc0('0x16')](function(_0xc7638e){logger[_0xfbc0('0x11')]('MailQueue,\x20%s,\x20%s',_0x4e15d7,_0xc7638e);_0x3a96e3(_0xc7638e);});});}exports[_0xfbc0('0x17')]=function(_0x214795){var _0x864f9=this;return new Promise(function(_0x23ae11,_0x4f1e4e){return db[_0xfbc0('0x18')][_0xfbc0('0x19')]({'raw':_0x214795[_0xfbc0('0x1a')]?_0x214795[_0xfbc0('0x1a')][_0xfbc0('0x1b')]===undefined?!![]:![]:!![],'where':_0x214795[_0xfbc0('0x1a')]?_0x214795[_0xfbc0('0x1a')][_0xfbc0('0x1c')]||null:null,'attributes':_0x214795[_0xfbc0('0x1a')]?_0x214795['options'][_0xfbc0('0x1d')]||null:null,'limit':_0x214795[_0xfbc0('0x1a')]?_0x214795[_0xfbc0('0x1a')][_0xfbc0('0x1e')]||null:null,'include':_0x214795[_0xfbc0('0x1a')]?_0x214795[_0xfbc0('0x1a')][_0xfbc0('0x1f')]?_['map'](_0x214795[_0xfbc0('0x1a')][_0xfbc0('0x1f')],function(_0x2e9f0a){return{'model':db[_0x2e9f0a['model']],'as':_0x2e9f0a['as'],'attributes':_0x2e9f0a[_0xfbc0('0x1d')],'include':_0x2e9f0a[_0xfbc0('0x1f')]?_[_0xfbc0('0x20')](_0x2e9f0a[_0xfbc0('0x1f')],function(_0x49e00f){return{'model':db[_0x49e00f[_0xfbc0('0x21')]],'as':_0x49e00f['as'],'attributes':_0x49e00f[_0xfbc0('0x1d')],'include':_0x49e00f['include']?_[_0xfbc0('0x20')](_0x49e00f['include'],function(_0x2f8446){return{'model':db[_0x2f8446[_0xfbc0('0x21')]],'as':_0x2f8446['as'],'attributes':_0x2f8446[_0xfbc0('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xfbc0('0x22')](function(_0xbd67d1){logger[_0xfbc0('0xd')]('GetMailQueue',_0x214795);logger['debug'](_0xfbc0('0x17'),_0x214795,JSON[_0xfbc0('0x10')](_0xbd67d1));_0x23ae11(_0xbd67d1);})[_0xfbc0('0x16')](function(_0x3f6ada){logger['error'](_0xfbc0('0x17'),_0x3f6ada['message'],_0x214795);_0x4f1e4e(_0x864f9['error'](0x1f4,_0x3f6ada[_0xfbc0('0x13')]));});});};exports[_0xfbc0('0x23')]=function(_0x57fad0){var _0x1b6cce=this;return new Promise(function(_0x4cd3dd,_0x27d395){return db[_0xfbc0('0x18')][_0xfbc0('0x24')]({'raw':_0x57fad0['options']?_0x57fad0['options'][_0xfbc0('0x1b')]===undefined?!![]:![]:!![],'where':_0x57fad0[_0xfbc0('0x1a')]?_0x57fad0[_0xfbc0('0x1a')][_0xfbc0('0x1c')]||null:null,'attributes':_0x57fad0[_0xfbc0('0x1a')]?_0x57fad0['options'][_0xfbc0('0x1d')]||null:null,'include':_0x57fad0[_0xfbc0('0x1a')]?_0x57fad0['options'][_0xfbc0('0x1f')]?_[_0xfbc0('0x20')](_0x57fad0['options'][_0xfbc0('0x1f')],function(_0x508656){return{'model':db[_0x508656[_0xfbc0('0x21')]],'as':_0x508656['as'],'attributes':_0x508656['attributes'],'include':_0x508656[_0xfbc0('0x1f')]?_[_0xfbc0('0x20')](_0x508656[_0xfbc0('0x1f')],function(_0x3199cb){return{'model':db[_0x3199cb[_0xfbc0('0x21')]],'as':_0x3199cb['as'],'attributes':_0x3199cb[_0xfbc0('0x1d')],'include':_0x3199cb[_0xfbc0('0x1f')]?_[_0xfbc0('0x20')](_0x3199cb[_0xfbc0('0x1f')],function(_0x14999e){return{'model':db[_0x14999e[_0xfbc0('0x21')]],'as':_0x14999e['as'],'attributes':_0x14999e[_0xfbc0('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xfbc0('0x22')](function(_0x332124){logger[_0xfbc0('0xd')](_0xfbc0('0x23'),_0x57fad0);logger[_0xfbc0('0x25')](_0xfbc0('0x23'),_0x57fad0,JSON[_0xfbc0('0x10')](_0x332124));_0x4cd3dd(_0x332124);})['catch'](function(_0x55f8bf){logger[_0xfbc0('0x11')](_0xfbc0('0x23'),_0x55f8bf[_0xfbc0('0x13')],_0x57fad0);_0x27d395(_0x1b6cce['error'](0x1f4,_0x55f8bf[_0xfbc0('0x13')]));});});}; \ No newline at end of file +var _0xbe2d=['error','code','MailQueue,\x20%s,\x20%s','message','result','GetMailQueue','MailQueue','findAll','options','raw','where','attributes','limit','include','map','model','catch','find','ShowMailQueue','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','./mailQueue.socket','register','request','then','info','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5eb8d7,_0xfc8daf){var _0x38ec33=function(_0x1c4041){while(--_0x1c4041){_0x5eb8d7['push'](_0x5eb8d7['shift']());}};_0x38ec33(++_0xfc8daf);}(_0xbe2d,0x17b));var _0xdbe2=function(_0x1f2a72,_0x2fb5b3){_0x1f2a72=_0x1f2a72-0x0;var _0x28c96c=_0xbe2d[_0x1f2a72];return _0x28c96c;};'use strict';var _=require(_0xdbe2('0x0'));var util=require('util');var moment=require(_0xdbe2('0x1'));var BPromise=require(_0xdbe2('0x2'));var rs=require(_0xdbe2('0x3'));var fs=require('fs');var Redis=require(_0xdbe2('0x4'));var db=require(_0xdbe2('0x5'))['db'];var utils=require(_0xdbe2('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xdbe2('0x7'));var jayson=require(_0xdbe2('0x8'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_['defaults'](config[_0xdbe2('0x9')],{'host':_0xdbe2('0xa'),'port':0x18eb});var socket=require(_0xdbe2('0xb'))(new Redis(config[_0xdbe2('0x9')]));require(_0xdbe2('0xc'))[_0xdbe2('0xd')](socket);function respondWithRpcPromise(_0xe5a635,_0x5b9a30,_0x2389b9){return new BPromise(function(_0x59a15b,_0x2bb337){return client[_0xdbe2('0xe')](_0xe5a635,_0x2389b9)[_0xdbe2('0xf')](function(_0x3d5ce9){logger[_0xdbe2('0x10')]('MailQueue,\x20%s,\x20%s',_0x5b9a30,_0xdbe2('0x11'));logger[_0xdbe2('0x12')](_0xdbe2('0x13'),_0x5b9a30,_0xdbe2('0x11'),JSON[_0xdbe2('0x14')](_0x3d5ce9));if(_0x3d5ce9[_0xdbe2('0x15')]){if(_0x3d5ce9['error'][_0xdbe2('0x16')]===0x1f4){logger[_0xdbe2('0x15')](_0xdbe2('0x17'),_0x5b9a30,_0x3d5ce9[_0xdbe2('0x15')][_0xdbe2('0x18')]);return _0x2bb337(_0x3d5ce9['error']['message']);}logger[_0xdbe2('0x15')]('MailQueue,\x20%s,\x20%s',_0x5b9a30,_0x3d5ce9[_0xdbe2('0x15')][_0xdbe2('0x18')]);return _0x59a15b(_0x3d5ce9[_0xdbe2('0x15')][_0xdbe2('0x18')]);}else{logger['info'](_0xdbe2('0x17'),_0x5b9a30,_0xdbe2('0x11'));_0x59a15b(_0x3d5ce9[_0xdbe2('0x19')]['message']);}})['catch'](function(_0x32a40b){logger[_0xdbe2('0x15')](_0xdbe2('0x17'),_0x5b9a30,_0x32a40b);_0x2bb337(_0x32a40b);});});}exports[_0xdbe2('0x1a')]=function(_0x3937af){var _0x224446=this;return new Promise(function(_0x1026b6,_0x3128a9){return db[_0xdbe2('0x1b')][_0xdbe2('0x1c')]({'raw':_0x3937af[_0xdbe2('0x1d')]?_0x3937af[_0xdbe2('0x1d')][_0xdbe2('0x1e')]===undefined?!![]:![]:!![],'where':_0x3937af[_0xdbe2('0x1d')]?_0x3937af[_0xdbe2('0x1d')][_0xdbe2('0x1f')]||null:null,'attributes':_0x3937af[_0xdbe2('0x1d')]?_0x3937af[_0xdbe2('0x1d')][_0xdbe2('0x20')]||null:null,'limit':_0x3937af['options']?_0x3937af[_0xdbe2('0x1d')][_0xdbe2('0x21')]||null:null,'include':_0x3937af['options']?_0x3937af['options'][_0xdbe2('0x22')]?_[_0xdbe2('0x23')](_0x3937af[_0xdbe2('0x1d')][_0xdbe2('0x22')],function(_0x46ebe8){return{'model':db[_0x46ebe8[_0xdbe2('0x24')]],'as':_0x46ebe8['as'],'attributes':_0x46ebe8[_0xdbe2('0x20')],'include':_0x46ebe8[_0xdbe2('0x22')]?_['map'](_0x46ebe8[_0xdbe2('0x22')],function(_0x3389e2){return{'model':db[_0x3389e2[_0xdbe2('0x24')]],'as':_0x3389e2['as'],'attributes':_0x3389e2[_0xdbe2('0x20')],'include':_0x3389e2[_0xdbe2('0x22')]?_[_0xdbe2('0x23')](_0x3389e2[_0xdbe2('0x22')],function(_0x439e7c){return{'model':db[_0x439e7c[_0xdbe2('0x24')]],'as':_0x439e7c['as'],'attributes':_0x439e7c[_0xdbe2('0x20')]};}):[]};}):[]};}):[]:[]})[_0xdbe2('0xf')](function(_0x269c48){logger['info'](_0xdbe2('0x1a'),_0x3937af);logger[_0xdbe2('0x12')](_0xdbe2('0x1a'),_0x3937af,JSON[_0xdbe2('0x14')](_0x269c48));_0x1026b6(_0x269c48);})[_0xdbe2('0x25')](function(_0x249d0a){logger['error'](_0xdbe2('0x1a'),_0x249d0a[_0xdbe2('0x18')],_0x3937af);_0x3128a9(_0x224446[_0xdbe2('0x15')](0x1f4,_0x249d0a['message']));});});};exports['ShowMailQueue']=function(_0x5e722d){var _0x3726a2=this;return new Promise(function(_0x5d017b,_0x57328a){return db[_0xdbe2('0x1b')][_0xdbe2('0x26')]({'raw':_0x5e722d[_0xdbe2('0x1d')]?_0x5e722d[_0xdbe2('0x1d')][_0xdbe2('0x1e')]===undefined?!![]:![]:!![],'where':_0x5e722d[_0xdbe2('0x1d')]?_0x5e722d[_0xdbe2('0x1d')][_0xdbe2('0x1f')]||null:null,'attributes':_0x5e722d['options']?_0x5e722d[_0xdbe2('0x1d')][_0xdbe2('0x20')]||null:null,'include':_0x5e722d[_0xdbe2('0x1d')]?_0x5e722d[_0xdbe2('0x1d')][_0xdbe2('0x22')]?_[_0xdbe2('0x23')](_0x5e722d[_0xdbe2('0x1d')]['include'],function(_0x58a10d){return{'model':db[_0x58a10d[_0xdbe2('0x24')]],'as':_0x58a10d['as'],'attributes':_0x58a10d['attributes'],'include':_0x58a10d['include']?_['map'](_0x58a10d[_0xdbe2('0x22')],function(_0xb9b571){return{'model':db[_0xb9b571[_0xdbe2('0x24')]],'as':_0xb9b571['as'],'attributes':_0xb9b571[_0xdbe2('0x20')],'include':_0xb9b571[_0xdbe2('0x22')]?_[_0xdbe2('0x23')](_0xb9b571[_0xdbe2('0x22')],function(_0x4a457e){return{'model':db[_0x4a457e[_0xdbe2('0x24')]],'as':_0x4a457e['as'],'attributes':_0x4a457e[_0xdbe2('0x20')]};}):[]};}):[]};}):[]:[]})[_0xdbe2('0xf')](function(_0x245cc6){logger[_0xdbe2('0x10')]('ShowMailQueue',_0x5e722d);logger[_0xdbe2('0x12')](_0xdbe2('0x27'),_0x5e722d,JSON[_0xdbe2('0x14')](_0x245cc6));_0x5d017b(_0x245cc6);})['catch'](function(_0x4e2274){logger['error'](_0xdbe2('0x27'),_0x4e2274['message'],_0x5e722d);_0x57328a(_0x3726a2[_0xdbe2('0x15')](0x1f4,_0x4e2274['message']));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 4a4eef3..b4646db 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 _0x47cb=['update','removeListener','register','length','save','remove'];(function(_0x5e6eac,_0x7d6b04){var _0x27afd9=function(_0x4cbdb9){while(--_0x4cbdb9){_0x5e6eac['push'](_0x5e6eac['shift']());}};_0x27afd9(++_0x7d6b04);}(_0x47cb,0x10c));var _0xb47c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x47cb[_0x3dd15e];return _0x231fd0;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0xb47c('0x0'),_0xb47c('0x1'),_0xb47c('0x2')];function createListener(_0x1382fe,_0x1b1f29){return function(_0x105d81){_0x1b1f29['emit'](_0x1382fe,_0x105d81);};}function removeListener(_0x3817e5,_0x164052){return function(){MailQueueEvents[_0xb47c('0x3')](_0x3817e5,_0x164052);};}exports[_0xb47c('0x4')]=function(_0x25cdca){for(var _0x872cf4=0x0,_0x2bc48a=events[_0xb47c('0x5')];_0x872cf4<_0x2bc48a;_0x872cf4++){var _0x192c9f=events[_0x872cf4];var _0x598684=createListener('mailQueue:'+_0x192c9f,_0x25cdca);MailQueueEvents['on'](_0x192c9f,_0x598684);}}; \ No newline at end of file +var _0x67c2=['removeListener','register','length','mailQueue:','./mailQueue.events','save','remove','update'];(function(_0x3eaf33,_0x18027d){var _0x3efda1=function(_0x380288){while(--_0x380288){_0x3eaf33['push'](_0x3eaf33['shift']());}};_0x3efda1(++_0x18027d);}(_0x67c2,0xc4));var _0x267c=function(_0x4ef9b3,_0x5240a7){_0x4ef9b3=_0x4ef9b3-0x0;var _0x3fda28=_0x67c2[_0x4ef9b3];return _0x3fda28;};'use strict';var MailQueueEvents=require(_0x267c('0x0'));var events=[_0x267c('0x1'),_0x267c('0x2'),_0x267c('0x3')];function createListener(_0x28ebce,_0x1d93d0){return function(_0x31831b){_0x1d93d0['emit'](_0x28ebce,_0x31831b);};}function removeListener(_0x442062,_0x907614){return function(){MailQueueEvents[_0x267c('0x4')](_0x442062,_0x907614);};}exports[_0x267c('0x5')]=function(_0x2c96fd){for(var _0x4924fa=0x0,_0x23d65b=events[_0x267c('0x6')];_0x4924fa<_0x23d65b;_0x4924fa++){var _0x43b607=events[_0x4924fa];var _0x36b8fa=createListener(_0x267c('0x7')+_0x43b607,_0x2c96fd);MailQueueEvents['on'](_0x43b607,_0x36b8fa);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 703f563..f735227 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 _0x6a28=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','create','put','update','delete','destroy','exports','util','connect-timeout','express'];(function(_0x2ef080,_0x408786){var _0x445e71=function(_0x3aa3e8){while(--_0x3aa3e8){_0x2ef080['push'](_0x2ef080['shift']());}};_0x445e71(++_0x408786);}(_0x6a28,0x9d));var _0x86a2=function(_0x4596b7,_0xb3be94){_0x4596b7=_0x4596b7-0x0;var _0x30fe73=_0x6a28[_0x4596b7];return _0x30fe73;};'use strict';var multer=require('multer');var util=require(_0x86a2('0x0'));var path=require('path');var timeout=require(_0x86a2('0x1'));var express=require(_0x86a2('0x2'));var router=express[_0x86a2('0x3')]();var fs_extra=require(_0x86a2('0x4'));var auth=require(_0x86a2('0x5'));var interaction=require(_0x86a2('0x6'));var config=require(_0x86a2('0x7'));var controller=require('./mailQueueReport.controller');router[_0x86a2('0x8')]('/',auth['isAuthenticated'](),controller[_0x86a2('0x9')]);router['get'](_0x86a2('0xa'),auth[_0x86a2('0xb')](),controller[_0x86a2('0xc')]);router[_0x86a2('0x8')](_0x86a2('0xd'),auth[_0x86a2('0xb')](),controller['show']);router['post']('/',auth[_0x86a2('0xb')](),controller[_0x86a2('0xe')]);router[_0x86a2('0xf')]('/:id',auth[_0x86a2('0xb')](),controller[_0x86a2('0x10')]);router[_0x86a2('0x11')](_0x86a2('0xd'),auth[_0x86a2('0xb')](),controller[_0x86a2('0x12')]);module[_0x86a2('0x13')]=router; \ No newline at end of file +var _0xd307=['multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','index','isAuthenticated','describe','/:id','show','post','create','update','delete','destroy','exports'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xd307,0xc8));var _0x7d30=function(_0xd226e,_0x2ecfa2){_0xd226e=_0xd226e-0x0;var _0x2bb8b2=_0xd307[_0xd226e];return _0x2bb8b2;};'use strict';var multer=require(_0x7d30('0x0'));var util=require(_0x7d30('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7d30('0x2'));var router=express['Router']();var fs_extra=require(_0x7d30('0x3'));var auth=require(_0x7d30('0x4'));var interaction=require(_0x7d30('0x5'));var config=require(_0x7d30('0x6'));var controller=require(_0x7d30('0x7'));router[_0x7d30('0x8')]('/',auth['isAuthenticated'](),controller[_0x7d30('0x9')]);router[_0x7d30('0x8')]('/describe',auth[_0x7d30('0xa')](),controller[_0x7d30('0xb')]);router[_0x7d30('0x8')](_0x7d30('0xc'),auth[_0x7d30('0xa')](),controller[_0x7d30('0xd')]);router[_0x7d30('0xe')]('/',auth[_0x7d30('0xa')](),controller[_0x7d30('0xf')]);router['put'](_0x7d30('0xc'),auth['isAuthenticated'](),controller[_0x7d30('0x10')]);router[_0x7d30('0x11')](_0x7d30('0xc'),auth[_0x7d30('0xa')](),controller[_0x7d30('0x12')]);module[_0x7d30('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 243e528..b0f9713 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 _0x98f9=['sequelize','exports','STRING','DATE'];(function(_0x1f4038,_0x2b28e4){var _0x5930e3=function(_0x240030){while(--_0x240030){_0x1f4038['push'](_0x1f4038['shift']());}};_0x5930e3(++_0x2b28e4);}(_0x98f9,0x150));var _0x998f=function(_0x1175cb,_0x240e85){_0x1175cb=_0x1175cb-0x0;var _0xb43f00=_0x98f9[_0x1175cb];return _0xb43f00;};'use strict';var moment=require('moment');var Sequelize=require(_0x998f('0x0'));module[_0x998f('0x1')]={'uniqueid':{'type':Sequelize[_0x998f('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x998f('0x2')]},'joinAt':{'type':Sequelize[_0x998f('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x998f('0x3')]},'exitAt':{'type':Sequelize[_0x998f('0x3')]},'reason':{'type':Sequelize[_0x998f('0x2')]}}; \ No newline at end of file +var _0xc81b=['exports','STRING','DATE','moment'];(function(_0x5ff8cc,_0x31fcea){var _0x561e2c=function(_0x450b8d){while(--_0x450b8d){_0x5ff8cc['push'](_0x5ff8cc['shift']());}};_0x561e2c(++_0x31fcea);}(_0xc81b,0x1a7));var _0xbc81=function(_0x45ffbb,_0x41fff8){_0x45ffbb=_0x45ffbb-0x0;var _0x290f94=_0xc81b[_0x45ffbb];return _0x290f94;};'use strict';var moment=require(_0xbc81('0x0'));var Sequelize=require('sequelize');module[_0xbc81('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xbc81('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xbc81('0x3')]},'acceptAt':{'type':Sequelize[_0xbc81('0x3')]},'exitAt':{'type':Sequelize[_0xbc81('0x3')]},'reason':{'type':Sequelize[_0xbc81('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 5dabebc..6a8df4a 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 _0x8952=['filter','VIRTUAL','merge','options','findAll','rows','show','params','keys','includeAll','include','catch','create','body','destroy','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','end','stack','name','map','MailQueueReport','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x8952,0x17e));var _0x2895=function(_0x207ebd,_0x1d11a2){_0x207ebd=_0x207ebd-0x0;var _0x46d893=_0x8952[_0x207ebd];return _0x46d893;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2895('0x0'));var zipdir=require(_0x2895('0x1'));var jsonpatch=require(_0x2895('0x2'));var rp=require(_0x2895('0x3'));var moment=require(_0x2895('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2895('0x5'));var util=require(_0x2895('0x6'));var path=require(_0x2895('0x7'));var sox=require('sox');var csv=require(_0x2895('0x8'));var ejs=require(_0x2895('0x9'));var fs=require('fs');var fs_extra=require(_0x2895('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x2895('0xb'));var jsforce=require(_0x2895('0xc'));var deskjs=require(_0x2895('0xd'));var toCsv=require(_0x2895('0x8'));var querystring=require(_0x2895('0xe'));var Papa=require('papaparse');var Redis=require(_0x2895('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x2895('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2895('0x11'));var utils=require(_0x2895('0x12'));var config=require(_0x2895('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x2895('0x14'))['db'];function respondWithStatusCode(_0x3924be,_0x4b1342){_0x4b1342=_0x4b1342||0xcc;return function(_0x32574c){if(_0x32574c){return _0x3924be[_0x2895('0x15')](_0x4b1342);}return _0x3924be['status'](_0x4b1342)['end']();};}function respondWithResult(_0x1d1493,_0x2ca2ac){_0x2ca2ac=_0x2ca2ac||0xc8;return function(_0x5777a0){if(_0x5777a0){return _0x1d1493[_0x2895('0x16')](_0x2ca2ac)[_0x2895('0x17')](_0x5777a0);}};}function respondWithFilteredResult(_0x27b50e,_0x1ae013){return function(_0x1d3659){if(_0x1d3659){var _0x2627e6=typeof _0x1ae013[_0x2895('0x18')]===_0x2895('0x19')&&typeof _0x1ae013[_0x2895('0x1a')]===_0x2895('0x19');var _0x10a1bf=_0x1d3659[_0x2895('0x1b')];var _0xbf8b63=_0x2627e6?0x0:_0x1ae013[_0x2895('0x18')];var _0x155124=_0x2627e6?_0x1d3659[_0x2895('0x1b')]:_0x1ae013[_0x2895('0x18')]+_0x1ae013[_0x2895('0x1a')];var _0x5a8eab;if(_0x155124>=_0x10a1bf){_0x155124=_0x10a1bf;_0x5a8eab=0xc8;}else{_0x5a8eab=0xce;}_0x27b50e['status'](_0x5a8eab);return _0x27b50e['set'](_0x2895('0x1c'),_0xbf8b63+'-'+_0x155124+'/'+_0x10a1bf)[_0x2895('0x17')](_0x1d3659);}return null;};}function patchUpdates(_0x3ec4da){return function(_0x593e47){try{jsonpatch[_0x2895('0x1d')](_0x593e47,_0x3ec4da,!![]);}catch(_0x190b79){return BPromise[_0x2895('0x1e')](_0x190b79);}return _0x593e47[_0x2895('0x1f')]();};}function saveUpdates(_0x8b75e0,_0x5dbbfe){return function(_0x30c6c3){if(_0x30c6c3){return _0x30c6c3[_0x2895('0x20')](_0x8b75e0)['then'](function(_0x142e58){return _0x142e58;});}return null;};}function removeEntity(_0x384357,_0x6f8ad4){return function(_0x511286){if(_0x511286){return _0x511286['destroy']()[_0x2895('0x21')](function(){_0x384357[_0x2895('0x16')](0xcc)[_0x2895('0x22')]();});}};}function handleEntityNotFound(_0x4a21cf,_0x3d3320){return function(_0x3690ce){if(!_0x3690ce){_0x4a21cf['sendStatus'](0x194);}return _0x3690ce;};}function handleError(_0x293ad3,_0x127540){_0x127540=_0x127540||0x1f4;return function(_0x2cd4df){logger['error'](_0x2cd4df[_0x2895('0x23')]);if(_0x2cd4df[_0x2895('0x24')]){delete _0x2cd4df['name'];}_0x293ad3[_0x2895('0x16')](_0x127540)['send'](_0x2cd4df);};}exports['index']=function(_0x18a935,_0x4ee2cc){var _0xfa4f85={},_0x381538={},_0x4fdd94={'count':0x0,'rows':[]};var _0x5574bf=_[_0x2895('0x25')](db[_0x2895('0x26')][_0x2895('0x27')],function(_0x14e343){return{'name':_0x14e343[_0x2895('0x28')],'type':_0x14e343[_0x2895('0x29')][_0x2895('0x2a')]};});_0x381538['model']=_[_0x2895('0x25')](_0x5574bf,_0x2895('0x24'));_0x381538[_0x2895('0x2b')]=_['keys'](_0x18a935[_0x2895('0x2b')]);_0x381538[_0x2895('0x2c')]=_[_0x2895('0x2d')](_0x381538[_0x2895('0x2e')],_0x381538['query']);_0xfa4f85[_0x2895('0x2f')]=_[_0x2895('0x2d')](_0x381538[_0x2895('0x2e')],qs[_0x2895('0x30')](_0x18a935[_0x2895('0x2b')]['fields']));_0xfa4f85['attributes']=_0xfa4f85[_0x2895('0x2f')][_0x2895('0x31')]?_0xfa4f85['attributes']:_0x381538[_0x2895('0x2e')];if(!_0x18a935['query'][_0x2895('0x32')](_0x2895('0x33'))){_0xfa4f85['limit']=qs[_0x2895('0x1a')](_0x18a935['query'][_0x2895('0x1a')]);_0xfa4f85['offset']=qs['offset'](_0x18a935[_0x2895('0x2b')][_0x2895('0x18')]);}_0xfa4f85[_0x2895('0x34')]=qs['sort'](_0x18a935[_0x2895('0x2b')][_0x2895('0x35')]);_0xfa4f85[_0x2895('0x36')]=qs[_0x2895('0x2c')](_[_0x2895('0x37')](_0x18a935[_0x2895('0x2b')],_0x381538[_0x2895('0x2c')]),_0x5574bf);if(_0x18a935[_0x2895('0x2b')][_0x2895('0x38')]){_0xfa4f85[_0x2895('0x36')]=_['merge'](_0xfa4f85[_0x2895('0x36')],{'$or':_[_0x2895('0x25')](_0x5574bf,function(_0x47413d){if(_0x47413d[_0x2895('0x29')]!==_0x2895('0x39')){var _0x12d7d8={};_0x12d7d8[_0x47413d[_0x2895('0x24')]]={'$like':'%'+_0x18a935['query']['filter']+'%'};return _0x12d7d8;}})});}_0xfa4f85=_[_0x2895('0x3a')]({},_0xfa4f85,_0x18a935[_0x2895('0x3b')]);var _0x24b9e0={'where':_0xfa4f85[_0x2895('0x36')]};return db[_0x2895('0x26')][_0x2895('0x1b')](_0x24b9e0)['then'](function(_0x5d18ef){_0x4fdd94[_0x2895('0x1b')]=_0x5d18ef;if(_0x18a935[_0x2895('0x2b')]['includeAll']){_0xfa4f85['include']=[{'all':!![]}];}return db[_0x2895('0x26')][_0x2895('0x3c')](_0xfa4f85);})[_0x2895('0x21')](function(_0x28967f){_0x4fdd94[_0x2895('0x3d')]=_0x28967f;return _0x4fdd94;})[_0x2895('0x21')](respondWithFilteredResult(_0x4ee2cc,_0xfa4f85))['catch'](handleError(_0x4ee2cc,null));};exports[_0x2895('0x3e')]=function(_0x2cfb24,_0x18ca24){var _0x1537fd={'raw':!![],'where':{'id':_0x2cfb24[_0x2895('0x3f')]['id']}},_0x4af6d6={};_0x4af6d6[_0x2895('0x2e')]=_[_0x2895('0x40')](db[_0x2895('0x26')]['rawAttributes']);_0x4af6d6['query']=_[_0x2895('0x40')](_0x2cfb24[_0x2895('0x2b')]);_0x4af6d6[_0x2895('0x2c')]=_[_0x2895('0x2d')](_0x4af6d6[_0x2895('0x2e')],_0x4af6d6['query']);_0x1537fd['attributes']=_[_0x2895('0x2d')](_0x4af6d6[_0x2895('0x2e')],qs[_0x2895('0x30')](_0x2cfb24[_0x2895('0x2b')][_0x2895('0x30')]));_0x1537fd[_0x2895('0x2f')]=_0x1537fd[_0x2895('0x2f')]['length']?_0x1537fd[_0x2895('0x2f')]:_0x4af6d6[_0x2895('0x2e')];if(_0x2cfb24[_0x2895('0x2b')][_0x2895('0x41')]){_0x1537fd[_0x2895('0x42')]=[{'all':!![]}];}_0x1537fd=_[_0x2895('0x3a')]({},_0x1537fd,_0x2cfb24[_0x2895('0x3b')]);return db[_0x2895('0x26')]['find'](_0x1537fd)[_0x2895('0x21')](handleEntityNotFound(_0x18ca24,null))[_0x2895('0x21')](respondWithResult(_0x18ca24,null))[_0x2895('0x43')](handleError(_0x18ca24,null));};exports['create']=function(_0xc85aa1,_0x5307a9){return db['MailQueueReport'][_0x2895('0x44')](_0xc85aa1[_0x2895('0x45')],{})[_0x2895('0x21')](respondWithResult(_0x5307a9,0xc9))[_0x2895('0x43')](handleError(_0x5307a9,null));};exports[_0x2895('0x20')]=function(_0x3cc331,_0x11e53a){if(_0x3cc331['body']['id']){delete _0x3cc331[_0x2895('0x45')]['id'];}return db[_0x2895('0x26')]['find']({'where':{'id':_0x3cc331['params']['id']}})['then'](handleEntityNotFound(_0x11e53a,null))[_0x2895('0x21')](saveUpdates(_0x3cc331[_0x2895('0x45')],null))[_0x2895('0x21')](respondWithResult(_0x11e53a,null))[_0x2895('0x43')](handleError(_0x11e53a,null));};exports[_0x2895('0x46')]=function(_0x3c5261,_0xaca46c){return db[_0x2895('0x26')][_0x2895('0x47')]({'where':{'id':_0x3c5261[_0x2895('0x3f')]['id']}})[_0x2895('0x21')](handleEntityNotFound(_0xaca46c,null))[_0x2895('0x21')](removeEntity(_0xaca46c,null))[_0x2895('0x43')](handleError(_0xaca46c,null));};exports[_0x2895('0x48')]=function(_0x356d35,_0x3c1135){return db[_0x2895('0x26')][_0x2895('0x48')]()[_0x2895('0x21')](respondWithResult(_0x3c1135,null))[_0x2895('0x43')](handleError(_0x3c1135,null));}; \ No newline at end of file +var _0xbff5=['squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','send','map','MailQueueReport','rawAttributes','fieldName','key','name','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','catch','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','fs-extra','lodash'];(function(_0x3850fd,_0x2fdbda){var _0x2afd90=function(_0x5ee9d1){while(--_0x5ee9d1){_0x3850fd['push'](_0x3850fd['shift']());}};_0x2afd90(++_0x2fdbda);}(_0xbff5,0x1bc));var _0x5bff=function(_0x3b0fa6,_0x2355f9){_0x3b0fa6=_0x3b0fa6-0x0;var _0x493a59=_0xbff5[_0x3b0fa6];return _0x493a59;};'use strict';var emlformat=require(_0x5bff('0x0'));var rimraf=require(_0x5bff('0x1'));var zipdir=require(_0x5bff('0x2'));var jsonpatch=require(_0x5bff('0x3'));var rp=require(_0x5bff('0x4'));var moment=require(_0x5bff('0x5'));var BPromise=require(_0x5bff('0x6'));var Mustache=require('mustache');var util=require(_0x5bff('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x5bff('0x8'));var ejs=require(_0x5bff('0x9'));var fs=require('fs');var fs_extra=require(_0x5bff('0xa'));var _=require(_0x5bff('0xb'));var squel=require(_0x5bff('0xc'));var crypto=require(_0x5bff('0xd'));var jsforce=require(_0x5bff('0xe'));var deskjs=require(_0x5bff('0xf'));var toCsv=require(_0x5bff('0x8'));var querystring=require('querystring');var Papa=require(_0x5bff('0x10'));var Redis=require('ioredis');var authService=require(_0x5bff('0x11'));var qs=require(_0x5bff('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5bff('0x13'));var logger=require('../../config/logger')(_0x5bff('0x14'));var utils=require('../../config/utils');var config=require(_0x5bff('0x15'));var licenseUtil=require(_0x5bff('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x132dc9,_0x50e1e9){_0x50e1e9=_0x50e1e9||0xcc;return function(_0x335e78){if(_0x335e78){return _0x132dc9[_0x5bff('0x17')](_0x50e1e9);}return _0x132dc9['status'](_0x50e1e9)[_0x5bff('0x18')]();};}function respondWithResult(_0xa16a3f,_0x5b0d2d){_0x5b0d2d=_0x5b0d2d||0xc8;return function(_0x5f2a55){if(_0x5f2a55){return _0xa16a3f[_0x5bff('0x19')](_0x5b0d2d)[_0x5bff('0x1a')](_0x5f2a55);}};}function respondWithFilteredResult(_0x3a507c,_0x4d883e){return function(_0x2d22ab){if(_0x2d22ab){var _0x4612ec=typeof _0x4d883e[_0x5bff('0x1b')]==='undefined'&&typeof _0x4d883e[_0x5bff('0x1c')]===_0x5bff('0x1d');var _0x38daa0=_0x2d22ab['count'];var _0xc9fbc3=_0x4612ec?0x0:_0x4d883e[_0x5bff('0x1b')];var _0x36653b=_0x4612ec?_0x2d22ab[_0x5bff('0x1e')]:_0x4d883e['offset']+_0x4d883e[_0x5bff('0x1c')];var _0x5357d4;if(_0x36653b>=_0x38daa0){_0x36653b=_0x38daa0;_0x5357d4=0xc8;}else{_0x5357d4=0xce;}_0x3a507c[_0x5bff('0x19')](_0x5357d4);return _0x3a507c['set'](_0x5bff('0x1f'),_0xc9fbc3+'-'+_0x36653b+'/'+_0x38daa0)[_0x5bff('0x1a')](_0x2d22ab);}return null;};}function patchUpdates(_0x2a83ce){return function(_0x6cbfa){try{jsonpatch[_0x5bff('0x20')](_0x6cbfa,_0x2a83ce,!![]);}catch(_0x2012e4){return BPromise[_0x5bff('0x21')](_0x2012e4);}return _0x6cbfa[_0x5bff('0x22')]();};}function saveUpdates(_0x155e16,_0x490bc1){return function(_0x5f2593){if(_0x5f2593){return _0x5f2593[_0x5bff('0x23')](_0x155e16)[_0x5bff('0x24')](function(_0x1e7f8a){return _0x1e7f8a;});}return null;};}function removeEntity(_0x352b1f,_0x31d26b){return function(_0x3913fd){if(_0x3913fd){return _0x3913fd[_0x5bff('0x25')]()['then'](function(){_0x352b1f['status'](0xcc)[_0x5bff('0x18')]();});}};}function handleEntityNotFound(_0x53bd97,_0x220c8f){return function(_0xcc091d){if(!_0xcc091d){_0x53bd97[_0x5bff('0x17')](0x194);}return _0xcc091d;};}function handleError(_0x6f18f1,_0xfa361d){_0xfa361d=_0xfa361d||0x1f4;return function(_0x1140eb){logger[_0x5bff('0x26')](_0x1140eb[_0x5bff('0x27')]);if(_0x1140eb['name']){delete _0x1140eb['name'];}_0x6f18f1[_0x5bff('0x19')](_0xfa361d)[_0x5bff('0x28')](_0x1140eb);};}exports['index']=function(_0x36a7d2,_0x588078){var _0x5470cb={},_0x3eda3a={},_0x5cf207={'count':0x0,'rows':[]};var _0x3ed23b=_[_0x5bff('0x29')](db[_0x5bff('0x2a')][_0x5bff('0x2b')],function(_0x48aee1){return{'name':_0x48aee1[_0x5bff('0x2c')],'type':_0x48aee1['type'][_0x5bff('0x2d')]};});_0x3eda3a['model']=_[_0x5bff('0x29')](_0x3ed23b,_0x5bff('0x2e'));_0x3eda3a[_0x5bff('0x2f')]=_[_0x5bff('0x30')](_0x36a7d2[_0x5bff('0x2f')]);_0x3eda3a[_0x5bff('0x31')]=_['intersection'](_0x3eda3a[_0x5bff('0x32')],_0x3eda3a[_0x5bff('0x2f')]);_0x5470cb[_0x5bff('0x33')]=_[_0x5bff('0x34')](_0x3eda3a[_0x5bff('0x32')],qs[_0x5bff('0x35')](_0x36a7d2[_0x5bff('0x2f')][_0x5bff('0x35')]));_0x5470cb['attributes']=_0x5470cb[_0x5bff('0x33')][_0x5bff('0x36')]?_0x5470cb[_0x5bff('0x33')]:_0x3eda3a[_0x5bff('0x32')];if(!_0x36a7d2['query'][_0x5bff('0x37')](_0x5bff('0x38'))){_0x5470cb['limit']=qs[_0x5bff('0x1c')](_0x36a7d2[_0x5bff('0x2f')][_0x5bff('0x1c')]);_0x5470cb[_0x5bff('0x1b')]=qs['offset'](_0x36a7d2[_0x5bff('0x2f')][_0x5bff('0x1b')]);}_0x5470cb[_0x5bff('0x39')]=qs['sort'](_0x36a7d2[_0x5bff('0x2f')]['sort']);_0x5470cb[_0x5bff('0x3a')]=qs[_0x5bff('0x31')](_[_0x5bff('0x3b')](_0x36a7d2['query'],_0x3eda3a[_0x5bff('0x31')]),_0x3ed23b);if(_0x36a7d2[_0x5bff('0x2f')][_0x5bff('0x3c')]){_0x5470cb['where']=_[_0x5bff('0x3d')](_0x5470cb[_0x5bff('0x3a')],{'$or':_['map'](_0x3ed23b,function(_0x265cdb){if(_0x265cdb[_0x5bff('0x3e')]!==_0x5bff('0x3f')){var _0x77a071={};_0x77a071[_0x265cdb[_0x5bff('0x2e')]]={'$like':'%'+_0x36a7d2['query'][_0x5bff('0x3c')]+'%'};return _0x77a071;}})});}_0x5470cb=_['merge']({},_0x5470cb,_0x36a7d2[_0x5bff('0x40')]);var _0x2fecb9={'where':_0x5470cb[_0x5bff('0x3a')]};return db[_0x5bff('0x2a')][_0x5bff('0x1e')](_0x2fecb9)[_0x5bff('0x24')](function(_0x1d0346){_0x5cf207['count']=_0x1d0346;if(_0x36a7d2['query'][_0x5bff('0x41')]){_0x5470cb[_0x5bff('0x42')]=[{'all':!![]}];}return db[_0x5bff('0x2a')][_0x5bff('0x43')](_0x5470cb);})[_0x5bff('0x24')](function(_0xb7b82a){_0x5cf207[_0x5bff('0x44')]=_0xb7b82a;return _0x5cf207;})[_0x5bff('0x24')](respondWithFilteredResult(_0x588078,_0x5470cb))['catch'](handleError(_0x588078,null));};exports[_0x5bff('0x45')]=function(_0x49676f,_0x3dc13f){var _0x1b8c7f={'raw':!![],'where':{'id':_0x49676f[_0x5bff('0x46')]['id']}},_0x543517={};_0x543517[_0x5bff('0x32')]=_['keys'](db[_0x5bff('0x2a')][_0x5bff('0x2b')]);_0x543517[_0x5bff('0x2f')]=_['keys'](_0x49676f[_0x5bff('0x2f')]);_0x543517[_0x5bff('0x31')]=_[_0x5bff('0x34')](_0x543517['model'],_0x543517[_0x5bff('0x2f')]);_0x1b8c7f[_0x5bff('0x33')]=_[_0x5bff('0x34')](_0x543517[_0x5bff('0x32')],qs['fields'](_0x49676f[_0x5bff('0x2f')]['fields']));_0x1b8c7f['attributes']=_0x1b8c7f[_0x5bff('0x33')][_0x5bff('0x36')]?_0x1b8c7f['attributes']:_0x543517[_0x5bff('0x32')];if(_0x49676f[_0x5bff('0x2f')]['includeAll']){_0x1b8c7f[_0x5bff('0x42')]=[{'all':!![]}];}_0x1b8c7f=_[_0x5bff('0x3d')]({},_0x1b8c7f,_0x49676f[_0x5bff('0x40')]);return db[_0x5bff('0x2a')]['find'](_0x1b8c7f)[_0x5bff('0x24')](handleEntityNotFound(_0x3dc13f,null))[_0x5bff('0x24')](respondWithResult(_0x3dc13f,null))[_0x5bff('0x47')](handleError(_0x3dc13f,null));};exports[_0x5bff('0x48')]=function(_0x1e94c5,_0x2588b8){return db['MailQueueReport'][_0x5bff('0x48')](_0x1e94c5[_0x5bff('0x49')],{})['then'](respondWithResult(_0x2588b8,0xc9))[_0x5bff('0x47')](handleError(_0x2588b8,null));};exports['update']=function(_0x47fc14,_0x4ff13a){if(_0x47fc14[_0x5bff('0x49')]['id']){delete _0x47fc14[_0x5bff('0x49')]['id'];}return db['MailQueueReport'][_0x5bff('0x4a')]({'where':{'id':_0x47fc14[_0x5bff('0x46')]['id']}})[_0x5bff('0x24')](handleEntityNotFound(_0x4ff13a,null))[_0x5bff('0x24')](saveUpdates(_0x47fc14[_0x5bff('0x49')],null))['then'](respondWithResult(_0x4ff13a,null))[_0x5bff('0x47')](handleError(_0x4ff13a,null));};exports[_0x5bff('0x25')]=function(_0x5e99f5,_0x16c61e){return db['MailQueueReport'][_0x5bff('0x4a')]({'where':{'id':_0x5e99f5[_0x5bff('0x46')]['id']}})[_0x5bff('0x24')](handleEntityNotFound(_0x16c61e,null))[_0x5bff('0x24')](removeEntity(_0x16c61e,null))[_0x5bff('0x47')](handleError(_0x16c61e,null));};exports['describe']=function(_0x36089e,_0x18018e){return db['MailQueueReport'][_0x5bff('0x4b')]()[_0x5bff('0x24')](respondWithResult(_0x18018e,null))['catch'](handleError(_0x18018e,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 69292f0..fe105b5 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 _0x4af9=['lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailQueueReport.attributes','define','MailQueueReport','uniqueid'];(function(_0x5f0719,_0xfa75ce){var _0x342483=function(_0xda48e9){while(--_0xda48e9){_0x5f0719['push'](_0x5f0719['shift']());}};_0x342483(++_0xfa75ce);}(_0x4af9,0x12c));var _0x94af=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x4af9[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x94af('0x0'));var util=require(_0x94af('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x94af('0x2'));var BPromise=require(_0x94af('0x3'));var rp=require(_0x94af('0x4'));var fs=require('fs');var path=require(_0x94af('0x5'));var rimraf=require(_0x94af('0x6'));var config=require(_0x94af('0x7'));var attributes=require(_0x94af('0x8'));module['exports']=function(_0x28a640,_0x360a33){return _0x28a640[_0x94af('0x9')](_0x94af('0xa'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0x94af('0xb'),'fields':[_0x94af('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x35c8=['report_mail_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','define'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x35c8,0x152));var _0x835c=function(_0x3dd7c6,_0x28c2ab){_0x3dd7c6=_0x3dd7c6-0x0;var _0x386ac6=_0x35c8[_0x3dd7c6];return _0x386ac6;};'use strict';var _=require('lodash');var util=require(_0x835c('0x0'));var logger=require(_0x835c('0x1'))(_0x835c('0x2'));var moment=require(_0x835c('0x3'));var BPromise=require(_0x835c('0x4'));var rp=require(_0x835c('0x5'));var fs=require('fs');var path=require(_0x835c('0x6'));var rimraf=require(_0x835c('0x7'));var config=require(_0x835c('0x8'));var attributes=require(_0x835c('0x9'));module[_0x835c('0xa')]=function(_0x2dc1e3,_0x3e5052){return _0x2dc1e3[_0x835c('0xb')]('MailQueueReport',attributes,{'tableName':_0x835c('0xc'),'paranoid':![],'indexes':[{'name':_0x835c('0xd'),'fields':[_0x835c('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 2495453..c6ddf46 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 _0x326f=['error','code','message','result','catch','CreateMailQueueReport','MailQueueReport','options','raw','stringify','UpdateMailQueueReport','body','attributes','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x850e1d,_0x268b6c){var _0x6a361e=function(_0x14ae1b){while(--_0x14ae1b){_0x850e1d['push'](_0x850e1d['shift']());}};_0x6a361e(++_0x268b6c);}(_0x326f,0xd1));var _0xf326=function(_0xe800b8,_0x3ca9d7){_0xe800b8=_0xe800b8-0x0;var _0x2c288f=_0x326f[_0xe800b8];return _0x2c288f;};'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')]('MailQueueReport,\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')]('MailQueueReport,\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')]['create'](_0x453100['body'],{'raw':_0x453100['options']?_0x453100[_0xf326('0x16')][_0xf326('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x4cabce){logger[_0xf326('0xb')]('CreateMailQueueReport',_0x453100);logger['debug'](_0xf326('0x14'),_0x453100,JSON[_0xf326('0x18')](_0x4cabce));_0x31ffb9(_0x4cabce);})['catch'](function(_0x5aa184){logger[_0xf326('0xf')](_0xf326('0x14'),_0x5aa184['message'],_0x453100);_0xcef2b5(_0x18bee3[_0xf326('0xf')](0x1f4,_0x5aa184[_0xf326('0x11')]));});});};exports[_0xf326('0x19')]=function(_0x295752){var _0x17c157=this;return new Promise(function(_0x2049ec,_0x5ce532){return db['MailQueueReport']['update'](_0x295752[_0xf326('0x1a')],{'raw':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')][_0xf326('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')]['where']||null:null,'attributes':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')][_0xf326('0x1b')]||null:null,'limit':_0x295752['options']?_0x295752[_0xf326('0x16')]['limit']||null:null})['then'](function(_0x6a8e89){logger[_0xf326('0xb')](_0xf326('0x19'),_0x295752);logger['debug'](_0xf326('0x19'),_0x295752,JSON[_0xf326('0x18')](_0x6a8e89));_0x2049ec(_0x6a8e89);})['catch'](function(_0x225776){logger[_0xf326('0xf')](_0xf326('0x19'),_0x225776[_0xf326('0x11')],_0x295752);_0x5ce532(_0x17c157[_0xf326('0xf')](0x1f4,_0x225776[_0xf326('0x11')]));});});}; \ No newline at end of file +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(_0x3f2560,_0x5c84e4){var _0x3234ad=function(_0x11b6e9){while(--_0x11b6e9){_0x3f2560['push'](_0x3f2560['shift']());}};_0x3234ad(++_0x5c84e4);}(_0x1261,0x144));var _0x1126=function(_0x13b07a,_0x49cfc3){_0x13b07a=_0x13b07a-0x0;var _0xdcbe0=_0x1261[_0x13b07a];return _0xdcbe0;};'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 diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 9171ea4..a265d9b 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x4a90a2,_0x10155e){var _0x4ef519=function(_0x15a327){while(--_0x15a327){_0x4a90a2['push'](_0x4a90a2['shift']());}};_0x4ef519(++_0x10155e);}(_0xcb91,0x1a9));var _0x1cb9=function(_0xb4cc12,_0x41436e){_0xb4cc12=_0xb4cc12-0x0;var _0x8593b5=_0xcb91[_0xb4cc12];return _0x8593b5;};'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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x109a44,_0x5c8f4c){var _0x1069b8=function(_0x28cfbd){while(--_0x28cfbd){_0x109a44['push'](_0x109a44['shift']());}};_0x1069b8(++_0x5c8f4c);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 3f740e2..2f43c40 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 _0x4e0e=['BOOLEAN','INTEGER','INBOX','sequelize','exports','STRING'];(function(_0x79d75b,_0x42575d){var _0x952b21=function(_0x435e5c){while(--_0x435e5c){_0x79d75b['push'](_0x79d75b['shift']());}};_0x952b21(++_0x42575d);}(_0x4e0e,0x1b3));var _0xe4e0=function(_0x35dd95,_0x10cc5a){_0x35dd95=_0x35dd95-0x0;var _0x61bf3c=_0x4e0e[_0x35dd95];return _0x61bf3c;};'use strict';var Sequelize=require(_0xe4e0('0x0'));module[_0xe4e0('0x1')]={'description':{'type':Sequelize[_0xe4e0('0x2')]},'host':{'type':Sequelize[_0xe4e0('0x2')]},'authentication':{'type':Sequelize[_0xe4e0('0x3')],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xe4e0('0x2')]},'port':{'type':Sequelize[_0xe4e0('0x4')]},'tls':{'type':Sequelize[_0xe4e0('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xe4e0('0x2')],'defaultValue':_0xe4e0('0x5')},'connTimeout':{'type':Sequelize[_0xe4e0('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xe4e0('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0xe4e0('0x2')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x3def=['INTEGER','BOOLEAN','sequelize','STRING'];(function(_0x193d82,_0x41c48d){var _0x220402=function(_0xb76af2){while(--_0xb76af2){_0x193d82['push'](_0x193d82['shift']());}};_0x220402(++_0x41c48d);}(_0x3def,0x1b2));var _0xf3de=function(_0x17de0f,_0xea2a51){_0x17de0f=_0x17de0f-0x0;var _0x2befb9=_0x3def[_0x17de0f];return _0x2befb9;};'use strict';var Sequelize=require(_0xf3de('0x0'));module['exports']={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize[_0xf3de('0x1')]},'password':{'type':Sequelize[_0xf3de('0x1')]},'port':{'type':Sequelize[_0xf3de('0x2')]},'tls':{'type':Sequelize[_0xf3de('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xf3de('0x1')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xf3de('0x2')],'defaultValue':0x5},'service':{'type':Sequelize[_0xf3de('0x1')]},'modernAuthentication':{'type':Sequelize[_0xf3de('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 6e8384d..2ec3eef 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 _0x6776=['util','api','moment','bluebird','request-promise','path','../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in','lodash'];(function(_0x4ad34a,_0x2aab2a){var _0x3fa704=function(_0x783786){while(--_0x783786){_0x4ad34a['push'](_0x4ad34a['shift']());}};_0x3fa704(++_0x2aab2a);}(_0x6776,0x19f));var _0x6677=function(_0x437feb,_0x1fc9bb){_0x437feb=_0x437feb-0x0;var _0xa8e0f5=_0x6776[_0x437feb];return _0xa8e0f5;};'use strict';var _=require(_0x6677('0x0'));var util=require(_0x6677('0x1'));var logger=require('../../config/logger')(_0x6677('0x2'));var moment=require(_0x6677('0x3'));var BPromise=require(_0x6677('0x4'));var rp=require(_0x6677('0x5'));var fs=require('fs');var path=require(_0x6677('0x6'));var rimraf=require('rimraf');var config=require(_0x6677('0x7'));var attributes=require(_0x6677('0x8'));module[_0x6677('0x9')]=function(_0x47a19e,_0x5a6d33){return _0x47a19e[_0x6677('0xa')](_0x6677('0xb'),attributes,{'tableName':_0x6677('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5a2a=['util','moment','bluebird','request-promise','path','../../config/environment','./mailServerIn.attributes','exports','mail_servers_in','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5a2a,0x1df));var _0xa5a2=function(_0x31441b,_0x155084){_0x31441b=_0x31441b-0x0;var _0x2e0b97=_0x5a2a[_0x31441b];return _0x2e0b97;};'use strict';var _=require(_0xa5a2('0x0'));var util=require(_0xa5a2('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xa5a2('0x2'));var BPromise=require(_0xa5a2('0x3'));var rp=require(_0xa5a2('0x4'));var fs=require('fs');var path=require(_0xa5a2('0x5'));var rimraf=require('rimraf');var config=require(_0xa5a2('0x6'));var attributes=require(_0xa5a2('0x7'));module[_0xa5a2('0x8')]=function(_0x1789e3,_0x3e63bf){return _0x1789e3['define']('MailServerIn',attributes,{'tableName':_0xa5a2('0x9'),'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 8b92371..08d7f18 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 _0x06d8=['info','MailServerIn,\x20%s,\x20%s','debug','MailServerIn,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','MailServerIn','findAll','options','raw','where','attributes','limit','include','map','model','GetMailServerIn','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x3ec1da,_0x1e36f5){var _0x472358=function(_0x1d41b1){while(--_0x1d41b1){_0x3ec1da['push'](_0x3ec1da['shift']());}};_0x472358(++_0x1e36f5);}(_0x06d8,0xd4));var _0x806d=function(_0x4b7dfd,_0x37d450){_0x4b7dfd=_0x4b7dfd-0x0;var _0x32e85f=_0x06d8[_0x4b7dfd];return _0x32e85f;};'use strict';var _=require(_0x806d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x806d('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x806d('0x2'));var db=require(_0x806d('0x3'))['db'];var utils=require(_0x806d('0x4'));var logger=require(_0x806d('0x5'))(_0x806d('0x6'));var config=require(_0x806d('0x7'));var jayson=require(_0x806d('0x8'));var client=jayson[_0x806d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x15f567,_0x585ef1,_0x582c5b){return new BPromise(function(_0x4368fc,_0x19f3af){return client[_0x806d('0xa')](_0x15f567,_0x582c5b)[_0x806d('0xb')](function(_0x3f5d7c){logger[_0x806d('0xc')](_0x806d('0xd'),_0x585ef1,'request\x20sent');logger[_0x806d('0xe')](_0x806d('0xf'),_0x585ef1,_0x806d('0x10'),JSON['stringify'](_0x3f5d7c));if(_0x3f5d7c[_0x806d('0x11')]){if(_0x3f5d7c[_0x806d('0x11')]['code']===0x1f4){logger['error'](_0x806d('0xd'),_0x585ef1,_0x3f5d7c[_0x806d('0x11')][_0x806d('0x12')]);return _0x19f3af(_0x3f5d7c['error'][_0x806d('0x12')]);}logger[_0x806d('0x11')](_0x806d('0xd'),_0x585ef1,_0x3f5d7c[_0x806d('0x11')][_0x806d('0x12')]);return _0x4368fc(_0x3f5d7c[_0x806d('0x11')][_0x806d('0x12')]);}else{logger['info'](_0x806d('0xd'),_0x585ef1,_0x806d('0x10'));_0x4368fc(_0x3f5d7c[_0x806d('0x13')][_0x806d('0x12')]);}})[_0x806d('0x14')](function(_0x4d9297){logger[_0x806d('0x11')]('MailServerIn,\x20%s,\x20%s',_0x585ef1,_0x4d9297);_0x19f3af(_0x4d9297);});});}exports['GetMailServerIn']=function(_0x3c2f0a){var _0x154432=this;return new Promise(function(_0x5ba39e,_0x7b9561){return db[_0x806d('0x15')][_0x806d('0x16')]({'raw':_0x3c2f0a[_0x806d('0x17')]?_0x3c2f0a['options'][_0x806d('0x18')]===undefined?!![]:![]:!![],'where':_0x3c2f0a['options']?_0x3c2f0a[_0x806d('0x17')][_0x806d('0x19')]||null:null,'attributes':_0x3c2f0a[_0x806d('0x17')]?_0x3c2f0a[_0x806d('0x17')][_0x806d('0x1a')]||null:null,'limit':_0x3c2f0a[_0x806d('0x17')]?_0x3c2f0a[_0x806d('0x17')][_0x806d('0x1b')]||null:null,'include':_0x3c2f0a[_0x806d('0x17')]?_0x3c2f0a['options'][_0x806d('0x1c')]?_[_0x806d('0x1d')](_0x3c2f0a[_0x806d('0x17')][_0x806d('0x1c')],function(_0x260167){return{'model':db[_0x260167[_0x806d('0x1e')]],'as':_0x260167['as'],'attributes':_0x260167[_0x806d('0x1a')],'include':_0x260167['include']?_[_0x806d('0x1d')](_0x260167[_0x806d('0x1c')],function(_0x45d8ed){return{'model':db[_0x45d8ed['model']],'as':_0x45d8ed['as'],'attributes':_0x45d8ed[_0x806d('0x1a')],'include':_0x45d8ed['include']?_['map'](_0x45d8ed[_0x806d('0x1c')],function(_0x44f1ed){return{'model':db[_0x44f1ed['model']],'as':_0x44f1ed['as'],'attributes':_0x44f1ed[_0x806d('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x806d('0xb')](function(_0x135f91){logger['info']('GetMailServerIn',_0x3c2f0a);logger['debug'](_0x806d('0x1f'),_0x3c2f0a,JSON['stringify'](_0x135f91));_0x5ba39e(_0x135f91);})[_0x806d('0x14')](function(_0x35c886){logger[_0x806d('0x11')](_0x806d('0x1f'),_0x35c886['message'],_0x3c2f0a);_0x7b9561(_0x154432[_0x806d('0x11')](0x1f4,_0x35c886[_0x806d('0x12')]));});});}; \ No newline at end of file +var _0x3dca=['rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','MailServerIn,\x20%s,\x20%s','catch','GetMailServerIn','MailServerIn','findAll','options','raw','where','attributes','include','map','model','then','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x28b400,_0x38b5c7){var _0x2c148e=function(_0x2202ae){while(--_0x2202ae){_0x28b400['push'](_0x28b400['shift']());}};_0x2c148e(++_0x38b5c7);}(_0x3dca,0x186));var _0xa3dc=function(_0xf053db,_0x1be36c){_0xf053db=_0xf053db-0x0;var _0x265c3b=_0x3dca[_0xf053db];return _0x265c3b;};'use strict';var _=require(_0xa3dc('0x0'));var util=require(_0xa3dc('0x1'));var moment=require('moment');var BPromise=require(_0xa3dc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa3dc('0x3'))['db'];var utils=require(_0xa3dc('0x4'));var logger=require(_0xa3dc('0x5'))(_0xa3dc('0x6'));var config=require(_0xa3dc('0x7'));var jayson=require(_0xa3dc('0x8'));var client=jayson[_0xa3dc('0x9')][_0xa3dc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2d2c6,_0x2a7bb1,_0x15d65e){return new BPromise(function(_0x3b3ba4,_0x5b7875){return client[_0xa3dc('0xb')](_0x2d2c6,_0x15d65e)['then'](function(_0x19a17c){logger[_0xa3dc('0xc')]('MailServerIn,\x20%s,\x20%s',_0x2a7bb1,_0xa3dc('0xd'));logger[_0xa3dc('0xe')](_0xa3dc('0xf'),_0x2a7bb1,'request\x20sent',JSON[_0xa3dc('0x10')](_0x19a17c));if(_0x19a17c['error']){if(_0x19a17c[_0xa3dc('0x11')][_0xa3dc('0x12')]===0x1f4){logger[_0xa3dc('0x11')]('MailServerIn,\x20%s,\x20%s',_0x2a7bb1,_0x19a17c['error'][_0xa3dc('0x13')]);return _0x5b7875(_0x19a17c['error'][_0xa3dc('0x13')]);}logger[_0xa3dc('0x11')](_0xa3dc('0x14'),_0x2a7bb1,_0x19a17c[_0xa3dc('0x11')][_0xa3dc('0x13')]);return _0x3b3ba4(_0x19a17c[_0xa3dc('0x11')][_0xa3dc('0x13')]);}else{logger['info'](_0xa3dc('0x14'),_0x2a7bb1,_0xa3dc('0xd'));_0x3b3ba4(_0x19a17c['result']['message']);}})[_0xa3dc('0x15')](function(_0x24c9c9){logger[_0xa3dc('0x11')](_0xa3dc('0x14'),_0x2a7bb1,_0x24c9c9);_0x5b7875(_0x24c9c9);});});}exports[_0xa3dc('0x16')]=function(_0xe31613){var _0x5b0b84=this;return new Promise(function(_0x2991df,_0x1bf088){return db[_0xa3dc('0x17')][_0xa3dc('0x18')]({'raw':_0xe31613[_0xa3dc('0x19')]?_0xe31613[_0xa3dc('0x19')][_0xa3dc('0x1a')]===undefined?!![]:![]:!![],'where':_0xe31613[_0xa3dc('0x19')]?_0xe31613[_0xa3dc('0x19')][_0xa3dc('0x1b')]||null:null,'attributes':_0xe31613[_0xa3dc('0x19')]?_0xe31613['options'][_0xa3dc('0x1c')]||null:null,'limit':_0xe31613[_0xa3dc('0x19')]?_0xe31613[_0xa3dc('0x19')]['limit']||null:null,'include':_0xe31613[_0xa3dc('0x19')]?_0xe31613[_0xa3dc('0x19')][_0xa3dc('0x1d')]?_[_0xa3dc('0x1e')](_0xe31613[_0xa3dc('0x19')][_0xa3dc('0x1d')],function(_0x2a170f){return{'model':db[_0x2a170f[_0xa3dc('0x1f')]],'as':_0x2a170f['as'],'attributes':_0x2a170f['attributes'],'include':_0x2a170f[_0xa3dc('0x1d')]?_[_0xa3dc('0x1e')](_0x2a170f[_0xa3dc('0x1d')],function(_0x1eae08){return{'model':db[_0x1eae08[_0xa3dc('0x1f')]],'as':_0x1eae08['as'],'attributes':_0x1eae08[_0xa3dc('0x1c')],'include':_0x1eae08[_0xa3dc('0x1d')]?_[_0xa3dc('0x1e')](_0x1eae08[_0xa3dc('0x1d')],function(_0x2c1c63){return{'model':db[_0x2c1c63[_0xa3dc('0x1f')]],'as':_0x2c1c63['as'],'attributes':_0x2c1c63[_0xa3dc('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa3dc('0x20')](function(_0x316bf1){logger['info'](_0xa3dc('0x16'),_0xe31613);logger[_0xa3dc('0xe')]('GetMailServerIn',_0xe31613,JSON[_0xa3dc('0x10')](_0x316bf1));_0x2991df(_0x316bf1);})[_0xa3dc('0x15')](function(_0x106aa6){logger['error'](_0xa3dc('0x16'),_0x106aa6[_0xa3dc('0x13')],_0xe31613);_0x1bf088(_0x5b0b84[_0xa3dc('0x11')](0x1f4,_0x106aa6[_0xa3dc('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index a5f6c68..d62c00b 100644 --- a/server/api/mailServerOut/index.js +++ b/server/api/mailServerOut/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x4c7fb5,_0x2548ef){var _0x2e10ac=function(_0xf7e27c){while(--_0xf7e27c){_0x4c7fb5['push'](_0x4c7fb5['shift']());}};_0x2e10ac(++_0x2548ef);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file +var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x7a54,0x106));var _0x47a5=function(_0x2feb76,_0x1a1234){_0x2feb76=_0x2feb76-0x0;var _0x3f650c=_0x7a54[_0x2feb76];return _0x3f650c;};'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 66616bb..7ac1d7a 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 _0xcf66=['BOOLEAN','sequelize','exports','STRING'];(function(_0x1e8d94,_0x5414a9){var _0x752523=function(_0x5af42b){while(--_0x5af42b){_0x1e8d94['push'](_0x1e8d94['shift']());}};_0x752523(++_0x5414a9);}(_0xcf66,0x71));var _0x6cf6=function(_0x3e9b5b,_0x404ea6){_0x3e9b5b=_0x3e9b5b-0x0;var _0x1125a0=_0xcf66[_0x3e9b5b];return _0x1125a0;};'use strict';var Sequelize=require(_0x6cf6('0x0'));module[_0x6cf6('0x1')]={'description':{'type':Sequelize[_0x6cf6('0x2')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0x6cf6('0x2')]},'pass':{'type':Sequelize[_0x6cf6('0x2')]},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0x6cf6('0x2')]},'authentication':{'type':Sequelize[_0x6cf6('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x878f=['STRING','INTEGER','BOOLEAN','exports'];(function(_0x95be80,_0x3cca11){var _0x4ceceb=function(_0x26e964){while(--_0x26e964){_0x95be80['push'](_0x95be80['shift']());}};_0x4ceceb(++_0x3cca11);}(_0x878f,0x173));var _0xf878=function(_0x2e2006,_0x701b86){_0x2e2006=_0x2e2006-0x0;var _0x20182f=_0x878f[_0x2e2006];return _0x20182f;};'use strict';var Sequelize=require('sequelize');module[_0xf878('0x0')]={'description':{'type':Sequelize[_0xf878('0x1')]},'host':{'type':Sequelize[_0xf878('0x1')]},'user':{'type':Sequelize[_0xf878('0x1')]},'pass':{'type':Sequelize[_0xf878('0x1')]},'port':{'type':Sequelize[_0xf878('0x2')]},'secure':{'type':Sequelize[_0xf878('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0xf878('0x1')]},'authentication':{'type':Sequelize[_0xf878('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0xf878('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index aee80f8..2501926 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 _0xd4c5=['Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','MailServerOut','type','key','model','query','filters','intersection','attributes','fields','length','sort','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include','findAll','show','params','keys','catch','create','body','find','eml-format','zip-dir','request-promise','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','set'];(function(_0x2e9c3a,_0x42a377){var _0x3e9182=function(_0xd9230d){while(--_0xd9230d){_0x2e9c3a['push'](_0x2e9c3a['shift']());}};_0x3e9182(++_0x42a377);}(_0xd4c5,0x148));var _0x5d4c=function(_0x5bf123,_0x5b49eb){_0x5bf123=_0x5bf123-0x0;var _0x3051de=_0xd4c5[_0x5bf123];return _0x3051de;};'use strict';var emlformat=require(_0x5d4c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5d4c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5d4c('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5d4c('0x3'));var path=require(_0x5d4c('0x4'));var sox=require(_0x5d4c('0x5'));var csv=require('to-csv');var ejs=require(_0x5d4c('0x6'));var fs=require('fs');var fs_extra=require(_0x5d4c('0x7'));var _=require(_0x5d4c('0x8'));var squel=require('squel');var crypto=require(_0x5d4c('0x9'));var jsforce=require(_0x5d4c('0xa'));var deskjs=require(_0x5d4c('0xb'));var toCsv=require(_0x5d4c('0xc'));var querystring=require(_0x5d4c('0xd'));var Papa=require(_0x5d4c('0xe'));var Redis=require(_0x5d4c('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x5d4c('0x10'));var as=require(_0x5d4c('0x11'));var hardwareService=require(_0x5d4c('0x12'));var logger=require('../../config/logger')(_0x5d4c('0x13'));var utils=require(_0x5d4c('0x14'));var config=require(_0x5d4c('0x15'));var licenseUtil=require(_0x5d4c('0x16'));var db=require(_0x5d4c('0x17'))['db'];function respondWithStatusCode(_0x1e6330,_0xc7284e){_0xc7284e=_0xc7284e||0xcc;return function(_0x31b9f5){if(_0x31b9f5){return _0x1e6330[_0x5d4c('0x18')](_0xc7284e);}return _0x1e6330[_0x5d4c('0x19')](_0xc7284e)[_0x5d4c('0x1a')]();};}function respondWithResult(_0x2e7761,_0x3239bf){_0x3239bf=_0x3239bf||0xc8;return function(_0x2cb0e7){if(_0x2cb0e7){return _0x2e7761[_0x5d4c('0x19')](_0x3239bf)[_0x5d4c('0x1b')](_0x2cb0e7);}};}function respondWithFilteredResult(_0x4c71de,_0x10d720){return function(_0x3b95ce){if(_0x3b95ce){var _0x506f07=typeof _0x10d720['offset']===_0x5d4c('0x1c')&&typeof _0x10d720[_0x5d4c('0x1d')]==='undefined';var _0x2688bf=_0x3b95ce['count'];var _0x1e3230=_0x506f07?0x0:_0x10d720[_0x5d4c('0x1e')];var _0x122e86=_0x506f07?_0x3b95ce['count']:_0x10d720[_0x5d4c('0x1e')]+_0x10d720[_0x5d4c('0x1d')];var _0x1893a3;if(_0x122e86>=_0x2688bf){_0x122e86=_0x2688bf;_0x1893a3=0xc8;}else{_0x1893a3=0xce;}_0x4c71de[_0x5d4c('0x19')](_0x1893a3);return _0x4c71de[_0x5d4c('0x1f')](_0x5d4c('0x20'),_0x1e3230+'-'+_0x122e86+'/'+_0x2688bf)[_0x5d4c('0x1b')](_0x3b95ce);}return null;};}function patchUpdates(_0x2775f7){return function(_0x45ae24){try{jsonpatch[_0x5d4c('0x21')](_0x45ae24,_0x2775f7,!![]);}catch(_0x3f0d07){return BPromise[_0x5d4c('0x22')](_0x3f0d07);}return _0x45ae24[_0x5d4c('0x23')]();};}function saveUpdates(_0x4f871f,_0x3acfeb){return function(_0x503252){if(_0x503252){return _0x503252[_0x5d4c('0x24')](_0x4f871f)[_0x5d4c('0x25')](function(_0x3c4ced){return _0x3c4ced;});}return null;};}function removeEntity(_0xe194d,_0x5744bb){return function(_0x91e429){if(_0x91e429){return _0x91e429[_0x5d4c('0x26')]()[_0x5d4c('0x25')](function(){_0xe194d[_0x5d4c('0x19')](0xcc)[_0x5d4c('0x1a')]();});}};}function handleEntityNotFound(_0x7e54e2,_0x24f38a){return function(_0x6bc778){if(!_0x6bc778){_0x7e54e2['sendStatus'](0x194);}return _0x6bc778;};}function handleError(_0x403eed,_0x241034){_0x241034=_0x241034||0x1f4;return function(_0x2ef2fa){logger['error'](_0x2ef2fa[_0x5d4c('0x27')]);if(_0x2ef2fa[_0x5d4c('0x28')]){delete _0x2ef2fa[_0x5d4c('0x28')];}_0x403eed['status'](_0x241034)[_0x5d4c('0x29')](_0x2ef2fa);};}exports[_0x5d4c('0x2a')]=function(_0x42a391,_0x47b140){var _0x1bd993={},_0x5b89b0={},_0x1bae5c={'count':0x0,'rows':[]};var _0x5d2d39=_[_0x5d4c('0x2b')](db[_0x5d4c('0x2c')]['rawAttributes'],function(_0x530c3f){return{'name':_0x530c3f['fieldName'],'type':_0x530c3f[_0x5d4c('0x2d')][_0x5d4c('0x2e')]};});_0x5b89b0[_0x5d4c('0x2f')]=_[_0x5d4c('0x2b')](_0x5d2d39,_0x5d4c('0x28'));_0x5b89b0[_0x5d4c('0x30')]=_['keys'](_0x42a391[_0x5d4c('0x30')]);_0x5b89b0[_0x5d4c('0x31')]=_[_0x5d4c('0x32')](_0x5b89b0[_0x5d4c('0x2f')],_0x5b89b0[_0x5d4c('0x30')]);_0x1bd993[_0x5d4c('0x33')]=_[_0x5d4c('0x32')](_0x5b89b0[_0x5d4c('0x2f')],qs[_0x5d4c('0x34')](_0x42a391[_0x5d4c('0x30')][_0x5d4c('0x34')]));_0x1bd993[_0x5d4c('0x33')]=_0x1bd993[_0x5d4c('0x33')][_0x5d4c('0x35')]?_0x1bd993[_0x5d4c('0x33')]:_0x5b89b0[_0x5d4c('0x2f')];if(!_0x42a391[_0x5d4c('0x30')]['hasOwnProperty']('nolimit')){_0x1bd993[_0x5d4c('0x1d')]=qs[_0x5d4c('0x1d')](_0x42a391[_0x5d4c('0x30')][_0x5d4c('0x1d')]);_0x1bd993[_0x5d4c('0x1e')]=qs[_0x5d4c('0x1e')](_0x42a391[_0x5d4c('0x30')][_0x5d4c('0x1e')]);}_0x1bd993['order']=qs['sort'](_0x42a391[_0x5d4c('0x30')][_0x5d4c('0x36')]);_0x1bd993['where']=qs[_0x5d4c('0x31')](_[_0x5d4c('0x37')](_0x42a391[_0x5d4c('0x30')],_0x5b89b0['filters']),_0x5d2d39);if(_0x42a391[_0x5d4c('0x30')][_0x5d4c('0x38')]){_0x1bd993[_0x5d4c('0x39')]=_[_0x5d4c('0x3a')](_0x1bd993['where'],{'$or':_[_0x5d4c('0x2b')](_0x5d2d39,function(_0x425bb2){if(_0x425bb2[_0x5d4c('0x2d')]!==_0x5d4c('0x3b')){var _0x853f4f={};_0x853f4f[_0x425bb2[_0x5d4c('0x28')]]={'$like':'%'+_0x42a391[_0x5d4c('0x30')][_0x5d4c('0x38')]+'%'};return _0x853f4f;}})});}_0x1bd993=_['merge']({},_0x1bd993,_0x42a391[_0x5d4c('0x3c')]);var _0xb0a374={'where':_0x1bd993['where']};return db[_0x5d4c('0x2c')]['count'](_0xb0a374)[_0x5d4c('0x25')](function(_0x5891f9){_0x1bae5c[_0x5d4c('0x3d')]=_0x5891f9;if(_0x42a391[_0x5d4c('0x30')][_0x5d4c('0x3e')]){_0x1bd993[_0x5d4c('0x3f')]=[{'all':!![]}];}return db['MailServerOut'][_0x5d4c('0x40')](_0x1bd993);})[_0x5d4c('0x25')](function(_0x37fa86){_0x1bae5c['rows']=_0x37fa86;return _0x1bae5c;})[_0x5d4c('0x25')](respondWithFilteredResult(_0x47b140,_0x1bd993))['catch'](handleError(_0x47b140,null));};exports[_0x5d4c('0x41')]=function(_0x7ea2a6,_0x46e071){var _0x5e962f={'raw':!![],'where':{'id':_0x7ea2a6[_0x5d4c('0x42')]['id']}},_0x79e78d={};_0x79e78d['model']=_[_0x5d4c('0x43')](db['MailServerOut']['rawAttributes']);_0x79e78d['query']=_[_0x5d4c('0x43')](_0x7ea2a6[_0x5d4c('0x30')]);_0x79e78d[_0x5d4c('0x31')]=_[_0x5d4c('0x32')](_0x79e78d['model'],_0x79e78d['query']);_0x5e962f[_0x5d4c('0x33')]=_[_0x5d4c('0x32')](_0x79e78d[_0x5d4c('0x2f')],qs[_0x5d4c('0x34')](_0x7ea2a6[_0x5d4c('0x30')][_0x5d4c('0x34')]));_0x5e962f[_0x5d4c('0x33')]=_0x5e962f[_0x5d4c('0x33')][_0x5d4c('0x35')]?_0x5e962f[_0x5d4c('0x33')]:_0x79e78d['model'];if(_0x7ea2a6['query'][_0x5d4c('0x3e')]){_0x5e962f[_0x5d4c('0x3f')]=[{'all':!![]}];}_0x5e962f=_['merge']({},_0x5e962f,_0x7ea2a6[_0x5d4c('0x3c')]);return db[_0x5d4c('0x2c')]['find'](_0x5e962f)[_0x5d4c('0x25')](handleEntityNotFound(_0x46e071,null))[_0x5d4c('0x25')](respondWithResult(_0x46e071,null))[_0x5d4c('0x44')](handleError(_0x46e071,null));};exports[_0x5d4c('0x45')]=function(_0x9f838,_0x1faf76){return db[_0x5d4c('0x2c')]['create'](_0x9f838[_0x5d4c('0x46')],{})[_0x5d4c('0x25')](respondWithResult(_0x1faf76,0xc9))['catch'](handleError(_0x1faf76,null));};exports['update']=function(_0x4a032a,_0x4807ce){if(_0x4a032a[_0x5d4c('0x46')]['id']){delete _0x4a032a[_0x5d4c('0x46')]['id'];}return db[_0x5d4c('0x2c')]['find']({'where':{'id':_0x4a032a['params']['id']}})[_0x5d4c('0x25')](handleEntityNotFound(_0x4807ce,null))[_0x5d4c('0x25')](saveUpdates(_0x4a032a[_0x5d4c('0x46')],null))[_0x5d4c('0x25')](respondWithResult(_0x4807ce,null))['catch'](handleError(_0x4807ce,null));};exports[_0x5d4c('0x26')]=function(_0xd1de4,_0x2236e9){return db[_0x5d4c('0x2c')][_0x5d4c('0x47')]({'where':{'id':_0xd1de4[_0x5d4c('0x42')]['id']}})[_0x5d4c('0x25')](handleEntityNotFound(_0x2236e9,null))[_0x5d4c('0x25')](removeEntity(_0x2236e9,null))[_0x5d4c('0x44')](handleError(_0x2236e9,null));}; \ No newline at end of file +var _0xcecc=['model','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','options','include','findAll','rows','show','params','keys','intersection','includeAll','find','catch','create','body','destroy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','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','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','stack','name','send','index','map','MailServerOut','rawAttributes','fieldName','type','key','query','filters'];(function(_0x156d1d,_0x15f6a1){var _0x2af262=function(_0x1cffd2){while(--_0x1cffd2){_0x156d1d['push'](_0x156d1d['shift']());}};_0x2af262(++_0x15f6a1);}(_0xcecc,0xfd));var _0xccec=function(_0x2edb69,_0x3ac96c){_0x2edb69=_0x2edb69-0x0;var _0x336857=_0xcecc[_0x2edb69];return _0x336857;};'use strict';var emlformat=require(_0xccec('0x0'));var rimraf=require(_0xccec('0x1'));var zipdir=require(_0xccec('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xccec('0x3'));var moment=require(_0xccec('0x4'));var BPromise=require(_0xccec('0x5'));var Mustache=require(_0xccec('0x6'));var util=require(_0xccec('0x7'));var path=require('path');var sox=require(_0xccec('0x8'));var csv=require(_0xccec('0x9'));var ejs=require(_0xccec('0xa'));var fs=require('fs');var fs_extra=require(_0xccec('0xb'));var _=require(_0xccec('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xccec('0x9'));var querystring=require(_0xccec('0xd'));var Papa=require(_0xccec('0xe'));var Redis=require(_0xccec('0xf'));var authService=require(_0xccec('0x10'));var qs=require(_0xccec('0x11'));var as=require(_0xccec('0x12'));var hardwareService=require(_0xccec('0x13'));var logger=require(_0xccec('0x14'))('api');var utils=require(_0xccec('0x15'));var config=require(_0xccec('0x16'));var licenseUtil=require(_0xccec('0x17'));var db=require(_0xccec('0x18'))['db'];function respondWithStatusCode(_0x3d7157,_0x148814){_0x148814=_0x148814||0xcc;return function(_0x18c0d6){if(_0x18c0d6){return _0x3d7157[_0xccec('0x19')](_0x148814);}return _0x3d7157['status'](_0x148814)[_0xccec('0x1a')]();};}function respondWithResult(_0x2a2827,_0x4c4954){_0x4c4954=_0x4c4954||0xc8;return function(_0x389054){if(_0x389054){return _0x2a2827[_0xccec('0x1b')](_0x4c4954)[_0xccec('0x1c')](_0x389054);}};}function respondWithFilteredResult(_0x27fe88,_0x588eda){return function(_0x55d4ae){if(_0x55d4ae){var _0x35510=typeof _0x588eda[_0xccec('0x1d')]===_0xccec('0x1e')&&typeof _0x588eda[_0xccec('0x1f')]===_0xccec('0x1e');var _0x5c7cf1=_0x55d4ae[_0xccec('0x20')];var _0x5e0621=_0x35510?0x0:_0x588eda[_0xccec('0x1d')];var _0x2876e6=_0x35510?_0x55d4ae[_0xccec('0x20')]:_0x588eda[_0xccec('0x1d')]+_0x588eda[_0xccec('0x1f')];var _0x141949;if(_0x2876e6>=_0x5c7cf1){_0x2876e6=_0x5c7cf1;_0x141949=0xc8;}else{_0x141949=0xce;}_0x27fe88['status'](_0x141949);return _0x27fe88[_0xccec('0x21')](_0xccec('0x22'),_0x5e0621+'-'+_0x2876e6+'/'+_0x5c7cf1)['json'](_0x55d4ae);}return null;};}function patchUpdates(_0x56eb5e){return function(_0x682046){try{jsonpatch[_0xccec('0x23')](_0x682046,_0x56eb5e,!![]);}catch(_0x54a085){return BPromise['reject'](_0x54a085);}return _0x682046[_0xccec('0x24')]();};}function saveUpdates(_0x441ab2,_0x7daba){return function(_0x1cabf1){if(_0x1cabf1){return _0x1cabf1[_0xccec('0x25')](_0x441ab2)['then'](function(_0x363588){return _0x363588;});}return null;};}function removeEntity(_0x59fbe1,_0x5b0b6b){return function(_0x21a7cd){if(_0x21a7cd){return _0x21a7cd['destroy']()[_0xccec('0x26')](function(){_0x59fbe1[_0xccec('0x1b')](0xcc)[_0xccec('0x1a')]();});}};}function handleEntityNotFound(_0x32c643,_0x234f41){return function(_0x3f78dd){if(!_0x3f78dd){_0x32c643['sendStatus'](0x194);}return _0x3f78dd;};}function handleError(_0x293c45,_0x2478c1){_0x2478c1=_0x2478c1||0x1f4;return function(_0x179b9f){logger['error'](_0x179b9f[_0xccec('0x27')]);if(_0x179b9f[_0xccec('0x28')]){delete _0x179b9f['name'];}_0x293c45['status'](_0x2478c1)[_0xccec('0x29')](_0x179b9f);};}exports[_0xccec('0x2a')]=function(_0xad84e3,_0x2113fe){var _0x1c2c0b={},_0xd11af={},_0x81fc2d={'count':0x0,'rows':[]};var _0xbde203=_[_0xccec('0x2b')](db[_0xccec('0x2c')][_0xccec('0x2d')],function(_0x37772c){return{'name':_0x37772c[_0xccec('0x2e')],'type':_0x37772c[_0xccec('0x2f')][_0xccec('0x30')]};});_0xd11af['model']=_[_0xccec('0x2b')](_0xbde203,_0xccec('0x28'));_0xd11af[_0xccec('0x31')]=_['keys'](_0xad84e3['query']);_0xd11af[_0xccec('0x32')]=_['intersection'](_0xd11af[_0xccec('0x33')],_0xd11af[_0xccec('0x31')]);_0x1c2c0b[_0xccec('0x34')]=_['intersection'](_0xd11af['model'],qs[_0xccec('0x35')](_0xad84e3[_0xccec('0x31')][_0xccec('0x35')]));_0x1c2c0b['attributes']=_0x1c2c0b['attributes']['length']?_0x1c2c0b[_0xccec('0x34')]:_0xd11af[_0xccec('0x33')];if(!_0xad84e3[_0xccec('0x31')][_0xccec('0x36')](_0xccec('0x37'))){_0x1c2c0b['limit']=qs[_0xccec('0x1f')](_0xad84e3[_0xccec('0x31')][_0xccec('0x1f')]);_0x1c2c0b['offset']=qs[_0xccec('0x1d')](_0xad84e3[_0xccec('0x31')][_0xccec('0x1d')]);}_0x1c2c0b[_0xccec('0x38')]=qs['sort'](_0xad84e3[_0xccec('0x31')][_0xccec('0x39')]);_0x1c2c0b['where']=qs[_0xccec('0x32')](_[_0xccec('0x3a')](_0xad84e3[_0xccec('0x31')],_0xd11af['filters']),_0xbde203);if(_0xad84e3['query'][_0xccec('0x3b')]){_0x1c2c0b['where']=_[_0xccec('0x3c')](_0x1c2c0b[_0xccec('0x3d')],{'$or':_[_0xccec('0x2b')](_0xbde203,function(_0x358019){if(_0x358019[_0xccec('0x2f')]!=='VIRTUAL'){var _0x5cfd00={};_0x5cfd00[_0x358019[_0xccec('0x28')]]={'$like':'%'+_0xad84e3[_0xccec('0x31')][_0xccec('0x3b')]+'%'};return _0x5cfd00;}})});}_0x1c2c0b=_[_0xccec('0x3c')]({},_0x1c2c0b,_0xad84e3[_0xccec('0x3e')]);var _0x2f0279={'where':_0x1c2c0b[_0xccec('0x3d')]};return db['MailServerOut'][_0xccec('0x20')](_0x2f0279)[_0xccec('0x26')](function(_0xe61f2b){_0x81fc2d[_0xccec('0x20')]=_0xe61f2b;if(_0xad84e3['query']['includeAll']){_0x1c2c0b[_0xccec('0x3f')]=[{'all':!![]}];}return db[_0xccec('0x2c')][_0xccec('0x40')](_0x1c2c0b);})[_0xccec('0x26')](function(_0x3e8828){_0x81fc2d[_0xccec('0x41')]=_0x3e8828;return _0x81fc2d;})[_0xccec('0x26')](respondWithFilteredResult(_0x2113fe,_0x1c2c0b))['catch'](handleError(_0x2113fe,null));};exports[_0xccec('0x42')]=function(_0x38c38a,_0x2bec46){var _0x585e93={'raw':!![],'where':{'id':_0x38c38a[_0xccec('0x43')]['id']}},_0x5f4bb0={};_0x5f4bb0[_0xccec('0x33')]=_[_0xccec('0x44')](db[_0xccec('0x2c')][_0xccec('0x2d')]);_0x5f4bb0[_0xccec('0x31')]=_[_0xccec('0x44')](_0x38c38a['query']);_0x5f4bb0['filters']=_['intersection'](_0x5f4bb0[_0xccec('0x33')],_0x5f4bb0[_0xccec('0x31')]);_0x585e93[_0xccec('0x34')]=_[_0xccec('0x45')](_0x5f4bb0[_0xccec('0x33')],qs[_0xccec('0x35')](_0x38c38a[_0xccec('0x31')][_0xccec('0x35')]));_0x585e93['attributes']=_0x585e93[_0xccec('0x34')]['length']?_0x585e93['attributes']:_0x5f4bb0[_0xccec('0x33')];if(_0x38c38a['query'][_0xccec('0x46')]){_0x585e93[_0xccec('0x3f')]=[{'all':!![]}];}_0x585e93=_[_0xccec('0x3c')]({},_0x585e93,_0x38c38a[_0xccec('0x3e')]);return db[_0xccec('0x2c')][_0xccec('0x47')](_0x585e93)['then'](handleEntityNotFound(_0x2bec46,null))[_0xccec('0x26')](respondWithResult(_0x2bec46,null))[_0xccec('0x48')](handleError(_0x2bec46,null));};exports[_0xccec('0x49')]=function(_0x4933fd,_0x218424){return db[_0xccec('0x2c')][_0xccec('0x49')](_0x4933fd[_0xccec('0x4a')],{})[_0xccec('0x26')](respondWithResult(_0x218424,0xc9))[_0xccec('0x48')](handleError(_0x218424,null));};exports[_0xccec('0x25')]=function(_0x960f3b,_0x2b3315){if(_0x960f3b[_0xccec('0x4a')]['id']){delete _0x960f3b[_0xccec('0x4a')]['id'];}return db['MailServerOut']['find']({'where':{'id':_0x960f3b[_0xccec('0x43')]['id']}})[_0xccec('0x26')](handleEntityNotFound(_0x2b3315,null))[_0xccec('0x26')](saveUpdates(_0x960f3b[_0xccec('0x4a')],null))['then'](respondWithResult(_0x2b3315,null))[_0xccec('0x48')](handleError(_0x2b3315,null));};exports[_0xccec('0x4b')]=function(_0x1d82df,_0x14b0da){return db[_0xccec('0x2c')]['find']({'where':{'id':_0x1d82df[_0xccec('0x43')]['id']}})['then'](handleEntityNotFound(_0x14b0da,null))[_0xccec('0x26')](removeEntity(_0x14b0da,null))[_0xccec('0x48')](handleError(_0x14b0da,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index fb1fede..98daa4c 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 _0x9af1=['MailServerOut','mail_servers_out','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./mailServerOut.attributes','exports','define'];(function(_0x48fbd7,_0x11b7b6){var _0x283bcf=function(_0x91d08a){while(--_0x91d08a){_0x48fbd7['push'](_0x48fbd7['shift']());}};_0x283bcf(++_0x11b7b6);}(_0x9af1,0xb8));var _0x19af=function(_0x35d8ab,_0x41f966){_0x35d8ab=_0x35d8ab-0x0;var _0x425f16=_0x9af1[_0x35d8ab];return _0x425f16;};'use strict';var _=require(_0x19af('0x0'));var util=require(_0x19af('0x1'));var logger=require(_0x19af('0x2'))(_0x19af('0x3'));var moment=require('moment');var BPromise=require(_0x19af('0x4'));var rp=require(_0x19af('0x5'));var fs=require('fs');var path=require(_0x19af('0x6'));var rimraf=require(_0x19af('0x7'));var config=require('../../config/environment');var attributes=require(_0x19af('0x8'));module[_0x19af('0x9')]=function(_0x3c4dc7,_0x1a77a6){return _0x3c4dc7[_0x19af('0xa')](_0x19af('0xb'),attributes,{'tableName':_0x19af('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbfe2=['MailServerOut','mail_servers_out','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./mailServerOut.attributes','exports'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0xbfe2,0x6e));var _0x2bfe=function(_0x82ca45,_0x521848){_0x82ca45=_0x82ca45-0x0;var _0x26007e=_0xbfe2[_0x82ca45];return _0x26007e;};'use strict';var _=require(_0x2bfe('0x0'));var util=require(_0x2bfe('0x1'));var logger=require('../../config/logger')(_0x2bfe('0x2'));var moment=require(_0x2bfe('0x3'));var BPromise=require(_0x2bfe('0x4'));var rp=require(_0x2bfe('0x5'));var fs=require('fs');var path=require(_0x2bfe('0x6'));var rimraf=require('rimraf');var config=require(_0x2bfe('0x7'));var attributes=require(_0x2bfe('0x8'));module[_0x2bfe('0x9')]=function(_0x3af85a,_0x5ac6db){return _0x3af85a['define'](_0x2bfe('0xa'),attributes,{'tableName':_0x2bfe('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index eb12a69..d6f8be4 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 _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','MailServerOut,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x198c9f,_0x2e0ebe){var _0x28e458=function(_0x3b105b){while(--_0x3b105b){_0x198c9f['push'](_0x198c9f['shift']());}};_0x28e458(++_0x2e0ebe);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3b0762,_0x419325){_0x3b0762=_0x3b0762-0x0;var _0x1a4aa2=_0x5f2f[_0x3b0762];return _0x1a4aa2;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file +var _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0xc9c8ca,_0xbc7ae3){var _0x59fc76=function(_0x2b7f3f){while(--_0x2b7f3f){_0xc9c8ca['push'](_0xc9c8ca['shift']());}};_0x59fc76(++_0xbc7ae3);}(_0xadb5,0xad));var _0x5adb=function(_0x593095,_0x26258c){_0x593095=_0x593095-0x0;var _0x135c0e=_0xadb5[_0x593095];return _0x135c0e;};'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 573d480..76a25aa 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 _0xa635=['./mailSubstatus.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x5e2d54,_0x410662){var _0x59b188=function(_0x31f680){while(--_0x31f680){_0x5e2d54['push'](_0x5e2d54['shift']());}};_0x59b188(++_0x410662);}(_0xa635,0x1dc));var _0x5a63=function(_0x1e91bc,_0x3bb24e){_0x1e91bc=_0x1e91bc-0x0;var _0x1e02b6=_0xa635[_0x1e91bc];return _0x1e02b6;};'use strict';var multer=require(_0x5a63('0x0'));var util=require(_0x5a63('0x1'));var path=require(_0x5a63('0x2'));var timeout=require(_0x5a63('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x5a63('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x5a63('0x5'));var config=require(_0x5a63('0x6'));var controller=require(_0x5a63('0x7'));router[_0x5a63('0x8')]('/',auth[_0x5a63('0x9')](),controller[_0x5a63('0xa')]);router[_0x5a63('0x8')](_0x5a63('0xb'),auth[_0x5a63('0x9')](),controller[_0x5a63('0xc')]);router[_0x5a63('0x8')](_0x5a63('0xd'),auth[_0x5a63('0x9')](),controller[_0x5a63('0xe')]);router[_0x5a63('0xf')]('/',auth['isAuthenticated'](),controller[_0x5a63('0x10')]);router['put']('/:id',auth[_0x5a63('0x9')](),controller[_0x5a63('0x11')]);router[_0x5a63('0x12')]('/:id',auth[_0x5a63('0x9')](),controller[_0x5a63('0x13')]);module[_0x5a63('0x14')]=router; \ No newline at end of file +var _0x2037=['connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','delete','destroy','exports','multer','util','path'];(function(_0x850a91,_0x23ecd7){var _0x420aa4=function(_0x91cdad){while(--_0x91cdad){_0x850a91['push'](_0x850a91['shift']());}};_0x420aa4(++_0x23ecd7);}(_0x2037,0xf4));var _0x7203=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x2037[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x7203('0x0'));var util=require(_0x7203('0x1'));var path=require(_0x7203('0x2'));var timeout=require(_0x7203('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x7203('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x7203('0x5'));var config=require(_0x7203('0x6'));var controller=require('./mailSubstatus.controller');router[_0x7203('0x7')]('/',auth[_0x7203('0x8')](),controller[_0x7203('0x9')]);router[_0x7203('0x7')](_0x7203('0xa'),auth[_0x7203('0x8')](),controller[_0x7203('0xb')]);router[_0x7203('0x7')](_0x7203('0xc'),auth[_0x7203('0x8')](),controller['show']);router[_0x7203('0xd')]('/',auth['isAuthenticated'](),controller[_0x7203('0xe')]);router[_0x7203('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x7203('0x10')](_0x7203('0xc'),auth[_0x7203('0x8')](),controller[_0x7203('0x11')]);module[_0x7203('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index ffb6d63..61a4808 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 _0x8ace=['sequelize','exports','STRING','name'];(function(_0x1b642d,_0x512a38){var _0x3e5b16=function(_0x4218ff){while(--_0x4218ff){_0x1b642d['push'](_0x1b642d['shift']());}};_0x3e5b16(++_0x512a38);}(_0x8ace,0x1bc));var _0xe8ac=function(_0x295df8,_0x1f9924){_0x295df8=_0x295df8-0x0;var _0x1c4b61=_0x8ace[_0x295df8];return _0x1c4b61;};'use strict';var Sequelize=require(_0xe8ac('0x0'));module[_0xe8ac('0x1')]={'name':{'type':Sequelize[_0xe8ac('0x2')],'unique':_0xe8ac('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xe8ac('0x2')]}}; \ No newline at end of file +var _0x86f4=['STRING','name','sequelize','exports'];(function(_0x30f5d5,_0x2b4128){var _0x4173cc=function(_0x1d9d95){while(--_0x1d9d95){_0x30f5d5['push'](_0x30f5d5['shift']());}};_0x4173cc(++_0x2b4128);}(_0x86f4,0x18a));var _0x486f=function(_0x3d8c78,_0x1378b7){_0x3d8c78=_0x3d8c78-0x0;var _0x430b2c=_0x86f4[_0x3d8c78];return _0x430b2c;};'use strict';var Sequelize=require(_0x486f('0x0'));module[_0x486f('0x1')]={'name':{'type':Sequelize[_0x486f('0x2')],'unique':_0x486f('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x486f('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index e195154..ffec0b1 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 _0x1949=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','end','status','undefined','offset','limit','set','json','apply','update','then','destroy','error','stack','name','send','index','map','MailSubstatus','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','describe'];(function(_0x845cf4,_0x510466){var _0x99bb0a=function(_0x4f593b){while(--_0x4f593b){_0x845cf4['push'](_0x845cf4['shift']());}};_0x99bb0a(++_0x510466);}(_0x1949,0x172));var _0x9194=function(_0x28e87b,_0x1db402){_0x28e87b=_0x28e87b-0x0;var _0x12b404=_0x1949[_0x28e87b];return _0x12b404;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9194('0x0'));var jsonpatch=require(_0x9194('0x1'));var rp=require(_0x9194('0x2'));var moment=require(_0x9194('0x3'));var BPromise=require(_0x9194('0x4'));var Mustache=require(_0x9194('0x5'));var util=require('util');var path=require(_0x9194('0x6'));var sox=require('sox');var csv=require(_0x9194('0x7'));var ejs=require(_0x9194('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9194('0x9'));var squel=require(_0x9194('0xa'));var crypto=require(_0x9194('0xb'));var jsforce=require(_0x9194('0xc'));var deskjs=require(_0x9194('0xd'));var toCsv=require(_0x9194('0x7'));var querystring=require(_0x9194('0xe'));var Papa=require(_0x9194('0xf'));var Redis=require(_0x9194('0x10'));var authService=require(_0x9194('0x11'));var qs=require(_0x9194('0x12'));var as=require(_0x9194('0x13'));var hardwareService=require(_0x9194('0x14'));var logger=require(_0x9194('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x9194('0x16'));var db=require(_0x9194('0x17'))['db'];function respondWithStatusCode(_0x1d139b,_0x2996dc){_0x2996dc=_0x2996dc||0xcc;return function(_0x1500f2){if(_0x1500f2){return _0x1d139b['sendStatus'](_0x2996dc);}return _0x1d139b['status'](_0x2996dc)[_0x9194('0x18')]();};}function respondWithResult(_0x5ba94a,_0x170f40){_0x170f40=_0x170f40||0xc8;return function(_0x4e7cd4){if(_0x4e7cd4){return _0x5ba94a[_0x9194('0x19')](_0x170f40)['json'](_0x4e7cd4);}};}function respondWithFilteredResult(_0x454290,_0x1fb78e){return function(_0x1e13d9){if(_0x1e13d9){var _0x5cef9c=typeof _0x1fb78e['offset']===_0x9194('0x1a')&&typeof _0x1fb78e['limit']===_0x9194('0x1a');var _0x2453d0=_0x1e13d9['count'];var _0x50a6d3=_0x5cef9c?0x0:_0x1fb78e[_0x9194('0x1b')];var _0x2aea84=_0x5cef9c?_0x1e13d9['count']:_0x1fb78e['offset']+_0x1fb78e[_0x9194('0x1c')];var _0x3561db;if(_0x2aea84>=_0x2453d0){_0x2aea84=_0x2453d0;_0x3561db=0xc8;}else{_0x3561db=0xce;}_0x454290['status'](_0x3561db);return _0x454290[_0x9194('0x1d')]('Content-Range',_0x50a6d3+'-'+_0x2aea84+'/'+_0x2453d0)[_0x9194('0x1e')](_0x1e13d9);}return null;};}function patchUpdates(_0x2b85a){return function(_0x26bcdd){try{jsonpatch[_0x9194('0x1f')](_0x26bcdd,_0x2b85a,!![]);}catch(_0x534eb9){return BPromise['reject'](_0x534eb9);}return _0x26bcdd['save']();};}function saveUpdates(_0x4864a6,_0x465bf2){return function(_0x234317){if(_0x234317){return _0x234317[_0x9194('0x20')](_0x4864a6)[_0x9194('0x21')](function(_0x43b4b9){return _0x43b4b9;});}return null;};}function removeEntity(_0x550b2d,_0x2bd268){return function(_0x17ea28){if(_0x17ea28){return _0x17ea28[_0x9194('0x22')]()['then'](function(){_0x550b2d[_0x9194('0x19')](0xcc)[_0x9194('0x18')]();});}};}function handleEntityNotFound(_0x3dc854,_0x1aa155){return function(_0x81df5b){if(!_0x81df5b){_0x3dc854['sendStatus'](0x194);}return _0x81df5b;};}function handleError(_0x310e87,_0x89efcc){_0x89efcc=_0x89efcc||0x1f4;return function(_0x11261f){logger[_0x9194('0x23')](_0x11261f[_0x9194('0x24')]);if(_0x11261f[_0x9194('0x25')]){delete _0x11261f['name'];}_0x310e87[_0x9194('0x19')](_0x89efcc)[_0x9194('0x26')](_0x11261f);};}exports[_0x9194('0x27')]=function(_0x255620,_0x3cee8a){var _0x2886aa={},_0x3f6e50={},_0x12034b={'count':0x0,'rows':[]};var _0x1f448=_[_0x9194('0x28')](db[_0x9194('0x29')]['rawAttributes'],function(_0x5a95aa){return{'name':_0x5a95aa[_0x9194('0x2a')],'type':_0x5a95aa[_0x9194('0x2b')][_0x9194('0x2c')]};});_0x3f6e50[_0x9194('0x2d')]=_[_0x9194('0x28')](_0x1f448,'name');_0x3f6e50[_0x9194('0x2e')]=_[_0x9194('0x2f')](_0x255620[_0x9194('0x2e')]);_0x3f6e50[_0x9194('0x30')]=_[_0x9194('0x31')](_0x3f6e50[_0x9194('0x2d')],_0x3f6e50[_0x9194('0x2e')]);_0x2886aa['attributes']=_[_0x9194('0x31')](_0x3f6e50['model'],qs[_0x9194('0x32')](_0x255620[_0x9194('0x2e')][_0x9194('0x32')]));_0x2886aa['attributes']=_0x2886aa[_0x9194('0x33')][_0x9194('0x34')]?_0x2886aa['attributes']:_0x3f6e50[_0x9194('0x2d')];if(!_0x255620[_0x9194('0x2e')][_0x9194('0x35')](_0x9194('0x36'))){_0x2886aa['limit']=qs[_0x9194('0x1c')](_0x255620['query'][_0x9194('0x1c')]);_0x2886aa[_0x9194('0x1b')]=qs[_0x9194('0x1b')](_0x255620[_0x9194('0x2e')][_0x9194('0x1b')]);}_0x2886aa['order']=qs[_0x9194('0x37')](_0x255620[_0x9194('0x2e')][_0x9194('0x37')]);_0x2886aa[_0x9194('0x38')]=qs[_0x9194('0x30')](_[_0x9194('0x39')](_0x255620[_0x9194('0x2e')],_0x3f6e50[_0x9194('0x30')]),_0x1f448);if(_0x255620[_0x9194('0x2e')][_0x9194('0x3a')]){_0x2886aa[_0x9194('0x38')]=_[_0x9194('0x3b')](_0x2886aa['where'],{'$or':_[_0x9194('0x28')](_0x1f448,function(_0x58da6d){if(_0x58da6d[_0x9194('0x2b')]!==_0x9194('0x3c')){var _0x4840a6={};_0x4840a6[_0x58da6d[_0x9194('0x25')]]={'$like':'%'+_0x255620[_0x9194('0x2e')]['filter']+'%'};return _0x4840a6;}})});}_0x2886aa=_[_0x9194('0x3b')]({},_0x2886aa,_0x255620['options']);var _0x2d2939={'where':_0x2886aa[_0x9194('0x38')]};return db[_0x9194('0x29')][_0x9194('0x3d')](_0x2d2939)[_0x9194('0x21')](function(_0x3a8e00){_0x12034b[_0x9194('0x3d')]=_0x3a8e00;if(_0x255620['query'][_0x9194('0x3e')]){_0x2886aa[_0x9194('0x3f')]=[{'all':!![]}];}return db['MailSubstatus'][_0x9194('0x40')](_0x2886aa);})[_0x9194('0x21')](function(_0x8ef957){_0x12034b[_0x9194('0x41')]=_0x8ef957;return _0x12034b;})[_0x9194('0x21')](respondWithFilteredResult(_0x3cee8a,_0x2886aa))[_0x9194('0x42')](handleError(_0x3cee8a,null));};exports[_0x9194('0x43')]=function(_0x259d74,_0x1a32e7){var _0x3d2d0b={'raw':!![],'where':{'id':_0x259d74[_0x9194('0x44')]['id']}},_0x44c63a={};_0x44c63a[_0x9194('0x2d')]=_[_0x9194('0x2f')](db[_0x9194('0x29')][_0x9194('0x45')]);_0x44c63a[_0x9194('0x2e')]=_[_0x9194('0x2f')](_0x259d74[_0x9194('0x2e')]);_0x44c63a[_0x9194('0x30')]=_[_0x9194('0x31')](_0x44c63a[_0x9194('0x2d')],_0x44c63a[_0x9194('0x2e')]);_0x3d2d0b[_0x9194('0x33')]=_[_0x9194('0x31')](_0x44c63a[_0x9194('0x2d')],qs[_0x9194('0x32')](_0x259d74['query']['fields']));_0x3d2d0b[_0x9194('0x33')]=_0x3d2d0b['attributes'][_0x9194('0x34')]?_0x3d2d0b[_0x9194('0x33')]:_0x44c63a['model'];if(_0x259d74[_0x9194('0x2e')][_0x9194('0x3e')]){_0x3d2d0b[_0x9194('0x3f')]=[{'all':!![]}];}_0x3d2d0b=_['merge']({},_0x3d2d0b,_0x259d74['options']);return db[_0x9194('0x29')][_0x9194('0x46')](_0x3d2d0b)[_0x9194('0x21')](handleEntityNotFound(_0x1a32e7,null))[_0x9194('0x21')](respondWithResult(_0x1a32e7,null))['catch'](handleError(_0x1a32e7,null));};exports[_0x9194('0x47')]=function(_0x549f5c,_0x2502c8){return db[_0x9194('0x29')][_0x9194('0x47')](_0x549f5c['body'],{})[_0x9194('0x21')](respondWithResult(_0x2502c8,0xc9))['catch'](handleError(_0x2502c8,null));};exports[_0x9194('0x20')]=function(_0x51e2dd,_0x23a69d){if(_0x51e2dd[_0x9194('0x48')]['id']){delete _0x51e2dd[_0x9194('0x48')]['id'];}return db[_0x9194('0x29')][_0x9194('0x46')]({'where':{'id':_0x51e2dd[_0x9194('0x44')]['id']}})[_0x9194('0x21')](handleEntityNotFound(_0x23a69d,null))['then'](saveUpdates(_0x51e2dd[_0x9194('0x48')],null))[_0x9194('0x21')](respondWithResult(_0x23a69d,null))[_0x9194('0x42')](handleError(_0x23a69d,null));};exports[_0x9194('0x22')]=function(_0x979e47,_0x3887b0){return db['MailSubstatus'][_0x9194('0x46')]({'where':{'id':_0x979e47[_0x9194('0x44')]['id']}})['then'](handleEntityNotFound(_0x3887b0,null))[_0x9194('0x21')](removeEntity(_0x3887b0,null))['catch'](handleError(_0x3887b0,null));};exports[_0x9194('0x49')]=function(_0x2170d1,_0x1532ca){return db[_0x9194('0x29')]['describe']()['then'](respondWithResult(_0x1532ca,null))['catch'](handleError(_0x1532ca,null));}; \ No newline at end of file +var _0xc0c4=['error','stack','name','index','map','MailSubstatus','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','type','VIRTUAL','merge','options','then','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','describe','eml-format','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','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','apply','save','update','destroy'];(function(_0x1e0fee,_0x1edcf1){var _0x2fd7e3=function(_0x52555c){while(--_0x52555c){_0x1e0fee['push'](_0x1e0fee['shift']());}};_0x2fd7e3(++_0x1edcf1);}(_0xc0c4,0xc4));var _0x4c0c=function(_0x4bb166,_0x5339a3){_0x4bb166=_0x4bb166-0x0;var _0x5e7d2c=_0xc0c4[_0x4bb166];return _0x5e7d2c;};'use strict';var emlformat=require(_0x4c0c('0x0'));var rimraf=require(_0x4c0c('0x1'));var zipdir=require(_0x4c0c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4c0c('0x3'));var moment=require(_0x4c0c('0x4'));var BPromise=require(_0x4c0c('0x5'));var Mustache=require(_0x4c0c('0x6'));var util=require(_0x4c0c('0x7'));var path=require('path');var sox=require(_0x4c0c('0x8'));var csv=require(_0x4c0c('0x9'));var ejs=require(_0x4c0c('0xa'));var fs=require('fs');var fs_extra=require(_0x4c0c('0xb'));var _=require(_0x4c0c('0xc'));var squel=require(_0x4c0c('0xd'));var crypto=require(_0x4c0c('0xe'));var jsforce=require(_0x4c0c('0xf'));var deskjs=require(_0x4c0c('0x10'));var toCsv=require(_0x4c0c('0x9'));var querystring=require(_0x4c0c('0x11'));var Papa=require(_0x4c0c('0x12'));var Redis=require(_0x4c0c('0x13'));var authService=require(_0x4c0c('0x14'));var qs=require(_0x4c0c('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4c0c('0x16'))(_0x4c0c('0x17'));var utils=require(_0x4c0c('0x18'));var config=require(_0x4c0c('0x19'));var licenseUtil=require(_0x4c0c('0x1a'));var db=require(_0x4c0c('0x1b'))['db'];function respondWithStatusCode(_0x4a608f,_0x314916){_0x314916=_0x314916||0xcc;return function(_0x35ff1f){if(_0x35ff1f){return _0x4a608f[_0x4c0c('0x1c')](_0x314916);}return _0x4a608f[_0x4c0c('0x1d')](_0x314916)[_0x4c0c('0x1e')]();};}function respondWithResult(_0x584cd8,_0x2bfaa8){_0x2bfaa8=_0x2bfaa8||0xc8;return function(_0x2821ad){if(_0x2821ad){return _0x584cd8['status'](_0x2bfaa8)[_0x4c0c('0x1f')](_0x2821ad);}};}function respondWithFilteredResult(_0x566624,_0x35254c){return function(_0x1fafcc){if(_0x1fafcc){var _0x6978d2=typeof _0x35254c['offset']===_0x4c0c('0x20')&&typeof _0x35254c['limit']===_0x4c0c('0x20');var _0x1a61a6=_0x1fafcc[_0x4c0c('0x21')];var _0x351612=_0x6978d2?0x0:_0x35254c[_0x4c0c('0x22')];var _0x536f88=_0x6978d2?_0x1fafcc[_0x4c0c('0x21')]:_0x35254c[_0x4c0c('0x22')]+_0x35254c[_0x4c0c('0x23')];var _0x173ece;if(_0x536f88>=_0x1a61a6){_0x536f88=_0x1a61a6;_0x173ece=0xc8;}else{_0x173ece=0xce;}_0x566624['status'](_0x173ece);return _0x566624['set'](_0x4c0c('0x24'),_0x351612+'-'+_0x536f88+'/'+_0x1a61a6)[_0x4c0c('0x1f')](_0x1fafcc);}return null;};}function patchUpdates(_0xf4f337){return function(_0x547067){try{jsonpatch[_0x4c0c('0x25')](_0x547067,_0xf4f337,!![]);}catch(_0x12bfc9){return BPromise['reject'](_0x12bfc9);}return _0x547067[_0x4c0c('0x26')]();};}function saveUpdates(_0x114766,_0x11ba72){return function(_0x21eb73){if(_0x21eb73){return _0x21eb73[_0x4c0c('0x27')](_0x114766)['then'](function(_0x43dff2){return _0x43dff2;});}return null;};}function removeEntity(_0x27a513,_0x1d97b8){return function(_0x4bd975){if(_0x4bd975){return _0x4bd975[_0x4c0c('0x28')]()['then'](function(){_0x27a513[_0x4c0c('0x1d')](0xcc)[_0x4c0c('0x1e')]();});}};}function handleEntityNotFound(_0x8ae00b,_0xd3f11c){return function(_0x34529d){if(!_0x34529d){_0x8ae00b['sendStatus'](0x194);}return _0x34529d;};}function handleError(_0x330d9f,_0x56557d){_0x56557d=_0x56557d||0x1f4;return function(_0x282242){logger[_0x4c0c('0x29')](_0x282242[_0x4c0c('0x2a')]);if(_0x282242[_0x4c0c('0x2b')]){delete _0x282242[_0x4c0c('0x2b')];}_0x330d9f['status'](_0x56557d)['send'](_0x282242);};}exports[_0x4c0c('0x2c')]=function(_0x280741,_0xf75b89){var _0x545e25={},_0x313df7={},_0x154e45={'count':0x0,'rows':[]};var _0x822808=_[_0x4c0c('0x2d')](db[_0x4c0c('0x2e')][_0x4c0c('0x2f')],function(_0x11059c){return{'name':_0x11059c[_0x4c0c('0x30')],'type':_0x11059c['type'][_0x4c0c('0x31')]};});_0x313df7[_0x4c0c('0x32')]=_[_0x4c0c('0x2d')](_0x822808,_0x4c0c('0x2b'));_0x313df7[_0x4c0c('0x33')]=_['keys'](_0x280741[_0x4c0c('0x33')]);_0x313df7['filters']=_[_0x4c0c('0x34')](_0x313df7[_0x4c0c('0x32')],_0x313df7[_0x4c0c('0x33')]);_0x545e25[_0x4c0c('0x35')]=_[_0x4c0c('0x34')](_0x313df7[_0x4c0c('0x32')],qs['fields'](_0x280741['query'][_0x4c0c('0x36')]));_0x545e25[_0x4c0c('0x35')]=_0x545e25[_0x4c0c('0x35')][_0x4c0c('0x37')]?_0x545e25['attributes']:_0x313df7[_0x4c0c('0x32')];if(!_0x280741['query'][_0x4c0c('0x38')](_0x4c0c('0x39'))){_0x545e25['limit']=qs[_0x4c0c('0x23')](_0x280741['query']['limit']);_0x545e25[_0x4c0c('0x22')]=qs['offset'](_0x280741[_0x4c0c('0x33')][_0x4c0c('0x22')]);}_0x545e25['order']=qs[_0x4c0c('0x3a')](_0x280741[_0x4c0c('0x33')][_0x4c0c('0x3a')]);_0x545e25[_0x4c0c('0x3b')]=qs[_0x4c0c('0x3c')](_['pick'](_0x280741['query'],_0x313df7[_0x4c0c('0x3c')]),_0x822808);if(_0x280741[_0x4c0c('0x33')][_0x4c0c('0x3d')]){_0x545e25[_0x4c0c('0x3b')]=_['merge'](_0x545e25['where'],{'$or':_[_0x4c0c('0x2d')](_0x822808,function(_0x30627a){if(_0x30627a[_0x4c0c('0x3e')]!==_0x4c0c('0x3f')){var _0x57563a={};_0x57563a[_0x30627a[_0x4c0c('0x2b')]]={'$like':'%'+_0x280741[_0x4c0c('0x33')]['filter']+'%'};return _0x57563a;}})});}_0x545e25=_[_0x4c0c('0x40')]({},_0x545e25,_0x280741[_0x4c0c('0x41')]);var _0x15549a={'where':_0x545e25[_0x4c0c('0x3b')]};return db[_0x4c0c('0x2e')][_0x4c0c('0x21')](_0x15549a)[_0x4c0c('0x42')](function(_0x154894){_0x154e45[_0x4c0c('0x21')]=_0x154894;if(_0x280741[_0x4c0c('0x33')][_0x4c0c('0x43')]){_0x545e25[_0x4c0c('0x44')]=[{'all':!![]}];}return db[_0x4c0c('0x2e')][_0x4c0c('0x45')](_0x545e25);})['then'](function(_0x371ee8){_0x154e45[_0x4c0c('0x46')]=_0x371ee8;return _0x154e45;})[_0x4c0c('0x42')](respondWithFilteredResult(_0xf75b89,_0x545e25))[_0x4c0c('0x47')](handleError(_0xf75b89,null));};exports[_0x4c0c('0x48')]=function(_0xb97db0,_0x1a8c93){var _0xfa64ac={'raw':!![],'where':{'id':_0xb97db0[_0x4c0c('0x49')]['id']}},_0x40028f={};_0x40028f[_0x4c0c('0x32')]=_[_0x4c0c('0x4a')](db[_0x4c0c('0x2e')][_0x4c0c('0x2f')]);_0x40028f[_0x4c0c('0x33')]=_[_0x4c0c('0x4a')](_0xb97db0[_0x4c0c('0x33')]);_0x40028f[_0x4c0c('0x3c')]=_[_0x4c0c('0x34')](_0x40028f['model'],_0x40028f[_0x4c0c('0x33')]);_0xfa64ac[_0x4c0c('0x35')]=_[_0x4c0c('0x34')](_0x40028f[_0x4c0c('0x32')],qs[_0x4c0c('0x36')](_0xb97db0[_0x4c0c('0x33')][_0x4c0c('0x36')]));_0xfa64ac[_0x4c0c('0x35')]=_0xfa64ac[_0x4c0c('0x35')][_0x4c0c('0x37')]?_0xfa64ac['attributes']:_0x40028f['model'];if(_0xb97db0['query'][_0x4c0c('0x43')]){_0xfa64ac[_0x4c0c('0x44')]=[{'all':!![]}];}_0xfa64ac=_[_0x4c0c('0x40')]({},_0xfa64ac,_0xb97db0['options']);return db[_0x4c0c('0x2e')][_0x4c0c('0x4b')](_0xfa64ac)['then'](handleEntityNotFound(_0x1a8c93,null))['then'](respondWithResult(_0x1a8c93,null))[_0x4c0c('0x47')](handleError(_0x1a8c93,null));};exports['create']=function(_0x214501,_0x514364){return db[_0x4c0c('0x2e')][_0x4c0c('0x4c')](_0x214501['body'],{})['then'](respondWithResult(_0x514364,0xc9))[_0x4c0c('0x47')](handleError(_0x514364,null));};exports[_0x4c0c('0x27')]=function(_0x21b53b,_0x35d2bb){if(_0x21b53b['body']['id']){delete _0x21b53b[_0x4c0c('0x4d')]['id'];}return db['MailSubstatus'][_0x4c0c('0x4b')]({'where':{'id':_0x21b53b[_0x4c0c('0x49')]['id']}})[_0x4c0c('0x42')](handleEntityNotFound(_0x35d2bb,null))[_0x4c0c('0x42')](saveUpdates(_0x21b53b[_0x4c0c('0x4d')],null))[_0x4c0c('0x42')](respondWithResult(_0x35d2bb,null))[_0x4c0c('0x47')](handleError(_0x35d2bb,null));};exports[_0x4c0c('0x28')]=function(_0x35c999,_0x155566){return db[_0x4c0c('0x2e')][_0x4c0c('0x4b')]({'where':{'id':_0x35c999['params']['id']}})[_0x4c0c('0x42')](handleEntityNotFound(_0x155566,null))[_0x4c0c('0x42')](removeEntity(_0x155566,null))[_0x4c0c('0x47')](handleError(_0x155566,null));};exports['describe']=function(_0x2cba05,_0x30f779){return db[_0x4c0c('0x2e')][_0x4c0c('0x4e')]()[_0x4c0c('0x42')](respondWithResult(_0x30f779,null))[_0x4c0c('0x47')](handleError(_0x30f779,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 544eed6..6ca7870 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 _0x2be5=['events','../../mysqldb','MailSubstatus','setMaxListeners','update','emit','hook','exports'];(function(_0x344179,_0xb1c8a7){var _0x38fb32=function(_0x601710){while(--_0x601710){_0x344179['push'](_0x344179['shift']());}};_0x38fb32(++_0xb1c8a7);}(_0x2be5,0x150));var _0x52be=function(_0x1b8857,_0x16396c){_0x1b8857=_0x1b8857-0x0;var _0x3cf41b=_0x2be5[_0x1b8857];return _0x3cf41b;};'use strict';var EventEmitter=require(_0x52be('0x0'));var MailSubstatus=require(_0x52be('0x1'))['db'][_0x52be('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x52be('0x3')](0x0);var events={'afterUpdate':_0x52be('0x4')};function emitEvent(_0x12b14b){return function(_0x5d8431,_0x28ee91,_0x1ca820){MailSubstatusEvents['emit'](_0x12b14b+':'+_0x5d8431['id'],_0x5d8431);MailSubstatusEvents[_0x52be('0x5')](_0x12b14b,_0x5d8431);_0x1ca820(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailSubstatus[_0x52be('0x6')](e,emitEvent(event));}}module[_0x52be('0x7')]=MailSubstatusEvents; \ No newline at end of file +var _0xcc42=['exports','events','../../mysqldb','MailSubstatus','setMaxListeners','update','emit','hasOwnProperty','hook'];(function(_0x130b30,_0x3d45b6){var _0x1b9f34=function(_0xf5b5ff){while(--_0xf5b5ff){_0x130b30['push'](_0x130b30['shift']());}};_0x1b9f34(++_0x3d45b6);}(_0xcc42,0xbe));var _0x2cc4=function(_0x4c4037,_0x15054b){_0x4c4037=_0x4c4037-0x0;var _0x357862=_0xcc42[_0x4c4037];return _0x357862;};'use strict';var EventEmitter=require(_0x2cc4('0x0'));var MailSubstatus=require(_0x2cc4('0x1'))['db'][_0x2cc4('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x2cc4('0x3')](0x0);var events={'afterUpdate':_0x2cc4('0x4')};function emitEvent(_0x13824d){return function(_0x4686dc,_0x4d0120,_0x36298c){MailSubstatusEvents[_0x2cc4('0x5')](_0x13824d+':'+_0x4686dc['id'],_0x4686dc);MailSubstatusEvents[_0x2cc4('0x5')](_0x13824d,_0x4686dc);_0x36298c(null);};}for(var e in events){if(events[_0x2cc4('0x6')](e)){var event=events[e];MailSubstatus[_0x2cc4('0x7')](e,emitEvent(event));}}module[_0x2cc4('0x8')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 8c091d8..2703e85 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 _0x6906=['mail_substatuses','Condition','update','mailSubstatus','_previousDataValues','name','then','catch','./mailSubstatus.attributes','exports','models','define'];(function(_0x1bacf4,_0x4a4184){var _0xc43993=function(_0x54849a){while(--_0x54849a){_0x1bacf4['push'](_0x1bacf4['shift']());}};_0xc43993(++_0x4a4184);}(_0x6906,0x1d0));var _0x6690=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x6906[_0x501510];return _0x1e6ee5;};'use strict';var attributes=require(_0x6690('0x0'));module[_0x6690('0x1')]=function(_0x4a08a7){var _0x542c7d=_0x4a08a7[_0x6690('0x2')];return _0x4a08a7[_0x6690('0x3')]('MailSubstatus',attributes,{'tableName':_0x6690('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x46e604,_0xc4a37,_0x27d1b2){return _0x542c7d[_0x6690('0x5')][_0x6690('0x6')]({'value':_0x46e604['name']},{'where':{'field':_0x6690('0x7'),'value':_0x46e604[_0x6690('0x8')][_0x6690('0x9')]}})[_0x6690('0xa')](function(){_0x27d1b2();})[_0x6690('0xb')](function(_0x13482d){_0x27d1b2(_0x13482d);});}}});}; \ No newline at end of file +var _0xf4d3=['update','_previousDataValues','name','then','catch','exports','define','mail_substatuses','Condition'];(function(_0x3fd8e5,_0x3b1b2f){var _0x13c5b8=function(_0x6ef246){while(--_0x6ef246){_0x3fd8e5['push'](_0x3fd8e5['shift']());}};_0x13c5b8(++_0x3b1b2f);}(_0xf4d3,0x140));var _0x3f4d=function(_0x827f3a,_0x3ee6f5){_0x827f3a=_0x827f3a-0x0;var _0x1cd993=_0xf4d3[_0x827f3a];return _0x1cd993;};'use strict';var attributes=require('./mailSubstatus.attributes');module[_0x3f4d('0x0')]=function(_0x29dace){var _0x5606ba=_0x29dace['models'];return _0x29dace[_0x3f4d('0x1')]('MailSubstatus',attributes,{'tableName':_0x3f4d('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x3be0b0,_0x5cae5b,_0x5ef273){return _0x5606ba[_0x3f4d('0x3')][_0x3f4d('0x4')]({'value':_0x3be0b0['name']},{'where':{'field':'mailSubstatus','value':_0x3be0b0[_0x3f4d('0x5')][_0x3f4d('0x6')]}})[_0x3f4d('0x7')](function(){_0x5ef273();})[_0x3f4d('0x8')](function(_0x5435f0){_0x5ef273(_0x5435f0);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 432d37f..d8d074f 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 _0x4c7d=['MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','request','info','MailSubstatus,\x20%s,\x20%s','request\x20sent'];(function(_0x59943d,_0x2e751b){var _0x46ace9=function(_0xfbd5f2){while(--_0xfbd5f2){_0x59943d['push'](_0x59943d['shift']());}};_0x46ace9(++_0x2e751b);}(_0x4c7d,0x1ce));var _0xd4c7=function(_0x1ca65d,_0x53fbc3){_0x1ca65d=_0x1ca65d-0x0;var _0x31cc85=_0x4c7d[_0x1ca65d];return _0x31cc85;};'use strict';var _=require('lodash');var util=require(_0xd4c7('0x0'));var moment=require(_0xd4c7('0x1'));var BPromise=require(_0xd4c7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd4c7('0x3'));var db=require(_0xd4c7('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xd4c7('0x5'));var jayson=require(_0xd4c7('0x6'));var client=jayson[_0xd4c7('0x7')][_0xd4c7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x307a95,_0x2e8005,_0x52a28a){return new BPromise(function(_0x55890b,_0x5512a8){return client[_0xd4c7('0x9')](_0x307a95,_0x52a28a)['then'](function(_0x5a89e1){logger[_0xd4c7('0xa')](_0xd4c7('0xb'),_0x2e8005,_0xd4c7('0xc'));logger['debug'](_0xd4c7('0xd'),_0x2e8005,'request\x20sent',JSON[_0xd4c7('0xe')](_0x5a89e1));if(_0x5a89e1[_0xd4c7('0xf')]){if(_0x5a89e1[_0xd4c7('0xf')][_0xd4c7('0x10')]===0x1f4){logger['error'](_0xd4c7('0xb'),_0x2e8005,_0x5a89e1['error'][_0xd4c7('0x11')]);return _0x5512a8(_0x5a89e1[_0xd4c7('0xf')]['message']);}logger['error'](_0xd4c7('0xb'),_0x2e8005,_0x5a89e1['error'][_0xd4c7('0x11')]);return _0x55890b(_0x5a89e1[_0xd4c7('0xf')][_0xd4c7('0x11')]);}else{logger[_0xd4c7('0xa')]('MailSubstatus,\x20%s,\x20%s',_0x2e8005,'request\x20sent');_0x55890b(_0x5a89e1[_0xd4c7('0x12')][_0xd4c7('0x11')]);}})['catch'](function(_0x89ccdb){logger[_0xd4c7('0xf')](_0xd4c7('0xb'),_0x2e8005,_0x89ccdb);_0x5512a8(_0x89ccdb);});});} \ No newline at end of file +var _0x6697=['jayson/promise','client','http','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0x6697,0x10c));var _0x7669=function(_0x4484f7,_0x1c6e68){_0x4484f7=_0x4484f7-0x0;var _0xd4a6fa=_0x6697[_0x4484f7];return _0xd4a6fa;};'use strict';var _=require('lodash');var util=require(_0x7669('0x0'));var moment=require(_0x7669('0x1'));var BPromise=require(_0x7669('0x2'));var rs=require(_0x7669('0x3'));var fs=require('fs');var Redis=require(_0x7669('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7669('0x5'));var logger=require(_0x7669('0x6'))('rpc');var config=require(_0x7669('0x7'));var jayson=require(_0x7669('0x8'));var client=jayson[_0x7669('0x9')][_0x7669('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4d22ca,_0x451707,_0x3e3f15){return new BPromise(function(_0x4c76f1,_0x2d5d87){return client[_0x7669('0xb')](_0x4d22ca,_0x3e3f15)[_0x7669('0xc')](function(_0x43f63c){logger[_0x7669('0xd')](_0x7669('0xe'),_0x451707,_0x7669('0xf'));logger['debug'](_0x7669('0x10'),_0x451707,_0x7669('0xf'),JSON[_0x7669('0x11')](_0x43f63c));if(_0x43f63c[_0x7669('0x12')]){if(_0x43f63c[_0x7669('0x12')][_0x7669('0x13')]===0x1f4){logger['error'](_0x7669('0xe'),_0x451707,_0x43f63c[_0x7669('0x12')][_0x7669('0x14')]);return _0x2d5d87(_0x43f63c['error'][_0x7669('0x14')]);}logger[_0x7669('0x12')](_0x7669('0xe'),_0x451707,_0x43f63c[_0x7669('0x12')][_0x7669('0x14')]);return _0x4c76f1(_0x43f63c[_0x7669('0x12')][_0x7669('0x14')]);}else{logger[_0x7669('0xd')]('MailSubstatus,\x20%s,\x20%s',_0x451707,_0x7669('0xf'));_0x4c76f1(_0x43f63c[_0x7669('0x15')][_0x7669('0x14')]);}})[_0x7669('0x16')](function(_0x2d316f){logger['error'](_0x7669('0xe'),_0x451707,_0x2d316f);_0x2d5d87(_0x2d316f);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 915ed3c..748c35c 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 _0xf493=['delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','describe','isAuthenticated','show','post','create','/:id'];(function(_0x17622f,_0x31f944){var _0x375aa2=function(_0x39b2e3){while(--_0x39b2e3){_0x17622f['push'](_0x17622f['shift']());}};_0x375aa2(++_0x31f944);}(_0xf493,0x8f));var _0x3f49=function(_0x4452e3,_0x22a3b3){_0x4452e3=_0x4452e3-0x0;var _0xb56a8=_0xf493[_0x4452e3];return _0xb56a8;};'use strict';var multer=require(_0x3f49('0x0'));var util=require(_0x3f49('0x1'));var path=require(_0x3f49('0x2'));var timeout=require(_0x3f49('0x3'));var express=require('express');var router=express[_0x3f49('0x4')]();var fs_extra=require(_0x3f49('0x5'));var auth=require(_0x3f49('0x6'));var interaction=require(_0x3f49('0x7'));var config=require(_0x3f49('0x8'));var controller=require('./mailTransferReport.controller');router[_0x3f49('0x9')]('/',auth['isAuthenticated'](),controller[_0x3f49('0xa')]);router[_0x3f49('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x3f49('0xb')]);router[_0x3f49('0x9')]('/:id',auth[_0x3f49('0xc')](),controller[_0x3f49('0xd')]);router[_0x3f49('0xe')]('/',auth[_0x3f49('0xc')](),controller[_0x3f49('0xf')]);router['put'](_0x3f49('0x10'),auth['isAuthenticated'](),controller['update']);router[_0x3f49('0x11')](_0x3f49('0x10'),auth['isAuthenticated'](),controller[_0x3f49('0x12')]);module[_0x3f49('0x13')]=router; \ No newline at end of file +var _0x512d=['express','Router','../../components/auth/service','../../config/environment','isAuthenticated','get','/describe','describe','/:id','show','post','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x512d,0x153));var _0xd512=function(_0x40e18b,_0xb1f8ed){_0x40e18b=_0x40e18b-0x0;var _0x2919d7=_0x512d[_0x40e18b];return _0x2919d7;};'use strict';var multer=require('multer');var util=require(_0xd512('0x0'));var path=require(_0xd512('0x1'));var timeout=require(_0xd512('0x2'));var express=require(_0xd512('0x3'));var router=express[_0xd512('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd512('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd512('0x6'));var controller=require('./mailTransferReport.controller');router['get']('/',auth[_0xd512('0x7')](),controller['index']);router[_0xd512('0x8')](_0xd512('0x9'),auth[_0xd512('0x7')](),controller[_0xd512('0xa')]);router['get'](_0xd512('0xb'),auth[_0xd512('0x7')](),controller[_0xd512('0xc')]);router[_0xd512('0xd')]('/',auth[_0xd512('0x7')](),controller['create']);router['put'](_0xd512('0xb'),auth['isAuthenticated'](),controller[_0xd512('0xe')]);router[_0xd512('0xf')]('/:id',auth[_0xd512('0x7')](),controller[_0xd512('0x10')]);module[_0xd512('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 2f6aebb..564f414 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 _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x266155,_0x5ecc85){var _0x344520=function(_0x35e46e){while(--_0x35e46e){_0x266155['push'](_0x266155['shift']());}};_0x344520(++_0x5ecc85);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4cce65,_0x40021e){_0x4cce65=_0x4cce65-0x0;var _0x4d1b45=_0xcb91[_0x4cce65];return _0x4d1b45;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1cb9('0x0')]={'uniqueid':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1cb9('0x2')](_0x1cb9('0x3'),'agent',_0x1cb9('0x4')),'allowNull':![],'defaultValue':_0x1cb9('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x1cb9('0x5')]}}; \ No newline at end of file +var _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x2ed0c9,_0x3b4e73){var _0x2893e8=function(_0x369d83){while(--_0x369d83){_0x2ed0c9['push'](_0x2ed0c9['shift']());}};_0x2893e8(++_0x3b4e73);}(_0x00bb,0x1d8));var _0xb00b=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x00bb[_0x3b380d];return _0x54502b;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 4c8b4ac..e13a75c 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 _0x6612=['sendStatus','error','stack','name','send','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','merge','VIRTUAL','options','MailTransferReport','includeAll','include','findAll','show','params','find','catch','create','body','update','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy'];(function(_0x4b9a3a,_0x4fae51){var _0x553159=function(_0x180af7){while(--_0x180af7){_0x4b9a3a['push'](_0x4b9a3a['shift']());}};_0x553159(++_0x4fae51);}(_0x6612,0x1ed));var _0x2661=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0x6612[_0x3a6efd];return _0x487b9a;};'use strict';var emlformat=require(_0x2661('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2661('0x1'));var jsonpatch=require(_0x2661('0x2'));var rp=require(_0x2661('0x3'));var moment=require(_0x2661('0x4'));var BPromise=require(_0x2661('0x5'));var Mustache=require(_0x2661('0x6'));var util=require(_0x2661('0x7'));var path=require('path');var sox=require(_0x2661('0x8'));var csv=require(_0x2661('0x9'));var ejs=require(_0x2661('0xa'));var fs=require('fs');var fs_extra=require(_0x2661('0xb'));var _=require(_0x2661('0xc'));var squel=require(_0x2661('0xd'));var crypto=require(_0x2661('0xe'));var jsforce=require(_0x2661('0xf'));var deskjs=require(_0x2661('0x10'));var toCsv=require(_0x2661('0x9'));var querystring=require(_0x2661('0x11'));var Papa=require('papaparse');var Redis=require(_0x2661('0x12'));var authService=require(_0x2661('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2661('0x14'));var logger=require('../../config/logger')(_0x2661('0x15'));var utils=require(_0x2661('0x16'));var config=require(_0x2661('0x17'));var licenseUtil=require(_0x2661('0x18'));var db=require(_0x2661('0x19'))['db'];function respondWithStatusCode(_0x46510a,_0x22b6e4){_0x22b6e4=_0x22b6e4||0xcc;return function(_0x25a998){if(_0x25a998){return _0x46510a['sendStatus'](_0x22b6e4);}return _0x46510a[_0x2661('0x1a')](_0x22b6e4)[_0x2661('0x1b')]();};}function respondWithResult(_0x25ae24,_0x2de5ab){_0x2de5ab=_0x2de5ab||0xc8;return function(_0x324b67){if(_0x324b67){return _0x25ae24[_0x2661('0x1a')](_0x2de5ab)[_0x2661('0x1c')](_0x324b67);}};}function respondWithFilteredResult(_0x1f7a7b,_0x3bc83e){return function(_0x479683){if(_0x479683){var _0x113ed9=typeof _0x3bc83e[_0x2661('0x1d')]===_0x2661('0x1e')&&typeof _0x3bc83e[_0x2661('0x1f')]===_0x2661('0x1e');var _0x30def5=_0x479683[_0x2661('0x20')];var _0x5e99ea=_0x113ed9?0x0:_0x3bc83e[_0x2661('0x1d')];var _0x75ebb6=_0x113ed9?_0x479683[_0x2661('0x20')]:_0x3bc83e[_0x2661('0x1d')]+_0x3bc83e['limit'];var _0x37ad05;if(_0x75ebb6>=_0x30def5){_0x75ebb6=_0x30def5;_0x37ad05=0xc8;}else{_0x37ad05=0xce;}_0x1f7a7b[_0x2661('0x1a')](_0x37ad05);return _0x1f7a7b[_0x2661('0x21')](_0x2661('0x22'),_0x5e99ea+'-'+_0x75ebb6+'/'+_0x30def5)['json'](_0x479683);}return null;};}function patchUpdates(_0x35e72a){return function(_0x27abf1){try{jsonpatch['apply'](_0x27abf1,_0x35e72a,!![]);}catch(_0x14b8da){return BPromise[_0x2661('0x23')](_0x14b8da);}return _0x27abf1[_0x2661('0x24')]();};}function saveUpdates(_0x5e5dc4,_0x2dc8e2){return function(_0x2d5206){if(_0x2d5206){return _0x2d5206['update'](_0x5e5dc4)[_0x2661('0x25')](function(_0x1935b2){return _0x1935b2;});}return null;};}function removeEntity(_0x24b316,_0xa36280){return function(_0x92e651){if(_0x92e651){return _0x92e651[_0x2661('0x26')]()['then'](function(){_0x24b316[_0x2661('0x1a')](0xcc)[_0x2661('0x1b')]();});}};}function handleEntityNotFound(_0x517081,_0x57d5dd){return function(_0x459bbc){if(!_0x459bbc){_0x517081[_0x2661('0x27')](0x194);}return _0x459bbc;};}function handleError(_0x5875ec,_0xa6755e){_0xa6755e=_0xa6755e||0x1f4;return function(_0x7ff900){logger[_0x2661('0x28')](_0x7ff900[_0x2661('0x29')]);if(_0x7ff900['name']){delete _0x7ff900[_0x2661('0x2a')];}_0x5875ec['status'](_0xa6755e)[_0x2661('0x2b')](_0x7ff900);};}exports['index']=function(_0x3ee68e,_0xb8db35){var _0xf5f5f4={},_0x19aab5={},_0x3b5381={'count':0x0,'rows':[]};var _0x532c1b=_[_0x2661('0x2c')](db['MailTransferReport'][_0x2661('0x2d')],function(_0x38c0e1){return{'name':_0x38c0e1[_0x2661('0x2e')],'type':_0x38c0e1[_0x2661('0x2f')]['key']};});_0x19aab5[_0x2661('0x30')]=_[_0x2661('0x2c')](_0x532c1b,'name');_0x19aab5[_0x2661('0x31')]=_[_0x2661('0x32')](_0x3ee68e[_0x2661('0x31')]);_0x19aab5[_0x2661('0x33')]=_[_0x2661('0x34')](_0x19aab5[_0x2661('0x30')],_0x19aab5[_0x2661('0x31')]);_0xf5f5f4[_0x2661('0x35')]=_[_0x2661('0x34')](_0x19aab5['model'],qs[_0x2661('0x36')](_0x3ee68e[_0x2661('0x31')]['fields']));_0xf5f5f4[_0x2661('0x35')]=_0xf5f5f4[_0x2661('0x35')][_0x2661('0x37')]?_0xf5f5f4[_0x2661('0x35')]:_0x19aab5[_0x2661('0x30')];if(!_0x3ee68e['query'][_0x2661('0x38')](_0x2661('0x39'))){_0xf5f5f4[_0x2661('0x1f')]=qs['limit'](_0x3ee68e['query']['limit']);_0xf5f5f4[_0x2661('0x1d')]=qs['offset'](_0x3ee68e['query'][_0x2661('0x1d')]);}_0xf5f5f4['order']=qs[_0x2661('0x3a')](_0x3ee68e[_0x2661('0x31')][_0x2661('0x3a')]);_0xf5f5f4['where']=qs[_0x2661('0x33')](_['pick'](_0x3ee68e[_0x2661('0x31')],_0x19aab5[_0x2661('0x33')]),_0x532c1b);if(_0x3ee68e[_0x2661('0x31')][_0x2661('0x3b')]){_0xf5f5f4[_0x2661('0x3c')]=_[_0x2661('0x3d')](_0xf5f5f4[_0x2661('0x3c')],{'$or':_[_0x2661('0x2c')](_0x532c1b,function(_0x12e0a6){if(_0x12e0a6[_0x2661('0x2f')]!==_0x2661('0x3e')){var _0x3bd6fd={};_0x3bd6fd[_0x12e0a6[_0x2661('0x2a')]]={'$like':'%'+_0x3ee68e[_0x2661('0x31')]['filter']+'%'};return _0x3bd6fd;}})});}_0xf5f5f4=_[_0x2661('0x3d')]({},_0xf5f5f4,_0x3ee68e[_0x2661('0x3f')]);var _0xbd73af={'where':_0xf5f5f4[_0x2661('0x3c')]};return db[_0x2661('0x40')][_0x2661('0x20')](_0xbd73af)['then'](function(_0xacca5d){_0x3b5381['count']=_0xacca5d;if(_0x3ee68e[_0x2661('0x31')][_0x2661('0x41')]){_0xf5f5f4[_0x2661('0x42')]=[{'all':!![]}];}return db[_0x2661('0x40')][_0x2661('0x43')](_0xf5f5f4);})['then'](function(_0x29973f){_0x3b5381['rows']=_0x29973f;return _0x3b5381;})[_0x2661('0x25')](respondWithFilteredResult(_0xb8db35,_0xf5f5f4))['catch'](handleError(_0xb8db35,null));};exports[_0x2661('0x44')]=function(_0x380a77,_0x257365){var _0x46ca98={'raw':!![],'where':{'id':_0x380a77[_0x2661('0x45')]['id']}},_0x3648f7={};_0x3648f7[_0x2661('0x30')]=_[_0x2661('0x32')](db[_0x2661('0x40')]['rawAttributes']);_0x3648f7[_0x2661('0x31')]=_[_0x2661('0x32')](_0x380a77[_0x2661('0x31')]);_0x3648f7['filters']=_['intersection'](_0x3648f7[_0x2661('0x30')],_0x3648f7[_0x2661('0x31')]);_0x46ca98[_0x2661('0x35')]=_['intersection'](_0x3648f7['model'],qs['fields'](_0x380a77[_0x2661('0x31')][_0x2661('0x36')]));_0x46ca98[_0x2661('0x35')]=_0x46ca98[_0x2661('0x35')][_0x2661('0x37')]?_0x46ca98[_0x2661('0x35')]:_0x3648f7[_0x2661('0x30')];if(_0x380a77[_0x2661('0x31')][_0x2661('0x41')]){_0x46ca98[_0x2661('0x42')]=[{'all':!![]}];}_0x46ca98=_[_0x2661('0x3d')]({},_0x46ca98,_0x380a77['options']);return db[_0x2661('0x40')][_0x2661('0x46')](_0x46ca98)['then'](handleEntityNotFound(_0x257365,null))['then'](respondWithResult(_0x257365,null))[_0x2661('0x47')](handleError(_0x257365,null));};exports[_0x2661('0x48')]=function(_0x1735c0,_0x2ef014){return db['MailTransferReport'][_0x2661('0x48')](_0x1735c0[_0x2661('0x49')],{})['then'](respondWithResult(_0x2ef014,0xc9))[_0x2661('0x47')](handleError(_0x2ef014,null));};exports[_0x2661('0x4a')]=function(_0x3a5917,_0x2fc6a3){if(_0x3a5917[_0x2661('0x49')]['id']){delete _0x3a5917[_0x2661('0x49')]['id'];}return db[_0x2661('0x40')][_0x2661('0x46')]({'where':{'id':_0x3a5917[_0x2661('0x45')]['id']}})[_0x2661('0x25')](handleEntityNotFound(_0x2fc6a3,null))[_0x2661('0x25')](saveUpdates(_0x3a5917['body'],null))[_0x2661('0x25')](respondWithResult(_0x2fc6a3,null))[_0x2661('0x47')](handleError(_0x2fc6a3,null));};exports[_0x2661('0x26')]=function(_0x530e59,_0x3e5245){return db['MailTransferReport']['find']({'where':{'id':_0x530e59[_0x2661('0x45')]['id']}})[_0x2661('0x25')](handleEntityNotFound(_0x3e5245,null))[_0x2661('0x25')](removeEntity(_0x3e5245,null))[_0x2661('0x47')](handleError(_0x3e5245,null));};exports[_0x2661('0x4b')]=function(_0x1c1975,_0x220209){return db[_0x2661('0x40')][_0x2661('0x4b')]()[_0x2661('0x25')](respondWithResult(_0x220209,null))['catch'](handleError(_0x220209,null));}; \ No newline at end of file +var _0xa975=['where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','create','body','find','describe','eml-format','rimraf','zip-dir','request-promise','util','path','sox','ejs','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','status','end','offset','undefined','count','limit','Content-Range','json','apply','save','update','then','destroy','sendStatus','stack','name','send','index','map','MailTransferReport','rawAttributes','fieldName','type','keys','query','model','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort'];(function(_0x5b8802,_0x4911ee){var _0x1135be=function(_0x2157b5){while(--_0x2157b5){_0x5b8802['push'](_0x5b8802['shift']());}};_0x1135be(++_0x4911ee);}(_0xa975,0x16a));var _0x5a97=function(_0x245490,_0x40ba27){_0x245490=_0x245490-0x0;var _0x341444=_0xa975[_0x245490];return _0x341444;};'use strict';var emlformat=require(_0x5a97('0x0'));var rimraf=require(_0x5a97('0x1'));var zipdir=require(_0x5a97('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5a97('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5a97('0x4'));var path=require(_0x5a97('0x5'));var sox=require(_0x5a97('0x6'));var csv=require('to-csv');var ejs=require(_0x5a97('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x5a97('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x5a97('0x9'));var toCsv=require(_0x5a97('0xa'));var querystring=require('querystring');var Papa=require(_0x5a97('0xb'));var Redis=require(_0x5a97('0xc'));var authService=require(_0x5a97('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x5a97('0xe'));var hardwareService=require(_0x5a97('0xf'));var logger=require('../../config/logger')(_0x5a97('0x10'));var utils=require(_0x5a97('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x5a97('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2275d8,_0x4ae5d5){_0x4ae5d5=_0x4ae5d5||0xcc;return function(_0x1d946c){if(_0x1d946c){return _0x2275d8['sendStatus'](_0x4ae5d5);}return _0x2275d8[_0x5a97('0x13')](_0x4ae5d5)[_0x5a97('0x14')]();};}function respondWithResult(_0x43b37f,_0xf430a0){_0xf430a0=_0xf430a0||0xc8;return function(_0x280148){if(_0x280148){return _0x43b37f[_0x5a97('0x13')](_0xf430a0)['json'](_0x280148);}};}function respondWithFilteredResult(_0x377dca,_0x33db44){return function(_0x1b4d31){if(_0x1b4d31){var _0x4c739d=typeof _0x33db44[_0x5a97('0x15')]===_0x5a97('0x16')&&typeof _0x33db44['limit']===_0x5a97('0x16');var _0xa46629=_0x1b4d31[_0x5a97('0x17')];var _0x882814=_0x4c739d?0x0:_0x33db44['offset'];var _0x1dc1c9=_0x4c739d?_0x1b4d31['count']:_0x33db44['offset']+_0x33db44[_0x5a97('0x18')];var _0x2e2ae0;if(_0x1dc1c9>=_0xa46629){_0x1dc1c9=_0xa46629;_0x2e2ae0=0xc8;}else{_0x2e2ae0=0xce;}_0x377dca[_0x5a97('0x13')](_0x2e2ae0);return _0x377dca['set'](_0x5a97('0x19'),_0x882814+'-'+_0x1dc1c9+'/'+_0xa46629)[_0x5a97('0x1a')](_0x1b4d31);}return null;};}function patchUpdates(_0x5d8f4f){return function(_0x3771e9){try{jsonpatch[_0x5a97('0x1b')](_0x3771e9,_0x5d8f4f,!![]);}catch(_0x14d149){return BPromise['reject'](_0x14d149);}return _0x3771e9[_0x5a97('0x1c')]();};}function saveUpdates(_0x27b64b,_0x1768e7){return function(_0x3c8598){if(_0x3c8598){return _0x3c8598[_0x5a97('0x1d')](_0x27b64b)[_0x5a97('0x1e')](function(_0x22304f){return _0x22304f;});}return null;};}function removeEntity(_0x262b69,_0x2eced3){return function(_0xd8f854){if(_0xd8f854){return _0xd8f854[_0x5a97('0x1f')]()[_0x5a97('0x1e')](function(){_0x262b69[_0x5a97('0x13')](0xcc)[_0x5a97('0x14')]();});}};}function handleEntityNotFound(_0x7c9884,_0x596186){return function(_0x20ea8a){if(!_0x20ea8a){_0x7c9884[_0x5a97('0x20')](0x194);}return _0x20ea8a;};}function handleError(_0x15ed71,_0x1479f7){_0x1479f7=_0x1479f7||0x1f4;return function(_0x4f6023){logger['error'](_0x4f6023[_0x5a97('0x21')]);if(_0x4f6023['name']){delete _0x4f6023[_0x5a97('0x22')];}_0x15ed71[_0x5a97('0x13')](_0x1479f7)[_0x5a97('0x23')](_0x4f6023);};}exports[_0x5a97('0x24')]=function(_0x3bbed8,_0x2c017a){var _0x2eec68={},_0x41f69c={},_0x12bf31={'count':0x0,'rows':[]};var _0x5dc8ed=_[_0x5a97('0x25')](db[_0x5a97('0x26')][_0x5a97('0x27')],function(_0x165047){return{'name':_0x165047[_0x5a97('0x28')],'type':_0x165047[_0x5a97('0x29')]['key']};});_0x41f69c['model']=_['map'](_0x5dc8ed,_0x5a97('0x22'));_0x41f69c['query']=_[_0x5a97('0x2a')](_0x3bbed8[_0x5a97('0x2b')]);_0x41f69c['filters']=_['intersection'](_0x41f69c[_0x5a97('0x2c')],_0x41f69c[_0x5a97('0x2b')]);_0x2eec68['attributes']=_[_0x5a97('0x2d')](_0x41f69c[_0x5a97('0x2c')],qs['fields'](_0x3bbed8[_0x5a97('0x2b')][_0x5a97('0x2e')]));_0x2eec68['attributes']=_0x2eec68[_0x5a97('0x2f')]['length']?_0x2eec68['attributes']:_0x41f69c[_0x5a97('0x2c')];if(!_0x3bbed8['query'][_0x5a97('0x30')](_0x5a97('0x31'))){_0x2eec68[_0x5a97('0x18')]=qs[_0x5a97('0x18')](_0x3bbed8[_0x5a97('0x2b')]['limit']);_0x2eec68[_0x5a97('0x15')]=qs[_0x5a97('0x15')](_0x3bbed8['query'][_0x5a97('0x15')]);}_0x2eec68[_0x5a97('0x32')]=qs[_0x5a97('0x33')](_0x3bbed8[_0x5a97('0x2b')][_0x5a97('0x33')]);_0x2eec68[_0x5a97('0x34')]=qs['filters'](_[_0x5a97('0x35')](_0x3bbed8[_0x5a97('0x2b')],_0x41f69c[_0x5a97('0x36')]),_0x5dc8ed);if(_0x3bbed8[_0x5a97('0x2b')][_0x5a97('0x37')]){_0x2eec68[_0x5a97('0x34')]=_[_0x5a97('0x38')](_0x2eec68[_0x5a97('0x34')],{'$or':_[_0x5a97('0x25')](_0x5dc8ed,function(_0x16c729){if(_0x16c729[_0x5a97('0x29')]!==_0x5a97('0x39')){var _0x2225c1={};_0x2225c1[_0x16c729[_0x5a97('0x22')]]={'$like':'%'+_0x3bbed8['query']['filter']+'%'};return _0x2225c1;}})});}_0x2eec68=_[_0x5a97('0x38')]({},_0x2eec68,_0x3bbed8[_0x5a97('0x3a')]);var _0xedf9e0={'where':_0x2eec68[_0x5a97('0x34')]};return db[_0x5a97('0x26')]['count'](_0xedf9e0)[_0x5a97('0x1e')](function(_0x20b3f4){_0x12bf31[_0x5a97('0x17')]=_0x20b3f4;if(_0x3bbed8[_0x5a97('0x2b')][_0x5a97('0x3b')]){_0x2eec68[_0x5a97('0x3c')]=[{'all':!![]}];}return db[_0x5a97('0x26')]['findAll'](_0x2eec68);})[_0x5a97('0x1e')](function(_0x5a5b8b){_0x12bf31[_0x5a97('0x3d')]=_0x5a5b8b;return _0x12bf31;})[_0x5a97('0x1e')](respondWithFilteredResult(_0x2c017a,_0x2eec68))[_0x5a97('0x3e')](handleError(_0x2c017a,null));};exports[_0x5a97('0x3f')]=function(_0x431308,_0x3b0bbd){var _0x2248a8={'raw':!![],'where':{'id':_0x431308[_0x5a97('0x40')]['id']}},_0x58244a={};_0x58244a[_0x5a97('0x2c')]=_['keys'](db['MailTransferReport']['rawAttributes']);_0x58244a['query']=_[_0x5a97('0x2a')](_0x431308[_0x5a97('0x2b')]);_0x58244a[_0x5a97('0x36')]=_[_0x5a97('0x2d')](_0x58244a['model'],_0x58244a[_0x5a97('0x2b')]);_0x2248a8['attributes']=_[_0x5a97('0x2d')](_0x58244a['model'],qs[_0x5a97('0x2e')](_0x431308[_0x5a97('0x2b')][_0x5a97('0x2e')]));_0x2248a8[_0x5a97('0x2f')]=_0x2248a8[_0x5a97('0x2f')]['length']?_0x2248a8['attributes']:_0x58244a[_0x5a97('0x2c')];if(_0x431308['query'][_0x5a97('0x3b')]){_0x2248a8[_0x5a97('0x3c')]=[{'all':!![]}];}_0x2248a8=_[_0x5a97('0x38')]({},_0x2248a8,_0x431308['options']);return db[_0x5a97('0x26')]['find'](_0x2248a8)[_0x5a97('0x1e')](handleEntityNotFound(_0x3b0bbd,null))['then'](respondWithResult(_0x3b0bbd,null))['catch'](handleError(_0x3b0bbd,null));};exports[_0x5a97('0x41')]=function(_0x1c12a9,_0xb710be){return db['MailTransferReport'][_0x5a97('0x41')](_0x1c12a9[_0x5a97('0x42')],{})[_0x5a97('0x1e')](respondWithResult(_0xb710be,0xc9))[_0x5a97('0x3e')](handleError(_0xb710be,null));};exports[_0x5a97('0x1d')]=function(_0x31fe41,_0x2c909e){if(_0x31fe41['body']['id']){delete _0x31fe41['body']['id'];}return db['MailTransferReport'][_0x5a97('0x43')]({'where':{'id':_0x31fe41[_0x5a97('0x40')]['id']}})[_0x5a97('0x1e')](handleEntityNotFound(_0x2c909e,null))[_0x5a97('0x1e')](saveUpdates(_0x31fe41[_0x5a97('0x42')],null))[_0x5a97('0x1e')](respondWithResult(_0x2c909e,null))[_0x5a97('0x3e')](handleError(_0x2c909e,null));};exports['destroy']=function(_0x1aaf16,_0x227d44){return db[_0x5a97('0x26')]['find']({'where':{'id':_0x1aaf16[_0x5a97('0x40')]['id']}})[_0x5a97('0x1e')](handleEntityNotFound(_0x227d44,null))[_0x5a97('0x1e')](removeEntity(_0x227d44,null))[_0x5a97('0x3e')](handleError(_0x227d44,null));};exports[_0x5a97('0x44')]=function(_0x378f67,_0x754c5e){return db['MailTransferReport'][_0x5a97('0x44')]()[_0x5a97('0x1e')](respondWithResult(_0x754c5e,null))[_0x5a97('0x3e')](handleError(_0x754c5e,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 9219dae..3d10f14 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 _0xf88f=['bluebird','request-promise','rimraf','../../config/environment','./mailTransferReport.attributes','define','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x153d1f,_0x519903){var _0x1a64a0=function(_0xc3aba9){while(--_0xc3aba9){_0x153d1f['push'](_0x153d1f['shift']());}};_0x1a64a0(++_0x519903);}(_0xf88f,0x1bb));var _0xff88=function(_0x5d82dd,_0x3f69d8){_0x5d82dd=_0x5d82dd-0x0;var _0x5ab3eb=_0xf88f[_0x5d82dd];return _0x5ab3eb;};'use strict';var _=require(_0xff88('0x0'));var util=require(_0xff88('0x1'));var logger=require(_0xff88('0x2'))(_0xff88('0x3'));var moment=require(_0xff88('0x4'));var BPromise=require(_0xff88('0x5'));var rp=require(_0xff88('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xff88('0x7'));var config=require(_0xff88('0x8'));var attributes=require(_0xff88('0x9'));module['exports']=function(_0x38e1df,_0x406a2e){return _0x38e1df[_0xff88('0xa')](_0xff88('0xb'),attributes,{'tableName':_0xff88('0xc'),'paranoid':![],'indexes':[{'name':_0xff88('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x97ed=['bluebird','path','rimraf','../../config/environment','./mailTransferReport.attributes','MailTransferReport','uniqueid','lodash','util','moment'];(function(_0x5194a1,_0x5c8886){var _0x3121ae=function(_0x43da9c){while(--_0x43da9c){_0x5194a1['push'](_0x5194a1['shift']());}};_0x3121ae(++_0x5c8886);}(_0x97ed,0x1e7));var _0xd97e=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x97ed[_0x565c49];return _0x20ca34;};'use strict';var _=require(_0xd97e('0x0'));var util=require(_0xd97e('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xd97e('0x2'));var BPromise=require(_0xd97e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd97e('0x4'));var rimraf=require(_0xd97e('0x5'));var config=require(_0xd97e('0x6'));var attributes=require(_0xd97e('0x7'));module['exports']=function(_0x2468bc,_0x538bdd){return _0x2468bc['define'](_0xd97e('0x8'),attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xd97e('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 472b7ed..9754eaf 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 _0xbb5c=['client','request','then','info','request\x20sent','stringify','error','code','MailTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','jayson/promise'];(function(_0xffeba7,_0xf84f44){var _0x5c0d88=function(_0x111866){while(--_0x111866){_0xffeba7['push'](_0xffeba7['shift']());}};_0x5c0d88(++_0xf84f44);}(_0xbb5c,0x1d8));var _0xcbb5=function(_0xa04c8a,_0x411ee9){_0xa04c8a=_0xa04c8a-0x0;var _0x484869=_0xbb5c[_0xa04c8a];return _0x484869;};'use strict';var _=require(_0xcbb5('0x0'));var util=require(_0xcbb5('0x1'));var moment=require(_0xcbb5('0x2'));var BPromise=require(_0xcbb5('0x3'));var rs=require(_0xcbb5('0x4'));var fs=require('fs');var Redis=require(_0xcbb5('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xcbb5('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xcbb5('0x7'));var client=jayson[_0xcbb5('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xea28d1,_0xadd4a3,_0x2f7ce0){return new BPromise(function(_0x3d8555,_0x33f85b){return client[_0xcbb5('0x9')](_0xea28d1,_0x2f7ce0)[_0xcbb5('0xa')](function(_0x3b23d2){logger[_0xcbb5('0xb')]('MailTransferReport,\x20%s,\x20%s',_0xadd4a3,_0xcbb5('0xc'));logger['debug']('MailTransferReport,\x20%s,\x20%s,\x20%s',_0xadd4a3,_0xcbb5('0xc'),JSON[_0xcbb5('0xd')](_0x3b23d2));if(_0x3b23d2[_0xcbb5('0xe')]){if(_0x3b23d2['error'][_0xcbb5('0xf')]===0x1f4){logger[_0xcbb5('0xe')](_0xcbb5('0x10'),_0xadd4a3,_0x3b23d2[_0xcbb5('0xe')][_0xcbb5('0x11')]);return _0x33f85b(_0x3b23d2[_0xcbb5('0xe')][_0xcbb5('0x11')]);}logger[_0xcbb5('0xe')](_0xcbb5('0x10'),_0xadd4a3,_0x3b23d2['error'][_0xcbb5('0x11')]);return _0x3d8555(_0x3b23d2[_0xcbb5('0xe')]['message']);}else{logger[_0xcbb5('0xb')](_0xcbb5('0x10'),_0xadd4a3,_0xcbb5('0xc'));_0x3d8555(_0x3b23d2[_0xcbb5('0x12')][_0xcbb5('0x11')]);}})[_0xcbb5('0x13')](function(_0x18e486){logger[_0xcbb5('0xe')]('MailTransferReport,\x20%s,\x20%s',_0xadd4a3,_0x18e486);_0x33f85b(_0x18e486);});});} \ No newline at end of file +var _0x9c2b=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch'];(function(_0x673722,_0x275d7e){var _0x21249c=function(_0x25b4e7){while(--_0x25b4e7){_0x673722['push'](_0x673722['shift']());}};_0x21249c(++_0x275d7e);}(_0x9c2b,0x9a));var _0xb9c2=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0x9c2b[_0x1203f];return _0x365f0a;};'use strict';var _=require(_0xb9c2('0x0'));var util=require(_0xb9c2('0x1'));var moment=require(_0xb9c2('0x2'));var BPromise=require('bluebird');var rs=require(_0xb9c2('0x3'));var fs=require('fs');var Redis=require(_0xb9c2('0x4'));var db=require(_0xb9c2('0x5'))['db'];var utils=require(_0xb9c2('0x6'));var logger=require(_0xb9c2('0x7'))(_0xb9c2('0x8'));var config=require(_0xb9c2('0x9'));var jayson=require(_0xb9c2('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4b72d8,_0x4dfaf6,_0xe7454d){return new BPromise(function(_0x2f1bcd,_0x4915c1){return client[_0xb9c2('0xb')](_0x4b72d8,_0xe7454d)[_0xb9c2('0xc')](function(_0x394829){logger[_0xb9c2('0xd')](_0xb9c2('0xe'),_0x4dfaf6,_0xb9c2('0xf'));logger[_0xb9c2('0x10')]('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x4dfaf6,_0xb9c2('0xf'),JSON[_0xb9c2('0x11')](_0x394829));if(_0x394829['error']){if(_0x394829[_0xb9c2('0x12')]['code']===0x1f4){logger[_0xb9c2('0x12')](_0xb9c2('0xe'),_0x4dfaf6,_0x394829[_0xb9c2('0x12')][_0xb9c2('0x13')]);return _0x4915c1(_0x394829['error'][_0xb9c2('0x13')]);}logger[_0xb9c2('0x12')]('MailTransferReport,\x20%s,\x20%s',_0x4dfaf6,_0x394829['error'][_0xb9c2('0x13')]);return _0x2f1bcd(_0x394829[_0xb9c2('0x12')]['message']);}else{logger[_0xb9c2('0xd')](_0xb9c2('0xe'),_0x4dfaf6,'request\x20sent');_0x2f1bcd(_0x394829[_0xb9c2('0x14')][_0xb9c2('0x13')]);}})[_0xb9c2('0x15')](function(_0x4a7d91){logger[_0xb9c2('0x12')](_0xb9c2('0xe'),_0x4dfaf6,_0x4a7d91);_0x4915c1(_0x4a7d91);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 946c385..4860361 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 _0xec8a=['../../config/environment','./memberReport.controller','get','isAuthenticated','index','/describe','/:id','post','create','put','update','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x849a23,_0x34bc53){var _0x3c5a3e=function(_0x326d13){while(--_0x326d13){_0x849a23['push'](_0x849a23['shift']());}};_0x3c5a3e(++_0x34bc53);}(_0xec8a,0x13c));var _0xaec8=function(_0x1e9714,_0x133133){_0x1e9714=_0x1e9714-0x0;var _0x34f945=_0xec8a[_0x1e9714];return _0x34f945;};'use strict';var multer=require(_0xaec8('0x0'));var util=require('util');var path=require(_0xaec8('0x1'));var timeout=require(_0xaec8('0x2'));var express=require(_0xaec8('0x3'));var router=express[_0xaec8('0x4')]();var fs_extra=require(_0xaec8('0x5'));var auth=require(_0xaec8('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xaec8('0x7'));var controller=require(_0xaec8('0x8'));router[_0xaec8('0x9')]('/',auth[_0xaec8('0xa')](),controller[_0xaec8('0xb')]);router[_0xaec8('0x9')](_0xaec8('0xc'),auth[_0xaec8('0xa')](),controller['describe']);router['get'](_0xaec8('0xd'),auth[_0xaec8('0xa')](),controller['show']);router[_0xaec8('0xe')]('/',auth[_0xaec8('0xa')](),controller[_0xaec8('0xf')]);router[_0xaec8('0x10')](_0xaec8('0xd'),auth['isAuthenticated'](),controller[_0xaec8('0x11')]);router['delete'](_0xaec8('0xd'),auth['isAuthenticated'](),controller[_0xaec8('0x12')]);module['exports']=router; \ No newline at end of file +var _0x5847=['put','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./memberReport.controller','isAuthenticated','get','/describe','describe','/:id','show','post'];(function(_0x382987,_0x58058b){var _0x29eb57=function(_0x646f43){while(--_0x646f43){_0x382987['push'](_0x382987['shift']());}};_0x29eb57(++_0x58058b);}(_0x5847,0x91));var _0x7584=function(_0x19ddca,_0x4af093){_0x19ddca=_0x19ddca-0x0;var _0x5d052d=_0x5847[_0x19ddca];return _0x5d052d;};'use strict';var multer=require(_0x7584('0x0'));var util=require(_0x7584('0x1'));var path=require('path');var timeout=require(_0x7584('0x2'));var express=require(_0x7584('0x3'));var router=express['Router']();var fs_extra=require(_0x7584('0x4'));var auth=require(_0x7584('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7584('0x6'));var controller=require(_0x7584('0x7'));router['get']('/',auth[_0x7584('0x8')](),controller['index']);router[_0x7584('0x9')](_0x7584('0xa'),auth[_0x7584('0x8')](),controller[_0x7584('0xb')]);router[_0x7584('0x9')](_0x7584('0xc'),auth['isAuthenticated'](),controller[_0x7584('0xd')]);router[_0x7584('0xe')]('/',auth[_0x7584('0x8')](),controller['create']);router[_0x7584('0xf')](_0x7584('0xc'),auth[_0x7584('0x8')](),controller[_0x7584('0x10')]);router[_0x7584('0x11')]('/:id',auth[_0x7584('0x8')](),controller[_0x7584('0x12')]);module[_0x7584('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 c538d08..76b9355 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 _0x3c29=['duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[queue]','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','DATE','getDataValue','enterAt','diff','setDataValue','exitAt'];(function(_0x28f449,_0x204667){var _0x4edb64=function(_0x4300ca){while(--_0x4300ca){_0x28f449['push'](_0x28f449['shift']());}};_0x4edb64(++_0x204667);}(_0x3c29,0x113));var _0x93c2=function(_0x2e0f26,_0x3697e1){_0x2e0f26=_0x2e0f26-0x0;var _0x2475ed=_0x3c29[_0x2e0f26];return _0x2475ed;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x93c2('0x0')]={'channel':{'type':Sequelize[_0x93c2('0x1')]},'membername':{'type':Sequelize[_0x93c2('0x1')]},'interface':{'type':Sequelize[_0x93c2('0x1')]},'type':{'type':Sequelize[_0x93c2('0x1')],'defaultValue':_0x93c2('0x2'),'comment':_0x93c2('0x3')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0x93c2('0x4')]},'exitAt':{'type':Sequelize[_0x93c2('0x4')],'set':function(_0x2823ce){var _0x2ae53d=moment(_0x2823ce);var _0x1d5495=moment(this[_0x93c2('0x5')](_0x93c2('0x6')));var _0x12fd20=_0x2ae53d[_0x93c2('0x7')](_0x1d5495,'seconds');this[_0x93c2('0x8')](_0x93c2('0x9'),_0x2823ce);this['setDataValue'](_0x93c2('0xa'),_0x12fd20>=0x0?_0x12fd20:null);}},'data1':{'type':Sequelize[_0x93c2('0x1')],'comment':_0x93c2('0xb')},'data2':{'type':Sequelize[_0x93c2('0x1')],'comment':_0x93c2('0xc')},'data3':{'type':Sequelize[_0x93c2('0x1')],'comment':_0x93c2('0xd')},'data4':{'type':Sequelize[_0x93c2('0x1')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0x93c2('0x1')],'comment':_0x93c2('0xe')},'role':{'type':Sequelize[_0x93c2('0x1')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x93c2('0x1')]}}; \ No newline at end of file +var _0x19ab=['sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','DATE','getDataValue','enterAt','diff','seconds','exitAt','setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','INTEGER'];(function(_0x132293,_0x259f25){var _0x31a4a2=function(_0x221339){while(--_0x221339){_0x132293['push'](_0x132293['shift']());}};_0x31a4a2(++_0x259f25);}(_0x19ab,0x1a2));var _0xb19a=function(_0x4ccfd7,_0x5a625a){_0x4ccfd7=_0x4ccfd7-0x0;var _0x542fa9=_0x19ab[_0x4ccfd7];return _0x542fa9;};'use strict';var Sequelize=require(_0xb19a('0x0'));var moment=require(_0xb19a('0x1'));module[_0xb19a('0x2')]={'channel':{'type':Sequelize[_0xb19a('0x3')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xb19a('0x3')]},'type':{'type':Sequelize[_0xb19a('0x3')],'defaultValue':_0xb19a('0x4'),'comment':_0xb19a('0x5')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0xb19a('0x6')]},'exitAt':{'type':Sequelize[_0xb19a('0x6')],'set':function(_0x41a467){var _0x40ac54=moment(_0x41a467);var _0x3a6881=moment(this[_0xb19a('0x7')](_0xb19a('0x8')));var _0x52c15d=_0x40ac54[_0xb19a('0x9')](_0x3a6881,_0xb19a('0xa'));this['setDataValue'](_0xb19a('0xb'),_0x41a467);this[_0xb19a('0xc')](_0xb19a('0xd'),_0x52c15d>=0x0?_0x52c15d:null);}},'data1':{'type':Sequelize[_0xb19a('0x3')],'comment':_0xb19a('0xe')},'data2':{'type':Sequelize[_0xb19a('0x3')],'comment':_0xb19a('0xf')},'data3':{'type':Sequelize[_0xb19a('0x3')],'comment':_0xb19a('0x10')},'data4':{'type':Sequelize[_0xb19a('0x3')],'comment':_0xb19a('0x11')},'data5':{'type':Sequelize[_0xb19a('0x3')],'comment':'talk:[queue]'},'role':{'type':Sequelize[_0xb19a('0x3')]},'internal':{'type':Sequelize[_0xb19a('0x12')]},'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 42b2861..b75f8a5 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(_0x245afe,_0x319cde){var _0x4eefde=function(_0x15a1fa){while(--_0x15a1fa){_0x245afe['push'](_0x245afe['shift']());}};_0x4eefde(++_0x319cde);}(_0x34e8,0x12c));var _0x834e=function(_0xbfd792,_0x43228a){_0xbfd792=_0xbfd792-0x0;var _0x3c2d8f=_0x34e8[_0xbfd792];return _0x3c2d8f;};'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 _0xedd9=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','find','create','body','update','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','then','end','error','stack','send','index','map','MemberReport','rawAttributes','fieldName','type','key','model','name','query'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0xedd9,0xfc));var _0x9edd=function(_0x152bf1,_0x21aef3){_0x152bf1=_0x152bf1-0x0;var _0x33d955=_0xedd9[_0x152bf1];return _0x33d955;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9edd('0x0'));var zipdir=require(_0x9edd('0x1'));var jsonpatch=require(_0x9edd('0x2'));var rp=require(_0x9edd('0x3'));var moment=require(_0x9edd('0x4'));var BPromise=require(_0x9edd('0x5'));var Mustache=require(_0x9edd('0x6'));var util=require(_0x9edd('0x7'));var path=require('path');var sox=require(_0x9edd('0x8'));var csv=require(_0x9edd('0x9'));var ejs=require(_0x9edd('0xa'));var fs=require('fs');var fs_extra=require(_0x9edd('0xb'));var _=require('lodash');var squel=require(_0x9edd('0xc'));var crypto=require('crypto');var jsforce=require(_0x9edd('0xd'));var deskjs=require(_0x9edd('0xe'));var toCsv=require(_0x9edd('0x9'));var querystring=require(_0x9edd('0xf'));var Papa=require('papaparse');var Redis=require(_0x9edd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9edd('0x11'));var as=require(_0x9edd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9edd('0x13'))(_0x9edd('0x14'));var utils=require('../../config/utils');var config=require(_0x9edd('0x15'));var licenseUtil=require(_0x9edd('0x16'));var db=require(_0x9edd('0x17'))['db'];function respondWithStatusCode(_0xfd544a,_0x287ddd){_0x287ddd=_0x287ddd||0xcc;return function(_0x3a7b84){if(_0x3a7b84){return _0xfd544a[_0x9edd('0x18')](_0x287ddd);}return _0xfd544a[_0x9edd('0x19')](_0x287ddd)['end']();};}function respondWithResult(_0x176bfa,_0x44fc7c){_0x44fc7c=_0x44fc7c||0xc8;return function(_0x891832){if(_0x891832){return _0x176bfa[_0x9edd('0x19')](_0x44fc7c)[_0x9edd('0x1a')](_0x891832);}};}function respondWithFilteredResult(_0x338f3c,_0x1042aa){return function(_0x75a4ab){if(_0x75a4ab){var _0x4ea60f=typeof _0x1042aa[_0x9edd('0x1b')]===_0x9edd('0x1c')&&typeof _0x1042aa[_0x9edd('0x1d')]==='undefined';var _0x1b54c0=_0x75a4ab[_0x9edd('0x1e')];var _0x40ba32=_0x4ea60f?0x0:_0x1042aa['offset'];var _0x43dc70=_0x4ea60f?_0x75a4ab['count']:_0x1042aa[_0x9edd('0x1b')]+_0x1042aa[_0x9edd('0x1d')];var _0x4bdb88;if(_0x43dc70>=_0x1b54c0){_0x43dc70=_0x1b54c0;_0x4bdb88=0xc8;}else{_0x4bdb88=0xce;}_0x338f3c['status'](_0x4bdb88);return _0x338f3c[_0x9edd('0x1f')]('Content-Range',_0x40ba32+'-'+_0x43dc70+'/'+_0x1b54c0)[_0x9edd('0x1a')](_0x75a4ab);}return null;};}function patchUpdates(_0x54a03f){return function(_0x535f37){try{jsonpatch[_0x9edd('0x20')](_0x535f37,_0x54a03f,!![]);}catch(_0x1c46a8){return BPromise['reject'](_0x1c46a8);}return _0x535f37['save']();};}function saveUpdates(_0x341d67,_0x186186){return function(_0x477878){if(_0x477878){return _0x477878['update'](_0x341d67)[_0x9edd('0x21')](function(_0x1dca43){return _0x1dca43;});}return null;};}function removeEntity(_0x44a6c1,_0x2ca65f){return function(_0x339a0d){if(_0x339a0d){return _0x339a0d['destroy']()[_0x9edd('0x21')](function(){_0x44a6c1[_0x9edd('0x19')](0xcc)[_0x9edd('0x22')]();});}};}function handleEntityNotFound(_0x2f9f86,_0x310a4d){return function(_0x4d507f){if(!_0x4d507f){_0x2f9f86['sendStatus'](0x194);}return _0x4d507f;};}function handleError(_0x3276ee,_0xfeca7b){_0xfeca7b=_0xfeca7b||0x1f4;return function(_0x8d67aa){logger[_0x9edd('0x23')](_0x8d67aa[_0x9edd('0x24')]);if(_0x8d67aa['name']){delete _0x8d67aa['name'];}_0x3276ee[_0x9edd('0x19')](_0xfeca7b)[_0x9edd('0x25')](_0x8d67aa);};}exports[_0x9edd('0x26')]=function(_0x52746a,_0x238b22){var _0x28cfae={},_0x2ae8dd={},_0x41af53={'count':0x0,'rows':[]};var _0x5eccfb=_[_0x9edd('0x27')](db[_0x9edd('0x28')][_0x9edd('0x29')],function(_0x12c1bc){return{'name':_0x12c1bc[_0x9edd('0x2a')],'type':_0x12c1bc[_0x9edd('0x2b')][_0x9edd('0x2c')]};});_0x2ae8dd[_0x9edd('0x2d')]=_[_0x9edd('0x27')](_0x5eccfb,_0x9edd('0x2e'));_0x2ae8dd[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x52746a[_0x9edd('0x2f')]);_0x2ae8dd[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x2ae8dd['model'],_0x2ae8dd[_0x9edd('0x2f')]);_0x28cfae[_0x9edd('0x33')]=_[_0x9edd('0x32')](_0x2ae8dd['model'],qs[_0x9edd('0x34')](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x34')]));_0x28cfae[_0x9edd('0x33')]=_0x28cfae[_0x9edd('0x33')][_0x9edd('0x35')]?_0x28cfae[_0x9edd('0x33')]:_0x2ae8dd[_0x9edd('0x2d')];if(!_0x52746a[_0x9edd('0x2f')][_0x9edd('0x36')](_0x9edd('0x37'))){_0x28cfae[_0x9edd('0x1d')]=qs[_0x9edd('0x1d')](_0x52746a[_0x9edd('0x2f')]['limit']);_0x28cfae[_0x9edd('0x1b')]=qs['offset'](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x1b')]);}_0x28cfae[_0x9edd('0x38')]=qs[_0x9edd('0x39')](_0x52746a[_0x9edd('0x2f')]['sort']);_0x28cfae[_0x9edd('0x3a')]=qs[_0x9edd('0x31')](_[_0x9edd('0x3b')](_0x52746a[_0x9edd('0x2f')],_0x2ae8dd[_0x9edd('0x31')]),_0x5eccfb);if(_0x52746a[_0x9edd('0x2f')][_0x9edd('0x3c')]){_0x28cfae[_0x9edd('0x3a')]=_[_0x9edd('0x3d')](_0x28cfae[_0x9edd('0x3a')],{'$or':_['map'](_0x5eccfb,function(_0x231604){if(_0x231604['type']!==_0x9edd('0x3e')){var _0x5658d6={};_0x5658d6[_0x231604[_0x9edd('0x2e')]]={'$like':'%'+_0x52746a[_0x9edd('0x2f')][_0x9edd('0x3c')]+'%'};return _0x5658d6;}})});}_0x28cfae=_['merge']({},_0x28cfae,_0x52746a[_0x9edd('0x3f')]);var _0xcbd0ef={'where':_0x28cfae[_0x9edd('0x3a')]};return db['MemberReport'][_0x9edd('0x1e')](_0xcbd0ef)['then'](function(_0x1fc4fb){_0x41af53[_0x9edd('0x1e')]=_0x1fc4fb;if(_0x52746a['query'][_0x9edd('0x40')]){_0x28cfae[_0x9edd('0x41')]=[{'all':!![]}];}return db[_0x9edd('0x28')][_0x9edd('0x42')](_0x28cfae);})['then'](function(_0x449f01){_0x41af53['rows']=_0x449f01;return _0x41af53;})[_0x9edd('0x21')](respondWithFilteredResult(_0x238b22,_0x28cfae))[_0x9edd('0x43')](handleError(_0x238b22,null));};exports['show']=function(_0x318757,_0x49a128){var _0x548299={'raw':!![],'where':{'id':_0x318757[_0x9edd('0x44')]['id']}},_0x369b69={};_0x369b69[_0x9edd('0x2d')]=_[_0x9edd('0x30')](db[_0x9edd('0x28')][_0x9edd('0x29')]);_0x369b69[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x318757[_0x9edd('0x2f')]);_0x369b69[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x369b69[_0x9edd('0x2d')],_0x369b69[_0x9edd('0x2f')]);_0x548299[_0x9edd('0x33')]=_[_0x9edd('0x32')](_0x369b69['model'],qs[_0x9edd('0x34')](_0x318757[_0x9edd('0x2f')][_0x9edd('0x34')]));_0x548299[_0x9edd('0x33')]=_0x548299[_0x9edd('0x33')][_0x9edd('0x35')]?_0x548299[_0x9edd('0x33')]:_0x369b69['model'];if(_0x318757['query']['includeAll']){_0x548299[_0x9edd('0x41')]=[{'all':!![]}];}_0x548299=_['merge']({},_0x548299,_0x318757[_0x9edd('0x3f')]);return db[_0x9edd('0x28')][_0x9edd('0x45')](_0x548299)[_0x9edd('0x21')](handleEntityNotFound(_0x49a128,null))[_0x9edd('0x21')](respondWithResult(_0x49a128,null))['catch'](handleError(_0x49a128,null));};exports[_0x9edd('0x46')]=function(_0x35e63c,_0x40e33d){return db['MemberReport'][_0x9edd('0x46')](_0x35e63c[_0x9edd('0x47')],{})[_0x9edd('0x21')](respondWithResult(_0x40e33d,0xc9))[_0x9edd('0x43')](handleError(_0x40e33d,null));};exports[_0x9edd('0x48')]=function(_0x35bdec,_0x4d4f33){if(_0x35bdec[_0x9edd('0x47')]['id']){delete _0x35bdec[_0x9edd('0x47')]['id'];}return db['MemberReport'][_0x9edd('0x45')]({'where':{'id':_0x35bdec[_0x9edd('0x44')]['id']}})['then'](handleEntityNotFound(_0x4d4f33,null))[_0x9edd('0x21')](saveUpdates(_0x35bdec[_0x9edd('0x47')],null))[_0x9edd('0x21')](respondWithResult(_0x4d4f33,null))['catch'](handleError(_0x4d4f33,null));};exports[_0x9edd('0x49')]=function(_0x151157,_0x317a60){return db[_0x9edd('0x28')]['find']({'where':{'id':_0x151157[_0x9edd('0x44')]['id']}})[_0x9edd('0x21')](handleEntityNotFound(_0x317a60,null))[_0x9edd('0x21')](removeEntity(_0x317a60,null))['catch'](handleError(_0x317a60,null));};exports[_0x9edd('0x4a')]=function(_0x21f6ce,_0x57db43){return db[_0x9edd('0x28')]['describe']()[_0x9edd('0x21')](respondWithResult(_0x57db43,null))[_0x9edd('0x43')](handleError(_0x57db43,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 0f392b5..f643a0b 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 _0x119f=['exports','MemberReport','report_member','membername_interface','interface','lodash','util','../../config/logger','api','moment','request-promise','../../config/environment'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x119f,0xf5));var _0xf119=function(_0x17f396,_0x3f829d){_0x17f396=_0x17f396-0x0;var _0x1f9ab8=_0x119f[_0x17f396];return _0x1f9ab8;};'use strict';var _=require(_0xf119('0x0'));var util=require(_0xf119('0x1'));var logger=require(_0xf119('0x2'))(_0xf119('0x3'));var moment=require(_0xf119('0x4'));var BPromise=require('bluebird');var rp=require(_0xf119('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf119('0x6'));var attributes=require('./memberReport.attributes');module[_0xf119('0x7')]=function(_0x5b343b,_0x3b1696){return _0x5b343b['define'](_0xf119('0x8'),attributes,{'tableName':_0xf119('0x9'),'paranoid':![],'indexes':[{'name':_0xf119('0xa'),'fields':['membername',_0xf119('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xaff5=['../../config/environment','./memberReport.attributes','exports','define','MemberReport','membername_interface','membername','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x195e97,_0x344631){var _0x2673ea=function(_0x5bc479){while(--_0x5bc479){_0x195e97['push'](_0x195e97['shift']());}};_0x2673ea(++_0x344631);}(_0xaff5,0x1b9));var _0x5aff=function(_0x1f235a,_0x4e3bda){_0x1f235a=_0x1f235a-0x0;var _0x3d2fac=_0xaff5[_0x1f235a];return _0x3d2fac;};'use strict';var _=require(_0x5aff('0x0'));var util=require('util');var logger=require(_0x5aff('0x1'))(_0x5aff('0x2'));var moment=require('moment');var BPromise=require(_0x5aff('0x3'));var rp=require(_0x5aff('0x4'));var fs=require('fs');var path=require(_0x5aff('0x5'));var rimraf=require(_0x5aff('0x6'));var config=require(_0x5aff('0x7'));var attributes=require(_0x5aff('0x8'));module[_0x5aff('0x9')]=function(_0x375e11,_0x33611f){return _0x375e11[_0x5aff('0xa')](_0x5aff('0xb'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0x5aff('0xc'),'fields':[_0x5aff('0xd'),'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 e0a7f7b..de7c607 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 _0x6132=['message','info','result','catch','GetMemberReport','MemberReport','findAll','options','raw','limit','include','model','attributes','map','CreateMemberReport','body','UpdateMemberReport','where','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x7b3ab7,_0x4856d9){var _0x3a0438=function(_0x224c5){while(--_0x224c5){_0x7b3ab7['push'](_0x7b3ab7['shift']());}};_0x3a0438(++_0x4856d9);}(_0x6132,0x13a));var _0x2613=function(_0x5d97fc,_0x3373cd){_0x5d97fc=_0x5d97fc-0x0;var _0x428863=_0x6132[_0x5d97fc];return _0x428863;};'use strict';var _=require(_0x2613('0x0'));var util=require(_0x2613('0x1'));var moment=require(_0x2613('0x2'));var BPromise=require(_0x2613('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2613('0x4'));var db=require(_0x2613('0x5'))['db'];var utils=require(_0x2613('0x6'));var logger=require(_0x2613('0x7'))('rpc');var config=require(_0x2613('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2613('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x309663,_0x369931,_0x465a32){return new BPromise(function(_0xe295ea,_0x4b6a40){return client[_0x2613('0xa')](_0x309663,_0x465a32)[_0x2613('0xb')](function(_0x196831){logger['info'](_0x2613('0xc'),_0x369931,_0x2613('0xd'));logger[_0x2613('0xe')](_0x2613('0xf'),_0x369931,_0x2613('0xd'),JSON[_0x2613('0x10')](_0x196831));if(_0x196831[_0x2613('0x11')]){if(_0x196831[_0x2613('0x11')][_0x2613('0x12')]===0x1f4){logger[_0x2613('0x11')]('MemberReport,\x20%s,\x20%s',_0x369931,_0x196831[_0x2613('0x11')][_0x2613('0x13')]);return _0x4b6a40(_0x196831[_0x2613('0x11')][_0x2613('0x13')]);}logger['error'](_0x2613('0xc'),_0x369931,_0x196831[_0x2613('0x11')][_0x2613('0x13')]);return _0xe295ea(_0x196831[_0x2613('0x11')]['message']);}else{logger[_0x2613('0x14')](_0x2613('0xc'),_0x369931,_0x2613('0xd'));_0xe295ea(_0x196831[_0x2613('0x15')]['message']);}})[_0x2613('0x16')](function(_0x13cdee){logger['error'](_0x2613('0xc'),_0x369931,_0x13cdee);_0x4b6a40(_0x13cdee);});});}exports[_0x2613('0x17')]=function(_0x207553){var _0x247e4c=this;return new Promise(function(_0x2954f3,_0x546c85){return db[_0x2613('0x18')][_0x2613('0x19')]({'raw':_0x207553['options']?_0x207553[_0x2613('0x1a')][_0x2613('0x1b')]===undefined?!![]:![]:!![],'where':_0x207553[_0x2613('0x1a')]?_0x207553[_0x2613('0x1a')]['where']||null:null,'attributes':_0x207553[_0x2613('0x1a')]?_0x207553['options']['attributes']||null:null,'limit':_0x207553[_0x2613('0x1a')]?_0x207553['options'][_0x2613('0x1c')]||null:null,'include':_0x207553[_0x2613('0x1a')]?_0x207553[_0x2613('0x1a')]['include']?_['map'](_0x207553[_0x2613('0x1a')][_0x2613('0x1d')],function(_0x4ecaae){return{'model':db[_0x4ecaae[_0x2613('0x1e')]],'as':_0x4ecaae['as'],'attributes':_0x4ecaae[_0x2613('0x1f')],'include':_0x4ecaae[_0x2613('0x1d')]?_[_0x2613('0x20')](_0x4ecaae[_0x2613('0x1d')],function(_0x115f6f){return{'model':db[_0x115f6f[_0x2613('0x1e')]],'as':_0x115f6f['as'],'attributes':_0x115f6f[_0x2613('0x1f')],'include':_0x115f6f['include']?_[_0x2613('0x20')](_0x115f6f[_0x2613('0x1d')],function(_0x19fb11){return{'model':db[_0x19fb11[_0x2613('0x1e')]],'as':_0x19fb11['as'],'attributes':_0x19fb11[_0x2613('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x2613('0xb')](function(_0x15ee46){logger[_0x2613('0x14')](_0x2613('0x17'),_0x207553);logger['debug'](_0x2613('0x17'),_0x207553,JSON[_0x2613('0x10')](_0x15ee46));_0x2954f3(_0x15ee46);})[_0x2613('0x16')](function(_0x3110d3){logger[_0x2613('0x11')](_0x2613('0x17'),_0x3110d3[_0x2613('0x13')],_0x207553);_0x546c85(_0x247e4c[_0x2613('0x11')](0x1f4,_0x3110d3['message']));});});};exports[_0x2613('0x21')]=function(_0x151415){var _0x328ac2=this;return new Promise(function(_0x471585,_0xd9c8c1){return db[_0x2613('0x18')]['create'](_0x151415[_0x2613('0x22')],{'raw':_0x151415['options']?_0x151415[_0x2613('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x2613('0xb')](function(_0x59369a){logger[_0x2613('0x14')](_0x2613('0x21'),_0x151415);logger[_0x2613('0xe')](_0x2613('0x21'),_0x151415,JSON[_0x2613('0x10')](_0x59369a));_0x471585(_0x59369a);})['catch'](function(_0x2eaf1d){logger[_0x2613('0x11')](_0x2613('0x21'),_0x2eaf1d['message'],_0x151415);_0xd9c8c1(_0x328ac2['error'](0x1f4,_0x2eaf1d[_0x2613('0x13')]));});});};exports[_0x2613('0x23')]=function(_0x145a46){var _0x328931=this;return new Promise(function(_0x2e9b07,_0x4745db){return db['MemberReport']['update'](_0x145a46[_0x2613('0x22')],{'raw':_0x145a46['options']?_0x145a46['options'][_0x2613('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x145a46[_0x2613('0x1a')]?_0x145a46['options'][_0x2613('0x24')]||null:null,'attributes':_0x145a46['options']?_0x145a46[_0x2613('0x1a')][_0x2613('0x1f')]||null:null,'limit':_0x145a46['options']?_0x145a46['options']['limit']||null:null})[_0x2613('0xb')](function(_0x3b8dd6){logger[_0x2613('0x14')]('UpdateMemberReport',_0x145a46);logger[_0x2613('0xe')](_0x2613('0x23'),_0x145a46,JSON[_0x2613('0x10')](_0x3b8dd6));_0x2e9b07(_0x3b8dd6);})[_0x2613('0x16')](function(_0x3b6636){logger['error']('UpdateMemberReport',_0x3b6636[_0x2613('0x13')],_0x145a46);_0x4745db(_0x328931[_0x2613('0x11')](0x1f4,_0x3b6636[_0x2613('0x13')]));});});}; \ No newline at end of file +var _0x3f8a=['client','http','request','then','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetMemberReport','findAll','options','raw','attributes','limit','include','model','map','CreateMemberReport','create','body','update','UpdateMemberReport','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x43d1c5,_0x138da9){var _0x15773b=function(_0xeb1687){while(--_0xeb1687){_0x43d1c5['push'](_0x43d1c5['shift']());}};_0x15773b(++_0x138da9);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x2be6a4,_0x39648b){_0x2be6a4=_0x2be6a4-0x0;var _0x7f64e=_0x3f8a[_0x2be6a4];return _0x7f64e;};'use strict';var _=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var moment=require(_0xa3f8('0x2'));var BPromise=require(_0xa3f8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa3f8('0x4'));var db=require(_0xa3f8('0x5'))['db'];var utils=require(_0xa3f8('0x6'));var logger=require(_0xa3f8('0x7'))(_0xa3f8('0x8'));var config=require(_0xa3f8('0x9'));var jayson=require(_0xa3f8('0xa'));var client=jayson[_0xa3f8('0xb')][_0xa3f8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xf895d9,_0xcfea5,_0x268332){return new BPromise(function(_0x2faf2e,_0x2448de){return client[_0xa3f8('0xd')](_0xf895d9,_0x268332)[_0xa3f8('0xe')](function(_0xcdb0d4){logger['info'](_0xa3f8('0xf'),_0xcfea5,_0xa3f8('0x10'));logger[_0xa3f8('0x11')](_0xa3f8('0x12'),_0xcfea5,'request\x20sent',JSON[_0xa3f8('0x13')](_0xcdb0d4));if(_0xcdb0d4[_0xa3f8('0x14')]){if(_0xcdb0d4[_0xa3f8('0x14')][_0xa3f8('0x15')]===0x1f4){logger[_0xa3f8('0x14')](_0xa3f8('0xf'),_0xcfea5,_0xcdb0d4[_0xa3f8('0x14')][_0xa3f8('0x16')]);return _0x2448de(_0xcdb0d4[_0xa3f8('0x14')][_0xa3f8('0x16')]);}logger[_0xa3f8('0x14')](_0xa3f8('0xf'),_0xcfea5,_0xcdb0d4['error'][_0xa3f8('0x16')]);return _0x2faf2e(_0xcdb0d4[_0xa3f8('0x14')][_0xa3f8('0x16')]);}else{logger[_0xa3f8('0x17')]('MemberReport,\x20%s,\x20%s',_0xcfea5,_0xa3f8('0x10'));_0x2faf2e(_0xcdb0d4[_0xa3f8('0x18')][_0xa3f8('0x16')]);}})[_0xa3f8('0x19')](function(_0x45ef64){logger[_0xa3f8('0x14')](_0xa3f8('0xf'),_0xcfea5,_0x45ef64);_0x2448de(_0x45ef64);});});}exports[_0xa3f8('0x1a')]=function(_0x2cb49f){var _0x267e73=this;return new Promise(function(_0x54b870,_0x3ad8cd){return db['MemberReport'][_0xa3f8('0x1b')]({'raw':_0x2cb49f[_0xa3f8('0x1c')]?_0x2cb49f[_0xa3f8('0x1c')][_0xa3f8('0x1d')]===undefined?!![]:![]:!![],'where':_0x2cb49f['options']?_0x2cb49f[_0xa3f8('0x1c')]['where']||null:null,'attributes':_0x2cb49f[_0xa3f8('0x1c')]?_0x2cb49f['options'][_0xa3f8('0x1e')]||null:null,'limit':_0x2cb49f[_0xa3f8('0x1c')]?_0x2cb49f[_0xa3f8('0x1c')][_0xa3f8('0x1f')]||null:null,'include':_0x2cb49f[_0xa3f8('0x1c')]?_0x2cb49f[_0xa3f8('0x1c')][_0xa3f8('0x20')]?_['map'](_0x2cb49f[_0xa3f8('0x1c')]['include'],function(_0x3ce57b){return{'model':db[_0x3ce57b[_0xa3f8('0x21')]],'as':_0x3ce57b['as'],'attributes':_0x3ce57b[_0xa3f8('0x1e')],'include':_0x3ce57b[_0xa3f8('0x20')]?_[_0xa3f8('0x22')](_0x3ce57b[_0xa3f8('0x20')],function(_0x6e3cb4){return{'model':db[_0x6e3cb4[_0xa3f8('0x21')]],'as':_0x6e3cb4['as'],'attributes':_0x6e3cb4[_0xa3f8('0x1e')],'include':_0x6e3cb4[_0xa3f8('0x20')]?_['map'](_0x6e3cb4[_0xa3f8('0x20')],function(_0x2d29c1){return{'model':db[_0x2d29c1[_0xa3f8('0x21')]],'as':_0x2d29c1['as'],'attributes':_0x2d29c1['attributes']};}):[]};}):[]};}):[]:[]})[_0xa3f8('0xe')](function(_0x57f6be){logger[_0xa3f8('0x17')](_0xa3f8('0x1a'),_0x2cb49f);logger[_0xa3f8('0x11')]('GetMemberReport',_0x2cb49f,JSON[_0xa3f8('0x13')](_0x57f6be));_0x54b870(_0x57f6be);})['catch'](function(_0x21c57e){logger[_0xa3f8('0x14')](_0xa3f8('0x1a'),_0x21c57e[_0xa3f8('0x16')],_0x2cb49f);_0x3ad8cd(_0x267e73[_0xa3f8('0x14')](0x1f4,_0x21c57e[_0xa3f8('0x16')]));});});};exports[_0xa3f8('0x23')]=function(_0x424a3e){var _0x25f9f5=this;return new Promise(function(_0x290a4e,_0x6e83b0){return db['MemberReport'][_0xa3f8('0x24')](_0x424a3e[_0xa3f8('0x25')],{'raw':_0x424a3e[_0xa3f8('0x1c')]?_0x424a3e[_0xa3f8('0x1c')][_0xa3f8('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x1b8aa8){logger[_0xa3f8('0x17')]('CreateMemberReport',_0x424a3e);logger[_0xa3f8('0x11')](_0xa3f8('0x23'),_0x424a3e,JSON['stringify'](_0x1b8aa8));_0x290a4e(_0x1b8aa8);})[_0xa3f8('0x19')](function(_0x4ec2ce){logger['error'](_0xa3f8('0x23'),_0x4ec2ce[_0xa3f8('0x16')],_0x424a3e);_0x6e83b0(_0x25f9f5['error'](0x1f4,_0x4ec2ce[_0xa3f8('0x16')]));});});};exports['UpdateMemberReport']=function(_0x1d7a30){var _0x30a972=this;return new Promise(function(_0x4e512e,_0x22e8ea){return db['MemberReport'][_0xa3f8('0x26')](_0x1d7a30['body'],{'raw':_0x1d7a30[_0xa3f8('0x1c')]?_0x1d7a30['options'][_0xa3f8('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1d7a30['options']?_0x1d7a30['options']['where']||null:null,'attributes':_0x1d7a30[_0xa3f8('0x1c')]?_0x1d7a30[_0xa3f8('0x1c')][_0xa3f8('0x1e')]||null:null,'limit':_0x1d7a30[_0xa3f8('0x1c')]?_0x1d7a30['options'][_0xa3f8('0x1f')]||null:null})[_0xa3f8('0xe')](function(_0x3d01f6){logger[_0xa3f8('0x17')](_0xa3f8('0x27'),_0x1d7a30);logger[_0xa3f8('0x11')]('UpdateMemberReport',_0x1d7a30,JSON[_0xa3f8('0x13')](_0x3d01f6));_0x4e512e(_0x3d01f6);})[_0xa3f8('0x19')](function(_0x38c75b){logger['error'](_0xa3f8('0x27'),_0x38c75b[_0xa3f8('0x16')],_0x1d7a30);_0x22e8ea(_0x30a972['error'](0x1f4,_0x38c75b[_0xa3f8('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 4c260fa..82a89fb 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 _0x72bd=['multer','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./migration.controller','index','exports'];(function(_0x26d944,_0x112b0a){var _0x10187a=function(_0xc3bf9d){while(--_0xc3bf9d){_0x26d944['push'](_0x26d944['shift']());}};_0x10187a(++_0x112b0a);}(_0x72bd,0xcf));var _0xd72b=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0x72bd[_0x1d24eb];return _0x1dc576;};'use strict';var multer=require(_0xd72b('0x0'));var util=require('util');var path=require(_0xd72b('0x1'));var timeout=require(_0xd72b('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xd72b('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xd72b('0x4'));var config=require(_0xd72b('0x5'));var controller=require(_0xd72b('0x6'));router['get']('/',controller[_0xd72b('0x7')]);module[_0xd72b('0x8')]=router; \ No newline at end of file +var _0xfca5=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','get','index','exports','multer'];(function(_0x2c6d8d,_0xd0025f){var _0x5f3ab8=function(_0x22a4d7){while(--_0x22a4d7){_0x2c6d8d['push'](_0x2c6d8d['shift']());}};_0x5f3ab8(++_0xd0025f);}(_0xfca5,0xcf));var _0x5fca=function(_0xbe40ad,_0x44343c){_0xbe40ad=_0xbe40ad-0x0;var _0x50fac9=_0xfca5[_0xbe40ad];return _0x50fac9;};'use strict';var multer=require(_0x5fca('0x0'));var util=require('util');var path=require(_0x5fca('0x1'));var timeout=require(_0x5fca('0x2'));var express=require(_0x5fca('0x3'));var router=express[_0x5fca('0x4')]();var fs_extra=require(_0x5fca('0x5'));var auth=require(_0x5fca('0x6'));var interaction=require(_0x5fca('0x7'));var config=require(_0x5fca('0x8'));var controller=require(_0x5fca('0x9'));router[_0x5fca('0xa')]('/',controller[_0x5fca('0xb')]);module[_0x5fca('0xc')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 15a1594..e1b7b3a 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 _0xbad5=['sequelize','STRING','version'];(function(_0x177cce,_0x52e8c8){var _0xbfefba=function(_0x47dc69){while(--_0x47dc69){_0x177cce['push'](_0x177cce['shift']());}};_0xbfefba(++_0x52e8c8);}(_0xbad5,0x183));var _0x5bad=function(_0x392996,_0x2833d5){_0x392996=_0x392996-0x0;var _0x59a2f1=_0xbad5[_0x392996];return _0x59a2f1;};'use strict';var Sequelize=require(_0x5bad('0x0'));module['exports']={'version':{'type':Sequelize[_0x5bad('0x1')],'unique':_0x5bad('0x2')}}; \ No newline at end of file +var _0x3b38=['exports','version','sequelize'];(function(_0x2dbce7,_0x57cb8d){var _0x3a3ed0=function(_0x28c8c6){while(--_0x28c8c6){_0x2dbce7['push'](_0x2dbce7['shift']());}};_0x3a3ed0(++_0x57cb8d);}(_0x3b38,0x125));var _0x83b3=function(_0x5558f0,_0x295235){_0x5558f0=_0x5558f0-0x0;var _0x1e1ca7=_0x3b38[_0x5558f0];return _0x1e1ca7;};'use strict';var Sequelize=require(_0x83b3('0x0'));module[_0x83b3('0x1')]={'version':{'type':Sequelize['STRING'],'unique':_0x83b3('0x2')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index b024453..5b4d118 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 _0x4097=['where','filter','merge','VIRTUAL','includeAll','include','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','count','set','apply','save','update','then','destroy','error','stack','name','send','index','Migration','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','fields','attributes','length','nolimit','order','sort'];(function(_0x47b6f3,_0x23c755){var _0xe548c0=function(_0x3496c5){while(--_0x3496c5){_0x47b6f3['push'](_0x47b6f3['shift']());}};_0xe548c0(++_0x23c755);}(_0x4097,0x198));var _0x7409=function(_0x21eeb4,_0x306590){_0x21eeb4=_0x21eeb4-0x0;var _0x12a3fb=_0x4097[_0x21eeb4];return _0x12a3fb;};'use strict';var emlformat=require(_0x7409('0x0'));var rimraf=require(_0x7409('0x1'));var zipdir=require(_0x7409('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7409('0x3'));var moment=require(_0x7409('0x4'));var BPromise=require(_0x7409('0x5'));var Mustache=require('mustache');var util=require(_0x7409('0x6'));var path=require(_0x7409('0x7'));var sox=require(_0x7409('0x8'));var csv=require(_0x7409('0x9'));var ejs=require(_0x7409('0xa'));var fs=require('fs');var fs_extra=require(_0x7409('0xb'));var _=require(_0x7409('0xc'));var squel=require('squel');var crypto=require(_0x7409('0xd'));var jsforce=require(_0x7409('0xe'));var deskjs=require(_0x7409('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7409('0x10'));var Papa=require(_0x7409('0x11'));var Redis=require(_0x7409('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x7409('0x13'));var as=require(_0x7409('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7409('0x15'))(_0x7409('0x16'));var utils=require(_0x7409('0x17'));var config=require(_0x7409('0x18'));var licenseUtil=require(_0x7409('0x19'));var db=require(_0x7409('0x1a'))['db'];function respondWithStatusCode(_0x5ade8b,_0x45d56c){_0x45d56c=_0x45d56c||0xcc;return function(_0x36613c){if(_0x36613c){return _0x5ade8b[_0x7409('0x1b')](_0x45d56c);}return _0x5ade8b['status'](_0x45d56c)[_0x7409('0x1c')]();};}function respondWithResult(_0x371346,_0x114052){_0x114052=_0x114052||0xc8;return function(_0x4056cb){if(_0x4056cb){return _0x371346[_0x7409('0x1d')](_0x114052)[_0x7409('0x1e')](_0x4056cb);}};}function respondWithFilteredResult(_0x318a69,_0x5627b7){return function(_0xbf1450){if(_0xbf1450){var _0x2ae939=typeof _0x5627b7[_0x7409('0x1f')]==='undefined'&&typeof _0x5627b7[_0x7409('0x20')]==='undefined';var _0x1bf1a4=_0xbf1450['count'];var _0x504331=_0x2ae939?0x0:_0x5627b7[_0x7409('0x1f')];var _0x165a27=_0x2ae939?_0xbf1450[_0x7409('0x21')]:_0x5627b7[_0x7409('0x1f')]+_0x5627b7[_0x7409('0x20')];var _0x578b5f;if(_0x165a27>=_0x1bf1a4){_0x165a27=_0x1bf1a4;_0x578b5f=0xc8;}else{_0x578b5f=0xce;}_0x318a69[_0x7409('0x1d')](_0x578b5f);return _0x318a69[_0x7409('0x22')]('Content-Range',_0x504331+'-'+_0x165a27+'/'+_0x1bf1a4)[_0x7409('0x1e')](_0xbf1450);}return null;};}function patchUpdates(_0x405299){return function(_0x29ca97){try{jsonpatch[_0x7409('0x23')](_0x29ca97,_0x405299,!![]);}catch(_0x371b94){return BPromise['reject'](_0x371b94);}return _0x29ca97[_0x7409('0x24')]();};}function saveUpdates(_0xc7cc9f,_0x24082b){return function(_0x847dd){if(_0x847dd){return _0x847dd[_0x7409('0x25')](_0xc7cc9f)[_0x7409('0x26')](function(_0x27a1ee){return _0x27a1ee;});}return null;};}function removeEntity(_0x3d262b,_0x50575f){return function(_0x56fe9b){if(_0x56fe9b){return _0x56fe9b[_0x7409('0x27')]()['then'](function(){_0x3d262b[_0x7409('0x1d')](0xcc)[_0x7409('0x1c')]();});}};}function handleEntityNotFound(_0x84c85c,_0x252e47){return function(_0x12be89){if(!_0x12be89){_0x84c85c[_0x7409('0x1b')](0x194);}return _0x12be89;};}function handleError(_0x2f0068,_0x3a34b8){_0x3a34b8=_0x3a34b8||0x1f4;return function(_0x33b739){logger[_0x7409('0x28')](_0x33b739[_0x7409('0x29')]);if(_0x33b739[_0x7409('0x2a')]){delete _0x33b739[_0x7409('0x2a')];}_0x2f0068[_0x7409('0x1d')](_0x3a34b8)[_0x7409('0x2b')](_0x33b739);};}exports[_0x7409('0x2c')]=function(_0x308b4e,_0x1f7070){var _0x5ab375={},_0x4d672d={},_0x3448da={'count':0x0,'rows':[]};var _0x5d2b36=_['map'](db[_0x7409('0x2d')][_0x7409('0x2e')],function(_0x25bc2e){return{'name':_0x25bc2e[_0x7409('0x2f')],'type':_0x25bc2e[_0x7409('0x30')][_0x7409('0x31')]};});_0x4d672d[_0x7409('0x32')]=_[_0x7409('0x33')](_0x5d2b36,_0x7409('0x2a'));_0x4d672d[_0x7409('0x34')]=_[_0x7409('0x35')](_0x308b4e[_0x7409('0x34')]);_0x4d672d['filters']=_[_0x7409('0x36')](_0x4d672d[_0x7409('0x32')],_0x4d672d[_0x7409('0x34')]);_0x5ab375['attributes']=_[_0x7409('0x36')](_0x4d672d[_0x7409('0x32')],qs['fields'](_0x308b4e[_0x7409('0x34')][_0x7409('0x37')]));_0x5ab375[_0x7409('0x38')]=_0x5ab375['attributes'][_0x7409('0x39')]?_0x5ab375[_0x7409('0x38')]:_0x4d672d['model'];if(!_0x308b4e['query']['hasOwnProperty'](_0x7409('0x3a'))){_0x5ab375['limit']=qs[_0x7409('0x20')](_0x308b4e[_0x7409('0x34')]['limit']);_0x5ab375[_0x7409('0x1f')]=qs[_0x7409('0x1f')](_0x308b4e[_0x7409('0x34')][_0x7409('0x1f')]);}_0x5ab375[_0x7409('0x3b')]=qs['sort'](_0x308b4e[_0x7409('0x34')][_0x7409('0x3c')]);_0x5ab375[_0x7409('0x3d')]=qs['filters'](_['pick'](_0x308b4e[_0x7409('0x34')],_0x4d672d['filters']),_0x5d2b36);if(_0x308b4e[_0x7409('0x34')][_0x7409('0x3e')]){_0x5ab375[_0x7409('0x3d')]=_[_0x7409('0x3f')](_0x5ab375[_0x7409('0x3d')],{'$or':_[_0x7409('0x33')](_0x5d2b36,function(_0x3d0777){if(_0x3d0777[_0x7409('0x30')]!==_0x7409('0x40')){var _0x2d38ab={};_0x2d38ab[_0x3d0777[_0x7409('0x2a')]]={'$like':'%'+_0x308b4e[_0x7409('0x34')][_0x7409('0x3e')]+'%'};return _0x2d38ab;}})});}_0x5ab375=_[_0x7409('0x3f')]({},_0x5ab375,_0x308b4e['options']);var _0x58698b={'where':_0x5ab375[_0x7409('0x3d')]};return db[_0x7409('0x2d')][_0x7409('0x21')](_0x58698b)[_0x7409('0x26')](function(_0x54dc0a){_0x3448da[_0x7409('0x21')]=_0x54dc0a;if(_0x308b4e[_0x7409('0x34')][_0x7409('0x41')]){_0x5ab375[_0x7409('0x42')]=[{'all':!![]}];}return db['Migration']['findAll'](_0x5ab375);})['then'](function(_0x4aa654){_0x3448da['rows']=_0x4aa654;return _0x3448da;})[_0x7409('0x26')](respondWithFilteredResult(_0x1f7070,_0x5ab375))['catch'](handleError(_0x1f7070,null));}; \ No newline at end of file +var _0x60e9=['map','Migration','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','apply','reject','update','then','status','name','send','index'];(function(_0x531f56,_0x334fcc){var _0x2cd1d4=function(_0x12a368){while(--_0x12a368){_0x531f56['push'](_0x531f56['shift']());}};_0x2cd1d4(++_0x334fcc);}(_0x60e9,0x11e));var _0x960e=function(_0x1e9bf5,_0x226e07){_0x1e9bf5=_0x1e9bf5-0x0;var _0x24cb4b=_0x60e9[_0x1e9bf5];return _0x24cb4b;};'use strict';var emlformat=require(_0x960e('0x0'));var rimraf=require(_0x960e('0x1'));var zipdir=require(_0x960e('0x2'));var jsonpatch=require(_0x960e('0x3'));var rp=require(_0x960e('0x4'));var moment=require(_0x960e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x960e('0x6'));var util=require(_0x960e('0x7'));var path=require(_0x960e('0x8'));var sox=require(_0x960e('0x9'));var csv=require(_0x960e('0xa'));var ejs=require(_0x960e('0xb'));var fs=require('fs');var fs_extra=require(_0x960e('0xc'));var _=require(_0x960e('0xd'));var squel=require(_0x960e('0xe'));var crypto=require(_0x960e('0xf'));var jsforce=require(_0x960e('0x10'));var deskjs=require(_0x960e('0x11'));var toCsv=require(_0x960e('0xa'));var querystring=require(_0x960e('0x12'));var Papa=require(_0x960e('0x13'));var Redis=require(_0x960e('0x14'));var authService=require(_0x960e('0x15'));var qs=require(_0x960e('0x16'));var as=require(_0x960e('0x17'));var hardwareService=require(_0x960e('0x18'));var logger=require('../../config/logger')(_0x960e('0x19'));var utils=require('../../config/utils');var config=require(_0x960e('0x1a'));var licenseUtil=require(_0x960e('0x1b'));var db=require(_0x960e('0x1c'))['db'];function respondWithStatusCode(_0x5b3a7f,_0x52d7ef){_0x52d7ef=_0x52d7ef||0xcc;return function(_0x18ff36){if(_0x18ff36){return _0x5b3a7f[_0x960e('0x1d')](_0x52d7ef);}return _0x5b3a7f['status'](_0x52d7ef)[_0x960e('0x1e')]();};}function respondWithResult(_0x27e8aa,_0x34fc86){_0x34fc86=_0x34fc86||0xc8;return function(_0x1d2abe){if(_0x1d2abe){return _0x27e8aa['status'](_0x34fc86)[_0x960e('0x1f')](_0x1d2abe);}};}function respondWithFilteredResult(_0x3a4343,_0x839582){return function(_0x17b586){if(_0x17b586){var _0x17462b=typeof _0x839582[_0x960e('0x20')]===_0x960e('0x21')&&typeof _0x839582[_0x960e('0x22')]===_0x960e('0x21');var _0x279a7c=_0x17b586[_0x960e('0x23')];var _0x5aed20=_0x17462b?0x0:_0x839582[_0x960e('0x20')];var _0x9b2856=_0x17462b?_0x17b586['count']:_0x839582[_0x960e('0x20')]+_0x839582['limit'];var _0x5b5b67;if(_0x9b2856>=_0x279a7c){_0x9b2856=_0x279a7c;_0x5b5b67=0xc8;}else{_0x5b5b67=0xce;}_0x3a4343['status'](_0x5b5b67);return _0x3a4343['set']('Content-Range',_0x5aed20+'-'+_0x9b2856+'/'+_0x279a7c)[_0x960e('0x1f')](_0x17b586);}return null;};}function patchUpdates(_0x225844){return function(_0x213d82){try{jsonpatch[_0x960e('0x24')](_0x213d82,_0x225844,!![]);}catch(_0x51a757){return BPromise[_0x960e('0x25')](_0x51a757);}return _0x213d82['save']();};}function saveUpdates(_0x278b59,_0x1e172c){return function(_0x7d7ab9){if(_0x7d7ab9){return _0x7d7ab9[_0x960e('0x26')](_0x278b59)[_0x960e('0x27')](function(_0x503f67){return _0x503f67;});}return null;};}function removeEntity(_0x7ce260,_0x566c04){return function(_0x42d7db){if(_0x42d7db){return _0x42d7db['destroy']()['then'](function(){_0x7ce260[_0x960e('0x28')](0xcc)[_0x960e('0x1e')]();});}};}function handleEntityNotFound(_0x22b8ea,_0x9a31a0){return function(_0x24b198){if(!_0x24b198){_0x22b8ea['sendStatus'](0x194);}return _0x24b198;};}function handleError(_0x5e4d6f,_0x27ea54){_0x27ea54=_0x27ea54||0x1f4;return function(_0xce1251){logger['error'](_0xce1251['stack']);if(_0xce1251['name']){delete _0xce1251[_0x960e('0x29')];}_0x5e4d6f[_0x960e('0x28')](_0x27ea54)[_0x960e('0x2a')](_0xce1251);};}exports[_0x960e('0x2b')]=function(_0x455a32,_0xeb8210){var _0xdee05c={},_0x3f29ca={},_0x74bcc={'count':0x0,'rows':[]};var _0x30ebd8=_[_0x960e('0x2c')](db[_0x960e('0x2d')]['rawAttributes'],function(_0x2eec53){return{'name':_0x2eec53['fieldName'],'type':_0x2eec53[_0x960e('0x2e')][_0x960e('0x2f')]};});_0x3f29ca[_0x960e('0x30')]=_[_0x960e('0x2c')](_0x30ebd8,_0x960e('0x29'));_0x3f29ca[_0x960e('0x31')]=_['keys'](_0x455a32[_0x960e('0x31')]);_0x3f29ca[_0x960e('0x32')]=_[_0x960e('0x33')](_0x3f29ca[_0x960e('0x30')],_0x3f29ca[_0x960e('0x31')]);_0xdee05c[_0x960e('0x34')]=_[_0x960e('0x33')](_0x3f29ca['model'],qs[_0x960e('0x35')](_0x455a32[_0x960e('0x31')][_0x960e('0x35')]));_0xdee05c[_0x960e('0x34')]=_0xdee05c[_0x960e('0x34')]['length']?_0xdee05c[_0x960e('0x34')]:_0x3f29ca[_0x960e('0x30')];if(!_0x455a32[_0x960e('0x31')][_0x960e('0x36')](_0x960e('0x37'))){_0xdee05c[_0x960e('0x22')]=qs[_0x960e('0x22')](_0x455a32[_0x960e('0x31')][_0x960e('0x22')]);_0xdee05c[_0x960e('0x20')]=qs[_0x960e('0x20')](_0x455a32['query'][_0x960e('0x20')]);}_0xdee05c[_0x960e('0x38')]=qs[_0x960e('0x39')](_0x455a32[_0x960e('0x31')][_0x960e('0x39')]);_0xdee05c[_0x960e('0x3a')]=qs[_0x960e('0x32')](_['pick'](_0x455a32['query'],_0x3f29ca[_0x960e('0x32')]),_0x30ebd8);if(_0x455a32['query'][_0x960e('0x3b')]){_0xdee05c['where']=_[_0x960e('0x3c')](_0xdee05c[_0x960e('0x3a')],{'$or':_[_0x960e('0x2c')](_0x30ebd8,function(_0x5e18cd){if(_0x5e18cd[_0x960e('0x2e')]!==_0x960e('0x3d')){var _0x37a327={};_0x37a327[_0x5e18cd[_0x960e('0x29')]]={'$like':'%'+_0x455a32[_0x960e('0x31')]['filter']+'%'};return _0x37a327;}})});}_0xdee05c=_[_0x960e('0x3c')]({},_0xdee05c,_0x455a32[_0x960e('0x3e')]);var _0x476df4={'where':_0xdee05c[_0x960e('0x3a')]};return db[_0x960e('0x2d')][_0x960e('0x23')](_0x476df4)[_0x960e('0x27')](function(_0x3bccee){_0x74bcc[_0x960e('0x23')]=_0x3bccee;if(_0x455a32['query'][_0x960e('0x3f')]){_0xdee05c[_0x960e('0x40')]=[{'all':!![]}];}return db['Migration']['findAll'](_0xdee05c);})[_0x960e('0x27')](function(_0x219f2c){_0x74bcc['rows']=_0x219f2c;return _0x74bcc;})[_0x960e('0x27')](respondWithFilteredResult(_0xeb8210,_0xdee05c))[_0x960e('0x41')](handleError(_0xeb8210,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 06788bd..cbb2718 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 _0x177b=['../../config/environment','exports','define','Migration','migrations','lodash','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x1088d8,_0x595d21){var _0x291b41=function(_0x20280a){while(--_0x20280a){_0x1088d8['push'](_0x1088d8['shift']());}};_0x291b41(++_0x595d21);}(_0x177b,0xc5));var _0xb177=function(_0x2586ad,_0x3a2816){_0x2586ad=_0x2586ad-0x0;var _0x4128db=_0x177b[_0x2586ad];return _0x4128db;};'use strict';var _=require(_0xb177('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb177('0x1'));var moment=require(_0xb177('0x2'));var BPromise=require(_0xb177('0x3'));var rp=require(_0xb177('0x4'));var fs=require('fs');var path=require(_0xb177('0x5'));var rimraf=require(_0xb177('0x6'));var config=require(_0xb177('0x7'));var attributes=require('./migration.attributes');module[_0xb177('0x8')]=function(_0x276335,_0x160d67){return _0x276335[_0xb177('0x9')](_0xb177('0xa'),attributes,{'tableName':_0xb177('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5c28=['request-promise','path','rimraf','./migration.attributes','exports','Migration','migrations','util','../../config/logger','api','moment','bluebird'];(function(_0x5a361d,_0x259dfc){var _0x24a315=function(_0xb5e44e){while(--_0xb5e44e){_0x5a361d['push'](_0x5a361d['shift']());}};_0x24a315(++_0x259dfc);}(_0x5c28,0x67));var _0x85c2=function(_0x35b253,_0x24d21c){_0x35b253=_0x35b253-0x0;var _0x2f97d2=_0x5c28[_0x35b253];return _0x2f97d2;};'use strict';var _=require('lodash');var util=require(_0x85c2('0x0'));var logger=require(_0x85c2('0x1'))(_0x85c2('0x2'));var moment=require(_0x85c2('0x3'));var BPromise=require(_0x85c2('0x4'));var rp=require(_0x85c2('0x5'));var fs=require('fs');var path=require(_0x85c2('0x6'));var rimraf=require(_0x85c2('0x7'));var config=require('../../config/environment');var attributes=require(_0x85c2('0x8'));module[_0x85c2('0x9')]=function(_0x1afafc,_0x5abc34){return _0x1afafc['define'](_0x85c2('0xa'),attributes,{'tableName':_0x85c2('0xb'),'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 cd26e0d..b6b30ce 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 _0x6e16=['code','error','message','result','catch','moment','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x24a7df,_0x5949fe){var _0x492b5c=function(_0x5d6bb0){while(--_0x5d6bb0){_0x24a7df['push'](_0x24a7df['shift']());}};_0x492b5c(++_0x5949fe);}(_0x6e16,0x1d3));var _0x66e1=function(_0xac1c84,_0x374e50){_0xac1c84=_0xac1c84-0x0;var _0x19bf97=_0x6e16[_0xac1c84];return _0x19bf97;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x66e1('0x0'));var BPromise=require('bluebird');var rs=require(_0x66e1('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x66e1('0x2'))['db'];var utils=require(_0x66e1('0x3'));var logger=require('../../config/logger')(_0x66e1('0x4'));var config=require('../../config/environment');var jayson=require(_0x66e1('0x5'));var client=jayson[_0x66e1('0x6')][_0x66e1('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5d1175,_0x37dd64,_0x43b549){return new BPromise(function(_0x257ecd,_0x202c0d){return client[_0x66e1('0x8')](_0x5d1175,_0x43b549)[_0x66e1('0x9')](function(_0x2d5c1a){logger[_0x66e1('0xa')](_0x66e1('0xb'),_0x37dd64,_0x66e1('0xc'));logger[_0x66e1('0xd')](_0x66e1('0xe'),_0x37dd64,_0x66e1('0xc'),JSON[_0x66e1('0xf')](_0x2d5c1a));if(_0x2d5c1a['error']){if(_0x2d5c1a['error'][_0x66e1('0x10')]===0x1f4){logger[_0x66e1('0x11')](_0x66e1('0xb'),_0x37dd64,_0x2d5c1a['error']['message']);return _0x202c0d(_0x2d5c1a[_0x66e1('0x11')]['message']);}logger[_0x66e1('0x11')](_0x66e1('0xb'),_0x37dd64,_0x2d5c1a['error'][_0x66e1('0x12')]);return _0x257ecd(_0x2d5c1a[_0x66e1('0x11')]['message']);}else{logger[_0x66e1('0xa')](_0x66e1('0xb'),_0x37dd64,_0x66e1('0xc'));_0x257ecd(_0x2d5c1a[_0x66e1('0x13')]['message']);}})[_0x66e1('0x14')](function(_0x3e3d19){logger[_0x66e1('0x11')](_0x66e1('0xb'),_0x37dd64,_0x3e3d19);_0x202c0d(_0x3e3d19);});});} \ No newline at end of file +var _0x983c=['catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x143475,_0x458e84){var _0x491066=function(_0x509171){while(--_0x509171){_0x143475['push'](_0x143475['shift']());}};_0x491066(++_0x458e84);}(_0x983c,0xf3));var _0xc983=function(_0x1c081d,_0x10b432){_0x1c081d=_0x1c081d-0x0;var _0x2deb0e=_0x983c[_0x1c081d];return _0x2deb0e;};'use strict';var _=require(_0xc983('0x0'));var util=require(_0xc983('0x1'));var moment=require(_0xc983('0x2'));var BPromise=require(_0xc983('0x3'));var rs=require(_0xc983('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc983('0x5'))['db'];var utils=require(_0xc983('0x6'));var logger=require(_0xc983('0x7'))(_0xc983('0x8'));var config=require(_0xc983('0x9'));var jayson=require(_0xc983('0xa'));var client=jayson[_0xc983('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x346933,_0x363403,_0x141900){return new BPromise(function(_0x11cd44,_0x52025a){return client['request'](_0x346933,_0x141900)['then'](function(_0x5ad672){logger[_0xc983('0xc')](_0xc983('0xd'),_0x363403,_0xc983('0xe'));logger[_0xc983('0xf')](_0xc983('0x10'),_0x363403,_0xc983('0xe'),JSON[_0xc983('0x11')](_0x5ad672));if(_0x5ad672[_0xc983('0x12')]){if(_0x5ad672[_0xc983('0x12')]['code']===0x1f4){logger[_0xc983('0x12')](_0xc983('0xd'),_0x363403,_0x5ad672[_0xc983('0x12')][_0xc983('0x13')]);return _0x52025a(_0x5ad672[_0xc983('0x12')][_0xc983('0x13')]);}logger['error'](_0xc983('0xd'),_0x363403,_0x5ad672[_0xc983('0x12')][_0xc983('0x13')]);return _0x11cd44(_0x5ad672[_0xc983('0x12')][_0xc983('0x13')]);}else{logger[_0xc983('0xc')]('Migration,\x20%s,\x20%s',_0x363403,_0xc983('0xe'));_0x11cd44(_0x5ad672[_0xc983('0x14')][_0xc983('0x13')]);}})[_0xc983('0x15')](function(_0x2f5dad){logger[_0xc983('0x12')](_0xc983('0xd'),_0x363403,_0x2f5dad);_0x52025a(_0x2f5dad);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index d8aeb9e..35cd689 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 _0x9300=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./network.controller','isAuthenticated','index','get','/:id','show','create','delete','destroy','exports','multer'];(function(_0x2e0979,_0x50df9e){var _0x20f403=function(_0x4a4f37){while(--_0x4a4f37){_0x2e0979['push'](_0x2e0979['shift']());}};_0x20f403(++_0x50df9e);}(_0x9300,0x153));var _0x0930=function(_0x1071d6,_0x293323){_0x1071d6=_0x1071d6-0x0;var _0x4c6be4=_0x9300[_0x1071d6];return _0x4c6be4;};'use strict';var multer=require(_0x0930('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x0930('0x1'));var express=require(_0x0930('0x2'));var router=express[_0x0930('0x3')]();var fs_extra=require(_0x0930('0x4'));var auth=require(_0x0930('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0930('0x6'));var controller=require(_0x0930('0x7'));router['get']('/',auth[_0x0930('0x8')](),controller[_0x0930('0x9')]);router[_0x0930('0xa')](_0x0930('0xb'),auth[_0x0930('0x8')](),controller[_0x0930('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0930('0xd')]);router['put'](_0x0930('0xb'),auth[_0x0930('0x8')](),controller['update']);router[_0x0930('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x0930('0xf')]);module[_0x0930('0x10')]=router; \ No newline at end of file +var _0xad1b=['exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','isAuthenticated','/:id','update','delete','destroy'];(function(_0x8666ec,_0x34fb14){var _0x496fe8=function(_0x52361d){while(--_0x52361d){_0x8666ec['push'](_0x8666ec['shift']());}};_0x496fe8(++_0x34fb14);}(_0xad1b,0x131));var _0xbad1=function(_0x104590,_0x21b0b5){_0x104590=_0x104590-0x0;var _0x380a7c=_0xad1b[_0x104590];return _0x380a7c;};'use strict';var multer=require(_0xbad1('0x0'));var util=require(_0xbad1('0x1'));var path=require(_0xbad1('0x2'));var timeout=require(_0xbad1('0x3'));var express=require('express');var router=express[_0xbad1('0x4')]();var fs_extra=require(_0xbad1('0x5'));var auth=require(_0xbad1('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xbad1('0x7'));var controller=require('./network.controller');router[_0xbad1('0x8')]('/',auth['isAuthenticated'](),controller[_0xbad1('0x9')]);router[_0xbad1('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xbad1('0xa')](),controller['create']);router['put'](_0xbad1('0xb'),auth[_0xbad1('0xa')](),controller[_0xbad1('0xc')]);router[_0xbad1('0xd')](_0xbad1('0xb'),auth['isAuthenticated'](),controller[_0xbad1('0xe')]);module[_0xbad1('0xf')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 62c4e76..f70b911 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 _0xd7c4=['externip','stun','turn','STRING','ENUM','localnet'];(function(_0x13aa7f,_0x85900f){var _0x5254cc=function(_0x3712a1){while(--_0x3712a1){_0x13aa7f['push'](_0x13aa7f['shift']());}};_0x5254cc(++_0x85900f);}(_0xd7c4,0x19c));var _0x4d7c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd7c4[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x4d7c('0x0')](_0x4d7c('0x1'),_0x4d7c('0x2'),_0x4d7c('0x3'),_0x4d7c('0x4'))},'value':{'type':Sequelize[_0x4d7c('0x5')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x4d7c('0x5')]}}; \ No newline at end of file +var _0x8b41=['stun','turn','STRING','sequelize','exports','ENUM','externip'];(function(_0x5f25c1,_0xf0c46c){var _0xa1d70c=function(_0x259ea9){while(--_0x259ea9){_0x5f25c1['push'](_0x5f25c1['shift']());}};_0xa1d70c(++_0xf0c46c);}(_0x8b41,0x192));var _0x18b4=function(_0x25e05d,_0x3b76d7){_0x25e05d=_0x25e05d-0x0;var _0x874e73=_0x8b41[_0x25e05d];return _0x874e73;};'use strict';var Sequelize=require(_0x18b4('0x0'));module[_0x18b4('0x1')]={'type':{'type':Sequelize[_0x18b4('0x2')]('localnet',_0x18b4('0x3'),_0x18b4('0x4'),_0x18b4('0x5'))},'value':{'type':Sequelize[_0x18b4('0x6')]},'username':{'type':Sequelize[_0x18b4('0x6')]},'password':{'type':Sequelize[_0x18b4('0x6')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 67ab704..f8d0505 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 _0x82ee=['request','info','Network,\x20%s,\x20%s','request\x20sent','debug','code','error','message','catch','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','sendStatus','name','send','index','map','rawAttributes','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','Network','findAll','rows','show','params','includeAll','options','create','body','STUN','join','root','server/files/templates/stun_multiple.ejs','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','TURN','server/files/templates/turn_multiple.ejs','utf8','/etc/asterisk/turn_xcally.conf','res_stun_monitor.so','readFileSync','server/files/templates/network.ejs','render','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','find','toUpperCase','util','path','ejs','../../config/logger','../../config/environment','../../mysqldb','jayson/promise','client'];(function(_0x46ed5e,_0x161949){var _0x204cac=function(_0x3ac007){while(--_0x3ac007){_0x46ed5e['push'](_0x46ed5e['shift']());}};_0x204cac(++_0x161949);}(_0x82ee,0xf7));var _0xe82e=function(_0x55dd1e,_0x5d2b54){_0x55dd1e=_0x55dd1e-0x0;var _0x2f7ed6=_0x82ee[_0x55dd1e];return _0x2f7ed6;};'use strict';var util=require(_0xe82e('0x0'));var path=require(_0xe82e('0x1'));var ejs=require(_0xe82e('0x2'));var fs=require('fs');var _=require('lodash');var qs=require('../../components/parsers/qs');var logger=require(_0xe82e('0x3'))('api');var config=require(_0xe82e('0x4'));var db=require(_0xe82e('0x5'))['db'];var jayson=require(_0xe82e('0x6'));var client=jayson[_0xe82e('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0xebc015,_0xff8c67,_0x122788,_0x3c3f25){return new Promise(function(_0x320098,_0x4c78a0){var _0x4fd236=_0x3c3f25||client;return _0x4fd236[_0xe82e('0x8')](_0xebc015,_0x122788)['then'](function(_0x32f5b5){logger[_0xe82e('0x9')](_0xe82e('0xa'),_0xff8c67,_0xe82e('0xb'));logger[_0xe82e('0xc')]('Network,\x20%s,\x20%s,\x20%s',_0xff8c67,_0xe82e('0xb'),JSON['stringify'](_0x32f5b5));if(_0x32f5b5['error']){if(_0x32f5b5['error'][_0xe82e('0xd')]===0x1f4){logger[_0xe82e('0xe')](_0xe82e('0xa'),_0xff8c67,_0x32f5b5[_0xe82e('0xe')][_0xe82e('0xf')]);return _0x4c78a0(_0x32f5b5[_0xe82e('0xe')][_0xe82e('0xf')]);}logger[_0xe82e('0xe')]('Network,\x20%s,\x20%s',_0xff8c67,_0x32f5b5[_0xe82e('0xe')][_0xe82e('0xf')]);return _0x320098(_0x32f5b5[_0xe82e('0xe')][_0xe82e('0xf')]);}else{logger[_0xe82e('0x9')](_0xe82e('0xa'),_0xff8c67,_0xe82e('0xb'));_0x320098(_0x32f5b5['result'][_0xe82e('0xf')]);}})[_0xe82e('0x10')](function(_0x4864e1){logger[_0xe82e('0xe')](_0xe82e('0xa'),_0xff8c67,_0x4864e1);_0x4c78a0(_0x4864e1);});});}function respondWithResult(_0x29ca12,_0x3eb44b){_0x3eb44b=_0x3eb44b||0xc8;return function(_0x57f47e){if(_0x57f47e){return _0x29ca12[_0xe82e('0x11')](_0x3eb44b)[_0xe82e('0x12')](_0x57f47e);}};}function respondWithFilteredResult(_0xb85fb9,_0x2645ee){return function(_0x56c016){if(_0x56c016){var _0xa3b71a=typeof _0x2645ee[_0xe82e('0x13')]===_0xe82e('0x14')&&typeof _0x2645ee[_0xe82e('0x15')]===_0xe82e('0x14');var _0xdc13b5=_0x56c016['count'];var _0x58be9e=_0xa3b71a?0x0:_0x2645ee['offset'];var _0xc75044=_0xa3b71a?_0x56c016[_0xe82e('0x16')]:_0x2645ee[_0xe82e('0x13')]+_0x2645ee[_0xe82e('0x15')];var _0x2bd3a6;if(_0xc75044>=_0xdc13b5){_0xc75044=_0xdc13b5;_0x2bd3a6=0xc8;}else{_0x2bd3a6=0xce;}_0xb85fb9[_0xe82e('0x11')](_0x2bd3a6);return _0xb85fb9[_0xe82e('0x17')](_0xe82e('0x18'),_0x58be9e+'-'+_0xc75044+'/'+_0xdc13b5)['json'](_0x56c016);}return null;};}function saveUpdates(_0x450fd8){return function(_0x1080eb){if(_0x1080eb){return _0x1080eb[_0xe82e('0x19')](_0x450fd8)[_0xe82e('0x1a')](function(_0x14b839){return _0x14b839;});}return null;};}function removeEntity(_0x29595c){return function(_0x13e7ab){if(_0x13e7ab){return _0x13e7ab[_0xe82e('0x1b')]()[_0xe82e('0x1a')](function(){_0x29595c[_0xe82e('0x11')](0xcc)[_0xe82e('0x1c')]();});}};}function handleEntityNotFound(_0x2fd64b){return function(_0x487c80){if(!_0x487c80){_0x2fd64b[_0xe82e('0x1d')](0x194);}return _0x487c80;};}function handleError(_0x3263f5,_0x3084b9){_0x3084b9=_0x3084b9||0x1f4;return function(_0x45acd1){logger[_0xe82e('0xe')](_0x45acd1['stack']);if(_0x45acd1[_0xe82e('0x1e')]){delete _0x45acd1[_0xe82e('0x1e')];}_0x3263f5[_0xe82e('0x11')](_0x3084b9)[_0xe82e('0x1f')](_0x45acd1);};}exports[_0xe82e('0x20')]=function(_0x27fb26,_0x1ddad3){var _0x2c4d2c={},_0x2c40de={},_0x4d8aec={'count':0x0,'rows':[]};var _0x57eb33=_[_0xe82e('0x21')](db['Network'][_0xe82e('0x22')],function(_0x2a71d1){return{'name':_0x2a71d1['fieldName'],'type':_0x2a71d1[_0xe82e('0x23')][_0xe82e('0x24')]};});_0x2c40de[_0xe82e('0x25')]=_[_0xe82e('0x21')](_0x57eb33,_0xe82e('0x1e'));_0x2c40de['query']=_[_0xe82e('0x26')](_0x27fb26[_0xe82e('0x27')]);_0x2c40de[_0xe82e('0x28')]=_['intersection'](_0x2c40de[_0xe82e('0x25')],_0x2c40de['query']);_0x2c4d2c[_0xe82e('0x29')]=_[_0xe82e('0x2a')](_0x2c40de['model'],qs[_0xe82e('0x2b')](_0x27fb26[_0xe82e('0x27')][_0xe82e('0x2b')]));_0x2c4d2c[_0xe82e('0x29')]=_0x2c4d2c[_0xe82e('0x29')][_0xe82e('0x2c')]?_0x2c4d2c['attributes']:_0x2c40de['model'];if(!_0x27fb26[_0xe82e('0x27')][_0xe82e('0x2d')](_0xe82e('0x2e'))){_0x2c4d2c[_0xe82e('0x15')]=qs[_0xe82e('0x15')](_0x27fb26[_0xe82e('0x27')][_0xe82e('0x15')]);_0x2c4d2c[_0xe82e('0x13')]=qs[_0xe82e('0x13')](_0x27fb26['query'][_0xe82e('0x13')]);}_0x2c4d2c[_0xe82e('0x2f')]=qs[_0xe82e('0x30')](_0x27fb26[_0xe82e('0x27')]['sort']);_0x2c4d2c[_0xe82e('0x31')]=qs['filters'](_[_0xe82e('0x32')](_0x27fb26['query'],_0x2c40de[_0xe82e('0x28')]),_0x57eb33);if(_0x27fb26[_0xe82e('0x27')][_0xe82e('0x33')]){_0x2c4d2c[_0xe82e('0x31')]=_[_0xe82e('0x34')](_0x2c4d2c[_0xe82e('0x31')],{'$or':_[_0xe82e('0x21')](_0x57eb33,function(_0x258481){if(_0x258481[_0xe82e('0x23')]!==_0xe82e('0x35')){var _0x1b7310={};_0x1b7310[_0x258481[_0xe82e('0x1e')]]={'$like':'%'+_0x27fb26[_0xe82e('0x27')][_0xe82e('0x33')]+'%'};return _0x1b7310;}})});}_0x2c4d2c=_[_0xe82e('0x34')]({},_0x2c4d2c,_0x27fb26['options']);var _0x13c385={'where':_0x2c4d2c[_0xe82e('0x31')]};return db['Network'][_0xe82e('0x16')](_0x13c385)[_0xe82e('0x1a')](function(_0xbb07f7){_0x4d8aec[_0xe82e('0x16')]=_0xbb07f7;if(_0x27fb26[_0xe82e('0x27')]['includeAll']){_0x2c4d2c[_0xe82e('0x36')]=[{'all':!![]}];}return db[_0xe82e('0x37')][_0xe82e('0x38')](_0x2c4d2c);})[_0xe82e('0x1a')](function(_0x3ba07d){_0x4d8aec[_0xe82e('0x39')]=_0x3ba07d;return _0x4d8aec;})[_0xe82e('0x1a')](respondWithFilteredResult(_0x1ddad3,_0x2c4d2c))[_0xe82e('0x10')](handleError(_0x1ddad3,null));};exports[_0xe82e('0x3a')]=function(_0x28f38c,_0x16b499){var _0x23b091={'raw':!![],'where':{'id':_0x28f38c[_0xe82e('0x3b')]['id']}},_0x306f26={};_0x306f26['model']=_[_0xe82e('0x26')](db['Network'][_0xe82e('0x22')]);_0x306f26[_0xe82e('0x27')]=_[_0xe82e('0x26')](_0x28f38c[_0xe82e('0x27')]);_0x306f26[_0xe82e('0x28')]=_['intersection'](_0x306f26['model'],_0x306f26[_0xe82e('0x27')]);_0x23b091[_0xe82e('0x29')]=_[_0xe82e('0x2a')](_0x306f26[_0xe82e('0x25')],qs[_0xe82e('0x2b')](_0x28f38c[_0xe82e('0x27')][_0xe82e('0x2b')]));_0x23b091['attributes']=_0x23b091[_0xe82e('0x29')][_0xe82e('0x2c')]?_0x23b091[_0xe82e('0x29')]:_0x306f26['model'];if(_0x28f38c['query'][_0xe82e('0x3c')]){_0x23b091['include']=[{'all':!![]}];}_0x23b091=_[_0xe82e('0x34')]({},_0x23b091,_0x28f38c[_0xe82e('0x3d')]);return db[_0xe82e('0x37')]['find'](_0x23b091)[_0xe82e('0x1a')](handleEntityNotFound(_0x16b499,null))[_0xe82e('0x1a')](respondWithResult(_0x16b499,null))[_0xe82e('0x10')](handleError(_0x16b499,null));};exports[_0xe82e('0x3e')]=function(_0x2247ce,_0x30bb31){var _0xb9130b;return db[_0xe82e('0x37')][_0xe82e('0x3e')](_0x2247ce[_0xe82e('0x3f')],{'raw':!![]})[_0xe82e('0x1a')](function(_0x50e230){_0xb9130b=_0x50e230;return db[_0xe82e('0x37')]['findAll']({'where':{'type':_0x2247ce[_0xe82e('0x3f')][_0xe82e('0x23')]},'raw':!![]});})[_0xe82e('0x1a')](function(_0x24bda5){if(_0xb9130b[_0xe82e('0x23')]['toUpperCase']()==_0xe82e('0x40')){var _0x136dcd=fs['readFileSync'](path[_0xe82e('0x41')](config[_0xe82e('0x42')],_0xe82e('0x43')),'utf8');var _0x504002=ejs['render'](_0x136dcd,{'networks':_0x24bda5||[]});fs[_0xe82e('0x44')](_0xe82e('0x45'),_0x504002);return respondWithRpcPromise(_0xe82e('0x46'),_0xe82e('0x3e'),{'module':'res_stun_monitor.so'});}else if(_0xb9130b[_0xe82e('0x23')]['toUpperCase']()==_0xe82e('0x47')){var _0x52fb05=fs['readFileSync'](path[_0xe82e('0x41')](config[_0xe82e('0x42')],_0xe82e('0x48')),_0xe82e('0x49'));var _0x1da30a=ejs['render'](_0x52fb05,{'networks':_0x24bda5||[]});fs['writeFileSync'](_0xe82e('0x4a'),_0x1da30a);return respondWithRpcPromise(_0xe82e('0x46'),'create',{'module':_0xe82e('0x4b')});}else{var _0x523127=fs[_0xe82e('0x4c')](path[_0xe82e('0x41')](config[_0xe82e('0x42')],_0xe82e('0x4d')),'utf8');var _0xc8c61b=ejs[_0xe82e('0x4e')](_0x523127,{'networks':_0x24bda5||[]});fs[_0xe82e('0x44')](util[_0xe82e('0x4f')](_0xe82e('0x50'),_0x2247ce[_0xe82e('0x3f')]['type'][_0xe82e('0x51')]()),_0xc8c61b);return respondWithRpcPromise(_0xe82e('0x46'),_0xe82e('0x3e'),{'module':_0xe82e('0x52')});}})[_0xe82e('0x1a')](function(){return _0xb9130b;})[_0xe82e('0x1a')](respondWithResult(_0x30bb31,0xc9))[_0xe82e('0x10')](handleError(_0x30bb31,null));};exports[_0xe82e('0x19')]=function(_0xf3ec16,_0x566353){var _0x43aaf9;return db[_0xe82e('0x37')][_0xe82e('0x53')]({'where':{'id':_0xf3ec16[_0xe82e('0x3b')]['id']}})['then'](handleEntityNotFound(_0x566353,null))['then'](saveUpdates(_0xf3ec16[_0xe82e('0x3f')],null))['then'](function(_0x71f1ac){if(_0x71f1ac){_0x43aaf9=_0x71f1ac;return db['Network'][_0xe82e('0x38')]({'where':{'type':_0x43aaf9[_0xe82e('0x23')]},'raw':!![]});}return null;})[_0xe82e('0x1a')](function(_0xa675bf){if(_0x43aaf9['type'][_0xe82e('0x54')]()==_0xe82e('0x40')){var _0x1cddc3=fs[_0xe82e('0x4c')](path[_0xe82e('0x41')](config[_0xe82e('0x42')],'server/files/templates/stun_multiple.ejs'),'utf8');var _0x48fb84=ejs['render'](_0x1cddc3,{'networks':_0xa675bf||[]});fs[_0xe82e('0x44')]('/etc/asterisk/stun_xcally.conf',_0x48fb84);return respondWithRpcPromise('Reload',_0xe82e('0x19'),{'module':_0xe82e('0x4b')});}else if(_0x43aaf9[_0xe82e('0x23')][_0xe82e('0x54')]()==_0xe82e('0x47')){var _0x46e708=fs['readFileSync'](path['join'](config['root'],_0xe82e('0x48')),'utf8');var _0x3d2d57=ejs[_0xe82e('0x4e')](_0x46e708,{'networks':_0xa675bf||[]});fs[_0xe82e('0x44')](_0xe82e('0x4a'),_0x3d2d57);return respondWithRpcPromise(_0xe82e('0x46'),'update',{'module':_0xe82e('0x4b')});}else{var _0x5dff9f=fs[_0xe82e('0x4c')](path[_0xe82e('0x41')](config[_0xe82e('0x42')],_0xe82e('0x4d')),_0xe82e('0x49'));var _0x2d1889=ejs['render'](_0x5dff9f,{'networks':_0xa675bf||[]});fs[_0xe82e('0x44')](util[_0xe82e('0x4f')](_0xe82e('0x50'),_0xf3ec16[_0xe82e('0x3f')][_0xe82e('0x23')][_0xe82e('0x51')]()),_0x2d1889);return respondWithRpcPromise('Reload',_0xe82e('0x19'),{'module':_0xe82e('0x52')});}})[_0xe82e('0x1a')](function(_0x3bd7d0){if(_0x3bd7d0){return _0x43aaf9;}return null;})[_0xe82e('0x1a')](respondWithResult(_0x566353,null))[_0xe82e('0x10')](handleError(_0x566353,null));};exports['destroy']=function(_0x342ec6,_0x513d0f){var _0x3ecdd8;return db[_0xe82e('0x37')][_0xe82e('0x53')]({'where':{'id':_0x342ec6[_0xe82e('0x3b')]['id']}})[_0xe82e('0x1a')](function(_0x5f3062){_0x3ecdd8=_0x5f3062;return _0x5f3062;})['then'](handleEntityNotFound(_0x513d0f,null))['then'](removeEntity(_0x513d0f,null))['then'](function(){if(_0x3ecdd8){return db['Network'][_0xe82e('0x38')]({'where':{'type':_0x3ecdd8[_0xe82e('0x23')]},'raw':!![]});}})[_0xe82e('0x1a')](function(_0x119897){if(_0x3ecdd8[_0xe82e('0x23')][_0xe82e('0x54')]()==_0xe82e('0x40')){var _0x38eb32=fs[_0xe82e('0x4c')](path[_0xe82e('0x41')](config[_0xe82e('0x42')],_0xe82e('0x43')),_0xe82e('0x49'));var _0x387a1a=ejs[_0xe82e('0x4e')](_0x38eb32,{'networks':_0x119897||[]});fs['writeFileSync'](_0xe82e('0x45'),_0x387a1a);return respondWithRpcPromise(_0xe82e('0x46'),_0xe82e('0x1b'),{'module':_0xe82e('0x4b')});}else if(_0x3ecdd8[_0xe82e('0x23')][_0xe82e('0x54')]()=='TURN'){var _0x4ed8dc=fs[_0xe82e('0x4c')](path[_0xe82e('0x41')](config[_0xe82e('0x42')],_0xe82e('0x48')),_0xe82e('0x49'));var _0xffaea6=ejs['render'](_0x4ed8dc,{'networks':_0x119897||[]});fs[_0xe82e('0x44')](_0xe82e('0x4a'),_0xffaea6);return respondWithRpcPromise(_0xe82e('0x46'),_0xe82e('0x1b'),{'module':_0xe82e('0x4b')});}else{var _0x4b97cb=fs[_0xe82e('0x4c')](path['join'](config[_0xe82e('0x42')],_0xe82e('0x4d')),_0xe82e('0x49'));var _0xf43433=ejs[_0xe82e('0x4e')](_0x4b97cb,{'networks':_0x119897||[]});fs[_0xe82e('0x44')](util[_0xe82e('0x4f')]('/etc/asterisk/sip_xcally_%s.conf',_0x3ecdd8[_0xe82e('0x23')][_0xe82e('0x51')]()),_0xf43433);return respondWithRpcPromise(_0xe82e('0x46'),_0xe82e('0x1b'),{'module':_0xe82e('0x52')});}})[_0xe82e('0x10')](handleError(_0x513d0f,null));}; \ No newline at end of file +var _0x1b65=['catch','status','offset','undefined','limit','count','set','Content-Range','json','update','then','end','sendStatus','name','send','map','Network','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','rows','show','params','keys','length','includeAll','find','create','body','toUpperCase','STUN','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','res_stun_monitor.so','TURN','readFileSync','server/files/templates/turn_multiple.ejs','join','server/files/templates/network.ejs','format','Reload','chan_sip.so','/etc/asterisk/sip_xcally_%s.conf','/etc/asterisk/turn_xcally.conf','destroy','toLowerCase','util','path','ejs','lodash','../../components/parsers/qs','../../config/logger','../../mysqldb','jayson/promise','http','request','info','request\x20sent','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Network,\x20%s,\x20%s','result'];(function(_0x14aaae,_0x2da6cd){var _0x4584b7=function(_0x20ee3f){while(--_0x20ee3f){_0x14aaae['push'](_0x14aaae['shift']());}};_0x4584b7(++_0x2da6cd);}(_0x1b65,0xf2));var _0x51b6=function(_0x97501e,_0x48c8fd){_0x97501e=_0x97501e-0x0;var _0x5919c8=_0x1b65[_0x97501e];return _0x5919c8;};'use strict';var util=require(_0x51b6('0x0'));var path=require(_0x51b6('0x1'));var ejs=require(_0x51b6('0x2'));var fs=require('fs');var _=require(_0x51b6('0x3'));var qs=require(_0x51b6('0x4'));var logger=require(_0x51b6('0x5'))('api');var config=require('../../config/environment');var db=require(_0x51b6('0x6'))['db'];var jayson=require(_0x51b6('0x7'));var client=jayson['client'][_0x51b6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x364667,_0x20341b,_0x5a7633,_0x697b9c){return new Promise(function(_0x20ae35,_0x427d5c){var _0x58ce68=_0x697b9c||client;return _0x58ce68[_0x51b6('0x9')](_0x364667,_0x5a7633)['then'](function(_0x94fbe){logger[_0x51b6('0xa')]('Network,\x20%s,\x20%s',_0x20341b,_0x51b6('0xb'));logger['debug'](_0x51b6('0xc'),_0x20341b,_0x51b6('0xb'),JSON[_0x51b6('0xd')](_0x94fbe));if(_0x94fbe[_0x51b6('0xe')]){if(_0x94fbe[_0x51b6('0xe')][_0x51b6('0xf')]===0x1f4){logger[_0x51b6('0xe')]('Network,\x20%s,\x20%s',_0x20341b,_0x94fbe['error'][_0x51b6('0x10')]);return _0x427d5c(_0x94fbe[_0x51b6('0xe')]['message']);}logger[_0x51b6('0xe')](_0x51b6('0x11'),_0x20341b,_0x94fbe[_0x51b6('0xe')][_0x51b6('0x10')]);return _0x20ae35(_0x94fbe[_0x51b6('0xe')][_0x51b6('0x10')]);}else{logger[_0x51b6('0xa')]('Network,\x20%s,\x20%s',_0x20341b,_0x51b6('0xb'));_0x20ae35(_0x94fbe[_0x51b6('0x12')]['message']);}})[_0x51b6('0x13')](function(_0x7bee98){logger[_0x51b6('0xe')](_0x51b6('0x11'),_0x20341b,_0x7bee98);_0x427d5c(_0x7bee98);});});}function respondWithResult(_0x4f866a,_0x202ae9){_0x202ae9=_0x202ae9||0xc8;return function(_0x82d9e){if(_0x82d9e){return _0x4f866a[_0x51b6('0x14')](_0x202ae9)['json'](_0x82d9e);}};}function respondWithFilteredResult(_0x372699,_0x2c23f3){return function(_0x290d88){if(_0x290d88){var _0x1b7fc7=typeof _0x2c23f3[_0x51b6('0x15')]===_0x51b6('0x16')&&typeof _0x2c23f3[_0x51b6('0x17')]===_0x51b6('0x16');var _0xe3af84=_0x290d88['count'];var _0x372868=_0x1b7fc7?0x0:_0x2c23f3[_0x51b6('0x15')];var _0x2f58c2=_0x1b7fc7?_0x290d88[_0x51b6('0x18')]:_0x2c23f3[_0x51b6('0x15')]+_0x2c23f3[_0x51b6('0x17')];var _0x2097be;if(_0x2f58c2>=_0xe3af84){_0x2f58c2=_0xe3af84;_0x2097be=0xc8;}else{_0x2097be=0xce;}_0x372699[_0x51b6('0x14')](_0x2097be);return _0x372699[_0x51b6('0x19')](_0x51b6('0x1a'),_0x372868+'-'+_0x2f58c2+'/'+_0xe3af84)[_0x51b6('0x1b')](_0x290d88);}return null;};}function saveUpdates(_0x2ef995){return function(_0x65fe28){if(_0x65fe28){return _0x65fe28[_0x51b6('0x1c')](_0x2ef995)[_0x51b6('0x1d')](function(_0x2c2410){return _0x2c2410;});}return null;};}function removeEntity(_0x4d1444){return function(_0x1b62ed){if(_0x1b62ed){return _0x1b62ed['destroy']()['then'](function(){_0x4d1444[_0x51b6('0x14')](0xcc)[_0x51b6('0x1e')]();});}};}function handleEntityNotFound(_0x3bef46){return function(_0x1d8ed1){if(!_0x1d8ed1){_0x3bef46[_0x51b6('0x1f')](0x194);}return _0x1d8ed1;};}function handleError(_0x5d1077,_0x34ba47){_0x34ba47=_0x34ba47||0x1f4;return function(_0x599fed){logger[_0x51b6('0xe')](_0x599fed['stack']);if(_0x599fed[_0x51b6('0x20')]){delete _0x599fed['name'];}_0x5d1077[_0x51b6('0x14')](_0x34ba47)[_0x51b6('0x21')](_0x599fed);};}exports['index']=function(_0x460f8e,_0x25aea2){var _0x700d23={},_0x52db4f={},_0x6093d7={'count':0x0,'rows':[]};var _0x4da01a=_[_0x51b6('0x22')](db[_0x51b6('0x23')][_0x51b6('0x24')],function(_0x519ef7){return{'name':_0x519ef7[_0x51b6('0x25')],'type':_0x519ef7[_0x51b6('0x26')][_0x51b6('0x27')]};});_0x52db4f[_0x51b6('0x28')]=_[_0x51b6('0x22')](_0x4da01a,'name');_0x52db4f[_0x51b6('0x29')]=_['keys'](_0x460f8e['query']);_0x52db4f[_0x51b6('0x2a')]=_[_0x51b6('0x2b')](_0x52db4f['model'],_0x52db4f[_0x51b6('0x29')]);_0x700d23[_0x51b6('0x2c')]=_[_0x51b6('0x2b')](_0x52db4f[_0x51b6('0x28')],qs[_0x51b6('0x2d')](_0x460f8e[_0x51b6('0x29')][_0x51b6('0x2d')]));_0x700d23[_0x51b6('0x2c')]=_0x700d23[_0x51b6('0x2c')]['length']?_0x700d23[_0x51b6('0x2c')]:_0x52db4f[_0x51b6('0x28')];if(!_0x460f8e[_0x51b6('0x29')][_0x51b6('0x2e')](_0x51b6('0x2f'))){_0x700d23[_0x51b6('0x17')]=qs[_0x51b6('0x17')](_0x460f8e['query']['limit']);_0x700d23[_0x51b6('0x15')]=qs[_0x51b6('0x15')](_0x460f8e['query'][_0x51b6('0x15')]);}_0x700d23[_0x51b6('0x30')]=qs['sort'](_0x460f8e[_0x51b6('0x29')][_0x51b6('0x31')]);_0x700d23[_0x51b6('0x32')]=qs[_0x51b6('0x2a')](_[_0x51b6('0x33')](_0x460f8e[_0x51b6('0x29')],_0x52db4f[_0x51b6('0x2a')]),_0x4da01a);if(_0x460f8e[_0x51b6('0x29')][_0x51b6('0x34')]){_0x700d23['where']=_[_0x51b6('0x35')](_0x700d23[_0x51b6('0x32')],{'$or':_[_0x51b6('0x22')](_0x4da01a,function(_0x28932a){if(_0x28932a['type']!=='VIRTUAL'){var _0x55f8f2={};_0x55f8f2[_0x28932a[_0x51b6('0x20')]]={'$like':'%'+_0x460f8e['query'][_0x51b6('0x34')]+'%'};return _0x55f8f2;}})});}_0x700d23=_[_0x51b6('0x35')]({},_0x700d23,_0x460f8e[_0x51b6('0x36')]);var _0x1bd123={'where':_0x700d23['where']};return db['Network']['count'](_0x1bd123)[_0x51b6('0x1d')](function(_0x389b23){_0x6093d7[_0x51b6('0x18')]=_0x389b23;if(_0x460f8e['query']['includeAll']){_0x700d23[_0x51b6('0x37')]=[{'all':!![]}];}return db['Network'][_0x51b6('0x38')](_0x700d23);})[_0x51b6('0x1d')](function(_0x240531){_0x6093d7[_0x51b6('0x39')]=_0x240531;return _0x6093d7;})['then'](respondWithFilteredResult(_0x25aea2,_0x700d23))['catch'](handleError(_0x25aea2,null));};exports[_0x51b6('0x3a')]=function(_0x4e1b05,_0x26882a){var _0x646069={'raw':!![],'where':{'id':_0x4e1b05[_0x51b6('0x3b')]['id']}},_0x57687f={};_0x57687f[_0x51b6('0x28')]=_[_0x51b6('0x3c')](db[_0x51b6('0x23')]['rawAttributes']);_0x57687f[_0x51b6('0x29')]=_[_0x51b6('0x3c')](_0x4e1b05[_0x51b6('0x29')]);_0x57687f[_0x51b6('0x2a')]=_['intersection'](_0x57687f[_0x51b6('0x28')],_0x57687f['query']);_0x646069[_0x51b6('0x2c')]=_[_0x51b6('0x2b')](_0x57687f[_0x51b6('0x28')],qs['fields'](_0x4e1b05['query'][_0x51b6('0x2d')]));_0x646069[_0x51b6('0x2c')]=_0x646069[_0x51b6('0x2c')][_0x51b6('0x3d')]?_0x646069[_0x51b6('0x2c')]:_0x57687f['model'];if(_0x4e1b05[_0x51b6('0x29')][_0x51b6('0x3e')]){_0x646069[_0x51b6('0x37')]=[{'all':!![]}];}_0x646069=_['merge']({},_0x646069,_0x4e1b05[_0x51b6('0x36')]);return db[_0x51b6('0x23')][_0x51b6('0x3f')](_0x646069)[_0x51b6('0x1d')](handleEntityNotFound(_0x26882a,null))[_0x51b6('0x1d')](respondWithResult(_0x26882a,null))['catch'](handleError(_0x26882a,null));};exports[_0x51b6('0x40')]=function(_0x41facb,_0x1fbb6b){var _0x504f49;return db[_0x51b6('0x23')][_0x51b6('0x40')](_0x41facb['body'],{'raw':!![]})[_0x51b6('0x1d')](function(_0x1a8eec){_0x504f49=_0x1a8eec;return db['Network'][_0x51b6('0x38')]({'where':{'type':_0x41facb[_0x51b6('0x41')][_0x51b6('0x26')]},'raw':!![]});})['then'](function(_0xd442ff){if(_0x504f49[_0x51b6('0x26')][_0x51b6('0x42')]()==_0x51b6('0x43')){var _0xb234d3=fs['readFileSync'](path['join'](config[_0x51b6('0x44')],_0x51b6('0x45')),_0x51b6('0x46'));var _0x3222db=ejs[_0x51b6('0x47')](_0xb234d3,{'networks':_0xd442ff||[]});fs[_0x51b6('0x48')](_0x51b6('0x49'),_0x3222db);return respondWithRpcPromise('Reload',_0x51b6('0x40'),{'module':_0x51b6('0x4a')});}else if(_0x504f49[_0x51b6('0x26')]['toUpperCase']()==_0x51b6('0x4b')){var _0x3f3777=fs[_0x51b6('0x4c')](path['join'](config[_0x51b6('0x44')],_0x51b6('0x4d')),_0x51b6('0x46'));var _0x5e9afd=ejs[_0x51b6('0x47')](_0x3f3777,{'networks':_0xd442ff||[]});fs[_0x51b6('0x48')]('/etc/asterisk/turn_xcally.conf',_0x5e9afd);return respondWithRpcPromise('Reload',_0x51b6('0x40'),{'module':_0x51b6('0x4a')});}else{var _0x3d56ed=fs[_0x51b6('0x4c')](path[_0x51b6('0x4e')](config[_0x51b6('0x44')],_0x51b6('0x4f')),'utf8');var _0x4584ad=ejs[_0x51b6('0x47')](_0x3d56ed,{'networks':_0xd442ff||[]});fs[_0x51b6('0x48')](util[_0x51b6('0x50')]('/etc/asterisk/sip_xcally_%s.conf',_0x41facb[_0x51b6('0x41')][_0x51b6('0x26')]['toLowerCase']()),_0x4584ad);return respondWithRpcPromise(_0x51b6('0x51'),_0x51b6('0x40'),{'module':_0x51b6('0x52')});}})[_0x51b6('0x1d')](function(){return _0x504f49;})[_0x51b6('0x1d')](respondWithResult(_0x1fbb6b,0xc9))[_0x51b6('0x13')](handleError(_0x1fbb6b,null));};exports[_0x51b6('0x1c')]=function(_0xba93b2,_0x3ab4c1){var _0x1c11ba;return db['Network'][_0x51b6('0x3f')]({'where':{'id':_0xba93b2['params']['id']}})[_0x51b6('0x1d')](handleEntityNotFound(_0x3ab4c1,null))[_0x51b6('0x1d')](saveUpdates(_0xba93b2['body'],null))[_0x51b6('0x1d')](function(_0x3cc214){if(_0x3cc214){_0x1c11ba=_0x3cc214;return db[_0x51b6('0x23')]['findAll']({'where':{'type':_0x1c11ba['type']},'raw':!![]});}return null;})['then'](function(_0x2d9b86){if(_0x1c11ba[_0x51b6('0x26')][_0x51b6('0x42')]()==_0x51b6('0x43')){var _0x5050e8=fs['readFileSync'](path[_0x51b6('0x4e')](config[_0x51b6('0x44')],_0x51b6('0x45')),_0x51b6('0x46'));var _0x441cd2=ejs[_0x51b6('0x47')](_0x5050e8,{'networks':_0x2d9b86||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0x441cd2);return respondWithRpcPromise('Reload',_0x51b6('0x1c'),{'module':_0x51b6('0x4a')});}else if(_0x1c11ba[_0x51b6('0x26')][_0x51b6('0x42')]()==_0x51b6('0x4b')){var _0x53c6c1=fs[_0x51b6('0x4c')](path['join'](config[_0x51b6('0x44')],_0x51b6('0x4d')),'utf8');var _0x47258f=ejs[_0x51b6('0x47')](_0x53c6c1,{'networks':_0x2d9b86||[]});fs[_0x51b6('0x48')]('/etc/asterisk/turn_xcally.conf',_0x47258f);return respondWithRpcPromise(_0x51b6('0x51'),_0x51b6('0x1c'),{'module':'res_stun_monitor.so'});}else{var _0x9c8723=fs[_0x51b6('0x4c')](path[_0x51b6('0x4e')](config['root'],'server/files/templates/network.ejs'),_0x51b6('0x46'));var _0x2580ee=ejs['render'](_0x9c8723,{'networks':_0x2d9b86||[]});fs[_0x51b6('0x48')](util[_0x51b6('0x50')](_0x51b6('0x53'),_0xba93b2[_0x51b6('0x41')][_0x51b6('0x26')]['toLowerCase']()),_0x2580ee);return respondWithRpcPromise(_0x51b6('0x51'),_0x51b6('0x1c'),{'module':'chan_sip.so'});}})['then'](function(_0x382270){if(_0x382270){return _0x1c11ba;}return null;})[_0x51b6('0x1d')](respondWithResult(_0x3ab4c1,null))[_0x51b6('0x13')](handleError(_0x3ab4c1,null));};exports['destroy']=function(_0x2a5a4d,_0x3c1624){var _0x4dea88;return db[_0x51b6('0x23')]['find']({'where':{'id':_0x2a5a4d[_0x51b6('0x3b')]['id']}})['then'](function(_0x5840eb){_0x4dea88=_0x5840eb;return _0x5840eb;})[_0x51b6('0x1d')](handleEntityNotFound(_0x3c1624,null))[_0x51b6('0x1d')](removeEntity(_0x3c1624,null))[_0x51b6('0x1d')](function(){if(_0x4dea88){return db['Network'][_0x51b6('0x38')]({'where':{'type':_0x4dea88[_0x51b6('0x26')]},'raw':!![]});}})[_0x51b6('0x1d')](function(_0x23feb3){if(_0x4dea88[_0x51b6('0x26')]['toUpperCase']()=='STUN'){var _0x153691=fs[_0x51b6('0x4c')](path[_0x51b6('0x4e')](config[_0x51b6('0x44')],_0x51b6('0x45')),_0x51b6('0x46'));var _0x127695=ejs[_0x51b6('0x47')](_0x153691,{'networks':_0x23feb3||[]});fs['writeFileSync'](_0x51b6('0x49'),_0x127695);return respondWithRpcPromise(_0x51b6('0x51'),'destroy',{'module':_0x51b6('0x4a')});}else if(_0x4dea88[_0x51b6('0x26')][_0x51b6('0x42')]()==_0x51b6('0x4b')){var _0x1fa7ff=fs[_0x51b6('0x4c')](path[_0x51b6('0x4e')](config[_0x51b6('0x44')],_0x51b6('0x4d')),_0x51b6('0x46'));var _0x54bf04=ejs[_0x51b6('0x47')](_0x1fa7ff,{'networks':_0x23feb3||[]});fs[_0x51b6('0x48')](_0x51b6('0x54'),_0x54bf04);return respondWithRpcPromise(_0x51b6('0x51'),_0x51b6('0x55'),{'module':_0x51b6('0x4a')});}else{var _0x242762=fs[_0x51b6('0x4c')](path[_0x51b6('0x4e')](config[_0x51b6('0x44')],'server/files/templates/network.ejs'),_0x51b6('0x46'));var _0x290a91=ejs[_0x51b6('0x47')](_0x242762,{'networks':_0x23feb3||[]});fs['writeFileSync'](util[_0x51b6('0x50')](_0x51b6('0x53'),_0x4dea88['type'][_0x51b6('0x56')]()),_0x290a91);return respondWithRpcPromise(_0x51b6('0x51'),_0x51b6('0x55'),{'module':_0x51b6('0x52')});}})['catch'](handleError(_0x3c1624,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index d7470ed..973f642 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 _0xb688=['exports','Network','network','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./network.attributes'];(function(_0x1777d4,_0x5602d1){var _0x1f5e9f=function(_0x37803f){while(--_0x37803f){_0x1777d4['push'](_0x1777d4['shift']());}};_0x1f5e9f(++_0x5602d1);}(_0xb688,0xcf));var _0x8b68=function(_0x1860d8,_0x3142ff){_0x1860d8=_0x1860d8-0x0;var _0x3f0355=_0xb688[_0x1860d8];return _0x3f0355;};'use strict';var _=require('lodash');var util=require(_0x8b68('0x0'));var logger=require(_0x8b68('0x1'))(_0x8b68('0x2'));var moment=require(_0x8b68('0x3'));var BPromise=require(_0x8b68('0x4'));var rp=require(_0x8b68('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8b68('0x6'));var config=require(_0x8b68('0x7'));var attributes=require(_0x8b68('0x8'));module[_0x8b68('0x9')]=function(_0x583d16,_0x34314e){return _0x583d16['define'](_0x8b68('0xa'),attributes,{'tableName':_0x8b68('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7d98=['lodash','../../config/logger','api','moment','bluebird','path','rimraf','./network.attributes','define','Network','network'];(function(_0x11e2ea,_0x39acce){var _0x31cb5a=function(_0x158be7){while(--_0x158be7){_0x11e2ea['push'](_0x11e2ea['shift']());}};_0x31cb5a(++_0x39acce);}(_0x7d98,0xe7));var _0x87d9=function(_0x3d4876,_0x366386){_0x3d4876=_0x3d4876-0x0;var _0x58ca9d=_0x7d98[_0x3d4876];return _0x58ca9d;};'use strict';var _=require(_0x87d9('0x0'));var util=require('util');var logger=require(_0x87d9('0x1'))(_0x87d9('0x2'));var moment=require(_0x87d9('0x3'));var BPromise=require(_0x87d9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x87d9('0x5'));var rimraf=require(_0x87d9('0x6'));var config=require('../../config/environment');var attributes=require(_0x87d9('0x7'));module['exports']=function(_0x5ed6d2,_0x510ba4){return _0x5ed6d2[_0x87d9('0x8')](_0x87d9('0x9'),attributes,{'tableName':_0x87d9('0xa'),'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 3a818a8..9c24266 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(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x7a54,0x106));var _0x47a5=function(_0x57f2e4,_0x3d3bbe){_0x57f2e4=_0x57f2e4-0x0;var _0x3e9da0=_0x7a54[_0x57f2e4];return _0x3e9da0;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4a30b6,_0x2a2f93){var _0x3768b3=function(_0x9e40f4){while(--_0x9e40f4){_0x4a30b6['push'](_0x4a30b6['shift']());}};_0x3768b3(++_0x2a2f93);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index c36bd84..42d094c 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 _0x0e95=['get','isAuthenticated','index','describe','show','getDispositions','/:id/canned_answers','getAnswers','getApplications','getInteractions','/:id/users','getAgents','create','/:id/dispositions','post','addAnswer','/:id/notify','notify','/:id/applications','addApplications','addAgents','/:id/send','put','/:id','update','delete','destroy','removeDispositions','removeAnswers','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller'];(function(_0x47cfa0,_0x1aef61){var _0x8fd4b6=function(_0x24e8ba){while(--_0x24e8ba){_0x47cfa0['push'](_0x47cfa0['shift']());}};_0x8fd4b6(++_0x1aef61);}(_0x0e95,0x6c));var _0x50e9=function(_0x46a93a,_0x760adc){_0x46a93a=_0x46a93a-0x0;var _0x561de6=_0x0e95[_0x46a93a];return _0x561de6;};'use strict';var multer=require(_0x50e9('0x0'));var util=require(_0x50e9('0x1'));var path=require('path');var timeout=require(_0x50e9('0x2'));var express=require('express');var router=express[_0x50e9('0x3')]();var fs_extra=require(_0x50e9('0x4'));var auth=require(_0x50e9('0x5'));var interaction=require(_0x50e9('0x6'));var config=require(_0x50e9('0x7'));var controller=require(_0x50e9('0x8'));router[_0x50e9('0x9')]('/',auth[_0x50e9('0xa')](),controller[_0x50e9('0xb')]);router[_0x50e9('0x9')]('/describe',auth[_0x50e9('0xa')](),controller[_0x50e9('0xc')]);router[_0x50e9('0x9')]('/:id',auth[_0x50e9('0xa')](),controller[_0x50e9('0xd')]);router[_0x50e9('0x9')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x50e9('0xe')]);router[_0x50e9('0x9')](_0x50e9('0xf'),auth[_0x50e9('0xa')](),controller[_0x50e9('0x10')]);router[_0x50e9('0x9')]('/:id/applications',auth['isAuthenticated'](),controller[_0x50e9('0x11')]);router[_0x50e9('0x9')]('/:id/interactions',auth[_0x50e9('0xa')](),controller[_0x50e9('0x12')]);router[_0x50e9('0x9')](_0x50e9('0x13'),auth[_0x50e9('0xa')](),controller[_0x50e9('0x14')]);router['post']('/',auth[_0x50e9('0xa')](),controller[_0x50e9('0x15')]);router['post'](_0x50e9('0x16'),auth[_0x50e9('0xa')](),controller['addDisposition']);router[_0x50e9('0x17')]('/:id/canned_answers',auth[_0x50e9('0xa')](),controller[_0x50e9('0x18')]);router[_0x50e9('0x17')](_0x50e9('0x19'),controller[_0x50e9('0x1a')]);router[_0x50e9('0x17')](_0x50e9('0x1b'),auth['isAuthenticated'](),controller[_0x50e9('0x1c')]);router[_0x50e9('0x17')]('/:id/users',auth[_0x50e9('0xa')](),controller[_0x50e9('0x1d')]);router[_0x50e9('0x17')](_0x50e9('0x1e'),auth[_0x50e9('0xa')](),controller['send']);router[_0x50e9('0x1f')](_0x50e9('0x20'),auth[_0x50e9('0xa')](),controller[_0x50e9('0x21')]);router[_0x50e9('0x22')](_0x50e9('0x20'),auth[_0x50e9('0xa')](),controller[_0x50e9('0x23')]);router[_0x50e9('0x22')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x50e9('0x24')]);router[_0x50e9('0x22')](_0x50e9('0xf'),auth['isAuthenticated'](),controller[_0x50e9('0x25')]);router[_0x50e9('0x22')](_0x50e9('0x13'),auth[_0x50e9('0xa')](),controller['removeAgents']);module[_0x50e9('0x26')]=router; \ No newline at end of file +var _0x605f=['put','/:id','update','delete','removeAnswers','removeAgents','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','/:id/canned_answers','getAnswers','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','create','addAnswer','post','/:id/notify','addApplications','/:id/send'];(function(_0x5c7480,_0x7f6a2c){var _0x4e7718=function(_0x2e8f1a){while(--_0x2e8f1a){_0x5c7480['push'](_0x5c7480['shift']());}};_0x4e7718(++_0x7f6a2c);}(_0x605f,0x15b));var _0xf605=function(_0x2ff35b,_0x384d6e){_0x2ff35b=_0x2ff35b-0x0;var _0x293bc3=_0x605f[_0x2ff35b];return _0x293bc3;};'use strict';var multer=require(_0xf605('0x0'));var util=require(_0xf605('0x1'));var path=require(_0xf605('0x2'));var timeout=require('connect-timeout');var express=require(_0xf605('0x3'));var router=express[_0xf605('0x4')]();var fs_extra=require(_0xf605('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf605('0x6'));var config=require('../../config/environment');var controller=require('./openchannelAccount.controller');router[_0xf605('0x7')]('/',auth[_0xf605('0x8')](),controller[_0xf605('0x9')]);router[_0xf605('0x7')](_0xf605('0xa'),auth[_0xf605('0x8')](),controller[_0xf605('0xb')]);router[_0xf605('0x7')]('/:id',auth[_0xf605('0x8')](),controller[_0xf605('0xc')]);router[_0xf605('0x7')](_0xf605('0xd'),auth[_0xf605('0x8')](),controller['getDispositions']);router[_0xf605('0x7')](_0xf605('0xe'),auth['isAuthenticated'](),controller[_0xf605('0xf')]);router[_0xf605('0x7')]('/:id/applications',auth[_0xf605('0x8')](),controller[_0xf605('0x10')]);router[_0xf605('0x7')](_0xf605('0x11'),auth['isAuthenticated'](),controller[_0xf605('0x12')]);router['get'](_0xf605('0x13'),auth[_0xf605('0x8')](),controller[_0xf605('0x14')]);router['post']('/',auth['isAuthenticated'](),controller[_0xf605('0x15')]);router['post'](_0xf605('0xd'),auth[_0xf605('0x8')](),controller['addDisposition']);router['post'](_0xf605('0xe'),auth[_0xf605('0x8')](),controller[_0xf605('0x16')]);router[_0xf605('0x17')](_0xf605('0x18'),controller['notify']);router[_0xf605('0x17')]('/:id/applications',auth[_0xf605('0x8')](),controller[_0xf605('0x19')]);router[_0xf605('0x17')](_0xf605('0x13'),auth[_0xf605('0x8')](),controller['addAgents']);router[_0xf605('0x17')](_0xf605('0x1a'),auth[_0xf605('0x8')](),controller['send']);router[_0xf605('0x1b')](_0xf605('0x1c'),auth['isAuthenticated'](),controller[_0xf605('0x1d')]);router[_0xf605('0x1e')](_0xf605('0x1c'),auth['isAuthenticated'](),controller['destroy']);router[_0xf605('0x1e')](_0xf605('0xd'),auth[_0xf605('0x8')](),controller['removeDispositions']);router[_0xf605('0x1e')](_0xf605('0xe'),auth['isAuthenticated'](),controller[_0xf605('0x1f')]);router[_0xf605('0x1e')]('/:id/users',auth['isAuthenticated'](),controller[_0xf605('0x20')]);module[_0xf605('0x21')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 045f57b..1f4894a 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 _0x71db=['mandatoryDisposition','sequelize','name','STRING','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','mandatoryDispositionPauseId','setDataValue'];(function(_0x5469b5,_0xf86e73){var _0x34da84=function(_0x1eb913){while(--_0x1eb913){_0x5469b5['push'](_0x5469b5['shift']());}};_0x34da84(++_0xf86e73);}(_0x71db,0x121));var _0xb71d=function(_0x4c5c97,_0x4f85bf){_0x4c5c97=_0x4c5c97-0x0;var _0xd5d2cb=_0x71db[_0x4c5c97];return _0xd5d2cb;};'use strict';var Sequelize=require(_0xb71d('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xb71d('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0xb71d('0x2')]},'token':{'type':Sequelize[_0xb71d('0x2')],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0xb71d('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xb71d('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xb71d('0x3')],'defaultValue':function(){return _0xb71d('0x4');}},'notificationSound':{'type':Sequelize[_0xb71d('0x5')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xb71d('0x5')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xb71d('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xb71d('0x2')]},'queueTransfer':{'type':Sequelize[_0xb71d('0x5')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb71d('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xb71d('0x5')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb71d('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb71d('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0xb71d('0x7')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xb71d('0x8'),'set':function(_0x25ae97){if(!_0x25ae97)this['setDataValue'](_0xb71d('0x9'),null);this[_0xb71d('0xa')](_0xb71d('0xb'),_0x25ae97);}}}; \ No newline at end of file +var _0x857d=['randomstring','exports','STRING','name','generate','TEXT','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','sequelize'];(function(_0x45ce90,_0x114609){var _0x313c45=function(_0x55102a){while(--_0x55102a){_0x45ce90['push'](_0x45ce90['shift']());}};_0x313c45(++_0x114609);}(_0x857d,0xb3));var _0xd857=function(_0x175c23,_0x4fa75e){_0x175c23=_0x175c23-0x0;var _0x99f2cd=_0x857d[_0x175c23];return _0x99f2cd;};'use strict';var Sequelize=require(_0xd857('0x0'));var rs=require(_0xd857('0x1'));module[_0xd857('0x2')]={'name':{'type':Sequelize[_0xd857('0x3')],'unique':_0xd857('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0xd857('0x3')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xd857('0x5')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xd857('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xd857('0x6')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xd857('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xd857('0x3')]},'queueTransfer':{'type':Sequelize[_0xd857('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xd857('0x8')],'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[_0xd857('0x8')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xd857('0x7')],'defaultValue':![],'comment':_0xd857('0x9'),'set':function(_0x3e25d9){if(!_0x3e25d9)this['setDataValue'](_0xd857('0xa'),null);this[_0xd857('0xb')]('mandatoryDisposition',_0x3e25d9);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 0c6bee8..c4fead4 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 _0x25d5=['message','OpenchannelAccount,\x20%s,\x20%s','result','sendStatus','status','end','json','offset','undefined','limit','count','set','save','destroy','get','OpenchannelAccounts','UserProfileResource','name','send','index','Pause','map','rawAttributes','fieldName','type','keys','query','filters','intersection','attributes','length','model','nolimit','order','sort','filter','VIRTUAL','options','includeAll','include','OpenchannelAccount','findAll','catch','show','fields','merge','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','update','body','params','mandatoryDispositionPause','describe','addDisposition','OpenchannelAccountId','Disposition','findOne','hasOwnProperty','pick','where','removeDispositions','ids','getAnswers','CannedAnswer','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','CompanyId','ListId','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','from','List','Contacts','DESC','OpenchannelApplication','Applications','account','applications','list','orderBy','priority','asc','contact','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','firstName','messageId','created','autoclose','unmanaged','OpenchannelMessage','AttachmentId','interaction','UserId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','READ_COMMITTED','bulkCreate','findAndCountAll','stack','getApplications','getInteractions','Contact','Tag','Tags','tag','rows','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','getAgents','out','dataValues','Messages','push','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','jayson/promise','client','http','request','then','info','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x9c5775,_0x5d3504){var _0x5094f7=function(_0x2b3e04){while(--_0x2b3e04){_0x9c5775['push'](_0x9c5775['shift']());}};_0x5094f7(++_0x5d3504);}(_0x25d5,0x91));var _0x525d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x25d5[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x525d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x525d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x525d('0x2'));var moment=require(_0x525d('0x3'));var BPromise=require(_0x525d('0x4'));var Mustache=require('mustache');var util=require(_0x525d('0x5'));var path=require(_0x525d('0x6'));var sox=require(_0x525d('0x7'));var csv=require(_0x525d('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x525d('0x9'));var _=require(_0x525d('0xa'));var squel=require(_0x525d('0xb'));var crypto=require(_0x525d('0xc'));var jsforce=require(_0x525d('0xd'));var deskjs=require(_0x525d('0xe'));var toCsv=require(_0x525d('0x8'));var querystring=require(_0x525d('0xf'));var Papa=require(_0x525d('0x10'));var Redis=require('ioredis');var authService=require(_0x525d('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x525d('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x525d('0x13'));var config=require(_0x525d('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x525d('0x15'))['db'];config[_0x525d('0x16')]=_[_0x525d('0x17')](config['redis'],{'host':_0x525d('0x18'),'port':0x18eb});var socket=require(_0x525d('0x19'))(new Redis(config[_0x525d('0x16')]));require(_0x525d('0x1a'))['register'](socket);var jayson=require(_0x525d('0x1b'));var client=jayson[_0x525d('0x1c')][_0x525d('0x1d')]({'port':0x232c});var client9002=jayson[_0x525d('0x1c')][_0x525d('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x31ed21,_0x107dfb,_0x471049,_0x50b4f3){return new BPromise(function(_0x51dfca,_0x38750c){var _0x389565=_0x50b4f3||client;return _0x389565[_0x525d('0x1e')](_0x31ed21,_0x471049)[_0x525d('0x1f')](function(_0x8abf8c){logger[_0x525d('0x20')]('OpenchannelAccount,\x20%s,\x20%s',_0x107dfb,_0x525d('0x21'));logger[_0x525d('0x22')](_0x525d('0x23'),_0x107dfb,_0x525d('0x21'),JSON[_0x525d('0x24')](_0x8abf8c));if(_0x8abf8c[_0x525d('0x25')]){if(_0x8abf8c['error'][_0x525d('0x26')]===0x1f4){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x107dfb,_0x8abf8c['error'][_0x525d('0x27')]);return _0x38750c(_0x8abf8c['error'][_0x525d('0x27')]);}logger[_0x525d('0x25')](_0x525d('0x28'),_0x107dfb,_0x8abf8c[_0x525d('0x25')][_0x525d('0x27')]);return _0x51dfca(_0x8abf8c['error'][_0x525d('0x27')]);}else{logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x107dfb,_0x525d('0x21'));_0x51dfca(_0x8abf8c[_0x525d('0x29')]['message']);}})['catch'](function(_0x3d4a5c){logger['error'](_0x525d('0x28'),_0x107dfb,_0x3d4a5c);_0x38750c(_0x3d4a5c);});});}function respondWithStatusCode(_0x25eeff,_0x190294){_0x190294=_0x190294||0xcc;return function(_0x3dca8a){if(_0x3dca8a){return _0x25eeff[_0x525d('0x2a')](_0x190294);}return _0x25eeff[_0x525d('0x2b')](_0x190294)[_0x525d('0x2c')]();};}function respondWithResult(_0x589e42,_0x3a4886){_0x3a4886=_0x3a4886||0xc8;return function(_0x5b13c2){if(_0x5b13c2){return _0x589e42[_0x525d('0x2b')](_0x3a4886)[_0x525d('0x2d')](_0x5b13c2);}};}function respondWithFilteredResult(_0x512d9f,_0x54856d){return function(_0x86bc45){if(_0x86bc45){var _0x4b9dbb=typeof _0x54856d[_0x525d('0x2e')]===_0x525d('0x2f')&&typeof _0x54856d[_0x525d('0x30')]===_0x525d('0x2f');var _0x497d6e=_0x86bc45['count'];var _0x356a13=_0x4b9dbb?0x0:_0x54856d[_0x525d('0x2e')];var _0x1f10bd=_0x4b9dbb?_0x86bc45[_0x525d('0x31')]:_0x54856d[_0x525d('0x2e')]+_0x54856d[_0x525d('0x30')];var _0x3ff3a4;if(_0x1f10bd>=_0x497d6e){_0x1f10bd=_0x497d6e;_0x3ff3a4=0xc8;}else{_0x3ff3a4=0xce;}_0x512d9f[_0x525d('0x2b')](_0x3ff3a4);return _0x512d9f[_0x525d('0x32')]('Content-Range',_0x356a13+'-'+_0x1f10bd+'/'+_0x497d6e)[_0x525d('0x2d')](_0x86bc45);}return null;};}function patchUpdates(_0x54e610){return function(_0x341d94){try{jsonpatch['apply'](_0x341d94,_0x54e610,!![]);}catch(_0x43447e){return BPromise['reject'](_0x43447e);}return _0x341d94[_0x525d('0x33')]();};}function saveUpdates(_0xef8484,_0x37827c){return function(_0x55c026){if(_0x55c026){return _0x55c026['update'](_0xef8484)[_0x525d('0x1f')](function(_0x2d3178){return _0x2d3178;});}return null;};}function removeEntity(_0x1f7420,_0x75c2fa){return function(_0x382d32){if(_0x382d32){return _0x382d32[_0x525d('0x34')]()['then'](function(){var _0x21afd1=_0x382d32[_0x525d('0x35')]({'plain':!![]});var _0xa6f6c0=_0x525d('0x36');return db[_0x525d('0x37')][_0x525d('0x34')]({'where':{'type':_0xa6f6c0,'resourceId':_0x21afd1['id']}})[_0x525d('0x1f')](function(){return _0x382d32;});})[_0x525d('0x1f')](function(){_0x1f7420[_0x525d('0x2b')](0xcc)[_0x525d('0x2c')]();});}};}function handleEntityNotFound(_0x58377f,_0x261a70){return function(_0x16adaf){if(!_0x16adaf){_0x58377f[_0x525d('0x2a')](0x194);}return _0x16adaf;};}function handleError(_0x45fd5c,_0x13aaea){_0x13aaea=_0x13aaea||0x1f4;return function(_0x341d12){logger[_0x525d('0x25')](_0x341d12['stack']);if(_0x341d12[_0x525d('0x38')]){delete _0x341d12[_0x525d('0x38')];}_0x45fd5c[_0x525d('0x2b')](_0x13aaea)[_0x525d('0x39')](_0x341d12);};}exports[_0x525d('0x3a')]=function(_0x229037,_0x8eadaf){var _0xc011bd={'include':[{'model':db[_0x525d('0x3b')],'as':'mandatoryDispositionPause'}]},_0x332c28={},_0x3e1583={'count':0x0,'rows':[]};var _0x275272=_[_0x525d('0x3c')](db['OpenchannelAccount'][_0x525d('0x3d')],function(_0x241970){return{'name':_0x241970[_0x525d('0x3e')],'type':_0x241970[_0x525d('0x3f')]['key']};});_0x332c28['model']=_[_0x525d('0x3c')](_0x275272,_0x525d('0x38'));_0x332c28['query']=_[_0x525d('0x40')](_0x229037[_0x525d('0x41')]);_0x332c28[_0x525d('0x42')]=_[_0x525d('0x43')](_0x332c28['model'],_0x332c28[_0x525d('0x41')]);_0xc011bd[_0x525d('0x44')]=_[_0x525d('0x43')](_0x332c28['model'],qs['fields'](_0x229037['query']['fields']));_0xc011bd[_0x525d('0x44')]=_0xc011bd[_0x525d('0x44')][_0x525d('0x45')]?_0xc011bd[_0x525d('0x44')]:_0x332c28[_0x525d('0x46')];if(!_0x229037[_0x525d('0x41')]['hasOwnProperty'](_0x525d('0x47'))){_0xc011bd[_0x525d('0x30')]=qs[_0x525d('0x30')](_0x229037[_0x525d('0x41')][_0x525d('0x30')]);_0xc011bd['offset']=qs[_0x525d('0x2e')](_0x229037['query'][_0x525d('0x2e')]);}_0xc011bd[_0x525d('0x48')]=qs[_0x525d('0x49')](_0x229037['query'][_0x525d('0x49')]);_0xc011bd['where']=qs[_0x525d('0x42')](_['pick'](_0x229037[_0x525d('0x41')],_0x332c28[_0x525d('0x42')]),_0x275272);if(_0x229037[_0x525d('0x41')][_0x525d('0x4a')]){_0xc011bd['where']=_['merge'](_0xc011bd['where'],{'$or':_[_0x525d('0x3c')](_0x275272,function(_0x3b82af){if(_0x3b82af[_0x525d('0x3f')]!==_0x525d('0x4b')){var _0x14fc09={};_0x14fc09[_0x3b82af[_0x525d('0x38')]]={'$like':'%'+_0x229037[_0x525d('0x41')]['filter']+'%'};return _0x14fc09;}})});}_0xc011bd=_['merge']({},_0xc011bd,_0x229037[_0x525d('0x4c')]);var _0x2abb17={'where':_0xc011bd['where']};return db['OpenchannelAccount'][_0x525d('0x31')](_0x2abb17)['then'](function(_0x4a7a5b){_0x3e1583[_0x525d('0x31')]=_0x4a7a5b;if(_0x229037[_0x525d('0x41')][_0x525d('0x4d')]){_0xc011bd[_0x525d('0x4e')]=[{'all':!![]}];}return db[_0x525d('0x4f')][_0x525d('0x50')](_0xc011bd);})[_0x525d('0x1f')](function(_0x2df3ca){_0x3e1583['rows']=_0x2df3ca;return _0x3e1583;})[_0x525d('0x1f')](respondWithFilteredResult(_0x8eadaf,_0xc011bd))[_0x525d('0x51')](handleError(_0x8eadaf,null));};exports[_0x525d('0x52')]=function(_0x50accf,_0x556bc8){var _0x16fc6e={'raw':![],'where':{'id':_0x50accf['params']['id']},'include':[{'model':db[_0x525d('0x3b')],'as':'mandatoryDispositionPause'}]},_0x36d5b3={};_0x36d5b3[_0x525d('0x46')]=_[_0x525d('0x40')](db[_0x525d('0x4f')][_0x525d('0x3d')]);_0x36d5b3['query']=_[_0x525d('0x40')](_0x50accf[_0x525d('0x41')]);_0x36d5b3[_0x525d('0x42')]=_[_0x525d('0x43')](_0x36d5b3['model'],_0x36d5b3[_0x525d('0x41')]);_0x16fc6e[_0x525d('0x44')]=_[_0x525d('0x43')](_0x36d5b3[_0x525d('0x46')],qs[_0x525d('0x53')](_0x50accf[_0x525d('0x41')][_0x525d('0x53')]));_0x16fc6e[_0x525d('0x44')]=_0x16fc6e['attributes'][_0x525d('0x45')]?_0x16fc6e[_0x525d('0x44')]:_0x36d5b3['model'];if(_0x50accf['query'][_0x525d('0x4d')]){_0x16fc6e['include']=[{'all':!![]}];}_0x16fc6e=_[_0x525d('0x54')]({},_0x16fc6e,_0x50accf[_0x525d('0x4c')]);return db[_0x525d('0x4f')]['find'](_0x16fc6e)['then'](handleEntityNotFound(_0x556bc8,null))[_0x525d('0x1f')](respondWithResult(_0x556bc8,null))['catch'](handleError(_0x556bc8,null));};exports[_0x525d('0x55')]=function(_0x46cee5,_0x2fae49){return db[_0x525d('0x4f')][_0x525d('0x55')](_0x46cee5['body'],{})[_0x525d('0x1f')](function(_0x25b692){var _0x254110=_0x46cee5[_0x525d('0x56')]['get']({'plain':!![]});if(!_0x254110)throw new Error(_0x525d('0x57'));if(_0x254110[_0x525d('0x58')]===_0x525d('0x56')){var _0x58dff2=_0x25b692[_0x525d('0x35')]({'plain':!![]});var _0x51ef08=_0x525d('0x36');return db[_0x525d('0x59')][_0x525d('0x5a')]({'where':{'name':_0x51ef08,'userProfileId':_0x254110[_0x525d('0x5b')]},'raw':!![]})[_0x525d('0x1f')](function(_0x31b525){if(_0x31b525&&_0x31b525[_0x525d('0x5c')]===0x0){return db['UserProfileResource'][_0x525d('0x55')]({'name':_0x58dff2[_0x525d('0x38')],'resourceId':_0x58dff2['id'],'type':_0x31b525[_0x525d('0x38')],'sectionId':_0x31b525['id']},{})['then'](function(){return _0x25b692;});}else{return _0x25b692;}})[_0x525d('0x51')](function(_0x3ce628){logger[_0x525d('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3ce628);throw _0x3ce628;});}return _0x25b692;})['then'](respondWithResult(_0x2fae49,0xc9))[_0x525d('0x51')](handleError(_0x2fae49,null));};exports[_0x525d('0x5d')]=function(_0xbe3f48,_0x47431b){if(_0xbe3f48['body']['id']){delete _0xbe3f48[_0x525d('0x5e')]['id'];}return db['OpenchannelAccount'][_0x525d('0x5a')]({'where':{'id':_0xbe3f48[_0x525d('0x5f')]['id']},'include':[{'model':db['Pause'],'as':_0x525d('0x60')}]})[_0x525d('0x1f')](handleEntityNotFound(_0x47431b,null))[_0x525d('0x1f')](saveUpdates(_0xbe3f48[_0x525d('0x5e')],null))[_0x525d('0x1f')](respondWithResult(_0x47431b,null))[_0x525d('0x51')](handleError(_0x47431b,null));};exports[_0x525d('0x34')]=function(_0x2409c4,_0x5adece){return db['OpenchannelAccount']['find']({'where':{'id':_0x2409c4[_0x525d('0x5f')]['id']}})[_0x525d('0x1f')](handleEntityNotFound(_0x5adece,null))['then'](removeEntity(_0x5adece,null))[_0x525d('0x51')](handleError(_0x5adece,null));};exports['describe']=function(_0x98c1ef,_0x5f609f){return db['OpenchannelAccount'][_0x525d('0x61')]()[_0x525d('0x1f')](respondWithResult(_0x5f609f,null))['catch'](handleError(_0x5f609f,null));};exports[_0x525d('0x62')]=function(_0x492210,_0x208fe4,_0x2bcbbc){if(_0x492210['body']['id']){delete _0x492210[_0x525d('0x5e')]['id'];}return db[_0x525d('0x4f')][_0x525d('0x5a')]({'where':{'id':_0x492210[_0x525d('0x5f')]['id']}})['then'](handleEntityNotFound(_0x208fe4,null))[_0x525d('0x1f')](function(_0x3be484){if(_0x3be484){_0x492210[_0x525d('0x5e')][_0x525d('0x63')]=_0x3be484['id'];return db[_0x525d('0x64')][_0x525d('0x55')](_0x492210[_0x525d('0x5e')]);}})[_0x525d('0x1f')](respondWithResult(_0x208fe4,null))['catch'](handleError(_0x208fe4,null));};exports['getDispositions']=function(_0x149f21,_0x135898,_0x50f789){var _0x5ad7a8={'raw':![],'where':{}};var _0x42e318={};var _0x4d17c3={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x525d('0x65')]({'where':{'id':_0x149f21[_0x525d('0x5f')]['id']}})[_0x525d('0x1f')](handleEntityNotFound(_0x135898,null))[_0x525d('0x1f')](function(_0x51164c){if(_0x51164c){_0x42e318[_0x525d('0x46')]=_[_0x525d('0x40')](db['Disposition'][_0x525d('0x3d')]);_0x42e318['query']=_['keys'](_0x149f21['query']);_0x42e318['filters']=_['intersection'](_0x42e318[_0x525d('0x46')],_0x42e318[_0x525d('0x41')]);_0x5ad7a8[_0x525d('0x44')]=_['intersection'](_0x42e318[_0x525d('0x46')],qs[_0x525d('0x53')](_0x149f21[_0x525d('0x41')]['fields']));_0x5ad7a8[_0x525d('0x44')]=_0x5ad7a8[_0x525d('0x44')][_0x525d('0x45')]?_0x5ad7a8[_0x525d('0x44')]:_0x42e318[_0x525d('0x46')];if(!_0x149f21[_0x525d('0x41')][_0x525d('0x66')](_0x525d('0x47'))){_0x5ad7a8[_0x525d('0x30')]=qs[_0x525d('0x30')](_0x149f21['query']['limit']);_0x5ad7a8[_0x525d('0x2e')]=qs[_0x525d('0x2e')](_0x149f21[_0x525d('0x41')][_0x525d('0x2e')]);}_0x5ad7a8[_0x525d('0x48')]=qs[_0x525d('0x49')](_0x149f21['query'][_0x525d('0x49')]);_0x5ad7a8['where']=qs[_0x525d('0x42')](_[_0x525d('0x67')](_0x149f21[_0x525d('0x41')],_0x42e318[_0x525d('0x42')]));_0x5ad7a8[_0x525d('0x68')][_0x525d('0x63')]=_0x51164c['id'];if(_0x149f21['query'][_0x525d('0x4a')]){_0x5ad7a8['where']=_[_0x525d('0x54')](_0x5ad7a8[_0x525d('0x68')],{'$or':_[_0x525d('0x3c')](_0x5ad7a8['attributes'],function(_0x527b9b){var _0x5ad7a0={};_0x5ad7a0[_0x527b9b]={'$like':'%'+_0x149f21[_0x525d('0x41')]['filter']+'%'};return _0x5ad7a0;})});}_0x5ad7a8=_[_0x525d('0x54')]({},_0x5ad7a8,_0x149f21['options']);return db['Disposition'][_0x525d('0x31')]({'where':_0x5ad7a8[_0x525d('0x68')]})[_0x525d('0x1f')](function(_0x23481e){_0x4d17c3[_0x525d('0x31')]=_0x23481e;if(_0x149f21[_0x525d('0x41')][_0x525d('0x4d')]){_0x5ad7a8['include']=[{'all':!![]}];}return db[_0x525d('0x64')][_0x525d('0x50')](_0x5ad7a8);})['then'](function(_0xaaeebe){_0x4d17c3['rows']=_0xaaeebe;return _0x4d17c3;});}})[_0x525d('0x1f')](respondWithFilteredResult(_0x135898,_0x5ad7a8))['catch'](handleError(_0x135898,null));};exports[_0x525d('0x69')]=function(_0x759ba2,_0x42b365,_0x3a626e){return db[_0x525d('0x4f')][_0x525d('0x5a')]({'where':{'id':_0x759ba2['params']['id']}})['then'](handleEntityNotFound(_0x42b365,null))[_0x525d('0x1f')](function(_0x3a8ac1){if(_0x3a8ac1){return _0x3a8ac1['removeDispositions'](_0x759ba2[_0x525d('0x41')][_0x525d('0x6a')]);}})[_0x525d('0x1f')](respondWithStatusCode(_0x42b365,null))[_0x525d('0x51')](handleError(_0x42b365,null));};exports['addAnswer']=function(_0x51218d,_0x18b8a1,_0x3a931b){if(_0x51218d[_0x525d('0x5e')]['id']){delete _0x51218d[_0x525d('0x5e')]['id'];}return db[_0x525d('0x4f')]['find']({'where':{'id':_0x51218d[_0x525d('0x5f')]['id']}})[_0x525d('0x1f')](handleEntityNotFound(_0x18b8a1,null))[_0x525d('0x1f')](function(_0x5b4fd9){if(_0x5b4fd9){_0x51218d[_0x525d('0x5e')][_0x525d('0x63')]=_0x5b4fd9['id'];return db['CannedAnswer'][_0x525d('0x55')](_0x51218d[_0x525d('0x5e')]);}})['then'](respondWithResult(_0x18b8a1,null))[_0x525d('0x51')](handleError(_0x18b8a1,null));};exports[_0x525d('0x6b')]=function(_0x47ed42,_0x16bfe7,_0x583392){var _0x28f6eb={'raw':![],'where':{}};var _0x1815d8={};var _0x35ff12={'count':0x0,'rows':[]};return db[_0x525d('0x4f')][_0x525d('0x65')]({'where':{'id':_0x47ed42[_0x525d('0x5f')]['id']}})[_0x525d('0x1f')](handleEntityNotFound(_0x16bfe7,null))[_0x525d('0x1f')](function(_0x5a6e3f){if(_0x5a6e3f){_0x1815d8[_0x525d('0x46')]=_[_0x525d('0x40')](db[_0x525d('0x6c')][_0x525d('0x3d')]);_0x1815d8[_0x525d('0x41')]=_[_0x525d('0x40')](_0x47ed42['query']);_0x1815d8[_0x525d('0x42')]=_['intersection'](_0x1815d8[_0x525d('0x46')],_0x1815d8[_0x525d('0x41')]);_0x28f6eb[_0x525d('0x44')]=_[_0x525d('0x43')](_0x1815d8[_0x525d('0x46')],qs[_0x525d('0x53')](_0x47ed42['query'][_0x525d('0x53')]));_0x28f6eb[_0x525d('0x44')]=_0x28f6eb[_0x525d('0x44')][_0x525d('0x45')]?_0x28f6eb[_0x525d('0x44')]:_0x1815d8[_0x525d('0x46')];if(!_0x47ed42[_0x525d('0x41')][_0x525d('0x66')](_0x525d('0x47'))){_0x28f6eb['limit']=qs[_0x525d('0x30')](_0x47ed42[_0x525d('0x41')]['limit']);_0x28f6eb[_0x525d('0x2e')]=qs['offset'](_0x47ed42['query'][_0x525d('0x2e')]);}_0x28f6eb['order']=qs['sort'](_0x47ed42[_0x525d('0x41')][_0x525d('0x49')]);_0x28f6eb['where']=qs[_0x525d('0x42')](_[_0x525d('0x67')](_0x47ed42['query'],_0x1815d8[_0x525d('0x42')]));_0x28f6eb['where'][_0x525d('0x63')]=_0x5a6e3f['id'];if(_0x47ed42['query'][_0x525d('0x4a')]){_0x28f6eb[_0x525d('0x68')]=_[_0x525d('0x54')](_0x28f6eb['where'],{'$or':_[_0x525d('0x3c')](_0x28f6eb['attributes'],function(_0x1fd373){var _0x409f04={};_0x409f04[_0x1fd373]={'$like':'%'+_0x47ed42[_0x525d('0x41')][_0x525d('0x4a')]+'%'};return _0x409f04;})});}_0x28f6eb=_[_0x525d('0x54')]({},_0x28f6eb,_0x47ed42['options']);return db[_0x525d('0x6c')]['count']({'where':_0x28f6eb[_0x525d('0x68')]})[_0x525d('0x1f')](function(_0x139a8d){_0x35ff12['count']=_0x139a8d;if(_0x47ed42[_0x525d('0x41')][_0x525d('0x4d')]){_0x28f6eb['include']=[{'all':!![]}];}return db[_0x525d('0x6c')][_0x525d('0x50')](_0x28f6eb);})[_0x525d('0x1f')](function(_0x4768da){_0x35ff12['rows']=_0x4768da;return _0x35ff12;});}})[_0x525d('0x1f')](respondWithFilteredResult(_0x16bfe7,_0x28f6eb))[_0x525d('0x51')](handleError(_0x16bfe7,null));};exports['removeAnswers']=function(_0x4584a9,_0x3d5d80,_0x68213b){return db[_0x525d('0x4f')][_0x525d('0x5a')]({'where':{'id':_0x4584a9['params']['id']}})[_0x525d('0x1f')](handleEntityNotFound(_0x3d5d80,null))[_0x525d('0x1f')](function(_0x49103c){if(_0x49103c){return _0x49103c['removeAnswers'](_0x4584a9[_0x525d('0x41')][_0x525d('0x6a')]);}})[_0x525d('0x1f')](respondWithStatusCode(_0x3d5d80,null))[_0x525d('0x51')](handleError(_0x3d5d80,null));};exports['notify']=function(_0x50825b,_0x160d3a,_0xc194a4){var _0x2f4642={'body':_0x50825b[_0x525d('0x5e')],'channel':_0x525d('0x6d')};var _0x46d6f5=[];var _0xf1c0de=[];var _0x52e1a9={};var _0x1f91d2=![];return db[_0x525d('0x6e')]['describe']()[_0x525d('0x1f')](function(_0x1b1ffc){if(!_0x1b1ffc){throw new db[(_0x525d('0x6f'))][(_0x525d('0x70'))](_0x525d('0x71'));}_0x46d6f5=_['difference'](_[_0x525d('0x40')](_0x1b1ffc),[_0x525d('0x72'),_0x525d('0x73')]);_0xf1c0de=_['difference'](_['keys'](_0x1b1ffc),[_0x525d('0x72'),_0x525d('0x73'),_0x525d('0x74'),_0x525d('0x75')]);if(_0x50825b[_0x525d('0x5e')]['id']){delete _0x50825b[_0x525d('0x5e')]['id'];}if(_['isNil'](_0x50825b['body']['from'])){throw new db['Sequelize'][(_0x525d('0x70'))](_0x525d('0x76'));}if(_['isNil'](_0x50825b['body'][_0x525d('0x5e')])||_0x50825b[_0x525d('0x5e')][_0x525d('0x5e')]===''){throw new db[(_0x525d('0x6f'))]['ValidationError'](_0x525d('0x77'));}if(_[_0x525d('0x78')](_0x50825b[_0x525d('0x5e')][_0x525d('0x79')])){throw new db['Sequelize']['ValidationError'](_0x525d('0x7a')+_0xf1c0de);}if(!_['includes'](_0xf1c0de,_0x50825b[_0x525d('0x5e')][_0x525d('0x79')])){throw new db['Sequelize'][(_0x525d('0x70'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xf1c0de);}_0x52e1a9[_0x50825b[_0x525d('0x5e')][_0x525d('0x79')]]=_0x50825b['body'][_0x525d('0x7b')];})[_0x525d('0x1f')](function(){return db[_0x525d('0x4f')][_0x525d('0x5a')]({'where':{'id':_0x50825b['params']['id']},'include':[{'model':db['CmList'],'as':_0x525d('0x7c'),'include':[{'model':db[_0x525d('0x6e')],'as':_0x525d('0x7d'),'where':_0x52e1a9,'limit':0x1,'order':[[_0x525d('0x73'),_0x525d('0x7e')]]}]},{'model':db[_0x525d('0x7f')],'as':_0x525d('0x80')}]});})[_0x525d('0x1f')](handleEntityNotFound(_0x160d3a,null))[_0x525d('0x1f')](function(_0x9fc07f){if(_0x9fc07f&&_0x9fc07f[_0x525d('0x7c')]){_0x2f4642[_0x525d('0x81')]=_0x9fc07f;_0x2f4642[_0x525d('0x82')]=_0x9fc07f[_0x525d('0x80')];_0x2f4642[_0x525d('0x83')]=_0x9fc07f[_0x525d('0x7c')];_0x2f4642[_0x525d('0x82')]=_[_0x525d('0x84')](_0x2f4642[_0x525d('0x82')],[_0x525d('0x85')],[_0x525d('0x86')]);if(_0x2f4642['account'][_0x525d('0x80')]){delete _0x2f4642['account'][_0x525d('0x80')];}if(_0x2f4642[_0x525d('0x81')][_0x525d('0x7c')]&&_0x2f4642['account'][_0x525d('0x7c')][_0x525d('0x7d')][_0x525d('0x45')]){return _0x2f4642[_0x525d('0x81')][_0x525d('0x7c')][_0x525d('0x7d')][0x0];}var _0x2ba004=_['defaults'](_0x50825b['body'],{'firstName':_0x50825b[_0x525d('0x5e')][_0x525d('0x7b')],'ListId':_0x9fc07f['ListId']});_0x2ba004[_0x50825b['body']['mapKey']]=_0x50825b[_0x525d('0x5e')]['from'];return db[_0x525d('0x6e')][_0x525d('0x55')](_0x2ba004,{'fields':_0x46d6f5,'raw':!![]});}})['then'](handleEntityNotFound(_0x160d3a,null))[_0x525d('0x1f')](function(_0x54928a){_0x2f4642[_0x525d('0x87')]=_0x54928a;if(_0x54928a){var _0x315f36={'ContactId':_0x54928a['id'],'OpenchannelAccountId':_0x50825b['params']['id'],'from':(_0x54928a['firstName']||'')+'\x20'+(_0x54928a[_0x525d('0x88')]||'')};var _0x7f2b7={'OpenchannelAccountId':_0x50825b[_0x525d('0x5f')]['id'],'closed':![]};if(_0x50825b['body'][_0x525d('0x89')]){_0x7f2b7['threadId']=_0x50825b[_0x525d('0x5e')][_0x525d('0x89')];return db[_0x525d('0x8a')][_0x525d('0x5a')]({'where':_0x7f2b7})[_0x525d('0x1f')](function(_0x171e4b){if(_0x171e4b){return[_0x171e4b,![]];}_0x315f36[_0x525d('0x89')]=_0x50825b[_0x525d('0x5e')][_0x525d('0x89')];_0x315f36[_0x525d('0x8b')]=_0x50825b[_0x525d('0x5e')][_0x525d('0x8b')];return db['OpenchannelInteraction'][_0x525d('0x55')](_0x315f36)['then'](function(_0x35032d){return[_0x35032d,!![]];});});}else{_0x7f2b7[_0x525d('0x89')]=null;}_0x7f2b7[_0x525d('0x8c')]=_0x54928a['id'];return db[_0x525d('0x8a')][_0x525d('0x5a')]({'where':_0x7f2b7})[_0x525d('0x1f')](function(_0x3961b1){if(_0x3961b1){return[_0x3961b1,![]];}return db[_0x525d('0x8a')][_0x525d('0x55')](_0x315f36)['then'](function(_0x269811){return[_0x269811,!![]];});});}})[_0x525d('0x8d')](function(_0x5c03ae,_0x44aa42){if(_0x5c03ae){_0x1f91d2=_0x44aa42;if(!_0x44aa42){var _0x4375ea={'from':(_0x2f4642['contact'][_0x525d('0x8e')]||'')+'\x20'+(_0x2f4642[_0x525d('0x87')][_0x525d('0x88')]||'')};if(_0x50825b[_0x525d('0x5e')]['threadId']&&_0x50825b['body']['messageId']&&_0x50825b[_0x525d('0x5e')][_0x525d('0x89')]!=_0x50825b[_0x525d('0x5e')]['messageId']){_0x4375ea[_0x525d('0x89')]=_0x50825b['body'][_0x525d('0x8f')];}return _0x5c03ae[_0x525d('0x5d')](_0x4375ea);}else{return _0x5c03ae;}}})['then'](function(_0x300adc){_0x2f4642['interaction']=_0x300adc[_0x525d('0x35')]({'plain':!![]});_0x2f4642['interaction'][_0x525d('0x90')]=_0x1f91d2;if(_0x2f4642['interaction'][_0x525d('0x90')]){if(_0x2f4642[_0x525d('0x81')][_0x525d('0x91')]){_0x2f4642[_0x525d('0x82')]['push']({'id':0x0,'priority':_0x2f4642[_0x525d('0x82')][_0x525d('0x45')]+0x1,'app':'close','appdata':_0x525d('0x92'),'interval':'*,*,*,*'});}}return db[_0x525d('0x93')][_0x525d('0x55')]({'body':_0x50825b[_0x525d('0x5e')]['body'],'OpenchannelAccountId':_0x50825b['params']['id'],'OpenchannelInteractionId':_0x300adc['id'],'direction':'in','ContactId':_0x2f4642[_0x525d('0x87')]['id'],'AttachmentId':_0x50825b[_0x525d('0x5e')][_0x525d('0x94')]});})[_0x525d('0x1f')](function(_0x462c9d){_0x2f4642[_0x525d('0x27')]=_0x462c9d;if(_0x2f4642[_0x525d('0x95')][_0x525d('0x96')]){return db[_0x525d('0x97')]['find']({'attributes':['id','name'],'where':{'id':_0x2f4642[_0x525d('0x95')][_0x525d('0x96')]}})[_0x525d('0x1f')](function(_0x2d8906){if(_0x2d8906){_0x2f4642[_0x525d('0x82')][_0x525d('0x98')]({'id':0x0,'priority':0x0,'app':_0x525d('0x99'),'appdata':_0x2d8906[_0x525d('0x38')]+','+(_0x2f4642['account'][_0x525d('0x9a')]||0xa),'interval':_0x525d('0x9b')});_0x2f4642[_0x525d('0x9c')]=![];}return respondWithRpcPromise(_0x525d('0x9d'),_0x525d('0x9e'),_0x2f4642);});}return respondWithRpcPromise(_0x525d('0x9d'),'startRouting',_0x2f4642);})[_0x525d('0x1f')](function(_0x53c1d6){respondWithRpcPromise(_0x525d('0x9f'),_0x525d('0x9f'),{'event':'notify','message':_0x53c1d6},client9002);return _0x53c1d6;})[_0x525d('0x1f')](respondWithResult(_0x160d3a,null))['catch'](handleError(_0x160d3a,null));};exports[_0x525d('0xa0')]=function(_0x9f5866,_0x1089fc){var _0x1c293e=_0x9f5866[_0x525d('0x5f')]['id'];var _0x339fc2=_0x9f5866[_0x525d('0x5e')];var _0x40cf57=0xc8;var _0x1aec4f=null;return db[_0x525d('0xa1')]['transaction']({'isolationLevel':db[_0x525d('0xa1')]['Transaction']['ISOLATION_LEVELS'][_0x525d('0xa2')]},function(_0x36cb48){return db[_0x525d('0x4f')][_0x525d('0x65')]({'where':{'id':_0x1c293e},'transaction':_0x36cb48})[_0x525d('0x1f')](function(_0x107113){if(_0x107113){return db['OpenchannelApplication'][_0x525d('0x34')]({'where':{'OpenchannelAccountId':_0x1c293e},'transaction':_0x36cb48})['then'](function(){var _0x31f430=_[_0x525d('0x3c')](_0x339fc2,function(_0x1b8884){_0x1b8884['OpenchannelAccountId']=_0x1c293e;return _0x1b8884;});return db[_0x525d('0x7f')][_0x525d('0xa3')](_0x31f430,{'transaction':_0x36cb48});});}else{_0x40cf57=0x194;_0x1aec4f=[];}});})[_0x525d('0x1f')](function(){if(_0x40cf57!==0x194){return db['OpenchannelApplication'][_0x525d('0xa4')]({'where':{'OpenchannelAccountId':_0x1c293e},'order':_0x525d('0x85')})[_0x525d('0x1f')](function(_0x3fdccc){_0x1aec4f=_0x3fdccc;});}})[_0x525d('0x51')](function(_0x2e01d0){_0x40cf57=0x1f4;logger['error'](_0x2e01d0[_0x525d('0xa5')]);if(_0x2e01d0[_0x525d('0x38')]){delete _0x2e01d0['name'];}_0x1aec4f=_0x2e01d0;})['finally'](function(){if(_0x1aec4f===null){_0x1089fc[_0x525d('0x2a')](_0x40cf57);}else{if(_0x40cf57===0x1f4){_0x1089fc[_0x525d('0x2b')](_0x40cf57)[_0x525d('0x39')](_0x1aec4f);}else{_0x1089fc[_0x525d('0x2b')](_0x40cf57)['json'](_0x1aec4f);}}});};exports[_0x525d('0xa6')]=function(_0x30ae98,_0x24fafc,_0x2e7ad9){var _0x12d24e={};var _0xd40782={};var _0x56ce16;var _0x29a019;return db[_0x525d('0x4f')][_0x525d('0x65')]({'where':{'id':_0x30ae98[_0x525d('0x5f')]['id']}})[_0x525d('0x1f')](handleEntityNotFound(_0x24fafc,null))[_0x525d('0x1f')](function(_0xa318c9){if(_0xa318c9){_0x56ce16=_0xa318c9;_0xd40782[_0x525d('0x46')]=_[_0x525d('0x40')](db[_0x525d('0x7f')][_0x525d('0x3d')]);_0xd40782[_0x525d('0x41')]=_[_0x525d('0x40')](_0x30ae98[_0x525d('0x41')]);_0xd40782[_0x525d('0x42')]=_['intersection'](_0xd40782[_0x525d('0x46')],_0xd40782[_0x525d('0x41')]);_0x12d24e['attributes']=_[_0x525d('0x43')](_0xd40782[_0x525d('0x46')],qs[_0x525d('0x53')](_0x30ae98[_0x525d('0x41')][_0x525d('0x53')]));_0x12d24e['attributes']=_0x12d24e[_0x525d('0x44')]['length']?_0x12d24e[_0x525d('0x44')]:_0xd40782[_0x525d('0x46')];_0x12d24e['order']=qs[_0x525d('0x49')](_0x30ae98[_0x525d('0x41')][_0x525d('0x49')]);_0x12d24e[_0x525d('0x68')]=qs[_0x525d('0x42')](_['pick'](_0x30ae98[_0x525d('0x41')],_0xd40782[_0x525d('0x42')]));if(_0x30ae98[_0x525d('0x41')][_0x525d('0x4a')]){_0x12d24e[_0x525d('0x68')]=_[_0x525d('0x54')](_0x12d24e['where'],{'$or':_['map'](_0x12d24e[_0x525d('0x44')],function(_0x13a3c5){var _0x2a2391={};_0x2a2391[_0x13a3c5]={'$like':'%'+_0x30ae98['query']['filter']+'%'};return _0x2a2391;})});}_0x12d24e=_['merge']({},_0x12d24e,_0x30ae98['options']);return _0x56ce16[_0x525d('0xa6')](_0x12d24e);}})[_0x525d('0x1f')](function(_0x2206aa){if(_0x2206aa){_0x29a019=_0x2206aa['length'];if(!_0x30ae98[_0x525d('0x41')][_0x525d('0x66')](_0x525d('0x47'))){_0x12d24e[_0x525d('0x30')]=qs['limit'](_0x30ae98[_0x525d('0x41')][_0x525d('0x30')]);_0x12d24e['offset']=qs['offset'](_0x30ae98[_0x525d('0x41')][_0x525d('0x2e')]);}return _0x56ce16[_0x525d('0xa6')](_0x12d24e);}})[_0x525d('0x1f')](function(_0x4ca3d1){if(_0x4ca3d1){return _0x4ca3d1?{'count':_0x29a019,'rows':_0x4ca3d1}:null;}})[_0x525d('0x1f')](respondWithResult(_0x24fafc,null))[_0x525d('0x51')](handleError(_0x24fafc,null));};exports[_0x525d('0xa7')]=function(_0x43deb1,_0x4932cf,_0x3ee185){var _0x33db3e={'raw':![],'where':{}};var _0x52000e={};var _0x5577fe={'count':0x0,'rows':[]};return db[_0x525d('0x4f')][_0x525d('0x65')]({'where':{'id':_0x43deb1[_0x525d('0x5f')]['id']}})['then'](handleEntityNotFound(_0x4932cf,null))[_0x525d('0x1f')](function(_0x45469b){if(_0x45469b){_0x52000e[_0x525d('0x46')]=_[_0x525d('0x40')](db[_0x525d('0x8a')][_0x525d('0x3d')]);_0x52000e[_0x525d('0x41')]=_['keys'](_0x43deb1[_0x525d('0x41')]);_0x52000e[_0x525d('0x42')]=_[_0x525d('0x43')](_0x52000e[_0x525d('0x46')],_0x52000e[_0x525d('0x41')]);_0x33db3e[_0x525d('0x44')]=_[_0x525d('0x43')](_0x52000e['model'],qs[_0x525d('0x53')](_0x43deb1[_0x525d('0x41')][_0x525d('0x53')]));_0x33db3e[_0x525d('0x44')]=_0x33db3e[_0x525d('0x44')][_0x525d('0x45')]?_0x33db3e[_0x525d('0x44')]:_0x52000e[_0x525d('0x46')];if(!_0x43deb1['query']['hasOwnProperty'](_0x525d('0x47'))){_0x33db3e['limit']=qs['limit'](_0x43deb1['query'][_0x525d('0x30')]);_0x33db3e[_0x525d('0x2e')]=qs[_0x525d('0x2e')](_0x43deb1[_0x525d('0x41')]['offset']);}_0x33db3e[_0x525d('0x48')]=qs['sort'](_0x43deb1[_0x525d('0x41')]['sort']);_0x33db3e[_0x525d('0x68')]=qs[_0x525d('0x42')](_['pick'](_0x43deb1[_0x525d('0x41')],_0x52000e[_0x525d('0x42')]));_0x33db3e['where'][_0x525d('0x63')]=_0x45469b['id'];if(_0x43deb1[_0x525d('0x41')]['filter']){_0x33db3e[_0x525d('0x68')]=_[_0x525d('0x54')](_0x33db3e[_0x525d('0x68')],{'$or':_['map'](_0x33db3e['attributes'],function(_0x462a4f){var _0x1b7b60={};_0x1b7b60[_0x462a4f]={'$like':'%'+_0x43deb1['query'][_0x525d('0x4a')]+'%'};return _0x1b7b60;})});}_0x33db3e=_['merge']({},_0x33db3e,_0x43deb1['options']);return db[_0x525d('0x8a')]['count']({'where':_0x33db3e[_0x525d('0x68')]})[_0x525d('0x1f')](function(_0x55c39c){_0x5577fe[_0x525d('0x31')]=_0x55c39c;if(_0x43deb1[_0x525d('0x41')]['includeAll']){_0x33db3e[_0x525d('0x4e')]=[{'model':db[_0x525d('0x6e')],'as':_0x525d('0xa8'),'required':![]},{'model':db[_0x525d('0x97')],'as':'Owner','attributes':[_0x525d('0x38'),'fullname','internal'],'required':![]},{'model':db[_0x525d('0xa9')],'as':_0x525d('0xaa'),'attributes':['id',_0x525d('0x38'),'color'],'where':_0x43deb1[_0x525d('0x41')][_0x525d('0xab')]?{'id':_0x43deb1[_0x525d('0x41')][_0x525d('0xab')]}:undefined,'required':_0x43deb1['query'][_0x525d('0xab')]?!![]:![]}];}return db[_0x525d('0x8a')][_0x525d('0x50')](_0x33db3e);})[_0x525d('0x1f')](function(_0x576521){_0x5577fe[_0x525d('0xac')]=_0x576521;return _0x5577fe;});}})[_0x525d('0x1f')](respondWithFilteredResult(_0x4932cf,_0x33db3e))[_0x525d('0x51')](handleError(_0x4932cf,null));};exports[_0x525d('0xad')]=function(_0x17fb4d,_0x3a39a4,_0x50f273){return db[_0x525d('0x4f')][_0x525d('0x5a')]({'where':{'id':_0x17fb4d['params']['id']}})[_0x525d('0x1f')](handleEntityNotFound(_0x3a39a4,null))[_0x525d('0x1f')](function(_0x2a1e8e){if(_0x2a1e8e){return _0x2a1e8e[_0x525d('0xad')](_0x17fb4d[_0x525d('0x5e')][_0x525d('0x6a')],_[_0x525d('0xae')](_0x17fb4d[_0x525d('0x5e')],['ids','id'])||{})[_0x525d('0x8d')](function(_0x2a9208){for(var _0x241495=0x0;_0x241495<_0x17fb4d['body'][_0x525d('0x6a')][_0x525d('0x45')];_0x241495+=0x1){socket[_0x525d('0xaf')](_0x525d('0xb0'),{'UserId':Number(_0x17fb4d[_0x525d('0x5e')][_0x525d('0x6a')][_0x241495]),'OpenchannelAccountId':Number(_0x17fb4d[_0x525d('0x5f')]['id'])});}return _0x2a9208;});}})['then'](respondWithResult(_0x3a39a4,null))['catch'](handleError(_0x3a39a4,null));};exports['removeAgents']=function(_0x251452,_0x327822,_0x510d4b){return db[_0x525d('0x4f')][_0x525d('0x5a')]({'where':{'id':_0x251452[_0x525d('0x5f')]['id']}})[_0x525d('0x1f')](handleEntityNotFound(_0x327822,null))['then'](function(_0x42aaba){if(_0x42aaba){return _0x42aaba[_0x525d('0xb1')](_0x251452[_0x525d('0x41')]['ids'])[_0x525d('0x1f')](function(){if(_[_0x525d('0xb2')](_0x251452[_0x525d('0x41')][_0x525d('0x6a')])){for(var _0x6920fe=0x0;_0x6920fe<_0x251452[_0x525d('0x41')][_0x525d('0x6a')][_0x525d('0x45')];_0x6920fe+=0x1){socket[_0x525d('0xaf')]('userOpenchannelAccount:remove',{'UserId':Number(_0x251452[_0x525d('0x41')][_0x525d('0x6a')][_0x6920fe]),'OpenchannelAccountId':Number(_0x251452[_0x525d('0x5f')]['id'])});}}else{socket[_0x525d('0xaf')]('userOpenchannelAccount:remove',{'UserId':Number(_0x251452[_0x525d('0x41')][_0x525d('0x6a')]),'OpenchannelAccountId':Number(_0x251452[_0x525d('0x5f')]['id'])});}});}})[_0x525d('0x1f')](respondWithStatusCode(_0x327822,null))[_0x525d('0x51')](handleError(_0x327822,null));};exports[_0x525d('0xb3')]=function(_0x2251b0,_0x1746ba,_0x291ddf){var _0x466ba6={};var _0x6b0cc1={};var _0x4f21bc;var _0x50afff;return db[_0x525d('0x4f')]['findOne']({'where':{'id':_0x2251b0[_0x525d('0x5f')]['id']}})[_0x525d('0x1f')](handleEntityNotFound(_0x1746ba,null))[_0x525d('0x1f')](function(_0x3763f7){if(_0x3763f7){_0x4f21bc=_0x3763f7;_0x6b0cc1[_0x525d('0x46')]=_[_0x525d('0x40')](db[_0x525d('0x97')][_0x525d('0x3d')]);_0x6b0cc1[_0x525d('0x41')]=_[_0x525d('0x40')](_0x2251b0[_0x525d('0x41')]);_0x6b0cc1[_0x525d('0x42')]=_[_0x525d('0x43')](_0x6b0cc1[_0x525d('0x46')],_0x6b0cc1['query']);_0x466ba6['attributes']=_[_0x525d('0x43')](_0x6b0cc1['model'],qs[_0x525d('0x53')](_0x2251b0[_0x525d('0x41')][_0x525d('0x53')]));_0x466ba6[_0x525d('0x44')]=_0x466ba6['attributes'][_0x525d('0x45')]?_0x466ba6[_0x525d('0x44')]:_0x6b0cc1[_0x525d('0x46')];_0x466ba6[_0x525d('0x48')]=qs[_0x525d('0x49')](_0x2251b0[_0x525d('0x41')][_0x525d('0x49')]);_0x466ba6[_0x525d('0x68')]=qs[_0x525d('0x42')](_[_0x525d('0x67')](_0x2251b0['query'],_0x6b0cc1[_0x525d('0x42')]));if(_0x2251b0[_0x525d('0x41')][_0x525d('0x4a')]){_0x466ba6[_0x525d('0x68')]=_[_0x525d('0x54')](_0x466ba6['where'],{'$or':_[_0x525d('0x3c')](_0x466ba6[_0x525d('0x44')],function(_0x48d566){var _0x6ae73c={};_0x6ae73c[_0x48d566]={'$like':'%'+_0x2251b0[_0x525d('0x41')][_0x525d('0x4a')]+'%'};return _0x6ae73c;})});}_0x466ba6=_[_0x525d('0x54')]({},_0x466ba6,_0x2251b0[_0x525d('0x4c')]);return _0x4f21bc['getAgents'](_0x466ba6);}})[_0x525d('0x1f')](function(_0x4f2fa6){if(_0x4f2fa6){_0x50afff=_0x4f2fa6[_0x525d('0x45')];if(!_0x2251b0[_0x525d('0x41')][_0x525d('0x66')](_0x525d('0x47'))){_0x466ba6[_0x525d('0x30')]=qs[_0x525d('0x30')](_0x2251b0['query'][_0x525d('0x30')]);_0x466ba6[_0x525d('0x2e')]=qs[_0x525d('0x2e')](_0x2251b0[_0x525d('0x41')][_0x525d('0x2e')]);}return _0x4f21bc[_0x525d('0xb3')](_0x466ba6);}})[_0x525d('0x1f')](function(_0x23bcc0){if(_0x23bcc0){return _0x23bcc0?{'count':_0x50afff,'rows':_0x23bcc0}:null;}})[_0x525d('0x1f')](respondWithResult(_0x1746ba,null))[_0x525d('0x51')](handleError(_0x1746ba,null));};exports[_0x525d('0x39')]=function(_0x2af6d1,_0x3bf1fb,_0x1ae876){var _0x167347,_0x32d207,_0x3a0e79;if(_[_0x525d('0x78')](_0x2af6d1[_0x525d('0x5e')][_0x525d('0x5e')])||_0x2af6d1['body'][_0x525d('0x5e')]===''){throw new db[(_0x525d('0x6f'))][(_0x525d('0x70'))](_0x525d('0x77'));}if(_[_0x525d('0x78')](_0x2af6d1[_0x525d('0x5e')]['to'])){}_0x167347=_0x2af6d1[_0x525d('0x5e')]['to'];return db[_0x525d('0x4f')]['findOne']({'where':{'id':_0x2af6d1[_0x525d('0x5f')]['id']}})[_0x525d('0x1f')](handleEntityNotFound(_0x3bf1fb,null))[_0x525d('0x1f')](function(_0x4c4bdd){if(_0x4c4bdd){return db[_0x525d('0x4f')]['find']({'where':{'id':_0x4c4bdd['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x525d('0x6e')],'as':_0x525d('0x7d'),'where':{[_0x4c4bdd[_0x525d('0x79')]]:_0x167347},'limit':0x1,'order':[[_0x525d('0x73'),_0x525d('0x7e')]]}]}]})[_0x525d('0x1f')](handleEntityNotFound(_0x3bf1fb,null))[_0x525d('0x1f')](function(_0x55da49){if(_0x55da49&&_0x55da49[_0x525d('0x7c')]){_0x32d207=_0x55da49[_0x525d('0x35')]({'plain':!![]});if(_0x32d207[_0x525d('0x7c')]&&_0x32d207['List'][_0x525d('0x7d')][_0x525d('0x45')]){return _0x32d207[_0x525d('0x7c')]['Contacts'][0x0];}return db[_0x525d('0x6e')][_0x525d('0x55')](_[_0x525d('0x17')](_0x2af6d1['body'],{'firstName':_0x167347,[_0x55da49[_0x525d('0x79')]]:_0x167347,'phone':_0x167347,'ListId':_0x32d207['ListId']}));}})[_0x525d('0x1f')](handleEntityNotFound(_0x3bf1fb,null))['then'](function(_0x29bb29){if(_0x29bb29){_0x3a0e79=_0x29bb29;return db[_0x525d('0x8a')]['find']({'where':{'ContactId':_0x3a0e79['id'],'closed':![],'OpenchannelAccountId':_0x32d207['id']}})[_0x525d('0x1f')](function(_0x54a5d3){if(_0x54a5d3){return[_0x54a5d3,![]];}return db[_0x525d('0x8a')][_0x525d('0x55')]({'UserId':_0x2af6d1[_0x525d('0x56')]['id'],'ContactId':_0x3a0e79['id'],'OpenchannelAccountId':_0x32d207['id'],'lastMsgDirection':_0x525d('0xb4'),'firstMsgDirection':_0x525d('0xb4'),'Messages':[_['merge'](_0x2af6d1[_0x525d('0x5e')],{'read':![],'body':_0x2af6d1[_0x525d('0x5e')]['body'],'OpenchannelAccountId':_0x32d207['id'],'UserId':_0x2af6d1[_0x525d('0x56')]['id'],'ContactId':_0x3a0e79['id']})]},{'include':[{'model':db[_0x525d('0x93')],'as':'Messages'}]})['then'](function(_0x162cb1){return[_0x162cb1,!![]];});});}})[_0x525d('0x8d')](function(_0x196046,_0x4b48b9){if(_0x4b48b9){return _0x196046;}return db[_0x525d('0x93')][_0x525d('0x55')](_[_0x525d('0x54')](_0x2af6d1[_0x525d('0x5e')],{'read':![],'body':_0x2af6d1[_0x525d('0x5e')]['body'],'OpenchannelAccountId':_0x32d207['id'],'OpenchannelInteractionId':_0x196046['id'],'UserId':_0x2af6d1[_0x525d('0x56')]['id'],'ContactId':_0x3a0e79['id']}))['then'](function(_0x5c0f6f){_0x196046[_0x525d('0xb5')][_0x525d('0xb6')]=[];_0x196046[_0x525d('0xb5')][_0x525d('0xb6')][_0x525d('0xb7')](_0x5c0f6f[_0x525d('0xb5')]);return _0x196046;});});}})['then'](respondWithResult(_0x3bf1fb,null))['catch'](handleError(_0x3bf1fb,null));}; \ No newline at end of file +var _0x8248=['params','length','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','OpenchannelAccounts','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','OpenchannelAccountId','getDispositions','findOne','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','notify','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','Contacts','DESC','Applications','account','applications','list','orderBy','priority','asc','defaults','contact','firstName','threadId','OpenchannelInteraction','externalUrl','ContactId','lastName','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','OpenchannelApplication','bulkCreate','findAndCountAll','finally','getApplications','getInteractions','Owner','internal','Tag','Tags','tag','addAgents','omit','spread','emit','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','CmList','out','Messages','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','redis','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch'];(function(_0x51b0dc,_0x5307b7){var _0x13fa89=function(_0x2c880f){while(--_0x2c880f){_0x51b0dc['push'](_0x51b0dc['shift']());}};_0x13fa89(++_0x5307b7);}(_0x8248,0x67));var _0x8824=function(_0x4c7225,_0x4dc28d){_0x4c7225=_0x4c7225-0x0;var _0x19f1ed=_0x8248[_0x4c7225];return _0x19f1ed;};'use strict';var emlformat=require(_0x8824('0x0'));var rimraf=require(_0x8824('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8824('0x2'));var rp=require('request-promise');var moment=require(_0x8824('0x3'));var BPromise=require(_0x8824('0x4'));var Mustache=require('mustache');var util=require(_0x8824('0x5'));var path=require(_0x8824('0x6'));var sox=require(_0x8824('0x7'));var csv=require(_0x8824('0x8'));var ejs=require(_0x8824('0x9'));var fs=require('fs');var fs_extra=require(_0x8824('0xa'));var _=require(_0x8824('0xb'));var squel=require(_0x8824('0xc'));var crypto=require(_0x8824('0xd'));var jsforce=require(_0x8824('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x8824('0x8'));var querystring=require(_0x8824('0xf'));var Papa=require(_0x8824('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8824('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x8824('0x12'));var config=require(_0x8824('0x13'));var licenseUtil=require(_0x8824('0x14'));var db=require('../../mysqldb')['db'];config[_0x8824('0x15')]=_['defaults'](config[_0x8824('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x8824('0x16'))(new Redis(config[_0x8824('0x15')]));require(_0x8824('0x17'))[_0x8824('0x18')](socket);var jayson=require(_0x8824('0x19'));var client=jayson[_0x8824('0x1a')][_0x8824('0x1b')]({'port':0x232c});var client9002=jayson[_0x8824('0x1a')][_0x8824('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x447946,_0x367ffe,_0x34afb5,_0x37bb4c){return new BPromise(function(_0x21ebd4,_0x5ce033){var _0x1635e4=_0x37bb4c||client;return _0x1635e4['request'](_0x447946,_0x34afb5)['then'](function(_0x32cd83){logger[_0x8824('0x1c')](_0x8824('0x1d'),_0x367ffe,_0x8824('0x1e'));logger['debug'](_0x8824('0x1f'),_0x367ffe,'request\x20sent',JSON[_0x8824('0x20')](_0x32cd83));if(_0x32cd83['error']){if(_0x32cd83[_0x8824('0x21')][_0x8824('0x22')]===0x1f4){logger[_0x8824('0x21')](_0x8824('0x1d'),_0x367ffe,_0x32cd83[_0x8824('0x21')][_0x8824('0x23')]);return _0x5ce033(_0x32cd83[_0x8824('0x21')]['message']);}logger[_0x8824('0x21')](_0x8824('0x1d'),_0x367ffe,_0x32cd83[_0x8824('0x21')][_0x8824('0x23')]);return _0x21ebd4(_0x32cd83['error'][_0x8824('0x23')]);}else{logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x367ffe,_0x8824('0x1e'));_0x21ebd4(_0x32cd83[_0x8824('0x24')][_0x8824('0x23')]);}})['catch'](function(_0xd89d43){logger[_0x8824('0x21')](_0x8824('0x1d'),_0x367ffe,_0xd89d43);_0x5ce033(_0xd89d43);});});}function respondWithStatusCode(_0x44d4d6,_0x4a967d){_0x4a967d=_0x4a967d||0xcc;return function(_0x321695){if(_0x321695){return _0x44d4d6[_0x8824('0x25')](_0x4a967d);}return _0x44d4d6[_0x8824('0x26')](_0x4a967d)[_0x8824('0x27')]();};}function respondWithResult(_0x181562,_0xc22bd4){_0xc22bd4=_0xc22bd4||0xc8;return function(_0x253a41){if(_0x253a41){return _0x181562[_0x8824('0x26')](_0xc22bd4)[_0x8824('0x28')](_0x253a41);}};}function respondWithFilteredResult(_0xfe4d0b,_0x4bb39a){return function(_0x137523){if(_0x137523){var _0x5bac2d=typeof _0x4bb39a['offset']==='undefined'&&typeof _0x4bb39a[_0x8824('0x29')]===_0x8824('0x2a');var _0x2d946c=_0x137523[_0x8824('0x2b')];var _0x34260c=_0x5bac2d?0x0:_0x4bb39a['offset'];var _0x532b25=_0x5bac2d?_0x137523['count']:_0x4bb39a['offset']+_0x4bb39a['limit'];var _0x17a995;if(_0x532b25>=_0x2d946c){_0x532b25=_0x2d946c;_0x17a995=0xc8;}else{_0x17a995=0xce;}_0xfe4d0b['status'](_0x17a995);return _0xfe4d0b[_0x8824('0x2c')](_0x8824('0x2d'),_0x34260c+'-'+_0x532b25+'/'+_0x2d946c)[_0x8824('0x28')](_0x137523);}return null;};}function patchUpdates(_0x49dac8){return function(_0x51cf4e){try{jsonpatch[_0x8824('0x2e')](_0x51cf4e,_0x49dac8,!![]);}catch(_0xc91479){return BPromise[_0x8824('0x2f')](_0xc91479);}return _0x51cf4e['save']();};}function saveUpdates(_0x6fd49f,_0x329072){return function(_0x524976){if(_0x524976){return _0x524976[_0x8824('0x30')](_0x6fd49f)[_0x8824('0x31')](function(_0x1ce485){return _0x1ce485;});}return null;};}function removeEntity(_0x200adb,_0xc6cb29){return function(_0x4a4ca7){if(_0x4a4ca7){return _0x4a4ca7[_0x8824('0x32')]()[_0x8824('0x31')](function(){var _0x122b76=_0x4a4ca7[_0x8824('0x33')]({'plain':!![]});var _0x1714c6='OpenchannelAccounts';return db[_0x8824('0x34')][_0x8824('0x32')]({'where':{'type':_0x1714c6,'resourceId':_0x122b76['id']}})[_0x8824('0x31')](function(){return _0x4a4ca7;});})[_0x8824('0x31')](function(){_0x200adb[_0x8824('0x26')](0xcc)[_0x8824('0x27')]();});}};}function handleEntityNotFound(_0x19b775,_0x18f4ff){return function(_0xa86d7){if(!_0xa86d7){_0x19b775[_0x8824('0x25')](0x194);}return _0xa86d7;};}function handleError(_0x29be04,_0x572a7d){_0x572a7d=_0x572a7d||0x1f4;return function(_0x27af2c){logger[_0x8824('0x21')](_0x27af2c[_0x8824('0x35')]);if(_0x27af2c[_0x8824('0x36')]){delete _0x27af2c[_0x8824('0x36')];}_0x29be04['status'](_0x572a7d)[_0x8824('0x37')](_0x27af2c);};}exports[_0x8824('0x38')]=function(_0x5cff82,_0x2c95d2){var _0x452bc4={'include':[{'model':db[_0x8824('0x39')],'as':_0x8824('0x3a')}]},_0x1e7cae={},_0x312020={'count':0x0,'rows':[]};var _0xac8792=_[_0x8824('0x3b')](db[_0x8824('0x3c')][_0x8824('0x3d')],function(_0x3a1fd5){return{'name':_0x3a1fd5[_0x8824('0x3e')],'type':_0x3a1fd5[_0x8824('0x3f')]['key']};});_0x1e7cae[_0x8824('0x40')]=_[_0x8824('0x3b')](_0xac8792,_0x8824('0x36'));_0x1e7cae[_0x8824('0x41')]=_[_0x8824('0x42')](_0x5cff82[_0x8824('0x41')]);_0x1e7cae[_0x8824('0x43')]=_[_0x8824('0x44')](_0x1e7cae[_0x8824('0x40')],_0x1e7cae[_0x8824('0x41')]);_0x452bc4[_0x8824('0x45')]=_[_0x8824('0x44')](_0x1e7cae['model'],qs[_0x8824('0x46')](_0x5cff82[_0x8824('0x41')]['fields']));_0x452bc4[_0x8824('0x45')]=_0x452bc4[_0x8824('0x45')]['length']?_0x452bc4[_0x8824('0x45')]:_0x1e7cae[_0x8824('0x40')];if(!_0x5cff82['query'][_0x8824('0x47')](_0x8824('0x48'))){_0x452bc4[_0x8824('0x29')]=qs[_0x8824('0x29')](_0x5cff82['query'][_0x8824('0x29')]);_0x452bc4['offset']=qs[_0x8824('0x49')](_0x5cff82[_0x8824('0x41')]['offset']);}_0x452bc4[_0x8824('0x4a')]=qs['sort'](_0x5cff82[_0x8824('0x41')][_0x8824('0x4b')]);_0x452bc4[_0x8824('0x4c')]=qs[_0x8824('0x43')](_[_0x8824('0x4d')](_0x5cff82['query'],_0x1e7cae[_0x8824('0x43')]),_0xac8792);if(_0x5cff82['query'][_0x8824('0x4e')]){_0x452bc4['where']=_[_0x8824('0x4f')](_0x452bc4[_0x8824('0x4c')],{'$or':_[_0x8824('0x3b')](_0xac8792,function(_0x35502e){if(_0x35502e[_0x8824('0x3f')]!==_0x8824('0x50')){var _0x1c88ea={};_0x1c88ea[_0x35502e[_0x8824('0x36')]]={'$like':'%'+_0x5cff82['query'][_0x8824('0x4e')]+'%'};return _0x1c88ea;}})});}_0x452bc4=_[_0x8824('0x4f')]({},_0x452bc4,_0x5cff82[_0x8824('0x51')]);var _0x84fb40={'where':_0x452bc4['where']};return db[_0x8824('0x3c')]['count'](_0x84fb40)[_0x8824('0x31')](function(_0xfb9dc5){_0x312020[_0x8824('0x2b')]=_0xfb9dc5;if(_0x5cff82[_0x8824('0x41')][_0x8824('0x52')]){_0x452bc4['include']=[{'all':!![]}];}return db[_0x8824('0x3c')][_0x8824('0x53')](_0x452bc4);})[_0x8824('0x31')](function(_0x161bd6){_0x312020[_0x8824('0x54')]=_0x161bd6;return _0x312020;})['then'](respondWithFilteredResult(_0x2c95d2,_0x452bc4))[_0x8824('0x55')](handleError(_0x2c95d2,null));};exports['show']=function(_0x28a274,_0x3ac5f7){var _0x60dd4f={'raw':![],'where':{'id':_0x28a274[_0x8824('0x56')]['id']},'include':[{'model':db['Pause'],'as':_0x8824('0x3a')}]},_0x39853f={};_0x39853f[_0x8824('0x40')]=_['keys'](db['OpenchannelAccount'][_0x8824('0x3d')]);_0x39853f[_0x8824('0x41')]=_[_0x8824('0x42')](_0x28a274[_0x8824('0x41')]);_0x39853f['filters']=_[_0x8824('0x44')](_0x39853f[_0x8824('0x40')],_0x39853f[_0x8824('0x41')]);_0x60dd4f[_0x8824('0x45')]=_['intersection'](_0x39853f['model'],qs[_0x8824('0x46')](_0x28a274[_0x8824('0x41')][_0x8824('0x46')]));_0x60dd4f['attributes']=_0x60dd4f[_0x8824('0x45')][_0x8824('0x57')]?_0x60dd4f['attributes']:_0x39853f['model'];if(_0x28a274[_0x8824('0x41')][_0x8824('0x52')]){_0x60dd4f[_0x8824('0x58')]=[{'all':!![]}];}_0x60dd4f=_['merge']({},_0x60dd4f,_0x28a274[_0x8824('0x51')]);return db[_0x8824('0x3c')][_0x8824('0x59')](_0x60dd4f)[_0x8824('0x31')](handleEntityNotFound(_0x3ac5f7,null))[_0x8824('0x31')](respondWithResult(_0x3ac5f7,null))[_0x8824('0x55')](handleError(_0x3ac5f7,null));};exports['create']=function(_0x46b57b,_0xbe90c1){return db[_0x8824('0x3c')][_0x8824('0x5a')](_0x46b57b[_0x8824('0x5b')],{})[_0x8824('0x31')](function(_0x3e9cb5){var _0x1cb16f=_0x46b57b[_0x8824('0x5c')][_0x8824('0x33')]({'plain':!![]});if(!_0x1cb16f)throw new Error(_0x8824('0x5d'));if(_0x1cb16f['role']===_0x8824('0x5c')){var _0x46b8ac=_0x3e9cb5[_0x8824('0x33')]({'plain':!![]});var _0x27e5e9=_0x8824('0x5e');return db['UserProfileSection']['find']({'where':{'name':_0x27e5e9,'userProfileId':_0x1cb16f[_0x8824('0x5f')]},'raw':!![]})[_0x8824('0x31')](function(_0x404251){if(_0x404251&&_0x404251['autoAssociation']===0x0){return db[_0x8824('0x34')]['create']({'name':_0x46b8ac[_0x8824('0x36')],'resourceId':_0x46b8ac['id'],'type':_0x404251[_0x8824('0x36')],'sectionId':_0x404251['id']},{})[_0x8824('0x31')](function(){return _0x3e9cb5;});}else{return _0x3e9cb5;}})[_0x8824('0x55')](function(_0x1abc59){logger[_0x8824('0x21')](_0x8824('0x60'),_0x1abc59);throw _0x1abc59;});}return _0x3e9cb5;})[_0x8824('0x31')](respondWithResult(_0xbe90c1,0xc9))['catch'](handleError(_0xbe90c1,null));};exports[_0x8824('0x30')]=function(_0x244dd4,_0x3f62d6){if(_0x244dd4[_0x8824('0x5b')]['id']){delete _0x244dd4['body']['id'];}return db[_0x8824('0x3c')][_0x8824('0x59')]({'where':{'id':_0x244dd4['params']['id']},'include':[{'model':db[_0x8824('0x39')],'as':'mandatoryDispositionPause'}]})[_0x8824('0x31')](handleEntityNotFound(_0x3f62d6,null))['then'](saveUpdates(_0x244dd4[_0x8824('0x5b')],null))[_0x8824('0x31')](respondWithResult(_0x3f62d6,null))[_0x8824('0x55')](handleError(_0x3f62d6,null));};exports[_0x8824('0x32')]=function(_0x215358,_0x484025){return db[_0x8824('0x3c')]['find']({'where':{'id':_0x215358[_0x8824('0x56')]['id']}})['then'](handleEntityNotFound(_0x484025,null))['then'](removeEntity(_0x484025,null))[_0x8824('0x55')](handleError(_0x484025,null));};exports[_0x8824('0x61')]=function(_0x11f001,_0x112682){return db['OpenchannelAccount'][_0x8824('0x61')]()['then'](respondWithResult(_0x112682,null))['catch'](handleError(_0x112682,null));};exports[_0x8824('0x62')]=function(_0x442588,_0x18cc36,_0x24d8a7){if(_0x442588[_0x8824('0x5b')]['id']){delete _0x442588[_0x8824('0x5b')]['id'];}return db[_0x8824('0x3c')]['find']({'where':{'id':_0x442588[_0x8824('0x56')]['id']}})[_0x8824('0x31')](handleEntityNotFound(_0x18cc36,null))['then'](function(_0x4d680e){if(_0x4d680e){_0x442588[_0x8824('0x5b')][_0x8824('0x63')]=_0x4d680e['id'];return db['Disposition']['create'](_0x442588[_0x8824('0x5b')]);}})[_0x8824('0x31')](respondWithResult(_0x18cc36,null))[_0x8824('0x55')](handleError(_0x18cc36,null));};exports[_0x8824('0x64')]=function(_0x10f942,_0x24a9b0,_0x17b563){var _0x3c3e3b={'raw':![],'where':{}};var _0xae8665={};var _0x42d7bb={'count':0x0,'rows':[]};return db[_0x8824('0x3c')][_0x8824('0x65')]({'where':{'id':_0x10f942[_0x8824('0x56')]['id']}})[_0x8824('0x31')](handleEntityNotFound(_0x24a9b0,null))[_0x8824('0x31')](function(_0x1476d8){if(_0x1476d8){_0xae8665[_0x8824('0x40')]=_[_0x8824('0x42')](db[_0x8824('0x66')][_0x8824('0x3d')]);_0xae8665['query']=_['keys'](_0x10f942['query']);_0xae8665[_0x8824('0x43')]=_['intersection'](_0xae8665[_0x8824('0x40')],_0xae8665[_0x8824('0x41')]);_0x3c3e3b[_0x8824('0x45')]=_['intersection'](_0xae8665[_0x8824('0x40')],qs[_0x8824('0x46')](_0x10f942[_0x8824('0x41')][_0x8824('0x46')]));_0x3c3e3b[_0x8824('0x45')]=_0x3c3e3b[_0x8824('0x45')][_0x8824('0x57')]?_0x3c3e3b[_0x8824('0x45')]:_0xae8665[_0x8824('0x40')];if(!_0x10f942['query'][_0x8824('0x47')](_0x8824('0x48'))){_0x3c3e3b['limit']=qs[_0x8824('0x29')](_0x10f942[_0x8824('0x41')][_0x8824('0x29')]);_0x3c3e3b[_0x8824('0x49')]=qs[_0x8824('0x49')](_0x10f942['query'][_0x8824('0x49')]);}_0x3c3e3b[_0x8824('0x4a')]=qs[_0x8824('0x4b')](_0x10f942[_0x8824('0x41')][_0x8824('0x4b')]);_0x3c3e3b[_0x8824('0x4c')]=qs[_0x8824('0x43')](_['pick'](_0x10f942[_0x8824('0x41')],_0xae8665[_0x8824('0x43')]));_0x3c3e3b['where'][_0x8824('0x63')]=_0x1476d8['id'];if(_0x10f942[_0x8824('0x41')][_0x8824('0x4e')]){_0x3c3e3b[_0x8824('0x4c')]=_[_0x8824('0x4f')](_0x3c3e3b['where'],{'$or':_[_0x8824('0x3b')](_0x3c3e3b[_0x8824('0x45')],function(_0x33d0e6){var _0x22ddd5={};_0x22ddd5[_0x33d0e6]={'$like':'%'+_0x10f942[_0x8824('0x41')][_0x8824('0x4e')]+'%'};return _0x22ddd5;})});}_0x3c3e3b=_[_0x8824('0x4f')]({},_0x3c3e3b,_0x10f942['options']);return db[_0x8824('0x66')][_0x8824('0x2b')]({'where':_0x3c3e3b[_0x8824('0x4c')]})[_0x8824('0x31')](function(_0x187112){_0x42d7bb['count']=_0x187112;if(_0x10f942[_0x8824('0x41')][_0x8824('0x52')]){_0x3c3e3b['include']=[{'all':!![]}];}return db[_0x8824('0x66')][_0x8824('0x53')](_0x3c3e3b);})[_0x8824('0x31')](function(_0x497911){_0x42d7bb[_0x8824('0x54')]=_0x497911;return _0x42d7bb;});}})['then'](respondWithFilteredResult(_0x24a9b0,_0x3c3e3b))[_0x8824('0x55')](handleError(_0x24a9b0,null));};exports[_0x8824('0x67')]=function(_0x4125e3,_0x5ba86c,_0x3be598){return db[_0x8824('0x3c')][_0x8824('0x59')]({'where':{'id':_0x4125e3[_0x8824('0x56')]['id']}})[_0x8824('0x31')](handleEntityNotFound(_0x5ba86c,null))['then'](function(_0x5515a4){if(_0x5515a4){return _0x5515a4[_0x8824('0x67')](_0x4125e3[_0x8824('0x41')][_0x8824('0x68')]);}})['then'](respondWithStatusCode(_0x5ba86c,null))[_0x8824('0x55')](handleError(_0x5ba86c,null));};exports[_0x8824('0x69')]=function(_0x21c1e2,_0x46956e,_0x43775c){if(_0x21c1e2['body']['id']){delete _0x21c1e2[_0x8824('0x5b')]['id'];}return db[_0x8824('0x3c')][_0x8824('0x59')]({'where':{'id':_0x21c1e2[_0x8824('0x56')]['id']}})[_0x8824('0x31')](handleEntityNotFound(_0x46956e,null))[_0x8824('0x31')](function(_0x10747b){if(_0x10747b){_0x21c1e2['body'][_0x8824('0x63')]=_0x10747b['id'];return db['CannedAnswer'][_0x8824('0x5a')](_0x21c1e2['body']);}})[_0x8824('0x31')](respondWithResult(_0x46956e,null))[_0x8824('0x55')](handleError(_0x46956e,null));};exports['getAnswers']=function(_0x30868b,_0x3bc341,_0x48465a){var _0x2eb894={'raw':![],'where':{}};var _0x541754={};var _0x320f16={'count':0x0,'rows':[]};return db[_0x8824('0x3c')]['findOne']({'where':{'id':_0x30868b['params']['id']}})[_0x8824('0x31')](handleEntityNotFound(_0x3bc341,null))[_0x8824('0x31')](function(_0x1a91c7){if(_0x1a91c7){_0x541754[_0x8824('0x40')]=_[_0x8824('0x42')](db['CannedAnswer']['rawAttributes']);_0x541754[_0x8824('0x41')]=_['keys'](_0x30868b['query']);_0x541754['filters']=_[_0x8824('0x44')](_0x541754[_0x8824('0x40')],_0x541754[_0x8824('0x41')]);_0x2eb894[_0x8824('0x45')]=_[_0x8824('0x44')](_0x541754[_0x8824('0x40')],qs[_0x8824('0x46')](_0x30868b[_0x8824('0x41')][_0x8824('0x46')]));_0x2eb894[_0x8824('0x45')]=_0x2eb894[_0x8824('0x45')]['length']?_0x2eb894[_0x8824('0x45')]:_0x541754[_0x8824('0x40')];if(!_0x30868b[_0x8824('0x41')][_0x8824('0x47')](_0x8824('0x48'))){_0x2eb894[_0x8824('0x29')]=qs[_0x8824('0x29')](_0x30868b[_0x8824('0x41')]['limit']);_0x2eb894[_0x8824('0x49')]=qs[_0x8824('0x49')](_0x30868b[_0x8824('0x41')]['offset']);}_0x2eb894[_0x8824('0x4a')]=qs[_0x8824('0x4b')](_0x30868b[_0x8824('0x41')][_0x8824('0x4b')]);_0x2eb894['where']=qs[_0x8824('0x43')](_[_0x8824('0x4d')](_0x30868b['query'],_0x541754[_0x8824('0x43')]));_0x2eb894['where'][_0x8824('0x63')]=_0x1a91c7['id'];if(_0x30868b['query'][_0x8824('0x4e')]){_0x2eb894[_0x8824('0x4c')]=_[_0x8824('0x4f')](_0x2eb894[_0x8824('0x4c')],{'$or':_[_0x8824('0x3b')](_0x2eb894['attributes'],function(_0x50bc87){var _0x58cd08={};_0x58cd08[_0x50bc87]={'$like':'%'+_0x30868b[_0x8824('0x41')][_0x8824('0x4e')]+'%'};return _0x58cd08;})});}_0x2eb894=_[_0x8824('0x4f')]({},_0x2eb894,_0x30868b[_0x8824('0x51')]);return db['CannedAnswer'][_0x8824('0x2b')]({'where':_0x2eb894[_0x8824('0x4c')]})[_0x8824('0x31')](function(_0x375ab7){_0x320f16['count']=_0x375ab7;if(_0x30868b[_0x8824('0x41')]['includeAll']){_0x2eb894[_0x8824('0x58')]=[{'all':!![]}];}return db[_0x8824('0x6a')][_0x8824('0x53')](_0x2eb894);})['then'](function(_0xca0f36){_0x320f16['rows']=_0xca0f36;return _0x320f16;});}})[_0x8824('0x31')](respondWithFilteredResult(_0x3bc341,_0x2eb894))['catch'](handleError(_0x3bc341,null));};exports[_0x8824('0x6b')]=function(_0x3e6feb,_0x1ad890,_0x484e25){return db[_0x8824('0x3c')][_0x8824('0x59')]({'where':{'id':_0x3e6feb[_0x8824('0x56')]['id']}})[_0x8824('0x31')](handleEntityNotFound(_0x1ad890,null))[_0x8824('0x31')](function(_0x135008){if(_0x135008){return _0x135008['removeAnswers'](_0x3e6feb[_0x8824('0x41')][_0x8824('0x68')]);}})[_0x8824('0x31')](respondWithStatusCode(_0x1ad890,null))['catch'](handleError(_0x1ad890,null));};exports[_0x8824('0x6c')]=function(_0x2beffc,_0x25d193,_0x3cce8f){var _0x9c20a0={'body':_0x2beffc[_0x8824('0x5b')],'channel':_0x8824('0x6d')};var _0x160884=[];var _0x3e2425=[];var _0x10f73d={};var _0x2a7115=![];return db[_0x8824('0x6e')][_0x8824('0x61')]()[_0x8824('0x31')](function(_0x112cee){if(!_0x112cee){throw new db[(_0x8824('0x6f'))][(_0x8824('0x70'))](_0x8824('0x71'));}_0x160884=_[_0x8824('0x72')](_[_0x8824('0x42')](_0x112cee),[_0x8824('0x73'),_0x8824('0x74')]);_0x3e2425=_[_0x8824('0x72')](_['keys'](_0x112cee),['createdAt',_0x8824('0x74'),_0x8824('0x75'),_0x8824('0x76')]);if(_0x2beffc[_0x8824('0x5b')]['id']){delete _0x2beffc[_0x8824('0x5b')]['id'];}if(_[_0x8824('0x77')](_0x2beffc[_0x8824('0x5b')][_0x8824('0x78')])){throw new db[(_0x8824('0x6f'))][(_0x8824('0x70'))](_0x8824('0x79'));}if(_[_0x8824('0x77')](_0x2beffc[_0x8824('0x5b')][_0x8824('0x5b')])||_0x2beffc['body'][_0x8824('0x5b')]===''){throw new db[(_0x8824('0x6f'))][(_0x8824('0x70'))](_0x8824('0x7a'));}if(_[_0x8824('0x77')](_0x2beffc[_0x8824('0x5b')][_0x8824('0x7b')])){throw new db[(_0x8824('0x6f'))][(_0x8824('0x70'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3e2425);}if(!_[_0x8824('0x7c')](_0x3e2425,_0x2beffc['body']['mapKey'])){throw new db[(_0x8824('0x6f'))][(_0x8824('0x70'))](_0x8824('0x7d')+_0x3e2425);}_0x10f73d[_0x2beffc[_0x8824('0x5b')][_0x8824('0x7b')]]=_0x2beffc[_0x8824('0x5b')][_0x8824('0x78')];})[_0x8824('0x31')](function(){return db[_0x8824('0x3c')][_0x8824('0x59')]({'where':{'id':_0x2beffc['params']['id']},'include':[{'model':db['CmList'],'as':_0x8824('0x7e'),'include':[{'model':db[_0x8824('0x6e')],'as':_0x8824('0x7f'),'where':_0x10f73d,'limit':0x1,'order':[[_0x8824('0x74'),_0x8824('0x80')]]}]},{'model':db['OpenchannelApplication'],'as':_0x8824('0x81')}]});})[_0x8824('0x31')](handleEntityNotFound(_0x25d193,null))[_0x8824('0x31')](function(_0x1473d5){if(_0x1473d5&&_0x1473d5[_0x8824('0x7e')]){_0x9c20a0[_0x8824('0x82')]=_0x1473d5;_0x9c20a0[_0x8824('0x83')]=_0x1473d5[_0x8824('0x81')];_0x9c20a0[_0x8824('0x84')]=_0x1473d5['List'];_0x9c20a0[_0x8824('0x83')]=_[_0x8824('0x85')](_0x9c20a0['applications'],[_0x8824('0x86')],[_0x8824('0x87')]);if(_0x9c20a0[_0x8824('0x82')][_0x8824('0x81')]){delete _0x9c20a0[_0x8824('0x82')][_0x8824('0x81')];}if(_0x9c20a0[_0x8824('0x82')][_0x8824('0x7e')]&&_0x9c20a0['account'][_0x8824('0x7e')][_0x8824('0x7f')][_0x8824('0x57')]){return _0x9c20a0['account'][_0x8824('0x7e')][_0x8824('0x7f')][0x0];}var _0x25d1fa=_[_0x8824('0x88')](_0x2beffc[_0x8824('0x5b')],{'firstName':_0x2beffc[_0x8824('0x5b')][_0x8824('0x78')],'ListId':_0x1473d5[_0x8824('0x76')]});_0x25d1fa[_0x2beffc['body'][_0x8824('0x7b')]]=_0x2beffc[_0x8824('0x5b')]['from'];return db[_0x8824('0x6e')][_0x8824('0x5a')](_0x25d1fa,{'fields':_0x160884,'raw':!![]});}})['then'](handleEntityNotFound(_0x25d193,null))[_0x8824('0x31')](function(_0x20fd8a){_0x9c20a0[_0x8824('0x89')]=_0x20fd8a;if(_0x20fd8a){var _0x3f707c={'ContactId':_0x20fd8a['id'],'OpenchannelAccountId':_0x2beffc[_0x8824('0x56')]['id'],'from':(_0x20fd8a[_0x8824('0x8a')]||'')+'\x20'+(_0x20fd8a['lastName']||'')};var _0x226978={'OpenchannelAccountId':_0x2beffc[_0x8824('0x56')]['id'],'closed':![]};if(_0x2beffc[_0x8824('0x5b')][_0x8824('0x8b')]){_0x226978['threadId']=_0x2beffc[_0x8824('0x5b')]['threadId'];return db[_0x8824('0x8c')][_0x8824('0x59')]({'where':_0x226978})[_0x8824('0x31')](function(_0x50d81a){if(_0x50d81a){return[_0x50d81a,![]];}_0x3f707c[_0x8824('0x8b')]=_0x2beffc['body']['threadId'];_0x3f707c[_0x8824('0x8d')]=_0x2beffc[_0x8824('0x5b')][_0x8824('0x8d')];return db[_0x8824('0x8c')][_0x8824('0x5a')](_0x3f707c)[_0x8824('0x31')](function(_0x3f94e9){return[_0x3f94e9,!![]];});});}else{_0x226978[_0x8824('0x8b')]=null;}_0x226978[_0x8824('0x8e')]=_0x20fd8a['id'];return db[_0x8824('0x8c')][_0x8824('0x59')]({'where':_0x226978})[_0x8824('0x31')](function(_0x4d0f41){if(_0x4d0f41){return[_0x4d0f41,![]];}return db['OpenchannelInteraction'][_0x8824('0x5a')](_0x3f707c)[_0x8824('0x31')](function(_0x5328fd){return[_0x5328fd,!![]];});});}})['spread'](function(_0x220ad5,_0x2de9c8){if(_0x220ad5){_0x2a7115=_0x2de9c8;if(!_0x2de9c8){var _0x30d533={'from':(_0x9c20a0['contact'][_0x8824('0x8a')]||'')+'\x20'+(_0x9c20a0[_0x8824('0x89')][_0x8824('0x8f')]||'')};if(_0x2beffc['body'][_0x8824('0x8b')]&&_0x2beffc[_0x8824('0x5b')][_0x8824('0x90')]&&_0x2beffc[_0x8824('0x5b')][_0x8824('0x8b')]!=_0x2beffc['body'][_0x8824('0x90')]){_0x30d533[_0x8824('0x8b')]=_0x2beffc['body'][_0x8824('0x90')];}return _0x220ad5[_0x8824('0x30')](_0x30d533);}else{return _0x220ad5;}}})[_0x8824('0x31')](function(_0x25f6f4){_0x9c20a0[_0x8824('0x91')]=_0x25f6f4[_0x8824('0x33')]({'plain':!![]});_0x9c20a0['interaction'][_0x8824('0x92')]=_0x2a7115;if(_0x9c20a0[_0x8824('0x91')][_0x8824('0x92')]){if(_0x9c20a0[_0x8824('0x82')][_0x8824('0x93')]){_0x9c20a0[_0x8824('0x83')][_0x8824('0x94')]({'id':0x0,'priority':_0x9c20a0[_0x8824('0x83')][_0x8824('0x57')]+0x1,'app':_0x8824('0x95'),'appdata':_0x8824('0x96'),'interval':_0x8824('0x97')});}}return db[_0x8824('0x98')][_0x8824('0x5a')]({'body':_0x2beffc['body'][_0x8824('0x5b')],'OpenchannelAccountId':_0x2beffc[_0x8824('0x56')]['id'],'OpenchannelInteractionId':_0x25f6f4['id'],'direction':'in','ContactId':_0x9c20a0[_0x8824('0x89')]['id'],'AttachmentId':_0x2beffc[_0x8824('0x5b')]['AttachmentId']});})[_0x8824('0x31')](function(_0xaa912c){_0x9c20a0[_0x8824('0x23')]=_0xaa912c;if(_0x9c20a0[_0x8824('0x91')][_0x8824('0x99')]){return db[_0x8824('0x9a')][_0x8824('0x59')]({'attributes':['id',_0x8824('0x36')],'where':{'id':_0x9c20a0[_0x8824('0x91')][_0x8824('0x99')]}})[_0x8824('0x31')](function(_0x1420e2){if(_0x1420e2){_0x9c20a0[_0x8824('0x83')][_0x8824('0x9b')]({'id':0x0,'priority':0x0,'app':_0x8824('0x9c'),'appdata':_0x1420e2[_0x8824('0x36')]+','+(_0x9c20a0[_0x8824('0x82')][_0x8824('0x9d')]||0xa),'interval':_0x8824('0x97')});_0x9c20a0[_0x8824('0x9e')]=![];}return respondWithRpcPromise(_0x8824('0x9f'),_0x8824('0xa0'),_0x9c20a0);});}return respondWithRpcPromise(_0x8824('0x9f'),'startRouting',_0x9c20a0);})[_0x8824('0x31')](function(_0x27aab8){respondWithRpcPromise(_0x8824('0xa1'),_0x8824('0xa1'),{'event':_0x8824('0x6c'),'message':_0x27aab8},client9002);return _0x27aab8;})[_0x8824('0x31')](respondWithResult(_0x25d193,null))[_0x8824('0x55')](handleError(_0x25d193,null));};exports[_0x8824('0xa2')]=function(_0xe3229b,_0xb46043){var _0x3e6ddc=_0xe3229b['params']['id'];var _0xe10c06=_0xe3229b['body'];var _0x46aeeb=0xc8;var _0x1ae778=null;return db[_0x8824('0xa3')][_0x8824('0xa4')]({'isolationLevel':db[_0x8824('0xa3')][_0x8824('0xa5')][_0x8824('0xa6')]['READ_COMMITTED']},function(_0x4566a4){return db[_0x8824('0x3c')]['findOne']({'where':{'id':_0x3e6ddc},'transaction':_0x4566a4})[_0x8824('0x31')](function(_0x273225){if(_0x273225){return db[_0x8824('0xa7')][_0x8824('0x32')]({'where':{'OpenchannelAccountId':_0x3e6ddc},'transaction':_0x4566a4})[_0x8824('0x31')](function(){var _0x26ca8d=_[_0x8824('0x3b')](_0xe10c06,function(_0x294098){_0x294098[_0x8824('0x63')]=_0x3e6ddc;return _0x294098;});return db[_0x8824('0xa7')][_0x8824('0xa8')](_0x26ca8d,{'transaction':_0x4566a4});});}else{_0x46aeeb=0x194;_0x1ae778=[];}});})[_0x8824('0x31')](function(){if(_0x46aeeb!==0x194){return db[_0x8824('0xa7')][_0x8824('0xa9')]({'where':{'OpenchannelAccountId':_0x3e6ddc},'order':_0x8824('0x86')})[_0x8824('0x31')](function(_0x25f1f7){_0x1ae778=_0x25f1f7;});}})[_0x8824('0x55')](function(_0x316e4f){_0x46aeeb=0x1f4;logger[_0x8824('0x21')](_0x316e4f[_0x8824('0x35')]);if(_0x316e4f['name']){delete _0x316e4f[_0x8824('0x36')];}_0x1ae778=_0x316e4f;})[_0x8824('0xaa')](function(){if(_0x1ae778===null){_0xb46043[_0x8824('0x25')](_0x46aeeb);}else{if(_0x46aeeb===0x1f4){_0xb46043[_0x8824('0x26')](_0x46aeeb)['send'](_0x1ae778);}else{_0xb46043[_0x8824('0x26')](_0x46aeeb)[_0x8824('0x28')](_0x1ae778);}}});};exports[_0x8824('0xab')]=function(_0x505525,_0x5040f6,_0x25d0eb){var _0x13b679={};var _0x5e146e={};var _0x407727;var _0x136e1c;return db[_0x8824('0x3c')][_0x8824('0x65')]({'where':{'id':_0x505525[_0x8824('0x56')]['id']}})['then'](handleEntityNotFound(_0x5040f6,null))[_0x8824('0x31')](function(_0x1487ec){if(_0x1487ec){_0x407727=_0x1487ec;_0x5e146e[_0x8824('0x40')]=_[_0x8824('0x42')](db[_0x8824('0xa7')]['rawAttributes']);_0x5e146e[_0x8824('0x41')]=_[_0x8824('0x42')](_0x505525['query']);_0x5e146e[_0x8824('0x43')]=_['intersection'](_0x5e146e[_0x8824('0x40')],_0x5e146e[_0x8824('0x41')]);_0x13b679[_0x8824('0x45')]=_['intersection'](_0x5e146e[_0x8824('0x40')],qs[_0x8824('0x46')](_0x505525[_0x8824('0x41')][_0x8824('0x46')]));_0x13b679[_0x8824('0x45')]=_0x13b679[_0x8824('0x45')][_0x8824('0x57')]?_0x13b679[_0x8824('0x45')]:_0x5e146e[_0x8824('0x40')];_0x13b679[_0x8824('0x4a')]=qs['sort'](_0x505525[_0x8824('0x41')]['sort']);_0x13b679[_0x8824('0x4c')]=qs[_0x8824('0x43')](_['pick'](_0x505525[_0x8824('0x41')],_0x5e146e[_0x8824('0x43')]));if(_0x505525[_0x8824('0x41')][_0x8824('0x4e')]){_0x13b679[_0x8824('0x4c')]=_[_0x8824('0x4f')](_0x13b679[_0x8824('0x4c')],{'$or':_[_0x8824('0x3b')](_0x13b679[_0x8824('0x45')],function(_0x5baf15){var _0x5b7299={};_0x5b7299[_0x5baf15]={'$like':'%'+_0x505525['query']['filter']+'%'};return _0x5b7299;})});}_0x13b679=_[_0x8824('0x4f')]({},_0x13b679,_0x505525['options']);return _0x407727[_0x8824('0xab')](_0x13b679);}})[_0x8824('0x31')](function(_0x31a7c3){if(_0x31a7c3){_0x136e1c=_0x31a7c3['length'];if(!_0x505525['query'][_0x8824('0x47')](_0x8824('0x48'))){_0x13b679['limit']=qs[_0x8824('0x29')](_0x505525[_0x8824('0x41')][_0x8824('0x29')]);_0x13b679['offset']=qs[_0x8824('0x49')](_0x505525[_0x8824('0x41')][_0x8824('0x49')]);}return _0x407727[_0x8824('0xab')](_0x13b679);}})[_0x8824('0x31')](function(_0x23b368){if(_0x23b368){return _0x23b368?{'count':_0x136e1c,'rows':_0x23b368}:null;}})['then'](respondWithResult(_0x5040f6,null))['catch'](handleError(_0x5040f6,null));};exports[_0x8824('0xac')]=function(_0x2904b3,_0x503ec5,_0x2faccf){var _0x1f5fb4={'raw':![],'where':{}};var _0x2726a2={};var _0x9c18e3={'count':0x0,'rows':[]};return db[_0x8824('0x3c')][_0x8824('0x65')]({'where':{'id':_0x2904b3[_0x8824('0x56')]['id']}})[_0x8824('0x31')](handleEntityNotFound(_0x503ec5,null))[_0x8824('0x31')](function(_0x58cd10){if(_0x58cd10){_0x2726a2[_0x8824('0x40')]=_[_0x8824('0x42')](db[_0x8824('0x8c')][_0x8824('0x3d')]);_0x2726a2[_0x8824('0x41')]=_[_0x8824('0x42')](_0x2904b3[_0x8824('0x41')]);_0x2726a2[_0x8824('0x43')]=_['intersection'](_0x2726a2[_0x8824('0x40')],_0x2726a2[_0x8824('0x41')]);_0x1f5fb4[_0x8824('0x45')]=_[_0x8824('0x44')](_0x2726a2['model'],qs[_0x8824('0x46')](_0x2904b3[_0x8824('0x41')]['fields']));_0x1f5fb4[_0x8824('0x45')]=_0x1f5fb4[_0x8824('0x45')][_0x8824('0x57')]?_0x1f5fb4['attributes']:_0x2726a2[_0x8824('0x40')];if(!_0x2904b3[_0x8824('0x41')][_0x8824('0x47')](_0x8824('0x48'))){_0x1f5fb4[_0x8824('0x29')]=qs[_0x8824('0x29')](_0x2904b3[_0x8824('0x41')]['limit']);_0x1f5fb4[_0x8824('0x49')]=qs[_0x8824('0x49')](_0x2904b3[_0x8824('0x41')]['offset']);}_0x1f5fb4['order']=qs['sort'](_0x2904b3[_0x8824('0x41')][_0x8824('0x4b')]);_0x1f5fb4['where']=qs['filters'](_['pick'](_0x2904b3[_0x8824('0x41')],_0x2726a2[_0x8824('0x43')]));_0x1f5fb4[_0x8824('0x4c')]['OpenchannelAccountId']=_0x58cd10['id'];if(_0x2904b3[_0x8824('0x41')]['filter']){_0x1f5fb4[_0x8824('0x4c')]=_[_0x8824('0x4f')](_0x1f5fb4[_0x8824('0x4c')],{'$or':_[_0x8824('0x3b')](_0x1f5fb4[_0x8824('0x45')],function(_0x39db4d){var _0x19ab0c={};_0x19ab0c[_0x39db4d]={'$like':'%'+_0x2904b3['query'][_0x8824('0x4e')]+'%'};return _0x19ab0c;})});}_0x1f5fb4=_[_0x8824('0x4f')]({},_0x1f5fb4,_0x2904b3[_0x8824('0x51')]);return db[_0x8824('0x8c')][_0x8824('0x2b')]({'where':_0x1f5fb4['where']})[_0x8824('0x31')](function(_0x112ea4){_0x9c18e3[_0x8824('0x2b')]=_0x112ea4;if(_0x2904b3[_0x8824('0x41')][_0x8824('0x52')]){_0x1f5fb4[_0x8824('0x58')]=[{'model':db[_0x8824('0x6e')],'as':'Contact','required':![]},{'model':db[_0x8824('0x9a')],'as':_0x8824('0xad'),'attributes':['name','fullname',_0x8824('0xae')],'required':![]},{'model':db[_0x8824('0xaf')],'as':_0x8824('0xb0'),'attributes':['id',_0x8824('0x36'),'color'],'where':_0x2904b3['query'][_0x8824('0xb1')]?{'id':_0x2904b3['query'][_0x8824('0xb1')]}:undefined,'required':_0x2904b3[_0x8824('0x41')][_0x8824('0xb1')]?!![]:![]}];}return db[_0x8824('0x8c')][_0x8824('0x53')](_0x1f5fb4);})[_0x8824('0x31')](function(_0x54f4c1){_0x9c18e3[_0x8824('0x54')]=_0x54f4c1;return _0x9c18e3;});}})[_0x8824('0x31')](respondWithFilteredResult(_0x503ec5,_0x1f5fb4))[_0x8824('0x55')](handleError(_0x503ec5,null));};exports[_0x8824('0xb2')]=function(_0x6fcfb3,_0x186c2f,_0x26bf4f){return db[_0x8824('0x3c')]['find']({'where':{'id':_0x6fcfb3[_0x8824('0x56')]['id']}})[_0x8824('0x31')](handleEntityNotFound(_0x186c2f,null))[_0x8824('0x31')](function(_0x2a4821){if(_0x2a4821){return _0x2a4821[_0x8824('0xb2')](_0x6fcfb3[_0x8824('0x5b')][_0x8824('0x68')],_[_0x8824('0xb3')](_0x6fcfb3[_0x8824('0x5b')],[_0x8824('0x68'),'id'])||{})[_0x8824('0xb4')](function(_0x59b414){for(var _0xe86fbf=0x0;_0xe86fbf<_0x6fcfb3[_0x8824('0x5b')][_0x8824('0x68')][_0x8824('0x57')];_0xe86fbf+=0x1){socket[_0x8824('0xb5')]('userOpenchannelAccount:save',{'UserId':Number(_0x6fcfb3[_0x8824('0x5b')][_0x8824('0x68')][_0xe86fbf]),'OpenchannelAccountId':Number(_0x6fcfb3[_0x8824('0x56')]['id'])});}return _0x59b414;});}})[_0x8824('0x31')](respondWithResult(_0x186c2f,null))[_0x8824('0x55')](handleError(_0x186c2f,null));};exports[_0x8824('0xb6')]=function(_0x297cbc,_0x1cebc2,_0x142269){return db[_0x8824('0x3c')][_0x8824('0x59')]({'where':{'id':_0x297cbc[_0x8824('0x56')]['id']}})[_0x8824('0x31')](handleEntityNotFound(_0x1cebc2,null))[_0x8824('0x31')](function(_0x56305c){if(_0x56305c){return _0x56305c[_0x8824('0xb6')](_0x297cbc[_0x8824('0x41')]['ids'])[_0x8824('0x31')](function(){if(_[_0x8824('0xb7')](_0x297cbc['query'][_0x8824('0x68')])){for(var _0x1b2c3c=0x0;_0x1b2c3c<_0x297cbc[_0x8824('0x41')][_0x8824('0x68')][_0x8824('0x57')];_0x1b2c3c+=0x1){socket['emit'](_0x8824('0xb8'),{'UserId':Number(_0x297cbc['query'][_0x8824('0x68')][_0x1b2c3c]),'OpenchannelAccountId':Number(_0x297cbc[_0x8824('0x56')]['id'])});}}else{socket[_0x8824('0xb5')](_0x8824('0xb8'),{'UserId':Number(_0x297cbc[_0x8824('0x41')][_0x8824('0x68')]),'OpenchannelAccountId':Number(_0x297cbc[_0x8824('0x56')]['id'])});}});}})[_0x8824('0x31')](respondWithStatusCode(_0x1cebc2,null))[_0x8824('0x55')](handleError(_0x1cebc2,null));};exports['getAgents']=function(_0x587cb8,_0x30fe5b,_0x442e04){var _0x4bf869={};var _0x49c350={};var _0x42de43;var _0x18742f;return db['OpenchannelAccount']['findOne']({'where':{'id':_0x587cb8['params']['id']}})[_0x8824('0x31')](handleEntityNotFound(_0x30fe5b,null))[_0x8824('0x31')](function(_0x7efafc){if(_0x7efafc){_0x42de43=_0x7efafc;_0x49c350[_0x8824('0x40')]=_[_0x8824('0x42')](db[_0x8824('0x9a')][_0x8824('0x3d')]);_0x49c350[_0x8824('0x41')]=_[_0x8824('0x42')](_0x587cb8[_0x8824('0x41')]);_0x49c350['filters']=_['intersection'](_0x49c350[_0x8824('0x40')],_0x49c350[_0x8824('0x41')]);_0x4bf869[_0x8824('0x45')]=_[_0x8824('0x44')](_0x49c350[_0x8824('0x40')],qs['fields'](_0x587cb8[_0x8824('0x41')][_0x8824('0x46')]));_0x4bf869[_0x8824('0x45')]=_0x4bf869[_0x8824('0x45')]['length']?_0x4bf869[_0x8824('0x45')]:_0x49c350[_0x8824('0x40')];_0x4bf869[_0x8824('0x4a')]=qs[_0x8824('0x4b')](_0x587cb8[_0x8824('0x41')][_0x8824('0x4b')]);_0x4bf869['where']=qs['filters'](_[_0x8824('0x4d')](_0x587cb8[_0x8824('0x41')],_0x49c350['filters']));if(_0x587cb8[_0x8824('0x41')][_0x8824('0x4e')]){_0x4bf869[_0x8824('0x4c')]=_['merge'](_0x4bf869[_0x8824('0x4c')],{'$or':_[_0x8824('0x3b')](_0x4bf869[_0x8824('0x45')],function(_0x48f18a){var _0x563529={};_0x563529[_0x48f18a]={'$like':'%'+_0x587cb8[_0x8824('0x41')]['filter']+'%'};return _0x563529;})});}_0x4bf869=_['merge']({},_0x4bf869,_0x587cb8[_0x8824('0x51')]);return _0x42de43[_0x8824('0xb9')](_0x4bf869);}})[_0x8824('0x31')](function(_0x471664){if(_0x471664){_0x18742f=_0x471664['length'];if(!_0x587cb8['query']['hasOwnProperty'](_0x8824('0x48'))){_0x4bf869[_0x8824('0x29')]=qs[_0x8824('0x29')](_0x587cb8['query'][_0x8824('0x29')]);_0x4bf869['offset']=qs[_0x8824('0x49')](_0x587cb8[_0x8824('0x41')][_0x8824('0x49')]);}return _0x42de43['getAgents'](_0x4bf869);}})[_0x8824('0x31')](function(_0x50b50d){if(_0x50b50d){return _0x50b50d?{'count':_0x18742f,'rows':_0x50b50d}:null;}})[_0x8824('0x31')](respondWithResult(_0x30fe5b,null))[_0x8824('0x55')](handleError(_0x30fe5b,null));};exports[_0x8824('0x37')]=function(_0x315270,_0x22acc3,_0x3476f5){var _0x30cd3f,_0x49784b,_0x20a0b9;if(_[_0x8824('0x77')](_0x315270['body']['body'])||_0x315270['body'][_0x8824('0x5b')]===''){throw new db[(_0x8824('0x6f'))][(_0x8824('0x70'))](_0x8824('0x7a'));}if(_['isNil'](_0x315270[_0x8824('0x5b')]['to'])){}_0x30cd3f=_0x315270[_0x8824('0x5b')]['to'];return db['OpenchannelAccount']['findOne']({'where':{'id':_0x315270[_0x8824('0x56')]['id']}})[_0x8824('0x31')](handleEntityNotFound(_0x22acc3,null))[_0x8824('0x31')](function(_0x20578d){if(_0x20578d){return db[_0x8824('0x3c')]['find']({'where':{'id':_0x20578d['id']},'include':[{'model':db[_0x8824('0xba')],'as':'List','include':[{'model':db[_0x8824('0x6e')],'as':_0x8824('0x7f'),'where':{[_0x20578d[_0x8824('0x7b')]]:_0x30cd3f},'limit':0x1,'order':[[_0x8824('0x74'),_0x8824('0x80')]]}]}]})[_0x8824('0x31')](handleEntityNotFound(_0x22acc3,null))[_0x8824('0x31')](function(_0x24c4c0){if(_0x24c4c0&&_0x24c4c0[_0x8824('0x7e')]){_0x49784b=_0x24c4c0[_0x8824('0x33')]({'plain':!![]});if(_0x49784b[_0x8824('0x7e')]&&_0x49784b['List'][_0x8824('0x7f')][_0x8824('0x57')]){return _0x49784b['List'][_0x8824('0x7f')][0x0];}return db[_0x8824('0x6e')][_0x8824('0x5a')](_['defaults'](_0x315270['body'],{'firstName':_0x30cd3f,[_0x24c4c0[_0x8824('0x7b')]]:_0x30cd3f,'phone':_0x30cd3f,'ListId':_0x49784b[_0x8824('0x76')]}));}})[_0x8824('0x31')](handleEntityNotFound(_0x22acc3,null))[_0x8824('0x31')](function(_0x313ec7){if(_0x313ec7){_0x20a0b9=_0x313ec7;return db[_0x8824('0x8c')]['find']({'where':{'ContactId':_0x20a0b9['id'],'closed':![],'OpenchannelAccountId':_0x49784b['id']}})['then'](function(_0x368e41){if(_0x368e41){return[_0x368e41,![]];}return db[_0x8824('0x8c')]['create']({'UserId':_0x315270[_0x8824('0x5c')]['id'],'ContactId':_0x20a0b9['id'],'OpenchannelAccountId':_0x49784b['id'],'lastMsgDirection':'out','firstMsgDirection':_0x8824('0xbb'),'Messages':[_[_0x8824('0x4f')](_0x315270[_0x8824('0x5b')],{'read':![],'body':_0x315270[_0x8824('0x5b')]['body'],'OpenchannelAccountId':_0x49784b['id'],'UserId':_0x315270[_0x8824('0x5c')]['id'],'ContactId':_0x20a0b9['id']})]},{'include':[{'model':db[_0x8824('0x98')],'as':_0x8824('0xbc')}]})[_0x8824('0x31')](function(_0xffa63b){return[_0xffa63b,!![]];});});}})['spread'](function(_0x43afae,_0x848fa0){if(_0x848fa0){return _0x43afae;}return db[_0x8824('0x98')][_0x8824('0x5a')](_[_0x8824('0x4f')](_0x315270['body'],{'read':![],'body':_0x315270['body'][_0x8824('0x5b')],'OpenchannelAccountId':_0x49784b['id'],'OpenchannelInteractionId':_0x43afae['id'],'UserId':_0x315270[_0x8824('0x5c')]['id'],'ContactId':_0x20a0b9['id']}))[_0x8824('0x31')](function(_0x37dcca){_0x43afae['dataValues'][_0x8824('0xbc')]=[];_0x43afae['dataValues'][_0x8824('0xbc')]['push'](_0x37dcca['dataValues']);return _0x43afae;});});}})[_0x8824('0x31')](respondWithResult(_0x22acc3,null))[_0x8824('0x55')](handleError(_0x22acc3,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 61f75b8..b2d8420 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 _0xb58b=['exports','../../mysqldb','OpenchannelAccount','setMaxListeners','update','remove','emit','hook'];(function(_0x20d7a1,_0x1d1391){var _0x360654=function(_0x5450c0){while(--_0x5450c0){_0x20d7a1['push'](_0x20d7a1['shift']());}};_0x360654(++_0x1d1391);}(_0xb58b,0x1f1));var _0xbb58=function(_0x4981d8,_0x4796f8){_0x4981d8=_0x4981d8-0x0;var _0x4e2060=_0xb58b[_0x4981d8];return _0x4e2060;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0xbb58('0x0'))['db'][_0xbb58('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xbb58('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xbb58('0x3'),'afterDestroy':_0xbb58('0x4')};function emitEvent(_0x5c9ec5){return function(_0x226363,_0x546510,_0x2edb10){OpenchannelAccountEvents[_0xbb58('0x5')](_0x5c9ec5+':'+_0x226363['id'],_0x226363);OpenchannelAccountEvents[_0xbb58('0x5')](_0x5c9ec5,_0x226363);_0x2edb10(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0xbb58('0x6')](e,emitEvent(event));}}module[_0xbb58('0x7')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x70e0=['emit','events','../../mysqldb','OpenchannelAccount','update','remove'];(function(_0x3577cf,_0x1113e0){var _0x3fa5af=function(_0x33cb6b){while(--_0x33cb6b){_0x3577cf['push'](_0x3577cf['shift']());}};_0x3fa5af(++_0x1113e0);}(_0x70e0,0x17b));var _0x070e=function(_0xa050b6,_0x398fe1){_0xa050b6=_0xa050b6-0x0;var _0x5c1b43=_0x70e0[_0xa050b6];return _0x5c1b43;};'use strict';var EventEmitter=require(_0x070e('0x0'));var OpenchannelAccount=require(_0x070e('0x1'))['db'][_0x070e('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x070e('0x3'),'afterDestroy':_0x070e('0x4')};function emitEvent(_0x277d32){return function(_0x2593e5,_0x5c90fc,_0x7bce9b){OpenchannelAccountEvents['emit'](_0x277d32+':'+_0x2593e5['id'],_0x2593e5);OpenchannelAccountEvents[_0x070e('0x5')](_0x277d32,_0x2593e5);_0x7bce9b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount['hook'](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 8231dd3..b2d8e7c 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(_0x199af6,_0x1cd5a5){var _0x46b7fa=function(_0x498aff){while(--_0x498aff){_0x199af6['push'](_0x199af6['shift']());}};_0x46b7fa(++_0x1cd5a5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'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(_0x5e104,_0x391b77){var _0x15db91=function(_0x3de41c){while(--_0x3de41c){_0x5e104['push'](_0x5e104['shift']());}};_0x15db91(++_0x391b77);}(_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 diff --git a/server/api/openchannelAccount/openchannelAccount.rpc.js b/server/api/openchannelAccount/openchannelAccount.rpc.js index 31344d9..094c50d 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 _0xe3d4=['redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','request','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe3d4,0xc6));var _0x4e3d=function(_0x1715f0,_0x3311fe){_0x1715f0=_0x1715f0-0x0;var _0x504209=_0xe3d4[_0x1715f0];return _0x504209;};'use strict';var _=require('lodash');var util=require(_0x4e3d('0x0'));var moment=require(_0x4e3d('0x1'));var BPromise=require(_0x4e3d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4e3d('0x3'));var db=require(_0x4e3d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4e3d('0x5'))('rpc');var config=require(_0x4e3d('0x6'));var jayson=require(_0x4e3d('0x7'));var client=jayson['client'][_0x4e3d('0x8')]({'port':0x232a});config[_0x4e3d('0x9')]=_['defaults'](config[_0x4e3d('0x9')],{'host':_0x4e3d('0xa'),'port':0x18eb});var socket=require(_0x4e3d('0xb'))(new Redis(config[_0x4e3d('0x9')]));require(_0x4e3d('0xc'))[_0x4e3d('0xd')](socket);function respondWithRpcPromise(_0x500f5c,_0x5032b7,_0x7f3787){return new BPromise(function(_0x1a79cf,_0x17ea9a){return client[_0x4e3d('0xe')](_0x500f5c,_0x7f3787)[_0x4e3d('0xf')](function(_0x67497f){logger['info'](_0x4e3d('0x10'),_0x5032b7,_0x4e3d('0x11'));logger[_0x4e3d('0x12')](_0x4e3d('0x13'),_0x5032b7,_0x4e3d('0x11'),JSON[_0x4e3d('0x14')](_0x67497f));if(_0x67497f[_0x4e3d('0x15')]){if(_0x67497f[_0x4e3d('0x15')]['code']===0x1f4){logger[_0x4e3d('0x15')](_0x4e3d('0x10'),_0x5032b7,_0x67497f[_0x4e3d('0x15')]['message']);return _0x17ea9a(_0x67497f[_0x4e3d('0x15')][_0x4e3d('0x16')]);}logger[_0x4e3d('0x15')](_0x4e3d('0x10'),_0x5032b7,_0x67497f[_0x4e3d('0x15')][_0x4e3d('0x16')]);return _0x1a79cf(_0x67497f[_0x4e3d('0x15')][_0x4e3d('0x16')]);}else{logger['info'](_0x4e3d('0x10'),_0x5032b7,'request\x20sent');_0x1a79cf(_0x67497f['result'][_0x4e3d('0x16')]);}})['catch'](function(_0x5a2389){logger[_0x4e3d('0x15')](_0x4e3d('0x10'),_0x5032b7,_0x5a2389);_0x17ea9a(_0x5a2389);});});} \ No newline at end of file +var _0x3264=['request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','OpenchannelAccount,\x20%s,\x20%s','message','catch','util','moment','bluebird','randomstring','../../config/utils','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','request','info'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3264,0x7f));var _0x4326=function(_0xd0b415,_0x149675){_0xd0b415=_0xd0b415-0x0;var _0x2bdf2c=_0x3264[_0xd0b415];return _0x2bdf2c;};'use strict';var _=require('lodash');var util=require(_0x4326('0x0'));var moment=require(_0x4326('0x1'));var BPromise=require(_0x4326('0x2'));var rs=require(_0x4326('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4326('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x4326('0x5'));var jayson=require(_0x4326('0x6'));var client=jayson[_0x4326('0x7')][_0x4326('0x8')]({'port':0x232a});config['redis']=_[_0x4326('0x9')](config[_0x4326('0xa')],{'host':_0x4326('0xb'),'port':0x18eb});var socket=require(_0x4326('0xc'))(new Redis(config[_0x4326('0xa')]));require(_0x4326('0xd'))[_0x4326('0xe')](socket);function respondWithRpcPromise(_0x5cde0b,_0x58bade,_0x51323a){return new BPromise(function(_0x97d63e,_0x9daa3f){return client[_0x4326('0xf')](_0x5cde0b,_0x51323a)['then'](function(_0x5ac227){logger[_0x4326('0x10')]('OpenchannelAccount,\x20%s,\x20%s',_0x58bade,_0x4326('0x11'));logger[_0x4326('0x12')](_0x4326('0x13'),_0x58bade,'request\x20sent',JSON['stringify'](_0x5ac227));if(_0x5ac227[_0x4326('0x14')]){if(_0x5ac227['error']['code']===0x1f4){logger[_0x4326('0x14')](_0x4326('0x15'),_0x58bade,_0x5ac227[_0x4326('0x14')][_0x4326('0x16')]);return _0x9daa3f(_0x5ac227['error'][_0x4326('0x16')]);}logger[_0x4326('0x14')](_0x4326('0x15'),_0x58bade,_0x5ac227['error'][_0x4326('0x16')]);return _0x97d63e(_0x5ac227[_0x4326('0x14')][_0x4326('0x16')]);}else{logger[_0x4326('0x10')]('OpenchannelAccount,\x20%s,\x20%s',_0x58bade,_0x4326('0x11'));_0x97d63e(_0x5ac227['result'][_0x4326('0x16')]);}})[_0x4326('0x17')](function(_0x35f24b){logger[_0x4326('0x14')](_0x4326('0x15'),_0x58bade,_0x35f24b);_0x9daa3f(_0x35f24b);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 251dc8e..4ee9da0 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 _0x6953=['./openchannelAccount.events','save','emit','register','length'];(function(_0x1af482,_0x1af5b7){var _0x7e7580=function(_0x5ed4a7){while(--_0x5ed4a7){_0x1af482['push'](_0x1af482['shift']());}};_0x7e7580(++_0x1af5b7);}(_0x6953,0x91));var _0x3695=function(_0xd158dc,_0x128608){_0xd158dc=_0xd158dc-0x0;var _0x12d25f=_0x6953[_0xd158dc];return _0x12d25f;};'use strict';var OpenchannelAccountEvents=require(_0x3695('0x0'));var events=[_0x3695('0x1'),'remove','update'];function createListener(_0x53e2fa,_0x402642){return function(_0x550d98){_0x402642[_0x3695('0x2')](_0x53e2fa,_0x550d98);};}function removeListener(_0xca2457,_0x366541){return function(){OpenchannelAccountEvents['removeListener'](_0xca2457,_0x366541);};}exports[_0x3695('0x3')]=function(_0x558026){for(var _0x2d7d98=0x0,_0x14eb32=events[_0x3695('0x4')];_0x2d7d98<_0x14eb32;_0x2d7d98++){var _0x1a4e75=events[_0x2d7d98];var _0x301e46=createListener('openchannelAccount:'+_0x1a4e75,_0x558026);OpenchannelAccountEvents['on'](_0x1a4e75,_0x301e46);}}; \ No newline at end of file +var _0x95c5=['register','length','openchannelAccount:','./openchannelAccount.events','save','update','emit','removeListener'];(function(_0x41da22,_0x2d02f4){var _0x27b255=function(_0x3ac6a0){while(--_0x3ac6a0){_0x41da22['push'](_0x41da22['shift']());}};_0x27b255(++_0x2d02f4);}(_0x95c5,0x153));var _0x595c=function(_0x462999,_0x24d200){_0x462999=_0x462999-0x0;var _0x4b1366=_0x95c5[_0x462999];return _0x4b1366;};'use strict';var OpenchannelAccountEvents=require(_0x595c('0x0'));var events=[_0x595c('0x1'),'remove',_0x595c('0x2')];function createListener(_0x22a23d,_0x36a7da){return function(_0x1da8dc){_0x36a7da[_0x595c('0x3')](_0x22a23d,_0x1da8dc);};}function removeListener(_0x218d7b,_0xf4369b){return function(){OpenchannelAccountEvents[_0x595c('0x4')](_0x218d7b,_0xf4369b);};}exports[_0x595c('0x5')]=function(_0x46be42){for(var _0x4ff80b=0x0,_0x49a115=events[_0x595c('0x6')];_0x4ff80b<_0x49a115;_0x4ff80b++){var _0xfcaf47=events[_0x4ff80b];var _0x218eca=createListener(_0x595c('0x7')+_0xfcaf47,_0x46be42);OpenchannelAccountEvents['on'](_0xfcaf47,_0x218eca);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 7982e31..86c58b6 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 _0x46c7=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','/:id','isAuthenticated','post','create','put','delete','exports','multer','util','path','connect-timeout'];(function(_0xc66190,_0x1dab7d){var _0x20b436=function(_0x318b10){while(--_0x318b10){_0xc66190['push'](_0xc66190['shift']());}};_0x20b436(++_0x1dab7d);}(_0x46c7,0x152));var _0x746c=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x46c7[_0x4b369d];return _0x571a98;};'use strict';var multer=require(_0x746c('0x0'));var util=require(_0x746c('0x1'));var path=require(_0x746c('0x2'));var timeout=require(_0x746c('0x3'));var express=require(_0x746c('0x4'));var router=express[_0x746c('0x5')]();var fs_extra=require(_0x746c('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x746c('0x7'));var config=require(_0x746c('0x8'));var controller=require(_0x746c('0x9'));router[_0x746c('0xa')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x746c('0xb'),auth[_0x746c('0xc')](),controller['show']);router[_0x746c('0xd')]('/',auth[_0x746c('0xc')](),controller[_0x746c('0xe')]);router[_0x746c('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x746c('0x10')](_0x746c('0xb'),auth[_0x746c('0xc')](),controller['destroy']);module[_0x746c('0x11')]=router; \ No newline at end of file +var _0x6e29=['exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete'];(function(_0x25be71,_0x5451f4){var _0x43e806=function(_0x137beb){while(--_0x137beb){_0x25be71['push'](_0x25be71['shift']());}};_0x43e806(++_0x5451f4);}(_0x6e29,0x16a));var _0x96e2=function(_0x141966,_0x12fe79){_0x141966=_0x141966-0x0;var _0x2fdb35=_0x6e29[_0x141966];return _0x2fdb35;};'use strict';var multer=require(_0x96e2('0x0'));var util=require(_0x96e2('0x1'));var path=require(_0x96e2('0x2'));var timeout=require('connect-timeout');var express=require(_0x96e2('0x3'));var router=express[_0x96e2('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x96e2('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x96e2('0x6'));var controller=require(_0x96e2('0x7'));router[_0x96e2('0x8')]('/',auth[_0x96e2('0x9')](),controller[_0x96e2('0xa')]);router[_0x96e2('0x8')](_0x96e2('0xb'),auth[_0x96e2('0x9')](),controller[_0x96e2('0xc')]);router[_0x96e2('0xd')]('/',auth[_0x96e2('0x9')](),controller[_0x96e2('0xe')]);router[_0x96e2('0xf')](_0x96e2('0xb'),auth['isAuthenticated'](),controller[_0x96e2('0x10')]);router[_0x96e2('0x11')]('/:id',auth[_0x96e2('0x9')](),controller['destroy']);module[_0x96e2('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index cc0df77..a16f4b1 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 _0xc07b=['noop','TEXT','sequelize','exports','STRING'];(function(_0x489959,_0x55c7d5){var _0x43f533=function(_0x57c6cb){while(--_0x57c6cb){_0x489959['push'](_0x489959['shift']());}};_0x43f533(++_0x55c7d5);}(_0xc07b,0x1d3));var _0xbc07=function(_0x264545,_0x214037){_0x264545=_0x264545-0x0;var _0x114d10=_0xc07b[_0x264545];return _0x114d10;};'use strict';var Sequelize=require(_0xbc07('0x0'));module[_0xbc07('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xbc07('0x2')],'allowNull':![],'defaultValue':_0xbc07('0x3')},'appdata':{'type':Sequelize[_0xbc07('0x4')]()},'description':{'type':Sequelize[_0xbc07('0x2')]},'interval':{'type':Sequelize[_0xbc07('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x013f=['STRING','noop','*,*,*,*','sequelize','exports','INTEGER'];(function(_0xef7d45,_0x22d053){var _0x5e7cfa=function(_0x5c79c0){while(--_0x5c79c0){_0xef7d45['push'](_0xef7d45['shift']());}};_0x5e7cfa(++_0x22d053);}(_0x013f,0x81));var _0xf013=function(_0x13cfd8,_0x5411e8){_0x13cfd8=_0x13cfd8-0x0;var _0x52cc5d=_0x013f[_0x13cfd8];return _0x52cc5d;};'use strict';var Sequelize=require(_0xf013('0x0'));module[_0xf013('0x1')]={'priority':{'type':Sequelize[_0xf013('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xf013('0x3')],'allowNull':![],'defaultValue':_0xf013('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xf013('0x3')],'defaultValue':_0xf013('0x5')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 47dc53d..2340213 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 _0x0da9=['catch','show','params','rawAttributes','length','find','create','body','update','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','error','name','send','index','map','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','OpenchannelApplication','includeAll','include'];(function(_0x35e6ca,_0x54939f){var _0x239e43=function(_0x3ea90d){while(--_0x3ea90d){_0x35e6ca['push'](_0x35e6ca['shift']());}};_0x239e43(++_0x54939f);}(_0x0da9,0x1cb));var _0x90da=function(_0x127820,_0x4a606d){_0x127820=_0x127820-0x0;var _0x1f71a9=_0x0da9[_0x127820];return _0x1f71a9;};'use strict';var emlformat=require(_0x90da('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x90da('0x1'));var jsonpatch=require(_0x90da('0x2'));var rp=require(_0x90da('0x3'));var moment=require(_0x90da('0x4'));var BPromise=require(_0x90da('0x5'));var Mustache=require(_0x90da('0x6'));var util=require(_0x90da('0x7'));var path=require('path');var sox=require(_0x90da('0x8'));var csv=require(_0x90da('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x90da('0xa'));var crypto=require(_0x90da('0xb'));var jsforce=require(_0x90da('0xc'));var deskjs=require(_0x90da('0xd'));var toCsv=require(_0x90da('0x9'));var querystring=require('querystring');var Papa=require(_0x90da('0xe'));var Redis=require(_0x90da('0xf'));var authService=require(_0x90da('0x10'));var qs=require(_0x90da('0x11'));var as=require(_0x90da('0x12'));var hardwareService=require(_0x90da('0x13'));var logger=require(_0x90da('0x14'))('api');var utils=require(_0x90da('0x15'));var config=require(_0x90da('0x16'));var licenseUtil=require(_0x90da('0x17'));var db=require(_0x90da('0x18'))['db'];function respondWithStatusCode(_0x34c3cd,_0x2f951a){_0x2f951a=_0x2f951a||0xcc;return function(_0x6c59c7){if(_0x6c59c7){return _0x34c3cd[_0x90da('0x19')](_0x2f951a);}return _0x34c3cd[_0x90da('0x1a')](_0x2f951a)[_0x90da('0x1b')]();};}function respondWithResult(_0x36f4b5,_0x36fe79){_0x36fe79=_0x36fe79||0xc8;return function(_0x2adace){if(_0x2adace){return _0x36f4b5[_0x90da('0x1a')](_0x36fe79)['json'](_0x2adace);}};}function respondWithFilteredResult(_0x119ba5,_0x44acdf){return function(_0x1978f4){if(_0x1978f4){var _0x540204=typeof _0x44acdf[_0x90da('0x1c')]===_0x90da('0x1d')&&typeof _0x44acdf[_0x90da('0x1e')]==='undefined';var _0x5e0d17=_0x1978f4[_0x90da('0x1f')];var _0x131769=_0x540204?0x0:_0x44acdf[_0x90da('0x1c')];var _0x4f235e=_0x540204?_0x1978f4[_0x90da('0x1f')]:_0x44acdf['offset']+_0x44acdf[_0x90da('0x1e')];var _0x40483e;if(_0x4f235e>=_0x5e0d17){_0x4f235e=_0x5e0d17;_0x40483e=0xc8;}else{_0x40483e=0xce;}_0x119ba5[_0x90da('0x1a')](_0x40483e);return _0x119ba5[_0x90da('0x20')](_0x90da('0x21'),_0x131769+'-'+_0x4f235e+'/'+_0x5e0d17)['json'](_0x1978f4);}return null;};}function patchUpdates(_0x56d1a5){return function(_0x25446d){try{jsonpatch['apply'](_0x25446d,_0x56d1a5,!![]);}catch(_0x37a8c9){return BPromise[_0x90da('0x22')](_0x37a8c9);}return _0x25446d[_0x90da('0x23')]();};}function saveUpdates(_0x4ceccb,_0x3b366e){return function(_0x460449){if(_0x460449){return _0x460449['update'](_0x4ceccb)[_0x90da('0x24')](function(_0x1b8a28){return _0x1b8a28;});}return null;};}function removeEntity(_0x3de919,_0x39a2ab){return function(_0x54ef67){if(_0x54ef67){return _0x54ef67[_0x90da('0x25')]()['then'](function(){_0x3de919[_0x90da('0x1a')](0xcc)[_0x90da('0x1b')]();});}};}function handleEntityNotFound(_0x3e3c86,_0x2effe5){return function(_0x4d0a64){if(!_0x4d0a64){_0x3e3c86[_0x90da('0x19')](0x194);}return _0x4d0a64;};}function handleError(_0x2efdb3,_0x1995f0){_0x1995f0=_0x1995f0||0x1f4;return function(_0x5d3757){logger[_0x90da('0x26')](_0x5d3757['stack']);if(_0x5d3757[_0x90da('0x27')]){delete _0x5d3757[_0x90da('0x27')];}_0x2efdb3['status'](_0x1995f0)[_0x90da('0x28')](_0x5d3757);};}exports[_0x90da('0x29')]=function(_0x38d778,_0x14c06c){var _0xb019c0={},_0x15a9c0={},_0x3461ed={'count':0x0,'rows':[]};var _0x307cc5=_[_0x90da('0x2a')](db['OpenchannelApplication']['rawAttributes'],function(_0x259fe2){return{'name':_0x259fe2[_0x90da('0x2b')],'type':_0x259fe2[_0x90da('0x2c')][_0x90da('0x2d')]};});_0x15a9c0[_0x90da('0x2e')]=_[_0x90da('0x2a')](_0x307cc5,_0x90da('0x27'));_0x15a9c0['query']=_[_0x90da('0x2f')](_0x38d778[_0x90da('0x30')]);_0x15a9c0[_0x90da('0x31')]=_['intersection'](_0x15a9c0[_0x90da('0x2e')],_0x15a9c0[_0x90da('0x30')]);_0xb019c0[_0x90da('0x32')]=_[_0x90da('0x33')](_0x15a9c0['model'],qs[_0x90da('0x34')](_0x38d778[_0x90da('0x30')][_0x90da('0x34')]));_0xb019c0[_0x90da('0x32')]=_0xb019c0[_0x90da('0x32')]['length']?_0xb019c0['attributes']:_0x15a9c0[_0x90da('0x2e')];if(!_0x38d778[_0x90da('0x30')][_0x90da('0x35')](_0x90da('0x36'))){_0xb019c0[_0x90da('0x1e')]=qs['limit'](_0x38d778[_0x90da('0x30')][_0x90da('0x1e')]);_0xb019c0[_0x90da('0x1c')]=qs[_0x90da('0x1c')](_0x38d778[_0x90da('0x30')]['offset']);}_0xb019c0[_0x90da('0x37')]=qs['sort'](_0x38d778[_0x90da('0x30')][_0x90da('0x38')]);_0xb019c0['where']=qs[_0x90da('0x31')](_[_0x90da('0x39')](_0x38d778[_0x90da('0x30')],_0x15a9c0[_0x90da('0x31')]),_0x307cc5);if(_0x38d778[_0x90da('0x30')][_0x90da('0x3a')]){_0xb019c0['where']=_[_0x90da('0x3b')](_0xb019c0[_0x90da('0x3c')],{'$or':_[_0x90da('0x2a')](_0x307cc5,function(_0x382cf5){if(_0x382cf5['type']!==_0x90da('0x3d')){var _0x125c7f={};_0x125c7f[_0x382cf5['name']]={'$like':'%'+_0x38d778[_0x90da('0x30')][_0x90da('0x3a')]+'%'};return _0x125c7f;}})});}_0xb019c0=_[_0x90da('0x3b')]({},_0xb019c0,_0x38d778[_0x90da('0x3e')]);var _0x3bf23f={'where':_0xb019c0['where']};return db[_0x90da('0x3f')]['count'](_0x3bf23f)[_0x90da('0x24')](function(_0x303afc){_0x3461ed[_0x90da('0x1f')]=_0x303afc;if(_0x38d778[_0x90da('0x30')][_0x90da('0x40')]){_0xb019c0[_0x90da('0x41')]=[{'all':!![]}];}return db['OpenchannelApplication']['findAll'](_0xb019c0);})[_0x90da('0x24')](function(_0x4c30ee){_0x3461ed['rows']=_0x4c30ee;return _0x3461ed;})['then'](respondWithFilteredResult(_0x14c06c,_0xb019c0))[_0x90da('0x42')](handleError(_0x14c06c,null));};exports[_0x90da('0x43')]=function(_0x1f617f,_0x5f3510){var _0x1c255a={'raw':!![],'where':{'id':_0x1f617f[_0x90da('0x44')]['id']}},_0x24d2eb={};_0x24d2eb[_0x90da('0x2e')]=_[_0x90da('0x2f')](db[_0x90da('0x3f')][_0x90da('0x45')]);_0x24d2eb[_0x90da('0x30')]=_[_0x90da('0x2f')](_0x1f617f[_0x90da('0x30')]);_0x24d2eb['filters']=_[_0x90da('0x33')](_0x24d2eb['model'],_0x24d2eb['query']);_0x1c255a[_0x90da('0x32')]=_['intersection'](_0x24d2eb['model'],qs[_0x90da('0x34')](_0x1f617f[_0x90da('0x30')][_0x90da('0x34')]));_0x1c255a[_0x90da('0x32')]=_0x1c255a['attributes'][_0x90da('0x46')]?_0x1c255a['attributes']:_0x24d2eb[_0x90da('0x2e')];if(_0x1f617f['query'][_0x90da('0x40')]){_0x1c255a[_0x90da('0x41')]=[{'all':!![]}];}_0x1c255a=_['merge']({},_0x1c255a,_0x1f617f[_0x90da('0x3e')]);return db[_0x90da('0x3f')][_0x90da('0x47')](_0x1c255a)[_0x90da('0x24')](handleEntityNotFound(_0x5f3510,null))[_0x90da('0x24')](respondWithResult(_0x5f3510,null))[_0x90da('0x42')](handleError(_0x5f3510,null));};exports[_0x90da('0x48')]=function(_0x3bd1fc,_0x585e72){return db[_0x90da('0x3f')][_0x90da('0x48')](_0x3bd1fc[_0x90da('0x49')],{})[_0x90da('0x24')](respondWithResult(_0x585e72,0xc9))['catch'](handleError(_0x585e72,null));};exports[_0x90da('0x4a')]=function(_0x202a3a,_0x488047){if(_0x202a3a[_0x90da('0x49')]['id']){delete _0x202a3a[_0x90da('0x49')]['id'];}return db[_0x90da('0x3f')][_0x90da('0x47')]({'where':{'id':_0x202a3a[_0x90da('0x44')]['id']}})[_0x90da('0x24')](handleEntityNotFound(_0x488047,null))['then'](saveUpdates(_0x202a3a[_0x90da('0x49')],null))[_0x90da('0x24')](respondWithResult(_0x488047,null))[_0x90da('0x42')](handleError(_0x488047,null));};exports[_0x90da('0x25')]=function(_0x45057b,_0x78370){return db[_0x90da('0x3f')]['find']({'where':{'id':_0x45057b[_0x90da('0x44')]['id']}})[_0x90da('0x24')](handleEntityNotFound(_0x78370,null))[_0x90da('0x24')](removeEntity(_0x78370,null))[_0x90da('0x42')](handleError(_0x78370,null));}; \ No newline at end of file +var _0xcb0e=['zip-dir','fast-json-patch','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/logger','api','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','error','stack','name','index','OpenchannelApplication','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','keys','find','catch','create','body','params','eml-format','rimraf'];(function(_0x5e6f3a,_0x4a0ba5){var _0xceef8b=function(_0x5b9774){while(--_0x5b9774){_0x5e6f3a['push'](_0x5e6f3a['shift']());}};_0xceef8b(++_0x4a0ba5);}(_0xcb0e,0x92));var _0xecb0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcb0e[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xecb0('0x0'));var rimraf=require(_0xecb0('0x1'));var zipdir=require(_0xecb0('0x2'));var jsonpatch=require(_0xecb0('0x3'));var rp=require('request-promise');var moment=require(_0xecb0('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xecb0('0x5'));var util=require('util');var path=require(_0xecb0('0x6'));var sox=require(_0xecb0('0x7'));var csv=require(_0xecb0('0x8'));var ejs=require(_0xecb0('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xecb0('0xa'));var squel=require(_0xecb0('0xb'));var crypto=require(_0xecb0('0xc'));var jsforce=require(_0xecb0('0xd'));var deskjs=require(_0xecb0('0xe'));var toCsv=require(_0xecb0('0x8'));var querystring=require(_0xecb0('0xf'));var Papa=require(_0xecb0('0x10'));var Redis=require('ioredis');var authService=require(_0xecb0('0x11'));var qs=require(_0xecb0('0x12'));var as=require(_0xecb0('0x13'));var hardwareService=require(_0xecb0('0x14'));var logger=require(_0xecb0('0x15'))(_0xecb0('0x16'));var utils=require('../../config/utils');var config=require(_0xecb0('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x42c0b8,_0x5b3cb4){_0x5b3cb4=_0x5b3cb4||0xcc;return function(_0x50ab3c){if(_0x50ab3c){return _0x42c0b8[_0xecb0('0x18')](_0x5b3cb4);}return _0x42c0b8[_0xecb0('0x19')](_0x5b3cb4)[_0xecb0('0x1a')]();};}function respondWithResult(_0x12a77c,_0x3cf923){_0x3cf923=_0x3cf923||0xc8;return function(_0x4875b4){if(_0x4875b4){return _0x12a77c['status'](_0x3cf923)[_0xecb0('0x1b')](_0x4875b4);}};}function respondWithFilteredResult(_0x1d7266,_0x57e181){return function(_0x2aab52){if(_0x2aab52){var _0x1df3c7=typeof _0x57e181[_0xecb0('0x1c')]===_0xecb0('0x1d')&&typeof _0x57e181[_0xecb0('0x1e')]===_0xecb0('0x1d');var _0x1dede=_0x2aab52['count'];var _0x4e0ad7=_0x1df3c7?0x0:_0x57e181[_0xecb0('0x1c')];var _0x337a89=_0x1df3c7?_0x2aab52[_0xecb0('0x1f')]:_0x57e181[_0xecb0('0x1c')]+_0x57e181['limit'];var _0x33870f;if(_0x337a89>=_0x1dede){_0x337a89=_0x1dede;_0x33870f=0xc8;}else{_0x33870f=0xce;}_0x1d7266[_0xecb0('0x19')](_0x33870f);return _0x1d7266['set'](_0xecb0('0x20'),_0x4e0ad7+'-'+_0x337a89+'/'+_0x1dede)[_0xecb0('0x1b')](_0x2aab52);}return null;};}function patchUpdates(_0x1cc5e7){return function(_0x403d57){try{jsonpatch[_0xecb0('0x21')](_0x403d57,_0x1cc5e7,!![]);}catch(_0x14b78b){return BPromise[_0xecb0('0x22')](_0x14b78b);}return _0x403d57['save']();};}function saveUpdates(_0x5e61f6,_0x9349d4){return function(_0xde079){if(_0xde079){return _0xde079[_0xecb0('0x23')](_0x5e61f6)[_0xecb0('0x24')](function(_0x4291be){return _0x4291be;});}return null;};}function removeEntity(_0x557ff2,_0x149ec5){return function(_0x4465c5){if(_0x4465c5){return _0x4465c5[_0xecb0('0x25')]()[_0xecb0('0x24')](function(){_0x557ff2['status'](0xcc)[_0xecb0('0x1a')]();});}};}function handleEntityNotFound(_0x3e82c1,_0x5bc0fa){return function(_0x94d2a8){if(!_0x94d2a8){_0x3e82c1['sendStatus'](0x194);}return _0x94d2a8;};}function handleError(_0x55df52,_0x2fa6e3){_0x2fa6e3=_0x2fa6e3||0x1f4;return function(_0x56b9cc){logger[_0xecb0('0x26')](_0x56b9cc[_0xecb0('0x27')]);if(_0x56b9cc[_0xecb0('0x28')]){delete _0x56b9cc['name'];}_0x55df52[_0xecb0('0x19')](_0x2fa6e3)['send'](_0x56b9cc);};}exports[_0xecb0('0x29')]=function(_0x4b609d,_0x60037f){var _0x177d47={},_0x15d0e6={},_0x34efbc={'count':0x0,'rows':[]};var _0x306ebe=_['map'](db[_0xecb0('0x2a')][_0xecb0('0x2b')],function(_0x55db81){return{'name':_0x55db81[_0xecb0('0x2c')],'type':_0x55db81[_0xecb0('0x2d')][_0xecb0('0x2e')]};});_0x15d0e6[_0xecb0('0x2f')]=_[_0xecb0('0x30')](_0x306ebe,_0xecb0('0x28'));_0x15d0e6[_0xecb0('0x31')]=_['keys'](_0x4b609d[_0xecb0('0x31')]);_0x15d0e6[_0xecb0('0x32')]=_[_0xecb0('0x33')](_0x15d0e6[_0xecb0('0x2f')],_0x15d0e6['query']);_0x177d47['attributes']=_[_0xecb0('0x33')](_0x15d0e6[_0xecb0('0x2f')],qs[_0xecb0('0x34')](_0x4b609d[_0xecb0('0x31')]['fields']));_0x177d47[_0xecb0('0x35')]=_0x177d47[_0xecb0('0x35')][_0xecb0('0x36')]?_0x177d47[_0xecb0('0x35')]:_0x15d0e6[_0xecb0('0x2f')];if(!_0x4b609d[_0xecb0('0x31')]['hasOwnProperty'](_0xecb0('0x37'))){_0x177d47[_0xecb0('0x1e')]=qs['limit'](_0x4b609d[_0xecb0('0x31')]['limit']);_0x177d47[_0xecb0('0x1c')]=qs[_0xecb0('0x1c')](_0x4b609d[_0xecb0('0x31')]['offset']);}_0x177d47[_0xecb0('0x38')]=qs[_0xecb0('0x39')](_0x4b609d[_0xecb0('0x31')][_0xecb0('0x39')]);_0x177d47[_0xecb0('0x3a')]=qs[_0xecb0('0x32')](_[_0xecb0('0x3b')](_0x4b609d[_0xecb0('0x31')],_0x15d0e6[_0xecb0('0x32')]),_0x306ebe);if(_0x4b609d[_0xecb0('0x31')][_0xecb0('0x3c')]){_0x177d47[_0xecb0('0x3a')]=_[_0xecb0('0x3d')](_0x177d47['where'],{'$or':_[_0xecb0('0x30')](_0x306ebe,function(_0x2fac74){if(_0x2fac74['type']!==_0xecb0('0x3e')){var _0x3b8530={};_0x3b8530[_0x2fac74['name']]={'$like':'%'+_0x4b609d[_0xecb0('0x31')][_0xecb0('0x3c')]+'%'};return _0x3b8530;}})});}_0x177d47=_[_0xecb0('0x3d')]({},_0x177d47,_0x4b609d[_0xecb0('0x3f')]);var _0x55de9c={'where':_0x177d47[_0xecb0('0x3a')]};return db[_0xecb0('0x2a')][_0xecb0('0x1f')](_0x55de9c)['then'](function(_0x2c5793){_0x34efbc['count']=_0x2c5793;if(_0x4b609d[_0xecb0('0x31')][_0xecb0('0x40')]){_0x177d47[_0xecb0('0x41')]=[{'all':!![]}];}return db[_0xecb0('0x2a')][_0xecb0('0x42')](_0x177d47);})[_0xecb0('0x24')](function(_0x302cec){_0x34efbc['rows']=_0x302cec;return _0x34efbc;})[_0xecb0('0x24')](respondWithFilteredResult(_0x60037f,_0x177d47))['catch'](handleError(_0x60037f,null));};exports[_0xecb0('0x43')]=function(_0x6822e4,_0x35118e){var _0x51d8c6={'raw':!![],'where':{'id':_0x6822e4['params']['id']}},_0x40b5ca={};_0x40b5ca[_0xecb0('0x2f')]=_[_0xecb0('0x44')](db[_0xecb0('0x2a')][_0xecb0('0x2b')]);_0x40b5ca['query']=_['keys'](_0x6822e4[_0xecb0('0x31')]);_0x40b5ca[_0xecb0('0x32')]=_[_0xecb0('0x33')](_0x40b5ca[_0xecb0('0x2f')],_0x40b5ca['query']);_0x51d8c6[_0xecb0('0x35')]=_['intersection'](_0x40b5ca['model'],qs[_0xecb0('0x34')](_0x6822e4['query'][_0xecb0('0x34')]));_0x51d8c6[_0xecb0('0x35')]=_0x51d8c6['attributes'][_0xecb0('0x36')]?_0x51d8c6[_0xecb0('0x35')]:_0x40b5ca[_0xecb0('0x2f')];if(_0x6822e4[_0xecb0('0x31')][_0xecb0('0x40')]){_0x51d8c6['include']=[{'all':!![]}];}_0x51d8c6=_['merge']({},_0x51d8c6,_0x6822e4[_0xecb0('0x3f')]);return db[_0xecb0('0x2a')][_0xecb0('0x45')](_0x51d8c6)['then'](handleEntityNotFound(_0x35118e,null))[_0xecb0('0x24')](respondWithResult(_0x35118e,null))[_0xecb0('0x46')](handleError(_0x35118e,null));};exports[_0xecb0('0x47')]=function(_0x2988ce,_0x53da1c){return db['OpenchannelApplication'][_0xecb0('0x47')](_0x2988ce['body'],{})[_0xecb0('0x24')](respondWithResult(_0x53da1c,0xc9))[_0xecb0('0x46')](handleError(_0x53da1c,null));};exports[_0xecb0('0x23')]=function(_0x5e7257,_0x57c2c9){if(_0x5e7257[_0xecb0('0x48')]['id']){delete _0x5e7257['body']['id'];}return db['OpenchannelApplication'][_0xecb0('0x45')]({'where':{'id':_0x5e7257[_0xecb0('0x49')]['id']}})[_0xecb0('0x24')](handleEntityNotFound(_0x57c2c9,null))['then'](saveUpdates(_0x5e7257[_0xecb0('0x48')],null))[_0xecb0('0x24')](respondWithResult(_0x57c2c9,null))[_0xecb0('0x46')](handleError(_0x57c2c9,null));};exports[_0xecb0('0x25')]=function(_0x38d265,_0x34cdff){return db['OpenchannelApplication'][_0xecb0('0x45')]({'where':{'id':_0x38d265[_0xecb0('0x49')]['id']}})['then'](handleEntityNotFound(_0x34cdff,null))[_0xecb0('0x24')](removeEntity(_0x34cdff,null))[_0xecb0('0x46')](handleError(_0x34cdff,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 9fa3532..8d09183 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 _0x07bd=['./openchannelApplication.attributes','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','path','../../config/environment'];(function(_0x458c74,_0x41254a){var _0x21d738=function(_0x5dad60){while(--_0x5dad60){_0x458c74['push'](_0x458c74['shift']());}};_0x21d738(++_0x41254a);}(_0x07bd,0x12d));var _0xd07b=function(_0x143106,_0x34e18){_0x143106=_0x143106-0x0;var _0x3465a8=_0x07bd[_0x143106];return _0x3465a8;};'use strict';var _=require(_0xd07b('0x0'));var util=require(_0xd07b('0x1'));var logger=require('../../config/logger')(_0xd07b('0x2'));var moment=require(_0xd07b('0x3'));var BPromise=require(_0xd07b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd07b('0x5'));var rimraf=require('rimraf');var config=require(_0xd07b('0x6'));var attributes=require(_0xd07b('0x7'));module['exports']=function(_0x3c4653,_0x23a3af){return _0x3c4653['define']('OpenchannelApplication',attributes,{'tableName':_0xd07b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd07b('0x9'),'collate':_0xd07b('0xa')});}; \ No newline at end of file +var _0xb2d4=['request-promise','rimraf','../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','../../config/logger','moment'];(function(_0x23402b,_0x421ac9){var _0x3a21c7=function(_0x3608ec){while(--_0x3608ec){_0x23402b['push'](_0x23402b['shift']());}};_0x3a21c7(++_0x421ac9);}(_0xb2d4,0x15a));var _0x4b2d=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xb2d4[_0x433a86];return _0x23000c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4b2d('0x0'))('api');var moment=require(_0x4b2d('0x1'));var BPromise=require('bluebird');var rp=require(_0x4b2d('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4b2d('0x3'));var config=require(_0x4b2d('0x4'));var attributes=require(_0x4b2d('0x5'));module[_0x4b2d('0x6')]=function(_0x3be3cd,_0x4df96f){return _0x3be3cd[_0x4b2d('0x7')](_0x4b2d('0x8'),attributes,{'tableName':_0x4b2d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4b2d('0xa'),'collate':_0x4b2d('0xb')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 234ea9e..97f5500 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 _0xf384=['stringify','error','code','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','where','attributes','then','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','OpenchannelApplication,\x20%s,\x20%s','debug','request\x20sent'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0xf384,0x145));var _0x4f38=function(_0x1084a5,_0x579890){_0x1084a5=_0x1084a5-0x0;var _0xf18360=_0xf384[_0x1084a5];return _0xf18360;};'use strict';var _=require(_0x4f38('0x0'));var util=require(_0x4f38('0x1'));var moment=require('moment');var BPromise=require(_0x4f38('0x2'));var rs=require(_0x4f38('0x3'));var fs=require('fs');var Redis=require(_0x4f38('0x4'));var db=require(_0x4f38('0x5'))['db'];var utils=require(_0x4f38('0x6'));var logger=require(_0x4f38('0x7'))(_0x4f38('0x8'));var config=require(_0x4f38('0x9'));var jayson=require(_0x4f38('0xa'));var client=jayson[_0x4f38('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xa7fa0d,_0x39a975,_0x189e2b){return new BPromise(function(_0x38e77a,_0x9b4bf5){return client['request'](_0xa7fa0d,_0x189e2b)['then'](function(_0x5e5436){logger[_0x4f38('0xc')](_0x4f38('0xd'),_0x39a975,'request\x20sent');logger[_0x4f38('0xe')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x39a975,_0x4f38('0xf'),JSON[_0x4f38('0x10')](_0x5e5436));if(_0x5e5436[_0x4f38('0x11')]){if(_0x5e5436[_0x4f38('0x11')][_0x4f38('0x12')]===0x1f4){logger[_0x4f38('0x11')](_0x4f38('0xd'),_0x39a975,_0x5e5436[_0x4f38('0x11')][_0x4f38('0x13')]);return _0x9b4bf5(_0x5e5436[_0x4f38('0x11')][_0x4f38('0x13')]);}logger['error'](_0x4f38('0xd'),_0x39a975,_0x5e5436[_0x4f38('0x11')][_0x4f38('0x13')]);return _0x38e77a(_0x5e5436[_0x4f38('0x11')][_0x4f38('0x13')]);}else{logger[_0x4f38('0xc')](_0x4f38('0xd'),_0x39a975,_0x4f38('0xf'));_0x38e77a(_0x5e5436[_0x4f38('0x14')][_0x4f38('0x13')]);}})[_0x4f38('0x15')](function(_0x3301de){logger[_0x4f38('0x11')](_0x4f38('0xd'),_0x39a975,_0x3301de);_0x9b4bf5(_0x3301de);});});}exports[_0x4f38('0x16')]=function(_0x1d280f){var _0x5ce982=this;return new Promise(function(_0xf8c4c9,_0x255f05){return db[_0x4f38('0x17')][_0x4f38('0x18')](_0x1d280f[_0x4f38('0x19')],{'raw':_0x1d280f['options']?_0x1d280f[_0x4f38('0x1a')][_0x4f38('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1d280f[_0x4f38('0x1a')]?_0x1d280f['options'][_0x4f38('0x1c')]||null:null,'attributes':_0x1d280f[_0x4f38('0x1a')]?_0x1d280f[_0x4f38('0x1a')][_0x4f38('0x1d')]||null:null,'limit':_0x1d280f['options']?_0x1d280f['options']['limit']||null:null})[_0x4f38('0x1e')](function(_0x21a1af){logger['info'](_0x4f38('0x16'),_0x1d280f);logger[_0x4f38('0xe')]('UpdateOpenchannelApplication',_0x1d280f,JSON[_0x4f38('0x10')](_0x21a1af));_0xf8c4c9(_0x21a1af);})[_0x4f38('0x15')](function(_0x4e233a){logger[_0x4f38('0x11')]('UpdateOpenchannelApplication',_0x4e233a['message'],_0x1d280f);_0x255f05(_0x5ce982[_0x4f38('0x11')](0x1f4,_0x4e233a[_0x4f38('0x13')]));});});}; \ No newline at end of file +var _0x2641=['limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','OpenchannelApplication,\x20%s,\x20%s','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','body','options','where','attributes'];(function(_0x56f2a1,_0x41d1b9){var _0x419b0d=function(_0x11fe88){while(--_0x11fe88){_0x56f2a1['push'](_0x56f2a1['shift']());}};_0x419b0d(++_0x41d1b9);}(_0x2641,0xa1));var _0x1264=function(_0x20fc15,_0x5ba246){_0x20fc15=_0x20fc15-0x0;var _0x328d38=_0x2641[_0x20fc15];return _0x328d38;};'use strict';var _=require(_0x1264('0x0'));var util=require(_0x1264('0x1'));var moment=require(_0x1264('0x2'));var BPromise=require(_0x1264('0x3'));var rs=require(_0x1264('0x4'));var fs=require('fs');var Redis=require(_0x1264('0x5'));var db=require(_0x1264('0x6'))['db'];var utils=require(_0x1264('0x7'));var logger=require(_0x1264('0x8'))('rpc');var config=require(_0x1264('0x9'));var jayson=require(_0x1264('0xa'));var client=jayson[_0x1264('0xb')][_0x1264('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x22e06e,_0x2a9a4f,_0x2c53f9){return new BPromise(function(_0x47db8a,_0x171d4a){return client['request'](_0x22e06e,_0x2c53f9)[_0x1264('0xd')](function(_0x112d02){logger['info'](_0x1264('0xe'),_0x2a9a4f,'request\x20sent');logger[_0x1264('0xf')](_0x1264('0x10'),_0x2a9a4f,_0x1264('0x11'),JSON[_0x1264('0x12')](_0x112d02));if(_0x112d02[_0x1264('0x13')]){if(_0x112d02[_0x1264('0x13')][_0x1264('0x14')]===0x1f4){logger[_0x1264('0x13')](_0x1264('0xe'),_0x2a9a4f,_0x112d02[_0x1264('0x13')][_0x1264('0x15')]);return _0x171d4a(_0x112d02[_0x1264('0x13')][_0x1264('0x15')]);}logger[_0x1264('0x13')](_0x1264('0xe'),_0x2a9a4f,_0x112d02[_0x1264('0x13')][_0x1264('0x15')]);return _0x47db8a(_0x112d02[_0x1264('0x13')][_0x1264('0x15')]);}else{logger[_0x1264('0x16')](_0x1264('0xe'),_0x2a9a4f,'request\x20sent');_0x47db8a(_0x112d02[_0x1264('0x17')][_0x1264('0x15')]);}})[_0x1264('0x18')](function(_0x4f9fcf){logger[_0x1264('0x13')](_0x1264('0xe'),_0x2a9a4f,_0x4f9fcf);_0x171d4a(_0x4f9fcf);});});}exports[_0x1264('0x19')]=function(_0x43c967){var _0x5e59bc=this;return new Promise(function(_0x4f4639,_0xc4c7f1){return db[_0x1264('0x1a')]['update'](_0x43c967[_0x1264('0x1b')],{'raw':_0x43c967['options']?_0x43c967[_0x1264('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x43c967[_0x1264('0x1c')]?_0x43c967['options'][_0x1264('0x1d')]||null:null,'attributes':_0x43c967[_0x1264('0x1c')]?_0x43c967['options'][_0x1264('0x1e')]||null:null,'limit':_0x43c967[_0x1264('0x1c')]?_0x43c967[_0x1264('0x1c')][_0x1264('0x1f')]||null:null})[_0x1264('0xd')](function(_0x28261a){logger[_0x1264('0x16')](_0x1264('0x19'),_0x43c967);logger[_0x1264('0xf')](_0x1264('0x19'),_0x43c967,JSON[_0x1264('0x12')](_0x28261a));_0x4f4639(_0x28261a);})['catch'](function(_0x350c9a){logger[_0x1264('0x13')]('UpdateOpenchannelApplication',_0x350c9a['message'],_0x43c967);_0xc4c7f1(_0x5e59bc[_0x1264('0x13')](0x1f4,_0x350c9a['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 233bb33..c617f65 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 _0x7e3f=['create','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','put','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','/:id/messages','/:id/download','download','post'];(function(_0x2c59d4,_0x30adf7){var _0x1f9ae7=function(_0x22d006){while(--_0x22d006){_0x2c59d4['push'](_0x2c59d4['shift']());}};_0x1f9ae7(++_0x30adf7);}(_0x7e3f,0xd1));var _0xf7e3=function(_0x276be7,_0xb61f1d){_0x276be7=_0x276be7-0x0;var _0x3ab1c0=_0x7e3f[_0x276be7];return _0x3ab1c0;};'use strict';var multer=require('multer');var util=require(_0xf7e3('0x0'));var path=require('path');var timeout=require(_0xf7e3('0x1'));var express=require(_0xf7e3('0x2'));var router=express[_0xf7e3('0x3')]();var fs_extra=require(_0xf7e3('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xf7e3('0x5'));var config=require(_0xf7e3('0x6'));var controller=require('./openchannelInteraction.controller');router['get']('/',auth[_0xf7e3('0x7')](),controller[_0xf7e3('0x8')]);router['get']('/describe',auth[_0xf7e3('0x7')](),controller['describe']);router[_0xf7e3('0x9')](_0xf7e3('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xf7e3('0x9')](_0xf7e3('0xb'),auth[_0xf7e3('0x7')](),controller['getMessages']);router[_0xf7e3('0x9')](_0xf7e3('0xc'),auth[_0xf7e3('0x7')](),controller[_0xf7e3('0xd')]);router[_0xf7e3('0xe')]('/',auth[_0xf7e3('0x7')](),controller[_0xf7e3('0xf')]);router['post'](_0xf7e3('0xb'),auth[_0xf7e3('0x7')](),controller[_0xf7e3('0x10')]);router[_0xf7e3('0xe')](_0xf7e3('0x11'),auth[_0xf7e3('0x7')](),interaction[_0xf7e3('0x12')](_0xf7e3('0x13'),_0xf7e3('0x14')),controller['addTags']);router[_0xf7e3('0x15')](_0xf7e3('0xa'),auth['isAuthenticated'](),interaction[_0xf7e3('0x12')](_0xf7e3('0x13'),_0xf7e3('0x16')),controller[_0xf7e3('0x17')]);router[_0xf7e3('0x18')](_0xf7e3('0xa'),auth['isAuthenticated'](),interaction[_0xf7e3('0x12')](_0xf7e3('0x13'),_0xf7e3('0x19')),controller[_0xf7e3('0x1a')]);router['delete']('/:id/tags',auth[_0xf7e3('0x7')](),controller['removeTags']);module[_0xf7e3('0x1b')]=router; \ No newline at end of file +var _0x1460=['/:id','/:id/messages','getMessages','/:id/download','download','post','addMessage','tracked','openchannel','addTags','put','openchannelinteraction:update','update','delete','destroy','/:id/tags','removeTags','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','describe'];(function(_0x1233a7,_0x3aeb2d){var _0x2fced1=function(_0x3c8c58){while(--_0x3c8c58){_0x1233a7['push'](_0x1233a7['shift']());}};_0x2fced1(++_0x3aeb2d);}(_0x1460,0x1e6));var _0x0146=function(_0xe9ada0,_0x4d4bcc){_0xe9ada0=_0xe9ada0-0x0;var _0x21a1ca=_0x1460[_0xe9ada0];return _0x21a1ca;};'use strict';var multer=require(_0x0146('0x0'));var util=require(_0x0146('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0146('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x0146('0x3'));var interaction=require(_0x0146('0x4'));var config=require('../../config/environment');var controller=require('./openchannelInteraction.controller');router[_0x0146('0x5')]('/',auth[_0x0146('0x6')](),controller['index']);router[_0x0146('0x5')]('/describe',auth[_0x0146('0x6')](),controller[_0x0146('0x7')]);router['get'](_0x0146('0x8'),auth['isAuthenticated'](),controller['show']);router['get'](_0x0146('0x9'),auth[_0x0146('0x6')](),controller[_0x0146('0xa')]);router[_0x0146('0x5')](_0x0146('0xb'),auth[_0x0146('0x6')](),controller[_0x0146('0xc')]);router[_0x0146('0xd')]('/',auth[_0x0146('0x6')](),controller['create']);router[_0x0146('0xd')](_0x0146('0x9'),auth[_0x0146('0x6')](),controller[_0x0146('0xe')]);router[_0x0146('0xd')]('/:id/tags',auth['isAuthenticated'](),interaction[_0x0146('0xf')](_0x0146('0x10'),'openchannelinteraction:addtags'),controller[_0x0146('0x11')]);router[_0x0146('0x12')](_0x0146('0x8'),auth[_0x0146('0x6')](),interaction[_0x0146('0xf')]('openchannel',_0x0146('0x13')),controller[_0x0146('0x14')]);router[_0x0146('0x15')](_0x0146('0x8'),auth[_0x0146('0x6')](),interaction[_0x0146('0xf')](_0x0146('0x10'),'openchannelinteraction:destroy'),controller[_0x0146('0x16')]);router[_0x0146('0x15')](_0x0146('0x17'),auth[_0x0146('0x6')](),controller[_0x0146('0x18')]);module[_0x0146('0x19')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 3d1e970..7a4e808 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 _0x03ce=['DATE','STRING','ENUM','out','sequelize','exports','BOOLEAN'];(function(_0x58999b,_0xea4695){var _0x5efc3a=function(_0x98de31){while(--_0x98de31){_0x58999b['push'](_0x58999b['shift']());}};_0x5efc3a(++_0xea4695);}(_0x03ce,0x1a1));var _0xe03c=function(_0x4196f6,_0x219f6d){_0x4196f6=_0x4196f6-0x0;var _0x17344d=_0x03ce[_0x4196f6];return _0x17344d;};'use strict';var Sequelize=require(_0xe03c('0x0'));module[_0xe03c('0x1')]={'closed':{'type':Sequelize[_0xe03c('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xe03c('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xe03c('0x4')]},'thirdDisposition':{'type':Sequelize[_0xe03c('0x4')]},'note':{'type':Sequelize[_0xe03c('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0xe03c('0x4')]},'externalUrl':{'type':Sequelize[_0xe03c('0x4')]},'lastMsgAt':{'type':Sequelize[_0xe03c('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xe03c('0x5')]('in',_0xe03c('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0xe03c('0x5')]('in',_0xe03c('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x89e8=['DATE','STRING','ENUM','out','sequelize','exports','BOOLEAN'];(function(_0xee405c,_0x135503){var _0x12a589=function(_0x48bffa){while(--_0x48bffa){_0xee405c['push'](_0xee405c['shift']());}};_0x12a589(++_0x135503);}(_0x89e8,0x74));var _0x889e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x89e8[_0x4cf98e];return _0x1623ac;};'use strict';var Sequelize=require(_0x889e('0x0'));module[_0x889e('0x1')]={'closed':{'type':Sequelize[_0x889e('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x889e('0x3')]},'disposition':{'type':Sequelize[_0x889e('0x4')]},'secondDisposition':{'type':Sequelize[_0x889e('0x4')]},'thirdDisposition':{'type':Sequelize[_0x889e('0x4')]},'note':{'type':Sequelize[_0x889e('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize[_0x889e('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x889e('0x5')]('in',_0x889e('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x889e('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize[_0x889e('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index acde989..99a014d 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 _0x692b=['index','map','OpenchannelInteraction','rawAttributes','fieldName','type','key','findAll','query','catch','show','from','model','keys','intersection','attributes','fields','length','includeAll','include','options','create','body','find','params','describe','addMessage','ids','omit','getMessages','findOne','filters','hasOwnProperty','where','pick','filter','merge','$gte','OpenchannelMessage','rows','addTags','spread','color','openchannelInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','attachments','format','push','User','fullname','CmContact','Contact','firstName','lastName','Attachment','Messages','createdAt','direction','read','OpenchannelAccount','Account','Owner','get','mkdirSync','N.A.','closedAt','YYYY-MM-DD\x20HH:mm:ss','disposition','threadId','Public','Private','basename','existsSync','createReadStream','pipe','createWriteStream','System','renderFile','views','downloadInteraction.ejs','transcript-','Openchannel','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','rimraf','zip-dir','moment','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','json','offset','limit','undefined','count','update','then','destroy','end','error','stack','name','send'];(function(_0x14206d,_0x8c7313){var _0x17bf4f=function(_0x18c67a){while(--_0x18c67a){_0x14206d['push'](_0x14206d['shift']());}};_0x17bf4f(++_0x8c7313);}(_0x692b,0xd9));var _0xb692=function(_0x1031e6,_0x3e5b64){_0x1031e6=_0x1031e6-0x0;var _0x224542=_0x692b[_0x1031e6];return _0x224542;};'use strict';var rimraf=require(_0xb692('0x0'));var zipdir=require(_0xb692('0x1'));var moment=require(_0xb692('0x2'));var util=require(_0xb692('0x3'));var path=require(_0xb692('0x4'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb692('0x5'));var Redis=require(_0xb692('0x6'));var interaction=require(_0xb692('0x7'));var qs=require(_0xb692('0x8'));var pdf=require(_0xb692('0x9'));var logger=require(_0xb692('0xa'))(_0xb692('0xb'));var config=require(_0xb692('0xc'));var db=require(_0xb692('0xd'))['db'];config[_0xb692('0xe')]=_['defaults'](config[_0xb692('0xe')],{'host':_0xb692('0xf'),'port':0x18eb});var socket=require(_0xb692('0x10'))(new Redis(config[_0xb692('0xe')]));require('./openchannelInteraction.socket')[_0xb692('0x11')](socket);function respondWithStatusCode(_0x36f8e4,_0x3af507){_0x3af507=_0x3af507||0xcc;return function(_0x689c18){if(_0x689c18){return _0x36f8e4[_0xb692('0x12')](_0x3af507);}return _0x36f8e4['status'](_0x3af507)['end']();};}function respondWithResult(_0x3564e3,_0x54902b){_0x54902b=_0x54902b||0xc8;return function(_0x1ecb62){if(_0x1ecb62){return _0x3564e3[_0xb692('0x13')](_0x54902b)[_0xb692('0x14')](_0x1ecb62);}};}function respondWithFilteredResult(_0x5e2346,_0x9ce6f6){return function(_0x1448f5){if(_0x1448f5){var _0x34e96a=typeof _0x9ce6f6[_0xb692('0x15')]==='undefined'&&typeof _0x9ce6f6[_0xb692('0x16')]===_0xb692('0x17');var _0x2765b8=_0x1448f5['count'];var _0x28f601=_0x34e96a?0x0:_0x9ce6f6[_0xb692('0x15')];var _0x1e5c5b=_0x34e96a?_0x1448f5[_0xb692('0x18')]:_0x9ce6f6[_0xb692('0x15')]+_0x9ce6f6['limit'];var _0x5258b7;if(_0x1e5c5b>=_0x2765b8){_0x1e5c5b=_0x2765b8;_0x5258b7=0xc8;}else{_0x5258b7=0xce;}_0x5e2346[_0xb692('0x13')](_0x5258b7);return _0x5e2346['set']('Content-Range',_0x28f601+'-'+_0x1e5c5b+'/'+_0x2765b8)['json'](_0x1448f5);}return null;};}function saveUpdates(_0x11d0ee){return function(_0x3d19dc){if(_0x3d19dc){return _0x3d19dc[_0xb692('0x19')](_0x11d0ee)[_0xb692('0x1a')](function(_0x197e75){return _0x197e75;});}return null;};}function removeEntity(_0x170dda){return function(_0x2dc55b){if(_0x2dc55b){return _0x2dc55b[_0xb692('0x1b')]()[_0xb692('0x1a')](function(){_0x170dda['status'](0xcc)[_0xb692('0x1c')]();});}};}function handleEntityNotFound(_0x244aba){return function(_0x2f602a){if(!_0x2f602a){_0x244aba[_0xb692('0x12')](0x194);}return _0x2f602a;};}function handleError(_0x473ada,_0x34a5b0){_0x34a5b0=_0x34a5b0||0x1f4;return function(_0x403ed3){logger[_0xb692('0x1d')](_0x403ed3[_0xb692('0x1e')]);if(_0x403ed3[_0xb692('0x1f')]){delete _0x403ed3[_0xb692('0x1f')];}_0x473ada['status'](_0x34a5b0)[_0xb692('0x20')](_0x403ed3);};}exports[_0xb692('0x21')]=function(_0x516569,_0x49f146){var _0x13b316={};var _0x1c92b2=_[_0xb692('0x22')](db[_0xb692('0x23')][_0xb692('0x24')],function(_0x3f8959){return{'name':_0x3f8959[_0xb692('0x25')],'type':_0x3f8959[_0xb692('0x26')][_0xb692('0x27')]};});_0x13b316=qs['getOptions'](_0x1c92b2,_0x516569);return interaction[_0xb692('0x28')]('openchannel',_0x516569[_0xb692('0x29')],_0x516569['user'],_0x13b316,_0x1c92b2)[_0xb692('0x1a')](respondWithFilteredResult(_0x49f146,_0x13b316))[_0xb692('0x2a')](handleError(_0x49f146,null));};exports[_0xb692('0x2b')]=function(_0x492bc9,_0x2d73e2){var _0x4aeb00={};if(_0x492bc9[_0xb692('0x29')][_0xb692('0x26')]&&_0x492bc9[_0xb692('0x29')][_0xb692('0x26')]===_0xb692('0x2c')){_0x4aeb00[_0xb692('0x2c')]=_0x492bc9['params']['id'];}else{_0x4aeb00['id']=_0x492bc9['params']['id'];}var _0xa021b2={'raw':![],'where':_0x4aeb00},_0x3d6ae5={};_0x3d6ae5[_0xb692('0x2d')]=_[_0xb692('0x2e')](db[_0xb692('0x23')][_0xb692('0x24')]);_0x3d6ae5[_0xb692('0x29')]=_[_0xb692('0x2e')](_0x492bc9[_0xb692('0x29')]);_0x3d6ae5['filters']=_[_0xb692('0x2f')](_0x3d6ae5[_0xb692('0x2d')],_0x3d6ae5[_0xb692('0x29')]);_0xa021b2[_0xb692('0x30')]=_[_0xb692('0x2f')](_0x3d6ae5[_0xb692('0x2d')],qs[_0xb692('0x31')](_0x492bc9[_0xb692('0x29')][_0xb692('0x31')]));_0xa021b2[_0xb692('0x30')]=_0xa021b2[_0xb692('0x30')][_0xb692('0x32')]?_0xa021b2[_0xb692('0x30')]:_0x3d6ae5['model'];if(_0x492bc9[_0xb692('0x29')][_0xb692('0x33')]){_0xa021b2[_0xb692('0x34')]=[{'all':!![]}];}_0xa021b2=_['merge']({},_0xa021b2,_0x492bc9[_0xb692('0x35')]);return db[_0xb692('0x23')]['find'](_0xa021b2)[_0xb692('0x1a')](handleEntityNotFound(_0x2d73e2,null))[_0xb692('0x1a')](respondWithResult(_0x2d73e2,null))[_0xb692('0x2a')](handleError(_0x2d73e2,null));};exports[_0xb692('0x36')]=function(_0x53741c,_0x3afae5){return db[_0xb692('0x23')][_0xb692('0x36')](_0x53741c[_0xb692('0x37')],{})[_0xb692('0x1a')](respondWithResult(_0x3afae5,0xc9))['catch'](handleError(_0x3afae5,null));};exports['update']=function(_0x2e7cc2,_0x4226ea){if(_0x2e7cc2['body']['id']){delete _0x2e7cc2[_0xb692('0x37')]['id'];}return db[_0xb692('0x23')][_0xb692('0x38')]({'where':{'id':_0x2e7cc2[_0xb692('0x39')]['id']}})['then'](handleEntityNotFound(_0x4226ea,null))[_0xb692('0x1a')](saveUpdates(_0x2e7cc2[_0xb692('0x37')],null))[_0xb692('0x1a')](respondWithResult(_0x4226ea,null))[_0xb692('0x2a')](handleError(_0x4226ea,null));};exports[_0xb692('0x1b')]=function(_0x545f89,_0x548ea4){return db['OpenchannelInteraction']['find']({'where':{'id':_0x545f89['params']['id']}})[_0xb692('0x1a')](handleEntityNotFound(_0x548ea4,null))[_0xb692('0x1a')](removeEntity(_0x548ea4,null))[_0xb692('0x2a')](handleError(_0x548ea4,null));};exports[_0xb692('0x3a')]=function(_0x161b41,_0x353ecf){return db[_0xb692('0x23')][_0xb692('0x3a')]()['then'](respondWithResult(_0x353ecf,null))['catch'](handleError(_0x353ecf,null));};exports['addMessage']=function(_0x22e3cc,_0x4ddfd6){return db['OpenchannelMessage'][_0xb692('0x38')]({'where':{'id':_0x22e3cc[_0xb692('0x39')]['id']}})[_0xb692('0x1a')](handleEntityNotFound(_0x4ddfd6,null))[_0xb692('0x1a')](function(_0x5e975b){if(_0x5e975b){return _0x5e975b[_0xb692('0x3b')](_0x22e3cc['body'][_0xb692('0x3c')],_[_0xb692('0x3d')](_0x22e3cc[_0xb692('0x37')],[_0xb692('0x3c'),'id'])||{});}})[_0xb692('0x1a')](respondWithResult(_0x4ddfd6,null))[_0xb692('0x2a')](handleError(_0x4ddfd6,null));};exports[_0xb692('0x3e')]=function(_0x2c9916,_0x3cf43d){var _0x568280={'raw':![],'where':{}};var _0x5635e8={};var _0x378c20={'count':0x0,'rows':[]};return db[_0xb692('0x23')][_0xb692('0x3f')]({'where':{'id':_0x2c9916['params']['id']}})[_0xb692('0x1a')](handleEntityNotFound(_0x3cf43d,null))[_0xb692('0x1a')](function(_0x3e99ee){if(_0x3e99ee){_0x5635e8[_0xb692('0x2d')]=_[_0xb692('0x2e')](db['OpenchannelMessage'][_0xb692('0x24')]);_0x5635e8[_0xb692('0x29')]=_['keys'](_0x2c9916[_0xb692('0x29')]);_0x5635e8[_0xb692('0x40')]=_[_0xb692('0x2f')](_0x5635e8[_0xb692('0x2d')],_0x5635e8[_0xb692('0x29')]);_0x568280[_0xb692('0x30')]=_[_0xb692('0x2f')](_0x5635e8['model'],qs[_0xb692('0x31')](_0x2c9916[_0xb692('0x29')][_0xb692('0x31')]));_0x568280['attributes']=_0x568280[_0xb692('0x30')][_0xb692('0x32')]?_0x568280[_0xb692('0x30')]:_0x5635e8[_0xb692('0x2d')];if(!_0x2c9916[_0xb692('0x29')][_0xb692('0x41')]('nolimit')){_0x568280['limit']=qs[_0xb692('0x16')](_0x2c9916[_0xb692('0x29')][_0xb692('0x16')]);_0x568280[_0xb692('0x15')]=qs['offset'](_0x2c9916[_0xb692('0x29')][_0xb692('0x15')]);}_0x568280['order']=qs['sort'](_0x2c9916['query']['sort']);_0x568280[_0xb692('0x42')]=qs[_0xb692('0x40')](_[_0xb692('0x43')](_0x2c9916['query'],_0x5635e8[_0xb692('0x40')]));_0x568280[_0xb692('0x42')]['OpenchannelInteractionId']=_0x3e99ee['id'];if(_0x2c9916[_0xb692('0x29')][_0xb692('0x44')]){_0x568280[_0xb692('0x42')]=_[_0xb692('0x45')](_0x568280[_0xb692('0x42')],{'$or':_['map'](_0x568280['attributes'],function(_0x4d9917){var _0x3c0fa1={};_0x3c0fa1[_0x4d9917]={'$like':'%'+_0x2c9916[_0xb692('0x29')][_0xb692('0x44')]+'%'};return _0x3c0fa1;})});}if(_0x2c9916[_0xb692('0x29')][_0xb692('0x46')]){var _0x8d10f8=_0x2c9916[_0xb692('0x29')][_0xb692('0x46')]['split'](',');var _0x5591ff={};_0x5591ff[_0x8d10f8[0x0]]={'$gte':moment(_0x8d10f8[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x568280[_0xb692('0x42')]=_[_0xb692('0x45')](_0x568280[_0xb692('0x42')],_0x5591ff);}_0x568280=_[_0xb692('0x45')]({},_0x568280,_0x2c9916['options']);return db[_0xb692('0x47')][_0xb692('0x18')]({'where':_0x568280[_0xb692('0x42')]})['then'](function(_0x3c6a63){_0x378c20[_0xb692('0x18')]=_0x3c6a63;if(_0x2c9916['query'][_0xb692('0x33')]){_0x568280[_0xb692('0x34')]=[{'all':!![]}];}return db[_0xb692('0x47')][_0xb692('0x28')](_0x568280);})['then'](function(_0x4f7f2b){_0x378c20[_0xb692('0x48')]=_0x4f7f2b;return _0x378c20;});}})[_0xb692('0x1a')](respondWithFilteredResult(_0x3cf43d,_0x568280))[_0xb692('0x2a')](handleError(_0x3cf43d,null));};exports[_0xb692('0x49')]=function(_0x17a0e3,_0x4cc04c){return db[_0xb692('0x23')][_0xb692('0x38')]({'where':{'id':_0x17a0e3[_0xb692('0x39')]['id']}})[_0xb692('0x1a')](handleEntityNotFound(_0x4cc04c,null))[_0xb692('0x1a')](function(_0x4f52f7){if(_0x4f52f7){return _0x4f52f7['setTags'](_0x17a0e3['body'][_0xb692('0x3c')],_[_0xb692('0x3d')](_0x17a0e3[_0xb692('0x37')],[_0xb692('0x3c'),'id'])||{})[_0xb692('0x4a')](function(){return db['Tag'][_0xb692('0x28')]({'attributes':['id',_0xb692('0x1f'),_0xb692('0x4b')],'where':{'id':_0x17a0e3[_0xb692('0x37')]['ids']}});})[_0xb692('0x1a')](function(_0x9017ac){socket['emit'](_0xb692('0x4c'),{'id':Number(_0x17a0e3[_0xb692('0x39')]['id']),'tags':_0x9017ac||[]});return{'id':Number(_0x17a0e3[_0xb692('0x39')]['id']),'tags':_0x9017ac||[]};});}})[_0xb692('0x1a')](respondWithResult(_0x4cc04c,null))[_0xb692('0x2a')](handleError(_0x4cc04c,null));};exports[_0xb692('0x4d')]=function(_0x50b091,_0x482fca){return db['OpenchannelInteraction']['find']({'where':{'id':_0x50b091[_0xb692('0x39')]['id']}})['then'](handleEntityNotFound(_0x482fca,null))[_0xb692('0x1a')](function(_0x14adda){if(_0x14adda){return _0x14adda[_0xb692('0x4d')](_0x50b091[_0xb692('0x29')][_0xb692('0x3c')]);}})[_0xb692('0x1a')](respondWithStatusCode(_0x482fca,null))[_0xb692('0x2a')](handleError(_0x482fca,null));};exports[_0xb692('0x4e')]=function(_0x17a328,_0x3dceb4){var _0x15d3af=moment()[_0xb692('0x4f')]()[_0xb692('0x50')]();var _0x5aed1a=path[_0xb692('0x51')](config[_0xb692('0x52')],_0xb692('0x53'),_0xb692('0x54'),'tmp');var _0x5b1749=path['join'](config[_0xb692('0x52')],'server',_0xb692('0x54'),_0xb692('0x55'));var _0x495291=path['join'](_0x5aed1a,_0x15d3af);var _0x250ff6=util[_0xb692('0x56')]('transcript-%d-%s.zip',_0x17a328['params']['id'],_0x15d3af);var _0x558c57=path[_0xb692('0x51')](_0x5aed1a,_0x250ff6);var _0x540a8d=[];_0x540a8d[_0xb692('0x57')]({'model':db[_0xb692('0x58')],'as':_0xb692('0x58'),'attributes':['id',_0xb692('0x59')],'raw':!![]});_0x540a8d['push']({'model':db[_0xb692('0x5a')],'as':_0xb692('0x5b'),'attributes':['id',_0xb692('0x5c'),_0xb692('0x5d')],'raw':!![]});if(_0x17a328[_0xb692('0x29')][_0xb692('0x55')]){_0x540a8d['push']({'model':db[_0xb692('0x5e')],'as':'Attachment','raw':!![]});}var _0x2a9eec=[{'model':db['OpenchannelMessage'],'as':_0xb692('0x5f'),'attributes':['id',_0xb692('0x37'),_0xb692('0x60'),_0xb692('0x61'),'secret',_0xb692('0x62')],'include':_0x540a8d}];_0x2a9eec['push']({'model':db[_0xb692('0x63')],'as':_0xb692('0x64'),'attributes':['id',_0xb692('0x1f')]});_0x2a9eec[_0xb692('0x57')]({'model':db[_0xb692('0x58')],'as':_0xb692('0x65'),'attributes':['id',_0xb692('0x59')]});return db[_0xb692('0x23')][_0xb692('0x38')]({'where':{'id':_0x17a328[_0xb692('0x39')]['id']},'include':_0x2a9eec})['then'](handleEntityNotFound(_0x3dceb4,null))[_0xb692('0x1a')](function(_0x52226e){if(_0x52226e){var _0xabe87b=_0x52226e[_0xb692('0x66')]({'plain':!![]});fs[_0xb692('0x67')](_0x495291);var _0x10ac22={'channel':'Openchannel','account':_0xabe87b[_0xb692('0x64')][_0xb692('0x1f')],'agent':_0xabe87b[_0xb692('0x65')]?_0xabe87b[_0xb692('0x65')][_0xb692('0x59')]:_0xb692('0x68'),'createdAt':moment(_0xabe87b[_0xb692('0x60')])[_0xb692('0x56')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0xabe87b['closed']?moment(_0xabe87b[_0xb692('0x69')])[_0xb692('0x56')](_0xb692('0x6a'))['toString']():'','disposition':_0xabe87b[_0xb692('0x6b')],'visibility':_0xabe87b[_0xb692('0x6c')]?_0xb692('0x6d'):_0xb692('0x6e'),'messages':_(_0xabe87b[_0xb692('0x5f')])[_0xb692('0x44')]({'secret':![]})[_0xb692('0x22')](function(_0x2b469c){if(_0x2b469c['Attachment']){var _0x59b274=path[_0xb692('0x51')](_0x5b1749,_0x2b469c[_0xb692('0x5e')][_0xb692('0x6f')]);if(fs[_0xb692('0x70')](_0x59b274)){fs[_0xb692('0x71')](_0x59b274)[_0xb692('0x72')](fs[_0xb692('0x73')](path['join'](_0x495291,_0x2b469c[_0xb692('0x5e')][_0xb692('0x6f')])));}}return{'date':moment(_0x2b469c[_0xb692('0x60')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xb692('0x50')](),'sender':_0x2b469c[_0xb692('0x61')]==='out'?_0x2b469c[_0xb692('0x58')]?_0x2b469c[_0xb692('0x58')][_0xb692('0x59')]:_0xb692('0x74'):_0x2b469c['Contact']['firstName']+(_0x2b469c[_0xb692('0x5b')][_0xb692('0x5d')]?'\x20'+_0x2b469c[_0xb692('0x5b')][_0xb692('0x5d')]:''),'body':_0x2b469c[_0xb692('0x5e')]?_0x2b469c[_0xb692('0x5e')][_0xb692('0x6f')]:_0x2b469c['body'],'direction':_0x2b469c[_0xb692('0x61')]==='out'?'A':'C','secret':_0x2b469c['secret'],'read':_0x2b469c[_0xb692('0x62')],'attachment':_0x2b469c[_0xb692('0x5e')]};})['value']()};return ejs[_0xb692('0x75')](path[_0xb692('0x51')](config[_0xb692('0x52')],_0xb692('0x53'),_0xb692('0x76'),_0xb692('0x77')),{'interaction':_0x10ac22})[_0xb692('0x1a')](function(_0x2593d3){var _0x5e3465=path[_0xb692('0x51')](_0x495291,_0xb692('0x78')+_0xabe87b['id']+'-'+_0x15d3af+'.pdf');var _0x20cb00={'path':_0x5e3465,'channel':_0xb692('0x79'),'interactionId':_0xabe87b['id']};return pdf[_0xb692('0x7a')](_0x2593d3,_0x20cb00);})[_0xb692('0x1a')](function(){return new Promise(function(_0xbdf6c,_0x560aea){zipdir(_0x495291,{'saveTo':_0x558c57},function(_0x2ef03c,_0x279fe6){if(_0x2ef03c)return _0x560aea(_0x2ef03c);return _0xbdf6c(_0x279fe6);});})[_0xb692('0x1a')](function(){return new Promise(function(_0x5dbc34,_0x2e7dc7){rimraf(_0x495291,function(_0x3e60a2){if(_0x3e60a2)_0x2e7dc7(_0x3e60a2);return _0x5dbc34();});});})[_0xb692('0x1a')](function(){return _0x3dceb4[_0xb692('0x4e')](_0x558c57,_0x250ff6,function(_0x44274f){if(_0x44274f){logger[_0xb692('0x1d')](_0xb692('0x7b'),_0x44274f);}else{fs[_0xb692('0x7c')](_0x558c57);}});});});}else{return _0x3dceb4['sendStatus'](0xc8);}})[_0xb692('0x2a')](handleError(_0x3dceb4,null));}; \ No newline at end of file +var _0x6215=['tmp','attachments','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','lastName','Attachment','Messages','secret','read','Account','Owner','get','mkdirSync','Openchannel','N.A.','createdAt','YYYY-MM-DD\x20HH:mm:ss','toString','Public','Private','basename','existsSync','createReadStream','createWriteStream','direction','System','out','value','views','transcript-','.pdf','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','zip-dir','util','path','ejs','lodash','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','update','then','destroy','error','stack','name','send','index','OpenchannelInteraction','findAll','openchannel','query','catch','show','params','model','rawAttributes','filters','intersection','fields','attributes','length','include','merge','options','create','body','find','describe','OpenchannelMessage','addMessage','omit','ids','findOne','hasOwnProperty','order','sort','where','pick','OpenchannelInteractionId','filter','map','$gte','split','format','addTags','setTags','spread','Tag','color','emit','removeTags','download','join','root','server','files'];(function(_0x1de511,_0x3763b9){var _0xdee9e4=function(_0x2260ea){while(--_0x2260ea){_0x1de511['push'](_0x1de511['shift']());}};_0xdee9e4(++_0x3763b9);}(_0x6215,0x119));var _0x5621=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6215[_0x3dd15e];return _0x231fd0;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x5621('0x0'));var moment=require('moment');var util=require(_0x5621('0x1'));var path=require(_0x5621('0x2'));var ejs=require(_0x5621('0x3'));var fs=require('fs');var _=require(_0x5621('0x4'));var Redis=require('ioredis');var interaction=require(_0x5621('0x5'));var qs=require(_0x5621('0x6'));var pdf=require('../../components/export/pdf');var logger=require(_0x5621('0x7'))(_0x5621('0x8'));var config=require(_0x5621('0x9'));var db=require(_0x5621('0xa'))['db'];config[_0x5621('0xb')]=_[_0x5621('0xc')](config['redis'],{'host':_0x5621('0xd'),'port':0x18eb});var socket=require(_0x5621('0xe'))(new Redis(config[_0x5621('0xb')]));require(_0x5621('0xf'))[_0x5621('0x10')](socket);function respondWithStatusCode(_0x57ccae,_0xf5e389){_0xf5e389=_0xf5e389||0xcc;return function(_0x4cfb95){if(_0x4cfb95){return _0x57ccae[_0x5621('0x11')](_0xf5e389);}return _0x57ccae[_0x5621('0x12')](_0xf5e389)[_0x5621('0x13')]();};}function respondWithResult(_0xfc032c,_0x50ffd0){_0x50ffd0=_0x50ffd0||0xc8;return function(_0x3e59db){if(_0x3e59db){return _0xfc032c[_0x5621('0x12')](_0x50ffd0)[_0x5621('0x14')](_0x3e59db);}};}function respondWithFilteredResult(_0x46b591,_0xf00432){return function(_0x5905c4){if(_0x5905c4){var _0x40ee84=typeof _0xf00432[_0x5621('0x15')]===_0x5621('0x16')&&typeof _0xf00432[_0x5621('0x17')]==='undefined';var _0x17ac2f=_0x5905c4[_0x5621('0x18')];var _0x16fc45=_0x40ee84?0x0:_0xf00432[_0x5621('0x15')];var _0x504807=_0x40ee84?_0x5905c4[_0x5621('0x18')]:_0xf00432[_0x5621('0x15')]+_0xf00432[_0x5621('0x17')];var _0x56ddba;if(_0x504807>=_0x17ac2f){_0x504807=_0x17ac2f;_0x56ddba=0xc8;}else{_0x56ddba=0xce;}_0x46b591[_0x5621('0x12')](_0x56ddba);return _0x46b591['set']('Content-Range',_0x16fc45+'-'+_0x504807+'/'+_0x17ac2f)[_0x5621('0x14')](_0x5905c4);}return null;};}function saveUpdates(_0x2b484f){return function(_0x2f8764){if(_0x2f8764){return _0x2f8764[_0x5621('0x19')](_0x2b484f)[_0x5621('0x1a')](function(_0x50afc1){return _0x50afc1;});}return null;};}function removeEntity(_0x3d33d2){return function(_0x1bd37f){if(_0x1bd37f){return _0x1bd37f[_0x5621('0x1b')]()[_0x5621('0x1a')](function(){_0x3d33d2[_0x5621('0x12')](0xcc)[_0x5621('0x13')]();});}};}function handleEntityNotFound(_0x332353){return function(_0x1cb840){if(!_0x1cb840){_0x332353[_0x5621('0x11')](0x194);}return _0x1cb840;};}function handleError(_0x5345bd,_0x54496d){_0x54496d=_0x54496d||0x1f4;return function(_0x20d508){logger[_0x5621('0x1c')](_0x20d508[_0x5621('0x1d')]);if(_0x20d508[_0x5621('0x1e')]){delete _0x20d508[_0x5621('0x1e')];}_0x5345bd[_0x5621('0x12')](_0x54496d)[_0x5621('0x1f')](_0x20d508);};}exports[_0x5621('0x20')]=function(_0x40701b,_0x153efb){var _0x50ff2a={};var _0x520559=_['map'](db[_0x5621('0x21')]['rawAttributes'],function(_0x584484){return{'name':_0x584484['fieldName'],'type':_0x584484['type']['key']};});_0x50ff2a=qs['getOptions'](_0x520559,_0x40701b);return interaction[_0x5621('0x22')](_0x5621('0x23'),_0x40701b[_0x5621('0x24')],_0x40701b['user'],_0x50ff2a,_0x520559)[_0x5621('0x1a')](respondWithFilteredResult(_0x153efb,_0x50ff2a))[_0x5621('0x25')](handleError(_0x153efb,null));};exports[_0x5621('0x26')]=function(_0x293e78,_0x462856){var _0x29904d={};if(_0x293e78[_0x5621('0x24')]['type']&&_0x293e78['query']['type']==='from'){_0x29904d['from']=_0x293e78[_0x5621('0x27')]['id'];}else{_0x29904d['id']=_0x293e78[_0x5621('0x27')]['id'];}var _0xcd22fb={'raw':![],'where':_0x29904d},_0x20d3a4={};_0x20d3a4[_0x5621('0x28')]=_['keys'](db[_0x5621('0x21')][_0x5621('0x29')]);_0x20d3a4['query']=_['keys'](_0x293e78[_0x5621('0x24')]);_0x20d3a4[_0x5621('0x2a')]=_['intersection'](_0x20d3a4[_0x5621('0x28')],_0x20d3a4['query']);_0xcd22fb['attributes']=_[_0x5621('0x2b')](_0x20d3a4[_0x5621('0x28')],qs['fields'](_0x293e78['query'][_0x5621('0x2c')]));_0xcd22fb[_0x5621('0x2d')]=_0xcd22fb[_0x5621('0x2d')][_0x5621('0x2e')]?_0xcd22fb[_0x5621('0x2d')]:_0x20d3a4[_0x5621('0x28')];if(_0x293e78[_0x5621('0x24')]['includeAll']){_0xcd22fb[_0x5621('0x2f')]=[{'all':!![]}];}_0xcd22fb=_[_0x5621('0x30')]({},_0xcd22fb,_0x293e78[_0x5621('0x31')]);return db['OpenchannelInteraction']['find'](_0xcd22fb)['then'](handleEntityNotFound(_0x462856,null))[_0x5621('0x1a')](respondWithResult(_0x462856,null))[_0x5621('0x25')](handleError(_0x462856,null));};exports[_0x5621('0x32')]=function(_0x5093d6,_0x2aa3e0){return db[_0x5621('0x21')]['create'](_0x5093d6[_0x5621('0x33')],{})[_0x5621('0x1a')](respondWithResult(_0x2aa3e0,0xc9))[_0x5621('0x25')](handleError(_0x2aa3e0,null));};exports[_0x5621('0x19')]=function(_0x2d99f2,_0x55f212){if(_0x2d99f2[_0x5621('0x33')]['id']){delete _0x2d99f2[_0x5621('0x33')]['id'];}return db[_0x5621('0x21')][_0x5621('0x34')]({'where':{'id':_0x2d99f2['params']['id']}})[_0x5621('0x1a')](handleEntityNotFound(_0x55f212,null))[_0x5621('0x1a')](saveUpdates(_0x2d99f2[_0x5621('0x33')],null))[_0x5621('0x1a')](respondWithResult(_0x55f212,null))[_0x5621('0x25')](handleError(_0x55f212,null));};exports['destroy']=function(_0x274c9b,_0xb14c37){return db[_0x5621('0x21')][_0x5621('0x34')]({'where':{'id':_0x274c9b[_0x5621('0x27')]['id']}})[_0x5621('0x1a')](handleEntityNotFound(_0xb14c37,null))[_0x5621('0x1a')](removeEntity(_0xb14c37,null))['catch'](handleError(_0xb14c37,null));};exports[_0x5621('0x35')]=function(_0x4e1172,_0x3d62e6){return db[_0x5621('0x21')][_0x5621('0x35')]()['then'](respondWithResult(_0x3d62e6,null))['catch'](handleError(_0x3d62e6,null));};exports['addMessage']=function(_0x545364,_0xb53e47){return db[_0x5621('0x36')][_0x5621('0x34')]({'where':{'id':_0x545364[_0x5621('0x27')]['id']}})[_0x5621('0x1a')](handleEntityNotFound(_0xb53e47,null))[_0x5621('0x1a')](function(_0x4f6834){if(_0x4f6834){return _0x4f6834[_0x5621('0x37')](_0x545364[_0x5621('0x33')]['ids'],_[_0x5621('0x38')](_0x545364['body'],[_0x5621('0x39'),'id'])||{});}})[_0x5621('0x1a')](respondWithResult(_0xb53e47,null))['catch'](handleError(_0xb53e47,null));};exports['getMessages']=function(_0x146167,_0x3de0ad){var _0x2834e8={'raw':![],'where':{}};var _0x5ccf95={};var _0x102c3a={'count':0x0,'rows':[]};return db[_0x5621('0x21')][_0x5621('0x3a')]({'where':{'id':_0x146167['params']['id']}})[_0x5621('0x1a')](handleEntityNotFound(_0x3de0ad,null))[_0x5621('0x1a')](function(_0x3b8059){if(_0x3b8059){_0x5ccf95[_0x5621('0x28')]=_['keys'](db[_0x5621('0x36')]['rawAttributes']);_0x5ccf95[_0x5621('0x24')]=_['keys'](_0x146167[_0x5621('0x24')]);_0x5ccf95[_0x5621('0x2a')]=_[_0x5621('0x2b')](_0x5ccf95[_0x5621('0x28')],_0x5ccf95['query']);_0x2834e8[_0x5621('0x2d')]=_['intersection'](_0x5ccf95[_0x5621('0x28')],qs[_0x5621('0x2c')](_0x146167[_0x5621('0x24')][_0x5621('0x2c')]));_0x2834e8[_0x5621('0x2d')]=_0x2834e8[_0x5621('0x2d')][_0x5621('0x2e')]?_0x2834e8[_0x5621('0x2d')]:_0x5ccf95['model'];if(!_0x146167[_0x5621('0x24')][_0x5621('0x3b')]('nolimit')){_0x2834e8[_0x5621('0x17')]=qs[_0x5621('0x17')](_0x146167[_0x5621('0x24')]['limit']);_0x2834e8[_0x5621('0x15')]=qs[_0x5621('0x15')](_0x146167[_0x5621('0x24')][_0x5621('0x15')]);}_0x2834e8[_0x5621('0x3c')]=qs[_0x5621('0x3d')](_0x146167['query']['sort']);_0x2834e8[_0x5621('0x3e')]=qs[_0x5621('0x2a')](_[_0x5621('0x3f')](_0x146167['query'],_0x5ccf95['filters']));_0x2834e8[_0x5621('0x3e')][_0x5621('0x40')]=_0x3b8059['id'];if(_0x146167['query'][_0x5621('0x41')]){_0x2834e8[_0x5621('0x3e')]=_['merge'](_0x2834e8['where'],{'$or':_[_0x5621('0x42')](_0x2834e8['attributes'],function(_0x4e332c){var _0x3c41b3={};_0x3c41b3[_0x4e332c]={'$like':'%'+_0x146167[_0x5621('0x24')]['filter']+'%'};return _0x3c41b3;})});}if(_0x146167['query']['$gte']){var _0x1dd009=_0x146167[_0x5621('0x24')][_0x5621('0x43')][_0x5621('0x44')](',');var _0x26b08f={};_0x26b08f[_0x1dd009[0x0]]={'$gte':moment(_0x1dd009[0x1])[_0x5621('0x45')]('YYYY-MM-DD\x20HH:mm:ss')};_0x2834e8['where']=_[_0x5621('0x30')](_0x2834e8[_0x5621('0x3e')],_0x26b08f);}_0x2834e8=_[_0x5621('0x30')]({},_0x2834e8,_0x146167[_0x5621('0x31')]);return db[_0x5621('0x36')][_0x5621('0x18')]({'where':_0x2834e8[_0x5621('0x3e')]})[_0x5621('0x1a')](function(_0x279c84){_0x102c3a[_0x5621('0x18')]=_0x279c84;if(_0x146167[_0x5621('0x24')]['includeAll']){_0x2834e8[_0x5621('0x2f')]=[{'all':!![]}];}return db[_0x5621('0x36')][_0x5621('0x22')](_0x2834e8);})[_0x5621('0x1a')](function(_0xf0142e){_0x102c3a['rows']=_0xf0142e;return _0x102c3a;});}})['then'](respondWithFilteredResult(_0x3de0ad,_0x2834e8))[_0x5621('0x25')](handleError(_0x3de0ad,null));};exports[_0x5621('0x46')]=function(_0x410e8a,_0x2c6131){return db[_0x5621('0x21')][_0x5621('0x34')]({'where':{'id':_0x410e8a['params']['id']}})['then'](handleEntityNotFound(_0x2c6131,null))[_0x5621('0x1a')](function(_0x2f946d){if(_0x2f946d){return _0x2f946d[_0x5621('0x47')](_0x410e8a['body']['ids'],_[_0x5621('0x38')](_0x410e8a[_0x5621('0x33')],[_0x5621('0x39'),'id'])||{})[_0x5621('0x48')](function(){return db[_0x5621('0x49')][_0x5621('0x22')]({'attributes':['id',_0x5621('0x1e'),_0x5621('0x4a')],'where':{'id':_0x410e8a['body'][_0x5621('0x39')]}});})['then'](function(_0x37081f){socket[_0x5621('0x4b')]('openchannelInteractionTags:save',{'id':Number(_0x410e8a[_0x5621('0x27')]['id']),'tags':_0x37081f||[]});return{'id':Number(_0x410e8a[_0x5621('0x27')]['id']),'tags':_0x37081f||[]};});}})[_0x5621('0x1a')](respondWithResult(_0x2c6131,null))[_0x5621('0x25')](handleError(_0x2c6131,null));};exports[_0x5621('0x4c')]=function(_0x2841c0,_0xbfdceb){return db[_0x5621('0x21')]['find']({'where':{'id':_0x2841c0[_0x5621('0x27')]['id']}})['then'](handleEntityNotFound(_0xbfdceb,null))[_0x5621('0x1a')](function(_0x24ff20){if(_0x24ff20){return _0x24ff20['removeTags'](_0x2841c0['query']['ids']);}})[_0x5621('0x1a')](respondWithStatusCode(_0xbfdceb,null))[_0x5621('0x25')](handleError(_0xbfdceb,null));};exports[_0x5621('0x4d')]=function(_0x46b92b,_0x12b6db){var _0x4ed883=moment()['unix']()['toString']();var _0x6f901a=path[_0x5621('0x4e')](config[_0x5621('0x4f')],_0x5621('0x50'),_0x5621('0x51'),_0x5621('0x52'));var _0x46f8a9=path[_0x5621('0x4e')](config[_0x5621('0x4f')],_0x5621('0x50'),_0x5621('0x51'),_0x5621('0x53'));var _0xad63df=path[_0x5621('0x4e')](_0x6f901a,_0x4ed883);var _0x15b6a0=util[_0x5621('0x45')](_0x5621('0x54'),_0x46b92b[_0x5621('0x27')]['id'],_0x4ed883);var _0x3bacc9=path['join'](_0x6f901a,_0x15b6a0);var _0x13c72c=[];_0x13c72c[_0x5621('0x55')]({'model':db[_0x5621('0x56')],'as':_0x5621('0x56'),'attributes':['id',_0x5621('0x57')],'raw':!![]});_0x13c72c[_0x5621('0x55')]({'model':db[_0x5621('0x58')],'as':_0x5621('0x59'),'attributes':['id',_0x5621('0x5a'),_0x5621('0x5b')],'raw':!![]});if(_0x46b92b[_0x5621('0x24')][_0x5621('0x53')]){_0x13c72c[_0x5621('0x55')]({'model':db[_0x5621('0x5c')],'as':'Attachment','raw':!![]});}var _0x4feb05=[{'model':db[_0x5621('0x36')],'as':_0x5621('0x5d'),'attributes':['id','body','createdAt','direction',_0x5621('0x5e'),_0x5621('0x5f')],'include':_0x13c72c}];_0x4feb05[_0x5621('0x55')]({'model':db['OpenchannelAccount'],'as':_0x5621('0x60'),'attributes':['id','name']});_0x4feb05[_0x5621('0x55')]({'model':db[_0x5621('0x56')],'as':_0x5621('0x61'),'attributes':['id',_0x5621('0x57')]});return db['OpenchannelInteraction'][_0x5621('0x34')]({'where':{'id':_0x46b92b[_0x5621('0x27')]['id']},'include':_0x4feb05})['then'](handleEntityNotFound(_0x12b6db,null))[_0x5621('0x1a')](function(_0x4b71c9){if(_0x4b71c9){var _0x381ffa=_0x4b71c9[_0x5621('0x62')]({'plain':!![]});fs[_0x5621('0x63')](_0xad63df);var _0x210dd1={'channel':_0x5621('0x64'),'account':_0x381ffa['Account']['name'],'agent':_0x381ffa['Owner']?_0x381ffa[_0x5621('0x61')][_0x5621('0x57')]:_0x5621('0x65'),'createdAt':moment(_0x381ffa[_0x5621('0x66')])[_0x5621('0x45')](_0x5621('0x67'))[_0x5621('0x68')](),'closedAt':_0x381ffa['closed']?moment(_0x381ffa['closedAt'])[_0x5621('0x45')](_0x5621('0x67'))['toString']():'','disposition':_0x381ffa['disposition'],'visibility':_0x381ffa['threadId']?_0x5621('0x69'):_0x5621('0x6a'),'messages':_(_0x381ffa[_0x5621('0x5d')])['filter']({'secret':![]})[_0x5621('0x42')](function(_0x36c4d0){if(_0x36c4d0[_0x5621('0x5c')]){var _0xacda22=path[_0x5621('0x4e')](_0x46f8a9,_0x36c4d0[_0x5621('0x5c')][_0x5621('0x6b')]);if(fs[_0x5621('0x6c')](_0xacda22)){fs[_0x5621('0x6d')](_0xacda22)['pipe'](fs[_0x5621('0x6e')](path[_0x5621('0x4e')](_0xad63df,_0x36c4d0[_0x5621('0x5c')][_0x5621('0x6b')])));}}return{'date':moment(_0x36c4d0[_0x5621('0x66')])[_0x5621('0x45')](_0x5621('0x67'))['toString'](),'sender':_0x36c4d0[_0x5621('0x6f')]==='out'?_0x36c4d0[_0x5621('0x56')]?_0x36c4d0[_0x5621('0x56')]['fullname']:_0x5621('0x70'):_0x36c4d0[_0x5621('0x59')][_0x5621('0x5a')]+(_0x36c4d0[_0x5621('0x59')][_0x5621('0x5b')]?'\x20'+_0x36c4d0['Contact'][_0x5621('0x5b')]:''),'body':_0x36c4d0['Attachment']?_0x36c4d0[_0x5621('0x5c')][_0x5621('0x6b')]:_0x36c4d0[_0x5621('0x33')],'direction':_0x36c4d0[_0x5621('0x6f')]===_0x5621('0x71')?'A':'C','secret':_0x36c4d0[_0x5621('0x5e')],'read':_0x36c4d0[_0x5621('0x5f')],'attachment':_0x36c4d0['Attachment']};})[_0x5621('0x72')]()};return ejs['renderFile'](path[_0x5621('0x4e')](config[_0x5621('0x4f')],_0x5621('0x50'),_0x5621('0x73'),'downloadInteraction.ejs'),{'interaction':_0x210dd1})['then'](function(_0xcc4822){var _0x5bda79=path[_0x5621('0x4e')](_0xad63df,_0x5621('0x74')+_0x381ffa['id']+'-'+_0x4ed883+_0x5621('0x75'));var _0x476877={'path':_0x5bda79,'channel':_0x5621('0x64'),'interactionId':_0x381ffa['id']};return pdf[_0x5621('0x76')](_0xcc4822,_0x476877);})['then'](function(){return new Promise(function(_0x2a651e,_0x15ccb9){zipdir(_0xad63df,{'saveTo':_0x3bacc9},function(_0x48cdbe,_0x241ac8){if(_0x48cdbe)return _0x15ccb9(_0x48cdbe);return _0x2a651e(_0x241ac8);});})[_0x5621('0x1a')](function(){return new Promise(function(_0x3f409c,_0x34e50c){rimraf(_0xad63df,function(_0x214116){if(_0x214116)_0x34e50c(_0x214116);return _0x3f409c();});});})[_0x5621('0x1a')](function(){return _0x12b6db[_0x5621('0x4d')](_0x3bacc9,_0x15b6a0,function(_0x3eefc9){if(_0x3eefc9){logger[_0x5621('0x1c')](_0x5621('0x77'),_0x3eefc9);}else{fs[_0x5621('0x78')](_0x3bacc9);}});});});}else{return _0x12b6db[_0x5621('0x11')](0xc8);}})[_0x5621('0x25')](handleError(_0x12b6db,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index a73321c..676072e 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 _0x34d6=['length','emit','catch','hasOwnProperty','hook','exports','events','OpenchannelInteraction','../../mysqldb','setMaxListeners','getUsers','then','setDataValue','map','findAll'];(function(_0x554d2e,_0x2439bc){var _0x591868=function(_0x4fc567){while(--_0x4fc567){_0x554d2e['push'](_0x554d2e['shift']());}};_0x591868(++_0x2439bc);}(_0x34d6,0x17d));var _0x634d=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x34d6[_0x5c2e3e];return _0x53f64a;};'use strict';var EventEmitter=require(_0x634d('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db'][_0x634d('0x1')];var OpenchannelMessage=require(_0x634d('0x2'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x634d('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x16920d){return function(_0x2f94ce,_0x112d6f,_0x411bfd){_0x2f94ce[_0x634d('0x4')]({'attributes':['id'],'raw':!![]})[_0x634d('0x5')](function(_0x3ae3c3){_0x2f94ce[_0x634d('0x6')]('Users',_0x3ae3c3[_0x634d('0x7')](function(_0x46f2d2){return{'id':_0x46f2d2['id']};}));return OpenchannelMessage[_0x634d('0x8')]({'where':{'OpenchannelInteractionId':_0x2f94ce['id'],'direction':'in','read':![]},'raw':!![]});})[_0x634d('0x5')](function(_0x316334){_0x2f94ce[_0x634d('0x6')]('unreadMessages',_0x316334[_0x634d('0x9')]);OpenchannelInteractionEvents['emit'](_0x16920d+':'+_0x2f94ce['id'],_0x2f94ce);OpenchannelInteractionEvents[_0x634d('0xa')](_0x16920d,_0x2f94ce);_0x411bfd(null);})[_0x634d('0xb')](_0x411bfd(null));};}for(var e in events){if(events[_0x634d('0xc')](e)){var event=events[e];OpenchannelInteraction[_0x634d('0xd')](e,emitEvent(event));}}module[_0x634d('0xe')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x1ed0=['save','getUsers','then','setDataValue','Users','map','length','emit','catch','hook','exports','events','../../mysqldb'];(function(_0x407041,_0x2571be){var _0x107d8c=function(_0x5c8ef9){while(--_0x5c8ef9){_0x407041['push'](_0x407041['shift']());}};_0x107d8c(++_0x2571be);}(_0x1ed0,0x8d));var _0x01ed=function(_0x5285f9,_0x2bd7d7){_0x5285f9=_0x5285f9-0x0;var _0x6edc0c=_0x1ed0[_0x5285f9];return _0x6edc0c;};'use strict';var EventEmitter=require(_0x01ed('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0x01ed('0x1'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x01ed('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x23e7be){return function(_0xfe8def,_0x19ddb8,_0x4f8e69){_0xfe8def[_0x01ed('0x3')]({'attributes':['id'],'raw':!![]})[_0x01ed('0x4')](function(_0x591636){_0xfe8def[_0x01ed('0x5')](_0x01ed('0x6'),_0x591636[_0x01ed('0x7')](function(_0x30eda0){return{'id':_0x30eda0['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0xfe8def['id'],'direction':'in','read':![]},'raw':!![]});})[_0x01ed('0x4')](function(_0x1cabed){_0xfe8def['setDataValue']('unreadMessages',_0x1cabed[_0x01ed('0x8')]);OpenchannelInteractionEvents[_0x01ed('0x9')](_0x23e7be+':'+_0xfe8def['id'],_0xfe8def);OpenchannelInteractionEvents[_0x01ed('0x9')](_0x23e7be,_0xfe8def);_0x4f8e69(null);})[_0x01ed('0xa')](_0x4f8e69(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0x01ed('0xb')](e,emitEvent(event));}}module[_0x01ed('0xc')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 67693f3..da35f2e 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 _0x878e=['utf8mb4','utf8mb4_unicode_ci','changed','closed','closedAt','format','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelInteraction.attributes','define','OpenchannelInteraction'];(function(_0x120c91,_0x334389){var _0x4c49de=function(_0x20788a){while(--_0x20788a){_0x120c91['push'](_0x120c91['shift']());}};_0x4c49de(++_0x334389);}(_0x878e,0x1ce));var _0xe878=function(_0x263b9f,_0x510f5a){_0x263b9f=_0x263b9f-0x0;var _0x4db4ab=_0x878e[_0x263b9f];return _0x4db4ab;};'use strict';var _=require(_0xe878('0x0'));var util=require(_0xe878('0x1'));var logger=require(_0xe878('0x2'))(_0xe878('0x3'));var moment=require(_0xe878('0x4'));var BPromise=require(_0xe878('0x5'));var rp=require(_0xe878('0x6'));var fs=require('fs');var path=require(_0xe878('0x7'));var rimraf=require(_0xe878('0x8'));var config=require(_0xe878('0x9'));var attributes=require(_0xe878('0xa'));module['exports']=function(_0x26473a,_0x4a7437){return _0x26473a[_0xe878('0xb')](_0xe878('0xc'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe878('0xd'),'collate':_0xe878('0xe'),'hooks':{'beforeUpdate':function(_0x2e6a7f,_0x187e15,_0xa3a70c){if(_0x2e6a7f[_0xe878('0xf')](_0xe878('0x10'))){_0x2e6a7f[_0xe878('0x11')]=moment()[_0xe878('0x12')]('YYYY-MM-DD\x20HH:mm:ss');}_0xa3a70c(null,_0x2e6a7f);}}});}; \ No newline at end of file +var _0xd3a7=['define','utf8mb4','utf8mb4_unicode_ci','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','exports'];(function(_0x5743d9,_0x506537){var _0x2bcd90=function(_0x2474bd){while(--_0x2474bd){_0x5743d9['push'](_0x5743d9['shift']());}};_0x2bcd90(++_0x506537);}(_0xd3a7,0x107));var _0x7d3a=function(_0x65123b,_0x1daec1){_0x65123b=_0x65123b-0x0;var _0x527096=_0xd3a7[_0x65123b];return _0x527096;};'use strict';var _=require(_0x7d3a('0x0'));var util=require(_0x7d3a('0x1'));var logger=require(_0x7d3a('0x2'))(_0x7d3a('0x3'));var moment=require(_0x7d3a('0x4'));var BPromise=require('bluebird');var rp=require(_0x7d3a('0x5'));var fs=require('fs');var path=require(_0x7d3a('0x6'));var rimraf=require('rimraf');var config=require(_0x7d3a('0x7'));var attributes=require('./openchannelInteraction.attributes');module[_0x7d3a('0x8')]=function(_0x1471d0,_0x18ea62){return _0x1471d0[_0x7d3a('0x9')]('OpenchannelInteraction',attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7d3a('0xa'),'collate':_0x7d3a('0xb'),'hooks':{'beforeUpdate':function(_0x31bdc8,_0x528abb,_0x1044ca){if(_0x31bdc8['changed'](_0x7d3a('0xc'))){_0x31bdc8[_0x7d3a('0xd')]=moment()[_0x7d3a('0xe')](_0x7d3a('0xf'));}_0x1044ca(null,_0x31bdc8);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index ca6a8a5..50b3f59 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 _0xba11=['omit','spread','AddTags','lodash','util','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./openchannelInteraction.socket','register','request','then','OpenchannelInteraction,\x20%s,\x20%s','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','UpdateOpenchannelInteraction','update','body','raw','options','attributes','stringify','AddTagsToOpenchannelInteraction','find','where','addTags','ids'];(function(_0x35d59c,_0x341ef9){var _0x18cd27=function(_0x16a9c4){while(--_0x16a9c4){_0x35d59c['push'](_0x35d59c['shift']());}};_0x18cd27(++_0x341ef9);}(_0xba11,0x114));var _0x1ba1=function(_0x49a023,_0x104a22){_0x49a023=_0x49a023-0x0;var _0x461991=_0xba11[_0x49a023];return _0x461991;};'use strict';var _=require(_0x1ba1('0x0'));var util=require(_0x1ba1('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1ba1('0x2'));var logger=require(_0x1ba1('0x3'))('rpc');var config=require(_0x1ba1('0x4'));var jayson=require(_0x1ba1('0x5'));var client=jayson[_0x1ba1('0x6')]['http']({'port':0x232a});config[_0x1ba1('0x7')]=_[_0x1ba1('0x8')](config[_0x1ba1('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x1ba1('0x9'))(new Redis(config[_0x1ba1('0x7')]));require(_0x1ba1('0xa'))[_0x1ba1('0xb')](socket);function respondWithRpcPromise(_0x935952,_0x534ba9,_0x4ce9b2){return new BPromise(function(_0xfcfd86,_0x468ac2){return client[_0x1ba1('0xc')](_0x935952,_0x4ce9b2)[_0x1ba1('0xd')](function(_0x3ace65){logger['info'](_0x1ba1('0xe'),_0x534ba9,'request\x20sent');logger[_0x1ba1('0xf')](_0x1ba1('0x10'),_0x534ba9,_0x1ba1('0x11'),JSON['stringify'](_0x3ace65));if(_0x3ace65[_0x1ba1('0x12')]){if(_0x3ace65[_0x1ba1('0x12')][_0x1ba1('0x13')]===0x1f4){logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x534ba9,_0x3ace65[_0x1ba1('0x12')]['message']);return _0x468ac2(_0x3ace65[_0x1ba1('0x12')][_0x1ba1('0x14')]);}logger[_0x1ba1('0x12')](_0x1ba1('0xe'),_0x534ba9,_0x3ace65['error']['message']);return _0xfcfd86(_0x3ace65[_0x1ba1('0x12')][_0x1ba1('0x14')]);}else{logger[_0x1ba1('0x15')](_0x1ba1('0xe'),_0x534ba9,'request\x20sent');_0xfcfd86(_0x3ace65[_0x1ba1('0x16')][_0x1ba1('0x14')]);}})[_0x1ba1('0x17')](function(_0x1eaf29){logger[_0x1ba1('0x12')](_0x1ba1('0xe'),_0x534ba9,_0x1eaf29);_0x468ac2(_0x1eaf29);});});}exports[_0x1ba1('0x18')]=function(_0x283832){var _0x219b8a=this;return new Promise(function(_0x1db5d7,_0xe48a07){return db['OpenchannelInteraction'][_0x1ba1('0x19')](_0x283832[_0x1ba1('0x1a')],{'raw':_0x283832['options']?_0x283832['options'][_0x1ba1('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x283832[_0x1ba1('0x1c')]?_0x283832[_0x1ba1('0x1c')]['where']||null:null,'attributes':_0x283832['options']?_0x283832[_0x1ba1('0x1c')][_0x1ba1('0x1d')]||null:null,'limit':_0x283832['options']?_0x283832[_0x1ba1('0x1c')]['limit']||null:null})[_0x1ba1('0xd')](function(_0x243075){logger['info'](_0x1ba1('0x18'),_0x283832);logger[_0x1ba1('0xf')](_0x1ba1('0x18'),_0x283832,JSON[_0x1ba1('0x1e')](_0x243075));_0x1db5d7(_0x243075);})['catch'](function(_0x345b55){logger[_0x1ba1('0x12')](_0x1ba1('0x18'),_0x345b55['message'],_0x283832);_0xe48a07(_0x219b8a['error'](0x1f4,_0x345b55[_0x1ba1('0x14')]));});});};exports[_0x1ba1('0x1f')]=function(_0x3f92da){return new Promise(function(_0x3e30d5,_0x3d34e0){return db['OpenchannelInteraction'][_0x1ba1('0x20')]({'where':_0x3f92da[_0x1ba1('0x1c')]?_0x3f92da[_0x1ba1('0x1c')][_0x1ba1('0x21')]||null:null})[_0x1ba1('0xd')](function(_0x4276be){if(_0x4276be){return _0x4276be[_0x1ba1('0x22')](_0x3f92da[_0x1ba1('0x1a')][_0x1ba1('0x23')],_[_0x1ba1('0x24')](_0x3f92da[_0x1ba1('0x1a')],[_0x1ba1('0x23'),'id'])||{});}})[_0x1ba1('0x25')](function(_0x1ca3e0){logger[_0x1ba1('0x15')](_0x1ba1('0x26'),_0x3f92da);logger['debug'](_0x1ba1('0x26'),_0x3f92da,JSON[_0x1ba1('0x1e')](_0x1ca3e0));_0x3e30d5(_0x1ca3e0);})[_0x1ba1('0x17')](function(_0x1c571e){logger[_0x1ba1('0x12')](_0x1ba1('0x26'),_0x1c571e[_0x1ba1('0x14')],_0x3f92da);_0x3d34e0(_this[_0x1ba1('0x12')](0x1f4,_0x1c571e[_0x1ba1('0x14')]));});});}; \ No newline at end of file +var _0xbd4c=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','request','then','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','error','code','message','info','result','UpdateOpenchannelInteraction','update','body','raw','options','where','limit','stringify','catch','find','ids','omit','spread','AddTags','lodash','util'];(function(_0x686070,_0x5b6c83){var _0x313343=function(_0x3e0de4){while(--_0x3e0de4){_0x686070['push'](_0x686070['shift']());}};_0x313343(++_0x5b6c83);}(_0xbd4c,0x12b));var _0xcbd4=function(_0x41d75b,_0x5d5fd6){_0x41d75b=_0x41d75b-0x0;var _0xec758e=_0xbd4c[_0x41d75b];return _0xec758e;};'use strict';var _=require(_0xcbd4('0x0'));var util=require(_0xcbd4('0x1'));var moment=require(_0xcbd4('0x2'));var BPromise=require(_0xcbd4('0x3'));var rs=require(_0xcbd4('0x4'));var fs=require('fs');var Redis=require(_0xcbd4('0x5'));var db=require(_0xcbd4('0x6'))['db'];var utils=require(_0xcbd4('0x7'));var logger=require(_0xcbd4('0x8'))('rpc');var config=require(_0xcbd4('0x9'));var jayson=require(_0xcbd4('0xa'));var client=jayson[_0xcbd4('0xb')][_0xcbd4('0xc')]({'port':0x232a});config['redis']=_[_0xcbd4('0xd')](config[_0xcbd4('0xe')],{'host':_0xcbd4('0xf'),'port':0x18eb});var socket=require(_0xcbd4('0x10'))(new Redis(config[_0xcbd4('0xe')]));require('./openchannelInteraction.socket')[_0xcbd4('0x11')](socket);function respondWithRpcPromise(_0x29597c,_0x118daa,_0x33c0b8){return new BPromise(function(_0x4ee5f5,_0x260ca4){return client[_0xcbd4('0x12')](_0x29597c,_0x33c0b8)[_0xcbd4('0x13')](function(_0xd0c8f1){logger['info'](_0xcbd4('0x14'),_0x118daa,_0xcbd4('0x15'));logger[_0xcbd4('0x16')](_0xcbd4('0x17'),_0x118daa,_0xcbd4('0x15'),JSON['stringify'](_0xd0c8f1));if(_0xd0c8f1[_0xcbd4('0x18')]){if(_0xd0c8f1[_0xcbd4('0x18')][_0xcbd4('0x19')]===0x1f4){logger[_0xcbd4('0x18')](_0xcbd4('0x14'),_0x118daa,_0xd0c8f1[_0xcbd4('0x18')][_0xcbd4('0x1a')]);return _0x260ca4(_0xd0c8f1[_0xcbd4('0x18')][_0xcbd4('0x1a')]);}logger[_0xcbd4('0x18')](_0xcbd4('0x14'),_0x118daa,_0xd0c8f1[_0xcbd4('0x18')][_0xcbd4('0x1a')]);return _0x4ee5f5(_0xd0c8f1[_0xcbd4('0x18')]['message']);}else{logger[_0xcbd4('0x1b')](_0xcbd4('0x14'),_0x118daa,_0xcbd4('0x15'));_0x4ee5f5(_0xd0c8f1[_0xcbd4('0x1c')][_0xcbd4('0x1a')]);}})['catch'](function(_0x4f655d){logger['error'](_0xcbd4('0x14'),_0x118daa,_0x4f655d);_0x260ca4(_0x4f655d);});});}exports[_0xcbd4('0x1d')]=function(_0x512988){var _0x270f6d=this;return new Promise(function(_0x3c6965,_0x3ad266){return db['OpenchannelInteraction'][_0xcbd4('0x1e')](_0x512988[_0xcbd4('0x1f')],{'raw':_0x512988['options']?_0x512988['options'][_0xcbd4('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x512988[_0xcbd4('0x21')]?_0x512988['options'][_0xcbd4('0x22')]||null:null,'attributes':_0x512988[_0xcbd4('0x21')]?_0x512988['options']['attributes']||null:null,'limit':_0x512988['options']?_0x512988['options'][_0xcbd4('0x23')]||null:null})['then'](function(_0x51afbd){logger[_0xcbd4('0x1b')](_0xcbd4('0x1d'),_0x512988);logger['debug'](_0xcbd4('0x1d'),_0x512988,JSON[_0xcbd4('0x24')](_0x51afbd));_0x3c6965(_0x51afbd);})[_0xcbd4('0x25')](function(_0x3e5ab4){logger[_0xcbd4('0x18')]('UpdateOpenchannelInteraction',_0x3e5ab4[_0xcbd4('0x1a')],_0x512988);_0x3ad266(_0x270f6d[_0xcbd4('0x18')](0x1f4,_0x3e5ab4[_0xcbd4('0x1a')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x258eaf){return new Promise(function(_0x76aae1,_0x104bba){return db['OpenchannelInteraction'][_0xcbd4('0x26')]({'where':_0x258eaf[_0xcbd4('0x21')]?_0x258eaf[_0xcbd4('0x21')][_0xcbd4('0x22')]||null:null})['then'](function(_0xc8ecf9){if(_0xc8ecf9){return _0xc8ecf9['addTags'](_0x258eaf['body'][_0xcbd4('0x27')],_[_0xcbd4('0x28')](_0x258eaf[_0xcbd4('0x1f')],['ids','id'])||{});}})[_0xcbd4('0x29')](function(_0x80adfd){logger['info'](_0xcbd4('0x2a'),_0x258eaf);logger['debug']('AddTags',_0x258eaf,JSON[_0xcbd4('0x24')](_0x80adfd));_0x76aae1(_0x80adfd);})[_0xcbd4('0x25')](function(_0xbb8aca){logger['error'](_0xcbd4('0x2a'),_0xbb8aca[_0xcbd4('0x1a')],_0x258eaf);_0x104bba(_this['error'](0x1f4,_0xbb8aca[_0xcbd4('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 4f2a0a7..2ce4c1c 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 _0x3f6b=['update','emit','removeListener','register','save','remove'];(function(_0x3f477c,_0x52b7ff){var _0x4c36b3=function(_0x3b47bb){while(--_0x3b47bb){_0x3f477c['push'](_0x3f477c['shift']());}};_0x4c36b3(++_0x52b7ff);}(_0x3f6b,0xf4));var _0xb3f6=function(_0x25c324,_0x1b0a6e){_0x25c324=_0x25c324-0x0;var _0x1a6f16=_0x3f6b[_0x25c324];return _0x1a6f16;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0xb3f6('0x0'),_0xb3f6('0x1'),_0xb3f6('0x2')];function createListener(_0x460798,_0x4eeb79){return function(_0x2e18fd){_0x4eeb79[_0xb3f6('0x3')](_0x460798,_0x2e18fd);};}function removeListener(_0x27189f,_0x53eae3){return function(){OpenchannelInteractionEvents[_0xb3f6('0x4')](_0x27189f,_0x53eae3);};}exports[_0xb3f6('0x5')]=function(_0x251f6f){for(var _0xd6218d=0x0,_0xea331b=events['length'];_0xd6218d<_0xea331b;_0xd6218d++){var _0xd63b07=events[_0xd6218d];var _0x3b24ba=createListener('openchannelInteraction:'+_0xd63b07,_0x251f6f);OpenchannelInteractionEvents['on'](_0xd63b07,_0x3b24ba);}}; \ No newline at end of file +var _0x328e=['emit','removeListener','length','openchannelInteraction:','./openchannelInteraction.events','remove','update'];(function(_0x382606,_0xba33c2){var _0x402a38=function(_0x3a0c49){while(--_0x3a0c49){_0x382606['push'](_0x382606['shift']());}};_0x402a38(++_0xba33c2);}(_0x328e,0x170));var _0xe328=function(_0x3401ab,_0x5e1301){_0x3401ab=_0x3401ab-0x0;var _0x438391=_0x328e[_0x3401ab];return _0x438391;};'use strict';var OpenchannelInteractionEvents=require(_0xe328('0x0'));var events=['save',_0xe328('0x1'),_0xe328('0x2')];function createListener(_0x15d8ba,_0x1e16ce){return function(_0x6a8a80){_0x1e16ce[_0xe328('0x3')](_0x15d8ba,_0x6a8a80);};}function removeListener(_0x567823,_0x59c20a){return function(){OpenchannelInteractionEvents[_0xe328('0x4')](_0x567823,_0x59c20a);};}exports['register']=function(_0xcbf391){for(var _0x39c4f7=0x0,_0x35b620=events[_0xe328('0x5')];_0x39c4f7<_0x35b620;_0x39c4f7++){var _0x5367fc=events[_0x39c4f7];var _0x46d6b5=createListener(_0xe328('0x6')+_0x5367fc,_0xcbf391);OpenchannelInteractionEvents['on'](_0x5367fc,_0x46d6b5);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index c248749..c551d39 100644 --- a/server/api/openchannelMessage/index.js +++ b/server/api/openchannelMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['openchannelmessage:create','put','update','/:id/reject','reject','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','get','index','isAuthenticated','describe','/:id','post','tracked','openchannel'];(function(_0x5bcb0f,_0x221e89){var _0x57eec2=function(_0x8e295){while(--_0x8e295){_0x5bcb0f['push'](_0x5bcb0f['shift']());}};_0x57eec2(++_0x221e89);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x318840,_0x561b1e){_0x318840=_0x318840-0x0;var _0x223da4=_0xcb91[_0x318840];return _0x223da4;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');var controller=require(_0x1cb9('0x6'));router[_0x1cb9('0x7')]('/',auth['isAuthenticated'](),controller[_0x1cb9('0x8')]);router[_0x1cb9('0x7')]('/describe',auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xa')]);router['get'](_0x1cb9('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x1cb9('0xc')]('/',auth[_0x1cb9('0x9')](),interaction[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x1cb9('0xf')),controller['create']);router[_0x1cb9('0x10')](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x11')]);router[_0x1cb9('0x10')]('/:id/accept',auth['isAuthenticated'](),controller['accept']);router[_0x1cb9('0x10')](_0x1cb9('0x12'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x13')]);router['delete'](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x14')]);module[_0x1cb9('0x15')]=router; \ No newline at end of file +var _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(_0x2b884c,_0x46772a){var _0x1912fc=function(_0x1de344){while(--_0x1de344){_0x2b884c['push'](_0x2b884c['shift']());}};_0x1912fc(++_0x46772a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),interaction[_0x0a9e('0xe')](_0x0a9e('0xf'),_0x0a9e('0x10')),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0x11')]);router[_0x0a9e('0x12')](_0x0a9e('0x13'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x12')]('/:id/reject',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x15')]);router[_0x0a9e('0x16')](_0x0a9e('0x17'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index df8a77f..8ee1536 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 _0xd139=['BOOLEAN','ENUM','out','DATE','STRING','sequelize','exports'];(function(_0x2bf00b,_0xc27791){var _0x1bc255=function(_0x280f48){while(--_0x280f48){_0x2bf00b['push'](_0x2bf00b['shift']());}};_0x1bc255(++_0xc27791);}(_0xd139,0x14e));var _0x9d13=function(_0x503182,_0x52fbeb){_0x503182=_0x503182-0x0;var _0x58913d=_0xd139[_0x503182];return _0x58913d;};'use strict';var Sequelize=require(_0x9d13('0x0'));module[_0x9d13('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x9d13('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0x9d13('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x9d13('0x3')]('in',_0x9d13('0x4')),'defaultValue':_0x9d13('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x9d13('0x5')]},'providerName':{'type':Sequelize[_0x9d13('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x9d9b=['STRING','exports','TEXT','BOOLEAN','ENUM','out'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9d9b,0x1e1));var _0xb9d9=function(_0x280089,_0x1d63f4){_0x280089=_0x280089-0x0;var _0x1c75f3=_0x9d9b[_0x280089];return _0x1c75f3;};'use strict';var Sequelize=require('sequelize');module[_0xb9d9('0x0')]={'body':{'type':Sequelize[_0xb9d9('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xb9d9('0x2')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xb9d9('0x3')]('in',_0xb9d9('0x4')),'defaultValue':_0xb9d9('0x4'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0xb9d9('0x5')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 69b19c9..c005df0 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 _0xc8f5=['querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','./openchannelMessage.socket','register','http','request','then','info','request\x20sent','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','offset','undefined','set','json','apply','save','update','stack','name','send','index','map','OpenchannelMessage','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','include','rows','params','rawAttributes','find','create','body','destroy','describe','openchannel-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','isNil','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','User','fullname','email','internal','interface','motionChannel','EventManager','reject','openchannel','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','ContactId','contact','SIP/%s','channel','event','rejectmessage','eml-format','rimraf','fast-json-patch','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0x4c463a,_0x4411bb){var _0x54f816=function(_0x3086ce){while(--_0x3086ce){_0x4c463a['push'](_0x4c463a['shift']());}};_0x54f816(++_0x4411bb);}(_0xc8f5,0xeb));var _0x5c8f=function(_0x527a53,_0x3265d6){_0x527a53=_0x527a53-0x0;var _0x2332f5=_0xc8f5[_0x527a53];return _0x2332f5;};'use strict';var emlformat=require(_0x5c8f('0x0'));var rimraf=require(_0x5c8f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5c8f('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5c8f('0x3'));var util=require(_0x5c8f('0x4'));var path=require(_0x5c8f('0x5'));var sox=require('sox');var csv=require(_0x5c8f('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5c8f('0x7'));var _=require(_0x5c8f('0x8'));var squel=require(_0x5c8f('0x9'));var crypto=require(_0x5c8f('0xa'));var jsforce=require(_0x5c8f('0xb'));var deskjs=require(_0x5c8f('0xc'));var toCsv=require('to-csv');var querystring=require(_0x5c8f('0xd'));var Papa=require(_0x5c8f('0xe'));var Redis=require('ioredis');var authService=require(_0x5c8f('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x5c8f('0x10'));var hardwareService=require(_0x5c8f('0x11'));var logger=require(_0x5c8f('0x12'))('api');var utils=require(_0x5c8f('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5c8f('0x14'))['db'];config[_0x5c8f('0x15')]=_[_0x5c8f('0x16')](config[_0x5c8f('0x15')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x5c8f('0x17'))[_0x5c8f('0x18')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x5c8f('0x19')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x35a6f7,_0x38a61f,_0x1d4c58,_0x3782b6){return new BPromise(function(_0xf6e4ea,_0x3160a0){var _0x50c505=_0x3782b6||client;return _0x50c505[_0x5c8f('0x1a')](_0x35a6f7,_0x1d4c58)[_0x5c8f('0x1b')](function(_0x1a0f20){logger[_0x5c8f('0x1c')]('OpenchannelMessage,\x20%s,\x20%s',_0x38a61f,_0x5c8f('0x1d'));logger['debug'](_0x5c8f('0x1e'),_0x38a61f,_0x5c8f('0x1d'),JSON[_0x5c8f('0x1f')](_0x1a0f20));if(_0x1a0f20[_0x5c8f('0x20')]){if(_0x1a0f20['error'][_0x5c8f('0x21')]===0x1f4){logger[_0x5c8f('0x20')](_0x5c8f('0x22'),_0x38a61f,_0x1a0f20[_0x5c8f('0x20')][_0x5c8f('0x23')]);return _0x3160a0(_0x1a0f20[_0x5c8f('0x20')]['message']);}logger[_0x5c8f('0x20')](_0x5c8f('0x22'),_0x38a61f,_0x1a0f20[_0x5c8f('0x20')][_0x5c8f('0x23')]);return _0xf6e4ea(_0x1a0f20[_0x5c8f('0x20')][_0x5c8f('0x23')]);}else{logger[_0x5c8f('0x1c')](_0x5c8f('0x22'),_0x38a61f,'request\x20sent');_0xf6e4ea(_0x1a0f20[_0x5c8f('0x24')][_0x5c8f('0x23')]);}})[_0x5c8f('0x25')](function(_0x53c6ed){logger[_0x5c8f('0x20')]('OpenchannelMessage,\x20%s,\x20%s',_0x38a61f,_0x53c6ed);_0x3160a0(_0x53c6ed);});});}function respondWithStatusCode(_0x4fc2fe,_0x30dc3f){_0x30dc3f=_0x30dc3f||0xcc;return function(_0x53936f){if(_0x53936f){return _0x4fc2fe[_0x5c8f('0x26')](_0x30dc3f);}return _0x4fc2fe[_0x5c8f('0x27')](_0x30dc3f)[_0x5c8f('0x28')]();};}function respondWithResult(_0x532c29,_0x386060){_0x386060=_0x386060||0xc8;return function(_0x56ffad){if(_0x56ffad){return _0x532c29[_0x5c8f('0x27')](_0x386060)['json'](_0x56ffad);}};}function respondWithFilteredResult(_0x863d9b,_0x169cdf){return function(_0x37e5aa){if(_0x37e5aa){var _0x3d7fb5=typeof _0x169cdf[_0x5c8f('0x29')]===_0x5c8f('0x2a')&&typeof _0x169cdf['limit']===_0x5c8f('0x2a');var _0x549ad0=_0x37e5aa['count'];var _0x2b7344=_0x3d7fb5?0x0:_0x169cdf['offset'];var _0x35f2e3=_0x3d7fb5?_0x37e5aa['count']:_0x169cdf[_0x5c8f('0x29')]+_0x169cdf['limit'];var _0x4a8f7d;if(_0x35f2e3>=_0x549ad0){_0x35f2e3=_0x549ad0;_0x4a8f7d=0xc8;}else{_0x4a8f7d=0xce;}_0x863d9b['status'](_0x4a8f7d);return _0x863d9b[_0x5c8f('0x2b')]('Content-Range',_0x2b7344+'-'+_0x35f2e3+'/'+_0x549ad0)[_0x5c8f('0x2c')](_0x37e5aa);}return null;};}function patchUpdates(_0x55dbc6){return function(_0x306be6){try{jsonpatch[_0x5c8f('0x2d')](_0x306be6,_0x55dbc6,!![]);}catch(_0x1f94e2){return BPromise['reject'](_0x1f94e2);}return _0x306be6[_0x5c8f('0x2e')]();};}function saveUpdates(_0x4bb31b,_0xa0b424){return function(_0x22ade7){if(_0x22ade7){return _0x22ade7[_0x5c8f('0x2f')](_0x4bb31b)[_0x5c8f('0x1b')](function(_0x221364){return _0x221364;});}return null;};}function removeEntity(_0x546987,_0x95a344){return function(_0xeb1ef0){if(_0xeb1ef0){return _0xeb1ef0['destroy']()[_0x5c8f('0x1b')](function(){_0x546987['status'](0xcc)[_0x5c8f('0x28')]();});}};}function handleEntityNotFound(_0x24e979,_0x86884c){return function(_0x19ab71){if(!_0x19ab71){_0x24e979[_0x5c8f('0x26')](0x194);}return _0x19ab71;};}function handleError(_0x13ceee,_0x9a0f7){_0x9a0f7=_0x9a0f7||0x1f4;return function(_0x239d1a){logger[_0x5c8f('0x20')](_0x239d1a[_0x5c8f('0x30')]);if(_0x239d1a[_0x5c8f('0x31')]){delete _0x239d1a[_0x5c8f('0x31')];}_0x13ceee[_0x5c8f('0x27')](_0x9a0f7)[_0x5c8f('0x32')](_0x239d1a);};}exports[_0x5c8f('0x33')]=function(_0x43220a,_0x46f5f3){var _0x334610={},_0x5065d1={},_0x1fb92d={'count':0x0,'rows':[]};var _0x2cd293=_[_0x5c8f('0x34')](db[_0x5c8f('0x35')]['rawAttributes'],function(_0x4e2dec){return{'name':_0x4e2dec['fieldName'],'type':_0x4e2dec[_0x5c8f('0x36')][_0x5c8f('0x37')]};});_0x5065d1['model']=_['map'](_0x2cd293,_0x5c8f('0x31'));_0x5065d1[_0x5c8f('0x38')]=_[_0x5c8f('0x39')](_0x43220a[_0x5c8f('0x38')]);_0x5065d1[_0x5c8f('0x3a')]=_[_0x5c8f('0x3b')](_0x5065d1['model'],_0x5065d1['query']);_0x334610[_0x5c8f('0x3c')]=_[_0x5c8f('0x3b')](_0x5065d1[_0x5c8f('0x3d')],qs[_0x5c8f('0x3e')](_0x43220a[_0x5c8f('0x38')][_0x5c8f('0x3e')]));_0x334610[_0x5c8f('0x3c')]=_0x334610[_0x5c8f('0x3c')][_0x5c8f('0x3f')]?_0x334610['attributes']:_0x5065d1[_0x5c8f('0x3d')];if(!_0x43220a['query'][_0x5c8f('0x40')](_0x5c8f('0x41'))){_0x334610[_0x5c8f('0x42')]=qs['limit'](_0x43220a[_0x5c8f('0x38')][_0x5c8f('0x42')]);_0x334610[_0x5c8f('0x29')]=qs['offset'](_0x43220a[_0x5c8f('0x38')][_0x5c8f('0x29')]);}_0x334610[_0x5c8f('0x43')]=qs[_0x5c8f('0x44')](_0x43220a[_0x5c8f('0x38')][_0x5c8f('0x44')]);_0x334610[_0x5c8f('0x45')]=qs['filters'](_[_0x5c8f('0x46')](_0x43220a['query'],_0x5065d1[_0x5c8f('0x3a')]),_0x2cd293);if(_0x43220a[_0x5c8f('0x38')][_0x5c8f('0x47')]){_0x334610[_0x5c8f('0x45')]=_['merge'](_0x334610[_0x5c8f('0x45')],{'$or':_['map'](_0x2cd293,function(_0x487d32){if(_0x487d32[_0x5c8f('0x36')]!==_0x5c8f('0x48')){var _0xf6f612={};_0xf6f612[_0x487d32[_0x5c8f('0x31')]]={'$like':'%'+_0x43220a[_0x5c8f('0x38')][_0x5c8f('0x47')]+'%'};return _0xf6f612;}})});}_0x334610=_[_0x5c8f('0x49')]({},_0x334610,_0x43220a[_0x5c8f('0x4a')]);var _0x15fc6c={'where':_0x334610['where']};return db[_0x5c8f('0x35')][_0x5c8f('0x4b')](_0x15fc6c)[_0x5c8f('0x1b')](function(_0x4064c7){_0x1fb92d[_0x5c8f('0x4b')]=_0x4064c7;if(_0x43220a[_0x5c8f('0x38')][_0x5c8f('0x4c')]){_0x334610[_0x5c8f('0x4d')]=[{'all':!![]}];}return db['OpenchannelMessage']['findAll'](_0x334610);})[_0x5c8f('0x1b')](function(_0x1e5eed){_0x1fb92d[_0x5c8f('0x4e')]=_0x1e5eed;return _0x1fb92d;})[_0x5c8f('0x1b')](respondWithFilteredResult(_0x46f5f3,_0x334610))[_0x5c8f('0x25')](handleError(_0x46f5f3,null));};exports['show']=function(_0x3a612f,_0x5b55e0){var _0x74b453={'raw':!![],'where':{'id':_0x3a612f[_0x5c8f('0x4f')]['id']}},_0x5dc3bb={};_0x5dc3bb['model']=_[_0x5c8f('0x39')](db[_0x5c8f('0x35')][_0x5c8f('0x50')]);_0x5dc3bb[_0x5c8f('0x38')]=_[_0x5c8f('0x39')](_0x3a612f['query']);_0x5dc3bb[_0x5c8f('0x3a')]=_[_0x5c8f('0x3b')](_0x5dc3bb[_0x5c8f('0x3d')],_0x5dc3bb[_0x5c8f('0x38')]);_0x74b453[_0x5c8f('0x3c')]=_[_0x5c8f('0x3b')](_0x5dc3bb[_0x5c8f('0x3d')],qs['fields'](_0x3a612f[_0x5c8f('0x38')]['fields']));_0x74b453[_0x5c8f('0x3c')]=_0x74b453[_0x5c8f('0x3c')]['length']?_0x74b453[_0x5c8f('0x3c')]:_0x5dc3bb[_0x5c8f('0x3d')];if(_0x3a612f[_0x5c8f('0x38')][_0x5c8f('0x4c')]){_0x74b453['include']=[{'all':!![]}];}_0x74b453=_[_0x5c8f('0x49')]({},_0x74b453,_0x3a612f['options']);return db['OpenchannelMessage'][_0x5c8f('0x51')](_0x74b453)[_0x5c8f('0x1b')](handleEntityNotFound(_0x5b55e0,null))['then'](respondWithResult(_0x5b55e0,null))['catch'](handleError(_0x5b55e0,null));};exports[_0x5c8f('0x52')]=function(_0x20d020,_0x1fdd3e){return db[_0x5c8f('0x35')][_0x5c8f('0x52')](_0x20d020[_0x5c8f('0x53')],{})[_0x5c8f('0x1b')](respondWithResult(_0x1fdd3e,0xc9))[_0x5c8f('0x25')](handleError(_0x1fdd3e,null));};exports[_0x5c8f('0x2f')]=function(_0x4c14fb,_0x3d9ede){if(_0x4c14fb[_0x5c8f('0x53')]['id']){delete _0x4c14fb[_0x5c8f('0x53')]['id'];}return db[_0x5c8f('0x35')][_0x5c8f('0x51')]({'where':{'id':_0x4c14fb[_0x5c8f('0x4f')]['id']}})[_0x5c8f('0x1b')](handleEntityNotFound(_0x3d9ede,null))[_0x5c8f('0x1b')](saveUpdates(_0x4c14fb[_0x5c8f('0x53')],null))[_0x5c8f('0x1b')](respondWithResult(_0x3d9ede,null))['catch'](handleError(_0x3d9ede,null));};exports[_0x5c8f('0x54')]=function(_0x284569,_0x47bb4c){return db[_0x5c8f('0x35')][_0x5c8f('0x51')]({'where':{'id':_0x284569[_0x5c8f('0x4f')]['id']}})[_0x5c8f('0x1b')](handleEntityNotFound(_0x47bb4c,null))['then'](removeEntity(_0x47bb4c,null))[_0x5c8f('0x25')](handleError(_0x47bb4c,null));};exports['describe']=function(_0x13593c,_0x54d529){return db[_0x5c8f('0x35')][_0x5c8f('0x55')]()[_0x5c8f('0x1b')](respondWithResult(_0x54d529,null))[_0x5c8f('0x25')](handleError(_0x54d529,null));};var interaction_log=require('../../config/logger')(_0x5c8f('0x56'));exports[_0x5c8f('0x57')]=function(_0x4e4251,_0x436732,_0x4ec865){var _0x27a6ba={'agent':{},'channel':'openchannel'};if(_0x4e4251[_0x5c8f('0x53')]['id']){delete _0x4e4251[_0x5c8f('0x53')]['id'];}_0x4e4251[_0x5c8f('0x53')][_0x5c8f('0x58')]=!![];_0x4e4251[_0x5c8f('0x53')][_0x5c8f('0x59')]=moment()[_0x5c8f('0x5a')](_0x5c8f('0x5b'));_0x4e4251[_0x5c8f('0x53')][_0x5c8f('0x5c')]=_0x4e4251[_0x5c8f('0x53')][_0x5c8f('0x5c')]||_0x4e4251['user']['id'];_0x27a6ba[_0x5c8f('0x5d')]['id']=_0x4e4251[_0x5c8f('0x53')][_0x5c8f('0x5c')];return db[_0x5c8f('0x35')][_0x5c8f('0x51')]({'where':{'id':_0x4e4251[_0x5c8f('0x4f')]['id'],'UserId':null}})[_0x5c8f('0x1b')](handleEntityNotFound(_0x436732,null))[_0x5c8f('0x1b')](saveUpdates(_0x4e4251[_0x5c8f('0x53')],null))['then'](function(_0x44114d){if(_0x44114d){_0x27a6ba['message']=_0x44114d[_0x5c8f('0x5e')]({'plain':!![]});return db['OpenchannelInteraction']['find']({'where':{'id':_0x44114d['OpenchannelInteractionId']}});}return null;})[_0x5c8f('0x1b')](handleEntityNotFound(_0x436732,null))[_0x5c8f('0x1b')](function(_0x30a0a9){if(_0x30a0a9){return _0x30a0a9['update']({'UserId':_0x4e4251['body']['UserId'],'read1stAt':_[_0x5c8f('0x5f')](_0x30a0a9[_0x5c8f('0x60')])?moment()['format'](_0x5c8f('0x5b')):undefined});}return null;})[_0x5c8f('0x1b')](function(_0x5b8c21){if(_0x5b8c21){_0x27a6ba[_0x5c8f('0x61')]=_0x5b8c21[_0x5c8f('0x5e')]({'plain':!![]});interaction_log[_0x5c8f('0x1c')](_0x5c8f('0x62'),_0x4e4251['user']['id'],_0x4e4251[_0x5c8f('0x63')][_0x5c8f('0x31')],_0x4e4251[_0x5c8f('0x63')][_0x5c8f('0x64')],_0x27a6ba[_0x5c8f('0x61')]['id'],_0x4e4251[_0x5c8f('0x53')]?JSON['stringify'](_0x4e4251['body']):'null');return respondWithRpcPromise(_0x5c8f('0x65'),'acceptMessage',_0x27a6ba);}return null;})[_0x5c8f('0x1b')](function(_0x5b9721){var _0x1290c0=_0x5c8f('0x66')+_0x5b9721[_0x5c8f('0x23')]['ContactId'];return db[_0x5c8f('0x67')][_0x5c8f('0x38')](_0x1290c0,{'type':db[_0x5c8f('0x68')][_0x5c8f('0x69')][_0x5c8f('0x6a')],'raw':!![]})[_0x5c8f('0x1b')](function(_0x4c8fa1){return _0x4c8fa1;});})['then'](function(_0x5ae494){if(_0x5ae494){_0x27a6ba[_0x5c8f('0x23')]['contact']=_0x5ae494[0x0];if(!_0x4e4251['body'][_0x5c8f('0x5c')])return;return db[_0x5c8f('0x6b')][_0x5c8f('0x51')]({'where':{'id':_0x4e4251['body'][_0x5c8f('0x5c')],'role':_0x5c8f('0x5d')},'attributes':['id','name',_0x5c8f('0x6c'),_0x5c8f('0x6d'),_0x5c8f('0x6e')],'raw':!![]});}return null;})[_0x5c8f('0x1b')](function(_0x5268f8){if(!_0x5268f8)return null;_0x27a6ba[_0x5c8f('0x23')][_0x5c8f('0x5d')]=_0x5268f8;return _0x27a6ba;})[_0x5c8f('0x1b')](function(_0x22e17d){if(_0x22e17d){if(_0x4e4251['body']['manual']){_0x27a6ba[_0x5c8f('0x23')][_0x5c8f('0x6f')]=util[_0x5c8f('0x5a')]('SIP/%s',_0x4e4251['user']['name']);_0x27a6ba[_0x5c8f('0x23')]['channel']=_0x27a6ba['channel'];_0x27a6ba[_0x5c8f('0x23')][_0x5c8f('0x70')]=_0x27a6ba['channel'];_0x27a6ba['message']['event']=_0x5c8f('0x57');return respondWithRpcPromise(_0x5c8f('0x71'),_0x5c8f('0x71'),{'event':'acceptmessage','message':_0x27a6ba['message']},client9002)['then'](function(){return _0x27a6ba;});}return _0x27a6ba;}return null;})[_0x5c8f('0x1b')](respondWithResult(_0x436732,null))[_0x5c8f('0x25')](handleError(_0x436732,null));};var interaction_log=require('../../config/logger')('openchannel-interactions');exports[_0x5c8f('0x72')]=function(_0x427eb3,_0x314473,_0x35b06b){var _0x8aaea7={'agent':{},'channel':_0x5c8f('0x73')};if(_0x427eb3[_0x5c8f('0x53')]['id']){delete _0x427eb3[_0x5c8f('0x53')]['id'];}_0x427eb3[_0x5c8f('0x53')]['UserId']=_0x427eb3['body'][_0x5c8f('0x5c')]||_0x427eb3[_0x5c8f('0x63')]['id'];_0x8aaea7[_0x5c8f('0x5d')]['id']=_0x427eb3[_0x5c8f('0x53')]['UserId'];return db[_0x5c8f('0x35')][_0x5c8f('0x51')]({'where':{'id':_0x427eb3['params']['id'],'UserId':null}})[_0x5c8f('0x1b')](handleEntityNotFound(_0x314473,null))[_0x5c8f('0x1b')](function(_0x4809e5){if(_0x4809e5){_0x8aaea7[_0x5c8f('0x23')]=_0x4809e5[_0x5c8f('0x5e')]({'plain':!![]});return db['OpenchannelInteraction'][_0x5c8f('0x51')]({'where':{'id':_0x4809e5['OpenchannelInteractionId']}});}return null;})[_0x5c8f('0x1b')](handleEntityNotFound(_0x314473,null))[_0x5c8f('0x1b')](function(_0x55f956){if(_0x55f956){_0x8aaea7['interaction']=_0x55f956[_0x5c8f('0x5e')]({'plain':!![]});interaction_log[_0x5c8f('0x1c')](_0x5c8f('0x74'),_0x427eb3[_0x5c8f('0x63')]['id'],_0x427eb3[_0x5c8f('0x63')]['name'],_0x427eb3[_0x5c8f('0x63')][_0x5c8f('0x64')],_0x8aaea7[_0x5c8f('0x61')]['id'],_0x427eb3['body']?JSON[_0x5c8f('0x1f')](_0x427eb3['body']):'null');return respondWithRpcPromise('RejectMessage',_0x5c8f('0x75'),_0x8aaea7);}return null;})[_0x5c8f('0x1b')](function(_0x255b0e){var _0x51a111=_0x5c8f('0x66')+_0x255b0e[_0x5c8f('0x23')][_0x5c8f('0x76')];return db[_0x5c8f('0x67')]['query'](_0x51a111,{'type':db[_0x5c8f('0x68')]['QueryTypes']['SELECT'],'raw':!![]})[_0x5c8f('0x1b')](function(_0x244ea5){return _0x244ea5;});})[_0x5c8f('0x1b')](function(_0x4535ac){if(_0x4535ac){_0x8aaea7['message'][_0x5c8f('0x77')]=_0x4535ac[0x0];if(!_0x427eb3[_0x5c8f('0x53')][_0x5c8f('0x5c')])return;return db[_0x5c8f('0x6b')][_0x5c8f('0x51')]({'where':{'id':_0x427eb3[_0x5c8f('0x53')][_0x5c8f('0x5c')],'role':'agent'},'attributes':['id',_0x5c8f('0x31'),'fullname',_0x5c8f('0x6d'),_0x5c8f('0x6e')],'raw':!![]});}return null;})[_0x5c8f('0x1b')](function(_0x145bb4){if(!_0x145bb4)return null;_0x8aaea7[_0x5c8f('0x23')]['agent']=_0x145bb4;return _0x8aaea7;})['then'](function(_0x22a5e5){if(_0x22a5e5){_0x22a5e5[_0x5c8f('0x23')][_0x5c8f('0x6f')]=util[_0x5c8f('0x5a')](_0x5c8f('0x78'),_0x427eb3[_0x5c8f('0x63')][_0x5c8f('0x31')]);_0x22a5e5[_0x5c8f('0x23')][_0x5c8f('0x79')]=_0x8aaea7[_0x5c8f('0x79')];_0x22a5e5['message'][_0x5c8f('0x70')]=_0x8aaea7[_0x5c8f('0x79')];_0x22a5e5[_0x5c8f('0x23')][_0x5c8f('0x7a')]='reject';respondWithRpcPromise(_0x5c8f('0x71'),_0x5c8f('0x71'),{'event':_0x5c8f('0x7b'),'message':_0x22a5e5[_0x5c8f('0x23')]},client9002);return _0x8aaea7;}return null;})[_0x5c8f('0x1b')](respondWithResult(_0x314473,null))[_0x5c8f('0x25')](handleError(_0x314473,null));}; \ No newline at end of file +var _0x8e08=['fs-extra','lodash','jsforce','desk.js','to-csv','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','defaults','localhost','socket.io-emitter','redis','./openchannelMessage.socket','register','jayson/promise','client','http','request','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','result','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','stack','send','index','map','rawAttributes','type','name','query','keys','model','intersection','fields','attributes','length','hasOwnProperty','order','where','pick','filters','filter','merge','VIRTUAL','OpenchannelMessage','includeAll','include','findAll','rows','catch','show','options','find','create','body','params','describe','openchannel-interactions','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','OpenchannelInteraction','OpenchannelInteractionId','read1stAt','interaction','role','stringify','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','User','agent','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','ContactId','rejectmessage','rimraf','fast-json-patch','request-promise','moment','mustache','util','ejs'];(function(_0x85b65f,_0x198f61){var _0x5e3ec2=function(_0x752a2c){while(--_0x752a2c){_0x85b65f['push'](_0x85b65f['shift']());}};_0x5e3ec2(++_0x198f61);}(_0x8e08,0xf9));var _0x88e0=function(_0x57d0ac,_0x1ddfa6){_0x57d0ac=_0x57d0ac-0x0;var _0x111698=_0x8e08[_0x57d0ac];return _0x111698;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x88e0('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x88e0('0x1'));var rp=require(_0x88e0('0x2'));var moment=require(_0x88e0('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x88e0('0x4'));var util=require(_0x88e0('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x88e0('0x6'));var fs=require('fs');var fs_extra=require(_0x88e0('0x7'));var _=require(_0x88e0('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x88e0('0x9'));var deskjs=require(_0x88e0('0xa'));var toCsv=require(_0x88e0('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x88e0('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x88e0('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x88e0('0xe'))('api');var utils=require(_0x88e0('0xf'));var config=require(_0x88e0('0x10'));var licenseUtil=require(_0x88e0('0x11'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x88e0('0x12')](config['redis'],{'host':_0x88e0('0x13'),'port':0x18eb});var socket=require(_0x88e0('0x14'))(new Redis(config[_0x88e0('0x15')]));require(_0x88e0('0x16'))[_0x88e0('0x17')](socket);var jayson=require(_0x88e0('0x18'));var client=jayson[_0x88e0('0x19')][_0x88e0('0x1a')]({'port':0x232c});var client9002=jayson[_0x88e0('0x19')][_0x88e0('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x739ed2,_0x463d75,_0x4584f4,_0x2fadcc){return new BPromise(function(_0x4d0649,_0x30ad50){var _0x6b5dc6=_0x2fadcc||client;return _0x6b5dc6[_0x88e0('0x1b')](_0x739ed2,_0x4584f4)['then'](function(_0x1366c5){logger['info'](_0x88e0('0x1c'),_0x463d75,_0x88e0('0x1d'));logger[_0x88e0('0x1e')](_0x88e0('0x1f'),_0x463d75,'request\x20sent',JSON['stringify'](_0x1366c5));if(_0x1366c5[_0x88e0('0x20')]){if(_0x1366c5[_0x88e0('0x20')][_0x88e0('0x21')]===0x1f4){logger[_0x88e0('0x20')](_0x88e0('0x1c'),_0x463d75,_0x1366c5[_0x88e0('0x20')][_0x88e0('0x22')]);return _0x30ad50(_0x1366c5[_0x88e0('0x20')]['message']);}logger[_0x88e0('0x20')](_0x88e0('0x1c'),_0x463d75,_0x1366c5[_0x88e0('0x20')]['message']);return _0x4d0649(_0x1366c5[_0x88e0('0x20')][_0x88e0('0x22')]);}else{logger[_0x88e0('0x23')](_0x88e0('0x1c'),_0x463d75,_0x88e0('0x1d'));_0x4d0649(_0x1366c5[_0x88e0('0x24')][_0x88e0('0x22')]);}})['catch'](function(_0x5551c1){logger['error'](_0x88e0('0x1c'),_0x463d75,_0x5551c1);_0x30ad50(_0x5551c1);});});}function respondWithStatusCode(_0x28bd35,_0x29202b){_0x29202b=_0x29202b||0xcc;return function(_0x54608e){if(_0x54608e){return _0x28bd35[_0x88e0('0x25')](_0x29202b);}return _0x28bd35[_0x88e0('0x26')](_0x29202b)[_0x88e0('0x27')]();};}function respondWithResult(_0x302bf1,_0x246ed5){_0x246ed5=_0x246ed5||0xc8;return function(_0x401bb2){if(_0x401bb2){return _0x302bf1[_0x88e0('0x26')](_0x246ed5)['json'](_0x401bb2);}};}function respondWithFilteredResult(_0x2759e5,_0x459300){return function(_0x280c95){if(_0x280c95){var _0xd5a42d=typeof _0x459300[_0x88e0('0x28')]===_0x88e0('0x29')&&typeof _0x459300['limit']===_0x88e0('0x29');var _0x185b27=_0x280c95['count'];var _0x8b8e88=_0xd5a42d?0x0:_0x459300[_0x88e0('0x28')];var _0x12ecab=_0xd5a42d?_0x280c95[_0x88e0('0x2a')]:_0x459300['offset']+_0x459300[_0x88e0('0x2b')];var _0x2f08ec;if(_0x12ecab>=_0x185b27){_0x12ecab=_0x185b27;_0x2f08ec=0xc8;}else{_0x2f08ec=0xce;}_0x2759e5['status'](_0x2f08ec);return _0x2759e5[_0x88e0('0x2c')](_0x88e0('0x2d'),_0x8b8e88+'-'+_0x12ecab+'/'+_0x185b27)[_0x88e0('0x2e')](_0x280c95);}return null;};}function patchUpdates(_0x4f07af){return function(_0x21ff2a){try{jsonpatch[_0x88e0('0x2f')](_0x21ff2a,_0x4f07af,!![]);}catch(_0x3c3fb6){return BPromise[_0x88e0('0x30')](_0x3c3fb6);}return _0x21ff2a[_0x88e0('0x31')]();};}function saveUpdates(_0x37a783,_0x42caaf){return function(_0x3e9297){if(_0x3e9297){return _0x3e9297[_0x88e0('0x32')](_0x37a783)[_0x88e0('0x33')](function(_0x4cf4a0){return _0x4cf4a0;});}return null;};}function removeEntity(_0x4b404b,_0x5924c3){return function(_0x5ee952){if(_0x5ee952){return _0x5ee952['destroy']()[_0x88e0('0x33')](function(){_0x4b404b[_0x88e0('0x26')](0xcc)[_0x88e0('0x27')]();});}};}function handleEntityNotFound(_0x65c0f,_0x3f580d){return function(_0x4abb71){if(!_0x4abb71){_0x65c0f['sendStatus'](0x194);}return _0x4abb71;};}function handleError(_0x544b9e,_0x270d63){_0x270d63=_0x270d63||0x1f4;return function(_0x2d431b){logger[_0x88e0('0x20')](_0x2d431b[_0x88e0('0x34')]);if(_0x2d431b['name']){delete _0x2d431b['name'];}_0x544b9e[_0x88e0('0x26')](_0x270d63)[_0x88e0('0x35')](_0x2d431b);};}exports[_0x88e0('0x36')]=function(_0x1de83a,_0x10165e){var _0x519550={},_0x1fa2eb={},_0x5ec17f={'count':0x0,'rows':[]};var _0x306423=_[_0x88e0('0x37')](db['OpenchannelMessage'][_0x88e0('0x38')],function(_0x191bc9){return{'name':_0x191bc9['fieldName'],'type':_0x191bc9[_0x88e0('0x39')]['key']};});_0x1fa2eb['model']=_['map'](_0x306423,_0x88e0('0x3a'));_0x1fa2eb[_0x88e0('0x3b')]=_[_0x88e0('0x3c')](_0x1de83a[_0x88e0('0x3b')]);_0x1fa2eb['filters']=_['intersection'](_0x1fa2eb[_0x88e0('0x3d')],_0x1fa2eb[_0x88e0('0x3b')]);_0x519550['attributes']=_[_0x88e0('0x3e')](_0x1fa2eb['model'],qs[_0x88e0('0x3f')](_0x1de83a[_0x88e0('0x3b')]['fields']));_0x519550['attributes']=_0x519550[_0x88e0('0x40')][_0x88e0('0x41')]?_0x519550[_0x88e0('0x40')]:_0x1fa2eb['model'];if(!_0x1de83a['query'][_0x88e0('0x42')]('nolimit')){_0x519550[_0x88e0('0x2b')]=qs['limit'](_0x1de83a[_0x88e0('0x3b')][_0x88e0('0x2b')]);_0x519550[_0x88e0('0x28')]=qs[_0x88e0('0x28')](_0x1de83a[_0x88e0('0x3b')]['offset']);}_0x519550[_0x88e0('0x43')]=qs['sort'](_0x1de83a['query']['sort']);_0x519550[_0x88e0('0x44')]=qs['filters'](_[_0x88e0('0x45')](_0x1de83a[_0x88e0('0x3b')],_0x1fa2eb[_0x88e0('0x46')]),_0x306423);if(_0x1de83a[_0x88e0('0x3b')][_0x88e0('0x47')]){_0x519550[_0x88e0('0x44')]=_[_0x88e0('0x48')](_0x519550['where'],{'$or':_['map'](_0x306423,function(_0x3df3dc){if(_0x3df3dc[_0x88e0('0x39')]!==_0x88e0('0x49')){var _0x1b9f87={};_0x1b9f87[_0x3df3dc['name']]={'$like':'%'+_0x1de83a[_0x88e0('0x3b')]['filter']+'%'};return _0x1b9f87;}})});}_0x519550=_['merge']({},_0x519550,_0x1de83a['options']);var _0x3ad413={'where':_0x519550[_0x88e0('0x44')]};return db[_0x88e0('0x4a')][_0x88e0('0x2a')](_0x3ad413)[_0x88e0('0x33')](function(_0x56749c){_0x5ec17f['count']=_0x56749c;if(_0x1de83a[_0x88e0('0x3b')][_0x88e0('0x4b')]){_0x519550[_0x88e0('0x4c')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x88e0('0x4d')](_0x519550);})[_0x88e0('0x33')](function(_0x1633f9){_0x5ec17f[_0x88e0('0x4e')]=_0x1633f9;return _0x5ec17f;})['then'](respondWithFilteredResult(_0x10165e,_0x519550))[_0x88e0('0x4f')](handleError(_0x10165e,null));};exports[_0x88e0('0x50')]=function(_0x330c28,_0x5576f9){var _0x1c27b2={'raw':!![],'where':{'id':_0x330c28['params']['id']}},_0x3bae98={};_0x3bae98['model']=_[_0x88e0('0x3c')](db[_0x88e0('0x4a')][_0x88e0('0x38')]);_0x3bae98['query']=_['keys'](_0x330c28[_0x88e0('0x3b')]);_0x3bae98[_0x88e0('0x46')]=_['intersection'](_0x3bae98['model'],_0x3bae98[_0x88e0('0x3b')]);_0x1c27b2[_0x88e0('0x40')]=_[_0x88e0('0x3e')](_0x3bae98['model'],qs[_0x88e0('0x3f')](_0x330c28[_0x88e0('0x3b')][_0x88e0('0x3f')]));_0x1c27b2[_0x88e0('0x40')]=_0x1c27b2[_0x88e0('0x40')][_0x88e0('0x41')]?_0x1c27b2['attributes']:_0x3bae98['model'];if(_0x330c28[_0x88e0('0x3b')][_0x88e0('0x4b')]){_0x1c27b2[_0x88e0('0x4c')]=[{'all':!![]}];}_0x1c27b2=_['merge']({},_0x1c27b2,_0x330c28[_0x88e0('0x51')]);return db['OpenchannelMessage'][_0x88e0('0x52')](_0x1c27b2)[_0x88e0('0x33')](handleEntityNotFound(_0x5576f9,null))['then'](respondWithResult(_0x5576f9,null))['catch'](handleError(_0x5576f9,null));};exports[_0x88e0('0x53')]=function(_0x1f8d9d,_0x429bab){return db[_0x88e0('0x4a')]['create'](_0x1f8d9d[_0x88e0('0x54')],{})['then'](respondWithResult(_0x429bab,0xc9))[_0x88e0('0x4f')](handleError(_0x429bab,null));};exports[_0x88e0('0x32')]=function(_0xcc235a,_0x3537fa){if(_0xcc235a[_0x88e0('0x54')]['id']){delete _0xcc235a[_0x88e0('0x54')]['id'];}return db[_0x88e0('0x4a')][_0x88e0('0x52')]({'where':{'id':_0xcc235a['params']['id']}})[_0x88e0('0x33')](handleEntityNotFound(_0x3537fa,null))['then'](saveUpdates(_0xcc235a[_0x88e0('0x54')],null))[_0x88e0('0x33')](respondWithResult(_0x3537fa,null))[_0x88e0('0x4f')](handleError(_0x3537fa,null));};exports['destroy']=function(_0x344856,_0x189c89){return db['OpenchannelMessage'][_0x88e0('0x52')]({'where':{'id':_0x344856[_0x88e0('0x55')]['id']}})['then'](handleEntityNotFound(_0x189c89,null))[_0x88e0('0x33')](removeEntity(_0x189c89,null))[_0x88e0('0x4f')](handleError(_0x189c89,null));};exports[_0x88e0('0x56')]=function(_0x4b94a3,_0x3b3273){return db[_0x88e0('0x4a')][_0x88e0('0x56')]()['then'](respondWithResult(_0x3b3273,null))['catch'](handleError(_0x3b3273,null));};var interaction_log=require(_0x88e0('0xe'))(_0x88e0('0x57'));exports[_0x88e0('0x58')]=function(_0x3cb88b,_0x463383,_0x310b3e){var _0x5ae76f={'agent':{},'channel':_0x88e0('0x59')};if(_0x3cb88b[_0x88e0('0x54')]['id']){delete _0x3cb88b['body']['id'];}_0x3cb88b[_0x88e0('0x54')][_0x88e0('0x5a')]=!![];_0x3cb88b[_0x88e0('0x54')][_0x88e0('0x5b')]=moment()[_0x88e0('0x5c')](_0x88e0('0x5d'));_0x3cb88b[_0x88e0('0x54')][_0x88e0('0x5e')]=_0x3cb88b[_0x88e0('0x54')][_0x88e0('0x5e')]||_0x3cb88b[_0x88e0('0x5f')]['id'];_0x5ae76f['agent']['id']=_0x3cb88b[_0x88e0('0x54')][_0x88e0('0x5e')];return db['OpenchannelMessage'][_0x88e0('0x52')]({'where':{'id':_0x3cb88b['params']['id'],'UserId':null}})[_0x88e0('0x33')](handleEntityNotFound(_0x463383,null))[_0x88e0('0x33')](saveUpdates(_0x3cb88b[_0x88e0('0x54')],null))[_0x88e0('0x33')](function(_0x273fba){if(_0x273fba){_0x5ae76f[_0x88e0('0x22')]=_0x273fba[_0x88e0('0x60')]({'plain':!![]});return db[_0x88e0('0x61')]['find']({'where':{'id':_0x273fba[_0x88e0('0x62')]}});}return null;})[_0x88e0('0x33')](handleEntityNotFound(_0x463383,null))[_0x88e0('0x33')](function(_0x53c57e){if(_0x53c57e){return _0x53c57e[_0x88e0('0x32')]({'UserId':_0x3cb88b[_0x88e0('0x54')][_0x88e0('0x5e')],'read1stAt':_['isNil'](_0x53c57e[_0x88e0('0x63')])?moment()[_0x88e0('0x5c')](_0x88e0('0x5d')):undefined});}return null;})['then'](function(_0xc0165b){if(_0xc0165b){_0x5ae76f[_0x88e0('0x64')]=_0xc0165b[_0x88e0('0x60')]({'plain':!![]});interaction_log[_0x88e0('0x23')]('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3cb88b[_0x88e0('0x5f')]['id'],_0x3cb88b['user'][_0x88e0('0x3a')],_0x3cb88b['user'][_0x88e0('0x65')],_0x5ae76f[_0x88e0('0x64')]['id'],_0x3cb88b[_0x88e0('0x54')]?JSON[_0x88e0('0x66')](_0x3cb88b[_0x88e0('0x54')]):'null');return respondWithRpcPromise(_0x88e0('0x67'),_0x88e0('0x68'),_0x5ae76f);}return null;})[_0x88e0('0x33')](function(_0x370b57){var _0x164bc1=_0x88e0('0x69')+_0x370b57[_0x88e0('0x22')]['ContactId'];return db[_0x88e0('0x6a')][_0x88e0('0x3b')](_0x164bc1,{'type':db[_0x88e0('0x6b')][_0x88e0('0x6c')][_0x88e0('0x6d')],'raw':!![]})[_0x88e0('0x33')](function(_0x41b02a){return _0x41b02a;});})[_0x88e0('0x33')](function(_0x23e88d){if(_0x23e88d){_0x5ae76f[_0x88e0('0x22')]['contact']=_0x23e88d[0x0];if(!_0x3cb88b[_0x88e0('0x54')][_0x88e0('0x5e')])return;return db[_0x88e0('0x6e')][_0x88e0('0x52')]({'where':{'id':_0x3cb88b[_0x88e0('0x54')][_0x88e0('0x5e')],'role':_0x88e0('0x6f')},'attributes':['id','name',_0x88e0('0x70'),_0x88e0('0x71'),_0x88e0('0x72')],'raw':!![]});}return null;})['then'](function(_0x455642){if(!_0x455642)return null;_0x5ae76f['message'][_0x88e0('0x6f')]=_0x455642;return _0x5ae76f;})['then'](function(_0x16a234){if(_0x16a234){if(_0x3cb88b['body'][_0x88e0('0x73')]){_0x5ae76f[_0x88e0('0x22')][_0x88e0('0x74')]=util[_0x88e0('0x5c')](_0x88e0('0x75'),_0x3cb88b[_0x88e0('0x5f')][_0x88e0('0x3a')]);_0x5ae76f['message']['channel']=_0x5ae76f[_0x88e0('0x76')];_0x5ae76f['message'][_0x88e0('0x77')]=_0x5ae76f[_0x88e0('0x76')];_0x5ae76f[_0x88e0('0x22')][_0x88e0('0x78')]='accept';return respondWithRpcPromise(_0x88e0('0x79'),_0x88e0('0x79'),{'event':'acceptmessage','message':_0x5ae76f[_0x88e0('0x22')]},client9002)[_0x88e0('0x33')](function(){return _0x5ae76f;});}return _0x5ae76f;}return null;})[_0x88e0('0x33')](respondWithResult(_0x463383,null))[_0x88e0('0x4f')](handleError(_0x463383,null));};var interaction_log=require(_0x88e0('0xe'))(_0x88e0('0x57'));exports[_0x88e0('0x30')]=function(_0x5062aa,_0x52db74,_0x5434f3){var _0x8424f0={'agent':{},'channel':_0x88e0('0x59')};if(_0x5062aa['body']['id']){delete _0x5062aa[_0x88e0('0x54')]['id'];}_0x5062aa['body'][_0x88e0('0x5e')]=_0x5062aa[_0x88e0('0x54')][_0x88e0('0x5e')]||_0x5062aa[_0x88e0('0x5f')]['id'];_0x8424f0[_0x88e0('0x6f')]['id']=_0x5062aa[_0x88e0('0x54')][_0x88e0('0x5e')];return db[_0x88e0('0x4a')]['find']({'where':{'id':_0x5062aa[_0x88e0('0x55')]['id'],'UserId':null}})[_0x88e0('0x33')](handleEntityNotFound(_0x52db74,null))[_0x88e0('0x33')](function(_0x55d878){if(_0x55d878){_0x8424f0[_0x88e0('0x22')]=_0x55d878['get']({'plain':!![]});return db['OpenchannelInteraction'][_0x88e0('0x52')]({'where':{'id':_0x55d878[_0x88e0('0x62')]}});}return null;})['then'](handleEntityNotFound(_0x52db74,null))[_0x88e0('0x33')](function(_0x2a703c){if(_0x2a703c){_0x8424f0[_0x88e0('0x64')]=_0x2a703c[_0x88e0('0x60')]({'plain':!![]});interaction_log['info'](_0x88e0('0x7a'),_0x5062aa[_0x88e0('0x5f')]['id'],_0x5062aa['user'][_0x88e0('0x3a')],_0x5062aa['user'][_0x88e0('0x65')],_0x8424f0[_0x88e0('0x64')]['id'],_0x5062aa[_0x88e0('0x54')]?JSON['stringify'](_0x5062aa[_0x88e0('0x54')]):_0x88e0('0x7b'));return respondWithRpcPromise(_0x88e0('0x7c'),_0x88e0('0x7d'),_0x8424f0);}return null;})[_0x88e0('0x33')](function(_0x194bf2){var _0xd3d67a=_0x88e0('0x69')+_0x194bf2[_0x88e0('0x22')][_0x88e0('0x7e')];return db[_0x88e0('0x6a')][_0x88e0('0x3b')](_0xd3d67a,{'type':db[_0x88e0('0x6b')][_0x88e0('0x6c')]['SELECT'],'raw':!![]})[_0x88e0('0x33')](function(_0x25cd54){return _0x25cd54;});})[_0x88e0('0x33')](function(_0x3d77a8){if(_0x3d77a8){_0x8424f0[_0x88e0('0x22')]['contact']=_0x3d77a8[0x0];if(!_0x5062aa[_0x88e0('0x54')][_0x88e0('0x5e')])return;return db['User'][_0x88e0('0x52')]({'where':{'id':_0x5062aa[_0x88e0('0x54')][_0x88e0('0x5e')],'role':_0x88e0('0x6f')},'attributes':['id','name',_0x88e0('0x70'),_0x88e0('0x71'),'internal'],'raw':!![]});}return null;})[_0x88e0('0x33')](function(_0x3f8a86){if(!_0x3f8a86)return null;_0x8424f0[_0x88e0('0x22')][_0x88e0('0x6f')]=_0x3f8a86;return _0x8424f0;})[_0x88e0('0x33')](function(_0x1b5c2f){if(_0x1b5c2f){_0x1b5c2f[_0x88e0('0x22')]['interface']=util[_0x88e0('0x5c')](_0x88e0('0x75'),_0x5062aa['user'][_0x88e0('0x3a')]);_0x1b5c2f[_0x88e0('0x22')][_0x88e0('0x76')]=_0x8424f0['channel'];_0x1b5c2f[_0x88e0('0x22')][_0x88e0('0x77')]=_0x8424f0[_0x88e0('0x76')];_0x1b5c2f['message'][_0x88e0('0x78')]=_0x88e0('0x30');respondWithRpcPromise(_0x88e0('0x79'),_0x88e0('0x79'),{'event':_0x88e0('0x7f'),'message':_0x1b5c2f[_0x88e0('0x22')]},client9002);return _0x8424f0;}return null;})[_0x88e0('0x33')](respondWithResult(_0x52db74,null))[_0x88e0('0x4f')](handleError(_0x52db74,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 14d3827..cc96fc2 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 _0x2d2f=['exports','events','OpenchannelMessage','update','remove','emit','hasOwnProperty'];(function(_0x3727ba,_0xc33010){var _0x222e38=function(_0x55bec4){while(--_0x55bec4){_0x3727ba['push'](_0x3727ba['shift']());}};_0x222e38(++_0xc33010);}(_0x2d2f,0xc5));var _0xf2d2=function(_0x59123b,_0x1b6a12){_0x59123b=_0x59123b-0x0;var _0x3dd249=_0x2d2f[_0x59123b];return _0x3dd249;};'use strict';var EventEmitter=require(_0xf2d2('0x0'));var OpenchannelMessage=require('../../mysqldb')['db'][_0xf2d2('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xf2d2('0x2'),'afterDestroy':_0xf2d2('0x3')};function emitEvent(_0x4d71ab){return function(_0x450a81,_0x2a682d,_0xb46388){OpenchannelMessageEvents['emit'](_0x4d71ab+':'+_0x450a81['id'],_0x450a81);OpenchannelMessageEvents[_0xf2d2('0x4')](_0x4d71ab,_0x450a81);_0xb46388(null);};}for(var e in events){if(events[_0xf2d2('0x5')](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0xf2d2('0x6')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x929c=['../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','remove','emit','exports','events'];(function(_0xfd6a6f,_0x15b226){var _0x54de53=function(_0x26f172){while(--_0x26f172){_0xfd6a6f['push'](_0xfd6a6f['shift']());}};_0x54de53(++_0x15b226);}(_0x929c,0x6b));var _0xc929=function(_0x491bf7,_0x141deb){_0x491bf7=_0x491bf7-0x0;var _0x3fbb8c=_0x929c[_0x491bf7];return _0x3fbb8c;};'use strict';var EventEmitter=require(_0xc929('0x0'));var OpenchannelMessage=require(_0xc929('0x1'))['db'][_0xc929('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xc929('0x3')](0x0);var events={'afterCreate':_0xc929('0x4'),'afterUpdate':_0xc929('0x5'),'afterDestroy':_0xc929('0x6')};function emitEvent(_0x40dde5){return function(_0x9b3479,_0x415e25,_0x355686){OpenchannelMessageEvents[_0xc929('0x7')](_0x40dde5+':'+_0x9b3479['id'],_0x9b3479);OpenchannelMessageEvents[_0xc929('0x7')](_0x40dde5,_0x9b3479);_0x355686(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0xc929('0x8')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index a1ddd4f..1846643 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 _0x49ef=['direction','toLowerCase','out','findOne','OpenchannelInteractionId','then','update','createdAt','error','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','OpenchannelInteraction','Interactions','Contact','keys','info','OpenchannelMessage,\x20%s,\x20%s','format','Forwarding\x20message\x20%d\x20to\x20%s','replyUri','length','Interaction','omit','POST','method','GET','threadId','catch','afterCreate','inspect','utf8mb4','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','fti_openchannel_messages','body','FULLTEXT','models','get'];(function(_0x342dc7,_0x2db9cf){var _0x503a49=function(_0x5171f8){while(--_0x5171f8){_0x342dc7['push'](_0x342dc7['shift']());}};_0x503a49(++_0x2db9cf);}(_0x49ef,0x84));var _0xf49e=function(_0x540dd6,_0x57a8ad){_0x540dd6=_0x540dd6-0x0;var _0x41914c=_0x49ef[_0x540dd6];return _0x41914c;};'use strict';var _=require('lodash');var util=require(_0xf49e('0x0'));var logger=require(_0xf49e('0x1'))(_0xf49e('0x2'));var moment=require('moment');var BPromise=require(_0xf49e('0x3'));var rp=require(_0xf49e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf49e('0x5'));var config=require(_0xf49e('0x6'));var attributes=require(_0xf49e('0x7'));module[_0xf49e('0x8')]=function(_0x448298,_0x902524){return _0x448298[_0xf49e('0x9')]('OpenchannelMessage',attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0xf49e('0xa'),'fields':[_0xf49e('0xb')],'type':_0xf49e('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x182c76,_0x2a990d,_0x2ba543){var _0x495bcc=_0x448298[_0xf49e('0xd')];var _0x2feb48=_0x182c76[_0xf49e('0xe')]({'plain':!![]});if(_0x2feb48[_0xf49e('0xf')][_0xf49e('0x10')]()==='in'||_0x2feb48[_0xf49e('0xf')][_0xf49e('0x10')]()===_0xf49e('0x11')&&!_0x2feb48['secret']&&!_['isNil'](_0x2feb48['UserId'])){_0x495bcc['OpenchannelInteraction'][_0xf49e('0x12')]({'where':{'id':_0x2feb48[_0xf49e('0x13')]}})[_0xf49e('0x14')](function(_0x50f5eb){if(_0x50f5eb){_0x50f5eb[_0xf49e('0x15')]({'lastMsgAt':_0x2feb48[_0xf49e('0x16')],'lastMsgDirection':_0x2feb48['direction'][_0xf49e('0x10')]()});}})['catch'](function(_0x5c2da7){console[_0xf49e('0x17')](_0x5c2da7);});}if(_0x2feb48[_0xf49e('0xf')]===_0xf49e('0x11')&&!_0x2feb48['secret']){var _0x1ca291;_0x495bcc[_0xf49e('0x18')][_0xf49e('0x19')]()['then'](function(_0x30a817){return _0x495bcc[_0xf49e('0x1a')][_0xf49e('0x1b')]({'where':{'id':_0x2feb48[_0xf49e('0x1c')]},'include':[{'model':_0x495bcc[_0xf49e('0x1d')],'as':_0xf49e('0x1e'),'where':{'id':_0x2feb48[_0xf49e('0x13')]},'limit':0x1,'include':[{'model':_0x495bcc[_0xf49e('0x18')],'as':_0xf49e('0x1f'),'attributes':_[_0xf49e('0x20')](_0x30a817)}]}]});})[_0xf49e('0x14')](function(_0x5743bd){_0x1ca291=_0x5743bd[_0xf49e('0xe')]({'plain':!![]});if(_0x1ca291&&_0x1ca291['replyUri']){logger[_0xf49e('0x21')](_0xf49e('0x22'),'afterCreate',util[_0xf49e('0x23')](_0xf49e('0x24'),_0x2feb48['id'],_0x1ca291[_0xf49e('0x25')]));if(_0x1ca291[_0xf49e('0x1e')]&&_0x1ca291[_0xf49e('0x1e')][_0xf49e('0x26')]){_0x2feb48[_0xf49e('0x27')]=_[_0xf49e('0x28')](_0x1ca291[_0xf49e('0x1e')][0x0],_0xf49e('0x1f'));_0x2feb48['Contact']=_0x1ca291[_0xf49e('0x1e')][0x0][_0xf49e('0x1f')];}var _0x2a990d={'method':_0xf49e('0x29'),'uri':encodeURI(_0x1ca291[_0xf49e('0x25')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x2a990d[_0xf49e('0x2a')]){case _0xf49e('0x2b'):_0x2a990d['qs']=_0x2feb48;break;case'POST':_0x2a990d['body']=_0x2feb48;break;}return rp(_0x2a990d)['then'](function(_0x1dcc5c){logger[_0xf49e('0x21')](_0xf49e('0x22'),'afterCreate',util['format']('Message\x20%d\x20forwarded\x20to\x20%s',_0x2feb48['id'],_0x1ca291[_0xf49e('0x25')]));if(_0x1dcc5c[_0xf49e('0xb')][_0xf49e('0x2c')]&&_0x1dcc5c['body']['threadId']!=_0x2feb48[_0xf49e('0x27')][_0xf49e('0x2c')]){return _0x495bcc[_0xf49e('0x1d')]['update']({'threadId':_0x1dcc5c[_0xf49e('0xb')][_0xf49e('0x2c')]},{'where':{'id':_0x2feb48[_0xf49e('0x27')]['id']}});}else{return;}})[_0xf49e('0x14')](function(){return _0x182c76[_0xf49e('0x15')]({'read':!![]});})[_0xf49e('0x2d')](function(_0x21bf7c){logger[_0xf49e('0x17')](_0xf49e('0x22'),_0xf49e('0x2e'),util[_0xf49e('0x2f')](_0x21bf7c,{'showHidden':![],'depth':null}));_0x2ba543();});}else{_0x2ba543();}})['finally'](function(){_0x2ba543();});}else{_0x2ba543();}}},'charset':_0xf49e('0x30'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xdb6e=['catch','error','describe','then','OpenchannelAccount','find','OpenchannelAccountId','CmContact','keys','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','Interactions','length','omit','Contact','POST','replyUri','GET','Message\x20%d\x20forwarded\x20to\x20%s','body','threadId','Interaction','utf8mb4','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','OpenchannelMessage','fti_openchannel_messages','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','OpenchannelInteraction','findOne','OpenchannelInteractionId','update','createdAt'];(function(_0x3a030a,_0x19bbda){var _0xf887dc=function(_0x211f20){while(--_0x211f20){_0x3a030a['push'](_0x3a030a['shift']());}};_0xf887dc(++_0x19bbda);}(_0xdb6e,0x145));var _0xedb6=function(_0x5941b7,_0x499160){_0x5941b7=_0x5941b7-0x0;var _0x2ae4df=_0xdb6e[_0x5941b7];return _0x2ae4df;};'use strict';var _=require(_0xedb6('0x0'));var util=require(_0xedb6('0x1'));var logger=require('../../config/logger')(_0xedb6('0x2'));var moment=require(_0xedb6('0x3'));var BPromise=require(_0xedb6('0x4'));var rp=require(_0xedb6('0x5'));var fs=require('fs');var path=require(_0xedb6('0x6'));var rimraf=require(_0xedb6('0x7'));var config=require(_0xedb6('0x8'));var attributes=require(_0xedb6('0x9'));module[_0xedb6('0xa')]=function(_0x43032e,_0x244ecf){return _0x43032e['define'](_0xedb6('0xb'),attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0xedb6('0xc'),'fields':['body'],'type':_0xedb6('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x27e2d0,_0x3d1c6b,_0x2d7a7a){var _0x285cbf=_0x43032e[_0xedb6('0xe')];var _0x18b24e=_0x27e2d0['get']({'plain':!![]});if(_0x18b24e[_0xedb6('0xf')][_0xedb6('0x10')]()==='in'||_0x18b24e[_0xedb6('0xf')][_0xedb6('0x10')]()===_0xedb6('0x11')&&!_0x18b24e[_0xedb6('0x12')]&&!_[_0xedb6('0x13')](_0x18b24e['UserId'])){_0x285cbf[_0xedb6('0x14')][_0xedb6('0x15')]({'where':{'id':_0x18b24e[_0xedb6('0x16')]}})['then'](function(_0x5dc3b6){if(_0x5dc3b6){_0x5dc3b6[_0xedb6('0x17')]({'lastMsgAt':_0x18b24e[_0xedb6('0x18')],'lastMsgDirection':_0x18b24e[_0xedb6('0xf')][_0xedb6('0x10')]()});}})[_0xedb6('0x19')](function(_0x26cb18){console[_0xedb6('0x1a')](_0x26cb18);});}if(_0x18b24e[_0xedb6('0xf')]===_0xedb6('0x11')&&!_0x18b24e['secret']){var _0x4d364a;_0x285cbf['CmContact'][_0xedb6('0x1b')]()[_0xedb6('0x1c')](function(_0x169fde){return _0x285cbf[_0xedb6('0x1d')][_0xedb6('0x1e')]({'where':{'id':_0x18b24e[_0xedb6('0x1f')]},'include':[{'model':_0x285cbf[_0xedb6('0x14')],'as':'Interactions','where':{'id':_0x18b24e['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x285cbf[_0xedb6('0x20')],'as':'Contact','attributes':_[_0xedb6('0x21')](_0x169fde)}]}]});})[_0xedb6('0x1c')](function(_0x4320c8){_0x4d364a=_0x4320c8['get']({'plain':!![]});if(_0x4d364a&&_0x4d364a['replyUri']){logger['info'](_0xedb6('0x22'),_0xedb6('0x23'),util[_0xedb6('0x24')](_0xedb6('0x25'),_0x18b24e['id'],_0x4d364a['replyUri']));if(_0x4d364a[_0xedb6('0x26')]&&_0x4d364a[_0xedb6('0x26')][_0xedb6('0x27')]){_0x18b24e['Interaction']=_[_0xedb6('0x28')](_0x4d364a[_0xedb6('0x26')][0x0],_0xedb6('0x29'));_0x18b24e['Contact']=_0x4d364a[_0xedb6('0x26')][0x0]['Contact'];}var _0x3d1c6b={'method':_0xedb6('0x2a'),'uri':encodeURI(_0x4d364a[_0xedb6('0x2b')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x3d1c6b['method']){case _0xedb6('0x2c'):_0x3d1c6b['qs']=_0x18b24e;break;case _0xedb6('0x2a'):_0x3d1c6b['body']=_0x18b24e;break;}return rp(_0x3d1c6b)[_0xedb6('0x1c')](function(_0x5c0606){logger['info'](_0xedb6('0x22'),'afterCreate',util[_0xedb6('0x24')](_0xedb6('0x2d'),_0x18b24e['id'],_0x4d364a['replyUri']));if(_0x5c0606[_0xedb6('0x2e')]['threadId']&&_0x5c0606[_0xedb6('0x2e')][_0xedb6('0x2f')]!=_0x18b24e[_0xedb6('0x30')]['threadId']){return _0x285cbf[_0xedb6('0x14')][_0xedb6('0x17')]({'threadId':_0x5c0606[_0xedb6('0x2e')][_0xedb6('0x2f')]},{'where':{'id':_0x18b24e[_0xedb6('0x30')]['id']}});}else{return;}})[_0xedb6('0x1c')](function(){return _0x27e2d0[_0xedb6('0x17')]({'read':!![]});})[_0xedb6('0x19')](function(_0x44bfbe){logger[_0xedb6('0x1a')](_0xedb6('0x22'),_0xedb6('0x23'),util['inspect'](_0x44bfbe,{'showHidden':![],'depth':null}));_0x2d7a7a();});}else{_0x2d7a7a();}})['finally'](function(){_0x2d7a7a();});}else{_0x2d7a7a();}}},'charset':_0xedb6('0x31'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 16b0404..1456f88 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 _0x5f2f=['OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','OpenchannelMessage','create','options','raw','CreateOpenchannelMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x48b6b9,_0x4ba81b){var _0x15cb34=function(_0x49c2eb){while(--_0x49c2eb){_0x48b6b9['push'](_0x48b6b9['shift']());}};_0x15cb34(++_0x4ba81b);}(_0x5f2f,0x73));var _0xf5f2=function(_0x418e60,_0x1f1e91){_0x418e60=_0x418e60-0x0;var _0x4e792a=_0x5f2f[_0x418e60];return _0x4e792a;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});config[_0xf5f2('0xc')]=_[_0xf5f2('0xd')](config['redis'],{'host':_0xf5f2('0xe'),'port':0x18eb});var socket=require(_0xf5f2('0xf'))(new Redis(config[_0xf5f2('0xc')]));require('./openchannelMessage.socket')[_0xf5f2('0x10')](socket);function respondWithRpcPromise(_0x15dd7c,_0x218ae3,_0x4e0e6b){return new BPromise(function(_0x977a59,_0x4ebbbe){return client['request'](_0x15dd7c,_0x4e0e6b)[_0xf5f2('0x11')](function(_0x151aba){logger['info'](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));logger[_0xf5f2('0x14')](_0xf5f2('0x15'),_0x218ae3,_0xf5f2('0x13'),JSON[_0xf5f2('0x16')](_0x151aba));if(_0x151aba['error']){if(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x18')]===0x1f4){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')]['message']);return _0x4ebbbe(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);return _0x977a59(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}else{logger[_0xf5f2('0x1a')](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));_0x977a59(_0x151aba[_0xf5f2('0x1b')][_0xf5f2('0x19')]);}})[_0xf5f2('0x1c')](function(_0x3cf5ea){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x3cf5ea);_0x4ebbbe(_0x3cf5ea);});});}exports['CreateOpenchannelMessage']=function(_0x34706d){var _0x47101e=this;return new Promise(function(_0x49dac2,_0x47acfc){return db[_0xf5f2('0x1d')][_0xf5f2('0x1e')](_0x34706d['body'],{'raw':_0x34706d[_0xf5f2('0x1f')]?_0x34706d[_0xf5f2('0x1f')][_0xf5f2('0x20')]===undefined?!![]:![]:!![]})[_0xf5f2('0x11')](function(_0x36f1cb){logger['info'](_0xf5f2('0x21'),_0x34706d);logger[_0xf5f2('0x14')](_0xf5f2('0x21'),_0x34706d,JSON[_0xf5f2('0x16')](_0x36f1cb));_0x49dac2(_0x36f1cb);})[_0xf5f2('0x1c')](function(_0x5bdf4a){logger['error'](_0xf5f2('0x21'),_0x5bdf4a[_0xf5f2('0x19')],_0x34706d);_0x47acfc(_0x47101e[_0xf5f2('0x17')](0x1f4,_0x5bdf4a[_0xf5f2('0x19')]));});});}; \ No newline at end of file +var _0x2ef3=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','result','catch','CreateOpenchannelMessage','create','options','info'];(function(_0x249b63,_0x1d7515){var _0x3b8209=function(_0x3bd510){while(--_0x3bd510){_0x249b63['push'](_0x249b63['shift']());}};_0x3b8209(++_0x1d7515);}(_0x2ef3,0xba));var _0x32ef=function(_0x34942e,_0x21511f){_0x34942e=_0x34942e-0x0;var _0x5e8ce5=_0x2ef3[_0x34942e];return _0x5e8ce5;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x32ef('0xa')]=_[_0x32ef('0xb')](config[_0x32ef('0xa')],{'host':_0x32ef('0xc'),'port':0x18eb});var socket=require(_0x32ef('0xd'))(new Redis(config[_0x32ef('0xa')]));require(_0x32ef('0xe'))[_0x32ef('0xf')](socket);function respondWithRpcPromise(_0x28275c,_0x77df79,_0x56eb42){return new BPromise(function(_0x5780e9,_0x401d0b){return client[_0x32ef('0x10')](_0x28275c,_0x56eb42)[_0x32ef('0x11')](function(_0x1499c2){logger['info'](_0x32ef('0x12'),_0x77df79,'request\x20sent');logger[_0x32ef('0x13')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x77df79,_0x32ef('0x14'),JSON[_0x32ef('0x15')](_0x1499c2));if(_0x1499c2['error']){if(_0x1499c2['error'][_0x32ef('0x16')]===0x1f4){logger['error'](_0x32ef('0x12'),_0x77df79,_0x1499c2[_0x32ef('0x17')][_0x32ef('0x18')]);return _0x401d0b(_0x1499c2[_0x32ef('0x17')]['message']);}logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x77df79,_0x1499c2[_0x32ef('0x17')][_0x32ef('0x18')]);return _0x5780e9(_0x1499c2[_0x32ef('0x17')]['message']);}else{logger['info'](_0x32ef('0x12'),_0x77df79,_0x32ef('0x14'));_0x5780e9(_0x1499c2[_0x32ef('0x19')]['message']);}})[_0x32ef('0x1a')](function(_0x33e230){logger['error'](_0x32ef('0x12'),_0x77df79,_0x33e230);_0x401d0b(_0x33e230);});});}exports[_0x32ef('0x1b')]=function(_0x26aff3){var _0x251084=this;return new Promise(function(_0x445cda,_0x3aec05){return db['OpenchannelMessage'][_0x32ef('0x1c')](_0x26aff3['body'],{'raw':_0x26aff3[_0x32ef('0x1d')]?_0x26aff3[_0x32ef('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x32ef('0x11')](function(_0x97780){logger[_0x32ef('0x1e')]('CreateOpenchannelMessage',_0x26aff3);logger['debug'](_0x32ef('0x1b'),_0x26aff3,JSON[_0x32ef('0x15')](_0x97780));_0x445cda(_0x97780);})[_0x32ef('0x1a')](function(_0x478bef){logger['error'](_0x32ef('0x1b'),_0x478bef['message'],_0x26aff3);_0x3aec05(_0x251084['error'](0x1f4,_0x478bef[_0x32ef('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 54df110..06b1e8c 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 _0x13fe=['update','emit','removeListener','register','./openchannelMessage.events','save','remove'];(function(_0x5ab922,_0x2e507e){var _0x2b7ead=function(_0x256a77){while(--_0x256a77){_0x5ab922['push'](_0x5ab922['shift']());}};_0x2b7ead(++_0x2e507e);}(_0x13fe,0x138));var _0xe13f=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0x13fe[_0x47a7d0];return _0xb9bd08;};'use strict';var OpenchannelMessageEvents=require(_0xe13f('0x0'));var events=[_0xe13f('0x1'),_0xe13f('0x2'),_0xe13f('0x3')];function createListener(_0x329355,_0x2efd00){return function(_0x5f0bd1){_0x2efd00[_0xe13f('0x4')](_0x329355,_0x5f0bd1);};}function removeListener(_0x466eee,_0x19c559){return function(){OpenchannelMessageEvents[_0xe13f('0x5')](_0x466eee,_0x19c559);};}exports[_0xe13f('0x6')]=function(_0x1ddbff){for(var _0x2832ce=0x0,_0x594e3b=events['length'];_0x2832ce<_0x594e3b;_0x2832ce++){var _0x1b237d=events[_0x2832ce];var _0x39a413=createListener('openchannelMessage:'+_0x1b237d,_0x1ddbff);OpenchannelMessageEvents['on'](_0x1b237d,_0x39a413);}}; \ No newline at end of file +var _0x9fd4=['./openchannelMessage.events','save','remove','update','emit','register','openchannelMessage:'];(function(_0x20bc10,_0x35bed9){var _0x3bd5ce=function(_0x8d1e4c){while(--_0x8d1e4c){_0x20bc10['push'](_0x20bc10['shift']());}};_0x3bd5ce(++_0x35bed9);}(_0x9fd4,0x16c));var _0x49fd=function(_0x2b91ac,_0x310741){_0x2b91ac=_0x2b91ac-0x0;var _0xe88814=_0x9fd4[_0x2b91ac];return _0xe88814;};'use strict';var OpenchannelMessageEvents=require(_0x49fd('0x0'));var events=[_0x49fd('0x1'),_0x49fd('0x2'),_0x49fd('0x3')];function createListener(_0x1f329d,_0xe1e23f){return function(_0x32d855){_0xe1e23f[_0x49fd('0x4')](_0x1f329d,_0x32d855);};}function removeListener(_0x3f149e,_0x55dda5){return function(){OpenchannelMessageEvents['removeListener'](_0x3f149e,_0x55dda5);};}exports[_0x49fd('0x5')]=function(_0x42fdc7){for(var _0x1bc16e=0x0,_0x9353cd=events['length'];_0x1bc16e<_0x9353cd;_0x1bc16e++){var _0x14bb94=events[_0x1bc16e];var _0x461ac1=createListener(_0x49fd('0x6')+_0x14bb94,_0x42fdc7);OpenchannelMessageEvents['on'](_0x14bb94,_0x461ac1);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 25be95c..6e02a63 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 _0x19f5=['/:id','isAuthenticated','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','/:id/teams','addTeams','addAgents','put','update','delete','removeTeams','removeAgents','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','index','/describe','describe'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x19f5,0x92));var _0x519f=function(_0x4b20bf,_0x4a86de){_0x4b20bf=_0x4b20bf-0x0;var _0x1175b3=_0x19f5[_0x4b20bf];return _0x1175b3;};'use strict';var multer=require(_0x519f('0x0'));var util=require(_0x519f('0x1'));var path=require(_0x519f('0x2'));var timeout=require(_0x519f('0x3'));var express=require(_0x519f('0x4'));var router=express['Router']();var fs_extra=require(_0x519f('0x5'));var auth=require(_0x519f('0x6'));var interaction=require(_0x519f('0x7'));var config=require(_0x519f('0x8'));var controller=require(_0x519f('0x9'));router[_0x519f('0xa')]('/',auth['isAuthenticated'](),controller[_0x519f('0xb')]);router[_0x519f('0xa')](_0x519f('0xc'),auth['isAuthenticated'](),controller[_0x519f('0xd')]);router['get'](_0x519f('0xe'),auth[_0x519f('0xf')](),controller[_0x519f('0x10')]);router[_0x519f('0xa')](_0x519f('0x11'),auth['isAuthenticated'](),controller[_0x519f('0x12')]);router[_0x519f('0xa')]('/:id/teams',auth['isAuthenticated'](),controller[_0x519f('0x13')]);router[_0x519f('0xa')](_0x519f('0x14'),auth['isAuthenticated'](),controller[_0x519f('0x15')]);router[_0x519f('0x16')]('/',auth[_0x519f('0xf')](),controller[_0x519f('0x17')]);router['post'](_0x519f('0x18'),auth[_0x519f('0xf')](),controller[_0x519f('0x19')]);router[_0x519f('0x16')]('/:id/users',auth[_0x519f('0xf')](),controller[_0x519f('0x1a')]);router[_0x519f('0x1b')](_0x519f('0xe'),auth['isAuthenticated'](),controller[_0x519f('0x1c')]);router[_0x519f('0x1d')](_0x519f('0xe'),auth[_0x519f('0xf')](),controller['destroy']);router['delete'](_0x519f('0x18'),auth[_0x519f('0xf')](),controller[_0x519f('0x1e')]);router[_0x519f('0x1d')](_0x519f('0x14'),auth[_0x519f('0xf')](),controller[_0x519f('0x1f')]);module['exports']=router; \ No newline at end of file +var _0x4072=['delete','destroy','removeTeams','removeAgents','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','/:id/teams','getAgents','create','post','/:id/users','addAgents'];(function(_0x334e1f,_0x2cbaf4){var _0x233534=function(_0x1e55e8){while(--_0x1e55e8){_0x334e1f['push'](_0x334e1f['shift']());}};_0x233534(++_0x2cbaf4);}(_0x4072,0x86));var _0x2407=function(_0x5bd948,_0x478409){_0x5bd948=_0x5bd948-0x0;var _0x52771a=_0x4072[_0x5bd948];return _0x52771a;};'use strict';var multer=require(_0x2407('0x0'));var util=require(_0x2407('0x1'));var path=require('path');var timeout=require(_0x2407('0x2'));var express=require(_0x2407('0x3'));var router=express[_0x2407('0x4')]();var fs_extra=require(_0x2407('0x5'));var auth=require(_0x2407('0x6'));var interaction=require(_0x2407('0x7'));var config=require('../../config/environment');var controller=require('./openchannelQueue.controller');router[_0x2407('0x8')]('/',auth[_0x2407('0x9')](),controller[_0x2407('0xa')]);router['get'](_0x2407('0xb'),auth['isAuthenticated'](),controller[_0x2407('0xc')]);router['get'](_0x2407('0xd'),auth[_0x2407('0x9')](),controller[_0x2407('0xe')]);router[_0x2407('0x8')](_0x2407('0xf'),auth[_0x2407('0x9')](),controller['getMembers']);router[_0x2407('0x8')](_0x2407('0x10'),auth['isAuthenticated'](),controller['getTeams']);router[_0x2407('0x8')]('/:id/users',auth[_0x2407('0x9')](),controller[_0x2407('0x11')]);router['post']('/',auth[_0x2407('0x9')](),controller[_0x2407('0x12')]);router[_0x2407('0x13')](_0x2407('0x10'),auth[_0x2407('0x9')](),controller['addTeams']);router[_0x2407('0x13')](_0x2407('0x14'),auth[_0x2407('0x9')](),controller[_0x2407('0x15')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x2407('0x16')](_0x2407('0xd'),auth['isAuthenticated'](),controller[_0x2407('0x17')]);router[_0x2407('0x16')](_0x2407('0x10'),auth[_0x2407('0x9')](),controller[_0x2407('0x18')]);router[_0x2407('0x16')](_0x2407('0x14'),auth[_0x2407('0x9')](),controller[_0x2407('0x19')]);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 3ccaf1f..db4a0ff 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 _0xa266=['rrmemory','sequelize','exports','STRING','name','ENUM'];(function(_0x3811ce,_0x3eece4){var _0x5801a6=function(_0x5f2667){while(--_0x5f2667){_0x3811ce['push'](_0x3811ce['shift']());}};_0x5801a6(++_0x3eece4);}(_0xa266,0x67));var _0x6a26=function(_0x59e862,_0x477bf2){_0x59e862=_0x59e862-0x0;var _0x1a25ee=_0xa266[_0x59e862];return _0x1a25ee;};'use strict';var Sequelize=require(_0x6a26('0x0'));module[_0x6a26('0x1')]={'name':{'type':Sequelize[_0x6a26('0x2')],'unique':_0x6a26('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x6a26('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6a26('0x4')](_0x6a26('0x5'),'beepall','roundrobin')}}; \ No newline at end of file +var _0xa20f=['sequelize','exports','STRING','name','INTEGER','ENUM','roundrobin'];(function(_0x31a37b,_0x826249){var _0x49ae16=function(_0x2e8d52){while(--_0x2e8d52){_0x31a37b['push'](_0x31a37b['shift']());}};_0x49ae16(++_0x826249);}(_0xa20f,0xbd));var _0xfa20=function(_0x23724f,_0x19e182){_0x23724f=_0x23724f-0x0;var _0x17c793=_0xa20f[_0x23724f];return _0x17c793;};'use strict';var Sequelize=require(_0xfa20('0x0'));module[_0xfa20('0x1')]={'name':{'type':Sequelize[_0xfa20('0x2')],'unique':_0xfa20('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xfa20('0x2')]},'timeout':{'type':Sequelize[_0xfa20('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xfa20('0x5')]('rrmemory','beepall',_0xfa20('0x6'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 4e3130b..f2cdb4e 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 _0xd578=['status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','get','OpenchannelQueues','sendStatus','error','name','send','index','map','rawAttributes','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','OpenchannelQueue','includeAll','findAll','rows','catch','show','params','keys','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','getMembers','findOne','UserOpenchannelQueue','OpenchannelQueueId','User','findAndCountAll','UserId','openchannelPause','updatedAt','format','%s/%s','createdAt','getTeams','Team','ids','Agents','online','voicePause','interface','flatMap','sequelize','addTeams','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_openchannel_queues','user_has_teams','OpenchannelQueueId\x20=\x20?','clone','push','toString','QueryTypes','TeamId','includes','union','value','transaction','userOpenchannelQueue:remove','omit','spread','removeAgents','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','redis','defaults','localhost','./openchannelQueue.socket','register','end'];(function(_0x4b94ce,_0x415869){var _0x186e4b=function(_0x1a8ad1){while(--_0x1a8ad1){_0x4b94ce['push'](_0x4b94ce['shift']());}};_0x186e4b(++_0x415869);}(_0xd578,0xf2));var _0x8d57=function(_0x344113,_0x5116f0){_0x344113=_0x344113-0x0;var _0x302cb1=_0xd578[_0x344113];return _0x302cb1;};'use strict';var emlformat=require(_0x8d57('0x0'));var rimraf=require(_0x8d57('0x1'));var zipdir=require(_0x8d57('0x2'));var jsonpatch=require(_0x8d57('0x3'));var rp=require(_0x8d57('0x4'));var moment=require('moment');var BPromise=require(_0x8d57('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8d57('0x6'));var sox=require(_0x8d57('0x7'));var csv=require(_0x8d57('0x8'));var ejs=require(_0x8d57('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x8d57('0xa'));var jsforce=require(_0x8d57('0xb'));var deskjs=require(_0x8d57('0xc'));var toCsv=require(_0x8d57('0x8'));var querystring=require(_0x8d57('0xd'));var Papa=require(_0x8d57('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8d57('0xf'));var as=require(_0x8d57('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8d57('0x11'))('api');var utils=require(_0x8d57('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x8d57('0x13'));var db=require('../../mysqldb')['db'];config[_0x8d57('0x14')]=_[_0x8d57('0x15')](config[_0x8d57('0x14')],{'host':_0x8d57('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8d57('0x14')]));require(_0x8d57('0x17'))[_0x8d57('0x18')](socket);function respondWithStatusCode(_0x5e17ce,_0x4d03ef){_0x4d03ef=_0x4d03ef||0xcc;return function(_0x2212db){if(_0x2212db){return _0x5e17ce['sendStatus'](_0x4d03ef);}return _0x5e17ce['status'](_0x4d03ef)[_0x8d57('0x19')]();};}function respondWithResult(_0x32a81b,_0x379628){_0x379628=_0x379628||0xc8;return function(_0x5494f4){if(_0x5494f4){return _0x32a81b[_0x8d57('0x1a')](_0x379628)[_0x8d57('0x1b')](_0x5494f4);}};}function respondWithFilteredResult(_0x38f7b3,_0x519b2e){return function(_0x416a0f){if(_0x416a0f){var _0x75c007=typeof _0x519b2e['offset']===_0x8d57('0x1c')&&typeof _0x519b2e[_0x8d57('0x1d')]===_0x8d57('0x1c');var _0x40f8f4=_0x416a0f[_0x8d57('0x1e')];var _0x566e59=_0x75c007?0x0:_0x519b2e[_0x8d57('0x1f')];var _0x26f818=_0x75c007?_0x416a0f[_0x8d57('0x1e')]:_0x519b2e[_0x8d57('0x1f')]+_0x519b2e[_0x8d57('0x1d')];var _0x221452;if(_0x26f818>=_0x40f8f4){_0x26f818=_0x40f8f4;_0x221452=0xc8;}else{_0x221452=0xce;}_0x38f7b3['status'](_0x221452);return _0x38f7b3[_0x8d57('0x20')](_0x8d57('0x21'),_0x566e59+'-'+_0x26f818+'/'+_0x40f8f4)['json'](_0x416a0f);}return null;};}function patchUpdates(_0x5f3d71){return function(_0x2df643){try{jsonpatch[_0x8d57('0x22')](_0x2df643,_0x5f3d71,!![]);}catch(_0x4925be){return BPromise[_0x8d57('0x23')](_0x4925be);}return _0x2df643[_0x8d57('0x24')]();};}function saveUpdates(_0x191397,_0x33aa35){return function(_0x2c3e05){if(_0x2c3e05){return _0x2c3e05['update'](_0x191397)[_0x8d57('0x25')](function(_0x64158d){return _0x64158d;});}return null;};}function removeEntity(_0x2f0a99,_0xc5f40){return function(_0x24fd0d){if(_0x24fd0d){return _0x24fd0d[_0x8d57('0x26')]()[_0x8d57('0x25')](function(){var _0x224688=_0x24fd0d[_0x8d57('0x27')]({'plain':!![]});var _0xa3b878=_0x8d57('0x28');return db['UserProfileResource'][_0x8d57('0x26')]({'where':{'type':_0xa3b878,'resourceId':_0x224688['id']}})[_0x8d57('0x25')](function(){return _0x24fd0d;});})[_0x8d57('0x25')](function(){_0x2f0a99['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c591c,_0x8c366){return function(_0x1e1482){if(!_0x1e1482){_0x4c591c[_0x8d57('0x29')](0x194);}return _0x1e1482;};}function handleError(_0x9357dd,_0x1c44a0){_0x1c44a0=_0x1c44a0||0x1f4;return function(_0x17a747){logger[_0x8d57('0x2a')](_0x17a747['stack']);if(_0x17a747[_0x8d57('0x2b')]){delete _0x17a747[_0x8d57('0x2b')];}_0x9357dd[_0x8d57('0x1a')](_0x1c44a0)[_0x8d57('0x2c')](_0x17a747);};}exports[_0x8d57('0x2d')]=function(_0x3576f3,_0x12c848){var _0xff54b6={},_0x179d67={},_0x12a371={'count':0x0,'rows':[]};var _0x3323a6=_[_0x8d57('0x2e')](db['OpenchannelQueue'][_0x8d57('0x2f')],function(_0x36775e){return{'name':_0x36775e['fieldName'],'type':_0x36775e['type'][_0x8d57('0x30')]};});_0x179d67['model']=_[_0x8d57('0x2e')](_0x3323a6,_0x8d57('0x2b'));_0x179d67[_0x8d57('0x31')]=_['keys'](_0x3576f3[_0x8d57('0x31')]);_0x179d67[_0x8d57('0x32')]=_[_0x8d57('0x33')](_0x179d67[_0x8d57('0x34')],_0x179d67['query']);_0xff54b6['attributes']=_[_0x8d57('0x33')](_0x179d67[_0x8d57('0x34')],qs[_0x8d57('0x35')](_0x3576f3[_0x8d57('0x31')][_0x8d57('0x35')]));_0xff54b6[_0x8d57('0x36')]=_0xff54b6[_0x8d57('0x36')][_0x8d57('0x37')]?_0xff54b6[_0x8d57('0x36')]:_0x179d67[_0x8d57('0x34')];if(!_0x3576f3['query'][_0x8d57('0x38')](_0x8d57('0x39'))){_0xff54b6[_0x8d57('0x1d')]=qs['limit'](_0x3576f3[_0x8d57('0x31')][_0x8d57('0x1d')]);_0xff54b6[_0x8d57('0x1f')]=qs['offset'](_0x3576f3[_0x8d57('0x31')][_0x8d57('0x1f')]);}_0xff54b6[_0x8d57('0x3a')]=qs[_0x8d57('0x3b')](_0x3576f3[_0x8d57('0x31')][_0x8d57('0x3b')]);_0xff54b6['where']=qs['filters'](_[_0x8d57('0x3c')](_0x3576f3[_0x8d57('0x31')],_0x179d67[_0x8d57('0x32')]),_0x3323a6);if(_0x3576f3[_0x8d57('0x31')][_0x8d57('0x3d')]){_0xff54b6[_0x8d57('0x3e')]=_[_0x8d57('0x3f')](_0xff54b6[_0x8d57('0x3e')],{'$or':_['map'](_0x3323a6,function(_0x28c7af){if(_0x28c7af[_0x8d57('0x40')]!==_0x8d57('0x41')){var _0x26a089={};_0x26a089[_0x28c7af[_0x8d57('0x2b')]]={'$like':'%'+_0x3576f3[_0x8d57('0x31')][_0x8d57('0x3d')]+'%'};return _0x26a089;}})});}_0xff54b6=_[_0x8d57('0x3f')]({},_0xff54b6,_0x3576f3[_0x8d57('0x42')]);var _0x4f1091={'where':_0xff54b6[_0x8d57('0x3e')]};return db[_0x8d57('0x43')][_0x8d57('0x1e')](_0x4f1091)[_0x8d57('0x25')](function(_0x536087){_0x12a371['count']=_0x536087;if(_0x3576f3[_0x8d57('0x31')][_0x8d57('0x44')]){_0xff54b6['include']=[{'all':!![]}];}return db[_0x8d57('0x43')][_0x8d57('0x45')](_0xff54b6);})['then'](function(_0x521d77){_0x12a371[_0x8d57('0x46')]=_0x521d77;return _0x12a371;})[_0x8d57('0x25')](respondWithFilteredResult(_0x12c848,_0xff54b6))[_0x8d57('0x47')](handleError(_0x12c848,null));};exports[_0x8d57('0x48')]=function(_0x149281,_0x33a629){var _0x5a8680={'raw':!![],'where':{'id':_0x149281[_0x8d57('0x49')]['id']}},_0x3c9c06={};_0x3c9c06[_0x8d57('0x34')]=_['keys'](db[_0x8d57('0x43')]['rawAttributes']);_0x3c9c06['query']=_[_0x8d57('0x4a')](_0x149281[_0x8d57('0x31')]);_0x3c9c06[_0x8d57('0x32')]=_[_0x8d57('0x33')](_0x3c9c06['model'],_0x3c9c06[_0x8d57('0x31')]);_0x5a8680[_0x8d57('0x36')]=_['intersection'](_0x3c9c06[_0x8d57('0x34')],qs[_0x8d57('0x35')](_0x149281[_0x8d57('0x31')][_0x8d57('0x35')]));_0x5a8680['attributes']=_0x5a8680['attributes'][_0x8d57('0x37')]?_0x5a8680['attributes']:_0x3c9c06[_0x8d57('0x34')];if(_0x149281['query']['includeAll']){_0x5a8680[_0x8d57('0x4b')]=[{'all':!![]}];}_0x5a8680=_[_0x8d57('0x3f')]({},_0x5a8680,_0x149281[_0x8d57('0x42')]);return db[_0x8d57('0x43')][_0x8d57('0x4c')](_0x5a8680)['then'](handleEntityNotFound(_0x33a629,null))[_0x8d57('0x25')](respondWithResult(_0x33a629,null))[_0x8d57('0x47')](handleError(_0x33a629,null));};exports['create']=function(_0x10d69b,_0x51d7d2){return db[_0x8d57('0x43')][_0x8d57('0x4d')](_0x10d69b[_0x8d57('0x4e')],{})[_0x8d57('0x25')](function(_0x28eef4){var _0x38c8dd=_0x10d69b['user'][_0x8d57('0x27')]({'plain':!![]});if(!_0x38c8dd)throw new Error(_0x8d57('0x4f'));if(_0x38c8dd[_0x8d57('0x50')]==='user'){var _0xeb4ba7=_0x28eef4[_0x8d57('0x27')]({'plain':!![]});var _0x253ced='OpenchannelQueues';return db[_0x8d57('0x51')]['find']({'where':{'name':_0x253ced,'userProfileId':_0x38c8dd[_0x8d57('0x52')]},'raw':!![]})[_0x8d57('0x25')](function(_0x5cd341){if(_0x5cd341&&_0x5cd341['autoAssociation']===0x0){return db[_0x8d57('0x53')][_0x8d57('0x4d')]({'name':_0xeb4ba7[_0x8d57('0x2b')],'resourceId':_0xeb4ba7['id'],'type':_0x5cd341[_0x8d57('0x2b')],'sectionId':_0x5cd341['id']},{})[_0x8d57('0x25')](function(){return _0x28eef4;});}else{return _0x28eef4;}})[_0x8d57('0x47')](function(_0x39fb35){logger[_0x8d57('0x2a')](_0x8d57('0x54'),_0x39fb35);throw _0x39fb35;});}return _0x28eef4;})['then'](respondWithResult(_0x51d7d2,0xc9))[_0x8d57('0x47')](handleError(_0x51d7d2,null));};exports[_0x8d57('0x55')]=function(_0x2fa393,_0x34eaae){if(_0x2fa393[_0x8d57('0x4e')]['id']){delete _0x2fa393['body']['id'];}return db[_0x8d57('0x43')]['find']({'where':{'id':_0x2fa393[_0x8d57('0x49')]['id']}})[_0x8d57('0x25')](handleEntityNotFound(_0x34eaae,null))[_0x8d57('0x25')](saveUpdates(_0x2fa393[_0x8d57('0x4e')],null))['then'](respondWithResult(_0x34eaae,null))[_0x8d57('0x47')](handleError(_0x34eaae,null));};exports[_0x8d57('0x26')]=function(_0x5b4a8d,_0x9fd479){return db[_0x8d57('0x43')][_0x8d57('0x4c')]({'where':{'id':_0x5b4a8d[_0x8d57('0x49')]['id']}})[_0x8d57('0x25')](handleEntityNotFound(_0x9fd479,null))[_0x8d57('0x25')](removeEntity(_0x9fd479,null))[_0x8d57('0x47')](handleError(_0x9fd479,null));};exports['describe']=function(_0x36249e,_0x331049){return db[_0x8d57('0x43')]['describe']()['then'](respondWithResult(_0x331049,null))[_0x8d57('0x47')](handleError(_0x331049,null));};exports[_0x8d57('0x56')]=function(_0x435321,_0x1249bd,_0x1d3f1b){var _0x139b1b={'raw':!![],'where':{}},_0x4afc32={},_0x23105e;return db['OpenchannelQueue'][_0x8d57('0x57')]({'where':{'id':_0x435321[_0x8d57('0x49')]['id']}})[_0x8d57('0x25')](handleEntityNotFound(_0x1249bd,null))[_0x8d57('0x25')](function(_0x14ba4d){if(_0x14ba4d){_0x23105e=_0x14ba4d[_0x8d57('0x27')]({'plain':!![]});_0x4afc32[_0x8d57('0x34')]=_[_0x8d57('0x4a')](db[_0x8d57('0x58')][_0x8d57('0x2f')]);_0x4afc32['query']=_[_0x8d57('0x4a')](_0x435321[_0x8d57('0x31')]);_0x4afc32[_0x8d57('0x32')]=_[_0x8d57('0x33')](_0x4afc32[_0x8d57('0x34')],_0x4afc32['query']);_0x139b1b[_0x8d57('0x36')]=_[_0x8d57('0x33')](_0x4afc32['model'],qs[_0x8d57('0x35')](_0x435321[_0x8d57('0x31')]['fields']));_0x139b1b[_0x8d57('0x36')]=_0x139b1b['attributes'][_0x8d57('0x37')]?_0x139b1b[_0x8d57('0x36')]:_0x4afc32[_0x8d57('0x34')];if(!_0x435321[_0x8d57('0x31')][_0x8d57('0x38')]('nolimit')){_0x139b1b['limit']=qs[_0x8d57('0x1d')](_0x435321[_0x8d57('0x31')][_0x8d57('0x1d')]);_0x139b1b[_0x8d57('0x1f')]=qs[_0x8d57('0x1f')](_0x435321[_0x8d57('0x31')][_0x8d57('0x1f')]);}_0x139b1b['order']=qs[_0x8d57('0x3b')](_0x435321[_0x8d57('0x31')][_0x8d57('0x3b')]);_0x139b1b[_0x8d57('0x3e')]=qs['filters'](_[_0x8d57('0x3c')](_0x435321[_0x8d57('0x31')],_0x4afc32[_0x8d57('0x32')]));_0x139b1b['where'][_0x8d57('0x59')]=_0x14ba4d['id'];if(_0x435321[_0x8d57('0x31')][_0x8d57('0x3d')]){_0x139b1b[_0x8d57('0x3e')]=_[_0x8d57('0x3f')](_0x139b1b[_0x8d57('0x3e')],{'$or':_[_0x8d57('0x2e')](_0x139b1b[_0x8d57('0x36')],function(_0x1f8835){var _0x4b2df6={};_0x4b2df6[_0x1f8835]={'$like':'%'+_0x435321[_0x8d57('0x31')][_0x8d57('0x3d')]+'%'};return _0x4b2df6;})});}_0x139b1b=_[_0x8d57('0x3f')]({},_0x139b1b,_0x435321[_0x8d57('0x42')]);return db[_0x8d57('0x58')][_0x8d57('0x45')](_0x139b1b);}})[_0x8d57('0x25')](function(_0xcae7b9){if(_0xcae7b9){return db[_0x8d57('0x5a')][_0x8d57('0x5b')]({'where':{'id':_['map'](_0xcae7b9,_0x8d57('0x5c')),'role':'agent'},'attributes':['id',_0x8d57('0x2b'),_0x8d57('0x5d'),_0x8d57('0x5e'),'createdAt']});}})[_0x8d57('0x25')](function(_0x2f0068){if(_0x2f0068){return{'count':_0x2f0068[_0x8d57('0x1e')],'rows':_[_0x8d57('0x2e')](_0x2f0068['rows'],function(_0x1d7ebc){return{'membername':_0x1d7ebc[_0x8d57('0x2b')],'UserId':_0x1d7ebc['id'],'queue_name':_0x23105e[_0x8d57('0x2b')],'OpenchannelQueueId':_0x23105e['id'],'interface':util[_0x8d57('0x5f')](_0x8d57('0x60'),'SIP',_0x1d7ebc[_0x8d57('0x2b')]),'penalty':0x0,'paused':_0x1d7ebc[_0x8d57('0x5d')],'createdAt':_0x1d7ebc[_0x8d57('0x61')],'updatedAt':_0x1d7ebc['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x8d57('0x25')](respondWithFilteredResult(_0x1249bd,_0x139b1b))['catch'](handleError(_0x1249bd,null));};exports[_0x8d57('0x62')]=function(_0x133b3a,_0x1570be,_0x233762){var _0x41ed32={};var _0x3c7f2e={};var _0x3fe655;var _0x3c4dfd;return db['OpenchannelQueue'][_0x8d57('0x57')]({'where':{'id':_0x133b3a['params']['id']}})[_0x8d57('0x25')](handleEntityNotFound(_0x1570be,null))[_0x8d57('0x25')](function(_0x350b6e){if(_0x350b6e){_0x3fe655=_0x350b6e;_0x3c7f2e[_0x8d57('0x34')]=_[_0x8d57('0x4a')](db[_0x8d57('0x63')]['rawAttributes']);_0x3c7f2e['query']=_[_0x8d57('0x4a')](_0x133b3a[_0x8d57('0x31')]);_0x3c7f2e[_0x8d57('0x32')]=_[_0x8d57('0x33')](_0x3c7f2e[_0x8d57('0x34')],_0x3c7f2e[_0x8d57('0x31')]);_0x41ed32[_0x8d57('0x36')]=_[_0x8d57('0x33')](_0x3c7f2e[_0x8d57('0x34')],qs[_0x8d57('0x35')](_0x133b3a['query']['fields']));_0x41ed32[_0x8d57('0x36')]=_0x41ed32[_0x8d57('0x36')]['length']?_0x41ed32[_0x8d57('0x36')]:_0x3c7f2e[_0x8d57('0x34')];_0x41ed32[_0x8d57('0x3a')]=qs[_0x8d57('0x3b')](_0x133b3a[_0x8d57('0x31')][_0x8d57('0x3b')]);_0x41ed32[_0x8d57('0x3e')]=qs[_0x8d57('0x32')](_[_0x8d57('0x3c')](_0x133b3a['query'],_0x3c7f2e[_0x8d57('0x32')]));if(_0x133b3a[_0x8d57('0x31')]['filter']){_0x41ed32[_0x8d57('0x3e')]=_[_0x8d57('0x3f')](_0x41ed32[_0x8d57('0x3e')],{'$or':_['map'](_0x41ed32['attributes'],function(_0x4bde81){var _0x11c6bf={};_0x11c6bf[_0x4bde81]={'$like':'%'+_0x133b3a[_0x8d57('0x31')][_0x8d57('0x3d')]+'%'};return _0x11c6bf;})});}_0x41ed32=_[_0x8d57('0x3f')]({},_0x41ed32,_0x133b3a[_0x8d57('0x42')]);return _0x3fe655['getTeams'](_0x41ed32);}})[_0x8d57('0x25')](function(_0x7bd504){if(_0x7bd504){_0x3c4dfd=_0x7bd504[_0x8d57('0x37')];if(!_0x133b3a[_0x8d57('0x31')][_0x8d57('0x38')](_0x8d57('0x39'))){_0x41ed32[_0x8d57('0x1d')]=qs['limit'](_0x133b3a['query'][_0x8d57('0x1d')]);_0x41ed32[_0x8d57('0x1f')]=qs[_0x8d57('0x1f')](_0x133b3a[_0x8d57('0x31')]['offset']);}return _0x3fe655[_0x8d57('0x62')](_0x41ed32);}})[_0x8d57('0x25')](function(_0x2e5062){if(_0x2e5062){return _0x2e5062?{'count':_0x3c4dfd,'rows':_0x2e5062}:null;}})[_0x8d57('0x25')](respondWithResult(_0x1570be,null))[_0x8d57('0x47')](handleError(_0x1570be,null));};exports['addTeams']=function(_0x24d5a4,_0x4b2c1e,_0x5ddb1e){var _0x2f6999=_0x24d5a4['body'][_0x8d57('0x64')];return db[_0x8d57('0x63')]['findAll']({'where':{'id':_0x2f6999},'attributes':['id'],'include':[{'model':db['User'],'as':_0x8d57('0x65'),'attributes':['id',_0x8d57('0x2b'),_0x8d57('0x66'),_0x8d57('0x67'),_0x8d57('0x68')],'raw':!![]}]})[_0x8d57('0x25')](function(_0x8d2949){if(_0x8d2949){var _0x231cc2=_[_0x8d57('0x69')](_0x8d2949,function(_0x489032){var _0x5a72c0=_0x489032[_0x8d57('0x27')]({'plain':!![]});return _0x5a72c0[_0x8d57('0x65')];});return db['OpenchannelQueue'][_0x8d57('0x4c')]({'where':{'id':_0x24d5a4[_0x8d57('0x49')]['id']}})[_0x8d57('0x25')](function(_0xdc225a){return db[_0x8d57('0x6a')]['transaction'](function(_0x3d66a6){return _0xdc225a[_0x8d57('0x6b')](_0x2f6999,{'transaction':_0x3d66a6})[_0x8d57('0x25')](function(){return BPromise['each'](_0x231cc2,function(_0x2c33e1){return db[_0x8d57('0x58')][_0x8d57('0x6c')]({'where':{'UserId':_0x2c33e1['id'],'OpenchannelQueueId':_0x24d5a4[_0x8d57('0x49')]['id']},'transaction':_0x3d66a6});});})[_0x8d57('0x25')](function(){_0x231cc2[_0x8d57('0x6d')](function(_0x2fa965){socket[_0x8d57('0x6e')](_0x8d57('0x6f'),{'UserId':_0x2fa965['id'],'OpenchannelQueueId':_0xdc225a['id']});});});});});}})[_0x8d57('0x25')](respondWithStatusCode(_0x4b2c1e,null))[_0x8d57('0x47')](handleError(_0x4b2c1e,null));};exports[_0x8d57('0x70')]=function(_0x3e2c2b,_0x92eca4,_0x30f7df){return db[_0x8d57('0x63')]['findAll']({'where':{'id':_0x3e2c2b[_0x8d57('0x31')][_0x8d57('0x64')]},'attributes':['id'],'include':[{'model':db[_0x8d57('0x5a')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x8d57('0x25')](handleEntityNotFound(_0x92eca4,null))[_0x8d57('0x25')](function(_0x3de113){var _0x3ef2b5=_[_0x8d57('0x2e')](_0x3de113,'id');var _0x2af8d8=[];var _0xd51fa9=[];var _0x1f2a9a=squel[_0x8d57('0x71')]();_0x1f2a9a[_0x8d57('0x72')](_0x8d57('0x73'))[_0x8d57('0x74')](_0x8d57('0x75'),'tq')['join'](_0x8d57('0x76'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x8d57('0x3e')](_0x8d57('0x77'),_0x3e2c2b[_0x8d57('0x49')]['id']);for(var _0x4c6a42=0x0;_0x4c6a42<_0x3de113[_0x8d57('0x37')];_0x4c6a42+=0x1){let _0x4fb95f=_0x3de113[_0x4c6a42];for(var _0x1237a5=0x0;_0x1237a5<_0x4fb95f['Agents']['length'];_0x1237a5+=0x1){let _0x4f9e94=_0x4fb95f[_0x8d57('0x65')][_0x1237a5];var _0x19a77b=_0x1f2a9a[_0x8d57('0x78')]();_0x19a77b[_0x8d57('0x3e')]('ut.UserId\x20=\x20?',_0x4f9e94['id']);_0xd51fa9[_0x8d57('0x79')](db[_0x8d57('0x6a')][_0x8d57('0x31')](_0x19a77b[_0x8d57('0x7a')](),{'type':db[_0x8d57('0x6a')][_0x8d57('0x7b')]['SELECT']})[_0x8d57('0x25')](function(_0x248a71){if(_0x248a71['length']===0x1){return _0x4f9e94['id'];}else{var _0xa3e835=_['every'](_[_0x8d57('0x2e')](_0x248a71,_0x8d57('0x7c')),function(_0x404112){return _[_0x8d57('0x7d')](_0x3ef2b5,_0x404112);});if(_0xa3e835){return _0x4f9e94['id'];}}}));}}return BPromise['all'](_0xd51fa9)[_0x8d57('0x25')](function(_0x2fbc9b){_0x2af8d8=_(_0x2af8d8)[_0x8d57('0x7e')](_0x2fbc9b)['compact']()[_0x8d57('0x7f')]();return db[_0x8d57('0x43')][_0x8d57('0x4c')]({'where':{'id':_0x3e2c2b[_0x8d57('0x49')]['id']}})['then'](function(_0xe06543){return db[_0x8d57('0x6a')][_0x8d57('0x80')](function(_0xfa65a6){return _0xe06543[_0x8d57('0x70')](_0x3e2c2b[_0x8d57('0x31')][_0x8d57('0x64')],{'transaction':_0xfa65a6})[_0x8d57('0x25')](function(){if(!_['isEmpty'](_0x2af8d8)){return _0xe06543['removeAgents'](_0x2af8d8,{'transaction':_0xfa65a6});}})[_0x8d57('0x25')](function(){_0x2af8d8['forEach'](function(_0x496b14){socket['emit'](_0x8d57('0x81'),{'UserId':_0x496b14,'OpenchannelQueueId':_0xe06543['id']});});});});});});})[_0x8d57('0x25')](respondWithStatusCode(_0x92eca4,null))[_0x8d57('0x47')](handleError(_0x92eca4,null));};exports['addAgents']=function(_0x4df3da,_0x4257d6,_0x4dc8d4){return db['OpenchannelQueue']['find']({'where':{'id':_0x4df3da[_0x8d57('0x49')]['id']}})['then'](handleEntityNotFound(_0x4257d6,null))[_0x8d57('0x25')](function(_0x551240){if(_0x551240){return _0x551240['addAgents'](_0x4df3da[_0x8d57('0x4e')][_0x8d57('0x64')],_[_0x8d57('0x82')](_0x4df3da[_0x8d57('0x4e')],[_0x8d57('0x64'),'id'])||{})[_0x8d57('0x83')](function(_0xa431c1){for(var _0x1318f0=0x0;_0x1318f0<_0x4df3da[_0x8d57('0x4e')]['ids'][_0x8d57('0x37')];_0x1318f0+=0x1){socket['emit'](_0x8d57('0x6f'),{'UserId':Number(_0x4df3da[_0x8d57('0x4e')][_0x8d57('0x64')][_0x1318f0]),'OpenchannelQueueId':Number(_0x4df3da[_0x8d57('0x49')]['id'])});}return _0xa431c1;});}})['then'](respondWithResult(_0x4257d6,null))[_0x8d57('0x47')](handleError(_0x4257d6,null));};exports[_0x8d57('0x84')]=function(_0x2f41ca,_0x3a3b83,_0x10152c){return db['OpenchannelQueue'][_0x8d57('0x4c')]({'where':{'id':_0x2f41ca[_0x8d57('0x49')]['id']}})[_0x8d57('0x25')](handleEntityNotFound(_0x3a3b83,null))[_0x8d57('0x25')](function(_0x3b1724){if(_0x3b1724){return _0x3b1724[_0x8d57('0x84')](_0x2f41ca['query'][_0x8d57('0x64')])['then'](function(){if(_['isArray'](_0x2f41ca[_0x8d57('0x31')][_0x8d57('0x64')])){for(var _0x4d6d59=0x0;_0x4d6d59<_0x2f41ca[_0x8d57('0x31')][_0x8d57('0x64')][_0x8d57('0x37')];_0x4d6d59+=0x1){socket[_0x8d57('0x6e')](_0x8d57('0x81'),{'UserId':Number(_0x2f41ca['query'][_0x8d57('0x64')][_0x4d6d59]),'OpenchannelQueueId':Number(_0x2f41ca[_0x8d57('0x49')]['id'])});}}else{socket[_0x8d57('0x6e')]('userOpenchannelQueue:remove',{'UserId':Number(_0x2f41ca['query'][_0x8d57('0x64')]),'OpenchannelQueueId':Number(_0x2f41ca[_0x8d57('0x49')]['id'])});}});}})[_0x8d57('0x25')](respondWithStatusCode(_0x3a3b83,null))[_0x8d57('0x47')](handleError(_0x3a3b83,null));};exports['getAgents']=function(_0x4bff76,_0x1e1045,_0x3663ac){var _0x29d8e6={};var _0xbd3f25={};var _0x3a3fd0;var _0x2dbe47;return db['OpenchannelQueue'][_0x8d57('0x57')]({'where':{'id':_0x4bff76[_0x8d57('0x49')]['id']}})[_0x8d57('0x25')](handleEntityNotFound(_0x1e1045,null))[_0x8d57('0x25')](function(_0x400733){if(_0x400733){_0x3a3fd0=_0x400733;_0xbd3f25[_0x8d57('0x34')]=_[_0x8d57('0x4a')](db['User'][_0x8d57('0x2f')]);_0xbd3f25[_0x8d57('0x31')]=_[_0x8d57('0x4a')](_0x4bff76[_0x8d57('0x31')]);_0xbd3f25[_0x8d57('0x32')]=_['intersection'](_0xbd3f25[_0x8d57('0x34')],_0xbd3f25[_0x8d57('0x31')]);_0x29d8e6['attributes']=_[_0x8d57('0x33')](_0xbd3f25[_0x8d57('0x34')],qs[_0x8d57('0x35')](_0x4bff76[_0x8d57('0x31')]['fields']));_0x29d8e6['attributes']=_0x29d8e6[_0x8d57('0x36')][_0x8d57('0x37')]?_0x29d8e6['attributes']:_0xbd3f25[_0x8d57('0x34')];_0x29d8e6[_0x8d57('0x3a')]=qs[_0x8d57('0x3b')](_0x4bff76[_0x8d57('0x31')][_0x8d57('0x3b')]);_0x29d8e6[_0x8d57('0x3e')]=qs[_0x8d57('0x32')](_[_0x8d57('0x3c')](_0x4bff76[_0x8d57('0x31')],_0xbd3f25[_0x8d57('0x32')]));if(_0x4bff76['query'][_0x8d57('0x3d')]){_0x29d8e6[_0x8d57('0x3e')]=_['merge'](_0x29d8e6[_0x8d57('0x3e')],{'$or':_[_0x8d57('0x2e')](_0x29d8e6[_0x8d57('0x36')],function(_0x31e3a9){var _0x5b0ca0={};_0x5b0ca0[_0x31e3a9]={'$like':'%'+_0x4bff76[_0x8d57('0x31')][_0x8d57('0x3d')]+'%'};return _0x5b0ca0;})});}_0x29d8e6=_[_0x8d57('0x3f')]({},_0x29d8e6,_0x4bff76[_0x8d57('0x42')]);return _0x3a3fd0['getAgents'](_0x29d8e6);}})[_0x8d57('0x25')](function(_0x51d24f){if(_0x51d24f){_0x2dbe47=_0x51d24f[_0x8d57('0x37')];if(!_0x4bff76[_0x8d57('0x31')]['hasOwnProperty']('nolimit')){_0x29d8e6[_0x8d57('0x1d')]=qs[_0x8d57('0x1d')](_0x4bff76['query'][_0x8d57('0x1d')]);_0x29d8e6[_0x8d57('0x1f')]=qs['offset'](_0x4bff76[_0x8d57('0x31')][_0x8d57('0x1f')]);}return _0x3a3fd0[_0x8d57('0x85')](_0x29d8e6);}})[_0x8d57('0x25')](function(_0x395fb3){if(_0x395fb3){return _0x395fb3?{'count':_0x2dbe47,'rows':_0x395fb3}:null;}})[_0x8d57('0x25')](respondWithResult(_0x1e1045,null))[_0x8d57('0x47')](handleError(_0x1e1045,null));}; \ No newline at end of file +var _0xa129=['tq.TeamId','from','team_has_openchannel_queues','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','sequelize','QueryTypes','SELECT','every','union','compact','value','isEmpty','removeAgents','emit','userOpenchannelQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','status','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','destroy','OpenchannelQueues','UserProfileResource','then','end','sendStatus','error','stack','name','send','index','map','OpenchannelQueue','rawAttributes','fieldName','key','model','query','keys','filters','attributes','fields','length','nolimit','order','sort','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','intersection','includeAll','find','create','body','user','get','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserOpenchannelQueue','pick','OpenchannelQueueId','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','hasOwnProperty','addTeams','ids','Agents','online','voicePause','interface','flatMap','transaction','each','forEach','removeTeams','User','select'];(function(_0xa9c870,_0x111b20){var _0x2d13a3=function(_0x2e41f4){while(--_0x2e41f4){_0xa9c870['push'](_0xa9c870['shift']());}};_0x2d13a3(++_0x111b20);}(_0xa129,0x136));var _0x9a12=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa129[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x9a12('0x0'));var rimraf=require(_0x9a12('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9a12('0x2'));var rp=require(_0x9a12('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9a12('0x4'));var util=require(_0x9a12('0x5'));var path=require(_0x9a12('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9a12('0x7'));var fs=require('fs');var fs_extra=require(_0x9a12('0x8'));var _=require('lodash');var squel=require(_0x9a12('0x9'));var crypto=require('crypto');var jsforce=require(_0x9a12('0xa'));var deskjs=require(_0x9a12('0xb'));var toCsv=require(_0x9a12('0xc'));var querystring=require(_0x9a12('0xd'));var Papa=require(_0x9a12('0xe'));var Redis=require(_0x9a12('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x9a12('0x10'));var as=require(_0x9a12('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9a12('0x12'))(_0x9a12('0x13'));var utils=require(_0x9a12('0x14'));var config=require(_0x9a12('0x15'));var licenseUtil=require(_0x9a12('0x16'));var db=require(_0x9a12('0x17'))['db'];config[_0x9a12('0x18')]=_[_0x9a12('0x19')](config[_0x9a12('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x9a12('0x1a'))(new Redis(config[_0x9a12('0x18')]));require('./openchannelQueue.socket')[_0x9a12('0x1b')](socket);function respondWithStatusCode(_0x2e7ffb,_0x295142){_0x295142=_0x295142||0xcc;return function(_0x3839b5){if(_0x3839b5){return _0x2e7ffb['sendStatus'](_0x295142);}return _0x2e7ffb['status'](_0x295142)['end']();};}function respondWithResult(_0x28fd5a,_0x5c2292){_0x5c2292=_0x5c2292||0xc8;return function(_0x34c7b9){if(_0x34c7b9){return _0x28fd5a[_0x9a12('0x1c')](_0x5c2292)[_0x9a12('0x1d')](_0x34c7b9);}};}function respondWithFilteredResult(_0x4a0bbb,_0x59e296){return function(_0x2bd764){if(_0x2bd764){var _0x3c9e16=typeof _0x59e296[_0x9a12('0x1e')]==='undefined'&&typeof _0x59e296[_0x9a12('0x1f')]===_0x9a12('0x20');var _0x102255=_0x2bd764[_0x9a12('0x21')];var _0x5e1aba=_0x3c9e16?0x0:_0x59e296[_0x9a12('0x1e')];var _0x386285=_0x3c9e16?_0x2bd764[_0x9a12('0x21')]:_0x59e296[_0x9a12('0x1e')]+_0x59e296[_0x9a12('0x1f')];var _0x31273e;if(_0x386285>=_0x102255){_0x386285=_0x102255;_0x31273e=0xc8;}else{_0x31273e=0xce;}_0x4a0bbb[_0x9a12('0x1c')](_0x31273e);return _0x4a0bbb[_0x9a12('0x22')](_0x9a12('0x23'),_0x5e1aba+'-'+_0x386285+'/'+_0x102255)[_0x9a12('0x1d')](_0x2bd764);}return null;};}function patchUpdates(_0x3b8e3b){return function(_0x454387){try{jsonpatch[_0x9a12('0x24')](_0x454387,_0x3b8e3b,!![]);}catch(_0xf39560){return BPromise['reject'](_0xf39560);}return _0x454387[_0x9a12('0x25')]();};}function saveUpdates(_0x49e094,_0x2e8e7c){return function(_0x1f1f89){if(_0x1f1f89){return _0x1f1f89[_0x9a12('0x26')](_0x49e094)['then'](function(_0x5a0f33){return _0x5a0f33;});}return null;};}function removeEntity(_0x597e97,_0x470a7b){return function(_0x44781a){if(_0x44781a){return _0x44781a[_0x9a12('0x27')]()['then'](function(){var _0x1f2227=_0x44781a['get']({'plain':!![]});var _0x2fc555=_0x9a12('0x28');return db[_0x9a12('0x29')][_0x9a12('0x27')]({'where':{'type':_0x2fc555,'resourceId':_0x1f2227['id']}})[_0x9a12('0x2a')](function(){return _0x44781a;});})['then'](function(){_0x597e97[_0x9a12('0x1c')](0xcc)[_0x9a12('0x2b')]();});}};}function handleEntityNotFound(_0x3680cd,_0x2678ee){return function(_0x2da584){if(!_0x2da584){_0x3680cd[_0x9a12('0x2c')](0x194);}return _0x2da584;};}function handleError(_0x431773,_0x5859ec){_0x5859ec=_0x5859ec||0x1f4;return function(_0x38bdea){logger[_0x9a12('0x2d')](_0x38bdea[_0x9a12('0x2e')]);if(_0x38bdea[_0x9a12('0x2f')]){delete _0x38bdea[_0x9a12('0x2f')];}_0x431773[_0x9a12('0x1c')](_0x5859ec)[_0x9a12('0x30')](_0x38bdea);};}exports[_0x9a12('0x31')]=function(_0x3ec84d,_0x534580){var _0x44f877={},_0x4b978d={},_0x406727={'count':0x0,'rows':[]};var _0x279f7d=_[_0x9a12('0x32')](db[_0x9a12('0x33')][_0x9a12('0x34')],function(_0x27b14e){return{'name':_0x27b14e[_0x9a12('0x35')],'type':_0x27b14e['type'][_0x9a12('0x36')]};});_0x4b978d[_0x9a12('0x37')]=_[_0x9a12('0x32')](_0x279f7d,_0x9a12('0x2f'));_0x4b978d[_0x9a12('0x38')]=_[_0x9a12('0x39')](_0x3ec84d['query']);_0x4b978d[_0x9a12('0x3a')]=_['intersection'](_0x4b978d[_0x9a12('0x37')],_0x4b978d[_0x9a12('0x38')]);_0x44f877[_0x9a12('0x3b')]=_['intersection'](_0x4b978d[_0x9a12('0x37')],qs[_0x9a12('0x3c')](_0x3ec84d['query'][_0x9a12('0x3c')]));_0x44f877['attributes']=_0x44f877[_0x9a12('0x3b')][_0x9a12('0x3d')]?_0x44f877[_0x9a12('0x3b')]:_0x4b978d[_0x9a12('0x37')];if(!_0x3ec84d[_0x9a12('0x38')]['hasOwnProperty'](_0x9a12('0x3e'))){_0x44f877['limit']=qs[_0x9a12('0x1f')](_0x3ec84d['query']['limit']);_0x44f877[_0x9a12('0x1e')]=qs[_0x9a12('0x1e')](_0x3ec84d['query'][_0x9a12('0x1e')]);}_0x44f877[_0x9a12('0x3f')]=qs[_0x9a12('0x40')](_0x3ec84d[_0x9a12('0x38')][_0x9a12('0x40')]);_0x44f877['where']=qs[_0x9a12('0x3a')](_['pick'](_0x3ec84d[_0x9a12('0x38')],_0x4b978d[_0x9a12('0x3a')]),_0x279f7d);if(_0x3ec84d[_0x9a12('0x38')][_0x9a12('0x41')]){_0x44f877[_0x9a12('0x42')]=_[_0x9a12('0x43')](_0x44f877['where'],{'$or':_[_0x9a12('0x32')](_0x279f7d,function(_0x56803c){if(_0x56803c['type']!==_0x9a12('0x44')){var _0x527e71={};_0x527e71[_0x56803c[_0x9a12('0x2f')]]={'$like':'%'+_0x3ec84d[_0x9a12('0x38')][_0x9a12('0x41')]+'%'};return _0x527e71;}})});}_0x44f877=_[_0x9a12('0x43')]({},_0x44f877,_0x3ec84d[_0x9a12('0x45')]);var _0x1fb8d1={'where':_0x44f877[_0x9a12('0x42')]};return db[_0x9a12('0x33')][_0x9a12('0x21')](_0x1fb8d1)[_0x9a12('0x2a')](function(_0x4d40dd){_0x406727['count']=_0x4d40dd;if(_0x3ec84d['query']['includeAll']){_0x44f877[_0x9a12('0x46')]=[{'all':!![]}];}return db['OpenchannelQueue'][_0x9a12('0x47')](_0x44f877);})[_0x9a12('0x2a')](function(_0x1d4d05){_0x406727[_0x9a12('0x48')]=_0x1d4d05;return _0x406727;})[_0x9a12('0x2a')](respondWithFilteredResult(_0x534580,_0x44f877))[_0x9a12('0x49')](handleError(_0x534580,null));};exports[_0x9a12('0x4a')]=function(_0x4df50e,_0x210b4d){var _0x24664d={'raw':!![],'where':{'id':_0x4df50e[_0x9a12('0x4b')]['id']}},_0x4f5917={};_0x4f5917[_0x9a12('0x37')]=_[_0x9a12('0x39')](db[_0x9a12('0x33')]['rawAttributes']);_0x4f5917['query']=_[_0x9a12('0x39')](_0x4df50e[_0x9a12('0x38')]);_0x4f5917[_0x9a12('0x3a')]=_['intersection'](_0x4f5917[_0x9a12('0x37')],_0x4f5917['query']);_0x24664d[_0x9a12('0x3b')]=_[_0x9a12('0x4c')](_0x4f5917[_0x9a12('0x37')],qs[_0x9a12('0x3c')](_0x4df50e[_0x9a12('0x38')][_0x9a12('0x3c')]));_0x24664d[_0x9a12('0x3b')]=_0x24664d[_0x9a12('0x3b')][_0x9a12('0x3d')]?_0x24664d[_0x9a12('0x3b')]:_0x4f5917[_0x9a12('0x37')];if(_0x4df50e[_0x9a12('0x38')][_0x9a12('0x4d')]){_0x24664d[_0x9a12('0x46')]=[{'all':!![]}];}_0x24664d=_[_0x9a12('0x43')]({},_0x24664d,_0x4df50e['options']);return db[_0x9a12('0x33')][_0x9a12('0x4e')](_0x24664d)[_0x9a12('0x2a')](handleEntityNotFound(_0x210b4d,null))['then'](respondWithResult(_0x210b4d,null))[_0x9a12('0x49')](handleError(_0x210b4d,null));};exports[_0x9a12('0x4f')]=function(_0x346830,_0x4e6b0b){return db['OpenchannelQueue'][_0x9a12('0x4f')](_0x346830[_0x9a12('0x50')],{})['then'](function(_0x47d7fb){var _0xf9386=_0x346830[_0x9a12('0x51')][_0x9a12('0x52')]({'plain':!![]});if(!_0xf9386)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xf9386[_0x9a12('0x53')]===_0x9a12('0x51')){var _0x3e0f71=_0x47d7fb['get']({'plain':!![]});var _0x90e1ea='OpenchannelQueues';return db[_0x9a12('0x54')]['find']({'where':{'name':_0x90e1ea,'userProfileId':_0xf9386[_0x9a12('0x55')]},'raw':!![]})[_0x9a12('0x2a')](function(_0x2c0c0e){if(_0x2c0c0e&&_0x2c0c0e[_0x9a12('0x56')]===0x0){return db[_0x9a12('0x29')][_0x9a12('0x4f')]({'name':_0x3e0f71[_0x9a12('0x2f')],'resourceId':_0x3e0f71['id'],'type':_0x2c0c0e[_0x9a12('0x2f')],'sectionId':_0x2c0c0e['id']},{})['then'](function(){return _0x47d7fb;});}else{return _0x47d7fb;}})[_0x9a12('0x49')](function(_0x3a9be2){logger['error'](_0x9a12('0x57'),_0x3a9be2);throw _0x3a9be2;});}return _0x47d7fb;})['then'](respondWithResult(_0x4e6b0b,0xc9))[_0x9a12('0x49')](handleError(_0x4e6b0b,null));};exports['update']=function(_0x13b2a7,_0x4a4555){if(_0x13b2a7[_0x9a12('0x50')]['id']){delete _0x13b2a7['body']['id'];}return db['OpenchannelQueue']['find']({'where':{'id':_0x13b2a7[_0x9a12('0x4b')]['id']}})[_0x9a12('0x2a')](handleEntityNotFound(_0x4a4555,null))['then'](saveUpdates(_0x13b2a7['body'],null))[_0x9a12('0x2a')](respondWithResult(_0x4a4555,null))[_0x9a12('0x49')](handleError(_0x4a4555,null));};exports[_0x9a12('0x27')]=function(_0x3d88e8,_0x61d2a0){return db[_0x9a12('0x33')][_0x9a12('0x4e')]({'where':{'id':_0x3d88e8['params']['id']}})[_0x9a12('0x2a')](handleEntityNotFound(_0x61d2a0,null))[_0x9a12('0x2a')](removeEntity(_0x61d2a0,null))[_0x9a12('0x49')](handleError(_0x61d2a0,null));};exports[_0x9a12('0x58')]=function(_0x4b7145,_0x172ac3){return db[_0x9a12('0x33')][_0x9a12('0x58')]()[_0x9a12('0x2a')](respondWithResult(_0x172ac3,null))[_0x9a12('0x49')](handleError(_0x172ac3,null));};exports[_0x9a12('0x59')]=function(_0x4945f5,_0x3c31e5,_0x58df8a){var _0x30a1a4={'raw':!![],'where':{}},_0x428df7={},_0x441cbb;return db[_0x9a12('0x33')][_0x9a12('0x5a')]({'where':{'id':_0x4945f5[_0x9a12('0x4b')]['id']}})[_0x9a12('0x2a')](handleEntityNotFound(_0x3c31e5,null))[_0x9a12('0x2a')](function(_0x5f3bc5){if(_0x5f3bc5){_0x441cbb=_0x5f3bc5[_0x9a12('0x52')]({'plain':!![]});_0x428df7['model']=_[_0x9a12('0x39')](db[_0x9a12('0x5b')][_0x9a12('0x34')]);_0x428df7['query']=_['keys'](_0x4945f5[_0x9a12('0x38')]);_0x428df7[_0x9a12('0x3a')]=_[_0x9a12('0x4c')](_0x428df7[_0x9a12('0x37')],_0x428df7['query']);_0x30a1a4['attributes']=_[_0x9a12('0x4c')](_0x428df7[_0x9a12('0x37')],qs[_0x9a12('0x3c')](_0x4945f5[_0x9a12('0x38')][_0x9a12('0x3c')]));_0x30a1a4[_0x9a12('0x3b')]=_0x30a1a4['attributes']['length']?_0x30a1a4[_0x9a12('0x3b')]:_0x428df7[_0x9a12('0x37')];if(!_0x4945f5[_0x9a12('0x38')]['hasOwnProperty'](_0x9a12('0x3e'))){_0x30a1a4[_0x9a12('0x1f')]=qs[_0x9a12('0x1f')](_0x4945f5[_0x9a12('0x38')][_0x9a12('0x1f')]);_0x30a1a4['offset']=qs['offset'](_0x4945f5[_0x9a12('0x38')][_0x9a12('0x1e')]);}_0x30a1a4[_0x9a12('0x3f')]=qs[_0x9a12('0x40')](_0x4945f5[_0x9a12('0x38')][_0x9a12('0x40')]);_0x30a1a4[_0x9a12('0x42')]=qs[_0x9a12('0x3a')](_[_0x9a12('0x5c')](_0x4945f5[_0x9a12('0x38')],_0x428df7[_0x9a12('0x3a')]));_0x30a1a4[_0x9a12('0x42')][_0x9a12('0x5d')]=_0x5f3bc5['id'];if(_0x4945f5['query']['filter']){_0x30a1a4[_0x9a12('0x42')]=_[_0x9a12('0x43')](_0x30a1a4[_0x9a12('0x42')],{'$or':_[_0x9a12('0x32')](_0x30a1a4[_0x9a12('0x3b')],function(_0x30fafa){var _0x1b8512={};_0x1b8512[_0x30fafa]={'$like':'%'+_0x4945f5[_0x9a12('0x38')][_0x9a12('0x41')]+'%'};return _0x1b8512;})});}_0x30a1a4=_['merge']({},_0x30a1a4,_0x4945f5[_0x9a12('0x45')]);return db[_0x9a12('0x5b')][_0x9a12('0x47')](_0x30a1a4);}})[_0x9a12('0x2a')](function(_0x552bb4){if(_0x552bb4){return db['User'][_0x9a12('0x5e')]({'where':{'id':_[_0x9a12('0x32')](_0x552bb4,_0x9a12('0x5f')),'role':_0x9a12('0x60')},'attributes':['id',_0x9a12('0x2f'),_0x9a12('0x61'),_0x9a12('0x62'),_0x9a12('0x63')]});}})[_0x9a12('0x2a')](function(_0x1b72a1){if(_0x1b72a1){return{'count':_0x1b72a1[_0x9a12('0x21')],'rows':_[_0x9a12('0x32')](_0x1b72a1[_0x9a12('0x48')],function(_0x38820c){return{'membername':_0x38820c[_0x9a12('0x2f')],'UserId':_0x38820c['id'],'queue_name':_0x441cbb[_0x9a12('0x2f')],'OpenchannelQueueId':_0x441cbb['id'],'interface':util[_0x9a12('0x64')](_0x9a12('0x65'),_0x9a12('0x66'),_0x38820c['name']),'penalty':0x0,'paused':_0x38820c[_0x9a12('0x61')],'createdAt':_0x38820c['createdAt'],'updatedAt':_0x38820c[_0x9a12('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x3c31e5,_0x30a1a4))['catch'](handleError(_0x3c31e5,null));};exports[_0x9a12('0x67')]=function(_0x591af5,_0xdfef8f,_0x44d8d9){var _0x57b967={};var _0x4431f6={};var _0x4acbcf;var _0x297941;return db[_0x9a12('0x33')][_0x9a12('0x5a')]({'where':{'id':_0x591af5[_0x9a12('0x4b')]['id']}})[_0x9a12('0x2a')](handleEntityNotFound(_0xdfef8f,null))['then'](function(_0x2597fd){if(_0x2597fd){_0x4acbcf=_0x2597fd;_0x4431f6[_0x9a12('0x37')]=_['keys'](db[_0x9a12('0x68')][_0x9a12('0x34')]);_0x4431f6['query']=_[_0x9a12('0x39')](_0x591af5[_0x9a12('0x38')]);_0x4431f6[_0x9a12('0x3a')]=_[_0x9a12('0x4c')](_0x4431f6[_0x9a12('0x37')],_0x4431f6[_0x9a12('0x38')]);_0x57b967['attributes']=_[_0x9a12('0x4c')](_0x4431f6[_0x9a12('0x37')],qs['fields'](_0x591af5[_0x9a12('0x38')][_0x9a12('0x3c')]));_0x57b967[_0x9a12('0x3b')]=_0x57b967[_0x9a12('0x3b')][_0x9a12('0x3d')]?_0x57b967[_0x9a12('0x3b')]:_0x4431f6[_0x9a12('0x37')];_0x57b967[_0x9a12('0x3f')]=qs['sort'](_0x591af5['query'][_0x9a12('0x40')]);_0x57b967[_0x9a12('0x42')]=qs[_0x9a12('0x3a')](_[_0x9a12('0x5c')](_0x591af5[_0x9a12('0x38')],_0x4431f6[_0x9a12('0x3a')]));if(_0x591af5[_0x9a12('0x38')][_0x9a12('0x41')]){_0x57b967[_0x9a12('0x42')]=_['merge'](_0x57b967['where'],{'$or':_['map'](_0x57b967[_0x9a12('0x3b')],function(_0x1adbec){var _0x36c745={};_0x36c745[_0x1adbec]={'$like':'%'+_0x591af5[_0x9a12('0x38')][_0x9a12('0x41')]+'%'};return _0x36c745;})});}_0x57b967=_[_0x9a12('0x43')]({},_0x57b967,_0x591af5[_0x9a12('0x45')]);return _0x4acbcf[_0x9a12('0x67')](_0x57b967);}})['then'](function(_0x15d1c3){if(_0x15d1c3){_0x297941=_0x15d1c3['length'];if(!_0x591af5['query'][_0x9a12('0x69')](_0x9a12('0x3e'))){_0x57b967[_0x9a12('0x1f')]=qs[_0x9a12('0x1f')](_0x591af5['query'][_0x9a12('0x1f')]);_0x57b967['offset']=qs['offset'](_0x591af5[_0x9a12('0x38')][_0x9a12('0x1e')]);}return _0x4acbcf[_0x9a12('0x67')](_0x57b967);}})[_0x9a12('0x2a')](function(_0x1b9c9c){if(_0x1b9c9c){return _0x1b9c9c?{'count':_0x297941,'rows':_0x1b9c9c}:null;}})[_0x9a12('0x2a')](respondWithResult(_0xdfef8f,null))['catch'](handleError(_0xdfef8f,null));};exports[_0x9a12('0x6a')]=function(_0x4f6588,_0x58bb41,_0x15ba32){var _0x2709de=_0x4f6588[_0x9a12('0x50')][_0x9a12('0x6b')];return db[_0x9a12('0x68')]['findAll']({'where':{'id':_0x2709de},'attributes':['id'],'include':[{'model':db['User'],'as':_0x9a12('0x6c'),'attributes':['id',_0x9a12('0x2f'),_0x9a12('0x6d'),_0x9a12('0x6e'),_0x9a12('0x6f')],'raw':!![]}]})['then'](function(_0x48e5fd){if(_0x48e5fd){var _0x413daf=_[_0x9a12('0x70')](_0x48e5fd,function(_0x40353f){var _0x4c68cd=_0x40353f[_0x9a12('0x52')]({'plain':!![]});return _0x4c68cd['Agents'];});return db[_0x9a12('0x33')][_0x9a12('0x4e')]({'where':{'id':_0x4f6588[_0x9a12('0x4b')]['id']}})[_0x9a12('0x2a')](function(_0x2a17a7){return db['sequelize'][_0x9a12('0x71')](function(_0x13be59){return _0x2a17a7[_0x9a12('0x6a')](_0x2709de,{'transaction':_0x13be59})[_0x9a12('0x2a')](function(){return BPromise[_0x9a12('0x72')](_0x413daf,function(_0x532d15){return db[_0x9a12('0x5b')]['findOrCreate']({'where':{'UserId':_0x532d15['id'],'OpenchannelQueueId':_0x4f6588[_0x9a12('0x4b')]['id']},'transaction':_0x13be59});});})['then'](function(){_0x413daf[_0x9a12('0x73')](function(_0x112ad4){socket['emit']('userOpenchannelQueue:save',{'UserId':_0x112ad4['id'],'OpenchannelQueueId':_0x2a17a7['id']});});});});});}})['then'](respondWithStatusCode(_0x58bb41,null))[_0x9a12('0x49')](handleError(_0x58bb41,null));};exports[_0x9a12('0x74')]=function(_0x2e2398,_0x4d2f08,_0x41cfed){return db[_0x9a12('0x68')]['findAll']({'where':{'id':_0x2e2398[_0x9a12('0x38')][_0x9a12('0x6b')]},'attributes':['id'],'include':[{'model':db[_0x9a12('0x75')],'as':_0x9a12('0x6c'),'attributes':['id'],'raw':!![]}]})[_0x9a12('0x2a')](handleEntityNotFound(_0x4d2f08,null))['then'](function(_0x12b790){var _0x2072a3=_[_0x9a12('0x32')](_0x12b790,'id');var _0x417cfe=[];var _0xd73e08=[];var _0x12222f=squel[_0x9a12('0x76')]();_0x12222f['field'](_0x9a12('0x77'))[_0x9a12('0x78')](_0x9a12('0x79'),'tq')['join']('user_has_teams','ut',_0x9a12('0x7a'))['where']('OpenchannelQueueId\x20=\x20?',_0x2e2398[_0x9a12('0x4b')]['id']);for(var _0x547f03=0x0;_0x547f03<_0x12b790['length'];_0x547f03+=0x1){let _0xeb740=_0x12b790[_0x547f03];for(var _0x3fe5f8=0x0;_0x3fe5f8<_0xeb740[_0x9a12('0x6c')][_0x9a12('0x3d')];_0x3fe5f8+=0x1){let _0x4933e0=_0xeb740[_0x9a12('0x6c')][_0x3fe5f8];var _0x5254e3=_0x12222f[_0x9a12('0x7b')]();_0x5254e3[_0x9a12('0x42')](_0x9a12('0x7c'),_0x4933e0['id']);_0xd73e08[_0x9a12('0x7d')](db['sequelize']['query'](_0x5254e3[_0x9a12('0x7e')](),{'type':db[_0x9a12('0x7f')][_0x9a12('0x80')][_0x9a12('0x81')]})['then'](function(_0x4be8d7){if(_0x4be8d7[_0x9a12('0x3d')]===0x1){return _0x4933e0['id'];}else{var _0x49c7d0=_[_0x9a12('0x82')](_['map'](_0x4be8d7,'TeamId'),function(_0x1e3495){return _['includes'](_0x2072a3,_0x1e3495);});if(_0x49c7d0){return _0x4933e0['id'];}}}));}}return BPromise['all'](_0xd73e08)[_0x9a12('0x2a')](function(_0x979181){_0x417cfe=_(_0x417cfe)[_0x9a12('0x83')](_0x979181)[_0x9a12('0x84')]()[_0x9a12('0x85')]();return db[_0x9a12('0x33')][_0x9a12('0x4e')]({'where':{'id':_0x2e2398[_0x9a12('0x4b')]['id']}})[_0x9a12('0x2a')](function(_0x272cfc){return db[_0x9a12('0x7f')][_0x9a12('0x71')](function(_0x4d79a9){return _0x272cfc[_0x9a12('0x74')](_0x2e2398[_0x9a12('0x38')]['ids'],{'transaction':_0x4d79a9})[_0x9a12('0x2a')](function(){if(!_[_0x9a12('0x86')](_0x417cfe)){return _0x272cfc[_0x9a12('0x87')](_0x417cfe,{'transaction':_0x4d79a9});}})[_0x9a12('0x2a')](function(){_0x417cfe[_0x9a12('0x73')](function(_0x3ad260){socket[_0x9a12('0x88')](_0x9a12('0x89'),{'UserId':_0x3ad260,'OpenchannelQueueId':_0x272cfc['id']});});});});});});})[_0x9a12('0x2a')](respondWithStatusCode(_0x4d2f08,null))[_0x9a12('0x49')](handleError(_0x4d2f08,null));};exports[_0x9a12('0x8a')]=function(_0x48ea7e,_0x48a918,_0x6f53b4){return db[_0x9a12('0x33')]['find']({'where':{'id':_0x48ea7e[_0x9a12('0x4b')]['id']}})[_0x9a12('0x2a')](handleEntityNotFound(_0x48a918,null))[_0x9a12('0x2a')](function(_0x76a53b){if(_0x76a53b){return _0x76a53b[_0x9a12('0x8a')](_0x48ea7e[_0x9a12('0x50')][_0x9a12('0x6b')],_[_0x9a12('0x8b')](_0x48ea7e[_0x9a12('0x50')],['ids','id'])||{})[_0x9a12('0x8c')](function(_0x169ada){for(var _0x46197e=0x0;_0x46197e<_0x48ea7e['body'][_0x9a12('0x6b')][_0x9a12('0x3d')];_0x46197e+=0x1){socket[_0x9a12('0x88')]('userOpenchannelQueue:save',{'UserId':Number(_0x48ea7e['body'][_0x9a12('0x6b')][_0x46197e]),'OpenchannelQueueId':Number(_0x48ea7e[_0x9a12('0x4b')]['id'])});}return _0x169ada;});}})[_0x9a12('0x2a')](respondWithResult(_0x48a918,null))[_0x9a12('0x49')](handleError(_0x48a918,null));};exports[_0x9a12('0x87')]=function(_0x192259,_0x4e736b,_0x244e7a){return db['OpenchannelQueue'][_0x9a12('0x4e')]({'where':{'id':_0x192259[_0x9a12('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4e736b,null))[_0x9a12('0x2a')](function(_0x34ac05){if(_0x34ac05){return _0x34ac05[_0x9a12('0x87')](_0x192259[_0x9a12('0x38')]['ids'])['then'](function(){if(_[_0x9a12('0x8d')](_0x192259[_0x9a12('0x38')][_0x9a12('0x6b')])){for(var _0x643939=0x0;_0x643939<_0x192259[_0x9a12('0x38')][_0x9a12('0x6b')][_0x9a12('0x3d')];_0x643939+=0x1){socket[_0x9a12('0x88')]('userOpenchannelQueue:remove',{'UserId':Number(_0x192259['query'][_0x9a12('0x6b')][_0x643939]),'OpenchannelQueueId':Number(_0x192259[_0x9a12('0x4b')]['id'])});}}else{socket[_0x9a12('0x88')](_0x9a12('0x89'),{'UserId':Number(_0x192259[_0x9a12('0x38')]['ids']),'OpenchannelQueueId':Number(_0x192259[_0x9a12('0x4b')]['id'])});}});}})[_0x9a12('0x2a')](respondWithStatusCode(_0x4e736b,null))[_0x9a12('0x49')](handleError(_0x4e736b,null));};exports[_0x9a12('0x8e')]=function(_0x56344d,_0x47609f,_0x374fde){var _0xa362={};var _0x1e7900={};var _0x114cbd;var _0xe83d1c;return db[_0x9a12('0x33')][_0x9a12('0x5a')]({'where':{'id':_0x56344d['params']['id']}})['then'](handleEntityNotFound(_0x47609f,null))[_0x9a12('0x2a')](function(_0x413f3e){if(_0x413f3e){_0x114cbd=_0x413f3e;_0x1e7900['model']=_[_0x9a12('0x39')](db[_0x9a12('0x75')]['rawAttributes']);_0x1e7900[_0x9a12('0x38')]=_[_0x9a12('0x39')](_0x56344d['query']);_0x1e7900[_0x9a12('0x3a')]=_[_0x9a12('0x4c')](_0x1e7900['model'],_0x1e7900[_0x9a12('0x38')]);_0xa362[_0x9a12('0x3b')]=_[_0x9a12('0x4c')](_0x1e7900[_0x9a12('0x37')],qs['fields'](_0x56344d['query']['fields']));_0xa362['attributes']=_0xa362[_0x9a12('0x3b')]['length']?_0xa362['attributes']:_0x1e7900[_0x9a12('0x37')];_0xa362[_0x9a12('0x3f')]=qs[_0x9a12('0x40')](_0x56344d[_0x9a12('0x38')][_0x9a12('0x40')]);_0xa362[_0x9a12('0x42')]=qs[_0x9a12('0x3a')](_[_0x9a12('0x5c')](_0x56344d[_0x9a12('0x38')],_0x1e7900[_0x9a12('0x3a')]));if(_0x56344d['query'][_0x9a12('0x41')]){_0xa362[_0x9a12('0x42')]=_['merge'](_0xa362[_0x9a12('0x42')],{'$or':_[_0x9a12('0x32')](_0xa362[_0x9a12('0x3b')],function(_0x37de47){var _0xa009={};_0xa009[_0x37de47]={'$like':'%'+_0x56344d[_0x9a12('0x38')]['filter']+'%'};return _0xa009;})});}_0xa362=_['merge']({},_0xa362,_0x56344d[_0x9a12('0x45')]);return _0x114cbd[_0x9a12('0x8e')](_0xa362);}})[_0x9a12('0x2a')](function(_0x4eeb0c){if(_0x4eeb0c){_0xe83d1c=_0x4eeb0c[_0x9a12('0x3d')];if(!_0x56344d[_0x9a12('0x38')][_0x9a12('0x69')](_0x9a12('0x3e'))){_0xa362[_0x9a12('0x1f')]=qs[_0x9a12('0x1f')](_0x56344d['query'][_0x9a12('0x1f')]);_0xa362['offset']=qs[_0x9a12('0x1e')](_0x56344d[_0x9a12('0x38')][_0x9a12('0x1e')]);}return _0x114cbd[_0x9a12('0x8e')](_0xa362);}})[_0x9a12('0x2a')](function(_0x5b56ba){if(_0x5b56ba){return _0x5b56ba?{'count':_0xe83d1c,'rows':_0x5b56ba}:null;}})[_0x9a12('0x2a')](respondWithResult(_0x47609f,null))[_0x9a12('0x49')](handleError(_0x47609f,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 77635c2..afa86e2 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 _0x0752=['emit','hasOwnProperty','hook','exports','../../mysqldb','OpenchannelQueue','setMaxListeners','update'];(function(_0x53b77e,_0x5a9694){var _0x51c533=function(_0xc35fd){while(--_0xc35fd){_0x53b77e['push'](_0x53b77e['shift']());}};_0x51c533(++_0x5a9694);}(_0x0752,0x1b4));var _0x2075=function(_0x493344,_0x4594c6){_0x493344=_0x493344-0x0;var _0x15c957=_0x0752[_0x493344];return _0x15c957;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require(_0x2075('0x0'))['db'][_0x2075('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x2075('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2075('0x3'),'afterDestroy':'remove'};function emitEvent(_0x564196){return function(_0x384081,_0x250a56,_0x396874){OpenchannelQueueEvents[_0x2075('0x4')](_0x564196+':'+_0x384081['id'],_0x384081);OpenchannelQueueEvents[_0x2075('0x4')](_0x564196,_0x384081);_0x396874(null);};}for(var e in events){if(events[_0x2075('0x5')](e)){var event=events[e];OpenchannelQueue[_0x2075('0x6')](e,emitEvent(event));}}module[_0x2075('0x7')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x8a17=['hook','exports','events','../../mysqldb','OpenchannelQueue','setMaxListeners','save','remove','emit'];(function(_0x142756,_0x36f804){var _0x4167bd=function(_0x32826b){while(--_0x32826b){_0x142756['push'](_0x142756['shift']());}};_0x4167bd(++_0x36f804);}(_0x8a17,0x197));var _0x78a1=function(_0x5a99db,_0x1cece5){_0x5a99db=_0x5a99db-0x0;var _0x3aad62=_0x8a17[_0x5a99db];return _0x3aad62;};'use strict';var EventEmitter=require(_0x78a1('0x0'));var OpenchannelQueue=require(_0x78a1('0x1'))['db'][_0x78a1('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x78a1('0x3')](0x0);var events={'afterCreate':_0x78a1('0x4'),'afterUpdate':'update','afterDestroy':_0x78a1('0x5')};function emitEvent(_0x54c470){return function(_0x740246,_0x380394,_0x590979){OpenchannelQueueEvents[_0x78a1('0x6')](_0x54c470+':'+_0x740246['id'],_0x740246);OpenchannelQueueEvents[_0x78a1('0x6')](_0x54c470,_0x740246);_0x590979(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0x78a1('0x7')](e,emitEvent(event));}}module[_0x78a1('0x8')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 7925e91..64133d1 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 _0x8a26=['rimraf','../../config/environment','./openchannelQueue.attributes','define','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x2fb356,_0x567092){var _0x27fb4b=function(_0x11c996){while(--_0x11c996){_0x2fb356['push'](_0x2fb356['shift']());}};_0x27fb4b(++_0x567092);}(_0x8a26,0x17a));var _0x68a2=function(_0x359669,_0x48b75c){_0x359669=_0x359669-0x0;var _0x4e032c=_0x8a26[_0x359669];return _0x4e032c;};'use strict';var _=require(_0x68a2('0x0'));var util=require(_0x68a2('0x1'));var logger=require(_0x68a2('0x2'))(_0x68a2('0x3'));var moment=require(_0x68a2('0x4'));var BPromise=require(_0x68a2('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x68a2('0x6'));var rimraf=require(_0x68a2('0x7'));var config=require(_0x68a2('0x8'));var attributes=require(_0x68a2('0x9'));module['exports']=function(_0x414a6d,_0x3b5b6a){return _0x414a6d[_0x68a2('0xa')]('OpenchannelQueue',attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa0f9=['path','../../config/environment','exports','define','OpenchannelQueue','lodash','util','../../config/logger','api'];(function(_0x1bb58c,_0x2c8a4d){var _0x277586=function(_0x11fd4c){while(--_0x11fd4c){_0x1bb58c['push'](_0x1bb58c['shift']());}};_0x277586(++_0x2c8a4d);}(_0xa0f9,0x1f4));var _0x9a0f=function(_0xcda377,_0x1e2678){_0xcda377=_0xcda377-0x0;var _0x1c024f=_0xa0f9[_0xcda377];return _0x1c024f;};'use strict';var _=require(_0x9a0f('0x0'));var util=require(_0x9a0f('0x1'));var logger=require(_0x9a0f('0x2'))(_0x9a0f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9a0f('0x4'));var rimraf=require('rimraf');var config=require(_0x9a0f('0x5'));var attributes=require('./openchannelQueue.attributes');module[_0x9a0f('0x6')]=function(_0x1139bb,_0x3068bc){return _0x1139bb[_0x9a0f('0x7')](_0x9a0f('0x8'),attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index d0de860..8f07ce7 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 _0xb08b=['request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','where','limit','include','map','model','attributes','ShowOpenchannelQueue','find','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','redis','defaults','socket.io-emitter','./openchannelQueue.socket','register'];(function(_0x7acd9c,_0x4ebb68){var _0x4af9d8=function(_0x1e05de){while(--_0x1e05de){_0x7acd9c['push'](_0x7acd9c['shift']());}};_0x4af9d8(++_0x4ebb68);}(_0xb08b,0x1c6));var _0xbb08=function(_0x534c87,_0xcc83cb){_0x534c87=_0x534c87-0x0;var _0x467a74=_0xb08b[_0x534c87];return _0x467a74;};'use strict';var _=require(_0xbb08('0x0'));var util=require('util');var moment=require(_0xbb08('0x1'));var BPromise=require(_0xbb08('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbb08('0x3'));var db=require(_0xbb08('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xbb08('0x5'))(_0xbb08('0x6'));var config=require(_0xbb08('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbb08('0x8')]({'port':0x232a});config[_0xbb08('0x9')]=_[_0xbb08('0xa')](config[_0xbb08('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xbb08('0xb'))(new Redis(config[_0xbb08('0x9')]));require(_0xbb08('0xc'))[_0xbb08('0xd')](socket);function respondWithRpcPromise(_0x4af592,_0x36f63f,_0x39dc13){return new BPromise(function(_0x5370f1,_0x228faf){return client[_0xbb08('0xe')](_0x4af592,_0x39dc13)[_0xbb08('0xf')](function(_0x275f40){logger[_0xbb08('0x10')](_0xbb08('0x11'),_0x36f63f,_0xbb08('0x12'));logger[_0xbb08('0x13')]('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x36f63f,'request\x20sent',JSON[_0xbb08('0x14')](_0x275f40));if(_0x275f40[_0xbb08('0x15')]){if(_0x275f40['error'][_0xbb08('0x16')]===0x1f4){logger['error'](_0xbb08('0x11'),_0x36f63f,_0x275f40[_0xbb08('0x15')][_0xbb08('0x17')]);return _0x228faf(_0x275f40[_0xbb08('0x15')][_0xbb08('0x17')]);}logger[_0xbb08('0x15')](_0xbb08('0x11'),_0x36f63f,_0x275f40[_0xbb08('0x15')][_0xbb08('0x17')]);return _0x5370f1(_0x275f40['error'][_0xbb08('0x17')]);}else{logger[_0xbb08('0x10')]('OpenchannelQueue,\x20%s,\x20%s',_0x36f63f,_0xbb08('0x12'));_0x5370f1(_0x275f40[_0xbb08('0x18')]['message']);}})[_0xbb08('0x19')](function(_0x3a261d){logger[_0xbb08('0x15')](_0xbb08('0x11'),_0x36f63f,_0x3a261d);_0x228faf(_0x3a261d);});});}exports[_0xbb08('0x1a')]=function(_0x4e36a0){var _0x2bad09=this;return new Promise(function(_0x123fe5,_0x1501f8){return db[_0xbb08('0x1b')][_0xbb08('0x1c')]({'raw':_0x4e36a0[_0xbb08('0x1d')]?_0x4e36a0[_0xbb08('0x1d')][_0xbb08('0x1e')]===undefined?!![]:![]:!![],'where':_0x4e36a0[_0xbb08('0x1d')]?_0x4e36a0[_0xbb08('0x1d')][_0xbb08('0x1f')]||null:null,'attributes':_0x4e36a0['options']?_0x4e36a0[_0xbb08('0x1d')]['attributes']||null:null,'limit':_0x4e36a0[_0xbb08('0x1d')]?_0x4e36a0[_0xbb08('0x1d')][_0xbb08('0x20')]||null:null,'include':_0x4e36a0[_0xbb08('0x1d')]?_0x4e36a0[_0xbb08('0x1d')][_0xbb08('0x21')]?_[_0xbb08('0x22')](_0x4e36a0[_0xbb08('0x1d')]['include'],function(_0x360b80){return{'model':db[_0x360b80[_0xbb08('0x23')]],'as':_0x360b80['as'],'attributes':_0x360b80[_0xbb08('0x24')],'include':_0x360b80[_0xbb08('0x21')]?_[_0xbb08('0x22')](_0x360b80[_0xbb08('0x21')],function(_0x3a7396){return{'model':db[_0x3a7396['model']],'as':_0x3a7396['as'],'attributes':_0x3a7396['attributes'],'include':_0x3a7396[_0xbb08('0x21')]?_[_0xbb08('0x22')](_0x3a7396[_0xbb08('0x21')],function(_0x53e72e){return{'model':db[_0x53e72e[_0xbb08('0x23')]],'as':_0x53e72e['as'],'attributes':_0x53e72e[_0xbb08('0x24')]};}):[]};}):[]};}):[]:[]})[_0xbb08('0xf')](function(_0x8d53c4){logger['info'](_0xbb08('0x1a'),_0x4e36a0);logger[_0xbb08('0x13')](_0xbb08('0x1a'),_0x4e36a0,JSON['stringify'](_0x8d53c4));_0x123fe5(_0x8d53c4);})[_0xbb08('0x19')](function(_0x4ed8ea){logger['error'](_0xbb08('0x1a'),_0x4ed8ea[_0xbb08('0x17')],_0x4e36a0);_0x1501f8(_0x2bad09['error'](0x1f4,_0x4ed8ea[_0xbb08('0x17')]));});});};exports[_0xbb08('0x25')]=function(_0x53698e){var _0x5c2568=this;return new Promise(function(_0x2ecfac,_0x37a97d){return db[_0xbb08('0x1b')][_0xbb08('0x26')]({'raw':_0x53698e[_0xbb08('0x1d')]?_0x53698e[_0xbb08('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x53698e['options']?_0x53698e['options'][_0xbb08('0x1f')]||null:null,'attributes':_0x53698e['options']?_0x53698e[_0xbb08('0x1d')][_0xbb08('0x24')]||null:null,'include':_0x53698e['options']?_0x53698e[_0xbb08('0x1d')][_0xbb08('0x21')]?_[_0xbb08('0x22')](_0x53698e[_0xbb08('0x1d')][_0xbb08('0x21')],function(_0x4001c6){return{'model':db[_0x4001c6[_0xbb08('0x23')]],'as':_0x4001c6['as'],'attributes':_0x4001c6[_0xbb08('0x24')],'include':_0x4001c6['include']?_[_0xbb08('0x22')](_0x4001c6[_0xbb08('0x21')],function(_0x25d177){return{'model':db[_0x25d177[_0xbb08('0x23')]],'as':_0x25d177['as'],'attributes':_0x25d177[_0xbb08('0x24')],'include':_0x25d177[_0xbb08('0x21')]?_[_0xbb08('0x22')](_0x25d177[_0xbb08('0x21')],function(_0x3d3137){return{'model':db[_0x3d3137[_0xbb08('0x23')]],'as':_0x3d3137['as'],'attributes':_0x3d3137['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x58e612){logger['info'](_0xbb08('0x25'),_0x53698e);logger[_0xbb08('0x13')](_0xbb08('0x25'),_0x53698e,JSON[_0xbb08('0x14')](_0x58e612));_0x2ecfac(_0x58e612);})[_0xbb08('0x19')](function(_0x1194c7){logger[_0xbb08('0x15')](_0xbb08('0x25'),_0x1194c7['message'],_0x53698e);_0x37a97d(_0x5c2568[_0xbb08('0x15')](0x1f4,_0x1194c7[_0xbb08('0x17')]));});});}; \ No newline at end of file +var _0xec96=['lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','request','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','attributes','limit','include','map','then','ShowOpenchannelQueue','find','model','debug'];(function(_0x14ed26,_0x268a89){var _0x2cfe12=function(_0x1560b7){while(--_0x1560b7){_0x14ed26['push'](_0x14ed26['shift']());}};_0x2cfe12(++_0x268a89);}(_0xec96,0xa0));var _0x6ec9=function(_0x2094d5,_0x2f987c){_0x2094d5=_0x2094d5-0x0;var _0x396a73=_0xec96[_0x2094d5];return _0x396a73;};'use strict';var _=require(_0x6ec9('0x0'));var util=require(_0x6ec9('0x1'));var moment=require(_0x6ec9('0x2'));var BPromise=require('bluebird');var rs=require(_0x6ec9('0x3'));var fs=require('fs');var Redis=require(_0x6ec9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6ec9('0x5'));var logger=require('../../config/logger')(_0x6ec9('0x6'));var config=require(_0x6ec9('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6ec9('0x8')][_0x6ec9('0x9')]({'port':0x232a});config[_0x6ec9('0xa')]=_[_0x6ec9('0xb')](config[_0x6ec9('0xa')],{'host':_0x6ec9('0xc'),'port':0x18eb});var socket=require(_0x6ec9('0xd'))(new Redis(config[_0x6ec9('0xa')]));require('./openchannelQueue.socket')[_0x6ec9('0xe')](socket);function respondWithRpcPromise(_0x5e4279,_0x36d8c3,_0xb83b58){return new BPromise(function(_0x5ee448,_0x451f9d){return client[_0x6ec9('0xf')](_0x5e4279,_0xb83b58)['then'](function(_0x394eee){logger[_0x6ec9('0x10')](_0x6ec9('0x11'),_0x36d8c3,_0x6ec9('0x12'));logger['debug'](_0x6ec9('0x13'),_0x36d8c3,_0x6ec9('0x12'),JSON[_0x6ec9('0x14')](_0x394eee));if(_0x394eee[_0x6ec9('0x15')]){if(_0x394eee[_0x6ec9('0x15')][_0x6ec9('0x16')]===0x1f4){logger[_0x6ec9('0x15')]('OpenchannelQueue,\x20%s,\x20%s',_0x36d8c3,_0x394eee[_0x6ec9('0x15')]['message']);return _0x451f9d(_0x394eee[_0x6ec9('0x15')][_0x6ec9('0x17')]);}logger['error'](_0x6ec9('0x11'),_0x36d8c3,_0x394eee[_0x6ec9('0x15')]['message']);return _0x5ee448(_0x394eee['error'][_0x6ec9('0x17')]);}else{logger[_0x6ec9('0x10')]('OpenchannelQueue,\x20%s,\x20%s',_0x36d8c3,_0x6ec9('0x12'));_0x5ee448(_0x394eee[_0x6ec9('0x18')][_0x6ec9('0x17')]);}})[_0x6ec9('0x19')](function(_0x561942){logger[_0x6ec9('0x15')]('OpenchannelQueue,\x20%s,\x20%s',_0x36d8c3,_0x561942);_0x451f9d(_0x561942);});});}exports[_0x6ec9('0x1a')]=function(_0x3a9d28){var _0x55613a=this;return new Promise(function(_0x5da6d6,_0x5f3631){return db[_0x6ec9('0x1b')][_0x6ec9('0x1c')]({'raw':_0x3a9d28['options']?_0x3a9d28[_0x6ec9('0x1d')][_0x6ec9('0x1e')]===undefined?!![]:![]:!![],'where':_0x3a9d28['options']?_0x3a9d28['options']['where']||null:null,'attributes':_0x3a9d28[_0x6ec9('0x1d')]?_0x3a9d28[_0x6ec9('0x1d')][_0x6ec9('0x1f')]||null:null,'limit':_0x3a9d28[_0x6ec9('0x1d')]?_0x3a9d28[_0x6ec9('0x1d')][_0x6ec9('0x20')]||null:null,'include':_0x3a9d28['options']?_0x3a9d28[_0x6ec9('0x1d')][_0x6ec9('0x21')]?_[_0x6ec9('0x22')](_0x3a9d28[_0x6ec9('0x1d')][_0x6ec9('0x21')],function(_0x391fc6){return{'model':db[_0x391fc6['model']],'as':_0x391fc6['as'],'attributes':_0x391fc6[_0x6ec9('0x1f')],'include':_0x391fc6[_0x6ec9('0x21')]?_['map'](_0x391fc6[_0x6ec9('0x21')],function(_0x24334b){return{'model':db[_0x24334b['model']],'as':_0x24334b['as'],'attributes':_0x24334b['attributes'],'include':_0x24334b[_0x6ec9('0x21')]?_[_0x6ec9('0x22')](_0x24334b[_0x6ec9('0x21')],function(_0x190caa){return{'model':db[_0x190caa['model']],'as':_0x190caa['as'],'attributes':_0x190caa[_0x6ec9('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x6ec9('0x23')](function(_0x3143cd){logger[_0x6ec9('0x10')](_0x6ec9('0x1a'),_0x3a9d28);logger['debug'](_0x6ec9('0x1a'),_0x3a9d28,JSON['stringify'](_0x3143cd));_0x5da6d6(_0x3143cd);})[_0x6ec9('0x19')](function(_0x5dc746){logger['error'](_0x6ec9('0x1a'),_0x5dc746['message'],_0x3a9d28);_0x5f3631(_0x55613a[_0x6ec9('0x15')](0x1f4,_0x5dc746[_0x6ec9('0x17')]));});});};exports[_0x6ec9('0x24')]=function(_0x4546af){var _0x3ec28f=this;return new Promise(function(_0x2835e2,_0xb6dab5){return db[_0x6ec9('0x1b')][_0x6ec9('0x25')]({'raw':_0x4546af[_0x6ec9('0x1d')]?_0x4546af[_0x6ec9('0x1d')][_0x6ec9('0x1e')]===undefined?!![]:![]:!![],'where':_0x4546af[_0x6ec9('0x1d')]?_0x4546af[_0x6ec9('0x1d')]['where']||null:null,'attributes':_0x4546af[_0x6ec9('0x1d')]?_0x4546af[_0x6ec9('0x1d')][_0x6ec9('0x1f')]||null:null,'include':_0x4546af[_0x6ec9('0x1d')]?_0x4546af[_0x6ec9('0x1d')][_0x6ec9('0x21')]?_[_0x6ec9('0x22')](_0x4546af[_0x6ec9('0x1d')][_0x6ec9('0x21')],function(_0x58e247){return{'model':db[_0x58e247[_0x6ec9('0x26')]],'as':_0x58e247['as'],'attributes':_0x58e247[_0x6ec9('0x1f')],'include':_0x58e247['include']?_['map'](_0x58e247[_0x6ec9('0x21')],function(_0x578703){return{'model':db[_0x578703[_0x6ec9('0x26')]],'as':_0x578703['as'],'attributes':_0x578703[_0x6ec9('0x1f')],'include':_0x578703[_0x6ec9('0x21')]?_[_0x6ec9('0x22')](_0x578703[_0x6ec9('0x21')],function(_0x7112d6){return{'model':db[_0x7112d6['model']],'as':_0x7112d6['as'],'attributes':_0x7112d6[_0x6ec9('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x6ec9('0x23')](function(_0xf976d7){logger[_0x6ec9('0x10')](_0x6ec9('0x24'),_0x4546af);logger[_0x6ec9('0x27')](_0x6ec9('0x24'),_0x4546af,JSON[_0x6ec9('0x14')](_0xf976d7));_0x2835e2(_0xf976d7);})['catch'](function(_0x3e752e){logger[_0x6ec9('0x15')](_0x6ec9('0x24'),_0x3e752e[_0x6ec9('0x17')],_0x4546af);_0xb6dab5(_0x3ec28f[_0x6ec9('0x15')](0x1f4,_0x3e752e[_0x6ec9('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 11958bc..9c6a338 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 _0x5769=['length','openchannelQueue:','save','remove','update','emit','removeListener','register'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5769,0x172));var _0x9576=function(_0x220036,_0xa2b3c0){_0x220036=_0x220036-0x0;var _0x31cfce=_0x5769[_0x220036];return _0x31cfce;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=[_0x9576('0x0'),_0x9576('0x1'),_0x9576('0x2')];function createListener(_0x3518ba,_0x1b15bf){return function(_0x4d8d52){_0x1b15bf[_0x9576('0x3')](_0x3518ba,_0x4d8d52);};}function removeListener(_0x22d615,_0x3d02c3){return function(){OpenchannelQueueEvents[_0x9576('0x4')](_0x22d615,_0x3d02c3);};}exports[_0x9576('0x5')]=function(_0xeb7462){for(var _0x5f5b7c=0x0,_0x34752d=events[_0x9576('0x6')];_0x5f5b7c<_0x34752d;_0x5f5b7c++){var _0x14c21b=events[_0x5f5b7c];var _0x32d0bc=createListener(_0x9576('0x7')+_0x14c21b,_0xeb7462);OpenchannelQueueEvents['on'](_0x14c21b,_0x32d0bc);}}; \ No newline at end of file +var _0x56bf=['removeListener','register','update','emit'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x56bf,0x8e));var _0xf56b=function(_0x36b037,_0x2b234e){_0x36b037=_0x36b037-0x0;var _0x409194=_0x56bf[_0x36b037];return _0x409194;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=['save','remove',_0xf56b('0x0')];function createListener(_0x14d2e7,_0x5b3729){return function(_0x25c2aa){_0x5b3729[_0xf56b('0x1')](_0x14d2e7,_0x25c2aa);};}function removeListener(_0x5ee46b,_0xcc9723){return function(){OpenchannelQueueEvents[_0xf56b('0x2')](_0x5ee46b,_0xcc9723);};}exports[_0xf56b('0x3')]=function(_0xca4399){for(var _0x13cb11=0x0,_0x5dd920=events['length'];_0x13cb11<_0x5dd920;_0x13cb11++){var _0x3e8bf7=events[_0x13cb11];var _0x2ccc03=createListener('openchannelQueue:'+_0x3e8bf7,_0xca4399);OpenchannelQueueEvents['on'](_0x3e8bf7,_0x2ccc03);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 23f46a3..9395cab 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 _0x53af=['destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete'];(function(_0x3cd61f,_0x410b2f){var _0x366ae5=function(_0x1e2565){while(--_0x1e2565){_0x3cd61f['push'](_0x3cd61f['shift']());}};_0x366ae5(++_0x410b2f);}(_0x53af,0x9c));var _0xf53a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x53af[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xf53a('0x0'));var util=require(_0xf53a('0x1'));var path=require(_0xf53a('0x2'));var timeout=require(_0xf53a('0x3'));var express=require(_0xf53a('0x4'));var router=express['Router']();var fs_extra=require(_0xf53a('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf53a('0x6'));var controller=require(_0xf53a('0x7'));router[_0xf53a('0x8')]('/',auth[_0xf53a('0x9')](),controller[_0xf53a('0xa')]);router[_0xf53a('0x8')](_0xf53a('0xb'),auth['isAuthenticated'](),controller[_0xf53a('0xc')]);router[_0xf53a('0x8')](_0xf53a('0xd'),auth[_0xf53a('0x9')](),controller[_0xf53a('0xe')]);router[_0xf53a('0xf')]('/',auth[_0xf53a('0x9')](),controller[_0xf53a('0x10')]);router[_0xf53a('0x11')](_0xf53a('0xd'),auth[_0xf53a('0x9')](),controller[_0xf53a('0x12')]);router[_0xf53a('0x13')](_0xf53a('0xd'),auth[_0xf53a('0x9')](),controller[_0xf53a('0x14')]);module[_0xf53a('0x15')]=router; \ No newline at end of file +var _0xfec9=['delete','destroy','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','post','create','put','update'];(function(_0x2bfd47,_0x519460){var _0x2d72e7=function(_0x2a62dd){while(--_0x2a62dd){_0x2bfd47['push'](_0x2bfd47['shift']());}};_0x2d72e7(++_0x519460);}(_0xfec9,0x133));var _0x9fec=function(_0x19409d,_0xf48905){_0x19409d=_0x19409d-0x0;var _0x5de146=_0xfec9[_0x19409d];return _0x5de146;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9fec('0x0'));var timeout=require('connect-timeout');var express=require(_0x9fec('0x1'));var router=express[_0x9fec('0x2')]();var fs_extra=require(_0x9fec('0x3'));var auth=require(_0x9fec('0x4'));var interaction=require(_0x9fec('0x5'));var config=require('../../config/environment');var controller=require(_0x9fec('0x6'));router[_0x9fec('0x7')]('/',auth[_0x9fec('0x8')](),controller['index']);router[_0x9fec('0x7')](_0x9fec('0x9'),auth[_0x9fec('0x8')](),controller[_0x9fec('0xa')]);router[_0x9fec('0x7')](_0x9fec('0xb'),auth[_0x9fec('0x8')](),controller['show']);router[_0x9fec('0xc')]('/',auth['isAuthenticated'](),controller[_0x9fec('0xd')]);router[_0x9fec('0xe')](_0x9fec('0xb'),auth['isAuthenticated'](),controller[_0x9fec('0xf')]);router[_0x9fec('0x10')](_0x9fec('0xb'),auth[_0x9fec('0x8')](),controller[_0x9fec('0x11')]);module[_0x9fec('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 d1b7d26..ed1d13d 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 _0x2265=['DATE','moment','sequelize','exports','STRING'];(function(_0x158b8d,_0x1d054d){var _0x3a9015=function(_0x45c1b8){while(--_0x45c1b8){_0x158b8d['push'](_0x158b8d['shift']());}};_0x3a9015(++_0x1d054d);}(_0x2265,0x114));var _0x5226=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0x2265[_0x9cd4c3];return _0x4c9025;};'use strict';var moment=require(_0x5226('0x0'));var Sequelize=require(_0x5226('0x1'));module[_0x5226('0x2')]={'uniqueid':{'type':Sequelize[_0x5226('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x5226('0x3')]},'joinAt':{'type':Sequelize[_0x5226('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x5226('0x4')]},'exitAt':{'type':Sequelize[_0x5226('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5dca=['DATE','sequelize','exports','STRING'];(function(_0x1d5e0e,_0x40f9eb){var _0x1acedc=function(_0x4ce818){while(--_0x4ce818){_0x1d5e0e['push'](_0x1d5e0e['shift']());}};_0x1acedc(++_0x40f9eb);}(_0x5dca,0x17d));var _0xa5dc=function(_0x39931c,_0x34b8f2){_0x39931c=_0x39931c-0x0;var _0x3f0c8d=_0x5dca[_0x39931c];return _0x3f0c8d;};'use strict';var moment=require('moment');var Sequelize=require(_0xa5dc('0x0'));module[_0xa5dc('0x1')]={'uniqueid':{'type':Sequelize[_0xa5dc('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xa5dc('0x2')]},'joinAt':{'type':Sequelize[_0xa5dc('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xa5dc('0x3')]},'exitAt':{'type':Sequelize[_0xa5dc('0x3')]},'reason':{'type':Sequelize[_0xa5dc('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 3d4fd2c..9a8fa27 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 _0x86b4=['crypto','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','undefined','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','map','OpenchannelQueueReport','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','keys','include','find','create','body','update','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash'];(function(_0x328b9b,_0x13082a){var _0x3a2d51=function(_0x63002b){while(--_0x63002b){_0x328b9b['push'](_0x328b9b['shift']());}};_0x3a2d51(++_0x13082a);}(_0x86b4,0x179));var _0x486b=function(_0x2dc8ea,_0x5794ab){_0x2dc8ea=_0x2dc8ea-0x0;var _0x9f6a3a=_0x86b4[_0x2dc8ea];return _0x9f6a3a;};'use strict';var emlformat=require(_0x486b('0x0'));var rimraf=require(_0x486b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x486b('0x2'));var rp=require(_0x486b('0x3'));var moment=require(_0x486b('0x4'));var BPromise=require(_0x486b('0x5'));var Mustache=require(_0x486b('0x6'));var util=require(_0x486b('0x7'));var path=require(_0x486b('0x8'));var sox=require('sox');var csv=require(_0x486b('0x9'));var ejs=require(_0x486b('0xa'));var fs=require('fs');var fs_extra=require(_0x486b('0xb'));var _=require(_0x486b('0xc'));var squel=require('squel');var crypto=require(_0x486b('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x486b('0x9'));var querystring=require('querystring');var Papa=require(_0x486b('0xe'));var Redis=require(_0x486b('0xf'));var authService=require(_0x486b('0x10'));var qs=require(_0x486b('0x11'));var as=require(_0x486b('0x12'));var hardwareService=require(_0x486b('0x13'));var logger=require(_0x486b('0x14'))('api');var utils=require(_0x486b('0x15'));var config=require(_0x486b('0x16'));var licenseUtil=require(_0x486b('0x17'));var db=require(_0x486b('0x18'))['db'];function respondWithStatusCode(_0xefa84a,_0x16eca5){_0x16eca5=_0x16eca5||0xcc;return function(_0x42dcbc){if(_0x42dcbc){return _0xefa84a[_0x486b('0x19')](_0x16eca5);}return _0xefa84a[_0x486b('0x1a')](_0x16eca5)[_0x486b('0x1b')]();};}function respondWithResult(_0x522813,_0x4a841e){_0x4a841e=_0x4a841e||0xc8;return function(_0x4d0f01){if(_0x4d0f01){return _0x522813[_0x486b('0x1a')](_0x4a841e)[_0x486b('0x1c')](_0x4d0f01);}};}function respondWithFilteredResult(_0x3e646c,_0x5dc019){return function(_0x1ab26e){if(_0x1ab26e){var _0x4e6302=typeof _0x5dc019['offset']===_0x486b('0x1d')&&typeof _0x5dc019['limit']===_0x486b('0x1d');var _0x2a9c94=_0x1ab26e[_0x486b('0x1e')];var _0x167867=_0x4e6302?0x0:_0x5dc019[_0x486b('0x1f')];var _0x4403ac=_0x4e6302?_0x1ab26e[_0x486b('0x1e')]:_0x5dc019[_0x486b('0x1f')]+_0x5dc019[_0x486b('0x20')];var _0x386107;if(_0x4403ac>=_0x2a9c94){_0x4403ac=_0x2a9c94;_0x386107=0xc8;}else{_0x386107=0xce;}_0x3e646c[_0x486b('0x1a')](_0x386107);return _0x3e646c[_0x486b('0x21')](_0x486b('0x22'),_0x167867+'-'+_0x4403ac+'/'+_0x2a9c94)[_0x486b('0x1c')](_0x1ab26e);}return null;};}function patchUpdates(_0x363074){return function(_0x5b6099){try{jsonpatch[_0x486b('0x23')](_0x5b6099,_0x363074,!![]);}catch(_0x3f0f4d){return BPromise[_0x486b('0x24')](_0x3f0f4d);}return _0x5b6099[_0x486b('0x25')]();};}function saveUpdates(_0x36c3fd,_0x2d2853){return function(_0x7495cb){if(_0x7495cb){return _0x7495cb['update'](_0x36c3fd)[_0x486b('0x26')](function(_0x3dadc8){return _0x3dadc8;});}return null;};}function removeEntity(_0x46e981,_0x13f33c){return function(_0x2bdd6c){if(_0x2bdd6c){return _0x2bdd6c[_0x486b('0x27')]()['then'](function(){_0x46e981[_0x486b('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x491363,_0x46cd96){return function(_0x1d928b){if(!_0x1d928b){_0x491363[_0x486b('0x19')](0x194);}return _0x1d928b;};}function handleError(_0x53a2dd,_0x42e872){_0x42e872=_0x42e872||0x1f4;return function(_0x3681cf){logger['error'](_0x3681cf[_0x486b('0x28')]);if(_0x3681cf[_0x486b('0x29')]){delete _0x3681cf[_0x486b('0x29')];}_0x53a2dd['status'](_0x42e872)[_0x486b('0x2a')](_0x3681cf);};}exports[_0x486b('0x2b')]=function(_0x41953c,_0x37ea5a){var _0xafe884={},_0x28631d={},_0x4f132e={'count':0x0,'rows':[]};var _0x5c10fa=_[_0x486b('0x2c')](db[_0x486b('0x2d')][_0x486b('0x2e')],function(_0x5551bc){return{'name':_0x5551bc[_0x486b('0x2f')],'type':_0x5551bc['type'][_0x486b('0x30')]};});_0x28631d[_0x486b('0x31')]=_['map'](_0x5c10fa,'name');_0x28631d[_0x486b('0x32')]=_['keys'](_0x41953c[_0x486b('0x32')]);_0x28631d[_0x486b('0x33')]=_[_0x486b('0x34')](_0x28631d[_0x486b('0x31')],_0x28631d[_0x486b('0x32')]);_0xafe884['attributes']=_[_0x486b('0x34')](_0x28631d[_0x486b('0x31')],qs[_0x486b('0x35')](_0x41953c[_0x486b('0x32')][_0x486b('0x35')]));_0xafe884['attributes']=_0xafe884[_0x486b('0x36')][_0x486b('0x37')]?_0xafe884[_0x486b('0x36')]:_0x28631d[_0x486b('0x31')];if(!_0x41953c[_0x486b('0x32')]['hasOwnProperty'](_0x486b('0x38'))){_0xafe884[_0x486b('0x20')]=qs[_0x486b('0x20')](_0x41953c[_0x486b('0x32')][_0x486b('0x20')]);_0xafe884[_0x486b('0x1f')]=qs[_0x486b('0x1f')](_0x41953c[_0x486b('0x32')]['offset']);}_0xafe884[_0x486b('0x39')]=qs[_0x486b('0x3a')](_0x41953c[_0x486b('0x32')][_0x486b('0x3a')]);_0xafe884[_0x486b('0x3b')]=qs[_0x486b('0x33')](_[_0x486b('0x3c')](_0x41953c[_0x486b('0x32')],_0x28631d[_0x486b('0x33')]),_0x5c10fa);if(_0x41953c[_0x486b('0x32')][_0x486b('0x3d')]){_0xafe884[_0x486b('0x3b')]=_[_0x486b('0x3e')](_0xafe884[_0x486b('0x3b')],{'$or':_[_0x486b('0x2c')](_0x5c10fa,function(_0x428612){if(_0x428612['type']!==_0x486b('0x3f')){var _0x43f7b1={};_0x43f7b1[_0x428612[_0x486b('0x29')]]={'$like':'%'+_0x41953c[_0x486b('0x32')]['filter']+'%'};return _0x43f7b1;}})});}_0xafe884=_['merge']({},_0xafe884,_0x41953c[_0x486b('0x40')]);var _0x11697e={'where':_0xafe884[_0x486b('0x3b')]};return db[_0x486b('0x2d')][_0x486b('0x1e')](_0x11697e)['then'](function(_0x531d9b){_0x4f132e[_0x486b('0x1e')]=_0x531d9b;if(_0x41953c['query'][_0x486b('0x41')]){_0xafe884['include']=[{'all':!![]}];}return db[_0x486b('0x2d')][_0x486b('0x42')](_0xafe884);})[_0x486b('0x26')](function(_0x47a8f1){_0x4f132e[_0x486b('0x43')]=_0x47a8f1;return _0x4f132e;})['then'](respondWithFilteredResult(_0x37ea5a,_0xafe884))[_0x486b('0x44')](handleError(_0x37ea5a,null));};exports[_0x486b('0x45')]=function(_0x4a1fa3,_0x478631){var _0x18c884={'raw':!![],'where':{'id':_0x4a1fa3['params']['id']}},_0x4b226a={};_0x4b226a[_0x486b('0x31')]=_[_0x486b('0x46')](db[_0x486b('0x2d')][_0x486b('0x2e')]);_0x4b226a['query']=_[_0x486b('0x46')](_0x4a1fa3[_0x486b('0x32')]);_0x4b226a[_0x486b('0x33')]=_[_0x486b('0x34')](_0x4b226a[_0x486b('0x31')],_0x4b226a['query']);_0x18c884[_0x486b('0x36')]=_[_0x486b('0x34')](_0x4b226a[_0x486b('0x31')],qs[_0x486b('0x35')](_0x4a1fa3['query'][_0x486b('0x35')]));_0x18c884['attributes']=_0x18c884['attributes'][_0x486b('0x37')]?_0x18c884['attributes']:_0x4b226a[_0x486b('0x31')];if(_0x4a1fa3['query'][_0x486b('0x41')]){_0x18c884[_0x486b('0x47')]=[{'all':!![]}];}_0x18c884=_[_0x486b('0x3e')]({},_0x18c884,_0x4a1fa3[_0x486b('0x40')]);return db[_0x486b('0x2d')][_0x486b('0x48')](_0x18c884)[_0x486b('0x26')](handleEntityNotFound(_0x478631,null))['then'](respondWithResult(_0x478631,null))[_0x486b('0x44')](handleError(_0x478631,null));};exports['create']=function(_0x1026ec,_0x45a970){return db[_0x486b('0x2d')][_0x486b('0x49')](_0x1026ec[_0x486b('0x4a')],{})[_0x486b('0x26')](respondWithResult(_0x45a970,0xc9))[_0x486b('0x44')](handleError(_0x45a970,null));};exports[_0x486b('0x4b')]=function(_0x1f4b1e,_0x2b2ad4){if(_0x1f4b1e[_0x486b('0x4a')]['id']){delete _0x1f4b1e[_0x486b('0x4a')]['id'];}return db[_0x486b('0x2d')][_0x486b('0x48')]({'where':{'id':_0x1f4b1e[_0x486b('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2b2ad4,null))[_0x486b('0x26')](saveUpdates(_0x1f4b1e[_0x486b('0x4a')],null))[_0x486b('0x26')](respondWithResult(_0x2b2ad4,null))[_0x486b('0x44')](handleError(_0x2b2ad4,null));};exports['destroy']=function(_0x2049e8,_0x9343ac){return db['OpenchannelQueueReport'][_0x486b('0x48')]({'where':{'id':_0x2049e8[_0x486b('0x4c')]['id']}})[_0x486b('0x26')](handleEntityNotFound(_0x9343ac,null))[_0x486b('0x26')](removeEntity(_0x9343ac,null))[_0x486b('0x44')](handleError(_0x9343ac,null));};exports[_0x486b('0x4d')]=function(_0x3bf4f3,_0x45a49f){return db['OpenchannelQueueReport'][_0x486b('0x4d')]()[_0x486b('0x26')](respondWithResult(_0x45a49f,null))[_0x486b('0x44')](handleError(_0x45a49f,null));}; \ No newline at end of file +var _0x5175=['find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','save','update','then','destroy','error','name','send','index','map','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','OpenchannelQueueReport','includeAll','include','findAll','catch','show','params','keys'];(function(_0x384fbc,_0x11696f){var _0x2b7827=function(_0x33ee67){while(--_0x33ee67){_0x384fbc['push'](_0x384fbc['shift']());}};_0x2b7827(++_0x11696f);}(_0x5175,0x16c));var _0x5517=function(_0x4cc45c,_0x32de7f){_0x4cc45c=_0x4cc45c-0x0;var _0x375b70=_0x5175[_0x4cc45c];return _0x375b70;};'use strict';var emlformat=require(_0x5517('0x0'));var rimraf=require(_0x5517('0x1'));var zipdir=require(_0x5517('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5517('0x3'));var moment=require(_0x5517('0x4'));var BPromise=require(_0x5517('0x5'));var Mustache=require(_0x5517('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x5517('0x7'));var ejs=require(_0x5517('0x8'));var fs=require('fs');var fs_extra=require(_0x5517('0x9'));var _=require(_0x5517('0xa'));var squel=require('squel');var crypto=require(_0x5517('0xb'));var jsforce=require(_0x5517('0xc'));var deskjs=require(_0x5517('0xd'));var toCsv=require(_0x5517('0x7'));var querystring=require(_0x5517('0xe'));var Papa=require(_0x5517('0xf'));var Redis=require(_0x5517('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x5517('0x11'));var as=require(_0x5517('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5517('0x13'))(_0x5517('0x14'));var utils=require(_0x5517('0x15'));var config=require(_0x5517('0x16'));var licenseUtil=require(_0x5517('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x15db0a,_0x5e97da){_0x5e97da=_0x5e97da||0xcc;return function(_0x5ed9cb){if(_0x5ed9cb){return _0x15db0a[_0x5517('0x18')](_0x5e97da);}return _0x15db0a[_0x5517('0x19')](_0x5e97da)[_0x5517('0x1a')]();};}function respondWithResult(_0x59a626,_0x40957e){_0x40957e=_0x40957e||0xc8;return function(_0x4bfe99){if(_0x4bfe99){return _0x59a626[_0x5517('0x19')](_0x40957e)[_0x5517('0x1b')](_0x4bfe99);}};}function respondWithFilteredResult(_0x468274,_0x4a1d53){return function(_0x2e3e5d){if(_0x2e3e5d){var _0x4a7635=typeof _0x4a1d53['offset']===_0x5517('0x1c')&&typeof _0x4a1d53[_0x5517('0x1d')]===_0x5517('0x1c');var _0x40617e=_0x2e3e5d[_0x5517('0x1e')];var _0x5eb310=_0x4a7635?0x0:_0x4a1d53['offset'];var _0x27c774=_0x4a7635?_0x2e3e5d[_0x5517('0x1e')]:_0x4a1d53[_0x5517('0x1f')]+_0x4a1d53['limit'];var _0x5b0c74;if(_0x27c774>=_0x40617e){_0x27c774=_0x40617e;_0x5b0c74=0xc8;}else{_0x5b0c74=0xce;}_0x468274[_0x5517('0x19')](_0x5b0c74);return _0x468274[_0x5517('0x20')]('Content-Range',_0x5eb310+'-'+_0x27c774+'/'+_0x40617e)[_0x5517('0x1b')](_0x2e3e5d);}return null;};}function patchUpdates(_0x14458e){return function(_0x1554c5){try{jsonpatch[_0x5517('0x21')](_0x1554c5,_0x14458e,!![]);}catch(_0x443529){return BPromise['reject'](_0x443529);}return _0x1554c5[_0x5517('0x22')]();};}function saveUpdates(_0x15067b,_0x1c4219){return function(_0x7bc547){if(_0x7bc547){return _0x7bc547[_0x5517('0x23')](_0x15067b)[_0x5517('0x24')](function(_0x2a401d){return _0x2a401d;});}return null;};}function removeEntity(_0x4764a5,_0x53828b){return function(_0x2085ed){if(_0x2085ed){return _0x2085ed[_0x5517('0x25')]()[_0x5517('0x24')](function(){_0x4764a5['status'](0xcc)[_0x5517('0x1a')]();});}};}function handleEntityNotFound(_0x54aed1,_0x55d112){return function(_0x38a175){if(!_0x38a175){_0x54aed1[_0x5517('0x18')](0x194);}return _0x38a175;};}function handleError(_0xb8c4d8,_0x3f67ad){_0x3f67ad=_0x3f67ad||0x1f4;return function(_0xeaac38){logger[_0x5517('0x26')](_0xeaac38['stack']);if(_0xeaac38['name']){delete _0xeaac38[_0x5517('0x27')];}_0xb8c4d8[_0x5517('0x19')](_0x3f67ad)[_0x5517('0x28')](_0xeaac38);};}exports[_0x5517('0x29')]=function(_0x3689aa,_0xac9901){var _0x40560d={},_0x479699={},_0x2c1211={'count':0x0,'rows':[]};var _0x43f850=_[_0x5517('0x2a')](db['OpenchannelQueueReport']['rawAttributes'],function(_0x48f164){return{'name':_0x48f164['fieldName'],'type':_0x48f164[_0x5517('0x2b')][_0x5517('0x2c')]};});_0x479699[_0x5517('0x2d')]=_[_0x5517('0x2a')](_0x43f850,_0x5517('0x27'));_0x479699[_0x5517('0x2e')]=_['keys'](_0x3689aa[_0x5517('0x2e')]);_0x479699['filters']=_['intersection'](_0x479699[_0x5517('0x2d')],_0x479699[_0x5517('0x2e')]);_0x40560d[_0x5517('0x2f')]=_[_0x5517('0x30')](_0x479699[_0x5517('0x2d')],qs[_0x5517('0x31')](_0x3689aa[_0x5517('0x2e')][_0x5517('0x31')]));_0x40560d['attributes']=_0x40560d[_0x5517('0x2f')][_0x5517('0x32')]?_0x40560d[_0x5517('0x2f')]:_0x479699[_0x5517('0x2d')];if(!_0x3689aa[_0x5517('0x2e')][_0x5517('0x33')]('nolimit')){_0x40560d['limit']=qs[_0x5517('0x1d')](_0x3689aa[_0x5517('0x2e')][_0x5517('0x1d')]);_0x40560d['offset']=qs[_0x5517('0x1f')](_0x3689aa['query'][_0x5517('0x1f')]);}_0x40560d[_0x5517('0x34')]=qs[_0x5517('0x35')](_0x3689aa[_0x5517('0x2e')][_0x5517('0x35')]);_0x40560d[_0x5517('0x36')]=qs[_0x5517('0x37')](_[_0x5517('0x38')](_0x3689aa[_0x5517('0x2e')],_0x479699[_0x5517('0x37')]),_0x43f850);if(_0x3689aa[_0x5517('0x2e')][_0x5517('0x39')]){_0x40560d[_0x5517('0x36')]=_[_0x5517('0x3a')](_0x40560d['where'],{'$or':_[_0x5517('0x2a')](_0x43f850,function(_0x453f36){if(_0x453f36[_0x5517('0x2b')]!==_0x5517('0x3b')){var _0x48dac4={};_0x48dac4[_0x453f36[_0x5517('0x27')]]={'$like':'%'+_0x3689aa[_0x5517('0x2e')]['filter']+'%'};return _0x48dac4;}})});}_0x40560d=_[_0x5517('0x3a')]({},_0x40560d,_0x3689aa['options']);var _0x9fc4a7={'where':_0x40560d['where']};return db[_0x5517('0x3c')][_0x5517('0x1e')](_0x9fc4a7)[_0x5517('0x24')](function(_0x4273bd){_0x2c1211['count']=_0x4273bd;if(_0x3689aa[_0x5517('0x2e')][_0x5517('0x3d')]){_0x40560d[_0x5517('0x3e')]=[{'all':!![]}];}return db[_0x5517('0x3c')][_0x5517('0x3f')](_0x40560d);})[_0x5517('0x24')](function(_0x4ebb8f){_0x2c1211['rows']=_0x4ebb8f;return _0x2c1211;})['then'](respondWithFilteredResult(_0xac9901,_0x40560d))[_0x5517('0x40')](handleError(_0xac9901,null));};exports[_0x5517('0x41')]=function(_0x25e310,_0x48961c){var _0x3028b6={'raw':!![],'where':{'id':_0x25e310[_0x5517('0x42')]['id']}},_0xc3aa9={};_0xc3aa9[_0x5517('0x2d')]=_[_0x5517('0x43')](db[_0x5517('0x3c')]['rawAttributes']);_0xc3aa9[_0x5517('0x2e')]=_[_0x5517('0x43')](_0x25e310[_0x5517('0x2e')]);_0xc3aa9[_0x5517('0x37')]=_[_0x5517('0x30')](_0xc3aa9[_0x5517('0x2d')],_0xc3aa9[_0x5517('0x2e')]);_0x3028b6['attributes']=_['intersection'](_0xc3aa9['model'],qs[_0x5517('0x31')](_0x25e310['query']['fields']));_0x3028b6[_0x5517('0x2f')]=_0x3028b6[_0x5517('0x2f')][_0x5517('0x32')]?_0x3028b6[_0x5517('0x2f')]:_0xc3aa9[_0x5517('0x2d')];if(_0x25e310[_0x5517('0x2e')][_0x5517('0x3d')]){_0x3028b6[_0x5517('0x3e')]=[{'all':!![]}];}_0x3028b6=_[_0x5517('0x3a')]({},_0x3028b6,_0x25e310['options']);return db['OpenchannelQueueReport'][_0x5517('0x44')](_0x3028b6)[_0x5517('0x24')](handleEntityNotFound(_0x48961c,null))[_0x5517('0x24')](respondWithResult(_0x48961c,null))[_0x5517('0x40')](handleError(_0x48961c,null));};exports[_0x5517('0x45')]=function(_0x19d0c5,_0x15f5ad){return db['OpenchannelQueueReport']['create'](_0x19d0c5['body'],{})[_0x5517('0x24')](respondWithResult(_0x15f5ad,0xc9))['catch'](handleError(_0x15f5ad,null));};exports[_0x5517('0x23')]=function(_0x2c60ab,_0x14bac7){if(_0x2c60ab['body']['id']){delete _0x2c60ab[_0x5517('0x46')]['id'];}return db[_0x5517('0x3c')][_0x5517('0x44')]({'where':{'id':_0x2c60ab['params']['id']}})[_0x5517('0x24')](handleEntityNotFound(_0x14bac7,null))['then'](saveUpdates(_0x2c60ab[_0x5517('0x46')],null))[_0x5517('0x24')](respondWithResult(_0x14bac7,null))[_0x5517('0x40')](handleError(_0x14bac7,null));};exports['destroy']=function(_0x350162,_0x50c7e5){return db['OpenchannelQueueReport'][_0x5517('0x44')]({'where':{'id':_0x350162['params']['id']}})[_0x5517('0x24')](handleEntityNotFound(_0x50c7e5,null))[_0x5517('0x24')](removeEntity(_0x50c7e5,null))[_0x5517('0x40')](handleError(_0x50c7e5,null));};exports[_0x5517('0x47')]=function(_0x25cc94,_0x51d120){return db[_0x5517('0x3c')][_0x5517('0x47')]()['then'](respondWithResult(_0x51d120,null))[_0x5517('0x40')](handleError(_0x51d120,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 0535b48..50c1fc8 100644 --- a/server/api/openchannelQueueReport/openchannelQueueReport.model.js +++ b/server/api/openchannelQueueReport/openchannelQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['bluebird','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','lodash','util','../../config/logger','api','moment'];(function(_0x189261,_0x29f3c8){var _0x361fd2=function(_0x41734d){while(--_0x41734d){_0x189261['push'](_0x189261['shift']());}};_0x361fd2(++_0x29f3c8);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xc4aa[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5fc3=['util','api','moment','bluebird','request-promise','path','../../config/environment','./openchannelQueueReport.attributes','exports','define','report_openchannel_queue','uniqueid','lodash'];(function(_0x380f49,_0x3747c8){var _0x4b5b64=function(_0x14fca8){while(--_0x14fca8){_0x380f49['push'](_0x380f49['shift']());}};_0x4b5b64(++_0x3747c8);}(_0x5fc3,0xa8));var _0x35fc=function(_0x3e6b2f,_0x1ffa07){_0x3e6b2f=_0x3e6b2f-0x0;var _0x323215=_0x5fc3[_0x3e6b2f];return _0x323215;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var logger=require('../../config/logger')(_0x35fc('0x2'));var moment=require(_0x35fc('0x3'));var BPromise=require(_0x35fc('0x4'));var rp=require(_0x35fc('0x5'));var fs=require('fs');var path=require(_0x35fc('0x6'));var rimraf=require('rimraf');var config=require(_0x35fc('0x7'));var attributes=require(_0x35fc('0x8'));module[_0x35fc('0x9')]=function(_0x5b85ad,_0x5754be){return _0x5b85ad[_0x35fc('0xa')]('OpenchannelQueueReport',attributes,{'tableName':_0x35fc('0xb'),'paranoid':![],'indexes':[{'name':_0x35fc('0xc'),'fields':[_0x35fc('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index a065c95..a8d0e6f 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 _0x58a4=['request','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateOpenchannelQueueReport','body','options','raw','OpenchannelQueueReport','update','where','attributes','limit','UpdateOpenchannelQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x506d53,_0x4f2080){var _0x18de67=function(_0x2cbfe7){while(--_0x2cbfe7){_0x506d53['push'](_0x506d53['shift']());}};_0x18de67(++_0x4f2080);}(_0x58a4,0xbf));var _0x458a=function(_0x5e9b23,_0x3069fd){_0x5e9b23=_0x5e9b23-0x0;var _0x27501f=_0x58a4[_0x5e9b23];return _0x27501f;};'use strict';var _=require(_0x458a('0x0'));var util=require(_0x458a('0x1'));var moment=require(_0x458a('0x2'));var BPromise=require(_0x458a('0x3'));var rs=require(_0x458a('0x4'));var fs=require('fs');var Redis=require(_0x458a('0x5'));var db=require(_0x458a('0x6'))['db'];var utils=require(_0x458a('0x7'));var logger=require(_0x458a('0x8'))(_0x458a('0x9'));var config=require(_0x458a('0xa'));var jayson=require(_0x458a('0xb'));var client=jayson[_0x458a('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5358c2,_0x30b095,_0x11fcaa){return new BPromise(function(_0x2029bc,_0x1e658e){return client[_0x458a('0xd')](_0x5358c2,_0x11fcaa)['then'](function(_0x4bedce){logger[_0x458a('0xe')](_0x458a('0xf'),_0x30b095,_0x458a('0x10'));logger[_0x458a('0x11')](_0x458a('0x12'),_0x30b095,'request\x20sent',JSON[_0x458a('0x13')](_0x4bedce));if(_0x4bedce[_0x458a('0x14')]){if(_0x4bedce['error'][_0x458a('0x15')]===0x1f4){logger[_0x458a('0x14')](_0x458a('0xf'),_0x30b095,_0x4bedce[_0x458a('0x14')][_0x458a('0x16')]);return _0x1e658e(_0x4bedce['error']['message']);}logger[_0x458a('0x14')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x30b095,_0x4bedce[_0x458a('0x14')][_0x458a('0x16')]);return _0x2029bc(_0x4bedce[_0x458a('0x14')][_0x458a('0x16')]);}else{logger[_0x458a('0xe')](_0x458a('0xf'),_0x30b095,'request\x20sent');_0x2029bc(_0x4bedce['result']['message']);}})[_0x458a('0x17')](function(_0x3fd6d4){logger[_0x458a('0x14')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x30b095,_0x3fd6d4);_0x1e658e(_0x3fd6d4);});});}exports[_0x458a('0x18')]=function(_0x260c87){var _0x18504d=this;return new Promise(function(_0x392986,_0xa91473){return db['OpenchannelQueueReport']['create'](_0x260c87[_0x458a('0x19')],{'raw':_0x260c87['options']?_0x260c87[_0x458a('0x1a')][_0x458a('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x468416){logger['info'](_0x458a('0x18'),_0x260c87);logger[_0x458a('0x11')]('CreateOpenchannelQueueReport',_0x260c87,JSON[_0x458a('0x13')](_0x468416));_0x392986(_0x468416);})[_0x458a('0x17')](function(_0x5a2bcb){logger[_0x458a('0x14')]('CreateOpenchannelQueueReport',_0x5a2bcb[_0x458a('0x16')],_0x260c87);_0xa91473(_0x18504d['error'](0x1f4,_0x5a2bcb[_0x458a('0x16')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0x36b08e){var _0x911eaf=this;return new Promise(function(_0xcb0756,_0xcda8cc){return db[_0x458a('0x1c')][_0x458a('0x1d')](_0x36b08e[_0x458a('0x19')],{'raw':_0x36b08e[_0x458a('0x1a')]?_0x36b08e[_0x458a('0x1a')][_0x458a('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x36b08e[_0x458a('0x1a')]?_0x36b08e[_0x458a('0x1a')][_0x458a('0x1e')]||null:null,'attributes':_0x36b08e['options']?_0x36b08e[_0x458a('0x1a')][_0x458a('0x1f')]||null:null,'limit':_0x36b08e['options']?_0x36b08e['options'][_0x458a('0x20')]||null:null})['then'](function(_0x33c5d8){logger[_0x458a('0xe')](_0x458a('0x21'),_0x36b08e);logger['debug'](_0x458a('0x21'),_0x36b08e,JSON[_0x458a('0x13')](_0x33c5d8));_0xcb0756(_0x33c5d8);})[_0x458a('0x17')](function(_0x562c36){logger['error'](_0x458a('0x21'),_0x562c36['message'],_0x36b08e);_0xcda8cc(_0x911eaf[_0x458a('0x14')](0x1f4,_0x562c36['message']));});});}; \ No newline at end of file +var _0x77e6=['OpenchannelQueueReport,\x20%s,\x20%s','message','result','catch','OpenchannelQueueReport','create','options','raw','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','update','body','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','info','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x328d70,_0x4aca97){var _0x49cb48=function(_0x2ff0a3){while(--_0x2ff0a3){_0x328d70['push'](_0x328d70['shift']());}};_0x49cb48(++_0x4aca97);}(_0x77e6,0x1a6));var _0x677e=function(_0x5e6aed,_0x500548){_0x5e6aed=_0x5e6aed-0x0;var _0x519cd3=_0x77e6[_0x5e6aed];return _0x519cd3;};'use strict';var _=require(_0x677e('0x0'));var util=require(_0x677e('0x1'));var moment=require(_0x677e('0x2'));var BPromise=require(_0x677e('0x3'));var rs=require(_0x677e('0x4'));var fs=require('fs');var Redis=require(_0x677e('0x5'));var db=require(_0x677e('0x6'))['db'];var utils=require(_0x677e('0x7'));var logger=require('../../config/logger')(_0x677e('0x8'));var config=require(_0x677e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x677e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x40d314,_0x4d1a57,_0x5a5dd3){return new BPromise(function(_0x2eb40c,_0x4c519f){return client[_0x677e('0xb')](_0x40d314,_0x5a5dd3)[_0x677e('0xc')](function(_0x552931){logger[_0x677e('0xd')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x4d1a57,_0x677e('0xe'));logger[_0x677e('0xf')](_0x677e('0x10'),_0x4d1a57,_0x677e('0xe'),JSON[_0x677e('0x11')](_0x552931));if(_0x552931[_0x677e('0x12')]){if(_0x552931[_0x677e('0x12')][_0x677e('0x13')]===0x1f4){logger[_0x677e('0x12')](_0x677e('0x14'),_0x4d1a57,_0x552931[_0x677e('0x12')][_0x677e('0x15')]);return _0x4c519f(_0x552931[_0x677e('0x12')][_0x677e('0x15')]);}logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x4d1a57,_0x552931['error'][_0x677e('0x15')]);return _0x2eb40c(_0x552931[_0x677e('0x12')][_0x677e('0x15')]);}else{logger[_0x677e('0xd')](_0x677e('0x14'),_0x4d1a57,_0x677e('0xe'));_0x2eb40c(_0x552931[_0x677e('0x16')][_0x677e('0x15')]);}})[_0x677e('0x17')](function(_0x32d306){logger[_0x677e('0x12')](_0x677e('0x14'),_0x4d1a57,_0x32d306);_0x4c519f(_0x32d306);});});}exports['CreateOpenchannelQueueReport']=function(_0x1c5124){var _0x2ef2bf=this;return new Promise(function(_0x385b06,_0x221b6d){return db[_0x677e('0x18')][_0x677e('0x19')](_0x1c5124['body'],{'raw':_0x1c5124[_0x677e('0x1a')]?_0x1c5124['options'][_0x677e('0x1b')]===undefined?!![]:![]:!![]})[_0x677e('0xc')](function(_0x26e9c5){logger['info'](_0x677e('0x1c'),_0x1c5124);logger[_0x677e('0xf')](_0x677e('0x1c'),_0x1c5124,JSON[_0x677e('0x11')](_0x26e9c5));_0x385b06(_0x26e9c5);})[_0x677e('0x17')](function(_0x8732e0){logger[_0x677e('0x12')]('CreateOpenchannelQueueReport',_0x8732e0['message'],_0x1c5124);_0x221b6d(_0x2ef2bf['error'](0x1f4,_0x8732e0[_0x677e('0x15')]));});});};exports[_0x677e('0x1d')]=function(_0x31a1e4){var _0x540d0e=this;return new Promise(function(_0x424e5d,_0x2cda81){return db[_0x677e('0x18')][_0x677e('0x1e')](_0x31a1e4[_0x677e('0x1f')],{'raw':_0x31a1e4[_0x677e('0x1a')]?_0x31a1e4['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x31a1e4[_0x677e('0x1a')]?_0x31a1e4[_0x677e('0x1a')]['where']||null:null,'attributes':_0x31a1e4[_0x677e('0x1a')]?_0x31a1e4[_0x677e('0x1a')][_0x677e('0x20')]||null:null,'limit':_0x31a1e4[_0x677e('0x1a')]?_0x31a1e4[_0x677e('0x1a')][_0x677e('0x21')]||null:null})['then'](function(_0xcd4646){logger[_0x677e('0xd')](_0x677e('0x1d'),_0x31a1e4);logger[_0x677e('0xf')](_0x677e('0x1d'),_0x31a1e4,JSON[_0x677e('0x11')](_0xcd4646));_0x424e5d(_0xcd4646);})[_0x677e('0x17')](function(_0x10eb66){logger[_0x677e('0x12')]('UpdateOpenchannelQueueReport',_0x10eb66[_0x677e('0x15')],_0x31a1e4);_0x2cda81(_0x540d0e[_0x677e('0x12')](0x1f4,_0x10eb66[_0x677e('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index d3d7113..e1c9b5a 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 _0x5068=['/describe','describe','get','/:id','show','put','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','isAuthenticated','index'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x5068,0x16e));var _0x8506=function(_0x3410a7,_0x2f1a0e){_0x3410a7=_0x3410a7-0x0;var _0x4caea9=_0x5068[_0x3410a7];return _0x4caea9;};'use strict';var multer=require('multer');var util=require(_0x8506('0x0'));var path=require(_0x8506('0x1'));var timeout=require(_0x8506('0x2'));var express=require(_0x8506('0x3'));var router=express[_0x8506('0x4')]();var fs_extra=require(_0x8506('0x5'));var auth=require(_0x8506('0x6'));var interaction=require(_0x8506('0x7'));var config=require(_0x8506('0x8'));var controller=require(_0x8506('0x9'));router['get']('/',auth[_0x8506('0xa')](),controller[_0x8506('0xb')]);router['get'](_0x8506('0xc'),auth[_0x8506('0xa')](),controller[_0x8506('0xd')]);router[_0x8506('0xe')](_0x8506('0xf'),auth[_0x8506('0xa')](),controller[_0x8506('0x10')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x8506('0x11')](_0x8506('0xf'),auth[_0x8506('0xa')](),controller[_0x8506('0x12')]);router[_0x8506('0x13')]('/:id',auth[_0x8506('0xa')](),controller['destroy']);module[_0x8506('0x14')]=router; \ No newline at end of file +var _0x010c=['isAuthenticated','index','/describe','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get'];(function(_0x23cfbe,_0x3dd38c){var _0x289935=function(_0x2954a4){while(--_0x2954a4){_0x23cfbe['push'](_0x23cfbe['shift']());}};_0x289935(++_0x3dd38c);}(_0x010c,0x165));var _0xc010=function(_0x51bbe4,_0x35248a){_0x51bbe4=_0x51bbe4-0x0;var _0x567751=_0x010c[_0x51bbe4];return _0x567751;};'use strict';var multer=require('multer');var util=require(_0xc010('0x0'));var path=require(_0xc010('0x1'));var timeout=require(_0xc010('0x2'));var express=require(_0xc010('0x3'));var router=express[_0xc010('0x4')]();var fs_extra=require(_0xc010('0x5'));var auth=require(_0xc010('0x6'));var interaction=require(_0xc010('0x7'));var config=require(_0xc010('0x8'));var controller=require(_0xc010('0x9'));router[_0xc010('0xa')]('/',auth[_0xc010('0xb')](),controller[_0xc010('0xc')]);router[_0xc010('0xa')](_0xc010('0xd'),auth[_0xc010('0xb')](),controller['describe']);router[_0xc010('0xa')](_0xc010('0xe'),auth[_0xc010('0xb')](),controller[_0xc010('0xf')]);router[_0xc010('0x10')]('/',auth[_0xc010('0xb')](),controller[_0xc010('0x11')]);router[_0xc010('0x12')]('/:id',auth[_0xc010('0xb')](),controller[_0xc010('0x13')]);router[_0xc010('0x14')](_0xc010('0xe'),auth[_0xc010('0xb')](),controller[_0xc010('0x15')]);module[_0xc010('0x16')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 5529545..1289e3f 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(_0x35d120,_0x2ca28c){var _0x69e008=function(_0x182896){while(--_0x182896){_0x35d120['push'](_0x35d120['shift']());}};_0x69e008(++_0x2ca28c);}(_0x34e8,0x12c));var _0x834e=function(_0x1c1a53,_0x242d70){_0x1c1a53=_0x1c1a53-0x0;var _0x5ba2ae=_0x34e8[_0x1c1a53];return _0x5ba2ae;};'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 _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x199627,_0x3ac12e){var _0x513a5f=function(_0x55fc0d){while(--_0x55fc0d){_0x199627['push'](_0x199627['shift']());}};_0x513a5f(++_0x3ac12e);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x457b64,_0x49a219){_0x457b64=_0x457b64-0x0;var _0x437111=_0xcb91[_0x457b64];return _0x437111;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1cb9('0x0')]={'uniqueid':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1cb9('0x2')](_0x1cb9('0x3'),'agent',_0x1cb9('0x4')),'allowNull':![],'defaultValue':_0x1cb9('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x1cb9('0x5')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 0067819..c3c2fac 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 _0x2d26=['reject','save','update','then','destroy','error','stack','name','send','index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','rows','catch','show','params','includeAll','include','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply'];(function(_0x3b61d2,_0x433430){var _0x76759b=function(_0xc34969){while(--_0xc34969){_0x3b61d2['push'](_0x3b61d2['shift']());}};_0x76759b(++_0x433430);}(_0x2d26,0x119));var _0x62d2=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x2d26[_0x5c351c];return _0x26f3b3;};'use strict';var emlformat=require(_0x62d2('0x0'));var rimraf=require(_0x62d2('0x1'));var zipdir=require(_0x62d2('0x2'));var jsonpatch=require(_0x62d2('0x3'));var rp=require(_0x62d2('0x4'));var moment=require(_0x62d2('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x62d2('0x6'));var util=require(_0x62d2('0x7'));var path=require(_0x62d2('0x8'));var sox=require(_0x62d2('0x9'));var csv=require(_0x62d2('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x62d2('0xb'));var _=require(_0x62d2('0xc'));var squel=require(_0x62d2('0xd'));var crypto=require(_0x62d2('0xe'));var jsforce=require(_0x62d2('0xf'));var deskjs=require(_0x62d2('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x62d2('0x11'));var Redis=require(_0x62d2('0x12'));var authService=require(_0x62d2('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x62d2('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x62d2('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x62d2('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x62d2('0x17'))['db'];function respondWithStatusCode(_0x234891,_0x2b83cd){_0x2b83cd=_0x2b83cd||0xcc;return function(_0x111073){if(_0x111073){return _0x234891[_0x62d2('0x18')](_0x2b83cd);}return _0x234891[_0x62d2('0x19')](_0x2b83cd)[_0x62d2('0x1a')]();};}function respondWithResult(_0x116e0e,_0x18dc98){_0x18dc98=_0x18dc98||0xc8;return function(_0x5c3243){if(_0x5c3243){return _0x116e0e[_0x62d2('0x19')](_0x18dc98)['json'](_0x5c3243);}};}function respondWithFilteredResult(_0x1b3639,_0x3ff888){return function(_0x10334e){if(_0x10334e){var _0x2c352e=typeof _0x3ff888[_0x62d2('0x1b')]==='undefined'&&typeof _0x3ff888[_0x62d2('0x1c')]===_0x62d2('0x1d');var _0x278a6c=_0x10334e[_0x62d2('0x1e')];var _0x2f410c=_0x2c352e?0x0:_0x3ff888[_0x62d2('0x1b')];var _0x3eb96a=_0x2c352e?_0x10334e['count']:_0x3ff888[_0x62d2('0x1b')]+_0x3ff888[_0x62d2('0x1c')];var _0x154590;if(_0x3eb96a>=_0x278a6c){_0x3eb96a=_0x278a6c;_0x154590=0xc8;}else{_0x154590=0xce;}_0x1b3639[_0x62d2('0x19')](_0x154590);return _0x1b3639[_0x62d2('0x1f')](_0x62d2('0x20'),_0x2f410c+'-'+_0x3eb96a+'/'+_0x278a6c)[_0x62d2('0x21')](_0x10334e);}return null;};}function patchUpdates(_0x48baeb){return function(_0x5ae349){try{jsonpatch[_0x62d2('0x22')](_0x5ae349,_0x48baeb,!![]);}catch(_0x105b56){return BPromise[_0x62d2('0x23')](_0x105b56);}return _0x5ae349[_0x62d2('0x24')]();};}function saveUpdates(_0x48a6bc,_0x41c94f){return function(_0x2b2908){if(_0x2b2908){return _0x2b2908[_0x62d2('0x25')](_0x48a6bc)[_0x62d2('0x26')](function(_0x385c57){return _0x385c57;});}return null;};}function removeEntity(_0x41fc03,_0x52a8f0){return function(_0x11d907){if(_0x11d907){return _0x11d907[_0x62d2('0x27')]()[_0x62d2('0x26')](function(){_0x41fc03['status'](0xcc)[_0x62d2('0x1a')]();});}};}function handleEntityNotFound(_0x283d60,_0x1d7ad4){return function(_0x22ae56){if(!_0x22ae56){_0x283d60['sendStatus'](0x194);}return _0x22ae56;};}function handleError(_0x1a7104,_0x2947dd){_0x2947dd=_0x2947dd||0x1f4;return function(_0x482466){logger[_0x62d2('0x28')](_0x482466[_0x62d2('0x29')]);if(_0x482466[_0x62d2('0x2a')]){delete _0x482466['name'];}_0x1a7104['status'](_0x2947dd)[_0x62d2('0x2b')](_0x482466);};}exports[_0x62d2('0x2c')]=function(_0x3e2573,_0xe9ba20){var _0x531053={},_0x23ee5e={},_0x40ff72={'count':0x0,'rows':[]};var _0x5903f3=_[_0x62d2('0x2d')](db[_0x62d2('0x2e')][_0x62d2('0x2f')],function(_0x19f753){return{'name':_0x19f753[_0x62d2('0x30')],'type':_0x19f753[_0x62d2('0x31')][_0x62d2('0x32')]};});_0x23ee5e[_0x62d2('0x33')]=_[_0x62d2('0x2d')](_0x5903f3,_0x62d2('0x2a'));_0x23ee5e['query']=_[_0x62d2('0x34')](_0x3e2573[_0x62d2('0x35')]);_0x23ee5e[_0x62d2('0x36')]=_['intersection'](_0x23ee5e[_0x62d2('0x33')],_0x23ee5e['query']);_0x531053[_0x62d2('0x37')]=_[_0x62d2('0x38')](_0x23ee5e[_0x62d2('0x33')],qs[_0x62d2('0x39')](_0x3e2573[_0x62d2('0x35')][_0x62d2('0x39')]));_0x531053['attributes']=_0x531053[_0x62d2('0x37')][_0x62d2('0x3a')]?_0x531053[_0x62d2('0x37')]:_0x23ee5e[_0x62d2('0x33')];if(!_0x3e2573[_0x62d2('0x35')][_0x62d2('0x3b')](_0x62d2('0x3c'))){_0x531053['limit']=qs[_0x62d2('0x1c')](_0x3e2573[_0x62d2('0x35')]['limit']);_0x531053[_0x62d2('0x1b')]=qs[_0x62d2('0x1b')](_0x3e2573[_0x62d2('0x35')][_0x62d2('0x1b')]);}_0x531053[_0x62d2('0x3d')]=qs[_0x62d2('0x3e')](_0x3e2573['query'][_0x62d2('0x3e')]);_0x531053[_0x62d2('0x3f')]=qs['filters'](_[_0x62d2('0x40')](_0x3e2573[_0x62d2('0x35')],_0x23ee5e[_0x62d2('0x36')]),_0x5903f3);if(_0x3e2573['query'][_0x62d2('0x41')]){_0x531053[_0x62d2('0x3f')]=_['merge'](_0x531053[_0x62d2('0x3f')],{'$or':_[_0x62d2('0x2d')](_0x5903f3,function(_0x50c29b){if(_0x50c29b['type']!==_0x62d2('0x42')){var _0x25d588={};_0x25d588[_0x50c29b[_0x62d2('0x2a')]]={'$like':'%'+_0x3e2573[_0x62d2('0x35')][_0x62d2('0x41')]+'%'};return _0x25d588;}})});}_0x531053=_[_0x62d2('0x43')]({},_0x531053,_0x3e2573['options']);var _0x125f2b={'where':_0x531053[_0x62d2('0x3f')]};return db[_0x62d2('0x2e')][_0x62d2('0x1e')](_0x125f2b)[_0x62d2('0x26')](function(_0x2c8846){_0x40ff72[_0x62d2('0x1e')]=_0x2c8846;if(_0x3e2573['query']['includeAll']){_0x531053['include']=[{'all':!![]}];}return db[_0x62d2('0x2e')]['findAll'](_0x531053);})['then'](function(_0x46e149){_0x40ff72[_0x62d2('0x44')]=_0x46e149;return _0x40ff72;})[_0x62d2('0x26')](respondWithFilteredResult(_0xe9ba20,_0x531053))[_0x62d2('0x45')](handleError(_0xe9ba20,null));};exports[_0x62d2('0x46')]=function(_0x418b78,_0x41eb67){var _0x205fd2={'raw':!![],'where':{'id':_0x418b78[_0x62d2('0x47')]['id']}},_0x500a25={};_0x500a25[_0x62d2('0x33')]=_[_0x62d2('0x34')](db['OpenchannelTransferReport'][_0x62d2('0x2f')]);_0x500a25[_0x62d2('0x35')]=_[_0x62d2('0x34')](_0x418b78[_0x62d2('0x35')]);_0x500a25[_0x62d2('0x36')]=_[_0x62d2('0x38')](_0x500a25[_0x62d2('0x33')],_0x500a25[_0x62d2('0x35')]);_0x205fd2[_0x62d2('0x37')]=_['intersection'](_0x500a25[_0x62d2('0x33')],qs[_0x62d2('0x39')](_0x418b78['query']['fields']));_0x205fd2['attributes']=_0x205fd2[_0x62d2('0x37')][_0x62d2('0x3a')]?_0x205fd2[_0x62d2('0x37')]:_0x500a25[_0x62d2('0x33')];if(_0x418b78['query'][_0x62d2('0x48')]){_0x205fd2[_0x62d2('0x49')]=[{'all':!![]}];}_0x205fd2=_[_0x62d2('0x43')]({},_0x205fd2,_0x418b78[_0x62d2('0x4a')]);return db[_0x62d2('0x2e')][_0x62d2('0x4b')](_0x205fd2)[_0x62d2('0x26')](handleEntityNotFound(_0x41eb67,null))[_0x62d2('0x26')](respondWithResult(_0x41eb67,null))[_0x62d2('0x45')](handleError(_0x41eb67,null));};exports[_0x62d2('0x4c')]=function(_0x692800,_0x3f79d0){return db[_0x62d2('0x2e')][_0x62d2('0x4c')](_0x692800[_0x62d2('0x4d')],{})[_0x62d2('0x26')](respondWithResult(_0x3f79d0,0xc9))[_0x62d2('0x45')](handleError(_0x3f79d0,null));};exports['update']=function(_0x36949f,_0x4d2a61){if(_0x36949f['body']['id']){delete _0x36949f['body']['id'];}return db['OpenchannelTransferReport'][_0x62d2('0x4b')]({'where':{'id':_0x36949f[_0x62d2('0x47')]['id']}})[_0x62d2('0x26')](handleEntityNotFound(_0x4d2a61,null))[_0x62d2('0x26')](saveUpdates(_0x36949f['body'],null))[_0x62d2('0x26')](respondWithResult(_0x4d2a61,null))[_0x62d2('0x45')](handleError(_0x4d2a61,null));};exports[_0x62d2('0x27')]=function(_0x3292da,_0x32f7f7){return db[_0x62d2('0x2e')][_0x62d2('0x4b')]({'where':{'id':_0x3292da['params']['id']}})[_0x62d2('0x26')](handleEntityNotFound(_0x32f7f7,null))['then'](removeEntity(_0x32f7f7,null))[_0x62d2('0x45')](handleError(_0x32f7f7,null));};exports['describe']=function(_0x2d866e,_0x42cafe){return db[_0x62d2('0x2e')][_0x62d2('0x4e')]()['then'](respondWithResult(_0x42cafe,null))[_0x62d2('0x45')](handleError(_0x42cafe,null));}; \ No newline at end of file +var _0x8ca6=['model','query','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','catch','params','keys','rawAttributes','intersection','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','offset','count','set','Content-Range','reject','update','then','destroy','name','send','index','map','OpenchannelTransferReport','fieldName','type','key'];(function(_0x480430,_0x27ad8f){var _0x1a29d1=function(_0x26cc8d){while(--_0x26cc8d){_0x480430['push'](_0x480430['shift']());}};_0x1a29d1(++_0x27ad8f);}(_0x8ca6,0x139));var _0x68ca=function(_0x4d8cb8,_0x2d8a00){_0x4d8cb8=_0x4d8cb8-0x0;var _0x5a9c5d=_0x8ca6[_0x4d8cb8];return _0x5a9c5d;};'use strict';var emlformat=require(_0x68ca('0x0'));var rimraf=require(_0x68ca('0x1'));var zipdir=require(_0x68ca('0x2'));var jsonpatch=require(_0x68ca('0x3'));var rp=require(_0x68ca('0x4'));var moment=require(_0x68ca('0x5'));var BPromise=require(_0x68ca('0x6'));var Mustache=require(_0x68ca('0x7'));var util=require(_0x68ca('0x8'));var path=require(_0x68ca('0x9'));var sox=require(_0x68ca('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x68ca('0xb'));var squel=require('squel');var crypto=require(_0x68ca('0xc'));var jsforce=require(_0x68ca('0xd'));var deskjs=require(_0x68ca('0xe'));var toCsv=require('to-csv');var querystring=require(_0x68ca('0xf'));var Papa=require(_0x68ca('0x10'));var Redis=require(_0x68ca('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x68ca('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x68ca('0x13'));var logger=require(_0x68ca('0x14'))(_0x68ca('0x15'));var utils=require('../../config/utils');var config=require(_0x68ca('0x16'));var licenseUtil=require(_0x68ca('0x17'));var db=require(_0x68ca('0x18'))['db'];function respondWithStatusCode(_0x4d088d,_0x417fc7){_0x417fc7=_0x417fc7||0xcc;return function(_0x43effa){if(_0x43effa){return _0x4d088d[_0x68ca('0x19')](_0x417fc7);}return _0x4d088d[_0x68ca('0x1a')](_0x417fc7)[_0x68ca('0x1b')]();};}function respondWithResult(_0x47db7e,_0x3641e2){_0x3641e2=_0x3641e2||0xc8;return function(_0x3c46a4){if(_0x3c46a4){return _0x47db7e[_0x68ca('0x1a')](_0x3641e2)[_0x68ca('0x1c')](_0x3c46a4);}};}function respondWithFilteredResult(_0x586045,_0x17d309){return function(_0x111082){if(_0x111082){var _0x432292=typeof _0x17d309['offset']==='undefined'&&typeof _0x17d309[_0x68ca('0x1d')]===_0x68ca('0x1e');var _0x1e7d47=_0x111082['count'];var _0x40b271=_0x432292?0x0:_0x17d309[_0x68ca('0x1f')];var _0x48bf64=_0x432292?_0x111082[_0x68ca('0x20')]:_0x17d309[_0x68ca('0x1f')]+_0x17d309[_0x68ca('0x1d')];var _0x7e027e;if(_0x48bf64>=_0x1e7d47){_0x48bf64=_0x1e7d47;_0x7e027e=0xc8;}else{_0x7e027e=0xce;}_0x586045['status'](_0x7e027e);return _0x586045[_0x68ca('0x21')](_0x68ca('0x22'),_0x40b271+'-'+_0x48bf64+'/'+_0x1e7d47)[_0x68ca('0x1c')](_0x111082);}return null;};}function patchUpdates(_0x582b6a){return function(_0x5532f7){try{jsonpatch['apply'](_0x5532f7,_0x582b6a,!![]);}catch(_0x26d8bc){return BPromise[_0x68ca('0x23')](_0x26d8bc);}return _0x5532f7['save']();};}function saveUpdates(_0x374081,_0x1104e4){return function(_0x289cec){if(_0x289cec){return _0x289cec[_0x68ca('0x24')](_0x374081)[_0x68ca('0x25')](function(_0x1ed178){return _0x1ed178;});}return null;};}function removeEntity(_0x1f28ac,_0x33f764){return function(_0x1acf64){if(_0x1acf64){return _0x1acf64[_0x68ca('0x26')]()['then'](function(){_0x1f28ac[_0x68ca('0x1a')](0xcc)[_0x68ca('0x1b')]();});}};}function handleEntityNotFound(_0x1be520,_0x7da3e5){return function(_0x30c28d){if(!_0x30c28d){_0x1be520[_0x68ca('0x19')](0x194);}return _0x30c28d;};}function handleError(_0x464c5e,_0x28b121){_0x28b121=_0x28b121||0x1f4;return function(_0x2607ab){logger['error'](_0x2607ab['stack']);if(_0x2607ab[_0x68ca('0x27')]){delete _0x2607ab[_0x68ca('0x27')];}_0x464c5e[_0x68ca('0x1a')](_0x28b121)[_0x68ca('0x28')](_0x2607ab);};}exports[_0x68ca('0x29')]=function(_0x572476,_0x33e8f0){var _0x47e5cc={},_0x59db71={},_0xc2dc82={'count':0x0,'rows':[]};var _0x1e4cbd=_[_0x68ca('0x2a')](db[_0x68ca('0x2b')]['rawAttributes'],function(_0x30dda4){return{'name':_0x30dda4[_0x68ca('0x2c')],'type':_0x30dda4[_0x68ca('0x2d')][_0x68ca('0x2e')]};});_0x59db71[_0x68ca('0x2f')]=_[_0x68ca('0x2a')](_0x1e4cbd,_0x68ca('0x27'));_0x59db71['query']=_['keys'](_0x572476[_0x68ca('0x30')]);_0x59db71['filters']=_['intersection'](_0x59db71['model'],_0x59db71[_0x68ca('0x30')]);_0x47e5cc['attributes']=_['intersection'](_0x59db71['model'],qs[_0x68ca('0x31')](_0x572476[_0x68ca('0x30')][_0x68ca('0x31')]));_0x47e5cc[_0x68ca('0x32')]=_0x47e5cc[_0x68ca('0x32')]['length']?_0x47e5cc['attributes']:_0x59db71['model'];if(!_0x572476[_0x68ca('0x30')][_0x68ca('0x33')](_0x68ca('0x34'))){_0x47e5cc[_0x68ca('0x1d')]=qs[_0x68ca('0x1d')](_0x572476['query'][_0x68ca('0x1d')]);_0x47e5cc[_0x68ca('0x1f')]=qs['offset'](_0x572476[_0x68ca('0x30')][_0x68ca('0x1f')]);}_0x47e5cc[_0x68ca('0x35')]=qs['sort'](_0x572476[_0x68ca('0x30')][_0x68ca('0x36')]);_0x47e5cc[_0x68ca('0x37')]=qs[_0x68ca('0x38')](_[_0x68ca('0x39')](_0x572476[_0x68ca('0x30')],_0x59db71[_0x68ca('0x38')]),_0x1e4cbd);if(_0x572476[_0x68ca('0x30')][_0x68ca('0x3a')]){_0x47e5cc[_0x68ca('0x37')]=_[_0x68ca('0x3b')](_0x47e5cc[_0x68ca('0x37')],{'$or':_[_0x68ca('0x2a')](_0x1e4cbd,function(_0x4e8b6a){if(_0x4e8b6a[_0x68ca('0x2d')]!=='VIRTUAL'){var _0x2928bd={};_0x2928bd[_0x4e8b6a[_0x68ca('0x27')]]={'$like':'%'+_0x572476[_0x68ca('0x30')][_0x68ca('0x3a')]+'%'};return _0x2928bd;}})});}_0x47e5cc=_[_0x68ca('0x3b')]({},_0x47e5cc,_0x572476[_0x68ca('0x3c')]);var _0x52be6f={'where':_0x47e5cc['where']};return db[_0x68ca('0x2b')][_0x68ca('0x20')](_0x52be6f)[_0x68ca('0x25')](function(_0x332e70){_0xc2dc82['count']=_0x332e70;if(_0x572476['query'][_0x68ca('0x3d')]){_0x47e5cc['include']=[{'all':!![]}];}return db[_0x68ca('0x2b')]['findAll'](_0x47e5cc);})[_0x68ca('0x25')](function(_0x1f4bcf){_0xc2dc82['rows']=_0x1f4bcf;return _0xc2dc82;})[_0x68ca('0x25')](respondWithFilteredResult(_0x33e8f0,_0x47e5cc))[_0x68ca('0x3e')](handleError(_0x33e8f0,null));};exports['show']=function(_0x3435e1,_0x269079){var _0x4fa483={'raw':!![],'where':{'id':_0x3435e1[_0x68ca('0x3f')]['id']}},_0x5017c4={};_0x5017c4[_0x68ca('0x2f')]=_[_0x68ca('0x40')](db['OpenchannelTransferReport'][_0x68ca('0x41')]);_0x5017c4[_0x68ca('0x30')]=_[_0x68ca('0x40')](_0x3435e1['query']);_0x5017c4['filters']=_[_0x68ca('0x42')](_0x5017c4[_0x68ca('0x2f')],_0x5017c4[_0x68ca('0x30')]);_0x4fa483[_0x68ca('0x32')]=_[_0x68ca('0x42')](_0x5017c4[_0x68ca('0x2f')],qs[_0x68ca('0x31')](_0x3435e1[_0x68ca('0x30')][_0x68ca('0x31')]));_0x4fa483[_0x68ca('0x32')]=_0x4fa483[_0x68ca('0x32')]['length']?_0x4fa483[_0x68ca('0x32')]:_0x5017c4['model'];if(_0x3435e1[_0x68ca('0x30')][_0x68ca('0x3d')]){_0x4fa483[_0x68ca('0x43')]=[{'all':!![]}];}_0x4fa483=_[_0x68ca('0x3b')]({},_0x4fa483,_0x3435e1[_0x68ca('0x3c')]);return db[_0x68ca('0x2b')][_0x68ca('0x44')](_0x4fa483)['then'](handleEntityNotFound(_0x269079,null))['then'](respondWithResult(_0x269079,null))[_0x68ca('0x3e')](handleError(_0x269079,null));};exports['create']=function(_0x44c760,_0x37ee6f){return db[_0x68ca('0x2b')][_0x68ca('0x45')](_0x44c760['body'],{})[_0x68ca('0x25')](respondWithResult(_0x37ee6f,0xc9))[_0x68ca('0x3e')](handleError(_0x37ee6f,null));};exports[_0x68ca('0x24')]=function(_0x3f54ae,_0x4dde70){if(_0x3f54ae[_0x68ca('0x46')]['id']){delete _0x3f54ae[_0x68ca('0x46')]['id'];}return db[_0x68ca('0x2b')][_0x68ca('0x44')]({'where':{'id':_0x3f54ae[_0x68ca('0x3f')]['id']}})[_0x68ca('0x25')](handleEntityNotFound(_0x4dde70,null))['then'](saveUpdates(_0x3f54ae[_0x68ca('0x46')],null))['then'](respondWithResult(_0x4dde70,null))['catch'](handleError(_0x4dde70,null));};exports[_0x68ca('0x26')]=function(_0x33bc88,_0x56d8ad){return db[_0x68ca('0x2b')][_0x68ca('0x44')]({'where':{'id':_0x33bc88[_0x68ca('0x3f')]['id']}})['then'](handleEntityNotFound(_0x56d8ad,null))[_0x68ca('0x25')](removeEntity(_0x56d8ad,null))[_0x68ca('0x3e')](handleError(_0x56d8ad,null));};exports[_0x68ca('0x47')]=function(_0xa0a108,_0xb63331){return db['OpenchannelTransferReport'][_0x68ca('0x47')]()[_0x68ca('0x25')](respondWithResult(_0xb63331,null))[_0x68ca('0x3e')](handleError(_0xb63331,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 1751eaa..17df2be 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 _0x6b4e=['../../config/environment','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x5dbb71,_0x2b3270){var _0x261dde=function(_0x419309){while(--_0x419309){_0x5dbb71['push'](_0x5dbb71['shift']());}};_0x261dde(++_0x2b3270);}(_0x6b4e,0xe7));var _0xe6b4=function(_0x3cb70,_0xac94e5){_0x3cb70=_0x3cb70-0x0;var _0x7e38b4=_0x6b4e[_0x3cb70];return _0x7e38b4;};'use strict';var _=require(_0xe6b4('0x0'));var util=require(_0xe6b4('0x1'));var logger=require(_0xe6b4('0x2'))('api');var moment=require(_0xe6b4('0x3'));var BPromise=require('bluebird');var rp=require(_0xe6b4('0x4'));var fs=require('fs');var path=require(_0xe6b4('0x5'));var rimraf=require(_0xe6b4('0x6'));var config=require(_0xe6b4('0x7'));var attributes=require(_0xe6b4('0x8'));module[_0xe6b4('0x9')]=function(_0x206778,_0xcf175){return _0x206778[_0xe6b4('0xa')](_0xe6b4('0xb'),attributes,{'tableName':_0xe6b4('0xc'),'paranoid':![],'indexes':[{'name':_0xe6b4('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x4ef9=['define','OpenchannelTransferReport','uniqueid','lodash','api','moment','path','rimraf','../../config/environment','./openchannelTransferReport.attributes'];(function(_0x37437c,_0x55dacf){var _0x35e1a1=function(_0xdcb380){while(--_0xdcb380){_0x37437c['push'](_0x37437c['shift']());}};_0x35e1a1(++_0x55dacf);}(_0x4ef9,0x161));var _0x94ef=function(_0xfca0bf,_0x8ac9f9){_0xfca0bf=_0xfca0bf-0x0;var _0xc72568=_0x4ef9[_0xfca0bf];return _0xc72568;};'use strict';var _=require(_0x94ef('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x94ef('0x1'));var moment=require(_0x94ef('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x94ef('0x3'));var rimraf=require(_0x94ef('0x4'));var config=require(_0x94ef('0x5'));var attributes=require(_0x94ef('0x6'));module['exports']=function(_0x4fce52,_0x3fea74){return _0x4fce52[_0x94ef('0x7')](_0x94ef('0x8'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0x94ef('0x9'),'fields':[_0x94ef('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 54420a5..1bf554e 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 _0x6108=['OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info'];(function(_0x205e5a,_0x5c19fb){var _0x10da58=function(_0x1ba35d){while(--_0x1ba35d){_0x205e5a['push'](_0x205e5a['shift']());}};_0x10da58(++_0x5c19fb);}(_0x6108,0xbc));var _0x8610=function(_0x3afade,_0x1644b0){_0x3afade=_0x3afade-0x0;var _0x458909=_0x6108[_0x3afade];return _0x458909;};'use strict';var _=require(_0x8610('0x0'));var util=require('util');var moment=require(_0x8610('0x1'));var BPromise=require(_0x8610('0x2'));var rs=require(_0x8610('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8610('0x4'));var logger=require(_0x8610('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8610('0x6'));var client=jayson[_0x8610('0x7')][_0x8610('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x26dab3,_0x4e0fe4,_0x174f41){return new BPromise(function(_0x49e0a2,_0x6ee380){return client[_0x8610('0x9')](_0x26dab3,_0x174f41)[_0x8610('0xa')](function(_0x48d693){logger[_0x8610('0xb')](_0x8610('0xc'),_0x4e0fe4,_0x8610('0xd'));logger[_0x8610('0xe')](_0x8610('0xf'),_0x4e0fe4,_0x8610('0xd'),JSON['stringify'](_0x48d693));if(_0x48d693[_0x8610('0x10')]){if(_0x48d693[_0x8610('0x10')][_0x8610('0x11')]===0x1f4){logger['error'](_0x8610('0xc'),_0x4e0fe4,_0x48d693['error'][_0x8610('0x12')]);return _0x6ee380(_0x48d693[_0x8610('0x10')][_0x8610('0x12')]);}logger[_0x8610('0x10')](_0x8610('0xc'),_0x4e0fe4,_0x48d693['error']['message']);return _0x49e0a2(_0x48d693[_0x8610('0x10')][_0x8610('0x12')]);}else{logger[_0x8610('0xb')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x4e0fe4,'request\x20sent');_0x49e0a2(_0x48d693['result'][_0x8610('0x12')]);}})[_0x8610('0x13')](function(_0x56ec75){logger[_0x8610('0x10')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x4e0fe4,_0x56ec75);_0x6ee380(_0x56ec75);});});} \ No newline at end of file +var _0x1cb9=['error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x1cb9,0x14e));var _0x91cb=function(_0x5e53aa,_0x22d09b){_0x5e53aa=_0x5e53aa-0x0;var _0x292e2c=_0x1cb9[_0x5e53aa];return _0x292e2c;};'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')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x15c517(_0xa43e7a[_0x91cb('0x12')]['message']);}else{logger['info'](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));_0x15c517(_0xa43e7a[_0x91cb('0x14')]['message']);}})[_0x91cb('0x15')](function(_0x135890){logger['error'](_0x91cb('0xd'),_0x8f8a3b,_0x135890);_0x5bda2f(_0x135890);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 926ead5..6ec83f8 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 _0x79d3=['fs-extra','../../components/auth/service','../../config/environment','./pause.controller','get','isAuthenticated','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x243792,_0x3eaba3){var _0x510182=function(_0x5df562){while(--_0x5df562){_0x243792['push'](_0x243792['shift']());}};_0x510182(++_0x3eaba3);}(_0x79d3,0x1c6));var _0x379d=function(_0x58b301,_0x45e991){_0x58b301=_0x58b301-0x0;var _0x2171b3=_0x79d3[_0x58b301];return _0x2171b3;};'use strict';var multer=require(_0x379d('0x0'));var util=require(_0x379d('0x1'));var path=require(_0x379d('0x2'));var timeout=require(_0x379d('0x3'));var express=require(_0x379d('0x4'));var router=express[_0x379d('0x5')]();var fs_extra=require(_0x379d('0x6'));var auth=require(_0x379d('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x379d('0x8'));var controller=require(_0x379d('0x9'));router[_0x379d('0xa')]('/',auth[_0x379d('0xb')](),controller['index']);router[_0x379d('0xa')](_0x379d('0xc'),auth[_0x379d('0xb')](),controller[_0x379d('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x379d('0xe')]);router[_0x379d('0xf')](_0x379d('0xc'),auth['isAuthenticated'](),controller[_0x379d('0x10')]);router[_0x379d('0x11')](_0x379d('0xc'),auth['isAuthenticated'](),controller[_0x379d('0x12')]);module[_0x379d('0x13')]=router; \ No newline at end of file +var _0xd86a=['/:id','isAuthenticated','show','post','create','put','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./pause.controller','get','index'];(function(_0x1d972a,_0x38f777){var _0x8c3651=function(_0x2f98b5){while(--_0x2f98b5){_0x1d972a['push'](_0x1d972a['shift']());}};_0x8c3651(++_0x38f777);}(_0xd86a,0xd1));var _0xad86=function(_0x2d6197,_0x82ebfb){_0x2d6197=_0x2d6197-0x0;var _0x4d0e75=_0xd86a[_0x2d6197];return _0x4d0e75;};'use strict';var multer=require(_0xad86('0x0'));var util=require(_0xad86('0x1'));var path=require(_0xad86('0x2'));var timeout=require('connect-timeout');var express=require(_0xad86('0x3'));var router=express[_0xad86('0x4')]();var fs_extra=require(_0xad86('0x5'));var auth=require(_0xad86('0x6'));var interaction=require(_0xad86('0x7'));var config=require('../../config/environment');var controller=require(_0xad86('0x8'));router[_0xad86('0x9')]('/',auth['isAuthenticated'](),controller[_0xad86('0xa')]);router[_0xad86('0x9')](_0xad86('0xb'),auth[_0xad86('0xc')](),controller[_0xad86('0xd')]);router[_0xad86('0xe')]('/',auth[_0xad86('0xc')](),controller[_0xad86('0xf')]);router[_0xad86('0x10')](_0xad86('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xad86('0x11')]('/:id',auth[_0xad86('0xc')](),controller[_0xad86('0x12')]);module[_0xad86('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 4a92de6..e7cf41b 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 _0x2022=['STRING','sequelize','exports'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x2022,0xeb));var _0x2202=function(_0x920ae3,_0x4652ef){_0x920ae3=_0x920ae3-0x0;var _0x19ea79=_0x2022[_0x920ae3];return _0x19ea79;};'use strict';var Sequelize=require(_0x2202('0x0'));module[_0x2202('0x1')]={'name':{'type':Sequelize[_0x2202('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x2202('0x2')]}}; \ No newline at end of file +var _0x94b2=['STRING','name','sequelize'];(function(_0x2d91c6,_0x10ae0e){var _0x3a8d19=function(_0x27a3ce){while(--_0x27a3ce){_0x2d91c6['push'](_0x2d91c6['shift']());}};_0x3a8d19(++_0x10ae0e);}(_0x94b2,0x1f1));var _0x294b=function(_0x14a7e7,_0x1d3977){_0x14a7e7=_0x14a7e7-0x0;var _0x5d4e91=_0x94b2[_0x14a7e7];return _0x5d4e91;};'use strict';var Sequelize=require(_0x294b('0x0'));module['exports']={'name':{'type':Sequelize[_0x294b('0x1')],'unique':_0x294b('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x294b('0x1')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index e9aafeb..299f236 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 _0x6e7f=['squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Pauses','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','merge','VIRTUAL','Pause','includeAll','include','findAll','rows','options','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','params','eml-format','rimraf','zip-dir','moment','bluebird','util','path','to-csv','lodash'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x6e7f,0x143));var _0xf6e7=function(_0x55cdf9,_0x5def70){_0x55cdf9=_0x55cdf9-0x0;var _0x1dd11c=_0x6e7f[_0x55cdf9];return _0x1dd11c;};'use strict';var emlformat=require(_0xf6e7('0x0'));var rimraf=require(_0xf6e7('0x1'));var zipdir=require(_0xf6e7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf6e7('0x3'));var BPromise=require(_0xf6e7('0x4'));var Mustache=require('mustache');var util=require(_0xf6e7('0x5'));var path=require(_0xf6e7('0x6'));var sox=require('sox');var csv=require(_0xf6e7('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf6e7('0x8'));var squel=require(_0xf6e7('0x9'));var crypto=require(_0xf6e7('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf6e7('0x7'));var querystring=require('querystring');var Papa=require(_0xf6e7('0xb'));var Redis=require(_0xf6e7('0xc'));var authService=require(_0xf6e7('0xd'));var qs=require(_0xf6e7('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf6e7('0xf'));var logger=require(_0xf6e7('0x10'))(_0xf6e7('0x11'));var utils=require(_0xf6e7('0x12'));var config=require(_0xf6e7('0x13'));var licenseUtil=require(_0xf6e7('0x14'));var db=require(_0xf6e7('0x15'))['db'];function respondWithStatusCode(_0x31a970,_0x28384c){_0x28384c=_0x28384c||0xcc;return function(_0x188450){if(_0x188450){return _0x31a970[_0xf6e7('0x16')](_0x28384c);}return _0x31a970[_0xf6e7('0x17')](_0x28384c)[_0xf6e7('0x18')]();};}function respondWithResult(_0x52f9a7,_0x1087fe){_0x1087fe=_0x1087fe||0xc8;return function(_0x16cd34){if(_0x16cd34){return _0x52f9a7[_0xf6e7('0x17')](_0x1087fe)[_0xf6e7('0x19')](_0x16cd34);}};}function respondWithFilteredResult(_0x12e4e8,_0x3a3a3a){return function(_0x56f4b4){if(_0x56f4b4){var _0x9dc292=typeof _0x3a3a3a['offset']===_0xf6e7('0x1a')&&typeof _0x3a3a3a['limit']==='undefined';var _0x37d3d5=_0x56f4b4[_0xf6e7('0x1b')];var _0x2ea10f=_0x9dc292?0x0:_0x3a3a3a[_0xf6e7('0x1c')];var _0xb0c8ba=_0x9dc292?_0x56f4b4[_0xf6e7('0x1b')]:_0x3a3a3a[_0xf6e7('0x1c')]+_0x3a3a3a[_0xf6e7('0x1d')];var _0xf17ce0;if(_0xb0c8ba>=_0x37d3d5){_0xb0c8ba=_0x37d3d5;_0xf17ce0=0xc8;}else{_0xf17ce0=0xce;}_0x12e4e8[_0xf6e7('0x17')](_0xf17ce0);return _0x12e4e8[_0xf6e7('0x1e')](_0xf6e7('0x1f'),_0x2ea10f+'-'+_0xb0c8ba+'/'+_0x37d3d5)[_0xf6e7('0x19')](_0x56f4b4);}return null;};}function patchUpdates(_0x36fdf5){return function(_0x5e148b){try{jsonpatch[_0xf6e7('0x20')](_0x5e148b,_0x36fdf5,!![]);}catch(_0x44008b){return BPromise[_0xf6e7('0x21')](_0x44008b);}return _0x5e148b[_0xf6e7('0x22')]();};}function saveUpdates(_0x46c972,_0x166d8d){return function(_0x556a7d){if(_0x556a7d){return _0x556a7d[_0xf6e7('0x23')](_0x46c972)[_0xf6e7('0x24')](function(_0x349a04){return _0x349a04;});}return null;};}function removeEntity(_0x123625,_0x39ef4d){return function(_0x4395da){if(_0x4395da){return _0x4395da[_0xf6e7('0x25')]()['then'](function(){var _0x100b43=_0x4395da[_0xf6e7('0x26')]({'plain':!![]});var _0x5e6102=_0xf6e7('0x27');return db[_0xf6e7('0x28')]['destroy']({'where':{'type':_0x5e6102,'resourceId':_0x100b43['id']}})[_0xf6e7('0x24')](function(){return _0x4395da;});})['then'](function(){_0x123625['status'](0xcc)[_0xf6e7('0x18')]();});}};}function handleEntityNotFound(_0x48ffbb,_0x4cbb01){return function(_0x349acc){if(!_0x349acc){_0x48ffbb['sendStatus'](0x194);}return _0x349acc;};}function handleError(_0x2c482b,_0x453227){_0x453227=_0x453227||0x1f4;return function(_0x57efa5){logger[_0xf6e7('0x29')](_0x57efa5[_0xf6e7('0x2a')]);if(_0x57efa5[_0xf6e7('0x2b')]){delete _0x57efa5[_0xf6e7('0x2b')];}_0x2c482b[_0xf6e7('0x17')](_0x453227)[_0xf6e7('0x2c')](_0x57efa5);};}exports[_0xf6e7('0x2d')]=function(_0x36e6c9,_0x2b9163){var _0x31d26c={},_0x214c4d={},_0x3ccd1e={'count':0x0,'rows':[]};var _0x2a9764=_[_0xf6e7('0x2e')](db['Pause'][_0xf6e7('0x2f')],function(_0x57f6bd){return{'name':_0x57f6bd[_0xf6e7('0x30')],'type':_0x57f6bd[_0xf6e7('0x31')][_0xf6e7('0x32')]};});_0x214c4d[_0xf6e7('0x33')]=_[_0xf6e7('0x2e')](_0x2a9764,_0xf6e7('0x2b'));_0x214c4d[_0xf6e7('0x34')]=_[_0xf6e7('0x35')](_0x36e6c9[_0xf6e7('0x34')]);_0x214c4d[_0xf6e7('0x36')]=_[_0xf6e7('0x37')](_0x214c4d[_0xf6e7('0x33')],_0x214c4d[_0xf6e7('0x34')]);_0x31d26c[_0xf6e7('0x38')]=_[_0xf6e7('0x37')](_0x214c4d[_0xf6e7('0x33')],qs['fields'](_0x36e6c9[_0xf6e7('0x34')][_0xf6e7('0x39')]));_0x31d26c[_0xf6e7('0x38')]=_0x31d26c[_0xf6e7('0x38')][_0xf6e7('0x3a')]?_0x31d26c[_0xf6e7('0x38')]:_0x214c4d[_0xf6e7('0x33')];if(!_0x36e6c9['query'][_0xf6e7('0x3b')](_0xf6e7('0x3c'))){_0x31d26c['limit']=qs[_0xf6e7('0x1d')](_0x36e6c9['query'][_0xf6e7('0x1d')]);_0x31d26c[_0xf6e7('0x1c')]=qs[_0xf6e7('0x1c')](_0x36e6c9[_0xf6e7('0x34')]['offset']);}_0x31d26c['order']=qs[_0xf6e7('0x3d')](_0x36e6c9[_0xf6e7('0x34')][_0xf6e7('0x3d')]);_0x31d26c['where']=qs[_0xf6e7('0x36')](_['pick'](_0x36e6c9['query'],_0x214c4d[_0xf6e7('0x36')]),_0x2a9764);if(_0x36e6c9[_0xf6e7('0x34')][_0xf6e7('0x3e')]){_0x31d26c[_0xf6e7('0x3f')]=_[_0xf6e7('0x40')](_0x31d26c[_0xf6e7('0x3f')],{'$or':_['map'](_0x2a9764,function(_0x414033){if(_0x414033[_0xf6e7('0x31')]!==_0xf6e7('0x41')){var _0x551263={};_0x551263[_0x414033[_0xf6e7('0x2b')]]={'$like':'%'+_0x36e6c9[_0xf6e7('0x34')][_0xf6e7('0x3e')]+'%'};return _0x551263;}})});}_0x31d26c=_[_0xf6e7('0x40')]({},_0x31d26c,_0x36e6c9['options']);var _0x34727e={'where':_0x31d26c[_0xf6e7('0x3f')]};return db[_0xf6e7('0x42')]['count'](_0x34727e)['then'](function(_0x26b84e){_0x3ccd1e['count']=_0x26b84e;if(_0x36e6c9['query'][_0xf6e7('0x43')]){_0x31d26c[_0xf6e7('0x44')]=[{'all':!![]}];}return db[_0xf6e7('0x42')][_0xf6e7('0x45')](_0x31d26c);})[_0xf6e7('0x24')](function(_0x15c92d){_0x3ccd1e[_0xf6e7('0x46')]=_0x15c92d;return _0x3ccd1e;})['then'](respondWithFilteredResult(_0x2b9163,_0x31d26c))['catch'](handleError(_0x2b9163,null));};exports['show']=function(_0x1b4bbd,_0x2cdcac){var _0x4f1f49={'raw':!![],'where':{'id':_0x1b4bbd['params']['id']}},_0xbf04af={};_0xbf04af[_0xf6e7('0x33')]=_[_0xf6e7('0x35')](db[_0xf6e7('0x42')][_0xf6e7('0x2f')]);_0xbf04af[_0xf6e7('0x34')]=_['keys'](_0x1b4bbd[_0xf6e7('0x34')]);_0xbf04af['filters']=_[_0xf6e7('0x37')](_0xbf04af[_0xf6e7('0x33')],_0xbf04af[_0xf6e7('0x34')]);_0x4f1f49[_0xf6e7('0x38')]=_[_0xf6e7('0x37')](_0xbf04af[_0xf6e7('0x33')],qs[_0xf6e7('0x39')](_0x1b4bbd[_0xf6e7('0x34')][_0xf6e7('0x39')]));_0x4f1f49[_0xf6e7('0x38')]=_0x4f1f49[_0xf6e7('0x38')][_0xf6e7('0x3a')]?_0x4f1f49['attributes']:_0xbf04af[_0xf6e7('0x33')];if(_0x1b4bbd[_0xf6e7('0x34')][_0xf6e7('0x43')]){_0x4f1f49[_0xf6e7('0x44')]=[{'all':!![]}];}_0x4f1f49=_[_0xf6e7('0x40')]({},_0x4f1f49,_0x1b4bbd[_0xf6e7('0x47')]);return db[_0xf6e7('0x42')][_0xf6e7('0x48')](_0x4f1f49)[_0xf6e7('0x24')](handleEntityNotFound(_0x2cdcac,null))[_0xf6e7('0x24')](respondWithResult(_0x2cdcac,null))['catch'](handleError(_0x2cdcac,null));};exports['create']=function(_0xefd0fe,_0x19d955){return db[_0xf6e7('0x42')]['create'](_0xefd0fe[_0xf6e7('0x49')],{})[_0xf6e7('0x24')](function(_0x513d86){var _0x8b3612=_0xefd0fe[_0xf6e7('0x4a')]['get']({'plain':!![]});if(!_0x8b3612)throw new Error(_0xf6e7('0x4b'));if(_0x8b3612[_0xf6e7('0x4c')]===_0xf6e7('0x4a')){var _0xd1fb6=_0x513d86['get']({'plain':!![]});var _0x20974c=_0xf6e7('0x27');return db[_0xf6e7('0x4d')]['find']({'where':{'name':_0x20974c,'userProfileId':_0x8b3612[_0xf6e7('0x4e')]},'raw':!![]})[_0xf6e7('0x24')](function(_0x291c60){if(_0x291c60&&_0x291c60['autoAssociation']===0x0){return db[_0xf6e7('0x28')][_0xf6e7('0x4f')]({'name':_0xd1fb6[_0xf6e7('0x2b')],'resourceId':_0xd1fb6['id'],'type':_0x291c60[_0xf6e7('0x2b')],'sectionId':_0x291c60['id']},{})[_0xf6e7('0x24')](function(){return _0x513d86;});}else{return _0x513d86;}})['catch'](function(_0x5bb989){logger['error'](_0xf6e7('0x50'),_0x5bb989);throw _0x5bb989;});}return _0x513d86;})[_0xf6e7('0x24')](respondWithResult(_0x19d955,0xc9))[_0xf6e7('0x51')](handleError(_0x19d955,null));};exports['update']=function(_0x3edc27,_0x167310){if(_0x3edc27[_0xf6e7('0x49')]['id']){delete _0x3edc27[_0xf6e7('0x49')]['id'];}return db[_0xf6e7('0x42')][_0xf6e7('0x48')]({'where':{'id':_0x3edc27[_0xf6e7('0x52')]['id']}})['then'](handleEntityNotFound(_0x167310,null))[_0xf6e7('0x24')](saveUpdates(_0x3edc27[_0xf6e7('0x49')],null))[_0xf6e7('0x24')](respondWithResult(_0x167310,null))[_0xf6e7('0x51')](handleError(_0x167310,null));};exports[_0xf6e7('0x25')]=function(_0x4e38ee,_0x4cf0d7){return db[_0xf6e7('0x42')]['find']({'where':{'id':_0x4e38ee[_0xf6e7('0x52')]['id']}})[_0xf6e7('0x24')](handleEntityNotFound(_0x4cf0d7,null))[_0xf6e7('0x24')](removeEntity(_0x4cf0d7,null))[_0xf6e7('0x51')](handleError(_0x4cf0d7,null));}; \ No newline at end of file +var _0x95b6=['Pauses','UserProfileResource','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','order','sort','where','pick','merge','VIRTUAL','options','Pause','include','findAll','rows','show','params','includeAll','find','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','then','destroy','get'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x95b6,0xd2));var _0x695b=function(_0x1642ba,_0x44b1ba){_0x1642ba=_0x1642ba-0x0;var _0x4d39a2=_0x95b6[_0x1642ba];return _0x4d39a2;};'use strict';var emlformat=require(_0x695b('0x0'));var rimraf=require(_0x695b('0x1'));var zipdir=require(_0x695b('0x2'));var jsonpatch=require(_0x695b('0x3'));var rp=require('request-promise');var moment=require(_0x695b('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x695b('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x695b('0x6'));var ejs=require(_0x695b('0x7'));var fs=require('fs');var fs_extra=require(_0x695b('0x8'));var _=require('lodash');var squel=require(_0x695b('0x9'));var crypto=require(_0x695b('0xa'));var jsforce=require(_0x695b('0xb'));var deskjs=require(_0x695b('0xc'));var toCsv=require(_0x695b('0x6'));var querystring=require('querystring');var Papa=require(_0x695b('0xd'));var Redis=require(_0x695b('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x695b('0xf'));var as=require(_0x695b('0x10'));var hardwareService=require(_0x695b('0x11'));var logger=require(_0x695b('0x12'))(_0x695b('0x13'));var utils=require(_0x695b('0x14'));var config=require(_0x695b('0x15'));var licenseUtil=require(_0x695b('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x36d628,_0x21bf45){_0x21bf45=_0x21bf45||0xcc;return function(_0xcbcc48){if(_0xcbcc48){return _0x36d628[_0x695b('0x17')](_0x21bf45);}return _0x36d628['status'](_0x21bf45)[_0x695b('0x18')]();};}function respondWithResult(_0xbced9d,_0x3142ee){_0x3142ee=_0x3142ee||0xc8;return function(_0x513c06){if(_0x513c06){return _0xbced9d['status'](_0x3142ee)[_0x695b('0x19')](_0x513c06);}};}function respondWithFilteredResult(_0x2391fa,_0x8c3ff5){return function(_0x310663){if(_0x310663){var _0xf774d2=typeof _0x8c3ff5[_0x695b('0x1a')]===_0x695b('0x1b')&&typeof _0x8c3ff5[_0x695b('0x1c')]===_0x695b('0x1b');var _0x20dd0f=_0x310663[_0x695b('0x1d')];var _0x1ea1e5=_0xf774d2?0x0:_0x8c3ff5[_0x695b('0x1a')];var _0x593867=_0xf774d2?_0x310663[_0x695b('0x1d')]:_0x8c3ff5[_0x695b('0x1a')]+_0x8c3ff5['limit'];var _0x40492e;if(_0x593867>=_0x20dd0f){_0x593867=_0x20dd0f;_0x40492e=0xc8;}else{_0x40492e=0xce;}_0x2391fa[_0x695b('0x1e')](_0x40492e);return _0x2391fa[_0x695b('0x1f')](_0x695b('0x20'),_0x1ea1e5+'-'+_0x593867+'/'+_0x20dd0f)[_0x695b('0x19')](_0x310663);}return null;};}function patchUpdates(_0x2cac36){return function(_0x34ee48){try{jsonpatch[_0x695b('0x21')](_0x34ee48,_0x2cac36,!![]);}catch(_0x5dc3ec){return BPromise[_0x695b('0x22')](_0x5dc3ec);}return _0x34ee48[_0x695b('0x23')]();};}function saveUpdates(_0x591d65,_0x21cfb8){return function(_0x5554be){if(_0x5554be){return _0x5554be['update'](_0x591d65)[_0x695b('0x24')](function(_0x4af77e){return _0x4af77e;});}return null;};}function removeEntity(_0x21f41e,_0x2f6632){return function(_0x5e408f){if(_0x5e408f){return _0x5e408f[_0x695b('0x25')]()['then'](function(){var _0xcee938=_0x5e408f[_0x695b('0x26')]({'plain':!![]});var _0x5f0a2c=_0x695b('0x27');return db[_0x695b('0x28')]['destroy']({'where':{'type':_0x5f0a2c,'resourceId':_0xcee938['id']}})[_0x695b('0x24')](function(){return _0x5e408f;});})[_0x695b('0x24')](function(){_0x21f41e['status'](0xcc)[_0x695b('0x18')]();});}};}function handleEntityNotFound(_0x5bf3bd,_0x42b38e){return function(_0x2cb410){if(!_0x2cb410){_0x5bf3bd[_0x695b('0x17')](0x194);}return _0x2cb410;};}function handleError(_0x4f59ee,_0x628766){_0x628766=_0x628766||0x1f4;return function(_0x1e6a8e){logger['error'](_0x1e6a8e[_0x695b('0x29')]);if(_0x1e6a8e[_0x695b('0x2a')]){delete _0x1e6a8e[_0x695b('0x2a')];}_0x4f59ee[_0x695b('0x1e')](_0x628766)[_0x695b('0x2b')](_0x1e6a8e);};}exports[_0x695b('0x2c')]=function(_0x5350d6,_0x358c91){var _0x237620={},_0xc853a6={},_0x18f9e2={'count':0x0,'rows':[]};var _0x639649=_[_0x695b('0x2d')](db['Pause'][_0x695b('0x2e')],function(_0x5b94df){return{'name':_0x5b94df[_0x695b('0x2f')],'type':_0x5b94df[_0x695b('0x30')][_0x695b('0x31')]};});_0xc853a6[_0x695b('0x32')]=_[_0x695b('0x2d')](_0x639649,'name');_0xc853a6[_0x695b('0x33')]=_[_0x695b('0x34')](_0x5350d6[_0x695b('0x33')]);_0xc853a6[_0x695b('0x35')]=_['intersection'](_0xc853a6['model'],_0xc853a6[_0x695b('0x33')]);_0x237620['attributes']=_[_0x695b('0x36')](_0xc853a6['model'],qs['fields'](_0x5350d6['query'][_0x695b('0x37')]));_0x237620[_0x695b('0x38')]=_0x237620[_0x695b('0x38')][_0x695b('0x39')]?_0x237620[_0x695b('0x38')]:_0xc853a6[_0x695b('0x32')];if(!_0x5350d6[_0x695b('0x33')]['hasOwnProperty']('nolimit')){_0x237620[_0x695b('0x1c')]=qs[_0x695b('0x1c')](_0x5350d6[_0x695b('0x33')][_0x695b('0x1c')]);_0x237620['offset']=qs[_0x695b('0x1a')](_0x5350d6[_0x695b('0x33')][_0x695b('0x1a')]);}_0x237620[_0x695b('0x3a')]=qs[_0x695b('0x3b')](_0x5350d6[_0x695b('0x33')][_0x695b('0x3b')]);_0x237620[_0x695b('0x3c')]=qs['filters'](_[_0x695b('0x3d')](_0x5350d6[_0x695b('0x33')],_0xc853a6[_0x695b('0x35')]),_0x639649);if(_0x5350d6[_0x695b('0x33')]['filter']){_0x237620[_0x695b('0x3c')]=_[_0x695b('0x3e')](_0x237620['where'],{'$or':_[_0x695b('0x2d')](_0x639649,function(_0x382452){if(_0x382452['type']!==_0x695b('0x3f')){var _0x2fe56b={};_0x2fe56b[_0x382452[_0x695b('0x2a')]]={'$like':'%'+_0x5350d6[_0x695b('0x33')]['filter']+'%'};return _0x2fe56b;}})});}_0x237620=_[_0x695b('0x3e')]({},_0x237620,_0x5350d6[_0x695b('0x40')]);var _0x4ec50a={'where':_0x237620['where']};return db[_0x695b('0x41')][_0x695b('0x1d')](_0x4ec50a)[_0x695b('0x24')](function(_0x44a463){_0x18f9e2[_0x695b('0x1d')]=_0x44a463;if(_0x5350d6['query']['includeAll']){_0x237620[_0x695b('0x42')]=[{'all':!![]}];}return db[_0x695b('0x41')][_0x695b('0x43')](_0x237620);})[_0x695b('0x24')](function(_0x3d7b4d){_0x18f9e2[_0x695b('0x44')]=_0x3d7b4d;return _0x18f9e2;})[_0x695b('0x24')](respondWithFilteredResult(_0x358c91,_0x237620))['catch'](handleError(_0x358c91,null));};exports[_0x695b('0x45')]=function(_0x33ce42,_0x182528){var _0x2836c0={'raw':!![],'where':{'id':_0x33ce42[_0x695b('0x46')]['id']}},_0x748bbc={};_0x748bbc['model']=_[_0x695b('0x34')](db['Pause'][_0x695b('0x2e')]);_0x748bbc['query']=_[_0x695b('0x34')](_0x33ce42[_0x695b('0x33')]);_0x748bbc[_0x695b('0x35')]=_[_0x695b('0x36')](_0x748bbc[_0x695b('0x32')],_0x748bbc[_0x695b('0x33')]);_0x2836c0[_0x695b('0x38')]=_[_0x695b('0x36')](_0x748bbc[_0x695b('0x32')],qs[_0x695b('0x37')](_0x33ce42[_0x695b('0x33')][_0x695b('0x37')]));_0x2836c0[_0x695b('0x38')]=_0x2836c0[_0x695b('0x38')]['length']?_0x2836c0[_0x695b('0x38')]:_0x748bbc[_0x695b('0x32')];if(_0x33ce42[_0x695b('0x33')][_0x695b('0x47')]){_0x2836c0['include']=[{'all':!![]}];}_0x2836c0=_['merge']({},_0x2836c0,_0x33ce42[_0x695b('0x40')]);return db[_0x695b('0x41')][_0x695b('0x48')](_0x2836c0)[_0x695b('0x24')](handleEntityNotFound(_0x182528,null))['then'](respondWithResult(_0x182528,null))[_0x695b('0x49')](handleError(_0x182528,null));};exports[_0x695b('0x4a')]=function(_0x3dba35,_0x3da231){return db[_0x695b('0x41')][_0x695b('0x4a')](_0x3dba35['body'],{})['then'](function(_0x225932){var _0xb685df=_0x3dba35['user'][_0x695b('0x26')]({'plain':!![]});if(!_0xb685df)throw new Error(_0x695b('0x4b'));if(_0xb685df[_0x695b('0x4c')]===_0x695b('0x4d')){var _0x1c18cd=_0x225932[_0x695b('0x26')]({'plain':!![]});var _0x13b776='Pauses';return db['UserProfileSection'][_0x695b('0x48')]({'where':{'name':_0x13b776,'userProfileId':_0xb685df[_0x695b('0x4e')]},'raw':!![]})[_0x695b('0x24')](function(_0xbb4875){if(_0xbb4875&&_0xbb4875[_0x695b('0x4f')]===0x0){return db[_0x695b('0x28')][_0x695b('0x4a')]({'name':_0x1c18cd[_0x695b('0x2a')],'resourceId':_0x1c18cd['id'],'type':_0xbb4875[_0x695b('0x2a')],'sectionId':_0xbb4875['id']},{})[_0x695b('0x24')](function(){return _0x225932;});}else{return _0x225932;}})[_0x695b('0x49')](function(_0x338411){logger[_0x695b('0x50')](_0x695b('0x51'),_0x338411);throw _0x338411;});}return _0x225932;})['then'](respondWithResult(_0x3da231,0xc9))[_0x695b('0x49')](handleError(_0x3da231,null));};exports['update']=function(_0x2e89b1,_0x5b7e61){if(_0x2e89b1['body']['id']){delete _0x2e89b1[_0x695b('0x52')]['id'];}return db[_0x695b('0x41')]['find']({'where':{'id':_0x2e89b1[_0x695b('0x46')]['id']}})['then'](handleEntityNotFound(_0x5b7e61,null))[_0x695b('0x24')](saveUpdates(_0x2e89b1[_0x695b('0x52')],null))['then'](respondWithResult(_0x5b7e61,null))[_0x695b('0x49')](handleError(_0x5b7e61,null));};exports[_0x695b('0x25')]=function(_0x27ab89,_0x1d8e66){return db['Pause'][_0x695b('0x48')]({'where':{'id':_0x27ab89['params']['id']}})['then'](handleEntityNotFound(_0x1d8e66,null))['then'](removeEntity(_0x1d8e66,null))[_0x695b('0x49')](handleError(_0x1d8e66,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index c646a0a..fe97d4d 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 _0x6aa7=['Pause','tools_pauses','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','define'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x6aa7,0x178));var _0x76aa=function(_0x3cf5f9,_0x4f34c8){_0x3cf5f9=_0x3cf5f9-0x0;var _0x213e96=_0x6aa7[_0x3cf5f9];return _0x213e96;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var logger=require(_0x76aa('0x1'))(_0x76aa('0x2'));var moment=require(_0x76aa('0x3'));var BPromise=require(_0x76aa('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x76aa('0x5'));var rimraf=require(_0x76aa('0x6'));var config=require(_0x76aa('0x7'));var attributes=require('./pause.attributes');module['exports']=function(_0x1aceaa,_0x4d53f6){return _0x1aceaa[_0x76aa('0x8')](_0x76aa('0x9'),attributes,{'tableName':_0x76aa('0xa'),'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(_0x11ec6c,_0x1a8169){var _0xb59506=function(_0x58e31d){while(--_0x58e31d){_0x11ec6c['push'](_0x11ec6c['shift']());}};_0xb59506(++_0x1a8169);}(_0x7217,0x19e));var _0x7721=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0x7217[_0xc6be3a];return _0x56a310;};'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 df361f2..340cf8b 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(_0x5d31ea,_0x53b4dd){var _0x2f1d25=function(_0x3f9a6e){while(--_0x3f9a6e){_0x5d31ea['push'](_0x5d31ea['shift']());}};_0x2f1d25(++_0x53b4dd);}(_0x7a54,0x106));var _0x47a5=function(_0x12ddfe,_0xc6e2a3){_0x12ddfe=_0x12ddfe-0x0;var _0x11d791=_0x7a54[_0x12ddfe];return _0x11d791;};'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(_0xb51043,_0xabad){var _0x25bbaa=function(_0x297659){while(--_0x297659){_0xb51043['push'](_0xb51043['shift']());}};_0x25bbaa(++_0xabad);}(_0xb10b,0x12a));var _0xbb10=function(_0x1653b1,_0x35b7d1){_0x1653b1=_0x1653b1-0x0;var _0x3e0b17=_0xb10b[_0x1653b1];return _0x3e0b17;};'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 75b092e..f23e9ec 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 _0x0b78=['multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./plugin.controller','index','/webhook','webhookGet','get','/:id','show','/:id/download','download','join','root','server/files/plugins','originalname','format','%s-%s%s','extname','now','post','single','file','upload','webhookPost','isAuthenticated','update','delete','exports'];(function(_0x1ccd37,_0x542c82){var _0x1eef50=function(_0x510fd5){while(--_0x510fd5){_0x1ccd37['push'](_0x1ccd37['shift']());}};_0x1eef50(++_0x542c82);}(_0x0b78,0x1ad));var _0x80b7=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x0b78[_0x19950b];return _0x3c6b41;};'use strict';var multer=require(_0x80b7('0x0'));var util=require(_0x80b7('0x1'));var path=require('path');var timeout=require(_0x80b7('0x2'));var express=require(_0x80b7('0x3'));var router=express['Router']();var fs_extra=require(_0x80b7('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x80b7('0x5'));var config=require(_0x80b7('0x6'));var controller=require(_0x80b7('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x80b7('0x8')]);router['get'](_0x80b7('0x9'),controller[_0x80b7('0xa')]);router[_0x80b7('0xb')](_0x80b7('0xc'),auth['isAuthenticated'](),controller[_0x80b7('0xd')]);router[_0x80b7('0xb')](_0x80b7('0xe'),auth['isAuthenticated'](),controller[_0x80b7('0xf')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2b1a00,_0x4599c1,_0x3b19da){_0x3b19da(null,path[_0x80b7('0x10')](config[_0x80b7('0x11')],_0x80b7('0x12')));},'filename':function(_0x3f8c16,_0x145241,_0x323d06){_0x145241[_0x80b7('0x13')]=_0x145241[_0x80b7('0x13')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x323d06(null,util[_0x80b7('0x14')](_0x80b7('0x15'),path['basename'](_0x145241[_0x80b7('0x13')],path[_0x80b7('0x16')](_0x145241['originalname'])),Date[_0x80b7('0x17')](),path[_0x80b7('0x16')](_0x145241[_0x80b7('0x13')])));}})});router[_0x80b7('0x18')]('/',upload[_0x80b7('0x19')](_0x80b7('0x1a')),controller[_0x80b7('0x1b')]);router[_0x80b7('0x18')](_0x80b7('0x9'),controller[_0x80b7('0x1c')]);router['put'](_0x80b7('0xc'),auth[_0x80b7('0x1d')](),controller[_0x80b7('0x1e')]);router[_0x80b7('0x1f')]('/:id',auth['isAuthenticated'](),controller[_0x80b7('0x1f')]);module[_0x80b7('0x20')]=router; \ No newline at end of file +var _0x6f0d=['delete','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','isAuthenticated','get','/webhook','webhookGet','show','/:id/download','download','join','server/files/plugins','originalname','replace','format','%s-%s%s','extname','now','post','single','file','upload','webhookPost','put','/:id','update'];(function(_0x2e913b,_0x4b7071){var _0x173899=function(_0x2a7d22){while(--_0x2a7d22){_0x2e913b['push'](_0x2e913b['shift']());}};_0x173899(++_0x4b7071);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x20bcc1,_0x626294){_0x20bcc1=_0x20bcc1-0x0;var _0xe46137=_0x6f0d[_0x20bcc1];return _0xe46137;};'use strict';var multer=require('multer');var util=require(_0xd6f0('0x0'));var path=require(_0xd6f0('0x1'));var timeout=require(_0xd6f0('0x2'));var express=require(_0xd6f0('0x3'));var router=express['Router']();var fs_extra=require(_0xd6f0('0x4'));var auth=require(_0xd6f0('0x5'));var interaction=require(_0xd6f0('0x6'));var config=require(_0xd6f0('0x7'));var controller=require(_0xd6f0('0x8'));router['get']('/',auth[_0xd6f0('0x9')](),controller['index']);router[_0xd6f0('0xa')](_0xd6f0('0xb'),controller[_0xd6f0('0xc')]);router[_0xd6f0('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xd6f0('0xd')]);router[_0xd6f0('0xa')](_0xd6f0('0xe'),auth[_0xd6f0('0x9')](),controller[_0xd6f0('0xf')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x136eee,_0xee144c,_0x329f69){_0x329f69(null,path[_0xd6f0('0x10')](config['root'],_0xd6f0('0x11')));},'filename':function(_0x2f0459,_0x306aad,_0x45973d){_0x306aad[_0xd6f0('0x12')]=_0x306aad[_0xd6f0('0x12')][_0xd6f0('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x45973d(null,util[_0xd6f0('0x14')](_0xd6f0('0x15'),path['basename'](_0x306aad[_0xd6f0('0x12')],path[_0xd6f0('0x16')](_0x306aad['originalname'])),Date[_0xd6f0('0x17')](),path['extname'](_0x306aad[_0xd6f0('0x12')])));}})});router[_0xd6f0('0x18')]('/',upload[_0xd6f0('0x19')](_0xd6f0('0x1a')),controller[_0xd6f0('0x1b')]);router[_0xd6f0('0x18')](_0xd6f0('0xb'),controller[_0xd6f0('0x1c')]);router[_0xd6f0('0x1d')](_0xd6f0('0x1e'),auth[_0xd6f0('0x9')](),controller[_0xd6f0('0x1f')]);router[_0xd6f0('0x20')](_0xd6f0('0x1e'),auth[_0xd6f0('0x9')](),controller[_0xd6f0('0x20')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index fc471e4..db91898 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 _0x1fb2=['agentOnly','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','ENUM','html','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'];(function(_0x43f0c6,_0x4b0dae){var _0x3f4ce6=function(_0x403257){while(--_0x403257){_0x43f0c6['push'](_0x43f0c6['shift']());}};_0x3f4ce6(++_0x4b0dae);}(_0x1fb2,0x18f));var _0x21fb=function(_0x44c8b7,_0x428566){_0x44c8b7=_0x44c8b7-0x0;var _0x54b70b=_0x1fb2[_0x44c8b7];return _0x54b70b;};'use strict';var Sequelize=require(_0x21fb('0x0'));module[_0x21fb('0x1')]={'name':{'type':Sequelize[_0x21fb('0x2')]},'type':{'type':Sequelize[_0x21fb('0x3')](_0x21fb('0x4'),'script')},'description':{'type':Sequelize[_0x21fb('0x5')]},'version':{'type':Sequelize[_0x21fb('0x5')]},'path':{'type':Sequelize['STRING'],'comment':_0x21fb('0x6')},'active':{'type':Sequelize[_0x21fb('0x7')],'defaultValue':0x0,'comment':_0x21fb('0x8')},'sidebar':{'type':Sequelize['ENUM']('adminOnly',_0x21fb('0x9'),_0x21fb('0xa'),'never'),'defaultValue':_0x21fb('0xa'),'comment':_0x21fb('0xb')},'icon':{'type':Sequelize[_0x21fb('0x2')]},'adminUrl':{'type':Sequelize[_0x21fb('0x2')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0x21fb('0x2')]},'scriptPath':{'type':Sequelize[_0x21fb('0x2')]}}; \ No newline at end of file +var _0x3ff3=['always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','ENUM','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','agentOnly'];(function(_0x2e649a,_0x31e1c0){var _0x383ab2=function(_0xe62058){while(--_0xe62058){_0x2e649a['push'](_0x2e649a['shift']());}};_0x383ab2(++_0x31e1c0);}(_0x3ff3,0x8f));var _0x33ff=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x3ff3[_0x2be8c2];return _0x97f531;};'use strict';var Sequelize=require(_0x33ff('0x0'));module[_0x33ff('0x1')]={'name':{'type':Sequelize[_0x33ff('0x2')]},'type':{'type':Sequelize[_0x33ff('0x3')](_0x33ff('0x4'),_0x33ff('0x5'))},'description':{'type':Sequelize[_0x33ff('0x6')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0x33ff('0x2')],'comment':_0x33ff('0x7')},'active':{'type':Sequelize[_0x33ff('0x8')],'defaultValue':0x0,'comment':_0x33ff('0x9')},'sidebar':{'type':Sequelize[_0x33ff('0x3')]('adminOnly',_0x33ff('0xa'),_0x33ff('0xb'),_0x33ff('0xc')),'defaultValue':_0x33ff('0xb'),'comment':_0x33ff('0xd')},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0x33ff('0x2')]},'scriptName':{'type':Sequelize[_0x33ff('0x2')]},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index b2e27b4..ead0d65 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 _0xd977=['Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','description','sidebar','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','encoding','method','%s%s','headers','content-length','content-type','statusCode','webhookPost','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','extract-zip','archiver','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','json','offset','undefined','count','set','apply','reject','then','destroy','get','Plugins','UserProfileResource','end','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','Plugin','include','rows','catch','params','includeAll','find','download','join','root','server/files/plugins','format','basename','createWriteStream','zip','warning','code','ENOENT','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','Sequelize','**/*','dirname','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Temporary\x20file\x20removed','upload','file','extname','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0xd977,0xce));var _0x7d97=function(_0x1b70f7,_0xd1d2c8){_0x1b70f7=_0x1b70f7-0x0;var _0x18f09f=_0xd977[_0x1b70f7];return _0x18f09f;};'use strict';var emlformat=require(_0x7d97('0x0'));var rimraf=require(_0x7d97('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7d97('0x2'));var moment=require(_0x7d97('0x3'));var BPromise=require(_0x7d97('0x4'));var Mustache=require('mustache');var util=require(_0x7d97('0x5'));var path=require(_0x7d97('0x6'));var sox=require(_0x7d97('0x7'));var csv=require(_0x7d97('0x8'));var ejs=require(_0x7d97('0x9'));var fs=require('fs');var fs_extra=require(_0x7d97('0xa'));var _=require(_0x7d97('0xb'));var squel=require(_0x7d97('0xc'));var crypto=require(_0x7d97('0xd'));var jsforce=require(_0x7d97('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7d97('0x8'));var querystring=require(_0x7d97('0xf'));var Papa=require(_0x7d97('0x10'));var extract=require(_0x7d97('0x11'));var rimraf=require(_0x7d97('0x1'));var archiver=require(_0x7d97('0x12'));var Redis=require(_0x7d97('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x7d97('0x14'));var as=require(_0x7d97('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7d97('0x16'))(_0x7d97('0x17'));var utils=require(_0x7d97('0x18'));var config=require(_0x7d97('0x19'));var licenseUtil=require(_0x7d97('0x1a'));var db=require(_0x7d97('0x1b'))['db'];config[_0x7d97('0x1c')]=_[_0x7d97('0x1d')](config['redis'],{'host':_0x7d97('0x1e'),'port':0x18eb});var socket=require(_0x7d97('0x1f'))(new Redis(config[_0x7d97('0x1c')]));require(_0x7d97('0x20'))[_0x7d97('0x21')](socket);function respondWithStatusCode(_0x3adfb3,_0x329a9b){_0x329a9b=_0x329a9b||0xcc;return function(_0xfef6c4){if(_0xfef6c4){return _0x3adfb3[_0x7d97('0x22')](_0x329a9b);}return _0x3adfb3[_0x7d97('0x23')](_0x329a9b)['end']();};}function respondWithResult(_0x43d16b,_0x329df3){_0x329df3=_0x329df3||0xc8;return function(_0x302696){if(_0x302696){return _0x43d16b['status'](_0x329df3)[_0x7d97('0x24')](_0x302696);}};}function respondWithFilteredResult(_0xf5b2f5,_0x4495e8){return function(_0x832ed3){if(_0x832ed3){var _0x304de9=typeof _0x4495e8[_0x7d97('0x25')]==='undefined'&&typeof _0x4495e8['limit']===_0x7d97('0x26');var _0x4a1d6e=_0x832ed3[_0x7d97('0x27')];var _0x511f9e=_0x304de9?0x0:_0x4495e8[_0x7d97('0x25')];var _0xc85135=_0x304de9?_0x832ed3[_0x7d97('0x27')]:_0x4495e8['offset']+_0x4495e8['limit'];var _0x2e185f;if(_0xc85135>=_0x4a1d6e){_0xc85135=_0x4a1d6e;_0x2e185f=0xc8;}else{_0x2e185f=0xce;}_0xf5b2f5[_0x7d97('0x23')](_0x2e185f);return _0xf5b2f5[_0x7d97('0x28')]('Content-Range',_0x511f9e+'-'+_0xc85135+'/'+_0x4a1d6e)[_0x7d97('0x24')](_0x832ed3);}return null;};}function patchUpdates(_0x11d1d2){return function(_0x420983){try{jsonpatch[_0x7d97('0x29')](_0x420983,_0x11d1d2,!![]);}catch(_0x222419){return BPromise[_0x7d97('0x2a')](_0x222419);}return _0x420983['save']();};}function saveUpdates(_0x3ffea5,_0x2482bd){return function(_0x2b4c48){if(_0x2b4c48){return _0x2b4c48['update'](_0x3ffea5)[_0x7d97('0x2b')](function(_0x2d215e){return _0x2d215e;});}return null;};}function removeEntity(_0x8e62a5,_0x223faf){return function(_0x446569){if(_0x446569){return _0x446569[_0x7d97('0x2c')]()[_0x7d97('0x2b')](function(){var _0x19ef8a=_0x446569[_0x7d97('0x2d')]({'plain':!![]});var _0x1b2104=_0x7d97('0x2e');return db[_0x7d97('0x2f')][_0x7d97('0x2c')]({'where':{'type':_0x1b2104,'resourceId':_0x19ef8a['id']}})[_0x7d97('0x2b')](function(){return _0x446569;});})[_0x7d97('0x2b')](function(){_0x8e62a5[_0x7d97('0x23')](0xcc)[_0x7d97('0x30')]();});}};}function handleEntityNotFound(_0x12169,_0x1c14dd){return function(_0x57606a){if(!_0x57606a){_0x12169[_0x7d97('0x22')](0x194);}return _0x57606a;};}function handleError(_0x408fd0,_0x537d4c){_0x537d4c=_0x537d4c||0x1f4;return function(_0x3604ad){logger[_0x7d97('0x31')](_0x3604ad['stack']);if(_0x3604ad['name']){delete _0x3604ad[_0x7d97('0x32')];}_0x408fd0[_0x7d97('0x23')](_0x537d4c)[_0x7d97('0x33')](_0x3604ad);};}exports[_0x7d97('0x34')]=function(_0x49de65,_0x266d31){var _0xa37e2={},_0x4c492e={},_0xa4a183={'count':0x0,'rows':[]};var _0x22c608=_[_0x7d97('0x35')](db['Plugin'][_0x7d97('0x36')],function(_0x10dc08){return{'name':_0x10dc08[_0x7d97('0x37')],'type':_0x10dc08[_0x7d97('0x38')][_0x7d97('0x39')]};});_0x4c492e[_0x7d97('0x3a')]=_['map'](_0x22c608,_0x7d97('0x32'));_0x4c492e[_0x7d97('0x3b')]=_[_0x7d97('0x3c')](_0x49de65[_0x7d97('0x3b')]);_0x4c492e[_0x7d97('0x3d')]=_[_0x7d97('0x3e')](_0x4c492e['model'],_0x4c492e[_0x7d97('0x3b')]);_0xa37e2[_0x7d97('0x3f')]=_[_0x7d97('0x3e')](_0x4c492e[_0x7d97('0x3a')],qs[_0x7d97('0x40')](_0x49de65[_0x7d97('0x3b')][_0x7d97('0x40')]));_0xa37e2[_0x7d97('0x3f')]=_0xa37e2[_0x7d97('0x3f')][_0x7d97('0x41')]?_0xa37e2[_0x7d97('0x3f')]:_0x4c492e['model'];if(!_0x49de65[_0x7d97('0x3b')]['hasOwnProperty']('nolimit')){_0xa37e2[_0x7d97('0x42')]=qs[_0x7d97('0x42')](_0x49de65[_0x7d97('0x3b')]['limit']);_0xa37e2[_0x7d97('0x25')]=qs[_0x7d97('0x25')](_0x49de65[_0x7d97('0x3b')][_0x7d97('0x25')]);}_0xa37e2[_0x7d97('0x43')]=qs[_0x7d97('0x44')](_0x49de65[_0x7d97('0x3b')][_0x7d97('0x44')]);_0xa37e2[_0x7d97('0x45')]=qs[_0x7d97('0x3d')](_[_0x7d97('0x46')](_0x49de65[_0x7d97('0x3b')],_0x4c492e[_0x7d97('0x3d')]),_0x22c608);if(_0x49de65[_0x7d97('0x3b')][_0x7d97('0x47')]){_0xa37e2[_0x7d97('0x45')]=_['merge'](_0xa37e2['where'],{'$or':_[_0x7d97('0x35')](_0x22c608,function(_0x2aeb5c){if(_0x2aeb5c[_0x7d97('0x38')]!==_0x7d97('0x48')){var _0x40a411={};_0x40a411[_0x2aeb5c[_0x7d97('0x32')]]={'$like':'%'+_0x49de65['query'][_0x7d97('0x47')]+'%'};return _0x40a411;}})});}_0xa37e2=_[_0x7d97('0x49')]({},_0xa37e2,_0x49de65[_0x7d97('0x4a')]);var _0x2fda0b={'where':_0xa37e2[_0x7d97('0x45')]};return db[_0x7d97('0x4b')][_0x7d97('0x27')](_0x2fda0b)['then'](function(_0x11b90a){_0xa4a183['count']=_0x11b90a;if(_0x49de65[_0x7d97('0x3b')]['includeAll']){_0xa37e2[_0x7d97('0x4c')]=[{'all':!![]}];}return db['Plugin']['findAll'](_0xa37e2);})[_0x7d97('0x2b')](function(_0x36e67b){_0xa4a183[_0x7d97('0x4d')]=_0x36e67b;return _0xa4a183;})['then'](respondWithFilteredResult(_0x266d31,_0xa37e2))[_0x7d97('0x4e')](handleError(_0x266d31,null));};exports['show']=function(_0x56f270,_0x43a301){var _0x1b4f4c={'raw':!![],'where':{'id':_0x56f270[_0x7d97('0x4f')]['id']}},_0x4ff9b9={};_0x4ff9b9[_0x7d97('0x3a')]=_[_0x7d97('0x3c')](db[_0x7d97('0x4b')][_0x7d97('0x36')]);_0x4ff9b9[_0x7d97('0x3b')]=_[_0x7d97('0x3c')](_0x56f270[_0x7d97('0x3b')]);_0x4ff9b9[_0x7d97('0x3d')]=_[_0x7d97('0x3e')](_0x4ff9b9[_0x7d97('0x3a')],_0x4ff9b9[_0x7d97('0x3b')]);_0x1b4f4c['attributes']=_['intersection'](_0x4ff9b9[_0x7d97('0x3a')],qs[_0x7d97('0x40')](_0x56f270[_0x7d97('0x3b')][_0x7d97('0x40')]));_0x1b4f4c[_0x7d97('0x3f')]=_0x1b4f4c[_0x7d97('0x3f')][_0x7d97('0x41')]?_0x1b4f4c[_0x7d97('0x3f')]:_0x4ff9b9[_0x7d97('0x3a')];if(_0x56f270['query'][_0x7d97('0x50')]){_0x1b4f4c[_0x7d97('0x4c')]=[{'all':!![]}];}_0x1b4f4c=_[_0x7d97('0x49')]({},_0x1b4f4c,_0x56f270[_0x7d97('0x4a')]);return db[_0x7d97('0x4b')][_0x7d97('0x51')](_0x1b4f4c)[_0x7d97('0x2b')](handleEntityNotFound(_0x43a301,null))[_0x7d97('0x2b')](respondWithResult(_0x43a301,null))[_0x7d97('0x4e')](handleError(_0x43a301,null));};exports[_0x7d97('0x52')]=function(_0x463248,_0x21ed83,_0x1a4407){return db[_0x7d97('0x4b')][_0x7d97('0x51')]({'where':{'id':_0x463248[_0x7d97('0x4f')]['id']},'attributes':[_0x7d97('0x32'),_0x7d97('0x6')],'raw':!![]})[_0x7d97('0x2b')](handleEntityNotFound(_0x21ed83,null))[_0x7d97('0x2b')](function(_0x560d0a){if(_0x560d0a){var _0x5bdde6=path[_0x7d97('0x53')](config[_0x7d97('0x54')],_0x7d97('0x55'),util[_0x7d97('0x56')]('%s.zip',path[_0x7d97('0x57')](_0x560d0a['path'])));var _0x2a507c=fs[_0x7d97('0x58')](_0x5bdde6);var _0x55e722=archiver(_0x7d97('0x59'),{'zlib':{'level':0x9}});_0x55e722['on'](_0x7d97('0x5a'),function(_0x5e4b99){if(_0x5e4b99[_0x7d97('0x5b')]===_0x7d97('0x5c')){logger[_0x7d97('0x31')](_0x5e4b99);}else{throw new db['Sequelize'][(_0x7d97('0x5d'))](_0x7d97('0x5e'));}});_0x55e722['on']('error',function(_0x4b7d4a){throw new db[(_0x7d97('0x5f'))][(_0x7d97('0x5d'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x55e722['pipe'](_0x2a507c);_0x55e722['glob'](_0x7d97('0x60'),{'cwd':path[_0x7d97('0x53')](config[_0x7d97('0x54')],_0x7d97('0x55'),path[_0x7d97('0x61')](_0x560d0a[_0x7d97('0x6')])),'ignore':[path[_0x7d97('0x53')](path[_0x7d97('0x57')](_0x560d0a[_0x7d97('0x6')]),_0x7d97('0x62')),path['join'](path[_0x7d97('0x57')](_0x560d0a['path']),_0x7d97('0x63'))],'nodir':!![]})[_0x7d97('0x64')]();_0x2a507c['on'](_0x7d97('0x65'),function(){if(!fs[_0x7d97('0x66')](_0x5bdde6)){throw new db[(_0x7d97('0x5f'))]['Error'](_0x7d97('0x67'));}return _0x21ed83[_0x7d97('0x52')](_0x5bdde6,util[_0x7d97('0x56')]('%s.zip',path[_0x7d97('0x57')](_0x560d0a[_0x7d97('0x6')])),function(_0x1979c3){if(_0x1979c3){throw new db[(_0x7d97('0x5f'))][(_0x7d97('0x5d'))](_0x7d97('0x68'));}fs[_0x7d97('0x69')](_0x5bdde6);logger[_0x7d97('0x6a')]('Download\x20completed');logger['info'](_0x7d97('0x6b'));});});}return null;})['catch'](handleError(_0x21ed83,null));};exports[_0x7d97('0x6c')]=function(_0x20a80b,_0x117c4d,_0xf3f2cd){var _0x406cff=path[_0x7d97('0x57')](_0x20a80b[_0x7d97('0x6d')]['filename'],path[_0x7d97('0x6e')](_0x20a80b[_0x7d97('0x6d')][_0x7d97('0x6f')]));var _0x2913eb=path[_0x7d97('0x53')](config[_0x7d97('0x54')],_0x7d97('0x55'),_0x20a80b[_0x7d97('0x6d')]['filename']);var _0x168ded=path[_0x7d97('0x53')](config[_0x7d97('0x54')],_0x7d97('0x55'),_0x406cff);logger[_0x7d97('0x6a')](_0x7d97('0x70'),_0x2913eb);logger[_0x7d97('0x6a')](_0x7d97('0x71'),_0x168ded);try{fs[_0x7d97('0x72')](_0x2913eb,parseInt(_0x7d97('0x73'),0x8));extract(_0x2913eb,{'dir':_0x168ded},function(_0x482676){if(_0x482676){logger['error'](_0x482676);handleError(_0x482676,!![]);};var _0x323dde=fs[_0x7d97('0x74')](_0x168ded);if(_0x323dde['length']>0x1){removeReferences(_0x2913eb,_0x168ded);logger[_0x7d97('0x31')](_0x7d97('0x75'));return _0xf3f2cd(new Error(_0x7d97('0x75')));}var _0x286822=fs[_0x7d97('0x76')](path['join'](_0x168ded,_0x323dde[0x0]));if(_0x286822[_0x7d97('0x77')]()){removeReferences(_0x2913eb,_0x168ded);logger['error']('Invalid\x20plugin\x20structure');return _0xf3f2cd(new Error(_0x7d97('0x75')));}if(_0x286822[_0x7d97('0x78')]()){var _0x632612=fs[_0x7d97('0x74')](path['join'](_0x168ded,_0x323dde[0x0]));if(_0x632612[_0x7d97('0x41')]===0x0){removeReferences(_0x2913eb,_0x168ded);logger['error']('Invalid\x20plugin\x20structure');return _0xf3f2cd(new Error(_0x7d97('0x75')));}var _0xafb681=_0x632612['some'](function(_0x5122f8){return _0x5122f8===_0x7d97('0x79');});if(!_0xafb681){return _0xf3f2cd(new Error(_0x7d97('0x7a')));}var _0x359fe5=fs[_0x7d97('0x7b')](path[_0x7d97('0x53')](_0x168ded,_0x323dde[0x0],_0x7d97('0x79')));var _0x4f1b95=JSON[_0x7d97('0x7c')](_0x359fe5);if('undefined'==typeof _0x4f1b95[_0x7d97('0x32')]){return _0xf3f2cd(new Error(_0x7d97('0x7d')));}if('undefined'==typeof _0x4f1b95[_0x7d97('0x38')]){return _0xf3f2cd(new Error(_0x7d97('0x7e')));}if(_0x7d97('0x26')==typeof _0x4f1b95[_0x7d97('0x7f')]){return _0xf3f2cd(new Error(_0x7d97('0x80')));}if('undefined'==typeof _0x4f1b95[_0x7d97('0x81')]){return _0xf3f2cd(new Error(_0x7d97('0x82')));}if(_0x4f1b95[_0x7d97('0x38')]===_0x7d97('0x83')){if(_0x7d97('0x26')==typeof _0x4f1b95[_0x7d97('0x81')][_0x7d97('0x84')]){return _0xf3f2cd(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0x7d97('0x26')==typeof _0x4f1b95[_0x7d97('0x81')][_0x7d97('0x84')][_0x7d97('0x85')]&&_0x7d97('0x26')==typeof _0x4f1b95[_0x7d97('0x81')]['views'][_0x7d97('0x86')]){return _0xf3f2cd(new Error(_0x7d97('0x87')));}}else if(_0x4f1b95['type']===_0x7d97('0x88')){if(_0x7d97('0x26')==typeof _0x4f1b95[_0x7d97('0x81')][_0x7d97('0x89')]){return _0xf3f2cd(new Error(_0x7d97('0x8a')));}if(_0x7d97('0x26')==typeof _0x4f1b95['parameters'][_0x7d97('0x8b')]){return _0xf3f2cd(new Error(_0x7d97('0x8c')));}}else{return _0xf3f2cd(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x4a5955=_0x4f1b95[_0x7d97('0x32')];var _0x2c3c08=_0x4f1b95[_0x7d97('0x8d')];var _0x2c4c19=_0x4f1b95[_0x7d97('0x38')];var _0x5b9e22=_0x4f1b95[_0x7d97('0x8e')]?_0x4f1b95[_0x7d97('0x8e')]:'always';var _0x211d16=_0x4f1b95['icon']?_0x4f1b95['icon']:'icon-apps';var _0x50265b='';var _0x8a6077='';var _0x5839b1='';var _0x1df709='';var _0x3a0611=_0x4f1b95['version'];if(_0x2c4c19===_0x7d97('0x83')){if(_0x7d97('0x26')!=typeof _0x4f1b95[_0x7d97('0x81')][_0x7d97('0x84')]['admin']){var _0xcf2535=_0x4f1b95[_0x7d97('0x81')]['views'][_0x7d97('0x85')];if(!/^(f|ht)tps?:\/\//i[_0x7d97('0x8f')](_0xcf2535)){_0x50265b=path[_0x7d97('0x53')](_0x7d97('0x90'),_0x406cff,_0x323dde[0x0],_0xcf2535);}else{_0x50265b=_0xcf2535;}}else{logger[_0x7d97('0x6a')](_0x7d97('0x91'));}if(_0x7d97('0x26')!=typeof _0x4f1b95[_0x7d97('0x81')][_0x7d97('0x84')][_0x7d97('0x86')]){var _0xf72057=_0x4f1b95['parameters'][_0x7d97('0x84')][_0x7d97('0x86')];if(!/^(f|ht)tps?:\/\//i[_0x7d97('0x8f')](_0xf72057)){_0x8a6077=path[_0x7d97('0x53')]('plugins',_0x406cff,_0x323dde[0x0],_0xf72057);}else{_0x8a6077=_0xf72057;}}else{logger['info'](_0x7d97('0x92'));}}else if(_0x2c4c19===_0x7d97('0x88')){_0x5839b1=_0x4f1b95['parameters'][_0x7d97('0x89')];_0x1df709=_0x4f1b95[_0x7d97('0x81')][_0x7d97('0x8b')];if(_0x7d97('0x26')!=typeof _0x4f1b95[_0x7d97('0x81')][_0x7d97('0x84')]){if('undefined'!=typeof _0x4f1b95[_0x7d97('0x81')][_0x7d97('0x84')][_0x7d97('0x85')]){var _0xcf2535=_0x4f1b95[_0x7d97('0x81')][_0x7d97('0x84')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x7d97('0x8f')](_0xcf2535)){_0x50265b=path['join']('plugins',_0x406cff,_0x323dde[0x0],_0xcf2535);}else{_0x50265b=_0xcf2535;}}if(_0x7d97('0x26')!=typeof _0x4f1b95[_0x7d97('0x81')][_0x7d97('0x84')][_0x7d97('0x86')]){var _0xf72057=_0x4f1b95[_0x7d97('0x81')][_0x7d97('0x84')][_0x7d97('0x86')];if(!/^(f|ht)tps?:\/\//i[_0x7d97('0x8f')](_0xf72057)){_0x8a6077=path[_0x7d97('0x53')](_0x7d97('0x90'),_0x406cff,_0x323dde[0x0],_0xf72057);}else{_0x8a6077=_0xf72057;}}}}var _0x313620={'name':_0x4a5955,'description':_0x2c3c08,'path':path[_0x7d97('0x53')](_0x406cff,_0x323dde[0x0]),'type':_0x2c4c19,'sidebar':_0x5b9e22,'icon':_0x211d16,'adminUrl':_0x50265b,'agentUrl':_0x8a6077,'scriptName':_0x5839b1,'scriptPath':_0x1df709,'version':_0x3a0611};removeReferences(_0x2913eb,null);return db[_0x7d97('0x4b')][_0x7d97('0x93')](_0x313620)['then'](function(_0x200c69){var _0x3ad6df={'role':_0x20a80b[_0x7d97('0x94')]['role'],'userProfileId':_0x20a80b[_0x7d97('0x94')]['userProfileId']};if(!_0x3ad6df)throw new Error(_0x7d97('0x95'));if(_0x3ad6df[_0x7d97('0x96')]===_0x7d97('0x97')){var _0x33e60b=_0x200c69[_0x7d97('0x2d')]({'plain':!![]});return db[_0x7d97('0x98')][_0x7d97('0x51')]({'where':{'name':_0x7d97('0x2e'),'userProfileId':_0x3ad6df[_0x7d97('0x99')]},'raw':!![]})[_0x7d97('0x2b')](function(_0x4b982a){if(_0x4b982a&&_0x4b982a[_0x7d97('0x9a')]===0x0){return db[_0x7d97('0x2f')][_0x7d97('0x93')]({'name':_0x33e60b[_0x7d97('0x32')],'resourceId':_0x33e60b['id'],'type':_0x4b982a[_0x7d97('0x32')],'sectionId':_0x4b982a['id']},{})[_0x7d97('0x2b')](function(){return _0x200c69;});}else{return _0x200c69;}})[_0x7d97('0x4e')](function(_0x3710eb){logger[_0x7d97('0x31')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3710eb);throw _0x3710eb;});}return _0x200c69;})['then'](respondWithResult(_0x117c4d,null))['catch'](handleError(_0x117c4d,null));}});}catch(_0x204bb3){_0x117c4d['status'](0x1f4)[_0x7d97('0x33')](_0x204bb3);}};function removeReferences(_0x2dba42,_0x585cff){try{if(_0x2dba42){fs['unlinkSync'](_0x2dba42);logger[_0x7d97('0x6a')](_0x7d97('0x9b'));}if(_0x585cff){rimraf(_0x585cff,function(){});logger[_0x7d97('0x6a')](_0x7d97('0x9c'));}}catch(_0x878f5e){logger[_0x7d97('0x31')](_0x878f5e);}}exports['update']=function(_0x267971,_0x24eac3,_0x16b606){return db[_0x7d97('0x4b')]['find']({'where':{'id':_0x267971[_0x7d97('0x4f')]['id']}})[_0x7d97('0x2b')](handleEntityNotFound(_0x24eac3,null))[_0x7d97('0x2b')](saveUpdates(_0x267971[_0x7d97('0x94')],null))[_0x7d97('0x2b')](respondWithResult(_0x24eac3,null))[_0x7d97('0x4e')](handleError(_0x24eac3,null));};exports[_0x7d97('0x9d')]=function(_0x3363eb,_0x5ca60a,_0x1ff359){return db[_0x7d97('0x4b')][_0x7d97('0x51')]({'where':{'id':_0x3363eb[_0x7d97('0x4f')]['id']}})[_0x7d97('0x2b')](function(_0xd9d7e6){if(_0xd9d7e6){return _0xd9d7e6[_0x7d97('0x2c')]();}})[_0x7d97('0x2b')](function(_0x3dbe3e){rimraf(path[_0x7d97('0x53')](config[_0x7d97('0x54')],_0x7d97('0x55'),path['dirname'](_0x3dbe3e['path'])),function(){});return _0x3dbe3e;})[_0x7d97('0x2b')](handleEntityNotFound(_0x5ca60a,null))[_0x7d97('0x2b')](respondWithStatusCode(_0x5ca60a,null))[_0x7d97('0x4e')](handleError(_0x5ca60a,null));};exports[_0x7d97('0x9e')]=function(_0xe4c1f,_0x30840f,_0x5dc422){return BPromise[_0x7d97('0x9f')]()[_0x7d97('0x2b')](function(){if(!_0xe4c1f[_0x7d97('0x3b')][_0x7d97('0x6')]){throw new Error(_0x7d97('0xa0'));}if(!_0xe4c1f[_0x7d97('0x3b')][_0x7d97('0xa1')]){throw new Error(_0x7d97('0xa2'));}var _0x8e418e=_0xe4c1f[_0x7d97('0x3b')][_0x7d97('0xa3')]?_0xe4c1f[_0x7d97('0x3b')][_0x7d97('0xa3')]+':'+_0xe4c1f[_0x7d97('0x3b')][_0x7d97('0xa1')]:'http://localhost:'+_0xe4c1f['query']['port'];var _0x122ecf=_0xe4c1f[_0x7d97('0x3b')][_0x7d97('0x24')]?_0xe4c1f[_0x7d97('0x3b')][_0x7d97('0x24')]:!![];var _0x37da4a=_0xe4c1f[_0x7d97('0x3b')][_0x7d97('0xa4')]?_0xe4c1f[_0x7d97('0x3b')][_0x7d97('0xa4')]:null;var _0x13d8c2={'method':_0xe4c1f[_0x7d97('0xa5')],'uri':util[_0x7d97('0x56')](_0x7d97('0xa6'),_0x8e418e,_0xe4c1f[_0x7d97('0x3b')][_0x7d97('0x6')]),'json':_0x122ecf,'resolveWithFullResponse':!![],'encoding':_0x37da4a,'qs':_0xe4c1f['query']};if(_0xe4c1f[_0x7d97('0xa7')]){_0x13d8c2[_0x7d97('0xa7')]=_0xe4c1f['headers'];if(_0x13d8c2['headers'][_0x7d97('0xa8')]){delete _0x13d8c2[_0x7d97('0xa7')][_0x7d97('0xa8')];}}if(_0x13d8c2['headers'][_0x7d97('0xa9')]){delete _0x13d8c2[_0x7d97('0xa7')][_0x7d97('0xa9')];}return rp(_0x13d8c2);})[_0x7d97('0x2b')](function(_0x370b2b){if(_0x370b2b){_0x30840f[_0x7d97('0x28')](_0x370b2b['headers']);logger[_0x7d97('0x6a')](_0x370b2b[_0x7d97('0x94')]);if(_['endsWith'](_0xe4c1f[_0x7d97('0x3b')][_0x7d97('0x6')],_0x7d97('0x52'))&&_0x370b2b[_0x7d97('0xaa')]==0x1f4){return _0x30840f['sendStatus'](_0x370b2b[_0x7d97('0xaa')]);}else{return _0x30840f[_0x7d97('0x23')](_0x370b2b[_0x7d97('0xaa')])[_0x7d97('0x33')](_0x370b2b[_0x7d97('0x94')]);}}else{return _0x30840f[_0x7d97('0x22')](0xc8);}})[_0x7d97('0x4e')](handleError(_0x30840f,null));};exports[_0x7d97('0xab')]=function(_0x253ddb,_0x807309,_0x3bc50b){return BPromise[_0x7d97('0x9f')]()[_0x7d97('0x2b')](function(){if(!_0x253ddb[_0x7d97('0x3b')][_0x7d97('0x6')]){throw new Error(_0x7d97('0xa0'));}if(!_0x253ddb['query'][_0x7d97('0xa1')]){throw new Error(_0x7d97('0xa2'));}var _0x51a821=_0x253ddb[_0x7d97('0x3b')][_0x7d97('0xa3')]?_0x253ddb[_0x7d97('0x3b')]['hostname']+':'+_0x253ddb[_0x7d97('0x3b')][_0x7d97('0xa1')]:'http://localhost:'+_0x253ddb[_0x7d97('0x3b')][_0x7d97('0xa1')];var _0x24786e=_0x253ddb[_0x7d97('0x3b')][_0x7d97('0x24')]?_0x253ddb['query']['json']:!![];var _0x3b2e18=_0x253ddb[_0x7d97('0x3b')][_0x7d97('0xa4')]?_0x253ddb[_0x7d97('0x3b')][_0x7d97('0xa4')]:null;var _0x1a8644={'method':_0x253ddb[_0x7d97('0xa5')],'uri':util[_0x7d97('0x56')]('%s%s',_0x51a821,_0x253ddb[_0x7d97('0x3b')][_0x7d97('0x6')]),'json':_0x24786e,'resolveWithFullResponse':!![],'encoding':_0x3b2e18,'body':_0x253ddb[_0x7d97('0x94')]};if(_0x253ddb[_0x7d97('0xa7')]){_0x1a8644['headers']=_0x253ddb[_0x7d97('0xa7')];if(_0x1a8644[_0x7d97('0xa7')][_0x7d97('0xa8')]){delete _0x1a8644['headers'][_0x7d97('0xa8')];}}if(_0x1a8644['headers']['content-type']){delete _0x1a8644[_0x7d97('0xa7')][_0x7d97('0xa9')];}return rp(_0x1a8644);})[_0x7d97('0x2b')](function(_0x124522){if(_0x124522){_0x807309[_0x7d97('0x28')](_0x124522[_0x7d97('0xa7')]);logger['info'](_0x124522[_0x7d97('0x94')]);return _0x807309['status'](_0x124522['statusCode'])['send'](_0x124522[_0x7d97('0x94')]);}else{return _0x807309[_0x7d97('0x22')](0xc8);}})[_0x7d97('0x4e')](handleError(_0x807309,null));}; \ No newline at end of file +var _0x9f87=['format','%s.zip','basename','createWriteStream','zip','warning','code','ENOENT','error','Sequelize','Error\x20while\x20generating\x20the\x20zip\x20archive','Error','glob','**/*','node_modules/**/*','attachments/**/*','finalize','existsSync','unlinkSync','info','upload','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','isFile','isDirectory','Plugin\x20manifest\x20missing','manifest.json','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20parameters\x20missing','parameters','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','html','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Extracted\x20folder\x20removed','delete','webhookGet','\x27PATH\x27\x20parameter\x20not\x20specified','port','hostname','json','encoding','method','headers','content-length','content-type','set','endsWith','statusCode','webhookPost','resolve','\x27PORT\x27\x20parameter\x20not\x20specified','%s%s','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','socket.io-emitter','./plugin.socket','register','sendStatus','status','end','offset','undefined','limit','count','Content-Range','apply','reject','save','then','get','Plugins','destroy','name','send','index','map','Plugin','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','include','findAll','rows','show','params','options','catch','find','join','root','server/files/plugins'];(function(_0xd307d9,_0x50e8e0){var _0x209bf8=function(_0x335069){while(--_0x335069){_0xd307d9['push'](_0xd307d9['shift']());}};_0x209bf8(++_0x50e8e0);}(_0x9f87,0x1af));var _0x79f8=function(_0x115a07,_0xc16ec1){_0x115a07=_0x115a07-0x0;var _0x5a8ead=_0x9f87[_0x115a07];return _0x5a8ead;};'use strict';var emlformat=require(_0x79f8('0x0'));var rimraf=require(_0x79f8('0x1'));var zipdir=require(_0x79f8('0x2'));var jsonpatch=require(_0x79f8('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x79f8('0x4'));var Mustache=require(_0x79f8('0x5'));var util=require('util');var path=require(_0x79f8('0x6'));var sox=require(_0x79f8('0x7'));var csv=require(_0x79f8('0x8'));var ejs=require(_0x79f8('0x9'));var fs=require('fs');var fs_extra=require(_0x79f8('0xa'));var _=require(_0x79f8('0xb'));var squel=require(_0x79f8('0xc'));var crypto=require(_0x79f8('0xd'));var jsforce=require(_0x79f8('0xe'));var deskjs=require(_0x79f8('0xf'));var toCsv=require(_0x79f8('0x8'));var querystring=require(_0x79f8('0x10'));var Papa=require('papaparse');var extract=require(_0x79f8('0x11'));var rimraf=require(_0x79f8('0x1'));var archiver=require(_0x79f8('0x12'));var Redis=require(_0x79f8('0x13'));var authService=require(_0x79f8('0x14'));var qs=require(_0x79f8('0x15'));var as=require(_0x79f8('0x16'));var hardwareService=require(_0x79f8('0x17'));var logger=require(_0x79f8('0x18'))(_0x79f8('0x19'));var utils=require(_0x79f8('0x1a'));var config=require(_0x79f8('0x1b'));var licenseUtil=require(_0x79f8('0x1c'));var db=require('../../mysqldb')['db'];config[_0x79f8('0x1d')]=_['defaults'](config[_0x79f8('0x1d')],{'host':'localhost','port':0x18eb});var socket=require(_0x79f8('0x1e'))(new Redis(config[_0x79f8('0x1d')]));require(_0x79f8('0x1f'))[_0x79f8('0x20')](socket);function respondWithStatusCode(_0x4c3cbc,_0xd4bdb5){_0xd4bdb5=_0xd4bdb5||0xcc;return function(_0x706e30){if(_0x706e30){return _0x4c3cbc[_0x79f8('0x21')](_0xd4bdb5);}return _0x4c3cbc[_0x79f8('0x22')](_0xd4bdb5)[_0x79f8('0x23')]();};}function respondWithResult(_0x2a4202,_0x1523e0){_0x1523e0=_0x1523e0||0xc8;return function(_0x4f8cab){if(_0x4f8cab){return _0x2a4202['status'](_0x1523e0)['json'](_0x4f8cab);}};}function respondWithFilteredResult(_0x1dcd18,_0x378efe){return function(_0x177713){if(_0x177713){var _0x24517d=typeof _0x378efe[_0x79f8('0x24')]===_0x79f8('0x25')&&typeof _0x378efe[_0x79f8('0x26')]===_0x79f8('0x25');var _0x25bce4=_0x177713['count'];var _0x5898d5=_0x24517d?0x0:_0x378efe['offset'];var _0x24ac19=_0x24517d?_0x177713[_0x79f8('0x27')]:_0x378efe[_0x79f8('0x24')]+_0x378efe[_0x79f8('0x26')];var _0x51c3e6;if(_0x24ac19>=_0x25bce4){_0x24ac19=_0x25bce4;_0x51c3e6=0xc8;}else{_0x51c3e6=0xce;}_0x1dcd18[_0x79f8('0x22')](_0x51c3e6);return _0x1dcd18['set'](_0x79f8('0x28'),_0x5898d5+'-'+_0x24ac19+'/'+_0x25bce4)['json'](_0x177713);}return null;};}function patchUpdates(_0x2336e4){return function(_0x46b862){try{jsonpatch[_0x79f8('0x29')](_0x46b862,_0x2336e4,!![]);}catch(_0x31d20b){return BPromise[_0x79f8('0x2a')](_0x31d20b);}return _0x46b862[_0x79f8('0x2b')]();};}function saveUpdates(_0x1a5899,_0x526ec3){return function(_0x1d1de5){if(_0x1d1de5){return _0x1d1de5['update'](_0x1a5899)[_0x79f8('0x2c')](function(_0x1f9745){return _0x1f9745;});}return null;};}function removeEntity(_0x42e395,_0x4905cb){return function(_0x1516f1){if(_0x1516f1){return _0x1516f1['destroy']()[_0x79f8('0x2c')](function(){var _0x46662e=_0x1516f1[_0x79f8('0x2d')]({'plain':!![]});var _0x3e3c32=_0x79f8('0x2e');return db['UserProfileResource'][_0x79f8('0x2f')]({'where':{'type':_0x3e3c32,'resourceId':_0x46662e['id']}})[_0x79f8('0x2c')](function(){return _0x1516f1;});})[_0x79f8('0x2c')](function(){_0x42e395[_0x79f8('0x22')](0xcc)[_0x79f8('0x23')]();});}};}function handleEntityNotFound(_0x38c1f3,_0x1179ae){return function(_0x2aada5){if(!_0x2aada5){_0x38c1f3[_0x79f8('0x21')](0x194);}return _0x2aada5;};}function handleError(_0x334cc2,_0x2bc751){_0x2bc751=_0x2bc751||0x1f4;return function(_0x51788d){logger['error'](_0x51788d['stack']);if(_0x51788d['name']){delete _0x51788d[_0x79f8('0x30')];}_0x334cc2[_0x79f8('0x22')](_0x2bc751)[_0x79f8('0x31')](_0x51788d);};}exports[_0x79f8('0x32')]=function(_0x9b4682,_0x245e91){var _0x52f873={},_0x3ac5a0={},_0x1d2eeb={'count':0x0,'rows':[]};var _0x5e51e7=_[_0x79f8('0x33')](db[_0x79f8('0x34')][_0x79f8('0x35')],function(_0x66d6e1){return{'name':_0x66d6e1[_0x79f8('0x36')],'type':_0x66d6e1[_0x79f8('0x37')][_0x79f8('0x38')]};});_0x3ac5a0[_0x79f8('0x39')]=_['map'](_0x5e51e7,'name');_0x3ac5a0[_0x79f8('0x3a')]=_[_0x79f8('0x3b')](_0x9b4682[_0x79f8('0x3a')]);_0x3ac5a0[_0x79f8('0x3c')]=_['intersection'](_0x3ac5a0['model'],_0x3ac5a0['query']);_0x52f873[_0x79f8('0x3d')]=_[_0x79f8('0x3e')](_0x3ac5a0[_0x79f8('0x39')],qs[_0x79f8('0x3f')](_0x9b4682['query'][_0x79f8('0x3f')]));_0x52f873[_0x79f8('0x3d')]=_0x52f873[_0x79f8('0x3d')][_0x79f8('0x40')]?_0x52f873[_0x79f8('0x3d')]:_0x3ac5a0[_0x79f8('0x39')];if(!_0x9b4682[_0x79f8('0x3a')][_0x79f8('0x41')](_0x79f8('0x42'))){_0x52f873[_0x79f8('0x26')]=qs[_0x79f8('0x26')](_0x9b4682[_0x79f8('0x3a')][_0x79f8('0x26')]);_0x52f873['offset']=qs[_0x79f8('0x24')](_0x9b4682[_0x79f8('0x3a')][_0x79f8('0x24')]);}_0x52f873[_0x79f8('0x43')]=qs[_0x79f8('0x44')](_0x9b4682['query']['sort']);_0x52f873[_0x79f8('0x45')]=qs[_0x79f8('0x3c')](_[_0x79f8('0x46')](_0x9b4682[_0x79f8('0x3a')],_0x3ac5a0[_0x79f8('0x3c')]),_0x5e51e7);if(_0x9b4682[_0x79f8('0x3a')]['filter']){_0x52f873[_0x79f8('0x45')]=_['merge'](_0x52f873[_0x79f8('0x45')],{'$or':_['map'](_0x5e51e7,function(_0x1df0d1){if(_0x1df0d1[_0x79f8('0x37')]!==_0x79f8('0x47')){var _0x4e99b7={};_0x4e99b7[_0x1df0d1[_0x79f8('0x30')]]={'$like':'%'+_0x9b4682[_0x79f8('0x3a')][_0x79f8('0x48')]+'%'};return _0x4e99b7;}})});}_0x52f873=_[_0x79f8('0x49')]({},_0x52f873,_0x9b4682['options']);var _0xac3658={'where':_0x52f873['where']};return db['Plugin'][_0x79f8('0x27')](_0xac3658)['then'](function(_0x584c6f){_0x1d2eeb['count']=_0x584c6f;if(_0x9b4682[_0x79f8('0x3a')]['includeAll']){_0x52f873[_0x79f8('0x4a')]=[{'all':!![]}];}return db[_0x79f8('0x34')][_0x79f8('0x4b')](_0x52f873);})[_0x79f8('0x2c')](function(_0x373fe8){_0x1d2eeb[_0x79f8('0x4c')]=_0x373fe8;return _0x1d2eeb;})[_0x79f8('0x2c')](respondWithFilteredResult(_0x245e91,_0x52f873))['catch'](handleError(_0x245e91,null));};exports[_0x79f8('0x4d')]=function(_0x5ea285,_0x457618){var _0x33079c={'raw':!![],'where':{'id':_0x5ea285[_0x79f8('0x4e')]['id']}},_0x4fe0a7={};_0x4fe0a7[_0x79f8('0x39')]=_['keys'](db[_0x79f8('0x34')][_0x79f8('0x35')]);_0x4fe0a7[_0x79f8('0x3a')]=_[_0x79f8('0x3b')](_0x5ea285['query']);_0x4fe0a7[_0x79f8('0x3c')]=_['intersection'](_0x4fe0a7['model'],_0x4fe0a7[_0x79f8('0x3a')]);_0x33079c['attributes']=_[_0x79f8('0x3e')](_0x4fe0a7[_0x79f8('0x39')],qs[_0x79f8('0x3f')](_0x5ea285[_0x79f8('0x3a')]['fields']));_0x33079c[_0x79f8('0x3d')]=_0x33079c[_0x79f8('0x3d')]['length']?_0x33079c[_0x79f8('0x3d')]:_0x4fe0a7[_0x79f8('0x39')];if(_0x5ea285[_0x79f8('0x3a')]['includeAll']){_0x33079c[_0x79f8('0x4a')]=[{'all':!![]}];}_0x33079c=_[_0x79f8('0x49')]({},_0x33079c,_0x5ea285[_0x79f8('0x4f')]);return db[_0x79f8('0x34')]['find'](_0x33079c)[_0x79f8('0x2c')](handleEntityNotFound(_0x457618,null))[_0x79f8('0x2c')](respondWithResult(_0x457618,null))[_0x79f8('0x50')](handleError(_0x457618,null));};exports['download']=function(_0x252833,_0x4c6a4a,_0x283150){return db[_0x79f8('0x34')][_0x79f8('0x51')]({'where':{'id':_0x252833[_0x79f8('0x4e')]['id']},'attributes':[_0x79f8('0x30'),_0x79f8('0x6')],'raw':!![]})['then'](handleEntityNotFound(_0x4c6a4a,null))[_0x79f8('0x2c')](function(_0x15bb5c){if(_0x15bb5c){var _0x263bf4=path[_0x79f8('0x52')](config[_0x79f8('0x53')],_0x79f8('0x54'),util[_0x79f8('0x55')](_0x79f8('0x56'),path[_0x79f8('0x57')](_0x15bb5c[_0x79f8('0x6')])));var _0x55bd4d=fs[_0x79f8('0x58')](_0x263bf4);var _0x57ab63=archiver(_0x79f8('0x59'),{'zlib':{'level':0x9}});_0x57ab63['on'](_0x79f8('0x5a'),function(_0x4990a0){if(_0x4990a0[_0x79f8('0x5b')]===_0x79f8('0x5c')){logger[_0x79f8('0x5d')](_0x4990a0);}else{throw new db[(_0x79f8('0x5e'))]['Error'](_0x79f8('0x5f'));}});_0x57ab63['on'](_0x79f8('0x5d'),function(_0x5631d0){throw new db[(_0x79f8('0x5e'))][(_0x79f8('0x60'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x57ab63['pipe'](_0x55bd4d);_0x57ab63[_0x79f8('0x61')](_0x79f8('0x62'),{'cwd':path[_0x79f8('0x52')](config[_0x79f8('0x53')],_0x79f8('0x54'),path['dirname'](_0x15bb5c['path'])),'ignore':[path['join'](path['basename'](_0x15bb5c['path']),_0x79f8('0x63')),path[_0x79f8('0x52')](path[_0x79f8('0x57')](_0x15bb5c[_0x79f8('0x6')]),_0x79f8('0x64'))],'nodir':!![]})[_0x79f8('0x65')]();_0x55bd4d['on']('close',function(){if(!fs[_0x79f8('0x66')](_0x263bf4)){throw new db[(_0x79f8('0x5e'))][(_0x79f8('0x60'))]('Plugin\x20not\x20found');}return _0x4c6a4a['download'](_0x263bf4,util[_0x79f8('0x55')](_0x79f8('0x56'),path[_0x79f8('0x57')](_0x15bb5c[_0x79f8('0x6')])),function(_0x5b4a34){if(_0x5b4a34){throw new db[(_0x79f8('0x5e'))][(_0x79f8('0x60'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0x79f8('0x67')](_0x263bf4);logger[_0x79f8('0x68')]('Download\x20completed');logger[_0x79f8('0x68')]('Temporary\x20file\x20removed');});});}return null;})[_0x79f8('0x50')](handleError(_0x4c6a4a,null));};exports[_0x79f8('0x69')]=function(_0x26f398,_0x182519,_0x5dfa50){var _0xb9e2e5=path[_0x79f8('0x57')](_0x26f398[_0x79f8('0x6a')][_0x79f8('0x6b')],path[_0x79f8('0x6c')](_0x26f398[_0x79f8('0x6a')][_0x79f8('0x6b')]));var _0x26e97d=path[_0x79f8('0x52')](config[_0x79f8('0x53')],_0x79f8('0x54'),_0x26f398['file'][_0x79f8('0x6b')]);var _0x11097b=path[_0x79f8('0x52')](config[_0x79f8('0x53')],_0x79f8('0x54'),_0xb9e2e5);logger[_0x79f8('0x68')](_0x79f8('0x6d'),_0x26e97d);logger['info'](_0x79f8('0x6e'),_0x11097b);try{fs[_0x79f8('0x6f')](_0x26e97d,parseInt(_0x79f8('0x70'),0x8));extract(_0x26e97d,{'dir':_0x11097b},function(_0xd4bb06){if(_0xd4bb06){logger[_0x79f8('0x5d')](_0xd4bb06);handleError(_0xd4bb06,!![]);};var _0x54d24b=fs[_0x79f8('0x71')](_0x11097b);if(_0x54d24b[_0x79f8('0x40')]>0x1){removeReferences(_0x26e97d,_0x11097b);logger[_0x79f8('0x5d')]('Invalid\x20plugin\x20structure');return _0x5dfa50(new Error(_0x79f8('0x72')));}var _0x56a51f=fs['lstatSync'](path['join'](_0x11097b,_0x54d24b[0x0]));if(_0x56a51f[_0x79f8('0x73')]()){removeReferences(_0x26e97d,_0x11097b);logger[_0x79f8('0x5d')](_0x79f8('0x72'));return _0x5dfa50(new Error(_0x79f8('0x72')));}if(_0x56a51f[_0x79f8('0x74')]()){var _0x1eeefb=fs['readdirSync'](path[_0x79f8('0x52')](_0x11097b,_0x54d24b[0x0]));if(_0x1eeefb[_0x79f8('0x40')]===0x0){removeReferences(_0x26e97d,_0x11097b);logger['error']('Invalid\x20plugin\x20structure');return _0x5dfa50(new Error(_0x79f8('0x72')));}var _0x228d03=_0x1eeefb['some'](function(_0x4f9c49){return _0x4f9c49==='manifest.json';});if(!_0x228d03){return _0x5dfa50(new Error(_0x79f8('0x75')));}var _0x3b5e11=fs['readFileSync'](path['join'](_0x11097b,_0x54d24b[0x0],_0x79f8('0x76')));var _0x4e4f28=JSON[_0x79f8('0x77')](_0x3b5e11);if(_0x79f8('0x25')==typeof _0x4e4f28['name']){return _0x5dfa50(new Error(_0x79f8('0x78')));}if('undefined'==typeof _0x4e4f28[_0x79f8('0x37')]){return _0x5dfa50(new Error(_0x79f8('0x79')));}if('undefined'==typeof _0x4e4f28[_0x79f8('0x7a')]){return _0x5dfa50(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if('undefined'==typeof _0x4e4f28['parameters']){return _0x5dfa50(new Error(_0x79f8('0x7b')));}if(_0x4e4f28[_0x79f8('0x37')]==='html'){if(_0x79f8('0x25')==typeof _0x4e4f28[_0x79f8('0x7c')][_0x79f8('0x7d')]){return _0x5dfa50(new Error(_0x79f8('0x7e')));}if(_0x79f8('0x25')==typeof _0x4e4f28[_0x79f8('0x7c')][_0x79f8('0x7d')][_0x79f8('0x7f')]&&_0x79f8('0x25')==typeof _0x4e4f28[_0x79f8('0x7c')][_0x79f8('0x7d')][_0x79f8('0x80')]){return _0x5dfa50(new Error(_0x79f8('0x81')));}}else if(_0x4e4f28[_0x79f8('0x37')]===_0x79f8('0x82')){if(_0x79f8('0x25')==typeof _0x4e4f28['parameters']['scriptName']){return _0x5dfa50(new Error(_0x79f8('0x83')));}if(_0x79f8('0x25')==typeof _0x4e4f28[_0x79f8('0x7c')][_0x79f8('0x84')]){return _0x5dfa50(new Error(_0x79f8('0x85')));}}else{return _0x5dfa50(new Error(_0x79f8('0x86')));}var _0x48990b=_0x4e4f28['name'];var _0x14bc14=_0x4e4f28[_0x79f8('0x87')];var _0x34757a=_0x4e4f28[_0x79f8('0x37')];var _0x5cde35=_0x4e4f28[_0x79f8('0x88')]?_0x4e4f28[_0x79f8('0x88')]:_0x79f8('0x89');var _0x24c44e=_0x4e4f28[_0x79f8('0x8a')]?_0x4e4f28['icon']:_0x79f8('0x8b');var _0x5d2787='';var _0x437066='';var _0x33d046='';var _0x63c463='';var _0x6bcb8c=_0x4e4f28[_0x79f8('0x7a')];if(_0x34757a===_0x79f8('0x8c')){if(_0x79f8('0x25')!=typeof _0x4e4f28['parameters'][_0x79f8('0x7d')]['admin']){var _0x1109cb=_0x4e4f28[_0x79f8('0x7c')]['views']['admin'];if(!/^(f|ht)tps?:\/\//i[_0x79f8('0x8d')](_0x1109cb)){_0x5d2787=path[_0x79f8('0x52')](_0x79f8('0x8e'),_0xb9e2e5,_0x54d24b[0x0],_0x1109cb);}else{_0x5d2787=_0x1109cb;}}else{logger[_0x79f8('0x68')](_0x79f8('0x8f'));}if(_0x79f8('0x25')!=typeof _0x4e4f28[_0x79f8('0x7c')][_0x79f8('0x7d')]['agent']){var _0x4e05ec=_0x4e4f28['parameters'][_0x79f8('0x7d')][_0x79f8('0x80')];if(!/^(f|ht)tps?:\/\//i[_0x79f8('0x8d')](_0x4e05ec)){_0x437066=path[_0x79f8('0x52')](_0x79f8('0x8e'),_0xb9e2e5,_0x54d24b[0x0],_0x4e05ec);}else{_0x437066=_0x4e05ec;}}else{logger['info'](_0x79f8('0x90'));}}else if(_0x34757a===_0x79f8('0x82')){_0x33d046=_0x4e4f28[_0x79f8('0x7c')]['scriptName'];_0x63c463=_0x4e4f28[_0x79f8('0x7c')]['scriptPath'];if(_0x79f8('0x25')!=typeof _0x4e4f28[_0x79f8('0x7c')][_0x79f8('0x7d')]){if('undefined'!=typeof _0x4e4f28[_0x79f8('0x7c')]['views'][_0x79f8('0x7f')]){var _0x1109cb=_0x4e4f28[_0x79f8('0x7c')][_0x79f8('0x7d')][_0x79f8('0x7f')];if(!/^(f|ht)tps?:\/\//i[_0x79f8('0x8d')](_0x1109cb)){_0x5d2787=path['join'](_0x79f8('0x8e'),_0xb9e2e5,_0x54d24b[0x0],_0x1109cb);}else{_0x5d2787=_0x1109cb;}}if('undefined'!=typeof _0x4e4f28[_0x79f8('0x7c')][_0x79f8('0x7d')][_0x79f8('0x80')]){var _0x4e05ec=_0x4e4f28['parameters']['views'][_0x79f8('0x80')];if(!/^(f|ht)tps?:\/\//i[_0x79f8('0x8d')](_0x4e05ec)){_0x437066=path[_0x79f8('0x52')](_0x79f8('0x8e'),_0xb9e2e5,_0x54d24b[0x0],_0x4e05ec);}else{_0x437066=_0x4e05ec;}}}}var _0x49f5bf={'name':_0x48990b,'description':_0x14bc14,'path':path['join'](_0xb9e2e5,_0x54d24b[0x0]),'type':_0x34757a,'sidebar':_0x5cde35,'icon':_0x24c44e,'adminUrl':_0x5d2787,'agentUrl':_0x437066,'scriptName':_0x33d046,'scriptPath':_0x63c463,'version':_0x6bcb8c};removeReferences(_0x26e97d,null);return db[_0x79f8('0x34')][_0x79f8('0x91')](_0x49f5bf)[_0x79f8('0x2c')](function(_0x2e92a0){var _0x4d82e6={'role':_0x26f398[_0x79f8('0x92')][_0x79f8('0x93')],'userProfileId':_0x26f398[_0x79f8('0x92')][_0x79f8('0x94')]};if(!_0x4d82e6)throw new Error(_0x79f8('0x95'));if(_0x4d82e6['role']===_0x79f8('0x96')){var _0xc769=_0x2e92a0[_0x79f8('0x2d')]({'plain':!![]});return db[_0x79f8('0x97')][_0x79f8('0x51')]({'where':{'name':_0x79f8('0x2e'),'userProfileId':_0x4d82e6[_0x79f8('0x94')]},'raw':!![]})[_0x79f8('0x2c')](function(_0x30c2af){if(_0x30c2af&&_0x30c2af['autoAssociation']===0x0){return db['UserProfileResource'][_0x79f8('0x91')]({'name':_0xc769[_0x79f8('0x30')],'resourceId':_0xc769['id'],'type':_0x30c2af[_0x79f8('0x30')],'sectionId':_0x30c2af['id']},{})[_0x79f8('0x2c')](function(){return _0x2e92a0;});}else{return _0x2e92a0;}})[_0x79f8('0x50')](function(_0x273668){logger[_0x79f8('0x5d')](_0x79f8('0x98'),_0x273668);throw _0x273668;});}return _0x2e92a0;})['then'](respondWithResult(_0x182519,null))[_0x79f8('0x50')](handleError(_0x182519,null));}});}catch(_0x484e72){_0x182519[_0x79f8('0x22')](0x1f4)['send'](_0x484e72);}};function removeReferences(_0x4b947e,_0x144dc0){try{if(_0x4b947e){fs[_0x79f8('0x67')](_0x4b947e);logger[_0x79f8('0x68')]('Zip\x20archive\x20removed');}if(_0x144dc0){rimraf(_0x144dc0,function(){});logger[_0x79f8('0x68')](_0x79f8('0x99'));}}catch(_0x3320b5){logger['error'](_0x3320b5);}}exports['update']=function(_0xa463b2,_0x97100c,_0x230c2b){return db[_0x79f8('0x34')]['find']({'where':{'id':_0xa463b2[_0x79f8('0x4e')]['id']}})[_0x79f8('0x2c')](handleEntityNotFound(_0x97100c,null))[_0x79f8('0x2c')](saveUpdates(_0xa463b2[_0x79f8('0x92')],null))[_0x79f8('0x2c')](respondWithResult(_0x97100c,null))[_0x79f8('0x50')](handleError(_0x97100c,null));};exports[_0x79f8('0x9a')]=function(_0x21142e,_0x187c1a,_0x2f0256){return db[_0x79f8('0x34')]['find']({'where':{'id':_0x21142e[_0x79f8('0x4e')]['id']}})[_0x79f8('0x2c')](function(_0x43d2bc){if(_0x43d2bc){return _0x43d2bc[_0x79f8('0x2f')]();}})[_0x79f8('0x2c')](function(_0x2f4e61){rimraf(path[_0x79f8('0x52')](config[_0x79f8('0x53')],_0x79f8('0x54'),path['dirname'](_0x2f4e61['path'])),function(){});return _0x2f4e61;})['then'](handleEntityNotFound(_0x187c1a,null))[_0x79f8('0x2c')](respondWithStatusCode(_0x187c1a,null))[_0x79f8('0x50')](handleError(_0x187c1a,null));};exports[_0x79f8('0x9b')]=function(_0x248c74,_0x3810bd,_0x477727){return BPromise['resolve']()[_0x79f8('0x2c')](function(){if(!_0x248c74[_0x79f8('0x3a')][_0x79f8('0x6')]){throw new Error(_0x79f8('0x9c'));}if(!_0x248c74[_0x79f8('0x3a')][_0x79f8('0x9d')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x349bf1=_0x248c74[_0x79f8('0x3a')][_0x79f8('0x9e')]?_0x248c74[_0x79f8('0x3a')]['hostname']+':'+_0x248c74[_0x79f8('0x3a')][_0x79f8('0x9d')]:'http://localhost:'+_0x248c74['query']['port'];var _0x2f0749=_0x248c74[_0x79f8('0x3a')][_0x79f8('0x9f')]?_0x248c74[_0x79f8('0x3a')][_0x79f8('0x9f')]:!![];var _0x5b4176=_0x248c74[_0x79f8('0x3a')][_0x79f8('0xa0')]?_0x248c74[_0x79f8('0x3a')][_0x79f8('0xa0')]:null;var _0x781491={'method':_0x248c74[_0x79f8('0xa1')],'uri':util[_0x79f8('0x55')]('%s%s',_0x349bf1,_0x248c74['query'][_0x79f8('0x6')]),'json':_0x2f0749,'resolveWithFullResponse':!![],'encoding':_0x5b4176,'qs':_0x248c74[_0x79f8('0x3a')]};if(_0x248c74[_0x79f8('0xa2')]){_0x781491[_0x79f8('0xa2')]=_0x248c74['headers'];if(_0x781491[_0x79f8('0xa2')][_0x79f8('0xa3')]){delete _0x781491[_0x79f8('0xa2')]['content-length'];}}if(_0x781491[_0x79f8('0xa2')][_0x79f8('0xa4')]){delete _0x781491[_0x79f8('0xa2')][_0x79f8('0xa4')];}return rp(_0x781491);})['then'](function(_0x5dccdf){if(_0x5dccdf){_0x3810bd[_0x79f8('0xa5')](_0x5dccdf[_0x79f8('0xa2')]);logger[_0x79f8('0x68')](_0x5dccdf[_0x79f8('0x92')]);if(_[_0x79f8('0xa6')](_0x248c74['query'][_0x79f8('0x6')],'download')&&_0x5dccdf[_0x79f8('0xa7')]==0x1f4){return _0x3810bd[_0x79f8('0x21')](_0x5dccdf['statusCode']);}else{return _0x3810bd[_0x79f8('0x22')](_0x5dccdf[_0x79f8('0xa7')])[_0x79f8('0x31')](_0x5dccdf[_0x79f8('0x92')]);}}else{return _0x3810bd[_0x79f8('0x21')](0xc8);}})[_0x79f8('0x50')](handleError(_0x3810bd,null));};exports[_0x79f8('0xa8')]=function(_0x14ca48,_0x2dc5af,_0x12826e){return BPromise[_0x79f8('0xa9')]()[_0x79f8('0x2c')](function(){if(!_0x14ca48['query'][_0x79f8('0x6')]){throw new Error(_0x79f8('0x9c'));}if(!_0x14ca48['query'][_0x79f8('0x9d')]){throw new Error(_0x79f8('0xaa'));}var _0x2d5b9e=_0x14ca48['query']['hostname']?_0x14ca48[_0x79f8('0x3a')][_0x79f8('0x9e')]+':'+_0x14ca48[_0x79f8('0x3a')][_0x79f8('0x9d')]:'http://localhost:'+_0x14ca48[_0x79f8('0x3a')]['port'];var _0x7839a4=_0x14ca48[_0x79f8('0x3a')]['json']?_0x14ca48[_0x79f8('0x3a')][_0x79f8('0x9f')]:!![];var _0x30ce47=_0x14ca48[_0x79f8('0x3a')]['encoding']?_0x14ca48['query']['encoding']:null;var _0x3dddd5={'method':_0x14ca48[_0x79f8('0xa1')],'uri':util[_0x79f8('0x55')](_0x79f8('0xab'),_0x2d5b9e,_0x14ca48['query'][_0x79f8('0x6')]),'json':_0x7839a4,'resolveWithFullResponse':!![],'encoding':_0x30ce47,'body':_0x14ca48[_0x79f8('0x92')]};if(_0x14ca48[_0x79f8('0xa2')]){_0x3dddd5[_0x79f8('0xa2')]=_0x14ca48[_0x79f8('0xa2')];if(_0x3dddd5[_0x79f8('0xa2')][_0x79f8('0xa3')]){delete _0x3dddd5[_0x79f8('0xa2')][_0x79f8('0xa3')];}}if(_0x3dddd5[_0x79f8('0xa2')][_0x79f8('0xa4')]){delete _0x3dddd5[_0x79f8('0xa2')][_0x79f8('0xa4')];}return rp(_0x3dddd5);})['then'](function(_0x31b465){if(_0x31b465){_0x2dc5af['set'](_0x31b465[_0x79f8('0xa2')]);logger[_0x79f8('0x68')](_0x31b465['body']);return _0x2dc5af[_0x79f8('0x22')](_0x31b465[_0x79f8('0xa7')])['send'](_0x31b465[_0x79f8('0x92')]);}else{return _0x2dc5af['sendStatus'](0xc8);}})['catch'](handleError(_0x2dc5af,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index a70cf71..3841671 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 _0x4300=['hasOwnProperty','exports','events','update','remove','emit'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0x4300,0x1a6));var _0x0430=function(_0x8ddb51,_0x1c283b){_0x8ddb51=_0x8ddb51-0x0;var _0x3873fe=_0x4300[_0x8ddb51];return _0x3873fe;};'use strict';var EventEmitter=require(_0x0430('0x0'));var Plugin=require('../../mysqldb')['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x0430('0x1'),'afterDestroy':_0x0430('0x2')};function emitEvent(_0x1c139f){return function(_0x2a1e62,_0x1735aa,_0x5d0aac){PluginEvents[_0x0430('0x3')](_0x1c139f+':'+_0x2a1e62['id'],_0x2a1e62);PluginEvents['emit'](_0x1c139f,_0x2a1e62);_0x5d0aac(null);};}for(var e in events){if(events[_0x0430('0x4')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0x0430('0x5')]=PluginEvents; \ No newline at end of file +var _0xe558=['hook','exports','events','../../mysqldb','Plugin','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x3b3e93,_0x314b02){var _0x12edf9=function(_0x1b2e95){while(--_0x1b2e95){_0x3b3e93['push'](_0x3b3e93['shift']());}};_0x12edf9(++_0x314b02);}(_0xe558,0x70));var _0x8e55=function(_0x3abdf0,_0xe5a075){_0x3abdf0=_0x3abdf0-0x0;var _0x20c869=_0xe558[_0x3abdf0];return _0x20c869;};'use strict';var EventEmitter=require(_0x8e55('0x0'));var Plugin=require(_0x8e55('0x1'))['db'][_0x8e55('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x8e55('0x3')](0x0);var events={'afterCreate':_0x8e55('0x4'),'afterUpdate':_0x8e55('0x5'),'afterDestroy':_0x8e55('0x6')};function emitEvent(_0x3a5285){return function(_0x28c870,_0x5bc807,_0xf125cc){PluginEvents[_0x8e55('0x7')](_0x3a5285+':'+_0x28c870['id'],_0x28c870);PluginEvents[_0x8e55('0x7')](_0x3a5285,_0x28c870);_0xf125cc(null);};}for(var e in events){if(events[_0x8e55('0x8')](e)){var event=events[e];Plugin[_0x8e55('0x9')](e,emitEvent(event));}}module[_0x8e55('0xa')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 3ed8d82..11b94b0 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 _0x8840=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./plugin.attributes','exports','define','Plugin','plugins','lodash','util','../../config/logger'];(function(_0x8838cf,_0x1e6b3e){var _0x19b8f2=function(_0x2f1395){while(--_0x2f1395){_0x8838cf['push'](_0x8838cf['shift']());}};_0x19b8f2(++_0x1e6b3e);}(_0x8840,0x15b));var _0x0884=function(_0xa1b5fb,_0x41a2bd){_0xa1b5fb=_0xa1b5fb-0x0;var _0x123597=_0x8840[_0xa1b5fb];return _0x123597;};'use strict';var _=require(_0x0884('0x0'));var util=require(_0x0884('0x1'));var logger=require(_0x0884('0x2'))(_0x0884('0x3'));var moment=require(_0x0884('0x4'));var BPromise=require(_0x0884('0x5'));var rp=require(_0x0884('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0884('0x7'));var config=require(_0x0884('0x8'));var attributes=require(_0x0884('0x9'));module[_0x0884('0xa')]=function(_0x4dfa82,_0x45a820){return _0x4dfa82[_0x0884('0xb')](_0x0884('0xc'),attributes,{'tableName':_0x0884('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x20b5=['Plugin','plugins','lodash','util','../../config/logger','api','bluebird','path','../../config/environment','./plugin.attributes'];(function(_0x346c65,_0x2f399d){var _0x1f0bb2=function(_0x5fed1b){while(--_0x5fed1b){_0x346c65['push'](_0x346c65['shift']());}};_0x1f0bb2(++_0x2f399d);}(_0x20b5,0x11a));var _0x520b=function(_0x485b27,_0x2bd241){_0x485b27=_0x485b27-0x0;var _0x430601=_0x20b5[_0x485b27];return _0x430601;};'use strict';var _=require(_0x520b('0x0'));var util=require(_0x520b('0x1'));var logger=require(_0x520b('0x2'))(_0x520b('0x3'));var moment=require('moment');var BPromise=require(_0x520b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x520b('0x5'));var rimraf=require('rimraf');var config=require(_0x520b('0x6'));var attributes=require(_0x520b('0x7'));module['exports']=function(_0x13c11c,_0x23795f){return _0x13c11c['define'](_0x520b('0x8'),attributes,{'tableName':_0x520b('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 001020b..9859300 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 _0xc0c0=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','./plugin.socket','register','then','Plugin,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','Plugin','create','options','raw','CreatePlugin','catch'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xc0c0,0x136));var _0x0c0c=function(_0x1a9204,_0x1c9e00){_0x1a9204=_0x1a9204-0x0;var _0x17ca68=_0xc0c0[_0x1a9204];return _0x17ca68;};'use strict';var _=require(_0x0c0c('0x0'));var util=require(_0x0c0c('0x1'));var moment=require(_0x0c0c('0x2'));var BPromise=require(_0x0c0c('0x3'));var rs=require(_0x0c0c('0x4'));var fs=require('fs');var Redis=require(_0x0c0c('0x5'));var db=require(_0x0c0c('0x6'))['db'];var utils=require(_0x0c0c('0x7'));var logger=require('../../config/logger')(_0x0c0c('0x8'));var config=require(_0x0c0c('0x9'));var jayson=require(_0x0c0c('0xa'));var client=jayson['client'][_0x0c0c('0xb')]({'port':0x232a});config[_0x0c0c('0xc')]=_[_0x0c0c('0xd')](config[_0x0c0c('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0c0c('0xe'))[_0x0c0c('0xf')](socket);function respondWithRpcPromise(_0x38840e,_0x1761bc,_0x48ba72){return new BPromise(function(_0x55084a,_0x20e6ec){return client['request'](_0x38840e,_0x48ba72)[_0x0c0c('0x10')](function(_0xe2aff3){logger['info'](_0x0c0c('0x11'),_0x1761bc,_0x0c0c('0x12'));logger[_0x0c0c('0x13')]('Plugin,\x20%s,\x20%s,\x20%s',_0x1761bc,_0x0c0c('0x12'),JSON['stringify'](_0xe2aff3));if(_0xe2aff3['error']){if(_0xe2aff3[_0x0c0c('0x14')][_0x0c0c('0x15')]===0x1f4){logger[_0x0c0c('0x14')]('Plugin,\x20%s,\x20%s',_0x1761bc,_0xe2aff3[_0x0c0c('0x14')][_0x0c0c('0x16')]);return _0x20e6ec(_0xe2aff3['error'][_0x0c0c('0x16')]);}logger['error'](_0x0c0c('0x11'),_0x1761bc,_0xe2aff3[_0x0c0c('0x14')][_0x0c0c('0x16')]);return _0x55084a(_0xe2aff3[_0x0c0c('0x14')][_0x0c0c('0x16')]);}else{logger[_0x0c0c('0x17')](_0x0c0c('0x11'),_0x1761bc,_0x0c0c('0x12'));_0x55084a(_0xe2aff3[_0x0c0c('0x18')]['message']);}})['catch'](function(_0x383e0c){logger[_0x0c0c('0x14')](_0x0c0c('0x11'),_0x1761bc,_0x383e0c);_0x20e6ec(_0x383e0c);});});}exports['CreatePlugin']=function(_0x36f578){var _0x54af47=this;return new Promise(function(_0x3b5eeb,_0x4be3d8){return db[_0x0c0c('0x19')][_0x0c0c('0x1a')](_0x36f578['body'],{'raw':_0x36f578[_0x0c0c('0x1b')]?_0x36f578[_0x0c0c('0x1b')][_0x0c0c('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0xa81e79){logger[_0x0c0c('0x17')](_0x0c0c('0x1d'),_0x36f578);logger[_0x0c0c('0x13')](_0x0c0c('0x1d'),_0x36f578,JSON['stringify'](_0xa81e79));_0x3b5eeb(_0xa81e79);})[_0x0c0c('0x1e')](function(_0x1125bd){logger[_0x0c0c('0x14')](_0x0c0c('0x1d'),_0x1125bd[_0x0c0c('0x16')],_0x36f578);_0x4be3d8(_0x54af47[_0x0c0c('0x14')](0x1f4,_0x1125bd['message']));});});}; \ No newline at end of file +var _0x15ba=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','redis','localhost','socket.io-emitter','./plugin.socket','request','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CreatePlugin','Plugin','create','body','raw','then','catch','lodash','util','moment'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x15ba,0x1bd));var _0xa15b=function(_0x2aa0e7,_0x4e5145){_0x2aa0e7=_0x2aa0e7-0x0;var _0x1472c0=_0x15ba[_0x2aa0e7];return _0x1472c0;};'use strict';var _=require(_0xa15b('0x0'));var util=require(_0xa15b('0x1'));var moment=require(_0xa15b('0x2'));var BPromise=require(_0xa15b('0x3'));var rs=require(_0xa15b('0x4'));var fs=require('fs');var Redis=require(_0xa15b('0x5'));var db=require(_0xa15b('0x6'))['db'];var utils=require(_0xa15b('0x7'));var logger=require(_0xa15b('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa15b('0x9')][_0xa15b('0xa')]({'port':0x232a});config[_0xa15b('0xb')]=_['defaults'](config[_0xa15b('0xb')],{'host':_0xa15b('0xc'),'port':0x18eb});var socket=require(_0xa15b('0xd'))(new Redis(config[_0xa15b('0xb')]));require(_0xa15b('0xe'))['register'](socket);function respondWithRpcPromise(_0x2be7bd,_0x2ba842,_0x2da36d){return new BPromise(function(_0x452d01,_0x479150){return client[_0xa15b('0xf')](_0x2be7bd,_0x2da36d)['then'](function(_0x56b57e){logger[_0xa15b('0x10')](_0xa15b('0x11'),_0x2ba842,_0xa15b('0x12'));logger[_0xa15b('0x13')](_0xa15b('0x14'),_0x2ba842,_0xa15b('0x12'),JSON[_0xa15b('0x15')](_0x56b57e));if(_0x56b57e[_0xa15b('0x16')]){if(_0x56b57e[_0xa15b('0x16')][_0xa15b('0x17')]===0x1f4){logger[_0xa15b('0x16')]('Plugin,\x20%s,\x20%s',_0x2ba842,_0x56b57e[_0xa15b('0x16')][_0xa15b('0x18')]);return _0x479150(_0x56b57e[_0xa15b('0x16')][_0xa15b('0x18')]);}logger[_0xa15b('0x16')]('Plugin,\x20%s,\x20%s',_0x2ba842,_0x56b57e[_0xa15b('0x16')][_0xa15b('0x18')]);return _0x452d01(_0x56b57e[_0xa15b('0x16')][_0xa15b('0x18')]);}else{logger[_0xa15b('0x10')](_0xa15b('0x11'),_0x2ba842,_0xa15b('0x12'));_0x452d01(_0x56b57e['result'][_0xa15b('0x18')]);}})['catch'](function(_0x10f3eb){logger[_0xa15b('0x16')](_0xa15b('0x11'),_0x2ba842,_0x10f3eb);_0x479150(_0x10f3eb);});});}exports[_0xa15b('0x19')]=function(_0x5bdd86){var _0x2c4585=this;return new Promise(function(_0x80125c,_0x1f8c51){return db[_0xa15b('0x1a')][_0xa15b('0x1b')](_0x5bdd86[_0xa15b('0x1c')],{'raw':_0x5bdd86['options']?_0x5bdd86['options'][_0xa15b('0x1d')]===undefined?!![]:![]:!![]})[_0xa15b('0x1e')](function(_0x2f7714){logger['info'](_0xa15b('0x19'),_0x5bdd86);logger[_0xa15b('0x13')](_0xa15b('0x19'),_0x5bdd86,JSON[_0xa15b('0x15')](_0x2f7714));_0x80125c(_0x2f7714);})[_0xa15b('0x1f')](function(_0x553267){logger[_0xa15b('0x16')](_0xa15b('0x19'),_0x553267[_0xa15b('0x18')],_0x5bdd86);_0x1f8c51(_0x2c4585[_0xa15b('0x16')](0x1f4,_0x553267[_0xa15b('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 4e99e2f..e1cb74b 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 _0xfd17=['./plugin.events','save','remove','emit','register','plugin:'];(function(_0x1616e2,_0x342e3e){var _0x6db66a=function(_0x5e6628){while(--_0x5e6628){_0x1616e2['push'](_0x1616e2['shift']());}};_0x6db66a(++_0x342e3e);}(_0xfd17,0x14a));var _0x7fd1=function(_0x290694,_0x281935){_0x290694=_0x290694-0x0;var _0x5a0f2e=_0xfd17[_0x290694];return _0x5a0f2e;};'use strict';var PluginEvents=require(_0x7fd1('0x0'));var events=[_0x7fd1('0x1'),_0x7fd1('0x2'),'update'];function createListener(_0x409808,_0x7ec61b){return function(_0x582ff4){_0x7ec61b[_0x7fd1('0x3')](_0x409808,_0x582ff4);};}function removeListener(_0x283291,_0x34c7e6){return function(){PluginEvents['removeListener'](_0x283291,_0x34c7e6);};}exports[_0x7fd1('0x4')]=function(_0x1da62d){for(var _0x8bfc5f=0x0,_0x4e7423=events['length'];_0x8bfc5f<_0x4e7423;_0x8bfc5f++){var _0x916b22=events[_0x8bfc5f];var _0x1e1d6f=createListener(_0x7fd1('0x5')+_0x916b22,_0x1da62d);PluginEvents['on'](_0x916b22,_0x1e1d6f);}}; \ No newline at end of file +var _0xd7cc=['register','length','./plugin.events','save','remove','update','emit','removeListener'];(function(_0x30faec,_0x18940b){var _0x29484f=function(_0x169ae8){while(--_0x169ae8){_0x30faec['push'](_0x30faec['shift']());}};_0x29484f(++_0x18940b);}(_0xd7cc,0x15a));var _0xcd7c=function(_0x10fe98,_0x7a9dac){_0x10fe98=_0x10fe98-0x0;var _0x30688d=_0xd7cc[_0x10fe98];return _0x30688d;};'use strict';var PluginEvents=require(_0xcd7c('0x0'));var events=[_0xcd7c('0x1'),_0xcd7c('0x2'),_0xcd7c('0x3')];function createListener(_0x478048,_0x212dfb){return function(_0x40bf10){_0x212dfb[_0xcd7c('0x4')](_0x478048,_0x40bf10);};}function removeListener(_0x5a7081,_0x5165f3){return function(){PluginEvents[_0xcd7c('0x5')](_0x5a7081,_0x5165f3);};}exports[_0xcd7c('0x6')]=function(_0x344ce6){for(var _0x307e85=0x0,_0x4f9ec0=events[_0xcd7c('0x7')];_0x307e85<_0x4f9ec0;_0x307e85++){var _0x4d0b87=events[_0x307e85];var _0x1cb13d=createListener('plugin:'+_0x4d0b87,_0x344ce6);PluginEvents['on'](_0x4d0b87,_0x1cb13d);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index db07641..81eca13 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(_0x1bde05,_0x1966e0){var _0x171cfd=function(_0x2f7e21){while(--_0x2f7e21){_0x1bde05['push'](_0x1bde05['shift']());}};_0x171cfd(++_0x1966e0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'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(_0x21e369,_0x3a59aa){var _0x5cd76f=function(_0xdeca54){while(--_0xdeca54){_0x21e369['push'](_0x21e369['shift']());}};_0x5cd76f(++_0x3a59aa);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'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 02b27dd..2d91062 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 _0xbdb7=['status','send','npm\x20install','info','index','list','then','express','motion2','length','catch','describe','params','body','join','../../files/plugins','script','cwd','chdir','dirname','start','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty','Unknown\x20status','destroy','delete','lodash','../../config/pm2','../../config/logger','api','path','child_process','exec','bluebird','stack','name'];(function(_0x28a5d6,_0x5180e3){var _0x805d1e=function(_0x5b2dbb){while(--_0x5b2dbb){_0x28a5d6['push'](_0x28a5d6['shift']());}};_0x805d1e(++_0x5180e3);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x455e82,_0x522f6f){_0x455e82=_0x455e82-0x0;var _0x2d0520=_0xbdb7[_0x455e82];return _0x2d0520;};'use strict';var _=require(_0x7bdb('0x0'));var pm2=require(_0x7bdb('0x1'));var logger=require(_0x7bdb('0x2'))(_0x7bdb('0x3'));var path=require(_0x7bdb('0x4'));var exec=require(_0x7bdb('0x5'))[_0x7bdb('0x6')];var BPromise=require(_0x7bdb('0x7'));function handleEntityNotFound(_0x46c068,_0x47aec5){return function(_0x28542c){if(!_0x28542c){_0x46c068['sendStatus'](0x194);;}return _0x28542c;};}function respondWithResult(_0x4b5fff,_0xffdc86){_0xffdc86=_0xffdc86||0xc8;return function(_0x1e23a3){if(_0x1e23a3){return _0x4b5fff['status'](_0xffdc86)['json'](_0x1e23a3);}return null;};}function handleError(_0x468041,_0x11a877){_0x11a877=_0x11a877||0x1f4;return function(_0x530f81){logger['error'](_0x530f81[_0x7bdb('0x8')]);if(_0x530f81[_0x7bdb('0x9')]){delete _0x530f81[_0x7bdb('0x9')];}_0x468041[_0x7bdb('0xa')](_0x11a877)[_0x7bdb('0xb')](_0x530f81);};}function execChildProcess(){return new BPromise(function(_0x144ff7,_0x297724){exec(_0x7bdb('0xc'),function(_0x5462da,_0x4e5b8e,_0x52b9b9){logger[_0x7bdb('0xd')](_0x4e5b8e);logger[_0x7bdb('0xd')](_0x52b9b9);if(_0x5462da){logger['error'](_0x5462da);return _0x297724(_0x5462da);}return _0x144ff7(_0x4e5b8e);});});}exports[_0x7bdb('0xe')]=function(_0x53021d,_0x5898c1){return pm2[_0x7bdb('0xf')]()[_0x7bdb('0x10')](function(_0x4fd91a){if(_0x4fd91a){var _0x50eeca=_['reject'](_0x4fd91a,function(_0x4476ff){return _0x4476ff[_0x7bdb('0x9')]===_0x7bdb('0x11')||_0x4476ff[_0x7bdb('0x9')]===_0x7bdb('0x12');});return{'rows':_0x50eeca,'count':_0x50eeca[_0x7bdb('0x13')]};}return null;})[_0x7bdb('0x10')](respondWithResult(_0x5898c1,null))[_0x7bdb('0x14')](handleError(_0x5898c1,null));};exports['show']=function(_0x1c5750,_0x43f352){return pm2[_0x7bdb('0x15')](_0x1c5750[_0x7bdb('0x16')]['id'])['then'](respondWithResult(_0x43f352,null))[_0x7bdb('0x10')](handleEntityNotFound(_0x43f352,null))[_0x7bdb('0x14')](handleError(_0x43f352,null));};exports['create']=function(_0x3e5f8e,_0x31f78e){if(_0x3e5f8e[_0x7bdb('0x17')][_0x7bdb('0x9')]&&_0x3e5f8e[_0x7bdb('0x17')]['script']){var _0x49f353=path[_0x7bdb('0x18')](__dirname,_0x7bdb('0x19'),_0x3e5f8e['body'][_0x7bdb('0x1a')]);var _0x118ea1=process[_0x7bdb('0x1b')]();process[_0x7bdb('0x1c')](path[_0x7bdb('0x1d')](_0x49f353));return execChildProcess()['then'](function(_0x1d37ac){process[_0x7bdb('0x1c')](_0x118ea1);return pm2[_0x7bdb('0x1e')]({'name':_0x3e5f8e[_0x7bdb('0x17')]['name'],'script':_0x49f353});})['then'](function(_0x3c423f){pm2['dump']();return _0x3c423f[0x0];})['then'](respondWithResult(_0x31f78e,0xc9))['catch'](handleError(_0x31f78e,null));}else{return _0x31f78e[_0x7bdb('0xa')](0x1f4)['send']({'message':_0x7bdb('0x1f')});}};exports[_0x7bdb('0x20')]=function(_0x3ec129,_0x7c09cf){if(_0x3ec129[_0x7bdb('0x17')]['id']){delete _0x3ec129['body']['id'];}var _0x10e818={'online':_0x7bdb('0x21'),'stopped':_0x7bdb('0x22')};if(_0x10e818[_0x7bdb('0x23')](_0x3ec129[_0x7bdb('0x17')][_0x7bdb('0xa')])){return pm2[_0x10e818[_0x3ec129[_0x7bdb('0x17')][_0x7bdb('0xa')]]](_0x3ec129[_0x7bdb('0x16')]['id'])[_0x7bdb('0x10')](respondWithResult(_0x7c09cf,0xc8))[_0x7bdb('0x14')](handleError(_0x7c09cf,null));}else{return _0x7c09cf[_0x7bdb('0xa')](0x1f4)['send']({'message':_0x7bdb('0x24')});}};exports[_0x7bdb('0x25')]=function(_0x8f7672,_0x9f5c1){if(_0x8f7672[_0x7bdb('0x17')]['id']){delete _0x8f7672['body']['id'];}if(_0x8f7672[_0x7bdb('0x16')]['id']){return pm2[_0x7bdb('0x26')](_0x8f7672[_0x7bdb('0x16')]['id'])[_0x7bdb('0x10')](function(_0x58c6b7){pm2['dump']();return _0x58c6b7[0x0];})['then'](respondWithResult(_0x9f5c1,null))[_0x7bdb('0x14')](handleError(_0x9f5c1,null));}else{return _0x9f5c1['status'](0x1f4)[_0x7bdb('0xb')]({'message':'Unknown\x20id'});}}; \ No newline at end of file +var _0x5db8=['Unknown\x20status','Unknown\x20id','lodash','../../config/pm2','../../config/logger','path','child_process','exec','sendStatus','status','json','error','name','send','info','index','list','then','reject','express','length','catch','show','describe','create','body','script','join','../../files/plugins','cwd','chdir','dirname','start','dump','update','restart','params'];(function(_0x20a394,_0x5c4e0c){var _0x8a454f=function(_0x26d21c){while(--_0x26d21c){_0x20a394['push'](_0x20a394['shift']());}};_0x8a454f(++_0x5c4e0c);}(_0x5db8,0xbb));var _0x85db=function(_0x29f014,_0x508522){_0x29f014=_0x29f014-0x0;var _0x316be5=_0x5db8[_0x29f014];return _0x316be5;};'use strict';var _=require(_0x85db('0x0'));var pm2=require(_0x85db('0x1'));var logger=require(_0x85db('0x2'))('api');var path=require(_0x85db('0x3'));var exec=require(_0x85db('0x4'))[_0x85db('0x5')];var BPromise=require('bluebird');function handleEntityNotFound(_0x5b7426,_0x13c216){return function(_0x1182c0){if(!_0x1182c0){_0x5b7426[_0x85db('0x6')](0x194);;}return _0x1182c0;};}function respondWithResult(_0x34d71f,_0x48bf16){_0x48bf16=_0x48bf16||0xc8;return function(_0x489b13){if(_0x489b13){return _0x34d71f[_0x85db('0x7')](_0x48bf16)[_0x85db('0x8')](_0x489b13);}return null;};}function handleError(_0xc6fd00,_0x308988){_0x308988=_0x308988||0x1f4;return function(_0x59a522){logger[_0x85db('0x9')](_0x59a522['stack']);if(_0x59a522[_0x85db('0xa')]){delete _0x59a522[_0x85db('0xa')];}_0xc6fd00[_0x85db('0x7')](_0x308988)[_0x85db('0xb')](_0x59a522);};}function execChildProcess(){return new BPromise(function(_0x5491fa,_0x54feb2){exec('npm\x20install',function(_0x14f838,_0x458b2b,_0x4de057){logger[_0x85db('0xc')](_0x458b2b);logger['info'](_0x4de057);if(_0x14f838){logger[_0x85db('0x9')](_0x14f838);return _0x54feb2(_0x14f838);}return _0x5491fa(_0x458b2b);});});}exports[_0x85db('0xd')]=function(_0x382c43,_0x216a41){return pm2[_0x85db('0xe')]()[_0x85db('0xf')](function(_0x2b7507){if(_0x2b7507){var _0x25ec64=_[_0x85db('0x10')](_0x2b7507,function(_0x415281){return _0x415281[_0x85db('0xa')]===_0x85db('0x11')||_0x415281[_0x85db('0xa')]==='motion2';});return{'rows':_0x25ec64,'count':_0x25ec64[_0x85db('0x12')]};}return null;})[_0x85db('0xf')](respondWithResult(_0x216a41,null))[_0x85db('0x13')](handleError(_0x216a41,null));};exports[_0x85db('0x14')]=function(_0x2ecd71,_0x396afa){return pm2[_0x85db('0x15')](_0x2ecd71['params']['id'])[_0x85db('0xf')](respondWithResult(_0x396afa,null))[_0x85db('0xf')](handleEntityNotFound(_0x396afa,null))[_0x85db('0x13')](handleError(_0x396afa,null));};exports[_0x85db('0x16')]=function(_0x4d976d,_0x2bc9a4){if(_0x4d976d[_0x85db('0x17')][_0x85db('0xa')]&&_0x4d976d[_0x85db('0x17')][_0x85db('0x18')]){var _0x5c37d7=path[_0x85db('0x19')](__dirname,_0x85db('0x1a'),_0x4d976d[_0x85db('0x17')][_0x85db('0x18')]);var _0x44c122=process[_0x85db('0x1b')]();process[_0x85db('0x1c')](path[_0x85db('0x1d')](_0x5c37d7));return execChildProcess()['then'](function(_0xfffea2){process[_0x85db('0x1c')](_0x44c122);return pm2[_0x85db('0x1e')]({'name':_0x4d976d[_0x85db('0x17')][_0x85db('0xa')],'script':_0x5c37d7});})[_0x85db('0xf')](function(_0x51c948){pm2[_0x85db('0x1f')]();return _0x51c948[0x0];})[_0x85db('0xf')](respondWithResult(_0x2bc9a4,0xc9))[_0x85db('0x13')](handleError(_0x2bc9a4,null));}else{return _0x2bc9a4['status'](0x1f4)['send']({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0x85db('0x20')]=function(_0x105bb9,_0x33448e){if(_0x105bb9['body']['id']){delete _0x105bb9[_0x85db('0x17')]['id'];}var _0xc2abb8={'online':_0x85db('0x21'),'stopped':'stop'};if(_0xc2abb8['hasOwnProperty'](_0x105bb9[_0x85db('0x17')][_0x85db('0x7')])){return pm2[_0xc2abb8[_0x105bb9[_0x85db('0x17')][_0x85db('0x7')]]](_0x105bb9[_0x85db('0x22')]['id'])[_0x85db('0xf')](respondWithResult(_0x33448e,0xc8))[_0x85db('0x13')](handleError(_0x33448e,null));}else{return _0x33448e[_0x85db('0x7')](0x1f4)[_0x85db('0xb')]({'message':_0x85db('0x23')});}};exports['destroy']=function(_0x4a15b9,_0x13ad98){if(_0x4a15b9['body']['id']){delete _0x4a15b9[_0x85db('0x17')]['id'];}if(_0x4a15b9[_0x85db('0x22')]['id']){return pm2['delete'](_0x4a15b9[_0x85db('0x22')]['id'])[_0x85db('0xf')](function(_0x38369f){pm2[_0x85db('0x1f')]();return _0x38369f[0x0];})['then'](respondWithResult(_0x13ad98,null))[_0x85db('0x13')](handleError(_0x13ad98,null));}else{return _0x13ad98[_0x85db('0x7')](0x1f4)[_0x85db('0xb')]({'message':_0x85db('0x24')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index d22dd78..9697e48 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 _0x9fd0=['/queues','getQueues','exports','express','Router','../../components/auth/service','./realtime.controller','/agents','isAuthenticated','getAgents'];(function(_0x81a6a3,_0x2b1cad){var _0x290061=function(_0x2f9b44){while(--_0x2f9b44){_0x81a6a3['push'](_0x81a6a3['shift']());}};_0x290061(++_0x2b1cad);}(_0x9fd0,0x1ed));var _0x09fd=function(_0x353004,_0x501d24){_0x353004=_0x353004-0x0;var _0x24245b=_0x9fd0[_0x353004];return _0x24245b;};'use strict';var express=require(_0x09fd('0x0'));var router=express[_0x09fd('0x1')]();var auth=require(_0x09fd('0x2'));var controller=require(_0x09fd('0x3'));router['get'](_0x09fd('0x4'),auth[_0x09fd('0x5')](),controller[_0x09fd('0x6')]);router['get'](_0x09fd('0x7'),auth[_0x09fd('0x5')](),controller[_0x09fd('0x8')]);module[_0x09fd('0x9')]=router; \ No newline at end of file +var _0xad59=['exports','express','Router','../../components/auth/service','./realtime.controller','get','/agents','isAuthenticated','getAgents','/queues','getQueues'];(function(_0x1619aa,_0x1684a3){var _0x5415e0=function(_0x3c37a4){while(--_0x3c37a4){_0x1619aa['push'](_0x1619aa['shift']());}};_0x5415e0(++_0x1684a3);}(_0xad59,0xbc));var _0x9ad5=function(_0x4e92a0,_0x3701ef){_0x4e92a0=_0x4e92a0-0x0;var _0x9ac2c8=_0xad59[_0x4e92a0];return _0x9ac2c8;};'use strict';var express=require(_0x9ad5('0x0'));var router=express[_0x9ad5('0x1')]();var auth=require(_0x9ad5('0x2'));var controller=require(_0x9ad5('0x3'));router[_0x9ad5('0x4')](_0x9ad5('0x5'),auth[_0x9ad5('0x6')](),controller[_0x9ad5('0x7')]);router['get'](_0x9ad5('0x8'),auth[_0x9ad5('0x6')](),controller[_0x9ad5('0x9')]);module[_0x9ad5('0xa')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 41e5d55..5be6d1f 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 _0x7d5d=['Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','includes','globalStatus','sort','validateSortParameter','getUpdatedSortOptions','fields','join','order','getAgentIdsByQueues','getRealtimeAgents','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','map','User','rawAttributes','fieldName','key','getOptions','raw','length','push','sequelize','literal','FIELD(id,','*pause','Pause','where','merge','user','role','userProfileId','agent','assign','UserProfile','find','filterAgentAttributes','getAgentStatus','voice','talking','voiceStatus','Status','sortAgentsByStatus','split','catch','resolve','isValidChannel','startCase','Queue','name','type','outbound','dialActive','dialMethod','QueueCampaigns','filter','getResources','findAndCountAll','getRealtimeQueues','initializeQueues','util','../../components/realtime/agents','../../config/utils','../../mysqldb','../../errors/api','handleError','offset','undefined','limit','count','status','set','getAgents','getChannels','query','globalStatusFilter','pauseTypeFilter','pause','then','channel','format'];(function(_0x247adc,_0x354368){var _0x2c33d8=function(_0x414131){while(--_0x414131){_0x247adc['push'](_0x247adc['shift']());}};_0x2c33d8(++_0x354368);}(_0x7d5d,0x1dd));var _0xd7d5=function(_0x40d768,_0x30ad98){_0x40d768=_0x40d768-0x0;var _0x1ab282=_0x7d5d[_0x40d768];return _0x1ab282;};'use strict';var _=require('lodash');var util=require(_0xd7d5('0x0'));var rta=require(_0xd7d5('0x1'));var rtq=require('../../components/realtime/queues');var qs=require('../../components/parsers/qs');var utils=require(_0xd7d5('0x2'));var db=require(_0xd7d5('0x3'))['db'];var APIBadRequestError=require(_0xd7d5('0x4'))['APIBadRequestError'];var APIHandleError=require(_0xd7d5('0x4'))[_0xd7d5('0x5')];function respondWithFilteredResult(_0xed8369,_0x352c44){return function(_0x3b0a50){if(_0x3b0a50){var _0x559f36=typeof _0x352c44[_0xd7d5('0x6')]===_0xd7d5('0x7')&&typeof _0x352c44[_0xd7d5('0x8')]==='undefined';var _0x1499df=_0x3b0a50[_0xd7d5('0x9')];var _0x4c3b64=_0x559f36?0x0:_0x352c44[_0xd7d5('0x6')];var _0x23b02e=_0x559f36?_0x3b0a50[_0xd7d5('0x9')]:_0x352c44['offset']+_0x352c44[_0xd7d5('0x8')];var _0x15f33b;if(_0x23b02e>=_0x1499df){_0x23b02e=_0x1499df;_0x15f33b=0xc8;}else{_0x15f33b=0xce;}_0xed8369[_0xd7d5('0xa')](_0x15f33b);return _0xed8369[_0xd7d5('0xb')]('Content-Range',_0x4c3b64+'-'+_0x23b02e+'/'+_0x1499df)['json'](_0x3b0a50);}return null;};}exports[_0xd7d5('0xc')]=function(_0x3f695b,_0x283b16){var _0x2ecc2a={'count':0x0,'rows':[]};var _0x36d707={};var _0x612f8c;var _0x54e2f1=utils[_0xd7d5('0xd')]();var _0x32753d;var _0x2c38f1;var _0x3a01d9=_0x3f695b[_0xd7d5('0xe')]['globalQueueFilter'];var _0x4508f2=_0x3f695b[_0xd7d5('0xe')][_0xd7d5('0xf')];var _0x25b1cb=_0x3f695b[_0xd7d5('0xe')][_0xd7d5('0x10')];var _0x2625e2=_0x4508f2===_0xd7d5('0x11')||_0x4508f2==='*pause'?!![]:![];var _0x567b97=[];var _0xdc774c;var _0x5ea400;Promise['resolve']()[_0xd7d5('0x12')](function(){if(_0x3f695b['query'][_0xd7d5('0x13')]){if(!utils['isValidChannel'](_0x3f695b[_0xd7d5('0xe')][_0xd7d5('0x13')])){throw new APIBadRequestError(util[_0xd7d5('0x14')](_0xd7d5('0x15'),_0x3f695b[_0xd7d5('0xe')]['channel']));}_0x612f8c=_0x3f695b[_0xd7d5('0xe')][_0xd7d5('0x13')][_0xd7d5('0x16')]();}if(!_0x3f695b['query']['sort']||!_0x3f695b[_0xd7d5('0xe')]['sort'][_0xd7d5('0x17')](_0xd7d5('0x18'))){_0x3f695b[_0xd7d5('0xe')][_0xd7d5('0x19')]=rta[_0xd7d5('0x1a')](_0x3f695b[_0xd7d5('0xe')][_0xd7d5('0x19')]);return;}var _0x4da10b=rta[_0xd7d5('0x1b')](_0x3f695b[_0xd7d5('0xe')]['sort']);_0x3f695b[_0xd7d5('0xe')][_0xd7d5('0x19')]=_0x4da10b[_0xd7d5('0x1c')][_0xd7d5('0x1d')](',');_0xdc774c=_0x4da10b[_0xd7d5('0x1e')];})[_0xd7d5('0x12')](function(){if(!_0x3a01d9){return[];}return rta[_0xd7d5('0x1f')](_0x3a01d9,_0x612f8c);})[_0xd7d5('0x12')](function(_0x3bd423){_0x567b97=_0x3bd423;return rta[_0xd7d5('0x20')]();})[_0xd7d5('0x12')](function(_0x2930c8){_0x2c38f1=_0x2930c8[_0xd7d5('0x21')];if((!_0x4508f2||_0x2625e2)&&!_0xdc774c){return _0x567b97;}if(_0xdc774c&&!_0x4508f2){return rta[_0xd7d5('0x22')](_0x2c38f1,_0x567b97,_0xdc774c);}else{return rta[_0xd7d5('0x23')](_0x2c38f1,_0x567b97,_0x4508f2);}})['then'](function(_0x3b258d){_0x567b97=_0x3b258d;var _0x1d8bfb=![];if(_0x567b97['length']===0x0){if(_0x3a01d9||_0x4508f2){_0x1d8bfb=!![];}if(_0x2625e2){_0x1d8bfb=![];}}if(_0x1d8bfb){return _0x2ecc2a;}var _0x30b929=_[_0xd7d5('0x24')](db[_0xd7d5('0x25')][_0xd7d5('0x26')],function(_0x42cb58){return{'name':_0x42cb58[_0xd7d5('0x27')],'type':_0x42cb58['type'][_0xd7d5('0x28')]};});_0x3f695b[_0xd7d5('0xe')]['role']='agent';_0x3f695b['query']['online']=!![];_0x36d707=qs[_0xd7d5('0x29')](_0x30b929,_0x3f695b);_0x36d707[_0xd7d5('0x2a')]=!![];var _0x3e943d=[];if(_0x567b97[_0xd7d5('0x2b')]>0x0){_0x3e943d[_0xd7d5('0x2c')]({'id':{'$in':_0x567b97}});if(_0xdc774c&&!_0x4508f2){_0x5ea400=[db[_0xd7d5('0x2d')][_0xd7d5('0x2e')](_0xd7d5('0x2f')+_0x567b97+')')];_0x36d707[_0xd7d5('0x1e')]=_0x5ea400;}}if(_0x2625e2){_0x54e2f1['forEach'](function(_0x2a54dd){var _0x31a9a9=!![];if(_0x4508f2===_0xd7d5('0x30')&&_0x612f8c!==_0x2a54dd){_0x31a9a9=![];}_0x3e943d[_0xd7d5('0x2c')]({[_0x2a54dd+_0xd7d5('0x31')]:_0x31a9a9});});if(_0x25b1cb){_0x3e943d[_0xd7d5('0x2c')]({'pauseType':_0x25b1cb});}}else if(_0x4508f2){_0x54e2f1['forEach'](function(_0x53d896){_0x3e943d[_0xd7d5('0x2c')]({[_0x53d896+_0xd7d5('0x31')]:![]});});}_0x36d707[_0xd7d5('0x32')]=_[_0xd7d5('0x33')](_0x36d707[_0xd7d5('0x32')],{'$and':_0x3e943d});if(_0x3f695b[_0xd7d5('0x34')][_0xd7d5('0x35')]===_0xd7d5('0x34')){var _0x536952={'params':{'id':_0x3f695b[_0xd7d5('0x34')][_0xd7d5('0x36')]},'query':{'section':'Agents','role':_0xd7d5('0x37'),'online':!![],'raw':!![],'ids':_0x567b97,'customSorting':_0x5ea400}};if(_0x2625e2){_0x536952['query']['extraQueryConditions']=_0x3e943d;}_0x536952[_0xd7d5('0xe')]=Object[_0xd7d5('0x38')](_0x536952[_0xd7d5('0xe')],_0x3f695b[_0xd7d5('0xe')]);delete _0x536952['query']['id'];return db[_0xd7d5('0x39')]['getResources'](_0x536952);}return db[_0xd7d5('0x25')]['findAndCountAll'](_0x36d707);})['then'](function(_0x4b3982){_0x2ecc2a['count']=_0x4b3982[_0xd7d5('0x9')];_0x32753d=_0x4b3982['rows'];return _0x32753d['map'](function(_0xa43e66){var _0xfdaa7b=_[_0xd7d5('0x3a')](_0x2c38f1,['id',_0xa43e66['id']]);if(_0xfdaa7b){var _0x51d5ca=rta[_0xd7d5('0x3b')](_0xfdaa7b);_['merge'](_0xa43e66,_0x51d5ca);}_0xa43e66[_0xd7d5('0x18')]=rta[_0xd7d5('0x3c')](_0xa43e66);if(_0xa43e66[_0xd7d5('0x18')][_0xd7d5('0x17')]('pause')){_0x54e2f1['forEach'](function(_0x49ee0a){if(_0xa43e66[_0x49ee0a+_0xd7d5('0x31')]){if(_0x49ee0a===_0xd7d5('0x3d')){if(_0xa43e66['voiceStatus']!==_0xd7d5('0x3e')){_0xa43e66[_0xd7d5('0x3f')]=_0xd7d5('0x11');}}else{_0xa43e66[_0x49ee0a+_0xd7d5('0x40')]=_0xd7d5('0x11');}}});}return _0xa43e66;});})['then'](function(_0x50a40d){if(!_0xdc774c||_0x5ea400){return _0x50a40d;}return rta[_0xd7d5('0x41')](_0x50a40d,_0xdc774c);})[_0xd7d5('0x12')](function(_0x5ccbf8){var _0x56b879=null;if(_0x3f695b['query'][_0xd7d5('0x1c')]){var _0x1d6f8f=_0x3f695b['query']['fields'][_0xd7d5('0x42')](',');_0x56b879=_0x5ccbf8['map'](function(_0x329e29){return _['pick'](_0x329e29,_0x1d6f8f);});}_0x2ecc2a[_0xd7d5('0x21')]=_0x56b879||_0x5ccbf8;return _0x2ecc2a;})[_0xd7d5('0x12')](respondWithFilteredResult(_0x283b16,_0x36d707))[_0xd7d5('0x43')](APIHandleError(_0x283b16));};exports['getQueues']=function(_0x2115e8,_0x25aec9){var _0x59de05={'count':0x0,'rows':[]};var _0x2d525d={};var _0x6abc8f;var _0xce6a0c;var _0x57cbb0;Promise[_0xd7d5('0x44')]()[_0xd7d5('0x12')](function(){if(_0x2115e8['query'][_0xd7d5('0x13')]){if(!utils[_0xd7d5('0x45')](_0x2115e8[_0xd7d5('0xe')][_0xd7d5('0x13')])){throw new APIBadRequestError(util[_0xd7d5('0x14')](_0xd7d5('0x15'),_0x2115e8[_0xd7d5('0xe')][_0xd7d5('0x13')]));}_0x6abc8f=_0x2115e8[_0xd7d5('0xe')]['channel'][_0xd7d5('0x16')]();}var _0x1b4f54=_[_0xd7d5('0x46')](_0x6abc8f)+_0xd7d5('0x47');var _0x2747aa=_[_0xd7d5('0x24')](db[_0x1b4f54][_0xd7d5('0x26')],function(_0x5624e4){return{'name':_0x5624e4['fieldName'],'type':_0x5624e4['type'][_0xd7d5('0x28')]};});if(!_0x2115e8[_0xd7d5('0xe')][_0xd7d5('0x1c')]){var _0x5ce350=['id',_0xd7d5('0x48')];if(_0x6abc8f===_0xd7d5('0x3d')){_0x5ce350['push'](_0xd7d5('0x49'));if(_0x2115e8[_0xd7d5('0xe')][_0xd7d5('0x49')]===_0xd7d5('0x4a')){_0x5ce350[_0xd7d5('0x2c')]([_0xd7d5('0x4b'),_0xd7d5('0x4c')]);}}_0x2115e8[_0xd7d5('0xe')]['fields']=_0x5ce350[_0xd7d5('0x1d')](',');}_0x2d525d=qs[_0xd7d5('0x29')](_0x2747aa,_0x2115e8);if(_0x2115e8[_0xd7d5('0x34')]['role']==='user'){var _0x10a0b0={'params':{'id':_0x2115e8[_0xd7d5('0x34')][_0xd7d5('0x36')]},'query':{'section':_0x6abc8f==='voice'&&_0x2115e8[_0xd7d5('0xe')]['type']==='outbound'?_0xd7d5('0x4d'):_['startCase'](_0x6abc8f)+'Queues','type':_0x2115e8[_0xd7d5('0xe')][_0xd7d5('0x49')],'nolimit':!![],'sort':_0xd7d5('0x48'),'filter':_0x2115e8[_0xd7d5('0xe')][_0xd7d5('0x4e')]}};_0x10a0b0[_0xd7d5('0xe')]=Object[_0xd7d5('0x38')](_0x10a0b0[_0xd7d5('0xe')],_0x2115e8['query']);delete _0x10a0b0[_0xd7d5('0xe')]['id'];return db['UserProfile'][_0xd7d5('0x4f')](_0x10a0b0);}return db[_0x1b4f54][_0xd7d5('0x50')](_0x2d525d);})['then'](function(_0x186f78){_0x59de05[_0xd7d5('0x9')]=_0x186f78['count'];_0xce6a0c=_0x186f78[_0xd7d5('0x21')];return rtq[_0xd7d5('0x51')](_0x2115e8,_0x6abc8f);})[_0xd7d5('0x12')](function(_0x392b69){_0x57cbb0=_0x392b69[_0xd7d5('0x21')];return rtq[_0xd7d5('0x52')](_0xce6a0c,_0x57cbb0,_0x6abc8f,_0x2115e8['query'][_0xd7d5('0x49')]);})[_0xd7d5('0x12')](function(_0x177ad3){_0x59de05[_0xd7d5('0x21')]=_0x177ad3;return _0x59de05;})[_0xd7d5('0x12')](respondWithFilteredResult(_0x25aec9,_0x2d525d))['catch'](APIHandleError(_0x25aec9));}; \ No newline at end of file +var _0x8d92=['type','role','agent','online','getOptions','push','literal','FIELD(id,','order','forEach','Pause','where','merge','user','userProfileId','Agents','assign','UserProfile','getResources','User','findAndCountAll','find','filterAgentAttributes','voice','voiceStatus','Status','sortAgentsByStatus','fields','split','pick','catch','startCase','Queue','key','name','dialActive','dialMethod','join','outbound','Queues','filter','getRealtimeQueues','lodash','util','../../components/realtime/agents','../../components/realtime/queues','../../config/utils','../../mysqldb','../../errors/api','APIBadRequestError','handleError','offset','limit','undefined','count','status','set','Content-Range','json','getAgents','getChannels','query','globalQueueFilter','pause','*pause','resolve','then','channel','isValidChannel','format','Channel\x20parameter\x20%s\x20is\x20invalid','sort','includes','globalStatus','validateSortParameter','getRealtimeAgents','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','length','map','rawAttributes','fieldName'];(function(_0x441f42,_0x5a5785){var _0x53b099=function(_0x5d7d27){while(--_0x5d7d27){_0x441f42['push'](_0x441f42['shift']());}};_0x53b099(++_0x5a5785);}(_0x8d92,0x1c9));var _0x28d9=function(_0x56aad3,_0x3d48bc){_0x56aad3=_0x56aad3-0x0;var _0x1d165a=_0x8d92[_0x56aad3];return _0x1d165a;};'use strict';var _=require(_0x28d9('0x0'));var util=require(_0x28d9('0x1'));var rta=require(_0x28d9('0x2'));var rtq=require(_0x28d9('0x3'));var qs=require('../../components/parsers/qs');var utils=require(_0x28d9('0x4'));var db=require(_0x28d9('0x5'))['db'];var APIBadRequestError=require(_0x28d9('0x6'))[_0x28d9('0x7')];var APIHandleError=require('../../errors/api')[_0x28d9('0x8')];function respondWithFilteredResult(_0x170232,_0x17e72b){return function(_0x4b978a){if(_0x4b978a){var _0x4726a9=typeof _0x17e72b[_0x28d9('0x9')]==='undefined'&&typeof _0x17e72b[_0x28d9('0xa')]===_0x28d9('0xb');var _0x36d051=_0x4b978a[_0x28d9('0xc')];var _0x56b87f=_0x4726a9?0x0:_0x17e72b[_0x28d9('0x9')];var _0x9360ab=_0x4726a9?_0x4b978a[_0x28d9('0xc')]:_0x17e72b[_0x28d9('0x9')]+_0x17e72b[_0x28d9('0xa')];var _0x1c02d4;if(_0x9360ab>=_0x36d051){_0x9360ab=_0x36d051;_0x1c02d4=0xc8;}else{_0x1c02d4=0xce;}_0x170232[_0x28d9('0xd')](_0x1c02d4);return _0x170232[_0x28d9('0xe')](_0x28d9('0xf'),_0x56b87f+'-'+_0x9360ab+'/'+_0x36d051)[_0x28d9('0x10')](_0x4b978a);}return null;};}exports[_0x28d9('0x11')]=function(_0x258ffd,_0x91e1da){var _0x5347ba={'count':0x0,'rows':[]};var _0x5e02f9={};var _0x3c581f;var _0x15deea=utils[_0x28d9('0x12')]();var _0x84c534;var _0x5aad9c;var _0x1a2293=_0x258ffd[_0x28d9('0x13')][_0x28d9('0x14')];var _0x49018d=_0x258ffd[_0x28d9('0x13')]['globalStatusFilter'];var _0x377f7b=_0x258ffd[_0x28d9('0x13')]['pauseTypeFilter'];var _0x152817=_0x49018d===_0x28d9('0x15')||_0x49018d===_0x28d9('0x16')?!![]:![];var _0x2fe463=[];var _0x31bcce;var _0xae024a;Promise[_0x28d9('0x17')]()[_0x28d9('0x18')](function(){if(_0x258ffd[_0x28d9('0x13')][_0x28d9('0x19')]){if(!utils[_0x28d9('0x1a')](_0x258ffd[_0x28d9('0x13')][_0x28d9('0x19')])){throw new APIBadRequestError(util[_0x28d9('0x1b')](_0x28d9('0x1c'),_0x258ffd[_0x28d9('0x13')][_0x28d9('0x19')]));}_0x3c581f=_0x258ffd[_0x28d9('0x13')][_0x28d9('0x19')]['toLowerCase']();}if(!_0x258ffd['query']['sort']||!_0x258ffd[_0x28d9('0x13')][_0x28d9('0x1d')][_0x28d9('0x1e')](_0x28d9('0x1f'))){_0x258ffd[_0x28d9('0x13')][_0x28d9('0x1d')]=rta[_0x28d9('0x20')](_0x258ffd[_0x28d9('0x13')][_0x28d9('0x1d')]);return;}var _0x3361a6=rta['getUpdatedSortOptions'](_0x258ffd[_0x28d9('0x13')][_0x28d9('0x1d')]);_0x258ffd[_0x28d9('0x13')][_0x28d9('0x1d')]=_0x3361a6['fields']['join'](',');_0x31bcce=_0x3361a6['order'];})['then'](function(){if(!_0x1a2293){return[];}return rta['getAgentIdsByQueues'](_0x1a2293,_0x3c581f);})[_0x28d9('0x18')](function(_0x344f81){_0x2fe463=_0x344f81;return rta[_0x28d9('0x21')]();})['then'](function(_0x21f5f3){_0x5aad9c=_0x21f5f3[_0x28d9('0x22')];if((!_0x49018d||_0x152817)&&!_0x31bcce){return _0x2fe463;}if(_0x31bcce&&!_0x49018d){return rta[_0x28d9('0x23')](_0x5aad9c,_0x2fe463,_0x31bcce);}else{return rta[_0x28d9('0x24')](_0x5aad9c,_0x2fe463,_0x49018d);}})[_0x28d9('0x18')](function(_0x4f55f8){_0x2fe463=_0x4f55f8;var _0x53751b=![];if(_0x2fe463[_0x28d9('0x25')]===0x0){if(_0x1a2293||_0x49018d){_0x53751b=!![];}if(_0x152817){_0x53751b=![];}}if(_0x53751b){return _0x5347ba;}var _0x3763cb=_[_0x28d9('0x26')](db['User'][_0x28d9('0x27')],function(_0xc2253b){return{'name':_0xc2253b[_0x28d9('0x28')],'type':_0xc2253b[_0x28d9('0x29')]['key']};});_0x258ffd[_0x28d9('0x13')][_0x28d9('0x2a')]=_0x28d9('0x2b');_0x258ffd[_0x28d9('0x13')][_0x28d9('0x2c')]=!![];_0x5e02f9=qs[_0x28d9('0x2d')](_0x3763cb,_0x258ffd);_0x5e02f9['raw']=!![];var _0x5b3119=[];if(_0x2fe463['length']>0x0){_0x5b3119[_0x28d9('0x2e')]({'id':{'$in':_0x2fe463}});if(_0x31bcce&&!_0x49018d){_0xae024a=[db['sequelize'][_0x28d9('0x2f')](_0x28d9('0x30')+_0x2fe463+')')];_0x5e02f9[_0x28d9('0x31')]=_0xae024a;}}if(_0x152817){_0x15deea[_0x28d9('0x32')](function(_0x27eb48){var _0x130426=!![];if(_0x49018d==='*pause'&&_0x3c581f!==_0x27eb48){_0x130426=![];}_0x5b3119[_0x28d9('0x2e')]({[_0x27eb48+_0x28d9('0x33')]:_0x130426});});if(_0x377f7b){_0x5b3119['push']({'pauseType':_0x377f7b});}}else if(_0x49018d){_0x15deea[_0x28d9('0x32')](function(_0x286472){_0x5b3119[_0x28d9('0x2e')]({[_0x286472+_0x28d9('0x33')]:![]});});}_0x5e02f9[_0x28d9('0x34')]=_[_0x28d9('0x35')](_0x5e02f9['where'],{'$and':_0x5b3119});if(_0x258ffd[_0x28d9('0x36')]['role']===_0x28d9('0x36')){var _0x5ad5f8={'params':{'id':_0x258ffd[_0x28d9('0x36')][_0x28d9('0x37')]},'query':{'section':_0x28d9('0x38'),'role':_0x28d9('0x2b'),'online':!![],'raw':!![],'ids':_0x2fe463,'customSorting':_0xae024a}};if(_0x152817){_0x5ad5f8[_0x28d9('0x13')]['extraQueryConditions']=_0x5b3119;}_0x5ad5f8[_0x28d9('0x13')]=Object[_0x28d9('0x39')](_0x5ad5f8[_0x28d9('0x13')],_0x258ffd['query']);delete _0x5ad5f8[_0x28d9('0x13')]['id'];return db[_0x28d9('0x3a')][_0x28d9('0x3b')](_0x5ad5f8);}return db[_0x28d9('0x3c')][_0x28d9('0x3d')](_0x5e02f9);})[_0x28d9('0x18')](function(_0x21cbca){_0x5347ba[_0x28d9('0xc')]=_0x21cbca[_0x28d9('0xc')];_0x84c534=_0x21cbca[_0x28d9('0x22')];return _0x84c534['map'](function(_0x366543){var _0x1711ee=_[_0x28d9('0x3e')](_0x5aad9c,['id',_0x366543['id']]);if(_0x1711ee){var _0x5b5972=rta[_0x28d9('0x3f')](_0x1711ee);_[_0x28d9('0x35')](_0x366543,_0x5b5972);}_0x366543[_0x28d9('0x1f')]=rta['getAgentStatus'](_0x366543);if(_0x366543[_0x28d9('0x1f')][_0x28d9('0x1e')](_0x28d9('0x15'))){_0x15deea[_0x28d9('0x32')](function(_0xfe4e76){if(_0x366543[_0xfe4e76+_0x28d9('0x33')]){if(_0xfe4e76===_0x28d9('0x40')){if(_0x366543[_0x28d9('0x41')]!=='talking'){_0x366543[_0x28d9('0x41')]='pause';}}else{_0x366543[_0xfe4e76+_0x28d9('0x42')]='pause';}}});}return _0x366543;});})[_0x28d9('0x18')](function(_0x56a8f5){if(!_0x31bcce||_0xae024a){return _0x56a8f5;}return rta[_0x28d9('0x43')](_0x56a8f5,_0x31bcce);})['then'](function(_0x2d0ac2){var _0x474000=null;if(_0x258ffd[_0x28d9('0x13')][_0x28d9('0x44')]){var _0x1a8142=_0x258ffd['query']['fields'][_0x28d9('0x45')](',');_0x474000=_0x2d0ac2[_0x28d9('0x26')](function(_0x49a847){return _[_0x28d9('0x46')](_0x49a847,_0x1a8142);});}_0x5347ba[_0x28d9('0x22')]=_0x474000||_0x2d0ac2;return _0x5347ba;})['then'](respondWithFilteredResult(_0x91e1da,_0x5e02f9))[_0x28d9('0x47')](APIHandleError(_0x91e1da));};exports['getQueues']=function(_0x21ebbc,_0x2f83dc){var _0xed34a8={'count':0x0,'rows':[]};var _0x318db9={};var _0x592aed;var _0x1c77a5;var _0x264229;Promise[_0x28d9('0x17')]()[_0x28d9('0x18')](function(){if(_0x21ebbc[_0x28d9('0x13')][_0x28d9('0x19')]){if(!utils[_0x28d9('0x1a')](_0x21ebbc[_0x28d9('0x13')][_0x28d9('0x19')])){throw new APIBadRequestError(util[_0x28d9('0x1b')](_0x28d9('0x1c'),_0x21ebbc[_0x28d9('0x13')][_0x28d9('0x19')]));}_0x592aed=_0x21ebbc[_0x28d9('0x13')]['channel']['toLowerCase']();}var _0x6bd2a6=_[_0x28d9('0x48')](_0x592aed)+_0x28d9('0x49');var _0x4bb803=_[_0x28d9('0x26')](db[_0x6bd2a6][_0x28d9('0x27')],function(_0x3324ba){return{'name':_0x3324ba['fieldName'],'type':_0x3324ba['type'][_0x28d9('0x4a')]};});if(!_0x21ebbc[_0x28d9('0x13')][_0x28d9('0x44')]){var _0x16c10e=['id',_0x28d9('0x4b')];if(_0x592aed===_0x28d9('0x40')){_0x16c10e[_0x28d9('0x2e')](_0x28d9('0x29'));if(_0x21ebbc['query'][_0x28d9('0x29')]==='outbound'){_0x16c10e[_0x28d9('0x2e')]([_0x28d9('0x4c'),_0x28d9('0x4d')]);}}_0x21ebbc[_0x28d9('0x13')][_0x28d9('0x44')]=_0x16c10e[_0x28d9('0x4e')](',');}_0x318db9=qs[_0x28d9('0x2d')](_0x4bb803,_0x21ebbc);if(_0x21ebbc[_0x28d9('0x36')][_0x28d9('0x2a')]===_0x28d9('0x36')){var _0x5ad46a={'params':{'id':_0x21ebbc['user'][_0x28d9('0x37')]},'query':{'section':_0x592aed==='voice'&&_0x21ebbc[_0x28d9('0x13')][_0x28d9('0x29')]===_0x28d9('0x4f')?'QueueCampaigns':_['startCase'](_0x592aed)+_0x28d9('0x50'),'type':_0x21ebbc['query'][_0x28d9('0x29')],'nolimit':!![],'sort':_0x28d9('0x4b'),'filter':_0x21ebbc[_0x28d9('0x13')][_0x28d9('0x51')]}};_0x5ad46a[_0x28d9('0x13')]=Object[_0x28d9('0x39')](_0x5ad46a[_0x28d9('0x13')],_0x21ebbc['query']);delete _0x5ad46a[_0x28d9('0x13')]['id'];return db[_0x28d9('0x3a')][_0x28d9('0x3b')](_0x5ad46a);}return db[_0x6bd2a6]['findAndCountAll'](_0x318db9);})[_0x28d9('0x18')](function(_0x4c7d5c){_0xed34a8[_0x28d9('0xc')]=_0x4c7d5c[_0x28d9('0xc')];_0x1c77a5=_0x4c7d5c[_0x28d9('0x22')];return rtq[_0x28d9('0x52')](_0x21ebbc,_0x592aed);})[_0x28d9('0x18')](function(_0x3f1a5e){_0x264229=_0x3f1a5e['rows'];return rtq['initializeQueues'](_0x1c77a5,_0x264229,_0x592aed,_0x21ebbc[_0x28d9('0x13')]['type']);})[_0x28d9('0x18')](function(_0x1b553f){_0xed34a8[_0x28d9('0x22')]=_0x1b553f;return _0xed34a8;})[_0x28d9('0x18')](respondWithFilteredResult(_0x2f83dc,_0x318db9))[_0x28d9('0x47')](APIHandleError(_0x2f83dc));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index ca32937..59af5b3 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x28cbc0,_0x203516){var _0x4b3cf5=function(_0x2a15c6){while(--_0x2a15c6){_0x28cbc0['push'](_0x28cbc0['shift']());}};_0x4b3cf5(++_0x203516);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x11e8ac,_0xe2068f){var _0xc35fdf=function(_0x1a1422){while(--_0x1a1422){_0x11e8ac['push'](_0x11e8ac['shift']());}};_0xc35fdf(++_0xe2068f);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 5f0f0d2..8983bee 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 _0xbecd=['STRING','DATE','sequelize','INTEGER'];(function(_0xfb2767,_0x1498ba){var _0x4fd17e=function(_0x14a484){while(--_0x14a484){_0xfb2767['push'](_0xfb2767['shift']());}};_0x4fd17e(++_0x1498ba);}(_0xbecd,0x6a));var _0xdbec=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xbecd[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xdbec('0x0'));module['exports']={'state':{'type':Sequelize[_0xdbec('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xdbec('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0xdbec('0x2')]},'starttime':{'type':Sequelize[_0xdbec('0x3')]},'responsetime':{'type':Sequelize[_0xdbec('0x3')]},'ringtime':{'type':Sequelize[_0xdbec('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xdbec('0x2')]},'campaigntype':{'type':Sequelize[_0xdbec('0x2')]},'membername':{'type':Sequelize[_0xdbec('0x2')]}}; \ No newline at end of file +var _0xf360=['INTEGER','DATE','STRING','sequelize','exports'];(function(_0x4193fd,_0x32fc44){var _0x246baf=function(_0x3f035f){while(--_0x3f035f){_0x4193fd['push'](_0x4193fd['shift']());}};_0x246baf(++_0x32fc44);}(_0xf360,0x9e));var _0x0f36=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xf360[_0x126558];return _0x1f6d14;};'use strict';var Sequelize=require(_0x0f36('0x0'));module[_0x0f36('0x1')]={'state':{'type':Sequelize[_0x0f36('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x0f36('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x0f36('0x3')]},'responsetime':{'type':Sequelize[_0x0f36('0x3')]},'ringtime':{'type':Sequelize[_0x0f36('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x0f36('0x4')]},'membername':{'type':Sequelize[_0x0f36('0x4')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 492eb47..d3180c2 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 _0xc4e3=['ReportAgentPreview','report_agent_preview','lodash','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./reportAgentPreview.attributes','define'];(function(_0x5f5c3f,_0x1b5047){var _0x44f2a4=function(_0x33c9cb){while(--_0x33c9cb){_0x5f5c3f['push'](_0x5f5c3f['shift']());}};_0x44f2a4(++_0x1b5047);}(_0xc4e3,0x86));var _0x3c4e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc4e3[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x3c4e('0x0'));var util=require('util');var logger=require(_0x3c4e('0x1'))(_0x3c4e('0x2'));var moment=require(_0x3c4e('0x3'));var BPromise=require(_0x3c4e('0x4'));var rp=require(_0x3c4e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3c4e('0x6'));var attributes=require(_0x3c4e('0x7'));module['exports']=function(_0x91b105,_0x13533f){return _0x91b105[_0x3c4e('0x8')](_0x3c4e('0x9'),attributes,{'tableName':_0x3c4e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8e54=['moment','bluebird','request-promise','path','../../config/environment','./reportAgentPreview.attributes','exports','define','ReportAgentPreview','report_agent_preview','lodash','util'];(function(_0x5538a4,_0xe0b8b0){var _0x530a52=function(_0x1ebe09){while(--_0x1ebe09){_0x5538a4['push'](_0x5538a4['shift']());}};_0x530a52(++_0xe0b8b0);}(_0x8e54,0xca));var _0x48e5=function(_0x35d988,_0x104c5a){_0x35d988=_0x35d988-0x0;var _0x10bcd8=_0x8e54[_0x35d988];return _0x10bcd8;};'use strict';var _=require(_0x48e5('0x0'));var util=require(_0x48e5('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x48e5('0x2'));var BPromise=require(_0x48e5('0x3'));var rp=require(_0x48e5('0x4'));var fs=require('fs');var path=require(_0x48e5('0x5'));var rimraf=require('rimraf');var config=require(_0x48e5('0x6'));var attributes=require(_0x48e5('0x7'));module[_0x48e5('0x8')]=function(_0x20ce40,_0x4c9f74){return _0x20ce40[_0x48e5('0x9')](_0x48e5('0xa'),attributes,{'tableName':_0x48e5('0xb'),'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 81202bc..533fa9b 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 _0x0bb8=['raw','stringify','lodash','util','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','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'];(function(_0x5b4daa,_0xc385e4){var _0x9b569c=function(_0x76fdb6){while(--_0x76fdb6){_0x5b4daa['push'](_0x5b4daa['shift']());}};_0x9b569c(++_0xc385e4);}(_0x0bb8,0x154));var _0x80bb=function(_0x55993a,_0x9e2304){_0x55993a=_0x55993a-0x0;var _0x334287=_0x0bb8[_0x55993a];return _0x334287;};'use strict';var _=require(_0x80bb('0x0'));var util=require(_0x80bb('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x80bb('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x80bb('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x80bb('0x4'))(_0x80bb('0x5'));var config=require(_0x80bb('0x6'));var jayson=require(_0x80bb('0x7'));var client=jayson['client'][_0x80bb('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x420b11,_0x45ee86,_0x5400e0){return new BPromise(function(_0x33a6a9,_0x5c764b){return client['request'](_0x420b11,_0x5400e0)[_0x80bb('0x9')](function(_0x400bde){logger['info'](_0x80bb('0xa'),_0x45ee86,_0x80bb('0xb'));logger[_0x80bb('0xc')](_0x80bb('0xd'),_0x45ee86,'request\x20sent',JSON['stringify'](_0x400bde));if(_0x400bde['error']){if(_0x400bde[_0x80bb('0xe')][_0x80bb('0xf')]===0x1f4){logger[_0x80bb('0xe')](_0x80bb('0xa'),_0x45ee86,_0x400bde[_0x80bb('0xe')][_0x80bb('0x10')]);return _0x5c764b(_0x400bde[_0x80bb('0xe')]['message']);}logger[_0x80bb('0xe')](_0x80bb('0xa'),_0x45ee86,_0x400bde[_0x80bb('0xe')][_0x80bb('0x10')]);return _0x33a6a9(_0x400bde['error'][_0x80bb('0x10')]);}else{logger[_0x80bb('0x11')](_0x80bb('0xa'),_0x45ee86,'request\x20sent');_0x33a6a9(_0x400bde['result'][_0x80bb('0x10')]);}})[_0x80bb('0x12')](function(_0x1fe4a6){logger[_0x80bb('0xe')](_0x80bb('0xa'),_0x45ee86,_0x1fe4a6);_0x5c764b(_0x1fe4a6);});});}exports[_0x80bb('0x13')]=function(_0x3a4196){var _0xed5323=this;return new Promise(function(_0x4b0f0f,_0x2e906c){return db[_0x80bb('0x14')][_0x80bb('0x15')](_0x3a4196[_0x80bb('0x16')],{'raw':_0x3a4196['options']?_0x3a4196[_0x80bb('0x17')][_0x80bb('0x18')]===undefined?!![]:![]:!![]})[_0x80bb('0x9')](function(_0x2e5047){logger[_0x80bb('0x11')](_0x80bb('0x13'),_0x3a4196);logger['debug'](_0x80bb('0x13'),_0x3a4196,JSON[_0x80bb('0x19')](_0x2e5047));_0x4b0f0f(_0x2e5047);})[_0x80bb('0x12')](function(_0x1c9505){logger[_0x80bb('0xe')](_0x80bb('0x13'),_0x1c9505['message'],_0x3a4196);_0x2e906c(_0xed5323[_0x80bb('0xe')](0x1f4,_0x1c9505['message']));});});}; \ No newline at end of file +var _0xdf06=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','ReportAgentPreview,\x20%s,\x20%s','message','catch','CreateReportAgentPreview','ReportAgentPreview','body','options','raw','lodash','util'];(function(_0x16544d,_0x496861){var _0x3dc181=function(_0x17da84){while(--_0x17da84){_0x16544d['push'](_0x16544d['shift']());}};_0x3dc181(++_0x496861);}(_0xdf06,0xc2));var _0x6df0=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xdf06[_0x138adb];return _0x1b27f2;};'use strict';var _=require(_0x6df0('0x0'));var util=require(_0x6df0('0x1'));var moment=require(_0x6df0('0x2'));var BPromise=require(_0x6df0('0x3'));var rs=require(_0x6df0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6df0('0x5'))['db'];var utils=require(_0x6df0('0x6'));var logger=require(_0x6df0('0x7'))('rpc');var config=require(_0x6df0('0x8'));var jayson=require(_0x6df0('0x9'));var client=jayson[_0x6df0('0xa')][_0x6df0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x36a036,_0x3c010e,_0x11f38a){return new BPromise(function(_0xe04f77,_0x5ddfcb){return client['request'](_0x36a036,_0x11f38a)[_0x6df0('0xc')](function(_0x24f71f){logger[_0x6df0('0xd')]('ReportAgentPreview,\x20%s,\x20%s',_0x3c010e,_0x6df0('0xe'));logger[_0x6df0('0xf')](_0x6df0('0x10'),_0x3c010e,'request\x20sent',JSON[_0x6df0('0x11')](_0x24f71f));if(_0x24f71f[_0x6df0('0x12')]){if(_0x24f71f['error'][_0x6df0('0x13')]===0x1f4){logger['error'](_0x6df0('0x14'),_0x3c010e,_0x24f71f[_0x6df0('0x12')][_0x6df0('0x15')]);return _0x5ddfcb(_0x24f71f[_0x6df0('0x12')]['message']);}logger[_0x6df0('0x12')]('ReportAgentPreview,\x20%s,\x20%s',_0x3c010e,_0x24f71f[_0x6df0('0x12')][_0x6df0('0x15')]);return _0xe04f77(_0x24f71f['error'][_0x6df0('0x15')]);}else{logger[_0x6df0('0xd')](_0x6df0('0x14'),_0x3c010e,_0x6df0('0xe'));_0xe04f77(_0x24f71f['result'][_0x6df0('0x15')]);}})[_0x6df0('0x16')](function(_0x561735){logger[_0x6df0('0x12')](_0x6df0('0x14'),_0x3c010e,_0x561735);_0x5ddfcb(_0x561735);});});}exports[_0x6df0('0x17')]=function(_0x2860f8){var _0x176244=this;return new Promise(function(_0x2fc217,_0x57cd1d){return db[_0x6df0('0x18')]['create'](_0x2860f8[_0x6df0('0x19')],{'raw':_0x2860f8[_0x6df0('0x1a')]?_0x2860f8[_0x6df0('0x1a')][_0x6df0('0x1b')]===undefined?!![]:![]:!![]})[_0x6df0('0xc')](function(_0x1e73af){logger['info'](_0x6df0('0x17'),_0x2860f8);logger['debug'](_0x6df0('0x17'),_0x2860f8,JSON[_0x6df0('0x11')](_0x1e73af));_0x2fc217(_0x1e73af);})[_0x6df0('0x16')](function(_0x304127){logger[_0x6df0('0x12')](_0x6df0('0x17'),_0x304127[_0x6df0('0x15')],_0x2860f8);_0x57cd1d(_0x176244[_0x6df0('0x12')](0x1f4,_0x304127['message']));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 8e9fa04..0e02952 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 _0xd5b6=['exports','express','Router','./rpc.controller','get','/voice/channels','isAuthenticated','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','put','/voice/queues/:id','updateVoiceQueue','/outbound','outbound','/agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','chatQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','post','queueNotify','mail','/mail/queues/:id','showMailQueues','chat','/chat/queues/:id','showChatQueues','showFaxQueues','/openchannel/queues/:id/notify','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','/agents/:id/notify','agentNotify'];(function(_0x3299d1,_0x545733){var _0x44356e=function(_0x52fd77){while(--_0x52fd77){_0x3299d1['push'](_0x3299d1['shift']());}};_0x44356e(++_0x545733);}(_0xd5b6,0x191));var _0x6d5b=function(_0x4fbaf5,_0x345457){_0x4fbaf5=_0x4fbaf5-0x0;var _0x58c5c5=_0xd5b6[_0x4fbaf5];return _0x58c5c5;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var express=require(_0x6d5b('0x0'));var router=express[_0x6d5b('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x6d5b('0x2'));router[_0x6d5b('0x3')](_0x6d5b('0x4'),auth[_0x6d5b('0x5')](),controller['voiceChannels']);router[_0x6d5b('0x3')](_0x6d5b('0x6'),auth['isAuthenticated'](),controller[_0x6d5b('0x7')]);router[_0x6d5b('0x3')](_0x6d5b('0x8'),auth[_0x6d5b('0x5')](),controller[_0x6d5b('0x9')]);router[_0x6d5b('0x3')](_0x6d5b('0xa'),auth['isAuthenticated'](),controller[_0x6d5b('0xb')]);router[_0x6d5b('0x3')](_0x6d5b('0xc'),auth['isAuthenticated'](),controller[_0x6d5b('0xd')]);router['get'](_0x6d5b('0xe'),auth[_0x6d5b('0x5')](),controller[_0x6d5b('0xf')]);router[_0x6d5b('0x3')]('/mail/accounts',auth[_0x6d5b('0x5')](),controller['mailAccounts']);router[_0x6d5b('0x3')](_0x6d5b('0x10'),auth['isAuthenticated'](),controller[_0x6d5b('0x11')]);router[_0x6d5b('0x3')](_0x6d5b('0x12'),auth[_0x6d5b('0x5')](),controller[_0x6d5b('0x13')]);router['get'](_0x6d5b('0x14'),auth[_0x6d5b('0x5')](),controller[_0x6d5b('0x15')]);router[_0x6d5b('0x3')]('/fax/queues',auth['isAuthenticated'](),controller[_0x6d5b('0x16')]);router['get'](_0x6d5b('0x17'),auth[_0x6d5b('0x5')](),controller[_0x6d5b('0x18')]);router[_0x6d5b('0x3')](_0x6d5b('0x19'),auth[_0x6d5b('0x5')](),controller[_0x6d5b('0x1a')]);router['get'](_0x6d5b('0x1b'),auth[_0x6d5b('0x5')](),controller[_0x6d5b('0x1c')]);router[_0x6d5b('0x3')](_0x6d5b('0x1d'),auth[_0x6d5b('0x5')](),controller[_0x6d5b('0x1e')]);router['get'](_0x6d5b('0x1f'),auth[_0x6d5b('0x5')](),controller[_0x6d5b('0x20')]);router[_0x6d5b('0x3')]('/voice/queues/:id',auth[_0x6d5b('0x5')](),controller['showVoiceQueues']);router[_0x6d5b('0x21')](_0x6d5b('0x22'),auth['isAuthenticated'](),controller[_0x6d5b('0x23')]);router[_0x6d5b('0x3')](_0x6d5b('0x24'),auth[_0x6d5b('0x5')](),controller[_0x6d5b('0x25')]);router['get']('/outbound/channels',auth[_0x6d5b('0x5')](),controller['outboundChannels']);router[_0x6d5b('0x3')](_0x6d5b('0x26'),auth[_0x6d5b('0x5')](),controller['agents']);router['put'](_0x6d5b('0x27'),auth[_0x6d5b('0x5')](),controller[_0x6d5b('0x28')]);router[_0x6d5b('0x3')](_0x6d5b('0x29'),auth[_0x6d5b('0x5')](),controller[_0x6d5b('0x2a')]);router[_0x6d5b('0x3')](_0x6d5b('0x2b'),auth[_0x6d5b('0x5')](),controller['trunks']);router[_0x6d5b('0x3')](_0x6d5b('0x2c'),auth[_0x6d5b('0x5')](),controller[_0x6d5b('0x2d')]);router[_0x6d5b('0x3')](_0x6d5b('0x2e'),auth[_0x6d5b('0x5')](),controller[_0x6d5b('0x2f')]);router['get']('/chat/queues/waitinginteractions',auth[_0x6d5b('0x5')](),controller[_0x6d5b('0x30')]);router[_0x6d5b('0x3')]('/mail/queues/waitinginteractions',auth[_0x6d5b('0x5')](),controller['mailQueuesWaitingInteractions']);router[_0x6d5b('0x3')](_0x6d5b('0x31'),auth[_0x6d5b('0x5')](),controller[_0x6d5b('0x32')]);router[_0x6d5b('0x3')](_0x6d5b('0x33'),auth[_0x6d5b('0x5')](),controller[_0x6d5b('0x34')]);router['get'](_0x6d5b('0x35'),auth[_0x6d5b('0x5')](),controller[_0x6d5b('0x36')]);router[_0x6d5b('0x3')](_0x6d5b('0x37'),auth['isAuthenticated'](),controller[_0x6d5b('0x38')]);router[_0x6d5b('0x3')](_0x6d5b('0x39'),auth['isAuthenticated'](),controller['faxQueuesWaitingInteractions']);router[_0x6d5b('0x3a')]('/mail/queues/:id/notify',auth[_0x6d5b('0x5')](),controller[_0x6d5b('0x3b')](_0x6d5b('0x3c')));router[_0x6d5b('0x3')](_0x6d5b('0x3d'),auth[_0x6d5b('0x5')](),controller[_0x6d5b('0x3e')]);router[_0x6d5b('0x3a')]('/chat/queues/:id/notify',auth[_0x6d5b('0x5')](),controller[_0x6d5b('0x3b')](_0x6d5b('0x3f')));router[_0x6d5b('0x3')](_0x6d5b('0x40'),auth[_0x6d5b('0x5')](),controller[_0x6d5b('0x41')]);router['post']('/fax/queues/:id/notify',auth[_0x6d5b('0x5')](),controller[_0x6d5b('0x3b')]('fax'));router['get']('/fax/queues/:id',auth[_0x6d5b('0x5')](),controller[_0x6d5b('0x42')]);router[_0x6d5b('0x3a')](_0x6d5b('0x43'),auth['isAuthenticated'](),controller['queueNotify']('openchannel'));router[_0x6d5b('0x3')](_0x6d5b('0x44'),auth['isAuthenticated'](),controller[_0x6d5b('0x45')]);router[_0x6d5b('0x3a')](_0x6d5b('0x46'),auth[_0x6d5b('0x5')](),controller['queueNotify'](_0x6d5b('0x47')));router[_0x6d5b('0x3a')](_0x6d5b('0x48'),auth['isAuthenticated'](),controller[_0x6d5b('0x3b')](_0x6d5b('0x49')));router[_0x6d5b('0x3')](_0x6d5b('0x4a'),auth[_0x6d5b('0x5')](),controller[_0x6d5b('0x4b')]);router['get'](_0x6d5b('0x4c'),auth['isAuthenticated'](),controller['showWhatsappQueues']);router['post'](_0x6d5b('0x4d'),auth[_0x6d5b('0x5')](),controller[_0x6d5b('0x4e')]);module[_0x6d5b('0x4f')]=router; \ No newline at end of file +var _0x5a1f=['exports','path','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/queues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels/:uniqueid','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound','outbound','/outbound/channels','agents','/agents/:id/capacity','/telephones','telephones','trunks','/campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','/mail/queues/:id/notify','queueNotify','mail','showMailQueues','post','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','fax','/fax/queues/:id','showFaxQueues','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x5a1f,0xf7));var _0xf5a1=function(_0x39e955,_0x14fcb8){_0x39e955=_0x39e955-0x0;var _0x42b48f=_0x5a1f[_0x39e955];return _0x42b48f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf5a1('0x0'));var express=require('express');var router=express[_0xf5a1('0x1')]();var auth=require(_0xf5a1('0x2'));var controller=require(_0xf5a1('0x3'));router[_0xf5a1('0x4')](_0xf5a1('0x5'),auth[_0xf5a1('0x6')](),controller['voiceChannels']);router[_0xf5a1('0x4')](_0xf5a1('0x7'),auth[_0xf5a1('0x6')](),controller[_0xf5a1('0x8')]);router[_0xf5a1('0x4')]('/voice/channels/:uniqueid/stopmixmonitor',auth[_0xf5a1('0x6')](),controller['voiceChannelStopMixMonitor']);router[_0xf5a1('0x4')](_0xf5a1('0x9'),auth[_0xf5a1('0x6')](),controller['voiceQueues']);router[_0xf5a1('0x4')](_0xf5a1('0xa'),auth[_0xf5a1('0x6')](),controller[_0xf5a1('0xb')]);router[_0xf5a1('0x4')](_0xf5a1('0xc'),auth[_0xf5a1('0x6')](),controller[_0xf5a1('0xd')]);router[_0xf5a1('0x4')](_0xf5a1('0xe'),auth[_0xf5a1('0x6')](),controller['mailAccounts']);router['get'](_0xf5a1('0xf'),auth[_0xf5a1('0x6')](),controller[_0xf5a1('0x10')]);router[_0xf5a1('0x4')](_0xf5a1('0x11'),auth[_0xf5a1('0x6')](),controller[_0xf5a1('0x12')]);router['get']('/whatsapp/queues',auth[_0xf5a1('0x6')](),controller[_0xf5a1('0x13')]);router['get'](_0xf5a1('0x14'),auth[_0xf5a1('0x6')](),controller[_0xf5a1('0x15')]);router[_0xf5a1('0x4')](_0xf5a1('0x16'),auth[_0xf5a1('0x6')](),controller[_0xf5a1('0x17')]);router[_0xf5a1('0x4')]('/voice/queues/channels',auth[_0xf5a1('0x6')](),controller['voiceQueuesChannels']);router['get'](_0xf5a1('0x18'),auth['isAuthenticated'](),controller['voiceQueuesChannel']);router[_0xf5a1('0x4')](_0xf5a1('0x19'),auth[_0xf5a1('0x6')](),controller[_0xf5a1('0x1a')]);router[_0xf5a1('0x4')](_0xf5a1('0x1b'),auth['isAuthenticated'](),controller[_0xf5a1('0x1c')]);router['get'](_0xf5a1('0x1d'),auth[_0xf5a1('0x6')](),controller[_0xf5a1('0x1e')]);router[_0xf5a1('0x1f')](_0xf5a1('0x1d'),auth[_0xf5a1('0x6')](),controller[_0xf5a1('0x20')]);router[_0xf5a1('0x4')](_0xf5a1('0x21'),auth['isAuthenticated'](),controller[_0xf5a1('0x22')]);router[_0xf5a1('0x4')](_0xf5a1('0x23'),auth[_0xf5a1('0x6')](),controller['outboundChannels']);router['get']('/agents',auth[_0xf5a1('0x6')](),controller[_0xf5a1('0x24')]);router[_0xf5a1('0x1f')](_0xf5a1('0x25'),auth[_0xf5a1('0x6')](),controller['agentCapacity']);router[_0xf5a1('0x4')](_0xf5a1('0x26'),auth[_0xf5a1('0x6')](),controller[_0xf5a1('0x27')]);router['get']('/trunks',auth['isAuthenticated'](),controller[_0xf5a1('0x28')]);router[_0xf5a1('0x4')](_0xf5a1('0x29'),auth['isAuthenticated'](),controller['campaigns']);router[_0xf5a1('0x4')](_0xf5a1('0x2a'),auth[_0xf5a1('0x6')](),controller[_0xf5a1('0x2b')]);router[_0xf5a1('0x4')](_0xf5a1('0x2c'),auth['isAuthenticated'](),controller[_0xf5a1('0x2d')]);router[_0xf5a1('0x4')](_0xf5a1('0x2e'),auth[_0xf5a1('0x6')](),controller[_0xf5a1('0x2f')]);router[_0xf5a1('0x4')](_0xf5a1('0x30'),auth[_0xf5a1('0x6')](),controller[_0xf5a1('0x31')]);router[_0xf5a1('0x4')](_0xf5a1('0x32'),auth[_0xf5a1('0x6')](),controller[_0xf5a1('0x33')]);router['get'](_0xf5a1('0x34'),auth[_0xf5a1('0x6')](),controller[_0xf5a1('0x35')]);router[_0xf5a1('0x4')](_0xf5a1('0x36'),auth[_0xf5a1('0x6')](),controller['whatsappQueuesWaitingInteractions']);router[_0xf5a1('0x4')](_0xf5a1('0x37'),auth[_0xf5a1('0x6')](),controller[_0xf5a1('0x38')]);router['post'](_0xf5a1('0x39'),auth[_0xf5a1('0x6')](),controller[_0xf5a1('0x3a')](_0xf5a1('0x3b')));router[_0xf5a1('0x4')]('/mail/queues/:id',auth[_0xf5a1('0x6')](),controller[_0xf5a1('0x3c')]);router[_0xf5a1('0x3d')](_0xf5a1('0x3e'),auth[_0xf5a1('0x6')](),controller[_0xf5a1('0x3a')](_0xf5a1('0x3f')));router[_0xf5a1('0x4')](_0xf5a1('0x40'),auth['isAuthenticated'](),controller[_0xf5a1('0x41')]);router[_0xf5a1('0x3d')]('/fax/queues/:id/notify',auth[_0xf5a1('0x6')](),controller[_0xf5a1('0x3a')](_0xf5a1('0x42')));router[_0xf5a1('0x4')](_0xf5a1('0x43'),auth['isAuthenticated'](),controller[_0xf5a1('0x44')]);router[_0xf5a1('0x3d')]('/openchannel/queues/:id/notify',auth[_0xf5a1('0x6')](),controller[_0xf5a1('0x3a')](_0xf5a1('0x45')));router['get'](_0xf5a1('0x46'),auth[_0xf5a1('0x6')](),controller[_0xf5a1('0x47')]);router['post'](_0xf5a1('0x48'),auth[_0xf5a1('0x6')](),controller[_0xf5a1('0x3a')](_0xf5a1('0x49')));router['post'](_0xf5a1('0x4a'),auth[_0xf5a1('0x6')](),controller[_0xf5a1('0x3a')](_0xf5a1('0x4b')));router[_0xf5a1('0x4')](_0xf5a1('0x4c'),auth[_0xf5a1('0x6')](),controller[_0xf5a1('0x4d')]);router[_0xf5a1('0x4')](_0xf5a1('0x4e'),auth['isAuthenticated'](),controller[_0xf5a1('0x4f')]);router[_0xf5a1('0x3d')](_0xf5a1('0x50'),auth[_0xf5a1('0x6')](),controller['agentNotify']);module[_0xf5a1('0x51')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index b4608b2..7de5c02 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 _0xd451=['value','indexOf','queue_id','filter','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','queueNotify','Queue','findOne','\x20Queue\x20not\x20found','Interaction','\x20Message\x20not\x20found','update','queue','MessageId','InteractionId','From','Account','QueueId','TransferReport','create','Start','queueTransferTimeout','agentNotify','channel','Channel\x20field\x20is\x20mandatory','capitalize','Website','User','Agent\x20not\x20found','Message','bluebird','moment','lodash','../../mysqldb','jayson/promise','client','http','request','error','code','message','result','json','sendStatus','name','send','isNil','rows','find','voiceChannels','VoiceChannels','then','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','query','params','catch','voiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','OutboundChannels','agents','Agents','interaction','user','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','MemberReport','findOrCreate','SIP/%s','interface','agent','AgentCapacity','capacity','Telephones','trunks','chatQueues','showChatQueues','ChatQueues','mailQueues','showMailQueues','MailQueues','mailAccounts','MailAccounts','openchannelQueues','showOpenchannelQueues','OpenchannelQueues','SmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','faxAccounts','FaxAccounts','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','map','uniq'];(function(_0x2679c0,_0x2ee8b5){var _0x1e54b1=function(_0x3b292){while(--_0x3b292){_0x2679c0['push'](_0x2679c0['shift']());}};_0x1e54b1(++_0x2ee8b5);}(_0xd451,0x117));var _0x1d45=function(_0x3a512c,_0x42cc62){_0x3a512c=_0x3a512c-0x0;var _0x3a5597=_0xd451[_0x3a512c];return _0x3a5597;};'use strict';var BPromise=require(_0x1d45('0x0'));var moment=require(_0x1d45('0x1'));var _=require(_0x1d45('0x2'));var util=require('util');var db=require(_0x1d45('0x3'))['db'];var logger=require('../../config/logger')('api');var jayson=require(_0x1d45('0x4'));var amiClient=jayson[_0x1d45('0x5')][_0x1d45('0x6')]({'port':0x232a});var mailClient=jayson[_0x1d45('0x5')]['http']({'port':0x232b});var routingClient=jayson['client'][_0x1d45('0x6')]({'port':0x232c});function respondWithRpcPromise(_0xe6ebb2,_0x51d904,_0x291135){return new BPromise(function(_0x12679d,_0x5b979b){var _0x239133=_0x291135?_0x291135:amiClient;return _0x239133[_0x1d45('0x7')](_0xe6ebb2,_0x51d904)['then'](function(_0xed51d0){if(_0xed51d0[_0x1d45('0x8')]){if(_0xed51d0[_0x1d45('0x8')][_0x1d45('0x9')]===0x1f4){return _0x5b979b(_0xed51d0['error'][_0x1d45('0xa')]);}return _0x12679d(_0xed51d0[_0x1d45('0x8')][_0x1d45('0xa')]);}else{_0x12679d(_0xed51d0[_0x1d45('0xb')]);}})['catch'](function(_0x1cc812){_0x5b979b(_0x1cc812);});});}function respondWithResult(_0x28d26c,_0xe38fe0){_0xe38fe0=_0xe38fe0||0xc8;return function(_0x3661b1){if(_0x3661b1){return _0x28d26c['status'](_0xe38fe0)[_0x1d45('0xc')](_0x3661b1);}return _0x28d26c[_0x1d45('0xd')](0x194);};}function handleError(_0x69f17b,_0x356cb3){_0x356cb3=_0x356cb3||0x1f4;return function(_0x85a658){logger['error'](_0x85a658['stack']);if(_0x85a658[_0x1d45('0xe')]){delete _0x85a658['name'];}_0x69f17b['status'](_0x356cb3)[_0x1d45('0xf')](_0x85a658);};}function findById(_0x41a9c3){return function(_0x48dbab){if(!_[_0x1d45('0x10')](_0x41a9c3)&&!_[_0x1d45('0x10')](_0x48dbab)&&!_['isNil'](_0x48dbab[_0x1d45('0x11')])){return _[_0x1d45('0x12')](_0x48dbab['rows'],function(_0x46f8b5){return _0x46f8b5['id']==_0x41a9c3;});}return null;};}exports[_0x1d45('0x13')]=function(_0x6b41ff,_0x1a5c64){return respondWithRpcPromise(_0x1d45('0x14'),_0x6b41ff['query'])[_0x1d45('0x15')](respondWithResult(_0x1a5c64,null))['catch'](handleError(_0x1a5c64,null));};exports[_0x1d45('0x16')]=function(_0x3682b5,_0x2de4d9){return respondWithRpcPromise(_0x1d45('0x17'),_[_0x1d45('0x18')](_0x3682b5[_0x1d45('0x19')],_0x3682b5[_0x1d45('0x1a')]))[_0x1d45('0x15')](respondWithResult(_0x2de4d9,null))[_0x1d45('0x1b')](handleError(_0x2de4d9,null));};exports[_0x1d45('0x1c')]=function(_0x39b7d0,_0x2a404d){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_[_0x1d45('0x18')](_0x39b7d0['query'],_0x39b7d0[_0x1d45('0x1a')]))[_0x1d45('0x15')](respondWithResult(_0x2a404d,null))[_0x1d45('0x1b')](handleError(_0x2a404d,null));};exports[_0x1d45('0x1d')]=function(_0x46ca79,_0x397320){return respondWithRpcPromise(_0x1d45('0x1e'),_0x46ca79[_0x1d45('0x19')])[_0x1d45('0x15')](respondWithResult(_0x397320,null))[_0x1d45('0x1b')](handleError(_0x397320,null));};exports[_0x1d45('0x1f')]=function(_0x473b3d,_0x1e0f66){return respondWithRpcPromise('VoiceQueues',_0x473b3d[_0x1d45('0x19')])['then'](findById(_0x473b3d[_0x1d45('0x1a')]['id']))[_0x1d45('0x15')](respondWithResult(_0x1e0f66,null))[_0x1d45('0x1b')](handleError(_0x1e0f66,null));};exports['updateVoiceQueue']=function(_0x374640,_0x5bf145){return respondWithRpcPromise(_0x1d45('0x20'),_['merge'](_0x374640[_0x1d45('0x21')],_0x374640[_0x1d45('0x1a')]))['then'](respondWithResult(_0x5bf145,null))[_0x1d45('0x1b')](handleError(_0x5bf145,null));};exports[_0x1d45('0x22')]=function(_0x40d3c1,_0x4e140c){return respondWithRpcPromise('VoiceQueuesPreview',_[_0x1d45('0x18')](_0x40d3c1[_0x1d45('0x19')],_0x40d3c1['params']))['then'](respondWithResult(_0x4e140c,null))['catch'](handleError(_0x4e140c,null));};exports[_0x1d45('0x23')]=function(_0x21b4f5,_0x543a08){return respondWithRpcPromise(_0x1d45('0x24'),_0x21b4f5[_0x1d45('0x19')])[_0x1d45('0x15')](respondWithResult(_0x543a08,null))[_0x1d45('0x1b')](handleError(_0x543a08,null));};exports[_0x1d45('0x25')]=function(_0x540443,_0x4e6ca2){return respondWithRpcPromise(_0x1d45('0x26'),_['merge'](_0x540443[_0x1d45('0x19')],_0x540443['params']))[_0x1d45('0x15')](respondWithResult(_0x4e6ca2,null))['catch'](handleError(_0x4e6ca2,null));};exports[_0x1d45('0x27')]=function(_0x1c82ba,_0x497639){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0x1d45('0x18')](_0x1c82ba[_0x1d45('0x19')],_0x1c82ba['params']))[_0x1d45('0x15')](respondWithResult(_0x497639,null))[_0x1d45('0x1b')](handleError(_0x497639,null));};exports[_0x1d45('0x28')]=function(_0x109f0e,_0x1167cd){return respondWithRpcPromise(_0x1d45('0x29'),_[_0x1d45('0x18')](_0x109f0e[_0x1d45('0x19')],_0x109f0e[_0x1d45('0x1a')]))['then'](respondWithResult(_0x1167cd,null))[_0x1d45('0x1b')](handleError(_0x1167cd,null));};exports[_0x1d45('0x2a')]=function(_0x4a1e8a,_0x563ef4){return respondWithRpcPromise(_0x1d45('0x2b'),_0x4a1e8a[_0x1d45('0x19')])[_0x1d45('0x15')](respondWithResult(_0x563ef4,null))[_0x1d45('0x1b')](handleError(_0x563ef4,null));};exports['outboundChannels']=function(_0x28e03c,_0x21f035){return respondWithRpcPromise(_0x1d45('0x2c'),_0x28e03c[_0x1d45('0x19')])[_0x1d45('0x15')](respondWithResult(_0x21f035,null))[_0x1d45('0x1b')](handleError(_0x21f035,null));};exports[_0x1d45('0x2d')]=function(_0x173e8a,_0x579f10){var _0x3d9ddf;return respondWithRpcPromise(_0x1d45('0x2e'),_0x173e8a[_0x1d45('0x19')])[_0x1d45('0x15')](function(_0x49e02a){_0x3d9ddf=_0x49e02a;return respondWithRpcPromise(_0x1d45('0x2e'),_0x173e8a[_0x1d45('0x19')],routingClient);})[_0x1d45('0x15')](function(_0x386208){return _[_0x1d45('0x18')]({},_0x386208,_0x3d9ddf);})[_0x1d45('0x15')](respondWithResult(_0x579f10,null))[_0x1d45('0x1b')](handleError(_0x579f10,null));};exports['agentCapacity']=function(_0x185801,_0x2d8945){if(_0x185801['body']&&_0x185801['body'][_0x1d45('0x2f')]&&_0x185801[_0x1d45('0x30')]&&_0x185801[_0x1d45('0x30')][_0x1d45('0xe')]){for(var _0x825af0 in _0x185801[_0x1d45('0x21')][_0x1d45('0x2f')]){if(_0x185801[_0x1d45('0x21')][_0x1d45('0x2f')]['hasOwnProperty'](_0x825af0)){db['MemberReport'][_0x1d45('0x31')]({'where':{'channel':_0x825af0,'membername':_0x185801['user']['name'],'type':_0x1d45('0x32'),'exitAt':null,'uniqueid':_0x185801[_0x1d45('0x21')][_0x1d45('0x2f')][_0x825af0]&&_0x185801[_0x1d45('0x21')]['interaction'][_0x825af0][_0x1d45('0x33')]?{'$notIn':_0x185801[_0x1d45('0x21')][_0x1d45('0x2f')][_0x825af0]}:{'$ne':null}}})['then'](function(_0x5f3848){var _0x1cd206=moment()[_0x1d45('0x34')](_0x1d45('0x35'));for(var _0xcc0a0=0x0,_0xa5da6b=_0x5f3848[_0x1d45('0x33')];_0xcc0a0<_0xa5da6b;_0xcc0a0+=0x1){_0x5f3848[_0xcc0a0]['updateAttributes']({'exitAt':_0x1cd206});}});for(var _0x402ee9=0x0;_0x402ee9<_0x185801[_0x1d45('0x21')]['interaction'][_0x825af0][_0x1d45('0x33')];_0x402ee9+=0x1){db[_0x1d45('0x36')][_0x1d45('0x37')]({'where':{'channel':_0x825af0,'membername':_0x185801[_0x1d45('0x30')][_0x1d45('0xe')],'type':'INTERACTION','uniqueid':_0x185801[_0x1d45('0x21')][_0x1d45('0x2f')][_0x825af0][_0x402ee9],'exitAt':null},'defaults':{'channel':_0x825af0,'membername':_0x185801[_0x1d45('0x30')][_0x1d45('0xe')],'interface':_['isNil'](_0x185801['user']['interface'])?util['format'](_0x1d45('0x38'),_0x185801[_0x1d45('0x30')][_0x1d45('0xe')]):_0x185801['user'][_0x1d45('0x39')],'type':_0x1d45('0x32'),'enterAt':moment()[_0x1d45('0x34')](_0x1d45('0x35')),'role':_0x1d45('0x3a'),'internal':_0x185801[_0x1d45('0x30')]['internal'],'uniqueid':_0x185801[_0x1d45('0x21')][_0x1d45('0x2f')][_0x825af0][_0x402ee9]}});}}}}return respondWithRpcPromise(_0x1d45('0x3b'),{'id':_0x185801[_0x1d45('0x1a')]['id'],'capacity':_0x185801[_0x1d45('0x21')][_0x1d45('0x3c')]},routingClient)[_0x1d45('0x15')](respondWithResult(_0x2d8945,null))['catch'](handleError(_0x2d8945,null));};exports['telephones']=function(_0x531c7e,_0x1ca73e){return respondWithRpcPromise(_0x1d45('0x3d'),_0x531c7e[_0x1d45('0x19')])[_0x1d45('0x15')](respondWithResult(_0x1ca73e,null))[_0x1d45('0x1b')](handleError(_0x1ca73e,null));};exports[_0x1d45('0x3e')]=function(_0x1c3383,_0x4e03f3){return respondWithRpcPromise('Trunks',_0x1c3383[_0x1d45('0x19')])[_0x1d45('0x15')](respondWithResult(_0x4e03f3,null))[_0x1d45('0x1b')](handleError(_0x4e03f3,null));};exports['campaigns']=function(_0x29cf82,_0x129cdf){return respondWithRpcPromise('Campaigns',_0x29cf82[_0x1d45('0x19')])['then'](respondWithResult(_0x129cdf,null))[_0x1d45('0x1b')](handleError(_0x129cdf,null));};exports[_0x1d45('0x3f')]=function(_0x56ef8c,_0x23c5a6){return respondWithRpcPromise('ChatQueues',_0x56ef8c[_0x1d45('0x19')],routingClient)[_0x1d45('0x15')](respondWithResult(_0x23c5a6,null))[_0x1d45('0x1b')](handleError(_0x23c5a6,null));};exports[_0x1d45('0x40')]=function(_0x111c9b,_0x2f523d){return respondWithRpcPromise(_0x1d45('0x41'),_0x111c9b[_0x1d45('0x19')],routingClient)['then'](findById(_0x111c9b[_0x1d45('0x1a')]['id']))[_0x1d45('0x15')](respondWithResult(_0x2f523d,null))[_0x1d45('0x1b')](handleError(_0x2f523d,null));};exports[_0x1d45('0x42')]=function(_0x40f7cc,_0x501d0e){return respondWithRpcPromise('MailQueues',_0x40f7cc[_0x1d45('0x19')],routingClient)[_0x1d45('0x15')](respondWithResult(_0x501d0e,null))[_0x1d45('0x1b')](handleError(_0x501d0e,null));};exports[_0x1d45('0x43')]=function(_0x17a135,_0x143130){return respondWithRpcPromise(_0x1d45('0x44'),_0x17a135[_0x1d45('0x19')],routingClient)[_0x1d45('0x15')](findById(_0x17a135[_0x1d45('0x1a')]['id']))[_0x1d45('0x15')](respondWithResult(_0x143130,null))[_0x1d45('0x1b')](handleError(_0x143130,null));};exports[_0x1d45('0x45')]=function(_0x97c6f4,_0x1a35e8){return respondWithRpcPromise(_0x1d45('0x46'),_0x97c6f4['query'],mailClient)['then'](respondWithResult(_0x1a35e8,null))[_0x1d45('0x1b')](handleError(_0x1a35e8,null));};exports[_0x1d45('0x47')]=function(_0x1aee63,_0x526f42){return respondWithRpcPromise('OpenchannelQueues',_0x1aee63[_0x1d45('0x19')],routingClient)[_0x1d45('0x15')](respondWithResult(_0x526f42,null))['catch'](handleError(_0x526f42,null));};exports[_0x1d45('0x48')]=function(_0x12f2e8,_0x540dc9){return respondWithRpcPromise(_0x1d45('0x49'),_0x12f2e8[_0x1d45('0x19')],routingClient)[_0x1d45('0x15')](findById(_0x12f2e8[_0x1d45('0x1a')]['id']))[_0x1d45('0x15')](respondWithResult(_0x540dc9,null))[_0x1d45('0x1b')](handleError(_0x540dc9,null));};exports['smsQueues']=function(_0x746105,_0x434a40){return respondWithRpcPromise(_0x1d45('0x4a'),_0x746105[_0x1d45('0x19')],routingClient)[_0x1d45('0x15')](respondWithResult(_0x434a40,null))[_0x1d45('0x1b')](handleError(_0x434a40,null));};exports['showSmsQueues']=function(_0x46a760,_0x15dd03){return respondWithRpcPromise(_0x1d45('0x4a'),_0x46a760[_0x1d45('0x19')],routingClient)[_0x1d45('0x15')](findById(_0x46a760[_0x1d45('0x1a')]['id']))[_0x1d45('0x15')](respondWithResult(_0x15dd03,null))[_0x1d45('0x1b')](handleError(_0x15dd03,null));};exports[_0x1d45('0x4b')]=function(_0x6606e5,_0x33ba0b){return respondWithRpcPromise(_0x1d45('0x4c'),_0x6606e5[_0x1d45('0x19')],routingClient)[_0x1d45('0x15')](respondWithResult(_0x33ba0b,null))[_0x1d45('0x1b')](handleError(_0x33ba0b,null));};exports[_0x1d45('0x4d')]=function(_0x114edb,_0x2079be){return respondWithRpcPromise(_0x1d45('0x4c'),_0x114edb[_0x1d45('0x19')],routingClient)['then'](findById(_0x114edb[_0x1d45('0x1a')]['id']))[_0x1d45('0x15')](respondWithResult(_0x2079be,null))[_0x1d45('0x1b')](handleError(_0x2079be,null));};exports[_0x1d45('0x4e')]=function(_0x363c9a,_0x496da8){return respondWithRpcPromise('FaxQueues',_0x363c9a['query'],routingClient)[_0x1d45('0x15')](respondWithResult(_0x496da8,null))['catch'](handleError(_0x496da8,null));};exports['showFaxQueues']=function(_0x2bf8a9,_0x330774){return respondWithRpcPromise(_0x1d45('0x4f'),_0x2bf8a9[_0x1d45('0x19')],routingClient)[_0x1d45('0x15')](findById(_0x2bf8a9[_0x1d45('0x1a')]['id']))[_0x1d45('0x15')](respondWithResult(_0x330774,null))['catch'](handleError(_0x330774,null));};exports[_0x1d45('0x50')]=function(_0x3c1c32,_0xe7bba7){return respondWithRpcPromise(_0x1d45('0x51'),_0x3c1c32[_0x1d45('0x19')])[_0x1d45('0x15')](respondWithResult(_0xe7bba7,null))[_0x1d45('0x1b')](handleError(_0xe7bba7,null));};exports['chatQueuesWaitingInteractions']=function(_0x466473,_0x1a75b6){return respondWithRpcPromise(_0x1d45('0x52'),_0x466473[_0x1d45('0x19')],routingClient)[_0x1d45('0x15')](respondWithResult(_0x1a75b6,null))[_0x1d45('0x1b')](handleError(_0x1a75b6,null));};exports[_0x1d45('0x53')]=function(_0x59dffb,_0x2ca31d){return respondWithRpcPromise(_0x1d45('0x54'),_0x59dffb[_0x1d45('0x19')],routingClient)['then'](respondWithResult(_0x2ca31d,null))['catch'](handleError(_0x2ca31d,null));};exports[_0x1d45('0x55')]=function(_0x22ce24,_0x4a8b3c){return respondWithRpcPromise(_0x1d45('0x56'),_0x22ce24[_0x1d45('0x19')],routingClient)[_0x1d45('0x15')](respondWithResult(_0x4a8b3c,null))['catch'](handleError(_0x4a8b3c,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x19d530,_0x50ddb5){return respondWithRpcPromise(_0x1d45('0x56'),_0x19d530[_0x1d45('0x19')],routingClient)[_0x1d45('0x15')](function(_0x2d9a11){if(_0x19d530[_0x1d45('0x19')][_0x1d45('0x57')]!==undefined){var _0x424301=_(_0x2d9a11[_0x1d45('0x11')])['filter']([_0x19d530['query']['type'],_0x19d530[_0x1d45('0x1a')]['id']])[_0x1d45('0x58')]('queue_id')[_0x1d45('0x59')]()[_0x1d45('0x5a')]();return _0x2d9a11['rows']['filter'](function(_0xef4e33){return _0x424301[_0x1d45('0x5b')](_0xef4e33[_0x1d45('0x5c')])>-0x1;});}else{return _0x2d9a11[_0x1d45('0x11')][_0x1d45('0x5d')](function(_0x58d9a7){return _0x58d9a7[_0x1d45('0x5c')]===parseInt(_0x19d530[_0x1d45('0x1a')]['id']);});}})[_0x1d45('0x15')](respondWithResult(_0x50ddb5,null))[_0x1d45('0x1b')](handleError(_0x50ddb5,null));};exports[_0x1d45('0x5e')]=function(_0x307986,_0x3d3ffe){return respondWithRpcPromise(_0x1d45('0x5f'),_0x307986[_0x1d45('0x19')],routingClient)['then'](respondWithResult(_0x3d3ffe,null))[_0x1d45('0x1b')](handleError(_0x3d3ffe,null));};exports[_0x1d45('0x60')]=function(_0x1150c2,_0x4f1931){return respondWithRpcPromise(_0x1d45('0x61'),_0x1150c2[_0x1d45('0x19')],routingClient)[_0x1d45('0x15')](respondWithResult(_0x4f1931,null))[_0x1d45('0x1b')](handleError(_0x4f1931,null));};exports['faxQueuesWaitingInteractions']=function(_0xc0720,_0xa2f355){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0xc0720[_0x1d45('0x19')],routingClient)[_0x1d45('0x15')](respondWithResult(_0xa2f355,null))[_0x1d45('0x1b')](handleError(_0xa2f355,null));};exports[_0x1d45('0x62')]=function(_0x1fd1ff){return function(_0xaa148e,_0x1ad086){var _0x336770,_0x560349;var _0x2b79df=_['capitalize'](_0x1fd1ff);var _0x3e37df=_0x1fd1ff==='chat'?'Website':'Account';return db[_0x2b79df+_0x1d45('0x63')][_0x1d45('0x64')]({'raw':!![],'where':{'id':_0xaa148e['params']['id']}})[_0x1d45('0x15')](function(_0x5068a2){if(_[_0x1d45('0x10')](_0x5068a2)){throw new Error(_0x2b79df+_0x1d45('0x65'));}_0x336770=_0x5068a2;return db[_0x2b79df+'Message'][_0x1d45('0x64')]({'where':{'id':_0xaa148e['body']['messageId']},'include':[{'model':db[_0x2b79df+_0x1d45('0x66')],'as':'Interaction'},{'model':db[_0x2b79df+_0x3e37df],'as':'Account'}]});})[_0x1d45('0x15')](function(_0x2dbdc6){if(_[_0x1d45('0x10')](_0x2dbdc6)){throw new Error(_0x2b79df+_0x1d45('0x67'));}_0x560349=_0x2dbdc6;return _0x2dbdc6[_0x1d45('0x68')]({'read':0x0,'readAt':null,'UserId':null});})[_0x1d45('0x15')](function(){var _0x376bf5={'uniqueid':_0x1fd1ff+'.'+_0x560349['id']+'.'+_0x560349['Interaction']['id'],'FromUserId':_0xaa148e[_0x1d45('0x30')]['id'],'type':_0x1d45('0x69')};_0x376bf5[_0x2b79df+_0x1d45('0x6a')]=_0x560349['id'];_0x376bf5[_0x2b79df+_0x1d45('0x6b')]=_0x560349[_0x1d45('0x66')]['id'];_0x376bf5[_0x1d45('0x6c')+_0x2b79df+_0x3e37df+'Id']=_0x560349[_0x1d45('0x6d')]['id'];_0x376bf5['To'+_0x2b79df+_0x1d45('0x6e')]=_0x336770['id'];return db[_0x2b79df+_0x1d45('0x6f')][_0x1d45('0x70')](_0x376bf5);})[_0x1d45('0x15')](function(){return respondWithRpcPromise(_0x1d45('0x71'),{'channel':_0x1fd1ff,'interaction':_0x560349['Interaction'],'message':_0x560349,'account':_0x560349['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0x1d45('0x69'),'appdata':_0x336770[_0x1d45('0xe')]+','+(_0x560349[_0x1d45('0x6d')][_0x1d45('0x72')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0x1d45('0x15')](respondWithResult(_0x1ad086,null))['catch'](handleError(_0x1ad086,null));};};exports[_0x1d45('0x73')]=function(_0x247c18,_0x14c392){var _0x3cf9f4,_0x29dcec;if(_['isNil'](_0x247c18[_0x1d45('0x21')][_0x1d45('0x74')])){throw new Error(_0x1d45('0x75'));}var _0x53ddbe=_0x247c18[_0x1d45('0x21')]['channel'];var _0x11942a=_[_0x1d45('0x76')](_0x53ddbe);var _0x1b306c=_0x53ddbe==='chat'?_0x1d45('0x77'):_0x1d45('0x6d');return db[_0x1d45('0x78')]['findOne']({'raw':!![],'where':{'id':_0x247c18[_0x1d45('0x1a')]['id'],'role':_0x1d45('0x3a')}})['then'](function(_0x5bf2ec){if(_[_0x1d45('0x10')](_0x5bf2ec)){throw new Error(_0x1d45('0x79'));}_0x3cf9f4=_0x5bf2ec;return db[_0x11942a+_0x1d45('0x7a')][_0x1d45('0x64')]({'where':{'id':_0x247c18['body']['messageId']},'include':[{'model':db[_0x11942a+_0x1d45('0x66')],'as':_0x1d45('0x66')},{'model':db[_0x11942a+_0x1b306c],'as':_0x1d45('0x6d')}]});})[_0x1d45('0x15')](function(_0x888d34){if(_[_0x1d45('0x10')](_0x888d34)){throw new Error(_0x11942a+'\x20Message\x20not\x20found');}_0x29dcec=_0x888d34;return _0x888d34[_0x1d45('0x68')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x3e8f44={'uniqueid':_0x53ddbe+'.'+_0x29dcec['id']+'.'+_0x29dcec['Interaction']['id'],'FromUserId':_0x247c18[_0x1d45('0x30')]['id'],'type':_0x1d45('0x3a'),'ToUserId':_0x3cf9f4['id']};_0x3e8f44[_0x11942a+'MessageId']=_0x29dcec['id'];_0x3e8f44[_0x11942a+_0x1d45('0x6b')]=_0x29dcec[_0x1d45('0x66')]['id'];_0x3e8f44[_0x1d45('0x6c')+_0x11942a+_0x1b306c+'Id']=_0x29dcec[_0x1d45('0x6d')]['id'];return db[_0x11942a+'TransferReport']['create'](_0x3e8f44);})['then'](function(){return respondWithRpcPromise(_0x1d45('0x71'),{'channel':_0x53ddbe,'interaction':_0x29dcec['Interaction'],'message':_0x29dcec,'account':_0x29dcec[_0x1d45('0x6d')],'applications':[{'id':0x0,'priority':0x1,'app':_0x1d45('0x3a'),'appdata':_0x3cf9f4[_0x1d45('0xe')]+','+(_0x29dcec[_0x1d45('0x6d')]['agentTransferTimeout']||0x12c),'interval':'*,*,*,*'}]},routingClient);})['then'](respondWithResult(_0x14c392,null))[_0x1d45('0x1b')](handleError(_0x14c392,null));}; \ No newline at end of file +var _0xa0a0=['FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','rows','filter','type','queue_id','uniq','value','indexOf','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Queue','Message','findOne','messageId','Interaction','Account','MessageId','InteractionId','QueueId','TransferReport','create','queueTransferTimeout','*,*,*,*','agentNotify','channel','User','Agent\x20not\x20found','\x20Message\x20not\x20found','From','Start','agentTransferTimeout','moment','lodash','util','jayson/promise','client','http','request','then','error','code','message','catch','status','sendStatus','stack','name','send','isNil','find','voiceChannels','VoiceChannels','VoiceChannelMixMonitor','merge','query','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','params','voiceQueues','VoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','interaction','user','findAll','length','format','YYYY-MM-DD\x20HH:mm:ss','MemberReport','findOrCreate','interface','SIP/%s','INTERACTION','agent','telephones','Telephones','trunks','Trunks','campaigns','ChatQueues','MailQueues','showMailQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','faxQueues','FaxQueues','faxAccounts'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa0a0,0x11e));var _0x0a0a=function(_0x49f8c2,_0x5166b7){_0x49f8c2=_0x49f8c2-0x0;var _0x3e63ec=_0xa0a0[_0x49f8c2];return _0x3e63ec;};'use strict';var BPromise=require('bluebird');var moment=require(_0x0a0a('0x0'));var _=require(_0x0a0a('0x1'));var util=require(_0x0a0a('0x2'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')('api');var jayson=require(_0x0a0a('0x3'));var amiClient=jayson[_0x0a0a('0x4')][_0x0a0a('0x5')]({'port':0x232a});var mailClient=jayson['client'][_0x0a0a('0x5')]({'port':0x232b});var routingClient=jayson['client'][_0x0a0a('0x5')]({'port':0x232c});function respondWithRpcPromise(_0x4f0448,_0x4a7e23,_0x8bc561){return new BPromise(function(_0x4f7464,_0x55d082){var _0x428482=_0x8bc561?_0x8bc561:amiClient;return _0x428482[_0x0a0a('0x6')](_0x4f0448,_0x4a7e23)[_0x0a0a('0x7')](function(_0xd38c41){if(_0xd38c41[_0x0a0a('0x8')]){if(_0xd38c41[_0x0a0a('0x8')][_0x0a0a('0x9')]===0x1f4){return _0x55d082(_0xd38c41[_0x0a0a('0x8')][_0x0a0a('0xa')]);}return _0x4f7464(_0xd38c41[_0x0a0a('0x8')][_0x0a0a('0xa')]);}else{_0x4f7464(_0xd38c41['result']);}})[_0x0a0a('0xb')](function(_0x5b5f6b){_0x55d082(_0x5b5f6b);});});}function respondWithResult(_0x52e175,_0x4019f3){_0x4019f3=_0x4019f3||0xc8;return function(_0x56e81b){if(_0x56e81b){return _0x52e175[_0x0a0a('0xc')](_0x4019f3)['json'](_0x56e81b);}return _0x52e175[_0x0a0a('0xd')](0x194);};}function handleError(_0x40f0d0,_0x5942be){_0x5942be=_0x5942be||0x1f4;return function(_0x525872){logger[_0x0a0a('0x8')](_0x525872[_0x0a0a('0xe')]);if(_0x525872[_0x0a0a('0xf')]){delete _0x525872['name'];}_0x40f0d0[_0x0a0a('0xc')](_0x5942be)[_0x0a0a('0x10')](_0x525872);};}function findById(_0x25db4e){return function(_0x221751){if(!_[_0x0a0a('0x11')](_0x25db4e)&&!_[_0x0a0a('0x11')](_0x221751)&&!_[_0x0a0a('0x11')](_0x221751['rows'])){return _[_0x0a0a('0x12')](_0x221751['rows'],function(_0x330c1d){return _0x330c1d['id']==_0x25db4e;});}return null;};}exports[_0x0a0a('0x13')]=function(_0x5f160a,_0x452c5e){return respondWithRpcPromise(_0x0a0a('0x14'),_0x5f160a['query'])[_0x0a0a('0x7')](respondWithResult(_0x452c5e,null))[_0x0a0a('0xb')](handleError(_0x452c5e,null));};exports['voiceChannelMixMonitor']=function(_0x1e28a4,_0x39f932){return respondWithRpcPromise(_0x0a0a('0x15'),_[_0x0a0a('0x16')](_0x1e28a4[_0x0a0a('0x17')],_0x1e28a4['params']))[_0x0a0a('0x7')](respondWithResult(_0x39f932,null))['catch'](handleError(_0x39f932,null));};exports[_0x0a0a('0x18')]=function(_0x21555d,_0x5545ab){return respondWithRpcPromise(_0x0a0a('0x19'),_[_0x0a0a('0x16')](_0x21555d[_0x0a0a('0x17')],_0x21555d[_0x0a0a('0x1a')]))[_0x0a0a('0x7')](respondWithResult(_0x5545ab,null))['catch'](handleError(_0x5545ab,null));};exports[_0x0a0a('0x1b')]=function(_0x23c2f9,_0x3614cd){return respondWithRpcPromise(_0x0a0a('0x1c'),_0x23c2f9[_0x0a0a('0x17')])[_0x0a0a('0x7')](respondWithResult(_0x3614cd,null))[_0x0a0a('0xb')](handleError(_0x3614cd,null));};exports['showVoiceQueues']=function(_0xa2eea1,_0x914b77){return respondWithRpcPromise('VoiceQueues',_0xa2eea1[_0x0a0a('0x17')])[_0x0a0a('0x7')](findById(_0xa2eea1['params']['id']))[_0x0a0a('0x7')](respondWithResult(_0x914b77,null))[_0x0a0a('0xb')](handleError(_0x914b77,null));};exports['updateVoiceQueue']=function(_0x296c52,_0x4f318e){return respondWithRpcPromise(_0x0a0a('0x1d'),_[_0x0a0a('0x16')](_0x296c52[_0x0a0a('0x1e')],_0x296c52[_0x0a0a('0x1a')]))[_0x0a0a('0x7')](respondWithResult(_0x4f318e,null))[_0x0a0a('0xb')](handleError(_0x4f318e,null));};exports[_0x0a0a('0x1f')]=function(_0x335bf7,_0x311fe8){return respondWithRpcPromise(_0x0a0a('0x20'),_[_0x0a0a('0x16')](_0x335bf7[_0x0a0a('0x17')],_0x335bf7[_0x0a0a('0x1a')]))['then'](respondWithResult(_0x311fe8,null))[_0x0a0a('0xb')](handleError(_0x311fe8,null));};exports[_0x0a0a('0x21')]=function(_0x3dfd42,_0x597455){return respondWithRpcPromise(_0x0a0a('0x22'),_0x3dfd42[_0x0a0a('0x17')])[_0x0a0a('0x7')](respondWithResult(_0x597455,null))[_0x0a0a('0xb')](handleError(_0x597455,null));};exports[_0x0a0a('0x23')]=function(_0x2927a3,_0x58d859){return respondWithRpcPromise(_0x0a0a('0x24'),_[_0x0a0a('0x16')](_0x2927a3[_0x0a0a('0x17')],_0x2927a3['params']))['then'](respondWithResult(_0x58d859,null))[_0x0a0a('0xb')](handleError(_0x58d859,null));};exports[_0x0a0a('0x25')]=function(_0x1a236d,_0x1ae507){return respondWithRpcPromise('VoiceQueuesChannelHangup',_['merge'](_0x1a236d[_0x0a0a('0x17')],_0x1a236d[_0x0a0a('0x1a')]))[_0x0a0a('0x7')](respondWithResult(_0x1ae507,null))[_0x0a0a('0xb')](handleError(_0x1ae507,null));};exports[_0x0a0a('0x26')]=function(_0x48955b,_0x21ac6d){return respondWithRpcPromise(_0x0a0a('0x27'),_[_0x0a0a('0x16')](_0x48955b[_0x0a0a('0x17')],_0x48955b[_0x0a0a('0x1a')]))['then'](respondWithResult(_0x21ac6d,null))['catch'](handleError(_0x21ac6d,null));};exports[_0x0a0a('0x28')]=function(_0x22144a,_0x333a11){return respondWithRpcPromise(_0x0a0a('0x29'),_0x22144a[_0x0a0a('0x17')])[_0x0a0a('0x7')](respondWithResult(_0x333a11,null))[_0x0a0a('0xb')](handleError(_0x333a11,null));};exports[_0x0a0a('0x2a')]=function(_0x4c2b82,_0x560332){return respondWithRpcPromise(_0x0a0a('0x2b'),_0x4c2b82[_0x0a0a('0x17')])[_0x0a0a('0x7')](respondWithResult(_0x560332,null))[_0x0a0a('0xb')](handleError(_0x560332,null));};exports[_0x0a0a('0x2c')]=function(_0x230c5e,_0x4ca82b){var _0x133c99;return respondWithRpcPromise(_0x0a0a('0x2d'),_0x230c5e[_0x0a0a('0x17')])[_0x0a0a('0x7')](function(_0x1df317){_0x133c99=_0x1df317;return respondWithRpcPromise('Agents',_0x230c5e[_0x0a0a('0x17')],routingClient);})[_0x0a0a('0x7')](function(_0xe14171){return _[_0x0a0a('0x16')]({},_0xe14171,_0x133c99);})[_0x0a0a('0x7')](respondWithResult(_0x4ca82b,null))[_0x0a0a('0xb')](handleError(_0x4ca82b,null));};exports[_0x0a0a('0x2e')]=function(_0x411de0,_0x1c62cb){if(_0x411de0['body']&&_0x411de0[_0x0a0a('0x1e')][_0x0a0a('0x2f')]&&_0x411de0[_0x0a0a('0x30')]&&_0x411de0['user'][_0x0a0a('0xf')]){for(var _0x35676f in _0x411de0['body'][_0x0a0a('0x2f')]){if(_0x411de0[_0x0a0a('0x1e')][_0x0a0a('0x2f')]['hasOwnProperty'](_0x35676f)){db['MemberReport'][_0x0a0a('0x31')]({'where':{'channel':_0x35676f,'membername':_0x411de0[_0x0a0a('0x30')][_0x0a0a('0xf')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x411de0[_0x0a0a('0x1e')][_0x0a0a('0x2f')][_0x35676f]&&_0x411de0['body'][_0x0a0a('0x2f')][_0x35676f][_0x0a0a('0x32')]?{'$notIn':_0x411de0[_0x0a0a('0x1e')][_0x0a0a('0x2f')][_0x35676f]}:{'$ne':null}}})[_0x0a0a('0x7')](function(_0x1e396d){var _0x2030f5=moment()[_0x0a0a('0x33')](_0x0a0a('0x34'));for(var _0x308215=0x0,_0x33ef75=_0x1e396d['length'];_0x308215<_0x33ef75;_0x308215+=0x1){_0x1e396d[_0x308215]['updateAttributes']({'exitAt':_0x2030f5});}});for(var _0x395a2f=0x0;_0x395a2f<_0x411de0[_0x0a0a('0x1e')][_0x0a0a('0x2f')][_0x35676f][_0x0a0a('0x32')];_0x395a2f+=0x1){db[_0x0a0a('0x35')][_0x0a0a('0x36')]({'where':{'channel':_0x35676f,'membername':_0x411de0[_0x0a0a('0x30')]['name'],'type':'INTERACTION','uniqueid':_0x411de0[_0x0a0a('0x1e')][_0x0a0a('0x2f')][_0x35676f][_0x395a2f],'exitAt':null},'defaults':{'channel':_0x35676f,'membername':_0x411de0[_0x0a0a('0x30')]['name'],'interface':_[_0x0a0a('0x11')](_0x411de0[_0x0a0a('0x30')][_0x0a0a('0x37')])?util[_0x0a0a('0x33')](_0x0a0a('0x38'),_0x411de0[_0x0a0a('0x30')]['name']):_0x411de0[_0x0a0a('0x30')]['interface'],'type':_0x0a0a('0x39'),'enterAt':moment()['format'](_0x0a0a('0x34')),'role':_0x0a0a('0x3a'),'internal':_0x411de0[_0x0a0a('0x30')]['internal'],'uniqueid':_0x411de0['body']['interaction'][_0x35676f][_0x395a2f]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x411de0['params']['id'],'capacity':_0x411de0[_0x0a0a('0x1e')]['capacity']},routingClient)[_0x0a0a('0x7')](respondWithResult(_0x1c62cb,null))['catch'](handleError(_0x1c62cb,null));};exports[_0x0a0a('0x3b')]=function(_0x1857b8,_0x260387){return respondWithRpcPromise(_0x0a0a('0x3c'),_0x1857b8[_0x0a0a('0x17')])['then'](respondWithResult(_0x260387,null))[_0x0a0a('0xb')](handleError(_0x260387,null));};exports[_0x0a0a('0x3d')]=function(_0x42c7f7,_0x1f7ff2){return respondWithRpcPromise(_0x0a0a('0x3e'),_0x42c7f7[_0x0a0a('0x17')])[_0x0a0a('0x7')](respondWithResult(_0x1f7ff2,null))[_0x0a0a('0xb')](handleError(_0x1f7ff2,null));};exports[_0x0a0a('0x3f')]=function(_0x47a6f9,_0x4548b2){return respondWithRpcPromise('Campaigns',_0x47a6f9[_0x0a0a('0x17')])[_0x0a0a('0x7')](respondWithResult(_0x4548b2,null))[_0x0a0a('0xb')](handleError(_0x4548b2,null));};exports['chatQueues']=function(_0x1292f3,_0x31f26f){return respondWithRpcPromise('ChatQueues',_0x1292f3[_0x0a0a('0x17')],routingClient)[_0x0a0a('0x7')](respondWithResult(_0x31f26f,null))[_0x0a0a('0xb')](handleError(_0x31f26f,null));};exports['showChatQueues']=function(_0x7b02a4,_0x3d3724){return respondWithRpcPromise(_0x0a0a('0x40'),_0x7b02a4[_0x0a0a('0x17')],routingClient)['then'](findById(_0x7b02a4['params']['id']))['then'](respondWithResult(_0x3d3724,null))['catch'](handleError(_0x3d3724,null));};exports['mailQueues']=function(_0x1de340,_0x48d23e){return respondWithRpcPromise(_0x0a0a('0x41'),_0x1de340[_0x0a0a('0x17')],routingClient)['then'](respondWithResult(_0x48d23e,null))[_0x0a0a('0xb')](handleError(_0x48d23e,null));};exports[_0x0a0a('0x42')]=function(_0x1ec8a4,_0x85c6d7){return respondWithRpcPromise(_0x0a0a('0x41'),_0x1ec8a4[_0x0a0a('0x17')],routingClient)[_0x0a0a('0x7')](findById(_0x1ec8a4[_0x0a0a('0x1a')]['id']))[_0x0a0a('0x7')](respondWithResult(_0x85c6d7,null))[_0x0a0a('0xb')](handleError(_0x85c6d7,null));};exports['mailAccounts']=function(_0x4623ae,_0x5d8251){return respondWithRpcPromise('MailAccounts',_0x4623ae[_0x0a0a('0x17')],mailClient)['then'](respondWithResult(_0x5d8251,null))[_0x0a0a('0xb')](handleError(_0x5d8251,null));};exports['openchannelQueues']=function(_0x345830,_0x3e97fa){return respondWithRpcPromise(_0x0a0a('0x43'),_0x345830[_0x0a0a('0x17')],routingClient)[_0x0a0a('0x7')](respondWithResult(_0x3e97fa,null))[_0x0a0a('0xb')](handleError(_0x3e97fa,null));};exports[_0x0a0a('0x44')]=function(_0x4dc01e,_0x231ff9){return respondWithRpcPromise(_0x0a0a('0x43'),_0x4dc01e[_0x0a0a('0x17')],routingClient)['then'](findById(_0x4dc01e[_0x0a0a('0x1a')]['id']))[_0x0a0a('0x7')](respondWithResult(_0x231ff9,null))[_0x0a0a('0xb')](handleError(_0x231ff9,null));};exports[_0x0a0a('0x45')]=function(_0x3eb198,_0x451bed){return respondWithRpcPromise(_0x0a0a('0x46'),_0x3eb198[_0x0a0a('0x17')],routingClient)['then'](respondWithResult(_0x451bed,null))[_0x0a0a('0xb')](handleError(_0x451bed,null));};exports[_0x0a0a('0x47')]=function(_0x196037,_0xca658){return respondWithRpcPromise(_0x0a0a('0x46'),_0x196037[_0x0a0a('0x17')],routingClient)[_0x0a0a('0x7')](findById(_0x196037[_0x0a0a('0x1a')]['id']))[_0x0a0a('0x7')](respondWithResult(_0xca658,null))[_0x0a0a('0xb')](handleError(_0xca658,null));};exports[_0x0a0a('0x48')]=function(_0x5524d4,_0x3d4855){return respondWithRpcPromise('WhatsappQueues',_0x5524d4[_0x0a0a('0x17')],routingClient)['then'](respondWithResult(_0x3d4855,null))[_0x0a0a('0xb')](handleError(_0x3d4855,null));};exports['showWhatsappQueues']=function(_0x390954,_0x3bc1da){return respondWithRpcPromise(_0x0a0a('0x49'),_0x390954[_0x0a0a('0x17')],routingClient)[_0x0a0a('0x7')](findById(_0x390954[_0x0a0a('0x1a')]['id']))['then'](respondWithResult(_0x3bc1da,null))['catch'](handleError(_0x3bc1da,null));};exports[_0x0a0a('0x4a')]=function(_0xfc311c,_0x1b4807){return respondWithRpcPromise(_0x0a0a('0x4b'),_0xfc311c['query'],routingClient)[_0x0a0a('0x7')](respondWithResult(_0x1b4807,null))['catch'](handleError(_0x1b4807,null));};exports['showFaxQueues']=function(_0xb5eb13,_0x29ff65){return respondWithRpcPromise(_0x0a0a('0x4b'),_0xb5eb13['query'],routingClient)[_0x0a0a('0x7')](findById(_0xb5eb13['params']['id']))[_0x0a0a('0x7')](respondWithResult(_0x29ff65,null))[_0x0a0a('0xb')](handleError(_0x29ff65,null));};exports[_0x0a0a('0x4c')]=function(_0x90f634,_0x3a6dd8){return respondWithRpcPromise(_0x0a0a('0x4d'),_0x90f634['query'])[_0x0a0a('0x7')](respondWithResult(_0x3a6dd8,null))[_0x0a0a('0xb')](handleError(_0x3a6dd8,null));};exports[_0x0a0a('0x4e')]=function(_0xbb53dd,_0x1737dc){return respondWithRpcPromise(_0x0a0a('0x4f'),_0xbb53dd['query'],routingClient)[_0x0a0a('0x7')](respondWithResult(_0x1737dc,null))[_0x0a0a('0xb')](handleError(_0x1737dc,null));};exports[_0x0a0a('0x50')]=function(_0x2629ae,_0x972247){return respondWithRpcPromise(_0x0a0a('0x51'),_0x2629ae[_0x0a0a('0x17')],routingClient)[_0x0a0a('0x7')](respondWithResult(_0x972247,null))[_0x0a0a('0xb')](handleError(_0x972247,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x1fc93c,_0x17edc2){return respondWithRpcPromise(_0x0a0a('0x52'),_0x1fc93c[_0x0a0a('0x17')],routingClient)[_0x0a0a('0x7')](respondWithResult(_0x17edc2,null))[_0x0a0a('0xb')](handleError(_0x17edc2,null));};exports[_0x0a0a('0x53')]=function(_0x337d9f,_0x10b7ab){return respondWithRpcPromise(_0x0a0a('0x52'),_0x337d9f[_0x0a0a('0x17')],routingClient)[_0x0a0a('0x7')](function(_0x5907c0){if(_0x337d9f[_0x0a0a('0x17')]['type']!==undefined){var _0x10d040=_(_0x5907c0[_0x0a0a('0x54')])[_0x0a0a('0x55')]([_0x337d9f[_0x0a0a('0x17')][_0x0a0a('0x56')],_0x337d9f[_0x0a0a('0x1a')]['id']])['map'](_0x0a0a('0x57'))[_0x0a0a('0x58')]()[_0x0a0a('0x59')]();return _0x5907c0[_0x0a0a('0x54')]['filter'](function(_0x1ad02e){return _0x10d040[_0x0a0a('0x5a')](_0x1ad02e[_0x0a0a('0x57')])>-0x1;});}else{return _0x5907c0['rows'][_0x0a0a('0x55')](function(_0x38c01d){return _0x38c01d[_0x0a0a('0x57')]===parseInt(_0x337d9f[_0x0a0a('0x1a')]['id']);});}})[_0x0a0a('0x7')](respondWithResult(_0x10b7ab,null))[_0x0a0a('0xb')](handleError(_0x10b7ab,null));};exports[_0x0a0a('0x5b')]=function(_0x1ae9d3,_0xc46015){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x1ae9d3[_0x0a0a('0x17')],routingClient)['then'](respondWithResult(_0xc46015,null))[_0x0a0a('0xb')](handleError(_0xc46015,null));};exports[_0x0a0a('0x5c')]=function(_0x24b53b,_0x45351f){return respondWithRpcPromise(_0x0a0a('0x5d'),_0x24b53b[_0x0a0a('0x17')],routingClient)[_0x0a0a('0x7')](respondWithResult(_0x45351f,null))[_0x0a0a('0xb')](handleError(_0x45351f,null));};exports[_0x0a0a('0x5e')]=function(_0x19388b,_0x3fb433){return respondWithRpcPromise(_0x0a0a('0x5f'),_0x19388b[_0x0a0a('0x17')],routingClient)[_0x0a0a('0x7')](respondWithResult(_0x3fb433,null))[_0x0a0a('0xb')](handleError(_0x3fb433,null));};exports[_0x0a0a('0x60')]=function(_0x267803){return function(_0x1541af,_0x6f9a5f){var _0x5d7dd8,_0x57db2e;var _0x510912=_[_0x0a0a('0x61')](_0x267803);var _0x134d08=_0x267803===_0x0a0a('0x62')?_0x0a0a('0x63'):'Account';return db[_0x510912+_0x0a0a('0x64')]['findOne']({'raw':!![],'where':{'id':_0x1541af[_0x0a0a('0x1a')]['id']}})[_0x0a0a('0x7')](function(_0x476a6c){if(_[_0x0a0a('0x11')](_0x476a6c)){throw new Error(_0x510912+'\x20Queue\x20not\x20found');}_0x5d7dd8=_0x476a6c;return db[_0x510912+_0x0a0a('0x65')][_0x0a0a('0x66')]({'where':{'id':_0x1541af['body'][_0x0a0a('0x67')]},'include':[{'model':db[_0x510912+_0x0a0a('0x68')],'as':_0x0a0a('0x68')},{'model':db[_0x510912+_0x134d08],'as':_0x0a0a('0x69')}]});})[_0x0a0a('0x7')](function(_0x3b80a8){if(_[_0x0a0a('0x11')](_0x3b80a8)){throw new Error(_0x510912+'\x20Message\x20not\x20found');}_0x57db2e=_0x3b80a8;return _0x3b80a8['update']({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0xdfe462={'uniqueid':_0x267803+'.'+_0x57db2e['id']+'.'+_0x57db2e[_0x0a0a('0x68')]['id'],'FromUserId':_0x1541af[_0x0a0a('0x30')]['id'],'type':'queue'};_0xdfe462[_0x510912+_0x0a0a('0x6a')]=_0x57db2e['id'];_0xdfe462[_0x510912+_0x0a0a('0x6b')]=_0x57db2e[_0x0a0a('0x68')]['id'];_0xdfe462['From'+_0x510912+_0x134d08+'Id']=_0x57db2e[_0x0a0a('0x69')]['id'];_0xdfe462['To'+_0x510912+_0x0a0a('0x6c')]=_0x5d7dd8['id'];return db[_0x510912+_0x0a0a('0x6d')][_0x0a0a('0x6e')](_0xdfe462);})[_0x0a0a('0x7')](function(){return respondWithRpcPromise('Start',{'channel':_0x267803,'interaction':_0x57db2e[_0x0a0a('0x68')],'message':_0x57db2e,'account':_0x57db2e[_0x0a0a('0x69')],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x5d7dd8['name']+','+(_0x57db2e[_0x0a0a('0x69')][_0x0a0a('0x6f')]||0x12c),'interval':_0x0a0a('0x70')}]},routingClient);})[_0x0a0a('0x7')](respondWithResult(_0x6f9a5f,null))[_0x0a0a('0xb')](handleError(_0x6f9a5f,null));};};exports[_0x0a0a('0x71')]=function(_0x4fa980,_0x539a65){var _0x5645c8,_0xa23d65;if(_[_0x0a0a('0x11')](_0x4fa980[_0x0a0a('0x1e')][_0x0a0a('0x72')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x2b9459=_0x4fa980[_0x0a0a('0x1e')]['channel'];var _0xd80a2e=_[_0x0a0a('0x61')](_0x2b9459);var _0x10532b=_0x2b9459==='chat'?_0x0a0a('0x63'):_0x0a0a('0x69');return db[_0x0a0a('0x73')]['findOne']({'raw':!![],'where':{'id':_0x4fa980[_0x0a0a('0x1a')]['id'],'role':'agent'}})[_0x0a0a('0x7')](function(_0x13bc18){if(_[_0x0a0a('0x11')](_0x13bc18)){throw new Error(_0x0a0a('0x74'));}_0x5645c8=_0x13bc18;return db[_0xd80a2e+_0x0a0a('0x65')][_0x0a0a('0x66')]({'where':{'id':_0x4fa980[_0x0a0a('0x1e')][_0x0a0a('0x67')]},'include':[{'model':db[_0xd80a2e+'Interaction'],'as':_0x0a0a('0x68')},{'model':db[_0xd80a2e+_0x10532b],'as':_0x0a0a('0x69')}]});})['then'](function(_0xfb6499){if(_[_0x0a0a('0x11')](_0xfb6499)){throw new Error(_0xd80a2e+_0x0a0a('0x75'));}_0xa23d65=_0xfb6499;return _0xfb6499['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x0a0a('0x7')](function(){var _0x3b9a16={'uniqueid':_0x2b9459+'.'+_0xa23d65['id']+'.'+_0xa23d65[_0x0a0a('0x68')]['id'],'FromUserId':_0x4fa980[_0x0a0a('0x30')]['id'],'type':_0x0a0a('0x3a'),'ToUserId':_0x5645c8['id']};_0x3b9a16[_0xd80a2e+_0x0a0a('0x6a')]=_0xa23d65['id'];_0x3b9a16[_0xd80a2e+_0x0a0a('0x6b')]=_0xa23d65[_0x0a0a('0x68')]['id'];_0x3b9a16[_0x0a0a('0x76')+_0xd80a2e+_0x10532b+'Id']=_0xa23d65[_0x0a0a('0x69')]['id'];return db[_0xd80a2e+_0x0a0a('0x6d')]['create'](_0x3b9a16);})[_0x0a0a('0x7')](function(){return respondWithRpcPromise(_0x0a0a('0x77'),{'channel':_0x2b9459,'interaction':_0xa23d65[_0x0a0a('0x68')],'message':_0xa23d65,'account':_0xa23d65[_0x0a0a('0x69')],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x5645c8[_0x0a0a('0xf')]+','+(_0xa23d65['Account'][_0x0a0a('0x78')]||0x12c),'interval':_0x0a0a('0x70')}]},routingClient);})[_0x0a0a('0x7')](respondWithResult(_0x539a65,null))[_0x0a0a('0xb')](handleError(_0x539a65,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 4e7d1ce..ff7390e 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 _0x2c88=['destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get','isAuthenticated','index','/:id','show','/:id/run','run','post','create','update','delete'];(function(_0x282f61,_0x1f5874){var _0x532181=function(_0x5b3140){while(--_0x5b3140){_0x282f61['push'](_0x282f61['shift']());}};_0x532181(++_0x1f5874);}(_0x2c88,0x1ce));var _0x82c8=function(_0x3fe848,_0xde9c12){_0x3fe848=_0x3fe848-0x0;var _0x9242f0=_0x2c88[_0x3fe848];return _0x9242f0;};'use strict';var multer=require(_0x82c8('0x0'));var util=require(_0x82c8('0x1'));var path=require(_0x82c8('0x2'));var timeout=require(_0x82c8('0x3'));var express=require(_0x82c8('0x4'));var router=express['Router']();var fs_extra=require(_0x82c8('0x5'));var auth=require(_0x82c8('0x6'));var interaction=require(_0x82c8('0x7'));var config=require(_0x82c8('0x8'));var controller=require(_0x82c8('0x9'));router[_0x82c8('0xa')]('/',auth[_0x82c8('0xb')](),controller[_0x82c8('0xc')]);router['get'](_0x82c8('0xd'),auth['isAuthenticated'](),controller[_0x82c8('0xe')]);router['get'](_0x82c8('0xf'),auth[_0x82c8('0xb')](),controller[_0x82c8('0x10')]);router[_0x82c8('0x11')]('/',auth['isAuthenticated'](),controller[_0x82c8('0x12')]);router['put'](_0x82c8('0xd'),auth['isAuthenticated'](),controller[_0x82c8('0x13')]);router[_0x82c8('0x14')](_0x82c8('0xd'),auth['isAuthenticated'](),controller[_0x82c8('0x15')]);module[_0x82c8('0x16')]=router; \ No newline at end of file +var _0x06cc=['../../components/interaction/service','../../config/environment','./schedule.controller','isAuthenticated','index','get','/:id','/:id/run','create','delete','destroy','exports','util','connect-timeout','express','fs-extra'];(function(_0x341d81,_0x4bb49a){var _0x39a870=function(_0x388595){while(--_0x388595){_0x341d81['push'](_0x341d81['shift']());}};_0x39a870(++_0x4bb49a);}(_0x06cc,0xac));var _0xc06c=function(_0x8e9820,_0x26acb0){_0x8e9820=_0x8e9820-0x0;var _0x421604=_0x06cc[_0x8e9820];return _0x421604;};'use strict';var multer=require('multer');var util=require(_0xc06c('0x0'));var path=require('path');var timeout=require(_0xc06c('0x1'));var express=require(_0xc06c('0x2'));var router=express['Router']();var fs_extra=require(_0xc06c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xc06c('0x4'));var config=require(_0xc06c('0x5'));var controller=require(_0xc06c('0x6'));router['get']('/',auth[_0xc06c('0x7')](),controller[_0xc06c('0x8')]);router[_0xc06c('0x9')](_0xc06c('0xa'),auth[_0xc06c('0x7')](),controller['show']);router[_0xc06c('0x9')](_0xc06c('0xb'),auth[_0xc06c('0x7')](),controller['run']);router['post']('/',auth['isAuthenticated'](),controller[_0xc06c('0xc')]);router['put'](_0xc06c('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xc06c('0xd')]('/:id',auth[_0xc06c('0x7')](),controller[_0xc06c('0xe')]);module[_0xc06c('0xf')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 302029d..171cb4c 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 _0xb0c8=['months','weeks','days','hours','csv','xlsx','custom','default','BOOLEAN','TEXT','sequelize','exports','STRING','DATE','ENUM','years'];(function(_0x1a20ec,_0x27626c){var _0x3a2ec1=function(_0xb45d54){while(--_0xb45d54){_0x1a20ec['push'](_0x1a20ec['shift']());}};_0x3a2ec1(++_0x27626c);}(_0xb0c8,0x1ea));var _0x8b0c=function(_0x4bd788,_0x5b82d1){_0x4bd788=_0x4bd788-0x0;var _0x18e74f=_0xb0c8[_0x4bd788];return _0x18e74f;};'use strict';var Sequelize=require(_0x8b0c('0x0'));module[_0x8b0c('0x1')]={'name':{'type':Sequelize[_0x8b0c('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x8b0c('0x2')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0x8b0c('0x3')],'allowNull':![]},'endAt':{'type':Sequelize[_0x8b0c('0x3')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x8b0c('0x4')](_0x8b0c('0x5'),'quarters',_0x8b0c('0x6'),_0x8b0c('0x7'),_0x8b0c('0x8'),_0x8b0c('0x9'),'minutes'),'allowNull':![],'defaultValue':_0x8b0c('0x8')},'output':{'type':Sequelize[_0x8b0c('0x4')](_0x8b0c('0xa'),'pdf',_0x8b0c('0xb')),'allowNull':![],'defaultValue':_0x8b0c('0xa')},'type':{'type':Sequelize[_0x8b0c('0x4')](_0x8b0c('0xc'),_0x8b0c('0xd')),'allowNull':![],'defaultValue':_0x8b0c('0xc')},'sendMail':{'type':Sequelize[_0x8b0c('0xe')],'defaultValue':![]},'email':{'type':Sequelize[_0x8b0c('0x2')]},'cc':{'type':Sequelize[_0x8b0c('0xf')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x8a84=['STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','quarters','months','weeks','hours','minutes','days','csv','xlsx','custom','default','TEXT','sequelize'];(function(_0x24bf2a,_0x28bce8){var _0x1f140d=function(_0x2cff3e){while(--_0x2cff3e){_0x24bf2a['push'](_0x24bf2a['shift']());}};_0x1f140d(++_0x28bce8);}(_0x8a84,0xb3));var _0x48a8=function(_0x1cd674,_0x8d3638){_0x1cd674=_0x1cd674-0x0;var _0x27928f=_0x8a84[_0x1cd674];return _0x27928f;};'use strict';var Sequelize=require(_0x48a8('0x0'));module['exports']={'name':{'type':Sequelize[_0x48a8('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x48a8('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x48a8('0x1')],'allowNull':![],'defaultValue':_0x48a8('0x3')},'startAt':{'type':Sequelize[_0x48a8('0x4')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x48a8('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x48a8('0x6')]('years',_0x48a8('0x7'),_0x48a8('0x8'),_0x48a8('0x9'),'days',_0x48a8('0xa'),_0x48a8('0xb')),'allowNull':![],'defaultValue':_0x48a8('0xc')},'output':{'type':Sequelize[_0x48a8('0x6')](_0x48a8('0xd'),'pdf',_0x48a8('0xe')),'allowNull':![],'defaultValue':_0x48a8('0xd')},'type':{'type':Sequelize[_0x48a8('0x6')](_0x48a8('0xf'),_0x48a8('0x10')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0x48a8('0x2')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x48a8('0x11')]},'bcc':{'type':Sequelize[_0x48a8('0x11')]},'sendIfEmpty':{'type':Sequelize[_0x48a8('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index f56f52e..3055a01 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 _0xacde=['fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Scheduler','userProfileId','UserProfileResource','update','params','run','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','undefined','limit','count','offset','set','reject','save','then','get','destroy','status','error','stack','name','send','index','Schedule','rawAttributes','type','key','model','query','keys','filters','attributes','intersection'];(function(_0x296144,_0x26bbbf){var _0x5329b1=function(_0x5d321b){while(--_0x5d321b){_0x296144['push'](_0x296144['shift']());}};_0x5329b1(++_0x26bbbf);}(_0xacde,0x110));var _0xeacd=function(_0x2b63a0,_0x14fc48){_0x2b63a0=_0x2b63a0-0x0;var _0x4f0434=_0xacde[_0x2b63a0];return _0x4f0434;};'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(_0xeacd('0x0'));var moment=require(_0xeacd('0x1'));var BPromise=require(_0xeacd('0x2'));var Mustache=require(_0xeacd('0x3'));var util=require(_0xeacd('0x4'));var path=require(_0xeacd('0x5'));var sox=require(_0xeacd('0x6'));var csv=require(_0xeacd('0x7'));var ejs=require(_0xeacd('0x8'));var fs=require('fs');var fs_extra=require(_0xeacd('0x9'));var _=require(_0xeacd('0xa'));var squel=require(_0xeacd('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xeacd('0xc'));var toCsv=require(_0xeacd('0x7'));var querystring=require(_0xeacd('0xd'));var Papa=require(_0xeacd('0xe'));var Redis=require('ioredis');var authService=require(_0xeacd('0xf'));var qs=require(_0xeacd('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xeacd('0x11'));var logger=require(_0xeacd('0x12'))(_0xeacd('0x13'));var utils=require('../../config/utils');var config=require(_0xeacd('0x14'));var licenseUtil=require(_0xeacd('0x15'));var db=require(_0xeacd('0x16'))['db'];function respondWithStatusCode(_0x3de56d,_0x3f11c3){_0x3f11c3=_0x3f11c3||0xcc;return function(_0x116f73){if(_0x116f73){return _0x3de56d[_0xeacd('0x17')](_0x3f11c3);}return _0x3de56d['status'](_0x3f11c3)[_0xeacd('0x18')]();};}function respondWithResult(_0x1b67a6,_0x598256){_0x598256=_0x598256||0xc8;return function(_0x3101e2){if(_0x3101e2){return _0x1b67a6['status'](_0x598256)[_0xeacd('0x19')](_0x3101e2);}};}function respondWithFilteredResult(_0x51a5f6,_0x1f6554){return function(_0x1652a6){if(_0x1652a6){var _0x503802=typeof _0x1f6554['offset']===_0xeacd('0x1a')&&typeof _0x1f6554[_0xeacd('0x1b')]===_0xeacd('0x1a');var _0x5cfb31=_0x1652a6[_0xeacd('0x1c')];var _0x401147=_0x503802?0x0:_0x1f6554[_0xeacd('0x1d')];var _0x217ed7=_0x503802?_0x1652a6['count']:_0x1f6554[_0xeacd('0x1d')]+_0x1f6554[_0xeacd('0x1b')];var _0x25094e;if(_0x217ed7>=_0x5cfb31){_0x217ed7=_0x5cfb31;_0x25094e=0xc8;}else{_0x25094e=0xce;}_0x51a5f6['status'](_0x25094e);return _0x51a5f6[_0xeacd('0x1e')]('Content-Range',_0x401147+'-'+_0x217ed7+'/'+_0x5cfb31)[_0xeacd('0x19')](_0x1652a6);}return null;};}function patchUpdates(_0x9519a4){return function(_0xdf5d5a){try{jsonpatch['apply'](_0xdf5d5a,_0x9519a4,!![]);}catch(_0x3bd689){return BPromise[_0xeacd('0x1f')](_0x3bd689);}return _0xdf5d5a[_0xeacd('0x20')]();};}function saveUpdates(_0x3c9460,_0x25bd92){return function(_0x1ade83){if(_0x1ade83){return _0x1ade83['update'](_0x3c9460)[_0xeacd('0x21')](function(_0x51804b){return _0x51804b;});}return null;};}function removeEntity(_0x17adeb,_0x33f38f){return function(_0x127f9d){if(_0x127f9d){return _0x127f9d['destroy']()[_0xeacd('0x21')](function(){var _0x1e29bb=_0x127f9d[_0xeacd('0x22')]({'plain':!![]});var _0x174593='Scheduler';return db['UserProfileResource'][_0xeacd('0x23')]({'where':{'type':_0x174593,'resourceId':_0x1e29bb['id']}})[_0xeacd('0x21')](function(){return _0x127f9d;});})['then'](function(){_0x17adeb[_0xeacd('0x24')](0xcc)[_0xeacd('0x18')]();});}};}function handleEntityNotFound(_0x39d0c4,_0x29cccf){return function(_0x30e4ad){if(!_0x30e4ad){_0x39d0c4[_0xeacd('0x17')](0x194);}return _0x30e4ad;};}function handleError(_0x8b389d,_0x3147e7){_0x3147e7=_0x3147e7||0x1f4;return function(_0x28630c){logger[_0xeacd('0x25')](_0x28630c[_0xeacd('0x26')]);if(_0x28630c[_0xeacd('0x27')]){delete _0x28630c['name'];}_0x8b389d[_0xeacd('0x24')](_0x3147e7)[_0xeacd('0x28')](_0x28630c);};}exports[_0xeacd('0x29')]=function(_0x4eb7d1,_0x2707e5){var _0x12cd65={},_0xcad8d1={},_0x52e8a5={'count':0x0,'rows':[]};var _0x4b0061=_['map'](db[_0xeacd('0x2a')][_0xeacd('0x2b')],function(_0x39d9b2){return{'name':_0x39d9b2['fieldName'],'type':_0x39d9b2[_0xeacd('0x2c')][_0xeacd('0x2d')]};});_0xcad8d1[_0xeacd('0x2e')]=_['map'](_0x4b0061,'name');_0xcad8d1[_0xeacd('0x2f')]=_[_0xeacd('0x30')](_0x4eb7d1[_0xeacd('0x2f')]);_0xcad8d1[_0xeacd('0x31')]=_['intersection'](_0xcad8d1[_0xeacd('0x2e')],_0xcad8d1[_0xeacd('0x2f')]);_0x12cd65[_0xeacd('0x32')]=_[_0xeacd('0x33')](_0xcad8d1[_0xeacd('0x2e')],qs[_0xeacd('0x34')](_0x4eb7d1[_0xeacd('0x2f')][_0xeacd('0x34')]));_0x12cd65[_0xeacd('0x32')]=_0x12cd65[_0xeacd('0x32')][_0xeacd('0x35')]?_0x12cd65['attributes']:_0xcad8d1[_0xeacd('0x2e')];if(!_0x4eb7d1[_0xeacd('0x2f')][_0xeacd('0x36')](_0xeacd('0x37'))){_0x12cd65[_0xeacd('0x1b')]=qs['limit'](_0x4eb7d1[_0xeacd('0x2f')][_0xeacd('0x1b')]);_0x12cd65[_0xeacd('0x1d')]=qs[_0xeacd('0x1d')](_0x4eb7d1[_0xeacd('0x2f')][_0xeacd('0x1d')]);}_0x12cd65[_0xeacd('0x38')]=qs[_0xeacd('0x39')](_0x4eb7d1[_0xeacd('0x2f')][_0xeacd('0x39')]);_0x12cd65[_0xeacd('0x3a')]=qs[_0xeacd('0x31')](_[_0xeacd('0x3b')](_0x4eb7d1['query'],_0xcad8d1[_0xeacd('0x31')]),_0x4b0061);if(_0x4eb7d1[_0xeacd('0x2f')][_0xeacd('0x3c')]){_0x12cd65['where']=_[_0xeacd('0x3d')](_0x12cd65[_0xeacd('0x3a')],{'$or':_['map'](_0x4b0061,function(_0xb50e84){if(_0xb50e84[_0xeacd('0x2c')]!=='VIRTUAL'){var _0xd1b94d={};_0xd1b94d[_0xb50e84[_0xeacd('0x27')]]={'$like':'%'+_0x4eb7d1[_0xeacd('0x2f')]['filter']+'%'};return _0xd1b94d;}})});}_0x12cd65=_[_0xeacd('0x3d')]({},_0x12cd65,_0x4eb7d1[_0xeacd('0x3e')]);var _0x51a583={'where':_0x12cd65[_0xeacd('0x3a')]};return db[_0xeacd('0x2a')]['count'](_0x51a583)[_0xeacd('0x21')](function(_0x474223){_0x52e8a5[_0xeacd('0x1c')]=_0x474223;if(_0x4eb7d1[_0xeacd('0x2f')][_0xeacd('0x3f')]){_0x12cd65['include']=[{'all':!![]}];}return db[_0xeacd('0x2a')][_0xeacd('0x40')](_0x12cd65);})[_0xeacd('0x21')](function(_0x353af6){_0x52e8a5[_0xeacd('0x41')]=_0x353af6;return _0x52e8a5;})[_0xeacd('0x21')](respondWithFilteredResult(_0x2707e5,_0x12cd65))[_0xeacd('0x42')](handleError(_0x2707e5,null));};exports[_0xeacd('0x43')]=function(_0x458853,_0x92321d){var _0x1c1f99={'raw':![],'where':{'id':_0x458853['params']['id']}},_0x36c146={};_0x36c146[_0xeacd('0x2e')]=_['keys'](db['Schedule'][_0xeacd('0x2b')]);_0x36c146[_0xeacd('0x2f')]=_[_0xeacd('0x30')](_0x458853[_0xeacd('0x2f')]);_0x36c146[_0xeacd('0x31')]=_[_0xeacd('0x33')](_0x36c146[_0xeacd('0x2e')],_0x36c146['query']);_0x1c1f99[_0xeacd('0x32')]=_[_0xeacd('0x33')](_0x36c146[_0xeacd('0x2e')],qs[_0xeacd('0x34')](_0x458853[_0xeacd('0x2f')][_0xeacd('0x34')]));_0x1c1f99[_0xeacd('0x32')]=_0x1c1f99[_0xeacd('0x32')][_0xeacd('0x35')]?_0x1c1f99[_0xeacd('0x32')]:_0x36c146[_0xeacd('0x2e')];if(_0x458853[_0xeacd('0x2f')]['includeAll']){_0x1c1f99[_0xeacd('0x44')]=[{'all':!![]}];}_0x1c1f99=_[_0xeacd('0x3d')]({},_0x1c1f99,_0x458853[_0xeacd('0x3e')]);return db[_0xeacd('0x2a')][_0xeacd('0x45')](_0x1c1f99)['then'](handleEntityNotFound(_0x92321d,null))[_0xeacd('0x21')](respondWithResult(_0x92321d,null))[_0xeacd('0x42')](handleError(_0x92321d,null));};exports['create']=function(_0x32a64e,_0x475dc5){return db[_0xeacd('0x2a')][_0xeacd('0x46')](_0x32a64e[_0xeacd('0x47')],{})[_0xeacd('0x21')](function(_0x5daabb){var _0x239a5f=_0x32a64e[_0xeacd('0x48')][_0xeacd('0x22')]({'plain':!![]});if(!_0x239a5f)throw new Error(_0xeacd('0x49'));if(_0x239a5f[_0xeacd('0x4a')]==='user'){var _0x1a1def=_0x5daabb[_0xeacd('0x22')]({'plain':!![]});var _0x25ba35=_0xeacd('0x4b');return db['UserProfileSection']['find']({'where':{'name':_0x25ba35,'userProfileId':_0x239a5f[_0xeacd('0x4c')]},'raw':!![]})[_0xeacd('0x21')](function(_0x3aee5b){if(_0x3aee5b&&_0x3aee5b['autoAssociation']===0x0){return db[_0xeacd('0x4d')][_0xeacd('0x46')]({'name':_0x1a1def[_0xeacd('0x27')],'resourceId':_0x1a1def['id'],'type':_0x3aee5b[_0xeacd('0x27')],'sectionId':_0x3aee5b['id']},{})[_0xeacd('0x21')](function(){return _0x5daabb;});}else{return _0x5daabb;}})[_0xeacd('0x42')](function(_0x134098){logger[_0xeacd('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x134098);throw _0x134098;});}return _0x5daabb;})[_0xeacd('0x21')](respondWithResult(_0x475dc5,0xc9))[_0xeacd('0x42')](handleError(_0x475dc5,null));};exports[_0xeacd('0x4e')]=function(_0x41786f,_0x5cb3fd){if(_0x41786f[_0xeacd('0x47')]['id']){delete _0x41786f[_0xeacd('0x47')]['id'];}return db['Schedule'][_0xeacd('0x45')]({'where':{'id':_0x41786f[_0xeacd('0x4f')]['id']}})[_0xeacd('0x21')](handleEntityNotFound(_0x5cb3fd,null))[_0xeacd('0x21')](saveUpdates(_0x41786f[_0xeacd('0x47')],null))[_0xeacd('0x21')](respondWithResult(_0x5cb3fd,null))[_0xeacd('0x42')](handleError(_0x5cb3fd,null));};exports[_0xeacd('0x23')]=function(_0x4eb693,_0x1fc35a){return db['Schedule'][_0xeacd('0x45')]({'where':{'id':_0x4eb693[_0xeacd('0x4f')]['id']}})['then'](handleEntityNotFound(_0x1fc35a,null))[_0xeacd('0x21')](removeEntity(_0x1fc35a,null))[_0xeacd('0x42')](handleError(_0x1fc35a,null));};exports['run']=function(_0x35bdd3,_0xfec734,_0x5c81bb){var _0x2ea81d=require('../../config/schedule');return db[_0xeacd('0x2a')][_0xeacd('0x45')]({'where':{'id':_0x35bdd3[_0xeacd('0x4f')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0xfec734,null))[_0xeacd('0x21')](function(){_0x2ea81d[_0xeacd('0x50')](_0x35bdd3[_0xeacd('0x4f')]['id']);})[_0xeacd('0x21')](respondWithStatusCode(_0xfec734,null))[_0xeacd('0x42')](handleError(_0xfec734,null));}; \ No newline at end of file +var _0xfccc=['count','limit','set','Content-Range','apply','reject','save','update','Scheduler','UserProfileResource','destroy','then','stack','name','send','index','map','Schedule','rawAttributes','type','key','query','filters','model','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','run','../../config/schedule','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0x457681,_0x391b2c){var _0x322437=function(_0x2a0a95){while(--_0x2a0a95){_0x457681['push'](_0x457681['shift']());}};_0x322437(++_0x391b2c);}(_0xfccc,0xe6));var _0xcfcc=function(_0x3f25db,_0x1d3686){_0x3f25db=_0x3f25db-0x0;var _0x54f29d=_0xfccc[_0x3f25db];return _0x54f29d;};'use strict';var emlformat=require(_0xcfcc('0x0'));var rimraf=require(_0xcfcc('0x1'));var zipdir=require(_0xcfcc('0x2'));var jsonpatch=require(_0xcfcc('0x3'));var rp=require(_0xcfcc('0x4'));var moment=require('moment');var BPromise=require(_0xcfcc('0x5'));var Mustache=require(_0xcfcc('0x6'));var util=require(_0xcfcc('0x7'));var path=require('path');var sox=require(_0xcfcc('0x8'));var csv=require(_0xcfcc('0x9'));var ejs=require(_0xcfcc('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xcfcc('0xb'));var crypto=require(_0xcfcc('0xc'));var jsforce=require(_0xcfcc('0xd'));var deskjs=require(_0xcfcc('0xe'));var toCsv=require(_0xcfcc('0x9'));var querystring=require(_0xcfcc('0xf'));var Papa=require(_0xcfcc('0x10'));var Redis=require('ioredis');var authService=require(_0xcfcc('0x11'));var qs=require(_0xcfcc('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcfcc('0x13'));var logger=require(_0xcfcc('0x14'))('api');var utils=require(_0xcfcc('0x15'));var config=require(_0xcfcc('0x16'));var licenseUtil=require(_0xcfcc('0x17'));var db=require(_0xcfcc('0x18'))['db'];function respondWithStatusCode(_0x2780fd,_0xacc838){_0xacc838=_0xacc838||0xcc;return function(_0x12599c){if(_0x12599c){return _0x2780fd[_0xcfcc('0x19')](_0xacc838);}return _0x2780fd[_0xcfcc('0x1a')](_0xacc838)[_0xcfcc('0x1b')]();};}function respondWithResult(_0x5a50d7,_0x54fa64){_0x54fa64=_0x54fa64||0xc8;return function(_0x1e2ce0){if(_0x1e2ce0){return _0x5a50d7['status'](_0x54fa64)[_0xcfcc('0x1c')](_0x1e2ce0);}};}function respondWithFilteredResult(_0x14f2c0,_0x34e3d9){return function(_0x36923b){if(_0x36923b){var _0x26dcf3=typeof _0x34e3d9[_0xcfcc('0x1d')]===_0xcfcc('0x1e')&&typeof _0x34e3d9['limit']===_0xcfcc('0x1e');var _0x45daca=_0x36923b[_0xcfcc('0x1f')];var _0x514a03=_0x26dcf3?0x0:_0x34e3d9[_0xcfcc('0x1d')];var _0x463ff1=_0x26dcf3?_0x36923b['count']:_0x34e3d9[_0xcfcc('0x1d')]+_0x34e3d9[_0xcfcc('0x20')];var _0x4cbd34;if(_0x463ff1>=_0x45daca){_0x463ff1=_0x45daca;_0x4cbd34=0xc8;}else{_0x4cbd34=0xce;}_0x14f2c0[_0xcfcc('0x1a')](_0x4cbd34);return _0x14f2c0[_0xcfcc('0x21')](_0xcfcc('0x22'),_0x514a03+'-'+_0x463ff1+'/'+_0x45daca)['json'](_0x36923b);}return null;};}function patchUpdates(_0x2bec1c){return function(_0xb05c5f){try{jsonpatch[_0xcfcc('0x23')](_0xb05c5f,_0x2bec1c,!![]);}catch(_0x267bba){return BPromise[_0xcfcc('0x24')](_0x267bba);}return _0xb05c5f[_0xcfcc('0x25')]();};}function saveUpdates(_0x55f6ff,_0x51fc28){return function(_0x7bef52){if(_0x7bef52){return _0x7bef52[_0xcfcc('0x26')](_0x55f6ff)['then'](function(_0x542a7e){return _0x542a7e;});}return null;};}function removeEntity(_0x474e09,_0xd078d6){return function(_0x160a53){if(_0x160a53){return _0x160a53['destroy']()['then'](function(){var _0x1b9405=_0x160a53['get']({'plain':!![]});var _0x5a4374=_0xcfcc('0x27');return db[_0xcfcc('0x28')][_0xcfcc('0x29')]({'where':{'type':_0x5a4374,'resourceId':_0x1b9405['id']}})[_0xcfcc('0x2a')](function(){return _0x160a53;});})[_0xcfcc('0x2a')](function(){_0x474e09[_0xcfcc('0x1a')](0xcc)[_0xcfcc('0x1b')]();});}};}function handleEntityNotFound(_0x48b2a3,_0x2f6110){return function(_0x1f94bc){if(!_0x1f94bc){_0x48b2a3['sendStatus'](0x194);}return _0x1f94bc;};}function handleError(_0x1b27ea,_0x3fcc59){_0x3fcc59=_0x3fcc59||0x1f4;return function(_0x46ef33){logger['error'](_0x46ef33[_0xcfcc('0x2b')]);if(_0x46ef33[_0xcfcc('0x2c')]){delete _0x46ef33[_0xcfcc('0x2c')];}_0x1b27ea[_0xcfcc('0x1a')](_0x3fcc59)[_0xcfcc('0x2d')](_0x46ef33);};}exports[_0xcfcc('0x2e')]=function(_0x22b1a2,_0x561a13){var _0x4adb8d={},_0x1d0b40={},_0x2327bd={'count':0x0,'rows':[]};var _0x173976=_[_0xcfcc('0x2f')](db[_0xcfcc('0x30')][_0xcfcc('0x31')],function(_0x50f456){return{'name':_0x50f456['fieldName'],'type':_0x50f456[_0xcfcc('0x32')][_0xcfcc('0x33')]};});_0x1d0b40['model']=_['map'](_0x173976,_0xcfcc('0x2c'));_0x1d0b40['query']=_['keys'](_0x22b1a2[_0xcfcc('0x34')]);_0x1d0b40[_0xcfcc('0x35')]=_['intersection'](_0x1d0b40[_0xcfcc('0x36')],_0x1d0b40['query']);_0x4adb8d['attributes']=_[_0xcfcc('0x37')](_0x1d0b40[_0xcfcc('0x36')],qs[_0xcfcc('0x38')](_0x22b1a2[_0xcfcc('0x34')][_0xcfcc('0x38')]));_0x4adb8d[_0xcfcc('0x39')]=_0x4adb8d['attributes'][_0xcfcc('0x3a')]?_0x4adb8d['attributes']:_0x1d0b40[_0xcfcc('0x36')];if(!_0x22b1a2['query']['hasOwnProperty'](_0xcfcc('0x3b'))){_0x4adb8d[_0xcfcc('0x20')]=qs['limit'](_0x22b1a2[_0xcfcc('0x34')]['limit']);_0x4adb8d[_0xcfcc('0x1d')]=qs['offset'](_0x22b1a2[_0xcfcc('0x34')][_0xcfcc('0x1d')]);}_0x4adb8d[_0xcfcc('0x3c')]=qs[_0xcfcc('0x3d')](_0x22b1a2[_0xcfcc('0x34')][_0xcfcc('0x3d')]);_0x4adb8d[_0xcfcc('0x3e')]=qs[_0xcfcc('0x35')](_[_0xcfcc('0x3f')](_0x22b1a2[_0xcfcc('0x34')],_0x1d0b40[_0xcfcc('0x35')]),_0x173976);if(_0x22b1a2[_0xcfcc('0x34')][_0xcfcc('0x40')]){_0x4adb8d[_0xcfcc('0x3e')]=_[_0xcfcc('0x41')](_0x4adb8d[_0xcfcc('0x3e')],{'$or':_[_0xcfcc('0x2f')](_0x173976,function(_0x5303b1){if(_0x5303b1[_0xcfcc('0x32')]!==_0xcfcc('0x42')){var _0x59bbe4={};_0x59bbe4[_0x5303b1[_0xcfcc('0x2c')]]={'$like':'%'+_0x22b1a2['query']['filter']+'%'};return _0x59bbe4;}})});}_0x4adb8d=_['merge']({},_0x4adb8d,_0x22b1a2['options']);var _0x2d8fca={'where':_0x4adb8d['where']};return db[_0xcfcc('0x30')]['count'](_0x2d8fca)[_0xcfcc('0x2a')](function(_0x50b0db){_0x2327bd[_0xcfcc('0x1f')]=_0x50b0db;if(_0x22b1a2['query'][_0xcfcc('0x43')]){_0x4adb8d[_0xcfcc('0x44')]=[{'all':!![]}];}return db[_0xcfcc('0x30')][_0xcfcc('0x45')](_0x4adb8d);})[_0xcfcc('0x2a')](function(_0xfd00fb){_0x2327bd['rows']=_0xfd00fb;return _0x2327bd;})['then'](respondWithFilteredResult(_0x561a13,_0x4adb8d))[_0xcfcc('0x46')](handleError(_0x561a13,null));};exports[_0xcfcc('0x47')]=function(_0x2344b1,_0x52f565){var _0x52907b={'raw':![],'where':{'id':_0x2344b1['params']['id']}},_0x182c4b={};_0x182c4b[_0xcfcc('0x36')]=_['keys'](db[_0xcfcc('0x30')][_0xcfcc('0x31')]);_0x182c4b['query']=_['keys'](_0x2344b1[_0xcfcc('0x34')]);_0x182c4b['filters']=_[_0xcfcc('0x37')](_0x182c4b[_0xcfcc('0x36')],_0x182c4b[_0xcfcc('0x34')]);_0x52907b[_0xcfcc('0x39')]=_[_0xcfcc('0x37')](_0x182c4b['model'],qs[_0xcfcc('0x38')](_0x2344b1['query'][_0xcfcc('0x38')]));_0x52907b['attributes']=_0x52907b[_0xcfcc('0x39')][_0xcfcc('0x3a')]?_0x52907b[_0xcfcc('0x39')]:_0x182c4b[_0xcfcc('0x36')];if(_0x2344b1[_0xcfcc('0x34')]['includeAll']){_0x52907b[_0xcfcc('0x44')]=[{'all':!![]}];}_0x52907b=_[_0xcfcc('0x41')]({},_0x52907b,_0x2344b1[_0xcfcc('0x48')]);return db[_0xcfcc('0x30')][_0xcfcc('0x49')](_0x52907b)[_0xcfcc('0x2a')](handleEntityNotFound(_0x52f565,null))[_0xcfcc('0x2a')](respondWithResult(_0x52f565,null))['catch'](handleError(_0x52f565,null));};exports[_0xcfcc('0x4a')]=function(_0x450151,_0x5cda40){return db[_0xcfcc('0x30')][_0xcfcc('0x4a')](_0x450151[_0xcfcc('0x4b')],{})[_0xcfcc('0x2a')](function(_0x3419f5){var _0x11087a=_0x450151[_0xcfcc('0x4c')][_0xcfcc('0x4d')]({'plain':!![]});if(!_0x11087a)throw new Error(_0xcfcc('0x4e'));if(_0x11087a['role']===_0xcfcc('0x4c')){var _0x18a132=_0x3419f5[_0xcfcc('0x4d')]({'plain':!![]});var _0x23fe97=_0xcfcc('0x27');return db[_0xcfcc('0x4f')][_0xcfcc('0x49')]({'where':{'name':_0x23fe97,'userProfileId':_0x11087a[_0xcfcc('0x50')]},'raw':!![]})[_0xcfcc('0x2a')](function(_0xc3efc1){if(_0xc3efc1&&_0xc3efc1[_0xcfcc('0x51')]===0x0){return db[_0xcfcc('0x28')][_0xcfcc('0x4a')]({'name':_0x18a132[_0xcfcc('0x2c')],'resourceId':_0x18a132['id'],'type':_0xc3efc1[_0xcfcc('0x2c')],'sectionId':_0xc3efc1['id']},{})[_0xcfcc('0x2a')](function(){return _0x3419f5;});}else{return _0x3419f5;}})[_0xcfcc('0x46')](function(_0x3954d7){logger[_0xcfcc('0x52')](_0xcfcc('0x53'),_0x3954d7);throw _0x3954d7;});}return _0x3419f5;})['then'](respondWithResult(_0x5cda40,0xc9))[_0xcfcc('0x46')](handleError(_0x5cda40,null));};exports['update']=function(_0x3ff41b,_0x24684d){if(_0x3ff41b['body']['id']){delete _0x3ff41b['body']['id'];}return db[_0xcfcc('0x30')][_0xcfcc('0x49')]({'where':{'id':_0x3ff41b['params']['id']}})[_0xcfcc('0x2a')](handleEntityNotFound(_0x24684d,null))['then'](saveUpdates(_0x3ff41b['body'],null))[_0xcfcc('0x2a')](respondWithResult(_0x24684d,null))['catch'](handleError(_0x24684d,null));};exports[_0xcfcc('0x29')]=function(_0x15159e,_0x559a09){return db[_0xcfcc('0x30')][_0xcfcc('0x49')]({'where':{'id':_0x15159e[_0xcfcc('0x54')]['id']}})[_0xcfcc('0x2a')](handleEntityNotFound(_0x559a09,null))['then'](removeEntity(_0x559a09,null))['catch'](handleError(_0x559a09,null));};exports[_0xcfcc('0x55')]=function(_0x5dc813,_0x3580cb,_0x137b74){var _0x363ffd=require(_0xcfcc('0x56'));return db[_0xcfcc('0x30')][_0xcfcc('0x49')]({'where':{'id':_0x5dc813[_0xcfcc('0x54')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x3580cb,null))[_0xcfcc('0x2a')](function(){_0x363ffd[_0xcfcc('0x55')](_0x5dc813[_0xcfcc('0x54')]['id']);})['then'](respondWithStatusCode(_0x3580cb,null))['catch'](handleError(_0x3580cb,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 5dd3522..8df900c 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 _0x5af8=['path','rimraf','../../config/environment','exports','define','Schedule','tools_schedules','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x1f7001,_0x166eed){var _0x4a3d1d=function(_0x44635b){while(--_0x44635b){_0x1f7001['push'](_0x1f7001['shift']());}};_0x4a3d1d(++_0x166eed);}(_0x5af8,0xf1));var _0x85af=function(_0x47014e,_0x7decfc){_0x47014e=_0x47014e-0x0;var _0x16fae8=_0x5af8[_0x47014e];return _0x16fae8;};'use strict';var _=require(_0x85af('0x0'));var util=require(_0x85af('0x1'));var logger=require(_0x85af('0x2'))(_0x85af('0x3'));var moment=require('moment');var BPromise=require(_0x85af('0x4'));var rp=require(_0x85af('0x5'));var fs=require('fs');var path=require(_0x85af('0x6'));var rimraf=require(_0x85af('0x7'));var config=require(_0x85af('0x8'));var attributes=require('./schedule.attributes');module[_0x85af('0x9')]=function(_0x535186,_0x432a58){return _0x535186[_0x85af('0xa')](_0x85af('0xb'),attributes,{'tableName':_0x85af('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a66=['rimraf','../../config/environment','./schedule.attributes','exports','define','Schedule','tools_schedules','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x165a3b,_0x145957){var _0x5a78e4=function(_0x1a05de){while(--_0x1a05de){_0x165a3b['push'](_0x165a3b['shift']());}};_0x5a78e4(++_0x145957);}(_0x7a66,0xbd));var _0x67a6=function(_0x4a8ae1,_0x2121f4){_0x4a8ae1=_0x4a8ae1-0x0;var _0xa3331a=_0x7a66[_0x4a8ae1];return _0xa3331a;};'use strict';var _=require(_0x67a6('0x0'));var util=require(_0x67a6('0x1'));var logger=require(_0x67a6('0x2'))(_0x67a6('0x3'));var moment=require(_0x67a6('0x4'));var BPromise=require('bluebird');var rp=require(_0x67a6('0x5'));var fs=require('fs');var path=require(_0x67a6('0x6'));var rimraf=require(_0x67a6('0x7'));var config=require(_0x67a6('0x8'));var attributes=require(_0x67a6('0x9'));module[_0x67a6('0xa')]=function(_0x4f79b7,_0x7fd5e8){return _0x4f79b7[_0x67a6('0xb')](_0x67a6('0xc'),attributes,{'tableName':_0x67a6('0xd'),'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 12cfd6b..eff0402 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 _0x5f72=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','then','Schedule,\x20%s,\x20%s','request\x20sent','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','lodash','util','moment'];(function(_0x28a16f,_0x4ec9f8){var _0x12187e=function(_0x4515bd){while(--_0x4515bd){_0x28a16f['push'](_0x28a16f['shift']());}};_0x12187e(++_0x4ec9f8);}(_0x5f72,0x101));var _0x25f7=function(_0x5317b5,_0x4dfd6e){_0x5317b5=_0x5317b5-0x0;var _0x3b7ce2=_0x5f72[_0x5317b5];return _0x3b7ce2;};'use strict';var _=require(_0x25f7('0x0'));var util=require(_0x25f7('0x1'));var moment=require(_0x25f7('0x2'));var BPromise=require(_0x25f7('0x3'));var rs=require(_0x25f7('0x4'));var fs=require('fs');var Redis=require(_0x25f7('0x5'));var db=require(_0x25f7('0x6'))['db'];var utils=require(_0x25f7('0x7'));var logger=require(_0x25f7('0x8'))(_0x25f7('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x25f7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x291065,_0x2e2a35,_0x425a5f){return new BPromise(function(_0x33c182,_0x4be85d){return client['request'](_0x291065,_0x425a5f)[_0x25f7('0xb')](function(_0x101b53){logger['info'](_0x25f7('0xc'),_0x2e2a35,_0x25f7('0xd'));logger['debug'](_0x25f7('0xe'),_0x2e2a35,_0x25f7('0xd'),JSON[_0x25f7('0xf')](_0x101b53));if(_0x101b53[_0x25f7('0x10')]){if(_0x101b53[_0x25f7('0x10')]['code']===0x1f4){logger[_0x25f7('0x10')]('Schedule,\x20%s,\x20%s',_0x2e2a35,_0x101b53[_0x25f7('0x10')]['message']);return _0x4be85d(_0x101b53[_0x25f7('0x10')]['message']);}logger[_0x25f7('0x10')](_0x25f7('0xc'),_0x2e2a35,_0x101b53[_0x25f7('0x10')][_0x25f7('0x11')]);return _0x33c182(_0x101b53['error'][_0x25f7('0x11')]);}else{logger[_0x25f7('0x12')](_0x25f7('0xc'),_0x2e2a35,_0x25f7('0xd'));_0x33c182(_0x101b53['result'][_0x25f7('0x11')]);}})[_0x25f7('0x13')](function(_0x3a2880){logger[_0x25f7('0x10')](_0x25f7('0xc'),_0x2e2a35,_0x3a2880);_0x4be85d(_0x3a2880);});});} \ No newline at end of file +var _0x42b9=['request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','rpc','jayson/promise','client','http'];(function(_0x5751e6,_0x125e5e){var _0x4199e4=function(_0x559843){while(--_0x559843){_0x5751e6['push'](_0x5751e6['shift']());}};_0x4199e4(++_0x125e5e);}(_0x42b9,0x132));var _0x942b=function(_0x136628,_0xdd3206){_0x136628=_0x136628-0x0;var _0x35aad7=_0x42b9[_0x136628];return _0x35aad7;};'use strict';var _=require(_0x942b('0x0'));var util=require(_0x942b('0x1'));var moment=require(_0x942b('0x2'));var BPromise=require('bluebird');var rs=require(_0x942b('0x3'));var fs=require('fs');var Redis=require(_0x942b('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x942b('0x5'));var config=require('../../config/environment');var jayson=require(_0x942b('0x6'));var client=jayson[_0x942b('0x7')][_0x942b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x53c255,_0x2a28bb,_0x366fb5){return new BPromise(function(_0x463101,_0x19d1bf){return client[_0x942b('0x9')](_0x53c255,_0x366fb5)[_0x942b('0xa')](function(_0xa88cc4){logger[_0x942b('0xb')](_0x942b('0xc'),_0x2a28bb,_0x942b('0xd'));logger[_0x942b('0xe')](_0x942b('0xf'),_0x2a28bb,'request\x20sent',JSON['stringify'](_0xa88cc4));if(_0xa88cc4[_0x942b('0x10')]){if(_0xa88cc4[_0x942b('0x10')][_0x942b('0x11')]===0x1f4){logger[_0x942b('0x10')]('Schedule,\x20%s,\x20%s',_0x2a28bb,_0xa88cc4[_0x942b('0x10')][_0x942b('0x12')]);return _0x19d1bf(_0xa88cc4['error'][_0x942b('0x12')]);}logger[_0x942b('0x10')]('Schedule,\x20%s,\x20%s',_0x2a28bb,_0xa88cc4[_0x942b('0x10')][_0x942b('0x12')]);return _0x463101(_0xa88cc4['error'][_0x942b('0x12')]);}else{logger['info']('Schedule,\x20%s,\x20%s',_0x2a28bb,_0x942b('0xd'));_0x463101(_0xa88cc4[_0x942b('0x13')][_0x942b('0x12')]);}})[_0x942b('0x14')](function(_0xeab74d){logger['error'](_0x942b('0xc'),_0x2a28bb,_0xeab74d);_0x19d1bf(_0xeab74d);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index bcb46ed..7747f89 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 _0x4e27=['create','put','update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./screenRecording.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/download','download','post'];(function(_0x5ad021,_0x40a38c){var _0x2074d2=function(_0xa7b79){while(--_0xa7b79){_0x5ad021['push'](_0x5ad021['shift']());}};_0x2074d2(++_0x40a38c);}(_0x4e27,0x125));var _0x74e2=function(_0x1568e5,_0x5c8fb6){_0x1568e5=_0x1568e5-0x0;var _0x270c89=_0x4e27[_0x1568e5];return _0x270c89;};'use strict';var multer=require(_0x74e2('0x0'));var util=require(_0x74e2('0x1'));var path=require(_0x74e2('0x2'));var timeout=require(_0x74e2('0x3'));var express=require('express');var router=express[_0x74e2('0x4')]();var fs_extra=require(_0x74e2('0x5'));var auth=require(_0x74e2('0x6'));var interaction=require(_0x74e2('0x7'));var config=require('../../config/environment');var controller=require(_0x74e2('0x8'));router['get']('/',auth[_0x74e2('0x9')](),controller[_0x74e2('0xa')]);router[_0x74e2('0xb')](_0x74e2('0xc'),auth['isAuthenticated'](),controller[_0x74e2('0xd')]);router['get'](_0x74e2('0xe'),auth[_0x74e2('0x9')](),controller[_0x74e2('0xf')]);router[_0x74e2('0xb')](_0x74e2('0x10'),auth['isAuthenticated'](),controller[_0x74e2('0x11')]);router[_0x74e2('0x12')]('/',auth[_0x74e2('0x9')](),controller[_0x74e2('0x13')]);router[_0x74e2('0x14')]('/:id',auth[_0x74e2('0x9')](),controller[_0x74e2('0x15')]);router[_0x74e2('0x16')](_0x74e2('0xe'),auth[_0x74e2('0x9')](),controller[_0x74e2('0x17')]);module['exports']=router; \ No newline at end of file +var _0x6f0f=['show','download','post','create','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe'];(function(_0x25701b,_0x2a6976){var _0x3a8a2c=function(_0x1a5e78){while(--_0x1a5e78){_0x25701b['push'](_0x25701b['shift']());}};_0x3a8a2c(++_0x2a6976);}(_0x6f0f,0x65));var _0xf6f0=function(_0x221b8c,_0x2c7afc){_0x221b8c=_0x221b8c-0x0;var _0x3fab9f=_0x6f0f[_0x221b8c];return _0x3fab9f;};'use strict';var multer=require(_0xf6f0('0x0'));var util=require(_0xf6f0('0x1'));var path=require(_0xf6f0('0x2'));var timeout=require(_0xf6f0('0x3'));var express=require(_0xf6f0('0x4'));var router=express[_0xf6f0('0x5')]();var fs_extra=require(_0xf6f0('0x6'));var auth=require(_0xf6f0('0x7'));var interaction=require(_0xf6f0('0x8'));var config=require('../../config/environment');var controller=require('./screenRecording.controller');router[_0xf6f0('0x9')]('/',auth[_0xf6f0('0xa')](),controller[_0xf6f0('0xb')]);router['get'](_0xf6f0('0xc'),auth[_0xf6f0('0xa')](),controller[_0xf6f0('0xd')]);router[_0xf6f0('0x9')]('/:id',auth[_0xf6f0('0xa')](),controller[_0xf6f0('0xe')]);router['get']('/:id/download',auth[_0xf6f0('0xa')](),controller[_0xf6f0('0xf')]);router[_0xf6f0('0x10')]('/',auth[_0xf6f0('0xa')](),controller[_0xf6f0('0x11')]);router['put'](_0xf6f0('0x12'),auth[_0xf6f0('0xa')](),controller[_0xf6f0('0x13')]);router[_0xf6f0('0x14')]('/:id',auth[_0xf6f0('0xa')](),controller[_0xf6f0('0x15')]);module[_0xf6f0('0x16')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 328c1a7..229f296 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 _0xf4c9=['DATE','toString','createdAt','MM-DD-YYYY\x20HH:mm','updatedAt','format','sequelize','moment','path','exports','getDataValue','value','extname','STRING','replace','setDataValue','INTEGER','startedAt','subtract','closedAt','duration'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0xf4c9,0x1aa));var _0x9f4c=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0xf4c9[_0x525c7b];return _0x27b33e;};'use strict';var Sequelize=require(_0x9f4c('0x0'));var moment=require(_0x9f4c('0x1'));var path=require(_0x9f4c('0x2'));var config=require('../../config/environment');module[_0x9f4c('0x3')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x9f4c('0x4')](_0x9f4c('0x5'))?path[_0x9f4c('0x6')](this['getDataValue'](_0x9f4c('0x5'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x9f4c('0x7')]},'value':{'type':Sequelize['STRING'],'set':function(_0x5cf322){var _0x498795=_0x5cf322[_0x9f4c('0x8')](/\\/g,'/');this[_0x9f4c('0x9')](_0x9f4c('0x5'),_0x498795);}},'rating':{'type':Sequelize[_0x9f4c('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x9f4c('0xa')],'set':function(_0x37b693){this['setDataValue'](_0x9f4c('0xb'),moment()[_0x9f4c('0xc')](_0x37b693,'ms'));this[_0x9f4c('0x9')](_0x9f4c('0xd'),moment());this[_0x9f4c('0x9')](_0x9f4c('0xe'),_0x37b693);}},'startedAt':{'type':Sequelize[_0x9f4c('0xf')],'get':function(){return moment(this[_0x9f4c('0x4')]('startedAt'))['format']('MM-DD-YYYY\x20HH:mm')[_0x9f4c('0x10')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0x9f4c('0xd')))['format']('MM-DD-YYYY\x20HH:mm')[_0x9f4c('0x10')]();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0x9f4c('0x11')))['format'](_0x9f4c('0x12'))[_0x9f4c('0x10')]();}},'updatedAt':{'type':Sequelize[_0x9f4c('0xf')],'get':function(){return moment(this[_0x9f4c('0x4')](_0x9f4c('0x13')))[_0x9f4c('0x14')]('MM-DD-YYYY\x20HH:mm')[_0x9f4c('0x10')]();}}}; \ No newline at end of file +var _0x4ca7=['sequelize','moment','path','exports','VIRTUAL','extname','value','STRING','replace','setDataValue','INTEGER','startedAt','closedAt','duration','DATE','getDataValue','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','updatedAt'];(function(_0x16c1f8,_0x1b03f7){var _0x10e2b5=function(_0x32a114){while(--_0x32a114){_0x16c1f8['push'](_0x16c1f8['shift']());}};_0x10e2b5(++_0x1b03f7);}(_0x4ca7,0x1e3));var _0x74ca=function(_0x3522ad,_0xd589cd){_0x3522ad=_0x3522ad-0x0;var _0x3f34e3=_0x4ca7[_0x3522ad];return _0x3f34e3;};'use strict';var Sequelize=require(_0x74ca('0x0'));var moment=require(_0x74ca('0x1'));var path=require(_0x74ca('0x2'));var config=require('../../config/environment');module[_0x74ca('0x3')]={'format':{'type':Sequelize[_0x74ca('0x4')],'get':function(){return this['getDataValue']('value')?path[_0x74ca('0x5')](this['getDataValue'](_0x74ca('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0x74ca('0x7')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x74ca('0x7')],'set':function(_0x572dc2){var _0x453b45=_0x572dc2[_0x74ca('0x8')](/\\/g,'/');this[_0x74ca('0x9')](_0x74ca('0x6'),_0x453b45);}},'rating':{'type':Sequelize[_0x74ca('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x74ca('0xa')],'set':function(_0x116715){this['setDataValue'](_0x74ca('0xb'),moment()['subtract'](_0x116715,'ms'));this[_0x74ca('0x9')](_0x74ca('0xc'),moment());this['setDataValue'](_0x74ca('0xd'),_0x116715);}},'startedAt':{'type':Sequelize[_0x74ca('0xe')],'get':function(){return moment(this[_0x74ca('0xf')](_0x74ca('0xb')))[_0x74ca('0x10')](_0x74ca('0x11'))[_0x74ca('0x12')]();}},'closedAt':{'type':Sequelize[_0x74ca('0xe')],'get':function(){return moment(this['getDataValue'](_0x74ca('0xc')))[_0x74ca('0x10')](_0x74ca('0x11'))[_0x74ca('0x12')]();}},'createdAt':{'type':Sequelize[_0x74ca('0xe')],'get':function(){return moment(this[_0x74ca('0xf')](_0x74ca('0x13')))[_0x74ca('0x10')](_0x74ca('0x11'))[_0x74ca('0x12')]();}},'updatedAt':{'type':Sequelize[_0x74ca('0xe')],'get':function(){return moment(this[_0x74ca('0xf')](_0x74ca('0x14')))[_0x74ca('0x10')]('MM-DD-YYYY\x20HH:mm')[_0x74ca('0x12')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 105dfe6..cacda8c 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 _0xd6d6=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','ScreenRecording','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','include','findAll','catch','find','create','body','duration','createdAt','closedAt','value','params','describe','download','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','Entity\x20not\x20found','info','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','isNil','File:\x20\x22','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x4a666d,_0x2c4ea6){var _0x572e3d=function(_0x4685a8){while(--_0x4685a8){_0x4a666d['push'](_0x4a666d['shift']());}};_0x572e3d(++_0x2c4ea6);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x4e2a47,_0x37f2d1){_0x4e2a47=_0x4e2a47-0x0;var _0x5a72f9=_0xd6d6[_0x4e2a47];return _0x5a72f9;};'use strict';var emlformat=require(_0x6d6d('0x0'));var rimraf=require(_0x6d6d('0x1'));var zipdir=require(_0x6d6d('0x2'));var jsonpatch=require(_0x6d6d('0x3'));var rp=require('request-promise');var moment=require(_0x6d6d('0x4'));var BPromise=require(_0x6d6d('0x5'));var Mustache=require(_0x6d6d('0x6'));var util=require(_0x6d6d('0x7'));var path=require(_0x6d6d('0x8'));var sox=require(_0x6d6d('0x9'));var csv=require(_0x6d6d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6d6d('0xb'));var _=require(_0x6d6d('0xc'));var squel=require(_0x6d6d('0xd'));var crypto=require(_0x6d6d('0xe'));var jsforce=require(_0x6d6d('0xf'));var deskjs=require(_0x6d6d('0x10'));var toCsv=require(_0x6d6d('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6d6d('0x11'));var authService=require(_0x6d6d('0x12'));var qs=require(_0x6d6d('0x13'));var as=require(_0x6d6d('0x14'));var hardwareService=require(_0x6d6d('0x15'));var logger=require('../../config/logger')(_0x6d6d('0x16'));var utils=require(_0x6d6d('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6d6d('0x18'))['db'];function respondWithStatusCode(_0x32146d,_0xe61c36){_0xe61c36=_0xe61c36||0xcc;return function(_0x3f8542){if(_0x3f8542){return _0x32146d[_0x6d6d('0x19')](_0xe61c36);}return _0x32146d[_0x6d6d('0x1a')](_0xe61c36)[_0x6d6d('0x1b')]();};}function respondWithResult(_0x2cb2dd,_0x5f4154){_0x5f4154=_0x5f4154||0xc8;return function(_0xd09ea7){if(_0xd09ea7){return _0x2cb2dd[_0x6d6d('0x1a')](_0x5f4154)[_0x6d6d('0x1c')](_0xd09ea7);}};}function respondWithFilteredResult(_0xa3b05d,_0x29cbd8){return function(_0x5d80c0){if(_0x5d80c0){var _0x2e6fdb=typeof _0x29cbd8['offset']===_0x6d6d('0x1d')&&typeof _0x29cbd8[_0x6d6d('0x1e')]===_0x6d6d('0x1d');var _0x4bb3d1=_0x5d80c0['count'];var _0x9e1e18=_0x2e6fdb?0x0:_0x29cbd8[_0x6d6d('0x1f')];var _0x2b59d4=_0x2e6fdb?_0x5d80c0[_0x6d6d('0x20')]:_0x29cbd8['offset']+_0x29cbd8['limit'];var _0x474873;if(_0x2b59d4>=_0x4bb3d1){_0x2b59d4=_0x4bb3d1;_0x474873=0xc8;}else{_0x474873=0xce;}_0xa3b05d['status'](_0x474873);return _0xa3b05d[_0x6d6d('0x21')](_0x6d6d('0x22'),_0x9e1e18+'-'+_0x2b59d4+'/'+_0x4bb3d1)[_0x6d6d('0x1c')](_0x5d80c0);}return null;};}function patchUpdates(_0x450352){return function(_0x40d35b){try{jsonpatch[_0x6d6d('0x23')](_0x40d35b,_0x450352,!![]);}catch(_0x164c67){return BPromise[_0x6d6d('0x24')](_0x164c67);}return _0x40d35b[_0x6d6d('0x25')]();};}function saveUpdates(_0x6f64e3,_0x24b10d){return function(_0x6e58e3){if(_0x6e58e3){return _0x6e58e3[_0x6d6d('0x26')](_0x6f64e3)[_0x6d6d('0x27')](function(_0x1f7f88){return _0x1f7f88;});}return null;};}function removeEntity(_0x25a02e,_0xced622){return function(_0x583b10){if(_0x583b10){return _0x583b10[_0x6d6d('0x28')]()[_0x6d6d('0x27')](function(){_0x25a02e[_0x6d6d('0x1a')](0xcc)[_0x6d6d('0x1b')]();});}};}function handleEntityNotFound(_0xf0df7f,_0x12fab2){return function(_0x554f8e){if(!_0x554f8e){_0xf0df7f[_0x6d6d('0x19')](0x194);}return _0x554f8e;};}function handleError(_0x2b5e31,_0x235451){_0x235451=_0x235451||0x1f4;return function(_0x126ac8){logger[_0x6d6d('0x29')](_0x126ac8[_0x6d6d('0x2a')]);if(_0x126ac8[_0x6d6d('0x2b')]){delete _0x126ac8['name'];}_0x2b5e31[_0x6d6d('0x1a')](_0x235451)[_0x6d6d('0x2c')](_0x126ac8);};}exports['index']=function(_0x553645,_0x3edcce){var _0x5273cd={},_0x8a9a84={},_0x57341f={'count':0x0,'rows':[]};var _0xde3272=_[_0x6d6d('0x2d')](db[_0x6d6d('0x2e')][_0x6d6d('0x2f')],function(_0x64d1f7){return{'name':_0x64d1f7[_0x6d6d('0x30')],'type':_0x64d1f7[_0x6d6d('0x31')][_0x6d6d('0x32')]};});_0x8a9a84[_0x6d6d('0x33')]=_[_0x6d6d('0x34')](_['map'](_0xde3272,_0x6d6d('0x2b')),['format']);_0x8a9a84[_0x6d6d('0x35')]=_[_0x6d6d('0x36')](_0x553645[_0x6d6d('0x35')]);_0x8a9a84[_0x6d6d('0x37')]=_['intersection'](_0x8a9a84[_0x6d6d('0x33')],_0x8a9a84['query']);_0x5273cd[_0x6d6d('0x38')]=_[_0x6d6d('0x39')](_0x8a9a84['model'],qs[_0x6d6d('0x3a')](_0x553645[_0x6d6d('0x35')][_0x6d6d('0x3a')]));_0x5273cd[_0x6d6d('0x38')]=_0x5273cd[_0x6d6d('0x38')][_0x6d6d('0x3b')]?_0x5273cd[_0x6d6d('0x38')]:_0x8a9a84[_0x6d6d('0x33')];if(!_0x553645[_0x6d6d('0x35')][_0x6d6d('0x3c')](_0x6d6d('0x3d'))){_0x5273cd[_0x6d6d('0x1e')]=qs[_0x6d6d('0x1e')](_0x553645[_0x6d6d('0x35')]['limit']);_0x5273cd[_0x6d6d('0x1f')]=qs[_0x6d6d('0x1f')](_0x553645[_0x6d6d('0x35')][_0x6d6d('0x1f')]);}_0x5273cd['order']=qs['sort'](_0x553645[_0x6d6d('0x35')][_0x6d6d('0x3e')]);_0x5273cd[_0x6d6d('0x3f')]=qs['filters'](_[_0x6d6d('0x40')](_0x553645[_0x6d6d('0x35')],_0x8a9a84[_0x6d6d('0x37')]),_0xde3272);if(_0x553645[_0x6d6d('0x35')]['filter']){_0x5273cd['where']=_['merge'](_0x5273cd[_0x6d6d('0x3f')],{'$or':_[_0x6d6d('0x2d')](_0xde3272,function(_0x33c8f2){if(_0x33c8f2[_0x6d6d('0x31')]!=='VIRTUAL'){var _0x253416={};_0x253416[_0x33c8f2[_0x6d6d('0x2b')]]={'$like':'%'+_0x553645[_0x6d6d('0x35')][_0x6d6d('0x41')]+'%'};return _0x253416;}})});}_0x5273cd=_[_0x6d6d('0x42')]({},_0x5273cd,_0x553645[_0x6d6d('0x43')]);var _0x4b457d={'where':_0x5273cd[_0x6d6d('0x3f')]};return db[_0x6d6d('0x2e')][_0x6d6d('0x20')](_0x4b457d)[_0x6d6d('0x27')](function(_0x32275b){_0x57341f[_0x6d6d('0x20')]=_0x32275b;if(_0x553645[_0x6d6d('0x35')]['includeAll']){_0x5273cd[_0x6d6d('0x44')]=[{'all':!![]}];}return db[_0x6d6d('0x2e')][_0x6d6d('0x45')](_0x5273cd);})[_0x6d6d('0x27')](function(_0xe1aa77){_0x57341f['rows']=_0xe1aa77;return _0x57341f;})[_0x6d6d('0x27')](respondWithFilteredResult(_0x3edcce,_0x5273cd))[_0x6d6d('0x46')](handleError(_0x3edcce,null));};exports['show']=function(_0x452de2,_0x50dc17){var _0x15bf62={'raw':![],'where':{'id':_0x452de2['params']['id']}},_0x43c03c={};_0x43c03c[_0x6d6d('0x33')]=_[_0x6d6d('0x36')](db[_0x6d6d('0x2e')][_0x6d6d('0x2f')]);_0x43c03c[_0x6d6d('0x35')]=_['keys'](_0x452de2['query']);_0x43c03c[_0x6d6d('0x37')]=_['intersection'](_0x43c03c['model'],_0x43c03c[_0x6d6d('0x35')]);_0x15bf62[_0x6d6d('0x38')]=_[_0x6d6d('0x39')](_0x43c03c['model'],qs[_0x6d6d('0x3a')](_0x452de2['query'][_0x6d6d('0x3a')]));_0x15bf62[_0x6d6d('0x38')]=_0x15bf62[_0x6d6d('0x38')][_0x6d6d('0x3b')]?_0x15bf62[_0x6d6d('0x38')]:_0x43c03c[_0x6d6d('0x33')];if(_0x452de2[_0x6d6d('0x35')]['includeAll']){_0x15bf62[_0x6d6d('0x44')]=[{'all':!![]}];}_0x15bf62=_[_0x6d6d('0x42')]({},_0x15bf62,_0x452de2[_0x6d6d('0x43')]);return db[_0x6d6d('0x2e')][_0x6d6d('0x47')](_0x15bf62)[_0x6d6d('0x27')](handleEntityNotFound(_0x50dc17,null))[_0x6d6d('0x27')](respondWithResult(_0x50dc17,null))[_0x6d6d('0x46')](handleError(_0x50dc17,null));};exports[_0x6d6d('0x48')]=function(_0x5e4c04,_0x4d78bb){return db[_0x6d6d('0x2e')][_0x6d6d('0x48')](_0x5e4c04[_0x6d6d('0x49')],{})[_0x6d6d('0x27')](respondWithResult(_0x4d78bb,0xc9))[_0x6d6d('0x46')](handleError(_0x4d78bb,null));};exports['update']=function(_0x47170d,_0x27b396){if(_0x47170d[_0x6d6d('0x49')]['id']){delete _0x47170d[_0x6d6d('0x49')]['id'];}delete _0x47170d[_0x6d6d('0x49')][_0x6d6d('0x4a')];delete _0x47170d[_0x6d6d('0x49')][_0x6d6d('0x4b')];delete _0x47170d[_0x6d6d('0x49')][_0x6d6d('0x4c')];delete _0x47170d[_0x6d6d('0x49')][_0x6d6d('0x4d')];return db['ScreenRecording'][_0x6d6d('0x47')]({'where':{'id':_0x47170d[_0x6d6d('0x4e')]['id']}})[_0x6d6d('0x27')](handleEntityNotFound(_0x27b396,null))[_0x6d6d('0x27')](saveUpdates(_0x47170d[_0x6d6d('0x49')],null))['then'](respondWithResult(_0x27b396,null))[_0x6d6d('0x46')](handleError(_0x27b396,null));};exports[_0x6d6d('0x4f')]=function(_0x45340b,_0x4e4c3e){return db['ScreenRecording'][_0x6d6d('0x4f')]()['then'](respondWithResult(_0x4e4c3e,null))[_0x6d6d('0x46')](handleError(_0x4e4c3e,null));};exports[_0x6d6d('0x50')]=function(_0x32aaae,_0x268361,_0x4777a5){var _0x18e2de=require(_0x6d6d('0x51'));var _0x26c23a=![];var _0x1a8f33={};if(_0x32aaae[_0x6d6d('0x35')]['type']&&_0x32aaae[_0x6d6d('0x35')][_0x6d6d('0x31')]===_0x6d6d('0x52')){_0x1a8f33[_0x6d6d('0x52')]=_0x32aaae[_0x6d6d('0x4e')]['id'];}else{_0x1a8f33['id']=_0x32aaae[_0x6d6d('0x4e')]['id'];}return db[_0x6d6d('0x2e')]['find']({'where':_0x1a8f33,'attributes':['id','value'],'raw':!![]})[_0x6d6d('0x27')](handleEntityNotFound(_0x268361,null))[_0x6d6d('0x27')](function(_0x5cc644){if(_0x5cc644){var _0x3e98a0=path[_0x6d6d('0x53')](config[_0x6d6d('0x54')],_0x6d6d('0x55'),_0x5cc644[_0x6d6d('0x4d')]);var _0xc6b96e=util[_0x6d6d('0x56')](_0x6d6d('0x57'),_0x3e98a0);if(fs[_0x6d6d('0x58')](_0xc6b96e)){_0x26c23a=!![];return _0x18e2de[_0x6d6d('0x59')](_0xc6b96e,_0x3e98a0,config[_0x6d6d('0x5a')][_0x6d6d('0x5b')])[_0x6d6d('0x27')](function(){return _0x5cc644;});}return _0x5cc644;}})[_0x6d6d('0x27')](function(_0x3065ea){if(_0x3065ea){var _0x50d8dd=path[_0x6d6d('0x53')](config[_0x6d6d('0x54')],'server/files/screen_recordings',_0x3065ea[_0x6d6d('0x4d')]);if(!fs[_0x6d6d('0x58')](_0x50d8dd)){throw new db[(_0x6d6d('0x5c'))][(_0x6d6d('0x5d'))](_0x6d6d('0x5e'));}if(_0x3065ea[_0x6d6d('0x5f')]){return _0x268361[_0x6d6d('0x50')](_0x50d8dd,_0x3065ea[_0x6d6d('0x5f')]+path[_0x6d6d('0x60')](_0x50d8dd),function(){if(_0x26c23a){fs['unlink'](_0x50d8dd);}});}else{return _0x268361['download'](_0x50d8dd,function(_0x22c3a1){if(_0x26c23a){fs[_0x6d6d('0x61')](_0x50d8dd);}});}}})[_0x6d6d('0x46')](function(_0x5de33f){if(_0x5de33f['message']===_0x6d6d('0x5e')){_0x268361['status'](0x194)[_0x6d6d('0x2c')]('Not\x20found');}else{return handleError(_0x268361,null);}});};exports[_0x6d6d('0x28')]=function(_0x367a6f,_0x21f14c){return db[_0x6d6d('0x2e')][_0x6d6d('0x47')]({'where':{'id':_0x367a6f[_0x6d6d('0x4e')]['id']}})['then'](function(_0x41e576){if(_['isNil'](_0x41e576)){throw new ReferenceError(_0x6d6d('0x62'));}return _0x41e576;})['then'](function(_0x2a21d8){var _0x3e48f7=path[_0x6d6d('0x53')](config[_0x6d6d('0x54')],_0x6d6d('0x55'),_0x2a21d8[_0x6d6d('0x4d')]);logger[_0x6d6d('0x63')]('cancellazione\x20fisica\x20documento\x20%s',_0x3e48f7);if(!_['isNil'](_0x2a21d8[_0x6d6d('0x4d')])&&fs['existsSync'](_0x3e48f7)){logger[_0x6d6d('0x63')]('File:\x20\x22'+_0x3e48f7+_0x6d6d('0x64'));fs[_0x6d6d('0x65')](_0x3e48f7);}_0x3e48f7=_0x3e48f7+_0x6d6d('0x66');if(!_[_0x6d6d('0x67')](_0x2a21d8[_0x6d6d('0x4d')])&&fs[_0x6d6d('0x58')](_0x3e48f7)){logger['info'](_0x6d6d('0x68')+_0x3e48f7+_0x6d6d('0x64'));fs[_0x6d6d('0x65')](_0x3e48f7);}return _0x2a21d8;})[_0x6d6d('0x27')](function(_0x1ba731){if(!_0x1ba731)throw new InternalError();return _0x1ba731[_0x6d6d('0x28')]();})[_0x6d6d('0x27')](function(){_0x21f14c['status'](0xcc)[_0x6d6d('0x1b')]();})[_0x6d6d('0x46')](handleError(_0x21f14c,null));}; \ No newline at end of file +var _0x8958=['pick','merge','VIRTUAL','filter','options','ScreenRecording','include','findAll','params','rawAttributes','includeAll','create','catch','body','createdAt','closedAt','describe','download','../../components/encryptor','uniqueid','find','value','join','root','server/files/screen_recordings','%s.cypher','decryptFile','secrets','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','unlink','message','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','destroy','rimraf','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','apply','reject','save','update','then','error','name','send','index','map','fieldName','type','key','model','format','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x26fcef,_0x176cab){var _0x4adc38=function(_0x811f04){while(--_0x811f04){_0x26fcef['push'](_0x26fcef['shift']());}};_0x4adc38(++_0x176cab);}(_0x8958,0x93));var _0x8895=function(_0x5355fc,_0x454ef7){_0x5355fc=_0x5355fc-0x0;var _0x2145f1=_0x8958[_0x5355fc];return _0x2145f1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8895('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8895('0x1'));var Mustache=require('mustache');var util=require(_0x8895('0x2'));var path=require(_0x8895('0x3'));var sox=require(_0x8895('0x4'));var csv=require('to-csv');var ejs=require(_0x8895('0x5'));var fs=require('fs');var fs_extra=require(_0x8895('0x6'));var _=require(_0x8895('0x7'));var squel=require(_0x8895('0x8'));var crypto=require(_0x8895('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x8895('0xa'));var toCsv=require(_0x8895('0xb'));var querystring=require(_0x8895('0xc'));var Papa=require(_0x8895('0xd'));var Redis=require(_0x8895('0xe'));var authService=require(_0x8895('0xf'));var qs=require(_0x8895('0x10'));var as=require(_0x8895('0x11'));var hardwareService=require(_0x8895('0x12'));var logger=require(_0x8895('0x13'))('api');var utils=require(_0x8895('0x14'));var config=require(_0x8895('0x15'));var licenseUtil=require(_0x8895('0x16'));var db=require(_0x8895('0x17'))['db'];function respondWithStatusCode(_0x446e1a,_0xaf93bc){_0xaf93bc=_0xaf93bc||0xcc;return function(_0x5af0ef){if(_0x5af0ef){return _0x446e1a[_0x8895('0x18')](_0xaf93bc);}return _0x446e1a[_0x8895('0x19')](_0xaf93bc)[_0x8895('0x1a')]();};}function respondWithResult(_0x57d40a,_0x47b9fe){_0x47b9fe=_0x47b9fe||0xc8;return function(_0x9191b8){if(_0x9191b8){return _0x57d40a['status'](_0x47b9fe)[_0x8895('0x1b')](_0x9191b8);}};}function respondWithFilteredResult(_0x337101,_0x195789){return function(_0x3d7b59){if(_0x3d7b59){var _0x2c9d40=typeof _0x195789['offset']===_0x8895('0x1c')&&typeof _0x195789[_0x8895('0x1d')]===_0x8895('0x1c');var _0xcdd661=_0x3d7b59[_0x8895('0x1e')];var _0x1b5c82=_0x2c9d40?0x0:_0x195789[_0x8895('0x1f')];var _0x26cee0=_0x2c9d40?_0x3d7b59[_0x8895('0x1e')]:_0x195789[_0x8895('0x1f')]+_0x195789[_0x8895('0x1d')];var _0x6b8a16;if(_0x26cee0>=_0xcdd661){_0x26cee0=_0xcdd661;_0x6b8a16=0xc8;}else{_0x6b8a16=0xce;}_0x337101[_0x8895('0x19')](_0x6b8a16);return _0x337101['set']('Content-Range',_0x1b5c82+'-'+_0x26cee0+'/'+_0xcdd661)['json'](_0x3d7b59);}return null;};}function patchUpdates(_0x3daf43){return function(_0x456282){try{jsonpatch[_0x8895('0x20')](_0x456282,_0x3daf43,!![]);}catch(_0x29449a){return BPromise[_0x8895('0x21')](_0x29449a);}return _0x456282[_0x8895('0x22')]();};}function saveUpdates(_0x461346,_0xc1ce17){return function(_0x5219ca){if(_0x5219ca){return _0x5219ca[_0x8895('0x23')](_0x461346)[_0x8895('0x24')](function(_0x2a403){return _0x2a403;});}return null;};}function removeEntity(_0x1f71f3,_0x29223d){return function(_0x4d092d){if(_0x4d092d){return _0x4d092d['destroy']()[_0x8895('0x24')](function(){_0x1f71f3[_0x8895('0x19')](0xcc)[_0x8895('0x1a')]();});}};}function handleEntityNotFound(_0x24a376,_0x4fc150){return function(_0x25da11){if(!_0x25da11){_0x24a376[_0x8895('0x18')](0x194);}return _0x25da11;};}function handleError(_0x187a15,_0x5486a6){_0x5486a6=_0x5486a6||0x1f4;return function(_0x4aee03){logger[_0x8895('0x25')](_0x4aee03['stack']);if(_0x4aee03[_0x8895('0x26')]){delete _0x4aee03[_0x8895('0x26')];}_0x187a15[_0x8895('0x19')](_0x5486a6)[_0x8895('0x27')](_0x4aee03);};}exports[_0x8895('0x28')]=function(_0x5c03ea,_0x4d567a){var _0x6e449d={},_0x37ac3a={},_0x3fc4cc={'count':0x0,'rows':[]};var _0x16b65b=_[_0x8895('0x29')](db['ScreenRecording']['rawAttributes'],function(_0x46ae32){return{'name':_0x46ae32[_0x8895('0x2a')],'type':_0x46ae32[_0x8895('0x2b')][_0x8895('0x2c')]};});_0x37ac3a[_0x8895('0x2d')]=_['differenceBy'](_[_0x8895('0x29')](_0x16b65b,'name'),[_0x8895('0x2e')]);_0x37ac3a['query']=_[_0x8895('0x2f')](_0x5c03ea[_0x8895('0x30')]);_0x37ac3a[_0x8895('0x31')]=_[_0x8895('0x32')](_0x37ac3a[_0x8895('0x2d')],_0x37ac3a['query']);_0x6e449d[_0x8895('0x33')]=_[_0x8895('0x32')](_0x37ac3a[_0x8895('0x2d')],qs[_0x8895('0x34')](_0x5c03ea[_0x8895('0x30')]['fields']));_0x6e449d[_0x8895('0x33')]=_0x6e449d['attributes'][_0x8895('0x35')]?_0x6e449d['attributes']:_0x37ac3a[_0x8895('0x2d')];if(!_0x5c03ea[_0x8895('0x30')][_0x8895('0x36')](_0x8895('0x37'))){_0x6e449d[_0x8895('0x1d')]=qs['limit'](_0x5c03ea[_0x8895('0x30')]['limit']);_0x6e449d[_0x8895('0x1f')]=qs[_0x8895('0x1f')](_0x5c03ea[_0x8895('0x30')][_0x8895('0x1f')]);}_0x6e449d[_0x8895('0x38')]=qs[_0x8895('0x39')](_0x5c03ea['query'][_0x8895('0x39')]);_0x6e449d[_0x8895('0x3a')]=qs['filters'](_[_0x8895('0x3b')](_0x5c03ea['query'],_0x37ac3a[_0x8895('0x31')]),_0x16b65b);if(_0x5c03ea[_0x8895('0x30')]['filter']){_0x6e449d[_0x8895('0x3a')]=_[_0x8895('0x3c')](_0x6e449d['where'],{'$or':_['map'](_0x16b65b,function(_0x202130){if(_0x202130[_0x8895('0x2b')]!==_0x8895('0x3d')){var _0x331a9e={};_0x331a9e[_0x202130[_0x8895('0x26')]]={'$like':'%'+_0x5c03ea['query'][_0x8895('0x3e')]+'%'};return _0x331a9e;}})});}_0x6e449d=_[_0x8895('0x3c')]({},_0x6e449d,_0x5c03ea[_0x8895('0x3f')]);var _0x10005f={'where':_0x6e449d[_0x8895('0x3a')]};return db[_0x8895('0x40')]['count'](_0x10005f)[_0x8895('0x24')](function(_0x5ebfc4){_0x3fc4cc[_0x8895('0x1e')]=_0x5ebfc4;if(_0x5c03ea[_0x8895('0x30')]['includeAll']){_0x6e449d[_0x8895('0x41')]=[{'all':!![]}];}return db['ScreenRecording'][_0x8895('0x42')](_0x6e449d);})['then'](function(_0x4af3b1){_0x3fc4cc['rows']=_0x4af3b1;return _0x3fc4cc;})['then'](respondWithFilteredResult(_0x4d567a,_0x6e449d))['catch'](handleError(_0x4d567a,null));};exports['show']=function(_0x447ed6,_0x206f57){var _0x596531={'raw':![],'where':{'id':_0x447ed6[_0x8895('0x43')]['id']}},_0x4835d7={};_0x4835d7[_0x8895('0x2d')]=_['keys'](db[_0x8895('0x40')][_0x8895('0x44')]);_0x4835d7[_0x8895('0x30')]=_[_0x8895('0x2f')](_0x447ed6[_0x8895('0x30')]);_0x4835d7['filters']=_['intersection'](_0x4835d7['model'],_0x4835d7[_0x8895('0x30')]);_0x596531['attributes']=_[_0x8895('0x32')](_0x4835d7[_0x8895('0x2d')],qs[_0x8895('0x34')](_0x447ed6[_0x8895('0x30')]['fields']));_0x596531[_0x8895('0x33')]=_0x596531[_0x8895('0x33')][_0x8895('0x35')]?_0x596531[_0x8895('0x33')]:_0x4835d7[_0x8895('0x2d')];if(_0x447ed6[_0x8895('0x30')][_0x8895('0x45')]){_0x596531[_0x8895('0x41')]=[{'all':!![]}];}_0x596531=_['merge']({},_0x596531,_0x447ed6[_0x8895('0x3f')]);return db[_0x8895('0x40')]['find'](_0x596531)[_0x8895('0x24')](handleEntityNotFound(_0x206f57,null))['then'](respondWithResult(_0x206f57,null))['catch'](handleError(_0x206f57,null));};exports[_0x8895('0x46')]=function(_0x337a9f,_0x130018){return db['ScreenRecording'][_0x8895('0x46')](_0x337a9f['body'],{})[_0x8895('0x24')](respondWithResult(_0x130018,0xc9))[_0x8895('0x47')](handleError(_0x130018,null));};exports[_0x8895('0x23')]=function(_0x1ca539,_0x2f3bf1){if(_0x1ca539[_0x8895('0x48')]['id']){delete _0x1ca539[_0x8895('0x48')]['id'];}delete _0x1ca539['body']['duration'];delete _0x1ca539[_0x8895('0x48')][_0x8895('0x49')];delete _0x1ca539['body'][_0x8895('0x4a')];delete _0x1ca539['body']['value'];return db[_0x8895('0x40')]['find']({'where':{'id':_0x1ca539[_0x8895('0x43')]['id']}})[_0x8895('0x24')](handleEntityNotFound(_0x2f3bf1,null))[_0x8895('0x24')](saveUpdates(_0x1ca539[_0x8895('0x48')],null))[_0x8895('0x24')](respondWithResult(_0x2f3bf1,null))[_0x8895('0x47')](handleError(_0x2f3bf1,null));};exports[_0x8895('0x4b')]=function(_0x38d6ae,_0x583419){return db[_0x8895('0x40')][_0x8895('0x4b')]()[_0x8895('0x24')](respondWithResult(_0x583419,null))['catch'](handleError(_0x583419,null));};exports[_0x8895('0x4c')]=function(_0x3935fd,_0xd7ffeb,_0x14e769){var _0x1e264a=require(_0x8895('0x4d'));var _0x434ab8=![];var _0x216e6e={};if(_0x3935fd[_0x8895('0x30')][_0x8895('0x2b')]&&_0x3935fd['query'][_0x8895('0x2b')]===_0x8895('0x4e')){_0x216e6e[_0x8895('0x4e')]=_0x3935fd[_0x8895('0x43')]['id'];}else{_0x216e6e['id']=_0x3935fd[_0x8895('0x43')]['id'];}return db['ScreenRecording'][_0x8895('0x4f')]({'where':_0x216e6e,'attributes':['id',_0x8895('0x50')],'raw':!![]})[_0x8895('0x24')](handleEntityNotFound(_0xd7ffeb,null))[_0x8895('0x24')](function(_0x37a7b4){if(_0x37a7b4){var _0x58dd6c=path[_0x8895('0x51')](config[_0x8895('0x52')],_0x8895('0x53'),_0x37a7b4['value']);var _0x20422f=util[_0x8895('0x2e')](_0x8895('0x54'),_0x58dd6c);if(fs['existsSync'](_0x20422f)){_0x434ab8=!![];return _0x1e264a[_0x8895('0x55')](_0x20422f,_0x58dd6c,config[_0x8895('0x56')]['recording'])[_0x8895('0x24')](function(){return _0x37a7b4;});}return _0x37a7b4;}})[_0x8895('0x24')](function(_0x5198f8){if(_0x5198f8){var _0x2f990a=path[_0x8895('0x51')](config[_0x8895('0x52')],_0x8895('0x53'),_0x5198f8['value']);if(!fs['existsSync'](_0x2f990a)){throw new db[(_0x8895('0x57'))][(_0x8895('0x58'))](_0x8895('0x59'));}if(_0x5198f8['filename']){return _0xd7ffeb[_0x8895('0x4c')](_0x2f990a,_0x5198f8[_0x8895('0x5a')]+path['extname'](_0x2f990a),function(){if(_0x434ab8){fs[_0x8895('0x5b')](_0x2f990a);}});}else{return _0xd7ffeb['download'](_0x2f990a,function(_0x435e36){if(_0x434ab8){fs[_0x8895('0x5b')](_0x2f990a);}});}}})[_0x8895('0x47')](function(_0x14f8a4){if(_0x14f8a4[_0x8895('0x5c')]==='ScreenRecording\x20not\x20found'){_0xd7ffeb['status'](0x194)[_0x8895('0x27')](_0x8895('0x5d'));}else{return handleError(_0xd7ffeb,null);}});};exports['destroy']=function(_0x46f8ae,_0x131476){return db[_0x8895('0x40')][_0x8895('0x4f')]({'where':{'id':_0x46f8ae['params']['id']}})[_0x8895('0x24')](function(_0x2d2bf9){if(_[_0x8895('0x5e')](_0x2d2bf9)){throw new ReferenceError(_0x8895('0x5f'));}return _0x2d2bf9;})[_0x8895('0x24')](function(_0x41a2fe){var _0x261d4b=path[_0x8895('0x51')](config[_0x8895('0x52')],_0x8895('0x53'),_0x41a2fe[_0x8895('0x50')]);logger[_0x8895('0x60')](_0x8895('0x61'),_0x261d4b);if(!_[_0x8895('0x5e')](_0x41a2fe[_0x8895('0x50')])&&fs['existsSync'](_0x261d4b)){logger['info']('File:\x20\x22'+_0x261d4b+_0x8895('0x62'));fs[_0x8895('0x63')](_0x261d4b);}_0x261d4b=_0x261d4b+_0x8895('0x64');if(!_[_0x8895('0x5e')](_0x41a2fe[_0x8895('0x50')])&&fs['existsSync'](_0x261d4b)){logger[_0x8895('0x60')](_0x8895('0x65')+_0x261d4b+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x8895('0x63')](_0x261d4b);}return _0x41a2fe;})[_0x8895('0x24')](function(_0xf51f48){if(!_0xf51f48)throw new InternalError();return _0xf51f48[_0x8895('0x66')]();})[_0x8895('0x24')](function(){_0x131476['status'](0xcc)[_0x8895('0x1a')]();})[_0x8895('0x47')](handleError(_0x131476,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 333e2c4..33fe92d 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 _0x8126=['screen_recordings','interactionid','lodash','util','../../config/logger','api','moment','bluebird','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording'];(function(_0x1a2c22,_0x15027){var _0x2fc87e=function(_0x587806){while(--_0x587806){_0x1a2c22['push'](_0x1a2c22['shift']());}};_0x2fc87e(++_0x15027);}(_0x8126,0x16e));var _0x6812=function(_0x20ceec,_0x5d61e6){_0x20ceec=_0x20ceec-0x0;var _0x567ceb=_0x8126[_0x20ceec];return _0x567ceb;};'use strict';var _=require(_0x6812('0x0'));var util=require(_0x6812('0x1'));var logger=require(_0x6812('0x2'))(_0x6812('0x3'));var moment=require(_0x6812('0x4'));var BPromise=require(_0x6812('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6812('0x6'));var attributes=require(_0x6812('0x7'));module[_0x6812('0x8')]=function(_0x4824d4,_0x22efcd){return _0x4824d4[_0x6812('0x9')](_0x6812('0xa'),attributes,{'tableName':_0x6812('0xb'),'paranoid':![],'indexes':[{'name':_0x6812('0xc'),'fields':[_0x6812('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5e28=['../../config/environment','./screenRecording.attributes','exports','define','screen_recordings','interactionid','lodash','util','../../config/logger','api','bluebird','path','rimraf'];(function(_0x2b7737,_0x1c5e90){var _0x2bc6cc=function(_0x4346d1){while(--_0x4346d1){_0x2b7737['push'](_0x2b7737['shift']());}};_0x2bc6cc(++_0x1c5e90);}(_0x5e28,0x165));var _0x85e2=function(_0x269ee8,_0x477226){_0x269ee8=_0x269ee8-0x0;var _0x4d98bd=_0x5e28[_0x269ee8];return _0x4d98bd;};'use strict';var _=require(_0x85e2('0x0'));var util=require(_0x85e2('0x1'));var logger=require(_0x85e2('0x2'))(_0x85e2('0x3'));var moment=require('moment');var BPromise=require(_0x85e2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x85e2('0x5'));var rimraf=require(_0x85e2('0x6'));var config=require(_0x85e2('0x7'));var attributes=require(_0x85e2('0x8'));module[_0x85e2('0x9')]=function(_0x365c3f,_0x215099){return _0x365c3f[_0x85e2('0xa')]('ScreenRecording',attributes,{'tableName':_0x85e2('0xb'),'paranoid':![],'indexes':[{'name':_0x85e2('0xc'),'fields':[_0x85e2('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index fa87e44..a7c6208 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 _0x0a35=['code','ScreenRecording,\x20%s,\x20%s','message','result','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x28b930,_0x19b05f){var _0x112256=function(_0x3b3f61){while(--_0x3b3f61){_0x28b930['push'](_0x28b930['shift']());}};_0x112256(++_0x19b05f);}(_0x0a35,0x123));var _0x50a3=function(_0x65ff6c,_0x4c2da3){_0x65ff6c=_0x65ff6c-0x0;var _0x238215=_0x0a35[_0x65ff6c];return _0x238215;};'use strict';var _=require(_0x50a3('0x0'));var util=require('util');var moment=require(_0x50a3('0x1'));var BPromise=require('bluebird');var rs=require(_0x50a3('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x50a3('0x3'))['db'];var utils=require(_0x50a3('0x4'));var logger=require(_0x50a3('0x5'))(_0x50a3('0x6'));var config=require(_0x50a3('0x7'));var jayson=require(_0x50a3('0x8'));var client=jayson[_0x50a3('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x8a88fd,_0x8cbf07,_0x4858ff){return new BPromise(function(_0x50675a,_0x1196d0){return client[_0x50a3('0xa')](_0x8a88fd,_0x4858ff)[_0x50a3('0xb')](function(_0x1449b8){logger['info']('ScreenRecording,\x20%s,\x20%s',_0x8cbf07,_0x50a3('0xc'));logger[_0x50a3('0xd')](_0x50a3('0xe'),_0x8cbf07,_0x50a3('0xc'),JSON[_0x50a3('0xf')](_0x1449b8));if(_0x1449b8[_0x50a3('0x10')]){if(_0x1449b8[_0x50a3('0x10')][_0x50a3('0x11')]===0x1f4){logger['error'](_0x50a3('0x12'),_0x8cbf07,_0x1449b8[_0x50a3('0x10')]['message']);return _0x1196d0(_0x1449b8[_0x50a3('0x10')][_0x50a3('0x13')]);}logger['error']('ScreenRecording,\x20%s,\x20%s',_0x8cbf07,_0x1449b8[_0x50a3('0x10')][_0x50a3('0x13')]);return _0x50675a(_0x1449b8['error'][_0x50a3('0x13')]);}else{logger['info']('ScreenRecording,\x20%s,\x20%s',_0x8cbf07,_0x50a3('0xc'));_0x50675a(_0x1449b8[_0x50a3('0x14')][_0x50a3('0x13')]);}})[_0x50a3('0x15')](function(_0x4035bd){logger['error'](_0x50a3('0x12'),_0x8cbf07,_0x4035bd);_0x1196d0(_0x4035bd);});});} \ No newline at end of file +var _0x0c2e=['rpc','../../config/environment','client','http','request','then','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x3550e8,_0x424fea){var _0x18eb61=function(_0x2dcb49){while(--_0x2dcb49){_0x3550e8['push'](_0x3550e8['shift']());}};_0x18eb61(++_0x424fea);}(_0x0c2e,0x1c5));var _0xe0c2=function(_0x84b164,_0x13cd9d){_0x84b164=_0x84b164-0x0;var _0x173942=_0x0c2e[_0x84b164];return _0x173942;};'use strict';var _=require(_0xe0c2('0x0'));var util=require(_0xe0c2('0x1'));var moment=require(_0xe0c2('0x2'));var BPromise=require('bluebird');var rs=require(_0xe0c2('0x3'));var fs=require('fs');var Redis=require(_0xe0c2('0x4'));var db=require(_0xe0c2('0x5'))['db'];var utils=require(_0xe0c2('0x6'));var logger=require('../../config/logger')(_0xe0c2('0x7'));var config=require(_0xe0c2('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe0c2('0x9')][_0xe0c2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x48402c,_0x4df742,_0x4b3111){return new BPromise(function(_0x46c87a,_0x462ef5){return client[_0xe0c2('0xb')](_0x48402c,_0x4b3111)[_0xe0c2('0xc')](function(_0x3735f2){logger['info'](_0xe0c2('0xd'),_0x4df742,_0xe0c2('0xe'));logger[_0xe0c2('0xf')]('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x4df742,_0xe0c2('0xe'),JSON[_0xe0c2('0x10')](_0x3735f2));if(_0x3735f2['error']){if(_0x3735f2[_0xe0c2('0x11')][_0xe0c2('0x12')]===0x1f4){logger[_0xe0c2('0x11')](_0xe0c2('0xd'),_0x4df742,_0x3735f2[_0xe0c2('0x11')][_0xe0c2('0x13')]);return _0x462ef5(_0x3735f2['error'][_0xe0c2('0x13')]);}logger[_0xe0c2('0x11')](_0xe0c2('0xd'),_0x4df742,_0x3735f2['error'][_0xe0c2('0x13')]);return _0x46c87a(_0x3735f2[_0xe0c2('0x11')][_0xe0c2('0x13')]);}else{logger[_0xe0c2('0x14')]('ScreenRecording,\x20%s,\x20%s',_0x4df742,_0xe0c2('0xe'));_0x46c87a(_0x3735f2[_0xe0c2('0x15')][_0xe0c2('0x13')]);}})[_0xe0c2('0x16')](function(_0x5239e9){logger[_0xe0c2('0x11')]('ScreenRecording,\x20%s,\x20%s',_0x4df742,_0x5239e9);_0x462ef5(_0x5239e9);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 9b5be99..479c44a 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 _0x9f70=['join','favicon','addFavicon','put','isAuthenticated','update','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./setting.controller','get','/now','getDate','show','/:id/logo','getLogo','getLogoLogin','/:id/gdpr','/:id/preferred','/:id/favicon','diskStorage','root','server/files/images/logos/','%s%s','logo','extname','originalname','logologin','post','single','file','format','addPreferred'];(function(_0x5d381c,_0x445675){var _0x5d0199=function(_0x3344e3){while(--_0x3344e3){_0x5d381c['push'](_0x5d381c['shift']());}};_0x5d0199(++_0x445675);}(_0x9f70,0x137));var _0x09f7=function(_0x44d95e,_0x545bdf){_0x44d95e=_0x44d95e-0x0;var _0x4b85e3=_0x9f70[_0x44d95e];return _0x4b85e3;};'use strict';var multer=require(_0x09f7('0x0'));var util=require('util');var path=require(_0x09f7('0x1'));var timeout=require(_0x09f7('0x2'));var express=require(_0x09f7('0x3'));var router=express['Router']();var fs_extra=require(_0x09f7('0x4'));var auth=require(_0x09f7('0x5'));var interaction=require(_0x09f7('0x6'));var config=require('../../config/environment');var controller=require(_0x09f7('0x7'));router[_0x09f7('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x09f7('0x9'),controller[_0x09f7('0xa')]);router[_0x09f7('0x8')]('/:id',controller[_0x09f7('0xb')]);router['get'](_0x09f7('0xc'),controller[_0x09f7('0xd')]);router[_0x09f7('0x8')]('/:id/logo_login',controller[_0x09f7('0xe')]);router['get'](_0x09f7('0xf'),controller['gdpr']);router[_0x09f7('0x8')](_0x09f7('0x10'),controller['getPreferred']);router[_0x09f7('0x8')](_0x09f7('0x11'),controller['getFavicon']);var upload=multer({'storage':multer[_0x09f7('0x12')]({'destination':function(_0x2bb175,_0x46bb09,_0x1ee5f3){_0x1ee5f3(null,path['join'](config[_0x09f7('0x13')],_0x09f7('0x14')));},'filename':function(_0x7474a4,_0xf0dc60,_0x8431ec){_0x8431ec(null,util['format'](_0x09f7('0x15'),_0x09f7('0x16'),path[_0x09f7('0x17')](_0xf0dc60[_0x09f7('0x18')])));}})});router['post']('/:id/logo',upload['single']('file'),controller['addLogo']);var upload=multer({'storage':multer[_0x09f7('0x12')]({'destination':function(_0x18ebc3,_0x1f0b06,_0x41bb6a){_0x41bb6a(null,path['join'](config[_0x09f7('0x13')],_0x09f7('0x14')));},'filename':function(_0x138d22,_0x85f8cc,_0x394751){_0x394751(null,util['format'](_0x09f7('0x15'),_0x09f7('0x19'),path['extname'](_0x85f8cc[_0x09f7('0x18')])));}})});router[_0x09f7('0x1a')]('/:id/logo_login',upload[_0x09f7('0x1b')](_0x09f7('0x1c')),controller['addLogoLogin']);var upload=multer({'storage':multer[_0x09f7('0x12')]({'destination':function(_0x238bbd,_0x4e57ee,_0x27cdcb){_0x27cdcb(null,path['join'](config[_0x09f7('0x13')],_0x09f7('0x14')));},'filename':function(_0x49b95a,_0x5196af,_0x36c536){_0x36c536(null,util[_0x09f7('0x1d')](_0x09f7('0x15'),'preferred',path[_0x09f7('0x17')](_0x5196af['originalname'])));}})});router[_0x09f7('0x1a')]('/:id/preferred',upload['single'](_0x09f7('0x1c')),controller[_0x09f7('0x1e')]);var upload=multer({'storage':multer[_0x09f7('0x12')]({'destination':function(_0x3bc71c,_0x87b0de,_0x56c653){_0x56c653(null,path[_0x09f7('0x1f')](config[_0x09f7('0x13')],_0x09f7('0x14')));},'filename':function(_0xf6052c,_0x34bd15,_0x2026cb){_0x2026cb(null,util[_0x09f7('0x1d')](_0x09f7('0x15'),_0x09f7('0x20'),path[_0x09f7('0x17')](_0x34bd15[_0x09f7('0x18')])));}})});router[_0x09f7('0x1a')](_0x09f7('0x11'),upload[_0x09f7('0x1b')](_0x09f7('0x1c')),controller[_0x09f7('0x21')]);router[_0x09f7('0x22')]('/:id',auth[_0x09f7('0x23')](),controller[_0x09f7('0x24')]);module[_0x09f7('0x25')]=router; \ No newline at end of file +var _0xd9ce=['update','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','isAuthenticated','get','/:id','show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','getPreferred','/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/','format','%s%s','extname','originalname','post','single','file','logologin','addLogoLogin','/:id/preferred','addPreferred','favicon','addFavicon','put'];(function(_0x41e52b,_0x3376e9){var _0xc34ecf=function(_0x47ec73){while(--_0x47ec73){_0x41e52b['push'](_0x41e52b['shift']());}};_0xc34ecf(++_0x3376e9);}(_0xd9ce,0xca));var _0xed9c=function(_0x46ce14,_0x4f7796){_0x46ce14=_0x46ce14-0x0;var _0x1f15f0=_0xd9ce[_0x46ce14];return _0x1f15f0;};'use strict';var multer=require(_0xed9c('0x0'));var util=require(_0xed9c('0x1'));var path=require(_0xed9c('0x2'));var timeout=require('connect-timeout');var express=require(_0xed9c('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xed9c('0x4'));var interaction=require(_0xed9c('0x5'));var config=require(_0xed9c('0x6'));var controller=require(_0xed9c('0x7'));router['get']('/',auth[_0xed9c('0x8')](),controller['index']);router[_0xed9c('0x9')]('/now',controller['getDate']);router[_0xed9c('0x9')](_0xed9c('0xa'),controller[_0xed9c('0xb')]);router['get'](_0xed9c('0xc'),controller[_0xed9c('0xd')]);router[_0xed9c('0x9')](_0xed9c('0xe'),controller[_0xed9c('0xf')]);router[_0xed9c('0x9')](_0xed9c('0x10'),controller['gdpr']);router[_0xed9c('0x9')]('/:id/preferred',controller[_0xed9c('0x11')]);router[_0xed9c('0x9')](_0xed9c('0x12'),controller[_0xed9c('0x13')]);var upload=multer({'storage':multer[_0xed9c('0x14')]({'destination':function(_0xd9f274,_0x3bf508,_0xc845c4){_0xc845c4(null,path[_0xed9c('0x15')](config[_0xed9c('0x16')],_0xed9c('0x17')));},'filename':function(_0x2d39ca,_0x3aa16b,_0x118e78){_0x118e78(null,util[_0xed9c('0x18')](_0xed9c('0x19'),'logo',path[_0xed9c('0x1a')](_0x3aa16b[_0xed9c('0x1b')])));}})});router[_0xed9c('0x1c')](_0xed9c('0xc'),upload[_0xed9c('0x1d')](_0xed9c('0x1e')),controller['addLogo']);var upload=multer({'storage':multer[_0xed9c('0x14')]({'destination':function(_0x40a314,_0xa76664,_0x356e9f){_0x356e9f(null,path[_0xed9c('0x15')](config[_0xed9c('0x16')],_0xed9c('0x17')));},'filename':function(_0x2d84aa,_0x23008c,_0x41a7a1){_0x41a7a1(null,util[_0xed9c('0x18')]('%s%s',_0xed9c('0x1f'),path[_0xed9c('0x1a')](_0x23008c[_0xed9c('0x1b')])));}})});router['post'](_0xed9c('0xe'),upload['single'](_0xed9c('0x1e')),controller[_0xed9c('0x20')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x90784c,_0x4217ba,_0x2ffcfc){_0x2ffcfc(null,path[_0xed9c('0x15')](config[_0xed9c('0x16')],_0xed9c('0x17')));},'filename':function(_0x180184,_0x4a5d33,_0x3aaa18){_0x3aaa18(null,util[_0xed9c('0x18')](_0xed9c('0x19'),'preferred',path['extname'](_0x4a5d33[_0xed9c('0x1b')])));}})});router[_0xed9c('0x1c')](_0xed9c('0x21'),upload[_0xed9c('0x1d')]('file'),controller[_0xed9c('0x22')]);var upload=multer({'storage':multer[_0xed9c('0x14')]({'destination':function(_0x53a9f3,_0x3d1ef4,_0x2a124f){_0x2a124f(null,path[_0xed9c('0x15')](config[_0xed9c('0x16')],_0xed9c('0x17')));},'filename':function(_0x44304a,_0x14bd9f,_0x46bdec){_0x46bdec(null,util[_0xed9c('0x18')](_0xed9c('0x19'),_0xed9c('0x23'),path['extname'](_0x14bd9f[_0xed9c('0x1b')])));}})});router[_0xed9c('0x1c')](_0xed9c('0x12'),upload[_0xed9c('0x1d')](_0xed9c('0x1e')),controller[_0xed9c('0x24')]);router[_0xed9c('0x25')](_0xed9c('0xa'),auth['isAuthenticated'](),controller[_0xed9c('0x26')]);module[_0xed9c('0x27')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 130b909..f1ed9cb 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(_0x4983a5,_0x3051b3){var _0x553103=function(_0x19bed3){while(--_0x19bed3){_0x4983a5['push'](_0x4983a5['shift']());}};_0x553103(++_0x3051b3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'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(_0x4ddf30,_0x143152){var _0x2bc2dd=function(_0x29e356){while(--_0x29e356){_0x4ddf30['push'](_0x4ddf30['shift']());}};_0x2bc2dd(++_0x143152);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'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 696c9d6..62216ce 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 _0x53a2=['query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','type','VIRTUAL','options','includeAll','rows','show','include','find','body','params','file','filename','logo','addLogoLogin','loginLogo','getLogo','server/files/images/logos','preferred','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','join','root','toLower','default','default_logo.svg','existsSync','Sequelize','ValidationError','\x20not\x20found','download','getLicense','favicon','default_loginLogo.svg','upperFirst','gdpr','securePassword','default_preferred.png','custom','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','now','format','send','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','http','request','info','request\x20sent','debug','stringify','error','code','Setting,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','stack','name','index','Setting','rawAttributes','fieldName','model'];(function(_0x2f1457,_0x324953){var _0x33db47=function(_0x55de13){while(--_0x55de13){_0x2f1457['push'](_0x2f1457['shift']());}};_0x33db47(++_0x324953);}(_0x53a2,0x1ab));var _0x253a=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x53a2[_0x3b380d];return _0x54502b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x253a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x253a('0x1'));var rp=require(_0x253a('0x2'));var moment=require(_0x253a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x253a('0x4'));var util=require(_0x253a('0x5'));var path=require(_0x253a('0x6'));var sox=require(_0x253a('0x7'));var csv=require(_0x253a('0x8'));var ejs=require(_0x253a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x253a('0xa'));var squel=require('squel');var crypto=require(_0x253a('0xb'));var jsforce=require(_0x253a('0xc'));var deskjs=require(_0x253a('0xd'));var toCsv=require(_0x253a('0x8'));var querystring=require(_0x253a('0xe'));var Papa=require('papaparse');var Redis=require(_0x253a('0xf'));var authService=require(_0x253a('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x253a('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x253a('0x12'));var utils=require(_0x253a('0x13'));var config=require(_0x253a('0x14'));var licenseUtil=require(_0x253a('0x15'));var db=require('../../mysqldb')['db'];var jayson=require(_0x253a('0x16'));var client=jayson['client'][_0x253a('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x524028,_0x18577d,_0x59a208,_0x2c6888){return new BPromise(function(_0x4f2ed3,_0x165b6a){var _0x1b2a17=_0x2c6888||client;return _0x1b2a17[_0x253a('0x18')](_0x524028,_0x59a208)['then'](function(_0x445479){logger[_0x253a('0x19')]('Setting,\x20%s,\x20%s',_0x18577d,_0x253a('0x1a'));logger[_0x253a('0x1b')]('Setting,\x20%s,\x20%s,\x20%s',_0x18577d,'request\x20sent',JSON[_0x253a('0x1c')](_0x445479));if(_0x445479[_0x253a('0x1d')]){if(_0x445479[_0x253a('0x1d')][_0x253a('0x1e')]===0x1f4){logger[_0x253a('0x1d')](_0x253a('0x1f'),_0x18577d,_0x445479[_0x253a('0x1d')]['message']);return _0x165b6a(_0x445479[_0x253a('0x1d')][_0x253a('0x20')]);}logger[_0x253a('0x1d')]('Setting,\x20%s,\x20%s',_0x18577d,_0x445479['error'][_0x253a('0x20')]);return _0x4f2ed3(_0x445479[_0x253a('0x1d')]['message']);}else{logger[_0x253a('0x19')](_0x253a('0x1f'),_0x18577d,_0x253a('0x1a'));_0x4f2ed3(_0x445479[_0x253a('0x21')]['message']);}})[_0x253a('0x22')](function(_0x3a422e){logger[_0x253a('0x1d')](_0x253a('0x1f'),_0x18577d,_0x3a422e);_0x165b6a(_0x3a422e);});});}function respondWithStatusCode(_0x46917f,_0x3eaded){_0x3eaded=_0x3eaded||0xcc;return function(_0x15ad33){if(_0x15ad33){return _0x46917f[_0x253a('0x23')](_0x3eaded);}return _0x46917f[_0x253a('0x24')](_0x3eaded)[_0x253a('0x25')]();};}function respondWithResult(_0x58eeec,_0x2949b3){_0x2949b3=_0x2949b3||0xc8;return function(_0x36c2eb){if(_0x36c2eb){return _0x58eeec[_0x253a('0x24')](_0x2949b3)['json'](_0x36c2eb);}};}function respondWithFilteredResult(_0x542adb,_0x5bba8b){return function(_0x37c18f){if(_0x37c18f){var _0x537507=typeof _0x5bba8b[_0x253a('0x26')]===_0x253a('0x27')&&typeof _0x5bba8b[_0x253a('0x28')]===_0x253a('0x27');var _0x5b685a=_0x37c18f[_0x253a('0x29')];var _0x3d133f=_0x537507?0x0:_0x5bba8b[_0x253a('0x26')];var _0xb91c5e=_0x537507?_0x37c18f[_0x253a('0x29')]:_0x5bba8b['offset']+_0x5bba8b[_0x253a('0x28')];var _0x1e7d02;if(_0xb91c5e>=_0x5b685a){_0xb91c5e=_0x5b685a;_0x1e7d02=0xc8;}else{_0x1e7d02=0xce;}_0x542adb[_0x253a('0x24')](_0x1e7d02);return _0x542adb[_0x253a('0x2a')](_0x253a('0x2b'),_0x3d133f+'-'+_0xb91c5e+'/'+_0x5b685a)[_0x253a('0x2c')](_0x37c18f);}return null;};}function patchUpdates(_0x3b111c){return function(_0x13b799){try{jsonpatch[_0x253a('0x2d')](_0x13b799,_0x3b111c,!![]);}catch(_0x513a0d){return BPromise[_0x253a('0x2e')](_0x513a0d);}return _0x13b799[_0x253a('0x2f')]();};}function saveUpdates(_0x506d5c,_0x37a46c){return function(_0x3651c1){if(_0x3651c1){return _0x3651c1[_0x253a('0x30')](_0x506d5c)[_0x253a('0x31')](function(_0x3d7cb9){return _0x3d7cb9;});}return null;};}function removeEntity(_0x191594,_0x15e8e0){return function(_0x3e8d61){if(_0x3e8d61){return _0x3e8d61['destroy']()[_0x253a('0x31')](function(){_0x191594[_0x253a('0x24')](0xcc)[_0x253a('0x25')]();});}};}function handleEntityNotFound(_0xc7ed79,_0x425e5f){return function(_0x17f72b){if(!_0x17f72b){_0xc7ed79['sendStatus'](0x194);}return _0x17f72b;};}function handleError(_0x5b02fd,_0x5b4888){_0x5b4888=_0x5b4888||0x1f4;return function(_0x1e3dc8){logger[_0x253a('0x1d')](_0x1e3dc8[_0x253a('0x32')]);if(_0x1e3dc8[_0x253a('0x33')]){delete _0x1e3dc8[_0x253a('0x33')];}_0x5b02fd[_0x253a('0x24')](_0x5b4888)['send'](_0x1e3dc8);};}exports[_0x253a('0x34')]=function(_0xbe4d11,_0x51fed3){var _0x4dbb86={},_0x3cfbe9={},_0x4c3026={'count':0x0,'rows':[]};var _0x2edc5b=_['map'](db[_0x253a('0x35')][_0x253a('0x36')],function(_0x3891cf){return{'name':_0x3891cf[_0x253a('0x37')],'type':_0x3891cf['type']['key']};});_0x3cfbe9[_0x253a('0x38')]=_['map'](_0x2edc5b,_0x253a('0x33'));_0x3cfbe9[_0x253a('0x39')]=_[_0x253a('0x3a')](_0xbe4d11[_0x253a('0x39')]);_0x3cfbe9[_0x253a('0x3b')]=_[_0x253a('0x3c')](_0x3cfbe9[_0x253a('0x38')],_0x3cfbe9[_0x253a('0x39')]);_0x4dbb86[_0x253a('0x3d')]=_[_0x253a('0x3c')](_0x3cfbe9[_0x253a('0x38')],qs['fields'](_0xbe4d11['query'][_0x253a('0x3e')]));_0x4dbb86[_0x253a('0x3d')]=_0x4dbb86[_0x253a('0x3d')][_0x253a('0x3f')]?_0x4dbb86[_0x253a('0x3d')]:_0x3cfbe9['model'];if(!_0xbe4d11[_0x253a('0x39')][_0x253a('0x40')](_0x253a('0x41'))){_0x4dbb86[_0x253a('0x28')]=qs[_0x253a('0x28')](_0xbe4d11[_0x253a('0x39')][_0x253a('0x28')]);_0x4dbb86[_0x253a('0x26')]=qs[_0x253a('0x26')](_0xbe4d11[_0x253a('0x39')]['offset']);}_0x4dbb86[_0x253a('0x42')]=qs[_0x253a('0x43')](_0xbe4d11[_0x253a('0x39')][_0x253a('0x43')]);_0x4dbb86[_0x253a('0x44')]=qs[_0x253a('0x3b')](_[_0x253a('0x45')](_0xbe4d11[_0x253a('0x39')],_0x3cfbe9[_0x253a('0x3b')]),_0x2edc5b);if(_0xbe4d11['query'][_0x253a('0x46')]){_0x4dbb86[_0x253a('0x44')]=_[_0x253a('0x47')](_0x4dbb86[_0x253a('0x44')],{'$or':_[_0x253a('0x48')](_0x2edc5b,function(_0x4c5ab0){if(_0x4c5ab0[_0x253a('0x49')]!==_0x253a('0x4a')){var _0x5db52a={};_0x5db52a[_0x4c5ab0[_0x253a('0x33')]]={'$like':'%'+_0xbe4d11[_0x253a('0x39')][_0x253a('0x46')]+'%'};return _0x5db52a;}})});}_0x4dbb86=_[_0x253a('0x47')]({},_0x4dbb86,_0xbe4d11[_0x253a('0x4b')]);var _0x2b045b={'where':_0x4dbb86[_0x253a('0x44')]};return db[_0x253a('0x35')][_0x253a('0x29')](_0x2b045b)[_0x253a('0x31')](function(_0x401c17){_0x4c3026[_0x253a('0x29')]=_0x401c17;if(_0xbe4d11[_0x253a('0x39')][_0x253a('0x4c')]){_0x4dbb86['include']=[{'all':!![]}];}return db[_0x253a('0x35')]['findAll'](_0x4dbb86);})[_0x253a('0x31')](function(_0x2b1ea6){_0x4c3026[_0x253a('0x4d')]=_0x2b1ea6;return _0x4c3026;})[_0x253a('0x31')](respondWithFilteredResult(_0x51fed3,_0x4dbb86))['catch'](handleError(_0x51fed3,null));};exports[_0x253a('0x4e')]=function(_0x2ec24e,_0x29ae29){var _0x1c4ac8={'raw':![],'where':{'id':_0x2ec24e['params']['id']}},_0x869c25={};_0x869c25['model']=_[_0x253a('0x3a')](db[_0x253a('0x35')][_0x253a('0x36')]);_0x869c25[_0x253a('0x39')]=_['keys'](_0x2ec24e[_0x253a('0x39')]);_0x869c25[_0x253a('0x3b')]=_[_0x253a('0x3c')](_0x869c25[_0x253a('0x38')],_0x869c25['query']);_0x1c4ac8[_0x253a('0x3d')]=_['intersection'](_0x869c25[_0x253a('0x38')],qs[_0x253a('0x3e')](_0x2ec24e[_0x253a('0x39')][_0x253a('0x3e')]));_0x1c4ac8['attributes']=_0x1c4ac8['attributes'][_0x253a('0x3f')]?_0x1c4ac8['attributes']:_0x869c25[_0x253a('0x38')];if(_0x2ec24e['query'][_0x253a('0x4c')]){_0x1c4ac8[_0x253a('0x4f')]=[{'all':!![]}];}_0x1c4ac8=_[_0x253a('0x47')]({},_0x1c4ac8,_0x2ec24e[_0x253a('0x4b')]);return db['Setting'][_0x253a('0x50')](_0x1c4ac8)[_0x253a('0x31')](handleEntityNotFound(_0x29ae29,null))['then'](respondWithResult(_0x29ae29,null))['catch'](handleError(_0x29ae29,null));};exports[_0x253a('0x30')]=function(_0x233909,_0x381fe2){if(_0x233909['body']['id']){delete _0x233909[_0x253a('0x51')]['id'];}return db[_0x253a('0x35')][_0x253a('0x50')]({'where':{'id':_0x233909[_0x253a('0x52')]['id']}})[_0x253a('0x31')](handleEntityNotFound(_0x381fe2,null))[_0x253a('0x31')](saveUpdates(_0x233909['body'],null))[_0x253a('0x31')](respondWithResult(_0x381fe2,null))[_0x253a('0x22')](handleError(_0x381fe2,null));};exports['addLogo']=function(_0x3f974c,_0x281203,_0x55ed5f){if(_0x3f974c[_0x253a('0x53')]&&_0x3f974c['file'][_0x253a('0x54')]){_0x3f974c[_0x253a('0x51')][_0x253a('0x55')]=_0x3f974c[_0x253a('0x53')][_0x253a('0x54')];}return db['Setting'][_0x253a('0x50')]({'where':{'id':_0x3f974c[_0x253a('0x52')]['id']}})[_0x253a('0x31')](handleEntityNotFound(_0x281203,null))[_0x253a('0x31')](saveUpdates(_0x3f974c[_0x253a('0x51')],null))[_0x253a('0x31')](respondWithResult(_0x281203,null))['catch'](handleError(_0x281203,null));};exports[_0x253a('0x56')]=function(_0x54a684,_0x29d5af,_0x32e604){if(_0x54a684[_0x253a('0x53')]&&_0x54a684[_0x253a('0x53')][_0x253a('0x54')]){_0x54a684['body'][_0x253a('0x57')]=_0x54a684[_0x253a('0x53')][_0x253a('0x54')];}return db[_0x253a('0x35')][_0x253a('0x50')]({'where':{'id':_0x54a684['params']['id']}})[_0x253a('0x31')](handleEntityNotFound(_0x29d5af,null))[_0x253a('0x31')](saveUpdates(_0x54a684[_0x253a('0x51')],null))[_0x253a('0x31')](respondWithResult(_0x29d5af,null))[_0x253a('0x22')](handleError(_0x29d5af,null));};var utilLicense=require(_0x253a('0x15'));exports[_0x253a('0x58')]=function(_0x1f3025,_0x7e4f63,_0x38e57b){var _0x51de54=_0x253a('0x59');var _0x10a2b1={'custom':![]};return utilLicense['getLicense']()[_0x253a('0x31')](function(_0x2e9959){if(_0x2e9959){_0x10a2b1=_0x2e9959;}return db[_0x253a('0x35')][_0x253a('0x50')]({'where':{'id':_0x1f3025['params']['id']},'attributes':['logo',_0x253a('0x57'),_0x253a('0x5a'),'favicon',_0x253a('0x5b'),_0x253a('0x5c'),_0x253a('0x5d'),_0x253a('0x5e')],'raw':!![]});})['then'](handleEntityNotFound(_0x7e4f63,null))[_0x253a('0x31')](function(_0x215344){if(_0x215344){var _0x20636c=_0x215344['logo']&&fs['existsSync'](path[_0x253a('0x5f')](config[_0x253a('0x60')],_0x51de54,_[_0x253a('0x61')](_0x215344[_0x253a('0x55')])))?path['join'](config[_0x253a('0x60')],_0x51de54,_[_0x253a('0x61')](_0x215344[_0x253a('0x55')])):path[_0x253a('0x5f')](config['root'],_0x51de54,_[_0x253a('0x61')]('default_logo.svg'));var _0x1cfeaf=_0x253a('0x62')+_['upperFirst'](_0x253a('0x55'));if(_0x215344[_0x1cfeaf]||!_0x10a2b1['custom']){_0x20636c=path[_0x253a('0x5f')](config['root'],_0x51de54,_[_0x253a('0x61')](_0x253a('0x63')));}if(!fs[_0x253a('0x64')](_0x20636c)){throw new db[(_0x253a('0x65'))][(_0x253a('0x66'))](_['upperFirst'](_0x253a('0x55'))+_0x253a('0x67'));}return _0x7e4f63[_0x253a('0x68')](_0x20636c);}})[_0x253a('0x22')](handleError(_0x7e4f63,null));};var utilLicense=require(_0x253a('0x15'));exports['getLogoLogin']=function(_0x6bb6ae,_0x126084,_0x200edd){var _0x3fd5e3=_0x253a('0x59');var _0x3ca37d={'custom':![]};return utilLicense[_0x253a('0x69')]()[_0x253a('0x31')](function(_0x29f834){if(_0x29f834){_0x3ca37d=_0x29f834;}return db[_0x253a('0x35')][_0x253a('0x50')]({'where':{'id':_0x6bb6ae['params']['id']},'attributes':[_0x253a('0x55'),_0x253a('0x57'),'preferred',_0x253a('0x6a'),'defaultLogo',_0x253a('0x5c'),'defaultPreferred',_0x253a('0x5e')],'raw':!![]});})['then'](handleEntityNotFound(_0x126084,null))[_0x253a('0x31')](function(_0x76bdfe){if(_0x76bdfe){var _0x4e9729=_0x76bdfe[_0x253a('0x57')]&&fs['existsSync'](path[_0x253a('0x5f')](config[_0x253a('0x60')],_0x3fd5e3,_[_0x253a('0x61')](_0x76bdfe[_0x253a('0x57')])))?path['join'](config['root'],_0x3fd5e3,_[_0x253a('0x61')](_0x76bdfe['loginLogo'])):path['join'](config['root'],_0x3fd5e3,_['toLower'](_0x253a('0x6b')));var _0x26c5af=_0x253a('0x62')+_[_0x253a('0x6c')](_0x253a('0x57'));if(_0x76bdfe[_0x26c5af]||!_0x3ca37d['custom']){_0x4e9729=path[_0x253a('0x5f')](config[_0x253a('0x60')],_0x3fd5e3,_['toLower'](_0x253a('0x6b')));}if(!fs[_0x253a('0x64')](_0x4e9729)){throw new db[(_0x253a('0x65'))][(_0x253a('0x66'))](_[_0x253a('0x6c')]('loginLogo')+_0x253a('0x67'));}return _0x126084[_0x253a('0x68')](_0x4e9729);}})[_0x253a('0x22')](handleError(_0x126084,null));};exports[_0x253a('0x6d')]=function(_0x17aefb,_0xc1155a){return db['Setting'][_0x253a('0x50')]({'where':{'id':_0x17aefb['params']['id']},'attributes':[_0x253a('0x6e')]})[_0x253a('0x31')](respondWithResult(_0xc1155a,null))[_0x253a('0x22')](handleError(_0xc1155a,null));};exports['addPreferred']=function(_0x5b5bae,_0x256103,_0x1ccd27){if(_0x5b5bae[_0x253a('0x53')]&&_0x5b5bae[_0x253a('0x53')]['filename']){_0x5b5bae[_0x253a('0x51')][_0x253a('0x5a')]=_0x5b5bae[_0x253a('0x53')][_0x253a('0x54')];}return db[_0x253a('0x35')][_0x253a('0x50')]({'where':{'id':_0x5b5bae[_0x253a('0x52')]['id']}})[_0x253a('0x31')](handleEntityNotFound(_0x256103,null))[_0x253a('0x31')](saveUpdates(_0x5b5bae['body'],null))[_0x253a('0x31')](respondWithResult(_0x256103,null))['catch'](handleError(_0x256103,null));};var utilLicense=require(_0x253a('0x15'));exports['getPreferred']=function(_0xe8d230,_0x49b617,_0x26747d){var _0x42cf25='server/files/images/logos';var _0x5cd4d7={'custom':![]};return utilLicense[_0x253a('0x69')]()[_0x253a('0x31')](function(_0xe564e1){if(_0xe564e1){_0x5cd4d7=_0xe564e1;}return db[_0x253a('0x35')][_0x253a('0x50')]({'where':{'id':_0xe8d230[_0x253a('0x52')]['id']},'attributes':['logo',_0x253a('0x57'),_0x253a('0x5a'),_0x253a('0x6a'),'defaultLogo',_0x253a('0x5c'),_0x253a('0x5d'),_0x253a('0x5e')],'raw':!![]});})[_0x253a('0x31')](handleEntityNotFound(_0x49b617,null))['then'](function(_0x41c610){if(_0x41c610){var _0x5ce6dc=_0x41c610[_0x253a('0x5a')]&&fs['existsSync'](path[_0x253a('0x5f')](config[_0x253a('0x60')],_0x42cf25,_[_0x253a('0x61')](_0x41c610[_0x253a('0x5a')])))?path[_0x253a('0x5f')](config[_0x253a('0x60')],_0x42cf25,_[_0x253a('0x61')](_0x41c610[_0x253a('0x5a')])):path[_0x253a('0x5f')](config[_0x253a('0x60')],_0x42cf25,_['toLower'](_0x253a('0x6f')));var _0x3c56db=_0x253a('0x62')+_[_0x253a('0x6c')](_0x253a('0x5a'));if(_0x41c610[_0x3c56db]||!_0x5cd4d7[_0x253a('0x70')]||!_0x5cd4d7[_0x253a('0x5a')]){_0x5ce6dc=path[_0x253a('0x5f')](config['root'],_0x42cf25,_[_0x253a('0x61')](_0x253a('0x6f')));}if(!fs[_0x253a('0x64')](_0x5ce6dc)){throw new db[(_0x253a('0x65'))][(_0x253a('0x66'))](_[_0x253a('0x6c')](_0x253a('0x5a'))+_0x253a('0x67'));}return _0x49b617[_0x253a('0x68')](_0x5ce6dc);}})[_0x253a('0x22')](handleError(_0x49b617,null));};exports[_0x253a('0x71')]=function(_0x39dc80,_0x5e369b,_0x14b6b2){if(_0x39dc80[_0x253a('0x53')]&&_0x39dc80['file'][_0x253a('0x54')]){_0x39dc80[_0x253a('0x51')][_0x253a('0x6a')]=_0x39dc80[_0x253a('0x53')][_0x253a('0x54')];}return db['Setting'][_0x253a('0x50')]({'where':{'id':_0x39dc80[_0x253a('0x52')]['id']}})['then'](handleEntityNotFound(_0x5e369b,null))['then'](saveUpdates(_0x39dc80[_0x253a('0x51')],null))[_0x253a('0x31')](respondWithResult(_0x5e369b,null))[_0x253a('0x22')](handleError(_0x5e369b,null));};var utilLicense=require(_0x253a('0x15'));exports[_0x253a('0x72')]=function(_0x27346,_0x202aaf,_0x474f74){var _0x481462=_0x253a('0x59');var _0x51042d={'custom':![]};return utilLicense[_0x253a('0x69')]()[_0x253a('0x31')](function(_0x3355ed){if(_0x3355ed){_0x51042d=_0x3355ed;}return db[_0x253a('0x35')][_0x253a('0x50')]({'where':{'id':_0x27346['params']['id']},'attributes':[_0x253a('0x55'),_0x253a('0x57'),_0x253a('0x5a'),_0x253a('0x6a'),_0x253a('0x5b'),_0x253a('0x5c'),'defaultPreferred',_0x253a('0x5e')],'raw':!![]});})['then'](handleEntityNotFound(_0x202aaf,null))['then'](function(_0x5c0d04){if(_0x5c0d04){var _0x3a14b1=_0x5c0d04[_0x253a('0x6a')]&&fs[_0x253a('0x64')](path[_0x253a('0x5f')](config['root'],_0x481462,_['toLower'](_0x5c0d04[_0x253a('0x6a')])))?path[_0x253a('0x5f')](config[_0x253a('0x60')],_0x481462,_[_0x253a('0x61')](_0x5c0d04[_0x253a('0x6a')])):path[_0x253a('0x5f')](config[_0x253a('0x60')],_0x481462,_['toLower'](_0x253a('0x73')));var _0x21c9e6=_0x253a('0x62')+_[_0x253a('0x6c')]('favicon');if(_0x5c0d04[_0x21c9e6]||!_0x51042d[_0x253a('0x70')]){_0x3a14b1=path['join'](config['root'],_0x481462,_[_0x253a('0x61')](_0x253a('0x73')));}if(!fs[_0x253a('0x64')](_0x3a14b1)){throw new db[(_0x253a('0x65'))][(_0x253a('0x66'))](_[_0x253a('0x6c')]('favicon')+_0x253a('0x67'));}return _0x202aaf[_0x253a('0x68')](_0x3a14b1);}})[_0x253a('0x22')](handleError(_0x202aaf,null));};exports[_0x253a('0x74')]=function(_0x17c5e1,_0x1967a6){var _0x41b7ce={'offset':moment()[_0x253a('0x75')]()};_0x41b7ce[_0x253a('0x76')]=moment()[_0x253a('0x75')](_0x41b7ce[_0x253a('0x26')])[_0x253a('0x77')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x1967a6[_0x253a('0x24')](0xc8)[_0x253a('0x78')](_0x41b7ce);}; \ No newline at end of file +var _0xbaad=['sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','jayson/promise','client','http','request','then','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','catch','sendStatus','status','json','offset','undefined','limit','count','apply','reject','save','update','end','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','Setting','includeAll','include','findAll','rows','show','params','find','body','addLogo','filename','logo','file','addLogoLogin','loginLogo','../../config/license/util','getLogo','server/files/images/logos','preferred','favicon','defaultLogo','defaultLoginLogo','defaultFavicon','existsSync','root','toLower','join','default_logo.svg','default','upperFirst','custom','Sequelize','download','getLicense','defaultPreferred','default_loginLogo.svg','ValidationError','\x20not\x20found','gdpr','securePassword','addPreferred','getPreferred','default_preferred.png','addFavicon','default_favicon.ico','utcOffset','now','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x3f8d1e,_0x115971){var _0x3c4564=function(_0xe62f70){while(--_0xe62f70){_0x3f8d1e['push'](_0x3f8d1e['shift']());}};_0x3c4564(++_0x115971);}(_0xbaad,0x1e6));var _0xdbaa=function(_0x352f0d,_0xfcc11a){_0x352f0d=_0x352f0d-0x0;var _0x250f40=_0xbaad[_0x352f0d];return _0x250f40;};'use strict';var emlformat=require(_0xdbaa('0x0'));var rimraf=require(_0xdbaa('0x1'));var zipdir=require(_0xdbaa('0x2'));var jsonpatch=require(_0xdbaa('0x3'));var rp=require(_0xdbaa('0x4'));var moment=require(_0xdbaa('0x5'));var BPromise=require(_0xdbaa('0x6'));var Mustache=require(_0xdbaa('0x7'));var util=require(_0xdbaa('0x8'));var path=require(_0xdbaa('0x9'));var sox=require(_0xdbaa('0xa'));var csv=require(_0xdbaa('0xb'));var ejs=require(_0xdbaa('0xc'));var fs=require('fs');var fs_extra=require(_0xdbaa('0xd'));var _=require(_0xdbaa('0xe'));var squel=require('squel');var crypto=require(_0xdbaa('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xdbaa('0x10'));var toCsv=require(_0xdbaa('0xb'));var querystring=require('querystring');var Papa=require(_0xdbaa('0x11'));var Redis=require('ioredis');var authService=require(_0xdbaa('0x12'));var qs=require(_0xdbaa('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdbaa('0x14'));var logger=require(_0xdbaa('0x15'))(_0xdbaa('0x16'));var utils=require('../../config/utils');var config=require(_0xdbaa('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require(_0xdbaa('0x18'));var client=jayson[_0xdbaa('0x19')][_0xdbaa('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x1e532e,_0x28c921,_0x428da9,_0x38a53e){return new BPromise(function(_0x1e2b0b,_0x20958d){var _0x27e2a4=_0x38a53e||client;return _0x27e2a4[_0xdbaa('0x1b')](_0x1e532e,_0x428da9)[_0xdbaa('0x1c')](function(_0x24df88){logger['info'](_0xdbaa('0x1d'),_0x28c921,_0xdbaa('0x1e'));logger[_0xdbaa('0x1f')](_0xdbaa('0x20'),_0x28c921,_0xdbaa('0x1e'),JSON[_0xdbaa('0x21')](_0x24df88));if(_0x24df88['error']){if(_0x24df88['error'][_0xdbaa('0x22')]===0x1f4){logger['error'](_0xdbaa('0x1d'),_0x28c921,_0x24df88[_0xdbaa('0x23')][_0xdbaa('0x24')]);return _0x20958d(_0x24df88[_0xdbaa('0x23')]['message']);}logger['error'](_0xdbaa('0x1d'),_0x28c921,_0x24df88[_0xdbaa('0x23')][_0xdbaa('0x24')]);return _0x1e2b0b(_0x24df88['error'][_0xdbaa('0x24')]);}else{logger[_0xdbaa('0x25')](_0xdbaa('0x1d'),_0x28c921,'request\x20sent');_0x1e2b0b(_0x24df88['result'][_0xdbaa('0x24')]);}})[_0xdbaa('0x26')](function(_0x47286b){logger[_0xdbaa('0x23')](_0xdbaa('0x1d'),_0x28c921,_0x47286b);_0x20958d(_0x47286b);});});}function respondWithStatusCode(_0x187d20,_0x5536b5){_0x5536b5=_0x5536b5||0xcc;return function(_0x17fecb){if(_0x17fecb){return _0x187d20[_0xdbaa('0x27')](_0x5536b5);}return _0x187d20['status'](_0x5536b5)['end']();};}function respondWithResult(_0x415232,_0x53d449){_0x53d449=_0x53d449||0xc8;return function(_0x16829d){if(_0x16829d){return _0x415232[_0xdbaa('0x28')](_0x53d449)[_0xdbaa('0x29')](_0x16829d);}};}function respondWithFilteredResult(_0x35736f,_0x494276){return function(_0x41aaae){if(_0x41aaae){var _0x2ac5c3=typeof _0x494276[_0xdbaa('0x2a')]===_0xdbaa('0x2b')&&typeof _0x494276[_0xdbaa('0x2c')]===_0xdbaa('0x2b');var _0x33b648=_0x41aaae[_0xdbaa('0x2d')];var _0xd96b6c=_0x2ac5c3?0x0:_0x494276[_0xdbaa('0x2a')];var _0x16be95=_0x2ac5c3?_0x41aaae[_0xdbaa('0x2d')]:_0x494276['offset']+_0x494276['limit'];var _0x259d56;if(_0x16be95>=_0x33b648){_0x16be95=_0x33b648;_0x259d56=0xc8;}else{_0x259d56=0xce;}_0x35736f[_0xdbaa('0x28')](_0x259d56);return _0x35736f['set']('Content-Range',_0xd96b6c+'-'+_0x16be95+'/'+_0x33b648)[_0xdbaa('0x29')](_0x41aaae);}return null;};}function patchUpdates(_0x4fa4e9){return function(_0x7852c4){try{jsonpatch[_0xdbaa('0x2e')](_0x7852c4,_0x4fa4e9,!![]);}catch(_0x58ebe5){return BPromise[_0xdbaa('0x2f')](_0x58ebe5);}return _0x7852c4[_0xdbaa('0x30')]();};}function saveUpdates(_0x289166,_0x1a8715){return function(_0x8ea051){if(_0x8ea051){return _0x8ea051[_0xdbaa('0x31')](_0x289166)[_0xdbaa('0x1c')](function(_0x29e7b4){return _0x29e7b4;});}return null;};}function removeEntity(_0x3343cb,_0x41e682){return function(_0x5db6d4){if(_0x5db6d4){return _0x5db6d4['destroy']()['then'](function(){_0x3343cb[_0xdbaa('0x28')](0xcc)[_0xdbaa('0x32')]();});}};}function handleEntityNotFound(_0x286173,_0x3a6bb2){return function(_0x52b063){if(!_0x52b063){_0x286173[_0xdbaa('0x27')](0x194);}return _0x52b063;};}function handleError(_0x5046fc,_0x2aead0){_0x2aead0=_0x2aead0||0x1f4;return function(_0x414c2c){logger[_0xdbaa('0x23')](_0x414c2c['stack']);if(_0x414c2c['name']){delete _0x414c2c[_0xdbaa('0x33')];}_0x5046fc[_0xdbaa('0x28')](_0x2aead0)[_0xdbaa('0x34')](_0x414c2c);};}exports[_0xdbaa('0x35')]=function(_0x22232d,_0xc80305){var _0x4efe98={},_0x30c62f={},_0x4c3c04={'count':0x0,'rows':[]};var _0x24265e=_[_0xdbaa('0x36')](db['Setting'][_0xdbaa('0x37')],function(_0x13720c){return{'name':_0x13720c[_0xdbaa('0x38')],'type':_0x13720c[_0xdbaa('0x39')][_0xdbaa('0x3a')]};});_0x30c62f['model']=_[_0xdbaa('0x36')](_0x24265e,_0xdbaa('0x33'));_0x30c62f[_0xdbaa('0x3b')]=_[_0xdbaa('0x3c')](_0x22232d['query']);_0x30c62f[_0xdbaa('0x3d')]=_[_0xdbaa('0x3e')](_0x30c62f[_0xdbaa('0x3f')],_0x30c62f[_0xdbaa('0x3b')]);_0x4efe98['attributes']=_['intersection'](_0x30c62f[_0xdbaa('0x3f')],qs[_0xdbaa('0x40')](_0x22232d[_0xdbaa('0x3b')][_0xdbaa('0x40')]));_0x4efe98[_0xdbaa('0x41')]=_0x4efe98['attributes'][_0xdbaa('0x42')]?_0x4efe98[_0xdbaa('0x41')]:_0x30c62f['model'];if(!_0x22232d[_0xdbaa('0x3b')][_0xdbaa('0x43')](_0xdbaa('0x44'))){_0x4efe98[_0xdbaa('0x2c')]=qs[_0xdbaa('0x2c')](_0x22232d[_0xdbaa('0x3b')][_0xdbaa('0x2c')]);_0x4efe98[_0xdbaa('0x2a')]=qs[_0xdbaa('0x2a')](_0x22232d[_0xdbaa('0x3b')]['offset']);}_0x4efe98[_0xdbaa('0x45')]=qs[_0xdbaa('0x46')](_0x22232d[_0xdbaa('0x3b')][_0xdbaa('0x46')]);_0x4efe98['where']=qs[_0xdbaa('0x3d')](_[_0xdbaa('0x47')](_0x22232d['query'],_0x30c62f[_0xdbaa('0x3d')]),_0x24265e);if(_0x22232d[_0xdbaa('0x3b')][_0xdbaa('0x48')]){_0x4efe98[_0xdbaa('0x49')]=_[_0xdbaa('0x4a')](_0x4efe98[_0xdbaa('0x49')],{'$or':_[_0xdbaa('0x36')](_0x24265e,function(_0xfcfc52){if(_0xfcfc52[_0xdbaa('0x39')]!=='VIRTUAL'){var _0x2e86ef={};_0x2e86ef[_0xfcfc52[_0xdbaa('0x33')]]={'$like':'%'+_0x22232d[_0xdbaa('0x3b')][_0xdbaa('0x48')]+'%'};return _0x2e86ef;}})});}_0x4efe98=_[_0xdbaa('0x4a')]({},_0x4efe98,_0x22232d[_0xdbaa('0x4b')]);var _0x117d5c={'where':_0x4efe98[_0xdbaa('0x49')]};return db[_0xdbaa('0x4c')]['count'](_0x117d5c)[_0xdbaa('0x1c')](function(_0x3c0bc3){_0x4c3c04[_0xdbaa('0x2d')]=_0x3c0bc3;if(_0x22232d['query'][_0xdbaa('0x4d')]){_0x4efe98[_0xdbaa('0x4e')]=[{'all':!![]}];}return db['Setting'][_0xdbaa('0x4f')](_0x4efe98);})[_0xdbaa('0x1c')](function(_0x2ed20c){_0x4c3c04[_0xdbaa('0x50')]=_0x2ed20c;return _0x4c3c04;})[_0xdbaa('0x1c')](respondWithFilteredResult(_0xc80305,_0x4efe98))[_0xdbaa('0x26')](handleError(_0xc80305,null));};exports[_0xdbaa('0x51')]=function(_0x542af6,_0x3b61b6){var _0x34a046={'raw':![],'where':{'id':_0x542af6[_0xdbaa('0x52')]['id']}},_0x4488f6={};_0x4488f6['model']=_[_0xdbaa('0x3c')](db[_0xdbaa('0x4c')][_0xdbaa('0x37')]);_0x4488f6[_0xdbaa('0x3b')]=_[_0xdbaa('0x3c')](_0x542af6[_0xdbaa('0x3b')]);_0x4488f6[_0xdbaa('0x3d')]=_[_0xdbaa('0x3e')](_0x4488f6[_0xdbaa('0x3f')],_0x4488f6['query']);_0x34a046['attributes']=_['intersection'](_0x4488f6[_0xdbaa('0x3f')],qs[_0xdbaa('0x40')](_0x542af6[_0xdbaa('0x3b')][_0xdbaa('0x40')]));_0x34a046[_0xdbaa('0x41')]=_0x34a046[_0xdbaa('0x41')][_0xdbaa('0x42')]?_0x34a046[_0xdbaa('0x41')]:_0x4488f6[_0xdbaa('0x3f')];if(_0x542af6[_0xdbaa('0x3b')][_0xdbaa('0x4d')]){_0x34a046[_0xdbaa('0x4e')]=[{'all':!![]}];}_0x34a046=_['merge']({},_0x34a046,_0x542af6[_0xdbaa('0x4b')]);return db[_0xdbaa('0x4c')][_0xdbaa('0x53')](_0x34a046)[_0xdbaa('0x1c')](handleEntityNotFound(_0x3b61b6,null))['then'](respondWithResult(_0x3b61b6,null))['catch'](handleError(_0x3b61b6,null));};exports['update']=function(_0x26b042,_0xb9380c){if(_0x26b042['body']['id']){delete _0x26b042[_0xdbaa('0x54')]['id'];}return db[_0xdbaa('0x4c')][_0xdbaa('0x53')]({'where':{'id':_0x26b042[_0xdbaa('0x52')]['id']}})['then'](handleEntityNotFound(_0xb9380c,null))[_0xdbaa('0x1c')](saveUpdates(_0x26b042[_0xdbaa('0x54')],null))['then'](respondWithResult(_0xb9380c,null))['catch'](handleError(_0xb9380c,null));};exports[_0xdbaa('0x55')]=function(_0x48547a,_0xabae7f,_0x49f0f6){if(_0x48547a['file']&&_0x48547a['file'][_0xdbaa('0x56')]){_0x48547a[_0xdbaa('0x54')][_0xdbaa('0x57')]=_0x48547a[_0xdbaa('0x58')][_0xdbaa('0x56')];}return db['Setting'][_0xdbaa('0x53')]({'where':{'id':_0x48547a[_0xdbaa('0x52')]['id']}})['then'](handleEntityNotFound(_0xabae7f,null))[_0xdbaa('0x1c')](saveUpdates(_0x48547a[_0xdbaa('0x54')],null))[_0xdbaa('0x1c')](respondWithResult(_0xabae7f,null))[_0xdbaa('0x26')](handleError(_0xabae7f,null));};exports[_0xdbaa('0x59')]=function(_0x5bd5c3,_0xebb229,_0x2e802f){if(_0x5bd5c3['file']&&_0x5bd5c3[_0xdbaa('0x58')][_0xdbaa('0x56')]){_0x5bd5c3[_0xdbaa('0x54')][_0xdbaa('0x5a')]=_0x5bd5c3['file'][_0xdbaa('0x56')];}return db[_0xdbaa('0x4c')][_0xdbaa('0x53')]({'where':{'id':_0x5bd5c3[_0xdbaa('0x52')]['id']}})[_0xdbaa('0x1c')](handleEntityNotFound(_0xebb229,null))[_0xdbaa('0x1c')](saveUpdates(_0x5bd5c3['body'],null))['then'](respondWithResult(_0xebb229,null))[_0xdbaa('0x26')](handleError(_0xebb229,null));};var utilLicense=require(_0xdbaa('0x5b'));exports[_0xdbaa('0x5c')]=function(_0xce47e0,_0x1e85d4,_0x595bf3){var _0x4bad4d=_0xdbaa('0x5d');var _0x23cbb7={'custom':![]};return utilLicense['getLicense']()[_0xdbaa('0x1c')](function(_0xd7edc8){if(_0xd7edc8){_0x23cbb7=_0xd7edc8;}return db[_0xdbaa('0x4c')][_0xdbaa('0x53')]({'where':{'id':_0xce47e0[_0xdbaa('0x52')]['id']},'attributes':[_0xdbaa('0x57'),'loginLogo',_0xdbaa('0x5e'),_0xdbaa('0x5f'),_0xdbaa('0x60'),_0xdbaa('0x61'),'defaultPreferred',_0xdbaa('0x62')],'raw':!![]});})[_0xdbaa('0x1c')](handleEntityNotFound(_0x1e85d4,null))[_0xdbaa('0x1c')](function(_0x40745f){if(_0x40745f){var _0x1abf8b=_0x40745f[_0xdbaa('0x57')]&&fs[_0xdbaa('0x63')](path['join'](config[_0xdbaa('0x64')],_0x4bad4d,_[_0xdbaa('0x65')](_0x40745f['logo'])))?path[_0xdbaa('0x66')](config[_0xdbaa('0x64')],_0x4bad4d,_['toLower'](_0x40745f[_0xdbaa('0x57')])):path['join'](config[_0xdbaa('0x64')],_0x4bad4d,_[_0xdbaa('0x65')](_0xdbaa('0x67')));var _0x3336bf=_0xdbaa('0x68')+_[_0xdbaa('0x69')]('logo');if(_0x40745f[_0x3336bf]||!_0x23cbb7[_0xdbaa('0x6a')]){_0x1abf8b=path[_0xdbaa('0x66')](config[_0xdbaa('0x64')],_0x4bad4d,_['toLower'](_0xdbaa('0x67')));}if(!fs['existsSync'](_0x1abf8b)){throw new db[(_0xdbaa('0x6b'))]['ValidationError'](_[_0xdbaa('0x69')](_0xdbaa('0x57'))+'\x20not\x20found');}return _0x1e85d4[_0xdbaa('0x6c')](_0x1abf8b);}})[_0xdbaa('0x26')](handleError(_0x1e85d4,null));};var utilLicense=require('../../config/license/util');exports['getLogoLogin']=function(_0xda50d1,_0x5e71d7,_0x414082){var _0x5a5273=_0xdbaa('0x5d');var _0x100394={'custom':![]};return utilLicense[_0xdbaa('0x6d')]()[_0xdbaa('0x1c')](function(_0x34761d){if(_0x34761d){_0x100394=_0x34761d;}return db['Setting'][_0xdbaa('0x53')]({'where':{'id':_0xda50d1['params']['id']},'attributes':[_0xdbaa('0x57'),_0xdbaa('0x5a'),_0xdbaa('0x5e'),_0xdbaa('0x5f'),_0xdbaa('0x60'),_0xdbaa('0x61'),_0xdbaa('0x6e'),_0xdbaa('0x62')],'raw':!![]});})[_0xdbaa('0x1c')](handleEntityNotFound(_0x5e71d7,null))[_0xdbaa('0x1c')](function(_0x116a12){if(_0x116a12){var _0x274622=_0x116a12[_0xdbaa('0x5a')]&&fs[_0xdbaa('0x63')](path['join'](config[_0xdbaa('0x64')],_0x5a5273,_['toLower'](_0x116a12[_0xdbaa('0x5a')])))?path[_0xdbaa('0x66')](config[_0xdbaa('0x64')],_0x5a5273,_[_0xdbaa('0x65')](_0x116a12[_0xdbaa('0x5a')])):path[_0xdbaa('0x66')](config['root'],_0x5a5273,_[_0xdbaa('0x65')](_0xdbaa('0x6f')));var _0x44a16c='default'+_[_0xdbaa('0x69')](_0xdbaa('0x5a'));if(_0x116a12[_0x44a16c]||!_0x100394['custom']){_0x274622=path[_0xdbaa('0x66')](config['root'],_0x5a5273,_[_0xdbaa('0x65')]('default_loginLogo.svg'));}if(!fs['existsSync'](_0x274622)){throw new db['Sequelize'][(_0xdbaa('0x70'))](_[_0xdbaa('0x69')]('loginLogo')+_0xdbaa('0x71'));}return _0x5e71d7[_0xdbaa('0x6c')](_0x274622);}})['catch'](handleError(_0x5e71d7,null));};exports[_0xdbaa('0x72')]=function(_0x37869f,_0x479a56){return db[_0xdbaa('0x4c')]['find']({'where':{'id':_0x37869f[_0xdbaa('0x52')]['id']},'attributes':[_0xdbaa('0x73')]})[_0xdbaa('0x1c')](respondWithResult(_0x479a56,null))[_0xdbaa('0x26')](handleError(_0x479a56,null));};exports[_0xdbaa('0x74')]=function(_0x3f7f26,_0xa91b0b,_0x35d8ca){if(_0x3f7f26[_0xdbaa('0x58')]&&_0x3f7f26[_0xdbaa('0x58')][_0xdbaa('0x56')]){_0x3f7f26[_0xdbaa('0x54')][_0xdbaa('0x5e')]=_0x3f7f26[_0xdbaa('0x58')][_0xdbaa('0x56')];}return db['Setting'][_0xdbaa('0x53')]({'where':{'id':_0x3f7f26['params']['id']}})['then'](handleEntityNotFound(_0xa91b0b,null))[_0xdbaa('0x1c')](saveUpdates(_0x3f7f26[_0xdbaa('0x54')],null))[_0xdbaa('0x1c')](respondWithResult(_0xa91b0b,null))[_0xdbaa('0x26')](handleError(_0xa91b0b,null));};var utilLicense=require('../../config/license/util');exports[_0xdbaa('0x75')]=function(_0x6d41d6,_0x2af652,_0x458e9d){var _0x2c1ec3=_0xdbaa('0x5d');var _0x326cd7={'custom':![]};return utilLicense[_0xdbaa('0x6d')]()[_0xdbaa('0x1c')](function(_0x9f977b){if(_0x9f977b){_0x326cd7=_0x9f977b;}return db[_0xdbaa('0x4c')][_0xdbaa('0x53')]({'where':{'id':_0x6d41d6[_0xdbaa('0x52')]['id']},'attributes':['logo',_0xdbaa('0x5a'),_0xdbaa('0x5e'),_0xdbaa('0x5f'),_0xdbaa('0x60'),_0xdbaa('0x61'),'defaultPreferred',_0xdbaa('0x62')],'raw':!![]});})['then'](handleEntityNotFound(_0x2af652,null))[_0xdbaa('0x1c')](function(_0x1336e0){if(_0x1336e0){var _0x1810f1=_0x1336e0[_0xdbaa('0x5e')]&&fs[_0xdbaa('0x63')](path['join'](config[_0xdbaa('0x64')],_0x2c1ec3,_[_0xdbaa('0x65')](_0x1336e0[_0xdbaa('0x5e')])))?path[_0xdbaa('0x66')](config[_0xdbaa('0x64')],_0x2c1ec3,_[_0xdbaa('0x65')](_0x1336e0['preferred'])):path[_0xdbaa('0x66')](config[_0xdbaa('0x64')],_0x2c1ec3,_[_0xdbaa('0x65')](_0xdbaa('0x76')));var _0x5d421f=_0xdbaa('0x68')+_[_0xdbaa('0x69')]('preferred');if(_0x1336e0[_0x5d421f]||!_0x326cd7['custom']||!_0x326cd7['preferred']){_0x1810f1=path[_0xdbaa('0x66')](config[_0xdbaa('0x64')],_0x2c1ec3,_[_0xdbaa('0x65')]('default_preferred.png'));}if(!fs[_0xdbaa('0x63')](_0x1810f1)){throw new db[(_0xdbaa('0x6b'))][(_0xdbaa('0x70'))](_['upperFirst']('preferred')+_0xdbaa('0x71'));}return _0x2af652[_0xdbaa('0x6c')](_0x1810f1);}})['catch'](handleError(_0x2af652,null));};exports[_0xdbaa('0x77')]=function(_0x18a701,_0x4d33ae,_0x377322){if(_0x18a701[_0xdbaa('0x58')]&&_0x18a701['file']['filename']){_0x18a701[_0xdbaa('0x54')][_0xdbaa('0x5f')]=_0x18a701['file'][_0xdbaa('0x56')];}return db['Setting'][_0xdbaa('0x53')]({'where':{'id':_0x18a701[_0xdbaa('0x52')]['id']}})[_0xdbaa('0x1c')](handleEntityNotFound(_0x4d33ae,null))[_0xdbaa('0x1c')](saveUpdates(_0x18a701['body'],null))['then'](respondWithResult(_0x4d33ae,null))['catch'](handleError(_0x4d33ae,null));};var utilLicense=require(_0xdbaa('0x5b'));exports['getFavicon']=function(_0x5200ed,_0x2a912d,_0x2991cd){var _0x34aed8=_0xdbaa('0x5d');var _0x105cea={'custom':![]};return utilLicense[_0xdbaa('0x6d')]()['then'](function(_0x2965a6){if(_0x2965a6){_0x105cea=_0x2965a6;}return db['Setting'][_0xdbaa('0x53')]({'where':{'id':_0x5200ed[_0xdbaa('0x52')]['id']},'attributes':[_0xdbaa('0x57'),'loginLogo',_0xdbaa('0x5e'),_0xdbaa('0x5f'),_0xdbaa('0x60'),'defaultLoginLogo',_0xdbaa('0x6e'),_0xdbaa('0x62')],'raw':!![]});})[_0xdbaa('0x1c')](handleEntityNotFound(_0x2a912d,null))[_0xdbaa('0x1c')](function(_0x25afcd){if(_0x25afcd){var _0x78abc4=_0x25afcd[_0xdbaa('0x5f')]&&fs[_0xdbaa('0x63')](path[_0xdbaa('0x66')](config[_0xdbaa('0x64')],_0x34aed8,_['toLower'](_0x25afcd[_0xdbaa('0x5f')])))?path[_0xdbaa('0x66')](config[_0xdbaa('0x64')],_0x34aed8,_[_0xdbaa('0x65')](_0x25afcd[_0xdbaa('0x5f')])):path[_0xdbaa('0x66')](config['root'],_0x34aed8,_[_0xdbaa('0x65')](_0xdbaa('0x78')));var _0x5d4940=_0xdbaa('0x68')+_[_0xdbaa('0x69')](_0xdbaa('0x5f'));if(_0x25afcd[_0x5d4940]||!_0x105cea[_0xdbaa('0x6a')]){_0x78abc4=path[_0xdbaa('0x66')](config[_0xdbaa('0x64')],_0x34aed8,_[_0xdbaa('0x65')](_0xdbaa('0x78')));}if(!fs['existsSync'](_0x78abc4)){throw new db[(_0xdbaa('0x6b'))]['ValidationError'](_[_0xdbaa('0x69')](_0xdbaa('0x5f'))+_0xdbaa('0x71'));}return _0x2a912d[_0xdbaa('0x6c')](_0x78abc4);}})[_0xdbaa('0x26')](handleError(_0x2a912d,null));};exports['getDate']=function(_0x5bc40a,_0xd3b326){var _0x580283={'offset':moment()[_0xdbaa('0x79')]()};_0x580283[_0xdbaa('0x7a')]=moment()[_0xdbaa('0x79')](_0x580283[_0xdbaa('0x2a')])['format'](_0xdbaa('0x7b'));return _0xd3b326[_0xdbaa('0x28')](0xc8)['send'](_0x580283);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 8cabe07..5d3010a 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 _0x008c=['define','settings','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./setting.attributes','exports'];(function(_0x2b1551,_0x1776fe){var _0x2fc2a1=function(_0x5d43c8){while(--_0x5d43c8){_0x2b1551['push'](_0x2b1551['shift']());}};_0x2fc2a1(++_0x1776fe);}(_0x008c,0x188));var _0xc008=function(_0x15e0d2,_0x8333c){_0x15e0d2=_0x15e0d2-0x0;var _0x45bb73=_0x008c[_0x15e0d2];return _0x45bb73;};'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 +var _0x9957=['exports','define','Setting','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./setting.attributes'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_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':'settings','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 5ac6708..f91d6ff 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 _0x0c1f=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','ShowSetting','find','options','raw','where','attributes','include','map','model','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x49282b,_0x4e2125){var _0xcb542e=function(_0x19fb29){while(--_0x19fb29){_0x49282b['push'](_0x49282b['shift']());}};_0xcb542e(++_0x4e2125);}(_0x0c1f,0x1b3));var _0xf0c1=function(_0x2fbedc,_0x25d163){_0x2fbedc=_0x2fbedc-0x0;var _0x56b33e=_0x0c1f[_0x2fbedc];return _0x56b33e;};'use strict';var _=require(_0xf0c1('0x0'));var util=require(_0xf0c1('0x1'));var moment=require(_0xf0c1('0x2'));var BPromise=require(_0xf0c1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf0c1('0x4'))['db'];var utils=require(_0xf0c1('0x5'));var logger=require(_0xf0c1('0x6'))(_0xf0c1('0x7'));var config=require(_0xf0c1('0x8'));var jayson=require(_0xf0c1('0x9'));var client=jayson[_0xf0c1('0xa')][_0xf0c1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3a75a6,_0x39fdda,_0xbb13f3){return new BPromise(function(_0x44a05b,_0x4e3485){return client[_0xf0c1('0xc')](_0x3a75a6,_0xbb13f3)[_0xf0c1('0xd')](function(_0x2f60c3){logger[_0xf0c1('0xe')](_0xf0c1('0xf'),_0x39fdda,_0xf0c1('0x10'));logger[_0xf0c1('0x11')](_0xf0c1('0x12'),_0x39fdda,_0xf0c1('0x10'),JSON[_0xf0c1('0x13')](_0x2f60c3));if(_0x2f60c3[_0xf0c1('0x14')]){if(_0x2f60c3[_0xf0c1('0x14')][_0xf0c1('0x15')]===0x1f4){logger[_0xf0c1('0x14')](_0xf0c1('0xf'),_0x39fdda,_0x2f60c3[_0xf0c1('0x14')][_0xf0c1('0x16')]);return _0x4e3485(_0x2f60c3[_0xf0c1('0x14')][_0xf0c1('0x16')]);}logger['error'](_0xf0c1('0xf'),_0x39fdda,_0x2f60c3[_0xf0c1('0x14')][_0xf0c1('0x16')]);return _0x44a05b(_0x2f60c3[_0xf0c1('0x14')][_0xf0c1('0x16')]);}else{logger[_0xf0c1('0xe')]('Setting,\x20%s,\x20%s',_0x39fdda,_0xf0c1('0x10'));_0x44a05b(_0x2f60c3[_0xf0c1('0x17')][_0xf0c1('0x16')]);}})['catch'](function(_0x2964d9){logger[_0xf0c1('0x14')](_0xf0c1('0xf'),_0x39fdda,_0x2964d9);_0x4e3485(_0x2964d9);});});}exports[_0xf0c1('0x18')]=function(_0x292394){var _0x48c4b5=this;return new Promise(function(_0x209bc0,_0x40191d){return db['Setting'][_0xf0c1('0x19')]({'raw':_0x292394[_0xf0c1('0x1a')]?_0x292394[_0xf0c1('0x1a')][_0xf0c1('0x1b')]===undefined?!![]:![]:!![],'where':_0x292394[_0xf0c1('0x1a')]?_0x292394[_0xf0c1('0x1a')][_0xf0c1('0x1c')]||null:null,'attributes':_0x292394['options']?_0x292394[_0xf0c1('0x1a')][_0xf0c1('0x1d')]||null:null,'include':_0x292394[_0xf0c1('0x1a')]?_0x292394['options'][_0xf0c1('0x1e')]?_[_0xf0c1('0x1f')](_0x292394['options'][_0xf0c1('0x1e')],function(_0x21e5ca){return{'model':db[_0x21e5ca['model']],'as':_0x21e5ca['as'],'attributes':_0x21e5ca[_0xf0c1('0x1d')],'include':_0x21e5ca[_0xf0c1('0x1e')]?_[_0xf0c1('0x1f')](_0x21e5ca['include'],function(_0x4d8066){return{'model':db[_0x4d8066[_0xf0c1('0x20')]],'as':_0x4d8066['as'],'attributes':_0x4d8066[_0xf0c1('0x1d')],'include':_0x4d8066['include']?_[_0xf0c1('0x1f')](_0x4d8066[_0xf0c1('0x1e')],function(_0x4ad0ee){return{'model':db[_0x4ad0ee[_0xf0c1('0x20')]],'as':_0x4ad0ee['as'],'attributes':_0x4ad0ee[_0xf0c1('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xf0c1('0xd')](function(_0x4e7ae3){logger[_0xf0c1('0xe')](_0xf0c1('0x18'),_0x292394);logger[_0xf0c1('0x11')](_0xf0c1('0x18'),_0x292394,JSON[_0xf0c1('0x13')](_0x4e7ae3));_0x209bc0(_0x4e7ae3);})[_0xf0c1('0x21')](function(_0x26f9ad){logger[_0xf0c1('0x14')]('ShowSetting',_0x26f9ad[_0xf0c1('0x16')],_0x292394);_0x40191d(_0x48c4b5[_0xf0c1('0x14')](0x1f4,_0x26f9ad[_0xf0c1('0x16')]));});});}; \ No newline at end of file +var _0xa4e1=['http','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','message','catch','ShowSetting','options','raw','where','attributes','include','model','map','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x176774,_0x112d62){var _0x43c72e=function(_0x13ef7a){while(--_0x13ef7a){_0x176774['push'](_0x176774['shift']());}};_0x43c72e(++_0x112d62);}(_0xa4e1,0xcf));var _0x1a4e=function(_0x110230,_0x9327b4){_0x110230=_0x110230-0x0;var _0xef860f=_0xa4e1[_0x110230];return _0xef860f;};'use strict';var _=require(_0x1a4e('0x0'));var util=require(_0x1a4e('0x1'));var moment=require(_0x1a4e('0x2'));var BPromise=require('bluebird');var rs=require(_0x1a4e('0x3'));var fs=require('fs');var Redis=require(_0x1a4e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1a4e('0x5'));var logger=require(_0x1a4e('0x6'))(_0x1a4e('0x7'));var config=require(_0x1a4e('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1a4e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3dc763,_0x36ecf9,_0x1936a7){return new BPromise(function(_0x2de9ac,_0x51ca5c){return client['request'](_0x3dc763,_0x1936a7)[_0x1a4e('0xa')](function(_0x20f468){logger[_0x1a4e('0xb')](_0x1a4e('0xc'),_0x36ecf9,_0x1a4e('0xd'));logger[_0x1a4e('0xe')](_0x1a4e('0xf'),_0x36ecf9,_0x1a4e('0xd'),JSON['stringify'](_0x20f468));if(_0x20f468['error']){if(_0x20f468['error']['code']===0x1f4){logger['error'](_0x1a4e('0xc'),_0x36ecf9,_0x20f468[_0x1a4e('0x10')]['message']);return _0x51ca5c(_0x20f468[_0x1a4e('0x10')][_0x1a4e('0x11')]);}logger[_0x1a4e('0x10')](_0x1a4e('0xc'),_0x36ecf9,_0x20f468['error'][_0x1a4e('0x11')]);return _0x2de9ac(_0x20f468[_0x1a4e('0x10')][_0x1a4e('0x11')]);}else{logger[_0x1a4e('0xb')](_0x1a4e('0xc'),_0x36ecf9,_0x1a4e('0xd'));_0x2de9ac(_0x20f468['result']['message']);}})[_0x1a4e('0x12')](function(_0x9dde72){logger['error'](_0x1a4e('0xc'),_0x36ecf9,_0x9dde72);_0x51ca5c(_0x9dde72);});});}exports[_0x1a4e('0x13')]=function(_0x29c7d4){var _0x12f274=this;return new Promise(function(_0x58271c,_0x542c93){return db['Setting']['find']({'raw':_0x29c7d4[_0x1a4e('0x14')]?_0x29c7d4[_0x1a4e('0x14')][_0x1a4e('0x15')]===undefined?!![]:![]:!![],'where':_0x29c7d4[_0x1a4e('0x14')]?_0x29c7d4['options'][_0x1a4e('0x16')]||null:null,'attributes':_0x29c7d4[_0x1a4e('0x14')]?_0x29c7d4[_0x1a4e('0x14')][_0x1a4e('0x17')]||null:null,'include':_0x29c7d4[_0x1a4e('0x14')]?_0x29c7d4[_0x1a4e('0x14')]['include']?_['map'](_0x29c7d4[_0x1a4e('0x14')][_0x1a4e('0x18')],function(_0xacb1e0){return{'model':db[_0xacb1e0[_0x1a4e('0x19')]],'as':_0xacb1e0['as'],'attributes':_0xacb1e0[_0x1a4e('0x17')],'include':_0xacb1e0[_0x1a4e('0x18')]?_['map'](_0xacb1e0[_0x1a4e('0x18')],function(_0x56d372){return{'model':db[_0x56d372['model']],'as':_0x56d372['as'],'attributes':_0x56d372['attributes'],'include':_0x56d372[_0x1a4e('0x18')]?_[_0x1a4e('0x1a')](_0x56d372['include'],function(_0x10d6fa){return{'model':db[_0x10d6fa['model']],'as':_0x10d6fa['as'],'attributes':_0x10d6fa['attributes']};}):[]};}):[]};}):[]:[]})[_0x1a4e('0xa')](function(_0x327d56){logger[_0x1a4e('0xb')](_0x1a4e('0x13'),_0x29c7d4);logger['debug'](_0x1a4e('0x13'),_0x29c7d4,JSON['stringify'](_0x327d56));_0x58271c(_0x327d56);})['catch'](function(_0x54787d){logger[_0x1a4e('0x10')]('ShowSetting',_0x54787d['message'],_0x29c7d4);_0x542c93(_0x12f274[_0x1a4e('0x10')](0x1f4,_0x54787d[_0x1a4e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 7a576b8..225b019 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 _0x5fab=['create','post','/:id/dispositions','addAnswer','/:id/notify','notify','addApplications','status','addAgents','put','update','delete','removeDispositions','removeAnswers','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','/describe','describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','/:id/interactions','getInteractions','/:id/status','statusGet','/:id/users'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0x5fab,0x177));var _0xb5fa=function(_0x6a21f4,_0x220ad8){_0x6a21f4=_0x6a21f4-0x0;var _0x4c15ac=_0x5fab[_0x6a21f4];return _0x4c15ac;};'use strict';var multer=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var path=require('path');var timeout=require(_0xb5fa('0x2'));var express=require(_0xb5fa('0x3'));var router=express[_0xb5fa('0x4')]();var fs_extra=require(_0xb5fa('0x5'));var auth=require(_0xb5fa('0x6'));var interaction=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var controller=require(_0xb5fa('0x9'));router[_0xb5fa('0xa')]('/',auth[_0xb5fa('0xb')](),controller['index']);router['get'](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xd')]);router['get'](_0xb5fa('0xe'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xf')]);router['get']('/:id/dispositions',auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x10')]);router[_0xb5fa('0xa')](_0xb5fa('0x11'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x12')]);router[_0xb5fa('0xa')](_0xb5fa('0x13'),auth[_0xb5fa('0xb')](),controller['getApplications']);router[_0xb5fa('0xa')](_0xb5fa('0x14'),auth['isAuthenticated'](),controller[_0xb5fa('0x15')]);router['get'](_0xb5fa('0x16'),controller[_0xb5fa('0x17')]);router[_0xb5fa('0xa')](_0xb5fa('0x18'),auth[_0xb5fa('0xb')](),controller['getAgents']);router['post']('/',auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x19')]);router[_0xb5fa('0x1a')](_0xb5fa('0x1b'),auth['isAuthenticated'](),controller['addDisposition']);router[_0xb5fa('0x1a')](_0xb5fa('0x11'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x1c')]);router[_0xb5fa('0x1a')](_0xb5fa('0x1d'),controller[_0xb5fa('0x1e')]);router[_0xb5fa('0x1a')](_0xb5fa('0x13'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x1f')]);router[_0xb5fa('0x1a')]('/:id/send',auth[_0xb5fa('0xb')](),controller['send']);router[_0xb5fa('0x1a')]('/:id/status',controller[_0xb5fa('0x20')]);router[_0xb5fa('0x1a')]('/:id/users',auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x21')]);router[_0xb5fa('0x22')]('/:id',auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x23')]);router[_0xb5fa('0x24')]('/:id',auth[_0xb5fa('0xb')](),controller['destroy']);router[_0xb5fa('0x24')](_0xb5fa('0x1b'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x25')]);router[_0xb5fa('0x24')](_0xb5fa('0x11'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x26')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0xb5fa('0x27')]=router; \ No newline at end of file +var _0x7fbe=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status','statusGet','/:id/users','post','create','/:id/notify','notify','put','delete','removeAnswers','path','connect-timeout','express'];(function(_0x3b9f5d,_0x4aa440){var _0xec0839=function(_0x315174){while(--_0x315174){_0x3b9f5d['push'](_0x3b9f5d['shift']());}};_0xec0839(++_0x4aa440);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x31295c,_0x2f2b82){_0x31295c=_0x31295c-0x0;var _0x2c150e=_0x7fbe[_0x31295c];return _0x2c150e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe7fb('0x0'));var timeout=require(_0xe7fb('0x1'));var express=require(_0xe7fb('0x2'));var router=express[_0xe7fb('0x3')]();var fs_extra=require(_0xe7fb('0x4'));var auth=require(_0xe7fb('0x5'));var interaction=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var controller=require(_0xe7fb('0x8'));router[_0xe7fb('0x9')]('/',auth[_0xe7fb('0xa')](),controller[_0xe7fb('0xb')]);router[_0xe7fb('0x9')](_0xe7fb('0xc'),auth['isAuthenticated'](),controller[_0xe7fb('0xd')]);router[_0xe7fb('0x9')](_0xe7fb('0xe'),auth[_0xe7fb('0xa')](),controller['show']);router['get'](_0xe7fb('0xf'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x10')]);router[_0xe7fb('0x9')](_0xe7fb('0x11'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x12')]);router[_0xe7fb('0x9')](_0xe7fb('0x13'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x14')]);router[_0xe7fb('0x9')](_0xe7fb('0x15'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x16')]);router['get'](_0xe7fb('0x17'),controller[_0xe7fb('0x18')]);router['get'](_0xe7fb('0x19'),auth[_0xe7fb('0xa')](),controller['getAgents']);router[_0xe7fb('0x1a')]('/',auth['isAuthenticated'](),controller[_0xe7fb('0x1b')]);router[_0xe7fb('0x1a')](_0xe7fb('0xf'),auth[_0xe7fb('0xa')](),controller['addDisposition']);router[_0xe7fb('0x1a')]('/:id/canned_answers',auth[_0xe7fb('0xa')](),controller['addAnswer']);router[_0xe7fb('0x1a')](_0xe7fb('0x1c'),controller[_0xe7fb('0x1d')]);router[_0xe7fb('0x1a')]('/:id/applications',auth[_0xe7fb('0xa')](),controller['addApplications']);router[_0xe7fb('0x1a')]('/:id/send',auth[_0xe7fb('0xa')](),controller['send']);router[_0xe7fb('0x1a')](_0xe7fb('0x17'),controller['status']);router[_0xe7fb('0x1a')](_0xe7fb('0x19'),auth[_0xe7fb('0xa')](),controller['addAgents']);router[_0xe7fb('0x1e')](_0xe7fb('0xe'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xe7fb('0xe'),auth['isAuthenticated'](),controller['destroy']);router[_0xe7fb('0x1f')](_0xe7fb('0xf'),auth[_0xe7fb('0xa')](),controller['removeDispositions']);router[_0xe7fb('0x1f')](_0xe7fb('0x11'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x20')]);router[_0xe7fb('0x1f')](_0xe7fb('0x19'),auth[_0xe7fb('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index e9368f1..8f53981 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 _0xaa6c=['csc','infobip','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','exports','STRING','name','generate','ENUM','twilio','connectel','plivo','bandwidth'];(function(_0x10c601,_0x1e466a){var _0x478a9a=function(_0x151af7){while(--_0x151af7){_0x10c601['push'](_0x10c601['shift']());}};_0x478a9a(++_0x1e466a);}(_0xaa6c,0x1af));var _0xcaa6=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0xaa6c[_0x3b0731];return _0x4204d7;};'use strict';var Sequelize=require(_0xcaa6('0x0'));var rs=require('randomstring');module[_0xcaa6('0x1')]={'name':{'type':Sequelize[_0xcaa6('0x2')],'unique':_0xcaa6('0x3'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0xcaa6('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0xcaa6('0x2')],'defaultValue':function(){return rs[_0xcaa6('0x4')]();}},'phone':{'type':Sequelize[_0xcaa6('0x2')]},'type':{'type':Sequelize[_0xcaa6('0x5')](_0xcaa6('0x6'),'skebby',_0xcaa6('0x7'),'clicksend',_0xcaa6('0x8'),'clickatell',_0xcaa6('0x9'),_0xcaa6('0xa'),_0xcaa6('0xb'),_0xcaa6('0xc'))},'accountSid':{'type':Sequelize[_0xcaa6('0x2')]},'authId':{'type':Sequelize[_0xcaa6('0x2')]},'authToken':{'type':Sequelize[_0xcaa6('0x2')]},'smsMethod':{'type':Sequelize[_0xcaa6('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0xcaa6('0x2')]},'password':{'type':Sequelize[_0xcaa6('0x2')]},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize[_0xcaa6('0x2')]},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0xcaa6('0x2')]},'deliveryReport':{'type':Sequelize[_0xcaa6('0xd')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xcaa6('0xe')],'defaultValue':function(){return _0xcaa6('0xf');}},'notificationSound':{'type':Sequelize[_0xcaa6('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xcaa6('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xcaa6('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xcaa6('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xcaa6('0x11')},'mandatoryDisposition':{'type':Sequelize[_0xcaa6('0xd')],'defaultValue':![],'comment':_0xcaa6('0x12'),'set':function(_0x35564d){if(!_0x35564d)this[_0xcaa6('0x13')]('mandatoryDispositionPauseId',null);this[_0xcaa6('0x13')](_0xcaa6('0x14'),_0x35564d);}}}; \ No newline at end of file +var _0x179e=['plivo','clickatell','csc','infobip','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','randomstring','exports','STRING','name','ENUM','twilio','connectel','clicksend'];(function(_0x50c9b8,_0x563fdc){var _0x494f09=function(_0x509c9c){while(--_0x509c9c){_0x50c9b8['push'](_0x50c9b8['shift']());}};_0x494f09(++_0x563fdc);}(_0x179e,0x187));var _0xe179=function(_0x12705f,_0x195e8b){_0x12705f=_0x12705f-0x0;var _0x4c484d=_0x179e[_0x12705f];return _0x4c484d;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xe179('0x0'));module[_0xe179('0x1')]={'name':{'type':Sequelize[_0xe179('0x2')],'unique':_0xe179('0x3'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0xe179('0x2')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0xe179('0x2')]},'type':{'type':Sequelize[_0xe179('0x4')](_0xe179('0x5'),'skebby',_0xe179('0x6'),_0xe179('0x7'),_0xe179('0x8'),_0xe179('0x9'),'bandwidth',_0xe179('0xa'),_0xe179('0xb'),_0xe179('0xc'))},'accountSid':{'type':Sequelize[_0xe179('0x2')]},'authId':{'type':Sequelize[_0xe179('0x2')]},'authToken':{'type':Sequelize[_0xe179('0x2')]},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0xe179('0x2')]},'applicationId':{'type':Sequelize[_0xe179('0x2')]},'accountId':{'type':Sequelize[_0xe179('0x2')]},'senderString':{'type':Sequelize[_0xe179('0x2')]},'deliveryReport':{'type':Sequelize[_0xe179('0xd')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xe179('0xe')],'defaultValue':function(){return _0xe179('0xf');}},'notificationSound':{'type':Sequelize[_0xe179('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xe179('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xe179('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xe179('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xe179('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xe179('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xe179('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe179('0x10')],'comment':_0xe179('0x11')},'mandatoryDisposition':{'type':Sequelize[_0xe179('0xd')],'defaultValue':![],'comment':_0xe179('0x12'),'set':function(_0x3b6c04){if(!_0x3b6c04)this[_0xe179('0x13')](_0xe179('0x14'),null);this[_0xe179('0x13')]('mandatoryDisposition',_0x3b6c04);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 1f34251..885f673 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 _0x8d37=['client','http','then','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','SmsAccount,\x20%s,\x20%s','message','info','request\x20sent','result','catch','sendStatus','status','end','json','offset','count','limit','set','Content-Range','apply','reject','save','destroy','UserProfileResource','stack','name','send','index','mandatoryDispositionPause','SmsAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','Pause','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','params','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','hasOwnProperty','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','SmsApplication','Applications','account','applications','priority','asc','CmContact','ValidationError','difference','createdAt','updatedAt','CompanyId','mobile','twilio','from','From','Body','messageId','MessageSid','skebby','sender','text','connectel','message_id','results','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','refid','isNil','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','CmList','ListId','Contacts','DESC','contact','SmsInteraction','spread','interaction','created','autoclose','close','unmanaged','SmsMessage','ContactId','AttachmentId','User','UserId','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','receiveMessage','debug','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','addApplications','transaction','sequelize','Transaction','READ_COMMITTED','findAndCountAll','finally','getApplications','internal','Tag','Tags','color','tag','List','Messages','dataValues','push','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','statusInt','requestid','clicksend','status_code','infobip','DELIVERED','groupName','redif','update','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','statusGet','csc','message-id','state','addAgents','omit','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./smsAccount.socket','jayson/promise'];(function(_0x3719ec,_0x4638c2){var _0x53af3a=function(_0xd55f21){while(--_0xd55f21){_0x3719ec['push'](_0x3719ec['shift']());}};_0x53af3a(++_0x4638c2);}(_0x8d37,0x1a8));var _0x78d3=function(_0x588a2f,_0x19420c){_0x588a2f=_0x588a2f-0x0;var _0x3f2e22=_0x8d37[_0x588a2f];return _0x3f2e22;};'use strict';var emlformat=require(_0x78d3('0x0'));var rimraf=require(_0x78d3('0x1'));var zipdir=require(_0x78d3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x78d3('0x3'));var moment=require(_0x78d3('0x4'));var BPromise=require(_0x78d3('0x5'));var Mustache=require(_0x78d3('0x6'));var util=require(_0x78d3('0x7'));var path=require(_0x78d3('0x8'));var sox=require(_0x78d3('0x9'));var csv=require(_0x78d3('0xa'));var ejs=require(_0x78d3('0xb'));var fs=require('fs');var fs_extra=require(_0x78d3('0xc'));var _=require(_0x78d3('0xd'));var squel=require('squel');var crypto=require(_0x78d3('0xe'));var jsforce=require(_0x78d3('0xf'));var deskjs=require(_0x78d3('0x10'));var toCsv=require(_0x78d3('0xa'));var querystring=require('querystring');var Papa=require(_0x78d3('0x11'));var Redis=require(_0x78d3('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x78d3('0x13'));var as=require(_0x78d3('0x14'));var hardwareService=require(_0x78d3('0x15'));var logger=require('../../config/logger')(_0x78d3('0x16'));var utils=require(_0x78d3('0x17'));var config=require(_0x78d3('0x18'));var licenseUtil=require(_0x78d3('0x19'));var db=require(_0x78d3('0x1a'))['db'];config['redis']=_[_0x78d3('0x1b')](config[_0x78d3('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0x78d3('0x1d'))(new Redis(config[_0x78d3('0x1c')]));require(_0x78d3('0x1e'))['register'](socket);var jayson=require(_0x78d3('0x1f'));var client=jayson[_0x78d3('0x20')][_0x78d3('0x21')]({'port':0x232c});function respondWithRpcPromise(_0x5057db,_0x5b73f0,_0x583252,_0x54a40b){return new BPromise(function(_0x52c639,_0x2600c1){var _0x5e749d=_0x54a40b||client;return _0x5e749d['request'](_0x5057db,_0x583252)[_0x78d3('0x22')](function(_0x2651f4){logger['info']('SmsAccount,\x20%s,\x20%s',_0x5b73f0,'request\x20sent');logger['debug'](_0x78d3('0x23'),_0x5b73f0,'request\x20sent',JSON[_0x78d3('0x24')](_0x2651f4));if(_0x2651f4['error']){if(_0x2651f4[_0x78d3('0x25')]['code']===0x1f4){logger[_0x78d3('0x25')](_0x78d3('0x26'),_0x5b73f0,_0x2651f4['error'][_0x78d3('0x27')]);return _0x2600c1(_0x2651f4['error']['message']);}logger['error'](_0x78d3('0x26'),_0x5b73f0,_0x2651f4[_0x78d3('0x25')][_0x78d3('0x27')]);return _0x52c639(_0x2651f4[_0x78d3('0x25')][_0x78d3('0x27')]);}else{logger[_0x78d3('0x28')](_0x78d3('0x26'),_0x5b73f0,_0x78d3('0x29'));_0x52c639(_0x2651f4[_0x78d3('0x2a')][_0x78d3('0x27')]);}})[_0x78d3('0x2b')](function(_0xcf2018){logger[_0x78d3('0x25')](_0x78d3('0x26'),_0x5b73f0,_0xcf2018);_0x2600c1(_0xcf2018);});});}function respondWithStatusCode(_0x41ad1a,_0x1da126){_0x1da126=_0x1da126||0xcc;return function(_0x4ed2cf){if(_0x4ed2cf){return _0x41ad1a[_0x78d3('0x2c')](_0x1da126);}return _0x41ad1a[_0x78d3('0x2d')](_0x1da126)[_0x78d3('0x2e')]();};}function respondWithResult(_0x54f51c,_0x23796e){_0x23796e=_0x23796e||0xc8;return function(_0x7c9a6){if(_0x7c9a6){return _0x54f51c[_0x78d3('0x2d')](_0x23796e)[_0x78d3('0x2f')](_0x7c9a6);}};}function respondWithFilteredResult(_0x5b6714,_0x3523e3){return function(_0x2f4ed3){if(_0x2f4ed3){var _0x2cdcc1=typeof _0x3523e3[_0x78d3('0x30')]==='undefined'&&typeof _0x3523e3['limit']==='undefined';var _0x5ec4ea=_0x2f4ed3[_0x78d3('0x31')];var _0x20c3a3=_0x2cdcc1?0x0:_0x3523e3['offset'];var _0x4ce01b=_0x2cdcc1?_0x2f4ed3[_0x78d3('0x31')]:_0x3523e3['offset']+_0x3523e3[_0x78d3('0x32')];var _0x517c89;if(_0x4ce01b>=_0x5ec4ea){_0x4ce01b=_0x5ec4ea;_0x517c89=0xc8;}else{_0x517c89=0xce;}_0x5b6714[_0x78d3('0x2d')](_0x517c89);return _0x5b6714[_0x78d3('0x33')](_0x78d3('0x34'),_0x20c3a3+'-'+_0x4ce01b+'/'+_0x5ec4ea)['json'](_0x2f4ed3);}return null;};}function patchUpdates(_0x2ec58c){return function(_0x1ff7e9){try{jsonpatch[_0x78d3('0x35')](_0x1ff7e9,_0x2ec58c,!![]);}catch(_0x1345e1){return BPromise[_0x78d3('0x36')](_0x1345e1);}return _0x1ff7e9[_0x78d3('0x37')]();};}function saveUpdates(_0x468746,_0x59a90f){return function(_0x24d3bb){if(_0x24d3bb){return _0x24d3bb['update'](_0x468746)[_0x78d3('0x22')](function(_0x5c722a){return _0x5c722a;});}return null;};}function removeEntity(_0x192458,_0x485766){return function(_0x1013ff){if(_0x1013ff){return _0x1013ff[_0x78d3('0x38')]()[_0x78d3('0x22')](function(){var _0x4e23fe=_0x1013ff['get']({'plain':!![]});var _0x260f44='SmsAccounts';return db[_0x78d3('0x39')][_0x78d3('0x38')]({'where':{'type':_0x260f44,'resourceId':_0x4e23fe['id']}})[_0x78d3('0x22')](function(){return _0x1013ff;});})[_0x78d3('0x22')](function(){_0x192458[_0x78d3('0x2d')](0xcc)[_0x78d3('0x2e')]();});}};}function handleEntityNotFound(_0x3318c2,_0x466e82){return function(_0x5616ed){if(!_0x5616ed){_0x3318c2['sendStatus'](0x194);}return _0x5616ed;};}function handleError(_0x1a8318,_0x1c34e9){_0x1c34e9=_0x1c34e9||0x1f4;return function(_0x23a9bf){logger[_0x78d3('0x25')](_0x23a9bf[_0x78d3('0x3a')]);if(_0x23a9bf[_0x78d3('0x3b')]){delete _0x23a9bf['name'];}_0x1a8318['status'](_0x1c34e9)[_0x78d3('0x3c')](_0x23a9bf);};}exports[_0x78d3('0x3d')]=function(_0x413d95,_0x5354e7){var _0x5a7587={'include':[{'model':db['Pause'],'as':_0x78d3('0x3e')}]},_0x4d0fbd={},_0x2939bc={'count':0x0,'rows':[]};var _0x5d83b1=_['map'](db[_0x78d3('0x3f')][_0x78d3('0x40')],function(_0x5e234a){return{'name':_0x5e234a[_0x78d3('0x41')],'type':_0x5e234a[_0x78d3('0x42')][_0x78d3('0x43')]};});_0x4d0fbd[_0x78d3('0x44')]=_[_0x78d3('0x45')](_0x5d83b1,_0x78d3('0x3b'));_0x4d0fbd[_0x78d3('0x46')]=_[_0x78d3('0x47')](_0x413d95[_0x78d3('0x46')]);_0x4d0fbd[_0x78d3('0x48')]=_['intersection'](_0x4d0fbd[_0x78d3('0x44')],_0x4d0fbd[_0x78d3('0x46')]);_0x5a7587[_0x78d3('0x49')]=_[_0x78d3('0x4a')](_0x4d0fbd['model'],qs[_0x78d3('0x4b')](_0x413d95[_0x78d3('0x46')][_0x78d3('0x4b')]));_0x5a7587[_0x78d3('0x49')]=_0x5a7587[_0x78d3('0x49')][_0x78d3('0x4c')]?_0x5a7587[_0x78d3('0x49')]:_0x4d0fbd[_0x78d3('0x44')];if(!_0x413d95[_0x78d3('0x46')]['hasOwnProperty'](_0x78d3('0x4d'))){_0x5a7587[_0x78d3('0x32')]=qs[_0x78d3('0x32')](_0x413d95[_0x78d3('0x46')][_0x78d3('0x32')]);_0x5a7587[_0x78d3('0x30')]=qs[_0x78d3('0x30')](_0x413d95[_0x78d3('0x46')][_0x78d3('0x30')]);}_0x5a7587[_0x78d3('0x4e')]=qs['sort'](_0x413d95[_0x78d3('0x46')][_0x78d3('0x4f')]);_0x5a7587[_0x78d3('0x50')]=qs['filters'](_[_0x78d3('0x51')](_0x413d95[_0x78d3('0x46')],_0x4d0fbd['filters']),_0x5d83b1);if(_0x413d95[_0x78d3('0x46')][_0x78d3('0x52')]){_0x5a7587['where']=_[_0x78d3('0x53')](_0x5a7587[_0x78d3('0x50')],{'$or':_[_0x78d3('0x45')](_0x5d83b1,function(_0x1710d1){if(_0x1710d1[_0x78d3('0x42')]!=='VIRTUAL'){var _0x31ea73={};_0x31ea73[_0x1710d1[_0x78d3('0x3b')]]={'$like':'%'+_0x413d95[_0x78d3('0x46')][_0x78d3('0x52')]+'%'};return _0x31ea73;}})});}_0x5a7587=_[_0x78d3('0x53')]({},_0x5a7587,_0x413d95[_0x78d3('0x54')]);var _0x24e015={'where':_0x5a7587[_0x78d3('0x50')]};return db[_0x78d3('0x3f')][_0x78d3('0x31')](_0x24e015)[_0x78d3('0x22')](function(_0xec4dfc){_0x2939bc[_0x78d3('0x31')]=_0xec4dfc;if(_0x413d95['query'][_0x78d3('0x55')]){_0x5a7587[_0x78d3('0x56')]=[{'all':!![]}];}return db[_0x78d3('0x3f')][_0x78d3('0x57')](_0x5a7587);})['then'](function(_0x2d09d9){_0x2939bc[_0x78d3('0x58')]=_0x2d09d9;return _0x2939bc;})['then'](respondWithFilteredResult(_0x5354e7,_0x5a7587))[_0x78d3('0x2b')](handleError(_0x5354e7,null));};exports[_0x78d3('0x59')]=function(_0x4adca3,_0x31f040){var _0x162dab={'raw':![],'where':{'id':_0x4adca3['params']['id']},'include':[{'model':db[_0x78d3('0x5a')],'as':_0x78d3('0x3e')}]},_0x3a1c86={};_0x3a1c86[_0x78d3('0x44')]=_[_0x78d3('0x47')](db[_0x78d3('0x3f')][_0x78d3('0x40')]);_0x3a1c86[_0x78d3('0x46')]=_[_0x78d3('0x47')](_0x4adca3[_0x78d3('0x46')]);_0x3a1c86['filters']=_[_0x78d3('0x4a')](_0x3a1c86[_0x78d3('0x44')],_0x3a1c86[_0x78d3('0x46')]);_0x162dab['attributes']=_[_0x78d3('0x4a')](_0x3a1c86[_0x78d3('0x44')],qs[_0x78d3('0x4b')](_0x4adca3[_0x78d3('0x46')][_0x78d3('0x4b')]));_0x162dab[_0x78d3('0x49')]=_0x162dab[_0x78d3('0x49')][_0x78d3('0x4c')]?_0x162dab['attributes']:_0x3a1c86[_0x78d3('0x44')];if(_0x4adca3['query'][_0x78d3('0x55')]){_0x162dab[_0x78d3('0x56')]=[{'all':!![]}];}_0x162dab=_['merge']({},_0x162dab,_0x4adca3[_0x78d3('0x54')]);return db['SmsAccount'][_0x78d3('0x5b')](_0x162dab)[_0x78d3('0x22')](handleEntityNotFound(_0x31f040,null))['then'](respondWithResult(_0x31f040,null))[_0x78d3('0x2b')](handleError(_0x31f040,null));};exports[_0x78d3('0x5c')]=function(_0x5bb302,_0x4da90d){return db[_0x78d3('0x3f')][_0x78d3('0x5c')](_0x5bb302[_0x78d3('0x5d')],{})[_0x78d3('0x22')](function(_0x33daad){var _0x599d62=_0x5bb302[_0x78d3('0x5e')]['get']({'plain':!![]});if(!_0x599d62)throw new Error(_0x78d3('0x5f'));if(_0x599d62[_0x78d3('0x60')]===_0x78d3('0x5e')){var _0x1d0133=_0x33daad[_0x78d3('0x61')]({'plain':!![]});var _0x9893dc='SmsAccounts';return db[_0x78d3('0x62')][_0x78d3('0x5b')]({'where':{'name':_0x9893dc,'userProfileId':_0x599d62[_0x78d3('0x63')]},'raw':!![]})[_0x78d3('0x22')](function(_0x21fa95){if(_0x21fa95&&_0x21fa95['autoAssociation']===0x0){return db[_0x78d3('0x39')][_0x78d3('0x5c')]({'name':_0x1d0133[_0x78d3('0x3b')],'resourceId':_0x1d0133['id'],'type':_0x21fa95[_0x78d3('0x3b')],'sectionId':_0x21fa95['id']},{})[_0x78d3('0x22')](function(){return _0x33daad;});}else{return _0x33daad;}})['catch'](function(_0x4f212c){logger[_0x78d3('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4f212c);throw _0x4f212c;});}return _0x33daad;})[_0x78d3('0x22')](respondWithResult(_0x4da90d,0xc9))[_0x78d3('0x2b')](handleError(_0x4da90d,null));};exports['update']=function(_0x1d01ad,_0x1a5de1){if(_0x1d01ad[_0x78d3('0x5d')]['id']){delete _0x1d01ad[_0x78d3('0x5d')]['id'];}return db[_0x78d3('0x3f')][_0x78d3('0x5b')]({'where':{'id':_0x1d01ad[_0x78d3('0x64')]['id']},'include':[{'model':db[_0x78d3('0x5a')],'as':'mandatoryDispositionPause'}]})[_0x78d3('0x22')](handleEntityNotFound(_0x1a5de1,null))[_0x78d3('0x22')](saveUpdates(_0x1d01ad[_0x78d3('0x5d')],null))['then'](respondWithResult(_0x1a5de1,null))['catch'](handleError(_0x1a5de1,null));};exports[_0x78d3('0x38')]=function(_0x5bcecc,_0x30c2ac){return db[_0x78d3('0x3f')][_0x78d3('0x5b')]({'where':{'id':_0x5bcecc[_0x78d3('0x64')]['id']}})[_0x78d3('0x22')](handleEntityNotFound(_0x30c2ac,null))[_0x78d3('0x22')](removeEntity(_0x30c2ac,null))['catch'](handleError(_0x30c2ac,null));};exports[_0x78d3('0x65')]=function(_0x50af80,_0x15d3d1){return db[_0x78d3('0x3f')][_0x78d3('0x65')]()['then'](respondWithResult(_0x15d3d1,null))['catch'](handleError(_0x15d3d1,null));};exports[_0x78d3('0x66')]=function(_0x5a8219,_0x4fe050,_0x25ab74){if(_0x5a8219['body']['id']){delete _0x5a8219[_0x78d3('0x5d')]['id'];}return db[_0x78d3('0x3f')][_0x78d3('0x5b')]({'where':{'id':_0x5a8219[_0x78d3('0x64')]['id']}})[_0x78d3('0x22')](handleEntityNotFound(_0x4fe050,null))[_0x78d3('0x22')](function(_0x4cad32){if(_0x4cad32){_0x5a8219[_0x78d3('0x5d')][_0x78d3('0x67')]=_0x4cad32['id'];return db[_0x78d3('0x68')][_0x78d3('0x5c')](_0x5a8219[_0x78d3('0x5d')]);}})[_0x78d3('0x22')](respondWithResult(_0x4fe050,null))[_0x78d3('0x2b')](handleError(_0x4fe050,null));};exports[_0x78d3('0x69')]=function(_0x4df43d,_0x3dba44,_0x37b2c6){var _0x21ad5a={'raw':![],'where':{}};var _0x49c8cd={};var _0x47e98e={'count':0x0,'rows':[]};return db[_0x78d3('0x3f')][_0x78d3('0x6a')]({'where':{'id':_0x4df43d['params']['id']}})[_0x78d3('0x22')](handleEntityNotFound(_0x3dba44,null))[_0x78d3('0x22')](function(_0x54d802){if(_0x54d802){_0x49c8cd[_0x78d3('0x44')]=_[_0x78d3('0x47')](db[_0x78d3('0x68')][_0x78d3('0x40')]);_0x49c8cd[_0x78d3('0x46')]=_['keys'](_0x4df43d[_0x78d3('0x46')]);_0x49c8cd[_0x78d3('0x48')]=_[_0x78d3('0x4a')](_0x49c8cd[_0x78d3('0x44')],_0x49c8cd['query']);_0x21ad5a[_0x78d3('0x49')]=_['intersection'](_0x49c8cd[_0x78d3('0x44')],qs[_0x78d3('0x4b')](_0x4df43d[_0x78d3('0x46')][_0x78d3('0x4b')]));_0x21ad5a['attributes']=_0x21ad5a[_0x78d3('0x49')][_0x78d3('0x4c')]?_0x21ad5a[_0x78d3('0x49')]:_0x49c8cd['model'];if(!_0x4df43d[_0x78d3('0x46')][_0x78d3('0x6b')](_0x78d3('0x4d'))){_0x21ad5a['limit']=qs['limit'](_0x4df43d['query'][_0x78d3('0x32')]);_0x21ad5a[_0x78d3('0x30')]=qs['offset'](_0x4df43d['query'][_0x78d3('0x30')]);}_0x21ad5a[_0x78d3('0x4e')]=qs[_0x78d3('0x4f')](_0x4df43d[_0x78d3('0x46')][_0x78d3('0x4f')]);_0x21ad5a['where']=qs['filters'](_[_0x78d3('0x51')](_0x4df43d[_0x78d3('0x46')],_0x49c8cd[_0x78d3('0x48')]));_0x21ad5a[_0x78d3('0x50')][_0x78d3('0x67')]=_0x54d802['id'];if(_0x4df43d[_0x78d3('0x46')][_0x78d3('0x52')]){_0x21ad5a[_0x78d3('0x50')]=_[_0x78d3('0x53')](_0x21ad5a[_0x78d3('0x50')],{'$or':_[_0x78d3('0x45')](_0x21ad5a[_0x78d3('0x49')],function(_0x144038){var _0x1eec95={};_0x1eec95[_0x144038]={'$like':'%'+_0x4df43d['query'][_0x78d3('0x52')]+'%'};return _0x1eec95;})});}_0x21ad5a=_[_0x78d3('0x53')]({},_0x21ad5a,_0x4df43d[_0x78d3('0x54')]);return db['Disposition'][_0x78d3('0x31')]({'where':_0x21ad5a[_0x78d3('0x50')]})[_0x78d3('0x22')](function(_0x2d9892){_0x47e98e['count']=_0x2d9892;if(_0x4df43d[_0x78d3('0x46')][_0x78d3('0x55')]){_0x21ad5a[_0x78d3('0x56')]=[{'all':!![]}];}return db[_0x78d3('0x68')][_0x78d3('0x57')](_0x21ad5a);})['then'](function(_0x41824c){_0x47e98e[_0x78d3('0x58')]=_0x41824c;return _0x47e98e;});}})[_0x78d3('0x22')](respondWithFilteredResult(_0x3dba44,_0x21ad5a))['catch'](handleError(_0x3dba44,null));};exports[_0x78d3('0x6c')]=function(_0x3951f5,_0x3a22cb,_0xe57283){return db[_0x78d3('0x3f')][_0x78d3('0x5b')]({'where':{'id':_0x3951f5[_0x78d3('0x64')]['id']}})[_0x78d3('0x22')](handleEntityNotFound(_0x3a22cb,null))[_0x78d3('0x22')](function(_0x42af89){if(_0x42af89){return _0x42af89[_0x78d3('0x6c')](_0x3951f5[_0x78d3('0x46')][_0x78d3('0x6d')]);}})[_0x78d3('0x22')](respondWithStatusCode(_0x3a22cb,null))[_0x78d3('0x2b')](handleError(_0x3a22cb,null));};exports[_0x78d3('0x6e')]=function(_0x3c869a,_0x189a61,_0x535f35){if(_0x3c869a[_0x78d3('0x5d')]['id']){delete _0x3c869a[_0x78d3('0x5d')]['id'];}return db[_0x78d3('0x3f')][_0x78d3('0x5b')]({'where':{'id':_0x3c869a[_0x78d3('0x64')]['id']}})[_0x78d3('0x22')](handleEntityNotFound(_0x189a61,null))[_0x78d3('0x22')](function(_0x571fde){if(_0x571fde){_0x3c869a['body'][_0x78d3('0x67')]=_0x571fde['id'];return db[_0x78d3('0x6f')][_0x78d3('0x5c')](_0x3c869a[_0x78d3('0x5d')]);}})[_0x78d3('0x22')](respondWithResult(_0x189a61,null))[_0x78d3('0x2b')](handleError(_0x189a61,null));};exports[_0x78d3('0x70')]=function(_0x5b03d5,_0x275170,_0x2f313e){var _0x2461e7={'raw':![],'where':{}};var _0x1b2bf3={};var _0x240ba1={'count':0x0,'rows':[]};return db[_0x78d3('0x3f')][_0x78d3('0x6a')]({'where':{'id':_0x5b03d5[_0x78d3('0x64')]['id']}})[_0x78d3('0x22')](handleEntityNotFound(_0x275170,null))[_0x78d3('0x22')](function(_0x16d495){if(_0x16d495){_0x1b2bf3[_0x78d3('0x44')]=_[_0x78d3('0x47')](db['CannedAnswer']['rawAttributes']);_0x1b2bf3[_0x78d3('0x46')]=_[_0x78d3('0x47')](_0x5b03d5[_0x78d3('0x46')]);_0x1b2bf3[_0x78d3('0x48')]=_[_0x78d3('0x4a')](_0x1b2bf3['model'],_0x1b2bf3['query']);_0x2461e7['attributes']=_[_0x78d3('0x4a')](_0x1b2bf3[_0x78d3('0x44')],qs['fields'](_0x5b03d5['query'][_0x78d3('0x4b')]));_0x2461e7[_0x78d3('0x49')]=_0x2461e7['attributes'][_0x78d3('0x4c')]?_0x2461e7[_0x78d3('0x49')]:_0x1b2bf3[_0x78d3('0x44')];if(!_0x5b03d5[_0x78d3('0x46')]['hasOwnProperty']('nolimit')){_0x2461e7['limit']=qs['limit'](_0x5b03d5[_0x78d3('0x46')][_0x78d3('0x32')]);_0x2461e7[_0x78d3('0x30')]=qs[_0x78d3('0x30')](_0x5b03d5[_0x78d3('0x46')][_0x78d3('0x30')]);}_0x2461e7[_0x78d3('0x4e')]=qs[_0x78d3('0x4f')](_0x5b03d5['query'][_0x78d3('0x4f')]);_0x2461e7['where']=qs['filters'](_[_0x78d3('0x51')](_0x5b03d5['query'],_0x1b2bf3[_0x78d3('0x48')]));_0x2461e7[_0x78d3('0x50')][_0x78d3('0x67')]=_0x16d495['id'];if(_0x5b03d5[_0x78d3('0x46')]['filter']){_0x2461e7[_0x78d3('0x50')]=_[_0x78d3('0x53')](_0x2461e7[_0x78d3('0x50')],{'$or':_[_0x78d3('0x45')](_0x2461e7[_0x78d3('0x49')],function(_0x38c843){var _0x5c64d5={};_0x5c64d5[_0x38c843]={'$like':'%'+_0x5b03d5[_0x78d3('0x46')][_0x78d3('0x52')]+'%'};return _0x5c64d5;})});}_0x2461e7=_[_0x78d3('0x53')]({},_0x2461e7,_0x5b03d5[_0x78d3('0x54')]);return db[_0x78d3('0x6f')][_0x78d3('0x31')]({'where':_0x2461e7['where']})[_0x78d3('0x22')](function(_0x57114f){_0x240ba1[_0x78d3('0x31')]=_0x57114f;if(_0x5b03d5[_0x78d3('0x46')]['includeAll']){_0x2461e7['include']=[{'all':!![]}];}return db['CannedAnswer'][_0x78d3('0x57')](_0x2461e7);})['then'](function(_0x4984e3){_0x240ba1[_0x78d3('0x58')]=_0x4984e3;return _0x240ba1;});}})['then'](respondWithFilteredResult(_0x275170,_0x2461e7))['catch'](handleError(_0x275170,null));};exports[_0x78d3('0x71')]=function(_0x3487bb,_0x134be9,_0x4a2123){return db['SmsAccount'][_0x78d3('0x5b')]({'where':{'id':_0x3487bb['params']['id']}})[_0x78d3('0x22')](handleEntityNotFound(_0x134be9,null))[_0x78d3('0x22')](function(_0x3a8cba){if(_0x3a8cba){return _0x3a8cba['removeAnswers'](_0x3487bb[_0x78d3('0x46')][_0x78d3('0x6d')]);}})['then'](respondWithStatusCode(_0x134be9,null))[_0x78d3('0x2b')](handleError(_0x134be9,null));};exports[_0x78d3('0x72')]=function(_0x1f99f6,_0x4028a6,_0x795a71){var _0x5599fe={'channel':'sms'};var _0x1bb0dc=[];var _0x336035=[];var _0xce58a4={};return db[_0x78d3('0x3f')][_0x78d3('0x5b')]({'where':{'id':_0x1f99f6[_0x78d3('0x64')]['id']},'include':[{'model':db[_0x78d3('0x73')],'as':_0x78d3('0x74')}]})[_0x78d3('0x22')](handleEntityNotFound(_0x4028a6,null))[_0x78d3('0x22')](function(_0x3a619a){_0x5599fe[_0x78d3('0x75')]=_0x3a619a;_0x5599fe[_0x78d3('0x76')]=_['orderBy'](_0x3a619a[_0x78d3('0x74')],[_0x78d3('0x77')],[_0x78d3('0x78')]);if(_0x5599fe[_0x78d3('0x75')][_0x78d3('0x74')]){delete _0x5599fe['account']['Applications'];}return db[_0x78d3('0x79')][_0x78d3('0x65')]();})[_0x78d3('0x22')](function(_0x569004){if(!_0x569004){throw new db['Sequelize'][(_0x78d3('0x7a'))]('no\x20available\x20attributes');}_0x1bb0dc=_[_0x78d3('0x7b')](_[_0x78d3('0x47')](_0x569004),[_0x78d3('0x7c'),_0x78d3('0x7d')]);_0x336035=_[_0x78d3('0x7b')](_[_0x78d3('0x47')](_0x569004),[_0x78d3('0x7c'),_0x78d3('0x7d'),_0x78d3('0x7e'),'ListId']);_0x5599fe[_0x78d3('0x5d')]={'mapKey':_0x78d3('0x7f')};if(_0x5599fe[_0x78d3('0x75')]['type']){switch(_0x5599fe[_0x78d3('0x75')][_0x78d3('0x42')]){case _0x78d3('0x80'):_0x5599fe[_0x78d3('0x5d')][_0x78d3('0x81')]=_0x1f99f6['body'][_0x78d3('0x82')];_0x5599fe[_0x78d3('0x5d')][_0x78d3('0x5d')]=_0x1f99f6['body'][_0x78d3('0x83')];_0x5599fe[_0x78d3('0x5d')][_0x78d3('0x84')]=_0x1f99f6[_0x78d3('0x5d')][_0x78d3('0x85')];break;case _0x78d3('0x86'):_0x5599fe[_0x78d3('0x5d')][_0x78d3('0x81')]='+'+_0x1f99f6[_0x78d3('0x5d')][_0x78d3('0x87')];_0x5599fe[_0x78d3('0x5d')][_0x78d3('0x5d')]=_0x1f99f6[_0x78d3('0x5d')][_0x78d3('0x88')];break;case _0x78d3('0x89'):_0x5599fe['body']['from']=_0x1f99f6[_0x78d3('0x5d')][_0x78d3('0x81')];_0x5599fe[_0x78d3('0x5d')][_0x78d3('0x5d')]=_0x1f99f6['body']['message'];break;case'clicksend':_0x5599fe[_0x78d3('0x5d')][_0x78d3('0x81')]=_0x1f99f6[_0x78d3('0x5d')][_0x78d3('0x81')];_0x5599fe[_0x78d3('0x5d')][_0x78d3('0x5d')]=_0x1f99f6[_0x78d3('0x5d')]['body'];_0x5599fe[_0x78d3('0x5d')]['messageId']=_0x1f99f6[_0x78d3('0x5d')][_0x78d3('0x8a')];break;case'plivo':_0x5599fe[_0x78d3('0x5d')][_0x78d3('0x81')]=_0x1f99f6[_0x78d3('0x5d')][_0x78d3('0x82')];_0x5599fe[_0x78d3('0x5d')][_0x78d3('0x5d')]=_0x1f99f6[_0x78d3('0x5d')]['Text'];_0x5599fe[_0x78d3('0x5d')]['messageId']=_0x1f99f6[_0x78d3('0x5d')]['MessageUUID'];break;case'infobip':_0x5599fe[_0x78d3('0x5d')][_0x78d3('0x81')]='+'+_0x1f99f6[_0x78d3('0x5d')][_0x78d3('0x8b')][0x0]['from'];_0x5599fe[_0x78d3('0x5d')]['body']=_0x1f99f6[_0x78d3('0x5d')][_0x78d3('0x8b')][0x0][_0x78d3('0x88')];_0x5599fe['body'][_0x78d3('0x84')]=_0x1f99f6[_0x78d3('0x5d')][_0x78d3('0x8b')][0x0]['messageId'];break;case'csc':_0x5599fe[_0x78d3('0x5d')][_0x78d3('0x81')]=_0x1f99f6[_0x78d3('0x5d')]['originatingAddress'];_0x5599fe[_0x78d3('0x5d')][_0x78d3('0x5d')]=_0x1f99f6[_0x78d3('0x5d')][_0x78d3('0x8c')]['message'];break;case _0x78d3('0x8d'):_0x5599fe['body'][_0x78d3('0x81')]=_0x1f99f6['body'][_0x78d3('0x8e')];_0x5599fe[_0x78d3('0x5d')]['body']=_0x1f99f6['body'][_0x78d3('0x88')];_0x5599fe[_0x78d3('0x5d')]['messageId']=_0x1f99f6[_0x78d3('0x5d')][_0x78d3('0x8f')];break;case _0x78d3('0x90'):_0x5599fe[_0x78d3('0x5d')][_0x78d3('0x84')]=_0x1f99f6[_0x78d3('0x5d')][0x0][_0x78d3('0x27')]['id'];_0x5599fe[_0x78d3('0x5d')]['from']=_0x1f99f6['body'][0x0][_0x78d3('0x27')]['from'];_0x5599fe[_0x78d3('0x5d')][_0x78d3('0x5d')]=_0x1f99f6[_0x78d3('0x5d')][0x0]['message'][_0x78d3('0x88')];break;case _0x78d3('0x91'):_0x5599fe[_0x78d3('0x5d')][_0x78d3('0x81')]=_0x1f99f6['body'][_0x78d3('0x81')];_0x5599fe[_0x78d3('0x5d')][_0x78d3('0x5d')]=_0x1f99f6[_0x78d3('0x5d')][_0x78d3('0x27')];_0x5599fe[_0x78d3('0x5d')][_0x78d3('0x84')]=_0x1f99f6[_0x78d3('0x5d')][_0x78d3('0x92')];break;}}if(_0x5599fe[_0x78d3('0x5d')]['id']){delete _0x5599fe['body']['id'];}if(_[_0x78d3('0x93')](_0x5599fe[_0x78d3('0x5d')][_0x78d3('0x81')])){throw new db[(_0x78d3('0x94'))][(_0x78d3('0x7a'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x5599fe[_0x78d3('0x5d')][_0x78d3('0x5d')])||_0x5599fe[_0x78d3('0x5d')][_0x78d3('0x5d')]===''){throw new db[(_0x78d3('0x94'))][(_0x78d3('0x7a'))](_0x78d3('0x95'));}if(_[_0x78d3('0x93')](_0x5599fe[_0x78d3('0x5d')]['mapKey'])){throw new db['Sequelize'][(_0x78d3('0x7a'))](_0x78d3('0x96')+_0x336035);}if(!_['includes'](_0x336035,_0x5599fe[_0x78d3('0x5d')]['mapKey'])){throw new db[(_0x78d3('0x94'))][(_0x78d3('0x7a'))](_0x78d3('0x97')+_0x336035);}_0xce58a4[_0x5599fe[_0x78d3('0x5d')][_0x78d3('0x98')]]=_0x5599fe[_0x78d3('0x5d')]['from'];return db[_0x78d3('0x99')]['find']({'where':{'id':_0x5599fe[_0x78d3('0x75')][_0x78d3('0x9a')]},'include':[{'model':db[_0x78d3('0x79')],'as':_0x78d3('0x9b'),'where':_0xce58a4,'limit':0x1,'order':[[_0x78d3('0x7d'),_0x78d3('0x9c')]]}]});})[_0x78d3('0x22')](handleEntityNotFound(_0x4028a6,null))['then'](function(_0x5757cd){if(_0x5757cd){_0x5599fe['list']=_['omit'](_0x5757cd,[_0x78d3('0x9b')]);if(_0x5757cd[_0x78d3('0x9b')][_0x78d3('0x4c')]){return _0x5757cd[_0x78d3('0x9b')][0x0];}var _0x285d86=_['defaults'](_0x5599fe[_0x78d3('0x5d')],{'firstName':_0x5599fe[_0x78d3('0x5d')][_0x78d3('0x81')],'ListId':_0x5757cd['id']});_0x285d86[_0x5599fe[_0x78d3('0x5d')][_0x78d3('0x98')]]=_0x5599fe[_0x78d3('0x5d')][_0x78d3('0x81')];return db[_0x78d3('0x79')][_0x78d3('0x5c')](_0x285d86,{'fields':_0x1bb0dc,'raw':!![]});}})[_0x78d3('0x22')](handleEntityNotFound(_0x4028a6,null))[_0x78d3('0x22')](function(_0x3c5a5e){if(_0x3c5a5e){_0x5599fe[_0x78d3('0x9d')]=_0x3c5a5e;var _0x5bacce={'ContactId':_0x3c5a5e['id'],'phone':_0x5599fe['body'][_0x78d3('0x81')],'SmsAccountId':_0x1f99f6[_0x78d3('0x64')]['id']};var _0x347bc5={'ContactId':_0x3c5a5e['id'],'SmsAccountId':_0x1f99f6[_0x78d3('0x64')]['id'],'closed':![]};return db['SmsInteraction']['find']({'where':_0x347bc5})[_0x78d3('0x22')](function(_0x497b12){if(_0x497b12){return[_0x497b12,![]];}return db[_0x78d3('0x9e')][_0x78d3('0x5c')](_0x5bacce)[_0x78d3('0x22')](function(_0x3f1d9d){return[_0x3f1d9d,!![]];});});}})[_0x78d3('0x9f')](function(_0x589c88,_0x395aff){_0x5599fe[_0x78d3('0xa0')]=_0x589c88[_0x78d3('0x61')]({'plain':!![]});_0x5599fe[_0x78d3('0xa0')][_0x78d3('0xa1')]=![];if(_0x395aff){if(_0x5599fe[_0x78d3('0x75')][_0x78d3('0xa2')]){_0x5599fe[_0x78d3('0x76')]['push']({'id':0x0,'priority':_0x5599fe[_0x78d3('0x76')]['length']+0x1,'app':_0x78d3('0xa3'),'appdata':_0x78d3('0xa4'),'interval':'*,*,*,*'});}_0x5599fe[_0x78d3('0xa0')][_0x78d3('0xa1')]=!![];}return db[_0x78d3('0xa5')][_0x78d3('0x5c')]({'phone':_0x5599fe['body'][_0x78d3('0x81')],'messageId':_0x5599fe[_0x78d3('0x5d')]['messageId'],'body':_0x5599fe[_0x78d3('0x5d')][_0x78d3('0x5d')],'SmsAccountId':_0x1f99f6[_0x78d3('0x64')]['id'],'SmsInteractionId':_0x589c88['id'],'direction':'in','ContactId':_0x589c88[_0x78d3('0xa6')],'AttachmentId':_0x5599fe[_0x78d3('0x5d')][_0x78d3('0xa7')]});})[_0x78d3('0x22')](function(_0x56449c){_0x5599fe[_0x78d3('0x27')]=_0x56449c;if(_0x5599fe[_0x78d3('0xa0')]['UserId']){return db[_0x78d3('0xa8')][_0x78d3('0x5b')]({'attributes':['id',_0x78d3('0x3b')],'where':{'id':_0x5599fe[_0x78d3('0xa0')][_0x78d3('0xa9')]}})['then'](function(_0x58560b){if(_0x58560b){_0x5599fe[_0x78d3('0x76')][_0x78d3('0xaa')]({'id':0x0,'priority':0x0,'app':_0x78d3('0xab'),'appdata':_0x58560b[_0x78d3('0x3b')]+','+(_0x5599fe[_0x78d3('0x75')][_0x78d3('0xac')]||0xa),'interval':_0x78d3('0xad')});}return respondWithRpcPromise(_0x78d3('0xae'),_0x78d3('0xaf'),_0x5599fe);});}return respondWithRpcPromise('Start',_0x78d3('0xaf'),_0x5599fe);})[_0x78d3('0x22')](function(_0x16d6fa){if(_0x16d6fa){var _0x36ba66=0xc8;var _0x16dc1d=_0x78d3('0xb0');logger[_0x78d3('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x16dc1d,_0x36ba66,'entity\x20found');logger[_0x78d3('0xb1')](_0x78d3('0xb2'),_0x16dc1d,_0x36ba66,'entity\x20found',JSON[_0x78d3('0x24')](_0x16d6fa));if(_0x5599fe['account'][_0x78d3('0x42')]===_0x78d3('0x80')){return _0x4028a6[_0x78d3('0x2d')](_0x36ba66)['set'](_0x78d3('0xb3'),_0x78d3('0xb4'))[_0x78d3('0x3c')](_0x78d3('0xb5'));}else{return _0x4028a6['status'](_0x36ba66)[_0x78d3('0x2f')](_0x16d6fa);}}})[_0x78d3('0x2b')](handleError(_0x4028a6,null));};exports[_0x78d3('0xb6')]=function(_0x3e7173,_0x1c532a){var _0x43baec=_0x3e7173['params']['id'];var _0x2720e7=_0x3e7173[_0x78d3('0x5d')];var _0x2ec320=0xc8;var _0x5f375f=null;return db['sequelize'][_0x78d3('0xb7')]({'isolationLevel':db[_0x78d3('0xb8')][_0x78d3('0xb9')]['ISOLATION_LEVELS'][_0x78d3('0xba')]},function(_0x21597d){return db['SmsAccount']['findOne']({'where':{'id':_0x43baec},'transaction':_0x21597d})[_0x78d3('0x22')](function(_0x34d367){if(_0x34d367){return db[_0x78d3('0x73')][_0x78d3('0x38')]({'where':{'SmsAccountId':_0x43baec},'transaction':_0x21597d})[_0x78d3('0x22')](function(){var _0xaba06b=_[_0x78d3('0x45')](_0x2720e7,function(_0x3fd0d4){_0x3fd0d4[_0x78d3('0x67')]=_0x43baec;return _0x3fd0d4;});return db['SmsApplication']['bulkCreate'](_0xaba06b,{'transaction':_0x21597d});});}else{_0x2ec320=0x194;_0x5f375f=[];}});})[_0x78d3('0x22')](function(){if(_0x2ec320!==0x194){return db[_0x78d3('0x73')][_0x78d3('0xbb')]({'where':{'SmsAccountId':_0x43baec},'order':_0x78d3('0x77')})[_0x78d3('0x22')](function(_0x4e4d63){_0x5f375f=_0x4e4d63;});}})[_0x78d3('0x2b')](function(_0x340e10){_0x2ec320=0x1f4;logger[_0x78d3('0x25')](_0x340e10[_0x78d3('0x3a')]);if(_0x340e10[_0x78d3('0x3b')]){delete _0x340e10[_0x78d3('0x3b')];}_0x5f375f=_0x340e10;})[_0x78d3('0xbc')](function(){if(_0x5f375f===null){_0x1c532a[_0x78d3('0x2c')](_0x2ec320);}else{if(_0x2ec320===0x1f4){_0x1c532a['status'](_0x2ec320)[_0x78d3('0x3c')](_0x5f375f);}else{_0x1c532a[_0x78d3('0x2d')](_0x2ec320)['json'](_0x5f375f);}}});};exports[_0x78d3('0xbd')]=function(_0x419253,_0x2a0f0e,_0xdf1a63){var _0x12f0a3={};var _0x4839cc={};var _0x4f4838;var _0x4fb3a0;return db[_0x78d3('0x3f')][_0x78d3('0x6a')]({'where':{'id':_0x419253[_0x78d3('0x64')]['id']}})[_0x78d3('0x22')](handleEntityNotFound(_0x2a0f0e,null))[_0x78d3('0x22')](function(_0x29d612){if(_0x29d612){_0x4f4838=_0x29d612;_0x4839cc[_0x78d3('0x44')]=_[_0x78d3('0x47')](db[_0x78d3('0x73')]['rawAttributes']);_0x4839cc[_0x78d3('0x46')]=_['keys'](_0x419253[_0x78d3('0x46')]);_0x4839cc[_0x78d3('0x48')]=_[_0x78d3('0x4a')](_0x4839cc[_0x78d3('0x44')],_0x4839cc[_0x78d3('0x46')]);_0x12f0a3[_0x78d3('0x49')]=_['intersection'](_0x4839cc[_0x78d3('0x44')],qs['fields'](_0x419253['query']['fields']));_0x12f0a3[_0x78d3('0x49')]=_0x12f0a3[_0x78d3('0x49')][_0x78d3('0x4c')]?_0x12f0a3['attributes']:_0x4839cc[_0x78d3('0x44')];_0x12f0a3[_0x78d3('0x4e')]=qs['sort'](_0x419253[_0x78d3('0x46')]['sort']);_0x12f0a3[_0x78d3('0x50')]=qs[_0x78d3('0x48')](_[_0x78d3('0x51')](_0x419253[_0x78d3('0x46')],_0x4839cc[_0x78d3('0x48')]));if(_0x419253[_0x78d3('0x46')][_0x78d3('0x52')]){_0x12f0a3[_0x78d3('0x50')]=_[_0x78d3('0x53')](_0x12f0a3[_0x78d3('0x50')],{'$or':_[_0x78d3('0x45')](_0x12f0a3[_0x78d3('0x49')],function(_0x12dc47){var _0x18e7cc={};_0x18e7cc[_0x12dc47]={'$like':'%'+_0x419253[_0x78d3('0x46')][_0x78d3('0x52')]+'%'};return _0x18e7cc;})});}_0x12f0a3=_[_0x78d3('0x53')]({},_0x12f0a3,_0x419253[_0x78d3('0x54')]);return _0x4f4838[_0x78d3('0xbd')](_0x12f0a3);}})['then'](function(_0xbbcb21){if(_0xbbcb21){_0x4fb3a0=_0xbbcb21[_0x78d3('0x4c')];if(!_0x419253[_0x78d3('0x46')][_0x78d3('0x6b')]('nolimit')){_0x12f0a3[_0x78d3('0x32')]=qs['limit'](_0x419253[_0x78d3('0x46')][_0x78d3('0x32')]);_0x12f0a3[_0x78d3('0x30')]=qs[_0x78d3('0x30')](_0x419253[_0x78d3('0x46')][_0x78d3('0x30')]);}return _0x4f4838[_0x78d3('0xbd')](_0x12f0a3);}})[_0x78d3('0x22')](function(_0x290bf6){if(_0x290bf6){return _0x290bf6?{'count':_0x4fb3a0,'rows':_0x290bf6}:null;}})[_0x78d3('0x22')](respondWithResult(_0x2a0f0e,null))[_0x78d3('0x2b')](handleError(_0x2a0f0e,null));};exports['getInteractions']=function(_0x5b42af,_0x49babd,_0x20130f){var _0x83afa2={'raw':![],'where':{}};var _0x5c4a3f={};var _0x1abfd0={'count':0x0,'rows':[]};return db[_0x78d3('0x3f')][_0x78d3('0x6a')]({'where':{'id':_0x5b42af[_0x78d3('0x64')]['id']}})['then'](handleEntityNotFound(_0x49babd,null))[_0x78d3('0x22')](function(_0x2f0bad){if(_0x2f0bad){_0x5c4a3f['model']=_['keys'](db[_0x78d3('0x9e')][_0x78d3('0x40')]);_0x5c4a3f['query']=_[_0x78d3('0x47')](_0x5b42af['query']);_0x5c4a3f[_0x78d3('0x48')]=_[_0x78d3('0x4a')](_0x5c4a3f[_0x78d3('0x44')],_0x5c4a3f['query']);_0x83afa2[_0x78d3('0x49')]=_[_0x78d3('0x4a')](_0x5c4a3f['model'],qs[_0x78d3('0x4b')](_0x5b42af[_0x78d3('0x46')][_0x78d3('0x4b')]));_0x83afa2[_0x78d3('0x49')]=_0x83afa2[_0x78d3('0x49')][_0x78d3('0x4c')]?_0x83afa2[_0x78d3('0x49')]:_0x5c4a3f[_0x78d3('0x44')];if(!_0x5b42af[_0x78d3('0x46')][_0x78d3('0x6b')]('nolimit')){_0x83afa2['limit']=qs[_0x78d3('0x32')](_0x5b42af[_0x78d3('0x46')][_0x78d3('0x32')]);_0x83afa2[_0x78d3('0x30')]=qs['offset'](_0x5b42af[_0x78d3('0x46')][_0x78d3('0x30')]);}_0x83afa2[_0x78d3('0x4e')]=qs[_0x78d3('0x4f')](_0x5b42af[_0x78d3('0x46')]['sort']);_0x83afa2['where']=qs[_0x78d3('0x48')](_[_0x78d3('0x51')](_0x5b42af[_0x78d3('0x46')],_0x5c4a3f[_0x78d3('0x48')]));_0x83afa2['where'][_0x78d3('0x67')]=_0x2f0bad['id'];if(_0x5b42af[_0x78d3('0x46')][_0x78d3('0x52')]){_0x83afa2['where']=_[_0x78d3('0x53')](_0x83afa2[_0x78d3('0x50')],{'$or':_[_0x78d3('0x45')](_0x83afa2[_0x78d3('0x49')],function(_0x50b600){var _0x27eb10={};_0x27eb10[_0x50b600]={'$like':'%'+_0x5b42af[_0x78d3('0x46')][_0x78d3('0x52')]+'%'};return _0x27eb10;})});}_0x83afa2=_[_0x78d3('0x53')]({},_0x83afa2,_0x5b42af[_0x78d3('0x54')]);return db['SmsInteraction'][_0x78d3('0x31')]({'where':_0x83afa2[_0x78d3('0x50')]})[_0x78d3('0x22')](function(_0x1a2ae0){_0x1abfd0[_0x78d3('0x31')]=_0x1a2ae0;if(_0x5b42af[_0x78d3('0x46')]['includeAll']){_0x83afa2[_0x78d3('0x56')]=[{'model':db[_0x78d3('0x79')],'as':'Contact','required':![]},{'model':db[_0x78d3('0xa8')],'as':'Owner','attributes':['name','fullname',_0x78d3('0xbe')],'required':![]},{'model':db[_0x78d3('0xbf')],'as':_0x78d3('0xc0'),'attributes':['id',_0x78d3('0x3b'),_0x78d3('0xc1')],'where':_0x5b42af[_0x78d3('0x46')][_0x78d3('0xc2')]?{'id':_0x5b42af[_0x78d3('0x46')][_0x78d3('0xc2')]}:undefined,'required':_0x5b42af['query']['tag']?!![]:![]}];}return db[_0x78d3('0x9e')]['findAll'](_0x83afa2);})[_0x78d3('0x22')](function(_0x473ffb){_0x1abfd0[_0x78d3('0x58')]=_0x473ffb;return _0x1abfd0;});}})[_0x78d3('0x22')](respondWithFilteredResult(_0x49babd,_0x83afa2))[_0x78d3('0x2b')](handleError(_0x49babd,null));};exports[_0x78d3('0x3c')]=function(_0x39846c,_0x1c1263,_0x573d45){var _0x527ff5,_0x21e1c8,_0x57442d;if(_['isNil'](_0x39846c['body'][_0x78d3('0x5d')])||_0x39846c['body'][_0x78d3('0x5d')]===''){throw new db[(_0x78d3('0x94'))][(_0x78d3('0x7a'))](_0x78d3('0x95'));}if(_[_0x78d3('0x93')](_0x39846c[_0x78d3('0x5d')]['to'])){throw new db[(_0x78d3('0x94'))][(_0x78d3('0x7a'))]('to\x20is\x20mandatory');}_0x527ff5=_0x39846c['body']['to'];return db['SmsAccount']['find']({'where':{'id':_0x39846c[_0x78d3('0x64')]['id']},'include':[{'model':db[_0x78d3('0x99')],'as':_0x78d3('0xc3'),'include':[{'model':db['CmContact'],'as':_0x78d3('0x9b'),'where':{'mobile':_0x527ff5},'limit':0x1,'order':[[_0x78d3('0x7d'),'DESC']]}]}]})[_0x78d3('0x22')](handleEntityNotFound(_0x1c1263,null))['then'](function(_0x579716){if(_0x579716&&_0x579716[_0x78d3('0xc3')]){_0x21e1c8=_0x579716['get']({'plain':!![]});if(_0x21e1c8[_0x78d3('0xc3')]&&_0x21e1c8[_0x78d3('0xc3')]['Contacts'][_0x78d3('0x4c')]){return _0x21e1c8[_0x78d3('0xc3')][_0x78d3('0x9b')][0x0];}return db[_0x78d3('0x79')]['create'](_[_0x78d3('0x1b')](_0x39846c[_0x78d3('0x5d')],{'firstName':_0x527ff5,'mobile':_0x527ff5,'phone':_0x527ff5,'ListId':_0x21e1c8['ListId']}));}})[_0x78d3('0x22')](handleEntityNotFound(_0x1c1263,null))[_0x78d3('0x22')](function(_0x1648cb){if(_0x1648cb){_0x57442d=_0x1648cb;return db[_0x78d3('0x9e')][_0x78d3('0x5b')]({'where':{'ContactId':_0x57442d['id'],'closed':![],'SmsAccountId':_0x21e1c8['id']}})[_0x78d3('0x22')](function(_0x2d84b5){if(_0x2d84b5){return[_0x2d84b5,![]];}return db[_0x78d3('0x9e')][_0x78d3('0x5c')]({'UserId':_0x39846c[_0x78d3('0x5e')]['id'],'ContactId':_0x57442d['id'],'SmsAccountId':_0x21e1c8['id'],'phone':_0x527ff5,'firstMsgDirection':'out','Messages':[_[_0x78d3('0x53')](_0x39846c[_0x78d3('0x5d')],{'read':![],'body':_0x39846c['body'][_0x78d3('0x5d')],'phone':_0x527ff5,'SmsAccountId':_0x21e1c8['id'],'UserId':_0x39846c[_0x78d3('0x5e')]['id'],'ContactId':_0x57442d['id']})]},{'include':[{'model':db[_0x78d3('0xa5')],'as':_0x78d3('0xc4')}]})[_0x78d3('0x22')](function(_0x59277e){return[_0x59277e,!![]];});});}})[_0x78d3('0x9f')](function(_0x588f26,_0x5ec212){if(_0x5ec212){return _0x588f26;}return db['SmsMessage'][_0x78d3('0x5c')](_[_0x78d3('0x53')](_0x39846c[_0x78d3('0x5d')],{'read':![],'body':_0x39846c['body']['body'],'phone':_0x527ff5,'SmsAccountId':_0x21e1c8['id'],'SmsInteractionId':_0x588f26['id'],'UserId':_0x39846c[_0x78d3('0x5e')]['id'],'ContactId':_0x57442d['id']}))[_0x78d3('0x22')](function(_0x4cca25){_0x588f26[_0x78d3('0xc5')]['Messages']=[];_0x588f26[_0x78d3('0xc5')][_0x78d3('0xc4')][_0x78d3('0xc6')](_0x4cca25['dataValues']);return _0x588f26;});})['then'](respondWithResult(_0x1c1263,null))[_0x78d3('0x2b')](handleError(_0x1c1263,null));};exports['status']=function(_0x3ba7d,_0xcb7ac0,_0x5a7fc0){if(_0x3ba7d[_0x78d3('0x5d')]['id']){delete _0x3ba7d['body']['id'];}var _0x1a31d0,_0x62b1e1,_0x13027a;return db[_0x78d3('0x3f')][_0x78d3('0x5b')]({'where':{'id':_0x3ba7d[_0x78d3('0x64')]['id']}})['then'](handleEntityNotFound(_0xcb7ac0,null))[_0x78d3('0x22')](function(_0x332881){if(_0x332881){_0x13027a=_0x332881;logger[_0x78d3('0xb1')](_0x78d3('0x23'),_0x78d3('0x2d'),_0x78d3('0xc7'),_0x332881[_0x78d3('0x42')],util[_0x78d3('0xc8')](_0x3ba7d[_0x78d3('0x5d')],{'showHidden':![],'depth':null}));switch(_0x332881['type']){case _0x78d3('0x86'):if(_0x3ba7d[_0x78d3('0x5d')][_0x78d3('0xc9')]&&_0x3ba7d['body'][_0x78d3('0x2d')]){_0x62b1e1=_0x3ba7d[_0x78d3('0x5d')][_0x78d3('0x2d')];return db[_0x78d3('0xa5')][_0x78d3('0x5b')]({'where':{'messageId':_0x3ba7d[_0x78d3('0x5d')]['skebby_dispatch_id']}});}break;case'connectel':if(_0x3ba7d[_0x78d3('0x5d')]['requestid']&&_0x3ba7d['body'][_0x78d3('0xca')]){_0x62b1e1=_0x3ba7d[_0x78d3('0x5d')][_0x78d3('0xca')];return db[_0x78d3('0xa5')][_0x78d3('0x5b')]({'where':{'messageId':_0x3ba7d[_0x78d3('0x5d')][_0x78d3('0xcb')]}});}break;case _0x78d3('0xcc'):if(_0x3ba7d[_0x78d3('0x5d')]['message_id']&&_0x3ba7d[_0x78d3('0x5d')]['status_code']){_0x62b1e1=_0x3ba7d[_0x78d3('0x5d')][_0x78d3('0xcd')];return db[_0x78d3('0xa5')][_0x78d3('0x5b')]({'where':{'messageId':_0x3ba7d['body'][_0x78d3('0x8a')]}});}break;case _0x78d3('0xce'):var _0x352b5f=_0x3ba7d[_0x78d3('0x5d')][_0x78d3('0x8b')][0x0];if(_0x352b5f[_0x78d3('0x84')]&&_0x352b5f[_0x78d3('0x2d')]['groupName']===_0x78d3('0xcf')){_0x62b1e1=_0x352b5f[_0x78d3('0x2d')][_0x78d3('0xd0')];return db[_0x78d3('0xa5')][_0x78d3('0x5b')]({'where':{'messageId':_0x352b5f[_0x78d3('0x84')]}});}break;case _0x78d3('0x8d'):if(_0x3ba7d[_0x78d3('0x5d')][_0x78d3('0x84')]&&_0x3ba7d[_0x78d3('0x5d')][_0x78d3('0x2d')]){_0x62b1e1=_0x3ba7d[_0x78d3('0x5d')][_0x78d3('0x2d')];return db[_0x78d3('0xa5')][_0x78d3('0x5b')]({'where':{'messageId':_0x3ba7d[_0x78d3('0x5d')][_0x78d3('0x84')]}});}break;case _0x78d3('0x90'):if(_0x3ba7d['body'][0x0]['message']['id']){_0x62b1e1=_0x3ba7d[_0x78d3('0x5d')][0x0][_0x78d3('0x42')];return db[_0x78d3('0xa5')]['find']({'where':{'messageId':_0x3ba7d[_0x78d3('0x5d')][0x0][_0x78d3('0x27')]['id']}});}break;case'intelepeer':if(_0x3ba7d[_0x78d3('0x5d')]['redif']&&_0x3ba7d[_0x78d3('0x5d')]['status']){_0x62b1e1=_0x3ba7d[_0x78d3('0x5d')][_0x78d3('0x2d')];return db['SmsMessage'][_0x78d3('0x5b')]({'where':{'messageId':_0x3ba7d[_0x78d3('0x5d')][_0x78d3('0xd1')]}});}break;}}})[_0x78d3('0x22')](handleEntityNotFound(_0xcb7ac0,null))[_0x78d3('0x22')](function(_0x191652){if(_0x191652){_0x1a31d0=_0x191652;switch(_0x13027a[_0x78d3('0x42')]){case _0x78d3('0x86'):if(_0x62b1e1===_0x78d3('0xcf')){return _0x1a31d0[_0x78d3('0xd2')]({'read':!![]});}else{logger['error'](_0x78d3('0x23'),_0x78d3('0x2d'),_0x78d3('0x86'),util[_0x78d3('0xc8')](_0x3ba7d['body'],{'showHidden':![],'depth':null}));}break;case _0x78d3('0x89'):if(_0x62b1e1==='1'){return _0x1a31d0[_0x78d3('0xd2')]({'read':!![]});}else{logger[_0x78d3('0x25')](_0x78d3('0x23'),'status','skebby',util['inspect'](_0x3ba7d[_0x78d3('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x78d3('0xcc'):if(!_0x3ba7d['body'][_0x78d3('0xd3')]&&_0x62b1e1>=0xc8&&_0x62b1e1<=0xce){return _0x1a31d0[_0x78d3('0xd2')]({'read':!![]});}else{logger[_0x78d3('0x25')](_0x78d3('0x23'),_0x78d3('0x2d'),'clicksend',util[_0x78d3('0xc8')](_0x3ba7d[_0x78d3('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x78d3('0xce'):var _0x204f8d=_0x3ba7d[_0x78d3('0x5d')][_0x78d3('0x8b')][0x0];if(_0x204f8d[_0x78d3('0x2d')]['groupName']===_0x78d3('0xcf')){return _0x1a31d0[_0x78d3('0xd2')]({'read':!![]});}else{logger['error'](_0x78d3('0x23'),'status',_0x78d3('0xce'),util[_0x78d3('0xc8')](_0x3ba7d['body'],{'showHidden':![],'depth':null}));}break;case _0x78d3('0x8d'):if(_0x62b1e1==_0x78d3('0xd4')||_0x62b1e1==_0x78d3('0xd5')){return _0x1a31d0[_0x78d3('0xd2')]({'read':!![]});}else{logger[_0x78d3('0x25')](_0x78d3('0x23'),_0x78d3('0x2d'),'clickatell',util['inspect'](_0x3ba7d[_0x78d3('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x78d3('0x90'):if(_0x62b1e1==_0x78d3('0xd6')){return _0x1a31d0[_0x78d3('0xd2')]({'read':!![]});}else{logger['error'](_0x78d3('0x23'),_0x78d3('0x2d'),_0x78d3('0x90'),util[_0x78d3('0xc8')](_0x3ba7d[_0x78d3('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x78d3('0x91'):if(_0x62b1e1===_0x78d3('0xd7')||_0x62b1e1==='ACCEPTD'){return _0x1a31d0[_0x78d3('0xd2')]({'read':!![]});}else{logger[_0x78d3('0x25')](_0x78d3('0x23'),_0x78d3('0x2d'),_0x78d3('0x91'),util[_0x78d3('0xc8')](_0x3ba7d[_0x78d3('0x5d')],{'showHidden':![],'depth':null}));}break;}return _0x1a31d0;}})[_0x78d3('0x22')](respondWithResult(_0xcb7ac0,null))['catch'](handleError(_0xcb7ac0,null));};exports[_0x78d3('0xd8')]=function(_0x3fd1d7,_0x559759,_0x399f92){var _0xebf659,_0x1b17b2,_0x3b0e9e;return db['SmsAccount'][_0x78d3('0x5b')]({'where':{'id':_0x3fd1d7[_0x78d3('0x64')]['id']}})[_0x78d3('0x22')](handleEntityNotFound(_0x559759,null))[_0x78d3('0x22')](function(_0x407fdf){if(_0x407fdf){_0x3b0e9e=_0x407fdf;logger[_0x78d3('0xb1')](_0x78d3('0x23'),_0x78d3('0x2d'),_0x78d3('0xc7'),_0x407fdf[_0x78d3('0x42')],util[_0x78d3('0xc8')](_0x3fd1d7[_0x78d3('0x46')],{'showHidden':![],'depth':null}));switch(_0x407fdf['type']){case _0x78d3('0xd9'):if(_0x3fd1d7[_0x78d3('0x46')][_0x78d3('0xda')]&&_0x3fd1d7[_0x78d3('0x46')][_0x78d3('0xdb')]){_0x1b17b2=_0x3fd1d7[_0x78d3('0x46')][_0x78d3('0xdb')];return db[_0x78d3('0xa5')][_0x78d3('0x5b')]({'where':{'messageId':_0x3fd1d7[_0x78d3('0x46')][_0x78d3('0xda')]}});}break;}}})['then'](handleEntityNotFound(_0x559759,null))[_0x78d3('0x22')](function(_0xea1abc){if(_0xea1abc){_0xebf659=_0xea1abc;switch(_0x3b0e9e[_0x78d3('0x42')]){case _0x78d3('0xd9'):if(_0x1b17b2==='2'||_0x1b17b2==='6'){return _0xebf659[_0x78d3('0xd2')]({'read':!![]});}else{logger[_0x78d3('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x78d3('0x2d'),_0x78d3('0xd9'),util[_0x78d3('0xc8')](_0x3fd1d7[_0x78d3('0x46')],{'showHidden':![],'depth':null}));};break;}return _0xebf659;}})[_0x78d3('0x22')](respondWithResult(_0x559759,null))['catch'](handleError(_0x559759,null));};exports[_0x78d3('0xdc')]=function(_0x5bcd6c,_0x4b5d86,_0x52af7f){return db[_0x78d3('0x3f')][_0x78d3('0x5b')]({'where':{'id':_0x5bcd6c[_0x78d3('0x64')]['id']}})[_0x78d3('0x22')](handleEntityNotFound(_0x4b5d86,null))[_0x78d3('0x22')](function(_0x11a8d1){if(_0x11a8d1){return _0x11a8d1[_0x78d3('0xdc')](_0x5bcd6c['body'][_0x78d3('0x6d')],_[_0x78d3('0xdd')](_0x5bcd6c[_0x78d3('0x5d')],[_0x78d3('0x6d'),'id'])||{})['spread'](function(_0x360435){for(var _0x409263=0x0;_0x409263<_0x5bcd6c[_0x78d3('0x5d')][_0x78d3('0x6d')][_0x78d3('0x4c')];_0x409263+=0x1){socket[_0x78d3('0xde')](_0x78d3('0xdf'),{'UserId':Number(_0x5bcd6c[_0x78d3('0x5d')]['ids'][_0x409263]),'SmsAccountId':Number(_0x5bcd6c[_0x78d3('0x64')]['id'])});}return _0x360435;});}})['then'](respondWithResult(_0x4b5d86,null))[_0x78d3('0x2b')](handleError(_0x4b5d86,null));};exports[_0x78d3('0xe0')]=function(_0x304eef,_0x1dfcb5,_0x401e63){return db[_0x78d3('0x3f')]['find']({'where':{'id':_0x304eef['params']['id']}})['then'](handleEntityNotFound(_0x1dfcb5,null))[_0x78d3('0x22')](function(_0x1f90a6){if(_0x1f90a6){return _0x1f90a6['removeAgents'](_0x304eef['query']['ids'])[_0x78d3('0x22')](function(){if(_[_0x78d3('0xe1')](_0x304eef[_0x78d3('0x46')][_0x78d3('0x6d')])){for(var _0x23a764=0x0;_0x23a764<_0x304eef[_0x78d3('0x46')][_0x78d3('0x6d')][_0x78d3('0x4c')];_0x23a764+=0x1){socket[_0x78d3('0xde')](_0x78d3('0xe2'),{'UserId':Number(_0x304eef[_0x78d3('0x46')][_0x78d3('0x6d')][_0x23a764]),'SmsAccountId':Number(_0x304eef['params']['id'])});}}else{socket[_0x78d3('0xde')](_0x78d3('0xe2'),{'UserId':Number(_0x304eef[_0x78d3('0x46')][_0x78d3('0x6d')]),'SmsAccountId':Number(_0x304eef[_0x78d3('0x64')]['id'])});}});}})[_0x78d3('0x22')](respondWithStatusCode(_0x1dfcb5,null))[_0x78d3('0x2b')](handleError(_0x1dfcb5,null));};exports[_0x78d3('0xe3')]=function(_0x2ceae7,_0xff7645,_0x93b595){var _0x2bd584={};var _0x103f56={};var _0x343a88;var _0x3bb18f;return db[_0x78d3('0x3f')][_0x78d3('0x6a')]({'where':{'id':_0x2ceae7[_0x78d3('0x64')]['id']}})[_0x78d3('0x22')](handleEntityNotFound(_0xff7645,null))[_0x78d3('0x22')](function(_0x2afe8c){if(_0x2afe8c){_0x343a88=_0x2afe8c;_0x103f56['model']=_['keys'](db[_0x78d3('0xa8')][_0x78d3('0x40')]);_0x103f56[_0x78d3('0x46')]=_[_0x78d3('0x47')](_0x2ceae7['query']);_0x103f56['filters']=_[_0x78d3('0x4a')](_0x103f56[_0x78d3('0x44')],_0x103f56[_0x78d3('0x46')]);_0x2bd584[_0x78d3('0x49')]=_['intersection'](_0x103f56[_0x78d3('0x44')],qs[_0x78d3('0x4b')](_0x2ceae7['query'][_0x78d3('0x4b')]));_0x2bd584['attributes']=_0x2bd584[_0x78d3('0x49')][_0x78d3('0x4c')]?_0x2bd584['attributes']:_0x103f56[_0x78d3('0x44')];_0x2bd584['order']=qs[_0x78d3('0x4f')](_0x2ceae7[_0x78d3('0x46')][_0x78d3('0x4f')]);_0x2bd584[_0x78d3('0x50')]=qs[_0x78d3('0x48')](_['pick'](_0x2ceae7[_0x78d3('0x46')],_0x103f56[_0x78d3('0x48')]));if(_0x2ceae7[_0x78d3('0x46')][_0x78d3('0x52')]){_0x2bd584[_0x78d3('0x50')]=_[_0x78d3('0x53')](_0x2bd584['where'],{'$or':_[_0x78d3('0x45')](_0x2bd584[_0x78d3('0x49')],function(_0x22fc91){var _0x4c99d0={};_0x4c99d0[_0x22fc91]={'$like':'%'+_0x2ceae7[_0x78d3('0x46')][_0x78d3('0x52')]+'%'};return _0x4c99d0;})});}_0x2bd584=_[_0x78d3('0x53')]({},_0x2bd584,_0x2ceae7[_0x78d3('0x54')]);return _0x343a88['getAgents'](_0x2bd584);}})[_0x78d3('0x22')](function(_0x1c4adc){if(_0x1c4adc){_0x3bb18f=_0x1c4adc[_0x78d3('0x4c')];if(!_0x2ceae7[_0x78d3('0x46')][_0x78d3('0x6b')]('nolimit')){_0x2bd584[_0x78d3('0x32')]=qs[_0x78d3('0x32')](_0x2ceae7[_0x78d3('0x46')][_0x78d3('0x32')]);_0x2bd584[_0x78d3('0x30')]=qs['offset'](_0x2ceae7[_0x78d3('0x46')]['offset']);}return _0x343a88['getAgents'](_0x2bd584);}})['then'](function(_0x43464a){if(_0x43464a){return _0x43464a?{'count':_0x3bb18f,'rows':_0x43464a}:null;}})[_0x78d3('0x22')](respondWithResult(_0xff7645,null))[_0x78d3('0x2b')](handleError(_0xff7645,null));}; \ No newline at end of file +var _0x6ae7=['status_code','groupName','DELIVERED','inspect','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','statusGet','csc','message-id','state','addAgents','emit','removeAgents','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','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','../../config/license/util','../../mysqldb','redis','defaults','localhost','./smsAccount.socket','register','jayson/promise','http','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','get','SmsAccounts','UserProfileResource','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','params','rawAttributes','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','nolimit','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','sms','SmsApplication','Applications','applications','orderBy','account','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','difference','updatedAt','ListId','mobile','from','Body','messageId','MessageSid','connectel','clicksend','message_id','plivo','From','Text','MessageUUID','infobip','results','text','clickatell','replyMessageId','bandwidth','intelepeer','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','Contacts','DESC','list','contact','SmsInteraction','spread','autoclose','push','close','interaction','created','ContactId','UserId','User','unshift','agent','*,*,*,*','Start','startRouting','receiveMessage','entity\x20found','debug','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','sequelize','transaction','Transaction','bulkCreate','findAndCountAll','priority','finally','getApplications','getInteractions','Contact','Owner','fullname','internal','Tags','tag','to\x20is\x20mandatory','List','out','Messages','SmsMessage','dataValues','received\x20delivery\x20report\x20from','skebby','skebby_dispatch_id','requestid','statusInt'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x6ae7,0xf9));var _0x76ae=function(_0x278a3d,_0x64e73a){_0x278a3d=_0x278a3d-0x0;var _0x35145b=_0x6ae7[_0x278a3d];return _0x35145b;};'use strict';var emlformat=require(_0x76ae('0x0'));var rimraf=require(_0x76ae('0x1'));var zipdir=require(_0x76ae('0x2'));var jsonpatch=require(_0x76ae('0x3'));var rp=require(_0x76ae('0x4'));var moment=require(_0x76ae('0x5'));var BPromise=require(_0x76ae('0x6'));var Mustache=require(_0x76ae('0x7'));var util=require(_0x76ae('0x8'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x76ae('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x76ae('0xa'));var squel=require(_0x76ae('0xb'));var crypto=require(_0x76ae('0xc'));var jsforce=require(_0x76ae('0xd'));var deskjs=require(_0x76ae('0xe'));var toCsv=require('to-csv');var querystring=require(_0x76ae('0xf'));var Papa=require(_0x76ae('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x76ae('0x11'));var as=require(_0x76ae('0x12'));var hardwareService=require(_0x76ae('0x13'));var logger=require(_0x76ae('0x14'))(_0x76ae('0x15'));var utils=require(_0x76ae('0x16'));var config=require(_0x76ae('0x17'));var licenseUtil=require(_0x76ae('0x18'));var db=require(_0x76ae('0x19'))['db'];config[_0x76ae('0x1a')]=_[_0x76ae('0x1b')](config[_0x76ae('0x1a')],{'host':_0x76ae('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x76ae('0x1a')]));require(_0x76ae('0x1d'))[_0x76ae('0x1e')](socket);var jayson=require(_0x76ae('0x1f'));var client=jayson['client'][_0x76ae('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x33c572,_0x1fd655,_0x5852dc,_0xbccd36){return new BPromise(function(_0x4b6b91,_0x48ce84){var _0x267894=_0xbccd36||client;return _0x267894[_0x76ae('0x21')](_0x33c572,_0x5852dc)[_0x76ae('0x22')](function(_0x404be1){logger[_0x76ae('0x23')](_0x76ae('0x24'),_0x1fd655,_0x76ae('0x25'));logger['debug'](_0x76ae('0x26'),_0x1fd655,_0x76ae('0x25'),JSON[_0x76ae('0x27')](_0x404be1));if(_0x404be1['error']){if(_0x404be1[_0x76ae('0x28')][_0x76ae('0x29')]===0x1f4){logger[_0x76ae('0x28')](_0x76ae('0x24'),_0x1fd655,_0x404be1[_0x76ae('0x28')][_0x76ae('0x2a')]);return _0x48ce84(_0x404be1[_0x76ae('0x28')][_0x76ae('0x2a')]);}logger[_0x76ae('0x28')]('SmsAccount,\x20%s,\x20%s',_0x1fd655,_0x404be1[_0x76ae('0x28')][_0x76ae('0x2a')]);return _0x4b6b91(_0x404be1[_0x76ae('0x28')][_0x76ae('0x2a')]);}else{logger[_0x76ae('0x23')](_0x76ae('0x24'),_0x1fd655,'request\x20sent');_0x4b6b91(_0x404be1['result'][_0x76ae('0x2a')]);}})[_0x76ae('0x2b')](function(_0x1a3fd8){logger[_0x76ae('0x28')](_0x76ae('0x24'),_0x1fd655,_0x1a3fd8);_0x48ce84(_0x1a3fd8);});});}function respondWithStatusCode(_0x4a1c42,_0x3f9ab4){_0x3f9ab4=_0x3f9ab4||0xcc;return function(_0x318349){if(_0x318349){return _0x4a1c42['sendStatus'](_0x3f9ab4);}return _0x4a1c42[_0x76ae('0x2c')](_0x3f9ab4)[_0x76ae('0x2d')]();};}function respondWithResult(_0x15c0f4,_0x821714){_0x821714=_0x821714||0xc8;return function(_0x38102a){if(_0x38102a){return _0x15c0f4[_0x76ae('0x2c')](_0x821714)[_0x76ae('0x2e')](_0x38102a);}};}function respondWithFilteredResult(_0x34df87,_0x1b77d0){return function(_0x15e9e6){if(_0x15e9e6){var _0x12e20b=typeof _0x1b77d0[_0x76ae('0x2f')]===_0x76ae('0x30')&&typeof _0x1b77d0[_0x76ae('0x31')]===_0x76ae('0x30');var _0x3ee4de=_0x15e9e6[_0x76ae('0x32')];var _0x69f9b4=_0x12e20b?0x0:_0x1b77d0[_0x76ae('0x2f')];var _0x55ce26=_0x12e20b?_0x15e9e6[_0x76ae('0x32')]:_0x1b77d0[_0x76ae('0x2f')]+_0x1b77d0[_0x76ae('0x31')];var _0x5d33f1;if(_0x55ce26>=_0x3ee4de){_0x55ce26=_0x3ee4de;_0x5d33f1=0xc8;}else{_0x5d33f1=0xce;}_0x34df87['status'](_0x5d33f1);return _0x34df87[_0x76ae('0x33')](_0x76ae('0x34'),_0x69f9b4+'-'+_0x55ce26+'/'+_0x3ee4de)['json'](_0x15e9e6);}return null;};}function patchUpdates(_0x242b60){return function(_0x22e98e){try{jsonpatch[_0x76ae('0x35')](_0x22e98e,_0x242b60,!![]);}catch(_0x379952){return BPromise[_0x76ae('0x36')](_0x379952);}return _0x22e98e[_0x76ae('0x37')]();};}function saveUpdates(_0x31ec05,_0x185f0f){return function(_0x38daf7){if(_0x38daf7){return _0x38daf7[_0x76ae('0x38')](_0x31ec05)[_0x76ae('0x22')](function(_0x36f17f){return _0x36f17f;});}return null;};}function removeEntity(_0x4f3f03,_0x32ec1e){return function(_0x958634){if(_0x958634){return _0x958634[_0x76ae('0x39')]()[_0x76ae('0x22')](function(){var _0x4fcb81=_0x958634[_0x76ae('0x3a')]({'plain':!![]});var _0x566721=_0x76ae('0x3b');return db[_0x76ae('0x3c')][_0x76ae('0x39')]({'where':{'type':_0x566721,'resourceId':_0x4fcb81['id']}})['then'](function(){return _0x958634;});})[_0x76ae('0x22')](function(){_0x4f3f03['status'](0xcc)[_0x76ae('0x2d')]();});}};}function handleEntityNotFound(_0x6369e8,_0x14cafe){return function(_0x37cca2){if(!_0x37cca2){_0x6369e8[_0x76ae('0x3d')](0x194);}return _0x37cca2;};}function handleError(_0x3602ad,_0x4d3b1f){_0x4d3b1f=_0x4d3b1f||0x1f4;return function(_0x1656e1){logger['error'](_0x1656e1[_0x76ae('0x3e')]);if(_0x1656e1[_0x76ae('0x3f')]){delete _0x1656e1['name'];}_0x3602ad['status'](_0x4d3b1f)[_0x76ae('0x40')](_0x1656e1);};}exports[_0x76ae('0x41')]=function(_0x3a6aaf,_0x3a275b){var _0x169fd2={'include':[{'model':db[_0x76ae('0x42')],'as':_0x76ae('0x43')}]},_0x304677={},_0x46e8ae={'count':0x0,'rows':[]};var _0x5b1299=_[_0x76ae('0x44')](db[_0x76ae('0x45')]['rawAttributes'],function(_0x28760a){return{'name':_0x28760a[_0x76ae('0x46')],'type':_0x28760a[_0x76ae('0x47')][_0x76ae('0x48')]};});_0x304677[_0x76ae('0x49')]=_['map'](_0x5b1299,_0x76ae('0x3f'));_0x304677[_0x76ae('0x4a')]=_[_0x76ae('0x4b')](_0x3a6aaf[_0x76ae('0x4a')]);_0x304677['filters']=_[_0x76ae('0x4c')](_0x304677[_0x76ae('0x49')],_0x304677[_0x76ae('0x4a')]);_0x169fd2['attributes']=_[_0x76ae('0x4c')](_0x304677[_0x76ae('0x49')],qs[_0x76ae('0x4d')](_0x3a6aaf[_0x76ae('0x4a')][_0x76ae('0x4d')]));_0x169fd2[_0x76ae('0x4e')]=_0x169fd2[_0x76ae('0x4e')][_0x76ae('0x4f')]?_0x169fd2[_0x76ae('0x4e')]:_0x304677[_0x76ae('0x49')];if(!_0x3a6aaf[_0x76ae('0x4a')][_0x76ae('0x50')]('nolimit')){_0x169fd2['limit']=qs[_0x76ae('0x31')](_0x3a6aaf[_0x76ae('0x4a')]['limit']);_0x169fd2[_0x76ae('0x2f')]=qs['offset'](_0x3a6aaf[_0x76ae('0x4a')][_0x76ae('0x2f')]);}_0x169fd2[_0x76ae('0x51')]=qs[_0x76ae('0x52')](_0x3a6aaf['query'][_0x76ae('0x52')]);_0x169fd2[_0x76ae('0x53')]=qs[_0x76ae('0x54')](_[_0x76ae('0x55')](_0x3a6aaf[_0x76ae('0x4a')],_0x304677['filters']),_0x5b1299);if(_0x3a6aaf[_0x76ae('0x4a')][_0x76ae('0x56')]){_0x169fd2[_0x76ae('0x53')]=_['merge'](_0x169fd2['where'],{'$or':_['map'](_0x5b1299,function(_0x3a4ab0){if(_0x3a4ab0['type']!==_0x76ae('0x57')){var _0x3dfc60={};_0x3dfc60[_0x3a4ab0['name']]={'$like':'%'+_0x3a6aaf['query']['filter']+'%'};return _0x3dfc60;}})});}_0x169fd2=_[_0x76ae('0x58')]({},_0x169fd2,_0x3a6aaf[_0x76ae('0x59')]);var _0x157f8e={'where':_0x169fd2[_0x76ae('0x53')]};return db[_0x76ae('0x45')]['count'](_0x157f8e)[_0x76ae('0x22')](function(_0x457f96){_0x46e8ae['count']=_0x457f96;if(_0x3a6aaf[_0x76ae('0x4a')][_0x76ae('0x5a')]){_0x169fd2[_0x76ae('0x5b')]=[{'all':!![]}];}return db['SmsAccount']['findAll'](_0x169fd2);})[_0x76ae('0x22')](function(_0x30695b){_0x46e8ae[_0x76ae('0x5c')]=_0x30695b;return _0x46e8ae;})['then'](respondWithFilteredResult(_0x3a275b,_0x169fd2))[_0x76ae('0x2b')](handleError(_0x3a275b,null));};exports['show']=function(_0x16d690,_0x2bdc88){var _0x251604={'raw':![],'where':{'id':_0x16d690[_0x76ae('0x5d')]['id']},'include':[{'model':db[_0x76ae('0x42')],'as':_0x76ae('0x43')}]},_0x292e1a={};_0x292e1a[_0x76ae('0x49')]=_[_0x76ae('0x4b')](db['SmsAccount'][_0x76ae('0x5e')]);_0x292e1a[_0x76ae('0x4a')]=_[_0x76ae('0x4b')](_0x16d690[_0x76ae('0x4a')]);_0x292e1a[_0x76ae('0x54')]=_[_0x76ae('0x4c')](_0x292e1a[_0x76ae('0x49')],_0x292e1a[_0x76ae('0x4a')]);_0x251604[_0x76ae('0x4e')]=_[_0x76ae('0x4c')](_0x292e1a[_0x76ae('0x49')],qs['fields'](_0x16d690[_0x76ae('0x4a')][_0x76ae('0x4d')]));_0x251604[_0x76ae('0x4e')]=_0x251604[_0x76ae('0x4e')][_0x76ae('0x4f')]?_0x251604[_0x76ae('0x4e')]:_0x292e1a[_0x76ae('0x49')];if(_0x16d690[_0x76ae('0x4a')][_0x76ae('0x5a')]){_0x251604['include']=[{'all':!![]}];}_0x251604=_['merge']({},_0x251604,_0x16d690[_0x76ae('0x59')]);return db[_0x76ae('0x45')]['find'](_0x251604)[_0x76ae('0x22')](handleEntityNotFound(_0x2bdc88,null))[_0x76ae('0x22')](respondWithResult(_0x2bdc88,null))[_0x76ae('0x2b')](handleError(_0x2bdc88,null));};exports[_0x76ae('0x5f')]=function(_0x6e91cd,_0x406d41){return db[_0x76ae('0x45')][_0x76ae('0x5f')](_0x6e91cd[_0x76ae('0x60')],{})[_0x76ae('0x22')](function(_0x2af33f){var _0x22c1c8=_0x6e91cd['user']['get']({'plain':!![]});if(!_0x22c1c8)throw new Error(_0x76ae('0x61'));if(_0x22c1c8[_0x76ae('0x62')]===_0x76ae('0x63')){var _0xe6f7ef=_0x2af33f[_0x76ae('0x3a')]({'plain':!![]});var _0x38d271=_0x76ae('0x3b');return db[_0x76ae('0x64')][_0x76ae('0x65')]({'where':{'name':_0x38d271,'userProfileId':_0x22c1c8[_0x76ae('0x66')]},'raw':!![]})['then'](function(_0x451c12){if(_0x451c12&&_0x451c12[_0x76ae('0x67')]===0x0){return db[_0x76ae('0x3c')][_0x76ae('0x5f')]({'name':_0xe6f7ef['name'],'resourceId':_0xe6f7ef['id'],'type':_0x451c12[_0x76ae('0x3f')],'sectionId':_0x451c12['id']},{})[_0x76ae('0x22')](function(){return _0x2af33f;});}else{return _0x2af33f;}})[_0x76ae('0x2b')](function(_0x25ba5f){logger[_0x76ae('0x28')](_0x76ae('0x68'),_0x25ba5f);throw _0x25ba5f;});}return _0x2af33f;})['then'](respondWithResult(_0x406d41,0xc9))[_0x76ae('0x2b')](handleError(_0x406d41,null));};exports[_0x76ae('0x38')]=function(_0x558416,_0x50d2fb){if(_0x558416[_0x76ae('0x60')]['id']){delete _0x558416[_0x76ae('0x60')]['id'];}return db[_0x76ae('0x45')][_0x76ae('0x65')]({'where':{'id':_0x558416[_0x76ae('0x5d')]['id']},'include':[{'model':db[_0x76ae('0x42')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x50d2fb,null))[_0x76ae('0x22')](saveUpdates(_0x558416[_0x76ae('0x60')],null))[_0x76ae('0x22')](respondWithResult(_0x50d2fb,null))['catch'](handleError(_0x50d2fb,null));};exports[_0x76ae('0x39')]=function(_0x1a03a,_0x39ccfd){return db[_0x76ae('0x45')][_0x76ae('0x65')]({'where':{'id':_0x1a03a[_0x76ae('0x5d')]['id']}})[_0x76ae('0x22')](handleEntityNotFound(_0x39ccfd,null))[_0x76ae('0x22')](removeEntity(_0x39ccfd,null))[_0x76ae('0x2b')](handleError(_0x39ccfd,null));};exports[_0x76ae('0x69')]=function(_0x2fba24,_0x1e9e96){return db[_0x76ae('0x45')][_0x76ae('0x69')]()[_0x76ae('0x22')](respondWithResult(_0x1e9e96,null))[_0x76ae('0x2b')](handleError(_0x1e9e96,null));};exports[_0x76ae('0x6a')]=function(_0x379592,_0x8de0e0,_0xc59c6c){if(_0x379592[_0x76ae('0x60')]['id']){delete _0x379592['body']['id'];}return db[_0x76ae('0x45')]['find']({'where':{'id':_0x379592[_0x76ae('0x5d')]['id']}})[_0x76ae('0x22')](handleEntityNotFound(_0x8de0e0,null))[_0x76ae('0x22')](function(_0x4c327d){if(_0x4c327d){_0x379592[_0x76ae('0x60')][_0x76ae('0x6b')]=_0x4c327d['id'];return db[_0x76ae('0x6c')][_0x76ae('0x5f')](_0x379592['body']);}})['then'](respondWithResult(_0x8de0e0,null))[_0x76ae('0x2b')](handleError(_0x8de0e0,null));};exports[_0x76ae('0x6d')]=function(_0x2ec58f,_0x1ca49a,_0x3a3bf6){var _0x2b6851={'raw':![],'where':{}};var _0x48a3f3={};var _0x311420={'count':0x0,'rows':[]};return db[_0x76ae('0x45')][_0x76ae('0x6e')]({'where':{'id':_0x2ec58f[_0x76ae('0x5d')]['id']}})[_0x76ae('0x22')](handleEntityNotFound(_0x1ca49a,null))[_0x76ae('0x22')](function(_0x311e47){if(_0x311e47){_0x48a3f3[_0x76ae('0x49')]=_[_0x76ae('0x4b')](db[_0x76ae('0x6c')][_0x76ae('0x5e')]);_0x48a3f3[_0x76ae('0x4a')]=_[_0x76ae('0x4b')](_0x2ec58f[_0x76ae('0x4a')]);_0x48a3f3[_0x76ae('0x54')]=_[_0x76ae('0x4c')](_0x48a3f3['model'],_0x48a3f3[_0x76ae('0x4a')]);_0x2b6851[_0x76ae('0x4e')]=_[_0x76ae('0x4c')](_0x48a3f3['model'],qs[_0x76ae('0x4d')](_0x2ec58f[_0x76ae('0x4a')][_0x76ae('0x4d')]));_0x2b6851[_0x76ae('0x4e')]=_0x2b6851[_0x76ae('0x4e')][_0x76ae('0x4f')]?_0x2b6851[_0x76ae('0x4e')]:_0x48a3f3[_0x76ae('0x49')];if(!_0x2ec58f[_0x76ae('0x4a')][_0x76ae('0x50')](_0x76ae('0x6f'))){_0x2b6851[_0x76ae('0x31')]=qs[_0x76ae('0x31')](_0x2ec58f[_0x76ae('0x4a')][_0x76ae('0x31')]);_0x2b6851[_0x76ae('0x2f')]=qs[_0x76ae('0x2f')](_0x2ec58f[_0x76ae('0x4a')][_0x76ae('0x2f')]);}_0x2b6851['order']=qs[_0x76ae('0x52')](_0x2ec58f['query'][_0x76ae('0x52')]);_0x2b6851[_0x76ae('0x53')]=qs['filters'](_[_0x76ae('0x55')](_0x2ec58f[_0x76ae('0x4a')],_0x48a3f3[_0x76ae('0x54')]));_0x2b6851[_0x76ae('0x53')]['SmsAccountId']=_0x311e47['id'];if(_0x2ec58f[_0x76ae('0x4a')][_0x76ae('0x56')]){_0x2b6851[_0x76ae('0x53')]=_[_0x76ae('0x58')](_0x2b6851['where'],{'$or':_['map'](_0x2b6851[_0x76ae('0x4e')],function(_0x4fec36){var _0x14b4bb={};_0x14b4bb[_0x4fec36]={'$like':'%'+_0x2ec58f[_0x76ae('0x4a')]['filter']+'%'};return _0x14b4bb;})});}_0x2b6851=_[_0x76ae('0x58')]({},_0x2b6851,_0x2ec58f[_0x76ae('0x59')]);return db[_0x76ae('0x6c')]['count']({'where':_0x2b6851[_0x76ae('0x53')]})[_0x76ae('0x22')](function(_0x4706c2){_0x311420[_0x76ae('0x32')]=_0x4706c2;if(_0x2ec58f['query'][_0x76ae('0x5a')]){_0x2b6851[_0x76ae('0x5b')]=[{'all':!![]}];}return db[_0x76ae('0x6c')][_0x76ae('0x70')](_0x2b6851);})[_0x76ae('0x22')](function(_0x58b02d){_0x311420['rows']=_0x58b02d;return _0x311420;});}})['then'](respondWithFilteredResult(_0x1ca49a,_0x2b6851))['catch'](handleError(_0x1ca49a,null));};exports['removeDispositions']=function(_0x5d0bc3,_0x3ced96,_0x1db7b3){return db[_0x76ae('0x45')][_0x76ae('0x65')]({'where':{'id':_0x5d0bc3[_0x76ae('0x5d')]['id']}})[_0x76ae('0x22')](handleEntityNotFound(_0x3ced96,null))['then'](function(_0x2db464){if(_0x2db464){return _0x2db464[_0x76ae('0x71')](_0x5d0bc3['query'][_0x76ae('0x72')]);}})[_0x76ae('0x22')](respondWithStatusCode(_0x3ced96,null))[_0x76ae('0x2b')](handleError(_0x3ced96,null));};exports[_0x76ae('0x73')]=function(_0x4517e3,_0x3a4675,_0x3ee3aa){if(_0x4517e3[_0x76ae('0x60')]['id']){delete _0x4517e3[_0x76ae('0x60')]['id'];}return db[_0x76ae('0x45')][_0x76ae('0x65')]({'where':{'id':_0x4517e3['params']['id']}})[_0x76ae('0x22')](handleEntityNotFound(_0x3a4675,null))[_0x76ae('0x22')](function(_0x4e6fdc){if(_0x4e6fdc){_0x4517e3['body']['SmsAccountId']=_0x4e6fdc['id'];return db[_0x76ae('0x74')][_0x76ae('0x5f')](_0x4517e3[_0x76ae('0x60')]);}})[_0x76ae('0x22')](respondWithResult(_0x3a4675,null))[_0x76ae('0x2b')](handleError(_0x3a4675,null));};exports[_0x76ae('0x75')]=function(_0x2500e3,_0x3002a9,_0x45f5da){var _0x5a0d13={'raw':![],'where':{}};var _0x1609ed={};var _0x4878e4={'count':0x0,'rows':[]};return db['SmsAccount'][_0x76ae('0x6e')]({'where':{'id':_0x2500e3[_0x76ae('0x5d')]['id']}})[_0x76ae('0x22')](handleEntityNotFound(_0x3002a9,null))['then'](function(_0x5802d9){if(_0x5802d9){_0x1609ed[_0x76ae('0x49')]=_['keys'](db['CannedAnswer'][_0x76ae('0x5e')]);_0x1609ed[_0x76ae('0x4a')]=_[_0x76ae('0x4b')](_0x2500e3[_0x76ae('0x4a')]);_0x1609ed[_0x76ae('0x54')]=_['intersection'](_0x1609ed[_0x76ae('0x49')],_0x1609ed['query']);_0x5a0d13[_0x76ae('0x4e')]=_[_0x76ae('0x4c')](_0x1609ed['model'],qs['fields'](_0x2500e3[_0x76ae('0x4a')][_0x76ae('0x4d')]));_0x5a0d13[_0x76ae('0x4e')]=_0x5a0d13[_0x76ae('0x4e')][_0x76ae('0x4f')]?_0x5a0d13[_0x76ae('0x4e')]:_0x1609ed[_0x76ae('0x49')];if(!_0x2500e3[_0x76ae('0x4a')][_0x76ae('0x50')](_0x76ae('0x6f'))){_0x5a0d13[_0x76ae('0x31')]=qs[_0x76ae('0x31')](_0x2500e3[_0x76ae('0x4a')][_0x76ae('0x31')]);_0x5a0d13[_0x76ae('0x2f')]=qs['offset'](_0x2500e3[_0x76ae('0x4a')][_0x76ae('0x2f')]);}_0x5a0d13[_0x76ae('0x51')]=qs[_0x76ae('0x52')](_0x2500e3['query'][_0x76ae('0x52')]);_0x5a0d13[_0x76ae('0x53')]=qs[_0x76ae('0x54')](_[_0x76ae('0x55')](_0x2500e3[_0x76ae('0x4a')],_0x1609ed[_0x76ae('0x54')]));_0x5a0d13['where'][_0x76ae('0x6b')]=_0x5802d9['id'];if(_0x2500e3['query'][_0x76ae('0x56')]){_0x5a0d13[_0x76ae('0x53')]=_[_0x76ae('0x58')](_0x5a0d13[_0x76ae('0x53')],{'$or':_['map'](_0x5a0d13[_0x76ae('0x4e')],function(_0x1ddf3f){var _0x3a9dbe={};_0x3a9dbe[_0x1ddf3f]={'$like':'%'+_0x2500e3[_0x76ae('0x4a')][_0x76ae('0x56')]+'%'};return _0x3a9dbe;})});}_0x5a0d13=_[_0x76ae('0x58')]({},_0x5a0d13,_0x2500e3[_0x76ae('0x59')]);return db[_0x76ae('0x74')][_0x76ae('0x32')]({'where':_0x5a0d13[_0x76ae('0x53')]})[_0x76ae('0x22')](function(_0x48b4f8){_0x4878e4['count']=_0x48b4f8;if(_0x2500e3[_0x76ae('0x4a')][_0x76ae('0x5a')]){_0x5a0d13[_0x76ae('0x5b')]=[{'all':!![]}];}return db[_0x76ae('0x74')][_0x76ae('0x70')](_0x5a0d13);})[_0x76ae('0x22')](function(_0x4e65a1){_0x4878e4['rows']=_0x4e65a1;return _0x4878e4;});}})[_0x76ae('0x22')](respondWithFilteredResult(_0x3002a9,_0x5a0d13))[_0x76ae('0x2b')](handleError(_0x3002a9,null));};exports[_0x76ae('0x76')]=function(_0x173f82,_0x1d4bd3,_0x1e8e86){return db[_0x76ae('0x45')][_0x76ae('0x65')]({'where':{'id':_0x173f82[_0x76ae('0x5d')]['id']}})[_0x76ae('0x22')](handleEntityNotFound(_0x1d4bd3,null))[_0x76ae('0x22')](function(_0x23f5d0){if(_0x23f5d0){return _0x23f5d0[_0x76ae('0x76')](_0x173f82[_0x76ae('0x4a')][_0x76ae('0x72')]);}})[_0x76ae('0x22')](respondWithStatusCode(_0x1d4bd3,null))[_0x76ae('0x2b')](handleError(_0x1d4bd3,null));};exports['notify']=function(_0x2bb347,_0x52cad4,_0x5705b3){var _0x4df1c1={'channel':_0x76ae('0x77')};var _0xe62ceb=[];var _0x5b0418=[];var _0x441538={};return db['SmsAccount'][_0x76ae('0x65')]({'where':{'id':_0x2bb347[_0x76ae('0x5d')]['id']},'include':[{'model':db[_0x76ae('0x78')],'as':_0x76ae('0x79')}]})[_0x76ae('0x22')](handleEntityNotFound(_0x52cad4,null))[_0x76ae('0x22')](function(_0x1e01f5){_0x4df1c1['account']=_0x1e01f5;_0x4df1c1[_0x76ae('0x7a')]=_[_0x76ae('0x7b')](_0x1e01f5['Applications'],['priority'],['asc']);if(_0x4df1c1['account']['Applications']){delete _0x4df1c1[_0x76ae('0x7c')][_0x76ae('0x79')];}return db['CmContact'][_0x76ae('0x69')]();})[_0x76ae('0x22')](function(_0x50fcf5){if(!_0x50fcf5){throw new db[(_0x76ae('0x7d'))][(_0x76ae('0x7e'))](_0x76ae('0x7f'));}_0xe62ceb=_['difference'](_[_0x76ae('0x4b')](_0x50fcf5),[_0x76ae('0x80'),'updatedAt']);_0x5b0418=_[_0x76ae('0x81')](_[_0x76ae('0x4b')](_0x50fcf5),[_0x76ae('0x80'),_0x76ae('0x82'),'CompanyId',_0x76ae('0x83')]);_0x4df1c1['body']={'mapKey':_0x76ae('0x84')};if(_0x4df1c1[_0x76ae('0x7c')][_0x76ae('0x47')]){switch(_0x4df1c1[_0x76ae('0x7c')][_0x76ae('0x47')]){case'twilio':_0x4df1c1['body'][_0x76ae('0x85')]=_0x2bb347['body']['From'];_0x4df1c1[_0x76ae('0x60')]['body']=_0x2bb347['body'][_0x76ae('0x86')];_0x4df1c1[_0x76ae('0x60')][_0x76ae('0x87')]=_0x2bb347[_0x76ae('0x60')][_0x76ae('0x88')];break;case'skebby':_0x4df1c1[_0x76ae('0x60')]['from']='+'+_0x2bb347[_0x76ae('0x60')]['sender'];_0x4df1c1[_0x76ae('0x60')]['body']=_0x2bb347[_0x76ae('0x60')]['text'];break;case _0x76ae('0x89'):_0x4df1c1['body']['from']=_0x2bb347['body'][_0x76ae('0x85')];_0x4df1c1[_0x76ae('0x60')]['body']=_0x2bb347['body'][_0x76ae('0x2a')];break;case _0x76ae('0x8a'):_0x4df1c1[_0x76ae('0x60')][_0x76ae('0x85')]=_0x2bb347['body'][_0x76ae('0x85')];_0x4df1c1[_0x76ae('0x60')][_0x76ae('0x60')]=_0x2bb347['body'][_0x76ae('0x60')];_0x4df1c1[_0x76ae('0x60')][_0x76ae('0x87')]=_0x2bb347[_0x76ae('0x60')][_0x76ae('0x8b')];break;case _0x76ae('0x8c'):_0x4df1c1['body'][_0x76ae('0x85')]=_0x2bb347['body'][_0x76ae('0x8d')];_0x4df1c1[_0x76ae('0x60')][_0x76ae('0x60')]=_0x2bb347[_0x76ae('0x60')][_0x76ae('0x8e')];_0x4df1c1[_0x76ae('0x60')][_0x76ae('0x87')]=_0x2bb347[_0x76ae('0x60')][_0x76ae('0x8f')];break;case _0x76ae('0x90'):_0x4df1c1['body'][_0x76ae('0x85')]='+'+_0x2bb347[_0x76ae('0x60')][_0x76ae('0x91')][0x0][_0x76ae('0x85')];_0x4df1c1['body']['body']=_0x2bb347[_0x76ae('0x60')][_0x76ae('0x91')][0x0][_0x76ae('0x92')];_0x4df1c1[_0x76ae('0x60')][_0x76ae('0x87')]=_0x2bb347[_0x76ae('0x60')][_0x76ae('0x91')][0x0][_0x76ae('0x87')];break;case'csc':_0x4df1c1[_0x76ae('0x60')]['from']=_0x2bb347[_0x76ae('0x60')]['originatingAddress'];_0x4df1c1[_0x76ae('0x60')]['body']=_0x2bb347[_0x76ae('0x60')]['segmentedMessage']['message'];break;case _0x76ae('0x93'):_0x4df1c1['body'][_0x76ae('0x85')]=_0x2bb347['body']['fromNumber'];_0x4df1c1[_0x76ae('0x60')][_0x76ae('0x60')]=_0x2bb347[_0x76ae('0x60')][_0x76ae('0x92')];_0x4df1c1['body'][_0x76ae('0x87')]=_0x2bb347[_0x76ae('0x60')][_0x76ae('0x94')];break;case _0x76ae('0x95'):_0x4df1c1[_0x76ae('0x60')][_0x76ae('0x87')]=_0x2bb347[_0x76ae('0x60')][0x0][_0x76ae('0x2a')]['id'];_0x4df1c1[_0x76ae('0x60')][_0x76ae('0x85')]=_0x2bb347[_0x76ae('0x60')][0x0][_0x76ae('0x2a')][_0x76ae('0x85')];_0x4df1c1[_0x76ae('0x60')][_0x76ae('0x60')]=_0x2bb347[_0x76ae('0x60')][0x0][_0x76ae('0x2a')]['text'];break;case _0x76ae('0x96'):_0x4df1c1[_0x76ae('0x60')][_0x76ae('0x85')]=_0x2bb347[_0x76ae('0x60')][_0x76ae('0x85')];_0x4df1c1[_0x76ae('0x60')]['body']=_0x2bb347[_0x76ae('0x60')][_0x76ae('0x2a')];_0x4df1c1[_0x76ae('0x60')][_0x76ae('0x87')]=_0x2bb347[_0x76ae('0x60')][_0x76ae('0x97')];break;}}if(_0x4df1c1[_0x76ae('0x60')]['id']){delete _0x4df1c1[_0x76ae('0x60')]['id'];}if(_[_0x76ae('0x98')](_0x4df1c1[_0x76ae('0x60')][_0x76ae('0x85')])){throw new db['Sequelize'][(_0x76ae('0x7e'))](_0x76ae('0x99'));}if(_[_0x76ae('0x98')](_0x4df1c1['body'][_0x76ae('0x60')])||_0x4df1c1[_0x76ae('0x60')][_0x76ae('0x60')]===''){throw new db['Sequelize'][(_0x76ae('0x7e'))](_0x76ae('0x9a'));}if(_[_0x76ae('0x98')](_0x4df1c1[_0x76ae('0x60')][_0x76ae('0x9b')])){throw new db['Sequelize'][(_0x76ae('0x7e'))](_0x76ae('0x9c')+_0x5b0418);}if(!_[_0x76ae('0x9d')](_0x5b0418,_0x4df1c1[_0x76ae('0x60')][_0x76ae('0x9b')])){throw new db['Sequelize'][(_0x76ae('0x7e'))](_0x76ae('0x9e')+_0x5b0418);}_0x441538[_0x4df1c1[_0x76ae('0x60')]['mapKey']]=_0x4df1c1[_0x76ae('0x60')][_0x76ae('0x85')];return db[_0x76ae('0x9f')]['find']({'where':{'id':_0x4df1c1['account'][_0x76ae('0x83')]},'include':[{'model':db[_0x76ae('0xa0')],'as':_0x76ae('0xa1'),'where':_0x441538,'limit':0x1,'order':[[_0x76ae('0x82'),_0x76ae('0xa2')]]}]});})['then'](handleEntityNotFound(_0x52cad4,null))[_0x76ae('0x22')](function(_0x5f0983){if(_0x5f0983){_0x4df1c1[_0x76ae('0xa3')]=_['omit'](_0x5f0983,[_0x76ae('0xa1')]);if(_0x5f0983[_0x76ae('0xa1')][_0x76ae('0x4f')]){return _0x5f0983[_0x76ae('0xa1')][0x0];}var _0xf3806c=_['defaults'](_0x4df1c1[_0x76ae('0x60')],{'firstName':_0x4df1c1[_0x76ae('0x60')][_0x76ae('0x85')],'ListId':_0x5f0983['id']});_0xf3806c[_0x4df1c1[_0x76ae('0x60')]['mapKey']]=_0x4df1c1[_0x76ae('0x60')][_0x76ae('0x85')];return db[_0x76ae('0xa0')][_0x76ae('0x5f')](_0xf3806c,{'fields':_0xe62ceb,'raw':!![]});}})['then'](handleEntityNotFound(_0x52cad4,null))[_0x76ae('0x22')](function(_0x58b940){if(_0x58b940){_0x4df1c1[_0x76ae('0xa4')]=_0x58b940;var _0x536e35={'ContactId':_0x58b940['id'],'phone':_0x4df1c1[_0x76ae('0x60')][_0x76ae('0x85')],'SmsAccountId':_0x2bb347[_0x76ae('0x5d')]['id']};var _0x404a0c={'ContactId':_0x58b940['id'],'SmsAccountId':_0x2bb347['params']['id'],'closed':![]};return db['SmsInteraction'][_0x76ae('0x65')]({'where':_0x404a0c})['then'](function(_0x209651){if(_0x209651){return[_0x209651,![]];}return db[_0x76ae('0xa5')][_0x76ae('0x5f')](_0x536e35)['then'](function(_0x126ed9){return[_0x126ed9,!![]];});});}})[_0x76ae('0xa6')](function(_0x35137d,_0x485a2c){_0x4df1c1['interaction']=_0x35137d[_0x76ae('0x3a')]({'plain':!![]});_0x4df1c1['interaction']['created']=![];if(_0x485a2c){if(_0x4df1c1[_0x76ae('0x7c')][_0x76ae('0xa7')]){_0x4df1c1[_0x76ae('0x7a')][_0x76ae('0xa8')]({'id':0x0,'priority':_0x4df1c1['applications'][_0x76ae('0x4f')]+0x1,'app':_0x76ae('0xa9'),'appdata':'unmanaged','interval':'*,*,*,*'});}_0x4df1c1[_0x76ae('0xaa')][_0x76ae('0xab')]=!![];}return db['SmsMessage'][_0x76ae('0x5f')]({'phone':_0x4df1c1[_0x76ae('0x60')][_0x76ae('0x85')],'messageId':_0x4df1c1[_0x76ae('0x60')][_0x76ae('0x87')],'body':_0x4df1c1[_0x76ae('0x60')][_0x76ae('0x60')],'SmsAccountId':_0x2bb347[_0x76ae('0x5d')]['id'],'SmsInteractionId':_0x35137d['id'],'direction':'in','ContactId':_0x35137d[_0x76ae('0xac')],'AttachmentId':_0x4df1c1[_0x76ae('0x60')]['AttachmentId']});})[_0x76ae('0x22')](function(_0x27a408){_0x4df1c1['message']=_0x27a408;if(_0x4df1c1[_0x76ae('0xaa')][_0x76ae('0xad')]){return db[_0x76ae('0xae')][_0x76ae('0x65')]({'attributes':['id','name'],'where':{'id':_0x4df1c1[_0x76ae('0xaa')][_0x76ae('0xad')]}})[_0x76ae('0x22')](function(_0x188077){if(_0x188077){_0x4df1c1[_0x76ae('0x7a')][_0x76ae('0xaf')]({'id':0x0,'priority':0x0,'app':_0x76ae('0xb0'),'appdata':_0x188077['name']+','+(_0x4df1c1['account']['waitForTheAssignedAgent']||0xa),'interval':_0x76ae('0xb1')});}return respondWithRpcPromise(_0x76ae('0xb2'),_0x76ae('0xb3'),_0x4df1c1);});}return respondWithRpcPromise(_0x76ae('0xb2'),_0x76ae('0xb3'),_0x4df1c1);})[_0x76ae('0x22')](function(_0x42e6ca){if(_0x42e6ca){var _0x1e967b=0xc8;var _0xb3edec=_0x76ae('0xb4');logger[_0x76ae('0x23')](_0x76ae('0x26'),_0xb3edec,_0x1e967b,_0x76ae('0xb5'));logger[_0x76ae('0xb6')](_0x76ae('0xb7'),_0xb3edec,_0x1e967b,_0x76ae('0xb5'),JSON[_0x76ae('0x27')](_0x42e6ca));if(_0x4df1c1[_0x76ae('0x7c')][_0x76ae('0x47')]==='twilio'){return _0x52cad4[_0x76ae('0x2c')](_0x1e967b)[_0x76ae('0x33')](_0x76ae('0xb8'),_0x76ae('0xb9'))['send'](_0x76ae('0xba'));}else{return _0x52cad4['status'](_0x1e967b)[_0x76ae('0x2e')](_0x42e6ca);}}})['catch'](handleError(_0x52cad4,null));};exports['addApplications']=function(_0xdcdb34,_0x46f5ee){var _0x1615eb=_0xdcdb34[_0x76ae('0x5d')]['id'];var _0x17dedf=_0xdcdb34[_0x76ae('0x60')];var _0x2ab4a0=0xc8;var _0xb21be9=null;return db[_0x76ae('0xbb')][_0x76ae('0xbc')]({'isolationLevel':db[_0x76ae('0xbb')][_0x76ae('0xbd')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x1d2a57){return db[_0x76ae('0x45')]['findOne']({'where':{'id':_0x1615eb},'transaction':_0x1d2a57})[_0x76ae('0x22')](function(_0xb9970){if(_0xb9970){return db[_0x76ae('0x78')][_0x76ae('0x39')]({'where':{'SmsAccountId':_0x1615eb},'transaction':_0x1d2a57})[_0x76ae('0x22')](function(){var _0x2558ea=_[_0x76ae('0x44')](_0x17dedf,function(_0x4d02a6){_0x4d02a6['SmsAccountId']=_0x1615eb;return _0x4d02a6;});return db[_0x76ae('0x78')][_0x76ae('0xbe')](_0x2558ea,{'transaction':_0x1d2a57});});}else{_0x2ab4a0=0x194;_0xb21be9=[];}});})[_0x76ae('0x22')](function(){if(_0x2ab4a0!==0x194){return db['SmsApplication'][_0x76ae('0xbf')]({'where':{'SmsAccountId':_0x1615eb},'order':_0x76ae('0xc0')})['then'](function(_0x27d5a8){_0xb21be9=_0x27d5a8;});}})[_0x76ae('0x2b')](function(_0x1e10ea){_0x2ab4a0=0x1f4;logger[_0x76ae('0x28')](_0x1e10ea[_0x76ae('0x3e')]);if(_0x1e10ea['name']){delete _0x1e10ea['name'];}_0xb21be9=_0x1e10ea;})[_0x76ae('0xc1')](function(){if(_0xb21be9===null){_0x46f5ee[_0x76ae('0x3d')](_0x2ab4a0);}else{if(_0x2ab4a0===0x1f4){_0x46f5ee['status'](_0x2ab4a0)[_0x76ae('0x40')](_0xb21be9);}else{_0x46f5ee[_0x76ae('0x2c')](_0x2ab4a0)[_0x76ae('0x2e')](_0xb21be9);}}});};exports[_0x76ae('0xc2')]=function(_0x2b3085,_0x512270,_0x280ec9){var _0x37d3b7={};var _0x4d43ef={};var _0x29a196;var _0x2a42ce;return db['SmsAccount'][_0x76ae('0x6e')]({'where':{'id':_0x2b3085[_0x76ae('0x5d')]['id']}})[_0x76ae('0x22')](handleEntityNotFound(_0x512270,null))[_0x76ae('0x22')](function(_0x48e70c){if(_0x48e70c){_0x29a196=_0x48e70c;_0x4d43ef[_0x76ae('0x49')]=_[_0x76ae('0x4b')](db[_0x76ae('0x78')][_0x76ae('0x5e')]);_0x4d43ef[_0x76ae('0x4a')]=_[_0x76ae('0x4b')](_0x2b3085[_0x76ae('0x4a')]);_0x4d43ef[_0x76ae('0x54')]=_['intersection'](_0x4d43ef[_0x76ae('0x49')],_0x4d43ef[_0x76ae('0x4a')]);_0x37d3b7[_0x76ae('0x4e')]=_[_0x76ae('0x4c')](_0x4d43ef[_0x76ae('0x49')],qs[_0x76ae('0x4d')](_0x2b3085[_0x76ae('0x4a')][_0x76ae('0x4d')]));_0x37d3b7[_0x76ae('0x4e')]=_0x37d3b7[_0x76ae('0x4e')][_0x76ae('0x4f')]?_0x37d3b7[_0x76ae('0x4e')]:_0x4d43ef[_0x76ae('0x49')];_0x37d3b7['order']=qs[_0x76ae('0x52')](_0x2b3085[_0x76ae('0x4a')]['sort']);_0x37d3b7['where']=qs[_0x76ae('0x54')](_[_0x76ae('0x55')](_0x2b3085[_0x76ae('0x4a')],_0x4d43ef[_0x76ae('0x54')]));if(_0x2b3085[_0x76ae('0x4a')][_0x76ae('0x56')]){_0x37d3b7[_0x76ae('0x53')]=_[_0x76ae('0x58')](_0x37d3b7['where'],{'$or':_['map'](_0x37d3b7[_0x76ae('0x4e')],function(_0x2a8239){var _0x72b629={};_0x72b629[_0x2a8239]={'$like':'%'+_0x2b3085[_0x76ae('0x4a')][_0x76ae('0x56')]+'%'};return _0x72b629;})});}_0x37d3b7=_[_0x76ae('0x58')]({},_0x37d3b7,_0x2b3085['options']);return _0x29a196[_0x76ae('0xc2')](_0x37d3b7);}})[_0x76ae('0x22')](function(_0x4de197){if(_0x4de197){_0x2a42ce=_0x4de197[_0x76ae('0x4f')];if(!_0x2b3085[_0x76ae('0x4a')][_0x76ae('0x50')](_0x76ae('0x6f'))){_0x37d3b7['limit']=qs[_0x76ae('0x31')](_0x2b3085[_0x76ae('0x4a')]['limit']);_0x37d3b7[_0x76ae('0x2f')]=qs['offset'](_0x2b3085['query']['offset']);}return _0x29a196[_0x76ae('0xc2')](_0x37d3b7);}})['then'](function(_0x2dd587){if(_0x2dd587){return _0x2dd587?{'count':_0x2a42ce,'rows':_0x2dd587}:null;}})[_0x76ae('0x22')](respondWithResult(_0x512270,null))[_0x76ae('0x2b')](handleError(_0x512270,null));};exports[_0x76ae('0xc3')]=function(_0x2b3a79,_0x4ef5a7,_0x513ae1){var _0x43a0ee={'raw':![],'where':{}};var _0x9f6aa7={};var _0x45edb2={'count':0x0,'rows':[]};return db[_0x76ae('0x45')][_0x76ae('0x6e')]({'where':{'id':_0x2b3a79[_0x76ae('0x5d')]['id']}})[_0x76ae('0x22')](handleEntityNotFound(_0x4ef5a7,null))[_0x76ae('0x22')](function(_0x19cee5){if(_0x19cee5){_0x9f6aa7[_0x76ae('0x49')]=_['keys'](db[_0x76ae('0xa5')][_0x76ae('0x5e')]);_0x9f6aa7[_0x76ae('0x4a')]=_[_0x76ae('0x4b')](_0x2b3a79[_0x76ae('0x4a')]);_0x9f6aa7[_0x76ae('0x54')]=_[_0x76ae('0x4c')](_0x9f6aa7['model'],_0x9f6aa7[_0x76ae('0x4a')]);_0x43a0ee['attributes']=_[_0x76ae('0x4c')](_0x9f6aa7['model'],qs[_0x76ae('0x4d')](_0x2b3a79[_0x76ae('0x4a')][_0x76ae('0x4d')]));_0x43a0ee[_0x76ae('0x4e')]=_0x43a0ee[_0x76ae('0x4e')][_0x76ae('0x4f')]?_0x43a0ee[_0x76ae('0x4e')]:_0x9f6aa7[_0x76ae('0x49')];if(!_0x2b3a79[_0x76ae('0x4a')][_0x76ae('0x50')]('nolimit')){_0x43a0ee[_0x76ae('0x31')]=qs[_0x76ae('0x31')](_0x2b3a79[_0x76ae('0x4a')]['limit']);_0x43a0ee['offset']=qs[_0x76ae('0x2f')](_0x2b3a79['query'][_0x76ae('0x2f')]);}_0x43a0ee[_0x76ae('0x51')]=qs[_0x76ae('0x52')](_0x2b3a79[_0x76ae('0x4a')][_0x76ae('0x52')]);_0x43a0ee['where']=qs[_0x76ae('0x54')](_[_0x76ae('0x55')](_0x2b3a79['query'],_0x9f6aa7[_0x76ae('0x54')]));_0x43a0ee[_0x76ae('0x53')][_0x76ae('0x6b')]=_0x19cee5['id'];if(_0x2b3a79[_0x76ae('0x4a')]['filter']){_0x43a0ee['where']=_[_0x76ae('0x58')](_0x43a0ee['where'],{'$or':_['map'](_0x43a0ee[_0x76ae('0x4e')],function(_0x2265cd){var _0x256423={};_0x256423[_0x2265cd]={'$like':'%'+_0x2b3a79[_0x76ae('0x4a')][_0x76ae('0x56')]+'%'};return _0x256423;})});}_0x43a0ee=_['merge']({},_0x43a0ee,_0x2b3a79[_0x76ae('0x59')]);return db['SmsInteraction']['count']({'where':_0x43a0ee[_0x76ae('0x53')]})[_0x76ae('0x22')](function(_0x2de048){_0x45edb2[_0x76ae('0x32')]=_0x2de048;if(_0x2b3a79[_0x76ae('0x4a')]['includeAll']){_0x43a0ee[_0x76ae('0x5b')]=[{'model':db[_0x76ae('0xa0')],'as':_0x76ae('0xc4'),'required':![]},{'model':db[_0x76ae('0xae')],'as':_0x76ae('0xc5'),'attributes':['name',_0x76ae('0xc6'),_0x76ae('0xc7')],'required':![]},{'model':db['Tag'],'as':_0x76ae('0xc8'),'attributes':['id',_0x76ae('0x3f'),'color'],'where':_0x2b3a79[_0x76ae('0x4a')][_0x76ae('0xc9')]?{'id':_0x2b3a79[_0x76ae('0x4a')]['tag']}:undefined,'required':_0x2b3a79[_0x76ae('0x4a')][_0x76ae('0xc9')]?!![]:![]}];}return db[_0x76ae('0xa5')][_0x76ae('0x70')](_0x43a0ee);})[_0x76ae('0x22')](function(_0x148360){_0x45edb2['rows']=_0x148360;return _0x45edb2;});}})['then'](respondWithFilteredResult(_0x4ef5a7,_0x43a0ee))[_0x76ae('0x2b')](handleError(_0x4ef5a7,null));};exports[_0x76ae('0x40')]=function(_0x18f285,_0x38f6ed,_0x2def5a){var _0x4ce029,_0x2c0cf5,_0x3f2852;if(_[_0x76ae('0x98')](_0x18f285['body'][_0x76ae('0x60')])||_0x18f285[_0x76ae('0x60')][_0x76ae('0x60')]===''){throw new db[(_0x76ae('0x7d'))]['ValidationError'](_0x76ae('0x9a'));}if(_[_0x76ae('0x98')](_0x18f285[_0x76ae('0x60')]['to'])){throw new db[(_0x76ae('0x7d'))][(_0x76ae('0x7e'))](_0x76ae('0xca'));}_0x4ce029=_0x18f285[_0x76ae('0x60')]['to'];return db[_0x76ae('0x45')][_0x76ae('0x65')]({'where':{'id':_0x18f285['params']['id']},'include':[{'model':db[_0x76ae('0x9f')],'as':_0x76ae('0xcb'),'include':[{'model':db[_0x76ae('0xa0')],'as':_0x76ae('0xa1'),'where':{'mobile':_0x4ce029},'limit':0x1,'order':[[_0x76ae('0x82'),'DESC']]}]}]})[_0x76ae('0x22')](handleEntityNotFound(_0x38f6ed,null))[_0x76ae('0x22')](function(_0x33e14c){if(_0x33e14c&&_0x33e14c[_0x76ae('0xcb')]){_0x2c0cf5=_0x33e14c['get']({'plain':!![]});if(_0x2c0cf5[_0x76ae('0xcb')]&&_0x2c0cf5['List']['Contacts'][_0x76ae('0x4f')]){return _0x2c0cf5[_0x76ae('0xcb')]['Contacts'][0x0];}return db[_0x76ae('0xa0')][_0x76ae('0x5f')](_[_0x76ae('0x1b')](_0x18f285['body'],{'firstName':_0x4ce029,'mobile':_0x4ce029,'phone':_0x4ce029,'ListId':_0x2c0cf5[_0x76ae('0x83')]}));}})['then'](handleEntityNotFound(_0x38f6ed,null))['then'](function(_0x143866){if(_0x143866){_0x3f2852=_0x143866;return db[_0x76ae('0xa5')][_0x76ae('0x65')]({'where':{'ContactId':_0x3f2852['id'],'closed':![],'SmsAccountId':_0x2c0cf5['id']}})[_0x76ae('0x22')](function(_0x4e8659){if(_0x4e8659){return[_0x4e8659,![]];}return db[_0x76ae('0xa5')][_0x76ae('0x5f')]({'UserId':_0x18f285['user']['id'],'ContactId':_0x3f2852['id'],'SmsAccountId':_0x2c0cf5['id'],'phone':_0x4ce029,'firstMsgDirection':_0x76ae('0xcc'),'Messages':[_['merge'](_0x18f285[_0x76ae('0x60')],{'read':![],'body':_0x18f285[_0x76ae('0x60')]['body'],'phone':_0x4ce029,'SmsAccountId':_0x2c0cf5['id'],'UserId':_0x18f285[_0x76ae('0x63')]['id'],'ContactId':_0x3f2852['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0x76ae('0xcd')}]})['then'](function(_0x5d9c48){return[_0x5d9c48,!![]];});});}})[_0x76ae('0xa6')](function(_0x81e711,_0x4b3db7){if(_0x4b3db7){return _0x81e711;}return db[_0x76ae('0xce')]['create'](_[_0x76ae('0x58')](_0x18f285[_0x76ae('0x60')],{'read':![],'body':_0x18f285['body'][_0x76ae('0x60')],'phone':_0x4ce029,'SmsAccountId':_0x2c0cf5['id'],'SmsInteractionId':_0x81e711['id'],'UserId':_0x18f285[_0x76ae('0x63')]['id'],'ContactId':_0x3f2852['id']}))[_0x76ae('0x22')](function(_0x2e0e97){_0x81e711[_0x76ae('0xcf')][_0x76ae('0xcd')]=[];_0x81e711[_0x76ae('0xcf')][_0x76ae('0xcd')][_0x76ae('0xa8')](_0x2e0e97[_0x76ae('0xcf')]);return _0x81e711;});})[_0x76ae('0x22')](respondWithResult(_0x38f6ed,null))[_0x76ae('0x2b')](handleError(_0x38f6ed,null));};exports['status']=function(_0x1bdc47,_0x299d16,_0x2a350e){if(_0x1bdc47['body']['id']){delete _0x1bdc47[_0x76ae('0x60')]['id'];}var _0x526627,_0x5e2c06,_0x4d0aa5;return db[_0x76ae('0x45')]['find']({'where':{'id':_0x1bdc47[_0x76ae('0x5d')]['id']}})['then'](handleEntityNotFound(_0x299d16,null))[_0x76ae('0x22')](function(_0x1c34d4){if(_0x1c34d4){_0x4d0aa5=_0x1c34d4;logger['debug'](_0x76ae('0x26'),_0x76ae('0x2c'),_0x76ae('0xd0'),_0x1c34d4[_0x76ae('0x47')],util['inspect'](_0x1bdc47['body'],{'showHidden':![],'depth':null}));switch(_0x1c34d4[_0x76ae('0x47')]){case _0x76ae('0xd1'):if(_0x1bdc47['body'][_0x76ae('0xd2')]&&_0x1bdc47['body']['status']){_0x5e2c06=_0x1bdc47['body'][_0x76ae('0x2c')];return db[_0x76ae('0xce')]['find']({'where':{'messageId':_0x1bdc47['body'][_0x76ae('0xd2')]}});}break;case _0x76ae('0x89'):if(_0x1bdc47['body'][_0x76ae('0xd3')]&&_0x1bdc47['body'][_0x76ae('0xd4')]){_0x5e2c06=_0x1bdc47[_0x76ae('0x60')][_0x76ae('0xd4')];return db[_0x76ae('0xce')][_0x76ae('0x65')]({'where':{'messageId':_0x1bdc47[_0x76ae('0x60')][_0x76ae('0xd3')]}});}break;case _0x76ae('0x8a'):if(_0x1bdc47['body']['message_id']&&_0x1bdc47[_0x76ae('0x60')][_0x76ae('0xd5')]){_0x5e2c06=_0x1bdc47[_0x76ae('0x60')][_0x76ae('0xd5')];return db[_0x76ae('0xce')][_0x76ae('0x65')]({'where':{'messageId':_0x1bdc47[_0x76ae('0x60')][_0x76ae('0x8b')]}});}break;case _0x76ae('0x90'):var _0x11102d=_0x1bdc47[_0x76ae('0x60')]['results'][0x0];if(_0x11102d[_0x76ae('0x87')]&&_0x11102d['status'][_0x76ae('0xd6')]===_0x76ae('0xd7')){_0x5e2c06=_0x11102d[_0x76ae('0x2c')][_0x76ae('0xd6')];return db[_0x76ae('0xce')][_0x76ae('0x65')]({'where':{'messageId':_0x11102d[_0x76ae('0x87')]}});}break;case _0x76ae('0x93'):if(_0x1bdc47[_0x76ae('0x60')][_0x76ae('0x87')]&&_0x1bdc47[_0x76ae('0x60')][_0x76ae('0x2c')]){_0x5e2c06=_0x1bdc47[_0x76ae('0x60')][_0x76ae('0x2c')];return db[_0x76ae('0xce')][_0x76ae('0x65')]({'where':{'messageId':_0x1bdc47['body'][_0x76ae('0x87')]}});}break;case'bandwidth':if(_0x1bdc47[_0x76ae('0x60')][0x0]['message']['id']){_0x5e2c06=_0x1bdc47[_0x76ae('0x60')][0x0]['type'];return db[_0x76ae('0xce')]['find']({'where':{'messageId':_0x1bdc47[_0x76ae('0x60')][0x0][_0x76ae('0x2a')]['id']}});}break;case _0x76ae('0x96'):if(_0x1bdc47[_0x76ae('0x60')]['redif']&&_0x1bdc47[_0x76ae('0x60')][_0x76ae('0x2c')]){_0x5e2c06=_0x1bdc47['body'][_0x76ae('0x2c')];return db[_0x76ae('0xce')][_0x76ae('0x65')]({'where':{'messageId':_0x1bdc47['body']['redif']}});}break;}}})[_0x76ae('0x22')](handleEntityNotFound(_0x299d16,null))['then'](function(_0x12904c){if(_0x12904c){_0x526627=_0x12904c;switch(_0x4d0aa5[_0x76ae('0x47')]){case'skebby':if(_0x5e2c06===_0x76ae('0xd7')){return _0x526627[_0x76ae('0x38')]({'read':!![]});}else{logger[_0x76ae('0x28')](_0x76ae('0x26'),_0x76ae('0x2c'),_0x76ae('0xd1'),util[_0x76ae('0xd8')](_0x1bdc47[_0x76ae('0x60')],{'showHidden':![],'depth':null}));}break;case _0x76ae('0x89'):if(_0x5e2c06==='1'){return _0x526627['update']({'read':!![]});}else{logger['error'](_0x76ae('0x26'),_0x76ae('0x2c'),'skebby',util[_0x76ae('0xd8')](_0x1bdc47['body'],{'showHidden':![],'depth':null}));}break;case _0x76ae('0x8a'):if(!_0x1bdc47[_0x76ae('0x60')][_0x76ae('0xd9')]&&_0x5e2c06>=0xc8&&_0x5e2c06<=0xce){return _0x526627[_0x76ae('0x38')]({'read':!![]});}else{logger[_0x76ae('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x76ae('0x2c'),_0x76ae('0x8a'),util[_0x76ae('0xd8')](_0x1bdc47[_0x76ae('0x60')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x837fa6=_0x1bdc47[_0x76ae('0x60')][_0x76ae('0x91')][0x0];if(_0x837fa6[_0x76ae('0x2c')][_0x76ae('0xd6')]===_0x76ae('0xd7')){return _0x526627[_0x76ae('0x38')]({'read':!![]});}else{logger[_0x76ae('0x28')](_0x76ae('0x26'),'status',_0x76ae('0x90'),util[_0x76ae('0xd8')](_0x1bdc47[_0x76ae('0x60')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x5e2c06==_0x76ae('0xda')||_0x5e2c06==_0x76ae('0xdb')){return _0x526627['update']({'read':!![]});}else{logger['error'](_0x76ae('0x26'),'status','clickatell',util['inspect'](_0x1bdc47[_0x76ae('0x60')],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x5e2c06=='message-delivered'){return _0x526627[_0x76ae('0x38')]({'read':!![]});}else{logger[_0x76ae('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x76ae('0x2c'),_0x76ae('0x95'),util[_0x76ae('0xd8')](_0x1bdc47[_0x76ae('0x60')],{'showHidden':![],'depth':null}));}break;case _0x76ae('0x96'):if(_0x5e2c06===_0x76ae('0xdc')||_0x5e2c06===_0x76ae('0xdd')){return _0x526627[_0x76ae('0x38')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x76ae('0x2c'),_0x76ae('0x96'),util[_0x76ae('0xd8')](_0x1bdc47['body'],{'showHidden':![],'depth':null}));}break;}return _0x526627;}})[_0x76ae('0x22')](respondWithResult(_0x299d16,null))['catch'](handleError(_0x299d16,null));};exports[_0x76ae('0xde')]=function(_0x3789ef,_0x393725,_0x3692d6){var _0x57caa5,_0x2ab1a5,_0x18f78e;return db['SmsAccount']['find']({'where':{'id':_0x3789ef[_0x76ae('0x5d')]['id']}})[_0x76ae('0x22')](handleEntityNotFound(_0x393725,null))[_0x76ae('0x22')](function(_0x268086){if(_0x268086){_0x18f78e=_0x268086;logger[_0x76ae('0xb6')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x76ae('0xd0'),_0x268086[_0x76ae('0x47')],util[_0x76ae('0xd8')](_0x3789ef[_0x76ae('0x4a')],{'showHidden':![],'depth':null}));switch(_0x268086['type']){case _0x76ae('0xdf'):if(_0x3789ef['query'][_0x76ae('0xe0')]&&_0x3789ef[_0x76ae('0x4a')][_0x76ae('0xe1')]){_0x2ab1a5=_0x3789ef[_0x76ae('0x4a')]['state'];return db['SmsMessage']['find']({'where':{'messageId':_0x3789ef[_0x76ae('0x4a')][_0x76ae('0xe0')]}});}break;}}})[_0x76ae('0x22')](handleEntityNotFound(_0x393725,null))[_0x76ae('0x22')](function(_0x299856){if(_0x299856){_0x57caa5=_0x299856;switch(_0x18f78e[_0x76ae('0x47')]){case'csc':if(_0x2ab1a5==='2'||_0x2ab1a5==='6'){return _0x57caa5[_0x76ae('0x38')]({'read':!![]});}else{logger['error'](_0x76ae('0x26'),_0x76ae('0x2c'),'csc',util[_0x76ae('0xd8')](_0x3789ef[_0x76ae('0x4a')],{'showHidden':![],'depth':null}));};break;}return _0x57caa5;}})[_0x76ae('0x22')](respondWithResult(_0x393725,null))['catch'](handleError(_0x393725,null));};exports['addAgents']=function(_0x5460ff,_0xb20106,_0x26f6aa){return db[_0x76ae('0x45')][_0x76ae('0x65')]({'where':{'id':_0x5460ff[_0x76ae('0x5d')]['id']}})[_0x76ae('0x22')](handleEntityNotFound(_0xb20106,null))['then'](function(_0x16f89b){if(_0x16f89b){return _0x16f89b[_0x76ae('0xe2')](_0x5460ff[_0x76ae('0x60')]['ids'],_['omit'](_0x5460ff[_0x76ae('0x60')],[_0x76ae('0x72'),'id'])||{})[_0x76ae('0xa6')](function(_0x4b6e6f){for(var _0x3f47ad=0x0;_0x3f47ad<_0x5460ff['body'][_0x76ae('0x72')][_0x76ae('0x4f')];_0x3f47ad+=0x1){socket[_0x76ae('0xe3')]('userSmsAccount:save',{'UserId':Number(_0x5460ff[_0x76ae('0x60')][_0x76ae('0x72')][_0x3f47ad]),'SmsAccountId':Number(_0x5460ff[_0x76ae('0x5d')]['id'])});}return _0x4b6e6f;});}})[_0x76ae('0x22')](respondWithResult(_0xb20106,null))[_0x76ae('0x2b')](handleError(_0xb20106,null));};exports['removeAgents']=function(_0x2c121e,_0x4cb81a,_0x32b2e6){return db[_0x76ae('0x45')]['find']({'where':{'id':_0x2c121e['params']['id']}})[_0x76ae('0x22')](handleEntityNotFound(_0x4cb81a,null))[_0x76ae('0x22')](function(_0x54bdbc){if(_0x54bdbc){return _0x54bdbc[_0x76ae('0xe4')](_0x2c121e[_0x76ae('0x4a')]['ids'])[_0x76ae('0x22')](function(){if(_['isArray'](_0x2c121e[_0x76ae('0x4a')]['ids'])){for(var _0x555d0f=0x0;_0x555d0f<_0x2c121e[_0x76ae('0x4a')][_0x76ae('0x72')][_0x76ae('0x4f')];_0x555d0f+=0x1){socket[_0x76ae('0xe3')](_0x76ae('0xe5'),{'UserId':Number(_0x2c121e[_0x76ae('0x4a')][_0x76ae('0x72')][_0x555d0f]),'SmsAccountId':Number(_0x2c121e[_0x76ae('0x5d')]['id'])});}}else{socket[_0x76ae('0xe3')](_0x76ae('0xe5'),{'UserId':Number(_0x2c121e[_0x76ae('0x4a')]['ids']),'SmsAccountId':Number(_0x2c121e[_0x76ae('0x5d')]['id'])});}});}})[_0x76ae('0x22')](respondWithStatusCode(_0x4cb81a,null))['catch'](handleError(_0x4cb81a,null));};exports[_0x76ae('0xe6')]=function(_0x391978,_0x558c86,_0x42cea6){var _0x1e14e7={};var _0x27a6d6={};var _0x4c5d9b;var _0x1e6a53;return db[_0x76ae('0x45')]['findOne']({'where':{'id':_0x391978['params']['id']}})[_0x76ae('0x22')](handleEntityNotFound(_0x558c86,null))['then'](function(_0x30354c){if(_0x30354c){_0x4c5d9b=_0x30354c;_0x27a6d6[_0x76ae('0x49')]=_[_0x76ae('0x4b')](db['User'][_0x76ae('0x5e')]);_0x27a6d6[_0x76ae('0x4a')]=_['keys'](_0x391978['query']);_0x27a6d6[_0x76ae('0x54')]=_[_0x76ae('0x4c')](_0x27a6d6[_0x76ae('0x49')],_0x27a6d6['query']);_0x1e14e7[_0x76ae('0x4e')]=_[_0x76ae('0x4c')](_0x27a6d6[_0x76ae('0x49')],qs[_0x76ae('0x4d')](_0x391978[_0x76ae('0x4a')]['fields']));_0x1e14e7[_0x76ae('0x4e')]=_0x1e14e7[_0x76ae('0x4e')][_0x76ae('0x4f')]?_0x1e14e7[_0x76ae('0x4e')]:_0x27a6d6[_0x76ae('0x49')];_0x1e14e7[_0x76ae('0x51')]=qs[_0x76ae('0x52')](_0x391978[_0x76ae('0x4a')][_0x76ae('0x52')]);_0x1e14e7[_0x76ae('0x53')]=qs['filters'](_[_0x76ae('0x55')](_0x391978[_0x76ae('0x4a')],_0x27a6d6['filters']));if(_0x391978['query'][_0x76ae('0x56')]){_0x1e14e7[_0x76ae('0x53')]=_[_0x76ae('0x58')](_0x1e14e7[_0x76ae('0x53')],{'$or':_[_0x76ae('0x44')](_0x1e14e7['attributes'],function(_0x23c487){var _0x2ebaac={};_0x2ebaac[_0x23c487]={'$like':'%'+_0x391978[_0x76ae('0x4a')][_0x76ae('0x56')]+'%'};return _0x2ebaac;})});}_0x1e14e7=_[_0x76ae('0x58')]({},_0x1e14e7,_0x391978['options']);return _0x4c5d9b[_0x76ae('0xe6')](_0x1e14e7);}})[_0x76ae('0x22')](function(_0x33f432){if(_0x33f432){_0x1e6a53=_0x33f432[_0x76ae('0x4f')];if(!_0x391978[_0x76ae('0x4a')]['hasOwnProperty'](_0x76ae('0x6f'))){_0x1e14e7[_0x76ae('0x31')]=qs[_0x76ae('0x31')](_0x391978[_0x76ae('0x4a')][_0x76ae('0x31')]);_0x1e14e7['offset']=qs[_0x76ae('0x2f')](_0x391978[_0x76ae('0x4a')][_0x76ae('0x2f')]);}return _0x4c5d9b[_0x76ae('0xe6')](_0x1e14e7);}})[_0x76ae('0x22')](function(_0x19e745){if(_0x19e745){return _0x19e745?{'count':_0x1e6a53,'rows':_0x19e745}:null;}})[_0x76ae('0x22')](respondWithResult(_0x558c86,null))[_0x76ae('0x2b')](handleError(_0x558c86,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 86c5bea..f993844 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 _0x64ce=['hook','events','../../mysqldb','SmsAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x44951e,_0x2f56a4){var _0x57bf59=function(_0x83574e){while(--_0x83574e){_0x44951e['push'](_0x44951e['shift']());}};_0x57bf59(++_0x2f56a4);}(_0x64ce,0x1a5));var _0xe64c=function(_0x508faf,_0x1792f3){_0x508faf=_0x508faf-0x0;var _0x3b785e=_0x64ce[_0x508faf];return _0x3b785e;};'use strict';var EventEmitter=require(_0xe64c('0x0'));var SmsAccount=require(_0xe64c('0x1'))['db'][_0xe64c('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xe64c('0x3')](0x0);var events={'afterCreate':_0xe64c('0x4'),'afterUpdate':_0xe64c('0x5'),'afterDestroy':_0xe64c('0x6')};function emitEvent(_0x33776b){return function(_0x2c355b,_0x3c64c6,_0x58ab9f){SmsAccountEvents[_0xe64c('0x7')](_0x33776b+':'+_0x2c355b['id'],_0x2c355b);SmsAccountEvents[_0xe64c('0x7')](_0x33776b,_0x2c355b);_0x58ab9f(null);};}for(var e in events){if(events[_0xe64c('0x8')](e)){var event=events[e];SmsAccount[_0xe64c('0x9')](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file +var _0xfaf8=['hasOwnProperty','hook','exports','events','SmsAccount','setMaxListeners','update','remove','emit'];(function(_0x24ea73,_0x536285){var _0x38004b=function(_0xaf7bc4){while(--_0xaf7bc4){_0x24ea73['push'](_0x24ea73['shift']());}};_0x38004b(++_0x536285);}(_0xfaf8,0x66));var _0x8faf=function(_0x48385d,_0x4bcd0c){_0x48385d=_0x48385d-0x0;var _0xe4bc36=_0xfaf8[_0x48385d];return _0xe4bc36;};'use strict';var EventEmitter=require(_0x8faf('0x0'));var SmsAccount=require('../../mysqldb')['db'][_0x8faf('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x8faf('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8faf('0x3'),'afterDestroy':_0x8faf('0x4')};function emitEvent(_0x1aea23){return function(_0x472c24,_0x17a0b7,_0x2756fc){SmsAccountEvents[_0x8faf('0x5')](_0x1aea23+':'+_0x472c24['id'],_0x472c24);SmsAccountEvents['emit'](_0x1aea23,_0x472c24);_0x2756fc(null);};}for(var e in events){if(events[_0x8faf('0x6')](e)){var event=events[e];SmsAccount[_0x8faf('0x7')](e,emitEvent(event));}}module[_0x8faf('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 c99e7fd..8b6a6bb 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 _0x1b19=['path','rimraf','../../config/environment','./smsAccount.attributes','exports','define','sms_accounts','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x1b19,0x10b));var _0x91b1=function(_0x2501c4,_0x202f4e){_0x2501c4=_0x2501c4-0x0;var _0x2b8a63=_0x1b19[_0x2501c4];return _0x2b8a63;};'use strict';var _=require(_0x91b1('0x0'));var util=require(_0x91b1('0x1'));var logger=require(_0x91b1('0x2'))('api');var moment=require(_0x91b1('0x3'));var BPromise=require(_0x91b1('0x4'));var rp=require(_0x91b1('0x5'));var fs=require('fs');var path=require(_0x91b1('0x6'));var rimraf=require(_0x91b1('0x7'));var config=require(_0x91b1('0x8'));var attributes=require(_0x91b1('0x9'));module[_0x91b1('0xa')]=function(_0x16234a,_0x472798){return _0x16234a[_0x91b1('0xb')]('SmsAccount',attributes,{'tableName':_0x91b1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x07bc=['rimraf','../../config/environment','./smsAccount.attributes','define','SmsAccount','sms_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x07bc,0xf4));var _0xc07b=function(_0x1da043,_0x572f78){_0x1da043=_0x1da043-0x0;var _0x30213f=_0x07bc[_0x1da043];return _0x30213f;};'use strict';var _=require(_0xc07b('0x0'));var util=require(_0xc07b('0x1'));var logger=require(_0xc07b('0x2'))(_0xc07b('0x3'));var moment=require(_0xc07b('0x4'));var BPromise=require(_0xc07b('0x5'));var rp=require(_0xc07b('0x6'));var fs=require('fs');var path=require(_0xc07b('0x7'));var rimraf=require(_0xc07b('0x8'));var config=require(_0xc07b('0x9'));var attributes=require(_0xc07b('0xa'));module['exports']=function(_0x1e0ed5,_0x472857){return _0x1e0ed5[_0xc07b('0xb')](_0xc07b('0xc'),attributes,{'tableName':_0xc07b('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index d9f7f6e..c783c5d 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 _0x3383=['request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','ShowSmsAccount','SmsAccount','find','options','where','attributes','include','model','map','then','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','socket.io-emitter','register','request','SmsAccount,\x20%s,\x20%s'];(function(_0x1cc124,_0x5a1044){var _0x884b74=function(_0x4ad609){while(--_0x4ad609){_0x1cc124['push'](_0x1cc124['shift']());}};_0x884b74(++_0x5a1044);}(_0x3383,0xa3));var _0x3338=function(_0x145847,_0xd783b3){_0x145847=_0x145847-0x0;var _0x53a820=_0x3383[_0x145847];return _0x53a820;};'use strict';var _=require(_0x3338('0x0'));var util=require(_0x3338('0x1'));var moment=require(_0x3338('0x2'));var BPromise=require(_0x3338('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3338('0x4'));var db=require(_0x3338('0x5'))['db'];var utils=require(_0x3338('0x6'));var logger=require(_0x3338('0x7'))(_0x3338('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3338('0x9')][_0x3338('0xa')]({'port':0x232a});config[_0x3338('0xb')]=_[_0x3338('0xc')](config[_0x3338('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x3338('0xd'))(new Redis(config[_0x3338('0xb')]));require('./smsAccount.socket')[_0x3338('0xe')](socket);function respondWithRpcPromise(_0x4b71eb,_0x25b7b7,_0x8b37c3){return new BPromise(function(_0x562f9c,_0x357566){return client[_0x3338('0xf')](_0x4b71eb,_0x8b37c3)['then'](function(_0x4d66bb){logger['info'](_0x3338('0x10'),_0x25b7b7,_0x3338('0x11'));logger[_0x3338('0x12')](_0x3338('0x13'),_0x25b7b7,_0x3338('0x11'),JSON['stringify'](_0x4d66bb));if(_0x4d66bb[_0x3338('0x14')]){if(_0x4d66bb['error'][_0x3338('0x15')]===0x1f4){logger[_0x3338('0x14')](_0x3338('0x10'),_0x25b7b7,_0x4d66bb[_0x3338('0x14')][_0x3338('0x16')]);return _0x357566(_0x4d66bb[_0x3338('0x14')][_0x3338('0x16')]);}logger['error'](_0x3338('0x10'),_0x25b7b7,_0x4d66bb[_0x3338('0x14')][_0x3338('0x16')]);return _0x562f9c(_0x4d66bb[_0x3338('0x14')]['message']);}else{logger[_0x3338('0x17')](_0x3338('0x10'),_0x25b7b7,_0x3338('0x11'));_0x562f9c(_0x4d66bb[_0x3338('0x18')][_0x3338('0x16')]);}})['catch'](function(_0x631b7){logger[_0x3338('0x14')](_0x3338('0x10'),_0x25b7b7,_0x631b7);_0x357566(_0x631b7);});});}exports[_0x3338('0x19')]=function(_0x30abd7){var _0x22bebc=this;return new Promise(function(_0x3c6b73,_0x4f8b20){return db[_0x3338('0x1a')][_0x3338('0x1b')]({'raw':_0x30abd7[_0x3338('0x1c')]?_0x30abd7[_0x3338('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x30abd7[_0x3338('0x1c')]?_0x30abd7[_0x3338('0x1c')][_0x3338('0x1d')]||null:null,'attributes':_0x30abd7[_0x3338('0x1c')]?_0x30abd7[_0x3338('0x1c')][_0x3338('0x1e')]||null:null,'include':_0x30abd7[_0x3338('0x1c')]?_0x30abd7[_0x3338('0x1c')][_0x3338('0x1f')]?_['map'](_0x30abd7[_0x3338('0x1c')]['include'],function(_0x514f77){return{'model':db[_0x514f77[_0x3338('0x20')]],'as':_0x514f77['as'],'attributes':_0x514f77[_0x3338('0x1e')],'include':_0x514f77[_0x3338('0x1f')]?_[_0x3338('0x21')](_0x514f77[_0x3338('0x1f')],function(_0x2e84c0){return{'model':db[_0x2e84c0[_0x3338('0x20')]],'as':_0x2e84c0['as'],'attributes':_0x2e84c0[_0x3338('0x1e')],'include':_0x2e84c0[_0x3338('0x1f')]?_[_0x3338('0x21')](_0x2e84c0[_0x3338('0x1f')],function(_0xd3abc7){return{'model':db[_0xd3abc7[_0x3338('0x20')]],'as':_0xd3abc7['as'],'attributes':_0xd3abc7[_0x3338('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x3338('0x22')](function(_0x204a7e){logger[_0x3338('0x17')](_0x3338('0x19'),_0x30abd7);logger['debug']('ShowSmsAccount',_0x30abd7,JSON[_0x3338('0x23')](_0x204a7e));_0x3c6b73(_0x204a7e);})['catch'](function(_0xc801ef){logger[_0x3338('0x14')]('ShowSmsAccount',_0xc801ef[_0x3338('0x16')],_0x30abd7);_0x4f8b20(_0x22bebc[_0x3338('0x14')](0x1f4,_0xc801ef['message']));});});}; \ No newline at end of file +var _0x32fc=['debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSmsAccount','SmsAccount','find','options','raw','attributes','include','map','model','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','./smsAccount.socket','register','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x1fc122,_0x5e2c17){var _0xa2cb13=function(_0x263b13){while(--_0x263b13){_0x1fc122['push'](_0x1fc122['shift']());}};_0xa2cb13(++_0x5e2c17);}(_0x32fc,0x80));var _0xc32f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x32fc[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc32f('0x0'));var util=require(_0xc32f('0x1'));var moment=require(_0xc32f('0x2'));var BPromise=require(_0xc32f('0x3'));var rs=require(_0xc32f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc32f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc32f('0x6'))('rpc');var config=require(_0xc32f('0x7'));var jayson=require(_0xc32f('0x8'));var client=jayson[_0xc32f('0x9')][_0xc32f('0xa')]({'port':0x232a});config[_0xc32f('0xb')]=_['defaults'](config['redis'],{'host':_0xc32f('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc32f('0xd'))[_0xc32f('0xe')](socket);function respondWithRpcPromise(_0x400855,_0x53d7a6,_0x54066e){return new BPromise(function(_0x28f936,_0x2c6171){return client[_0xc32f('0xf')](_0x400855,_0x54066e)[_0xc32f('0x10')](function(_0x20e458){logger[_0xc32f('0x11')](_0xc32f('0x12'),_0x53d7a6,_0xc32f('0x13'));logger[_0xc32f('0x14')](_0xc32f('0x15'),_0x53d7a6,_0xc32f('0x13'),JSON[_0xc32f('0x16')](_0x20e458));if(_0x20e458[_0xc32f('0x17')]){if(_0x20e458[_0xc32f('0x17')][_0xc32f('0x18')]===0x1f4){logger['error']('SmsAccount,\x20%s,\x20%s',_0x53d7a6,_0x20e458[_0xc32f('0x17')][_0xc32f('0x19')]);return _0x2c6171(_0x20e458[_0xc32f('0x17')]['message']);}logger[_0xc32f('0x17')](_0xc32f('0x12'),_0x53d7a6,_0x20e458[_0xc32f('0x17')][_0xc32f('0x19')]);return _0x28f936(_0x20e458[_0xc32f('0x17')][_0xc32f('0x19')]);}else{logger[_0xc32f('0x11')](_0xc32f('0x12'),_0x53d7a6,_0xc32f('0x13'));_0x28f936(_0x20e458[_0xc32f('0x1a')][_0xc32f('0x19')]);}})[_0xc32f('0x1b')](function(_0x1e819b){logger[_0xc32f('0x17')](_0xc32f('0x12'),_0x53d7a6,_0x1e819b);_0x2c6171(_0x1e819b);});});}exports[_0xc32f('0x1c')]=function(_0x452cb3){var _0x1f4426=this;return new Promise(function(_0x5d3165,_0x4808f6){return db[_0xc32f('0x1d')][_0xc32f('0x1e')]({'raw':_0x452cb3[_0xc32f('0x1f')]?_0x452cb3[_0xc32f('0x1f')][_0xc32f('0x20')]===undefined?!![]:![]:!![],'where':_0x452cb3['options']?_0x452cb3['options']['where']||null:null,'attributes':_0x452cb3[_0xc32f('0x1f')]?_0x452cb3[_0xc32f('0x1f')][_0xc32f('0x21')]||null:null,'include':_0x452cb3[_0xc32f('0x1f')]?_0x452cb3[_0xc32f('0x1f')][_0xc32f('0x22')]?_[_0xc32f('0x23')](_0x452cb3[_0xc32f('0x1f')]['include'],function(_0x2254a3){return{'model':db[_0x2254a3[_0xc32f('0x24')]],'as':_0x2254a3['as'],'attributes':_0x2254a3['attributes'],'include':_0x2254a3[_0xc32f('0x22')]?_[_0xc32f('0x23')](_0x2254a3[_0xc32f('0x22')],function(_0x16e65b){return{'model':db[_0x16e65b[_0xc32f('0x24')]],'as':_0x16e65b['as'],'attributes':_0x16e65b[_0xc32f('0x21')],'include':_0x16e65b[_0xc32f('0x22')]?_[_0xc32f('0x23')](_0x16e65b[_0xc32f('0x22')],function(_0x57dcb7){return{'model':db[_0x57dcb7[_0xc32f('0x24')]],'as':_0x57dcb7['as'],'attributes':_0x57dcb7['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x6c4339){logger[_0xc32f('0x11')](_0xc32f('0x1c'),_0x452cb3);logger[_0xc32f('0x14')](_0xc32f('0x1c'),_0x452cb3,JSON[_0xc32f('0x16')](_0x6c4339));_0x5d3165(_0x6c4339);})[_0xc32f('0x1b')](function(_0x145171){logger['error'](_0xc32f('0x1c'),_0x145171[_0xc32f('0x19')],_0x452cb3);_0x4808f6(_0x1f4426[_0xc32f('0x17')](0x1f4,_0x145171[_0xc32f('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index e37999e..8784738 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(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xa9e0[_0x32d457];return _0x338386;};'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(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'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 df2ba03..bed89df 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 _0x3e74=['path','connect-timeout','express','../../components/auth/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','exports','multer'];(function(_0x417d17,_0x17bb4f){var _0x3224ac=function(_0x4f96d4){while(--_0x4f96d4){_0x417d17['push'](_0x417d17['shift']());}};_0x3224ac(++_0x17bb4f);}(_0x3e74,0x175));var _0x43e7=function(_0x4f36e9,_0x6371aa){_0x4f36e9=_0x4f36e9-0x0;var _0x5f7c5e=_0x3e74[_0x4f36e9];return _0x5f7c5e;};'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('0xc')]('/',auth[_0x43e7('0x8')](),controller['create']);router[_0x43e7('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x43e7('0xe')]);router[_0x43e7('0xf')]('/:id',auth[_0x43e7('0x8')](),controller['destroy']);module[_0x43e7('0x10')]=router; \ No newline at end of file +var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x20c9b2,_0x55d7b1){var _0x2c6030=function(_0x10845f){while(--_0x10845f){_0x20c9b2['push'](_0x20c9b2['shift']());}};_0x2c6030(++_0x55d7b1);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 5d14c5d..fc118b8 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 _0x0209=['noop','TEXT','sequelize','exports','INTEGER','STRING'];(function(_0x38e997,_0x10f1c3){var _0x2812ce=function(_0x13fdcc){while(--_0x13fdcc){_0x38e997['push'](_0x38e997['shift']());}};_0x2812ce(++_0x10f1c3);}(_0x0209,0x1b8));var _0x9020=function(_0x27966f,_0x237303){_0x27966f=_0x27966f-0x0;var _0x228052=_0x0209[_0x27966f];return _0x228052;};'use strict';var Sequelize=require(_0x9020('0x0'));module[_0x9020('0x1')]={'priority':{'type':Sequelize[_0x9020('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x9020('0x3')],'allowNull':![],'defaultValue':_0x9020('0x4')},'appdata':{'type':Sequelize[_0x9020('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x9020('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x6010=['noop','STRING','exports','INTEGER'];(function(_0x38537f,_0x252124){var _0x141e23=function(_0x2809b5){while(--_0x2809b5){_0x38537f['push'](_0x38537f['shift']());}};_0x141e23(++_0x252124);}(_0x6010,0x1ee));var _0x0601=function(_0x5a7c22,_0x1c381d){_0x5a7c22=_0x5a7c22-0x0;var _0x376521=_0x6010[_0x5a7c22];return _0x376521;};'use strict';var Sequelize=require('sequelize');module[_0x0601('0x0')]={'priority':{'type':Sequelize[_0x0601('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0601('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x0601('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 6beccaf..2448d6d 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 _0x729f=['end','json','offset','undefined','limit','count','Content-Range','reject','save','then','error','stack','name','send','SmsApplication','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','destroy','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x2e8fe5,_0x2ceea0){var _0x19eca6=function(_0x1cc3e4){while(--_0x1cc3e4){_0x2e8fe5['push'](_0x2e8fe5['shift']());}};_0x19eca6(++_0x2ceea0);}(_0x729f,0xc2));var _0xf729=function(_0x5bdbfd,_0x3aaf24){_0x5bdbfd=_0x5bdbfd-0x0;var _0x5711c0=_0x729f[_0x5bdbfd];return _0x5711c0;};'use strict';var emlformat=require(_0xf729('0x0'));var rimraf=require(_0xf729('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf729('0x2'));var rp=require(_0xf729('0x3'));var moment=require(_0xf729('0x4'));var BPromise=require(_0xf729('0x5'));var Mustache=require(_0xf729('0x6'));var util=require(_0xf729('0x7'));var path=require(_0xf729('0x8'));var sox=require('sox');var csv=require(_0xf729('0x9'));var ejs=require(_0xf729('0xa'));var fs=require('fs');var fs_extra=require(_0xf729('0xb'));var _=require('lodash');var squel=require(_0xf729('0xc'));var crypto=require(_0xf729('0xd'));var jsforce=require(_0xf729('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf729('0xf'));var Papa=require(_0xf729('0x10'));var Redis=require('ioredis');var authService=require(_0xf729('0x11'));var qs=require(_0xf729('0x12'));var as=require(_0xf729('0x13'));var hardwareService=require(_0xf729('0x14'));var logger=require(_0xf729('0x15'))('api');var utils=require(_0xf729('0x16'));var config=require(_0xf729('0x17'));var licenseUtil=require(_0xf729('0x18'));var db=require(_0xf729('0x19'))['db'];function respondWithStatusCode(_0x4da316,_0x4b9c3d){_0x4b9c3d=_0x4b9c3d||0xcc;return function(_0x330a7a){if(_0x330a7a){return _0x4da316[_0xf729('0x1a')](_0x4b9c3d);}return _0x4da316[_0xf729('0x1b')](_0x4b9c3d)[_0xf729('0x1c')]();};}function respondWithResult(_0x20fd16,_0x51eb03){_0x51eb03=_0x51eb03||0xc8;return function(_0x2f4d4e){if(_0x2f4d4e){return _0x20fd16[_0xf729('0x1b')](_0x51eb03)[_0xf729('0x1d')](_0x2f4d4e);}};}function respondWithFilteredResult(_0x1662bb,_0x58b42f){return function(_0x1dca21){if(_0x1dca21){var _0x3021e=typeof _0x58b42f[_0xf729('0x1e')]===_0xf729('0x1f')&&typeof _0x58b42f[_0xf729('0x20')]==='undefined';var _0x324d5a=_0x1dca21[_0xf729('0x21')];var _0x5ab2ab=_0x3021e?0x0:_0x58b42f[_0xf729('0x1e')];var _0x502c90=_0x3021e?_0x1dca21[_0xf729('0x21')]:_0x58b42f[_0xf729('0x1e')]+_0x58b42f[_0xf729('0x20')];var _0x1b7642;if(_0x502c90>=_0x324d5a){_0x502c90=_0x324d5a;_0x1b7642=0xc8;}else{_0x1b7642=0xce;}_0x1662bb[_0xf729('0x1b')](_0x1b7642);return _0x1662bb['set'](_0xf729('0x22'),_0x5ab2ab+'-'+_0x502c90+'/'+_0x324d5a)[_0xf729('0x1d')](_0x1dca21);}return null;};}function patchUpdates(_0x24f773){return function(_0x3be2fe){try{jsonpatch['apply'](_0x3be2fe,_0x24f773,!![]);}catch(_0x22f002){return BPromise[_0xf729('0x23')](_0x22f002);}return _0x3be2fe[_0xf729('0x24')]();};}function saveUpdates(_0x78f50,_0x25ba53){return function(_0x3d7888){if(_0x3d7888){return _0x3d7888['update'](_0x78f50)['then'](function(_0x6531a){return _0x6531a;});}return null;};}function removeEntity(_0x4fb573,_0x4b2eb0){return function(_0x128c33){if(_0x128c33){return _0x128c33['destroy']()[_0xf729('0x25')](function(){_0x4fb573['status'](0xcc)[_0xf729('0x1c')]();});}};}function handleEntityNotFound(_0x38a9fa,_0x4372fe){return function(_0x38d6e9){if(!_0x38d6e9){_0x38a9fa[_0xf729('0x1a')](0x194);}return _0x38d6e9;};}function handleError(_0x100e8f,_0x12e6b0){_0x12e6b0=_0x12e6b0||0x1f4;return function(_0x34f5ea){logger[_0xf729('0x26')](_0x34f5ea[_0xf729('0x27')]);if(_0x34f5ea[_0xf729('0x28')]){delete _0x34f5ea['name'];}_0x100e8f[_0xf729('0x1b')](_0x12e6b0)[_0xf729('0x29')](_0x34f5ea);};}exports['index']=function(_0x43c04b,_0x255501){var _0x3351b0={},_0x5a2d05={},_0x38bda7={'count':0x0,'rows':[]};var _0x4dcf0f=_['map'](db[_0xf729('0x2a')][_0xf729('0x2b')],function(_0x1b9d98){return{'name':_0x1b9d98[_0xf729('0x2c')],'type':_0x1b9d98[_0xf729('0x2d')][_0xf729('0x2e')]};});_0x5a2d05[_0xf729('0x2f')]=_[_0xf729('0x30')](_0x4dcf0f,_0xf729('0x28'));_0x5a2d05[_0xf729('0x31')]=_[_0xf729('0x32')](_0x43c04b[_0xf729('0x31')]);_0x5a2d05['filters']=_[_0xf729('0x33')](_0x5a2d05[_0xf729('0x2f')],_0x5a2d05[_0xf729('0x31')]);_0x3351b0[_0xf729('0x34')]=_[_0xf729('0x33')](_0x5a2d05['model'],qs[_0xf729('0x35')](_0x43c04b[_0xf729('0x31')]['fields']));_0x3351b0['attributes']=_0x3351b0[_0xf729('0x34')][_0xf729('0x36')]?_0x3351b0[_0xf729('0x34')]:_0x5a2d05[_0xf729('0x2f')];if(!_0x43c04b[_0xf729('0x31')][_0xf729('0x37')](_0xf729('0x38'))){_0x3351b0[_0xf729('0x20')]=qs[_0xf729('0x20')](_0x43c04b[_0xf729('0x31')][_0xf729('0x20')]);_0x3351b0[_0xf729('0x1e')]=qs[_0xf729('0x1e')](_0x43c04b['query']['offset']);}_0x3351b0[_0xf729('0x39')]=qs['sort'](_0x43c04b[_0xf729('0x31')][_0xf729('0x3a')]);_0x3351b0['where']=qs['filters'](_['pick'](_0x43c04b[_0xf729('0x31')],_0x5a2d05[_0xf729('0x3b')]),_0x4dcf0f);if(_0x43c04b[_0xf729('0x31')]['filter']){_0x3351b0['where']=_[_0xf729('0x3c')](_0x3351b0[_0xf729('0x3d')],{'$or':_[_0xf729('0x30')](_0x4dcf0f,function(_0x1b637f){if(_0x1b637f[_0xf729('0x2d')]!==_0xf729('0x3e')){var _0x3af3ca={};_0x3af3ca[_0x1b637f['name']]={'$like':'%'+_0x43c04b[_0xf729('0x31')]['filter']+'%'};return _0x3af3ca;}})});}_0x3351b0=_[_0xf729('0x3c')]({},_0x3351b0,_0x43c04b[_0xf729('0x3f')]);var _0x36e097={'where':_0x3351b0[_0xf729('0x3d')]};return db['SmsApplication'][_0xf729('0x21')](_0x36e097)['then'](function(_0x10dc80){_0x38bda7[_0xf729('0x21')]=_0x10dc80;if(_0x43c04b[_0xf729('0x31')][_0xf729('0x40')]){_0x3351b0[_0xf729('0x41')]=[{'all':!![]}];}return db[_0xf729('0x2a')][_0xf729('0x42')](_0x3351b0);})['then'](function(_0x16980c){_0x38bda7[_0xf729('0x43')]=_0x16980c;return _0x38bda7;})['then'](respondWithFilteredResult(_0x255501,_0x3351b0))[_0xf729('0x44')](handleError(_0x255501,null));};exports[_0xf729('0x45')]=function(_0x1cd298,_0x58246b){var _0x1665e3={'raw':!![],'where':{'id':_0x1cd298[_0xf729('0x46')]['id']}},_0x567a58={};_0x567a58[_0xf729('0x2f')]=_[_0xf729('0x32')](db['SmsApplication'][_0xf729('0x2b')]);_0x567a58[_0xf729('0x31')]=_[_0xf729('0x32')](_0x1cd298[_0xf729('0x31')]);_0x567a58[_0xf729('0x3b')]=_[_0xf729('0x33')](_0x567a58['model'],_0x567a58[_0xf729('0x31')]);_0x1665e3[_0xf729('0x34')]=_['intersection'](_0x567a58[_0xf729('0x2f')],qs[_0xf729('0x35')](_0x1cd298[_0xf729('0x31')][_0xf729('0x35')]));_0x1665e3[_0xf729('0x34')]=_0x1665e3['attributes'][_0xf729('0x36')]?_0x1665e3[_0xf729('0x34')]:_0x567a58[_0xf729('0x2f')];if(_0x1cd298[_0xf729('0x31')][_0xf729('0x40')]){_0x1665e3[_0xf729('0x41')]=[{'all':!![]}];}_0x1665e3=_[_0xf729('0x3c')]({},_0x1665e3,_0x1cd298[_0xf729('0x3f')]);return db[_0xf729('0x2a')][_0xf729('0x47')](_0x1665e3)[_0xf729('0x25')](handleEntityNotFound(_0x58246b,null))[_0xf729('0x25')](respondWithResult(_0x58246b,null))['catch'](handleError(_0x58246b,null));};exports[_0xf729('0x48')]=function(_0x511738,_0x418cbf){return db['SmsApplication'][_0xf729('0x48')](_0x511738['body'],{})[_0xf729('0x25')](respondWithResult(_0x418cbf,0xc9))['catch'](handleError(_0x418cbf,null));};exports['update']=function(_0x1fc1f0,_0x5d96d7){if(_0x1fc1f0['body']['id']){delete _0x1fc1f0['body']['id'];}return db['SmsApplication'][_0xf729('0x47')]({'where':{'id':_0x1fc1f0[_0xf729('0x46')]['id']}})[_0xf729('0x25')](handleEntityNotFound(_0x5d96d7,null))[_0xf729('0x25')](saveUpdates(_0x1fc1f0['body'],null))['then'](respondWithResult(_0x5d96d7,null))[_0xf729('0x44')](handleError(_0x5d96d7,null));};exports[_0xf729('0x49')]=function(_0x4d9817,_0x3a7e35){return db[_0xf729('0x2a')]['find']({'where':{'id':_0x4d9817[_0xf729('0x46')]['id']}})[_0xf729('0x25')](handleEntityNotFound(_0x3a7e35,null))['then'](removeEntity(_0x3a7e35,null))[_0xf729('0x44')](handleError(_0x3a7e35,null));}; \ No newline at end of file +var _0x6242=['rows','show','rawAttributes','length','includeAll','find','catch','create','body','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/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','update','then','destroy','stack','name','send','index','map','fieldName','type','key','keys','query','filters','intersection','model','fields','attributes','sort','where','pick','filter','merge','VIRTUAL','include','SmsApplication','findAll'];(function(_0x117576,_0x1ced1a){var _0x4533f5=function(_0x19bc33){while(--_0x19bc33){_0x117576['push'](_0x117576['shift']());}};_0x4533f5(++_0x1ced1a);}(_0x6242,0x1bf));var _0x2624=function(_0x52ec32,_0x28bb6b){_0x52ec32=_0x52ec32-0x0;var _0x467d0e=_0x6242[_0x52ec32];return _0x467d0e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2624('0x0'));var jsonpatch=require(_0x2624('0x1'));var rp=require(_0x2624('0x2'));var moment=require(_0x2624('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x2624('0x4'));var util=require(_0x2624('0x5'));var path=require(_0x2624('0x6'));var sox=require(_0x2624('0x7'));var csv=require(_0x2624('0x8'));var ejs=require(_0x2624('0x9'));var fs=require('fs');var fs_extra=require(_0x2624('0xa'));var _=require(_0x2624('0xb'));var squel=require(_0x2624('0xc'));var crypto=require('crypto');var jsforce=require(_0x2624('0xd'));var deskjs=require(_0x2624('0xe'));var toCsv=require(_0x2624('0x8'));var querystring=require(_0x2624('0xf'));var Papa=require(_0x2624('0x10'));var Redis=require('ioredis');var authService=require(_0x2624('0x11'));var qs=require(_0x2624('0x12'));var as=require(_0x2624('0x13'));var hardwareService=require(_0x2624('0x14'));var logger=require(_0x2624('0x15'))(_0x2624('0x16'));var utils=require(_0x2624('0x17'));var config=require(_0x2624('0x18'));var licenseUtil=require(_0x2624('0x19'));var db=require(_0x2624('0x1a'))['db'];function respondWithStatusCode(_0x166f1f,_0x4fa752){_0x4fa752=_0x4fa752||0xcc;return function(_0x35b291){if(_0x35b291){return _0x166f1f[_0x2624('0x1b')](_0x4fa752);}return _0x166f1f[_0x2624('0x1c')](_0x4fa752)[_0x2624('0x1d')]();};}function respondWithResult(_0x4ed357,_0x3bcdf4){_0x3bcdf4=_0x3bcdf4||0xc8;return function(_0x4f3a74){if(_0x4f3a74){return _0x4ed357['status'](_0x3bcdf4)[_0x2624('0x1e')](_0x4f3a74);}};}function respondWithFilteredResult(_0x135ee3,_0x4a85f6){return function(_0x54e812){if(_0x54e812){var _0x5ae30=typeof _0x4a85f6[_0x2624('0x1f')]===_0x2624('0x20')&&typeof _0x4a85f6[_0x2624('0x21')]===_0x2624('0x20');var _0x1d104b=_0x54e812[_0x2624('0x22')];var _0x1a0de2=_0x5ae30?0x0:_0x4a85f6['offset'];var _0x468ece=_0x5ae30?_0x54e812[_0x2624('0x22')]:_0x4a85f6['offset']+_0x4a85f6[_0x2624('0x21')];var _0x4a8fae;if(_0x468ece>=_0x1d104b){_0x468ece=_0x1d104b;_0x4a8fae=0xc8;}else{_0x4a8fae=0xce;}_0x135ee3[_0x2624('0x1c')](_0x4a8fae);return _0x135ee3['set'](_0x2624('0x23'),_0x1a0de2+'-'+_0x468ece+'/'+_0x1d104b)[_0x2624('0x1e')](_0x54e812);}return null;};}function patchUpdates(_0x39aac4){return function(_0x57cff5){try{jsonpatch['apply'](_0x57cff5,_0x39aac4,!![]);}catch(_0x13eab0){return BPromise[_0x2624('0x24')](_0x13eab0);}return _0x57cff5['save']();};}function saveUpdates(_0x2b5b5b,_0x159ced){return function(_0x10e104){if(_0x10e104){return _0x10e104[_0x2624('0x25')](_0x2b5b5b)[_0x2624('0x26')](function(_0x1a3fc6){return _0x1a3fc6;});}return null;};}function removeEntity(_0x1884f8,_0x1fabe6){return function(_0x26661d){if(_0x26661d){return _0x26661d[_0x2624('0x27')]()[_0x2624('0x26')](function(){_0x1884f8[_0x2624('0x1c')](0xcc)[_0x2624('0x1d')]();});}};}function handleEntityNotFound(_0x2b5f1f,_0x274433){return function(_0x34e2ff){if(!_0x34e2ff){_0x2b5f1f['sendStatus'](0x194);}return _0x34e2ff;};}function handleError(_0x3ee61e,_0x37ad8a){_0x37ad8a=_0x37ad8a||0x1f4;return function(_0xfd1ac1){logger['error'](_0xfd1ac1[_0x2624('0x28')]);if(_0xfd1ac1[_0x2624('0x29')]){delete _0xfd1ac1[_0x2624('0x29')];}_0x3ee61e[_0x2624('0x1c')](_0x37ad8a)[_0x2624('0x2a')](_0xfd1ac1);};}exports[_0x2624('0x2b')]=function(_0x556a8d,_0xad9edb){var _0x36ec78={},_0xc6381c={},_0x4f1c49={'count':0x0,'rows':[]};var _0x15bfa3=_[_0x2624('0x2c')](db['SmsApplication']['rawAttributes'],function(_0x3faa55){return{'name':_0x3faa55[_0x2624('0x2d')],'type':_0x3faa55[_0x2624('0x2e')][_0x2624('0x2f')]};});_0xc6381c['model']=_[_0x2624('0x2c')](_0x15bfa3,_0x2624('0x29'));_0xc6381c['query']=_[_0x2624('0x30')](_0x556a8d[_0x2624('0x31')]);_0xc6381c[_0x2624('0x32')]=_[_0x2624('0x33')](_0xc6381c[_0x2624('0x34')],_0xc6381c[_0x2624('0x31')]);_0x36ec78['attributes']=_[_0x2624('0x33')](_0xc6381c[_0x2624('0x34')],qs['fields'](_0x556a8d[_0x2624('0x31')][_0x2624('0x35')]));_0x36ec78[_0x2624('0x36')]=_0x36ec78[_0x2624('0x36')]['length']?_0x36ec78['attributes']:_0xc6381c[_0x2624('0x34')];if(!_0x556a8d['query']['hasOwnProperty']('nolimit')){_0x36ec78['limit']=qs['limit'](_0x556a8d[_0x2624('0x31')]['limit']);_0x36ec78[_0x2624('0x1f')]=qs[_0x2624('0x1f')](_0x556a8d['query'][_0x2624('0x1f')]);}_0x36ec78['order']=qs[_0x2624('0x37')](_0x556a8d[_0x2624('0x31')][_0x2624('0x37')]);_0x36ec78[_0x2624('0x38')]=qs[_0x2624('0x32')](_[_0x2624('0x39')](_0x556a8d[_0x2624('0x31')],_0xc6381c['filters']),_0x15bfa3);if(_0x556a8d[_0x2624('0x31')][_0x2624('0x3a')]){_0x36ec78[_0x2624('0x38')]=_[_0x2624('0x3b')](_0x36ec78[_0x2624('0x38')],{'$or':_['map'](_0x15bfa3,function(_0x5bfb19){if(_0x5bfb19['type']!==_0x2624('0x3c')){var _0x1e86ca={};_0x1e86ca[_0x5bfb19[_0x2624('0x29')]]={'$like':'%'+_0x556a8d['query'][_0x2624('0x3a')]+'%'};return _0x1e86ca;}})});}_0x36ec78=_['merge']({},_0x36ec78,_0x556a8d['options']);var _0x220fa1={'where':_0x36ec78['where']};return db['SmsApplication'][_0x2624('0x22')](_0x220fa1)[_0x2624('0x26')](function(_0x3bc026){_0x4f1c49[_0x2624('0x22')]=_0x3bc026;if(_0x556a8d[_0x2624('0x31')]['includeAll']){_0x36ec78[_0x2624('0x3d')]=[{'all':!![]}];}return db[_0x2624('0x3e')][_0x2624('0x3f')](_0x36ec78);})['then'](function(_0x297859){_0x4f1c49[_0x2624('0x40')]=_0x297859;return _0x4f1c49;})[_0x2624('0x26')](respondWithFilteredResult(_0xad9edb,_0x36ec78))['catch'](handleError(_0xad9edb,null));};exports[_0x2624('0x41')]=function(_0xab3bab,_0x2faa49){var _0x54ea03={'raw':!![],'where':{'id':_0xab3bab['params']['id']}},_0x33830b={};_0x33830b['model']=_['keys'](db[_0x2624('0x3e')][_0x2624('0x42')]);_0x33830b[_0x2624('0x31')]=_['keys'](_0xab3bab[_0x2624('0x31')]);_0x33830b['filters']=_['intersection'](_0x33830b[_0x2624('0x34')],_0x33830b[_0x2624('0x31')]);_0x54ea03[_0x2624('0x36')]=_['intersection'](_0x33830b['model'],qs[_0x2624('0x35')](_0xab3bab['query']['fields']));_0x54ea03['attributes']=_0x54ea03[_0x2624('0x36')][_0x2624('0x43')]?_0x54ea03[_0x2624('0x36')]:_0x33830b[_0x2624('0x34')];if(_0xab3bab['query'][_0x2624('0x44')]){_0x54ea03[_0x2624('0x3d')]=[{'all':!![]}];}_0x54ea03=_[_0x2624('0x3b')]({},_0x54ea03,_0xab3bab['options']);return db[_0x2624('0x3e')][_0x2624('0x45')](_0x54ea03)['then'](handleEntityNotFound(_0x2faa49,null))[_0x2624('0x26')](respondWithResult(_0x2faa49,null))[_0x2624('0x46')](handleError(_0x2faa49,null));};exports[_0x2624('0x47')]=function(_0x2042d0,_0x3bdd71){return db['SmsApplication'][_0x2624('0x47')](_0x2042d0[_0x2624('0x48')],{})[_0x2624('0x26')](respondWithResult(_0x3bdd71,0xc9))[_0x2624('0x46')](handleError(_0x3bdd71,null));};exports[_0x2624('0x25')]=function(_0x448ed3,_0x49aad2){if(_0x448ed3[_0x2624('0x48')]['id']){delete _0x448ed3[_0x2624('0x48')]['id'];}return db['SmsApplication'][_0x2624('0x45')]({'where':{'id':_0x448ed3['params']['id']}})['then'](handleEntityNotFound(_0x49aad2,null))['then'](saveUpdates(_0x448ed3[_0x2624('0x48')],null))[_0x2624('0x26')](respondWithResult(_0x49aad2,null))['catch'](handleError(_0x49aad2,null));};exports[_0x2624('0x27')]=function(_0x287d9c,_0x5befad){return db[_0x2624('0x3e')][_0x2624('0x45')]({'where':{'id':_0x287d9c['params']['id']}})[_0x2624('0x26')](handleEntityNotFound(_0x5befad,null))[_0x2624('0x26')](removeEntity(_0x5befad,null))[_0x2624('0x46')](handleError(_0x5befad,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 9ace077..21359f4 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 _0xa94d=['../../config/logger','api','bluebird','path','rimraf','../../config/environment','exports','define','SmsApplication','sms_applications','utf8mb4_unicode_ci','lodash','util'];(function(_0x2cdd20,_0x19729f){var _0x461bce=function(_0x1dc11e){while(--_0x1dc11e){_0x2cdd20['push'](_0x2cdd20['shift']());}};_0x461bce(++_0x19729f);}(_0xa94d,0x80));var _0xda94=function(_0x3547d6,_0x55add0){_0x3547d6=_0x3547d6-0x0;var _0x161361=_0xa94d[_0x3547d6];return _0x161361;};'use strict';var _=require(_0xda94('0x0'));var util=require(_0xda94('0x1'));var logger=require(_0xda94('0x2'))(_0xda94('0x3'));var moment=require('moment');var BPromise=require(_0xda94('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xda94('0x5'));var rimraf=require(_0xda94('0x6'));var config=require(_0xda94('0x7'));var attributes=require('./smsApplication.attributes');module[_0xda94('0x8')]=function(_0x4b42a0,_0x278a7e){return _0x4b42a0[_0xda94('0x9')](_0xda94('0xa'),attributes,{'tableName':_0xda94('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xda94('0xc')});}; \ No newline at end of file +var _0xe88d=['request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','exports','define','SmsApplication','sms_applications','utf8mb4','lodash','util','../../config/logger','bluebird'];(function(_0x5c12ba,_0x229eee){var _0x4ed0fa=function(_0x410943){while(--_0x410943){_0x5c12ba['push'](_0x5c12ba['shift']());}};_0x4ed0fa(++_0x229eee);}(_0xe88d,0x1ae));var _0xde88=function(_0x30faee,_0x1c3794){_0x30faee=_0x30faee-0x0;var _0x3a90ab=_0xe88d[_0x30faee];return _0x3a90ab;};'use strict';var _=require(_0xde88('0x0'));var util=require(_0xde88('0x1'));var logger=require(_0xde88('0x2'))('api');var moment=require('moment');var BPromise=require(_0xde88('0x3'));var rp=require(_0xde88('0x4'));var fs=require('fs');var path=require(_0xde88('0x5'));var rimraf=require(_0xde88('0x6'));var config=require(_0xde88('0x7'));var attributes=require(_0xde88('0x8'));module[_0xde88('0x9')]=function(_0x444ff2,_0x440acc){return _0x444ff2[_0xde88('0xa')](_0xde88('0xb'),attributes,{'tableName':_0xde88('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xde88('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 4447191..dcc8538 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 _0x5386=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util'];(function(_0x585883,_0x2cda0f){var _0x3a88ed=function(_0x45af55){while(--_0x45af55){_0x585883['push'](_0x585883['shift']());}};_0x3a88ed(++_0x2cda0f);}(_0x5386,0x1e1));var _0x6538=function(_0x48ecd2,_0x481ad3){_0x48ecd2=_0x48ecd2-0x0;var _0x5a4457=_0x5386[_0x48ecd2];return _0x5a4457;};'use strict';var _=require(_0x6538('0x0'));var util=require(_0x6538('0x1'));var moment=require(_0x6538('0x2'));var BPromise=require(_0x6538('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6538('0x4'));var db=require(_0x6538('0x5'))['db'];var utils=require(_0x6538('0x6'));var logger=require(_0x6538('0x7'))(_0x6538('0x8'));var config=require(_0x6538('0x9'));var jayson=require(_0x6538('0xa'));var client=jayson[_0x6538('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x16c291,_0x4b0e05,_0x16d67){return new BPromise(function(_0x28e83b,_0x113fe4){return client[_0x6538('0xc')](_0x16c291,_0x16d67)[_0x6538('0xd')](function(_0x2bce05){logger[_0x6538('0xe')](_0x6538('0xf'),_0x4b0e05,_0x6538('0x10'));logger[_0x6538('0x11')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0x4b0e05,_0x6538('0x10'),JSON[_0x6538('0x12')](_0x2bce05));if(_0x2bce05[_0x6538('0x13')]){if(_0x2bce05['error'][_0x6538('0x14')]===0x1f4){logger['error'](_0x6538('0xf'),_0x4b0e05,_0x2bce05[_0x6538('0x13')]['message']);return _0x113fe4(_0x2bce05[_0x6538('0x13')][_0x6538('0x15')]);}logger['error'](_0x6538('0xf'),_0x4b0e05,_0x2bce05[_0x6538('0x13')][_0x6538('0x15')]);return _0x28e83b(_0x2bce05['error'][_0x6538('0x15')]);}else{logger['info'](_0x6538('0xf'),_0x4b0e05,_0x6538('0x10'));_0x28e83b(_0x2bce05[_0x6538('0x16')][_0x6538('0x15')]);}})['catch'](function(_0x7caa07){logger[_0x6538('0x13')]('SmsApplication,\x20%s,\x20%s',_0x4b0e05,_0x7caa07);_0x113fe4(_0x7caa07);});});} \ No newline at end of file +var _0x8603=['message','info','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','SmsApplication,\x20%s,\x20%s','request\x20sent','SmsApplication,\x20%s,\x20%s,\x20%s','error'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x8603,0x190));var _0x3860=function(_0x522c70,_0x89c019){_0x522c70=_0x522c70-0x0;var _0x1a6323=_0x8603[_0x522c70];return _0x1a6323;};'use strict';var _=require('lodash');var util=require(_0x3860('0x0'));var moment=require(_0x3860('0x1'));var BPromise=require(_0x3860('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3860('0x3'))['db'];var utils=require(_0x3860('0x4'));var logger=require(_0x3860('0x5'))('rpc');var config=require(_0x3860('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3860('0x7')][_0x3860('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1eca44,_0xd3ce26,_0x472bf2){return new BPromise(function(_0x4aba10,_0x5c7350){return client['request'](_0x1eca44,_0x472bf2)[_0x3860('0x9')](function(_0x441dc4){logger['info'](_0x3860('0xa'),_0xd3ce26,_0x3860('0xb'));logger['debug'](_0x3860('0xc'),_0xd3ce26,_0x3860('0xb'),JSON['stringify'](_0x441dc4));if(_0x441dc4[_0x3860('0xd')]){if(_0x441dc4[_0x3860('0xd')]['code']===0x1f4){logger[_0x3860('0xd')](_0x3860('0xa'),_0xd3ce26,_0x441dc4[_0x3860('0xd')][_0x3860('0xe')]);return _0x5c7350(_0x441dc4[_0x3860('0xd')][_0x3860('0xe')]);}logger[_0x3860('0xd')](_0x3860('0xa'),_0xd3ce26,_0x441dc4[_0x3860('0xd')][_0x3860('0xe')]);return _0x4aba10(_0x441dc4['error'][_0x3860('0xe')]);}else{logger[_0x3860('0xf')](_0x3860('0xa'),_0xd3ce26,_0x3860('0xb'));_0x4aba10(_0x441dc4[_0x3860('0x10')][_0x3860('0xe')]);}})[_0x3860('0x11')](function(_0x378305){logger[_0x3860('0xd')](_0x3860('0xa'),_0xd3ce26,_0x378305);_0x5c7350(_0x378305);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 92786a9..919299c 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 _0x2032=['./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','show','/:id/messages','getMessages','/:id/download','download','create','/:id/tags','sms','smsinteraction:addtags','addTags','put','/:id','tracked','smsinteraction:update','update','smsinteraction:destroy','delete','removeTags','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x38c160,_0x1318fa){var _0x780b56=function(_0x51c44e){while(--_0x51c44e){_0x38c160['push'](_0x38c160['shift']());}};_0x780b56(++_0x1318fa);}(_0x2032,0xd9));var _0x2203=function(_0x2f00d5,_0x3b2a4b){_0x2f00d5=_0x2f00d5-0x0;var _0x3e281b=_0x2032[_0x2f00d5];return _0x3e281b;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var fs_extra=require(_0x2203('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var controller=require(_0x2203('0x7'));router[_0x2203('0x8')]('/',auth[_0x2203('0x9')](),controller[_0x2203('0xa')]);router[_0x2203('0x8')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0xc')]);router[_0x2203('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x2203('0xd')]);router['get'](_0x2203('0xe'),auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);router['get'](_0x2203('0x10'),auth['isAuthenticated'](),controller[_0x2203('0x11')]);router['post']('/',auth[_0x2203('0x9')](),controller[_0x2203('0x12')]);router['post']('/:id/messages',auth['isAuthenticated'](),controller['addMessage']);router['post'](_0x2203('0x13'),auth['isAuthenticated'](),interaction['tracked'](_0x2203('0x14'),_0x2203('0x15')),controller[_0x2203('0x16')]);router[_0x2203('0x17')](_0x2203('0x18'),auth[_0x2203('0x9')](),interaction[_0x2203('0x19')](_0x2203('0x14'),_0x2203('0x1a')),controller[_0x2203('0x1b')]);router['delete'](_0x2203('0x18'),auth[_0x2203('0x9')](),interaction['tracked'](_0x2203('0x14'),_0x2203('0x1c')),controller['destroy']);router[_0x2203('0x1d')]('/:id/tags',auth[_0x2203('0x9')](),controller[_0x2203('0x1e')]);module[_0x2203('0x1f')]=router; \ No newline at end of file +var _0x6e6c=['create','addMessage','tracked','sms','smsinteraction:addtags','addTags','/:id','smsinteraction:update','update','smsinteraction:destroy','destroy','delete','/:id/tags','removeTags','exports','multer','util','connect-timeout','express','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id/messages','getMessages','/:id/download','download','post'];(function(_0x2f08f9,_0x2532fc){var _0x15434b=function(_0x505f16){while(--_0x505f16){_0x2f08f9['push'](_0x2f08f9['shift']());}};_0x15434b(++_0x2532fc);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x6e6c[_0x397e5f];return _0x5302b8;};'use strict';var multer=require(_0xc6e6('0x0'));var util=require(_0xc6e6('0x1'));var path=require('path');var timeout=require(_0xc6e6('0x2'));var express=require(_0xc6e6('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc6e6('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xc6e6('0x5'));var controller=require('./smsInteraction.controller');router[_0xc6e6('0x6')]('/',auth[_0xc6e6('0x7')](),controller['index']);router[_0xc6e6('0x6')](_0xc6e6('0x8'),auth['isAuthenticated'](),controller[_0xc6e6('0x9')]);router[_0xc6e6('0x6')]('/:id',auth[_0xc6e6('0x7')](),controller['show']);router[_0xc6e6('0x6')](_0xc6e6('0xa'),auth[_0xc6e6('0x7')](),controller[_0xc6e6('0xb')]);router[_0xc6e6('0x6')](_0xc6e6('0xc'),auth[_0xc6e6('0x7')](),controller[_0xc6e6('0xd')]);router[_0xc6e6('0xe')]('/',auth['isAuthenticated'](),controller[_0xc6e6('0xf')]);router['post'](_0xc6e6('0xa'),auth[_0xc6e6('0x7')](),controller[_0xc6e6('0x10')]);router[_0xc6e6('0xe')]('/:id/tags',auth[_0xc6e6('0x7')](),interaction[_0xc6e6('0x11')](_0xc6e6('0x12'),_0xc6e6('0x13')),controller[_0xc6e6('0x14')]);router['put'](_0xc6e6('0x15'),auth[_0xc6e6('0x7')](),interaction['tracked'](_0xc6e6('0x12'),_0xc6e6('0x16')),controller[_0xc6e6('0x17')]);router['delete']('/:id',auth['isAuthenticated'](),interaction[_0xc6e6('0x11')]('sms',_0xc6e6('0x18')),controller[_0xc6e6('0x19')]);router[_0xc6e6('0x1a')](_0xc6e6('0x1b'),auth[_0xc6e6('0x7')](),controller[_0xc6e6('0x1c')]);module[_0xc6e6('0x1d')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 4b6ade1..6035d89 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 _0x8403=['BOOLEAN','DATE','STRING','ENUM','out','sequelize','moment','exports'];(function(_0x48e1ec,_0x35f468){var _0x3b33eb=function(_0x507bf9){while(--_0x507bf9){_0x48e1ec['push'](_0x48e1ec['shift']());}};_0x3b33eb(++_0x35f468);}(_0x8403,0x1a5));var _0x3840=function(_0x491ab0,_0x3753fb){_0x491ab0=_0x491ab0-0x0;var _0x314db2=_0x8403[_0x491ab0];return _0x314db2;};'use strict';var Sequelize=require(_0x3840('0x0'));var moment=require(_0x3840('0x1'));module[_0x3840('0x2')]={'closed':{'type':Sequelize[_0x3840('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x3840('0x4')]},'disposition':{'type':Sequelize[_0x3840('0x5')]},'secondDisposition':{'type':Sequelize[_0x3840('0x5')]},'thirdDisposition':{'type':Sequelize[_0x3840('0x5')]},'note':{'type':Sequelize[_0x3840('0x5')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x3840('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x3840('0x6')]('in',_0x3840('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x3840('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x3840('0x6')]('in',_0x3840('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xb2f1=['sequelize','moment','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x5f38a0,_0x2087e){var _0x1bedf0=function(_0xfeb89){while(--_0xfeb89){_0x5f38a0['push'](_0x5f38a0['shift']());}};_0x1bedf0(++_0x2087e);}(_0xb2f1,0xee));var _0x1b2f=function(_0x5beb9e,_0x59c6af){_0x5beb9e=_0x5beb9e-0x0;var _0x2833f4=_0xb2f1[_0x5beb9e];return _0x2833f4;};'use strict';var Sequelize=require(_0x1b2f('0x0'));var moment=require(_0x1b2f('0x1'));module['exports']={'closed':{'type':Sequelize[_0x1b2f('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x1b2f('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x1b2f('0x4')]},'thirdDisposition':{'type':Sequelize[_0x1b2f('0x4')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x1b2f('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x1b2f('0x5')]('in',_0x1b2f('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x1b2f('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x1b2f('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 259e956..824e417 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 _0x644f=['fields','length','includeAll','merge','find','body','describe','SmsMessage','addMessage','omit','ids','getMessages','findOne','hasOwnProperty','nolimit','order','sort','where','SmsInteractionId','filter','$gte','split','format','include','findAll','rows','addTags','setTags','Tag','emit','removeTags','download','unix','toString','join','server','tmp','transcript-%d-%s.zip','push','User','CmContact','Contact','firstName','lastName','Messages','createdAt','direction','read','SmsAccount','Account','Owner','fullname','get','mkdirSync','Sms','N.A.','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','out','System','secret','renderFile','root','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','sendStatus','rimraf','zip-dir','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','register','status','end','offset','undefined','limit','count','Content-Range','json','update','destroy','then','error','name','send','index','map','SmsInteraction','rawAttributes','fieldName','type','key','getOptions','sms','query','catch','show','params','keys','filters','intersection','model','attributes'];(function(_0x17141f,_0x4d7c4b){var _0x3ee900=function(_0x5ec0f4){while(--_0x5ec0f4){_0x17141f['push'](_0x17141f['shift']());}};_0x3ee900(++_0x4d7c4b);}(_0x644f,0xc2));var _0xf644=function(_0x260f28,_0x4e9b30){_0x260f28=_0x260f28-0x0;var _0x3aefcc=_0x644f[_0x260f28];return _0x3aefcc;};'use strict';var rimraf=require(_0xf644('0x0'));var zipdir=require(_0xf644('0x1'));var moment=require('moment');var BPromise=require('bluebird');var util=require(_0xf644('0x2'));var path=require(_0xf644('0x3'));var ejs=require(_0xf644('0x4'));var fs=require('fs');var _=require(_0xf644('0x5'));var Redis=require(_0xf644('0x6'));var interaction=require(_0xf644('0x7'));var qs=require(_0xf644('0x8'));var pdf=require(_0xf644('0x9'));var logger=require(_0xf644('0xa'))(_0xf644('0xb'));var config=require(_0xf644('0xc'));var db=require(_0xf644('0xd'))['db'];config['redis']=_[_0xf644('0xe')](config[_0xf644('0xf')],{'host':'localhost','port':0x18eb});var socket=require(_0xf644('0x10'))(new Redis(config['redis']));require('./smsInteraction.socket')[_0xf644('0x11')](socket);function respondWithStatusCode(_0x4a490d,_0x2c7bd0){_0x2c7bd0=_0x2c7bd0||0xcc;return function(_0x865312){if(_0x865312){return _0x4a490d['sendStatus'](_0x2c7bd0);}return _0x4a490d[_0xf644('0x12')](_0x2c7bd0)[_0xf644('0x13')]();};}function respondWithResult(_0x1ef872,_0x5911d3){_0x5911d3=_0x5911d3||0xc8;return function(_0x296647){if(_0x296647){return _0x1ef872[_0xf644('0x12')](_0x5911d3)['json'](_0x296647);}};}function respondWithFilteredResult(_0x3678c9,_0xaa5d1c){return function(_0x4ed4d6){if(_0x4ed4d6){var _0x400906=typeof _0xaa5d1c[_0xf644('0x14')]===_0xf644('0x15')&&typeof _0xaa5d1c[_0xf644('0x16')]==='undefined';var _0x155fd9=_0x4ed4d6[_0xf644('0x17')];var _0x52f74a=_0x400906?0x0:_0xaa5d1c['offset'];var _0x4c197b=_0x400906?_0x4ed4d6['count']:_0xaa5d1c[_0xf644('0x14')]+_0xaa5d1c[_0xf644('0x16')];var _0x34dec2;if(_0x4c197b>=_0x155fd9){_0x4c197b=_0x155fd9;_0x34dec2=0xc8;}else{_0x34dec2=0xce;}_0x3678c9[_0xf644('0x12')](_0x34dec2);return _0x3678c9['set'](_0xf644('0x18'),_0x52f74a+'-'+_0x4c197b+'/'+_0x155fd9)[_0xf644('0x19')](_0x4ed4d6);}return null;};}function saveUpdates(_0x4650b5){return function(_0x44fc39){if(_0x44fc39){return _0x44fc39[_0xf644('0x1a')](_0x4650b5)['then'](function(_0x4beeb0){return _0x4beeb0;});}return null;};}function removeEntity(_0x37c32d){return function(_0x305515){if(_0x305515){return _0x305515[_0xf644('0x1b')]()[_0xf644('0x1c')](function(){_0x37c32d[_0xf644('0x12')](0xcc)[_0xf644('0x13')]();});}};}function handleEntityNotFound(_0x67e595){return function(_0x20c0fb){if(!_0x20c0fb){_0x67e595['sendStatus'](0x194);}return _0x20c0fb;};}function handleError(_0x14af1b,_0x1c36b4){_0x1c36b4=_0x1c36b4||0x1f4;return function(_0x2180c6){logger[_0xf644('0x1d')](_0x2180c6['stack']);if(_0x2180c6[_0xf644('0x1e')]){delete _0x2180c6[_0xf644('0x1e')];}_0x14af1b[_0xf644('0x12')](_0x1c36b4)[_0xf644('0x1f')](_0x2180c6);};}exports[_0xf644('0x20')]=function(_0x3173c1,_0xae30c0){var _0x4cb86c={};var _0x4b6369=_[_0xf644('0x21')](db[_0xf644('0x22')][_0xf644('0x23')],function(_0x383987){return{'name':_0x383987[_0xf644('0x24')],'type':_0x383987[_0xf644('0x25')][_0xf644('0x26')]};});_0x4cb86c=qs[_0xf644('0x27')](_0x4b6369,_0x3173c1);return interaction['findAll'](_0xf644('0x28'),_0x3173c1[_0xf644('0x29')],_0x3173c1['user'],_0x4cb86c,_0x4b6369)['then'](respondWithFilteredResult(_0xae30c0,_0x4cb86c))[_0xf644('0x2a')](handleError(_0xae30c0,null));};exports[_0xf644('0x2b')]=function(_0x16c745,_0x3881e3){var _0x2bcb20={'raw':![],'where':{'id':_0x16c745[_0xf644('0x2c')]['id']}},_0x1ef501={};_0x1ef501['model']=_[_0xf644('0x2d')](db[_0xf644('0x22')]['rawAttributes']);_0x1ef501['query']=_[_0xf644('0x2d')](_0x16c745[_0xf644('0x29')]);_0x1ef501[_0xf644('0x2e')]=_[_0xf644('0x2f')](_0x1ef501[_0xf644('0x30')],_0x1ef501[_0xf644('0x29')]);_0x2bcb20[_0xf644('0x31')]=_[_0xf644('0x2f')](_0x1ef501[_0xf644('0x30')],qs[_0xf644('0x32')](_0x16c745['query']['fields']));_0x2bcb20[_0xf644('0x31')]=_0x2bcb20[_0xf644('0x31')][_0xf644('0x33')]?_0x2bcb20[_0xf644('0x31')]:_0x1ef501[_0xf644('0x30')];if(_0x16c745[_0xf644('0x29')][_0xf644('0x34')]){_0x2bcb20['include']=[{'all':!![]}];}_0x2bcb20=_[_0xf644('0x35')]({},_0x2bcb20,_0x16c745['options']);return db['SmsInteraction'][_0xf644('0x36')](_0x2bcb20)[_0xf644('0x1c')](handleEntityNotFound(_0x3881e3,null))[_0xf644('0x1c')](respondWithResult(_0x3881e3,null))['catch'](handleError(_0x3881e3,null));};exports['create']=function(_0x3aa198,_0xd5790a){return db[_0xf644('0x22')]['create'](_0x3aa198[_0xf644('0x37')],{})[_0xf644('0x1c')](respondWithResult(_0xd5790a,0xc9))['catch'](handleError(_0xd5790a,null));};exports[_0xf644('0x1a')]=function(_0x67cbfc,_0x27fbc7){if(_0x67cbfc[_0xf644('0x37')]['id']){delete _0x67cbfc[_0xf644('0x37')]['id'];}return db[_0xf644('0x22')]['find']({'where':{'id':_0x67cbfc[_0xf644('0x2c')]['id']}})['then'](handleEntityNotFound(_0x27fbc7,null))[_0xf644('0x1c')](saveUpdates(_0x67cbfc[_0xf644('0x37')],null))[_0xf644('0x1c')](respondWithResult(_0x27fbc7,null))[_0xf644('0x2a')](handleError(_0x27fbc7,null));};exports[_0xf644('0x1b')]=function(_0x60bec,_0x52e738){return db[_0xf644('0x22')][_0xf644('0x36')]({'where':{'id':_0x60bec[_0xf644('0x2c')]['id']}})['then'](handleEntityNotFound(_0x52e738,null))['then'](removeEntity(_0x52e738,null))[_0xf644('0x2a')](handleError(_0x52e738,null));};exports[_0xf644('0x38')]=function(_0x11d879,_0x14efb3){return db['SmsInteraction'][_0xf644('0x38')]()['then'](respondWithResult(_0x14efb3,null))[_0xf644('0x2a')](handleError(_0x14efb3,null));};exports['addMessage']=function(_0x2d9f52,_0x3475cf){return db[_0xf644('0x39')][_0xf644('0x36')]({'where':{'id':_0x2d9f52['params']['id']}})[_0xf644('0x1c')](handleEntityNotFound(_0x3475cf,null))[_0xf644('0x1c')](function(_0x565e83){if(_0x565e83){return _0x565e83[_0xf644('0x3a')](_0x2d9f52[_0xf644('0x37')]['ids'],_[_0xf644('0x3b')](_0x2d9f52['body'],[_0xf644('0x3c'),'id'])||{});}})[_0xf644('0x1c')](respondWithResult(_0x3475cf,null))[_0xf644('0x2a')](handleError(_0x3475cf,null));};exports[_0xf644('0x3d')]=function(_0x29724d,_0x594615){var _0x1062e3={'raw':![],'where':{}};var _0x395340={};var _0x1b9e4f={'count':0x0,'rows':[]};return db[_0xf644('0x22')][_0xf644('0x3e')]({'where':{'id':_0x29724d['params']['id']}})[_0xf644('0x1c')](handleEntityNotFound(_0x594615,null))[_0xf644('0x1c')](function(_0x2db98c){if(_0x2db98c){_0x395340['model']=_[_0xf644('0x2d')](db[_0xf644('0x39')][_0xf644('0x23')]);_0x395340[_0xf644('0x29')]=_['keys'](_0x29724d['query']);_0x395340[_0xf644('0x2e')]=_[_0xf644('0x2f')](_0x395340[_0xf644('0x30')],_0x395340[_0xf644('0x29')]);_0x1062e3['attributes']=_['intersection'](_0x395340[_0xf644('0x30')],qs[_0xf644('0x32')](_0x29724d[_0xf644('0x29')]['fields']));_0x1062e3[_0xf644('0x31')]=_0x1062e3[_0xf644('0x31')][_0xf644('0x33')]?_0x1062e3[_0xf644('0x31')]:_0x395340[_0xf644('0x30')];if(!_0x29724d[_0xf644('0x29')][_0xf644('0x3f')](_0xf644('0x40'))){_0x1062e3[_0xf644('0x16')]=qs['limit'](_0x29724d[_0xf644('0x29')][_0xf644('0x16')]);_0x1062e3[_0xf644('0x14')]=qs[_0xf644('0x14')](_0x29724d[_0xf644('0x29')][_0xf644('0x14')]);}_0x1062e3[_0xf644('0x41')]=qs['sort'](_0x29724d[_0xf644('0x29')][_0xf644('0x42')]);_0x1062e3['where']=qs['filters'](_['pick'](_0x29724d[_0xf644('0x29')],_0x395340['filters']));_0x1062e3[_0xf644('0x43')][_0xf644('0x44')]=_0x2db98c['id'];if(_0x29724d['query'][_0xf644('0x45')]){_0x1062e3[_0xf644('0x43')]=_[_0xf644('0x35')](_0x1062e3[_0xf644('0x43')],{'$or':_[_0xf644('0x21')](_0x1062e3[_0xf644('0x31')],function(_0x40910c){var _0x3d0915={};_0x3d0915[_0x40910c]={'$like':'%'+_0x29724d['query'][_0xf644('0x45')]+'%'};return _0x3d0915;})});}if(_0x29724d[_0xf644('0x29')][_0xf644('0x46')]){var _0x53701d=_0x29724d[_0xf644('0x29')][_0xf644('0x46')][_0xf644('0x47')](',');var _0x58a3b8={};_0x58a3b8[_0x53701d[0x0]]={'$gte':moment(_0x53701d[0x1])[_0xf644('0x48')]('YYYY-MM-DD\x20HH:mm:ss')};_0x1062e3[_0xf644('0x43')]=_['merge'](_0x1062e3[_0xf644('0x43')],_0x58a3b8);}_0x1062e3=_[_0xf644('0x35')]({},_0x1062e3,_0x29724d['options']);return db[_0xf644('0x39')][_0xf644('0x17')]({'where':_0x1062e3[_0xf644('0x43')]})[_0xf644('0x1c')](function(_0x1d68fd){_0x1b9e4f['count']=_0x1d68fd;if(_0x29724d['query'][_0xf644('0x34')]){_0x1062e3[_0xf644('0x49')]=[{'all':!![]}];}return db[_0xf644('0x39')][_0xf644('0x4a')](_0x1062e3);})[_0xf644('0x1c')](function(_0x4763c7){_0x1b9e4f[_0xf644('0x4b')]=_0x4763c7;return _0x1b9e4f;});}})[_0xf644('0x1c')](respondWithFilteredResult(_0x594615,_0x1062e3))[_0xf644('0x2a')](handleError(_0x594615,null));};exports[_0xf644('0x4c')]=function(_0x389c40,_0xf74e1){return db[_0xf644('0x22')][_0xf644('0x36')]({'where':{'id':_0x389c40['params']['id']}})[_0xf644('0x1c')](handleEntityNotFound(_0xf74e1,null))[_0xf644('0x1c')](function(_0x2ad9a3){if(_0x2ad9a3){return _0x2ad9a3[_0xf644('0x4d')](_0x389c40[_0xf644('0x37')][_0xf644('0x3c')],_[_0xf644('0x3b')](_0x389c40[_0xf644('0x37')],[_0xf644('0x3c'),'id'])||{})['spread'](function(){return db[_0xf644('0x4e')][_0xf644('0x4a')]({'attributes':['id',_0xf644('0x1e'),'color'],'where':{'id':_0x389c40[_0xf644('0x37')][_0xf644('0x3c')]}});})['then'](function(_0x4efff5){socket[_0xf644('0x4f')]('smsInteractionTags:save',{'id':Number(_0x389c40[_0xf644('0x2c')]['id']),'tags':_0x4efff5||[]});return{'id':Number(_0x389c40[_0xf644('0x2c')]['id']),'tags':_0x4efff5||[]};});}})[_0xf644('0x1c')](respondWithResult(_0xf74e1,null))['catch'](handleError(_0xf74e1,null));};exports[_0xf644('0x50')]=function(_0xc225ae,_0x41e3d8){return db['SmsInteraction'][_0xf644('0x36')]({'where':{'id':_0xc225ae[_0xf644('0x2c')]['id']}})['then'](handleEntityNotFound(_0x41e3d8,null))[_0xf644('0x1c')](function(_0x479d21){if(_0x479d21){return _0x479d21[_0xf644('0x50')](_0xc225ae['query'][_0xf644('0x3c')]);}})['then'](respondWithStatusCode(_0x41e3d8,null))[_0xf644('0x2a')](handleError(_0x41e3d8,null));};exports[_0xf644('0x51')]=function(_0x27c13d,_0x36c5db){var _0x31e76a=moment()[_0xf644('0x52')]()[_0xf644('0x53')]();var _0xf258d8=path[_0xf644('0x54')](config['root'],_0xf644('0x55'),'files',_0xf644('0x56'));var _0x18b52b=path[_0xf644('0x54')](_0xf258d8,_0x31e76a);var _0xbd0649=util['format'](_0xf644('0x57'),_0x27c13d[_0xf644('0x2c')]['id'],_0x31e76a);var _0x2eac5e=path[_0xf644('0x54')](_0xf258d8,_0xbd0649);var _0x25ccee=[];_0x25ccee[_0xf644('0x58')]({'model':db[_0xf644('0x59')],'as':_0xf644('0x59'),'attributes':['id','fullname'],'raw':!![]});_0x25ccee[_0xf644('0x58')]({'model':db[_0xf644('0x5a')],'as':_0xf644('0x5b'),'attributes':['id',_0xf644('0x5c'),_0xf644('0x5d')],'raw':!![]});var _0x275a9e=[{'model':db[_0xf644('0x39')],'as':_0xf644('0x5e'),'attributes':['id','body',_0xf644('0x5f'),_0xf644('0x60'),'secret',_0xf644('0x61')],'include':_0x25ccee}];_0x275a9e['push']({'model':db[_0xf644('0x62')],'as':_0xf644('0x63'),'attributes':['id',_0xf644('0x1e')]});_0x275a9e['push']({'model':db['User'],'as':_0xf644('0x64'),'attributes':['id',_0xf644('0x65')]});return db[_0xf644('0x22')][_0xf644('0x36')]({'where':{'id':_0x27c13d[_0xf644('0x2c')]['id']},'include':_0x275a9e})['then'](handleEntityNotFound(_0x36c5db,null))[_0xf644('0x1c')](function(_0x4ec2b1){if(_0x4ec2b1){var _0x580871=_0x4ec2b1[_0xf644('0x66')]({'plain':!![]});fs[_0xf644('0x67')](_0x18b52b);var _0x174bfd={'channel':_0xf644('0x68'),'account':_0x580871[_0xf644('0x63')][_0xf644('0x1e')],'agent':_0x580871[_0xf644('0x64')]?_0x580871['Owner'][_0xf644('0x65')]:_0xf644('0x69'),'createdAt':moment(_0x580871[_0xf644('0x5f')])[_0xf644('0x48')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x580871[_0xf644('0x6a')]?moment(_0x580871[_0xf644('0x6b')])[_0xf644('0x48')](_0xf644('0x6c'))[_0xf644('0x53')]():'','disposition':_0x580871['disposition'],'messages':_(_0x580871['Messages'])['filter']({'secret':![]})[_0xf644('0x21')](function(_0xfd5aad){return{'date':moment(_0xfd5aad[_0xf644('0x5f')])[_0xf644('0x48')](_0xf644('0x6c'))['toString'](),'sender':_0xfd5aad[_0xf644('0x60')]===_0xf644('0x6d')?_0xfd5aad[_0xf644('0x59')]?_0xfd5aad[_0xf644('0x59')][_0xf644('0x65')]:_0xf644('0x6e'):_0xfd5aad[_0xf644('0x5b')]['firstName']+(_0xfd5aad['Contact'][_0xf644('0x5d')]?'\x20'+_0xfd5aad['Contact'][_0xf644('0x5d')]:''),'body':_0xfd5aad[_0xf644('0x37')],'direction':_0xfd5aad[_0xf644('0x60')]===_0xf644('0x6d')?'A':'C','secret':_0xfd5aad[_0xf644('0x6f')],'read':_0xfd5aad[_0xf644('0x61')]};})['value']()};return ejs[_0xf644('0x70')](path['join'](config[_0xf644('0x71')],'server','views',_0xf644('0x72')),{'interaction':_0x174bfd})['then'](function(_0x29f9f9){var _0x2310e8=path['join'](_0x18b52b,_0xf644('0x73')+_0x580871['id']+'-'+_0x31e76a+_0xf644('0x74'));var _0x173a93={'path':_0x2310e8,'channel':_0xf644('0x68'),'interactionId':_0x580871['id']};return pdf[_0xf644('0x75')](_0x29f9f9,_0x173a93);})[_0xf644('0x1c')](function(){return new BPromise(function(_0x1a3ba2,_0x152f1e){zipdir(_0x18b52b,{'saveTo':_0x2eac5e},function(_0x50bdd7,_0x4f485f){if(_0x50bdd7)return _0x152f1e(_0x50bdd7);return _0x1a3ba2(_0x4f485f);});})['then'](function(){return new BPromise(function(_0x49f208,_0x4b3a85){rimraf(_0x18b52b,function(_0x59d2e1){if(_0x59d2e1)_0x4b3a85(_0x59d2e1);return _0x49f208();});});})[_0xf644('0x1c')](function(){return _0x36c5db['download'](_0x2eac5e,_0xbd0649,function(_0x17586f){if(_0x17586f){console[_0xf644('0x76')](_0xf644('0x77'),_0x17586f);}else{fs[_0xf644('0x78')](_0x2eac5e);}});});});}else{return _0x36c5db[_0xf644('0x79')](0xc8);}})['catch'](handleError(_0x36c5db,null));}; \ No newline at end of file +var _0x254a=['findAll','sms','query','catch','show','params','model','keys','filters','intersection','fields','attributes','length','includeAll','merge','options','SmsInteraction','find','create','body','describe','addMessage','SmsMessage','omit','ids','getMessages','hasOwnProperty','nolimit','order','where','pick','SmsInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','include','addTags','setTags','spread','color','emit','smsInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','tmp','transcript-%d-%s.zip','push','User','CmContact','Contact','firstName','Messages','createdAt','direction','secret','SmsAccount','Account','Owner','fullname','mkdirSync','Sms','N.A.','closedAt','out','lastName','read','renderFile','views','transcript-','createPdfFromHTML','log','err','unlinkSync','rimraf','zip-dir','moment','util','path','ejs','lodash','../../components/interaction/service','../../components/export/pdf','../../config/logger','api','redis','defaults','localhost','./smsInteraction.socket','sendStatus','status','end','json','offset','undefined','limit','count','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','getOptions'];(function(_0x312775,_0x486f37){var _0x3cff11=function(_0x4c4715){while(--_0x4c4715){_0x312775['push'](_0x312775['shift']());}};_0x3cff11(++_0x486f37);}(_0x254a,0x138));var _0xa254=function(_0x41598b,_0x897d53){_0x41598b=_0x41598b-0x0;var _0x2cb5e5=_0x254a[_0x41598b];return _0x2cb5e5;};'use strict';var rimraf=require(_0xa254('0x0'));var zipdir=require(_0xa254('0x1'));var moment=require(_0xa254('0x2'));var BPromise=require('bluebird');var util=require(_0xa254('0x3'));var path=require(_0xa254('0x4'));var ejs=require(_0xa254('0x5'));var fs=require('fs');var _=require(_0xa254('0x6'));var Redis=require('ioredis');var interaction=require(_0xa254('0x7'));var qs=require('../../components/parsers/qs');var pdf=require(_0xa254('0x8'));var logger=require(_0xa254('0x9'))(_0xa254('0xa'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xa254('0xb')]=_[_0xa254('0xc')](config['redis'],{'host':_0xa254('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa254('0xb')]));require(_0xa254('0xe'))['register'](socket);function respondWithStatusCode(_0x4fc5f2,_0x346ea1){_0x346ea1=_0x346ea1||0xcc;return function(_0x2a4519){if(_0x2a4519){return _0x4fc5f2[_0xa254('0xf')](_0x346ea1);}return _0x4fc5f2[_0xa254('0x10')](_0x346ea1)[_0xa254('0x11')]();};}function respondWithResult(_0x533881,_0x11965c){_0x11965c=_0x11965c||0xc8;return function(_0x5b5f73){if(_0x5b5f73){return _0x533881['status'](_0x11965c)[_0xa254('0x12')](_0x5b5f73);}};}function respondWithFilteredResult(_0x1e3cf8,_0x504296){return function(_0x22c469){if(_0x22c469){var _0x46322b=typeof _0x504296[_0xa254('0x13')]===_0xa254('0x14')&&typeof _0x504296[_0xa254('0x15')]==='undefined';var _0x217467=_0x22c469[_0xa254('0x16')];var _0x7532b7=_0x46322b?0x0:_0x504296[_0xa254('0x13')];var _0x37586e=_0x46322b?_0x22c469[_0xa254('0x16')]:_0x504296[_0xa254('0x13')]+_0x504296[_0xa254('0x15')];var _0x348a64;if(_0x37586e>=_0x217467){_0x37586e=_0x217467;_0x348a64=0xc8;}else{_0x348a64=0xce;}_0x1e3cf8['status'](_0x348a64);return _0x1e3cf8['set']('Content-Range',_0x7532b7+'-'+_0x37586e+'/'+_0x217467)[_0xa254('0x12')](_0x22c469);}return null;};}function saveUpdates(_0x2dcf3a){return function(_0x31ec79){if(_0x31ec79){return _0x31ec79[_0xa254('0x17')](_0x2dcf3a)[_0xa254('0x18')](function(_0x1b7773){return _0x1b7773;});}return null;};}function removeEntity(_0x25455e){return function(_0x4d82f9){if(_0x4d82f9){return _0x4d82f9[_0xa254('0x19')]()['then'](function(){_0x25455e[_0xa254('0x10')](0xcc)[_0xa254('0x11')]();});}};}function handleEntityNotFound(_0x572b2f){return function(_0x3a1927){if(!_0x3a1927){_0x572b2f[_0xa254('0xf')](0x194);}return _0x3a1927;};}function handleError(_0x53f908,_0x5d8bcc){_0x5d8bcc=_0x5d8bcc||0x1f4;return function(_0x34c7c4){logger[_0xa254('0x1a')](_0x34c7c4[_0xa254('0x1b')]);if(_0x34c7c4['name']){delete _0x34c7c4[_0xa254('0x1c')];}_0x53f908[_0xa254('0x10')](_0x5d8bcc)[_0xa254('0x1d')](_0x34c7c4);};}exports['index']=function(_0x4bd012,_0xe734d5){var _0xcbf8c4={};var _0x3c2a25=_[_0xa254('0x1e')](db['SmsInteraction'][_0xa254('0x1f')],function(_0xdd8c94){return{'name':_0xdd8c94[_0xa254('0x20')],'type':_0xdd8c94[_0xa254('0x21')][_0xa254('0x22')]};});_0xcbf8c4=qs[_0xa254('0x23')](_0x3c2a25,_0x4bd012);return interaction[_0xa254('0x24')](_0xa254('0x25'),_0x4bd012[_0xa254('0x26')],_0x4bd012['user'],_0xcbf8c4,_0x3c2a25)[_0xa254('0x18')](respondWithFilteredResult(_0xe734d5,_0xcbf8c4))[_0xa254('0x27')](handleError(_0xe734d5,null));};exports[_0xa254('0x28')]=function(_0x135cf3,_0x627344){var _0x5c9e28={'raw':![],'where':{'id':_0x135cf3[_0xa254('0x29')]['id']}},_0xa6aad0={};_0xa6aad0[_0xa254('0x2a')]=_[_0xa254('0x2b')](db['SmsInteraction'][_0xa254('0x1f')]);_0xa6aad0[_0xa254('0x26')]=_[_0xa254('0x2b')](_0x135cf3[_0xa254('0x26')]);_0xa6aad0[_0xa254('0x2c')]=_[_0xa254('0x2d')](_0xa6aad0[_0xa254('0x2a')],_0xa6aad0[_0xa254('0x26')]);_0x5c9e28['attributes']=_[_0xa254('0x2d')](_0xa6aad0[_0xa254('0x2a')],qs[_0xa254('0x2e')](_0x135cf3[_0xa254('0x26')]['fields']));_0x5c9e28[_0xa254('0x2f')]=_0x5c9e28[_0xa254('0x2f')][_0xa254('0x30')]?_0x5c9e28['attributes']:_0xa6aad0[_0xa254('0x2a')];if(_0x135cf3[_0xa254('0x26')][_0xa254('0x31')]){_0x5c9e28['include']=[{'all':!![]}];}_0x5c9e28=_[_0xa254('0x32')]({},_0x5c9e28,_0x135cf3[_0xa254('0x33')]);return db[_0xa254('0x34')][_0xa254('0x35')](_0x5c9e28)[_0xa254('0x18')](handleEntityNotFound(_0x627344,null))[_0xa254('0x18')](respondWithResult(_0x627344,null))[_0xa254('0x27')](handleError(_0x627344,null));};exports[_0xa254('0x36')]=function(_0x172d0d,_0x4aa54e){return db['SmsInteraction'][_0xa254('0x36')](_0x172d0d[_0xa254('0x37')],{})['then'](respondWithResult(_0x4aa54e,0xc9))[_0xa254('0x27')](handleError(_0x4aa54e,null));};exports['update']=function(_0x5d1cd0,_0x288c66){if(_0x5d1cd0[_0xa254('0x37')]['id']){delete _0x5d1cd0[_0xa254('0x37')]['id'];}return db[_0xa254('0x34')]['find']({'where':{'id':_0x5d1cd0[_0xa254('0x29')]['id']}})[_0xa254('0x18')](handleEntityNotFound(_0x288c66,null))[_0xa254('0x18')](saveUpdates(_0x5d1cd0[_0xa254('0x37')],null))[_0xa254('0x18')](respondWithResult(_0x288c66,null))[_0xa254('0x27')](handleError(_0x288c66,null));};exports[_0xa254('0x19')]=function(_0x120195,_0x1a7d06){return db[_0xa254('0x34')][_0xa254('0x35')]({'where':{'id':_0x120195[_0xa254('0x29')]['id']}})[_0xa254('0x18')](handleEntityNotFound(_0x1a7d06,null))['then'](removeEntity(_0x1a7d06,null))['catch'](handleError(_0x1a7d06,null));};exports[_0xa254('0x38')]=function(_0x15fe81,_0x5e359f){return db['SmsInteraction'][_0xa254('0x38')]()[_0xa254('0x18')](respondWithResult(_0x5e359f,null))[_0xa254('0x27')](handleError(_0x5e359f,null));};exports[_0xa254('0x39')]=function(_0x3d9efa,_0x2efe10){return db[_0xa254('0x3a')]['find']({'where':{'id':_0x3d9efa[_0xa254('0x29')]['id']}})[_0xa254('0x18')](handleEntityNotFound(_0x2efe10,null))[_0xa254('0x18')](function(_0xf1ee69){if(_0xf1ee69){return _0xf1ee69[_0xa254('0x39')](_0x3d9efa[_0xa254('0x37')]['ids'],_[_0xa254('0x3b')](_0x3d9efa[_0xa254('0x37')],[_0xa254('0x3c'),'id'])||{});}})[_0xa254('0x18')](respondWithResult(_0x2efe10,null))[_0xa254('0x27')](handleError(_0x2efe10,null));};exports[_0xa254('0x3d')]=function(_0x3a3458,_0x32c60e){var _0x171d57={'raw':![],'where':{}};var _0x15bbba={};var _0x21f446={'count':0x0,'rows':[]};return db['SmsInteraction']['findOne']({'where':{'id':_0x3a3458[_0xa254('0x29')]['id']}})[_0xa254('0x18')](handleEntityNotFound(_0x32c60e,null))[_0xa254('0x18')](function(_0x4814e0){if(_0x4814e0){_0x15bbba[_0xa254('0x2a')]=_['keys'](db[_0xa254('0x3a')][_0xa254('0x1f')]);_0x15bbba[_0xa254('0x26')]=_['keys'](_0x3a3458[_0xa254('0x26')]);_0x15bbba['filters']=_[_0xa254('0x2d')](_0x15bbba[_0xa254('0x2a')],_0x15bbba[_0xa254('0x26')]);_0x171d57[_0xa254('0x2f')]=_[_0xa254('0x2d')](_0x15bbba['model'],qs[_0xa254('0x2e')](_0x3a3458['query'][_0xa254('0x2e')]));_0x171d57[_0xa254('0x2f')]=_0x171d57['attributes'][_0xa254('0x30')]?_0x171d57[_0xa254('0x2f')]:_0x15bbba[_0xa254('0x2a')];if(!_0x3a3458[_0xa254('0x26')][_0xa254('0x3e')](_0xa254('0x3f'))){_0x171d57[_0xa254('0x15')]=qs[_0xa254('0x15')](_0x3a3458['query']['limit']);_0x171d57['offset']=qs[_0xa254('0x13')](_0x3a3458['query'][_0xa254('0x13')]);}_0x171d57[_0xa254('0x40')]=qs['sort'](_0x3a3458[_0xa254('0x26')]['sort']);_0x171d57[_0xa254('0x41')]=qs[_0xa254('0x2c')](_[_0xa254('0x42')](_0x3a3458[_0xa254('0x26')],_0x15bbba[_0xa254('0x2c')]));_0x171d57[_0xa254('0x41')][_0xa254('0x43')]=_0x4814e0['id'];if(_0x3a3458[_0xa254('0x26')][_0xa254('0x44')]){_0x171d57[_0xa254('0x41')]=_[_0xa254('0x32')](_0x171d57['where'],{'$or':_[_0xa254('0x1e')](_0x171d57[_0xa254('0x2f')],function(_0x4056e6){var _0x624926={};_0x624926[_0x4056e6]={'$like':'%'+_0x3a3458[_0xa254('0x26')][_0xa254('0x44')]+'%'};return _0x624926;})});}if(_0x3a3458['query'][_0xa254('0x45')]){var _0x578233=_0x3a3458['query'][_0xa254('0x45')][_0xa254('0x46')](',');var _0x2869b1={};_0x2869b1[_0x578233[0x0]]={'$gte':moment(_0x578233[0x1])['format'](_0xa254('0x47'))};_0x171d57['where']=_[_0xa254('0x32')](_0x171d57[_0xa254('0x41')],_0x2869b1);}_0x171d57=_[_0xa254('0x32')]({},_0x171d57,_0x3a3458[_0xa254('0x33')]);return db[_0xa254('0x3a')]['count']({'where':_0x171d57[_0xa254('0x41')]})[_0xa254('0x18')](function(_0x2775ba){_0x21f446[_0xa254('0x16')]=_0x2775ba;if(_0x3a3458[_0xa254('0x26')][_0xa254('0x31')]){_0x171d57[_0xa254('0x48')]=[{'all':!![]}];}return db[_0xa254('0x3a')]['findAll'](_0x171d57);})[_0xa254('0x18')](function(_0x2fc253){_0x21f446['rows']=_0x2fc253;return _0x21f446;});}})[_0xa254('0x18')](respondWithFilteredResult(_0x32c60e,_0x171d57))[_0xa254('0x27')](handleError(_0x32c60e,null));};exports[_0xa254('0x49')]=function(_0x4e7e2b,_0x4fb797){return db[_0xa254('0x34')][_0xa254('0x35')]({'where':{'id':_0x4e7e2b[_0xa254('0x29')]['id']}})[_0xa254('0x18')](handleEntityNotFound(_0x4fb797,null))['then'](function(_0x348e6){if(_0x348e6){return _0x348e6[_0xa254('0x4a')](_0x4e7e2b[_0xa254('0x37')][_0xa254('0x3c')],_['omit'](_0x4e7e2b[_0xa254('0x37')],[_0xa254('0x3c'),'id'])||{})[_0xa254('0x4b')](function(){return db['Tag'][_0xa254('0x24')]({'attributes':['id',_0xa254('0x1c'),_0xa254('0x4c')],'where':{'id':_0x4e7e2b['body'][_0xa254('0x3c')]}});})[_0xa254('0x18')](function(_0x1bd93d){socket[_0xa254('0x4d')](_0xa254('0x4e'),{'id':Number(_0x4e7e2b['params']['id']),'tags':_0x1bd93d||[]});return{'id':Number(_0x4e7e2b['params']['id']),'tags':_0x1bd93d||[]};});}})[_0xa254('0x18')](respondWithResult(_0x4fb797,null))[_0xa254('0x27')](handleError(_0x4fb797,null));};exports[_0xa254('0x4f')]=function(_0x49d39f,_0x10b8be){return db[_0xa254('0x34')]['find']({'where':{'id':_0x49d39f[_0xa254('0x29')]['id']}})[_0xa254('0x18')](handleEntityNotFound(_0x10b8be,null))[_0xa254('0x18')](function(_0x29bdb9){if(_0x29bdb9){return _0x29bdb9[_0xa254('0x4f')](_0x49d39f[_0xa254('0x26')][_0xa254('0x3c')]);}})[_0xa254('0x18')](respondWithStatusCode(_0x10b8be,null))['catch'](handleError(_0x10b8be,null));};exports[_0xa254('0x50')]=function(_0x1d89fd,_0x5f1081){var _0x81b94f=moment()[_0xa254('0x51')]()[_0xa254('0x52')]();var _0xb21c9=path[_0xa254('0x53')](config[_0xa254('0x54')],_0xa254('0x55'),_0xa254('0x56'),_0xa254('0x57'));var _0x57d176=path['join'](_0xb21c9,_0x81b94f);var _0x1d7b8b=util['format'](_0xa254('0x58'),_0x1d89fd[_0xa254('0x29')]['id'],_0x81b94f);var _0x5eb711=path[_0xa254('0x53')](_0xb21c9,_0x1d7b8b);var _0x28d224=[];_0x28d224[_0xa254('0x59')]({'model':db[_0xa254('0x5a')],'as':_0xa254('0x5a'),'attributes':['id','fullname'],'raw':!![]});_0x28d224[_0xa254('0x59')]({'model':db[_0xa254('0x5b')],'as':_0xa254('0x5c'),'attributes':['id',_0xa254('0x5d'),'lastName'],'raw':!![]});var _0x62948f=[{'model':db[_0xa254('0x3a')],'as':_0xa254('0x5e'),'attributes':['id','body',_0xa254('0x5f'),_0xa254('0x60'),_0xa254('0x61'),'read'],'include':_0x28d224}];_0x62948f['push']({'model':db[_0xa254('0x62')],'as':_0xa254('0x63'),'attributes':['id',_0xa254('0x1c')]});_0x62948f[_0xa254('0x59')]({'model':db[_0xa254('0x5a')],'as':_0xa254('0x64'),'attributes':['id',_0xa254('0x65')]});return db[_0xa254('0x34')][_0xa254('0x35')]({'where':{'id':_0x1d89fd[_0xa254('0x29')]['id']},'include':_0x62948f})[_0xa254('0x18')](handleEntityNotFound(_0x5f1081,null))[_0xa254('0x18')](function(_0x478448){if(_0x478448){var _0x3cc896=_0x478448['get']({'plain':!![]});fs[_0xa254('0x66')](_0x57d176);var _0xc07788={'channel':_0xa254('0x67'),'account':_0x3cc896[_0xa254('0x63')][_0xa254('0x1c')],'agent':_0x3cc896[_0xa254('0x64')]?_0x3cc896[_0xa254('0x64')]['fullname']:_0xa254('0x68'),'createdAt':moment(_0x3cc896[_0xa254('0x5f')])['format'](_0xa254('0x47'))[_0xa254('0x52')](),'closedAt':_0x3cc896['closed']?moment(_0x3cc896[_0xa254('0x69')])['format'](_0xa254('0x47'))[_0xa254('0x52')]():'','disposition':_0x3cc896['disposition'],'messages':_(_0x3cc896['Messages'])['filter']({'secret':![]})['map'](function(_0x1b38e1){return{'date':moment(_0x1b38e1[_0xa254('0x5f')])['format'](_0xa254('0x47'))[_0xa254('0x52')](),'sender':_0x1b38e1['direction']===_0xa254('0x6a')?_0x1b38e1[_0xa254('0x5a')]?_0x1b38e1[_0xa254('0x5a')][_0xa254('0x65')]:'System':_0x1b38e1[_0xa254('0x5c')][_0xa254('0x5d')]+(_0x1b38e1[_0xa254('0x5c')][_0xa254('0x6b')]?'\x20'+_0x1b38e1['Contact'][_0xa254('0x6b')]:''),'body':_0x1b38e1[_0xa254('0x37')],'direction':_0x1b38e1[_0xa254('0x60')]==='out'?'A':'C','secret':_0x1b38e1[_0xa254('0x61')],'read':_0x1b38e1[_0xa254('0x6c')]};})['value']()};return ejs[_0xa254('0x6d')](path[_0xa254('0x53')](config[_0xa254('0x54')],_0xa254('0x55'),_0xa254('0x6e'),'downloadInteraction.ejs'),{'interaction':_0xc07788})['then'](function(_0x37f04d){var _0x173206=path[_0xa254('0x53')](_0x57d176,_0xa254('0x6f')+_0x3cc896['id']+'-'+_0x81b94f+'.pdf');var _0xb99519={'path':_0x173206,'channel':_0xa254('0x67'),'interactionId':_0x3cc896['id']};return pdf[_0xa254('0x70')](_0x37f04d,_0xb99519);})[_0xa254('0x18')](function(){return new BPromise(function(_0x123456,_0x51fd39){zipdir(_0x57d176,{'saveTo':_0x5eb711},function(_0x33cf5a,_0x448f85){if(_0x33cf5a)return _0x51fd39(_0x33cf5a);return _0x123456(_0x448f85);});})[_0xa254('0x18')](function(){return new BPromise(function(_0x1ccf16,_0x3248c9){rimraf(_0x57d176,function(_0x14ecd1){if(_0x14ecd1)_0x3248c9(_0x14ecd1);return _0x1ccf16();});});})['then'](function(){return _0x5f1081['download'](_0x5eb711,_0x1d7b8b,function(_0x14042c){if(_0x14042c){console[_0xa254('0x71')](_0xa254('0x72'),_0x14042c);}else{fs[_0xa254('0x73')](_0x5eb711);}});});});}else{return _0x5f1081[_0xa254('0xf')](0xc8);}})['catch'](handleError(_0x5f1081,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 0fb49b8..904af21 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 _0xaebd=['SmsInteraction','../../mysqldb','SmsMessage','setMaxListeners','save','remove','then','map','findAll','unreadMessages','emit','catch','hasOwnProperty','events'];(function(_0x317fe5,_0x4bed83){var _0x1702e0=function(_0x3d3978){while(--_0x3d3978){_0x317fe5['push'](_0x317fe5['shift']());}};_0x1702e0(++_0x4bed83);}(_0xaebd,0x1e9));var _0xdaeb=function(_0x476823,_0x46c089){_0x476823=_0x476823-0x0;var _0x3fb2d7=_0xaebd[_0x476823];return _0x3fb2d7;};'use strict';var EventEmitter=require(_0xdaeb('0x0'));var SmsInteraction=require('../../mysqldb')['db'][_0xdaeb('0x1')];var SmsMessage=require(_0xdaeb('0x2'))['db'][_0xdaeb('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xdaeb('0x4')](0x0);var events={'afterCreate':_0xdaeb('0x5'),'afterUpdate':'update','afterDestroy':_0xdaeb('0x6')};function emitEvent(_0x1c617a){return function(_0x1a99be,_0x1141fe,_0xee94f9){_0x1a99be['getUsers']({'attributes':['id'],'raw':!![]})[_0xdaeb('0x7')](function(_0x3f7ba1){_0x1a99be['setDataValue']('Users',_0x3f7ba1[_0xdaeb('0x8')](function(_0x11b164){return{'id':_0x11b164['id']};}));return SmsMessage[_0xdaeb('0x9')]({'where':{'SmsInteractionId':_0x1a99be['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0xbb4b72){_0x1a99be['setDataValue'](_0xdaeb('0xa'),_0xbb4b72['length']);SmsInteractionEvents[_0xdaeb('0xb')](_0x1c617a+':'+_0x1a99be['id'],_0x1a99be);SmsInteractionEvents['emit'](_0x1c617a,_0x1a99be);_0xee94f9(null);})[_0xdaeb('0xc')](_0xee94f9(null));};}for(var e in events){if(events[_0xdaeb('0xd')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file +var _0xc2c7=['setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','update','remove','getUsers','Users','map','findAll','then'];(function(_0x126e70,_0x5d48ac){var _0x1a8a66=function(_0x54c03f){while(--_0x54c03f){_0x126e70['push'](_0x126e70['shift']());}};_0x1a8a66(++_0x5d48ac);}(_0xc2c7,0x134));var _0x7c2c=function(_0x1854aa,_0x521ce8){_0x1854aa=_0x1854aa-0x0;var _0x48bd51=_0xc2c7[_0x1854aa];return _0x48bd51;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0x7c2c('0x0'))['db'][_0x7c2c('0x1')];var SmsMessage=require(_0x7c2c('0x0'))['db'][_0x7c2c('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x7c2c('0x3')](0x0);var events={'afterCreate':_0x7c2c('0x4'),'afterUpdate':_0x7c2c('0x5'),'afterDestroy':_0x7c2c('0x6')};function emitEvent(_0x4bbc14){return function(_0x59f346,_0x31dc4e,_0x42ecc9){_0x59f346[_0x7c2c('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x4abe93){_0x59f346['setDataValue'](_0x7c2c('0x8'),_0x4abe93[_0x7c2c('0x9')](function(_0x3e668f){return{'id':_0x3e668f['id']};}));return SmsMessage[_0x7c2c('0xa')]({'where':{'SmsInteractionId':_0x59f346['id'],'direction':'in','read':![]},'raw':!![]});})[_0x7c2c('0xb')](function(_0x57b107){_0x59f346[_0x7c2c('0xc')](_0x7c2c('0xd'),_0x57b107[_0x7c2c('0xe')]);SmsInteractionEvents[_0x7c2c('0xf')](_0x4bbc14+':'+_0x59f346['id'],_0x59f346);SmsInteractionEvents[_0x7c2c('0xf')](_0x4bbc14,_0x59f346);_0x42ecc9(null);})[_0x7c2c('0x10')](_0x42ecc9(null));};}for(var e in events){if(events[_0x7c2c('0x11')](e)){var event=events[e];SmsInteraction[_0x7c2c('0x12')](e,emitEvent(event));}}module[_0x7c2c('0x13')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 597d4f0..425a9f2 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 _0xd38d=['request-promise','path','rimraf','./smsInteraction.attributes','define','SmsInteraction','sms_interactions','changed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','bluebird'];(function(_0x25997b,_0xeddec4){var _0x43f8e1=function(_0x3a1005){while(--_0x3a1005){_0x25997b['push'](_0x25997b['shift']());}};_0x43f8e1(++_0xeddec4);}(_0xd38d,0x145));var _0xdd38=function(_0x236c89,_0xd76ba9){_0x236c89=_0x236c89-0x0;var _0x3b2a15=_0xd38d[_0x236c89];return _0x3b2a15;};'use strict';var _=require(_0xdd38('0x0'));var util=require(_0xdd38('0x1'));var logger=require(_0xdd38('0x2'))('api');var moment=require(_0xdd38('0x3'));var BPromise=require(_0xdd38('0x4'));var rp=require(_0xdd38('0x5'));var fs=require('fs');var path=require(_0xdd38('0x6'));var rimraf=require(_0xdd38('0x7'));var config=require('../../config/environment');var attributes=require(_0xdd38('0x8'));module['exports']=function(_0x2d2b6b,_0x500dc6){return _0x2d2b6b[_0xdd38('0x9')](_0xdd38('0xa'),attributes,{'tableName':_0xdd38('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1da777,_0x184836,_0x1fe2be){if(_0x1da777[_0xdd38('0xc')]('closed')){_0x1da777[_0xdd38('0xd')]=moment()['format'](_0xdd38('0xe'));}_0x1fe2be(null,_0x1da777);}}});}; \ No newline at end of file +var _0x9c5a=['exports','SmsInteraction','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./smsInteraction.attributes'];(function(_0x32c55a,_0x211eba){var _0x3252b3=function(_0x5db811){while(--_0x5db811){_0x32c55a['push'](_0x32c55a['shift']());}};_0x3252b3(++_0x211eba);}(_0x9c5a,0x151));var _0xa9c5=function(_0x15026a,_0x31508a){_0x15026a=_0x15026a-0x0;var _0x468883=_0x9c5a[_0x15026a];return _0x468883;};'use strict';var _=require(_0xa9c5('0x0'));var util=require('util');var logger=require(_0xa9c5('0x1'))('api');var moment=require(_0xa9c5('0x2'));var BPromise=require(_0xa9c5('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa9c5('0x4'));var rimraf=require(_0xa9c5('0x5'));var config=require(_0xa9c5('0x6'));var attributes=require(_0xa9c5('0x7'));module[_0xa9c5('0x8')]=function(_0x157142,_0xdfc3dd){return _0x157142['define'](_0xa9c5('0x9'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4ab1f3,_0x133043,_0x500397){if(_0x4ab1f3[_0xa9c5('0xa')](_0xa9c5('0xb'))){_0x4ab1f3[_0xa9c5('0xc')]=moment()[_0xa9c5('0xd')](_0xa9c5('0xe'));}_0x500397(null,_0x4ab1f3);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index d575fb2..ae53b4e 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 _0x861a=['attributes','limit','stringify','find','body','ids','spread','AddTags','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','error','code','SmsInteraction,\x20%s,\x20%s','message','result','catch','UpdateSmsInteraction','SmsInteraction','update','options','raw','where'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x861a,0xec));var _0xa861=function(_0x5a7a33,_0x39de57){_0x5a7a33=_0x5a7a33-0x0;var _0x12688e=_0x861a[_0x5a7a33];return _0x12688e;};'use strict';var _=require(_0xa861('0x0'));var util=require('util');var moment=require(_0xa861('0x1'));var BPromise=require(_0xa861('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa861('0x3'));var db=require(_0xa861('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa861('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa861('0x6'));var client=jayson[_0xa861('0x7')]['http']({'port':0x232a});config[_0xa861('0x8')]=_[_0xa861('0x9')](config['redis'],{'host':_0xa861('0xa'),'port':0x18eb});var socket=require(_0xa861('0xb'))(new Redis(config[_0xa861('0x8')]));require('./smsInteraction.socket')[_0xa861('0xc')](socket);function respondWithRpcPromise(_0x21bf15,_0x2933af,_0x233c8d){return new BPromise(function(_0x2f2adb,_0x30b085){return client[_0xa861('0xd')](_0x21bf15,_0x233c8d)[_0xa861('0xe')](function(_0x5d778b){logger[_0xa861('0xf')]('SmsInteraction,\x20%s,\x20%s',_0x2933af,_0xa861('0x10'));logger[_0xa861('0x11')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x2933af,_0xa861('0x10'),JSON['stringify'](_0x5d778b));if(_0x5d778b['error']){if(_0x5d778b[_0xa861('0x12')][_0xa861('0x13')]===0x1f4){logger[_0xa861('0x12')]('SmsInteraction,\x20%s,\x20%s',_0x2933af,_0x5d778b[_0xa861('0x12')]['message']);return _0x30b085(_0x5d778b[_0xa861('0x12')]['message']);}logger[_0xa861('0x12')](_0xa861('0x14'),_0x2933af,_0x5d778b[_0xa861('0x12')]['message']);return _0x2f2adb(_0x5d778b[_0xa861('0x12')][_0xa861('0x15')]);}else{logger[_0xa861('0xf')](_0xa861('0x14'),_0x2933af,_0xa861('0x10'));_0x2f2adb(_0x5d778b[_0xa861('0x16')][_0xa861('0x15')]);}})[_0xa861('0x17')](function(_0x343479){logger[_0xa861('0x12')](_0xa861('0x14'),_0x2933af,_0x343479);_0x30b085(_0x343479);});});}exports[_0xa861('0x18')]=function(_0x347d36){var _0x5b4568=this;return new Promise(function(_0x25f002,_0x25ca2f){return db[_0xa861('0x19')][_0xa861('0x1a')](_0x347d36['body'],{'raw':_0x347d36[_0xa861('0x1b')]?_0x347d36[_0xa861('0x1b')][_0xa861('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x347d36['options']?_0x347d36['options'][_0xa861('0x1d')]||null:null,'attributes':_0x347d36[_0xa861('0x1b')]?_0x347d36[_0xa861('0x1b')][_0xa861('0x1e')]||null:null,'limit':_0x347d36[_0xa861('0x1b')]?_0x347d36[_0xa861('0x1b')][_0xa861('0x1f')]||null:null})[_0xa861('0xe')](function(_0x3a2569){logger[_0xa861('0xf')](_0xa861('0x18'),_0x347d36);logger[_0xa861('0x11')](_0xa861('0x18'),_0x347d36,JSON[_0xa861('0x20')](_0x3a2569));_0x25f002(_0x3a2569);})[_0xa861('0x17')](function(_0x25eed4){logger[_0xa861('0x12')](_0xa861('0x18'),_0x25eed4[_0xa861('0x15')],_0x347d36);_0x25ca2f(_0x5b4568[_0xa861('0x12')](0x1f4,_0x25eed4['message']));});});};exports['AddTagsToSmsInteraction']=function(_0x52b8aa){return new Promise(function(_0x4cbbe0,_0xb49958){return db[_0xa861('0x19')][_0xa861('0x21')]({'where':_0x52b8aa[_0xa861('0x1b')]?_0x52b8aa[_0xa861('0x1b')][_0xa861('0x1d')]||null:null})['then'](function(_0x4a4317){if(_0x4a4317){return _0x4a4317['addTags'](_0x52b8aa[_0xa861('0x22')][_0xa861('0x23')],_['omit'](_0x52b8aa['body'],[_0xa861('0x23'),'id'])||{});}})[_0xa861('0x24')](function(_0x4ef01c){logger[_0xa861('0xf')](_0xa861('0x25'),_0x52b8aa);logger['debug']('AddTags',_0x52b8aa,JSON[_0xa861('0x20')](_0x4ef01c));_0x4cbbe0(_0x4ef01c);})[_0xa861('0x17')](function(_0x2d7f51){logger['error'](_0xa861('0x25'),_0x2d7f51[_0xa861('0x15')],_0x52b8aa);_0xb49958(_this['error'](0x1f4,_0x2d7f51[_0xa861('0x15')]));});});}; \ No newline at end of file +var _0x569b=['SmsInteraction,\x20%s,\x20%s','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','UpdateSmsInteraction','SmsInteraction','body','options','raw','attributes','then','AddTagsToSmsInteraction','find','where','addTags','omit','ids','spread','AddTags','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','socket.io-emitter','./smsInteraction.socket','register','info'];(function(_0x179892,_0xa7aa1f){var _0x5a3af9=function(_0x8e7c3c){while(--_0x8e7c3c){_0x179892['push'](_0x179892['shift']());}};_0x5a3af9(++_0xa7aa1f);}(_0x569b,0xe6));var _0xb569=function(_0x819464,_0x46fc91){_0x819464=_0x819464-0x0;var _0x49dcc0=_0x569b[_0x819464];return _0x49dcc0;};'use strict';var _=require(_0xb569('0x0'));var util=require(_0xb569('0x1'));var moment=require(_0xb569('0x2'));var BPromise=require(_0xb569('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb569('0x4'))['db'];var utils=require(_0xb569('0x5'));var logger=require(_0xb569('0x6'))(_0xb569('0x7'));var config=require('../../config/environment');var jayson=require(_0xb569('0x8'));var client=jayson['client'][_0xb569('0x9')]({'port':0x232a});config[_0xb569('0xa')]=_[_0xb569('0xb')](config[_0xb569('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xb569('0xc'))(new Redis(config['redis']));require(_0xb569('0xd'))[_0xb569('0xe')](socket);function respondWithRpcPromise(_0x39185d,_0x1644f4,_0x490750){return new BPromise(function(_0x482b47,_0x6b107e){return client['request'](_0x39185d,_0x490750)['then'](function(_0x348f7a){logger[_0xb569('0xf')](_0xb569('0x10'),_0x1644f4,'request\x20sent');logger[_0xb569('0x11')](_0xb569('0x12'),_0x1644f4,_0xb569('0x13'),JSON[_0xb569('0x14')](_0x348f7a));if(_0x348f7a['error']){if(_0x348f7a['error'][_0xb569('0x15')]===0x1f4){logger[_0xb569('0x16')](_0xb569('0x10'),_0x1644f4,_0x348f7a[_0xb569('0x16')]['message']);return _0x6b107e(_0x348f7a[_0xb569('0x16')][_0xb569('0x17')]);}logger[_0xb569('0x16')]('SmsInteraction,\x20%s,\x20%s',_0x1644f4,_0x348f7a[_0xb569('0x16')][_0xb569('0x17')]);return _0x482b47(_0x348f7a[_0xb569('0x16')]['message']);}else{logger[_0xb569('0xf')]('SmsInteraction,\x20%s,\x20%s',_0x1644f4,_0xb569('0x13'));_0x482b47(_0x348f7a[_0xb569('0x18')][_0xb569('0x17')]);}})[_0xb569('0x19')](function(_0x1926fe){logger['error']('SmsInteraction,\x20%s,\x20%s',_0x1644f4,_0x1926fe);_0x6b107e(_0x1926fe);});});}exports[_0xb569('0x1a')]=function(_0x36c564){var _0x3043ec=this;return new Promise(function(_0x31412d,_0x425b29){return db[_0xb569('0x1b')]['update'](_0x36c564[_0xb569('0x1c')],{'raw':_0x36c564[_0xb569('0x1d')]?_0x36c564['options'][_0xb569('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x36c564[_0xb569('0x1d')]?_0x36c564['options']['where']||null:null,'attributes':_0x36c564[_0xb569('0x1d')]?_0x36c564['options'][_0xb569('0x1f')]||null:null,'limit':_0x36c564[_0xb569('0x1d')]?_0x36c564[_0xb569('0x1d')]['limit']||null:null})[_0xb569('0x20')](function(_0x12de1d){logger[_0xb569('0xf')](_0xb569('0x1a'),_0x36c564);logger[_0xb569('0x11')](_0xb569('0x1a'),_0x36c564,JSON['stringify'](_0x12de1d));_0x31412d(_0x12de1d);})['catch'](function(_0x4388ce){logger[_0xb569('0x16')]('UpdateSmsInteraction',_0x4388ce[_0xb569('0x17')],_0x36c564);_0x425b29(_0x3043ec['error'](0x1f4,_0x4388ce[_0xb569('0x17')]));});});};exports[_0xb569('0x21')]=function(_0x3ff451){return new Promise(function(_0x4f5b83,_0x10b292){return db[_0xb569('0x1b')][_0xb569('0x22')]({'where':_0x3ff451['options']?_0x3ff451[_0xb569('0x1d')][_0xb569('0x23')]||null:null})[_0xb569('0x20')](function(_0x518ad0){if(_0x518ad0){return _0x518ad0[_0xb569('0x24')](_0x3ff451[_0xb569('0x1c')]['ids'],_[_0xb569('0x25')](_0x3ff451['body'],[_0xb569('0x26'),'id'])||{});}})[_0xb569('0x27')](function(_0xd4ebf3){logger[_0xb569('0xf')](_0xb569('0x28'),_0x3ff451);logger[_0xb569('0x11')]('AddTags',_0x3ff451,JSON['stringify'](_0xd4ebf3));_0x4f5b83(_0xd4ebf3);})[_0xb569('0x19')](function(_0x460742){logger[_0xb569('0x16')](_0xb569('0x28'),_0x460742[_0xb569('0x17')],_0x3ff451);_0x10b292(_this[_0xb569('0x16')](0x1f4,_0x460742[_0xb569('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index c441bcd..5358f6e 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 _0xf6e7=['removeListener','length','./smsInteraction.events'];(function(_0x20c3b4,_0x2fbfa9){var _0x595c49=function(_0x245cfb){while(--_0x245cfb){_0x20c3b4['push'](_0x20c3b4['shift']());}};_0x595c49(++_0x2fbfa9);}(_0xf6e7,0x119));var _0x7f6e=function(_0x7ed066,_0x267d90){_0x7ed066=_0x7ed066-0x0;var _0x527168=_0xf6e7[_0x7ed066];return _0x527168;};'use strict';var SmsInteractionEvents=require(_0x7f6e('0x0'));var events=['save','remove','update'];function createListener(_0x1d8e66,_0x6228f3){return function(_0x51733e){_0x6228f3['emit'](_0x1d8e66,_0x51733e);};}function removeListener(_0x1723a5,_0x2d5a1f){return function(){SmsInteractionEvents[_0x7f6e('0x1')](_0x1723a5,_0x2d5a1f);};}exports['register']=function(_0x53664b){for(var _0x88e013=0x0,_0x1299ca=events[_0x7f6e('0x2')];_0x88e013<_0x1299ca;_0x88e013++){var _0x574be8=events[_0x88e013];var _0x141828=createListener('smsInteraction:'+_0x574be8,_0x53664b);SmsInteractionEvents['on'](_0x574be8,_0x141828);}}; \ No newline at end of file +var _0x69f8=['smsInteraction:','remove','update','emit','register','length'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x69f8,0x103));var _0x869f=function(_0x281856,_0xe6ba4d){_0x281856=_0x281856-0x0;var _0x1f8b8f=_0x69f8[_0x281856];return _0x1f8b8f;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=['save',_0x869f('0x0'),_0x869f('0x1')];function createListener(_0x4fb1ac,_0x38d202){return function(_0x1794f1){_0x38d202[_0x869f('0x2')](_0x4fb1ac,_0x1794f1);};}function removeListener(_0x5c562c,_0x38bab7){return function(){SmsInteractionEvents['removeListener'](_0x5c562c,_0x38bab7);};}exports[_0x869f('0x3')]=function(_0x11ac45){for(var _0x3f55c2=0x0,_0x354c29=events[_0x869f('0x4')];_0x3f55c2<_0x354c29;_0x3f55c2++){var _0x532093=events[_0x3f55c2];var _0x5b00ec=createListener(_0x869f('0x5')+_0x532093,_0x11ac45);SmsInteractionEvents['on'](_0x532093,_0x5b00ec);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index b9b2311..f04b2a2 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 _0x0dff=['multer','path','express','Router','../../components/interaction/service','./smsMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','post','smsmessage:create','create','/:id/status','status','update','put','/:id/accept','/:id/reject','reject','destroy','exports'];(function(_0x4dc7b9,_0x319d5a){var _0x3ab114=function(_0x51a9df){while(--_0x51a9df){_0x4dc7b9['push'](_0x4dc7b9['shift']());}};_0x3ab114(++_0x319d5a);}(_0x0dff,0x168));var _0xf0df=function(_0x3c0670,_0x5a5fff){_0x3c0670=_0x3c0670-0x0;var _0x8813ab=_0x0dff[_0x3c0670];return _0x8813ab;};'use strict';var multer=require(_0xf0df('0x0'));var util=require('util');var path=require(_0xf0df('0x1'));var timeout=require('connect-timeout');var express=require(_0xf0df('0x2'));var router=express[_0xf0df('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf0df('0x4'));var config=require('../../config/environment');var controller=require(_0xf0df('0x5'));router[_0xf0df('0x6')]('/',auth[_0xf0df('0x7')](),controller['index']);router[_0xf0df('0x6')](_0xf0df('0x8'),auth[_0xf0df('0x7')](),controller[_0xf0df('0x9')]);router['get'](_0xf0df('0xa'),auth[_0xf0df('0x7')](),controller[_0xf0df('0xb')]);router[_0xf0df('0xc')]('/',auth[_0xf0df('0x7')](),interaction['tracked']('sms',_0xf0df('0xd')),controller[_0xf0df('0xe')]);router[_0xf0df('0xc')](_0xf0df('0xf'),controller[_0xf0df('0x10')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xf0df('0x11')]);router[_0xf0df('0x12')](_0xf0df('0x13'),auth[_0xf0df('0x7')](),controller['accept']);router[_0xf0df('0x12')](_0xf0df('0x14'),auth[_0xf0df('0x7')](),controller[_0xf0df('0x15')]);router['delete'](_0xf0df('0xa'),auth[_0xf0df('0x7')](),controller[_0xf0df('0x16')]);module[_0xf0df('0x17')]=router; \ No newline at end of file +var _0xaa5a=['create','/:id/status','status','put','/:id/reject','reject','delete','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','sms','smsmessage:create'];(function(_0x38dc43,_0x518cbb){var _0x1366d3=function(_0x410fc5){while(--_0x410fc5){_0x38dc43['push'](_0x38dc43['shift']());}};_0x1366d3(++_0x518cbb);}(_0xaa5a,0x1d3));var _0xaaa5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaa5a[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xaaa5('0x0'));var util=require(_0xaaa5('0x1'));var path=require('path');var timeout=require(_0xaaa5('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xaaa5('0x3'));var auth=require(_0xaaa5('0x4'));var interaction=require(_0xaaa5('0x5'));var config=require(_0xaaa5('0x6'));var controller=require(_0xaaa5('0x7'));router[_0xaaa5('0x8')]('/',auth[_0xaaa5('0x9')](),controller[_0xaaa5('0xa')]);router[_0xaaa5('0x8')](_0xaaa5('0xb'),auth[_0xaaa5('0x9')](),controller[_0xaaa5('0xc')]);router[_0xaaa5('0x8')](_0xaaa5('0xd'),auth[_0xaaa5('0x9')](),controller[_0xaaa5('0xe')]);router[_0xaaa5('0xf')]('/',auth[_0xaaa5('0x9')](),interaction[_0xaaa5('0x10')](_0xaaa5('0x11'),_0xaaa5('0x12')),controller[_0xaaa5('0x13')]);router[_0xaaa5('0xf')](_0xaaa5('0x14'),controller[_0xaaa5('0x15')]);router[_0xaaa5('0x16')](_0xaaa5('0xd'),auth[_0xaaa5('0x9')](),controller['update']);router[_0xaaa5('0x16')]('/:id/accept',auth['isAuthenticated'](),controller['accept']);router[_0xaaa5('0x16')](_0xaaa5('0x17'),auth[_0xaaa5('0x9')](),controller[_0xaaa5('0x18')]);router[_0xaaa5('0x19')](_0xaaa5('0xd'),auth[_0xaaa5('0x9')](),controller['destroy']);module[_0xaaa5('0x1a')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 82cbcf6..ea44273 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 _0x0faf=['STRING','DATE','sequelize','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x31efa5,_0x47e119){var _0x31cd99=function(_0x8a213c){while(--_0x8a213c){_0x31efa5['push'](_0x31efa5['shift']());}};_0x31cd99(++_0x47e119);}(_0x0faf,0x132));var _0xf0fa=function(_0x221637,_0x42a5e0){_0x221637=_0x221637-0x0;var _0x11bf9e=_0x0faf[_0x221637];return _0x11bf9e;};'use strict';var Sequelize=require(_0xf0fa('0x0'));module['exports']={'body':{'type':Sequelize[_0xf0fa('0x1')](_0xf0fa('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xf0fa('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xf0fa('0x4')]('in',_0xf0fa('0x5')),'defaultValue':_0xf0fa('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xf0fa('0x6')](0xbe)},'phone':{'type':Sequelize[_0xf0fa('0x6')]},'readAt':{'type':Sequelize[_0xf0fa('0x7')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0xf0fa('0x6')]},'providerResponse':{'type':Sequelize[_0xf0fa('0x1')]}}; \ No newline at end of file +var _0x3b34=['out','STRING','DATE','sequelize','exports','TEXT','BOOLEAN'];(function(_0x44b3bd,_0x44c97d){var _0x1efc4a=function(_0x5d0205){while(--_0x5d0205){_0x44b3bd['push'](_0x44b3bd['shift']());}};_0x1efc4a(++_0x44c97d);}(_0x3b34,0xe3));var _0x43b3=function(_0x4c9278,_0x324a88){_0x4c9278=_0x4c9278-0x0;var _0x7844a9=_0x3b34[_0x4c9278];return _0x7844a9;};'use strict';var Sequelize=require(_0x43b3('0x0'));module[_0x43b3('0x1')]={'body':{'type':Sequelize[_0x43b3('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x43b3('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x43b3('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x43b3('0x5')](0xbe)},'phone':{'type':Sequelize[_0x43b3('0x5')]},'readAt':{'type':Sequelize[_0x43b3('0x6')]},'secret':{'type':Sequelize[_0x43b3('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x43b3('0x5')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 7a73c85..3be7faa 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 _0xc0a4=['format','YYYY-MM-DD\x20HH:mm:ss','interaction','user','null','AcceptMessage','acceptMessage','sequelize','Sequelize','QueryTypes','fullname','email','internal','manual','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','sms-interactions','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','SELECT','User','interface','rejectmessage','SmsAccountId','inspect','twilio','MessageSid','plivo','MessageUUID','messageId','indexOf','sent','delivered','SmsAccount,\x20%s,\x20%s,\x20%s','plivio','results','groupName','DELIVERED','infobip','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','./smsMessage.socket','register','jayson/promise','client','http','request','info','SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','status','end','json','offset','count','limit','set','Content-Range','apply','reject','save','update','then','name','send','index','map','rawAttributes','fieldName','key','model','keys','intersection','attributes','fields','length','query','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','type','merge','SmsMessage','includeAll','include','findAll','rows','show','params','options','create','body','find','destroy','describe','accept','sms','read','readAt','UserId','agent','get','SmsInteraction','SmsInteractionId','isNil','read1stAt'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xc0a4,0xc6));var _0x4c0a=function(_0x580e55,_0x10c639){_0x580e55=_0x580e55-0x0;var _0x565ca3=_0xc0a4[_0x580e55];return _0x565ca3;};'use strict';var emlformat=require(_0x4c0a('0x0'));var rimraf=require(_0x4c0a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4c0a('0x2'));var rp=require('request-promise');var moment=require(_0x4c0a('0x3'));var BPromise=require(_0x4c0a('0x4'));var Mustache=require(_0x4c0a('0x5'));var util=require(_0x4c0a('0x6'));var path=require(_0x4c0a('0x7'));var sox=require(_0x4c0a('0x8'));var csv=require(_0x4c0a('0x9'));var ejs=require(_0x4c0a('0xa'));var fs=require('fs');var fs_extra=require(_0x4c0a('0xb'));var _=require(_0x4c0a('0xc'));var squel=require('squel');var crypto=require(_0x4c0a('0xd'));var jsforce=require(_0x4c0a('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4c0a('0x9'));var querystring=require(_0x4c0a('0xf'));var Papa=require('papaparse');var Redis=require(_0x4c0a('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x4c0a('0x11'));var as=require(_0x4c0a('0x12'));var hardwareService=require(_0x4c0a('0x13'));var logger=require(_0x4c0a('0x14'))(_0x4c0a('0x15'));var utils=require(_0x4c0a('0x16'));var config=require(_0x4c0a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x4c0a('0x18'))['db'];config[_0x4c0a('0x19')]=_['defaults'](config[_0x4c0a('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x4c0a('0x1a'))[_0x4c0a('0x1b')](socket);var jayson=require(_0x4c0a('0x1c'));var client=jayson[_0x4c0a('0x1d')]['http']({'port':0x232c});var client9002=jayson[_0x4c0a('0x1d')][_0x4c0a('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x5117ee,_0x1cea0c,_0x546736,_0x42d755){return new BPromise(function(_0x60e374,_0x5d3ea0){var _0x31e8cf=_0x42d755||client;return _0x31e8cf[_0x4c0a('0x1f')](_0x5117ee,_0x546736)['then'](function(_0x171409){logger[_0x4c0a('0x20')](_0x4c0a('0x21'),_0x1cea0c,'request\x20sent');logger[_0x4c0a('0x22')](_0x4c0a('0x23'),_0x1cea0c,_0x4c0a('0x24'),JSON[_0x4c0a('0x25')](_0x171409));if(_0x171409[_0x4c0a('0x26')]){if(_0x171409['error'][_0x4c0a('0x27')]===0x1f4){logger[_0x4c0a('0x26')]('SmsMessage,\x20%s,\x20%s',_0x1cea0c,_0x171409[_0x4c0a('0x26')]['message']);return _0x5d3ea0(_0x171409[_0x4c0a('0x26')]['message']);}logger[_0x4c0a('0x26')](_0x4c0a('0x21'),_0x1cea0c,_0x171409[_0x4c0a('0x26')]['message']);return _0x60e374(_0x171409[_0x4c0a('0x26')][_0x4c0a('0x28')]);}else{logger[_0x4c0a('0x20')](_0x4c0a('0x21'),_0x1cea0c,_0x4c0a('0x24'));_0x60e374(_0x171409[_0x4c0a('0x29')][_0x4c0a('0x28')]);}})[_0x4c0a('0x2a')](function(_0x12e49e){logger[_0x4c0a('0x26')](_0x4c0a('0x21'),_0x1cea0c,_0x12e49e);_0x5d3ea0(_0x12e49e);});});}function respondWithStatusCode(_0x1b8d68,_0x45215b){_0x45215b=_0x45215b||0xcc;return function(_0x4bd0bc){if(_0x4bd0bc){return _0x1b8d68['sendStatus'](_0x45215b);}return _0x1b8d68[_0x4c0a('0x2b')](_0x45215b)[_0x4c0a('0x2c')]();};}function respondWithResult(_0x15135d,_0x1f6559){_0x1f6559=_0x1f6559||0xc8;return function(_0x1efcd3){if(_0x1efcd3){return _0x15135d[_0x4c0a('0x2b')](_0x1f6559)[_0x4c0a('0x2d')](_0x1efcd3);}};}function respondWithFilteredResult(_0x2a14f9,_0x5ce007){return function(_0x41d2de){if(_0x41d2de){var _0x3ef6cc=typeof _0x5ce007[_0x4c0a('0x2e')]==='undefined'&&typeof _0x5ce007['limit']==='undefined';var _0x179ca6=_0x41d2de['count'];var _0x3a8ce2=_0x3ef6cc?0x0:_0x5ce007[_0x4c0a('0x2e')];var _0x459cfd=_0x3ef6cc?_0x41d2de[_0x4c0a('0x2f')]:_0x5ce007[_0x4c0a('0x2e')]+_0x5ce007[_0x4c0a('0x30')];var _0x5e8f9c;if(_0x459cfd>=_0x179ca6){_0x459cfd=_0x179ca6;_0x5e8f9c=0xc8;}else{_0x5e8f9c=0xce;}_0x2a14f9[_0x4c0a('0x2b')](_0x5e8f9c);return _0x2a14f9[_0x4c0a('0x31')](_0x4c0a('0x32'),_0x3a8ce2+'-'+_0x459cfd+'/'+_0x179ca6)['json'](_0x41d2de);}return null;};}function patchUpdates(_0x350c57){return function(_0x4d0225){try{jsonpatch[_0x4c0a('0x33')](_0x4d0225,_0x350c57,!![]);}catch(_0x52280c){return BPromise[_0x4c0a('0x34')](_0x52280c);}return _0x4d0225[_0x4c0a('0x35')]();};}function saveUpdates(_0x3c28ab,_0x4faeea){return function(_0x21b545){if(_0x21b545){return _0x21b545[_0x4c0a('0x36')](_0x3c28ab)['then'](function(_0x305cc4){return _0x305cc4;});}return null;};}function removeEntity(_0x5a3f4a,_0x5606a7){return function(_0xf57cb8){if(_0xf57cb8){return _0xf57cb8['destroy']()[_0x4c0a('0x37')](function(){_0x5a3f4a[_0x4c0a('0x2b')](0xcc)[_0x4c0a('0x2c')]();});}};}function handleEntityNotFound(_0x9de1a1,_0x1a83ff){return function(_0x41e76c){if(!_0x41e76c){_0x9de1a1['sendStatus'](0x194);}return _0x41e76c;};}function handleError(_0x440838,_0x48103d){_0x48103d=_0x48103d||0x1f4;return function(_0xf86399){logger['error'](_0xf86399['stack']);if(_0xf86399[_0x4c0a('0x38')]){delete _0xf86399[_0x4c0a('0x38')];}_0x440838[_0x4c0a('0x2b')](_0x48103d)[_0x4c0a('0x39')](_0xf86399);};}exports[_0x4c0a('0x3a')]=function(_0xe4ada7,_0x1775df){var _0x6cb4f1={},_0x87a1ef={},_0xcd61a={'count':0x0,'rows':[]};var _0xfdcb84=_[_0x4c0a('0x3b')](db['SmsMessage'][_0x4c0a('0x3c')],function(_0x523fde){return{'name':_0x523fde[_0x4c0a('0x3d')],'type':_0x523fde['type'][_0x4c0a('0x3e')]};});_0x87a1ef[_0x4c0a('0x3f')]=_[_0x4c0a('0x3b')](_0xfdcb84,_0x4c0a('0x38'));_0x87a1ef['query']=_[_0x4c0a('0x40')](_0xe4ada7['query']);_0x87a1ef['filters']=_[_0x4c0a('0x41')](_0x87a1ef[_0x4c0a('0x3f')],_0x87a1ef['query']);_0x6cb4f1[_0x4c0a('0x42')]=_[_0x4c0a('0x41')](_0x87a1ef['model'],qs['fields'](_0xe4ada7['query'][_0x4c0a('0x43')]));_0x6cb4f1[_0x4c0a('0x42')]=_0x6cb4f1[_0x4c0a('0x42')][_0x4c0a('0x44')]?_0x6cb4f1[_0x4c0a('0x42')]:_0x87a1ef[_0x4c0a('0x3f')];if(!_0xe4ada7[_0x4c0a('0x45')][_0x4c0a('0x46')](_0x4c0a('0x47'))){_0x6cb4f1[_0x4c0a('0x30')]=qs[_0x4c0a('0x30')](_0xe4ada7[_0x4c0a('0x45')][_0x4c0a('0x30')]);_0x6cb4f1[_0x4c0a('0x2e')]=qs['offset'](_0xe4ada7[_0x4c0a('0x45')][_0x4c0a('0x2e')]);}_0x6cb4f1[_0x4c0a('0x48')]=qs['sort'](_0xe4ada7[_0x4c0a('0x45')][_0x4c0a('0x49')]);_0x6cb4f1[_0x4c0a('0x4a')]=qs[_0x4c0a('0x4b')](_[_0x4c0a('0x4c')](_0xe4ada7['query'],_0x87a1ef['filters']),_0xfdcb84);if(_0xe4ada7[_0x4c0a('0x45')][_0x4c0a('0x4d')]){_0x6cb4f1['where']=_['merge'](_0x6cb4f1[_0x4c0a('0x4a')],{'$or':_[_0x4c0a('0x3b')](_0xfdcb84,function(_0x1f5faa){if(_0x1f5faa[_0x4c0a('0x4e')]!=='VIRTUAL'){var _0x46fc39={};_0x46fc39[_0x1f5faa[_0x4c0a('0x38')]]={'$like':'%'+_0xe4ada7[_0x4c0a('0x45')]['filter']+'%'};return _0x46fc39;}})});}_0x6cb4f1=_[_0x4c0a('0x4f')]({},_0x6cb4f1,_0xe4ada7['options']);var _0x556312={'where':_0x6cb4f1['where']};return db[_0x4c0a('0x50')][_0x4c0a('0x2f')](_0x556312)[_0x4c0a('0x37')](function(_0x5a2bb4){_0xcd61a[_0x4c0a('0x2f')]=_0x5a2bb4;if(_0xe4ada7[_0x4c0a('0x45')][_0x4c0a('0x51')]){_0x6cb4f1[_0x4c0a('0x52')]=[{'all':!![]}];}return db[_0x4c0a('0x50')][_0x4c0a('0x53')](_0x6cb4f1);})['then'](function(_0x38356b){_0xcd61a[_0x4c0a('0x54')]=_0x38356b;return _0xcd61a;})[_0x4c0a('0x37')](respondWithFilteredResult(_0x1775df,_0x6cb4f1))['catch'](handleError(_0x1775df,null));};exports[_0x4c0a('0x55')]=function(_0x2f7464,_0x4e4124){var _0x5cd73f={'raw':!![],'where':{'id':_0x2f7464[_0x4c0a('0x56')]['id']}},_0x262cac={};_0x262cac[_0x4c0a('0x3f')]=_['keys'](db[_0x4c0a('0x50')][_0x4c0a('0x3c')]);_0x262cac[_0x4c0a('0x45')]=_[_0x4c0a('0x40')](_0x2f7464[_0x4c0a('0x45')]);_0x262cac[_0x4c0a('0x4b')]=_[_0x4c0a('0x41')](_0x262cac[_0x4c0a('0x3f')],_0x262cac[_0x4c0a('0x45')]);_0x5cd73f[_0x4c0a('0x42')]=_['intersection'](_0x262cac[_0x4c0a('0x3f')],qs[_0x4c0a('0x43')](_0x2f7464[_0x4c0a('0x45')][_0x4c0a('0x43')]));_0x5cd73f[_0x4c0a('0x42')]=_0x5cd73f['attributes']['length']?_0x5cd73f[_0x4c0a('0x42')]:_0x262cac[_0x4c0a('0x3f')];if(_0x2f7464[_0x4c0a('0x45')][_0x4c0a('0x51')]){_0x5cd73f[_0x4c0a('0x52')]=[{'all':!![]}];}_0x5cd73f=_[_0x4c0a('0x4f')]({},_0x5cd73f,_0x2f7464[_0x4c0a('0x57')]);return db[_0x4c0a('0x50')]['find'](_0x5cd73f)[_0x4c0a('0x37')](handleEntityNotFound(_0x4e4124,null))[_0x4c0a('0x37')](respondWithResult(_0x4e4124,null))['catch'](handleError(_0x4e4124,null));};exports['create']=function(_0x8850c,_0x1ba535){return db[_0x4c0a('0x50')][_0x4c0a('0x58')](_0x8850c[_0x4c0a('0x59')],{})[_0x4c0a('0x37')](respondWithResult(_0x1ba535,0xc9))[_0x4c0a('0x2a')](handleError(_0x1ba535,null));};exports[_0x4c0a('0x36')]=function(_0x3d3d39,_0x477da2){if(_0x3d3d39[_0x4c0a('0x59')]['id']){delete _0x3d3d39[_0x4c0a('0x59')]['id'];}return db[_0x4c0a('0x50')][_0x4c0a('0x5a')]({'where':{'id':_0x3d3d39['params']['id']}})[_0x4c0a('0x37')](handleEntityNotFound(_0x477da2,null))['then'](saveUpdates(_0x3d3d39['body'],null))['then'](respondWithResult(_0x477da2,null))[_0x4c0a('0x2a')](handleError(_0x477da2,null));};exports[_0x4c0a('0x5b')]=function(_0x51369c,_0x5bb13d){return db[_0x4c0a('0x50')][_0x4c0a('0x5a')]({'where':{'id':_0x51369c[_0x4c0a('0x56')]['id']}})['then'](handleEntityNotFound(_0x5bb13d,null))[_0x4c0a('0x37')](removeEntity(_0x5bb13d,null))[_0x4c0a('0x2a')](handleError(_0x5bb13d,null));};exports[_0x4c0a('0x5c')]=function(_0x213b1e,_0x15e87e){return db[_0x4c0a('0x50')][_0x4c0a('0x5c')]()[_0x4c0a('0x37')](respondWithResult(_0x15e87e,null))[_0x4c0a('0x2a')](handleError(_0x15e87e,null));};var interaction_log=require(_0x4c0a('0x14'))('sms-interactions');exports[_0x4c0a('0x5d')]=function(_0x3d1fd0,_0x14576a,_0x3b98c5){var _0x32a919={'agent':{},'channel':_0x4c0a('0x5e')};if(_0x3d1fd0['body']['id']){delete _0x3d1fd0[_0x4c0a('0x59')]['id'];}_0x3d1fd0[_0x4c0a('0x59')][_0x4c0a('0x5f')]=!![];_0x3d1fd0['body'][_0x4c0a('0x60')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x3d1fd0['body']['UserId']=_0x3d1fd0['body'][_0x4c0a('0x61')]||_0x3d1fd0['user']['id'];_0x32a919[_0x4c0a('0x62')]['id']=_0x3d1fd0['body'][_0x4c0a('0x61')];return db[_0x4c0a('0x50')]['find']({'where':{'id':_0x3d1fd0[_0x4c0a('0x56')]['id'],'UserId':null}})[_0x4c0a('0x37')](handleEntityNotFound(_0x14576a,null))[_0x4c0a('0x37')](saveUpdates(_0x3d1fd0[_0x4c0a('0x59')],null))[_0x4c0a('0x37')](function(_0x5ed7ed){if(_0x5ed7ed){_0x32a919[_0x4c0a('0x28')]=_0x5ed7ed[_0x4c0a('0x63')]({'plain':!![]});return db[_0x4c0a('0x64')][_0x4c0a('0x5a')]({'where':{'id':_0x5ed7ed[_0x4c0a('0x65')]}});}return null;})[_0x4c0a('0x37')](handleEntityNotFound(_0x14576a,null))['then'](function(_0x148765){if(_0x148765){return _0x148765[_0x4c0a('0x36')]({'UserId':_0x3d1fd0['body'][_0x4c0a('0x61')],'read1stAt':_[_0x4c0a('0x66')](_0x148765[_0x4c0a('0x67')])?moment()[_0x4c0a('0x68')](_0x4c0a('0x69')):undefined});}return null;})[_0x4c0a('0x37')](function(_0x51da16){if(_0x51da16){_0x32a919[_0x4c0a('0x6a')]=_0x51da16[_0x4c0a('0x63')]({'plain':!![]});interaction_log[_0x4c0a('0x20')]('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3d1fd0[_0x4c0a('0x6b')]['id'],_0x3d1fd0[_0x4c0a('0x6b')][_0x4c0a('0x38')],_0x3d1fd0[_0x4c0a('0x6b')]['role'],_0x32a919['interaction']['id'],_0x3d1fd0[_0x4c0a('0x59')]?JSON[_0x4c0a('0x25')](_0x3d1fd0['body']):_0x4c0a('0x6c'));return respondWithRpcPromise(_0x4c0a('0x6d'),_0x4c0a('0x6e'),_0x32a919);}return null;})[_0x4c0a('0x37')](function(_0x44fdfa){var _0x5a66c7='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x44fdfa[_0x4c0a('0x28')]['ContactId'];return db[_0x4c0a('0x6f')][_0x4c0a('0x45')](_0x5a66c7,{'type':db[_0x4c0a('0x70')][_0x4c0a('0x71')]['SELECT'],'raw':!![]})[_0x4c0a('0x37')](function(_0x2dce8f){return _0x2dce8f;});})[_0x4c0a('0x37')](function(_0x1b9b59){if(_0x1b9b59){_0x32a919[_0x4c0a('0x28')]['contact']=_0x1b9b59[0x0];if(!_0x3d1fd0[_0x4c0a('0x59')][_0x4c0a('0x61')])return;return db['User']['find']({'where':{'id':_0x3d1fd0[_0x4c0a('0x59')][_0x4c0a('0x61')],'role':_0x4c0a('0x62')},'attributes':['id',_0x4c0a('0x38'),_0x4c0a('0x72'),_0x4c0a('0x73'),_0x4c0a('0x74')],'raw':!![]});}return null;})['then'](function(_0x5efedb){if(!_0x5efedb)return null;_0x32a919[_0x4c0a('0x28')][_0x4c0a('0x62')]=_0x5efedb;return _0x32a919;})[_0x4c0a('0x37')](function(_0x11e1c1){if(_0x11e1c1){if(_0x3d1fd0[_0x4c0a('0x59')][_0x4c0a('0x75')]){_0x32a919[_0x4c0a('0x28')]['interface']=util[_0x4c0a('0x68')](_0x4c0a('0x76'),_0x3d1fd0[_0x4c0a('0x6b')][_0x4c0a('0x38')]);_0x32a919[_0x4c0a('0x28')][_0x4c0a('0x77')]=_0x32a919[_0x4c0a('0x77')];_0x32a919[_0x4c0a('0x28')][_0x4c0a('0x78')]=_0x32a919[_0x4c0a('0x77')];_0x32a919[_0x4c0a('0x28')][_0x4c0a('0x79')]=_0x4c0a('0x5d');return respondWithRpcPromise('EventManager',_0x4c0a('0x7a'),{'event':_0x4c0a('0x7b'),'message':_0x32a919[_0x4c0a('0x28')]},client9002)[_0x4c0a('0x37')](function(){return _0x32a919;});}return _0x32a919;}return null;})[_0x4c0a('0x37')](respondWithResult(_0x14576a,null))[_0x4c0a('0x2a')](handleError(_0x14576a,null));};var interaction_log=require(_0x4c0a('0x14'))(_0x4c0a('0x7c'));exports[_0x4c0a('0x34')]=function(_0x326bf6,_0x33b870,_0x4e6846){var _0x2598e5={'agent':{},'channel':_0x4c0a('0x5e')};if(_0x326bf6[_0x4c0a('0x59')]['id']){delete _0x326bf6[_0x4c0a('0x59')]['id'];}_0x326bf6['body'][_0x4c0a('0x61')]=_0x326bf6['body'][_0x4c0a('0x61')]||_0x326bf6['user']['id'];_0x2598e5[_0x4c0a('0x62')]['id']=_0x326bf6[_0x4c0a('0x59')]['UserId'];return db[_0x4c0a('0x50')][_0x4c0a('0x5a')]({'where':{'id':_0x326bf6[_0x4c0a('0x56')]['id'],'UserId':null}})[_0x4c0a('0x37')](handleEntityNotFound(_0x33b870,null))['then'](function(_0x5ac87f){if(_0x5ac87f){_0x2598e5[_0x4c0a('0x28')]=_0x5ac87f[_0x4c0a('0x63')]({'plain':!![]});return db[_0x4c0a('0x64')]['find']({'where':{'id':_0x5ac87f[_0x4c0a('0x65')]}});}return null;})[_0x4c0a('0x37')](handleEntityNotFound(_0x33b870,null))[_0x4c0a('0x37')](function(_0x8eb321){if(_0x8eb321){_0x2598e5['interaction']=_0x8eb321[_0x4c0a('0x63')]({'plain':!![]});interaction_log['info'](_0x4c0a('0x7d'),_0x326bf6[_0x4c0a('0x6b')]['id'],_0x326bf6[_0x4c0a('0x6b')]['name'],_0x326bf6[_0x4c0a('0x6b')][_0x4c0a('0x7e')],_0x2598e5['interaction']['id'],_0x326bf6['body']?JSON[_0x4c0a('0x25')](_0x326bf6[_0x4c0a('0x59')]):_0x4c0a('0x6c'));return respondWithRpcPromise(_0x4c0a('0x7f'),_0x4c0a('0x80'),_0x2598e5);}return null;})[_0x4c0a('0x37')](function(_0x395e2f){var _0x1d7a3d=_0x4c0a('0x81')+_0x395e2f[_0x4c0a('0x28')][_0x4c0a('0x82')];return db[_0x4c0a('0x6f')][_0x4c0a('0x45')](_0x1d7a3d,{'type':db['Sequelize'][_0x4c0a('0x71')][_0x4c0a('0x83')],'raw':!![]})[_0x4c0a('0x37')](function(_0x1dccc7){return _0x1dccc7;});})[_0x4c0a('0x37')](function(_0x5c768e){if(_0x5c768e){_0x2598e5['message']['contact']=_0x5c768e[0x0];if(!_0x326bf6[_0x4c0a('0x59')][_0x4c0a('0x61')])return;return db[_0x4c0a('0x84')][_0x4c0a('0x5a')]({'where':{'id':_0x326bf6[_0x4c0a('0x59')][_0x4c0a('0x61')],'role':_0x4c0a('0x62')},'attributes':['id','name',_0x4c0a('0x72'),'email',_0x4c0a('0x74')],'raw':!![]});}return null;})['then'](function(_0x274af0){if(!_0x274af0)return null;_0x2598e5[_0x4c0a('0x28')][_0x4c0a('0x62')]=_0x274af0;return _0x2598e5;})[_0x4c0a('0x37')](function(_0x59247a){if(_0x59247a){_0x59247a[_0x4c0a('0x28')][_0x4c0a('0x85')]=util[_0x4c0a('0x68')]('SIP/%s',_0x326bf6[_0x4c0a('0x6b')][_0x4c0a('0x38')]);_0x59247a[_0x4c0a('0x28')][_0x4c0a('0x77')]=_0x2598e5[_0x4c0a('0x77')];_0x59247a['message'][_0x4c0a('0x78')]=_0x2598e5[_0x4c0a('0x77')];_0x59247a[_0x4c0a('0x28')][_0x4c0a('0x79')]='reject';respondWithRpcPromise(_0x4c0a('0x7a'),'EventManager',{'event':_0x4c0a('0x86'),'message':_0x59247a[_0x4c0a('0x28')]},client9002);return _0x2598e5;}return null;})[_0x4c0a('0x37')](respondWithResult(_0x33b870,null))[_0x4c0a('0x2a')](handleError(_0x33b870,null));};exports[_0x4c0a('0x2b')]=function(_0x3ad535,_0x22ddf0,_0xe88ba0){if(_0x3ad535[_0x4c0a('0x59')]['id']){delete _0x3ad535[_0x4c0a('0x59')]['id'];}var _0x163e0f;return db['SmsMessage']['find']({'where':{'id':_0x3ad535[_0x4c0a('0x56')]['id']}})['then'](handleEntityNotFound(_0x22ddf0,null))[_0x4c0a('0x37')](function(_0x2c2b2d){if(_0x2c2b2d){_0x163e0f=_0x2c2b2d;return db['SmsAccount']['find']({'where':{'id':_0x2c2b2d[_0x4c0a('0x87')]}});}})[_0x4c0a('0x37')](handleEntityNotFound(_0x22ddf0,null))['then'](function(_0x2e6b9c){if(_0x2e6b9c){logger['debug'](_0x4c0a('0x23'),_0x4c0a('0x2b'),'received\x20delivery\x20report\x20from',_0x2e6b9c[_0x4c0a('0x4e')],util[_0x4c0a('0x88')](_0x3ad535['body'],{'showHidden':![],'depth':null}));switch(_0x2e6b9c[_0x4c0a('0x4e')]){case _0x4c0a('0x89'):if(_0x3ad535['body'][_0x4c0a('0x8a')]&&_0x3ad535[_0x4c0a('0x59')][_0x4c0a('0x8a')]===_0x163e0f['messageId']){return _0x163e0f[_0x4c0a('0x36')]({'read':!![]});}else{logger[_0x4c0a('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4c0a('0x2b'),_0x4c0a('0x89'),util[_0x4c0a('0x88')](_0x3ad535[_0x4c0a('0x59')],{'showHidden':![],'depth':null}));}break;case _0x4c0a('0x8b'):if(_0x3ad535[_0x4c0a('0x59')][_0x4c0a('0x8c')]&&_0x3ad535[_0x4c0a('0x59')][_0x4c0a('0x8c')]===_0x163e0f[_0x4c0a('0x8d')]&&_[_0x4c0a('0x8e')]([_0x4c0a('0x8f'),_0x4c0a('0x90')],_0x3ad535[_0x4c0a('0x59')]['Status'])>=0x0){return _0x163e0f['update']({'read':!![]});}else{logger[_0x4c0a('0x26')](_0x4c0a('0x91'),_0x4c0a('0x2b'),_0x4c0a('0x92'),util[_0x4c0a('0x88')](_0x3ad535[_0x4c0a('0x59')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x5b60b0=_0x3ad535[_0x4c0a('0x59')][_0x4c0a('0x93')][0x0];if(_0x5b60b0[_0x4c0a('0x2b')][_0x4c0a('0x94')]===_0x4c0a('0x95')){return _0x163e0f[_0x4c0a('0x36')]({'read':!![]});}else{logger['error'](_0x4c0a('0x91'),_0x4c0a('0x2b'),_0x4c0a('0x96'),util[_0x4c0a('0x88')](_0x3ad535['body'],{'showHidden':![],'depth':null}));}break;}return _0x163e0f;}})[_0x4c0a('0x37')](respondWithResult(_0x22ddf0,null))[_0x4c0a('0x2a')](handleError(_0x22ddf0,null));}; \ No newline at end of file +var _0xc025=['findAll','rows','show','params','include','find','create','body','describe','../../config/logger','sms-interactions','accept','sms','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','SmsInteraction','SmsInteractionId','read1stAt','format','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','info','interaction','RejectMessage','rejectMessage','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','MessageUUID','indexOf','sent','Status','plivio','results','infobip','eml-format','zip-dir','request-promise','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./smsMessage.socket','register','client','http','request','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','offset','undefined','count','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','send','index','map','SmsMessage','rawAttributes','fieldName','type','key','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll'];(function(_0x393779,_0x205abe){var _0x19aecf=function(_0x20f5ad){while(--_0x20f5ad){_0x393779['push'](_0x393779['shift']());}};_0x19aecf(++_0x205abe);}(_0xc025,0x169));var _0x5c02=function(_0x24fdd7,_0xe598bf){_0x24fdd7=_0x24fdd7-0x0;var _0x38931b=_0xc025[_0x24fdd7];return _0x38931b;};'use strict';var emlformat=require(_0x5c02('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5c02('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5c02('0x2'));var moment=require(_0x5c02('0x3'));var BPromise=require(_0x5c02('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5c02('0x5'));var sox=require(_0x5c02('0x6'));var csv=require('to-csv');var ejs=require(_0x5c02('0x7'));var fs=require('fs');var fs_extra=require(_0x5c02('0x8'));var _=require(_0x5c02('0x9'));var squel=require(_0x5c02('0xa'));var crypto=require(_0x5c02('0xb'));var jsforce=require(_0x5c02('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x5c02('0xd'));var querystring=require(_0x5c02('0xe'));var Papa=require('papaparse');var Redis=require(_0x5c02('0xf'));var authService=require(_0x5c02('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x5c02('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5c02('0x12'));var db=require(_0x5c02('0x13'))['db'];config['redis']=_['defaults'](config[_0x5c02('0x14')],{'host':_0x5c02('0x15'),'port':0x18eb});var socket=require(_0x5c02('0x16'))(new Redis(config[_0x5c02('0x14')]));require(_0x5c02('0x17'))[_0x5c02('0x18')](socket);var jayson=require('jayson/promise');var client=jayson[_0x5c02('0x19')][_0x5c02('0x1a')]({'port':0x232c});var client9002=jayson[_0x5c02('0x19')][_0x5c02('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x17888d,_0x1c6bfc,_0x15d3d8,_0x7d38e8){return new BPromise(function(_0xfd3cf4,_0x5f21bd){var _0xf9532d=_0x7d38e8||client;return _0xf9532d[_0x5c02('0x1b')](_0x17888d,_0x15d3d8)['then'](function(_0x96958e){logger['info'](_0x5c02('0x1c'),_0x1c6bfc,_0x5c02('0x1d'));logger[_0x5c02('0x1e')](_0x5c02('0x1f'),_0x1c6bfc,'request\x20sent',JSON[_0x5c02('0x20')](_0x96958e));if(_0x96958e[_0x5c02('0x21')]){if(_0x96958e[_0x5c02('0x21')][_0x5c02('0x22')]===0x1f4){logger[_0x5c02('0x21')](_0x5c02('0x1c'),_0x1c6bfc,_0x96958e[_0x5c02('0x21')][_0x5c02('0x23')]);return _0x5f21bd(_0x96958e[_0x5c02('0x21')]['message']);}logger[_0x5c02('0x21')](_0x5c02('0x1c'),_0x1c6bfc,_0x96958e[_0x5c02('0x21')][_0x5c02('0x23')]);return _0xfd3cf4(_0x96958e['error']['message']);}else{logger['info']('SmsMessage,\x20%s,\x20%s',_0x1c6bfc,_0x5c02('0x1d'));_0xfd3cf4(_0x96958e[_0x5c02('0x24')]['message']);}})[_0x5c02('0x25')](function(_0x24b8b6){logger[_0x5c02('0x21')](_0x5c02('0x1c'),_0x1c6bfc,_0x24b8b6);_0x5f21bd(_0x24b8b6);});});}function respondWithStatusCode(_0x3f8d28,_0x54c18c){_0x54c18c=_0x54c18c||0xcc;return function(_0x2a9ea9){if(_0x2a9ea9){return _0x3f8d28[_0x5c02('0x26')](_0x54c18c);}return _0x3f8d28[_0x5c02('0x27')](_0x54c18c)[_0x5c02('0x28')]();};}function respondWithResult(_0x20eb2c,_0x5909b7){_0x5909b7=_0x5909b7||0xc8;return function(_0x54f67c){if(_0x54f67c){return _0x20eb2c[_0x5c02('0x27')](_0x5909b7)['json'](_0x54f67c);}};}function respondWithFilteredResult(_0x2f8b5c,_0x5467d8){return function(_0x2a0dde){if(_0x2a0dde){var _0x1c891f=typeof _0x5467d8[_0x5c02('0x29')]===_0x5c02('0x2a')&&typeof _0x5467d8['limit']===_0x5c02('0x2a');var _0x3322f8=_0x2a0dde[_0x5c02('0x2b')];var _0x3bae01=_0x1c891f?0x0:_0x5467d8[_0x5c02('0x29')];var _0x3a9d9d=_0x1c891f?_0x2a0dde[_0x5c02('0x2b')]:_0x5467d8[_0x5c02('0x29')]+_0x5467d8['limit'];var _0xe4943a;if(_0x3a9d9d>=_0x3322f8){_0x3a9d9d=_0x3322f8;_0xe4943a=0xc8;}else{_0xe4943a=0xce;}_0x2f8b5c[_0x5c02('0x27')](_0xe4943a);return _0x2f8b5c['set'](_0x5c02('0x2c'),_0x3bae01+'-'+_0x3a9d9d+'/'+_0x3322f8)[_0x5c02('0x2d')](_0x2a0dde);}return null;};}function patchUpdates(_0x1dc3dd){return function(_0x755f6e){try{jsonpatch[_0x5c02('0x2e')](_0x755f6e,_0x1dc3dd,!![]);}catch(_0x4b9db3){return BPromise[_0x5c02('0x2f')](_0x4b9db3);}return _0x755f6e[_0x5c02('0x30')]();};}function saveUpdates(_0x16ee35,_0x58eb5f){return function(_0x5e6d9e){if(_0x5e6d9e){return _0x5e6d9e[_0x5c02('0x31')](_0x16ee35)[_0x5c02('0x32')](function(_0x82ad1f){return _0x82ad1f;});}return null;};}function removeEntity(_0x3e2eaa,_0xb21af8){return function(_0x43b75b){if(_0x43b75b){return _0x43b75b[_0x5c02('0x33')]()['then'](function(){_0x3e2eaa[_0x5c02('0x27')](0xcc)[_0x5c02('0x28')]();});}};}function handleEntityNotFound(_0x5da0a3,_0x1e2f42){return function(_0x75bcb7){if(!_0x75bcb7){_0x5da0a3['sendStatus'](0x194);}return _0x75bcb7;};}function handleError(_0x1f9c5b,_0xb4c19f){_0xb4c19f=_0xb4c19f||0x1f4;return function(_0x210a2f){logger[_0x5c02('0x21')](_0x210a2f[_0x5c02('0x34')]);if(_0x210a2f[_0x5c02('0x35')]){delete _0x210a2f['name'];}_0x1f9c5b['status'](_0xb4c19f)[_0x5c02('0x36')](_0x210a2f);};}exports[_0x5c02('0x37')]=function(_0x26f3c9,_0x5cf424){var _0x16c5b9={},_0x2af5cc={},_0x511b1e={'count':0x0,'rows':[]};var _0x3d0dc6=_[_0x5c02('0x38')](db[_0x5c02('0x39')][_0x5c02('0x3a')],function(_0xbd0419){return{'name':_0xbd0419[_0x5c02('0x3b')],'type':_0xbd0419[_0x5c02('0x3c')][_0x5c02('0x3d')]};});_0x2af5cc[_0x5c02('0x3e')]=_[_0x5c02('0x38')](_0x3d0dc6,_0x5c02('0x35'));_0x2af5cc['query']=_[_0x5c02('0x3f')](_0x26f3c9['query']);_0x2af5cc['filters']=_[_0x5c02('0x40')](_0x2af5cc[_0x5c02('0x3e')],_0x2af5cc[_0x5c02('0x41')]);_0x16c5b9[_0x5c02('0x42')]=_[_0x5c02('0x40')](_0x2af5cc[_0x5c02('0x3e')],qs[_0x5c02('0x43')](_0x26f3c9[_0x5c02('0x41')][_0x5c02('0x43')]));_0x16c5b9[_0x5c02('0x42')]=_0x16c5b9['attributes'][_0x5c02('0x44')]?_0x16c5b9['attributes']:_0x2af5cc[_0x5c02('0x3e')];if(!_0x26f3c9['query'][_0x5c02('0x45')]('nolimit')){_0x16c5b9[_0x5c02('0x46')]=qs[_0x5c02('0x46')](_0x26f3c9[_0x5c02('0x41')]['limit']);_0x16c5b9['offset']=qs[_0x5c02('0x29')](_0x26f3c9[_0x5c02('0x41')][_0x5c02('0x29')]);}_0x16c5b9[_0x5c02('0x47')]=qs[_0x5c02('0x48')](_0x26f3c9[_0x5c02('0x41')][_0x5c02('0x48')]);_0x16c5b9[_0x5c02('0x49')]=qs['filters'](_['pick'](_0x26f3c9[_0x5c02('0x41')],_0x2af5cc[_0x5c02('0x4a')]),_0x3d0dc6);if(_0x26f3c9[_0x5c02('0x41')][_0x5c02('0x4b')]){_0x16c5b9[_0x5c02('0x49')]=_[_0x5c02('0x4c')](_0x16c5b9['where'],{'$or':_[_0x5c02('0x38')](_0x3d0dc6,function(_0x3acf2d){if(_0x3acf2d[_0x5c02('0x3c')]!==_0x5c02('0x4d')){var _0x101482={};_0x101482[_0x3acf2d[_0x5c02('0x35')]]={'$like':'%'+_0x26f3c9['query'][_0x5c02('0x4b')]+'%'};return _0x101482;}})});}_0x16c5b9=_[_0x5c02('0x4c')]({},_0x16c5b9,_0x26f3c9[_0x5c02('0x4e')]);var _0x4fa3c3={'where':_0x16c5b9['where']};return db['SmsMessage'][_0x5c02('0x2b')](_0x4fa3c3)[_0x5c02('0x32')](function(_0x5d25c2){_0x511b1e[_0x5c02('0x2b')]=_0x5d25c2;if(_0x26f3c9[_0x5c02('0x41')][_0x5c02('0x4f')]){_0x16c5b9['include']=[{'all':!![]}];}return db[_0x5c02('0x39')][_0x5c02('0x50')](_0x16c5b9);})[_0x5c02('0x32')](function(_0x545852){_0x511b1e[_0x5c02('0x51')]=_0x545852;return _0x511b1e;})[_0x5c02('0x32')](respondWithFilteredResult(_0x5cf424,_0x16c5b9))[_0x5c02('0x25')](handleError(_0x5cf424,null));};exports[_0x5c02('0x52')]=function(_0xee7fba,_0x3fe3ff){var _0x5eec7a={'raw':!![],'where':{'id':_0xee7fba[_0x5c02('0x53')]['id']}},_0x29028f={};_0x29028f[_0x5c02('0x3e')]=_[_0x5c02('0x3f')](db[_0x5c02('0x39')][_0x5c02('0x3a')]);_0x29028f[_0x5c02('0x41')]=_[_0x5c02('0x3f')](_0xee7fba[_0x5c02('0x41')]);_0x29028f[_0x5c02('0x4a')]=_[_0x5c02('0x40')](_0x29028f['model'],_0x29028f[_0x5c02('0x41')]);_0x5eec7a[_0x5c02('0x42')]=_['intersection'](_0x29028f[_0x5c02('0x3e')],qs[_0x5c02('0x43')](_0xee7fba[_0x5c02('0x41')][_0x5c02('0x43')]));_0x5eec7a[_0x5c02('0x42')]=_0x5eec7a['attributes'][_0x5c02('0x44')]?_0x5eec7a[_0x5c02('0x42')]:_0x29028f[_0x5c02('0x3e')];if(_0xee7fba[_0x5c02('0x41')]['includeAll']){_0x5eec7a[_0x5c02('0x54')]=[{'all':!![]}];}_0x5eec7a=_['merge']({},_0x5eec7a,_0xee7fba[_0x5c02('0x4e')]);return db['SmsMessage'][_0x5c02('0x55')](_0x5eec7a)[_0x5c02('0x32')](handleEntityNotFound(_0x3fe3ff,null))[_0x5c02('0x32')](respondWithResult(_0x3fe3ff,null))[_0x5c02('0x25')](handleError(_0x3fe3ff,null));};exports[_0x5c02('0x56')]=function(_0x18a2c8,_0x5c8666){return db['SmsMessage'][_0x5c02('0x56')](_0x18a2c8[_0x5c02('0x57')],{})[_0x5c02('0x32')](respondWithResult(_0x5c8666,0xc9))[_0x5c02('0x25')](handleError(_0x5c8666,null));};exports[_0x5c02('0x31')]=function(_0x10ae58,_0x502770){if(_0x10ae58[_0x5c02('0x57')]['id']){delete _0x10ae58[_0x5c02('0x57')]['id'];}return db[_0x5c02('0x39')][_0x5c02('0x55')]({'where':{'id':_0x10ae58[_0x5c02('0x53')]['id']}})['then'](handleEntityNotFound(_0x502770,null))[_0x5c02('0x32')](saveUpdates(_0x10ae58[_0x5c02('0x57')],null))[_0x5c02('0x32')](respondWithResult(_0x502770,null))[_0x5c02('0x25')](handleError(_0x502770,null));};exports['destroy']=function(_0x176747,_0x24674c){return db[_0x5c02('0x39')]['find']({'where':{'id':_0x176747[_0x5c02('0x53')]['id']}})[_0x5c02('0x32')](handleEntityNotFound(_0x24674c,null))[_0x5c02('0x32')](removeEntity(_0x24674c,null))['catch'](handleError(_0x24674c,null));};exports['describe']=function(_0x802a8f,_0xc2d419){return db[_0x5c02('0x39')][_0x5c02('0x58')]()[_0x5c02('0x32')](respondWithResult(_0xc2d419,null))[_0x5c02('0x25')](handleError(_0xc2d419,null));};var interaction_log=require(_0x5c02('0x59'))(_0x5c02('0x5a'));exports[_0x5c02('0x5b')]=function(_0xcf6892,_0x138e7f,_0x3de3f2){var _0x548a55={'agent':{},'channel':_0x5c02('0x5c')};if(_0xcf6892[_0x5c02('0x57')]['id']){delete _0xcf6892[_0x5c02('0x57')]['id'];}_0xcf6892['body'][_0x5c02('0x5d')]=!![];_0xcf6892[_0x5c02('0x57')][_0x5c02('0x5e')]=moment()['format'](_0x5c02('0x5f'));_0xcf6892[_0x5c02('0x57')][_0x5c02('0x60')]=_0xcf6892[_0x5c02('0x57')][_0x5c02('0x60')]||_0xcf6892['user']['id'];_0x548a55[_0x5c02('0x61')]['id']=_0xcf6892[_0x5c02('0x57')][_0x5c02('0x60')];return db[_0x5c02('0x39')][_0x5c02('0x55')]({'where':{'id':_0xcf6892[_0x5c02('0x53')]['id'],'UserId':null}})[_0x5c02('0x32')](handleEntityNotFound(_0x138e7f,null))[_0x5c02('0x32')](saveUpdates(_0xcf6892[_0x5c02('0x57')],null))['then'](function(_0x2b1422){if(_0x2b1422){_0x548a55[_0x5c02('0x23')]=_0x2b1422[_0x5c02('0x62')]({'plain':!![]});return db[_0x5c02('0x63')][_0x5c02('0x55')]({'where':{'id':_0x2b1422[_0x5c02('0x64')]}});}return null;})[_0x5c02('0x32')](handleEntityNotFound(_0x138e7f,null))[_0x5c02('0x32')](function(_0x3d8393){if(_0x3d8393){return _0x3d8393[_0x5c02('0x31')]({'UserId':_0xcf6892['body'][_0x5c02('0x60')],'read1stAt':_['isNil'](_0x3d8393[_0x5c02('0x65')])?moment()[_0x5c02('0x66')](_0x5c02('0x5f')):undefined});}return null;})[_0x5c02('0x32')](function(_0x1fabc7){if(_0x1fabc7){_0x548a55['interaction']=_0x1fabc7['get']({'plain':!![]});interaction_log['info'](_0x5c02('0x67'),_0xcf6892[_0x5c02('0x68')]['id'],_0xcf6892[_0x5c02('0x68')][_0x5c02('0x35')],_0xcf6892[_0x5c02('0x68')][_0x5c02('0x69')],_0x548a55['interaction']['id'],_0xcf6892[_0x5c02('0x57')]?JSON['stringify'](_0xcf6892[_0x5c02('0x57')]):_0x5c02('0x6a'));return respondWithRpcPromise(_0x5c02('0x6b'),_0x5c02('0x6c'),_0x548a55);}return null;})[_0x5c02('0x32')](function(_0x140a26){var _0x4a903e=_0x5c02('0x6d')+_0x140a26[_0x5c02('0x23')][_0x5c02('0x6e')];return db[_0x5c02('0x6f')]['query'](_0x4a903e,{'type':db[_0x5c02('0x70')][_0x5c02('0x71')][_0x5c02('0x72')],'raw':!![]})[_0x5c02('0x32')](function(_0x570a59){return _0x570a59;});})[_0x5c02('0x32')](function(_0x37a3bd){if(_0x37a3bd){_0x548a55['message'][_0x5c02('0x73')]=_0x37a3bd[0x0];if(!_0xcf6892['body'][_0x5c02('0x60')])return;return db[_0x5c02('0x74')]['find']({'where':{'id':_0xcf6892[_0x5c02('0x57')]['UserId'],'role':_0x5c02('0x61')},'attributes':['id',_0x5c02('0x35'),_0x5c02('0x75'),_0x5c02('0x76'),_0x5c02('0x77')],'raw':!![]});}return null;})[_0x5c02('0x32')](function(_0x3e82a0){if(!_0x3e82a0)return null;_0x548a55[_0x5c02('0x23')][_0x5c02('0x61')]=_0x3e82a0;return _0x548a55;})[_0x5c02('0x32')](function(_0xf7d783){if(_0xf7d783){if(_0xcf6892[_0x5c02('0x57')][_0x5c02('0x78')]){_0x548a55['message'][_0x5c02('0x79')]=util[_0x5c02('0x66')](_0x5c02('0x7a'),_0xcf6892['user'][_0x5c02('0x35')]);_0x548a55[_0x5c02('0x23')][_0x5c02('0x7b')]=_0x548a55[_0x5c02('0x7b')];_0x548a55[_0x5c02('0x23')][_0x5c02('0x7c')]=_0x548a55[_0x5c02('0x7b')];_0x548a55[_0x5c02('0x23')][_0x5c02('0x7d')]=_0x5c02('0x5b');return respondWithRpcPromise('EventManager',_0x5c02('0x7e'),{'event':'acceptmessage','message':_0x548a55[_0x5c02('0x23')]},client9002)[_0x5c02('0x32')](function(){return _0x548a55;});}return _0x548a55;}return null;})[_0x5c02('0x32')](respondWithResult(_0x138e7f,null))[_0x5c02('0x25')](handleError(_0x138e7f,null));};var interaction_log=require(_0x5c02('0x59'))(_0x5c02('0x5a'));exports[_0x5c02('0x2f')]=function(_0x186650,_0x2d746d,_0x5009f6){var _0x3cd6d9={'agent':{},'channel':'sms'};if(_0x186650['body']['id']){delete _0x186650[_0x5c02('0x57')]['id'];}_0x186650[_0x5c02('0x57')][_0x5c02('0x60')]=_0x186650[_0x5c02('0x57')]['UserId']||_0x186650['user']['id'];_0x3cd6d9['agent']['id']=_0x186650[_0x5c02('0x57')]['UserId'];return db[_0x5c02('0x39')]['find']({'where':{'id':_0x186650[_0x5c02('0x53')]['id'],'UserId':null}})[_0x5c02('0x32')](handleEntityNotFound(_0x2d746d,null))[_0x5c02('0x32')](function(_0x2452d5){if(_0x2452d5){_0x3cd6d9['message']=_0x2452d5[_0x5c02('0x62')]({'plain':!![]});return db[_0x5c02('0x63')][_0x5c02('0x55')]({'where':{'id':_0x2452d5[_0x5c02('0x64')]}});}return null;})['then'](handleEntityNotFound(_0x2d746d,null))[_0x5c02('0x32')](function(_0x563897){if(_0x563897){_0x3cd6d9['interaction']=_0x563897['get']({'plain':!![]});interaction_log[_0x5c02('0x7f')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x186650[_0x5c02('0x68')]['id'],_0x186650[_0x5c02('0x68')][_0x5c02('0x35')],_0x186650[_0x5c02('0x68')][_0x5c02('0x69')],_0x3cd6d9[_0x5c02('0x80')]['id'],_0x186650['body']?JSON['stringify'](_0x186650[_0x5c02('0x57')]):_0x5c02('0x6a'));return respondWithRpcPromise(_0x5c02('0x81'),_0x5c02('0x82'),_0x3cd6d9);}return null;})['then'](function(_0x4e7213){var _0x27887c=_0x5c02('0x6d')+_0x4e7213[_0x5c02('0x23')][_0x5c02('0x6e')];return db['sequelize'][_0x5c02('0x41')](_0x27887c,{'type':db[_0x5c02('0x70')]['QueryTypes']['SELECT'],'raw':!![]})[_0x5c02('0x32')](function(_0x5bae1){return _0x5bae1;});})[_0x5c02('0x32')](function(_0x14d3bc){if(_0x14d3bc){_0x3cd6d9['message'][_0x5c02('0x73')]=_0x14d3bc[0x0];if(!_0x186650[_0x5c02('0x57')]['UserId'])return;return db[_0x5c02('0x74')][_0x5c02('0x55')]({'where':{'id':_0x186650[_0x5c02('0x57')][_0x5c02('0x60')],'role':_0x5c02('0x61')},'attributes':['id',_0x5c02('0x35'),_0x5c02('0x75'),_0x5c02('0x76'),_0x5c02('0x77')],'raw':!![]});}return null;})[_0x5c02('0x32')](function(_0x5a392b){if(!_0x5a392b)return null;_0x3cd6d9[_0x5c02('0x23')][_0x5c02('0x61')]=_0x5a392b;return _0x3cd6d9;})['then'](function(_0x50e92b){if(_0x50e92b){_0x50e92b[_0x5c02('0x23')][_0x5c02('0x79')]=util['format'](_0x5c02('0x7a'),_0x186650[_0x5c02('0x68')][_0x5c02('0x35')]);_0x50e92b[_0x5c02('0x23')][_0x5c02('0x7b')]=_0x3cd6d9['channel'];_0x50e92b[_0x5c02('0x23')]['motionChannel']=_0x3cd6d9[_0x5c02('0x7b')];_0x50e92b[_0x5c02('0x23')][_0x5c02('0x7d')]=_0x5c02('0x2f');respondWithRpcPromise(_0x5c02('0x7e'),_0x5c02('0x7e'),{'event':_0x5c02('0x83'),'message':_0x50e92b[_0x5c02('0x23')]},client9002);return _0x3cd6d9;}return null;})[_0x5c02('0x32')](respondWithResult(_0x2d746d,null))['catch'](handleError(_0x2d746d,null));};exports['status']=function(_0x5bd534,_0x4e92aa,_0x45d966){if(_0x5bd534[_0x5c02('0x57')]['id']){delete _0x5bd534[_0x5c02('0x57')]['id'];}var _0x2dad48;return db['SmsMessage'][_0x5c02('0x55')]({'where':{'id':_0x5bd534[_0x5c02('0x53')]['id']}})[_0x5c02('0x32')](handleEntityNotFound(_0x4e92aa,null))[_0x5c02('0x32')](function(_0x293b64){if(_0x293b64){_0x2dad48=_0x293b64;return db[_0x5c02('0x84')][_0x5c02('0x55')]({'where':{'id':_0x293b64[_0x5c02('0x85')]}});}})['then'](handleEntityNotFound(_0x4e92aa,null))[_0x5c02('0x32')](function(_0x3142e2){if(_0x3142e2){logger['debug'](_0x5c02('0x1f'),_0x5c02('0x27'),_0x5c02('0x86'),_0x3142e2['type'],util[_0x5c02('0x87')](_0x5bd534[_0x5c02('0x57')],{'showHidden':![],'depth':null}));switch(_0x3142e2[_0x5c02('0x3c')]){case _0x5c02('0x88'):if(_0x5bd534['body']['MessageSid']&&_0x5bd534[_0x5c02('0x57')][_0x5c02('0x89')]===_0x2dad48[_0x5c02('0x8a')]){return _0x2dad48[_0x5c02('0x31')]({'read':!![]});}else{logger[_0x5c02('0x21')](_0x5c02('0x8b'),_0x5c02('0x27'),_0x5c02('0x88'),util[_0x5c02('0x87')](_0x5bd534[_0x5c02('0x57')],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x5bd534['body'][_0x5c02('0x8c')]&&_0x5bd534[_0x5c02('0x57')]['MessageUUID']===_0x2dad48[_0x5c02('0x8a')]&&_[_0x5c02('0x8d')]([_0x5c02('0x8e'),'delivered'],_0x5bd534['body'][_0x5c02('0x8f')])>=0x0){return _0x2dad48[_0x5c02('0x31')]({'read':!![]});}else{logger[_0x5c02('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x5c02('0x27'),_0x5c02('0x90'),util[_0x5c02('0x87')](_0x5bd534['body'],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x2951e6=_0x5bd534[_0x5c02('0x57')][_0x5c02('0x91')][0x0];if(_0x2951e6['status']['groupName']==='DELIVERED'){return _0x2dad48['update']({'read':!![]});}else{logger[_0x5c02('0x21')](_0x5c02('0x8b'),_0x5c02('0x27'),_0x5c02('0x92'),util[_0x5c02('0x87')](_0x5bd534['body'],{'showHidden':![],'depth':null}));}break;}return _0x2dad48;}})['then'](respondWithResult(_0x4e92aa,null))[_0x5c02('0x25')](handleError(_0x4e92aa,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 6f66bff..aac9d89 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 _0x6fe7=['hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save','update','remove','emit'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x6fe7,0x1b2));var _0x76fe=function(_0x531c48,_0x5d36e5){_0x531c48=_0x531c48-0x0;var _0x208c85=_0x6fe7[_0x531c48];return _0x208c85;};'use strict';var EventEmitter=require(_0x76fe('0x0'));var SmsMessage=require(_0x76fe('0x1'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x76fe('0x2')](0x0);var events={'afterCreate':_0x76fe('0x3'),'afterUpdate':_0x76fe('0x4'),'afterDestroy':_0x76fe('0x5')};function emitEvent(_0x546b33){return function(_0x1e714f,_0x3eb3f8,_0x2b7287){SmsMessageEvents[_0x76fe('0x6')](_0x546b33+':'+_0x1e714f['id'],_0x1e714f);SmsMessageEvents['emit'](_0x546b33,_0x1e714f);_0x2b7287(null);};}for(var e in events){if(events[_0x76fe('0x7')](e)){var event=events[e];SmsMessage[_0x76fe('0x8')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file +var _0x869c=['events','../../mysqldb','SmsMessage','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x2d6334,_0x442f22){var _0x2ff29d=function(_0x3ea4f7){while(--_0x3ea4f7){_0x2d6334['push'](_0x2d6334['shift']());}};_0x2ff29d(++_0x442f22);}(_0x869c,0xf0));var _0xc869=function(_0x1df099,_0x353123){_0x1df099=_0x1df099-0x0;var _0x35f53f=_0x869c[_0x1df099];return _0x35f53f;};'use strict';var EventEmitter=require(_0xc869('0x0'));var SmsMessage=require(_0xc869('0x1'))['db'][_0xc869('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xc869('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc869('0x4'),'afterDestroy':_0xc869('0x5')};function emitEvent(_0x2c4582){return function(_0x4ba45d,_0x4a59c9,_0x201dbc){SmsMessageEvents[_0xc869('0x6')](_0x2c4582+':'+_0x4ba45d['id'],_0x4ba45d);SmsMessageEvents[_0xc869('0x6')](_0x2c4582,_0x4ba45d);_0x201dbc(null);};}for(var e in events){if(events[_0xc869('0x7')](e)){var event=events[e];SmsMessage[_0xc869('0x8')](e,emitEvent(event));}}module[_0xc869('0x9')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 81bc78c..2744560 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 _0x376a=['/status?token=','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','skebby','username','password','smsMethod','sender','login?username=','&password=','GET','sms','session_key','total_sent','Missing\x20parameters:\x20username,\x20password','connectel','POST','https://smsapi.connectel.se/api/v2/send/','requestid','deliveryReport','read','inspect','clicksend','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','head','message_id','clickSend','plivo','senderString','token','authId','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','login','text','timestamp','sort','apiKey','createHash','md5','digest','hex','signature=','/external/get/send.php?','keys','id_sms','Missing\x20parameters:\x20apiKey','clickatell','uuid','UTF-8','apiMessageId','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','bandwidth','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','intelepeer','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','rimraf','exports','define','SmsMessage','messageId','fti_sms_messages','body','FULLTEXT','models','get','toLowerCase','direction','secret','isNil','UserId','SmsInteractionId','then','update','createdAt','catch','error','out','find','SmsAccountId','type','twilio','accountSid','authToken','messages','create','phone','remote','/api/sms/messages/'];(function(_0x1862b4,_0x54aed3){var _0x371687=function(_0x4bd5ff){while(--_0x4bd5ff){_0x1862b4['push'](_0x1862b4['shift']());}};_0x371687(++_0x54aed3);}(_0x376a,0xcf));var _0xa376=function(_0x384c9f,_0x39ed3e){_0x384c9f=_0x384c9f-0x0;var _0x5ab9c1=_0x376a[_0x384c9f];return _0x5ab9c1;};'use strict';var _=require(_0xa376('0x0'));var util=require(_0xa376('0x1'));var logger=require(_0xa376('0x2'))('api');var moment=require('moment');var BPromise=require(_0xa376('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa376('0x4'));var config=require('../../config/environment');var attributes=require('./smsMessage.attributes');module[_0xa376('0x5')]=function(_0x41db08,_0x202971){return _0x41db08[_0xa376('0x6')](_0xa376('0x7'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':'messageId','fields':[_0xa376('0x8')]},{'name':_0xa376('0x9'),'fields':[_0xa376('0xa')],'type':_0xa376('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5cf7ed,_0x5d5afb,_0x4d4fcc){var _0x3e0997=_0x41db08[_0xa376('0xc')];var _0x1feadc=_0x5cf7ed[_0xa376('0xd')]({'plain':!![]});if(_0x1feadc['direction'][_0xa376('0xe')]()==='in'||_0x1feadc[_0xa376('0xf')][_0xa376('0xe')]()==='out'&&!_0x1feadc[_0xa376('0x10')]&&!_[_0xa376('0x11')](_0x1feadc[_0xa376('0x12')])&&!_[_0xa376('0x11')](_0x1feadc['SmsInteractionId'])){_0x3e0997['SmsInteraction']['findOne']({'where':{'id':_0x1feadc[_0xa376('0x13')]}})[_0xa376('0x14')](function(_0x4e870d){if(_0x4e870d){_0x4e870d[_0xa376('0x15')]({'lastMsgAt':_0x1feadc[_0xa376('0x16')],'lastMsgDirection':_0x1feadc[_0xa376('0xf')][_0xa376('0xe')]()});}})[_0xa376('0x17')](function(_0x277c2f){console[_0xa376('0x18')](_0x277c2f);});}if(_0x1feadc['direction']===_0xa376('0x19')&&!_0x1feadc[_0xa376('0x10')]){var _0x2c2a9b;_0x3e0997['SmsAccount'][_0xa376('0x1a')]({'where':{'id':_0x1feadc[_0xa376('0x1b')]},'raw':!![]})[_0xa376('0x14')](function(_0x282e1f){_0x2c2a9b=_0x282e1f;if(_0x2c2a9b&&_0x2c2a9b['type']){switch(_0x2c2a9b[_0xa376('0x1c')]){case'twilio':var _0x63ca36=require(_0xa376('0x1d'));if(_0x2c2a9b[_0xa376('0x1e')]&&_0x2c2a9b['authToken']&&_0x2c2a9b['phone']){var _0x148aa0=new _0x63ca36(_0x2c2a9b['accountSid'],_0x2c2a9b[_0xa376('0x1f')]);_0x148aa0[_0xa376('0x20')][_0xa376('0x21')]({'body':_0x1feadc[_0xa376('0xa')],'to':_0x1feadc[_0xa376('0x22')],'from':_0x2c2a9b[_0xa376('0x22')],'statusCallback':_0x2c2a9b[_0xa376('0x23')]+_0xa376('0x24')+_0x1feadc['id']+_0xa376('0x25')+_0x2c2a9b['token']})[_0xa376('0x14')](function(_0x4a69a3){if(_0x4a69a3[_0xa376('0x26')]){return _0x5cf7ed[_0xa376('0x15')]({'messageId':_0x4a69a3[_0xa376('0x26')]});}})[_0xa376('0x17')](function(_0x179031){logger[_0xa376('0x18')](_0xa376('0x27'),'afterCreate','twilio',util['inspect'](_0x179031,{'showHidden':![],'depth':null}));});}else{logger[_0xa376('0x18')](_0xa376('0x27'),_0xa376('0x28'),_0xa376('0x1d'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0xa376('0x29'):var _0x1d2fe8='https://api.skebby.it/API/v1.0/REST/';if(_0x2c2a9b[_0xa376('0x2a')]&&_0x2c2a9b[_0xa376('0x2b')]){var _0x557fb9={'recipient':[_0x1feadc['phone']],'message':_0x1feadc[_0xa376('0xa')],'message_type':_0x2c2a9b['smsMethod']};if(_0x2c2a9b['smsMethod']&&_0x2c2a9b[_0xa376('0x2c')]!=='SI'){_0x557fb9[_0xa376('0x2d')]=_0x2c2a9b['phone'];}var _0x47ed8b={'url':_0x1d2fe8+_0xa376('0x2e')+_0x2c2a9b[_0xa376('0x2a')]+_0xa376('0x2f')+_0x2c2a9b[_0xa376('0x2b')],'method':_0xa376('0x30')};rp(_0x47ed8b)[_0xa376('0x14')](function(_0x54e55a){var _0x56c79f=_0x54e55a['split'](';');var _0x4c1a81={'user_key':_0x56c79f[0x0],'session_key':_0x56c79f[0x1]};_0x47ed8b={'url':_0x1d2fe8+_0xa376('0x31'),'method':'POST','headers':{'user_key':_0x4c1a81['user_key'],'Session_key':_0x4c1a81[_0xa376('0x32')]},'json':!![],'body':_0x557fb9};return rp(_0x47ed8b);})[_0xa376('0x14')](function(_0x490960){if(_0x490960[_0xa376('0x33')]>=0x1){var _0x526bd3={'messageId':_0x490960['internal_order_id']};if(_0x2c2a9b['smsMethod']!=='GP'||!_0x2c2a9b['deliveryReport']){_0x526bd3['read']=!![];}return _0x5cf7ed['update'](_0x526bd3);}else{return logger[_0xa376('0x18')](_0xa376('0x27'),_0xa376('0x28'),'skebby',util['inspect'](_0x490960,{'showHidden':![],'depth':null}));}})[_0xa376('0x17')](function(_0x9933f6){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa376('0x28'),_0xa376('0x29'),util['inspect'](_0x9933f6,{'showHidden':![],'depth':null}));});}else{logger[_0xa376('0x18')](_0xa376('0x27'),_0xa376('0x28'),_0xa376('0x29'),_0xa376('0x34'));}break;case _0xa376('0x35'):if(_0x2c2a9b[_0xa376('0x1f')]){var _0x2931e2={'recipient':_0x1feadc[_0xa376('0x22')],'message':_0x1feadc[_0xa376('0xa')],'sender':_0x2c2a9b['senderString']||_0x2c2a9b[_0xa376('0x22')],'authorization':_0x2c2a9b['authToken']};var _0x5d5afb={'method':_0xa376('0x36'),'uri':_0xa376('0x37'),'body':_0x2931e2,'json':!![]};rp(_0x5d5afb)[_0xa376('0x14')](function(_0x4431c8){var _0x16ea65={'messageId':_0x4431c8[_0xa376('0x38')]};if(!_0x2c2a9b[_0xa376('0x39')]){_0x16ea65[_0xa376('0x3a')]=!![];}return _0x5cf7ed[_0xa376('0x15')](_0x16ea65);})[_0xa376('0x17')](function(_0x22be43){logger[_0xa376('0x18')](_0xa376('0x27'),'afterCreate',_0xa376('0x35'),util[_0xa376('0x3b')](_0x22be43,{'showHidden':![],'depth':null}));});}else{logger[_0xa376('0x18')](_0xa376('0x27'),_0xa376('0x28'),_0xa376('0x35'),'Missing\x20parameters:\x20authToken');}break;case _0xa376('0x3c'):if(_0x2c2a9b[_0xa376('0x2a')]&&_0x2c2a9b[_0xa376('0x2b')]){var _0x2931e2={'messages':[{'source':'xCALLY\x20Motion','to':_0x1feadc[_0xa376('0x22')],'body':_0x1feadc['body'],'from':_0x2c2a9b['senderString']||_0x2c2a9b[_0xa376('0x22')]}]};var _0x580450=util[_0xa376('0x3d')](_0xa376('0x3e'),_0x2c2a9b[_0xa376('0x2a')],_0x2c2a9b[_0xa376('0x2b')]);var _0x5d5afb={'method':'POST','uri':_0xa376('0x3f'),'body':_0x2931e2,'headers':{'Authorization':util[_0xa376('0x3d')](_0xa376('0x40'),new Buffer(_0x580450)[_0xa376('0x41')](_0xa376('0x42')))},'json':!![]};rp(_0x5d5afb)[_0xa376('0x14')](function(_0x39a2ef){if(_0x39a2ef[_0xa376('0x43')]>=0xc8&&_0x39a2ef[_0xa376('0x43')]<=0xce){if(_0x39a2ef[_0xa376('0x44')]&&_0x39a2ef[_0xa376('0x44')]['queued_count']>0x0){var _0xee4f03=_[_0xa376('0x45')](_0x39a2ef[_0xa376('0x44')][_0xa376('0x20')]);var _0x4f182f={'messageId':_0xee4f03[_0xa376('0x46')]};if(!_0x2c2a9b['deliveryReport']){_0x4f182f['read']=!![];}return _0x5cf7ed['update'](_0x4f182f);}else{logger[_0xa376('0x18')](_0xa376('0x27'),_0xa376('0x28'),_0xa376('0x47'),util[_0xa376('0x3b')](_0x39a2ef,{'showHidden':![],'depth':null}));}}else{logger[_0xa376('0x18')](_0xa376('0x27'),_0xa376('0x28'),_0xa376('0x47'),util['inspect'](_0x39a2ef,{'showHidden':![],'depth':null}));}})['catch'](function(_0x1e494c){logger[_0xa376('0x18')](_0xa376('0x27'),_0xa376('0x28'),_0xa376('0x47'),util[_0xa376('0x3b')](_0x1e494c,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xa376('0x27'),_0xa376('0x28'),'clickSend',_0xa376('0x34'));}break;case _0xa376('0x48'):if(_0x2c2a9b['authId']&&_0x2c2a9b[_0xa376('0x1f')]){var _0x2931e2={'dst':_0x1feadc[_0xa376('0x22')],'text':_0x1feadc[_0xa376('0xa')],'src':_0x2c2a9b[_0xa376('0x49')]||_0x2c2a9b['phone'],'url':_0x2c2a9b[_0xa376('0x23')]+'/api/sms/messages/'+_0x1feadc['id']+_0xa376('0x25')+_0x2c2a9b[_0xa376('0x4a')]};var _0x580450=util[_0xa376('0x3d')]('%s:%s',_0x2c2a9b[_0xa376('0x4b')],_0x2c2a9b[_0xa376('0x1f')]);var _0x5d5afb={'method':_0xa376('0x36'),'uri':util['format'](_0xa376('0x4c'),_0x2c2a9b['authId']),'body':_0x2931e2,'headers':{'Authorization':util[_0xa376('0x3d')](_0xa376('0x40'),new Buffer(_0x580450)[_0xa376('0x41')](_0xa376('0x42')))},'json':!![]};rp(_0x5d5afb)[_0xa376('0x14')](function(_0x24ebbb){var _0x3b37f8={'messageId':_0x24ebbb[_0xa376('0x4d')][0x0]};return _0x5cf7ed[_0xa376('0x15')](_0x3b37f8);})[_0xa376('0x17')](function(_0x4b741e){logger[_0xa376('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xa376('0x48'),util[_0xa376('0x3b')](_0x4b741e,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa376('0x28'),_0xa376('0x48'),_0xa376('0x4e'));}break;case _0xa376('0x4f'):if(_0x2c2a9b['username']&&_0x2c2a9b[_0xa376('0x2b')]){if(_0x2c2a9b[_0xa376('0x50')]){var _0x3b6280={'method':'POST','uri':_0x2c2a9b[_0xa376('0x50')]+_0xa376('0x51'),'body':{'username':_0x2c2a9b[_0xa376('0x2a')],'password':_0x2c2a9b[_0xa376('0x2b')]},'json':!![]};return rp(_0x3b6280)[_0xa376('0x14')](function(_0x3912f1){var _0x5f1d46={'method':_0xa376('0x36'),'uri':_0x2c2a9b[_0xa376('0x50')]+_0xa376('0x52'),'body':{'messages':[{'from':_0x2c2a9b[_0xa376('0x22')],'destinations':[{'to':_0x1feadc[_0xa376('0x22')]}],'text':_0x1feadc[_0xa376('0xa')],'notifyUrl':_0x2c2a9b[_0xa376('0x23')]+_0xa376('0x24')+_0x1feadc['id']+_0xa376('0x25')+_0x2c2a9b[_0xa376('0x4a')],'notifyContentType':_0xa376('0x53'),'callbackData':_0x2c2a9b[_0xa376('0x22')]+';'+_0x1feadc[_0xa376('0xa')]}]},'headers':{'Authorization':_0xa376('0x54')+_0x3912f1[_0xa376('0x4a')]},'json':!![]};return rp(_0x5f1d46)['then'](function(_0x5eff1f){if(_0x5eff1f[_0xa376('0x20')]){var _0x50d807={'messageId':_0x5eff1f[_0xa376('0x20')][0x0][_0xa376('0x8')]};if(!_0x2c2a9b['deliveryReport']){_0x50d807[_0xa376('0x3a')]=!![];}return _0x5cf7ed[_0xa376('0x15')](_0x50d807);}else{return logger[_0xa376('0x18')](_0xa376('0x27'),_0xa376('0x28'),'infobip',util['inspect'](_0x5eff1f,{'showHidden':![],'depth':null}));}});})[_0xa376('0x17')](function(_0x18ba71){return logger['error'](_0xa376('0x27'),_0xa376('0x28'),_0xa376('0x4f'),util['inspect'](_0x18ba71,{'showHidden':![],'depth':null}));});}else{logger[_0xa376('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa376('0x28'),_0xa376('0x4f'),_0xa376('0x55'));}}else{logger[_0xa376('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa376('0x28'),_0xa376('0x4f'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xa376('0x56'):var _0x4ab15b=require(_0xa376('0x57'));if(_0x2c2a9b['apiKey']){var _0x57200a={};_0x57200a[_0xa376('0x58')]=_0x2c2a9b[_0xa376('0x2a')];_0x57200a[_0xa376('0x22')]=_0x1feadc['phone'];_0x57200a[_0xa376('0x2d')]=_0x2c2a9b['phone'];_0x57200a[_0xa376('0x59')]=_0x1feadc['body'];_0x57200a[_0xa376('0x5a')]=+new Date();var _0x5c073c='';var _0x196177='';var _0x3a8227=Object['keys'](_0x57200a);_0x3a8227[_0xa376('0x5b')]();for(var _0x35c736=0x0;_0x35c736<_0x3a8227['length'];_0x35c736++){if(_0x5c073c!=''){_0x5c073c+='&';}_0x5c073c+=_0x3a8227[_0x35c736]+'='+encodeURIComponent(_0x57200a[_0x3a8227[_0x35c736]]);_0x196177+=_0x57200a[_0x3a8227[_0x35c736]];}_0x196177+=_0x2c2a9b[_0xa376('0x5c')];_0x196177=_0x4ab15b[_0xa376('0x5d')](_0xa376('0x5e'))[_0xa376('0x15')](_0x196177)[_0xa376('0x5f')](_0xa376('0x60'));if(_0x5c073c!==''){_0x5c073c+='&';}_0x5c073c+=_0xa376('0x61')+_0x196177;var _0x47ed8b={'method':'GET','uri':_0x2c2a9b[_0xa376('0x50')]+_0xa376('0x62')+_0x5c073c,'json':!![]};return rp(_0x47ed8b)['then'](function(_0x4dfc3d){var _0x588d20=Object[_0xa376('0x63')](_0x4dfc3d);if(_0x4dfc3d[_0x588d20[0x0]][_0xa376('0x18')]&&parseInt(_0x4dfc3d[_0x588d20[0x0]][_0xa376('0x18')])===0x0){var _0x1e059b={'messageId':_0x4dfc3d[_0x588d20[0x0]][_0xa376('0x64')]};if(!_0x2c2a9b[_0xa376('0x39')]){_0x1e059b['read']=!![];}return _0x5cf7ed[_0xa376('0x15')](_0x1e059b);}else{return logger[_0xa376('0x18')](_0xa376('0x27'),_0xa376('0x28'),_0xa376('0x56'),util[_0xa376('0x3b')](_0x4dfc3d['error'],{'showHidden':![],'depth':null}));}})[_0xa376('0x17')](function(_0x523081){return logger[_0xa376('0x18')](_0xa376('0x27'),_0xa376('0x28'),_0xa376('0x56'),util[_0xa376('0x3b')](_0x523081,{'showHidden':![],'depth':null}));});}else{logger[_0xa376('0x18')](_0xa376('0x27'),_0xa376('0x28'),_0xa376('0x56'),_0xa376('0x65'));}break;case _0xa376('0x66'):if(_0x2c2a9b[_0xa376('0x5c')]){var _0x4b06de={'method':_0xa376('0x36'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x2c2a9b[_0xa376('0x5c')]},'body':{'content':_0x1feadc['body'],'to':[_0x1feadc[_0xa376('0x22')]],'from':_0x2c2a9b[_0xa376('0x22')],'binary':![],'clientMessageId':_0xa376('0x67'),'charset':_0xa376('0x68')},'json':!![]};rp(_0x4b06de)[_0xa376('0x14')](function(_0x409054){if(!_0x409054[_0xa376('0x18')]){var _0x375903={'messageId':_0x409054[_0xa376('0x20')][0x0][_0xa376('0x69')]};if(!_0x2c2a9b[_0xa376('0x39')]){_0x375903['read']=!![];}return _0x5cf7ed[_0xa376('0x15')](_0x375903);}else{return logger[_0xa376('0x18')](_0xa376('0x27'),'afterCreate',_0xa376('0x66'),util[_0xa376('0x3b')](_0x409054['error'],{'showHidden':![],'depth':null}));}})[_0xa376('0x17')](function(_0x4ff940){return logger[_0xa376('0x18')](_0xa376('0x27'),'afterCreate',_0xa376('0x66'),util[_0xa376('0x3b')](_0x4ff940,{'showHidden':![],'depth':null}));});}else{logger[_0xa376('0x18')](_0xa376('0x27'),_0xa376('0x28'),'clickatell',_0xa376('0x65'));}break;case'bandwidth':if(_0x2c2a9b[_0xa376('0x2a')]&&_0x2c2a9b[_0xa376('0x2b')]){var _0x580450=util[_0xa376('0x3d')](_0xa376('0x3e'),_0x2c2a9b[_0xa376('0x2a')],_0x2c2a9b[_0xa376('0x2b')]);var _0x5d5afb={'method':'POST','uri':_0xa376('0x6a')+_0x2c2a9b[_0xa376('0x6b')]+_0xa376('0x6c'),'body':{'to':[_0x1feadc['phone']],'text':_0x1feadc[_0xa376('0xa')],'from':_0x2c2a9b[_0xa376('0x22')],'applicationId':_0x2c2a9b['applicationId']},'headers':{'Authorization':util['format'](_0xa376('0x40'),new Buffer(_0x580450)[_0xa376('0x41')]('base64'))},'json':!![]};rp(_0x5d5afb)['then'](function(_0x2fe80f){if(_0x2fe80f['id']){var _0x12432e={'messageId':_0x2fe80f['id']};return _0x5cf7ed[_0xa376('0x15')](_0x12432e);}else{logger[_0xa376('0x18')](_0xa376('0x27'),'afterCreate',_0xa376('0x6d'),util['inspect'](_0x2fe80f,{'showHidden':![],'depth':null}));}})[_0xa376('0x17')](function(_0x3c2721){logger[_0xa376('0x18')](_0xa376('0x27'),_0xa376('0x28'),_0xa376('0x6d'),util[_0xa376('0x3b')](_0x3c2721,{'showHidden':![],'depth':null}));});}else{logger[_0xa376('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa376('0x28'),'bandwidth',_0xa376('0x34'));}break;case'intelepeer':if(_0x2c2a9b[_0xa376('0x5c')]){var _0x496ab7={};var _0x47ed8b={'method':_0xa376('0x36'),'uri':_0xa376('0x6e'),'headers':{'Authorization':_0xa376('0x6f')+_0x2c2a9b[_0xa376('0x5c')],'Content-Type':'application/json'},'body':{'from':_0x2c2a9b[_0xa376('0x22')],'to':_0x1feadc[_0xa376('0x22')],'text':_0x1feadc['body']},'json':!![]};return rp(_0x47ed8b)[_0xa376('0x14')](function(_0x3d724c){if(_0x3d724c[_0xa376('0x70')]==0xca){_0x496ab7[_0xa376('0x71')]=_0x3d724c;var _0x1ae696={'method':_0xa376('0x36'),'uri':_0xa376('0x72'),'headers':{'Authorization':_0xa376('0x6f')+_0x2c2a9b[_0xa376('0x5c')],'Content-Type':_0xa376('0x53')},'body':{'refid':_0x496ab7[_0xa376('0x71')][_0xa376('0x73')]},'json':!![]};return rp(_0x1ae696)[_0xa376('0x14')](function(_0x325880){_0x496ab7[_0xa376('0x74')]=_0x325880;var _0x19101d={'messageId':_0x496ab7[_0xa376('0x71')][_0xa376('0x73')],'read':!![]};return _0x5cf7ed[_0xa376('0x15')](_0x19101d);});}else{return logger[_0xa376('0x18')](_0xa376('0x27'),_0xa376('0x28'),'intelepeer',util[_0xa376('0x3b')](_0x3d724c,{'showHidden':![],'depth':null}));}})[_0xa376('0x17')](function(_0x20c5f7){return logger['error'](_0xa376('0x27'),_0xa376('0x28'),'intelepeer',util[_0xa376('0x3b')](_0x20c5f7,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0xa376('0x27'),_0xa376('0x28'),_0xa376('0x75'),_0xa376('0x76'));}break;}}})[_0xa376('0x77')](function(){_0x4d4fcc();});}else{_0x4d4fcc();}}},'charset':_0xa376('0x78'),'collate':_0xa376('0x79')});}; \ No newline at end of file +var _0x9261=['body','remote','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','split','sms','POST','user_key','session_key','total_sent','internal_order_id','deliveryReport','read','afterCreate','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','connectel','Missing\x20parameters:\x20authToken','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','base64','http_code','data','queued_count','head','messages','clickSend','plivo','authId','/api/sms/messages/','https://api.plivo.com/v1/Account/%s/Message/','toString','message_uuid','infobip','baseUrl','/auth/1/session','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','text','timestamp','keys','sort','length','createHash','md5','digest','hex','signature=','GET','/external/get/send.php?','id_sms','clickatell','https://platform.clickatell.com/messages','UTF-8','Missing\x20parameters:\x20apiKey','bandwidth','https://messaging.bandwidth.com/api/v2/users/','applicationId','Missing\x20parameters:\x20username,\x20password','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','code','https://api.intelepeer.com/_rest/v4/app/sms/mdr','message','refid','status','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','messageId','FULLTEXT','models','direction','toLowerCase','secret','isNil','UserId','SmsInteractionId','SmsInteraction','then','update','catch','error','out','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','phone','create'];(function(_0x565a33,_0x53d036){var _0x35bc25=function(_0x51c6f3){while(--_0x51c6f3){_0x565a33['push'](_0x565a33['shift']());}};_0x35bc25(++_0x53d036);}(_0x9261,0xda));var _0x1926=function(_0x80bea0,_0x4c30f4){_0x80bea0=_0x80bea0-0x0;var _0x50fb90=_0x9261[_0x80bea0];return _0x50fb90;};'use strict';var _=require(_0x1926('0x0'));var util=require(_0x1926('0x1'));var logger=require(_0x1926('0x2'))(_0x1926('0x3'));var moment=require(_0x1926('0x4'));var BPromise=require(_0x1926('0x5'));var rp=require(_0x1926('0x6'));var fs=require('fs');var path=require(_0x1926('0x7'));var rimraf=require(_0x1926('0x8'));var config=require(_0x1926('0x9'));var attributes=require(_0x1926('0xa'));module[_0x1926('0xb')]=function(_0xa72aae,_0x11c006){return _0xa72aae[_0x1926('0xc')](_0x1926('0xd'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':'messageId','fields':[_0x1926('0xe')]},{'name':'fti_sms_messages','fields':['body'],'type':_0x1926('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x17c1fd,_0x46922f,_0x216742){var _0x6e0b9e=_0xa72aae[_0x1926('0x10')];var _0x5851ca=_0x17c1fd['get']({'plain':!![]});if(_0x5851ca[_0x1926('0x11')][_0x1926('0x12')]()==='in'||_0x5851ca[_0x1926('0x11')][_0x1926('0x12')]()==='out'&&!_0x5851ca[_0x1926('0x13')]&&!_[_0x1926('0x14')](_0x5851ca[_0x1926('0x15')])&&!_[_0x1926('0x14')](_0x5851ca[_0x1926('0x16')])){_0x6e0b9e[_0x1926('0x17')]['findOne']({'where':{'id':_0x5851ca[_0x1926('0x16')]}})[_0x1926('0x18')](function(_0x1d5e8d){if(_0x1d5e8d){_0x1d5e8d[_0x1926('0x19')]({'lastMsgAt':_0x5851ca['createdAt'],'lastMsgDirection':_0x5851ca[_0x1926('0x11')][_0x1926('0x12')]()});}})[_0x1926('0x1a')](function(_0x58d411){console[_0x1926('0x1b')](_0x58d411);});}if(_0x5851ca[_0x1926('0x11')]===_0x1926('0x1c')&&!_0x5851ca[_0x1926('0x13')]){var _0x1790d7;_0x6e0b9e[_0x1926('0x1d')][_0x1926('0x1e')]({'where':{'id':_0x5851ca[_0x1926('0x1f')]},'raw':!![]})[_0x1926('0x18')](function(_0x4a233c){_0x1790d7=_0x4a233c;if(_0x1790d7&&_0x1790d7[_0x1926('0x20')]){switch(_0x1790d7[_0x1926('0x20')]){case _0x1926('0x21'):var _0x724945=require(_0x1926('0x21'));if(_0x1790d7[_0x1926('0x22')]&&_0x1790d7[_0x1926('0x23')]&&_0x1790d7[_0x1926('0x24')]){var _0x512670=new _0x724945(_0x1790d7[_0x1926('0x22')],_0x1790d7[_0x1926('0x23')]);_0x512670['messages'][_0x1926('0x25')]({'body':_0x5851ca[_0x1926('0x26')],'to':_0x5851ca[_0x1926('0x24')],'from':_0x1790d7[_0x1926('0x24')],'statusCallback':_0x1790d7[_0x1926('0x27')]+'/api/sms/messages/'+_0x5851ca['id']+_0x1926('0x28')+_0x1790d7[_0x1926('0x29')]})[_0x1926('0x18')](function(_0x4c2cd2){if(_0x4c2cd2[_0x1926('0x2a')]){return _0x17c1fd['update']({'messageId':_0x4c2cd2[_0x1926('0x2a')]});}})[_0x1926('0x1a')](function(_0x27dcc0){logger[_0x1926('0x1b')](_0x1926('0x2b'),'afterCreate',_0x1926('0x21'),util[_0x1926('0x2c')](_0x27dcc0,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x1926('0x2b'),'afterCreate',_0x1926('0x21'),_0x1926('0x2d'));}break;case _0x1926('0x2e'):var _0x4b2f7e=_0x1926('0x2f');if(_0x1790d7[_0x1926('0x30')]&&_0x1790d7[_0x1926('0x31')]){var _0x14a1ab={'recipient':[_0x5851ca[_0x1926('0x24')]],'message':_0x5851ca[_0x1926('0x26')],'message_type':_0x1790d7['smsMethod']};if(_0x1790d7[_0x1926('0x32')]&&_0x1790d7['smsMethod']!=='SI'){_0x14a1ab[_0x1926('0x33')]=_0x1790d7[_0x1926('0x24')];}var _0x3c2d2e={'url':_0x4b2f7e+_0x1926('0x34')+_0x1790d7[_0x1926('0x30')]+'&password='+_0x1790d7[_0x1926('0x31')],'method':'GET'};rp(_0x3c2d2e)[_0x1926('0x18')](function(_0x28d114){var _0xbb021d=_0x28d114[_0x1926('0x35')](';');var _0x43cba6={'user_key':_0xbb021d[0x0],'session_key':_0xbb021d[0x1]};_0x3c2d2e={'url':_0x4b2f7e+_0x1926('0x36'),'method':_0x1926('0x37'),'headers':{'user_key':_0x43cba6[_0x1926('0x38')],'Session_key':_0x43cba6[_0x1926('0x39')]},'json':!![],'body':_0x14a1ab};return rp(_0x3c2d2e);})[_0x1926('0x18')](function(_0x182576){if(_0x182576[_0x1926('0x3a')]>=0x1){var _0x5109a0={'messageId':_0x182576[_0x1926('0x3b')]};if(_0x1790d7['smsMethod']!=='GP'||!_0x1790d7[_0x1926('0x3c')]){_0x5109a0[_0x1926('0x3d')]=!![];}return _0x17c1fd[_0x1926('0x19')](_0x5109a0);}else{return logger[_0x1926('0x1b')](_0x1926('0x2b'),_0x1926('0x3e'),_0x1926('0x2e'),util[_0x1926('0x2c')](_0x182576,{'showHidden':![],'depth':null}));}})['catch'](function(_0x2b704f){return logger[_0x1926('0x1b')](_0x1926('0x2b'),_0x1926('0x3e'),_0x1926('0x2e'),util[_0x1926('0x2c')](_0x2b704f,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x1926('0x2b'),'afterCreate',_0x1926('0x2e'),'Missing\x20parameters:\x20username,\x20password');}break;case'connectel':if(_0x1790d7[_0x1926('0x23')]){var _0xc51616={'recipient':_0x5851ca[_0x1926('0x24')],'message':_0x5851ca['body'],'sender':_0x1790d7[_0x1926('0x3f')]||_0x1790d7[_0x1926('0x24')],'authorization':_0x1790d7[_0x1926('0x23')]};var _0x46922f={'method':_0x1926('0x37'),'uri':_0x1926('0x40'),'body':_0xc51616,'json':!![]};rp(_0x46922f)[_0x1926('0x18')](function(_0x410edd){var _0x2d9ddf={'messageId':_0x410edd[_0x1926('0x41')]};if(!_0x1790d7[_0x1926('0x3c')]){_0x2d9ddf['read']=!![];}return _0x17c1fd[_0x1926('0x19')](_0x2d9ddf);})['catch'](function(_0x434714){logger[_0x1926('0x1b')](_0x1926('0x2b'),_0x1926('0x3e'),_0x1926('0x42'),util[_0x1926('0x2c')](_0x434714,{'showHidden':![],'depth':null}));});}else{logger[_0x1926('0x1b')](_0x1926('0x2b'),_0x1926('0x3e'),_0x1926('0x42'),_0x1926('0x43'));}break;case'clicksend':if(_0x1790d7['username']&&_0x1790d7[_0x1926('0x31')]){var _0xc51616={'messages':[{'source':_0x1926('0x44'),'to':_0x5851ca[_0x1926('0x24')],'body':_0x5851ca[_0x1926('0x26')],'from':_0x1790d7[_0x1926('0x3f')]||_0x1790d7[_0x1926('0x24')]}]};var _0x5725c8=util[_0x1926('0x45')](_0x1926('0x46'),_0x1790d7[_0x1926('0x30')],_0x1790d7[_0x1926('0x31')]);var _0x46922f={'method':'POST','uri':_0x1926('0x47'),'body':_0xc51616,'headers':{'Authorization':util[_0x1926('0x45')](_0x1926('0x48'),new Buffer(_0x5725c8)['toString'](_0x1926('0x49')))},'json':!![]};rp(_0x46922f)[_0x1926('0x18')](function(_0xdaf1c){if(_0xdaf1c['http_code']>=0xc8&&_0xdaf1c[_0x1926('0x4a')]<=0xce){if(_0xdaf1c[_0x1926('0x4b')]&&_0xdaf1c[_0x1926('0x4b')][_0x1926('0x4c')]>0x0){var _0x597580=_[_0x1926('0x4d')](_0xdaf1c[_0x1926('0x4b')][_0x1926('0x4e')]);var _0x38b54c={'messageId':_0x597580['message_id']};if(!_0x1790d7[_0x1926('0x3c')]){_0x38b54c[_0x1926('0x3d')]=!![];}return _0x17c1fd[_0x1926('0x19')](_0x38b54c);}else{logger[_0x1926('0x1b')](_0x1926('0x2b'),'afterCreate',_0x1926('0x4f'),util[_0x1926('0x2c')](_0xdaf1c,{'showHidden':![],'depth':null}));}}else{logger[_0x1926('0x1b')](_0x1926('0x2b'),_0x1926('0x3e'),_0x1926('0x4f'),util[_0x1926('0x2c')](_0xdaf1c,{'showHidden':![],'depth':null}));}})[_0x1926('0x1a')](function(_0x4e08ed){logger[_0x1926('0x1b')](_0x1926('0x2b'),_0x1926('0x3e'),'clickSend',util[_0x1926('0x2c')](_0x4e08ed,{'showHidden':![],'depth':null}));});}else{logger[_0x1926('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1926('0x3e'),_0x1926('0x4f'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x1926('0x50'):if(_0x1790d7[_0x1926('0x51')]&&_0x1790d7[_0x1926('0x23')]){var _0xc51616={'dst':_0x5851ca[_0x1926('0x24')],'text':_0x5851ca[_0x1926('0x26')],'src':_0x1790d7[_0x1926('0x3f')]||_0x1790d7[_0x1926('0x24')],'url':_0x1790d7[_0x1926('0x27')]+_0x1926('0x52')+_0x5851ca['id']+_0x1926('0x28')+_0x1790d7[_0x1926('0x29')]};var _0x5725c8=util[_0x1926('0x45')](_0x1926('0x46'),_0x1790d7[_0x1926('0x51')],_0x1790d7[_0x1926('0x23')]);var _0x46922f={'method':_0x1926('0x37'),'uri':util[_0x1926('0x45')](_0x1926('0x53'),_0x1790d7[_0x1926('0x51')]),'body':_0xc51616,'headers':{'Authorization':util[_0x1926('0x45')](_0x1926('0x48'),new Buffer(_0x5725c8)[_0x1926('0x54')](_0x1926('0x49')))},'json':!![]};rp(_0x46922f)[_0x1926('0x18')](function(_0x4647e1){var _0x497c12={'messageId':_0x4647e1[_0x1926('0x55')][0x0]};return _0x17c1fd[_0x1926('0x19')](_0x497c12);})['catch'](function(_0x232472){logger[_0x1926('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x1926('0x50'),util['inspect'](_0x232472,{'showHidden':![],'depth':null}));});}else{logger[_0x1926('0x1b')](_0x1926('0x2b'),_0x1926('0x3e'),_0x1926('0x50'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case _0x1926('0x56'):if(_0x1790d7['username']&&_0x1790d7[_0x1926('0x31')]){if(_0x1790d7[_0x1926('0x57')]){var _0x1a322d={'method':_0x1926('0x37'),'uri':_0x1790d7['baseUrl']+_0x1926('0x58'),'body':{'username':_0x1790d7['username'],'password':_0x1790d7[_0x1926('0x31')]},'json':!![]};return rp(_0x1a322d)['then'](function(_0x32f13e){var _0x384e31={'method':'POST','uri':_0x1790d7[_0x1926('0x57')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0x1790d7['phone'],'destinations':[{'to':_0x5851ca['phone']}],'text':_0x5851ca[_0x1926('0x26')],'notifyUrl':_0x1790d7[_0x1926('0x27')]+_0x1926('0x52')+_0x5851ca['id']+'/status?token='+_0x1790d7[_0x1926('0x29')],'notifyContentType':_0x1926('0x59'),'callbackData':_0x1790d7[_0x1926('0x24')]+';'+_0x5851ca[_0x1926('0x26')]}]},'headers':{'Authorization':_0x1926('0x5a')+_0x32f13e[_0x1926('0x29')]},'json':!![]};return rp(_0x384e31)[_0x1926('0x18')](function(_0x5b2a38){if(_0x5b2a38['messages']){var _0x25ed88={'messageId':_0x5b2a38['messages'][0x0][_0x1926('0xe')]};if(!_0x1790d7[_0x1926('0x3c')]){_0x25ed88[_0x1926('0x3d')]=!![];}return _0x17c1fd['update'](_0x25ed88);}else{return logger[_0x1926('0x1b')](_0x1926('0x2b'),_0x1926('0x3e'),_0x1926('0x56'),util['inspect'](_0x5b2a38,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x4e8958){return logger[_0x1926('0x1b')](_0x1926('0x2b'),_0x1926('0x3e'),_0x1926('0x56'),util['inspect'](_0x4e8958,{'showHidden':![],'depth':null}));});}else{logger[_0x1926('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','infobip',_0x1926('0x5b'));}}else{logger[_0x1926('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1926('0x3e'),_0x1926('0x56'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x1926('0x5c'):var _0x1a861c=require(_0x1926('0x5d'));if(_0x1790d7[_0x1926('0x5e')]){var _0x538c0f={};_0x538c0f[_0x1926('0x5f')]=_0x1790d7['username'];_0x538c0f[_0x1926('0x24')]=_0x5851ca['phone'];_0x538c0f[_0x1926('0x33')]=_0x1790d7[_0x1926('0x24')];_0x538c0f[_0x1926('0x60')]=_0x5851ca[_0x1926('0x26')];_0x538c0f[_0x1926('0x61')]=+new Date();var _0x44ac77='';var _0x22e58c='';var _0x3b1eea=Object[_0x1926('0x62')](_0x538c0f);_0x3b1eea[_0x1926('0x63')]();for(var _0x58df64=0x0;_0x58df64<_0x3b1eea[_0x1926('0x64')];_0x58df64++){if(_0x44ac77!=''){_0x44ac77+='&';}_0x44ac77+=_0x3b1eea[_0x58df64]+'='+encodeURIComponent(_0x538c0f[_0x3b1eea[_0x58df64]]);_0x22e58c+=_0x538c0f[_0x3b1eea[_0x58df64]];}_0x22e58c+=_0x1790d7[_0x1926('0x5e')];_0x22e58c=_0x1a861c[_0x1926('0x65')](_0x1926('0x66'))['update'](_0x22e58c)[_0x1926('0x67')](_0x1926('0x68'));if(_0x44ac77!==''){_0x44ac77+='&';}_0x44ac77+=_0x1926('0x69')+_0x22e58c;var _0x3c2d2e={'method':_0x1926('0x6a'),'uri':_0x1790d7[_0x1926('0x57')]+_0x1926('0x6b')+_0x44ac77,'json':!![]};return rp(_0x3c2d2e)[_0x1926('0x18')](function(_0x133e99){var _0x34b073=Object[_0x1926('0x62')](_0x133e99);if(_0x133e99[_0x34b073[0x0]][_0x1926('0x1b')]&&parseInt(_0x133e99[_0x34b073[0x0]]['error'])===0x0){var _0x21f6e3={'messageId':_0x133e99[_0x34b073[0x0]][_0x1926('0x6c')]};if(!_0x1790d7['deliveryReport']){_0x21f6e3[_0x1926('0x3d')]=!![];}return _0x17c1fd[_0x1926('0x19')](_0x21f6e3);}else{return logger[_0x1926('0x1b')](_0x1926('0x2b'),_0x1926('0x3e'),_0x1926('0x5c'),util[_0x1926('0x2c')](_0x133e99[_0x1926('0x1b')],{'showHidden':![],'depth':null}));}})[_0x1926('0x1a')](function(_0x3f8fb2){return logger[_0x1926('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1926('0x3e'),'csc',util['inspect'](_0x3f8fb2,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x1926('0x5c'),'Missing\x20parameters:\x20apiKey');}break;case _0x1926('0x6d'):if(_0x1790d7[_0x1926('0x5e')]){var _0x489d12={'method':_0x1926('0x37'),'uri':_0x1926('0x6e'),'headers':{'Authorization':_0x1790d7[_0x1926('0x5e')]},'body':{'content':_0x5851ca[_0x1926('0x26')],'to':[_0x5851ca['phone']],'from':_0x1790d7[_0x1926('0x24')],'binary':![],'clientMessageId':'uuid','charset':_0x1926('0x6f')},'json':!![]};rp(_0x489d12)['then'](function(_0x574e80){if(!_0x574e80[_0x1926('0x1b')]){var _0x3d2dfc={'messageId':_0x574e80[_0x1926('0x4e')][0x0]['apiMessageId']};if(!_0x1790d7['deliveryReport']){_0x3d2dfc['read']=!![];}return _0x17c1fd['update'](_0x3d2dfc);}else{return logger[_0x1926('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1926('0x3e'),_0x1926('0x6d'),util[_0x1926('0x2c')](_0x574e80[_0x1926('0x1b')],{'showHidden':![],'depth':null}));}})[_0x1926('0x1a')](function(_0x3cf7e3){return logger[_0x1926('0x1b')](_0x1926('0x2b'),'afterCreate',_0x1926('0x6d'),util[_0x1926('0x2c')](_0x3cf7e3,{'showHidden':![],'depth':null}));});}else{logger[_0x1926('0x1b')](_0x1926('0x2b'),'afterCreate',_0x1926('0x6d'),_0x1926('0x70'));}break;case _0x1926('0x71'):if(_0x1790d7['username']&&_0x1790d7[_0x1926('0x31')]){var _0x5725c8=util[_0x1926('0x45')](_0x1926('0x46'),_0x1790d7['username'],_0x1790d7['password']);var _0x46922f={'method':'POST','uri':_0x1926('0x72')+_0x1790d7['accountId']+'/messages','body':{'to':[_0x5851ca[_0x1926('0x24')]],'text':_0x5851ca[_0x1926('0x26')],'from':_0x1790d7[_0x1926('0x24')],'applicationId':_0x1790d7[_0x1926('0x73')]},'headers':{'Authorization':util[_0x1926('0x45')](_0x1926('0x48'),new Buffer(_0x5725c8)[_0x1926('0x54')](_0x1926('0x49')))},'json':!![]};rp(_0x46922f)[_0x1926('0x18')](function(_0x4723ad){if(_0x4723ad['id']){var _0xa02b37={'messageId':_0x4723ad['id']};return _0x17c1fd[_0x1926('0x19')](_0xa02b37);}else{logger['error'](_0x1926('0x2b'),_0x1926('0x3e'),_0x1926('0x71'),util[_0x1926('0x2c')](_0x4723ad,{'showHidden':![],'depth':null}));}})[_0x1926('0x1a')](function(_0x1bddf5){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x1926('0x71'),util[_0x1926('0x2c')](_0x1bddf5,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x1926('0x2b'),'afterCreate',_0x1926('0x71'),_0x1926('0x74'));}break;case _0x1926('0x75'):if(_0x1790d7[_0x1926('0x5e')]){var _0x177e94={};var _0x3c2d2e={'method':_0x1926('0x37'),'uri':_0x1926('0x76'),'headers':{'Authorization':'Bearer\x20'+_0x1790d7[_0x1926('0x5e')],'Content-Type':'application/json'},'body':{'from':_0x1790d7[_0x1926('0x24')],'to':_0x5851ca['phone'],'text':_0x5851ca['body']},'json':!![]};return rp(_0x3c2d2e)[_0x1926('0x18')](function(_0x1178c8){if(_0x1178c8[_0x1926('0x77')]==0xca){_0x177e94['message']=_0x1178c8;var _0x516e23={'method':'POST','uri':_0x1926('0x78'),'headers':{'Authorization':'Bearer\x20'+_0x1790d7[_0x1926('0x5e')],'Content-Type':'application/json'},'body':{'refid':_0x177e94[_0x1926('0x79')][_0x1926('0x7a')]},'json':!![]};return rp(_0x516e23)[_0x1926('0x18')](function(_0x2e5dcb){_0x177e94[_0x1926('0x7b')]=_0x2e5dcb;var _0x163982={'messageId':_0x177e94[_0x1926('0x79')][_0x1926('0x7a')],'read':!![]};return _0x17c1fd['update'](_0x163982);});}else{return logger[_0x1926('0x1b')](_0x1926('0x2b'),_0x1926('0x3e'),'intelepeer',util['inspect'](_0x1178c8,{'showHidden':![],'depth':null}));}})['catch'](function(_0x51f76e){return logger[_0x1926('0x1b')](_0x1926('0x2b'),'afterCreate',_0x1926('0x75'),util[_0x1926('0x2c')](_0x51f76e,{'showHidden':![],'depth':null}));});}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x1926('0x75'),_0x1926('0x7c'));}break;}}})[_0x1926('0x7d')](function(){_0x216742();});}else{_0x216742();}}},'charset':_0x1926('0x7e'),'collate':_0x1926('0x7f')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index c0e2a79..d2df9df 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 _0xc3fa=['http','redis','defaults','localhost','socket.io-emitter','request','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','CreateSmsMessage','SmsMessage','options','raw','then','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise'];(function(_0x6be7b7,_0x23c9eb){var _0x217e2d=function(_0x4e79e3){while(--_0x4e79e3){_0x6be7b7['push'](_0x6be7b7['shift']());}};_0x217e2d(++_0x23c9eb);}(_0xc3fa,0xeb));var _0xac3f=function(_0x2bddf9,_0x22c873){_0x2bddf9=_0x2bddf9-0x0;var _0x3f3ae9=_0xc3fa[_0x2bddf9];return _0x3f3ae9;};'use strict';var _=require(_0xac3f('0x0'));var util=require(_0xac3f('0x1'));var moment=require('moment');var BPromise=require(_0xac3f('0x2'));var rs=require(_0xac3f('0x3'));var fs=require('fs');var Redis=require(_0xac3f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xac3f('0x5'));var logger=require('../../config/logger')(_0xac3f('0x6'));var config=require('../../config/environment');var jayson=require(_0xac3f('0x7'));var client=jayson['client'][_0xac3f('0x8')]({'port':0x232a});config[_0xac3f('0x9')]=_[_0xac3f('0xa')](config['redis'],{'host':_0xac3f('0xb'),'port':0x18eb});var socket=require(_0xac3f('0xc'))(new Redis(config['redis']));require('./smsMessage.socket')['register'](socket);function respondWithRpcPromise(_0xfc35d5,_0x456f57,_0x44875a){return new BPromise(function(_0x223189,_0x233b0b){return client[_0xac3f('0xd')](_0xfc35d5,_0x44875a)['then'](function(_0x531f06){logger[_0xac3f('0xe')](_0xac3f('0xf'),_0x456f57,_0xac3f('0x10'));logger[_0xac3f('0x11')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x456f57,_0xac3f('0x10'),JSON[_0xac3f('0x12')](_0x531f06));if(_0x531f06[_0xac3f('0x13')]){if(_0x531f06[_0xac3f('0x13')]['code']===0x1f4){logger['error']('SmsMessage,\x20%s,\x20%s',_0x456f57,_0x531f06[_0xac3f('0x13')][_0xac3f('0x14')]);return _0x233b0b(_0x531f06['error'][_0xac3f('0x14')]);}logger[_0xac3f('0x13')](_0xac3f('0xf'),_0x456f57,_0x531f06[_0xac3f('0x13')][_0xac3f('0x14')]);return _0x223189(_0x531f06[_0xac3f('0x13')][_0xac3f('0x14')]);}else{logger[_0xac3f('0xe')](_0xac3f('0xf'),_0x456f57,_0xac3f('0x10'));_0x223189(_0x531f06['result'][_0xac3f('0x14')]);}})[_0xac3f('0x15')](function(_0x3aba39){logger['error'](_0xac3f('0xf'),_0x456f57,_0x3aba39);_0x233b0b(_0x3aba39);});});}exports[_0xac3f('0x16')]=function(_0x2e775e){var _0x4b3ce4=this;return new Promise(function(_0x346a96,_0x4fa88c){return db[_0xac3f('0x17')]['create'](_0x2e775e['body'],{'raw':_0x2e775e[_0xac3f('0x18')]?_0x2e775e[_0xac3f('0x18')][_0xac3f('0x19')]===undefined?!![]:![]:!![]})[_0xac3f('0x1a')](function(_0x26fbdf){logger[_0xac3f('0xe')](_0xac3f('0x16'),_0x2e775e);logger[_0xac3f('0x11')](_0xac3f('0x16'),_0x2e775e,JSON[_0xac3f('0x12')](_0x26fbdf));_0x346a96(_0x26fbdf);})[_0xac3f('0x15')](function(_0x3f8f6d){logger[_0xac3f('0x13')](_0xac3f('0x16'),_0x3f8f6d[_0xac3f('0x14')],_0x2e775e);_0x4fa88c(_0x4b3ce4[_0xac3f('0x13')](0x1f4,_0x3f8f6d[_0xac3f('0x14')]));});});}; \ No newline at end of file +var _0xaa1d=['../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./smsMessage.socket','register','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','CreateSmsMessage','SmsMessage','create','body','options','raw','then','lodash','util','moment','ioredis','../../mysqldb'];(function(_0x5ab8d6,_0x4414c5){var _0x339755=function(_0x3d4f6f){while(--_0x3d4f6f){_0x5ab8d6['push'](_0x5ab8d6['shift']());}};_0x339755(++_0x4414c5);}(_0xaa1d,0x150));var _0xdaa1=function(_0x249ba5,_0x122fe3){_0x249ba5=_0x249ba5-0x0;var _0x4746ae=_0xaa1d[_0x249ba5];return _0x4746ae;};'use strict';var _=require(_0xdaa1('0x0'));var util=require(_0xdaa1('0x1'));var moment=require(_0xdaa1('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdaa1('0x3'));var db=require(_0xdaa1('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xdaa1('0x5'))(_0xdaa1('0x6'));var config=require(_0xdaa1('0x7'));var jayson=require(_0xdaa1('0x8'));var client=jayson[_0xdaa1('0x9')]['http']({'port':0x232a});config[_0xdaa1('0xa')]=_[_0xdaa1('0xb')](config[_0xdaa1('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xdaa1('0xc'))(new Redis(config[_0xdaa1('0xa')]));require(_0xdaa1('0xd'))[_0xdaa1('0xe')](socket);function respondWithRpcPromise(_0x96861a,_0x56f842,_0x2e2899){return new BPromise(function(_0x1559aa,_0xd5e5bf){return client['request'](_0x96861a,_0x2e2899)['then'](function(_0x311303){logger[_0xdaa1('0xf')](_0xdaa1('0x10'),_0x56f842,_0xdaa1('0x11'));logger[_0xdaa1('0x12')](_0xdaa1('0x13'),_0x56f842,'request\x20sent',JSON[_0xdaa1('0x14')](_0x311303));if(_0x311303[_0xdaa1('0x15')]){if(_0x311303[_0xdaa1('0x15')]['code']===0x1f4){logger['error'](_0xdaa1('0x10'),_0x56f842,_0x311303['error']['message']);return _0xd5e5bf(_0x311303[_0xdaa1('0x15')]['message']);}logger[_0xdaa1('0x15')](_0xdaa1('0x10'),_0x56f842,_0x311303['error'][_0xdaa1('0x16')]);return _0x1559aa(_0x311303[_0xdaa1('0x15')][_0xdaa1('0x16')]);}else{logger[_0xdaa1('0xf')](_0xdaa1('0x10'),_0x56f842,'request\x20sent');_0x1559aa(_0x311303['result'][_0xdaa1('0x16')]);}})[_0xdaa1('0x17')](function(_0x44ed42){logger[_0xdaa1('0x15')](_0xdaa1('0x10'),_0x56f842,_0x44ed42);_0xd5e5bf(_0x44ed42);});});}exports[_0xdaa1('0x18')]=function(_0x27d2eb){var _0x5c6c6b=this;return new Promise(function(_0x5cdb12,_0x2675d1){return db[_0xdaa1('0x19')][_0xdaa1('0x1a')](_0x27d2eb[_0xdaa1('0x1b')],{'raw':_0x27d2eb['options']?_0x27d2eb[_0xdaa1('0x1c')][_0xdaa1('0x1d')]===undefined?!![]:![]:!![]})[_0xdaa1('0x1e')](function(_0x3155c7){logger['info'](_0xdaa1('0x18'),_0x27d2eb);logger[_0xdaa1('0x12')](_0xdaa1('0x18'),_0x27d2eb,JSON[_0xdaa1('0x14')](_0x3155c7));_0x5cdb12(_0x3155c7);})[_0xdaa1('0x17')](function(_0x494ea7){logger[_0xdaa1('0x15')](_0xdaa1('0x18'),_0x494ea7[_0xdaa1('0x16')],_0x27d2eb);_0x2675d1(_0x5c6c6b['error'](0x1f4,_0x494ea7[_0xdaa1('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index a39b850..59cbaad 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 _0x0a95=['length','smsMessage:','./smsMessage.events','update','register'];(function(_0x5685f5,_0x247707){var _0x212ecc=function(_0x36e991){while(--_0x36e991){_0x5685f5['push'](_0x5685f5['shift']());}};_0x212ecc(++_0x247707);}(_0x0a95,0xac));var _0x50a9=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x0a95[_0x465a0c];return _0x1e202e;};'use strict';var SmsMessageEvents=require(_0x50a9('0x0'));var events=['save','remove',_0x50a9('0x1')];function createListener(_0x28a5d3,_0x5c3ddf){return function(_0x20f7c5){_0x5c3ddf['emit'](_0x28a5d3,_0x20f7c5);};}function removeListener(_0x2524d3,_0x53420a){return function(){SmsMessageEvents['removeListener'](_0x2524d3,_0x53420a);};}exports[_0x50a9('0x2')]=function(_0x1f0da6){for(var _0x4a426f=0x0,_0xcbb08f=events[_0x50a9('0x3')];_0x4a426f<_0xcbb08f;_0x4a426f++){var _0xaa5440=events[_0x4a426f];var _0x5cbc6d=createListener(_0x50a9('0x4')+_0xaa5440,_0x1f0da6);SmsMessageEvents['on'](_0xaa5440,_0x5cbc6d);}}; \ No newline at end of file +var _0x1b68=['removeListener','register','emit'];(function(_0xe66cf2,_0x32ba5f){var _0x2d84e7=function(_0x58a7d8){while(--_0x58a7d8){_0xe66cf2['push'](_0xe66cf2['shift']());}};_0x2d84e7(++_0x32ba5f);}(_0x1b68,0x158));var _0x81b6=function(_0x483f6f,_0x40068d){_0x483f6f=_0x483f6f-0x0;var _0x2f0ed0=_0x1b68[_0x483f6f];return _0x2f0ed0;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=['save','remove','update'];function createListener(_0x56349d,_0x2b714b){return function(_0x524b65){_0x2b714b[_0x81b6('0x0')](_0x56349d,_0x524b65);};}function removeListener(_0xd3fb9a,_0x414866){return function(){SmsMessageEvents[_0x81b6('0x1')](_0xd3fb9a,_0x414866);};}exports[_0x81b6('0x2')]=function(_0x54b5bb){for(var _0x26b81a=0x0,_0x2ef42d=events['length'];_0x26b81a<_0x2ef42d;_0x26b81a++){var _0x4e3654=events[_0x26b81a];var _0x5cbe32=createListener('smsMessage:'+_0x4e3654,_0x54b5bb);SmsMessageEvents['on'](_0x4e3654,_0x5cbe32);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 15346d5..e950f88 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 _0x93b1=['./smsQueue.controller','get','isAuthenticated','index','describe','/:id','show','/:id/members','getMembers','getTeams','/:id/users','post','create','addTeams','put','delete','/:id/teams','removeTeams','removeAgents','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x4ab737,_0x47ea44){var _0x55ee78=function(_0x554c7d){while(--_0x554c7d){_0x4ab737['push'](_0x4ab737['shift']());}};_0x55ee78(++_0x47ea44);}(_0x93b1,0x122));var _0x193b=function(_0x5b150f,_0x185e99){_0x5b150f=_0x5b150f-0x0;var _0x3a246e=_0x93b1[_0x5b150f];return _0x3a246e;};'use strict';var multer=require(_0x193b('0x0'));var util=require(_0x193b('0x1'));var path=require('path');var timeout=require(_0x193b('0x2'));var express=require('express');var router=express[_0x193b('0x3')]();var fs_extra=require(_0x193b('0x4'));var auth=require(_0x193b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x193b('0x6'));var controller=require(_0x193b('0x7'));router[_0x193b('0x8')]('/',auth[_0x193b('0x9')](),controller[_0x193b('0xa')]);router[_0x193b('0x8')]('/describe',auth[_0x193b('0x9')](),controller[_0x193b('0xb')]);router[_0x193b('0x8')](_0x193b('0xc'),auth[_0x193b('0x9')](),controller[_0x193b('0xd')]);router['get'](_0x193b('0xe'),auth['isAuthenticated'](),controller[_0x193b('0xf')]);router[_0x193b('0x8')]('/:id/teams',auth[_0x193b('0x9')](),controller[_0x193b('0x10')]);router[_0x193b('0x8')](_0x193b('0x11'),auth[_0x193b('0x9')](),controller['getAgents']);router[_0x193b('0x12')]('/',auth[_0x193b('0x9')](),controller[_0x193b('0x13')]);router[_0x193b('0x12')]('/:id/teams',auth[_0x193b('0x9')](),controller[_0x193b('0x14')]);router[_0x193b('0x12')](_0x193b('0x11'),auth[_0x193b('0x9')](),controller['addAgents']);router[_0x193b('0x15')](_0x193b('0xc'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x193b('0xc'),auth['isAuthenticated'](),controller['destroy']);router[_0x193b('0x16')](_0x193b('0x17'),auth[_0x193b('0x9')](),controller[_0x193b('0x18')]);router[_0x193b('0x16')](_0x193b('0x11'),auth[_0x193b('0x9')](),controller[_0x193b('0x19')]);module[_0x193b('0x1a')]=router; \ No newline at end of file +var _0x5d59=['fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','show','getMembers','/:id/teams','getAgents','create','post','addTeams','/:id/users','addAgents','put','update','delete','/:id','destroy','removeTeams','removeAgents','exports','multer','util','path','express','Router'];(function(_0x38d2c6,_0x5c1a2f){var _0x3c3633=function(_0x5cf20c){while(--_0x5cf20c){_0x38d2c6['push'](_0x38d2c6['shift']());}};_0x3c3633(++_0x5c1a2f);}(_0x5d59,0x163));var _0x95d5=function(_0x5b73ff,_0x1cba4d){_0x5b73ff=_0x5b73ff-0x0;var _0x1c4ba4=_0x5d59[_0x5b73ff];return _0x1c4ba4;};'use strict';var multer=require(_0x95d5('0x0'));var util=require(_0x95d5('0x1'));var path=require(_0x95d5('0x2'));var timeout=require('connect-timeout');var express=require(_0x95d5('0x3'));var router=express[_0x95d5('0x4')]();var fs_extra=require(_0x95d5('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x95d5('0x6'));var config=require(_0x95d5('0x7'));var controller=require('./smsQueue.controller');router['get']('/',auth[_0x95d5('0x8')](),controller[_0x95d5('0x9')]);router[_0x95d5('0xa')](_0x95d5('0xb'),auth['isAuthenticated'](),controller[_0x95d5('0xc')]);router[_0x95d5('0xa')]('/:id',auth[_0x95d5('0x8')](),controller[_0x95d5('0xd')]);router['get']('/:id/members',auth[_0x95d5('0x8')](),controller[_0x95d5('0xe')]);router[_0x95d5('0xa')](_0x95d5('0xf'),auth[_0x95d5('0x8')](),controller['getTeams']);router[_0x95d5('0xa')]('/:id/users',auth['isAuthenticated'](),controller[_0x95d5('0x10')]);router['post']('/',auth[_0x95d5('0x8')](),controller[_0x95d5('0x11')]);router[_0x95d5('0x12')](_0x95d5('0xf'),auth['isAuthenticated'](),controller[_0x95d5('0x13')]);router[_0x95d5('0x12')](_0x95d5('0x14'),auth[_0x95d5('0x8')](),controller[_0x95d5('0x15')]);router[_0x95d5('0x16')]('/:id',auth[_0x95d5('0x8')](),controller[_0x95d5('0x17')]);router[_0x95d5('0x18')](_0x95d5('0x19'),auth[_0x95d5('0x8')](),controller[_0x95d5('0x1a')]);router[_0x95d5('0x18')](_0x95d5('0xf'),auth['isAuthenticated'](),controller[_0x95d5('0x1b')]);router['delete']('/:id/users',auth[_0x95d5('0x8')](),controller[_0x95d5('0x1c')]);module[_0x95d5('0x1d')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 003ccd8..84d7536 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 _0x6f49=['rrmemory','roundrobin','exports','name','STRING','INTEGER'];(function(_0x48645f,_0x427f26){var _0x9b59ff=function(_0x263072){while(--_0x263072){_0x48645f['push'](_0x48645f['shift']());}};_0x9b59ff(++_0x427f26);}(_0x6f49,0x1d6));var _0x96f4=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6f49[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0x96f4('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x96f4('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x96f4('0x2')]},'timeout':{'type':Sequelize[_0x96f4('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x96f4('0x4'),'beepall',_0x96f4('0x5'))}}; \ No newline at end of file +var _0x2117=['rrmemory','roundrobin','sequelize','exports','STRING','name','ENUM'];(function(_0x2dc96f,_0x459058){var _0xd012da=function(_0x38d032){while(--_0x38d032){_0x2dc96f['push'](_0x2dc96f['shift']());}};_0xd012da(++_0x459058);}(_0x2117,0xa3));var _0x7211=function(_0x4a4b82,_0x47bea0){_0x4a4b82=_0x4a4b82-0x0;var _0x1d9df2=_0x2117[_0x4a4b82];return _0x1d9df2;};'use strict';var Sequelize=require(_0x7211('0x0'));module[_0x7211('0x1')]={'name':{'type':Sequelize[_0x7211('0x2')],'unique':_0x7211('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x7211('0x4')](_0x7211('0x5'),'beepall',_0x7211('0x6'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 0aa6305..a2556b7 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 _0xcb2c=['SmsQueues','UserProfileResource','destroy','end','error','name','index','map','SmsQueue','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','findAll','rows','catch','show','include','find','create','body','user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','findOne','UserSmsQueue','order','SmsQueueId','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','format','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','sequelize','transaction','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','field','tq.TeamId','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','includes','union','compact','value','isEmpty','removeAgents','addAgents','omit','isArray','userSmsQueue:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','offset','limit','undefined','count','set','Content-Range','json','update','then','get'];(function(_0x3c57df,_0x5f1ca1){var _0x329c6a=function(_0x2129ca){while(--_0x2129ca){_0x3c57df['push'](_0x3c57df['shift']());}};_0x329c6a(++_0x5f1ca1);}(_0xcb2c,0x16b));var _0xccb2=function(_0x1eda20,_0x1149f4){_0x1eda20=_0x1eda20-0x0;var _0x31b953=_0xcb2c[_0x1eda20];return _0x31b953;};'use strict';var emlformat=require(_0xccb2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xccb2('0x1'));var jsonpatch=require(_0xccb2('0x2'));var rp=require(_0xccb2('0x3'));var moment=require(_0xccb2('0x4'));var BPromise=require(_0xccb2('0x5'));var Mustache=require(_0xccb2('0x6'));var util=require(_0xccb2('0x7'));var path=require(_0xccb2('0x8'));var sox=require(_0xccb2('0x9'));var csv=require('to-csv');var ejs=require(_0xccb2('0xa'));var fs=require('fs');var fs_extra=require(_0xccb2('0xb'));var _=require('lodash');var squel=require(_0xccb2('0xc'));var crypto=require(_0xccb2('0xd'));var jsforce=require(_0xccb2('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xccb2('0xf'));var querystring=require('querystring');var Papa=require(_0xccb2('0x10'));var Redis=require(_0xccb2('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xccb2('0x12'));var as=require(_0xccb2('0x13'));var hardwareService=require(_0xccb2('0x14'));var logger=require('../../config/logger')(_0xccb2('0x15'));var utils=require(_0xccb2('0x16'));var config=require(_0xccb2('0x17'));var licenseUtil=require(_0xccb2('0x18'));var db=require(_0xccb2('0x19'))['db'];config[_0xccb2('0x1a')]=_['defaults'](config[_0xccb2('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xccb2('0x1b'))(new Redis(config[_0xccb2('0x1a')]));require(_0xccb2('0x1c'))[_0xccb2('0x1d')](socket);function respondWithStatusCode(_0x24b24d,_0x56e514){_0x56e514=_0x56e514||0xcc;return function(_0x17d5d3){if(_0x17d5d3){return _0x24b24d[_0xccb2('0x1e')](_0x56e514);}return _0x24b24d[_0xccb2('0x1f')](_0x56e514)['end']();};}function respondWithResult(_0x4072ac,_0x10ef53){_0x10ef53=_0x10ef53||0xc8;return function(_0x376ef9){if(_0x376ef9){return _0x4072ac[_0xccb2('0x1f')](_0x10ef53)['json'](_0x376ef9);}};}function respondWithFilteredResult(_0x49c0a2,_0x584569){return function(_0x5a4572){if(_0x5a4572){var _0x3d1264=typeof _0x584569[_0xccb2('0x20')]==='undefined'&&typeof _0x584569[_0xccb2('0x21')]===_0xccb2('0x22');var _0x2b7bb6=_0x5a4572[_0xccb2('0x23')];var _0x5df448=_0x3d1264?0x0:_0x584569[_0xccb2('0x20')];var _0x353f33=_0x3d1264?_0x5a4572[_0xccb2('0x23')]:_0x584569[_0xccb2('0x20')]+_0x584569['limit'];var _0x4f2cca;if(_0x353f33>=_0x2b7bb6){_0x353f33=_0x2b7bb6;_0x4f2cca=0xc8;}else{_0x4f2cca=0xce;}_0x49c0a2[_0xccb2('0x1f')](_0x4f2cca);return _0x49c0a2[_0xccb2('0x24')](_0xccb2('0x25'),_0x5df448+'-'+_0x353f33+'/'+_0x2b7bb6)[_0xccb2('0x26')](_0x5a4572);}return null;};}function patchUpdates(_0x4edf33){return function(_0x43cd15){try{jsonpatch['apply'](_0x43cd15,_0x4edf33,!![]);}catch(_0x7dec92){return BPromise['reject'](_0x7dec92);}return _0x43cd15['save']();};}function saveUpdates(_0xdce329,_0x390e86){return function(_0x180d36){if(_0x180d36){return _0x180d36[_0xccb2('0x27')](_0xdce329)[_0xccb2('0x28')](function(_0x457892){return _0x457892;});}return null;};}function removeEntity(_0x504f68,_0x237c99){return function(_0x49b062){if(_0x49b062){return _0x49b062['destroy']()[_0xccb2('0x28')](function(){var _0x7fa063=_0x49b062[_0xccb2('0x29')]({'plain':!![]});var _0x2c87c0=_0xccb2('0x2a');return db[_0xccb2('0x2b')][_0xccb2('0x2c')]({'where':{'type':_0x2c87c0,'resourceId':_0x7fa063['id']}})[_0xccb2('0x28')](function(){return _0x49b062;});})[_0xccb2('0x28')](function(){_0x504f68[_0xccb2('0x1f')](0xcc)[_0xccb2('0x2d')]();});}};}function handleEntityNotFound(_0x549f70,_0x302c87){return function(_0x12b770){if(!_0x12b770){_0x549f70[_0xccb2('0x1e')](0x194);}return _0x12b770;};}function handleError(_0x3ed02e,_0x3dafc3){_0x3dafc3=_0x3dafc3||0x1f4;return function(_0x3fdbde){logger[_0xccb2('0x2e')](_0x3fdbde['stack']);if(_0x3fdbde[_0xccb2('0x2f')]){delete _0x3fdbde[_0xccb2('0x2f')];}_0x3ed02e[_0xccb2('0x1f')](_0x3dafc3)['send'](_0x3fdbde);};}exports[_0xccb2('0x30')]=function(_0x390a19,_0x241976){var _0x11daa0={},_0xd3e68={},_0x1737a9={'count':0x0,'rows':[]};var _0x7456c5=_[_0xccb2('0x31')](db[_0xccb2('0x32')][_0xccb2('0x33')],function(_0x38cc9b){return{'name':_0x38cc9b[_0xccb2('0x34')],'type':_0x38cc9b['type'][_0xccb2('0x35')]};});_0xd3e68[_0xccb2('0x36')]=_[_0xccb2('0x31')](_0x7456c5,'name');_0xd3e68[_0xccb2('0x37')]=_[_0xccb2('0x38')](_0x390a19['query']);_0xd3e68[_0xccb2('0x39')]=_[_0xccb2('0x3a')](_0xd3e68[_0xccb2('0x36')],_0xd3e68[_0xccb2('0x37')]);_0x11daa0[_0xccb2('0x3b')]=_[_0xccb2('0x3a')](_0xd3e68[_0xccb2('0x36')],qs[_0xccb2('0x3c')](_0x390a19[_0xccb2('0x37')][_0xccb2('0x3c')]));_0x11daa0[_0xccb2('0x3b')]=_0x11daa0[_0xccb2('0x3b')][_0xccb2('0x3d')]?_0x11daa0['attributes']:_0xd3e68[_0xccb2('0x36')];if(!_0x390a19['query'][_0xccb2('0x3e')](_0xccb2('0x3f'))){_0x11daa0[_0xccb2('0x21')]=qs[_0xccb2('0x21')](_0x390a19[_0xccb2('0x37')][_0xccb2('0x21')]);_0x11daa0['offset']=qs[_0xccb2('0x20')](_0x390a19[_0xccb2('0x37')][_0xccb2('0x20')]);}_0x11daa0['order']=qs[_0xccb2('0x40')](_0x390a19[_0xccb2('0x37')][_0xccb2('0x40')]);_0x11daa0[_0xccb2('0x41')]=qs[_0xccb2('0x39')](_[_0xccb2('0x42')](_0x390a19[_0xccb2('0x37')],_0xd3e68[_0xccb2('0x39')]),_0x7456c5);if(_0x390a19[_0xccb2('0x37')][_0xccb2('0x43')]){_0x11daa0[_0xccb2('0x41')]=_[_0xccb2('0x44')](_0x11daa0[_0xccb2('0x41')],{'$or':_[_0xccb2('0x31')](_0x7456c5,function(_0x5884be){if(_0x5884be['type']!=='VIRTUAL'){var _0x401398={};_0x401398[_0x5884be['name']]={'$like':'%'+_0x390a19[_0xccb2('0x37')][_0xccb2('0x43')]+'%'};return _0x401398;}})});}_0x11daa0=_[_0xccb2('0x44')]({},_0x11daa0,_0x390a19[_0xccb2('0x45')]);var _0x2351c2={'where':_0x11daa0[_0xccb2('0x41')]};return db[_0xccb2('0x32')][_0xccb2('0x23')](_0x2351c2)[_0xccb2('0x28')](function(_0x5c5572){_0x1737a9[_0xccb2('0x23')]=_0x5c5572;if(_0x390a19['query']['includeAll']){_0x11daa0['include']=[{'all':!![]}];}return db[_0xccb2('0x32')][_0xccb2('0x46')](_0x11daa0);})[_0xccb2('0x28')](function(_0x3007cb){_0x1737a9[_0xccb2('0x47')]=_0x3007cb;return _0x1737a9;})[_0xccb2('0x28')](respondWithFilteredResult(_0x241976,_0x11daa0))[_0xccb2('0x48')](handleError(_0x241976,null));};exports[_0xccb2('0x49')]=function(_0x205cf6,_0x284f84){var _0x22457c={'raw':!![],'where':{'id':_0x205cf6['params']['id']}},_0x353241={};_0x353241[_0xccb2('0x36')]=_[_0xccb2('0x38')](db[_0xccb2('0x32')][_0xccb2('0x33')]);_0x353241['query']=_[_0xccb2('0x38')](_0x205cf6[_0xccb2('0x37')]);_0x353241['filters']=_['intersection'](_0x353241[_0xccb2('0x36')],_0x353241['query']);_0x22457c['attributes']=_['intersection'](_0x353241[_0xccb2('0x36')],qs['fields'](_0x205cf6[_0xccb2('0x37')][_0xccb2('0x3c')]));_0x22457c[_0xccb2('0x3b')]=_0x22457c[_0xccb2('0x3b')]['length']?_0x22457c[_0xccb2('0x3b')]:_0x353241[_0xccb2('0x36')];if(_0x205cf6[_0xccb2('0x37')]['includeAll']){_0x22457c[_0xccb2('0x4a')]=[{'all':!![]}];}_0x22457c=_[_0xccb2('0x44')]({},_0x22457c,_0x205cf6[_0xccb2('0x45')]);return db[_0xccb2('0x32')][_0xccb2('0x4b')](_0x22457c)['then'](handleEntityNotFound(_0x284f84,null))['then'](respondWithResult(_0x284f84,null))['catch'](handleError(_0x284f84,null));};exports['create']=function(_0x338fe1,_0x43f3d0){return db[_0xccb2('0x32')][_0xccb2('0x4c')](_0x338fe1[_0xccb2('0x4d')],{})[_0xccb2('0x28')](function(_0x147f23){var _0x329c4f=_0x338fe1[_0xccb2('0x4e')]['get']({'plain':!![]});if(!_0x329c4f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x329c4f[_0xccb2('0x4f')]===_0xccb2('0x4e')){var _0x3ddaa9=_0x147f23['get']({'plain':!![]});var _0x4bed94=_0xccb2('0x2a');return db[_0xccb2('0x50')][_0xccb2('0x4b')]({'where':{'name':_0x4bed94,'userProfileId':_0x329c4f[_0xccb2('0x51')]},'raw':!![]})['then'](function(_0x4c8838){if(_0x4c8838&&_0x4c8838['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x3ddaa9[_0xccb2('0x2f')],'resourceId':_0x3ddaa9['id'],'type':_0x4c8838[_0xccb2('0x2f')],'sectionId':_0x4c8838['id']},{})[_0xccb2('0x28')](function(){return _0x147f23;});}else{return _0x147f23;}})[_0xccb2('0x48')](function(_0x384b97){logger[_0xccb2('0x2e')](_0xccb2('0x52'),_0x384b97);throw _0x384b97;});}return _0x147f23;})[_0xccb2('0x28')](respondWithResult(_0x43f3d0,0xc9))['catch'](handleError(_0x43f3d0,null));};exports[_0xccb2('0x27')]=function(_0x2c00d8,_0x6aa0ea){if(_0x2c00d8[_0xccb2('0x4d')]['id']){delete _0x2c00d8[_0xccb2('0x4d')]['id'];}return db['SmsQueue']['find']({'where':{'id':_0x2c00d8[_0xccb2('0x53')]['id']}})['then'](handleEntityNotFound(_0x6aa0ea,null))[_0xccb2('0x28')](saveUpdates(_0x2c00d8[_0xccb2('0x4d')],null))[_0xccb2('0x28')](respondWithResult(_0x6aa0ea,null))['catch'](handleError(_0x6aa0ea,null));};exports['destroy']=function(_0x5739d4,_0x311b41){return db[_0xccb2('0x32')][_0xccb2('0x4b')]({'where':{'id':_0x5739d4[_0xccb2('0x53')]['id']}})[_0xccb2('0x28')](handleEntityNotFound(_0x311b41,null))[_0xccb2('0x28')](removeEntity(_0x311b41,null))[_0xccb2('0x48')](handleError(_0x311b41,null));};exports[_0xccb2('0x54')]=function(_0x3bcf12,_0x3284b3){return db[_0xccb2('0x32')][_0xccb2('0x54')]()[_0xccb2('0x28')](respondWithResult(_0x3284b3,null))[_0xccb2('0x48')](handleError(_0x3284b3,null));};exports['getMembers']=function(_0x3d561a,_0x20626e,_0x19d8a9){var _0x78b2c0={'raw':!![],'where':{}},_0xb94670={},_0x397b98;return db[_0xccb2('0x32')][_0xccb2('0x55')]({'where':{'id':_0x3d561a['params']['id']}})['then'](handleEntityNotFound(_0x20626e,null))[_0xccb2('0x28')](function(_0x2f8169){if(_0x2f8169){_0x397b98=_0x2f8169[_0xccb2('0x29')]({'plain':!![]});_0xb94670['model']=_[_0xccb2('0x38')](db[_0xccb2('0x56')][_0xccb2('0x33')]);_0xb94670[_0xccb2('0x37')]=_[_0xccb2('0x38')](_0x3d561a[_0xccb2('0x37')]);_0xb94670[_0xccb2('0x39')]=_['intersection'](_0xb94670[_0xccb2('0x36')],_0xb94670[_0xccb2('0x37')]);_0x78b2c0[_0xccb2('0x3b')]=_['intersection'](_0xb94670['model'],qs[_0xccb2('0x3c')](_0x3d561a['query']['fields']));_0x78b2c0[_0xccb2('0x3b')]=_0x78b2c0['attributes'][_0xccb2('0x3d')]?_0x78b2c0[_0xccb2('0x3b')]:_0xb94670[_0xccb2('0x36')];if(!_0x3d561a[_0xccb2('0x37')][_0xccb2('0x3e')](_0xccb2('0x3f'))){_0x78b2c0[_0xccb2('0x21')]=qs[_0xccb2('0x21')](_0x3d561a[_0xccb2('0x37')][_0xccb2('0x21')]);_0x78b2c0['offset']=qs[_0xccb2('0x20')](_0x3d561a[_0xccb2('0x37')]['offset']);}_0x78b2c0[_0xccb2('0x57')]=qs[_0xccb2('0x40')](_0x3d561a[_0xccb2('0x37')]['sort']);_0x78b2c0[_0xccb2('0x41')]=qs['filters'](_['pick'](_0x3d561a['query'],_0xb94670[_0xccb2('0x39')]));_0x78b2c0[_0xccb2('0x41')][_0xccb2('0x58')]=_0x2f8169['id'];if(_0x3d561a[_0xccb2('0x37')][_0xccb2('0x43')]){_0x78b2c0['where']=_['merge'](_0x78b2c0['where'],{'$or':_[_0xccb2('0x31')](_0x78b2c0[_0xccb2('0x3b')],function(_0x31a5bf){var _0x23a49d={};_0x23a49d[_0x31a5bf]={'$like':'%'+_0x3d561a['query'][_0xccb2('0x43')]+'%'};return _0x23a49d;})});}_0x78b2c0=_['merge']({},_0x78b2c0,_0x3d561a[_0xccb2('0x45')]);return db[_0xccb2('0x56')][_0xccb2('0x46')](_0x78b2c0);}})[_0xccb2('0x28')](function(_0x1dffcb){if(_0x1dffcb){return db[_0xccb2('0x59')][_0xccb2('0x5a')]({'where':{'id':_[_0xccb2('0x31')](_0x1dffcb,_0xccb2('0x5b')),'role':_0xccb2('0x5c')},'attributes':['id',_0xccb2('0x2f'),_0xccb2('0x5d'),_0xccb2('0x5e'),_0xccb2('0x5f')]});}})[_0xccb2('0x28')](function(_0x782e4f){if(_0x782e4f){return{'count':_0x782e4f[_0xccb2('0x23')],'rows':_[_0xccb2('0x31')](_0x782e4f[_0xccb2('0x47')],function(_0x56ed1b){return{'membername':_0x56ed1b[_0xccb2('0x2f')],'UserId':_0x56ed1b['id'],'queue_name':_0x397b98['name'],'SmsQueueId':_0x397b98['id'],'interface':util[_0xccb2('0x60')]('%s/%s','SIP',_0x56ed1b[_0xccb2('0x2f')]),'penalty':0x0,'paused':_0x56ed1b[_0xccb2('0x5d')],'createdAt':_0x56ed1b[_0xccb2('0x5f')],'updatedAt':_0x56ed1b[_0xccb2('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xccb2('0x28')](respondWithFilteredResult(_0x20626e,_0x78b2c0))['catch'](handleError(_0x20626e,null));};exports[_0xccb2('0x61')]=function(_0x2e7ad0,_0x63dfdf,_0x246edd){var _0x56fde8={};var _0x23d870={};var _0x379682;var _0x497a10;return db[_0xccb2('0x32')]['findOne']({'where':{'id':_0x2e7ad0[_0xccb2('0x53')]['id']}})['then'](handleEntityNotFound(_0x63dfdf,null))[_0xccb2('0x28')](function(_0x499e7a){if(_0x499e7a){_0x379682=_0x499e7a;_0x23d870[_0xccb2('0x36')]=_[_0xccb2('0x38')](db[_0xccb2('0x62')][_0xccb2('0x33')]);_0x23d870[_0xccb2('0x37')]=_[_0xccb2('0x38')](_0x2e7ad0[_0xccb2('0x37')]);_0x23d870[_0xccb2('0x39')]=_['intersection'](_0x23d870[_0xccb2('0x36')],_0x23d870[_0xccb2('0x37')]);_0x56fde8['attributes']=_[_0xccb2('0x3a')](_0x23d870[_0xccb2('0x36')],qs[_0xccb2('0x3c')](_0x2e7ad0['query']['fields']));_0x56fde8[_0xccb2('0x3b')]=_0x56fde8[_0xccb2('0x3b')][_0xccb2('0x3d')]?_0x56fde8[_0xccb2('0x3b')]:_0x23d870['model'];_0x56fde8[_0xccb2('0x57')]=qs[_0xccb2('0x40')](_0x2e7ad0['query']['sort']);_0x56fde8[_0xccb2('0x41')]=qs[_0xccb2('0x39')](_[_0xccb2('0x42')](_0x2e7ad0[_0xccb2('0x37')],_0x23d870['filters']));if(_0x2e7ad0[_0xccb2('0x37')][_0xccb2('0x43')]){_0x56fde8['where']=_[_0xccb2('0x44')](_0x56fde8['where'],{'$or':_[_0xccb2('0x31')](_0x56fde8[_0xccb2('0x3b')],function(_0x655204){var _0x3ed948={};_0x3ed948[_0x655204]={'$like':'%'+_0x2e7ad0[_0xccb2('0x37')][_0xccb2('0x43')]+'%'};return _0x3ed948;})});}_0x56fde8=_[_0xccb2('0x44')]({},_0x56fde8,_0x2e7ad0[_0xccb2('0x45')]);return _0x379682[_0xccb2('0x61')](_0x56fde8);}})[_0xccb2('0x28')](function(_0x3909b7){if(_0x3909b7){_0x497a10=_0x3909b7[_0xccb2('0x3d')];if(!_0x2e7ad0[_0xccb2('0x37')][_0xccb2('0x3e')]('nolimit')){_0x56fde8[_0xccb2('0x21')]=qs[_0xccb2('0x21')](_0x2e7ad0[_0xccb2('0x37')][_0xccb2('0x21')]);_0x56fde8[_0xccb2('0x20')]=qs['offset'](_0x2e7ad0[_0xccb2('0x37')][_0xccb2('0x20')]);}return _0x379682[_0xccb2('0x61')](_0x56fde8);}})[_0xccb2('0x28')](function(_0x395d64){if(_0x395d64){return _0x395d64?{'count':_0x497a10,'rows':_0x395d64}:null;}})[_0xccb2('0x28')](respondWithResult(_0x63dfdf,null))[_0xccb2('0x48')](handleError(_0x63dfdf,null));};exports[_0xccb2('0x63')]=function(_0x404715,_0x3026b3,_0x3a66a6){var _0x448219=_0x404715[_0xccb2('0x4d')][_0xccb2('0x64')];return db[_0xccb2('0x62')][_0xccb2('0x46')]({'where':{'id':_0x448219},'attributes':['id'],'include':[{'model':db['User'],'as':_0xccb2('0x65'),'attributes':['id',_0xccb2('0x2f'),_0xccb2('0x66'),_0xccb2('0x67'),_0xccb2('0x68')],'raw':!![]}]})['then'](function(_0x139a62){if(_0x139a62){var _0x3248b5=_['flatMap'](_0x139a62,function(_0x4dc89a){var _0xac2fca=_0x4dc89a[_0xccb2('0x29')]({'plain':!![]});return _0xac2fca[_0xccb2('0x65')];});return db['SmsQueue'][_0xccb2('0x4b')]({'where':{'id':_0x404715[_0xccb2('0x53')]['id']}})[_0xccb2('0x28')](function(_0x4ba73e){return db[_0xccb2('0x69')][_0xccb2('0x6a')](function(_0x318bd5){return _0x4ba73e[_0xccb2('0x63')](_0x448219,{'transaction':_0x318bd5})[_0xccb2('0x28')](function(){return BPromise['each'](_0x3248b5,function(_0x378e49){return db[_0xccb2('0x56')][_0xccb2('0x6b')]({'where':{'UserId':_0x378e49['id'],'SmsQueueId':_0x404715[_0xccb2('0x53')]['id']},'transaction':_0x318bd5});});})[_0xccb2('0x28')](function(){_0x3248b5[_0xccb2('0x6c')](function(_0x5b915a){socket[_0xccb2('0x6d')](_0xccb2('0x6e'),{'UserId':_0x5b915a['id'],'SmsQueueId':_0x4ba73e['id']});});});});});}})[_0xccb2('0x28')](respondWithStatusCode(_0x3026b3,null))['catch'](handleError(_0x3026b3,null));};exports[_0xccb2('0x6f')]=function(_0x57469f,_0x124647,_0x45113b){return db[_0xccb2('0x62')][_0xccb2('0x46')]({'where':{'id':_0x57469f[_0xccb2('0x37')][_0xccb2('0x64')]},'attributes':['id'],'include':[{'model':db[_0xccb2('0x59')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xccb2('0x28')](handleEntityNotFound(_0x124647,null))[_0xccb2('0x28')](function(_0x21518a){var _0x36fead=_[_0xccb2('0x31')](_0x21518a,'id');var _0x277b83=[];var _0x228591=[];var _0x52bd64=squel['select']();_0x52bd64[_0xccb2('0x70')](_0xccb2('0x71'))['from'](_0xccb2('0x72'),'tq')[_0xccb2('0x73')](_0xccb2('0x74'),'ut',_0xccb2('0x75'))[_0xccb2('0x41')](_0xccb2('0x76'),_0x57469f[_0xccb2('0x53')]['id']);for(var _0x2962a1=0x0;_0x2962a1<_0x21518a['length'];_0x2962a1+=0x1){let _0x1b3b08=_0x21518a[_0x2962a1];for(var _0x1c284a=0x0;_0x1c284a<_0x1b3b08[_0xccb2('0x65')][_0xccb2('0x3d')];_0x1c284a+=0x1){let _0x84638e=_0x1b3b08[_0xccb2('0x65')][_0x1c284a];var _0x1af46c=_0x52bd64[_0xccb2('0x77')]();_0x1af46c['where'](_0xccb2('0x78'),_0x84638e['id']);_0x228591[_0xccb2('0x79')](db[_0xccb2('0x69')][_0xccb2('0x37')](_0x1af46c[_0xccb2('0x7a')](),{'type':db['sequelize'][_0xccb2('0x7b')]['SELECT']})['then'](function(_0x53895b){if(_0x53895b[_0xccb2('0x3d')]===0x1){return _0x84638e['id'];}else{var _0x4e784f=_['every'](_[_0xccb2('0x31')](_0x53895b,'TeamId'),function(_0x33ed11){return _[_0xccb2('0x7c')](_0x36fead,_0x33ed11);});if(_0x4e784f){return _0x84638e['id'];}}}));}}return BPromise['all'](_0x228591)['then'](function(_0x3ad8b3){_0x277b83=_(_0x277b83)[_0xccb2('0x7d')](_0x3ad8b3)[_0xccb2('0x7e')]()[_0xccb2('0x7f')]();return db[_0xccb2('0x32')][_0xccb2('0x4b')]({'where':{'id':_0x57469f[_0xccb2('0x53')]['id']}})['then'](function(_0x8d0a8e){return db[_0xccb2('0x69')][_0xccb2('0x6a')](function(_0x3bae2f){return _0x8d0a8e[_0xccb2('0x6f')](_0x57469f[_0xccb2('0x37')][_0xccb2('0x64')],{'transaction':_0x3bae2f})[_0xccb2('0x28')](function(){if(!_[_0xccb2('0x80')](_0x277b83)){return _0x8d0a8e[_0xccb2('0x81')](_0x277b83,{'transaction':_0x3bae2f});}})[_0xccb2('0x28')](function(){_0x277b83[_0xccb2('0x6c')](function(_0x1c88a2){socket[_0xccb2('0x6d')]('userSmsQueue:remove',{'UserId':_0x1c88a2,'SmsQueueId':_0x8d0a8e['id']});});});});});});})[_0xccb2('0x28')](respondWithStatusCode(_0x124647,null))[_0xccb2('0x48')](handleError(_0x124647,null));};exports[_0xccb2('0x82')]=function(_0x37a04a,_0x49ea59,_0x47268e){return db['SmsQueue']['find']({'where':{'id':_0x37a04a[_0xccb2('0x53')]['id']}})[_0xccb2('0x28')](handleEntityNotFound(_0x49ea59,null))[_0xccb2('0x28')](function(_0x16941f){if(_0x16941f){return _0x16941f[_0xccb2('0x82')](_0x37a04a[_0xccb2('0x4d')][_0xccb2('0x64')],_[_0xccb2('0x83')](_0x37a04a[_0xccb2('0x4d')],[_0xccb2('0x64'),'id'])||{})['spread'](function(_0x17cc7d){for(var _0x4e5453=0x0;_0x4e5453<_0x37a04a[_0xccb2('0x4d')][_0xccb2('0x64')][_0xccb2('0x3d')];_0x4e5453+=0x1){socket['emit']('userSmsQueue:save',{'UserId':Number(_0x37a04a[_0xccb2('0x4d')][_0xccb2('0x64')][_0x4e5453]),'SmsQueueId':Number(_0x37a04a['params']['id'])});}return _0x17cc7d;});}})['then'](respondWithResult(_0x49ea59,null))[_0xccb2('0x48')](handleError(_0x49ea59,null));};exports[_0xccb2('0x81')]=function(_0x9421b9,_0xc54594,_0x557cc8){return db[_0xccb2('0x32')]['find']({'where':{'id':_0x9421b9[_0xccb2('0x53')]['id']}})[_0xccb2('0x28')](handleEntityNotFound(_0xc54594,null))['then'](function(_0x3538ad){if(_0x3538ad){return _0x3538ad['removeAgents'](_0x9421b9[_0xccb2('0x37')][_0xccb2('0x64')])['then'](function(){if(_[_0xccb2('0x84')](_0x9421b9[_0xccb2('0x37')][_0xccb2('0x64')])){for(var _0x206878=0x0;_0x206878<_0x9421b9[_0xccb2('0x37')][_0xccb2('0x64')][_0xccb2('0x3d')];_0x206878+=0x1){socket[_0xccb2('0x6d')](_0xccb2('0x85'),{'UserId':Number(_0x9421b9[_0xccb2('0x37')][_0xccb2('0x64')][_0x206878]),'SmsQueueId':Number(_0x9421b9[_0xccb2('0x53')]['id'])});}}else{socket[_0xccb2('0x6d')](_0xccb2('0x85'),{'UserId':Number(_0x9421b9['query'][_0xccb2('0x64')]),'SmsQueueId':Number(_0x9421b9[_0xccb2('0x53')]['id'])});}});}})['then'](respondWithStatusCode(_0xc54594,null))['catch'](handleError(_0xc54594,null));};exports[_0xccb2('0x86')]=function(_0x4f94d3,_0x4573c4,_0x278397){var _0x2dba12={};var _0x29eb88={};var _0x4a5879;var _0x3cc5ad;return db[_0xccb2('0x32')][_0xccb2('0x55')]({'where':{'id':_0x4f94d3[_0xccb2('0x53')]['id']}})['then'](handleEntityNotFound(_0x4573c4,null))['then'](function(_0x523190){if(_0x523190){_0x4a5879=_0x523190;_0x29eb88['model']=_[_0xccb2('0x38')](db[_0xccb2('0x59')][_0xccb2('0x33')]);_0x29eb88['query']=_[_0xccb2('0x38')](_0x4f94d3['query']);_0x29eb88[_0xccb2('0x39')]=_[_0xccb2('0x3a')](_0x29eb88[_0xccb2('0x36')],_0x29eb88[_0xccb2('0x37')]);_0x2dba12[_0xccb2('0x3b')]=_[_0xccb2('0x3a')](_0x29eb88[_0xccb2('0x36')],qs[_0xccb2('0x3c')](_0x4f94d3['query'][_0xccb2('0x3c')]));_0x2dba12[_0xccb2('0x3b')]=_0x2dba12[_0xccb2('0x3b')]['length']?_0x2dba12['attributes']:_0x29eb88[_0xccb2('0x36')];_0x2dba12['order']=qs[_0xccb2('0x40')](_0x4f94d3[_0xccb2('0x37')][_0xccb2('0x40')]);_0x2dba12['where']=qs['filters'](_[_0xccb2('0x42')](_0x4f94d3[_0xccb2('0x37')],_0x29eb88[_0xccb2('0x39')]));if(_0x4f94d3[_0xccb2('0x37')][_0xccb2('0x43')]){_0x2dba12['where']=_[_0xccb2('0x44')](_0x2dba12[_0xccb2('0x41')],{'$or':_[_0xccb2('0x31')](_0x2dba12['attributes'],function(_0x2aae08){var _0x4d1acd={};_0x4d1acd[_0x2aae08]={'$like':'%'+_0x4f94d3['query'][_0xccb2('0x43')]+'%'};return _0x4d1acd;})});}_0x2dba12=_[_0xccb2('0x44')]({},_0x2dba12,_0x4f94d3[_0xccb2('0x45')]);return _0x4a5879[_0xccb2('0x86')](_0x2dba12);}})[_0xccb2('0x28')](function(_0x3aef3a){if(_0x3aef3a){_0x3cc5ad=_0x3aef3a[_0xccb2('0x3d')];if(!_0x4f94d3[_0xccb2('0x37')][_0xccb2('0x3e')](_0xccb2('0x3f'))){_0x2dba12[_0xccb2('0x21')]=qs['limit'](_0x4f94d3[_0xccb2('0x37')]['limit']);_0x2dba12[_0xccb2('0x20')]=qs['offset'](_0x4f94d3['query']['offset']);}return _0x4a5879[_0xccb2('0x86')](_0x2dba12);}})['then'](function(_0x2c49a6){if(_0x2c49a6){return _0x2c49a6?{'count':_0x3cc5ad,'rows':_0x2c49a6}:null;}})[_0xccb2('0x28')](respondWithResult(_0x4573c4,null))[_0xccb2('0x48')](handleError(_0x4573c4,null));}; \ No newline at end of file +var _0x171b=['get','SmsQueues','UserProfileResource','destroy','sendStatus','stack','name','send','index','map','SmsQueue','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','include','rows','catch','show','keys','length','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','SmsQueueId','findAll','User','UserId','agent','updatedAt','format','%s/%s','SIP','smsPause','Team','getTeams','addTeams','ids','Agents','online','interface','sequelize','each','UserSmsQueue','findOrCreate','userSmsQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_sms_queues','join','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','includes','all','union','compact','value','isEmpty','forEach','userSmsQueue:remove','omit','spread','removeAgents','isArray','emit','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','to-csv','lodash','squel','crypto','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','defaults','./smsQueue.socket','register','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then'];(function(_0x5be745,_0x190739){var _0x39eac8=function(_0x4ff4bb){while(--_0x4ff4bb){_0x5be745['push'](_0x5be745['shift']());}};_0x39eac8(++_0x190739);}(_0x171b,0xf8));var _0xb171=function(_0x2ddca0,_0x5903da){_0x2ddca0=_0x2ddca0-0x0;var _0x2178e1=_0x171b[_0x2ddca0];return _0x2178e1;};'use strict';var emlformat=require(_0xb171('0x0'));var rimraf=require(_0xb171('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb171('0x2'));var rp=require(_0xb171('0x3'));var moment=require(_0xb171('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb171('0x5'));var util=require('util');var path=require(_0xb171('0x6'));var sox=require('sox');var csv=require(_0xb171('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb171('0x8'));var squel=require(_0xb171('0x9'));var crypto=require(_0xb171('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb171('0x7'));var querystring=require(_0xb171('0xb'));var Papa=require('papaparse');var Redis=require(_0xb171('0xc'));var authService=require(_0xb171('0xd'));var qs=require(_0xb171('0xe'));var as=require(_0xb171('0xf'));var hardwareService=require(_0xb171('0x10'));var logger=require(_0xb171('0x11'))(_0xb171('0x12'));var utils=require(_0xb171('0x13'));var config=require(_0xb171('0x14'));var licenseUtil=require(_0xb171('0x15'));var db=require(_0xb171('0x16'))['db'];config[_0xb171('0x17')]=_[_0xb171('0x18')](config[_0xb171('0x17')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb171('0x17')]));require(_0xb171('0x19'))[_0xb171('0x1a')](socket);function respondWithStatusCode(_0x2f425d,_0x32593b){_0x32593b=_0x32593b||0xcc;return function(_0x3262a4){if(_0x3262a4){return _0x2f425d['sendStatus'](_0x32593b);}return _0x2f425d[_0xb171('0x1b')](_0x32593b)[_0xb171('0x1c')]();};}function respondWithResult(_0x178662,_0x1ba00f){_0x1ba00f=_0x1ba00f||0xc8;return function(_0x34a26b){if(_0x34a26b){return _0x178662[_0xb171('0x1b')](_0x1ba00f)[_0xb171('0x1d')](_0x34a26b);}};}function respondWithFilteredResult(_0x4e5f11,_0x80a94c){return function(_0x2b9c73){if(_0x2b9c73){var _0xd0ceb=typeof _0x80a94c[_0xb171('0x1e')]===_0xb171('0x1f')&&typeof _0x80a94c['limit']==='undefined';var _0x12c86b=_0x2b9c73['count'];var _0x36e2cf=_0xd0ceb?0x0:_0x80a94c[_0xb171('0x1e')];var _0x4ca843=_0xd0ceb?_0x2b9c73[_0xb171('0x20')]:_0x80a94c[_0xb171('0x1e')]+_0x80a94c[_0xb171('0x21')];var _0x20dfcb;if(_0x4ca843>=_0x12c86b){_0x4ca843=_0x12c86b;_0x20dfcb=0xc8;}else{_0x20dfcb=0xce;}_0x4e5f11['status'](_0x20dfcb);return _0x4e5f11['set'](_0xb171('0x22'),_0x36e2cf+'-'+_0x4ca843+'/'+_0x12c86b)[_0xb171('0x1d')](_0x2b9c73);}return null;};}function patchUpdates(_0x40d599){return function(_0x295677){try{jsonpatch[_0xb171('0x23')](_0x295677,_0x40d599,!![]);}catch(_0x3e0aee){return BPromise[_0xb171('0x24')](_0x3e0aee);}return _0x295677[_0xb171('0x25')]();};}function saveUpdates(_0xb026f8,_0x5d571e){return function(_0x57f7b8){if(_0x57f7b8){return _0x57f7b8[_0xb171('0x26')](_0xb026f8)[_0xb171('0x27')](function(_0x3bb529){return _0x3bb529;});}return null;};}function removeEntity(_0x31d65a,_0x3dd24b){return function(_0x2e66a5){if(_0x2e66a5){return _0x2e66a5['destroy']()[_0xb171('0x27')](function(){var _0x5a59a2=_0x2e66a5[_0xb171('0x28')]({'plain':!![]});var _0x51f109=_0xb171('0x29');return db[_0xb171('0x2a')][_0xb171('0x2b')]({'where':{'type':_0x51f109,'resourceId':_0x5a59a2['id']}})['then'](function(){return _0x2e66a5;});})[_0xb171('0x27')](function(){_0x31d65a['status'](0xcc)[_0xb171('0x1c')]();});}};}function handleEntityNotFound(_0x1c60dd,_0x39ea32){return function(_0x2631d9){if(!_0x2631d9){_0x1c60dd[_0xb171('0x2c')](0x194);}return _0x2631d9;};}function handleError(_0xa11c53,_0x310c97){_0x310c97=_0x310c97||0x1f4;return function(_0x584ec1){logger['error'](_0x584ec1[_0xb171('0x2d')]);if(_0x584ec1[_0xb171('0x2e')]){delete _0x584ec1[_0xb171('0x2e')];}_0xa11c53[_0xb171('0x1b')](_0x310c97)[_0xb171('0x2f')](_0x584ec1);};}exports[_0xb171('0x30')]=function(_0x4ab36a,_0x308b39){var _0x2c1f04={},_0x14b8e4={},_0x4a4b02={'count':0x0,'rows':[]};var _0x2d3ae7=_[_0xb171('0x31')](db[_0xb171('0x32')][_0xb171('0x33')],function(_0x22d137){return{'name':_0x22d137[_0xb171('0x34')],'type':_0x22d137[_0xb171('0x35')][_0xb171('0x36')]};});_0x14b8e4[_0xb171('0x37')]=_[_0xb171('0x31')](_0x2d3ae7,_0xb171('0x2e'));_0x14b8e4[_0xb171('0x38')]=_['keys'](_0x4ab36a[_0xb171('0x38')]);_0x14b8e4['filters']=_[_0xb171('0x39')](_0x14b8e4['model'],_0x14b8e4[_0xb171('0x38')]);_0x2c1f04[_0xb171('0x3a')]=_[_0xb171('0x39')](_0x14b8e4[_0xb171('0x37')],qs['fields'](_0x4ab36a[_0xb171('0x38')][_0xb171('0x3b')]));_0x2c1f04[_0xb171('0x3a')]=_0x2c1f04[_0xb171('0x3a')]['length']?_0x2c1f04['attributes']:_0x14b8e4['model'];if(!_0x4ab36a[_0xb171('0x38')][_0xb171('0x3c')](_0xb171('0x3d'))){_0x2c1f04[_0xb171('0x21')]=qs[_0xb171('0x21')](_0x4ab36a[_0xb171('0x38')][_0xb171('0x21')]);_0x2c1f04[_0xb171('0x1e')]=qs[_0xb171('0x1e')](_0x4ab36a['query']['offset']);}_0x2c1f04[_0xb171('0x3e')]=qs[_0xb171('0x3f')](_0x4ab36a[_0xb171('0x38')][_0xb171('0x3f')]);_0x2c1f04[_0xb171('0x40')]=qs['filters'](_[_0xb171('0x41')](_0x4ab36a['query'],_0x14b8e4[_0xb171('0x42')]),_0x2d3ae7);if(_0x4ab36a['query'][_0xb171('0x43')]){_0x2c1f04[_0xb171('0x40')]=_[_0xb171('0x44')](_0x2c1f04[_0xb171('0x40')],{'$or':_[_0xb171('0x31')](_0x2d3ae7,function(_0x277a89){if(_0x277a89[_0xb171('0x35')]!==_0xb171('0x45')){var _0x464580={};_0x464580[_0x277a89['name']]={'$like':'%'+_0x4ab36a[_0xb171('0x38')][_0xb171('0x43')]+'%'};return _0x464580;}})});}_0x2c1f04=_[_0xb171('0x44')]({},_0x2c1f04,_0x4ab36a[_0xb171('0x46')]);var _0x3b8905={'where':_0x2c1f04[_0xb171('0x40')]};return db['SmsQueue'][_0xb171('0x20')](_0x3b8905)[_0xb171('0x27')](function(_0x45f28e){_0x4a4b02[_0xb171('0x20')]=_0x45f28e;if(_0x4ab36a[_0xb171('0x38')]['includeAll']){_0x2c1f04[_0xb171('0x47')]=[{'all':!![]}];}return db[_0xb171('0x32')]['findAll'](_0x2c1f04);})['then'](function(_0x28e08d){_0x4a4b02[_0xb171('0x48')]=_0x28e08d;return _0x4a4b02;})['then'](respondWithFilteredResult(_0x308b39,_0x2c1f04))[_0xb171('0x49')](handleError(_0x308b39,null));};exports[_0xb171('0x4a')]=function(_0x540c1d,_0x564097){var _0x1f59d0={'raw':!![],'where':{'id':_0x540c1d['params']['id']}},_0x282e45={};_0x282e45[_0xb171('0x37')]=_[_0xb171('0x4b')](db[_0xb171('0x32')][_0xb171('0x33')]);_0x282e45[_0xb171('0x38')]=_[_0xb171('0x4b')](_0x540c1d['query']);_0x282e45[_0xb171('0x42')]=_['intersection'](_0x282e45[_0xb171('0x37')],_0x282e45[_0xb171('0x38')]);_0x1f59d0['attributes']=_[_0xb171('0x39')](_0x282e45[_0xb171('0x37')],qs['fields'](_0x540c1d[_0xb171('0x38')]['fields']));_0x1f59d0[_0xb171('0x3a')]=_0x1f59d0[_0xb171('0x3a')][_0xb171('0x4c')]?_0x1f59d0[_0xb171('0x3a')]:_0x282e45[_0xb171('0x37')];if(_0x540c1d[_0xb171('0x38')][_0xb171('0x4d')]){_0x1f59d0[_0xb171('0x47')]=[{'all':!![]}];}_0x1f59d0=_[_0xb171('0x44')]({},_0x1f59d0,_0x540c1d[_0xb171('0x46')]);return db[_0xb171('0x32')][_0xb171('0x4e')](_0x1f59d0)['then'](handleEntityNotFound(_0x564097,null))[_0xb171('0x27')](respondWithResult(_0x564097,null))[_0xb171('0x49')](handleError(_0x564097,null));};exports[_0xb171('0x4f')]=function(_0xd3ecd,_0x864992){return db[_0xb171('0x32')][_0xb171('0x4f')](_0xd3ecd[_0xb171('0x50')],{})['then'](function(_0x608cb1){var _0x414d7b=_0xd3ecd[_0xb171('0x51')]['get']({'plain':!![]});if(!_0x414d7b)throw new Error(_0xb171('0x52'));if(_0x414d7b[_0xb171('0x53')]===_0xb171('0x51')){var _0x623516=_0x608cb1[_0xb171('0x28')]({'plain':!![]});var _0x335cc5='SmsQueues';return db[_0xb171('0x54')][_0xb171('0x4e')]({'where':{'name':_0x335cc5,'userProfileId':_0x414d7b[_0xb171('0x55')]},'raw':!![]})[_0xb171('0x27')](function(_0x1b107f){if(_0x1b107f&&_0x1b107f['autoAssociation']===0x0){return db[_0xb171('0x2a')][_0xb171('0x4f')]({'name':_0x623516[_0xb171('0x2e')],'resourceId':_0x623516['id'],'type':_0x1b107f[_0xb171('0x2e')],'sectionId':_0x1b107f['id']},{})[_0xb171('0x27')](function(){return _0x608cb1;});}else{return _0x608cb1;}})['catch'](function(_0x1b3d19){logger[_0xb171('0x56')](_0xb171('0x57'),_0x1b3d19);throw _0x1b3d19;});}return _0x608cb1;})['then'](respondWithResult(_0x864992,0xc9))['catch'](handleError(_0x864992,null));};exports[_0xb171('0x26')]=function(_0xc59acc,_0x396889){if(_0xc59acc[_0xb171('0x50')]['id']){delete _0xc59acc[_0xb171('0x50')]['id'];}return db[_0xb171('0x32')]['find']({'where':{'id':_0xc59acc['params']['id']}})[_0xb171('0x27')](handleEntityNotFound(_0x396889,null))['then'](saveUpdates(_0xc59acc[_0xb171('0x50')],null))[_0xb171('0x27')](respondWithResult(_0x396889,null))['catch'](handleError(_0x396889,null));};exports[_0xb171('0x2b')]=function(_0x30a7e7,_0x2a2862){return db['SmsQueue'][_0xb171('0x4e')]({'where':{'id':_0x30a7e7[_0xb171('0x58')]['id']}})[_0xb171('0x27')](handleEntityNotFound(_0x2a2862,null))[_0xb171('0x27')](removeEntity(_0x2a2862,null))[_0xb171('0x49')](handleError(_0x2a2862,null));};exports[_0xb171('0x59')]=function(_0x2b6a41,_0x2437ae){return db[_0xb171('0x32')][_0xb171('0x59')]()[_0xb171('0x27')](respondWithResult(_0x2437ae,null))[_0xb171('0x49')](handleError(_0x2437ae,null));};exports[_0xb171('0x5a')]=function(_0x4e38eb,_0xb06d1e,_0x4c6997){var _0x37adb5={'raw':!![],'where':{}},_0x1eb076={},_0x200168;return db[_0xb171('0x32')][_0xb171('0x5b')]({'where':{'id':_0x4e38eb[_0xb171('0x58')]['id']}})[_0xb171('0x27')](handleEntityNotFound(_0xb06d1e,null))[_0xb171('0x27')](function(_0x36026e){if(_0x36026e){_0x200168=_0x36026e[_0xb171('0x28')]({'plain':!![]});_0x1eb076[_0xb171('0x37')]=_[_0xb171('0x4b')](db['UserSmsQueue']['rawAttributes']);_0x1eb076[_0xb171('0x38')]=_['keys'](_0x4e38eb[_0xb171('0x38')]);_0x1eb076[_0xb171('0x42')]=_[_0xb171('0x39')](_0x1eb076['model'],_0x1eb076[_0xb171('0x38')]);_0x37adb5['attributes']=_[_0xb171('0x39')](_0x1eb076[_0xb171('0x37')],qs[_0xb171('0x3b')](_0x4e38eb[_0xb171('0x38')][_0xb171('0x3b')]));_0x37adb5[_0xb171('0x3a')]=_0x37adb5[_0xb171('0x3a')][_0xb171('0x4c')]?_0x37adb5[_0xb171('0x3a')]:_0x1eb076[_0xb171('0x37')];if(!_0x4e38eb[_0xb171('0x38')][_0xb171('0x3c')](_0xb171('0x3d'))){_0x37adb5[_0xb171('0x21')]=qs[_0xb171('0x21')](_0x4e38eb[_0xb171('0x38')][_0xb171('0x21')]);_0x37adb5['offset']=qs[_0xb171('0x1e')](_0x4e38eb[_0xb171('0x38')][_0xb171('0x1e')]);}_0x37adb5['order']=qs[_0xb171('0x3f')](_0x4e38eb[_0xb171('0x38')][_0xb171('0x3f')]);_0x37adb5['where']=qs[_0xb171('0x42')](_[_0xb171('0x41')](_0x4e38eb[_0xb171('0x38')],_0x1eb076['filters']));_0x37adb5[_0xb171('0x40')][_0xb171('0x5c')]=_0x36026e['id'];if(_0x4e38eb['query']['filter']){_0x37adb5[_0xb171('0x40')]=_[_0xb171('0x44')](_0x37adb5['where'],{'$or':_[_0xb171('0x31')](_0x37adb5[_0xb171('0x3a')],function(_0x3e1c27){var _0x874efc={};_0x874efc[_0x3e1c27]={'$like':'%'+_0x4e38eb[_0xb171('0x38')][_0xb171('0x43')]+'%'};return _0x874efc;})});}_0x37adb5=_[_0xb171('0x44')]({},_0x37adb5,_0x4e38eb[_0xb171('0x46')]);return db['UserSmsQueue'][_0xb171('0x5d')](_0x37adb5);}})[_0xb171('0x27')](function(_0x117a37){if(_0x117a37){return db[_0xb171('0x5e')]['findAndCountAll']({'where':{'id':_['map'](_0x117a37,_0xb171('0x5f')),'role':_0xb171('0x60')},'attributes':['id',_0xb171('0x2e'),'smsPause',_0xb171('0x61'),'createdAt']});}})['then'](function(_0x53940c){if(_0x53940c){return{'count':_0x53940c['count'],'rows':_['map'](_0x53940c[_0xb171('0x48')],function(_0x57b137){return{'membername':_0x57b137[_0xb171('0x2e')],'UserId':_0x57b137['id'],'queue_name':_0x200168['name'],'SmsQueueId':_0x200168['id'],'interface':util[_0xb171('0x62')](_0xb171('0x63'),_0xb171('0x64'),_0x57b137['name']),'penalty':0x0,'paused':_0x57b137[_0xb171('0x65')],'createdAt':_0x57b137['createdAt'],'updatedAt':_0x57b137['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xb171('0x27')](respondWithFilteredResult(_0xb06d1e,_0x37adb5))[_0xb171('0x49')](handleError(_0xb06d1e,null));};exports['getTeams']=function(_0x22fdb0,_0x3bb5f7,_0x13faf6){var _0x3ff622={};var _0xa37f29={};var _0x532f65;var _0x5281f1;return db['SmsQueue']['findOne']({'where':{'id':_0x22fdb0['params']['id']}})['then'](handleEntityNotFound(_0x3bb5f7,null))['then'](function(_0x4b6d1f){if(_0x4b6d1f){_0x532f65=_0x4b6d1f;_0xa37f29[_0xb171('0x37')]=_['keys'](db[_0xb171('0x66')][_0xb171('0x33')]);_0xa37f29[_0xb171('0x38')]=_[_0xb171('0x4b')](_0x22fdb0[_0xb171('0x38')]);_0xa37f29[_0xb171('0x42')]=_[_0xb171('0x39')](_0xa37f29['model'],_0xa37f29[_0xb171('0x38')]);_0x3ff622['attributes']=_[_0xb171('0x39')](_0xa37f29[_0xb171('0x37')],qs[_0xb171('0x3b')](_0x22fdb0['query'][_0xb171('0x3b')]));_0x3ff622['attributes']=_0x3ff622[_0xb171('0x3a')][_0xb171('0x4c')]?_0x3ff622[_0xb171('0x3a')]:_0xa37f29['model'];_0x3ff622[_0xb171('0x3e')]=qs['sort'](_0x22fdb0[_0xb171('0x38')][_0xb171('0x3f')]);_0x3ff622[_0xb171('0x40')]=qs[_0xb171('0x42')](_[_0xb171('0x41')](_0x22fdb0[_0xb171('0x38')],_0xa37f29[_0xb171('0x42')]));if(_0x22fdb0[_0xb171('0x38')][_0xb171('0x43')]){_0x3ff622[_0xb171('0x40')]=_[_0xb171('0x44')](_0x3ff622[_0xb171('0x40')],{'$or':_[_0xb171('0x31')](_0x3ff622[_0xb171('0x3a')],function(_0x241701){var _0x44e8ca={};_0x44e8ca[_0x241701]={'$like':'%'+_0x22fdb0[_0xb171('0x38')][_0xb171('0x43')]+'%'};return _0x44e8ca;})});}_0x3ff622=_[_0xb171('0x44')]({},_0x3ff622,_0x22fdb0[_0xb171('0x46')]);return _0x532f65[_0xb171('0x67')](_0x3ff622);}})[_0xb171('0x27')](function(_0x197f2d){if(_0x197f2d){_0x5281f1=_0x197f2d[_0xb171('0x4c')];if(!_0x22fdb0[_0xb171('0x38')][_0xb171('0x3c')]('nolimit')){_0x3ff622['limit']=qs[_0xb171('0x21')](_0x22fdb0[_0xb171('0x38')][_0xb171('0x21')]);_0x3ff622['offset']=qs[_0xb171('0x1e')](_0x22fdb0['query'][_0xb171('0x1e')]);}return _0x532f65[_0xb171('0x67')](_0x3ff622);}})[_0xb171('0x27')](function(_0x3c8466){if(_0x3c8466){return _0x3c8466?{'count':_0x5281f1,'rows':_0x3c8466}:null;}})[_0xb171('0x27')](respondWithResult(_0x3bb5f7,null))[_0xb171('0x49')](handleError(_0x3bb5f7,null));};exports[_0xb171('0x68')]=function(_0x157d1d,_0x4bab41,_0x15dfb4){var _0x28b2e9=_0x157d1d[_0xb171('0x50')][_0xb171('0x69')];return db[_0xb171('0x66')]['findAll']({'where':{'id':_0x28b2e9},'attributes':['id'],'include':[{'model':db['User'],'as':_0xb171('0x6a'),'attributes':['id','name',_0xb171('0x6b'),'voicePause',_0xb171('0x6c')],'raw':!![]}]})['then'](function(_0x55c03a){if(_0x55c03a){var _0x367218=_['flatMap'](_0x55c03a,function(_0x399ad4){var _0x209927=_0x399ad4['get']({'plain':!![]});return _0x209927['Agents'];});return db[_0xb171('0x32')][_0xb171('0x4e')]({'where':{'id':_0x157d1d[_0xb171('0x58')]['id']}})['then'](function(_0x4360d8){return db[_0xb171('0x6d')]['transaction'](function(_0x4c1cfa){return _0x4360d8[_0xb171('0x68')](_0x28b2e9,{'transaction':_0x4c1cfa})['then'](function(){return BPromise[_0xb171('0x6e')](_0x367218,function(_0x5a74f1){return db[_0xb171('0x6f')][_0xb171('0x70')]({'where':{'UserId':_0x5a74f1['id'],'SmsQueueId':_0x157d1d['params']['id']},'transaction':_0x4c1cfa});});})[_0xb171('0x27')](function(){_0x367218['forEach'](function(_0x2c2a9b){socket['emit'](_0xb171('0x71'),{'UserId':_0x2c2a9b['id'],'SmsQueueId':_0x4360d8['id']});});});});});}})[_0xb171('0x27')](respondWithStatusCode(_0x4bab41,null))[_0xb171('0x49')](handleError(_0x4bab41,null));};exports[_0xb171('0x72')]=function(_0x2b1a59,_0x12123b,_0x107f07){return db[_0xb171('0x66')][_0xb171('0x5d')]({'where':{'id':_0x2b1a59[_0xb171('0x38')]['ids']},'attributes':['id'],'include':[{'model':db[_0xb171('0x5e')],'as':_0xb171('0x6a'),'attributes':['id'],'raw':!![]}]})[_0xb171('0x27')](handleEntityNotFound(_0x12123b,null))[_0xb171('0x27')](function(_0x291332){var _0x3eb2a6=_[_0xb171('0x31')](_0x291332,'id');var _0x2bc16e=[];var _0x1fe2f2=[];var _0x135693=squel[_0xb171('0x73')]();_0x135693[_0xb171('0x74')](_0xb171('0x75'))[_0xb171('0x76')](_0xb171('0x77'),'tq')[_0xb171('0x78')]('user_has_teams','ut',_0xb171('0x79'))['where'](_0xb171('0x7a'),_0x2b1a59['params']['id']);for(var _0x34edfc=0x0;_0x34edfc<_0x291332[_0xb171('0x4c')];_0x34edfc+=0x1){let _0x5b0cef=_0x291332[_0x34edfc];for(var _0x392c88=0x0;_0x392c88<_0x5b0cef[_0xb171('0x6a')][_0xb171('0x4c')];_0x392c88+=0x1){let _0x5ea475=_0x5b0cef['Agents'][_0x392c88];var _0x528a06=_0x135693[_0xb171('0x7b')]();_0x528a06['where'](_0xb171('0x7c'),_0x5ea475['id']);_0x1fe2f2[_0xb171('0x7d')](db[_0xb171('0x6d')][_0xb171('0x38')](_0x528a06[_0xb171('0x7e')](),{'type':db[_0xb171('0x6d')][_0xb171('0x7f')][_0xb171('0x80')]})[_0xb171('0x27')](function(_0x5e2f08){if(_0x5e2f08[_0xb171('0x4c')]===0x1){return _0x5ea475['id'];}else{var _0x41fd39=_[_0xb171('0x81')](_['map'](_0x5e2f08,'TeamId'),function(_0x200020){return _[_0xb171('0x82')](_0x3eb2a6,_0x200020);});if(_0x41fd39){return _0x5ea475['id'];}}}));}}return BPromise[_0xb171('0x83')](_0x1fe2f2)[_0xb171('0x27')](function(_0x12a69c){_0x2bc16e=_(_0x2bc16e)[_0xb171('0x84')](_0x12a69c)[_0xb171('0x85')]()[_0xb171('0x86')]();return db['SmsQueue']['find']({'where':{'id':_0x2b1a59[_0xb171('0x58')]['id']}})[_0xb171('0x27')](function(_0x75f960){return db[_0xb171('0x6d')]['transaction'](function(_0x142358){return _0x75f960[_0xb171('0x72')](_0x2b1a59['query'][_0xb171('0x69')],{'transaction':_0x142358})[_0xb171('0x27')](function(){if(!_[_0xb171('0x87')](_0x2bc16e)){return _0x75f960['removeAgents'](_0x2bc16e,{'transaction':_0x142358});}})[_0xb171('0x27')](function(){_0x2bc16e[_0xb171('0x88')](function(_0x16c243){socket['emit'](_0xb171('0x89'),{'UserId':_0x16c243,'SmsQueueId':_0x75f960['id']});});});});});});})[_0xb171('0x27')](respondWithStatusCode(_0x12123b,null))['catch'](handleError(_0x12123b,null));};exports['addAgents']=function(_0x450999,_0x5e0a01,_0x421fa4){return db[_0xb171('0x32')][_0xb171('0x4e')]({'where':{'id':_0x450999[_0xb171('0x58')]['id']}})[_0xb171('0x27')](handleEntityNotFound(_0x5e0a01,null))['then'](function(_0x55d54b){if(_0x55d54b){return _0x55d54b['addAgents'](_0x450999[_0xb171('0x50')]['ids'],_[_0xb171('0x8a')](_0x450999[_0xb171('0x50')],[_0xb171('0x69'),'id'])||{})[_0xb171('0x8b')](function(_0x32f0dd){for(var _0x56a5a5=0x0;_0x56a5a5<_0x450999[_0xb171('0x50')]['ids'][_0xb171('0x4c')];_0x56a5a5+=0x1){socket['emit'](_0xb171('0x71'),{'UserId':Number(_0x450999[_0xb171('0x50')][_0xb171('0x69')][_0x56a5a5]),'SmsQueueId':Number(_0x450999['params']['id'])});}return _0x32f0dd;});}})[_0xb171('0x27')](respondWithResult(_0x5e0a01,null))['catch'](handleError(_0x5e0a01,null));};exports[_0xb171('0x8c')]=function(_0x5d627a,_0x3bbc82,_0x2fcade){return db[_0xb171('0x32')]['find']({'where':{'id':_0x5d627a[_0xb171('0x58')]['id']}})['then'](handleEntityNotFound(_0x3bbc82,null))['then'](function(_0x3b0f28){if(_0x3b0f28){return _0x3b0f28[_0xb171('0x8c')](_0x5d627a['query'][_0xb171('0x69')])[_0xb171('0x27')](function(){if(_[_0xb171('0x8d')](_0x5d627a[_0xb171('0x38')]['ids'])){for(var _0x2ebaef=0x0;_0x2ebaef<_0x5d627a[_0xb171('0x38')][_0xb171('0x69')][_0xb171('0x4c')];_0x2ebaef+=0x1){socket[_0xb171('0x8e')](_0xb171('0x89'),{'UserId':Number(_0x5d627a[_0xb171('0x38')][_0xb171('0x69')][_0x2ebaef]),'SmsQueueId':Number(_0x5d627a['params']['id'])});}}else{socket['emit']('userSmsQueue:remove',{'UserId':Number(_0x5d627a['query'][_0xb171('0x69')]),'SmsQueueId':Number(_0x5d627a[_0xb171('0x58')]['id'])});}});}})['then'](respondWithStatusCode(_0x3bbc82,null))[_0xb171('0x49')](handleError(_0x3bbc82,null));};exports[_0xb171('0x8f')]=function(_0x2ae512,_0x12a50d,_0x4df9a5){var _0x42f2d5={};var _0x1d0a2f={};var _0x17f559;var _0x1c84f4;return db[_0xb171('0x32')]['findOne']({'where':{'id':_0x2ae512[_0xb171('0x58')]['id']}})['then'](handleEntityNotFound(_0x12a50d,null))[_0xb171('0x27')](function(_0x1a7fd3){if(_0x1a7fd3){_0x17f559=_0x1a7fd3;_0x1d0a2f[_0xb171('0x37')]=_[_0xb171('0x4b')](db[_0xb171('0x5e')][_0xb171('0x33')]);_0x1d0a2f[_0xb171('0x38')]=_[_0xb171('0x4b')](_0x2ae512['query']);_0x1d0a2f[_0xb171('0x42')]=_[_0xb171('0x39')](_0x1d0a2f['model'],_0x1d0a2f[_0xb171('0x38')]);_0x42f2d5[_0xb171('0x3a')]=_[_0xb171('0x39')](_0x1d0a2f['model'],qs[_0xb171('0x3b')](_0x2ae512[_0xb171('0x38')]['fields']));_0x42f2d5[_0xb171('0x3a')]=_0x42f2d5[_0xb171('0x3a')][_0xb171('0x4c')]?_0x42f2d5['attributes']:_0x1d0a2f[_0xb171('0x37')];_0x42f2d5['order']=qs[_0xb171('0x3f')](_0x2ae512[_0xb171('0x38')]['sort']);_0x42f2d5['where']=qs[_0xb171('0x42')](_[_0xb171('0x41')](_0x2ae512[_0xb171('0x38')],_0x1d0a2f[_0xb171('0x42')]));if(_0x2ae512['query']['filter']){_0x42f2d5[_0xb171('0x40')]=_['merge'](_0x42f2d5[_0xb171('0x40')],{'$or':_[_0xb171('0x31')](_0x42f2d5[_0xb171('0x3a')],function(_0x4d72a9){var _0x553e5e={};_0x553e5e[_0x4d72a9]={'$like':'%'+_0x2ae512[_0xb171('0x38')][_0xb171('0x43')]+'%'};return _0x553e5e;})});}_0x42f2d5=_['merge']({},_0x42f2d5,_0x2ae512[_0xb171('0x46')]);return _0x17f559[_0xb171('0x8f')](_0x42f2d5);}})[_0xb171('0x27')](function(_0x256993){if(_0x256993){_0x1c84f4=_0x256993[_0xb171('0x4c')];if(!_0x2ae512[_0xb171('0x38')][_0xb171('0x3c')](_0xb171('0x3d'))){_0x42f2d5[_0xb171('0x21')]=qs['limit'](_0x2ae512['query'][_0xb171('0x21')]);_0x42f2d5['offset']=qs['offset'](_0x2ae512[_0xb171('0x38')][_0xb171('0x1e')]);}return _0x17f559[_0xb171('0x8f')](_0x42f2d5);}})[_0xb171('0x27')](function(_0x43516f){if(_0x43516f){return _0x43516f?{'count':_0x1c84f4,'rows':_0x43516f}:null;}})[_0xb171('0x27')](respondWithResult(_0x12a50d,null))[_0xb171('0x49')](handleError(_0x12a50d,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 00a9bc4..d296d5d 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 _0x8510=['save','update','remove','emit','hasOwnProperty','events','../../mysqldb','SmsQueue','setMaxListeners'];(function(_0xcf4569,_0x1ce755){var _0x7fef=function(_0x374ab8){while(--_0x374ab8){_0xcf4569['push'](_0xcf4569['shift']());}};_0x7fef(++_0x1ce755);}(_0x8510,0x113));var _0x0851=function(_0xefd3e6,_0x10d71e){_0xefd3e6=_0xefd3e6-0x0;var _0x52a204=_0x8510[_0xefd3e6];return _0x52a204;};'use strict';var EventEmitter=require(_0x0851('0x0'));var SmsQueue=require(_0x0851('0x1'))['db'][_0x0851('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x0851('0x3')](0x0);var events={'afterCreate':_0x0851('0x4'),'afterUpdate':_0x0851('0x5'),'afterDestroy':_0x0851('0x6')};function emitEvent(_0x409308){return function(_0x5e4026,_0x2a2f29,_0x4896ba){SmsQueueEvents['emit'](_0x409308+':'+_0x5e4026['id'],_0x5e4026);SmsQueueEvents[_0x0851('0x7')](_0x409308,_0x5e4026);_0x4896ba(null);};}for(var e in events){if(events[_0x0851('0x8')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file +var _0xe1f8=['emit','hasOwnProperty','exports','events','../../mysqldb','SmsQueue','setMaxListeners','update'];(function(_0xbe471d,_0x382a26){var _0x4b5dc7=function(_0xa77d8d){while(--_0xa77d8d){_0xbe471d['push'](_0xbe471d['shift']());}};_0x4b5dc7(++_0x382a26);}(_0xe1f8,0x193));var _0x8e1f=function(_0x50f6df,_0x42a86a){_0x50f6df=_0x50f6df-0x0;var _0x2b82b3=_0xe1f8[_0x50f6df];return _0x2b82b3;};'use strict';var EventEmitter=require(_0x8e1f('0x0'));var SmsQueue=require(_0x8e1f('0x1'))['db'][_0x8e1f('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x8e1f('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8e1f('0x4'),'afterDestroy':'remove'};function emitEvent(_0x570bd7){return function(_0x407bfd,_0x10ad54,_0x35812d){SmsQueueEvents[_0x8e1f('0x5')](_0x570bd7+':'+_0x407bfd['id'],_0x407bfd);SmsQueueEvents[_0x8e1f('0x5')](_0x570bd7,_0x407bfd);_0x35812d(null);};}for(var e in events){if(events[_0x8e1f('0x6')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0x8e1f('0x7')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 3c3ee40..f0e89a0 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 _0xe81e=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./smsQueue.attributes','define','SmsQueue','sms_queues'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe81e,0xdc));var _0xee81=function(_0x281a36,_0x1b3ab0){_0x281a36=_0x281a36-0x0;var _0x33333c=_0xe81e[_0x281a36];return _0x33333c;};'use strict';var _=require('lodash');var util=require(_0xee81('0x0'));var logger=require(_0xee81('0x1'))(_0xee81('0x2'));var moment=require(_0xee81('0x3'));var BPromise=require(_0xee81('0x4'));var rp=require(_0xee81('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xee81('0x6'));var config=require('../../config/environment');var attributes=require(_0xee81('0x7'));module['exports']=function(_0x5ba6ee,_0x589d8a){return _0x5ba6ee[_0xee81('0x8')](_0xee81('0x9'),attributes,{'tableName':_0xee81('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x488e=['path','rimraf','../../config/environment','./smsQueue.attributes','exports','SmsQueue','sms_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x454fa7,_0x54fc63){var _0x16cb40=function(_0x104a3b){while(--_0x104a3b){_0x454fa7['push'](_0x454fa7['shift']());}};_0x16cb40(++_0x54fc63);}(_0x488e,0x1f1));var _0xe488=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x488e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe488('0x0'));var util=require(_0xe488('0x1'));var logger=require(_0xe488('0x2'))(_0xe488('0x3'));var moment=require(_0xe488('0x4'));var BPromise=require(_0xe488('0x5'));var rp=require(_0xe488('0x6'));var fs=require('fs');var path=require(_0xe488('0x7'));var rimraf=require(_0xe488('0x8'));var config=require(_0xe488('0x9'));var attributes=require(_0xe488('0xa'));module[_0xe488('0xb')]=function(_0x3c924d,_0x2850ae){return _0x3c924d['define'](_0xe488('0xc'),attributes,{'tableName':_0xe488('0xd'),'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 f98e5fb..c9a6cfc 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 _0xe795=['limit','include','map','model','debug','ShowSmsQueue','find','where','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetSmsQueue','SmsQueue','findAll','options','raw','attributes'];(function(_0x53ec10,_0x319fae){var _0x493912=function(_0x958c39){while(--_0x958c39){_0x53ec10['push'](_0x53ec10['shift']());}};_0x493912(++_0x319fae);}(_0xe795,0x17a));var _0x5e79=function(_0x2a3f64,_0x16ea3e){_0x2a3f64=_0x2a3f64-0x0;var _0x1accd1=_0xe795[_0x2a3f64];return _0x1accd1;};'use strict';var _=require(_0x5e79('0x0'));var util=require(_0x5e79('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5e79('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5e79('0x3'))['db'];var utils=require(_0x5e79('0x4'));var logger=require(_0x5e79('0x5'))('rpc');var config=require(_0x5e79('0x6'));var jayson=require(_0x5e79('0x7'));var client=jayson[_0x5e79('0x8')][_0x5e79('0x9')]({'port':0x232a});config[_0x5e79('0xa')]=_[_0x5e79('0xb')](config[_0x5e79('0xa')],{'host':_0x5e79('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./smsQueue.socket')['register'](socket);function respondWithRpcPromise(_0x397cd7,_0x4a2e72,_0x2e69ad){return new BPromise(function(_0x263247,_0x12d44f){return client[_0x5e79('0xd')](_0x397cd7,_0x2e69ad)[_0x5e79('0xe')](function(_0x19caa7){logger[_0x5e79('0xf')](_0x5e79('0x10'),_0x4a2e72,_0x5e79('0x11'));logger['debug']('SmsQueue,\x20%s,\x20%s,\x20%s',_0x4a2e72,_0x5e79('0x11'),JSON[_0x5e79('0x12')](_0x19caa7));if(_0x19caa7[_0x5e79('0x13')]){if(_0x19caa7[_0x5e79('0x13')][_0x5e79('0x14')]===0x1f4){logger[_0x5e79('0x13')]('SmsQueue,\x20%s,\x20%s',_0x4a2e72,_0x19caa7[_0x5e79('0x13')][_0x5e79('0x15')]);return _0x12d44f(_0x19caa7[_0x5e79('0x13')][_0x5e79('0x15')]);}logger[_0x5e79('0x13')]('SmsQueue,\x20%s,\x20%s',_0x4a2e72,_0x19caa7[_0x5e79('0x13')][_0x5e79('0x15')]);return _0x263247(_0x19caa7[_0x5e79('0x13')][_0x5e79('0x15')]);}else{logger[_0x5e79('0xf')]('SmsQueue,\x20%s,\x20%s',_0x4a2e72,_0x5e79('0x11'));_0x263247(_0x19caa7['result'][_0x5e79('0x15')]);}})[_0x5e79('0x16')](function(_0x3b8541){logger[_0x5e79('0x13')](_0x5e79('0x10'),_0x4a2e72,_0x3b8541);_0x12d44f(_0x3b8541);});});}exports[_0x5e79('0x17')]=function(_0x2a4b14){var _0x374589=this;return new Promise(function(_0x913595,_0x310a2e){return db[_0x5e79('0x18')][_0x5e79('0x19')]({'raw':_0x2a4b14[_0x5e79('0x1a')]?_0x2a4b14['options'][_0x5e79('0x1b')]===undefined?!![]:![]:!![],'where':_0x2a4b14[_0x5e79('0x1a')]?_0x2a4b14['options']['where']||null:null,'attributes':_0x2a4b14[_0x5e79('0x1a')]?_0x2a4b14[_0x5e79('0x1a')][_0x5e79('0x1c')]||null:null,'limit':_0x2a4b14['options']?_0x2a4b14[_0x5e79('0x1a')][_0x5e79('0x1d')]||null:null,'include':_0x2a4b14[_0x5e79('0x1a')]?_0x2a4b14[_0x5e79('0x1a')][_0x5e79('0x1e')]?_[_0x5e79('0x1f')](_0x2a4b14['options'][_0x5e79('0x1e')],function(_0x30eeef){return{'model':db[_0x30eeef[_0x5e79('0x20')]],'as':_0x30eeef['as'],'attributes':_0x30eeef[_0x5e79('0x1c')],'include':_0x30eeef[_0x5e79('0x1e')]?_['map'](_0x30eeef[_0x5e79('0x1e')],function(_0x430607){return{'model':db[_0x430607[_0x5e79('0x20')]],'as':_0x430607['as'],'attributes':_0x430607[_0x5e79('0x1c')],'include':_0x430607[_0x5e79('0x1e')]?_[_0x5e79('0x1f')](_0x430607[_0x5e79('0x1e')],function(_0x4cf15f){return{'model':db[_0x4cf15f[_0x5e79('0x20')]],'as':_0x4cf15f['as'],'attributes':_0x4cf15f[_0x5e79('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xaa4527){logger[_0x5e79('0xf')]('GetSmsQueue',_0x2a4b14);logger[_0x5e79('0x21')](_0x5e79('0x17'),_0x2a4b14,JSON[_0x5e79('0x12')](_0xaa4527));_0x913595(_0xaa4527);})['catch'](function(_0x15659b){logger[_0x5e79('0x13')](_0x5e79('0x17'),_0x15659b[_0x5e79('0x15')],_0x2a4b14);_0x310a2e(_0x374589['error'](0x1f4,_0x15659b['message']));});});};exports[_0x5e79('0x22')]=function(_0x29bb9d){var _0x5a61cc=this;return new Promise(function(_0x3e985f,_0x437d12){return db[_0x5e79('0x18')][_0x5e79('0x23')]({'raw':_0x29bb9d['options']?_0x29bb9d[_0x5e79('0x1a')][_0x5e79('0x1b')]===undefined?!![]:![]:!![],'where':_0x29bb9d['options']?_0x29bb9d[_0x5e79('0x1a')][_0x5e79('0x24')]||null:null,'attributes':_0x29bb9d[_0x5e79('0x1a')]?_0x29bb9d[_0x5e79('0x1a')][_0x5e79('0x1c')]||null:null,'include':_0x29bb9d[_0x5e79('0x1a')]?_0x29bb9d[_0x5e79('0x1a')][_0x5e79('0x1e')]?_['map'](_0x29bb9d[_0x5e79('0x1a')][_0x5e79('0x1e')],function(_0x2cb7a1){return{'model':db[_0x2cb7a1['model']],'as':_0x2cb7a1['as'],'attributes':_0x2cb7a1[_0x5e79('0x1c')],'include':_0x2cb7a1[_0x5e79('0x1e')]?_[_0x5e79('0x1f')](_0x2cb7a1[_0x5e79('0x1e')],function(_0x4259d8){return{'model':db[_0x4259d8[_0x5e79('0x20')]],'as':_0x4259d8['as'],'attributes':_0x4259d8[_0x5e79('0x1c')],'include':_0x4259d8[_0x5e79('0x1e')]?_[_0x5e79('0x1f')](_0x4259d8[_0x5e79('0x1e')],function(_0x43dd6c){return{'model':db[_0x43dd6c[_0x5e79('0x20')]],'as':_0x43dd6c['as'],'attributes':_0x43dd6c[_0x5e79('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x35837f){logger['info']('ShowSmsQueue',_0x29bb9d);logger[_0x5e79('0x21')](_0x5e79('0x22'),_0x29bb9d,JSON[_0x5e79('0x12')](_0x35837f));_0x3e985f(_0x35837f);})[_0x5e79('0x16')](function(_0x5c0d65){logger[_0x5e79('0x13')](_0x5e79('0x22'),_0x5c0d65['message'],_0x29bb9d);_0x437d12(_0x5a61cc['error'](0x1f4,_0x5c0d65[_0x5e79('0x15')]));});});}; \ No newline at end of file +var _0xde19=['message','result','catch','GetSmsQueue','options','raw','limit','model','include','map','attributes','ShowSmsQueue','SmsQueue','find','where','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x367e5b,_0x5721e4){var _0x4b909e=function(_0x22c6a4){while(--_0x22c6a4){_0x367e5b['push'](_0x367e5b['shift']());}};_0x4b909e(++_0x5721e4);}(_0xde19,0x19b));var _0x9de1=function(_0x428dbd,_0x30eeb5){_0x428dbd=_0x428dbd-0x0;var _0xc411d8=_0xde19[_0x428dbd];return _0xc411d8;};'use strict';var _=require(_0x9de1('0x0'));var util=require(_0x9de1('0x1'));var moment=require(_0x9de1('0x2'));var BPromise=require(_0x9de1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9de1('0x4'));var db=require(_0x9de1('0x5'))['db'];var utils=require(_0x9de1('0x6'));var logger=require(_0x9de1('0x7'))(_0x9de1('0x8'));var config=require(_0x9de1('0x9'));var jayson=require(_0x9de1('0xa'));var client=jayson[_0x9de1('0xb')][_0x9de1('0xc')]({'port':0x232a});config[_0x9de1('0xd')]=_[_0x9de1('0xe')](config[_0x9de1('0xd')],{'host':_0x9de1('0xf'),'port':0x18eb});var socket=require(_0x9de1('0x10'))(new Redis(config['redis']));require(_0x9de1('0x11'))[_0x9de1('0x12')](socket);function respondWithRpcPromise(_0x1b18e7,_0x57918d,_0x4487a4){return new BPromise(function(_0xa2bda4,_0x2806f0){return client[_0x9de1('0x13')](_0x1b18e7,_0x4487a4)[_0x9de1('0x14')](function(_0x40bc7b){logger[_0x9de1('0x15')](_0x9de1('0x16'),_0x57918d,_0x9de1('0x17'));logger[_0x9de1('0x18')](_0x9de1('0x19'),_0x57918d,_0x9de1('0x17'),JSON[_0x9de1('0x1a')](_0x40bc7b));if(_0x40bc7b[_0x9de1('0x1b')]){if(_0x40bc7b[_0x9de1('0x1b')][_0x9de1('0x1c')]===0x1f4){logger[_0x9de1('0x1b')](_0x9de1('0x16'),_0x57918d,_0x40bc7b[_0x9de1('0x1b')]['message']);return _0x2806f0(_0x40bc7b[_0x9de1('0x1b')]['message']);}logger[_0x9de1('0x1b')]('SmsQueue,\x20%s,\x20%s',_0x57918d,_0x40bc7b[_0x9de1('0x1b')][_0x9de1('0x1d')]);return _0xa2bda4(_0x40bc7b[_0x9de1('0x1b')][_0x9de1('0x1d')]);}else{logger[_0x9de1('0x15')](_0x9de1('0x16'),_0x57918d,_0x9de1('0x17'));_0xa2bda4(_0x40bc7b[_0x9de1('0x1e')][_0x9de1('0x1d')]);}})[_0x9de1('0x1f')](function(_0x1dba1b){logger[_0x9de1('0x1b')]('SmsQueue,\x20%s,\x20%s',_0x57918d,_0x1dba1b);_0x2806f0(_0x1dba1b);});});}exports[_0x9de1('0x20')]=function(_0x284dc4){var _0x57822b=this;return new Promise(function(_0x17685a,_0x4de031){return db['SmsQueue']['findAll']({'raw':_0x284dc4[_0x9de1('0x21')]?_0x284dc4[_0x9de1('0x21')][_0x9de1('0x22')]===undefined?!![]:![]:!![],'where':_0x284dc4[_0x9de1('0x21')]?_0x284dc4['options']['where']||null:null,'attributes':_0x284dc4[_0x9de1('0x21')]?_0x284dc4['options']['attributes']||null:null,'limit':_0x284dc4[_0x9de1('0x21')]?_0x284dc4[_0x9de1('0x21')][_0x9de1('0x23')]||null:null,'include':_0x284dc4[_0x9de1('0x21')]?_0x284dc4[_0x9de1('0x21')]['include']?_['map'](_0x284dc4[_0x9de1('0x21')]['include'],function(_0x9c821b){return{'model':db[_0x9c821b[_0x9de1('0x24')]],'as':_0x9c821b['as'],'attributes':_0x9c821b['attributes'],'include':_0x9c821b[_0x9de1('0x25')]?_[_0x9de1('0x26')](_0x9c821b['include'],function(_0x57fe39){return{'model':db[_0x57fe39[_0x9de1('0x24')]],'as':_0x57fe39['as'],'attributes':_0x57fe39['attributes'],'include':_0x57fe39[_0x9de1('0x25')]?_[_0x9de1('0x26')](_0x57fe39[_0x9de1('0x25')],function(_0x1fa0b9){return{'model':db[_0x1fa0b9['model']],'as':_0x1fa0b9['as'],'attributes':_0x1fa0b9[_0x9de1('0x27')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4408b5){logger[_0x9de1('0x15')](_0x9de1('0x20'),_0x284dc4);logger[_0x9de1('0x18')](_0x9de1('0x20'),_0x284dc4,JSON[_0x9de1('0x1a')](_0x4408b5));_0x17685a(_0x4408b5);})[_0x9de1('0x1f')](function(_0x12a005){logger[_0x9de1('0x1b')]('GetSmsQueue',_0x12a005[_0x9de1('0x1d')],_0x284dc4);_0x4de031(_0x57822b['error'](0x1f4,_0x12a005[_0x9de1('0x1d')]));});});};exports[_0x9de1('0x28')]=function(_0x495502){var _0x165cee=this;return new Promise(function(_0x3c9a2c,_0x544b13){return db[_0x9de1('0x29')][_0x9de1('0x2a')]({'raw':_0x495502['options']?_0x495502['options']['raw']===undefined?!![]:![]:!![],'where':_0x495502['options']?_0x495502[_0x9de1('0x21')][_0x9de1('0x2b')]||null:null,'attributes':_0x495502['options']?_0x495502['options'][_0x9de1('0x27')]||null:null,'include':_0x495502[_0x9de1('0x21')]?_0x495502[_0x9de1('0x21')][_0x9de1('0x25')]?_['map'](_0x495502['options'][_0x9de1('0x25')],function(_0xe0c42c){return{'model':db[_0xe0c42c[_0x9de1('0x24')]],'as':_0xe0c42c['as'],'attributes':_0xe0c42c[_0x9de1('0x27')],'include':_0xe0c42c[_0x9de1('0x25')]?_[_0x9de1('0x26')](_0xe0c42c[_0x9de1('0x25')],function(_0xdbfb8a){return{'model':db[_0xdbfb8a[_0x9de1('0x24')]],'as':_0xdbfb8a['as'],'attributes':_0xdbfb8a[_0x9de1('0x27')],'include':_0xdbfb8a['include']?_[_0x9de1('0x26')](_0xdbfb8a['include'],function(_0x9fd5fe){return{'model':db[_0x9fd5fe[_0x9de1('0x24')]],'as':_0x9fd5fe['as'],'attributes':_0x9fd5fe[_0x9de1('0x27')]};}):[]};}):[]};}):[]:[]})[_0x9de1('0x14')](function(_0xe9a271){logger[_0x9de1('0x15')](_0x9de1('0x28'),_0x495502);logger[_0x9de1('0x18')](_0x9de1('0x28'),_0x495502,JSON[_0x9de1('0x1a')](_0xe9a271));_0x3c9a2c(_0xe9a271);})['catch'](function(_0xa9cf08){logger[_0x9de1('0x1b')](_0x9de1('0x28'),_0xa9cf08['message'],_0x495502);_0x544b13(_0x165cee[_0x9de1('0x1b')](0x1f4,_0xa9cf08[_0x9de1('0x1d')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 2dc45a2..e575ea5 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 _0x0cd2=['save','remove','register','length','smsQueue:','./smsQueue.events'];(function(_0x1e4894,_0x1a7496){var _0x373945=function(_0xb15e88){while(--_0xb15e88){_0x1e4894['push'](_0x1e4894['shift']());}};_0x373945(++_0x1a7496);}(_0x0cd2,0x71));var _0x20cd=function(_0x267956,_0x670891){_0x267956=_0x267956-0x0;var _0x468b2a=_0x0cd2[_0x267956];return _0x468b2a;};'use strict';var SmsQueueEvents=require(_0x20cd('0x0'));var events=[_0x20cd('0x1'),_0x20cd('0x2'),'update'];function createListener(_0x2dd31e,_0x728360){return function(_0x1d4d2b){_0x728360['emit'](_0x2dd31e,_0x1d4d2b);};}function removeListener(_0x21e233,_0x8535c0){return function(){SmsQueueEvents['removeListener'](_0x21e233,_0x8535c0);};}exports[_0x20cd('0x3')]=function(_0x308b6f){for(var _0x19914c=0x0,_0x3f2ba5=events[_0x20cd('0x4')];_0x19914c<_0x3f2ba5;_0x19914c++){var _0x1f3dcd=events[_0x19914c];var _0x3aea52=createListener(_0x20cd('0x5')+_0x1f3dcd,_0x308b6f);SmsQueueEvents['on'](_0x1f3dcd,_0x3aea52);}}; \ No newline at end of file +var _0x0557=['emit','removeListener','register','length','./smsQueue.events','remove','update'];(function(_0x35a503,_0x4864e8){var _0x2151c2=function(_0x8ffa9c){while(--_0x8ffa9c){_0x35a503['push'](_0x35a503['shift']());}};_0x2151c2(++_0x4864e8);}(_0x0557,0x13f));var _0x7055=function(_0x179506,_0xb87ecc){_0x179506=_0x179506-0x0;var _0x4201f1=_0x0557[_0x179506];return _0x4201f1;};'use strict';var SmsQueueEvents=require(_0x7055('0x0'));var events=['save',_0x7055('0x1'),_0x7055('0x2')];function createListener(_0x2b4994,_0x4a7aa0){return function(_0x34e30b){_0x4a7aa0[_0x7055('0x3')](_0x2b4994,_0x34e30b);};}function removeListener(_0x24e657,_0x151aac){return function(){SmsQueueEvents[_0x7055('0x4')](_0x24e657,_0x151aac);};}exports[_0x7055('0x5')]=function(_0x29e521){for(var _0x4595c7=0x0,_0x5ce1b3=events[_0x7055('0x6')];_0x4595c7<_0x5ce1b3;_0x4595c7++){var _0xeb8abb=events[_0x4595c7];var _0x262d0a=createListener('smsQueue:'+_0xeb8abb,_0x29e521);SmsQueueEvents['on'](_0xeb8abb,_0x262d0a);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 06ffcb1..0f6d142 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 _0xaef4=['util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','describe','/:id','create','destroy','exports','multer'];(function(_0x1185f7,_0x349cb0){var _0x1e2ced=function(_0x4e8f22){while(--_0x4e8f22){_0x1185f7['push'](_0x1185f7['shift']());}};_0x1e2ced(++_0x349cb0);}(_0xaef4,0x197));var _0x4aef=function(_0x37b4b0,_0x386e11){_0x37b4b0=_0x37b4b0-0x0;var _0xedecfd=_0xaef4[_0x37b4b0];return _0xedecfd;};'use strict';var multer=require(_0x4aef('0x0'));var util=require(_0x4aef('0x1'));var path=require(_0x4aef('0x2'));var timeout=require(_0x4aef('0x3'));var express=require(_0x4aef('0x4'));var router=express[_0x4aef('0x5')]();var fs_extra=require(_0x4aef('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4aef('0x7'));var controller=require(_0x4aef('0x8'));router[_0x4aef('0x9')]('/',auth[_0x4aef('0xa')](),controller[_0x4aef('0xb')]);router[_0x4aef('0x9')]('/describe',auth[_0x4aef('0xa')](),controller[_0x4aef('0xc')]);router[_0x4aef('0x9')](_0x4aef('0xd'),auth[_0x4aef('0xa')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x4aef('0xe')]);router['put'](_0x4aef('0xd'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x4aef('0xf')]);module[_0x4aef('0x10')]=router; \ No newline at end of file +var _0x494e=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','/describe','isAuthenticated','describe','/:id','post','put','update','destroy','exports','multer','path'];(function(_0x12811f,_0x32d7e9){var _0x46f10b=function(_0x758733){while(--_0x758733){_0x12811f['push'](_0x12811f['shift']());}};_0x46f10b(++_0x32d7e9);}(_0x494e,0xd6));var _0xe494=function(_0x2d2326,_0x1eac00){_0x2d2326=_0x2d2326-0x0;var _0x31aa6d=_0x494e[_0x2d2326];return _0x31aa6d;};'use strict';var multer=require(_0xe494('0x0'));var util=require('util');var path=require(_0xe494('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe494('0x2')]();var fs_extra=require(_0xe494('0x3'));var auth=require(_0xe494('0x4'));var interaction=require(_0xe494('0x5'));var config=require(_0xe494('0x6'));var controller=require(_0xe494('0x7'));router[_0xe494('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe494('0x8')](_0xe494('0x9'),auth[_0xe494('0xa')](),controller[_0xe494('0xb')]);router[_0xe494('0x8')](_0xe494('0xc'),auth[_0xe494('0xa')](),controller['show']);router[_0xe494('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe494('0xe')](_0xe494('0xc'),auth[_0xe494('0xa')](),controller[_0xe494('0xf')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xe494('0x10')]);module[_0xe494('0x11')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 83dc3a2..ed42ca4 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 _0xc878=['DATE','exports','STRING'];(function(_0x4bd47c,_0x2bca90){var _0x2b1882=function(_0x102d44){while(--_0x102d44){_0x4bd47c['push'](_0x4bd47c['shift']());}};_0x2b1882(++_0x2bca90);}(_0xc878,0x10f));var _0x8c87=function(_0x217ff6,_0x36f75d){_0x217ff6=_0x217ff6-0x0;var _0x417c93=_0xc878[_0x217ff6];return _0x417c93;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x8c87('0x0')]={'uniqueid':{'type':Sequelize[_0x8c87('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x8c87('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x8c87('0x2')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x8c87('0x2')]},'reason':{'type':Sequelize[_0x8c87('0x1')]}}; \ No newline at end of file +var _0x0453=['DATE','sequelize','exports','STRING'];(function(_0x4b77cc,_0x584394){var _0x51910a=function(_0x2f0441){while(--_0x2f0441){_0x4b77cc['push'](_0x4b77cc['shift']());}};_0x51910a(++_0x584394);}(_0x0453,0x155));var _0x3045=function(_0x2b4366,_0x581d87){_0x2b4366=_0x2b4366-0x0;var _0x1fde9c=_0x0453[_0x2b4366];return _0x1fde9c;};'use strict';var moment=require('moment');var Sequelize=require(_0x3045('0x0'));module[_0x3045('0x1')]={'uniqueid':{'type':Sequelize[_0x3045('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x3045('0x3')]},'leaveAt':{'type':Sequelize[_0x3045('0x3')]},'acceptAt':{'type':Sequelize[_0x3045('0x3')]},'exitAt':{'type':Sequelize[_0x3045('0x3')]},'reason':{'type':Sequelize[_0x3045('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 257eb82..479632b 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 _0xc566=['undefined','limit','count','offset','set','Content-Range','json','reject','update','then','destroy','name','send','index','rawAttributes','type','map','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','SmsQueueReport','include','findAll','rows','catch','show','params','includeAll','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end'];(function(_0x268aa9,_0x52cc23){var _0x110acf=function(_0x44371b){while(--_0x44371b){_0x268aa9['push'](_0x268aa9['shift']());}};_0x110acf(++_0x52cc23);}(_0xc566,0x74));var _0x6c56=function(_0x33c2d7,_0x307676){_0x33c2d7=_0x33c2d7-0x0;var _0x1d8a94=_0xc566[_0x33c2d7];return _0x1d8a94;};'use strict';var emlformat=require(_0x6c56('0x0'));var rimraf=require(_0x6c56('0x1'));var zipdir=require(_0x6c56('0x2'));var jsonpatch=require(_0x6c56('0x3'));var rp=require(_0x6c56('0x4'));var moment=require(_0x6c56('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6c56('0x6'));var path=require('path');var sox=require(_0x6c56('0x7'));var csv=require(_0x6c56('0x8'));var ejs=require(_0x6c56('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6c56('0xa'));var squel=require(_0x6c56('0xb'));var crypto=require(_0x6c56('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6c56('0x8'));var querystring=require(_0x6c56('0xd'));var Papa=require(_0x6c56('0xe'));var Redis=require(_0x6c56('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x6c56('0x10'));var as=require(_0x6c56('0x11'));var hardwareService=require(_0x6c56('0x12'));var logger=require('../../config/logger')(_0x6c56('0x13'));var utils=require(_0x6c56('0x14'));var config=require(_0x6c56('0x15'));var licenseUtil=require(_0x6c56('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x7dae11,_0x33bb91){_0x33bb91=_0x33bb91||0xcc;return function(_0x25858b){if(_0x25858b){return _0x7dae11[_0x6c56('0x17')](_0x33bb91);}return _0x7dae11[_0x6c56('0x18')](_0x33bb91)[_0x6c56('0x19')]();};}function respondWithResult(_0x2043d9,_0x3940a7){_0x3940a7=_0x3940a7||0xc8;return function(_0x19d4bf){if(_0x19d4bf){return _0x2043d9['status'](_0x3940a7)['json'](_0x19d4bf);}};}function respondWithFilteredResult(_0x433c42,_0x141278){return function(_0x40b8d6){if(_0x40b8d6){var _0x57b053=typeof _0x141278['offset']===_0x6c56('0x1a')&&typeof _0x141278[_0x6c56('0x1b')]===_0x6c56('0x1a');var _0x26510f=_0x40b8d6[_0x6c56('0x1c')];var _0x3692a9=_0x57b053?0x0:_0x141278[_0x6c56('0x1d')];var _0x5b3585=_0x57b053?_0x40b8d6[_0x6c56('0x1c')]:_0x141278[_0x6c56('0x1d')]+_0x141278['limit'];var _0x538c11;if(_0x5b3585>=_0x26510f){_0x5b3585=_0x26510f;_0x538c11=0xc8;}else{_0x538c11=0xce;}_0x433c42[_0x6c56('0x18')](_0x538c11);return _0x433c42[_0x6c56('0x1e')](_0x6c56('0x1f'),_0x3692a9+'-'+_0x5b3585+'/'+_0x26510f)[_0x6c56('0x20')](_0x40b8d6);}return null;};}function patchUpdates(_0xa905a9){return function(_0x188e16){try{jsonpatch['apply'](_0x188e16,_0xa905a9,!![]);}catch(_0x15a3dc){return BPromise[_0x6c56('0x21')](_0x15a3dc);}return _0x188e16['save']();};}function saveUpdates(_0x241e18,_0x1985ca){return function(_0x33401f){if(_0x33401f){return _0x33401f[_0x6c56('0x22')](_0x241e18)[_0x6c56('0x23')](function(_0x20dffc){return _0x20dffc;});}return null;};}function removeEntity(_0x194f3b,_0x291b42){return function(_0x2e9577){if(_0x2e9577){return _0x2e9577[_0x6c56('0x24')]()['then'](function(){_0x194f3b[_0x6c56('0x18')](0xcc)[_0x6c56('0x19')]();});}};}function handleEntityNotFound(_0x30185c,_0x341922){return function(_0x4cc855){if(!_0x4cc855){_0x30185c[_0x6c56('0x17')](0x194);}return _0x4cc855;};}function handleError(_0x3f62cd,_0x36036e){_0x36036e=_0x36036e||0x1f4;return function(_0xed8a8a){logger['error'](_0xed8a8a['stack']);if(_0xed8a8a[_0x6c56('0x25')]){delete _0xed8a8a['name'];}_0x3f62cd[_0x6c56('0x18')](_0x36036e)[_0x6c56('0x26')](_0xed8a8a);};}exports[_0x6c56('0x27')]=function(_0x28c9f1,_0x8aeeb6){var _0x140902={},_0x551ea5={},_0x28d17a={'count':0x0,'rows':[]};var _0x5ac9e2=_['map'](db['SmsQueueReport'][_0x6c56('0x28')],function(_0x58ad35){return{'name':_0x58ad35['fieldName'],'type':_0x58ad35[_0x6c56('0x29')]['key']};});_0x551ea5['model']=_[_0x6c56('0x2a')](_0x5ac9e2,'name');_0x551ea5[_0x6c56('0x2b')]=_[_0x6c56('0x2c')](_0x28c9f1[_0x6c56('0x2b')]);_0x551ea5['filters']=_[_0x6c56('0x2d')](_0x551ea5[_0x6c56('0x2e')],_0x551ea5[_0x6c56('0x2b')]);_0x140902['attributes']=_[_0x6c56('0x2d')](_0x551ea5['model'],qs[_0x6c56('0x2f')](_0x28c9f1[_0x6c56('0x2b')]['fields']));_0x140902['attributes']=_0x140902[_0x6c56('0x30')][_0x6c56('0x31')]?_0x140902['attributes']:_0x551ea5['model'];if(!_0x28c9f1['query'][_0x6c56('0x32')](_0x6c56('0x33'))){_0x140902['limit']=qs['limit'](_0x28c9f1[_0x6c56('0x2b')][_0x6c56('0x1b')]);_0x140902['offset']=qs['offset'](_0x28c9f1[_0x6c56('0x2b')][_0x6c56('0x1d')]);}_0x140902[_0x6c56('0x34')]=qs[_0x6c56('0x35')](_0x28c9f1[_0x6c56('0x2b')][_0x6c56('0x35')]);_0x140902[_0x6c56('0x36')]=qs[_0x6c56('0x37')](_[_0x6c56('0x38')](_0x28c9f1[_0x6c56('0x2b')],_0x551ea5[_0x6c56('0x37')]),_0x5ac9e2);if(_0x28c9f1[_0x6c56('0x2b')][_0x6c56('0x39')]){_0x140902[_0x6c56('0x36')]=_[_0x6c56('0x3a')](_0x140902['where'],{'$or':_[_0x6c56('0x2a')](_0x5ac9e2,function(_0x29a61a){if(_0x29a61a[_0x6c56('0x29')]!=='VIRTUAL'){var _0x3358b1={};_0x3358b1[_0x29a61a[_0x6c56('0x25')]]={'$like':'%'+_0x28c9f1[_0x6c56('0x2b')][_0x6c56('0x39')]+'%'};return _0x3358b1;}})});}_0x140902=_[_0x6c56('0x3a')]({},_0x140902,_0x28c9f1['options']);var _0x4ba7ca={'where':_0x140902[_0x6c56('0x36')]};return db[_0x6c56('0x3b')][_0x6c56('0x1c')](_0x4ba7ca)[_0x6c56('0x23')](function(_0x1050d7){_0x28d17a[_0x6c56('0x1c')]=_0x1050d7;if(_0x28c9f1[_0x6c56('0x2b')]['includeAll']){_0x140902[_0x6c56('0x3c')]=[{'all':!![]}];}return db['SmsQueueReport'][_0x6c56('0x3d')](_0x140902);})[_0x6c56('0x23')](function(_0x574775){_0x28d17a[_0x6c56('0x3e')]=_0x574775;return _0x28d17a;})[_0x6c56('0x23')](respondWithFilteredResult(_0x8aeeb6,_0x140902))[_0x6c56('0x3f')](handleError(_0x8aeeb6,null));};exports[_0x6c56('0x40')]=function(_0x2f9e87,_0xa86e17){var _0xa68b52={'raw':!![],'where':{'id':_0x2f9e87[_0x6c56('0x41')]['id']}},_0x1d0ff2={};_0x1d0ff2[_0x6c56('0x2e')]=_[_0x6c56('0x2c')](db[_0x6c56('0x3b')][_0x6c56('0x28')]);_0x1d0ff2[_0x6c56('0x2b')]=_['keys'](_0x2f9e87[_0x6c56('0x2b')]);_0x1d0ff2[_0x6c56('0x37')]=_[_0x6c56('0x2d')](_0x1d0ff2[_0x6c56('0x2e')],_0x1d0ff2[_0x6c56('0x2b')]);_0xa68b52[_0x6c56('0x30')]=_['intersection'](_0x1d0ff2[_0x6c56('0x2e')],qs['fields'](_0x2f9e87[_0x6c56('0x2b')][_0x6c56('0x2f')]));_0xa68b52[_0x6c56('0x30')]=_0xa68b52[_0x6c56('0x30')][_0x6c56('0x31')]?_0xa68b52['attributes']:_0x1d0ff2['model'];if(_0x2f9e87[_0x6c56('0x2b')][_0x6c56('0x42')]){_0xa68b52['include']=[{'all':!![]}];}_0xa68b52=_[_0x6c56('0x3a')]({},_0xa68b52,_0x2f9e87['options']);return db[_0x6c56('0x3b')][_0x6c56('0x43')](_0xa68b52)[_0x6c56('0x23')](handleEntityNotFound(_0xa86e17,null))[_0x6c56('0x23')](respondWithResult(_0xa86e17,null))[_0x6c56('0x3f')](handleError(_0xa86e17,null));};exports['create']=function(_0x57d756,_0x154af4){return db[_0x6c56('0x3b')][_0x6c56('0x44')](_0x57d756[_0x6c56('0x45')],{})['then'](respondWithResult(_0x154af4,0xc9))[_0x6c56('0x3f')](handleError(_0x154af4,null));};exports[_0x6c56('0x22')]=function(_0x5a3296,_0x28ef38){if(_0x5a3296[_0x6c56('0x45')]['id']){delete _0x5a3296[_0x6c56('0x45')]['id'];}return db[_0x6c56('0x3b')][_0x6c56('0x43')]({'where':{'id':_0x5a3296[_0x6c56('0x41')]['id']}})[_0x6c56('0x23')](handleEntityNotFound(_0x28ef38,null))[_0x6c56('0x23')](saveUpdates(_0x5a3296[_0x6c56('0x45')],null))[_0x6c56('0x23')](respondWithResult(_0x28ef38,null))[_0x6c56('0x3f')](handleError(_0x28ef38,null));};exports[_0x6c56('0x24')]=function(_0x2a1a0c,_0x3aec91){return db[_0x6c56('0x3b')][_0x6c56('0x43')]({'where':{'id':_0x2a1a0c[_0x6c56('0x41')]['id']}})['then'](handleEntityNotFound(_0x3aec91,null))[_0x6c56('0x23')](removeEntity(_0x3aec91,null))[_0x6c56('0x3f')](handleError(_0x3aec91,null));};exports[_0x6c56('0x46')]=function(_0xa3f328,_0x106392){return db[_0x6c56('0x3b')][_0x6c56('0x46')]()[_0x6c56('0x23')](respondWithResult(_0x106392,null))['catch'](handleError(_0x106392,null));}; \ No newline at end of file +var _0xe983=['keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','SmsQueueReport','includeAll','include','rows','show','params','find','catch','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','then','destroy','error','name','send','map','rawAttributes','fieldName','type','model','query'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xe983,0xf5));var _0x3e98=function(_0x8fbe8a,_0x548ab7){_0x8fbe8a=_0x8fbe8a-0x0;var _0x4b96bc=_0xe983[_0x8fbe8a];return _0x4b96bc;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3e98('0x0'));var jsonpatch=require(_0x3e98('0x1'));var rp=require(_0x3e98('0x2'));var moment=require(_0x3e98('0x3'));var BPromise=require(_0x3e98('0x4'));var Mustache=require(_0x3e98('0x5'));var util=require(_0x3e98('0x6'));var path=require(_0x3e98('0x7'));var sox=require(_0x3e98('0x8'));var csv=require(_0x3e98('0x9'));var ejs=require(_0x3e98('0xa'));var fs=require('fs');var fs_extra=require(_0x3e98('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3e98('0xc'));var deskjs=require(_0x3e98('0xd'));var toCsv=require(_0x3e98('0x9'));var querystring=require(_0x3e98('0xe'));var Papa=require(_0x3e98('0xf'));var Redis=require(_0x3e98('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x3e98('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3e98('0x12'));var logger=require(_0x3e98('0x13'))(_0x3e98('0x14'));var utils=require(_0x3e98('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x3e98('0x16'));var db=require(_0x3e98('0x17'))['db'];function respondWithStatusCode(_0x48d11f,_0x4ea711){_0x4ea711=_0x4ea711||0xcc;return function(_0x115465){if(_0x115465){return _0x48d11f[_0x3e98('0x18')](_0x4ea711);}return _0x48d11f['status'](_0x4ea711)[_0x3e98('0x19')]();};}function respondWithResult(_0x2fe8ac,_0x115096){_0x115096=_0x115096||0xc8;return function(_0x190479){if(_0x190479){return _0x2fe8ac[_0x3e98('0x1a')](_0x115096)['json'](_0x190479);}};}function respondWithFilteredResult(_0x2b77c6,_0x3e61b8){return function(_0xc94b69){if(_0xc94b69){var _0x381698=typeof _0x3e61b8[_0x3e98('0x1b')]===_0x3e98('0x1c')&&typeof _0x3e61b8[_0x3e98('0x1d')]===_0x3e98('0x1c');var _0xcd7caf=_0xc94b69['count'];var _0x4ba639=_0x381698?0x0:_0x3e61b8[_0x3e98('0x1b')];var _0x5053f1=_0x381698?_0xc94b69[_0x3e98('0x1e')]:_0x3e61b8[_0x3e98('0x1b')]+_0x3e61b8[_0x3e98('0x1d')];var _0x4496b5;if(_0x5053f1>=_0xcd7caf){_0x5053f1=_0xcd7caf;_0x4496b5=0xc8;}else{_0x4496b5=0xce;}_0x2b77c6[_0x3e98('0x1a')](_0x4496b5);return _0x2b77c6[_0x3e98('0x1f')](_0x3e98('0x20'),_0x4ba639+'-'+_0x5053f1+'/'+_0xcd7caf)[_0x3e98('0x21')](_0xc94b69);}return null;};}function patchUpdates(_0x4c7a6a){return function(_0x150da2){try{jsonpatch[_0x3e98('0x22')](_0x150da2,_0x4c7a6a,!![]);}catch(_0x14e7b6){return BPromise['reject'](_0x14e7b6);}return _0x150da2[_0x3e98('0x23')]();};}function saveUpdates(_0x173a8e,_0x5c5ca8){return function(_0x6c13e1){if(_0x6c13e1){return _0x6c13e1['update'](_0x173a8e)[_0x3e98('0x24')](function(_0x29944b){return _0x29944b;});}return null;};}function removeEntity(_0x490b76,_0x55f948){return function(_0x38673c){if(_0x38673c){return _0x38673c[_0x3e98('0x25')]()[_0x3e98('0x24')](function(){_0x490b76['status'](0xcc)[_0x3e98('0x19')]();});}};}function handleEntityNotFound(_0x5d1187,_0xe4be3a){return function(_0x56a487){if(!_0x56a487){_0x5d1187[_0x3e98('0x18')](0x194);}return _0x56a487;};}function handleError(_0x1fa5e9,_0xb07179){_0xb07179=_0xb07179||0x1f4;return function(_0x518558){logger[_0x3e98('0x26')](_0x518558['stack']);if(_0x518558['name']){delete _0x518558[_0x3e98('0x27')];}_0x1fa5e9[_0x3e98('0x1a')](_0xb07179)[_0x3e98('0x28')](_0x518558);};}exports['index']=function(_0x19e5d4,_0x3b5e13){var _0x7964e6={},_0xdfb5a1={},_0xa274cd={'count':0x0,'rows':[]};var _0xcbb278=_[_0x3e98('0x29')](db['SmsQueueReport'][_0x3e98('0x2a')],function(_0x3930e3){return{'name':_0x3930e3[_0x3e98('0x2b')],'type':_0x3930e3[_0x3e98('0x2c')]['key']};});_0xdfb5a1[_0x3e98('0x2d')]=_[_0x3e98('0x29')](_0xcbb278,_0x3e98('0x27'));_0xdfb5a1[_0x3e98('0x2e')]=_[_0x3e98('0x2f')](_0x19e5d4[_0x3e98('0x2e')]);_0xdfb5a1[_0x3e98('0x30')]=_[_0x3e98('0x31')](_0xdfb5a1[_0x3e98('0x2d')],_0xdfb5a1[_0x3e98('0x2e')]);_0x7964e6['attributes']=_['intersection'](_0xdfb5a1[_0x3e98('0x2d')],qs[_0x3e98('0x32')](_0x19e5d4[_0x3e98('0x2e')][_0x3e98('0x32')]));_0x7964e6[_0x3e98('0x33')]=_0x7964e6[_0x3e98('0x33')][_0x3e98('0x34')]?_0x7964e6[_0x3e98('0x33')]:_0xdfb5a1[_0x3e98('0x2d')];if(!_0x19e5d4[_0x3e98('0x2e')][_0x3e98('0x35')](_0x3e98('0x36'))){_0x7964e6['limit']=qs[_0x3e98('0x1d')](_0x19e5d4[_0x3e98('0x2e')][_0x3e98('0x1d')]);_0x7964e6[_0x3e98('0x1b')]=qs[_0x3e98('0x1b')](_0x19e5d4[_0x3e98('0x2e')][_0x3e98('0x1b')]);}_0x7964e6[_0x3e98('0x37')]=qs['sort'](_0x19e5d4['query'][_0x3e98('0x38')]);_0x7964e6[_0x3e98('0x39')]=qs[_0x3e98('0x30')](_['pick'](_0x19e5d4[_0x3e98('0x2e')],_0xdfb5a1[_0x3e98('0x30')]),_0xcbb278);if(_0x19e5d4[_0x3e98('0x2e')]['filter']){_0x7964e6['where']=_[_0x3e98('0x3a')](_0x7964e6['where'],{'$or':_[_0x3e98('0x29')](_0xcbb278,function(_0x421812){if(_0x421812[_0x3e98('0x2c')]!==_0x3e98('0x3b')){var _0x789c3c={};_0x789c3c[_0x421812[_0x3e98('0x27')]]={'$like':'%'+_0x19e5d4[_0x3e98('0x2e')][_0x3e98('0x3c')]+'%'};return _0x789c3c;}})});}_0x7964e6=_[_0x3e98('0x3a')]({},_0x7964e6,_0x19e5d4[_0x3e98('0x3d')]);var _0x56409d={'where':_0x7964e6['where']};return db[_0x3e98('0x3e')][_0x3e98('0x1e')](_0x56409d)[_0x3e98('0x24')](function(_0x46eb5d){_0xa274cd[_0x3e98('0x1e')]=_0x46eb5d;if(_0x19e5d4[_0x3e98('0x2e')][_0x3e98('0x3f')]){_0x7964e6[_0x3e98('0x40')]=[{'all':!![]}];}return db['SmsQueueReport']['findAll'](_0x7964e6);})[_0x3e98('0x24')](function(_0x1e28b2){_0xa274cd[_0x3e98('0x41')]=_0x1e28b2;return _0xa274cd;})['then'](respondWithFilteredResult(_0x3b5e13,_0x7964e6))['catch'](handleError(_0x3b5e13,null));};exports[_0x3e98('0x42')]=function(_0x330e3c,_0x32fc46){var _0x35facc={'raw':!![],'where':{'id':_0x330e3c[_0x3e98('0x43')]['id']}},_0x16e457={};_0x16e457[_0x3e98('0x2d')]=_[_0x3e98('0x2f')](db[_0x3e98('0x3e')]['rawAttributes']);_0x16e457['query']=_[_0x3e98('0x2f')](_0x330e3c['query']);_0x16e457[_0x3e98('0x30')]=_[_0x3e98('0x31')](_0x16e457[_0x3e98('0x2d')],_0x16e457[_0x3e98('0x2e')]);_0x35facc['attributes']=_[_0x3e98('0x31')](_0x16e457[_0x3e98('0x2d')],qs[_0x3e98('0x32')](_0x330e3c[_0x3e98('0x2e')]['fields']));_0x35facc['attributes']=_0x35facc[_0x3e98('0x33')][_0x3e98('0x34')]?_0x35facc['attributes']:_0x16e457[_0x3e98('0x2d')];if(_0x330e3c[_0x3e98('0x2e')]['includeAll']){_0x35facc[_0x3e98('0x40')]=[{'all':!![]}];}_0x35facc=_[_0x3e98('0x3a')]({},_0x35facc,_0x330e3c['options']);return db[_0x3e98('0x3e')][_0x3e98('0x44')](_0x35facc)[_0x3e98('0x24')](handleEntityNotFound(_0x32fc46,null))[_0x3e98('0x24')](respondWithResult(_0x32fc46,null))[_0x3e98('0x45')](handleError(_0x32fc46,null));};exports[_0x3e98('0x46')]=function(_0x4875a2,_0x37cb95){return db[_0x3e98('0x3e')][_0x3e98('0x46')](_0x4875a2[_0x3e98('0x47')],{})[_0x3e98('0x24')](respondWithResult(_0x37cb95,0xc9))[_0x3e98('0x45')](handleError(_0x37cb95,null));};exports['update']=function(_0x1267a7,_0x57e419){if(_0x1267a7[_0x3e98('0x47')]['id']){delete _0x1267a7[_0x3e98('0x47')]['id'];}return db[_0x3e98('0x3e')]['find']({'where':{'id':_0x1267a7[_0x3e98('0x43')]['id']}})['then'](handleEntityNotFound(_0x57e419,null))[_0x3e98('0x24')](saveUpdates(_0x1267a7['body'],null))['then'](respondWithResult(_0x57e419,null))[_0x3e98('0x45')](handleError(_0x57e419,null));};exports['destroy']=function(_0x121383,_0x4091c9){return db[_0x3e98('0x3e')]['find']({'where':{'id':_0x121383['params']['id']}})[_0x3e98('0x24')](handleEntityNotFound(_0x4091c9,null))['then'](removeEntity(_0x4091c9,null))[_0x3e98('0x45')](handleError(_0x4091c9,null));};exports[_0x3e98('0x48')]=function(_0x2e5a07,_0x538a22){return db[_0x3e98('0x3e')]['describe']()[_0x3e98('0x24')](respondWithResult(_0x538a22,null))[_0x3e98('0x45')](handleError(_0x538a22,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 3e795c3..1fb9fcb 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 _0xbaf0=['define','SmsQueueReport','report_sms_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x4e1de1,_0x5315be){var _0x4b3173=function(_0x104dd6){while(--_0x104dd6){_0x4e1de1['push'](_0x4e1de1['shift']());}};_0x4b3173(++_0x5315be);}(_0xbaf0,0x12a));var _0x0baf=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbaf0[_0x465028];return _0xb783d4;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0baf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['define','SmsQueueReport','uniqueid','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xa9e0[_0x55f8b4];return _0x2475f9;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0a9e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 67eb881..a41614c 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 _0x0ace=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SmsQueueReport,\x20%s,\x20%s','message','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','UpdateSmsQueueReport','update','where','attributes','limit','lodash'];(function(_0x4f6f84,_0x31e197){var _0x20d989=function(_0x34db70){while(--_0x34db70){_0x4f6f84['push'](_0x4f6f84['shift']());}};_0x20d989(++_0x31e197);}(_0x0ace,0x1c6));var _0xe0ac=function(_0x220d63,_0x2ac173){_0x220d63=_0x220d63-0x0;var _0xffccaa=_0x0ace[_0x220d63];return _0xffccaa;};'use strict';var _=require(_0xe0ac('0x0'));var util=require(_0xe0ac('0x1'));var moment=require(_0xe0ac('0x2'));var BPromise=require(_0xe0ac('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe0ac('0x4'));var db=require(_0xe0ac('0x5'))['db'];var utils=require(_0xe0ac('0x6'));var logger=require(_0xe0ac('0x7'))(_0xe0ac('0x8'));var config=require(_0xe0ac('0x9'));var jayson=require(_0xe0ac('0xa'));var client=jayson[_0xe0ac('0xb')][_0xe0ac('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x18102a,_0x25a231,_0x4b4a4d){return new BPromise(function(_0x45f3dd,_0xda0f45){return client[_0xe0ac('0xd')](_0x18102a,_0x4b4a4d)[_0xe0ac('0xe')](function(_0xa59797){logger[_0xe0ac('0xf')]('SmsQueueReport,\x20%s,\x20%s',_0x25a231,'request\x20sent');logger[_0xe0ac('0x10')](_0xe0ac('0x11'),_0x25a231,_0xe0ac('0x12'),JSON[_0xe0ac('0x13')](_0xa59797));if(_0xa59797[_0xe0ac('0x14')]){if(_0xa59797[_0xe0ac('0x14')][_0xe0ac('0x15')]===0x1f4){logger['error'](_0xe0ac('0x16'),_0x25a231,_0xa59797[_0xe0ac('0x14')][_0xe0ac('0x17')]);return _0xda0f45(_0xa59797[_0xe0ac('0x14')][_0xe0ac('0x17')]);}logger[_0xe0ac('0x14')](_0xe0ac('0x16'),_0x25a231,_0xa59797[_0xe0ac('0x14')]['message']);return _0x45f3dd(_0xa59797[_0xe0ac('0x14')][_0xe0ac('0x17')]);}else{logger[_0xe0ac('0xf')]('SmsQueueReport,\x20%s,\x20%s',_0x25a231,_0xe0ac('0x12'));_0x45f3dd(_0xa59797['result'][_0xe0ac('0x17')]);}})[_0xe0ac('0x18')](function(_0x1d15f6){logger[_0xe0ac('0x14')](_0xe0ac('0x16'),_0x25a231,_0x1d15f6);_0xda0f45(_0x1d15f6);});});}exports[_0xe0ac('0x19')]=function(_0x2c0686){var _0x5c3f5a=this;return new Promise(function(_0x174f0e,_0x289a13){return db[_0xe0ac('0x1a')][_0xe0ac('0x1b')](_0x2c0686[_0xe0ac('0x1c')],{'raw':_0x2c0686[_0xe0ac('0x1d')]?_0x2c0686[_0xe0ac('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0xe0ac('0xe')](function(_0x2b22a1){logger[_0xe0ac('0xf')](_0xe0ac('0x19'),_0x2c0686);logger['debug']('CreateSmsQueueReport',_0x2c0686,JSON[_0xe0ac('0x13')](_0x2b22a1));_0x174f0e(_0x2b22a1);})['catch'](function(_0x3987e0){logger[_0xe0ac('0x14')]('CreateSmsQueueReport',_0x3987e0[_0xe0ac('0x17')],_0x2c0686);_0x289a13(_0x5c3f5a[_0xe0ac('0x14')](0x1f4,_0x3987e0[_0xe0ac('0x17')]));});});};exports[_0xe0ac('0x1e')]=function(_0xb2b2eb){var _0x434661=this;return new Promise(function(_0x513eee,_0x48ad65){return db[_0xe0ac('0x1a')][_0xe0ac('0x1f')](_0xb2b2eb[_0xe0ac('0x1c')],{'raw':_0xb2b2eb[_0xe0ac('0x1d')]?_0xb2b2eb['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb2b2eb[_0xe0ac('0x1d')]?_0xb2b2eb[_0xe0ac('0x1d')][_0xe0ac('0x20')]||null:null,'attributes':_0xb2b2eb[_0xe0ac('0x1d')]?_0xb2b2eb[_0xe0ac('0x1d')][_0xe0ac('0x21')]||null:null,'limit':_0xb2b2eb[_0xe0ac('0x1d')]?_0xb2b2eb[_0xe0ac('0x1d')][_0xe0ac('0x22')]||null:null})[_0xe0ac('0xe')](function(_0x19822d){logger[_0xe0ac('0xf')](_0xe0ac('0x1e'),_0xb2b2eb);logger[_0xe0ac('0x10')](_0xe0ac('0x1e'),_0xb2b2eb,JSON['stringify'](_0x19822d));_0x513eee(_0x19822d);})['catch'](function(_0x48eca5){logger['error'](_0xe0ac('0x1e'),_0x48eca5[_0xe0ac('0x17')],_0xb2b2eb);_0x48ad65(_0x434661['error'](0x1f4,_0x48eca5[_0xe0ac('0x17')]));});});}; \ No newline at end of file +var _0x6e67=['error','code','message','SmsQueueReport,\x20%s,\x20%s','result','catch','CreateSmsQueueReport','SmsQueueReport','options','UpdateSmsQueueReport','raw','where','attributes','limit','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x12ae59,_0x3ea991){var _0x6ecbc0=function(_0x359649){while(--_0x359649){_0x12ae59['push'](_0x12ae59['shift']());}};_0x6ecbc0(++_0x3ea991);}(_0x6e67,0xe7));var _0x76e6=function(_0x2d489a,_0x25ce3c){_0x2d489a=_0x2d489a-0x0;var _0x11b301=_0x6e67[_0x2d489a];return _0x11b301;};'use strict';var _=require(_0x76e6('0x0'));var util=require(_0x76e6('0x1'));var moment=require(_0x76e6('0x2'));var BPromise=require('bluebird');var rs=require(_0x76e6('0x3'));var fs=require('fs');var Redis=require(_0x76e6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x76e6('0x5'));var logger=require(_0x76e6('0x6'))(_0x76e6('0x7'));var config=require(_0x76e6('0x8'));var jayson=require(_0x76e6('0x9'));var client=jayson['client'][_0x76e6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3ac78e,_0x25b79f,_0x176e6b){return new BPromise(function(_0x13f85d,_0x8d46be){return client['request'](_0x3ac78e,_0x176e6b)[_0x76e6('0xb')](function(_0x33a770){logger[_0x76e6('0xc')]('SmsQueueReport,\x20%s,\x20%s',_0x25b79f,_0x76e6('0xd'));logger[_0x76e6('0xe')](_0x76e6('0xf'),_0x25b79f,'request\x20sent',JSON[_0x76e6('0x10')](_0x33a770));if(_0x33a770[_0x76e6('0x11')]){if(_0x33a770[_0x76e6('0x11')][_0x76e6('0x12')]===0x1f4){logger[_0x76e6('0x11')]('SmsQueueReport,\x20%s,\x20%s',_0x25b79f,_0x33a770[_0x76e6('0x11')]['message']);return _0x8d46be(_0x33a770['error'][_0x76e6('0x13')]);}logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x25b79f,_0x33a770[_0x76e6('0x11')][_0x76e6('0x13')]);return _0x13f85d(_0x33a770[_0x76e6('0x11')][_0x76e6('0x13')]);}else{logger[_0x76e6('0xc')](_0x76e6('0x14'),_0x25b79f,_0x76e6('0xd'));_0x13f85d(_0x33a770[_0x76e6('0x15')][_0x76e6('0x13')]);}})[_0x76e6('0x16')](function(_0x237291){logger[_0x76e6('0x11')](_0x76e6('0x14'),_0x25b79f,_0x237291);_0x8d46be(_0x237291);});});}exports[_0x76e6('0x17')]=function(_0x327564){var _0x12c755=this;return new Promise(function(_0x345345,_0x3c577c){return db[_0x76e6('0x18')]['create'](_0x327564['body'],{'raw':_0x327564[_0x76e6('0x19')]?_0x327564[_0x76e6('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x76e6('0xb')](function(_0x3dce83){logger[_0x76e6('0xc')](_0x76e6('0x17'),_0x327564);logger[_0x76e6('0xe')](_0x76e6('0x17'),_0x327564,JSON[_0x76e6('0x10')](_0x3dce83));_0x345345(_0x3dce83);})['catch'](function(_0x1bc058){logger[_0x76e6('0x11')]('CreateSmsQueueReport',_0x1bc058[_0x76e6('0x13')],_0x327564);_0x3c577c(_0x12c755[_0x76e6('0x11')](0x1f4,_0x1bc058[_0x76e6('0x13')]));});});};exports[_0x76e6('0x1a')]=function(_0x2a2447){var _0xea8abf=this;return new Promise(function(_0x3bd73c,_0x4c8a2c){return db['SmsQueueReport']['update'](_0x2a2447['body'],{'raw':_0x2a2447['options']?_0x2a2447[_0x76e6('0x19')][_0x76e6('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a2447[_0x76e6('0x19')]?_0x2a2447[_0x76e6('0x19')][_0x76e6('0x1c')]||null:null,'attributes':_0x2a2447['options']?_0x2a2447['options'][_0x76e6('0x1d')]||null:null,'limit':_0x2a2447['options']?_0x2a2447['options'][_0x76e6('0x1e')]||null:null})[_0x76e6('0xb')](function(_0x4a9bf6){logger[_0x76e6('0xc')]('UpdateSmsQueueReport',_0x2a2447);logger[_0x76e6('0xe')](_0x76e6('0x1a'),_0x2a2447,JSON[_0x76e6('0x10')](_0x4a9bf6));_0x3bd73c(_0x4a9bf6);})['catch'](function(_0x6309ef){logger[_0x76e6('0x11')]('UpdateSmsQueueReport',_0x6309ef[_0x76e6('0x13')],_0x2a2447);_0x4c8a2c(_0xea8abf[_0x76e6('0x11')](0x1f4,_0x6309ef[_0x76e6('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index e72f5c8..528c69a 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 _0xf69d=['./smsTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0xf69d,0xd3));var _0xdf69=function(_0x55ea20,_0x1d6e5f){_0x55ea20=_0x55ea20-0x0;var _0x4e419e=_0xf69d[_0x55ea20];return _0x4e419e;};'use strict';var multer=require(_0xdf69('0x0'));var util=require(_0xdf69('0x1'));var path=require(_0xdf69('0x2'));var timeout=require(_0xdf69('0x3'));var express=require(_0xdf69('0x4'));var router=express['Router']();var fs_extra=require(_0xdf69('0x5'));var auth=require(_0xdf69('0x6'));var interaction=require(_0xdf69('0x7'));var config=require(_0xdf69('0x8'));var controller=require(_0xdf69('0x9'));router[_0xdf69('0xa')]('/',auth[_0xdf69('0xb')](),controller[_0xdf69('0xc')]);router[_0xdf69('0xa')](_0xdf69('0xd'),auth[_0xdf69('0xb')](),controller[_0xdf69('0xe')]);router[_0xdf69('0xa')](_0xdf69('0xf'),auth[_0xdf69('0xb')](),controller[_0xdf69('0x10')]);router[_0xdf69('0x11')]('/',auth['isAuthenticated'](),controller[_0xdf69('0x12')]);router[_0xdf69('0x13')](_0xdf69('0xf'),auth[_0xdf69('0xb')](),controller[_0xdf69('0x14')]);router[_0xdf69('0x15')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x277c=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','describe','/:id','show','post','create','update','delete','destroy','multer','path','connect-timeout'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x277c,0x153));var _0xc277=function(_0x39a6c7,_0x4f2423){_0x39a6c7=_0x39a6c7-0x0;var _0x3f789b=_0x277c[_0x39a6c7];return _0x3f789b;};'use strict';var multer=require(_0xc277('0x0'));var util=require('util');var path=require(_0xc277('0x1'));var timeout=require(_0xc277('0x2'));var express=require(_0xc277('0x3'));var router=express[_0xc277('0x4')]();var fs_extra=require(_0xc277('0x5'));var auth=require(_0xc277('0x6'));var interaction=require(_0xc277('0x7'));var config=require(_0xc277('0x8'));var controller=require('./smsTransferReport.controller');router['get']('/',auth[_0xc277('0x9')](),controller['index']);router[_0xc277('0xa')]('/describe',auth[_0xc277('0x9')](),controller[_0xc277('0xb')]);router['get'](_0xc277('0xc'),auth[_0xc277('0x9')](),controller[_0xc277('0xd')]);router[_0xc277('0xe')]('/',auth[_0xc277('0x9')](),controller[_0xc277('0xf')]);router['put']('/:id',auth[_0xc277('0x9')](),controller[_0xc277('0x10')]);router[_0xc277('0x11')](_0xc277('0xc'),auth['isAuthenticated'](),controller[_0xc277('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 8f3aa98..c534cf4 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 _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x191dff,_0xb60d16){var _0x410a43=function(_0x25ccdc){while(--_0x25ccdc){_0x191dff['push'](_0x191dff['shift']());}};_0x410a43(++_0xb60d16);}(_0xa9e0,0x123));var _0x0a9e=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xa9e0[_0x12d033];return _0x3b4e80;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file +var _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x4857dd,_0x11b507){var _0x33589c=function(_0x1cabce){while(--_0x1cabce){_0x4857dd['push'](_0x4857dd['shift']());}};_0x33589c(++_0x11b507);}(_0x008c,0x188));var _0xc008=function(_0x2e1051,_0x58b01d){_0x2e1051=_0x2e1051-0x0;var _0x5aa734=_0x008c[_0x2e1051];return _0x5aa734;};'use strict';var moment=require(_0xc008('0x0'));var Sequelize=require(_0xc008('0x1'));module[_0xc008('0x2')]={'uniqueid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc008('0x4')]('account',_0xc008('0x5'),_0xc008('0x6')),'allowNull':![],'defaultValue':_0xc008('0x6')},'transferredAt':{'type':Sequelize[_0xc008('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc008('0x8')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 0ece1fb..d9c0dc1 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 _0x47f3=['then','destroy','stack','name','send','map','SmsTransferReport','rawAttributes','fieldName','type','keys','filters','query','attributes','intersection','model','fields','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x47f3,0x14b));var _0x347f=function(_0x43eaeb,_0x419a9d){_0x43eaeb=_0x43eaeb-0x0;var _0x13f774=_0x47f3[_0x43eaeb];return _0x13f774;};'use strict';var emlformat=require(_0x347f('0x0'));var rimraf=require(_0x347f('0x1'));var zipdir=require(_0x347f('0x2'));var jsonpatch=require(_0x347f('0x3'));var rp=require('request-promise');var moment=require(_0x347f('0x4'));var BPromise=require(_0x347f('0x5'));var Mustache=require(_0x347f('0x6'));var util=require(_0x347f('0x7'));var path=require(_0x347f('0x8'));var sox=require(_0x347f('0x9'));var csv=require(_0x347f('0xa'));var ejs=require(_0x347f('0xb'));var fs=require('fs');var fs_extra=require(_0x347f('0xc'));var _=require('lodash');var squel=require(_0x347f('0xd'));var crypto=require('crypto');var jsforce=require(_0x347f('0xe'));var deskjs=require(_0x347f('0xf'));var toCsv=require(_0x347f('0xa'));var querystring=require(_0x347f('0x10'));var Papa=require(_0x347f('0x11'));var Redis=require(_0x347f('0x12'));var authService=require(_0x347f('0x13'));var qs=require(_0x347f('0x14'));var as=require(_0x347f('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x347f('0x16'))(_0x347f('0x17'));var utils=require(_0x347f('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x347f('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x53db0d,_0xbb03cb){_0xbb03cb=_0xbb03cb||0xcc;return function(_0x142849){if(_0x142849){return _0x53db0d['sendStatus'](_0xbb03cb);}return _0x53db0d[_0x347f('0x1a')](_0xbb03cb)[_0x347f('0x1b')]();};}function respondWithResult(_0x9df003,_0x4160af){_0x4160af=_0x4160af||0xc8;return function(_0x5067bd){if(_0x5067bd){return _0x9df003['status'](_0x4160af)[_0x347f('0x1c')](_0x5067bd);}};}function respondWithFilteredResult(_0x3eae70,_0x200701){return function(_0x4ca35a){if(_0x4ca35a){var _0x4101b0=typeof _0x200701[_0x347f('0x1d')]===_0x347f('0x1e')&&typeof _0x200701[_0x347f('0x1f')]===_0x347f('0x1e');var _0x124d7e=_0x4ca35a[_0x347f('0x20')];var _0x577884=_0x4101b0?0x0:_0x200701[_0x347f('0x1d')];var _0x52101c=_0x4101b0?_0x4ca35a[_0x347f('0x20')]:_0x200701['offset']+_0x200701['limit'];var _0x3cfb26;if(_0x52101c>=_0x124d7e){_0x52101c=_0x124d7e;_0x3cfb26=0xc8;}else{_0x3cfb26=0xce;}_0x3eae70[_0x347f('0x1a')](_0x3cfb26);return _0x3eae70[_0x347f('0x21')](_0x347f('0x22'),_0x577884+'-'+_0x52101c+'/'+_0x124d7e)['json'](_0x4ca35a);}return null;};}function patchUpdates(_0x5a732c){return function(_0x3787e1){try{jsonpatch[_0x347f('0x23')](_0x3787e1,_0x5a732c,!![]);}catch(_0x5c5cf9){return BPromise[_0x347f('0x24')](_0x5c5cf9);}return _0x3787e1[_0x347f('0x25')]();};}function saveUpdates(_0x1283d5,_0x52d60b){return function(_0x181417){if(_0x181417){return _0x181417[_0x347f('0x26')](_0x1283d5)[_0x347f('0x27')](function(_0x2a4d03){return _0x2a4d03;});}return null;};}function removeEntity(_0x4fae1c,_0x4e93ae){return function(_0x33ac5b){if(_0x33ac5b){return _0x33ac5b[_0x347f('0x28')]()[_0x347f('0x27')](function(){_0x4fae1c[_0x347f('0x1a')](0xcc)[_0x347f('0x1b')]();});}};}function handleEntityNotFound(_0x327f6b,_0x353233){return function(_0x1b4e05){if(!_0x1b4e05){_0x327f6b['sendStatus'](0x194);}return _0x1b4e05;};}function handleError(_0x1b80a8,_0x1061d1){_0x1061d1=_0x1061d1||0x1f4;return function(_0x30247c){logger['error'](_0x30247c[_0x347f('0x29')]);if(_0x30247c[_0x347f('0x2a')]){delete _0x30247c['name'];}_0x1b80a8[_0x347f('0x1a')](_0x1061d1)[_0x347f('0x2b')](_0x30247c);};}exports['index']=function(_0x1072ea,_0x470d22){var _0xcadb11={},_0x434f5f={},_0x21c737={'count':0x0,'rows':[]};var _0x44e3b9=_[_0x347f('0x2c')](db[_0x347f('0x2d')][_0x347f('0x2e')],function(_0x5ee06b){return{'name':_0x5ee06b[_0x347f('0x2f')],'type':_0x5ee06b[_0x347f('0x30')]['key']};});_0x434f5f['model']=_[_0x347f('0x2c')](_0x44e3b9,_0x347f('0x2a'));_0x434f5f['query']=_[_0x347f('0x31')](_0x1072ea['query']);_0x434f5f[_0x347f('0x32')]=_['intersection'](_0x434f5f['model'],_0x434f5f[_0x347f('0x33')]);_0xcadb11[_0x347f('0x34')]=_[_0x347f('0x35')](_0x434f5f[_0x347f('0x36')],qs[_0x347f('0x37')](_0x1072ea[_0x347f('0x33')][_0x347f('0x37')]));_0xcadb11[_0x347f('0x34')]=_0xcadb11[_0x347f('0x34')]['length']?_0xcadb11[_0x347f('0x34')]:_0x434f5f[_0x347f('0x36')];if(!_0x1072ea[_0x347f('0x33')]['hasOwnProperty']('nolimit')){_0xcadb11[_0x347f('0x1f')]=qs[_0x347f('0x1f')](_0x1072ea[_0x347f('0x33')][_0x347f('0x1f')]);_0xcadb11[_0x347f('0x1d')]=qs[_0x347f('0x1d')](_0x1072ea['query'][_0x347f('0x1d')]);}_0xcadb11['order']=qs[_0x347f('0x38')](_0x1072ea[_0x347f('0x33')][_0x347f('0x38')]);_0xcadb11[_0x347f('0x39')]=qs['filters'](_[_0x347f('0x3a')](_0x1072ea[_0x347f('0x33')],_0x434f5f[_0x347f('0x32')]),_0x44e3b9);if(_0x1072ea[_0x347f('0x33')]['filter']){_0xcadb11[_0x347f('0x39')]=_[_0x347f('0x3b')](_0xcadb11[_0x347f('0x39')],{'$or':_[_0x347f('0x2c')](_0x44e3b9,function(_0x1dbd53){if(_0x1dbd53[_0x347f('0x30')]!==_0x347f('0x3c')){var _0x2f6c3f={};_0x2f6c3f[_0x1dbd53[_0x347f('0x2a')]]={'$like':'%'+_0x1072ea[_0x347f('0x33')]['filter']+'%'};return _0x2f6c3f;}})});}_0xcadb11=_[_0x347f('0x3b')]({},_0xcadb11,_0x1072ea[_0x347f('0x3d')]);var _0xcfc5b3={'where':_0xcadb11[_0x347f('0x39')]};return db['SmsTransferReport'][_0x347f('0x20')](_0xcfc5b3)[_0x347f('0x27')](function(_0x15b1b1){_0x21c737['count']=_0x15b1b1;if(_0x1072ea[_0x347f('0x33')][_0x347f('0x3e')]){_0xcadb11[_0x347f('0x3f')]=[{'all':!![]}];}return db[_0x347f('0x2d')][_0x347f('0x40')](_0xcadb11);})[_0x347f('0x27')](function(_0x53ac0e){_0x21c737[_0x347f('0x41')]=_0x53ac0e;return _0x21c737;})[_0x347f('0x27')](respondWithFilteredResult(_0x470d22,_0xcadb11))[_0x347f('0x42')](handleError(_0x470d22,null));};exports[_0x347f('0x43')]=function(_0x506b37,_0xbfc84b){var _0x5594f6={'raw':!![],'where':{'id':_0x506b37[_0x347f('0x44')]['id']}},_0x422c7c={};_0x422c7c['model']=_[_0x347f('0x31')](db[_0x347f('0x2d')][_0x347f('0x2e')]);_0x422c7c[_0x347f('0x33')]=_[_0x347f('0x31')](_0x506b37[_0x347f('0x33')]);_0x422c7c[_0x347f('0x32')]=_[_0x347f('0x35')](_0x422c7c[_0x347f('0x36')],_0x422c7c[_0x347f('0x33')]);_0x5594f6['attributes']=_[_0x347f('0x35')](_0x422c7c[_0x347f('0x36')],qs[_0x347f('0x37')](_0x506b37['query']['fields']));_0x5594f6[_0x347f('0x34')]=_0x5594f6[_0x347f('0x34')][_0x347f('0x45')]?_0x5594f6[_0x347f('0x34')]:_0x422c7c[_0x347f('0x36')];if(_0x506b37[_0x347f('0x33')][_0x347f('0x3e')]){_0x5594f6[_0x347f('0x3f')]=[{'all':!![]}];}_0x5594f6=_['merge']({},_0x5594f6,_0x506b37[_0x347f('0x3d')]);return db[_0x347f('0x2d')]['find'](_0x5594f6)[_0x347f('0x27')](handleEntityNotFound(_0xbfc84b,null))[_0x347f('0x27')](respondWithResult(_0xbfc84b,null))[_0x347f('0x42')](handleError(_0xbfc84b,null));};exports['create']=function(_0x4d9e4a,_0x44e597){return db[_0x347f('0x2d')][_0x347f('0x46')](_0x4d9e4a[_0x347f('0x47')],{})[_0x347f('0x27')](respondWithResult(_0x44e597,0xc9))[_0x347f('0x42')](handleError(_0x44e597,null));};exports[_0x347f('0x26')]=function(_0x46b03b,_0x14e132){if(_0x46b03b[_0x347f('0x47')]['id']){delete _0x46b03b[_0x347f('0x47')]['id'];}return db[_0x347f('0x2d')][_0x347f('0x48')]({'where':{'id':_0x46b03b[_0x347f('0x44')]['id']}})['then'](handleEntityNotFound(_0x14e132,null))[_0x347f('0x27')](saveUpdates(_0x46b03b[_0x347f('0x47')],null))[_0x347f('0x27')](respondWithResult(_0x14e132,null))[_0x347f('0x42')](handleError(_0x14e132,null));};exports[_0x347f('0x28')]=function(_0x1bce59,_0x175f53){return db['SmsTransferReport'][_0x347f('0x48')]({'where':{'id':_0x1bce59['params']['id']}})[_0x347f('0x27')](handleEntityNotFound(_0x175f53,null))[_0x347f('0x27')](removeEntity(_0x175f53,null))[_0x347f('0x42')](handleError(_0x175f53,null));};exports['describe']=function(_0x282d9a,_0x127739){return db[_0x347f('0x2d')][_0x347f('0x49')]()[_0x347f('0x27')](respondWithResult(_0x127739,null))['catch'](handleError(_0x127739,null));}; \ No newline at end of file +var _0x7ef7=['offset','undefined','limit','count','set','apply','reject','save','update','then','error','stack','name','send','index','map','rawAttributes','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','SmsTransferReport','rows','catch','show','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x368587,_0x1b6554){var _0x42d33c=function(_0xfdccf){while(--_0xfdccf){_0x368587['push'](_0x368587['shift']());}};_0x42d33c(++_0x1b6554);}(_0x7ef7,0x7e));var _0x77ef=function(_0x38518d,_0x35ecfe){_0x38518d=_0x38518d-0x0;var _0x40705b=_0x7ef7[_0x38518d];return _0x40705b;};'use strict';var emlformat=require(_0x77ef('0x0'));var rimraf=require(_0x77ef('0x1'));var zipdir=require(_0x77ef('0x2'));var jsonpatch=require(_0x77ef('0x3'));var rp=require(_0x77ef('0x4'));var moment=require(_0x77ef('0x5'));var BPromise=require(_0x77ef('0x6'));var Mustache=require(_0x77ef('0x7'));var util=require('util');var path=require(_0x77ef('0x8'));var sox=require(_0x77ef('0x9'));var csv=require(_0x77ef('0xa'));var ejs=require(_0x77ef('0xb'));var fs=require('fs');var fs_extra=require(_0x77ef('0xc'));var _=require(_0x77ef('0xd'));var squel=require(_0x77ef('0xe'));var crypto=require(_0x77ef('0xf'));var jsforce=require(_0x77ef('0x10'));var deskjs=require(_0x77ef('0x11'));var toCsv=require(_0x77ef('0xa'));var querystring=require(_0x77ef('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x77ef('0x13'));var qs=require(_0x77ef('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x77ef('0x15'));var logger=require(_0x77ef('0x16'))('api');var utils=require(_0x77ef('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x77ef('0x18'));var db=require(_0x77ef('0x19'))['db'];function respondWithStatusCode(_0xdc5628,_0x4381a9){_0x4381a9=_0x4381a9||0xcc;return function(_0x25f1d4){if(_0x25f1d4){return _0xdc5628[_0x77ef('0x1a')](_0x4381a9);}return _0xdc5628[_0x77ef('0x1b')](_0x4381a9)[_0x77ef('0x1c')]();};}function respondWithResult(_0x5504ee,_0x5aee29){_0x5aee29=_0x5aee29||0xc8;return function(_0x1b58e0){if(_0x1b58e0){return _0x5504ee[_0x77ef('0x1b')](_0x5aee29)[_0x77ef('0x1d')](_0x1b58e0);}};}function respondWithFilteredResult(_0x1a5d8d,_0x168804){return function(_0x29e17c){if(_0x29e17c){var _0x8e1a04=typeof _0x168804[_0x77ef('0x1e')]===_0x77ef('0x1f')&&typeof _0x168804[_0x77ef('0x20')]===_0x77ef('0x1f');var _0x1a74d0=_0x29e17c['count'];var _0x1f2453=_0x8e1a04?0x0:_0x168804[_0x77ef('0x1e')];var _0x5de831=_0x8e1a04?_0x29e17c[_0x77ef('0x21')]:_0x168804[_0x77ef('0x1e')]+_0x168804[_0x77ef('0x20')];var _0x4a89bc;if(_0x5de831>=_0x1a74d0){_0x5de831=_0x1a74d0;_0x4a89bc=0xc8;}else{_0x4a89bc=0xce;}_0x1a5d8d[_0x77ef('0x1b')](_0x4a89bc);return _0x1a5d8d[_0x77ef('0x22')]('Content-Range',_0x1f2453+'-'+_0x5de831+'/'+_0x1a74d0)[_0x77ef('0x1d')](_0x29e17c);}return null;};}function patchUpdates(_0x581c48){return function(_0x2c757c){try{jsonpatch[_0x77ef('0x23')](_0x2c757c,_0x581c48,!![]);}catch(_0x3b3eb9){return BPromise[_0x77ef('0x24')](_0x3b3eb9);}return _0x2c757c[_0x77ef('0x25')]();};}function saveUpdates(_0x2f5782,_0x5d9d1d){return function(_0x5aae71){if(_0x5aae71){return _0x5aae71[_0x77ef('0x26')](_0x2f5782)['then'](function(_0x576089){return _0x576089;});}return null;};}function removeEntity(_0x3cf17f,_0x6d5c2c){return function(_0x1cea7a){if(_0x1cea7a){return _0x1cea7a['destroy']()[_0x77ef('0x27')](function(){_0x3cf17f[_0x77ef('0x1b')](0xcc)[_0x77ef('0x1c')]();});}};}function handleEntityNotFound(_0x11e5f5,_0x45c6f3){return function(_0x225874){if(!_0x225874){_0x11e5f5['sendStatus'](0x194);}return _0x225874;};}function handleError(_0x368780,_0xb1d23e){_0xb1d23e=_0xb1d23e||0x1f4;return function(_0x51db41){logger[_0x77ef('0x28')](_0x51db41[_0x77ef('0x29')]);if(_0x51db41[_0x77ef('0x2a')]){delete _0x51db41['name'];}_0x368780[_0x77ef('0x1b')](_0xb1d23e)[_0x77ef('0x2b')](_0x51db41);};}exports[_0x77ef('0x2c')]=function(_0x3c3e29,_0x18151e){var _0x111848={},_0x5cb202={},_0x1ea39b={'count':0x0,'rows':[]};var _0x1844d7=_[_0x77ef('0x2d')](db['SmsTransferReport'][_0x77ef('0x2e')],function(_0x49d7fd){return{'name':_0x49d7fd['fieldName'],'type':_0x49d7fd['type'][_0x77ef('0x2f')]};});_0x5cb202[_0x77ef('0x30')]=_[_0x77ef('0x2d')](_0x1844d7,_0x77ef('0x2a'));_0x5cb202[_0x77ef('0x31')]=_[_0x77ef('0x32')](_0x3c3e29[_0x77ef('0x31')]);_0x5cb202[_0x77ef('0x33')]=_['intersection'](_0x5cb202[_0x77ef('0x30')],_0x5cb202[_0x77ef('0x31')]);_0x111848[_0x77ef('0x34')]=_[_0x77ef('0x35')](_0x5cb202[_0x77ef('0x30')],qs[_0x77ef('0x36')](_0x3c3e29[_0x77ef('0x31')][_0x77ef('0x36')]));_0x111848[_0x77ef('0x34')]=_0x111848[_0x77ef('0x34')][_0x77ef('0x37')]?_0x111848[_0x77ef('0x34')]:_0x5cb202[_0x77ef('0x30')];if(!_0x3c3e29[_0x77ef('0x31')][_0x77ef('0x38')](_0x77ef('0x39'))){_0x111848['limit']=qs[_0x77ef('0x20')](_0x3c3e29[_0x77ef('0x31')]['limit']);_0x111848['offset']=qs[_0x77ef('0x1e')](_0x3c3e29['query'][_0x77ef('0x1e')]);}_0x111848[_0x77ef('0x3a')]=qs[_0x77ef('0x3b')](_0x3c3e29[_0x77ef('0x31')]['sort']);_0x111848[_0x77ef('0x3c')]=qs[_0x77ef('0x33')](_[_0x77ef('0x3d')](_0x3c3e29[_0x77ef('0x31')],_0x5cb202[_0x77ef('0x33')]),_0x1844d7);if(_0x3c3e29['query'][_0x77ef('0x3e')]){_0x111848[_0x77ef('0x3c')]=_[_0x77ef('0x3f')](_0x111848[_0x77ef('0x3c')],{'$or':_['map'](_0x1844d7,function(_0x20b4a9){if(_0x20b4a9[_0x77ef('0x40')]!==_0x77ef('0x41')){var _0x56a5ea={};_0x56a5ea[_0x20b4a9[_0x77ef('0x2a')]]={'$like':'%'+_0x3c3e29[_0x77ef('0x31')][_0x77ef('0x3e')]+'%'};return _0x56a5ea;}})});}_0x111848=_[_0x77ef('0x3f')]({},_0x111848,_0x3c3e29[_0x77ef('0x42')]);var _0x84d677={'where':_0x111848[_0x77ef('0x3c')]};return db['SmsTransferReport'][_0x77ef('0x21')](_0x84d677)['then'](function(_0x302de6){_0x1ea39b['count']=_0x302de6;if(_0x3c3e29[_0x77ef('0x31')][_0x77ef('0x43')]){_0x111848[_0x77ef('0x44')]=[{'all':!![]}];}return db[_0x77ef('0x45')]['findAll'](_0x111848);})[_0x77ef('0x27')](function(_0x261d2){_0x1ea39b[_0x77ef('0x46')]=_0x261d2;return _0x1ea39b;})[_0x77ef('0x27')](respondWithFilteredResult(_0x18151e,_0x111848))[_0x77ef('0x47')](handleError(_0x18151e,null));};exports[_0x77ef('0x48')]=function(_0x5ca101,_0x781a0){var _0x218ab1={'raw':!![],'where':{'id':_0x5ca101['params']['id']}},_0x107282={};_0x107282[_0x77ef('0x30')]=_[_0x77ef('0x32')](db[_0x77ef('0x45')][_0x77ef('0x2e')]);_0x107282['query']=_[_0x77ef('0x32')](_0x5ca101[_0x77ef('0x31')]);_0x107282[_0x77ef('0x33')]=_[_0x77ef('0x35')](_0x107282[_0x77ef('0x30')],_0x107282[_0x77ef('0x31')]);_0x218ab1[_0x77ef('0x34')]=_['intersection'](_0x107282[_0x77ef('0x30')],qs[_0x77ef('0x36')](_0x5ca101[_0x77ef('0x31')][_0x77ef('0x36')]));_0x218ab1[_0x77ef('0x34')]=_0x218ab1['attributes'][_0x77ef('0x37')]?_0x218ab1[_0x77ef('0x34')]:_0x107282[_0x77ef('0x30')];if(_0x5ca101[_0x77ef('0x31')][_0x77ef('0x43')]){_0x218ab1['include']=[{'all':!![]}];}_0x218ab1=_[_0x77ef('0x3f')]({},_0x218ab1,_0x5ca101[_0x77ef('0x42')]);return db['SmsTransferReport'][_0x77ef('0x49')](_0x218ab1)[_0x77ef('0x27')](handleEntityNotFound(_0x781a0,null))[_0x77ef('0x27')](respondWithResult(_0x781a0,null))[_0x77ef('0x47')](handleError(_0x781a0,null));};exports[_0x77ef('0x4a')]=function(_0x292c32,_0x1b6339){return db[_0x77ef('0x45')][_0x77ef('0x4a')](_0x292c32[_0x77ef('0x4b')],{})[_0x77ef('0x27')](respondWithResult(_0x1b6339,0xc9))[_0x77ef('0x47')](handleError(_0x1b6339,null));};exports[_0x77ef('0x26')]=function(_0x582e93,_0xd0a5b6){if(_0x582e93['body']['id']){delete _0x582e93[_0x77ef('0x4b')]['id'];}return db[_0x77ef('0x45')][_0x77ef('0x49')]({'where':{'id':_0x582e93['params']['id']}})[_0x77ef('0x27')](handleEntityNotFound(_0xd0a5b6,null))['then'](saveUpdates(_0x582e93[_0x77ef('0x4b')],null))[_0x77ef('0x27')](respondWithResult(_0xd0a5b6,null))['catch'](handleError(_0xd0a5b6,null));};exports[_0x77ef('0x4c')]=function(_0x2f28ab,_0x1b6a6f){return db[_0x77ef('0x45')][_0x77ef('0x49')]({'where':{'id':_0x2f28ab['params']['id']}})[_0x77ef('0x27')](handleEntityNotFound(_0x1b6a6f,null))[_0x77ef('0x27')](removeEntity(_0x1b6a6f,null))[_0x77ef('0x47')](handleError(_0x1b6a6f,null));};exports[_0x77ef('0x4d')]=function(_0x2591bd,_0x197bd6){return db[_0x77ef('0x45')][_0x77ef('0x4d')]()[_0x77ef('0x27')](respondWithResult(_0x197bd6,null))[_0x77ef('0x47')](handleError(_0x197bd6,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 10fec49..7c643ee 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 _0xac15=['request-promise','path','../../config/environment','exports','SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','moment'];(function(_0x135083,_0x8f1013){var _0x5e7117=function(_0x553302){while(--_0x553302){_0x135083['push'](_0x135083['shift']());}};_0x5e7117(++_0x8f1013);}(_0xac15,0x11f));var _0x5ac1=function(_0x4fc3f1,_0x56b75f){_0x4fc3f1=_0x4fc3f1-0x0;var _0x4d6975=_0xac15[_0x4fc3f1];return _0x4d6975;};'use strict';var _=require(_0x5ac1('0x0'));var util=require(_0x5ac1('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x5ac1('0x2'));var BPromise=require('bluebird');var rp=require(_0x5ac1('0x3'));var fs=require('fs');var path=require(_0x5ac1('0x4'));var rimraf=require('rimraf');var config=require(_0x5ac1('0x5'));var attributes=require('./smsTransferReport.attributes');module[_0x5ac1('0x6')]=function(_0x2cf69b,_0x101ede){return _0x2cf69b['define'](_0x5ac1('0x7'),attributes,{'tableName':_0x5ac1('0x8'),'paranoid':![],'indexes':[{'name':_0x5ac1('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xa78e=['bluebird','request-promise','path','../../config/environment','./smsTransferReport.attributes','exports','SmsTransferReport','uniqueid','lodash','util','../../config/logger'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0xa78e,0x1e1));var _0xea78=function(_0x307973,_0x4cca2f){_0x307973=_0x307973-0x0;var _0xf9a85=_0xa78e[_0x307973];return _0xf9a85;};'use strict';var _=require(_0xea78('0x0'));var util=require(_0xea78('0x1'));var logger=require(_0xea78('0x2'))('api');var moment=require('moment');var BPromise=require(_0xea78('0x3'));var rp=require(_0xea78('0x4'));var fs=require('fs');var path=require(_0xea78('0x5'));var rimraf=require('rimraf');var config=require(_0xea78('0x6'));var attributes=require(_0xea78('0x7'));module[_0xea78('0x8')]=function(_0x3cb08c,_0x1c5825){return _0x3cb08c['define'](_0xea78('0x9'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0xea78('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index abf7b80..f3c839b 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 _0xf3ff=['error','code','message','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','SmsTransferReport,\x20%s,\x20%s','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x54fd2d,_0x4cb55e){var _0x5dff6c=function(_0x26b595){while(--_0x26b595){_0x54fd2d['push'](_0x54fd2d['shift']());}};_0x5dff6c(++_0x4cb55e);}(_0xf3ff,0xae));var _0xff3f=function(_0x133f37,_0x164849){_0x133f37=_0x133f37-0x0;var _0x2ff53d=_0xf3ff[_0x133f37];return _0x2ff53d;};'use strict';var _=require(_0xff3f('0x0'));var util=require('util');var moment=require(_0xff3f('0x1'));var BPromise=require(_0xff3f('0x2'));var rs=require(_0xff3f('0x3'));var fs=require('fs');var Redis=require(_0xff3f('0x4'));var db=require(_0xff3f('0x5'))['db'];var utils=require(_0xff3f('0x6'));var logger=require('../../config/logger')(_0xff3f('0x7'));var config=require(_0xff3f('0x8'));var jayson=require(_0xff3f('0x9'));var client=jayson['client'][_0xff3f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x45a86f,_0x5568d0,_0x465c8a){return new BPromise(function(_0x1543bf,_0x5c1d76){return client['request'](_0x45a86f,_0x465c8a)['then'](function(_0x34df96){logger['info'](_0xff3f('0xb'),_0x5568d0,'request\x20sent');logger[_0xff3f('0xc')](_0xff3f('0xd'),_0x5568d0,_0xff3f('0xe'),JSON[_0xff3f('0xf')](_0x34df96));if(_0x34df96[_0xff3f('0x10')]){if(_0x34df96[_0xff3f('0x10')][_0xff3f('0x11')]===0x1f4){logger[_0xff3f('0x10')](_0xff3f('0xb'),_0x5568d0,_0x34df96[_0xff3f('0x10')]['message']);return _0x5c1d76(_0x34df96['error'][_0xff3f('0x12')]);}logger[_0xff3f('0x10')](_0xff3f('0xb'),_0x5568d0,_0x34df96['error']['message']);return _0x1543bf(_0x34df96[_0xff3f('0x10')]['message']);}else{logger['info'](_0xff3f('0xb'),_0x5568d0,_0xff3f('0xe'));_0x1543bf(_0x34df96['result'][_0xff3f('0x12')]);}})['catch'](function(_0x129647){logger['error'](_0xff3f('0xb'),_0x5568d0,_0x129647);_0x5c1d76(_0x129647);});});} \ No newline at end of file +var _0x0309=['error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x411f03,_0x192c77){var _0x51ed81=function(_0x5dd252){while(--_0x5dd252){_0x411f03['push'](_0x411f03['shift']());}};_0x51ed81(++_0x192c77);}(_0x0309,0x165));var _0x9030=function(_0x59243b,_0x3f4731){_0x59243b=_0x59243b-0x0;var _0x1076d7=_0x0309[_0x59243b];return _0x1076d7;};'use strict';var _=require(_0x9030('0x0'));var util=require('util');var moment=require(_0x9030('0x1'));var BPromise=require('bluebird');var rs=require(_0x9030('0x2'));var fs=require('fs');var Redis=require(_0x9030('0x3'));var db=require(_0x9030('0x4'))['db'];var utils=require(_0x9030('0x5'));var logger=require(_0x9030('0x6'))(_0x9030('0x7'));var config=require(_0x9030('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9030('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x105c15,_0x4f2d84,_0xb53eb4){return new BPromise(function(_0x4e6c7b,_0x1e2360){return client[_0x9030('0xa')](_0x105c15,_0xb53eb4)[_0x9030('0xb')](function(_0x5711b4){logger[_0x9030('0xc')](_0x9030('0xd'),_0x4f2d84,_0x9030('0xe'));logger['debug'](_0x9030('0xf'),_0x4f2d84,_0x9030('0xe'),JSON[_0x9030('0x10')](_0x5711b4));if(_0x5711b4[_0x9030('0x11')]){if(_0x5711b4[_0x9030('0x11')][_0x9030('0x12')]===0x1f4){logger[_0x9030('0x11')]('SmsTransferReport,\x20%s,\x20%s',_0x4f2d84,_0x5711b4[_0x9030('0x11')][_0x9030('0x13')]);return _0x1e2360(_0x5711b4[_0x9030('0x11')][_0x9030('0x13')]);}logger['error'](_0x9030('0xd'),_0x4f2d84,_0x5711b4[_0x9030('0x11')][_0x9030('0x13')]);return _0x4e6c7b(_0x5711b4[_0x9030('0x11')][_0x9030('0x13')]);}else{logger[_0x9030('0xc')](_0x9030('0xd'),_0x4f2d84,_0x9030('0xe'));_0x4e6c7b(_0x5711b4[_0x9030('0x14')]['message']);}})[_0x9030('0x15')](function(_0x17e80d){logger[_0x9030('0x11')](_0x9030('0xd'),_0x4f2d84,_0x17e80d);_0x1e2360(_0x17e80d);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 3605b8c..a80466a 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 _0xd8c9=['now','post','single','put','update','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./sound.controller','get','/:id','isAuthenticated','download','join','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','extname'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0xd8c9,0xc3));var _0x9d8c=function(_0xe1e236,_0x2aa415){_0xe1e236=_0xe1e236-0x0;var _0x1855f3=_0xd8c9[_0xe1e236];return _0x1855f3;};'use strict';var multer=require(_0x9d8c('0x0'));var util=require(_0x9d8c('0x1'));var path=require(_0x9d8c('0x2'));var timeout=require(_0x9d8c('0x3'));var express=require(_0x9d8c('0x4'));var router=express[_0x9d8c('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x9d8c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9d8c('0x7'));var controller=require(_0x9d8c('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x9d8c('0x9')](_0x9d8c('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x9d8c('0x9')]('/:id/download',auth[_0x9d8c('0xb')](),controller[_0x9d8c('0xc')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x377af4,_0x13efe0,_0x693b70){_0x693b70(null,path[_0x9d8c('0xd')](config[_0x9d8c('0xe')],_0x9d8c('0xf')));},'filename':function(_0x728776,_0x6fc417,_0x3c10da){_0x6fc417[_0x9d8c('0x10')]=_0x6fc417[_0x9d8c('0x10')][_0x9d8c('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3c10da(null,util[_0x9d8c('0x12')](_0x9d8c('0x13'),path['basename'](_0x6fc417['originalname'],path[_0x9d8c('0x14')](_0x6fc417[_0x9d8c('0x10')])),Date[_0x9d8c('0x15')](),path[_0x9d8c('0x14')](_0x6fc417[_0x9d8c('0x10')])));}})});router[_0x9d8c('0x16')]('/',upload[_0x9d8c('0x17')]('file'),controller['create']);router[_0x9d8c('0x18')](_0x9d8c('0xa'),auth[_0x9d8c('0xb')](),controller[_0x9d8c('0x19')]);router[_0x9d8c('0x1a')](_0x9d8c('0xa'),auth[_0x9d8c('0xb')](),controller[_0x9d8c('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x8d8c=['replace','format','%s-%s%s','basename','extname','now','post','single','file','create','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/:id','show','diskStorage','root','originalname'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x8d8c,0x1dd));var _0xc8d8=function(_0x18e014,_0x593ba7){_0x18e014=_0x18e014-0x0;var _0x858ce3=_0x8d8c[_0x18e014];return _0x858ce3;};'use strict';var multer=require(_0xc8d8('0x0'));var util=require(_0xc8d8('0x1'));var path=require('path');var timeout=require(_0xc8d8('0x2'));var express=require(_0xc8d8('0x3'));var router=express[_0xc8d8('0x4')]();var fs_extra=require(_0xc8d8('0x5'));var auth=require(_0xc8d8('0x6'));var interaction=require(_0xc8d8('0x7'));var config=require(_0xc8d8('0x8'));var controller=require('./sound.controller');router['get']('/',auth[_0xc8d8('0x9')](),controller['index']);router[_0xc8d8('0xa')](_0xc8d8('0xb'),auth[_0xc8d8('0x9')](),controller[_0xc8d8('0xc')]);router[_0xc8d8('0xa')]('/:id/download',auth['isAuthenticated'](),controller['download']);var upload=multer({'storage':multer[_0xc8d8('0xd')]({'destination':function(_0x1c66f9,_0x441e3d,_0x33ac8c){_0x33ac8c(null,path['join'](config[_0xc8d8('0xe')],'server/files/sounds/original/'));},'filename':function(_0x225694,_0x34a7fe,_0x41e01d){_0x34a7fe[_0xc8d8('0xf')]=_0x34a7fe['originalname'][_0xc8d8('0x10')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x41e01d(null,util[_0xc8d8('0x11')](_0xc8d8('0x12'),path[_0xc8d8('0x13')](_0x34a7fe[_0xc8d8('0xf')],path[_0xc8d8('0x14')](_0x34a7fe[_0xc8d8('0xf')])),Date[_0xc8d8('0x15')](),path['extname'](_0x34a7fe[_0xc8d8('0xf')])));}})});router[_0xc8d8('0x16')]('/',upload[_0xc8d8('0x17')](_0xc8d8('0x18')),controller[_0xc8d8('0x19')]);router['put'](_0xc8d8('0xb'),auth[_0xc8d8('0x9')](),controller[_0xc8d8('0x1a')]);router['delete'](_0xc8d8('0xb'),auth[_0xc8d8('0x9')](),controller[_0xc8d8('0x1b')]);module[_0xc8d8('0x1c')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 8ccc8e4..840fb6d 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 _0x539b=['INTEGER','sequelize','exports','name','STRING','FLOAT','BIGINT'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0x539b,0x1ac));var _0xb539=function(_0x18539a,_0x1a8bf3){_0x18539a=_0x18539a-0x0;var _0x279caa=_0x539b[_0x18539a];return _0x279caa;};'use strict';var Sequelize=require(_0xb539('0x0'));module[_0xb539('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xb539('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0xb539('0x3')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0xb539('0x3')]},'original_format':{'type':Sequelize[_0xb539('0x3')]},'original_duration':{'type':Sequelize[_0xb539('0x4')]},'original_sampleCount':{'type':Sequelize[_0xb539('0x5')]},'original_channelCount':{'type':Sequelize[_0xb539('0x6')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0xb539('0x6')]},'converted_format':{'type':Sequelize[_0xb539('0x3')]},'converted_duration':{'type':Sequelize[_0xb539('0x4')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xb6e5=['STRING','FLOAT','BIGINT','INTEGER','exports'];(function(_0x20728e,_0x3a9f75){var _0x12412f=function(_0x30c870){while(--_0x30c870){_0x20728e['push'](_0x20728e['shift']());}};_0x12412f(++_0x3a9f75);}(_0xb6e5,0xdb));var _0x5b6e=function(_0x209928,_0x566055){_0x209928=_0x209928-0x0;var _0x54a87a=_0xb6e5[_0x209928];return _0x54a87a;};'use strict';var Sequelize=require('sequelize');module[_0x5b6e('0x0')]={'name':{'type':Sequelize[_0x5b6e('0x1')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0x5b6e('0x1')]},'original_format':{'type':Sequelize[_0x5b6e('0x1')]},'original_duration':{'type':Sequelize[_0x5b6e('0x2')]},'original_sampleCount':{'type':Sequelize[_0x5b6e('0x3')]},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0x5b6e('0x4')]},'converted_format':{'type':Sequelize[_0x5b6e('0x1')]},'converted_duration':{'type':Sequelize[_0x5b6e('0x2')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0x5b6e('0x4')]},'converted_bitRate':{'type':Sequelize[_0x5b6e('0x3')]},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 544c07d..dc8cb05 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 _0x374a=['map','Sound','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','where','filter','type','VIRTUAL','merge','options','include','catch','show','params','includeAll','find','download','save_name','converted_format','existsSync','join','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','root','format','%s.%s','create','file','originalname','extname','filename','substring','wav','server/files/sounds/original','basename','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','error','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','bitRate','original_sampleRate','sampleRate','converted_duration','converted_sampleCount','channelCount','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','update','pick','delete','rimraf','fast-json-patch','request-promise','mustache','util','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','then','get','Sounds','UserProfileResource','destroy','name','send','index'];(function(_0x3147de,_0x98105f){var _0x4ad14c=function(_0x411a8b){while(--_0x411a8b){_0x3147de['push'](_0x3147de['shift']());}};_0x4ad14c(++_0x98105f);}(_0x374a,0x137));var _0xa374=function(_0x3eaa53,_0x2ab4b1){_0x3eaa53=_0x3eaa53-0x0;var _0x33b017=_0x374a[_0x3eaa53];return _0x33b017;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa374('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa374('0x1'));var rp=require(_0xa374('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa374('0x3'));var util=require(_0xa374('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0xa374('0x5'));var ejs=require(_0xa374('0x6'));var fs=require('fs');var fs_extra=require(_0xa374('0x7'));var _=require('lodash');var squel=require(_0xa374('0x8'));var crypto=require(_0xa374('0x9'));var jsforce=require(_0xa374('0xa'));var deskjs=require(_0xa374('0xb'));var toCsv=require(_0xa374('0x5'));var querystring=require(_0xa374('0xc'));var Papa=require('papaparse');var Redis=require(_0xa374('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xa374('0xe'));var as=require(_0xa374('0xf'));var hardwareService=require(_0xa374('0x10'));var logger=require('../../config/logger')(_0xa374('0x11'));var utils=require(_0xa374('0x12'));var config=require(_0xa374('0x13'));var licenseUtil=require(_0xa374('0x14'));var db=require(_0xa374('0x15'))['db'];function respondWithStatusCode(_0x3dd114,_0x4dd569){_0x4dd569=_0x4dd569||0xcc;return function(_0x753faf){if(_0x753faf){return _0x3dd114[_0xa374('0x16')](_0x4dd569);}return _0x3dd114[_0xa374('0x17')](_0x4dd569)[_0xa374('0x18')]();};}function respondWithResult(_0xcf828c,_0xca8bab){_0xca8bab=_0xca8bab||0xc8;return function(_0x3cde74){if(_0x3cde74){return _0xcf828c[_0xa374('0x17')](_0xca8bab)[_0xa374('0x19')](_0x3cde74);}};}function respondWithFilteredResult(_0x3f42ba,_0xf736c7){return function(_0x4c7307){if(_0x4c7307){var _0x29259b=typeof _0xf736c7[_0xa374('0x1a')]===_0xa374('0x1b')&&typeof _0xf736c7[_0xa374('0x1c')]===_0xa374('0x1b');var _0x137eff=_0x4c7307['count'];var _0x4205f0=_0x29259b?0x0:_0xf736c7['offset'];var _0x1df622=_0x29259b?_0x4c7307[_0xa374('0x1d')]:_0xf736c7[_0xa374('0x1a')]+_0xf736c7['limit'];var _0x2be8e2;if(_0x1df622>=_0x137eff){_0x1df622=_0x137eff;_0x2be8e2=0xc8;}else{_0x2be8e2=0xce;}_0x3f42ba[_0xa374('0x17')](_0x2be8e2);return _0x3f42ba[_0xa374('0x1e')]('Content-Range',_0x4205f0+'-'+_0x1df622+'/'+_0x137eff)[_0xa374('0x19')](_0x4c7307);}return null;};}function patchUpdates(_0x474612){return function(_0x429062){try{jsonpatch[_0xa374('0x1f')](_0x429062,_0x474612,!![]);}catch(_0x2db728){return BPromise['reject'](_0x2db728);}return _0x429062['save']();};}function saveUpdates(_0x226200,_0x3b51e6){return function(_0x59200a){if(_0x59200a){return _0x59200a['update'](_0x226200)[_0xa374('0x20')](function(_0x521408){return _0x521408;});}return null;};}function removeEntity(_0x29083f,_0x9800fc){return function(_0x199758){if(_0x199758){return _0x199758['destroy']()['then'](function(){var _0x1ca529=_0x199758[_0xa374('0x21')]({'plain':!![]});var _0x267a69=_0xa374('0x22');return db[_0xa374('0x23')][_0xa374('0x24')]({'where':{'type':_0x267a69,'resourceId':_0x1ca529['id']}})[_0xa374('0x20')](function(){return _0x199758;});})[_0xa374('0x20')](function(){_0x29083f['status'](0xcc)[_0xa374('0x18')]();});}};}function handleEntityNotFound(_0x13330a,_0x3f6c62){return function(_0x3220b4){if(!_0x3220b4){_0x13330a[_0xa374('0x16')](0x194);}return _0x3220b4;};}function handleError(_0x36cc29,_0x33fe33){_0x33fe33=_0x33fe33||0x1f4;return function(_0x29091b){logger['error'](_0x29091b['stack']);if(_0x29091b['name']){delete _0x29091b[_0xa374('0x25')];}_0x36cc29[_0xa374('0x17')](_0x33fe33)[_0xa374('0x26')](_0x29091b);};}exports[_0xa374('0x27')]=function(_0xb37785,_0xb526e2){var _0x313ccb={},_0x34f932={},_0x1125eb={'count':0x0,'rows':[]};var _0x884a40=_[_0xa374('0x28')](db[_0xa374('0x29')][_0xa374('0x2a')],function(_0x24a952){return{'name':_0x24a952['fieldName'],'type':_0x24a952['type']['key']};});_0x34f932[_0xa374('0x2b')]=_[_0xa374('0x28')](_0x884a40,'name');_0x34f932[_0xa374('0x2c')]=_[_0xa374('0x2d')](_0xb37785[_0xa374('0x2c')]);_0x34f932[_0xa374('0x2e')]=_[_0xa374('0x2f')](_0x34f932[_0xa374('0x2b')],_0x34f932['query']);_0x313ccb[_0xa374('0x30')]=_[_0xa374('0x2f')](_0x34f932['model'],qs['fields'](_0xb37785[_0xa374('0x2c')][_0xa374('0x31')]));_0x313ccb[_0xa374('0x30')]=_0x313ccb['attributes'][_0xa374('0x32')]?_0x313ccb[_0xa374('0x30')]:_0x34f932[_0xa374('0x2b')];if(!_0xb37785[_0xa374('0x2c')][_0xa374('0x33')]('nolimit')){_0x313ccb['limit']=qs[_0xa374('0x1c')](_0xb37785[_0xa374('0x2c')][_0xa374('0x1c')]);_0x313ccb[_0xa374('0x1a')]=qs['offset'](_0xb37785[_0xa374('0x2c')][_0xa374('0x1a')]);}_0x313ccb[_0xa374('0x34')]=qs['sort'](_0xb37785[_0xa374('0x2c')]['sort']);_0x313ccb[_0xa374('0x35')]=qs[_0xa374('0x2e')](_['pick'](_0xb37785[_0xa374('0x2c')],_0x34f932[_0xa374('0x2e')]),_0x884a40);if(_0xb37785[_0xa374('0x2c')][_0xa374('0x36')]){_0x313ccb[_0xa374('0x35')]=_['merge'](_0x313ccb[_0xa374('0x35')],{'$or':_['map'](_0x884a40,function(_0x11d584){if(_0x11d584[_0xa374('0x37')]!==_0xa374('0x38')){var _0x259b57={};_0x259b57[_0x11d584[_0xa374('0x25')]]={'$like':'%'+_0xb37785[_0xa374('0x2c')][_0xa374('0x36')]+'%'};return _0x259b57;}})});}_0x313ccb=_[_0xa374('0x39')]({},_0x313ccb,_0xb37785[_0xa374('0x3a')]);var _0x489d04={'where':_0x313ccb[_0xa374('0x35')]};return db['Sound'][_0xa374('0x1d')](_0x489d04)[_0xa374('0x20')](function(_0x2234bf){_0x1125eb[_0xa374('0x1d')]=_0x2234bf;if(_0xb37785['query']['includeAll']){_0x313ccb[_0xa374('0x3b')]=[{'all':!![]}];}return db[_0xa374('0x29')]['findAll'](_0x313ccb);})['then'](function(_0x10837a){_0x1125eb['rows']=_0x10837a;return _0x1125eb;})['then'](respondWithFilteredResult(_0xb526e2,_0x313ccb))[_0xa374('0x3c')](handleError(_0xb526e2,null));};exports[_0xa374('0x3d')]=function(_0x4b4ef4,_0x3b03ec){var _0x5aec88={'raw':!![],'where':{'id':_0x4b4ef4[_0xa374('0x3e')]['id']}},_0x5863ed={};_0x5863ed['model']=_[_0xa374('0x2d')](db[_0xa374('0x29')][_0xa374('0x2a')]);_0x5863ed[_0xa374('0x2c')]=_['keys'](_0x4b4ef4[_0xa374('0x2c')]);_0x5863ed[_0xa374('0x2e')]=_[_0xa374('0x2f')](_0x5863ed[_0xa374('0x2b')],_0x5863ed[_0xa374('0x2c')]);_0x5aec88['attributes']=_[_0xa374('0x2f')](_0x5863ed[_0xa374('0x2b')],qs[_0xa374('0x31')](_0x4b4ef4[_0xa374('0x2c')]['fields']));_0x5aec88[_0xa374('0x30')]=_0x5aec88['attributes']['length']?_0x5aec88[_0xa374('0x30')]:_0x5863ed['model'];if(_0x4b4ef4[_0xa374('0x2c')][_0xa374('0x3f')]){_0x5aec88[_0xa374('0x3b')]=[{'all':!![]}];}_0x5aec88=_['merge']({},_0x5aec88,_0x4b4ef4['options']);return db[_0xa374('0x29')][_0xa374('0x40')](_0x5aec88)[_0xa374('0x20')](handleEntityNotFound(_0x3b03ec,null))[_0xa374('0x20')](respondWithResult(_0x3b03ec,null))[_0xa374('0x3c')](handleError(_0x3b03ec,null));};exports[_0xa374('0x41')]=function(_0x313a70,_0xd491bd,_0x102055){return db[_0xa374('0x29')][_0xa374('0x40')]({'where':{'id':_0x313a70[_0xa374('0x3e')]['id']},'attributes':['name',_0xa374('0x42'),_0xa374('0x43')],'raw':!![]})[_0xa374('0x20')](handleEntityNotFound(_0xd491bd,null))[_0xa374('0x20')](function(_0x30ee99){if(_0x30ee99){if(!fs[_0xa374('0x44')](path[_0xa374('0x45')](config['root'],_0xa374('0x46'),_0x30ee99['save_name']+'.'+_0x30ee99[_0xa374('0x43')]))){throw new db[(_0xa374('0x47'))][(_0xa374('0x48'))](_0xa374('0x49'));}return _0xd491bd['download'](path[_0xa374('0x45')](config[_0xa374('0x4a')],_0xa374('0x46'),util[_0xa374('0x4b')](_0xa374('0x4c'),_0x30ee99['save_name'],_0x30ee99[_0xa374('0x43')])),util[_0xa374('0x4b')](_0xa374('0x4c'),_0x30ee99[_0xa374('0x25')],_0x30ee99[_0xa374('0x43')]));}return null;})[_0xa374('0x3c')](handleError(_0xd491bd,null));};exports[_0xa374('0x4d')]=function(_0x1e8e9b,_0x54dacf,_0x5c5b86){var _0x3d7eaa={'name':path['basename'](_0x1e8e9b[_0xa374('0x4e')][_0xa374('0x4f')],path[_0xa374('0x50')](_0x1e8e9b[_0xa374('0x4e')][_0xa374('0x4f')])),'save_name':path['basename'](_0x1e8e9b['file'][_0xa374('0x51')],path[_0xa374('0x50')](_0x1e8e9b[_0xa374('0x4e')]['filename'])),'original_format':path[_0xa374('0x50')](_0x1e8e9b[_0xa374('0x4e')][_0xa374('0x4f')])[_0xa374('0x52')](0x1),'converted_format':_0xa374('0x53')};var _0x510bf7=path[_0xa374('0x45')](config['root'],_0xa374('0x54'),_0x1e8e9b[_0xa374('0x4e')][_0xa374('0x51')]);var _0x22fbdc=path['join'](config[_0xa374('0x4a')],_0xa374('0x46'),util[_0xa374('0x4b')](_0xa374('0x4c'),path[_0xa374('0x55')](_0x1e8e9b[_0xa374('0x4e')]['filename'],path[_0xa374('0x50')](_0x1e8e9b[_0xa374('0x4e')][_0xa374('0x51')])),_0x3d7eaa[_0xa374('0x43')]));logger[_0xa374('0x56')]('Sound\x20upload\x20filepath:\x20%s',_0x510bf7);logger[_0xa374('0x56')](_0xa374('0x57'),_0x22fbdc);try{fs[_0xa374('0x58')](_0x510bf7,parseInt(_0xa374('0x59'),0x8));var _0xb127b8=sox[_0xa374('0x5a')](_0x510bf7,_0x22fbdc,{'sampleRate':0x1f40,'format':_0xa374('0x53'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0xb127b8['on'](_0xa374('0x5b'),function(_0x4263e9){fs[_0xa374('0x5c')](_0x510bf7);_0x54dacf[_0xa374('0x17')](0x1f4)[_0xa374('0x26')](_0x4263e9);});_0xb127b8['on'](_0xa374('0x5d'),function(_0x46fad4){_0x3d7eaa[_0xa374('0x5e')]=isNaN(_0x46fad4[_0xa374('0x5f')])?null:_0x46fad4['duration']*0x3e8;_0x3d7eaa[_0xa374('0x60')]=isNaN(_0x46fad4[_0xa374('0x61')])?null:_0x46fad4[_0xa374('0x61')];_0x3d7eaa[_0xa374('0x62')]=isNaN(_0x46fad4['channelCount'])?null:_0x46fad4['channelCount'];_0x3d7eaa['original_bitRate']=isNaN(_0x46fad4[_0xa374('0x63')])?null:_0x46fad4[_0xa374('0x63')];_0x3d7eaa[_0xa374('0x64')]=isNaN(_0x46fad4[_0xa374('0x65')])?null:_0x46fad4[_0xa374('0x65')];});_0xb127b8['on']('dest',function(_0x149912){_0x3d7eaa[_0xa374('0x66')]=isNaN(_0x149912[_0xa374('0x5f')])?null:_0x149912[_0xa374('0x5f')]*0x3e8;_0x3d7eaa[_0xa374('0x67')]=isNaN(_0x149912[_0xa374('0x61')])?null:_0x149912[_0xa374('0x61')];_0x3d7eaa['converted_channelCount']=isNaN(_0x149912[_0xa374('0x68')])?null:_0x149912['channelCount'];_0x3d7eaa['converted_bitRate']=isNaN(_0x149912[_0xa374('0x63')])?null:_0x149912['bitRate'];_0x3d7eaa['converted_sampleRate']=isNaN(_0x149912[_0xa374('0x65')])?null:_0x149912[_0xa374('0x65')];});_0xb127b8['on']('end',function(){fs[_0xa374('0x58')](_0x22fbdc,parseInt('0777',0x8));return db[_0xa374('0x29')][_0xa374('0x4d')](_0x3d7eaa)[_0xa374('0x20')](function(_0x18d3ec){var _0x4bb157={'role':_0x1e8e9b[_0xa374('0x69')][_0xa374('0x6a')],'userProfileId':_0x1e8e9b['body'][_0xa374('0x6b')]};if(!_0x4bb157)throw new Error(_0xa374('0x6c'));if(_0x4bb157[_0xa374('0x6a')]===_0xa374('0x6d')){var _0x5e3456=_0x18d3ec[_0xa374('0x21')]({'plain':!![]});return db[_0xa374('0x6e')]['find']({'where':{'name':'Sounds','userProfileId':_0x4bb157[_0xa374('0x6b')]},'raw':!![]})[_0xa374('0x20')](function(_0x1287bf){if(_0x1287bf&&_0x1287bf[_0xa374('0x6f')]===0x0){return db['UserProfileResource']['create']({'name':_0x5e3456[_0xa374('0x25')],'resourceId':_0x5e3456['id'],'type':_0x1287bf['name'],'sectionId':_0x1287bf['id']},{})[_0xa374('0x20')](function(){return _0x18d3ec;});}else{return _0x18d3ec;}})[_0xa374('0x3c')](function(_0x191d0c){logger[_0xa374('0x5b')](_0xa374('0x70'),_0x191d0c);throw _0x191d0c;});}return _0x18d3ec;})['then'](respondWithResult(_0x54dacf,null))[_0xa374('0x3c')](handleError(_0x54dacf,null));});_0xb127b8[_0xa374('0x71')]();}catch(_0x3a065b){_0x54dacf[_0xa374('0x17')](0x1f4)['send'](_0x3a065b);}};exports[_0xa374('0x72')]=function(_0xa8f755,_0x292f59,_0x4f6b61){return db[_0xa374('0x29')][_0xa374('0x40')]({'where':{'id':_0xa8f755[_0xa374('0x3e')]['id']}})[_0xa374('0x20')](handleEntityNotFound(_0x292f59,null))[_0xa374('0x20')](saveUpdates(_[_0xa374('0x73')](_0xa8f755[_0xa374('0x69')],[_0xa374('0x25'),'description']),null))[_0xa374('0x20')](respondWithResult(_0x292f59,null))[_0xa374('0x3c')](handleError(_0x292f59,null));};exports[_0xa374('0x74')]=function(_0x24aaa3,_0x22bb5e,_0x4330e1){return db['Sound'][_0xa374('0x40')]({'where':{'id':_0x24aaa3[_0xa374('0x3e')]['id']}})[_0xa374('0x20')](function(_0x35c4c7){if(_0x35c4c7){return _0x35c4c7[_0xa374('0x24')]();}})[_0xa374('0x20')](function(_0x14669f){var _0x3a5403=path[_0xa374('0x45')](config['root'],_0xa374('0x54'),util[_0xa374('0x4b')](_0xa374('0x4c'),_0x14669f[_0xa374('0x42')],_0x14669f['original_format']));var _0x311ee1=path[_0xa374('0x45')](config[_0xa374('0x4a')],_0xa374('0x46'),util[_0xa374('0x4b')]('%s.%s',_0x14669f[_0xa374('0x42')],_0x14669f[_0xa374('0x43')]));fs[_0xa374('0x5c')](_0x3a5403);fs[_0xa374('0x5c')](_0x311ee1);return _0x14669f;})['then'](function(_0x353d45){if(_0x353d45){return _0x22bb5e[_0xa374('0x17')](0xcc)['end']();}})[_0xa374('0x20')](handleEntityNotFound(_0x22bb5e,null))[_0xa374('0x3c')](handleError(_0x22bb5e,null));}; \ No newline at end of file +var _0x3427=['format','%s.%s','create','file','originalname','basename','filename','extname','substring','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','0777','wav','src','duration','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_sampleCount','converted_channelCount','converted_sampleRate','chmodSync','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Sounds','autoAssociation','start','description','original_format','unlinkSync','zip-dir','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','get','UserProfileResource','error','stack','send','index','map','Sound','rawAttributes','fieldName','type','key','name','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','keys','find','catch','download','params','save_name','converted_format','existsSync','join','server/files/sounds/converted','ValidationError','root'];(function(_0xadb99a,_0x5af811){var _0x3a4507=function(_0x4ed5b2){while(--_0x4ed5b2){_0xadb99a['push'](_0xadb99a['shift']());}};_0x3a4507(++_0x5af811);}(_0x3427,0x9f));var _0x7342=function(_0x8a08d0,_0xfcb749){_0x8a08d0=_0x8a08d0-0x0;var _0x4e6b53=_0x3427[_0x8a08d0];return _0x4e6b53;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7342('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7342('0x1'));var Mustache=require(_0x7342('0x2'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x7342('0x3'));var ejs=require(_0x7342('0x4'));var fs=require('fs');var fs_extra=require(_0x7342('0x5'));var _=require(_0x7342('0x6'));var squel=require(_0x7342('0x7'));var crypto=require(_0x7342('0x8'));var jsforce=require(_0x7342('0x9'));var deskjs=require(_0x7342('0xa'));var toCsv=require(_0x7342('0x3'));var querystring=require(_0x7342('0xb'));var Papa=require(_0x7342('0xc'));var Redis=require(_0x7342('0xd'));var authService=require(_0x7342('0xe'));var qs=require(_0x7342('0xf'));var as=require(_0x7342('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7342('0x11'))(_0x7342('0x12'));var utils=require('../../config/utils');var config=require(_0x7342('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x7342('0x14'))['db'];function respondWithStatusCode(_0x506050,_0x121bb9){_0x121bb9=_0x121bb9||0xcc;return function(_0x443f55){if(_0x443f55){return _0x506050[_0x7342('0x15')](_0x121bb9);}return _0x506050[_0x7342('0x16')](_0x121bb9)[_0x7342('0x17')]();};}function respondWithResult(_0x13f59b,_0x4c105f){_0x4c105f=_0x4c105f||0xc8;return function(_0x575583){if(_0x575583){return _0x13f59b[_0x7342('0x16')](_0x4c105f)['json'](_0x575583);}};}function respondWithFilteredResult(_0xe99fe8,_0xfcea82){return function(_0x5c4922){if(_0x5c4922){var _0x5a0468=typeof _0xfcea82[_0x7342('0x18')]===_0x7342('0x19')&&typeof _0xfcea82[_0x7342('0x1a')]==='undefined';var _0x50efd9=_0x5c4922[_0x7342('0x1b')];var _0x381d96=_0x5a0468?0x0:_0xfcea82[_0x7342('0x18')];var _0x391c93=_0x5a0468?_0x5c4922[_0x7342('0x1b')]:_0xfcea82[_0x7342('0x18')]+_0xfcea82[_0x7342('0x1a')];var _0x4b72dc;if(_0x391c93>=_0x50efd9){_0x391c93=_0x50efd9;_0x4b72dc=0xc8;}else{_0x4b72dc=0xce;}_0xe99fe8[_0x7342('0x16')](_0x4b72dc);return _0xe99fe8[_0x7342('0x1c')](_0x7342('0x1d'),_0x381d96+'-'+_0x391c93+'/'+_0x50efd9)[_0x7342('0x1e')](_0x5c4922);}return null;};}function patchUpdates(_0x596e8b){return function(_0x416514){try{jsonpatch[_0x7342('0x1f')](_0x416514,_0x596e8b,!![]);}catch(_0x8fb4e6){return BPromise['reject'](_0x8fb4e6);}return _0x416514[_0x7342('0x20')]();};}function saveUpdates(_0xa8dcb1,_0x1ecc86){return function(_0x4edeb1){if(_0x4edeb1){return _0x4edeb1[_0x7342('0x21')](_0xa8dcb1)[_0x7342('0x22')](function(_0x172f86){return _0x172f86;});}return null;};}function removeEntity(_0x350220,_0x981644){return function(_0x15afe4){if(_0x15afe4){return _0x15afe4[_0x7342('0x23')]()['then'](function(){var _0x4cf310=_0x15afe4[_0x7342('0x24')]({'plain':!![]});var _0x1ef103='Sounds';return db[_0x7342('0x25')][_0x7342('0x23')]({'where':{'type':_0x1ef103,'resourceId':_0x4cf310['id']}})[_0x7342('0x22')](function(){return _0x15afe4;});})[_0x7342('0x22')](function(){_0x350220[_0x7342('0x16')](0xcc)[_0x7342('0x17')]();});}};}function handleEntityNotFound(_0x4fe465,_0x38961e){return function(_0x54552d){if(!_0x54552d){_0x4fe465['sendStatus'](0x194);}return _0x54552d;};}function handleError(_0x125524,_0x574c97){_0x574c97=_0x574c97||0x1f4;return function(_0x3609ea){logger[_0x7342('0x26')](_0x3609ea[_0x7342('0x27')]);if(_0x3609ea['name']){delete _0x3609ea['name'];}_0x125524[_0x7342('0x16')](_0x574c97)[_0x7342('0x28')](_0x3609ea);};}exports[_0x7342('0x29')]=function(_0x37e2f0,_0x34a1e4){var _0x8528ec={},_0x57d8e5={},_0x3b0b27={'count':0x0,'rows':[]};var _0x26551e=_[_0x7342('0x2a')](db[_0x7342('0x2b')][_0x7342('0x2c')],function(_0x511887){return{'name':_0x511887[_0x7342('0x2d')],'type':_0x511887[_0x7342('0x2e')][_0x7342('0x2f')]};});_0x57d8e5['model']=_[_0x7342('0x2a')](_0x26551e,_0x7342('0x30'));_0x57d8e5['query']=_['keys'](_0x37e2f0[_0x7342('0x31')]);_0x57d8e5[_0x7342('0x32')]=_[_0x7342('0x33')](_0x57d8e5[_0x7342('0x34')],_0x57d8e5[_0x7342('0x31')]);_0x8528ec[_0x7342('0x35')]=_['intersection'](_0x57d8e5[_0x7342('0x34')],qs[_0x7342('0x36')](_0x37e2f0['query'][_0x7342('0x36')]));_0x8528ec[_0x7342('0x35')]=_0x8528ec[_0x7342('0x35')][_0x7342('0x37')]?_0x8528ec['attributes']:_0x57d8e5[_0x7342('0x34')];if(!_0x37e2f0[_0x7342('0x31')][_0x7342('0x38')]('nolimit')){_0x8528ec[_0x7342('0x1a')]=qs[_0x7342('0x1a')](_0x37e2f0['query'][_0x7342('0x1a')]);_0x8528ec['offset']=qs['offset'](_0x37e2f0['query'][_0x7342('0x18')]);}_0x8528ec[_0x7342('0x39')]=qs[_0x7342('0x3a')](_0x37e2f0[_0x7342('0x31')][_0x7342('0x3a')]);_0x8528ec[_0x7342('0x3b')]=qs[_0x7342('0x32')](_[_0x7342('0x3c')](_0x37e2f0['query'],_0x57d8e5[_0x7342('0x32')]),_0x26551e);if(_0x37e2f0['query'][_0x7342('0x3d')]){_0x8528ec[_0x7342('0x3b')]=_[_0x7342('0x3e')](_0x8528ec[_0x7342('0x3b')],{'$or':_['map'](_0x26551e,function(_0x46f69d){if(_0x46f69d['type']!==_0x7342('0x3f')){var _0x5ac2f5={};_0x5ac2f5[_0x46f69d[_0x7342('0x30')]]={'$like':'%'+_0x37e2f0[_0x7342('0x31')][_0x7342('0x3d')]+'%'};return _0x5ac2f5;}})});}_0x8528ec=_[_0x7342('0x3e')]({},_0x8528ec,_0x37e2f0[_0x7342('0x40')]);var _0x242ebc={'where':_0x8528ec[_0x7342('0x3b')]};return db[_0x7342('0x2b')][_0x7342('0x1b')](_0x242ebc)[_0x7342('0x22')](function(_0x143b13){_0x3b0b27[_0x7342('0x1b')]=_0x143b13;if(_0x37e2f0[_0x7342('0x31')][_0x7342('0x41')]){_0x8528ec[_0x7342('0x42')]=[{'all':!![]}];}return db[_0x7342('0x2b')]['findAll'](_0x8528ec);})['then'](function(_0x19e95f){_0x3b0b27[_0x7342('0x43')]=_0x19e95f;return _0x3b0b27;})[_0x7342('0x22')](respondWithFilteredResult(_0x34a1e4,_0x8528ec))['catch'](handleError(_0x34a1e4,null));};exports[_0x7342('0x44')]=function(_0x551ff3,_0xaba7b7){var _0x1fa455={'raw':!![],'where':{'id':_0x551ff3['params']['id']}},_0xb68f1f={};_0xb68f1f[_0x7342('0x34')]=_['keys'](db[_0x7342('0x2b')]['rawAttributes']);_0xb68f1f[_0x7342('0x31')]=_[_0x7342('0x45')](_0x551ff3[_0x7342('0x31')]);_0xb68f1f['filters']=_[_0x7342('0x33')](_0xb68f1f[_0x7342('0x34')],_0xb68f1f[_0x7342('0x31')]);_0x1fa455['attributes']=_[_0x7342('0x33')](_0xb68f1f[_0x7342('0x34')],qs[_0x7342('0x36')](_0x551ff3[_0x7342('0x31')][_0x7342('0x36')]));_0x1fa455['attributes']=_0x1fa455[_0x7342('0x35')][_0x7342('0x37')]?_0x1fa455[_0x7342('0x35')]:_0xb68f1f[_0x7342('0x34')];if(_0x551ff3['query'][_0x7342('0x41')]){_0x1fa455[_0x7342('0x42')]=[{'all':!![]}];}_0x1fa455=_[_0x7342('0x3e')]({},_0x1fa455,_0x551ff3[_0x7342('0x40')]);return db[_0x7342('0x2b')][_0x7342('0x46')](_0x1fa455)[_0x7342('0x22')](handleEntityNotFound(_0xaba7b7,null))[_0x7342('0x22')](respondWithResult(_0xaba7b7,null))[_0x7342('0x47')](handleError(_0xaba7b7,null));};exports[_0x7342('0x48')]=function(_0x3a76dd,_0x586122,_0x440b0b){return db[_0x7342('0x2b')][_0x7342('0x46')]({'where':{'id':_0x3a76dd[_0x7342('0x49')]['id']},'attributes':[_0x7342('0x30'),_0x7342('0x4a'),_0x7342('0x4b')],'raw':!![]})[_0x7342('0x22')](handleEntityNotFound(_0x586122,null))['then'](function(_0x53a362){if(_0x53a362){if(!fs[_0x7342('0x4c')](path[_0x7342('0x4d')](config['root'],_0x7342('0x4e'),_0x53a362[_0x7342('0x4a')]+'.'+_0x53a362[_0x7342('0x4b')]))){throw new db['Sequelize'][(_0x7342('0x4f'))]('Sound\x20not\x20found');}return _0x586122['download'](path[_0x7342('0x4d')](config[_0x7342('0x50')],_0x7342('0x4e'),util[_0x7342('0x51')]('%s.%s',_0x53a362[_0x7342('0x4a')],_0x53a362['converted_format'])),util['format'](_0x7342('0x52'),_0x53a362[_0x7342('0x30')],_0x53a362[_0x7342('0x4b')]));}return null;})[_0x7342('0x47')](handleError(_0x586122,null));};exports[_0x7342('0x53')]=function(_0x458b3c,_0x2802d9,_0x29b938){var _0x31f749={'name':path['basename'](_0x458b3c[_0x7342('0x54')][_0x7342('0x55')],path['extname'](_0x458b3c[_0x7342('0x54')]['originalname'])),'save_name':path[_0x7342('0x56')](_0x458b3c['file'][_0x7342('0x57')],path['extname'](_0x458b3c[_0x7342('0x54')]['filename'])),'original_format':path[_0x7342('0x58')](_0x458b3c[_0x7342('0x54')][_0x7342('0x55')])[_0x7342('0x59')](0x1),'converted_format':'wav'};var _0x48de34=path[_0x7342('0x4d')](config['root'],'server/files/sounds/original',_0x458b3c[_0x7342('0x54')][_0x7342('0x57')]);var _0x5343cb=path[_0x7342('0x4d')](config['root'],_0x7342('0x4e'),util['format'](_0x7342('0x52'),path[_0x7342('0x56')](_0x458b3c['file'][_0x7342('0x57')],path[_0x7342('0x58')](_0x458b3c[_0x7342('0x54')]['filename'])),_0x31f749[_0x7342('0x4b')]));logger[_0x7342('0x5a')](_0x7342('0x5b'),_0x48de34);logger[_0x7342('0x5a')](_0x7342('0x5c'),_0x5343cb);try{fs['chmodSync'](_0x48de34,parseInt(_0x7342('0x5d'),0x8));var _0x28276a=sox['transcode'](_0x48de34,_0x5343cb,{'sampleRate':0x1f40,'format':_0x7342('0x5e'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x28276a['on'](_0x7342('0x26'),function(_0x4b5d5e){fs['unlinkSync'](_0x48de34);_0x2802d9[_0x7342('0x16')](0x1f4)['send'](_0x4b5d5e);});_0x28276a['on'](_0x7342('0x5f'),function(_0x2d0b6f){_0x31f749['original_duration']=isNaN(_0x2d0b6f[_0x7342('0x60')])?null:_0x2d0b6f[_0x7342('0x60')]*0x3e8;_0x31f749['original_sampleCount']=isNaN(_0x2d0b6f[_0x7342('0x61')])?null:_0x2d0b6f[_0x7342('0x61')];_0x31f749[_0x7342('0x62')]=isNaN(_0x2d0b6f['channelCount'])?null:_0x2d0b6f[_0x7342('0x63')];_0x31f749[_0x7342('0x64')]=isNaN(_0x2d0b6f[_0x7342('0x65')])?null:_0x2d0b6f[_0x7342('0x65')];_0x31f749[_0x7342('0x66')]=isNaN(_0x2d0b6f[_0x7342('0x67')])?null:_0x2d0b6f[_0x7342('0x67')];});_0x28276a['on'](_0x7342('0x68'),function(_0x58d4da){_0x31f749['converted_duration']=isNaN(_0x58d4da[_0x7342('0x60')])?null:_0x58d4da['duration']*0x3e8;_0x31f749[_0x7342('0x69')]=isNaN(_0x58d4da[_0x7342('0x61')])?null:_0x58d4da[_0x7342('0x61')];_0x31f749[_0x7342('0x6a')]=isNaN(_0x58d4da[_0x7342('0x63')])?null:_0x58d4da[_0x7342('0x63')];_0x31f749['converted_bitRate']=isNaN(_0x58d4da['bitRate'])?null:_0x58d4da[_0x7342('0x65')];_0x31f749[_0x7342('0x6b')]=isNaN(_0x58d4da['sampleRate'])?null:_0x58d4da[_0x7342('0x67')];});_0x28276a['on'](_0x7342('0x17'),function(){fs[_0x7342('0x6c')](_0x5343cb,parseInt('0777',0x8));return db[_0x7342('0x2b')][_0x7342('0x53')](_0x31f749)[_0x7342('0x22')](function(_0x1ff1d8){var _0x534011={'role':_0x458b3c[_0x7342('0x6d')][_0x7342('0x6e')],'userProfileId':_0x458b3c['body'][_0x7342('0x6f')]};if(!_0x534011)throw new Error(_0x7342('0x70'));if(_0x534011[_0x7342('0x6e')]===_0x7342('0x71')){var _0x15ecc7=_0x1ff1d8[_0x7342('0x24')]({'plain':!![]});return db['UserProfileSection'][_0x7342('0x46')]({'where':{'name':_0x7342('0x72'),'userProfileId':_0x534011[_0x7342('0x6f')]},'raw':!![]})[_0x7342('0x22')](function(_0x42fdd1){if(_0x42fdd1&&_0x42fdd1[_0x7342('0x73')]===0x0){return db[_0x7342('0x25')][_0x7342('0x53')]({'name':_0x15ecc7['name'],'resourceId':_0x15ecc7['id'],'type':_0x42fdd1[_0x7342('0x30')],'sectionId':_0x42fdd1['id']},{})[_0x7342('0x22')](function(){return _0x1ff1d8;});}else{return _0x1ff1d8;}})[_0x7342('0x47')](function(_0x42ae64){logger[_0x7342('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x42ae64);throw _0x42ae64;});}return _0x1ff1d8;})[_0x7342('0x22')](respondWithResult(_0x2802d9,null))[_0x7342('0x47')](handleError(_0x2802d9,null));});_0x28276a[_0x7342('0x74')]();}catch(_0x81ecda){_0x2802d9[_0x7342('0x16')](0x1f4)[_0x7342('0x28')](_0x81ecda);}};exports[_0x7342('0x21')]=function(_0xf9589,_0x16aee3,_0x2ad3c8){return db[_0x7342('0x2b')]['find']({'where':{'id':_0xf9589['params']['id']}})[_0x7342('0x22')](handleEntityNotFound(_0x16aee3,null))[_0x7342('0x22')](saveUpdates(_['pick'](_0xf9589[_0x7342('0x6d')],['name',_0x7342('0x75')]),null))[_0x7342('0x22')](respondWithResult(_0x16aee3,null))['catch'](handleError(_0x16aee3,null));};exports['delete']=function(_0x31548b,_0xc1f00c,_0x217860){return db[_0x7342('0x2b')]['find']({'where':{'id':_0x31548b[_0x7342('0x49')]['id']}})[_0x7342('0x22')](function(_0xfb3012){if(_0xfb3012){return _0xfb3012[_0x7342('0x23')]();}})[_0x7342('0x22')](function(_0x338ee9){var _0x272d4b=path[_0x7342('0x4d')](config[_0x7342('0x50')],'server/files/sounds/original',util['format']('%s.%s',_0x338ee9[_0x7342('0x4a')],_0x338ee9[_0x7342('0x76')]));var _0x3a44e9=path[_0x7342('0x4d')](config[_0x7342('0x50')],_0x7342('0x4e'),util[_0x7342('0x51')](_0x7342('0x52'),_0x338ee9[_0x7342('0x4a')],_0x338ee9[_0x7342('0x4b')]));fs[_0x7342('0x77')](_0x272d4b);fs[_0x7342('0x77')](_0x3a44e9);return _0x338ee9;})[_0x7342('0x22')](function(_0x3a7998){if(_0x3a7998){return _0xc1f00c[_0x7342('0x16')](0xcc)[_0x7342('0x17')]();}})[_0x7342('0x22')](handleEntityNotFound(_0xc1f00c,null))[_0x7342('0x47')](handleError(_0xc1f00c,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 3c43a68..48b2a05 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 _0xe386=['request-promise','path','../../config/environment','./sound.attributes','exports','Sound','tools_sounds','lodash','util','../../config/logger','api','bluebird'];(function(_0x337229,_0x390e5e){var _0x5c639a=function(_0x359e02){while(--_0x359e02){_0x337229['push'](_0x337229['shift']());}};_0x5c639a(++_0x390e5e);}(_0xe386,0xaf));var _0x6e38=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xe386[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x6e38('0x0'));var util=require(_0x6e38('0x1'));var logger=require(_0x6e38('0x2'))(_0x6e38('0x3'));var moment=require('moment');var BPromise=require(_0x6e38('0x4'));var rp=require(_0x6e38('0x5'));var fs=require('fs');var path=require(_0x6e38('0x6'));var rimraf=require('rimraf');var config=require(_0x6e38('0x7'));var attributes=require(_0x6e38('0x8'));module[_0x6e38('0x9')]=function(_0x130464,_0x485c2c){return _0x130464['define'](_0x6e38('0xa'),attributes,{'tableName':_0x6e38('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe8a6=['./sound.attributes','exports','Sound','tools_sounds','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x36de10,_0xfe25e8){var _0x58100f=function(_0x1fee3f){while(--_0x1fee3f){_0x36de10['push'](_0x36de10['shift']());}};_0x58100f(++_0xfe25e8);}(_0xe8a6,0x7c));var _0x6e8a=function(_0x8db8bb,_0x170311){_0x8db8bb=_0x8db8bb-0x0;var _0x233835=_0xe8a6[_0x8db8bb];return _0x233835;};'use strict';var _=require(_0x6e8a('0x0'));var util=require(_0x6e8a('0x1'));var logger=require(_0x6e8a('0x2'))(_0x6e8a('0x3'));var moment=require('moment');var BPromise=require(_0x6e8a('0x4'));var rp=require(_0x6e8a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6e8a('0x6'));var config=require(_0x6e8a('0x7'));var attributes=require(_0x6e8a('0x8'));module[_0x6e8a('0x9')]=function(_0x53580d,_0x182674){return _0x53580d['define'](_0x6e8a('0xa'),attributes,{'tableName':_0x6e8a('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 d92e093..6558786 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 _0xf83d=['ioredis','../../mysqldb','rpc','jayson/promise','client','http','request','then','info','Sound,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','ShowSound','Sound','options','where','attributes','include','map','model','lodash','util','moment','bluebird','randomstring'];(function(_0x1f3890,_0x2f9aad){var _0x4af351=function(_0xd4cdfa){while(--_0xd4cdfa){_0x1f3890['push'](_0x1f3890['shift']());}};_0x4af351(++_0x2f9aad);}(_0xf83d,0x145));var _0xdf83=function(_0x7b44ff,_0x118719){_0x7b44ff=_0x7b44ff-0x0;var _0x49c5d3=_0xf83d[_0x7b44ff];return _0x49c5d3;};'use strict';var _=require(_0xdf83('0x0'));var util=require(_0xdf83('0x1'));var moment=require(_0xdf83('0x2'));var BPromise=require(_0xdf83('0x3'));var rs=require(_0xdf83('0x4'));var fs=require('fs');var Redis=require(_0xdf83('0x5'));var db=require(_0xdf83('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdf83('0x7'));var config=require('../../config/environment');var jayson=require(_0xdf83('0x8'));var client=jayson[_0xdf83('0x9')][_0xdf83('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2553e4,_0x23d910,_0x47134f){return new BPromise(function(_0x202f57,_0x48136a){return client[_0xdf83('0xb')](_0x2553e4,_0x47134f)[_0xdf83('0xc')](function(_0x2d616b){logger[_0xdf83('0xd')](_0xdf83('0xe'),_0x23d910,'request\x20sent');logger[_0xdf83('0xf')]('Sound,\x20%s,\x20%s,\x20%s',_0x23d910,_0xdf83('0x10'),JSON[_0xdf83('0x11')](_0x2d616b));if(_0x2d616b['error']){if(_0x2d616b[_0xdf83('0x12')]['code']===0x1f4){logger[_0xdf83('0x12')](_0xdf83('0xe'),_0x23d910,_0x2d616b[_0xdf83('0x12')][_0xdf83('0x13')]);return _0x48136a(_0x2d616b[_0xdf83('0x12')][_0xdf83('0x13')]);}logger[_0xdf83('0x12')]('Sound,\x20%s,\x20%s',_0x23d910,_0x2d616b['error']['message']);return _0x202f57(_0x2d616b['error'][_0xdf83('0x13')]);}else{logger[_0xdf83('0xd')](_0xdf83('0xe'),_0x23d910,_0xdf83('0x10'));_0x202f57(_0x2d616b[_0xdf83('0x14')][_0xdf83('0x13')]);}})[_0xdf83('0x15')](function(_0x156560){logger[_0xdf83('0x12')](_0xdf83('0xe'),_0x23d910,_0x156560);_0x48136a(_0x156560);});});}exports[_0xdf83('0x16')]=function(_0x4f5103){var _0x46dd39=this;return new Promise(function(_0x56f558,_0x6e2069){return db[_0xdf83('0x17')]['find']({'raw':_0x4f5103[_0xdf83('0x18')]?_0x4f5103[_0xdf83('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x4f5103[_0xdf83('0x18')]?_0x4f5103[_0xdf83('0x18')][_0xdf83('0x19')]||null:null,'attributes':_0x4f5103['options']?_0x4f5103[_0xdf83('0x18')][_0xdf83('0x1a')]||null:null,'include':_0x4f5103['options']?_0x4f5103[_0xdf83('0x18')][_0xdf83('0x1b')]?_[_0xdf83('0x1c')](_0x4f5103[_0xdf83('0x18')][_0xdf83('0x1b')],function(_0xef447c){return{'model':db[_0xef447c[_0xdf83('0x1d')]],'as':_0xef447c['as'],'attributes':_0xef447c['attributes'],'include':_0xef447c['include']?_['map'](_0xef447c[_0xdf83('0x1b')],function(_0x11032d){return{'model':db[_0x11032d[_0xdf83('0x1d')]],'as':_0x11032d['as'],'attributes':_0x11032d['attributes'],'include':_0x11032d[_0xdf83('0x1b')]?_[_0xdf83('0x1c')](_0x11032d[_0xdf83('0x1b')],function(_0x37f451){return{'model':db[_0x37f451[_0xdf83('0x1d')]],'as':_0x37f451['as'],'attributes':_0x37f451['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x55df22){logger[_0xdf83('0xd')](_0xdf83('0x16'),_0x4f5103);logger[_0xdf83('0xf')](_0xdf83('0x16'),_0x4f5103,JSON[_0xdf83('0x11')](_0x55df22));_0x56f558(_0x55df22);})['catch'](function(_0x4b98f0){logger[_0xdf83('0x12')]('ShowSound',_0x4b98f0[_0xdf83('0x13')],_0x4f5103);_0x6e2069(_0x46dd39[_0xdf83('0x12')](0x1f4,_0x4b98f0[_0xdf83('0x13')]));});});}; \ No newline at end of file +var _0xdbfb=['debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','find','options','raw','where','attributes','include','map','model','ShowSound','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Sound,\x20%s,\x20%s','request\x20sent'];(function(_0x4c6c97,_0x243a44){var _0x3f6ca7=function(_0x54e6b7){while(--_0x54e6b7){_0x4c6c97['push'](_0x4c6c97['shift']());}};_0x3f6ca7(++_0x243a44);}(_0xdbfb,0x122));var _0xbdbf=function(_0x39840e,_0x52683a){_0x39840e=_0x39840e-0x0;var _0xc179cf=_0xdbfb[_0x39840e];return _0xc179cf;};'use strict';var _=require(_0xbdbf('0x0'));var util=require(_0xbdbf('0x1'));var moment=require(_0xbdbf('0x2'));var BPromise=require(_0xbdbf('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbdbf('0x4'));var db=require(_0xbdbf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xbdbf('0x6'))(_0xbdbf('0x7'));var config=require(_0xbdbf('0x8'));var jayson=require(_0xbdbf('0x9'));var client=jayson[_0xbdbf('0xa')][_0xbdbf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3e52c2,_0x3e1f53,_0x31c9d0){return new BPromise(function(_0x6ab774,_0x4927ce){return client[_0xbdbf('0xc')](_0x3e52c2,_0x31c9d0)[_0xbdbf('0xd')](function(_0x2dc3c7){logger['info'](_0xbdbf('0xe'),_0x3e1f53,_0xbdbf('0xf'));logger[_0xbdbf('0x10')](_0xbdbf('0x11'),_0x3e1f53,_0xbdbf('0xf'),JSON[_0xbdbf('0x12')](_0x2dc3c7));if(_0x2dc3c7['error']){if(_0x2dc3c7[_0xbdbf('0x13')][_0xbdbf('0x14')]===0x1f4){logger[_0xbdbf('0x13')]('Sound,\x20%s,\x20%s',_0x3e1f53,_0x2dc3c7['error'][_0xbdbf('0x15')]);return _0x4927ce(_0x2dc3c7[_0xbdbf('0x13')]['message']);}logger['error']('Sound,\x20%s,\x20%s',_0x3e1f53,_0x2dc3c7['error'][_0xbdbf('0x15')]);return _0x6ab774(_0x2dc3c7[_0xbdbf('0x13')][_0xbdbf('0x15')]);}else{logger[_0xbdbf('0x16')](_0xbdbf('0xe'),_0x3e1f53,_0xbdbf('0xf'));_0x6ab774(_0x2dc3c7[_0xbdbf('0x17')][_0xbdbf('0x15')]);}})[_0xbdbf('0x18')](function(_0x97b7b8){logger[_0xbdbf('0x13')](_0xbdbf('0xe'),_0x3e1f53,_0x97b7b8);_0x4927ce(_0x97b7b8);});});}exports['ShowSound']=function(_0x5f107f){var _0x51ff4a=this;return new Promise(function(_0x5f1dc9,_0x36d953){return db['Sound'][_0xbdbf('0x19')]({'raw':_0x5f107f[_0xbdbf('0x1a')]?_0x5f107f[_0xbdbf('0x1a')][_0xbdbf('0x1b')]===undefined?!![]:![]:!![],'where':_0x5f107f[_0xbdbf('0x1a')]?_0x5f107f[_0xbdbf('0x1a')][_0xbdbf('0x1c')]||null:null,'attributes':_0x5f107f[_0xbdbf('0x1a')]?_0x5f107f['options'][_0xbdbf('0x1d')]||null:null,'include':_0x5f107f[_0xbdbf('0x1a')]?_0x5f107f['options'][_0xbdbf('0x1e')]?_[_0xbdbf('0x1f')](_0x5f107f[_0xbdbf('0x1a')]['include'],function(_0x29b024){return{'model':db[_0x29b024[_0xbdbf('0x20')]],'as':_0x29b024['as'],'attributes':_0x29b024[_0xbdbf('0x1d')],'include':_0x29b024[_0xbdbf('0x1e')]?_['map'](_0x29b024['include'],function(_0x382522){return{'model':db[_0x382522[_0xbdbf('0x20')]],'as':_0x382522['as'],'attributes':_0x382522['attributes'],'include':_0x382522[_0xbdbf('0x1e')]?_[_0xbdbf('0x1f')](_0x382522[_0xbdbf('0x1e')],function(_0x1938b4){return{'model':db[_0x1938b4['model']],'as':_0x1938b4['as'],'attributes':_0x1938b4[_0xbdbf('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2f7198){logger[_0xbdbf('0x16')](_0xbdbf('0x21'),_0x5f107f);logger['debug'](_0xbdbf('0x21'),_0x5f107f,JSON['stringify'](_0x2f7198));_0x5f1dc9(_0x2f7198);})[_0xbdbf('0x18')](function(_0x5bd1e9){logger[_0xbdbf('0x13')](_0xbdbf('0x21'),_0x5bd1e9[_0xbdbf('0x15')],_0x5f107f);_0x36d953(_0x51ff4a[_0xbdbf('0x13')](0x1f4,_0x5bd1e9['message']));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 1e6115d..61a8aff 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(_0x2285be,_0x39728b){var _0x59ce16=function(_0x24abea){while(--_0x24abea){_0x2285be['push'](_0x2285be['shift']());}};_0x59ce16(++_0x39728b);}(_0x2032,0xd9));var _0x2203=function(_0x41995a,_0x5a8a90){_0x41995a=_0x41995a-0x0;var _0x299843=_0x2032[_0x41995a];return _0x299843;};'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 _0x0b0e=['./squareMessage.controller','get','isAuthenticated','index','show','post','create','/:id','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x20237d,_0x506c3d){var _0x5a5b92=function(_0xdca92d){while(--_0xdca92d){_0x20237d['push'](_0x20237d['shift']());}};_0x5a5b92(++_0x506c3d);}(_0x0b0e,0x187));var _0xe0b0=function(_0x274638,_0x578968){_0x274638=_0x274638-0x0;var _0x5755df=_0x0b0e[_0x274638];return _0x5755df;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0xd')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xe')]);router['put'](_0xe0b0('0xf'),auth[_0xe0b0('0xa')](),controller['update']);router[_0xe0b0('0x10')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x11')]);module[_0xe0b0('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index bd096e6..6a96742 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 _0x89d3=['out','sequelize','STRING','TEXT','ENUM'];(function(_0x318840,_0x561b1e){var _0x223da4=function(_0x510071){while(--_0x510071){_0x318840['push'](_0x318840['shift']());}};_0x223da4(++_0x561b1e);}(_0x89d3,0x13c));var _0x389d=function(_0x1f83ac,_0x8016fc){_0x1f83ac=_0x1f83ac-0x0;var _0x1985de=_0x89d3[_0x1f83ac];return _0x1985de;};'use strict';var Sequelize=require(_0x389d('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x389d('0x1')]},'body':{'type':Sequelize[_0x389d('0x2')]('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0x389d('0x3')]('in',_0x389d('0x4')),'defaultValue':_0x389d('0x4'),'allowNull':![]},'providerName':{'type':Sequelize[_0x389d('0x1')]},'providerResponse':{'type':Sequelize[_0x389d('0x2')]}}; \ No newline at end of file +var _0x3006=['STRING','medium','out','TEXT'];(function(_0x30a231,_0x59ec45){var _0x2e947c=function(_0x58200e){while(--_0x58200e){_0x30a231['push'](_0x30a231['shift']());}};_0x2e947c(++_0x59ec45);}(_0x3006,0x100));var _0x6300=function(_0x285ec5,_0x1629e2){_0x285ec5=_0x285ec5-0x0;var _0x2c4528=_0x3006[_0x285ec5];return _0x2c4528;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x6300('0x0')]},'body':{'type':Sequelize['TEXT'](_0x6300('0x1')),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in',_0x6300('0x2')),'defaultValue':_0x6300('0x2'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x6300('0x3')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index a4954b8..cdad3d2 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 _0x5612=['model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','SquareMessage','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','count','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key'];(function(_0x51cc1d,_0xaa88ae){var _0x2eb9f2=function(_0x1ca525){while(--_0x1ca525){_0x51cc1d['push'](_0x51cc1d['shift']());}};_0x2eb9f2(++_0xaa88ae);}(_0x5612,0x149));var _0x2561=function(_0x5026cd,_0x733e25){_0x5026cd=_0x5026cd-0x0;var _0x62086=_0x5612[_0x5026cd];return _0x62086;};'use strict';var emlformat=require(_0x2561('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2561('0x1'));var jsonpatch=require(_0x2561('0x2'));var rp=require(_0x2561('0x3'));var moment=require('moment');var BPromise=require(_0x2561('0x4'));var Mustache=require(_0x2561('0x5'));var util=require(_0x2561('0x6'));var path=require(_0x2561('0x7'));var sox=require('sox');var csv=require(_0x2561('0x8'));var ejs=require(_0x2561('0x9'));var fs=require('fs');var fs_extra=require(_0x2561('0xa'));var _=require(_0x2561('0xb'));var squel=require('squel');var crypto=require(_0x2561('0xc'));var jsforce=require(_0x2561('0xd'));var deskjs=require(_0x2561('0xe'));var toCsv=require(_0x2561('0x8'));var querystring=require(_0x2561('0xf'));var Papa=require(_0x2561('0x10'));var Redis=require('ioredis');var authService=require(_0x2561('0x11'));var qs=require(_0x2561('0x12'));var as=require(_0x2561('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2561('0x14'))('api');var utils=require(_0x2561('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2561('0x16'))['db'];function respondWithStatusCode(_0x27a405,_0x447741){_0x447741=_0x447741||0xcc;return function(_0x229154){if(_0x229154){return _0x27a405[_0x2561('0x17')](_0x447741);}return _0x27a405[_0x2561('0x18')](_0x447741)[_0x2561('0x19')]();};}function respondWithResult(_0x279e32,_0x52e54e){_0x52e54e=_0x52e54e||0xc8;return function(_0x443955){if(_0x443955){return _0x279e32[_0x2561('0x18')](_0x52e54e)[_0x2561('0x1a')](_0x443955);}};}function respondWithFilteredResult(_0x7a47da,_0x3d0b37){return function(_0x42f683){if(_0x42f683){var _0x474536=typeof _0x3d0b37[_0x2561('0x1b')]==='undefined'&&typeof _0x3d0b37[_0x2561('0x1c')]==='undefined';var _0x2af1a9=_0x42f683['count'];var _0x255c18=_0x474536?0x0:_0x3d0b37[_0x2561('0x1b')];var _0x2eab88=_0x474536?_0x42f683[_0x2561('0x1d')]:_0x3d0b37[_0x2561('0x1b')]+_0x3d0b37[_0x2561('0x1c')];var _0x40c11d;if(_0x2eab88>=_0x2af1a9){_0x2eab88=_0x2af1a9;_0x40c11d=0xc8;}else{_0x40c11d=0xce;}_0x7a47da[_0x2561('0x18')](_0x40c11d);return _0x7a47da['set'](_0x2561('0x1e'),_0x255c18+'-'+_0x2eab88+'/'+_0x2af1a9)[_0x2561('0x1a')](_0x42f683);}return null;};}function patchUpdates(_0x59c824){return function(_0x23dbe3){try{jsonpatch[_0x2561('0x1f')](_0x23dbe3,_0x59c824,!![]);}catch(_0x23e2e4){return BPromise[_0x2561('0x20')](_0x23e2e4);}return _0x23dbe3[_0x2561('0x21')]();};}function saveUpdates(_0x57e689,_0x1be223){return function(_0xa8d414){if(_0xa8d414){return _0xa8d414[_0x2561('0x22')](_0x57e689)[_0x2561('0x23')](function(_0x36ef67){return _0x36ef67;});}return null;};}function removeEntity(_0x203433,_0x8778ce){return function(_0x2c4613){if(_0x2c4613){return _0x2c4613['destroy']()[_0x2561('0x23')](function(){_0x203433['status'](0xcc)[_0x2561('0x19')]();});}};}function handleEntityNotFound(_0x5adef1,_0x5cc180){return function(_0x6a9b0f){if(!_0x6a9b0f){_0x5adef1[_0x2561('0x17')](0x194);}return _0x6a9b0f;};}function handleError(_0x58c42b,_0x4d6c49){_0x4d6c49=_0x4d6c49||0x1f4;return function(_0x470750){logger[_0x2561('0x24')](_0x470750[_0x2561('0x25')]);if(_0x470750[_0x2561('0x26')]){delete _0x470750[_0x2561('0x26')];}_0x58c42b[_0x2561('0x18')](_0x4d6c49)[_0x2561('0x27')](_0x470750);};}exports[_0x2561('0x28')]=function(_0x2d356a,_0x46c276){var _0x1ee43e={},_0x394ccf={},_0xc6a82d={'count':0x0,'rows':[]};var _0x198af7=_[_0x2561('0x29')](db['SquareMessage'][_0x2561('0x2a')],function(_0x127d17){return{'name':_0x127d17[_0x2561('0x2b')],'type':_0x127d17[_0x2561('0x2c')][_0x2561('0x2d')]};});_0x394ccf[_0x2561('0x2e')]=_[_0x2561('0x29')](_0x198af7,_0x2561('0x26'));_0x394ccf[_0x2561('0x2f')]=_[_0x2561('0x30')](_0x2d356a['query']);_0x394ccf[_0x2561('0x31')]=_[_0x2561('0x32')](_0x394ccf[_0x2561('0x2e')],_0x394ccf['query']);_0x1ee43e['attributes']=_[_0x2561('0x32')](_0x394ccf[_0x2561('0x2e')],qs[_0x2561('0x33')](_0x2d356a['query']['fields']));_0x1ee43e['attributes']=_0x1ee43e[_0x2561('0x34')][_0x2561('0x35')]?_0x1ee43e[_0x2561('0x34')]:_0x394ccf[_0x2561('0x2e')];if(!_0x2d356a[_0x2561('0x2f')][_0x2561('0x36')]('nolimit')){_0x1ee43e[_0x2561('0x1c')]=qs['limit'](_0x2d356a[_0x2561('0x2f')][_0x2561('0x1c')]);_0x1ee43e[_0x2561('0x1b')]=qs['offset'](_0x2d356a['query'][_0x2561('0x1b')]);}_0x1ee43e[_0x2561('0x37')]=qs[_0x2561('0x38')](_0x2d356a['query'][_0x2561('0x38')]);_0x1ee43e[_0x2561('0x39')]=qs[_0x2561('0x31')](_[_0x2561('0x3a')](_0x2d356a[_0x2561('0x2f')],_0x394ccf[_0x2561('0x31')]),_0x198af7);if(_0x2d356a[_0x2561('0x2f')][_0x2561('0x3b')]){_0x1ee43e[_0x2561('0x39')]=_['merge'](_0x1ee43e['where'],{'$or':_[_0x2561('0x29')](_0x198af7,function(_0x1055d7){if(_0x1055d7[_0x2561('0x2c')]!==_0x2561('0x3c')){var _0x51e442={};_0x51e442[_0x1055d7[_0x2561('0x26')]]={'$like':'%'+_0x2d356a[_0x2561('0x2f')][_0x2561('0x3b')]+'%'};return _0x51e442;}})});}_0x1ee43e=_[_0x2561('0x3d')]({},_0x1ee43e,_0x2d356a[_0x2561('0x3e')]);var _0x5b2083={'where':_0x1ee43e['where']};return db[_0x2561('0x3f')][_0x2561('0x1d')](_0x5b2083)[_0x2561('0x23')](function(_0x63e633){_0xc6a82d[_0x2561('0x1d')]=_0x63e633;if(_0x2d356a[_0x2561('0x2f')][_0x2561('0x40')]){_0x1ee43e[_0x2561('0x41')]=[{'all':!![]}];}return db[_0x2561('0x3f')][_0x2561('0x42')](_0x1ee43e);})[_0x2561('0x23')](function(_0x473242){_0xc6a82d[_0x2561('0x43')]=_0x473242;return _0xc6a82d;})[_0x2561('0x23')](respondWithFilteredResult(_0x46c276,_0x1ee43e))[_0x2561('0x44')](handleError(_0x46c276,null));};exports[_0x2561('0x45')]=function(_0xa7006a,_0x2f5567){var _0x56bd6d={'raw':!![],'where':{'id':_0xa7006a[_0x2561('0x46')]['id']}},_0x468d94={};_0x468d94['model']=_[_0x2561('0x30')](db[_0x2561('0x3f')][_0x2561('0x2a')]);_0x468d94[_0x2561('0x2f')]=_[_0x2561('0x30')](_0xa7006a['query']);_0x468d94[_0x2561('0x31')]=_[_0x2561('0x32')](_0x468d94[_0x2561('0x2e')],_0x468d94[_0x2561('0x2f')]);_0x56bd6d[_0x2561('0x34')]=_[_0x2561('0x32')](_0x468d94[_0x2561('0x2e')],qs['fields'](_0xa7006a[_0x2561('0x2f')]['fields']));_0x56bd6d['attributes']=_0x56bd6d[_0x2561('0x34')][_0x2561('0x35')]?_0x56bd6d[_0x2561('0x34')]:_0x468d94[_0x2561('0x2e')];if(_0xa7006a[_0x2561('0x2f')][_0x2561('0x40')]){_0x56bd6d[_0x2561('0x41')]=[{'all':!![]}];}_0x56bd6d=_[_0x2561('0x3d')]({},_0x56bd6d,_0xa7006a[_0x2561('0x3e')]);return db['SquareMessage'][_0x2561('0x47')](_0x56bd6d)[_0x2561('0x23')](handleEntityNotFound(_0x2f5567,null))[_0x2561('0x23')](respondWithResult(_0x2f5567,null))[_0x2561('0x44')](handleError(_0x2f5567,null));};exports[_0x2561('0x48')]=function(_0x4f0513,_0x3c2735){return db['SquareMessage'][_0x2561('0x48')](_0x4f0513[_0x2561('0x49')],{})[_0x2561('0x23')](respondWithResult(_0x3c2735,0xc9))[_0x2561('0x44')](handleError(_0x3c2735,null));};exports['update']=function(_0x3f16a4,_0x4afa0e){if(_0x3f16a4[_0x2561('0x49')]['id']){delete _0x3f16a4[_0x2561('0x49')]['id'];}return db[_0x2561('0x3f')][_0x2561('0x47')]({'where':{'id':_0x3f16a4['params']['id']}})['then'](handleEntityNotFound(_0x4afa0e,null))['then'](saveUpdates(_0x3f16a4['body'],null))[_0x2561('0x23')](respondWithResult(_0x4afa0e,null))['catch'](handleError(_0x4afa0e,null));};exports[_0x2561('0x4a')]=function(_0x51a946,_0x47c922){return db[_0x2561('0x3f')][_0x2561('0x47')]({'where':{'id':_0x51a946['params']['id']}})['then'](handleEntityNotFound(_0x47c922,null))[_0x2561('0x23')](removeEntity(_0x47c922,null))[_0x2561('0x44')](handleError(_0x47c922,null));}; \ No newline at end of file +var _0x9845=['desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','end','json','undefined','count','offset','limit','status','Content-Range','apply','save','update','then','destroy','error','stack','name','index','map','SquareMessage','rawAttributes','fieldName','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','include','create','body','find','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce'];(function(_0x23e3ce,_0x4b8d73){var _0x24a7d4=function(_0x4bb1de){while(--_0x4bb1de){_0x23e3ce['push'](_0x23e3ce['shift']());}};_0x24a7d4(++_0x4b8d73);}(_0x9845,0x1e2));var _0x5984=function(_0x4ed955,_0x5b2b35){_0x4ed955=_0x4ed955-0x0;var _0x24bd1b=_0x9845[_0x4ed955];return _0x24bd1b;};'use strict';var emlformat=require(_0x5984('0x0'));var rimraf=require(_0x5984('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5984('0x2'));var rp=require(_0x5984('0x3'));var moment=require(_0x5984('0x4'));var BPromise=require(_0x5984('0x5'));var Mustache=require(_0x5984('0x6'));var util=require('util');var path=require(_0x5984('0x7'));var sox=require(_0x5984('0x8'));var csv=require(_0x5984('0x9'));var ejs=require(_0x5984('0xa'));var fs=require('fs');var fs_extra=require(_0x5984('0xb'));var _=require('lodash');var squel=require(_0x5984('0xc'));var crypto=require(_0x5984('0xd'));var jsforce=require(_0x5984('0xe'));var deskjs=require(_0x5984('0xf'));var toCsv=require(_0x5984('0x9'));var querystring=require('querystring');var Papa=require(_0x5984('0x10'));var Redis=require(_0x5984('0x11'));var authService=require(_0x5984('0x12'));var qs=require(_0x5984('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5984('0x14'));var logger=require(_0x5984('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x5984('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x5984('0x17'))['db'];function respondWithStatusCode(_0x1487a3,_0x20e728){_0x20e728=_0x20e728||0xcc;return function(_0x5218e4){if(_0x5218e4){return _0x1487a3[_0x5984('0x18')](_0x20e728);}return _0x1487a3['status'](_0x20e728)[_0x5984('0x19')]();};}function respondWithResult(_0x173e56,_0x25aa3f){_0x25aa3f=_0x25aa3f||0xc8;return function(_0x4e6faa){if(_0x4e6faa){return _0x173e56['status'](_0x25aa3f)[_0x5984('0x1a')](_0x4e6faa);}};}function respondWithFilteredResult(_0x5d85a7,_0x3894f2){return function(_0x37036b){if(_0x37036b){var _0x198aef=typeof _0x3894f2['offset']===_0x5984('0x1b')&&typeof _0x3894f2['limit']===_0x5984('0x1b');var _0x328885=_0x37036b[_0x5984('0x1c')];var _0x5715f5=_0x198aef?0x0:_0x3894f2[_0x5984('0x1d')];var _0x4c0cdf=_0x198aef?_0x37036b[_0x5984('0x1c')]:_0x3894f2[_0x5984('0x1d')]+_0x3894f2[_0x5984('0x1e')];var _0x5d52f3;if(_0x4c0cdf>=_0x328885){_0x4c0cdf=_0x328885;_0x5d52f3=0xc8;}else{_0x5d52f3=0xce;}_0x5d85a7[_0x5984('0x1f')](_0x5d52f3);return _0x5d85a7['set'](_0x5984('0x20'),_0x5715f5+'-'+_0x4c0cdf+'/'+_0x328885)['json'](_0x37036b);}return null;};}function patchUpdates(_0x484110){return function(_0xcbf8e4){try{jsonpatch[_0x5984('0x21')](_0xcbf8e4,_0x484110,!![]);}catch(_0x4e8f3a){return BPromise['reject'](_0x4e8f3a);}return _0xcbf8e4[_0x5984('0x22')]();};}function saveUpdates(_0x13d8c0,_0x3712b9){return function(_0x12b66c){if(_0x12b66c){return _0x12b66c[_0x5984('0x23')](_0x13d8c0)[_0x5984('0x24')](function(_0x47ea79){return _0x47ea79;});}return null;};}function removeEntity(_0xfb2b58,_0x51c4ab){return function(_0x160396){if(_0x160396){return _0x160396[_0x5984('0x25')]()[_0x5984('0x24')](function(){_0xfb2b58[_0x5984('0x1f')](0xcc)[_0x5984('0x19')]();});}};}function handleEntityNotFound(_0x59247c,_0x24be01){return function(_0x192805){if(!_0x192805){_0x59247c[_0x5984('0x18')](0x194);}return _0x192805;};}function handleError(_0x271a2a,_0x196384){_0x196384=_0x196384||0x1f4;return function(_0x951f0b){logger[_0x5984('0x26')](_0x951f0b[_0x5984('0x27')]);if(_0x951f0b['name']){delete _0x951f0b[_0x5984('0x28')];}_0x271a2a[_0x5984('0x1f')](_0x196384)['send'](_0x951f0b);};}exports[_0x5984('0x29')]=function(_0x1327da,_0x51a2f2){var _0x20dcfe={},_0x4d4c68={},_0x3a3004={'count':0x0,'rows':[]};var _0x103724=_[_0x5984('0x2a')](db[_0x5984('0x2b')][_0x5984('0x2c')],function(_0x986fe9){return{'name':_0x986fe9[_0x5984('0x2d')],'type':_0x986fe9['type']['key']};});_0x4d4c68[_0x5984('0x2e')]=_['map'](_0x103724,'name');_0x4d4c68[_0x5984('0x2f')]=_['keys'](_0x1327da[_0x5984('0x2f')]);_0x4d4c68[_0x5984('0x30')]=_['intersection'](_0x4d4c68[_0x5984('0x2e')],_0x4d4c68[_0x5984('0x2f')]);_0x20dcfe['attributes']=_[_0x5984('0x31')](_0x4d4c68[_0x5984('0x2e')],qs[_0x5984('0x32')](_0x1327da[_0x5984('0x2f')][_0x5984('0x32')]));_0x20dcfe[_0x5984('0x33')]=_0x20dcfe[_0x5984('0x33')][_0x5984('0x34')]?_0x20dcfe[_0x5984('0x33')]:_0x4d4c68['model'];if(!_0x1327da['query'][_0x5984('0x35')]('nolimit')){_0x20dcfe[_0x5984('0x1e')]=qs['limit'](_0x1327da[_0x5984('0x2f')][_0x5984('0x1e')]);_0x20dcfe[_0x5984('0x1d')]=qs[_0x5984('0x1d')](_0x1327da[_0x5984('0x2f')][_0x5984('0x1d')]);}_0x20dcfe['order']=qs[_0x5984('0x36')](_0x1327da[_0x5984('0x2f')][_0x5984('0x36')]);_0x20dcfe[_0x5984('0x37')]=qs[_0x5984('0x30')](_['pick'](_0x1327da[_0x5984('0x2f')],_0x4d4c68['filters']),_0x103724);if(_0x1327da[_0x5984('0x2f')][_0x5984('0x38')]){_0x20dcfe[_0x5984('0x37')]=_[_0x5984('0x39')](_0x20dcfe['where'],{'$or':_[_0x5984('0x2a')](_0x103724,function(_0x33b2a6){if(_0x33b2a6['type']!==_0x5984('0x3a')){var _0x3d9245={};_0x3d9245[_0x33b2a6[_0x5984('0x28')]]={'$like':'%'+_0x1327da['query'][_0x5984('0x38')]+'%'};return _0x3d9245;}})});}_0x20dcfe=_[_0x5984('0x39')]({},_0x20dcfe,_0x1327da[_0x5984('0x3b')]);var _0x115ebc={'where':_0x20dcfe[_0x5984('0x37')]};return db[_0x5984('0x2b')][_0x5984('0x1c')](_0x115ebc)[_0x5984('0x24')](function(_0x43c532){_0x3a3004['count']=_0x43c532;if(_0x1327da[_0x5984('0x2f')][_0x5984('0x3c')]){_0x20dcfe['include']=[{'all':!![]}];}return db[_0x5984('0x2b')][_0x5984('0x3d')](_0x20dcfe);})[_0x5984('0x24')](function(_0xe5cf31){_0x3a3004[_0x5984('0x3e')]=_0xe5cf31;return _0x3a3004;})['then'](respondWithFilteredResult(_0x51a2f2,_0x20dcfe))[_0x5984('0x3f')](handleError(_0x51a2f2,null));};exports[_0x5984('0x40')]=function(_0x4b89f1,_0xdd5e69){var _0x293a14={'raw':!![],'where':{'id':_0x4b89f1[_0x5984('0x41')]['id']}},_0x5202ea={};_0x5202ea[_0x5984('0x2e')]=_[_0x5984('0x42')](db['SquareMessage'][_0x5984('0x2c')]);_0x5202ea[_0x5984('0x2f')]=_[_0x5984('0x42')](_0x4b89f1[_0x5984('0x2f')]);_0x5202ea[_0x5984('0x30')]=_['intersection'](_0x5202ea[_0x5984('0x2e')],_0x5202ea['query']);_0x293a14[_0x5984('0x33')]=_[_0x5984('0x31')](_0x5202ea[_0x5984('0x2e')],qs[_0x5984('0x32')](_0x4b89f1[_0x5984('0x2f')][_0x5984('0x32')]));_0x293a14['attributes']=_0x293a14[_0x5984('0x33')][_0x5984('0x34')]?_0x293a14[_0x5984('0x33')]:_0x5202ea[_0x5984('0x2e')];if(_0x4b89f1['query']['includeAll']){_0x293a14[_0x5984('0x43')]=[{'all':!![]}];}_0x293a14=_[_0x5984('0x39')]({},_0x293a14,_0x4b89f1[_0x5984('0x3b')]);return db[_0x5984('0x2b')]['find'](_0x293a14)[_0x5984('0x24')](handleEntityNotFound(_0xdd5e69,null))[_0x5984('0x24')](respondWithResult(_0xdd5e69,null))[_0x5984('0x3f')](handleError(_0xdd5e69,null));};exports['create']=function(_0x2e8a14,_0x5b1631){return db['SquareMessage'][_0x5984('0x44')](_0x2e8a14[_0x5984('0x45')],{})[_0x5984('0x24')](respondWithResult(_0x5b1631,0xc9))[_0x5984('0x3f')](handleError(_0x5b1631,null));};exports[_0x5984('0x23')]=function(_0x4a6ff8,_0x391073){if(_0x4a6ff8[_0x5984('0x45')]['id']){delete _0x4a6ff8[_0x5984('0x45')]['id'];}return db[_0x5984('0x2b')][_0x5984('0x46')]({'where':{'id':_0x4a6ff8['params']['id']}})[_0x5984('0x24')](handleEntityNotFound(_0x391073,null))[_0x5984('0x24')](saveUpdates(_0x4a6ff8[_0x5984('0x45')],null))[_0x5984('0x24')](respondWithResult(_0x391073,null))[_0x5984('0x3f')](handleError(_0x391073,null));};exports[_0x5984('0x25')]=function(_0x8cd397,_0x5cbc04){return db[_0x5984('0x2b')][_0x5984('0x46')]({'where':{'id':_0x8cd397[_0x5984('0x41')]['id']}})[_0x5984('0x24')](handleEntityNotFound(_0x5cbc04,null))[_0x5984('0x24')](removeEntity(_0x5cbc04,null))[_0x5984('0x3f')](handleError(_0x5cbc04,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 24aefaf..0a053bd 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 _0xdc46=['api','bluebird','request-promise','path','../../config/environment','./squareMessage.attributes','exports','define','SquareMessage','util','../../config/logger'];(function(_0x5f21aa,_0x3b79af){var _0x3d621c=function(_0x4a00bf){while(--_0x4a00bf){_0x5f21aa['push'](_0x5f21aa['shift']());}};_0x3d621c(++_0x3b79af);}(_0xdc46,0x1b6));var _0x6dc4=function(_0x1dceff,_0x2737f6){_0x1dceff=_0x1dceff-0x0;var _0x4057da=_0xdc46[_0x1dceff];return _0x4057da;};'use strict';var _=require('lodash');var util=require(_0x6dc4('0x0'));var logger=require(_0x6dc4('0x1'))(_0x6dc4('0x2'));var moment=require('moment');var BPromise=require(_0x6dc4('0x3'));var rp=require(_0x6dc4('0x4'));var fs=require('fs');var path=require(_0x6dc4('0x5'));var rimraf=require('rimraf');var config=require(_0x6dc4('0x6'));var attributes=require(_0x6dc4('0x7'));module[_0x6dc4('0x8')]=function(_0x1c2e72,_0x3562cc){return _0x1c2e72[_0x6dc4('0x9')](_0x6dc4('0xa'),attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8009=['./squareMessage.attributes','exports','define','SquareMessage','square_messages','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x185563,_0x4214ab){var _0x3a455e=function(_0x397dc8){while(--_0x397dc8){_0x185563['push'](_0x185563['shift']());}};_0x3a455e(++_0x4214ab);}(_0x8009,0x179));var _0x9800=function(_0x2f0699,_0x143cd7){_0x2f0699=_0x2f0699-0x0;var _0xa8533b=_0x8009[_0x2f0699];return _0xa8533b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9800('0x0'))('api');var moment=require(_0x9800('0x1'));var BPromise=require(_0x9800('0x2'));var rp=require(_0x9800('0x3'));var fs=require('fs');var path=require(_0x9800('0x4'));var rimraf=require(_0x9800('0x5'));var config=require(_0x9800('0x6'));var attributes=require(_0x9800('0x7'));module[_0x9800('0x8')]=function(_0x42e7e0,_0xfa073e){return _0x42e7e0[_0x9800('0x9')](_0x9800('0xa'),attributes,{'tableName':_0x9800('0xb'),'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 f2f17da..560a43e 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 _0x6cfb=['CreateSquareMessage','SquareMessage','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x46a9fc,_0x2e0297){var _0x3bc1a7=function(_0x54f6f6){while(--_0x54f6f6){_0x46a9fc['push'](_0x46a9fc['shift']());}};_0x3bc1a7(++_0x2e0297);}(_0x6cfb,0x1aa));var _0xb6cf=function(_0x424a9a,_0x2dd9af){_0x424a9a=_0x424a9a-0x0;var _0xa7831c=_0x6cfb[_0x424a9a];return _0xa7831c;};'use strict';var _=require(_0xb6cf('0x0'));var util=require(_0xb6cf('0x1'));var moment=require(_0xb6cf('0x2'));var BPromise=require(_0xb6cf('0x3'));var rs=require(_0xb6cf('0x4'));var fs=require('fs');var Redis=require(_0xb6cf('0x5'));var db=require(_0xb6cf('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xb6cf('0x7'))(_0xb6cf('0x8'));var config=require(_0xb6cf('0x9'));var jayson=require(_0xb6cf('0xa'));var client=jayson[_0xb6cf('0xb')][_0xb6cf('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xc82d84,_0x2be266,_0xed065a){return new BPromise(function(_0x48ec5e,_0x46c004){return client['request'](_0xc82d84,_0xed065a)[_0xb6cf('0xd')](function(_0x29b074){logger[_0xb6cf('0xe')](_0xb6cf('0xf'),_0x2be266,_0xb6cf('0x10'));logger[_0xb6cf('0x11')](_0xb6cf('0x12'),_0x2be266,'request\x20sent',JSON[_0xb6cf('0x13')](_0x29b074));if(_0x29b074[_0xb6cf('0x14')]){if(_0x29b074['error'][_0xb6cf('0x15')]===0x1f4){logger['error'](_0xb6cf('0xf'),_0x2be266,_0x29b074[_0xb6cf('0x14')]['message']);return _0x46c004(_0x29b074[_0xb6cf('0x14')][_0xb6cf('0x16')]);}logger['error'](_0xb6cf('0xf'),_0x2be266,_0x29b074[_0xb6cf('0x14')][_0xb6cf('0x16')]);return _0x48ec5e(_0x29b074[_0xb6cf('0x14')]['message']);}else{logger[_0xb6cf('0xe')]('SquareMessage,\x20%s,\x20%s',_0x2be266,'request\x20sent');_0x48ec5e(_0x29b074['result'][_0xb6cf('0x16')]);}})[_0xb6cf('0x17')](function(_0x14f906){logger[_0xb6cf('0x14')](_0xb6cf('0xf'),_0x2be266,_0x14f906);_0x46c004(_0x14f906);});});}exports[_0xb6cf('0x18')]=function(_0x1965d4){var _0x2af38c=this;return new Promise(function(_0x434e47,_0x2a5f92){return db[_0xb6cf('0x19')][_0xb6cf('0x1a')](_0x1965d4[_0xb6cf('0x1b')],{'raw':_0x1965d4['options']?_0x1965d4[_0xb6cf('0x1c')][_0xb6cf('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0xfc4109){logger[_0xb6cf('0xe')](_0xb6cf('0x18'),_0x1965d4);logger['debug']('CreateSquareMessage',_0x1965d4,JSON['stringify'](_0xfc4109));_0x434e47(_0xfc4109);})[_0xb6cf('0x17')](function(_0x295e7a){logger[_0xb6cf('0x14')]('CreateSquareMessage',_0x295e7a['message'],_0x1965d4);_0x2a5f92(_0x2af38c[_0xb6cf('0x14')](0x1f4,_0x295e7a[_0xb6cf('0x16')]));});});}; \ No newline at end of file +var _0x6b4b=['message','result','catch','CreateSquareMessage','SquareMessage','create','body','options','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','request\x20sent','debug','stringify','error','code','SquareMessage,\x20%s,\x20%s'];(function(_0x3c1238,_0x35c719){var _0x5a394f=function(_0x143793){while(--_0x143793){_0x3c1238['push'](_0x3c1238['shift']());}};_0x5a394f(++_0x35c719);}(_0x6b4b,0xcc));var _0xb6b4=function(_0x39c734,_0x2f3e06){_0x39c734=_0x39c734-0x0;var _0xb2a2f9=_0x6b4b[_0x39c734];return _0xb2a2f9;};'use strict';var _=require(_0xb6b4('0x0'));var util=require(_0xb6b4('0x1'));var moment=require(_0xb6b4('0x2'));var BPromise=require(_0xb6b4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb6b4('0x4'));var db=require(_0xb6b4('0x5'))['db'];var utils=require(_0xb6b4('0x6'));var logger=require(_0xb6b4('0x7'))(_0xb6b4('0x8'));var config=require(_0xb6b4('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xb6b4('0xa')][_0xb6b4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x53c364,_0x162969,_0x5cd5e9){return new BPromise(function(_0x53cbef,_0x4c1ef8){return client['request'](_0x53c364,_0x5cd5e9)[_0xb6b4('0xc')](function(_0x1686fd){logger[_0xb6b4('0xd')]('SquareMessage,\x20%s,\x20%s',_0x162969,_0xb6b4('0xe'));logger[_0xb6b4('0xf')]('SquareMessage,\x20%s,\x20%s,\x20%s',_0x162969,_0xb6b4('0xe'),JSON[_0xb6b4('0x10')](_0x1686fd));if(_0x1686fd[_0xb6b4('0x11')]){if(_0x1686fd[_0xb6b4('0x11')][_0xb6b4('0x12')]===0x1f4){logger['error'](_0xb6b4('0x13'),_0x162969,_0x1686fd[_0xb6b4('0x11')]['message']);return _0x4c1ef8(_0x1686fd[_0xb6b4('0x11')][_0xb6b4('0x14')]);}logger[_0xb6b4('0x11')](_0xb6b4('0x13'),_0x162969,_0x1686fd[_0xb6b4('0x11')][_0xb6b4('0x14')]);return _0x53cbef(_0x1686fd[_0xb6b4('0x11')][_0xb6b4('0x14')]);}else{logger[_0xb6b4('0xd')](_0xb6b4('0x13'),_0x162969,'request\x20sent');_0x53cbef(_0x1686fd[_0xb6b4('0x15')]['message']);}})[_0xb6b4('0x16')](function(_0x26f0e8){logger['error'](_0xb6b4('0x13'),_0x162969,_0x26f0e8);_0x4c1ef8(_0x26f0e8);});});}exports[_0xb6b4('0x17')]=function(_0x359857){var _0x3ee73a=this;return new Promise(function(_0x2ecef9,_0xc94a53){return db[_0xb6b4('0x18')][_0xb6b4('0x19')](_0x359857[_0xb6b4('0x1a')],{'raw':_0x359857[_0xb6b4('0x1b')]?_0x359857[_0xb6b4('0x1b')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x516c68){logger[_0xb6b4('0xd')](_0xb6b4('0x17'),_0x359857);logger['debug'](_0xb6b4('0x17'),_0x359857,JSON[_0xb6b4('0x10')](_0x516c68));_0x2ecef9(_0x516c68);})['catch'](function(_0x1eeb37){logger[_0xb6b4('0x11')](_0xb6b4('0x17'),_0x1eeb37[_0xb6b4('0x14')],_0x359857);_0xc94a53(_0x3ee73a[_0xb6b4('0x11')](0x1f4,_0x1eeb37[_0xb6b4('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index ab9bf3e..ebf9479 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 _0x4710=['create','put','/:id','isAuthenticated','update','destroy','exports','multer','express','Router','fs-extra','index','show','get','/:id/test','15s','test'];(function(_0x5c6330,_0x44f763){var _0x35d318=function(_0x12c712){while(--_0x12c712){_0x5c6330['push'](_0x5c6330['shift']());}};_0x35d318(++_0x44f763);}(_0x4710,0x139));var _0x0471=function(_0x1eeba4,_0x294889){_0x1eeba4=_0x1eeba4-0x0;var _0x5690b1=_0x4710[_0x1eeba4];return _0x5690b1;};'use strict';var multer=require(_0x0471('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0471('0x1'));var router=express[_0x0471('0x2')]();var fs_extra=require(_0x0471('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./squareOdbc.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x0471('0x4')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x0471('0x5')]);router[_0x0471('0x6')](_0x0471('0x7'),auth['isAuthenticated'](),timeout(_0x0471('0x8')),controller[_0x0471('0x9')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0471('0xa')]);router[_0x0471('0xb')](_0x0471('0xc'),auth[_0x0471('0xd')](),controller[_0x0471('0xe')]);router['delete'](_0x0471('0xc'),auth[_0x0471('0xd')](),controller[_0x0471('0xf')]);module[_0x0471('0x10')]=router; \ No newline at end of file +var _0x06aa=['destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./squareOdbc.controller','get','/:id','isAuthenticated','show','/:id/test','test','create','update'];(function(_0x1dbf97,_0x3d0669){var _0x13356d=function(_0x4461e5){while(--_0x4461e5){_0x1dbf97['push'](_0x1dbf97['shift']());}};_0x13356d(++_0x3d0669);}(_0x06aa,0x16a));var _0xa06a=function(_0x4133a6,_0x1dbb66){_0x4133a6=_0x4133a6-0x0;var _0x1457c2=_0x06aa[_0x4133a6];return _0x1457c2;};'use strict';var multer=require(_0xa06a('0x0'));var util=require(_0xa06a('0x1'));var path=require(_0xa06a('0x2'));var timeout=require(_0xa06a('0x3'));var express=require(_0xa06a('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa06a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa06a('0x6'));var controller=require(_0xa06a('0x7'));router[_0xa06a('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xa06a('0x9'),auth[_0xa06a('0xa')](),controller[_0xa06a('0xb')]);router['get'](_0xa06a('0xc'),auth[_0xa06a('0xa')](),timeout('15s'),controller[_0xa06a('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa06a('0xe')]);router['put'](_0xa06a('0x9'),auth[_0xa06a('0xa')](),controller[_0xa06a('0xf')]);router['delete'](_0xa06a('0x9'),auth[_0xa06a('0xa')](),controller[_0xa06a('0x10')]);module[_0xa06a('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 042846c..a6c0878 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 _0xa3ef=['name','STRING'];(function(_0xd740b3,_0x53649f){var _0x53f5e7=function(_0x3e57d0){while(--_0x3e57d0){_0xd740b3['push'](_0xd740b3['shift']());}};_0x53f5e7(++_0x53649f);}(_0xa3ef,0xbd));var _0xfa3e=function(_0x56a8c6,_0x30aec8){_0x56a8c6=_0x56a8c6-0x0;var _0x1cb75a=_0xa3ef[_0x56a8c6];return _0x1cb75a;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xfa3e('0x0')],'unique':_0xfa3e('0x1'),'allowNull':![]},'dsn':{'type':Sequelize[_0xfa3e('0x0')]},'description':{'type':Sequelize[_0xfa3e('0x0')]}}; \ No newline at end of file +var _0xefc3=['STRING','sequelize','exports'];(function(_0x22c15a,_0x2d6084){var _0x1071ca=function(_0x47276d){while(--_0x47276d){_0x22c15a['push'](_0x22c15a['shift']());}};_0x1071ca(++_0x2d6084);}(_0xefc3,0xcd));var _0x3efc=function(_0x411ac2,_0xe2bb01){_0x411ac2=_0x411ac2-0x0;var _0x102725=_0xefc3[_0x411ac2];return _0x102725;};'use strict';var Sequelize=require(_0x3efc('0x0'));module[_0x3efc('0x1')]={'name':{'type':Sequelize[_0x3efc('0x2')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3efc('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 785e89a..0012de7 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 _0x0bab=['then','get','ODBC','UserProfileResource','destroy','name','send','index','map','SquareOdbc','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','where','merge','VIRTUAL','filter','include','findAll','rows','catch','params','keys','rawAttributes','includeAll','options','find','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','test','dsn','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update'];(function(_0x4d0df6,_0x4634f3){var _0x4e2615=function(_0x5285e2){while(--_0x5285e2){_0x4d0df6['push'](_0x4d0df6['shift']());}};_0x4e2615(++_0x4634f3);}(_0x0bab,0x19f));var _0xb0ba=function(_0x350744,_0x7d9b13){_0x350744=_0x350744-0x0;var _0x14ad39=_0x0bab[_0x350744];return _0x14ad39;};'use strict';var emlformat=require(_0xb0ba('0x0'));var rimraf=require(_0xb0ba('0x1'));var zipdir=require(_0xb0ba('0x2'));var jsonpatch=require(_0xb0ba('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb0ba('0x4'));var Mustache=require(_0xb0ba('0x5'));var util=require(_0xb0ba('0x6'));var path=require('path');var sox=require(_0xb0ba('0x7'));var csv=require(_0xb0ba('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb0ba('0x9'));var _=require(_0xb0ba('0xa'));var squel=require(_0xb0ba('0xb'));var crypto=require(_0xb0ba('0xc'));var jsforce=require(_0xb0ba('0xd'));var deskjs=require(_0xb0ba('0xe'));var toCsv=require('to-csv');var querystring=require(_0xb0ba('0xf'));var Papa=require(_0xb0ba('0x10'));var Redis=require(_0xb0ba('0x11'));var authService=require(_0xb0ba('0x12'));var qs=require(_0xb0ba('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb0ba('0x14'));var logger=require(_0xb0ba('0x15'))(_0xb0ba('0x16'));var utils=require(_0xb0ba('0x17'));var config=require(_0xb0ba('0x18'));var licenseUtil=require(_0xb0ba('0x19'));var db=require(_0xb0ba('0x1a'))['db'];function respondWithStatusCode(_0x411935,_0x19570f){_0x19570f=_0x19570f||0xcc;return function(_0x526c48){if(_0x526c48){return _0x411935[_0xb0ba('0x1b')](_0x19570f);}return _0x411935[_0xb0ba('0x1c')](_0x19570f)[_0xb0ba('0x1d')]();};}function respondWithResult(_0x2c97d4,_0x17e8d9){_0x17e8d9=_0x17e8d9||0xc8;return function(_0x24aae2){if(_0x24aae2){return _0x2c97d4['status'](_0x17e8d9)[_0xb0ba('0x1e')](_0x24aae2);}};}function respondWithFilteredResult(_0x4e113c,_0x40745f){return function(_0x4b9129){if(_0x4b9129){var _0x2b7b3b=typeof _0x40745f[_0xb0ba('0x1f')]===_0xb0ba('0x20')&&typeof _0x40745f['limit']===_0xb0ba('0x20');var _0x1823c9=_0x4b9129[_0xb0ba('0x21')];var _0x3b9b45=_0x2b7b3b?0x0:_0x40745f[_0xb0ba('0x1f')];var _0x2f0f39=_0x2b7b3b?_0x4b9129['count']:_0x40745f[_0xb0ba('0x1f')]+_0x40745f[_0xb0ba('0x22')];var _0x483784;if(_0x2f0f39>=_0x1823c9){_0x2f0f39=_0x1823c9;_0x483784=0xc8;}else{_0x483784=0xce;}_0x4e113c['status'](_0x483784);return _0x4e113c[_0xb0ba('0x23')](_0xb0ba('0x24'),_0x3b9b45+'-'+_0x2f0f39+'/'+_0x1823c9)['json'](_0x4b9129);}return null;};}function patchUpdates(_0x15cdb6){return function(_0x46d3f2){try{jsonpatch[_0xb0ba('0x25')](_0x46d3f2,_0x15cdb6,!![]);}catch(_0xc45c9){return BPromise['reject'](_0xc45c9);}return _0x46d3f2[_0xb0ba('0x26')]();};}function saveUpdates(_0x22539b,_0x2bf4a8){return function(_0x1a2298){if(_0x1a2298){return _0x1a2298[_0xb0ba('0x27')](_0x22539b)[_0xb0ba('0x28')](function(_0xe39cf8){return _0xe39cf8;});}return null;};}function removeEntity(_0x2d2200,_0x3e0736){return function(_0x1fecdd){if(_0x1fecdd){return _0x1fecdd['destroy']()[_0xb0ba('0x28')](function(){var _0xf891a=_0x1fecdd[_0xb0ba('0x29')]({'plain':!![]});var _0x3318f5=_0xb0ba('0x2a');return db[_0xb0ba('0x2b')][_0xb0ba('0x2c')]({'where':{'type':_0x3318f5,'resourceId':_0xf891a['id']}})[_0xb0ba('0x28')](function(){return _0x1fecdd;});})[_0xb0ba('0x28')](function(){_0x2d2200['status'](0xcc)[_0xb0ba('0x1d')]();});}};}function handleEntityNotFound(_0x150bb6,_0x28d40e){return function(_0x1f25ce){if(!_0x1f25ce){_0x150bb6[_0xb0ba('0x1b')](0x194);}return _0x1f25ce;};}function handleError(_0x427f97,_0x254057){_0x254057=_0x254057||0x1f4;return function(_0xadc516){logger['error'](_0xadc516['stack']);if(_0xadc516[_0xb0ba('0x2d')]){delete _0xadc516[_0xb0ba('0x2d')];}_0x427f97[_0xb0ba('0x1c')](_0x254057)[_0xb0ba('0x2e')](_0xadc516);};}exports[_0xb0ba('0x2f')]=function(_0x1cf7a2,_0xb855a0){var _0x11ea13={},_0x1a0f50={},_0x44c731={'count':0x0,'rows':[]};var _0x2aed03=_[_0xb0ba('0x30')](db[_0xb0ba('0x31')]['rawAttributes'],function(_0x398988){return{'name':_0x398988[_0xb0ba('0x32')],'type':_0x398988[_0xb0ba('0x33')][_0xb0ba('0x34')]};});_0x1a0f50[_0xb0ba('0x35')]=_['map'](_0x2aed03,'name');_0x1a0f50[_0xb0ba('0x36')]=_['keys'](_0x1cf7a2[_0xb0ba('0x36')]);_0x1a0f50[_0xb0ba('0x37')]=_[_0xb0ba('0x38')](_0x1a0f50[_0xb0ba('0x35')],_0x1a0f50['query']);_0x11ea13[_0xb0ba('0x39')]=_[_0xb0ba('0x38')](_0x1a0f50[_0xb0ba('0x35')],qs[_0xb0ba('0x3a')](_0x1cf7a2[_0xb0ba('0x36')][_0xb0ba('0x3a')]));_0x11ea13['attributes']=_0x11ea13[_0xb0ba('0x39')][_0xb0ba('0x3b')]?_0x11ea13['attributes']:_0x1a0f50['model'];if(!_0x1cf7a2[_0xb0ba('0x36')][_0xb0ba('0x3c')]('nolimit')){_0x11ea13['limit']=qs[_0xb0ba('0x22')](_0x1cf7a2[_0xb0ba('0x36')][_0xb0ba('0x22')]);_0x11ea13[_0xb0ba('0x1f')]=qs[_0xb0ba('0x1f')](_0x1cf7a2[_0xb0ba('0x36')][_0xb0ba('0x1f')]);}_0x11ea13[_0xb0ba('0x3d')]=qs['sort'](_0x1cf7a2['query'][_0xb0ba('0x3e')]);_0x11ea13['where']=qs[_0xb0ba('0x37')](_[_0xb0ba('0x3f')](_0x1cf7a2['query'],_0x1a0f50['filters']),_0x2aed03);if(_0x1cf7a2[_0xb0ba('0x36')]['filter']){_0x11ea13[_0xb0ba('0x40')]=_[_0xb0ba('0x41')](_0x11ea13[_0xb0ba('0x40')],{'$or':_[_0xb0ba('0x30')](_0x2aed03,function(_0x4c4cce){if(_0x4c4cce['type']!==_0xb0ba('0x42')){var _0x5de952={};_0x5de952[_0x4c4cce['name']]={'$like':'%'+_0x1cf7a2[_0xb0ba('0x36')][_0xb0ba('0x43')]+'%'};return _0x5de952;}})});}_0x11ea13=_[_0xb0ba('0x41')]({},_0x11ea13,_0x1cf7a2['options']);var _0x347e08={'where':_0x11ea13[_0xb0ba('0x40')]};return db[_0xb0ba('0x31')][_0xb0ba('0x21')](_0x347e08)[_0xb0ba('0x28')](function(_0x4f2ddd){_0x44c731['count']=_0x4f2ddd;if(_0x1cf7a2[_0xb0ba('0x36')]['includeAll']){_0x11ea13[_0xb0ba('0x44')]=[{'all':!![]}];}return db['SquareOdbc'][_0xb0ba('0x45')](_0x11ea13);})['then'](function(_0x5dac04){_0x44c731[_0xb0ba('0x46')]=_0x5dac04;return _0x44c731;})[_0xb0ba('0x28')](respondWithFilteredResult(_0xb855a0,_0x11ea13))[_0xb0ba('0x47')](handleError(_0xb855a0,null));};exports['show']=function(_0x3ee564,_0x5e1421){var _0x141737={'raw':!![],'where':{'id':_0x3ee564[_0xb0ba('0x48')]['id']}},_0x5d9283={};_0x5d9283[_0xb0ba('0x35')]=_[_0xb0ba('0x49')](db[_0xb0ba('0x31')][_0xb0ba('0x4a')]);_0x5d9283[_0xb0ba('0x36')]=_['keys'](_0x3ee564['query']);_0x5d9283[_0xb0ba('0x37')]=_[_0xb0ba('0x38')](_0x5d9283[_0xb0ba('0x35')],_0x5d9283['query']);_0x141737[_0xb0ba('0x39')]=_[_0xb0ba('0x38')](_0x5d9283[_0xb0ba('0x35')],qs[_0xb0ba('0x3a')](_0x3ee564[_0xb0ba('0x36')][_0xb0ba('0x3a')]));_0x141737[_0xb0ba('0x39')]=_0x141737[_0xb0ba('0x39')][_0xb0ba('0x3b')]?_0x141737['attributes']:_0x5d9283[_0xb0ba('0x35')];if(_0x3ee564[_0xb0ba('0x36')][_0xb0ba('0x4b')]){_0x141737[_0xb0ba('0x44')]=[{'all':!![]}];}_0x141737=_['merge']({},_0x141737,_0x3ee564[_0xb0ba('0x4c')]);return db['SquareOdbc'][_0xb0ba('0x4d')](_0x141737)[_0xb0ba('0x28')](handleEntityNotFound(_0x5e1421,null))[_0xb0ba('0x28')](respondWithResult(_0x5e1421,null))[_0xb0ba('0x47')](handleError(_0x5e1421,null));};exports['create']=function(_0x40e566,_0x5bedb6){return db[_0xb0ba('0x31')]['create'](_0x40e566['body'],{})[_0xb0ba('0x28')](function(_0x3f454d){var _0x255b69=_0x40e566[_0xb0ba('0x4e')][_0xb0ba('0x29')]({'plain':!![]});if(!_0x255b69)throw new Error(_0xb0ba('0x4f'));if(_0x255b69[_0xb0ba('0x50')]===_0xb0ba('0x4e')){var _0xd25c7c=_0x3f454d['get']({'plain':!![]});var _0x97119b=_0xb0ba('0x2a');return db[_0xb0ba('0x51')]['find']({'where':{'name':_0x97119b,'userProfileId':_0x255b69[_0xb0ba('0x52')]},'raw':!![]})[_0xb0ba('0x28')](function(_0xc2c632){if(_0xc2c632&&_0xc2c632[_0xb0ba('0x53')]===0x0){return db[_0xb0ba('0x2b')][_0xb0ba('0x54')]({'name':_0xd25c7c['name'],'resourceId':_0xd25c7c['id'],'type':_0xc2c632[_0xb0ba('0x2d')],'sectionId':_0xc2c632['id']},{})[_0xb0ba('0x28')](function(){return _0x3f454d;});}else{return _0x3f454d;}})[_0xb0ba('0x47')](function(_0x50218e){logger[_0xb0ba('0x55')](_0xb0ba('0x56'),_0x50218e);throw _0x50218e;});}return _0x3f454d;})[_0xb0ba('0x28')](respondWithResult(_0x5bedb6,0xc9))[_0xb0ba('0x47')](handleError(_0x5bedb6,null));};exports[_0xb0ba('0x27')]=function(_0x3ca42e,_0x5ea7a4){if(_0x3ca42e[_0xb0ba('0x57')]['id']){delete _0x3ca42e['body']['id'];}return db[_0xb0ba('0x31')][_0xb0ba('0x4d')]({'where':{'id':_0x3ca42e[_0xb0ba('0x48')]['id']}})[_0xb0ba('0x28')](handleEntityNotFound(_0x5ea7a4,null))['then'](saveUpdates(_0x3ca42e[_0xb0ba('0x57')],null))[_0xb0ba('0x28')](respondWithResult(_0x5ea7a4,null))[_0xb0ba('0x47')](handleError(_0x5ea7a4,null));};exports[_0xb0ba('0x2c')]=function(_0x2e68ed,_0x67d314){return db[_0xb0ba('0x31')]['find']({'where':{'id':_0x2e68ed['params']['id']}})['then'](handleEntityNotFound(_0x67d314,null))[_0xb0ba('0x28')](removeEntity(_0x67d314,null))[_0xb0ba('0x47')](handleError(_0x67d314,null));};exports[_0xb0ba('0x58')]=function(_0xa81735,_0x39f8cd,_0x335a69){var _0x4f3bf7;return db[_0xb0ba('0x31')][_0xb0ba('0x4d')]({'where':{'id':_0xa81735[_0xb0ba('0x48')]['id']},'attributes':['id',_0xb0ba('0x59')]})[_0xb0ba('0x28')](handleEntityNotFound(_0x39f8cd,null))['then'](function(_0x53a174){if(_0x53a174){var _0x4038a0=require('odbc')();_0x4038a0['openSync'](_0x53a174[_0xb0ba('0x59')]);_0x4038a0[_0xb0ba('0x5a')]();return _0x53a174;}})['then'](respondWithResult(_0x39f8cd,null))[_0xb0ba('0x47')](handleError(_0x39f8cd,null));}; \ No newline at end of file +var _0x103b=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','count','limit','set','Content-Range','apply','save','update','then','get','ODBC','UserProfileResource','destroy','stack','name','index','SquareOdbc','fieldName','type','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','include','findAll','catch','params','includeAll','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','dsn','odbc','openSync','closeSync','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x103b,0x1e1));var _0xb103=function(_0xc994c0,_0x17f70f){_0xc994c0=_0xc994c0-0x0;var _0x3a0f72=_0x103b[_0xc994c0];return _0x3a0f72;};'use strict';var emlformat=require(_0xb103('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb103('0x1'));var jsonpatch=require(_0xb103('0x2'));var rp=require(_0xb103('0x3'));var moment=require('moment');var BPromise=require(_0xb103('0x4'));var Mustache=require(_0xb103('0x5'));var util=require(_0xb103('0x6'));var path=require(_0xb103('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb103('0x8'));var fs=require('fs');var fs_extra=require(_0xb103('0x9'));var _=require(_0xb103('0xa'));var squel=require('squel');var crypto=require(_0xb103('0xb'));var jsforce=require(_0xb103('0xc'));var deskjs=require(_0xb103('0xd'));var toCsv=require(_0xb103('0xe'));var querystring=require(_0xb103('0xf'));var Papa=require(_0xb103('0x10'));var Redis=require(_0xb103('0x11'));var authService=require(_0xb103('0x12'));var qs=require(_0xb103('0x13'));var as=require(_0xb103('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xb103('0x15'));var config=require(_0xb103('0x16'));var licenseUtil=require(_0xb103('0x17'));var db=require(_0xb103('0x18'))['db'];function respondWithStatusCode(_0x14cdd1,_0x3b72bd){_0x3b72bd=_0x3b72bd||0xcc;return function(_0x415ca2){if(_0x415ca2){return _0x14cdd1[_0xb103('0x19')](_0x3b72bd);}return _0x14cdd1[_0xb103('0x1a')](_0x3b72bd)[_0xb103('0x1b')]();};}function respondWithResult(_0x41b10e,_0x348000){_0x348000=_0x348000||0xc8;return function(_0x3cb896){if(_0x3cb896){return _0x41b10e[_0xb103('0x1a')](_0x348000)[_0xb103('0x1c')](_0x3cb896);}};}function respondWithFilteredResult(_0x489cc8,_0x35a69d){return function(_0x17fc15){if(_0x17fc15){var _0x525019=typeof _0x35a69d[_0xb103('0x1d')]==='undefined'&&typeof _0x35a69d['limit']==='undefined';var _0x373e61=_0x17fc15[_0xb103('0x1e')];var _0x1f1f7c=_0x525019?0x0:_0x35a69d[_0xb103('0x1d')];var _0x12ca81=_0x525019?_0x17fc15[_0xb103('0x1e')]:_0x35a69d[_0xb103('0x1d')]+_0x35a69d[_0xb103('0x1f')];var _0x1cdbc2;if(_0x12ca81>=_0x373e61){_0x12ca81=_0x373e61;_0x1cdbc2=0xc8;}else{_0x1cdbc2=0xce;}_0x489cc8[_0xb103('0x1a')](_0x1cdbc2);return _0x489cc8[_0xb103('0x20')](_0xb103('0x21'),_0x1f1f7c+'-'+_0x12ca81+'/'+_0x373e61)[_0xb103('0x1c')](_0x17fc15);}return null;};}function patchUpdates(_0x3a4b22){return function(_0x1381cc){try{jsonpatch[_0xb103('0x22')](_0x1381cc,_0x3a4b22,!![]);}catch(_0x39fc10){return BPromise['reject'](_0x39fc10);}return _0x1381cc[_0xb103('0x23')]();};}function saveUpdates(_0x161047,_0x532b0b){return function(_0x15f652){if(_0x15f652){return _0x15f652[_0xb103('0x24')](_0x161047)['then'](function(_0x33c9ae){return _0x33c9ae;});}return null;};}function removeEntity(_0x1781df,_0x3600ed){return function(_0x29aba6){if(_0x29aba6){return _0x29aba6['destroy']()[_0xb103('0x25')](function(){var _0x3633cc=_0x29aba6[_0xb103('0x26')]({'plain':!![]});var _0xa55dbf=_0xb103('0x27');return db[_0xb103('0x28')][_0xb103('0x29')]({'where':{'type':_0xa55dbf,'resourceId':_0x3633cc['id']}})[_0xb103('0x25')](function(){return _0x29aba6;});})[_0xb103('0x25')](function(){_0x1781df[_0xb103('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3bbaa6,_0x50a08c){return function(_0x2c95a2){if(!_0x2c95a2){_0x3bbaa6[_0xb103('0x19')](0x194);}return _0x2c95a2;};}function handleError(_0xa66748,_0x166bf6){_0x166bf6=_0x166bf6||0x1f4;return function(_0x182dec){logger['error'](_0x182dec[_0xb103('0x2a')]);if(_0x182dec[_0xb103('0x2b')]){delete _0x182dec[_0xb103('0x2b')];}_0xa66748[_0xb103('0x1a')](_0x166bf6)['send'](_0x182dec);};}exports[_0xb103('0x2c')]=function(_0x4a1056,_0x128b58){var _0x440095={},_0x4e3ff4={},_0x1967aa={'count':0x0,'rows':[]};var _0x4d1638=_['map'](db[_0xb103('0x2d')]['rawAttributes'],function(_0x11c494){return{'name':_0x11c494[_0xb103('0x2e')],'type':_0x11c494[_0xb103('0x2f')]['key']};});_0x4e3ff4[_0xb103('0x30')]=_[_0xb103('0x31')](_0x4d1638,_0xb103('0x2b'));_0x4e3ff4[_0xb103('0x32')]=_[_0xb103('0x33')](_0x4a1056[_0xb103('0x32')]);_0x4e3ff4['filters']=_[_0xb103('0x34')](_0x4e3ff4[_0xb103('0x30')],_0x4e3ff4['query']);_0x440095[_0xb103('0x35')]=_[_0xb103('0x34')](_0x4e3ff4[_0xb103('0x30')],qs[_0xb103('0x36')](_0x4a1056[_0xb103('0x32')][_0xb103('0x36')]));_0x440095[_0xb103('0x35')]=_0x440095['attributes'][_0xb103('0x37')]?_0x440095[_0xb103('0x35')]:_0x4e3ff4[_0xb103('0x30')];if(!_0x4a1056[_0xb103('0x32')][_0xb103('0x38')]('nolimit')){_0x440095['limit']=qs['limit'](_0x4a1056['query']['limit']);_0x440095['offset']=qs[_0xb103('0x1d')](_0x4a1056[_0xb103('0x32')][_0xb103('0x1d')]);}_0x440095[_0xb103('0x39')]=qs[_0xb103('0x3a')](_0x4a1056['query'][_0xb103('0x3a')]);_0x440095[_0xb103('0x3b')]=qs[_0xb103('0x3c')](_[_0xb103('0x3d')](_0x4a1056[_0xb103('0x32')],_0x4e3ff4[_0xb103('0x3c')]),_0x4d1638);if(_0x4a1056[_0xb103('0x32')]['filter']){_0x440095[_0xb103('0x3b')]=_['merge'](_0x440095[_0xb103('0x3b')],{'$or':_[_0xb103('0x31')](_0x4d1638,function(_0x2dd88d){if(_0x2dd88d[_0xb103('0x2f')]!=='VIRTUAL'){var _0x207898={};_0x207898[_0x2dd88d[_0xb103('0x2b')]]={'$like':'%'+_0x4a1056[_0xb103('0x32')][_0xb103('0x3e')]+'%'};return _0x207898;}})});}_0x440095=_['merge']({},_0x440095,_0x4a1056['options']);var _0xfe26a={'where':_0x440095[_0xb103('0x3b')]};return db[_0xb103('0x2d')][_0xb103('0x1e')](_0xfe26a)['then'](function(_0x1d1dfa){_0x1967aa['count']=_0x1d1dfa;if(_0x4a1056['query']['includeAll']){_0x440095[_0xb103('0x3f')]=[{'all':!![]}];}return db['SquareOdbc'][_0xb103('0x40')](_0x440095);})['then'](function(_0x3cfc62){_0x1967aa['rows']=_0x3cfc62;return _0x1967aa;})[_0xb103('0x25')](respondWithFilteredResult(_0x128b58,_0x440095))[_0xb103('0x41')](handleError(_0x128b58,null));};exports['show']=function(_0x335e29,_0x1a956a){var _0xa6158d={'raw':!![],'where':{'id':_0x335e29[_0xb103('0x42')]['id']}},_0x56655e={};_0x56655e[_0xb103('0x30')]=_[_0xb103('0x33')](db['SquareOdbc']['rawAttributes']);_0x56655e[_0xb103('0x32')]=_['keys'](_0x335e29[_0xb103('0x32')]);_0x56655e[_0xb103('0x3c')]=_[_0xb103('0x34')](_0x56655e['model'],_0x56655e[_0xb103('0x32')]);_0xa6158d[_0xb103('0x35')]=_['intersection'](_0x56655e[_0xb103('0x30')],qs[_0xb103('0x36')](_0x335e29[_0xb103('0x32')][_0xb103('0x36')]));_0xa6158d[_0xb103('0x35')]=_0xa6158d[_0xb103('0x35')]['length']?_0xa6158d[_0xb103('0x35')]:_0x56655e[_0xb103('0x30')];if(_0x335e29['query'][_0xb103('0x43')]){_0xa6158d[_0xb103('0x3f')]=[{'all':!![]}];}_0xa6158d=_['merge']({},_0xa6158d,_0x335e29['options']);return db[_0xb103('0x2d')][_0xb103('0x44')](_0xa6158d)[_0xb103('0x25')](handleEntityNotFound(_0x1a956a,null))[_0xb103('0x25')](respondWithResult(_0x1a956a,null))[_0xb103('0x41')](handleError(_0x1a956a,null));};exports[_0xb103('0x45')]=function(_0x4a0460,_0x1ae691){return db[_0xb103('0x2d')][_0xb103('0x45')](_0x4a0460[_0xb103('0x46')],{})[_0xb103('0x25')](function(_0x471ce1){var _0x589139=_0x4a0460[_0xb103('0x47')]['get']({'plain':!![]});if(!_0x589139)throw new Error(_0xb103('0x48'));if(_0x589139[_0xb103('0x49')]===_0xb103('0x47')){var _0x318f68=_0x471ce1['get']({'plain':!![]});var _0x30c9fc='ODBC';return db[_0xb103('0x4a')][_0xb103('0x44')]({'where':{'name':_0x30c9fc,'userProfileId':_0x589139[_0xb103('0x4b')]},'raw':!![]})['then'](function(_0x36e7cc){if(_0x36e7cc&&_0x36e7cc[_0xb103('0x4c')]===0x0){return db[_0xb103('0x28')][_0xb103('0x45')]({'name':_0x318f68[_0xb103('0x2b')],'resourceId':_0x318f68['id'],'type':_0x36e7cc[_0xb103('0x2b')],'sectionId':_0x36e7cc['id']},{})['then'](function(){return _0x471ce1;});}else{return _0x471ce1;}})['catch'](function(_0x5cb295){logger[_0xb103('0x4d')](_0xb103('0x4e'),_0x5cb295);throw _0x5cb295;});}return _0x471ce1;})[_0xb103('0x25')](respondWithResult(_0x1ae691,0xc9))[_0xb103('0x41')](handleError(_0x1ae691,null));};exports[_0xb103('0x24')]=function(_0xea8aa6,_0xbc067c){if(_0xea8aa6[_0xb103('0x46')]['id']){delete _0xea8aa6[_0xb103('0x46')]['id'];}return db[_0xb103('0x2d')]['find']({'where':{'id':_0xea8aa6['params']['id']}})[_0xb103('0x25')](handleEntityNotFound(_0xbc067c,null))['then'](saveUpdates(_0xea8aa6[_0xb103('0x46')],null))[_0xb103('0x25')](respondWithResult(_0xbc067c,null))[_0xb103('0x41')](handleError(_0xbc067c,null));};exports['destroy']=function(_0x5a6b88,_0x18f19c){return db[_0xb103('0x2d')][_0xb103('0x44')]({'where':{'id':_0x5a6b88[_0xb103('0x42')]['id']}})[_0xb103('0x25')](handleEntityNotFound(_0x18f19c,null))[_0xb103('0x25')](removeEntity(_0x18f19c,null))['catch'](handleError(_0x18f19c,null));};exports['test']=function(_0x5abe11,_0x9158e8,_0x2e74ea){var _0x5c20e2;return db[_0xb103('0x2d')][_0xb103('0x44')]({'where':{'id':_0x5abe11[_0xb103('0x42')]['id']},'attributes':['id',_0xb103('0x4f')]})[_0xb103('0x25')](handleEntityNotFound(_0x9158e8,null))[_0xb103('0x25')](function(_0x7e68ea){if(_0x7e68ea){var _0x960324=require(_0xb103('0x50'))();_0x960324[_0xb103('0x51')](_0x7e68ea[_0xb103('0x4f')]);_0x960324[_0xb103('0x52')]();return _0x7e68ea;}})[_0xb103('0x25')](respondWithResult(_0x9158e8,null))[_0xb103('0x41')](handleError(_0x9158e8,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 6012e33..b3aba3f 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 _0x9bef=['moment','bluebird','request-promise','path','rimraf','./squareOdbc.attributes','define','SquareOdbc','lodash','util','api'];(function(_0x1670e8,_0x5488ea){var _0x11fe3=function(_0x19c667){while(--_0x19c667){_0x1670e8['push'](_0x1670e8['shift']());}};_0x11fe3(++_0x5488ea);}(_0x9bef,0xfa));var _0xf9be=function(_0x4e7516,_0x30eacf){_0x4e7516=_0x4e7516-0x0;var _0x4fd321=_0x9bef[_0x4e7516];return _0x4fd321;};'use strict';var _=require(_0xf9be('0x0'));var util=require(_0xf9be('0x1'));var logger=require('../../config/logger')(_0xf9be('0x2'));var moment=require(_0xf9be('0x3'));var BPromise=require(_0xf9be('0x4'));var rp=require(_0xf9be('0x5'));var fs=require('fs');var path=require(_0xf9be('0x6'));var rimraf=require(_0xf9be('0x7'));var config=require('../../config/environment');var attributes=require(_0xf9be('0x8'));module['exports']=function(_0x3bfdb1,_0x24bd89){return _0x3bfdb1[_0xf9be('0x9')](_0xf9be('0xa'),attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6bda=['lodash','util','api','moment','bluebird','path','../../config/environment','./squareOdbc.attributes','exports','define','SquareOdbc','square_odbc'];(function(_0xeb46ce,_0x3042b3){var _0x14acda=function(_0x246b75){while(--_0x246b75){_0xeb46ce['push'](_0xeb46ce['shift']());}};_0x14acda(++_0x3042b3);}(_0x6bda,0xf0));var _0xa6bd=function(_0x3d7446,_0x52d7ce){_0x3d7446=_0x3d7446-0x0;var _0xcd565=_0x6bda[_0x3d7446];return _0xcd565;};'use strict';var _=require(_0xa6bd('0x0'));var util=require(_0xa6bd('0x1'));var logger=require('../../config/logger')(_0xa6bd('0x2'));var moment=require(_0xa6bd('0x3'));var BPromise=require(_0xa6bd('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa6bd('0x5'));var rimraf=require('rimraf');var config=require(_0xa6bd('0x6'));var attributes=require(_0xa6bd('0x7'));module[_0xa6bd('0x8')]=function(_0x1d9c9d,_0x33c8c4){return _0x1d9c9d[_0xa6bd('0x9')](_0xa6bd('0xa'),attributes,{'tableName':_0xa6bd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index 4aa00d7..04c9e50 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 _0xc524=['jayson/promise','http','request','then','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','options','where','attributes','include','map','model','ShowSquareOdbc','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x55cf47,_0x3d037b){var _0x42bf2b=function(_0x2edd84){while(--_0x2edd84){_0x55cf47['push'](_0x55cf47['shift']());}};_0x42bf2b(++_0x3d037b);}(_0xc524,0xfe));var _0x4c52=function(_0x459da7,_0xcab10d){_0x459da7=_0x459da7-0x0;var _0x580207=_0xc524[_0x459da7];return _0x580207;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4c52('0x0'));var BPromise=require(_0x4c52('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4c52('0x2'));var db=require(_0x4c52('0x3'))['db'];var utils=require(_0x4c52('0x4'));var logger=require('../../config/logger')(_0x4c52('0x5'));var config=require(_0x4c52('0x6'));var jayson=require(_0x4c52('0x7'));var client=jayson['client'][_0x4c52('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x167bbf,_0x399ef1,_0x574682){return new BPromise(function(_0x5a0ab8,_0x3c6cfe){return client[_0x4c52('0x9')](_0x167bbf,_0x574682)[_0x4c52('0xa')](function(_0x1852ed){logger['info'](_0x4c52('0xb'),_0x399ef1,_0x4c52('0xc'));logger[_0x4c52('0xd')](_0x4c52('0xe'),_0x399ef1,_0x4c52('0xc'),JSON[_0x4c52('0xf')](_0x1852ed));if(_0x1852ed['error']){if(_0x1852ed[_0x4c52('0x10')][_0x4c52('0x11')]===0x1f4){logger['error'](_0x4c52('0xb'),_0x399ef1,_0x1852ed[_0x4c52('0x10')][_0x4c52('0x12')]);return _0x3c6cfe(_0x1852ed['error'][_0x4c52('0x12')]);}logger[_0x4c52('0x10')]('SquareOdbc,\x20%s,\x20%s',_0x399ef1,_0x1852ed[_0x4c52('0x10')][_0x4c52('0x12')]);return _0x5a0ab8(_0x1852ed[_0x4c52('0x10')]['message']);}else{logger[_0x4c52('0x13')](_0x4c52('0xb'),_0x399ef1,_0x4c52('0xc'));_0x5a0ab8(_0x1852ed[_0x4c52('0x14')][_0x4c52('0x12')]);}})[_0x4c52('0x15')](function(_0x389464){logger[_0x4c52('0x10')](_0x4c52('0xb'),_0x399ef1,_0x389464);_0x3c6cfe(_0x389464);});});}exports['ShowSquareOdbc']=function(_0xc992c9){var _0x3ef071=this;return new Promise(function(_0x19bd4b,_0x48ab9d){return db['SquareOdbc']['find']({'raw':_0xc992c9['options']?_0xc992c9[_0x4c52('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0xc992c9['options']?_0xc992c9[_0x4c52('0x16')][_0x4c52('0x17')]||null:null,'attributes':_0xc992c9[_0x4c52('0x16')]?_0xc992c9[_0x4c52('0x16')][_0x4c52('0x18')]||null:null,'include':_0xc992c9[_0x4c52('0x16')]?_0xc992c9[_0x4c52('0x16')][_0x4c52('0x19')]?_['map'](_0xc992c9[_0x4c52('0x16')]['include'],function(_0x52039d){return{'model':db[_0x52039d['model']],'as':_0x52039d['as'],'attributes':_0x52039d[_0x4c52('0x18')],'include':_0x52039d[_0x4c52('0x19')]?_[_0x4c52('0x1a')](_0x52039d['include'],function(_0x2a5e5b){return{'model':db[_0x2a5e5b[_0x4c52('0x1b')]],'as':_0x2a5e5b['as'],'attributes':_0x2a5e5b[_0x4c52('0x18')],'include':_0x2a5e5b[_0x4c52('0x19')]?_['map'](_0x2a5e5b[_0x4c52('0x19')],function(_0x4b23f8){return{'model':db[_0x4b23f8['model']],'as':_0x4b23f8['as'],'attributes':_0x4b23f8[_0x4c52('0x18')]};}):[]};}):[]};}):[]:[]})[_0x4c52('0xa')](function(_0x5c0378){logger[_0x4c52('0x13')](_0x4c52('0x1c'),_0xc992c9);logger[_0x4c52('0xd')](_0x4c52('0x1c'),_0xc992c9,JSON[_0x4c52('0xf')](_0x5c0378));_0x19bd4b(_0x5c0378);})[_0x4c52('0x15')](function(_0x5da9a1){logger[_0x4c52('0x10')](_0x4c52('0x1c'),_0x5da9a1[_0x4c52('0x12')],_0xc992c9);_0x48ab9d(_0x3ef071['error'](0x1f4,_0x5da9a1[_0x4c52('0x12')]));});});}; \ No newline at end of file +var _0x526e=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','ShowSquareOdbc','find','raw','options','where','attributes','map','include','model','catch','lodash'];(function(_0x222e37,_0x55c4ee){var _0x2b02c6=function(_0x560f80){while(--_0x560f80){_0x222e37['push'](_0x222e37['shift']());}};_0x2b02c6(++_0x55c4ee);}(_0x526e,0x83));var _0xe526=function(_0x4096bf,_0x2a8bfa){_0x4096bf=_0x4096bf-0x0;var _0x2f6e64=_0x526e[_0x4096bf];return _0x2f6e64;};'use strict';var _=require(_0xe526('0x0'));var util=require(_0xe526('0x1'));var moment=require(_0xe526('0x2'));var BPromise=require(_0xe526('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe526('0x4'));var db=require(_0xe526('0x5'))['db'];var utils=require(_0xe526('0x6'));var logger=require(_0xe526('0x7'))('rpc');var config=require(_0xe526('0x8'));var jayson=require(_0xe526('0x9'));var client=jayson[_0xe526('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x551be8,_0x3a9a9e,_0x58ba43){return new BPromise(function(_0x5c533f,_0x4903cd){return client[_0xe526('0xb')](_0x551be8,_0x58ba43)[_0xe526('0xc')](function(_0x409ae0){logger[_0xe526('0xd')](_0xe526('0xe'),_0x3a9a9e,_0xe526('0xf'));logger[_0xe526('0x10')](_0xe526('0x11'),_0x3a9a9e,'request\x20sent',JSON[_0xe526('0x12')](_0x409ae0));if(_0x409ae0['error']){if(_0x409ae0[_0xe526('0x13')][_0xe526('0x14')]===0x1f4){logger['error'](_0xe526('0xe'),_0x3a9a9e,_0x409ae0[_0xe526('0x13')][_0xe526('0x15')]);return _0x4903cd(_0x409ae0['error'][_0xe526('0x15')]);}logger[_0xe526('0x13')](_0xe526('0xe'),_0x3a9a9e,_0x409ae0[_0xe526('0x13')][_0xe526('0x15')]);return _0x5c533f(_0x409ae0[_0xe526('0x13')][_0xe526('0x15')]);}else{logger[_0xe526('0xd')](_0xe526('0xe'),_0x3a9a9e,_0xe526('0xf'));_0x5c533f(_0x409ae0[_0xe526('0x16')]['message']);}})['catch'](function(_0x3395f9){logger[_0xe526('0x13')](_0xe526('0xe'),_0x3a9a9e,_0x3395f9);_0x4903cd(_0x3395f9);});});}exports[_0xe526('0x17')]=function(_0x53d302){var _0x1d2c06=this;return new Promise(function(_0x384531,_0x3e7bf9){return db['SquareOdbc'][_0xe526('0x18')]({'raw':_0x53d302['options']?_0x53d302['options'][_0xe526('0x19')]===undefined?!![]:![]:!![],'where':_0x53d302[_0xe526('0x1a')]?_0x53d302[_0xe526('0x1a')][_0xe526('0x1b')]||null:null,'attributes':_0x53d302[_0xe526('0x1a')]?_0x53d302[_0xe526('0x1a')][_0xe526('0x1c')]||null:null,'include':_0x53d302[_0xe526('0x1a')]?_0x53d302[_0xe526('0x1a')]['include']?_[_0xe526('0x1d')](_0x53d302[_0xe526('0x1a')][_0xe526('0x1e')],function(_0x4cee59){return{'model':db[_0x4cee59['model']],'as':_0x4cee59['as'],'attributes':_0x4cee59['attributes'],'include':_0x4cee59['include']?_[_0xe526('0x1d')](_0x4cee59[_0xe526('0x1e')],function(_0x3ceced){return{'model':db[_0x3ceced[_0xe526('0x1f')]],'as':_0x3ceced['as'],'attributes':_0x3ceced[_0xe526('0x1c')],'include':_0x3ceced[_0xe526('0x1e')]?_['map'](_0x3ceced['include'],function(_0x74ccb){return{'model':db[_0x74ccb[_0xe526('0x1f')]],'as':_0x74ccb['as'],'attributes':_0x74ccb[_0xe526('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe526('0xc')](function(_0xe8755d){logger[_0xe526('0xd')](_0xe526('0x17'),_0x53d302);logger['debug'](_0xe526('0x17'),_0x53d302,JSON['stringify'](_0xe8755d));_0x384531(_0xe8755d);})[_0xe526('0x20')](function(_0x568e83){logger[_0xe526('0x13')](_0xe526('0x17'),_0x568e83[_0xe526('0x15')],_0x53d302);_0x3e7bf9(_0x1d2c06[_0xe526('0x13')](0x1f4,_0x568e83[_0xe526('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 508d42c..4814701 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 _0xca01=['create','/:id','update','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./squareProject.controller','get','isAuthenticated','show','post'];(function(_0x3fed24,_0x20e80f){var _0x191a9a=function(_0x12f389){while(--_0x12f389){_0x3fed24['push'](_0x3fed24['shift']());}};_0x191a9a(++_0x20e80f);}(_0xca01,0xc0));var _0x1ca0=function(_0x23422f,_0x2cd057){_0x23422f=_0x23422f-0x0;var _0x2faae2=_0xca01[_0x23422f];return _0x2faae2;};'use strict';var multer=require('multer');var util=require(_0x1ca0('0x0'));var path=require(_0x1ca0('0x1'));var timeout=require(_0x1ca0('0x2'));var express=require('express');var router=express[_0x1ca0('0x3')]();var fs_extra=require(_0x1ca0('0x4'));var auth=require(_0x1ca0('0x5'));var interaction=require(_0x1ca0('0x6'));var config=require('../../config/environment');var controller=require(_0x1ca0('0x7'));router[_0x1ca0('0x8')]('/',auth[_0x1ca0('0x9')](),controller['index']);router[_0x1ca0('0x8')]('/:id',auth[_0x1ca0('0x9')](),controller[_0x1ca0('0xa')]);router[_0x1ca0('0xb')]('/',auth[_0x1ca0('0x9')](),controller[_0x1ca0('0xc')]);router['put'](_0x1ca0('0xd'),auth[_0x1ca0('0x9')](),controller[_0x1ca0('0xe')]);router['delete'](_0x1ca0('0xd'),auth[_0x1ca0('0x9')](),controller[_0x1ca0('0xf')]);module[_0x1ca0('0x10')]=router; \ No newline at end of file +var _0x37b7=['./squareProject.controller','get','index','/:id','show','post','isAuthenticated','create','update','delete','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x37b7,0xb4));var _0x737b=function(_0x557fd2,_0x2c0a7a){_0x557fd2=_0x557fd2-0x0;var _0x1b54a2=_0x37b7[_0x557fd2];return _0x1b54a2;};'use strict';var multer=require(_0x737b('0x0'));var util=require('util');var path=require(_0x737b('0x1'));var timeout=require(_0x737b('0x2'));var express=require(_0x737b('0x3'));var router=express[_0x737b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x737b('0x5'));var interaction=require(_0x737b('0x6'));var config=require('../../config/environment');var controller=require(_0x737b('0x7'));router[_0x737b('0x8')]('/',auth['isAuthenticated'](),controller[_0x737b('0x9')]);router['get'](_0x737b('0xa'),auth['isAuthenticated'](),controller[_0x737b('0xb')]);router[_0x737b('0xc')]('/',auth[_0x737b('0xd')](),controller[_0x737b('0xe')]);router['put']('/:id',auth[_0x737b('0xd')](),controller[_0x737b('0xf')]);router[_0x737b('0x10')](_0x737b('0xa'),auth[_0x737b('0xd')](),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 107523e..59ffea0 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 _0x52ad=['toString','DATE','STRING','TEXT','BLOB','getDataValue','preproduction','utf8','long','production'];(function(_0x2e58fb,_0x317293){var _0x10fbb2=function(_0x2362bf){while(--_0x2362bf){_0x2e58fb['push'](_0x2e58fb['shift']());}};_0x10fbb2(++_0x317293);}(_0x52ad,0xd4));var _0xd52a=function(_0x22a974,_0x27f666){_0x22a974=_0x22a974-0x0;var _0x25ba43=_0x52ad[_0x22a974];return _0x25ba43;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xd52a('0x0')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xd52a('0x0')]},'notes':{'type':Sequelize[_0xd52a('0x1')]},'preproduction':{'type':Sequelize[_0xd52a('0x2')]('long'),'get':function(){if(this[_0xd52a('0x3')]('preproduction')){return this[_0xd52a('0x3')](_0xd52a('0x4'))['toString'](_0xd52a('0x5'));}}},'production':{'type':Sequelize[_0xd52a('0x2')](_0xd52a('0x6')),'get':function(){if(this[_0xd52a('0x3')](_0xd52a('0x7'))){return this[_0xd52a('0x3')](_0xd52a('0x7'))[_0xd52a('0x8')](_0xd52a('0x5'));}}},'savedAt':{'type':Sequelize[_0xd52a('0x9')]},'publishedAt':{'type':Sequelize[_0xd52a('0x9')]}}; \ No newline at end of file +var _0xce30=['STRING','BLOB','long','getDataValue','preproduction','toString','utf8','production','DATE','exports'];(function(_0x1e86d9,_0x3b18aa){var _0x2d2b54=function(_0x1bdc19){while(--_0x1bdc19){_0x1e86d9['push'](_0x1e86d9['shift']());}};_0x2d2b54(++_0x3b18aa);}(_0xce30,0x1ad));var _0x0ce3=function(_0x43be21,_0x1a1140){_0x43be21=_0x43be21-0x0;var _0x535370=_0xce30[_0x43be21];return _0x535370;};'use strict';var Sequelize=require('sequelize');module[_0x0ce3('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x0ce3('0x1')]},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0x0ce3('0x2')](_0x0ce3('0x3')),'get':function(){if(this[_0x0ce3('0x4')]('preproduction')){return this[_0x0ce3('0x4')](_0x0ce3('0x5'))[_0x0ce3('0x6')](_0x0ce3('0x7'));}}},'production':{'type':Sequelize[_0x0ce3('0x2')](_0x0ce3('0x3')),'get':function(){if(this[_0x0ce3('0x4')](_0x0ce3('0x8'))){return this[_0x0ce3('0x4')]('production')[_0x0ce3('0x6')]('utf8');}}},'savedAt':{'type':Sequelize[_0x0ce3('0x9')]},'publishedAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index b348e19..2f3807b 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 _0x655d=['stringify','end','sendStatus','error','stack','name','send','index','map','SquareProject','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filter','merge','where','VIRTUAL','options','include','findAll','catch','show','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','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','./squareProject.socket','register','status','offset','undefined','limit','count','set','Content-Range','then','destroy','get','UserProfileResource','publish','agi'];(function(_0x36a046,_0x1c37ce){var _0x435883=function(_0x12741f){while(--_0x12741f){_0x36a046['push'](_0x36a046['shift']());}};_0x435883(++_0x1c37ce);}(_0x655d,0x18b));var _0xd655=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x655d[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0xd655('0x0'));var Redis=require(_0xd655('0x1'));var qs=require(_0xd655('0x2'));var logger=require(_0xd655('0x3'))(_0xd655('0x4'));var config=require(_0xd655('0x5'));var db=require(_0xd655('0x6'))['db'];config['redis']=_[_0xd655('0x7')](config[_0xd655('0x8')],{'host':_0xd655('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xd655('0xa'))[_0xd655('0xb')](socket);function respondWithResult(_0x8d99d2,_0x16f46b){_0x16f46b=_0x16f46b||0xc8;return function(_0x271d18){if(_0x271d18){return _0x8d99d2[_0xd655('0xc')](_0x16f46b)['json'](_0x271d18);}};}function respondWithFilteredResult(_0x599b40,_0x32acdf){return function(_0x32b4db){if(_0x32b4db){var _0x529c90=typeof _0x32acdf[_0xd655('0xd')]===_0xd655('0xe')&&typeof _0x32acdf[_0xd655('0xf')]===_0xd655('0xe');var _0x4708cc=_0x32b4db[_0xd655('0x10')];var _0x11a48b=_0x529c90?0x0:_0x32acdf[_0xd655('0xd')];var _0x241c4f=_0x529c90?_0x32b4db[_0xd655('0x10')]:_0x32acdf[_0xd655('0xd')]+_0x32acdf[_0xd655('0xf')];var _0x5e76a0;if(_0x241c4f>=_0x4708cc){_0x241c4f=_0x4708cc;_0x5e76a0=0xc8;}else{_0x5e76a0=0xce;}_0x599b40['status'](_0x5e76a0);return _0x599b40[_0xd655('0x11')](_0xd655('0x12'),_0x11a48b+'-'+_0x241c4f+'/'+_0x4708cc)['json'](_0x32b4db);}return null;};}function saveUpdates(_0x23fdf7){return function(_0x26f020){if(_0x26f020){return _0x26f020['update'](_0x23fdf7)[_0xd655('0x13')](function(_0x212bf1){return _0x212bf1;});}return null;};}function removeEntity(_0x59ab2e){return function(_0xaa5fc6){if(_0xaa5fc6){return _0xaa5fc6[_0xd655('0x14')]()['then'](function(){var _0x426494=_0xaa5fc6[_0xd655('0x15')]({'plain':!![]});var _0x111dd1='SquareProjects';return db[_0xd655('0x16')][_0xd655('0x14')]({'where':{'type':_0x111dd1,'resourceId':_0x426494['id']}})['then'](function(){return _0xaa5fc6;});})[_0xd655('0x13')](function(){var _0xf1a511=new Redis(config[_0xd655('0x8')]);_0xf1a511[_0xd655('0x17')](_0xd655('0x18'),JSON[_0xd655('0x19')]({'id':_0xaa5fc6['id'],'deleted':!![]}));})['then'](function(){_0x59ab2e['status'](0xcc)[_0xd655('0x1a')]();});}};}function handleEntityNotFound(_0x2db28e){return function(_0x1e9e44){if(!_0x1e9e44){_0x2db28e[_0xd655('0x1b')](0x194);}return _0x1e9e44;};}function handleError(_0x487aa9,_0x28e5f7){_0x28e5f7=_0x28e5f7||0x1f4;return function(_0x4eb7a0){logger[_0xd655('0x1c')](_0x4eb7a0[_0xd655('0x1d')]);if(_0x4eb7a0[_0xd655('0x1e')]){delete _0x4eb7a0['name'];}_0x487aa9[_0xd655('0xc')](_0x28e5f7)[_0xd655('0x1f')](_0x4eb7a0);};}exports[_0xd655('0x20')]=function(_0x138473,_0x1b2561){var _0x42256b={},_0x53043a={},_0x3b2bb3={'count':0x0,'rows':[]};var _0x628f74=_[_0xd655('0x21')](db[_0xd655('0x22')][_0xd655('0x23')],function(_0x509626){return{'name':_0x509626[_0xd655('0x24')],'type':_0x509626[_0xd655('0x25')][_0xd655('0x26')]};});_0x53043a[_0xd655('0x27')]=_[_0xd655('0x21')](_0x628f74,_0xd655('0x1e'));_0x53043a[_0xd655('0x28')]=_[_0xd655('0x29')](_0x138473[_0xd655('0x28')]);_0x53043a[_0xd655('0x2a')]=_['intersection'](_0x53043a['model'],_0x53043a[_0xd655('0x28')]);_0x42256b[_0xd655('0x2b')]=_[_0xd655('0x2c')](_0x53043a[_0xd655('0x27')],qs[_0xd655('0x2d')](_0x138473[_0xd655('0x28')][_0xd655('0x2d')]));_0x42256b[_0xd655('0x2b')]=_0x42256b[_0xd655('0x2b')][_0xd655('0x2e')]?_0x42256b['attributes']:_0x53043a['model'];if(!_0x138473[_0xd655('0x28')][_0xd655('0x2f')](_0xd655('0x30'))){_0x42256b['limit']=qs[_0xd655('0xf')](_0x138473[_0xd655('0x28')][_0xd655('0xf')]);_0x42256b[_0xd655('0xd')]=qs[_0xd655('0xd')](_0x138473[_0xd655('0x28')][_0xd655('0xd')]);}_0x42256b['order']=qs[_0xd655('0x31')](_0x138473[_0xd655('0x28')][_0xd655('0x31')]);_0x42256b['where']=qs['filters'](_[_0xd655('0x32')](_0x138473[_0xd655('0x28')],_0x53043a[_0xd655('0x2a')]),_0x628f74);if(_0x138473['query'][_0xd655('0x33')]){_0x42256b['where']=_[_0xd655('0x34')](_0x42256b[_0xd655('0x35')],{'$or':_[_0xd655('0x21')](_0x628f74,function(_0x2b9844){if(_0x2b9844[_0xd655('0x25')]!==_0xd655('0x36')){var _0x5651d4={};_0x5651d4[_0x2b9844[_0xd655('0x1e')]]={'$like':'%'+_0x138473[_0xd655('0x28')]['filter']+'%'};return _0x5651d4;}})});}_0x42256b=_['merge']({},_0x42256b,_0x138473[_0xd655('0x37')]);var _0x12d8a0={'where':_0x42256b[_0xd655('0x35')]};return db[_0xd655('0x22')][_0xd655('0x10')](_0x12d8a0)[_0xd655('0x13')](function(_0x1a5f71){_0x3b2bb3['count']=_0x1a5f71;if(_0x138473['query']['includeAll']){_0x42256b[_0xd655('0x38')]=[{'all':!![]}];}return db['SquareProject'][_0xd655('0x39')](_0x42256b);})[_0xd655('0x13')](function(_0x2e4c63){_0x3b2bb3['rows']=_0x2e4c63;return _0x3b2bb3;})['then'](respondWithFilteredResult(_0x1b2561,_0x42256b))[_0xd655('0x3a')](handleError(_0x1b2561,null));};exports[_0xd655('0x3b')]=function(_0x2bcbd2,_0x4c60de){var _0x26f224={'raw':![],'where':{'id':_0x2bcbd2['params']['id']}},_0x1b2d5b={};_0x1b2d5b[_0xd655('0x27')]=_[_0xd655('0x29')](db[_0xd655('0x22')][_0xd655('0x23')]);_0x1b2d5b[_0xd655('0x28')]=_[_0xd655('0x29')](_0x2bcbd2[_0xd655('0x28')]);_0x1b2d5b[_0xd655('0x2a')]=_['intersection'](_0x1b2d5b[_0xd655('0x27')],_0x1b2d5b[_0xd655('0x28')]);_0x26f224[_0xd655('0x2b')]=_[_0xd655('0x2c')](_0x1b2d5b[_0xd655('0x27')],qs['fields'](_0x2bcbd2[_0xd655('0x28')]['fields']));_0x26f224['attributes']=_0x26f224[_0xd655('0x2b')]['length']?_0x26f224['attributes']:_0x1b2d5b[_0xd655('0x27')];if(_0x2bcbd2[_0xd655('0x28')]['includeAll']){_0x26f224[_0xd655('0x38')]=[{'all':!![]}];}_0x26f224=_[_0xd655('0x34')]({},_0x26f224,_0x2bcbd2['options']);return db['SquareProject'][_0xd655('0x3c')](_0x26f224)[_0xd655('0x13')](handleEntityNotFound(_0x4c60de,null))['then'](respondWithResult(_0x4c60de,null))['catch'](handleError(_0x4c60de,null));};exports[_0xd655('0x3d')]=function(_0x1f1ce8,_0x6975b7){return db[_0xd655('0x22')][_0xd655('0x3d')](_0x1f1ce8[_0xd655('0x3e')],{})[_0xd655('0x13')](function(_0x2c3aa9){var _0x50a316=_0x1f1ce8[_0xd655('0x3f')][_0xd655('0x15')]({'plain':!![]});if(!_0x50a316)throw new Error(_0xd655('0x40'));if(_0x50a316[_0xd655('0x41')]===_0xd655('0x3f')){var _0x3434fe=_0x2c3aa9[_0xd655('0x15')]({'plain':!![]});var _0x416c98='SquareProjects';return db[_0xd655('0x42')][_0xd655('0x3c')]({'where':{'name':_0x416c98,'userProfileId':_0x50a316[_0xd655('0x43')]},'raw':!![]})['then'](function(_0x491f6e){if(_0x491f6e&&_0x491f6e['autoAssociation']===0x0){return db['UserProfileResource'][_0xd655('0x3d')]({'name':_0x3434fe[_0xd655('0x1e')],'resourceId':_0x3434fe['id'],'type':_0x491f6e[_0xd655('0x1e')],'sectionId':_0x491f6e['id']},{})[_0xd655('0x13')](function(){return _0x2c3aa9;});}else{return _0x2c3aa9;}})[_0xd655('0x3a')](function(_0x3f1b77){logger['error'](_0xd655('0x44'),_0x3f1b77);throw _0x3f1b77;});}return _0x2c3aa9;})[_0xd655('0x13')](respondWithResult(_0x6975b7,0xc9))[_0xd655('0x3a')](handleError(_0x6975b7,null));};exports['update']=function(_0x11fea4,_0x5bc0bf){if(_0x11fea4[_0xd655('0x3e')]['id']){delete _0x11fea4[_0xd655('0x3e')]['id'];}return db[_0xd655('0x22')][_0xd655('0x3c')]({'where':{'id':_0x11fea4[_0xd655('0x45')]['id']}})[_0xd655('0x13')](handleEntityNotFound(_0x5bc0bf,null))[_0xd655('0x13')](saveUpdates(_0x11fea4[_0xd655('0x3e')],null))[_0xd655('0x13')](function(_0x95b046){if(!_0x95b046)return;var _0x547883=_0x95b046[_0xd655('0x15')]({'plain':!![]});return _0x547883;})[_0xd655('0x13')](function(_0x5a97d7){var _0x187212=new Redis(config[_0xd655('0x8')]);_0x187212[_0xd655('0x17')]('agi',JSON[_0xd655('0x19')](_[_0xd655('0x32')](_0x5a97d7,['id',_0xd655('0x1e'),'production'])));return _0x5a97d7;})[_0xd655('0x13')](respondWithResult(_0x5bc0bf,null))[_0xd655('0x3a')](handleError(_0x5bc0bf,null));};exports[_0xd655('0x14')]=function(_0x4073e1,_0x2b6e2f){return db[_0xd655('0x22')][_0xd655('0x3c')]({'where':{'id':_0x4073e1[_0xd655('0x45')]['id']}})[_0xd655('0x13')](handleEntityNotFound(_0x2b6e2f,null))[_0xd655('0x13')](removeEntity(_0x2b6e2f,null))[_0xd655('0x3a')](handleError(_0x2b6e2f,null));}; \ No newline at end of file +var _0x9e42=['query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','options','includeAll','rows','catch','show','params','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','localhost','redis','register','status','offset','undefined','count','limit','set','json','update','then','destroy','get','SquareProjects','UserProfileResource','publish','stringify','end','error','name','send','index','map','SquareProject','rawAttributes','fieldName','key','model'];(function(_0x14f30b,_0x4ac7ca){var _0x248b2e=function(_0x800f64){while(--_0x800f64){_0x14f30b['push'](_0x14f30b['shift']());}};_0x248b2e(++_0x4ac7ca);}(_0x9e42,0x1dc));var _0x29e4=function(_0x5235a6,_0x680b76){_0x5235a6=_0x5235a6-0x0;var _0x1cf37e=_0x9e42[_0x5235a6];return _0x1cf37e;};'use strict';var _=require(_0x29e4('0x0'));var Redis=require(_0x29e4('0x1'));var qs=require(_0x29e4('0x2'));var logger=require(_0x29e4('0x3'))(_0x29e4('0x4'));var config=require(_0x29e4('0x5'));var db=require(_0x29e4('0x6'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x29e4('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x29e4('0x8')]));require('./squareProject.socket')[_0x29e4('0x9')](socket);function respondWithResult(_0x38f655,_0x93aaae){_0x93aaae=_0x93aaae||0xc8;return function(_0x332234){if(_0x332234){return _0x38f655[_0x29e4('0xa')](_0x93aaae)['json'](_0x332234);}};}function respondWithFilteredResult(_0x4761d4,_0x473797){return function(_0x50c833){if(_0x50c833){var _0x524714=typeof _0x473797[_0x29e4('0xb')]===_0x29e4('0xc')&&typeof _0x473797['limit']===_0x29e4('0xc');var _0x3409b3=_0x50c833['count'];var _0x2309e6=_0x524714?0x0:_0x473797['offset'];var _0x2d9c52=_0x524714?_0x50c833[_0x29e4('0xd')]:_0x473797['offset']+_0x473797[_0x29e4('0xe')];var _0x12d715;if(_0x2d9c52>=_0x3409b3){_0x2d9c52=_0x3409b3;_0x12d715=0xc8;}else{_0x12d715=0xce;}_0x4761d4[_0x29e4('0xa')](_0x12d715);return _0x4761d4[_0x29e4('0xf')]('Content-Range',_0x2309e6+'-'+_0x2d9c52+'/'+_0x3409b3)[_0x29e4('0x10')](_0x50c833);}return null;};}function saveUpdates(_0x442bec){return function(_0x395162){if(_0x395162){return _0x395162[_0x29e4('0x11')](_0x442bec)[_0x29e4('0x12')](function(_0x73e6f5){return _0x73e6f5;});}return null;};}function removeEntity(_0x36125c){return function(_0x1d3fad){if(_0x1d3fad){return _0x1d3fad[_0x29e4('0x13')]()['then'](function(){var _0x44cf88=_0x1d3fad[_0x29e4('0x14')]({'plain':!![]});var _0x4ccaa4=_0x29e4('0x15');return db[_0x29e4('0x16')][_0x29e4('0x13')]({'where':{'type':_0x4ccaa4,'resourceId':_0x44cf88['id']}})[_0x29e4('0x12')](function(){return _0x1d3fad;});})[_0x29e4('0x12')](function(){var _0x4a26fa=new Redis(config[_0x29e4('0x8')]);_0x4a26fa[_0x29e4('0x17')]('agi',JSON[_0x29e4('0x18')]({'id':_0x1d3fad['id'],'deleted':!![]}));})['then'](function(){_0x36125c[_0x29e4('0xa')](0xcc)[_0x29e4('0x19')]();});}};}function handleEntityNotFound(_0x5d56c7){return function(_0x500230){if(!_0x500230){_0x5d56c7['sendStatus'](0x194);}return _0x500230;};}function handleError(_0xf2a29f,_0x412bd8){_0x412bd8=_0x412bd8||0x1f4;return function(_0x1cf111){logger[_0x29e4('0x1a')](_0x1cf111['stack']);if(_0x1cf111[_0x29e4('0x1b')]){delete _0x1cf111[_0x29e4('0x1b')];}_0xf2a29f[_0x29e4('0xa')](_0x412bd8)[_0x29e4('0x1c')](_0x1cf111);};}exports[_0x29e4('0x1d')]=function(_0x107830,_0x4f9c69){var _0x13a365={},_0x4c6e57={},_0x48d1d3={'count':0x0,'rows':[]};var _0x27b70d=_[_0x29e4('0x1e')](db[_0x29e4('0x1f')][_0x29e4('0x20')],function(_0x12700e){return{'name':_0x12700e[_0x29e4('0x21')],'type':_0x12700e['type'][_0x29e4('0x22')]};});_0x4c6e57[_0x29e4('0x23')]=_[_0x29e4('0x1e')](_0x27b70d,_0x29e4('0x1b'));_0x4c6e57[_0x29e4('0x24')]=_[_0x29e4('0x25')](_0x107830[_0x29e4('0x24')]);_0x4c6e57[_0x29e4('0x26')]=_[_0x29e4('0x27')](_0x4c6e57['model'],_0x4c6e57['query']);_0x13a365[_0x29e4('0x28')]=_['intersection'](_0x4c6e57[_0x29e4('0x23')],qs[_0x29e4('0x29')](_0x107830[_0x29e4('0x24')]['fields']));_0x13a365[_0x29e4('0x28')]=_0x13a365[_0x29e4('0x28')][_0x29e4('0x2a')]?_0x13a365[_0x29e4('0x28')]:_0x4c6e57['model'];if(!_0x107830['query'][_0x29e4('0x2b')](_0x29e4('0x2c'))){_0x13a365[_0x29e4('0xe')]=qs[_0x29e4('0xe')](_0x107830[_0x29e4('0x24')]['limit']);_0x13a365[_0x29e4('0xb')]=qs[_0x29e4('0xb')](_0x107830[_0x29e4('0x24')][_0x29e4('0xb')]);}_0x13a365[_0x29e4('0x2d')]=qs['sort'](_0x107830['query'][_0x29e4('0x2e')]);_0x13a365[_0x29e4('0x2f')]=qs[_0x29e4('0x26')](_[_0x29e4('0x30')](_0x107830[_0x29e4('0x24')],_0x4c6e57[_0x29e4('0x26')]),_0x27b70d);if(_0x107830[_0x29e4('0x24')][_0x29e4('0x31')]){_0x13a365[_0x29e4('0x2f')]=_['merge'](_0x13a365[_0x29e4('0x2f')],{'$or':_[_0x29e4('0x1e')](_0x27b70d,function(_0x527aa5){if(_0x527aa5[_0x29e4('0x32')]!=='VIRTUAL'){var _0x4057f6={};_0x4057f6[_0x527aa5[_0x29e4('0x1b')]]={'$like':'%'+_0x107830['query']['filter']+'%'};return _0x4057f6;}})});}_0x13a365=_['merge']({},_0x13a365,_0x107830[_0x29e4('0x33')]);var _0x2384c6={'where':_0x13a365[_0x29e4('0x2f')]};return db['SquareProject']['count'](_0x2384c6)[_0x29e4('0x12')](function(_0x418d44){_0x48d1d3[_0x29e4('0xd')]=_0x418d44;if(_0x107830[_0x29e4('0x24')][_0x29e4('0x34')]){_0x13a365['include']=[{'all':!![]}];}return db[_0x29e4('0x1f')]['findAll'](_0x13a365);})[_0x29e4('0x12')](function(_0x429f33){_0x48d1d3[_0x29e4('0x35')]=_0x429f33;return _0x48d1d3;})['then'](respondWithFilteredResult(_0x4f9c69,_0x13a365))[_0x29e4('0x36')](handleError(_0x4f9c69,null));};exports[_0x29e4('0x37')]=function(_0x3aaa9c,_0x36e714){var _0x170924={'raw':![],'where':{'id':_0x3aaa9c[_0x29e4('0x38')]['id']}},_0x274ad6={};_0x274ad6['model']=_[_0x29e4('0x25')](db[_0x29e4('0x1f')][_0x29e4('0x20')]);_0x274ad6[_0x29e4('0x24')]=_[_0x29e4('0x25')](_0x3aaa9c[_0x29e4('0x24')]);_0x274ad6[_0x29e4('0x26')]=_[_0x29e4('0x27')](_0x274ad6[_0x29e4('0x23')],_0x274ad6['query']);_0x170924['attributes']=_['intersection'](_0x274ad6[_0x29e4('0x23')],qs[_0x29e4('0x29')](_0x3aaa9c[_0x29e4('0x24')]['fields']));_0x170924[_0x29e4('0x28')]=_0x170924['attributes'][_0x29e4('0x2a')]?_0x170924[_0x29e4('0x28')]:_0x274ad6['model'];if(_0x3aaa9c[_0x29e4('0x24')][_0x29e4('0x34')]){_0x170924['include']=[{'all':!![]}];}_0x170924=_[_0x29e4('0x39')]({},_0x170924,_0x3aaa9c[_0x29e4('0x33')]);return db[_0x29e4('0x1f')][_0x29e4('0x3a')](_0x170924)[_0x29e4('0x12')](handleEntityNotFound(_0x36e714,null))[_0x29e4('0x12')](respondWithResult(_0x36e714,null))['catch'](handleError(_0x36e714,null));};exports[_0x29e4('0x3b')]=function(_0x49ec5e,_0x55e1f5){return db[_0x29e4('0x1f')]['create'](_0x49ec5e[_0x29e4('0x3c')],{})['then'](function(_0x31d40d){var _0x5c2ae2=_0x49ec5e[_0x29e4('0x3d')][_0x29e4('0x14')]({'plain':!![]});if(!_0x5c2ae2)throw new Error(_0x29e4('0x3e'));if(_0x5c2ae2[_0x29e4('0x3f')]===_0x29e4('0x3d')){var _0xee82d5=_0x31d40d[_0x29e4('0x14')]({'plain':!![]});var _0x4e5292=_0x29e4('0x15');return db['UserProfileSection'][_0x29e4('0x3a')]({'where':{'name':_0x4e5292,'userProfileId':_0x5c2ae2['userProfileId']},'raw':!![]})['then'](function(_0x3944f3){if(_0x3944f3&&_0x3944f3['autoAssociation']===0x0){return db[_0x29e4('0x16')][_0x29e4('0x3b')]({'name':_0xee82d5[_0x29e4('0x1b')],'resourceId':_0xee82d5['id'],'type':_0x3944f3[_0x29e4('0x1b')],'sectionId':_0x3944f3['id']},{})[_0x29e4('0x12')](function(){return _0x31d40d;});}else{return _0x31d40d;}})[_0x29e4('0x36')](function(_0x595158){logger[_0x29e4('0x1a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x595158);throw _0x595158;});}return _0x31d40d;})[_0x29e4('0x12')](respondWithResult(_0x55e1f5,0xc9))['catch'](handleError(_0x55e1f5,null));};exports['update']=function(_0x2897d5,_0x1be9f7){if(_0x2897d5[_0x29e4('0x3c')]['id']){delete _0x2897d5[_0x29e4('0x3c')]['id'];}return db[_0x29e4('0x1f')][_0x29e4('0x3a')]({'where':{'id':_0x2897d5['params']['id']}})[_0x29e4('0x12')](handleEntityNotFound(_0x1be9f7,null))[_0x29e4('0x12')](saveUpdates(_0x2897d5[_0x29e4('0x3c')],null))[_0x29e4('0x12')](function(_0x498393){if(!_0x498393)return;var _0x2b107b=_0x498393[_0x29e4('0x14')]({'plain':!![]});return _0x2b107b;})['then'](function(_0x5c9694){var _0x5f43e2=new Redis(config[_0x29e4('0x8')]);_0x5f43e2['publish']('agi',JSON[_0x29e4('0x18')](_[_0x29e4('0x30')](_0x5c9694,['id',_0x29e4('0x1b'),'production'])));return _0x5c9694;})['then'](respondWithResult(_0x1be9f7,null))[_0x29e4('0x36')](handleError(_0x1be9f7,null));};exports[_0x29e4('0x13')]=function(_0x1831bb,_0x43be85){return db['SquareProject']['find']({'where':{'id':_0x1831bb[_0x29e4('0x38')]['id']}})[_0x29e4('0x12')](handleEntityNotFound(_0x43be85,null))[_0x29e4('0x12')](removeEntity(_0x43be85,null))[_0x29e4('0x36')](handleError(_0x43be85,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index a0185ba..fd38906 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 _0x0430=['hasOwnProperty','hook','exports','events','../../mysqldb','SquareProject','setMaxListeners','save','update','remove','emit'];(function(_0x2d4ed8,_0x515a8b){var _0xa78e5c=function(_0x1a4059){while(--_0x1a4059){_0x2d4ed8['push'](_0x2d4ed8['shift']());}};_0xa78e5c(++_0x515a8b);}(_0x0430,0xd4));var _0x0043=function(_0x268659,_0x3e6684){_0x268659=_0x268659-0x0;var _0x46bd03=_0x0430[_0x268659];return _0x46bd03;};'use strict';var EventEmitter=require(_0x0043('0x0'));var SquareProject=require(_0x0043('0x1'))['db'][_0x0043('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x0043('0x3')](0x0);var events={'afterCreate':_0x0043('0x4'),'afterUpdate':_0x0043('0x5'),'afterDestroy':_0x0043('0x6')};function emitEvent(_0x2a39c5){return function(_0x379e77,_0x420072,_0x50bb17){SquareProjectEvents['emit'](_0x2a39c5+':'+_0x379e77['id'],_0x379e77);SquareProjectEvents[_0x0043('0x7')](_0x2a39c5,_0x379e77);_0x50bb17(null);};}for(var e in events){if(events[_0x0043('0x8')](e)){var event=events[e];SquareProject[_0x0043('0x9')](e,emitEvent(event));}}module[_0x0043('0xa')]=SquareProjectEvents; \ No newline at end of file +var _0xa925=['save','update','emit','hasOwnProperty','hook','exports','events','SquareProject','setMaxListeners'];(function(_0x5045f3,_0x9084e1){var _0x867321=function(_0x17f342){while(--_0x17f342){_0x5045f3['push'](_0x5045f3['shift']());}};_0x867321(++_0x9084e1);}(_0xa925,0x102));var _0x5a92=function(_0x342700,_0x569f75){_0x342700=_0x342700-0x0;var _0x53406f=_0xa925[_0x342700];return _0x53406f;};'use strict';var EventEmitter=require(_0x5a92('0x0'));var SquareProject=require('../../mysqldb')['db'][_0x5a92('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x5a92('0x2')](0x0);var events={'afterCreate':_0x5a92('0x3'),'afterUpdate':_0x5a92('0x4'),'afterDestroy':'remove'};function emitEvent(_0x57b32c){return function(_0x2015b9,_0x1cfed8,_0x5eeeea){SquareProjectEvents[_0x5a92('0x5')](_0x57b32c+':'+_0x2015b9['id'],_0x2015b9);SquareProjectEvents[_0x5a92('0x5')](_0x57b32c,_0x2015b9);_0x5eeeea(null);};}for(var e in events){if(events[_0x5a92('0x6')](e)){var event=events[e];SquareProject[_0x5a92('0x7')](e,emitEvent(event));}}module[_0x5a92('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 7f74c96..9361a2b 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 _0x9613=['savedAt','format','YYYY-MM-DD\x20HH:mm:ss','production','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareProject.attributes','define','SquareProject','square_projects','preproduction'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x9613,0x17a));var _0x3961=function(_0xea23f8,_0x2b76d2){_0xea23f8=_0xea23f8-0x0;var _0x437658=_0x9613[_0xea23f8];return _0x437658;};'use strict';var _=require(_0x3961('0x0'));var util=require('util');var logger=require(_0x3961('0x1'))('api');var moment=require(_0x3961('0x2'));var BPromise=require(_0x3961('0x3'));var rp=require(_0x3961('0x4'));var fs=require('fs');var path=require(_0x3961('0x5'));var rimraf=require(_0x3961('0x6'));var config=require(_0x3961('0x7'));var attributes=require(_0x3961('0x8'));module['exports']=function(_0x5c2cfd,_0x37313a){return _0x5c2cfd[_0x3961('0x9')](_0x3961('0xa'),attributes,{'tableName':_0x3961('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x16209e,_0x1e4001,_0x53e82b){if(_0x16209e['changed'](_0x3961('0xc'))){_0x16209e[_0x3961('0xd')]=moment()[_0x3961('0xe')](_0x3961('0xf'));}if(_0x16209e['changed'](_0x3961('0x10'))){_0x16209e['publishedAt']=moment()[_0x3961('0xe')](_0x3961('0xf'));}_0x53e82b(null,_0x16209e);}}});}; \ No newline at end of file +var _0xeebc=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./squareProject.attributes','exports','define','SquareProject','square_projects','changed','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt'];(function(_0x558e45,_0x4f5e4f){var _0x3e9075=function(_0x289725){while(--_0x289725){_0x558e45['push'](_0x558e45['shift']());}};_0x3e9075(++_0x4f5e4f);}(_0xeebc,0xd2));var _0xceeb=function(_0x212b85,_0x1dddc5){_0x212b85=_0x212b85-0x0;var _0x1e8ac3=_0xeebc[_0x212b85];return _0x1e8ac3;};'use strict';var _=require(_0xceeb('0x0'));var util=require(_0xceeb('0x1'));var logger=require(_0xceeb('0x2'))(_0xceeb('0x3'));var moment=require(_0xceeb('0x4'));var BPromise=require(_0xceeb('0x5'));var rp=require(_0xceeb('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xceeb('0x7'));var config=require(_0xceeb('0x8'));var attributes=require(_0xceeb('0x9'));module[_0xceeb('0xa')]=function(_0x3bcaa4,_0x1a76de){return _0x3bcaa4[_0xceeb('0xb')](_0xceeb('0xc'),attributes,{'tableName':_0xceeb('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xbd338a,_0x2ee284,_0x8544a9){if(_0xbd338a[_0xceeb('0xe')](_0xceeb('0xf'))){_0xbd338a[_0xceeb('0x10')]=moment()[_0xceeb('0x11')](_0xceeb('0x12'));}if(_0xbd338a[_0xceeb('0xe')](_0xceeb('0x13'))){_0xbd338a[_0xceeb('0x14')]=moment()[_0xceeb('0x11')](_0xceeb('0x12'));}_0x8544a9(null,_0xbd338a);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 020424c..a646f09 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 _0xebd3=['rpc','../../config/environment','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','GetSquareProjects','options','raw','where','attributes','limit','include','map','model','info','debug','stringify','catch','error','message','ShowSquareProject','SquareProject','then','ioredis','../../config/logger'];(function(_0x1167ea,_0x3cc2ee){var _0x2a9fb0=function(_0x4056b9){while(--_0x4056b9){_0x1167ea['push'](_0x1167ea['shift']());}};_0x2a9fb0(++_0x3cc2ee);}(_0xebd3,0xfa));var _0x3ebd=function(_0x3b2369,_0x4c68b9){_0x3b2369=_0x3b2369-0x0;var _0x5a1367=_0xebd3[_0x3b2369];return _0x5a1367;};'use strict';var _=require('lodash');var Redis=require(_0x3ebd('0x0'));var db=require('../../mysqldb')['db'];var logger=require(_0x3ebd('0x1'))(_0x3ebd('0x2'));var config=require(_0x3ebd('0x3'));config[_0x3ebd('0x4')]=_[_0x3ebd('0x5')](config['redis'],{'host':_0x3ebd('0x6'),'port':0x18eb});var socket=require(_0x3ebd('0x7'))(new Redis(config[_0x3ebd('0x4')]));require(_0x3ebd('0x8'))[_0x3ebd('0x9')](socket);exports[_0x3ebd('0xa')]=function(_0x4f14f0){var _0x19e542=this;return new Promise(function(_0x42710f,_0x442e90){return db['SquareProject']['findAll']({'raw':_0x4f14f0[_0x3ebd('0xb')]?_0x4f14f0['options'][_0x3ebd('0xc')]===undefined?!![]:![]:!![],'where':_0x4f14f0[_0x3ebd('0xb')]?_0x4f14f0[_0x3ebd('0xb')][_0x3ebd('0xd')]||null:null,'attributes':_0x4f14f0[_0x3ebd('0xb')]?_0x4f14f0[_0x3ebd('0xb')][_0x3ebd('0xe')]||null:null,'limit':_0x4f14f0[_0x3ebd('0xb')]?_0x4f14f0[_0x3ebd('0xb')][_0x3ebd('0xf')]||null:null,'include':_0x4f14f0[_0x3ebd('0xb')]?_0x4f14f0[_0x3ebd('0xb')][_0x3ebd('0x10')]?_[_0x3ebd('0x11')](_0x4f14f0[_0x3ebd('0xb')]['include'],function(_0x3f39ff){return{'model':db[_0x3f39ff[_0x3ebd('0x12')]],'as':_0x3f39ff['as'],'attributes':_0x3f39ff[_0x3ebd('0xe')],'include':_0x3f39ff[_0x3ebd('0x10')]?_[_0x3ebd('0x11')](_0x3f39ff[_0x3ebd('0x10')],function(_0x43081f){return{'model':db[_0x43081f['model']],'as':_0x43081f['as'],'attributes':_0x43081f[_0x3ebd('0xe')],'include':_0x43081f['include']?_[_0x3ebd('0x11')](_0x43081f['include'],function(_0x4a8c90){return{'model':db[_0x4a8c90[_0x3ebd('0x12')]],'as':_0x4a8c90['as'],'attributes':_0x4a8c90[_0x3ebd('0xe')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3961db){logger[_0x3ebd('0x13')]('GetSquareProjects',_0x4f14f0);logger[_0x3ebd('0x14')](_0x3ebd('0xa'),_0x4f14f0,JSON[_0x3ebd('0x15')](_0x3961db));_0x42710f(_0x3961db);})[_0x3ebd('0x16')](function(_0x560f60){logger[_0x3ebd('0x17')](_0x3ebd('0xa'),_0x560f60[_0x3ebd('0x18')],_0x4f14f0);_0x442e90(_0x19e542[_0x3ebd('0x17')](0x1f4,_0x560f60[_0x3ebd('0x18')]));});});};exports[_0x3ebd('0x19')]=function(_0xdac840){var _0x3b7980=this;return new Promise(function(_0x4cea12,_0x66b12e){return db[_0x3ebd('0x1a')]['find']({'raw':_0xdac840[_0x3ebd('0xb')]?_0xdac840[_0x3ebd('0xb')][_0x3ebd('0xc')]===undefined?!![]:![]:!![],'where':_0xdac840[_0x3ebd('0xb')]?_0xdac840[_0x3ebd('0xb')][_0x3ebd('0xd')]||null:null,'attributes':_0xdac840[_0x3ebd('0xb')]?_0xdac840[_0x3ebd('0xb')][_0x3ebd('0xe')]||null:null,'include':_0xdac840[_0x3ebd('0xb')]?_0xdac840['options'][_0x3ebd('0x10')]?_['map'](_0xdac840[_0x3ebd('0xb')][_0x3ebd('0x10')],function(_0xde9c7b){return{'model':db[_0xde9c7b['model']],'as':_0xde9c7b['as'],'attributes':_0xde9c7b[_0x3ebd('0xe')],'include':_0xde9c7b[_0x3ebd('0x10')]?_['map'](_0xde9c7b[_0x3ebd('0x10')],function(_0x43e0cf){return{'model':db[_0x43e0cf[_0x3ebd('0x12')]],'as':_0x43e0cf['as'],'attributes':_0x43e0cf[_0x3ebd('0xe')],'include':_0x43e0cf['include']?_[_0x3ebd('0x11')](_0x43e0cf[_0x3ebd('0x10')],function(_0x1e7ff4){return{'model':db[_0x1e7ff4[_0x3ebd('0x12')]],'as':_0x1e7ff4['as'],'attributes':_0x1e7ff4[_0x3ebd('0xe')]};}):[]};}):[]};}):[]:[]})[_0x3ebd('0x1b')](function(_0x16f07c){logger[_0x3ebd('0x13')](_0x3ebd('0x19'),_0xdac840);logger[_0x3ebd('0x14')](_0x3ebd('0x19'),_0xdac840,JSON[_0x3ebd('0x15')](_0x16f07c));_0x4cea12(_0x16f07c);})[_0x3ebd('0x16')](function(_0x4507b6){logger[_0x3ebd('0x17')](_0x3ebd('0x19'),_0x4507b6['message'],_0xdac840);_0x66b12e(_0x3b7980[_0x3ebd('0x17')](0x1f4,_0x4507b6['message']));});});}; \ No newline at end of file +var _0x454c=['map','model','then','info','stringify','catch','error','message','ShowSquareProject','debug','lodash','ioredis','../../mysqldb','../../config/logger','../../config/environment','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','GetSquareProjects','SquareProject','findAll','options','raw','where','attributes','limit','include'];(function(_0xacd9b3,_0x5beff1){var _0x172e3e=function(_0x4ce603){while(--_0x4ce603){_0xacd9b3['push'](_0xacd9b3['shift']());}};_0x172e3e(++_0x5beff1);}(_0x454c,0xdc));var _0xc454=function(_0x310504,_0x26ad95){_0x310504=_0x310504-0x0;var _0x5b36d0=_0x454c[_0x310504];return _0x5b36d0;};'use strict';var _=require(_0xc454('0x0'));var Redis=require(_0xc454('0x1'));var db=require(_0xc454('0x2'))['db'];var logger=require(_0xc454('0x3'))('rpc');var config=require(_0xc454('0x4'));config[_0xc454('0x5')]=_[_0xc454('0x6')](config[_0xc454('0x5')],{'host':_0xc454('0x7'),'port':0x18eb});var socket=require(_0xc454('0x8'))(new Redis(config[_0xc454('0x5')]));require(_0xc454('0x9'))[_0xc454('0xa')](socket);exports[_0xc454('0xb')]=function(_0x3d2449){var _0x5f332c=this;return new Promise(function(_0x30a95a,_0x2c4a90){return db[_0xc454('0xc')][_0xc454('0xd')]({'raw':_0x3d2449['options']?_0x3d2449[_0xc454('0xe')][_0xc454('0xf')]===undefined?!![]:![]:!![],'where':_0x3d2449[_0xc454('0xe')]?_0x3d2449[_0xc454('0xe')][_0xc454('0x10')]||null:null,'attributes':_0x3d2449[_0xc454('0xe')]?_0x3d2449['options'][_0xc454('0x11')]||null:null,'limit':_0x3d2449[_0xc454('0xe')]?_0x3d2449[_0xc454('0xe')][_0xc454('0x12')]||null:null,'include':_0x3d2449[_0xc454('0xe')]?_0x3d2449[_0xc454('0xe')][_0xc454('0x13')]?_['map'](_0x3d2449[_0xc454('0xe')][_0xc454('0x13')],function(_0x13174d){return{'model':db[_0x13174d['model']],'as':_0x13174d['as'],'attributes':_0x13174d[_0xc454('0x11')],'include':_0x13174d['include']?_[_0xc454('0x14')](_0x13174d[_0xc454('0x13')],function(_0x50ce1c){return{'model':db[_0x50ce1c[_0xc454('0x15')]],'as':_0x50ce1c['as'],'attributes':_0x50ce1c[_0xc454('0x11')],'include':_0x50ce1c['include']?_[_0xc454('0x14')](_0x50ce1c['include'],function(_0x2ed4d4){return{'model':db[_0x2ed4d4[_0xc454('0x15')]],'as':_0x2ed4d4['as'],'attributes':_0x2ed4d4[_0xc454('0x11')]};}):[]};}):[]};}):[]:[]})[_0xc454('0x16')](function(_0x5dfc70){logger[_0xc454('0x17')]('GetSquareProjects',_0x3d2449);logger['debug']('GetSquareProjects',_0x3d2449,JSON[_0xc454('0x18')](_0x5dfc70));_0x30a95a(_0x5dfc70);})[_0xc454('0x19')](function(_0x18082f){logger[_0xc454('0x1a')](_0xc454('0xb'),_0x18082f[_0xc454('0x1b')],_0x3d2449);_0x2c4a90(_0x5f332c['error'](0x1f4,_0x18082f[_0xc454('0x1b')]));});});};exports[_0xc454('0x1c')]=function(_0x239b08){var _0x5ef2bd=this;return new Promise(function(_0x42a0e6,_0x14749f){return db[_0xc454('0xc')]['find']({'raw':_0x239b08[_0xc454('0xe')]?_0x239b08[_0xc454('0xe')][_0xc454('0xf')]===undefined?!![]:![]:!![],'where':_0x239b08['options']?_0x239b08['options'][_0xc454('0x10')]||null:null,'attributes':_0x239b08['options']?_0x239b08[_0xc454('0xe')][_0xc454('0x11')]||null:null,'include':_0x239b08[_0xc454('0xe')]?_0x239b08[_0xc454('0xe')][_0xc454('0x13')]?_[_0xc454('0x14')](_0x239b08['options'][_0xc454('0x13')],function(_0x1f0fcb){return{'model':db[_0x1f0fcb[_0xc454('0x15')]],'as':_0x1f0fcb['as'],'attributes':_0x1f0fcb['attributes'],'include':_0x1f0fcb[_0xc454('0x13')]?_['map'](_0x1f0fcb[_0xc454('0x13')],function(_0x30b2c7){return{'model':db[_0x30b2c7[_0xc454('0x15')]],'as':_0x30b2c7['as'],'attributes':_0x30b2c7[_0xc454('0x11')],'include':_0x30b2c7['include']?_[_0xc454('0x14')](_0x30b2c7[_0xc454('0x13')],function(_0x5e9089){return{'model':db[_0x5e9089['model']],'as':_0x5e9089['as'],'attributes':_0x5e9089[_0xc454('0x11')]};}):[]};}):[]};}):[]:[]})[_0xc454('0x16')](function(_0xfc76bc){logger[_0xc454('0x17')](_0xc454('0x1c'),_0x239b08);logger[_0xc454('0x1d')](_0xc454('0x1c'),_0x239b08,JSON[_0xc454('0x18')](_0xfc76bc));_0x42a0e6(_0xfc76bc);})[_0xc454('0x19')](function(_0x468e41){logger[_0xc454('0x1a')](_0xc454('0x1c'),_0x468e41[_0xc454('0x1b')],_0x239b08);_0x14749f(_0x5ef2bd[_0xc454('0x1a')](0x1f4,_0x468e41['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 328e321..1dcae75 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 _0xc2ec=['length','squareProject:','./squareProject.events','save','remove','emit','removeListener','register'];(function(_0x995685,_0x1146b0){var _0x105d4c=function(_0xa9032c){while(--_0xa9032c){_0x995685['push'](_0x995685['shift']());}};_0x105d4c(++_0x1146b0);}(_0xc2ec,0xe2));var _0xcc2e=function(_0x54106e,_0x26bade){_0x54106e=_0x54106e-0x0;var _0x3918a2=_0xc2ec[_0x54106e];return _0x3918a2;};'use strict';var SquareProjectEvents=require(_0xcc2e('0x0'));var events=[_0xcc2e('0x1'),_0xcc2e('0x2'),'update'];function createListener(_0x157043,_0x5c8513){return function(_0x4c5e6c){_0x5c8513[_0xcc2e('0x3')](_0x157043,_0x4c5e6c);};}function removeListener(_0x5c2e11,_0x556ef2){return function(){SquareProjectEvents[_0xcc2e('0x4')](_0x5c2e11,_0x556ef2);};}exports[_0xcc2e('0x5')]=function(_0x5c12fa){for(var _0x5192b6=0x0,_0x2aba0e=events[_0xcc2e('0x6')];_0x5192b6<_0x2aba0e;_0x5192b6++){var _0x3157ae=events[_0x5192b6];var _0x5b3d30=createListener(_0xcc2e('0x7')+_0x3157ae,_0x5c12fa);SquareProjectEvents['on'](_0x3157ae,_0x5b3d30);}}; \ No newline at end of file +var _0x87d5=['save','emit','removeListener','register'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x87d5,0x74));var _0x587d=function(_0x46da61,_0x131db7){_0x46da61=_0x46da61-0x0;var _0x23f65a=_0x87d5[_0x46da61];return _0x23f65a;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0x587d('0x0'),'remove','update'];function createListener(_0x49f3c5,_0x5e788b){return function(_0x515df0){_0x5e788b[_0x587d('0x1')](_0x49f3c5,_0x515df0);};}function removeListener(_0x3365ef,_0x10b501){return function(){SquareProjectEvents[_0x587d('0x2')](_0x3365ef,_0x10b501);};}exports[_0x587d('0x3')]=function(_0x2b3cb2){for(var _0x3e3ced=0x0,_0xeaa27c=events['length'];_0x3e3ced<_0xeaa27c;_0x3e3ced++){var _0x374887=events[_0x3e3ced];var _0x574306=createListener('squareProject:'+_0x374887,_0x2b3cb2);SquareProjectEvents['on'](_0x374887,_0x574306);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 59efdb2..027116c 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 _0x7fbe=['/:id','show','/:id/download','create','put','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','index'];(function(_0x590c1b,_0x4961c3){var _0xd53864=function(_0x43a8cd){while(--_0x43a8cd){_0x590c1b['push'](_0x590c1b['shift']());}};_0xd53864(++_0x4961c3);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x2dbd5e,_0x202f18){_0x2dbd5e=_0x2dbd5e-0x0;var _0x41855f=_0x7fbe[_0x2dbd5e];return _0x41855f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe7fb('0x0'));var timeout=require(_0xe7fb('0x1'));var express=require(_0xe7fb('0x2'));var router=express[_0xe7fb('0x3')]();var fs_extra=require(_0xe7fb('0x4'));var auth=require(_0xe7fb('0x5'));var interaction=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var controller=require(_0xe7fb('0x8'));router[_0xe7fb('0x9')]('/',auth[_0xe7fb('0xa')](),controller[_0xe7fb('0xb')]);router[_0xe7fb('0x9')](_0xe7fb('0xc'),auth['isAuthenticated'](),controller[_0xe7fb('0xd')]);router[_0xe7fb('0x9')](_0xe7fb('0xe'),auth[_0xe7fb('0xa')](),controller['download']);router['post']('/',auth[_0xe7fb('0xa')](),controller[_0xe7fb('0xf')]);router[_0xe7fb('0x10')](_0xe7fb('0xc'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x11')]);router[_0xe7fb('0x12')](_0xe7fb('0xc'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x13')]);module[_0xe7fb('0x14')]=router; \ No newline at end of file +var _0x0295=['isAuthenticated','index','post','create','put','/:id','update','delete','destroy','exports','multer','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get'];(function(_0x56916d,_0x37b935){var _0x2b7f1f=function(_0x206eb1){while(--_0x206eb1){_0x56916d['push'](_0x56916d['shift']());}};_0x2b7f1f(++_0x37b935);}(_0x0295,0x1f0));var _0x5029=function(_0x1196b0,_0x36c47a){_0x1196b0=_0x1196b0-0x0;var _0x111c52=_0x0295[_0x1196b0];return _0x111c52;};'use strict';var multer=require(_0x5029('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5029('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x5029('0x2'));var auth=require(_0x5029('0x3'));var interaction=require(_0x5029('0x4'));var config=require(_0x5029('0x5'));var controller=require(_0x5029('0x6'));router[_0x5029('0x7')]('/',auth[_0x5029('0x8')](),controller[_0x5029('0x9')]);router[_0x5029('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x5029('0x7')]('/:id/download',auth[_0x5029('0x8')](),controller['download']);router[_0x5029('0xa')]('/',auth['isAuthenticated'](),controller[_0x5029('0xb')]);router[_0x5029('0xc')](_0x5029('0xd'),auth['isAuthenticated'](),controller[_0x5029('0xe')]);router[_0x5029('0xf')](_0x5029('0xd'),auth['isAuthenticated'](),controller[_0x5029('0x10')]);module[_0x5029('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 6f667ac..cf68553 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 _0xd8fb=['STRING','getDataValue','savePath','sequelize','exports'];(function(_0x1b1bee,_0x3d66f3){var _0x33a9c4=function(_0x1c5d1c){while(--_0x1c5d1c){_0x1b1bee['push'](_0x1b1bee['shift']());}};_0x33a9c4(++_0x3d66f3);}(_0xd8fb,0x99));var _0xbd8f=function(_0x454185,_0x3b4f4c){_0x454185=_0x454185-0x0;var _0x75cde9=_0xd8fb[_0x454185];return _0x75cde9;};'use strict';var Sequelize=require(_0xbd8f('0x0'));module[_0xbd8f('0x1')]={'uniqueid':{'type':Sequelize[_0xbd8f('0x2')]},'callerid':{'type':Sequelize[_0xbd8f('0x2')]},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xbd8f('0x2')]},'accountcode':{'type':Sequelize[_0xbd8f('0x2')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0xbd8f('0x2')]},'saveName':{'type':Sequelize[_0xbd8f('0x2')]},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize[_0xbd8f('0x2')]},'format':{'type':Sequelize['VIRTUAL'],'get':function(){var _0xf503c4='';var _0x578499=this[_0xbd8f('0x3')](_0xbd8f('0x4'));if(_0x578499){_0xf503c4=_0x578499['substring'](_0x578499['lastIndexOf']('.'));}return _0xf503c4;}}}; \ No newline at end of file +var _0x2eb2=['substring','lastIndexOf','exports','STRING','VIRTUAL','getDataValue','savePath'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x2eb2,0x19f));var _0x22eb=function(_0x4bb66f,_0x3cd682){_0x4bb66f=_0x4bb66f-0x0;var _0xf2772f=_0x2eb2[_0x4bb66f];return _0xf2772f;};'use strict';var Sequelize=require('sequelize');module[_0x22eb('0x0')]={'uniqueid':{'type':Sequelize[_0x22eb('0x1')]},'callerid':{'type':Sequelize[_0x22eb('0x1')]},'calleridname':{'type':Sequelize[_0x22eb('0x1')]},'context':{'type':Sequelize[_0x22eb('0x1')]},'extension':{'type':Sequelize[_0x22eb('0x1')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x22eb('0x1')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize[_0x22eb('0x1')]},'filename':{'type':Sequelize[_0x22eb('0x1')]},'savePath':{'type':Sequelize[_0x22eb('0x1')]},'format':{'type':Sequelize[_0x22eb('0x2')],'get':function(){var _0x4539d0='';var _0x396806=this[_0x22eb('0x3')](_0x22eb('0x4'));if(_0x396806){_0x4539d0=_0x396806[_0x22eb('0x5')](_0x396806[_0x22eb('0x6')]('.'));}return _0x4539d0;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 285a22b..3fcea85 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 _0x8f93=['Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','merge','where','VIRTUAL','options','SquareRecording','includeAll','include','findAll','rows','show','catch','create','body','find','params','download','../../components/encryptor','uniqueid','savePath','format','%s.cypher','decryptFile','secrets','recording','existsSync','Sequelize','ValidationError','SquareRecording\x20not\x20found','filename','unlink','Not\x20found','destroy','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','jsforce','to-csv','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set'];(function(_0x1de43c,_0xaa29de){var _0x296d3e=function(_0x50b76f){while(--_0x50b76f){_0x1de43c['push'](_0x1de43c['shift']());}};_0x296d3e(++_0xaa29de);}(_0x8f93,0xa7));var _0x38f9=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x8f93[_0xfae23b];return _0x200640;};'use strict';var emlformat=require(_0x38f9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x38f9('0x1'));var jsonpatch=require(_0x38f9('0x2'));var rp=require(_0x38f9('0x3'));var moment=require(_0x38f9('0x4'));var BPromise=require(_0x38f9('0x5'));var Mustache=require(_0x38f9('0x6'));var util=require(_0x38f9('0x7'));var path=require(_0x38f9('0x8'));var sox=require(_0x38f9('0x9'));var csv=require('to-csv');var ejs=require(_0x38f9('0xa'));var fs=require('fs');var fs_extra=require(_0x38f9('0xb'));var _=require('lodash');var squel=require(_0x38f9('0xc'));var crypto=require('crypto');var jsforce=require(_0x38f9('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x38f9('0xe'));var querystring=require('querystring');var Papa=require(_0x38f9('0xf'));var Redis=require(_0x38f9('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x38f9('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x38f9('0x12'))(_0x38f9('0x13'));var utils=require(_0x38f9('0x14'));var config=require(_0x38f9('0x15'));var licenseUtil=require(_0x38f9('0x16'));var db=require(_0x38f9('0x17'))['db'];function respondWithStatusCode(_0x1ef268,_0x476af0){_0x476af0=_0x476af0||0xcc;return function(_0x32b5db){if(_0x32b5db){return _0x1ef268[_0x38f9('0x18')](_0x476af0);}return _0x1ef268[_0x38f9('0x19')](_0x476af0)[_0x38f9('0x1a')]();};}function respondWithResult(_0x5e2192,_0x5e639f){_0x5e639f=_0x5e639f||0xc8;return function(_0x45dbd8){if(_0x45dbd8){return _0x5e2192['status'](_0x5e639f)[_0x38f9('0x1b')](_0x45dbd8);}};}function respondWithFilteredResult(_0x47e599,_0x40b8b5){return function(_0x1ab957){if(_0x1ab957){var _0x37b853=typeof _0x40b8b5[_0x38f9('0x1c')]===_0x38f9('0x1d')&&typeof _0x40b8b5[_0x38f9('0x1e')]===_0x38f9('0x1d');var _0x23b393=_0x1ab957[_0x38f9('0x1f')];var _0x118524=_0x37b853?0x0:_0x40b8b5[_0x38f9('0x1c')];var _0x5c0acb=_0x37b853?_0x1ab957[_0x38f9('0x1f')]:_0x40b8b5['offset']+_0x40b8b5[_0x38f9('0x1e')];var _0x49b8f1;if(_0x5c0acb>=_0x23b393){_0x5c0acb=_0x23b393;_0x49b8f1=0xc8;}else{_0x49b8f1=0xce;}_0x47e599[_0x38f9('0x19')](_0x49b8f1);return _0x47e599[_0x38f9('0x20')](_0x38f9('0x21'),_0x118524+'-'+_0x5c0acb+'/'+_0x23b393)[_0x38f9('0x1b')](_0x1ab957);}return null;};}function patchUpdates(_0x2bc722){return function(_0x15ae01){try{jsonpatch[_0x38f9('0x22')](_0x15ae01,_0x2bc722,!![]);}catch(_0x3c5e48){return BPromise[_0x38f9('0x23')](_0x3c5e48);}return _0x15ae01[_0x38f9('0x24')]();};}function saveUpdates(_0x109f00,_0x57e49f){return function(_0x585480){if(_0x585480){return _0x585480[_0x38f9('0x25')](_0x109f00)[_0x38f9('0x26')](function(_0x3fa78f){return _0x3fa78f;});}return null;};}function removeEntity(_0x3c3166,_0x242ca6){return function(_0x1b7a1e){if(_0x1b7a1e){return _0x1b7a1e['destroy']()[_0x38f9('0x26')](function(){_0x3c3166[_0x38f9('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x49147e,_0x273474){return function(_0x4610e5){if(!_0x4610e5){_0x49147e['sendStatus'](0x194);}return _0x4610e5;};}function handleError(_0x23beb2,_0x3ce747){_0x3ce747=_0x3ce747||0x1f4;return function(_0x514f2f){logger[_0x38f9('0x27')](_0x514f2f[_0x38f9('0x28')]);if(_0x514f2f[_0x38f9('0x29')]){delete _0x514f2f[_0x38f9('0x29')];}_0x23beb2[_0x38f9('0x19')](_0x3ce747)[_0x38f9('0x2a')](_0x514f2f);};}exports[_0x38f9('0x2b')]=function(_0x1617eb,_0x15e3ec){var _0x58ded8={},_0xd89189={},_0x1a9c36={'count':0x0,'rows':[]};var _0x252da1=_[_0x38f9('0x2c')](db['SquareRecording'][_0x38f9('0x2d')],function(_0x47e76f){return{'name':_0x47e76f['fieldName'],'type':_0x47e76f[_0x38f9('0x2e')][_0x38f9('0x2f')]};});_0xd89189[_0x38f9('0x30')]=_[_0x38f9('0x2c')](_0x252da1,_0x38f9('0x29'));_0xd89189['query']=_[_0x38f9('0x31')](_0x1617eb[_0x38f9('0x32')]);_0xd89189[_0x38f9('0x33')]=_[_0x38f9('0x34')](_0xd89189[_0x38f9('0x30')],_0xd89189[_0x38f9('0x32')]);_0x58ded8[_0x38f9('0x35')]=_[_0x38f9('0x34')](_0xd89189[_0x38f9('0x30')],qs[_0x38f9('0x36')](_0x1617eb['query'][_0x38f9('0x36')]));_0x58ded8[_0x38f9('0x35')]=_0x58ded8[_0x38f9('0x35')][_0x38f9('0x37')]?_0x58ded8[_0x38f9('0x35')]:_0xd89189[_0x38f9('0x30')];if(!_0x1617eb[_0x38f9('0x32')][_0x38f9('0x38')](_0x38f9('0x39'))){_0x58ded8['limit']=qs[_0x38f9('0x1e')](_0x1617eb[_0x38f9('0x32')][_0x38f9('0x1e')]);_0x58ded8[_0x38f9('0x1c')]=qs[_0x38f9('0x1c')](_0x1617eb['query'][_0x38f9('0x1c')]);}_0x58ded8[_0x38f9('0x3a')]=qs[_0x38f9('0x3b')](_0x1617eb['query']['sort']);_0x58ded8['where']=qs[_0x38f9('0x33')](_['pick'](_0x1617eb[_0x38f9('0x32')],_0xd89189[_0x38f9('0x33')]),_0x252da1);if(_0x1617eb['query'][_0x38f9('0x3c')]){_0x58ded8['where']=_[_0x38f9('0x3d')](_0x58ded8[_0x38f9('0x3e')],{'$or':_[_0x38f9('0x2c')](_0x252da1,function(_0x58ba4e){if(_0x58ba4e[_0x38f9('0x2e')]!==_0x38f9('0x3f')){var _0x1af723={};_0x1af723[_0x58ba4e[_0x38f9('0x29')]]={'$like':'%'+_0x1617eb[_0x38f9('0x32')][_0x38f9('0x3c')]+'%'};return _0x1af723;}})});}_0x58ded8=_[_0x38f9('0x3d')]({},_0x58ded8,_0x1617eb[_0x38f9('0x40')]);var _0x2c59a9={'where':_0x58ded8[_0x38f9('0x3e')]};return db[_0x38f9('0x41')]['count'](_0x2c59a9)[_0x38f9('0x26')](function(_0x2af3e7){_0x1a9c36[_0x38f9('0x1f')]=_0x2af3e7;if(_0x1617eb[_0x38f9('0x32')][_0x38f9('0x42')]){_0x58ded8[_0x38f9('0x43')]=[{'all':!![]}];}return db[_0x38f9('0x41')][_0x38f9('0x44')](_0x58ded8);})[_0x38f9('0x26')](function(_0x308910){_0x1a9c36[_0x38f9('0x45')]=_0x308910;return _0x1a9c36;})[_0x38f9('0x26')](respondWithFilteredResult(_0x15e3ec,_0x58ded8))['catch'](handleError(_0x15e3ec,null));};exports[_0x38f9('0x46')]=function(_0x5ea141,_0x5184fd){var _0x33aaf9={'raw':!![],'where':{'id':_0x5ea141['params']['id']}},_0x3907da={};_0x3907da['model']=_[_0x38f9('0x31')](db[_0x38f9('0x41')][_0x38f9('0x2d')]);_0x3907da[_0x38f9('0x32')]=_[_0x38f9('0x31')](_0x5ea141['query']);_0x3907da[_0x38f9('0x33')]=_[_0x38f9('0x34')](_0x3907da[_0x38f9('0x30')],_0x3907da[_0x38f9('0x32')]);_0x33aaf9[_0x38f9('0x35')]=_[_0x38f9('0x34')](_0x3907da[_0x38f9('0x30')],qs['fields'](_0x5ea141['query'][_0x38f9('0x36')]));_0x33aaf9[_0x38f9('0x35')]=_0x33aaf9[_0x38f9('0x35')]['length']?_0x33aaf9[_0x38f9('0x35')]:_0x3907da[_0x38f9('0x30')];if(_0x5ea141['query'][_0x38f9('0x42')]){_0x33aaf9['include']=[{'all':!![]}];}_0x33aaf9=_[_0x38f9('0x3d')]({},_0x33aaf9,_0x5ea141[_0x38f9('0x40')]);return db[_0x38f9('0x41')]['find'](_0x33aaf9)[_0x38f9('0x26')](handleEntityNotFound(_0x5184fd,null))[_0x38f9('0x26')](respondWithResult(_0x5184fd,null))[_0x38f9('0x47')](handleError(_0x5184fd,null));};exports[_0x38f9('0x48')]=function(_0x530cec,_0x2a6f26){return db[_0x38f9('0x41')][_0x38f9('0x48')](_0x530cec[_0x38f9('0x49')],{})[_0x38f9('0x26')](respondWithResult(_0x2a6f26,0xc9))[_0x38f9('0x47')](handleError(_0x2a6f26,null));};exports[_0x38f9('0x25')]=function(_0x2e3c13,_0x54aea6){if(_0x2e3c13[_0x38f9('0x49')]['id']){delete _0x2e3c13[_0x38f9('0x49')]['id'];}return db[_0x38f9('0x41')][_0x38f9('0x4a')]({'where':{'id':_0x2e3c13[_0x38f9('0x4b')]['id']}})['then'](handleEntityNotFound(_0x54aea6,null))[_0x38f9('0x26')](saveUpdates(_0x2e3c13['body'],null))[_0x38f9('0x26')](respondWithResult(_0x54aea6,null))[_0x38f9('0x47')](handleError(_0x54aea6,null));};exports[_0x38f9('0x4c')]=function(_0x5ed791,_0x1203a4,_0x402629){var _0x48afd7=require(_0x38f9('0x4d'));var _0x5a26ac=![];var _0x165d94={};if(_0x5ed791['query'][_0x38f9('0x2e')]&&_0x5ed791[_0x38f9('0x32')][_0x38f9('0x2e')]===_0x38f9('0x4e')){_0x165d94['uniqueid']=_0x5ed791[_0x38f9('0x4b')]['id'];}else{_0x165d94['id']=_0x5ed791[_0x38f9('0x4b')]['id'];}return db['SquareRecording'][_0x38f9('0x4a')]({'where':_0x165d94,'attributes':['id','savePath','filename'],'raw':!![]})['then'](handleEntityNotFound(_0x1203a4,null))[_0x38f9('0x26')](function(_0x1fb1cd){if(_0x1fb1cd){var _0x4c6c8b=_0x1fb1cd[_0x38f9('0x4f')];var _0xb650c0=util[_0x38f9('0x50')](_0x38f9('0x51'),_0x4c6c8b);if(fs['existsSync'](_0xb650c0)){_0x5a26ac=!![];return _0x48afd7[_0x38f9('0x52')](_0xb650c0,_0x4c6c8b,config[_0x38f9('0x53')][_0x38f9('0x54')])[_0x38f9('0x26')](function(){return _0x1fb1cd;});}return _0x1fb1cd;}})[_0x38f9('0x26')](function(_0x39e66c){if(_0x39e66c){var _0x4a9b81=_0x39e66c['savePath'];if(!fs[_0x38f9('0x55')](_0x4a9b81)){throw new db[(_0x38f9('0x56'))][(_0x38f9('0x57'))](_0x38f9('0x58'));}if(_0x39e66c['filename']){return _0x1203a4['download'](_0x4a9b81,_0x39e66c[_0x38f9('0x59')]+path['extname'](_0x4a9b81),function(){if(_0x5a26ac){fs[_0x38f9('0x5a')](_0x4a9b81);}});}else{return _0x1203a4['download'](_0x4a9b81,function(_0x3e2c76){if(_0x5a26ac){fs[_0x38f9('0x5a')](_0x4a9b81);}});}}})[_0x38f9('0x47')](function(_0x5666d7){if(_0x5666d7['message']===_0x38f9('0x58')){_0x1203a4['status'](0x194)['send'](_0x38f9('0x5b'));}else{return handleError(_0x1203a4,null);}});};exports[_0x38f9('0x5c')]=function(_0x41cd4b,_0x2a59b1){return db['SquareRecording'][_0x38f9('0x4a')]({'where':{'id':_0x41cd4b[_0x38f9('0x4b')]['id']}})[_0x38f9('0x26')](function(_0x437cd1){if(_[_0x38f9('0x5d')](_0x437cd1)){throw new ReferenceError('Entity\x20not\x20found');}return _0x437cd1;})[_0x38f9('0x26')](function(_0x3a73b9){var _0x3fc5b3=_0x3a73b9['savePath'];logger[_0x38f9('0x5e')](_0x38f9('0x5f'),_0x3fc5b3);if(!_[_0x38f9('0x5d')](_0x3a73b9[_0x38f9('0x4f')])&&fs['existsSync'](_0x3fc5b3)){logger['info'](_0x38f9('0x60')+_0x3fc5b3+_0x38f9('0x61'));fs['unlinkSync'](_0x3fc5b3);}_0x3fc5b3=_0x3fc5b3+_0x38f9('0x62');if(!_[_0x38f9('0x5d')](_0x3a73b9['savePath'])&&fs['existsSync'](_0x3fc5b3)){logger[_0x38f9('0x5e')](_0x38f9('0x60')+_0x3fc5b3+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x38f9('0x63')](_0x3fc5b3);}return _0x3a73b9;})[_0x38f9('0x26')](function(_0x41e7f0){if(!_0x41e7f0)throw new InternalError();return _0x41e7f0['destroy']();})[_0x38f9('0x26')](function(){_0x2a59b1[_0x38f9('0x19')](0xcc)['end']();})['catch'](handleError(_0x2a59b1,null));}; \ No newline at end of file +var _0x9745=['info','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','File:\x20\x22','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','then','destroy','index','fieldName','key','map','name','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','SquareRecording','includeAll','rows','show','params','rawAttributes','include','find','catch','create','update','body','download','../../components/encryptor','type','uniqueid','savePath','filename','existsSync','decryptFile','secrets','ValidationError','unlink','message','SquareRecording\x20not\x20found','send','Not\x20found','isNil','Entity\x20not\x20found'];(function(_0x47c4ba,_0x3d692c){var _0x5435eb=function(_0x10c849){while(--_0x10c849){_0x47c4ba['push'](_0x47c4ba['shift']());}};_0x5435eb(++_0x3d692c);}(_0x9745,0xc0));var _0x5974=function(_0x1c8c28,_0x3ee093){_0x1c8c28=_0x1c8c28-0x0;var _0x1f59b4=_0x9745[_0x1c8c28];return _0x1f59b4;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5974('0x0'));var jsonpatch=require(_0x5974('0x1'));var rp=require('request-promise');var moment=require(_0x5974('0x2'));var BPromise=require(_0x5974('0x3'));var Mustache=require(_0x5974('0x4'));var util=require(_0x5974('0x5'));var path=require(_0x5974('0x6'));var sox=require(_0x5974('0x7'));var csv=require('to-csv');var ejs=require(_0x5974('0x8'));var fs=require('fs');var fs_extra=require(_0x5974('0x9'));var _=require(_0x5974('0xa'));var squel=require(_0x5974('0xb'));var crypto=require(_0x5974('0xc'));var jsforce=require(_0x5974('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x5974('0xe'));var querystring=require(_0x5974('0xf'));var Papa=require(_0x5974('0x10'));var Redis=require(_0x5974('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5974('0x12'));var as=require(_0x5974('0x13'));var hardwareService=require(_0x5974('0x14'));var logger=require(_0x5974('0x15'))(_0x5974('0x16'));var utils=require(_0x5974('0x17'));var config=require(_0x5974('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x5974('0x19'))['db'];function respondWithStatusCode(_0x398580,_0x41f7a3){_0x41f7a3=_0x41f7a3||0xcc;return function(_0x7f9838){if(_0x7f9838){return _0x398580[_0x5974('0x1a')](_0x41f7a3);}return _0x398580[_0x5974('0x1b')](_0x41f7a3)[_0x5974('0x1c')]();};}function respondWithResult(_0x360da4,_0x433613){_0x433613=_0x433613||0xc8;return function(_0x3c568e){if(_0x3c568e){return _0x360da4[_0x5974('0x1b')](_0x433613)[_0x5974('0x1d')](_0x3c568e);}};}function respondWithFilteredResult(_0x28f3d9,_0x1d70f9){return function(_0x2771b3){if(_0x2771b3){var _0x2cbb96=typeof _0x1d70f9[_0x5974('0x1e')]===_0x5974('0x1f')&&typeof _0x1d70f9[_0x5974('0x20')]==='undefined';var _0x538f35=_0x2771b3[_0x5974('0x21')];var _0x1eb721=_0x2cbb96?0x0:_0x1d70f9[_0x5974('0x1e')];var _0x1787be=_0x2cbb96?_0x2771b3['count']:_0x1d70f9['offset']+_0x1d70f9[_0x5974('0x20')];var _0x433e57;if(_0x1787be>=_0x538f35){_0x1787be=_0x538f35;_0x433e57=0xc8;}else{_0x433e57=0xce;}_0x28f3d9['status'](_0x433e57);return _0x28f3d9[_0x5974('0x22')](_0x5974('0x23'),_0x1eb721+'-'+_0x1787be+'/'+_0x538f35)[_0x5974('0x1d')](_0x2771b3);}return null;};}function patchUpdates(_0x17096b){return function(_0x108d16){try{jsonpatch['apply'](_0x108d16,_0x17096b,!![]);}catch(_0x19b855){return BPromise['reject'](_0x19b855);}return _0x108d16[_0x5974('0x24')]();};}function saveUpdates(_0x9feb56,_0xb0f4e4){return function(_0x33cc4b){if(_0x33cc4b){return _0x33cc4b['update'](_0x9feb56)[_0x5974('0x25')](function(_0x4d42ff){return _0x4d42ff;});}return null;};}function removeEntity(_0x5618ab,_0x288dc2){return function(_0x38c3fc){if(_0x38c3fc){return _0x38c3fc[_0x5974('0x26')]()[_0x5974('0x25')](function(){_0x5618ab[_0x5974('0x1b')](0xcc)[_0x5974('0x1c')]();});}};}function handleEntityNotFound(_0x10fadc,_0xfb647b){return function(_0x4eae0a){if(!_0x4eae0a){_0x10fadc['sendStatus'](0x194);}return _0x4eae0a;};}function handleError(_0x30c8cd,_0x1009e7){_0x1009e7=_0x1009e7||0x1f4;return function(_0x326782){logger['error'](_0x326782['stack']);if(_0x326782['name']){delete _0x326782['name'];}_0x30c8cd['status'](_0x1009e7)['send'](_0x326782);};}exports[_0x5974('0x27')]=function(_0x5377c9,_0x197bba){var _0x4a84d7={},_0x8e45a7={},_0x5659b1={'count':0x0,'rows':[]};var _0x46c1db=_['map'](db['SquareRecording']['rawAttributes'],function(_0x369752){return{'name':_0x369752[_0x5974('0x28')],'type':_0x369752['type'][_0x5974('0x29')]};});_0x8e45a7['model']=_[_0x5974('0x2a')](_0x46c1db,_0x5974('0x2b'));_0x8e45a7[_0x5974('0x2c')]=_[_0x5974('0x2d')](_0x5377c9[_0x5974('0x2c')]);_0x8e45a7['filters']=_[_0x5974('0x2e')](_0x8e45a7[_0x5974('0x2f')],_0x8e45a7[_0x5974('0x2c')]);_0x4a84d7['attributes']=_[_0x5974('0x2e')](_0x8e45a7[_0x5974('0x2f')],qs[_0x5974('0x30')](_0x5377c9[_0x5974('0x2c')][_0x5974('0x30')]));_0x4a84d7['attributes']=_0x4a84d7[_0x5974('0x31')][_0x5974('0x32')]?_0x4a84d7[_0x5974('0x31')]:_0x8e45a7[_0x5974('0x2f')];if(!_0x5377c9[_0x5974('0x2c')][_0x5974('0x33')](_0x5974('0x34'))){_0x4a84d7[_0x5974('0x20')]=qs['limit'](_0x5377c9[_0x5974('0x2c')][_0x5974('0x20')]);_0x4a84d7[_0x5974('0x1e')]=qs[_0x5974('0x1e')](_0x5377c9['query'][_0x5974('0x1e')]);}_0x4a84d7[_0x5974('0x35')]=qs[_0x5974('0x36')](_0x5377c9['query'][_0x5974('0x36')]);_0x4a84d7[_0x5974('0x37')]=qs[_0x5974('0x38')](_[_0x5974('0x39')](_0x5377c9[_0x5974('0x2c')],_0x8e45a7['filters']),_0x46c1db);if(_0x5377c9[_0x5974('0x2c')][_0x5974('0x3a')]){_0x4a84d7[_0x5974('0x37')]=_[_0x5974('0x3b')](_0x4a84d7[_0x5974('0x37')],{'$or':_[_0x5974('0x2a')](_0x46c1db,function(_0x569f35){if(_0x569f35['type']!=='VIRTUAL'){var _0x243591={};_0x243591[_0x569f35[_0x5974('0x2b')]]={'$like':'%'+_0x5377c9[_0x5974('0x2c')]['filter']+'%'};return _0x243591;}})});}_0x4a84d7=_['merge']({},_0x4a84d7,_0x5377c9[_0x5974('0x3c')]);var _0x2c0efd={'where':_0x4a84d7['where']};return db[_0x5974('0x3d')]['count'](_0x2c0efd)[_0x5974('0x25')](function(_0x592d72){_0x5659b1[_0x5974('0x21')]=_0x592d72;if(_0x5377c9[_0x5974('0x2c')][_0x5974('0x3e')]){_0x4a84d7['include']=[{'all':!![]}];}return db[_0x5974('0x3d')]['findAll'](_0x4a84d7);})[_0x5974('0x25')](function(_0x206c32){_0x5659b1[_0x5974('0x3f')]=_0x206c32;return _0x5659b1;})[_0x5974('0x25')](respondWithFilteredResult(_0x197bba,_0x4a84d7))['catch'](handleError(_0x197bba,null));};exports[_0x5974('0x40')]=function(_0x512b9a,_0x360965){var _0x5691d7={'raw':!![],'where':{'id':_0x512b9a[_0x5974('0x41')]['id']}},_0x265dcc={};_0x265dcc[_0x5974('0x2f')]=_[_0x5974('0x2d')](db[_0x5974('0x3d')][_0x5974('0x42')]);_0x265dcc[_0x5974('0x2c')]=_['keys'](_0x512b9a[_0x5974('0x2c')]);_0x265dcc[_0x5974('0x38')]=_[_0x5974('0x2e')](_0x265dcc[_0x5974('0x2f')],_0x265dcc[_0x5974('0x2c')]);_0x5691d7[_0x5974('0x31')]=_[_0x5974('0x2e')](_0x265dcc[_0x5974('0x2f')],qs[_0x5974('0x30')](_0x512b9a[_0x5974('0x2c')][_0x5974('0x30')]));_0x5691d7[_0x5974('0x31')]=_0x5691d7['attributes'][_0x5974('0x32')]?_0x5691d7[_0x5974('0x31')]:_0x265dcc[_0x5974('0x2f')];if(_0x512b9a[_0x5974('0x2c')][_0x5974('0x3e')]){_0x5691d7[_0x5974('0x43')]=[{'all':!![]}];}_0x5691d7=_[_0x5974('0x3b')]({},_0x5691d7,_0x512b9a[_0x5974('0x3c')]);return db[_0x5974('0x3d')][_0x5974('0x44')](_0x5691d7)[_0x5974('0x25')](handleEntityNotFound(_0x360965,null))[_0x5974('0x25')](respondWithResult(_0x360965,null))[_0x5974('0x45')](handleError(_0x360965,null));};exports['create']=function(_0x5266e5,_0x57eec9){return db[_0x5974('0x3d')][_0x5974('0x46')](_0x5266e5['body'],{})[_0x5974('0x25')](respondWithResult(_0x57eec9,0xc9))['catch'](handleError(_0x57eec9,null));};exports[_0x5974('0x47')]=function(_0x5905af,_0x392073){if(_0x5905af['body']['id']){delete _0x5905af[_0x5974('0x48')]['id'];}return db[_0x5974('0x3d')][_0x5974('0x44')]({'where':{'id':_0x5905af[_0x5974('0x41')]['id']}})[_0x5974('0x25')](handleEntityNotFound(_0x392073,null))[_0x5974('0x25')](saveUpdates(_0x5905af[_0x5974('0x48')],null))[_0x5974('0x25')](respondWithResult(_0x392073,null))[_0x5974('0x45')](handleError(_0x392073,null));};exports[_0x5974('0x49')]=function(_0x4ff02b,_0x30b0db,_0xc4a4bd){var _0x32cb50=require(_0x5974('0x4a'));var _0x2864fd=![];var _0x43a2d3={};if(_0x4ff02b[_0x5974('0x2c')][_0x5974('0x4b')]&&_0x4ff02b[_0x5974('0x2c')][_0x5974('0x4b')]===_0x5974('0x4c')){_0x43a2d3[_0x5974('0x4c')]=_0x4ff02b['params']['id'];}else{_0x43a2d3['id']=_0x4ff02b[_0x5974('0x41')]['id'];}return db[_0x5974('0x3d')][_0x5974('0x44')]({'where':_0x43a2d3,'attributes':['id',_0x5974('0x4d'),_0x5974('0x4e')],'raw':!![]})[_0x5974('0x25')](handleEntityNotFound(_0x30b0db,null))[_0x5974('0x25')](function(_0x240c95){if(_0x240c95){var _0x3f9af9=_0x240c95[_0x5974('0x4d')];var _0x22d5bb=util['format']('%s.cypher',_0x3f9af9);if(fs[_0x5974('0x4f')](_0x22d5bb)){_0x2864fd=!![];return _0x32cb50[_0x5974('0x50')](_0x22d5bb,_0x3f9af9,config[_0x5974('0x51')]['recording'])['then'](function(){return _0x240c95;});}return _0x240c95;}})['then'](function(_0x19079e){if(_0x19079e){var _0x2e58f7=_0x19079e[_0x5974('0x4d')];if(!fs['existsSync'](_0x2e58f7)){throw new db['Sequelize'][(_0x5974('0x52'))]('SquareRecording\x20not\x20found');}if(_0x19079e[_0x5974('0x4e')]){return _0x30b0db[_0x5974('0x49')](_0x2e58f7,_0x19079e['filename']+path['extname'](_0x2e58f7),function(){if(_0x2864fd){fs[_0x5974('0x53')](_0x2e58f7);}});}else{return _0x30b0db[_0x5974('0x49')](_0x2e58f7,function(_0x23d495){if(_0x2864fd){fs[_0x5974('0x53')](_0x2e58f7);}});}}})['catch'](function(_0x5ce746){if(_0x5ce746[_0x5974('0x54')]===_0x5974('0x55')){_0x30b0db[_0x5974('0x1b')](0x194)[_0x5974('0x56')](_0x5974('0x57'));}else{return handleError(_0x30b0db,null);}});};exports[_0x5974('0x26')]=function(_0x4a9c5c,_0x5c67a9){return db['SquareRecording'][_0x5974('0x44')]({'where':{'id':_0x4a9c5c[_0x5974('0x41')]['id']}})[_0x5974('0x25')](function(_0x5cb557){if(_[_0x5974('0x58')](_0x5cb557)){throw new ReferenceError(_0x5974('0x59'));}return _0x5cb557;})[_0x5974('0x25')](function(_0x99b24e){var _0x262f71=_0x99b24e[_0x5974('0x4d')];logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0x262f71);if(!_['isNil'](_0x99b24e[_0x5974('0x4d')])&&fs['existsSync'](_0x262f71)){logger[_0x5974('0x5a')]('File:\x20\x22'+_0x262f71+_0x5974('0x5b'));fs['unlinkSync'](_0x262f71);}_0x262f71=_0x262f71+_0x5974('0x5c');if(!_[_0x5974('0x58')](_0x99b24e[_0x5974('0x4d')])&&fs['existsSync'](_0x262f71)){logger[_0x5974('0x5a')](_0x5974('0x5d')+_0x262f71+_0x5974('0x5b'));fs['unlinkSync'](_0x262f71);}return _0x99b24e;})[_0x5974('0x25')](function(_0x2c6760){if(!_0x2c6760)throw new InternalError();return _0x2c6760[_0x5974('0x26')]();})[_0x5974('0x25')](function(){_0x5c67a9['status'](0xcc)[_0x5974('0x1c')]();})['catch'](handleError(_0x5c67a9,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index c686d90..c34526a 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 _0x202a=['util','../../config/logger','api','bluebird','../../config/environment','./squareRecording.attributes'];(function(_0x445608,_0x569aaa){var _0x544038=function(_0x3ac781){while(--_0x3ac781){_0x445608['push'](_0x445608['shift']());}};_0x544038(++_0x569aaa);}(_0x202a,0xc0));var _0xa202=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x202a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xa202('0x0'));var logger=require(_0xa202('0x1'))(_0xa202('0x2'));var moment=require('moment');var BPromise=require(_0xa202('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa202('0x4'));var attributes=require(_0xa202('0x5'));module['exports']=function(_0x49e186,_0x8e05f0){return _0x49e186['define']('SquareRecording',attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x61f1=['moment','bluebird','rimraf','../../config/environment','exports','define','SquareRecording','util','api'];(function(_0x5e3c78,_0x51e22e){var _0x36bed1=function(_0x3f891a){while(--_0x3f891a){_0x5e3c78['push'](_0x5e3c78['shift']());}};_0x36bed1(++_0x51e22e);}(_0x61f1,0x18a));var _0x161f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x61f1[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x161f('0x0'));var logger=require('../../config/logger')(_0x161f('0x1'));var moment=require(_0x161f('0x2'));var BPromise=require(_0x161f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x161f('0x4'));var config=require(_0x161f('0x5'));var attributes=require('./squareRecording.attributes');module[_0x161f('0x6')]=function(_0x2317af,_0x15b3a4){return _0x2317af[_0x161f('0x7')](_0x161f('0x8'),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 fcafa23..5086b35 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 _0x3978=['ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','request','info','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareRecording,\x20%s,\x20%s','message','result','catch','CreateSquareRecording','SquareRecording','create','options','then','lodash','util','moment','randomstring'];(function(_0x4881fc,_0x5f1c90){var _0x342a28=function(_0x10276c){while(--_0x10276c){_0x4881fc['push'](_0x4881fc['shift']());}};_0x342a28(++_0x5f1c90);}(_0x3978,0x68));var _0x8397=function(_0x521855,_0x571571){_0x521855=_0x521855-0x0;var _0x4f1957=_0x3978[_0x521855];return _0x4f1957;};'use strict';var _=require(_0x8397('0x0'));var util=require(_0x8397('0x1'));var moment=require(_0x8397('0x2'));var BPromise=require('bluebird');var rs=require(_0x8397('0x3'));var fs=require('fs');var Redis=require(_0x8397('0x4'));var db=require(_0x8397('0x5'))['db'];var utils=require(_0x8397('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x8397('0x7'));var client=jayson[_0x8397('0x8')][_0x8397('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x19b699,_0x4b4b7f,_0x848b47){return new BPromise(function(_0x1a8ec2,_0x196e28){return client[_0x8397('0xa')](_0x19b699,_0x848b47)['then'](function(_0x378176){logger[_0x8397('0xb')]('SquareRecording,\x20%s,\x20%s',_0x4b4b7f,_0x8397('0xc'));logger[_0x8397('0xd')](_0x8397('0xe'),_0x4b4b7f,'request\x20sent',JSON[_0x8397('0xf')](_0x378176));if(_0x378176[_0x8397('0x10')]){if(_0x378176['error'][_0x8397('0x11')]===0x1f4){logger[_0x8397('0x10')](_0x8397('0x12'),_0x4b4b7f,_0x378176[_0x8397('0x10')][_0x8397('0x13')]);return _0x196e28(_0x378176['error'][_0x8397('0x13')]);}logger[_0x8397('0x10')](_0x8397('0x12'),_0x4b4b7f,_0x378176['error'][_0x8397('0x13')]);return _0x1a8ec2(_0x378176[_0x8397('0x10')]['message']);}else{logger['info']('SquareRecording,\x20%s,\x20%s',_0x4b4b7f,'request\x20sent');_0x1a8ec2(_0x378176[_0x8397('0x14')]['message']);}})[_0x8397('0x15')](function(_0x3ecedd){logger[_0x8397('0x10')](_0x8397('0x12'),_0x4b4b7f,_0x3ecedd);_0x196e28(_0x3ecedd);});});}exports[_0x8397('0x16')]=function(_0x45cb7f){var _0x7be3a2=this;return new Promise(function(_0x58d03a,_0x51baec){return db[_0x8397('0x17')][_0x8397('0x18')](_0x45cb7f['body'],{'raw':_0x45cb7f[_0x8397('0x19')]?_0x45cb7f['options']['raw']===undefined?!![]:![]:!![]})[_0x8397('0x1a')](function(_0x8f4efc){logger[_0x8397('0xb')]('CreateSquareRecording',_0x45cb7f);logger[_0x8397('0xd')](_0x8397('0x16'),_0x45cb7f,JSON[_0x8397('0xf')](_0x8f4efc));_0x58d03a(_0x8f4efc);})[_0x8397('0x15')](function(_0x134dbf){logger[_0x8397('0x10')]('CreateSquareRecording',_0x134dbf[_0x8397('0x13')],_0x45cb7f);_0x51baec(_0x7be3a2[_0x8397('0x10')](0x1f4,_0x134dbf[_0x8397('0x13')]));});});}; \ No newline at end of file +var _0x3e6d=['../../config/logger','rpc','../../config/environment','client','http','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateSquareRecording','SquareRecording','create','body','options','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x3502e,_0x264b8b){var _0x300758=function(_0x1ce7a6){while(--_0x1ce7a6){_0x3502e['push'](_0x3502e['shift']());}};_0x300758(++_0x264b8b);}(_0x3e6d,0x14a));var _0xd3e6=function(_0x51f46b,_0xd38e06){_0x51f46b=_0x51f46b-0x0;var _0x1812cb=_0x3e6d[_0x51f46b];return _0x1812cb;};'use strict';var _=require(_0xd3e6('0x0'));var util=require('util');var moment=require(_0xd3e6('0x1'));var BPromise=require(_0xd3e6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd3e6('0x3'));var db=require(_0xd3e6('0x4'))['db'];var utils=require(_0xd3e6('0x5'));var logger=require(_0xd3e6('0x6'))(_0xd3e6('0x7'));var config=require(_0xd3e6('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd3e6('0x9')][_0xd3e6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1f5355,_0x146084,_0x367c73){return new BPromise(function(_0x5c3527,_0x54f9c6){return client[_0xd3e6('0xb')](_0x1f5355,_0x367c73)[_0xd3e6('0xc')](function(_0x9f5209){logger[_0xd3e6('0xd')](_0xd3e6('0xe'),_0x146084,_0xd3e6('0xf'));logger[_0xd3e6('0x10')](_0xd3e6('0x11'),_0x146084,_0xd3e6('0xf'),JSON['stringify'](_0x9f5209));if(_0x9f5209[_0xd3e6('0x12')]){if(_0x9f5209[_0xd3e6('0x12')][_0xd3e6('0x13')]===0x1f4){logger['error'](_0xd3e6('0xe'),_0x146084,_0x9f5209[_0xd3e6('0x12')][_0xd3e6('0x14')]);return _0x54f9c6(_0x9f5209[_0xd3e6('0x12')]['message']);}logger[_0xd3e6('0x12')](_0xd3e6('0xe'),_0x146084,_0x9f5209[_0xd3e6('0x12')][_0xd3e6('0x14')]);return _0x5c3527(_0x9f5209[_0xd3e6('0x12')][_0xd3e6('0x14')]);}else{logger[_0xd3e6('0xd')]('SquareRecording,\x20%s,\x20%s',_0x146084,'request\x20sent');_0x5c3527(_0x9f5209[_0xd3e6('0x15')][_0xd3e6('0x14')]);}})[_0xd3e6('0x16')](function(_0x36512c){logger['error']('SquareRecording,\x20%s,\x20%s',_0x146084,_0x36512c);_0x54f9c6(_0x36512c);});});}exports[_0xd3e6('0x17')]=function(_0x54629e){var _0x3fee04=this;return new Promise(function(_0x483a16,_0x101dbe){return db[_0xd3e6('0x18')][_0xd3e6('0x19')](_0x54629e[_0xd3e6('0x1a')],{'raw':_0x54629e[_0xd3e6('0x1b')]?_0x54629e[_0xd3e6('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0xd3e6('0xc')](function(_0x5be055){logger[_0xd3e6('0xd')](_0xd3e6('0x17'),_0x54629e);logger[_0xd3e6('0x10')](_0xd3e6('0x17'),_0x54629e,JSON['stringify'](_0x5be055));_0x483a16(_0x5be055);})[_0xd3e6('0x16')](function(_0x2f62cd){logger[_0xd3e6('0x12')](_0xd3e6('0x17'),_0x2f62cd[_0xd3e6('0x14')],_0x54629e);_0x101dbe(_0x3fee04['error'](0x1f4,_0x2f62cd['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index e1e74b3..685f2ef 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 _0xe706=['/describe','describe','/:id','show','post','create','put','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index'];(function(_0x488941,_0x5a3938){var _0x2de6fc=function(_0x44c213){while(--_0x44c213){_0x488941['push'](_0x488941['shift']());}};_0x2de6fc(++_0x5a3938);}(_0xe706,0xa3));var _0x6e70=function(_0x5d8e11,_0x1b2574){_0x5d8e11=_0x5d8e11-0x0;var _0x25fa53=_0xe706[_0x5d8e11];return _0x25fa53;};'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')](),controller[_0x6e70('0x12')]);router[_0x6e70('0x13')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller['update']);router['delete'](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x14')]);module[_0x6e70('0x15')]=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(_0x21597f,_0x39eb71){var _0x1491b7=function(_0x2fb835){while(--_0x2fb835){_0x21597f['push'](_0x21597f['shift']());}};_0x1491b7(++_0x39eb71);}(_0xb10b,0x12a));var _0xbb10=function(_0x3e6d5d,_0x264c7a){_0x3e6d5d=_0x3e6d5d-0x0;var _0x238923=_0xb10b[_0x3e6d5d];return _0x238923;};'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 2171096..ca32f32 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 _0x3c6a=['BOOLEAN','sequelize','exports','STRING','DATE'];(function(_0x4b54fb,_0x2150e4){var _0x375eb4=function(_0x461679){while(--_0x461679){_0x4b54fb['push'](_0x4b54fb['shift']());}};_0x375eb4(++_0x2150e4);}(_0x3c6a,0xb5));var _0xa3c6=function(_0x491cbe,_0x45c8ba){_0x491cbe=_0x491cbe-0x0;var _0x59449d=_0x3c6a[_0x491cbe];return _0x59449d;};'use strict';var Sequelize=require(_0xa3c6('0x0'));module[_0xa3c6('0x1')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0xa3c6('0x2')]},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xa3c6('0x2')]},'type':{'type':Sequelize[_0xa3c6('0x2')]},'uniqueid':{'type':Sequelize[_0xa3c6('0x2')]},'version':{'type':Sequelize[_0xa3c6('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xa3c6('0x2')]},'callingpres':{'type':Sequelize[_0xa3c6('0x2')]},'callingani2':{'type':Sequelize[_0xa3c6('0x2')]},'callington':{'type':Sequelize[_0xa3c6('0x2')]},'callingtns':{'type':Sequelize[_0xa3c6('0x2')]},'dnid':{'type':Sequelize[_0xa3c6('0x2')]},'rdnis':{'type':Sequelize[_0xa3c6('0x2')]},'context':{'type':Sequelize[_0xa3c6('0x2')]},'extension':{'type':Sequelize[_0xa3c6('0x2')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0xa3c6('0x2')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0xa3c6('0x2')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xa3c6('0x3')]},'leaveAt':{'type':Sequelize[_0xa3c6('0x3')]},'bot':{'type':Sequelize[_0xa3c6('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xee64=['STRING','DATE','BOOLEAN','sequelize','exports'];(function(_0x11645c,_0x8b10b3){var _0x338801=function(_0x27b368){while(--_0x27b368){_0x11645c['push'](_0x11645c['shift']());}};_0x338801(++_0x8b10b3);}(_0xee64,0x1ca));var _0x4ee6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xee64[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x4ee6('0x0'));module[_0x4ee6('0x1')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0x4ee6('0x2')]},'request':{'type':Sequelize[_0x4ee6('0x2')]},'channel':{'type':Sequelize[_0x4ee6('0x2')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x4ee6('0x2')]},'version':{'type':Sequelize[_0x4ee6('0x2')]},'callerid':{'type':Sequelize[_0x4ee6('0x2')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0x4ee6('0x2')]},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0x4ee6('0x2')]},'callingtns':{'type':Sequelize[_0x4ee6('0x2')]},'dnid':{'type':Sequelize[_0x4ee6('0x2')]},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x4ee6('0x2')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x4ee6('0x2')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0x4ee6('0x2')]},'joinAt':{'type':Sequelize[_0x4ee6('0x3')]},'leaveAt':{'type':Sequelize[_0x4ee6('0x3')]},'bot':{'type':Sequelize[_0x4ee6('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 f9fc887..d5af774 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 _0x177c=['count','limit','set','Content-Range','apply','reject','then','stack','name','send','index','SquareReport','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','nolimit','order','where','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','body','update','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','desk.js','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0x237be9,_0x41c649){var _0x3b5de4=function(_0xf8e225){while(--_0xf8e225){_0x237be9['push'](_0x237be9['shift']());}};_0x3b5de4(++_0x41c649);}(_0x177c,0x1d5));var _0xc177=function(_0x54e6e1,_0x21062b){_0x54e6e1=_0x54e6e1-0x0;var _0x4d985d=_0x177c[_0x54e6e1];return _0x4d985d;};'use strict';var emlformat=require(_0xc177('0x0'));var rimraf=require(_0xc177('0x1'));var zipdir=require(_0xc177('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc177('0x3'));var moment=require(_0xc177('0x4'));var BPromise=require(_0xc177('0x5'));var Mustache=require(_0xc177('0x6'));var util=require(_0xc177('0x7'));var path=require(_0xc177('0x8'));var sox=require('sox');var csv=require(_0xc177('0x9'));var ejs=require(_0xc177('0xa'));var fs=require('fs');var fs_extra=require(_0xc177('0xb'));var _=require(_0xc177('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc177('0xd'));var toCsv=require(_0xc177('0x9'));var querystring=require('querystring');var Papa=require(_0xc177('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc177('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc177('0x10'));var logger=require(_0xc177('0x11'))('api');var utils=require(_0xc177('0x12'));var config=require(_0xc177('0x13'));var licenseUtil=require(_0xc177('0x14'));var db=require(_0xc177('0x15'))['db'];function respondWithStatusCode(_0x450550,_0x4ef865){_0x4ef865=_0x4ef865||0xcc;return function(_0x3a2195){if(_0x3a2195){return _0x450550[_0xc177('0x16')](_0x4ef865);}return _0x450550[_0xc177('0x17')](_0x4ef865)[_0xc177('0x18')]();};}function respondWithResult(_0x570153,_0x406c8f){_0x406c8f=_0x406c8f||0xc8;return function(_0x2b3729){if(_0x2b3729){return _0x570153[_0xc177('0x17')](_0x406c8f)[_0xc177('0x19')](_0x2b3729);}};}function respondWithFilteredResult(_0x49ee09,_0x8ec14e){return function(_0x44885e){if(_0x44885e){var _0x5af1c4=typeof _0x8ec14e[_0xc177('0x1a')]==='undefined'&&typeof _0x8ec14e['limit']===_0xc177('0x1b');var _0x4eb260=_0x44885e[_0xc177('0x1c')];var _0x371328=_0x5af1c4?0x0:_0x8ec14e[_0xc177('0x1a')];var _0x3e1ff6=_0x5af1c4?_0x44885e[_0xc177('0x1c')]:_0x8ec14e[_0xc177('0x1a')]+_0x8ec14e[_0xc177('0x1d')];var _0x4028ef;if(_0x3e1ff6>=_0x4eb260){_0x3e1ff6=_0x4eb260;_0x4028ef=0xc8;}else{_0x4028ef=0xce;}_0x49ee09['status'](_0x4028ef);return _0x49ee09[_0xc177('0x1e')](_0xc177('0x1f'),_0x371328+'-'+_0x3e1ff6+'/'+_0x4eb260)['json'](_0x44885e);}return null;};}function patchUpdates(_0x4aec0b){return function(_0xcae623){try{jsonpatch[_0xc177('0x20')](_0xcae623,_0x4aec0b,!![]);}catch(_0x82cc53){return BPromise[_0xc177('0x21')](_0x82cc53);}return _0xcae623['save']();};}function saveUpdates(_0x284704,_0x12d2fa){return function(_0x50719b){if(_0x50719b){return _0x50719b['update'](_0x284704)[_0xc177('0x22')](function(_0x2f4eca){return _0x2f4eca;});}return null;};}function removeEntity(_0x11ff6b,_0x4f56d5){return function(_0x342129){if(_0x342129){return _0x342129['destroy']()['then'](function(){_0x11ff6b[_0xc177('0x17')](0xcc)[_0xc177('0x18')]();});}};}function handleEntityNotFound(_0x172fb5,_0x4810b4){return function(_0x45194a){if(!_0x45194a){_0x172fb5[_0xc177('0x16')](0x194);}return _0x45194a;};}function handleError(_0x413ba2,_0x510c64){_0x510c64=_0x510c64||0x1f4;return function(_0x5147fc){logger['error'](_0x5147fc[_0xc177('0x23')]);if(_0x5147fc[_0xc177('0x24')]){delete _0x5147fc[_0xc177('0x24')];}_0x413ba2[_0xc177('0x17')](_0x510c64)[_0xc177('0x25')](_0x5147fc);};}exports[_0xc177('0x26')]=function(_0x3644ec,_0xf6c861){var _0xc33090={},_0xae630f={},_0x17d220={'count':0x0,'rows':[]};var _0x255e5c=_['map'](db[_0xc177('0x27')]['rawAttributes'],function(_0x2493d1){return{'name':_0x2493d1[_0xc177('0x28')],'type':_0x2493d1[_0xc177('0x29')][_0xc177('0x2a')]};});_0xae630f[_0xc177('0x2b')]=_[_0xc177('0x2c')](_0x255e5c,'name');_0xae630f['query']=_[_0xc177('0x2d')](_0x3644ec[_0xc177('0x2e')]);_0xae630f[_0xc177('0x2f')]=_[_0xc177('0x30')](_0xae630f[_0xc177('0x2b')],_0xae630f[_0xc177('0x2e')]);_0xc33090[_0xc177('0x31')]=_[_0xc177('0x30')](_0xae630f[_0xc177('0x2b')],qs['fields'](_0x3644ec['query'][_0xc177('0x32')]));_0xc33090[_0xc177('0x31')]=_0xc33090[_0xc177('0x31')]['length']?_0xc33090[_0xc177('0x31')]:_0xae630f[_0xc177('0x2b')];if(!_0x3644ec[_0xc177('0x2e')]['hasOwnProperty'](_0xc177('0x33'))){_0xc33090['limit']=qs[_0xc177('0x1d')](_0x3644ec[_0xc177('0x2e')][_0xc177('0x1d')]);_0xc33090[_0xc177('0x1a')]=qs[_0xc177('0x1a')](_0x3644ec[_0xc177('0x2e')][_0xc177('0x1a')]);}_0xc33090[_0xc177('0x34')]=qs['sort'](_0x3644ec[_0xc177('0x2e')]['sort']);_0xc33090[_0xc177('0x35')]=qs[_0xc177('0x2f')](_['pick'](_0x3644ec[_0xc177('0x2e')],_0xae630f['filters']),_0x255e5c);if(_0x3644ec[_0xc177('0x2e')]['filter']){_0xc33090[_0xc177('0x35')]=_[_0xc177('0x36')](_0xc33090[_0xc177('0x35')],{'$or':_['map'](_0x255e5c,function(_0x326d0c){if(_0x326d0c[_0xc177('0x29')]!==_0xc177('0x37')){var _0x57b018={};_0x57b018[_0x326d0c[_0xc177('0x24')]]={'$like':'%'+_0x3644ec[_0xc177('0x2e')][_0xc177('0x38')]+'%'};return _0x57b018;}})});}_0xc33090=_[_0xc177('0x36')]({},_0xc33090,_0x3644ec['options']);var _0x1449b8={'where':_0xc33090[_0xc177('0x35')]};return db[_0xc177('0x27')][_0xc177('0x1c')](_0x1449b8)['then'](function(_0x5b6940){_0x17d220['count']=_0x5b6940;if(_0x3644ec[_0xc177('0x2e')][_0xc177('0x39')]){_0xc33090[_0xc177('0x3a')]=[{'all':!![]}];}return db[_0xc177('0x27')][_0xc177('0x3b')](_0xc33090);})[_0xc177('0x22')](function(_0x2edbc6){_0x17d220[_0xc177('0x3c')]=_0x2edbc6;return _0x17d220;})[_0xc177('0x22')](respondWithFilteredResult(_0xf6c861,_0xc33090))[_0xc177('0x3d')](handleError(_0xf6c861,null));};exports[_0xc177('0x3e')]=function(_0x25a91e,_0x3819c4){var _0x4aeec3={'raw':!![],'where':{'id':_0x25a91e[_0xc177('0x3f')]['id']}},_0x5d8b89={};_0x5d8b89[_0xc177('0x2b')]=_[_0xc177('0x2d')](db[_0xc177('0x27')][_0xc177('0x40')]);_0x5d8b89['query']=_[_0xc177('0x2d')](_0x25a91e['query']);_0x5d8b89[_0xc177('0x2f')]=_[_0xc177('0x30')](_0x5d8b89[_0xc177('0x2b')],_0x5d8b89[_0xc177('0x2e')]);_0x4aeec3[_0xc177('0x31')]=_[_0xc177('0x30')](_0x5d8b89[_0xc177('0x2b')],qs[_0xc177('0x32')](_0x25a91e[_0xc177('0x2e')][_0xc177('0x32')]));_0x4aeec3['attributes']=_0x4aeec3['attributes'][_0xc177('0x41')]?_0x4aeec3[_0xc177('0x31')]:_0x5d8b89['model'];if(_0x25a91e['query'][_0xc177('0x39')]){_0x4aeec3['include']=[{'all':!![]}];}_0x4aeec3=_[_0xc177('0x36')]({},_0x4aeec3,_0x25a91e['options']);return db[_0xc177('0x27')][_0xc177('0x42')](_0x4aeec3)[_0xc177('0x22')](handleEntityNotFound(_0x3819c4,null))[_0xc177('0x22')](respondWithResult(_0x3819c4,null))[_0xc177('0x3d')](handleError(_0x3819c4,null));};exports['create']=function(_0x204a95,_0x5aedbb){return db[_0xc177('0x27')][_0xc177('0x43')](_0x204a95[_0xc177('0x44')],{})[_0xc177('0x22')](respondWithResult(_0x5aedbb,0xc9))[_0xc177('0x3d')](handleError(_0x5aedbb,null));};exports[_0xc177('0x45')]=function(_0x11247e,_0x2edd76){if(_0x11247e[_0xc177('0x44')]['id']){delete _0x11247e[_0xc177('0x44')]['id'];}return db['SquareReport']['find']({'where':{'id':_0x11247e[_0xc177('0x3f')]['id']}})[_0xc177('0x22')](handleEntityNotFound(_0x2edd76,null))[_0xc177('0x22')](saveUpdates(_0x11247e['body'],null))[_0xc177('0x22')](respondWithResult(_0x2edd76,null))[_0xc177('0x3d')](handleError(_0x2edd76,null));};exports['destroy']=function(_0xc427db,_0x520766){return db['SquareReport'][_0xc177('0x42')]({'where':{'id':_0xc427db[_0xc177('0x3f')]['id']}})[_0xc177('0x22')](handleEntityNotFound(_0x520766,null))[_0xc177('0x22')](removeEntity(_0x520766,null))[_0xc177('0x3d')](handleError(_0x520766,null));};exports[_0xc177('0x46')]=function(_0x14f096,_0x28ddf8){return db[_0xc177('0x27')][_0xc177('0x46')]()[_0xc177('0x22')](respondWithResult(_0x28ddf8,null))['catch'](handleError(_0x28ddf8,null));}; \ No newline at end of file +var _0x6f73=['limit','count','set','Content-Range','apply','reject','save','then','stack','name','send','map','SquareReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','includeAll','include','rows','catch','show','params','create','body','find','rimraf','zip-dir','fast-json-patch','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0x5d80de,_0x2cf15d){var _0x1c7556=function(_0x5bd806){while(--_0x5bd806){_0x5d80de['push'](_0x5d80de['shift']());}};_0x1c7556(++_0x2cf15d);}(_0x6f73,0x1c6));var _0x36f7=function(_0x3a6aa9,_0x1e840a){_0x3a6aa9=_0x3a6aa9-0x0;var _0x532fb2=_0x6f73[_0x3a6aa9];return _0x532fb2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x36f7('0x0'));var zipdir=require(_0x36f7('0x1'));var jsonpatch=require(_0x36f7('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x36f7('0x3'));var util=require('util');var path=require(_0x36f7('0x4'));var sox=require(_0x36f7('0x5'));var csv=require(_0x36f7('0x6'));var ejs=require(_0x36f7('0x7'));var fs=require('fs');var fs_extra=require(_0x36f7('0x8'));var _=require(_0x36f7('0x9'));var squel=require(_0x36f7('0xa'));var crypto=require(_0x36f7('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x36f7('0xc'));var Papa=require(_0x36f7('0xd'));var Redis=require(_0x36f7('0xe'));var authService=require(_0x36f7('0xf'));var qs=require(_0x36f7('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x36f7('0x11'))(_0x36f7('0x12'));var utils=require(_0x36f7('0x13'));var config=require(_0x36f7('0x14'));var licenseUtil=require(_0x36f7('0x15'));var db=require(_0x36f7('0x16'))['db'];function respondWithStatusCode(_0x5dd435,_0x5de134){_0x5de134=_0x5de134||0xcc;return function(_0x139ba1){if(_0x139ba1){return _0x5dd435[_0x36f7('0x17')](_0x5de134);}return _0x5dd435[_0x36f7('0x18')](_0x5de134)[_0x36f7('0x19')]();};}function respondWithResult(_0x58fdd3,_0x392568){_0x392568=_0x392568||0xc8;return function(_0x12496a){if(_0x12496a){return _0x58fdd3[_0x36f7('0x18')](_0x392568)[_0x36f7('0x1a')](_0x12496a);}};}function respondWithFilteredResult(_0x2a16cc,_0xd1e179){return function(_0x4ea6c1){if(_0x4ea6c1){var _0x2dbaf6=typeof _0xd1e179[_0x36f7('0x1b')]===_0x36f7('0x1c')&&typeof _0xd1e179[_0x36f7('0x1d')]===_0x36f7('0x1c');var _0x66367e=_0x4ea6c1['count'];var _0x39103a=_0x2dbaf6?0x0:_0xd1e179['offset'];var _0x311c7a=_0x2dbaf6?_0x4ea6c1[_0x36f7('0x1e')]:_0xd1e179['offset']+_0xd1e179[_0x36f7('0x1d')];var _0x5f1240;if(_0x311c7a>=_0x66367e){_0x311c7a=_0x66367e;_0x5f1240=0xc8;}else{_0x5f1240=0xce;}_0x2a16cc[_0x36f7('0x18')](_0x5f1240);return _0x2a16cc[_0x36f7('0x1f')](_0x36f7('0x20'),_0x39103a+'-'+_0x311c7a+'/'+_0x66367e)[_0x36f7('0x1a')](_0x4ea6c1);}return null;};}function patchUpdates(_0x17ba15){return function(_0x1f0260){try{jsonpatch[_0x36f7('0x21')](_0x1f0260,_0x17ba15,!![]);}catch(_0x283e1c){return BPromise[_0x36f7('0x22')](_0x283e1c);}return _0x1f0260[_0x36f7('0x23')]();};}function saveUpdates(_0x4e72f6,_0x363be4){return function(_0x3936ff){if(_0x3936ff){return _0x3936ff['update'](_0x4e72f6)['then'](function(_0x196c18){return _0x196c18;});}return null;};}function removeEntity(_0x193e1b,_0x4a8255){return function(_0x2ebae0){if(_0x2ebae0){return _0x2ebae0['destroy']()[_0x36f7('0x24')](function(){_0x193e1b['status'](0xcc)[_0x36f7('0x19')]();});}};}function handleEntityNotFound(_0x593d00,_0x4b4505){return function(_0x57b34d){if(!_0x57b34d){_0x593d00[_0x36f7('0x17')](0x194);}return _0x57b34d;};}function handleError(_0x3253a7,_0x1597e4){_0x1597e4=_0x1597e4||0x1f4;return function(_0x480b69){logger['error'](_0x480b69[_0x36f7('0x25')]);if(_0x480b69[_0x36f7('0x26')]){delete _0x480b69[_0x36f7('0x26')];}_0x3253a7[_0x36f7('0x18')](_0x1597e4)[_0x36f7('0x27')](_0x480b69);};}exports['index']=function(_0x532e28,_0x58c898){var _0x4999e5={},_0x43830a={},_0x5d9f12={'count':0x0,'rows':[]};var _0x2f69d2=_[_0x36f7('0x28')](db[_0x36f7('0x29')][_0x36f7('0x2a')],function(_0x20ce02){return{'name':_0x20ce02[_0x36f7('0x2b')],'type':_0x20ce02[_0x36f7('0x2c')][_0x36f7('0x2d')]};});_0x43830a['model']=_[_0x36f7('0x28')](_0x2f69d2,_0x36f7('0x26'));_0x43830a[_0x36f7('0x2e')]=_[_0x36f7('0x2f')](_0x532e28[_0x36f7('0x2e')]);_0x43830a[_0x36f7('0x30')]=_[_0x36f7('0x31')](_0x43830a[_0x36f7('0x32')],_0x43830a[_0x36f7('0x2e')]);_0x4999e5[_0x36f7('0x33')]=_[_0x36f7('0x31')](_0x43830a['model'],qs[_0x36f7('0x34')](_0x532e28['query'][_0x36f7('0x34')]));_0x4999e5[_0x36f7('0x33')]=_0x4999e5[_0x36f7('0x33')][_0x36f7('0x35')]?_0x4999e5[_0x36f7('0x33')]:_0x43830a[_0x36f7('0x32')];if(!_0x532e28[_0x36f7('0x2e')][_0x36f7('0x36')]('nolimit')){_0x4999e5['limit']=qs[_0x36f7('0x1d')](_0x532e28[_0x36f7('0x2e')][_0x36f7('0x1d')]);_0x4999e5[_0x36f7('0x1b')]=qs[_0x36f7('0x1b')](_0x532e28[_0x36f7('0x2e')]['offset']);}_0x4999e5[_0x36f7('0x37')]=qs[_0x36f7('0x38')](_0x532e28[_0x36f7('0x2e')]['sort']);_0x4999e5[_0x36f7('0x39')]=qs['filters'](_['pick'](_0x532e28[_0x36f7('0x2e')],_0x43830a[_0x36f7('0x30')]),_0x2f69d2);if(_0x532e28[_0x36f7('0x2e')][_0x36f7('0x3a')]){_0x4999e5[_0x36f7('0x39')]=_[_0x36f7('0x3b')](_0x4999e5['where'],{'$or':_['map'](_0x2f69d2,function(_0xec058e){if(_0xec058e[_0x36f7('0x2c')]!=='VIRTUAL'){var _0xa527dd={};_0xa527dd[_0xec058e['name']]={'$like':'%'+_0x532e28[_0x36f7('0x2e')]['filter']+'%'};return _0xa527dd;}})});}_0x4999e5=_[_0x36f7('0x3b')]({},_0x4999e5,_0x532e28['options']);var _0x2e1697={'where':_0x4999e5[_0x36f7('0x39')]};return db[_0x36f7('0x29')]['count'](_0x2e1697)['then'](function(_0x440707){_0x5d9f12[_0x36f7('0x1e')]=_0x440707;if(_0x532e28[_0x36f7('0x2e')][_0x36f7('0x3c')]){_0x4999e5[_0x36f7('0x3d')]=[{'all':!![]}];}return db[_0x36f7('0x29')]['findAll'](_0x4999e5);})[_0x36f7('0x24')](function(_0x2202f5){_0x5d9f12[_0x36f7('0x3e')]=_0x2202f5;return _0x5d9f12;})[_0x36f7('0x24')](respondWithFilteredResult(_0x58c898,_0x4999e5))[_0x36f7('0x3f')](handleError(_0x58c898,null));};exports[_0x36f7('0x40')]=function(_0x1a7a3d,_0x28e19b){var _0xd505fd={'raw':!![],'where':{'id':_0x1a7a3d[_0x36f7('0x41')]['id']}},_0x3b39b1={};_0x3b39b1[_0x36f7('0x32')]=_[_0x36f7('0x2f')](db[_0x36f7('0x29')][_0x36f7('0x2a')]);_0x3b39b1[_0x36f7('0x2e')]=_[_0x36f7('0x2f')](_0x1a7a3d['query']);_0x3b39b1[_0x36f7('0x30')]=_[_0x36f7('0x31')](_0x3b39b1[_0x36f7('0x32')],_0x3b39b1['query']);_0xd505fd[_0x36f7('0x33')]=_['intersection'](_0x3b39b1[_0x36f7('0x32')],qs['fields'](_0x1a7a3d[_0x36f7('0x2e')][_0x36f7('0x34')]));_0xd505fd['attributes']=_0xd505fd['attributes'][_0x36f7('0x35')]?_0xd505fd[_0x36f7('0x33')]:_0x3b39b1['model'];if(_0x1a7a3d['query']['includeAll']){_0xd505fd[_0x36f7('0x3d')]=[{'all':!![]}];}_0xd505fd=_[_0x36f7('0x3b')]({},_0xd505fd,_0x1a7a3d['options']);return db['SquareReport']['find'](_0xd505fd)[_0x36f7('0x24')](handleEntityNotFound(_0x28e19b,null))['then'](respondWithResult(_0x28e19b,null))['catch'](handleError(_0x28e19b,null));};exports[_0x36f7('0x42')]=function(_0x1058bb,_0x4574d4){return db['SquareReport'][_0x36f7('0x42')](_0x1058bb[_0x36f7('0x43')],{})[_0x36f7('0x24')](respondWithResult(_0x4574d4,0xc9))['catch'](handleError(_0x4574d4,null));};exports['update']=function(_0x54584f,_0x588184){if(_0x54584f[_0x36f7('0x43')]['id']){delete _0x54584f[_0x36f7('0x43')]['id'];}return db['SquareReport']['find']({'where':{'id':_0x54584f[_0x36f7('0x41')]['id']}})[_0x36f7('0x24')](handleEntityNotFound(_0x588184,null))[_0x36f7('0x24')](saveUpdates(_0x54584f[_0x36f7('0x43')],null))[_0x36f7('0x24')](respondWithResult(_0x588184,null))[_0x36f7('0x3f')](handleError(_0x588184,null));};exports['destroy']=function(_0x139c4d,_0x14afb3){return db[_0x36f7('0x29')][_0x36f7('0x44')]({'where':{'id':_0x139c4d[_0x36f7('0x41')]['id']}})[_0x36f7('0x24')](handleEntityNotFound(_0x14afb3,null))['then'](removeEntity(_0x14afb3,null))[_0x36f7('0x3f')](handleError(_0x14afb3,null));};exports['describe']=function(_0x28ce4f,_0x2b45c4){return db[_0x36f7('0x29')]['describe']()[_0x36f7('0x24')](respondWithResult(_0x2b45c4,null))['catch'](handleError(_0x2b45c4,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 41a1f2b..1ea5569 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 _0x9ad2=['util','../../config/logger','api','moment','path','rimraf','../../config/environment','./squareReport.attributes','exports','define','report_square','uid_pname','uniqueid','project_name','leaveAt','lodash'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x9ad2,0x11f));var _0x29ad=function(_0x5afb89,_0x3ab2e2){_0x5afb89=_0x5afb89-0x0;var _0x4227d0=_0x9ad2[_0x5afb89];return _0x4227d0;};'use strict';var _=require(_0x29ad('0x0'));var util=require(_0x29ad('0x1'));var logger=require(_0x29ad('0x2'))(_0x29ad('0x3'));var moment=require(_0x29ad('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x29ad('0x5'));var rimraf=require(_0x29ad('0x6'));var config=require(_0x29ad('0x7'));var attributes=require(_0x29ad('0x8'));module[_0x29ad('0x9')]=function(_0x107fe5,_0xd49588){return _0x107fe5[_0x29ad('0xa')]('SquareReport',attributes,{'tableName':_0x29ad('0xb'),'paranoid':![],'indexes':[{'name':_0x29ad('0xc'),'fields':[_0x29ad('0xd'),_0x29ad('0xe')]},{'name':_0x29ad('0xf'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file +var _0xedae=['util','../../config/logger','moment','bluebird','request-promise','../../config/environment','exports','report_square','uid_pname','project_name','leaveAt','lodash'];(function(_0x101ccf,_0x37e172){var _0x99b0f1=function(_0x4111c8){while(--_0x4111c8){_0x101ccf['push'](_0x101ccf['shift']());}};_0x99b0f1(++_0x37e172);}(_0xedae,0xa7));var _0xeeda=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xedae[_0x2576d7];return _0x16a08c;};'use strict';var _=require(_0xeeda('0x0'));var util=require(_0xeeda('0x1'));var logger=require(_0xeeda('0x2'))('api');var moment=require(_0xeeda('0x3'));var BPromise=require(_0xeeda('0x4'));var rp=require(_0xeeda('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xeeda('0x6'));var attributes=require('./squareReport.attributes');module[_0xeeda('0x7')]=function(_0x12b4aa,_0x35d1a7){return _0x12b4aa['define']('SquareReport',attributes,{'tableName':_0xeeda('0x8'),'paranoid':![],'indexes':[{'name':_0xeeda('0x9'),'fields':['uniqueid',_0xeeda('0xa')]},{'name':_0xeeda('0xb'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 7b4eec8..0df00f7 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 _0xccfd=['UpdateSquareReport','SquareReport','body','where','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','create','options','raw','CreateSquareReport'];(function(_0x5ccb33,_0xa4bcbe){var _0x4c1db8=function(_0x195494){while(--_0x195494){_0x5ccb33['push'](_0x5ccb33['shift']());}};_0x4c1db8(++_0xa4bcbe);}(_0xccfd,0xf3));var _0xdccf=function(_0x942433,_0x22c9e4){_0x942433=_0x942433-0x0;var _0x2b3cd3=_0xccfd[_0x942433];return _0x2b3cd3;};'use strict';var _=require(_0xdccf('0x0'));var util=require(_0xdccf('0x1'));var moment=require(_0xdccf('0x2'));var BPromise=require(_0xdccf('0x3'));var rs=require(_0xdccf('0x4'));var fs=require('fs');var Redis=require(_0xdccf('0x5'));var db=require(_0xdccf('0x6'))['db'];var utils=require(_0xdccf('0x7'));var logger=require(_0xdccf('0x8'))(_0xdccf('0x9'));var config=require(_0xdccf('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xdccf('0xb')][_0xdccf('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1d4ee5,_0x4a85a2,_0x5524ec){return new BPromise(function(_0x1569cb,_0x5e45fa){return client[_0xdccf('0xd')](_0x1d4ee5,_0x5524ec)[_0xdccf('0xe')](function(_0xefd5b5){logger['info'](_0xdccf('0xf'),_0x4a85a2,_0xdccf('0x10'));logger[_0xdccf('0x11')](_0xdccf('0x12'),_0x4a85a2,_0xdccf('0x10'),JSON[_0xdccf('0x13')](_0xefd5b5));if(_0xefd5b5['error']){if(_0xefd5b5[_0xdccf('0x14')][_0xdccf('0x15')]===0x1f4){logger[_0xdccf('0x14')](_0xdccf('0xf'),_0x4a85a2,_0xefd5b5[_0xdccf('0x14')][_0xdccf('0x16')]);return _0x5e45fa(_0xefd5b5[_0xdccf('0x14')]['message']);}logger[_0xdccf('0x14')]('SquareReport,\x20%s,\x20%s',_0x4a85a2,_0xefd5b5[_0xdccf('0x14')]['message']);return _0x1569cb(_0xefd5b5[_0xdccf('0x14')][_0xdccf('0x16')]);}else{logger[_0xdccf('0x17')](_0xdccf('0xf'),_0x4a85a2,'request\x20sent');_0x1569cb(_0xefd5b5[_0xdccf('0x18')][_0xdccf('0x16')]);}})['catch'](function(_0x44db24){logger[_0xdccf('0x14')](_0xdccf('0xf'),_0x4a85a2,_0x44db24);_0x5e45fa(_0x44db24);});});}exports['CreateSquareReport']=function(_0x3e7e1b){var _0x584f26=this;return new Promise(function(_0x572148,_0x29fb04){return db['SquareReport'][_0xdccf('0x19')](_0x3e7e1b['body'],{'raw':_0x3e7e1b[_0xdccf('0x1a')]?_0x3e7e1b[_0xdccf('0x1a')][_0xdccf('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x4690bc){logger[_0xdccf('0x17')](_0xdccf('0x1c'),_0x3e7e1b);logger[_0xdccf('0x11')](_0xdccf('0x1c'),_0x3e7e1b,JSON[_0xdccf('0x13')](_0x4690bc));_0x572148(_0x4690bc);})['catch'](function(_0x2e869b){logger[_0xdccf('0x14')](_0xdccf('0x1c'),_0x2e869b[_0xdccf('0x16')],_0x3e7e1b);_0x29fb04(_0x584f26[_0xdccf('0x14')](0x1f4,_0x2e869b['message']));});});};exports[_0xdccf('0x1d')]=function(_0x764aa2){var _0x5e2ea0=this;return new Promise(function(_0x562175,_0x30fa81){return db[_0xdccf('0x1e')]['update'](_0x764aa2[_0xdccf('0x1f')],{'raw':_0x764aa2[_0xdccf('0x1a')]?_0x764aa2[_0xdccf('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x764aa2[_0xdccf('0x1a')]?_0x764aa2['options'][_0xdccf('0x20')]||null:null,'attributes':_0x764aa2[_0xdccf('0x1a')]?_0x764aa2[_0xdccf('0x1a')]['attributes']||null:null,'limit':_0x764aa2[_0xdccf('0x1a')]?_0x764aa2[_0xdccf('0x1a')]['limit']||null:null})['then'](function(_0x4f66e5){logger[_0xdccf('0x17')](_0xdccf('0x1d'),_0x764aa2);logger['debug']('UpdateSquareReport',_0x764aa2,JSON[_0xdccf('0x13')](_0x4f66e5));_0x562175(_0x4f66e5);})[_0xdccf('0x21')](function(_0x37f69f){logger[_0xdccf('0x14')](_0xdccf('0x1d'),_0x37f69f[_0xdccf('0x16')],_0x764aa2);_0x30fa81(_0x5e2ea0['error'](0x1f4,_0x37f69f['message']));});});}; \ No newline at end of file +var _0xd65e=['UpdateSquareReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','SquareReport,\x20%s,\x20%s','SquareReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','CreateSquareReport','SquareReport','create','options','debug','catch','update','body','limit'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xd65e,0xc1));var _0xed65=function(_0x3f827a,_0x93c7d9){_0x3f827a=_0x3f827a-0x0;var _0x193b12=_0xd65e[_0x3f827a];return _0x193b12;};'use strict';var _=require(_0xed65('0x0'));var util=require(_0xed65('0x1'));var moment=require(_0xed65('0x2'));var BPromise=require(_0xed65('0x3'));var rs=require(_0xed65('0x4'));var fs=require('fs');var Redis=require(_0xed65('0x5'));var db=require(_0xed65('0x6'))['db'];var utils=require(_0xed65('0x7'));var logger=require(_0xed65('0x8'))(_0xed65('0x9'));var config=require('../../config/environment');var jayson=require(_0xed65('0xa'));var client=jayson[_0xed65('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41f913,_0x4a2b82,_0x1ec23f){return new BPromise(function(_0x681486,_0x231b5f){return client[_0xed65('0xc')](_0x41f913,_0x1ec23f)[_0xed65('0xd')](function(_0x119db9){logger[_0xed65('0xe')](_0xed65('0xf'),_0x4a2b82,'request\x20sent');logger['debug'](_0xed65('0x10'),_0x4a2b82,_0xed65('0x11'),JSON[_0xed65('0x12')](_0x119db9));if(_0x119db9[_0xed65('0x13')]){if(_0x119db9[_0xed65('0x13')][_0xed65('0x14')]===0x1f4){logger[_0xed65('0x13')]('SquareReport,\x20%s,\x20%s',_0x4a2b82,_0x119db9[_0xed65('0x13')]['message']);return _0x231b5f(_0x119db9[_0xed65('0x13')]['message']);}logger[_0xed65('0x13')](_0xed65('0xf'),_0x4a2b82,_0x119db9[_0xed65('0x13')][_0xed65('0x15')]);return _0x681486(_0x119db9[_0xed65('0x13')][_0xed65('0x15')]);}else{logger[_0xed65('0xe')](_0xed65('0xf'),_0x4a2b82,_0xed65('0x11'));_0x681486(_0x119db9['result'][_0xed65('0x15')]);}})['catch'](function(_0x139608){logger[_0xed65('0x13')](_0xed65('0xf'),_0x4a2b82,_0x139608);_0x231b5f(_0x139608);});});}exports[_0xed65('0x16')]=function(_0x5bffb7){var _0x5594dc=this;return new Promise(function(_0x1e4f15,_0x53ec19){return db[_0xed65('0x17')][_0xed65('0x18')](_0x5bffb7['body'],{'raw':_0x5bffb7[_0xed65('0x19')]?_0x5bffb7[_0xed65('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xed65('0xd')](function(_0x2dc0f7){logger[_0xed65('0xe')]('CreateSquareReport',_0x5bffb7);logger[_0xed65('0x1a')](_0xed65('0x16'),_0x5bffb7,JSON['stringify'](_0x2dc0f7));_0x1e4f15(_0x2dc0f7);})[_0xed65('0x1b')](function(_0x13b9b7){logger[_0xed65('0x13')](_0xed65('0x16'),_0x13b9b7[_0xed65('0x15')],_0x5bffb7);_0x53ec19(_0x5594dc[_0xed65('0x13')](0x1f4,_0x13b9b7[_0xed65('0x15')]));});});};exports['UpdateSquareReport']=function(_0x4813c6){var _0x38d223=this;return new Promise(function(_0x36cb56,_0x1a83b6){return db[_0xed65('0x17')][_0xed65('0x1c')](_0x4813c6[_0xed65('0x1d')],{'raw':_0x4813c6[_0xed65('0x19')]?_0x4813c6[_0xed65('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4813c6[_0xed65('0x19')]?_0x4813c6['options']['where']||null:null,'attributes':_0x4813c6[_0xed65('0x19')]?_0x4813c6[_0xed65('0x19')]['attributes']||null:null,'limit':_0x4813c6[_0xed65('0x19')]?_0x4813c6[_0xed65('0x19')][_0xed65('0x1e')]||null:null})[_0xed65('0xd')](function(_0x5c7e3d){logger[_0xed65('0xe')]('UpdateSquareReport',_0x4813c6);logger[_0xed65('0x1a')](_0xed65('0x1f'),_0x4813c6,JSON['stringify'](_0x5c7e3d));_0x36cb56(_0x5c7e3d);})['catch'](function(_0x3c9d48){logger[_0xed65('0x13')](_0xed65('0x1f'),_0x3c9d48[_0xed65('0x15')],_0x4813c6);_0x1a83b6(_0x38d223[_0xed65('0x13')](0x1f4,_0x3c9d48[_0xed65('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 5707c57..887e7cf 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 _0xa32a=['delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update'];(function(_0x494d1f,_0x3f72ff){var _0x457b6e=function(_0x38cb16){while(--_0x38cb16){_0x494d1f['push'](_0x494d1f['shift']());}};_0x457b6e(++_0x3f72ff);}(_0xa32a,0x162));var _0xaa32=function(_0x380e75,_0x486360){_0x380e75=_0x380e75-0x0;var _0x444d96=_0xa32a[_0x380e75];return _0x444d96;};'use strict';var multer=require(_0xaa32('0x0'));var util=require(_0xaa32('0x1'));var path=require(_0xaa32('0x2'));var timeout=require(_0xaa32('0x3'));var express=require('express');var router=express[_0xaa32('0x4')]();var fs_extra=require(_0xaa32('0x5'));var auth=require(_0xaa32('0x6'));var interaction=require(_0xaa32('0x7'));var config=require(_0xaa32('0x8'));var controller=require(_0xaa32('0x9'));router[_0xaa32('0xa')]('/',auth[_0xaa32('0xb')](),controller[_0xaa32('0xc')]);router['get']('/describe',auth[_0xaa32('0xb')](),controller[_0xaa32('0xd')]);router[_0xaa32('0xa')](_0xaa32('0xe'),auth['isAuthenticated'](),controller[_0xaa32('0xf')]);router[_0xaa32('0x10')]('/',auth[_0xaa32('0xb')](),controller[_0xaa32('0x11')]);router[_0xaa32('0x12')](_0xaa32('0xe'),auth[_0xaa32('0xb')](),controller[_0xaa32('0x13')]);router[_0xaa32('0x14')](_0xaa32('0xe'),auth['isAuthenticated'](),controller[_0xaa32('0x15')]);module['exports']=router; \ No newline at end of file +var _0x1baf=['isAuthenticated','describe','/:id','show','post','create','delete','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','index','get','/describe'];(function(_0x44ecb1,_0x5d40bf){var _0x4e4813=function(_0x319192){while(--_0x319192){_0x44ecb1['push'](_0x44ecb1['shift']());}};_0x4e4813(++_0x5d40bf);}(_0x1baf,0x1e8));var _0xf1ba=function(_0x30ba6d,_0x3cee0a){_0x30ba6d=_0x30ba6d-0x0;var _0x3311a7=_0x1baf[_0x30ba6d];return _0x3311a7;};'use strict';var multer=require(_0xf1ba('0x0'));var util=require('util');var path=require(_0xf1ba('0x1'));var timeout=require(_0xf1ba('0x2'));var express=require(_0xf1ba('0x3'));var router=express['Router']();var fs_extra=require(_0xf1ba('0x4'));var auth=require(_0xf1ba('0x5'));var interaction=require(_0xf1ba('0x6'));var config=require(_0xf1ba('0x7'));var controller=require(_0xf1ba('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xf1ba('0x9')]);router[_0xf1ba('0xa')](_0xf1ba('0xb'),auth[_0xf1ba('0xc')](),controller[_0xf1ba('0xd')]);router[_0xf1ba('0xa')](_0xf1ba('0xe'),auth['isAuthenticated'](),controller[_0xf1ba('0xf')]);router[_0xf1ba('0x10')]('/',auth['isAuthenticated'](),controller[_0xf1ba('0x11')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xf1ba('0x12')](_0xf1ba('0xe'),auth[_0xf1ba('0xc')](),controller[_0xf1ba('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 78c2c50..6a7f4e5 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 _0x91c4=['TEXT','sequelize','exports','STRING'];(function(_0x5c7897,_0x38e918){var _0x117844=function(_0x21ca66){while(--_0x21ca66){_0x5c7897['push'](_0x5c7897['shift']());}};_0x117844(++_0x38e918);}(_0x91c4,0x141));var _0x491c=function(_0x2622f8,_0x1b9573){_0x2622f8=_0x2622f8-0x0;var _0x526b59=_0x91c4[_0x2622f8];return _0x526b59;};'use strict';var Sequelize=require(_0x491c('0x0'));module[_0x491c('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0x491c('0x2')]},'application':{'type':Sequelize[_0x491c('0x2')]},'data':{'type':Sequelize[_0x491c('0x3')]},'project_name':{'type':Sequelize[_0x491c('0x2')]},'callerid':{'type':Sequelize[_0x491c('0x2')]}}; \ No newline at end of file +var _0x5ab3=['STRING','TEXT','sequelize','exports'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x5ab3,0x1de));var _0x35ab=function(_0x282a29,_0x4fd08b){_0x282a29=_0x282a29-0x0;var _0x2bfc2c=_0x5ab3[_0x282a29];return _0x2bfc2c;};'use strict';var Sequelize=require(_0x35ab('0x0'));module[_0x35ab('0x1')]={'uniqueid':{'type':Sequelize[_0x35ab('0x2')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0x35ab('0x3')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 9b09151..78f927c 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 _0xe796=['describe','zip-dir','fast-json-patch','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','index','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','filter','where','merge','options','includeAll','include','SquareDetailsReport','findAll','catch','show','params','length','find','create','body'];(function(_0x4ad1aa,_0x42bade){var _0x37465c=function(_0x10d23b){while(--_0x10d23b){_0x4ad1aa['push'](_0x4ad1aa['shift']());}};_0x37465c(++_0x42bade);}(_0xe796,0xdc));var _0x6e79=function(_0xb5338d,_0x332e87){_0xb5338d=_0xb5338d-0x0;var _0x11f17a=_0xe796[_0xb5338d];return _0x11f17a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6e79('0x0'));var jsonpatch=require(_0x6e79('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6e79('0x2'));var util=require('util');var path=require(_0x6e79('0x3'));var sox=require(_0x6e79('0x4'));var csv=require(_0x6e79('0x5'));var ejs=require(_0x6e79('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6e79('0x7'));var squel=require(_0x6e79('0x8'));var crypto=require(_0x6e79('0x9'));var jsforce=require(_0x6e79('0xa'));var deskjs=require(_0x6e79('0xb'));var toCsv=require(_0x6e79('0x5'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6e79('0xc'));var authService=require(_0x6e79('0xd'));var qs=require(_0x6e79('0xe'));var as=require(_0x6e79('0xf'));var hardwareService=require(_0x6e79('0x10'));var logger=require(_0x6e79('0x11'))(_0x6e79('0x12'));var utils=require(_0x6e79('0x13'));var config=require(_0x6e79('0x14'));var licenseUtil=require(_0x6e79('0x15'));var db=require(_0x6e79('0x16'))['db'];function respondWithStatusCode(_0x2477ab,_0x55dd49){_0x55dd49=_0x55dd49||0xcc;return function(_0x14ba6f){if(_0x14ba6f){return _0x2477ab[_0x6e79('0x17')](_0x55dd49);}return _0x2477ab[_0x6e79('0x18')](_0x55dd49)['end']();};}function respondWithResult(_0x1cac7c,_0x3fccaa){_0x3fccaa=_0x3fccaa||0xc8;return function(_0x4d103c){if(_0x4d103c){return _0x1cac7c[_0x6e79('0x18')](_0x3fccaa)[_0x6e79('0x19')](_0x4d103c);}};}function respondWithFilteredResult(_0x560c0c,_0x5389fa){return function(_0x4bbcb6){if(_0x4bbcb6){var _0x5cdaf1=typeof _0x5389fa[_0x6e79('0x1a')]===_0x6e79('0x1b')&&typeof _0x5389fa[_0x6e79('0x1c')]==='undefined';var _0x3cd774=_0x4bbcb6[_0x6e79('0x1d')];var _0x28b90a=_0x5cdaf1?0x0:_0x5389fa[_0x6e79('0x1a')];var _0x595975=_0x5cdaf1?_0x4bbcb6['count']:_0x5389fa[_0x6e79('0x1a')]+_0x5389fa[_0x6e79('0x1c')];var _0x4c57c5;if(_0x595975>=_0x3cd774){_0x595975=_0x3cd774;_0x4c57c5=0xc8;}else{_0x4c57c5=0xce;}_0x560c0c[_0x6e79('0x18')](_0x4c57c5);return _0x560c0c['set'](_0x6e79('0x1e'),_0x28b90a+'-'+_0x595975+'/'+_0x3cd774)['json'](_0x4bbcb6);}return null;};}function patchUpdates(_0xdf0a80){return function(_0x3ae275){try{jsonpatch[_0x6e79('0x1f')](_0x3ae275,_0xdf0a80,!![]);}catch(_0x7b4270){return BPromise[_0x6e79('0x20')](_0x7b4270);}return _0x3ae275[_0x6e79('0x21')]();};}function saveUpdates(_0x42ba27,_0x457149){return function(_0x3f5103){if(_0x3f5103){return _0x3f5103[_0x6e79('0x22')](_0x42ba27)[_0x6e79('0x23')](function(_0x4d860b){return _0x4d860b;});}return null;};}function removeEntity(_0x34f9dd,_0x461ce4){return function(_0x51dc47){if(_0x51dc47){return _0x51dc47[_0x6e79('0x24')]()['then'](function(){_0x34f9dd[_0x6e79('0x18')](0xcc)[_0x6e79('0x25')]();});}};}function handleEntityNotFound(_0x1961d1,_0x592469){return function(_0x121893){if(!_0x121893){_0x1961d1[_0x6e79('0x17')](0x194);}return _0x121893;};}function handleError(_0x44469f,_0x4aef33){_0x4aef33=_0x4aef33||0x1f4;return function(_0x114156){logger['error'](_0x114156[_0x6e79('0x26')]);if(_0x114156[_0x6e79('0x27')]){delete _0x114156[_0x6e79('0x27')];}_0x44469f[_0x6e79('0x18')](_0x4aef33)[_0x6e79('0x28')](_0x114156);};}exports[_0x6e79('0x29')]=function(_0x3584e3,_0x3060db){var _0x185907={},_0x4df24e={},_0x1c55a3={'count':0x0,'rows':[]};var _0x33d34d=_['map'](db['SquareDetailsReport'][_0x6e79('0x2a')],function(_0x27fc59){return{'name':_0x27fc59[_0x6e79('0x2b')],'type':_0x27fc59[_0x6e79('0x2c')]['key']};});_0x4df24e[_0x6e79('0x2d')]=_[_0x6e79('0x2e')](_0x33d34d,_0x6e79('0x27'));_0x4df24e[_0x6e79('0x2f')]=_[_0x6e79('0x30')](_0x3584e3[_0x6e79('0x2f')]);_0x4df24e[_0x6e79('0x31')]=_[_0x6e79('0x32')](_0x4df24e[_0x6e79('0x2d')],_0x4df24e[_0x6e79('0x2f')]);_0x185907['attributes']=_['intersection'](_0x4df24e[_0x6e79('0x2d')],qs[_0x6e79('0x33')](_0x3584e3[_0x6e79('0x2f')]['fields']));_0x185907['attributes']=_0x185907[_0x6e79('0x34')]['length']?_0x185907['attributes']:_0x4df24e[_0x6e79('0x2d')];if(!_0x3584e3[_0x6e79('0x2f')][_0x6e79('0x35')](_0x6e79('0x36'))){_0x185907[_0x6e79('0x1c')]=qs['limit'](_0x3584e3[_0x6e79('0x2f')]['limit']);_0x185907[_0x6e79('0x1a')]=qs[_0x6e79('0x1a')](_0x3584e3[_0x6e79('0x2f')][_0x6e79('0x1a')]);}_0x185907[_0x6e79('0x37')]=qs[_0x6e79('0x38')](_0x3584e3[_0x6e79('0x2f')][_0x6e79('0x38')]);_0x185907['where']=qs[_0x6e79('0x31')](_['pick'](_0x3584e3[_0x6e79('0x2f')],_0x4df24e['filters']),_0x33d34d);if(_0x3584e3[_0x6e79('0x2f')][_0x6e79('0x39')]){_0x185907['where']=_['merge'](_0x185907[_0x6e79('0x3a')],{'$or':_[_0x6e79('0x2e')](_0x33d34d,function(_0x20d300){if(_0x20d300[_0x6e79('0x2c')]!=='VIRTUAL'){var _0x59eabe={};_0x59eabe[_0x20d300[_0x6e79('0x27')]]={'$like':'%'+_0x3584e3[_0x6e79('0x2f')][_0x6e79('0x39')]+'%'};return _0x59eabe;}})});}_0x185907=_[_0x6e79('0x3b')]({},_0x185907,_0x3584e3[_0x6e79('0x3c')]);var _0x10facd={'where':_0x185907['where']};return db['SquareDetailsReport']['count'](_0x10facd)['then'](function(_0x93cf74){_0x1c55a3['count']=_0x93cf74;if(_0x3584e3[_0x6e79('0x2f')][_0x6e79('0x3d')]){_0x185907[_0x6e79('0x3e')]=[{'all':!![]}];}return db[_0x6e79('0x3f')][_0x6e79('0x40')](_0x185907);})['then'](function(_0x4b06ac){_0x1c55a3['rows']=_0x4b06ac;return _0x1c55a3;})['then'](respondWithFilteredResult(_0x3060db,_0x185907))[_0x6e79('0x41')](handleError(_0x3060db,null));};exports[_0x6e79('0x42')]=function(_0x45693f,_0x26fbe4){var _0xf083f0={'raw':!![],'where':{'id':_0x45693f[_0x6e79('0x43')]['id']}},_0x39f10c={};_0x39f10c[_0x6e79('0x2d')]=_[_0x6e79('0x30')](db[_0x6e79('0x3f')]['rawAttributes']);_0x39f10c['query']=_['keys'](_0x45693f[_0x6e79('0x2f')]);_0x39f10c[_0x6e79('0x31')]=_[_0x6e79('0x32')](_0x39f10c['model'],_0x39f10c[_0x6e79('0x2f')]);_0xf083f0[_0x6e79('0x34')]=_[_0x6e79('0x32')](_0x39f10c[_0x6e79('0x2d')],qs[_0x6e79('0x33')](_0x45693f[_0x6e79('0x2f')]['fields']));_0xf083f0[_0x6e79('0x34')]=_0xf083f0[_0x6e79('0x34')][_0x6e79('0x44')]?_0xf083f0['attributes']:_0x39f10c[_0x6e79('0x2d')];if(_0x45693f[_0x6e79('0x2f')]['includeAll']){_0xf083f0[_0x6e79('0x3e')]=[{'all':!![]}];}_0xf083f0=_[_0x6e79('0x3b')]({},_0xf083f0,_0x45693f[_0x6e79('0x3c')]);return db[_0x6e79('0x3f')][_0x6e79('0x45')](_0xf083f0)[_0x6e79('0x23')](handleEntityNotFound(_0x26fbe4,null))['then'](respondWithResult(_0x26fbe4,null))[_0x6e79('0x41')](handleError(_0x26fbe4,null));};exports[_0x6e79('0x46')]=function(_0x387aff,_0x54a69f){return db[_0x6e79('0x3f')][_0x6e79('0x46')](_0x387aff[_0x6e79('0x47')],{})['then'](respondWithResult(_0x54a69f,0xc9))['catch'](handleError(_0x54a69f,null));};exports[_0x6e79('0x22')]=function(_0x4ca4b2,_0x4e57c1){if(_0x4ca4b2[_0x6e79('0x47')]['id']){delete _0x4ca4b2[_0x6e79('0x47')]['id'];}return db['SquareDetailsReport'][_0x6e79('0x45')]({'where':{'id':_0x4ca4b2[_0x6e79('0x43')]['id']}})['then'](handleEntityNotFound(_0x4e57c1,null))[_0x6e79('0x23')](saveUpdates(_0x4ca4b2[_0x6e79('0x47')],null))[_0x6e79('0x23')](respondWithResult(_0x4e57c1,null))[_0x6e79('0x41')](handleError(_0x4e57c1,null));};exports[_0x6e79('0x24')]=function(_0x47ecfb,_0x1fb4a1){return db[_0x6e79('0x3f')][_0x6e79('0x45')]({'where':{'id':_0x47ecfb[_0x6e79('0x43')]['id']}})[_0x6e79('0x23')](handleEntityNotFound(_0x1fb4a1,null))['then'](removeEntity(_0x1fb4a1,null))[_0x6e79('0x41')](handleError(_0x1fb4a1,null));};exports[_0x6e79('0x48')]=function(_0x186a51,_0x13b110){return db[_0x6e79('0x3f')]['describe']()[_0x6e79('0x23')](respondWithResult(_0x13b110,null))['catch'](handleError(_0x13b110,null));}; \ No newline at end of file +var _0xe39b=['set','Content-Range','reject','save','update','then','destroy','error','stack','name','index','map','SquareDetailsReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','params','find','create','body','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count'];(function(_0xfeb825,_0x187462){var _0x328b41=function(_0x7c096e){while(--_0x7c096e){_0xfeb825['push'](_0xfeb825['shift']());}};_0x328b41(++_0x187462);}(_0xe39b,0xf8));var _0xbe39=function(_0x50ded7,_0x1aa5e2){_0x50ded7=_0x50ded7-0x0;var _0x46f377=_0xe39b[_0x50ded7];return _0x46f377;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbe39('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbe39('0x1'));var rp=require(_0xbe39('0x2'));var moment=require(_0xbe39('0x3'));var BPromise=require(_0xbe39('0x4'));var Mustache=require(_0xbe39('0x5'));var util=require('util');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(_0xbe39('0x6'));var _=require(_0xbe39('0x7'));var squel=require('squel');var crypto=require(_0xbe39('0x8'));var jsforce=require('jsforce');var deskjs=require(_0xbe39('0x9'));var toCsv=require('to-csv');var querystring=require(_0xbe39('0xa'));var Papa=require(_0xbe39('0xb'));var Redis=require(_0xbe39('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xbe39('0xd'));var as=require(_0xbe39('0xe'));var hardwareService=require(_0xbe39('0xf'));var logger=require(_0xbe39('0x10'))(_0xbe39('0x11'));var utils=require('../../config/utils');var config=require(_0xbe39('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xbe39('0x13'))['db'];function respondWithStatusCode(_0x43ba5e,_0x2a8228){_0x2a8228=_0x2a8228||0xcc;return function(_0x3f1125){if(_0x3f1125){return _0x43ba5e[_0xbe39('0x14')](_0x2a8228);}return _0x43ba5e[_0xbe39('0x15')](_0x2a8228)[_0xbe39('0x16')]();};}function respondWithResult(_0x44a6d0,_0x14d0f4){_0x14d0f4=_0x14d0f4||0xc8;return function(_0x53c384){if(_0x53c384){return _0x44a6d0['status'](_0x14d0f4)[_0xbe39('0x17')](_0x53c384);}};}function respondWithFilteredResult(_0x2b24e1,_0x7d860e){return function(_0x326eef){if(_0x326eef){var _0x34b839=typeof _0x7d860e[_0xbe39('0x18')]===_0xbe39('0x19')&&typeof _0x7d860e[_0xbe39('0x1a')]===_0xbe39('0x19');var _0x3ed99d=_0x326eef['count'];var _0x3cf5da=_0x34b839?0x0:_0x7d860e[_0xbe39('0x18')];var _0x2a8075=_0x34b839?_0x326eef[_0xbe39('0x1b')]:_0x7d860e[_0xbe39('0x18')]+_0x7d860e[_0xbe39('0x1a')];var _0x5d9265;if(_0x2a8075>=_0x3ed99d){_0x2a8075=_0x3ed99d;_0x5d9265=0xc8;}else{_0x5d9265=0xce;}_0x2b24e1[_0xbe39('0x15')](_0x5d9265);return _0x2b24e1[_0xbe39('0x1c')](_0xbe39('0x1d'),_0x3cf5da+'-'+_0x2a8075+'/'+_0x3ed99d)[_0xbe39('0x17')](_0x326eef);}return null;};}function patchUpdates(_0x1a6f71){return function(_0x417b96){try{jsonpatch['apply'](_0x417b96,_0x1a6f71,!![]);}catch(_0x3714c6){return BPromise[_0xbe39('0x1e')](_0x3714c6);}return _0x417b96[_0xbe39('0x1f')]();};}function saveUpdates(_0x23b54a,_0x4416f0){return function(_0x3bfbd3){if(_0x3bfbd3){return _0x3bfbd3[_0xbe39('0x20')](_0x23b54a)[_0xbe39('0x21')](function(_0x5ee48e){return _0x5ee48e;});}return null;};}function removeEntity(_0x376960,_0x5c080){return function(_0x2dde9a){if(_0x2dde9a){return _0x2dde9a[_0xbe39('0x22')]()[_0xbe39('0x21')](function(){_0x376960[_0xbe39('0x15')](0xcc)[_0xbe39('0x16')]();});}};}function handleEntityNotFound(_0x218715,_0xb34218){return function(_0xeeb5f9){if(!_0xeeb5f9){_0x218715[_0xbe39('0x14')](0x194);}return _0xeeb5f9;};}function handleError(_0x167bb0,_0x40e989){_0x40e989=_0x40e989||0x1f4;return function(_0x59c0a8){logger[_0xbe39('0x23')](_0x59c0a8[_0xbe39('0x24')]);if(_0x59c0a8[_0xbe39('0x25')]){delete _0x59c0a8[_0xbe39('0x25')];}_0x167bb0['status'](_0x40e989)['send'](_0x59c0a8);};}exports[_0xbe39('0x26')]=function(_0x269348,_0x5d5732){var _0x4fb413={},_0x650bb9={},_0x4d8beb={'count':0x0,'rows':[]};var _0x373713=_[_0xbe39('0x27')](db[_0xbe39('0x28')][_0xbe39('0x29')],function(_0x3f2f67){return{'name':_0x3f2f67[_0xbe39('0x2a')],'type':_0x3f2f67[_0xbe39('0x2b')]['key']};});_0x650bb9[_0xbe39('0x2c')]=_[_0xbe39('0x27')](_0x373713,_0xbe39('0x25'));_0x650bb9[_0xbe39('0x2d')]=_[_0xbe39('0x2e')](_0x269348[_0xbe39('0x2d')]);_0x650bb9[_0xbe39('0x2f')]=_[_0xbe39('0x30')](_0x650bb9[_0xbe39('0x2c')],_0x650bb9[_0xbe39('0x2d')]);_0x4fb413[_0xbe39('0x31')]=_['intersection'](_0x650bb9['model'],qs[_0xbe39('0x32')](_0x269348[_0xbe39('0x2d')][_0xbe39('0x32')]));_0x4fb413[_0xbe39('0x31')]=_0x4fb413[_0xbe39('0x31')][_0xbe39('0x33')]?_0x4fb413[_0xbe39('0x31')]:_0x650bb9[_0xbe39('0x2c')];if(!_0x269348[_0xbe39('0x2d')]['hasOwnProperty'](_0xbe39('0x34'))){_0x4fb413[_0xbe39('0x1a')]=qs[_0xbe39('0x1a')](_0x269348[_0xbe39('0x2d')][_0xbe39('0x1a')]);_0x4fb413[_0xbe39('0x18')]=qs['offset'](_0x269348['query'][_0xbe39('0x18')]);}_0x4fb413['order']=qs[_0xbe39('0x35')](_0x269348[_0xbe39('0x2d')]['sort']);_0x4fb413['where']=qs[_0xbe39('0x2f')](_[_0xbe39('0x36')](_0x269348[_0xbe39('0x2d')],_0x650bb9['filters']),_0x373713);if(_0x269348[_0xbe39('0x2d')][_0xbe39('0x37')]){_0x4fb413[_0xbe39('0x38')]=_[_0xbe39('0x39')](_0x4fb413['where'],{'$or':_[_0xbe39('0x27')](_0x373713,function(_0x4af538){if(_0x4af538[_0xbe39('0x2b')]!==_0xbe39('0x3a')){var _0x13e60f={};_0x13e60f[_0x4af538[_0xbe39('0x25')]]={'$like':'%'+_0x269348[_0xbe39('0x2d')][_0xbe39('0x37')]+'%'};return _0x13e60f;}})});}_0x4fb413=_['merge']({},_0x4fb413,_0x269348[_0xbe39('0x3b')]);var _0x1ccc61={'where':_0x4fb413['where']};return db['SquareDetailsReport'][_0xbe39('0x1b')](_0x1ccc61)[_0xbe39('0x21')](function(_0x386582){_0x4d8beb[_0xbe39('0x1b')]=_0x386582;if(_0x269348[_0xbe39('0x2d')][_0xbe39('0x3c')]){_0x4fb413[_0xbe39('0x3d')]=[{'all':!![]}];}return db[_0xbe39('0x28')]['findAll'](_0x4fb413);})[_0xbe39('0x21')](function(_0x2835d9){_0x4d8beb[_0xbe39('0x3e')]=_0x2835d9;return _0x4d8beb;})[_0xbe39('0x21')](respondWithFilteredResult(_0x5d5732,_0x4fb413))[_0xbe39('0x3f')](handleError(_0x5d5732,null));};exports['show']=function(_0x3349ed,_0x2a485f){var _0x58c0ed={'raw':!![],'where':{'id':_0x3349ed[_0xbe39('0x40')]['id']}},_0x25a23d={};_0x25a23d[_0xbe39('0x2c')]=_['keys'](db['SquareDetailsReport'][_0xbe39('0x29')]);_0x25a23d['query']=_[_0xbe39('0x2e')](_0x3349ed[_0xbe39('0x2d')]);_0x25a23d[_0xbe39('0x2f')]=_['intersection'](_0x25a23d[_0xbe39('0x2c')],_0x25a23d[_0xbe39('0x2d')]);_0x58c0ed[_0xbe39('0x31')]=_[_0xbe39('0x30')](_0x25a23d[_0xbe39('0x2c')],qs[_0xbe39('0x32')](_0x3349ed[_0xbe39('0x2d')][_0xbe39('0x32')]));_0x58c0ed['attributes']=_0x58c0ed['attributes'][_0xbe39('0x33')]?_0x58c0ed[_0xbe39('0x31')]:_0x25a23d['model'];if(_0x3349ed[_0xbe39('0x2d')][_0xbe39('0x3c')]){_0x58c0ed[_0xbe39('0x3d')]=[{'all':!![]}];}_0x58c0ed=_[_0xbe39('0x39')]({},_0x58c0ed,_0x3349ed['options']);return db[_0xbe39('0x28')][_0xbe39('0x41')](_0x58c0ed)[_0xbe39('0x21')](handleEntityNotFound(_0x2a485f,null))['then'](respondWithResult(_0x2a485f,null))[_0xbe39('0x3f')](handleError(_0x2a485f,null));};exports['create']=function(_0x2a55df,_0x2a5501){return db[_0xbe39('0x28')][_0xbe39('0x42')](_0x2a55df['body'],{})[_0xbe39('0x21')](respondWithResult(_0x2a5501,0xc9))['catch'](handleError(_0x2a5501,null));};exports['update']=function(_0x354a65,_0x9f6c17){if(_0x354a65[_0xbe39('0x43')]['id']){delete _0x354a65['body']['id'];}return db[_0xbe39('0x28')][_0xbe39('0x41')]({'where':{'id':_0x354a65['params']['id']}})[_0xbe39('0x21')](handleEntityNotFound(_0x9f6c17,null))['then'](saveUpdates(_0x354a65['body'],null))[_0xbe39('0x21')](respondWithResult(_0x9f6c17,null))[_0xbe39('0x3f')](handleError(_0x9f6c17,null));};exports['destroy']=function(_0x1fd933,_0x5480ef){return db['SquareDetailsReport'][_0xbe39('0x41')]({'where':{'id':_0x1fd933[_0xbe39('0x40')]['id']}})[_0xbe39('0x21')](handleEntityNotFound(_0x5480ef,null))['then'](removeEntity(_0x5480ef,null))[_0xbe39('0x3f')](handleError(_0x5480ef,null));};exports[_0xbe39('0x44')]=function(_0x5c430c,_0x1bbfb0){return db[_0xbe39('0x28')]['describe']()[_0xbe39('0x21')](respondWithResult(_0x1bbfb0,null))[_0xbe39('0x3f')](handleError(_0x1bbfb0,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 349af56..b5643e6 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 _0xcb64=['request-promise','rimraf','../../config/environment','./squareReportDetail.attributes','exports','define','report_square_details','util','../../config/logger','api','moment','bluebird'];(function(_0x3dd3f5,_0x478793){var _0x5097d6=function(_0x365bbf){while(--_0x365bbf){_0x3dd3f5['push'](_0x3dd3f5['shift']());}};_0x5097d6(++_0x478793);}(_0xcb64,0xaf));var _0x4cb6=function(_0x15b76f,_0x3d0ec8){_0x15b76f=_0x15b76f-0x0;var _0x534890=_0xcb64[_0x15b76f];return _0x534890;};'use strict';var _=require('lodash');var util=require(_0x4cb6('0x0'));var logger=require(_0x4cb6('0x1'))(_0x4cb6('0x2'));var moment=require(_0x4cb6('0x3'));var BPromise=require(_0x4cb6('0x4'));var rp=require(_0x4cb6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4cb6('0x6'));var config=require(_0x4cb6('0x7'));var attributes=require(_0x4cb6('0x8'));module[_0x4cb6('0x9')]=function(_0x48c753,_0x339a04){return _0x48c753[_0x4cb6('0xa')]('SquareDetailsReport',attributes,{'tableName':_0x4cb6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4b2f=['../../config/environment','./squareReportDetail.attributes','SquareDetailsReport','report_square_details','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x57e00e,_0x36e79a){var _0x415e60=function(_0x5cd7fa){while(--_0x5cd7fa){_0x57e00e['push'](_0x57e00e['shift']());}};_0x415e60(++_0x36e79a);}(_0x4b2f,0x17e));var _0xf4b2=function(_0x512973,_0x564e8b){_0x512973=_0x512973-0x0;var _0x32f2e1=_0x4b2f[_0x512973];return _0x32f2e1;};'use strict';var _=require(_0xf4b2('0x0'));var util=require('util');var logger=require(_0xf4b2('0x1'))(_0xf4b2('0x2'));var moment=require('moment');var BPromise=require(_0xf4b2('0x3'));var rp=require(_0xf4b2('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf4b2('0x5'));var attributes=require(_0xf4b2('0x6'));module['exports']=function(_0x300d4b,_0x446b0e){return _0x300d4b['define'](_0xf4b2('0x7'),attributes,{'tableName':_0xf4b2('0x8'),'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 d8d1fab..d824cf0 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 _0x97c1=['create','body','options','raw','then','CreateSquareDetailsReport','debug','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','SquareDetailsReport'];(function(_0x456032,_0x1a799d){var _0x1a53cd=function(_0x162cc8){while(--_0x162cc8){_0x456032['push'](_0x456032['shift']());}};_0x1a53cd(++_0x1a799d);}(_0x97c1,0xdf));var _0x197c=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x97c1[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x197c('0x0'));var util=require(_0x197c('0x1'));var moment=require('moment');var BPromise=require(_0x197c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x197c('0x3'))['db'];var utils=require(_0x197c('0x4'));var logger=require(_0x197c('0x5'))(_0x197c('0x6'));var config=require(_0x197c('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x197c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x437214,_0x60fab2,_0xfcee35){return new BPromise(function(_0x5cf5cb,_0x5d42c5){return client[_0x197c('0x9')](_0x437214,_0xfcee35)['then'](function(_0x339fab){logger[_0x197c('0xa')](_0x197c('0xb'),_0x60fab2,_0x197c('0xc'));logger['debug'](_0x197c('0xd'),_0x60fab2,_0x197c('0xc'),JSON[_0x197c('0xe')](_0x339fab));if(_0x339fab[_0x197c('0xf')]){if(_0x339fab[_0x197c('0xf')]['code']===0x1f4){logger[_0x197c('0xf')](_0x197c('0xb'),_0x60fab2,_0x339fab[_0x197c('0xf')][_0x197c('0x10')]);return _0x5d42c5(_0x339fab['error'][_0x197c('0x10')]);}logger[_0x197c('0xf')](_0x197c('0xb'),_0x60fab2,_0x339fab[_0x197c('0xf')][_0x197c('0x10')]);return _0x5cf5cb(_0x339fab[_0x197c('0xf')]['message']);}else{logger['info'](_0x197c('0xb'),_0x60fab2,_0x197c('0xc'));_0x5cf5cb(_0x339fab[_0x197c('0x11')][_0x197c('0x10')]);}})[_0x197c('0x12')](function(_0x7e302f){logger[_0x197c('0xf')](_0x197c('0xb'),_0x60fab2,_0x7e302f);_0x5d42c5(_0x7e302f);});});}exports['CreateSquareDetailsReport']=function(_0x372311){var _0x47aaa9=this;return new Promise(function(_0x50ac52,_0x1725d9){return db[_0x197c('0x13')][_0x197c('0x14')](_0x372311[_0x197c('0x15')],{'raw':_0x372311['options']?_0x372311[_0x197c('0x16')][_0x197c('0x17')]===undefined?!![]:![]:!![]})[_0x197c('0x18')](function(_0x5c278a){logger[_0x197c('0xa')](_0x197c('0x19'),_0x372311);logger[_0x197c('0x1a')](_0x197c('0x19'),_0x372311,JSON[_0x197c('0xe')](_0x5c278a));_0x50ac52(_0x5c278a);})[_0x197c('0x12')](function(_0x362bbf){logger[_0x197c('0xf')](_0x197c('0x19'),_0x362bbf[_0x197c('0x10')],_0x372311);_0x1725d9(_0x47aaa9[_0x197c('0xf')](0x1f4,_0x362bbf[_0x197c('0x10')]));});});}; \ No newline at end of file +var _0x0598=['catch','CreateSquareDetailsReport','SquareDetailsReport','body','options','then','lodash','util','bluebird','../../mysqldb','../../config/utils','jayson/promise','client','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message'];(function(_0x591e87,_0x28dbe5){var _0x28a086=function(_0x26a644){while(--_0x26a644){_0x591e87['push'](_0x591e87['shift']());}};_0x28a086(++_0x28dbe5);}(_0x0598,0x92));var _0x8059=function(_0x9867dd,_0xeec086){_0x9867dd=_0x9867dd-0x0;var _0x848d7e=_0x0598[_0x9867dd];return _0x848d7e;};'use strict';var _=require(_0x8059('0x0'));var util=require(_0x8059('0x1'));var moment=require('moment');var BPromise=require(_0x8059('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8059('0x3'))['db'];var utils=require(_0x8059('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x8059('0x5'));var client=jayson[_0x8059('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5996d7,_0x248273,_0x347f1b){return new BPromise(function(_0x4610d2,_0x116946){return client['request'](_0x5996d7,_0x347f1b)['then'](function(_0x89dda1){logger[_0x8059('0x7')](_0x8059('0x8'),_0x248273,_0x8059('0x9'));logger[_0x8059('0xa')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x248273,'request\x20sent',JSON[_0x8059('0xb')](_0x89dda1));if(_0x89dda1[_0x8059('0xc')]){if(_0x89dda1['error']['code']===0x1f4){logger['error'](_0x8059('0x8'),_0x248273,_0x89dda1[_0x8059('0xc')][_0x8059('0xd')]);return _0x116946(_0x89dda1[_0x8059('0xc')][_0x8059('0xd')]);}logger['error'](_0x8059('0x8'),_0x248273,_0x89dda1['error'][_0x8059('0xd')]);return _0x4610d2(_0x89dda1['error'][_0x8059('0xd')]);}else{logger[_0x8059('0x7')](_0x8059('0x8'),_0x248273,'request\x20sent');_0x4610d2(_0x89dda1['result']['message']);}})[_0x8059('0xe')](function(_0x239195){logger[_0x8059('0xc')](_0x8059('0x8'),_0x248273,_0x239195);_0x116946(_0x239195);});});}exports[_0x8059('0xf')]=function(_0x4b6d55){var _0x10ad98=this;return new Promise(function(_0x2bb670,_0x37e926){return db[_0x8059('0x10')]['create'](_0x4b6d55[_0x8059('0x11')],{'raw':_0x4b6d55['options']?_0x4b6d55[_0x8059('0x12')]['raw']===undefined?!![]:![]:!![]})[_0x8059('0x13')](function(_0x56d794){logger[_0x8059('0x7')](_0x8059('0xf'),_0x4b6d55);logger[_0x8059('0xa')]('CreateSquareDetailsReport',_0x4b6d55,JSON['stringify'](_0x56d794));_0x2bb670(_0x56d794);})[_0x8059('0xe')](function(_0x232f1b){logger[_0x8059('0xc')](_0x8059('0xf'),_0x232f1b['message'],_0x4b6d55);_0x37e926(_0x10ad98[_0x8059('0xc')](0x1f4,_0x232f1b[_0x8059('0xd')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index bde8eac..882170f 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 _0x9b5d=['exports','Router','../../components/auth/service','./system.controller','get','isAuthenticated','/process/:pid/kill','killProcess'];(function(_0x4aa4e6,_0x278c45){var _0x322588=function(_0x19279d){while(--_0x19279d){_0x4aa4e6['push'](_0x4aa4e6['shift']());}};_0x322588(++_0x278c45);}(_0x9b5d,0x131));var _0xd9b5=function(_0x1802d6,_0x5a8db1){_0x1802d6=_0x1802d6-0x0;var _0x22a1d4=_0x9b5d[_0x1802d6];return _0x22a1d4;};'use strict';var express=require('express');var router=express[_0xd9b5('0x0')]();var auth=require(_0xd9b5('0x1'));var controller=require(_0xd9b5('0x2'));router[_0xd9b5('0x3')]('/',auth[_0xd9b5('0x4')](),controller['index']);router['get'](_0xd9b5('0x5'),auth[_0xd9b5('0x4')](),controller[_0xd9b5('0x6')]);module[_0xd9b5('0x7')]=router; \ No newline at end of file +var _0x8ce1=['exports','Router','../../components/auth/service','./system.controller','get','isAuthenticated','/process/:pid/kill'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8ce1,0x158));var _0x18ce=function(_0x3e19ee,_0x2e0b83){_0x3e19ee=_0x3e19ee-0x0;var _0x4640d8=_0x8ce1[_0x3e19ee];return _0x4640d8;};'use strict';var express=require('express');var router=express[_0x18ce('0x0')]();var auth=require(_0x18ce('0x1'));var controller=require(_0x18ce('0x2'));router[_0x18ce('0x3')]('/',auth[_0x18ce('0x4')](),controller['index']);router[_0x18ce('0x3')](_0x18ce('0x5'),auth[_0x18ce('0x4')](),controller['killProcess']);module[_0x18ce('0x6')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 960e0de..72d468a 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 _0x1351=['pid','length','Process\x20with\x20pid\x20%s\x20not\x20found!','params','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','../../config/logger','api','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','getAllData','then','json','catch','killProcess','components/import/cm','format'];(function(_0x18fb84,_0xdbda8d){var _0x5e80b3=function(_0x325cbc){while(--_0x325cbc){_0x18fb84['push'](_0x18fb84['shift']());}};_0x5e80b3(++_0xdbda8d);}(_0x1351,0xa3));var _0x1135=function(_0x9a3578,_0x4aeecd){_0x9a3578=_0x9a3578-0x0;var _0x1028af=_0x1351[_0x9a3578];return _0x1028af;};'use strict';var info=require(_0x1135('0x0'));var exec=require(_0x1135('0x1'))['exec'];var logger=require(_0x1135('0x2'))(_0x1135('0x3'));var util=require('util');var BPromise=require(_0x1135('0x4'));var _=require(_0x1135('0x5'));function handleError(_0xf997ed,_0x5b318c,_0x4f611c){_0x5b318c=_0x5b318c||0x1f4;return function(_0x4160ef){logger[_0x1135('0x6')](_0x1135('0x7'),_0x4f611c,_0x5b318c,util[_0x1135('0x8')](_0x4160ef,{'showHidden':![],'depth':null}));delete _0x4160ef[_0x1135('0x9')];_0xf997ed[_0x1135('0xa')](_0x5b318c)[_0x1135('0xb')](_0x4160ef);};}exports['index']=function(_0x44d473,_0x2754a6){return info[_0x1135('0xc')]()[_0x1135('0xd')](function(_0x52e063){return _0x2754a6[_0x1135('0xa')](0xc8)[_0x1135('0xe')](_0x52e063);})[_0x1135('0xf')](function(_0x11badb){return _0x2754a6['status'](0x1f4)['json'](_0x11badb);});};exports[_0x1135('0x10')]=function(_0x2dd768,_0x10b641){var _0x5795e1=[_0x1135('0x11')];return new BPromise(function(_0x982094,_0x4a8384){return exec(util[_0x1135('0x12')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x2dd768['params'][_0x1135('0x13')]),function(_0x38bc89,_0x2a9ed8,_0x11f074){if(_0x38bc89){return _0x4a8384(_0x38bc89);}return _0x982094(_0x2a9ed8);});})[_0x1135('0xd')](function(_0x21585d){var _0x31674d=![];var _0x134ee6=_0x21585d['split'](/\n/);for(var _0x431aad=0x0,_0x1bd503=_0x5795e1[_0x1135('0x14')];_0x431aad<_0x1bd503,_0x31674d===![];_0x431aad+=0x1){if(_0x21585d['indexOf'](_0x5795e1[_0x431aad])>=0x0){_0x31674d=!![];}}if(!_0x31674d){throw new Error(util['format'](_0x1135('0x15'),_0x2dd768[_0x1135('0x16')][_0x1135('0x13')]));}process[_0x1135('0x17')](_0x2dd768['params'][_0x1135('0x13')],_0x1135('0x18'));return _0x10b641[_0x1135('0xa')](0xc8)[_0x1135('0xe')]({'message':util[_0x1135('0x12')](_0x1135('0x19'),_0x2dd768[_0x1135('0x16')][_0x1135('0x13')])});})[_0x1135('0xf')](handleError(_0x10b641,null,_0x1135('0x10')));}; \ No newline at end of file +var _0xe11f=['components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','killProcess','systeminformation','child_process','exec','../../config/logger','util','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','status','send','index','getAllData','then','json','catch'];(function(_0x35e731,_0x245366){var _0x175069=function(_0x3d1c84){while(--_0x3d1c84){_0x35e731['push'](_0x35e731['shift']());}};_0x175069(++_0x245366);}(_0xe11f,0x98));var _0xfe11=function(_0x48347d,_0x31ee2a){_0x48347d=_0x48347d-0x0;var _0x110f3d=_0xe11f[_0x48347d];return _0x110f3d;};'use strict';var info=require(_0xfe11('0x0'));var exec=require(_0xfe11('0x1'))[_0xfe11('0x2')];var logger=require(_0xfe11('0x3'))('api');var util=require(_0xfe11('0x4'));var BPromise=require('bluebird');var _=require(_0xfe11('0x5'));function handleError(_0x2d7b3b,_0x2ecce8,_0x374f27){_0x2ecce8=_0x2ecce8||0x1f4;return function(_0x23e32f){logger[_0xfe11('0x6')](_0xfe11('0x7'),_0x374f27,_0x2ecce8,util[_0xfe11('0x8')](_0x23e32f,{'showHidden':![],'depth':null}));delete _0x23e32f['name'];_0x2d7b3b[_0xfe11('0x9')](_0x2ecce8)[_0xfe11('0xa')](_0x23e32f);};}exports[_0xfe11('0xb')]=function(_0x309bdd,_0x478582){return info[_0xfe11('0xc')]()[_0xfe11('0xd')](function(_0x4c1775){return _0x478582[_0xfe11('0x9')](0xc8)[_0xfe11('0xe')](_0x4c1775);})[_0xfe11('0xf')](function(_0x5c8150){return _0x478582['status'](0x1f4)[_0xfe11('0xe')](_0x5c8150);});};exports['killProcess']=function(_0x3b871b,_0x518e78){var _0x594242=[_0xfe11('0x10')];return new BPromise(function(_0xede761,_0x1e8293){return exec(util[_0xfe11('0x11')](_0xfe11('0x12'),_0x3b871b[_0xfe11('0x13')][_0xfe11('0x14')]),function(_0x51148d,_0x2ed568,_0xb45624){if(_0x51148d){return _0x1e8293(_0x51148d);}return _0xede761(_0x2ed568);});})[_0xfe11('0xd')](function(_0x337679){var _0x46c02c=![];var _0x63b28a=_0x337679[_0xfe11('0x15')](/\n/);for(var _0x3f4b81=0x0,_0x425b9b=_0x594242[_0xfe11('0x16')];_0x3f4b81<_0x425b9b,_0x46c02c===![];_0x3f4b81+=0x1){if(_0x337679[_0xfe11('0x17')](_0x594242[_0x3f4b81])>=0x0){_0x46c02c=!![];}}if(!_0x46c02c){throw new Error(util[_0xfe11('0x11')](_0xfe11('0x18'),_0x3b871b['params'][_0xfe11('0x14')]));}process['kill'](_0x3b871b[_0xfe11('0x13')][_0xfe11('0x14')],_0xfe11('0x19'));return _0x518e78[_0xfe11('0x9')](0xc8)['json']({'message':util[_0xfe11('0x11')](_0xfe11('0x1a'),_0x3b871b[_0xfe11('0x13')][_0xfe11('0x14')])});})[_0xfe11('0xf')](handleError(_0x518e78,null,_0xfe11('0x1b')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index bba4c60..0a31e81 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 _0x8a85=['create','put','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show'];(function(_0x4cce68,_0x5a3ca0){var _0x92be5e=function(_0x25d27d){while(--_0x25d27d){_0x4cce68['push'](_0x4cce68['shift']());}};_0x92be5e(++_0x5a3ca0);}(_0x8a85,0x153));var _0x58a8=function(_0x5c238c,_0x473cb6){_0x5c238c=_0x5c238c-0x0;var _0x3b0d3c=_0x8a85[_0x5c238c];return _0x3b0d3c;};'use strict';var multer=require('multer');var util=require(_0x58a8('0x0'));var path=require('path');var timeout=require(_0x58a8('0x1'));var express=require(_0x58a8('0x2'));var router=express[_0x58a8('0x3')]();var fs_extra=require(_0x58a8('0x4'));var auth=require(_0x58a8('0x5'));var interaction=require(_0x58a8('0x6'));var config=require(_0x58a8('0x7'));var controller=require('./tag.controller');router[_0x58a8('0x8')]('/',auth[_0x58a8('0x9')](),controller[_0x58a8('0xa')]);router[_0x58a8('0x8')](_0x58a8('0xb'),auth[_0x58a8('0x9')](),controller[_0x58a8('0xc')]);router['post']('/',auth[_0x58a8('0x9')](),controller[_0x58a8('0xd')]);router[_0x58a8('0xe')](_0x58a8('0xb'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x58a8('0x9')](),controller['destroy']);module[_0x58a8('0xf')]=router; \ No newline at end of file +var _0x0381=['../../config/environment','./tag.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x2cc4e5,_0x3688c8){var _0x3148f5=function(_0x293e08){while(--_0x293e08){_0x2cc4e5['push'](_0x2cc4e5['shift']());}};_0x3148f5(++_0x3688c8);}(_0x0381,0x1c7));var _0x1038=function(_0xced432,_0x3e8a0d){_0xced432=_0xced432-0x0;var _0x74b51c=_0x0381[_0xced432];return _0x74b51c;};'use strict';var multer=require(_0x1038('0x0'));var util=require(_0x1038('0x1'));var path=require('path');var timeout=require(_0x1038('0x2'));var express=require(_0x1038('0x3'));var router=express[_0x1038('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1038('0x5'));var interaction=require(_0x1038('0x6'));var config=require(_0x1038('0x7'));var controller=require(_0x1038('0x8'));router[_0x1038('0x9')]('/',auth['isAuthenticated'](),controller[_0x1038('0xa')]);router[_0x1038('0x9')](_0x1038('0xb'),auth[_0x1038('0xc')](),controller[_0x1038('0xd')]);router[_0x1038('0xe')]('/',auth['isAuthenticated'](),controller[_0x1038('0xf')]);router[_0x1038('0x10')](_0x1038('0xb'),auth[_0x1038('0xc')](),controller[_0x1038('0x11')]);router[_0x1038('0x12')](_0x1038('0xb'),auth[_0x1038('0xc')](),controller[_0x1038('0x13')]);module[_0x1038('0x14')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 0bd70f7..c630ef8 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 _0xc16f=['sequelize','exports','name','STRING','#0091EA'];(function(_0x79ff6b,_0x35e762){var _0x423209=function(_0x45dd08){while(--_0x45dd08){_0x79ff6b['push'](_0x79ff6b['shift']());}};_0x423209(++_0x35e762);}(_0xc16f,0xe6));var _0xfc16=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc16f[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xfc16('0x0'));module[_0xfc16('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xfc16('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xfc16('0x3')],'defaultValue':_0xfc16('0x4')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2c54=['STRING','#0091EA','sequelize','exports'];(function(_0x439f4d,_0x3c2d3d){var _0x18c99b=function(_0x56e738){while(--_0x56e738){_0x439f4d['push'](_0x439f4d['shift']());}};_0x18c99b(++_0x3c2d3d);}(_0x2c54,0x136));var _0x42c5=function(_0x1f99a5,_0x33f468){_0x1f99a5=_0x1f99a5-0x0;var _0x2c7c76=_0x2c54[_0x1f99a5];return _0x2c7c76;};'use strict';var Sequelize=require(_0x42c5('0x0'));module[_0x42c5('0x1')]={'name':{'type':Sequelize[_0x42c5('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x42c5('0x2')],'defaultValue':_0x42c5('0x3')},'description':{'type':Sequelize[_0x42c5('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 79284e8..db27e39 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 _0xb332=['querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','apply','reject','save','update','then','get','UserProfileResource','error','stack','name','send','index','map','Tag','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','order','sort','where','pick','filter','options','count','include','findAll','catch','show','params','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Tags','UserProfileSection','find','body','destroy','eml-format','zip-dir','fast-json-patch','moment','mustache','path','to-csv','ejs','fs-extra','lodash','jsforce'];(function(_0x3053d5,_0x197ead){var _0x4fdcf7=function(_0x2b62ee){while(--_0x2b62ee){_0x3053d5['push'](_0x3053d5['shift']());}};_0x4fdcf7(++_0x197ead);}(_0xb332,0xd9));var _0x2b33=function(_0x4d0662,_0x145963){_0x4d0662=_0x4d0662-0x0;var _0x6eea6d=_0xb332[_0x4d0662];return _0x6eea6d;};'use strict';var emlformat=require(_0x2b33('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2b33('0x1'));var jsonpatch=require(_0x2b33('0x2'));var rp=require('request-promise');var moment=require(_0x2b33('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x2b33('0x4'));var util=require('util');var path=require(_0x2b33('0x5'));var sox=require('sox');var csv=require(_0x2b33('0x6'));var ejs=require(_0x2b33('0x7'));var fs=require('fs');var fs_extra=require(_0x2b33('0x8'));var _=require(_0x2b33('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2b33('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x2b33('0x6'));var querystring=require(_0x2b33('0xb'));var Papa=require(_0x2b33('0xc'));var Redis=require(_0x2b33('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x2b33('0xe'));var as=require(_0x2b33('0xf'));var hardwareService=require(_0x2b33('0x10'));var logger=require(_0x2b33('0x11'))(_0x2b33('0x12'));var utils=require(_0x2b33('0x13'));var config=require(_0x2b33('0x14'));var licenseUtil=require(_0x2b33('0x15'));var db=require(_0x2b33('0x16'))['db'];function respondWithStatusCode(_0x3969cb,_0xca2248){_0xca2248=_0xca2248||0xcc;return function(_0x4df129){if(_0x4df129){return _0x3969cb[_0x2b33('0x17')](_0xca2248);}return _0x3969cb[_0x2b33('0x18')](_0xca2248)[_0x2b33('0x19')]();};}function respondWithResult(_0x4ef886,_0x173c75){_0x173c75=_0x173c75||0xc8;return function(_0x4d39db){if(_0x4d39db){return _0x4ef886[_0x2b33('0x18')](_0x173c75)[_0x2b33('0x1a')](_0x4d39db);}};}function respondWithFilteredResult(_0x233cd9,_0x57aea7){return function(_0x52693f){if(_0x52693f){var _0x1d8e75=typeof _0x57aea7[_0x2b33('0x1b')]===_0x2b33('0x1c')&&typeof _0x57aea7[_0x2b33('0x1d')]===_0x2b33('0x1c');var _0x4d69d0=_0x52693f['count'];var _0x59f0b6=_0x1d8e75?0x0:_0x57aea7[_0x2b33('0x1b')];var _0x4f10c4=_0x1d8e75?_0x52693f['count']:_0x57aea7[_0x2b33('0x1b')]+_0x57aea7[_0x2b33('0x1d')];var _0x205d8f;if(_0x4f10c4>=_0x4d69d0){_0x4f10c4=_0x4d69d0;_0x205d8f=0xc8;}else{_0x205d8f=0xce;}_0x233cd9['status'](_0x205d8f);return _0x233cd9[_0x2b33('0x1e')]('Content-Range',_0x59f0b6+'-'+_0x4f10c4+'/'+_0x4d69d0)[_0x2b33('0x1a')](_0x52693f);}return null;};}function patchUpdates(_0x2565be){return function(_0x8c8dc2){try{jsonpatch[_0x2b33('0x1f')](_0x8c8dc2,_0x2565be,!![]);}catch(_0x233ba6){return BPromise[_0x2b33('0x20')](_0x233ba6);}return _0x8c8dc2[_0x2b33('0x21')]();};}function saveUpdates(_0x4fb725,_0x23024c){return function(_0x1d9c98){if(_0x1d9c98){return _0x1d9c98[_0x2b33('0x22')](_0x4fb725)[_0x2b33('0x23')](function(_0x58998e){return _0x58998e;});}return null;};}function removeEntity(_0x1c27d4,_0x27f1b8){return function(_0x2605e6){if(_0x2605e6){return _0x2605e6['destroy']()[_0x2b33('0x23')](function(){var _0x1b9a48=_0x2605e6[_0x2b33('0x24')]({'plain':!![]});var _0x32b835='Tags';return db[_0x2b33('0x25')]['destroy']({'where':{'type':_0x32b835,'resourceId':_0x1b9a48['id']}})[_0x2b33('0x23')](function(){return _0x2605e6;});})['then'](function(){_0x1c27d4[_0x2b33('0x18')](0xcc)[_0x2b33('0x19')]();});}};}function handleEntityNotFound(_0x5d8d05,_0x195aa2){return function(_0x53c2ad){if(!_0x53c2ad){_0x5d8d05[_0x2b33('0x17')](0x194);}return _0x53c2ad;};}function handleError(_0x5b16a8,_0x315ebd){_0x315ebd=_0x315ebd||0x1f4;return function(_0xa109f4){logger[_0x2b33('0x26')](_0xa109f4[_0x2b33('0x27')]);if(_0xa109f4[_0x2b33('0x28')]){delete _0xa109f4[_0x2b33('0x28')];}_0x5b16a8[_0x2b33('0x18')](_0x315ebd)[_0x2b33('0x29')](_0xa109f4);};}exports[_0x2b33('0x2a')]=function(_0x203c43,_0x4cf72f){var _0x5b6527={},_0x106ea0={},_0x2a081c={'count':0x0,'rows':[]};var _0x3282bf=_[_0x2b33('0x2b')](db[_0x2b33('0x2c')]['rawAttributes'],function(_0x570765){return{'name':_0x570765[_0x2b33('0x2d')],'type':_0x570765[_0x2b33('0x2e')][_0x2b33('0x2f')]};});_0x106ea0[_0x2b33('0x30')]=_[_0x2b33('0x2b')](_0x3282bf,_0x2b33('0x28'));_0x106ea0['query']=_[_0x2b33('0x31')](_0x203c43['query']);_0x106ea0[_0x2b33('0x32')]=_[_0x2b33('0x33')](_0x106ea0[_0x2b33('0x30')],_0x106ea0[_0x2b33('0x34')]);_0x5b6527[_0x2b33('0x35')]=_[_0x2b33('0x33')](_0x106ea0[_0x2b33('0x30')],qs[_0x2b33('0x36')](_0x203c43[_0x2b33('0x34')][_0x2b33('0x36')]));_0x5b6527[_0x2b33('0x35')]=_0x5b6527[_0x2b33('0x35')][_0x2b33('0x37')]?_0x5b6527[_0x2b33('0x35')]:_0x106ea0[_0x2b33('0x30')];if(!_0x203c43[_0x2b33('0x34')]['hasOwnProperty']('nolimit')){_0x5b6527['limit']=qs[_0x2b33('0x1d')](_0x203c43[_0x2b33('0x34')][_0x2b33('0x1d')]);_0x5b6527[_0x2b33('0x1b')]=qs[_0x2b33('0x1b')](_0x203c43['query']['offset']);}_0x5b6527[_0x2b33('0x38')]=qs['sort'](_0x203c43[_0x2b33('0x34')][_0x2b33('0x39')]);_0x5b6527[_0x2b33('0x3a')]=qs[_0x2b33('0x32')](_[_0x2b33('0x3b')](_0x203c43[_0x2b33('0x34')],_0x106ea0[_0x2b33('0x32')]),_0x3282bf);if(_0x203c43[_0x2b33('0x34')][_0x2b33('0x3c')]){_0x5b6527[_0x2b33('0x3a')]=_['merge'](_0x5b6527[_0x2b33('0x3a')],{'$or':_[_0x2b33('0x2b')](_0x3282bf,function(_0x1f0160){if(_0x1f0160['type']!=='VIRTUAL'){var _0x3afaa5={};_0x3afaa5[_0x1f0160['name']]={'$like':'%'+_0x203c43[_0x2b33('0x34')][_0x2b33('0x3c')]+'%'};return _0x3afaa5;}})});}_0x5b6527=_['merge']({},_0x5b6527,_0x203c43[_0x2b33('0x3d')]);var _0x13874a={'where':_0x5b6527['where']};return db[_0x2b33('0x2c')][_0x2b33('0x3e')](_0x13874a)['then'](function(_0x2168b6){_0x2a081c[_0x2b33('0x3e')]=_0x2168b6;if(_0x203c43[_0x2b33('0x34')]['includeAll']){_0x5b6527[_0x2b33('0x3f')]=[{'all':!![]}];}return db[_0x2b33('0x2c')][_0x2b33('0x40')](_0x5b6527);})[_0x2b33('0x23')](function(_0x22ce0c){_0x2a081c['rows']=_0x22ce0c;return _0x2a081c;})[_0x2b33('0x23')](respondWithFilteredResult(_0x4cf72f,_0x5b6527))[_0x2b33('0x41')](handleError(_0x4cf72f,null));};exports[_0x2b33('0x42')]=function(_0x5ad3b2,_0x1fd4b2){var _0x2ac846={'raw':!![],'where':{'id':_0x5ad3b2[_0x2b33('0x43')]['id']}},_0x3c61d6={};_0x3c61d6['model']=_[_0x2b33('0x31')](db[_0x2b33('0x2c')]['rawAttributes']);_0x3c61d6['query']=_['keys'](_0x5ad3b2[_0x2b33('0x34')]);_0x3c61d6['filters']=_[_0x2b33('0x33')](_0x3c61d6[_0x2b33('0x30')],_0x3c61d6[_0x2b33('0x34')]);_0x2ac846[_0x2b33('0x35')]=_[_0x2b33('0x33')](_0x3c61d6[_0x2b33('0x30')],qs[_0x2b33('0x36')](_0x5ad3b2[_0x2b33('0x34')]['fields']));_0x2ac846[_0x2b33('0x35')]=_0x2ac846[_0x2b33('0x35')][_0x2b33('0x37')]?_0x2ac846[_0x2b33('0x35')]:_0x3c61d6[_0x2b33('0x30')];if(_0x5ad3b2[_0x2b33('0x34')]['includeAll']){_0x2ac846['include']=[{'all':!![]}];}_0x2ac846=_['merge']({},_0x2ac846,_0x5ad3b2['options']);return db[_0x2b33('0x2c')]['find'](_0x2ac846)[_0x2b33('0x23')](handleEntityNotFound(_0x1fd4b2,null))['then'](respondWithResult(_0x1fd4b2,null))['catch'](handleError(_0x1fd4b2,null));};exports[_0x2b33('0x44')]=function(_0xd15da9,_0x357724){return db['Tag'][_0x2b33('0x44')](_0xd15da9['body'],{})[_0x2b33('0x23')](function(_0x27d3b6){var _0x2a20a4=_0xd15da9[_0x2b33('0x45')][_0x2b33('0x24')]({'plain':!![]});if(!_0x2a20a4)throw new Error(_0x2b33('0x46'));if(_0x2a20a4['role']===_0x2b33('0x45')){var _0x27f766=_0x27d3b6[_0x2b33('0x24')]({'plain':!![]});var _0x4e8c21=_0x2b33('0x47');return db[_0x2b33('0x48')][_0x2b33('0x49')]({'where':{'name':_0x4e8c21,'userProfileId':_0x2a20a4['userProfileId']},'raw':!![]})[_0x2b33('0x23')](function(_0x4cffe9){if(_0x4cffe9&&_0x4cffe9['autoAssociation']===0x0){return db[_0x2b33('0x25')][_0x2b33('0x44')]({'name':_0x27f766[_0x2b33('0x28')],'resourceId':_0x27f766['id'],'type':_0x4cffe9[_0x2b33('0x28')],'sectionId':_0x4cffe9['id']},{})[_0x2b33('0x23')](function(){return _0x27d3b6;});}else{return _0x27d3b6;}})[_0x2b33('0x41')](function(_0x1982aa){logger[_0x2b33('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1982aa);throw _0x1982aa;});}return _0x27d3b6;})[_0x2b33('0x23')](respondWithResult(_0x357724,0xc9))[_0x2b33('0x41')](handleError(_0x357724,null));};exports['update']=function(_0x28e75b,_0x45a939){if(_0x28e75b['body']['id']){delete _0x28e75b[_0x2b33('0x4a')]['id'];}return db[_0x2b33('0x2c')][_0x2b33('0x49')]({'where':{'id':_0x28e75b[_0x2b33('0x43')]['id']}})['then'](handleEntityNotFound(_0x45a939,null))[_0x2b33('0x23')](saveUpdates(_0x28e75b[_0x2b33('0x4a')],null))['then'](respondWithResult(_0x45a939,null))[_0x2b33('0x41')](handleError(_0x45a939,null));};exports[_0x2b33('0x4b')]=function(_0x1ce316,_0x26e0ca){return db[_0x2b33('0x2c')][_0x2b33('0x49')]({'where':{'id':_0x1ce316[_0x2b33('0x43')]['id']}})['then'](handleEntityNotFound(_0x26e0ca,null))['then'](removeEntity(_0x26e0ca,null))[_0x2b33('0x41')](handleError(_0x26e0ca,null));}; \ No newline at end of file +var _0xa37e=['path','sox','to-csv','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','limit','count','offset','set','Content-Range','apply','reject','save','update','then','get','Tags','UserProfileResource','destroy','error','name','send','Tag','rawAttributes','fieldName','type','key','map','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','include','rows','catch','show','params','includeAll','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','zip-dir','fast-json-patch','request-promise','moment','mustache'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa37e,0x97));var _0xea37=function(_0x3b58c2,_0x572bce){_0x3b58c2=_0x3b58c2-0x0;var _0x3a0a4b=_0xa37e[_0x3b58c2];return _0x3a0a4b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xea37('0x0'));var jsonpatch=require(_0xea37('0x1'));var rp=require(_0xea37('0x2'));var moment=require(_0xea37('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xea37('0x4'));var util=require('util');var path=require(_0xea37('0x5'));var sox=require(_0xea37('0x6'));var csv=require(_0xea37('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xea37('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xea37('0x9'));var deskjs=require(_0xea37('0xa'));var toCsv=require(_0xea37('0x7'));var querystring=require(_0xea37('0xb'));var Papa=require('papaparse');var Redis=require(_0xea37('0xc'));var authService=require(_0xea37('0xd'));var qs=require(_0xea37('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xea37('0xf'))(_0xea37('0x10'));var utils=require(_0xea37('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xea37('0x12'));var db=require(_0xea37('0x13'))['db'];function respondWithStatusCode(_0x2a2bcd,_0x589a61){_0x589a61=_0x589a61||0xcc;return function(_0x3aef9e){if(_0x3aef9e){return _0x2a2bcd[_0xea37('0x14')](_0x589a61);}return _0x2a2bcd['status'](_0x589a61)[_0xea37('0x15')]();};}function respondWithResult(_0x556a64,_0xd7d4e7){_0xd7d4e7=_0xd7d4e7||0xc8;return function(_0x4dd6d0){if(_0x4dd6d0){return _0x556a64[_0xea37('0x16')](_0xd7d4e7)[_0xea37('0x17')](_0x4dd6d0);}};}function respondWithFilteredResult(_0x168e80,_0x46aaf0){return function(_0x5b38aa){if(_0x5b38aa){var _0x18e4b8=typeof _0x46aaf0['offset']==='undefined'&&typeof _0x46aaf0[_0xea37('0x18')]==='undefined';var _0x257310=_0x5b38aa[_0xea37('0x19')];var _0x4ef3c9=_0x18e4b8?0x0:_0x46aaf0[_0xea37('0x1a')];var _0x465d3b=_0x18e4b8?_0x5b38aa['count']:_0x46aaf0[_0xea37('0x1a')]+_0x46aaf0[_0xea37('0x18')];var _0x3ee6bb;if(_0x465d3b>=_0x257310){_0x465d3b=_0x257310;_0x3ee6bb=0xc8;}else{_0x3ee6bb=0xce;}_0x168e80[_0xea37('0x16')](_0x3ee6bb);return _0x168e80[_0xea37('0x1b')](_0xea37('0x1c'),_0x4ef3c9+'-'+_0x465d3b+'/'+_0x257310)[_0xea37('0x17')](_0x5b38aa);}return null;};}function patchUpdates(_0x238567){return function(_0x28ed44){try{jsonpatch[_0xea37('0x1d')](_0x28ed44,_0x238567,!![]);}catch(_0x498df6){return BPromise[_0xea37('0x1e')](_0x498df6);}return _0x28ed44[_0xea37('0x1f')]();};}function saveUpdates(_0x356f04,_0x536eff){return function(_0x4aa2ae){if(_0x4aa2ae){return _0x4aa2ae[_0xea37('0x20')](_0x356f04)[_0xea37('0x21')](function(_0x98c6de){return _0x98c6de;});}return null;};}function removeEntity(_0x4302ca,_0x4996e9){return function(_0x25042e){if(_0x25042e){return _0x25042e['destroy']()['then'](function(){var _0x5503f1=_0x25042e[_0xea37('0x22')]({'plain':!![]});var _0x4ff973=_0xea37('0x23');return db[_0xea37('0x24')][_0xea37('0x25')]({'where':{'type':_0x4ff973,'resourceId':_0x5503f1['id']}})[_0xea37('0x21')](function(){return _0x25042e;});})[_0xea37('0x21')](function(){_0x4302ca[_0xea37('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x57a7cc,_0x55880c){return function(_0x477e25){if(!_0x477e25){_0x57a7cc[_0xea37('0x14')](0x194);}return _0x477e25;};}function handleError(_0x4ffcf1,_0x1ff12d){_0x1ff12d=_0x1ff12d||0x1f4;return function(_0x10d556){logger[_0xea37('0x26')](_0x10d556['stack']);if(_0x10d556[_0xea37('0x27')]){delete _0x10d556[_0xea37('0x27')];}_0x4ffcf1[_0xea37('0x16')](_0x1ff12d)[_0xea37('0x28')](_0x10d556);};}exports['index']=function(_0x44e0af,_0x55388b){var _0x568f98={},_0x1faf31={},_0x589244={'count':0x0,'rows':[]};var _0x52e23e=_['map'](db[_0xea37('0x29')][_0xea37('0x2a')],function(_0x3ec6af){return{'name':_0x3ec6af[_0xea37('0x2b')],'type':_0x3ec6af[_0xea37('0x2c')][_0xea37('0x2d')]};});_0x1faf31['model']=_[_0xea37('0x2e')](_0x52e23e,_0xea37('0x27'));_0x1faf31[_0xea37('0x2f')]=_[_0xea37('0x30')](_0x44e0af[_0xea37('0x2f')]);_0x1faf31[_0xea37('0x31')]=_['intersection'](_0x1faf31[_0xea37('0x32')],_0x1faf31['query']);_0x568f98[_0xea37('0x33')]=_[_0xea37('0x34')](_0x1faf31[_0xea37('0x32')],qs[_0xea37('0x35')](_0x44e0af[_0xea37('0x2f')][_0xea37('0x35')]));_0x568f98[_0xea37('0x33')]=_0x568f98[_0xea37('0x33')]['length']?_0x568f98[_0xea37('0x33')]:_0x1faf31[_0xea37('0x32')];if(!_0x44e0af[_0xea37('0x2f')][_0xea37('0x36')](_0xea37('0x37'))){_0x568f98[_0xea37('0x18')]=qs['limit'](_0x44e0af['query']['limit']);_0x568f98[_0xea37('0x1a')]=qs['offset'](_0x44e0af[_0xea37('0x2f')]['offset']);}_0x568f98['order']=qs['sort'](_0x44e0af['query'][_0xea37('0x38')]);_0x568f98[_0xea37('0x39')]=qs[_0xea37('0x31')](_[_0xea37('0x3a')](_0x44e0af[_0xea37('0x2f')],_0x1faf31[_0xea37('0x31')]),_0x52e23e);if(_0x44e0af[_0xea37('0x2f')][_0xea37('0x3b')]){_0x568f98[_0xea37('0x39')]=_['merge'](_0x568f98[_0xea37('0x39')],{'$or':_['map'](_0x52e23e,function(_0x278c9e){if(_0x278c9e[_0xea37('0x2c')]!==_0xea37('0x3c')){var _0x537f75={};_0x537f75[_0x278c9e[_0xea37('0x27')]]={'$like':'%'+_0x44e0af[_0xea37('0x2f')][_0xea37('0x3b')]+'%'};return _0x537f75;}})});}_0x568f98=_[_0xea37('0x3d')]({},_0x568f98,_0x44e0af['options']);var _0xc5f582={'where':_0x568f98['where']};return db[_0xea37('0x29')][_0xea37('0x19')](_0xc5f582)[_0xea37('0x21')](function(_0x847051){_0x589244[_0xea37('0x19')]=_0x847051;if(_0x44e0af[_0xea37('0x2f')]['includeAll']){_0x568f98[_0xea37('0x3e')]=[{'all':!![]}];}return db[_0xea37('0x29')]['findAll'](_0x568f98);})[_0xea37('0x21')](function(_0x4e9a82){_0x589244[_0xea37('0x3f')]=_0x4e9a82;return _0x589244;})[_0xea37('0x21')](respondWithFilteredResult(_0x55388b,_0x568f98))[_0xea37('0x40')](handleError(_0x55388b,null));};exports[_0xea37('0x41')]=function(_0x2281d9,_0x10c108){var _0xcd648c={'raw':!![],'where':{'id':_0x2281d9[_0xea37('0x42')]['id']}},_0x71760a={};_0x71760a[_0xea37('0x32')]=_[_0xea37('0x30')](db[_0xea37('0x29')][_0xea37('0x2a')]);_0x71760a[_0xea37('0x2f')]=_[_0xea37('0x30')](_0x2281d9['query']);_0x71760a[_0xea37('0x31')]=_[_0xea37('0x34')](_0x71760a[_0xea37('0x32')],_0x71760a[_0xea37('0x2f')]);_0xcd648c[_0xea37('0x33')]=_['intersection'](_0x71760a[_0xea37('0x32')],qs[_0xea37('0x35')](_0x2281d9[_0xea37('0x2f')][_0xea37('0x35')]));_0xcd648c[_0xea37('0x33')]=_0xcd648c[_0xea37('0x33')]['length']?_0xcd648c[_0xea37('0x33')]:_0x71760a[_0xea37('0x32')];if(_0x2281d9[_0xea37('0x2f')][_0xea37('0x43')]){_0xcd648c[_0xea37('0x3e')]=[{'all':!![]}];}_0xcd648c=_[_0xea37('0x3d')]({},_0xcd648c,_0x2281d9[_0xea37('0x44')]);return db[_0xea37('0x29')]['find'](_0xcd648c)[_0xea37('0x21')](handleEntityNotFound(_0x10c108,null))[_0xea37('0x21')](respondWithResult(_0x10c108,null))['catch'](handleError(_0x10c108,null));};exports[_0xea37('0x45')]=function(_0x2ff803,_0x172f22){return db[_0xea37('0x29')][_0xea37('0x45')](_0x2ff803[_0xea37('0x46')],{})[_0xea37('0x21')](function(_0x174a77){var _0x483d1a=_0x2ff803[_0xea37('0x47')]['get']({'plain':!![]});if(!_0x483d1a)throw new Error(_0xea37('0x48'));if(_0x483d1a['role']===_0xea37('0x47')){var _0x14c119=_0x174a77[_0xea37('0x22')]({'plain':!![]});var _0xb08dc5=_0xea37('0x23');return db[_0xea37('0x49')][_0xea37('0x4a')]({'where':{'name':_0xb08dc5,'userProfileId':_0x483d1a[_0xea37('0x4b')]},'raw':!![]})['then'](function(_0x4c55b9){if(_0x4c55b9&&_0x4c55b9[_0xea37('0x4c')]===0x0){return db[_0xea37('0x24')][_0xea37('0x45')]({'name':_0x14c119['name'],'resourceId':_0x14c119['id'],'type':_0x4c55b9[_0xea37('0x27')],'sectionId':_0x4c55b9['id']},{})[_0xea37('0x21')](function(){return _0x174a77;});}else{return _0x174a77;}})['catch'](function(_0xcb7bf3){logger[_0xea37('0x26')](_0xea37('0x4d'),_0xcb7bf3);throw _0xcb7bf3;});}return _0x174a77;})[_0xea37('0x21')](respondWithResult(_0x172f22,0xc9))[_0xea37('0x40')](handleError(_0x172f22,null));};exports[_0xea37('0x20')]=function(_0x2936ee,_0x224f2c){if(_0x2936ee[_0xea37('0x46')]['id']){delete _0x2936ee[_0xea37('0x46')]['id'];}return db[_0xea37('0x29')][_0xea37('0x4a')]({'where':{'id':_0x2936ee[_0xea37('0x42')]['id']}})[_0xea37('0x21')](handleEntityNotFound(_0x224f2c,null))[_0xea37('0x21')](saveUpdates(_0x2936ee['body'],null))[_0xea37('0x21')](respondWithResult(_0x224f2c,null))[_0xea37('0x40')](handleError(_0x224f2c,null));};exports[_0xea37('0x25')]=function(_0x2acb0f,_0x40d747){return db[_0xea37('0x29')]['find']({'where':{'id':_0x2acb0f[_0xea37('0x42')]['id']}})[_0xea37('0x21')](handleEntityNotFound(_0x40d747,null))[_0xea37('0x21')](removeEntity(_0x40d747,null))[_0xea37('0x40')](handleError(_0x40d747,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 9430fd5..b4388e2 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 _0x8135=['moment','request-promise','path','rimraf','../../config/environment','./tag.attributes','define','Tag','tools_tags','util','../../config/logger','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8135,0x99));var _0x5813=function(_0x3d9d28,_0xeb79a7){_0x3d9d28=_0x3d9d28-0x0;var _0x4b1050=_0x8135[_0x3d9d28];return _0x4b1050;};'use strict';var _=require('lodash');var util=require(_0x5813('0x0'));var logger=require(_0x5813('0x1'))(_0x5813('0x2'));var moment=require(_0x5813('0x3'));var BPromise=require('bluebird');var rp=require(_0x5813('0x4'));var fs=require('fs');var path=require(_0x5813('0x5'));var rimraf=require(_0x5813('0x6'));var config=require(_0x5813('0x7'));var attributes=require(_0x5813('0x8'));module['exports']=function(_0x57ac38,_0x27599d){return _0x57ac38[_0x5813('0x9')](_0x5813('0xa'),attributes,{'tableName':_0x5813('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x827a=['path','rimraf','../../config/environment','./tag.attributes','exports','Tag','tools_tags','util','api'];(function(_0x51266d,_0x11e599){var _0x1c58ce=function(_0x237930){while(--_0x237930){_0x51266d['push'](_0x51266d['shift']());}};_0x1c58ce(++_0x11e599);}(_0x827a,0x1e4));var _0xa827=function(_0x2633fa,_0x5768da){_0x2633fa=_0x2633fa-0x0;var _0x4e179e=_0x827a[_0x2633fa];return _0x4e179e;};'use strict';var _=require('lodash');var util=require(_0xa827('0x0'));var logger=require('../../config/logger')(_0xa827('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa827('0x2'));var rimraf=require(_0xa827('0x3'));var config=require(_0xa827('0x4'));var attributes=require(_0xa827('0x5'));module[_0xa827('0x6')]=function(_0x4a7fc7,_0x4b0547){return _0x4a7fc7['define'](_0xa827('0x7'),attributes,{'tableName':_0xa827('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 f7fe157..2f4b231 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 _0xd2ea=['../../config/environment','jayson/promise','client','request','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x5da7d5,_0x5501c7){var _0x1db2b1=function(_0x1be916){while(--_0x1be916){_0x5da7d5['push'](_0x5da7d5['shift']());}};_0x1db2b1(++_0x5501c7);}(_0xd2ea,0x15f));var _0xad2e=function(_0x6133cf,_0x2c8596){_0x6133cf=_0x6133cf-0x0;var _0x3e5cb5=_0xd2ea[_0x6133cf];return _0x3e5cb5;};'use strict';var _=require(_0xad2e('0x0'));var util=require(_0xad2e('0x1'));var moment=require(_0xad2e('0x2'));var BPromise=require(_0xad2e('0x3'));var rs=require(_0xad2e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xad2e('0x5'))['db'];var utils=require(_0xad2e('0x6'));var logger=require(_0xad2e('0x7'))(_0xad2e('0x8'));var config=require(_0xad2e('0x9'));var jayson=require(_0xad2e('0xa'));var client=jayson[_0xad2e('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b5170,_0x3e3d1f,_0x2ff7b2){return new BPromise(function(_0x5710ac,_0x1e0e9e){return client[_0xad2e('0xc')](_0x3b5170,_0x2ff7b2)['then'](function(_0x1eed2f){logger['info'](_0xad2e('0xd'),_0x3e3d1f,_0xad2e('0xe'));logger[_0xad2e('0xf')](_0xad2e('0x10'),_0x3e3d1f,'request\x20sent',JSON[_0xad2e('0x11')](_0x1eed2f));if(_0x1eed2f['error']){if(_0x1eed2f[_0xad2e('0x12')][_0xad2e('0x13')]===0x1f4){logger[_0xad2e('0x12')](_0xad2e('0xd'),_0x3e3d1f,_0x1eed2f['error'][_0xad2e('0x14')]);return _0x1e0e9e(_0x1eed2f['error'][_0xad2e('0x14')]);}logger['error']('Tag,\x20%s,\x20%s',_0x3e3d1f,_0x1eed2f['error']['message']);return _0x5710ac(_0x1eed2f[_0xad2e('0x12')][_0xad2e('0x14')]);}else{logger[_0xad2e('0x15')](_0xad2e('0xd'),_0x3e3d1f,_0xad2e('0xe'));_0x5710ac(_0x1eed2f[_0xad2e('0x16')][_0xad2e('0x14')]);}})[_0xad2e('0x17')](function(_0xd40b31){logger[_0xad2e('0x12')](_0xad2e('0xd'),_0x3e3d1f,_0xd40b31);_0x1e0e9e(_0xd40b31);});});} \ No newline at end of file +var _0x04de=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Tag,\x20%s,\x20%s','result','catch','lodash'];(function(_0x230e56,_0x26acc8){var _0x45a344=function(_0x9affcd){while(--_0x9affcd){_0x230e56['push'](_0x230e56['shift']());}};_0x45a344(++_0x26acc8);}(_0x04de,0x107));var _0xe04d=function(_0x1b262e,_0x4c8871){_0x1b262e=_0x1b262e-0x0;var _0x11fa10=_0x04de[_0x1b262e];return _0x11fa10;};'use strict';var _=require(_0xe04d('0x0'));var util=require(_0xe04d('0x1'));var moment=require(_0xe04d('0x2'));var BPromise=require(_0xe04d('0x3'));var rs=require(_0xe04d('0x4'));var fs=require('fs');var Redis=require(_0xe04d('0x5'));var db=require(_0xe04d('0x6'))['db'];var utils=require(_0xe04d('0x7'));var logger=require(_0xe04d('0x8'))(_0xe04d('0x9'));var config=require(_0xe04d('0xa'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x531688,_0x55efb5,_0x210e93){return new BPromise(function(_0x72b1ce,_0x1be121){return client[_0xe04d('0xb')](_0x531688,_0x210e93)[_0xe04d('0xc')](function(_0x2ae3c9){logger[_0xe04d('0xd')]('Tag,\x20%s,\x20%s',_0x55efb5,_0xe04d('0xe'));logger[_0xe04d('0xf')](_0xe04d('0x10'),_0x55efb5,_0xe04d('0xe'),JSON[_0xe04d('0x11')](_0x2ae3c9));if(_0x2ae3c9[_0xe04d('0x12')]){if(_0x2ae3c9[_0xe04d('0x12')][_0xe04d('0x13')]===0x1f4){logger[_0xe04d('0x12')]('Tag,\x20%s,\x20%s',_0x55efb5,_0x2ae3c9[_0xe04d('0x12')][_0xe04d('0x14')]);return _0x1be121(_0x2ae3c9[_0xe04d('0x12')][_0xe04d('0x14')]);}logger[_0xe04d('0x12')](_0xe04d('0x15'),_0x55efb5,_0x2ae3c9[_0xe04d('0x12')][_0xe04d('0x14')]);return _0x72b1ce(_0x2ae3c9[_0xe04d('0x12')][_0xe04d('0x14')]);}else{logger[_0xe04d('0xd')](_0xe04d('0x15'),_0x55efb5,'request\x20sent');_0x72b1ce(_0x2ae3c9[_0xe04d('0x16')]['message']);}})[_0xe04d('0x17')](function(_0x49c063){logger[_0xe04d('0x12')](_0xe04d('0x15'),_0x55efb5,_0x49c063);_0x1be121(_0x49c063);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index d8ceed4..60aaf35 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(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'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(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xa9e0[_0x220dbb];return _0x2b77de;};'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 cf8610b..fa50674 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(_0x2b0a90,_0x430905){var _0x3de097=function(_0x55f93e){while(--_0x55f93e){_0x2b0a90['push'](_0x2b0a90['shift']());}};_0x3de097(++_0x430905);}(_0x757a,0xde));var _0xa757=function(_0x22f48c,_0x1eef2b){_0x22f48c=_0x22f48c-0x0;var _0xcd30e3=_0x757a[_0x22f48c];return _0xcd30e3;};'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(_0xc0a3d3,_0x2c8d00){var _0x3386e8=function(_0x3f9df4){while(--_0x3f9df4){_0xc0a3d3['push'](_0xc0a3d3['shift']());}};_0x3386e8(++_0x2c8d00);}(_0xb7e7,0x121));var _0x7b7e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xb7e7[_0x5037ab];return _0x512adb;};'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 cbf5fc2..04748ee 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 _0xdfde=['user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','sequelize','transaction','Sequelize','QueryTypes','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','FaxQueueId','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','VoicePrefixId','findOne','channel','isValidChannel','Unknown\x20channel','toLowerCase','Queue','get','capitalize','Queues','addQueues','ValidationError','add','ids','removeQueues','addAgents','isArray','Voice','Mail','Fax','Openchannel','through','penalty','findOrCreate','emit','QueueId','User','online','interface','UserVoiceQueueRt','isNil','format','SIP/%s','voicePause','TeamVoiceQueue','all','UserVoicePrefix','spread','removeAgents','Sms','Whatsapp','Queue:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','register','sendStatus','status','end','json','undefined','limit','count','offset','apply','reject','update','then','error','stack','name','send','index','map','Team','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','params','rawAttributes','find','create'];(function(_0x4cb254,_0x17e637){var _0x12b042=function(_0x26764d){while(--_0x26764d){_0x4cb254['push'](_0x4cb254['shift']());}};_0x12b042(++_0x17e637);}(_0xdfde,0xe5));var _0xedfd=function(_0x4cfa2e,_0x5752b5){_0x4cfa2e=_0x4cfa2e-0x0;var _0x279b50=_0xdfde[_0x4cfa2e];return _0x279b50;};'use strict';var emlformat=require(_0xedfd('0x0'));var rimraf=require(_0xedfd('0x1'));var zipdir=require(_0xedfd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xedfd('0x3'));var moment=require(_0xedfd('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xedfd('0x5'));var sox=require(_0xedfd('0x6'));var csv=require(_0xedfd('0x7'));var ejs=require(_0xedfd('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xedfd('0x9'));var squel=require(_0xedfd('0xa'));var crypto=require('crypto');var jsforce=require(_0xedfd('0xb'));var deskjs=require(_0xedfd('0xc'));var toCsv=require(_0xedfd('0x7'));var querystring=require(_0xedfd('0xd'));var Papa=require(_0xedfd('0xe'));var Redis=require(_0xedfd('0xf'));var authService=require(_0xedfd('0x10'));var qs=require(_0xedfd('0x11'));var as=require(_0xedfd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xedfd('0x13'))(_0xedfd('0x14'));var utils=require(_0xedfd('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xedfd('0x16'));var db=require(_0xedfd('0x17'))['db'];config[_0xedfd('0x18')]=_[_0xedfd('0x19')](config[_0xedfd('0x18')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xedfd('0x18')]));require('./team.socket')[_0xedfd('0x1a')](socket);function respondWithStatusCode(_0x14b5db,_0xcc0bcb){_0xcc0bcb=_0xcc0bcb||0xcc;return function(_0xdcb552){if(_0xdcb552){return _0x14b5db[_0xedfd('0x1b')](_0xcc0bcb);}return _0x14b5db[_0xedfd('0x1c')](_0xcc0bcb)[_0xedfd('0x1d')]();};}function respondWithResult(_0xb1793a,_0x5542ba){_0x5542ba=_0x5542ba||0xc8;return function(_0x54ff51){if(_0x54ff51){return _0xb1793a['status'](_0x5542ba)[_0xedfd('0x1e')](_0x54ff51);}};}function respondWithFilteredResult(_0xf55db8,_0x44a6bd){return function(_0x3712e6){if(_0x3712e6){var _0x2d85ba=typeof _0x44a6bd['offset']===_0xedfd('0x1f')&&typeof _0x44a6bd[_0xedfd('0x20')]===_0xedfd('0x1f');var _0x1ca880=_0x3712e6['count'];var _0x18d34a=_0x2d85ba?0x0:_0x44a6bd['offset'];var _0x5e2d68=_0x2d85ba?_0x3712e6[_0xedfd('0x21')]:_0x44a6bd[_0xedfd('0x22')]+_0x44a6bd[_0xedfd('0x20')];var _0x405b0b;if(_0x5e2d68>=_0x1ca880){_0x5e2d68=_0x1ca880;_0x405b0b=0xc8;}else{_0x405b0b=0xce;}_0xf55db8[_0xedfd('0x1c')](_0x405b0b);return _0xf55db8['set']('Content-Range',_0x18d34a+'-'+_0x5e2d68+'/'+_0x1ca880)[_0xedfd('0x1e')](_0x3712e6);}return null;};}function patchUpdates(_0x3192b4){return function(_0x3147f1){try{jsonpatch[_0xedfd('0x23')](_0x3147f1,_0x3192b4,!![]);}catch(_0x1b2ec8){return BPromise[_0xedfd('0x24')](_0x1b2ec8);}return _0x3147f1['save']();};}function saveUpdates(_0x4e63e0,_0x5f5385){return function(_0x49c95f){if(_0x49c95f){return _0x49c95f[_0xedfd('0x25')](_0x4e63e0)[_0xedfd('0x26')](function(_0x13fdd2){return _0x13fdd2;});}return null;};}function handleEntityNotFound(_0x2ece58,_0x47c633){return function(_0x4d79c5){if(!_0x4d79c5){_0x2ece58[_0xedfd('0x1b')](0x194);}return _0x4d79c5;};}function handleError(_0x4f48dc,_0x535d0c){_0x535d0c=_0x535d0c||0x1f4;return function(_0x529d2e){logger[_0xedfd('0x27')](_0x529d2e[_0xedfd('0x28')]);if(_0x529d2e[_0xedfd('0x29')]){delete _0x529d2e[_0xedfd('0x29')];}_0x4f48dc[_0xedfd('0x1c')](_0x535d0c)[_0xedfd('0x2a')](_0x529d2e);};}exports[_0xedfd('0x2b')]=function(_0x1cf4ec,_0x510c96){var _0x1c1126={},_0x1bec10={},_0x58e49a={'count':0x0,'rows':[]};var _0x1176d3=_[_0xedfd('0x2c')](db[_0xedfd('0x2d')]['rawAttributes'],function(_0x59d3bf){return{'name':_0x59d3bf[_0xedfd('0x2e')],'type':_0x59d3bf[_0xedfd('0x2f')][_0xedfd('0x30')]};});_0x1bec10[_0xedfd('0x31')]=_[_0xedfd('0x2c')](_0x1176d3,_0xedfd('0x29'));_0x1bec10[_0xedfd('0x32')]=_[_0xedfd('0x33')](_0x1cf4ec[_0xedfd('0x32')]);_0x1bec10[_0xedfd('0x34')]=_['intersection'](_0x1bec10[_0xedfd('0x31')],_0x1bec10['query']);_0x1c1126[_0xedfd('0x35')]=_[_0xedfd('0x36')](_0x1bec10[_0xedfd('0x31')],qs[_0xedfd('0x37')](_0x1cf4ec[_0xedfd('0x32')]['fields']));_0x1c1126[_0xedfd('0x35')]=_0x1c1126[_0xedfd('0x35')][_0xedfd('0x38')]?_0x1c1126[_0xedfd('0x35')]:_0x1bec10[_0xedfd('0x31')];if(!_0x1cf4ec['query'][_0xedfd('0x39')](_0xedfd('0x3a'))){_0x1c1126[_0xedfd('0x20')]=qs['limit'](_0x1cf4ec[_0xedfd('0x32')]['limit']);_0x1c1126['offset']=qs['offset'](_0x1cf4ec[_0xedfd('0x32')][_0xedfd('0x22')]);}_0x1c1126[_0xedfd('0x3b')]=qs[_0xedfd('0x3c')](_0x1cf4ec['query'][_0xedfd('0x3c')]);_0x1c1126['where']=qs[_0xedfd('0x34')](_[_0xedfd('0x3d')](_0x1cf4ec['query'],_0x1bec10[_0xedfd('0x34')]),_0x1176d3);if(_0x1cf4ec[_0xedfd('0x32')]['filter']){_0x1c1126[_0xedfd('0x3e')]=_[_0xedfd('0x3f')](_0x1c1126['where'],{'$or':_[_0xedfd('0x2c')](_0x1176d3,function(_0x32eae3){if(_0x32eae3[_0xedfd('0x2f')]!==_0xedfd('0x40')){var _0x5e68d3={};_0x5e68d3[_0x32eae3['name']]={'$like':'%'+_0x1cf4ec['query'][_0xedfd('0x41')]+'%'};return _0x5e68d3;}})});}_0x1c1126=_['merge']({},_0x1c1126,_0x1cf4ec[_0xedfd('0x42')]);var _0x376db0={'where':_0x1c1126[_0xedfd('0x3e')]};return db[_0xedfd('0x2d')]['count'](_0x376db0)[_0xedfd('0x26')](function(_0x4dd77a){_0x58e49a[_0xedfd('0x21')]=_0x4dd77a;if(_0x1cf4ec[_0xedfd('0x32')][_0xedfd('0x43')]){_0x1c1126[_0xedfd('0x44')]=[{'all':!![]}];}return db['Team'][_0xedfd('0x45')](_0x1c1126);})['then'](function(_0x273e87){_0x58e49a['rows']=_0x273e87;return _0x58e49a;})[_0xedfd('0x26')](respondWithFilteredResult(_0x510c96,_0x1c1126))[_0xedfd('0x46')](handleError(_0x510c96,null));};exports['show']=function(_0x1c9688,_0x375b1a){var _0x46051d={'raw':![],'where':{'id':_0x1c9688[_0xedfd('0x47')]['id']}},_0x3bf5db={};_0x3bf5db['model']=_['keys'](db[_0xedfd('0x2d')][_0xedfd('0x48')]);_0x3bf5db[_0xedfd('0x32')]=_[_0xedfd('0x33')](_0x1c9688[_0xedfd('0x32')]);_0x3bf5db['filters']=_['intersection'](_0x3bf5db[_0xedfd('0x31')],_0x3bf5db[_0xedfd('0x32')]);_0x46051d[_0xedfd('0x35')]=_[_0xedfd('0x36')](_0x3bf5db[_0xedfd('0x31')],qs[_0xedfd('0x37')](_0x1c9688[_0xedfd('0x32')][_0xedfd('0x37')]));_0x46051d[_0xedfd('0x35')]=_0x46051d[_0xedfd('0x35')][_0xedfd('0x38')]?_0x46051d['attributes']:_0x3bf5db[_0xedfd('0x31')];if(_0x1c9688['query']['includeAll']){_0x46051d[_0xedfd('0x44')]=[{'all':!![]}];}_0x46051d=_[_0xedfd('0x3f')]({},_0x46051d,_0x1c9688[_0xedfd('0x42')]);return db[_0xedfd('0x2d')][_0xedfd('0x49')](_0x46051d)[_0xedfd('0x26')](handleEntityNotFound(_0x375b1a,null))[_0xedfd('0x26')](respondWithResult(_0x375b1a,null))['catch'](handleError(_0x375b1a,null));};exports[_0xedfd('0x4a')]=function(_0x6dc2e,_0xeca0a4){return db[_0xedfd('0x2d')][_0xedfd('0x4a')](_0x6dc2e['body'],{})[_0xedfd('0x26')](function(_0x19750b){var _0x1d4efd=_0x6dc2e[_0xedfd('0x4b')]['get']({'plain':!![]});if(!_0x1d4efd)throw new Error(_0xedfd('0x4c'));if(_0x1d4efd['role']===_0xedfd('0x4b')){var _0x26ec90=_0x19750b['get']({'plain':!![]});var _0x17fbed='Teams';return db[_0xedfd('0x4d')][_0xedfd('0x49')]({'where':{'name':_0x17fbed,'userProfileId':_0x1d4efd[_0xedfd('0x4e')]},'raw':!![]})['then'](function(_0x787394){if(_0x787394&&_0x787394[_0xedfd('0x4f')]===0x0){return db[_0xedfd('0x50')][_0xedfd('0x4a')]({'name':_0x26ec90[_0xedfd('0x29')],'resourceId':_0x26ec90['id'],'type':_0x787394[_0xedfd('0x29')],'sectionId':_0x787394['id']},{})[_0xedfd('0x26')](function(){return _0x19750b;});}else{return _0x19750b;}})['catch'](function(_0x1e3e66){logger[_0xedfd('0x27')](_0xedfd('0x51'),_0x1e3e66);throw _0x1e3e66;});}return _0x19750b;})[_0xedfd('0x26')](respondWithResult(_0xeca0a4,0xc9))[_0xedfd('0x46')](handleError(_0xeca0a4,null));};exports[_0xedfd('0x25')]=function(_0x1620c0,_0x47962d){if(_0x1620c0[_0xedfd('0x52')]['id']){delete _0x1620c0[_0xedfd('0x52')]['id'];}return db[_0xedfd('0x2d')][_0xedfd('0x49')]({'where':{'id':_0x1620c0['params']['id']}})[_0xedfd('0x26')](handleEntityNotFound(_0x47962d,null))[_0xedfd('0x26')](saveUpdates(_0x1620c0['body'],null))[_0xedfd('0x26')](respondWithResult(_0x47962d,null))['catch'](handleError(_0x47962d,null));};exports[_0xedfd('0x53')]=function(_0x41ccc3,_0x27f3d7){var _0x1efb11=_0x41ccc3[_0xedfd('0x47')]['id'];var _0x3a8067=[];return db[_0xedfd('0x54')][_0xedfd('0x55')](function(_0x2fd2a1){var _0x370841='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x1efb11;return db[_0xedfd('0x54')]['query'](_0x370841,{'type':db[_0xedfd('0x56')][_0xedfd('0x57')][_0xedfd('0x58')],'raw':!![],'transaction':_0x2fd2a1})[_0xedfd('0x26')](function(_0x491e2c){_0x3a8067=_[_0xedfd('0x2c')](_0x491e2c,function(_0x13deb6){return Number(_0x13deb6[_0xedfd('0x59')]);});})[_0xedfd('0x26')](function(){var _0x2d7a7e=_0xedfd('0x5a')+_0x1efb11;return db['sequelize'][_0xedfd('0x32')](_0x2d7a7e,{'type':db[_0xedfd('0x56')][_0xedfd('0x57')][_0xedfd('0x58')],'raw':!![],'transaction':_0x2fd2a1});})['then'](function(_0x56dd3b){var _0x4d4239=_[_0xedfd('0x2c')](_0x56dd3b,function(_0x31dd63){return Number(_0x31dd63[_0xedfd('0x5b')]);});return db[_0xedfd('0x5c')][_0xedfd('0x53')]({'where':{'UserId':{'$in':_0x3a8067},'VoiceQueueId':{'$in':_0x4d4239}},'transaction':_0x2fd2a1});})[_0xedfd('0x26')](function(){var _0x331c13=_0xedfd('0x5d')+_0x1efb11;return db['sequelize'][_0xedfd('0x32')](_0x331c13,{'type':db['Sequelize'][_0xedfd('0x57')][_0xedfd('0x58')],'raw':!![],'transaction':_0x2fd2a1});})[_0xedfd('0x26')](function(_0x7f3dea){var _0x9b99ec=_[_0xedfd('0x2c')](_0x7f3dea,function(_0x2d9880){return Number(_0x2d9880[_0xedfd('0x5e')]);});return db[_0xedfd('0x5f')][_0xedfd('0x53')]({'where':{'UserId':{'$in':_0x3a8067},'MailQueueId':{'$in':_0x9b99ec}},'transaction':_0x2fd2a1});})[_0xedfd('0x26')](function(){var _0x41428a=_0xedfd('0x60')+_0x1efb11;return db[_0xedfd('0x54')]['query'](_0x41428a,{'type':db[_0xedfd('0x56')][_0xedfd('0x57')][_0xedfd('0x58')],'raw':!![],'transaction':_0x2fd2a1});})[_0xedfd('0x26')](function(_0xdb5fea){var _0x146e41=_[_0xedfd('0x2c')](_0xdb5fea,function(_0x5c64ce){return Number(_0x5c64ce['SmsQueueId']);});return db[_0xedfd('0x61')][_0xedfd('0x53')]({'where':{'UserId':{'$in':_0x3a8067},'SmsQueueId':{'$in':_0x146e41}},'transaction':_0x2fd2a1});})[_0xedfd('0x26')](function(){var _0x61ba7a=_0xedfd('0x62')+_0x1efb11;return db[_0xedfd('0x54')][_0xedfd('0x32')](_0x61ba7a,{'type':db[_0xedfd('0x56')]['QueryTypes'][_0xedfd('0x58')],'raw':!![],'transaction':_0x2fd2a1});})['then'](function(_0x2ad53f){var _0x1558cc=_[_0xedfd('0x2c')](_0x2ad53f,function(_0x532e3a){return Number(_0x532e3a[_0xedfd('0x63')]);});return db[_0xedfd('0x64')][_0xedfd('0x53')]({'where':{'UserId':{'$in':_0x3a8067},'ChatQueueId':{'$in':_0x1558cc}},'transaction':_0x2fd2a1});})[_0xedfd('0x26')](function(){var _0x6b07d6='SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'+_0x1efb11;return db[_0xedfd('0x54')][_0xedfd('0x32')](_0x6b07d6,{'type':db[_0xedfd('0x56')]['QueryTypes'][_0xedfd('0x58')],'raw':!![],'transaction':_0x2fd2a1});})[_0xedfd('0x26')](function(_0x413019){var _0x15c329=_[_0xedfd('0x2c')](_0x413019,function(_0x17fb97){return Number(_0x17fb97[_0xedfd('0x65')]);});return db['UserFaxQueue'][_0xedfd('0x53')]({'where':{'UserId':{'$in':_0x3a8067},'FaxQueueId':{'$in':_0x15c329}},'transaction':_0x2fd2a1});})[_0xedfd('0x26')](function(){var _0x2ea740=_0xedfd('0x66')+_0x1efb11;return db['sequelize'][_0xedfd('0x32')](_0x2ea740,{'type':db[_0xedfd('0x56')][_0xedfd('0x57')][_0xedfd('0x58')],'raw':!![],'transaction':_0x2fd2a1});})[_0xedfd('0x26')](function(_0x4de8ba){var _0x34b46b=_[_0xedfd('0x2c')](_0x4de8ba,function(_0x284233){return Number(_0x284233[_0xedfd('0x67')]);});return db[_0xedfd('0x68')][_0xedfd('0x53')]({'where':{'UserId':{'$in':_0x3a8067},'OpenchannelQueueId':{'$in':_0x34b46b}},'transaction':_0x2fd2a1});})['then'](function(){var _0x2185dd=_0xedfd('0x69')+_0x1efb11;return db[_0xedfd('0x54')]['query'](_0x2185dd,{'type':db[_0xedfd('0x56')][_0xedfd('0x57')][_0xedfd('0x58')],'raw':!![],'transaction':_0x2fd2a1});})[_0xedfd('0x26')](function(_0x28737d){var _0xc54f3c=_['map'](_0x28737d,function(_0xd639e5){return Number(_0xd639e5[_0xedfd('0x6a')]);});return db[_0xedfd('0x6b')][_0xedfd('0x53')]({'where':{'UserId':{'$in':_0x3a8067},'WhatsappQueueId':{'$in':_0xc54f3c}},'transaction':_0x2fd2a1});})[_0xedfd('0x26')](function(){return db[_0xedfd('0x6c')][_0xedfd('0x49')]({'where':{'TeamId':_0x1efb11}});})[_0xedfd('0x26')](function(_0x3c39a9){if(_0x3c39a9===null){return;}return db['UserVoicePrefix'][_0xedfd('0x53')]({'where':{'UserId':{'$in':_0x3a8067},'VoicePrefixId':_0x3c39a9[_0xedfd('0x6d')]},'transaction':_0x2fd2a1});})[_0xedfd('0x26')](function(){return db[_0xedfd('0x2d')][_0xedfd('0x53')]({'where':{'id':_0x1efb11},'cascade':!![],'transaction':_0x2fd2a1});})['then'](function(_0x4fd642){if(_0x4fd642===0x0){_0x27f3d7['sendStatus'](0x194);}else{return db[_0xedfd('0x50')][_0xedfd('0x53')]({'where':{'type':'Teams','resourceId':_0x1efb11},'cascade':!![],'transaction':_0x2fd2a1})['then'](function(){_0x27f3d7[_0xedfd('0x1c')](0xcc)['end']();});}})['catch'](function(_0x21bbc3){_0x27f3d7[_0xedfd('0x1c')](0x1f4)['send'](_0x21bbc3);});});};exports['getQueues']=function(_0x5b78dd,_0x4193b0,_0x53e30f){return db[_0xedfd('0x2d')][_0xedfd('0x6e')]({'where':{'id':_0x5b78dd['params']['id']}})[_0xedfd('0x26')](handleEntityNotFound(_0x4193b0,null))[_0xedfd('0x26')](function(_0xbdfa15){if(!_0x5b78dd[_0xedfd('0x32')][_0xedfd('0x6f')]||!utils[_0xedfd('0x70')](_0x5b78dd[_0xedfd('0x32')][_0xedfd('0x6f')])){throw new db[(_0xedfd('0x56'))]['ValidationError'](_0xedfd('0x71'));}var _0x492040={};var _0x52e7b6={};_0x52e7b6[_0xedfd('0x31')]=_[_0xedfd('0x33')](db[_['capitalize'](_0x5b78dd[_0xedfd('0x32')]['channel'][_0xedfd('0x72')]())+_0xedfd('0x73')][_0xedfd('0x48')]);_0x52e7b6[_0xedfd('0x32')]=_[_0xedfd('0x33')](_0x5b78dd[_0xedfd('0x32')]);_0x52e7b6[_0xedfd('0x34')]=_[_0xedfd('0x36')](_0x52e7b6[_0xedfd('0x31')],_0x52e7b6['query']);_0x492040[_0xedfd('0x35')]=_[_0xedfd('0x36')](_0x52e7b6['model'],qs[_0xedfd('0x37')](_0x5b78dd[_0xedfd('0x32')][_0xedfd('0x37')]));_0x492040['attributes']=_0x492040[_0xedfd('0x35')]['length']?_0x492040['attributes']:_0x52e7b6[_0xedfd('0x31')];_0x492040[_0xedfd('0x20')]=qs[_0xedfd('0x20')](_0x5b78dd[_0xedfd('0x32')][_0xedfd('0x20')]);_0x492040['offset']=qs[_0xedfd('0x22')](_0x5b78dd['query'][_0xedfd('0x22')]);_0x492040[_0xedfd('0x3b')]=qs[_0xedfd('0x3c')](_0x5b78dd['query'][_0xedfd('0x3c')]);_0x492040[_0xedfd('0x3e')]=qs[_0xedfd('0x34')](_[_0xedfd('0x3d')](_0x5b78dd[_0xedfd('0x32')],_0x52e7b6[_0xedfd('0x34')]));_0x492040=_['merge']({},_0x492040,_0x5b78dd[_0xedfd('0x42')]);return _0xbdfa15[_0xedfd('0x74')+_[_0xedfd('0x75')](_0x5b78dd['query'][_0xedfd('0x6f')]['toLowerCase']())+_0xedfd('0x76')](_0x492040);})['then'](respondWithResult(_0x4193b0,null))[_0xedfd('0x46')](handleError(_0x4193b0,null));};exports[_0xedfd('0x77')]=function(_0x339d1f,_0x15b7a2,_0xe3cbdf){return db[_0xedfd('0x2d')][_0xedfd('0x6e')]({'where':{'id':_0x339d1f[_0xedfd('0x47')]['id']}})['then'](function(_0x5f2491){if(_0x5f2491){if(!_0x339d1f['body']['channel']||!utils['isValidChannel'](_0x339d1f['body'][_0xedfd('0x6f')])){throw new db[(_0xedfd('0x56'))][(_0xedfd('0x78'))](_0xedfd('0x71'));}return _0x5f2491[_0xedfd('0x79')+_[_0xedfd('0x75')](_0x339d1f[_0xedfd('0x52')][_0xedfd('0x6f')][_0xedfd('0x72')]())+_0xedfd('0x76')](_0x339d1f[_0xedfd('0x52')][_0xedfd('0x7a')]);}return null;})[_0xedfd('0x26')](handleEntityNotFound(_0x15b7a2,null))[_0xedfd('0x26')](respondWithStatusCode(_0x15b7a2,null))[_0xedfd('0x46')](handleError(_0x15b7a2,null));};exports[_0xedfd('0x7b')]=function(_0xc0138e,_0x5885eb,_0x419aac){return db[_0xedfd('0x2d')]['findOne']({'where':{'id':_0xc0138e[_0xedfd('0x47')]['id']}})[_0xedfd('0x26')](function(_0xc4c289){if(_0xc4c289){if(!_0xc0138e['query'][_0xedfd('0x6f')]||!utils['isValidChannel'](_0xc0138e[_0xedfd('0x32')][_0xedfd('0x6f')])){throw new db[(_0xedfd('0x56'))][(_0xedfd('0x78'))]('Unknown\x20channel');}return _0xc4c289['remove'+_['capitalize'](_0xc0138e[_0xedfd('0x32')][_0xedfd('0x6f')][_0xedfd('0x72')]())+_0xedfd('0x76')](_0xc0138e[_0xedfd('0x32')]['ids']);}return null;})[_0xedfd('0x26')](handleEntityNotFound(_0x5885eb,null))[_0xedfd('0x26')](respondWithStatusCode(_0x5885eb,null))['catch'](handleError(_0x5885eb,null));};exports[_0xedfd('0x7c')]=function(_0x119364,_0x46b9cf){var _0x169e9f=_[_0xedfd('0x7d')](_0x119364['body']['ids'])?_0x119364[_0xedfd('0x52')][_0xedfd('0x7a')]:[_0x119364[_0xedfd('0x52')][_0xedfd('0x7a')]];var _0x13fdc4=_0x119364[_0xedfd('0x47')]['id'];return db[_0xedfd('0x2d')][_0xedfd('0x49')]({'where':{'id':_0x13fdc4}})[_0xedfd('0x26')](handleEntityNotFound(_0x46b9cf,null))[_0xedfd('0x26')](function(_0x4026ed){if(_0x4026ed){var _0x255bec=[_0xedfd('0x7e'),'Chat',_0xedfd('0x7f'),'Sms',_0xedfd('0x80'),_0xedfd('0x81'),'Whatsapp'];return db['sequelize'][_0xedfd('0x55')](function(_0x164791){var _0xc383a2=_[_0xedfd('0x2c')](_0x255bec,function(_0x170b2e){var _0x573ead={'attributes':['id',_0xedfd('0x29')]};if(_0x170b2e==='Voice'){_0x573ead[_0xedfd('0x82')]={'attributes':[_0xedfd('0x83')]};}return _0x4026ed[_0xedfd('0x74')+_0x170b2e+_0xedfd('0x76')](_0x573ead)[_0xedfd('0x26')](function(_0xa2005){var _0xb0addf=_[_0xedfd('0x2c')](_0xa2005,function(_0x1d2c7f){var _0x5e6529=_[_0xedfd('0x2c')](_0x169e9f,function(_0x321cab){var _0x1466b7={'where':{'UserId':_0x321cab,[_0x170b2e+'QueueId']:_0x1d2c7f['id']},'transaction':_0x164791};if(_0x170b2e===_0xedfd('0x7e')){_0x1466b7['defaults']={'penalty':_0x1d2c7f['TeamVoiceQueue'][_0xedfd('0x83')]};}return db['User'+_0x170b2e+'Queue'][_0xedfd('0x84')](_0x1466b7)['then'](function(){socket[_0xedfd('0x85')]('user'+_0x170b2e+'Queue:save',{'UserId':_0x321cab,[_0x170b2e+_0xedfd('0x86')]:_0x1d2c7f['id']});if(_0x170b2e!=='Voice'){return;}return db[_0xedfd('0x87')][_0xedfd('0x45')]({'where':{'id':_0x169e9f,'online':0x1},'attributes':['id',_0xedfd('0x29'),_0xedfd('0x88'),'voicePause',_0xedfd('0x89')],'raw':!![]})[_0xedfd('0x26')](function(_0x205870){var _0x1d1046=_[_0xedfd('0x2c')](_0x205870,function(_0x38cbb1){return db[_0xedfd('0x8a')]['upsert']({'membername':_0x38cbb1[_0xedfd('0x29')],'UserId':_0x38cbb1['id'],'queue_name':_0x1d2c7f[_0xedfd('0x29')],'VoiceQueueId':_0x1d2c7f['id'],'interface':_[_0xedfd('0x8b')](_0x38cbb1[_0xedfd('0x89')])?util[_0xedfd('0x8c')](_0xedfd('0x8d'),_0x38cbb1[_0xedfd('0x29')]):_0x38cbb1[_0xedfd('0x89')],'paused':_0x38cbb1[_0xedfd('0x8e')]||![],'penalty':_0x1d2c7f[_0xedfd('0x8f')][_0xedfd('0x83')]},{'transaction':_0x164791});});return Promise['all'](_0x1d1046);});});});return Promise[_0xedfd('0x90')](_0x5e6529);});return Promise[_0xedfd('0x90')](_0xb0addf);})[_0xedfd('0x26')](function(){return db['TeamVoicePrefix'][_0xedfd('0x6e')]({'where':{'teamId':_0x13fdc4}})[_0xedfd('0x26')](function(_0x5a61b8){if(_0x5a61b8){var _0x756931=_[_0xedfd('0x2c')](_0x169e9f,function(_0x1c4fc7){db[_0xedfd('0x91')]['upsert']({'UserId':_0x1c4fc7,'VoicePrefixId':_0x5a61b8[_0xedfd('0x6d')]});});return Promise[_0xedfd('0x90')](_0x756931);}});});});return Promise[_0xedfd('0x90')](_0xc383a2)[_0xedfd('0x26')](function(){return _0x4026ed[_0xedfd('0x7c')](_0x169e9f,{'transaction':_0x164791})[_0xedfd('0x92')](function(_0x1c3d69){return _0x1c3d69;});});});}})['then'](respondWithResult(_0x46b9cf,null))[_0xedfd('0x46')](handleError(_0x46b9cf,null));};exports[_0xedfd('0x93')]=function(_0xbf953c,_0x465ad8){var _0x3d492c=_['isArray'](_0xbf953c['query'][_0xedfd('0x7a')])?_0xbf953c[_0xedfd('0x32')][_0xedfd('0x7a')]:[_0xbf953c['query']['ids']];var _0x2604ff=_0xbf953c[_0xedfd('0x47')]['id'];return db[_0xedfd('0x2d')][_0xedfd('0x49')]({'where':{'id':_0x2604ff}})[_0xedfd('0x26')](handleEntityNotFound(_0x465ad8,null))['then'](function(_0x1b2c7d){if(_0x1b2c7d){var _0x1256eb=[_0xedfd('0x7e'),'Chat',_0xedfd('0x7f'),_0xedfd('0x94'),_0xedfd('0x80'),_0xedfd('0x81'),_0xedfd('0x95')];return db['sequelize'][_0xedfd('0x55')](function(_0x40adac){var _0x458a0b=_[_0xedfd('0x2c')](_0x1256eb,function(_0x5dc278){var _0x48774e={'attributes':['id','name']};return _0x1b2c7d[_0xedfd('0x74')+_0x5dc278+_0xedfd('0x76')](_0x48774e)[_0xedfd('0x26')](function(_0x211069){var _0x4424dc=_[_0xedfd('0x2c')](_0x211069,function(_0x3a6329){return _0x3a6329[_0xedfd('0x93')](_0x3d492c,{'transaction':_0x40adac})[_0xedfd('0x26')](function(){var _0x5bd249=_[_0xedfd('0x2c')](_0x3d492c,function(_0x51678d){socket['emit'](_0xedfd('0x4b')+_0x5dc278+_0xedfd('0x96'),{'UserId':Number(_0x51678d),[_0x5dc278+'QueueId']:_0x3a6329['id']});if(_0x5dc278!==_0xedfd('0x7e')){return;}return db[_0xedfd('0x8a')][_0xedfd('0x53')]({'where':{'VoiceQueueId':_0x3a6329['id'],'UserId':_0x51678d},'transaction':_0x40adac});});return Promise['all'](_0x5bd249);});});return Promise['all'](_0x4424dc);});});return Promise[_0xedfd('0x90')](_0x458a0b)[_0xedfd('0x26')](function(){return _0x1b2c7d[_0xedfd('0x93')](_0x3d492c,{'transaction':_0x40adac});})[_0xedfd('0x26')](function(){return db[_0xedfd('0x6c')][_0xedfd('0x6e')]({'where':{'teamId':_0x2604ff}})[_0xedfd('0x26')](function(_0x50870d){if(_0x50870d){var _0x392678=_[_0xedfd('0x2c')](_0x3d492c,function(_0x3a6c10){db[_0xedfd('0x91')]['destroy']({'where':{'UserId':_0x3a6c10,'VoicePrefixId':_0x50870d[_0xedfd('0x6d')]}});});return Promise[_0xedfd('0x90')](_0x392678);}});});});}})[_0xedfd('0x26')](respondWithStatusCode(_0x465ad8,null))[_0xedfd('0x46')](handleError(_0x465ad8,null));};exports[_0xedfd('0x97')]=function(_0x17eaad,_0x137c18,_0x1d5912){var _0x9f495c={};var _0x1cc0ee={};var _0x4239a9;var _0x509bfe;return db[_0xedfd('0x2d')]['findOne']({'where':{'id':_0x17eaad[_0xedfd('0x47')]['id']}})[_0xedfd('0x26')](handleEntityNotFound(_0x137c18,null))['then'](function(_0x3300f8){if(_0x3300f8){_0x4239a9=_0x3300f8;_0x1cc0ee[_0xedfd('0x31')]=_[_0xedfd('0x33')](db['User']['rawAttributes']);_0x1cc0ee['query']=_[_0xedfd('0x33')](_0x17eaad[_0xedfd('0x32')]);_0x1cc0ee[_0xedfd('0x34')]=_[_0xedfd('0x36')](_0x1cc0ee[_0xedfd('0x31')],_0x1cc0ee[_0xedfd('0x32')]);_0x9f495c[_0xedfd('0x35')]=_[_0xedfd('0x36')](_0x1cc0ee[_0xedfd('0x31')],qs[_0xedfd('0x37')](_0x17eaad['query']['fields']));_0x9f495c[_0xedfd('0x35')]=_0x9f495c[_0xedfd('0x35')]['length']?_0x9f495c[_0xedfd('0x35')]:_0x1cc0ee['model'];_0x9f495c[_0xedfd('0x3b')]=qs[_0xedfd('0x3c')](_0x17eaad[_0xedfd('0x32')][_0xedfd('0x3c')]);_0x9f495c[_0xedfd('0x3e')]=qs[_0xedfd('0x34')](_[_0xedfd('0x3d')](_0x17eaad[_0xedfd('0x32')],_0x1cc0ee[_0xedfd('0x34')]));if(_0x17eaad[_0xedfd('0x32')][_0xedfd('0x41')]){_0x9f495c[_0xedfd('0x3e')]=_['merge'](_0x9f495c[_0xedfd('0x3e')],{'$or':_[_0xedfd('0x2c')](_0x9f495c['attributes'],function(_0x25f719){var _0x38818d={};_0x38818d[_0x25f719]={'$like':'%'+_0x17eaad[_0xedfd('0x32')][_0xedfd('0x41')]+'%'};return _0x38818d;})});}_0x9f495c=_[_0xedfd('0x3f')]({},_0x9f495c,_0x17eaad[_0xedfd('0x42')]);return _0x4239a9['getAgents'](_0x9f495c);}})[_0xedfd('0x26')](function(_0x1eab2a){if(_0x1eab2a){_0x509bfe=_0x1eab2a[_0xedfd('0x38')];if(!_0x17eaad[_0xedfd('0x32')][_0xedfd('0x39')]('nolimit')){_0x9f495c[_0xedfd('0x20')]=qs[_0xedfd('0x20')](_0x17eaad['query'][_0xedfd('0x20')]);_0x9f495c[_0xedfd('0x22')]=qs[_0xedfd('0x22')](_0x17eaad['query'][_0xedfd('0x22')]);}return _0x4239a9['getAgents'](_0x9f495c);}})['then'](function(_0x4ee905){if(_0x4ee905){return _0x4ee905?{'count':_0x509bfe,'rows':_0x4ee905}:null;}})['then'](respondWithResult(_0x137c18,null))[_0xedfd('0x46')](handleError(_0x137c18,null));}; \ No newline at end of file +var _0x855e=['TeamVoiceQueue','User','findOrCreate','emit','QueueId','online','voicePause','interface','UserVoiceQueueRt','upsert','isNil','all','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','spread','removeAgents','Whatsapp','Queue:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./team.socket','register','status','end','offset','undefined','limit','json','apply','reject','update','then','sendStatus','error','stack','name','map','rawAttributes','fieldName','type','key','query','keys','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','Team','count','include','findAll','rows','show','params','includeAll','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','sequelize','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','SELECT','VoiceQueueId','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','UserProfileResource','send','channel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','addQueues','findOne','Queues','ids','removeQueues','isValidChannel','remove','addAgents','isArray','Voice','Chat','Sms','Fax','Openchannel','transaction','through','penalty','defaults'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x855e,0x146));var _0xe855=function(_0x275fa1,_0x28af28){_0x275fa1=_0x275fa1-0x0;var _0x5c04db=_0x855e[_0x275fa1];return _0x5c04db;};'use strict';var emlformat=require(_0xe855('0x0'));var rimraf=require(_0xe855('0x1'));var zipdir=require(_0xe855('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe855('0x3'));var moment=require('moment');var BPromise=require(_0xe855('0x4'));var Mustache=require('mustache');var util=require(_0xe855('0x5'));var path=require(_0xe855('0x6'));var sox=require('sox');var csv=require(_0xe855('0x7'));var ejs=require(_0xe855('0x8'));var fs=require('fs');var fs_extra=require(_0xe855('0x9'));var _=require('lodash');var squel=require(_0xe855('0xa'));var crypto=require(_0xe855('0xb'));var jsforce=require(_0xe855('0xc'));var deskjs=require(_0xe855('0xd'));var toCsv=require(_0xe855('0x7'));var querystring=require(_0xe855('0xe'));var Papa=require(_0xe855('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe855('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe855('0x11'));var logger=require(_0xe855('0x12'))(_0xe855('0x13'));var utils=require(_0xe855('0x14'));var config=require(_0xe855('0x15'));var licenseUtil=require(_0xe855('0x16'));var db=require(_0xe855('0x17'))['db'];config['redis']=_['defaults'](config[_0xe855('0x18')],{'host':_0xe855('0x19'),'port':0x18eb});var socket=require(_0xe855('0x1a'))(new Redis(config[_0xe855('0x18')]));require(_0xe855('0x1b'))[_0xe855('0x1c')](socket);function respondWithStatusCode(_0x3fa9e3,_0x15cdd1){_0x15cdd1=_0x15cdd1||0xcc;return function(_0x24dd78){if(_0x24dd78){return _0x3fa9e3['sendStatus'](_0x15cdd1);}return _0x3fa9e3[_0xe855('0x1d')](_0x15cdd1)[_0xe855('0x1e')]();};}function respondWithResult(_0x49c438,_0x42f5ad){_0x42f5ad=_0x42f5ad||0xc8;return function(_0x1805ba){if(_0x1805ba){return _0x49c438[_0xe855('0x1d')](_0x42f5ad)['json'](_0x1805ba);}};}function respondWithFilteredResult(_0x37447f,_0x1b1a2a){return function(_0x359d81){if(_0x359d81){var _0x285ee5=typeof _0x1b1a2a[_0xe855('0x1f')]===_0xe855('0x20')&&typeof _0x1b1a2a[_0xe855('0x21')]==='undefined';var _0x1183a0=_0x359d81['count'];var _0x5592be=_0x285ee5?0x0:_0x1b1a2a['offset'];var _0x2d0b61=_0x285ee5?_0x359d81['count']:_0x1b1a2a[_0xe855('0x1f')]+_0x1b1a2a[_0xe855('0x21')];var _0x4d84b8;if(_0x2d0b61>=_0x1183a0){_0x2d0b61=_0x1183a0;_0x4d84b8=0xc8;}else{_0x4d84b8=0xce;}_0x37447f[_0xe855('0x1d')](_0x4d84b8);return _0x37447f['set']('Content-Range',_0x5592be+'-'+_0x2d0b61+'/'+_0x1183a0)[_0xe855('0x22')](_0x359d81);}return null;};}function patchUpdates(_0x36271b){return function(_0x3081ff){try{jsonpatch[_0xe855('0x23')](_0x3081ff,_0x36271b,!![]);}catch(_0x10536a){return BPromise[_0xe855('0x24')](_0x10536a);}return _0x3081ff['save']();};}function saveUpdates(_0x3419fe,_0x4fd7ee){return function(_0x1b6ac6){if(_0x1b6ac6){return _0x1b6ac6[_0xe855('0x25')](_0x3419fe)[_0xe855('0x26')](function(_0x3b6b95){return _0x3b6b95;});}return null;};}function handleEntityNotFound(_0x4fc339,_0x474216){return function(_0xfbcda0){if(!_0xfbcda0){_0x4fc339[_0xe855('0x27')](0x194);}return _0xfbcda0;};}function handleError(_0x3822ab,_0x1aa372){_0x1aa372=_0x1aa372||0x1f4;return function(_0x4d5b9f){logger[_0xe855('0x28')](_0x4d5b9f[_0xe855('0x29')]);if(_0x4d5b9f[_0xe855('0x2a')]){delete _0x4d5b9f[_0xe855('0x2a')];}_0x3822ab[_0xe855('0x1d')](_0x1aa372)['send'](_0x4d5b9f);};}exports['index']=function(_0x54de1b,_0x11e8b4){var _0x1b001e={},_0x33eb02={},_0x147b9f={'count':0x0,'rows':[]};var _0x2e6f0f=_[_0xe855('0x2b')](db['Team'][_0xe855('0x2c')],function(_0x1646af){return{'name':_0x1646af[_0xe855('0x2d')],'type':_0x1646af[_0xe855('0x2e')][_0xe855('0x2f')]};});_0x33eb02['model']=_['map'](_0x2e6f0f,'name');_0x33eb02[_0xe855('0x30')]=_[_0xe855('0x31')](_0x54de1b[_0xe855('0x30')]);_0x33eb02['filters']=_['intersection'](_0x33eb02['model'],_0x33eb02[_0xe855('0x30')]);_0x1b001e[_0xe855('0x32')]=_[_0xe855('0x33')](_0x33eb02[_0xe855('0x34')],qs[_0xe855('0x35')](_0x54de1b[_0xe855('0x30')][_0xe855('0x35')]));_0x1b001e['attributes']=_0x1b001e[_0xe855('0x32')][_0xe855('0x36')]?_0x1b001e[_0xe855('0x32')]:_0x33eb02['model'];if(!_0x54de1b[_0xe855('0x30')][_0xe855('0x37')](_0xe855('0x38'))){_0x1b001e[_0xe855('0x21')]=qs[_0xe855('0x21')](_0x54de1b[_0xe855('0x30')][_0xe855('0x21')]);_0x1b001e[_0xe855('0x1f')]=qs[_0xe855('0x1f')](_0x54de1b[_0xe855('0x30')][_0xe855('0x1f')]);}_0x1b001e[_0xe855('0x39')]=qs[_0xe855('0x3a')](_0x54de1b[_0xe855('0x30')][_0xe855('0x3a')]);_0x1b001e[_0xe855('0x3b')]=qs[_0xe855('0x3c')](_[_0xe855('0x3d')](_0x54de1b[_0xe855('0x30')],_0x33eb02['filters']),_0x2e6f0f);if(_0x54de1b[_0xe855('0x30')][_0xe855('0x3e')]){_0x1b001e[_0xe855('0x3b')]=_['merge'](_0x1b001e[_0xe855('0x3b')],{'$or':_[_0xe855('0x2b')](_0x2e6f0f,function(_0x1c09d5){if(_0x1c09d5[_0xe855('0x2e')]!==_0xe855('0x3f')){var _0x3b298b={};_0x3b298b[_0x1c09d5['name']]={'$like':'%'+_0x54de1b[_0xe855('0x30')][_0xe855('0x3e')]+'%'};return _0x3b298b;}})});}_0x1b001e=_[_0xe855('0x40')]({},_0x1b001e,_0x54de1b[_0xe855('0x41')]);var _0x19f2cc={'where':_0x1b001e[_0xe855('0x3b')]};return db[_0xe855('0x42')][_0xe855('0x43')](_0x19f2cc)[_0xe855('0x26')](function(_0x930699){_0x147b9f[_0xe855('0x43')]=_0x930699;if(_0x54de1b[_0xe855('0x30')]['includeAll']){_0x1b001e[_0xe855('0x44')]=[{'all':!![]}];}return db[_0xe855('0x42')][_0xe855('0x45')](_0x1b001e);})['then'](function(_0x29e0db){_0x147b9f[_0xe855('0x46')]=_0x29e0db;return _0x147b9f;})['then'](respondWithFilteredResult(_0x11e8b4,_0x1b001e))['catch'](handleError(_0x11e8b4,null));};exports[_0xe855('0x47')]=function(_0x25920d,_0x55e766){var _0x38e942={'raw':![],'where':{'id':_0x25920d[_0xe855('0x48')]['id']}},_0x222a68={};_0x222a68[_0xe855('0x34')]=_[_0xe855('0x31')](db[_0xe855('0x42')][_0xe855('0x2c')]);_0x222a68['query']=_[_0xe855('0x31')](_0x25920d[_0xe855('0x30')]);_0x222a68['filters']=_[_0xe855('0x33')](_0x222a68[_0xe855('0x34')],_0x222a68['query']);_0x38e942[_0xe855('0x32')]=_[_0xe855('0x33')](_0x222a68[_0xe855('0x34')],qs[_0xe855('0x35')](_0x25920d[_0xe855('0x30')][_0xe855('0x35')]));_0x38e942['attributes']=_0x38e942['attributes']['length']?_0x38e942['attributes']:_0x222a68[_0xe855('0x34')];if(_0x25920d[_0xe855('0x30')][_0xe855('0x49')]){_0x38e942[_0xe855('0x44')]=[{'all':!![]}];}_0x38e942=_[_0xe855('0x40')]({},_0x38e942,_0x25920d['options']);return db[_0xe855('0x42')][_0xe855('0x4a')](_0x38e942)['then'](handleEntityNotFound(_0x55e766,null))[_0xe855('0x26')](respondWithResult(_0x55e766,null))[_0xe855('0x4b')](handleError(_0x55e766,null));};exports['create']=function(_0x1c4168,_0x94abd4){return db['Team'][_0xe855('0x4c')](_0x1c4168[_0xe855('0x4d')],{})[_0xe855('0x26')](function(_0x34016d){var _0xf8fb17=_0x1c4168[_0xe855('0x4e')][_0xe855('0x4f')]({'plain':!![]});if(!_0xf8fb17)throw new Error(_0xe855('0x50'));if(_0xf8fb17[_0xe855('0x51')]==='user'){var _0x530f4d=_0x34016d[_0xe855('0x4f')]({'plain':!![]});var _0x121fb1=_0xe855('0x52');return db[_0xe855('0x53')][_0xe855('0x4a')]({'where':{'name':_0x121fb1,'userProfileId':_0xf8fb17[_0xe855('0x54')]},'raw':!![]})[_0xe855('0x26')](function(_0x592267){if(_0x592267&&_0x592267[_0xe855('0x55')]===0x0){return db['UserProfileResource'][_0xe855('0x4c')]({'name':_0x530f4d['name'],'resourceId':_0x530f4d['id'],'type':_0x592267[_0xe855('0x2a')],'sectionId':_0x592267['id']},{})[_0xe855('0x26')](function(){return _0x34016d;});}else{return _0x34016d;}})[_0xe855('0x4b')](function(_0x230fbf){logger['error'](_0xe855('0x56'),_0x230fbf);throw _0x230fbf;});}return _0x34016d;})['then'](respondWithResult(_0x94abd4,0xc9))[_0xe855('0x4b')](handleError(_0x94abd4,null));};exports['update']=function(_0x37d0f4,_0x5e09be){if(_0x37d0f4[_0xe855('0x4d')]['id']){delete _0x37d0f4['body']['id'];}return db[_0xe855('0x42')][_0xe855('0x4a')]({'where':{'id':_0x37d0f4[_0xe855('0x48')]['id']}})[_0xe855('0x26')](handleEntityNotFound(_0x5e09be,null))[_0xe855('0x26')](saveUpdates(_0x37d0f4['body'],null))['then'](respondWithResult(_0x5e09be,null))[_0xe855('0x4b')](handleError(_0x5e09be,null));};exports[_0xe855('0x57')]=function(_0x100ecc,_0x120056){var _0x438a74=_0x100ecc[_0xe855('0x48')]['id'];var _0x53db82=[];return db[_0xe855('0x58')]['transaction'](function(_0x251057){var _0x51a829=_0xe855('0x59')+_0x438a74;return db[_0xe855('0x58')][_0xe855('0x30')](_0x51a829,{'type':db[_0xe855('0x5a')][_0xe855('0x5b')]['SELECT'],'raw':!![],'transaction':_0x251057})['then'](function(_0x3a0a0b){_0x53db82=_[_0xe855('0x2b')](_0x3a0a0b,function(_0x2d17a0){return Number(_0x2d17a0['UserId']);});})[_0xe855('0x26')](function(){var _0x448142=_0xe855('0x5c')+_0x438a74;return db[_0xe855('0x58')][_0xe855('0x30')](_0x448142,{'type':db['Sequelize'][_0xe855('0x5b')][_0xe855('0x5d')],'raw':!![],'transaction':_0x251057});})[_0xe855('0x26')](function(_0x464756){var _0x3139e7=_[_0xe855('0x2b')](_0x464756,function(_0x415461){return Number(_0x415461[_0xe855('0x5e')]);});return db['UserVoiceQueue']['destroy']({'where':{'UserId':{'$in':_0x53db82},'VoiceQueueId':{'$in':_0x3139e7}},'transaction':_0x251057});})[_0xe855('0x26')](function(){var _0x3ea669=_0xe855('0x5f')+_0x438a74;return db['sequelize']['query'](_0x3ea669,{'type':db[_0xe855('0x5a')]['QueryTypes'][_0xe855('0x5d')],'raw':!![],'transaction':_0x251057});})[_0xe855('0x26')](function(_0x458d73){var _0x56bf5c=_['map'](_0x458d73,function(_0xdc8834){return Number(_0xdc8834[_0xe855('0x60')]);});return db[_0xe855('0x61')][_0xe855('0x57')]({'where':{'UserId':{'$in':_0x53db82},'MailQueueId':{'$in':_0x56bf5c}},'transaction':_0x251057});})[_0xe855('0x26')](function(){var _0x412d65=_0xe855('0x62')+_0x438a74;return db[_0xe855('0x58')]['query'](_0x412d65,{'type':db[_0xe855('0x5a')]['QueryTypes'][_0xe855('0x5d')],'raw':!![],'transaction':_0x251057});})['then'](function(_0x440f7c){var _0x4b30c1=_[_0xe855('0x2b')](_0x440f7c,function(_0x562847){return Number(_0x562847[_0xe855('0x63')]);});return db[_0xe855('0x64')]['destroy']({'where':{'UserId':{'$in':_0x53db82},'SmsQueueId':{'$in':_0x4b30c1}},'transaction':_0x251057});})[_0xe855('0x26')](function(){var _0x2e35d2=_0xe855('0x65')+_0x438a74;return db['sequelize'][_0xe855('0x30')](_0x2e35d2,{'type':db['Sequelize'][_0xe855('0x5b')][_0xe855('0x5d')],'raw':!![],'transaction':_0x251057});})[_0xe855('0x26')](function(_0x1189d4){var _0x3ef368=_[_0xe855('0x2b')](_0x1189d4,function(_0x20bfd3){return Number(_0x20bfd3['ChatQueueId']);});return db['UserChatQueue'][_0xe855('0x57')]({'where':{'UserId':{'$in':_0x53db82},'ChatQueueId':{'$in':_0x3ef368}},'transaction':_0x251057});})['then'](function(){var _0x3069a7='SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'+_0x438a74;return db[_0xe855('0x58')][_0xe855('0x30')](_0x3069a7,{'type':db['Sequelize']['QueryTypes'][_0xe855('0x5d')],'raw':!![],'transaction':_0x251057});})['then'](function(_0x4c67e8){var _0x1955f2=_[_0xe855('0x2b')](_0x4c67e8,function(_0x228ea0){return Number(_0x228ea0[_0xe855('0x66')]);});return db[_0xe855('0x67')][_0xe855('0x57')]({'where':{'UserId':{'$in':_0x53db82},'FaxQueueId':{'$in':_0x1955f2}},'transaction':_0x251057});})['then'](function(){var _0x3d292e='SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20'+_0x438a74;return db[_0xe855('0x58')][_0xe855('0x30')](_0x3d292e,{'type':db[_0xe855('0x5a')][_0xe855('0x5b')][_0xe855('0x5d')],'raw':!![],'transaction':_0x251057});})[_0xe855('0x26')](function(_0x385a2c){var _0x4a07cb=_['map'](_0x385a2c,function(_0x45d2b5){return Number(_0x45d2b5[_0xe855('0x68')]);});return db[_0xe855('0x69')][_0xe855('0x57')]({'where':{'UserId':{'$in':_0x53db82},'OpenchannelQueueId':{'$in':_0x4a07cb}},'transaction':_0x251057});})[_0xe855('0x26')](function(){var _0x272c85=_0xe855('0x6a')+_0x438a74;return db[_0xe855('0x58')][_0xe855('0x30')](_0x272c85,{'type':db[_0xe855('0x5a')][_0xe855('0x5b')]['SELECT'],'raw':!![],'transaction':_0x251057});})[_0xe855('0x26')](function(_0x25bf4c){var _0x38729a=_[_0xe855('0x2b')](_0x25bf4c,function(_0x2488e7){return Number(_0x2488e7['WhatsappQueueId']);});return db['UserWhatsappQueue'][_0xe855('0x57')]({'where':{'UserId':{'$in':_0x53db82},'WhatsappQueueId':{'$in':_0x38729a}},'transaction':_0x251057});})[_0xe855('0x26')](function(){return db['TeamVoicePrefix']['find']({'where':{'TeamId':_0x438a74}});})[_0xe855('0x26')](function(_0x152f15){if(_0x152f15===null){return;}return db['UserVoicePrefix']['destroy']({'where':{'UserId':{'$in':_0x53db82},'VoicePrefixId':_0x152f15['VoicePrefixId']},'transaction':_0x251057});})['then'](function(){return db[_0xe855('0x42')][_0xe855('0x57')]({'where':{'id':_0x438a74},'cascade':!![],'transaction':_0x251057});})[_0xe855('0x26')](function(_0x5f50c0){if(_0x5f50c0===0x0){_0x120056[_0xe855('0x27')](0x194);}else{return db[_0xe855('0x6b')]['destroy']({'where':{'type':_0xe855('0x52'),'resourceId':_0x438a74},'cascade':!![],'transaction':_0x251057})['then'](function(){_0x120056[_0xe855('0x1d')](0xcc)['end']();});}})[_0xe855('0x4b')](function(_0x3fc212){_0x120056[_0xe855('0x1d')](0x1f4)[_0xe855('0x6c')](_0x3fc212);});});};exports['getQueues']=function(_0x2a3490,_0x26c342,_0x335e46){return db['Team']['findOne']({'where':{'id':_0x2a3490[_0xe855('0x48')]['id']}})[_0xe855('0x26')](handleEntityNotFound(_0x26c342,null))[_0xe855('0x26')](function(_0x2bae25){if(!_0x2a3490[_0xe855('0x30')][_0xe855('0x6d')]||!utils['isValidChannel'](_0x2a3490['query'][_0xe855('0x6d')])){throw new db[(_0xe855('0x5a'))][(_0xe855('0x6e'))](_0xe855('0x6f'));}var _0x41c186={};var _0x177946={};_0x177946[_0xe855('0x34')]=_[_0xe855('0x31')](db[_[_0xe855('0x70')](_0x2a3490[_0xe855('0x30')][_0xe855('0x6d')][_0xe855('0x71')]())+_0xe855('0x72')]['rawAttributes']);_0x177946['query']=_[_0xe855('0x31')](_0x2a3490[_0xe855('0x30')]);_0x177946['filters']=_[_0xe855('0x33')](_0x177946['model'],_0x177946[_0xe855('0x30')]);_0x41c186[_0xe855('0x32')]=_[_0xe855('0x33')](_0x177946['model'],qs[_0xe855('0x35')](_0x2a3490[_0xe855('0x30')]['fields']));_0x41c186['attributes']=_0x41c186[_0xe855('0x32')][_0xe855('0x36')]?_0x41c186[_0xe855('0x32')]:_0x177946[_0xe855('0x34')];_0x41c186[_0xe855('0x21')]=qs[_0xe855('0x21')](_0x2a3490[_0xe855('0x30')][_0xe855('0x21')]);_0x41c186['offset']=qs[_0xe855('0x1f')](_0x2a3490[_0xe855('0x30')][_0xe855('0x1f')]);_0x41c186[_0xe855('0x39')]=qs[_0xe855('0x3a')](_0x2a3490['query'][_0xe855('0x3a')]);_0x41c186['where']=qs[_0xe855('0x3c')](_['pick'](_0x2a3490[_0xe855('0x30')],_0x177946[_0xe855('0x3c')]));_0x41c186=_[_0xe855('0x40')]({},_0x41c186,_0x2a3490['options']);return _0x2bae25['get'+_[_0xe855('0x70')](_0x2a3490[_0xe855('0x30')][_0xe855('0x6d')]['toLowerCase']())+'Queues'](_0x41c186);})['then'](respondWithResult(_0x26c342,null))[_0xe855('0x4b')](handleError(_0x26c342,null));};exports[_0xe855('0x73')]=function(_0x25e625,_0x3ab2e9,_0x4de4cb){return db[_0xe855('0x42')][_0xe855('0x74')]({'where':{'id':_0x25e625['params']['id']}})[_0xe855('0x26')](function(_0xd5d6bf){if(_0xd5d6bf){if(!_0x25e625['body']['channel']||!utils['isValidChannel'](_0x25e625[_0xe855('0x4d')][_0xe855('0x6d')])){throw new db['Sequelize'][(_0xe855('0x6e'))](_0xe855('0x6f'));}return _0xd5d6bf['add'+_[_0xe855('0x70')](_0x25e625[_0xe855('0x4d')][_0xe855('0x6d')][_0xe855('0x71')]())+_0xe855('0x75')](_0x25e625[_0xe855('0x4d')][_0xe855('0x76')]);}return null;})[_0xe855('0x26')](handleEntityNotFound(_0x3ab2e9,null))[_0xe855('0x26')](respondWithStatusCode(_0x3ab2e9,null))[_0xe855('0x4b')](handleError(_0x3ab2e9,null));};exports[_0xe855('0x77')]=function(_0x471207,_0x15bb1d,_0x7fa765){return db[_0xe855('0x42')][_0xe855('0x74')]({'where':{'id':_0x471207[_0xe855('0x48')]['id']}})['then'](function(_0x551fa4){if(_0x551fa4){if(!_0x471207[_0xe855('0x30')][_0xe855('0x6d')]||!utils[_0xe855('0x78')](_0x471207[_0xe855('0x30')][_0xe855('0x6d')])){throw new db['Sequelize'][(_0xe855('0x6e'))](_0xe855('0x6f'));}return _0x551fa4[_0xe855('0x79')+_[_0xe855('0x70')](_0x471207[_0xe855('0x30')][_0xe855('0x6d')][_0xe855('0x71')]())+_0xe855('0x75')](_0x471207[_0xe855('0x30')][_0xe855('0x76')]);}return null;})[_0xe855('0x26')](handleEntityNotFound(_0x15bb1d,null))[_0xe855('0x26')](respondWithStatusCode(_0x15bb1d,null))[_0xe855('0x4b')](handleError(_0x15bb1d,null));};exports[_0xe855('0x7a')]=function(_0x53e2de,_0xf6bc0c){var _0x4f7120=_[_0xe855('0x7b')](_0x53e2de[_0xe855('0x4d')][_0xe855('0x76')])?_0x53e2de['body'][_0xe855('0x76')]:[_0x53e2de[_0xe855('0x4d')][_0xe855('0x76')]];var _0x1048c3=_0x53e2de['params']['id'];return db[_0xe855('0x42')][_0xe855('0x4a')]({'where':{'id':_0x1048c3}})[_0xe855('0x26')](handleEntityNotFound(_0xf6bc0c,null))[_0xe855('0x26')](function(_0x5bec13){if(_0x5bec13){var _0x5a2b19=[_0xe855('0x7c'),_0xe855('0x7d'),'Mail',_0xe855('0x7e'),_0xe855('0x7f'),_0xe855('0x80'),'Whatsapp'];return db[_0xe855('0x58')][_0xe855('0x81')](function(_0x3ed76b){var _0x49717e=_[_0xe855('0x2b')](_0x5a2b19,function(_0xdceae0){var _0x4d53b0={'attributes':['id',_0xe855('0x2a')]};if(_0xdceae0===_0xe855('0x7c')){_0x4d53b0[_0xe855('0x82')]={'attributes':[_0xe855('0x83')]};}return _0x5bec13[_0xe855('0x4f')+_0xdceae0+'Queues'](_0x4d53b0)['then'](function(_0x497e97){var _0x3d240e=_[_0xe855('0x2b')](_0x497e97,function(_0x29604b){var _0x2c1126=_[_0xe855('0x2b')](_0x4f7120,function(_0x480c69){var _0x4a0dd8={'where':{'UserId':_0x480c69,[_0xdceae0+'QueueId']:_0x29604b['id']},'transaction':_0x3ed76b};if(_0xdceae0===_0xe855('0x7c')){_0x4a0dd8[_0xe855('0x84')]={'penalty':_0x29604b[_0xe855('0x85')]['penalty']};}return db[_0xe855('0x86')+_0xdceae0+_0xe855('0x72')][_0xe855('0x87')](_0x4a0dd8)[_0xe855('0x26')](function(){socket[_0xe855('0x88')]('user'+_0xdceae0+'Queue:save',{'UserId':_0x480c69,[_0xdceae0+_0xe855('0x89')]:_0x29604b['id']});if(_0xdceae0!==_0xe855('0x7c')){return;}return db[_0xe855('0x86')][_0xe855('0x45')]({'where':{'id':_0x4f7120,'online':0x1},'attributes':['id',_0xe855('0x2a'),_0xe855('0x8a'),_0xe855('0x8b'),_0xe855('0x8c')],'raw':!![]})[_0xe855('0x26')](function(_0x4cc594){var _0x55b964=_[_0xe855('0x2b')](_0x4cc594,function(_0x457509){return db[_0xe855('0x8d')][_0xe855('0x8e')]({'membername':_0x457509[_0xe855('0x2a')],'UserId':_0x457509['id'],'queue_name':_0x29604b[_0xe855('0x2a')],'VoiceQueueId':_0x29604b['id'],'interface':_[_0xe855('0x8f')](_0x457509[_0xe855('0x8c')])?util['format']('SIP/%s',_0x457509[_0xe855('0x2a')]):_0x457509[_0xe855('0x8c')],'paused':_0x457509['voicePause']||![],'penalty':_0x29604b[_0xe855('0x85')]['penalty']},{'transaction':_0x3ed76b});});return Promise[_0xe855('0x90')](_0x55b964);});});});return Promise[_0xe855('0x90')](_0x2c1126);});return Promise['all'](_0x3d240e);})[_0xe855('0x26')](function(){return db[_0xe855('0x91')][_0xe855('0x74')]({'where':{'teamId':_0x1048c3}})[_0xe855('0x26')](function(_0x45a22a){if(_0x45a22a){var _0x554b59=_[_0xe855('0x2b')](_0x4f7120,function(_0xda8f4){db[_0xe855('0x92')][_0xe855('0x8e')]({'UserId':_0xda8f4,'VoicePrefixId':_0x45a22a[_0xe855('0x93')]});});return Promise['all'](_0x554b59);}});});});return Promise[_0xe855('0x90')](_0x49717e)['then'](function(){return _0x5bec13[_0xe855('0x7a')](_0x4f7120,{'transaction':_0x3ed76b})[_0xe855('0x94')](function(_0x2e82e7){return _0x2e82e7;});});});}})[_0xe855('0x26')](respondWithResult(_0xf6bc0c,null))[_0xe855('0x4b')](handleError(_0xf6bc0c,null));};exports[_0xe855('0x95')]=function(_0x34ecf7,_0x39a375){var _0x17eae9=_[_0xe855('0x7b')](_0x34ecf7[_0xe855('0x30')][_0xe855('0x76')])?_0x34ecf7[_0xe855('0x30')][_0xe855('0x76')]:[_0x34ecf7[_0xe855('0x30')]['ids']];var _0x395396=_0x34ecf7['params']['id'];return db[_0xe855('0x42')][_0xe855('0x4a')]({'where':{'id':_0x395396}})[_0xe855('0x26')](handleEntityNotFound(_0x39a375,null))['then'](function(_0x5c8651){if(_0x5c8651){var _0x2cb71f=['Voice',_0xe855('0x7d'),'Mail',_0xe855('0x7e'),_0xe855('0x7f'),_0xe855('0x80'),_0xe855('0x96')];return db['sequelize'][_0xe855('0x81')](function(_0x4c359c){var _0x3a3f6a=_[_0xe855('0x2b')](_0x2cb71f,function(_0x4c475c){var _0x377ed6={'attributes':['id',_0xe855('0x2a')]};return _0x5c8651['get'+_0x4c475c+_0xe855('0x75')](_0x377ed6)['then'](function(_0x393a36){var _0x42b7b7=_[_0xe855('0x2b')](_0x393a36,function(_0x4afb88){return _0x4afb88[_0xe855('0x95')](_0x17eae9,{'transaction':_0x4c359c})['then'](function(){var _0x19a509=_[_0xe855('0x2b')](_0x17eae9,function(_0x1aff6a){socket[_0xe855('0x88')]('user'+_0x4c475c+_0xe855('0x97'),{'UserId':Number(_0x1aff6a),[_0x4c475c+_0xe855('0x89')]:_0x4afb88['id']});if(_0x4c475c!=='Voice'){return;}return db[_0xe855('0x8d')][_0xe855('0x57')]({'where':{'VoiceQueueId':_0x4afb88['id'],'UserId':_0x1aff6a},'transaction':_0x4c359c});});return Promise[_0xe855('0x90')](_0x19a509);});});return Promise['all'](_0x42b7b7);});});return Promise[_0xe855('0x90')](_0x3a3f6a)[_0xe855('0x26')](function(){return _0x5c8651['removeAgents'](_0x17eae9,{'transaction':_0x4c359c});})[_0xe855('0x26')](function(){return db[_0xe855('0x91')][_0xe855('0x74')]({'where':{'teamId':_0x395396}})[_0xe855('0x26')](function(_0x5330c7){if(_0x5330c7){var _0x512312=_['map'](_0x17eae9,function(_0xa056ef){db[_0xe855('0x92')][_0xe855('0x57')]({'where':{'UserId':_0xa056ef,'VoicePrefixId':_0x5330c7[_0xe855('0x93')]}});});return Promise['all'](_0x512312);}});});});}})[_0xe855('0x26')](respondWithStatusCode(_0x39a375,null))[_0xe855('0x4b')](handleError(_0x39a375,null));};exports[_0xe855('0x98')]=function(_0xa56ab9,_0x5235eb,_0x123d70){var _0x551989={};var _0x3b9f5e={};var _0x3a0e78;var _0x22622d;return db[_0xe855('0x42')][_0xe855('0x74')]({'where':{'id':_0xa56ab9[_0xe855('0x48')]['id']}})[_0xe855('0x26')](handleEntityNotFound(_0x5235eb,null))[_0xe855('0x26')](function(_0x5eabbb){if(_0x5eabbb){_0x3a0e78=_0x5eabbb;_0x3b9f5e[_0xe855('0x34')]=_[_0xe855('0x31')](db['User'][_0xe855('0x2c')]);_0x3b9f5e[_0xe855('0x30')]=_[_0xe855('0x31')](_0xa56ab9['query']);_0x3b9f5e['filters']=_[_0xe855('0x33')](_0x3b9f5e[_0xe855('0x34')],_0x3b9f5e['query']);_0x551989['attributes']=_[_0xe855('0x33')](_0x3b9f5e[_0xe855('0x34')],qs['fields'](_0xa56ab9[_0xe855('0x30')][_0xe855('0x35')]));_0x551989[_0xe855('0x32')]=_0x551989[_0xe855('0x32')][_0xe855('0x36')]?_0x551989[_0xe855('0x32')]:_0x3b9f5e['model'];_0x551989[_0xe855('0x39')]=qs[_0xe855('0x3a')](_0xa56ab9[_0xe855('0x30')][_0xe855('0x3a')]);_0x551989['where']=qs['filters'](_['pick'](_0xa56ab9[_0xe855('0x30')],_0x3b9f5e[_0xe855('0x3c')]));if(_0xa56ab9[_0xe855('0x30')][_0xe855('0x3e')]){_0x551989[_0xe855('0x3b')]=_[_0xe855('0x40')](_0x551989[_0xe855('0x3b')],{'$or':_['map'](_0x551989[_0xe855('0x32')],function(_0x87cb48){var _0x2f84ae={};_0x2f84ae[_0x87cb48]={'$like':'%'+_0xa56ab9[_0xe855('0x30')][_0xe855('0x3e')]+'%'};return _0x2f84ae;})});}_0x551989=_[_0xe855('0x40')]({},_0x551989,_0xa56ab9['options']);return _0x3a0e78[_0xe855('0x98')](_0x551989);}})['then'](function(_0x426058){if(_0x426058){_0x22622d=_0x426058['length'];if(!_0xa56ab9[_0xe855('0x30')]['hasOwnProperty'](_0xe855('0x38'))){_0x551989[_0xe855('0x21')]=qs[_0xe855('0x21')](_0xa56ab9[_0xe855('0x30')]['limit']);_0x551989['offset']=qs[_0xe855('0x1f')](_0xa56ab9[_0xe855('0x30')]['offset']);}return _0x3a0e78[_0xe855('0x98')](_0x551989);}})['then'](function(_0x2c0f3a){if(_0x2c0f3a){return _0x2c0f3a?{'count':_0x22622d,'rows':_0x2c0f3a}:null;}})[_0xe855('0x26')](respondWithResult(_0x5235eb,null))[_0xe855('0x4b')](handleError(_0x5235eb,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index acc6bb6..29e79eb 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 _0x13d4=['hook','events','Team','save','update','remove','emit','hasOwnProperty'];(function(_0x4a28c1,_0x5c7d98){var _0x2d7bae=function(_0x43471d){while(--_0x43471d){_0x4a28c1['push'](_0x4a28c1['shift']());}};_0x2d7bae(++_0x5c7d98);}(_0x13d4,0x149));var _0x413d=function(_0x736d3f,_0x26c615){_0x736d3f=_0x736d3f-0x0;var _0x319072=_0x13d4[_0x736d3f];return _0x319072;};'use strict';var EventEmitter=require(_0x413d('0x0'));var Team=require('../../mysqldb')['db'][_0x413d('0x1')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x413d('0x2'),'afterUpdate':_0x413d('0x3'),'afterDestroy':_0x413d('0x4')};function emitEvent(_0x2f4285){return function(_0x2ad686,_0x37f965,_0x2cbf6c){TeamEvents['emit'](_0x2f4285+':'+_0x2ad686['id'],_0x2ad686);TeamEvents[_0x413d('0x5')](_0x2f4285,_0x2ad686);_0x2cbf6c(null);};}for(var e in events){if(events[_0x413d('0x6')](e)){var event=events[e];Team[_0x413d('0x7')](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file +var _0xfb12=['../../mysqldb','Team','save','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x298ed3,_0x4ab5e1){var _0x5aad28=function(_0x168687){while(--_0x168687){_0x298ed3['push'](_0x298ed3['shift']());}};_0x5aad28(++_0x4ab5e1);}(_0xfb12,0x74));var _0x2fb1=function(_0x379ee5,_0x336c42){_0x379ee5=_0x379ee5-0x0;var _0x114694=_0xfb12[_0x379ee5];return _0x114694;};'use strict';var EventEmitter=require(_0x2fb1('0x0'));var Team=require(_0x2fb1('0x1'))['db'][_0x2fb1('0x2')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2fb1('0x3'),'afterUpdate':_0x2fb1('0x4'),'afterDestroy':_0x2fb1('0x5')};function emitEvent(_0x4b9ba4){return function(_0x4bf3e4,_0x27ee4c,_0x52b600){TeamEvents[_0x2fb1('0x6')](_0x4b9ba4+':'+_0x4bf3e4['id'],_0x4bf3e4);TeamEvents[_0x2fb1('0x6')](_0x4b9ba4,_0x4bf3e4);_0x52b600(null);};}for(var e in events){if(events[_0x2fb1('0x7')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0x2fb1('0x8')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 04e6725..cc8f408 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 _0x8f3d=['map','channel','catch','define','Team','teams','Chat','Fax','Mail','Openchannel','Sms','Voice','Whatsapp','resolve','lodash','./team.attributes','then'];(function(_0x1fc9e8,_0x382720){var _0x55b160=function(_0x4e1db6){while(--_0x4e1db6){_0x1fc9e8['push'](_0x1fc9e8['shift']());}};_0x55b160(++_0x382720);}(_0x8f3d,0x96));var _0xd8f3=function(_0x1442b0,_0x2bfe92){_0x1442b0=_0x1442b0-0x0;var _0xe195c0=_0x8f3d[_0x1442b0];return _0xe195c0;};'use strict';var _=require(_0xd8f3('0x0'));var attributes=require(_0xd8f3('0x1'));function getQueuesByChannel(_0x34c33b,_0x520187){var _0x16381d='get'+_0x520187+'Queues';return _0x34c33b[_0x16381d]()[_0xd8f3('0x2')](function(_0x28f0a7){return _[_0xd8f3('0x3')](_0x28f0a7,function(_0x32b3cc){_0x32b3cc['setDataValue'](_0xd8f3('0x4'),_0x520187);return _0x32b3cc;});})[_0xd8f3('0x5')](function(_0x55a9cc){throw _0x55a9cc;});}module['exports']=function(_0x200e89){return _0x200e89[_0xd8f3('0x6')](_0xd8f3('0x7'),attributes,{'tableName':_0xd8f3('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x4dee6d=this;var _0x2033c3=[_0xd8f3('0x9'),_0xd8f3('0xa'),_0xd8f3('0xb'),_0xd8f3('0xc'),_0xd8f3('0xd'),_0xd8f3('0xe'),_0xd8f3('0xf')];return Promise[_0xd8f3('0x10')]()[_0xd8f3('0x2')](function(){var _0x1a71cf=_[_0xd8f3('0x3')](_0x2033c3,function(_0x5b7cce){return getQueuesByChannel(_0x4dee6d,_0x5b7cce);});return Promise['all'](_0x1a71cf);})[_0xd8f3('0x5')](function(_0x50d3bd){throw _0x50d3bd;});}}});}; \ No newline at end of file +var _0x29f8=['channel','catch','exports','define','Team','Chat','Openchannel','Sms','Voice','Whatsapp','resolve','all','lodash','./team.attributes','get','Queues','then','map','setDataValue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x29f8,0x13c));var _0x829f=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0x29f8[_0x4e1d03];return _0x362d4b;};'use strict';var _=require(_0x829f('0x0'));var attributes=require(_0x829f('0x1'));function getQueuesByChannel(_0x44ccea,_0x38bd13){var _0x498f85=_0x829f('0x2')+_0x38bd13+_0x829f('0x3');return _0x44ccea[_0x498f85]()[_0x829f('0x4')](function(_0x4ef8f6){return _[_0x829f('0x5')](_0x4ef8f6,function(_0x407b2c){_0x407b2c[_0x829f('0x6')](_0x829f('0x7'),_0x38bd13);return _0x407b2c;});})[_0x829f('0x8')](function(_0x377b53){throw _0x377b53;});}module[_0x829f('0x9')]=function(_0x33cd1d){return _0x33cd1d[_0x829f('0xa')](_0x829f('0xb'),attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x5df09d=this;var _0x4817b7=[_0x829f('0xc'),'Fax','Mail',_0x829f('0xd'),_0x829f('0xe'),_0x829f('0xf'),_0x829f('0x10')];return Promise[_0x829f('0x11')]()[_0x829f('0x4')](function(){var _0x317c66=_[_0x829f('0x5')](_0x4817b7,function(_0x62ea95){return getQueuesByChannel(_0x5df09d,_0x62ea95);});return Promise[_0x829f('0x12')](_0x317c66);})[_0x829f('0x8')](function(_0x51d43c){throw _0x51d43c;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index d5f4faa..854b4e7 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 _0xcd63=['result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./team.socket','register','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x4e1d2d,_0x5a44e1){var _0x520f96=function(_0x432d2d){while(--_0x432d2d){_0x4e1d2d['push'](_0x4e1d2d['shift']());}};_0x520f96(++_0x5a44e1);}(_0xcd63,0xfe));var _0x3cd6=function(_0x1bb6c4,_0x2f8d6f){_0x1bb6c4=_0x1bb6c4-0x0;var _0xc6fd11=_0xcd63[_0x1bb6c4];return _0xc6fd11;};'use strict';var _=require(_0x3cd6('0x0'));var util=require(_0x3cd6('0x1'));var moment=require(_0x3cd6('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3cd6('0x3'));var db=require(_0x3cd6('0x4'))['db'];var utils=require(_0x3cd6('0x5'));var logger=require(_0x3cd6('0x6'))(_0x3cd6('0x7'));var config=require(_0x3cd6('0x8'));var jayson=require(_0x3cd6('0x9'));var client=jayson[_0x3cd6('0xa')][_0x3cd6('0xb')]({'port':0x232a});config[_0x3cd6('0xc')]=_['defaults'](config[_0x3cd6('0xc')],{'host':_0x3cd6('0xd'),'port':0x18eb});var socket=require(_0x3cd6('0xe'))(new Redis(config[_0x3cd6('0xc')]));require(_0x3cd6('0xf'))[_0x3cd6('0x10')](socket);function respondWithRpcPromise(_0x8f59ad,_0x496c17,_0x73a04d){return new BPromise(function(_0x236ce2,_0x19dbf5){return client['request'](_0x8f59ad,_0x73a04d)['then'](function(_0x543476){logger['info'](_0x3cd6('0x11'),_0x496c17,_0x3cd6('0x12'));logger[_0x3cd6('0x13')](_0x3cd6('0x14'),_0x496c17,_0x3cd6('0x12'),JSON[_0x3cd6('0x15')](_0x543476));if(_0x543476[_0x3cd6('0x16')]){if(_0x543476['error'][_0x3cd6('0x17')]===0x1f4){logger['error'](_0x3cd6('0x11'),_0x496c17,_0x543476['error']['message']);return _0x19dbf5(_0x543476[_0x3cd6('0x16')][_0x3cd6('0x18')]);}logger['error']('Team,\x20%s,\x20%s',_0x496c17,_0x543476[_0x3cd6('0x16')][_0x3cd6('0x18')]);return _0x236ce2(_0x543476[_0x3cd6('0x16')]['message']);}else{logger[_0x3cd6('0x19')](_0x3cd6('0x11'),_0x496c17,'request\x20sent');_0x236ce2(_0x543476[_0x3cd6('0x1a')][_0x3cd6('0x18')]);}})[_0x3cd6('0x1b')](function(_0x476b6f){logger[_0x3cd6('0x16')](_0x3cd6('0x11'),_0x496c17,_0x476b6f);_0x19dbf5(_0x476b6f);});});} \ No newline at end of file +var _0xbfe2=['info','Team,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','register','request'];(function(_0x5c6be5,_0x3ff1d5){var _0x151348=function(_0x3df6c6){while(--_0x3df6c6){_0x5c6be5['push'](_0x5c6be5['shift']());}};_0x151348(++_0x3ff1d5);}(_0xbfe2,0x75));var _0x2bfe=function(_0x693f3a,_0x3dce46){_0x693f3a=_0x693f3a-0x0;var _0x3225d0=_0xbfe2[_0x693f3a];return _0x3225d0;};'use strict';var _=require(_0x2bfe('0x0'));var util=require(_0x2bfe('0x1'));var moment=require('moment');var BPromise=require(_0x2bfe('0x2'));var rs=require(_0x2bfe('0x3'));var fs=require('fs');var Redis=require(_0x2bfe('0x4'));var db=require(_0x2bfe('0x5'))['db'];var utils=require(_0x2bfe('0x6'));var logger=require(_0x2bfe('0x7'))('rpc');var config=require(_0x2bfe('0x8'));var jayson=require(_0x2bfe('0x9'));var client=jayson[_0x2bfe('0xa')][_0x2bfe('0xb')]({'port':0x232a});config['redis']=_[_0x2bfe('0xc')](config['redis'],{'host':_0x2bfe('0xd'),'port':0x18eb});var socket=require(_0x2bfe('0xe'))(new Redis(config[_0x2bfe('0xf')]));require('./team.socket')[_0x2bfe('0x10')](socket);function respondWithRpcPromise(_0x3f2a8c,_0x28ec35,_0x546f8a){return new BPromise(function(_0x25f0e0,_0x2dd935){return client[_0x2bfe('0x11')](_0x3f2a8c,_0x546f8a)['then'](function(_0x369bf6){logger[_0x2bfe('0x12')](_0x2bfe('0x13'),_0x28ec35,_0x2bfe('0x14'));logger[_0x2bfe('0x15')]('Team,\x20%s,\x20%s,\x20%s',_0x28ec35,_0x2bfe('0x14'),JSON['stringify'](_0x369bf6));if(_0x369bf6[_0x2bfe('0x16')]){if(_0x369bf6[_0x2bfe('0x16')][_0x2bfe('0x17')]===0x1f4){logger['error']('Team,\x20%s,\x20%s',_0x28ec35,_0x369bf6[_0x2bfe('0x16')][_0x2bfe('0x18')]);return _0x2dd935(_0x369bf6['error'][_0x2bfe('0x18')]);}logger['error'](_0x2bfe('0x13'),_0x28ec35,_0x369bf6[_0x2bfe('0x16')][_0x2bfe('0x18')]);return _0x25f0e0(_0x369bf6[_0x2bfe('0x16')][_0x2bfe('0x18')]);}else{logger[_0x2bfe('0x12')](_0x2bfe('0x13'),_0x28ec35,_0x2bfe('0x14'));_0x25f0e0(_0x369bf6[_0x2bfe('0x19')]['message']);}})[_0x2bfe('0x1a')](function(_0x52134e){logger[_0x2bfe('0x16')](_0x2bfe('0x13'),_0x28ec35,_0x52134e);_0x2dd935(_0x52134e);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 0abb366..1bdd7c3 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 _0x9519=['remove','removeListener','register','length','team:','./team.events','save'];(function(_0x5ee40d,_0x2e8354){var _0x3c3c5a=function(_0x12c6b5){while(--_0x12c6b5){_0x5ee40d['push'](_0x5ee40d['shift']());}};_0x3c3c5a(++_0x2e8354);}(_0x9519,0x147));var _0x9951=function(_0x32d4d1,_0x3568e6){_0x32d4d1=_0x32d4d1-0x0;var _0x2da449=_0x9519[_0x32d4d1];return _0x2da449;};'use strict';var TeamEvents=require(_0x9951('0x0'));var events=[_0x9951('0x1'),_0x9951('0x2'),'update'];function createListener(_0x279b99,_0x300720){return function(_0x1bd1f7){_0x300720['emit'](_0x279b99,_0x1bd1f7);};}function removeListener(_0x300f2f,_0x5d38bf){return function(){TeamEvents[_0x9951('0x3')](_0x300f2f,_0x5d38bf);};}exports[_0x9951('0x4')]=function(_0x3addcc){for(var _0x333492=0x0,_0x399a4c=events[_0x9951('0x5')];_0x333492<_0x399a4c;_0x333492++){var _0x18693d=events[_0x333492];var _0x366e14=createListener(_0x9951('0x6')+_0x18693d,_0x3addcc);TeamEvents['on'](_0x18693d,_0x366e14);}}; \ No newline at end of file +var _0xb76d=['save','emit','team:','./team.events'];(function(_0xd8aad0,_0x4da2cd){var _0x570860=function(_0x1acc03){while(--_0x1acc03){_0xd8aad0['push'](_0xd8aad0['shift']());}};_0x570860(++_0x4da2cd);}(_0xb76d,0x19f));var _0xdb76=function(_0x21747a,_0x5e9f2b){_0x21747a=_0x21747a-0x0;var _0x20e4fb=_0xb76d[_0x21747a];return _0x20e4fb;};'use strict';var TeamEvents=require(_0xdb76('0x0'));var events=[_0xdb76('0x1'),'remove','update'];function createListener(_0x167c68,_0x544e33){return function(_0x5580eb){_0x544e33[_0xdb76('0x2')](_0x167c68,_0x5580eb);};}function removeListener(_0x2c055e,_0x26a3e9){return function(){TeamEvents['removeListener'](_0x2c055e,_0x26a3e9);};}exports['register']=function(_0x3ab524){for(var _0x2c516d=0x0,_0x1e6d75=events['length'];_0x2c516d<_0x1e6d75;_0x2c516d++){var _0x255937=events[_0x2c516d];var _0x3ec588=createListener(_0xdb76('0x3')+_0x255937,_0x3ab524);TeamEvents['on'](_0x255937,_0x3ec588);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 0fc325b..3fa02f7 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 _0x252f=['sequelize','exports'];(function(_0x4a1322,_0x17b4b8){var _0x426f00=function(_0x584bc5){while(--_0x584bc5){_0x4a1322['push'](_0x4a1322['shift']());}};_0x426f00(++_0x17b4b8);}(_0x252f,0xd0));var _0xf252=function(_0x40bc32,_0x428c83){_0x40bc32=_0x40bc32-0x0;var _0x2351e3=_0x252f[_0x40bc32];return _0x2351e3;};'use strict';var Sequelize=require(_0xf252('0x0'));module[_0xf252('0x1')]={'TeamId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x1da1=['sequelize','exports','INTEGER'];(function(_0x125713,_0x5b7517){var _0x4e9658=function(_0x5ae1c4){while(--_0x5ae1c4){_0x125713['push'](_0x125713['shift']());}};_0x4e9658(++_0x5b7517);}(_0x1da1,0x1a4));var _0x11da=function(_0x182abc,_0x4fde08){_0x182abc=_0x182abc-0x0;var _0x38cfe2=_0x1da1[_0x182abc];return _0x38cfe2;};'use strict';var Sequelize=require(_0x11da('0x0'));module[_0x11da('0x1')]={'TeamId':{'type':Sequelize[_0x11da('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x11da('0x2')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 8e5827d..41a9984 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 _0x6947=['./teamVoicePrefix.attributes','exports','define','team_has_voice_prefixes','util','api','moment','bluebird','request-promise','../../config/environment'];(function(_0x3f7b46,_0x52da57){var _0x39588d=function(_0xf59e7d){while(--_0xf59e7d){_0x3f7b46['push'](_0x3f7b46['shift']());}};_0x39588d(++_0x52da57);}(_0x6947,0x72));var _0x7694=function(_0x577742,_0x135c9f){_0x577742=_0x577742-0x0;var _0x28b114=_0x6947[_0x577742];return _0x28b114;};'use strict';var _=require('lodash');var util=require(_0x7694('0x0'));var logger=require('../../config/logger')(_0x7694('0x1'));var moment=require(_0x7694('0x2'));var BPromise=require(_0x7694('0x3'));var rp=require(_0x7694('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7694('0x5'));var attributes=require(_0x7694('0x6'));module[_0x7694('0x7')]=function(_0x5730,_0x36776b){return _0x5730[_0x7694('0x8')]('TeamVoicePrefix',attributes,{'tableName':_0x7694('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcb10=['request-promise','rimraf','../../config/environment','./teamVoicePrefix.attributes','exports','define','TeamVoicePrefix','lodash','util','api','moment'];(function(_0x4d8c05,_0x1dfcaa){var _0xf02fa6=function(_0x30e508){while(--_0x30e508){_0x4d8c05['push'](_0x4d8c05['shift']());}};_0xf02fa6(++_0x1dfcaa);}(_0xcb10,0x104));var _0x0cb1=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0xcb10[_0x1da527];return _0x40fc7c;};'use strict';var _=require(_0x0cb1('0x0'));var util=require(_0x0cb1('0x1'));var logger=require('../../config/logger')(_0x0cb1('0x2'));var moment=require(_0x0cb1('0x3'));var BPromise=require('bluebird');var rp=require(_0x0cb1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0cb1('0x5'));var config=require(_0x0cb1('0x6'));var attributes=require(_0x0cb1('0x7'));module[_0x0cb1('0x8')]=function(_0x430f60,_0x3ee6ec){return _0x430f60[_0x0cb1('0x9')](_0x0cb1('0xa'),attributes,{'tableName':'team_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 13c9869..c1aa30b 100644 --- a/server/api/teamVoiceQueue/index.js +++ b/server/api/teamVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x4c585a,_0x3ef2e9){var _0x2d2961=function(_0x255188){while(--_0x255188){_0x4c585a['push'](_0x4c585a['shift']());}};_0x2d2961(++_0x3ef2e9);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x4986e,_0x3f4dc0){var _0x27d7d2=function(_0x3adf21){while(--_0x3adf21){_0x4986e['push'](_0x4986e['shift']());}};_0x27d7d2(++_0x3f4dc0);}(_0x70e0,0x17b));var _0x070e=function(_0x15a50f,_0x45c026){_0x15a50f=_0x15a50f-0x0;var _0x2136b4=_0x70e0[_0x15a50f];return _0x2136b4;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index cf73de3..3519fd8 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 _0xdcdc=['exports','INTEGER','sequelize'];(function(_0x347657,_0x5b1972){var _0x46dec6=function(_0x46df46){while(--_0x46df46){_0x347657['push'](_0x347657['shift']());}};_0x46dec6(++_0x5b1972);}(_0xdcdc,0x8c));var _0xcdcd=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xdcdc[_0x432682];return _0x463d05;};'use strict';var Sequelize=require(_0xcdcd('0x0'));module[_0xcdcd('0x1')]={'penalty':{'type':Sequelize[_0xcdcd('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x95fa=['sequelize'];(function(_0x1f0334,_0x11c437){var _0x4118ed=function(_0x10adbc){while(--_0x10adbc){_0x1f0334['push'](_0x1f0334['shift']());}};_0x4118ed(++_0x11c437);}(_0x95fa,0x129));var _0xa95f=function(_0x24bde6,_0x54142b){_0x24bde6=_0x24bde6-0x0;var _0x4353d9=_0x95fa[_0x24bde6];return _0x4353d9;};'use strict';var Sequelize=require(_0xa95f('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index ddfd466..b9ea62c 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 _0xe3c5=['define','TeamVoiceQueue','team_has_voice_queues','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports'];(function(_0x39c734,_0x2f3e06){var _0xb2a2f9=function(_0x502f3f){while(--_0x502f3f){_0x39c734['push'](_0x39c734['shift']());}};_0xb2a2f9(++_0x2f3e06);}(_0xe3c5,0x17d));var _0x5e3c=function(_0x33bc64,_0x4d1e92){_0x33bc64=_0x33bc64-0x0;var _0x3fdd34=_0xe3c5[_0x33bc64];return _0x3fdd34;};'use strict';var _=require(_0x5e3c('0x0'));var util=require(_0x5e3c('0x1'));var logger=require(_0x5e3c('0x2'))(_0x5e3c('0x3'));var moment=require(_0x5e3c('0x4'));var BPromise=require(_0x5e3c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5e3c('0x6'));var rimraf=require(_0x5e3c('0x7'));var config=require(_0x5e3c('0x8'));var attributes=require(_0x5e3c('0x9'));module[_0x5e3c('0xa')]=function(_0x31a878,_0x1e631d){return _0x31a878[_0x5e3c('0xb')](_0x5e3c('0xc'),attributes,{'tableName':_0x5e3c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaf80=['rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','TeamVoiceQueue','lodash','util','../../config/logger','api','path'];(function(_0x34aa82,_0x42a05d){var _0x1e389b=function(_0x439c7b){while(--_0x439c7b){_0x34aa82['push'](_0x34aa82['shift']());}};_0x1e389b(++_0x42a05d);}(_0xaf80,0x1ef));var _0x0af8=function(_0x408581,_0x180cd0){_0x408581=_0x408581-0x0;var _0x538e35=_0xaf80[_0x408581];return _0x538e35;};'use strict';var _=require(_0x0af8('0x0'));var util=require(_0x0af8('0x1'));var logger=require(_0x0af8('0x2'))(_0x0af8('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0af8('0x4'));var rimraf=require(_0x0af8('0x5'));var config=require(_0x0af8('0x6'));var attributes=require(_0x0af8('0x7'));module[_0x0af8('0x8')]=function(_0x20fdc5,_0x5180bf){return _0x20fdc5['define'](_0x0af8('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 2689904..45a5dc9 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 _0xcef4=['stringify','error','code','message','result','catch','lodash','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s'];(function(_0x209f86,_0x215b94){var _0x344f=function(_0x520e26){while(--_0x520e26){_0x209f86['push'](_0x209f86['shift']());}};_0x344f(++_0x215b94);}(_0xcef4,0x1e9));var _0x4cef=function(_0xc40b9f,_0x17ec1f){_0xc40b9f=_0xc40b9f-0x0;var _0x535b9c=_0xcef4[_0xc40b9f];return _0x535b9c;};'use strict';var _=require(_0x4cef('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4cef('0x1'));var db=require(_0x4cef('0x2'))['db'];var utils=require(_0x4cef('0x3'));var logger=require(_0x4cef('0x4'))(_0x4cef('0x5'));var config=require(_0x4cef('0x6'));var jayson=require(_0x4cef('0x7'));var client=jayson[_0x4cef('0x8')][_0x4cef('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5f5ced,_0x4d03f4,_0x1c522e){return new BPromise(function(_0x4ac443,_0x14c015){return client['request'](_0x5f5ced,_0x1c522e)['then'](function(_0x5905f1){logger[_0x4cef('0xa')](_0x4cef('0xb'),_0x4d03f4,_0x4cef('0xc'));logger[_0x4cef('0xd')](_0x4cef('0xe'),_0x4d03f4,_0x4cef('0xc'),JSON[_0x4cef('0xf')](_0x5905f1));if(_0x5905f1[_0x4cef('0x10')]){if(_0x5905f1[_0x4cef('0x10')][_0x4cef('0x11')]===0x1f4){logger[_0x4cef('0x10')](_0x4cef('0xb'),_0x4d03f4,_0x5905f1['error'][_0x4cef('0x12')]);return _0x14c015(_0x5905f1[_0x4cef('0x10')][_0x4cef('0x12')]);}logger['error'](_0x4cef('0xb'),_0x4d03f4,_0x5905f1[_0x4cef('0x10')][_0x4cef('0x12')]);return _0x4ac443(_0x5905f1['error']['message']);}else{logger[_0x4cef('0xa')](_0x4cef('0xb'),_0x4d03f4,'request\x20sent');_0x4ac443(_0x5905f1[_0x4cef('0x13')][_0x4cef('0x12')]);}})[_0x4cef('0x14')](function(_0x1c357d){logger[_0x4cef('0x10')](_0x4cef('0xb'),_0x4d03f4,_0x1c357d);_0x14c015(_0x1c357d);});});} \ No newline at end of file +var _0x2d0c=['debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','TeamVoiceQueue,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent'];(function(_0x1ea170,_0x28d157){var _0x32487e=function(_0x5bebe9){while(--_0x5bebe9){_0x1ea170['push'](_0x1ea170['shift']());}};_0x32487e(++_0x28d157);}(_0x2d0c,0xc1));var _0xc2d0=function(_0x27638d,_0x4094db){_0x27638d=_0x27638d-0x0;var _0x35da35=_0x2d0c[_0x27638d];return _0x35da35;};'use strict';var _=require(_0xc2d0('0x0'));var util=require(_0xc2d0('0x1'));var moment=require('moment');var BPromise=require(_0xc2d0('0x2'));var rs=require(_0xc2d0('0x3'));var fs=require('fs');var Redis=require(_0xc2d0('0x4'));var db=require(_0xc2d0('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc2d0('0x6'));var config=require(_0xc2d0('0x7'));var jayson=require(_0xc2d0('0x8'));var client=jayson[_0xc2d0('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4f7c50,_0xce2e24,_0x4f0c47){return new BPromise(function(_0xda0402,_0x85456){return client[_0xc2d0('0xa')](_0x4f7c50,_0x4f0c47)[_0xc2d0('0xb')](function(_0x5ebb2e){logger[_0xc2d0('0xc')]('TeamVoiceQueue,\x20%s,\x20%s',_0xce2e24,_0xc2d0('0xd'));logger[_0xc2d0('0xe')](_0xc2d0('0xf'),_0xce2e24,_0xc2d0('0xd'),JSON[_0xc2d0('0x10')](_0x5ebb2e));if(_0x5ebb2e[_0xc2d0('0x11')]){if(_0x5ebb2e[_0xc2d0('0x11')][_0xc2d0('0x12')]===0x1f4){logger[_0xc2d0('0x11')]('TeamVoiceQueue,\x20%s,\x20%s',_0xce2e24,_0x5ebb2e[_0xc2d0('0x11')][_0xc2d0('0x13')]);return _0x85456(_0x5ebb2e['error']['message']);}logger[_0xc2d0('0x11')](_0xc2d0('0x14'),_0xce2e24,_0x5ebb2e[_0xc2d0('0x11')]['message']);return _0xda0402(_0x5ebb2e[_0xc2d0('0x11')]['message']);}else{logger['info']('TeamVoiceQueue,\x20%s,\x20%s',_0xce2e24,_0xc2d0('0xd'));_0xda0402(_0x5ebb2e[_0xc2d0('0x15')][_0xc2d0('0x13')]);}})[_0xc2d0('0x16')](function(_0x4b461a){logger[_0xc2d0('0x11')](_0xc2d0('0x14'),_0xce2e24,_0x4b461a);_0x85456(_0x4b461a);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 7dfc56e..e6239a5 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 _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x7a54,0x106));var _0x47a5=function(_0x560089,_0x5b033e){_0x560089=_0x560089-0x0;var _0x3eeeda=_0x7a54[_0x560089];return _0x3eeeda;};'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 _0x753c=['delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','index','/:id','show','post','create','put','update'];(function(_0x5b1a21,_0x3f16e0){var _0x39728a=function(_0x5b3596){while(--_0x5b3596){_0x5b1a21['push'](_0x5b1a21['shift']());}};_0x39728a(++_0x3f16e0);}(_0x753c,0x96));var _0xc753=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x753c[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require('multer');var util=require(_0xc753('0x0'));var path=require('path');var timeout=require(_0xc753('0x1'));var express=require(_0xc753('0x2'));var router=express[_0xc753('0x3')]();var fs_extra=require(_0xc753('0x4'));var auth=require(_0xc753('0x5'));var interaction=require(_0xc753('0x6'));var config=require(_0xc753('0x7'));var controller=require(_0xc753('0x8'));router[_0xc753('0x9')]('/',auth[_0xc753('0xa')](),controller[_0xc753('0xb')]);router[_0xc753('0x9')](_0xc753('0xc'),auth[_0xc753('0xa')](),controller[_0xc753('0xd')]);router[_0xc753('0xe')]('/',auth[_0xc753('0xa')](),controller[_0xc753('0xf')]);router[_0xc753('0x10')](_0xc753('0xc'),auth[_0xc753('0xa')](),controller[_0xc753('0x11')]);router[_0xc753('0x12')](_0xc753('0xc'),auth['isAuthenticated'](),controller[_0xc753('0x13')]);module[_0xc753('0x14')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index de5d517..e79b836 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 _0x5192=['STRING','TEXT','sequelize','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5192,0x122));var _0x2519=function(_0x2c8915,_0x27593b){_0x2c8915=_0x2c8915-0x0;var _0x2acde0=_0x5192[_0x2c8915];return _0x2acde0;};'use strict';var Sequelize=require(_0x2519('0x0'));module[_0x2519('0x1')]={'name':{'type':Sequelize[_0x2519('0x2')]},'description':{'type':Sequelize[_0x2519('0x2')]},'html':{'type':Sequelize[_0x2519('0x3')]}}; \ No newline at end of file +var _0x7932=['STRING','sequelize','exports'];(function(_0x23018a,_0xc2ce29){var _0x295a10=function(_0x988d98){while(--_0x988d98){_0x23018a['push'](_0x23018a['shift']());}};_0x295a10(++_0xc2ce29);}(_0x7932,0x73));var _0x2793=function(_0x51cd33,_0x1bd912){_0x51cd33=_0x51cd33-0x0;var _0x4e2bf9=_0x7932[_0x51cd33];return _0x4e2bf9;};'use strict';var Sequelize=require(_0x2793('0x0'));module[_0x2793('0x1')]={'name':{'type':Sequelize[_0x2793('0x2')]},'description':{'type':Sequelize[_0x2793('0x2')]},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 5814137..dc5f3f0 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 _0x281f=['keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Templates','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','params','eml-format','zip-dir','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','offset','undefined','count','limit','Content-Range','json','reject','update','then','get','destroy','end','error','name','send','map','Template','rawAttributes','fieldName','type','key','model','query'];(function(_0x503a57,_0x3353f6){var _0xc4373b=function(_0x30c47d){while(--_0x30c47d){_0x503a57['push'](_0x503a57['shift']());}};_0xc4373b(++_0x3353f6);}(_0x281f,0x15c));var _0xf281=function(_0x1780f8,_0x11ba93){_0x1780f8=_0x1780f8-0x0;var _0x33a410=_0x281f[_0x1780f8];return _0x33a410;};'use strict';var emlformat=require(_0xf281('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf281('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf281('0x2'));var BPromise=require(_0xf281('0x3'));var Mustache=require(_0xf281('0x4'));var util=require(_0xf281('0x5'));var path=require('path');var sox=require(_0xf281('0x6'));var csv=require(_0xf281('0x7'));var ejs=require(_0xf281('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf281('0x9'));var squel=require(_0xf281('0xa'));var crypto=require(_0xf281('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xf281('0xc'));var toCsv=require('to-csv');var querystring=require(_0xf281('0xd'));var Papa=require(_0xf281('0xe'));var Redis=require(_0xf281('0xf'));var authService=require(_0xf281('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf281('0x11'));var logger=require(_0xf281('0x12'))(_0xf281('0x13'));var utils=require(_0xf281('0x14'));var config=require(_0xf281('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2657df,_0x21cea8){_0x21cea8=_0x21cea8||0xcc;return function(_0x464348){if(_0x464348){return _0x2657df[_0xf281('0x16')](_0x21cea8);}return _0x2657df['status'](_0x21cea8)['end']();};}function respondWithResult(_0x20be3f,_0x4fe738){_0x4fe738=_0x4fe738||0xc8;return function(_0x1548a3){if(_0x1548a3){return _0x20be3f[_0xf281('0x17')](_0x4fe738)['json'](_0x1548a3);}};}function respondWithFilteredResult(_0x53e17c,_0x11f0cd){return function(_0x193635){if(_0x193635){var _0xa28355=typeof _0x11f0cd[_0xf281('0x18')]==='undefined'&&typeof _0x11f0cd['limit']===_0xf281('0x19');var _0x4faf90=_0x193635[_0xf281('0x1a')];var _0x1fae50=_0xa28355?0x0:_0x11f0cd[_0xf281('0x18')];var _0x37a6ab=_0xa28355?_0x193635[_0xf281('0x1a')]:_0x11f0cd[_0xf281('0x18')]+_0x11f0cd[_0xf281('0x1b')];var _0xe92e30;if(_0x37a6ab>=_0x4faf90){_0x37a6ab=_0x4faf90;_0xe92e30=0xc8;}else{_0xe92e30=0xce;}_0x53e17c[_0xf281('0x17')](_0xe92e30);return _0x53e17c['set'](_0xf281('0x1c'),_0x1fae50+'-'+_0x37a6ab+'/'+_0x4faf90)[_0xf281('0x1d')](_0x193635);}return null;};}function patchUpdates(_0x2627bb){return function(_0x115e47){try{jsonpatch['apply'](_0x115e47,_0x2627bb,!![]);}catch(_0x461a19){return BPromise[_0xf281('0x1e')](_0x461a19);}return _0x115e47['save']();};}function saveUpdates(_0xaf7ec5,_0x782ab5){return function(_0x32e922){if(_0x32e922){return _0x32e922[_0xf281('0x1f')](_0xaf7ec5)[_0xf281('0x20')](function(_0x2dde38){return _0x2dde38;});}return null;};}function removeEntity(_0xf22075,_0x303c9c){return function(_0xbe4fa){if(_0xbe4fa){return _0xbe4fa['destroy']()[_0xf281('0x20')](function(){var _0x26f01e=_0xbe4fa[_0xf281('0x21')]({'plain':!![]});var _0x282761='Templates';return db['UserProfileResource'][_0xf281('0x22')]({'where':{'type':_0x282761,'resourceId':_0x26f01e['id']}})[_0xf281('0x20')](function(){return _0xbe4fa;});})[_0xf281('0x20')](function(){_0xf22075['status'](0xcc)[_0xf281('0x23')]();});}};}function handleEntityNotFound(_0x31200c,_0x2b76d1){return function(_0x3b8fb5){if(!_0x3b8fb5){_0x31200c[_0xf281('0x16')](0x194);}return _0x3b8fb5;};}function handleError(_0x38f093,_0x34b959){_0x34b959=_0x34b959||0x1f4;return function(_0x5d600d){logger[_0xf281('0x24')](_0x5d600d['stack']);if(_0x5d600d[_0xf281('0x25')]){delete _0x5d600d[_0xf281('0x25')];}_0x38f093['status'](_0x34b959)[_0xf281('0x26')](_0x5d600d);};}exports['index']=function(_0x2ba6f3,_0x5d831b){var _0x11525e={},_0x33b96b={},_0x310da8={'count':0x0,'rows':[]};var _0x2ae0a6=_[_0xf281('0x27')](db[_0xf281('0x28')][_0xf281('0x29')],function(_0x37db21){return{'name':_0x37db21[_0xf281('0x2a')],'type':_0x37db21[_0xf281('0x2b')][_0xf281('0x2c')]};});_0x33b96b[_0xf281('0x2d')]=_['map'](_0x2ae0a6,_0xf281('0x25'));_0x33b96b[_0xf281('0x2e')]=_[_0xf281('0x2f')](_0x2ba6f3['query']);_0x33b96b[_0xf281('0x30')]=_['intersection'](_0x33b96b[_0xf281('0x2d')],_0x33b96b[_0xf281('0x2e')]);_0x11525e[_0xf281('0x31')]=_[_0xf281('0x32')](_0x33b96b['model'],qs[_0xf281('0x33')](_0x2ba6f3[_0xf281('0x2e')][_0xf281('0x33')]));_0x11525e['attributes']=_0x11525e[_0xf281('0x31')][_0xf281('0x34')]?_0x11525e[_0xf281('0x31')]:_0x33b96b[_0xf281('0x2d')];if(!_0x2ba6f3['query'][_0xf281('0x35')](_0xf281('0x36'))){_0x11525e[_0xf281('0x1b')]=qs[_0xf281('0x1b')](_0x2ba6f3['query']['limit']);_0x11525e[_0xf281('0x18')]=qs[_0xf281('0x18')](_0x2ba6f3[_0xf281('0x2e')][_0xf281('0x18')]);}_0x11525e[_0xf281('0x37')]=qs[_0xf281('0x38')](_0x2ba6f3['query'][_0xf281('0x38')]);_0x11525e[_0xf281('0x39')]=qs[_0xf281('0x30')](_[_0xf281('0x3a')](_0x2ba6f3['query'],_0x33b96b[_0xf281('0x30')]),_0x2ae0a6);if(_0x2ba6f3[_0xf281('0x2e')][_0xf281('0x3b')]){_0x11525e[_0xf281('0x39')]=_['merge'](_0x11525e[_0xf281('0x39')],{'$or':_['map'](_0x2ae0a6,function(_0x1b3e85){if(_0x1b3e85[_0xf281('0x2b')]!==_0xf281('0x3c')){var _0x5637db={};_0x5637db[_0x1b3e85['name']]={'$like':'%'+_0x2ba6f3['query'][_0xf281('0x3b')]+'%'};return _0x5637db;}})});}_0x11525e=_[_0xf281('0x3d')]({},_0x11525e,_0x2ba6f3['options']);var _0x314b62={'where':_0x11525e['where']};return db['Template'][_0xf281('0x1a')](_0x314b62)['then'](function(_0x54869c){_0x310da8[_0xf281('0x1a')]=_0x54869c;if(_0x2ba6f3[_0xf281('0x2e')][_0xf281('0x3e')]){_0x11525e[_0xf281('0x3f')]=[{'all':!![]}];}return db[_0xf281('0x28')][_0xf281('0x40')](_0x11525e);})['then'](function(_0x299513){_0x310da8[_0xf281('0x41')]=_0x299513;return _0x310da8;})[_0xf281('0x20')](respondWithFilteredResult(_0x5d831b,_0x11525e))[_0xf281('0x42')](handleError(_0x5d831b,null));};exports[_0xf281('0x43')]=function(_0x2ca43b,_0x57c825){var _0x2961c0={'raw':!![],'where':{'id':_0x2ca43b['params']['id']}},_0x487cd9={};_0x487cd9[_0xf281('0x2d')]=_[_0xf281('0x2f')](db['Template'][_0xf281('0x29')]);_0x487cd9['query']=_[_0xf281('0x2f')](_0x2ca43b[_0xf281('0x2e')]);_0x487cd9[_0xf281('0x30')]=_[_0xf281('0x32')](_0x487cd9[_0xf281('0x2d')],_0x487cd9['query']);_0x2961c0['attributes']=_['intersection'](_0x487cd9[_0xf281('0x2d')],qs[_0xf281('0x33')](_0x2ca43b['query'][_0xf281('0x33')]));_0x2961c0['attributes']=_0x2961c0[_0xf281('0x31')][_0xf281('0x34')]?_0x2961c0['attributes']:_0x487cd9[_0xf281('0x2d')];if(_0x2ca43b['query'][_0xf281('0x3e')]){_0x2961c0[_0xf281('0x3f')]=[{'all':!![]}];}_0x2961c0=_[_0xf281('0x3d')]({},_0x2961c0,_0x2ca43b['options']);return db[_0xf281('0x28')][_0xf281('0x44')](_0x2961c0)[_0xf281('0x20')](handleEntityNotFound(_0x57c825,null))[_0xf281('0x20')](respondWithResult(_0x57c825,null))[_0xf281('0x42')](handleError(_0x57c825,null));};exports['create']=function(_0x44c827,_0x3fd12d){return db[_0xf281('0x28')][_0xf281('0x45')](_0x44c827[_0xf281('0x46')],{})[_0xf281('0x20')](function(_0x180911){var _0x55a972=_0x44c827[_0xf281('0x47')][_0xf281('0x21')]({'plain':!![]});if(!_0x55a972)throw new Error(_0xf281('0x48'));if(_0x55a972['role']==='user'){var _0x2fe53b=_0x180911['get']({'plain':!![]});var _0x4fa850=_0xf281('0x49');return db[_0xf281('0x4a')][_0xf281('0x44')]({'where':{'name':_0x4fa850,'userProfileId':_0x55a972[_0xf281('0x4b')]},'raw':!![]})[_0xf281('0x20')](function(_0x18bfe8){if(_0x18bfe8&&_0x18bfe8[_0xf281('0x4c')]===0x0){return db[_0xf281('0x4d')][_0xf281('0x45')]({'name':_0x2fe53b[_0xf281('0x25')],'resourceId':_0x2fe53b['id'],'type':_0x18bfe8[_0xf281('0x25')],'sectionId':_0x18bfe8['id']},{})[_0xf281('0x20')](function(){return _0x180911;});}else{return _0x180911;}})['catch'](function(_0x33f617){logger[_0xf281('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x33f617);throw _0x33f617;});}return _0x180911;})[_0xf281('0x20')](respondWithResult(_0x3fd12d,0xc9))[_0xf281('0x42')](handleError(_0x3fd12d,null));};exports[_0xf281('0x1f')]=function(_0x2589ea,_0x4d1be1){if(_0x2589ea['body']['id']){delete _0x2589ea[_0xf281('0x46')]['id'];}return db[_0xf281('0x28')]['find']({'where':{'id':_0x2589ea[_0xf281('0x4e')]['id']}})[_0xf281('0x20')](handleEntityNotFound(_0x4d1be1,null))[_0xf281('0x20')](saveUpdates(_0x2589ea[_0xf281('0x46')],null))[_0xf281('0x20')](respondWithResult(_0x4d1be1,null))[_0xf281('0x42')](handleError(_0x4d1be1,null));};exports[_0xf281('0x22')]=function(_0x133fcc,_0x85198f){return db[_0xf281('0x28')]['find']({'where':{'id':_0x133fcc[_0xf281('0x4e')]['id']}})[_0xf281('0x20')](handleEntityNotFound(_0x85198f,null))[_0xf281('0x20')](removeEntity(_0x85198f,null))[_0xf281('0x42')](handleError(_0x85198f,null));}; \ No newline at end of file +var _0x956f=['apply','reject','update','then','destroy','get','Templates','UserProfileResource','error','stack','name','map','Template','rawAttributes','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','show','params','includeAll','find','catch','create','body','user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x956f,0xcf));var _0xf956=function(_0x3d1187,_0x2a8e79){_0x3d1187=_0x3d1187-0x0;var _0x3ceb4d=_0x956f[_0x3d1187];return _0x3ceb4d;};'use strict';var emlformat=require(_0xf956('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf956('0x1'));var jsonpatch=require(_0xf956('0x2'));var rp=require('request-promise');var moment=require(_0xf956('0x3'));var BPromise=require(_0xf956('0x4'));var Mustache=require('mustache');var util=require(_0xf956('0x5'));var path=require('path');var sox=require(_0xf956('0x6'));var csv=require(_0xf956('0x7'));var ejs=require(_0xf956('0x8'));var fs=require('fs');var fs_extra=require(_0xf956('0x9'));var _=require(_0xf956('0xa'));var squel=require(_0xf956('0xb'));var crypto=require(_0xf956('0xc'));var jsforce=require(_0xf956('0xd'));var deskjs=require(_0xf956('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf956('0xf'));var Redis=require(_0xf956('0x10'));var authService=require(_0xf956('0x11'));var qs=require(_0xf956('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf956('0x13'));var logger=require(_0xf956('0x14'))('api');var utils=require(_0xf956('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf956('0x16'))['db'];function respondWithStatusCode(_0x5762ec,_0x5369ae){_0x5369ae=_0x5369ae||0xcc;return function(_0x54f4a9){if(_0x54f4a9){return _0x5762ec[_0xf956('0x17')](_0x5369ae);}return _0x5762ec[_0xf956('0x18')](_0x5369ae)[_0xf956('0x19')]();};}function respondWithResult(_0x46f1c7,_0x1d340b){_0x1d340b=_0x1d340b||0xc8;return function(_0x289950){if(_0x289950){return _0x46f1c7[_0xf956('0x18')](_0x1d340b)[_0xf956('0x1a')](_0x289950);}};}function respondWithFilteredResult(_0x275e12,_0x1c0381){return function(_0x3c423e){if(_0x3c423e){var _0x53a701=typeof _0x1c0381[_0xf956('0x1b')]==='undefined'&&typeof _0x1c0381[_0xf956('0x1c')]===_0xf956('0x1d');var _0x599ead=_0x3c423e[_0xf956('0x1e')];var _0x24245f=_0x53a701?0x0:_0x1c0381[_0xf956('0x1b')];var _0x2a534a=_0x53a701?_0x3c423e[_0xf956('0x1e')]:_0x1c0381[_0xf956('0x1b')]+_0x1c0381[_0xf956('0x1c')];var _0x45e8ff;if(_0x2a534a>=_0x599ead){_0x2a534a=_0x599ead;_0x45e8ff=0xc8;}else{_0x45e8ff=0xce;}_0x275e12[_0xf956('0x18')](_0x45e8ff);return _0x275e12[_0xf956('0x1f')](_0xf956('0x20'),_0x24245f+'-'+_0x2a534a+'/'+_0x599ead)['json'](_0x3c423e);}return null;};}function patchUpdates(_0x41193d){return function(_0x198a66){try{jsonpatch[_0xf956('0x21')](_0x198a66,_0x41193d,!![]);}catch(_0x377f74){return BPromise[_0xf956('0x22')](_0x377f74);}return _0x198a66['save']();};}function saveUpdates(_0x2d6634,_0x5482e3){return function(_0x3a275b){if(_0x3a275b){return _0x3a275b[_0xf956('0x23')](_0x2d6634)[_0xf956('0x24')](function(_0x922baa){return _0x922baa;});}return null;};}function removeEntity(_0x2376fc,_0x541603){return function(_0x53cd90){if(_0x53cd90){return _0x53cd90[_0xf956('0x25')]()[_0xf956('0x24')](function(){var _0x18dab9=_0x53cd90[_0xf956('0x26')]({'plain':!![]});var _0x40ea9e=_0xf956('0x27');return db[_0xf956('0x28')][_0xf956('0x25')]({'where':{'type':_0x40ea9e,'resourceId':_0x18dab9['id']}})[_0xf956('0x24')](function(){return _0x53cd90;});})[_0xf956('0x24')](function(){_0x2376fc['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x338fc1,_0x47cd50){return function(_0x47fd4c){if(!_0x47fd4c){_0x338fc1[_0xf956('0x17')](0x194);}return _0x47fd4c;};}function handleError(_0x51a4c5,_0x4e62f8){_0x4e62f8=_0x4e62f8||0x1f4;return function(_0x2c66c0){logger[_0xf956('0x29')](_0x2c66c0[_0xf956('0x2a')]);if(_0x2c66c0[_0xf956('0x2b')]){delete _0x2c66c0[_0xf956('0x2b')];}_0x51a4c5[_0xf956('0x18')](_0x4e62f8)['send'](_0x2c66c0);};}exports['index']=function(_0x5276f4,_0x3111b6){var _0x348e61={},_0x471f7f={},_0x2266de={'count':0x0,'rows':[]};var _0x150e13=_[_0xf956('0x2c')](db[_0xf956('0x2d')][_0xf956('0x2e')],function(_0x1d38b2){return{'name':_0x1d38b2['fieldName'],'type':_0x1d38b2[_0xf956('0x2f')][_0xf956('0x30')]};});_0x471f7f['model']=_['map'](_0x150e13,_0xf956('0x2b'));_0x471f7f[_0xf956('0x31')]=_[_0xf956('0x32')](_0x5276f4['query']);_0x471f7f[_0xf956('0x33')]=_[_0xf956('0x34')](_0x471f7f['model'],_0x471f7f[_0xf956('0x31')]);_0x348e61[_0xf956('0x35')]=_[_0xf956('0x34')](_0x471f7f[_0xf956('0x36')],qs[_0xf956('0x37')](_0x5276f4[_0xf956('0x31')]['fields']));_0x348e61[_0xf956('0x35')]=_0x348e61['attributes'][_0xf956('0x38')]?_0x348e61['attributes']:_0x471f7f['model'];if(!_0x5276f4[_0xf956('0x31')][_0xf956('0x39')](_0xf956('0x3a'))){_0x348e61[_0xf956('0x1c')]=qs[_0xf956('0x1c')](_0x5276f4[_0xf956('0x31')][_0xf956('0x1c')]);_0x348e61[_0xf956('0x1b')]=qs[_0xf956('0x1b')](_0x5276f4[_0xf956('0x31')][_0xf956('0x1b')]);}_0x348e61[_0xf956('0x3b')]=qs[_0xf956('0x3c')](_0x5276f4[_0xf956('0x31')][_0xf956('0x3c')]);_0x348e61[_0xf956('0x3d')]=qs[_0xf956('0x33')](_[_0xf956('0x3e')](_0x5276f4['query'],_0x471f7f[_0xf956('0x33')]),_0x150e13);if(_0x5276f4[_0xf956('0x31')]['filter']){_0x348e61[_0xf956('0x3d')]=_[_0xf956('0x3f')](_0x348e61[_0xf956('0x3d')],{'$or':_['map'](_0x150e13,function(_0x59bf81){if(_0x59bf81[_0xf956('0x2f')]!==_0xf956('0x40')){var _0x3b676a={};_0x3b676a[_0x59bf81[_0xf956('0x2b')]]={'$like':'%'+_0x5276f4[_0xf956('0x31')][_0xf956('0x41')]+'%'};return _0x3b676a;}})});}_0x348e61=_['merge']({},_0x348e61,_0x5276f4[_0xf956('0x42')]);var _0x2e7ab5={'where':_0x348e61['where']};return db[_0xf956('0x2d')][_0xf956('0x1e')](_0x2e7ab5)['then'](function(_0xf5f31e){_0x2266de[_0xf956('0x1e')]=_0xf5f31e;if(_0x5276f4[_0xf956('0x31')]['includeAll']){_0x348e61[_0xf956('0x43')]=[{'all':!![]}];}return db[_0xf956('0x2d')][_0xf956('0x44')](_0x348e61);})[_0xf956('0x24')](function(_0xd3a616){_0x2266de['rows']=_0xd3a616;return _0x2266de;})['then'](respondWithFilteredResult(_0x3111b6,_0x348e61))['catch'](handleError(_0x3111b6,null));};exports[_0xf956('0x45')]=function(_0x18e39d,_0x48c2d6){var _0x318a0d={'raw':!![],'where':{'id':_0x18e39d[_0xf956('0x46')]['id']}},_0x27e98f={};_0x27e98f[_0xf956('0x36')]=_[_0xf956('0x32')](db['Template'][_0xf956('0x2e')]);_0x27e98f[_0xf956('0x31')]=_[_0xf956('0x32')](_0x18e39d[_0xf956('0x31')]);_0x27e98f[_0xf956('0x33')]=_[_0xf956('0x34')](_0x27e98f[_0xf956('0x36')],_0x27e98f[_0xf956('0x31')]);_0x318a0d[_0xf956('0x35')]=_['intersection'](_0x27e98f['model'],qs[_0xf956('0x37')](_0x18e39d['query']['fields']));_0x318a0d['attributes']=_0x318a0d['attributes']['length']?_0x318a0d[_0xf956('0x35')]:_0x27e98f[_0xf956('0x36')];if(_0x18e39d[_0xf956('0x31')][_0xf956('0x47')]){_0x318a0d['include']=[{'all':!![]}];}_0x318a0d=_['merge']({},_0x318a0d,_0x18e39d['options']);return db[_0xf956('0x2d')][_0xf956('0x48')](_0x318a0d)[_0xf956('0x24')](handleEntityNotFound(_0x48c2d6,null))[_0xf956('0x24')](respondWithResult(_0x48c2d6,null))[_0xf956('0x49')](handleError(_0x48c2d6,null));};exports['create']=function(_0x1d29f9,_0x547e6d){return db[_0xf956('0x2d')][_0xf956('0x4a')](_0x1d29f9[_0xf956('0x4b')],{})[_0xf956('0x24')](function(_0x1cf38c){var _0x8078f6=_0x1d29f9[_0xf956('0x4c')][_0xf956('0x26')]({'plain':!![]});if(!_0x8078f6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x8078f6[_0xf956('0x4d')]==='user'){var _0x28d03d=_0x1cf38c[_0xf956('0x26')]({'plain':!![]});var _0x2fe844=_0xf956('0x27');return db[_0xf956('0x4e')][_0xf956('0x48')]({'where':{'name':_0x2fe844,'userProfileId':_0x8078f6['userProfileId']},'raw':!![]})[_0xf956('0x24')](function(_0x2f07ce){if(_0x2f07ce&&_0x2f07ce['autoAssociation']===0x0){return db[_0xf956('0x28')]['create']({'name':_0x28d03d[_0xf956('0x2b')],'resourceId':_0x28d03d['id'],'type':_0x2f07ce[_0xf956('0x2b')],'sectionId':_0x2f07ce['id']},{})['then'](function(){return _0x1cf38c;});}else{return _0x1cf38c;}})[_0xf956('0x49')](function(_0x4105aa){logger['error'](_0xf956('0x4f'),_0x4105aa);throw _0x4105aa;});}return _0x1cf38c;})[_0xf956('0x24')](respondWithResult(_0x547e6d,0xc9))['catch'](handleError(_0x547e6d,null));};exports[_0xf956('0x23')]=function(_0x29428b,_0x22833e){if(_0x29428b[_0xf956('0x4b')]['id']){delete _0x29428b['body']['id'];}return db[_0xf956('0x2d')]['find']({'where':{'id':_0x29428b['params']['id']}})[_0xf956('0x24')](handleEntityNotFound(_0x22833e,null))[_0xf956('0x24')](saveUpdates(_0x29428b[_0xf956('0x4b')],null))[_0xf956('0x24')](respondWithResult(_0x22833e,null))[_0xf956('0x49')](handleError(_0x22833e,null));};exports[_0xf956('0x25')]=function(_0x4c0216,_0x92236b){return db[_0xf956('0x2d')]['find']({'where':{'id':_0x4c0216[_0xf956('0x46')]['id']}})['then'](handleEntityNotFound(_0x92236b,null))[_0xf956('0x24')](removeEntity(_0x92236b,null))[_0xf956('0x49')](handleError(_0x92236b,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 62c2fd1..5266252 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 _0xcdc0=['exports','define','tools_templates','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./template.attributes'];(function(_0x202ab7,_0x364c28){var _0x199c7e=function(_0x4ae663){while(--_0x4ae663){_0x202ab7['push'](_0x202ab7['shift']());}};_0x199c7e(++_0x364c28);}(_0xcdc0,0x18f));var _0x0cdc=function(_0x1553f7,_0x1e8e64){_0x1553f7=_0x1553f7-0x0;var _0x33cb06=_0xcdc0[_0x1553f7];return _0x33cb06;};'use strict';var _=require(_0x0cdc('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x0cdc('0x1'));var moment=require(_0x0cdc('0x2'));var BPromise=require(_0x0cdc('0x3'));var rp=require(_0x0cdc('0x4'));var fs=require('fs');var path=require(_0x0cdc('0x5'));var rimraf=require(_0x0cdc('0x6'));var config=require(_0x0cdc('0x7'));var attributes=require(_0x0cdc('0x8'));module[_0x0cdc('0x9')]=function(_0x199ebf,_0x4f3de6){return _0x199ebf[_0x0cdc('0xa')]('Template',attributes,{'tableName':_0x0cdc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2d95=['moment','bluebird','rimraf','../../config/environment','exports','Template','tools_templates','lodash','api'];(function(_0x2832b4,_0x2992ef){var _0x1f0f44=function(_0x175055){while(--_0x175055){_0x2832b4['push'](_0x2832b4['shift']());}};_0x1f0f44(++_0x2992ef);}(_0x2d95,0x142));var _0x52d9=function(_0x6025fc,_0x341da2){_0x6025fc=_0x6025fc-0x0;var _0x139404=_0x2d95[_0x6025fc];return _0x139404;};'use strict';var _=require(_0x52d9('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x52d9('0x1'));var moment=require(_0x52d9('0x2'));var BPromise=require(_0x52d9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x52d9('0x4'));var config=require(_0x52d9('0x5'));var attributes=require('./template.attributes');module[_0x52d9('0x6')]=function(_0x34a24b,_0x322aad){return _0x34a24b['define'](_0x52d9('0x7'),attributes,{'tableName':_0x52d9('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index 6c3d0e9..1ae9e56 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 _0x3afb=['debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','GetTemplate','Template','options','raw','where','attributes','limit','include','map','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','Template,\x20%s,\x20%s','request\x20sent'];(function(_0x106f42,_0x131ed9){var _0x3af68e=function(_0x77ee39){while(--_0x77ee39){_0x106f42['push'](_0x106f42['shift']());}};_0x3af68e(++_0x131ed9);}(_0x3afb,0xc1));var _0xb3af=function(_0x1757f2,_0x1b09fa){_0x1757f2=_0x1757f2-0x0;var _0x5e7212=_0x3afb[_0x1757f2];return _0x5e7212;};'use strict';var _=require(_0xb3af('0x0'));var util=require(_0xb3af('0x1'));var moment=require(_0xb3af('0x2'));var BPromise=require(_0xb3af('0x3'));var rs=require(_0xb3af('0x4'));var fs=require('fs');var Redis=require(_0xb3af('0x5'));var db=require(_0xb3af('0x6'))['db'];var utils=require(_0xb3af('0x7'));var logger=require(_0xb3af('0x8'))(_0xb3af('0x9'));var config=require('../../config/environment');var jayson=require(_0xb3af('0xa'));var client=jayson[_0xb3af('0xb')][_0xb3af('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x44edd5,_0x791694,_0x39538c){return new BPromise(function(_0x19e654,_0x14382b){return client[_0xb3af('0xd')](_0x44edd5,_0x39538c)[_0xb3af('0xe')](function(_0x440623){logger['info'](_0xb3af('0xf'),_0x791694,_0xb3af('0x10'));logger[_0xb3af('0x11')](_0xb3af('0x12'),_0x791694,_0xb3af('0x10'),JSON[_0xb3af('0x13')](_0x440623));if(_0x440623[_0xb3af('0x14')]){if(_0x440623[_0xb3af('0x14')]['code']===0x1f4){logger[_0xb3af('0x14')](_0xb3af('0xf'),_0x791694,_0x440623['error']['message']);return _0x14382b(_0x440623[_0xb3af('0x14')]['message']);}logger[_0xb3af('0x14')](_0xb3af('0xf'),_0x791694,_0x440623[_0xb3af('0x14')][_0xb3af('0x15')]);return _0x19e654(_0x440623['error'][_0xb3af('0x15')]);}else{logger[_0xb3af('0x16')](_0xb3af('0xf'),_0x791694,_0xb3af('0x10'));_0x19e654(_0x440623[_0xb3af('0x17')][_0xb3af('0x15')]);}})[_0xb3af('0x18')](function(_0x57b593){logger[_0xb3af('0x14')]('Template,\x20%s,\x20%s',_0x791694,_0x57b593);_0x14382b(_0x57b593);});});}exports[_0xb3af('0x19')]=function(_0x54c1af){var _0x4d5280=this;return new Promise(function(_0x34d8a8,_0x495e18){return db[_0xb3af('0x1a')]['findAll']({'raw':_0x54c1af[_0xb3af('0x1b')]?_0x54c1af['options'][_0xb3af('0x1c')]===undefined?!![]:![]:!![],'where':_0x54c1af[_0xb3af('0x1b')]?_0x54c1af[_0xb3af('0x1b')][_0xb3af('0x1d')]||null:null,'attributes':_0x54c1af[_0xb3af('0x1b')]?_0x54c1af[_0xb3af('0x1b')][_0xb3af('0x1e')]||null:null,'limit':_0x54c1af[_0xb3af('0x1b')]?_0x54c1af[_0xb3af('0x1b')][_0xb3af('0x1f')]||null:null,'include':_0x54c1af[_0xb3af('0x1b')]?_0x54c1af[_0xb3af('0x1b')][_0xb3af('0x20')]?_[_0xb3af('0x21')](_0x54c1af[_0xb3af('0x1b')][_0xb3af('0x20')],function(_0x3add18){return{'model':db[_0x3add18[_0xb3af('0x22')]],'as':_0x3add18['as'],'attributes':_0x3add18['attributes'],'include':_0x3add18['include']?_[_0xb3af('0x21')](_0x3add18[_0xb3af('0x20')],function(_0x4fc0ec){return{'model':db[_0x4fc0ec[_0xb3af('0x22')]],'as':_0x4fc0ec['as'],'attributes':_0x4fc0ec['attributes'],'include':_0x4fc0ec['include']?_[_0xb3af('0x21')](_0x4fc0ec['include'],function(_0x48f3cd){return{'model':db[_0x48f3cd[_0xb3af('0x22')]],'as':_0x48f3cd['as'],'attributes':_0x48f3cd[_0xb3af('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xb3af('0xe')](function(_0x43941b){logger[_0xb3af('0x16')](_0xb3af('0x19'),_0x54c1af);logger[_0xb3af('0x11')]('GetTemplate',_0x54c1af,JSON[_0xb3af('0x13')](_0x43941b));_0x34d8a8(_0x43941b);})['catch'](function(_0x536b1){logger[_0xb3af('0x14')]('GetTemplate',_0x536b1[_0xb3af('0x15')],_0x54c1af);_0x495e18(_0x4d5280['error'](0x1f4,_0x536b1[_0xb3af('0x15')]));});});}; \ No newline at end of file +var _0xdc42=['model','map','then','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','info','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','code','error','Template,\x20%s,\x20%s','message','result','catch','GetTemplate','findAll','options','attributes','include'];(function(_0x8a76ee,_0x20eb15){var _0x5d93d6=function(_0x398625){while(--_0x398625){_0x8a76ee['push'](_0x8a76ee['shift']());}};_0x5d93d6(++_0x20eb15);}(_0xdc42,0x199));var _0x2dc4=function(_0x4424c7,_0x38afdd){_0x4424c7=_0x4424c7-0x0;var _0x3741bf=_0xdc42[_0x4424c7];return _0x3741bf;};'use strict';var _=require(_0x2dc4('0x0'));var util=require('util');var moment=require(_0x2dc4('0x1'));var BPromise=require(_0x2dc4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2dc4('0x3'));var db=require(_0x2dc4('0x4'))['db'];var utils=require(_0x2dc4('0x5'));var logger=require(_0x2dc4('0x6'))(_0x2dc4('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x2dc4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4071d9,_0x1ee112,_0x4824b1){return new BPromise(function(_0x2695d2,_0x255b70){return client[_0x2dc4('0x9')](_0x4071d9,_0x4824b1)['then'](function(_0x5cd361){logger[_0x2dc4('0xa')]('Template,\x20%s,\x20%s',_0x1ee112,_0x2dc4('0xb'));logger[_0x2dc4('0xc')](_0x2dc4('0xd'),_0x1ee112,'request\x20sent',JSON[_0x2dc4('0xe')](_0x5cd361));if(_0x5cd361['error']){if(_0x5cd361['error'][_0x2dc4('0xf')]===0x1f4){logger[_0x2dc4('0x10')](_0x2dc4('0x11'),_0x1ee112,_0x5cd361['error'][_0x2dc4('0x12')]);return _0x255b70(_0x5cd361['error'][_0x2dc4('0x12')]);}logger['error'](_0x2dc4('0x11'),_0x1ee112,_0x5cd361[_0x2dc4('0x10')][_0x2dc4('0x12')]);return _0x2695d2(_0x5cd361['error'][_0x2dc4('0x12')]);}else{logger[_0x2dc4('0xa')]('Template,\x20%s,\x20%s',_0x1ee112,_0x2dc4('0xb'));_0x2695d2(_0x5cd361[_0x2dc4('0x13')][_0x2dc4('0x12')]);}})[_0x2dc4('0x14')](function(_0x22ca5c){logger[_0x2dc4('0x10')](_0x2dc4('0x11'),_0x1ee112,_0x22ca5c);_0x255b70(_0x22ca5c);});});}exports[_0x2dc4('0x15')]=function(_0x4d5c2d){var _0x3b8db0=this;return new Promise(function(_0x44d27e,_0x2272b9){return db['Template'][_0x2dc4('0x16')]({'raw':_0x4d5c2d[_0x2dc4('0x17')]?_0x4d5c2d[_0x2dc4('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x4d5c2d[_0x2dc4('0x17')]?_0x4d5c2d[_0x2dc4('0x17')]['where']||null:null,'attributes':_0x4d5c2d[_0x2dc4('0x17')]?_0x4d5c2d[_0x2dc4('0x17')][_0x2dc4('0x18')]||null:null,'limit':_0x4d5c2d['options']?_0x4d5c2d['options']['limit']||null:null,'include':_0x4d5c2d['options']?_0x4d5c2d[_0x2dc4('0x17')]['include']?_['map'](_0x4d5c2d[_0x2dc4('0x17')][_0x2dc4('0x19')],function(_0xc95136){return{'model':db[_0xc95136[_0x2dc4('0x1a')]],'as':_0xc95136['as'],'attributes':_0xc95136['attributes'],'include':_0xc95136[_0x2dc4('0x19')]?_[_0x2dc4('0x1b')](_0xc95136[_0x2dc4('0x19')],function(_0x9a9c64){return{'model':db[_0x9a9c64[_0x2dc4('0x1a')]],'as':_0x9a9c64['as'],'attributes':_0x9a9c64[_0x2dc4('0x18')],'include':_0x9a9c64['include']?_[_0x2dc4('0x1b')](_0x9a9c64[_0x2dc4('0x19')],function(_0x14cb31){return{'model':db[_0x14cb31['model']],'as':_0x14cb31['as'],'attributes':_0x14cb31[_0x2dc4('0x18')]};}):[]};}):[]};}):[]:[]})[_0x2dc4('0x1c')](function(_0x19dffc){logger[_0x2dc4('0xa')]('GetTemplate',_0x4d5c2d);logger['debug'](_0x2dc4('0x15'),_0x4d5c2d,JSON[_0x2dc4('0xe')](_0x19dffc));_0x44d27e(_0x19dffc);})[_0x2dc4('0x14')](function(_0x32ed33){logger[_0x2dc4('0x10')]('GetTemplate',_0x32ed33['message'],_0x4d5c2d);_0x2272b9(_0x3b8db0[_0x2dc4('0x10')](0x1f4,_0x32ed33[_0x2dc4('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 10ff26b..db999f3 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 _0xe0dd=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','/:id/any_conditions','getActions','post','create','addAllCondition','put','update','delete','destroy','exports','multer','util'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0xe0dd,0x163));var _0xde0d=function(_0x228641,_0x25d636){_0x228641=_0x228641-0x0;var _0x5d5d78=_0xe0dd[_0x228641];return _0x5d5d78;};'use strict';var multer=require(_0xde0d('0x0'));var util=require(_0xde0d('0x1'));var path=require('path');var timeout=require(_0xde0d('0x2'));var express=require(_0xde0d('0x3'));var router=express[_0xde0d('0x4')]();var fs_extra=require(_0xde0d('0x5'));var auth=require(_0xde0d('0x6'));var interaction=require(_0xde0d('0x7'));var config=require('../../config/environment');var controller=require('./trigger.controller');router[_0xde0d('0x8')]('/',auth[_0xde0d('0x9')](),controller['index']);router[_0xde0d('0x8')](_0xde0d('0xa'),auth[_0xde0d('0x9')](),controller['show']);router[_0xde0d('0x8')]('/:id/all_conditions',auth[_0xde0d('0x9')](),controller['getAllConditions']);router[_0xde0d('0x8')](_0xde0d('0xb'),auth[_0xde0d('0x9')](),controller['getAnyConditions']);router['get']('/:id/actions',auth[_0xde0d('0x9')](),controller[_0xde0d('0xc')]);router[_0xde0d('0xd')]('/',auth['isAuthenticated'](),controller[_0xde0d('0xe')]);router[_0xde0d('0xd')]('/:id/all_conditions',auth[_0xde0d('0x9')](),controller[_0xde0d('0xf')]);router[_0xde0d('0xd')](_0xde0d('0xb'),auth[_0xde0d('0x9')](),controller['addAnyCondition']);router[_0xde0d('0xd')]('/:id/actions',auth[_0xde0d('0x9')](),controller['addAction']);router[_0xde0d('0x10')]('/:id',auth[_0xde0d('0x9')](),controller[_0xde0d('0x11')]);router[_0xde0d('0x12')](_0xde0d('0xa'),auth[_0xde0d('0x9')](),controller[_0xde0d('0x13')]);module[_0xde0d('0x14')]=router; \ No newline at end of file +var _0x7d4d=['addAction','put','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','addAllCondition','addAnyCondition'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7d4d,0x18a));var _0xd7d4=function(_0x64aff8,_0x106082){_0x64aff8=_0x64aff8-0x0;var _0x5488a3=_0x7d4d[_0x64aff8];return _0x5488a3;};'use strict';var multer=require('multer');var util=require(_0xd7d4('0x0'));var path=require(_0xd7d4('0x1'));var timeout=require(_0xd7d4('0x2'));var express=require(_0xd7d4('0x3'));var router=express[_0xd7d4('0x4')]();var fs_extra=require(_0xd7d4('0x5'));var auth=require(_0xd7d4('0x6'));var interaction=require(_0xd7d4('0x7'));var config=require('../../config/environment');var controller=require('./trigger.controller');router[_0xd7d4('0x8')]('/',auth[_0xd7d4('0x9')](),controller[_0xd7d4('0xa')]);router['get'](_0xd7d4('0xb'),auth[_0xd7d4('0x9')](),controller[_0xd7d4('0xc')]);router[_0xd7d4('0x8')](_0xd7d4('0xd'),auth[_0xd7d4('0x9')](),controller[_0xd7d4('0xe')]);router['get'](_0xd7d4('0xf'),auth[_0xd7d4('0x9')](),controller[_0xd7d4('0x10')]);router[_0xd7d4('0x8')](_0xd7d4('0x11'),auth[_0xd7d4('0x9')](),controller[_0xd7d4('0x12')]);router[_0xd7d4('0x13')]('/',auth[_0xd7d4('0x9')](),controller['create']);router[_0xd7d4('0x13')](_0xd7d4('0xd'),auth[_0xd7d4('0x9')](),controller[_0xd7d4('0x14')]);router[_0xd7d4('0x13')](_0xd7d4('0xf'),auth[_0xd7d4('0x9')](),controller[_0xd7d4('0x15')]);router['post'](_0xd7d4('0x11'),auth[_0xd7d4('0x9')](),controller[_0xd7d4('0x16')]);router[_0xd7d4('0x17')](_0xd7d4('0xb'),auth[_0xd7d4('0x9')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xd7d4('0x18')]);module[_0xd7d4('0x19')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 14d93a8..05aeaa7 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 _0x0a41=['STRING','BOOLEAN','exports'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x0a41,0xe6));var _0x10a4=function(_0x30381e,_0x2a1f30){_0x30381e=_0x30381e-0x0;var _0x9fb2f3=_0x0a41[_0x30381e];return _0x9fb2f3;};'use strict';var Sequelize=require('sequelize');module[_0x10a4('0x0')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x10a4('0x1')]},'status':{'type':Sequelize[_0x10a4('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xae8a=['sequelize','STRING'];(function(_0x4ba644,_0x38ec13){var _0x394acb=function(_0x1b72e6){while(--_0x1b72e6){_0x4ba644['push'](_0x4ba644['shift']());}};_0x394acb(++_0x38ec13);}(_0xae8a,0x98));var _0xaae8=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xae8a[_0x433a86];return _0x23000c;};'use strict';var Sequelize=require(_0xaae8('0x0'));module['exports']={'name':{'type':Sequelize[_0xaae8('0x1')]},'channel':{'type':Sequelize[_0xaae8('0x1')]},'description':{'type':Sequelize[_0xaae8('0x1')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 4badb9a..0e782d3 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 _0x1cf8=['body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','findOne','getAllConditions','getAnyConditions','TriggerId','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','save','then','destroy','get','Triggers','UserProfileResource','error','stack','name','map','Trigger','rawAttributes','fieldName','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','create'];(function(_0xc545f4,_0x587830){var _0x8484a8=function(_0x2b29d1){while(--_0x2b29d1){_0xc545f4['push'](_0xc545f4['shift']());}};_0x8484a8(++_0x587830);}(_0x1cf8,0x76));var _0x81cf=function(_0x3c487b,_0x44c5e2){_0x3c487b=_0x3c487b-0x0;var _0x1d65f6=_0x1cf8[_0x3c487b];return _0x1d65f6;};'use strict';var emlformat=require(_0x81cf('0x0'));var rimraf=require(_0x81cf('0x1'));var zipdir=require(_0x81cf('0x2'));var jsonpatch=require(_0x81cf('0x3'));var rp=require(_0x81cf('0x4'));var moment=require('moment');var BPromise=require(_0x81cf('0x5'));var Mustache=require(_0x81cf('0x6'));var util=require('util');var path=require('path');var sox=require(_0x81cf('0x7'));var csv=require(_0x81cf('0x8'));var ejs=require(_0x81cf('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x81cf('0xa'));var squel=require(_0x81cf('0xb'));var crypto=require(_0x81cf('0xc'));var jsforce=require(_0x81cf('0xd'));var deskjs=require(_0x81cf('0xe'));var toCsv=require(_0x81cf('0x8'));var querystring=require(_0x81cf('0xf'));var Papa=require(_0x81cf('0x10'));var Redis=require(_0x81cf('0x11'));var authService=require(_0x81cf('0x12'));var qs=require(_0x81cf('0x13'));var as=require(_0x81cf('0x14'));var hardwareService=require(_0x81cf('0x15'));var logger=require(_0x81cf('0x16'))(_0x81cf('0x17'));var utils=require(_0x81cf('0x18'));var config=require(_0x81cf('0x19'));var licenseUtil=require(_0x81cf('0x1a'));var db=require(_0x81cf('0x1b'))['db'];function respondWithStatusCode(_0x35473f,_0xced836){_0xced836=_0xced836||0xcc;return function(_0x51d0d6){if(_0x51d0d6){return _0x35473f[_0x81cf('0x1c')](_0xced836);}return _0x35473f['status'](_0xced836)[_0x81cf('0x1d')]();};}function respondWithResult(_0xa83d31,_0x730c4b){_0x730c4b=_0x730c4b||0xc8;return function(_0x2bddf7){if(_0x2bddf7){return _0xa83d31[_0x81cf('0x1e')](_0x730c4b)['json'](_0x2bddf7);}};}function respondWithFilteredResult(_0x2b6bae,_0x376e41){return function(_0x55169f){if(_0x55169f){var _0x3abcea=typeof _0x376e41[_0x81cf('0x1f')]===_0x81cf('0x20')&&typeof _0x376e41[_0x81cf('0x21')]==='undefined';var _0x2e33e0=_0x55169f[_0x81cf('0x22')];var _0xbd9a99=_0x3abcea?0x0:_0x376e41[_0x81cf('0x1f')];var _0xeb6dc3=_0x3abcea?_0x55169f[_0x81cf('0x22')]:_0x376e41[_0x81cf('0x1f')]+_0x376e41['limit'];var _0x524a76;if(_0xeb6dc3>=_0x2e33e0){_0xeb6dc3=_0x2e33e0;_0x524a76=0xc8;}else{_0x524a76=0xce;}_0x2b6bae[_0x81cf('0x1e')](_0x524a76);return _0x2b6bae[_0x81cf('0x23')](_0x81cf('0x24'),_0xbd9a99+'-'+_0xeb6dc3+'/'+_0x2e33e0)[_0x81cf('0x25')](_0x55169f);}return null;};}function patchUpdates(_0x59862a){return function(_0x1b4768){try{jsonpatch['apply'](_0x1b4768,_0x59862a,!![]);}catch(_0x2cf9f7){return BPromise['reject'](_0x2cf9f7);}return _0x1b4768[_0x81cf('0x26')]();};}function saveUpdates(_0x21e81c,_0x4bae0c){return function(_0x348314){if(_0x348314){return _0x348314['update'](_0x21e81c)[_0x81cf('0x27')](function(_0x4bfd61){return _0x4bfd61;});}return null;};}function removeEntity(_0x25afeb,_0x179ae3){return function(_0x38ef7f){if(_0x38ef7f){return _0x38ef7f[_0x81cf('0x28')]()[_0x81cf('0x27')](function(){var _0x473e17=_0x38ef7f[_0x81cf('0x29')]({'plain':!![]});var _0x5b75d9=_0x81cf('0x2a');return db[_0x81cf('0x2b')][_0x81cf('0x28')]({'where':{'type':_0x5b75d9,'resourceId':_0x473e17['id']}})['then'](function(){return _0x38ef7f;});})[_0x81cf('0x27')](function(){_0x25afeb[_0x81cf('0x1e')](0xcc)[_0x81cf('0x1d')]();});}};}function handleEntityNotFound(_0x18ac79,_0x5b6b66){return function(_0x5ca3b8){if(!_0x5ca3b8){_0x18ac79[_0x81cf('0x1c')](0x194);}return _0x5ca3b8;};}function handleError(_0x408a24,_0xa07049){_0xa07049=_0xa07049||0x1f4;return function(_0x327194){logger[_0x81cf('0x2c')](_0x327194[_0x81cf('0x2d')]);if(_0x327194[_0x81cf('0x2e')]){delete _0x327194[_0x81cf('0x2e')];}_0x408a24[_0x81cf('0x1e')](_0xa07049)['send'](_0x327194);};}exports['index']=function(_0x44e97,_0x315265){var _0x3bbc45={},_0x55c3b9={},_0x22226d={'count':0x0,'rows':[]};var _0x16ca44=_[_0x81cf('0x2f')](db[_0x81cf('0x30')][_0x81cf('0x31')],function(_0x4e6057){return{'name':_0x4e6057[_0x81cf('0x32')],'type':_0x4e6057['type']['key']};});_0x55c3b9[_0x81cf('0x33')]=_['map'](_0x16ca44,'name');_0x55c3b9[_0x81cf('0x34')]=_[_0x81cf('0x35')](_0x44e97[_0x81cf('0x34')]);_0x55c3b9[_0x81cf('0x36')]=_['intersection'](_0x55c3b9[_0x81cf('0x33')],_0x55c3b9['query']);_0x3bbc45[_0x81cf('0x37')]=_[_0x81cf('0x38')](_0x55c3b9[_0x81cf('0x33')],qs[_0x81cf('0x39')](_0x44e97[_0x81cf('0x34')]['fields']));_0x3bbc45[_0x81cf('0x37')]=_0x3bbc45[_0x81cf('0x37')][_0x81cf('0x3a')]?_0x3bbc45[_0x81cf('0x37')]:_0x55c3b9[_0x81cf('0x33')];if(!_0x44e97['query'][_0x81cf('0x3b')](_0x81cf('0x3c'))){_0x3bbc45[_0x81cf('0x21')]=qs[_0x81cf('0x21')](_0x44e97[_0x81cf('0x34')]['limit']);_0x3bbc45[_0x81cf('0x1f')]=qs[_0x81cf('0x1f')](_0x44e97[_0x81cf('0x34')][_0x81cf('0x1f')]);}_0x3bbc45[_0x81cf('0x3d')]=qs[_0x81cf('0x3e')](_0x44e97[_0x81cf('0x34')][_0x81cf('0x3e')]);_0x3bbc45[_0x81cf('0x3f')]=qs['filters'](_[_0x81cf('0x40')](_0x44e97['query'],_0x55c3b9[_0x81cf('0x36')]),_0x16ca44);if(_0x44e97[_0x81cf('0x34')][_0x81cf('0x41')]){_0x3bbc45[_0x81cf('0x3f')]=_[_0x81cf('0x42')](_0x3bbc45[_0x81cf('0x3f')],{'$or':_[_0x81cf('0x2f')](_0x16ca44,function(_0x5a64c1){if(_0x5a64c1[_0x81cf('0x43')]!==_0x81cf('0x44')){var _0x3d883b={};_0x3d883b[_0x5a64c1[_0x81cf('0x2e')]]={'$like':'%'+_0x44e97[_0x81cf('0x34')][_0x81cf('0x41')]+'%'};return _0x3d883b;}})});}_0x3bbc45=_[_0x81cf('0x42')]({},_0x3bbc45,_0x44e97[_0x81cf('0x45')]);var _0x399bc5={'where':_0x3bbc45['where']};return db[_0x81cf('0x30')][_0x81cf('0x22')](_0x399bc5)['then'](function(_0x476f06){_0x22226d[_0x81cf('0x22')]=_0x476f06;if(_0x44e97[_0x81cf('0x34')][_0x81cf('0x46')]){_0x3bbc45[_0x81cf('0x47')]=[{'all':!![]}];}return db[_0x81cf('0x30')][_0x81cf('0x48')](_0x3bbc45);})['then'](function(_0x44f311){_0x22226d[_0x81cf('0x49')]=_0x44f311;return _0x22226d;})['then'](respondWithFilteredResult(_0x315265,_0x3bbc45))['catch'](handleError(_0x315265,null));};exports[_0x81cf('0x4a')]=function(_0x2301ed,_0x53dba7){var _0x574c30={'raw':![],'where':{'id':_0x2301ed[_0x81cf('0x4b')]['id']}},_0x257863={};_0x257863[_0x81cf('0x33')]=_['keys'](db[_0x81cf('0x30')][_0x81cf('0x31')]);_0x257863[_0x81cf('0x34')]=_['keys'](_0x2301ed[_0x81cf('0x34')]);_0x257863[_0x81cf('0x36')]=_[_0x81cf('0x38')](_0x257863['model'],_0x257863[_0x81cf('0x34')]);_0x574c30[_0x81cf('0x37')]=_['intersection'](_0x257863[_0x81cf('0x33')],qs[_0x81cf('0x39')](_0x2301ed[_0x81cf('0x34')]['fields']));_0x574c30[_0x81cf('0x37')]=_0x574c30['attributes'][_0x81cf('0x3a')]?_0x574c30[_0x81cf('0x37')]:_0x257863[_0x81cf('0x33')];if(_0x2301ed['query'][_0x81cf('0x46')]){_0x574c30[_0x81cf('0x47')]=[{'all':!![]}];}_0x574c30=_[_0x81cf('0x42')]({},_0x574c30,_0x2301ed[_0x81cf('0x45')]);return db[_0x81cf('0x30')][_0x81cf('0x4c')](_0x574c30)[_0x81cf('0x27')](handleEntityNotFound(_0x53dba7,null))['then'](respondWithResult(_0x53dba7,null))['catch'](handleError(_0x53dba7,null));};exports[_0x81cf('0x4d')]=function(_0x5653e2,_0x2ab33e){return db[_0x81cf('0x30')]['create'](_0x5653e2[_0x81cf('0x4e')],{})[_0x81cf('0x27')](function(_0x1a0bad){var _0x585610=_0x5653e2[_0x81cf('0x4f')][_0x81cf('0x29')]({'plain':!![]});if(!_0x585610)throw new Error(_0x81cf('0x50'));if(_0x585610[_0x81cf('0x51')]==='user'){var _0x3261e9=_0x1a0bad[_0x81cf('0x29')]({'plain':!![]});var _0x4c1a77=_0x81cf('0x2a');return db[_0x81cf('0x52')][_0x81cf('0x4c')]({'where':{'name':_0x4c1a77,'userProfileId':_0x585610['userProfileId']},'raw':!![]})[_0x81cf('0x27')](function(_0x4bad73){if(_0x4bad73&&_0x4bad73[_0x81cf('0x53')]===0x0){return db[_0x81cf('0x2b')][_0x81cf('0x4d')]({'name':_0x3261e9[_0x81cf('0x2e')],'resourceId':_0x3261e9['id'],'type':_0x4bad73[_0x81cf('0x2e')],'sectionId':_0x4bad73['id']},{})[_0x81cf('0x27')](function(){return _0x1a0bad;});}else{return _0x1a0bad;}})[_0x81cf('0x54')](function(_0x248431){logger['error'](_0x81cf('0x55'),_0x248431);throw _0x248431;});}return _0x1a0bad;})[_0x81cf('0x27')](respondWithResult(_0x2ab33e,0xc9))[_0x81cf('0x54')](handleError(_0x2ab33e,null));};exports[_0x81cf('0x56')]=function(_0x2ccbea,_0x970f10){if(_0x2ccbea[_0x81cf('0x4e')]['id']){delete _0x2ccbea[_0x81cf('0x4e')]['id'];}return db[_0x81cf('0x30')][_0x81cf('0x4c')]({'where':{'id':_0x2ccbea[_0x81cf('0x4b')]['id']}})[_0x81cf('0x27')](handleEntityNotFound(_0x970f10,null))[_0x81cf('0x27')](saveUpdates(_0x2ccbea[_0x81cf('0x4e')],null))['then'](respondWithResult(_0x970f10,null))[_0x81cf('0x54')](handleError(_0x970f10,null));};exports[_0x81cf('0x28')]=function(_0x3039e3,_0x4730f3){return db[_0x81cf('0x30')][_0x81cf('0x4c')]({'where':{'id':_0x3039e3[_0x81cf('0x4b')]['id']}})[_0x81cf('0x27')](handleEntityNotFound(_0x4730f3,null))['then'](removeEntity(_0x4730f3,null))[_0x81cf('0x54')](handleError(_0x4730f3,null));};exports[_0x81cf('0x57')]=function(_0x47066b,_0x22e7cb,_0x1a5169){if(_0x47066b[_0x81cf('0x4e')]['id']){delete _0x47066b[_0x81cf('0x4e')]['id'];}return db[_0x81cf('0x30')]['find']({'where':{'id':_0x47066b[_0x81cf('0x4b')]['id']}})[_0x81cf('0x27')](handleEntityNotFound(_0x22e7cb,null))[_0x81cf('0x27')](function(_0x472e83){if(_0x472e83){_0x47066b[_0x81cf('0x4e')][_0x81cf('0x58')]=_0x472e83['id'];return db[_0x81cf('0x59')]['create'](_0x47066b[_0x81cf('0x4e')]);}})[_0x81cf('0x27')](respondWithResult(_0x22e7cb,null))[_0x81cf('0x54')](handleError(_0x22e7cb,null));};exports[_0x81cf('0x5a')]=function(_0x13323a,_0x5924bb,_0x49327e){if(_0x13323a[_0x81cf('0x4e')]['id']){delete _0x13323a['body']['id'];}return db[_0x81cf('0x30')]['find']({'where':{'id':_0x13323a[_0x81cf('0x4b')]['id']}})[_0x81cf('0x27')](handleEntityNotFound(_0x5924bb,null))[_0x81cf('0x27')](function(_0x1e7f3b){if(_0x1e7f3b){_0x13323a['body'][_0x81cf('0x5b')]=_0x1e7f3b['id'];return db[_0x81cf('0x59')]['create'](_0x13323a['body']);}})[_0x81cf('0x27')](respondWithResult(_0x5924bb,null))['catch'](handleError(_0x5924bb,null));};exports['getAllConditions']=function(_0x4d183a,_0xa87c54,_0xbf0e24){var _0x133206={};var _0x3eea61={};var _0x52ffcc;var _0x554ccc;return db['Trigger'][_0x81cf('0x5c')]({'where':{'id':_0x4d183a['params']['id']}})[_0x81cf('0x27')](handleEntityNotFound(_0xa87c54,null))[_0x81cf('0x27')](function(_0xdf2679){if(_0xdf2679){_0x52ffcc=_0xdf2679;_0x3eea61['model']=_[_0x81cf('0x35')](db['Condition']['rawAttributes']);_0x3eea61['query']=_['keys'](_0x4d183a[_0x81cf('0x34')]);_0x3eea61['filters']=_[_0x81cf('0x38')](_0x3eea61[_0x81cf('0x33')],_0x3eea61['query']);_0x133206[_0x81cf('0x37')]=_[_0x81cf('0x38')](_0x3eea61['model'],qs[_0x81cf('0x39')](_0x4d183a['query'][_0x81cf('0x39')]));_0x133206[_0x81cf('0x37')]=_0x133206[_0x81cf('0x37')]['length']?_0x133206[_0x81cf('0x37')]:_0x3eea61[_0x81cf('0x33')];_0x133206[_0x81cf('0x3d')]=qs[_0x81cf('0x3e')](_0x4d183a['query'][_0x81cf('0x3e')]);_0x133206['where']=qs[_0x81cf('0x36')](_['pick'](_0x4d183a[_0x81cf('0x34')],_0x3eea61[_0x81cf('0x36')]));if(_0x4d183a[_0x81cf('0x34')][_0x81cf('0x41')]){_0x133206['where']=_['merge'](_0x133206[_0x81cf('0x3f')],{'$or':_[_0x81cf('0x2f')](_0x133206[_0x81cf('0x37')],function(_0x7d4906){var _0x3f2096={};_0x3f2096[_0x7d4906]={'$like':'%'+_0x4d183a[_0x81cf('0x34')][_0x81cf('0x41')]+'%'};return _0x3f2096;})});}_0x133206=_['merge']({},_0x133206,_0x4d183a[_0x81cf('0x45')]);return _0x52ffcc[_0x81cf('0x5d')](_0x133206);}})['then'](function(_0x4481ef){if(_0x4481ef){_0x554ccc=_0x4481ef['length'];if(!_0x4d183a[_0x81cf('0x34')]['hasOwnProperty'](_0x81cf('0x3c'))){_0x133206[_0x81cf('0x21')]=qs[_0x81cf('0x21')](_0x4d183a['query']['limit']);_0x133206['offset']=qs[_0x81cf('0x1f')](_0x4d183a[_0x81cf('0x34')][_0x81cf('0x1f')]);}return _0x52ffcc[_0x81cf('0x5d')](_0x133206);}})[_0x81cf('0x27')](function(_0x284f8c){if(_0x284f8c){return _0x284f8c?{'count':_0x554ccc,'rows':_0x284f8c}:null;}})[_0x81cf('0x27')](respondWithResult(_0xa87c54,null))['catch'](handleError(_0xa87c54,null));};exports['getAnyConditions']=function(_0x54b0c4,_0x2f2700,_0x52d421){var _0x2d279d={};var _0x319061={};var _0x37a0b1;var _0x18fa2a;return db[_0x81cf('0x30')][_0x81cf('0x5c')]({'where':{'id':_0x54b0c4[_0x81cf('0x4b')]['id']}})[_0x81cf('0x27')](handleEntityNotFound(_0x2f2700,null))['then'](function(_0x433bbe){if(_0x433bbe){_0x37a0b1=_0x433bbe;_0x319061[_0x81cf('0x33')]=_[_0x81cf('0x35')](db[_0x81cf('0x59')]['rawAttributes']);_0x319061[_0x81cf('0x34')]=_[_0x81cf('0x35')](_0x54b0c4['query']);_0x319061[_0x81cf('0x36')]=_[_0x81cf('0x38')](_0x319061[_0x81cf('0x33')],_0x319061[_0x81cf('0x34')]);_0x2d279d['attributes']=_['intersection'](_0x319061[_0x81cf('0x33')],qs['fields'](_0x54b0c4[_0x81cf('0x34')][_0x81cf('0x39')]));_0x2d279d['attributes']=_0x2d279d[_0x81cf('0x37')][_0x81cf('0x3a')]?_0x2d279d['attributes']:_0x319061[_0x81cf('0x33')];_0x2d279d['order']=qs[_0x81cf('0x3e')](_0x54b0c4[_0x81cf('0x34')][_0x81cf('0x3e')]);_0x2d279d[_0x81cf('0x3f')]=qs[_0x81cf('0x36')](_[_0x81cf('0x40')](_0x54b0c4[_0x81cf('0x34')],_0x319061['filters']));if(_0x54b0c4[_0x81cf('0x34')]['filter']){_0x2d279d[_0x81cf('0x3f')]=_[_0x81cf('0x42')](_0x2d279d[_0x81cf('0x3f')],{'$or':_[_0x81cf('0x2f')](_0x2d279d['attributes'],function(_0x5059f8){var _0x908ca7={};_0x908ca7[_0x5059f8]={'$like':'%'+_0x54b0c4['query'][_0x81cf('0x41')]+'%'};return _0x908ca7;})});}_0x2d279d=_[_0x81cf('0x42')]({},_0x2d279d,_0x54b0c4[_0x81cf('0x45')]);return _0x37a0b1[_0x81cf('0x5e')](_0x2d279d);}})['then'](function(_0x2ee30a){if(_0x2ee30a){_0x18fa2a=_0x2ee30a[_0x81cf('0x3a')];if(!_0x54b0c4['query'][_0x81cf('0x3b')](_0x81cf('0x3c'))){_0x2d279d['limit']=qs[_0x81cf('0x21')](_0x54b0c4[_0x81cf('0x34')][_0x81cf('0x21')]);_0x2d279d['offset']=qs[_0x81cf('0x1f')](_0x54b0c4['query'][_0x81cf('0x1f')]);}return _0x37a0b1['getAnyConditions'](_0x2d279d);}})[_0x81cf('0x27')](function(_0x31423d){if(_0x31423d){return _0x31423d?{'count':_0x18fa2a,'rows':_0x31423d}:null;}})[_0x81cf('0x27')](respondWithResult(_0x2f2700,null))['catch'](handleError(_0x2f2700,null));};exports['addAction']=function(_0x1d4f4d,_0x28f9ba,_0xb1b191){if(_0x1d4f4d[_0x81cf('0x4e')]['id']){delete _0x1d4f4d[_0x81cf('0x4e')]['id'];}return db[_0x81cf('0x30')][_0x81cf('0x4c')]({'where':{'id':_0x1d4f4d[_0x81cf('0x4b')]['id']}})[_0x81cf('0x27')](handleEntityNotFound(_0x28f9ba,null))[_0x81cf('0x27')](function(_0x48b70a){if(_0x48b70a){_0x1d4f4d['body'][_0x81cf('0x5f')]=_0x48b70a['id'];return db[_0x81cf('0x60')]['create'](_0x1d4f4d[_0x81cf('0x4e')]);}})['then'](respondWithResult(_0x28f9ba,null))[_0x81cf('0x54')](handleError(_0x28f9ba,null));};exports[_0x81cf('0x61')]=function(_0x6af14a,_0x5cc509,_0x4c1f12){var _0x2882fe={};var _0xb4e2c2={};var _0xf68ffb;var _0x2e8c57;return db[_0x81cf('0x30')][_0x81cf('0x5c')]({'where':{'id':_0x6af14a[_0x81cf('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5cc509,null))[_0x81cf('0x27')](function(_0x1f37d5){if(_0x1f37d5){_0xf68ffb=_0x1f37d5;_0xb4e2c2[_0x81cf('0x33')]=_[_0x81cf('0x35')](db[_0x81cf('0x60')][_0x81cf('0x31')]);_0xb4e2c2[_0x81cf('0x34')]=_[_0x81cf('0x35')](_0x6af14a[_0x81cf('0x34')]);_0xb4e2c2[_0x81cf('0x36')]=_[_0x81cf('0x38')](_0xb4e2c2[_0x81cf('0x33')],_0xb4e2c2[_0x81cf('0x34')]);_0x2882fe[_0x81cf('0x37')]=_[_0x81cf('0x38')](_0xb4e2c2[_0x81cf('0x33')],qs[_0x81cf('0x39')](_0x6af14a[_0x81cf('0x34')][_0x81cf('0x39')]));_0x2882fe['attributes']=_0x2882fe[_0x81cf('0x37')]['length']?_0x2882fe[_0x81cf('0x37')]:_0xb4e2c2[_0x81cf('0x33')];_0x2882fe['order']=qs[_0x81cf('0x3e')](_0x6af14a[_0x81cf('0x34')][_0x81cf('0x3e')]);_0x2882fe[_0x81cf('0x3f')]=qs[_0x81cf('0x36')](_[_0x81cf('0x40')](_0x6af14a[_0x81cf('0x34')],_0xb4e2c2[_0x81cf('0x36')]));if(_0x6af14a['query']['filter']){_0x2882fe[_0x81cf('0x3f')]=_['merge'](_0x2882fe[_0x81cf('0x3f')],{'$or':_['map'](_0x2882fe['attributes'],function(_0x4e3792){var _0x99c5f0={};_0x99c5f0[_0x4e3792]={'$like':'%'+_0x6af14a[_0x81cf('0x34')][_0x81cf('0x41')]+'%'};return _0x99c5f0;})});}_0x2882fe=_[_0x81cf('0x42')]({},_0x2882fe,_0x6af14a[_0x81cf('0x45')]);return _0xf68ffb['getActions'](_0x2882fe);}})[_0x81cf('0x27')](function(_0x584532){if(_0x584532){_0x2e8c57=_0x584532['length'];if(!_0x6af14a['query']['hasOwnProperty']('nolimit')){_0x2882fe[_0x81cf('0x21')]=qs[_0x81cf('0x21')](_0x6af14a['query'][_0x81cf('0x21')]);_0x2882fe[_0x81cf('0x1f')]=qs['offset'](_0x6af14a[_0x81cf('0x34')][_0x81cf('0x1f')]);}return _0xf68ffb[_0x81cf('0x61')](_0x2882fe);}})[_0x81cf('0x27')](function(_0x3fa8fd){if(_0x3fa8fd){return _0x3fa8fd?{'count':_0x2e8c57,'rows':_0x3fa8fd}:null;}})[_0x81cf('0x27')](respondWithResult(_0x5cc509,null))[_0x81cf('0x54')](handleError(_0x5cc509,null));}; \ No newline at end of file +var _0xb5e6=['options','count','includeAll','include','findAll','catch','show','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','TriggerAllId','addAnyCondition','TriggerAnyId','Condition','getAllConditions','pick','hasOwnProperty','nolimit','getAnyConditions','findOne','addAction','TriggerId','Action','getActions','eml-format','zip-dir','request-promise','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','set','Content-Range','apply','reject','save','then','destroy','UserProfileResource','error','name','send','index','Trigger','rawAttributes','key','model','map','query','keys','filters','intersection','fields','attributes','limit','order','sort','where','merge','VIRTUAL','filter'];(function(_0x6593d5,_0x44e040){var _0x532335=function(_0x50ac92){while(--_0x50ac92){_0x6593d5['push'](_0x6593d5['shift']());}};_0x532335(++_0x44e040);}(_0xb5e6,0x137));var _0x6b5e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xb5e6[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x6b5e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6b5e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6b5e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6b5e('0x3'));var util=require(_0x6b5e('0x4'));var path=require(_0x6b5e('0x5'));var sox=require(_0x6b5e('0x6'));var csv=require('to-csv');var ejs=require(_0x6b5e('0x7'));var fs=require('fs');var fs_extra=require(_0x6b5e('0x8'));var _=require(_0x6b5e('0x9'));var squel=require(_0x6b5e('0xa'));var crypto=require(_0x6b5e('0xb'));var jsforce=require(_0x6b5e('0xc'));var deskjs=require(_0x6b5e('0xd'));var toCsv=require(_0x6b5e('0xe'));var querystring=require(_0x6b5e('0xf'));var Papa=require(_0x6b5e('0x10'));var Redis=require('ioredis');var authService=require(_0x6b5e('0x11'));var qs=require(_0x6b5e('0x12'));var as=require(_0x6b5e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6b5e('0x14'))('api');var utils=require(_0x6b5e('0x15'));var config=require(_0x6b5e('0x16'));var licenseUtil=require(_0x6b5e('0x17'));var db=require(_0x6b5e('0x18'))['db'];function respondWithStatusCode(_0x354cf5,_0x267e7e){_0x267e7e=_0x267e7e||0xcc;return function(_0x17d6cc){if(_0x17d6cc){return _0x354cf5[_0x6b5e('0x19')](_0x267e7e);}return _0x354cf5[_0x6b5e('0x1a')](_0x267e7e)[_0x6b5e('0x1b')]();};}function respondWithResult(_0x5415c8,_0x2b4e3e){_0x2b4e3e=_0x2b4e3e||0xc8;return function(_0x2a65de){if(_0x2a65de){return _0x5415c8[_0x6b5e('0x1a')](_0x2b4e3e)[_0x6b5e('0x1c')](_0x2a65de);}};}function respondWithFilteredResult(_0x12e616,_0x5bc8bd){return function(_0x2dee9c){if(_0x2dee9c){var _0x17ed6f=typeof _0x5bc8bd[_0x6b5e('0x1d')]===_0x6b5e('0x1e')&&typeof _0x5bc8bd['limit']===_0x6b5e('0x1e');var _0x3f8692=_0x2dee9c['count'];var _0xe216b7=_0x17ed6f?0x0:_0x5bc8bd[_0x6b5e('0x1d')];var _0x1007bf=_0x17ed6f?_0x2dee9c['count']:_0x5bc8bd[_0x6b5e('0x1d')]+_0x5bc8bd['limit'];var _0x4588e7;if(_0x1007bf>=_0x3f8692){_0x1007bf=_0x3f8692;_0x4588e7=0xc8;}else{_0x4588e7=0xce;}_0x12e616['status'](_0x4588e7);return _0x12e616[_0x6b5e('0x1f')](_0x6b5e('0x20'),_0xe216b7+'-'+_0x1007bf+'/'+_0x3f8692)['json'](_0x2dee9c);}return null;};}function patchUpdates(_0x1d0c35){return function(_0x2d9c71){try{jsonpatch[_0x6b5e('0x21')](_0x2d9c71,_0x1d0c35,!![]);}catch(_0x1c2e82){return BPromise[_0x6b5e('0x22')](_0x1c2e82);}return _0x2d9c71[_0x6b5e('0x23')]();};}function saveUpdates(_0x522ed8,_0x189493){return function(_0x424d08){if(_0x424d08){return _0x424d08['update'](_0x522ed8)[_0x6b5e('0x24')](function(_0xf6e1b6){return _0xf6e1b6;});}return null;};}function removeEntity(_0x4be0b2,_0x23028a){return function(_0x43c820){if(_0x43c820){return _0x43c820[_0x6b5e('0x25')]()[_0x6b5e('0x24')](function(){var _0x976570=_0x43c820['get']({'plain':!![]});var _0xa72f67='Triggers';return db[_0x6b5e('0x26')]['destroy']({'where':{'type':_0xa72f67,'resourceId':_0x976570['id']}})[_0x6b5e('0x24')](function(){return _0x43c820;});})[_0x6b5e('0x24')](function(){_0x4be0b2[_0x6b5e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x87800b,_0x56976e){return function(_0x32ea1a){if(!_0x32ea1a){_0x87800b['sendStatus'](0x194);}return _0x32ea1a;};}function handleError(_0x2c1447,_0x1eeb35){_0x1eeb35=_0x1eeb35||0x1f4;return function(_0x93f1f5){logger[_0x6b5e('0x27')](_0x93f1f5['stack']);if(_0x93f1f5[_0x6b5e('0x28')]){delete _0x93f1f5[_0x6b5e('0x28')];}_0x2c1447[_0x6b5e('0x1a')](_0x1eeb35)[_0x6b5e('0x29')](_0x93f1f5);};}exports[_0x6b5e('0x2a')]=function(_0x13fffc,_0x29634d){var _0x37e0e3={},_0x21ccba={},_0x442061={'count':0x0,'rows':[]};var _0x2f7d5c=_['map'](db[_0x6b5e('0x2b')][_0x6b5e('0x2c')],function(_0x180371){return{'name':_0x180371['fieldName'],'type':_0x180371['type'][_0x6b5e('0x2d')]};});_0x21ccba[_0x6b5e('0x2e')]=_[_0x6b5e('0x2f')](_0x2f7d5c,'name');_0x21ccba[_0x6b5e('0x30')]=_[_0x6b5e('0x31')](_0x13fffc[_0x6b5e('0x30')]);_0x21ccba[_0x6b5e('0x32')]=_[_0x6b5e('0x33')](_0x21ccba[_0x6b5e('0x2e')],_0x21ccba[_0x6b5e('0x30')]);_0x37e0e3['attributes']=_['intersection'](_0x21ccba[_0x6b5e('0x2e')],qs[_0x6b5e('0x34')](_0x13fffc[_0x6b5e('0x30')][_0x6b5e('0x34')]));_0x37e0e3[_0x6b5e('0x35')]=_0x37e0e3[_0x6b5e('0x35')]['length']?_0x37e0e3['attributes']:_0x21ccba[_0x6b5e('0x2e')];if(!_0x13fffc[_0x6b5e('0x30')]['hasOwnProperty']('nolimit')){_0x37e0e3['limit']=qs[_0x6b5e('0x36')](_0x13fffc['query'][_0x6b5e('0x36')]);_0x37e0e3[_0x6b5e('0x1d')]=qs[_0x6b5e('0x1d')](_0x13fffc[_0x6b5e('0x30')]['offset']);}_0x37e0e3[_0x6b5e('0x37')]=qs[_0x6b5e('0x38')](_0x13fffc[_0x6b5e('0x30')]['sort']);_0x37e0e3[_0x6b5e('0x39')]=qs[_0x6b5e('0x32')](_['pick'](_0x13fffc[_0x6b5e('0x30')],_0x21ccba[_0x6b5e('0x32')]),_0x2f7d5c);if(_0x13fffc['query']['filter']){_0x37e0e3[_0x6b5e('0x39')]=_[_0x6b5e('0x3a')](_0x37e0e3[_0x6b5e('0x39')],{'$or':_[_0x6b5e('0x2f')](_0x2f7d5c,function(_0x2ddbab){if(_0x2ddbab['type']!==_0x6b5e('0x3b')){var _0xf56bd3={};_0xf56bd3[_0x2ddbab[_0x6b5e('0x28')]]={'$like':'%'+_0x13fffc[_0x6b5e('0x30')][_0x6b5e('0x3c')]+'%'};return _0xf56bd3;}})});}_0x37e0e3=_['merge']({},_0x37e0e3,_0x13fffc[_0x6b5e('0x3d')]);var _0x2990a6={'where':_0x37e0e3['where']};return db['Trigger'][_0x6b5e('0x3e')](_0x2990a6)[_0x6b5e('0x24')](function(_0x11d73e){_0x442061[_0x6b5e('0x3e')]=_0x11d73e;if(_0x13fffc[_0x6b5e('0x30')][_0x6b5e('0x3f')]){_0x37e0e3[_0x6b5e('0x40')]=[{'all':!![]}];}return db[_0x6b5e('0x2b')][_0x6b5e('0x41')](_0x37e0e3);})['then'](function(_0x13ca87){_0x442061['rows']=_0x13ca87;return _0x442061;})[_0x6b5e('0x24')](respondWithFilteredResult(_0x29634d,_0x37e0e3))[_0x6b5e('0x42')](handleError(_0x29634d,null));};exports[_0x6b5e('0x43')]=function(_0xaeeb10,_0x429e2b){var _0x29c639={'raw':![],'where':{'id':_0xaeeb10[_0x6b5e('0x44')]['id']}},_0x33fc04={};_0x33fc04['model']=_[_0x6b5e('0x31')](db[_0x6b5e('0x2b')][_0x6b5e('0x2c')]);_0x33fc04[_0x6b5e('0x30')]=_[_0x6b5e('0x31')](_0xaeeb10[_0x6b5e('0x30')]);_0x33fc04[_0x6b5e('0x32')]=_[_0x6b5e('0x33')](_0x33fc04[_0x6b5e('0x2e')],_0x33fc04[_0x6b5e('0x30')]);_0x29c639[_0x6b5e('0x35')]=_[_0x6b5e('0x33')](_0x33fc04['model'],qs[_0x6b5e('0x34')](_0xaeeb10[_0x6b5e('0x30')][_0x6b5e('0x34')]));_0x29c639[_0x6b5e('0x35')]=_0x29c639[_0x6b5e('0x35')][_0x6b5e('0x45')]?_0x29c639[_0x6b5e('0x35')]:_0x33fc04[_0x6b5e('0x2e')];if(_0xaeeb10[_0x6b5e('0x30')]['includeAll']){_0x29c639['include']=[{'all':!![]}];}_0x29c639=_[_0x6b5e('0x3a')]({},_0x29c639,_0xaeeb10[_0x6b5e('0x3d')]);return db[_0x6b5e('0x2b')][_0x6b5e('0x46')](_0x29c639)[_0x6b5e('0x24')](handleEntityNotFound(_0x429e2b,null))[_0x6b5e('0x24')](respondWithResult(_0x429e2b,null))[_0x6b5e('0x42')](handleError(_0x429e2b,null));};exports[_0x6b5e('0x47')]=function(_0x4e131c,_0x51a4f5){return db[_0x6b5e('0x2b')]['create'](_0x4e131c[_0x6b5e('0x48')],{})[_0x6b5e('0x24')](function(_0x549142){var _0xbbd7e3=_0x4e131c[_0x6b5e('0x49')]['get']({'plain':!![]});if(!_0xbbd7e3)throw new Error(_0x6b5e('0x4a'));if(_0xbbd7e3['role']===_0x6b5e('0x49')){var _0x44f8e4=_0x549142['get']({'plain':!![]});var _0x39afc2='Triggers';return db[_0x6b5e('0x4b')][_0x6b5e('0x46')]({'where':{'name':_0x39afc2,'userProfileId':_0xbbd7e3['userProfileId']},'raw':!![]})['then'](function(_0x27b8db){if(_0x27b8db&&_0x27b8db[_0x6b5e('0x4c')]===0x0){return db[_0x6b5e('0x26')][_0x6b5e('0x47')]({'name':_0x44f8e4[_0x6b5e('0x28')],'resourceId':_0x44f8e4['id'],'type':_0x27b8db[_0x6b5e('0x28')],'sectionId':_0x27b8db['id']},{})[_0x6b5e('0x24')](function(){return _0x549142;});}else{return _0x549142;}})['catch'](function(_0x8f8c90){logger[_0x6b5e('0x27')](_0x6b5e('0x4d'),_0x8f8c90);throw _0x8f8c90;});}return _0x549142;})[_0x6b5e('0x24')](respondWithResult(_0x51a4f5,0xc9))[_0x6b5e('0x42')](handleError(_0x51a4f5,null));};exports[_0x6b5e('0x4e')]=function(_0x25699a,_0xb2465){if(_0x25699a[_0x6b5e('0x48')]['id']){delete _0x25699a['body']['id'];}return db['Trigger'][_0x6b5e('0x46')]({'where':{'id':_0x25699a[_0x6b5e('0x44')]['id']}})[_0x6b5e('0x24')](handleEntityNotFound(_0xb2465,null))[_0x6b5e('0x24')](saveUpdates(_0x25699a[_0x6b5e('0x48')],null))[_0x6b5e('0x24')](respondWithResult(_0xb2465,null))[_0x6b5e('0x42')](handleError(_0xb2465,null));};exports['destroy']=function(_0x4468ee,_0x5c543e){return db['Trigger'][_0x6b5e('0x46')]({'where':{'id':_0x4468ee['params']['id']}})[_0x6b5e('0x24')](handleEntityNotFound(_0x5c543e,null))[_0x6b5e('0x24')](removeEntity(_0x5c543e,null))[_0x6b5e('0x42')](handleError(_0x5c543e,null));};exports['addAllCondition']=function(_0x121d37,_0x54ff9e,_0x5ce107){if(_0x121d37[_0x6b5e('0x48')]['id']){delete _0x121d37['body']['id'];}return db[_0x6b5e('0x2b')][_0x6b5e('0x46')]({'where':{'id':_0x121d37[_0x6b5e('0x44')]['id']}})[_0x6b5e('0x24')](handleEntityNotFound(_0x54ff9e,null))[_0x6b5e('0x24')](function(_0x45af41){if(_0x45af41){_0x121d37[_0x6b5e('0x48')][_0x6b5e('0x4f')]=_0x45af41['id'];return db['Condition'][_0x6b5e('0x47')](_0x121d37[_0x6b5e('0x48')]);}})['then'](respondWithResult(_0x54ff9e,null))['catch'](handleError(_0x54ff9e,null));};exports[_0x6b5e('0x50')]=function(_0x3ff9dc,_0x257836,_0x43819a){if(_0x3ff9dc[_0x6b5e('0x48')]['id']){delete _0x3ff9dc[_0x6b5e('0x48')]['id'];}return db['Trigger']['find']({'where':{'id':_0x3ff9dc[_0x6b5e('0x44')]['id']}})[_0x6b5e('0x24')](handleEntityNotFound(_0x257836,null))[_0x6b5e('0x24')](function(_0x41ec7b){if(_0x41ec7b){_0x3ff9dc[_0x6b5e('0x48')][_0x6b5e('0x51')]=_0x41ec7b['id'];return db[_0x6b5e('0x52')][_0x6b5e('0x47')](_0x3ff9dc[_0x6b5e('0x48')]);}})[_0x6b5e('0x24')](respondWithResult(_0x257836,null))[_0x6b5e('0x42')](handleError(_0x257836,null));};exports[_0x6b5e('0x53')]=function(_0x15b424,_0x2b21f2,_0x475e40){var _0x1146d4={};var _0x120e88={};var _0x16517e;var _0x17e59b;return db[_0x6b5e('0x2b')]['findOne']({'where':{'id':_0x15b424[_0x6b5e('0x44')]['id']}})[_0x6b5e('0x24')](handleEntityNotFound(_0x2b21f2,null))[_0x6b5e('0x24')](function(_0x55a122){if(_0x55a122){_0x16517e=_0x55a122;_0x120e88[_0x6b5e('0x2e')]=_[_0x6b5e('0x31')](db[_0x6b5e('0x52')][_0x6b5e('0x2c')]);_0x120e88['query']=_[_0x6b5e('0x31')](_0x15b424[_0x6b5e('0x30')]);_0x120e88[_0x6b5e('0x32')]=_['intersection'](_0x120e88[_0x6b5e('0x2e')],_0x120e88['query']);_0x1146d4[_0x6b5e('0x35')]=_[_0x6b5e('0x33')](_0x120e88[_0x6b5e('0x2e')],qs[_0x6b5e('0x34')](_0x15b424[_0x6b5e('0x30')][_0x6b5e('0x34')]));_0x1146d4[_0x6b5e('0x35')]=_0x1146d4[_0x6b5e('0x35')][_0x6b5e('0x45')]?_0x1146d4[_0x6b5e('0x35')]:_0x120e88[_0x6b5e('0x2e')];_0x1146d4[_0x6b5e('0x37')]=qs[_0x6b5e('0x38')](_0x15b424[_0x6b5e('0x30')][_0x6b5e('0x38')]);_0x1146d4[_0x6b5e('0x39')]=qs['filters'](_[_0x6b5e('0x54')](_0x15b424[_0x6b5e('0x30')],_0x120e88[_0x6b5e('0x32')]));if(_0x15b424[_0x6b5e('0x30')][_0x6b5e('0x3c')]){_0x1146d4[_0x6b5e('0x39')]=_['merge'](_0x1146d4[_0x6b5e('0x39')],{'$or':_[_0x6b5e('0x2f')](_0x1146d4[_0x6b5e('0x35')],function(_0x344ea1){var _0x2d9204={};_0x2d9204[_0x344ea1]={'$like':'%'+_0x15b424[_0x6b5e('0x30')]['filter']+'%'};return _0x2d9204;})});}_0x1146d4=_[_0x6b5e('0x3a')]({},_0x1146d4,_0x15b424['options']);return _0x16517e['getAllConditions'](_0x1146d4);}})[_0x6b5e('0x24')](function(_0x504209){if(_0x504209){_0x17e59b=_0x504209['length'];if(!_0x15b424['query'][_0x6b5e('0x55')](_0x6b5e('0x56'))){_0x1146d4[_0x6b5e('0x36')]=qs[_0x6b5e('0x36')](_0x15b424['query'][_0x6b5e('0x36')]);_0x1146d4['offset']=qs[_0x6b5e('0x1d')](_0x15b424[_0x6b5e('0x30')][_0x6b5e('0x1d')]);}return _0x16517e['getAllConditions'](_0x1146d4);}})[_0x6b5e('0x24')](function(_0x3270f5){if(_0x3270f5){return _0x3270f5?{'count':_0x17e59b,'rows':_0x3270f5}:null;}})['then'](respondWithResult(_0x2b21f2,null))[_0x6b5e('0x42')](handleError(_0x2b21f2,null));};exports[_0x6b5e('0x57')]=function(_0x4dc6ca,_0x4cb370,_0x398c83){var _0x419188={};var _0x2b5c8e={};var _0x2f5562;var _0x4a8739;return db[_0x6b5e('0x2b')][_0x6b5e('0x58')]({'where':{'id':_0x4dc6ca['params']['id']}})['then'](handleEntityNotFound(_0x4cb370,null))['then'](function(_0x37fb9){if(_0x37fb9){_0x2f5562=_0x37fb9;_0x2b5c8e[_0x6b5e('0x2e')]=_['keys'](db[_0x6b5e('0x52')][_0x6b5e('0x2c')]);_0x2b5c8e[_0x6b5e('0x30')]=_[_0x6b5e('0x31')](_0x4dc6ca[_0x6b5e('0x30')]);_0x2b5c8e[_0x6b5e('0x32')]=_[_0x6b5e('0x33')](_0x2b5c8e[_0x6b5e('0x2e')],_0x2b5c8e[_0x6b5e('0x30')]);_0x419188[_0x6b5e('0x35')]=_[_0x6b5e('0x33')](_0x2b5c8e[_0x6b5e('0x2e')],qs['fields'](_0x4dc6ca[_0x6b5e('0x30')][_0x6b5e('0x34')]));_0x419188[_0x6b5e('0x35')]=_0x419188[_0x6b5e('0x35')][_0x6b5e('0x45')]?_0x419188[_0x6b5e('0x35')]:_0x2b5c8e[_0x6b5e('0x2e')];_0x419188[_0x6b5e('0x37')]=qs[_0x6b5e('0x38')](_0x4dc6ca[_0x6b5e('0x30')][_0x6b5e('0x38')]);_0x419188[_0x6b5e('0x39')]=qs[_0x6b5e('0x32')](_[_0x6b5e('0x54')](_0x4dc6ca[_0x6b5e('0x30')],_0x2b5c8e[_0x6b5e('0x32')]));if(_0x4dc6ca[_0x6b5e('0x30')][_0x6b5e('0x3c')]){_0x419188['where']=_[_0x6b5e('0x3a')](_0x419188[_0x6b5e('0x39')],{'$or':_[_0x6b5e('0x2f')](_0x419188[_0x6b5e('0x35')],function(_0x279fba){var _0x4efe00={};_0x4efe00[_0x279fba]={'$like':'%'+_0x4dc6ca['query']['filter']+'%'};return _0x4efe00;})});}_0x419188=_[_0x6b5e('0x3a')]({},_0x419188,_0x4dc6ca[_0x6b5e('0x3d')]);return _0x2f5562[_0x6b5e('0x57')](_0x419188);}})[_0x6b5e('0x24')](function(_0x4f47db){if(_0x4f47db){_0x4a8739=_0x4f47db[_0x6b5e('0x45')];if(!_0x4dc6ca['query'][_0x6b5e('0x55')](_0x6b5e('0x56'))){_0x419188['limit']=qs[_0x6b5e('0x36')](_0x4dc6ca[_0x6b5e('0x30')][_0x6b5e('0x36')]);_0x419188['offset']=qs[_0x6b5e('0x1d')](_0x4dc6ca[_0x6b5e('0x30')][_0x6b5e('0x1d')]);}return _0x2f5562[_0x6b5e('0x57')](_0x419188);}})['then'](function(_0x25da5f){if(_0x25da5f){return _0x25da5f?{'count':_0x4a8739,'rows':_0x25da5f}:null;}})[_0x6b5e('0x24')](respondWithResult(_0x4cb370,null))[_0x6b5e('0x42')](handleError(_0x4cb370,null));};exports[_0x6b5e('0x59')]=function(_0x56a4fc,_0x17214a,_0x2175ba){if(_0x56a4fc[_0x6b5e('0x48')]['id']){delete _0x56a4fc['body']['id'];}return db[_0x6b5e('0x2b')][_0x6b5e('0x46')]({'where':{'id':_0x56a4fc['params']['id']}})[_0x6b5e('0x24')](handleEntityNotFound(_0x17214a,null))[_0x6b5e('0x24')](function(_0x366e14){if(_0x366e14){_0x56a4fc[_0x6b5e('0x48')][_0x6b5e('0x5a')]=_0x366e14['id'];return db[_0x6b5e('0x5b')][_0x6b5e('0x47')](_0x56a4fc[_0x6b5e('0x48')]);}})[_0x6b5e('0x24')](respondWithResult(_0x17214a,null))[_0x6b5e('0x42')](handleError(_0x17214a,null));};exports[_0x6b5e('0x5c')]=function(_0x5d9f5e,_0x25dd6e,_0x3c69a9){var _0x6fa719={};var _0x2e3231={};var _0x12ad51;var _0x2d2106;return db[_0x6b5e('0x2b')][_0x6b5e('0x58')]({'where':{'id':_0x5d9f5e['params']['id']}})[_0x6b5e('0x24')](handleEntityNotFound(_0x25dd6e,null))['then'](function(_0x319a3a){if(_0x319a3a){_0x12ad51=_0x319a3a;_0x2e3231[_0x6b5e('0x2e')]=_[_0x6b5e('0x31')](db['Action']['rawAttributes']);_0x2e3231['query']=_['keys'](_0x5d9f5e[_0x6b5e('0x30')]);_0x2e3231['filters']=_[_0x6b5e('0x33')](_0x2e3231['model'],_0x2e3231['query']);_0x6fa719[_0x6b5e('0x35')]=_['intersection'](_0x2e3231['model'],qs[_0x6b5e('0x34')](_0x5d9f5e[_0x6b5e('0x30')][_0x6b5e('0x34')]));_0x6fa719[_0x6b5e('0x35')]=_0x6fa719[_0x6b5e('0x35')][_0x6b5e('0x45')]?_0x6fa719[_0x6b5e('0x35')]:_0x2e3231[_0x6b5e('0x2e')];_0x6fa719['order']=qs[_0x6b5e('0x38')](_0x5d9f5e[_0x6b5e('0x30')][_0x6b5e('0x38')]);_0x6fa719[_0x6b5e('0x39')]=qs[_0x6b5e('0x32')](_[_0x6b5e('0x54')](_0x5d9f5e[_0x6b5e('0x30')],_0x2e3231['filters']));if(_0x5d9f5e['query'][_0x6b5e('0x3c')]){_0x6fa719[_0x6b5e('0x39')]=_['merge'](_0x6fa719['where'],{'$or':_[_0x6b5e('0x2f')](_0x6fa719[_0x6b5e('0x35')],function(_0x30bf9f){var _0x22385d={};_0x22385d[_0x30bf9f]={'$like':'%'+_0x5d9f5e[_0x6b5e('0x30')][_0x6b5e('0x3c')]+'%'};return _0x22385d;})});}_0x6fa719=_[_0x6b5e('0x3a')]({},_0x6fa719,_0x5d9f5e['options']);return _0x12ad51['getActions'](_0x6fa719);}})[_0x6b5e('0x24')](function(_0x496646){if(_0x496646){_0x2d2106=_0x496646[_0x6b5e('0x45')];if(!_0x5d9f5e[_0x6b5e('0x30')][_0x6b5e('0x55')](_0x6b5e('0x56'))){_0x6fa719['limit']=qs['limit'](_0x5d9f5e[_0x6b5e('0x30')][_0x6b5e('0x36')]);_0x6fa719['offset']=qs[_0x6b5e('0x1d')](_0x5d9f5e[_0x6b5e('0x30')][_0x6b5e('0x1d')]);}return _0x12ad51[_0x6b5e('0x5c')](_0x6fa719);}})[_0x6b5e('0x24')](function(_0x3a82c9){if(_0x3a82c9){return _0x3a82c9?{'count':_0x2d2106,'rows':_0x3a82c9}:null;}})[_0x6b5e('0x24')](respondWithResult(_0x25dd6e,null))[_0x6b5e('0x42')](handleError(_0x25dd6e,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index c7590ce..a9a4b76 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 _0xbe45=['rimraf','./trigger.attributes','exports','define','Trigger','tools_triggers','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x22132b,_0x26d0b1){var _0x50b48d=function(_0x8019e1){while(--_0x8019e1){_0x22132b['push'](_0x22132b['shift']());}};_0x50b48d(++_0x26d0b1);}(_0xbe45,0xf0));var _0x5be4=function(_0x37cd64,_0x54ba57){_0x37cd64=_0x37cd64-0x0;var _0x3a29dc=_0xbe45[_0x37cd64];return _0x3a29dc;};'use strict';var _=require(_0x5be4('0x0'));var util=require(_0x5be4('0x1'));var logger=require('../../config/logger')(_0x5be4('0x2'));var moment=require(_0x5be4('0x3'));var BPromise=require(_0x5be4('0x4'));var rp=require(_0x5be4('0x5'));var fs=require('fs');var path=require(_0x5be4('0x6'));var rimraf=require(_0x5be4('0x7'));var config=require('../../config/environment');var attributes=require(_0x5be4('0x8'));module[_0x5be4('0x9')]=function(_0x2681c7,_0x2b3c60){return _0x2681c7[_0x5be4('0xa')](_0x5be4('0xb'),attributes,{'tableName':_0x5be4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6726=['../../config/logger','moment','bluebird','path','../../config/environment','./trigger.attributes','exports','define','Trigger','tools_triggers','util'];(function(_0x17f234,_0x2ab699){var _0xf64326=function(_0x492a9e){while(--_0x492a9e){_0x17f234['push'](_0x17f234['shift']());}};_0xf64326(++_0x2ab699);}(_0x6726,0xdb));var _0x6672=function(_0x57da0a,_0x284aed){_0x57da0a=_0x57da0a-0x0;var _0x3145d5=_0x6726[_0x57da0a];return _0x3145d5;};'use strict';var _=require('lodash');var util=require(_0x6672('0x0'));var logger=require(_0x6672('0x1'))('api');var moment=require(_0x6672('0x2'));var BPromise=require(_0x6672('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6672('0x4'));var rimraf=require('rimraf');var config=require(_0x6672('0x5'));var attributes=require(_0x6672('0x6'));module[_0x6672('0x7')]=function(_0x40ba7e,_0x5701b9){return _0x40ba7e[_0x6672('0x8')](_0x6672('0x9'),attributes,{'tableName':_0x6672('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index ce9c6c1..dc61bb8 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 _0x0294=['include','model','attributes','GetTrigger','ShowTrigger','Trigger','find','raw','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','message','Trigger,\x20%s,\x20%s','result','catch','findAll','options','where','map'];(function(_0x379296,_0xb721a1){var _0x2461d0=function(_0x3ee5c6){while(--_0x3ee5c6){_0x379296['push'](_0x379296['shift']());}};_0x2461d0(++_0xb721a1);}(_0x0294,0x17a));var _0x4029=function(_0x228f13,_0x550e4a){_0x228f13=_0x228f13-0x0;var _0x2921f0=_0x0294[_0x228f13];return _0x2921f0;};'use strict';var _=require(_0x4029('0x0'));var util=require(_0x4029('0x1'));var moment=require(_0x4029('0x2'));var BPromise=require(_0x4029('0x3'));var rs=require(_0x4029('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4029('0x5'))['db'];var utils=require(_0x4029('0x6'));var logger=require(_0x4029('0x7'))(_0x4029('0x8'));var config=require(_0x4029('0x9'));var jayson=require(_0x4029('0xa'));var client=jayson[_0x4029('0xb')][_0x4029('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x39700a,_0x1f383,_0x3fccfd){return new BPromise(function(_0x3efcb8,_0x53d000){return client[_0x4029('0xd')](_0x39700a,_0x3fccfd)[_0x4029('0xe')](function(_0x15ff4e){logger[_0x4029('0xf')]('Trigger,\x20%s,\x20%s',_0x1f383,_0x4029('0x10'));logger[_0x4029('0x11')]('Trigger,\x20%s,\x20%s,\x20%s',_0x1f383,_0x4029('0x10'),JSON[_0x4029('0x12')](_0x15ff4e));if(_0x15ff4e[_0x4029('0x13')]){if(_0x15ff4e['error'][_0x4029('0x14')]===0x1f4){logger['error']('Trigger,\x20%s,\x20%s',_0x1f383,_0x15ff4e['error']['message']);return _0x53d000(_0x15ff4e['error'][_0x4029('0x15')]);}logger['error']('Trigger,\x20%s,\x20%s',_0x1f383,_0x15ff4e['error'][_0x4029('0x15')]);return _0x3efcb8(_0x15ff4e['error'][_0x4029('0x15')]);}else{logger['info'](_0x4029('0x16'),_0x1f383,'request\x20sent');_0x3efcb8(_0x15ff4e[_0x4029('0x17')][_0x4029('0x15')]);}})[_0x4029('0x18')](function(_0x393bdc){logger[_0x4029('0x13')](_0x4029('0x16'),_0x1f383,_0x393bdc);_0x53d000(_0x393bdc);});});}exports['GetTrigger']=function(_0x419baf){var _0x440fc5=this;return new Promise(function(_0x55e6d1,_0xae2912){return db['Trigger'][_0x4029('0x19')]({'raw':_0x419baf[_0x4029('0x1a')]?_0x419baf[_0x4029('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x419baf[_0x4029('0x1a')]?_0x419baf[_0x4029('0x1a')][_0x4029('0x1b')]||null:null,'attributes':_0x419baf['options']?_0x419baf[_0x4029('0x1a')]['attributes']||null:null,'limit':_0x419baf[_0x4029('0x1a')]?_0x419baf['options']['limit']||null:null,'include':_0x419baf[_0x4029('0x1a')]?_0x419baf[_0x4029('0x1a')]['include']?_[_0x4029('0x1c')](_0x419baf[_0x4029('0x1a')][_0x4029('0x1d')],function(_0x3b305f){return{'model':db[_0x3b305f[_0x4029('0x1e')]],'as':_0x3b305f['as'],'attributes':_0x3b305f[_0x4029('0x1f')],'include':_0x3b305f[_0x4029('0x1d')]?_[_0x4029('0x1c')](_0x3b305f[_0x4029('0x1d')],function(_0x3c1909){return{'model':db[_0x3c1909[_0x4029('0x1e')]],'as':_0x3c1909['as'],'attributes':_0x3c1909[_0x4029('0x1f')],'include':_0x3c1909['include']?_[_0x4029('0x1c')](_0x3c1909[_0x4029('0x1d')],function(_0x21d1db){return{'model':db[_0x21d1db[_0x4029('0x1e')]],'as':_0x21d1db['as'],'attributes':_0x21d1db[_0x4029('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x35c60c){logger[_0x4029('0xf')]('GetTrigger',_0x419baf);logger['debug']('GetTrigger',_0x419baf,JSON['stringify'](_0x35c60c));_0x55e6d1(_0x35c60c);})[_0x4029('0x18')](function(_0xa05cbe){logger[_0x4029('0x13')](_0x4029('0x20'),_0xa05cbe['message'],_0x419baf);_0xae2912(_0x440fc5[_0x4029('0x13')](0x1f4,_0xa05cbe[_0x4029('0x15')]));});});};exports[_0x4029('0x21')]=function(_0x2f7e9d){var _0x3d8fbc=this;return new Promise(function(_0x53b043,_0x5de2e8){return db[_0x4029('0x22')][_0x4029('0x23')]({'raw':_0x2f7e9d[_0x4029('0x1a')]?_0x2f7e9d[_0x4029('0x1a')][_0x4029('0x24')]===undefined?!![]:![]:!![],'where':_0x2f7e9d[_0x4029('0x1a')]?_0x2f7e9d[_0x4029('0x1a')]['where']||null:null,'attributes':_0x2f7e9d[_0x4029('0x1a')]?_0x2f7e9d['options']['attributes']||null:null,'include':_0x2f7e9d['options']?_0x2f7e9d[_0x4029('0x1a')][_0x4029('0x1d')]?_[_0x4029('0x1c')](_0x2f7e9d[_0x4029('0x1a')][_0x4029('0x1d')],function(_0x195633){return{'model':db[_0x195633[_0x4029('0x1e')]],'as':_0x195633['as'],'attributes':_0x195633[_0x4029('0x1f')],'include':_0x195633[_0x4029('0x1d')]?_[_0x4029('0x1c')](_0x195633['include'],function(_0x5c9388){return{'model':db[_0x5c9388['model']],'as':_0x5c9388['as'],'attributes':_0x5c9388[_0x4029('0x1f')],'include':_0x5c9388['include']?_[_0x4029('0x1c')](_0x5c9388[_0x4029('0x1d')],function(_0x1eece6){return{'model':db[_0x1eece6[_0x4029('0x1e')]],'as':_0x1eece6['as'],'attributes':_0x1eece6[_0x4029('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x40df67){logger[_0x4029('0xf')](_0x4029('0x21'),_0x2f7e9d);logger['debug']('ShowTrigger',_0x2f7e9d,JSON['stringify'](_0x40df67));_0x53b043(_0x40df67);})[_0x4029('0x18')](function(_0x4ec0c0){logger[_0x4029('0x13')](_0x4029('0x21'),_0x4ec0c0['message'],_0x2f7e9d);_0x5de2e8(_0x3d8fbc[_0x4029('0x13')](0x1f4,_0x4ec0c0['message']));});});}; \ No newline at end of file +var _0x0aa5=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','GetTrigger','Trigger','findAll','options','raw','where','map','include','model','attributes','then','find','ShowTrigger'];(function(_0x7b9a7e,_0x133d33){var _0x20ab8c=function(_0x4755c6){while(--_0x4755c6){_0x7b9a7e['push'](_0x7b9a7e['shift']());}};_0x20ab8c(++_0x133d33);}(_0x0aa5,0x84));var _0x50aa=function(_0x56219b,_0x94c128){_0x56219b=_0x56219b-0x0;var _0xfc5d0f=_0x0aa5[_0x56219b];return _0xfc5d0f;};'use strict';var _=require('lodash');var util=require(_0x50aa('0x0'));var moment=require(_0x50aa('0x1'));var BPromise=require(_0x50aa('0x2'));var rs=require(_0x50aa('0x3'));var fs=require('fs');var Redis=require(_0x50aa('0x4'));var db=require(_0x50aa('0x5'))['db'];var utils=require(_0x50aa('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x50aa('0x7'));var jayson=require(_0x50aa('0x8'));var client=jayson[_0x50aa('0x9')][_0x50aa('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1200c6,_0x327c20,_0x85698b){return new BPromise(function(_0x300ed4,_0x4d6952){return client[_0x50aa('0xb')](_0x1200c6,_0x85698b)['then'](function(_0x6afbfe){logger[_0x50aa('0xc')](_0x50aa('0xd'),_0x327c20,_0x50aa('0xe'));logger[_0x50aa('0xf')]('Trigger,\x20%s,\x20%s,\x20%s',_0x327c20,'request\x20sent',JSON[_0x50aa('0x10')](_0x6afbfe));if(_0x6afbfe[_0x50aa('0x11')]){if(_0x6afbfe[_0x50aa('0x11')]['code']===0x1f4){logger[_0x50aa('0x11')](_0x50aa('0xd'),_0x327c20,_0x6afbfe[_0x50aa('0x11')][_0x50aa('0x12')]);return _0x4d6952(_0x6afbfe['error']['message']);}logger['error'](_0x50aa('0xd'),_0x327c20,_0x6afbfe[_0x50aa('0x11')][_0x50aa('0x12')]);return _0x300ed4(_0x6afbfe['error'][_0x50aa('0x12')]);}else{logger[_0x50aa('0xc')](_0x50aa('0xd'),_0x327c20,_0x50aa('0xe'));_0x300ed4(_0x6afbfe['result']['message']);}})[_0x50aa('0x13')](function(_0x20dc13){logger[_0x50aa('0x11')](_0x50aa('0xd'),_0x327c20,_0x20dc13);_0x4d6952(_0x20dc13);});});}exports[_0x50aa('0x14')]=function(_0x436cab){var _0x2e6ecb=this;return new Promise(function(_0x36b8bd,_0x5dd5c5){return db[_0x50aa('0x15')][_0x50aa('0x16')]({'raw':_0x436cab['options']?_0x436cab[_0x50aa('0x17')][_0x50aa('0x18')]===undefined?!![]:![]:!![],'where':_0x436cab['options']?_0x436cab[_0x50aa('0x17')][_0x50aa('0x19')]||null:null,'attributes':_0x436cab[_0x50aa('0x17')]?_0x436cab[_0x50aa('0x17')]['attributes']||null:null,'limit':_0x436cab[_0x50aa('0x17')]?_0x436cab[_0x50aa('0x17')]['limit']||null:null,'include':_0x436cab['options']?_0x436cab['options']['include']?_[_0x50aa('0x1a')](_0x436cab[_0x50aa('0x17')][_0x50aa('0x1b')],function(_0x2d0957){return{'model':db[_0x2d0957[_0x50aa('0x1c')]],'as':_0x2d0957['as'],'attributes':_0x2d0957[_0x50aa('0x1d')],'include':_0x2d0957[_0x50aa('0x1b')]?_[_0x50aa('0x1a')](_0x2d0957[_0x50aa('0x1b')],function(_0x377716){return{'model':db[_0x377716[_0x50aa('0x1c')]],'as':_0x377716['as'],'attributes':_0x377716[_0x50aa('0x1d')],'include':_0x377716[_0x50aa('0x1b')]?_[_0x50aa('0x1a')](_0x377716[_0x50aa('0x1b')],function(_0x4364c7){return{'model':db[_0x4364c7[_0x50aa('0x1c')]],'as':_0x4364c7['as'],'attributes':_0x4364c7[_0x50aa('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x50aa('0x1e')](function(_0x5bf00e){logger[_0x50aa('0xc')]('GetTrigger',_0x436cab);logger[_0x50aa('0xf')](_0x50aa('0x14'),_0x436cab,JSON[_0x50aa('0x10')](_0x5bf00e));_0x36b8bd(_0x5bf00e);})[_0x50aa('0x13')](function(_0x32323c){logger['error'](_0x50aa('0x14'),_0x32323c[_0x50aa('0x12')],_0x436cab);_0x5dd5c5(_0x2e6ecb[_0x50aa('0x11')](0x1f4,_0x32323c[_0x50aa('0x12')]));});});};exports['ShowTrigger']=function(_0x1ce549){var _0x25e7e9=this;return new Promise(function(_0x34c153,_0x12b05d){return db[_0x50aa('0x15')][_0x50aa('0x1f')]({'raw':_0x1ce549['options']?_0x1ce549[_0x50aa('0x17')][_0x50aa('0x18')]===undefined?!![]:![]:!![],'where':_0x1ce549['options']?_0x1ce549['options'][_0x50aa('0x19')]||null:null,'attributes':_0x1ce549[_0x50aa('0x17')]?_0x1ce549[_0x50aa('0x17')][_0x50aa('0x1d')]||null:null,'include':_0x1ce549[_0x50aa('0x17')]?_0x1ce549[_0x50aa('0x17')][_0x50aa('0x1b')]?_['map'](_0x1ce549['options'][_0x50aa('0x1b')],function(_0xdd2721){return{'model':db[_0xdd2721[_0x50aa('0x1c')]],'as':_0xdd2721['as'],'attributes':_0xdd2721[_0x50aa('0x1d')],'include':_0xdd2721['include']?_[_0x50aa('0x1a')](_0xdd2721[_0x50aa('0x1b')],function(_0x37f512){return{'model':db[_0x37f512[_0x50aa('0x1c')]],'as':_0x37f512['as'],'attributes':_0x37f512[_0x50aa('0x1d')],'include':_0x37f512[_0x50aa('0x1b')]?_[_0x50aa('0x1a')](_0x37f512[_0x50aa('0x1b')],function(_0x57632a){return{'model':db[_0x57632a['model']],'as':_0x57632a['as'],'attributes':_0x57632a['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x351efb){logger[_0x50aa('0xc')](_0x50aa('0x20'),_0x1ce549);logger['debug']('ShowTrigger',_0x1ce549,JSON['stringify'](_0x351efb));_0x34c153(_0x351efb);})[_0x50aa('0x13')](function(_0xa283d3){logger['error'](_0x50aa('0x20'),_0xa283d3[_0x50aa('0x12')],_0x1ce549);_0x12b05d(_0x25e7e9[_0x50aa('0x11')](0x1f4,_0xa283d3[_0x50aa('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index da43605..0535346 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 _0xb418=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','isAuthenticated','index','post','/:id/clone','create','put','/:id','update','delete','destroy','exports'];(function(_0x232e7a,_0x19997){var _0x445ddd=function(_0x43628d){while(--_0x43628d){_0x232e7a['push'](_0x232e7a['shift']());}};_0x445ddd(++_0x19997);}(_0xb418,0x1a4));var _0x8b41=function(_0x3740fe,_0x6c543c){_0x3740fe=_0x3740fe-0x0;var _0x55492b=_0xb418[_0x3740fe];return _0x55492b;};'use strict';var multer=require(_0x8b41('0x0'));var util=require(_0x8b41('0x1'));var path=require(_0x8b41('0x2'));var timeout=require(_0x8b41('0x3'));var express=require('express');var router=express[_0x8b41('0x4')]();var fs_extra=require(_0x8b41('0x5'));var auth=require(_0x8b41('0x6'));var interaction=require(_0x8b41('0x7'));var config=require(_0x8b41('0x8'));var controller=require(_0x8b41('0x9'));router['get']('/',auth[_0x8b41('0xa')](),controller[_0x8b41('0xb')]);router['get']('/:id',auth[_0x8b41('0xa')](),controller['show']);router[_0x8b41('0xc')](_0x8b41('0xd'),auth['isAuthenticated'](),controller['clone']);router['post']('/',auth[_0x8b41('0xa')](),controller[_0x8b41('0xe')]);router[_0x8b41('0xf')](_0x8b41('0x10'),auth[_0x8b41('0xa')](),controller[_0x8b41('0x11')]);router[_0x8b41('0x12')](_0x8b41('0x10'),auth[_0x8b41('0xa')](),controller[_0x8b41('0x13')]);module[_0x8b41('0x14')]=router; \ No newline at end of file +var _0x04b3=['exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','index','show','post','clone','put','/:id','destroy'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x04b3,0x145));var _0x304b=function(_0x2fe92f,_0x52d5cf){_0x2fe92f=_0x2fe92f-0x0;var _0x1f70f4=_0x04b3[_0x2fe92f];return _0x1f70f4;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x304b('0x0'));var timeout=require('connect-timeout');var express=require(_0x304b('0x1'));var router=express[_0x304b('0x2')]();var fs_extra=require(_0x304b('0x3'));var auth=require(_0x304b('0x4'));var interaction=require(_0x304b('0x5'));var config=require(_0x304b('0x6'));var controller=require(_0x304b('0x7'));router[_0x304b('0x8')]('/',auth[_0x304b('0x9')](),controller[_0x304b('0xa')]);router[_0x304b('0x8')]('/:id',auth[_0x304b('0x9')](),controller[_0x304b('0xb')]);router[_0x304b('0xc')]('/:id/clone',auth[_0x304b('0x9')](),controller[_0x304b('0xd')]);router['post']('/',auth[_0x304b('0x9')](),controller['create']);router[_0x304b('0xe')](_0x304b('0xf'),auth[_0x304b('0x9')](),controller['update']);router['delete'](_0x304b('0xf'),auth['isAuthenticated'](),controller[_0x304b('0x10')]);module[_0x304b('0x11')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index cdb5fb1..dbb01c2 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 _0xc58b=['getDataValue','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','inband','auto','yes','outgoing','force_rport,comedia','nat','join','split','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','accept','refuse','originate','uac','uas','pai','certificate','active','passive','dynamic','nonat','update','sequelize','exports','name','ENUM','friend','user','peer','STRING','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','udp','setDataValue','transport'];(function(_0x253aee,_0x3a5816){var _0x2c34b0=function(_0x497300){while(--_0x497300){_0x253aee['push'](_0x253aee['shift']());}};_0x2c34b0(++_0x3a5816);}(_0xc58b,0x1ec));var _0xbc58=function(_0x13a330,_0x26b966){_0x13a330=_0x13a330-0x0;var _0x3927ec=_0xc58b[_0x13a330];return _0x3927ec;};'use strict';var Sequelize=require(_0xbc58('0x0'));module[_0xbc58('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xbc58('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xbc58('0x3')](_0xbc58('0x4'),_0xbc58('0x5'),_0xbc58('0x6')),'allowNull':![],'defaultValue':_0xbc58('0x4')},'context':{'type':Sequelize[_0xbc58('0x7')],'allowNull':![],'defaultValue':_0xbc58('0x8')},'callingpres':{'type':Sequelize[_0xbc58('0x3')](_0xbc58('0x9'),_0xbc58('0xa'),_0xbc58('0xb'),_0xbc58('0xc'),_0xbc58('0xd'),_0xbc58('0xe'),'PROHIB_FAILED_SCREEN','PROHIB')},'deny':{'type':Sequelize[_0xbc58('0x7')]},'permit':{'type':Sequelize[_0xbc58('0x7')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0xbc58('0x7')]},'remotesecret':{'type':Sequelize[_0xbc58('0x7')]},'transport':{'type':Sequelize[_0xbc58('0x7')],'defaultValue':_0xbc58('0xf'),'set':function(_0x216e26){this[_0xbc58('0x10')](_0xbc58('0x11'),_0x216e26?_0x216e26['join'](','):null);},'get':function(){return this['getDataValue'](_0xbc58('0x11'))?this[_0xbc58('0x12')](_0xbc58('0x11'))['split'](','):null;},'comment':_0xbc58('0x13')},'dtmfmode':{'type':Sequelize[_0xbc58('0x3')](_0xbc58('0x14'),'info',_0xbc58('0x15'),_0xbc58('0x16'),_0xbc58('0x17')),'defaultValue':_0xbc58('0x14')},'directmedia':{'type':Sequelize[_0xbc58('0x3')](_0xbc58('0x18'),'no','nonat','update',_0xbc58('0x19')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xbc58('0x3')](_0xbc58('0x18'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xbc58('0x7')]},'directmediadeny':{'type':Sequelize[_0xbc58('0x7')]},'nat':{'type':Sequelize['STRING'],'defaultValue':_0xbc58('0x1a'),'set':function(_0x23e571){this[_0xbc58('0x10')](_0xbc58('0x1b'),_0x23e571?_0x23e571[_0xbc58('0x1c')](','):null);},'get':function(){return this[_0xbc58('0x12')](_0xbc58('0x1b'))?this['getDataValue'](_0xbc58('0x1b'))[_0xbc58('0x1d')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0xbc58('0x7')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0xbc58('0x7')]},'namedpickupgroup':{'type':Sequelize[_0xbc58('0x7')]},'language':{'type':Sequelize[_0xbc58('0x7')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':_0xbc58('0x1e')},'allow':{'type':Sequelize[_0xbc58('0x7')],'allowNull':![],'defaultValue':_0xbc58('0x1f'),'set':function(_0x1f6002){this['setDataValue'](_0xbc58('0x20'),_0x1f6002?_0x1f6002[_0xbc58('0x1c')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0xbc58('0x12')]('allow')?this[_0xbc58('0x12')](_0xbc58('0x20'))[_0xbc58('0x1d')](';'):null;},'comment':_0xbc58('0x21')},'autoframing':{'type':Sequelize[_0xbc58('0x3')](_0xbc58('0x18'),'no')},'insecure':{'type':Sequelize[_0xbc58('0x7')],'defaultValue':_0xbc58('0x22'),'set':function(_0x24d45b){this[_0xbc58('0x10')](_0xbc58('0x23'),_0x24d45b?_0x24d45b['join'](','):null);},'get':function(){return this['getDataValue'](_0xbc58('0x23'))?this[_0xbc58('0x12')]('insecure')['split'](','):null;},'comment':_0xbc58('0x24')},'trustrpid':{'type':Sequelize[_0xbc58('0x3')](_0xbc58('0x18'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xbc58('0x3')](_0xbc58('0x18'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xbc58('0x3')](_0xbc58('0x18'),'no',_0xbc58('0x25'))},'promiscredir':{'type':Sequelize[_0xbc58('0x3')](_0xbc58('0x18'),'no')},'useclientcode':{'type':Sequelize[_0xbc58('0x3')](_0xbc58('0x18'),'no')},'accountcode':{'type':Sequelize[_0xbc58('0x26')](0xb)},'setvar':{'type':Sequelize[_0xbc58('0x7')]},'callerid':{'type':Sequelize[_0xbc58('0x7')],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0xbc58('0x7')]},'callcounter':{'type':Sequelize[_0xbc58('0x3')]('yes','no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0xbc58('0x26')](0xb)},'allowoverlap':{'type':Sequelize[_0xbc58('0x3')]('yes','no')},'allowsubscribe':{'type':Sequelize['ENUM']('yes','no')},'allowtransfer':{'type':Sequelize[_0xbc58('0x3')](_0xbc58('0x18'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM']('yes','no')},'subscribecontext':{'type':Sequelize[_0xbc58('0x7')]},'template':{'type':Sequelize[_0xbc58('0x7')]},'videosupport':{'type':Sequelize[_0xbc58('0x3')](_0xbc58('0x18'),'no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xbc58('0x26')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM']('yes','no')},'mailbox':{'type':Sequelize[_0xbc58('0x7')]},'session_timers':{'type':Sequelize[_0xbc58('0x3')](_0xbc58('0x27'),_0xbc58('0x28'),_0xbc58('0x29'))},'session_expires':{'type':Sequelize[_0xbc58('0x26')](0xb)},'session_minse':{'type':Sequelize[_0xbc58('0x26')](0xb)},'session_refresher':{'type':Sequelize[_0xbc58('0x3')](_0xbc58('0x2a'),'uas'),'defaultValue':_0xbc58('0x2b')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0xbc58('0x7')]},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0xbc58('0x7')]},'port':{'type':Sequelize[_0xbc58('0x26')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0xbc58('0x18'),'no'),'defaultValue':_0xbc58('0x18')},'keepalive':{'type':Sequelize[_0xbc58('0x26')](0xb)},'defaultip':{'type':Sequelize[_0xbc58('0x7')]},'defaultuser':{'type':Sequelize[_0xbc58('0x7')]},'rtptimeout':{'type':Sequelize[_0xbc58('0x26')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xbc58('0x26')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xbc58('0x26')](0xb)},'sendrpid':{'type':Sequelize[_0xbc58('0x3')](_0xbc58('0x18'),'no',_0xbc58('0x2c')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xbc58('0x7')]},'callbackextension':{'type':Sequelize[_0xbc58('0x7')]},'timert1':{'type':Sequelize[_0xbc58('0x26')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize[_0xbc58('0x7')]},'contactdeny':{'type':Sequelize[_0xbc58('0x7')]},'contactacl':{'type':Sequelize[_0xbc58('0x7')]},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize[_0xbc58('0x7')]},'maxforwards':{'type':Sequelize[_0xbc58('0x26')](0xb)},'encryption':{'type':Sequelize[_0xbc58('0x3')](_0xbc58('0x18'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0xbc58('0x18'),'no')},'force_avp':{'type':Sequelize[_0xbc58('0x3')](_0xbc58('0x18'),'no')},'icesupport':{'type':Sequelize[_0xbc58('0x3')](_0xbc58('0x18'),'no')},'dtlsenable':{'type':Sequelize[_0xbc58('0x3')]('yes','no')},'dtlsverify':{'type':Sequelize[_0xbc58('0x3')]('yes','no','fingerprint',_0xbc58('0x2d'))},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize[_0xbc58('0x7')]},'dtlsprivatekey':{'type':Sequelize[_0xbc58('0x7')]},'dtlscipher':{'type':Sequelize[_0xbc58('0x7')]},'dtlscafile':{'type':Sequelize[_0xbc58('0x7')]},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0xbc58('0x3')](_0xbc58('0x2e'),_0xbc58('0x2f'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xbc58('0x7')]},'usereqphone':{'type':Sequelize['ENUM'](_0xbc58('0x18'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0xbc58('0x7')]},'call_limit':{'type':Sequelize[_0xbc58('0x26')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xbc58('0x3')]('yes','no')},'subscribemwi':{'type':Sequelize['ENUM'](_0xbc58('0x18'),'no')},'vmexten':{'type':Sequelize[_0xbc58('0x7')]},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0xbc58('0x7')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xbc58('0x7')]},'host':{'type':Sequelize['STRING'],'defaultValue':_0xbc58('0x30')},'canreinvite':{'type':Sequelize[_0xbc58('0x3')]('yes','no',_0xbc58('0x31'),_0xbc58('0x32'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0xbc58('0x7')]},'otherFields':{'type':Sequelize[_0xbc58('0x7')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xbc58('0x7')],'defaultValue':'no'}}; \ No newline at end of file +var _0xd338=['split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','auto','yes','nonat','update','outgoing','nat','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','ulaw;alaw;gsm','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','accept','refuse','originate','uac','fingerprint','certificate','active','passive','actpass','dynamic','update,nonat','sequelize','exports','STRING','name','ENUM','friend','user','peer','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport','getDataValue'];(function(_0x352c88,_0x271f00){var _0x37ebcf=function(_0x3539f2){while(--_0x3539f2){_0x352c88['push'](_0x352c88['shift']());}};_0x37ebcf(++_0x271f00);}(_0xd338,0x15a));var _0x8d33=function(_0xe84805,_0x2702d9){_0xe84805=_0xe84805-0x0;var _0x398efd=_0xd338[_0xe84805];return _0x398efd;};'use strict';var Sequelize=require(_0x8d33('0x0'));module[_0x8d33('0x1')]={'name':{'type':Sequelize[_0x8d33('0x2')],'allowNull':![],'unique':_0x8d33('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x8d33('0x4')](_0x8d33('0x5'),_0x8d33('0x6'),_0x8d33('0x7')),'allowNull':![],'defaultValue':_0x8d33('0x5')},'context':{'type':Sequelize[_0x8d33('0x2')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0x8d33('0x4')](_0x8d33('0x8'),_0x8d33('0x9'),'ALLOWED_FAILED_SCREEN',_0x8d33('0xa'),_0x8d33('0xb'),'PROHIB_PASSED_SCREEN',_0x8d33('0xc'),_0x8d33('0xd'))},'deny':{'type':Sequelize[_0x8d33('0x2')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0x8d33('0x2')]},'md5secret':{'type':Sequelize[_0x8d33('0x2')]},'remotesecret':{'type':Sequelize[_0x8d33('0x2')]},'transport':{'type':Sequelize['STRING'],'defaultValue':_0x8d33('0xe'),'set':function(_0x41bf20){this[_0x8d33('0xf')](_0x8d33('0x10'),_0x41bf20?_0x41bf20['join'](','):null);},'get':function(){return this[_0x8d33('0x11')]('transport')?this['getDataValue'](_0x8d33('0x10'))[_0x8d33('0x12')](','):null;},'comment':_0x8d33('0x13')},'dtmfmode':{'type':Sequelize[_0x8d33('0x4')](_0x8d33('0x14'),_0x8d33('0x15'),_0x8d33('0x16'),'inband',_0x8d33('0x17')),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize['ENUM'](_0x8d33('0x18'),'no',_0x8d33('0x19'),_0x8d33('0x1a'),_0x8d33('0x1b')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x8d33('0x4')](_0x8d33('0x18'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0x8d33('0x2')]},'nat':{'type':Sequelize[_0x8d33('0x2')],'defaultValue':'force_rport,comedia','set':function(_0x1fcec3){this['setDataValue'](_0x8d33('0x1c'),_0x1fcec3?_0x1fcec3[_0x8d33('0x1d')](','):null);},'get':function(){return this[_0x8d33('0x11')](_0x8d33('0x1c'))?this['getDataValue']('nat')[_0x8d33('0x12')](','):null;},'comment':_0x8d33('0x1e')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x8d33('0x2')]},'pickupgroup':{'type':Sequelize[_0x8d33('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x8d33('0x2')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0x8d33('0x2')],'defaultValue':_0x8d33('0x1f')},'allow':{'type':Sequelize[_0x8d33('0x2')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x389fb0){this[_0x8d33('0xf')](_0x8d33('0x20'),_0x389fb0?_0x389fb0[_0x8d33('0x1d')](';'):_0x8d33('0x21'));},'get':function(){return this['getDataValue'](_0x8d33('0x20'))?this[_0x8d33('0x11')](_0x8d33('0x20'))[_0x8d33('0x12')](';'):null;},'comment':_0x8d33('0x22')},'autoframing':{'type':Sequelize[_0x8d33('0x4')](_0x8d33('0x18'),'no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':'port,invite','set':function(_0x1c4c14){this[_0x8d33('0xf')](_0x8d33('0x23'),_0x1c4c14?_0x1c4c14[_0x8d33('0x1d')](','):null);},'get':function(){return this[_0x8d33('0x11')]('insecure')?this[_0x8d33('0x11')](_0x8d33('0x23'))[_0x8d33('0x12')](','):null;},'comment':_0x8d33('0x24')},'trustrpid':{'type':Sequelize['ENUM'](_0x8d33('0x18'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x8d33('0x18'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x8d33('0x4')](_0x8d33('0x18'),'no',_0x8d33('0x25'))},'promiscredir':{'type':Sequelize[_0x8d33('0x4')]('yes','no')},'useclientcode':{'type':Sequelize['ENUM'](_0x8d33('0x18'),'no')},'accountcode':{'type':Sequelize[_0x8d33('0x26')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x8d33('0x2')],'defaultValue':_0x8d33('0x27')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize['ENUM'](_0x8d33('0x18'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x8d33('0x26')](0xb)},'allowoverlap':{'type':Sequelize[_0x8d33('0x4')](_0x8d33('0x18'),'no')},'allowsubscribe':{'type':Sequelize[_0x8d33('0x4')](_0x8d33('0x18'),'no')},'allowtransfer':{'type':Sequelize['ENUM']('yes','no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x8d33('0x18'),'no')},'subscribecontext':{'type':Sequelize[_0x8d33('0x2')]},'template':{'type':Sequelize[_0x8d33('0x2')]},'videosupport':{'type':Sequelize[_0x8d33('0x4')](_0x8d33('0x18'),'no',_0x8d33('0x28')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize[_0x8d33('0x4')]('yes','no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize['ENUM'](_0x8d33('0x29'),_0x8d33('0x2a'),_0x8d33('0x2b'))},'session_expires':{'type':Sequelize[_0x8d33('0x26')](0xb)},'session_minse':{'type':Sequelize[_0x8d33('0x26')](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0x8d33('0x2c'),'uas'),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x8d33('0x2')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0x8d33('0x2')]},'fromuser':{'type':Sequelize[_0x8d33('0x2')]},'port':{'type':Sequelize[_0x8d33('0x26')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0x8d33('0x18'),'no'),'defaultValue':_0x8d33('0x18')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0x8d33('0x2')]},'defaultuser':{'type':Sequelize[_0x8d33('0x2')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x8d33('0x26')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x8d33('0x26')](0xb)},'sendrpid':{'type':Sequelize[_0x8d33('0x4')]('yes','no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x8d33('0x2')]},'callbackextension':{'type':Sequelize[_0x8d33('0x2')]},'timert1':{'type':Sequelize[_0x8d33('0x26')](0xb)},'timerb':{'type':Sequelize[_0x8d33('0x26')](0xb)},'qualifyfreq':{'type':Sequelize[_0x8d33('0x26')](0xb)},'contactpermit':{'type':Sequelize[_0x8d33('0x2')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0x8d33('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0x8d33('0x2')]},'use_q850_reason':{'type':Sequelize[_0x8d33('0x2')]},'maxforwards':{'type':Sequelize[_0x8d33('0x26')](0xb)},'encryption':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x8d33('0x18'),'no')},'force_avp':{'type':Sequelize['ENUM'](_0x8d33('0x18'),'no')},'icesupport':{'type':Sequelize[_0x8d33('0x4')]('yes','no')},'dtlsenable':{'type':Sequelize[_0x8d33('0x4')]('yes','no')},'dtlsverify':{'type':Sequelize['ENUM'](_0x8d33('0x18'),'no',_0x8d33('0x2d'),_0x8d33('0x2e'))},'dtlsrekey':{'type':Sequelize[_0x8d33('0x26')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize[_0x8d33('0x2')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0x8d33('0x2')]},'dtlssetup':{'type':Sequelize['ENUM'](_0x8d33('0x2f'),_0x8d33('0x30'),_0x8d33('0x31')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x8d33('0x2')]},'usereqphone':{'type':Sequelize['ENUM'](_0x8d33('0x18'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x8d33('0x2')]},'recordofffeature':{'type':Sequelize[_0x8d33('0x2')]},'call_limit':{'type':Sequelize[_0x8d33('0x26')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0x8d33('0x18'),'no')},'subscribemwi':{'type':Sequelize[_0x8d33('0x4')](_0x8d33('0x18'),'no')},'vmexten':{'type':Sequelize[_0x8d33('0x2')]},'mohinterpret':{'type':Sequelize[_0x8d33('0x2')]},'mohsuggest':{'type':Sequelize[_0x8d33('0x2')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8d33('0x2')]},'host':{'type':Sequelize['STRING'],'defaultValue':_0x8d33('0x32')},'canreinvite':{'type':Sequelize[_0x8d33('0x4')](_0x8d33('0x18'),'no',_0x8d33('0x19'),_0x8d33('0x1a'),_0x8d33('0x33')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x8d33('0x2')]},'otherFields':{'type':Sequelize[_0x8d33('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x8d33('0x2')],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index 4d1fab2..c516550 100644 --- a/server/api/trunk/trunk.controller.js +++ b/server/api/trunk/trunk.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe14d=['options','includeAll','include','findAll','rows','params','keys','rawAttributes','find','omit','createdAt','updatedAt','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','server/files/templates/trunk.ejs','utf8','root','server/files/templates/registry.ejs','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','Reload','UserProfileSection','autoAssociation','readFileSync','render','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','get','Trunks','UserProfileResource','destroy','stack','name','map','Trunk','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','where','pick','filter','merge','VIRTUAL'];(function(_0x2ca954,_0x3855b5){var _0x5ea4e8=function(_0x27c0bc){while(--_0x27c0bc){_0x2ca954['push'](_0x2ca954['shift']());}};_0x5ea4e8(++_0x3855b5);}(_0xe14d,0x1ee));var _0xde14=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xe14d[_0x28947d];return _0x12d2ee;};'use strict';var emlformat=require(_0xde14('0x0'));var rimraf=require(_0xde14('0x1'));var zipdir=require(_0xde14('0x2'));var jsonpatch=require(_0xde14('0x3'));var rp=require('request-promise');var moment=require(_0xde14('0x4'));var BPromise=require(_0xde14('0x5'));var Mustache=require('mustache');var util=require(_0xde14('0x6'));var path=require(_0xde14('0x7'));var sox=require(_0xde14('0x8'));var csv=require(_0xde14('0x9'));var ejs=require(_0xde14('0xa'));var fs=require('fs');var fs_extra=require(_0xde14('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xde14('0xc'));var jsforce=require(_0xde14('0xd'));var deskjs=require(_0xde14('0xe'));var toCsv=require(_0xde14('0x9'));var querystring=require(_0xde14('0xf'));var Papa=require(_0xde14('0x10'));var Redis=require(_0xde14('0x11'));var authService=require(_0xde14('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xde14('0x13'));var hardwareService=require(_0xde14('0x14'));var logger=require(_0xde14('0x15'))(_0xde14('0x16'));var utils=require(_0xde14('0x17'));var config=require(_0xde14('0x18'));var licenseUtil=require(_0xde14('0x19'));var db=require(_0xde14('0x1a'))['db'];var jayson=require(_0xde14('0x1b'));var client=jayson[_0xde14('0x1c')][_0xde14('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x464624,_0x3521d4,_0x281c54,_0x1489e9){return new BPromise(function(_0x54c58b,_0x584959){var _0x23c878=_0x1489e9||client;return _0x23c878[_0xde14('0x1e')](_0x464624,_0x281c54)[_0xde14('0x1f')](function(_0x4c86ff){logger[_0xde14('0x20')](_0xde14('0x21'),_0x3521d4,_0xde14('0x22'));logger[_0xde14('0x23')](_0xde14('0x24'),_0x3521d4,_0xde14('0x22'),JSON[_0xde14('0x25')](_0x4c86ff));if(_0x4c86ff[_0xde14('0x26')]){if(_0x4c86ff[_0xde14('0x26')][_0xde14('0x27')]===0x1f4){logger['error'](_0xde14('0x21'),_0x3521d4,_0x4c86ff[_0xde14('0x26')][_0xde14('0x28')]);return _0x584959(_0x4c86ff[_0xde14('0x26')]['message']);}logger[_0xde14('0x26')]('Trunk,\x20%s,\x20%s',_0x3521d4,_0x4c86ff[_0xde14('0x26')]['message']);return _0x54c58b(_0x4c86ff[_0xde14('0x26')][_0xde14('0x28')]);}else{logger[_0xde14('0x20')](_0xde14('0x21'),_0x3521d4,_0xde14('0x22'));_0x54c58b(_0x4c86ff[_0xde14('0x29')][_0xde14('0x28')]);}})[_0xde14('0x2a')](function(_0xdd8d59){logger[_0xde14('0x26')](_0xde14('0x21'),_0x3521d4,_0xdd8d59);_0x584959(_0xdd8d59);});});}function respondWithStatusCode(_0xbaa078,_0x8f8033){_0x8f8033=_0x8f8033||0xcc;return function(_0x5ae4c1){if(_0x5ae4c1){return _0xbaa078[_0xde14('0x2b')](_0x8f8033);}return _0xbaa078[_0xde14('0x2c')](_0x8f8033)[_0xde14('0x2d')]();};}function respondWithResult(_0xbd05d6,_0x1bb7be){_0x1bb7be=_0x1bb7be||0xc8;return function(_0x21ef15){if(_0x21ef15){return _0xbd05d6[_0xde14('0x2c')](_0x1bb7be)[_0xde14('0x2e')](_0x21ef15);}};}function respondWithFilteredResult(_0x1618e1,_0x350a78){return function(_0x4eff65){if(_0x4eff65){var _0x309922=typeof _0x350a78[_0xde14('0x2f')]===_0xde14('0x30')&&typeof _0x350a78[_0xde14('0x31')]==='undefined';var _0x3fc2a4=_0x4eff65[_0xde14('0x32')];var _0x30c4a8=_0x309922?0x0:_0x350a78['offset'];var _0x4655fb=_0x309922?_0x4eff65['count']:_0x350a78[_0xde14('0x2f')]+_0x350a78[_0xde14('0x31')];var _0x3bb1da;if(_0x4655fb>=_0x3fc2a4){_0x4655fb=_0x3fc2a4;_0x3bb1da=0xc8;}else{_0x3bb1da=0xce;}_0x1618e1[_0xde14('0x2c')](_0x3bb1da);return _0x1618e1[_0xde14('0x33')](_0xde14('0x34'),_0x30c4a8+'-'+_0x4655fb+'/'+_0x3fc2a4)[_0xde14('0x2e')](_0x4eff65);}return null;};}function patchUpdates(_0x464666){return function(_0x4e7c5b){try{jsonpatch[_0xde14('0x35')](_0x4e7c5b,_0x464666,!![]);}catch(_0xbf49ac){return BPromise['reject'](_0xbf49ac);}return _0x4e7c5b[_0xde14('0x36')]();};}function saveUpdates(_0x4c9b15,_0x2e40ad){return function(_0x44e88a){if(_0x44e88a){return _0x44e88a[_0xde14('0x37')](_0x4c9b15)[_0xde14('0x1f')](function(_0x13c164){return _0x13c164;});}return null;};}function removeEntity(_0x57fc47,_0x26dfa9){return function(_0x57b98b){if(_0x57b98b){return _0x57b98b['destroy']()[_0xde14('0x1f')](function(){var _0x3c943b=_0x57b98b[_0xde14('0x38')]({'plain':!![]});var _0x319136=_0xde14('0x39');return db[_0xde14('0x3a')][_0xde14('0x3b')]({'where':{'type':_0x319136,'resourceId':_0x3c943b['id']}})[_0xde14('0x1f')](function(){return _0x57b98b;});})[_0xde14('0x1f')](function(){_0x57fc47['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c7136,_0x403007){return function(_0x20913d){if(!_0x20913d){_0x1c7136[_0xde14('0x2b')](0x194);}return _0x20913d;};}function handleError(_0x31cad4,_0x23813f){_0x23813f=_0x23813f||0x1f4;return function(_0x1f42ab){logger[_0xde14('0x26')](_0x1f42ab[_0xde14('0x3c')]);if(_0x1f42ab['name']){delete _0x1f42ab[_0xde14('0x3d')];}_0x31cad4['status'](_0x23813f)['send'](_0x1f42ab);};}exports['index']=function(_0xb0eba6,_0x258759){var _0x398f63={},_0x152dab={},_0x1228d8={'count':0x0,'rows':[]};var _0x8b5bb4=_[_0xde14('0x3e')](db[_0xde14('0x3f')]['rawAttributes'],function(_0xc2a39d){return{'name':_0xc2a39d[_0xde14('0x40')],'type':_0xc2a39d[_0xde14('0x41')][_0xde14('0x42')]};});_0x152dab[_0xde14('0x43')]=_[_0xde14('0x3e')](_0x8b5bb4,_0xde14('0x3d'));_0x152dab[_0xde14('0x44')]=_['keys'](_0xb0eba6[_0xde14('0x44')]);_0x152dab[_0xde14('0x45')]=_[_0xde14('0x46')](_0x152dab[_0xde14('0x43')],_0x152dab['query']);_0x398f63['attributes']=_[_0xde14('0x46')](_0x152dab[_0xde14('0x43')],qs[_0xde14('0x47')](_0xb0eba6[_0xde14('0x44')][_0xde14('0x47')]));_0x398f63['attributes']=_0x398f63[_0xde14('0x48')][_0xde14('0x49')]?_0x398f63[_0xde14('0x48')]:_0x152dab['model'];if(!_0xb0eba6[_0xde14('0x44')]['hasOwnProperty'](_0xde14('0x4a'))){_0x398f63['limit']=qs[_0xde14('0x31')](_0xb0eba6[_0xde14('0x44')][_0xde14('0x31')]);_0x398f63[_0xde14('0x2f')]=qs[_0xde14('0x2f')](_0xb0eba6[_0xde14('0x44')][_0xde14('0x2f')]);}_0x398f63[_0xde14('0x4b')]=qs['sort'](_0xb0eba6[_0xde14('0x44')]['sort']);_0x398f63[_0xde14('0x4c')]=qs['filters'](_[_0xde14('0x4d')](_0xb0eba6[_0xde14('0x44')],_0x152dab[_0xde14('0x45')]),_0x8b5bb4);if(_0xb0eba6[_0xde14('0x44')][_0xde14('0x4e')]){_0x398f63[_0xde14('0x4c')]=_[_0xde14('0x4f')](_0x398f63[_0xde14('0x4c')],{'$or':_['map'](_0x8b5bb4,function(_0x15859c){if(_0x15859c[_0xde14('0x41')]!==_0xde14('0x50')){var _0x4b1ef7={};_0x4b1ef7[_0x15859c['name']]={'$like':'%'+_0xb0eba6[_0xde14('0x44')][_0xde14('0x4e')]+'%'};return _0x4b1ef7;}})});}_0x398f63=_[_0xde14('0x4f')]({},_0x398f63,_0xb0eba6[_0xde14('0x51')]);var _0x39572b={'where':_0x398f63[_0xde14('0x4c')]};return db['Trunk'][_0xde14('0x32')](_0x39572b)['then'](function(_0xa408ec){_0x1228d8[_0xde14('0x32')]=_0xa408ec;if(_0xb0eba6['query'][_0xde14('0x52')]){_0x398f63[_0xde14('0x53')]=[{'all':!![]}];}return db[_0xde14('0x3f')][_0xde14('0x54')](_0x398f63);})[_0xde14('0x1f')](function(_0x1c87e1){_0x1228d8[_0xde14('0x55')]=_0x1c87e1;return _0x1228d8;})['then'](respondWithFilteredResult(_0x258759,_0x398f63))[_0xde14('0x2a')](handleError(_0x258759,null));};exports['show']=function(_0xfa80c8,_0x6aa9ab){var _0x237be4={'raw':![],'where':{'id':_0xfa80c8[_0xde14('0x56')]['id']}},_0x235202={};_0x235202[_0xde14('0x43')]=_[_0xde14('0x57')](db[_0xde14('0x3f')][_0xde14('0x58')]);_0x235202[_0xde14('0x44')]=_['keys'](_0xfa80c8[_0xde14('0x44')]);_0x235202[_0xde14('0x45')]=_[_0xde14('0x46')](_0x235202[_0xde14('0x43')],_0x235202[_0xde14('0x44')]);_0x237be4['attributes']=_[_0xde14('0x46')](_0x235202['model'],qs[_0xde14('0x47')](_0xfa80c8[_0xde14('0x44')][_0xde14('0x47')]));_0x237be4[_0xde14('0x48')]=_0x237be4[_0xde14('0x48')]['length']?_0x237be4['attributes']:_0x235202[_0xde14('0x43')];if(_0xfa80c8['query'][_0xde14('0x52')]){_0x237be4[_0xde14('0x53')]=[{'all':!![]}];}_0x237be4=_[_0xde14('0x4f')]({},_0x237be4,_0xfa80c8[_0xde14('0x51')]);return db[_0xde14('0x3f')][_0xde14('0x59')](_0x237be4)[_0xde14('0x1f')](handleEntityNotFound(_0x6aa9ab,null))[_0xde14('0x1f')](respondWithResult(_0x6aa9ab,null))[_0xde14('0x2a')](handleError(_0x6aa9ab,null));};exports['clone']=function(_0x205a94,_0x2c972b){var _0x1ea6d2={'where':{'id':_0x205a94[_0xde14('0x56')]['id']}},_0x21d226={};_0x21d226['model']=_[_0xde14('0x57')](db['Trunk'][_0xde14('0x58')]);_0x1ea6d2[_0xde14('0x48')]=_[_0xde14('0x46')](_0x21d226[_0xde14('0x43')],qs[_0xde14('0x47')](_0x205a94[_0xde14('0x44')][_0xde14('0x47')]));_0x1ea6d2[_0xde14('0x48')]=_0x1ea6d2['attributes']['length']?_0x1ea6d2['attributes']:_0x21d226[_0xde14('0x43')];if(_0x205a94['query']['includeAll']){_0x1ea6d2[_0xde14('0x53')]=[{'all':!![]}];}_0x1ea6d2=_[_0xde14('0x4f')]({},_0x1ea6d2,_0x205a94[_0xde14('0x51')]);return db[_0xde14('0x3f')][_0xde14('0x59')](_0x1ea6d2)[_0xde14('0x1f')](handleEntityNotFound(_0x2c972b,null))[_0xde14('0x1f')](function(_0x13f698){if(_0x13f698){var _0x2dd108=_0x13f698['get']({'plain':!![]});_0x2dd108=qs[_0xde14('0x5a')](_0x2dd108,['id',_0xde14('0x5b'),_0xde14('0x5c')]);_0x205a94['body']=_[_0xde14('0x5a')](_0x205a94['body'],['id',_0xde14('0x5b'),_0xde14('0x5c')]);return db[_0xde14('0x3f')][_0xde14('0x5d')](_[_0xde14('0x4f')](_0x2dd108,_0x205a94[_0xde14('0x5e')]),{'include':_0x205a94[_0xde14('0x44')]['includeAll']?[{'all':!![]}]:undefined})[_0xde14('0x1f')](function(_0x25ba7e){var _0x1a0bb1=_0x205a94[_0xde14('0x5f')][_0xde14('0x38')]({'plain':!![]});if(!_0x1a0bb1)throw new Error(_0xde14('0x60'));if(_0x1a0bb1[_0xde14('0x61')]==='user'){var _0x4a9e85=_0x25ba7e[_0xde14('0x38')]({'plain':!![]});var _0x19a162=_0xde14('0x39');return db['UserProfileSection'][_0xde14('0x59')]({'where':{'name':_0x19a162,'userProfileId':_0x1a0bb1[_0xde14('0x62')]},'raw':!![]})[_0xde14('0x1f')](function(_0x32e075){if(_0x32e075&&_0x32e075['autoAssociation']===0x0){return db['UserProfileResource'][_0xde14('0x5d')]({'name':_0x4a9e85[_0xde14('0x3d')],'resourceId':_0x4a9e85['id'],'type':_0x32e075[_0xde14('0x3d')],'sectionId':_0x32e075['id']},{})[_0xde14('0x1f')](function(){return _0x25ba7e;});}else{return _0x25ba7e;}})[_0xde14('0x2a')](function(_0x120284){logger[_0xde14('0x26')](_0xde14('0x63'),_0x120284);throw _0x120284;});}return _0x25ba7e;});}})[_0xde14('0x1f')](respondWithResult(_0x2c972b,0xc9))[_0xde14('0x2a')](handleError(_0x2c972b,null));};exports[_0xde14('0x5d')]=function(_0x299b69,_0x1ff577,_0x42329a){var _0x6a641f;return db[_0xde14('0x3f')][_0xde14('0x5d')](_0x299b69[_0xde14('0x5e')],{'raw':!![]})[_0xde14('0x1f')](function(_0x1b5d70){_0x6a641f=_0x1b5d70;return db[_0xde14('0x3f')][_0xde14('0x54')]({'raw':!![]});})[_0xde14('0x1f')](function(_0x4809fa){var _0x1084fb=fs['readFileSync'](path[_0xde14('0x64')](config['root'],_0xde14('0x65')),_0xde14('0x66'));var _0x3aaba2=fs['readFileSync'](path['join'](config[_0xde14('0x67')],_0xde14('0x68')),_0xde14('0x66'));var _0x430bdb=ejs['render'](_0x1084fb,{'trunks':_0x4809fa||[]});fs[_0xde14('0x69')](_0xde14('0x6a'),_0x430bdb);if(_0x6a641f[_0xde14('0x6b')]){var _0x500344=ejs['render'](_0x3aaba2,{'trunks':_0x4809fa||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x500344);}})[_0xde14('0x1f')](function(){return respondWithRpcPromise(_0xde14('0x6c'),_0xde14('0x5d'),{'module':'chan_sip.so'});})[_0xde14('0x1f')](function(){var _0x37f7c3=_0x299b69[_0xde14('0x5f')][_0xde14('0x38')]({'plain':!![]});if(!_0x37f7c3)throw new Error(_0xde14('0x60'));if(_0x37f7c3[_0xde14('0x61')]==='user'){var _0x579a6c=_0x6a641f[_0xde14('0x38')]({'plain':!![]});return db[_0xde14('0x6d')]['find']({'where':{'name':_0xde14('0x39'),'userProfileId':_0x37f7c3[_0xde14('0x62')]},'raw':!![]})[_0xde14('0x1f')](function(_0x367ede){if(_0x367ede&&_0x367ede[_0xde14('0x6e')]===0x0){return db[_0xde14('0x3a')][_0xde14('0x5d')]({'name':_0x579a6c['name'],'resourceId':_0x579a6c['id'],'type':_0x367ede['name'],'sectionId':_0x367ede['id']},{})['then'](function(){return _0x6a641f;});}else{return _0x6a641f;}})['catch'](function(_0x3dbda9){logger[_0xde14('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3dbda9);throw _0x3dbda9;});}return _0x6a641f;})['then'](respondWithResult(_0x1ff577,0xc9))[_0xde14('0x2a')](handleError(_0x1ff577,null));};exports[_0xde14('0x37')]=function(_0xe2b9f5,_0x5805ec,_0x1aa75d){var _0x2b1e2e;return db['Trunk'][_0xde14('0x59')]({'where':{'id':_0xe2b9f5[_0xde14('0x56')]['id']}})[_0xde14('0x1f')](handleEntityNotFound(_0x5805ec,null))[_0xde14('0x1f')](saveUpdates(_0xe2b9f5['body'],null))[_0xde14('0x1f')](function(_0x5a5b25){if(_0x5a5b25){_0x2b1e2e=_0x5a5b25;return db[_0xde14('0x3f')][_0xde14('0x54')]({'raw':!![]});}})[_0xde14('0x1f')](function(_0x5f49d1){if(_0x5f49d1){var _0x283eb8=fs[_0xde14('0x6f')](path[_0xde14('0x64')](config[_0xde14('0x67')],_0xde14('0x65')),'utf8');var _0x53433d=fs[_0xde14('0x6f')](path[_0xde14('0x64')](config[_0xde14('0x67')],'server/files/templates/registry.ejs'),_0xde14('0x66'));var _0x1a12b5=ejs[_0xde14('0x70')](_0x283eb8,{'trunks':_0x5f49d1||[]});fs[_0xde14('0x69')](_0xde14('0x6a'),_0x1a12b5);var _0x2cc5b7=ejs[_0xde14('0x70')](_0x53433d,{'trunks':_0x5f49d1||[]});fs['writeFileSync'](_0xde14('0x71'),_0x2cc5b7);return respondWithRpcPromise(_0xde14('0x6c'),_0xde14('0x37'),{'module':_0xde14('0x72')});}return null;})[_0xde14('0x1f')](function(_0x1732d0){if(_0x1732d0){return _0x2b1e2e;}})[_0xde14('0x1f')](respondWithResult(_0x5805ec,null))['catch'](handleError(_0x5805ec,null));};exports[_0xde14('0x3b')]=function(_0x1bdeae,_0x5f4b92,_0x4543f1){var _0x4a0108;return db[_0xde14('0x3f')]['find']({'where':{'id':_0x1bdeae[_0xde14('0x56')]['id']}})[_0xde14('0x1f')](handleEntityNotFound(_0x5f4b92,null))[_0xde14('0x1f')](removeEntity(_0x5f4b92,null))[_0xde14('0x1f')](function(){return db[_0xde14('0x3f')][_0xde14('0x54')]({'raw':!![]});})['then'](function(_0x43a155){var _0x58cf06=fs[_0xde14('0x6f')](path['join'](config[_0xde14('0x67')],_0xde14('0x65')),_0xde14('0x66'));var _0x4a1114=fs[_0xde14('0x6f')](path[_0xde14('0x64')](config[_0xde14('0x67')],'server/files/templates/registry.ejs'),'utf8');var _0x495741=ejs['render'](_0x58cf06,{'trunks':_0x43a155});var _0x381d6d=ejs[_0xde14('0x70')](_0x4a1114,{'trunks':_0x43a155});fs['writeFileSync'](_0xde14('0x6a'),_0x495741);fs[_0xde14('0x69')](_0xde14('0x71'),_0x381d6d);return respondWithRpcPromise(_0xde14('0x6c'),_0xde14('0x3b'),{'module':'chan_sip.so'});})[_0xde14('0x2a')](handleError(_0x5f4b92,null));}; \ No newline at end of file +var _0x3e74=['map','Trunk','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','where','type','filter','merge','options','includeAll','include','findAll','params','clone','find','get','omit','createdAt','body','updatedAt','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','root','server/files/templates/trunk.ejs','utf8','readFileSync','server/files/templates/registry.ejs','render','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','writeFileSync','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','Trunk,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','update','destroy','Trunks','UserProfileResource','stack','name','send','index'];(function(_0x5675ad,_0x331c36){var _0x36add6=function(_0x3abf59){while(--_0x3abf59){_0x5675ad['push'](_0x5675ad['shift']());}};_0x36add6(++_0x331c36);}(_0x3e74,0x175));var _0x43e7=function(_0x302571,_0x22f825){_0x302571=_0x302571-0x0;var _0x19ecda=_0x3e74[_0x302571];return _0x19ecda;};'use strict';var emlformat=require(_0x43e7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x43e7('0x1'));var jsonpatch=require(_0x43e7('0x2'));var rp=require(_0x43e7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x43e7('0x4'));var util=require('util');var path=require(_0x43e7('0x5'));var sox=require(_0x43e7('0x6'));var csv=require(_0x43e7('0x7'));var ejs=require(_0x43e7('0x8'));var fs=require('fs');var fs_extra=require(_0x43e7('0x9'));var _=require('lodash');var squel=require(_0x43e7('0xa'));var crypto=require(_0x43e7('0xb'));var jsforce=require(_0x43e7('0xc'));var deskjs=require(_0x43e7('0xd'));var toCsv=require(_0x43e7('0x7'));var querystring=require('querystring');var Papa=require(_0x43e7('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43e7('0xf'));var as=require(_0x43e7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x43e7('0x11'))('api');var utils=require(_0x43e7('0x12'));var config=require(_0x43e7('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x43e7('0x14'))['db'];var jayson=require(_0x43e7('0x15'));var client=jayson[_0x43e7('0x16')][_0x43e7('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x4e008c,_0x583d85,_0x2fcb36,_0x21fdd3){return new BPromise(function(_0x44b0bd,_0x51b974){var _0x5e641c=_0x21fdd3||client;return _0x5e641c[_0x43e7('0x18')](_0x4e008c,_0x2fcb36)[_0x43e7('0x19')](function(_0x203378){logger[_0x43e7('0x1a')]('Trunk,\x20%s,\x20%s',_0x583d85,'request\x20sent');logger[_0x43e7('0x1b')](_0x43e7('0x1c'),_0x583d85,_0x43e7('0x1d'),JSON['stringify'](_0x203378));if(_0x203378['error']){if(_0x203378[_0x43e7('0x1e')][_0x43e7('0x1f')]===0x1f4){logger[_0x43e7('0x1e')](_0x43e7('0x20'),_0x583d85,_0x203378[_0x43e7('0x1e')][_0x43e7('0x21')]);return _0x51b974(_0x203378[_0x43e7('0x1e')][_0x43e7('0x21')]);}logger[_0x43e7('0x1e')](_0x43e7('0x20'),_0x583d85,_0x203378[_0x43e7('0x1e')][_0x43e7('0x21')]);return _0x44b0bd(_0x203378['error'][_0x43e7('0x21')]);}else{logger[_0x43e7('0x1a')]('Trunk,\x20%s,\x20%s',_0x583d85,_0x43e7('0x1d'));_0x44b0bd(_0x203378[_0x43e7('0x22')][_0x43e7('0x21')]);}})[_0x43e7('0x23')](function(_0x4077fb){logger[_0x43e7('0x1e')]('Trunk,\x20%s,\x20%s',_0x583d85,_0x4077fb);_0x51b974(_0x4077fb);});});}function respondWithStatusCode(_0x454359,_0x4eea52){_0x4eea52=_0x4eea52||0xcc;return function(_0x4c9df3){if(_0x4c9df3){return _0x454359[_0x43e7('0x24')](_0x4eea52);}return _0x454359[_0x43e7('0x25')](_0x4eea52)['end']();};}function respondWithResult(_0x1f0673,_0x4ca5cf){_0x4ca5cf=_0x4ca5cf||0xc8;return function(_0x326dab){if(_0x326dab){return _0x1f0673['status'](_0x4ca5cf)[_0x43e7('0x26')](_0x326dab);}};}function respondWithFilteredResult(_0x1b5f50,_0x20888b){return function(_0x405f85){if(_0x405f85){var _0x51f4d7=typeof _0x20888b['offset']===_0x43e7('0x27')&&typeof _0x20888b['limit']===_0x43e7('0x27');var _0x40dc8f=_0x405f85[_0x43e7('0x28')];var _0xb1fc63=_0x51f4d7?0x0:_0x20888b['offset'];var _0x33a1a5=_0x51f4d7?_0x405f85[_0x43e7('0x28')]:_0x20888b[_0x43e7('0x29')]+_0x20888b[_0x43e7('0x2a')];var _0x442c3b;if(_0x33a1a5>=_0x40dc8f){_0x33a1a5=_0x40dc8f;_0x442c3b=0xc8;}else{_0x442c3b=0xce;}_0x1b5f50[_0x43e7('0x25')](_0x442c3b);return _0x1b5f50[_0x43e7('0x2b')](_0x43e7('0x2c'),_0xb1fc63+'-'+_0x33a1a5+'/'+_0x40dc8f)[_0x43e7('0x26')](_0x405f85);}return null;};}function patchUpdates(_0x35dbcd){return function(_0x17df44){try{jsonpatch[_0x43e7('0x2d')](_0x17df44,_0x35dbcd,!![]);}catch(_0x2bde44){return BPromise[_0x43e7('0x2e')](_0x2bde44);}return _0x17df44['save']();};}function saveUpdates(_0x238321,_0x44f6b0){return function(_0x3b8f78){if(_0x3b8f78){return _0x3b8f78[_0x43e7('0x2f')](_0x238321)[_0x43e7('0x19')](function(_0x4c8650){return _0x4c8650;});}return null;};}function removeEntity(_0x1eba65,_0x49b83d){return function(_0x30d47e){if(_0x30d47e){return _0x30d47e[_0x43e7('0x30')]()['then'](function(){var _0x5a7342=_0x30d47e['get']({'plain':!![]});var _0xf8320=_0x43e7('0x31');return db[_0x43e7('0x32')][_0x43e7('0x30')]({'where':{'type':_0xf8320,'resourceId':_0x5a7342['id']}})[_0x43e7('0x19')](function(){return _0x30d47e;});})[_0x43e7('0x19')](function(){_0x1eba65['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ac23d,_0x59e5b2){return function(_0x4e8e86){if(!_0x4e8e86){_0x4ac23d['sendStatus'](0x194);}return _0x4e8e86;};}function handleError(_0x5cb753,_0x14d888){_0x14d888=_0x14d888||0x1f4;return function(_0x49cda6){logger[_0x43e7('0x1e')](_0x49cda6[_0x43e7('0x33')]);if(_0x49cda6[_0x43e7('0x34')]){delete _0x49cda6[_0x43e7('0x34')];}_0x5cb753[_0x43e7('0x25')](_0x14d888)[_0x43e7('0x35')](_0x49cda6);};}exports[_0x43e7('0x36')]=function(_0x4f1a5f,_0x5332d9){var _0x5d84f4={},_0xfa0474={},_0xfe70e9={'count':0x0,'rows':[]};var _0x199ff6=_[_0x43e7('0x37')](db[_0x43e7('0x38')][_0x43e7('0x39')],function(_0x1d4589){return{'name':_0x1d4589[_0x43e7('0x3a')],'type':_0x1d4589['type'][_0x43e7('0x3b')]};});_0xfa0474[_0x43e7('0x3c')]=_['map'](_0x199ff6,_0x43e7('0x34'));_0xfa0474['query']=_[_0x43e7('0x3d')](_0x4f1a5f[_0x43e7('0x3e')]);_0xfa0474[_0x43e7('0x3f')]=_[_0x43e7('0x40')](_0xfa0474[_0x43e7('0x3c')],_0xfa0474[_0x43e7('0x3e')]);_0x5d84f4['attributes']=_['intersection'](_0xfa0474[_0x43e7('0x3c')],qs[_0x43e7('0x41')](_0x4f1a5f[_0x43e7('0x3e')][_0x43e7('0x41')]));_0x5d84f4[_0x43e7('0x42')]=_0x5d84f4['attributes'][_0x43e7('0x43')]?_0x5d84f4[_0x43e7('0x42')]:_0xfa0474['model'];if(!_0x4f1a5f[_0x43e7('0x3e')]['hasOwnProperty'](_0x43e7('0x44'))){_0x5d84f4['limit']=qs[_0x43e7('0x2a')](_0x4f1a5f[_0x43e7('0x3e')][_0x43e7('0x2a')]);_0x5d84f4[_0x43e7('0x29')]=qs['offset'](_0x4f1a5f['query'][_0x43e7('0x29')]);}_0x5d84f4[_0x43e7('0x45')]=qs[_0x43e7('0x46')](_0x4f1a5f[_0x43e7('0x3e')]['sort']);_0x5d84f4['where']=qs['filters'](_[_0x43e7('0x47')](_0x4f1a5f['query'],_0xfa0474[_0x43e7('0x3f')]),_0x199ff6);if(_0x4f1a5f['query']['filter']){_0x5d84f4[_0x43e7('0x48')]=_['merge'](_0x5d84f4[_0x43e7('0x48')],{'$or':_[_0x43e7('0x37')](_0x199ff6,function(_0x257bd8){if(_0x257bd8[_0x43e7('0x49')]!=='VIRTUAL'){var _0x91f1e4={};_0x91f1e4[_0x257bd8[_0x43e7('0x34')]]={'$like':'%'+_0x4f1a5f[_0x43e7('0x3e')][_0x43e7('0x4a')]+'%'};return _0x91f1e4;}})});}_0x5d84f4=_[_0x43e7('0x4b')]({},_0x5d84f4,_0x4f1a5f[_0x43e7('0x4c')]);var _0x51eef4={'where':_0x5d84f4['where']};return db[_0x43e7('0x38')][_0x43e7('0x28')](_0x51eef4)[_0x43e7('0x19')](function(_0x4c00a8){_0xfe70e9['count']=_0x4c00a8;if(_0x4f1a5f['query'][_0x43e7('0x4d')]){_0x5d84f4[_0x43e7('0x4e')]=[{'all':!![]}];}return db['Trunk'][_0x43e7('0x4f')](_0x5d84f4);})[_0x43e7('0x19')](function(_0x3c96fe){_0xfe70e9['rows']=_0x3c96fe;return _0xfe70e9;})['then'](respondWithFilteredResult(_0x5332d9,_0x5d84f4))['catch'](handleError(_0x5332d9,null));};exports['show']=function(_0x214e7e,_0xe955fc){var _0x52fea5={'raw':![],'where':{'id':_0x214e7e[_0x43e7('0x50')]['id']}},_0x23e7cb={};_0x23e7cb[_0x43e7('0x3c')]=_[_0x43e7('0x3d')](db['Trunk'][_0x43e7('0x39')]);_0x23e7cb['query']=_['keys'](_0x214e7e[_0x43e7('0x3e')]);_0x23e7cb[_0x43e7('0x3f')]=_[_0x43e7('0x40')](_0x23e7cb[_0x43e7('0x3c')],_0x23e7cb[_0x43e7('0x3e')]);_0x52fea5[_0x43e7('0x42')]=_[_0x43e7('0x40')](_0x23e7cb[_0x43e7('0x3c')],qs[_0x43e7('0x41')](_0x214e7e[_0x43e7('0x3e')]['fields']));_0x52fea5[_0x43e7('0x42')]=_0x52fea5[_0x43e7('0x42')]['length']?_0x52fea5[_0x43e7('0x42')]:_0x23e7cb['model'];if(_0x214e7e[_0x43e7('0x3e')][_0x43e7('0x4d')]){_0x52fea5[_0x43e7('0x4e')]=[{'all':!![]}];}_0x52fea5=_[_0x43e7('0x4b')]({},_0x52fea5,_0x214e7e[_0x43e7('0x4c')]);return db['Trunk']['find'](_0x52fea5)[_0x43e7('0x19')](handleEntityNotFound(_0xe955fc,null))[_0x43e7('0x19')](respondWithResult(_0xe955fc,null))[_0x43e7('0x23')](handleError(_0xe955fc,null));};exports[_0x43e7('0x51')]=function(_0x23d835,_0x25bb44){var _0xa47464={'where':{'id':_0x23d835[_0x43e7('0x50')]['id']}},_0x44f8a0={};_0x44f8a0[_0x43e7('0x3c')]=_[_0x43e7('0x3d')](db['Trunk'][_0x43e7('0x39')]);_0xa47464[_0x43e7('0x42')]=_['intersection'](_0x44f8a0[_0x43e7('0x3c')],qs[_0x43e7('0x41')](_0x23d835[_0x43e7('0x3e')]['fields']));_0xa47464['attributes']=_0xa47464[_0x43e7('0x42')][_0x43e7('0x43')]?_0xa47464['attributes']:_0x44f8a0[_0x43e7('0x3c')];if(_0x23d835['query']['includeAll']){_0xa47464[_0x43e7('0x4e')]=[{'all':!![]}];}_0xa47464=_[_0x43e7('0x4b')]({},_0xa47464,_0x23d835[_0x43e7('0x4c')]);return db[_0x43e7('0x38')][_0x43e7('0x52')](_0xa47464)['then'](handleEntityNotFound(_0x25bb44,null))[_0x43e7('0x19')](function(_0xdb9fbe){if(_0xdb9fbe){var _0x4d89bd=_0xdb9fbe[_0x43e7('0x53')]({'plain':!![]});_0x4d89bd=qs[_0x43e7('0x54')](_0x4d89bd,['id',_0x43e7('0x55'),'updatedAt']);_0x23d835['body']=_['omit'](_0x23d835[_0x43e7('0x56')],['id',_0x43e7('0x55'),_0x43e7('0x57')]);return db[_0x43e7('0x38')]['create'](_['merge'](_0x4d89bd,_0x23d835[_0x43e7('0x56')]),{'include':_0x23d835[_0x43e7('0x3e')][_0x43e7('0x4d')]?[{'all':!![]}]:undefined})[_0x43e7('0x19')](function(_0x5ea0db){var _0x4438c0=_0x23d835[_0x43e7('0x58')][_0x43e7('0x53')]({'plain':!![]});if(!_0x4438c0)throw new Error(_0x43e7('0x59'));if(_0x4438c0[_0x43e7('0x5a')]===_0x43e7('0x58')){var _0x4665db=_0x5ea0db[_0x43e7('0x53')]({'plain':!![]});var _0x406155=_0x43e7('0x31');return db[_0x43e7('0x5b')]['find']({'where':{'name':_0x406155,'userProfileId':_0x4438c0['userProfileId']},'raw':!![]})[_0x43e7('0x19')](function(_0x58a3a8){if(_0x58a3a8&&_0x58a3a8['autoAssociation']===0x0){return db['UserProfileResource'][_0x43e7('0x5c')]({'name':_0x4665db[_0x43e7('0x34')],'resourceId':_0x4665db['id'],'type':_0x58a3a8['name'],'sectionId':_0x58a3a8['id']},{})[_0x43e7('0x19')](function(){return _0x5ea0db;});}else{return _0x5ea0db;}})[_0x43e7('0x23')](function(_0x1d8438){logger['error'](_0x43e7('0x5d'),_0x1d8438);throw _0x1d8438;});}return _0x5ea0db;});}})[_0x43e7('0x19')](respondWithResult(_0x25bb44,0xc9))[_0x43e7('0x23')](handleError(_0x25bb44,null));};exports[_0x43e7('0x5c')]=function(_0x2f43d7,_0x472a19,_0x1e02fa){var _0x515f01;return db[_0x43e7('0x38')][_0x43e7('0x5c')](_0x2f43d7[_0x43e7('0x56')],{'raw':!![]})['then'](function(_0x56b06d){_0x515f01=_0x56b06d;return db[_0x43e7('0x38')]['findAll']({'raw':!![]});})['then'](function(_0x1b793d){var _0x154e47=fs['readFileSync'](path[_0x43e7('0x5e')](config[_0x43e7('0x5f')],_0x43e7('0x60')),_0x43e7('0x61'));var _0x16499c=fs[_0x43e7('0x62')](path[_0x43e7('0x5e')](config['root'],_0x43e7('0x63')),_0x43e7('0x61'));var _0x4e5956=ejs[_0x43e7('0x64')](_0x154e47,{'trunks':_0x1b793d||[]});fs['writeFileSync'](_0x43e7('0x65'),_0x4e5956);if(_0x515f01[_0x43e7('0x66')]){var _0x37301b=ejs[_0x43e7('0x64')](_0x16499c,{'trunks':_0x1b793d||[]});fs['writeFileSync'](_0x43e7('0x67'),_0x37301b);}})[_0x43e7('0x19')](function(){return respondWithRpcPromise(_0x43e7('0x68'),'create',{'module':_0x43e7('0x69')});})[_0x43e7('0x19')](function(){var _0x219dc6=_0x2f43d7[_0x43e7('0x58')][_0x43e7('0x53')]({'plain':!![]});if(!_0x219dc6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x219dc6[_0x43e7('0x5a')]===_0x43e7('0x58')){var _0x35d133=_0x515f01[_0x43e7('0x53')]({'plain':!![]});return db[_0x43e7('0x5b')][_0x43e7('0x52')]({'where':{'name':_0x43e7('0x31'),'userProfileId':_0x219dc6['userProfileId']},'raw':!![]})['then'](function(_0x405faa){if(_0x405faa&&_0x405faa['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x35d133[_0x43e7('0x34')],'resourceId':_0x35d133['id'],'type':_0x405faa[_0x43e7('0x34')],'sectionId':_0x405faa['id']},{})[_0x43e7('0x19')](function(){return _0x515f01;});}else{return _0x515f01;}})[_0x43e7('0x23')](function(_0x18713b){logger[_0x43e7('0x1e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x18713b);throw _0x18713b;});}return _0x515f01;})[_0x43e7('0x19')](respondWithResult(_0x472a19,0xc9))[_0x43e7('0x23')](handleError(_0x472a19,null));};exports[_0x43e7('0x2f')]=function(_0x5b4c76,_0x2abca0,_0xea84ec){var _0x184ae3;return db[_0x43e7('0x38')][_0x43e7('0x52')]({'where':{'id':_0x5b4c76[_0x43e7('0x50')]['id']}})[_0x43e7('0x19')](handleEntityNotFound(_0x2abca0,null))[_0x43e7('0x19')](saveUpdates(_0x5b4c76['body'],null))['then'](function(_0x55990c){if(_0x55990c){_0x184ae3=_0x55990c;return db[_0x43e7('0x38')][_0x43e7('0x4f')]({'raw':!![]});}})['then'](function(_0x3fe23f){if(_0x3fe23f){var _0x39a787=fs[_0x43e7('0x62')](path[_0x43e7('0x5e')](config['root'],'server/files/templates/trunk.ejs'),'utf8');var _0x177a7a=fs[_0x43e7('0x62')](path['join'](config['root'],_0x43e7('0x63')),_0x43e7('0x61'));var _0x3b7e5b=ejs['render'](_0x39a787,{'trunks':_0x3fe23f||[]});fs[_0x43e7('0x6a')](_0x43e7('0x65'),_0x3b7e5b);var _0x401654=ejs[_0x43e7('0x64')](_0x177a7a,{'trunks':_0x3fe23f||[]});fs['writeFileSync'](_0x43e7('0x67'),_0x401654);return respondWithRpcPromise('Reload',_0x43e7('0x2f'),{'module':_0x43e7('0x69')});}return null;})[_0x43e7('0x19')](function(_0x90667c){if(_0x90667c){return _0x184ae3;}})[_0x43e7('0x19')](respondWithResult(_0x2abca0,null))[_0x43e7('0x23')](handleError(_0x2abca0,null));};exports[_0x43e7('0x30')]=function(_0x5e8d4e,_0x109c86,_0x40257e){var _0x1aea4e;return db[_0x43e7('0x38')]['find']({'where':{'id':_0x5e8d4e['params']['id']}})['then'](handleEntityNotFound(_0x109c86,null))[_0x43e7('0x19')](removeEntity(_0x109c86,null))['then'](function(){return db[_0x43e7('0x38')][_0x43e7('0x4f')]({'raw':!![]});})[_0x43e7('0x19')](function(_0x7387f6){var _0xa75254=fs[_0x43e7('0x62')](path[_0x43e7('0x5e')](config[_0x43e7('0x5f')],_0x43e7('0x60')),_0x43e7('0x61'));var _0x3de22e=fs['readFileSync'](path[_0x43e7('0x5e')](config[_0x43e7('0x5f')],_0x43e7('0x63')),_0x43e7('0x61'));var _0x206e54=ejs['render'](_0xa75254,{'trunks':_0x7387f6});var _0x5e04ec=ejs[_0x43e7('0x64')](_0x3de22e,{'trunks':_0x7387f6});fs[_0x43e7('0x6a')]('/etc/asterisk/sip_xcally_trunks.conf',_0x206e54);fs[_0x43e7('0x6a')](_0x43e7('0x67'),_0x5e04ec);return respondWithRpcPromise('Reload','destroy',{'module':_0x43e7('0x69')});})[_0x43e7('0x23')](handleError(_0x109c86,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 2ceff11..2476a9d 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 _0xfebc=['moment','request-promise','../../config/environment','./trunk.attributes','exports','define','tools_trunks','lodash','util','../../config/logger','api'];(function(_0x5a73f2,_0x1667ae){var _0x3765be=function(_0x50286e){while(--_0x50286e){_0x5a73f2['push'](_0x5a73f2['shift']());}};_0x3765be(++_0x1667ae);}(_0xfebc,0x1ca));var _0xcfeb=function(_0xd1ce83,_0x4199ec){_0xd1ce83=_0xd1ce83-0x0;var _0x51aabb=_0xfebc[_0xd1ce83];return _0x51aabb;};'use strict';var _=require(_0xcfeb('0x0'));var util=require(_0xcfeb('0x1'));var logger=require(_0xcfeb('0x2'))(_0xcfeb('0x3'));var moment=require(_0xcfeb('0x4'));var BPromise=require('bluebird');var rp=require(_0xcfeb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xcfeb('0x6'));var attributes=require(_0xcfeb('0x7'));module[_0xcfeb('0x8')]=function(_0x5058c7,_0x519112){return _0x5058c7[_0xcfeb('0x9')]('Trunk',attributes,{'tableName':_0xcfeb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8db7=['lodash','moment','bluebird','path','rimraf','../../config/environment','./trunk.attributes','exports','define','Trunk'];(function(_0x35aeb5,_0x4e8855){var _0x18fcec=function(_0x2f81a5){while(--_0x2f81a5){_0x35aeb5['push'](_0x35aeb5['shift']());}};_0x18fcec(++_0x4e8855);}(_0x8db7,0x14a));var _0x78db=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0x8db7[_0x40220a];return _0x3903cc;};'use strict';var _=require(_0x78db('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x78db('0x1'));var BPromise=require(_0x78db('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x78db('0x3'));var rimraf=require(_0x78db('0x4'));var config=require(_0x78db('0x5'));var attributes=require(_0x78db('0x6'));module[_0x78db('0x7')]=function(_0xb09f4e,_0x22dffb){return _0xb09f4e[_0x78db('0x8')](_0x78db('0x9'),attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index d02f76a..f5d44a5 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 _0x29d3=['model','ShowTrunk','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Trunk,\x20%s,\x20%s','result','catch','Trunk','options','raw','where','attributes','include','map'];(function(_0x50008d,_0x7634dc){var _0x11c0cd=function(_0x12e522){while(--_0x12e522){_0x50008d['push'](_0x50008d['shift']());}};_0x11c0cd(++_0x7634dc);}(_0x29d3,0xf8));var _0x329d=function(_0x43dce4,_0x4f0f0a){_0x43dce4=_0x43dce4-0x0;var _0x3241d8=_0x29d3[_0x43dce4];return _0x3241d8;};'use strict';var _=require(_0x329d('0x0'));var util=require(_0x329d('0x1'));var moment=require(_0x329d('0x2'));var BPromise=require(_0x329d('0x3'));var rs=require(_0x329d('0x4'));var fs=require('fs');var Redis=require(_0x329d('0x5'));var db=require(_0x329d('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x329d('0x7'))(_0x329d('0x8'));var config=require(_0x329d('0x9'));var jayson=require(_0x329d('0xa'));var client=jayson['client'][_0x329d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x38f508,_0x35ffef,_0xbd8d4c){return new BPromise(function(_0x2d8e4a,_0x17e79f){return client[_0x329d('0xc')](_0x38f508,_0xbd8d4c)[_0x329d('0xd')](function(_0x534883){logger[_0x329d('0xe')]('Trunk,\x20%s,\x20%s',_0x35ffef,_0x329d('0xf'));logger[_0x329d('0x10')](_0x329d('0x11'),_0x35ffef,'request\x20sent',JSON[_0x329d('0x12')](_0x534883));if(_0x534883['error']){if(_0x534883[_0x329d('0x13')][_0x329d('0x14')]===0x1f4){logger[_0x329d('0x13')]('Trunk,\x20%s,\x20%s',_0x35ffef,_0x534883['error'][_0x329d('0x15')]);return _0x17e79f(_0x534883[_0x329d('0x13')][_0x329d('0x15')]);}logger[_0x329d('0x13')](_0x329d('0x16'),_0x35ffef,_0x534883[_0x329d('0x13')][_0x329d('0x15')]);return _0x2d8e4a(_0x534883[_0x329d('0x13')][_0x329d('0x15')]);}else{logger[_0x329d('0xe')]('Trunk,\x20%s,\x20%s',_0x35ffef,_0x329d('0xf'));_0x2d8e4a(_0x534883[_0x329d('0x17')][_0x329d('0x15')]);}})[_0x329d('0x18')](function(_0x3feeca){logger['error'](_0x329d('0x16'),_0x35ffef,_0x3feeca);_0x17e79f(_0x3feeca);});});}exports['GetTrunk']=function(_0x28a5a8){var _0x551170=this;return new Promise(function(_0x3c3368,_0xe37f8){return db[_0x329d('0x19')]['findAll']({'raw':_0x28a5a8[_0x329d('0x1a')]?_0x28a5a8[_0x329d('0x1a')][_0x329d('0x1b')]===undefined?!![]:![]:!![],'where':_0x28a5a8[_0x329d('0x1a')]?_0x28a5a8[_0x329d('0x1a')][_0x329d('0x1c')]||null:null,'attributes':_0x28a5a8[_0x329d('0x1a')]?_0x28a5a8[_0x329d('0x1a')][_0x329d('0x1d')]||null:null,'limit':_0x28a5a8[_0x329d('0x1a')]?_0x28a5a8[_0x329d('0x1a')]['limit']||null:null,'include':_0x28a5a8[_0x329d('0x1a')]?_0x28a5a8[_0x329d('0x1a')][_0x329d('0x1e')]?_[_0x329d('0x1f')](_0x28a5a8[_0x329d('0x1a')][_0x329d('0x1e')],function(_0x301dbc){return{'model':db[_0x301dbc[_0x329d('0x20')]],'as':_0x301dbc['as'],'attributes':_0x301dbc[_0x329d('0x1d')],'include':_0x301dbc['include']?_['map'](_0x301dbc[_0x329d('0x1e')],function(_0x564a96){return{'model':db[_0x564a96['model']],'as':_0x564a96['as'],'attributes':_0x564a96[_0x329d('0x1d')],'include':_0x564a96[_0x329d('0x1e')]?_[_0x329d('0x1f')](_0x564a96['include'],function(_0x1e4c99){return{'model':db[_0x1e4c99[_0x329d('0x20')]],'as':_0x1e4c99['as'],'attributes':_0x1e4c99[_0x329d('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x329d('0xd')](function(_0x3a65f2){logger[_0x329d('0xe')]('GetTrunk',_0x28a5a8);logger[_0x329d('0x10')]('GetTrunk',_0x28a5a8,JSON[_0x329d('0x12')](_0x3a65f2));_0x3c3368(_0x3a65f2);})[_0x329d('0x18')](function(_0x4a12c8){logger[_0x329d('0x13')]('GetTrunk',_0x4a12c8[_0x329d('0x15')],_0x28a5a8);_0xe37f8(_0x551170[_0x329d('0x13')](0x1f4,_0x4a12c8['message']));});});};exports[_0x329d('0x21')]=function(_0x30782c){var _0x1bf985=this;return new Promise(function(_0x4154d7,_0x2211ae){return db[_0x329d('0x19')][_0x329d('0x22')]({'raw':_0x30782c['options']?_0x30782c[_0x329d('0x1a')][_0x329d('0x1b')]===undefined?!![]:![]:!![],'where':_0x30782c[_0x329d('0x1a')]?_0x30782c[_0x329d('0x1a')]['where']||null:null,'attributes':_0x30782c[_0x329d('0x1a')]?_0x30782c[_0x329d('0x1a')]['attributes']||null:null,'include':_0x30782c[_0x329d('0x1a')]?_0x30782c['options'][_0x329d('0x1e')]?_[_0x329d('0x1f')](_0x30782c[_0x329d('0x1a')][_0x329d('0x1e')],function(_0x13e2af){return{'model':db[_0x13e2af[_0x329d('0x20')]],'as':_0x13e2af['as'],'attributes':_0x13e2af[_0x329d('0x1d')],'include':_0x13e2af[_0x329d('0x1e')]?_['map'](_0x13e2af[_0x329d('0x1e')],function(_0x4b0327){return{'model':db[_0x4b0327['model']],'as':_0x4b0327['as'],'attributes':_0x4b0327['attributes'],'include':_0x4b0327[_0x329d('0x1e')]?_['map'](_0x4b0327[_0x329d('0x1e')],function(_0x5af402){return{'model':db[_0x5af402['model']],'as':_0x5af402['as'],'attributes':_0x5af402[_0x329d('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3db766){logger[_0x329d('0xe')](_0x329d('0x21'),_0x30782c);logger[_0x329d('0x10')]('ShowTrunk',_0x30782c,JSON[_0x329d('0x12')](_0x3db766));_0x4154d7(_0x3db766);})[_0x329d('0x18')](function(_0x241a38){logger['error'](_0x329d('0x21'),_0x241a38[_0x329d('0x15')],_0x30782c);_0x2211ae(_0x1bf985[_0x329d('0x13')](0x1f4,_0x241a38[_0x329d('0x15')]));});});}; \ No newline at end of file +var _0x95d3=['ShowTrunk','catch','lodash','util','ioredis','../../mysqldb','rpc','jayson/promise','client','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','GetTrunk','Trunk','findAll','raw','options','where','attributes','limit','include','map','model'];(function(_0x47c581,_0x243ec0){var _0x3022a4=function(_0x3098a3){while(--_0x3098a3){_0x47c581['push'](_0x47c581['shift']());}};_0x3022a4(++_0x243ec0);}(_0x95d3,0x138));var _0x395d=function(_0x96c15f,_0x538403){_0x96c15f=_0x96c15f-0x0;var _0x202a78=_0x95d3[_0x96c15f];return _0x202a78;};'use strict';var _=require(_0x395d('0x0'));var util=require(_0x395d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x395d('0x2'));var db=require(_0x395d('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x395d('0x4'));var config=require('../../config/environment');var jayson=require(_0x395d('0x5'));var client=jayson[_0x395d('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x48aa96,_0x146009,_0x41e079){return new BPromise(function(_0x2cdc12,_0x4d9a1d){return client[_0x395d('0x7')](_0x48aa96,_0x41e079)[_0x395d('0x8')](function(_0xd16dca){logger[_0x395d('0x9')](_0x395d('0xa'),_0x146009,_0x395d('0xb'));logger[_0x395d('0xc')]('Trunk,\x20%s,\x20%s,\x20%s',_0x146009,'request\x20sent',JSON[_0x395d('0xd')](_0xd16dca));if(_0xd16dca[_0x395d('0xe')]){if(_0xd16dca[_0x395d('0xe')][_0x395d('0xf')]===0x1f4){logger[_0x395d('0xe')](_0x395d('0xa'),_0x146009,_0xd16dca[_0x395d('0xe')][_0x395d('0x10')]);return _0x4d9a1d(_0xd16dca[_0x395d('0xe')][_0x395d('0x10')]);}logger[_0x395d('0xe')](_0x395d('0xa'),_0x146009,_0xd16dca[_0x395d('0xe')]['message']);return _0x2cdc12(_0xd16dca['error'][_0x395d('0x10')]);}else{logger[_0x395d('0x9')](_0x395d('0xa'),_0x146009,_0x395d('0xb'));_0x2cdc12(_0xd16dca[_0x395d('0x11')][_0x395d('0x10')]);}})['catch'](function(_0x27fc7f){logger[_0x395d('0xe')]('Trunk,\x20%s,\x20%s',_0x146009,_0x27fc7f);_0x4d9a1d(_0x27fc7f);});});}exports[_0x395d('0x12')]=function(_0x291d0e){var _0x15d021=this;return new Promise(function(_0x9466f5,_0x134155){return db[_0x395d('0x13')][_0x395d('0x14')]({'raw':_0x291d0e['options']?_0x291d0e['options'][_0x395d('0x15')]===undefined?!![]:![]:!![],'where':_0x291d0e[_0x395d('0x16')]?_0x291d0e[_0x395d('0x16')][_0x395d('0x17')]||null:null,'attributes':_0x291d0e[_0x395d('0x16')]?_0x291d0e['options'][_0x395d('0x18')]||null:null,'limit':_0x291d0e[_0x395d('0x16')]?_0x291d0e[_0x395d('0x16')][_0x395d('0x19')]||null:null,'include':_0x291d0e[_0x395d('0x16')]?_0x291d0e['options'][_0x395d('0x1a')]?_[_0x395d('0x1b')](_0x291d0e['options'][_0x395d('0x1a')],function(_0x23003a){return{'model':db[_0x23003a[_0x395d('0x1c')]],'as':_0x23003a['as'],'attributes':_0x23003a[_0x395d('0x18')],'include':_0x23003a[_0x395d('0x1a')]?_[_0x395d('0x1b')](_0x23003a[_0x395d('0x1a')],function(_0x58e68a){return{'model':db[_0x58e68a[_0x395d('0x1c')]],'as':_0x58e68a['as'],'attributes':_0x58e68a['attributes'],'include':_0x58e68a[_0x395d('0x1a')]?_[_0x395d('0x1b')](_0x58e68a[_0x395d('0x1a')],function(_0x559ad3){return{'model':db[_0x559ad3[_0x395d('0x1c')]],'as':_0x559ad3['as'],'attributes':_0x559ad3[_0x395d('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x43c519){logger['info'](_0x395d('0x12'),_0x291d0e);logger[_0x395d('0xc')](_0x395d('0x12'),_0x291d0e,JSON[_0x395d('0xd')](_0x43c519));_0x9466f5(_0x43c519);})['catch'](function(_0x58cc51){logger[_0x395d('0xe')](_0x395d('0x12'),_0x58cc51['message'],_0x291d0e);_0x134155(_0x15d021[_0x395d('0xe')](0x1f4,_0x58cc51['message']));});});};exports['ShowTrunk']=function(_0x2634cd){var _0x52c419=this;return new Promise(function(_0x3a3292,_0x5b618a){return db[_0x395d('0x13')]['find']({'raw':_0x2634cd['options']?_0x2634cd[_0x395d('0x16')][_0x395d('0x15')]===undefined?!![]:![]:!![],'where':_0x2634cd[_0x395d('0x16')]?_0x2634cd[_0x395d('0x16')][_0x395d('0x17')]||null:null,'attributes':_0x2634cd['options']?_0x2634cd[_0x395d('0x16')][_0x395d('0x18')]||null:null,'include':_0x2634cd[_0x395d('0x16')]?_0x2634cd['options'][_0x395d('0x1a')]?_[_0x395d('0x1b')](_0x2634cd[_0x395d('0x16')][_0x395d('0x1a')],function(_0x39c0ce){return{'model':db[_0x39c0ce[_0x395d('0x1c')]],'as':_0x39c0ce['as'],'attributes':_0x39c0ce[_0x395d('0x18')],'include':_0x39c0ce[_0x395d('0x1a')]?_['map'](_0x39c0ce[_0x395d('0x1a')],function(_0x5f3498){return{'model':db[_0x5f3498[_0x395d('0x1c')]],'as':_0x5f3498['as'],'attributes':_0x5f3498['attributes'],'include':_0x5f3498['include']?_[_0x395d('0x1b')](_0x5f3498['include'],function(_0x3f4de1){return{'model':db[_0x3f4de1['model']],'as':_0x3f4de1['as'],'attributes':_0x3f4de1[_0x395d('0x18')]};}):[]};}):[]};}):[]:[]})[_0x395d('0x8')](function(_0x205d02){logger[_0x395d('0x9')]('ShowTrunk',_0x2634cd);logger[_0x395d('0xc')](_0x395d('0x1d'),_0x2634cd,JSON[_0x395d('0xd')](_0x205d02));_0x3a3292(_0x205d02);})[_0x395d('0x1e')](function(_0xe1ae2f){logger['error'](_0x395d('0x1d'),_0xe1ae2f['message'],_0x2634cd);_0x5b618a(_0x52c419[_0x395d('0xe')](0x1f4,_0xe1ae2f['message']));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index 9b03796..40bf92d 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 _0xbd55=['./user-setting.controller','put','/:id','isAuthenticated','update','exports','express','Router','../../components/auth/service'];(function(_0x4f0fb1,_0x52c7a4){var _0x20c933=function(_0x52684c){while(--_0x52684c){_0x4f0fb1['push'](_0x4f0fb1['shift']());}};_0x20c933(++_0x52c7a4);}(_0xbd55,0x153));var _0x5bd5=function(_0x1be1f6,_0x5e7089){_0x1be1f6=_0x1be1f6-0x0;var _0x2bd577=_0xbd55[_0x1be1f6];return _0x2bd577;};'use strict';var express=require(_0x5bd5('0x0'));var router=express[_0x5bd5('0x1')]();var auth=require(_0x5bd5('0x2'));var controller=require(_0x5bd5('0x3'));router[_0x5bd5('0x4')](_0x5bd5('0x5'),auth[_0x5bd5('0x6')](),controller[_0x5bd5('0x7')]);module[_0x5bd5('0x8')]=router; \ No newline at end of file +var _0x953b=['/:id','isAuthenticated','update','express','../../components/auth/service','./user-setting.controller','put'];(function(_0x10cfe5,_0x1a1ef7){var _0x4575f8=function(_0x4bad6e){while(--_0x4bad6e){_0x10cfe5['push'](_0x10cfe5['shift']());}};_0x4575f8(++_0x1a1ef7);}(_0x953b,0x15a));var _0xb953=function(_0x1bebec,_0x4d9599){_0x1bebec=_0x1bebec-0x0;var _0x2cb6a9=_0x953b[_0x1bebec];return _0x2cb6a9;};'use strict';var express=require(_0xb953('0x0'));var router=express['Router']();var auth=require(_0xb953('0x1'));var controller=require(_0xb953('0x2'));router[_0xb953('0x3')](_0xb953('0x4'),auth[_0xb953('0x5')](),controller[_0xb953('0x6')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.attributes.js b/server/api/user-setting/user-setting.attributes.js index f14e05e..6dabe0c 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 _0xb798=['error','warning','info','exports','TEXT','DATE','sequelize'];(function(_0x441c91,_0xb98613){var _0x3289c4=function(_0xe2a88c){while(--_0xe2a88c){_0x441c91['push'](_0x441c91['shift']());}};_0x3289c4(++_0xb98613);}(_0xb798,0x84));var _0x8b79=function(_0x98fcb0,_0x11e7fb){_0x98fcb0=_0x98fcb0-0x0;var _0x272c75=_0xb798[_0x98fcb0];return _0x272c75;};'use strict';var Sequelize=require(_0x8b79('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0x8b79('0x1'),_0x8b79('0x2'),_0x8b79('0x3'),'debug'];module[_0x8b79('0x4')]={'clientSideLoggingLevel':{'type':Sequelize['ENUM'](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x8b79('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x8b79('0x5')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x8b79('0x6')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize['INTEGER'],'unique':'UserId'}}; \ No newline at end of file +var _0x533b=['info','ENUM','BOOLEAN','TEXT','DATE','INTEGER','UserId','sequelize','error','warning'];(function(_0xfdf31,_0x1b04ce){var _0x559e27=function(_0x3ede1d){while(--_0x3ede1d){_0xfdf31['push'](_0xfdf31['shift']());}};_0x559e27(++_0x1b04ce);}(_0x533b,0x183));var _0xb533=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x533b[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xb533('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0xb533('0x1'),_0xb533('0x2'),_0xb533('0x3'),'debug'];module['exports']={'clientSideLoggingLevel':{'type':Sequelize[_0xb533('0x4')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0xb533('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0xb533('0x5')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0xb533('0x6')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xb533('0x7')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xb533('0x8')],'unique':_0xb533('0x9')}}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.controller.js b/server/api/user-setting/user-setting.controller.js index f834064..1a19c19 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 _0x01fe=['register','defaults','localhost','status','then','error','stack','name','send','update','user','role','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','body','catch','lodash','../../config/logger','api','socket.io-emitter','redis','./user-setting.socket'];(function(_0x168ed7,_0x3d460c){var _0x3d75a6=function(_0x1959b2){while(--_0x1959b2){_0x168ed7['push'](_0x168ed7['shift']());}};_0x3d75a6(++_0x3d460c);}(_0x01fe,0x102));var _0xe01f=function(_0xf4f407,_0x3636aa){_0xf4f407=_0xf4f407-0x0;var _0x209c24=_0x01fe[_0xf4f407];return _0x209c24;};'use strict';var _=require(_0xe01f('0x0'));var Redis=require('ioredis');var logger=require(_0xe01f('0x1'))(_0xe01f('0x2'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var socket=require(_0xe01f('0x3'))(new Redis(config[_0xe01f('0x4')]));require(_0xe01f('0x5'))[_0xe01f('0x6')](socket);config['redis']=_[_0xe01f('0x7')](config['redis'],{'host':_0xe01f('0x8'),'port':0x18eb});function respondWithResult(_0x3b754f,_0x45431b){_0x45431b=_0x45431b||0xc8;return function(_0x40376f){if(_0x40376f){return _0x3b754f[_0xe01f('0x9')](_0x45431b)['json'](_0x40376f);}};}function saveUpdates(_0x3cccd7){return function(_0x129e5a){if(_0x129e5a){return _0x129e5a['update'](_0x3cccd7)[_0xe01f('0xa')](function(_0x54334d){return _0x54334d;});}return null;};}function handleEntityNotFound(_0x10759b){return function(_0xe54c05){if(!_0xe54c05){_0x10759b['sendStatus'](0x194);}return _0xe54c05;};}function handleError(_0x2525ae,_0x4f409c){_0x4f409c=_0x4f409c||0x1f4;return function(_0x4caedf){logger[_0xe01f('0xb')](_0x4caedf[_0xe01f('0xc')]);if(_0x4caedf[_0xe01f('0xd')]){delete _0x4caedf[_0xe01f('0xd')];}_0x2525ae[_0xe01f('0x9')](_0x4f409c)[_0xe01f('0xe')](_0x4caedf);};}exports[_0xe01f('0xf')]=function(_0x52c2f0,_0x313bb5){if(_0x52c2f0[_0xe01f('0x10')][_0xe01f('0x11')]!==_0xe01f('0x12'))throw new Error(_0xe01f('0x13'));if(isNaN(Number(_0x52c2f0[_0xe01f('0x14')]['id'])))throw new Error(_0xe01f('0x15'));return db['UserSetting']['find']({'where':{'id':_0x52c2f0['params']['id']}})[_0xe01f('0xa')](handleEntityNotFound(_0x313bb5,null))[_0xe01f('0xa')](saveUpdates(_0x52c2f0[_0xe01f('0x16')],null))[_0xe01f('0xa')](respondWithResult(_0x313bb5,null))[_0xe01f('0x17')](handleError(_0x313bb5,null));}; \ No newline at end of file +var _0x919e=['sendStatus','name','status','role','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','find','catch','lodash','ioredis','../../config/logger','../../config/environment','redis','./user-setting.socket','register','defaults','localhost','json','update','then'];(function(_0x4202ca,_0x1a7d3b){var _0x59af57=function(_0x5f04fe){while(--_0x5f04fe){_0x4202ca['push'](_0x4202ca['shift']());}};_0x59af57(++_0x1a7d3b);}(_0x919e,0x1d7));var _0xe919=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x919e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe919('0x0'));var Redis=require(_0xe919('0x1'));var logger=require(_0xe919('0x2'))('api');var config=require(_0xe919('0x3'));var db=require('../../mysqldb')['db'];var socket=require('socket.io-emitter')(new Redis(config[_0xe919('0x4')]));require(_0xe919('0x5'))[_0xe919('0x6')](socket);config[_0xe919('0x4')]=_[_0xe919('0x7')](config[_0xe919('0x4')],{'host':_0xe919('0x8'),'port':0x18eb});function respondWithResult(_0x493b47,_0x7c1fa4){_0x7c1fa4=_0x7c1fa4||0xc8;return function(_0x2ceb41){if(_0x2ceb41){return _0x493b47['status'](_0x7c1fa4)[_0xe919('0x9')](_0x2ceb41);}};}function saveUpdates(_0x5c4129){return function(_0x1715db){if(_0x1715db){return _0x1715db[_0xe919('0xa')](_0x5c4129)[_0xe919('0xb')](function(_0x58a7a7){return _0x58a7a7;});}return null;};}function handleEntityNotFound(_0x83759d){return function(_0x34e59e){if(!_0x34e59e){_0x83759d[_0xe919('0xc')](0x194);}return _0x34e59e;};}function handleError(_0x53ab97,_0x12098d){_0x12098d=_0x12098d||0x1f4;return function(_0x50c6ff){logger['error'](_0x50c6ff['stack']);if(_0x50c6ff[_0xe919('0xd')]){delete _0x50c6ff[_0xe919('0xd')];}_0x53ab97[_0xe919('0xe')](_0x12098d)['send'](_0x50c6ff);};}exports['update']=function(_0x203b79,_0x26fc06){if(_0x203b79['user'][_0xe919('0xf')]!==_0xe919('0x10'))throw new Error(_0xe919('0x11'));if(isNaN(Number(_0x203b79[_0xe919('0x12')]['id'])))throw new Error(_0xe919('0x13'));return db[_0xe919('0x14')][_0xe919('0x15')]({'where':{'id':_0x203b79['params']['id']}})[_0xe919('0xb')](handleEntityNotFound(_0x26fc06,null))['then'](saveUpdates(_0x203b79['body'],null))[_0xe919('0xb')](respondWithResult(_0x26fc06,null))[_0xe919('0x16')](handleError(_0x26fc06,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 069deb3..fa5b2bf 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 _0x07fc=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserSetting'];(function(_0x17a108,_0x46cabc){var _0x462e84=function(_0x1746e5){while(--_0x1746e5){_0x17a108['push'](_0x17a108['shift']());}};_0x462e84(++_0x46cabc);}(_0x07fc,0xa2));var _0xc07f=function(_0x50fcaa,_0x1cf624){_0x50fcaa=_0x50fcaa-0x0;var _0x2be286=_0x07fc[_0x50fcaa];return _0x2be286;};'use strict';var EventEmitter=require(_0xc07f('0x0'));var UserSetting=require(_0xc07f('0x1'))['db'][_0xc07f('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0xc07f('0x3')](0x0);var events={'afterCreate':_0xc07f('0x4'),'afterUpdate':_0xc07f('0x5'),'afterDestroy':_0xc07f('0x6')};function emitEvent(_0x33598e){return function(_0x53de12,_0xba1658,_0x59e0af){UserSettingEvents[_0xc07f('0x7')](_0x33598e+':'+_0x53de12['id'],_0x53de12);UserSettingEvents[_0xc07f('0x7')](_0x33598e,_0x53de12);_0x59e0af(null);};}for(var e in events){if(events[_0xc07f('0x8')](e)){var event=events[e];UserSetting[_0xc07f('0x9')](e,emitEvent(event));}}module[_0xc07f('0xa')]=UserSettingEvents; \ No newline at end of file +var _0x629b=['emit','hasOwnProperty','hook','UserSetting','setMaxListeners','save','remove'];(function(_0x559ba7,_0x42c623){var _0x1497ea=function(_0x3dc8bc){while(--_0x3dc8bc){_0x559ba7['push'](_0x559ba7['shift']());}};_0x1497ea(++_0x42c623);}(_0x629b,0x1c3));var _0xb629=function(_0xbdbf5c,_0x1df03e){_0xbdbf5c=_0xbdbf5c-0x0;var _0x1584f3=_0x629b[_0xbdbf5c];return _0x1584f3;};'use strict';var EventEmitter=require('events');var UserSetting=require('../../mysqldb')['db'][_0xb629('0x0')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0xb629('0x1')](0x0);var events={'afterCreate':_0xb629('0x2'),'afterUpdate':'update','afterDestroy':_0xb629('0x3')};function emitEvent(_0x1a90ba){return function(_0x5d579a,_0x75689d,_0x53f00b){UserSettingEvents[_0xb629('0x4')](_0x1a90ba+':'+_0x5d579a['id'],_0x5d579a);UserSettingEvents['emit'](_0x1a90ba,_0x5d579a);_0x53f00b(null);};}for(var e in events){if(events[_0xb629('0x5')](e)){var event=events[e];UserSetting[_0xb629('0x6')](e,emitEvent(event));}}module['exports']=UserSettingEvents; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.model.js b/server/api/user-setting/user-setting.model.js index bb0633a..e2e6636 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 _0x152f=['./user-setting.attributes','exports','define','UserSetting','clientSideLoggingEnabled','clientSideLoggingEnabledSince'];(function(_0x568758,_0x72a9cd){var _0x1120fe=function(_0x397fdc){while(--_0x397fdc){_0x568758['push'](_0x568758['shift']());}};_0x1120fe(++_0x72a9cd);}(_0x152f,0x144));var _0xf152=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0x152f[_0x5e3b04];return _0x1fc44d;};'use strict';var attributes=require(_0xf152('0x0'));module[_0xf152('0x1')]=function(_0x3649e1){return _0x3649e1[_0xf152('0x2')](_0xf152('0x3'),attributes,{'tableName':'user_settings','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2d77c1){if(!_0x2d77c1[_0xf152('0x4')])_0x2d77c1[_0xf152('0x5')]=null;else if(_0x2d77c1[_0xf152('0x5')]===null)_0x2d77c1['clientSideLoggingEnabledSince']=new Date();}}});}; \ No newline at end of file +var _0x8d05=['define','UserSetting','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes','exports'];(function(_0x4eb86f,_0x58f49b){var _0xe62daa=function(_0x13fbd9){while(--_0x13fbd9){_0x4eb86f['push'](_0x4eb86f['shift']());}};_0xe62daa(++_0x58f49b);}(_0x8d05,0xe8));var _0x58d0=function(_0x5440db,_0x285e97){_0x5440db=_0x5440db-0x0;var _0x5eeedb=_0x8d05[_0x5440db];return _0x5eeedb;};'use strict';var attributes=require(_0x58d0('0x0'));module[_0x58d0('0x1')]=function(_0x163911){return _0x163911[_0x58d0('0x2')](_0x58d0('0x3'),attributes,{'tableName':'user_settings','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x510dd7){if(!_0x510dd7[_0x58d0('0x4')])_0x510dd7[_0x58d0('0x5')]=null;else if(_0x510dd7[_0x58d0('0x5')]===null)_0x510dd7[_0x58d0('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 8b2635a..2b47e65 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 _0xf5d3=['remove','update','user-setting:update:user-','UserId','register','length','user-setting:','save'];(function(_0x1f92b8,_0x2c704b){var _0x4d8e3a=function(_0x41abb0){while(--_0x41abb0){_0x1f92b8['push'](_0x1f92b8['shift']());}};_0x4d8e3a(++_0x2c704b);}(_0xf5d3,0x1c7));var _0x3f5d=function(_0x556bb1,_0x34830d){_0x556bb1=_0x556bb1-0x0;var _0x45455f=_0xf5d3[_0x556bb1];return _0x45455f;};'use strict';var UserSettingEvents=require('./user-setting.events');var events=[_0x3f5d('0x0'),_0x3f5d('0x1'),_0x3f5d('0x2')];function createListener(_0x1f8670,_0x1cff84){return function(_0x59c822){_0x1cff84['emit'](_0x1f8670,_0x59c822);if(_0x1f8670==='user-setting:update'){_0x1cff84['emit'](_0x3f5d('0x3')+_0x59c822[_0x3f5d('0x4')],_0x59c822);}};}exports[_0x3f5d('0x5')]=function(_0x37544a){for(var _0x1eae46=0x0,_0x591bb8=events[_0x3f5d('0x6')];_0x1eae46<_0x591bb8;_0x1eae46++){var _0x50987e=events[_0x1eae46];var _0x4d7d9a=createListener(_0x3f5d('0x7')+_0x50987e,_0x37544a);UserSettingEvents['on'](_0x50987e,_0x4d7d9a);}}; \ No newline at end of file +var _0x4b71=['./user-setting.events','save','remove','update','user-setting:update','emit','user-setting:update:user-','UserId','register','length'];(function(_0x56383d,_0x1bfdff){var _0x1bf508=function(_0x35613c){while(--_0x35613c){_0x56383d['push'](_0x56383d['shift']());}};_0x1bf508(++_0x1bfdff);}(_0x4b71,0x1c2));var _0x14b7=function(_0x4537fb,_0x388695){_0x4537fb=_0x4537fb-0x0;var _0x38b309=_0x4b71[_0x4537fb];return _0x38b309;};'use strict';var UserSettingEvents=require(_0x14b7('0x0'));var events=[_0x14b7('0x1'),_0x14b7('0x2'),_0x14b7('0x3')];function createListener(_0x6e5ff8,_0x329d2d){return function(_0x22f9d8){_0x329d2d['emit'](_0x6e5ff8,_0x22f9d8);if(_0x6e5ff8===_0x14b7('0x4')){_0x329d2d[_0x14b7('0x5')](_0x14b7('0x6')+_0x22f9d8[_0x14b7('0x7')],_0x22f9d8);}};}exports[_0x14b7('0x8')]=function(_0x1d9d8d){for(var _0x27aded=0x0,_0x3b426f=events[_0x14b7('0x9')];_0x27aded<_0x3b426f;_0x27aded++){var _0x561f22=events[_0x27aded];var _0x42d852=createListener('user-setting:'+_0x561f22,_0x1d9d8d);UserSettingEvents['on'](_0x561f22,_0x42d852);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 01994ba..c7ea54c 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 _0x96f9=['../../components/interaction/service','./user.controller','get','index','/describe','whoami','/presence','getPresence','/:id','isAuthenticated','/:id/avatar','getOpenTabs','/:id/contacts','getContacts','/:id/queues','/:id/queues_rt','getVoiceQueuesRt','getGroups','getRecordings','/:id/screen_recordings','getScreenRecordings','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getFaxInteractions','/:id/whatsapp/interactions','getTeams','/:id/lists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','addContacts','/create_many','bulkCreate','diskStorage','join','server/files/images/','format','%s-%s','single','addAvatar','/:id/login','login','logout','/:id/pause','pause','/:id/unpause','unpause','/:id/teams','addTeams','/:id/chat_interactions','/:id/mail_interactions','addMailInteractions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','/:id/mail_accounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','put','changePassword','removeQueues','delete','destroy','removeChatInteractions','/:id/fax_interactions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x4fc23e,_0x508eff){var _0x437936=function(_0x2d5ec5){while(--_0x2d5ec5){_0x4fc23e['push'](_0x4fc23e['shift']());}};_0x437936(++_0x508eff);}(_0x96f9,0x64));var _0x996f=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x96f9[_0x2c91e9];return _0x13f0ff;};'use strict';var multer=require(_0x996f('0x0'));var util=require(_0x996f('0x1'));var path=require(_0x996f('0x2'));var timeout=require(_0x996f('0x3'));var express=require(_0x996f('0x4'));var router=express[_0x996f('0x5')]();var fs_extra=require(_0x996f('0x6'));var auth=require(_0x996f('0x7'));var interaction=require(_0x996f('0x8'));var config=require('../../config/environment');var controller=require(_0x996f('0x9'));router[_0x996f('0xa')]('/',auth['isAuthenticated'](),controller[_0x996f('0xb')]);router[_0x996f('0xa')](_0x996f('0xc'),auth['isAuthenticated'](),controller['describe']);router['get']('/whoami',auth['isAuthenticated'](),controller[_0x996f('0xd')]);router[_0x996f('0xa')](_0x996f('0xe'),auth['isAuthenticated'](),controller[_0x996f('0xf')]);router[_0x996f('0xa')](_0x996f('0x10'),auth[_0x996f('0x11')](),controller['show']);router[_0x996f('0xa')](_0x996f('0x12'),controller['getAvatar']);router[_0x996f('0xa')]('/:id/open_tabs',auth[_0x996f('0x11')](),controller[_0x996f('0x13')]);router['get'](_0x996f('0x14'),auth['isAuthenticated'](),controller[_0x996f('0x15')]);router[_0x996f('0xa')](_0x996f('0x16'),auth[_0x996f('0x11')](),controller['getQueues']);router[_0x996f('0xa')](_0x996f('0x17'),auth['isAuthenticated'](),controller[_0x996f('0x18')]);router['get']('/:id/groups',auth[_0x996f('0x11')](),controller[_0x996f('0x19')]);router[_0x996f('0xa')]('/:id/recordings',auth[_0x996f('0x11')](),controller[_0x996f('0x1a')]);router['get'](_0x996f('0x1b'),auth[_0x996f('0x11')](),controller[_0x996f('0x1c')]);router[_0x996f('0xa')]('/:id/chat/interactions',auth[_0x996f('0x11')](),controller['getChatInteractions']);router[_0x996f('0xa')]('/:id/openchannel/interactions',auth[_0x996f('0x11')](),controller[_0x996f('0x1d')]);router[_0x996f('0xa')](_0x996f('0x1e'),auth[_0x996f('0x11')](),controller[_0x996f('0x1f')]);router[_0x996f('0xa')](_0x996f('0x20'),auth[_0x996f('0x11')](),controller['getSmsInteractions']);router[_0x996f('0xa')]('/:id/fax/interactions',auth[_0x996f('0x11')](),controller[_0x996f('0x21')]);router['get'](_0x996f('0x22'),auth[_0x996f('0x11')](),controller['getWhatsappInteractions']);router['get']('/:id/teams',auth[_0x996f('0x11')](),controller[_0x996f('0x23')]);router['get'](_0x996f('0x24'),auth['isAuthenticated'](),controller['getLists']);router[_0x996f('0xa')](_0x996f('0x25'),auth[_0x996f('0x11')](),controller[_0x996f('0x26')]);router[_0x996f('0xa')](_0x996f('0x27'),auth[_0x996f('0x11')](),controller[_0x996f('0x28')]);router[_0x996f('0xa')](_0x996f('0x29'),auth[_0x996f('0x11')](),controller[_0x996f('0x2a')]);router[_0x996f('0xa')]('/:id/mail_accounts',auth[_0x996f('0x11')](),controller[_0x996f('0x2b')]);router[_0x996f('0xa')](_0x996f('0x2c'),auth['isAuthenticated'](),controller[_0x996f('0x2d')]);router[_0x996f('0xa')](_0x996f('0x2e'),auth[_0x996f('0x11')](),controller['getSmsAccounts']);router['get'](_0x996f('0x2f'),auth[_0x996f('0x11')](),controller[_0x996f('0x30')]);router[_0x996f('0xa')](_0x996f('0x31'),auth[_0x996f('0x11')](),controller[_0x996f('0x32')]);router[_0x996f('0xa')](_0x996f('0x33'),auth[_0x996f('0x11')](),controller[_0x996f('0x34')]);router['get'](_0x996f('0x35'),auth[_0x996f('0x11')](),controller[_0x996f('0x36')]);router[_0x996f('0x37')](_0x996f('0x14'),auth[_0x996f('0x11')](),controller[_0x996f('0x38')]);router[_0x996f('0x37')]('/',auth[_0x996f('0x11')](),controller['create']);router[_0x996f('0x37')](_0x996f('0x39'),auth[_0x996f('0x11')](),controller[_0x996f('0x3a')]);router[_0x996f('0x37')](_0x996f('0x16'),auth[_0x996f('0x11')](),controller['addQueues']);var upload=multer({'storage':multer[_0x996f('0x3b')]({'destination':function(_0x50c0b1,_0x4b426e,_0x558689){_0x558689(null,path[_0x996f('0x3c')](config['root'],_0x996f('0x3d')));},'filename':function(_0x519ed8,_0x2cede8,_0x23758f){_0x23758f(null,util[_0x996f('0x3e')](_0x996f('0x3f'),Date['now'](),_0x2cede8['originalname']));}})});router[_0x996f('0x37')](_0x996f('0x12'),upload[_0x996f('0x40')]('file'),controller[_0x996f('0x41')]);router[_0x996f('0x37')](_0x996f('0x42'),auth['isAuthenticated'](),controller[_0x996f('0x43')]);router[_0x996f('0x37')]('/:id/logout',auth[_0x996f('0x11')](),controller[_0x996f('0x44')]);router[_0x996f('0x37')](_0x996f('0x45'),auth[_0x996f('0x11')](),controller[_0x996f('0x46')]);router[_0x996f('0x37')](_0x996f('0x47'),auth[_0x996f('0x11')](),controller[_0x996f('0x48')]);router['post'](_0x996f('0x49'),auth[_0x996f('0x11')](),controller[_0x996f('0x4a')]);router[_0x996f('0x37')](_0x996f('0x4b'),auth['isAuthenticated'](),controller['addChatInteractions']);router[_0x996f('0x37')](_0x996f('0x4c'),auth[_0x996f('0x11')](),controller[_0x996f('0x4d')]);router[_0x996f('0x37')]('/:id/fax_interactions',auth['isAuthenticated'](),controller[_0x996f('0x4e')]);router[_0x996f('0x37')](_0x996f('0x4f'),auth['isAuthenticated'](),controller[_0x996f('0x50')]);router[_0x996f('0x37')]('/:id/openchannel_interactions',auth[_0x996f('0x11')](),controller['addOpenchannelInteractions']);router['post'](_0x996f('0x51'),auth[_0x996f('0x11')](),controller[_0x996f('0x52')]);router['post'](_0x996f('0x29'),auth[_0x996f('0x11')](),controller[_0x996f('0x53')]);router[_0x996f('0x37')](_0x996f('0x54'),auth[_0x996f('0x11')](),controller[_0x996f('0x55')]);router[_0x996f('0x37')]('/:id/openchannel_accounts',auth[_0x996f('0x11')](),controller[_0x996f('0x56')]);router[_0x996f('0x37')]('/:id/sms_accounts',auth[_0x996f('0x11')](),controller[_0x996f('0x57')]);router[_0x996f('0x37')](_0x996f('0x2f'),auth['isAuthenticated'](),controller[_0x996f('0x58')]);router[_0x996f('0x37')](_0x996f('0x31'),auth[_0x996f('0x11')](),controller[_0x996f('0x59')]);router[_0x996f('0x37')](_0x996f('0x35'),auth['isAuthenticated'](),controller['createApiKey']);router[_0x996f('0x5a')](_0x996f('0x10'),auth[_0x996f('0x11')](),controller['update']);router[_0x996f('0x5a')]('/:id/password',auth[_0x996f('0x11')](),controller[_0x996f('0x5b')]);router['delete'](_0x996f('0x16'),auth[_0x996f('0x11')](),controller[_0x996f('0x5c')]);router['delete'](_0x996f('0x49'),auth[_0x996f('0x11')](),controller['removeTeams']);router[_0x996f('0x5d')](_0x996f('0x10'),auth[_0x996f('0x11')](),controller[_0x996f('0x5e')]);router[_0x996f('0x5d')](_0x996f('0x4b'),auth[_0x996f('0x11')](),controller[_0x996f('0x5f')]);router[_0x996f('0x5d')](_0x996f('0x4c'),auth[_0x996f('0x11')](),controller['removeMailInteractions']);router[_0x996f('0x5d')](_0x996f('0x60'),auth[_0x996f('0x11')](),controller[_0x996f('0x61')]);router['delete']('/:id/sms_interactions',auth[_0x996f('0x11')](),controller[_0x996f('0x62')]);router[_0x996f('0x5d')]('/:id/openchannel_interactions',auth[_0x996f('0x11')](),controller[_0x996f('0x63')]);router[_0x996f('0x5d')]('/:id/whatsapp_interactions',auth['isAuthenticated'](),controller[_0x996f('0x64')]);router[_0x996f('0x5d')](_0x996f('0x29'),auth[_0x996f('0x11')](),controller[_0x996f('0x65')]);router['delete'](_0x996f('0x54'),auth[_0x996f('0x11')](),controller[_0x996f('0x66')]);router[_0x996f('0x5d')](_0x996f('0x2c'),auth['isAuthenticated'](),controller[_0x996f('0x67')]);router[_0x996f('0x5d')](_0x996f('0x2e'),auth[_0x996f('0x11')](),controller[_0x996f('0x68')]);router[_0x996f('0x5d')]('/:id/chat_websites',auth[_0x996f('0x11')](),controller[_0x996f('0x69')]);router[_0x996f('0x5d')](_0x996f('0x31'),auth[_0x996f('0x11')](),controller[_0x996f('0x6a')]);router[_0x996f('0x5d')](_0x996f('0x35'),auth[_0x996f('0x11')](),controller[_0x996f('0x6b')]);module['exports']=router; \ No newline at end of file +var _0xd01f=['delete','removeQueues','removeTeams','destroy','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','/:id/whatsapp_interactions','removeWhatsappInteractions','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','multer','path','express','Router','../../components/auth/service','../../config/environment','./user.controller','get','index','describe','/whoami','isAuthenticated','whoami','/presence','getPresence','/:id','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','/:id/chat/interactions','getChatInteractions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','getAgents','getVoicePrefixes','/:id/fax_accounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','/:id/sms_accounts','getSmsAccounts','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','create','/create_many','bulkCreate','addQueues','diskStorage','join','root','server/files/images/','format','now','originalname','single','file','addAvatar','/:id/login','login','/:id/logout','/:id/pause','pause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','addOpenchannelInteractions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','/:id/chat_websites','addChatWebsites','addWhatsappAccounts','createApiKey','put','update','changePassword'];(function(_0x4dc6d5,_0x4a600f){var _0x4d3c7e=function(_0x595770){while(--_0x595770){_0x4dc6d5['push'](_0x4dc6d5['shift']());}};_0x4d3c7e(++_0x4a600f);}(_0xd01f,0x1d6));var _0xfd01=function(_0x2a4e92,_0x4c19d6){_0x2a4e92=_0x2a4e92-0x0;var _0x5964ab=_0xd01f[_0x2a4e92];return _0x5964ab;};'use strict';var multer=require(_0xfd01('0x0'));var util=require('util');var path=require(_0xfd01('0x1'));var timeout=require('connect-timeout');var express=require(_0xfd01('0x2'));var router=express[_0xfd01('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xfd01('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xfd01('0x5'));var controller=require(_0xfd01('0x6'));router[_0xfd01('0x7')]('/',auth['isAuthenticated'](),controller[_0xfd01('0x8')]);router[_0xfd01('0x7')]('/describe',auth['isAuthenticated'](),controller[_0xfd01('0x9')]);router[_0xfd01('0x7')](_0xfd01('0xa'),auth[_0xfd01('0xb')](),controller[_0xfd01('0xc')]);router[_0xfd01('0x7')](_0xfd01('0xd'),auth[_0xfd01('0xb')](),controller[_0xfd01('0xe')]);router[_0xfd01('0x7')](_0xfd01('0xf'),auth[_0xfd01('0xb')](),controller['show']);router[_0xfd01('0x7')](_0xfd01('0x10'),controller[_0xfd01('0x11')]);router[_0xfd01('0x7')](_0xfd01('0x12'),auth[_0xfd01('0xb')](),controller[_0xfd01('0x13')]);router[_0xfd01('0x7')](_0xfd01('0x14'),auth['isAuthenticated'](),controller['getContacts']);router[_0xfd01('0x7')](_0xfd01('0x15'),auth[_0xfd01('0xb')](),controller[_0xfd01('0x16')]);router[_0xfd01('0x7')](_0xfd01('0x17'),auth[_0xfd01('0xb')](),controller[_0xfd01('0x18')]);router['get']('/:id/groups',auth['isAuthenticated'](),controller[_0xfd01('0x19')]);router[_0xfd01('0x7')](_0xfd01('0x1a'),auth[_0xfd01('0xb')](),controller[_0xfd01('0x1b')]);router[_0xfd01('0x7')](_0xfd01('0x1c'),auth[_0xfd01('0xb')](),controller['getScreenRecordings']);router['get'](_0xfd01('0x1d'),auth[_0xfd01('0xb')](),controller[_0xfd01('0x1e')]);router[_0xfd01('0x7')]('/:id/openchannel/interactions',auth['isAuthenticated'](),controller[_0xfd01('0x1f')]);router[_0xfd01('0x7')](_0xfd01('0x20'),auth[_0xfd01('0xb')](),controller[_0xfd01('0x21')]);router['get'](_0xfd01('0x22'),auth[_0xfd01('0xb')](),controller[_0xfd01('0x23')]);router['get'](_0xfd01('0x24'),auth['isAuthenticated'](),controller[_0xfd01('0x25')]);router[_0xfd01('0x7')](_0xfd01('0x26'),auth[_0xfd01('0xb')](),controller['getWhatsappInteractions']);router['get'](_0xfd01('0x27'),auth[_0xfd01('0xb')](),controller[_0xfd01('0x28')]);router[_0xfd01('0x7')](_0xfd01('0x29'),auth[_0xfd01('0xb')](),controller[_0xfd01('0x2a')]);router[_0xfd01('0x7')](_0xfd01('0x2b'),auth['isAuthenticated'](),controller[_0xfd01('0x2c')]);router[_0xfd01('0x7')]('/:id/prefixes',auth[_0xfd01('0xb')](),controller[_0xfd01('0x2d')]);router[_0xfd01('0x7')](_0xfd01('0x2e'),auth[_0xfd01('0xb')](),controller['getFaxAccounts']);router[_0xfd01('0x7')](_0xfd01('0x2f'),auth[_0xfd01('0xb')](),controller[_0xfd01('0x30')]);router['get'](_0xfd01('0x31'),auth['isAuthenticated'](),controller['getOpenchannelAccounts']);router[_0xfd01('0x7')](_0xfd01('0x32'),auth['isAuthenticated'](),controller[_0xfd01('0x33')]);router['get']('/:id/chat_websites',auth[_0xfd01('0xb')](),controller[_0xfd01('0x34')]);router[_0xfd01('0x7')](_0xfd01('0x35'),auth[_0xfd01('0xb')](),controller[_0xfd01('0x36')]);router[_0xfd01('0x7')](_0xfd01('0x37'),auth[_0xfd01('0xb')](),controller[_0xfd01('0x38')]);router[_0xfd01('0x7')](_0xfd01('0x39'),auth[_0xfd01('0xb')](),controller[_0xfd01('0x3a')]);router[_0xfd01('0x3b')](_0xfd01('0x14'),auth[_0xfd01('0xb')](),controller['addContacts']);router[_0xfd01('0x3b')]('/',auth[_0xfd01('0xb')](),controller[_0xfd01('0x3c')]);router[_0xfd01('0x3b')](_0xfd01('0x3d'),auth[_0xfd01('0xb')](),controller[_0xfd01('0x3e')]);router['post'](_0xfd01('0x15'),auth[_0xfd01('0xb')](),controller[_0xfd01('0x3f')]);var upload=multer({'storage':multer[_0xfd01('0x40')]({'destination':function(_0x33339b,_0x188b93,_0x150006){_0x150006(null,path[_0xfd01('0x41')](config[_0xfd01('0x42')],_0xfd01('0x43')));},'filename':function(_0x40b8bb,_0x3ee4ee,_0xd49b95){_0xd49b95(null,util[_0xfd01('0x44')]('%s-%s',Date[_0xfd01('0x45')](),_0x3ee4ee[_0xfd01('0x46')]));}})});router[_0xfd01('0x3b')](_0xfd01('0x10'),upload[_0xfd01('0x47')](_0xfd01('0x48')),controller[_0xfd01('0x49')]);router['post'](_0xfd01('0x4a'),auth[_0xfd01('0xb')](),controller[_0xfd01('0x4b')]);router[_0xfd01('0x3b')](_0xfd01('0x4c'),auth[_0xfd01('0xb')](),controller['logout']);router[_0xfd01('0x3b')](_0xfd01('0x4d'),auth[_0xfd01('0xb')](),controller[_0xfd01('0x4e')]);router[_0xfd01('0x3b')]('/:id/unpause',auth[_0xfd01('0xb')](),controller['unpause']);router['post'](_0xfd01('0x27'),auth['isAuthenticated'](),controller[_0xfd01('0x4f')]);router[_0xfd01('0x3b')](_0xfd01('0x50'),auth['isAuthenticated'](),controller[_0xfd01('0x51')]);router[_0xfd01('0x3b')](_0xfd01('0x52'),auth[_0xfd01('0xb')](),controller[_0xfd01('0x53')]);router['post'](_0xfd01('0x54'),auth['isAuthenticated'](),controller[_0xfd01('0x55')]);router[_0xfd01('0x3b')](_0xfd01('0x56'),auth[_0xfd01('0xb')](),controller[_0xfd01('0x57')]);router[_0xfd01('0x3b')]('/:id/openchannel_interactions',auth[_0xfd01('0xb')](),controller[_0xfd01('0x58')]);router[_0xfd01('0x3b')]('/:id/whatsapp_interactions',auth[_0xfd01('0xb')](),controller[_0xfd01('0x59')]);router[_0xfd01('0x3b')]('/:id/fax_accounts',auth[_0xfd01('0xb')](),controller[_0xfd01('0x5a')]);router[_0xfd01('0x3b')](_0xfd01('0x2f'),auth[_0xfd01('0xb')](),controller[_0xfd01('0x5b')]);router[_0xfd01('0x3b')]('/:id/openchannel_accounts',auth[_0xfd01('0xb')](),controller[_0xfd01('0x5c')]);router[_0xfd01('0x3b')](_0xfd01('0x32'),auth['isAuthenticated'](),controller['addSmsAccounts']);router[_0xfd01('0x3b')](_0xfd01('0x5d'),auth[_0xfd01('0xb')](),controller[_0xfd01('0x5e')]);router['post']('/:id/whatsapp_accounts',auth[_0xfd01('0xb')](),controller[_0xfd01('0x5f')]);router['post'](_0xfd01('0x39'),auth[_0xfd01('0xb')](),controller[_0xfd01('0x60')]);router[_0xfd01('0x61')](_0xfd01('0xf'),auth[_0xfd01('0xb')](),controller[_0xfd01('0x62')]);router[_0xfd01('0x61')]('/:id/password',auth[_0xfd01('0xb')](),controller[_0xfd01('0x63')]);router[_0xfd01('0x64')](_0xfd01('0x15'),auth[_0xfd01('0xb')](),controller[_0xfd01('0x65')]);router['delete'](_0xfd01('0x27'),auth[_0xfd01('0xb')](),controller[_0xfd01('0x66')]);router[_0xfd01('0x64')](_0xfd01('0xf'),auth[_0xfd01('0xb')](),controller[_0xfd01('0x67')]);router['delete']('/:id/chat_interactions',auth[_0xfd01('0xb')](),controller[_0xfd01('0x68')]);router[_0xfd01('0x64')](_0xfd01('0x52'),auth[_0xfd01('0xb')](),controller[_0xfd01('0x69')]);router[_0xfd01('0x64')](_0xfd01('0x54'),auth[_0xfd01('0xb')](),controller[_0xfd01('0x6a')]);router['delete']('/:id/sms_interactions',auth[_0xfd01('0xb')](),controller[_0xfd01('0x6b')]);router['delete']('/:id/openchannel_interactions',auth[_0xfd01('0xb')](),controller['removeOpenchannelInteractions']);router[_0xfd01('0x64')](_0xfd01('0x6c'),auth[_0xfd01('0xb')](),controller[_0xfd01('0x6d')]);router[_0xfd01('0x64')](_0xfd01('0x2e'),auth['isAuthenticated'](),controller['removeFaxAccounts']);router[_0xfd01('0x64')](_0xfd01('0x2f'),auth[_0xfd01('0xb')](),controller[_0xfd01('0x6e')]);router['delete'](_0xfd01('0x31'),auth[_0xfd01('0xb')](),controller[_0xfd01('0x6f')]);router[_0xfd01('0x64')](_0xfd01('0x32'),auth[_0xfd01('0xb')](),controller[_0xfd01('0x70')]);router['delete']('/:id/chat_websites',auth[_0xfd01('0xb')](),controller[_0xfd01('0x71')]);router[_0xfd01('0x64')]('/:id/whatsapp_accounts',auth[_0xfd01('0xb')](),controller['removeWhatsappAccounts']);router[_0xfd01('0x64')](_0xfd01('0x39'),auth['isAuthenticated'](),controller['removeApiKey']);module['exports']=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 7e43ec1..3a385c1 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 _0xa9e0=['certificate','passive','nonat','update,nonat','TEXT','showWebBar','wss','encryption','force_avp','icesupport','dtlsenable','dtlssetup','dtlscertfile','rtcp_mux','avpf','dtlsverify','actpass','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','loginAttempts','sequelize','moment','util','STRING','setDataValue','name','defaultuser','callerid','getDataValue','internal','email','admin','user','agent','telephone','INTEGER','format','fullname','BOOLEAN','DATE','dynamic','ENUM','friend','peer','from-sip','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','udp','join','transport','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','update','outgoing','force_rport,comedia','nat','split','ulaw;alaw;gsm','allow','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas'];(function(_0x45f111,_0x3a1a4a){var _0x483508=function(_0x3131ab){while(--_0x3131ab){_0x45f111['push'](_0x45f111['shift']());}};_0x483508(++_0x3a1a4a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x333808){this[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x333808);this[_0x0a9e('0x4')](_0x0a9e('0x6'),_0x333808);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'set':function(_0x441e3a){this[_0x0a9e('0x4')]('fullname',_0x441e3a);this['setDataValue'](_0x0a9e('0x7'),util['format']('\x22%s\x22\x20<%s>',_0x441e3a,this[_0x0a9e('0x8')](_0x0a9e('0x9'))));}},'alias':{'type':Sequelize[_0x0a9e('0x3')]},'email':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'unique':_0x0a9e('0xa'),'validate':{'isEmail':!![]},'set':function(_0xbd1168){if(_0xbd1168){this['setDataValue']('email',_0xbd1168['toLowerCase']());}}},'role':{'type':Sequelize['ENUM'](_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe')),'allowNull':![]},'password':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'local'},'internal':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':![],'unique':_0x0a9e('0x9'),'set':function(_0x2b4227){this[_0x0a9e('0x4')](_0x0a9e('0x9'),_0x2b4227);this[_0x0a9e('0x4')]('accountcode',_0x2b4227);this[_0x0a9e('0x4')]('callerid',util[_0x0a9e('0x10')]('\x22%s\x22\x20<%s>',this[_0x0a9e('0x8')](_0x0a9e('0x11')),_0x2b4227));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x0a9e('0x3')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0x0a9e('0x3')]},'zipcode':{'type':Sequelize[_0x0a9e('0x3')]},'userpic':{'type':Sequelize[_0x0a9e('0x3')]},'city':{'type':Sequelize[_0x0a9e('0x3')]},'country':{'type':Sequelize[_0x0a9e('0x3')]},'online':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x0a9e('0x13')]},'voicePause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x0a9e('0x13')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x0a9e('0xf')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x0a9e('0xf')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x14')},'ipaddr':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0x0a9e('0xf')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x16'),_0x0a9e('0xc'),_0x0a9e('0x17')),'allowNull':!![],'defaultValue':_0x0a9e('0x16')},'context':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x18')},'callingpres':{'type':Sequelize[_0x0a9e('0x15')]('ALLOWED_NOT_SCREENED',_0x0a9e('0x19'),_0x0a9e('0x1a'),_0x0a9e('0x1b'),_0x0a9e('0x1c'),'PROHIB_PASSED_SCREEN',_0x0a9e('0x1d'),_0x0a9e('0x1e')),'allowNull':!![]},'deny':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'transport':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x1f'),'set':function(_0x540530){this[_0x0a9e('0x4')]('transport',_0x540530?_0x540530[_0x0a9e('0x20')](','):null);},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x21'))?this[_0x0a9e('0x8')](_0x0a9e('0x21'))['split'](','):null;},'comment':_0x0a9e('0x22')},'dtmfmode':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x23'),_0x0a9e('0x24'),_0x0a9e('0x25'),_0x0a9e('0x26'),_0x0a9e('0x27')),'allowNull':!![],'defaultValue':_0x0a9e('0x23')},'directmedia':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no','nonat',_0x0a9e('0x29'),_0x0a9e('0x2a')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'nat':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x2b'),'set':function(_0x15de0e){this['setDataValue']('nat',_0x15de0e?_0x15de0e[_0x0a9e('0x20')](','):null);},'get':function(){return this['getDataValue'](_0x0a9e('0x2c'))?this[_0x0a9e('0x8')](_0x0a9e('0x2c'))[_0x0a9e('0x2d')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x0a9e('0x3')]},'namedcallgroup':{'type':Sequelize[_0x0a9e('0x3')]},'pickupgroup':{'type':Sequelize[_0x0a9e('0x3')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x0a9e('0x3')]},'disallow':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0a9e('0x2e'),'set':function(_0x40d766){this['setDataValue'](_0x0a9e('0x2f'),_0x40d766?_0x40d766[_0x0a9e('0x20')](';'):_0x0a9e('0x2e'));},'get':function(){return this[_0x0a9e('0x8')]('allow')?this['getDataValue'](_0x0a9e('0x2f'))[_0x0a9e('0x2d')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'set':function(_0x5b4f5e){this[_0x0a9e('0x4')](_0x0a9e('0x30'),_0x5b4f5e?_0x5b4f5e[_0x0a9e('0x20')](','):null);},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x30'))?this[_0x0a9e('0x8')](_0x0a9e('0x30'))[_0x0a9e('0x2d')](','):null;},'comment':_0x0a9e('0x31')},'trustrpid':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x32')},'amaflags':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':_0x0a9e('0x28')},'busylevel':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x0a9e('0x15')]('yes','no',_0x0a9e('0x33')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x34'),_0x0a9e('0x35'),_0x0a9e('0x36')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM'](_0x0a9e('0x37'),_0x0a9e('0x38')),'allowNull':!![],'defaultValue':_0x0a9e('0x38')},'t38pt_usertpsource':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no','fingerprint',_0x0a9e('0x39')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x0a9e('0x15')]('active',_0x0a9e('0x3a'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no',_0x0a9e('0x3b'),_0x0a9e('0x29'),_0x0a9e('0x3c')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x0a9e('0x3')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x0a9e('0x13')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x0a9e('0x3d')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x3649cc){this['setDataValue'](_0x0a9e('0x3e'),_0x3649cc);var _0x5ba1f9=this['get']({'plain':!![]});switch(_0x3649cc){case 0x0:case 0x1:var _0x5674ee=_0x5ba1f9[_0x0a9e('0x21')]?_['isArray'](_0x5ba1f9[_0x0a9e('0x21')])?_0x5ba1f9[_0x0a9e('0x21')][_0x0a9e('0x20')]():_0x5ba1f9[_0x0a9e('0x21')]:_0x0a9e('0x1f');if(_0x5674ee===_0x0a9e('0x3f')){_0x5674ee='udp';}this[_0x0a9e('0x4')]('transport',_0x5674ee);this[_0x0a9e('0x4')](_0x0a9e('0x40'),'no');this[_0x0a9e('0x4')]('avpf',null);this[_0x0a9e('0x4')](_0x0a9e('0x41'),null);this[_0x0a9e('0x4')](_0x0a9e('0x42'),null);this['setDataValue'](_0x0a9e('0x43'),null);this[_0x0a9e('0x4')]('dtlsverify',null);this[_0x0a9e('0x4')](_0x0a9e('0x44'),null);this[_0x0a9e('0x4')](_0x0a9e('0x45'),null);this[_0x0a9e('0x4')]('dtlsprivatekey',null);this[_0x0a9e('0x4')](_0x0a9e('0x46'),'no');break;case 0x2:this[_0x0a9e('0x4')]('transport',_0x0a9e('0x3f'));this['setDataValue']('encryption',_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x47'),_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x41'),_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x42'),_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x43'),_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x48'),'no');this[_0x0a9e('0x4')](_0x0a9e('0x44'),_0x0a9e('0x49'));this['setDataValue'](_0x0a9e('0x45'),_0x5ba1f9[_0x0a9e('0x45')]||_0x0a9e('0x4a'));this['setDataValue'](_0x0a9e('0x4b'),_0x5ba1f9[_0x0a9e('0x4b')]||'/etc/pki/tls/private/motion.key');this[_0x0a9e('0x4')](_0x0a9e('0x46'),_0x0a9e('0x28'));break;default:}}},'permissions':{'type':Sequelize[_0x0a9e('0x3d')],'set':function(_0x13b5c0){this['setDataValue']('permissions',_0x13b5c0?_0x13b5c0['join'](','):[]);},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x4c'))?_[_0x0a9e('0x4d')](this[_0x0a9e('0x8')](_0x0a9e('0x4c'))[_0x0a9e('0x2d')](','),function(_0xeef20){return parseInt(_0xeef20,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x0a9e('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0x0a9e('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x0a9e('0x4e')],'get':function(){return this[_0x0a9e('0x8')]('phoneBarEnableScreenRecordingByAgent')?this[_0x0a9e('0x8')](_0x0a9e('0x4f')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![],'set':function(_0xdb98ca){if(typeof _0xdb98ca===_0x0a9e('0x50')){var _0x3df0e3=_0xdb98ca==='1'?!![]:_0xdb98ca==='0'?![]:_0xdb98ca===_0x0a9e('0x51')?!![]:_0xdb98ca===_0x0a9e('0x52')?![]:![];this[_0x0a9e('0x4')](_0x0a9e('0x53'),_0x3df0e3);}else{this[_0x0a9e('0x4')](_0x0a9e('0x53'),_0xdb98ca);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0xf4120f){this[_0x0a9e('0x4')](_0x0a9e('0x54'),_0xf4120f);if(_0xf4120f===!![]){this['setDataValue'](_0x0a9e('0x55'),moment());this[_0x0a9e('0x4')](_0x0a9e('0x56'),0x0);}else{this[_0x0a9e('0x4')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x0a9e('0xf')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0}}; \ No newline at end of file +var _0xedd9=['rfc2833','info','shortinfo','inband','auto','yes','update','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','refuse','originate','uas','certificate','active','passive','actpass','nonat','update,nonat','DATE','showWebBar','get','isArray','wss','encryption','force_avp','icesupport','dtlsverify','rtcp_mux','dtlsenable','dtlssetup','dtlscertfile','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','/etc/pki/tls/private/motion.key','TEXT','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','false','screenrecording','blocked','loginAttempts','blockedAt','UNSIGNED','moment','util','lodash','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','callerid','format','\x22%s\x22\x20<%s>','internal','email','ENUM','admin','user','agent','telephone','local','accountcode','getDataValue','fullname','BOOLEAN','INTEGER','dynamic','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'];(function(_0x4732be,_0x3cf1ce){var _0x24f4eb=function(_0x28db31){while(--_0x28db31){_0x4732be['push'](_0x4732be['shift']());}};_0x24f4eb(++_0x3cf1ce);}(_0xedd9,0xfc));var _0x9edd=function(_0x436c56,_0x2af9da){_0x436c56=_0x436c56-0x0;var _0x1fc13f=_0xedd9[_0x436c56];return _0x1fc13f;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x9edd('0x0'));var util=require(_0x9edd('0x1'));var _=require(_0x9edd('0x2'));module[_0x9edd('0x3')]={'name':{'type':Sequelize[_0x9edd('0x4')],'allowNull':![],'unique':_0x9edd('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x3e6d3a){this[_0x9edd('0x6')]('name',_0x3e6d3a);this[_0x9edd('0x6')](_0x9edd('0x7'),_0x3e6d3a);},'comment':_0x9edd('0x8')},'fullname':{'type':Sequelize[_0x9edd('0x4')],'allowNull':![],'set':function(_0x5319f7){this[_0x9edd('0x6')]('fullname',_0x5319f7);this[_0x9edd('0x6')](_0x9edd('0x9'),util[_0x9edd('0xa')](_0x9edd('0xb'),_0x5319f7,this['getDataValue'](_0x9edd('0xc'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x9edd('0x4')],'allowNull':![],'unique':_0x9edd('0xd'),'validate':{'isEmail':!![]},'set':function(_0x523026){if(_0x523026){this[_0x9edd('0x6')](_0x9edd('0xd'),_0x523026['toLowerCase']());}}},'role':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0xf'),_0x9edd('0x10'),_0x9edd('0x11'),_0x9edd('0x12')),'allowNull':![]},'password':{'type':Sequelize[_0x9edd('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x9edd('0x4')],'defaultValue':_0x9edd('0x13')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0x9edd('0xc'),'set':function(_0x44fc7c){this[_0x9edd('0x6')](_0x9edd('0xc'),_0x44fc7c);this[_0x9edd('0x6')](_0x9edd('0x14'),_0x44fc7c);this[_0x9edd('0x6')](_0x9edd('0x9'),util['format'](_0x9edd('0xb'),this[_0x9edd('0x15')](_0x9edd('0x16')),_0x44fc7c));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x9edd('0x4')]},'mobile':{'type':Sequelize[_0x9edd('0x4')]},'address':{'type':Sequelize[_0x9edd('0x4')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0x9edd('0x4')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x9edd('0x4')]},'online':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x9edd('0x4')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x9edd('0x18')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x9edd('0x19')},'ipaddr':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'port':{'type':Sequelize[_0x9edd('0x18')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x1a'),'user',_0x9edd('0x1b')),'allowNull':!![],'defaultValue':_0x9edd('0x1a')},'context':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![],'defaultValue':_0x9edd('0x1c')},'callingpres':{'type':Sequelize['ENUM'](_0x9edd('0x1d'),_0x9edd('0x1e'),_0x9edd('0x1f'),_0x9edd('0x20'),_0x9edd('0x21'),_0x9edd('0x22'),_0x9edd('0x23'),_0x9edd('0x24')),'allowNull':!![]},'deny':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'permit':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'secret':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'transport':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![],'defaultValue':_0x9edd('0x25'),'set':function(_0x5af178){this[_0x9edd('0x6')](_0x9edd('0x26'),_0x5af178?_0x5af178[_0x9edd('0x27')](','):null);},'get':function(){return this['getDataValue'](_0x9edd('0x26'))?this[_0x9edd('0x15')](_0x9edd('0x26'))[_0x9edd('0x28')](','):null;},'comment':_0x9edd('0x29')},'dtmfmode':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2a'),_0x9edd('0x2b'),_0x9edd('0x2c'),_0x9edd('0x2d'),_0x9edd('0x2e')),'allowNull':!![],'defaultValue':_0x9edd('0x2a')},'directmedia':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no','nonat',_0x9edd('0x30'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'nat':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x6de835){this[_0x9edd('0x6')](_0x9edd('0x31'),_0x6de835?_0x6de835[_0x9edd('0x27')](','):null);},'get':function(){return this[_0x9edd('0x15')](_0x9edd('0x31'))?this[_0x9edd('0x15')](_0x9edd('0x31'))[_0x9edd('0x28')](','):null;},'comment':_0x9edd('0x32')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x9edd('0x4')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x9edd('0x4')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x9edd('0x4')]},'disallow':{'type':Sequelize[_0x9edd('0x4')],'allowNull':![],'defaultValue':_0x9edd('0x33')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x9edd('0x34'),'set':function(_0xcbd0ef){this[_0x9edd('0x6')]('allow',_0xcbd0ef?_0xcbd0ef[_0x9edd('0x27')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x9edd('0x15')](_0x9edd('0x35'))?this['getDataValue'](_0x9edd('0x35'))[_0x9edd('0x28')](';'):null;},'comment':_0x9edd('0x36')},'autoframing':{'type':Sequelize[_0x9edd('0xe')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![],'set':function(_0x5bbdf8){this[_0x9edd('0x6')](_0x9edd('0x37'),_0x5bbdf8?_0x5bbdf8['join'](','):null);},'get':function(){return this[_0x9edd('0x15')]('insecure')?this['getDataValue'](_0x9edd('0x37'))[_0x9edd('0x28')](','):null;},'comment':_0x9edd('0x38')},'trustrpid':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no',_0x9edd('0x39')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![],'defaultValue':_0x9edd('0x3a')},'amaflags':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no'),'allowNull':!![],'defaultValue':_0x9edd('0x2f')},'busylevel':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0x9edd('0x2f'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0x9edd('0x2f'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'template':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0x9edd('0x2f'),'no',_0x9edd('0x3b')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x9edd('0x2f'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x3c'),_0x9edd('0x3d'),_0x9edd('0x3e')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x9edd('0xe')]('uac',_0x9edd('0x3f')),'allowNull':!![],'defaultValue':_0x9edd('0x3f')},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0x9edd('0x2f'),'no'),'allowNull':!![],'defaultValue':_0x9edd('0x2f')},'keepalive':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x9edd('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0x9edd('0x2f'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x9edd('0x2f'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM']('yes','no','fingerprint',_0x9edd('0x40')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x41'),_0x9edd('0x42'),_0x9edd('0x43')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x9edd('0x2f'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x9edd('0xe')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no',_0x9edd('0x44'),_0x9edd('0x30'),_0x9edd('0x45')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x9edd('0x46')],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0,'set':function(_0x3e9a3e){this[_0x9edd('0x6')](_0x9edd('0x47'),_0x3e9a3e);var _0x5df1d7=this[_0x9edd('0x48')]({'plain':!![]});switch(_0x3e9a3e){case 0x0:case 0x1:var _0x507cce=_0x5df1d7[_0x9edd('0x26')]?_[_0x9edd('0x49')](_0x5df1d7[_0x9edd('0x26')])?_0x5df1d7['transport'][_0x9edd('0x27')]():_0x5df1d7['transport']:_0x9edd('0x25');if(_0x507cce===_0x9edd('0x4a')){_0x507cce='udp';}this[_0x9edd('0x6')]('transport',_0x507cce);this[_0x9edd('0x6')](_0x9edd('0x4b'),'no');this[_0x9edd('0x6')]('avpf',null);this[_0x9edd('0x6')](_0x9edd('0x4c'),null);this[_0x9edd('0x6')](_0x9edd('0x4d'),null);this[_0x9edd('0x6')]('dtlsenable',null);this['setDataValue'](_0x9edd('0x4e'),null);this[_0x9edd('0x6')]('dtlssetup',null);this['setDataValue']('dtlscertfile',null);this[_0x9edd('0x6')]('dtlsprivatekey',null);this['setDataValue'](_0x9edd('0x4f'),'no');break;case 0x2:this[_0x9edd('0x6')]('transport',_0x9edd('0x4a'));this[_0x9edd('0x6')](_0x9edd('0x4b'),'yes');this[_0x9edd('0x6')]('avpf',_0x9edd('0x2f'));this[_0x9edd('0x6')]('force_avp',_0x9edd('0x2f'));this[_0x9edd('0x6')]('icesupport',_0x9edd('0x2f'));this[_0x9edd('0x6')](_0x9edd('0x50'),_0x9edd('0x2f'));this['setDataValue'](_0x9edd('0x4e'),'no');this['setDataValue'](_0x9edd('0x51'),_0x9edd('0x43'));this[_0x9edd('0x6')]('dtlscertfile',_0x5df1d7[_0x9edd('0x52')]||_0x9edd('0x53'));this[_0x9edd('0x6')](_0x9edd('0x54'),_0x5df1d7[_0x9edd('0x54')]||_0x9edd('0x55'));this[_0x9edd('0x6')]('rtcp_mux','yes');break;default:}}},'permissions':{'type':Sequelize[_0x9edd('0x56')],'set':function(_0x3c7874){this[_0x9edd('0x6')](_0x9edd('0x57'),_0x3c7874?_0x3c7874[_0x9edd('0x27')](','):[]);},'get':function(){return this['getDataValue'](_0x9edd('0x57'))?_[_0x9edd('0x58')](this[_0x9edd('0x15')]('permissions')[_0x9edd('0x28')](','),function(_0x29d70d){return parseInt(_0x29d70d,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0x9edd('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0x9edd('0x4')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x9edd('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x9edd('0xe')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x9edd('0x4')]},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x9edd('0x59')],'get':function(){return this[_0x9edd('0x15')](_0x9edd('0x5a'))?this['getDataValue']('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'interface':{'type':Sequelize[_0x9edd('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![],'set':function(_0x1eabcd){if(typeof _0x1eabcd===_0x9edd('0x5b')){var _0xef1397=_0x1eabcd==='1'?!![]:_0x1eabcd==='0'?![]:_0x1eabcd==='true'?!![]:_0x1eabcd===_0x9edd('0x5c')?![]:![];this[_0x9edd('0x6')](_0x9edd('0x5d'),_0xef1397);}else{this[_0x9edd('0x6')](_0x9edd('0x5d'),_0x1eabcd);}}},'blocked':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![],'set':function(_0x14fa8a){this['setDataValue'](_0x9edd('0x5e'),_0x14fa8a);if(_0x14fa8a===!![]){this[_0x9edd('0x6')]('blockedAt',moment());this[_0x9edd('0x6')](_0x9edd('0x5f'),0x0);}else{this['setDataValue'](_0x9edd('0x60'),null);}}},'blockedAt':{'type':Sequelize[_0x9edd('0x46')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x9edd('0x18')](0x5)[_0x9edd('0x61')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 6cb03e7..09bbbd5 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 _0x18b3=['../../mysqldb','socket.io-emitter','./user.socket','redis','client','http','sendStatus','status','end','undefined','count','offset','Content-Range','json','update','then','agent','emit','userNotification:recalc:','destroy','get','role','admin','Users','user','Agents','Telephones','telephone','filter','ignore','map','value','includes','find','UserProfileResource','error','stack','name','User','rawAttributes','fieldName','type','key','salt','previousPasswords','resetPasswordToken','md5secret','index','getOptions','where','query','includeAll','include','userSetting','UserSetting','attributes','push','findAll','rows','openTabs','true','length','dataValues','fax','mail','catch','show','params','merge','options','sms','whatsapp','all','body','describe','addContacts','omit','ids','internal','Setting','findById','max','isNil','min_internal','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','sequelize','QueryTypes','from','voicemail','mailbox','VoiceMail','email','permissions','101','102','103','113','110','104','105','106','107','109','100','111','115','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','settingsEnabled','userProfileId','UserProfileSection','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','checkUserLimits','isEmpty','autoAssociation','compact','changePassword','oldPassword','newPassword','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Sequelize','Invalid\x20body\x20format.\x20Use\x20newPassword','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordHistory','updatePasswordsHistory','addQueues','channel','interface','isValidChannel','add','capitalize','toLowerCase','Queues','Queue:save','voice','online','SIP/%s','voicePause','penalty','UserVoiceQueueRt','upsert','removeQueues','Unknown\x20channel','isArray','Queue:remove','file','filename','join','server/files/images/logos/default_profile.png','userpic','existsSync','server/files/images/','download','root','getOpenTabs','chat','openchannel','CHAT','createdAt','FaxOpenTabs','FAX','OpenchannelOpenTabs','MailOpenTabs','MAIL','SmsOpenTabs','SMS','WhatsappOpenTabs','WHATSAPP','concat','getContacts','findOne','format','User\x20with\x20id\x20%s\x20not\x20found','hasOwnProperty','CmList','List','Tag','Tags','color','tag','getQueues','model','keys','Queue','intersection','fields','order','sort','filters','nolimit','limit','pick','getVoiceQueuesRt','getGroups','ChatGroup','getRecordings','VoiceRecording','UserId','ScreenRecording','ChatInteraction','getChatInteractions','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','getSmsInteractions','getFaxInteractions','FaxInteraction','getWhatsappInteractions','WhatsappInteraction','phone','mobile','loginInPause','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','MemberReport','forEach','LOGIN','device','LOGININPAUSE','YYYY-MM-DD\x20HH:mm:ss','isMiddleware','resolve','logout','pause','PAUSE','updateAttributes','getChannels','bulkCreate','DEFAULT\x20PAUSE','unpause','Channel\x20parameter\x20%s\x20is\x20invalid','mailPause','chatPause','faxPause','smsPause','whatsappPause','pauseType','lastPauseAt','getTeams','Team','addTeams','Body\x20parameter\x20\x27ids\x27\x20is\x20required','transaction','flattenDeep','addAgent','getDataValue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','removeTeams','Query\x20parameter\x20\x27ids\x27\x20is\x20required','getAssociatedQueues','removeAgent','Voice','QueueId','getLists','getAgents','send','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','spread','user_has_chat_interactions:save','user_has_chat_interactions:remove','addMailInteractions','removeMailInteractions','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','getFaxAccounts','FaxAccount','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','OpenchannelAccount','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getScheduledCalls','CmHopper','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$in','$notIn','$like','$notLike','$iLike','$overlap','$contains','$contained','$any','firstName','CmContact','Contact','getApiKey','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','createApiKey','generateApiKey','iat','nonce','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','Unable\x20to\x20retrieve\x20the\x20current\x20user','getUserSetting','getPresence','teams','queues','inbound','flatten','lower','col','toString','asc','uniqBy','orderBy','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','offline','unknown','unavailable','ringing','voiceStatus','busy','slice','charAt','SELECT','ui.','field','ui.createdAt','user_has_','_interactions','ui.UserId\x20=\x20?','util','path','jayson/promise','ioredis','../../components/auth/service','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../errors/api','APIBadRequestError','APINotFoundError','handleError'];(function(_0x13b330,_0x297092){var _0x1f666c=function(_0x5ebc84){while(--_0x5ebc84){_0x13b330['push'](_0x13b330['shift']());}};_0x1f666c(++_0x297092);}(_0x18b3,0x185));var _0x318b=function(_0x3ddd9a,_0xe15a81){_0x3ddd9a=_0x3ddd9a-0x0;var _0x441c95=_0x18b3[_0x3ddd9a];return _0x441c95;};'use strict';var moment=require('moment');var util=require(_0x318b('0x0'));var path=require(_0x318b('0x1'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var jayson=require(_0x318b('0x2'));var Redis=require(_0x318b('0x3'));var authService=require(_0x318b('0x4'));var contacts=require(_0x318b('0x5'));var qs=require(_0x318b('0x6'));var logger=require(_0x318b('0x7'))(_0x318b('0x8'));var utils=require(_0x318b('0x9'));var config=require(_0x318b('0xa'));var licenseUtil=require(_0x318b('0xb'));var APIBadRequestError=require(_0x318b('0xc'))[_0x318b('0xd')];var APINotFoundError=require(_0x318b('0xc'))[_0x318b('0xe')];var APIHandleError=require('../../errors/api')[_0x318b('0xf')];var db=require(_0x318b('0x10'))['db'];var socket=require(_0x318b('0x11'))(new Redis(config['redis']));require(_0x318b('0x12'))['register'](socket);config[_0x318b('0x13')]=_['defaults'](config[_0x318b('0x13')],{'host':'localhost','port':0x18eb});var amiClient=jayson[_0x318b('0x14')][_0x318b('0x15')]({'port':0x232a});var values;function respondWithStatusCode(_0x181475,_0x1fe9d8){_0x1fe9d8=_0x1fe9d8||0xcc;return function(_0x392ce9){if(_0x392ce9){return _0x181475[_0x318b('0x16')](_0x1fe9d8);}return _0x181475[_0x318b('0x17')](_0x1fe9d8)[_0x318b('0x18')]();};}function respondWithResult(_0x2e2fdf,_0xbf7857){_0xbf7857=_0xbf7857||0xc8;return function(_0x29a8a6){if(_0x29a8a6){return _0x2e2fdf[_0x318b('0x17')](_0xbf7857)['json'](_0x29a8a6);}};}function respondWithFilteredResult(_0x3c0242,_0x390957){return function(_0x4e0fb9){if(_0x4e0fb9){var _0x512ad7=typeof _0x390957['offset']===_0x318b('0x19')&&typeof _0x390957['limit']===_0x318b('0x19');var _0x5b0d81=_0x4e0fb9[_0x318b('0x1a')];var _0x472c71=_0x512ad7?0x0:_0x390957[_0x318b('0x1b')];var _0x277154=_0x512ad7?_0x4e0fb9[_0x318b('0x1a')]:_0x390957['offset']+_0x390957['limit'];var _0x2c0eeb;if(_0x277154>=_0x5b0d81){_0x277154=_0x5b0d81;_0x2c0eeb=0xc8;}else{_0x2c0eeb=0xce;}_0x3c0242[_0x318b('0x17')](_0x2c0eeb);return _0x3c0242['set'](_0x318b('0x1c'),_0x472c71+'-'+_0x277154+'/'+_0x5b0d81)[_0x318b('0x1d')](_0x4e0fb9);}return null;};}function saveUpdates(_0x58d675){return function(_0x5cf0a7){if(_0x5cf0a7){return _0x5cf0a7[_0x318b('0x1e')](_0x58d675)[_0x318b('0x1f')](function(_0x2ec2c9){if(_0x2ec2c9['role']===_0x318b('0x20')){socket[_0x318b('0x21')](_0x318b('0x22')+_0x2ec2c9['id'],_0x2ec2c9);}return _0x2ec2c9;});}return null;};}function removeEntity(_0x3e0c10){return function(_0xb0ee70){if(_0xb0ee70){return _0xb0ee70[_0x318b('0x23')]()[_0x318b('0x1f')](function(){var _0x5831f2=_0xb0ee70[_0x318b('0x24')]({'plain':!![]});if(_0x5831f2[_0x318b('0x25')]===_0x318b('0x26'))return;var _0x3d35d5=[{'name':_0x318b('0x27'),'value':_0x318b('0x28'),'ignore':!![]},{'name':_0x318b('0x29'),'value':'agent','ignore':![]},{'name':_0x318b('0x2a'),'value':_0x318b('0x2b'),'ignore':![]}];var _0x547d95=_(_0x3d35d5)[_0x318b('0x2c')](_0x318b('0x2d'))[_0x318b('0x2e')](_0x318b('0x2f'))[_0x318b('0x2f')]();if(_[_0x318b('0x30')](_0x547d95,_0x5831f2[_0x318b('0x25')])){return;}var _0x46c22c=_[_0x318b('0x31')](_0x3d35d5,['value',_0x5831f2[_0x318b('0x25')]])['name'];return db[_0x318b('0x32')][_0x318b('0x23')]({'where':{'type':_0x46c22c,'resourceId':_0x5831f2['id']}})[_0x318b('0x1f')](function(){return _0xb0ee70;});})[_0x318b('0x1f')](function(){_0x3e0c10['status'](0xcc)[_0x318b('0x18')]();});}};}function handleEntityNotFound(_0x331c9a){return function(_0x606dff){if(!_0x606dff){_0x331c9a['sendStatus'](0x194);}return _0x606dff;};}function handleError(_0x2a116d,_0x61feb4){_0x61feb4=_0x61feb4||0x1f4;return function(_0x5d4409){logger[_0x318b('0x33')](_0x5d4409[_0x318b('0x34')]);if(_0x5d4409[_0x318b('0x35')]){delete _0x5d4409['name'];}_0x2a116d[_0x318b('0x17')](_0x61feb4)['send'](_0x5d4409);};}function getUserAttributes(){return _(db[_0x318b('0x36')][_0x318b('0x37')])[_0x318b('0x2e')](function(_0x47b66d){return{'name':_0x47b66d[_0x318b('0x38')],'type':_0x47b66d[_0x318b('0x39')][_0x318b('0x3a')]};})['filter'](function(_0x3a4da8){return!['password',_0x318b('0x3b'),_0x318b('0x3c'),_0x318b('0x3d'),'resetPasswordExpires','passwordResetAt',_0x318b('0x3e')][_0x318b('0x30')](_0x3a4da8[_0x318b('0x35')]);})[_0x318b('0x2f')]();}exports[_0x318b('0x3f')]=function(_0x536294,_0x490d06){var _0x22d294={},_0x390a04={'count':0x0,'rows':[]};var _0x1b7078=getUserAttributes();_0x22d294=qs[_0x318b('0x40')](_0x1b7078,_0x536294);var _0x588226={'where':_0x22d294[_0x318b('0x41')]};return db[_0x318b('0x36')][_0x318b('0x1a')](_0x588226)['then'](function(_0x51d7ea){_0x390a04[_0x318b('0x1a')]=_0x51d7ea;if(_0x536294[_0x318b('0x42')][_0x318b('0x43')]){_0x22d294[_0x318b('0x44')]=[{'all':!![]}];}if(_0x536294[_0x318b('0x42')][_0x318b('0x45')]==='true'){_0x22d294[_0x318b('0x44')]=[{'model':db[_0x318b('0x46')],'as':_0x318b('0x45')}];}if(!_['includes'](_0x22d294[_0x318b('0x47')],'id')){_0x22d294[_0x318b('0x47')][_0x318b('0x48')]('id');}return db[_0x318b('0x36')][_0x318b('0x49')](_0x22d294);})[_0x318b('0x1f')](function(_0x1fc2ed){_0x390a04[_0x318b('0x4a')]=_0x1fc2ed;if(_0x536294[_0x318b('0x42')][_0x318b('0x4b')]===_0x318b('0x4c')){var _0x4dd692=[];for(var _0x364e26=0x0;_0x364e26<_0x390a04[_0x318b('0x4a')][_0x318b('0x4d')];_0x364e26++){_0x4dd692[_0x318b('0x48')](get_open_tabs('chat',_0x390a04['rows'][_0x364e26]['dataValues']));_0x4dd692[_0x318b('0x48')](get_open_tabs('sms',_0x390a04[_0x318b('0x4a')][_0x364e26][_0x318b('0x4e')]));_0x4dd692[_0x318b('0x48')](get_open_tabs(_0x318b('0x4f'),_0x390a04[_0x318b('0x4a')][_0x364e26]['dataValues']));_0x4dd692[_0x318b('0x48')](get_open_tabs(_0x318b('0x50'),_0x390a04['rows'][_0x364e26]['dataValues']));_0x4dd692[_0x318b('0x48')](get_open_tabs('openchannel',_0x390a04[_0x318b('0x4a')][_0x364e26][_0x318b('0x4e')]));_0x4dd692[_0x318b('0x48')](get_open_tabs('whatsapp',_0x390a04[_0x318b('0x4a')][_0x364e26][_0x318b('0x4e')]));}return Promise['all'](_0x4dd692)['then'](function(){return _0x390a04;});}else{return _0x390a04;}})[_0x318b('0x1f')](respondWithFilteredResult(_0x490d06,_0x22d294))[_0x318b('0x51')](handleError(_0x490d06,null));};exports[_0x318b('0x52')]=function(_0x428246,_0x3ab7b3){var _0x1982e3=getUserAttributes();_0x428246[_0x318b('0x42')]['id']=_0x428246[_0x318b('0x53')]['id'];var _0x13192b=qs['getOptions'](_0x1982e3,_0x428246);if(_0x428246[_0x318b('0x42')]['includeAll']){_0x13192b['include']=[{'all':!![]}];}if(_0x428246['query'][_0x318b('0x45')]==='true'){_0x13192b[_0x318b('0x44')]=[{'model':db['UserSetting'],'as':'userSetting'}];}_0x13192b=_[_0x318b('0x54')]({},_0x13192b,_0x428246[_0x318b('0x55')]);if(!_['includes'](_0x13192b[_0x318b('0x47')],'id')){_0x13192b[_0x318b('0x47')][_0x318b('0x48')]('id');}return db['User'][_0x318b('0x31')](_0x13192b)['then'](handleEntityNotFound(_0x3ab7b3,null))[_0x318b('0x1f')](function(_0x3b5399){var _0x14624d=[];values=_0x3b5399;if(_0x428246[_0x318b('0x42')][_0x318b('0x4b')]===_0x318b('0x4c')){_0x14624d[_0x318b('0x48')](get_open_tabs('chat',_0x3b5399[_0x318b('0x4e')]));_0x14624d[_0x318b('0x48')](get_open_tabs(_0x318b('0x56'),_0x3b5399[_0x318b('0x4e')]));_0x14624d['push'](get_open_tabs('openchannel',_0x3b5399[_0x318b('0x4e')]));_0x14624d['push'](get_open_tabs(_0x318b('0x57'),_0x3b5399['dataValues']));_0x14624d[_0x318b('0x48')](get_open_tabs('fax',_0x3b5399[_0x318b('0x4e')]));_0x14624d[_0x318b('0x48')](get_open_tabs(_0x318b('0x50'),_0x3b5399[_0x318b('0x4e')]));return Promise[_0x318b('0x58')](_0x14624d);}else{return values;}})[_0x318b('0x1f')](function(){return values;})[_0x318b('0x1f')](respondWithResult(_0x3ab7b3,null))[_0x318b('0x51')](handleError(_0x3ab7b3,null));};exports[_0x318b('0x1e')]=function(_0xd0387a,_0x4762e7){if(_0xd0387a[_0x318b('0x59')]['id']){delete _0xd0387a['body']['id'];}delete _0xd0387a['body'][_0x318b('0x25')];return db['User'][_0x318b('0x31')]({'where':{'id':_0xd0387a[_0x318b('0x53')]['id']}})[_0x318b('0x1f')](handleEntityNotFound(_0x4762e7,null))[_0x318b('0x1f')](saveUpdates(_0xd0387a[_0x318b('0x59')],null))['then'](respondWithResult(_0x4762e7,null))['catch'](handleError(_0x4762e7,null));};exports[_0x318b('0x5a')]=function(_0x5463cc,_0x3ac84b){return db[_0x318b('0x36')]['describe']()[_0x318b('0x1f')](respondWithResult(_0x3ac84b,null))[_0x318b('0x51')](handleError(_0x3ac84b,null));};exports['addContacts']=function(_0xf8604d,_0x4bb1de){return db[_0x318b('0x36')][_0x318b('0x31')]({'where':{'id':_0xf8604d[_0x318b('0x53')]['id']}})[_0x318b('0x1f')](handleEntityNotFound(_0x4bb1de,null))['then'](function(_0x2f15e0){if(_0x2f15e0){return _0x2f15e0[_0x318b('0x5b')](_0xf8604d[_0x318b('0x59')]['ids'],_[_0x318b('0x5c')](_0xf8604d['body'],[_0x318b('0x5d'),'id'])||{});}})[_0x318b('0x1f')](respondWithResult(_0x4bb1de,null))['catch'](handleError(_0x4bb1de,null));};function validateUser(_0x43d673){return new Promise(function(_0x54cdd4,_0x1ca7b4){if(_0x43d673[_0x318b('0x5e')])return _0x54cdd4(_0x43d673);return db[_0x318b('0x5f')][_0x318b('0x60')](0x1)['then'](function(_0xce097f){if(_0xce097f['securePassword'])authService['validatePasswordPattern'](_0x43d673['password']);db[_0x318b('0x36')][_0x318b('0x61')]('internal')['then'](function(_0x3ed54b){if(_[_0x318b('0x62')](_0x3ed54b)){_0x43d673[_0x318b('0x5e')]=_0xce097f['min_internal']||0x1;return;}if(_[_0x318b('0x62')](_0xce097f[_0x318b('0x63')])||_0xce097f[_0x318b('0x63')]===_0x3ed54b){_0x43d673[_0x318b('0x5e')]=_0x3ed54b+0x1;return;}if(_0xce097f[_0x318b('0x63')]>_0x3ed54b){_0x43d673[_0x318b('0x5e')]=_0xce097f['min_internal'];return;}return db['sequelize'][_0x318b('0x42')](_0x318b('0x64'),{'type':db[_0x318b('0x65')][_0x318b('0x66')]['SELECT']})[_0x318b('0x1f')](function(_0x45b2f6){if(_0x45b2f6&&_0x45b2f6[_0x318b('0x4d')]){for(var _0x2d3e06=0x0,_0x455cc3=_0x45b2f6[_0x318b('0x4d')];_0x2d3e06<_0x455cc3&&_[_0x318b('0x62')](_0x43d673[_0x318b('0x5e')]);_0x2d3e06++){if(_0xce097f[_0x318b('0x63')]<=_0x45b2f6[_0x2d3e06][_0x318b('0x67')]){_0x43d673[_0x318b('0x5e')]=_0x45b2f6[_0x2d3e06][_0x318b('0x67')];}else if(_0xce097f[_0x318b('0x63')]>_0x45b2f6[_0x2d3e06][_0x318b('0x67')]&&_0xce097f[_0x318b('0x63')]<=_0x45b2f6[_0x2d3e06]['to']){_0x43d673['internal']=_0xce097f[_0x318b('0x63')];}}}if(_[_0x318b('0x62')](_0x43d673[_0x318b('0x5e')])){_0x43d673[_0x318b('0x5e')]=_0x3ed54b+0x1;}return _0x54cdd4(_0x43d673);});});})[_0x318b('0x51')](function(_0x1a05d6){_0x1ca7b4(_0x1a05d6);});});}function updateUser(_0xcee7ec){return new Promise(function(_0x510d7b,_0x11e056){try{if(_0xcee7ec[_0x318b('0x68')]){_0xcee7ec[_0x318b('0x69')]=_0xcee7ec['internal'];_0xcee7ec[_0x318b('0x6a')]={'mailbox':_0xcee7ec[_0x318b('0x5e')],'password':_0xcee7ec['password'],'fullname':_0xcee7ec['fullname'],'email':_0xcee7ec[_0x318b('0x6b')]};}if(_0xcee7ec[_0x318b('0x25')]===_0x318b('0x20')){if(!_0xcee7ec[_0x318b('0x6c')])_0xcee7ec['permissions']=[_0x318b('0x6d'),_0x318b('0x6e'),_0x318b('0x6f'),_0x318b('0x70'),_0x318b('0x71'),_0x318b('0x72'),_0x318b('0x73'),_0x318b('0x74'),_0x318b('0x75'),'108',_0x318b('0x76'),_0x318b('0x77'),_0x318b('0x78'),'114',_0x318b('0x79')];}_0x510d7b(_0xcee7ec);}catch(_0x23d91b){_0x11e056(_0x23d91b);}});}exports['create']=function(_0x563589,_0x472f34){if(_0x563589[_0x318b('0x28')]['role']==='agent')throw new Error(_0x318b('0x7a'));if(_0x563589['body'][_0x318b('0x25')]===_0x318b('0x28')&&_0x563589[_0x318b('0x28')][_0x318b('0x25')]!==_0x318b('0x26')){throw new Error(_0x318b('0x7b'));}if(_0x563589[_0x318b('0x59')][_0x318b('0x25')]==='admin'&&_0x563589[_0x318b('0x28')]['role']!==_0x318b('0x26')){throw new Error(_0x318b('0x7c'));}return licenseUtil['checkUserLimits']([_0x563589[_0x318b('0x59')]])[_0x318b('0x1f')](function(){return validateUser(_0x563589[_0x318b('0x59')]);})[_0x318b('0x1f')](function(_0x50501e){return updateUser(_0x50501e)['then'](function(_0x575927){if(_0x575927[_0x318b('0x25')]===_0x318b('0x26')){_0x575927[_0x318b('0x7d')]=_0x563589[_0x318b('0x28')][_0x318b('0x7d')];delete _0x575927[_0x318b('0x7e')];}return _0x575927;});})[_0x318b('0x1f')](function(_0x330b03){return db[_0x318b('0x36')]['create'](_0x330b03,{'include':[{'model':db[_0x318b('0x6a')],'as':_0x318b('0x6a')}]});})[_0x318b('0x1f')](function(_0x5ebb10){if(_0x563589[_0x318b('0x59')][_0x318b('0x25')]==='user')return _0x5ebb10;if(_0x563589['user'][_0x318b('0x25')]!==_0x318b('0x28'))return _0x5ebb10;return db[_0x318b('0x7f')][_0x318b('0x31')]({'where':{'name':_0x5ebb10['role']===_0x318b('0x20')?_0x318b('0x29'):_0x318b('0x2a'),'userProfileId':_0x563589[_0x318b('0x28')][_0x318b('0x7e')]},'raw':!![]})[_0x318b('0x1f')](function(_0x406e9c){if(!_0x406e9c||_0x406e9c['autoAssociation']!=0x0)return _0x5ebb10;return db[_0x318b('0x32')][_0x318b('0x80')]({'name':_0x5ebb10['name'],'resourceId':_0x5ebb10['id'],'type':_0x406e9c[_0x318b('0x35')],'sectionId':_0x406e9c['id']},{})[_0x318b('0x1f')](function(){return _0x5ebb10;});})[_0x318b('0x51')](function(_0x6d1d83){logger['error'](_0x318b('0x81'),_0x6d1d83);throw _0x6d1d83;});})[_0x318b('0x1f')](respondWithResult(_0x472f34,0xc9))[_0x318b('0x51')](handleError(_0x472f34,null));};exports['bulkCreate']=function(_0x51fc95,_0xcf1dec){var _0x23f053=_0x51fc95[_0x318b('0x59')];var _0x32a91c=[];if(_0x51fc95['user'][_0x318b('0x25')]===_0x318b('0x20'))throw new Error(_0x318b('0x7a'));if(_[_0x318b('0x82')](_0x23f053,[_0x318b('0x25'),_0x318b('0x28')])&&_0x51fc95['user'][_0x318b('0x25')]!==_0x318b('0x26')){throw new Error(_0x318b('0x7b'));}if(_[_0x318b('0x82')](_0x23f053,['role',_0x318b('0x26')])&&_0x51fc95[_0x318b('0x28')][_0x318b('0x25')]!==_0x318b('0x26')){throw new Error(_0x318b('0x83'));}return licenseUtil[_0x318b('0x84')](_0x23f053)[_0x318b('0x1f')](function(){return validateUser(_0x23f053[0x0]);})[_0x318b('0x1f')](function(){for(var _0x51dfd1=0x1;_0x51dfd1<_0x23f053[_0x318b('0x4d')];_0x51dfd1++){var _0x3071e9=_0x23f053[_0x51dfd1-0x1][_0x318b('0x5e')];if(!_0x23f053[_0x51dfd1][_0x318b('0x5e')])_0x23f053[_0x51dfd1]['internal']=_0x3071e9+0x1;_0x32a91c[_0x318b('0x48')](validateUser(_0x23f053[_0x51dfd1]));}return Promise[_0x318b('0x58')](_0x32a91c);})['then'](function(){_0x32a91c=[];for(var _0x477777=0x0;_0x477777<_0x23f053['length'];_0x477777++){_0x32a91c[_0x318b('0x48')](updateUser(_0x23f053[_0x477777]));}return Promise[_0x318b('0x58')](_0x32a91c);})['then'](function(){_0x32a91c=_0x23f053['map'](function(_0x59db21){return db[_0x318b('0x36')][_0x318b('0x80')](_0x59db21,{'include':[{'model':db[_0x318b('0x6a')],'as':_0x318b('0x6a')}]})[_0x318b('0x1f')](function(_0x496202){_0x59db21['id']=_0x496202['id'];return _0x59db21;});});return Promise[_0x318b('0x58')](_0x32a91c);})['then'](function(_0x4f07f9){if(_0x51fc95[_0x318b('0x59')][_0x318b('0x25')]===_0x318b('0x28'))return _0x4f07f9;if(_0x51fc95[_0x318b('0x28')][_0x318b('0x25')]!=='user')return _0x4f07f9;var _0x35711b=_[_0x318b('0x82')](_0x4f07f9,function(_0x142548){return _0x142548[_0x318b('0x25')]===_0x318b('0x20')||_0x142548[_0x318b('0x25')]===_0x318b('0x2b');});if(!_0x35711b)return _0x4f07f9;return db[_0x318b('0x7f')][_0x318b('0x49')]({'where':{'name':{'$or':[_0x318b('0x29'),_0x318b('0x2a')]},'userProfileId':_0x51fc95['user'][_0x318b('0x7e')]},'raw':!![]})[_0x318b('0x1f')](function(_0x2d7bd1){if(_[_0x318b('0x85')](_0x2d7bd1)||!_['some'](_0x2d7bd1,[_0x318b('0x86'),0x0]))return _0x4f07f9;_0x32a91c=[];var _0x55a754=_(_0x2d7bd1)[_0x318b('0x2e')](function(_0x8cceff){if(_0x8cceff[_0x318b('0x86')]===0x1)return;return _0x8cceff[_0x318b('0x35')]===_0x318b('0x29')?_0x318b('0x20'):_0x318b('0x2b');})[_0x318b('0x87')]()[_0x318b('0x2f')]();for(var _0x1cbe12=0x0;_0x1cbe12<_0x4f07f9[_0x318b('0x4d')];_0x1cbe12++){if(!_[_0x318b('0x30')](_0x55a754,_0x4f07f9[_0x1cbe12]['role']))return;var _0x5c6dbd=_0x4f07f9[_0x1cbe12][_0x318b('0x25')]===_0x318b('0x20')?_0x318b('0x29'):_0x318b('0x2a');_0x32a91c[_0x318b('0x48')](db['UserProfileResource'][_0x318b('0x80')]({'name':_0x4f07f9[_0x1cbe12][_0x318b('0x35')],'resourceId':_0x4f07f9[_0x1cbe12]['id'],'type':_0x5c6dbd,'sectionId':_[_0x318b('0x31')](_0x2d7bd1,['name',_0x5c6dbd])['id']},{}));}return Promise[_0x318b('0x58')](_0x32a91c);});})[_0x318b('0x1f')](respondWithResult(_0xcf1dec,0xc9))[_0x318b('0x51')](handleError(_0xcf1dec,null));};exports[_0x318b('0x88')]=function(_0x3d7af4,_0x934036){if(_0x3d7af4[_0x318b('0x59')]['id']){delete _0x3d7af4['body']['id'];}return db[_0x318b('0x36')][_0x318b('0x31')]({'where':{'id':_0x3d7af4[_0x318b('0x53')]['id']}})[_0x318b('0x1f')](function(_0x2a6581){if(!_0x2a6581)return null;if(_0x2a6581['id']===_0x3d7af4['user']['id']){if(!_0x3d7af4['body'][_0x318b('0x89')]||!_0x3d7af4['body'][_0x318b('0x8a')]){throw new db['Sequelize'][(_0x318b('0x8b'))](_0x318b('0x8c'));}if(!_0x2a6581['authenticate'](_0x3d7af4[_0x318b('0x59')][_0x318b('0x89')])){throw new db['Sequelize'][(_0x318b('0x8b'))]('Wrong\x20credentials');}if(_0x3d7af4[_0x318b('0x59')]['oldPassword']===_0x3d7af4['body'][_0x318b('0x8a')]){throw new db['Sequelize']['ValidationError'](_0x318b('0x8d'));}}else if(_0x3d7af4['user'][_0x318b('0x25')]===_0x318b('0x26')){if(!_0x3d7af4['body'][_0x318b('0x8a')]){throw new db[(_0x318b('0x8e'))]['ValidationError']('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x3d7af4[_0x318b('0x28')][_0x318b('0x25')]==='user'){if(!_0x3d7af4[_0x318b('0x59')][_0x318b('0x8a')]){throw new db[(_0x318b('0x8e'))][(_0x318b('0x8b'))](_0x318b('0x8f'));}if(_0x2a6581['role']!==_0x318b('0x20')){throw new db['Sequelize'][(_0x318b('0x8b'))]('Unauthorized');}}else{throw new db[(_0x318b('0x8e'))][(_0x318b('0x8b'))](_0x318b('0x7a'));}return _0x2a6581;})[_0x318b('0x1f')](handleEntityNotFound(_0x934036,null))[_0x318b('0x1f')](function(_0x60ef1e){return db['Setting']['findOne']({'attributes':['id',_0x318b('0x90'),_0x318b('0x91'),_0x318b('0x92')]})[_0x318b('0x1f')](function(_0x94aa48){if(_0x94aa48['securePassword'])authService['validatePasswordPattern'](_0x3d7af4[_0x318b('0x59')][_0x318b('0x8a')]);if(!_0x94aa48[_0x318b('0x91')]||!_0x60ef1e[_0x318b('0x3c')])return _0x60ef1e;authService[_0x318b('0x93')](_0x3d7af4[_0x318b('0x59')][_0x318b('0x8a')],_0x60ef1e[_0x318b('0x3c')],_0x94aa48[_0x318b('0x92')]);return _0x60ef1e;})[_0x318b('0x1f')](saveUpdates({'password':_0x3d7af4['body'][_0x318b('0x8a')],'passwordResetAt':_0x3d7af4[_0x318b('0x28')]['id']==_0x3d7af4[_0x318b('0x53')]['id']?moment():null,'previousPasswords':authService[_0x318b('0x94')](_0x3d7af4[_0x318b('0x59')][_0x318b('0x8a')],_0x60ef1e[_0x318b('0x3c')])},null));})[_0x318b('0x1f')](respondWithResult(_0x934036,null))[_0x318b('0x51')](handleError(_0x934036,null));};exports[_0x318b('0x95')]=function(_0x15055d,_0x5790ab){var _0x445d68=_0x15055d[_0x318b('0x59')][_0x318b('0x96')];return db[_0x318b('0x36')]['find']({'where':{'id':_0x15055d['params']['id']},'attributes':['id',_0x318b('0x35'),_0x318b('0x25'),'online','loginInPause','voicePause',_0x318b('0x97')]})['then'](handleEntityNotFound(_0x5790ab,null))[_0x318b('0x1f')](function(_0x38542b){if(_0x38542b){if(!utils[_0x318b('0x98')](_0x445d68)){throw new db[(_0x318b('0x8e'))][(_0x318b('0x8b'))]('Unknown\x20channel');}return _0x38542b[_0x318b('0x99')+_[_0x318b('0x9a')](_0x445d68[_0x318b('0x9b')]())+_0x318b('0x9c')](_0x15055d[_0x318b('0x59')][_0x318b('0x5d')],{'penalty':_0x15055d[_0x318b('0x59')]['penalty']||0x0})['spread'](function(_0x1f5ccd){for(var _0x4d175b=0x0;_0x4d175b<_0x15055d['body']['ids'][_0x318b('0x4d')];_0x4d175b+=0x1){var _0xb42e89={'UserId':Number(_0x15055d[_0x318b('0x53')]['id'])};_0xb42e89[_[_0x318b('0x9a')](_0x445d68[_0x318b('0x9b')]())+'QueueId']=Number(_0x15055d['body'][_0x318b('0x5d')][_0x4d175b]);socket['emit'](_0x318b('0x28')+_['capitalize'](_0x445d68['toLowerCase']())+_0x318b('0x9d'),_0xb42e89);}return _0x1f5ccd;})[_0x318b('0x1f')](function(){if(_0x445d68===_0x318b('0x9e')){return db['VoiceQueue'][_0x318b('0x49')]({'where':{'id':_0x15055d[_0x318b('0x59')][_0x318b('0x5d')]||[]},'raw':!![],'attributes':['id',_0x318b('0x35')]});}})[_0x318b('0x1f')](function(_0x426d21){var _0x49ba54=_0x38542b[_0x318b('0x24')]({'plain':!![]});var _0x150f17=[];if(_0x445d68===_0x318b('0x9e')&&_0x49ba54[_0x318b('0x25')]==='agent'&&_0x49ba54[_0x318b('0x9f')]){for(let _0x1ba0eb=0x0;_0x1ba0eb<_0x426d21[_0x318b('0x4d')];_0x1ba0eb+=0x1){_0x150f17[_0x318b('0x48')]({'membername':_0x49ba54[_0x318b('0x35')],'UserId':_0x49ba54['id'],'queue_name':_0x426d21[_0x1ba0eb][_0x318b('0x35')],'VoiceQueueId':_0x426d21[_0x1ba0eb]['id'],'interface':_[_0x318b('0x62')](_0x49ba54[_0x318b('0x97')])?util['format'](_0x318b('0xa0'),_0x49ba54[_0x318b('0x35')]):_0x49ba54['interface'],'paused':_0x49ba54[_0x318b('0xa1')]||![],'penalty':_0x15055d[_0x318b('0x59')][_0x318b('0xa2')]||0x0});}return Promise[_0x318b('0x58')](_0x150f17[_0x318b('0x2e')](function(_0x13914b){return db[_0x318b('0xa3')][_0x318b('0xa4')](_0x13914b);}));}return _0x38542b;});}})[_0x318b('0x1f')](respondWithStatusCode(_0x5790ab,null))[_0x318b('0x51')](handleError(_0x5790ab,null));};exports[_0x318b('0xa5')]=function(_0xfc72ee,_0x390c77){var _0x58ddbc,_0xb5e590;return db['User']['find']({'where':{'id':_0xfc72ee[_0x318b('0x53')]['id']},'attributes':['id','name',_0x318b('0x25')]})[_0x318b('0x1f')](handleEntityNotFound(_0x390c77,null))['then'](function(_0x297e34){if(_0x297e34){_0x58ddbc=_0x297e34;if(!_0xfc72ee[_0x318b('0x42')][_0x318b('0x96')]||!utils[_0x318b('0x98')](_0xfc72ee[_0x318b('0x42')][_0x318b('0x96')])){throw new db[(_0x318b('0x8e'))][(_0x318b('0x8b'))](_0x318b('0xa6'));}return _0x297e34['remove'+_['capitalize'](_0xfc72ee['query']['channel'][_0x318b('0x9b')]())+_0x318b('0x9c')](_0xfc72ee[_0x318b('0x42')][_0x318b('0x5d')]);}})['then'](function(_0xde0a98){if(_[_0x318b('0xa7')](_0xfc72ee[_0x318b('0x42')][_0x318b('0x5d')])){for(var _0x1f25c3=0x0;_0x1f25c3<_0xfc72ee[_0x318b('0x42')][_0x318b('0x5d')][_0x318b('0x4d')];_0x1f25c3+=0x1){_0xb5e590={'UserId':Number(_0xfc72ee[_0x318b('0x53')]['id'])};_0xb5e590[_['capitalize'](_0xfc72ee[_0x318b('0x42')][_0x318b('0x96')][_0x318b('0x9b')]())+'QueueId']=Number(_0xfc72ee['query'][_0x318b('0x5d')][_0x1f25c3]);socket[_0x318b('0x21')](_0x318b('0x28')+_[_0x318b('0x9a')](_0xfc72ee['query']['channel']['toLowerCase']())+_0x318b('0xa8'),_0xb5e590);}}else{_0xb5e590={'UserId':Number(_0xfc72ee[_0x318b('0x53')]['id'])};_0xb5e590[_[_0x318b('0x9a')](_0xfc72ee[_0x318b('0x42')][_0x318b('0x96')]['toLowerCase']())+'QueueId']=Number(_0xfc72ee['query'][_0x318b('0x5d')]);socket[_0x318b('0x21')](_0x318b('0x28')+_[_0x318b('0x9a')](_0xfc72ee[_0x318b('0x42')][_0x318b('0x96')][_0x318b('0x9b')]())+_0x318b('0xa8'),_0xb5e590);}return _0xde0a98;})[_0x318b('0x1f')](function(){if(_0xfc72ee[_0x318b('0x42')]['channel']===_0x318b('0x9e')){return db[_0x318b('0xa3')][_0x318b('0x23')]({'where':{'UserId':_0xfc72ee[_0x318b('0x53')]['id'],'VoiceQueueId':_0xfc72ee[_0x318b('0x42')][_0x318b('0x5d')]},'individualHooks':!![]})[_0x318b('0x1f')](function(){return _0x58ddbc;});}return _0x58ddbc;})[_0x318b('0x1f')](respondWithStatusCode(_0x390c77,null))[_0x318b('0x51')](handleError(_0x390c77,null));};exports['addAvatar']=function(_0x484243,_0x41ceba){_0x484243[_0x318b('0x59')]['userpic']=_0x484243[_0x318b('0xa9')][_0x318b('0xaa')];return db['User']['find']({'where':{'id':_0x484243[_0x318b('0x53')]['id']}})[_0x318b('0x1f')](handleEntityNotFound(_0x41ceba,null))[_0x318b('0x1f')](saveUpdates(_0x484243[_0x318b('0x59')],null))[_0x318b('0x1f')](respondWithResult(_0x41ceba,null))[_0x318b('0x51')](handleError(_0x41ceba,null));};exports['getAvatar']=function(_0x5cdd86,_0x32d8dc){var _0x378225=path[_0x318b('0xab')](config['root'],_0x318b('0xac'));return db[_0x318b('0x36')]['find']({'where':{'id':_0x5cdd86['params']['id']},'attributes':['id','userpic'],'raw':!![]})[_0x318b('0x1f')](handleEntityNotFound(_0x32d8dc,null))[_0x318b('0x1f')](function(_0x47e5ac){if(_0x47e5ac){if(_[_0x318b('0x62')](_0x47e5ac[_0x318b('0xad')])){return _0x32d8dc['download'](_0x378225);}else{if(!fs[_0x318b('0xae')](path['join'](config['root'],_0x318b('0xaf'),_0x47e5ac['userpic']))){return _0x32d8dc[_0x318b('0xb0')](_0x378225);}return _0x32d8dc[_0x318b('0xb0')](path[_0x318b('0xab')](config[_0x318b('0xb1')],_0x318b('0xaf'),_0x47e5ac[_0x318b('0xad')]));}}})[_0x318b('0x51')](handleError(_0x32d8dc,null));};exports[_0x318b('0xb2')]=function(_0x1b6ffe,_0x2b9dbc){return db[_0x318b('0x36')][_0x318b('0x31')]({'where':{'id':_0x1b6ffe[_0x318b('0x53')]['id']},'attributes':['id']})['then'](handleEntityNotFound(_0x2b9dbc,null))[_0x318b('0x1f')](function(_0x3dda1a){var _0x46aba3=[];values=_0x3dda1a['dataValues'];_0x46aba3[_0x318b('0x48')](get_open_tabs(_0x318b('0xb3'),_0x3dda1a[_0x318b('0x4e')]));_0x46aba3['push'](get_open_tabs(_0x318b('0x56'),_0x3dda1a[_0x318b('0x4e')]));_0x46aba3['push'](get_open_tabs(_0x318b('0xb4'),_0x3dda1a[_0x318b('0x4e')]));_0x46aba3[_0x318b('0x48')](get_open_tabs(_0x318b('0x57'),_0x3dda1a[_0x318b('0x4e')]));_0x46aba3[_0x318b('0x48')](get_open_tabs(_0x318b('0x4f'),_0x3dda1a[_0x318b('0x4e')]));_0x46aba3[_0x318b('0x48')](get_open_tabs(_0x318b('0x50'),_0x3dda1a[_0x318b('0x4e')]));return Promise[_0x318b('0x58')](_0x46aba3);})[_0x318b('0x1f')](function(_0x256335){if(_0x256335){var _0x5d24a9=_[_0x318b('0x2e')](values['ChatOpenTabs'],function(_0x121976){return{'channel':_0x318b('0xb5'),'id':_0x121976['id'],'createdAt':_0x121976[_0x318b('0xb6')]};});var _0x58d621=_[_0x318b('0x2e')](values[_0x318b('0xb7')],function(_0x637c90){return{'channel':_0x318b('0xb8'),'id':_0x637c90['id'],'createdAt':_0x637c90[_0x318b('0xb6')]};});var _0xb6b8e2=_[_0x318b('0x2e')](values[_0x318b('0xb9')],function(_0x523385){return{'channel':'OPENCHANNEL','id':_0x523385['id'],'createdAt':_0x523385[_0x318b('0xb6')]};});var _0x5f5ddf=_[_0x318b('0x2e')](values[_0x318b('0xba')],function(_0x199c7d){return{'channel':_0x318b('0xbb'),'id':_0x199c7d['id'],'createdAt':_0x199c7d['createdAt']};});var _0x57fcc1=_['map'](values[_0x318b('0xbc')],function(_0x4bc705){return{'channel':_0x318b('0xbd'),'id':_0x4bc705['id'],'createdAt':_0x4bc705[_0x318b('0xb6')]};});var _0x1cddad=_[_0x318b('0x2e')](values[_0x318b('0xbe')],function(_0x4a72d9){return{'channel':_0x318b('0xbf'),'id':_0x4a72d9['id'],'createdAt':_0x4a72d9[_0x318b('0xb6')]};});var _0x640952=_[_0x318b('0xc0')](_0x5d24a9,_0x58d621,_0xb6b8e2,_0x5f5ddf,_0x57fcc1,_0x1cddad);var _0x474e15={'count':_0x640952['length'],'rows':_0x640952};return _0x474e15;}else return null;})[_0x318b('0x1f')](respondWithResult(_0x2b9dbc,null))[_0x318b('0x51')](handleError(_0x2b9dbc,null));};exports[_0x318b('0xc1')]=function(_0xb66cf,_0x772e4f){var _0x3c3b40={};return db[_0x318b('0x36')][_0x318b('0xc2')]({'where':{'id':_0xb66cf[_0x318b('0x53')]['id']}})[_0x318b('0x1f')](function(_0xa1c797){if(!_0xa1c797){throw new APINotFoundError(util[_0x318b('0xc3')](_0x318b('0xc4'),_0xb66cf[_0x318b('0x53')]['id']));}return contacts[_0x318b('0x5a')]();})[_0x318b('0x1f')](function(_0x9d943c){_0xb66cf['query']['User']=_0xb66cf[_0x318b('0x53')]['id'];_0x3c3b40=qs[_0x318b('0x40')](_0x9d943c,_0xb66cf);if(_0xb66cf[_0x318b('0x42')][_0x318b('0xc5')](_0x318b('0x43'))){_0x3c3b40[_0x318b('0x44')]=[{'model':db[_0x318b('0xc6')],'as':_0x318b('0xc7'),'required':![]},{'model':db[_0x318b('0xc8')],'as':_0x318b('0xc9'),'attributes':['id',_0x318b('0x35'),_0x318b('0xca')],'where':_0xb66cf['query'][_0x318b('0xcb')]?{'id':_0xb66cf[_0x318b('0x42')]['tag']}:undefined,'required':_0xb66cf[_0x318b('0x42')][_0x318b('0xcb')]?!![]:![]}];}return contacts[_0x318b('0x49')](_0xb66cf[_0x318b('0x42')],_0xb66cf[_0x318b('0x28')],_0x3c3b40,_0x9d943c);})[_0x318b('0x1f')](respondWithFilteredResult(_0x772e4f,_0x3c3b40))['catch'](APIHandleError(_0x772e4f));};exports[_0x318b('0xcc')]=function(_0x33e145,_0x4db6ed){var _0x587786;var _0x48c734={};var _0x58593a;return db[_0x318b('0x36')][_0x318b('0xc2')]({'where':{'id':_0x33e145[_0x318b('0x53')]['id']},'attributes':['id',_0x318b('0x35'),_0x318b('0x25')]})[_0x318b('0x1f')](handleEntityNotFound(_0x4db6ed,null))[_0x318b('0x1f')](function(_0x49f638){if(!utils['isValidChannel'](_0x33e145['query'][_0x318b('0x96')])){throw new db[(_0x318b('0x8e'))][(_0x318b('0x8b'))]('Unknown\x20channel');}_0x587786=_0x49f638;var _0x419de9={};_0x419de9[_0x318b('0xcd')]=_[_0x318b('0xce')](db[_['capitalize'](_0x33e145[_0x318b('0x42')][_0x318b('0x96')])+_0x318b('0xcf')][_0x318b('0x37')]);_0x419de9[_0x318b('0x42')]=_[_0x318b('0xce')](_0x33e145['query']);_0x419de9['filters']=_[_0x318b('0xd0')](_0x419de9[_0x318b('0xcd')],_0x419de9[_0x318b('0x42')]);_0x48c734['attributes']=_[_0x318b('0xd0')](_0x419de9[_0x318b('0xcd')],qs[_0x318b('0xd1')](_0x33e145['query']['fields']));_0x48c734[_0x318b('0x47')]=_0x48c734[_0x318b('0x47')][_0x318b('0x4d')]?_0x48c734['attributes']:_0x419de9['model'];_0x48c734[_0x318b('0xd2')]=qs[_0x318b('0xd3')](_0x33e145[_0x318b('0x42')][_0x318b('0xd3')]);_0x48c734['where']=qs[_0x318b('0xd4')](_['pick'](_0x33e145[_0x318b('0x42')],_0x419de9[_0x318b('0xd4')]));if(_0x33e145[_0x318b('0x42')][_0x318b('0x2c')]){_0x48c734['where']=_['merge'](_0x48c734['where'],{'$or':_[_0x318b('0x2e')](_0x48c734['attributes'],function(_0x1feac7){var _0x331135={};_0x331135[_0x1feac7]={'$like':'%'+_0x33e145[_0x318b('0x42')][_0x318b('0x2c')]+'%'};return _0x331135;})});}_0x48c734=_[_0x318b('0x54')]({},_0x48c734,_0x33e145[_0x318b('0x55')]);switch(_0x587786[_0x318b('0x25')]){case'admin':return db[_['capitalize'](_0x33e145[_0x318b('0x42')][_0x318b('0x96')])+_0x318b('0xcf')][_0x318b('0x49')](_0x48c734);case _0x318b('0x28'):case _0x318b('0x20'):return _0x587786[_0x318b('0x24')+_[_0x318b('0x9a')](_0x33e145[_0x318b('0x42')]['channel'])+_0x318b('0x9c')](_0x48c734);default:throw new db['Sequelize'][(_0x318b('0x8b'))]('Unknown\x20role');}})[_0x318b('0x1f')](function(_0xae3b4a){_0x58593a=_0xae3b4a[_0x318b('0x4d')];if(!_0x33e145[_0x318b('0x42')][_0x318b('0xc5')](_0x318b('0xd5'))){_0x48c734['limit']=qs['limit'](_0x33e145[_0x318b('0x42')][_0x318b('0xd6')]);_0x48c734[_0x318b('0x1b')]=qs[_0x318b('0x1b')](_0x33e145[_0x318b('0x42')][_0x318b('0x1b')]);}switch(_0x587786[_0x318b('0x25')]){case _0x318b('0x26'):return db[_['capitalize'](_0x33e145[_0x318b('0x42')][_0x318b('0x96')])+_0x318b('0xcf')]['findAll'](_0x48c734);case _0x318b('0x28'):case _0x318b('0x20'):return _0x587786[_0x318b('0x24')+_[_0x318b('0x9a')](_0x33e145[_0x318b('0x42')][_0x318b('0x96')])+'Queues'](_0x48c734);}})[_0x318b('0x1f')](function(_0x5359c6){return{'count':_0x58593a,'rows':_0x5359c6};})[_0x318b('0x1f')](respondWithResult(_0x4db6ed,null))[_0x318b('0x51')](handleError(_0x4db6ed,null));};exports['getVoiceQueuesRt']=function(_0x398a73,_0x441e3b){var _0x4134e0={};var _0x3b8840={};var _0x5ca28f;var _0x31934d;return db[_0x318b('0x36')][_0x318b('0xc2')]({'where':{'id':_0x398a73['params']['id']}})[_0x318b('0x1f')](handleEntityNotFound(_0x441e3b,null))[_0x318b('0x1f')](function(_0xac728){if(_0xac728){_0x5ca28f=_0xac728;_0x3b8840[_0x318b('0xcd')]=_[_0x318b('0xce')](db[_0x318b('0xa3')][_0x318b('0x37')]);_0x3b8840[_0x318b('0x42')]=_[_0x318b('0xce')](_0x398a73['query']);_0x3b8840[_0x318b('0xd4')]=_['intersection'](_0x3b8840[_0x318b('0xcd')],_0x3b8840[_0x318b('0x42')]);_0x4134e0[_0x318b('0x47')]=_[_0x318b('0xd0')](_0x3b8840[_0x318b('0xcd')],qs['fields'](_0x398a73['query']['fields']));_0x4134e0[_0x318b('0x47')]=_0x4134e0[_0x318b('0x47')]['length']?_0x4134e0[_0x318b('0x47')]:_0x3b8840[_0x318b('0xcd')];_0x4134e0[_0x318b('0xd2')]=qs[_0x318b('0xd3')](_0x398a73[_0x318b('0x42')][_0x318b('0xd3')]);_0x4134e0['where']=qs[_0x318b('0xd4')](_[_0x318b('0xd7')](_0x398a73[_0x318b('0x42')],_0x3b8840[_0x318b('0xd4')]));if(_0x398a73['query'][_0x318b('0x2c')]){_0x4134e0[_0x318b('0x41')]=_[_0x318b('0x54')](_0x4134e0['where'],{'$or':_[_0x318b('0x2e')](_0x4134e0[_0x318b('0x47')],function(_0x2abb15){var _0x351d32={};_0x351d32[_0x2abb15]={'$like':'%'+_0x398a73[_0x318b('0x42')][_0x318b('0x2c')]+'%'};return _0x351d32;})});}_0x4134e0=_[_0x318b('0x54')]({},_0x4134e0,_0x398a73['options']);return _0x5ca28f[_0x318b('0xd8')](_0x4134e0);}})[_0x318b('0x1f')](function(_0x3b4da5){if(_0x3b4da5){_0x31934d=_0x3b4da5[_0x318b('0x4d')];if(!_0x398a73[_0x318b('0x42')][_0x318b('0xc5')]('nolimit')){_0x4134e0['limit']=qs[_0x318b('0xd6')](_0x398a73[_0x318b('0x42')][_0x318b('0xd6')]);_0x4134e0['offset']=qs[_0x318b('0x1b')](_0x398a73['query'][_0x318b('0x1b')]);}return _0x5ca28f[_0x318b('0xd8')](_0x4134e0);}})['then'](function(_0xaabc77){if(_0xaabc77){return _0xaabc77?{'count':_0x31934d,'rows':_0xaabc77}:null;}})[_0x318b('0x1f')](respondWithResult(_0x441e3b,null))[_0x318b('0x51')](handleError(_0x441e3b,null));};exports[_0x318b('0xd9')]=function(_0x35958b,_0x91faa){var _0x5e1351={};var _0x5f1c0a={};var _0x29efa0;var _0x23ed5a;return db['User'][_0x318b('0xc2')]({'where':{'id':_0x35958b[_0x318b('0x53')]['id']}})['then'](handleEntityNotFound(_0x91faa,null))['then'](function(_0x1b89a6){if(_0x1b89a6){_0x29efa0=_0x1b89a6;_0x5f1c0a[_0x318b('0xcd')]=_[_0x318b('0xce')](db[_0x318b('0xda')][_0x318b('0x37')]);_0x5f1c0a[_0x318b('0x42')]=_[_0x318b('0xce')](_0x35958b[_0x318b('0x42')]);_0x5f1c0a['filters']=_[_0x318b('0xd0')](_0x5f1c0a[_0x318b('0xcd')],_0x5f1c0a['query']);_0x5e1351['attributes']=_[_0x318b('0xd0')](_0x5f1c0a[_0x318b('0xcd')],qs['fields'](_0x35958b[_0x318b('0x42')]['fields']));_0x5e1351[_0x318b('0x47')]=_0x5e1351[_0x318b('0x47')][_0x318b('0x4d')]?_0x5e1351[_0x318b('0x47')]:_0x5f1c0a[_0x318b('0xcd')];_0x5e1351[_0x318b('0xd2')]=qs['sort'](_0x35958b[_0x318b('0x42')][_0x318b('0xd3')]);_0x5e1351[_0x318b('0x41')]=qs[_0x318b('0xd4')](_['pick'](_0x35958b['query'],_0x5f1c0a[_0x318b('0xd4')]));if(_0x35958b[_0x318b('0x42')][_0x318b('0x2c')]){_0x5e1351[_0x318b('0x41')]=_[_0x318b('0x54')](_0x5e1351[_0x318b('0x41')],{'$or':_['map'](_0x5e1351[_0x318b('0x47')],function(_0x50b6be){var _0x2e744f={};_0x2e744f[_0x50b6be]={'$like':'%'+_0x35958b['query'][_0x318b('0x2c')]+'%'};return _0x2e744f;})});}_0x5e1351=_[_0x318b('0x54')]({},_0x5e1351,_0x35958b[_0x318b('0x55')]);return _0x29efa0[_0x318b('0xd9')](_0x5e1351);}})[_0x318b('0x1f')](function(_0x58cf79){if(_0x58cf79){_0x23ed5a=_0x58cf79[_0x318b('0x4d')];if(!_0x35958b[_0x318b('0x42')][_0x318b('0xc5')](_0x318b('0xd5'))){_0x5e1351['limit']=qs['limit'](_0x35958b[_0x318b('0x42')][_0x318b('0xd6')]);_0x5e1351[_0x318b('0x1b')]=qs[_0x318b('0x1b')](_0x35958b[_0x318b('0x42')][_0x318b('0x1b')]);}return _0x29efa0[_0x318b('0xd9')](_0x5e1351);}})[_0x318b('0x1f')](function(_0x388c80){if(_0x388c80){return _0x388c80?{'count':_0x23ed5a,'rows':_0x388c80}:null;}})['then'](respondWithResult(_0x91faa,null))[_0x318b('0x51')](handleError(_0x91faa,null));};exports[_0x318b('0xdb')]=function(_0x40d4b8,_0x29c4b2){var _0x19e763={'raw':!![],'where':{}};var _0x4c400e={};var _0x4c2c4a={'count':0x0,'rows':[]};return db['User'][_0x318b('0xc2')]({'where':{'id':_0x40d4b8[_0x318b('0x53')]['id']}})[_0x318b('0x1f')](handleEntityNotFound(_0x29c4b2,null))['then'](function(_0x5d924b){if(_0x5d924b){_0x4c400e[_0x318b('0xcd')]=_[_0x318b('0xce')](db[_0x318b('0xdc')][_0x318b('0x37')]);_0x4c400e[_0x318b('0x42')]=_[_0x318b('0xce')](_0x40d4b8[_0x318b('0x42')]);_0x4c400e['filters']=_[_0x318b('0xd0')](_0x4c400e[_0x318b('0xcd')],_0x4c400e[_0x318b('0x42')]);_0x19e763[_0x318b('0x47')]=_['intersection'](_0x4c400e['model'],qs[_0x318b('0xd1')](_0x40d4b8[_0x318b('0x42')][_0x318b('0xd1')]));_0x19e763[_0x318b('0x47')]=_0x19e763[_0x318b('0x47')][_0x318b('0x4d')]?_0x19e763[_0x318b('0x47')]:_0x4c400e[_0x318b('0xcd')];if(!_0x40d4b8[_0x318b('0x42')][_0x318b('0xc5')]('nolimit')){_0x19e763[_0x318b('0xd6')]=qs['limit'](_0x40d4b8[_0x318b('0x42')][_0x318b('0xd6')]);_0x19e763['offset']=qs[_0x318b('0x1b')](_0x40d4b8[_0x318b('0x42')]['offset']);}_0x19e763[_0x318b('0xd2')]=qs[_0x318b('0xd3')](_0x40d4b8['query'][_0x318b('0xd3')]);_0x19e763[_0x318b('0x41')]=qs[_0x318b('0xd4')](_['pick'](_0x40d4b8['query'],_0x4c400e[_0x318b('0xd4')]));_0x19e763['where'][_0x318b('0xdd')]=_0x5d924b['id'];if(_0x40d4b8[_0x318b('0x42')][_0x318b('0x2c')]){_0x19e763['where']=_[_0x318b('0x54')](_0x19e763[_0x318b('0x41')],{'$or':_['map'](_0x19e763[_0x318b('0x47')],function(_0x5495dd){var _0x714774={};_0x714774[_0x5495dd]={'$like':'%'+_0x40d4b8[_0x318b('0x42')][_0x318b('0x2c')]+'%'};return _0x714774;})});}_0x19e763=_[_0x318b('0x54')]({},_0x19e763,_0x40d4b8[_0x318b('0x55')]);return db[_0x318b('0xdc')][_0x318b('0x1a')]({'where':_0x19e763['where']})[_0x318b('0x1f')](function(_0x743b65){_0x4c2c4a[_0x318b('0x1a')]=_0x743b65;if(_0x40d4b8[_0x318b('0x42')][_0x318b('0x43')]){_0x19e763[_0x318b('0x44')]=[{'all':!![]}];}return db['VoiceRecording']['findAll'](_0x19e763);})[_0x318b('0x1f')](function(_0x5b6bea){_0x4c2c4a[_0x318b('0x4a')]=_0x5b6bea;return _0x4c2c4a;});}})[_0x318b('0x1f')](respondWithFilteredResult(_0x29c4b2,_0x19e763))['catch'](handleError(_0x29c4b2,null));};exports['getScreenRecordings']=function(_0x118bd2,_0x1f3fb6){var _0x104c50={'raw':!![],'where':{}};var _0x513aa5={};var _0x2da9fa={'count':0x0,'rows':[]};return db[_0x318b('0x36')][_0x318b('0xc2')]({'where':{'id':_0x118bd2[_0x318b('0x53')]['id']}})[_0x318b('0x1f')](handleEntityNotFound(_0x1f3fb6,null))[_0x318b('0x1f')](function(_0x27615d){if(_0x27615d){_0x513aa5[_0x318b('0xcd')]=_['keys'](db[_0x318b('0xde')]['rawAttributes']);_0x513aa5[_0x318b('0x42')]=_[_0x318b('0xce')](_0x118bd2[_0x318b('0x42')]);_0x513aa5[_0x318b('0xd4')]=_['intersection'](_0x513aa5[_0x318b('0xcd')],_0x513aa5[_0x318b('0x42')]);_0x104c50[_0x318b('0x47')]=_['intersection'](_0x513aa5[_0x318b('0xcd')],qs[_0x318b('0xd1')](_0x118bd2[_0x318b('0x42')][_0x318b('0xd1')]));_0x104c50['attributes']=_0x104c50['attributes']['length']?_0x104c50[_0x318b('0x47')]:_0x513aa5[_0x318b('0xcd')];if(!_0x118bd2['query'][_0x318b('0xc5')]('nolimit')){_0x104c50[_0x318b('0xd6')]=qs['limit'](_0x118bd2[_0x318b('0x42')][_0x318b('0xd6')]);_0x104c50['offset']=qs[_0x318b('0x1b')](_0x118bd2['query'][_0x318b('0x1b')]);}_0x104c50[_0x318b('0xd2')]=qs[_0x318b('0xd3')](_0x118bd2['query'][_0x318b('0xd3')]);_0x104c50[_0x318b('0x41')]=qs[_0x318b('0xd4')](_[_0x318b('0xd7')](_0x118bd2[_0x318b('0x42')],_0x513aa5[_0x318b('0xd4')]));_0x104c50[_0x318b('0x41')][_0x318b('0xdd')]=_0x27615d['id'];if(_0x118bd2[_0x318b('0x42')][_0x318b('0x2c')]){_0x104c50['where']=_[_0x318b('0x54')](_0x104c50['where'],{'$or':_[_0x318b('0x2e')](_0x104c50['attributes'],function(_0x4ece69){var _0x419dc5={};_0x419dc5[_0x4ece69]={'$like':'%'+_0x118bd2['query'][_0x318b('0x2c')]+'%'};return _0x419dc5;})});}_0x104c50=_['merge']({},_0x104c50,_0x118bd2[_0x318b('0x55')]);return db['ScreenRecording'][_0x318b('0x1a')]({'where':_0x104c50[_0x318b('0x41')]})[_0x318b('0x1f')](function(_0x3572a6){_0x2da9fa[_0x318b('0x1a')]=_0x3572a6;if(_0x118bd2[_0x318b('0x42')][_0x318b('0x43')]){_0x104c50[_0x318b('0x44')]=[{'all':!![]}];}return db['ScreenRecording'][_0x318b('0x49')](_0x104c50);})[_0x318b('0x1f')](function(_0x5138a3){_0x2da9fa['rows']=_0x5138a3;return _0x2da9fa;});}})[_0x318b('0x1f')](respondWithFilteredResult(_0x1f3fb6,_0x104c50))[_0x318b('0x51')](handleError(_0x1f3fb6,null));};exports['getChatInteractions']=function(_0x107468,_0x496e00){var _0x5dc91c={};var _0x4ffcc8={};var _0x501fbf;var _0x289cfe;return db[_0x318b('0x36')][_0x318b('0xc2')]({'where':{'id':_0x107468[_0x318b('0x53')]['id']}})[_0x318b('0x1f')](handleEntityNotFound(_0x496e00,null))[_0x318b('0x1f')](function(_0x1c987f){if(_0x1c987f){_0x501fbf=_0x1c987f;_0x4ffcc8['model']=_[_0x318b('0xce')](db[_0x318b('0xdf')]['rawAttributes']);_0x4ffcc8[_0x318b('0x42')]=_[_0x318b('0xce')](_0x107468['query']);_0x4ffcc8[_0x318b('0xd4')]=_[_0x318b('0xd0')](_0x4ffcc8[_0x318b('0xcd')],_0x4ffcc8[_0x318b('0x42')]);_0x5dc91c['attributes']=_[_0x318b('0xd0')](_0x4ffcc8['model'],qs[_0x318b('0xd1')](_0x107468[_0x318b('0x42')][_0x318b('0xd1')]));_0x5dc91c['attributes']=_0x5dc91c[_0x318b('0x47')]['length']?_0x5dc91c[_0x318b('0x47')]:_0x4ffcc8[_0x318b('0xcd')];_0x5dc91c[_0x318b('0xd2')]=qs[_0x318b('0xd3')](_0x107468[_0x318b('0x42')][_0x318b('0xd3')]);_0x5dc91c[_0x318b('0x41')]=qs[_0x318b('0xd4')](_[_0x318b('0xd7')](_0x107468[_0x318b('0x42')],_0x4ffcc8[_0x318b('0xd4')]));if(_0x107468['query']['filter']){_0x5dc91c[_0x318b('0x41')]=_[_0x318b('0x54')](_0x5dc91c['where'],{'$or':_['map'](_0x5dc91c['attributes'],function(_0x391de7){var _0x501408={};_0x501408[_0x391de7]={'$like':'%'+_0x107468['query'][_0x318b('0x2c')]+'%'};return _0x501408;})});}_0x5dc91c=_['merge']({},_0x5dc91c,_0x107468[_0x318b('0x55')]);return _0x501fbf[_0x318b('0xe0')](_0x5dc91c);}})[_0x318b('0x1f')](function(_0x31b701){if(_0x31b701){_0x289cfe=_0x31b701['length'];if(!_0x107468[_0x318b('0x42')][_0x318b('0xc5')]('nolimit')){_0x5dc91c[_0x318b('0xd6')]=qs[_0x318b('0xd6')](_0x107468[_0x318b('0x42')][_0x318b('0xd6')]);_0x5dc91c[_0x318b('0x1b')]=qs[_0x318b('0x1b')](_0x107468[_0x318b('0x42')][_0x318b('0x1b')]);}return _0x501fbf['getChatInteractions'](_0x5dc91c);}})[_0x318b('0x1f')](function(_0x355efa){if(_0x355efa){return _0x355efa?{'count':_0x289cfe,'rows':_0x355efa}:null;}})[_0x318b('0x1f')](respondWithResult(_0x496e00,null))['catch'](handleError(_0x496e00,null));};exports[_0x318b('0xe1')]=function(_0x14716e,_0x51d68c){var _0x40152e={};var _0x72236={};var _0xa4d59;var _0xc35be1;return db['User']['findOne']({'where':{'id':_0x14716e['params']['id']}})[_0x318b('0x1f')](handleEntityNotFound(_0x51d68c,null))[_0x318b('0x1f')](function(_0x3cc99f){if(_0x3cc99f){_0xa4d59=_0x3cc99f;_0x72236['model']=_['keys'](db[_0x318b('0xe2')]['rawAttributes']);_0x72236[_0x318b('0x42')]=_[_0x318b('0xce')](_0x14716e[_0x318b('0x42')]);_0x72236[_0x318b('0xd4')]=_['intersection'](_0x72236[_0x318b('0xcd')],_0x72236[_0x318b('0x42')]);_0x40152e[_0x318b('0x47')]=_[_0x318b('0xd0')](_0x72236[_0x318b('0xcd')],qs[_0x318b('0xd1')](_0x14716e[_0x318b('0x42')][_0x318b('0xd1')]));_0x40152e[_0x318b('0x47')]=_0x40152e[_0x318b('0x47')][_0x318b('0x4d')]?_0x40152e[_0x318b('0x47')]:_0x72236[_0x318b('0xcd')];_0x40152e[_0x318b('0xd2')]=qs[_0x318b('0xd3')](_0x14716e[_0x318b('0x42')][_0x318b('0xd3')]);_0x40152e[_0x318b('0x41')]=qs['filters'](_['pick'](_0x14716e[_0x318b('0x42')],_0x72236['filters']));if(_0x14716e[_0x318b('0x42')]['filter']){_0x40152e[_0x318b('0x41')]=_[_0x318b('0x54')](_0x40152e[_0x318b('0x41')],{'$or':_['map'](_0x40152e[_0x318b('0x47')],function(_0x5134d8){var _0x5f37c8={};_0x5f37c8[_0x5134d8]={'$like':'%'+_0x14716e['query'][_0x318b('0x2c')]+'%'};return _0x5f37c8;})});}_0x40152e=_['merge']({},_0x40152e,_0x14716e['options']);return _0xa4d59[_0x318b('0xe1')](_0x40152e);}})[_0x318b('0x1f')](function(_0x1f0822){if(_0x1f0822){_0xc35be1=_0x1f0822[_0x318b('0x4d')];if(!_0x14716e[_0x318b('0x42')]['hasOwnProperty'](_0x318b('0xd5'))){_0x40152e[_0x318b('0xd6')]=qs[_0x318b('0xd6')](_0x14716e[_0x318b('0x42')][_0x318b('0xd6')]);_0x40152e['offset']=qs['offset'](_0x14716e['query']['offset']);}return _0xa4d59[_0x318b('0xe1')](_0x40152e);}})['then'](function(_0x325c33){if(_0x325c33){return _0x325c33?{'count':_0xc35be1,'rows':_0x325c33}:null;}})[_0x318b('0x1f')](respondWithResult(_0x51d68c,null))[_0x318b('0x51')](handleError(_0x51d68c,null));};exports[_0x318b('0xe3')]=function(_0x4d1f2,_0x5cc894){var _0xc3a9a4={'raw':!![],'where':{}};var _0x626270={};var _0xd2429d={'count':0x0,'rows':[]};return db[_0x318b('0x36')][_0x318b('0xc2')]({'where':{'id':_0x4d1f2[_0x318b('0x53')]['id']}})[_0x318b('0x1f')](handleEntityNotFound(_0x5cc894,null))['then'](function(_0x160106){if(_0x160106){_0x626270[_0x318b('0xcd')]=_['keys'](db[_0x318b('0xe4')]['rawAttributes']);_0x626270[_0x318b('0x42')]=_[_0x318b('0xce')](_0x4d1f2['query']);_0x626270[_0x318b('0xd4')]=_[_0x318b('0xd0')](_0x626270['model'],_0x626270[_0x318b('0x42')]);_0xc3a9a4[_0x318b('0x47')]=_[_0x318b('0xd0')](_0x626270[_0x318b('0xcd')],qs['fields'](_0x4d1f2[_0x318b('0x42')][_0x318b('0xd1')]));_0xc3a9a4[_0x318b('0x47')]=_0xc3a9a4[_0x318b('0x47')][_0x318b('0x4d')]?_0xc3a9a4['attributes']:_0x626270[_0x318b('0xcd')];if(!_0x4d1f2['query'][_0x318b('0xc5')]('nolimit')){_0xc3a9a4[_0x318b('0xd6')]=qs[_0x318b('0xd6')](_0x4d1f2[_0x318b('0x42')]['limit']);_0xc3a9a4[_0x318b('0x1b')]=qs[_0x318b('0x1b')](_0x4d1f2[_0x318b('0x42')][_0x318b('0x1b')]);}_0xc3a9a4['order']=qs[_0x318b('0xd3')](_0x4d1f2[_0x318b('0x42')][_0x318b('0xd3')]);_0xc3a9a4[_0x318b('0x41')]=qs[_0x318b('0xd4')](_[_0x318b('0xd7')](_0x4d1f2[_0x318b('0x42')],_0x626270[_0x318b('0xd4')]));_0xc3a9a4[_0x318b('0x41')][_0x318b('0xdd')]=_0x160106['id'];if(_0x4d1f2[_0x318b('0x42')][_0x318b('0x2c')]){_0xc3a9a4[_0x318b('0x41')]=_[_0x318b('0x54')](_0xc3a9a4[_0x318b('0x41')],{'$or':_['map'](_0xc3a9a4[_0x318b('0x47')],function(_0x1b2784){var _0x24543b={};_0x24543b[_0x1b2784]={'$like':'%'+_0x4d1f2[_0x318b('0x42')][_0x318b('0x2c')]+'%'};return _0x24543b;})});}_0xc3a9a4=_[_0x318b('0x54')]({},_0xc3a9a4,_0x4d1f2[_0x318b('0x55')]);return db['MailInteraction'][_0x318b('0x1a')]({'where':_0xc3a9a4[_0x318b('0x41')]})['then'](function(_0x2e0e0c){_0xd2429d[_0x318b('0x1a')]=_0x2e0e0c;if(_0x4d1f2[_0x318b('0x42')]['includeAll']){_0xc3a9a4[_0x318b('0x44')]=[{'all':!![]}];}return db[_0x318b('0xe4')][_0x318b('0x49')](_0xc3a9a4);})[_0x318b('0x1f')](function(_0x55d42f){_0xd2429d[_0x318b('0x4a')]=_0x55d42f;return _0xd2429d;});}})[_0x318b('0x1f')](respondWithFilteredResult(_0x5cc894,_0xc3a9a4))[_0x318b('0x51')](handleError(_0x5cc894,null));};exports['getSmsInteractions']=function(_0x113d8f,_0x16bab6){var _0x3feaf1={};var _0x253633={};var _0xcc2dd6;var _0x42ce20;return db[_0x318b('0x36')][_0x318b('0xc2')]({'where':{'id':_0x113d8f[_0x318b('0x53')]['id']}})[_0x318b('0x1f')](handleEntityNotFound(_0x16bab6,null))[_0x318b('0x1f')](function(_0xcffd22){if(_0xcffd22){_0xcc2dd6=_0xcffd22;_0x253633['model']=_[_0x318b('0xce')](db['SmsInteraction'][_0x318b('0x37')]);_0x253633[_0x318b('0x42')]=_[_0x318b('0xce')](_0x113d8f[_0x318b('0x42')]);_0x253633[_0x318b('0xd4')]=_[_0x318b('0xd0')](_0x253633[_0x318b('0xcd')],_0x253633[_0x318b('0x42')]);_0x3feaf1[_0x318b('0x47')]=_['intersection'](_0x253633['model'],qs[_0x318b('0xd1')](_0x113d8f[_0x318b('0x42')]['fields']));_0x3feaf1[_0x318b('0x47')]=_0x3feaf1['attributes'][_0x318b('0x4d')]?_0x3feaf1['attributes']:_0x253633[_0x318b('0xcd')];_0x3feaf1[_0x318b('0xd2')]=qs[_0x318b('0xd3')](_0x113d8f[_0x318b('0x42')]['sort']);_0x3feaf1['where']=qs[_0x318b('0xd4')](_[_0x318b('0xd7')](_0x113d8f[_0x318b('0x42')],_0x253633[_0x318b('0xd4')]));if(_0x113d8f['query'][_0x318b('0x2c')]){_0x3feaf1[_0x318b('0x41')]=_[_0x318b('0x54')](_0x3feaf1['where'],{'$or':_['map'](_0x3feaf1[_0x318b('0x47')],function(_0x1a452f){var _0x49b884={};_0x49b884[_0x1a452f]={'$like':'%'+_0x113d8f['query']['filter']+'%'};return _0x49b884;})});}_0x3feaf1=_[_0x318b('0x54')]({},_0x3feaf1,_0x113d8f[_0x318b('0x55')]);return _0xcc2dd6[_0x318b('0xe5')](_0x3feaf1);}})[_0x318b('0x1f')](function(_0x21f0d6){if(_0x21f0d6){_0x42ce20=_0x21f0d6['length'];if(!_0x113d8f[_0x318b('0x42')][_0x318b('0xc5')]('nolimit')){_0x3feaf1['limit']=qs[_0x318b('0xd6')](_0x113d8f[_0x318b('0x42')][_0x318b('0xd6')]);_0x3feaf1[_0x318b('0x1b')]=qs['offset'](_0x113d8f[_0x318b('0x42')]['offset']);}return _0xcc2dd6[_0x318b('0xe5')](_0x3feaf1);}})['then'](function(_0x3990be){if(_0x3990be){return _0x3990be?{'count':_0x42ce20,'rows':_0x3990be}:null;}})['then'](respondWithResult(_0x16bab6,null))['catch'](handleError(_0x16bab6,null));};exports[_0x318b('0xe6')]=function(_0x197f84,_0x2eea8a){var _0x4eb1dc={};var _0x4addce={};var _0x22b1df;var _0x4bc43e;return db[_0x318b('0x36')][_0x318b('0xc2')]({'where':{'id':_0x197f84['params']['id']}})[_0x318b('0x1f')](handleEntityNotFound(_0x2eea8a,null))[_0x318b('0x1f')](function(_0x54c63b){if(_0x54c63b){_0x22b1df=_0x54c63b;_0x4addce[_0x318b('0xcd')]=_['keys'](db[_0x318b('0xe7')][_0x318b('0x37')]);_0x4addce[_0x318b('0x42')]=_[_0x318b('0xce')](_0x197f84[_0x318b('0x42')]);_0x4addce[_0x318b('0xd4')]=_['intersection'](_0x4addce[_0x318b('0xcd')],_0x4addce[_0x318b('0x42')]);_0x4eb1dc[_0x318b('0x47')]=_[_0x318b('0xd0')](_0x4addce[_0x318b('0xcd')],qs[_0x318b('0xd1')](_0x197f84[_0x318b('0x42')]['fields']));_0x4eb1dc[_0x318b('0x47')]=_0x4eb1dc['attributes'][_0x318b('0x4d')]?_0x4eb1dc['attributes']:_0x4addce[_0x318b('0xcd')];_0x4eb1dc[_0x318b('0xd2')]=qs[_0x318b('0xd3')](_0x197f84['query'][_0x318b('0xd3')]);_0x4eb1dc[_0x318b('0x41')]=qs[_0x318b('0xd4')](_[_0x318b('0xd7')](_0x197f84[_0x318b('0x42')],_0x4addce[_0x318b('0xd4')]));if(_0x197f84['query'][_0x318b('0x2c')]){_0x4eb1dc[_0x318b('0x41')]=_[_0x318b('0x54')](_0x4eb1dc['where'],{'$or':_[_0x318b('0x2e')](_0x4eb1dc['attributes'],function(_0x35aca7){var _0x33056e={};_0x33056e[_0x35aca7]={'$like':'%'+_0x197f84[_0x318b('0x42')]['filter']+'%'};return _0x33056e;})});}_0x4eb1dc=_['merge']({},_0x4eb1dc,_0x197f84[_0x318b('0x55')]);return _0x22b1df['getFaxInteractions'](_0x4eb1dc);}})[_0x318b('0x1f')](function(_0x582936){if(_0x582936){_0x4bc43e=_0x582936[_0x318b('0x4d')];if(!_0x197f84['query'][_0x318b('0xc5')]('nolimit')){_0x4eb1dc[_0x318b('0xd6')]=qs[_0x318b('0xd6')](_0x197f84['query'][_0x318b('0xd6')]);_0x4eb1dc[_0x318b('0x1b')]=qs[_0x318b('0x1b')](_0x197f84[_0x318b('0x42')][_0x318b('0x1b')]);}return _0x22b1df['getFaxInteractions'](_0x4eb1dc);}})[_0x318b('0x1f')](function(_0x2fd1e1){if(_0x2fd1e1){return _0x2fd1e1?{'count':_0x4bc43e,'rows':_0x2fd1e1}:null;}})['then'](respondWithResult(_0x2eea8a,null))['catch'](handleError(_0x2eea8a,null));};exports[_0x318b('0xe8')]=function(_0x154723,_0x5577d5){var _0x2c8d2c={};var _0x1fec6b={};var _0x5a2260;var _0x518c09;return db[_0x318b('0x36')][_0x318b('0xc2')]({'where':{'id':_0x154723[_0x318b('0x53')]['id']}})['then'](handleEntityNotFound(_0x5577d5,null))['then'](function(_0x4202a1){if(_0x4202a1){_0x5a2260=_0x4202a1;_0x1fec6b['model']=_['keys'](db[_0x318b('0xe9')][_0x318b('0x37')]);_0x1fec6b['query']=_[_0x318b('0xce')](_0x154723[_0x318b('0x42')]);_0x1fec6b['filters']=_['intersection'](_0x1fec6b[_0x318b('0xcd')],_0x1fec6b[_0x318b('0x42')]);_0x2c8d2c['attributes']=_['intersection'](_0x1fec6b['model'],qs[_0x318b('0xd1')](_0x154723[_0x318b('0x42')][_0x318b('0xd1')]));_0x2c8d2c['attributes']=_0x2c8d2c[_0x318b('0x47')][_0x318b('0x4d')]?_0x2c8d2c['attributes']:_0x1fec6b[_0x318b('0xcd')];_0x2c8d2c[_0x318b('0xd2')]=qs[_0x318b('0xd3')](_0x154723['query']['sort']);_0x2c8d2c[_0x318b('0x41')]=qs[_0x318b('0xd4')](_[_0x318b('0xd7')](_0x154723['query'],_0x1fec6b[_0x318b('0xd4')]));if(_0x154723['query']['filter']){_0x2c8d2c['where']=_[_0x318b('0x54')](_0x2c8d2c[_0x318b('0x41')],{'$or':_['map'](_0x2c8d2c['attributes'],function(_0x503d37){var _0x2e5e82={};_0x2e5e82[_0x503d37]={'$like':'%'+_0x154723[_0x318b('0x42')][_0x318b('0x2c')]+'%'};return _0x2e5e82;})});}_0x2c8d2c=_[_0x318b('0x54')]({},_0x2c8d2c,_0x154723[_0x318b('0x55')]);return _0x5a2260[_0x318b('0xe8')](_0x2c8d2c);}})[_0x318b('0x1f')](function(_0x4175cb){if(_0x4175cb){_0x518c09=_0x4175cb['length'];if(!_0x154723[_0x318b('0x42')][_0x318b('0xc5')]('nolimit')){_0x2c8d2c[_0x318b('0xd6')]=qs[_0x318b('0xd6')](_0x154723['query'][_0x318b('0xd6')]);_0x2c8d2c[_0x318b('0x1b')]=qs[_0x318b('0x1b')](_0x154723[_0x318b('0x42')][_0x318b('0x1b')]);}return _0x5a2260[_0x318b('0xe8')](_0x2c8d2c);}})[_0x318b('0x1f')](function(_0x2b6ba8){if(_0x2b6ba8){return _0x2b6ba8?{'count':_0x518c09,'rows':_0x2b6ba8}:null;}})[_0x318b('0x1f')](respondWithResult(_0x5577d5,null))[_0x318b('0x51')](handleError(_0x5577d5,null));};exports['login']=function(_0x415d5e,_0x2ec97f,_0x30cbb8){var _0xe7de44;var _0x311f48;var _0x183638;var _0x42ffe7=!_[_0x318b('0x62')](_0x415d5e[_0x318b('0x53')]['id'])?_0x415d5e[_0x318b('0x53')]['id']:!_[_0x318b('0x62')](_0x415d5e[_0x318b('0x28')]['id'])?_0x415d5e[_0x318b('0x28')]['id']:null;return db[_0x318b('0x36')][_0x318b('0x31')]({'where':{'id':_0x42ffe7,'role':{'$or':[_0x318b('0x26'),_0x318b('0x28'),'agent']}},'attributes':['id','name',_0x318b('0xea'),_0x318b('0xeb'),_0x318b('0x25'),_0x318b('0x5e'),_0x318b('0xec')]})[_0x318b('0x1f')](function(_0x2e1f2b){if(_0x2e1f2b){if(_0x2e1f2b[_0x318b('0x25')]===_0x318b('0x20')){_0xe7de44=_0x2e1f2b;if(_0x415d5e['body'][_0x318b('0x97')]){_0x183638=util['format'](_0x318b('0xed'),_0xe7de44[_0x415d5e['body'][_0x318b('0x97')]]);}else if(_0x415d5e[_0x318b('0x59')][_0x318b('0xee')]){_0x183638=util[_0x318b('0xc3')](_0x318b('0xa0'),_0x415d5e['body'][_0x318b('0xee')]);}else{_0x183638=util[_0x318b('0xc3')](_0x318b('0xa0'),_0xe7de44[_0x318b('0x35')]);}socket['to'](util[_0x318b('0xc3')](_0x318b('0xef'),_0xe7de44['name']))[_0x318b('0x21')](_0x318b('0xf0'),{'user':{'id':_0xe7de44['id'],'name':_0xe7de44[_0x318b('0x35')]},'ip':_0x415d5e[_0x318b('0xf1')][_0x318b('0xf2')]||_0x415d5e[_0x318b('0xf3')][_0x318b('0xf4')]||_0x415d5e['socket'][_0x318b('0xf4')]||_0x415d5e[_0x318b('0xf3')][_0x318b('0xf5')][_0x318b('0xf4')]});return db[_0x318b('0xa3')][_0x318b('0x23')]({'where':{'membername':_0xe7de44[_0x318b('0x35')]},'individualHooks':!![]});}}else{throw new db['Sequelize']['ValidationError'](_0x318b('0xf6'));}})['then'](function(){if(_0xe7de44){return _0xe7de44[_0x318b('0xf7')]({'raw':!![]});}})[_0x318b('0x1f')](function(_0x329a11){if(_0xe7de44){if(_0x329a11){_0x311f48=_0x329a11;if(_0x311f48[_0x318b('0x4d')]){var _0x195be0=_0x311f48['map'](function(_0x3d8048){var _0x299d8b={'membername':_0xe7de44[_0x318b('0x35')],'UserId':_0xe7de44['id'],'queue_name':_0x3d8048[_0x318b('0x35')],'VoiceQueueId':_0x3d8048['id'],'interface':_0x183638,'paused':_0xe7de44['loginInPause']||![],'penalty':_0x3d8048['UserVoiceQueue.penalty']||0x0};return db[_0x318b('0xa3')][_0x318b('0xa4')](_0x299d8b);});return Promise[_0x318b('0x58')](_0x195be0);}}}})[_0x318b('0x1f')](function(){if(_0xe7de44){return db[_0x318b('0xf8')][_0x318b('0x49')]({'where':{'membername':_0xe7de44['name'],'exitAt':null}});}})[_0x318b('0x1f')](function(_0xf5bb8b){if(_0xe7de44){var _0x373405=[];_0xf5bb8b[_0x318b('0xf9')](function(_0x429bd2){_0x373405[_0x318b('0x48')](_0x429bd2[_0x318b('0x1e')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise[_0x318b('0x58')](_0x373405);}})[_0x318b('0x1f')](function(){if(_0xe7de44){var _0x1a2f1c=[];var _0x2ed017=[];var _0x3de8df=utils['getChannels']();var _0x3ee767={'membername':_0xe7de44[_0x318b('0x35')],'interface':_0x183638,'enterAt':moment()[_0x318b('0xc3')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0xe7de44[_0x318b('0x25')],'internal':_0xe7de44[_0x318b('0x5e')]};_0x3de8df[_0x318b('0xf9')](function(_0x7da50){_0x1a2f1c['push'](_[_0x318b('0x54')]({'channel':_0x7da50,'type':_0x318b('0xfa'),'data1':_0x415d5e[_0x318b('0x59')][_0x318b('0xfb')],'data2':_0x183638},_0x3ee767));if(_0xe7de44[_0x318b('0xec')]){_0x2ed017[_0x318b('0x48')](_[_0x318b('0x54')]({'channel':_0x7da50,'type':'PAUSE','data1':_0x318b('0xfc')},_0x3ee767));}});return db[_0x318b('0xf8')]['bulkCreate'](_0x1a2f1c[_0x318b('0xc0')](_0x2ed017),{'individualHooks':!![]});}})[_0x318b('0x1f')](function(){if(_0xe7de44){return _0xe7de44['update']({'online':!![],'lastLoginAt':moment()[_0x318b('0xc3')](_0x318b('0xfd')),'voicePause':_0xe7de44['loginInPause']||![],'mailPause':_0xe7de44['loginInPause']||![],'chatPause':_0xe7de44[_0x318b('0xec')]||![],'faxPause':_0xe7de44[_0x318b('0xec')]||![],'smsPause':_0xe7de44[_0x318b('0xec')]||![],'openchannelPause':_0xe7de44[_0x318b('0xec')]||![],'whatsappPause':_0xe7de44[_0x318b('0xec')]||![],'pauseType':_0xe7de44[_0x318b('0xec')]?_0x318b('0xfc'):null,'interface':_0x183638,'lastPauseAt':moment()[_0x318b('0xc3')](_0x318b('0xfd'))});}})['then'](function(_0x319999){if(_0x415d5e[_0x318b('0xfe')]){return _0x30cbb8();}else{return Promise[_0x318b('0xff')](_0x319999)['then'](respondWithResult(_0x2ec97f,null));}})[_0x318b('0x51')](handleError(_0x2ec97f,null));};exports[_0x318b('0x100')]=function(_0x53c885,_0x530536){var _0xd9a8d6;return db[_0x318b('0x36')][_0x318b('0x31')]({'where':{'id':_0x53c885[_0x318b('0x53')]['id'],'role':_0x318b('0x20')},'attributes':['id',_0x318b('0x35'),'role']})[_0x318b('0x1f')](handleEntityNotFound(_0x530536,null))[_0x318b('0x1f')](function(_0x4248b6){if(_0x4248b6){_0xd9a8d6=_0x4248b6;return db[_0x318b('0xa3')][_0x318b('0x23')]({'where':{'membername':_0xd9a8d6[_0x318b('0x35')]},'individualHooks':!![]});}})[_0x318b('0x1f')](function(){return db['MemberReport']['findAll']({'where':{'membername':_0xd9a8d6['name'],'exitAt':null}});})[_0x318b('0x1f')](function(_0xa5054f){var _0x17d62a=[];_0xa5054f[_0x318b('0xf9')](function(_0x2bfa90){_0x17d62a[_0x318b('0x48')](_0x2bfa90['update']({'exitAt':moment()[_0x318b('0xc3')](_0x318b('0xfd'))}));});return Promise[_0x318b('0x58')](_0x17d62a);})['then'](function(){return _0xd9a8d6[_0x318b('0x1e')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x318b('0x1f')](respondWithResult(_0x530536,null))[_0x318b('0x51')](handleError(_0x530536,null));};exports[_0x318b('0x101')]=function(_0x2d7425,_0x236e63){var _0x1ea63b;return db['UserVoiceQueueRt']['update']({'paused':0x1},{'where':{'UserId':_0x2d7425[_0x318b('0x53')]['id']},'individualHooks':!![]})['then'](function(){return db[_0x318b('0x36')][_0x318b('0x31')]({'where':{'id':_0x2d7425[_0x318b('0x53')]['id'],'role':_0x318b('0x20')},'attributes':['id','name',_0x318b('0x25'),'internal','interface','online']});})[_0x318b('0x1f')](handleEntityNotFound(_0x236e63,null))[_0x318b('0x1f')](function(_0x45c8b1){if(_0x45c8b1){_0x1ea63b=_0x45c8b1;return db['MemberReport'][_0x318b('0x49')]({'where':{'membername':_0x1ea63b[_0x318b('0x35')],'type':_0x318b('0x102'),'exitAt':null}});}})[_0x318b('0x1f')](function(_0x2dfeda){if(_0x2dfeda['length']){var _0x1da2a4=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');for(var _0x2d4daa=0x0,_0x50b1e6=_0x2dfeda['length'];_0x2d4daa<_0x50b1e6;_0x2d4daa++){_0x2dfeda[_0x2d4daa][_0x318b('0x103')]({'exitAt':_0x1da2a4});}}})[_0x318b('0x1f')](function(){var _0x212731=[];var _0x153a0d=utils[_0x318b('0x104')]();_0x153a0d[_0x318b('0xf9')](function(_0x3559b6){_0x212731[_0x318b('0x48')]({'channel':_0x3559b6,'membername':_0x1ea63b['name'],'interface':_['isNil'](_0x1ea63b[_0x318b('0x97')])?util[_0x318b('0xc3')](_0x318b('0xa0'),_0x1ea63b[_0x318b('0x35')]):_0x1ea63b[_0x318b('0x97')],'type':_0x318b('0x102'),'enterAt':moment()[_0x318b('0xc3')](_0x318b('0xfd')),'data1':_0x2d7425[_0x318b('0x59')][_0x318b('0x39')]||'DEFAULT\x20PAUSE','role':_0x1ea63b[_0x318b('0x25')],'internal':_0x1ea63b[_0x318b('0x5e')]});});return db[_0x318b('0xf8')][_0x318b('0x105')](_0x212731,{'individualHooks':!![]});})[_0x318b('0x1f')](function(){return _0x1ea63b['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x2d7425[_0x318b('0x59')]['type']||_0x318b('0x106'),'lastPauseAt':moment()[_0x318b('0xc3')](_0x318b('0xfd'))});})[_0x318b('0x1f')](respondWithResult(_0x236e63,null))[_0x318b('0x51')](handleError(_0x236e63,null));};exports[_0x318b('0x107')]=function(_0x92dc5d,_0xc7d54e){if(_0x92dc5d[_0x318b('0x59')][_0x318b('0x96')]&&!utils[_0x318b('0x98')](_0x92dc5d[_0x318b('0x59')][_0x318b('0x96')])){throw new APIBadRequestError(util['format'](_0x318b('0x108'),_0x92dc5d[_0x318b('0x59')]['channel']));}return db['User'][_0x318b('0x31')]({'where':{'id':_0x92dc5d[_0x318b('0x53')]['id']},'attributes':['id',_0x318b('0x35'),_0x318b('0x25'),_0x318b('0x5e'),_0x318b('0x97'),_0x318b('0x9f'),'voicePause',_0x318b('0x109'),_0x318b('0x10a'),_0x318b('0x10b'),'openchannelPause',_0x318b('0x10c'),_0x318b('0x10d'),_0x318b('0x10e'),_0x318b('0x10f')]})[_0x318b('0x1f')](function(_0x1c54a6){if(!_0x1c54a6){throw new APINotFoundError(util['format'](_0x318b('0xc4'),_0x92dc5d[_0x318b('0x53')]['id']));}return _0x1c54a6['unpause'](_0x92dc5d[_0x318b('0x59')][_0x318b('0x96')]);})[_0x318b('0x1f')](respondWithResult(_0xc7d54e,null))[_0x318b('0x51')](APIHandleError(_0xc7d54e));};exports[_0x318b('0x110')]=function(_0x47048a,_0x21275b){var _0x5172d2={};var _0x56997c={};var _0x43a8c2;var _0x42c6fa;return db[_0x318b('0x36')][_0x318b('0xc2')]({'where':{'id':_0x47048a['params']['id']}})[_0x318b('0x1f')](handleEntityNotFound(_0x21275b,null))[_0x318b('0x1f')](function(_0x4df8d4){if(_0x4df8d4){_0x43a8c2=_0x4df8d4;_0x56997c[_0x318b('0xcd')]=_[_0x318b('0xce')](db[_0x318b('0x111')][_0x318b('0x37')]);_0x56997c[_0x318b('0x42')]=_[_0x318b('0xce')](_0x47048a['query']);_0x56997c[_0x318b('0xd4')]=_[_0x318b('0xd0')](_0x56997c[_0x318b('0xcd')],_0x56997c['query']);_0x5172d2[_0x318b('0x47')]=_[_0x318b('0xd0')](_0x56997c['model'],qs['fields'](_0x47048a['query']['fields']));_0x5172d2[_0x318b('0x47')]=_0x5172d2[_0x318b('0x47')][_0x318b('0x4d')]?_0x5172d2[_0x318b('0x47')]:_0x56997c[_0x318b('0xcd')];_0x5172d2[_0x318b('0xd2')]=qs[_0x318b('0xd3')](_0x47048a[_0x318b('0x42')][_0x318b('0xd3')]);_0x5172d2[_0x318b('0x41')]=qs[_0x318b('0xd4')](_[_0x318b('0xd7')](_0x47048a[_0x318b('0x42')],_0x56997c['filters']));if(_0x47048a[_0x318b('0x42')][_0x318b('0x2c')]){_0x5172d2[_0x318b('0x41')]=_[_0x318b('0x54')](_0x5172d2[_0x318b('0x41')],{'$or':_[_0x318b('0x2e')](_0x5172d2[_0x318b('0x47')],function(_0x3570da){var _0x4b9b5d={};_0x4b9b5d[_0x3570da]={'$like':'%'+_0x47048a[_0x318b('0x42')][_0x318b('0x2c')]+'%'};return _0x4b9b5d;})});}_0x5172d2=_[_0x318b('0x54')]({},_0x5172d2,_0x47048a[_0x318b('0x55')]);return _0x43a8c2[_0x318b('0x110')](_0x5172d2);}})[_0x318b('0x1f')](function(_0x438b90){if(_0x438b90){_0x42c6fa=_0x438b90[_0x318b('0x4d')];if(!_0x47048a[_0x318b('0x42')]['hasOwnProperty']('nolimit')){_0x5172d2[_0x318b('0xd6')]=qs['limit'](_0x47048a[_0x318b('0x42')]['limit']);_0x5172d2[_0x318b('0x1b')]=qs['offset'](_0x47048a[_0x318b('0x42')][_0x318b('0x1b')]);}return _0x43a8c2[_0x318b('0x110')](_0x5172d2);}})[_0x318b('0x1f')](function(_0x5214db){if(_0x5214db){return _0x5214db?{'count':_0x42c6fa,'rows':_0x5214db}:null;}})[_0x318b('0x1f')](respondWithResult(_0x21275b,null))[_0x318b('0x51')](handleError(_0x21275b,null));};exports[_0x318b('0x112')]=function(_0x5dabe6,_0x21f5c9){var _0x166d2b=_0x5dabe6[_0x318b('0x53')]['id'];var _0x143e67=_0x5dabe6[_0x318b('0x59')]?_0x5dabe6[_0x318b('0x59')][_0x318b('0x5d')]:null;var _0x43e466=[];return Promise[_0x318b('0xff')]()['then'](function(){if(!_0x143e67)throw new APIBadRequestError(_0x318b('0x113'));})[_0x318b('0x1f')](function(){return db[_0x318b('0x36')][_0x318b('0xc2')]({'where':{'id':_0x166d2b}});})[_0x318b('0x1f')](function(_0x459a5b){if(!_0x459a5b)throw new APINotFoundError(util[_0x318b('0xc3')](_0x318b('0xc4'),_0x5dabe6[_0x318b('0x53')]['id']));return db[_0x318b('0x65')][_0x318b('0x114')](function(_0x2630d9){return _0x459a5b['addTeams'](_0x143e67,{'transaction':_0x2630d9})['then'](function(){return db['Team'][_0x318b('0x49')]({'where':{'id':{'$in':_0x143e67}}});})[_0x318b('0x1f')](function(_0x1b2255){var _0x202bb7=_['map'](_0x1b2255,function(_0x2e1b5f){return _0x2e1b5f['getAssociatedQueues']();});return Promise['all'](_0x202bb7);})[_0x318b('0x1f')](function(_0x280f31){_0x43e466=_[_0x318b('0x115')](_0x280f31);var _0x348737=_[_0x318b('0x2e')](_0x43e466,function(_0x1295b2){return _0x1295b2[_0x318b('0x116')](_0x459a5b['id'],{'transaction':_0x2630d9});});return Promise[_0x318b('0x58')](_0x348737);})[_0x318b('0x1f')](function(){if(!_0x459a5b['online'])return;var _0x42bbd2=_[_0x318b('0x2c')](_0x43e466,function(_0x3fc58a){return _0x3fc58a[_0x318b('0x117')](_0x318b('0x96'))==='Voice';});var _0x149a4c=_['map'](_0x42bbd2,function(_0x53c064){return db['UserVoiceQueueRt'][_0x318b('0xa4')]({'membername':_0x459a5b[_0x318b('0x35')],'UserId':_0x459a5b['id'],'queue_name':_0x53c064[_0x318b('0x35')],'VoiceQueueId':_0x53c064['id'],'interface':_['isNil'](_0x459a5b[_0x318b('0x97')])?util[_0x318b('0xc3')]('SIP/%s',_0x459a5b[_0x318b('0x35')]):_0x459a5b[_0x318b('0x97')],'paused':_0x459a5b[_0x318b('0xa1')]||![],'penalty':_0x459a5b[_0x318b('0xa2')]},{'transaction':_0x2630d9});});return Promise[_0x318b('0x58')](_0x149a4c);})[_0x318b('0x1f')](function(){return db[_0x318b('0x118')][_0x318b('0x49')]({'where':{'teamId':{'$in':_0x143e67}}});})[_0x318b('0x1f')](function(_0x2198b9){var _0x59586a=_['map'](_0x2198b9,function(_0x201b0a){return db[_0x318b('0x119')][_0x318b('0x80')]({'UserId':_0x459a5b['id'],'VoicePrefixId':_0x201b0a[_0x318b('0x11a')]},{'transaction':_0x2630d9});});return Promise['all'](_0x59586a);});});})[_0x318b('0x1f')](function(){for(var _0x2755d9=0x0;_0x2755d9<_0x43e466[_0x318b('0x4d')];_0x2755d9++){var _0x21e4c8=_0x43e466[_0x2755d9][_0x318b('0x117')](_0x318b('0x96'));var _0x2bccc6=_0x21e4c8+'QueueId';socket['emit'](_0x318b('0x28')+_0x21e4c8+_0x318b('0x9d'),{'UserId':_0x166d2b,['queueField']:_0x43e466[_0x2755d9]['id']});}})[_0x318b('0x1f')](respondWithStatusCode(_0x21f5c9,null))[_0x318b('0x51')](APIHandleError(_0x21f5c9));};exports[_0x318b('0x11b')]=function(_0x308250,_0x532c8b){var _0x21d2e4=_0x308250[_0x318b('0x53')]['id'];var _0x4de9d8=null;if(_0x308250[_0x318b('0x42')][_0x318b('0x5d')]){_0x4de9d8=_[_0x318b('0xa7')](_0x308250[_0x318b('0x42')][_0x318b('0x5d')])?_0x308250['query'][_0x318b('0x5d')]:[_0x308250[_0x318b('0x42')][_0x318b('0x5d')]];}var _0x1ae65c=[];return Promise[_0x318b('0xff')]()[_0x318b('0x1f')](function(){if(!_0x4de9d8)throw new APIBadRequestError(_0x318b('0x11c'));})[_0x318b('0x1f')](function(){return db[_0x318b('0x36')][_0x318b('0xc2')]({'where':{'id':_0x21d2e4}});})[_0x318b('0x1f')](function(_0x4253a2){if(!_0x4253a2)throw new APINotFoundError(util['format'](_0x318b('0xc4'),_0x308250[_0x318b('0x53')]['id']));return db[_0x318b('0x65')][_0x318b('0x114')](function(_0x21c2f5){return _0x4253a2[_0x318b('0x11b')](_0x4de9d8,{'transaction':_0x21c2f5})[_0x318b('0x1f')](function(){return db[_0x318b('0x111')][_0x318b('0x49')]({'where':{'id':{'$in':_0x4de9d8}}});})[_0x318b('0x1f')](function(_0x2b6ab3){var _0x249487=_[_0x318b('0x2e')](_0x2b6ab3,function(_0xbd5e78){return _0xbd5e78[_0x318b('0x11d')]();});return Promise[_0x318b('0x58')](_0x249487);})[_0x318b('0x1f')](function(_0x4d4a51){_0x1ae65c=_[_0x318b('0x115')](_0x4d4a51);var _0x2d0270=_[_0x318b('0x2e')](_0x1ae65c,function(_0x4b763a){return _0x4b763a[_0x318b('0x11e')](_0x4253a2['id'],{'transaction':_0x21c2f5});});return Promise[_0x318b('0x58')](_0x2d0270);})[_0x318b('0x1f')](function(){if(!_0x4253a2[_0x318b('0x9f')])return;var _0x57fa4c=_[_0x318b('0x2c')](_0x1ae65c,function(_0x5ad84b){return _0x5ad84b['getDataValue'](_0x318b('0x96'))===_0x318b('0x11f');});var _0x349f4f=_['map'](_0x57fa4c,function(_0x18be8a){return db[_0x318b('0xa3')]['destroy']({'where':{'VoiceQueueId':_0x18be8a['id'],'UserId':_0x4253a2['id']},'transaction':_0x21c2f5});});return Promise[_0x318b('0x58')](_0x349f4f);})[_0x318b('0x1f')](function(){return db[_0x318b('0x118')][_0x318b('0x49')]({'where':{'teamId':{'$in':_0x4de9d8}}});})[_0x318b('0x1f')](function(_0x5b092c){var _0x4e1a75=_[_0x318b('0x2e')](_0x5b092c,function(_0x56213c){return db[_0x318b('0x119')][_0x318b('0x23')]({'where':{'UserId':_0x4253a2['id'],'VoicePrefixId':_0x56213c[_0x318b('0x11a')]}},{'transaction':_0x21c2f5});});return Promise[_0x318b('0x58')](_0x4e1a75);});});})[_0x318b('0x1f')](function(){for(var _0x28828c=0x0;_0x28828c<_0x1ae65c[_0x318b('0x4d')];_0x28828c++){var _0x2ab6d6=_0x1ae65c[_0x28828c][_0x318b('0x117')](_0x318b('0x96'));var _0x1acc2f=_0x2ab6d6+_0x318b('0x120');socket[_0x318b('0x21')](_0x318b('0x28')+_0x2ab6d6+_0x318b('0xa8'),{'UserId':_0x21d2e4,['queueField']:_0x1ae65c[_0x28828c]['id']});}})[_0x318b('0x1f')](respondWithStatusCode(_0x532c8b,null))['catch'](APIHandleError(_0x532c8b));};exports['getLists']=function(_0x535da3,_0x51d917){var _0x599636={};var _0x2b8ae2={};var _0x5947cd;var _0x5a61ba;return db[_0x318b('0x36')]['findOne']({'where':{'id':_0x535da3['params']['id']}})[_0x318b('0x1f')](handleEntityNotFound(_0x51d917,null))[_0x318b('0x1f')](function(_0x23c172){if(_0x23c172){_0x5947cd=_0x23c172;_0x2b8ae2[_0x318b('0xcd')]=_[_0x318b('0xce')](db[_0x318b('0xc6')][_0x318b('0x37')]);_0x2b8ae2[_0x318b('0x42')]=_[_0x318b('0xce')](_0x535da3['query']);_0x2b8ae2[_0x318b('0xd4')]=_['intersection'](_0x2b8ae2[_0x318b('0xcd')],_0x2b8ae2[_0x318b('0x42')]);_0x599636['attributes']=_['intersection'](_0x2b8ae2['model'],qs['fields'](_0x535da3[_0x318b('0x42')]['fields']));_0x599636[_0x318b('0x47')]=_0x599636['attributes'][_0x318b('0x4d')]?_0x599636[_0x318b('0x47')]:_0x2b8ae2[_0x318b('0xcd')];_0x599636[_0x318b('0xd2')]=qs[_0x318b('0xd3')](_0x535da3['query']['sort']);_0x599636[_0x318b('0x41')]=qs[_0x318b('0xd4')](_[_0x318b('0xd7')](_0x535da3[_0x318b('0x42')],_0x2b8ae2[_0x318b('0xd4')]));if(_0x535da3['query']['filter']){_0x599636[_0x318b('0x41')]=_[_0x318b('0x54')](_0x599636[_0x318b('0x41')],{'$or':_[_0x318b('0x2e')](_0x599636[_0x318b('0x47')],function(_0x22eb32){var _0x2d9128={};_0x2d9128[_0x22eb32]={'$like':'%'+_0x535da3['query'][_0x318b('0x2c')]+'%'};return _0x2d9128;})});}_0x599636=_['merge']({},_0x599636,_0x535da3[_0x318b('0x55')]);return _0x5947cd['getLists'](_0x599636);}})['then'](function(_0x11634e){if(_0x11634e){_0x5a61ba=_0x11634e[_0x318b('0x4d')];if(!_0x535da3[_0x318b('0x42')][_0x318b('0xc5')]('nolimit')){_0x599636[_0x318b('0xd6')]=qs[_0x318b('0xd6')](_0x535da3[_0x318b('0x42')][_0x318b('0xd6')]);_0x599636[_0x318b('0x1b')]=qs[_0x318b('0x1b')](_0x535da3[_0x318b('0x42')][_0x318b('0x1b')]);}return _0x5947cd[_0x318b('0x121')](_0x599636);}})[_0x318b('0x1f')](function(_0x5e2238){if(_0x5e2238){return _0x5e2238?{'count':_0x5a61ba,'rows':_0x5e2238}:null;}})['then'](respondWithResult(_0x51d917,null))[_0x318b('0x51')](handleError(_0x51d917,null));};exports[_0x318b('0x122')]=function(_0x561e62,_0x43c0c0){var _0x399958={};var _0x207269={};var _0x585f0c;return db[_0x318b('0x36')]['findOne']({'where':{'id':_0x561e62[_0x318b('0x53')]['id']}})[_0x318b('0x1f')](handleEntityNotFound(_0x43c0c0,null))[_0x318b('0x1f')](function(_0x298691){if(_0x298691){_0x585f0c=_0x298691;_0x207269['model']=_[_0x318b('0xce')](db['User'][_0x318b('0x37')]);_0x207269[_0x318b('0x42')]=_[_0x318b('0xce')](_0x561e62[_0x318b('0x42')]);_0x207269[_0x318b('0xd4')]=_[_0x318b('0xd0')](_0x207269[_0x318b('0xcd')],_0x207269[_0x318b('0x42')]);_0x399958[_0x318b('0x47')]=_[_0x318b('0xd0')](_0x207269[_0x318b('0xcd')],qs['fields'](_0x561e62[_0x318b('0x42')][_0x318b('0xd1')]));_0x399958[_0x318b('0x47')]=_0x399958['attributes']['length']?_0x399958[_0x318b('0x47')]:_0x207269['model'];_0x399958[_0x318b('0xd2')]=qs[_0x318b('0xd3')](_0x561e62[_0x318b('0x42')][_0x318b('0xd3')]);_0x399958[_0x318b('0x41')]=qs[_0x318b('0xd4')](_[_0x318b('0xd7')](_0x561e62[_0x318b('0x42')],_0x207269[_0x318b('0xd4')]));if(_0x561e62[_0x318b('0x42')]['filter']){_0x399958[_0x318b('0x41')]=_[_0x318b('0x54')](_0x399958['where'],{'$or':_['map'](_0x399958[_0x318b('0x47')],function(_0x51304f){var _0x541593={};_0x541593[_0x51304f]={'$like':'%'+_0x561e62['query'][_0x318b('0x2c')]+'%'};return _0x541593;})});}_0x399958[_0x318b('0xcd')]=db[_0x318b('0x36')];_0x399958['as']=_0x318b('0x29');_0x399958=_[_0x318b('0x54')]({},_0x399958,_0x561e62[_0x318b('0x55')]);return _0x585f0c[_0x318b('0xf7')]({'include':[_0x399958]});}})['then'](function(_0x5f31ad){if(_0x5f31ad){var _0x112342={},_0x581f0e=[];for(var _0x24431b=0x0;_0x24431b<_0x5f31ad[_0x318b('0x4d')];_0x24431b+=0x1){for(var _0x4d074a=0x0,_0x6bfc0b;_0x4d074a<_0x5f31ad[_0x24431b][_0x318b('0x29')][_0x318b('0x4d')];_0x4d074a+=0x1){_0x6bfc0b=_0x5f31ad[_0x24431b]['Agents'][_0x4d074a][_0x318b('0x24')]({'plain':!![]});_0x112342[_0x6bfc0b['id']]=_0x6bfc0b;}}_0x112342=_['values'](_0x112342);for(var _0x1868ed=qs[_0x318b('0x1b')](_0x561e62[_0x318b('0x42')][_0x318b('0x1b')]);_0x1868ed<_0x112342['length']&&_0x581f0e[_0x318b('0x4d')]=_0xa14442){_0x460a22=_0xa14442;_0x3a4eac=0xc8;}else{_0x3a4eac=0xce;}_0x1c1df4[_0x498b('0x18')](_0x3a4eac);return _0x1c1df4[_0x498b('0x1e')]('Content-Range',_0x52f0e6+'-'+_0x460a22+'/'+_0xa14442)[_0x498b('0x1a')](_0x544114);}return null;};}function saveUpdates(_0xc880ab){return function(_0x441217){if(_0x441217){return _0x441217[_0x498b('0x1f')](_0xc880ab)[_0x498b('0x20')](function(_0x452a22){if(_0x452a22[_0x498b('0x21')]===_0x498b('0x22')){socket[_0x498b('0x23')](_0x498b('0x24')+_0x452a22['id'],_0x452a22);}return _0x452a22;});}return null;};}function removeEntity(_0x220f19){return function(_0x599477){if(_0x599477){return _0x599477[_0x498b('0x25')]()[_0x498b('0x20')](function(){var _0x2a9ad2=_0x599477[_0x498b('0x26')]({'plain':!![]});if(_0x2a9ad2[_0x498b('0x21')]===_0x498b('0x27'))return;var _0x35ff58=[{'name':_0x498b('0x28'),'value':_0x498b('0x29'),'ignore':!![]},{'name':_0x498b('0x2a'),'value':_0x498b('0x22'),'ignore':![]},{'name':_0x498b('0x2b'),'value':_0x498b('0x2c'),'ignore':![]}];var _0x5c3567=_(_0x35ff58)[_0x498b('0x2d')]('ignore')['map'](_0x498b('0x2e'))[_0x498b('0x2e')]();if(_['includes'](_0x5c3567,_0x2a9ad2[_0x498b('0x21')])){return;}var _0x2f331b=_['find'](_0x35ff58,[_0x498b('0x2e'),_0x2a9ad2[_0x498b('0x21')]])[_0x498b('0x2f')];return db[_0x498b('0x30')][_0x498b('0x25')]({'where':{'type':_0x2f331b,'resourceId':_0x2a9ad2['id']}})[_0x498b('0x20')](function(){return _0x599477;});})[_0x498b('0x20')](function(){_0x220f19[_0x498b('0x18')](0xcc)[_0x498b('0x19')]();});}};}function handleEntityNotFound(_0xd63ec0){return function(_0x4c27a4){if(!_0x4c27a4){_0xd63ec0[_0x498b('0x17')](0x194);}return _0x4c27a4;};}function handleError(_0x234502,_0xb2d349){_0xb2d349=_0xb2d349||0x1f4;return function(_0x2851f9){logger[_0x498b('0x31')](_0x2851f9['stack']);if(_0x2851f9['name']){delete _0x2851f9['name'];}_0x234502[_0x498b('0x18')](_0xb2d349)[_0x498b('0x32')](_0x2851f9);};}function getUserAttributes(){return _(db['User'][_0x498b('0x33')])['map'](function(_0x3a0619){return{'name':_0x3a0619[_0x498b('0x34')],'type':_0x3a0619[_0x498b('0x35')][_0x498b('0x36')]};})['filter'](function(_0x2b7cb0){return!['password',_0x498b('0x37'),'previousPasswords','resetPasswordToken',_0x498b('0x38'),_0x498b('0x39')][_0x498b('0x3a')](_0x2b7cb0['name']);})[_0x498b('0x2e')]();}exports[_0x498b('0x3b')]=function(_0x366a09,_0x5b67f7){var _0x512423={},_0x5e635c={'count':0x0,'rows':[]};var _0x50600d=getUserAttributes();_0x512423=qs['getOptions'](_0x50600d,_0x366a09);var _0x5ae302={'where':_0x512423[_0x498b('0x3c')]};return db[_0x498b('0x3d')][_0x498b('0x1d')](_0x5ae302)[_0x498b('0x20')](function(_0x5c15a9){_0x5e635c['count']=_0x5c15a9;if(_0x366a09['query'][_0x498b('0x3e')]){_0x512423['include']=[{'all':!![]}];}if(_0x366a09['query'][_0x498b('0x3f')]===_0x498b('0x40')){_0x512423[_0x498b('0x41')]=[{'model':db['UserSetting'],'as':'userSetting'}];}if(!_[_0x498b('0x3a')](_0x512423[_0x498b('0x42')],'id')){_0x512423['attributes']['push']('id');}return db['User']['findAll'](_0x512423);})[_0x498b('0x20')](function(_0x3f8a6e){_0x5e635c[_0x498b('0x43')]=_0x3f8a6e;if(_0x366a09['query'][_0x498b('0x44')]===_0x498b('0x40')){var _0x5d5b76=[];for(var _0x5a772c=0x0;_0x5a772c<_0x5e635c[_0x498b('0x43')][_0x498b('0x45')];_0x5a772c++){_0x5d5b76[_0x498b('0x46')](get_open_tabs('chat',_0x5e635c[_0x498b('0x43')][_0x5a772c][_0x498b('0x47')]));_0x5d5b76['push'](get_open_tabs(_0x498b('0x48'),_0x5e635c[_0x498b('0x43')][_0x5a772c]['dataValues']));_0x5d5b76[_0x498b('0x46')](get_open_tabs(_0x498b('0x49'),_0x5e635c['rows'][_0x5a772c][_0x498b('0x47')]));_0x5d5b76[_0x498b('0x46')](get_open_tabs(_0x498b('0x4a'),_0x5e635c['rows'][_0x5a772c]['dataValues']));_0x5d5b76[_0x498b('0x46')](get_open_tabs('openchannel',_0x5e635c[_0x498b('0x43')][_0x5a772c][_0x498b('0x47')]));_0x5d5b76['push'](get_open_tabs('whatsapp',_0x5e635c['rows'][_0x5a772c]['dataValues']));}return Promise[_0x498b('0x4b')](_0x5d5b76)[_0x498b('0x20')](function(){return _0x5e635c;});}else{return _0x5e635c;}})[_0x498b('0x20')](respondWithFilteredResult(_0x5b67f7,_0x512423))[_0x498b('0x4c')](handleError(_0x5b67f7,null));};exports[_0x498b('0x4d')]=function(_0x39dbde,_0x54647e){var _0xa9d504=getUserAttributes();_0x39dbde[_0x498b('0x4e')]['id']=_0x39dbde[_0x498b('0x4f')]['id'];var _0x46f152=qs[_0x498b('0x50')](_0xa9d504,_0x39dbde);if(_0x39dbde[_0x498b('0x4e')][_0x498b('0x3e')]){_0x46f152['include']=[{'all':!![]}];}if(_0x39dbde[_0x498b('0x4e')][_0x498b('0x3f')]==='true'){_0x46f152[_0x498b('0x41')]=[{'model':db['UserSetting'],'as':_0x498b('0x3f')}];}_0x46f152=_[_0x498b('0x51')]({},_0x46f152,_0x39dbde['options']);if(!_[_0x498b('0x3a')](_0x46f152[_0x498b('0x42')],'id')){_0x46f152[_0x498b('0x42')][_0x498b('0x46')]('id');}return db['User'][_0x498b('0x52')](_0x46f152)[_0x498b('0x20')](handleEntityNotFound(_0x54647e,null))[_0x498b('0x20')](function(_0x4e1622){var _0x184b48=[];values=_0x4e1622;if(_0x39dbde[_0x498b('0x4e')]['openTabs']===_0x498b('0x40')){_0x184b48['push'](get_open_tabs(_0x498b('0x53'),_0x4e1622['dataValues']));_0x184b48[_0x498b('0x46')](get_open_tabs(_0x498b('0x48'),_0x4e1622['dataValues']));_0x184b48[_0x498b('0x46')](get_open_tabs(_0x498b('0x54'),_0x4e1622['dataValues']));_0x184b48['push'](get_open_tabs('whatsapp',_0x4e1622[_0x498b('0x47')]));_0x184b48[_0x498b('0x46')](get_open_tabs('fax',_0x4e1622[_0x498b('0x47')]));_0x184b48[_0x498b('0x46')](get_open_tabs(_0x498b('0x4a'),_0x4e1622[_0x498b('0x47')]));return Promise['all'](_0x184b48);}else{return values;}})[_0x498b('0x20')](function(){return values;})['then'](respondWithResult(_0x54647e,null))['catch'](handleError(_0x54647e,null));};exports[_0x498b('0x1f')]=function(_0x26654c,_0x522fe0){if(_0x26654c[_0x498b('0x55')]['id']){delete _0x26654c[_0x498b('0x55')]['id'];}delete _0x26654c[_0x498b('0x55')][_0x498b('0x21')];return db[_0x498b('0x3d')]['find']({'where':{'id':_0x26654c[_0x498b('0x4f')]['id']}})[_0x498b('0x20')](handleEntityNotFound(_0x522fe0,null))[_0x498b('0x20')](saveUpdates(_0x26654c[_0x498b('0x55')],null))[_0x498b('0x20')](respondWithResult(_0x522fe0,null))['catch'](handleError(_0x522fe0,null));};exports[_0x498b('0x56')]=function(_0x403c0d,_0x5c03e5){return db[_0x498b('0x3d')][_0x498b('0x56')]()[_0x498b('0x20')](respondWithResult(_0x5c03e5,null))[_0x498b('0x4c')](handleError(_0x5c03e5,null));};exports[_0x498b('0x57')]=function(_0x131557,_0x264d9d){return db['User'][_0x498b('0x52')]({'where':{'id':_0x131557['params']['id']}})[_0x498b('0x20')](handleEntityNotFound(_0x264d9d,null))[_0x498b('0x20')](function(_0x17f0d8){if(_0x17f0d8){return _0x17f0d8[_0x498b('0x57')](_0x131557[_0x498b('0x55')]['ids'],_['omit'](_0x131557[_0x498b('0x55')],['ids','id'])||{});}})[_0x498b('0x20')](respondWithResult(_0x264d9d,null))[_0x498b('0x4c')](handleError(_0x264d9d,null));};function validateUser(_0x111883){return new Promise(function(_0x14ff8d,_0x6af4ee){if(_0x111883['internal'])return _0x14ff8d(_0x111883);return db['Setting'][_0x498b('0x58')](0x1)[_0x498b('0x20')](function(_0x5e1e18){if(_0x5e1e18['securePassword'])authService[_0x498b('0x59')](_0x111883[_0x498b('0x5a')]);db[_0x498b('0x3d')][_0x498b('0x5b')](_0x498b('0x5c'))[_0x498b('0x20')](function(_0x3c46f2){if(_[_0x498b('0x5d')](_0x3c46f2)){_0x111883[_0x498b('0x5c')]=_0x5e1e18['min_internal']||0x1;return;}if(_['isNil'](_0x5e1e18[_0x498b('0x5e')])||_0x5e1e18['min_internal']===_0x3c46f2){_0x111883[_0x498b('0x5c')]=_0x3c46f2+0x1;return;}if(_0x5e1e18[_0x498b('0x5e')]>_0x3c46f2){_0x111883[_0x498b('0x5c')]=_0x5e1e18['min_internal'];return;}return db[_0x498b('0x5f')]['query']('select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)',{'type':db['sequelize']['QueryTypes'][_0x498b('0x60')]})['then'](function(_0x1f7fb8){if(_0x1f7fb8&&_0x1f7fb8[_0x498b('0x45')]){for(var _0x4c9780=0x0,_0x56dc4c=_0x1f7fb8[_0x498b('0x45')];_0x4c9780<_0x56dc4c&&_[_0x498b('0x5d')](_0x111883['internal']);_0x4c9780++){if(_0x5e1e18[_0x498b('0x5e')]<=_0x1f7fb8[_0x4c9780][_0x498b('0x61')]){_0x111883[_0x498b('0x5c')]=_0x1f7fb8[_0x4c9780][_0x498b('0x61')];}else if(_0x5e1e18['min_internal']>_0x1f7fb8[_0x4c9780][_0x498b('0x61')]&&_0x5e1e18['min_internal']<=_0x1f7fb8[_0x4c9780]['to']){_0x111883[_0x498b('0x5c')]=_0x5e1e18[_0x498b('0x5e')];}}}if(_[_0x498b('0x5d')](_0x111883[_0x498b('0x5c')])){_0x111883['internal']=_0x3c46f2+0x1;}return _0x14ff8d(_0x111883);});});})[_0x498b('0x4c')](function(_0x3f1a6e){_0x6af4ee(_0x3f1a6e);});});}function updateUser(_0x54a4f9){return new Promise(function(_0x1245a5,_0x5f1ffa){try{if(_0x54a4f9[_0x498b('0x62')]){_0x54a4f9[_0x498b('0x63')]=_0x54a4f9[_0x498b('0x5c')];_0x54a4f9['VoiceMail']={'mailbox':_0x54a4f9[_0x498b('0x5c')],'password':_0x54a4f9['password'],'fullname':_0x54a4f9[_0x498b('0x64')],'email':_0x54a4f9[_0x498b('0x65')]};}if(_0x54a4f9[_0x498b('0x21')]==='agent'){if(!_0x54a4f9[_0x498b('0x66')])_0x54a4f9['permissions']=[_0x498b('0x67'),_0x498b('0x68'),'103',_0x498b('0x69'),_0x498b('0x6a'),_0x498b('0x6b'),'105',_0x498b('0x6c'),'107','108',_0x498b('0x6d'),_0x498b('0x6e'),'111',_0x498b('0x6f'),'115'];}_0x1245a5(_0x54a4f9);}catch(_0x5e4d26){_0x5f1ffa(_0x5e4d26);}});}exports[_0x498b('0x70')]=function(_0x6f7317,_0x46571f){if(_0x6f7317[_0x498b('0x29')][_0x498b('0x21')]===_0x498b('0x22'))throw new Error('Unauthorized');if(_0x6f7317['body'][_0x498b('0x21')]==='user'&&_0x6f7317[_0x498b('0x29')][_0x498b('0x21')]!==_0x498b('0x27')){throw new Error(_0x498b('0x71'));}if(_0x6f7317[_0x498b('0x55')]['role']===_0x498b('0x27')&&_0x6f7317[_0x498b('0x29')][_0x498b('0x21')]!=='admin'){throw new Error(_0x498b('0x72'));}return licenseUtil['checkUserLimits']([_0x6f7317[_0x498b('0x55')]])[_0x498b('0x20')](function(){return validateUser(_0x6f7317[_0x498b('0x55')]);})[_0x498b('0x20')](function(_0x38d3b5){return updateUser(_0x38d3b5)[_0x498b('0x20')](function(_0x4b5329){if(_0x4b5329[_0x498b('0x21')]===_0x498b('0x27')){_0x4b5329[_0x498b('0x73')]=_0x6f7317[_0x498b('0x29')]['settingsEnabled'];delete _0x4b5329[_0x498b('0x74')];}return _0x4b5329;});})[_0x498b('0x20')](function(_0x1a484b){return db[_0x498b('0x3d')][_0x498b('0x70')](_0x1a484b,{'include':[{'model':db[_0x498b('0x75')],'as':_0x498b('0x75')}]});})['then'](function(_0x37161b){if(_0x6f7317[_0x498b('0x55')][_0x498b('0x21')]==='user')return _0x37161b;if(_0x6f7317['user'][_0x498b('0x21')]!==_0x498b('0x29'))return _0x37161b;return db['UserProfileSection'][_0x498b('0x52')]({'where':{'name':_0x37161b[_0x498b('0x21')]==='agent'?'Agents':_0x498b('0x2b'),'userProfileId':_0x6f7317[_0x498b('0x29')][_0x498b('0x74')]},'raw':!![]})[_0x498b('0x20')](function(_0x64a453){if(!_0x64a453||_0x64a453[_0x498b('0x76')]!=0x0)return _0x37161b;return db[_0x498b('0x30')]['create']({'name':_0x37161b[_0x498b('0x2f')],'resourceId':_0x37161b['id'],'type':_0x64a453[_0x498b('0x2f')],'sectionId':_0x64a453['id']},{})[_0x498b('0x20')](function(){return _0x37161b;});})[_0x498b('0x4c')](function(_0x3771e6){logger[_0x498b('0x31')](_0x498b('0x77'),_0x3771e6);throw _0x3771e6;});})[_0x498b('0x20')](respondWithResult(_0x46571f,0xc9))['catch'](handleError(_0x46571f,null));};exports['bulkCreate']=function(_0x20dbe8,_0x1cd3dc){var _0xb28ccb=_0x20dbe8['body'];var _0x546a2f=[];if(_0x20dbe8[_0x498b('0x29')][_0x498b('0x21')]===_0x498b('0x22'))throw new Error('Unauthorized');if(_['some'](_0xb28ccb,[_0x498b('0x21'),_0x498b('0x29')])&&_0x20dbe8[_0x498b('0x29')][_0x498b('0x21')]!==_0x498b('0x27')){throw new Error(_0x498b('0x71'));}if(_[_0x498b('0x78')](_0xb28ccb,['role',_0x498b('0x27')])&&_0x20dbe8[_0x498b('0x29')]['role']!==_0x498b('0x27')){throw new Error(_0x498b('0x79'));}return licenseUtil['checkUserLimits'](_0xb28ccb)[_0x498b('0x20')](function(){return validateUser(_0xb28ccb[0x0]);})[_0x498b('0x20')](function(){for(var _0x4d0e6e=0x1;_0x4d0e6e<_0xb28ccb[_0x498b('0x45')];_0x4d0e6e++){var _0x20d44c=_0xb28ccb[_0x4d0e6e-0x1][_0x498b('0x5c')];if(!_0xb28ccb[_0x4d0e6e]['internal'])_0xb28ccb[_0x4d0e6e][_0x498b('0x5c')]=_0x20d44c+0x1;_0x546a2f[_0x498b('0x46')](validateUser(_0xb28ccb[_0x4d0e6e]));}return Promise[_0x498b('0x4b')](_0x546a2f);})[_0x498b('0x20')](function(){_0x546a2f=[];for(var _0x50b79d=0x0;_0x50b79d<_0xb28ccb['length'];_0x50b79d++){_0x546a2f['push'](updateUser(_0xb28ccb[_0x50b79d]));}return Promise['all'](_0x546a2f);})[_0x498b('0x20')](function(){_0x546a2f=_0xb28ccb['map'](function(_0x2c68de){return db[_0x498b('0x3d')]['create'](_0x2c68de,{'include':[{'model':db[_0x498b('0x75')],'as':'VoiceMail'}]})['then'](function(_0x5951e5){_0x2c68de['id']=_0x5951e5['id'];return _0x2c68de;});});return Promise['all'](_0x546a2f);})[_0x498b('0x20')](function(_0x717bed){if(_0x20dbe8[_0x498b('0x55')][_0x498b('0x21')]===_0x498b('0x29'))return _0x717bed;if(_0x20dbe8[_0x498b('0x29')]['role']!==_0x498b('0x29'))return _0x717bed;var _0x2eeb58=_['some'](_0x717bed,function(_0x145789){return _0x145789[_0x498b('0x21')]==='agent'||_0x145789[_0x498b('0x21')]===_0x498b('0x2c');});if(!_0x2eeb58)return _0x717bed;return db[_0x498b('0x7a')]['findAll']({'where':{'name':{'$or':[_0x498b('0x2a'),_0x498b('0x2b')]},'userProfileId':_0x20dbe8['user'][_0x498b('0x74')]},'raw':!![]})[_0x498b('0x20')](function(_0x1a576d){if(_[_0x498b('0x7b')](_0x1a576d)||!_[_0x498b('0x78')](_0x1a576d,[_0x498b('0x76'),0x0]))return _0x717bed;_0x546a2f=[];var _0x47f5b4=_(_0x1a576d)[_0x498b('0x7c')](function(_0x9e9006){if(_0x9e9006[_0x498b('0x76')]===0x1)return;return _0x9e9006[_0x498b('0x2f')]==='Agents'?_0x498b('0x22'):_0x498b('0x2c');})[_0x498b('0x7d')]()[_0x498b('0x2e')]();for(var _0x175864=0x0;_0x175864<_0x717bed[_0x498b('0x45')];_0x175864++){if(!_[_0x498b('0x3a')](_0x47f5b4,_0x717bed[_0x175864]['role']))return;var _0x5c8ff5=_0x717bed[_0x175864]['role']===_0x498b('0x22')?_0x498b('0x2a'):'Telephones';_0x546a2f[_0x498b('0x46')](db[_0x498b('0x30')][_0x498b('0x70')]({'name':_0x717bed[_0x175864][_0x498b('0x2f')],'resourceId':_0x717bed[_0x175864]['id'],'type':_0x5c8ff5,'sectionId':_[_0x498b('0x52')](_0x1a576d,['name',_0x5c8ff5])['id']},{}));}return Promise[_0x498b('0x4b')](_0x546a2f);});})[_0x498b('0x20')](respondWithResult(_0x1cd3dc,0xc9))[_0x498b('0x4c')](handleError(_0x1cd3dc,null));};exports[_0x498b('0x7e')]=function(_0x351733,_0x136994){if(_0x351733[_0x498b('0x55')]['id']){delete _0x351733[_0x498b('0x55')]['id'];}return db[_0x498b('0x3d')][_0x498b('0x52')]({'where':{'id':_0x351733[_0x498b('0x4f')]['id']}})[_0x498b('0x20')](function(_0x4330a8){if(!_0x4330a8)return null;if(_0x4330a8['id']===_0x351733[_0x498b('0x29')]['id']){if(!_0x351733[_0x498b('0x55')][_0x498b('0x7f')]||!_0x351733[_0x498b('0x55')][_0x498b('0x80')]){throw new db['Sequelize']['ValidationError']('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x4330a8['authenticate'](_0x351733[_0x498b('0x55')][_0x498b('0x7f')])){throw new db['Sequelize'][(_0x498b('0x81'))]('Wrong\x20credentials');}if(_0x351733[_0x498b('0x55')][_0x498b('0x7f')]===_0x351733[_0x498b('0x55')][_0x498b('0x80')]){throw new db[(_0x498b('0x82'))]['ValidationError'](_0x498b('0x83'));}}else if(_0x351733[_0x498b('0x29')]['role']===_0x498b('0x27')){if(!_0x351733['body'][_0x498b('0x80')]){throw new db['Sequelize'][(_0x498b('0x81'))](_0x498b('0x84'));}}else if(_0x351733[_0x498b('0x29')][_0x498b('0x21')]===_0x498b('0x29')){if(!_0x351733[_0x498b('0x55')][_0x498b('0x80')]){throw new db[(_0x498b('0x82'))][(_0x498b('0x81'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x4330a8['role']!=='agent'){throw new db[(_0x498b('0x82'))][(_0x498b('0x81'))](_0x498b('0x85'));}}else{throw new db['Sequelize'][(_0x498b('0x81'))]('Unauthorized');}return _0x4330a8;})[_0x498b('0x20')](handleEntityNotFound(_0x136994,null))['then'](function(_0x11b510){return db[_0x498b('0x86')]['findOne']({'attributes':['id',_0x498b('0x87'),_0x498b('0x88'),_0x498b('0x89')]})[_0x498b('0x20')](function(_0x539963){if(_0x539963[_0x498b('0x87')])authService['validatePasswordPattern'](_0x351733[_0x498b('0x55')][_0x498b('0x80')]);if(!_0x539963[_0x498b('0x88')]||!_0x11b510[_0x498b('0x8a')])return _0x11b510;authService[_0x498b('0x8b')](_0x351733['body']['newPassword'],_0x11b510[_0x498b('0x8a')],_0x539963[_0x498b('0x89')]);return _0x11b510;})[_0x498b('0x20')](saveUpdates({'password':_0x351733[_0x498b('0x55')][_0x498b('0x80')],'passwordResetAt':_0x351733[_0x498b('0x29')]['id']==_0x351733[_0x498b('0x4f')]['id']?moment():null,'previousPasswords':authService[_0x498b('0x8c')](_0x351733[_0x498b('0x55')][_0x498b('0x80')],_0x11b510[_0x498b('0x8a')])},null));})[_0x498b('0x20')](respondWithResult(_0x136994,null))['catch'](handleError(_0x136994,null));};exports['addQueues']=function(_0x34ef8e,_0x58960c){var _0x24af49=_0x34ef8e[_0x498b('0x55')][_0x498b('0x8d')];return db['User'][_0x498b('0x52')]({'where':{'id':_0x34ef8e[_0x498b('0x4f')]['id']},'attributes':['id',_0x498b('0x2f'),_0x498b('0x21'),'online',_0x498b('0x8e'),_0x498b('0x8f'),_0x498b('0x90')]})['then'](handleEntityNotFound(_0x58960c,null))[_0x498b('0x20')](function(_0x3de06e){if(_0x3de06e){if(!utils[_0x498b('0x91')](_0x24af49)){throw new db['Sequelize'][(_0x498b('0x81'))](_0x498b('0x92'));}return _0x3de06e[_0x498b('0x93')+_[_0x498b('0x94')](_0x24af49['toLowerCase']())+_0x498b('0x95')](_0x34ef8e[_0x498b('0x55')][_0x498b('0x96')],{'penalty':_0x34ef8e[_0x498b('0x55')][_0x498b('0x97')]||0x0})['spread'](function(_0x2960d8){for(var _0x3b7819=0x0;_0x3b7819<_0x34ef8e[_0x498b('0x55')][_0x498b('0x96')][_0x498b('0x45')];_0x3b7819+=0x1){var _0x56a606={'UserId':Number(_0x34ef8e[_0x498b('0x4f')]['id'])};_0x56a606[_[_0x498b('0x94')](_0x24af49[_0x498b('0x98')]())+_0x498b('0x99')]=Number(_0x34ef8e[_0x498b('0x55')]['ids'][_0x3b7819]);socket[_0x498b('0x23')](_0x498b('0x29')+_[_0x498b('0x94')](_0x24af49[_0x498b('0x98')]())+_0x498b('0x9a'),_0x56a606);}return _0x2960d8;})[_0x498b('0x20')](function(){if(_0x24af49===_0x498b('0x9b')){return db[_0x498b('0x9c')][_0x498b('0x9d')]({'where':{'id':_0x34ef8e[_0x498b('0x55')]['ids']||[]},'raw':!![],'attributes':['id',_0x498b('0x2f')]});}})['then'](function(_0x43e43a){var _0x3ccbb1=_0x3de06e[_0x498b('0x26')]({'plain':!![]});var _0x4d138e=[];if(_0x24af49===_0x498b('0x9b')&&_0x3ccbb1[_0x498b('0x21')]==='agent'&&_0x3ccbb1[_0x498b('0x9e')]){for(let _0x11bf67=0x0;_0x11bf67<_0x43e43a[_0x498b('0x45')];_0x11bf67+=0x1){_0x4d138e[_0x498b('0x46')]({'membername':_0x3ccbb1[_0x498b('0x2f')],'UserId':_0x3ccbb1['id'],'queue_name':_0x43e43a[_0x11bf67][_0x498b('0x2f')],'VoiceQueueId':_0x43e43a[_0x11bf67]['id'],'interface':_[_0x498b('0x5d')](_0x3ccbb1['interface'])?util[_0x498b('0x9f')](_0x498b('0xa0'),_0x3ccbb1[_0x498b('0x2f')]):_0x3ccbb1['interface'],'paused':_0x3ccbb1[_0x498b('0x8f')]||![],'penalty':_0x34ef8e['body']['penalty']||0x0});}return Promise[_0x498b('0x4b')](_0x4d138e[_0x498b('0x7c')](function(_0x28d7e5){return db[_0x498b('0xa1')]['upsert'](_0x28d7e5);}));}return _0x3de06e;});}})[_0x498b('0x20')](respondWithStatusCode(_0x58960c,null))['catch'](handleError(_0x58960c,null));};exports[_0x498b('0xa2')]=function(_0x462d6c,_0x3e427e){var _0x5750a8,_0x131218;return db['User'][_0x498b('0x52')]({'where':{'id':_0x462d6c[_0x498b('0x4f')]['id']},'attributes':['id','name','role']})[_0x498b('0x20')](handleEntityNotFound(_0x3e427e,null))[_0x498b('0x20')](function(_0x1cbef9){if(_0x1cbef9){_0x5750a8=_0x1cbef9;if(!_0x462d6c[_0x498b('0x4e')]['channel']||!utils[_0x498b('0x91')](_0x462d6c[_0x498b('0x4e')][_0x498b('0x8d')])){throw new db[(_0x498b('0x82'))][(_0x498b('0x81'))]('Unknown\x20channel');}return _0x1cbef9[_0x498b('0xa3')+_[_0x498b('0x94')](_0x462d6c[_0x498b('0x4e')][_0x498b('0x8d')][_0x498b('0x98')]())+'Queues'](_0x462d6c[_0x498b('0x4e')][_0x498b('0x96')]);}})['then'](function(_0x13369c){if(_['isArray'](_0x462d6c['query'][_0x498b('0x96')])){for(var _0x427103=0x0;_0x427103<_0x462d6c[_0x498b('0x4e')][_0x498b('0x96')][_0x498b('0x45')];_0x427103+=0x1){_0x131218={'UserId':Number(_0x462d6c['params']['id'])};_0x131218[_[_0x498b('0x94')](_0x462d6c[_0x498b('0x4e')][_0x498b('0x8d')]['toLowerCase']())+_0x498b('0x99')]=Number(_0x462d6c[_0x498b('0x4e')][_0x498b('0x96')][_0x427103]);socket[_0x498b('0x23')](_0x498b('0x29')+_[_0x498b('0x94')](_0x462d6c[_0x498b('0x4e')][_0x498b('0x8d')][_0x498b('0x98')]())+_0x498b('0xa4'),_0x131218);}}else{_0x131218={'UserId':Number(_0x462d6c['params']['id'])};_0x131218[_['capitalize'](_0x462d6c[_0x498b('0x4e')][_0x498b('0x8d')][_0x498b('0x98')]())+'QueueId']=Number(_0x462d6c[_0x498b('0x4e')][_0x498b('0x96')]);socket['emit'](_0x498b('0x29')+_[_0x498b('0x94')](_0x462d6c[_0x498b('0x4e')][_0x498b('0x8d')][_0x498b('0x98')]())+_0x498b('0xa4'),_0x131218);}return _0x13369c;})['then'](function(){if(_0x462d6c[_0x498b('0x4e')][_0x498b('0x8d')]==='voice'){return db[_0x498b('0xa1')][_0x498b('0x25')]({'where':{'UserId':_0x462d6c['params']['id'],'VoiceQueueId':_0x462d6c[_0x498b('0x4e')]['ids']},'individualHooks':!![]})[_0x498b('0x20')](function(){return _0x5750a8;});}return _0x5750a8;})[_0x498b('0x20')](respondWithStatusCode(_0x3e427e,null))[_0x498b('0x4c')](handleError(_0x3e427e,null));};exports[_0x498b('0xa5')]=function(_0x6f5ca9,_0x5a51f0){_0x6f5ca9[_0x498b('0x55')][_0x498b('0xa6')]=_0x6f5ca9[_0x498b('0xa7')]['filename'];return db[_0x498b('0x3d')][_0x498b('0x52')]({'where':{'id':_0x6f5ca9[_0x498b('0x4f')]['id']}})[_0x498b('0x20')](handleEntityNotFound(_0x5a51f0,null))[_0x498b('0x20')](saveUpdates(_0x6f5ca9[_0x498b('0x55')],null))[_0x498b('0x20')](respondWithResult(_0x5a51f0,null))[_0x498b('0x4c')](handleError(_0x5a51f0,null));};exports['getAvatar']=function(_0x6d1bdb,_0x5698f4){var _0x3985b4=path[_0x498b('0xa8')](config['root'],_0x498b('0xa9'));return db[_0x498b('0x3d')][_0x498b('0x52')]({'where':{'id':_0x6d1bdb[_0x498b('0x4f')]['id']},'attributes':['id',_0x498b('0xa6')],'raw':!![]})[_0x498b('0x20')](handleEntityNotFound(_0x5698f4,null))['then'](function(_0x17df18){if(_0x17df18){if(_[_0x498b('0x5d')](_0x17df18['userpic'])){return _0x5698f4['download'](_0x3985b4);}else{if(!fs['existsSync'](path[_0x498b('0xa8')](config[_0x498b('0xaa')],_0x498b('0xab'),_0x17df18['userpic']))){return _0x5698f4[_0x498b('0xac')](_0x3985b4);}return _0x5698f4[_0x498b('0xac')](path[_0x498b('0xa8')](config[_0x498b('0xaa')],_0x498b('0xab'),_0x17df18[_0x498b('0xa6')]));}}})['catch'](handleError(_0x5698f4,null));};exports[_0x498b('0xad')]=function(_0x39f9df,_0x4bbb11){return db[_0x498b('0x3d')][_0x498b('0x52')]({'where':{'id':_0x39f9df[_0x498b('0x4f')]['id']},'attributes':['id']})['then'](handleEntityNotFound(_0x4bbb11,null))[_0x498b('0x20')](function(_0xe9d8ca){var _0x1727c5=[];values=_0xe9d8ca[_0x498b('0x47')];_0x1727c5[_0x498b('0x46')](get_open_tabs('chat',_0xe9d8ca[_0x498b('0x47')]));_0x1727c5['push'](get_open_tabs('sms',_0xe9d8ca[_0x498b('0x47')]));_0x1727c5[_0x498b('0x46')](get_open_tabs(_0x498b('0x54'),_0xe9d8ca['dataValues']));_0x1727c5[_0x498b('0x46')](get_open_tabs(_0x498b('0xae'),_0xe9d8ca[_0x498b('0x47')]));_0x1727c5[_0x498b('0x46')](get_open_tabs(_0x498b('0x49'),_0xe9d8ca['dataValues']));_0x1727c5['push'](get_open_tabs(_0x498b('0x4a'),_0xe9d8ca[_0x498b('0x47')]));return Promise[_0x498b('0x4b')](_0x1727c5);})[_0x498b('0x20')](function(_0x795e44){if(_0x795e44){var _0x3df7cf=_['map'](values[_0x498b('0xaf')],function(_0x5d6b31){return{'channel':_0x498b('0xb0'),'id':_0x5d6b31['id'],'createdAt':_0x5d6b31[_0x498b('0xb1')]};});var _0xcce6ea=_['map'](values[_0x498b('0xb2')],function(_0x1e30d6){return{'channel':_0x498b('0xb3'),'id':_0x1e30d6['id'],'createdAt':_0x1e30d6[_0x498b('0xb1')]};});var _0x22eb22=_[_0x498b('0x7c')](values[_0x498b('0xb4')],function(_0x39d61f){return{'channel':_0x498b('0xb5'),'id':_0x39d61f['id'],'createdAt':_0x39d61f[_0x498b('0xb1')]};});var _0x163524=_['map'](values[_0x498b('0xb6')],function(_0x477dd5){return{'channel':_0x498b('0xb7'),'id':_0x477dd5['id'],'createdAt':_0x477dd5[_0x498b('0xb1')]};});var _0x1de1f4=_[_0x498b('0x7c')](values['SmsOpenTabs'],function(_0x290e46){return{'channel':_0x498b('0xb8'),'id':_0x290e46['id'],'createdAt':_0x290e46[_0x498b('0xb1')]};});var _0x4390bb=_[_0x498b('0x7c')](values['WhatsappOpenTabs'],function(_0x316c21){return{'channel':'WHATSAPP','id':_0x316c21['id'],'createdAt':_0x316c21[_0x498b('0xb1')]};});var _0x3a5abc=_[_0x498b('0xb9')](_0x3df7cf,_0xcce6ea,_0x22eb22,_0x163524,_0x1de1f4,_0x4390bb);var _0x1bdac5={'count':_0x3a5abc[_0x498b('0x45')],'rows':_0x3a5abc};return _0x1bdac5;}else return null;})[_0x498b('0x20')](respondWithResult(_0x4bbb11,null))['catch'](handleError(_0x4bbb11,null));};exports[_0x498b('0xba')]=function(_0x4f4332,_0x5b99a9){var _0x505311={};return db[_0x498b('0x3d')][_0x498b('0xbb')]({'where':{'id':_0x4f4332[_0x498b('0x4f')]['id']}})[_0x498b('0x20')](function(_0x1c22e0){if(!_0x1c22e0){throw new APINotFoundError(util[_0x498b('0x9f')](_0x498b('0xbc'),_0x4f4332[_0x498b('0x4f')]['id']));}return contacts['describe']();})[_0x498b('0x20')](function(_0x50a462){_0x4f4332[_0x498b('0x4e')]['User']=_0x4f4332[_0x498b('0x4f')]['id'];_0x505311=qs[_0x498b('0x50')](_0x50a462,_0x4f4332);if(_0x4f4332['query'][_0x498b('0xbd')](_0x498b('0x3e'))){_0x505311[_0x498b('0x41')]=[{'model':db[_0x498b('0xbe')],'as':_0x498b('0xbf'),'required':![]},{'model':db[_0x498b('0xc0')],'as':_0x498b('0xc1'),'attributes':['id',_0x498b('0x2f'),_0x498b('0xc2')],'where':_0x4f4332[_0x498b('0x4e')][_0x498b('0xc3')]?{'id':_0x4f4332[_0x498b('0x4e')][_0x498b('0xc3')]}:undefined,'required':_0x4f4332[_0x498b('0x4e')][_0x498b('0xc3')]?!![]:![]}];}return contacts['findAll'](_0x4f4332['query'],_0x4f4332[_0x498b('0x29')],_0x505311,_0x50a462);})[_0x498b('0x20')](respondWithFilteredResult(_0x5b99a9,_0x505311))['catch'](APIHandleError(_0x5b99a9));};exports['getQueues']=function(_0x14e999,_0x3f977e){var _0x2a7e71;var _0x6e0ebe={};var _0x5c446d;return db[_0x498b('0x3d')][_0x498b('0xbb')]({'where':{'id':_0x14e999[_0x498b('0x4f')]['id']},'attributes':['id',_0x498b('0x2f'),_0x498b('0x21')]})[_0x498b('0x20')](handleEntityNotFound(_0x3f977e,null))[_0x498b('0x20')](function(_0x5c7930){if(!utils[_0x498b('0x91')](_0x14e999['query'][_0x498b('0x8d')])){throw new db[(_0x498b('0x82'))][(_0x498b('0x81'))](_0x498b('0x92'));}_0x2a7e71=_0x5c7930;var _0x2ca2={};_0x2ca2['model']=_[_0x498b('0xc4')](db[_[_0x498b('0x94')](_0x14e999[_0x498b('0x4e')][_0x498b('0x8d')])+_0x498b('0xc5')][_0x498b('0x33')]);_0x2ca2['query']=_['keys'](_0x14e999['query']);_0x2ca2['filters']=_['intersection'](_0x2ca2['model'],_0x2ca2['query']);_0x6e0ebe[_0x498b('0x42')]=_[_0x498b('0xc6')](_0x2ca2[_0x498b('0xc7')],qs[_0x498b('0xc8')](_0x14e999[_0x498b('0x4e')][_0x498b('0xc8')]));_0x6e0ebe['attributes']=_0x6e0ebe[_0x498b('0x42')][_0x498b('0x45')]?_0x6e0ebe[_0x498b('0x42')]:_0x2ca2[_0x498b('0xc7')];_0x6e0ebe[_0x498b('0xc9')]=qs[_0x498b('0xca')](_0x14e999['query'][_0x498b('0xca')]);_0x6e0ebe[_0x498b('0x3c')]=qs[_0x498b('0xcb')](_[_0x498b('0xcc')](_0x14e999[_0x498b('0x4e')],_0x2ca2[_0x498b('0xcb')]));if(_0x14e999[_0x498b('0x4e')][_0x498b('0x2d')]){_0x6e0ebe[_0x498b('0x3c')]=_[_0x498b('0x51')](_0x6e0ebe['where'],{'$or':_[_0x498b('0x7c')](_0x6e0ebe[_0x498b('0x42')],function(_0x2d98f1){var _0x27109d={};_0x27109d[_0x2d98f1]={'$like':'%'+_0x14e999[_0x498b('0x4e')][_0x498b('0x2d')]+'%'};return _0x27109d;})});}_0x6e0ebe=_[_0x498b('0x51')]({},_0x6e0ebe,_0x14e999[_0x498b('0xcd')]);switch(_0x2a7e71[_0x498b('0x21')]){case'admin':return db[_[_0x498b('0x94')](_0x14e999['query'][_0x498b('0x8d')])+_0x498b('0xc5')][_0x498b('0x9d')](_0x6e0ebe);case _0x498b('0x29'):case'agent':return _0x2a7e71['get'+_[_0x498b('0x94')](_0x14e999[_0x498b('0x4e')]['channel'])+'Queues'](_0x6e0ebe);default:throw new db['Sequelize'][(_0x498b('0x81'))](_0x498b('0xce'));}})['then'](function(_0xab27b0){_0x5c446d=_0xab27b0[_0x498b('0x45')];if(!_0x14e999[_0x498b('0x4e')][_0x498b('0xbd')]('nolimit')){_0x6e0ebe[_0x498b('0x1c')]=qs[_0x498b('0x1c')](_0x14e999['query'][_0x498b('0x1c')]);_0x6e0ebe[_0x498b('0x1b')]=qs[_0x498b('0x1b')](_0x14e999['query']['offset']);}switch(_0x2a7e71[_0x498b('0x21')]){case'admin':return db[_[_0x498b('0x94')](_0x14e999[_0x498b('0x4e')][_0x498b('0x8d')])+_0x498b('0xc5')][_0x498b('0x9d')](_0x6e0ebe);case'user':case _0x498b('0x22'):return _0x2a7e71[_0x498b('0x26')+_['capitalize'](_0x14e999[_0x498b('0x4e')][_0x498b('0x8d')])+_0x498b('0x95')](_0x6e0ebe);}})[_0x498b('0x20')](function(_0x151186){return{'count':_0x5c446d,'rows':_0x151186};})[_0x498b('0x20')](respondWithResult(_0x3f977e,null))[_0x498b('0x4c')](handleError(_0x3f977e,null));};exports[_0x498b('0xcf')]=function(_0x50d5a5,_0x3b2aee){var _0x1d8621={};var _0x20e1e6={};var _0x4d3e74;var _0x435f6e;return db['User'][_0x498b('0xbb')]({'where':{'id':_0x50d5a5[_0x498b('0x4f')]['id']}})[_0x498b('0x20')](handleEntityNotFound(_0x3b2aee,null))[_0x498b('0x20')](function(_0x371471){if(_0x371471){_0x4d3e74=_0x371471;_0x20e1e6[_0x498b('0xc7')]=_['keys'](db[_0x498b('0xa1')][_0x498b('0x33')]);_0x20e1e6[_0x498b('0x4e')]=_[_0x498b('0xc4')](_0x50d5a5['query']);_0x20e1e6[_0x498b('0xcb')]=_[_0x498b('0xc6')](_0x20e1e6[_0x498b('0xc7')],_0x20e1e6[_0x498b('0x4e')]);_0x1d8621['attributes']=_[_0x498b('0xc6')](_0x20e1e6[_0x498b('0xc7')],qs[_0x498b('0xc8')](_0x50d5a5[_0x498b('0x4e')][_0x498b('0xc8')]));_0x1d8621[_0x498b('0x42')]=_0x1d8621['attributes'][_0x498b('0x45')]?_0x1d8621['attributes']:_0x20e1e6['model'];_0x1d8621[_0x498b('0xc9')]=qs['sort'](_0x50d5a5[_0x498b('0x4e')][_0x498b('0xca')]);_0x1d8621[_0x498b('0x3c')]=qs[_0x498b('0xcb')](_[_0x498b('0xcc')](_0x50d5a5['query'],_0x20e1e6[_0x498b('0xcb')]));if(_0x50d5a5[_0x498b('0x4e')][_0x498b('0x2d')]){_0x1d8621[_0x498b('0x3c')]=_[_0x498b('0x51')](_0x1d8621['where'],{'$or':_[_0x498b('0x7c')](_0x1d8621[_0x498b('0x42')],function(_0x71547b){var _0x437cd3={};_0x437cd3[_0x71547b]={'$like':'%'+_0x50d5a5[_0x498b('0x4e')]['filter']+'%'};return _0x437cd3;})});}_0x1d8621=_[_0x498b('0x51')]({},_0x1d8621,_0x50d5a5[_0x498b('0xcd')]);return _0x4d3e74['getVoiceQueuesRt'](_0x1d8621);}})['then'](function(_0x41729f){if(_0x41729f){_0x435f6e=_0x41729f[_0x498b('0x45')];if(!_0x50d5a5[_0x498b('0x4e')]['hasOwnProperty']('nolimit')){_0x1d8621['limit']=qs[_0x498b('0x1c')](_0x50d5a5['query'][_0x498b('0x1c')]);_0x1d8621[_0x498b('0x1b')]=qs[_0x498b('0x1b')](_0x50d5a5['query']['offset']);}return _0x4d3e74[_0x498b('0xcf')](_0x1d8621);}})[_0x498b('0x20')](function(_0x1f71e4){if(_0x1f71e4){return _0x1f71e4?{'count':_0x435f6e,'rows':_0x1f71e4}:null;}})[_0x498b('0x20')](respondWithResult(_0x3b2aee,null))[_0x498b('0x4c')](handleError(_0x3b2aee,null));};exports[_0x498b('0xd0')]=function(_0x534628,_0x487fc8){var _0x429861={};var _0x42c12a={};var _0x410ef3;var _0x1f178f;return db[_0x498b('0x3d')]['findOne']({'where':{'id':_0x534628[_0x498b('0x4f')]['id']}})[_0x498b('0x20')](handleEntityNotFound(_0x487fc8,null))[_0x498b('0x20')](function(_0x3557bc){if(_0x3557bc){_0x410ef3=_0x3557bc;_0x42c12a[_0x498b('0xc7')]=_[_0x498b('0xc4')](db[_0x498b('0xd1')][_0x498b('0x33')]);_0x42c12a[_0x498b('0x4e')]=_[_0x498b('0xc4')](_0x534628[_0x498b('0x4e')]);_0x42c12a['filters']=_['intersection'](_0x42c12a[_0x498b('0xc7')],_0x42c12a[_0x498b('0x4e')]);_0x429861[_0x498b('0x42')]=_['intersection'](_0x42c12a[_0x498b('0xc7')],qs[_0x498b('0xc8')](_0x534628[_0x498b('0x4e')]['fields']));_0x429861[_0x498b('0x42')]=_0x429861['attributes'][_0x498b('0x45')]?_0x429861[_0x498b('0x42')]:_0x42c12a[_0x498b('0xc7')];_0x429861[_0x498b('0xc9')]=qs[_0x498b('0xca')](_0x534628[_0x498b('0x4e')]['sort']);_0x429861['where']=qs['filters'](_['pick'](_0x534628[_0x498b('0x4e')],_0x42c12a[_0x498b('0xcb')]));if(_0x534628[_0x498b('0x4e')]['filter']){_0x429861[_0x498b('0x3c')]=_[_0x498b('0x51')](_0x429861[_0x498b('0x3c')],{'$or':_[_0x498b('0x7c')](_0x429861[_0x498b('0x42')],function(_0x5d7122){var _0x52a1d9={};_0x52a1d9[_0x5d7122]={'$like':'%'+_0x534628['query'][_0x498b('0x2d')]+'%'};return _0x52a1d9;})});}_0x429861=_[_0x498b('0x51')]({},_0x429861,_0x534628[_0x498b('0xcd')]);return _0x410ef3['getGroups'](_0x429861);}})[_0x498b('0x20')](function(_0x117763){if(_0x117763){_0x1f178f=_0x117763[_0x498b('0x45')];if(!_0x534628[_0x498b('0x4e')][_0x498b('0xbd')](_0x498b('0xd2'))){_0x429861[_0x498b('0x1c')]=qs[_0x498b('0x1c')](_0x534628[_0x498b('0x4e')][_0x498b('0x1c')]);_0x429861[_0x498b('0x1b')]=qs[_0x498b('0x1b')](_0x534628[_0x498b('0x4e')][_0x498b('0x1b')]);}return _0x410ef3[_0x498b('0xd0')](_0x429861);}})[_0x498b('0x20')](function(_0x2c90e5){if(_0x2c90e5){return _0x2c90e5?{'count':_0x1f178f,'rows':_0x2c90e5}:null;}})['then'](respondWithResult(_0x487fc8,null))[_0x498b('0x4c')](handleError(_0x487fc8,null));};exports['getRecordings']=function(_0x5ca9ee,_0x59a9b0){var _0x28bbac={'raw':!![],'where':{}};var _0x3d4a40={};var _0x26fe2f={'count':0x0,'rows':[]};return db[_0x498b('0x3d')][_0x498b('0xbb')]({'where':{'id':_0x5ca9ee['params']['id']}})['then'](handleEntityNotFound(_0x59a9b0,null))[_0x498b('0x20')](function(_0x51cd66){if(_0x51cd66){_0x3d4a40[_0x498b('0xc7')]=_[_0x498b('0xc4')](db[_0x498b('0xd3')][_0x498b('0x33')]);_0x3d4a40['query']=_['keys'](_0x5ca9ee[_0x498b('0x4e')]);_0x3d4a40[_0x498b('0xcb')]=_[_0x498b('0xc6')](_0x3d4a40['model'],_0x3d4a40['query']);_0x28bbac['attributes']=_['intersection'](_0x3d4a40[_0x498b('0xc7')],qs[_0x498b('0xc8')](_0x5ca9ee['query'][_0x498b('0xc8')]));_0x28bbac[_0x498b('0x42')]=_0x28bbac[_0x498b('0x42')]['length']?_0x28bbac['attributes']:_0x3d4a40[_0x498b('0xc7')];if(!_0x5ca9ee[_0x498b('0x4e')][_0x498b('0xbd')](_0x498b('0xd2'))){_0x28bbac[_0x498b('0x1c')]=qs[_0x498b('0x1c')](_0x5ca9ee[_0x498b('0x4e')][_0x498b('0x1c')]);_0x28bbac['offset']=qs[_0x498b('0x1b')](_0x5ca9ee['query']['offset']);}_0x28bbac['order']=qs[_0x498b('0xca')](_0x5ca9ee[_0x498b('0x4e')]['sort']);_0x28bbac[_0x498b('0x3c')]=qs[_0x498b('0xcb')](_[_0x498b('0xcc')](_0x5ca9ee[_0x498b('0x4e')],_0x3d4a40[_0x498b('0xcb')]));_0x28bbac[_0x498b('0x3c')]['UserId']=_0x51cd66['id'];if(_0x5ca9ee['query']['filter']){_0x28bbac[_0x498b('0x3c')]=_[_0x498b('0x51')](_0x28bbac[_0x498b('0x3c')],{'$or':_[_0x498b('0x7c')](_0x28bbac[_0x498b('0x42')],function(_0x36ea35){var _0x2aa228={};_0x2aa228[_0x36ea35]={'$like':'%'+_0x5ca9ee['query'][_0x498b('0x2d')]+'%'};return _0x2aa228;})});}_0x28bbac=_[_0x498b('0x51')]({},_0x28bbac,_0x5ca9ee[_0x498b('0xcd')]);return db[_0x498b('0xd3')]['count']({'where':_0x28bbac[_0x498b('0x3c')]})['then'](function(_0x1a7039){_0x26fe2f[_0x498b('0x1d')]=_0x1a7039;if(_0x5ca9ee[_0x498b('0x4e')][_0x498b('0x3e')]){_0x28bbac['include']=[{'all':!![]}];}return db['VoiceRecording']['findAll'](_0x28bbac);})[_0x498b('0x20')](function(_0x380b60){_0x26fe2f[_0x498b('0x43')]=_0x380b60;return _0x26fe2f;});}})['then'](respondWithFilteredResult(_0x59a9b0,_0x28bbac))['catch'](handleError(_0x59a9b0,null));};exports[_0x498b('0xd4')]=function(_0x55c1a0,_0x108f6d){var _0xc2957f={'raw':!![],'where':{}};var _0x19f7c6={};var _0x4d8329={'count':0x0,'rows':[]};return db[_0x498b('0x3d')][_0x498b('0xbb')]({'where':{'id':_0x55c1a0['params']['id']}})[_0x498b('0x20')](handleEntityNotFound(_0x108f6d,null))[_0x498b('0x20')](function(_0x5294bc){if(_0x5294bc){_0x19f7c6['model']=_['keys'](db[_0x498b('0xd5')][_0x498b('0x33')]);_0x19f7c6['query']=_[_0x498b('0xc4')](_0x55c1a0[_0x498b('0x4e')]);_0x19f7c6[_0x498b('0xcb')]=_[_0x498b('0xc6')](_0x19f7c6[_0x498b('0xc7')],_0x19f7c6[_0x498b('0x4e')]);_0xc2957f[_0x498b('0x42')]=_['intersection'](_0x19f7c6[_0x498b('0xc7')],qs[_0x498b('0xc8')](_0x55c1a0['query'][_0x498b('0xc8')]));_0xc2957f['attributes']=_0xc2957f[_0x498b('0x42')][_0x498b('0x45')]?_0xc2957f['attributes']:_0x19f7c6['model'];if(!_0x55c1a0[_0x498b('0x4e')][_0x498b('0xbd')](_0x498b('0xd2'))){_0xc2957f[_0x498b('0x1c')]=qs[_0x498b('0x1c')](_0x55c1a0['query'][_0x498b('0x1c')]);_0xc2957f[_0x498b('0x1b')]=qs['offset'](_0x55c1a0[_0x498b('0x4e')][_0x498b('0x1b')]);}_0xc2957f[_0x498b('0xc9')]=qs[_0x498b('0xca')](_0x55c1a0[_0x498b('0x4e')][_0x498b('0xca')]);_0xc2957f[_0x498b('0x3c')]=qs[_0x498b('0xcb')](_['pick'](_0x55c1a0[_0x498b('0x4e')],_0x19f7c6[_0x498b('0xcb')]));_0xc2957f[_0x498b('0x3c')]['UserId']=_0x5294bc['id'];if(_0x55c1a0['query']['filter']){_0xc2957f[_0x498b('0x3c')]=_[_0x498b('0x51')](_0xc2957f['where'],{'$or':_[_0x498b('0x7c')](_0xc2957f[_0x498b('0x42')],function(_0x4f3738){var _0x581363={};_0x581363[_0x4f3738]={'$like':'%'+_0x55c1a0['query'][_0x498b('0x2d')]+'%'};return _0x581363;})});}_0xc2957f=_[_0x498b('0x51')]({},_0xc2957f,_0x55c1a0['options']);return db[_0x498b('0xd5')][_0x498b('0x1d')]({'where':_0xc2957f[_0x498b('0x3c')]})[_0x498b('0x20')](function(_0x320ecf){_0x4d8329[_0x498b('0x1d')]=_0x320ecf;if(_0x55c1a0[_0x498b('0x4e')][_0x498b('0x3e')]){_0xc2957f['include']=[{'all':!![]}];}return db[_0x498b('0xd5')][_0x498b('0x9d')](_0xc2957f);})[_0x498b('0x20')](function(_0x53bac8){_0x4d8329[_0x498b('0x43')]=_0x53bac8;return _0x4d8329;});}})[_0x498b('0x20')](respondWithFilteredResult(_0x108f6d,_0xc2957f))['catch'](handleError(_0x108f6d,null));};exports['getChatInteractions']=function(_0x565444,_0x592a31){var _0x2e545f={};var _0x5d67fb={};var _0x4fff55;var _0x190987;return db[_0x498b('0x3d')]['findOne']({'where':{'id':_0x565444[_0x498b('0x4f')]['id']}})[_0x498b('0x20')](handleEntityNotFound(_0x592a31,null))['then'](function(_0x1a7016){if(_0x1a7016){_0x4fff55=_0x1a7016;_0x5d67fb[_0x498b('0xc7')]=_['keys'](db[_0x498b('0xd6')]['rawAttributes']);_0x5d67fb[_0x498b('0x4e')]=_[_0x498b('0xc4')](_0x565444['query']);_0x5d67fb[_0x498b('0xcb')]=_[_0x498b('0xc6')](_0x5d67fb['model'],_0x5d67fb[_0x498b('0x4e')]);_0x2e545f[_0x498b('0x42')]=_[_0x498b('0xc6')](_0x5d67fb[_0x498b('0xc7')],qs[_0x498b('0xc8')](_0x565444[_0x498b('0x4e')][_0x498b('0xc8')]));_0x2e545f[_0x498b('0x42')]=_0x2e545f[_0x498b('0x42')][_0x498b('0x45')]?_0x2e545f[_0x498b('0x42')]:_0x5d67fb['model'];_0x2e545f[_0x498b('0xc9')]=qs[_0x498b('0xca')](_0x565444[_0x498b('0x4e')]['sort']);_0x2e545f[_0x498b('0x3c')]=qs[_0x498b('0xcb')](_[_0x498b('0xcc')](_0x565444[_0x498b('0x4e')],_0x5d67fb[_0x498b('0xcb')]));if(_0x565444[_0x498b('0x4e')][_0x498b('0x2d')]){_0x2e545f[_0x498b('0x3c')]=_[_0x498b('0x51')](_0x2e545f['where'],{'$or':_[_0x498b('0x7c')](_0x2e545f[_0x498b('0x42')],function(_0x248074){var _0x1b6f81={};_0x1b6f81[_0x248074]={'$like':'%'+_0x565444[_0x498b('0x4e')][_0x498b('0x2d')]+'%'};return _0x1b6f81;})});}_0x2e545f=_['merge']({},_0x2e545f,_0x565444[_0x498b('0xcd')]);return _0x4fff55['getChatInteractions'](_0x2e545f);}})[_0x498b('0x20')](function(_0x714aac){if(_0x714aac){_0x190987=_0x714aac[_0x498b('0x45')];if(!_0x565444[_0x498b('0x4e')][_0x498b('0xbd')]('nolimit')){_0x2e545f[_0x498b('0x1c')]=qs[_0x498b('0x1c')](_0x565444['query']['limit']);_0x2e545f[_0x498b('0x1b')]=qs[_0x498b('0x1b')](_0x565444[_0x498b('0x4e')][_0x498b('0x1b')]);}return _0x4fff55[_0x498b('0xd7')](_0x2e545f);}})[_0x498b('0x20')](function(_0x5b7076){if(_0x5b7076){return _0x5b7076?{'count':_0x190987,'rows':_0x5b7076}:null;}})[_0x498b('0x20')](respondWithResult(_0x592a31,null))[_0x498b('0x4c')](handleError(_0x592a31,null));};exports['getOpenchannelInteractions']=function(_0x9e3b07,_0x2ee17f){var _0x111b32={};var _0x116498={};var _0x3424bd;var _0x1a9980;return db[_0x498b('0x3d')][_0x498b('0xbb')]({'where':{'id':_0x9e3b07[_0x498b('0x4f')]['id']}})['then'](handleEntityNotFound(_0x2ee17f,null))['then'](function(_0xd77245){if(_0xd77245){_0x3424bd=_0xd77245;_0x116498[_0x498b('0xc7')]=_['keys'](db[_0x498b('0xd8')][_0x498b('0x33')]);_0x116498[_0x498b('0x4e')]=_[_0x498b('0xc4')](_0x9e3b07[_0x498b('0x4e')]);_0x116498['filters']=_['intersection'](_0x116498[_0x498b('0xc7')],_0x116498[_0x498b('0x4e')]);_0x111b32[_0x498b('0x42')]=_['intersection'](_0x116498['model'],qs[_0x498b('0xc8')](_0x9e3b07['query'][_0x498b('0xc8')]));_0x111b32[_0x498b('0x42')]=_0x111b32['attributes'][_0x498b('0x45')]?_0x111b32[_0x498b('0x42')]:_0x116498[_0x498b('0xc7')];_0x111b32[_0x498b('0xc9')]=qs[_0x498b('0xca')](_0x9e3b07[_0x498b('0x4e')]['sort']);_0x111b32[_0x498b('0x3c')]=qs[_0x498b('0xcb')](_[_0x498b('0xcc')](_0x9e3b07[_0x498b('0x4e')],_0x116498[_0x498b('0xcb')]));if(_0x9e3b07['query']['filter']){_0x111b32[_0x498b('0x3c')]=_[_0x498b('0x51')](_0x111b32[_0x498b('0x3c')],{'$or':_[_0x498b('0x7c')](_0x111b32[_0x498b('0x42')],function(_0x235c21){var _0x430e88={};_0x430e88[_0x235c21]={'$like':'%'+_0x9e3b07[_0x498b('0x4e')]['filter']+'%'};return _0x430e88;})});}_0x111b32=_[_0x498b('0x51')]({},_0x111b32,_0x9e3b07[_0x498b('0xcd')]);return _0x3424bd[_0x498b('0xd9')](_0x111b32);}})['then'](function(_0x5e9aa8){if(_0x5e9aa8){_0x1a9980=_0x5e9aa8[_0x498b('0x45')];if(!_0x9e3b07['query'][_0x498b('0xbd')](_0x498b('0xd2'))){_0x111b32[_0x498b('0x1c')]=qs[_0x498b('0x1c')](_0x9e3b07[_0x498b('0x4e')]['limit']);_0x111b32[_0x498b('0x1b')]=qs['offset'](_0x9e3b07[_0x498b('0x4e')][_0x498b('0x1b')]);}return _0x3424bd[_0x498b('0xd9')](_0x111b32);}})[_0x498b('0x20')](function(_0x5a9b99){if(_0x5a9b99){return _0x5a9b99?{'count':_0x1a9980,'rows':_0x5a9b99}:null;}})[_0x498b('0x20')](respondWithResult(_0x2ee17f,null))[_0x498b('0x4c')](handleError(_0x2ee17f,null));};exports[_0x498b('0xda')]=function(_0x42d830,_0xc237ef){var _0x21e826={'raw':!![],'where':{}};var _0x483901={};var _0x2b7fe2={'count':0x0,'rows':[]};return db[_0x498b('0x3d')]['findOne']({'where':{'id':_0x42d830[_0x498b('0x4f')]['id']}})[_0x498b('0x20')](handleEntityNotFound(_0xc237ef,null))[_0x498b('0x20')](function(_0x49e2dc){if(_0x49e2dc){_0x483901[_0x498b('0xc7')]=_['keys'](db[_0x498b('0xdb')][_0x498b('0x33')]);_0x483901[_0x498b('0x4e')]=_[_0x498b('0xc4')](_0x42d830[_0x498b('0x4e')]);_0x483901['filters']=_[_0x498b('0xc6')](_0x483901['model'],_0x483901['query']);_0x21e826[_0x498b('0x42')]=_[_0x498b('0xc6')](_0x483901[_0x498b('0xc7')],qs[_0x498b('0xc8')](_0x42d830[_0x498b('0x4e')]['fields']));_0x21e826[_0x498b('0x42')]=_0x21e826[_0x498b('0x42')][_0x498b('0x45')]?_0x21e826['attributes']:_0x483901[_0x498b('0xc7')];if(!_0x42d830[_0x498b('0x4e')]['hasOwnProperty']('nolimit')){_0x21e826[_0x498b('0x1c')]=qs[_0x498b('0x1c')](_0x42d830[_0x498b('0x4e')][_0x498b('0x1c')]);_0x21e826['offset']=qs['offset'](_0x42d830[_0x498b('0x4e')][_0x498b('0x1b')]);}_0x21e826['order']=qs['sort'](_0x42d830[_0x498b('0x4e')][_0x498b('0xca')]);_0x21e826[_0x498b('0x3c')]=qs[_0x498b('0xcb')](_[_0x498b('0xcc')](_0x42d830[_0x498b('0x4e')],_0x483901[_0x498b('0xcb')]));_0x21e826[_0x498b('0x3c')][_0x498b('0xdc')]=_0x49e2dc['id'];if(_0x42d830[_0x498b('0x4e')][_0x498b('0x2d')]){_0x21e826[_0x498b('0x3c')]=_[_0x498b('0x51')](_0x21e826[_0x498b('0x3c')],{'$or':_[_0x498b('0x7c')](_0x21e826[_0x498b('0x42')],function(_0x5abcae){var _0x5d01e2={};_0x5d01e2[_0x5abcae]={'$like':'%'+_0x42d830[_0x498b('0x4e')][_0x498b('0x2d')]+'%'};return _0x5d01e2;})});}_0x21e826=_['merge']({},_0x21e826,_0x42d830['options']);return db[_0x498b('0xdb')][_0x498b('0x1d')]({'where':_0x21e826[_0x498b('0x3c')]})[_0x498b('0x20')](function(_0x145e0f){_0x2b7fe2[_0x498b('0x1d')]=_0x145e0f;if(_0x42d830[_0x498b('0x4e')][_0x498b('0x3e')]){_0x21e826[_0x498b('0x41')]=[{'all':!![]}];}return db[_0x498b('0xdb')][_0x498b('0x9d')](_0x21e826);})['then'](function(_0x1762ff){_0x2b7fe2[_0x498b('0x43')]=_0x1762ff;return _0x2b7fe2;});}})[_0x498b('0x20')](respondWithFilteredResult(_0xc237ef,_0x21e826))[_0x498b('0x4c')](handleError(_0xc237ef,null));};exports[_0x498b('0xdd')]=function(_0x3fe023,_0x391331){var _0x41830c={};var _0x5ef6a1={};var _0x4a4ad7;var _0x52351f;return db[_0x498b('0x3d')]['findOne']({'where':{'id':_0x3fe023['params']['id']}})['then'](handleEntityNotFound(_0x391331,null))[_0x498b('0x20')](function(_0x439259){if(_0x439259){_0x4a4ad7=_0x439259;_0x5ef6a1[_0x498b('0xc7')]=_[_0x498b('0xc4')](db[_0x498b('0xde')][_0x498b('0x33')]);_0x5ef6a1[_0x498b('0x4e')]=_[_0x498b('0xc4')](_0x3fe023[_0x498b('0x4e')]);_0x5ef6a1[_0x498b('0xcb')]=_['intersection'](_0x5ef6a1[_0x498b('0xc7')],_0x5ef6a1[_0x498b('0x4e')]);_0x41830c[_0x498b('0x42')]=_['intersection'](_0x5ef6a1['model'],qs['fields'](_0x3fe023['query']['fields']));_0x41830c[_0x498b('0x42')]=_0x41830c[_0x498b('0x42')][_0x498b('0x45')]?_0x41830c[_0x498b('0x42')]:_0x5ef6a1[_0x498b('0xc7')];_0x41830c[_0x498b('0xc9')]=qs[_0x498b('0xca')](_0x3fe023['query'][_0x498b('0xca')]);_0x41830c['where']=qs[_0x498b('0xcb')](_['pick'](_0x3fe023['query'],_0x5ef6a1['filters']));if(_0x3fe023[_0x498b('0x4e')][_0x498b('0x2d')]){_0x41830c[_0x498b('0x3c')]=_[_0x498b('0x51')](_0x41830c[_0x498b('0x3c')],{'$or':_['map'](_0x41830c[_0x498b('0x42')],function(_0x3a4956){var _0x1e1bf1={};_0x1e1bf1[_0x3a4956]={'$like':'%'+_0x3fe023[_0x498b('0x4e')][_0x498b('0x2d')]+'%'};return _0x1e1bf1;})});}_0x41830c=_[_0x498b('0x51')]({},_0x41830c,_0x3fe023[_0x498b('0xcd')]);return _0x4a4ad7[_0x498b('0xdd')](_0x41830c);}})[_0x498b('0x20')](function(_0x1cfd72){if(_0x1cfd72){_0x52351f=_0x1cfd72[_0x498b('0x45')];if(!_0x3fe023['query'][_0x498b('0xbd')](_0x498b('0xd2'))){_0x41830c[_0x498b('0x1c')]=qs[_0x498b('0x1c')](_0x3fe023[_0x498b('0x4e')][_0x498b('0x1c')]);_0x41830c[_0x498b('0x1b')]=qs['offset'](_0x3fe023[_0x498b('0x4e')][_0x498b('0x1b')]);}return _0x4a4ad7['getSmsInteractions'](_0x41830c);}})['then'](function(_0x3bc8d4){if(_0x3bc8d4){return _0x3bc8d4?{'count':_0x52351f,'rows':_0x3bc8d4}:null;}})[_0x498b('0x20')](respondWithResult(_0x391331,null))[_0x498b('0x4c')](handleError(_0x391331,null));};exports[_0x498b('0xdf')]=function(_0x2369e4,_0x316ed6){var _0x5996ca={};var _0x4b761e={};var _0x1f6149;var _0x195b8e;return db[_0x498b('0x3d')][_0x498b('0xbb')]({'where':{'id':_0x2369e4[_0x498b('0x4f')]['id']}})[_0x498b('0x20')](handleEntityNotFound(_0x316ed6,null))[_0x498b('0x20')](function(_0x1f77cd){if(_0x1f77cd){_0x1f6149=_0x1f77cd;_0x4b761e[_0x498b('0xc7')]=_['keys'](db[_0x498b('0xe0')][_0x498b('0x33')]);_0x4b761e['query']=_[_0x498b('0xc4')](_0x2369e4[_0x498b('0x4e')]);_0x4b761e['filters']=_[_0x498b('0xc6')](_0x4b761e['model'],_0x4b761e[_0x498b('0x4e')]);_0x5996ca['attributes']=_['intersection'](_0x4b761e[_0x498b('0xc7')],qs[_0x498b('0xc8')](_0x2369e4[_0x498b('0x4e')][_0x498b('0xc8')]));_0x5996ca[_0x498b('0x42')]=_0x5996ca[_0x498b('0x42')]['length']?_0x5996ca[_0x498b('0x42')]:_0x4b761e[_0x498b('0xc7')];_0x5996ca[_0x498b('0xc9')]=qs[_0x498b('0xca')](_0x2369e4['query'][_0x498b('0xca')]);_0x5996ca[_0x498b('0x3c')]=qs[_0x498b('0xcb')](_['pick'](_0x2369e4[_0x498b('0x4e')],_0x4b761e[_0x498b('0xcb')]));if(_0x2369e4[_0x498b('0x4e')]['filter']){_0x5996ca[_0x498b('0x3c')]=_[_0x498b('0x51')](_0x5996ca[_0x498b('0x3c')],{'$or':_[_0x498b('0x7c')](_0x5996ca['attributes'],function(_0x2a73d6){var _0x58dcb9={};_0x58dcb9[_0x2a73d6]={'$like':'%'+_0x2369e4[_0x498b('0x4e')]['filter']+'%'};return _0x58dcb9;})});}_0x5996ca=_[_0x498b('0x51')]({},_0x5996ca,_0x2369e4[_0x498b('0xcd')]);return _0x1f6149['getFaxInteractions'](_0x5996ca);}})[_0x498b('0x20')](function(_0x136be3){if(_0x136be3){_0x195b8e=_0x136be3[_0x498b('0x45')];if(!_0x2369e4['query'][_0x498b('0xbd')](_0x498b('0xd2'))){_0x5996ca[_0x498b('0x1c')]=qs[_0x498b('0x1c')](_0x2369e4[_0x498b('0x4e')][_0x498b('0x1c')]);_0x5996ca['offset']=qs[_0x498b('0x1b')](_0x2369e4[_0x498b('0x4e')][_0x498b('0x1b')]);}return _0x1f6149[_0x498b('0xdf')](_0x5996ca);}})[_0x498b('0x20')](function(_0x5bcf68){if(_0x5bcf68){return _0x5bcf68?{'count':_0x195b8e,'rows':_0x5bcf68}:null;}})[_0x498b('0x20')](respondWithResult(_0x316ed6,null))['catch'](handleError(_0x316ed6,null));};exports[_0x498b('0xe1')]=function(_0x4b27ea,_0x148298){var _0x4c94e5={};var _0x2cbcef={};var _0xdd8534;var _0x23214d;return db[_0x498b('0x3d')][_0x498b('0xbb')]({'where':{'id':_0x4b27ea[_0x498b('0x4f')]['id']}})['then'](handleEntityNotFound(_0x148298,null))[_0x498b('0x20')](function(_0x37ac21){if(_0x37ac21){_0xdd8534=_0x37ac21;_0x2cbcef[_0x498b('0xc7')]=_['keys'](db[_0x498b('0xe2')][_0x498b('0x33')]);_0x2cbcef[_0x498b('0x4e')]=_[_0x498b('0xc4')](_0x4b27ea[_0x498b('0x4e')]);_0x2cbcef[_0x498b('0xcb')]=_[_0x498b('0xc6')](_0x2cbcef[_0x498b('0xc7')],_0x2cbcef['query']);_0x4c94e5[_0x498b('0x42')]=_[_0x498b('0xc6')](_0x2cbcef[_0x498b('0xc7')],qs[_0x498b('0xc8')](_0x4b27ea[_0x498b('0x4e')][_0x498b('0xc8')]));_0x4c94e5['attributes']=_0x4c94e5[_0x498b('0x42')]['length']?_0x4c94e5[_0x498b('0x42')]:_0x2cbcef['model'];_0x4c94e5[_0x498b('0xc9')]=qs['sort'](_0x4b27ea['query'][_0x498b('0xca')]);_0x4c94e5['where']=qs[_0x498b('0xcb')](_[_0x498b('0xcc')](_0x4b27ea[_0x498b('0x4e')],_0x2cbcef['filters']));if(_0x4b27ea[_0x498b('0x4e')][_0x498b('0x2d')]){_0x4c94e5[_0x498b('0x3c')]=_[_0x498b('0x51')](_0x4c94e5[_0x498b('0x3c')],{'$or':_['map'](_0x4c94e5[_0x498b('0x42')],function(_0x2b02af){var _0x21d187={};_0x21d187[_0x2b02af]={'$like':'%'+_0x4b27ea[_0x498b('0x4e')][_0x498b('0x2d')]+'%'};return _0x21d187;})});}_0x4c94e5=_[_0x498b('0x51')]({},_0x4c94e5,_0x4b27ea[_0x498b('0xcd')]);return _0xdd8534[_0x498b('0xe1')](_0x4c94e5);}})[_0x498b('0x20')](function(_0x4d4ffe){if(_0x4d4ffe){_0x23214d=_0x4d4ffe[_0x498b('0x45')];if(!_0x4b27ea[_0x498b('0x4e')][_0x498b('0xbd')](_0x498b('0xd2'))){_0x4c94e5[_0x498b('0x1c')]=qs[_0x498b('0x1c')](_0x4b27ea[_0x498b('0x4e')][_0x498b('0x1c')]);_0x4c94e5['offset']=qs[_0x498b('0x1b')](_0x4b27ea['query']['offset']);}return _0xdd8534['getWhatsappInteractions'](_0x4c94e5);}})[_0x498b('0x20')](function(_0x4d3d66){if(_0x4d3d66){return _0x4d3d66?{'count':_0x23214d,'rows':_0x4d3d66}:null;}})[_0x498b('0x20')](respondWithResult(_0x148298,null))[_0x498b('0x4c')](handleError(_0x148298,null));};exports['login']=function(_0x15f9bd,_0x144a7e,_0x4cdac7){var _0x26fcdf;var _0x321d30;var _0x1c845e;var _0x46601e=!_[_0x498b('0x5d')](_0x15f9bd[_0x498b('0x4f')]['id'])?_0x15f9bd[_0x498b('0x4f')]['id']:!_[_0x498b('0x5d')](_0x15f9bd[_0x498b('0x29')]['id'])?_0x15f9bd[_0x498b('0x29')]['id']:null;return db[_0x498b('0x3d')][_0x498b('0x52')]({'where':{'id':_0x46601e,'role':{'$or':[_0x498b('0x27'),_0x498b('0x29'),_0x498b('0x22')]}},'attributes':['id','name',_0x498b('0xe3'),_0x498b('0xe4'),'role',_0x498b('0x5c'),_0x498b('0x8e')]})['then'](function(_0x128685){if(_0x128685){if(_0x128685[_0x498b('0x21')]===_0x498b('0x22')){_0x26fcdf=_0x128685;if(_0x15f9bd[_0x498b('0x55')][_0x498b('0x90')]){_0x1c845e=util[_0x498b('0x9f')](_0x498b('0xe5'),_0x26fcdf[_0x15f9bd['body']['interface']]);}else if(_0x15f9bd[_0x498b('0x55')][_0x498b('0xe6')]){_0x1c845e=util[_0x498b('0x9f')](_0x498b('0xa0'),_0x15f9bd['body']['intrf']);}else{_0x1c845e=util[_0x498b('0x9f')](_0x498b('0xa0'),_0x26fcdf['name']);}socket['to'](util[_0x498b('0x9f')](_0x498b('0xe7'),_0x26fcdf[_0x498b('0x2f')]))[_0x498b('0x23')](_0x498b('0xe8'),{'user':{'id':_0x26fcdf['id'],'name':_0x26fcdf['name']},'ip':_0x15f9bd[_0x498b('0xe9')][_0x498b('0xea')]||_0x15f9bd[_0x498b('0xeb')][_0x498b('0xec')]||_0x15f9bd[_0x498b('0xed')]['remoteAddress']||_0x15f9bd[_0x498b('0xeb')][_0x498b('0xed')][_0x498b('0xec')]});return db[_0x498b('0xa1')][_0x498b('0x25')]({'where':{'membername':_0x26fcdf[_0x498b('0x2f')]},'individualHooks':!![]});}}else{throw new db['Sequelize']['ValidationError'](_0x498b('0xee'));}})[_0x498b('0x20')](function(){if(_0x26fcdf){return _0x26fcdf[_0x498b('0xef')]({'raw':!![]});}})[_0x498b('0x20')](function(_0x522143){if(_0x26fcdf){if(_0x522143){_0x321d30=_0x522143;if(_0x321d30['length']){var _0x5e2cc4=_0x321d30[_0x498b('0x7c')](function(_0x3c92e3){var _0x4d8cd9={'membername':_0x26fcdf[_0x498b('0x2f')],'UserId':_0x26fcdf['id'],'queue_name':_0x3c92e3[_0x498b('0x2f')],'VoiceQueueId':_0x3c92e3['id'],'interface':_0x1c845e,'paused':_0x26fcdf[_0x498b('0x8e')]||![],'penalty':_0x3c92e3['UserVoiceQueue.penalty']||0x0};return db[_0x498b('0xa1')]['upsert'](_0x4d8cd9);});return Promise[_0x498b('0x4b')](_0x5e2cc4);}}}})[_0x498b('0x20')](function(){if(_0x26fcdf){return db[_0x498b('0xf0')][_0x498b('0x9d')]({'where':{'membername':_0x26fcdf[_0x498b('0x2f')],'exitAt':null}});}})[_0x498b('0x20')](function(_0x382f5c){if(_0x26fcdf){var _0x177819=[];_0x382f5c['forEach'](function(_0x45833f){_0x177819['push'](_0x45833f['update']({'exitAt':moment()[_0x498b('0x9f')](_0x498b('0xf1'))}));});return Promise[_0x498b('0x4b')](_0x177819);}})['then'](function(){if(_0x26fcdf){var _0x518a90=[];var _0x2d4ea0=[];var _0x123fec=utils[_0x498b('0xf2')]();var _0x1fff36={'membername':_0x26fcdf['name'],'interface':_0x1c845e,'enterAt':moment()[_0x498b('0x9f')](_0x498b('0xf1')),'role':_0x26fcdf[_0x498b('0x21')],'internal':_0x26fcdf[_0x498b('0x5c')]};_0x123fec['forEach'](function(_0x226219){_0x518a90[_0x498b('0x46')](_[_0x498b('0x51')]({'channel':_0x226219,'type':'LOGIN','data1':_0x15f9bd[_0x498b('0x55')][_0x498b('0xf3')],'data2':_0x1c845e},_0x1fff36));if(_0x26fcdf[_0x498b('0x8e')]){_0x2d4ea0[_0x498b('0x46')](_[_0x498b('0x51')]({'channel':_0x226219,'type':_0x498b('0xf4'),'data1':'LOGININPAUSE'},_0x1fff36));}});return db[_0x498b('0xf0')][_0x498b('0xf5')](_0x518a90['concat'](_0x2d4ea0),{'individualHooks':!![]});}})[_0x498b('0x20')](function(){if(_0x26fcdf){return _0x26fcdf[_0x498b('0x1f')]({'online':!![],'lastLoginAt':moment()[_0x498b('0x9f')](_0x498b('0xf1')),'voicePause':_0x26fcdf[_0x498b('0x8e')]||![],'mailPause':_0x26fcdf[_0x498b('0x8e')]||![],'chatPause':_0x26fcdf[_0x498b('0x8e')]||![],'faxPause':_0x26fcdf[_0x498b('0x8e')]||![],'smsPause':_0x26fcdf[_0x498b('0x8e')]||![],'openchannelPause':_0x26fcdf[_0x498b('0x8e')]||![],'whatsappPause':_0x26fcdf[_0x498b('0x8e')]||![],'pauseType':_0x26fcdf['loginInPause']?_0x498b('0xf6'):null,'interface':_0x1c845e,'lastPauseAt':moment()['format'](_0x498b('0xf1'))});}})[_0x498b('0x20')](function(_0x2b839f){if(_0x15f9bd[_0x498b('0xf7')]){return _0x4cdac7();}else{return Promise[_0x498b('0xf8')](_0x2b839f)[_0x498b('0x20')](respondWithResult(_0x144a7e,null));}})[_0x498b('0x4c')](handleError(_0x144a7e,null));};exports[_0x498b('0xf9')]=function(_0x4c37c3,_0x5579cc){var _0x551b5e;return db[_0x498b('0x3d')][_0x498b('0x52')]({'where':{'id':_0x4c37c3['params']['id'],'role':_0x498b('0x22')},'attributes':['id',_0x498b('0x2f'),_0x498b('0x21')]})[_0x498b('0x20')](handleEntityNotFound(_0x5579cc,null))[_0x498b('0x20')](function(_0x412b12){if(_0x412b12){_0x551b5e=_0x412b12;return db['UserVoiceQueueRt'][_0x498b('0x25')]({'where':{'membername':_0x551b5e[_0x498b('0x2f')]},'individualHooks':!![]});}})[_0x498b('0x20')](function(){return db[_0x498b('0xf0')][_0x498b('0x9d')]({'where':{'membername':_0x551b5e[_0x498b('0x2f')],'exitAt':null}});})['then'](function(_0x54267c){var _0x634422=[];_0x54267c[_0x498b('0xfa')](function(_0x41b238){_0x634422[_0x498b('0x46')](_0x41b238[_0x498b('0x1f')]({'exitAt':moment()[_0x498b('0x9f')](_0x498b('0xf1'))}));});return Promise[_0x498b('0x4b')](_0x634422);})[_0x498b('0x20')](function(){return _0x551b5e[_0x498b('0x1f')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0x5579cc,null))['catch'](handleError(_0x5579cc,null));};exports[_0x498b('0xfb')]=function(_0x2f9084,_0x58ab21){var _0xbfccbe;return db[_0x498b('0xa1')]['update']({'paused':0x1},{'where':{'UserId':_0x2f9084['params']['id']},'individualHooks':!![]})[_0x498b('0x20')](function(){return db[_0x498b('0x3d')][_0x498b('0x52')]({'where':{'id':_0x2f9084[_0x498b('0x4f')]['id'],'role':'agent'},'attributes':['id',_0x498b('0x2f'),_0x498b('0x21'),_0x498b('0x5c'),_0x498b('0x90'),_0x498b('0x9e')]});})[_0x498b('0x20')](handleEntityNotFound(_0x58ab21,null))[_0x498b('0x20')](function(_0x30273e){if(_0x30273e){_0xbfccbe=_0x30273e;return db[_0x498b('0xf0')]['findAll']({'where':{'membername':_0xbfccbe[_0x498b('0x2f')],'type':_0x498b('0xf4'),'exitAt':null}});}})[_0x498b('0x20')](function(_0x2ed1f6){if(_0x2ed1f6[_0x498b('0x45')]){var _0x45dc50=moment()[_0x498b('0x9f')](_0x498b('0xf1'));for(var _0x4d4111=0x0,_0x5692c8=_0x2ed1f6['length'];_0x4d4111<_0x5692c8;_0x4d4111++){_0x2ed1f6[_0x4d4111][_0x498b('0xfc')]({'exitAt':_0x45dc50});}}})[_0x498b('0x20')](function(){var _0x40b597=[];var _0x2c213e=utils[_0x498b('0xf2')]();_0x2c213e['forEach'](function(_0x2c9430){_0x40b597[_0x498b('0x46')]({'channel':_0x2c9430,'membername':_0xbfccbe['name'],'interface':_[_0x498b('0x5d')](_0xbfccbe[_0x498b('0x90')])?util[_0x498b('0x9f')](_0x498b('0xa0'),_0xbfccbe[_0x498b('0x2f')]):_0xbfccbe['interface'],'type':_0x498b('0xf4'),'enterAt':moment()['format'](_0x498b('0xf1')),'data1':_0x2f9084[_0x498b('0x55')][_0x498b('0x35')]||_0x498b('0xfd'),'role':_0xbfccbe[_0x498b('0x21')],'internal':_0xbfccbe['internal']});});return db[_0x498b('0xf0')][_0x498b('0xf5')](_0x40b597,{'individualHooks':!![]});})[_0x498b('0x20')](function(){return _0xbfccbe[_0x498b('0x1f')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x2f9084[_0x498b('0x55')][_0x498b('0x35')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0x498b('0x9f')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0x498b('0x20')](respondWithResult(_0x58ab21,null))[_0x498b('0x4c')](handleError(_0x58ab21,null));};exports[_0x498b('0xfe')]=function(_0x16dae8,_0x5596bd){if(_0x16dae8['body'][_0x498b('0x8d')]&&!utils['isValidChannel'](_0x16dae8[_0x498b('0x55')][_0x498b('0x8d')])){throw new APIBadRequestError(util['format'](_0x498b('0xff'),_0x16dae8[_0x498b('0x55')][_0x498b('0x8d')]));}return db[_0x498b('0x3d')][_0x498b('0x52')]({'where':{'id':_0x16dae8['params']['id']},'attributes':['id','name','role',_0x498b('0x5c'),_0x498b('0x90'),_0x498b('0x9e'),_0x498b('0x8f'),_0x498b('0x100'),_0x498b('0x101'),_0x498b('0x102'),_0x498b('0x103'),_0x498b('0x104'),'whatsappPause',_0x498b('0x105'),'lastPauseAt']})[_0x498b('0x20')](function(_0x4a49c5){if(!_0x4a49c5){throw new APINotFoundError(util[_0x498b('0x9f')](_0x498b('0xbc'),_0x16dae8[_0x498b('0x4f')]['id']));}return _0x4a49c5[_0x498b('0xfe')](_0x16dae8[_0x498b('0x55')]['channel']);})[_0x498b('0x20')](respondWithResult(_0x5596bd,null))[_0x498b('0x4c')](APIHandleError(_0x5596bd));};exports['getTeams']=function(_0x535d90,_0x29a65d){var _0x4fe114={};var _0x4a5340={};var _0x3f1ce2;var _0x33249f;return db[_0x498b('0x3d')][_0x498b('0xbb')]({'where':{'id':_0x535d90[_0x498b('0x4f')]['id']}})[_0x498b('0x20')](handleEntityNotFound(_0x29a65d,null))[_0x498b('0x20')](function(_0x4c100c){if(_0x4c100c){_0x3f1ce2=_0x4c100c;_0x4a5340['model']=_[_0x498b('0xc4')](db[_0x498b('0x106')]['rawAttributes']);_0x4a5340[_0x498b('0x4e')]=_['keys'](_0x535d90[_0x498b('0x4e')]);_0x4a5340[_0x498b('0xcb')]=_[_0x498b('0xc6')](_0x4a5340[_0x498b('0xc7')],_0x4a5340[_0x498b('0x4e')]);_0x4fe114['attributes']=_['intersection'](_0x4a5340[_0x498b('0xc7')],qs['fields'](_0x535d90[_0x498b('0x4e')][_0x498b('0xc8')]));_0x4fe114[_0x498b('0x42')]=_0x4fe114[_0x498b('0x42')][_0x498b('0x45')]?_0x4fe114['attributes']:_0x4a5340[_0x498b('0xc7')];_0x4fe114[_0x498b('0xc9')]=qs[_0x498b('0xca')](_0x535d90[_0x498b('0x4e')][_0x498b('0xca')]);_0x4fe114[_0x498b('0x3c')]=qs[_0x498b('0xcb')](_['pick'](_0x535d90['query'],_0x4a5340[_0x498b('0xcb')]));if(_0x535d90['query'][_0x498b('0x2d')]){_0x4fe114['where']=_[_0x498b('0x51')](_0x4fe114[_0x498b('0x3c')],{'$or':_[_0x498b('0x7c')](_0x4fe114[_0x498b('0x42')],function(_0x1a8e13){var _0x285ff6={};_0x285ff6[_0x1a8e13]={'$like':'%'+_0x535d90[_0x498b('0x4e')][_0x498b('0x2d')]+'%'};return _0x285ff6;})});}_0x4fe114=_[_0x498b('0x51')]({},_0x4fe114,_0x535d90[_0x498b('0xcd')]);return _0x3f1ce2['getTeams'](_0x4fe114);}})[_0x498b('0x20')](function(_0x28dbb0){if(_0x28dbb0){_0x33249f=_0x28dbb0['length'];if(!_0x535d90[_0x498b('0x4e')][_0x498b('0xbd')]('nolimit')){_0x4fe114['limit']=qs[_0x498b('0x1c')](_0x535d90[_0x498b('0x4e')]['limit']);_0x4fe114['offset']=qs[_0x498b('0x1b')](_0x535d90[_0x498b('0x4e')]['offset']);}return _0x3f1ce2['getTeams'](_0x4fe114);}})[_0x498b('0x20')](function(_0x10f87a){if(_0x10f87a){return _0x10f87a?{'count':_0x33249f,'rows':_0x10f87a}:null;}})['then'](respondWithResult(_0x29a65d,null))[_0x498b('0x4c')](handleError(_0x29a65d,null));};exports[_0x498b('0x107')]=function(_0x2ee48a,_0x4557fd){var _0x4514e8=_0x2ee48a[_0x498b('0x4f')]['id'];var _0xf0ce7f=_0x2ee48a['body']?_0x2ee48a['body'][_0x498b('0x96')]:null;var _0x4386ad=[];return Promise[_0x498b('0xf8')]()[_0x498b('0x20')](function(){if(!_0xf0ce7f)throw new APIBadRequestError(_0x498b('0x108'));})['then'](function(){return db[_0x498b('0x3d')][_0x498b('0xbb')]({'where':{'id':_0x4514e8}});})['then'](function(_0x3541df){if(!_0x3541df)throw new APINotFoundError(util['format'](_0x498b('0xbc'),_0x2ee48a[_0x498b('0x4f')]['id']));return db['sequelize']['transaction'](function(_0x252fb6){return _0x3541df[_0x498b('0x107')](_0xf0ce7f,{'transaction':_0x252fb6})[_0x498b('0x20')](function(){return db[_0x498b('0x106')][_0x498b('0x9d')]({'where':{'id':{'$in':_0xf0ce7f}}});})[_0x498b('0x20')](function(_0x3ffc7f){var _0xd4464a=_['map'](_0x3ffc7f,function(_0x86c0aa){return _0x86c0aa[_0x498b('0x109')]();});return Promise[_0x498b('0x4b')](_0xd4464a);})['then'](function(_0x18a80a){_0x4386ad=_[_0x498b('0x10a')](_0x18a80a);var _0x1ee2e4=_[_0x498b('0x7c')](_0x4386ad,function(_0x45fa88){return _0x45fa88[_0x498b('0x10b')](_0x3541df['id'],{'transaction':_0x252fb6});});return Promise['all'](_0x1ee2e4);})[_0x498b('0x20')](function(){if(!_0x3541df['online'])return;var _0x5ba3c6=_[_0x498b('0x2d')](_0x4386ad,function(_0x1297ca){return _0x1297ca['getDataValue'](_0x498b('0x8d'))===_0x498b('0x10c');});var _0x1f4d12=_[_0x498b('0x7c')](_0x5ba3c6,function(_0x509c65){return db['UserVoiceQueueRt'][_0x498b('0x10d')]({'membername':_0x3541df[_0x498b('0x2f')],'UserId':_0x3541df['id'],'queue_name':_0x509c65[_0x498b('0x2f')],'VoiceQueueId':_0x509c65['id'],'interface':_[_0x498b('0x5d')](_0x3541df['interface'])?util['format']('SIP/%s',_0x3541df[_0x498b('0x2f')]):_0x3541df[_0x498b('0x90')],'paused':_0x3541df['voicePause']||![],'penalty':_0x3541df[_0x498b('0x97')]},{'transaction':_0x252fb6});});return Promise['all'](_0x1f4d12);})[_0x498b('0x20')](function(){return db['TeamVoicePrefix']['findAll']({'where':{'teamId':{'$in':_0xf0ce7f}}});})['then'](function(_0x541125){var _0x159497=_[_0x498b('0x7c')](_0x541125,function(_0x461a9e){return db[_0x498b('0x10e')]['create']({'UserId':_0x3541df['id'],'VoicePrefixId':_0x461a9e['VoicePrefixId']},{'transaction':_0x252fb6});});return Promise['all'](_0x159497);});});})[_0x498b('0x20')](function(){for(var _0x42d124=0x0;_0x42d124<_0x4386ad[_0x498b('0x45')];_0x42d124++){var _0x595f5c=_0x4386ad[_0x42d124][_0x498b('0x10f')]('channel');var _0x4fe41c=_0x595f5c+_0x498b('0x99');socket['emit'](_0x498b('0x29')+_0x595f5c+_0x498b('0x9a'),{'UserId':_0x4514e8,['queueField']:_0x4386ad[_0x42d124]['id']});}})[_0x498b('0x20')](respondWithStatusCode(_0x4557fd,null))['catch'](APIHandleError(_0x4557fd));};exports[_0x498b('0x110')]=function(_0x2584ed,_0x5d763f){var _0x4d5825=_0x2584ed[_0x498b('0x4f')]['id'];var _0x320dcb=null;if(_0x2584ed[_0x498b('0x4e')][_0x498b('0x96')]){_0x320dcb=_[_0x498b('0x111')](_0x2584ed[_0x498b('0x4e')]['ids'])?_0x2584ed['query'][_0x498b('0x96')]:[_0x2584ed['query']['ids']];}var _0xd9823a=[];return Promise[_0x498b('0xf8')]()[_0x498b('0x20')](function(){if(!_0x320dcb)throw new APIBadRequestError(_0x498b('0x112'));})[_0x498b('0x20')](function(){return db[_0x498b('0x3d')][_0x498b('0xbb')]({'where':{'id':_0x4d5825}});})[_0x498b('0x20')](function(_0x3f3f98){if(!_0x3f3f98)throw new APINotFoundError(util[_0x498b('0x9f')](_0x498b('0xbc'),_0x2584ed[_0x498b('0x4f')]['id']));return db[_0x498b('0x5f')][_0x498b('0x113')](function(_0x5b5ae0){return _0x3f3f98['removeTeams'](_0x320dcb,{'transaction':_0x5b5ae0})[_0x498b('0x20')](function(){return db['Team'][_0x498b('0x9d')]({'where':{'id':{'$in':_0x320dcb}}});})[_0x498b('0x20')](function(_0x5b076f){var _0x2ffd81=_['map'](_0x5b076f,function(_0x901271){return _0x901271[_0x498b('0x109')]();});return Promise['all'](_0x2ffd81);})['then'](function(_0x8601bd){_0xd9823a=_[_0x498b('0x10a')](_0x8601bd);var _0x1369f8=_['map'](_0xd9823a,function(_0x259258){return _0x259258[_0x498b('0x114')](_0x3f3f98['id'],{'transaction':_0x5b5ae0});});return Promise[_0x498b('0x4b')](_0x1369f8);})[_0x498b('0x20')](function(){if(!_0x3f3f98[_0x498b('0x9e')])return;var _0x2ddc36=_['filter'](_0xd9823a,function(_0xb9d928){return _0xb9d928[_0x498b('0x10f')]('channel')===_0x498b('0x10c');});var _0x577d29=_[_0x498b('0x7c')](_0x2ddc36,function(_0x12e803){return db[_0x498b('0xa1')][_0x498b('0x25')]({'where':{'VoiceQueueId':_0x12e803['id'],'UserId':_0x3f3f98['id']},'transaction':_0x5b5ae0});});return Promise[_0x498b('0x4b')](_0x577d29);})['then'](function(){return db['TeamVoicePrefix'][_0x498b('0x9d')]({'where':{'teamId':{'$in':_0x320dcb}}});})[_0x498b('0x20')](function(_0x2c2553){var _0x53fd37=_[_0x498b('0x7c')](_0x2c2553,function(_0x3fbbce){return db[_0x498b('0x10e')]['destroy']({'where':{'UserId':_0x3f3f98['id'],'VoicePrefixId':_0x3fbbce[_0x498b('0x115')]}},{'transaction':_0x5b5ae0});});return Promise[_0x498b('0x4b')](_0x53fd37);});});})[_0x498b('0x20')](function(){for(var _0x1732a1=0x0;_0x1732a1<_0xd9823a['length'];_0x1732a1++){var _0x49de6a=_0xd9823a[_0x1732a1][_0x498b('0x10f')]('channel');var _0x15de1e=_0x49de6a+'QueueId';socket[_0x498b('0x23')](_0x498b('0x29')+_0x49de6a+_0x498b('0xa4'),{'UserId':_0x4d5825,['queueField']:_0xd9823a[_0x1732a1]['id']});}})['then'](respondWithStatusCode(_0x5d763f,null))[_0x498b('0x4c')](APIHandleError(_0x5d763f));};exports[_0x498b('0x116')]=function(_0x140173,_0xda9725){var _0x4f929c={};var _0x1e8f63={};var _0x50bd77;var _0x4da8a7;return db[_0x498b('0x3d')]['findOne']({'where':{'id':_0x140173['params']['id']}})[_0x498b('0x20')](handleEntityNotFound(_0xda9725,null))[_0x498b('0x20')](function(_0x1548d1){if(_0x1548d1){_0x50bd77=_0x1548d1;_0x1e8f63[_0x498b('0xc7')]=_[_0x498b('0xc4')](db[_0x498b('0xbe')][_0x498b('0x33')]);_0x1e8f63[_0x498b('0x4e')]=_['keys'](_0x140173[_0x498b('0x4e')]);_0x1e8f63['filters']=_['intersection'](_0x1e8f63[_0x498b('0xc7')],_0x1e8f63[_0x498b('0x4e')]);_0x4f929c[_0x498b('0x42')]=_['intersection'](_0x1e8f63[_0x498b('0xc7')],qs[_0x498b('0xc8')](_0x140173[_0x498b('0x4e')]['fields']));_0x4f929c[_0x498b('0x42')]=_0x4f929c[_0x498b('0x42')][_0x498b('0x45')]?_0x4f929c[_0x498b('0x42')]:_0x1e8f63[_0x498b('0xc7')];_0x4f929c['order']=qs['sort'](_0x140173[_0x498b('0x4e')][_0x498b('0xca')]);_0x4f929c[_0x498b('0x3c')]=qs[_0x498b('0xcb')](_['pick'](_0x140173['query'],_0x1e8f63[_0x498b('0xcb')]));if(_0x140173['query'][_0x498b('0x2d')]){_0x4f929c[_0x498b('0x3c')]=_[_0x498b('0x51')](_0x4f929c[_0x498b('0x3c')],{'$or':_[_0x498b('0x7c')](_0x4f929c[_0x498b('0x42')],function(_0x4c50cd){var _0x3f2ece={};_0x3f2ece[_0x4c50cd]={'$like':'%'+_0x140173['query'][_0x498b('0x2d')]+'%'};return _0x3f2ece;})});}_0x4f929c=_['merge']({},_0x4f929c,_0x140173['options']);return _0x50bd77[_0x498b('0x116')](_0x4f929c);}})[_0x498b('0x20')](function(_0xc451d4){if(_0xc451d4){_0x4da8a7=_0xc451d4[_0x498b('0x45')];if(!_0x140173[_0x498b('0x4e')][_0x498b('0xbd')](_0x498b('0xd2'))){_0x4f929c[_0x498b('0x1c')]=qs[_0x498b('0x1c')](_0x140173[_0x498b('0x4e')]['limit']);_0x4f929c[_0x498b('0x1b')]=qs['offset'](_0x140173['query'][_0x498b('0x1b')]);}return _0x50bd77[_0x498b('0x116')](_0x4f929c);}})[_0x498b('0x20')](function(_0x59361a){if(_0x59361a){return _0x59361a?{'count':_0x4da8a7,'rows':_0x59361a}:null;}})['then'](respondWithResult(_0xda9725,null))['catch'](handleError(_0xda9725,null));};exports[_0x498b('0x117')]=function(_0x329681,_0x24c83a){var _0x4e103c={};var _0x50dce6={};var _0x192f87;return db[_0x498b('0x3d')][_0x498b('0xbb')]({'where':{'id':_0x329681['params']['id']}})[_0x498b('0x20')](handleEntityNotFound(_0x24c83a,null))[_0x498b('0x20')](function(_0x4f9aec){if(_0x4f9aec){_0x192f87=_0x4f9aec;_0x50dce6[_0x498b('0xc7')]=_[_0x498b('0xc4')](db[_0x498b('0x3d')][_0x498b('0x33')]);_0x50dce6['query']=_[_0x498b('0xc4')](_0x329681[_0x498b('0x4e')]);_0x50dce6[_0x498b('0xcb')]=_[_0x498b('0xc6')](_0x50dce6['model'],_0x50dce6[_0x498b('0x4e')]);_0x4e103c[_0x498b('0x42')]=_[_0x498b('0xc6')](_0x50dce6[_0x498b('0xc7')],qs['fields'](_0x329681['query']['fields']));_0x4e103c[_0x498b('0x42')]=_0x4e103c[_0x498b('0x42')]['length']?_0x4e103c[_0x498b('0x42')]:_0x50dce6[_0x498b('0xc7')];_0x4e103c['order']=qs[_0x498b('0xca')](_0x329681['query'][_0x498b('0xca')]);_0x4e103c[_0x498b('0x3c')]=qs['filters'](_[_0x498b('0xcc')](_0x329681[_0x498b('0x4e')],_0x50dce6[_0x498b('0xcb')]));if(_0x329681[_0x498b('0x4e')]['filter']){_0x4e103c[_0x498b('0x3c')]=_[_0x498b('0x51')](_0x4e103c[_0x498b('0x3c')],{'$or':_[_0x498b('0x7c')](_0x4e103c[_0x498b('0x42')],function(_0x52c52a){var _0x2f862e={};_0x2f862e[_0x52c52a]={'$like':'%'+_0x329681[_0x498b('0x4e')]['filter']+'%'};return _0x2f862e;})});}_0x4e103c[_0x498b('0xc7')]=db[_0x498b('0x3d')];_0x4e103c['as']=_0x498b('0x2a');_0x4e103c=_[_0x498b('0x51')]({},_0x4e103c,_0x329681[_0x498b('0xcd')]);return _0x192f87['getVoiceQueues']({'include':[_0x4e103c]});}})[_0x498b('0x20')](function(_0x500c35){if(_0x500c35){var _0x2990a7={},_0x2644fe=[];for(var _0x35bdd7=0x0;_0x35bdd7<_0x500c35[_0x498b('0x45')];_0x35bdd7+=0x1){for(var _0x464392=0x0,_0x3566b7;_0x464392<_0x500c35[_0x35bdd7][_0x498b('0x2a')][_0x498b('0x45')];_0x464392+=0x1){_0x3566b7=_0x500c35[_0x35bdd7][_0x498b('0x2a')][_0x464392][_0x498b('0x26')]({'plain':!![]});_0x2990a7[_0x3566b7['id']]=_0x3566b7;}}_0x2990a7=_[_0x498b('0x118')](_0x2990a7);for(var _0x25219d=qs['offset'](_0x329681['query'][_0x498b('0x1b')]);_0x25219d<_0x2990a7['length']&&_0x2644fe['length']=_0xd1957a['agents']){throw new Error(_0xce0c('0x4f'));}})[_0xce0c('0x17')](function(){if(_0x4afe9f){return db[_0xce0c('0x43')][_0xce0c('0x44')]({'where':{'membername':_0x4afe9f[_0xce0c('0x26')]},'individualHooks':!![]});}})[_0xce0c('0x17')](function(){if(_0x4afe9f){return _0x4afe9f[_0xce0c('0x50')]({'raw':!![]});}})[_0xce0c('0x17')](function(_0x589f4d){if(_0x4afe9f){if(_0x589f4d){var _0x30b729=[];_0x127ffa=_0x589f4d;if(_0x127ffa[_0xce0c('0x27')]){for(var _0x3ac42f=0x0;_0x3ac42f<_0x127ffa[_0xce0c('0x27')];_0x3ac42f++){_0x30b729[_0xce0c('0x2d')](db[_0xce0c('0x43')][_0xce0c('0x51')]({'membername':_0x4afe9f[_0xce0c('0x26')],'UserId':_0x4afe9f['id'],'queue_name':_0x127ffa[_0x3ac42f][_0xce0c('0x26')],'VoiceQueueId':_0x127ffa[_0x3ac42f]['id'],'interface':_0x2bf102,'paused':_0x4afe9f[_0xce0c('0x4a')]||![],'penalty':_0x127ffa[_0x3ac42f][_0xce0c('0x52')]||0x0}));}return BPromise[_0xce0c('0x46')](_0x30b729);}}}})[_0xce0c('0x17')](function(){if(_0x4afe9f){return db[_0xce0c('0x25')][_0xce0c('0xe')]({'where':{'membername':_0x4afe9f[_0xce0c('0x26')],'exitAt':null}});}})[_0xce0c('0x17')](function(_0x11e815){if(_0x4afe9f){if(_0x11e815&&_0x11e815[_0xce0c('0x27')]){var _0x17c810=[];_0x11e815[_0xce0c('0x2c')](function(_0x48d9f9){_0x17c810['push'](_0x48d9f9[_0xce0c('0x45')]({'exitAt':moment()[_0xce0c('0x28')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0xce0c('0x46')](_0x17c810);}}})[_0xce0c('0x17')](function(){if(_0x4afe9f){var _0x55c7fe=[];var _0x1e4d4e=[];var _0x5f0a=utils[_0xce0c('0x2b')]();var _0x24c0d5={'membername':_0x4afe9f[_0xce0c('0x26')],'interface':_0x2bf102,'enterAt':moment()[_0xce0c('0x28')](_0xce0c('0x29')),'role':_0x4afe9f[_0xce0c('0x21')],'internal':_0x4afe9f['internal']};_0x5f0a['forEach'](function(_0x1d0e23){_0x55c7fe['push'](_['merge']({'channel':_0x1d0e23,'type':_0xce0c('0x53'),'data1':_0xce0c('0x54'),'data2':_0x2bf102},_0x24c0d5));if(_0x4afe9f[_0xce0c('0x4a')]){_0x1e4d4e[_0xce0c('0x2d')](_[_0xce0c('0x55')]({'channel':_0x1d0e23,'type':_0xce0c('0x30'),'data1':'LOGININPAUSE'},_0x24c0d5));}});return db[_0xce0c('0x25')]['bulkCreate'](_0x55c7fe[_0xce0c('0x56')](_0x1e4d4e),{'individualHooks':!![]});}})['then'](function(){if(_0x4afe9f){return _0x4afe9f[_0xce0c('0x45')]({'online':!![],'lastLoginAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x4afe9f[_0xce0c('0x4a')]||![],'mailPause':_0x4afe9f[_0xce0c('0x4a')]||![],'chatPause':_0x4afe9f[_0xce0c('0x4a')]||![],'faxPause':_0x4afe9f[_0xce0c('0x4a')]||![],'smsPause':_0x4afe9f[_0xce0c('0x4a')]||![],'openchannelPause':_0x4afe9f[_0xce0c('0x4a')]||![],'pauseType':_0x4afe9f[_0xce0c('0x4a')]?'LOGININPAUSE':null,'lastPauseAt':moment()['format'](_0xce0c('0x29')),'interface':_0x2bf102});}})['then'](function(_0x334f5d){_0x2c99e6(_0x334f5d);})[_0xce0c('0x1b')](function(_0x249a49){_0x23e307(_0x59964c[_0xce0c('0x1c')](0x1f4,_0x249a49[_0xce0c('0x1d')]));});});}; \ No newline at end of file +var _0x34ef=['attributes','then','info','debug','stringify','error','message','ShowUser','where','catch','PauseUser','User','find','name','role','internal','User\x20with\x20id\x20%s\x20not\x20found','params','MemberReport','length','format','updateAttributes','getChannels','push','isNil','SIP/%s','PAUSE','YYYY-MM-DD\x20HH:mm:ss','body','DEFAULT\x20PAUSE','uniqueid','bulkCreate','update','type','UnpauseUser','channel','Channel\x20parameter\x20%s\x20is\x20invalid','findOne','interface','mailPause','chatPause','openchannelPause','smsPause','whatsappPause','pauseType','lastPauseAt','system','LogoutUser','UserVoiceQueueRt','forEach','all','LoginUser','mobile','loginInPause','count','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','callysquare','merge','LOGININPAUSE','concat','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','redis','defaults','localhost','socket.io-emitter','./user.socket','register','GetUser','findAll','options','raw','limit','map','include','model'];(function(_0x5ae502,_0x1179b1){var _0x3de033=function(_0x4250fa){while(--_0x4250fa){_0x5ae502['push'](_0x5ae502['shift']());}};_0x3de033(++_0x1179b1);}(_0x34ef,0x143));var _0xf34e=function(_0x165872,_0x16ae1){_0x165872=_0x165872-0x0;var _0x34b266=_0x34ef[_0x165872];return _0x34b266;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf34e('0x0'));var BPromise=require(_0xf34e('0x1'));var Redis=require(_0xf34e('0x2'));var db=require(_0xf34e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xf34e('0x4'))(_0xf34e('0x5'));var config=require(_0xf34e('0x6'));config[_0xf34e('0x7')]=_[_0xf34e('0x8')](config[_0xf34e('0x7')],{'host':_0xf34e('0x9'),'port':0x18eb});var socket=require(_0xf34e('0xa'))(new Redis(config[_0xf34e('0x7')]));require(_0xf34e('0xb'))[_0xf34e('0xc')](socket);exports[_0xf34e('0xd')]=function(_0xc6adac){var _0x21337f=this;return new Promise(function(_0x48580a,_0x2012a6){return db['User'][_0xf34e('0xe')]({'raw':_0xc6adac[_0xf34e('0xf')]?_0xc6adac[_0xf34e('0xf')][_0xf34e('0x10')]===undefined?!![]:![]:!![],'where':_0xc6adac['options']?_0xc6adac['options']['where']||null:null,'attributes':_0xc6adac[_0xf34e('0xf')]?_0xc6adac[_0xf34e('0xf')]['attributes']||null:null,'limit':_0xc6adac[_0xf34e('0xf')]?_0xc6adac['options'][_0xf34e('0x11')]||null:null,'include':_0xc6adac[_0xf34e('0xf')]?_0xc6adac[_0xf34e('0xf')]['include']?_[_0xf34e('0x12')](_0xc6adac[_0xf34e('0xf')][_0xf34e('0x13')],function(_0x29b513){return{'model':db[_0x29b513[_0xf34e('0x14')]],'as':_0x29b513['as'],'attributes':_0x29b513['attributes'],'include':_0x29b513[_0xf34e('0x13')]?_[_0xf34e('0x12')](_0x29b513[_0xf34e('0x13')],function(_0x30d7da){return{'model':db[_0x30d7da[_0xf34e('0x14')]],'as':_0x30d7da['as'],'attributes':_0x30d7da['attributes'],'include':_0x30d7da[_0xf34e('0x13')]?_[_0xf34e('0x12')](_0x30d7da[_0xf34e('0x13')],function(_0x3d570e){return{'model':db[_0x3d570e[_0xf34e('0x14')]],'as':_0x3d570e['as'],'attributes':_0x3d570e[_0xf34e('0x15')]};}):[]};}):[]};}):[]:[]})[_0xf34e('0x16')](function(_0x511b6f){logger[_0xf34e('0x17')](_0xf34e('0xd'),_0xc6adac);logger[_0xf34e('0x18')](_0xf34e('0xd'),_0xc6adac,JSON[_0xf34e('0x19')](_0x511b6f));_0x48580a(_0x511b6f);})['catch'](function(_0x3fa686){logger[_0xf34e('0x1a')](_0xf34e('0xd'),_0x3fa686[_0xf34e('0x1b')],_0xc6adac);_0x2012a6(_0x21337f[_0xf34e('0x1a')](0x1f4,_0x3fa686[_0xf34e('0x1b')]));});});};exports[_0xf34e('0x1c')]=function(_0x4dc08d){var _0x12034f=this;return new Promise(function(_0x2781ce,_0x1e0ea6){return db['User']['find']({'raw':_0x4dc08d[_0xf34e('0xf')]?_0x4dc08d[_0xf34e('0xf')][_0xf34e('0x10')]===undefined?!![]:![]:!![],'where':_0x4dc08d['options']?_0x4dc08d[_0xf34e('0xf')][_0xf34e('0x1d')]||null:null,'attributes':_0x4dc08d[_0xf34e('0xf')]?_0x4dc08d[_0xf34e('0xf')]['attributes']||null:null,'include':_0x4dc08d[_0xf34e('0xf')]?_0x4dc08d['options']['include']?_[_0xf34e('0x12')](_0x4dc08d[_0xf34e('0xf')]['include'],function(_0x32b24e){return{'model':db[_0x32b24e[_0xf34e('0x14')]],'as':_0x32b24e['as'],'attributes':_0x32b24e[_0xf34e('0x15')],'include':_0x32b24e[_0xf34e('0x13')]?_['map'](_0x32b24e['include'],function(_0x53be9e){return{'model':db[_0x53be9e[_0xf34e('0x14')]],'as':_0x53be9e['as'],'attributes':_0x53be9e[_0xf34e('0x15')],'include':_0x53be9e[_0xf34e('0x13')]?_[_0xf34e('0x12')](_0x53be9e[_0xf34e('0x13')],function(_0x46b82a){return{'model':db[_0x46b82a[_0xf34e('0x14')]],'as':_0x46b82a['as'],'attributes':_0x46b82a[_0xf34e('0x15')]};}):[]};}):[]};}):[]:[]})[_0xf34e('0x16')](function(_0x58b012){logger[_0xf34e('0x17')](_0xf34e('0x1c'),_0x4dc08d);logger[_0xf34e('0x18')](_0xf34e('0x1c'),_0x4dc08d,JSON[_0xf34e('0x19')](_0x58b012));_0x2781ce(_0x58b012);})[_0xf34e('0x1e')](function(_0x484e39){logger['error'](_0xf34e('0x1c'),_0x484e39['message'],_0x4dc08d);_0x1e0ea6(_0x12034f[_0xf34e('0x1a')](0x1f4,_0x484e39[_0xf34e('0x1b')]));});});};exports[_0xf34e('0x1f')]=function(_0x5e4fe7){var _0x23d374;return db[_0xf34e('0x20')][_0xf34e('0x21')]({'where':_0x5e4fe7[_0xf34e('0xf')][_0xf34e('0x1d')]||{},'attributes':['id',_0xf34e('0x22'),_0xf34e('0x23'),_0xf34e('0x24'),'interface']})[_0xf34e('0x16')](function(_0x1acbe1){if(!_0x1acbe1){throw new Error(util['format'](_0xf34e('0x25'),_0x5e4fe7[_0xf34e('0x26')]['id']));}_0x23d374=_0x1acbe1;return db['UserVoiceQueueRt']['update']({'paused':0x1},{'where':{'UserId':_0x23d374['id']},'individualHooks':!![]});})[_0xf34e('0x16')](function(){return db[_0xf34e('0x27')][_0xf34e('0xe')]({'where':{'membername':_0x23d374[_0xf34e('0x22')],'type':'PAUSE','exitAt':null}});})[_0xf34e('0x16')](function(_0x5828b0){if(_0x5828b0&&_0x5828b0[_0xf34e('0x28')]){var _0x103cc2=moment()[_0xf34e('0x29')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x487fb3=0x0,_0x188d39=_0x5828b0[_0xf34e('0x28')];_0x487fb3<_0x188d39;_0x487fb3++){_0x5828b0[_0x487fb3][_0xf34e('0x2a')]({'exitAt':_0x103cc2});}}})[_0xf34e('0x16')](function(){var _0x1e77d9=[];var _0x2f9594=utils[_0xf34e('0x2b')]();_0x2f9594['forEach'](function(_0x207208){_0x1e77d9[_0xf34e('0x2c')]({'channel':_0x207208,'membername':_0x23d374['name'],'interface':_[_0xf34e('0x2d')](_0x23d374['interface'])?util['format'](_0xf34e('0x2e'),_0x23d374[_0xf34e('0x22')]):_0x23d374['interface'],'type':_0xf34e('0x2f'),'enterAt':moment()['format'](_0xf34e('0x30')),'data1':_0x5e4fe7[_0xf34e('0x31')]['type']||_0xf34e('0x32'),'role':_0x23d374[_0xf34e('0x23')],'internal':_0x23d374[_0xf34e('0x24')],'uniqueid':_0x5e4fe7['body'][_0xf34e('0x33')]||null});});return db['MemberReport'][_0xf34e('0x34')](_0x1e77d9,{'individualHooks':!![]});})['then'](function(){return _0x23d374[_0xf34e('0x35')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x5e4fe7[_0xf34e('0x31')][_0xf34e('0x36')]||_0xf34e('0x32'),'lastPauseAt':moment()[_0xf34e('0x29')](_0xf34e('0x30'))});})[_0xf34e('0x1e')](function(_0x33b3dd){throw _0x33b3dd;});};exports[_0xf34e('0x37')]=function(_0x4a2629){return Promise['resolve']()[_0xf34e('0x16')](function(){if(_0x4a2629[_0xf34e('0x31')][_0xf34e('0x38')]&&!utils['isValidChannel'](_0x4a2629['body'][_0xf34e('0x38')])){throw new Error(util['format'](_0xf34e('0x39'),_0x4a2629[_0xf34e('0x31')][_0xf34e('0x38')]));}return db[_0xf34e('0x20')][_0xf34e('0x3a')]({'where':_0x4a2629['options'][_0xf34e('0x1d')]||{},'attributes':['id','name',_0xf34e('0x23'),_0xf34e('0x24'),_0xf34e('0x3b'),'online','voicePause',_0xf34e('0x3c'),_0xf34e('0x3d'),'faxPause',_0xf34e('0x3e'),_0xf34e('0x3f'),_0xf34e('0x40'),_0xf34e('0x41'),_0xf34e('0x42')]});})['then'](function(_0x3495c8){if(!_0x3495c8){throw new Error(util['format']('User\x20with\x20id\x20%s\x20not\x20found',_0x4a2629[_0xf34e('0x26')]['id']));}return _0x3495c8['unpause'](_0x4a2629[_0xf34e('0x31')][_0xf34e('0x38')],_0xf34e('0x43'));})['catch'](function(_0x2522e2){throw _0x2522e2;});};exports[_0xf34e('0x44')]=function(_0xa9c084){var _0x40fef9=this;return new Promise(function(_0x41074f,_0x5806ea){var _0x2a9439;return db['User']['findOne']({'where':_0xa9c084[_0xf34e('0xf')][_0xf34e('0x1d')]||{},'attributes':['id',_0xf34e('0x22')]})['then'](function(_0x106055){if(_0x106055){_0x2a9439=_0x106055;return db[_0xf34e('0x45')]['destroy']({'where':{'membername':_0x2a9439[_0xf34e('0x22')]},'individualHooks':!![]});}})[_0xf34e('0x16')](function(){if(_0x2a9439){return db[_0xf34e('0x27')]['findAll']({'where':{'membername':_0x2a9439['name'],'exitAt':null}});}})['then'](function(_0x4783e4){if(_0x2a9439){if(_0x4783e4&&_0x4783e4[_0xf34e('0x28')]){var _0x22b13d=[];_0x4783e4[_0xf34e('0x46')](function(_0xdf6677){_0x22b13d['push'](_0xdf6677[_0xf34e('0x35')]({'exitAt':moment()[_0xf34e('0x29')](_0xf34e('0x30'))}));});return BPromise[_0xf34e('0x47')](_0x22b13d);}}})[_0xf34e('0x16')](function(){if(_0x2a9439){return _0x2a9439[_0xf34e('0x35')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0xf34e('0x16')](function(_0x14fbe8){_0x41074f(_0x14fbe8);})[_0xf34e('0x1e')](function(_0x92488f){_0x5806ea(_0x40fef9['error'](0x1f4,_0x92488f[_0xf34e('0x1b')]));});});};exports[_0xf34e('0x48')]=function(_0x89f4d8){var _0x2167a6=this;return new Promise(function(_0x5bf4f6,_0x1e9eb2){var _0x1a6d11;var _0x2d8141;var _0x554594;var _0x477207;return db[_0xf34e('0x20')][_0xf34e('0x3a')]({'where':_0x89f4d8[_0xf34e('0xf')][_0xf34e('0x1d')]||{},'attributes':['id',_0xf34e('0x22'),_0xf34e('0x23'),_0xf34e('0x49'),'phone','internal',_0xf34e('0x4a'),'interface']})[_0xf34e('0x16')](function(_0x5b674a){if(_0x5b674a){_0x1a6d11=_0x5b674a;_0x477207=_0x89f4d8[_0xf34e('0x31')][_0xf34e('0x3b')]?_0x89f4d8[_0xf34e('0x31')]['interface']:util[_0xf34e('0x29')](_0xf34e('0x2e'),_0x1a6d11['name']);return db['User'][_0xf34e('0x4b')]({'where':{'role':_0xf34e('0x4c'),'online':!![],'id':{'$ne':_0x1a6d11['id']}}});}})[_0xf34e('0x16')](function(_0x4d9d9c){if(_0x4d9d9c){_0x554594=_0x4d9d9c;return require(_0xf34e('0x4d'))[_0xf34e('0x4e')]();}})[_0xf34e('0x16')](function(_0x18d56f){if(_0x18d56f&&_0x18d56f[_0xf34e('0x4f')]&&_0x554594>=_0x18d56f[_0xf34e('0x4f')]){throw new Error(_0xf34e('0x50'));}})['then'](function(){if(_0x1a6d11){return db[_0xf34e('0x45')]['destroy']({'where':{'membername':_0x1a6d11[_0xf34e('0x22')]},'individualHooks':!![]});}})[_0xf34e('0x16')](function(){if(_0x1a6d11){return _0x1a6d11[_0xf34e('0x51')]({'raw':!![]});}})[_0xf34e('0x16')](function(_0x7e977f){if(_0x1a6d11){if(_0x7e977f){var _0x3422b2=[];_0x2d8141=_0x7e977f;if(_0x2d8141[_0xf34e('0x28')]){for(var _0x820ea6=0x0;_0x820ea6<_0x2d8141['length'];_0x820ea6++){_0x3422b2[_0xf34e('0x2c')](db[_0xf34e('0x45')]['upsert']({'membername':_0x1a6d11[_0xf34e('0x22')],'UserId':_0x1a6d11['id'],'queue_name':_0x2d8141[_0x820ea6][_0xf34e('0x22')],'VoiceQueueId':_0x2d8141[_0x820ea6]['id'],'interface':_0x477207,'paused':_0x1a6d11[_0xf34e('0x4a')]||![],'penalty':_0x2d8141[_0x820ea6]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0xf34e('0x47')](_0x3422b2);}}}})[_0xf34e('0x16')](function(){if(_0x1a6d11){return db['MemberReport'][_0xf34e('0xe')]({'where':{'membername':_0x1a6d11[_0xf34e('0x22')],'exitAt':null}});}})['then'](function(_0x5e30ee){if(_0x1a6d11){if(_0x5e30ee&&_0x5e30ee[_0xf34e('0x28')]){var _0x4aa9c=[];_0x5e30ee['forEach'](function(_0x42f241){_0x4aa9c['push'](_0x42f241[_0xf34e('0x35')]({'exitAt':moment()[_0xf34e('0x29')](_0xf34e('0x30'))}));});return BPromise[_0xf34e('0x47')](_0x4aa9c);}}})[_0xf34e('0x16')](function(){if(_0x1a6d11){var _0x25840c=[];var _0x3b8637=[];var _0x59edcf=utils[_0xf34e('0x2b')]();var _0x33cf96={'membername':_0x1a6d11[_0xf34e('0x22')],'interface':_0x477207,'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x1a6d11[_0xf34e('0x23')],'internal':_0x1a6d11[_0xf34e('0x24')]};_0x59edcf[_0xf34e('0x46')](function(_0x59cf09){_0x25840c[_0xf34e('0x2c')](_['merge']({'channel':_0x59cf09,'type':'LOGIN','data1':_0xf34e('0x52'),'data2':_0x477207},_0x33cf96));if(_0x1a6d11[_0xf34e('0x4a')]){_0x3b8637[_0xf34e('0x2c')](_[_0xf34e('0x53')]({'channel':_0x59cf09,'type':_0xf34e('0x2f'),'data1':_0xf34e('0x54')},_0x33cf96));}});return db[_0xf34e('0x27')][_0xf34e('0x34')](_0x25840c[_0xf34e('0x55')](_0x3b8637),{'individualHooks':!![]});}})[_0xf34e('0x16')](function(){if(_0x1a6d11){return _0x1a6d11['update']({'online':!![],'lastLoginAt':moment()[_0xf34e('0x29')](_0xf34e('0x30')),'voicePause':_0x1a6d11[_0xf34e('0x4a')]||![],'mailPause':_0x1a6d11[_0xf34e('0x4a')]||![],'chatPause':_0x1a6d11[_0xf34e('0x4a')]||![],'faxPause':_0x1a6d11['loginInPause']||![],'smsPause':_0x1a6d11[_0xf34e('0x4a')]||![],'openchannelPause':_0x1a6d11[_0xf34e('0x4a')]||![],'pauseType':_0x1a6d11[_0xf34e('0x4a')]?_0xf34e('0x54'):null,'lastPauseAt':moment()[_0xf34e('0x29')](_0xf34e('0x30')),'interface':_0x477207});}})['then'](function(_0x39de37){_0x5bf4f6(_0x39de37);})[_0xf34e('0x1e')](function(_0x44cd4c){_0x1e9eb2(_0x2167a6[_0xf34e('0x1a')](0x1f4,_0x44cd4c[_0xf34e('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 63ce8bf..2facb9f 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 _0x1a85=['save','remove','removeListener','register','user:','./user.events'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x1a85,0x77));var _0x51a8=function(_0x23c02b,_0x411b4d){_0x23c02b=_0x23c02b-0x0;var _0x25efc5=_0x1a85[_0x23c02b];return _0x25efc5;};'use strict';var UserEvents=require(_0x51a8('0x0'));var events=[_0x51a8('0x1'),_0x51a8('0x2'),'update'];function createListener(_0x182c9d,_0x16f8c9){return function(_0x1796af){_0x16f8c9['emit'](_0x182c9d,_0x1796af);};}function removeListener(_0x5bab99,_0x2c9b8e){return function(){UserEvents[_0x51a8('0x3')](_0x5bab99,_0x2c9b8e);};}exports[_0x51a8('0x4')]=function(_0x50e9e7){for(var _0x5c75e5=0x0,_0x3d376e=events['length'];_0x5c75e5<_0x3d376e;_0x5c75e5++){var _0x503a89=events[_0x5c75e5];var _0x2b5dd7=createListener(_0x51a8('0x5')+_0x503a89,_0x50e9e7);UserEvents['on'](_0x503a89,_0x2b5dd7);}}; \ No newline at end of file +var _0x6112=['update','emit','user:','./user.events','save','remove'];(function(_0xe71c60,_0x2a6d61){var _0x3c0010=function(_0x461f60){while(--_0x461f60){_0xe71c60['push'](_0xe71c60['shift']());}};_0x3c0010(++_0x2a6d61);}(_0x6112,0xdb));var _0x2611=function(_0x107ad7,_0x404cd6){_0x107ad7=_0x107ad7-0x0;var _0xd181d1=_0x6112[_0x107ad7];return _0xd181d1;};'use strict';var UserEvents=require(_0x2611('0x0'));var events=[_0x2611('0x1'),_0x2611('0x2'),_0x2611('0x3')];function createListener(_0x15a39e,_0x2935f0){return function(_0x5e3621){_0x2935f0[_0x2611('0x4')](_0x15a39e,_0x5e3621);};}function removeListener(_0x152af1,_0x59ab82){return function(){UserEvents['removeListener'](_0x152af1,_0x59ab82);};}exports['register']=function(_0x3562af){for(var _0x4aa691=0x0,_0x2ef129=events['length'];_0x4aa691<_0x2ef129;_0x4aa691++){var _0x11bd63=events[_0x4aa691];var _0x287c9a=createListener(_0x2611('0x5')+_0x11bd63,_0x3562af);UserEvents['on'](_0x11bd63,_0x287c9a);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index cdb681f..fc129a9 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x4afc75,_0x5df67f){var _0x2a6e1e=function(_0x352593){while(--_0x352593){_0x4afc75['push'](_0x4afc75['shift']());}};_0x2a6e1e(++_0x5df67f);}(_0xedd9,0xfc));var _0x9edd=function(_0x11d94c,_0x27ada4){_0x11d94c=_0x11d94c-0x0;var _0x55f734=_0xedd9[_0x11d94c];return _0x55f734;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x13b329,_0x5f2ca7){var _0x2c01bb=function(_0x183409){while(--_0x183409){_0x13b329['push'](_0x13b329['shift']());}};_0x2c01bb(++_0x5f2ca7);}(_0x9c44,0x178));var _0x49c4=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x9c44[_0x543084];return _0x306a57;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 32f340b..7b16a77 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 _0x14f5=['exports'];(function(_0x5ee013,_0x2226df){var _0x434508=function(_0x23c138){while(--_0x23c138){_0x5ee013['push'](_0x5ee013['shift']());}};_0x434508(++_0x2226df);}(_0x14f5,0xae));var _0x514f=function(_0x4415f0,_0x2c78c5){_0x4415f0=_0x4415f0-0x0;var _0x1e7904=_0x14f5[_0x4415f0];return _0x1e7904;};'use strict';var Sequelize=require('sequelize');module[_0x514f('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xbdb9=['INTEGER','sequelize','exports'];(function(_0x44c935,_0x3653f0){var _0x465bee=function(_0x211d20){while(--_0x211d20){_0x44c935['push'](_0x44c935['shift']());}};_0x465bee(++_0x3653f0);}(_0xbdb9,0xac));var _0x9bdb=function(_0xa5455b,_0x1c20a1){_0xa5455b=_0xa5455b-0x0;var _0x1e12a0=_0xbdb9[_0xa5455b];return _0x1e12a0;};'use strict';var Sequelize=require(_0x9bdb('0x0'));module[_0x9bdb('0x1')]={'penalty':{'type':Sequelize[_0x9bdb('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 e9b3aea..c0d4ed3 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 _0x47df=['./userChatQueue.attributes','exports','define','user_has_chat_queues','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0xf670f0,_0x353747){var _0x3c21c6=function(_0xa0e0b2){while(--_0xa0e0b2){_0xf670f0['push'](_0xf670f0['shift']());}};_0x3c21c6(++_0x353747);}(_0x47df,0x1b1));var _0xf47d=function(_0x287e86,_0x45ffff){_0x287e86=_0x287e86-0x0;var _0x452d7c=_0x47df[_0x287e86];return _0x452d7c;};'use strict';var _=require('lodash');var util=require(_0xf47d('0x0'));var logger=require(_0xf47d('0x1'))(_0xf47d('0x2'));var moment=require('moment');var BPromise=require(_0xf47d('0x3'));var rp=require(_0xf47d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf47d('0x5'));var config=require(_0xf47d('0x6'));var attributes=require(_0xf47d('0x7'));module[_0xf47d('0x8')]=function(_0x3ec0cc,_0x4c9f82){return _0x3ec0cc[_0xf47d('0x9')]('UserChatQueue',attributes,{'tableName':_0xf47d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7fe9=['request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','exports','define','UserChatQueue','user_has_chat_queues','lodash','util','moment','bluebird'];(function(_0x1e2f28,_0x27b8a2){var _0x47454c=function(_0x3a4adf){while(--_0x3a4adf){_0x1e2f28['push'](_0x1e2f28['shift']());}};_0x47454c(++_0x27b8a2);}(_0x7fe9,0x19c));var _0x97fe=function(_0x5917bd,_0x37a5a4){_0x5917bd=_0x5917bd-0x0;var _0x2efb99=_0x7fe9[_0x5917bd];return _0x2efb99;};'use strict';var _=require(_0x97fe('0x0'));var util=require(_0x97fe('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x97fe('0x2'));var BPromise=require(_0x97fe('0x3'));var rp=require(_0x97fe('0x4'));var fs=require('fs');var path=require(_0x97fe('0x5'));var rimraf=require(_0x97fe('0x6'));var config=require(_0x97fe('0x7'));var attributes=require(_0x97fe('0x8'));module[_0x97fe('0x9')]=function(_0x49c781,_0x8db0dc){return _0x49c781[_0x97fe('0xa')](_0x97fe('0xb'),attributes,{'tableName':_0x97fe('0xc'),'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 183f68d..d1b4327 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 _0x1ef4=['result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x598aa9,_0x36ce33){var _0x4ccbc3=function(_0x3be91a){while(--_0x3be91a){_0x598aa9['push'](_0x598aa9['shift']());}};_0x4ccbc3(++_0x36ce33);}(_0x1ef4,0xc8));var _0x41ef=function(_0x216d71,_0x59c4e1){_0x216d71=_0x216d71-0x0;var _0x46d25f=_0x1ef4[_0x216d71];return _0x46d25f;};'use strict';var _=require(_0x41ef('0x0'));var util=require(_0x41ef('0x1'));var moment=require(_0x41ef('0x2'));var BPromise=require('bluebird');var rs=require(_0x41ef('0x3'));var fs=require('fs');var Redis=require(_0x41ef('0x4'));var db=require(_0x41ef('0x5'))['db'];var utils=require(_0x41ef('0x6'));var logger=require(_0x41ef('0x7'))('rpc');var config=require(_0x41ef('0x8'));var jayson=require(_0x41ef('0x9'));var client=jayson['client'][_0x41ef('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x20b9fb,_0x3594d2,_0x265684){return new BPromise(function(_0x1dbe27,_0x57e2f3){return client[_0x41ef('0xb')](_0x20b9fb,_0x265684)['then'](function(_0x2beb22){logger[_0x41ef('0xc')](_0x41ef('0xd'),_0x3594d2,_0x41ef('0xe'));logger[_0x41ef('0xf')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x3594d2,_0x41ef('0xe'),JSON[_0x41ef('0x10')](_0x2beb22));if(_0x2beb22['error']){if(_0x2beb22[_0x41ef('0x11')][_0x41ef('0x12')]===0x1f4){logger[_0x41ef('0x11')](_0x41ef('0xd'),_0x3594d2,_0x2beb22[_0x41ef('0x11')]['message']);return _0x57e2f3(_0x2beb22[_0x41ef('0x11')][_0x41ef('0x13')]);}logger['error']('UserChatQueue,\x20%s,\x20%s',_0x3594d2,_0x2beb22[_0x41ef('0x11')]['message']);return _0x1dbe27(_0x2beb22[_0x41ef('0x11')][_0x41ef('0x13')]);}else{logger[_0x41ef('0xc')]('UserChatQueue,\x20%s,\x20%s',_0x3594d2,'request\x20sent');_0x1dbe27(_0x2beb22[_0x41ef('0x14')][_0x41ef('0x13')]);}})[_0x41ef('0x15')](function(_0x37e53a){logger[_0x41ef('0x11')]('UserChatQueue,\x20%s,\x20%s',_0x3594d2,_0x37e53a);_0x57e2f3(_0x37e53a);});});} \ No newline at end of file +var _0x05bb=['util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','client','http','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash'];(function(_0x1188c0,_0xa21f2a){var _0x3b997b=function(_0x21f573){while(--_0x21f573){_0x1188c0['push'](_0x1188c0['shift']());}};_0x3b997b(++_0xa21f2a);}(_0x05bb,0x1b8));var _0xb05b=function(_0x3dbb78,_0x3552c3){_0x3dbb78=_0x3dbb78-0x0;var _0x27d10f=_0x05bb[_0x3dbb78];return _0x27d10f;};'use strict';var _=require(_0xb05b('0x0'));var util=require(_0xb05b('0x1'));var moment=require(_0xb05b('0x2'));var BPromise=require(_0xb05b('0x3'));var rs=require(_0xb05b('0x4'));var fs=require('fs');var Redis=require(_0xb05b('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb05b('0x6'))(_0xb05b('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb05b('0x8')][_0xb05b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3080cd,_0x3916d1,_0x3f9679){return new BPromise(function(_0xb8d05e,_0x5e3ade){return client['request'](_0x3080cd,_0x3f9679)[_0xb05b('0xa')](function(_0x1339ab){logger[_0xb05b('0xb')](_0xb05b('0xc'),_0x3916d1,_0xb05b('0xd'));logger[_0xb05b('0xe')](_0xb05b('0xf'),_0x3916d1,_0xb05b('0xd'),JSON['stringify'](_0x1339ab));if(_0x1339ab['error']){if(_0x1339ab[_0xb05b('0x10')][_0xb05b('0x11')]===0x1f4){logger[_0xb05b('0x10')](_0xb05b('0xc'),_0x3916d1,_0x1339ab['error'][_0xb05b('0x12')]);return _0x5e3ade(_0x1339ab[_0xb05b('0x10')][_0xb05b('0x12')]);}logger[_0xb05b('0x10')](_0xb05b('0xc'),_0x3916d1,_0x1339ab[_0xb05b('0x10')][_0xb05b('0x12')]);return _0xb8d05e(_0x1339ab['error'][_0xb05b('0x12')]);}else{logger[_0xb05b('0xb')](_0xb05b('0xc'),_0x3916d1,'request\x20sent');_0xb8d05e(_0x1339ab[_0xb05b('0x13')][_0xb05b('0x12')]);}})[_0xb05b('0x14')](function(_0x2c295a){logger[_0xb05b('0x10')](_0xb05b('0xc'),_0x3916d1,_0x2c295a);_0x5e3ade(_0x2c295a);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index e4ac38d..c7e7029 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(_0x5dde91,_0x3bb66e){var _0x402888=function(_0x3ee674){while(--_0x3ee674){_0x5dde91['push'](_0x5dde91['shift']());}};_0x402888(++_0x3bb66e);}(_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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x23f1ed,_0x2dfecf){var _0x130011=function(_0xccf2e){while(--_0xccf2e){_0x23f1ed['push'](_0x23f1ed['shift']());}};_0x130011(++_0x2dfecf);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x31eb67,_0x9bc8c0){_0x31eb67=_0x31eb67-0x0;var _0x2a8cb8=_0xcb91[_0x31eb67];return _0x2a8cb8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index a2c4607..4f19293 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 _0x442d=['STRING','sequelize','exports'];(function(_0x38b7df,_0x13a912){var _0x1acddf=function(_0x551ee8){while(--_0x551ee8){_0x38b7df['push'](_0x38b7df['shift']());}};_0x1acddf(++_0x13a912);}(_0x442d,0x148));var _0xd442=function(_0x35c5a8,_0x8ecb48){_0x35c5a8=_0x35c5a8-0x0;var _0x34782c=_0x442d[_0x35c5a8];return _0x34782c;};'use strict';var Sequelize=require(_0xd442('0x0'));module[_0xd442('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0xd442('0x2')]}}; \ No newline at end of file +var _0xce30=['STRING','exports','INTEGER'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xce30,0x148));var _0x0ce3=function(_0x1b5d5f,_0x5ed766){_0x1b5d5f=_0x1b5d5f-0x0;var _0x3c9347=_0xce30[_0x1b5d5f];return _0x3c9347;};'use strict';var Sequelize=require('sequelize');module[_0x0ce3('0x0')]={'penalty':{'type':Sequelize[_0x0ce3('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x0ce3('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x0ce3('0x2')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 90eb93a..8116333 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 _0xb71d=['UserFaxQueue','user_has_fax_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','exports','define'];(function(_0x2df833,_0x54ee34){var _0x1adb99=function(_0x2e89c4){while(--_0x2e89c4){_0x2df833['push'](_0x2df833['shift']());}};_0x1adb99(++_0x54ee34);}(_0xb71d,0x178));var _0xdb71=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xb71d[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xdb71('0x0'));var util=require(_0xdb71('0x1'));var logger=require(_0xdb71('0x2'))(_0xdb71('0x3'));var moment=require(_0xdb71('0x4'));var BPromise=require(_0xdb71('0x5'));var rp=require(_0xdb71('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./userFaxQueue.attributes');module[_0xdb71('0x7')]=function(_0x46cfc2,_0x2cd039){return _0x46cfc2[_0xdb71('0x8')](_0xdb71('0x9'),attributes,{'tableName':_0xdb71('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc76e=['exports','user_has_fax_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userFaxQueue.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc76e,0x1ba));var _0xec76=function(_0x3811f8,_0xb89af8){_0x3811f8=_0x3811f8-0x0;var _0x390616=_0xc76e[_0x3811f8];return _0x390616;};'use strict';var _=require(_0xec76('0x0'));var util=require('util');var logger=require(_0xec76('0x1'))(_0xec76('0x2'));var moment=require(_0xec76('0x3'));var BPromise=require(_0xec76('0x4'));var rp=require(_0xec76('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xec76('0x6'));var config=require(_0xec76('0x7'));var attributes=require(_0xec76('0x8'));module[_0xec76('0x9')]=function(_0x146fab,_0x38d2bd){return _0x146fab['define']('UserFaxQueue',attributes,{'tableName':_0xec76('0xa'),'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 399a9e1..50cc198 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 _0x174c=['request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client'];(function(_0x45fc6a,_0x166adb){var _0x14bcfd=function(_0x3ba718){while(--_0x3ba718){_0x45fc6a['push'](_0x45fc6a['shift']());}};_0x14bcfd(++_0x166adb);}(_0x174c,0x1c2));var _0xc174=function(_0x5d71fb,_0x5b3f42){_0x5d71fb=_0x5d71fb-0x0;var _0x19bac8=_0x174c[_0x5d71fb];return _0x19bac8;};'use strict';var _=require(_0xc174('0x0'));var util=require(_0xc174('0x1'));var moment=require('moment');var BPromise=require(_0xc174('0x2'));var rs=require(_0xc174('0x3'));var fs=require('fs');var Redis=require(_0xc174('0x4'));var db=require(_0xc174('0x5'))['db'];var utils=require(_0xc174('0x6'));var logger=require(_0xc174('0x7'))(_0xc174('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc174('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x16dec4,_0x5c9cac,_0x27bef9){return new BPromise(function(_0x136288,_0x16744e){return client[_0xc174('0xa')](_0x16dec4,_0x27bef9)[_0xc174('0xb')](function(_0x5ec218){logger[_0xc174('0xc')](_0xc174('0xd'),_0x5c9cac,_0xc174('0xe'));logger[_0xc174('0xf')](_0xc174('0x10'),_0x5c9cac,'request\x20sent',JSON[_0xc174('0x11')](_0x5ec218));if(_0x5ec218[_0xc174('0x12')]){if(_0x5ec218[_0xc174('0x12')][_0xc174('0x13')]===0x1f4){logger[_0xc174('0x12')](_0xc174('0xd'),_0x5c9cac,_0x5ec218[_0xc174('0x12')][_0xc174('0x14')]);return _0x16744e(_0x5ec218[_0xc174('0x12')][_0xc174('0x14')]);}logger[_0xc174('0x12')](_0xc174('0xd'),_0x5c9cac,_0x5ec218[_0xc174('0x12')][_0xc174('0x14')]);return _0x136288(_0x5ec218[_0xc174('0x12')][_0xc174('0x14')]);}else{logger['info'](_0xc174('0xd'),_0x5c9cac,_0xc174('0xe'));_0x136288(_0x5ec218[_0xc174('0x15')][_0xc174('0x14')]);}})[_0xc174('0x16')](function(_0x45a204){logger[_0xc174('0x12')](_0xc174('0xd'),_0x5c9cac,_0x45a204);_0x16744e(_0x45a204);});});} \ No newline at end of file +var _0xc868=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','moment','bluebird'];(function(_0xf16b1,_0x33c637){var _0x26f94d=function(_0x5643d7){while(--_0x5643d7){_0xf16b1['push'](_0xf16b1['shift']());}};_0x26f94d(++_0x33c637);}(_0xc868,0x138));var _0x8c86=function(_0x4961a4,_0x3b5ec9){_0x4961a4=_0x4961a4-0x0;var _0x524aa0=_0xc868[_0x4961a4];return _0x524aa0;};'use strict';var _=require(_0x8c86('0x0'));var util=require('util');var moment=require(_0x8c86('0x1'));var BPromise=require(_0x8c86('0x2'));var rs=require(_0x8c86('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8c86('0x4'))['db'];var utils=require(_0x8c86('0x5'));var logger=require(_0x8c86('0x6'))(_0x8c86('0x7'));var config=require(_0x8c86('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8c86('0x9')][_0x8c86('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x288aae,_0x421108,_0x5efdb0){return new BPromise(function(_0x3e0706,_0x3cfce5){return client[_0x8c86('0xb')](_0x288aae,_0x5efdb0)[_0x8c86('0xc')](function(_0x476f55){logger[_0x8c86('0xd')](_0x8c86('0xe'),_0x421108,_0x8c86('0xf'));logger['debug']('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x421108,_0x8c86('0xf'),JSON[_0x8c86('0x10')](_0x476f55));if(_0x476f55[_0x8c86('0x11')]){if(_0x476f55['error']['code']===0x1f4){logger[_0x8c86('0x11')](_0x8c86('0xe'),_0x421108,_0x476f55[_0x8c86('0x11')][_0x8c86('0x12')]);return _0x3cfce5(_0x476f55[_0x8c86('0x11')]['message']);}logger[_0x8c86('0x11')](_0x8c86('0xe'),_0x421108,_0x476f55[_0x8c86('0x11')][_0x8c86('0x12')]);return _0x3e0706(_0x476f55['error']['message']);}else{logger[_0x8c86('0xd')](_0x8c86('0xe'),_0x421108,_0x8c86('0xf'));_0x3e0706(_0x476f55[_0x8c86('0x13')]['message']);}})[_0x8c86('0x14')](function(_0x340f0e){logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x421108,_0x340f0e);_0x3cfce5(_0x340f0e);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 1726c19..e509595 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x4d7906,_0x5250ed){var _0x667c9f=function(_0x562e75){while(--_0x562e75){_0x4d7906['push'](_0x4d7906['shift']());}};_0x667c9f(++_0x5250ed);}(_0xe706,0xa3));var _0x6e70=function(_0x280421,_0x238fa1){_0x280421=_0x280421-0x0;var _0x328d92=_0xe706[_0x280421];return _0x328d92;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x2c6780,_0x3e39b0){var _0x1d2d7e=function(_0x592a75){while(--_0x592a75){_0x2c6780['push'](_0x2c6780['shift']());}};_0x1d2d7e(++_0x3e39b0);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x48d6a3,_0x37c848){_0x48d6a3=_0x48d6a3-0x0;var _0x38bfa0=_0xcb91[_0x48d6a3];return _0x38bfa0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 1fb060d..b6c71a8 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 _0x7136=['INTEGER','sequelize','exports'];(function(_0x3ad350,_0x111ec4){var _0x348fe8=function(_0x4ee25d){while(--_0x4ee25d){_0x3ad350['push'](_0x3ad350['shift']());}};_0x348fe8(++_0x111ec4);}(_0x7136,0x1c0));var _0x6713=function(_0x2eb9eb,_0x4ce789){_0x2eb9eb=_0x2eb9eb-0x0;var _0x172bec=_0x7136[_0x2eb9eb];return _0x172bec;};'use strict';var Sequelize=require(_0x6713('0x0'));module[_0x6713('0x1')]={'penalty':{'type':Sequelize[_0x6713('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa135=['exports','INTEGER'];(function(_0x8f398c,_0x189cc6){var _0x22450c=function(_0x4cf097){while(--_0x4cf097){_0x8f398c['push'](_0x8f398c['shift']());}};_0x22450c(++_0x189cc6);}(_0xa135,0x12e));var _0x5a13=function(_0x174cd5,_0x366610){_0x174cd5=_0x174cd5-0x0;var _0x2388f0=_0xa135[_0x174cd5];return _0x2388f0;};'use strict';var Sequelize=require('sequelize');module[_0x5a13('0x0')]={'penalty':{'type':Sequelize[_0x5a13('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 7c36fd9..38d6a3e 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 _0x1bb4=['UserMailQueue','user_has_mail_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','define'];(function(_0x252b2a,_0x596a2d){var _0x48f71d=function(_0xd2dfa7){while(--_0xd2dfa7){_0x252b2a['push'](_0x252b2a['shift']());}};_0x48f71d(++_0x596a2d);}(_0x1bb4,0x12d));var _0x41bb=function(_0x3dd091,_0x2c44f9){_0x3dd091=_0x3dd091-0x0;var _0x4621a1=_0x1bb4[_0x3dd091];return _0x4621a1;};'use strict';var _=require(_0x41bb('0x0'));var util=require(_0x41bb('0x1'));var logger=require(_0x41bb('0x2'))('api');var moment=require(_0x41bb('0x3'));var BPromise=require(_0x41bb('0x4'));var rp=require(_0x41bb('0x5'));var fs=require('fs');var path=require(_0x41bb('0x6'));var rimraf=require(_0x41bb('0x7'));var config=require(_0x41bb('0x8'));var attributes=require(_0x41bb('0x9'));module['exports']=function(_0x3c2cd3,_0x4fbce1){return _0x3c2cd3[_0x41bb('0xa')](_0x41bb('0xb'),attributes,{'tableName':_0x41bb('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1cd7=['user_has_mail_queues','util','../../config/logger','api','moment','bluebird','path','rimraf','exports','define'];(function(_0x3ae33b,_0x299a4f){var _0x27041b=function(_0x5cbc8a){while(--_0x5cbc8a){_0x3ae33b['push'](_0x3ae33b['shift']());}};_0x27041b(++_0x299a4f);}(_0x1cd7,0x12d));var _0x71cd=function(_0x419b40,_0x1395e8){_0x419b40=_0x419b40-0x0;var _0x3a4da1=_0x1cd7[_0x419b40];return _0x3a4da1;};'use strict';var _=require('lodash');var util=require(_0x71cd('0x0'));var logger=require(_0x71cd('0x1'))(_0x71cd('0x2'));var moment=require(_0x71cd('0x3'));var BPromise=require(_0x71cd('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x71cd('0x5'));var rimraf=require(_0x71cd('0x6'));var config=require('../../config/environment');var attributes=require('./userMailQueue.attributes');module[_0x71cd('0x7')]=function(_0x551c51,_0x193591){return _0x551c51[_0x71cd('0x8')]('UserMailQueue',attributes,{'tableName':_0x71cd('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index 4bef7be..cda0725 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(_0x112fdf,_0x4f56fa){var _0x4139d2=function(_0x1bdfd3){while(--_0x1bdfd3){_0x112fdf['push'](_0x112fdf['shift']());}};_0x4139d2(++_0x4f56fa);}(_0x3e74,0x175));var _0x43e7=function(_0x1810d2,_0x4c49f1){_0x1810d2=_0x1810d2-0x0;var _0x4b24fa=_0x3e74[_0x1810d2];return _0x4b24fa;};'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 _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(_0x4424f0,_0x56aa47){var _0x1597f6=function(_0x362469){while(--_0x362469){_0x4424f0['push'](_0x4424f0['shift']());}};_0x1597f6(++_0x56aa47);}(_0x3e74,0x175));var _0x43e7=function(_0x55087,_0x35d855){_0x55087=_0x55087-0x0;var _0x2f6d7b=_0x3e74[_0x55087];return _0x2f6d7b;};'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 diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index d90e0e9..4ebdeb8 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 _0x07bb=['util','express','fs-extra','../../components/interaction/service','../../config/environment','./userNotification.controller','post','isAuthenticated','sendUserNotification','exports','multer'];(function(_0x25dbd4,_0x359199){var _0x55ca7e=function(_0x4cafad){while(--_0x4cafad){_0x25dbd4['push'](_0x25dbd4['shift']());}};_0x55ca7e(++_0x359199);}(_0x07bb,0x11d));var _0xb07b=function(_0x38f6bc,_0x10832a){_0x38f6bc=_0x38f6bc-0x0;var _0x209b27=_0x07bb[_0x38f6bc];return _0x209b27;};'use strict';var multer=require(_0xb07b('0x0'));var util=require(_0xb07b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb07b('0x2'));var router=express['Router']();var fs_extra=require(_0xb07b('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xb07b('0x4'));var config=require(_0xb07b('0x5'));var controller=require(_0xb07b('0x6'));router[_0xb07b('0x7')]('/',auth[_0xb07b('0x8')](),controller[_0xb07b('0x9')]);module[_0xb07b('0xa')]=router; \ No newline at end of file +var _0xd771=['fs-extra','../../components/auth/service','../../components/interaction/service','./userNotification.controller','post','isAuthenticated','sendUserNotification','exports','multer','util','path','express','Router'];(function(_0x4b6b0c,_0x4d0282){var _0x507c47=function(_0x5b9559){while(--_0x5b9559){_0x4b6b0c['push'](_0x4b6b0c['shift']());}};_0x507c47(++_0x4d0282);}(_0xd771,0x1dc));var _0x1d77=function(_0x555f06,_0x4172b8){_0x555f06=_0x555f06-0x0;var _0x1e1102=_0xd771[_0x555f06];return _0x1e1102;};'use strict';var multer=require(_0x1d77('0x0'));var util=require(_0x1d77('0x1'));var path=require(_0x1d77('0x2'));var timeout=require('connect-timeout');var express=require(_0x1d77('0x3'));var router=express[_0x1d77('0x4')]();var fs_extra=require(_0x1d77('0x5'));var auth=require(_0x1d77('0x6'));var interaction=require(_0x1d77('0x7'));var config=require('../../config/environment');var controller=require(_0x1d77('0x8'));router[_0x1d77('0x9')]('/',auth[_0x1d77('0xa')](),controller[_0x1d77('0xb')]);module[_0x1d77('0xc')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 774357c..6f43e87 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 _0x4225=['TEXT','STRING','BOOLEAN'];(function(_0x198666,_0x296dc0){var _0x206876=function(_0x4fc8d4){while(--_0x4fc8d4){_0x198666['push'](_0x198666['shift']());}};_0x206876(++_0x296dc0);}(_0x4225,0x7e));var _0x5422=function(_0x48724a,_0x3ab110){_0x48724a=_0x48724a-0x0;var _0x39502b=_0x4225[_0x48724a];return _0x39502b;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x5422('0x0')]},'senderName':{'type':Sequelize[_0x5422('0x1')]},'recipientsId':{'type':Sequelize[_0x5422('0x0')]},'recipientsDescription':{'type':Sequelize[_0x5422('0x1')]},'beep':{'type':Sequelize[_0x5422('0x2')]}}; \ No newline at end of file +var _0x150b=['sequelize','exports','TEXT','STRING','BOOLEAN'];(function(_0x573097,_0x8ab15c){var _0x5ca6d3=function(_0x1d250c){while(--_0x1d250c){_0x573097['push'](_0x573097['shift']());}};_0x5ca6d3(++_0x8ab15c);}(_0x150b,0x1b8));var _0xb150=function(_0x4b5813,_0x5769de){_0x4b5813=_0x4b5813-0x0;var _0x423465=_0x150b[_0x4b5813];return _0x423465;};'use strict';var Sequelize=require(_0xb150('0x0'));module[_0xb150('0x1')]={'body':{'type':Sequelize[_0xb150('0x2')]},'senderName':{'type':Sequelize[_0xb150('0x3')]},'recipientsId':{'type':Sequelize[_0xb150('0x2')]},'recipientsDescription':{'type':Sequelize[_0xb150('0x3')]},'beep':{'type':Sequelize[_0xb150('0x4')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 1f226ae..95ff4a2 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 _0x9c55=['sendStatus','end','status','undefined','limit','count','offset','Content-Range','json','apply','reject','save','update','destroy','then','error','stack','name','send','sendUserNotification','body','hasOwnProperty','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','user','recipientsDescription','isEmpty','beep','recipientsId','join','sequelize','transaction','UserNotification','create','recipient','emit','userNotification:send','catch','text','Template','findOne','html','render','forEach','startCase','User','ids','queue','replace','push','all','union','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register'];(function(_0x565fed,_0xb85768){var _0x3e018f=function(_0x104d8e){while(--_0x104d8e){_0x565fed['push'](_0x565fed['shift']());}};_0x3e018f(++_0xb85768);}(_0x9c55,0x179));var _0x59c5=function(_0x270dba,_0x1817d2){_0x270dba=_0x270dba-0x0;var _0x36b83b=_0x9c55[_0x270dba];return _0x36b83b;};'use strict';var emlformat=require(_0x59c5('0x0'));var rimraf=require(_0x59c5('0x1'));var zipdir=require(_0x59c5('0x2'));var jsonpatch=require(_0x59c5('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x59c5('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x59c5('0x5'));var sox=require(_0x59c5('0x6'));var csv=require(_0x59c5('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x59c5('0x8'));var _=require(_0x59c5('0x9'));var squel=require(_0x59c5('0xa'));var crypto=require(_0x59c5('0xb'));var jsforce=require(_0x59c5('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x59c5('0x7'));var querystring=require(_0x59c5('0xd'));var Papa=require('papaparse');var Redis=require(_0x59c5('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x59c5('0xf'));var as=require(_0x59c5('0x10'));var hardwareService=require(_0x59c5('0x11'));var logger=require(_0x59c5('0x12'))(_0x59c5('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x59c5('0x14'));var db=require(_0x59c5('0x15'))['db'];config[_0x59c5('0x16')]=_[_0x59c5('0x17')](config[_0x59c5('0x16')],{'host':_0x59c5('0x18'),'port':0x18eb});var socket=require(_0x59c5('0x19'))(new Redis(config[_0x59c5('0x16')]));require('./userNotification.socket')[_0x59c5('0x1a')](socket);function respondWithStatusCode(_0x1c27ea,_0x4b2068){_0x4b2068=_0x4b2068||0xcc;return function(_0x4bf1c8){if(_0x4bf1c8){return _0x1c27ea[_0x59c5('0x1b')](_0x4b2068);}return _0x1c27ea['status'](_0x4b2068)[_0x59c5('0x1c')]();};}function respondWithResult(_0x3d3ab9,_0x5d7ec8){_0x5d7ec8=_0x5d7ec8||0xc8;return function(_0x3c2869){if(_0x3c2869){return _0x3d3ab9[_0x59c5('0x1d')](_0x5d7ec8)['json'](_0x3c2869);}};}function respondWithFilteredResult(_0x1a1d86,_0x244301){return function(_0x3dabab){if(_0x3dabab){var _0x4c3786=typeof _0x244301['offset']===_0x59c5('0x1e')&&typeof _0x244301[_0x59c5('0x1f')]===_0x59c5('0x1e');var _0x8fbd1b=_0x3dabab[_0x59c5('0x20')];var _0x3006e2=_0x4c3786?0x0:_0x244301[_0x59c5('0x21')];var _0x582ca1=_0x4c3786?_0x3dabab[_0x59c5('0x20')]:_0x244301['offset']+_0x244301[_0x59c5('0x1f')];var _0x1dc7e8;if(_0x582ca1>=_0x8fbd1b){_0x582ca1=_0x8fbd1b;_0x1dc7e8=0xc8;}else{_0x1dc7e8=0xce;}_0x1a1d86[_0x59c5('0x1d')](_0x1dc7e8);return _0x1a1d86['set'](_0x59c5('0x22'),_0x3006e2+'-'+_0x582ca1+'/'+_0x8fbd1b)[_0x59c5('0x23')](_0x3dabab);}return null;};}function patchUpdates(_0x41b893){return function(_0x3e6366){try{jsonpatch[_0x59c5('0x24')](_0x3e6366,_0x41b893,!![]);}catch(_0x52f41f){return BPromise[_0x59c5('0x25')](_0x52f41f);}return _0x3e6366[_0x59c5('0x26')]();};}function saveUpdates(_0x1ef81e,_0x18de4a){return function(_0x4f4b3c){if(_0x4f4b3c){return _0x4f4b3c[_0x59c5('0x27')](_0x1ef81e)['then'](function(_0x378819){return _0x378819;});}return null;};}function removeEntity(_0xab66ac,_0x5ae06e){return function(_0x48107){if(_0x48107){return _0x48107[_0x59c5('0x28')]()[_0x59c5('0x29')](function(){_0xab66ac[_0x59c5('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x42b8f0,_0x55e523){return function(_0x1734c8){if(!_0x1734c8){_0x42b8f0[_0x59c5('0x1b')](0x194);}return _0x1734c8;};}function handleError(_0x37fafb,_0x2795c5){_0x2795c5=_0x2795c5||0x1f4;return function(_0x4f4662){logger[_0x59c5('0x2a')](_0x4f4662[_0x59c5('0x2b')]);if(_0x4f4662[_0x59c5('0x2c')]){delete _0x4f4662['name'];}_0x37fafb['status'](_0x2795c5)[_0x59c5('0x2d')](_0x4f4662);};}exports[_0x59c5('0x2e')]=function(_0x1aa987,_0x1e7b83,_0x288bb2){if(!_0x1aa987[_0x59c5('0x2f')][_0x59c5('0x30')]('text')&&!_0x1aa987[_0x59c5('0x2f')]['hasOwnProperty'](_0x59c5('0x31'))){throw new db[(_0x59c5('0x32'))][(_0x59c5('0x33'))](_0x59c5('0x34'));}else{if(_0x1aa987[_0x59c5('0x2f')]['hasOwnProperty'](_0x59c5('0x31'))&&!_0x1aa987['body'][_0x59c5('0x30')](_0x59c5('0x35'))){throw new db[(_0x59c5('0x32'))][(_0x59c5('0x33'))](_0x59c5('0x36'));}if(!_0x1aa987[_0x59c5('0x2f')][_0x59c5('0x30')](_0x59c5('0x37'))){throw new db[(_0x59c5('0x32'))][(_0x59c5('0x33'))](_0x59c5('0x38'));}else{try{var _0x3cb2a2=JSON[_0x59c5('0x39')](_0x1aa987[_0x59c5('0x2f')]['recipients']);}catch(_0x1b67a3){logger[_0x59c5('0x2a')](_0x1b67a3);throw new db['Sequelize'][(_0x59c5('0x33'))](_0x59c5('0x3a'));}var _0x59d66c=[_0x59c5('0x3b'),_0x59c5('0x3c'),_0x59c5('0x3d'),_0x59c5('0x3e'),_0x59c5('0x3f'),_0x59c5('0x40'),_0x59c5('0x41'),_0x59c5('0x42'),'user'];if(_[_0x59c5('0x43')](_0x3cb2a2,function(_0x1e1621){return!_[_0x59c5('0x44')](_0x59d66c,_0x1e1621[_0x59c5('0x45')][_0x59c5('0x46')]());})){throw new db['Sequelize'][(_0x59c5('0x33'))](_0x59c5('0x47'));}}}var _0x218de2={};_0x218de2[_0x59c5('0x48')]=_0x1aa987[_0x59c5('0x2f')][_0x59c5('0x30')](_0x59c5('0x48'))?_0x1aa987[_0x59c5('0x2f')]['senderName']:_0x1aa987[_0x59c5('0x49')]['fullname'];_0x218de2[_0x59c5('0x4a')]=_[_0x59c5('0x4b')](_0x1aa987['body'][_0x59c5('0x4a')])?null:_0x1aa987[_0x59c5('0x2f')][_0x59c5('0x4a')];_0x218de2[_0x59c5('0x4c')]=_0x1aa987[_0x59c5('0x2f')][_0x59c5('0x4c')]||![];_0x218de2['SenderId']=_0x1aa987[_0x59c5('0x49')]['id'];return getContent(_0x1aa987[_0x59c5('0x2f')])[_0x59c5('0x29')](function(_0x4a88df){_0x218de2[_0x59c5('0x2f')]=_0x4a88df;return getRecipients(_0x3cb2a2);})[_0x59c5('0x29')](function(_0x3e6b6f){_0x218de2[_0x59c5('0x4d')]=_['sortBy'](_0x3e6b6f)[_0x59c5('0x4e')](',');return db[_0x59c5('0x4f')][_0x59c5('0x50')](function(_0x4fb840){return db[_0x59c5('0x51')][_0x59c5('0x52')](_0x218de2,{'raw':!![],'transaction':_0x4fb840})['then'](function(_0x42a609){var _0x11ff72={'sender':_0x218de2[_0x59c5('0x48')],'description':_0x218de2['recipientsDescription'],'content':_0x218de2[_0x59c5('0x2f')],'beep':_0x218de2[_0x59c5('0x4c')]};_0x3e6b6f['forEach'](function(_0x5596e1){_0x11ff72[_0x59c5('0x53')]=_0x5596e1;socket[_0x59c5('0x54')](_0x59c5('0x55'),_0x11ff72);});return _0x42a609;});});})[_0x59c5('0x29')](respondWithResult(_0x1e7b83,0xc9))[_0x59c5('0x56')](handleError(_0x1e7b83,null));};function getContent(_0x31ce17){return new BPromise(function(_0x11f6bb,_0x42dfad){if(_0x31ce17[_0x59c5('0x57')]){_0x11f6bb(_0x31ce17[_0x59c5('0x57')]);return;}return db[_0x59c5('0x58')][_0x59c5('0x59')]({'attributes':[_0x59c5('0x5a')],'where':{'id':_0x31ce17[_0x59c5('0x31')]},'raw':!![]})['then'](function(_0x3f418d){if(!_0x3f418d)throw new db[(_0x59c5('0x32'))][(_0x59c5('0x33'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x41f3ca=Mustache[_0x59c5('0x5b')](_0x3f418d[_0x59c5('0x5a')],_0x31ce17['view']);_0x11f6bb(_0x41f3ca);})[_0x59c5('0x56')](function(_0xf41471){_0x42dfad(_0xf41471);});});}function getRecipients(_0x2bddb3){return new BPromise(function(_0x5929f6,_0x27b4c6){var _0x521406=[];var _0x223caa=[];_0x2bddb3[_0x59c5('0x5c')](function(_0x31cf29){var _0x479ef6=_[_0x59c5('0x5d')](_0x31cf29[_0x59c5('0x45')][_0x59c5('0x46')]());if(_0x479ef6===_0x59c5('0x5e')){_0x521406=_['union'](_0x521406,_0x31cf29[_0x59c5('0x5f')]);}else{if(_[_0x59c5('0x44')](_0x479ef6,_0x59c5('0x60')))_0x479ef6=_0x479ef6[_0x59c5('0x61')](_0x59c5('0x60'),'Queue');_0x31cf29[_0x59c5('0x5f')][_0x59c5('0x5c')](function(_0x40fe48){_0x223caa[_0x59c5('0x62')](getAgents(_0x479ef6,_0x40fe48));});}});return BPromise[_0x59c5('0x63')](_0x223caa)[_0x59c5('0x29')](function(_0x374d06){_0x521406=_[_0x59c5('0x64')](_0x521406,_['flatten'](_0x374d06));_0x5929f6(_0x521406);})[_0x59c5('0x56')](function(_0x6748db){_0x27b4c6(_0x6748db);});});}function getAgents(_0x19def6,_0x16fe55){return new BPromise(function(_0x1e8cc8,_0x26820d){return db[_0x19def6][_0x59c5('0x59')]({'where':{'id':_0x16fe55}})[_0x59c5('0x29')](function(_0x5b0f57){return _0x5b0f57['getAgents']({'attributes':['id'],'raw':!![]})[_0x59c5('0x29')](function(_0x28715b){var _0x3c0c63=_['map'](_0x28715b,'id');_0x1e8cc8(_0x3c0c63);});})[_0x59c5('0x56')](function(_0x46aeb1){_0x26820d(_0x46aeb1);});});} \ No newline at end of file +var _0x5251=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./userNotification.socket','register','sendStatus','status','offset','limit','undefined','count','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','sendUserNotification','body','text','TemplateId','hasOwnProperty','view','Sequelize','ValidationError','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','mailqueue','openchannelqueue','smsqueue','whatsappqueue','team','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','isEmpty','recipientsDescription','beep','recipientsId','sortBy','join','sequelize','transaction','UserNotification','recipient','emit','userNotification:send','catch','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','forEach','startCase','union','ids','queue','replace','all','flatten','getAgents','map','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x801484,_0x184262){var _0x2ecd18=function(_0x4ee805){while(--_0x4ee805){_0x801484['push'](_0x801484['shift']());}};_0x2ecd18(++_0x184262);}(_0x5251,0x17b));var _0x1525=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x5251[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1525('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1525('0x1'));var moment=require(_0x1525('0x2'));var BPromise=require(_0x1525('0x3'));var Mustache=require(_0x1525('0x4'));var util=require(_0x1525('0x5'));var path=require(_0x1525('0x6'));var sox=require(_0x1525('0x7'));var csv=require(_0x1525('0x8'));var ejs=require(_0x1525('0x9'));var fs=require('fs');var fs_extra=require(_0x1525('0xa'));var _=require(_0x1525('0xb'));var squel=require(_0x1525('0xc'));var crypto=require(_0x1525('0xd'));var jsforce=require(_0x1525('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1525('0xf'));var Papa=require(_0x1525('0x10'));var Redis=require(_0x1525('0x11'));var authService=require(_0x1525('0x12'));var qs=require(_0x1525('0x13'));var as=require(_0x1525('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1525('0x15'))(_0x1525('0x16'));var utils=require(_0x1525('0x17'));var config=require(_0x1525('0x18'));var licenseUtil=require(_0x1525('0x19'));var db=require(_0x1525('0x1a'))['db'];config[_0x1525('0x1b')]=_['defaults'](config[_0x1525('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x1525('0x1c'))(new Redis(config[_0x1525('0x1b')]));require(_0x1525('0x1d'))[_0x1525('0x1e')](socket);function respondWithStatusCode(_0xb3d978,_0x3fcadd){_0x3fcadd=_0x3fcadd||0xcc;return function(_0x205242){if(_0x205242){return _0xb3d978[_0x1525('0x1f')](_0x3fcadd);}return _0xb3d978['status'](_0x3fcadd)['end']();};}function respondWithResult(_0x173700,_0x25bc88){_0x25bc88=_0x25bc88||0xc8;return function(_0x28bec5){if(_0x28bec5){return _0x173700[_0x1525('0x20')](_0x25bc88)['json'](_0x28bec5);}};}function respondWithFilteredResult(_0x399abe,_0x5c0276){return function(_0x3d899b){if(_0x3d899b){var _0x2bde40=typeof _0x5c0276[_0x1525('0x21')]==='undefined'&&typeof _0x5c0276[_0x1525('0x22')]===_0x1525('0x23');var _0x2578c6=_0x3d899b['count'];var _0x426d78=_0x2bde40?0x0:_0x5c0276['offset'];var _0x102046=_0x2bde40?_0x3d899b[_0x1525('0x24')]:_0x5c0276[_0x1525('0x21')]+_0x5c0276[_0x1525('0x22')];var _0x2b6966;if(_0x102046>=_0x2578c6){_0x102046=_0x2578c6;_0x2b6966=0xc8;}else{_0x2b6966=0xce;}_0x399abe[_0x1525('0x20')](_0x2b6966);return _0x399abe['set'](_0x1525('0x25'),_0x426d78+'-'+_0x102046+'/'+_0x2578c6)[_0x1525('0x26')](_0x3d899b);}return null;};}function patchUpdates(_0x24a108){return function(_0x105a28){try{jsonpatch[_0x1525('0x27')](_0x105a28,_0x24a108,!![]);}catch(_0xa07e9b){return BPromise['reject'](_0xa07e9b);}return _0x105a28[_0x1525('0x28')]();};}function saveUpdates(_0x12252f,_0x467bc0){return function(_0x2c8b89){if(_0x2c8b89){return _0x2c8b89[_0x1525('0x29')](_0x12252f)[_0x1525('0x2a')](function(_0x31f661){return _0x31f661;});}return null;};}function removeEntity(_0x8c408b,_0x20074f){return function(_0x5aa4f4){if(_0x5aa4f4){return _0x5aa4f4[_0x1525('0x2b')]()[_0x1525('0x2a')](function(){_0x8c408b[_0x1525('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c77fe,_0x486982){return function(_0x4d1f6f){if(!_0x4d1f6f){_0x4c77fe[_0x1525('0x1f')](0x194);}return _0x4d1f6f;};}function handleError(_0x10f95c,_0x143a51){_0x143a51=_0x143a51||0x1f4;return function(_0x5e8eb6){logger[_0x1525('0x2c')](_0x5e8eb6[_0x1525('0x2d')]);if(_0x5e8eb6[_0x1525('0x2e')]){delete _0x5e8eb6[_0x1525('0x2e')];}_0x10f95c[_0x1525('0x20')](_0x143a51)[_0x1525('0x2f')](_0x5e8eb6);};}exports[_0x1525('0x30')]=function(_0x298d22,_0x5e46e3,_0x48745a){if(!_0x298d22[_0x1525('0x31')]['hasOwnProperty'](_0x1525('0x32'))&&!_0x298d22[_0x1525('0x31')]['hasOwnProperty'](_0x1525('0x33'))){throw new db['Sequelize']['ValidationError']('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x298d22[_0x1525('0x31')][_0x1525('0x34')](_0x1525('0x33'))&&!_0x298d22[_0x1525('0x31')][_0x1525('0x34')](_0x1525('0x35'))){throw new db[(_0x1525('0x36'))][(_0x1525('0x37'))](_0x1525('0x38'));}if(!_0x298d22['body'][_0x1525('0x34')](_0x1525('0x39'))){throw new db[(_0x1525('0x36'))][(_0x1525('0x37'))](_0x1525('0x3a'));}else{try{var _0x4a28c5=JSON[_0x1525('0x3b')](_0x298d22[_0x1525('0x31')][_0x1525('0x39')]);}catch(_0x4e1105){logger[_0x1525('0x2c')](_0x4e1105);throw new db[(_0x1525('0x36'))]['ValidationError']('Invalid\x20\x27recipients\x27\x20object');}var _0x80fdd1=['chatqueue','faxqueue',_0x1525('0x3c'),_0x1525('0x3d'),_0x1525('0x3e'),'voicequeue',_0x1525('0x3f'),_0x1525('0x40'),_0x1525('0x41')];if(_[_0x1525('0x42')](_0x4a28c5,function(_0x578d46){return!_[_0x1525('0x43')](_0x80fdd1,_0x578d46[_0x1525('0x44')][_0x1525('0x45')]());})){throw new db[(_0x1525('0x36'))][(_0x1525('0x37'))](_0x1525('0x46'));}}}var _0x5c55e0={};_0x5c55e0[_0x1525('0x47')]=_0x298d22[_0x1525('0x31')][_0x1525('0x34')](_0x1525('0x47'))?_0x298d22[_0x1525('0x31')][_0x1525('0x47')]:_0x298d22[_0x1525('0x41')][_0x1525('0x48')];_0x5c55e0['recipientsDescription']=_[_0x1525('0x49')](_0x298d22[_0x1525('0x31')][_0x1525('0x4a')])?null:_0x298d22[_0x1525('0x31')][_0x1525('0x4a')];_0x5c55e0[_0x1525('0x4b')]=_0x298d22[_0x1525('0x31')][_0x1525('0x4b')]||![];_0x5c55e0['SenderId']=_0x298d22[_0x1525('0x41')]['id'];return getContent(_0x298d22['body'])[_0x1525('0x2a')](function(_0x9035dd){_0x5c55e0[_0x1525('0x31')]=_0x9035dd;return getRecipients(_0x4a28c5);})[_0x1525('0x2a')](function(_0x574d4){_0x5c55e0[_0x1525('0x4c')]=_[_0x1525('0x4d')](_0x574d4)[_0x1525('0x4e')](',');return db[_0x1525('0x4f')][_0x1525('0x50')](function(_0x50f3c2){return db[_0x1525('0x51')]['create'](_0x5c55e0,{'raw':!![],'transaction':_0x50f3c2})[_0x1525('0x2a')](function(_0x3d9094){var _0x2a97fe={'sender':_0x5c55e0[_0x1525('0x47')],'description':_0x5c55e0['recipientsDescription'],'content':_0x5c55e0['body'],'beep':_0x5c55e0['beep']};_0x574d4['forEach'](function(_0xb4800a){_0x2a97fe[_0x1525('0x52')]=_0xb4800a;socket[_0x1525('0x53')](_0x1525('0x54'),_0x2a97fe);});return _0x3d9094;});});})[_0x1525('0x2a')](respondWithResult(_0x5e46e3,0xc9))[_0x1525('0x55')](handleError(_0x5e46e3,null));};function getContent(_0x294f69){return new BPromise(function(_0x2f1f81,_0xdf38c6){if(_0x294f69[_0x1525('0x32')]){_0x2f1f81(_0x294f69[_0x1525('0x32')]);return;}return db[_0x1525('0x56')][_0x1525('0x57')]({'attributes':[_0x1525('0x58')],'where':{'id':_0x294f69['TemplateId']},'raw':!![]})[_0x1525('0x2a')](function(_0x5e30ae){if(!_0x5e30ae)throw new db['Sequelize'][(_0x1525('0x37'))](_0x1525('0x59'));var _0x490803=Mustache['render'](_0x5e30ae[_0x1525('0x58')],_0x294f69[_0x1525('0x35')]);_0x2f1f81(_0x490803);})[_0x1525('0x55')](function(_0x4140d0){_0xdf38c6(_0x4140d0);});});}function getRecipients(_0x12f0a7){return new BPromise(function(_0x13c33a,_0x21c107){var _0xa9320f=[];var _0x19a6fe=[];_0x12f0a7[_0x1525('0x5a')](function(_0x527fbb){var _0x1ad395=_[_0x1525('0x5b')](_0x527fbb['model']['toLowerCase']());if(_0x1ad395==='User'){_0xa9320f=_[_0x1525('0x5c')](_0xa9320f,_0x527fbb[_0x1525('0x5d')]);}else{if(_[_0x1525('0x43')](_0x1ad395,_0x1525('0x5e')))_0x1ad395=_0x1ad395[_0x1525('0x5f')](_0x1525('0x5e'),'Queue');_0x527fbb[_0x1525('0x5d')][_0x1525('0x5a')](function(_0x224b45){_0x19a6fe['push'](getAgents(_0x1ad395,_0x224b45));});}});return BPromise[_0x1525('0x60')](_0x19a6fe)['then'](function(_0x399a2c){_0xa9320f=_[_0x1525('0x5c')](_0xa9320f,_[_0x1525('0x61')](_0x399a2c));_0x13c33a(_0xa9320f);})[_0x1525('0x55')](function(_0x29ed2d){_0x21c107(_0x29ed2d);});});}function getAgents(_0x944297,_0xeb0175){return new BPromise(function(_0x571af0,_0x8dcd45){return db[_0x944297][_0x1525('0x57')]({'where':{'id':_0xeb0175}})['then'](function(_0x1f32e2){return _0x1f32e2[_0x1525('0x62')]({'attributes':['id'],'raw':!![]})[_0x1525('0x2a')](function(_0x56b322){var _0x513f06=_[_0x1525('0x63')](_0x56b322,'id');_0x571af0(_0x513f06);});})['catch'](function(_0x2dc453){_0x8dcd45(_0x2dc453);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 5c3140f..75b026e 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 _0xa715=['emit','hook','exports','events','setMaxListeners','save','update','remove'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa715,0xcb));var _0x5a71=function(_0x23d116,_0x201fd8){_0x23d116=_0x23d116-0x0;var _0x45cc96=_0xa715[_0x23d116];return _0x45cc96;};'use strict';var EventEmitter=require(_0x5a71('0x0'));var UserNotification=require('../../mysqldb')['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x5a71('0x1')](0x0);var events={'afterCreate':_0x5a71('0x2'),'afterUpdate':_0x5a71('0x3'),'afterDestroy':_0x5a71('0x4')};function emitEvent(_0x3b8b8b){return function(_0xbc24c4,_0x3b1316,_0x2b5af6){UserNotificationEvents[_0x5a71('0x5')](_0x3b8b8b+':'+_0xbc24c4['id'],_0xbc24c4);UserNotificationEvents[_0x5a71('0x5')](_0x3b8b8b,_0xbc24c4);_0x2b5af6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification[_0x5a71('0x6')](e,emitEvent(event));}}module[_0x5a71('0x7')]=UserNotificationEvents; \ No newline at end of file +var _0xa331=['remove','hasOwnProperty','hook','exports','events','../../mysqldb','UserNotification','setMaxListeners','save','update'];(function(_0x20a005,_0x3267c4){var _0x318723=function(_0x4dd1e8){while(--_0x4dd1e8){_0x20a005['push'](_0x20a005['shift']());}};_0x318723(++_0x3267c4);}(_0xa331,0x162));var _0x1a33=function(_0x51dccc,_0x32ec11){_0x51dccc=_0x51dccc-0x0;var _0x44d20e=_0xa331[_0x51dccc];return _0x44d20e;};'use strict';var EventEmitter=require(_0x1a33('0x0'));var UserNotification=require(_0x1a33('0x1'))['db'][_0x1a33('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x1a33('0x3')](0x0);var events={'afterCreate':_0x1a33('0x4'),'afterUpdate':_0x1a33('0x5'),'afterDestroy':_0x1a33('0x6')};function emitEvent(_0x4e43da){return function(_0xa09f41,_0x4c8597,_0x1413cc){UserNotificationEvents['emit'](_0x4e43da+':'+_0xa09f41['id'],_0xa09f41);UserNotificationEvents['emit'](_0x4e43da,_0xa09f41);_0x1413cc(null);};}for(var e in events){if(events[_0x1a33('0x7')](e)){var event=events[e];UserNotification[_0x1a33('0x8')](e,emitEvent(event));}}module[_0x1a33('0x9')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 7e57762..6aaf63a 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 _0x36da=['define','UserNotification','userNotifications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./userNotification.attributes','exports'];(function(_0x1abe62,_0x597003){var _0xc1b000=function(_0x481227){while(--_0x481227){_0x1abe62['push'](_0x1abe62['shift']());}};_0xc1b000(++_0x597003);}(_0x36da,0x154));var _0xa36d=function(_0x301ff3,_0x1ae56e){_0x301ff3=_0x301ff3-0x0;var _0x11f57a=_0x36da[_0x301ff3];return _0x11f57a;};'use strict';var _=require(_0xa36d('0x0'));var util=require(_0xa36d('0x1'));var logger=require(_0xa36d('0x2'))(_0xa36d('0x3'));var moment=require(_0xa36d('0x4'));var BPromise=require(_0xa36d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa36d('0x6'));var rimraf=require(_0xa36d('0x7'));var config=require('../../config/environment');var attributes=require(_0xa36d('0x8'));module[_0xa36d('0x9')]=function(_0x22f112,_0x982041){return _0x22f112[_0xa36d('0xa')](_0xa36d('0xb'),attributes,{'tableName':_0xa36d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xa36d('0xd')});}; \ No newline at end of file +var _0xa222=['UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userNotification.attributes','define'];(function(_0x485201,_0x3c533a){var _0x9ca98a=function(_0x418ef0){while(--_0x418ef0){_0x485201['push'](_0x485201['shift']());}};_0x9ca98a(++_0x3c533a);}(_0xa222,0x1b7));var _0x2a22=function(_0x2074db,_0x10b81b){_0x2074db=_0x2074db-0x0;var _0x27324c=_0xa222[_0x2074db];return _0x27324c;};'use strict';var _=require(_0x2a22('0x0'));var util=require(_0x2a22('0x1'));var logger=require(_0x2a22('0x2'))(_0x2a22('0x3'));var moment=require(_0x2a22('0x4'));var BPromise=require(_0x2a22('0x5'));var rp=require(_0x2a22('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2a22('0x7'));var config=require(_0x2a22('0x8'));var attributes=require(_0x2a22('0x9'));module['exports']=function(_0x131132,_0x2f2ace){return _0x131132[_0x2a22('0xa')](_0x2a22('0xb'),attributes,{'tableName':_0x2a22('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2a22('0xd'),'collate':_0x2a22('0xe')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 47b5fec..01210d7 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 _0x771f=['UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','socket.io-emitter','./userNotification.socket','register','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x34ad37,_0x5ee0dd){var _0x428c43=function(_0x400320){while(--_0x400320){_0x34ad37['push'](_0x34ad37['shift']());}};_0x428c43(++_0x5ee0dd);}(_0x771f,0x10a));var _0xf771=function(_0x5e6fe1,_0x8f80ad){_0x5e6fe1=_0x5e6fe1-0x0;var _0x5a6018=_0x771f[_0x5e6fe1];return _0x5a6018;};'use strict';var _=require('lodash');var util=require(_0xf771('0x0'));var moment=require('moment');var BPromise=require(_0xf771('0x1'));var rs=require(_0xf771('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf771('0x3'))['db'];var utils=require(_0xf771('0x4'));var logger=require(_0xf771('0x5'))(_0xf771('0x6'));var config=require('../../config/environment');var jayson=require(_0xf771('0x7'));var client=jayson[_0xf771('0x8')][_0xf771('0x9')]({'port':0x232a});config['redis']=_[_0xf771('0xa')](config[_0xf771('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xf771('0xc'))(new Redis(config[_0xf771('0xb')]));require(_0xf771('0xd'))[_0xf771('0xe')](socket);function respondWithRpcPromise(_0x524838,_0x3dadb1,_0x2f4156){return new BPromise(function(_0x4c8437,_0x3903e5){return client['request'](_0x524838,_0x2f4156)[_0xf771('0xf')](function(_0x36d4e1){logger[_0xf771('0x10')](_0xf771('0x11'),_0x3dadb1,_0xf771('0x12'));logger[_0xf771('0x13')](_0xf771('0x14'),_0x3dadb1,_0xf771('0x12'),JSON[_0xf771('0x15')](_0x36d4e1));if(_0x36d4e1[_0xf771('0x16')]){if(_0x36d4e1[_0xf771('0x16')][_0xf771('0x17')]===0x1f4){logger['error'](_0xf771('0x11'),_0x3dadb1,_0x36d4e1[_0xf771('0x16')]['message']);return _0x3903e5(_0x36d4e1['error'][_0xf771('0x18')]);}logger[_0xf771('0x16')]('UserNotification,\x20%s,\x20%s',_0x3dadb1,_0x36d4e1['error'][_0xf771('0x18')]);return _0x4c8437(_0x36d4e1[_0xf771('0x16')][_0xf771('0x18')]);}else{logger['info'](_0xf771('0x11'),_0x3dadb1,'request\x20sent');_0x4c8437(_0x36d4e1['result'][_0xf771('0x18')]);}})[_0xf771('0x19')](function(_0x28ef7e){logger[_0xf771('0x16')](_0xf771('0x11'),_0x3dadb1,_0x28ef7e);_0x3903e5(_0x28ef7e);});});} \ No newline at end of file +var _0xebca=['jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./userNotification.socket','request','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','error','message','info','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment'];(function(_0x4e8e68,_0x52a7b8){var _0x3c1398=function(_0x315eb8){while(--_0x315eb8){_0x4e8e68['push'](_0x4e8e68['shift']());}};_0x3c1398(++_0x52a7b8);}(_0xebca,0x161));var _0xaebc=function(_0x2d138a,_0x38524c){_0x2d138a=_0x2d138a-0x0;var _0x1c13e9=_0xebca[_0x2d138a];return _0x1c13e9;};'use strict';var _=require('lodash');var util=require(_0xaebc('0x0'));var moment=require(_0xaebc('0x1'));var BPromise=require('bluebird');var rs=require(_0xaebc('0x2'));var fs=require('fs');var Redis=require(_0xaebc('0x3'));var db=require(_0xaebc('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xaebc('0x5'))('rpc');var config=require(_0xaebc('0x6'));var jayson=require(_0xaebc('0x7'));var client=jayson[_0xaebc('0x8')][_0xaebc('0x9')]({'port':0x232a});config['redis']=_[_0xaebc('0xa')](config[_0xaebc('0xb')],{'host':_0xaebc('0xc'),'port':0x18eb});var socket=require(_0xaebc('0xd'))(new Redis(config['redis']));require(_0xaebc('0xe'))['register'](socket);function respondWithRpcPromise(_0x4f98a9,_0x522834,_0x448924){return new BPromise(function(_0x5b2931,_0x435127){return client[_0xaebc('0xf')](_0x4f98a9,_0x448924)['then'](function(_0x37f459){logger['info'](_0xaebc('0x10'),_0x522834,_0xaebc('0x11'));logger[_0xaebc('0x12')](_0xaebc('0x13'),_0x522834,_0xaebc('0x11'),JSON['stringify'](_0x37f459));if(_0x37f459['error']){if(_0x37f459[_0xaebc('0x14')]['code']===0x1f4){logger[_0xaebc('0x14')](_0xaebc('0x10'),_0x522834,_0x37f459['error'][_0xaebc('0x15')]);return _0x435127(_0x37f459[_0xaebc('0x14')][_0xaebc('0x15')]);}logger[_0xaebc('0x14')](_0xaebc('0x10'),_0x522834,_0x37f459[_0xaebc('0x14')][_0xaebc('0x15')]);return _0x5b2931(_0x37f459['error'][_0xaebc('0x15')]);}else{logger[_0xaebc('0x16')](_0xaebc('0x10'),_0x522834,_0xaebc('0x11'));_0x5b2931(_0x37f459['result'][_0xaebc('0x15')]);}})[_0xaebc('0x17')](function(_0x14666c){logger['error'](_0xaebc('0x10'),_0x522834,_0x14666c);_0x435127(_0x14666c);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 3a28017..4f6ede3 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 _0x751c=['register','length','userNotification:','./userNotification.events','update','emit','removeListener'];(function(_0x57327d,_0x2f45e4){var _0x407d40=function(_0x3afa78){while(--_0x3afa78){_0x57327d['push'](_0x57327d['shift']());}};_0x407d40(++_0x2f45e4);}(_0x751c,0x14c));var _0xc751=function(_0x14b448,_0x36ba95){_0x14b448=_0x14b448-0x0;var _0x1bcd03=_0x751c[_0x14b448];return _0x1bcd03;};'use strict';var UserNotificationEvents=require(_0xc751('0x0'));var events=['save','remove',_0xc751('0x1')];function createListener(_0x914b45,_0x567e0e){return function(_0x435620){_0x567e0e[_0xc751('0x2')](_0x914b45,_0x435620);};}function removeListener(_0x35cb2d,_0x40e9cf){return function(){UserNotificationEvents[_0xc751('0x3')](_0x35cb2d,_0x40e9cf);};}exports[_0xc751('0x4')]=function(_0x1e476f){for(var _0x1af70d=0x0,_0x694572=events[_0xc751('0x5')];_0x1af70d<_0x694572;_0x1af70d++){var _0x424ea9=events[_0x1af70d];var _0x4c5ba3=createListener(_0xc751('0x6')+_0x424ea9,_0x1e476f);UserNotificationEvents['on'](_0x424ea9,_0x4c5ba3);}}; \ No newline at end of file +var _0x8ad1=['length','./userNotification.events','remove','update','emit','removeListener','register'];(function(_0x163c83,_0xb416e4){var _0x290e1b=function(_0x33c2c7){while(--_0x33c2c7){_0x163c83['push'](_0x163c83['shift']());}};_0x290e1b(++_0xb416e4);}(_0x8ad1,0xef));var _0x18ad=function(_0x19074d,_0x2b46d4){_0x19074d=_0x19074d-0x0;var _0xb366a8=_0x8ad1[_0x19074d];return _0xb366a8;};'use strict';var UserNotificationEvents=require(_0x18ad('0x0'));var events=['save',_0x18ad('0x1'),_0x18ad('0x2')];function createListener(_0x1f7c21,_0x253b83){return function(_0x4a2e67){_0x253b83[_0x18ad('0x3')](_0x1f7c21,_0x4a2e67);};}function removeListener(_0x7a7bf6,_0x13e7e4){return function(){UserNotificationEvents[_0x18ad('0x4')](_0x7a7bf6,_0x13e7e4);};}exports[_0x18ad('0x5')]=function(_0xd427d3){for(var _0x2c1f4d=0x0,_0x15f188=events[_0x18ad('0x6')];_0x2c1f4d<_0x15f188;_0x2c1f4d++){var _0x4aa2b5=events[_0x2c1f4d];var _0x4cb786=createListener('userNotification:'+_0x4aa2b5,_0xd427d3);UserNotificationEvents['on'](_0x4aa2b5,_0x4cb786);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index fb3a133..03a72be 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(_0x17346f,_0x322985){var _0x2931b5=function(_0x40d8bd){while(--_0x40d8bd){_0x17346f['push'](_0x17346f['shift']());}};_0x2931b5(++_0x322985);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x580ef3,_0x471646){var _0x46a603=function(_0x39e7e1){while(--_0x39e7e1){_0x580ef3['push'](_0x580ef3['shift']());}};_0x46a603(++_0x471646);}(_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/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 422f9be..dd2626a 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 _0xe57d=['INTEGER','sequelize'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xe57d,0xd7));var _0xde57=function(_0x470252,_0x457603){_0x470252=_0x470252-0x0;var _0xeec8b4=_0xe57d[_0x470252];return _0xeec8b4;};'use strict';var Sequelize=require(_0xde57('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xde57('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x56f3=['INTEGER','exports'];(function(_0x3ed56b,_0x3c85be){var _0x37a5d1=function(_0x11a53e){while(--_0x11a53e){_0x3ed56b['push'](_0x3ed56b['shift']());}};_0x37a5d1(++_0x3c85be);}(_0x56f3,0x87));var _0x356f=function(_0x50384d,_0x3bad82){_0x50384d=_0x50384d-0x0;var _0x2800cf=_0x56f3[_0x50384d];return _0x2800cf;};'use strict';var Sequelize=require('sequelize');module[_0x356f('0x0')]={'penalty':{'type':Sequelize[_0x356f('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 251e530..c017acc 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 _0x3569=['../../config/environment','exports','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x458f22,_0x45d568){var _0x2ffddc=function(_0x37fc21){while(--_0x37fc21){_0x458f22['push'](_0x458f22['shift']());}};_0x2ffddc(++_0x45d568);}(_0x3569,0x88));var _0x9356=function(_0x296754,_0x5befe9){_0x296754=_0x296754-0x0;var _0x1d9f1d=_0x3569[_0x296754];return _0x1d9f1d;};'use strict';var _=require(_0x9356('0x0'));var util=require(_0x9356('0x1'));var logger=require(_0x9356('0x2'))(_0x9356('0x3'));var moment=require('moment');var BPromise=require(_0x9356('0x4'));var rp=require(_0x9356('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9356('0x6'));var config=require(_0x9356('0x7'));var attributes=require('./userOpenchannelQueue.attributes');module[_0x9356('0x8')]=function(_0x4fbc13,_0x294336){return _0x4fbc13['define'](_0x9356('0x9'),attributes,{'tableName':_0x9356('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0f05=['../../config/environment','./userOpenchannelQueue.attributes','define','UserOpenchannelQueue','user_has_openchannel_queues','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x3635ce,_0x33a6f9){var _0x97ecd0=function(_0x123d98){while(--_0x123d98){_0x3635ce['push'](_0x3635ce['shift']());}};_0x97ecd0(++_0x33a6f9);}(_0x0f05,0x101));var _0x50f0=function(_0x207458,_0x1ae671){_0x207458=_0x207458-0x0;var _0x403a53=_0x0f05[_0x207458];return _0x403a53;};'use strict';var _=require('lodash');var util=require(_0x50f0('0x0'));var logger=require('../../config/logger')(_0x50f0('0x1'));var moment=require(_0x50f0('0x2'));var BPromise=require(_0x50f0('0x3'));var rp=require(_0x50f0('0x4'));var fs=require('fs');var path=require(_0x50f0('0x5'));var rimraf=require(_0x50f0('0x6'));var config=require(_0x50f0('0x7'));var attributes=require(_0x50f0('0x8'));module['exports']=function(_0x4c5677,_0x595339){return _0x4c5677[_0x50f0('0x9')](_0x50f0('0xa'),attributes,{'tableName':_0x50f0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index 7fd4a97..da52ec7 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 _0xd4cc=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x366776,_0x48f0bf){var _0x34e2ad=function(_0xb7dfb0){while(--_0xb7dfb0){_0x366776['push'](_0x366776['shift']());}};_0x34e2ad(++_0x48f0bf);}(_0xd4cc,0x8c));var _0xcd4c=function(_0x3e8b65,_0x2a17a9){_0x3e8b65=_0x3e8b65-0x0;var _0x4ca4ed=_0xd4cc[_0x3e8b65];return _0x4ca4ed;};'use strict';var _=require(_0xcd4c('0x0'));var util=require(_0xcd4c('0x1'));var moment=require(_0xcd4c('0x2'));var BPromise=require(_0xcd4c('0x3'));var rs=require(_0xcd4c('0x4'));var fs=require('fs');var Redis=require(_0xcd4c('0x5'));var db=require(_0xcd4c('0x6'))['db'];var utils=require(_0xcd4c('0x7'));var logger=require('../../config/logger')(_0xcd4c('0x8'));var config=require(_0xcd4c('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xcd4c('0xa')][_0xcd4c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x26dc7a,_0xbf292b,_0x2d04e3){return new BPromise(function(_0x14b226,_0x224d82){return client['request'](_0x26dc7a,_0x2d04e3)[_0xcd4c('0xc')](function(_0x419468){logger[_0xcd4c('0xd')](_0xcd4c('0xe'),_0xbf292b,_0xcd4c('0xf'));logger[_0xcd4c('0x10')](_0xcd4c('0x11'),_0xbf292b,'request\x20sent',JSON[_0xcd4c('0x12')](_0x419468));if(_0x419468[_0xcd4c('0x13')]){if(_0x419468['error'][_0xcd4c('0x14')]===0x1f4){logger[_0xcd4c('0x13')](_0xcd4c('0xe'),_0xbf292b,_0x419468['error'][_0xcd4c('0x15')]);return _0x224d82(_0x419468[_0xcd4c('0x13')]['message']);}logger[_0xcd4c('0x13')]('UserOpenchannelQueue,\x20%s,\x20%s',_0xbf292b,_0x419468['error'][_0xcd4c('0x15')]);return _0x14b226(_0x419468[_0xcd4c('0x13')]['message']);}else{logger[_0xcd4c('0xd')]('UserOpenchannelQueue,\x20%s,\x20%s',_0xbf292b,'request\x20sent');_0x14b226(_0x419468[_0xcd4c('0x16')]['message']);}})[_0xcd4c('0x17')](function(_0x3a5600){logger[_0xcd4c('0x13')](_0xcd4c('0xe'),_0xbf292b,_0x3a5600);_0x224d82(_0x3a5600);});});} \ No newline at end of file +var _0xbeee=['../../mysqldb','../../config/utils','../../config/environment','http','request','then','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','code','error','message','info','result','catch','util','bluebird','randomstring','ioredis'];(function(_0x1358cb,_0x127ae3){var _0x8fb368=function(_0x390031){while(--_0x390031){_0x1358cb['push'](_0x1358cb['shift']());}};_0x8fb368(++_0x127ae3);}(_0xbeee,0x1c4));var _0xebee=function(_0x3ddeb5,_0x2603d1){_0x3ddeb5=_0x3ddeb5-0x0;var _0x7d3c48=_0xbeee[_0x3ddeb5];return _0x7d3c48;};'use strict';var _=require('lodash');var util=require(_0xebee('0x0'));var moment=require('moment');var BPromise=require(_0xebee('0x1'));var rs=require(_0xebee('0x2'));var fs=require('fs');var Redis=require(_0xebee('0x3'));var db=require(_0xebee('0x4'))['db'];var utils=require(_0xebee('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xebee('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xebee('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3958e1,_0x84333b,_0x30456c){return new BPromise(function(_0x41a47e,_0x59d65d){return client[_0xebee('0x8')](_0x3958e1,_0x30456c)[_0xebee('0x9')](function(_0x383ab7){logger['info'](_0xebee('0xa'),_0x84333b,_0xebee('0xb'));logger[_0xebee('0xc')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x84333b,_0xebee('0xb'),JSON['stringify'](_0x383ab7));if(_0x383ab7['error']){if(_0x383ab7['error'][_0xebee('0xd')]===0x1f4){logger['error'](_0xebee('0xa'),_0x84333b,_0x383ab7[_0xebee('0xe')][_0xebee('0xf')]);return _0x59d65d(_0x383ab7['error'][_0xebee('0xf')]);}logger[_0xebee('0xe')](_0xebee('0xa'),_0x84333b,_0x383ab7[_0xebee('0xe')]['message']);return _0x41a47e(_0x383ab7[_0xebee('0xe')][_0xebee('0xf')]);}else{logger[_0xebee('0x10')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x84333b,_0xebee('0xb'));_0x41a47e(_0x383ab7[_0xebee('0x11')][_0xebee('0xf')]);}})[_0xebee('0x12')](function(_0x42ecd8){logger[_0xebee('0xe')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x84333b,_0x42ecd8);_0x59d65d(_0x42ecd8);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 228397a..62b5da6 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 _0x0e06=['index','describe','show','/:id/sections','getSections','/:id/resources','getResources','post','addSections','addResources','put','/:id','delete','destroy','removeSections','removeResources','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated'];(function(_0x26bb5e,_0x1319a2){var _0x426d14=function(_0x19bfdc){while(--_0x19bfdc){_0x26bb5e['push'](_0x26bb5e['shift']());}};_0x426d14(++_0x1319a2);}(_0x0e06,0x92));var _0x60e0=function(_0x479a2c,_0x51673b){_0x479a2c=_0x479a2c-0x0;var _0x4d19b0=_0x0e06[_0x479a2c];return _0x4d19b0;};'use strict';var multer=require(_0x60e0('0x0'));var util=require(_0x60e0('0x1'));var path=require(_0x60e0('0x2'));var timeout=require(_0x60e0('0x3'));var express=require('express');var router=express[_0x60e0('0x4')]();var fs_extra=require(_0x60e0('0x5'));var auth=require(_0x60e0('0x6'));var interaction=require(_0x60e0('0x7'));var config=require('../../config/environment');var controller=require('./userProfile.controller');router[_0x60e0('0x8')]('/',auth[_0x60e0('0x9')](),controller[_0x60e0('0xa')]);router[_0x60e0('0x8')]('/describe',auth[_0x60e0('0x9')](),controller[_0x60e0('0xb')]);router['get']('/:id',auth[_0x60e0('0x9')](),controller[_0x60e0('0xc')]);router[_0x60e0('0x8')](_0x60e0('0xd'),auth[_0x60e0('0x9')](),controller[_0x60e0('0xe')]);router[_0x60e0('0x8')](_0x60e0('0xf'),auth[_0x60e0('0x9')](),controller[_0x60e0('0x10')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x60e0('0x11')]('/:id/clone',auth['isAuthenticated'](),controller['clone']);router[_0x60e0('0x11')](_0x60e0('0xd'),auth[_0x60e0('0x9')](),controller[_0x60e0('0x12')]);router[_0x60e0('0x11')](_0x60e0('0xf'),auth[_0x60e0('0x9')](),controller[_0x60e0('0x13')]);router[_0x60e0('0x14')](_0x60e0('0x15'),auth[_0x60e0('0x9')](),controller['update']);router[_0x60e0('0x16')](_0x60e0('0x15'),auth[_0x60e0('0x9')](),controller[_0x60e0('0x17')]);router[_0x60e0('0x16')](_0x60e0('0xd'),auth['isAuthenticated'](),controller[_0x60e0('0x18')]);router[_0x60e0('0x16')](_0x60e0('0xf'),auth[_0x60e0('0x9')](),controller[_0x60e0('0x19')]);module['exports']=router; \ No newline at end of file +var _0x86fa=['getResources','post','create','/:id/clone','clone','addSections','addResources','put','update','/:id/resources','removeResources','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','/:id/sections'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x86fa,0x15c));var _0xa86f=function(_0x33bac3,_0x516d2f){_0x33bac3=_0x33bac3-0x0;var _0x1030ec=_0x86fa[_0x33bac3];return _0x1030ec;};'use strict';var multer=require(_0xa86f('0x0'));var util=require(_0xa86f('0x1'));var path=require(_0xa86f('0x2'));var timeout=require(_0xa86f('0x3'));var express=require(_0xa86f('0x4'));var router=express[_0xa86f('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xa86f('0x6'));var interaction=require(_0xa86f('0x7'));var config=require(_0xa86f('0x8'));var controller=require('./userProfile.controller');router[_0xa86f('0x9')]('/',auth[_0xa86f('0xa')](),controller[_0xa86f('0xb')]);router[_0xa86f('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xa86f('0xc')]);router[_0xa86f('0x9')](_0xa86f('0xd'),auth[_0xa86f('0xa')](),controller[_0xa86f('0xe')]);router[_0xa86f('0x9')](_0xa86f('0xf'),auth[_0xa86f('0xa')](),controller['getSections']);router[_0xa86f('0x9')]('/:id/resources',auth[_0xa86f('0xa')](),controller[_0xa86f('0x10')]);router[_0xa86f('0x11')]('/',auth['isAuthenticated'](),controller[_0xa86f('0x12')]);router['post'](_0xa86f('0x13'),auth[_0xa86f('0xa')](),controller[_0xa86f('0x14')]);router['post']('/:id/sections',auth[_0xa86f('0xa')](),controller[_0xa86f('0x15')]);router[_0xa86f('0x11')]('/:id/resources',auth[_0xa86f('0xa')](),controller[_0xa86f('0x16')]);router[_0xa86f('0x17')](_0xa86f('0xd'),auth['isAuthenticated'](),controller[_0xa86f('0x18')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);router['delete'](_0xa86f('0xf'),auth[_0xa86f('0xa')](),controller['removeSections']);router['delete'](_0xa86f('0x19'),auth['isAuthenticated'](),controller[_0xa86f('0x1a')]);module[_0xa86f('0x1b')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index c2ab9ba..812132d 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 _0x5cf0=['exports','name','STRING','setDataValue','crudPermissions','join','getDataValue','BOOLEAN','sequelize'];(function(_0x20524a,_0x39b6cd){var _0x13f99a=function(_0x2e085f){while(--_0x2e085f){_0x20524a['push'](_0x20524a['shift']());}};_0x13f99a(++_0x39b6cd);}(_0x5cf0,0x1d3));var _0x05cf=function(_0x42df04,_0x17c96d){_0x42df04=_0x42df04-0x0;var _0x83f776=_0x5cf0[_0x42df04];return _0x83f776;};'use strict';var Sequelize=require(_0x05cf('0x0'));module[_0x05cf('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x05cf('0x2')},'crudPermissions':{'type':Sequelize[_0x05cf('0x3')],'set':function(_0x18a725){this[_0x05cf('0x4')](_0x05cf('0x5'),_0x18a725?_0x18a725[_0x05cf('0x6')](''):[]);},'get':function(){return this['getDataValue'](_0x05cf('0x5'))?this[_0x05cf('0x7')]('crudPermissions')['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x05cf('0x3')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x05cf('0x8')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x05cf('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x05cf('0x8')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x05cf('0x8')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x05cf('0x8')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x05cf('0x8')],'defaultValue':!![]}}; \ No newline at end of file +var _0xcc49=['name','crudPermissions','getDataValue','split','BOOLEAN','exports','STRING'];(function(_0x4d07cc,_0x587613){var _0x42de3b=function(_0x201f78){while(--_0x201f78){_0x4d07cc['push'](_0x4d07cc['shift']());}};_0x42de3b(++_0x587613);}(_0xcc49,0x1cc));var _0x9cc4=function(_0x2468b5,_0x506b9e){_0x2468b5=_0x2468b5-0x0;var _0x1056e4=_0xcc49[_0x2468b5];return _0x1056e4;};'use strict';var Sequelize=require('sequelize');module[_0x9cc4('0x0')]={'name':{'type':Sequelize[_0x9cc4('0x1')],'allowNull':![],'unique':_0x9cc4('0x2')},'crudPermissions':{'type':Sequelize[_0x9cc4('0x1')],'set':function(_0x5dd753){this['setDataValue']('crudPermissions',_0x5dd753?_0x5dd753['join'](''):[]);},'get':function(){return this['getDataValue'](_0x9cc4('0x3'))?this[_0x9cc4('0x4')]('crudPermissions')[_0x9cc4('0x5')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x9cc4('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x9cc4('0x6')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x9cc4('0x6')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x9cc4('0x6')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x9cc4('0x6')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x9cc4('0x6')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x9cc4('0x6')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x9cc4('0x6')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 3a90af2..1447006 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 _0x779c=['Dashboard','forEach','resourceId','addResources','transaction','userProfileId','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','update','destroy','then','error','stack','send','map','UserProfile','rawAttributes','key','model','name','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','type','options','include','rows','catch','show','params','merge','find','create','body','clone','includeAll','omit','createdAt','updatedAt','crudPermissions','get','UserProfileSection','findAll','each','autoAssociation','sectionId','UserProfileResource','Resources','describe','sequelize','push','ids','enabled','subsections','includes','concat','findOne'];(function(_0x1d470a,_0x4ef470){var _0x5cde4e=function(_0x1e96aa){while(--_0x1e96aa){_0x1d470a['push'](_0x1d470a['shift']());}};_0x5cde4e(++_0x4ef470);}(_0x779c,0x159));var _0xc779=function(_0x38e054,_0x5cced7){_0x38e054=_0x38e054-0x0;var _0x118961=_0x779c[_0x38e054];return _0x118961;};'use strict';var emlformat=require(_0xc779('0x0'));var rimraf=require(_0xc779('0x1'));var zipdir=require(_0xc779('0x2'));var jsonpatch=require(_0xc779('0x3'));var rp=require(_0xc779('0x4'));var moment=require(_0xc779('0x5'));var BPromise=require(_0xc779('0x6'));var Mustache=require(_0xc779('0x7'));var util=require(_0xc779('0x8'));var path=require(_0xc779('0x9'));var sox=require('sox');var csv=require(_0xc779('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc779('0xb'));var _=require(_0xc779('0xc'));var squel=require(_0xc779('0xd'));var crypto=require(_0xc779('0xe'));var jsforce=require(_0xc779('0xf'));var deskjs=require(_0xc779('0x10'));var toCsv=require('to-csv');var querystring=require(_0xc779('0x11'));var Papa=require('papaparse');var Redis=require(_0xc779('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xc779('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc779('0x14'));var logger=require('../../config/logger')(_0xc779('0x15'));var utils=require('../../config/utils');var config=require(_0xc779('0x16'));var licenseUtil=require(_0xc779('0x17'));var db=require(_0xc779('0x18'))['db'];config[_0xc779('0x19')]=_['defaults'](config['redis'],{'host':_0xc779('0x1a'),'port':0x18eb});var socket=require(_0xc779('0x1b'))(new Redis(config[_0xc779('0x19')]));require(_0xc779('0x1c'))[_0xc779('0x1d')](socket);function respondWithStatusCode(_0x40d158,_0x1ae41a){_0x1ae41a=_0x1ae41a||0xcc;return function(_0x4e1316){if(_0x4e1316){return _0x40d158[_0xc779('0x1e')](_0x1ae41a);}return _0x40d158['status'](_0x1ae41a)[_0xc779('0x1f')]();};}function respondWithResult(_0x36850c,_0x539739){_0x539739=_0x539739||0xc8;return function(_0x598af0){if(_0x598af0){return _0x36850c[_0xc779('0x20')](_0x539739)[_0xc779('0x21')](_0x598af0);}};}function respondWithFilteredResult(_0x318796,_0x1f82e9){return function(_0x1cd964){if(_0x1cd964){var _0xbe72d6=typeof _0x1f82e9[_0xc779('0x22')]==='undefined'&&typeof _0x1f82e9[_0xc779('0x23')]===_0xc779('0x24');var _0x2e2f9e=_0x1cd964[_0xc779('0x25')];var _0x4af88a=_0xbe72d6?0x0:_0x1f82e9[_0xc779('0x22')];var _0x1055e9=_0xbe72d6?_0x1cd964[_0xc779('0x25')]:_0x1f82e9[_0xc779('0x22')]+_0x1f82e9['limit'];var _0x993084;if(_0x1055e9>=_0x2e2f9e){_0x1055e9=_0x2e2f9e;_0x993084=0xc8;}else{_0x993084=0xce;}_0x318796[_0xc779('0x20')](_0x993084);return _0x318796[_0xc779('0x26')](_0xc779('0x27'),_0x4af88a+'-'+_0x1055e9+'/'+_0x2e2f9e)[_0xc779('0x21')](_0x1cd964);}return null;};}function patchUpdates(_0x249c60){return function(_0x5f299a){try{jsonpatch['apply'](_0x5f299a,_0x249c60,!![]);}catch(_0x58da44){return BPromise['reject'](_0x58da44);}return _0x5f299a['save']();};}function saveUpdates(_0x56652c,_0x3a185f){return function(_0x1a82cc){if(_0x1a82cc){return _0x1a82cc[_0xc779('0x28')](_0x56652c)['then'](function(_0x47f66d){return _0x47f66d;});}return null;};}function removeEntity(_0x1c394f,_0x1c67f5){return function(_0x5df11c){if(_0x5df11c){return _0x5df11c[_0xc779('0x29')]()[_0xc779('0x2a')](function(){_0x1c394f[_0xc779('0x20')](0xcc)[_0xc779('0x1f')]();});}};}function handleEntityNotFound(_0x418da1,_0x512d99){return function(_0x3c0f54){if(!_0x3c0f54){_0x418da1['sendStatus'](0x194);}return _0x3c0f54;};}function handleError(_0x2eaa24,_0xa13393){_0xa13393=_0xa13393||0x1f4;return function(_0x171dd5){logger[_0xc779('0x2b')](_0x171dd5[_0xc779('0x2c')]);if(_0x171dd5['name']){delete _0x171dd5['name'];}_0x2eaa24['status'](_0xa13393)[_0xc779('0x2d')](_0x171dd5);};}exports['index']=function(_0xa39996,_0x51d9bf){var _0xdf7f70={},_0x2cbf7e={},_0x448273={'count':0x0,'rows':[]};var _0x2695b0=_[_0xc779('0x2e')](db[_0xc779('0x2f')][_0xc779('0x30')],function(_0x5e98d8){return{'name':_0x5e98d8['fieldName'],'type':_0x5e98d8['type'][_0xc779('0x31')]};});_0x2cbf7e[_0xc779('0x32')]=_[_0xc779('0x2e')](_0x2695b0,_0xc779('0x33'));_0x2cbf7e[_0xc779('0x34')]=_[_0xc779('0x35')](_0xa39996[_0xc779('0x34')]);_0x2cbf7e['filters']=_[_0xc779('0x36')](_0x2cbf7e[_0xc779('0x32')],_0x2cbf7e['query']);_0xdf7f70['attributes']=_['intersection'](_0x2cbf7e[_0xc779('0x32')],qs[_0xc779('0x37')](_0xa39996['query'][_0xc779('0x37')]));_0xdf7f70[_0xc779('0x38')]=_0xdf7f70[_0xc779('0x38')][_0xc779('0x39')]?_0xdf7f70[_0xc779('0x38')]:_0x2cbf7e['model'];if(!_0xa39996['query'][_0xc779('0x3a')]('nolimit')){_0xdf7f70['limit']=qs[_0xc779('0x23')](_0xa39996[_0xc779('0x34')][_0xc779('0x23')]);_0xdf7f70[_0xc779('0x22')]=qs[_0xc779('0x22')](_0xa39996['query'][_0xc779('0x22')]);}_0xdf7f70[_0xc779('0x3b')]=qs['sort'](_0xa39996['query'][_0xc779('0x3c')]);_0xdf7f70[_0xc779('0x3d')]=qs[_0xc779('0x3e')](_[_0xc779('0x3f')](_0xa39996[_0xc779('0x34')],_0x2cbf7e[_0xc779('0x3e')]),_0x2695b0);if(_0xa39996['query'][_0xc779('0x40')]){_0xdf7f70[_0xc779('0x3d')]=_['merge'](_0xdf7f70[_0xc779('0x3d')],{'$or':_[_0xc779('0x2e')](_0x2695b0,function(_0x59cf1c){if(_0x59cf1c[_0xc779('0x41')]!=='VIRTUAL'){var _0x2ecfc9={};_0x2ecfc9[_0x59cf1c[_0xc779('0x33')]]={'$like':'%'+_0xa39996[_0xc779('0x34')]['filter']+'%'};return _0x2ecfc9;}})});}_0xdf7f70=_['merge']({},_0xdf7f70,_0xa39996[_0xc779('0x42')]);var _0x538701={'where':_0xdf7f70['where']};return db['UserProfile']['count'](_0x538701)[_0xc779('0x2a')](function(_0x3091bd){_0x448273[_0xc779('0x25')]=_0x3091bd;if(_0xa39996[_0xc779('0x34')]['includeAll']){_0xdf7f70[_0xc779('0x43')]=[{'all':!![]}];}return db[_0xc779('0x2f')]['findAll'](_0xdf7f70);})[_0xc779('0x2a')](function(_0x5f2352){_0x448273[_0xc779('0x44')]=_0x5f2352;return _0x448273;})['then'](respondWithFilteredResult(_0x51d9bf,_0xdf7f70))[_0xc779('0x45')](handleError(_0x51d9bf,null));};exports[_0xc779('0x46')]=function(_0xb74b23,_0x3fcf18){var _0x57ee3c={'raw':![],'where':{'id':_0xb74b23[_0xc779('0x47')]['id']}},_0x283b07={};_0x283b07['model']=_[_0xc779('0x35')](db[_0xc779('0x2f')][_0xc779('0x30')]);_0x283b07['query']=_[_0xc779('0x35')](_0xb74b23[_0xc779('0x34')]);_0x283b07[_0xc779('0x3e')]=_[_0xc779('0x36')](_0x283b07[_0xc779('0x32')],_0x283b07[_0xc779('0x34')]);_0x57ee3c['attributes']=_[_0xc779('0x36')](_0x283b07[_0xc779('0x32')],qs[_0xc779('0x37')](_0xb74b23[_0xc779('0x34')][_0xc779('0x37')]));_0x57ee3c[_0xc779('0x38')]=_0x57ee3c['attributes'][_0xc779('0x39')]?_0x57ee3c[_0xc779('0x38')]:_0x283b07['model'];if(_0xb74b23['query']['includeAll']){_0x57ee3c[_0xc779('0x43')]=[{'all':!![]}];}_0x57ee3c=_[_0xc779('0x48')]({},_0x57ee3c,_0xb74b23['options']);return db[_0xc779('0x2f')][_0xc779('0x49')](_0x57ee3c)['then'](handleEntityNotFound(_0x3fcf18,null))[_0xc779('0x2a')](respondWithResult(_0x3fcf18,null))[_0xc779('0x45')](handleError(_0x3fcf18,null));};exports[_0xc779('0x4a')]=function(_0xf6df7e,_0x4d68a5){return db['UserProfile'][_0xc779('0x4a')](_0xf6df7e[_0xc779('0x4b')],{})[_0xc779('0x2a')](respondWithResult(_0x4d68a5,0xc9))['catch'](handleError(_0x4d68a5,null));};exports[_0xc779('0x4c')]=function(_0x584c6f,_0x285150){var _0x438004={'where':{'id':_0x584c6f[_0xc779('0x47')]['id']}},_0x14a459={};_0x14a459[_0xc779('0x32')]=_[_0xc779('0x35')](db['UserProfile'][_0xc779('0x30')]);_0x438004[_0xc779('0x38')]=_[_0xc779('0x36')](_0x14a459[_0xc779('0x32')],qs[_0xc779('0x37')](_0x584c6f[_0xc779('0x34')][_0xc779('0x37')]));_0x438004[_0xc779('0x38')]=_0x438004['attributes'][_0xc779('0x39')]?_0x438004[_0xc779('0x38')]:_0x14a459[_0xc779('0x32')];if(_0x584c6f[_0xc779('0x34')][_0xc779('0x4d')]){_0x438004[_0xc779('0x43')]=[{'all':!![]}];}_0x438004=_['merge']({},_0x438004,_0x584c6f[_0xc779('0x42')]);return db[_0xc779('0x2f')][_0xc779('0x49')](_0x438004)['then'](handleEntityNotFound(_0x285150,null))[_0xc779('0x2a')](function(_0x25c412){if(_0x25c412){var _0x147fdc=_0x25c412['get']({'plain':!![]});_0x147fdc=qs[_0xc779('0x4e')](_0x147fdc,['id',_0xc779('0x4f'),_0xc779('0x50'),_0xc779('0x51')]);_0x584c6f[_0xc779('0x4b')]=_['omit'](_0x584c6f[_0xc779('0x4b')],['id',_0xc779('0x4f'),_0xc779('0x50')]);return db['sequelize']['transaction'](function(_0x5bf921){return db[_0xc779('0x2f')][_0xc779('0x4a')](_[_0xc779('0x48')](_0x147fdc,_0x584c6f['body']),{'include':_0x584c6f[_0xc779('0x34')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x5bf921})[_0xc779('0x2a')](function(_0x16031c){var _0x301622=_0x16031c[_0xc779('0x52')]({'plain':!![]});return db[_0xc779('0x53')][_0xc779('0x54')]({'where':{'userProfileId':_0x584c6f[_0xc779('0x47')]['id']},'raw':!![]})[_0xc779('0x2a')](function(_0x57a573){if(_0x57a573){return BPromise[_0xc779('0x55')](_0x57a573,function(_0x4e6a3a){return new BPromise(function(_0x5f1619,_0x3323c8){if(_0x4e6a3a[_0xc779('0x56')]===null||_0x4e6a3a[_0xc779('0x56')]===0x1)_0x5f1619(null);return db['UserProfileResource'][_0xc779('0x54')]({'where':{'sectionId':_0x4e6a3a['id']},'raw':!![]})['then'](function(_0x3768f0){var _0x53d475=_['map'](_0x3768f0,function(_0x9d27df){return qs[_0xc779('0x4e')](_0x9d27df,['id',_0xc779('0x4f'),'updatedAt',_0xc779('0x57')]);});_0x5f1619(_0x53d475);})['catch'](function(_0x28da26){_0x3323c8(_0x28da26);});})[_0xc779('0x2a')](function(_0x2a9bf9){var _0x53e571=qs[_0xc779('0x4e')](_0x4e6a3a,['id',_0xc779('0x4f'),_0xc779('0x50')]);_0x53e571['userProfileId']=_0x301622['id'];if(_0x2a9bf9)_0x53e571['Resources']=_0x2a9bf9;return _0x53e571;})[_0xc779('0x2a')](function(_0x190b3a){return db['UserProfileSection'][_0xc779('0x4a')](_0x190b3a,{'include':[{'model':db[_0xc779('0x58')],'as':_0xc779('0x59')}],'raw':!![],'transaction':_0x5bf921});});})[_0xc779('0x2a')](function(){return _0x301622;});}});});});}})['then'](respondWithResult(_0x285150,0xc9))[_0xc779('0x45')](handleError(_0x285150,null));};exports[_0xc779('0x28')]=function(_0x296246,_0x1f64b3){if(_0x296246[_0xc779('0x4b')]['id']){delete _0x296246[_0xc779('0x4b')]['id'];}return db['UserProfile'][_0xc779('0x49')]({'where':{'id':_0x296246[_0xc779('0x47')]['id']}})[_0xc779('0x2a')](handleEntityNotFound(_0x1f64b3,null))[_0xc779('0x2a')](saveUpdates(_0x296246[_0xc779('0x4b')],null))[_0xc779('0x2a')](respondWithResult(_0x1f64b3,null))[_0xc779('0x45')](handleError(_0x1f64b3,null));};exports[_0xc779('0x29')]=function(_0x3dabd5,_0x36fba0){return db[_0xc779('0x2f')][_0xc779('0x49')]({'where':{'id':_0x3dabd5[_0xc779('0x47')]['id']}})[_0xc779('0x2a')](handleEntityNotFound(_0x36fba0,null))['then'](removeEntity(_0x36fba0,null))[_0xc779('0x45')](handleError(_0x36fba0,null));};exports[_0xc779('0x5a')]=function(_0x44f3df,_0x321b6c){return db['UserProfile'][_0xc779('0x5a')]()[_0xc779('0x2a')](respondWithResult(_0x321b6c,null))[_0xc779('0x45')](handleError(_0x321b6c,null));};exports['addSections']=function(_0x4a64c0,_0x478480){var _0x135d5f=_0x4a64c0[_0xc779('0x4b')];return db[_0xc779('0x2f')][_0xc779('0x49')]({'where':{'id':_0x4a64c0[_0xc779('0x47')]['id']}})[_0xc779('0x2a')](handleEntityNotFound(_0x478480,null))[_0xc779('0x2a')](function(_0x44057e){if(_0x44057e){return db[_0xc779('0x5b')]['transaction'](function(_0x51fe5b){return db[_0xc779('0x53')][_0xc779('0x29')]({'where':{'userProfileId':_0x4a64c0['params']['id'],'sectionId':_[_0xc779('0x2e')](_0x135d5f,function(_0x1d0e7e){return _0x1d0e7e['sectionId'];})},'transaction':_0x51fe5b})['then'](function(){var _0x36d915=_[_0xc779('0x2e')](_0x135d5f,function(_0x383a2b){_0x383a2b['userProfileId']=_0x4a64c0[_0xc779('0x47')]['id'];return _0x383a2b;});var _0x30219f=[];return BPromise[_0xc779('0x55')](_0x36d915,function(_0x2f03ea){return db[_0xc779('0x53')][_0xc779('0x4a')](_0x2f03ea,{'include':[{'model':db['UserProfileResource'],'as':_0xc779('0x59')}],'raw':!![],'transaction':_0x51fe5b})[_0xc779('0x2a')](function(_0x2ef7f3){_0x30219f[_0xc779('0x5c')](_0x2ef7f3[_0xc779('0x52')]({'plain':!![]}));});})[_0xc779('0x2a')](function(){return _0x30219f;});});});}})['then'](function(_0x24b8c2){return _0x24b8c2;})[_0xc779('0x2a')](respondWithResult(_0x478480,null))['catch'](handleError(_0x478480,null));};exports['removeSections']=function(_0x4e5fb9,_0x25144a){var _0x1fc825;return db[_0xc779('0x2f')][_0xc779('0x49')]({'where':{'id':_0x4e5fb9[_0xc779('0x47')]['id']},'attributes':['id',_0xc779('0x33')]})[_0xc779('0x2a')](handleEntityNotFound(_0x25144a,null))['then'](function(_0x76b747){if(_0x76b747){_0x1fc825=_0x76b747;return db['UserProfileSection'][_0xc779('0x29')]({'where':{'userProfileId':_0x4e5fb9[_0xc779('0x47')]['id'],'sectionId':_0x4e5fb9[_0xc779('0x34')][_0xc779('0x5d')]}});}})[_0xc779('0x2a')](function(){return _0x1fc825;})[_0xc779('0x2a')](respondWithStatusCode(_0x25144a,null))[_0xc779('0x45')](handleError(_0x25144a,null));};exports['getSections']=function(_0x7f4173,_0xe62a50){var _0x57286d=[];var _0x2f91e0=[];return db[_0xc779('0x53')][_0xc779('0x54')]({'where':{'userProfileId':_0x7f4173[_0xc779('0x47')]['id']},'raw':!![]})[_0xc779('0x2a')](function(_0x2395c9){_0x57286d=_[_0xc779('0x40')](_0x2395c9,function(_0x39afc4){return _0x39afc4[_0xc779('0x5e')]===0x1||_['includes']([0x3eb,0x709],_0x39afc4[_0xc779('0x57')]);});if(!_['isEmpty'](_0x57286d)){return _[_0xc779('0x2e')](_0x57286d,function(_0x598e87){return _0x598e87[_0xc779('0x57')];});}else{return;}})[_0xc779('0x2a')](function(_0x2e37e1){if(_0x2e37e1)_0x2f91e0=_0x2e37e1;if(_['includes'](_0x2f91e0,0x64)){var _0x4f57dc=_['find'](_0x57286d,{'sectionId':0x64});return hasDefaultDashboard(_0x4f57dc)[_0xc779('0x2a')](function(_0x567943){return _[_0xc779('0x2e')](_0x57286d,function(_0x45101b){if(_0x45101b[_0xc779('0x57')]===0x64){_0x45101b[_0xc779('0x5f')]=_0x567943;}return _0x45101b;});});}else{return;}})[_0xc779('0x2a')](function(_0x546299){if(_0x546299)_0x57286d=_0x546299;if(_[_0xc779('0x60')](_0x2f91e0,0x3eb)){var _0x2e5c98=_['find'](_0x57286d,{'sectionId':0x3eb});return getCustomDashboards(_0x2e5c98)[_0xc779('0x2a')](function(_0x5128e1){return _[_0xc779('0x2e')](_0x57286d,function(_0x29638f){if(_0x2e5c98['enabled']){if(_0x29638f[_0xc779('0x57')]===0x3eb){_0x29638f[_0xc779('0x5f')]=_0x5128e1;}}else{if(_0x29638f['sectionId']===0x64){if(!_0x29638f['subsections']){_0x29638f['subsections']=[];}_0x29638f[_0xc779('0x5f')]=_0x29638f[_0xc779('0x5f')][_0xc779('0x61')](_0x5128e1);}}return _0x29638f;});});}else{return;}})['then'](function(_0x2ee409){if(_0x2ee409)_0x57286d=_0x2ee409;if(_[_0xc779('0x60')](_0x2f91e0,0x709)){var _0x238030=_[_0xc779('0x49')](_0x57286d,{'sectionId':0x709});return getPlugins(_0x238030)['then'](function(_0x395c9e){if(_0x238030[_0xc779('0x5e')]){return _['map'](_0x57286d,function(_0x2b08a6){if(_0x2b08a6[_0xc779('0x57')]===0x709){_0x2b08a6[_0xc779('0x5f')]=_0x395c9e;}return _0x2b08a6;});}else{var _0x114638={'sectionId':0x76c,'enabled':0x1,'subsections':_0x395c9e};var _0x21b80c=_['map'](_0x57286d);_0x21b80c[_0xc779('0x5c')](_0x114638);return _0x21b80c;}});}else{return;}})[_0xc779('0x2a')](function(_0x2db4cb){if(_0x2db4cb)_0x57286d=_0x2db4cb;return _[_0xc779('0x40')](_0x57286d,[_0xc779('0x5e'),0x1]);})[_0xc779('0x2a')](respondWithResult(_0xe62a50,null))[_0xc779('0x45')](handleError(_0xe62a50,null));};function hasDefaultDashboard(_0x3535d9){var _0x167ce0=[0x65];return new BPromise(function(_0x3be12a,_0x248bdc){try{if(_0x3535d9[_0xc779('0x56')]){_0x3be12a(_0x167ce0);}else{return db['UserProfileResource'][_0xc779('0x62')]({'where':{'sectionId':_0x3535d9['id']},'raw':!![]})[_0xc779('0x2a')](function(_0x1337f3){_0x1337f3?_0x3be12a(_0x167ce0):_0x3be12a();});}}catch(_0x3daaf8){_0x248bdc(_0x3daaf8);}});}function getCustomDashboards(_0x2a36bf){var _0x25f8cb=[];return new BPromise(function(_0x418c12,_0x49f0bc){try{if(_0x2a36bf['autoAssociation']){return db[_0xc779('0x63')][_0xc779('0x54')]({'raw':!![]})[_0xc779('0x2a')](function(_0x233bd4){_0x233bd4[_0xc779('0x64')](function(_0xed8e3){_0x25f8cb['push'](_0xed8e3['id']+0x1869f);});_0x418c12(_0x25f8cb);});}else{return db[_0xc779('0x58')][_0xc779('0x54')]({'where':{'sectionId':_0x2a36bf['id']},'raw':!![]})['then'](function(_0x6e37d7){_0x6e37d7[_0xc779('0x64')](function(_0x5706be){_0x25f8cb[_0xc779('0x5c')](_0x5706be[_0xc779('0x65')]+0x1869f);});_0x418c12(_0x25f8cb);});}}catch(_0x253f47){_0x49f0bc(_0x253f47);}});}function getPlugins(_0x22c2d8){var _0x4f6690=[];return new BPromise(function(_0x2f1963,_0x15ce0e){try{if(_0x22c2d8[_0xc779('0x56')]){return db['Plugin'][_0xc779('0x54')]({'raw':!![]})[_0xc779('0x2a')](function(_0x206f4c){_0x206f4c['forEach'](function(_0x7fe2a1){_0x4f6690['push'](_0x7fe2a1['id']+0x15b38);});_0x2f1963(_0x4f6690);});}else{return db[_0xc779('0x58')][_0xc779('0x54')]({'where':{'sectionId':_0x22c2d8['id']},'raw':!![]})[_0xc779('0x2a')](function(_0x4d3eb6){_0x4d3eb6['forEach'](function(_0x161a60){_0x4f6690[_0xc779('0x5c')](_0x161a60[_0xc779('0x65')]+0x15b38);});_0x2f1963(_0x4f6690);});}}catch(_0xa8777c){_0x15ce0e(_0xa8777c);}});}exports[_0xc779('0x66')]=function(_0x1be9c0,_0x389c8f){return db[_0xc779('0x2f')][_0xc779('0x49')]({'where':{'id':_0x1be9c0[_0xc779('0x47')]['id']}})[_0xc779('0x2a')](handleEntityNotFound(_0x389c8f,null))[_0xc779('0x2a')](function(_0x4fd050){if(_0x4fd050){return db[_0xc779('0x5b')][_0xc779('0x67')](function(_0x3195a0){return db[_0xc779('0x53')][_0xc779('0x54')]({'where':{'userProfileId':_0x1be9c0[_0xc779('0x47')]['id']},'attributes':['id'],'raw':!![]})[_0xc779('0x2a')](function(_0x2d3460){if(_0x2d3460){return db[_0xc779('0x53')][_0xc779('0x29')]({'where':{'userProfileId':_0x1be9c0[_0xc779('0x47')]['id'],'id':_[_0xc779('0x2e')](_0x2d3460,function(_0x5337d8){return _0x5337d8['id'];})},'transaction':_0x3195a0});}})[_0xc779('0x2a')](function(_0x1e927a){var _0x36f919=_[_0xc779('0x2e')](_0x1be9c0[_0xc779('0x4b')],function(_0x40b2b8){_0x40b2b8[_0xc779('0x68')]=_0x1be9c0['params']['id'];return _0x40b2b8;});return db[_0xc779('0x53')][_0xc779('0x69')](_0x36f919,{'raw':!![],'transaction':_0x3195a0});})[_0xc779('0x2a')](function(_0x412730){var _0x32c237=_[_0xc779('0x40')](_[_0xc779('0x2e')](_0x412730,function(_0x34bbca){return _0x34bbca[_0xc779('0x52')]({'plain':!![]});}),{'includeAll':![]});if(_0x32c237){return db['UserProfileSection'][_0xc779('0x54')]({'where':{'userProfileId':_0x1be9c0[_0xc779('0x47')]['id'],'sectionId':_[_0xc779('0x2e')](_0x32c237,function(_0x24b77d){return _0x24b77d[_0xc779('0x57')];})},'attributes':['id',_0xc779('0x57')],'raw':!![]})['then'](function(_0x5c7227){var _0x54957b=_['map'](_0x1be9c0[_0xc779('0x4b')],function(_0x415d90){_0x415d90[_0xc779('0x68')]=_0x1be9c0[_0xc779('0x47')]['id'];return _0x415d90;});return db[_0xc779('0x58')]['bulkCreate'](_0x54957b,{'raw':!![],'transaction':_0x3195a0});});}})[_0xc779('0x45')](handleError(_0x389c8f,null));});}})[_0xc779('0x2a')](function(_0x4b92aa){var _0x7cb765=_[_0xc779('0x2e')](_0x4b92aa,function(_0x3912f8){return _0x3912f8[_0xc779('0x52')]({'plain':!![]});});})[_0xc779('0x2a')](respondWithResult(_0x389c8f,null))[_0xc779('0x45')](handleError(_0x389c8f,null));};exports[_0xc779('0x6a')]=function(_0x401154,_0x20e36a,_0x3f173b){return db[_0xc779('0x2f')]['find']({'where':{'id':_0x401154[_0xc779('0x47')]['id']}})[_0xc779('0x2a')](handleEntityNotFound(_0x20e36a,null))[_0xc779('0x2a')](function(_0xbb9966){if(_0xbb9966){return _0xbb9966[_0xc779('0x6a')](_0x401154[_0xc779('0x34')][_0xc779('0x5d')]);}})[_0xc779('0x2a')](respondWithStatusCode(_0x20e36a,null))['catch'](handleError(_0x20e36a,null));};exports[_0xc779('0x6b')]=function(_0x5327a1,_0x34e6a9){var _0x35230f={};if(!_0x5327a1[_0xc779('0x34')][_0xc779('0x6c')])throw new Error(_0xc779('0x6d'));if(!_0x5327a1[_0xc779('0x34')][_0xc779('0x3a')]('nolimit')){_0x35230f[_0xc779('0x23')]=qs[_0xc779('0x23')](_0x5327a1[_0xc779('0x34')][_0xc779('0x23')]);_0x35230f[_0xc779('0x22')]=qs[_0xc779('0x22')](_0x5327a1[_0xc779('0x34')][_0xc779('0x22')]);}return db[_0xc779('0x2f')][_0xc779('0x49')]({'where':{'id':_0x5327a1[_0xc779('0x47')]['id']}})[_0xc779('0x2a')](function(_0x141376){if(!_0x141376)throw new Error(_0xc779('0x6e')+_0x5327a1[_0xc779('0x47')]['id']);return db[_0xc779('0x2f')][_0xc779('0x6b')](_0x5327a1);})['then'](respondWithFilteredResult(_0x34e6a9,_0x35230f))[_0xc779('0x45')](handleError(_0x34e6a9,null));}; \ No newline at end of file +var _0x2d5d=['name','send','UserProfile','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','map','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','find','create','body','clone','omit','crudPermissions','createdAt','updatedAt','sequelize','transaction','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','describe','addSections','UserProfileSection','push','get','removeSections','ids','getSections','enabled','includes','isEmpty','subsections','concat','findOne','Dashboard','forEach','Plugin','resourceId','addResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','getResources','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack'];(function(_0x17af1e,_0x1716d7){var _0x32a1cc=function(_0x476bae){while(--_0x476bae){_0x17af1e['push'](_0x17af1e['shift']());}};_0x32a1cc(++_0x1716d7);}(_0x2d5d,0xbe));var _0xd2d5=function(_0x43e4cd,_0x2e2ece){_0x43e4cd=_0x43e4cd-0x0;var _0x47b42f=_0x2d5d[_0x43e4cd];return _0x47b42f;};'use strict';var emlformat=require(_0xd2d5('0x0'));var rimraf=require(_0xd2d5('0x1'));var zipdir=require(_0xd2d5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd2d5('0x3'));var moment=require(_0xd2d5('0x4'));var BPromise=require(_0xd2d5('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd2d5('0x6'));var sox=require(_0xd2d5('0x7'));var csv=require(_0xd2d5('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd2d5('0x9'));var _=require(_0xd2d5('0xa'));var squel=require(_0xd2d5('0xb'));var crypto=require(_0xd2d5('0xc'));var jsforce=require(_0xd2d5('0xd'));var deskjs=require(_0xd2d5('0xe'));var toCsv=require(_0xd2d5('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd2d5('0xf'));var authService=require(_0xd2d5('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xd2d5('0x11'));var hardwareService=require(_0xd2d5('0x12'));var logger=require(_0xd2d5('0x13'))(_0xd2d5('0x14'));var utils=require(_0xd2d5('0x15'));var config=require(_0xd2d5('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xd2d5('0x17'))['db'];config[_0xd2d5('0x18')]=_[_0xd2d5('0x19')](config[_0xd2d5('0x18')],{'host':_0xd2d5('0x1a'),'port':0x18eb});var socket=require(_0xd2d5('0x1b'))(new Redis(config[_0xd2d5('0x18')]));require(_0xd2d5('0x1c'))[_0xd2d5('0x1d')](socket);function respondWithStatusCode(_0x17b2c0,_0x326c94){_0x326c94=_0x326c94||0xcc;return function(_0x37b5c2){if(_0x37b5c2){return _0x17b2c0[_0xd2d5('0x1e')](_0x326c94);}return _0x17b2c0[_0xd2d5('0x1f')](_0x326c94)[_0xd2d5('0x20')]();};}function respondWithResult(_0x5f230a,_0x34e052){_0x34e052=_0x34e052||0xc8;return function(_0x43240b){if(_0x43240b){return _0x5f230a['status'](_0x34e052)[_0xd2d5('0x21')](_0x43240b);}};}function respondWithFilteredResult(_0x46c1f4,_0x3268c5){return function(_0x4aac45){if(_0x4aac45){var _0x306e64=typeof _0x3268c5[_0xd2d5('0x22')]===_0xd2d5('0x23')&&typeof _0x3268c5[_0xd2d5('0x24')]===_0xd2d5('0x23');var _0xe09b1c=_0x4aac45['count'];var _0x4bf2d1=_0x306e64?0x0:_0x3268c5[_0xd2d5('0x22')];var _0x581db3=_0x306e64?_0x4aac45[_0xd2d5('0x25')]:_0x3268c5[_0xd2d5('0x22')]+_0x3268c5[_0xd2d5('0x24')];var _0x58dfd3;if(_0x581db3>=_0xe09b1c){_0x581db3=_0xe09b1c;_0x58dfd3=0xc8;}else{_0x58dfd3=0xce;}_0x46c1f4[_0xd2d5('0x1f')](_0x58dfd3);return _0x46c1f4[_0xd2d5('0x26')](_0xd2d5('0x27'),_0x4bf2d1+'-'+_0x581db3+'/'+_0xe09b1c)['json'](_0x4aac45);}return null;};}function patchUpdates(_0x40a05f){return function(_0x4f4692){try{jsonpatch[_0xd2d5('0x28')](_0x4f4692,_0x40a05f,!![]);}catch(_0x39bb82){return BPromise[_0xd2d5('0x29')](_0x39bb82);}return _0x4f4692[_0xd2d5('0x2a')]();};}function saveUpdates(_0xd3c8f7,_0x2e54ff){return function(_0x214ce1){if(_0x214ce1){return _0x214ce1[_0xd2d5('0x2b')](_0xd3c8f7)['then'](function(_0x141c7c){return _0x141c7c;});}return null;};}function removeEntity(_0x2c387b,_0x4b4cb7){return function(_0x105e6e){if(_0x105e6e){return _0x105e6e[_0xd2d5('0x2c')]()[_0xd2d5('0x2d')](function(){_0x2c387b[_0xd2d5('0x1f')](0xcc)[_0xd2d5('0x20')]();});}};}function handleEntityNotFound(_0x2aa4be,_0x4a31f9){return function(_0x170bb1){if(!_0x170bb1){_0x2aa4be[_0xd2d5('0x1e')](0x194);}return _0x170bb1;};}function handleError(_0xfa1155,_0xe8e80c){_0xe8e80c=_0xe8e80c||0x1f4;return function(_0x52f0eb){logger[_0xd2d5('0x2e')](_0x52f0eb[_0xd2d5('0x2f')]);if(_0x52f0eb[_0xd2d5('0x30')]){delete _0x52f0eb[_0xd2d5('0x30')];}_0xfa1155['status'](_0xe8e80c)[_0xd2d5('0x31')](_0x52f0eb);};}exports['index']=function(_0x85698a,_0x424e52){var _0x5ae252={},_0x223e64={},_0xa45c19={'count':0x0,'rows':[]};var _0xdd9881=_['map'](db[_0xd2d5('0x32')][_0xd2d5('0x33')],function(_0x3142a4){return{'name':_0x3142a4[_0xd2d5('0x34')],'type':_0x3142a4[_0xd2d5('0x35')][_0xd2d5('0x36')]};});_0x223e64[_0xd2d5('0x37')]=_['map'](_0xdd9881,_0xd2d5('0x30'));_0x223e64['query']=_[_0xd2d5('0x38')](_0x85698a[_0xd2d5('0x39')]);_0x223e64['filters']=_[_0xd2d5('0x3a')](_0x223e64[_0xd2d5('0x37')],_0x223e64[_0xd2d5('0x39')]);_0x5ae252[_0xd2d5('0x3b')]=_[_0xd2d5('0x3a')](_0x223e64['model'],qs[_0xd2d5('0x3c')](_0x85698a[_0xd2d5('0x39')][_0xd2d5('0x3c')]));_0x5ae252[_0xd2d5('0x3b')]=_0x5ae252['attributes'][_0xd2d5('0x3d')]?_0x5ae252[_0xd2d5('0x3b')]:_0x223e64[_0xd2d5('0x37')];if(!_0x85698a['query'][_0xd2d5('0x3e')](_0xd2d5('0x3f'))){_0x5ae252['limit']=qs['limit'](_0x85698a[_0xd2d5('0x39')][_0xd2d5('0x24')]);_0x5ae252['offset']=qs[_0xd2d5('0x22')](_0x85698a[_0xd2d5('0x39')][_0xd2d5('0x22')]);}_0x5ae252[_0xd2d5('0x40')]=qs[_0xd2d5('0x41')](_0x85698a[_0xd2d5('0x39')]['sort']);_0x5ae252[_0xd2d5('0x42')]=qs[_0xd2d5('0x43')](_[_0xd2d5('0x44')](_0x85698a[_0xd2d5('0x39')],_0x223e64[_0xd2d5('0x43')]),_0xdd9881);if(_0x85698a['query'][_0xd2d5('0x45')]){_0x5ae252['where']=_['merge'](_0x5ae252[_0xd2d5('0x42')],{'$or':_[_0xd2d5('0x46')](_0xdd9881,function(_0x3fc535){if(_0x3fc535[_0xd2d5('0x35')]!==_0xd2d5('0x47')){var _0xe870cd={};_0xe870cd[_0x3fc535['name']]={'$like':'%'+_0x85698a[_0xd2d5('0x39')]['filter']+'%'};return _0xe870cd;}})});}_0x5ae252=_[_0xd2d5('0x48')]({},_0x5ae252,_0x85698a[_0xd2d5('0x49')]);var _0x1c63aa={'where':_0x5ae252['where']};return db[_0xd2d5('0x32')]['count'](_0x1c63aa)['then'](function(_0x84515c){_0xa45c19[_0xd2d5('0x25')]=_0x84515c;if(_0x85698a[_0xd2d5('0x39')][_0xd2d5('0x4a')]){_0x5ae252[_0xd2d5('0x4b')]=[{'all':!![]}];}return db[_0xd2d5('0x32')][_0xd2d5('0x4c')](_0x5ae252);})[_0xd2d5('0x2d')](function(_0x563420){_0xa45c19['rows']=_0x563420;return _0xa45c19;})[_0xd2d5('0x2d')](respondWithFilteredResult(_0x424e52,_0x5ae252))[_0xd2d5('0x4d')](handleError(_0x424e52,null));};exports[_0xd2d5('0x4e')]=function(_0xb87a74,_0x11e090){var _0x15fa8e={'raw':![],'where':{'id':_0xb87a74[_0xd2d5('0x4f')]['id']}},_0x2fea6f={};_0x2fea6f['model']=_[_0xd2d5('0x38')](db[_0xd2d5('0x32')][_0xd2d5('0x33')]);_0x2fea6f[_0xd2d5('0x39')]=_[_0xd2d5('0x38')](_0xb87a74[_0xd2d5('0x39')]);_0x2fea6f['filters']=_[_0xd2d5('0x3a')](_0x2fea6f[_0xd2d5('0x37')],_0x2fea6f[_0xd2d5('0x39')]);_0x15fa8e[_0xd2d5('0x3b')]=_['intersection'](_0x2fea6f['model'],qs[_0xd2d5('0x3c')](_0xb87a74['query'][_0xd2d5('0x3c')]));_0x15fa8e[_0xd2d5('0x3b')]=_0x15fa8e[_0xd2d5('0x3b')][_0xd2d5('0x3d')]?_0x15fa8e[_0xd2d5('0x3b')]:_0x2fea6f[_0xd2d5('0x37')];if(_0xb87a74[_0xd2d5('0x39')][_0xd2d5('0x4a')]){_0x15fa8e['include']=[{'all':!![]}];}_0x15fa8e=_['merge']({},_0x15fa8e,_0xb87a74[_0xd2d5('0x49')]);return db[_0xd2d5('0x32')][_0xd2d5('0x50')](_0x15fa8e)[_0xd2d5('0x2d')](handleEntityNotFound(_0x11e090,null))['then'](respondWithResult(_0x11e090,null))['catch'](handleError(_0x11e090,null));};exports[_0xd2d5('0x51')]=function(_0x591274,_0x4c328f){return db[_0xd2d5('0x32')][_0xd2d5('0x51')](_0x591274[_0xd2d5('0x52')],{})[_0xd2d5('0x2d')](respondWithResult(_0x4c328f,0xc9))[_0xd2d5('0x4d')](handleError(_0x4c328f,null));};exports[_0xd2d5('0x53')]=function(_0x4522a1,_0x9ba0e){var _0x27609d={'where':{'id':_0x4522a1[_0xd2d5('0x4f')]['id']}},_0x1345e3={};_0x1345e3[_0xd2d5('0x37')]=_[_0xd2d5('0x38')](db['UserProfile'][_0xd2d5('0x33')]);_0x27609d[_0xd2d5('0x3b')]=_['intersection'](_0x1345e3[_0xd2d5('0x37')],qs[_0xd2d5('0x3c')](_0x4522a1[_0xd2d5('0x39')][_0xd2d5('0x3c')]));_0x27609d[_0xd2d5('0x3b')]=_0x27609d[_0xd2d5('0x3b')]['length']?_0x27609d[_0xd2d5('0x3b')]:_0x1345e3[_0xd2d5('0x37')];if(_0x4522a1['query'][_0xd2d5('0x4a')]){_0x27609d[_0xd2d5('0x4b')]=[{'all':!![]}];}_0x27609d=_['merge']({},_0x27609d,_0x4522a1[_0xd2d5('0x49')]);return db[_0xd2d5('0x32')][_0xd2d5('0x50')](_0x27609d)[_0xd2d5('0x2d')](handleEntityNotFound(_0x9ba0e,null))[_0xd2d5('0x2d')](function(_0x103cbc){if(_0x103cbc){var _0x168192=_0x103cbc['get']({'plain':!![]});_0x168192=qs[_0xd2d5('0x54')](_0x168192,['id','createdAt','updatedAt',_0xd2d5('0x55')]);_0x4522a1['body']=_[_0xd2d5('0x54')](_0x4522a1[_0xd2d5('0x52')],['id',_0xd2d5('0x56'),_0xd2d5('0x57')]);return db[_0xd2d5('0x58')][_0xd2d5('0x59')](function(_0x288cd1){return db[_0xd2d5('0x32')][_0xd2d5('0x51')](_[_0xd2d5('0x48')](_0x168192,_0x4522a1['body']),{'include':_0x4522a1[_0xd2d5('0x39')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x288cd1})[_0xd2d5('0x2d')](function(_0x2ce5f5){var _0x4369ef=_0x2ce5f5['get']({'plain':!![]});return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x4522a1['params']['id']},'raw':!![]})[_0xd2d5('0x2d')](function(_0x1fae2e){if(_0x1fae2e){return BPromise[_0xd2d5('0x5a')](_0x1fae2e,function(_0x25ed95){return new BPromise(function(_0x5828e3,_0x4a5d0a){if(_0x25ed95['autoAssociation']===null||_0x25ed95[_0xd2d5('0x5b')]===0x1)_0x5828e3(null);return db[_0xd2d5('0x5c')]['findAll']({'where':{'sectionId':_0x25ed95['id']},'raw':!![]})['then'](function(_0x353337){var _0x5ae0c0=_['map'](_0x353337,function(_0x3e6a87){return qs['omit'](_0x3e6a87,['id','createdAt',_0xd2d5('0x57'),_0xd2d5('0x5d')]);});_0x5828e3(_0x5ae0c0);})[_0xd2d5('0x4d')](function(_0x38780c){_0x4a5d0a(_0x38780c);});})[_0xd2d5('0x2d')](function(_0x273c6d){var _0x420d85=qs['omit'](_0x25ed95,['id','createdAt',_0xd2d5('0x57')]);_0x420d85[_0xd2d5('0x5e')]=_0x4369ef['id'];if(_0x273c6d)_0x420d85[_0xd2d5('0x5f')]=_0x273c6d;return _0x420d85;})[_0xd2d5('0x2d')](function(_0x1a8eee){return db['UserProfileSection'][_0xd2d5('0x51')](_0x1a8eee,{'include':[{'model':db['UserProfileResource'],'as':_0xd2d5('0x5f')}],'raw':!![],'transaction':_0x288cd1});});})[_0xd2d5('0x2d')](function(){return _0x4369ef;});}});});});}})[_0xd2d5('0x2d')](respondWithResult(_0x9ba0e,0xc9))[_0xd2d5('0x4d')](handleError(_0x9ba0e,null));};exports[_0xd2d5('0x2b')]=function(_0x56d9b1,_0x47c672){if(_0x56d9b1[_0xd2d5('0x52')]['id']){delete _0x56d9b1[_0xd2d5('0x52')]['id'];}return db['UserProfile']['find']({'where':{'id':_0x56d9b1[_0xd2d5('0x4f')]['id']}})[_0xd2d5('0x2d')](handleEntityNotFound(_0x47c672,null))['then'](saveUpdates(_0x56d9b1[_0xd2d5('0x52')],null))['then'](respondWithResult(_0x47c672,null))[_0xd2d5('0x4d')](handleError(_0x47c672,null));};exports['destroy']=function(_0x2aa24e,_0x292304){return db[_0xd2d5('0x32')]['find']({'where':{'id':_0x2aa24e['params']['id']}})[_0xd2d5('0x2d')](handleEntityNotFound(_0x292304,null))[_0xd2d5('0x2d')](removeEntity(_0x292304,null))['catch'](handleError(_0x292304,null));};exports[_0xd2d5('0x60')]=function(_0x46b385,_0x54021a){return db[_0xd2d5('0x32')][_0xd2d5('0x60')]()['then'](respondWithResult(_0x54021a,null))[_0xd2d5('0x4d')](handleError(_0x54021a,null));};exports[_0xd2d5('0x61')]=function(_0x1fff72,_0x1348a1){var _0x5d8335=_0x1fff72['body'];return db[_0xd2d5('0x32')][_0xd2d5('0x50')]({'where':{'id':_0x1fff72['params']['id']}})[_0xd2d5('0x2d')](handleEntityNotFound(_0x1348a1,null))[_0xd2d5('0x2d')](function(_0xd902dc){if(_0xd902dc){return db[_0xd2d5('0x58')]['transaction'](function(_0x364668){return db[_0xd2d5('0x62')][_0xd2d5('0x2c')]({'where':{'userProfileId':_0x1fff72[_0xd2d5('0x4f')]['id'],'sectionId':_[_0xd2d5('0x46')](_0x5d8335,function(_0x5133a1){return _0x5133a1[_0xd2d5('0x5d')];})},'transaction':_0x364668})[_0xd2d5('0x2d')](function(){var _0x241a2b=_[_0xd2d5('0x46')](_0x5d8335,function(_0x58a3bc){_0x58a3bc['userProfileId']=_0x1fff72[_0xd2d5('0x4f')]['id'];return _0x58a3bc;});var _0x162996=[];return BPromise[_0xd2d5('0x5a')](_0x241a2b,function(_0x4286ae){return db[_0xd2d5('0x62')][_0xd2d5('0x51')](_0x4286ae,{'include':[{'model':db[_0xd2d5('0x5c')],'as':_0xd2d5('0x5f')}],'raw':!![],'transaction':_0x364668})['then'](function(_0x3698cb){_0x162996[_0xd2d5('0x63')](_0x3698cb[_0xd2d5('0x64')]({'plain':!![]}));});})[_0xd2d5('0x2d')](function(){return _0x162996;});});});}})[_0xd2d5('0x2d')](function(_0x4c98d5){return _0x4c98d5;})[_0xd2d5('0x2d')](respondWithResult(_0x1348a1,null))[_0xd2d5('0x4d')](handleError(_0x1348a1,null));};exports[_0xd2d5('0x65')]=function(_0x269b89,_0x77788){var _0x285038;return db[_0xd2d5('0x32')][_0xd2d5('0x50')]({'where':{'id':_0x269b89[_0xd2d5('0x4f')]['id']},'attributes':['id',_0xd2d5('0x30')]})['then'](handleEntityNotFound(_0x77788,null))['then'](function(_0x3dbd16){if(_0x3dbd16){_0x285038=_0x3dbd16;return db['UserProfileSection']['destroy']({'where':{'userProfileId':_0x269b89['params']['id'],'sectionId':_0x269b89[_0xd2d5('0x39')][_0xd2d5('0x66')]}});}})[_0xd2d5('0x2d')](function(){return _0x285038;})[_0xd2d5('0x2d')](respondWithStatusCode(_0x77788,null))['catch'](handleError(_0x77788,null));};exports[_0xd2d5('0x67')]=function(_0x208e2e,_0x3be9a8){var _0x526057=[];var _0xf1d8c8=[];return db[_0xd2d5('0x62')][_0xd2d5('0x4c')]({'where':{'userProfileId':_0x208e2e[_0xd2d5('0x4f')]['id']},'raw':!![]})['then'](function(_0x351b3e){_0x526057=_['filter'](_0x351b3e,function(_0x44ba44){return _0x44ba44[_0xd2d5('0x68')]===0x1||_[_0xd2d5('0x69')]([0x3eb,0x709],_0x44ba44[_0xd2d5('0x5d')]);});if(!_[_0xd2d5('0x6a')](_0x526057)){return _['map'](_0x526057,function(_0x19d6e6){return _0x19d6e6['sectionId'];});}else{return;}})[_0xd2d5('0x2d')](function(_0x43a40d){if(_0x43a40d)_0xf1d8c8=_0x43a40d;if(_['includes'](_0xf1d8c8,0x64)){var _0x2ddf13=_[_0xd2d5('0x50')](_0x526057,{'sectionId':0x64});return hasDefaultDashboard(_0x2ddf13)[_0xd2d5('0x2d')](function(_0x21a507){return _[_0xd2d5('0x46')](_0x526057,function(_0x170fc8){if(_0x170fc8[_0xd2d5('0x5d')]===0x64){_0x170fc8[_0xd2d5('0x6b')]=_0x21a507;}return _0x170fc8;});});}else{return;}})[_0xd2d5('0x2d')](function(_0x292c68){if(_0x292c68)_0x526057=_0x292c68;if(_['includes'](_0xf1d8c8,0x3eb)){var _0x2830ca=_[_0xd2d5('0x50')](_0x526057,{'sectionId':0x3eb});return getCustomDashboards(_0x2830ca)[_0xd2d5('0x2d')](function(_0x3afe3a){return _[_0xd2d5('0x46')](_0x526057,function(_0x55b8db){if(_0x2830ca[_0xd2d5('0x68')]){if(_0x55b8db[_0xd2d5('0x5d')]===0x3eb){_0x55b8db[_0xd2d5('0x6b')]=_0x3afe3a;}}else{if(_0x55b8db[_0xd2d5('0x5d')]===0x64){if(!_0x55b8db[_0xd2d5('0x6b')]){_0x55b8db[_0xd2d5('0x6b')]=[];}_0x55b8db['subsections']=_0x55b8db['subsections'][_0xd2d5('0x6c')](_0x3afe3a);}}return _0x55b8db;});});}else{return;}})[_0xd2d5('0x2d')](function(_0x25be46){if(_0x25be46)_0x526057=_0x25be46;if(_[_0xd2d5('0x69')](_0xf1d8c8,0x709)){var _0x3c257b=_[_0xd2d5('0x50')](_0x526057,{'sectionId':0x709});return getPlugins(_0x3c257b)[_0xd2d5('0x2d')](function(_0x4f6004){if(_0x3c257b[_0xd2d5('0x68')]){return _[_0xd2d5('0x46')](_0x526057,function(_0x2771d5){if(_0x2771d5[_0xd2d5('0x5d')]===0x709){_0x2771d5['subsections']=_0x4f6004;}return _0x2771d5;});}else{var _0x3451ff={'sectionId':0x76c,'enabled':0x1,'subsections':_0x4f6004};var _0x522fb6=_[_0xd2d5('0x46')](_0x526057);_0x522fb6[_0xd2d5('0x63')](_0x3451ff);return _0x522fb6;}});}else{return;}})[_0xd2d5('0x2d')](function(_0x291445){if(_0x291445)_0x526057=_0x291445;return _[_0xd2d5('0x45')](_0x526057,[_0xd2d5('0x68'),0x1]);})[_0xd2d5('0x2d')](respondWithResult(_0x3be9a8,null))['catch'](handleError(_0x3be9a8,null));};function hasDefaultDashboard(_0x3f62f9){var _0x5c66fb=[0x65];return new BPromise(function(_0x4834a4,_0x580728){try{if(_0x3f62f9[_0xd2d5('0x5b')]){_0x4834a4(_0x5c66fb);}else{return db[_0xd2d5('0x5c')][_0xd2d5('0x6d')]({'where':{'sectionId':_0x3f62f9['id']},'raw':!![]})['then'](function(_0x3d7fda){_0x3d7fda?_0x4834a4(_0x5c66fb):_0x4834a4();});}}catch(_0x46c446){_0x580728(_0x46c446);}});}function getCustomDashboards(_0xe84cc3){var _0x3bbe32=[];return new BPromise(function(_0x16d4dd,_0x579b79){try{if(_0xe84cc3['autoAssociation']){return db[_0xd2d5('0x6e')][_0xd2d5('0x4c')]({'raw':!![]})[_0xd2d5('0x2d')](function(_0x508f51){_0x508f51[_0xd2d5('0x6f')](function(_0x217d37){_0x3bbe32[_0xd2d5('0x63')](_0x217d37['id']+0x1869f);});_0x16d4dd(_0x3bbe32);});}else{return db[_0xd2d5('0x5c')][_0xd2d5('0x4c')]({'where':{'sectionId':_0xe84cc3['id']},'raw':!![]})[_0xd2d5('0x2d')](function(_0x1d26ac){_0x1d26ac['forEach'](function(_0x195c83){_0x3bbe32[_0xd2d5('0x63')](_0x195c83['resourceId']+0x1869f);});_0x16d4dd(_0x3bbe32);});}}catch(_0x240131){_0x579b79(_0x240131);}});}function getPlugins(_0x19fb2f){var _0x1a8c6c=[];return new BPromise(function(_0x1931cd,_0xc5f5ef){try{if(_0x19fb2f[_0xd2d5('0x5b')]){return db[_0xd2d5('0x70')][_0xd2d5('0x4c')]({'raw':!![]})[_0xd2d5('0x2d')](function(_0xc903fe){_0xc903fe['forEach'](function(_0x1855f6){_0x1a8c6c[_0xd2d5('0x63')](_0x1855f6['id']+0x15b38);});_0x1931cd(_0x1a8c6c);});}else{return db[_0xd2d5('0x5c')][_0xd2d5('0x4c')]({'where':{'sectionId':_0x19fb2f['id']},'raw':!![]})['then'](function(_0x3b79dd){_0x3b79dd[_0xd2d5('0x6f')](function(_0x185208){_0x1a8c6c[_0xd2d5('0x63')](_0x185208[_0xd2d5('0x71')]+0x15b38);});_0x1931cd(_0x1a8c6c);});}}catch(_0x4a52e1){_0xc5f5ef(_0x4a52e1);}});}exports[_0xd2d5('0x72')]=function(_0xcdfce3,_0x5e5aba){return db[_0xd2d5('0x32')][_0xd2d5('0x50')]({'where':{'id':_0xcdfce3[_0xd2d5('0x4f')]['id']}})['then'](handleEntityNotFound(_0x5e5aba,null))[_0xd2d5('0x2d')](function(_0x3815e4){if(_0x3815e4){return db[_0xd2d5('0x58')][_0xd2d5('0x59')](function(_0x4bde40){return db[_0xd2d5('0x62')]['findAll']({'where':{'userProfileId':_0xcdfce3[_0xd2d5('0x4f')]['id']},'attributes':['id'],'raw':!![]})[_0xd2d5('0x2d')](function(_0x31a554){if(_0x31a554){return db[_0xd2d5('0x62')][_0xd2d5('0x2c')]({'where':{'userProfileId':_0xcdfce3[_0xd2d5('0x4f')]['id'],'id':_[_0xd2d5('0x46')](_0x31a554,function(_0x54292e){return _0x54292e['id'];})},'transaction':_0x4bde40});}})[_0xd2d5('0x2d')](function(_0xf886f2){var _0x1474c8=_[_0xd2d5('0x46')](_0xcdfce3['body'],function(_0x18c7f2){_0x18c7f2['userProfileId']=_0xcdfce3['params']['id'];return _0x18c7f2;});return db[_0xd2d5('0x62')]['bulkCreate'](_0x1474c8,{'raw':!![],'transaction':_0x4bde40});})[_0xd2d5('0x2d')](function(_0x4e9438){var _0xb4c667=_[_0xd2d5('0x45')](_[_0xd2d5('0x46')](_0x4e9438,function(_0x1c1995){return _0x1c1995[_0xd2d5('0x64')]({'plain':!![]});}),{'includeAll':![]});if(_0xb4c667){return db[_0xd2d5('0x62')][_0xd2d5('0x4c')]({'where':{'userProfileId':_0xcdfce3[_0xd2d5('0x4f')]['id'],'sectionId':_[_0xd2d5('0x46')](_0xb4c667,function(_0x479708){return _0x479708[_0xd2d5('0x5d')];})},'attributes':['id',_0xd2d5('0x5d')],'raw':!![]})[_0xd2d5('0x2d')](function(_0x1ba06e){var _0x3ba65f=_[_0xd2d5('0x46')](_0xcdfce3['body'],function(_0x80d5a){_0x80d5a[_0xd2d5('0x5e')]=_0xcdfce3[_0xd2d5('0x4f')]['id'];return _0x80d5a;});return db[_0xd2d5('0x5c')]['bulkCreate'](_0x3ba65f,{'raw':!![],'transaction':_0x4bde40});});}})[_0xd2d5('0x4d')](handleError(_0x5e5aba,null));});}})[_0xd2d5('0x2d')](function(_0xc776ad){var _0x3cbec9=_[_0xd2d5('0x46')](_0xc776ad,function(_0x3183c1){return _0x3183c1[_0xd2d5('0x64')]({'plain':!![]});});})[_0xd2d5('0x2d')](respondWithResult(_0x5e5aba,null))[_0xd2d5('0x4d')](handleError(_0x5e5aba,null));};exports['removeResources']=function(_0x449d1e,_0x2ab3ca,_0x5dc2e4){return db[_0xd2d5('0x32')][_0xd2d5('0x50')]({'where':{'id':_0x449d1e[_0xd2d5('0x4f')]['id']}})[_0xd2d5('0x2d')](handleEntityNotFound(_0x2ab3ca,null))['then'](function(_0x42fc24){if(_0x42fc24){return _0x42fc24['removeResources'](_0x449d1e['query'][_0xd2d5('0x66')]);}})['then'](respondWithStatusCode(_0x2ab3ca,null))[_0xd2d5('0x4d')](handleError(_0x2ab3ca,null));};exports['getResources']=function(_0x17f3a5,_0x426f31){var _0x3ada3f={};if(!_0x17f3a5[_0xd2d5('0x39')][_0xd2d5('0x73')])throw new Error(_0xd2d5('0x74'));if(!_0x17f3a5['query']['hasOwnProperty']('nolimit')){_0x3ada3f['limit']=qs['limit'](_0x17f3a5[_0xd2d5('0x39')][_0xd2d5('0x24')]);_0x3ada3f[_0xd2d5('0x22')]=qs[_0xd2d5('0x22')](_0x17f3a5[_0xd2d5('0x39')][_0xd2d5('0x22')]);}return db[_0xd2d5('0x32')]['find']({'where':{'id':_0x17f3a5['params']['id']}})[_0xd2d5('0x2d')](function(_0x4238e6){if(!_0x4238e6)throw new Error(_0xd2d5('0x75')+_0x17f3a5[_0xd2d5('0x4f')]['id']);return db[_0xd2d5('0x32')][_0xd2d5('0x76')](_0x17f3a5);})[_0xd2d5('0x2d')](respondWithFilteredResult(_0x426f31,_0x3ada3f))['catch'](handleError(_0x426f31,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index d6703fc..4a795d0 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 _0x96fd=['setMaxListeners','save','remove','emit','hook','exports','../../mysqldb'];(function(_0x506cbf,_0xb7e1d8){var _0x5513f1=function(_0x25a9c4){while(--_0x25a9c4){_0x506cbf['push'](_0x506cbf['shift']());}};_0x5513f1(++_0xb7e1d8);}(_0x96fd,0x1e9));var _0xd96f=function(_0x4624d3,_0x329cb9){_0x4624d3=_0x4624d3-0x0;var _0x40678e=_0x96fd[_0x4624d3];return _0x40678e;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0xd96f('0x0'))['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xd96f('0x1')](0x0);var events={'afterCreate':_0xd96f('0x2'),'afterUpdate':'update','afterDestroy':_0xd96f('0x3')};function emitEvent(_0x110958){return function(_0x44f63c,_0x22b39b,_0x5d8681){UserProfileEvents[_0xd96f('0x4')](_0x110958+':'+_0x44f63c['id'],_0x44f63c);UserProfileEvents[_0xd96f('0x4')](_0x110958,_0x44f63c);_0x5d8681(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0xd96f('0x5')](e,emitEvent(event));}}module[_0xd96f('0x6')]=UserProfileEvents; \ No newline at end of file +var _0xe1d3=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserProfile','setMaxListeners','save'];(function(_0x7ec937,_0xbe3b08){var _0x150040=function(_0x4a5d8e){while(--_0x4a5d8e){_0x7ec937['push'](_0x7ec937['shift']());}};_0x150040(++_0xbe3b08);}(_0xe1d3,0x159));var _0x3e1d=function(_0xbe62a5,_0x392fff){_0xbe62a5=_0xbe62a5-0x0;var _0x21a774=_0xe1d3[_0xbe62a5];return _0x21a774;};'use strict';var EventEmitter=require(_0x3e1d('0x0'));var UserProfile=require(_0x3e1d('0x1'))['db'][_0x3e1d('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x3e1d('0x3')](0x0);var events={'afterCreate':_0x3e1d('0x4'),'afterUpdate':'update','afterDestroy':_0x3e1d('0x5')};function emitEvent(_0x4a0768){return function(_0x23f59b,_0x38df15,_0x4f6337){UserProfileEvents['emit'](_0x4a0768+':'+_0x23f59b['id'],_0x23f59b);UserProfileEvents[_0x3e1d('0x6')](_0x4a0768,_0x23f59b);_0x4f6337(null);};}for(var e in events){if(events[_0x3e1d('0x7')](e)){var event=events[e];UserProfile[_0x3e1d('0x8')](e,emitEvent(event));}}module[_0x3e1d('0x9')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 15d024a..b2f2c14 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 _0x1a18=['SmsQueue','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','Team','voicequeues','queuecampaigns','users','agents','telephones','admin','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','Pause','scheduler','Schedule','sounds','Tag','templates','Template','Trigger','Trunk','variables','Variable','plugins','extractedreports','Reports','reportId','metrics','AnalyticMetric','charAt','slice','Sequelize','QueryTypes','SELECT','ui.','InteractionId','ui.createdAt','from','_interactions','where','sequelize','query','toString','OpenTabs','define','raw','section','Invalid\x20section\x20\x27','isEmpty','length','find','params','all','ignore','push','rawAttributes','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','pick','merge','key','VIRTUAL','AnalyticExtractedReport','foreignKey','forEach','options','autoAssociation','reportType','default','DefaultReports','custom','CustomReports','count','ids','customSorting','extraQueryConditions','includeAll','include','Tags','color','tag','ThroughTags','rows','openTabs','true','sms','dataValues','fax','mail','openchannel','whatsapp','../../components/parsers/qs','exports','models','filter','field','value','findAll','associatedResources','catch','model','then','map','name','resolve','resourceId','type','toLowerCase','childModel','SquareProject','parentSections','SquareProjects','projects','contacts','CmContact','ListId','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','faxqueues','FaxQueue','faxaccounts','inboundroutes','outboundroutes','VoiceExtension','contexts','voicemails','VoiceMail','voicerecordings','Agents','membername','User','role','Telephones','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','musiconholds','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','MailSubstatus','OpenchannelQueue','smsqueues'];(function(_0xea9ef5,_0x3fa05c){var _0x1424db=function(_0x2fa784){while(--_0x2fa784){_0xea9ef5['push'](_0xea9ef5['shift']());}};_0x1424db(++_0x3fa05c);}(_0x1a18,0x7a));var _0x81a1=function(_0x452968,_0x31e391){_0x452968=_0x452968-0x0;var _0xb6f9ae=_0x1a18[_0x452968];return _0xb6f9ae;};'use strict';var _=require('lodash');var attributes=require('./userProfile.attributes');var qs=require(_0x81a1('0x0'));var squel=require('squel');module[_0x81a1('0x1')]=function(_0x1999a0){var _0x11b845=_0x1999a0[_0x81a1('0x2')];function _0x23a249(_0x5a3062,_0x388247){return new Promise(function(_0x33ef2a,_0x45b5e5){if(!_0x388247)return _0x33ef2a(null);var _0x4f2788=_0x388247['filter']?{[_0x388247[_0x81a1('0x3')][_0x81a1('0x4')]]:_0x388247[_0x81a1('0x3')][_0x81a1('0x5')]}:undefined;return _0x11b845[_0x5a3062][_0x81a1('0x6')]({'where':_0x4f2788,'raw':!![]})['then'](function(_0x1e42c5){_0x388247[_0x81a1('0x7')]=_['map'](_0x1e42c5,'id');_0x33ef2a(_0x388247);})[_0x81a1('0x8')](function(_0x1238ed){_0x45b5e5(_0x1238ed);});});}function _0x4ac0f0(_0x2aa312,_0x2b080b){return new Promise(function(_0xc71e53,_0x42985a){var _0x51f042=_0x2aa312[_0x81a1('0x3')]?{[_0x2aa312[_0x81a1('0x3')][_0x81a1('0x4')]]:_0x2aa312[_0x81a1('0x3')][_0x81a1('0x5')]}:undefined;return _0x11b845[_0x2aa312[_0x81a1('0x9')]][_0x81a1('0x6')]({'where':_0x51f042,'raw':!![]})[_0x81a1('0xa')](function(_0x5434dc){_0x2b080b[_0x81a1('0x7')]=_[_0x81a1('0xb')](_0x5434dc,function(_0x14a6ed){return _0x14a6ed[_0x81a1('0xc')];});_0xc71e53(_0x2b080b);})[_0x81a1('0x8')](function(_0x5562c5){_0x42985a(_0x5562c5);});});}function _0x38239f(_0x5a05f6,_0x56c87d,_0x4e372f){if(!_0x56c87d)return Promise[_0x81a1('0xd')](null);return new Promise(function(_0x3a4be7,_0x3f6119){return _0x11b845['UserProfileResource'][_0x81a1('0x6')]({'where':{'sectionId':_0x56c87d['id']},'raw':!![]})[_0x81a1('0xa')](function(_0x5e0eb5){if(_0x5a05f6[_0x81a1('0x4')]&&_0x5a05f6[_0x81a1('0x4')]!=='id'){_0x56c87d['associatedResources']=_['map'](_0x5e0eb5,function(_0x4c30ed){return _0x4c30ed[_0x5a05f6['field']];});}else{if(_0x4e372f==='AnalyticExtractedReport'){_0x56c87d[_0x81a1('0x7')]=_[_0x81a1('0xb')](_0x5e0eb5,function(_0x23c9f1){return{'id':_0x23c9f1[_0x81a1('0xe')],'type':_0x23c9f1[_0x81a1('0xf')]};});}else{_0x56c87d[_0x81a1('0x7')]=_[_0x81a1('0xb')](_0x5e0eb5,function(_0x1c509d){return _0x1c509d[_0x81a1('0xe')];});}}_0x3a4be7(_0x56c87d);})[_0x81a1('0x8')](function(_0x478b8f){_0x3f6119(_0x478b8f);});});}function _0x40fd8c(_0x17c564,_0x1a6e61){var _0x3f4077={'parentSections':[]};switch(_0x17c564[_0x81a1('0x10')]()){case'squareprojects':_0x3f4077[_0x81a1('0x11')]=_0x81a1('0x12');break;case'odbc':_0x3f4077[_0x81a1('0x11')]='SquareOdbc';break;case'squarerecordings':_0x3f4077[_0x81a1('0x11')]='SquareRecording';_0x3f4077[_0x81a1('0x13')]=[{'name':_0x81a1('0x14'),'field':_0x81a1('0xc'),'foreignKey':'projectName'}];break;case _0x81a1('0x15'):_0x3f4077['childModel']='JscriptyProject';break;case _0x81a1('0x16'):_0x3f4077[_0x81a1('0x11')]=_0x81a1('0x17');_0x3f4077[_0x81a1('0x13')]=[{'name':'Lists','field':'id','foreignKey':_0x81a1('0x18')}];break;case _0x81a1('0x19'):_0x3f4077[_0x81a1('0x11')]=_0x81a1('0x1a');break;case _0x81a1('0x1b'):_0x3f4077['childModel']=_0x81a1('0x1c');break;case _0x81a1('0x1d'):_0x3f4077[_0x81a1('0x11')]=_0x81a1('0x1e');break;case _0x81a1('0x1f'):_0x3f4077[_0x81a1('0x11')]=_0x81a1('0x20');break;case _0x81a1('0x21'):_0x3f4077[_0x81a1('0x11')]='ChatWebsite';break;case _0x81a1('0x22'):_0x3f4077[_0x81a1('0x11')]=_0x81a1('0x23');break;case _0x81a1('0x24'):_0x3f4077[_0x81a1('0x11')]='FaxAccount';break;case _0x81a1('0x25'):case'internalroutes':case _0x81a1('0x26'):_0x3f4077[_0x81a1('0x11')]=_0x81a1('0x27');break;case _0x81a1('0x28'):_0x3f4077[_0x81a1('0x11')]='VoiceContext';break;case _0x81a1('0x29'):_0x3f4077['childModel']=_0x81a1('0x2a');break;case _0x81a1('0x2b'):_0x3f4077[_0x81a1('0x11')]='VoiceRecording';_0x3f4077[_0x81a1('0x13')]=[{'name':_0x81a1('0x2c'),'field':_0x81a1('0xc'),'foreignKey':_0x81a1('0x2d'),'model':_0x81a1('0x2e'),'filter':{'field':_0x81a1('0x2f'),'value':['agent']}},{'name':_0x81a1('0x30'),'field':_0x81a1('0xc'),'foreignKey':_0x81a1('0x2d'),'model':'User','filter':{'field':_0x81a1('0x2f'),'value':['telephone']}},{'name':_0x81a1('0x31'),'field':_0x81a1('0xc'),'foreignKey':_0x81a1('0x32'),'model':_0x81a1('0x33'),'filter':{'field':_0x81a1('0xf'),'value':[_0x81a1('0x34')]}},{'name':_0x81a1('0x35'),'field':_0x81a1('0xc'),'foreignKey':_0x81a1('0x32'),'model':'VoiceQueue','filter':{'field':_0x81a1('0xf'),'value':['outbound']}}];break;case _0x81a1('0x36'):_0x3f4077[_0x81a1('0x11')]='VoiceMusicOnHold';break;case'chanspies':_0x3f4077[_0x81a1('0x11')]=_0x81a1('0x37');break;case _0x81a1('0x38'):_0x3f4077['childModel']=_0x81a1('0x39');break;case _0x81a1('0x3a'):_0x3f4077[_0x81a1('0x11')]=_0x81a1('0x3b');break;case _0x81a1('0x3c'):_0x3f4077['childModel']=_0x81a1('0x3d');break;case _0x81a1('0x3e'):_0x3f4077[_0x81a1('0x11')]=_0x81a1('0x3f');break;case'mailsubstatuses':_0x3f4077['childModel']=_0x81a1('0x40');break;case'openchannelqueues':_0x3f4077[_0x81a1('0x11')]=_0x81a1('0x41');break;case'openchannelaccounts':_0x3f4077['childModel']='OpenchannelAccount';break;case _0x81a1('0x42'):_0x3f4077[_0x81a1('0x11')]=_0x81a1('0x43');break;case'smsaccounts':_0x3f4077[_0x81a1('0x11')]=_0x81a1('0x44');break;case _0x81a1('0x45'):_0x3f4077[_0x81a1('0x11')]=_0x81a1('0x46');break;case _0x81a1('0x47'):_0x3f4077['childModel']=_0x81a1('0x48');break;case'teams':_0x3f4077[_0x81a1('0x11')]=_0x81a1('0x49');break;case _0x81a1('0x4a'):case _0x81a1('0x4b'):_0x3f4077[_0x81a1('0x11')]=_0x81a1('0x33');if(_0x1a6e61){_0x3f4077[_0x81a1('0x13')]=[{'name':_0x81a1('0x31')},{'name':_0x81a1('0x35')}];}break;case _0x81a1('0x4c'):case _0x81a1('0x4d'):case _0x81a1('0x4e'):_0x3f4077[_0x81a1('0x11')]=_0x81a1('0x2e');if(_0x1a6e61){_0x3f4077[_0x81a1('0x13')]=[{'name':'Users','filter':{'field':_0x81a1('0x2f'),'value':[_0x81a1('0x4f'),_0x81a1('0x50')]},'ignore':!![]},{'name':_0x81a1('0x2c')},{'name':_0x81a1('0x30')}];}break;case _0x81a1('0x51'):_0x3f4077[_0x81a1('0x11')]=_0x81a1('0x52');break;case _0x81a1('0x53'):_0x3f4077[_0x81a1('0x11')]=_0x81a1('0x54');break;case _0x81a1('0x55'):_0x3f4077[_0x81a1('0x11')]=_0x81a1('0x56');break;case _0x81a1('0x57'):_0x3f4077['childModel']=_0x81a1('0x58');break;case _0x81a1('0x59'):_0x3f4077[_0x81a1('0x11')]=_0x81a1('0x5a');break;case _0x81a1('0x5b'):_0x3f4077['childModel']=_0x81a1('0x5c');break;case _0x81a1('0x5d'):_0x3f4077[_0x81a1('0x11')]=_0x81a1('0x2e');break;case'cannedanswers':_0x3f4077['childModel']=_0x81a1('0x5e');break;case _0x81a1('0x5f'):_0x3f4077[_0x81a1('0x11')]=_0x81a1('0x60');break;case _0x81a1('0x61'):_0x3f4077[_0x81a1('0x11')]=_0x81a1('0x62');break;case _0x81a1('0x63'):_0x3f4077[_0x81a1('0x11')]=_0x81a1('0x64');break;case _0x81a1('0x65'):_0x3f4077[_0x81a1('0x11')]=_0x81a1('0x66');break;case _0x81a1('0x67'):_0x3f4077['childModel']=_0x81a1('0x68');break;case _0x81a1('0x69'):_0x3f4077[_0x81a1('0x11')]='Sound';break;case'tags':_0x3f4077[_0x81a1('0x11')]=_0x81a1('0x6a');break;case _0x81a1('0x6b'):_0x3f4077['childModel']=_0x81a1('0x6c');break;case'triggers':_0x3f4077[_0x81a1('0x11')]=_0x81a1('0x6d');break;case'trunks':_0x3f4077[_0x81a1('0x11')]=_0x81a1('0x6e');break;case _0x81a1('0x6f'):_0x3f4077[_0x81a1('0x11')]=_0x81a1('0x70');break;case _0x81a1('0x71'):_0x3f4077[_0x81a1('0x11')]='Plugin';break;case _0x81a1('0x72'):_0x3f4077[_0x81a1('0x11')]='AnalyticExtractedReport';_0x3f4077['parentSections']=[{'name':_0x81a1('0x73'),'field':'id','foreignKey':_0x81a1('0x74')}];break;case _0x81a1('0x75'):_0x3f4077['childModel']=_0x81a1('0x76');break;}return _0x3f4077;}function _0x3d1eb0(_0x279eed,_0xe0c816){var _0x5d77bc=_0x279eed[_0x81a1('0x77')](0x0)['toUpperCase']()+_0x279eed[_0x81a1('0x78')](0x1);var _0x5edd4e={'type':_0x11b845[_0x81a1('0x79')][_0x81a1('0x7a')][_0x81a1('0x7b')],'raw':!![]};return new Promise(function(_0x1b2500,_0x3d0da0){var _0x511cfd=squel['select']()[_0x81a1('0x4')](_0x81a1('0x7c')+_0x5d77bc+_0x81a1('0x7d'),'id')[_0x81a1('0x4')](_0x81a1('0x7e'))[_0x81a1('0x7f')]('user_has_'+_0x279eed+_0x81a1('0x80'),'ui')[_0x81a1('0x81')]('ui.UserId\x20=\x20?',_0xe0c816['id']);return _0x11b845[_0x81a1('0x82')][_0x81a1('0x83')](_0x511cfd[_0x81a1('0x84')](),_0x5edd4e)['then'](function(_0x538de0){_0xe0c816[_0x5d77bc+_0x81a1('0x85')]=_0x538de0;_0x1b2500(_0x538de0);})[_0x81a1('0x8')](function(_0x11807a){_0x3d0da0(_0x11807a);});});}return _0x1999a0[_0x81a1('0x86')]('UserProfile',attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x1e2c66){var _0x2d61c5={'raw':_0x1e2c66[_0x81a1('0x83')][_0x81a1('0x87')],'where':{}};var _0xe680f3={};var _0xa7f5ec={'count':0x0,'rows':[]};var _0x5b85ea=_0x1e2c66[_0x81a1('0x83')][_0x81a1('0x88')];var _0x20f443=_0x1e2c66[_0x81a1('0x83')]['mergeResources']||![];var _0x33277b=_0x40fd8c(_0x5b85ea,_0x20f443);if(!_0x33277b[_0x81a1('0x11')])throw new Error(_0x81a1('0x89')+_0x5b85ea+'\x27');var _0x511841=[{'name':_0x5b85ea}];if(!_[_0x81a1('0x8a')](_0x33277b[_0x81a1('0x13')]))_0x511841=_0x33277b[_0x81a1('0x13')];var _0x3c88ee=[];for(var _0x250dc2=0x0;_0x250dc2<_0x511841[_0x81a1('0x8b')];_0x250dc2++){_0x3c88ee['push'](_0x11b845['UserProfileSection'][_0x81a1('0x8c')]({'where':{'userProfileId':_0x1e2c66[_0x81a1('0x8d')]['id'],'name':_0x511841[_0x250dc2]['name']},'raw':!![]}));}return Promise[_0x81a1('0x8e')](_0x3c88ee)[_0x81a1('0xa')](function(_0x165b39){var _0x4d229e=_[_0x81a1('0x3')](_0x165b39,function(_0x28941d){return _0x28941d?_0x28941d:undefined;});var _0x380cda=_[_0x81a1('0x3')](_0x511841,[_0x81a1('0x8f'),!![]]);var _0x4e59b0=_[_0x81a1('0x8a')](_0x4d229e)&&_[_0x81a1('0x8a')](_0x380cda)?null:_['union'](_0x380cda,_0x4d229e);if(!_0x4e59b0)return null;var _0x4580c0=[];for(var _0x26d37b=0x0;_0x26d37b<_0x4e59b0[_0x81a1('0x8b')];_0x26d37b++){var _0x3e49d9=_[_0x81a1('0x8c')](_0x511841,function(_0x5cc3fb){return _0x4e59b0[_0x26d37b]?_0x5cc3fb[_0x81a1('0xc')]===_0x4e59b0[_0x26d37b]['name']:null;});if(_0x3e49d9){if(_0x4e59b0[_0x26d37b][_0x81a1('0x8f')]){_0x4580c0[_0x81a1('0x90')](_0x23a249(_0x33277b[_0x81a1('0x11')],_0x4e59b0[_0x26d37b]));}else{if(!_0x4e59b0[_0x26d37b]['autoAssociation']){_0x4580c0['push'](_0x38239f(_0x3e49d9,_0x4e59b0[_0x26d37b],_0x33277b['childModel']));}else{if(_0x3e49d9[_0x81a1('0x9')]){_0x4580c0[_0x81a1('0x90')](_0x4ac0f0(_0x3e49d9,_0x4e59b0[_0x26d37b]));}}}}}return Promise['all'](_0x4580c0);})[_0x81a1('0xa')](function(_0x26a5dc){var _0x26649b=_0x26a5dc;var _0x1856ca=null;if(_0x26649b){_0x1856ca=_0x26649b['length']===0x1?_0x26649b[0x0]:null;}if(!_0x1856ca&&!_0x26649b)return _0xa7f5ec;var _0x5462f6=_0x11b845[_0x33277b['childModel']][_0x81a1('0x91')];_0xe680f3[_0x81a1('0x9')]=_['keys'](_0x5462f6);_0xe680f3['query']=_['keys'](_0x1e2c66[_0x81a1('0x83')]);_0xe680f3[_0x81a1('0x92')]=_[_0x81a1('0x93')](_0xe680f3['model'],_0xe680f3['query']);_0x2d61c5[_0x81a1('0x94')]=_['intersection'](_0xe680f3[_0x81a1('0x9')],qs[_0x81a1('0x95')](_0x1e2c66['query'][_0x81a1('0x95')]));_0x2d61c5[_0x81a1('0x94')]=_0x2d61c5[_0x81a1('0x94')]['length']?_0x2d61c5['attributes']:_0xe680f3['model'];if(!_0x1e2c66[_0x81a1('0x83')][_0x81a1('0x96')](_0x81a1('0x97'))){_0x2d61c5[_0x81a1('0x98')]=qs[_0x81a1('0x98')](_0x1e2c66[_0x81a1('0x83')][_0x81a1('0x98')]);_0x2d61c5[_0x81a1('0x99')]=qs[_0x81a1('0x99')](_0x1e2c66[_0x81a1('0x83')][_0x81a1('0x99')]);}_0x2d61c5[_0x81a1('0x9a')]=qs[_0x81a1('0x9b')](_0x1e2c66[_0x81a1('0x83')][_0x81a1('0x9b')]);_0x2d61c5[_0x81a1('0x81')]=qs['filters'](_[_0x81a1('0x9c')](_0x1e2c66[_0x81a1('0x83')],_0xe680f3[_0x81a1('0x92')]));if(_0x1e2c66[_0x81a1('0x83')][_0x81a1('0x3')]){_0x2d61c5['where']=_[_0x81a1('0x9d')](_0x2d61c5[_0x81a1('0x81')],{'$or':_[_0x81a1('0xb')](_0x5462f6,function(_0x136910){if(_0x136910['type'][_0x81a1('0x9e')]!==_0x81a1('0x9f')){var _0x17ea55={};_0x17ea55[_0x136910[_0x81a1('0x4')]]={'$like':'%'+_0x1e2c66[_0x81a1('0x83')][_0x81a1('0x3')]+'%'};return _0x17ea55;}})});}var _0x5e5fe2=[];var _0x2c5f85=null;var _0x13df41={};if(_0x1856ca){_0x2c5f85=_[_0x81a1('0x8c')](_0x511841,['name',_0x1856ca[_0x81a1('0xc')]]);if(_0x2c5f85[_0x81a1('0x4')]){_0x13df41={};if(_0x33277b[_0x81a1('0x11')]===_0x81a1('0xa0')){_0x13df41[_0x2c5f85[_0x81a1('0xa1')]]=_['map'](_0x1856ca[_0x81a1('0x7')],'id');}else{_0x13df41[_0x2c5f85[_0x81a1('0xa1')]]=_0x1856ca[_0x81a1('0x7')];}_0x5e5fe2[_0x81a1('0x90')](_0x13df41);}else{_0x2d61c5['where']['id']=_0x1856ca['associatedResources'];}}else{for(var _0x230bad=0x0;_0x230bad<_0x26649b[_0x81a1('0x8b')];_0x230bad++){_0x2c5f85=_['find'](_0x511841,[_0x81a1('0xc'),_0x26649b[_0x230bad][_0x81a1('0xc')]]);if(_0x2c5f85[_0x81a1('0x4')]){_0x13df41={};_0x13df41[_0x2c5f85[_0x81a1('0xa1')]]=_0x26649b[_0x230bad][_0x81a1('0x7')];_0x5e5fe2[_0x81a1('0x90')](_0x13df41);}else{if(!_0x2d61c5['where']['id'])_0x2d61c5[_0x81a1('0x81')]['id']=[];_0x26649b[_0x230bad][_0x81a1('0x7')][_0x81a1('0xa2')](function(_0xcc9e1){_0x2d61c5[_0x81a1('0x81')]['id'][_0x81a1('0x90')](_0xcc9e1);});}}}if(!_['isEmpty'](_0x5e5fe2)){_0x2d61c5[_0x81a1('0x81')]=_[_0x81a1('0x9d')](_0x2d61c5[_0x81a1('0x81')],{'$and':{'$or':_0x5e5fe2}});}_0x2d61c5=_[_0x81a1('0x9d')]({},_0x2d61c5,_0x1e2c66[_0x81a1('0xa3')]);if(_0x1856ca&&!_0x1856ca[_0x81a1('0xa4')]&&_0x33277b[_0x81a1('0x11')]===_0x81a1('0xa0')){if(_0x1e2c66[_0x81a1('0x83')]['includeAll']){_0x2d61c5['include']=[{'all':!![]}];}return _0x11b845[_0x33277b[_0x81a1('0x11')]][_0x81a1('0x6')](_0x2d61c5)['then'](function(_0x1afd69){var _0x5f2c05=[];_0x1afd69[_0x81a1('0xa2')](function(_0x39f4cc){var _0x44e443;switch(_0x39f4cc[_0x81a1('0xa5')]){case _0x81a1('0xa6'):_0x44e443=_[_0x81a1('0x8c')](_0x1856ca[_0x81a1('0x7')],function(_0x5f3a29){return _0x5f3a29['id']===_0x39f4cc[_0x81a1('0x74')]&&_0x5f3a29['type']===_0x81a1('0xa7');});break;case _0x81a1('0xa8'):_0x44e443=_[_0x81a1('0x8c')](_0x1856ca['associatedResources'],function(_0x4a276b){return _0x4a276b['id']===_0x39f4cc[_0x81a1('0x74')]&&_0x4a276b[_0x81a1('0xf')]===_0x81a1('0xa9');});break;}if(_0x44e443)_0x5f2c05[_0x81a1('0x90')](_0x39f4cc);});_0xa7f5ec[_0x81a1('0xaa')]=_0x5f2c05[_0x81a1('0x8b')];_0xa7f5ec['rows']=_0x5f2c05;return _0xa7f5ec;});}else{if(!_[_0x81a1('0x8a')](_0x1e2c66[_0x81a1('0x83')][_0x81a1('0xab')])){_0x2d61c5[_0x81a1('0x81')]['id']=_0x2d61c5[_0x81a1('0x81')]['id']?_[_0x81a1('0x93')](_0x2d61c5[_0x81a1('0x81')]['id'],_0x1e2c66[_0x81a1('0x83')][_0x81a1('0xab')]):_0x1e2c66['query'][_0x81a1('0xab')];if(_0x1e2c66[_0x81a1('0x83')][_0x81a1('0xac')]){_0x2d61c5[_0x81a1('0x9a')]=_0x1e2c66[_0x81a1('0x83')][_0x81a1('0xac')];}}if(_0x1e2c66[_0x81a1('0x83')][_0x81a1('0xad')]){_0x2d61c5[_0x81a1('0x81')]=_[_0x81a1('0x9d')](_0x2d61c5[_0x81a1('0x81')],{'$and':_0x1e2c66[_0x81a1('0x83')][_0x81a1('0xad')]});}return _0x11b845[_0x33277b['childModel']][_0x81a1('0xaa')]({'where':_0x2d61c5['where']})['then'](function(_0x59f039){_0xa7f5ec['count']=_0x59f039;if(_0x1e2c66['query'][_0x81a1('0xae')]){if(_0x33277b[_0x81a1('0x11')]==='CmContact'){_0x2d61c5[_0x81a1('0xaf')]=[{'model':_0x11b845[_0x81a1('0x6a')],'as':_0x81a1('0xb0'),'attributes':['id',_0x81a1('0xc'),_0x81a1('0xb1')],'required':_0x1e2c66['query'][_0x81a1('0xb2')]?!![]:![]},{'model':_0x11b845[_0x81a1('0x6a')],'as':_0x81a1('0xb3'),'attributes':['id',_0x81a1('0xc'),_0x81a1('0xb1')],'through':_0x1e2c66['query'][_0x81a1('0xb2')]?{'attributes':[],'where':{'TagId':_0x1e2c66['query'][_0x81a1('0xb2')]||undefined}}:{},'required':_0x1e2c66[_0x81a1('0x83')]['tag']?!![]:![]}];}else{_0x2d61c5[_0x81a1('0xaf')]=[{'all':!![]}];}}return _0x11b845[_0x33277b[_0x81a1('0x11')]]['findAll'](_0x2d61c5);})[_0x81a1('0xa')](function(_0x183e48){_0xa7f5ec[_0x81a1('0xb4')]=_0x183e48;if(_0x5b85ea===_0x81a1('0x2c')&&_0x1e2c66[_0x81a1('0x83')][_0x81a1('0xb5')]===_0x81a1('0xb6')){var _0x110e3d=[];for(var _0x19f677=0x0;_0x19f677<_0xa7f5ec[_0x81a1('0xb4')]['length'];_0x19f677++){_0x110e3d['push'](_0x3d1eb0('chat',_0xa7f5ec[_0x81a1('0xb4')][_0x19f677]['dataValues']));_0x110e3d['push'](_0x3d1eb0(_0x81a1('0xb7'),_0xa7f5ec[_0x81a1('0xb4')][_0x19f677][_0x81a1('0xb8')]));_0x110e3d[_0x81a1('0x90')](_0x3d1eb0(_0x81a1('0xb9'),_0xa7f5ec['rows'][_0x19f677][_0x81a1('0xb8')]));_0x110e3d[_0x81a1('0x90')](_0x3d1eb0(_0x81a1('0xba'),_0xa7f5ec['rows'][_0x19f677][_0x81a1('0xb8')]));_0x110e3d[_0x81a1('0x90')](_0x3d1eb0(_0x81a1('0xbb'),_0xa7f5ec[_0x81a1('0xb4')][_0x19f677][_0x81a1('0xb8')]));_0x110e3d[_0x81a1('0x90')](_0x3d1eb0(_0x81a1('0xbc'),_0xa7f5ec[_0x81a1('0xb4')][_0x19f677]['dataValues']));}return Promise[_0x81a1('0x8e')](_0x110e3d)[_0x81a1('0xa')](function(){return _0xa7f5ec;});}return _0xa7f5ec;});}});}}});}; \ No newline at end of file +var _0x7573=['slice','Sequelize','SELECT','select','InteractionId','ui.createdAt','from','_interactions','where','sequelize','query','toString','OpenTabs','define','UserProfile','user_profiles','mergeResources','Invalid\x20section\x20\x27','isEmpty','push','UserProfileSection','find','params','all','length','ignore','autoAssociation','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','offset','order','key','foreignKey','forEach','includeAll','include','reportType','DefaultReports','reportId','count','rows','ids','customSorting','merge','extraQueryConditions','tag','ThroughTags','true','chat','dataValues','sms','mail','openchannel','whatsapp','./userProfile.attributes','../../components/parsers/qs','exports','filter','field','value','findAll','then','associatedResources','map','model','name','resolve','UserProfileResource','AnalyticExtractedReport','type','catch','toLowerCase','squareprojects','childModel','SquareProject','odbc','squarerecordings','SquareRecording','parentSections','SquareProjects','projectName','projects','JscriptyProject','contacts','CmContact','Lists','ListId','lists','companies','globalcustomfields','CmCustomField','chatqueues','ChatQueue','ChatWebsite','faxqueues','faxaccounts','FaxAccount','inboundroutes','outboundroutes','contexts','VoiceContext','voicemails','VoiceMail','VoiceRecording','Agents','membername','User','role','telephone','VoiceQueues','VoiceQueue','inbound','QueueCampaigns','outbound','VoiceMusicOnHold','VoiceChanSpy','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','Team','voicequeues','queuecampaigns','users','agents','Users','admin','user','Telephones','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','FreshdeskAccount','SugarcrmAccount','DeskAccount','ZohoAccount','vtigeraccounts','cannedanswers','dispositions','Disposition','Dashboard','intervals','Interval','pauses','scheduler','Schedule','sounds','Sound','tags','Tag','templates','Trigger','trunks','Trunk','variables','plugins','Plugin','extractedreports','Reports','metrics','AnalyticMetric','charAt'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7573,0x1ac));var _0x3757=function(_0x5dae8c,_0x298fac){_0x5dae8c=_0x5dae8c-0x0;var _0xdf2bed=_0x7573[_0x5dae8c];return _0xdf2bed;};'use strict';var _=require('lodash');var attributes=require(_0x3757('0x0'));var qs=require(_0x3757('0x1'));var squel=require('squel');module[_0x3757('0x2')]=function(_0x2804d0){var _0x5b9e64=_0x2804d0['models'];function _0x4fb117(_0x4d4a47,_0x139c5d){return new Promise(function(_0x6d1bb5,_0x431c2f){if(!_0x139c5d)return _0x6d1bb5(null);var _0x3c0a70=_0x139c5d[_0x3757('0x3')]?{[_0x139c5d[_0x3757('0x3')][_0x3757('0x4')]]:_0x139c5d[_0x3757('0x3')][_0x3757('0x5')]}:undefined;return _0x5b9e64[_0x4d4a47][_0x3757('0x6')]({'where':_0x3c0a70,'raw':!![]})[_0x3757('0x7')](function(_0x203b1c){_0x139c5d[_0x3757('0x8')]=_[_0x3757('0x9')](_0x203b1c,'id');_0x6d1bb5(_0x139c5d);})['catch'](function(_0x591ead){_0x431c2f(_0x591ead);});});}function _0x2d6cc8(_0x1dcc23,_0x4d8ce2){return new Promise(function(_0x4de354,_0x5d0c3c){var _0x102ee3=_0x1dcc23[_0x3757('0x3')]?{[_0x1dcc23[_0x3757('0x3')][_0x3757('0x4')]]:_0x1dcc23[_0x3757('0x3')][_0x3757('0x5')]}:undefined;return _0x5b9e64[_0x1dcc23[_0x3757('0xa')]][_0x3757('0x6')]({'where':_0x102ee3,'raw':!![]})[_0x3757('0x7')](function(_0x445916){_0x4d8ce2['associatedResources']=_[_0x3757('0x9')](_0x445916,function(_0x7fe7a4){return _0x7fe7a4[_0x3757('0xb')];});_0x4de354(_0x4d8ce2);})['catch'](function(_0x42dbad){_0x5d0c3c(_0x42dbad);});});}function _0x28414e(_0xced381,_0x3960a7,_0x154792){if(!_0x3960a7)return Promise[_0x3757('0xc')](null);return new Promise(function(_0x3c9afe,_0x181cb6){return _0x5b9e64[_0x3757('0xd')]['findAll']({'where':{'sectionId':_0x3960a7['id']},'raw':!![]})[_0x3757('0x7')](function(_0x4b6c24){if(_0xced381['field']&&_0xced381[_0x3757('0x4')]!=='id'){_0x3960a7[_0x3757('0x8')]=_[_0x3757('0x9')](_0x4b6c24,function(_0x5aae05){return _0x5aae05[_0xced381['field']];});}else{if(_0x154792===_0x3757('0xe')){_0x3960a7[_0x3757('0x8')]=_[_0x3757('0x9')](_0x4b6c24,function(_0x43d4a6){return{'id':_0x43d4a6['resourceId'],'type':_0x43d4a6[_0x3757('0xf')]};});}else{_0x3960a7['associatedResources']=_[_0x3757('0x9')](_0x4b6c24,function(_0x4e5fc5){return _0x4e5fc5['resourceId'];});}}_0x3c9afe(_0x3960a7);})[_0x3757('0x10')](function(_0x5e490b){_0x181cb6(_0x5e490b);});});}function _0x5cebee(_0x4d4384,_0x104586){var _0x2bc734={'parentSections':[]};switch(_0x4d4384[_0x3757('0x11')]()){case _0x3757('0x12'):_0x2bc734[_0x3757('0x13')]=_0x3757('0x14');break;case _0x3757('0x15'):_0x2bc734[_0x3757('0x13')]='SquareOdbc';break;case _0x3757('0x16'):_0x2bc734[_0x3757('0x13')]=_0x3757('0x17');_0x2bc734[_0x3757('0x18')]=[{'name':_0x3757('0x19'),'field':_0x3757('0xb'),'foreignKey':_0x3757('0x1a')}];break;case _0x3757('0x1b'):_0x2bc734[_0x3757('0x13')]=_0x3757('0x1c');break;case _0x3757('0x1d'):_0x2bc734[_0x3757('0x13')]=_0x3757('0x1e');_0x2bc734['parentSections']=[{'name':_0x3757('0x1f'),'field':'id','foreignKey':_0x3757('0x20')}];break;case _0x3757('0x21'):_0x2bc734[_0x3757('0x13')]='CmList';break;case _0x3757('0x22'):_0x2bc734['childModel']='CmCompany';break;case _0x3757('0x23'):_0x2bc734[_0x3757('0x13')]=_0x3757('0x24');break;case _0x3757('0x25'):_0x2bc734[_0x3757('0x13')]=_0x3757('0x26');break;case'chatwebsites':_0x2bc734[_0x3757('0x13')]=_0x3757('0x27');break;case _0x3757('0x28'):_0x2bc734[_0x3757('0x13')]='FaxQueue';break;case _0x3757('0x29'):_0x2bc734[_0x3757('0x13')]=_0x3757('0x2a');break;case _0x3757('0x2b'):case'internalroutes':case _0x3757('0x2c'):_0x2bc734[_0x3757('0x13')]='VoiceExtension';break;case _0x3757('0x2d'):_0x2bc734[_0x3757('0x13')]=_0x3757('0x2e');break;case _0x3757('0x2f'):_0x2bc734[_0x3757('0x13')]=_0x3757('0x30');break;case'voicerecordings':_0x2bc734['childModel']=_0x3757('0x31');_0x2bc734[_0x3757('0x18')]=[{'name':_0x3757('0x32'),'field':'name','foreignKey':_0x3757('0x33'),'model':_0x3757('0x34'),'filter':{'field':_0x3757('0x35'),'value':['agent']}},{'name':'Telephones','field':_0x3757('0xb'),'foreignKey':'membername','model':_0x3757('0x34'),'filter':{'field':'role','value':[_0x3757('0x36')]}},{'name':_0x3757('0x37'),'field':_0x3757('0xb'),'foreignKey':'queue','model':_0x3757('0x38'),'filter':{'field':_0x3757('0xf'),'value':[_0x3757('0x39')]}},{'name':_0x3757('0x3a'),'field':_0x3757('0xb'),'foreignKey':'queue','model':_0x3757('0x38'),'filter':{'field':_0x3757('0xf'),'value':[_0x3757('0x3b')]}}];break;case'musiconholds':_0x2bc734[_0x3757('0x13')]=_0x3757('0x3c');break;case'chanspies':_0x2bc734[_0x3757('0x13')]=_0x3757('0x3d');break;case'voiceprefixes':_0x2bc734[_0x3757('0x13')]=_0x3757('0x3e');break;case _0x3757('0x3f'):_0x2bc734[_0x3757('0x13')]=_0x3757('0x40');break;case _0x3757('0x41'):_0x2bc734['childModel']=_0x3757('0x42');break;case _0x3757('0x43'):_0x2bc734[_0x3757('0x13')]='MailAccount';break;case _0x3757('0x44'):_0x2bc734[_0x3757('0x13')]=_0x3757('0x45');break;case _0x3757('0x46'):_0x2bc734[_0x3757('0x13')]=_0x3757('0x47');break;case _0x3757('0x48'):_0x2bc734[_0x3757('0x13')]=_0x3757('0x49');break;case'smsqueues':_0x2bc734[_0x3757('0x13')]=_0x3757('0x4a');break;case _0x3757('0x4b'):_0x2bc734[_0x3757('0x13')]=_0x3757('0x4c');break;case _0x3757('0x4d'):_0x2bc734['childModel']=_0x3757('0x4e');break;case _0x3757('0x4f'):_0x2bc734['childModel']=_0x3757('0x50');break;case'teams':_0x2bc734['childModel']=_0x3757('0x51');break;case _0x3757('0x52'):case _0x3757('0x53'):_0x2bc734[_0x3757('0x13')]=_0x3757('0x38');if(_0x104586){_0x2bc734[_0x3757('0x18')]=[{'name':_0x3757('0x37')},{'name':'QueueCampaigns'}];}break;case _0x3757('0x54'):case _0x3757('0x55'):case'telephones':_0x2bc734[_0x3757('0x13')]=_0x3757('0x34');if(_0x104586){_0x2bc734[_0x3757('0x18')]=[{'name':_0x3757('0x56'),'filter':{'field':_0x3757('0x35'),'value':[_0x3757('0x57'),_0x3757('0x58')]},'ignore':!![]},{'name':_0x3757('0x32')},{'name':_0x3757('0x59')}];}break;case _0x3757('0x5a'):_0x2bc734[_0x3757('0x13')]=_0x3757('0x5b');break;case _0x3757('0x5c'):_0x2bc734[_0x3757('0x13')]=_0x3757('0x5d');break;case'freshdeskaccounts':_0x2bc734[_0x3757('0x13')]=_0x3757('0x5e');break;case'sugarcrmaccounts':_0x2bc734[_0x3757('0x13')]=_0x3757('0x5f');break;case'deskaccounts':_0x2bc734[_0x3757('0x13')]=_0x3757('0x60');break;case'zohoaccounts':_0x2bc734['childModel']=_0x3757('0x61');break;case _0x3757('0x62'):_0x2bc734[_0x3757('0x13')]=_0x3757('0x34');break;case _0x3757('0x63'):_0x2bc734[_0x3757('0x13')]='CannedAnswer';break;case _0x3757('0x64'):_0x2bc734[_0x3757('0x13')]=_0x3757('0x65');break;case'customdashboards':_0x2bc734[_0x3757('0x13')]=_0x3757('0x66');break;case _0x3757('0x67'):_0x2bc734[_0x3757('0x13')]=_0x3757('0x68');break;case _0x3757('0x69'):_0x2bc734[_0x3757('0x13')]='Pause';break;case _0x3757('0x6a'):_0x2bc734[_0x3757('0x13')]=_0x3757('0x6b');break;case _0x3757('0x6c'):_0x2bc734[_0x3757('0x13')]=_0x3757('0x6d');break;case _0x3757('0x6e'):_0x2bc734[_0x3757('0x13')]=_0x3757('0x6f');break;case _0x3757('0x70'):_0x2bc734[_0x3757('0x13')]='Template';break;case'triggers':_0x2bc734[_0x3757('0x13')]=_0x3757('0x71');break;case _0x3757('0x72'):_0x2bc734[_0x3757('0x13')]=_0x3757('0x73');break;case _0x3757('0x74'):_0x2bc734['childModel']='Variable';break;case _0x3757('0x75'):_0x2bc734[_0x3757('0x13')]=_0x3757('0x76');break;case _0x3757('0x77'):_0x2bc734[_0x3757('0x13')]=_0x3757('0xe');_0x2bc734[_0x3757('0x18')]=[{'name':_0x3757('0x78'),'field':'id','foreignKey':'reportId'}];break;case _0x3757('0x79'):_0x2bc734[_0x3757('0x13')]=_0x3757('0x7a');break;}return _0x2bc734;}function _0x1f8917(_0x387cb1,_0x18e3f4){var _0x27fd6d=_0x387cb1[_0x3757('0x7b')](0x0)['toUpperCase']()+_0x387cb1[_0x3757('0x7c')](0x1);var _0x55e054={'type':_0x5b9e64[_0x3757('0x7d')]['QueryTypes'][_0x3757('0x7e')],'raw':!![]};return new Promise(function(_0x563cdb,_0x921360){var _0x21f40a=squel[_0x3757('0x7f')]()[_0x3757('0x4')]('ui.'+_0x27fd6d+_0x3757('0x80'),'id')[_0x3757('0x4')](_0x3757('0x81'))[_0x3757('0x82')]('user_has_'+_0x387cb1+_0x3757('0x83'),'ui')[_0x3757('0x84')]('ui.UserId\x20=\x20?',_0x18e3f4['id']);return _0x5b9e64[_0x3757('0x85')][_0x3757('0x86')](_0x21f40a[_0x3757('0x87')](),_0x55e054)['then'](function(_0x206f50){_0x18e3f4[_0x27fd6d+_0x3757('0x88')]=_0x206f50;_0x563cdb(_0x206f50);})[_0x3757('0x10')](function(_0x476ea0){_0x921360(_0x476ea0);});});}return _0x2804d0[_0x3757('0x89')](_0x3757('0x8a'),attributes,{'tableName':_0x3757('0x8b'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x5719fe){var _0x5e6d2e={'raw':_0x5719fe[_0x3757('0x86')]['raw'],'where':{}};var _0x5d5153={};var _0x48795e={'count':0x0,'rows':[]};var _0x57c326=_0x5719fe[_0x3757('0x86')]['section'];var _0x5f26b1=_0x5719fe['query'][_0x3757('0x8c')]||![];var _0x57a23b=_0x5cebee(_0x57c326,_0x5f26b1);if(!_0x57a23b[_0x3757('0x13')])throw new Error(_0x3757('0x8d')+_0x57c326+'\x27');var _0x2f22a3=[{'name':_0x57c326}];if(!_[_0x3757('0x8e')](_0x57a23b[_0x3757('0x18')]))_0x2f22a3=_0x57a23b['parentSections'];var _0x21290f=[];for(var _0x54acde=0x0;_0x54acde<_0x2f22a3['length'];_0x54acde++){_0x21290f[_0x3757('0x8f')](_0x5b9e64[_0x3757('0x90')][_0x3757('0x91')]({'where':{'userProfileId':_0x5719fe[_0x3757('0x92')]['id'],'name':_0x2f22a3[_0x54acde][_0x3757('0xb')]},'raw':!![]}));}return Promise[_0x3757('0x93')](_0x21290f)['then'](function(_0x30e9b3){var _0x4d6857=_[_0x3757('0x3')](_0x30e9b3,function(_0x4d9320){return _0x4d9320?_0x4d9320:undefined;});var _0x21e9dd=_['filter'](_0x2f22a3,['ignore',!![]]);var _0x37328b=_[_0x3757('0x8e')](_0x4d6857)&&_[_0x3757('0x8e')](_0x21e9dd)?null:_['union'](_0x21e9dd,_0x4d6857);if(!_0x37328b)return null;var _0x142c53=[];for(var _0x46f4a8=0x0;_0x46f4a8<_0x37328b[_0x3757('0x94')];_0x46f4a8++){var _0x78c811=_[_0x3757('0x91')](_0x2f22a3,function(_0x39b066){return _0x37328b[_0x46f4a8]?_0x39b066[_0x3757('0xb')]===_0x37328b[_0x46f4a8][_0x3757('0xb')]:null;});if(_0x78c811){if(_0x37328b[_0x46f4a8][_0x3757('0x95')]){_0x142c53['push'](_0x4fb117(_0x57a23b['childModel'],_0x37328b[_0x46f4a8]));}else{if(!_0x37328b[_0x46f4a8][_0x3757('0x96')]){_0x142c53[_0x3757('0x8f')](_0x28414e(_0x78c811,_0x37328b[_0x46f4a8],_0x57a23b[_0x3757('0x13')]));}else{if(_0x78c811['model']){_0x142c53[_0x3757('0x8f')](_0x2d6cc8(_0x78c811,_0x37328b[_0x46f4a8]));}}}}}return Promise[_0x3757('0x93')](_0x142c53);})[_0x3757('0x7')](function(_0x5e1016){var _0x22475b=_0x5e1016;var _0x13a226=null;if(_0x22475b){_0x13a226=_0x22475b['length']===0x1?_0x22475b[0x0]:null;}if(!_0x13a226&&!_0x22475b)return _0x48795e;var _0x305a2d=_0x5b9e64[_0x57a23b[_0x3757('0x13')]]['rawAttributes'];_0x5d5153['model']=_[_0x3757('0x97')](_0x305a2d);_0x5d5153[_0x3757('0x86')]=_['keys'](_0x5719fe[_0x3757('0x86')]);_0x5d5153[_0x3757('0x98')]=_['intersection'](_0x5d5153[_0x3757('0xa')],_0x5d5153[_0x3757('0x86')]);_0x5e6d2e['attributes']=_[_0x3757('0x99')](_0x5d5153['model'],qs[_0x3757('0x9a')](_0x5719fe['query'][_0x3757('0x9a')]));_0x5e6d2e[_0x3757('0x9b')]=_0x5e6d2e['attributes']['length']?_0x5e6d2e['attributes']:_0x5d5153[_0x3757('0xa')];if(!_0x5719fe['query'][_0x3757('0x9c')](_0x3757('0x9d'))){_0x5e6d2e[_0x3757('0x9e')]=qs['limit'](_0x5719fe[_0x3757('0x86')][_0x3757('0x9e')]);_0x5e6d2e[_0x3757('0x9f')]=qs[_0x3757('0x9f')](_0x5719fe['query'][_0x3757('0x9f')]);}_0x5e6d2e[_0x3757('0xa0')]=qs['sort'](_0x5719fe[_0x3757('0x86')]['sort']);_0x5e6d2e['where']=qs['filters'](_['pick'](_0x5719fe['query'],_0x5d5153[_0x3757('0x98')]));if(_0x5719fe[_0x3757('0x86')][_0x3757('0x3')]){_0x5e6d2e['where']=_['merge'](_0x5e6d2e[_0x3757('0x84')],{'$or':_[_0x3757('0x9')](_0x305a2d,function(_0x3209b0){if(_0x3209b0[_0x3757('0xf')][_0x3757('0xa1')]!=='VIRTUAL'){var _0x63eda8={};_0x63eda8[_0x3209b0[_0x3757('0x4')]]={'$like':'%'+_0x5719fe[_0x3757('0x86')][_0x3757('0x3')]+'%'};return _0x63eda8;}})});}var _0x23776e=[];var _0x15a942=null;var _0x8ba6ef={};if(_0x13a226){_0x15a942=_[_0x3757('0x91')](_0x2f22a3,['name',_0x13a226[_0x3757('0xb')]]);if(_0x15a942[_0x3757('0x4')]){_0x8ba6ef={};if(_0x57a23b['childModel']==='AnalyticExtractedReport'){_0x8ba6ef[_0x15a942[_0x3757('0xa2')]]=_[_0x3757('0x9')](_0x13a226[_0x3757('0x8')],'id');}else{_0x8ba6ef[_0x15a942[_0x3757('0xa2')]]=_0x13a226[_0x3757('0x8')];}_0x23776e[_0x3757('0x8f')](_0x8ba6ef);}else{_0x5e6d2e[_0x3757('0x84')]['id']=_0x13a226[_0x3757('0x8')];}}else{for(var _0x348d50=0x0;_0x348d50<_0x22475b[_0x3757('0x94')];_0x348d50++){_0x15a942=_['find'](_0x2f22a3,[_0x3757('0xb'),_0x22475b[_0x348d50][_0x3757('0xb')]]);if(_0x15a942[_0x3757('0x4')]){_0x8ba6ef={};_0x8ba6ef[_0x15a942['foreignKey']]=_0x22475b[_0x348d50][_0x3757('0x8')];_0x23776e[_0x3757('0x8f')](_0x8ba6ef);}else{if(!_0x5e6d2e[_0x3757('0x84')]['id'])_0x5e6d2e['where']['id']=[];_0x22475b[_0x348d50][_0x3757('0x8')][_0x3757('0xa3')](function(_0x522963){_0x5e6d2e[_0x3757('0x84')]['id']['push'](_0x522963);});}}}if(!_[_0x3757('0x8e')](_0x23776e)){_0x5e6d2e[_0x3757('0x84')]=_['merge'](_0x5e6d2e[_0x3757('0x84')],{'$and':{'$or':_0x23776e}});}_0x5e6d2e=_['merge']({},_0x5e6d2e,_0x5719fe['options']);if(_0x13a226&&!_0x13a226[_0x3757('0x96')]&&_0x57a23b[_0x3757('0x13')]===_0x3757('0xe')){if(_0x5719fe[_0x3757('0x86')][_0x3757('0xa4')]){_0x5e6d2e[_0x3757('0xa5')]=[{'all':!![]}];}return _0x5b9e64[_0x57a23b[_0x3757('0x13')]][_0x3757('0x6')](_0x5e6d2e)[_0x3757('0x7')](function(_0x2b1659){var _0x5f4df4=[];_0x2b1659[_0x3757('0xa3')](function(_0x1d458b){var _0x24c07c;switch(_0x1d458b[_0x3757('0xa6')]){case'default':_0x24c07c=_['find'](_0x13a226[_0x3757('0x8')],function(_0x43d6dc){return _0x43d6dc['id']===_0x1d458b['reportId']&&_0x43d6dc[_0x3757('0xf')]===_0x3757('0xa7');});break;case'custom':_0x24c07c=_[_0x3757('0x91')](_0x13a226['associatedResources'],function(_0x360c00){return _0x360c00['id']===_0x1d458b[_0x3757('0xa8')]&&_0x360c00[_0x3757('0xf')]==='CustomReports';});break;}if(_0x24c07c)_0x5f4df4[_0x3757('0x8f')](_0x1d458b);});_0x48795e[_0x3757('0xa9')]=_0x5f4df4[_0x3757('0x94')];_0x48795e[_0x3757('0xaa')]=_0x5f4df4;return _0x48795e;});}else{if(!_['isEmpty'](_0x5719fe[_0x3757('0x86')]['ids'])){_0x5e6d2e[_0x3757('0x84')]['id']=_0x5e6d2e[_0x3757('0x84')]['id']?_[_0x3757('0x99')](_0x5e6d2e[_0x3757('0x84')]['id'],_0x5719fe[_0x3757('0x86')][_0x3757('0xab')]):_0x5719fe[_0x3757('0x86')][_0x3757('0xab')];if(_0x5719fe[_0x3757('0x86')][_0x3757('0xac')]){_0x5e6d2e[_0x3757('0xa0')]=_0x5719fe[_0x3757('0x86')][_0x3757('0xac')];}}if(_0x5719fe['query']['extraQueryConditions']){_0x5e6d2e[_0x3757('0x84')]=_[_0x3757('0xad')](_0x5e6d2e[_0x3757('0x84')],{'$and':_0x5719fe[_0x3757('0x86')][_0x3757('0xae')]});}return _0x5b9e64[_0x57a23b['childModel']][_0x3757('0xa9')]({'where':_0x5e6d2e[_0x3757('0x84')]})[_0x3757('0x7')](function(_0x27039f){_0x48795e[_0x3757('0xa9')]=_0x27039f;if(_0x5719fe[_0x3757('0x86')][_0x3757('0xa4')]){if(_0x57a23b['childModel']===_0x3757('0x1e')){_0x5e6d2e[_0x3757('0xa5')]=[{'model':_0x5b9e64['Tag'],'as':'Tags','attributes':['id','name','color'],'required':_0x5719fe[_0x3757('0x86')][_0x3757('0xaf')]?!![]:![]},{'model':_0x5b9e64[_0x3757('0x6f')],'as':_0x3757('0xb0'),'attributes':['id','name','color'],'through':_0x5719fe[_0x3757('0x86')][_0x3757('0xaf')]?{'attributes':[],'where':{'TagId':_0x5719fe[_0x3757('0x86')]['tag']||undefined}}:{},'required':_0x5719fe['query'][_0x3757('0xaf')]?!![]:![]}];}else{_0x5e6d2e[_0x3757('0xa5')]=[{'all':!![]}];}}return _0x5b9e64[_0x57a23b[_0x3757('0x13')]][_0x3757('0x6')](_0x5e6d2e);})[_0x3757('0x7')](function(_0x180ba0){_0x48795e[_0x3757('0xaa')]=_0x180ba0;if(_0x57c326===_0x3757('0x32')&&_0x5719fe[_0x3757('0x86')]['openTabs']===_0x3757('0xb1')){var _0x34cddb=[];for(var _0x15ae5f=0x0;_0x15ae5f<_0x48795e['rows'][_0x3757('0x94')];_0x15ae5f++){_0x34cddb[_0x3757('0x8f')](_0x1f8917(_0x3757('0xb2'),_0x48795e[_0x3757('0xaa')][_0x15ae5f][_0x3757('0xb3')]));_0x34cddb[_0x3757('0x8f')](_0x1f8917(_0x3757('0xb4'),_0x48795e[_0x3757('0xaa')][_0x15ae5f][_0x3757('0xb3')]));_0x34cddb[_0x3757('0x8f')](_0x1f8917('fax',_0x48795e[_0x3757('0xaa')][_0x15ae5f][_0x3757('0xb3')]));_0x34cddb[_0x3757('0x8f')](_0x1f8917(_0x3757('0xb5'),_0x48795e[_0x3757('0xaa')][_0x15ae5f][_0x3757('0xb3')]));_0x34cddb[_0x3757('0x8f')](_0x1f8917(_0x3757('0xb6'),_0x48795e[_0x3757('0xaa')][_0x15ae5f][_0x3757('0xb3')]));_0x34cddb[_0x3757('0x8f')](_0x1f8917(_0x3757('0xb7'),_0x48795e[_0x3757('0xaa')][_0x15ae5f][_0x3757('0xb3')]));}return Promise['all'](_0x34cddb)[_0x3757('0x7')](function(){return _0x48795e;});}return _0x48795e;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 1a96169..ffe055c 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 _0xaaee=['redis','defaults','localhost','./userProfile.socket','then','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x2232b2,_0x4404a7){var _0x4871e0=function(_0x50d6ee){while(--_0x50d6ee){_0x2232b2['push'](_0x2232b2['shift']());}};_0x4871e0(++_0x4404a7);}(_0xaaee,0x132));var _0xeaae=function(_0x2de633,_0x3ce734){_0x2de633=_0x2de633-0x0;var _0x3f18dd=_0xaaee[_0x2de633];return _0x3f18dd;};'use strict';var _=require(_0xeaae('0x0'));var util=require(_0xeaae('0x1'));var moment=require(_0xeaae('0x2'));var BPromise=require(_0xeaae('0x3'));var rs=require(_0xeaae('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xeaae('0x5'))['db'];var utils=require(_0xeaae('0x6'));var logger=require(_0xeaae('0x7'))(_0xeaae('0x8'));var config=require(_0xeaae('0x9'));var jayson=require(_0xeaae('0xa'));var client=jayson[_0xeaae('0xb')][_0xeaae('0xc')]({'port':0x232a});config[_0xeaae('0xd')]=_[_0xeaae('0xe')](config[_0xeaae('0xd')],{'host':_0xeaae('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xeaae('0xd')]));require(_0xeaae('0x10'))['register'](socket);function respondWithRpcPromise(_0x149943,_0x295a9a,_0xc3570c){return new BPromise(function(_0x435340,_0x484be3){return client['request'](_0x149943,_0xc3570c)[_0xeaae('0x11')](function(_0x465002){logger['info'](_0xeaae('0x12'),_0x295a9a,_0xeaae('0x13'));logger[_0xeaae('0x14')](_0xeaae('0x15'),_0x295a9a,'request\x20sent',JSON[_0xeaae('0x16')](_0x465002));if(_0x465002['error']){if(_0x465002[_0xeaae('0x17')][_0xeaae('0x18')]===0x1f4){logger[_0xeaae('0x17')](_0xeaae('0x12'),_0x295a9a,_0x465002[_0xeaae('0x17')][_0xeaae('0x19')]);return _0x484be3(_0x465002[_0xeaae('0x17')][_0xeaae('0x19')]);}logger[_0xeaae('0x17')](_0xeaae('0x12'),_0x295a9a,_0x465002[_0xeaae('0x17')][_0xeaae('0x19')]);return _0x435340(_0x465002[_0xeaae('0x17')]['message']);}else{logger[_0xeaae('0x1a')]('UserProfile,\x20%s,\x20%s',_0x295a9a,_0xeaae('0x13'));_0x435340(_0x465002[_0xeaae('0x1b')][_0xeaae('0x19')]);}})[_0xeaae('0x1c')](function(_0x5ec06e){logger[_0xeaae('0x17')](_0xeaae('0x12'),_0x295a9a,_0x5ec06e);_0x484be3(_0x5ec06e);});});} \ No newline at end of file +var _0x27eb=['localhost','./userProfile.socket','register','UserProfile,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults'];(function(_0x2fdf82,_0x322e7c){var _0x2382f5=function(_0x4d6951){while(--_0x4d6951){_0x2fdf82['push'](_0x2fdf82['shift']());}};_0x2382f5(++_0x322e7c);}(_0x27eb,0xd0));var _0xb27e=function(_0x5edac4,_0x4957f7){_0x5edac4=_0x5edac4-0x0;var _0x4f31de=_0x27eb[_0x5edac4];return _0x4f31de;};'use strict';var _=require(_0xb27e('0x0'));var util=require(_0xb27e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb27e('0x2'));var fs=require('fs');var Redis=require(_0xb27e('0x3'));var db=require(_0xb27e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb27e('0x5'))(_0xb27e('0x6'));var config=require(_0xb27e('0x7'));var jayson=require(_0xb27e('0x8'));var client=jayson['client'][_0xb27e('0x9')]({'port':0x232a});config[_0xb27e('0xa')]=_[_0xb27e('0xb')](config[_0xb27e('0xa')],{'host':_0xb27e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb27e('0xa')]));require(_0xb27e('0xd'))[_0xb27e('0xe')](socket);function respondWithRpcPromise(_0x2e9752,_0x26ea1f,_0x51a872){return new BPromise(function(_0x2b7bdc,_0x11bd85){return client['request'](_0x2e9752,_0x51a872)['then'](function(_0x38a41d){logger['info'](_0xb27e('0xf'),_0x26ea1f,_0xb27e('0x10'));logger['debug']('UserProfile,\x20%s,\x20%s,\x20%s',_0x26ea1f,'request\x20sent',JSON[_0xb27e('0x11')](_0x38a41d));if(_0x38a41d['error']){if(_0x38a41d[_0xb27e('0x12')]['code']===0x1f4){logger[_0xb27e('0x12')]('UserProfile,\x20%s,\x20%s',_0x26ea1f,_0x38a41d[_0xb27e('0x12')][_0xb27e('0x13')]);return _0x11bd85(_0x38a41d[_0xb27e('0x12')]['message']);}logger[_0xb27e('0x12')](_0xb27e('0xf'),_0x26ea1f,_0x38a41d[_0xb27e('0x12')][_0xb27e('0x13')]);return _0x2b7bdc(_0x38a41d[_0xb27e('0x12')][_0xb27e('0x13')]);}else{logger[_0xb27e('0x14')](_0xb27e('0xf'),_0x26ea1f,_0xb27e('0x10'));_0x2b7bdc(_0x38a41d['result'][_0xb27e('0x13')]);}})[_0xb27e('0x15')](function(_0x26bbf9){logger['error'](_0xb27e('0xf'),_0x26ea1f,_0x26bbf9);_0x11bd85(_0x26bbf9);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index eebc311..193354b 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 _0x058c=['remove','emit','register','length','./userProfile.events','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x058c,0xac));var _0xc058=function(_0x1fcfb5,_0x1a6f75){_0x1fcfb5=_0x1fcfb5-0x0;var _0x29868c=_0x058c[_0x1fcfb5];return _0x29868c;};'use strict';var UserProfileEvents=require(_0xc058('0x0'));var events=[_0xc058('0x1'),_0xc058('0x2'),'update'];function createListener(_0x5e902a,_0x158d10){return function(_0xc427d2){_0x158d10[_0xc058('0x3')](_0x5e902a,_0xc427d2);};}function removeListener(_0x5665ed,_0x5cf74e){return function(){UserProfileEvents['removeListener'](_0x5665ed,_0x5cf74e);};}exports[_0xc058('0x4')]=function(_0x2bab03){for(var _0x46f901=0x0,_0x142580=events[_0xc058('0x5')];_0x46f901<_0x142580;_0x46f901++){var _0x5f69f3=events[_0x46f901];var _0x39220e=createListener('userProfile:'+_0x5f69f3,_0x2bab03);UserProfileEvents['on'](_0x5f69f3,_0x39220e);}}; \ No newline at end of file +var _0xc092=['./userProfile.events','remove','update','emit','removeListener','register','length','userProfile:'];(function(_0x3ad1ee,_0x128466){var _0x5c0ea4=function(_0x5725b1){while(--_0x5725b1){_0x3ad1ee['push'](_0x3ad1ee['shift']());}};_0x5c0ea4(++_0x128466);}(_0xc092,0x168));var _0x2c09=function(_0x1eaa3e,_0x1e9065){_0x1eaa3e=_0x1eaa3e-0x0;var _0xfdc7d0=_0xc092[_0x1eaa3e];return _0xfdc7d0;};'use strict';var UserProfileEvents=require(_0x2c09('0x0'));var events=['save',_0x2c09('0x1'),_0x2c09('0x2')];function createListener(_0x105331,_0x5dbf16){return function(_0x23948c){_0x5dbf16[_0x2c09('0x3')](_0x105331,_0x23948c);};}function removeListener(_0x51f102,_0x27205e){return function(){UserProfileEvents[_0x2c09('0x4')](_0x51f102,_0x27205e);};}exports[_0x2c09('0x5')]=function(_0x3a6d8a){for(var _0x10df55=0x0,_0x2d1cb2=events[_0x2c09('0x6')];_0x10df55<_0x2d1cb2;_0x10df55++){var _0x1858d0=events[_0x10df55];var _0x354b18=createListener(_0x2c09('0x7')+_0x1858d0,_0x3a6d8a);UserProfileEvents['on'](_0x1858d0,_0x354b18);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 3ae0df5..3597297 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 _0x8cdc=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./userProfileResource.controller','isAuthenticated','get','/describe','describe','post','create','put','/:id'];(function(_0x145f2a,_0x4ada83){var _0x592b89=function(_0x3ad8bf){while(--_0x3ad8bf){_0x145f2a['push'](_0x145f2a['shift']());}};_0x592b89(++_0x4ada83);}(_0x8cdc,0x1d2));var _0xc8cd=function(_0x50b3f3,_0x1824d2){_0x50b3f3=_0x50b3f3-0x0;var _0x14774a=_0x8cdc[_0x50b3f3];return _0x14774a;};'use strict';var multer=require(_0xc8cd('0x0'));var util=require(_0xc8cd('0x1'));var path=require(_0xc8cd('0x2'));var timeout=require(_0xc8cd('0x3'));var express=require(_0xc8cd('0x4'));var router=express[_0xc8cd('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xc8cd('0x6'));var config=require(_0xc8cd('0x7'));var controller=require(_0xc8cd('0x8'));router['get']('/',auth[_0xc8cd('0x9')](),controller['index']);router[_0xc8cd('0xa')](_0xc8cd('0xb'),auth[_0xc8cd('0x9')](),controller[_0xc8cd('0xc')]);router['get']('/:id',auth[_0xc8cd('0x9')](),controller['show']);router[_0xc8cd('0xd')]('/',auth[_0xc8cd('0x9')](),controller[_0xc8cd('0xe')]);router[_0xc8cd('0xf')](_0xc8cd('0x10'),auth[_0xc8cd('0x9')](),controller[_0xc8cd('0x11')]);router[_0xc8cd('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xc8cd('0x13')]);module[_0xc8cd('0x14')]=router; \ No newline at end of file +var _0x9056=['post','create','put','/:id','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe'];(function(_0x574dd7,_0x5a10b4){var _0x587cfa=function(_0xa52af9){while(--_0xa52af9){_0x574dd7['push'](_0x574dd7['shift']());}};_0x587cfa(++_0x5a10b4);}(_0x9056,0xa7));var _0x6905=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9056[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x6905('0x0'));var path=require(_0x6905('0x1'));var timeout=require(_0x6905('0x2'));var express=require('express');var router=express[_0x6905('0x3')]();var fs_extra=require(_0x6905('0x4'));var auth=require(_0x6905('0x5'));var interaction=require(_0x6905('0x6'));var config=require(_0x6905('0x7'));var controller=require('./userProfileResource.controller');router[_0x6905('0x8')]('/',auth[_0x6905('0x9')](),controller[_0x6905('0xa')]);router[_0x6905('0x8')](_0x6905('0xb'),auth['isAuthenticated'](),controller[_0x6905('0xc')]);router['get']('/:id',auth[_0x6905('0x9')](),controller['show']);router[_0x6905('0xd')]('/',auth['isAuthenticated'](),controller[_0x6905('0xe')]);router[_0x6905('0xf')](_0x6905('0x10'),auth[_0x6905('0x9')](),controller['update']);router[_0x6905('0x11')](_0x6905('0x10'),auth['isAuthenticated'](),controller[_0x6905('0x12')]);module[_0x6905('0x13')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 0a40220..47a40ba 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 _0x1fc9=['STRING','INTEGER','sequelize','exports'];(function(_0xafa642,_0x562029){var _0x503748=function(_0x223df3){while(--_0x223df3){_0xafa642['push'](_0xafa642['shift']());}};_0x503748(++_0x562029);}(_0x1fc9,0x152));var _0x91fc=function(_0x2f0e13,_0xd0c688){_0x2f0e13=_0x2f0e13-0x0;var _0x4410b0=_0x1fc9[_0x2f0e13];return _0x4410b0;};'use strict';var Sequelize=require(_0x91fc('0x0'));module[_0x91fc('0x1')]={'name':{'type':Sequelize[_0x91fc('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x91fc('0x3')],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xc4c6=['exports','INTEGER','STRING','sequelize'];(function(_0x190a1b,_0x18e6a7){var _0x419d2c=function(_0x26c57e){while(--_0x26c57e){_0x190a1b['push'](_0x190a1b['shift']());}};_0x419d2c(++_0x18e6a7);}(_0xc4c6,0xe3));var _0x6c4c=function(_0xbdaf3e,_0x26faf4){_0xbdaf3e=_0xbdaf3e-0x0;var _0x269556=_0xc4c6[_0xbdaf3e];return _0x269556;};'use strict';var Sequelize=require(_0x6c4c('0x0'));module[_0x6c4c('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0x6c4c('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x6c4c('0x3')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index c6ed073..93f8399 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 _0xef0f=['json','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','UserProfileResource','key','model','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','params','keys','rawAttributes','find','create','body','catch','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range'];(function(_0x492262,_0x103adf){var _0x35100a=function(_0x2249a6){while(--_0x2249a6){_0x492262['push'](_0x492262['shift']());}};_0x35100a(++_0x103adf);}(_0xef0f,0x168));var _0xfef0=function(_0x546a89,_0x5a299b){_0x546a89=_0x546a89-0x0;var _0x2baafd=_0xef0f[_0x546a89];return _0x2baafd;};'use strict';var emlformat=require(_0xfef0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfef0('0x1'));var jsonpatch=require(_0xfef0('0x2'));var rp=require(_0xfef0('0x3'));var moment=require('moment');var BPromise=require(_0xfef0('0x4'));var Mustache=require(_0xfef0('0x5'));var util=require(_0xfef0('0x6'));var path=require('path');var sox=require(_0xfef0('0x7'));var csv=require(_0xfef0('0x8'));var ejs=require(_0xfef0('0x9'));var fs=require('fs');var fs_extra=require(_0xfef0('0xa'));var _=require(_0xfef0('0xb'));var squel=require(_0xfef0('0xc'));var crypto=require('crypto');var jsforce=require(_0xfef0('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xfef0('0x8'));var querystring=require(_0xfef0('0xe'));var Papa=require(_0xfef0('0xf'));var Redis=require(_0xfef0('0x10'));var authService=require(_0xfef0('0x11'));var qs=require(_0xfef0('0x12'));var as=require(_0xfef0('0x13'));var hardwareService=require(_0xfef0('0x14'));var logger=require(_0xfef0('0x15'))(_0xfef0('0x16'));var utils=require(_0xfef0('0x17'));var config=require(_0xfef0('0x18'));var licenseUtil=require(_0xfef0('0x19'));var db=require(_0xfef0('0x1a'))['db'];function respondWithStatusCode(_0x546c7a,_0x3135ab){_0x3135ab=_0x3135ab||0xcc;return function(_0x2f4e23){if(_0x2f4e23){return _0x546c7a[_0xfef0('0x1b')](_0x3135ab);}return _0x546c7a[_0xfef0('0x1c')](_0x3135ab)[_0xfef0('0x1d')]();};}function respondWithResult(_0x45599a,_0xa9f040){_0xa9f040=_0xa9f040||0xc8;return function(_0x573ae7){if(_0x573ae7){return _0x45599a[_0xfef0('0x1c')](_0xa9f040)['json'](_0x573ae7);}};}function respondWithFilteredResult(_0x4b5bcf,_0x5acdd0){return function(_0x118b8d){if(_0x118b8d){var _0x284b6d=typeof _0x5acdd0[_0xfef0('0x1e')]===_0xfef0('0x1f')&&typeof _0x5acdd0[_0xfef0('0x20')]===_0xfef0('0x1f');var _0x155833=_0x118b8d[_0xfef0('0x21')];var _0x581459=_0x284b6d?0x0:_0x5acdd0[_0xfef0('0x1e')];var _0x1642cd=_0x284b6d?_0x118b8d[_0xfef0('0x21')]:_0x5acdd0[_0xfef0('0x1e')]+_0x5acdd0[_0xfef0('0x20')];var _0x55912f;if(_0x1642cd>=_0x155833){_0x1642cd=_0x155833;_0x55912f=0xc8;}else{_0x55912f=0xce;}_0x4b5bcf[_0xfef0('0x1c')](_0x55912f);return _0x4b5bcf['set'](_0xfef0('0x22'),_0x581459+'-'+_0x1642cd+'/'+_0x155833)[_0xfef0('0x23')](_0x118b8d);}return null;};}function patchUpdates(_0x28dee1){return function(_0x48408a){try{jsonpatch[_0xfef0('0x24')](_0x48408a,_0x28dee1,!![]);}catch(_0x4c304d){return BPromise[_0xfef0('0x25')](_0x4c304d);}return _0x48408a[_0xfef0('0x26')]();};}function saveUpdates(_0x52b93b,_0x4897af){return function(_0x4b8b22){if(_0x4b8b22){return _0x4b8b22[_0xfef0('0x27')](_0x52b93b)['then'](function(_0x1f9970){return _0x1f9970;});}return null;};}function removeEntity(_0x46b34a,_0x1a8d66){return function(_0x4483f2){if(_0x4483f2){return _0x4483f2[_0xfef0('0x28')]()[_0xfef0('0x29')](function(){_0x46b34a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x316e20,_0x1ffaa4){return function(_0x924f6e){if(!_0x924f6e){_0x316e20[_0xfef0('0x1b')](0x194);}return _0x924f6e;};}function handleError(_0xab231c,_0xf60f2){_0xf60f2=_0xf60f2||0x1f4;return function(_0x5df04f){logger[_0xfef0('0x2a')](_0x5df04f[_0xfef0('0x2b')]);if(_0x5df04f['name']){delete _0x5df04f[_0xfef0('0x2c')];}_0xab231c[_0xfef0('0x1c')](_0xf60f2)[_0xfef0('0x2d')](_0x5df04f);};}exports[_0xfef0('0x2e')]=function(_0x37921f,_0x1ac4a3){var _0x3e3c4c={},_0x3e026a={},_0x26cb9a={'count':0x0,'rows':[]};var _0x213a91=_[_0xfef0('0x2f')](db[_0xfef0('0x30')]['rawAttributes'],function(_0x445625){return{'name':_0x445625['fieldName'],'type':_0x445625['type'][_0xfef0('0x31')]};});_0x3e026a[_0xfef0('0x32')]=_['map'](_0x213a91,'name');_0x3e026a['query']=_['keys'](_0x37921f['query']);_0x3e026a[_0xfef0('0x33')]=_[_0xfef0('0x34')](_0x3e026a[_0xfef0('0x32')],_0x3e026a['query']);_0x3e3c4c['attributes']=_['intersection'](_0x3e026a[_0xfef0('0x32')],qs['fields'](_0x37921f[_0xfef0('0x35')][_0xfef0('0x36')]));_0x3e3c4c[_0xfef0('0x37')]=_0x3e3c4c['attributes'][_0xfef0('0x38')]?_0x3e3c4c['attributes']:_0x3e026a[_0xfef0('0x32')];if(!_0x37921f[_0xfef0('0x35')][_0xfef0('0x39')](_0xfef0('0x3a'))){_0x3e3c4c[_0xfef0('0x20')]=qs[_0xfef0('0x20')](_0x37921f[_0xfef0('0x35')][_0xfef0('0x20')]);_0x3e3c4c['offset']=qs[_0xfef0('0x1e')](_0x37921f[_0xfef0('0x35')][_0xfef0('0x1e')]);}_0x3e3c4c[_0xfef0('0x3b')]=qs[_0xfef0('0x3c')](_0x37921f[_0xfef0('0x35')][_0xfef0('0x3c')]);_0x3e3c4c[_0xfef0('0x3d')]=qs[_0xfef0('0x33')](_[_0xfef0('0x3e')](_0x37921f[_0xfef0('0x35')],_0x3e026a[_0xfef0('0x33')]),_0x213a91);if(_0x37921f[_0xfef0('0x35')]['filter']){_0x3e3c4c[_0xfef0('0x3d')]=_['merge'](_0x3e3c4c[_0xfef0('0x3d')],{'$or':_[_0xfef0('0x2f')](_0x213a91,function(_0x1ddce6){if(_0x1ddce6['type']!==_0xfef0('0x3f')){var _0x29469e={};_0x29469e[_0x1ddce6[_0xfef0('0x2c')]]={'$like':'%'+_0x37921f['query'][_0xfef0('0x40')]+'%'};return _0x29469e;}})});}_0x3e3c4c=_[_0xfef0('0x41')]({},_0x3e3c4c,_0x37921f[_0xfef0('0x42')]);var _0x5577f4={'where':_0x3e3c4c[_0xfef0('0x3d')]};return db['UserProfileResource']['count'](_0x5577f4)[_0xfef0('0x29')](function(_0x547a5d){_0x26cb9a['count']=_0x547a5d;if(_0x37921f[_0xfef0('0x35')][_0xfef0('0x43')]){_0x3e3c4c[_0xfef0('0x44')]=[{'all':!![]}];}return db[_0xfef0('0x30')][_0xfef0('0x45')](_0x3e3c4c);})[_0xfef0('0x29')](function(_0x4dd8f8){_0x26cb9a[_0xfef0('0x46')]=_0x4dd8f8;return _0x26cb9a;})[_0xfef0('0x29')](respondWithFilteredResult(_0x1ac4a3,_0x3e3c4c))['catch'](handleError(_0x1ac4a3,null));};exports['show']=function(_0x1d554e,_0x5dc824){var _0x1fc518={'raw':![],'where':{'id':_0x1d554e[_0xfef0('0x47')]['id']}},_0x22c940={};_0x22c940[_0xfef0('0x32')]=_[_0xfef0('0x48')](db[_0xfef0('0x30')][_0xfef0('0x49')]);_0x22c940[_0xfef0('0x35')]=_['keys'](_0x1d554e[_0xfef0('0x35')]);_0x22c940['filters']=_['intersection'](_0x22c940[_0xfef0('0x32')],_0x22c940[_0xfef0('0x35')]);_0x1fc518['attributes']=_[_0xfef0('0x34')](_0x22c940['model'],qs[_0xfef0('0x36')](_0x1d554e[_0xfef0('0x35')][_0xfef0('0x36')]));_0x1fc518[_0xfef0('0x37')]=_0x1fc518['attributes'][_0xfef0('0x38')]?_0x1fc518[_0xfef0('0x37')]:_0x22c940['model'];if(_0x1d554e['query'][_0xfef0('0x43')]){_0x1fc518['include']=[{'all':!![]}];}_0x1fc518=_[_0xfef0('0x41')]({},_0x1fc518,_0x1d554e[_0xfef0('0x42')]);return db[_0xfef0('0x30')][_0xfef0('0x4a')](_0x1fc518)[_0xfef0('0x29')](handleEntityNotFound(_0x5dc824,null))[_0xfef0('0x29')](respondWithResult(_0x5dc824,null))['catch'](handleError(_0x5dc824,null));};exports[_0xfef0('0x4b')]=function(_0x559a28,_0x5a417e){return db[_0xfef0('0x30')][_0xfef0('0x4b')](_0x559a28[_0xfef0('0x4c')],{})['then'](respondWithResult(_0x5a417e,0xc9))[_0xfef0('0x4d')](handleError(_0x5a417e,null));};exports['update']=function(_0x5dd26b,_0x51f207){if(_0x5dd26b[_0xfef0('0x4c')]['id']){delete _0x5dd26b[_0xfef0('0x4c')]['id'];}return db[_0xfef0('0x30')][_0xfef0('0x4a')]({'where':{'id':_0x5dd26b[_0xfef0('0x47')]['id']}})[_0xfef0('0x29')](handleEntityNotFound(_0x51f207,null))[_0xfef0('0x29')](saveUpdates(_0x5dd26b[_0xfef0('0x4c')],null))[_0xfef0('0x29')](respondWithResult(_0x51f207,null))['catch'](handleError(_0x51f207,null));};exports['destroy']=function(_0x2bebec,_0x18e5ba){return db[_0xfef0('0x30')][_0xfef0('0x4a')]({'where':{'id':_0x2bebec[_0xfef0('0x47')]['id']}})[_0xfef0('0x29')](handleEntityNotFound(_0x18e5ba,null))[_0xfef0('0x29')](removeEntity(_0x18e5ba,null))[_0xfef0('0x4d')](handleError(_0x18e5ba,null));};exports['describe']=function(_0x2466e7,_0x19e449){return db[_0xfef0('0x30')][_0xfef0('0x4e')]()[_0xfef0('0x29')](respondWithResult(_0x19e449,null))['catch'](handleError(_0x19e449,null));}; \ No newline at end of file +var _0x4c60=['../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','then','destroy','end','error','stack','name','index','map','UserProfileResource','rawAttributes','key','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','catch','show','includeAll','find','create','update','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util'];(function(_0x536866,_0x54e594){var _0x3f8cee=function(_0x116c1e){while(--_0x116c1e){_0x536866['push'](_0x536866['shift']());}};_0x3f8cee(++_0x54e594);}(_0x4c60,0xc1));var _0x04c6=function(_0x1ce7a3,_0x374860){_0x1ce7a3=_0x1ce7a3-0x0;var _0x6d819e=_0x4c60[_0x1ce7a3];return _0x6d819e;};'use strict';var emlformat=require(_0x04c6('0x0'));var rimraf=require(_0x04c6('0x1'));var zipdir=require(_0x04c6('0x2'));var jsonpatch=require(_0x04c6('0x3'));var rp=require('request-promise');var moment=require(_0x04c6('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x04c6('0x5'));var csv=require(_0x04c6('0x6'));var ejs=require(_0x04c6('0x7'));var fs=require('fs');var fs_extra=require(_0x04c6('0x8'));var _=require(_0x04c6('0x9'));var squel=require(_0x04c6('0xa'));var crypto=require(_0x04c6('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x04c6('0xc'));var toCsv=require(_0x04c6('0x6'));var querystring=require(_0x04c6('0xd'));var Papa=require(_0x04c6('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x04c6('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x04c6('0x10'))(_0x04c6('0x11'));var utils=require('../../config/utils');var config=require(_0x04c6('0x12'));var licenseUtil=require(_0x04c6('0x13'));var db=require(_0x04c6('0x14'))['db'];function respondWithStatusCode(_0x4e5e6,_0x52cdcf){_0x52cdcf=_0x52cdcf||0xcc;return function(_0x257a0a){if(_0x257a0a){return _0x4e5e6[_0x04c6('0x15')](_0x52cdcf);}return _0x4e5e6[_0x04c6('0x16')](_0x52cdcf)['end']();};}function respondWithResult(_0x12d1c5,_0x15cbe0){_0x15cbe0=_0x15cbe0||0xc8;return function(_0x28632e){if(_0x28632e){return _0x12d1c5[_0x04c6('0x16')](_0x15cbe0)[_0x04c6('0x17')](_0x28632e);}};}function respondWithFilteredResult(_0x19a26f,_0x1cd963){return function(_0x3d46a9){if(_0x3d46a9){var _0x5a5a66=typeof _0x1cd963[_0x04c6('0x18')]===_0x04c6('0x19')&&typeof _0x1cd963[_0x04c6('0x1a')]===_0x04c6('0x19');var _0x43596a=_0x3d46a9[_0x04c6('0x1b')];var _0x21674a=_0x5a5a66?0x0:_0x1cd963[_0x04c6('0x18')];var _0x47f400=_0x5a5a66?_0x3d46a9[_0x04c6('0x1b')]:_0x1cd963[_0x04c6('0x18')]+_0x1cd963[_0x04c6('0x1a')];var _0x558b43;if(_0x47f400>=_0x43596a){_0x47f400=_0x43596a;_0x558b43=0xc8;}else{_0x558b43=0xce;}_0x19a26f['status'](_0x558b43);return _0x19a26f['set'](_0x04c6('0x1c'),_0x21674a+'-'+_0x47f400+'/'+_0x43596a)[_0x04c6('0x17')](_0x3d46a9);}return null;};}function patchUpdates(_0x50dd61){return function(_0x5a5e9e){try{jsonpatch[_0x04c6('0x1d')](_0x5a5e9e,_0x50dd61,!![]);}catch(_0x2eed94){return BPromise[_0x04c6('0x1e')](_0x2eed94);}return _0x5a5e9e['save']();};}function saveUpdates(_0x33a0f7,_0x13f2dc){return function(_0x9d41f8){if(_0x9d41f8){return _0x9d41f8['update'](_0x33a0f7)[_0x04c6('0x1f')](function(_0x41e29f){return _0x41e29f;});}return null;};}function removeEntity(_0x562491,_0x54a8b0){return function(_0x4c8d72){if(_0x4c8d72){return _0x4c8d72[_0x04c6('0x20')]()[_0x04c6('0x1f')](function(){_0x562491[_0x04c6('0x16')](0xcc)[_0x04c6('0x21')]();});}};}function handleEntityNotFound(_0x3e1328,_0x52e5f5){return function(_0x562952){if(!_0x562952){_0x3e1328[_0x04c6('0x15')](0x194);}return _0x562952;};}function handleError(_0x2ab1d2,_0x9acfa){_0x9acfa=_0x9acfa||0x1f4;return function(_0x3233d7){logger[_0x04c6('0x22')](_0x3233d7[_0x04c6('0x23')]);if(_0x3233d7['name']){delete _0x3233d7[_0x04c6('0x24')];}_0x2ab1d2[_0x04c6('0x16')](_0x9acfa)['send'](_0x3233d7);};}exports[_0x04c6('0x25')]=function(_0x1cd16a,_0x5f1331){var _0x5c9003={},_0x115d84={},_0x3a6d92={'count':0x0,'rows':[]};var _0x2a191f=_[_0x04c6('0x26')](db[_0x04c6('0x27')][_0x04c6('0x28')],function(_0x49c4ed){return{'name':_0x49c4ed['fieldName'],'type':_0x49c4ed['type'][_0x04c6('0x29')]};});_0x115d84['model']=_[_0x04c6('0x26')](_0x2a191f,_0x04c6('0x24'));_0x115d84['query']=_[_0x04c6('0x2a')](_0x1cd16a[_0x04c6('0x2b')]);_0x115d84[_0x04c6('0x2c')]=_[_0x04c6('0x2d')](_0x115d84['model'],_0x115d84[_0x04c6('0x2b')]);_0x5c9003[_0x04c6('0x2e')]=_[_0x04c6('0x2d')](_0x115d84[_0x04c6('0x2f')],qs[_0x04c6('0x30')](_0x1cd16a[_0x04c6('0x2b')][_0x04c6('0x30')]));_0x5c9003[_0x04c6('0x2e')]=_0x5c9003[_0x04c6('0x2e')][_0x04c6('0x31')]?_0x5c9003[_0x04c6('0x2e')]:_0x115d84[_0x04c6('0x2f')];if(!_0x1cd16a[_0x04c6('0x2b')][_0x04c6('0x32')](_0x04c6('0x33'))){_0x5c9003['limit']=qs[_0x04c6('0x1a')](_0x1cd16a[_0x04c6('0x2b')][_0x04c6('0x1a')]);_0x5c9003[_0x04c6('0x18')]=qs['offset'](_0x1cd16a[_0x04c6('0x2b')][_0x04c6('0x18')]);}_0x5c9003['order']=qs['sort'](_0x1cd16a['query'][_0x04c6('0x34')]);_0x5c9003[_0x04c6('0x35')]=qs['filters'](_[_0x04c6('0x36')](_0x1cd16a['query'],_0x115d84[_0x04c6('0x2c')]),_0x2a191f);if(_0x1cd16a[_0x04c6('0x2b')][_0x04c6('0x37')]){_0x5c9003[_0x04c6('0x35')]=_['merge'](_0x5c9003['where'],{'$or':_[_0x04c6('0x26')](_0x2a191f,function(_0x3a9a3b){if(_0x3a9a3b['type']!==_0x04c6('0x38')){var _0x5ce4b0={};_0x5ce4b0[_0x3a9a3b['name']]={'$like':'%'+_0x1cd16a[_0x04c6('0x2b')]['filter']+'%'};return _0x5ce4b0;}})});}_0x5c9003=_[_0x04c6('0x39')]({},_0x5c9003,_0x1cd16a[_0x04c6('0x3a')]);var _0x59ca18={'where':_0x5c9003[_0x04c6('0x35')]};return db['UserProfileResource'][_0x04c6('0x1b')](_0x59ca18)[_0x04c6('0x1f')](function(_0x2d83eb){_0x3a6d92[_0x04c6('0x1b')]=_0x2d83eb;if(_0x1cd16a[_0x04c6('0x2b')]['includeAll']){_0x5c9003[_0x04c6('0x3b')]=[{'all':!![]}];}return db['UserProfileResource'][_0x04c6('0x3c')](_0x5c9003);})['then'](function(_0x1f7ead){_0x3a6d92[_0x04c6('0x3d')]=_0x1f7ead;return _0x3a6d92;})[_0x04c6('0x1f')](respondWithFilteredResult(_0x5f1331,_0x5c9003))[_0x04c6('0x3e')](handleError(_0x5f1331,null));};exports[_0x04c6('0x3f')]=function(_0x2cdf34,_0x40477f){var _0x4a3c45={'raw':![],'where':{'id':_0x2cdf34['params']['id']}},_0xdfdc34={};_0xdfdc34[_0x04c6('0x2f')]=_['keys'](db['UserProfileResource'][_0x04c6('0x28')]);_0xdfdc34['query']=_[_0x04c6('0x2a')](_0x2cdf34[_0x04c6('0x2b')]);_0xdfdc34[_0x04c6('0x2c')]=_['intersection'](_0xdfdc34[_0x04c6('0x2f')],_0xdfdc34[_0x04c6('0x2b')]);_0x4a3c45[_0x04c6('0x2e')]=_[_0x04c6('0x2d')](_0xdfdc34[_0x04c6('0x2f')],qs[_0x04c6('0x30')](_0x2cdf34[_0x04c6('0x2b')]['fields']));_0x4a3c45['attributes']=_0x4a3c45[_0x04c6('0x2e')][_0x04c6('0x31')]?_0x4a3c45[_0x04c6('0x2e')]:_0xdfdc34['model'];if(_0x2cdf34[_0x04c6('0x2b')][_0x04c6('0x40')]){_0x4a3c45[_0x04c6('0x3b')]=[{'all':!![]}];}_0x4a3c45=_['merge']({},_0x4a3c45,_0x2cdf34['options']);return db['UserProfileResource'][_0x04c6('0x41')](_0x4a3c45)[_0x04c6('0x1f')](handleEntityNotFound(_0x40477f,null))['then'](respondWithResult(_0x40477f,null))[_0x04c6('0x3e')](handleError(_0x40477f,null));};exports[_0x04c6('0x42')]=function(_0x2bd045,_0x4ef366){return db[_0x04c6('0x27')][_0x04c6('0x42')](_0x2bd045['body'],{})[_0x04c6('0x1f')](respondWithResult(_0x4ef366,0xc9))[_0x04c6('0x3e')](handleError(_0x4ef366,null));};exports[_0x04c6('0x43')]=function(_0xee2822,_0x4cfde2){if(_0xee2822[_0x04c6('0x44')]['id']){delete _0xee2822[_0x04c6('0x44')]['id'];}return db[_0x04c6('0x27')][_0x04c6('0x41')]({'where':{'id':_0xee2822['params']['id']}})[_0x04c6('0x1f')](handleEntityNotFound(_0x4cfde2,null))[_0x04c6('0x1f')](saveUpdates(_0xee2822[_0x04c6('0x44')],null))[_0x04c6('0x1f')](respondWithResult(_0x4cfde2,null))['catch'](handleError(_0x4cfde2,null));};exports[_0x04c6('0x20')]=function(_0x42273e,_0x15ec61){return db['UserProfileResource'][_0x04c6('0x41')]({'where':{'id':_0x42273e[_0x04c6('0x45')]['id']}})[_0x04c6('0x1f')](handleEntityNotFound(_0x15ec61,null))[_0x04c6('0x1f')](removeEntity(_0x15ec61,null))[_0x04c6('0x3e')](handleError(_0x15ec61,null));};exports[_0x04c6('0x46')]=function(_0x1b8fa4,_0x160f91){return db[_0x04c6('0x27')][_0x04c6('0x46')]()[_0x04c6('0x1f')](respondWithResult(_0x160f91,null))[_0x04c6('0x3e')](handleError(_0x160f91,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 1f8510e..cb9054d 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 _0x1fb1=['bluebird','request-promise','path','rimraf','../../config/environment','./userProfileResource.attributes','define','UserProfileResource','user_profile_has_resources','resourceId','sectionId','lodash','util','api','moment'];(function(_0x26bbb6,_0x3be6f8){var _0x5b23c4=function(_0x405c73){while(--_0x405c73){_0x26bbb6['push'](_0x26bbb6['shift']());}};_0x5b23c4(++_0x3be6f8);}(_0x1fb1,0xec));var _0x11fb=function(_0x1e3dd2,_0x1c5f2c){_0x1e3dd2=_0x1e3dd2-0x0;var _0x3cf968=_0x1fb1[_0x1e3dd2];return _0x3cf968;};'use strict';var _=require(_0x11fb('0x0'));var util=require(_0x11fb('0x1'));var logger=require('../../config/logger')(_0x11fb('0x2'));var moment=require(_0x11fb('0x3'));var BPromise=require(_0x11fb('0x4'));var rp=require(_0x11fb('0x5'));var fs=require('fs');var path=require(_0x11fb('0x6'));var rimraf=require(_0x11fb('0x7'));var config=require(_0x11fb('0x8'));var attributes=require(_0x11fb('0x9'));module['exports']=function(_0x3f5528,_0x16f532){return _0x3f5528[_0x11fb('0xa')](_0x11fb('0xb'),attributes,{'tableName':_0x11fb('0xc'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x11fb('0xd'),_0x11fb('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0fae=['../../config/logger','api','moment','bluebird','rimraf','../../config/environment','exports','define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','sectionId'];(function(_0x15d87f,_0x2d6436){var _0x286b6a=function(_0x4b7caa){while(--_0x4b7caa){_0x15d87f['push'](_0x15d87f['shift']());}};_0x286b6a(++_0x2d6436);}(_0x0fae,0x8f));var _0xe0fa=function(_0x2b557c,_0x4fc8e6){_0x2b557c=_0x2b557c-0x0;var _0x16fcc3=_0x0fae[_0x2b557c];return _0x16fcc3;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe0fa('0x0'))(_0xe0fa('0x1'));var moment=require(_0xe0fa('0x2'));var BPromise=require(_0xe0fa('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe0fa('0x4'));var config=require(_0xe0fa('0x5'));var attributes=require('./userProfileResource.attributes');module[_0xe0fa('0x6')]=function(_0x3b0801,_0x42a796){return _0x3b0801[_0xe0fa('0x7')](_0xe0fa('0x8'),attributes,{'tableName':_0xe0fa('0x9'),'paranoid':![],'indexes':[{'name':_0xe0fa('0xa'),'fields':[_0xe0fa('0xb'),_0xe0fa('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index c5694f3..ea6e685 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 _0xf398=['request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','jayson/promise','client','request','then','info','UserProfileResource,\x20%s,\x20%s'];(function(_0x317dfa,_0x35fe08){var _0x21ea7c=function(_0xeee34d){while(--_0xeee34d){_0x317dfa['push'](_0x317dfa['shift']());}};_0x21ea7c(++_0x35fe08);}(_0xf398,0x7f));var _0x8f39=function(_0x4d5309,_0x42d4de){_0x4d5309=_0x4d5309-0x0;var _0x61e858=_0xf398[_0x4d5309];return _0x61e858;};'use strict';var _=require(_0x8f39('0x0'));var util=require(_0x8f39('0x1'));var moment=require(_0x8f39('0x2'));var BPromise=require(_0x8f39('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8f39('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8f39('0x5'))(_0x8f39('0x6'));var config=require('../../config/environment');var jayson=require(_0x8f39('0x7'));var client=jayson[_0x8f39('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x846f92,_0x4b34e3,_0x508910){return new BPromise(function(_0x438689,_0x45636e){return client[_0x8f39('0x9')](_0x846f92,_0x508910)[_0x8f39('0xa')](function(_0x59188e){logger[_0x8f39('0xb')](_0x8f39('0xc'),_0x4b34e3,_0x8f39('0xd'));logger[_0x8f39('0xe')](_0x8f39('0xf'),_0x4b34e3,_0x8f39('0xd'),JSON['stringify'](_0x59188e));if(_0x59188e[_0x8f39('0x10')]){if(_0x59188e[_0x8f39('0x10')]['code']===0x1f4){logger[_0x8f39('0x10')]('UserProfileResource,\x20%s,\x20%s',_0x4b34e3,_0x59188e[_0x8f39('0x10')][_0x8f39('0x11')]);return _0x45636e(_0x59188e[_0x8f39('0x10')][_0x8f39('0x11')]);}logger['error'](_0x8f39('0xc'),_0x4b34e3,_0x59188e[_0x8f39('0x10')][_0x8f39('0x11')]);return _0x438689(_0x59188e[_0x8f39('0x10')]['message']);}else{logger[_0x8f39('0xb')]('UserProfileResource,\x20%s,\x20%s',_0x4b34e3,_0x8f39('0xd'));_0x438689(_0x59188e[_0x8f39('0x12')]['message']);}})[_0x8f39('0x13')](function(_0x364e9f){logger[_0x8f39('0x10')](_0x8f39('0xc'),_0x4b34e3,_0x364e9f);_0x45636e(_0x364e9f);});});} \ No newline at end of file +var _0x9deb=['code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x518467,_0x383a5f){var _0x5a0ee4=function(_0x1af5c6){while(--_0x1af5c6){_0x518467['push'](_0x518467['shift']());}};_0x5a0ee4(++_0x383a5f);}(_0x9deb,0xdf));var _0xb9de=function(_0x44e191,_0x279a3a){_0x44e191=_0x44e191-0x0;var _0x189d9d=_0x9deb[_0x44e191];return _0x189d9d;};'use strict';var _=require(_0xb9de('0x0'));var util=require(_0xb9de('0x1'));var moment=require(_0xb9de('0x2'));var BPromise=require('bluebird');var rs=require(_0xb9de('0x3'));var fs=require('fs');var Redis=require(_0xb9de('0x4'));var db=require(_0xb9de('0x5'))['db'];var utils=require(_0xb9de('0x6'));var logger=require(_0xb9de('0x7'))('rpc');var config=require(_0xb9de('0x8'));var jayson=require(_0xb9de('0x9'));var client=jayson['client'][_0xb9de('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2bf4b3,_0x5be982,_0x1fcc73){return new BPromise(function(_0x5d9ce2,_0x19eaae){return client[_0xb9de('0xb')](_0x2bf4b3,_0x1fcc73)['then'](function(_0x17a791){logger[_0xb9de('0xc')](_0xb9de('0xd'),_0x5be982,_0xb9de('0xe'));logger[_0xb9de('0xf')](_0xb9de('0x10'),_0x5be982,_0xb9de('0xe'),JSON[_0xb9de('0x11')](_0x17a791));if(_0x17a791[_0xb9de('0x12')]){if(_0x17a791[_0xb9de('0x12')][_0xb9de('0x13')]===0x1f4){logger[_0xb9de('0x12')](_0xb9de('0xd'),_0x5be982,_0x17a791[_0xb9de('0x12')]['message']);return _0x19eaae(_0x17a791['error'][_0xb9de('0x14')]);}logger[_0xb9de('0x12')]('UserProfileResource,\x20%s,\x20%s',_0x5be982,_0x17a791[_0xb9de('0x12')]['message']);return _0x5d9ce2(_0x17a791['error'][_0xb9de('0x14')]);}else{logger['info'](_0xb9de('0xd'),_0x5be982,_0xb9de('0xe'));_0x5d9ce2(_0x17a791[_0xb9de('0x15')][_0xb9de('0x14')]);}})['catch'](function(_0x423a76){logger['error']('UserProfileResource,\x20%s,\x20%s',_0x5be982,_0x423a76);_0x19eaae(_0x423a76);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 4e586dd..4259e1e 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 _0xbe08=['./userProfileSection.controller','get','isAuthenticated','/describe','describe','/:id','post','create','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../config/environment'];(function(_0x3c09db,_0xa238b7){var _0x1883e7=function(_0x3e1226){while(--_0x3e1226){_0x3c09db['push'](_0x3c09db['shift']());}};_0x1883e7(++_0xa238b7);}(_0xbe08,0x107));var _0x8be0=function(_0x2d33b6,_0x119bf2){_0x2d33b6=_0x2d33b6-0x0;var _0x5f379f=_0xbe08[_0x2d33b6];return _0x5f379f;};'use strict';var multer=require(_0x8be0('0x0'));var util=require(_0x8be0('0x1'));var path=require(_0x8be0('0x2'));var timeout=require('connect-timeout');var express=require(_0x8be0('0x3'));var router=express[_0x8be0('0x4')]();var fs_extra=require(_0x8be0('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8be0('0x6'));var controller=require(_0x8be0('0x7'));router[_0x8be0('0x8')]('/',auth[_0x8be0('0x9')](),controller['index']);router[_0x8be0('0x8')](_0x8be0('0xa'),auth['isAuthenticated'](),controller[_0x8be0('0xb')]);router[_0x8be0('0x8')](_0x8be0('0xc'),auth[_0x8be0('0x9')](),controller['show']);router[_0x8be0('0xd')]('/',auth[_0x8be0('0x9')](),controller[_0x8be0('0xe')]);router['put'](_0x8be0('0xc'),auth[_0x8be0('0x9')](),controller[_0x8be0('0xf')]);router['delete']('/:id',auth[_0x8be0('0x9')](),controller[_0x8be0('0x10')]);module[_0x8be0('0x11')]=router; \ No newline at end of file +var _0xebc8=['put','delete','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post'];(function(_0xf0a95c,_0x570e29){var _0x3720ff=function(_0x40c364){while(--_0x40c364){_0xf0a95c['push'](_0xf0a95c['shift']());}};_0x3720ff(++_0x570e29);}(_0xebc8,0x107));var _0x8ebc=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xebc8[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x8ebc('0x0'));var util=require('util');var path=require(_0x8ebc('0x1'));var timeout=require(_0x8ebc('0x2'));var express=require(_0x8ebc('0x3'));var router=express[_0x8ebc('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8ebc('0x5'));var interaction=require(_0x8ebc('0x6'));var config=require(_0x8ebc('0x7'));var controller=require(_0x8ebc('0x8'));router['get']('/',auth[_0x8ebc('0x9')](),controller[_0x8ebc('0xa')]);router[_0x8ebc('0xb')](_0x8ebc('0xc'),auth[_0x8ebc('0x9')](),controller[_0x8ebc('0xd')]);router[_0x8ebc('0xb')](_0x8ebc('0xe'),auth[_0x8ebc('0x9')](),controller[_0x8ebc('0xf')]);router[_0x8ebc('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8ebc('0x11')](_0x8ebc('0xe'),auth[_0x8ebc('0x9')](),controller['update']);router[_0x8ebc('0x12')](_0x8ebc('0xe'),auth['isAuthenticated'](),controller[_0x8ebc('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 363cc4b..8576103 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 _0xb78e=['STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions','getDataValue','split','sequelize','exports'];(function(_0x142368,_0x8fb165){var _0x4d5894=function(_0x25953b){while(--_0x25953b){_0x142368['push'](_0x142368['shift']());}};_0x4d5894(++_0x8fb165);}(_0xb78e,0x1c9));var _0xeb78=function(_0x563b45,_0xf32730){_0x563b45=_0x563b45-0x0;var _0xac60ed=_0xb78e[_0x563b45];return _0xac60ed;};'use strict';var Sequelize=require(_0xeb78('0x0'));module[_0xeb78('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize[_0xeb78('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xeb78('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0xeb78('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xeb78('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xeb78('0x2')],'set':function(_0x308d12){this[_0xeb78('0x5')](_0xeb78('0x6'),_0x308d12?_0x308d12['join'](''):[]);},'get':function(){return this[_0xeb78('0x7')](_0xeb78('0x6'))?this[_0xeb78('0x7')](_0xeb78('0x6'))[_0xeb78('0x8')](''):[];}}}; \ No newline at end of file +var _0x5423=['getDataValue','crudPermissions','sequelize','exports','STRING','INTEGER','BOOLEAN','setDataValue','join'];(function(_0x18904a,_0x5b5191){var _0x4e8f5a=function(_0x77d429){while(--_0x77d429){_0x18904a['push'](_0x18904a['shift']());}};_0x4e8f5a(++_0x5b5191);}(_0x5423,0xe3));var _0x3542=function(_0x51fca9,_0x54a13f){_0x51fca9=_0x51fca9-0x0;var _0xbf5bb=_0x5423[_0x51fca9];return _0xbf5bb;};'use strict';var Sequelize=require(_0x3542('0x0'));module[_0x3542('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize[_0x3542('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x3542('0x3')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x3542('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x3542('0x2')],'set':function(_0xf0835){this[_0x3542('0x5')]('crudPermissions',_0xf0835?_0xf0835[_0x3542('0x6')](''):[]);},'get':function(){return this[_0x3542('0x7')](_0x3542('0x8'))?this[_0x3542('0x7')](_0x3542('0x8'))['split'](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 5afb231..a029961 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 _0x1f22=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','sendStatus','stack','name','send','index','UserProfileSection','rawAttributes','key','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','merge','map','VIRTUAL','filter','includeAll','include','findAll','catch','show','params','keys','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs'];(function(_0x16cff1,_0x210729){var _0x141cb3=function(_0x26dfcb){while(--_0x26dfcb){_0x16cff1['push'](_0x16cff1['shift']());}};_0x141cb3(++_0x210729);}(_0x1f22,0x16a));var _0x21f2=function(_0x3c7fca,_0x122dc1){_0x3c7fca=_0x3c7fca-0x0;var _0xf030eb=_0x1f22[_0x3c7fca];return _0xf030eb;};'use strict';var emlformat=require(_0x21f2('0x0'));var rimraf=require(_0x21f2('0x1'));var zipdir=require(_0x21f2('0x2'));var jsonpatch=require(_0x21f2('0x3'));var rp=require('request-promise');var moment=require(_0x21f2('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x21f2('0x5'));var util=require(_0x21f2('0x6'));var path=require(_0x21f2('0x7'));var sox=require('sox');var csv=require(_0x21f2('0x8'));var ejs=require(_0x21f2('0x9'));var fs=require('fs');var fs_extra=require(_0x21f2('0xa'));var _=require(_0x21f2('0xb'));var squel=require('squel');var crypto=require(_0x21f2('0xc'));var jsforce=require(_0x21f2('0xd'));var deskjs=require(_0x21f2('0xe'));var toCsv=require(_0x21f2('0x8'));var querystring=require(_0x21f2('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x21f2('0x10'));var qs=require(_0x21f2('0x11'));var as=require(_0x21f2('0x12'));var hardwareService=require(_0x21f2('0x13'));var logger=require(_0x21f2('0x14'))(_0x21f2('0x15'));var utils=require(_0x21f2('0x16'));var config=require(_0x21f2('0x17'));var licenseUtil=require(_0x21f2('0x18'));var db=require(_0x21f2('0x19'))['db'];function respondWithStatusCode(_0x1f9174,_0xaa82f5){_0xaa82f5=_0xaa82f5||0xcc;return function(_0x56d922){if(_0x56d922){return _0x1f9174['sendStatus'](_0xaa82f5);}return _0x1f9174[_0x21f2('0x1a')](_0xaa82f5)[_0x21f2('0x1b')]();};}function respondWithResult(_0x85d131,_0x54d54c){_0x54d54c=_0x54d54c||0xc8;return function(_0x428e99){if(_0x428e99){return _0x85d131[_0x21f2('0x1a')](_0x54d54c)[_0x21f2('0x1c')](_0x428e99);}};}function respondWithFilteredResult(_0x546d5b,_0x459838){return function(_0x7b7479){if(_0x7b7479){var _0x1dae40=typeof _0x459838[_0x21f2('0x1d')]===_0x21f2('0x1e')&&typeof _0x459838[_0x21f2('0x1f')]===_0x21f2('0x1e');var _0x3ae4c7=_0x7b7479[_0x21f2('0x20')];var _0x50bff7=_0x1dae40?0x0:_0x459838[_0x21f2('0x1d')];var _0x57303a=_0x1dae40?_0x7b7479['count']:_0x459838[_0x21f2('0x1d')]+_0x459838[_0x21f2('0x1f')];var _0x57b362;if(_0x57303a>=_0x3ae4c7){_0x57303a=_0x3ae4c7;_0x57b362=0xc8;}else{_0x57b362=0xce;}_0x546d5b[_0x21f2('0x1a')](_0x57b362);return _0x546d5b[_0x21f2('0x21')](_0x21f2('0x22'),_0x50bff7+'-'+_0x57303a+'/'+_0x3ae4c7)[_0x21f2('0x1c')](_0x7b7479);}return null;};}function patchUpdates(_0x554633){return function(_0x48a8cc){try{jsonpatch[_0x21f2('0x23')](_0x48a8cc,_0x554633,!![]);}catch(_0x193248){return BPromise['reject'](_0x193248);}return _0x48a8cc[_0x21f2('0x24')]();};}function saveUpdates(_0x129605,_0x5e6334){return function(_0x5c1221){if(_0x5c1221){return _0x5c1221[_0x21f2('0x25')](_0x129605)['then'](function(_0x3fe639){return _0x3fe639;});}return null;};}function removeEntity(_0x4e4221,_0x3e3636){return function(_0x2c9c7c){if(_0x2c9c7c){return _0x2c9c7c[_0x21f2('0x26')]()[_0x21f2('0x27')](function(){_0x4e4221[_0x21f2('0x1a')](0xcc)[_0x21f2('0x1b')]();});}};}function handleEntityNotFound(_0x24eecf,_0x28af95){return function(_0xca3e87){if(!_0xca3e87){_0x24eecf[_0x21f2('0x28')](0x194);}return _0xca3e87;};}function handleError(_0x8d4420,_0x48f3bc){_0x48f3bc=_0x48f3bc||0x1f4;return function(_0x2b319c){logger['error'](_0x2b319c[_0x21f2('0x29')]);if(_0x2b319c[_0x21f2('0x2a')]){delete _0x2b319c[_0x21f2('0x2a')];}_0x8d4420['status'](_0x48f3bc)[_0x21f2('0x2b')](_0x2b319c);};}exports[_0x21f2('0x2c')]=function(_0x259823,_0x53214b){var _0x5f0466={},_0x294b31={},_0x45d1c9={'count':0x0,'rows':[]};var _0x571166=_['map'](db[_0x21f2('0x2d')][_0x21f2('0x2e')],function(_0x1ff146){return{'name':_0x1ff146['fieldName'],'type':_0x1ff146['type'][_0x21f2('0x2f')]};});_0x294b31['model']=_['map'](_0x571166,_0x21f2('0x2a'));_0x294b31[_0x21f2('0x30')]=_['keys'](_0x259823[_0x21f2('0x30')]);_0x294b31[_0x21f2('0x31')]=_['intersection'](_0x294b31[_0x21f2('0x32')],_0x294b31['query']);_0x5f0466[_0x21f2('0x33')]=_[_0x21f2('0x34')](_0x294b31[_0x21f2('0x32')],qs[_0x21f2('0x35')](_0x259823[_0x21f2('0x30')]['fields']));_0x5f0466['attributes']=_0x5f0466[_0x21f2('0x33')][_0x21f2('0x36')]?_0x5f0466[_0x21f2('0x33')]:_0x294b31[_0x21f2('0x32')];if(!_0x259823[_0x21f2('0x30')][_0x21f2('0x37')]('nolimit')){_0x5f0466[_0x21f2('0x1f')]=qs['limit'](_0x259823['query']['limit']);_0x5f0466[_0x21f2('0x1d')]=qs[_0x21f2('0x1d')](_0x259823[_0x21f2('0x30')][_0x21f2('0x1d')]);}_0x5f0466[_0x21f2('0x38')]=qs[_0x21f2('0x39')](_0x259823[_0x21f2('0x30')][_0x21f2('0x39')]);_0x5f0466[_0x21f2('0x3a')]=qs[_0x21f2('0x31')](_[_0x21f2('0x3b')](_0x259823[_0x21f2('0x30')],_0x294b31['filters']),_0x571166);if(_0x259823[_0x21f2('0x30')]['filter']){_0x5f0466[_0x21f2('0x3a')]=_[_0x21f2('0x3c')](_0x5f0466[_0x21f2('0x3a')],{'$or':_[_0x21f2('0x3d')](_0x571166,function(_0x6862a1){if(_0x6862a1['type']!==_0x21f2('0x3e')){var _0x385de2={};_0x385de2[_0x6862a1[_0x21f2('0x2a')]]={'$like':'%'+_0x259823['query'][_0x21f2('0x3f')]+'%'};return _0x385de2;}})});}_0x5f0466=_[_0x21f2('0x3c')]({},_0x5f0466,_0x259823['options']);var _0x5df46a={'where':_0x5f0466[_0x21f2('0x3a')]};return db['UserProfileSection'][_0x21f2('0x20')](_0x5df46a)[_0x21f2('0x27')](function(_0x4d8f04){_0x45d1c9[_0x21f2('0x20')]=_0x4d8f04;if(_0x259823[_0x21f2('0x30')][_0x21f2('0x40')]){_0x5f0466[_0x21f2('0x41')]=[{'all':!![]}];}return db[_0x21f2('0x2d')][_0x21f2('0x42')](_0x5f0466);})[_0x21f2('0x27')](function(_0x2c9ba7){_0x45d1c9['rows']=_0x2c9ba7;return _0x45d1c9;})['then'](respondWithFilteredResult(_0x53214b,_0x5f0466))[_0x21f2('0x43')](handleError(_0x53214b,null));};exports[_0x21f2('0x44')]=function(_0x623a8d,_0x5a2f12){var _0x370aec={'raw':![],'where':{'id':_0x623a8d[_0x21f2('0x45')]['id']}},_0x52b9e5={};_0x52b9e5['model']=_[_0x21f2('0x46')](db[_0x21f2('0x2d')][_0x21f2('0x2e')]);_0x52b9e5[_0x21f2('0x30')]=_[_0x21f2('0x46')](_0x623a8d[_0x21f2('0x30')]);_0x52b9e5['filters']=_['intersection'](_0x52b9e5[_0x21f2('0x32')],_0x52b9e5['query']);_0x370aec[_0x21f2('0x33')]=_[_0x21f2('0x34')](_0x52b9e5[_0x21f2('0x32')],qs[_0x21f2('0x35')](_0x623a8d['query'][_0x21f2('0x35')]));_0x370aec['attributes']=_0x370aec['attributes'][_0x21f2('0x36')]?_0x370aec[_0x21f2('0x33')]:_0x52b9e5['model'];if(_0x623a8d['query'][_0x21f2('0x40')]){_0x370aec[_0x21f2('0x41')]=[{'all':!![]}];}_0x370aec=_[_0x21f2('0x3c')]({},_0x370aec,_0x623a8d[_0x21f2('0x47')]);return db[_0x21f2('0x2d')][_0x21f2('0x48')](_0x370aec)[_0x21f2('0x27')](handleEntityNotFound(_0x5a2f12,null))[_0x21f2('0x27')](respondWithResult(_0x5a2f12,null))[_0x21f2('0x43')](handleError(_0x5a2f12,null));};exports[_0x21f2('0x49')]=function(_0x3e3a25,_0x2a909d){return db[_0x21f2('0x2d')][_0x21f2('0x49')](_0x3e3a25['body'],{})['then'](respondWithResult(_0x2a909d,0xc9))[_0x21f2('0x43')](handleError(_0x2a909d,null));};exports[_0x21f2('0x25')]=function(_0x12187b,_0x4df719){if(_0x12187b['body']['id']){delete _0x12187b[_0x21f2('0x4a')]['id'];}return db[_0x21f2('0x2d')][_0x21f2('0x48')]({'where':{'id':_0x12187b[_0x21f2('0x45')]['id']}})[_0x21f2('0x27')](handleEntityNotFound(_0x4df719,null))[_0x21f2('0x27')](saveUpdates(_0x12187b[_0x21f2('0x4a')],null))['then'](respondWithResult(_0x4df719,null))['catch'](handleError(_0x4df719,null));};exports['destroy']=function(_0x47d501,_0x184dbd){return db[_0x21f2('0x2d')][_0x21f2('0x48')]({'where':{'id':_0x47d501[_0x21f2('0x45')]['id']}})['then'](handleEntityNotFound(_0x184dbd,null))['then'](removeEntity(_0x184dbd,null))['catch'](handleError(_0x184dbd,null));};exports[_0x21f2('0x4b')]=function(_0x3d51b,_0x4efe0c){return db[_0x21f2('0x2d')][_0x21f2('0x4b')]()[_0x21f2('0x27')](respondWithResult(_0x4efe0c,null))[_0x21f2('0x43')](handleError(_0x4efe0c,null));}; \ No newline at end of file +var _0x7beb=['filter','merge','type','options','includeAll','include','findAll','rows','show','params','keys','create','body','catch','find','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','offset','count','set','apply','reject','save','update','then','destroy','end','sendStatus','stack','name','index','map','UserProfileSection','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where'];(function(_0x45cd9d,_0x53f03f){var _0x5f2219=function(_0x490344){while(--_0x490344){_0x45cd9d['push'](_0x45cd9d['shift']());}};_0x5f2219(++_0x53f03f);}(_0x7beb,0x12c));var _0xb7be=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7beb[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xb7be('0x0'));var rimraf=require(_0xb7be('0x1'));var zipdir=require(_0xb7be('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb7be('0x3'));var moment=require('moment');var BPromise=require(_0xb7be('0x4'));var Mustache=require(_0xb7be('0x5'));var util=require(_0xb7be('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb7be('0x7'));var squel=require(_0xb7be('0x8'));var crypto=require('crypto');var jsforce=require(_0xb7be('0x9'));var deskjs=require(_0xb7be('0xa'));var toCsv=require('to-csv');var querystring=require(_0xb7be('0xb'));var Papa=require(_0xb7be('0xc'));var Redis=require(_0xb7be('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xb7be('0xe'));var as=require(_0xb7be('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb7be('0x10'));var utils=require(_0xb7be('0x11'));var config=require(_0xb7be('0x12'));var licenseUtil=require(_0xb7be('0x13'));var db=require(_0xb7be('0x14'))['db'];function respondWithStatusCode(_0x58b0b4,_0xe17fda){_0xe17fda=_0xe17fda||0xcc;return function(_0x5a93c2){if(_0x5a93c2){return _0x58b0b4['sendStatus'](_0xe17fda);}return _0x58b0b4[_0xb7be('0x15')](_0xe17fda)['end']();};}function respondWithResult(_0x5d01f6,_0x556482){_0x556482=_0x556482||0xc8;return function(_0x5bfa40){if(_0x5bfa40){return _0x5d01f6[_0xb7be('0x15')](_0x556482)[_0xb7be('0x16')](_0x5bfa40);}};}function respondWithFilteredResult(_0x1284f9,_0x408df1){return function(_0x12508a){if(_0x12508a){var _0x1b0b4b=typeof _0x408df1['offset']===_0xb7be('0x17')&&typeof _0x408df1['limit']===_0xb7be('0x17');var _0x1131cd=_0x12508a['count'];var _0x279501=_0x1b0b4b?0x0:_0x408df1[_0xb7be('0x18')];var _0xcc8fbc=_0x1b0b4b?_0x12508a[_0xb7be('0x19')]:_0x408df1['offset']+_0x408df1['limit'];var _0x82b7c;if(_0xcc8fbc>=_0x1131cd){_0xcc8fbc=_0x1131cd;_0x82b7c=0xc8;}else{_0x82b7c=0xce;}_0x1284f9[_0xb7be('0x15')](_0x82b7c);return _0x1284f9[_0xb7be('0x1a')]('Content-Range',_0x279501+'-'+_0xcc8fbc+'/'+_0x1131cd)['json'](_0x12508a);}return null;};}function patchUpdates(_0x33ec3e){return function(_0x2a362f){try{jsonpatch[_0xb7be('0x1b')](_0x2a362f,_0x33ec3e,!![]);}catch(_0x2a4008){return BPromise[_0xb7be('0x1c')](_0x2a4008);}return _0x2a362f[_0xb7be('0x1d')]();};}function saveUpdates(_0x35f0aa,_0x5b0568){return function(_0x4afed3){if(_0x4afed3){return _0x4afed3[_0xb7be('0x1e')](_0x35f0aa)[_0xb7be('0x1f')](function(_0x433bcb){return _0x433bcb;});}return null;};}function removeEntity(_0x520c86,_0x1f4105){return function(_0x8480d9){if(_0x8480d9){return _0x8480d9[_0xb7be('0x20')]()[_0xb7be('0x1f')](function(){_0x520c86['status'](0xcc)[_0xb7be('0x21')]();});}};}function handleEntityNotFound(_0x626809,_0x47c238){return function(_0x4826ee){if(!_0x4826ee){_0x626809[_0xb7be('0x22')](0x194);}return _0x4826ee;};}function handleError(_0x5e89d5,_0x2b6d04){_0x2b6d04=_0x2b6d04||0x1f4;return function(_0xd51788){logger['error'](_0xd51788[_0xb7be('0x23')]);if(_0xd51788[_0xb7be('0x24')]){delete _0xd51788[_0xb7be('0x24')];}_0x5e89d5[_0xb7be('0x15')](_0x2b6d04)['send'](_0xd51788);};}exports[_0xb7be('0x25')]=function(_0xff2e5d,_0x36be86){var _0x5f5cb4={},_0x91151={},_0x1fd356={'count':0x0,'rows':[]};var _0xfc6194=_[_0xb7be('0x26')](db[_0xb7be('0x27')][_0xb7be('0x28')],function(_0x36c3a8){return{'name':_0x36c3a8[_0xb7be('0x29')],'type':_0x36c3a8['type'][_0xb7be('0x2a')]};});_0x91151[_0xb7be('0x2b')]=_[_0xb7be('0x26')](_0xfc6194,_0xb7be('0x24'));_0x91151[_0xb7be('0x2c')]=_['keys'](_0xff2e5d[_0xb7be('0x2c')]);_0x91151[_0xb7be('0x2d')]=_[_0xb7be('0x2e')](_0x91151['model'],_0x91151['query']);_0x5f5cb4[_0xb7be('0x2f')]=_['intersection'](_0x91151[_0xb7be('0x2b')],qs[_0xb7be('0x30')](_0xff2e5d[_0xb7be('0x2c')][_0xb7be('0x30')]));_0x5f5cb4[_0xb7be('0x2f')]=_0x5f5cb4[_0xb7be('0x2f')][_0xb7be('0x31')]?_0x5f5cb4['attributes']:_0x91151[_0xb7be('0x2b')];if(!_0xff2e5d[_0xb7be('0x2c')][_0xb7be('0x32')](_0xb7be('0x33'))){_0x5f5cb4[_0xb7be('0x34')]=qs[_0xb7be('0x34')](_0xff2e5d[_0xb7be('0x2c')][_0xb7be('0x34')]);_0x5f5cb4[_0xb7be('0x18')]=qs[_0xb7be('0x18')](_0xff2e5d['query']['offset']);}_0x5f5cb4['order']=qs[_0xb7be('0x35')](_0xff2e5d['query'][_0xb7be('0x35')]);_0x5f5cb4[_0xb7be('0x36')]=qs[_0xb7be('0x2d')](_['pick'](_0xff2e5d[_0xb7be('0x2c')],_0x91151[_0xb7be('0x2d')]),_0xfc6194);if(_0xff2e5d[_0xb7be('0x2c')][_0xb7be('0x37')]){_0x5f5cb4[_0xb7be('0x36')]=_[_0xb7be('0x38')](_0x5f5cb4[_0xb7be('0x36')],{'$or':_[_0xb7be('0x26')](_0xfc6194,function(_0x1b0e34){if(_0x1b0e34[_0xb7be('0x39')]!=='VIRTUAL'){var _0x50148e={};_0x50148e[_0x1b0e34[_0xb7be('0x24')]]={'$like':'%'+_0xff2e5d['query']['filter']+'%'};return _0x50148e;}})});}_0x5f5cb4=_[_0xb7be('0x38')]({},_0x5f5cb4,_0xff2e5d[_0xb7be('0x3a')]);var _0x321ada={'where':_0x5f5cb4['where']};return db[_0xb7be('0x27')]['count'](_0x321ada)[_0xb7be('0x1f')](function(_0xaf897f){_0x1fd356[_0xb7be('0x19')]=_0xaf897f;if(_0xff2e5d[_0xb7be('0x2c')][_0xb7be('0x3b')]){_0x5f5cb4[_0xb7be('0x3c')]=[{'all':!![]}];}return db[_0xb7be('0x27')][_0xb7be('0x3d')](_0x5f5cb4);})[_0xb7be('0x1f')](function(_0x4b44bb){_0x1fd356[_0xb7be('0x3e')]=_0x4b44bb;return _0x1fd356;})['then'](respondWithFilteredResult(_0x36be86,_0x5f5cb4))['catch'](handleError(_0x36be86,null));};exports[_0xb7be('0x3f')]=function(_0x38d57a,_0x1c9391){var _0x48f234={'raw':![],'where':{'id':_0x38d57a[_0xb7be('0x40')]['id']}},_0x18b751={};_0x18b751[_0xb7be('0x2b')]=_[_0xb7be('0x41')](db[_0xb7be('0x27')][_0xb7be('0x28')]);_0x18b751[_0xb7be('0x2c')]=_[_0xb7be('0x41')](_0x38d57a['query']);_0x18b751[_0xb7be('0x2d')]=_[_0xb7be('0x2e')](_0x18b751['model'],_0x18b751['query']);_0x48f234[_0xb7be('0x2f')]=_[_0xb7be('0x2e')](_0x18b751[_0xb7be('0x2b')],qs['fields'](_0x38d57a[_0xb7be('0x2c')][_0xb7be('0x30')]));_0x48f234[_0xb7be('0x2f')]=_0x48f234[_0xb7be('0x2f')][_0xb7be('0x31')]?_0x48f234['attributes']:_0x18b751['model'];if(_0x38d57a[_0xb7be('0x2c')][_0xb7be('0x3b')]){_0x48f234[_0xb7be('0x3c')]=[{'all':!![]}];}_0x48f234=_[_0xb7be('0x38')]({},_0x48f234,_0x38d57a[_0xb7be('0x3a')]);return db[_0xb7be('0x27')]['find'](_0x48f234)[_0xb7be('0x1f')](handleEntityNotFound(_0x1c9391,null))['then'](respondWithResult(_0x1c9391,null))['catch'](handleError(_0x1c9391,null));};exports[_0xb7be('0x42')]=function(_0x41e6c2,_0x77ca4c){return db['UserProfileSection'][_0xb7be('0x42')](_0x41e6c2[_0xb7be('0x43')],{})[_0xb7be('0x1f')](respondWithResult(_0x77ca4c,0xc9))[_0xb7be('0x44')](handleError(_0x77ca4c,null));};exports['update']=function(_0x485ba3,_0x18da5b){if(_0x485ba3[_0xb7be('0x43')]['id']){delete _0x485ba3[_0xb7be('0x43')]['id'];}return db[_0xb7be('0x27')][_0xb7be('0x45')]({'where':{'id':_0x485ba3['params']['id']}})[_0xb7be('0x1f')](handleEntityNotFound(_0x18da5b,null))['then'](saveUpdates(_0x485ba3[_0xb7be('0x43')],null))[_0xb7be('0x1f')](respondWithResult(_0x18da5b,null))['catch'](handleError(_0x18da5b,null));};exports[_0xb7be('0x20')]=function(_0x1083f6,_0x30cf77){return db[_0xb7be('0x27')][_0xb7be('0x45')]({'where':{'id':_0x1083f6[_0xb7be('0x40')]['id']}})[_0xb7be('0x1f')](handleEntityNotFound(_0x30cf77,null))[_0xb7be('0x1f')](removeEntity(_0x30cf77,null))[_0xb7be('0x44')](handleError(_0x30cf77,null));};exports['describe']=function(_0x1f4168,_0x35d9a3){return db['UserProfileSection'][_0xb7be('0x46')]()[_0xb7be('0x1f')](respondWithResult(_0x35d9a3,null))[_0xb7be('0x44')](handleError(_0x35d9a3,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 80411f6..12e4e0d 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 _0xc532=['UserProfileSection','user_profile_has_sections','userProfileId','lodash','util','api','moment','request-promise','path','../../config/environment','./userProfileSection.attributes','exports','define'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0xc532,0x1b0));var _0x2c53=function(_0x28009d,_0x20286f){_0x28009d=_0x28009d-0x0;var _0x263bab=_0xc532[_0x28009d];return _0x263bab;};'use strict';var _=require(_0x2c53('0x0'));var util=require(_0x2c53('0x1'));var logger=require('../../config/logger')(_0x2c53('0x2'));var moment=require(_0x2c53('0x3'));var BPromise=require('bluebird');var rp=require(_0x2c53('0x4'));var fs=require('fs');var path=require(_0x2c53('0x5'));var rimraf=require('rimraf');var config=require(_0x2c53('0x6'));var attributes=require(_0x2c53('0x7'));module[_0x2c53('0x8')]=function(_0xa099eb,_0x72a198){return _0xa099eb[_0x2c53('0x9')](_0x2c53('0xa'),attributes,{'tableName':_0x2c53('0xb'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':['sectionId',_0x2c53('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4d77=['./userProfileSection.attributes','exports','define','UserProfileSection','compositeIndex','sectionId','userProfileId','lodash','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x4c3bbe,_0x56b505){var _0x334787=function(_0x385dcf){while(--_0x385dcf){_0x4c3bbe['push'](_0x4c3bbe['shift']());}};_0x334787(++_0x56b505);}(_0x4d77,0x96));var _0x74d7=function(_0x514cd5,_0x5a1ddd){_0x514cd5=_0x514cd5-0x0;var _0x28df30=_0x4d77[_0x514cd5];return _0x28df30;};'use strict';var _=require(_0x74d7('0x0'));var util=require('util');var logger=require(_0x74d7('0x1'))('api');var moment=require('moment');var BPromise=require(_0x74d7('0x2'));var rp=require(_0x74d7('0x3'));var fs=require('fs');var path=require(_0x74d7('0x4'));var rimraf=require(_0x74d7('0x5'));var config=require('../../config/environment');var attributes=require(_0x74d7('0x6'));module[_0x74d7('0x7')]=function(_0x7f6ef0,_0x3c002c){return _0x7f6ef0[_0x74d7('0x8')](_0x74d7('0x9'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0x74d7('0xa'),'fields':[_0x74d7('0xb'),_0x74d7('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index a1d41b6..2c68462 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 _0x7ed2=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x42bc91,_0x41f40a){var _0x3f5507=function(_0x20cfaf){while(--_0x20cfaf){_0x42bc91['push'](_0x42bc91['shift']());}};_0x3f5507(++_0x41f40a);}(_0x7ed2,0x16b));var _0x27ed=function(_0x3c67a3,_0x1a4cc3){_0x3c67a3=_0x3c67a3-0x0;var _0x1ff2ca=_0x7ed2[_0x3c67a3];return _0x1ff2ca;};'use strict';var _=require(_0x27ed('0x0'));var util=require(_0x27ed('0x1'));var moment=require(_0x27ed('0x2'));var BPromise=require(_0x27ed('0x3'));var rs=require(_0x27ed('0x4'));var fs=require('fs');var Redis=require(_0x27ed('0x5'));var db=require(_0x27ed('0x6'))['db'];var utils=require(_0x27ed('0x7'));var logger=require(_0x27ed('0x8'))(_0x27ed('0x9'));var config=require(_0x27ed('0xa'));var jayson=require(_0x27ed('0xb'));var client=jayson['client'][_0x27ed('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x409170,_0x15c2a4,_0x106537){return new BPromise(function(_0x2befc,_0x77931c){return client['request'](_0x409170,_0x106537)['then'](function(_0x219fc4){logger['info'](_0x27ed('0xd'),_0x15c2a4,_0x27ed('0xe'));logger[_0x27ed('0xf')](_0x27ed('0x10'),_0x15c2a4,_0x27ed('0xe'),JSON[_0x27ed('0x11')](_0x219fc4));if(_0x219fc4[_0x27ed('0x12')]){if(_0x219fc4['error']['code']===0x1f4){logger['error'](_0x27ed('0xd'),_0x15c2a4,_0x219fc4[_0x27ed('0x12')][_0x27ed('0x13')]);return _0x77931c(_0x219fc4[_0x27ed('0x12')][_0x27ed('0x13')]);}logger[_0x27ed('0x12')](_0x27ed('0xd'),_0x15c2a4,_0x219fc4[_0x27ed('0x12')]['message']);return _0x2befc(_0x219fc4[_0x27ed('0x12')]['message']);}else{logger[_0x27ed('0x14')]('UserProfileSection,\x20%s,\x20%s',_0x15c2a4,_0x27ed('0xe'));_0x2befc(_0x219fc4[_0x27ed('0x15')][_0x27ed('0x13')]);}})[_0x27ed('0x16')](function(_0x25f100){logger[_0x27ed('0x12')]('UserProfileSection,\x20%s,\x20%s',_0x15c2a4,_0x25f100);_0x77931c(_0x25f100);});});} \ No newline at end of file +var _0x70f3=['../../config/environment','jayson/promise','http','request','info','UserProfileSection,\x20%s,\x20%s','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x70f3,0xd4));var _0x370f=function(_0x3a2dae,_0x3b006a){_0x3a2dae=_0x3a2dae-0x0;var _0x5f35db=_0x70f3[_0x3a2dae];return _0x5f35db;};'use strict';var _=require('lodash');var util=require(_0x370f('0x0'));var moment=require(_0x370f('0x1'));var BPromise=require(_0x370f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x370f('0x3'));var db=require(_0x370f('0x4'))['db'];var utils=require(_0x370f('0x5'));var logger=require(_0x370f('0x6'))(_0x370f('0x7'));var config=require(_0x370f('0x8'));var jayson=require(_0x370f('0x9'));var client=jayson['client'][_0x370f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x58358d,_0x4fde98,_0x4a615e){return new BPromise(function(_0x4ce00f,_0x181c68){return client[_0x370f('0xb')](_0x58358d,_0x4a615e)['then'](function(_0x123eee){logger[_0x370f('0xc')](_0x370f('0xd'),_0x4fde98,'request\x20sent');logger[_0x370f('0xe')](_0x370f('0xf'),_0x4fde98,_0x370f('0x10'),JSON['stringify'](_0x123eee));if(_0x123eee[_0x370f('0x11')]){if(_0x123eee[_0x370f('0x11')]['code']===0x1f4){logger[_0x370f('0x11')](_0x370f('0xd'),_0x4fde98,_0x123eee[_0x370f('0x11')]['message']);return _0x181c68(_0x123eee[_0x370f('0x11')][_0x370f('0x12')]);}logger[_0x370f('0x11')](_0x370f('0xd'),_0x4fde98,_0x123eee[_0x370f('0x11')][_0x370f('0x12')]);return _0x4ce00f(_0x123eee[_0x370f('0x11')][_0x370f('0x12')]);}else{logger[_0x370f('0xc')](_0x370f('0xd'),_0x4fde98,'request\x20sent');_0x4ce00f(_0x123eee['result']['message']);}})[_0x370f('0x13')](function(_0x250d39){logger[_0x370f('0x11')](_0x370f('0xd'),_0x4fde98,_0x250d39);_0x181c68(_0x250d39);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index ca7abc6..93023c2 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(_0x329da1,_0x1c608e){var _0x26ca70=function(_0x5f3cbd){while(--_0x5f3cbd){_0x329da1['push'](_0x329da1['shift']());}};_0x26ca70(++_0x1c608e);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x695b76,_0x551526){_0x695b76=_0x695b76-0x0;var _0x1dc21f=_0xcb91[_0x695b76];return _0x1dc21f;};'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(_0xdb8f6,_0x579170){var _0xa29ec7=function(_0x1e2a04){while(--_0x1e2a04){_0xdb8f6['push'](_0xdb8f6['shift']());}};_0xa29ec7(++_0x579170);}(_0xedd9,0xfc));var _0x9edd=function(_0x29835c,_0x3504c2){_0x29835c=_0x29835c-0x0;var _0x3c4ac0=_0xedd9[_0x29835c];return _0x3c4ac0;};'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/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 97a270c..ed76320 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 _0x457e=['INTEGER'];(function(_0x5152db,_0x55fa0c){var _0x41f8fb=function(_0x154b40){while(--_0x154b40){_0x5152db['push'](_0x5152db['shift']());}};_0x41f8fb(++_0x55fa0c);}(_0x457e,0x15f));var _0xe457=function(_0x1e37be,_0x4480b){_0x1e37be=_0x1e37be-0x0;var _0x1c6d61=_0x457e[_0x1e37be];return _0x1c6d61;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0xe457('0x0')],'defaultValue':0x0}}; \ No newline at end of file +var _0x50b2=['exports'];(function(_0x2bbabf,_0x319d92){var _0x1633bb=function(_0x23b6dc){while(--_0x23b6dc){_0x2bbabf['push'](_0x2bbabf['shift']());}};_0x1633bb(++_0x319d92);}(_0x50b2,0x9d));var _0x250b=function(_0x38eb23,_0x196e8b){_0x38eb23=_0x38eb23-0x0;var _0x48506a=_0x50b2[_0x38eb23];return _0x48506a;};'use strict';var Sequelize=require('sequelize');module[_0x250b('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 949895b..629ffd1 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 _0x6365=['../../config/environment','exports','define','user_has_sms_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x326aa7,_0x12dceb){var _0x3955b2=function(_0x1fc290){while(--_0x1fc290){_0x326aa7['push'](_0x326aa7['shift']());}};_0x3955b2(++_0x12dceb);}(_0x6365,0x148));var _0x5636=function(_0x2f1d8b,_0x4f7bc5){_0x2f1d8b=_0x2f1d8b-0x0;var _0x5833ad=_0x6365[_0x2f1d8b];return _0x5833ad;};'use strict';var _=require(_0x5636('0x0'));var util=require(_0x5636('0x1'));var logger=require(_0x5636('0x2'))(_0x5636('0x3'));var moment=require('moment');var BPromise=require(_0x5636('0x4'));var rp=require(_0x5636('0x5'));var fs=require('fs');var path=require(_0x5636('0x6'));var rimraf=require(_0x5636('0x7'));var config=require(_0x5636('0x8'));var attributes=require('./userSmsQueue.attributes');module[_0x5636('0x9')]=function(_0x230d78,_0x2a12df){return _0x230d78[_0x5636('0xa')]('UserSmsQueue',attributes,{'tableName':_0x5636('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x01d9=['bluebird','request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports','define','UserSmsQueue','user_has_sms_queues','lodash','util','../../config/logger','api'];(function(_0x2d991c,_0x1583d4){var _0x3d5af5=function(_0x4401aa){while(--_0x4401aa){_0x2d991c['push'](_0x2d991c['shift']());}};_0x3d5af5(++_0x1583d4);}(_0x01d9,0x6c));var _0x901d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x01d9[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x901d('0x0'));var util=require(_0x901d('0x1'));var logger=require(_0x901d('0x2'))(_0x901d('0x3'));var moment=require('moment');var BPromise=require(_0x901d('0x4'));var rp=require(_0x901d('0x5'));var fs=require('fs');var path=require(_0x901d('0x6'));var rimraf=require(_0x901d('0x7'));var config=require(_0x901d('0x8'));var attributes=require(_0x901d('0x9'));module[_0x901d('0xa')]=function(_0x4e7842,_0x1e5d7d){return _0x4e7842[_0x901d('0xb')](_0x901d('0xc'),attributes,{'tableName':_0x901d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index 36dd171..b2fa43c 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 _0x4fe1=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','request','then','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserSmsQueue,\x20%s,\x20%s','message','info','result','catch','moment','bluebird'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x4fe1,0x1cc));var _0x14fe=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x4fe1[_0xdea41a];return _0x15d0d8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x14fe('0x0'));var BPromise=require(_0x14fe('0x1'));var rs=require(_0x14fe('0x2'));var fs=require('fs');var Redis=require(_0x14fe('0x3'));var db=require(_0x14fe('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x14fe('0x5'))(_0x14fe('0x6'));var config=require(_0x14fe('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3aab3b,_0x5dcec9,_0x32c774){return new BPromise(function(_0x4d69d3,_0x3da338){return client[_0x14fe('0x8')](_0x3aab3b,_0x32c774)[_0x14fe('0x9')](function(_0x2c3a56){logger['info']('UserSmsQueue,\x20%s,\x20%s',_0x5dcec9,_0x14fe('0xa'));logger[_0x14fe('0xb')](_0x14fe('0xc'),_0x5dcec9,_0x14fe('0xa'),JSON[_0x14fe('0xd')](_0x2c3a56));if(_0x2c3a56[_0x14fe('0xe')]){if(_0x2c3a56['error'][_0x14fe('0xf')]===0x1f4){logger[_0x14fe('0xe')](_0x14fe('0x10'),_0x5dcec9,_0x2c3a56[_0x14fe('0xe')][_0x14fe('0x11')]);return _0x3da338(_0x2c3a56[_0x14fe('0xe')][_0x14fe('0x11')]);}logger[_0x14fe('0xe')](_0x14fe('0x10'),_0x5dcec9,_0x2c3a56[_0x14fe('0xe')]['message']);return _0x4d69d3(_0x2c3a56[_0x14fe('0xe')][_0x14fe('0x11')]);}else{logger[_0x14fe('0x12')](_0x14fe('0x10'),_0x5dcec9,'request\x20sent');_0x4d69d3(_0x2c3a56[_0x14fe('0x13')][_0x14fe('0x11')]);}})[_0x14fe('0x14')](function(_0x306837){logger['error']('UserSmsQueue,\x20%s,\x20%s',_0x5dcec9,_0x306837);_0x3da338(_0x306837);});});} \ No newline at end of file +var _0xd95a=['UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','info'];(function(_0x585731,_0x5cdddb){var _0x4f7ff1=function(_0x2330c6){while(--_0x2330c6){_0x585731['push'](_0x585731['shift']());}};_0x4f7ff1(++_0x5cdddb);}(_0xd95a,0x9b));var _0xad95=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd95a[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xad95('0x0'));var util=require(_0xad95('0x1'));var moment=require('moment');var BPromise=require(_0xad95('0x2'));var rs=require(_0xad95('0x3'));var fs=require('fs');var Redis=require(_0xad95('0x4'));var db=require(_0xad95('0x5'))['db'];var utils=require(_0xad95('0x6'));var logger=require(_0xad95('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xad95('0x8'));var client=jayson[_0xad95('0x9')][_0xad95('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e26d7,_0x7daf3c,_0xb28b76){return new BPromise(function(_0x2561b9,_0x44c239){return client[_0xad95('0xb')](_0x1e26d7,_0xb28b76)['then'](function(_0x57845f){logger[_0xad95('0xc')](_0xad95('0xd'),_0x7daf3c,_0xad95('0xe'));logger[_0xad95('0xf')](_0xad95('0x10'),_0x7daf3c,'request\x20sent',JSON['stringify'](_0x57845f));if(_0x57845f['error']){if(_0x57845f[_0xad95('0x11')]['code']===0x1f4){logger['error']('UserSmsQueue,\x20%s,\x20%s',_0x7daf3c,_0x57845f[_0xad95('0x11')][_0xad95('0x12')]);return _0x44c239(_0x57845f[_0xad95('0x11')][_0xad95('0x12')]);}logger[_0xad95('0x11')](_0xad95('0xd'),_0x7daf3c,_0x57845f[_0xad95('0x11')][_0xad95('0x12')]);return _0x2561b9(_0x57845f[_0xad95('0x11')][_0xad95('0x12')]);}else{logger[_0xad95('0xc')](_0xad95('0xd'),_0x7daf3c,'request\x20sent');_0x2561b9(_0x57845f[_0xad95('0x13')][_0xad95('0x12')]);}})[_0xad95('0x14')](function(_0x387c7f){logger[_0xad95('0x11')](_0xad95('0xd'),_0x7daf3c,_0x387c7f);_0x44c239(_0x387c7f);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index cc5524a..c0a0c6f 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 _0x2575=['exports','INTEGER','sequelize'];(function(_0xf26c2e,_0x56c3ea){var _0x46ecb4=function(_0x1be516){while(--_0x1be516){_0xf26c2e['push'](_0xf26c2e['shift']());}};_0x46ecb4(++_0x56c3ea);}(_0x2575,0xd1));var _0x5257=function(_0x32dace,_0x176c7b){_0x32dace=_0x32dace-0x0;var _0x679407=_0x2575[_0x32dace];return _0x679407;};'use strict';var Sequelize=require(_0x5257('0x0'));module[_0x5257('0x1')]={'UserId':{'type':Sequelize[_0x5257('0x2')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x9a21=['sequelize','exports','INTEGER'];(function(_0x578a53,_0x29d7d1){var _0x358887=function(_0x4d9d70){while(--_0x4d9d70){_0x578a53['push'](_0x578a53['shift']());}};_0x358887(++_0x29d7d1);}(_0x9a21,0x15f));var _0x19a2=function(_0x5c6acd,_0x475638){_0x5c6acd=_0x5c6acd-0x0;var _0x20bb67=_0x9a21[_0x5c6acd];return _0x20bb67;};'use strict';var Sequelize=require(_0x19a2('0x0'));module[_0x19a2('0x1')]={'UserId':{'type':Sequelize[_0x19a2('0x2')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 8f2185e..e72b08e 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(_0x27a7a9,_0x2ff8e8){var _0x24651c=function(_0x11a75d){while(--_0x11a75d){_0x27a7a9['push'](_0x27a7a9['shift']());}};_0x24651c(++_0x2ff8e8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa9e0[_0x3947c9];return _0x2e7871;};'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(_0x207465,_0x95e4a1){var _0xca97f8=function(_0xfa331){while(--_0xfa331){_0x207465['push'](_0x207465['shift']());}};_0xca97f8(++_0x95e4a1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'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 fb87598..6d8e221 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(_0x1dae94,_0x239003){var _0x36ce2d=function(_0x295f18){while(--_0x295f18){_0x1dae94['push'](_0x1dae94['shift']());}};_0x36ce2d(++_0x239003);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x419d96,_0xea8a10){var _0x3c845d=function(_0x72c126){while(--_0x72c126){_0x419d96['push'](_0x419d96['shift']());}};_0x3c845d(++_0xea8a10);}(_0x70e0,0x17b));var _0x070e=function(_0x4675f4,_0x3e0a85){_0x4675f4=_0x4675f4-0x0;var _0x2ccfaa=_0x70e0[_0x4675f4];return _0x2ccfaa;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 1d3dd5b..54b9d6f 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 _0x06d0=['exports','INTEGER'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x06d0,0xa0));var _0x006d=function(_0x47a8ce,_0x4be0ed){_0x47a8ce=_0x47a8ce-0x0;var _0x262616=_0x06d0[_0x47a8ce];return _0x262616;};'use strict';var Sequelize=require('sequelize');module[_0x006d('0x0')]={'penalty':{'type':Sequelize[_0x006d('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x078c=['INTEGER','sequelize'];(function(_0x4d26f9,_0x34eb54){var _0x457b3c=function(_0x25dfc0){while(--_0x25dfc0){_0x4d26f9['push'](_0x4d26f9['shift']());}};_0x457b3c(++_0x34eb54);}(_0x078c,0x19f));var _0xc078=function(_0x383158,_0x415e43){_0x383158=_0x383158-0x0;var _0x507985=_0x078c[_0x383158];return _0x507985;};'use strict';var Sequelize=require(_0xc078('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xc078('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index c9c806d..b5de19f 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 _0x45c9=['moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','user_has_voice_queues','lodash','util','../../config/logger','api'];(function(_0x22117d,_0x5f1aca){var _0x27a087=function(_0x3644aa){while(--_0x3644aa){_0x22117d['push'](_0x22117d['shift']());}};_0x27a087(++_0x5f1aca);}(_0x45c9,0xe0));var _0x945c=function(_0x200e2d,_0xa6b814){_0x200e2d=_0x200e2d-0x0;var _0x31bf6b=_0x45c9[_0x200e2d];return _0x31bf6b;};'use strict';var _=require(_0x945c('0x0'));var util=require(_0x945c('0x1'));var logger=require(_0x945c('0x2'))(_0x945c('0x3'));var moment=require(_0x945c('0x4'));var BPromise=require(_0x945c('0x5'));var rp=require(_0x945c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x945c('0x7'));var config=require(_0x945c('0x8'));var attributes=require('./userVoiceQueue.attributes');module[_0x945c('0x9')]=function(_0x1b3fbd,_0xd45765){return _0x1b3fbd[_0x945c('0xa')]('UserVoiceQueue',attributes,{'tableName':_0x945c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa4e4=['exports','UserVoiceQueue','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes'];(function(_0x3671d0,_0x2a51e5){var _0x4e86ec=function(_0x43be0c){while(--_0x43be0c){_0x3671d0['push'](_0x3671d0['shift']());}};_0x4e86ec(++_0x2a51e5);}(_0xa4e4,0x1af));var _0x4a4e=function(_0x3a4464,_0x37afa0){_0x3a4464=_0x3a4464-0x0;var _0x42503f=_0xa4e4[_0x3a4464];return _0x42503f;};'use strict';var _=require('lodash');var util=require(_0x4a4e('0x0'));var logger=require('../../config/logger')(_0x4a4e('0x1'));var moment=require(_0x4a4e('0x2'));var BPromise=require(_0x4a4e('0x3'));var rp=require(_0x4a4e('0x4'));var fs=require('fs');var path=require(_0x4a4e('0x5'));var rimraf=require(_0x4a4e('0x6'));var config=require(_0x4a4e('0x7'));var attributes=require(_0x4a4e('0x8'));module[_0x4a4e('0x9')]=function(_0x30ef84,_0x4f4ced){return _0x30ef84['define'](_0x4a4e('0xa'),attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index 2577512..e730a84 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 _0xc3e3=['ioredis','../../config/logger','rpc','client','http','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','bluebird'];(function(_0x4e2f8e,_0x33b2e8){var _0x48571a=function(_0x1ec704){while(--_0x1ec704){_0x4e2f8e['push'](_0x4e2f8e['shift']());}};_0x48571a(++_0x33b2e8);}(_0xc3e3,0x151));var _0x3c3e=function(_0x5c0b22,_0x56d46a){_0x5c0b22=_0x5c0b22-0x0;var _0x16a8a6=_0xc3e3[_0x5c0b22];return _0x16a8a6;};'use strict';var _=require(_0x3c3e('0x0'));var util=require(_0x3c3e('0x1'));var moment=require('moment');var BPromise=require(_0x3c3e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3c3e('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3c3e('0x4'))(_0x3c3e('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3c3e('0x6')][_0x3c3e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2ecb47,_0x1f7479,_0x54800d){return new BPromise(function(_0x3ede1b,_0x29c255){return client['request'](_0x2ecb47,_0x54800d)['then'](function(_0x4f2043){logger[_0x3c3e('0x8')](_0x3c3e('0x9'),_0x1f7479,_0x3c3e('0xa'));logger['debug'](_0x3c3e('0xb'),_0x1f7479,_0x3c3e('0xa'),JSON[_0x3c3e('0xc')](_0x4f2043));if(_0x4f2043[_0x3c3e('0xd')]){if(_0x4f2043['error'][_0x3c3e('0xe')]===0x1f4){logger['error'](_0x3c3e('0x9'),_0x1f7479,_0x4f2043[_0x3c3e('0xd')][_0x3c3e('0xf')]);return _0x29c255(_0x4f2043[_0x3c3e('0xd')][_0x3c3e('0xf')]);}logger['error'](_0x3c3e('0x9'),_0x1f7479,_0x4f2043[_0x3c3e('0xd')][_0x3c3e('0xf')]);return _0x3ede1b(_0x4f2043[_0x3c3e('0xd')][_0x3c3e('0xf')]);}else{logger['info'](_0x3c3e('0x9'),_0x1f7479,_0x3c3e('0xa'));_0x3ede1b(_0x4f2043['result']['message']);}})[_0x3c3e('0x10')](function(_0x2b2f01){logger[_0x3c3e('0xd')](_0x3c3e('0x9'),_0x1f7479,_0x2b2f01);_0x29c255(_0x2b2f01);});});} \ No newline at end of file +var _0x3986=['message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x5446db,_0x14ec09){var _0x4fb491=function(_0x529c60){while(--_0x529c60){_0x5446db['push'](_0x5446db['shift']());}};_0x4fb491(++_0x14ec09);}(_0x3986,0x1e7));var _0x6398=function(_0xd49ec8,_0x557496){_0xd49ec8=_0xd49ec8-0x0;var _0x9c80ad=_0x3986[_0xd49ec8];return _0x9c80ad;};'use strict';var _=require(_0x6398('0x0'));var util=require(_0x6398('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6398('0x2'));var fs=require('fs');var Redis=require(_0x6398('0x3'));var db=require(_0x6398('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6398('0x5'))('rpc');var config=require(_0x6398('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x6398('0x7')][_0x6398('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1b4424,_0x27a5d0,_0x2e1138){return new BPromise(function(_0x86d5b7,_0x497485){return client[_0x6398('0x9')](_0x1b4424,_0x2e1138)[_0x6398('0xa')](function(_0x44fb30){logger[_0x6398('0xb')](_0x6398('0xc'),_0x27a5d0,_0x6398('0xd'));logger[_0x6398('0xe')](_0x6398('0xf'),_0x27a5d0,_0x6398('0xd'),JSON[_0x6398('0x10')](_0x44fb30));if(_0x44fb30[_0x6398('0x11')]){if(_0x44fb30['error'][_0x6398('0x12')]===0x1f4){logger[_0x6398('0x11')](_0x6398('0xc'),_0x27a5d0,_0x44fb30[_0x6398('0x11')][_0x6398('0x13')]);return _0x497485(_0x44fb30[_0x6398('0x11')]['message']);}logger[_0x6398('0x11')](_0x6398('0xc'),_0x27a5d0,_0x44fb30[_0x6398('0x11')][_0x6398('0x13')]);return _0x86d5b7(_0x44fb30[_0x6398('0x11')][_0x6398('0x13')]);}else{logger[_0x6398('0xb')](_0x6398('0xc'),_0x27a5d0,'request\x20sent');_0x86d5b7(_0x44fb30[_0x6398('0x14')][_0x6398('0x13')]);}})[_0x6398('0x15')](function(_0x16315d){logger[_0x6398('0x11')]('UserVoiceQueue,\x20%s,\x20%s',_0x27a5d0,_0x16315d);_0x497485(_0x16315d);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index e0c9be0..ae4f6cf 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0xa1b74d,_0x614e6f){var _0x56bad4=function(_0x29795c){while(--_0x29795c){_0xa1b74d['push'](_0xa1b74d['shift']());}};_0x56bad4(++_0x614e6f);}(_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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x411576,_0x89f531){var _0x5f0dff=function(_0x1bb83f){while(--_0x1bb83f){_0x411576['push'](_0x411576['shift']());}};_0x5f0dff(++_0x89f531);}(_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/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 6825b10..fa3ee9a 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 _0xcf0d=['queue_interface','Required\x20by\x20Asterisk','STRING','INTEGER'];(function(_0x1081a3,_0x2ac784){var _0x5696a2=function(_0x23d2f6){while(--_0x23d2f6){_0x1081a3['push'](_0x1081a3['shift']());}};_0x5696a2(++_0x2ac784);}(_0xcf0d,0x1d6));var _0xdcf0=function(_0x5c5b73,_0x26c7e4){_0x5c5b73=_0x5c5b73-0x0;var _0x3975db=_0xcf0d[_0x5c5b73];return _0x3975db;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0xdcf0('0x0')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0xdcf0('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize[_0xdcf0('0x0')],'allowNull':![],'unique':_0xdcf0('0x2'),'comment':_0xdcf0('0x3')},'VoiceQueueId':{'type':Sequelize[_0xdcf0('0x1')],'allowNull':![]},'interface':{'type':Sequelize[_0xdcf0('0x0')],'allowNull':![],'unique':'queue_interface','comment':_0xdcf0('0x3')},'penalty':{'type':Sequelize[_0xdcf0('0x1')](0xb),'defaultValue':0x0,'comment':_0xdcf0('0x3')},'paused':{'type':Sequelize[_0xdcf0('0x1')](0xb),'defaultValue':0x0,'comment':_0xdcf0('0x3')}}; \ No newline at end of file +var _0x1f45=['exports','INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface'];(function(_0x237ebe,_0x47a62d){var _0x49e858=function(_0x8340e7){while(--_0x8340e7){_0x237ebe['push'](_0x237ebe['shift']());}};_0x49e858(++_0x47a62d);}(_0x1f45,0x186));var _0x51f4=function(_0x541b98,_0xe002da){_0x541b98=_0x541b98-0x0;var _0x4e43f3=_0x1f45[_0x541b98];return _0x4e43f3;};'use strict';var Sequelize=require('sequelize');module[_0x51f4('0x0')]={'uniqueid':{'type':Sequelize[_0x51f4('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x51f4('0x2')},'membername':{'type':Sequelize[_0x51f4('0x3')],'allowNull':![],'comment':_0x51f4('0x2')},'UserId':{'type':Sequelize[_0x51f4('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x51f4('0x3')],'allowNull':![],'unique':_0x51f4('0x4'),'comment':_0x51f4('0x2')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0x51f4('0x3')],'allowNull':![],'unique':_0x51f4('0x4'),'comment':_0x51f4('0x2')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x51f4('0x2')},'paused':{'type':Sequelize[_0x51f4('0x1')](0xb),'defaultValue':0x0,'comment':_0x51f4('0x2')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index fd4f99d..f84dd7f 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 _0x0976=['../../mysqldb','update','remove','emit','hook','exports','events'];(function(_0x3b1507,_0x4182c1){var _0x1de16d=function(_0x129ed0){while(--_0x129ed0){_0x3b1507['push'](_0x3b1507['shift']());}};_0x1de16d(++_0x4182c1);}(_0x0976,0x13a));var _0x6097=function(_0x2de2b4,_0x3c975f){_0x2de2b4=_0x2de2b4-0x0;var _0x98c332=_0x0976[_0x2de2b4];return _0x98c332;};'use strict';var EventEmitter=require(_0x6097('0x0'));var UserVoiceQueueRt=require(_0x6097('0x1'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x6097('0x2'),'afterDestroy':_0x6097('0x3')};function emitEvent(_0x449757){return function(_0x40008e,_0x31da3a,_0x59d79f){UserVoiceQueueRtEvents[_0x6097('0x4')](_0x449757+':'+_0x40008e['id'],_0x40008e);UserVoiceQueueRtEvents['emit'](_0x449757,_0x40008e);_0x59d79f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0x6097('0x5')](e,emitEvent(event));}}module[_0x6097('0x6')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0xeca7=['exports','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','update','remove','emit'];(function(_0x151d64,_0x360f73){var _0x409cfd=function(_0x152309){while(--_0x152309){_0x151d64['push'](_0x151d64['shift']());}};_0x409cfd(++_0x360f73);}(_0xeca7,0x13c));var _0x7eca=function(_0x549c39,_0x1f88de){_0x549c39=_0x549c39-0x0;var _0xb88b84=_0xeca7[_0x549c39];return _0xb88b84;};'use strict';var EventEmitter=require(_0x7eca('0x0'));var UserVoiceQueueRt=require(_0x7eca('0x1'))['db'][_0x7eca('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x7eca('0x3')](0x0);var events={'afterCreate':_0x7eca('0x4'),'afterUpdate':_0x7eca('0x5'),'afterDestroy':_0x7eca('0x6')};function emitEvent(_0x2dce46){return function(_0x5de2fa,_0x2ad030,_0xa72ee6){UserVoiceQueueRtEvents['emit'](_0x2dce46+':'+_0x5de2fa['id'],_0x5de2fa);UserVoiceQueueRtEvents[_0x7eca('0x7')](_0x2dce46,_0x5de2fa);_0xa72ee6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module[_0x7eca('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 4a5db15..b376a8a 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 _0x5a65=['../../config/environment','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x5a65,0x71));var _0x55a6=function(_0x55101b,_0x4135e1){_0x55101b=_0x55101b-0x0;var _0x887298=_0x5a65[_0x55101b];return _0x887298;};'use strict';var _=require(_0x55a6('0x0'));var util=require(_0x55a6('0x1'));var logger=require(_0x55a6('0x2'))('api');var moment=require(_0x55a6('0x3'));var BPromise=require(_0x55a6('0x4'));var rp=require(_0x55a6('0x5'));var fs=require('fs');var path=require(_0x55a6('0x6'));var rimraf=require('rimraf');var config=require(_0x55a6('0x7'));var attributes=require('./userVoiceQueueRt.attributes');module[_0x55a6('0x8')]=function(_0x591338,_0x5af78f){return _0x591338[_0x55a6('0x9')](_0x55a6('0xa'),attributes,{'tableName':_0x55a6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfec2=['./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x237a39,_0x84f761){var _0x1fc502=function(_0x14a032){while(--_0x14a032){_0x237a39['push'](_0x237a39['shift']());}};_0x1fc502(++_0x84f761);}(_0xfec2,0x75));var _0x2fec=function(_0x97c30e,_0x400204){_0x97c30e=_0x97c30e-0x0;var _0x408d99=_0xfec2[_0x97c30e];return _0x408d99;};'use strict';var _=require(_0x2fec('0x0'));var util=require(_0x2fec('0x1'));var logger=require(_0x2fec('0x2'))(_0x2fec('0x3'));var moment=require(_0x2fec('0x4'));var BPromise=require(_0x2fec('0x5'));var rp=require(_0x2fec('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2fec('0x7'));var config=require(_0x2fec('0x8'));var attributes=require(_0x2fec('0x9'));module[_0x2fec('0xa')]=function(_0x42a5c2,_0x4e3c0b){return _0x42a5c2[_0x2fec('0xb')](_0x2fec('0xc'),attributes,{'tableName':_0x2fec('0xd'),'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 ee27ae5..9bfda70 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 _0x9024=['message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','sequelize','outboundQueuePauses','then','info','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x31a371,_0x50828e){var _0x2a5bd6=function(_0x2fb481){while(--_0x2fb481){_0x31a371['push'](_0x31a371['shift']());}};_0x2a5bd6(++_0x50828e);}(_0x9024,0x74));var _0x4902=function(_0x2d7f5f,_0x6d9b8){_0x2d7f5f=_0x2d7f5f-0x0;var _0x5e0a67=_0x9024[_0x2d7f5f];return _0x5e0a67;};'use strict';var _=require('lodash');var util=require(_0x4902('0x0'));var moment=require(_0x4902('0x1'));var BPromise=require(_0x4902('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4902('0x3'));var db=require(_0x4902('0x4'))['db'];var utils=require(_0x4902('0x5'));var logger=require(_0x4902('0x6'))(_0x4902('0x7'));var config=require('../../config/environment');var jayson=require(_0x4902('0x8'));var client=jayson[_0x4902('0x9')][_0x4902('0xa')]({'port':0x232a});config[_0x4902('0xb')]=_['defaults'](config[_0x4902('0xb')],{'host':_0x4902('0xc'),'port':0x18eb});var socket=require(_0x4902('0xd'))(new Redis(config['redis']));require(_0x4902('0xe'))[_0x4902('0xf')](socket);function respondWithRpcPromise(_0x22a39f,_0x2e8e26,_0x1b3656){return new BPromise(function(_0x33ba6f,_0x56bc60){return client[_0x4902('0x10')](_0x22a39f,_0x1b3656)['then'](function(_0x34a533){logger['info'](_0x4902('0x11'),_0x2e8e26,_0x4902('0x12'));logger[_0x4902('0x13')](_0x4902('0x14'),_0x2e8e26,_0x4902('0x12'),JSON[_0x4902('0x15')](_0x34a533));if(_0x34a533[_0x4902('0x16')]){if(_0x34a533[_0x4902('0x16')][_0x4902('0x17')]===0x1f4){logger[_0x4902('0x16')](_0x4902('0x11'),_0x2e8e26,_0x34a533[_0x4902('0x16')]['message']);return _0x56bc60(_0x34a533[_0x4902('0x16')][_0x4902('0x18')]);}logger[_0x4902('0x16')](_0x4902('0x11'),_0x2e8e26,_0x34a533[_0x4902('0x16')][_0x4902('0x18')]);return _0x33ba6f(_0x34a533[_0x4902('0x16')][_0x4902('0x18')]);}else{logger['info'](_0x4902('0x11'),_0x2e8e26,_0x4902('0x12'));_0x33ba6f(_0x34a533[_0x4902('0x19')][_0x4902('0x18')]);}})[_0x4902('0x1a')](function(_0x22daa2){logger['error'](_0x4902('0x11'),_0x2e8e26,_0x22daa2);_0x56bc60(_0x22daa2);});});}exports[_0x4902('0x1b')]=function(_0x25ace6){var _0x4de962=this;return new Promise(function(_0x29ad5b,_0x4f7935){return db[_0x4902('0x1c')][_0x4902('0x1d')]({'raw':_0x25ace6[_0x4902('0x1e')]?_0x25ace6[_0x4902('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x25ace6['options']?_0x25ace6[_0x4902('0x1e')]['where']||null:null,'attributes':[[db[_0x4902('0x1f')]['fn']('COUNT',db[_0x4902('0x1f')]['fn']('IF',db[_0x4902('0x1f')]['literal']('`paused`\x20=\x201,\x201,\x20null'))),_0x4902('0x20')]]})[_0x4902('0x21')](function(_0x13146d){logger[_0x4902('0x22')](_0x4902('0x1b'),_0x25ace6);logger[_0x4902('0x13')](_0x4902('0x1b'),_0x25ace6,JSON[_0x4902('0x15')](_0x13146d));_0x29ad5b(_0x13146d);})['catch'](function(_0x507622){logger[_0x4902('0x16')]('GetVoiceQueueRtPauses',_0x507622['message'],_0x25ace6);_0x4f7935(_0x4de962[_0x4902('0x16')](0x1f4,_0x507622[_0x4902('0x18')]));});});}; \ No newline at end of file +var _0x9074=['code','message','info','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','where','sequelize','COUNT','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','error'];(function(_0x1e08f8,_0x40723d){var _0x9c34d=function(_0x5db273){while(--_0x5db273){_0x1e08f8['push'](_0x1e08f8['shift']());}};_0x9c34d(++_0x40723d);}(_0x9074,0x146));var _0x4907=function(_0x415f47,_0xe2c19d){_0x415f47=_0x415f47-0x0;var _0x5e2513=_0x9074[_0x415f47];return _0x5e2513;};'use strict';var _=require(_0x4907('0x0'));var util=require(_0x4907('0x1'));var moment=require(_0x4907('0x2'));var BPromise=require('bluebird');var rs=require(_0x4907('0x3'));var fs=require('fs');var Redis=require(_0x4907('0x4'));var db=require(_0x4907('0x5'))['db'];var utils=require(_0x4907('0x6'));var logger=require(_0x4907('0x7'))(_0x4907('0x8'));var config=require(_0x4907('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x4907('0xa')][_0x4907('0xb')]({'port':0x232a});config[_0x4907('0xc')]=_[_0x4907('0xd')](config[_0x4907('0xc')],{'host':_0x4907('0xe'),'port':0x18eb});var socket=require(_0x4907('0xf'))(new Redis(config['redis']));require(_0x4907('0x10'))[_0x4907('0x11')](socket);function respondWithRpcPromise(_0x4d465e,_0x37b843,_0x12254c){return new BPromise(function(_0x127591,_0x2aea61){return client[_0x4907('0x12')](_0x4d465e,_0x12254c)[_0x4907('0x13')](function(_0x3c63ac){logger['info'](_0x4907('0x14'),_0x37b843,_0x4907('0x15'));logger[_0x4907('0x16')](_0x4907('0x17'),_0x37b843,_0x4907('0x15'),JSON['stringify'](_0x3c63ac));if(_0x3c63ac[_0x4907('0x18')]){if(_0x3c63ac[_0x4907('0x18')][_0x4907('0x19')]===0x1f4){logger[_0x4907('0x18')](_0x4907('0x14'),_0x37b843,_0x3c63ac['error'][_0x4907('0x1a')]);return _0x2aea61(_0x3c63ac[_0x4907('0x18')][_0x4907('0x1a')]);}logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x37b843,_0x3c63ac[_0x4907('0x18')][_0x4907('0x1a')]);return _0x127591(_0x3c63ac[_0x4907('0x18')][_0x4907('0x1a')]);}else{logger[_0x4907('0x1b')](_0x4907('0x14'),_0x37b843,_0x4907('0x15'));_0x127591(_0x3c63ac['result']['message']);}})[_0x4907('0x1c')](function(_0x4b6a7c){logger[_0x4907('0x18')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x37b843,_0x4b6a7c);_0x2aea61(_0x4b6a7c);});});}exports[_0x4907('0x1d')]=function(_0x4b77ef){var _0xb47cd0=this;return new Promise(function(_0x177de1,_0x9a2fd0){return db[_0x4907('0x1e')][_0x4907('0x1f')]({'raw':_0x4b77ef['options']?_0x4b77ef['options']['raw']===undefined?!![]:![]:!![],'where':_0x4b77ef[_0x4907('0x20')]?_0x4b77ef[_0x4907('0x20')][_0x4907('0x21')]||null:null,'attributes':[[db[_0x4907('0x22')]['fn'](_0x4907('0x23'),db[_0x4907('0x22')]['fn']('IF',db[_0x4907('0x22')]['literal'](_0x4907('0x24')))),_0x4907('0x25')]]})[_0x4907('0x13')](function(_0x4abd0d){logger['info'](_0x4907('0x1d'),_0x4b77ef);logger[_0x4907('0x16')](_0x4907('0x1d'),_0x4b77ef,JSON[_0x4907('0x26')](_0x4abd0d));_0x177de1(_0x4abd0d);})[_0x4907('0x1c')](function(_0xf9b87b){logger[_0x4907('0x18')](_0x4907('0x1d'),_0xf9b87b['message'],_0x4b77ef);_0x9a2fd0(_0xb47cd0[_0x4907('0x18')](0x1f4,_0xf9b87b[_0x4907('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index e721dfb..36f2b93 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 _0xbccd=['emit','removeListener','register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','update'];(function(_0x3d86cc,_0x45ae9c){var _0x3147f2=function(_0x299aa4){while(--_0x299aa4){_0x3d86cc['push'](_0x3d86cc['shift']());}};_0x3147f2(++_0x45ae9c);}(_0xbccd,0x1b0));var _0xdbcc=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0xbccd[_0x3ff085];return _0x2b68c3;};'use strict';var UserVoiceQueueRtEvents=require(_0xdbcc('0x0'));var events=['save','remove',_0xdbcc('0x1')];function createListener(_0x1c6fb5,_0x39bff4){return function(_0x193088){_0x39bff4[_0xdbcc('0x2')](_0x1c6fb5,_0x193088);};}function removeListener(_0x33b260,_0x4bd11a){return function(){UserVoiceQueueRtEvents[_0xdbcc('0x3')](_0x33b260,_0x4bd11a);};}exports[_0xdbcc('0x4')]=function(_0x9cca7a){for(var _0x2997fd=0x0,_0x7fe600=events[_0xdbcc('0x5')];_0x2997fd<_0x7fe600;_0x2997fd++){var _0x216289=events[_0x2997fd];var _0x22d783=createListener(_0xdbcc('0x6')+_0x216289,_0x9cca7a);UserVoiceQueueRtEvents['on'](_0x216289,_0x22d783);}}; \ No newline at end of file +var _0x6c14=['length','userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove','update','emit','removeListener','register'];(function(_0x12420d,_0x4cbc00){var _0x5650b4=function(_0x14a2a0){while(--_0x14a2a0){_0x12420d['push'](_0x12420d['shift']());}};_0x5650b4(++_0x4cbc00);}(_0x6c14,0xd1));var _0x46c1=function(_0x1293c4,_0x528f3f){_0x1293c4=_0x1293c4-0x0;var _0x29f499=_0x6c14[_0x1293c4];return _0x29f499;};'use strict';var UserVoiceQueueRtEvents=require(_0x46c1('0x0'));var events=[_0x46c1('0x1'),_0x46c1('0x2'),_0x46c1('0x3')];function createListener(_0xefbe38,_0x48cbdf){return function(_0x142e95){_0x48cbdf[_0x46c1('0x4')](_0xefbe38,_0x142e95);};}function removeListener(_0x311234,_0x5b4a69){return function(){UserVoiceQueueRtEvents[_0x46c1('0x5')](_0x311234,_0x5b4a69);};}exports[_0x46c1('0x6')]=function(_0x30120b){for(var _0x270204=0x0,_0x29b2d8=events[_0x46c1('0x7')];_0x270204<_0x29b2d8;_0x270204++){var _0xfaf798=events[_0x270204];var _0x1277f7=createListener(_0x46c1('0x8')+_0xfaf798,_0x30120b);UserVoiceQueueRtEvents['on'](_0xfaf798,_0x1277f7);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index bf89b1d..982a27b 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x2fc638,_0x412c66){var _0x1a60c5=function(_0x1c6b99){while(--_0x1c6b99){_0x2fc638['push'](_0x2fc638['shift']());}};_0x1a60c5(++_0x412c66);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x1e79d8,_0x3f2aa7){var _0x3c2e1c=function(_0xd2ccd4){while(--_0xd2ccd4){_0x1e79d8['push'](_0x1e79d8['shift']());}};_0x3c2e1c(++_0x3f2aa7);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index de18233..dadea01 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 _0xd344=['exports','INTEGER','sequelize'];(function(_0x374ada,_0x27b3a5){var _0x449ed8=function(_0x3efc46){while(--_0x3efc46){_0x374ada['push'](_0x374ada['shift']());}};_0x449ed8(++_0x27b3a5);}(_0xd344,0x104));var _0x4d34=function(_0x669b3a,_0xd3473a){_0x669b3a=_0x669b3a-0x0;var _0x127bdd=_0xd344[_0x669b3a];return _0x127bdd;};'use strict';var Sequelize=require(_0x4d34('0x0'));module[_0x4d34('0x1')]={'penalty':{'type':Sequelize[_0x4d34('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x23d3=['exports','INTEGER'];(function(_0x4aee1c,_0x30cb55){var _0x573132=function(_0x3a28b3){while(--_0x3a28b3){_0x4aee1c['push'](_0x4aee1c['shift']());}};_0x573132(++_0x30cb55);}(_0x23d3,0x158));var _0x323d=function(_0x3c7f15,_0x1e50e8){_0x3c7f15=_0x3c7f15-0x0;var _0x3920ef=_0x23d3[_0x3c7f15];return _0x3920ef;};'use strict';var Sequelize=require('sequelize');module[_0x323d('0x0')]={'penalty':{'type':Sequelize[_0x323d('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 dcdc28f..789f435 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 _0x617a=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','UserWhatsappQueue','user_has_whatsapp_queues'];(function(_0x236ffe,_0x31f020){var _0x469a34=function(_0x839049){while(--_0x839049){_0x236ffe['push'](_0x236ffe['shift']());}};_0x469a34(++_0x31f020);}(_0x617a,0x18c));var _0xa617=function(_0x2fc9e2,_0x1bdb51){_0x2fc9e2=_0x2fc9e2-0x0;var _0x2d1b9c=_0x617a[_0x2fc9e2];return _0x2d1b9c;};'use strict';var _=require('lodash');var util=require(_0xa617('0x0'));var logger=require(_0xa617('0x1'))('api');var moment=require(_0xa617('0x2'));var BPromise=require(_0xa617('0x3'));var rp=require(_0xa617('0x4'));var fs=require('fs');var path=require(_0xa617('0x5'));var rimraf=require(_0xa617('0x6'));var config=require(_0xa617('0x7'));var attributes=require('./userWhatsappQueue.attributes');module[_0xa617('0x8')]=function(_0x1d461a,_0x549089){return _0x1d461a[_0xa617('0x9')](_0xa617('0xa'),attributes,{'tableName':_0xa617('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6916=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','define','user_has_whatsapp_queues','lodash'];(function(_0x31ad81,_0x466fc0){var _0x5e0b4c=function(_0x5a7950){while(--_0x5a7950){_0x31ad81['push'](_0x31ad81['shift']());}};_0x5e0b4c(++_0x466fc0);}(_0x6916,0x19f));var _0x6691=function(_0x2a9dd3,_0x4bbffb){_0x2a9dd3=_0x2a9dd3-0x0;var _0xf26b5f=_0x6916[_0x2a9dd3];return _0xf26b5f;};'use strict';var _=require(_0x6691('0x0'));var util=require(_0x6691('0x1'));var logger=require(_0x6691('0x2'))(_0x6691('0x3'));var moment=require('moment');var BPromise=require(_0x6691('0x4'));var rp=require(_0x6691('0x5'));var fs=require('fs');var path=require(_0x6691('0x6'));var rimraf=require(_0x6691('0x7'));var config=require(_0x6691('0x8'));var attributes=require(_0x6691('0x9'));module[_0x6691('0xa')]=function(_0x3123a1,_0x4773bc){return _0x3123a1[_0x6691('0xb')]('UserWhatsappQueue',attributes,{'tableName':_0x6691('0xc'),'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 14f62c9..d8d82e4 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 _0x90cd=['http','then','info','UserWhatsappQueue,\x20%s,\x20%s','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc'];(function(_0x24c1aa,_0x5a5e2b){var _0xc35381=function(_0x137ec8){while(--_0x137ec8){_0x24c1aa['push'](_0x24c1aa['shift']());}};_0xc35381(++_0x5a5e2b);}(_0x90cd,0xca));var _0xd90c=function(_0x621b92,_0x50c8ff){_0x621b92=_0x621b92-0x0;var _0xadfec9=_0x90cd[_0x621b92];return _0xadfec9;};'use strict';var _=require(_0xd90c('0x0'));var util=require(_0xd90c('0x1'));var moment=require(_0xd90c('0x2'));var BPromise=require(_0xd90c('0x3'));var rs=require(_0xd90c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd90c('0x5'))['db'];var utils=require(_0xd90c('0x6'));var logger=require('../../config/logger')(_0xd90c('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xd90c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5e9103,_0x30b541,_0x380332){return new BPromise(function(_0x57a0be,_0x3551b9){return client['request'](_0x5e9103,_0x380332)[_0xd90c('0x9')](function(_0x1cb006){logger[_0xd90c('0xa')](_0xd90c('0xb'),_0x30b541,'request\x20sent');logger[_0xd90c('0xc')](_0xd90c('0xd'),_0x30b541,_0xd90c('0xe'),JSON[_0xd90c('0xf')](_0x1cb006));if(_0x1cb006[_0xd90c('0x10')]){if(_0x1cb006[_0xd90c('0x10')][_0xd90c('0x11')]===0x1f4){logger['error'](_0xd90c('0xb'),_0x30b541,_0x1cb006[_0xd90c('0x10')][_0xd90c('0x12')]);return _0x3551b9(_0x1cb006[_0xd90c('0x10')][_0xd90c('0x12')]);}logger[_0xd90c('0x10')](_0xd90c('0xb'),_0x30b541,_0x1cb006[_0xd90c('0x10')][_0xd90c('0x12')]);return _0x57a0be(_0x1cb006[_0xd90c('0x10')][_0xd90c('0x12')]);}else{logger[_0xd90c('0xa')]('UserWhatsappQueue,\x20%s,\x20%s',_0x30b541,_0xd90c('0xe'));_0x57a0be(_0x1cb006[_0xd90c('0x13')][_0xd90c('0x12')]);}})[_0xd90c('0x14')](function(_0x5c74fc){logger[_0xd90c('0x10')](_0xd90c('0xb'),_0x30b541,_0x5c74fc);_0x3551b9(_0x5c74fc);});});} \ No newline at end of file +var _0x21ca=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','debug','request\x20sent','error','message','result','catch'];(function(_0x1a4aef,_0x5dbf06){var _0x38b004=function(_0x1d5ffa){while(--_0x1d5ffa){_0x1a4aef['push'](_0x1a4aef['shift']());}};_0x38b004(++_0x5dbf06);}(_0x21ca,0x1b5));var _0xa21c=function(_0x51b363,_0x8c66d1){_0x51b363=_0x51b363-0x0;var _0x45c962=_0x21ca[_0x51b363];return _0x45c962;};'use strict';var _=require(_0xa21c('0x0'));var util=require(_0xa21c('0x1'));var moment=require(_0xa21c('0x2'));var BPromise=require(_0xa21c('0x3'));var rs=require(_0xa21c('0x4'));var fs=require('fs');var Redis=require(_0xa21c('0x5'));var db=require(_0xa21c('0x6'))['db'];var utils=require(_0xa21c('0x7'));var logger=require(_0xa21c('0x8'))('rpc');var config=require(_0xa21c('0x9'));var jayson=require(_0xa21c('0xa'));var client=jayson[_0xa21c('0xb')][_0xa21c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x59bc16,_0xf107e4,_0x5d2c3e){return new BPromise(function(_0x230e34,_0x3b6713){return client[_0xa21c('0xd')](_0x59bc16,_0x5d2c3e)[_0xa21c('0xe')](function(_0x1490b1){logger[_0xa21c('0xf')](_0xa21c('0x10'),_0xf107e4,'request\x20sent');logger[_0xa21c('0x11')]('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0xf107e4,_0xa21c('0x12'),JSON['stringify'](_0x1490b1));if(_0x1490b1[_0xa21c('0x13')]){if(_0x1490b1['error']['code']===0x1f4){logger[_0xa21c('0x13')](_0xa21c('0x10'),_0xf107e4,_0x1490b1[_0xa21c('0x13')][_0xa21c('0x14')]);return _0x3b6713(_0x1490b1[_0xa21c('0x13')][_0xa21c('0x14')]);}logger[_0xa21c('0x13')]('UserWhatsappQueue,\x20%s,\x20%s',_0xf107e4,_0x1490b1[_0xa21c('0x13')][_0xa21c('0x14')]);return _0x230e34(_0x1490b1[_0xa21c('0x13')][_0xa21c('0x14')]);}else{logger[_0xa21c('0xf')]('UserWhatsappQueue,\x20%s,\x20%s',_0xf107e4,_0xa21c('0x12'));_0x230e34(_0x1490b1[_0xa21c('0x15')][_0xa21c('0x14')]);}})[_0xa21c('0x16')](function(_0x51c299){logger[_0xa21c('0x13')]('UserWhatsappQueue,\x20%s,\x20%s',_0xf107e4,_0x51c299);_0x3b6713(_0x51c299);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 09fadd8..c5aa47f 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 _0x4711=['show','post','create','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./variable.controller','get','isAuthenticated','index'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0x4711,0x10c));var _0x1471=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4711[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x1471('0x0'));var util=require(_0x1471('0x1'));var path=require(_0x1471('0x2'));var timeout=require(_0x1471('0x3'));var express=require(_0x1471('0x4'));var router=express[_0x1471('0x5')]();var fs_extra=require(_0x1471('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x1471('0x7'));var config=require('../../config/environment');var controller=require(_0x1471('0x8'));router[_0x1471('0x9')]('/',auth[_0x1471('0xa')](),controller[_0x1471('0xb')]);router[_0x1471('0x9')]('/:id',auth[_0x1471('0xa')](),controller[_0x1471('0xc')]);router[_0x1471('0xd')]('/',auth[_0x1471('0xa')](),controller[_0x1471('0xe')]);router['put']('/:id',auth[_0x1471('0xa')](),controller[_0x1471('0xf')]);router[_0x1471('0x10')](_0x1471('0x11'),auth[_0x1471('0xa')](),controller[_0x1471('0x12')]);module[_0x1471('0x13')]=router; \ No newline at end of file +var _0xe062=['express','Router','../../components/interaction/service','../../config/environment','isAuthenticated','index','show','post','create','put','update','delete','/:id','destroy','exports','multer','util','connect-timeout'];(function(_0x4c54a1,_0x493a44){var _0x242c78=function(_0x38e007){while(--_0x38e007){_0x4c54a1['push'](_0x4c54a1['shift']());}};_0x242c78(++_0x493a44);}(_0xe062,0xd5));var _0x2e06=function(_0x34b2dc,_0x4a215a){_0x34b2dc=_0x34b2dc-0x0;var _0x49b872=_0xe062[_0x34b2dc];return _0x49b872;};'use strict';var multer=require(_0x2e06('0x0'));var util=require(_0x2e06('0x1'));var path=require('path');var timeout=require(_0x2e06('0x2'));var express=require(_0x2e06('0x3'));var router=express[_0x2e06('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x2e06('0x5'));var config=require(_0x2e06('0x6'));var controller=require('./variable.controller');router['get']('/',auth[_0x2e06('0x7')](),controller[_0x2e06('0x8')]);router['get']('/:id',auth[_0x2e06('0x7')](),controller[_0x2e06('0x9')]);router[_0x2e06('0xa')]('/',auth[_0x2e06('0x7')](),controller[_0x2e06('0xb')]);router[_0x2e06('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x2e06('0xd')]);router[_0x2e06('0xe')](_0x2e06('0xf'),auth['isAuthenticated'](),controller[_0x2e06('0x10')]);module[_0x2e06('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 c5b3eae..3509a86 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 _0x6a2e=['name','sequelize','exports','STRING'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0x6a2e,0x14d));var _0xe6a2=function(_0x3d509c,_0x13c25e){_0x3d509c=_0x3d509c-0x0;var _0x15d5b1=_0x6a2e[_0x3d509c];return _0x15d5b1;};'use strict';var Sequelize=require(_0xe6a2('0x0'));module[_0xe6a2('0x1')]={'name':{'type':Sequelize[_0xe6a2('0x2')],'unique':_0xe6a2('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xe6a2('0x2')]}}; \ No newline at end of file +var _0x0f16=['name','STRING','sequelize','exports'];(function(_0x2d91df,_0x245ce5){var _0x35ddf4=function(_0x49f88f){while(--_0x49f88f){_0x2d91df['push'](_0x2d91df['shift']());}};_0x35ddf4(++_0x245ce5);}(_0x0f16,0x192));var _0x60f1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0f16[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x60f1('0x0'));module[_0x60f1('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x60f1('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x60f1('0x3')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index d428c1a..af34340 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 _0x2e82=['keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','merge','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','body','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','get','Variables','UserProfileResource','destroy','error','stack','name','send','index','map','Variable','rawAttributes','fieldName','type','key','model'];(function(_0x1014e0,_0x446f45){var _0x287355=function(_0x280f69){while(--_0x280f69){_0x1014e0['push'](_0x1014e0['shift']());}};_0x287355(++_0x446f45);}(_0x2e82,0x76));var _0x22e8=function(_0x2894cc,_0x33d28d){_0x2894cc=_0x2894cc-0x0;var _0xab0a4e=_0x2e82[_0x2894cc];return _0xab0a4e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x22e8('0x0'));var jsonpatch=require(_0x22e8('0x1'));var rp=require(_0x22e8('0x2'));var moment=require('moment');var BPromise=require(_0x22e8('0x3'));var Mustache=require(_0x22e8('0x4'));var util=require(_0x22e8('0x5'));var path=require(_0x22e8('0x6'));var sox=require(_0x22e8('0x7'));var csv=require(_0x22e8('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x22e8('0x9'));var _=require(_0x22e8('0xa'));var squel=require(_0x22e8('0xb'));var crypto=require(_0x22e8('0xc'));var jsforce=require(_0x22e8('0xd'));var deskjs=require(_0x22e8('0xe'));var toCsv=require(_0x22e8('0x8'));var querystring=require(_0x22e8('0xf'));var Papa=require(_0x22e8('0x10'));var Redis=require(_0x22e8('0x11'));var authService=require(_0x22e8('0x12'));var qs=require(_0x22e8('0x13'));var as=require(_0x22e8('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x22e8('0x15'))(_0x22e8('0x16'));var utils=require(_0x22e8('0x17'));var config=require(_0x22e8('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x22e8('0x19'))['db'];function respondWithStatusCode(_0x2ab1a7,_0x5b8c50){_0x5b8c50=_0x5b8c50||0xcc;return function(_0x21f9ff){if(_0x21f9ff){return _0x2ab1a7[_0x22e8('0x1a')](_0x5b8c50);}return _0x2ab1a7[_0x22e8('0x1b')](_0x5b8c50)[_0x22e8('0x1c')]();};}function respondWithResult(_0x55e26c,_0x15da64){_0x15da64=_0x15da64||0xc8;return function(_0x5505af){if(_0x5505af){return _0x55e26c[_0x22e8('0x1b')](_0x15da64)[_0x22e8('0x1d')](_0x5505af);}};}function respondWithFilteredResult(_0x12bf1d,_0x4901b4){return function(_0x574f82){if(_0x574f82){var _0x3ceb89=typeof _0x4901b4[_0x22e8('0x1e')]===_0x22e8('0x1f')&&typeof _0x4901b4[_0x22e8('0x20')]===_0x22e8('0x1f');var _0x453c4e=_0x574f82[_0x22e8('0x21')];var _0x18fd71=_0x3ceb89?0x0:_0x4901b4[_0x22e8('0x1e')];var _0x853d7e=_0x3ceb89?_0x574f82[_0x22e8('0x21')]:_0x4901b4['offset']+_0x4901b4['limit'];var _0x34be47;if(_0x853d7e>=_0x453c4e){_0x853d7e=_0x453c4e;_0x34be47=0xc8;}else{_0x34be47=0xce;}_0x12bf1d[_0x22e8('0x1b')](_0x34be47);return _0x12bf1d[_0x22e8('0x22')]('Content-Range',_0x18fd71+'-'+_0x853d7e+'/'+_0x453c4e)['json'](_0x574f82);}return null;};}function patchUpdates(_0x187557){return function(_0x189785){try{jsonpatch[_0x22e8('0x23')](_0x189785,_0x187557,!![]);}catch(_0x220f94){return BPromise[_0x22e8('0x24')](_0x220f94);}return _0x189785[_0x22e8('0x25')]();};}function saveUpdates(_0x302101,_0x3447a8){return function(_0x50aa0a){if(_0x50aa0a){return _0x50aa0a[_0x22e8('0x26')](_0x302101)[_0x22e8('0x27')](function(_0x46ce0a){return _0x46ce0a;});}return null;};}function removeEntity(_0x447d7c,_0x42d0e7){return function(_0x4af68d){if(_0x4af68d){return _0x4af68d['destroy']()[_0x22e8('0x27')](function(){var _0x2909ec=_0x4af68d[_0x22e8('0x28')]({'plain':!![]});var _0x3593be=_0x22e8('0x29');return db[_0x22e8('0x2a')][_0x22e8('0x2b')]({'where':{'type':_0x3593be,'resourceId':_0x2909ec['id']}})[_0x22e8('0x27')](function(){return _0x4af68d;});})[_0x22e8('0x27')](function(){_0x447d7c['status'](0xcc)[_0x22e8('0x1c')]();});}};}function handleEntityNotFound(_0x15726a,_0x320e22){return function(_0x4d025f){if(!_0x4d025f){_0x15726a[_0x22e8('0x1a')](0x194);}return _0x4d025f;};}function handleError(_0x227205,_0x546a68){_0x546a68=_0x546a68||0x1f4;return function(_0x463e6b){logger[_0x22e8('0x2c')](_0x463e6b[_0x22e8('0x2d')]);if(_0x463e6b[_0x22e8('0x2e')]){delete _0x463e6b[_0x22e8('0x2e')];}_0x227205[_0x22e8('0x1b')](_0x546a68)[_0x22e8('0x2f')](_0x463e6b);};}exports[_0x22e8('0x30')]=function(_0x15c0be,_0x33af5a){var _0x4ee9ff={},_0x502086={},_0x4a33e2={'count':0x0,'rows':[]};var _0x10c7e0=_[_0x22e8('0x31')](db[_0x22e8('0x32')][_0x22e8('0x33')],function(_0x565063){return{'name':_0x565063[_0x22e8('0x34')],'type':_0x565063[_0x22e8('0x35')][_0x22e8('0x36')]};});_0x502086[_0x22e8('0x37')]=_['map'](_0x10c7e0,_0x22e8('0x2e'));_0x502086['query']=_[_0x22e8('0x38')](_0x15c0be[_0x22e8('0x39')]);_0x502086['filters']=_[_0x22e8('0x3a')](_0x502086[_0x22e8('0x37')],_0x502086[_0x22e8('0x39')]);_0x4ee9ff[_0x22e8('0x3b')]=_[_0x22e8('0x3a')](_0x502086[_0x22e8('0x37')],qs[_0x22e8('0x3c')](_0x15c0be[_0x22e8('0x39')][_0x22e8('0x3c')]));_0x4ee9ff[_0x22e8('0x3b')]=_0x4ee9ff[_0x22e8('0x3b')][_0x22e8('0x3d')]?_0x4ee9ff[_0x22e8('0x3b')]:_0x502086[_0x22e8('0x37')];if(!_0x15c0be[_0x22e8('0x39')][_0x22e8('0x3e')](_0x22e8('0x3f'))){_0x4ee9ff[_0x22e8('0x20')]=qs[_0x22e8('0x20')](_0x15c0be[_0x22e8('0x39')][_0x22e8('0x20')]);_0x4ee9ff[_0x22e8('0x1e')]=qs[_0x22e8('0x1e')](_0x15c0be['query']['offset']);}_0x4ee9ff[_0x22e8('0x40')]=qs[_0x22e8('0x41')](_0x15c0be['query'][_0x22e8('0x41')]);_0x4ee9ff[_0x22e8('0x42')]=qs[_0x22e8('0x43')](_[_0x22e8('0x44')](_0x15c0be[_0x22e8('0x39')],_0x502086[_0x22e8('0x43')]),_0x10c7e0);if(_0x15c0be['query'][_0x22e8('0x45')]){_0x4ee9ff[_0x22e8('0x42')]=_['merge'](_0x4ee9ff[_0x22e8('0x42')],{'$or':_[_0x22e8('0x31')](_0x10c7e0,function(_0xa408f0){if(_0xa408f0[_0x22e8('0x35')]!==_0x22e8('0x46')){var _0x34d803={};_0x34d803[_0xa408f0[_0x22e8('0x2e')]]={'$like':'%'+_0x15c0be[_0x22e8('0x39')][_0x22e8('0x45')]+'%'};return _0x34d803;}})});}_0x4ee9ff=_['merge']({},_0x4ee9ff,_0x15c0be['options']);var _0x56f1f7={'where':_0x4ee9ff[_0x22e8('0x42')]};return db[_0x22e8('0x32')][_0x22e8('0x21')](_0x56f1f7)[_0x22e8('0x27')](function(_0x3d1f8c){_0x4a33e2[_0x22e8('0x21')]=_0x3d1f8c;if(_0x15c0be[_0x22e8('0x39')][_0x22e8('0x47')]){_0x4ee9ff[_0x22e8('0x48')]=[{'all':!![]}];}return db['Variable'][_0x22e8('0x49')](_0x4ee9ff);})[_0x22e8('0x27')](function(_0xa1e843){_0x4a33e2[_0x22e8('0x4a')]=_0xa1e843;return _0x4a33e2;})[_0x22e8('0x27')](respondWithFilteredResult(_0x33af5a,_0x4ee9ff))[_0x22e8('0x4b')](handleError(_0x33af5a,null));};exports[_0x22e8('0x4c')]=function(_0x281f18,_0x4e7a4f){var _0x3c1223={'raw':!![],'where':{'id':_0x281f18[_0x22e8('0x4d')]['id']}},_0x874b64={};_0x874b64[_0x22e8('0x37')]=_[_0x22e8('0x38')](db[_0x22e8('0x32')]['rawAttributes']);_0x874b64['query']=_['keys'](_0x281f18['query']);_0x874b64[_0x22e8('0x43')]=_[_0x22e8('0x3a')](_0x874b64[_0x22e8('0x37')],_0x874b64[_0x22e8('0x39')]);_0x3c1223[_0x22e8('0x3b')]=_[_0x22e8('0x3a')](_0x874b64['model'],qs[_0x22e8('0x3c')](_0x281f18[_0x22e8('0x39')]['fields']));_0x3c1223[_0x22e8('0x3b')]=_0x3c1223[_0x22e8('0x3b')]['length']?_0x3c1223[_0x22e8('0x3b')]:_0x874b64[_0x22e8('0x37')];if(_0x281f18[_0x22e8('0x39')][_0x22e8('0x47')]){_0x3c1223[_0x22e8('0x48')]=[{'all':!![]}];}_0x3c1223=_[_0x22e8('0x4e')]({},_0x3c1223,_0x281f18[_0x22e8('0x4f')]);return db[_0x22e8('0x32')][_0x22e8('0x50')](_0x3c1223)[_0x22e8('0x27')](handleEntityNotFound(_0x4e7a4f,null))['then'](respondWithResult(_0x4e7a4f,null))[_0x22e8('0x4b')](handleError(_0x4e7a4f,null));};exports[_0x22e8('0x51')]=function(_0x2624ea,_0x57d86b){return db[_0x22e8('0x32')][_0x22e8('0x51')](_0x2624ea['body'],{})['then'](function(_0x35e592){var _0x4ed5c6=_0x2624ea[_0x22e8('0x52')][_0x22e8('0x28')]({'plain':!![]});if(!_0x4ed5c6)throw new Error(_0x22e8('0x53'));if(_0x4ed5c6[_0x22e8('0x54')]==='user'){var _0x14a6e0=_0x35e592[_0x22e8('0x28')]({'plain':!![]});var _0x3fb751=_0x22e8('0x29');return db['UserProfileSection'][_0x22e8('0x50')]({'where':{'name':_0x3fb751,'userProfileId':_0x4ed5c6[_0x22e8('0x55')]},'raw':!![]})[_0x22e8('0x27')](function(_0x9ee53e){if(_0x9ee53e&&_0x9ee53e['autoAssociation']===0x0){return db[_0x22e8('0x2a')][_0x22e8('0x51')]({'name':_0x14a6e0[_0x22e8('0x2e')],'resourceId':_0x14a6e0['id'],'type':_0x9ee53e[_0x22e8('0x2e')],'sectionId':_0x9ee53e['id']},{})[_0x22e8('0x27')](function(){return _0x35e592;});}else{return _0x35e592;}})[_0x22e8('0x4b')](function(_0x46994d){logger[_0x22e8('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x46994d);throw _0x46994d;});}return _0x35e592;})[_0x22e8('0x27')](respondWithResult(_0x57d86b,0xc9))[_0x22e8('0x4b')](handleError(_0x57d86b,null));};exports[_0x22e8('0x26')]=function(_0x16c879,_0x22e572){if(_0x16c879[_0x22e8('0x56')]['id']){delete _0x16c879[_0x22e8('0x56')]['id'];}return db[_0x22e8('0x32')][_0x22e8('0x50')]({'where':{'id':_0x16c879[_0x22e8('0x4d')]['id']}})[_0x22e8('0x27')](handleEntityNotFound(_0x22e572,null))[_0x22e8('0x27')](saveUpdates(_0x16c879['body'],null))[_0x22e8('0x27')](respondWithResult(_0x22e572,null))[_0x22e8('0x4b')](handleError(_0x22e572,null));};exports['destroy']=function(_0x5afa5e,_0x471629){return db[_0x22e8('0x32')][_0x22e8('0x50')]({'where':{'id':_0x5afa5e[_0x22e8('0x4d')]['id']}})['then'](handleEntityNotFound(_0x471629,null))['then'](removeEntity(_0x471629,null))[_0x22e8('0x4b')](handleError(_0x471629,null));}; \ No newline at end of file +var _0x8181=['filter','merge','VIRTUAL','includeAll','show','include','find','catch','create','user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','count','offset','set','Content-Range','apply','save','update','then','destroy','get','Variables','UserProfileResource','error','stack','name','send','index','map','Variable','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick'];(function(_0x5eb370,_0x2f1ce3){var _0x5dbcbd=function(_0x266c10){while(--_0x266c10){_0x5eb370['push'](_0x5eb370['shift']());}};_0x5dbcbd(++_0x2f1ce3);}(_0x8181,0x1af));var _0x1818=function(_0xe249f0,_0x59b2a4){_0xe249f0=_0xe249f0-0x0;var _0x5a69ca=_0x8181[_0xe249f0];return _0x5a69ca;};'use strict';var emlformat=require(_0x1818('0x0'));var rimraf=require(_0x1818('0x1'));var zipdir=require(_0x1818('0x2'));var jsonpatch=require(_0x1818('0x3'));var rp=require(_0x1818('0x4'));var moment=require(_0x1818('0x5'));var BPromise=require(_0x1818('0x6'));var Mustache=require('mustache');var util=require(_0x1818('0x7'));var path=require(_0x1818('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1818('0x9'));var fs=require('fs');var fs_extra=require(_0x1818('0xa'));var _=require(_0x1818('0xb'));var squel=require('squel');var crypto=require(_0x1818('0xc'));var jsforce=require(_0x1818('0xd'));var deskjs=require(_0x1818('0xe'));var toCsv=require(_0x1818('0xf'));var querystring=require(_0x1818('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1818('0x11'));var qs=require(_0x1818('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1818('0x13'));var logger=require(_0x1818('0x14'))('api');var utils=require(_0x1818('0x15'));var config=require(_0x1818('0x16'));var licenseUtil=require(_0x1818('0x17'));var db=require(_0x1818('0x18'))['db'];function respondWithStatusCode(_0x1dabd1,_0x51238f){_0x51238f=_0x51238f||0xcc;return function(_0x13d901){if(_0x13d901){return _0x1dabd1[_0x1818('0x19')](_0x51238f);}return _0x1dabd1['status'](_0x51238f)[_0x1818('0x1a')]();};}function respondWithResult(_0x3c2f93,_0x3ebb15){_0x3ebb15=_0x3ebb15||0xc8;return function(_0x5820e3){if(_0x5820e3){return _0x3c2f93[_0x1818('0x1b')](_0x3ebb15)[_0x1818('0x1c')](_0x5820e3);}};}function respondWithFilteredResult(_0x41235f,_0x2b3da9){return function(_0x2f58be){if(_0x2f58be){var _0x128e97=typeof _0x2b3da9['offset']===_0x1818('0x1d')&&typeof _0x2b3da9['limit']===_0x1818('0x1d');var _0x2f7bc5=_0x2f58be[_0x1818('0x1e')];var _0x413bf0=_0x128e97?0x0:_0x2b3da9[_0x1818('0x1f')];var _0x47b10b=_0x128e97?_0x2f58be[_0x1818('0x1e')]:_0x2b3da9[_0x1818('0x1f')]+_0x2b3da9['limit'];var _0x339bda;if(_0x47b10b>=_0x2f7bc5){_0x47b10b=_0x2f7bc5;_0x339bda=0xc8;}else{_0x339bda=0xce;}_0x41235f[_0x1818('0x1b')](_0x339bda);return _0x41235f[_0x1818('0x20')](_0x1818('0x21'),_0x413bf0+'-'+_0x47b10b+'/'+_0x2f7bc5)['json'](_0x2f58be);}return null;};}function patchUpdates(_0x57a91a){return function(_0x7ef4af){try{jsonpatch[_0x1818('0x22')](_0x7ef4af,_0x57a91a,!![]);}catch(_0x4dc821){return BPromise['reject'](_0x4dc821);}return _0x7ef4af[_0x1818('0x23')]();};}function saveUpdates(_0x57d11c,_0x26d07f){return function(_0x303dbb){if(_0x303dbb){return _0x303dbb[_0x1818('0x24')](_0x57d11c)[_0x1818('0x25')](function(_0x2366cd){return _0x2366cd;});}return null;};}function removeEntity(_0x51452b,_0x12179e){return function(_0x368cfb){if(_0x368cfb){return _0x368cfb[_0x1818('0x26')]()[_0x1818('0x25')](function(){var _0x35ef4e=_0x368cfb[_0x1818('0x27')]({'plain':!![]});var _0x18b51a=_0x1818('0x28');return db[_0x1818('0x29')][_0x1818('0x26')]({'where':{'type':_0x18b51a,'resourceId':_0x35ef4e['id']}})[_0x1818('0x25')](function(){return _0x368cfb;});})['then'](function(){_0x51452b['status'](0xcc)[_0x1818('0x1a')]();});}};}function handleEntityNotFound(_0x5221a8,_0x59bf9c){return function(_0x2af2a2){if(!_0x2af2a2){_0x5221a8[_0x1818('0x19')](0x194);}return _0x2af2a2;};}function handleError(_0x57e3d3,_0x291bff){_0x291bff=_0x291bff||0x1f4;return function(_0x26b025){logger[_0x1818('0x2a')](_0x26b025[_0x1818('0x2b')]);if(_0x26b025['name']){delete _0x26b025[_0x1818('0x2c')];}_0x57e3d3[_0x1818('0x1b')](_0x291bff)[_0x1818('0x2d')](_0x26b025);};}exports[_0x1818('0x2e')]=function(_0x3eefb0,_0x900683){var _0x3535b9={},_0x24864a={},_0x50209c={'count':0x0,'rows':[]};var _0x1fe234=_[_0x1818('0x2f')](db[_0x1818('0x30')][_0x1818('0x31')],function(_0x58384e){return{'name':_0x58384e[_0x1818('0x32')],'type':_0x58384e[_0x1818('0x33')][_0x1818('0x34')]};});_0x24864a['model']=_[_0x1818('0x2f')](_0x1fe234,_0x1818('0x2c'));_0x24864a[_0x1818('0x35')]=_[_0x1818('0x36')](_0x3eefb0[_0x1818('0x35')]);_0x24864a[_0x1818('0x37')]=_[_0x1818('0x38')](_0x24864a['model'],_0x24864a['query']);_0x3535b9['attributes']=_['intersection'](_0x24864a[_0x1818('0x39')],qs[_0x1818('0x3a')](_0x3eefb0['query'][_0x1818('0x3a')]));_0x3535b9[_0x1818('0x3b')]=_0x3535b9['attributes'][_0x1818('0x3c')]?_0x3535b9['attributes']:_0x24864a[_0x1818('0x39')];if(!_0x3eefb0['query'][_0x1818('0x3d')](_0x1818('0x3e'))){_0x3535b9['limit']=qs[_0x1818('0x3f')](_0x3eefb0[_0x1818('0x35')][_0x1818('0x3f')]);_0x3535b9['offset']=qs[_0x1818('0x1f')](_0x3eefb0[_0x1818('0x35')][_0x1818('0x1f')]);}_0x3535b9['order']=qs[_0x1818('0x40')](_0x3eefb0[_0x1818('0x35')][_0x1818('0x40')]);_0x3535b9[_0x1818('0x41')]=qs[_0x1818('0x37')](_[_0x1818('0x42')](_0x3eefb0[_0x1818('0x35')],_0x24864a[_0x1818('0x37')]),_0x1fe234);if(_0x3eefb0[_0x1818('0x35')][_0x1818('0x43')]){_0x3535b9['where']=_[_0x1818('0x44')](_0x3535b9[_0x1818('0x41')],{'$or':_[_0x1818('0x2f')](_0x1fe234,function(_0x1a75e7){if(_0x1a75e7[_0x1818('0x33')]!==_0x1818('0x45')){var _0x2a4deb={};_0x2a4deb[_0x1a75e7[_0x1818('0x2c')]]={'$like':'%'+_0x3eefb0[_0x1818('0x35')][_0x1818('0x43')]+'%'};return _0x2a4deb;}})});}_0x3535b9=_[_0x1818('0x44')]({},_0x3535b9,_0x3eefb0['options']);var _0x4cc483={'where':_0x3535b9[_0x1818('0x41')]};return db[_0x1818('0x30')][_0x1818('0x1e')](_0x4cc483)[_0x1818('0x25')](function(_0x3510ca){_0x50209c['count']=_0x3510ca;if(_0x3eefb0[_0x1818('0x35')][_0x1818('0x46')]){_0x3535b9['include']=[{'all':!![]}];}return db['Variable']['findAll'](_0x3535b9);})[_0x1818('0x25')](function(_0x38d327){_0x50209c['rows']=_0x38d327;return _0x50209c;})['then'](respondWithFilteredResult(_0x900683,_0x3535b9))['catch'](handleError(_0x900683,null));};exports[_0x1818('0x47')]=function(_0x2990d2,_0x3bb338){var _0x9875bc={'raw':!![],'where':{'id':_0x2990d2['params']['id']}},_0x4015ac={};_0x4015ac['model']=_[_0x1818('0x36')](db[_0x1818('0x30')]['rawAttributes']);_0x4015ac['query']=_['keys'](_0x2990d2[_0x1818('0x35')]);_0x4015ac[_0x1818('0x37')]=_[_0x1818('0x38')](_0x4015ac[_0x1818('0x39')],_0x4015ac['query']);_0x9875bc[_0x1818('0x3b')]=_[_0x1818('0x38')](_0x4015ac[_0x1818('0x39')],qs[_0x1818('0x3a')](_0x2990d2[_0x1818('0x35')][_0x1818('0x3a')]));_0x9875bc[_0x1818('0x3b')]=_0x9875bc['attributes'][_0x1818('0x3c')]?_0x9875bc[_0x1818('0x3b')]:_0x4015ac[_0x1818('0x39')];if(_0x2990d2[_0x1818('0x35')][_0x1818('0x46')]){_0x9875bc[_0x1818('0x48')]=[{'all':!![]}];}_0x9875bc=_[_0x1818('0x44')]({},_0x9875bc,_0x2990d2['options']);return db[_0x1818('0x30')][_0x1818('0x49')](_0x9875bc)['then'](handleEntityNotFound(_0x3bb338,null))[_0x1818('0x25')](respondWithResult(_0x3bb338,null))[_0x1818('0x4a')](handleError(_0x3bb338,null));};exports['create']=function(_0x47bc2a,_0x20e51b){return db[_0x1818('0x30')][_0x1818('0x4b')](_0x47bc2a['body'],{})[_0x1818('0x25')](function(_0x590168){var _0x73263a=_0x47bc2a[_0x1818('0x4c')]['get']({'plain':!![]});if(!_0x73263a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x73263a[_0x1818('0x4d')]===_0x1818('0x4c')){var _0x252ba9=_0x590168[_0x1818('0x27')]({'plain':!![]});var _0x26c3fe='Variables';return db[_0x1818('0x4e')][_0x1818('0x49')]({'where':{'name':_0x26c3fe,'userProfileId':_0x73263a['userProfileId']},'raw':!![]})['then'](function(_0x17f717){if(_0x17f717&&_0x17f717[_0x1818('0x4f')]===0x0){return db['UserProfileResource'][_0x1818('0x4b')]({'name':_0x252ba9['name'],'resourceId':_0x252ba9['id'],'type':_0x17f717[_0x1818('0x2c')],'sectionId':_0x17f717['id']},{})[_0x1818('0x25')](function(){return _0x590168;});}else{return _0x590168;}})[_0x1818('0x4a')](function(_0x535356){logger[_0x1818('0x2a')](_0x1818('0x50'),_0x535356);throw _0x535356;});}return _0x590168;})[_0x1818('0x25')](respondWithResult(_0x20e51b,0xc9))['catch'](handleError(_0x20e51b,null));};exports[_0x1818('0x24')]=function(_0x22aaab,_0x52db89){if(_0x22aaab[_0x1818('0x51')]['id']){delete _0x22aaab['body']['id'];}return db[_0x1818('0x30')][_0x1818('0x49')]({'where':{'id':_0x22aaab[_0x1818('0x52')]['id']}})[_0x1818('0x25')](handleEntityNotFound(_0x52db89,null))[_0x1818('0x25')](saveUpdates(_0x22aaab[_0x1818('0x51')],null))[_0x1818('0x25')](respondWithResult(_0x52db89,null))[_0x1818('0x4a')](handleError(_0x52db89,null));};exports[_0x1818('0x26')]=function(_0x412b50,_0x516ccf){return db[_0x1818('0x30')]['find']({'where':{'id':_0x412b50['params']['id']}})['then'](handleEntityNotFound(_0x516ccf,null))[_0x1818('0x25')](removeEntity(_0x516ccf,null))[_0x1818('0x4a')](handleError(_0x516ccf,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 2e2d0b6..9360fad 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 _0xe15d=['define','Variable','tools_variables','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./variable.attributes','exports'];(function(_0x34e180,_0x398f5d){var _0x2b3618=function(_0x9a0e9a){while(--_0x9a0e9a){_0x34e180['push'](_0x34e180['shift']());}};_0x2b3618(++_0x398f5d);}(_0xe15d,0x87));var _0xde15=function(_0x4650b0,_0x37dbd1){_0x4650b0=_0x4650b0-0x0;var _0x22bc47=_0xe15d[_0x4650b0];return _0x22bc47;};'use strict';var _=require(_0xde15('0x0'));var util=require(_0xde15('0x1'));var logger=require(_0xde15('0x2'))('api');var moment=require('moment');var BPromise=require(_0xde15('0x3'));var rp=require(_0xde15('0x4'));var fs=require('fs');var path=require(_0xde15('0x5'));var rimraf=require(_0xde15('0x6'));var config=require('../../config/environment');var attributes=require(_0xde15('0x7'));module[_0xde15('0x8')]=function(_0x471ab6,_0x33c29e){return _0x471ab6[_0xde15('0x9')](_0xde15('0xa'),attributes,{'tableName':_0xde15('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8948=['api','moment','rimraf','./variable.attributes','exports','Variable','tools_variables'];(function(_0x2272b5,_0x362458){var _0x110156=function(_0x5c2e32){while(--_0x5c2e32){_0x2272b5['push'](_0x2272b5['shift']());}};_0x110156(++_0x362458);}(_0x8948,0xe7));var _0x8894=function(_0x41700e,_0x250d99){_0x41700e=_0x41700e-0x0;var _0x407cb9=_0x8948[_0x41700e];return _0x407cb9;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x8894('0x0'));var moment=require(_0x8894('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8894('0x2'));var config=require('../../config/environment');var attributes=require(_0x8894('0x3'));module[_0x8894('0x4')]=function(_0x38205c,_0x36945d){return _0x38205c['define'](_0x8894('0x5'),attributes,{'tableName':_0x8894('0x6'),'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 37cecea..45d6b42 100644 --- a/server/api/variable/variable.rpc.js +++ b/server/api/variable/variable.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa41a=['debug','Variable,\x20%s,\x20%s,\x20%s','error','message','result','catch','ShowVariable','options','raw','where','attributes','include','map','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Variable,\x20%s,\x20%s','request\x20sent'];(function(_0x4ea69d,_0x290f53){var _0x5318e0=function(_0x18e081){while(--_0x18e081){_0x4ea69d['push'](_0x4ea69d['shift']());}};_0x5318e0(++_0x290f53);}(_0xa41a,0x6b));var _0xaa41=function(_0x484f51,_0x64c5a3){_0x484f51=_0x484f51-0x0;var _0x463795=_0xa41a[_0x484f51];return _0x463795;};'use strict';var _=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var moment=require('moment');var BPromise=require(_0xaa41('0x2'));var rs=require(_0xaa41('0x3'));var fs=require('fs');var Redis=require(_0xaa41('0x4'));var db=require(_0xaa41('0x5'))['db'];var utils=require(_0xaa41('0x6'));var logger=require(_0xaa41('0x7'))(_0xaa41('0x8'));var config=require(_0xaa41('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xaa41('0xa')][_0xaa41('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54bc5a,_0x5b1fff,_0x179545){return new BPromise(function(_0x202cce,_0x588ab4){return client[_0xaa41('0xc')](_0x54bc5a,_0x179545)[_0xaa41('0xd')](function(_0x409dab){logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));logger[_0xaa41('0x11')](_0xaa41('0x12'),_0x5b1fff,_0xaa41('0x10'),JSON['stringify'](_0x409dab));if(_0x409dab[_0xaa41('0x13')]){if(_0x409dab[_0xaa41('0x13')]['code']===0x1f4){logger['error'](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x588ab4(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x202cce(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}else{logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));_0x202cce(_0x409dab[_0xaa41('0x15')]['message']);}})[_0xaa41('0x16')](function(_0x16b930){logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x16b930);_0x588ab4(_0x16b930);});});}exports[_0xaa41('0x17')]=function(_0xd20ddf){var _0x29efe5=this;return new Promise(function(_0x46e6d3,_0x150ddf){return db['Variable']['find']({'raw':_0xd20ddf[_0xaa41('0x18')]?_0xd20ddf[_0xaa41('0x18')][_0xaa41('0x19')]===undefined?!![]:![]:!![],'where':_0xd20ddf['options']?_0xd20ddf[_0xaa41('0x18')][_0xaa41('0x1a')]||null:null,'attributes':_0xd20ddf['options']?_0xd20ddf['options'][_0xaa41('0x1b')]||null:null,'include':_0xd20ddf['options']?_0xd20ddf[_0xaa41('0x18')][_0xaa41('0x1c')]?_[_0xaa41('0x1d')](_0xd20ddf[_0xaa41('0x18')][_0xaa41('0x1c')],function(_0x4eb01f){return{'model':db[_0x4eb01f[_0xaa41('0x1e')]],'as':_0x4eb01f['as'],'attributes':_0x4eb01f[_0xaa41('0x1b')],'include':_0x4eb01f[_0xaa41('0x1c')]?_[_0xaa41('0x1d')](_0x4eb01f[_0xaa41('0x1c')],function(_0xa1f024){return{'model':db[_0xa1f024['model']],'as':_0xa1f024['as'],'attributes':_0xa1f024['attributes'],'include':_0xa1f024[_0xaa41('0x1c')]?_['map'](_0xa1f024['include'],function(_0x12e362){return{'model':db[_0x12e362['model']],'as':_0x12e362['as'],'attributes':_0x12e362['attributes']};}):[]};}):[]};}):[]:[]})[_0xaa41('0xd')](function(_0x9c8c21){logger[_0xaa41('0xe')](_0xaa41('0x17'),_0xd20ddf);logger[_0xaa41('0x11')](_0xaa41('0x17'),_0xd20ddf,JSON['stringify'](_0x9c8c21));_0x46e6d3(_0x9c8c21);})[_0xaa41('0x16')](function(_0x1f0275){logger[_0xaa41('0x13')](_0xaa41('0x17'),_0x1f0275[_0xaa41('0x14')],_0xd20ddf);_0x150ddf(_0x29efe5[_0xaa41('0x13')](0x1f4,_0x1f0275[_0xaa41('0x14')]));});});}; \ No newline at end of file +var _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(_0x4766f2,_0x38b8a1){var _0xe746c2=function(_0x27ad6d){while(--_0x27ad6d){_0x4766f2['push'](_0x4766f2['shift']());}};_0xe746c2(++_0x38b8a1);}(_0x1cb9,0x14e));var _0x91cb=function(_0x32d7ad,_0x5c759e){_0x32d7ad=_0x32d7ad-0x0;var _0x4b5a16=_0x1cb9[_0x32d7ad];return _0x4b5a16;};'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 diff --git a/server/api/version/index.js b/server/api/version/index.js index fa2d675..28e640a 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 _0x80bd=['canUpdate','fetch','/reset','/pull','pull','/restart','restart','migrations','exports','Router','../../components/auth/service','./version.controller','get','index','/fetch','isAuthenticated'];(function(_0x46c45c,_0x95a8bb){var _0x5a4a28=function(_0x31a7ae){while(--_0x31a7ae){_0x46c45c['push'](_0x46c45c['shift']());}};_0x5a4a28(++_0x95a8bb);}(_0x80bd,0x199));var _0xd80b=function(_0x427d94,_0x1930d0){_0x427d94=_0x427d94-0x0;var _0x6106bf=_0x80bd[_0x427d94];return _0x6106bf;};'use strict';var express=require('express');var router=express[_0xd80b('0x0')]();var auth=require(_0xd80b('0x1'));var controller=require(_0xd80b('0x2'));router[_0xd80b('0x3')]('/',controller[_0xd80b('0x4')]);router[_0xd80b('0x3')](_0xd80b('0x5'),auth[_0xd80b('0x6')](),auth[_0xd80b('0x7')](),controller[_0xd80b('0x8')]);router[_0xd80b('0x3')](_0xd80b('0x9'),auth[_0xd80b('0x6')](),auth[_0xd80b('0x7')](),controller['reset']);router[_0xd80b('0x3')](_0xd80b('0xa'),auth[_0xd80b('0x6')](),auth['canUpdate'](),controller[_0xd80b('0xb')]);router[_0xd80b('0x3')](_0xd80b('0xc'),auth[_0xd80b('0x6')](),controller[_0xd80b('0xd')]);router['get']('/migrations',controller[_0xd80b('0xe')]);module[_0xd80b('0xf')]=router; \ No newline at end of file +var _0xa317=['index','isAuthenticated','canUpdate','fetch','/reset','reset','pull','/restart','restart','/migrations','migrations','exports','express','Router','../../components/auth/service','./version.controller','get'];(function(_0xae334e,_0x27a6c6){var _0x205ab4=function(_0x46a243){while(--_0x46a243){_0xae334e['push'](_0xae334e['shift']());}};_0x205ab4(++_0x27a6c6);}(_0xa317,0x14f));var _0x7a31=function(_0x905a94,_0x5694bd){_0x905a94=_0x905a94-0x0;var _0x33c5d5=_0xa317[_0x905a94];return _0x33c5d5;};'use strict';var express=require(_0x7a31('0x0'));var router=express[_0x7a31('0x1')]();var auth=require(_0x7a31('0x2'));var controller=require(_0x7a31('0x3'));router[_0x7a31('0x4')]('/',controller[_0x7a31('0x5')]);router[_0x7a31('0x4')]('/fetch',auth[_0x7a31('0x6')](),auth[_0x7a31('0x7')](),controller[_0x7a31('0x8')]);router['get'](_0x7a31('0x9'),auth[_0x7a31('0x6')](),auth[_0x7a31('0x7')](),controller[_0x7a31('0xa')]);router[_0x7a31('0x4')]('/pull',auth[_0x7a31('0x6')](),auth[_0x7a31('0x7')](),controller[_0x7a31('0xb')]);router[_0x7a31('0x4')](_0x7a31('0xc'),auth['isAuthenticated'](),controller[_0x7a31('0xd')]);router[_0x7a31('0x4')](_0x7a31('0xe'),controller[_0x7a31('0xf')]);module[_0x7a31('0x10')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 64c837b..6b64331 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 _0x0d48=['UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','pkginfo','compare-versions','child_process','exec','../../config/environment','simple-git','root','index','exports','version','query','fetch','latest','2.0.0','status','json','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard','pull','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','join','server','replace','push','length','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','.js','Database\x20migrated\x20successfully\x20from\x20version\x20','last'];(function(_0x164af1,_0x3cf772){var _0x5d81a2=function(_0xa57547){while(--_0xa57547){_0x164af1['push'](_0x164af1['shift']());}};_0x5d81a2(++_0x3cf772);}(_0x0d48,0x122));var _0x80d4=function(_0xcd2266,_0xb5ae46){_0xcd2266=_0xcd2266-0x0;var _0x299e37=_0x0d48[_0xcd2266];return _0x299e37;};'use strict';var Umzug=require(_0x80d4('0x0'));var path=require(_0x80d4('0x1'));var fs=require('fs');var _=require('lodash');var pkginfo=require(_0x80d4('0x2'))(module,'version');var compareVersions=require(_0x80d4('0x3'));var exec=require(_0x80d4('0x4'))[_0x80d4('0x5')];var db=require('../../mysqldb')['db'];var config=require(_0x80d4('0x6'));var pm2=require('../../config/pm2');var logger=require('../../config/logger')('update');var git=require(_0x80d4('0x7'))(config[_0x80d4('0x8')]);exports[_0x80d4('0x9')]=function(_0x198f8c,_0x2b8bea){var _0x14d30e={'current':module[_0x80d4('0xa')][_0x80d4('0xb')],'phonebar':0x2};if(_0x198f8c[_0x80d4('0xc')]&&_0x198f8c['query']['latest']){return git[_0x80d4('0xd')]()['tags'](function(_0x2ed49c,_0x31b1ff){_0x14d30e[_0x80d4('0xe')]=(_0x2ed49c?module['exports']['version']:_0x31b1ff[_0x80d4('0xe')])||_0x80d4('0xf');return _0x2b8bea[_0x80d4('0x10')](0xc8)[_0x80d4('0x11')](_0x14d30e);});}else{return _0x2b8bea[_0x80d4('0x10')](0xc8)[_0x80d4('0x11')](_0x14d30e);}};exports[_0x80d4('0xd')]=function(_0x8fa211,_0x370b04){return git['fetch'](['origin',_0x80d4('0x12')],function(_0x1191d9){if(_0x1191d9){logger[_0x80d4('0x13')](_0x1191d9);return _0x370b04[_0x80d4('0x10')](0x1f4)[_0x80d4('0x11')](_0x1191d9);}logger[_0x80d4('0x14')](_0x80d4('0x15'));return _0x370b04[_0x80d4('0x10')](0xc8)[_0x80d4('0x11')]({'output':_0x80d4('0x16')});});};exports['reset']=function(_0x31f2da,_0x1d1c0e){return git[_0x80d4('0x17')]([_0x80d4('0x18'),_0x80d4('0x19')],function(_0x2de970){if(_0x2de970){logger[_0x80d4('0x13')](_0x2de970);return _0x1d1c0e[_0x80d4('0x10')](0x1f4)[_0x80d4('0x11')](_0x2de970);}logger[_0x80d4('0x14')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x1d1c0e[_0x80d4('0x10')](0xc8)[_0x80d4('0x11')]({'output':_0x80d4('0x1a')});});};exports[_0x80d4('0x1b')]=function(_0x30bae2,_0x22f45a){exec('npm\x20install\x20--production',function(_0x45d8f7,_0xc7929b,_0xd651ea){logger[_0x80d4('0x14')](_0xc7929b);logger[_0x80d4('0x14')](_0xd651ea);if(_0x45d8f7){logger['error'](_0x45d8f7);return _0x22f45a[_0x80d4('0x10')](0x1f4)[_0x80d4('0x11')](_0x45d8f7);}return _0x22f45a[_0x80d4('0x10')](0xc8)['json']({'output':_0xc7929b});});};exports[_0x80d4('0x1c')]=function(_0x53856c,_0xd1dc19){return pm2['restart'](_0x80d4('0x1d'))[_0x80d4('0x1e')](function(_0x4ef427){logger[_0x80d4('0x14')](_0x80d4('0x1f'),_0x4ef427);return _0xd1dc19[_0x80d4('0x10')](0xc8)['json']({'output':_0x80d4('0x20')});})[_0x80d4('0x21')](function(_0x332461){logger[_0x80d4('0x13')](_0x332461);return _0xd1dc19[_0x80d4('0x10')](0x1f4)['json'](_0x332461);});};exports[_0x80d4('0x22')]=function(_0xf88ce0,_0x4766d5){var _0x41d3c4=fs['readdirSync'](path[_0x80d4('0x23')](config['root'],_0x80d4('0x24'),'migrations'));var _0x360259=[];for(var _0x3d8510=0x0;_0x3d8510<_0x41d3c4['length'];_0x3d8510++){var _0x2d8c26=_0x41d3c4[_0x3d8510][_0x80d4('0x25')]('.js','');if(compareVersions(module[_0x80d4('0xa')][_0x80d4('0xb')],_0x2d8c26)===-0x1){_0x360259[_0x80d4('0x26')](_0x2d8c26);}}if(_0x360259[_0x80d4('0x27')]){var _0x381ebf=_0x360259['sort'](compareVersions);var _0x55e338=new Umzug({'storage':'sequelize','storageOptions':{'model':db['Migration'],'modelName':'Migration','columnName':_0x80d4('0xb')},'migrations':{'params':[db['sequelize']['getQueryInterface'](),db['sequelize'][_0x80d4('0x28')],function(){throw new Error(_0x80d4('0x29'));}],'path':path[_0x80d4('0x23')](config['root'],_0x80d4('0x24'),'migrations'),'pattern':/\.js$/}});_0x55e338['up']({'migrations':_[_0x80d4('0x2a')](_0x381ebf,function(_0x3ec861){return _0x3ec861+_0x80d4('0x2b');})})['then'](function(){return _0x4766d5[_0x80d4('0x10')](0xc8)[_0x80d4('0x11')]({'output':_0x80d4('0x2c')+module['exports'][_0x80d4('0xb')]+'\x20to\x20'+_[_0x80d4('0x2d')](_0x381ebf),'migrations':_[_0x80d4('0x23')](_0x381ebf)});})[_0x80d4('0x21')](function(_0x4b0331){if(_0x4b0331 instanceof db['sequelize'][_0x80d4('0x2e')]){return _0x4766d5[_0x80d4('0x10')](0xc8)[_0x80d4('0x11')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x4766d5['status'](0x1f4)[_0x80d4('0x11')](_0x4b0331);}});}else{return _0x4766d5['status'](0xc8)[_0x80d4('0x11')]({'output':_0x80d4('0x2f')});}}; \ No newline at end of file +var _0x9c84=['error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','catch','migrations','readdirSync','join','server','replace','version','sort','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','.js','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','root','exports','query','latest','fetch','tags','2.0.0','status','json','origin','master'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x9c84,0xcc));var _0x49c8=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9c84[_0x321bb2];return _0x9c12ed;};'use strict';var Umzug=require(_0x49c8('0x0'));var path=require(_0x49c8('0x1'));var fs=require('fs');var _=require(_0x49c8('0x2'));var pkginfo=require(_0x49c8('0x3'))(module,'version');var compareVersions=require(_0x49c8('0x4'));var exec=require(_0x49c8('0x5'))[_0x49c8('0x6')];var db=require(_0x49c8('0x7'))['db'];var config=require(_0x49c8('0x8'));var pm2=require(_0x49c8('0x9'));var logger=require(_0x49c8('0xa'))(_0x49c8('0xb'));var git=require(_0x49c8('0xc'))(config[_0x49c8('0xd')]);exports['index']=function(_0xd2cd6,_0x16863b){var _0x4a840b={'current':module[_0x49c8('0xe')]['version'],'phonebar':0x2};if(_0xd2cd6['query']&&_0xd2cd6[_0x49c8('0xf')][_0x49c8('0x10')]){return git[_0x49c8('0x11')]()[_0x49c8('0x12')](function(_0x2498b7,_0x2a28cd){_0x4a840b[_0x49c8('0x10')]=(_0x2498b7?module[_0x49c8('0xe')]['version']:_0x2a28cd[_0x49c8('0x10')])||_0x49c8('0x13');return _0x16863b[_0x49c8('0x14')](0xc8)[_0x49c8('0x15')](_0x4a840b);});}else{return _0x16863b[_0x49c8('0x14')](0xc8)[_0x49c8('0x15')](_0x4a840b);}};exports['fetch']=function(_0x55c74e,_0x9a7550){return git[_0x49c8('0x11')]([_0x49c8('0x16'),_0x49c8('0x17')],function(_0x15f0a1){if(_0x15f0a1){logger[_0x49c8('0x18')](_0x15f0a1);return _0x9a7550[_0x49c8('0x14')](0x1f4)[_0x49c8('0x15')](_0x15f0a1);}logger[_0x49c8('0x19')](_0x49c8('0x1a'));return _0x9a7550[_0x49c8('0x14')](0xc8)[_0x49c8('0x15')]({'output':_0x49c8('0x1b')});});};exports[_0x49c8('0x1c')]=function(_0x106988,_0x18a532){return git[_0x49c8('0x1c')]([_0x49c8('0x1d'),_0x49c8('0x1e')],function(_0x1f6a19){if(_0x1f6a19){logger[_0x49c8('0x18')](_0x1f6a19);return _0x18a532[_0x49c8('0x14')](0x1f4)[_0x49c8('0x15')](_0x1f6a19);}logger[_0x49c8('0x19')](_0x49c8('0x1f'));return _0x18a532['status'](0xc8)[_0x49c8('0x15')]({'output':_0x49c8('0x20')});});};exports[_0x49c8('0x21')]=function(_0x51d3f9,_0x2c9332){exec(_0x49c8('0x22'),function(_0x14e56b,_0x4a59c0,_0x496a6c){logger[_0x49c8('0x19')](_0x4a59c0);logger[_0x49c8('0x19')](_0x496a6c);if(_0x14e56b){logger[_0x49c8('0x18')](_0x14e56b);return _0x2c9332[_0x49c8('0x14')](0x1f4)[_0x49c8('0x15')](_0x14e56b);}return _0x2c9332[_0x49c8('0x14')](0xc8)[_0x49c8('0x15')]({'output':_0x4a59c0});});};exports[_0x49c8('0x23')]=function(_0x400b4a,_0x4fc778){return pm2[_0x49c8('0x23')](_0x49c8('0x24'))[_0x49c8('0x25')](function(_0x3700e6){logger[_0x49c8('0x19')](_0x49c8('0x26'),_0x3700e6);return _0x4fc778[_0x49c8('0x14')](0xc8)[_0x49c8('0x15')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0x49c8('0x27')](function(_0x3bc374){logger[_0x49c8('0x18')](_0x3bc374);return _0x4fc778['status'](0x1f4)[_0x49c8('0x15')](_0x3bc374);});};exports[_0x49c8('0x28')]=function(_0x41a22b,_0x2c1f7e){var _0xeb48a7=fs[_0x49c8('0x29')](path[_0x49c8('0x2a')](config[_0x49c8('0xd')],_0x49c8('0x2b'),_0x49c8('0x28')));var _0x5a99d4=[];for(var _0x1712ba=0x0;_0x1712ba<_0xeb48a7['length'];_0x1712ba++){var _0x503f6b=_0xeb48a7[_0x1712ba][_0x49c8('0x2c')]('.js','');if(compareVersions(module[_0x49c8('0xe')][_0x49c8('0x2d')],_0x503f6b)===-0x1){_0x5a99d4['push'](_0x503f6b);}}if(_0x5a99d4['length']){var _0x2d73e5=_0x5a99d4[_0x49c8('0x2e')](compareVersions);var _0x108cb6=new Umzug({'storage':_0x49c8('0x2f'),'storageOptions':{'model':db[_0x49c8('0x30')],'modelName':_0x49c8('0x30'),'columnName':_0x49c8('0x2d')},'migrations':{'params':[db[_0x49c8('0x2f')][_0x49c8('0x31')](),db[_0x49c8('0x2f')][_0x49c8('0x32')],function(){throw new Error(_0x49c8('0x33'));}],'path':path[_0x49c8('0x2a')](config[_0x49c8('0xd')],_0x49c8('0x2b'),'migrations'),'pattern':/\.js$/}});_0x108cb6['up']({'migrations':_['map'](_0x2d73e5,function(_0x2847e9){return _0x2847e9+_0x49c8('0x34');})})[_0x49c8('0x25')](function(){return _0x2c1f7e[_0x49c8('0x14')](0xc8)[_0x49c8('0x15')]({'output':_0x49c8('0x35')+module[_0x49c8('0xe')][_0x49c8('0x2d')]+_0x49c8('0x36')+_['last'](_0x2d73e5),'migrations':_[_0x49c8('0x2a')](_0x2d73e5)});})[_0x49c8('0x27')](function(_0x583f5d){if(_0x583f5d instanceof db[_0x49c8('0x2f')][_0x49c8('0x37')]){return _0x2c1f7e['status'](0xc8)[_0x49c8('0x15')]({'output':_0x49c8('0x38')});}else{return _0x2c1f7e[_0x49c8('0x14')](0x1f4)[_0x49c8('0x15')](_0x583f5d);}});}else{return _0x2c1f7e[_0x49c8('0x14')](0xc8)[_0x49c8('0x15')]({'output':_0x49c8('0x38')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index c3e644e..a432925 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 _0x0c7f=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','util'];(function(_0x481109,_0x341699){var _0x3fceec=function(_0xad9a90){while(--_0xad9a90){_0x481109['push'](_0x481109['shift']());}};_0x3fceec(++_0x341699);}(_0x0c7f,0xbf));var _0xf0c7=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x0c7f[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require('multer');var util=require(_0xf0c7('0x0'));var path=require('path');var timeout=require(_0xf0c7('0x1'));var express=require('express');var router=express[_0xf0c7('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xf0c7('0x3'));var interaction=require(_0xf0c7('0x4'));var config=require('../../config/environment');var controller=require('./voiceAgentReport.controller');router[_0xf0c7('0x5')]('/',auth[_0xf0c7('0x6')](),controller[_0xf0c7('0x7')]);router['get'](_0xf0c7('0x8'),auth[_0xf0c7('0x6')](),controller[_0xf0c7('0x9')]);router['get'](_0xf0c7('0xa'),auth[_0xf0c7('0x6')](),controller[_0xf0c7('0xb')]);router[_0xf0c7('0xc')]('/',auth[_0xf0c7('0x6')](),controller[_0xf0c7('0xd')]);router[_0xf0c7('0xe')]('/:id',auth[_0xf0c7('0x6')](),controller[_0xf0c7('0xf')]);router['delete'](_0xf0c7('0xa'),auth[_0xf0c7('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x9404=['get','index','/describe','describe','/:id','isAuthenticated','post','put','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller'];(function(_0x197d5c,_0x1936b0){var _0x13dc71=function(_0x332d07){while(--_0x332d07){_0x197d5c['push'](_0x197d5c['shift']());}};_0x13dc71(++_0x1936b0);}(_0x9404,0x14a));var _0x4940=function(_0x556fe2,_0x2f44a6){_0x556fe2=_0x556fe2-0x0;var _0x18268f=_0x9404[_0x556fe2];return _0x18268f;};'use strict';var multer=require(_0x4940('0x0'));var util=require(_0x4940('0x1'));var path=require(_0x4940('0x2'));var timeout=require(_0x4940('0x3'));var express=require('express');var router=express[_0x4940('0x4')]();var fs_extra=require(_0x4940('0x5'));var auth=require(_0x4940('0x6'));var interaction=require(_0x4940('0x7'));var config=require(_0x4940('0x8'));var controller=require(_0x4940('0x9'));router[_0x4940('0xa')]('/',auth['isAuthenticated'](),controller[_0x4940('0xb')]);router[_0x4940('0xa')](_0x4940('0xc'),auth['isAuthenticated'](),controller[_0x4940('0xd')]);router[_0x4940('0xa')](_0x4940('0xe'),auth[_0x4940('0xf')](),controller['show']);router[_0x4940('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x4940('0x11')](_0x4940('0xe'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x4940('0xe'),auth[_0x4940('0xf')](),controller[_0x4940('0x12')]);module[_0x4940('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index acb541c..e23da65 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 _0x81cb=['BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','INTEGER'];(function(_0x18932e,_0x40e025){var _0x45d4f8=function(_0x5c0f06){while(--_0x5c0f06){_0x18932e['push'](_0x18932e['shift']());}};_0x45d4f8(++_0x40e025);}(_0x81cb,0xaa));var _0xb81c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x81cb[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xb81c('0x0'));module[_0xb81c('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xb81c('0x2')]},'calleridnum':{'type':Sequelize[_0xb81c('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xb81c('0x2')]},'interface':{'type':Sequelize[_0xb81c('0x2')]},'membername':{'type':Sequelize[_0xb81c('0x2')]},'agentcalledAt':{'type':Sequelize[_0xb81c('0x3')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize[_0xb81c('0x3')]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0xb81c('0x4')]},'agentcomplete':{'type':Sequelize[_0xb81c('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xb81c('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xb81c('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xb81c('0x4')]},'agentacw':{'type':Sequelize[_0xb81c('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xb81c('0x4')]},'reason':{'type':Sequelize[_0xb81c('0x2')]},'lastevent':{'type':Sequelize[_0xb81c('0x2')]},'channel':{'type':Sequelize[_0xb81c('0x2')]},'channelstate':{'type':Sequelize[_0xb81c('0x4')]},'channelstatedesc':{'type':Sequelize[_0xb81c('0x2')]},'connectedlinenum':{'type':Sequelize[_0xb81c('0x2')]},'connectedlinename':{'type':Sequelize[_0xb81c('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xb81c('0x2')]},'context':{'type':Sequelize[_0xb81c('0x2')]},'exten':{'type':Sequelize[_0xb81c('0x2')]},'priority':{'type':Sequelize[_0xb81c('0x2')]},'destchannel':{'type':Sequelize[_0xb81c('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xb81c('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xb81c('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xb81c('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xb81c('0x2')]},'destaccountcode':{'type':Sequelize[_0xb81c('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xb81c('0x2')]},'destpriority':{'type':Sequelize[_0xb81c('0x2')]},'destuniqueid':{'type':Sequelize[_0xb81c('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize[_0xb81c('0x2')]},'transfer':{'type':Sequelize[_0xb81c('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0xb81c('0x6')},'transferexten':{'type':Sequelize[_0xb81c('0x2')]},'transferuniqueid':{'type':Sequelize[_0xb81c('0x2')]},'agententerreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x1399=['sequelize','exports','STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x4c2877,_0x1ec708){var _0x1fb46b=function(_0x3adbe2){while(--_0x3adbe2){_0x4c2877['push'](_0x4c2877['shift']());}};_0x1fb46b(++_0x1ec708);}(_0x1399,0x16c));var _0x9139=function(_0x1b876a,_0x4403cb){_0x1b876a=_0x1b876a-0x0;var _0x5f1eb5=_0x1399[_0x1b876a];return _0x5f1eb5;};'use strict';var Sequelize=require(_0x9139('0x0'));module[_0x9139('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x9139('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x9139('0x2')]},'queue':{'type':Sequelize[_0x9139('0x2')]},'interface':{'type':Sequelize[_0x9139('0x2')]},'membername':{'type':Sequelize[_0x9139('0x2')]},'agentcalledAt':{'type':Sequelize[_0x9139('0x3')]},'agentconnectAt':{'type':Sequelize[_0x9139('0x3')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize[_0x9139('0x3')]},'holdtime':{'type':Sequelize[_0x9139('0x4')]},'agentcomplete':{'type':Sequelize[_0x9139('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x9139('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x9139('0x4')]},'reason':{'type':Sequelize[_0x9139('0x2')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x9139('0x2')]},'channelstate':{'type':Sequelize[_0x9139('0x4')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x9139('0x2')]},'language':{'type':Sequelize[_0x9139('0x2')]},'accountcode':{'type':Sequelize[_0x9139('0x2')]},'context':{'type':Sequelize[_0x9139('0x2')]},'exten':{'type':Sequelize[_0x9139('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x9139('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x9139('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x9139('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x9139('0x2')]},'destlanguage':{'type':Sequelize[_0x9139('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x9139('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x9139('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x9139('0x2')]},'transfer':{'type':Sequelize[_0x9139('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x9139('0x2')],'comment':_0x9139('0x6')},'transferexten':{'type':Sequelize[_0x9139('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 1e543ea..d5708c0 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(_0x5a9c0c,_0x4ec485){var _0x53c77d=function(_0x1cf384){while(--_0x1cf384){_0x5a9c0c['push'](_0x5a9c0c['shift']());}};_0x53c77d(++_0x4ec485);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'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(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'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 e6ffa3c..6203804 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 _0x31f0=['report_agent','uniqueid','destuniqueid','lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./voiceAgentReport.attributes','define'];(function(_0x15d0c0,_0x49757f){var _0x4fa332=function(_0x410ee7){while(--_0x410ee7){_0x15d0c0['push'](_0x15d0c0['shift']());}};_0x4fa332(++_0x49757f);}(_0x31f0,0xb7));var _0x031f=function(_0x1c0701,_0x4ed38b){_0x1c0701=_0x1c0701-0x0;var _0xd4eaa6=_0x31f0[_0x1c0701];return _0xd4eaa6;};'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')]('VoiceAgentReport',attributes,{'tableName':_0x031f('0x9'),'paranoid':![],'indexes':[{'fields':[_0x031f('0xa'),_0x031f('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf2cf=['api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceAgentReport.attributes','VoiceAgentReport','report_agent','uniqueid','destuniqueid','util','../../config/logger'];(function(_0x340461,_0x3f7198){var _0x596afd=function(_0x13a5c5){while(--_0x13a5c5){_0x340461['push'](_0x340461['shift']());}};_0x596afd(++_0x3f7198);}(_0xf2cf,0xf5));var _0xff2c=function(_0x4a699c,_0x42e8f6){_0x4a699c=_0x4a699c-0x0;var _0x1cb1f0=_0xf2cf[_0x4a699c];return _0x1cb1f0;};'use strict';var _=require('lodash');var util=require(_0xff2c('0x0'));var logger=require(_0xff2c('0x1'))(_0xff2c('0x2'));var moment=require('moment');var BPromise=require(_0xff2c('0x3'));var rp=require(_0xff2c('0x4'));var fs=require('fs');var path=require(_0xff2c('0x5'));var rimraf=require(_0xff2c('0x6'));var config=require(_0xff2c('0x7'));var attributes=require(_0xff2c('0x8'));module['exports']=function(_0x8f0f4,_0x68b356){return _0x8f0f4['define'](_0xff2c('0x9'),attributes,{'tableName':_0xff2c('0xa'),'paranoid':![],'indexes':[{'fields':[_0xff2c('0xb'),_0xff2c('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index a5c7776..74912cc 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 _0x5ddc=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','VoiceAgentReport','create','body','options','raw','CreateVoiceAgentReport','UpdateVoiceAgentReport','update','where','attributes','limit','lodash','util','bluebird'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x5ddc,0x12f));var _0xc5dd=function(_0x5bdea9,_0x33f532){_0x5bdea9=_0x5bdea9-0x0;var _0x16eead=_0x5ddc[_0x5bdea9];return _0x16eead;};'use strict';var _=require(_0xc5dd('0x0'));var util=require(_0xc5dd('0x1'));var moment=require('moment');var BPromise=require(_0xc5dd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc5dd('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc5dd('0x4'));var logger=require(_0xc5dd('0x5'))(_0xc5dd('0x6'));var config=require(_0xc5dd('0x7'));var jayson=require(_0xc5dd('0x8'));var client=jayson[_0xc5dd('0x9')][_0xc5dd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3d6a30,_0x386a69,_0x39843e){return new BPromise(function(_0x21393c,_0x24877b){return client[_0xc5dd('0xb')](_0x3d6a30,_0x39843e)[_0xc5dd('0xc')](function(_0xd21918){logger[_0xc5dd('0xd')](_0xc5dd('0xe'),_0x386a69,_0xc5dd('0xf'));logger[_0xc5dd('0x10')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x386a69,'request\x20sent',JSON[_0xc5dd('0x11')](_0xd21918));if(_0xd21918['error']){if(_0xd21918['error'][_0xc5dd('0x12')]===0x1f4){logger[_0xc5dd('0x13')]('VoiceAgentReport,\x20%s,\x20%s',_0x386a69,_0xd21918['error'][_0xc5dd('0x14')]);return _0x24877b(_0xd21918[_0xc5dd('0x13')][_0xc5dd('0x14')]);}logger['error'](_0xc5dd('0xe'),_0x386a69,_0xd21918[_0xc5dd('0x13')][_0xc5dd('0x14')]);return _0x21393c(_0xd21918[_0xc5dd('0x13')]['message']);}else{logger[_0xc5dd('0xd')](_0xc5dd('0xe'),_0x386a69,'request\x20sent');_0x21393c(_0xd21918[_0xc5dd('0x15')][_0xc5dd('0x14')]);}})[_0xc5dd('0x16')](function(_0x59e07f){logger['error'](_0xc5dd('0xe'),_0x386a69,_0x59e07f);_0x24877b(_0x59e07f);});});}exports['CreateVoiceAgentReport']=function(_0xa0934a){var _0x46aa6b=this;return new Promise(function(_0x455f8a,_0x30f207){return db[_0xc5dd('0x17')][_0xc5dd('0x18')](_0xa0934a[_0xc5dd('0x19')],{'raw':_0xa0934a['options']?_0xa0934a[_0xc5dd('0x1a')][_0xc5dd('0x1b')]===undefined?!![]:![]:!![]})[_0xc5dd('0xc')](function(_0x195fd2){logger[_0xc5dd('0xd')](_0xc5dd('0x1c'),_0xa0934a);logger[_0xc5dd('0x10')](_0xc5dd('0x1c'),_0xa0934a,JSON[_0xc5dd('0x11')](_0x195fd2));_0x455f8a(_0x195fd2);})[_0xc5dd('0x16')](function(_0x2fbae3){logger[_0xc5dd('0x13')](_0xc5dd('0x1c'),_0x2fbae3[_0xc5dd('0x14')],_0xa0934a);_0x30f207(_0x46aa6b['error'](0x1f4,_0x2fbae3[_0xc5dd('0x14')]));});});};exports[_0xc5dd('0x1d')]=function(_0x20315b){var _0xdc29d8=this;return new Promise(function(_0x24e91b,_0xee2f3a){return db[_0xc5dd('0x17')][_0xc5dd('0x1e')](_0x20315b['body'],{'raw':_0x20315b['options']?_0x20315b[_0xc5dd('0x1a')][_0xc5dd('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20315b[_0xc5dd('0x1a')]?_0x20315b['options'][_0xc5dd('0x1f')]||null:null,'attributes':_0x20315b[_0xc5dd('0x1a')]?_0x20315b[_0xc5dd('0x1a')][_0xc5dd('0x20')]||null:null,'limit':_0x20315b[_0xc5dd('0x1a')]?_0x20315b['options'][_0xc5dd('0x21')]||null:null})['then'](function(_0x568d9b){logger[_0xc5dd('0xd')](_0xc5dd('0x1d'),_0x20315b);logger[_0xc5dd('0x10')](_0xc5dd('0x1d'),_0x20315b,JSON['stringify'](_0x568d9b));_0x24e91b(_0x568d9b);})['catch'](function(_0x369edd){logger['error'](_0xc5dd('0x1d'),_0x369edd['message'],_0x20315b);_0xee2f3a(_0xdc29d8[_0xc5dd('0x13')](0x1f4,_0x369edd[_0xc5dd('0x14')]));});});}; \ No newline at end of file +var _0x4340=['then','info','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceAgentReport,\x20%s,\x20%s','result','CreateVoiceAgentReport','create','body','options','raw','catch','VoiceAgentReport','limit','UpdateVoiceAgentReport','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x54edc9,_0x345f01){var _0x2ae7a9=function(_0x24a545){while(--_0x24a545){_0x54edc9['push'](_0x54edc9['shift']());}};_0x2ae7a9(++_0x345f01);}(_0x4340,0x94));var _0x0434=function(_0x2f8f9f,_0x2e7e35){_0x2f8f9f=_0x2f8f9f-0x0;var _0x4aa018=_0x4340[_0x2f8f9f];return _0x4aa018;};'use strict';var _=require('lodash');var util=require(_0x0434('0x0'));var moment=require('moment');var BPromise=require(_0x0434('0x1'));var rs=require(_0x0434('0x2'));var fs=require('fs');var Redis=require(_0x0434('0x3'));var db=require(_0x0434('0x4'))['db'];var utils=require(_0x0434('0x5'));var logger=require(_0x0434('0x6'))(_0x0434('0x7'));var config=require(_0x0434('0x8'));var jayson=require(_0x0434('0x9'));var client=jayson[_0x0434('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2c6557,_0x156c66,_0x4c81ee){return new BPromise(function(_0x200e2c,_0x16eb8c){return client[_0x0434('0xb')](_0x2c6557,_0x4c81ee)[_0x0434('0xc')](function(_0x307de4){logger[_0x0434('0xd')]('VoiceAgentReport,\x20%s,\x20%s',_0x156c66,_0x0434('0xe'));logger[_0x0434('0xf')](_0x0434('0x10'),_0x156c66,_0x0434('0xe'),JSON[_0x0434('0x11')](_0x307de4));if(_0x307de4['error']){if(_0x307de4[_0x0434('0x12')][_0x0434('0x13')]===0x1f4){logger[_0x0434('0x12')]('VoiceAgentReport,\x20%s,\x20%s',_0x156c66,_0x307de4[_0x0434('0x12')][_0x0434('0x14')]);return _0x16eb8c(_0x307de4['error'][_0x0434('0x14')]);}logger[_0x0434('0x12')](_0x0434('0x15'),_0x156c66,_0x307de4[_0x0434('0x12')][_0x0434('0x14')]);return _0x200e2c(_0x307de4[_0x0434('0x12')][_0x0434('0x14')]);}else{logger[_0x0434('0xd')]('VoiceAgentReport,\x20%s,\x20%s',_0x156c66,_0x0434('0xe'));_0x200e2c(_0x307de4[_0x0434('0x16')][_0x0434('0x14')]);}})['catch'](function(_0x17bb0d){logger[_0x0434('0x12')](_0x0434('0x15'),_0x156c66,_0x17bb0d);_0x16eb8c(_0x17bb0d);});});}exports[_0x0434('0x17')]=function(_0x35a37d){var _0x4053c0=this;return new Promise(function(_0x3c0e4b,_0x300c1c){return db['VoiceAgentReport'][_0x0434('0x18')](_0x35a37d[_0x0434('0x19')],{'raw':_0x35a37d[_0x0434('0x1a')]?_0x35a37d[_0x0434('0x1a')][_0x0434('0x1b')]===undefined?!![]:![]:!![]})[_0x0434('0xc')](function(_0x2dadbf){logger[_0x0434('0xd')](_0x0434('0x17'),_0x35a37d);logger['debug'](_0x0434('0x17'),_0x35a37d,JSON[_0x0434('0x11')](_0x2dadbf));_0x3c0e4b(_0x2dadbf);})[_0x0434('0x1c')](function(_0x584138){logger[_0x0434('0x12')](_0x0434('0x17'),_0x584138[_0x0434('0x14')],_0x35a37d);_0x300c1c(_0x4053c0[_0x0434('0x12')](0x1f4,_0x584138['message']));});});};exports['UpdateVoiceAgentReport']=function(_0x3bbf35){var _0x43d1c2=this;return new Promise(function(_0x574842,_0x5b75ef){return db[_0x0434('0x1d')]['update'](_0x3bbf35[_0x0434('0x19')],{'raw':_0x3bbf35[_0x0434('0x1a')]?_0x3bbf35['options'][_0x0434('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3bbf35[_0x0434('0x1a')]?_0x3bbf35['options']['where']||null:null,'attributes':_0x3bbf35[_0x0434('0x1a')]?_0x3bbf35[_0x0434('0x1a')]['attributes']||null:null,'limit':_0x3bbf35[_0x0434('0x1a')]?_0x3bbf35[_0x0434('0x1a')][_0x0434('0x1e')]||null:null})[_0x0434('0xc')](function(_0x57301c){logger['info'](_0x0434('0x1f'),_0x3bbf35);logger['debug']('UpdateVoiceAgentReport',_0x3bbf35,JSON['stringify'](_0x57301c));_0x574842(_0x57301c);})[_0x0434('0x1c')](function(_0x30d44f){logger[_0x0434('0x12')]('UpdateVoiceAgentReport',_0x30d44f['message'],_0x3bbf35);_0x5b75ef(_0x43d1c2['error'](0x1f4,_0x30d44f[_0x0434('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 4979335..79f16d3 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 _0x5292=['../../components/auth/service','../../components/interaction/service','./voiceCallReport.controller','get','/describe','/:id','show','post','isAuthenticated','create','put','update','exports','multer','util','connect-timeout','Router','fs-extra'];(function(_0x6e5788,_0x2a0590){var _0x4df0ba=function(_0x49fd21){while(--_0x49fd21){_0x6e5788['push'](_0x6e5788['shift']());}};_0x4df0ba(++_0x2a0590);}(_0x5292,0xf7));var _0x2529=function(_0x4424d7,_0x518a2c){_0x4424d7=_0x4424d7-0x0;var _0x513d98=_0x5292[_0x4424d7];return _0x513d98;};'use strict';var multer=require(_0x2529('0x0'));var util=require(_0x2529('0x1'));var path=require('path');var timeout=require(_0x2529('0x2'));var express=require('express');var router=express[_0x2529('0x3')]();var fs_extra=require(_0x2529('0x4'));var auth=require(_0x2529('0x5'));var interaction=require(_0x2529('0x6'));var config=require('../../config/environment');var controller=require(_0x2529('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x2529('0x8')](_0x2529('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0x2529('0x8')](_0x2529('0xa'),auth['isAuthenticated'](),controller[_0x2529('0xb')]);router[_0x2529('0xc')]('/',auth[_0x2529('0xd')](),controller[_0x2529('0xe')]);router[_0x2529('0xf')](_0x2529('0xa'),auth[_0x2529('0xd')](),controller[_0x2529('0x10')]);router['delete'](_0x2529('0xa'),auth[_0x2529('0xd')](),controller['destroy']);module[_0x2529('0x11')]=router; \ No newline at end of file +var _0x34e8=['exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','delete'];(function(_0x23563a,_0x42ed08){var _0x590f46=function(_0x3e982b){while(--_0x3e982b){_0x23563a['push'](_0x23563a['shift']());}};_0x590f46(++_0x42ed08);}(_0x34e8,0x12c));var _0x834e=function(_0x47811a,_0x17e8d9){_0x47811a=_0x47811a-0x0;var _0x3ff1da=_0x34e8[_0x47811a];return _0x3ff1da;};'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('0x11')]('/',auth[_0x834e('0xd')](),controller[_0x834e('0x12')]);router[_0x834e('0x13')](_0x834e('0xf'),auth[_0x834e('0xd')](),controller[_0x834e('0x14')]);router[_0x834e('0x15')](_0x834e('0xf'),auth[_0x834e('0xd')](),controller['destroy']);module[_0x834e('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index f0b686b..7325431 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 _0xc224=['exports','STRING','inbound','internal','outbound','inbound-fax','outbound-fax','dialer','TEXT','DATE','INTEGER','sequelize'];(function(_0x395aaf,_0x48a467){var _0x1b39d3=function(_0x228248){while(--_0x228248){_0x395aaf['push'](_0x395aaf['shift']());}};_0x1b39d3(++_0x48a467);}(_0xc224,0x1af));var _0x4c22=function(_0xd72849,_0x20253d){_0xd72849=_0xd72849-0x0;var _0x16fa96=_0xc224[_0xd72849];return _0x16fa96;};'use strict';var Sequelize=require(_0x4c22('0x0'));module[_0x4c22('0x1')]={'uniqueid':{'type':Sequelize[_0x4c22('0x2')]},'type':{'type':Sequelize['ENUM'](_0x4c22('0x3'),_0x4c22('0x4'),_0x4c22('0x5'),_0x4c22('0x6'),_0x4c22('0x7'),_0x4c22('0x8'))},'tag':{'type':Sequelize[_0x4c22('0x2')]},'accountcode':{'type':Sequelize[_0x4c22('0x2')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x4c22('0x2')]},'channel':{'type':Sequelize[_0x4c22('0x2')]},'destinationchannel':{'type':Sequelize[_0x4c22('0x2')]},'lastapplication':{'type':Sequelize[_0x4c22('0x2')]},'lastdata':{'type':Sequelize[_0x4c22('0x9')]},'starttime':{'type':Sequelize[_0x4c22('0xa')]},'systemanswertime':{'type':Sequelize[_0x4c22('0xa')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x4c22('0xa')]},'duration':{'type':Sequelize[_0x4c22('0xb')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x4c22('0x2')]},'amaflags':{'type':Sequelize[_0x4c22('0x2')]},'userfield':{'type':Sequelize[_0x4c22('0x2')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x4c22('0x2')]},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize[_0x4c22('0xb')]},'sipcallid':{'type':Sequelize[_0x4c22('0x2')]}}; \ No newline at end of file +var _0x4877=['inbound','outbound','inbound-fax','outbound-fax','dialer','TEXT','DATE','INTEGER','sequelize','exports','STRING','ENUM'];(function(_0x5d8088,_0x43f908){var _0x4f94fe=function(_0x109ca0){while(--_0x109ca0){_0x5d8088['push'](_0x5d8088['shift']());}};_0x4f94fe(++_0x43f908);}(_0x4877,0x80));var _0x7487=function(_0x4a67a7,_0x36e3a8){_0x4a67a7=_0x4a67a7-0x0;var _0x444d94=_0x4877[_0x4a67a7];return _0x444d94;};'use strict';var Sequelize=require(_0x7487('0x0'));module[_0x7487('0x1')]={'uniqueid':{'type':Sequelize[_0x7487('0x2')]},'type':{'type':Sequelize[_0x7487('0x3')](_0x7487('0x4'),'internal',_0x7487('0x5'),_0x7487('0x6'),_0x7487('0x7'),_0x7487('0x8'))},'tag':{'type':Sequelize[_0x7487('0x2')]},'accountcode':{'type':Sequelize[_0x7487('0x2')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0x7487('0x2')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x7487('0x2')]},'channel':{'type':Sequelize[_0x7487('0x2')]},'destinationchannel':{'type':Sequelize[_0x7487('0x2')]},'lastapplication':{'type':Sequelize[_0x7487('0x2')]},'lastdata':{'type':Sequelize[_0x7487('0x9')]},'starttime':{'type':Sequelize[_0x7487('0xa')]},'systemanswertime':{'type':Sequelize[_0x7487('0xa')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x7487('0xa')]},'duration':{'type':Sequelize[_0x7487('0xb')]},'billableseconds':{'type':Sequelize[_0x7487('0xb')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x7487('0x2')]},'amaflags':{'type':Sequelize[_0x7487('0x2')]},'userfield':{'type':Sequelize[_0x7487('0x2')]},'userDisposition':{'type':Sequelize[_0x7487('0x2')]},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0x7487('0x2')]},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x7487('0x2')]},'routeid':{'type':Sequelize[_0x7487('0xb')]},'sipcallid':{'type':Sequelize[_0x7487('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 3699a8f..f2ad25a 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 _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(_0x3f4845,_0x529f69){var _0x2dfe45=function(_0x43145c){while(--_0x43145c){_0x3f4845['push'](_0x3f4845['shift']());}};_0x2dfe45(++_0x529f69);}(_0x0b0e,0x187));var _0xe0b0=function(_0x4d7a70,_0x2d3bfa){_0x4d7a70=_0x4d7a70-0x0;var _0x3aafbb=_0x0b0e[_0x4d7a70];return _0x3aafbb;};'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 +var _0xb10b=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','VIRTUAL','filter','merge','options','VoiceCallReport','includeAll','include','alias','User','rows','show','find','create','body','catch','params','describe','uniqueid','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce'];(function(_0x2df748,_0x47c874){var _0x53c23c=function(_0x16f476){while(--_0x16f476){_0x2df748['push'](_0x2df748['shift']());}};_0x53c23c(++_0x47c874);}(_0xb10b,0x12a));var _0xbb10=function(_0x58a1ef,_0x4938cd){_0x58a1ef=_0x58a1ef-0x0;var _0x384e65=_0xb10b[_0x58a1ef];return _0x384e65;};'use strict';var emlformat=require(_0xbb10('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb10('0x1'));var jsonpatch=require(_0xbb10('0x2'));var rp=require(_0xbb10('0x3'));var moment=require('moment');var BPromise=require(_0xbb10('0x4'));var Mustache=require(_0xbb10('0x5'));var util=require(_0xbb10('0x6'));var path=require(_0xbb10('0x7'));var sox=require(_0xbb10('0x8'));var csv=require(_0xbb10('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb10('0xa'));var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0x9'));var querystring=require(_0xbb10('0xf'));var Papa=require(_0xbb10('0x10'));var Redis=require(_0xbb10('0x11'));var authService=require(_0xbb10('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb10('0x13'));var logger=require(_0xbb10('0x14'))(_0xbb10('0x15'));var utils=require('../../config/utils');var config=require(_0xbb10('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xbb10('0x17'))['db'];function respondWithStatusCode(_0x916a32,_0x285009){_0x285009=_0x285009||0xcc;return function(_0x193a27){if(_0x193a27){return _0x916a32[_0xbb10('0x18')](_0x285009);}return _0x916a32[_0xbb10('0x19')](_0x285009)['end']();};}function respondWithResult(_0x26e021,_0x42d7e4){_0x42d7e4=_0x42d7e4||0xc8;return function(_0x45b9d6){if(_0x45b9d6){return _0x26e021[_0xbb10('0x19')](_0x42d7e4)[_0xbb10('0x1a')](_0x45b9d6);}};}function respondWithFilteredResult(_0x2f2ebf,_0x24a57b){return function(_0x36b5e8){if(_0x36b5e8){var _0x3e26f4=typeof _0x24a57b[_0xbb10('0x1b')]==='undefined'&&typeof _0x24a57b[_0xbb10('0x1c')]===_0xbb10('0x1d');var _0x133ac2=_0x36b5e8[_0xbb10('0x1e')];var _0x378da8=_0x3e26f4?0x0:_0x24a57b[_0xbb10('0x1b')];var _0x575cca=_0x3e26f4?_0x36b5e8[_0xbb10('0x1e')]:_0x24a57b[_0xbb10('0x1b')]+_0x24a57b[_0xbb10('0x1c')];var _0x48b6e9;if(_0x575cca>=_0x133ac2){_0x575cca=_0x133ac2;_0x48b6e9=0xc8;}else{_0x48b6e9=0xce;}_0x2f2ebf[_0xbb10('0x19')](_0x48b6e9);return _0x2f2ebf[_0xbb10('0x1f')](_0xbb10('0x20'),_0x378da8+'-'+_0x575cca+'/'+_0x133ac2)[_0xbb10('0x1a')](_0x36b5e8);}return null;};}function patchUpdates(_0xdf237d){return function(_0x44e563){try{jsonpatch['apply'](_0x44e563,_0xdf237d,!![]);}catch(_0x12f888){return BPromise[_0xbb10('0x21')](_0x12f888);}return _0x44e563['save']();};}function saveUpdates(_0x4c4b0d,_0x8e2b97){return function(_0x311abe){if(_0x311abe){return _0x311abe[_0xbb10('0x22')](_0x4c4b0d)[_0xbb10('0x23')](function(_0x445761){return _0x445761;});}return null;};}function removeEntity(_0x1824b7,_0x407cb4){return function(_0x436104){if(_0x436104){return _0x436104[_0xbb10('0x24')]()[_0xbb10('0x23')](function(){_0x1824b7[_0xbb10('0x19')](0xcc)[_0xbb10('0x25')]();});}};}function handleEntityNotFound(_0x537898,_0x4fedac){return function(_0x4fb5e0){if(!_0x4fb5e0){_0x537898[_0xbb10('0x18')](0x194);}return _0x4fb5e0;};}function handleError(_0x3c5ae7,_0x2c89b9){_0x2c89b9=_0x2c89b9||0x1f4;return function(_0x4e25ff){logger[_0xbb10('0x26')](_0x4e25ff[_0xbb10('0x27')]);if(_0x4e25ff[_0xbb10('0x28')]){delete _0x4e25ff[_0xbb10('0x28')];}_0x3c5ae7[_0xbb10('0x19')](_0x2c89b9)[_0xbb10('0x29')](_0x4e25ff);};}exports[_0xbb10('0x2a')]=function(_0x4aabb9,_0x3796c7){var _0x21ac54={},_0xfc3595={},_0x2e0249={'count':0x0,'rows':[]};var _0x1d30aa=_[_0xbb10('0x2b')](db['VoiceCallReport'][_0xbb10('0x2c')],function(_0x4ee02e){return{'name':_0x4ee02e[_0xbb10('0x2d')],'type':_0x4ee02e['type'][_0xbb10('0x2e')]};});_0xfc3595[_0xbb10('0x2f')]=_[_0xbb10('0x2b')](_0x1d30aa,'name');_0xfc3595['query']=_[_0xbb10('0x30')](_0x4aabb9[_0xbb10('0x31')]);_0xfc3595['filters']=_[_0xbb10('0x32')](_0xfc3595[_0xbb10('0x2f')],_0xfc3595[_0xbb10('0x31')]);_0x21ac54[_0xbb10('0x33')]=_[_0xbb10('0x32')](_0xfc3595[_0xbb10('0x2f')],qs[_0xbb10('0x34')](_0x4aabb9['query'][_0xbb10('0x34')]));_0x21ac54[_0xbb10('0x33')]=_0x21ac54[_0xbb10('0x33')][_0xbb10('0x35')]?_0x21ac54[_0xbb10('0x33')]:_0xfc3595[_0xbb10('0x2f')];if(!_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x36')](_0xbb10('0x37'))){_0x21ac54['limit']=qs[_0xbb10('0x1c')](_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x1c')]);_0x21ac54[_0xbb10('0x1b')]=qs['offset'](_0x4aabb9[_0xbb10('0x31')]['offset']);}_0x21ac54['order']=qs[_0xbb10('0x38')](_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x38')]);_0x21ac54[_0xbb10('0x39')]=qs[_0xbb10('0x3a')](_[_0xbb10('0x3b')](_0x4aabb9['query'],_0xfc3595[_0xbb10('0x3a')]),_0x1d30aa);if(_0x4aabb9[_0xbb10('0x31')]['filter']){_0x21ac54['where']=_['merge'](_0x21ac54[_0xbb10('0x39')],{'$or':_[_0xbb10('0x2b')](_0x1d30aa,function(_0x2b658a){if(_0x2b658a['type']!==_0xbb10('0x3c')){var _0x3e8538={};_0x3e8538[_0x2b658a[_0xbb10('0x28')]]={'$like':'%'+_0x4aabb9['query'][_0xbb10('0x3d')]+'%'};return _0x3e8538;}})});}_0x21ac54=_[_0xbb10('0x3e')]({},_0x21ac54,_0x4aabb9[_0xbb10('0x3f')]);var _0x446f49={'where':_0x21ac54['where']};return db[_0xbb10('0x40')][_0xbb10('0x1e')](_0x446f49)['then'](function(_0xe2040f){_0x2e0249[_0xbb10('0x1e')]=_0xe2040f;if(_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x41')]){_0x21ac54[_0xbb10('0x42')]=[{'attributes':['id',_0xbb10('0x28'),'fullname',_0xbb10('0x43')],'model':db[_0xbb10('0x44')],'as':_0xbb10('0x44')}];}return db[_0xbb10('0x40')]['findAll'](_0x21ac54);})[_0xbb10('0x23')](function(_0x331751){_0x2e0249[_0xbb10('0x45')]=_0x331751;return _0x2e0249;})[_0xbb10('0x23')](respondWithFilteredResult(_0x3796c7,_0x21ac54))['catch'](handleError(_0x3796c7,null));};exports[_0xbb10('0x46')]=function(_0x202c60,_0x54ac18){var _0x5d9a4f={'raw':!![],'where':{'id':_0x202c60['params']['id']}},_0x38d78f={};_0x38d78f[_0xbb10('0x2f')]=_[_0xbb10('0x30')](db['VoiceCallReport'][_0xbb10('0x2c')]);_0x38d78f[_0xbb10('0x31')]=_[_0xbb10('0x30')](_0x202c60['query']);_0x38d78f[_0xbb10('0x3a')]=_[_0xbb10('0x32')](_0x38d78f[_0xbb10('0x2f')],_0x38d78f[_0xbb10('0x31')]);_0x5d9a4f[_0xbb10('0x33')]=_[_0xbb10('0x32')](_0x38d78f[_0xbb10('0x2f')],qs[_0xbb10('0x34')](_0x202c60[_0xbb10('0x31')][_0xbb10('0x34')]));_0x5d9a4f[_0xbb10('0x33')]=_0x5d9a4f[_0xbb10('0x33')]['length']?_0x5d9a4f[_0xbb10('0x33')]:_0x38d78f[_0xbb10('0x2f')];if(_0x202c60['query'][_0xbb10('0x41')]){_0x5d9a4f[_0xbb10('0x42')]=[{'all':!![]}];}_0x5d9a4f=_[_0xbb10('0x3e')]({},_0x5d9a4f,_0x202c60[_0xbb10('0x3f')]);return db[_0xbb10('0x40')][_0xbb10('0x47')](_0x5d9a4f)[_0xbb10('0x23')](handleEntityNotFound(_0x54ac18,null))['then'](respondWithResult(_0x54ac18,null))['catch'](handleError(_0x54ac18,null));};exports[_0xbb10('0x48')]=function(_0x76a208,_0x2b12bd){return db['VoiceCallReport']['create'](_0x76a208[_0xbb10('0x49')],{})[_0xbb10('0x23')](respondWithResult(_0x2b12bd,0xc9))[_0xbb10('0x4a')](handleError(_0x2b12bd,null));};exports[_0xbb10('0x24')]=function(_0x10159b,_0x22b315){return db[_0xbb10('0x40')][_0xbb10('0x47')]({'where':{'id':_0x10159b[_0xbb10('0x4b')]['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x22b315,null))['then'](removeEntity(_0x22b315,null))['catch'](handleError(_0x22b315,null));};exports[_0xbb10('0x4c')]=function(_0x467dba,_0x36ab7d){return db[_0xbb10('0x40')][_0xbb10('0x4c')]()[_0xbb10('0x23')](respondWithResult(_0x36ab7d,null))[_0xbb10('0x4a')](handleError(_0x36ab7d,null));};exports[_0xbb10('0x22')]=function(_0x1c0d8f,_0x1214f7){if(_0x1c0d8f[_0xbb10('0x49')][_0xbb10('0x4d')]){delete _0x1c0d8f[_0xbb10('0x49')][_0xbb10('0x4d')];}return db[_0xbb10('0x40')]['find']({'where':{'uniqueid':_0x1c0d8f[_0xbb10('0x4b')]['id'],'UserId':{'$or':[null,_0x1c0d8f['user']['id']]}}})[_0xbb10('0x23')](handleEntityNotFound(_0x1214f7,null))[_0xbb10('0x23')](saveUpdates(_0x1c0d8f[_0xbb10('0x49')],null))[_0xbb10('0x23')](respondWithResult(_0x1214f7,null))[_0xbb10('0x4a')](handleError(_0x1214f7,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 2ead1df..55b664d 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 _0x37c5=['api','moment','bluebird','rimraf','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','uniqueid','lodash','util','../../config/logger'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0x37c5,0x14f));var _0x537c=function(_0xf07642,_0x354dba){_0xf07642=_0xf07642-0x0;var _0x4ab35e=_0x37c5[_0xf07642];return _0x4ab35e;};'use strict';var _=require(_0x537c('0x0'));var util=require(_0x537c('0x1'));var logger=require(_0x537c('0x2'))(_0x537c('0x3'));var moment=require(_0x537c('0x4'));var BPromise=require(_0x537c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x537c('0x6'));var config=require('../../config/environment');var attributes=require(_0x537c('0x7'));module[_0x537c('0x8')]=function(_0x2a88ba,_0x388ca4){return _0x2a88ba[_0x537c('0x9')](_0x537c('0xa'),attributes,{'tableName':_0x537c('0xb'),'paranoid':![],'indexes':[{'fields':[_0x537c('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd9ef=['bluebird','request-promise','path','../../config/environment','./voiceCallReport.attributes','exports','report_call','lodash','util','../../config/logger','api','moment'];(function(_0x357bf6,_0x2d73ab){var _0x327602=function(_0x13cf7a){while(--_0x13cf7a){_0x357bf6['push'](_0x357bf6['shift']());}};_0x327602(++_0x2d73ab);}(_0xd9ef,0x133));var _0xfd9e=function(_0x29c5a9,_0x1e057b){_0x29c5a9=_0x29c5a9-0x0;var _0x1068ed=_0xd9ef[_0x29c5a9];return _0x1068ed;};'use strict';var _=require(_0xfd9e('0x0'));var util=require(_0xfd9e('0x1'));var logger=require(_0xfd9e('0x2'))(_0xfd9e('0x3'));var moment=require(_0xfd9e('0x4'));var BPromise=require(_0xfd9e('0x5'));var rp=require(_0xfd9e('0x6'));var fs=require('fs');var path=require(_0xfd9e('0x7'));var rimraf=require('rimraf');var config=require(_0xfd9e('0x8'));var attributes=require(_0xfd9e('0x9'));module[_0xfd9e('0xa')]=function(_0x6c7a97,_0x5127c2){return _0x6c7a97['define']('VoiceCallReport',attributes,{'tableName':_0xfd9e('0xb'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index a84e77a..a52a7a0 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 _0x14a7=['VoiceCallReport','options','raw','where','attributes','limit','map','include','model','CreateVoiceCallReport','create','body','then','debug','update','UpdateVoiceCallReport','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','jayson/promise','client','http','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceCallReport'];(function(_0x2378c4,_0x59fa09){var _0x47d7cc=function(_0x19f862){while(--_0x19f862){_0x2378c4['push'](_0x2378c4['shift']());}};_0x47d7cc(++_0x59fa09);}(_0x14a7,0x138));var _0x714a=function(_0x58a364,_0x3439f6){_0x58a364=_0x58a364-0x0;var _0x409b74=_0x14a7[_0x58a364];return _0x409b74;};'use strict';var _=require(_0x714a('0x0'));var util=require(_0x714a('0x1'));var moment=require(_0x714a('0x2'));var BPromise=require(_0x714a('0x3'));var rs=require(_0x714a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x714a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x714a('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x714a('0x7'));var client=jayson[_0x714a('0x8')][_0x714a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x13fc56,_0x597ed6,_0x5a1195){return new BPromise(function(_0xf73338,_0x51bd02){return client['request'](_0x13fc56,_0x5a1195)['then'](function(_0x1987e6){logger[_0x714a('0xa')](_0x714a('0xb'),_0x597ed6,_0x714a('0xc'));logger['debug'](_0x714a('0xd'),_0x597ed6,_0x714a('0xc'),JSON[_0x714a('0xe')](_0x1987e6));if(_0x1987e6['error']){if(_0x1987e6[_0x714a('0xf')][_0x714a('0x10')]===0x1f4){logger['error'](_0x714a('0xb'),_0x597ed6,_0x1987e6[_0x714a('0xf')][_0x714a('0x11')]);return _0x51bd02(_0x1987e6[_0x714a('0xf')][_0x714a('0x11')]);}logger['error'](_0x714a('0xb'),_0x597ed6,_0x1987e6[_0x714a('0xf')]['message']);return _0xf73338(_0x1987e6[_0x714a('0xf')][_0x714a('0x11')]);}else{logger['info'](_0x714a('0xb'),_0x597ed6,_0x714a('0xc'));_0xf73338(_0x1987e6[_0x714a('0x12')][_0x714a('0x11')]);}})[_0x714a('0x13')](function(_0x4f238a){logger[_0x714a('0xf')](_0x714a('0xb'),_0x597ed6,_0x4f238a);_0x51bd02(_0x4f238a);});});}exports[_0x714a('0x14')]=function(_0x4213b7){var _0x35ebf5=this;return new Promise(function(_0x462a0a,_0x393428){return db[_0x714a('0x15')]['findAll']({'raw':_0x4213b7[_0x714a('0x16')]?_0x4213b7[_0x714a('0x16')][_0x714a('0x17')]===undefined?!![]:![]:!![],'where':_0x4213b7['options']?_0x4213b7[_0x714a('0x16')][_0x714a('0x18')]||null:null,'attributes':_0x4213b7[_0x714a('0x16')]?_0x4213b7[_0x714a('0x16')][_0x714a('0x19')]||null:null,'limit':_0x4213b7[_0x714a('0x16')]?_0x4213b7[_0x714a('0x16')][_0x714a('0x1a')]||null:null,'include':_0x4213b7[_0x714a('0x16')]?_0x4213b7[_0x714a('0x16')]['include']?_[_0x714a('0x1b')](_0x4213b7[_0x714a('0x16')][_0x714a('0x1c')],function(_0x4907dc){return{'model':db[_0x4907dc[_0x714a('0x1d')]],'as':_0x4907dc['as'],'attributes':_0x4907dc['attributes'],'include':_0x4907dc[_0x714a('0x1c')]?_[_0x714a('0x1b')](_0x4907dc[_0x714a('0x1c')],function(_0x283ea0){return{'model':db[_0x283ea0['model']],'as':_0x283ea0['as'],'attributes':_0x283ea0[_0x714a('0x19')],'include':_0x283ea0[_0x714a('0x1c')]?_[_0x714a('0x1b')](_0x283ea0['include'],function(_0x351fa0){return{'model':db[_0x351fa0[_0x714a('0x1d')]],'as':_0x351fa0['as'],'attributes':_0x351fa0[_0x714a('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1ca14c){logger[_0x714a('0xa')](_0x714a('0x14'),_0x4213b7);logger['debug'](_0x714a('0x14'),_0x4213b7,JSON[_0x714a('0xe')](_0x1ca14c));_0x462a0a(_0x1ca14c);})[_0x714a('0x13')](function(_0x43565e){logger[_0x714a('0xf')]('GetVoiceCallReport',_0x43565e[_0x714a('0x11')],_0x4213b7);_0x393428(_0x35ebf5[_0x714a('0xf')](0x1f4,_0x43565e[_0x714a('0x11')]));});});};exports[_0x714a('0x1e')]=function(_0x57e7c2){var _0x37e3e0=this;return new Promise(function(_0x1c6dca,_0x2e2999){return db['VoiceCallReport'][_0x714a('0x1f')](_0x57e7c2[_0x714a('0x20')],{'raw':_0x57e7c2[_0x714a('0x16')]?_0x57e7c2[_0x714a('0x16')][_0x714a('0x17')]===undefined?!![]:![]:!![]})[_0x714a('0x21')](function(_0xb74f67){logger['info']('CreateVoiceCallReport',_0x57e7c2);logger[_0x714a('0x22')](_0x714a('0x1e'),_0x57e7c2,JSON[_0x714a('0xe')](_0xb74f67));_0x1c6dca(_0xb74f67);})[_0x714a('0x13')](function(_0x490268){logger[_0x714a('0xf')](_0x714a('0x1e'),_0x490268[_0x714a('0x11')],_0x57e7c2);_0x2e2999(_0x37e3e0[_0x714a('0xf')](0x1f4,_0x490268[_0x714a('0x11')]));});});};exports['UpdateVoiceCallReport']=function(_0x549001){var _0xfaa958=this;return new Promise(function(_0x2c6968,_0x463fa2){return db[_0x714a('0x15')][_0x714a('0x23')](_0x549001[_0x714a('0x20')],{'raw':_0x549001[_0x714a('0x16')]?_0x549001[_0x714a('0x16')][_0x714a('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x549001['options']?_0x549001[_0x714a('0x16')][_0x714a('0x18')]||null:null,'attributes':_0x549001[_0x714a('0x16')]?_0x549001[_0x714a('0x16')][_0x714a('0x19')]||null:null,'limit':_0x549001[_0x714a('0x16')]?_0x549001[_0x714a('0x16')][_0x714a('0x1a')]||null:null})[_0x714a('0x21')](function(_0x2866e8){logger[_0x714a('0xa')](_0x714a('0x24'),_0x549001);logger[_0x714a('0x22')](_0x714a('0x24'),_0x549001,JSON['stringify'](_0x2866e8));_0x2c6968(_0x2866e8);})['catch'](function(_0x4e66e0){logger[_0x714a('0xf')](_0x714a('0x24'),_0x4e66e0['message'],_0x549001);_0x463fa2(_0xfaa958['error'](0x1f4,_0x4e66e0['message']));});});}; \ No newline at end of file +var _0x71fe=['lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceCallReport','VoiceCallReport','options','raw','where','attributes','limit','include','model','map','debug','create','body','CreateVoiceCallReport','UpdateVoiceCallReport'];(function(_0x646821,_0x374c2e){var _0x54864a=function(_0x34435b){while(--_0x34435b){_0x646821['push'](_0x646821['shift']());}};_0x54864a(++_0x374c2e);}(_0x71fe,0x1d4));var _0xe71f=function(_0x180aca,_0x33f7c0){_0x180aca=_0x180aca-0x0;var _0x2fb3e7=_0x71fe[_0x180aca];return _0x2fb3e7;};'use strict';var _=require(_0xe71f('0x0'));var util=require(_0xe71f('0x1'));var moment=require(_0xe71f('0x2'));var BPromise=require(_0xe71f('0x3'));var rs=require(_0xe71f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe71f('0x5'))(_0xe71f('0x6'));var config=require(_0xe71f('0x7'));var jayson=require(_0xe71f('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x44a0ec,_0x419922,_0x4a8785){return new BPromise(function(_0x3d9412,_0x2a0b7d){return client[_0xe71f('0x9')](_0x44a0ec,_0x4a8785)[_0xe71f('0xa')](function(_0x9436f2){logger[_0xe71f('0xb')](_0xe71f('0xc'),_0x419922,_0xe71f('0xd'));logger['debug'](_0xe71f('0xe'),_0x419922,_0xe71f('0xd'),JSON[_0xe71f('0xf')](_0x9436f2));if(_0x9436f2[_0xe71f('0x10')]){if(_0x9436f2['error'][_0xe71f('0x11')]===0x1f4){logger[_0xe71f('0x10')](_0xe71f('0xc'),_0x419922,_0x9436f2[_0xe71f('0x10')][_0xe71f('0x12')]);return _0x2a0b7d(_0x9436f2[_0xe71f('0x10')]['message']);}logger[_0xe71f('0x10')]('VoiceCallReport,\x20%s,\x20%s',_0x419922,_0x9436f2[_0xe71f('0x10')][_0xe71f('0x12')]);return _0x3d9412(_0x9436f2[_0xe71f('0x10')][_0xe71f('0x12')]);}else{logger[_0xe71f('0xb')](_0xe71f('0xc'),_0x419922,_0xe71f('0xd'));_0x3d9412(_0x9436f2[_0xe71f('0x13')][_0xe71f('0x12')]);}})[_0xe71f('0x14')](function(_0x1efcda){logger[_0xe71f('0x10')](_0xe71f('0xc'),_0x419922,_0x1efcda);_0x2a0b7d(_0x1efcda);});});}exports[_0xe71f('0x15')]=function(_0x5815cb){var _0x26db64=this;return new Promise(function(_0x2e2e7f,_0x275fa0){return db[_0xe71f('0x16')]['findAll']({'raw':_0x5815cb[_0xe71f('0x17')]?_0x5815cb[_0xe71f('0x17')][_0xe71f('0x18')]===undefined?!![]:![]:!![],'where':_0x5815cb[_0xe71f('0x17')]?_0x5815cb[_0xe71f('0x17')][_0xe71f('0x19')]||null:null,'attributes':_0x5815cb[_0xe71f('0x17')]?_0x5815cb[_0xe71f('0x17')][_0xe71f('0x1a')]||null:null,'limit':_0x5815cb[_0xe71f('0x17')]?_0x5815cb[_0xe71f('0x17')][_0xe71f('0x1b')]||null:null,'include':_0x5815cb[_0xe71f('0x17')]?_0x5815cb['options']['include']?_['map'](_0x5815cb[_0xe71f('0x17')][_0xe71f('0x1c')],function(_0x2854e5){return{'model':db[_0x2854e5[_0xe71f('0x1d')]],'as':_0x2854e5['as'],'attributes':_0x2854e5['attributes'],'include':_0x2854e5[_0xe71f('0x1c')]?_[_0xe71f('0x1e')](_0x2854e5[_0xe71f('0x1c')],function(_0x2a5a72){return{'model':db[_0x2a5a72['model']],'as':_0x2a5a72['as'],'attributes':_0x2a5a72['attributes'],'include':_0x2a5a72[_0xe71f('0x1c')]?_[_0xe71f('0x1e')](_0x2a5a72[_0xe71f('0x1c')],function(_0xb66a41){return{'model':db[_0xb66a41[_0xe71f('0x1d')]],'as':_0xb66a41['as'],'attributes':_0xb66a41[_0xe71f('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xe71f('0xa')](function(_0xab7efe){logger[_0xe71f('0xb')]('GetVoiceCallReport',_0x5815cb);logger[_0xe71f('0x1f')]('GetVoiceCallReport',_0x5815cb,JSON['stringify'](_0xab7efe));_0x2e2e7f(_0xab7efe);})[_0xe71f('0x14')](function(_0x350dc0){logger[_0xe71f('0x10')](_0xe71f('0x15'),_0x350dc0[_0xe71f('0x12')],_0x5815cb);_0x275fa0(_0x26db64[_0xe71f('0x10')](0x1f4,_0x350dc0['message']));});});};exports['CreateVoiceCallReport']=function(_0x5e4da7){var _0x234ba0=this;return new Promise(function(_0x1b04eb,_0x767f48){return db[_0xe71f('0x16')][_0xe71f('0x20')](_0x5e4da7[_0xe71f('0x21')],{'raw':_0x5e4da7[_0xe71f('0x17')]?_0x5e4da7[_0xe71f('0x17')][_0xe71f('0x18')]===undefined?!![]:![]:!![]})[_0xe71f('0xa')](function(_0x515ab4){logger[_0xe71f('0xb')](_0xe71f('0x22'),_0x5e4da7);logger[_0xe71f('0x1f')](_0xe71f('0x22'),_0x5e4da7,JSON[_0xe71f('0xf')](_0x515ab4));_0x1b04eb(_0x515ab4);})['catch'](function(_0x36ec7a){logger[_0xe71f('0x10')](_0xe71f('0x22'),_0x36ec7a[_0xe71f('0x12')],_0x5e4da7);_0x767f48(_0x234ba0[_0xe71f('0x10')](0x1f4,_0x36ec7a[_0xe71f('0x12')]));});});};exports[_0xe71f('0x23')]=function(_0xe7725b){var _0x4123fc=this;return new Promise(function(_0x4c9c8a,_0x209051){return db[_0xe71f('0x16')]['update'](_0xe7725b[_0xe71f('0x21')],{'raw':_0xe7725b[_0xe71f('0x17')]?_0xe7725b[_0xe71f('0x17')][_0xe71f('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xe7725b[_0xe71f('0x17')]?_0xe7725b[_0xe71f('0x17')]['where']||null:null,'attributes':_0xe7725b['options']?_0xe7725b[_0xe71f('0x17')][_0xe71f('0x1a')]||null:null,'limit':_0xe7725b[_0xe71f('0x17')]?_0xe7725b[_0xe71f('0x17')][_0xe71f('0x1b')]||null:null})['then'](function(_0x5f34bc){logger[_0xe71f('0xb')](_0xe71f('0x23'),_0xe7725b);logger['debug'](_0xe71f('0x23'),_0xe7725b,JSON[_0xe71f('0xf')](_0x5f34bc));_0x4c9c8a(_0x5f34bc);})['catch'](function(_0xc13a5){logger[_0xe71f('0x10')](_0xe71f('0x23'),_0xc13a5[_0xe71f('0x12')],_0xe7725b);_0x209051(_0x4123fc[_0xe71f('0x10')](0x1f4,_0xc13a5[_0xe71f('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index cfa912a..7093ff2 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 _0x2d8b=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceChanSpy.controller','isAuthenticated','index','get','/:id','show','post'];(function(_0x421725,_0x318a04){var _0x51b322=function(_0xe58018){while(--_0xe58018){_0x421725['push'](_0x421725['shift']());}};_0x51b322(++_0x318a04);}(_0x2d8b,0x1e9));var _0xb2d8=function(_0x3aed59,_0x270ee1){_0x3aed59=_0x3aed59-0x0;var _0x15d9bb=_0x2d8b[_0x3aed59];return _0x15d9bb;};'use strict';var multer=require(_0xb2d8('0x0'));var util=require(_0xb2d8('0x1'));var path=require(_0xb2d8('0x2'));var timeout=require(_0xb2d8('0x3'));var express=require('express');var router=express[_0xb2d8('0x4')]();var fs_extra=require(_0xb2d8('0x5'));var auth=require(_0xb2d8('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb2d8('0x7'));var controller=require(_0xb2d8('0x8'));router['get']('/',auth[_0xb2d8('0x9')](),controller[_0xb2d8('0xa')]);router[_0xb2d8('0xb')](_0xb2d8('0xc'),auth[_0xb2d8('0x9')](),controller[_0xb2d8('0xd')]);router[_0xb2d8('0xe')]('/',auth[_0xb2d8('0x9')](),controller[_0xb2d8('0xf')]);router[_0xb2d8('0x10')](_0xb2d8('0xc'),auth[_0xb2d8('0x9')](),controller[_0xb2d8('0x11')]);router[_0xb2d8('0x12')](_0xb2d8('0xc'),auth[_0xb2d8('0x9')](),controller[_0xb2d8('0x13')]);module[_0xb2d8('0x14')]=router; \ No newline at end of file +var _0xad1d=['../../components/interaction/service','../../config/environment','get','isAuthenticated','post','create','put','/:id','destroy','exports','util','path','connect-timeout','express','fs-extra'];(function(_0x4b03c9,_0x17ce03){var _0x161ba2=function(_0xb952db){while(--_0xb952db){_0x4b03c9['push'](_0x4b03c9['shift']());}};_0x161ba2(++_0x17ce03);}(_0xad1d,0xaf));var _0xdad1=function(_0x374ada,_0x27b3a5){_0x374ada=_0x374ada-0x0;var _0x449ed8=_0xad1d[_0x374ada];return _0x449ed8;};'use strict';var multer=require('multer');var util=require(_0xdad1('0x0'));var path=require(_0xdad1('0x1'));var timeout=require(_0xdad1('0x2'));var express=require(_0xdad1('0x3'));var router=express['Router']();var fs_extra=require(_0xdad1('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xdad1('0x5'));var config=require(_0xdad1('0x6'));var controller=require('./voiceChanSpy.controller');router[_0xdad1('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth[_0xdad1('0x8')](),controller['show']);router[_0xdad1('0x9')]('/',auth[_0xdad1('0x8')](),controller[_0xdad1('0xa')]);router[_0xdad1('0xb')](_0xdad1('0xc'),auth[_0xdad1('0x8')](),controller['update']);router['delete'](_0xdad1('0xc'),auth[_0xdad1('0x8')](),controller[_0xdad1('0xd')]);module[_0xdad1('0xe')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 721a153..2b84ae7 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 _0x5951=['join','getDataValue','split','BOOLEAN','sequelize','exports','STRING','name','setDataValue','options'];(function(_0x481ad7,_0x4096ad){var _0x54dfd6=function(_0x47d712){while(--_0x47d712){_0x481ad7['push'](_0x481ad7['shift']());}};_0x54dfd6(++_0x4096ad);}(_0x5951,0x1e4));var _0x1595=function(_0xcbc8dd,_0x2700e9){_0xcbc8dd=_0xcbc8dd-0x0;var _0x5fec7=_0x5951[_0xcbc8dd];return _0x5fec7;};'use strict';var Sequelize=require(_0x1595('0x0'));module[_0x1595('0x1')]={'name':{'type':Sequelize[_0x1595('0x2')]},'prefix':{'type':Sequelize[_0x1595('0x2')],'unique':_0x1595('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x1595('0x2')],'set':function(_0x1ebf69){this[_0x1595('0x4')](_0x1595('0x5'),_0x1ebf69?_0x1ebf69[_0x1595('0x6')](''):[]);},'get':function(){return this[_0x1595('0x7')]('options')?this[_0x1595('0x7')](_0x1595('0x5'))[_0x1595('0x8')](''):[];}},'auth':{'type':Sequelize[_0x1595('0x9')],'defaultValue':![]},'password':{'type':Sequelize[_0x1595('0x2')]},'record':{'type':Sequelize[_0x1595('0x9')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x1595('0x2')]},'description':{'type':Sequelize[_0x1595('0x2')]}}; \ No newline at end of file +var _0x1d15=['setDataValue','options','join','getDataValue','split','BOOLEAN','STRING','sequelize','exports','name'];(function(_0x4e030f,_0x5a07a1){var _0x2d000f=function(_0x2846c9){while(--_0x2846c9){_0x4e030f['push'](_0x4e030f['shift']());}};_0x2d000f(++_0x5a07a1);}(_0x1d15,0x183));var _0x51d1=function(_0x24b034,_0x355a2a){_0x24b034=_0x24b034-0x0;var _0x13878a=_0x1d15[_0x24b034];return _0x13878a;};'use strict';var Sequelize=require(_0x51d1('0x0'));module[_0x51d1('0x1')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize['STRING'],'unique':_0x51d1('0x2'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x5dd4a0){this[_0x51d1('0x3')](_0x51d1('0x4'),_0x5dd4a0?_0x5dd4a0[_0x51d1('0x5')](''):[]);},'get':function(){return this[_0x51d1('0x6')](_0x51d1('0x4'))?this['getDataValue'](_0x51d1('0x4'))[_0x51d1('0x7')](''):[];}},'auth':{'type':Sequelize[_0x51d1('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0x51d1('0x9')]},'record':{'type':Sequelize[_0x51d1('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x51d1('0x9')]},'description':{'type':Sequelize[_0x51d1('0x9')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 87b08be..1079a1a 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 _0x9224=['request-promise','moment','bluebird','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','stack','name','index','map','VoiceChanSpy','fieldName','type','key','query','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','includeAll','include','findAll','rows','show','params','keys','length','options','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','ChanSpies','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0x9224,0xa3));var _0x4922=function(_0x465ca8,_0x58e1b1){_0x465ca8=_0x465ca8-0x0;var _0x31036b=_0x9224[_0x465ca8];return _0x31036b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4922('0x0'));var zipdir=require(_0x4922('0x1'));var jsonpatch=require(_0x4922('0x2'));var rp=require(_0x4922('0x3'));var moment=require(_0x4922('0x4'));var BPromise=require(_0x4922('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x4922('0x6'));var csv=require('to-csv');var ejs=require(_0x4922('0x7'));var fs=require('fs');var fs_extra=require(_0x4922('0x8'));var _=require(_0x4922('0x9'));var squel=require(_0x4922('0xa'));var crypto=require(_0x4922('0xb'));var jsforce=require(_0x4922('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x4922('0xd'));var querystring=require(_0x4922('0xe'));var Papa=require('papaparse');var Redis=require(_0x4922('0xf'));var authService=require(_0x4922('0x10'));var qs=require(_0x4922('0x11'));var as=require(_0x4922('0x12'));var hardwareService=require(_0x4922('0x13'));var logger=require(_0x4922('0x14'))(_0x4922('0x15'));var utils=require(_0x4922('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x4922('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x410502,_0x45de0c){_0x45de0c=_0x45de0c||0xcc;return function(_0x35ca3d){if(_0x35ca3d){return _0x410502[_0x4922('0x18')](_0x45de0c);}return _0x410502[_0x4922('0x19')](_0x45de0c)['end']();};}function respondWithResult(_0x103fa8,_0x704e23){_0x704e23=_0x704e23||0xc8;return function(_0x542410){if(_0x542410){return _0x103fa8[_0x4922('0x19')](_0x704e23)[_0x4922('0x1a')](_0x542410);}};}function respondWithFilteredResult(_0x15bf3a,_0x3010bb){return function(_0x434f62){if(_0x434f62){var _0x4385d2=typeof _0x3010bb[_0x4922('0x1b')]==='undefined'&&typeof _0x3010bb[_0x4922('0x1c')]==='undefined';var _0x15fe9e=_0x434f62[_0x4922('0x1d')];var _0x1d7fc2=_0x4385d2?0x0:_0x3010bb[_0x4922('0x1b')];var _0x2ef410=_0x4385d2?_0x434f62[_0x4922('0x1d')]:_0x3010bb['offset']+_0x3010bb[_0x4922('0x1c')];var _0x3abfbf;if(_0x2ef410>=_0x15fe9e){_0x2ef410=_0x15fe9e;_0x3abfbf=0xc8;}else{_0x3abfbf=0xce;}_0x15bf3a[_0x4922('0x19')](_0x3abfbf);return _0x15bf3a[_0x4922('0x1e')](_0x4922('0x1f'),_0x1d7fc2+'-'+_0x2ef410+'/'+_0x15fe9e)['json'](_0x434f62);}return null;};}function patchUpdates(_0x2b6a2d){return function(_0x20ef64){try{jsonpatch[_0x4922('0x20')](_0x20ef64,_0x2b6a2d,!![]);}catch(_0x183ec9){return BPromise[_0x4922('0x21')](_0x183ec9);}return _0x20ef64[_0x4922('0x22')]();};}function saveUpdates(_0x1c1243,_0x3b182b){return function(_0x5c766e){if(_0x5c766e){return _0x5c766e[_0x4922('0x23')](_0x1c1243)[_0x4922('0x24')](function(_0x4bd606){return _0x4bd606;});}return null;};}function removeEntity(_0x21859a,_0x23ce8d){return function(_0x4f93cb){if(_0x4f93cb){return _0x4f93cb[_0x4922('0x25')]()['then'](function(){var _0x3daefd=_0x4f93cb[_0x4922('0x26')]({'plain':!![]});var _0x26bb17='ChanSpies';return db[_0x4922('0x27')][_0x4922('0x25')]({'where':{'type':_0x26bb17,'resourceId':_0x3daefd['id']}})[_0x4922('0x24')](function(){return _0x4f93cb;});})['then'](function(){_0x21859a[_0x4922('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f39d5,_0x28d3ba){return function(_0x41ef37){if(!_0x41ef37){_0x3f39d5[_0x4922('0x18')](0x194);}return _0x41ef37;};}function handleError(_0x30b538,_0x4a7934){_0x4a7934=_0x4a7934||0x1f4;return function(_0x46cd81){logger['error'](_0x46cd81[_0x4922('0x28')]);if(_0x46cd81[_0x4922('0x29')]){delete _0x46cd81['name'];}_0x30b538['status'](_0x4a7934)['send'](_0x46cd81);};}exports[_0x4922('0x2a')]=function(_0x575024,_0x5e7709){var _0x187c73={},_0x2db1c6={},_0x481ae3={'count':0x0,'rows':[]};var _0x2b132d=_[_0x4922('0x2b')](db[_0x4922('0x2c')]['rawAttributes'],function(_0x49c88e){return{'name':_0x49c88e[_0x4922('0x2d')],'type':_0x49c88e[_0x4922('0x2e')][_0x4922('0x2f')]};});_0x2db1c6['model']=_[_0x4922('0x2b')](_0x2b132d,_0x4922('0x29'));_0x2db1c6[_0x4922('0x30')]=_['keys'](_0x575024['query']);_0x2db1c6[_0x4922('0x31')]=_[_0x4922('0x32')](_0x2db1c6['model'],_0x2db1c6[_0x4922('0x30')]);_0x187c73['attributes']=_[_0x4922('0x32')](_0x2db1c6[_0x4922('0x33')],qs[_0x4922('0x34')](_0x575024[_0x4922('0x30')][_0x4922('0x34')]));_0x187c73[_0x4922('0x35')]=_0x187c73[_0x4922('0x35')]['length']?_0x187c73[_0x4922('0x35')]:_0x2db1c6[_0x4922('0x33')];if(!_0x575024[_0x4922('0x30')][_0x4922('0x36')](_0x4922('0x37'))){_0x187c73[_0x4922('0x1c')]=qs[_0x4922('0x1c')](_0x575024[_0x4922('0x30')][_0x4922('0x1c')]);_0x187c73[_0x4922('0x1b')]=qs['offset'](_0x575024['query'][_0x4922('0x1b')]);}_0x187c73[_0x4922('0x38')]=qs[_0x4922('0x39')](_0x575024[_0x4922('0x30')][_0x4922('0x39')]);_0x187c73['where']=qs['filters'](_[_0x4922('0x3a')](_0x575024[_0x4922('0x30')],_0x2db1c6[_0x4922('0x31')]),_0x2b132d);if(_0x575024[_0x4922('0x30')][_0x4922('0x3b')]){_0x187c73['where']=_[_0x4922('0x3c')](_0x187c73[_0x4922('0x3d')],{'$or':_[_0x4922('0x2b')](_0x2b132d,function(_0x33f84f){if(_0x33f84f[_0x4922('0x2e')]!=='VIRTUAL'){var _0x5a4ec6={};_0x5a4ec6[_0x33f84f[_0x4922('0x29')]]={'$like':'%'+_0x575024[_0x4922('0x30')]['filter']+'%'};return _0x5a4ec6;}})});}_0x187c73=_[_0x4922('0x3c')]({},_0x187c73,_0x575024['options']);var _0x1f81cc={'where':_0x187c73[_0x4922('0x3d')]};return db[_0x4922('0x2c')][_0x4922('0x1d')](_0x1f81cc)[_0x4922('0x24')](function(_0x499b26){_0x481ae3['count']=_0x499b26;if(_0x575024[_0x4922('0x30')][_0x4922('0x3e')]){_0x187c73[_0x4922('0x3f')]=[{'all':!![]}];}return db[_0x4922('0x2c')][_0x4922('0x40')](_0x187c73);})[_0x4922('0x24')](function(_0xa2fec8){_0x481ae3[_0x4922('0x41')]=_0xa2fec8;return _0x481ae3;})[_0x4922('0x24')](respondWithFilteredResult(_0x5e7709,_0x187c73))['catch'](handleError(_0x5e7709,null));};exports[_0x4922('0x42')]=function(_0xc7bd23,_0x114bb8){var _0x1a4c06={'raw':![],'where':{'id':_0xc7bd23[_0x4922('0x43')]['id']}},_0x58bc02={};_0x58bc02[_0x4922('0x33')]=_[_0x4922('0x44')](db[_0x4922('0x2c')]['rawAttributes']);_0x58bc02['query']=_[_0x4922('0x44')](_0xc7bd23[_0x4922('0x30')]);_0x58bc02[_0x4922('0x31')]=_['intersection'](_0x58bc02['model'],_0x58bc02[_0x4922('0x30')]);_0x1a4c06[_0x4922('0x35')]=_[_0x4922('0x32')](_0x58bc02[_0x4922('0x33')],qs[_0x4922('0x34')](_0xc7bd23[_0x4922('0x30')][_0x4922('0x34')]));_0x1a4c06[_0x4922('0x35')]=_0x1a4c06['attributes'][_0x4922('0x45')]?_0x1a4c06[_0x4922('0x35')]:_0x58bc02[_0x4922('0x33')];if(_0xc7bd23[_0x4922('0x30')][_0x4922('0x3e')]){_0x1a4c06[_0x4922('0x3f')]=[{'all':!![]}];}_0x1a4c06=_[_0x4922('0x3c')]({},_0x1a4c06,_0xc7bd23[_0x4922('0x46')]);return db[_0x4922('0x2c')][_0x4922('0x47')](_0x1a4c06)[_0x4922('0x24')](handleEntityNotFound(_0x114bb8,null))[_0x4922('0x24')](respondWithResult(_0x114bb8,null))[_0x4922('0x48')](handleError(_0x114bb8,null));};exports[_0x4922('0x49')]=function(_0x4c7c02,_0x58fadf){return db[_0x4922('0x2c')]['create'](_0x4c7c02[_0x4922('0x4a')],{})[_0x4922('0x24')](function(_0x2fd67b){var _0x4f1054=_0x4c7c02['user'][_0x4922('0x26')]({'plain':!![]});if(!_0x4f1054)throw new Error(_0x4922('0x4b'));if(_0x4f1054['role']===_0x4922('0x4c')){var _0x121b03=_0x2fd67b['get']({'plain':!![]});var _0x3a7330=_0x4922('0x4d');return db[_0x4922('0x4e')][_0x4922('0x47')]({'where':{'name':_0x3a7330,'userProfileId':_0x4f1054[_0x4922('0x4f')]},'raw':!![]})[_0x4922('0x24')](function(_0x1951eb){if(_0x1951eb&&_0x1951eb[_0x4922('0x50')]===0x0){return db[_0x4922('0x27')][_0x4922('0x49')]({'name':_0x121b03[_0x4922('0x29')],'resourceId':_0x121b03['id'],'type':_0x1951eb['name'],'sectionId':_0x1951eb['id']},{})[_0x4922('0x24')](function(){return _0x2fd67b;});}else{return _0x2fd67b;}})[_0x4922('0x48')](function(_0x15f169){logger[_0x4922('0x51')](_0x4922('0x52'),_0x15f169);throw _0x15f169;});}return _0x2fd67b;})[_0x4922('0x24')](respondWithResult(_0x58fadf,0xc9))[_0x4922('0x48')](handleError(_0x58fadf,null));};exports[_0x4922('0x23')]=function(_0x16daad,_0xb45a07){if(_0x16daad['body']['id']){delete _0x16daad['body']['id'];}return db[_0x4922('0x2c')][_0x4922('0x47')]({'where':{'id':_0x16daad['params']['id']}})[_0x4922('0x24')](handleEntityNotFound(_0xb45a07,null))[_0x4922('0x24')](saveUpdates(_0x16daad[_0x4922('0x4a')],null))[_0x4922('0x24')](respondWithResult(_0xb45a07,null))[_0x4922('0x48')](handleError(_0xb45a07,null));};exports[_0x4922('0x25')]=function(_0xbcc817,_0x2c0f35){return db[_0x4922('0x2c')][_0x4922('0x47')]({'where':{'id':_0xbcc817[_0x4922('0x43')]['id']}})[_0x4922('0x24')](handleEntityNotFound(_0x2c0f35,null))['then'](removeEntity(_0x2c0f35,null))[_0x4922('0x48')](handleError(_0x2c0f35,null));}; \ No newline at end of file +var _0xb0b9=['params','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','offset','undefined','limit','count','Content-Range','json','apply','reject','save','then','destroy','get','ChanSpies','UserProfileResource','end','error','name','send','map','VoiceChanSpy','rawAttributes','fieldName','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','keys','includeAll','include','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','update','body','find'];(function(_0x1b2852,_0x277384){var _0x57b387=function(_0x2c7da4){while(--_0x2c7da4){_0x1b2852['push'](_0x1b2852['shift']());}};_0x57b387(++_0x277384);}(_0xb0b9,0x1f3));var _0x9b0b=function(_0x298060,_0x205bbf){_0x298060=_0x298060-0x0;var _0x2e50db=_0xb0b9[_0x298060];return _0x2e50db;};'use strict';var emlformat=require(_0x9b0b('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9b0b('0x1'));var rp=require(_0x9b0b('0x2'));var moment=require(_0x9b0b('0x3'));var BPromise=require(_0x9b0b('0x4'));var Mustache=require(_0x9b0b('0x5'));var util=require(_0x9b0b('0x6'));var path=require(_0x9b0b('0x7'));var sox=require(_0x9b0b('0x8'));var csv=require(_0x9b0b('0x9'));var ejs=require(_0x9b0b('0xa'));var fs=require('fs');var fs_extra=require(_0x9b0b('0xb'));var _=require(_0x9b0b('0xc'));var squel=require(_0x9b0b('0xd'));var crypto=require(_0x9b0b('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9b0b('0x9'));var querystring=require(_0x9b0b('0xf'));var Papa=require(_0x9b0b('0x10'));var Redis=require(_0x9b0b('0x11'));var authService=require(_0x9b0b('0x12'));var qs=require(_0x9b0b('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9b0b('0x14'));var logger=require(_0x9b0b('0x15'))(_0x9b0b('0x16'));var utils=require(_0x9b0b('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9b0b('0x18'))['db'];function respondWithStatusCode(_0x4b3ed5,_0x283336){_0x283336=_0x283336||0xcc;return function(_0x4e6739){if(_0x4e6739){return _0x4b3ed5[_0x9b0b('0x19')](_0x283336);}return _0x4b3ed5[_0x9b0b('0x1a')](_0x283336)['end']();};}function respondWithResult(_0x5974af,_0x5f0555){_0x5f0555=_0x5f0555||0xc8;return function(_0xe9c112){if(_0xe9c112){return _0x5974af[_0x9b0b('0x1a')](_0x5f0555)['json'](_0xe9c112);}};}function respondWithFilteredResult(_0x248ff9,_0x377736){return function(_0x297b07){if(_0x297b07){var _0x1e92c1=typeof _0x377736[_0x9b0b('0x1b')]===_0x9b0b('0x1c')&&typeof _0x377736[_0x9b0b('0x1d')]===_0x9b0b('0x1c');var _0x1b7673=_0x297b07[_0x9b0b('0x1e')];var _0x264b6d=_0x1e92c1?0x0:_0x377736[_0x9b0b('0x1b')];var _0x3334e5=_0x1e92c1?_0x297b07[_0x9b0b('0x1e')]:_0x377736['offset']+_0x377736[_0x9b0b('0x1d')];var _0xee66f5;if(_0x3334e5>=_0x1b7673){_0x3334e5=_0x1b7673;_0xee66f5=0xc8;}else{_0xee66f5=0xce;}_0x248ff9[_0x9b0b('0x1a')](_0xee66f5);return _0x248ff9['set'](_0x9b0b('0x1f'),_0x264b6d+'-'+_0x3334e5+'/'+_0x1b7673)[_0x9b0b('0x20')](_0x297b07);}return null;};}function patchUpdates(_0x4067d3){return function(_0x565d35){try{jsonpatch[_0x9b0b('0x21')](_0x565d35,_0x4067d3,!![]);}catch(_0x2218d5){return BPromise[_0x9b0b('0x22')](_0x2218d5);}return _0x565d35[_0x9b0b('0x23')]();};}function saveUpdates(_0x4fe0a2,_0x30bfe8){return function(_0x408f70){if(_0x408f70){return _0x408f70['update'](_0x4fe0a2)[_0x9b0b('0x24')](function(_0x1e7789){return _0x1e7789;});}return null;};}function removeEntity(_0x3f433c,_0x16b413){return function(_0xbf0f87){if(_0xbf0f87){return _0xbf0f87[_0x9b0b('0x25')]()[_0x9b0b('0x24')](function(){var _0x322a0b=_0xbf0f87[_0x9b0b('0x26')]({'plain':!![]});var _0x5771fd=_0x9b0b('0x27');return db[_0x9b0b('0x28')][_0x9b0b('0x25')]({'where':{'type':_0x5771fd,'resourceId':_0x322a0b['id']}})[_0x9b0b('0x24')](function(){return _0xbf0f87;});})['then'](function(){_0x3f433c[_0x9b0b('0x1a')](0xcc)[_0x9b0b('0x29')]();});}};}function handleEntityNotFound(_0x5c9ec3,_0x2841fc){return function(_0x1e25fb){if(!_0x1e25fb){_0x5c9ec3[_0x9b0b('0x19')](0x194);}return _0x1e25fb;};}function handleError(_0x47a135,_0x2cfe21){_0x2cfe21=_0x2cfe21||0x1f4;return function(_0xa4f392){logger[_0x9b0b('0x2a')](_0xa4f392['stack']);if(_0xa4f392[_0x9b0b('0x2b')]){delete _0xa4f392[_0x9b0b('0x2b')];}_0x47a135[_0x9b0b('0x1a')](_0x2cfe21)[_0x9b0b('0x2c')](_0xa4f392);};}exports['index']=function(_0x347f76,_0xfa71df){var _0x48d324={},_0x272934={},_0x32cde1={'count':0x0,'rows':[]};var _0x328e82=_[_0x9b0b('0x2d')](db[_0x9b0b('0x2e')][_0x9b0b('0x2f')],function(_0xfd6ce){return{'name':_0xfd6ce[_0x9b0b('0x30')],'type':_0xfd6ce['type']['key']};});_0x272934[_0x9b0b('0x31')]=_['map'](_0x328e82,_0x9b0b('0x2b'));_0x272934['query']=_['keys'](_0x347f76['query']);_0x272934[_0x9b0b('0x32')]=_[_0x9b0b('0x33')](_0x272934[_0x9b0b('0x31')],_0x272934[_0x9b0b('0x34')]);_0x48d324[_0x9b0b('0x35')]=_[_0x9b0b('0x33')](_0x272934[_0x9b0b('0x31')],qs[_0x9b0b('0x36')](_0x347f76[_0x9b0b('0x34')][_0x9b0b('0x36')]));_0x48d324[_0x9b0b('0x35')]=_0x48d324[_0x9b0b('0x35')][_0x9b0b('0x37')]?_0x48d324['attributes']:_0x272934[_0x9b0b('0x31')];if(!_0x347f76[_0x9b0b('0x34')][_0x9b0b('0x38')](_0x9b0b('0x39'))){_0x48d324[_0x9b0b('0x1d')]=qs[_0x9b0b('0x1d')](_0x347f76[_0x9b0b('0x34')][_0x9b0b('0x1d')]);_0x48d324[_0x9b0b('0x1b')]=qs[_0x9b0b('0x1b')](_0x347f76[_0x9b0b('0x34')][_0x9b0b('0x1b')]);}_0x48d324[_0x9b0b('0x3a')]=qs['sort'](_0x347f76['query'][_0x9b0b('0x3b')]);_0x48d324[_0x9b0b('0x3c')]=qs[_0x9b0b('0x32')](_[_0x9b0b('0x3d')](_0x347f76[_0x9b0b('0x34')],_0x272934['filters']),_0x328e82);if(_0x347f76[_0x9b0b('0x34')][_0x9b0b('0x3e')]){_0x48d324[_0x9b0b('0x3c')]=_[_0x9b0b('0x3f')](_0x48d324['where'],{'$or':_['map'](_0x328e82,function(_0x1fffc4){if(_0x1fffc4['type']!==_0x9b0b('0x40')){var _0x316d86={};_0x316d86[_0x1fffc4[_0x9b0b('0x2b')]]={'$like':'%'+_0x347f76[_0x9b0b('0x34')][_0x9b0b('0x3e')]+'%'};return _0x316d86;}})});}_0x48d324=_[_0x9b0b('0x3f')]({},_0x48d324,_0x347f76[_0x9b0b('0x41')]);var _0x24724c={'where':_0x48d324[_0x9b0b('0x3c')]};return db[_0x9b0b('0x2e')][_0x9b0b('0x1e')](_0x24724c)[_0x9b0b('0x24')](function(_0x4049ad){_0x32cde1[_0x9b0b('0x1e')]=_0x4049ad;if(_0x347f76[_0x9b0b('0x34')]['includeAll']){_0x48d324['include']=[{'all':!![]}];}return db['VoiceChanSpy'][_0x9b0b('0x42')](_0x48d324);})[_0x9b0b('0x24')](function(_0x1522a1){_0x32cde1[_0x9b0b('0x43')]=_0x1522a1;return _0x32cde1;})[_0x9b0b('0x24')](respondWithFilteredResult(_0xfa71df,_0x48d324))['catch'](handleError(_0xfa71df,null));};exports['show']=function(_0x20ec55,_0x243063){var _0x8be3d0={'raw':![],'where':{'id':_0x20ec55['params']['id']}},_0x136a33={};_0x136a33[_0x9b0b('0x31')]=_[_0x9b0b('0x44')](db[_0x9b0b('0x2e')][_0x9b0b('0x2f')]);_0x136a33[_0x9b0b('0x34')]=_['keys'](_0x20ec55[_0x9b0b('0x34')]);_0x136a33[_0x9b0b('0x32')]=_[_0x9b0b('0x33')](_0x136a33[_0x9b0b('0x31')],_0x136a33[_0x9b0b('0x34')]);_0x8be3d0[_0x9b0b('0x35')]=_[_0x9b0b('0x33')](_0x136a33[_0x9b0b('0x31')],qs['fields'](_0x20ec55['query']['fields']));_0x8be3d0[_0x9b0b('0x35')]=_0x8be3d0[_0x9b0b('0x35')][_0x9b0b('0x37')]?_0x8be3d0[_0x9b0b('0x35')]:_0x136a33[_0x9b0b('0x31')];if(_0x20ec55[_0x9b0b('0x34')][_0x9b0b('0x45')]){_0x8be3d0[_0x9b0b('0x46')]=[{'all':!![]}];}_0x8be3d0=_[_0x9b0b('0x3f')]({},_0x8be3d0,_0x20ec55[_0x9b0b('0x41')]);return db[_0x9b0b('0x2e')]['find'](_0x8be3d0)[_0x9b0b('0x24')](handleEntityNotFound(_0x243063,null))[_0x9b0b('0x24')](respondWithResult(_0x243063,null))['catch'](handleError(_0x243063,null));};exports['create']=function(_0xd9410f,_0x990950){return db[_0x9b0b('0x2e')][_0x9b0b('0x47')](_0xd9410f['body'],{})[_0x9b0b('0x24')](function(_0x348444){var _0x3eeb0c=_0xd9410f[_0x9b0b('0x48')][_0x9b0b('0x26')]({'plain':!![]});if(!_0x3eeb0c)throw new Error(_0x9b0b('0x49'));if(_0x3eeb0c[_0x9b0b('0x4a')]===_0x9b0b('0x48')){var _0x146654=_0x348444['get']({'plain':!![]});var _0x1a6cf8='ChanSpies';return db[_0x9b0b('0x4b')]['find']({'where':{'name':_0x1a6cf8,'userProfileId':_0x3eeb0c['userProfileId']},'raw':!![]})[_0x9b0b('0x24')](function(_0x2238d1){if(_0x2238d1&&_0x2238d1[_0x9b0b('0x4c')]===0x0){return db[_0x9b0b('0x28')][_0x9b0b('0x47')]({'name':_0x146654[_0x9b0b('0x2b')],'resourceId':_0x146654['id'],'type':_0x2238d1[_0x9b0b('0x2b')],'sectionId':_0x2238d1['id']},{})['then'](function(){return _0x348444;});}else{return _0x348444;}})['catch'](function(_0x4bba88){logger[_0x9b0b('0x2a')](_0x9b0b('0x4d'),_0x4bba88);throw _0x4bba88;});}return _0x348444;})[_0x9b0b('0x24')](respondWithResult(_0x990950,0xc9))[_0x9b0b('0x4e')](handleError(_0x990950,null));};exports[_0x9b0b('0x4f')]=function(_0x41331d,_0x5a568e){if(_0x41331d[_0x9b0b('0x50')]['id']){delete _0x41331d[_0x9b0b('0x50')]['id'];}return db['VoiceChanSpy']['find']({'where':{'id':_0x41331d['params']['id']}})[_0x9b0b('0x24')](handleEntityNotFound(_0x5a568e,null))[_0x9b0b('0x24')](saveUpdates(_0x41331d['body'],null))['then'](respondWithResult(_0x5a568e,null))['catch'](handleError(_0x5a568e,null));};exports[_0x9b0b('0x25')]=function(_0x2d8637,_0x23225c){return db[_0x9b0b('0x2e')][_0x9b0b('0x51')]({'where':{'id':_0x2d8637[_0x9b0b('0x52')]['id']}})[_0x9b0b('0x24')](handleEntityNotFound(_0x23225c,null))[_0x9b0b('0x24')](removeEntity(_0x23225c,null))[_0x9b0b('0x4e')](handleError(_0x23225c,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 5fde9d5..a2329d3 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 _0xdeb0=['name','options','join','StopMixMonitor','length','concat','internal','User','findAll','agent','then','catch','exports','define','VoiceChanSpy','voice_chanspy','VoiceExtension','destroy','bulkCreate','./voiceChanSpy.attributes','from-sip','format','prefix','system','push','merge','CDR(type)=%s','record','${UNIQUEID}.%s,a','recordingFormat','Authenticate','ChanSpy'];(function(_0x1c4571,_0x4b569d){var _0x1c0872=function(_0x11fbbb){while(--_0x11fbbb){_0x1c4571['push'](_0x1c4571['shift']());}};_0x1c0872(++_0x4b569d);}(_0xdeb0,0x173));var _0x0deb=function(_0x3ac769,_0x2825df){_0x3ac769=_0x3ac769-0x0;var _0x2185eb=_0xdeb0[_0x3ac769];return _0x2185eb;};'use strict';var _=require('lodash');var util=require('util');var BPromise=require('bluebird');var attributes=require(_0x0deb('0x0'));var getUserApplications=function(_0x29cef4,_0x1f3441,_0x1f05d4){var _0x2763fc=0x1;var _0x4e8dbd=[];var _0x506789={'context':_0x1f3441['context']||_0x0deb('0x1'),'exten':util[_0x0deb('0x2')]('%s%s',_0x29cef4[_0x0deb('0x3')],_0x1f05d4),'type':_0x0deb('0x4'),'isApp':![],'ChanSpyId':_0x29cef4['id'],'UserId':_0x1f3441['id']};_0x4e8dbd[_0x0deb('0x5')](_[_0x0deb('0x6')]({'app':'Set','appdata':util['format'](_0x0deb('0x7'),'chanspy'),'priority':_0x2763fc++},_0x506789));if(_0x29cef4[_0x0deb('0x8')]){_0x4e8dbd[_0x0deb('0x5')](_[_0x0deb('0x6')]({'app':'MixMonitor','appdata':util[_0x0deb('0x2')](_0x0deb('0x9'),_0x29cef4[_0x0deb('0xa')]),'priority':_0x2763fc++},_0x506789));}if(_0x29cef4['auth']){_0x4e8dbd[_0x0deb('0x5')](_['merge']({'app':_0x0deb('0xb'),'appdata':_0x29cef4['password'],'priority':_0x2763fc++},_0x506789));}_0x4e8dbd[_0x0deb('0x5')](_['merge']({'app':_0x0deb('0xc'),'appdata':util['format']('SIP/%s,%s',_0x1f3441[_0x0deb('0xd')],_0x29cef4[_0x0deb('0xe')]?_0x29cef4[_0x0deb('0xe')][_0x0deb('0xf')](''):''),'priority':_0x2763fc++},_0x506789));if(_0x29cef4[_0x0deb('0x8')]){_0x4e8dbd[_0x0deb('0x5')](_[_0x0deb('0x6')]({'app':_0x0deb('0x10'),'priority':_0x2763fc++},_0x506789));}return _0x4e8dbd;};var getChanSpyApplications=function(_0x449cbf,_0xf9e681){var _0x55e7d0=[];for(var _0x45eae0=0x0,_0x2e9d58=0x1;_0x45eae0<_0xf9e681[_0x0deb('0x11')];_0x45eae0++,_0x2e9d58=0x1){_0x55e7d0=_0x55e7d0[_0x0deb('0x12')](getUserApplications(_0x449cbf,_0xf9e681[_0x45eae0],_0xf9e681[_0x45eae0][_0x0deb('0x13')]));if(_0xf9e681[_0x45eae0][_0x0deb('0x13')]!=_0xf9e681[_0x45eae0][_0x0deb('0xd')]){_0x55e7d0=_0x55e7d0[_0x0deb('0x12')](getUserApplications(_0x449cbf,_0xf9e681[_0x45eae0],_0xf9e681[_0x45eae0][_0x0deb('0xd')]));}}return _0x55e7d0;};var getChanSpyPromise=function(_0x1ffa5a,_0x23cff2){return new BPromise(function(_0x2017af,_0x28c820){return _0x1ffa5a[_0x0deb('0x14')][_0x0deb('0x15')]({'attributes':['id',_0x0deb('0xd'),_0x0deb('0x13')],'where':{'role':_0x0deb('0x16'),'chanspy':!![]},'raw':!![]})[_0x0deb('0x17')](function(_0x14c1cf){if(_0x14c1cf){return _0x2017af(getChanSpyApplications(_0x23cff2,_0x14c1cf));}return _0x2017af([]);})[_0x0deb('0x18')](function(_0x5060d0){_0x28c820(_0x5060d0);});});};module[_0x0deb('0x19')]=function(_0x58d230,_0x51dd73){var _0x5ee8ed=_0x58d230['models'];return _0x58d230[_0x0deb('0x1a')](_0x0deb('0x1b'),attributes,{'tableName':_0x0deb('0x1c'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3c744e,_0x4cd497,_0x291cdc){return getChanSpyPromise(_0x5ee8ed,_0x3c744e)[_0x0deb('0x17')](function(_0x1e1718){if(_0x1e1718&&_0x1e1718[_0x0deb('0x11')]){return _0x5ee8ed['VoiceExtension']['bulkCreate'](_0x1e1718);}})[_0x0deb('0x17')](function(){_0x291cdc();})[_0x0deb('0x18')](function(_0x7dbe3a){_0x291cdc(_0x7dbe3a);});},'afterUpdate':function(_0x5dd536,_0x41f69f,_0x47819f){return _0x5ee8ed[_0x0deb('0x1d')][_0x0deb('0x1e')]({'where':{'ChanSpyId':_0x5dd536['id']}})[_0x0deb('0x17')](function(){return getChanSpyPromise(_0x5ee8ed,_0x5dd536);})[_0x0deb('0x17')](function(_0x158b0a){if(_0x158b0a&&_0x158b0a[_0x0deb('0x11')]){return _0x5ee8ed[_0x0deb('0x1d')][_0x0deb('0x1f')](_0x158b0a);}})[_0x0deb('0x17')](function(){_0x47819f();})[_0x0deb('0x18')](function(_0x8958d8){_0x47819f(_0x8958d8);});},'afterDestroy':function(_0x388d37,_0x2d57d2,_0x372fce){return _0x5ee8ed['VoiceExtension'][_0x0deb('0x1e')]({'where':{'ChanSpyId':_0x388d37['id']}})[_0x0deb('0x17')](function(){_0x372fce();})['catch'](function(_0x30b346){_0x372fce(_0x30b346);});}}});}; \ No newline at end of file +var _0x154b=['push','Set','chanspy','record','merge','MixMonitor','format','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','name','options','join','concat','internal','User','findAll','agent','then','catch','exports','models','VoiceChanSpy','voice_chanspy','bulkCreate','VoiceExtension','destroy','length','util','bluebird','./voiceChanSpy.attributes','from-sip','%s%s','prefix','system'];(function(_0x9b81a,_0x53dc63){var _0x2ce9db=function(_0x43dc4c){while(--_0x43dc4c){_0x9b81a['push'](_0x9b81a['shift']());}};_0x2ce9db(++_0x53dc63);}(_0x154b,0x65));var _0xb154=function(_0x235340,_0x4a4ca2){_0x235340=_0x235340-0x0;var _0x38890c=_0x154b[_0x235340];return _0x38890c;};'use strict';var _=require('lodash');var util=require(_0xb154('0x0'));var BPromise=require(_0xb154('0x1'));var attributes=require(_0xb154('0x2'));var getUserApplications=function(_0x11168c,_0x3bf996,_0x292bc0){var _0x29984f=0x1;var _0xbd8a74=[];var _0x4e21a1={'context':_0x3bf996['context']||_0xb154('0x3'),'exten':util['format'](_0xb154('0x4'),_0x11168c[_0xb154('0x5')],_0x292bc0),'type':_0xb154('0x6'),'isApp':![],'ChanSpyId':_0x11168c['id'],'UserId':_0x3bf996['id']};_0xbd8a74[_0xb154('0x7')](_['merge']({'app':_0xb154('0x8'),'appdata':util['format']('CDR(type)=%s',_0xb154('0x9')),'priority':_0x29984f++},_0x4e21a1));if(_0x11168c[_0xb154('0xa')]){_0xbd8a74[_0xb154('0x7')](_[_0xb154('0xb')]({'app':_0xb154('0xc'),'appdata':util[_0xb154('0xd')](_0xb154('0xe'),_0x11168c[_0xb154('0xf')]),'priority':_0x29984f++},_0x4e21a1));}if(_0x11168c[_0xb154('0x10')]){_0xbd8a74[_0xb154('0x7')](_[_0xb154('0xb')]({'app':_0xb154('0x11'),'appdata':_0x11168c['password'],'priority':_0x29984f++},_0x4e21a1));}_0xbd8a74[_0xb154('0x7')](_['merge']({'app':'ChanSpy','appdata':util[_0xb154('0xd')]('SIP/%s,%s',_0x3bf996[_0xb154('0x12')],_0x11168c['options']?_0x11168c[_0xb154('0x13')][_0xb154('0x14')](''):''),'priority':_0x29984f++},_0x4e21a1));if(_0x11168c[_0xb154('0xa')]){_0xbd8a74['push'](_['merge']({'app':'StopMixMonitor','priority':_0x29984f++},_0x4e21a1));}return _0xbd8a74;};var getChanSpyApplications=function(_0x1e3d1a,_0xe910c0){var _0x4638b6=[];for(var _0xa4910e=0x0,_0x5932f5=0x1;_0xa4910e<_0xe910c0['length'];_0xa4910e++,_0x5932f5=0x1){_0x4638b6=_0x4638b6[_0xb154('0x15')](getUserApplications(_0x1e3d1a,_0xe910c0[_0xa4910e],_0xe910c0[_0xa4910e][_0xb154('0x16')]));if(_0xe910c0[_0xa4910e]['internal']!=_0xe910c0[_0xa4910e][_0xb154('0x12')]){_0x4638b6=_0x4638b6[_0xb154('0x15')](getUserApplications(_0x1e3d1a,_0xe910c0[_0xa4910e],_0xe910c0[_0xa4910e]['name']));}}return _0x4638b6;};var getChanSpyPromise=function(_0x624e3,_0x141296){return new BPromise(function(_0x1f6307,_0x3efa75){return _0x624e3[_0xb154('0x17')][_0xb154('0x18')]({'attributes':['id','name',_0xb154('0x16')],'where':{'role':_0xb154('0x19'),'chanspy':!![]},'raw':!![]})[_0xb154('0x1a')](function(_0x57818b){if(_0x57818b){return _0x1f6307(getChanSpyApplications(_0x141296,_0x57818b));}return _0x1f6307([]);})[_0xb154('0x1b')](function(_0x220901){_0x3efa75(_0x220901);});});};module[_0xb154('0x1c')]=function(_0x2c0601,_0x2efcd5){var _0x4abb60=_0x2c0601[_0xb154('0x1d')];return _0x2c0601['define'](_0xb154('0x1e'),attributes,{'tableName':_0xb154('0x1f'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x417087,_0x3acd8f,_0x32c722){return getChanSpyPromise(_0x4abb60,_0x417087)[_0xb154('0x1a')](function(_0x2e1611){if(_0x2e1611&&_0x2e1611['length']){return _0x4abb60['VoiceExtension'][_0xb154('0x20')](_0x2e1611);}})[_0xb154('0x1a')](function(){_0x32c722();})[_0xb154('0x1b')](function(_0x15e07f){_0x32c722(_0x15e07f);});},'afterUpdate':function(_0x299ca4,_0x597e3f,_0x5650d9){return _0x4abb60[_0xb154('0x21')][_0xb154('0x22')]({'where':{'ChanSpyId':_0x299ca4['id']}})[_0xb154('0x1a')](function(){return getChanSpyPromise(_0x4abb60,_0x299ca4);})['then'](function(_0x3e4f0e){if(_0x3e4f0e&&_0x3e4f0e[_0xb154('0x23')]){return _0x4abb60[_0xb154('0x21')][_0xb154('0x20')](_0x3e4f0e);}})[_0xb154('0x1a')](function(){_0x5650d9();})[_0xb154('0x1b')](function(_0x2ed81d){_0x5650d9(_0x2ed81d);});},'afterDestroy':function(_0x5c16e3,_0x2852dc,_0x5ba6d4){return _0x4abb60[_0xb154('0x21')][_0xb154('0x22')]({'where':{'ChanSpyId':_0x5c16e3['id']}})['then'](function(){_0x5ba6d4();})[_0xb154('0x1b')](function(_0x4b3184){_0x5ba6d4(_0x4b3184);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index e854f46..28a14c0 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 _0x4058=['request','then','info','request\x20sent','debug','stringify','VoiceChanSpy,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4058,0x129));var _0x8405=function(_0x50d028,_0x3cbe68){_0x50d028=_0x50d028-0x0;var _0x509721=_0x4058[_0x50d028];return _0x509721;};'use strict';var _=require(_0x8405('0x0'));var util=require(_0x8405('0x1'));var moment=require(_0x8405('0x2'));var BPromise=require(_0x8405('0x3'));var rs=require(_0x8405('0x4'));var fs=require('fs');var Redis=require(_0x8405('0x5'));var db=require(_0x8405('0x6'))['db'];var utils=require(_0x8405('0x7'));var logger=require(_0x8405('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8405('0x9')][_0x8405('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3d9bf6,_0x1322e5,_0x1cb061){return new BPromise(function(_0x479c97,_0x16d810){return client[_0x8405('0xb')](_0x3d9bf6,_0x1cb061)[_0x8405('0xc')](function(_0x53bd7c){logger[_0x8405('0xd')]('VoiceChanSpy,\x20%s,\x20%s',_0x1322e5,_0x8405('0xe'));logger[_0x8405('0xf')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x1322e5,_0x8405('0xe'),JSON[_0x8405('0x10')](_0x53bd7c));if(_0x53bd7c['error']){if(_0x53bd7c['error']['code']===0x1f4){logger['error'](_0x8405('0x11'),_0x1322e5,_0x53bd7c['error']['message']);return _0x16d810(_0x53bd7c['error']['message']);}logger['error'](_0x8405('0x11'),_0x1322e5,_0x53bd7c[_0x8405('0x12')]['message']);return _0x479c97(_0x53bd7c[_0x8405('0x12')][_0x8405('0x13')]);}else{logger[_0x8405('0xd')](_0x8405('0x11'),_0x1322e5,'request\x20sent');_0x479c97(_0x53bd7c[_0x8405('0x14')][_0x8405('0x13')]);}})[_0x8405('0x15')](function(_0x30cef7){logger[_0x8405('0x12')](_0x8405('0x11'),_0x1322e5,_0x30cef7);_0x16d810(_0x30cef7);});});} \ No newline at end of file +var _0x3f8c=['VoiceChanSpy,\x20%s,\x20%s','request\x20sent','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','moment','bluebird','randomstring','ioredis','jayson/promise','client','http','request','then','info'];(function(_0x2fea3f,_0x143c24){var _0xe7b365=function(_0x4fb734){while(--_0x4fb734){_0x2fea3f['push'](_0x2fea3f['shift']());}};_0xe7b365(++_0x143c24);}(_0x3f8c,0x104));var _0xc3f8=function(_0x4d1a41,_0x101334){_0x4d1a41=_0x4d1a41-0x0;var _0x26c9ec=_0x3f8c[_0x4d1a41];return _0x26c9ec;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc3f8('0x0'));var BPromise=require(_0xc3f8('0x1'));var rs=require(_0xc3f8('0x2'));var fs=require('fs');var Redis=require(_0xc3f8('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xc3f8('0x4'));var client=jayson[_0xc3f8('0x5')][_0xc3f8('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x44c25d,_0x2bbaa5,_0x15512a){return new BPromise(function(_0x51093a,_0x28397e){return client[_0xc3f8('0x7')](_0x44c25d,_0x15512a)[_0xc3f8('0x8')](function(_0x3c340c){logger[_0xc3f8('0x9')](_0xc3f8('0xa'),_0x2bbaa5,_0xc3f8('0xb'));logger['debug'](_0xc3f8('0xc'),_0x2bbaa5,_0xc3f8('0xb'),JSON[_0xc3f8('0xd')](_0x3c340c));if(_0x3c340c[_0xc3f8('0xe')]){if(_0x3c340c['error'][_0xc3f8('0xf')]===0x1f4){logger[_0xc3f8('0xe')](_0xc3f8('0xa'),_0x2bbaa5,_0x3c340c[_0xc3f8('0xe')]['message']);return _0x28397e(_0x3c340c[_0xc3f8('0xe')][_0xc3f8('0x10')]);}logger[_0xc3f8('0xe')](_0xc3f8('0xa'),_0x2bbaa5,_0x3c340c[_0xc3f8('0xe')][_0xc3f8('0x10')]);return _0x51093a(_0x3c340c[_0xc3f8('0xe')][_0xc3f8('0x10')]);}else{logger[_0xc3f8('0x9')](_0xc3f8('0xa'),_0x2bbaa5,_0xc3f8('0xb'));_0x51093a(_0x3c340c[_0xc3f8('0x11')][_0xc3f8('0x10')]);}})['catch'](function(_0x14b3ed){logger['error']('VoiceChanSpy,\x20%s,\x20%s',_0x2bbaa5,_0x14b3ed);_0x28397e(_0x14b3ed);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index b81d338..6d78a84 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 _0xd3e3=['index','show','post','create','put','/:id','delete','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated'];(function(_0x10adf7,_0x1f7099){var _0x505ea6=function(_0x12ddc6){while(--_0x12ddc6){_0x10adf7['push'](_0x10adf7['shift']());}};_0x505ea6(++_0x1f7099);}(_0xd3e3,0x1cf));var _0x3d3e=function(_0xa6e9fa,_0x33372a){_0xa6e9fa=_0xa6e9fa-0x0;var _0x44592c=_0xd3e3[_0xa6e9fa];return _0x44592c;};'use strict';var multer=require('multer');var util=require(_0x3d3e('0x0'));var path=require(_0x3d3e('0x1'));var timeout=require(_0x3d3e('0x2'));var express=require(_0x3d3e('0x3'));var router=express[_0x3d3e('0x4')]();var fs_extra=require(_0x3d3e('0x5'));var auth=require(_0x3d3e('0x6'));var interaction=require(_0x3d3e('0x7'));var config=require(_0x3d3e('0x8'));var controller=require(_0x3d3e('0x9'));router[_0x3d3e('0xa')]('/',auth[_0x3d3e('0xb')](),controller[_0x3d3e('0xc')]);router[_0x3d3e('0xa')]('/:id',auth[_0x3d3e('0xb')](),controller[_0x3d3e('0xd')]);router[_0x3d3e('0xe')]('/',auth[_0x3d3e('0xb')](),controller[_0x3d3e('0xf')]);router[_0x3d3e('0x10')](_0x3d3e('0x11'),auth['isAuthenticated'](),controller['update']);router[_0x3d3e('0x12')]('/:id',auth[_0x3d3e('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xe156=['connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','/:id','post','create','delete','destroy','exports','util','path'];(function(_0x4a836d,_0x12820c){var _0x119a58=function(_0x1f61a2){while(--_0x1f61a2){_0x4a836d['push'](_0x4a836d['shift']());}};_0x119a58(++_0x12820c);}(_0xe156,0x8e));var _0x6e15=function(_0x485f35,_0x45a0fc){_0x485f35=_0x485f35-0x0;var _0x2ad118=_0xe156[_0x485f35];return _0x2ad118;};'use strict';var multer=require('multer');var util=require(_0x6e15('0x0'));var path=require(_0x6e15('0x1'));var timeout=require(_0x6e15('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x6e15('0x3'));var interaction=require(_0x6e15('0x4'));var config=require(_0x6e15('0x5'));var controller=require(_0x6e15('0x6'));router[_0x6e15('0x7')]('/',auth[_0x6e15('0x8')](),controller[_0x6e15('0x9')]);router[_0x6e15('0x7')](_0x6e15('0xa'),auth[_0x6e15('0x8')](),controller['show']);router[_0x6e15('0xb')]('/',auth[_0x6e15('0x8')](),controller[_0x6e15('0xc')]);router['put'](_0x6e15('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x6e15('0xd')]('/:id',auth[_0x6e15('0x8')](),controller[_0x6e15('0xe')]);module[_0x6e15('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 7c3e83b..2657feb 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 _0x78c1=['sequelize','exports','BOOLEAN'];(function(_0x412158,_0xce52f1){var _0x1c496b=function(_0x5162ac){while(--_0x5162ac){_0x412158['push'](_0x412158['shift']());}};_0x1c496b(++_0xce52f1);}(_0x78c1,0xd8));var _0x178c=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x78c1[_0x2be8c2];return _0x97f531;};'use strict';var Sequelize=require(_0x178c('0x0'));module[_0x178c('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x178c('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9ebf=['sequelize','exports','STRING','name','BOOLEAN'];(function(_0x13745e,_0x1aed64){var _0x464fe7=function(_0x289280){while(--_0x289280){_0x13745e['push'](_0x13745e['shift']());}};_0x464fe7(++_0x1aed64);}(_0x9ebf,0xf5));var _0xf9eb=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x9ebf[_0x199572];return _0x13cfa3;};'use strict';var Sequelize=require(_0xf9eb('0x0'));module[_0xf9eb('0x1')]={'name':{'type':Sequelize[_0xf9eb('0x2')],'unique':_0xf9eb('0x3')},'description':{'type':Sequelize[_0xf9eb('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xf9eb('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 2235a16..8ddb947 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 _0x10d8=['fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','type','VIRTUAL','includeAll','findAll','rows','show','params','include','options','find','create','body','readFileSync','join','root','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','Contexts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../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','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','UserProfileResource','stack','name','send','index','VoiceContext','fieldName','key','map','query','keys','filters','intersection','model'];(function(_0x5e8207,_0xf26436){var _0x2d249e=function(_0x367533){while(--_0x367533){_0x5e8207['push'](_0x5e8207['shift']());}};_0x2d249e(++_0xf26436);}(_0x10d8,0x16f));var _0x810d=function(_0x2f9248,_0x1733f5){_0x2f9248=_0x2f9248-0x0;var _0x43c447=_0x10d8[_0x2f9248];return _0x43c447;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x810d('0x0'));var zipdir=require(_0x810d('0x1'));var jsonpatch=require(_0x810d('0x2'));var rp=require(_0x810d('0x3'));var moment=require(_0x810d('0x4'));var BPromise=require(_0x810d('0x5'));var Mustache=require(_0x810d('0x6'));var util=require(_0x810d('0x7'));var path=require(_0x810d('0x8'));var sox=require(_0x810d('0x9'));var csv=require('to-csv');var ejs=require(_0x810d('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x810d('0xb'));var squel=require('squel');var crypto=require(_0x810d('0xc'));var jsforce=require(_0x810d('0xd'));var deskjs=require(_0x810d('0xe'));var toCsv=require('to-csv');var querystring=require(_0x810d('0xf'));var Papa=require(_0x810d('0x10'));var Redis=require(_0x810d('0x11'));var authService=require(_0x810d('0x12'));var qs=require(_0x810d('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x810d('0x14'))('api');var utils=require(_0x810d('0x15'));var config=require(_0x810d('0x16'));var licenseUtil=require(_0x810d('0x17'));var db=require(_0x810d('0x18'))['db'];var jayson=require(_0x810d('0x19'));var client=jayson[_0x810d('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x43dfbc,_0x399344,_0x37136a,_0xe68a){return new BPromise(function(_0xd6382f,_0xc1a605){var _0x4407c1=_0xe68a||client;return _0x4407c1[_0x810d('0x1b')](_0x43dfbc,_0x37136a)[_0x810d('0x1c')](function(_0xd25346){logger[_0x810d('0x1d')](_0x810d('0x1e'),_0x399344,_0x810d('0x1f'));logger[_0x810d('0x20')](_0x810d('0x21'),_0x399344,_0x810d('0x1f'),JSON[_0x810d('0x22')](_0xd25346));if(_0xd25346[_0x810d('0x23')]){if(_0xd25346[_0x810d('0x23')][_0x810d('0x24')]===0x1f4){logger[_0x810d('0x23')](_0x810d('0x1e'),_0x399344,_0xd25346[_0x810d('0x23')][_0x810d('0x25')]);return _0xc1a605(_0xd25346[_0x810d('0x23')][_0x810d('0x25')]);}logger[_0x810d('0x23')](_0x810d('0x1e'),_0x399344,_0xd25346['error'][_0x810d('0x25')]);return _0xd6382f(_0xd25346[_0x810d('0x23')]['message']);}else{logger[_0x810d('0x1d')](_0x810d('0x1e'),_0x399344,_0x810d('0x1f'));_0xd6382f(_0xd25346[_0x810d('0x26')][_0x810d('0x25')]);}})[_0x810d('0x27')](function(_0x45f3d6){logger[_0x810d('0x23')](_0x810d('0x1e'),_0x399344,_0x45f3d6);_0xc1a605(_0x45f3d6);});});}function respondWithStatusCode(_0x3d6f45,_0x3b7841){_0x3b7841=_0x3b7841||0xcc;return function(_0x463bd0){if(_0x463bd0){return _0x3d6f45[_0x810d('0x28')](_0x3b7841);}return _0x3d6f45[_0x810d('0x29')](_0x3b7841)[_0x810d('0x2a')]();};}function respondWithResult(_0x476dd8,_0x2ba470){_0x2ba470=_0x2ba470||0xc8;return function(_0xaab0a){if(_0xaab0a){return _0x476dd8[_0x810d('0x29')](_0x2ba470)[_0x810d('0x2b')](_0xaab0a);}};}function respondWithFilteredResult(_0x3d5113,_0x3d623f){return function(_0xc751c0){if(_0xc751c0){var _0x4b5148=typeof _0x3d623f[_0x810d('0x2c')]===_0x810d('0x2d')&&typeof _0x3d623f[_0x810d('0x2e')]===_0x810d('0x2d');var _0x3c9127=_0xc751c0[_0x810d('0x2f')];var _0xa69fa2=_0x4b5148?0x0:_0x3d623f[_0x810d('0x2c')];var _0x8cf860=_0x4b5148?_0xc751c0[_0x810d('0x2f')]:_0x3d623f[_0x810d('0x2c')]+_0x3d623f['limit'];var _0x2453aa;if(_0x8cf860>=_0x3c9127){_0x8cf860=_0x3c9127;_0x2453aa=0xc8;}else{_0x2453aa=0xce;}_0x3d5113[_0x810d('0x29')](_0x2453aa);return _0x3d5113[_0x810d('0x30')](_0x810d('0x31'),_0xa69fa2+'-'+_0x8cf860+'/'+_0x3c9127)['json'](_0xc751c0);}return null;};}function patchUpdates(_0xc7dff9){return function(_0x31a7e4){try{jsonpatch[_0x810d('0x32')](_0x31a7e4,_0xc7dff9,!![]);}catch(_0x3493b5){return BPromise[_0x810d('0x33')](_0x3493b5);}return _0x31a7e4[_0x810d('0x34')]();};}function saveUpdates(_0x3a3a08,_0x49d4be){return function(_0x557300){if(_0x557300){return _0x557300[_0x810d('0x35')](_0x3a3a08)[_0x810d('0x1c')](function(_0x158f95){return _0x158f95;});}return null;};}function removeEntity(_0x339fd9,_0x4b8f8e){return function(_0x111d3d){if(_0x111d3d){return _0x111d3d[_0x810d('0x36')]()['then'](function(){var _0x31a199=_0x111d3d['get']({'plain':!![]});var _0x14414b='Contexts';return db[_0x810d('0x37')][_0x810d('0x36')]({'where':{'type':_0x14414b,'resourceId':_0x31a199['id']}})[_0x810d('0x1c')](function(){return _0x111d3d;});})[_0x810d('0x1c')](function(){_0x339fd9[_0x810d('0x29')](0xcc)[_0x810d('0x2a')]();});}};}function handleEntityNotFound(_0x3c3bc6,_0x26fde7){return function(_0xd8b281){if(!_0xd8b281){_0x3c3bc6['sendStatus'](0x194);}return _0xd8b281;};}function handleError(_0x27738b,_0x35c41c){_0x35c41c=_0x35c41c||0x1f4;return function(_0x23e3c9){logger[_0x810d('0x23')](_0x23e3c9[_0x810d('0x38')]);if(_0x23e3c9[_0x810d('0x39')]){delete _0x23e3c9[_0x810d('0x39')];}_0x27738b[_0x810d('0x29')](_0x35c41c)[_0x810d('0x3a')](_0x23e3c9);};}exports[_0x810d('0x3b')]=function(_0x59f525,_0x1a657e){var _0x38f7d4={},_0x15d2ed={},_0x293ca5={'count':0x0,'rows':[]};var _0x566311=_['map'](db[_0x810d('0x3c')]['rawAttributes'],function(_0x3b0a46){return{'name':_0x3b0a46[_0x810d('0x3d')],'type':_0x3b0a46['type'][_0x810d('0x3e')]};});_0x15d2ed['model']=_[_0x810d('0x3f')](_0x566311,_0x810d('0x39'));_0x15d2ed[_0x810d('0x40')]=_[_0x810d('0x41')](_0x59f525[_0x810d('0x40')]);_0x15d2ed[_0x810d('0x42')]=_[_0x810d('0x43')](_0x15d2ed[_0x810d('0x44')],_0x15d2ed['query']);_0x38f7d4['attributes']=_[_0x810d('0x43')](_0x15d2ed[_0x810d('0x44')],qs['fields'](_0x59f525['query'][_0x810d('0x45')]));_0x38f7d4[_0x810d('0x46')]=_0x38f7d4[_0x810d('0x46')][_0x810d('0x47')]?_0x38f7d4[_0x810d('0x46')]:_0x15d2ed['model'];if(!_0x59f525[_0x810d('0x40')][_0x810d('0x48')](_0x810d('0x49'))){_0x38f7d4[_0x810d('0x2e')]=qs['limit'](_0x59f525['query'][_0x810d('0x2e')]);_0x38f7d4[_0x810d('0x2c')]=qs[_0x810d('0x2c')](_0x59f525['query'][_0x810d('0x2c')]);}_0x38f7d4['order']=qs[_0x810d('0x4a')](_0x59f525[_0x810d('0x40')][_0x810d('0x4a')]);_0x38f7d4[_0x810d('0x4b')]=qs['filters'](_['pick'](_0x59f525[_0x810d('0x40')],_0x15d2ed['filters']),_0x566311);if(_0x59f525[_0x810d('0x40')][_0x810d('0x4c')]){_0x38f7d4[_0x810d('0x4b')]=_[_0x810d('0x4d')](_0x38f7d4[_0x810d('0x4b')],{'$or':_[_0x810d('0x3f')](_0x566311,function(_0x55d3a8){if(_0x55d3a8[_0x810d('0x4e')]!==_0x810d('0x4f')){var _0x20fedf={};_0x20fedf[_0x55d3a8[_0x810d('0x39')]]={'$like':'%'+_0x59f525[_0x810d('0x40')][_0x810d('0x4c')]+'%'};return _0x20fedf;}})});}_0x38f7d4=_['merge']({},_0x38f7d4,_0x59f525['options']);var _0x3ab1e0={'where':_0x38f7d4['where']};return db[_0x810d('0x3c')][_0x810d('0x2f')](_0x3ab1e0)[_0x810d('0x1c')](function(_0x3cb1bb){_0x293ca5['count']=_0x3cb1bb;if(_0x59f525[_0x810d('0x40')][_0x810d('0x50')]){_0x38f7d4['include']=[{'all':!![]}];}return db['VoiceContext'][_0x810d('0x51')](_0x38f7d4);})[_0x810d('0x1c')](function(_0x53cbc2){_0x293ca5[_0x810d('0x52')]=_0x53cbc2;return _0x293ca5;})[_0x810d('0x1c')](respondWithFilteredResult(_0x1a657e,_0x38f7d4))[_0x810d('0x27')](handleError(_0x1a657e,null));};exports[_0x810d('0x53')]=function(_0x50342c,_0x51594a){var _0xd368eb={'raw':![],'where':{'id':_0x50342c[_0x810d('0x54')]['id']}},_0x57aa09={};_0x57aa09[_0x810d('0x44')]=_[_0x810d('0x41')](db[_0x810d('0x3c')]['rawAttributes']);_0x57aa09[_0x810d('0x40')]=_[_0x810d('0x41')](_0x50342c[_0x810d('0x40')]);_0x57aa09[_0x810d('0x42')]=_[_0x810d('0x43')](_0x57aa09[_0x810d('0x44')],_0x57aa09['query']);_0xd368eb[_0x810d('0x46')]=_[_0x810d('0x43')](_0x57aa09['model'],qs[_0x810d('0x45')](_0x50342c[_0x810d('0x40')][_0x810d('0x45')]));_0xd368eb['attributes']=_0xd368eb[_0x810d('0x46')]['length']?_0xd368eb[_0x810d('0x46')]:_0x57aa09[_0x810d('0x44')];if(_0x50342c[_0x810d('0x40')][_0x810d('0x50')]){_0xd368eb[_0x810d('0x55')]=[{'all':!![]}];}_0xd368eb=_[_0x810d('0x4d')]({},_0xd368eb,_0x50342c[_0x810d('0x56')]);return db[_0x810d('0x3c')][_0x810d('0x57')](_0xd368eb)['then'](handleEntityNotFound(_0x51594a,null))['then'](respondWithResult(_0x51594a,null))['catch'](handleError(_0x51594a,null));};exports[_0x810d('0x58')]=function(_0x396f2c,_0x4ce32f,_0x481c4a){var _0x8d7244;return db['VoiceContext']['create'](_0x396f2c[_0x810d('0x59')],{'raw':!![]})[_0x810d('0x1c')](function(_0x226d62){_0x8d7244=_0x226d62;return db[_0x810d('0x3c')][_0x810d('0x51')]({'raw':!![]});})[_0x810d('0x1c')](function(_0x42f8d9){var _0x39370e=fs[_0x810d('0x5a')](path[_0x810d('0x5b')](config[_0x810d('0x5c')],_0x810d('0x5d')),_0x810d('0x5e'));var _0x2f18a5=ejs[_0x810d('0x5f')](_0x39370e,{'contexts':_0x42f8d9||[]});fs[_0x810d('0x60')](_0x810d('0x61'),_0x2f18a5);})[_0x810d('0x1c')](function(){return respondWithRpcPromise(_0x810d('0x62'),_0x810d('0x58'),{'module':_0x810d('0x63')});})[_0x810d('0x1c')](function(){var _0x53280c=_0x396f2c[_0x810d('0x64')]['get']({'plain':!![]});if(!_0x53280c)throw new Error(_0x810d('0x65'));if(_0x53280c[_0x810d('0x66')]===_0x810d('0x64')){var _0xb69b4c=_0x8d7244[_0x810d('0x67')]({'plain':!![]});return db[_0x810d('0x68')][_0x810d('0x57')]({'where':{'name':_0x810d('0x69'),'userProfileId':_0x53280c[_0x810d('0x6a')]},'raw':!![]})['then'](function(_0x34d8a4){if(_0x34d8a4&&_0x34d8a4[_0x810d('0x6b')]===0x0){return db[_0x810d('0x37')]['create']({'name':_0xb69b4c['name'],'resourceId':_0xb69b4c['id'],'type':_0x34d8a4[_0x810d('0x39')],'sectionId':_0x34d8a4['id']},{})[_0x810d('0x1c')](function(){return _0x8d7244;});}else{return _0x8d7244;}})[_0x810d('0x27')](function(_0x560883){logger[_0x810d('0x23')](_0x810d('0x6c'),_0x560883);throw _0x560883;});}return _0x8d7244;})[_0x810d('0x1c')](respondWithResult(_0x4ce32f,0xc9))['catch'](handleError(_0x4ce32f,null));};exports[_0x810d('0x35')]=function(_0x1e78c6,_0x7a1553,_0x328c0b){var _0x55598a;return db[_0x810d('0x3c')][_0x810d('0x57')]({'where':{'id':_0x1e78c6[_0x810d('0x54')]['id']}})[_0x810d('0x1c')](handleEntityNotFound(_0x7a1553,null))[_0x810d('0x1c')](saveUpdates(_0x1e78c6[_0x810d('0x59')],null))[_0x810d('0x1c')](function(_0x1f667a){if(_0x1f667a){_0x55598a=_0x1f667a;return db[_0x810d('0x3c')][_0x810d('0x51')]({'raw':!![]});}})[_0x810d('0x1c')](function(_0x4e99df){var _0x40cff7=fs[_0x810d('0x5a')](path[_0x810d('0x5b')](config[_0x810d('0x5c')],_0x810d('0x5d')),_0x810d('0x5e'));var _0x33f3db=ejs[_0x810d('0x5f')](_0x40cff7,{'contexts':_0x4e99df||[]});fs[_0x810d('0x60')](_0x810d('0x61'),_0x33f3db);})[_0x810d('0x1c')](function(){return respondWithRpcPromise(_0x810d('0x62'),_0x810d('0x35'),{'module':_0x810d('0x63')});})['then'](function(){return _0x55598a;})['then'](respondWithResult(_0x7a1553,null))[_0x810d('0x27')](handleError(_0x7a1553,null));};exports[_0x810d('0x36')]=function(_0x84354a,_0x5bdf18,_0x22122c){var _0x1d2646;return db[_0x810d('0x3c')][_0x810d('0x57')]({'where':{'id':_0x84354a['params']['id']}})[_0x810d('0x1c')](handleEntityNotFound(_0x5bdf18,null))[_0x810d('0x1c')](removeEntity(_0x5bdf18,null))['then'](function(){return db[_0x810d('0x3c')][_0x810d('0x51')]({'raw':!![]});})[_0x810d('0x1c')](function(_0x55ed20){var _0x436174=fs[_0x810d('0x5a')](path[_0x810d('0x5b')](config[_0x810d('0x5c')],'server/files/templates/context.ejs'),_0x810d('0x5e'));var _0x4c358f=ejs[_0x810d('0x5f')](_0x436174,{'contexts':_0x55ed20});fs['writeFileSync'](_0x810d('0x61'),_0x4c358f);return respondWithRpcPromise(_0x810d('0x62'),_0x810d('0x36'),{'module':'chan_sip.so'});})[_0x810d('0x27')](handleError(_0x5bdf18,null));}; \ No newline at end of file +var _0x59ce=['user','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','root','readFileSync','join','server/files/templates/context.ejs','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','jayson/promise','client','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','error','message','catch','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','update','destroy','get','Contexts','UserProfileResource','name','send','index','map','VoiceContext','rawAttributes','fieldName','model','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','type','VIRTUAL','filter','merge','includeAll','include','rows','show','params','keys','create','body','findAll','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so'];(function(_0x37cc52,_0x459a9b){var _0x2b4a90=function(_0xabcfc7){while(--_0xabcfc7){_0x37cc52['push'](_0x37cc52['shift']());}};_0x2b4a90(++_0x459a9b);}(_0x59ce,0x66));var _0xe59c=function(_0x1916fa,_0x309985){_0x1916fa=_0x1916fa-0x0;var _0x11a332=_0x59ce[_0x1916fa];return _0x11a332;};'use strict';var emlformat=require(_0xe59c('0x0'));var rimraf=require(_0xe59c('0x1'));var zipdir=require(_0xe59c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe59c('0x3'));var BPromise=require(_0xe59c('0x4'));var Mustache=require(_0xe59c('0x5'));var util=require(_0xe59c('0x6'));var path=require(_0xe59c('0x7'));var sox=require(_0xe59c('0x8'));var csv=require(_0xe59c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe59c('0xa'));var squel=require(_0xe59c('0xb'));var crypto=require(_0xe59c('0xc'));var jsforce=require(_0xe59c('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe59c('0x9'));var querystring=require(_0xe59c('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe59c('0xf'));var as=require(_0xe59c('0x10'));var hardwareService=require(_0xe59c('0x11'));var logger=require('../../config/logger')(_0xe59c('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe59c('0x13'));var db=require(_0xe59c('0x14'))['db'];var jayson=require(_0xe59c('0x15'));var client=jayson[_0xe59c('0x16')]['http']({'port':0x232a});function respondWithRpcPromise(_0x14293a,_0x1649ae,_0x3e3a13,_0x8d38b4){return new BPromise(function(_0xbf79b3,_0x320aae){var _0x6425f8=_0x8d38b4||client;return _0x6425f8['request'](_0x14293a,_0x3e3a13)[_0xe59c('0x17')](function(_0x5049db){logger[_0xe59c('0x18')](_0xe59c('0x19'),_0x1649ae,_0xe59c('0x1a'));logger[_0xe59c('0x1b')](_0xe59c('0x1c'),_0x1649ae,_0xe59c('0x1a'),JSON['stringify'](_0x5049db));if(_0x5049db[_0xe59c('0x1d')]){if(_0x5049db[_0xe59c('0x1d')]['code']===0x1f4){logger[_0xe59c('0x1d')](_0xe59c('0x19'),_0x1649ae,_0x5049db[_0xe59c('0x1d')]['message']);return _0x320aae(_0x5049db[_0xe59c('0x1d')][_0xe59c('0x1e')]);}logger['error'](_0xe59c('0x19'),_0x1649ae,_0x5049db[_0xe59c('0x1d')][_0xe59c('0x1e')]);return _0xbf79b3(_0x5049db[_0xe59c('0x1d')]['message']);}else{logger[_0xe59c('0x18')]('VoiceContext,\x20%s,\x20%s',_0x1649ae,_0xe59c('0x1a'));_0xbf79b3(_0x5049db['result'][_0xe59c('0x1e')]);}})[_0xe59c('0x1f')](function(_0x339ac1){logger[_0xe59c('0x1d')](_0xe59c('0x19'),_0x1649ae,_0x339ac1);_0x320aae(_0x339ac1);});});}function respondWithStatusCode(_0x4c348f,_0x1110c9){_0x1110c9=_0x1110c9||0xcc;return function(_0x226272){if(_0x226272){return _0x4c348f[_0xe59c('0x20')](_0x1110c9);}return _0x4c348f[_0xe59c('0x21')](_0x1110c9)['end']();};}function respondWithResult(_0x5548c8,_0x5affef){_0x5affef=_0x5affef||0xc8;return function(_0x3e079a){if(_0x3e079a){return _0x5548c8[_0xe59c('0x21')](_0x5affef)[_0xe59c('0x22')](_0x3e079a);}};}function respondWithFilteredResult(_0x159d73,_0x550792){return function(_0x5ac882){if(_0x5ac882){var _0x31304a=typeof _0x550792[_0xe59c('0x23')]===_0xe59c('0x24')&&typeof _0x550792[_0xe59c('0x25')]===_0xe59c('0x24');var _0x3813d0=_0x5ac882[_0xe59c('0x26')];var _0x557a39=_0x31304a?0x0:_0x550792[_0xe59c('0x23')];var _0x2b3d50=_0x31304a?_0x5ac882[_0xe59c('0x26')]:_0x550792[_0xe59c('0x23')]+_0x550792[_0xe59c('0x25')];var _0x1047f9;if(_0x2b3d50>=_0x3813d0){_0x2b3d50=_0x3813d0;_0x1047f9=0xc8;}else{_0x1047f9=0xce;}_0x159d73['status'](_0x1047f9);return _0x159d73[_0xe59c('0x27')]('Content-Range',_0x557a39+'-'+_0x2b3d50+'/'+_0x3813d0)[_0xe59c('0x22')](_0x5ac882);}return null;};}function patchUpdates(_0x1798f8){return function(_0x24a860){try{jsonpatch[_0xe59c('0x28')](_0x24a860,_0x1798f8,!![]);}catch(_0x52779a){return BPromise[_0xe59c('0x29')](_0x52779a);}return _0x24a860['save']();};}function saveUpdates(_0x3494c3,_0x49c186){return function(_0x240b65){if(_0x240b65){return _0x240b65[_0xe59c('0x2a')](_0x3494c3)[_0xe59c('0x17')](function(_0x1aaecf){return _0x1aaecf;});}return null;};}function removeEntity(_0x2c182f,_0x591cd9){return function(_0xc6dbf4){if(_0xc6dbf4){return _0xc6dbf4[_0xe59c('0x2b')]()[_0xe59c('0x17')](function(){var _0x4200fe=_0xc6dbf4[_0xe59c('0x2c')]({'plain':!![]});var _0x1d1b56=_0xe59c('0x2d');return db[_0xe59c('0x2e')]['destroy']({'where':{'type':_0x1d1b56,'resourceId':_0x4200fe['id']}})[_0xe59c('0x17')](function(){return _0xc6dbf4;});})[_0xe59c('0x17')](function(){_0x2c182f[_0xe59c('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x13830a,_0x555f08){return function(_0x218371){if(!_0x218371){_0x13830a[_0xe59c('0x20')](0x194);}return _0x218371;};}function handleError(_0xa78a63,_0x14b191){_0x14b191=_0x14b191||0x1f4;return function(_0x120b92){logger[_0xe59c('0x1d')](_0x120b92['stack']);if(_0x120b92['name']){delete _0x120b92[_0xe59c('0x2f')];}_0xa78a63[_0xe59c('0x21')](_0x14b191)[_0xe59c('0x30')](_0x120b92);};}exports[_0xe59c('0x31')]=function(_0xaaf74f,_0x4e6e44){var _0x1cd099={},_0x3acc92={},_0x169a44={'count':0x0,'rows':[]};var _0x5613bd=_[_0xe59c('0x32')](db[_0xe59c('0x33')][_0xe59c('0x34')],function(_0x42d4cc){return{'name':_0x42d4cc[_0xe59c('0x35')],'type':_0x42d4cc['type']['key']};});_0x3acc92[_0xe59c('0x36')]=_[_0xe59c('0x32')](_0x5613bd,_0xe59c('0x2f'));_0x3acc92[_0xe59c('0x37')]=_['keys'](_0xaaf74f[_0xe59c('0x37')]);_0x3acc92[_0xe59c('0x38')]=_[_0xe59c('0x39')](_0x3acc92['model'],_0x3acc92['query']);_0x1cd099['attributes']=_['intersection'](_0x3acc92[_0xe59c('0x36')],qs[_0xe59c('0x3a')](_0xaaf74f[_0xe59c('0x37')][_0xe59c('0x3a')]));_0x1cd099[_0xe59c('0x3b')]=_0x1cd099[_0xe59c('0x3b')]['length']?_0x1cd099[_0xe59c('0x3b')]:_0x3acc92[_0xe59c('0x36')];if(!_0xaaf74f[_0xe59c('0x37')][_0xe59c('0x3c')]('nolimit')){_0x1cd099[_0xe59c('0x25')]=qs[_0xe59c('0x25')](_0xaaf74f[_0xe59c('0x37')]['limit']);_0x1cd099['offset']=qs[_0xe59c('0x23')](_0xaaf74f['query'][_0xe59c('0x23')]);}_0x1cd099[_0xe59c('0x3d')]=qs['sort'](_0xaaf74f[_0xe59c('0x37')][_0xe59c('0x3e')]);_0x1cd099[_0xe59c('0x3f')]=qs['filters'](_[_0xe59c('0x40')](_0xaaf74f[_0xe59c('0x37')],_0x3acc92['filters']),_0x5613bd);if(_0xaaf74f[_0xe59c('0x37')]['filter']){_0x1cd099[_0xe59c('0x3f')]=_['merge'](_0x1cd099['where'],{'$or':_[_0xe59c('0x32')](_0x5613bd,function(_0x3a39fa){if(_0x3a39fa[_0xe59c('0x41')]!==_0xe59c('0x42')){var _0x180a83={};_0x180a83[_0x3a39fa[_0xe59c('0x2f')]]={'$like':'%'+_0xaaf74f['query'][_0xe59c('0x43')]+'%'};return _0x180a83;}})});}_0x1cd099=_[_0xe59c('0x44')]({},_0x1cd099,_0xaaf74f['options']);var _0x21b048={'where':_0x1cd099[_0xe59c('0x3f')]};return db[_0xe59c('0x33')][_0xe59c('0x26')](_0x21b048)[_0xe59c('0x17')](function(_0xc0a73a){_0x169a44[_0xe59c('0x26')]=_0xc0a73a;if(_0xaaf74f[_0xe59c('0x37')][_0xe59c('0x45')]){_0x1cd099[_0xe59c('0x46')]=[{'all':!![]}];}return db[_0xe59c('0x33')]['findAll'](_0x1cd099);})['then'](function(_0x1838d5){_0x169a44[_0xe59c('0x47')]=_0x1838d5;return _0x169a44;})[_0xe59c('0x17')](respondWithFilteredResult(_0x4e6e44,_0x1cd099))[_0xe59c('0x1f')](handleError(_0x4e6e44,null));};exports[_0xe59c('0x48')]=function(_0x973bfa,_0x479c71){var _0x4c4929={'raw':![],'where':{'id':_0x973bfa[_0xe59c('0x49')]['id']}},_0x4040a1={};_0x4040a1[_0xe59c('0x36')]=_[_0xe59c('0x4a')](db['VoiceContext'][_0xe59c('0x34')]);_0x4040a1[_0xe59c('0x37')]=_['keys'](_0x973bfa[_0xe59c('0x37')]);_0x4040a1[_0xe59c('0x38')]=_[_0xe59c('0x39')](_0x4040a1[_0xe59c('0x36')],_0x4040a1['query']);_0x4c4929[_0xe59c('0x3b')]=_[_0xe59c('0x39')](_0x4040a1[_0xe59c('0x36')],qs[_0xe59c('0x3a')](_0x973bfa[_0xe59c('0x37')]['fields']));_0x4c4929[_0xe59c('0x3b')]=_0x4c4929['attributes']['length']?_0x4c4929[_0xe59c('0x3b')]:_0x4040a1[_0xe59c('0x36')];if(_0x973bfa['query'][_0xe59c('0x45')]){_0x4c4929[_0xe59c('0x46')]=[{'all':!![]}];}_0x4c4929=_[_0xe59c('0x44')]({},_0x4c4929,_0x973bfa['options']);return db[_0xe59c('0x33')]['find'](_0x4c4929)[_0xe59c('0x17')](handleEntityNotFound(_0x479c71,null))[_0xe59c('0x17')](respondWithResult(_0x479c71,null))[_0xe59c('0x1f')](handleError(_0x479c71,null));};exports[_0xe59c('0x4b')]=function(_0x2a5833,_0x45dc4d,_0x542718){var _0x18bb33;return db[_0xe59c('0x33')][_0xe59c('0x4b')](_0x2a5833[_0xe59c('0x4c')],{'raw':!![]})[_0xe59c('0x17')](function(_0x1f4384){_0x18bb33=_0x1f4384;return db['VoiceContext'][_0xe59c('0x4d')]({'raw':!![]});})['then'](function(_0xdad982){var _0x1f85cb=fs['readFileSync'](path['join'](config['root'],'server/files/templates/context.ejs'),_0xe59c('0x4e'));var _0x49479b=ejs[_0xe59c('0x4f')](_0x1f85cb,{'contexts':_0xdad982||[]});fs[_0xe59c('0x50')](_0xe59c('0x51'),_0x49479b);})[_0xe59c('0x17')](function(){return respondWithRpcPromise(_0xe59c('0x52'),_0xe59c('0x4b'),{'module':_0xe59c('0x53')});})['then'](function(){var _0x35e188=_0x2a5833[_0xe59c('0x54')][_0xe59c('0x2c')]({'plain':!![]});if(!_0x35e188)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x35e188['role']===_0xe59c('0x54')){var _0x7682aa=_0x18bb33[_0xe59c('0x2c')]({'plain':!![]});return db[_0xe59c('0x55')][_0xe59c('0x56')]({'where':{'name':_0xe59c('0x2d'),'userProfileId':_0x35e188['userProfileId']},'raw':!![]})[_0xe59c('0x17')](function(_0x5418f0){if(_0x5418f0&&_0x5418f0[_0xe59c('0x57')]===0x0){return db[_0xe59c('0x2e')]['create']({'name':_0x7682aa[_0xe59c('0x2f')],'resourceId':_0x7682aa['id'],'type':_0x5418f0[_0xe59c('0x2f')],'sectionId':_0x5418f0['id']},{})[_0xe59c('0x17')](function(){return _0x18bb33;});}else{return _0x18bb33;}})[_0xe59c('0x1f')](function(_0x5a9046){logger['error'](_0xe59c('0x58'),_0x5a9046);throw _0x5a9046;});}return _0x18bb33;})[_0xe59c('0x17')](respondWithResult(_0x45dc4d,0xc9))[_0xe59c('0x1f')](handleError(_0x45dc4d,null));};exports['update']=function(_0x48ef39,_0x2018e5,_0x4d7cc3){var _0x3ca13c;return db[_0xe59c('0x33')]['find']({'where':{'id':_0x48ef39[_0xe59c('0x49')]['id']}})[_0xe59c('0x17')](handleEntityNotFound(_0x2018e5,null))['then'](saveUpdates(_0x48ef39[_0xe59c('0x4c')],null))[_0xe59c('0x17')](function(_0x1f5011){if(_0x1f5011){_0x3ca13c=_0x1f5011;return db[_0xe59c('0x33')][_0xe59c('0x4d')]({'raw':!![]});}})['then'](function(_0x5e2437){var _0x3d4090=fs['readFileSync'](path['join'](config[_0xe59c('0x59')],'server/files/templates/context.ejs'),'utf8');var _0x3c6a59=ejs['render'](_0x3d4090,{'contexts':_0x5e2437||[]});fs[_0xe59c('0x50')](_0xe59c('0x51'),_0x3c6a59);})[_0xe59c('0x17')](function(){return respondWithRpcPromise(_0xe59c('0x52'),_0xe59c('0x2a'),{'module':_0xe59c('0x53')});})[_0xe59c('0x17')](function(){return _0x3ca13c;})['then'](respondWithResult(_0x2018e5,null))[_0xe59c('0x1f')](handleError(_0x2018e5,null));};exports[_0xe59c('0x2b')]=function(_0x591f88,_0x3e694a,_0x5db5dc){var _0x563b52;return db[_0xe59c('0x33')][_0xe59c('0x56')]({'where':{'id':_0x591f88[_0xe59c('0x49')]['id']}})[_0xe59c('0x17')](handleEntityNotFound(_0x3e694a,null))[_0xe59c('0x17')](removeEntity(_0x3e694a,null))['then'](function(){return db[_0xe59c('0x33')]['findAll']({'raw':!![]});})[_0xe59c('0x17')](function(_0x2af96e){var _0x98f266=fs[_0xe59c('0x5a')](path[_0xe59c('0x5b')](config[_0xe59c('0x59')],_0xe59c('0x5c')),_0xe59c('0x4e'));var _0x438d07=ejs['render'](_0x98f266,{'contexts':_0x2af96e});fs[_0xe59c('0x50')](_0xe59c('0x51'),_0x438d07);return respondWithRpcPromise(_0xe59c('0x52'),_0xe59c('0x2b'),{'module':_0xe59c('0x53')});})[_0xe59c('0x1f')](handleError(_0x3e694a,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 1c346e0..25bc51c 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 _0xa713=['rimraf','./voiceContext.attributes','exports','VoiceContext','voice_contexts','lodash','api','request-promise'];(function(_0xd578cb,_0x2167a3){var _0x775533=function(_0x1c340d){while(--_0x1c340d){_0xd578cb['push'](_0xd578cb['shift']());}};_0x775533(++_0x2167a3);}(_0xa713,0x7d));var _0x3a71=function(_0x3a5d04,_0x59ff36){_0x3a5d04=_0x3a5d04-0x0;var _0x3fb6a9=_0xa713[_0x3a5d04];return _0x3fb6a9;};'use strict';var _=require(_0x3a71('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3a71('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3a71('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3a71('0x3'));var config=require('../../config/environment');var attributes=require(_0x3a71('0x4'));module[_0x3a71('0x5')]=function(_0x49b8ee,_0x27de9a){return _0x49b8ee['define'](_0x3a71('0x6'),attributes,{'tableName':_0x3a71('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd2ad=['exports','define','VoiceContext','voice_contexts','lodash','api','path','rimraf','../../config/environment','./voiceContext.attributes'];(function(_0x4fa344,_0x2a8b35){var _0x496cd6=function(_0x332eec){while(--_0x332eec){_0x4fa344['push'](_0x4fa344['shift']());}};_0x496cd6(++_0x2a8b35);}(_0xd2ad,0x9a));var _0xdd2a=function(_0x22431e,_0x5af0a3){_0x22431e=_0x22431e-0x0;var _0xd978e9=_0xd2ad[_0x22431e];return _0xd978e9;};'use strict';var _=require(_0xdd2a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xdd2a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xdd2a('0x2'));var rimraf=require(_0xdd2a('0x3'));var config=require(_0xdd2a('0x4'));var attributes=require(_0xdd2a('0x5'));module[_0xdd2a('0x6')]=function(_0x1a94bd,_0x26c2fa){return _0x1a94bd[_0xdd2a('0x7')](_0xdd2a('0x8'),attributes,{'tableName':_0xdd2a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index 1121bbf..acd0132 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 _0xf793=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','randomstring','ioredis','../../mysqldb'];(function(_0x328111,_0x1c3a1c){var _0x3f676c=function(_0x583ebc){while(--_0x583ebc){_0x328111['push'](_0x328111['shift']());}};_0x3f676c(++_0x1c3a1c);}(_0xf793,0x1ac));var _0x3f79=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xf793[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var util=require(_0x3f79('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3f79('0x1'));var fs=require('fs');var Redis=require(_0x3f79('0x2'));var db=require(_0x3f79('0x3'))['db'];var utils=require(_0x3f79('0x4'));var logger=require(_0x3f79('0x5'))(_0x3f79('0x6'));var config=require(_0x3f79('0x7'));var jayson=require(_0x3f79('0x8'));var client=jayson[_0x3f79('0x9')][_0x3f79('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x571a80,_0x562431,_0x5c52a5){return new BPromise(function(_0x5f4ddc,_0x5d64d8){return client[_0x3f79('0xb')](_0x571a80,_0x5c52a5)[_0x3f79('0xc')](function(_0x1bbf9f){logger[_0x3f79('0xd')](_0x3f79('0xe'),_0x562431,_0x3f79('0xf'));logger[_0x3f79('0x10')](_0x3f79('0x11'),_0x562431,_0x3f79('0xf'),JSON[_0x3f79('0x12')](_0x1bbf9f));if(_0x1bbf9f[_0x3f79('0x13')]){if(_0x1bbf9f['error'][_0x3f79('0x14')]===0x1f4){logger['error'](_0x3f79('0xe'),_0x562431,_0x1bbf9f[_0x3f79('0x13')][_0x3f79('0x15')]);return _0x5d64d8(_0x1bbf9f[_0x3f79('0x13')][_0x3f79('0x15')]);}logger[_0x3f79('0x13')](_0x3f79('0xe'),_0x562431,_0x1bbf9f['error'][_0x3f79('0x15')]);return _0x5f4ddc(_0x1bbf9f[_0x3f79('0x13')]['message']);}else{logger['info'](_0x3f79('0xe'),_0x562431,'request\x20sent');_0x5f4ddc(_0x1bbf9f[_0x3f79('0x16')][_0x3f79('0x15')]);}})[_0x3f79('0x17')](function(_0x496537){logger[_0x3f79('0x13')]('VoiceContext,\x20%s,\x20%s',_0x562431,_0x496537);_0x5d64d8(_0x496537);});});} \ No newline at end of file +var _0xebe6=['../../config/logger','rpc','client','http','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x371f2c,_0x34e326){var _0x2089db=function(_0x5e540f){while(--_0x5e540f){_0x371f2c['push'](_0x371f2c['shift']());}};_0x2089db(++_0x34e326);}(_0xebe6,0x13a));var _0x6ebe=function(_0xbafd5f,_0x27cabb){_0xbafd5f=_0xbafd5f-0x0;var _0x148fad=_0xebe6[_0xbafd5f];return _0x148fad;};'use strict';var _=require(_0x6ebe('0x0'));var util=require(_0x6ebe('0x1'));var moment=require(_0x6ebe('0x2'));var BPromise=require(_0x6ebe('0x3'));var rs=require(_0x6ebe('0x4'));var fs=require('fs');var Redis=require(_0x6ebe('0x5'));var db=require(_0x6ebe('0x6'))['db'];var utils=require(_0x6ebe('0x7'));var logger=require(_0x6ebe('0x8'))(_0x6ebe('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6ebe('0xa')][_0x6ebe('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1226b9,_0x19b9dc,_0x3f0cdd){return new BPromise(function(_0x4f8750,_0x3cd02f){return client['request'](_0x1226b9,_0x3f0cdd)[_0x6ebe('0xc')](function(_0x1b19d5){logger[_0x6ebe('0xd')](_0x6ebe('0xe'),_0x19b9dc,_0x6ebe('0xf'));logger[_0x6ebe('0x10')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x19b9dc,_0x6ebe('0xf'),JSON[_0x6ebe('0x11')](_0x1b19d5));if(_0x1b19d5[_0x6ebe('0x12')]){if(_0x1b19d5[_0x6ebe('0x12')][_0x6ebe('0x13')]===0x1f4){logger[_0x6ebe('0x12')](_0x6ebe('0xe'),_0x19b9dc,_0x1b19d5[_0x6ebe('0x12')]['message']);return _0x3cd02f(_0x1b19d5[_0x6ebe('0x12')]['message']);}logger[_0x6ebe('0x12')](_0x6ebe('0xe'),_0x19b9dc,_0x1b19d5['error'][_0x6ebe('0x14')]);return _0x4f8750(_0x1b19d5[_0x6ebe('0x12')][_0x6ebe('0x14')]);}else{logger[_0x6ebe('0xd')](_0x6ebe('0xe'),_0x19b9dc,_0x6ebe('0xf'));_0x4f8750(_0x1b19d5[_0x6ebe('0x15')][_0x6ebe('0x14')]);}})[_0x6ebe('0x16')](function(_0x53ffa7){logger['error'](_0x6ebe('0xe'),_0x19b9dc,_0x53ffa7);_0x3cd02f(_0x53ffa7);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index d60c80c..3dfb8dd 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 _0xbb7f=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','update','delete','destroy','multer','util','connect-timeout','express'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xbb7f,0xe3));var _0xfbb7=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xbb7f[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0xfbb7('0x0'));var util=require(_0xfbb7('0x1'));var path=require('path');var timeout=require(_0xfbb7('0x2'));var express=require(_0xfbb7('0x3'));var router=express[_0xfbb7('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xfbb7('0x5'));var interaction=require(_0xfbb7('0x6'));var config=require(_0xfbb7('0x7'));var controller=require(_0xfbb7('0x8'));router['get']('/',auth[_0xfbb7('0x9')](),controller[_0xfbb7('0xa')]);router[_0xfbb7('0xb')](_0xfbb7('0xc'),auth[_0xfbb7('0x9')](),controller[_0xfbb7('0xd')]);router['get'](_0xfbb7('0xe'),auth[_0xfbb7('0x9')](),controller[_0xfbb7('0xf')]);router[_0xfbb7('0x10')]('/',auth[_0xfbb7('0x9')](),controller[_0xfbb7('0x11')]);router['put'](_0xfbb7('0xe'),auth[_0xfbb7('0x9')](),controller[_0xfbb7('0x12')]);router[_0xfbb7('0x13')](_0xfbb7('0xe'),auth['isAuthenticated'](),controller[_0xfbb7('0x14')]);module['exports']=router; \ No newline at end of file +var _0xca27=['/:id','update','destroy','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','isAuthenticated','index','get','describe','post','create'];(function(_0x2384bb,_0x12f81b){var _0x3f2bac=function(_0x337ece){while(--_0x337ece){_0x2384bb['push'](_0x2384bb['shift']());}};_0x3f2bac(++_0x12f81b);}(_0xca27,0xbe));var _0x7ca2=function(_0x26cb9b,_0x1eb4da){_0x26cb9b=_0x26cb9b-0x0;var _0x2f94b5=_0xca27[_0x26cb9b];return _0x2f94b5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7ca2('0x0'));var timeout=require(_0x7ca2('0x1'));var express=require(_0x7ca2('0x2'));var router=express[_0x7ca2('0x3')]();var fs_extra=require(_0x7ca2('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x7ca2('0x5'));var config=require(_0x7ca2('0x6'));var controller=require(_0x7ca2('0x7'));router['get']('/',auth[_0x7ca2('0x8')](),controller[_0x7ca2('0x9')]);router[_0x7ca2('0xa')]('/describe',auth[_0x7ca2('0x8')](),controller[_0x7ca2('0xb')]);router[_0x7ca2('0xa')]('/:id',auth[_0x7ca2('0x8')](),controller['show']);router[_0x7ca2('0xc')]('/',auth[_0x7ca2('0x8')](),controller[_0x7ca2('0xd')]);router['put'](_0x7ca2('0xe'),auth[_0x7ca2('0x8')](),controller[_0x7ca2('0xf')]);router['delete'](_0x7ca2('0xe'),auth[_0x7ca2('0x8')](),controller[_0x7ca2('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index bf57a26..3f54b72 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 _0x84ab=['INTEGER','DATE','called,connect,complete','sequelize','exports','STRING'];(function(_0x2503aa,_0x4ea0db){var _0x44f5e2=function(_0x49ca0d){while(--_0x49ca0d){_0x2503aa['push'](_0x2503aa['shift']());}};_0x44f5e2(++_0x4ea0db);}(_0x84ab,0x12f));var _0xb84a=function(_0x363b81,_0x81e6ca){_0x363b81=_0x363b81-0x0;var _0x1d92fb=_0x84ab[_0x363b81];return _0x1d92fb;};'use strict';var Sequelize=require(_0xb84a('0x0'));module[_0xb84a('0x1')]={'privilege':{'type':Sequelize[_0xb84a('0x2')]},'channel':{'type':Sequelize[_0xb84a('0x2')]},'channelstate':{'type':Sequelize[_0xb84a('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xb84a('0x2')]},'calleridname':{'type':Sequelize[_0xb84a('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xb84a('0x2')]},'language':{'type':Sequelize[_0xb84a('0x2')]},'accountcode':{'type':Sequelize[_0xb84a('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0xb84a('0x2')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xb84a('0x2')]},'destchannelstate':{'type':Sequelize[_0xb84a('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xb84a('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xb84a('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xb84a('0x2')]},'destlanguage':{'type':Sequelize[_0xb84a('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xb84a('0x3')]},'destuniqueid':{'type':Sequelize[_0xb84a('0x2')]},'destlinkedid':{'type':Sequelize[_0xb84a('0x2')]},'dialstring':{'type':Sequelize[_0xb84a('0x2')]},'dialstatus':{'type':Sequelize[_0xb84a('0x2')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xb84a('0x4')]},'endtime':{'type':Sequelize[_0xb84a('0x4')]},'lastevent':{'type':Sequelize[_0xb84a('0x2')],'comment':_0xb84a('0x5')},'routeId':{'type':Sequelize[_0xb84a('0x3')]},'duration':{'type':Sequelize[_0xb84a('0x3')]},'holdtime':{'type':Sequelize[_0xb84a('0x3')]},'billableseconds':{'type':Sequelize[_0xb84a('0x3')]}}; \ No newline at end of file +var _0x9c44=['STRING','INTEGER','DATE','called,connect,complete'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9c44,0x178));var _0x49c4=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x9c44[_0x17b6e3];return _0x3906f3;};'use strict';var Sequelize=require('sequelize');module['exports']={'privilege':{'type':Sequelize[_0x49c4('0x0')]},'channel':{'type':Sequelize[_0x49c4('0x0')]},'channelstate':{'type':Sequelize[_0x49c4('0x1')]},'channelstatedesc':{'type':Sequelize[_0x49c4('0x0')]},'calleridnum':{'type':Sequelize[_0x49c4('0x0')]},'calleridname':{'type':Sequelize[_0x49c4('0x0')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x49c4('0x0')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x49c4('0x0')]},'exten':{'type':Sequelize[_0x49c4('0x0')]},'priority':{'type':Sequelize[_0x49c4('0x1')]},'uniqueid':{'type':Sequelize[_0x49c4('0x0')]},'linkedid':{'type':Sequelize[_0x49c4('0x0')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x49c4('0x1')]},'destchannelstatedesc':{'type':Sequelize[_0x49c4('0x0')]},'destcalleridnum':{'type':Sequelize[_0x49c4('0x0')]},'destcalleridname':{'type':Sequelize[_0x49c4('0x0')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x49c4('0x0')]},'destaccountcode':{'type':Sequelize[_0x49c4('0x0')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x49c4('0x0')]},'destpriority':{'type':Sequelize[_0x49c4('0x1')]},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize[_0x49c4('0x0')]},'dialstatus':{'type':Sequelize[_0x49c4('0x0')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x49c4('0x2')]},'endtime':{'type':Sequelize[_0x49c4('0x2')]},'lastevent':{'type':Sequelize['STRING'],'comment':_0x49c4('0x3')},'routeId':{'type':Sequelize[_0x49c4('0x1')]},'duration':{'type':Sequelize[_0x49c4('0x1')]},'holdtime':{'type':Sequelize[_0x49c4('0x1')]},'billableseconds':{'type':Sequelize[_0x49c4('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index d1fec24..18af434 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 _0xf603=['send','index','map','VoiceDialReport','rawAttributes','type','key','query','keys','filters','intersection','attributes','model','fields','length','nolimit','order','sort','where','VIRTUAL','merge','options','includeAll','findAll','rows','show','include','find','catch','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','undefined','count','offset','limit','status','Content-Range','apply','save','update','then','destroy','error','stack','name'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0xf603,0x102));var _0x3f60=function(_0x28b351,_0xa7072d){_0x28b351=_0x28b351-0x0;var _0x1265df=_0xf603[_0x28b351];return _0x1265df;};'use strict';var emlformat=require(_0x3f60('0x0'));var rimraf=require(_0x3f60('0x1'));var zipdir=require(_0x3f60('0x2'));var jsonpatch=require(_0x3f60('0x3'));var rp=require(_0x3f60('0x4'));var moment=require('moment');var BPromise=require(_0x3f60('0x5'));var Mustache=require(_0x3f60('0x6'));var util=require('util');var path=require(_0x3f60('0x7'));var sox=require(_0x3f60('0x8'));var csv=require(_0x3f60('0x9'));var ejs=require(_0x3f60('0xa'));var fs=require('fs');var fs_extra=require(_0x3f60('0xb'));var _=require('lodash');var squel=require(_0x3f60('0xc'));var crypto=require('crypto');var jsforce=require(_0x3f60('0xd'));var deskjs=require(_0x3f60('0xe'));var toCsv=require(_0x3f60('0x9'));var querystring=require('querystring');var Papa=require(_0x3f60('0xf'));var Redis=require(_0x3f60('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x3f60('0x11'));var as=require(_0x3f60('0x12'));var hardwareService=require(_0x3f60('0x13'));var logger=require(_0x3f60('0x14'))(_0x3f60('0x15'));var utils=require(_0x3f60('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x3f60('0x17'));var db=require(_0x3f60('0x18'))['db'];function respondWithStatusCode(_0x3ce9a5,_0x44c201){_0x44c201=_0x44c201||0xcc;return function(_0x3a1efb){if(_0x3a1efb){return _0x3ce9a5[_0x3f60('0x19')](_0x44c201);}return _0x3ce9a5['status'](_0x44c201)[_0x3f60('0x1a')]();};}function respondWithResult(_0xff8613,_0x55e1b0){_0x55e1b0=_0x55e1b0||0xc8;return function(_0x4d847e){if(_0x4d847e){return _0xff8613['status'](_0x55e1b0)[_0x3f60('0x1b')](_0x4d847e);}};}function respondWithFilteredResult(_0x420623,_0x4809b5){return function(_0x5066e5){if(_0x5066e5){var _0x25c221=typeof _0x4809b5['offset']===_0x3f60('0x1c')&&typeof _0x4809b5['limit']==='undefined';var _0x5af9e1=_0x5066e5[_0x3f60('0x1d')];var _0x4a857e=_0x25c221?0x0:_0x4809b5[_0x3f60('0x1e')];var _0x151e32=_0x25c221?_0x5066e5[_0x3f60('0x1d')]:_0x4809b5[_0x3f60('0x1e')]+_0x4809b5[_0x3f60('0x1f')];var _0x248887;if(_0x151e32>=_0x5af9e1){_0x151e32=_0x5af9e1;_0x248887=0xc8;}else{_0x248887=0xce;}_0x420623[_0x3f60('0x20')](_0x248887);return _0x420623['set'](_0x3f60('0x21'),_0x4a857e+'-'+_0x151e32+'/'+_0x5af9e1)[_0x3f60('0x1b')](_0x5066e5);}return null;};}function patchUpdates(_0x11605e){return function(_0x3a292d){try{jsonpatch[_0x3f60('0x22')](_0x3a292d,_0x11605e,!![]);}catch(_0x58d4f6){return BPromise['reject'](_0x58d4f6);}return _0x3a292d[_0x3f60('0x23')]();};}function saveUpdates(_0x150abd,_0x5a9ef1){return function(_0x12f0cd){if(_0x12f0cd){return _0x12f0cd[_0x3f60('0x24')](_0x150abd)[_0x3f60('0x25')](function(_0x43da86){return _0x43da86;});}return null;};}function removeEntity(_0x2b2802,_0x15cde7){return function(_0x15cd87){if(_0x15cd87){return _0x15cd87[_0x3f60('0x26')]()['then'](function(){_0x2b2802[_0x3f60('0x20')](0xcc)[_0x3f60('0x1a')]();});}};}function handleEntityNotFound(_0x2dcf54,_0x39f214){return function(_0x4cb8f2){if(!_0x4cb8f2){_0x2dcf54[_0x3f60('0x19')](0x194);}return _0x4cb8f2;};}function handleError(_0x555fc6,_0x283273){_0x283273=_0x283273||0x1f4;return function(_0x49bb5d){logger[_0x3f60('0x27')](_0x49bb5d[_0x3f60('0x28')]);if(_0x49bb5d[_0x3f60('0x29')]){delete _0x49bb5d['name'];}_0x555fc6['status'](_0x283273)[_0x3f60('0x2a')](_0x49bb5d);};}exports[_0x3f60('0x2b')]=function(_0x439aab,_0x7e0c80){var _0xa17710={},_0x22dca4={},_0x256ec8={'count':0x0,'rows':[]};var _0x4a6129=_[_0x3f60('0x2c')](db[_0x3f60('0x2d')][_0x3f60('0x2e')],function(_0x4759f2){return{'name':_0x4759f2['fieldName'],'type':_0x4759f2[_0x3f60('0x2f')][_0x3f60('0x30')]};});_0x22dca4['model']=_[_0x3f60('0x2c')](_0x4a6129,_0x3f60('0x29'));_0x22dca4[_0x3f60('0x31')]=_[_0x3f60('0x32')](_0x439aab[_0x3f60('0x31')]);_0x22dca4[_0x3f60('0x33')]=_[_0x3f60('0x34')](_0x22dca4['model'],_0x22dca4[_0x3f60('0x31')]);_0xa17710[_0x3f60('0x35')]=_[_0x3f60('0x34')](_0x22dca4[_0x3f60('0x36')],qs[_0x3f60('0x37')](_0x439aab[_0x3f60('0x31')][_0x3f60('0x37')]));_0xa17710['attributes']=_0xa17710['attributes'][_0x3f60('0x38')]?_0xa17710[_0x3f60('0x35')]:_0x22dca4[_0x3f60('0x36')];if(!_0x439aab[_0x3f60('0x31')]['hasOwnProperty'](_0x3f60('0x39'))){_0xa17710[_0x3f60('0x1f')]=qs[_0x3f60('0x1f')](_0x439aab[_0x3f60('0x31')]['limit']);_0xa17710[_0x3f60('0x1e')]=qs['offset'](_0x439aab[_0x3f60('0x31')][_0x3f60('0x1e')]);}_0xa17710[_0x3f60('0x3a')]=qs[_0x3f60('0x3b')](_0x439aab['query'][_0x3f60('0x3b')]);_0xa17710[_0x3f60('0x3c')]=qs[_0x3f60('0x33')](_['pick'](_0x439aab[_0x3f60('0x31')],_0x22dca4[_0x3f60('0x33')]),_0x4a6129);if(_0x439aab['query']['filter']){_0xa17710[_0x3f60('0x3c')]=_['merge'](_0xa17710[_0x3f60('0x3c')],{'$or':_['map'](_0x4a6129,function(_0x47d2cb){if(_0x47d2cb[_0x3f60('0x2f')]!==_0x3f60('0x3d')){var _0x4dab08={};_0x4dab08[_0x47d2cb[_0x3f60('0x29')]]={'$like':'%'+_0x439aab[_0x3f60('0x31')]['filter']+'%'};return _0x4dab08;}})});}_0xa17710=_[_0x3f60('0x3e')]({},_0xa17710,_0x439aab[_0x3f60('0x3f')]);var _0x1876f2={'where':_0xa17710['where']};return db[_0x3f60('0x2d')]['count'](_0x1876f2)[_0x3f60('0x25')](function(_0x30fa5c){_0x256ec8[_0x3f60('0x1d')]=_0x30fa5c;if(_0x439aab[_0x3f60('0x31')][_0x3f60('0x40')]){_0xa17710['include']=[{'all':!![]}];}return db[_0x3f60('0x2d')][_0x3f60('0x41')](_0xa17710);})[_0x3f60('0x25')](function(_0x2c3dfe){_0x256ec8[_0x3f60('0x42')]=_0x2c3dfe;return _0x256ec8;})['then'](respondWithFilteredResult(_0x7e0c80,_0xa17710))['catch'](handleError(_0x7e0c80,null));};exports[_0x3f60('0x43')]=function(_0x36fb8d,_0x58da50){var _0x3e15e1={'raw':!![],'where':{'id':_0x36fb8d['params']['id']}},_0x293849={};_0x293849['model']=_[_0x3f60('0x32')](db[_0x3f60('0x2d')][_0x3f60('0x2e')]);_0x293849[_0x3f60('0x31')]=_[_0x3f60('0x32')](_0x36fb8d[_0x3f60('0x31')]);_0x293849[_0x3f60('0x33')]=_['intersection'](_0x293849['model'],_0x293849[_0x3f60('0x31')]);_0x3e15e1['attributes']=_[_0x3f60('0x34')](_0x293849[_0x3f60('0x36')],qs['fields'](_0x36fb8d[_0x3f60('0x31')][_0x3f60('0x37')]));_0x3e15e1[_0x3f60('0x35')]=_0x3e15e1[_0x3f60('0x35')][_0x3f60('0x38')]?_0x3e15e1[_0x3f60('0x35')]:_0x293849[_0x3f60('0x36')];if(_0x36fb8d[_0x3f60('0x31')][_0x3f60('0x40')]){_0x3e15e1[_0x3f60('0x44')]=[{'all':!![]}];}_0x3e15e1=_['merge']({},_0x3e15e1,_0x36fb8d['options']);return db['VoiceDialReport'][_0x3f60('0x45')](_0x3e15e1)['then'](handleEntityNotFound(_0x58da50,null))[_0x3f60('0x25')](respondWithResult(_0x58da50,null))[_0x3f60('0x46')](handleError(_0x58da50,null));};exports['create']=function(_0x35e182,_0x2b6984){return db[_0x3f60('0x2d')][_0x3f60('0x47')](_0x35e182[_0x3f60('0x48')],{})[_0x3f60('0x25')](respondWithResult(_0x2b6984,0xc9))[_0x3f60('0x46')](handleError(_0x2b6984,null));};exports['update']=function(_0x389f5a,_0x77ec62){if(_0x389f5a[_0x3f60('0x48')]['id']){delete _0x389f5a[_0x3f60('0x48')]['id'];}return db[_0x3f60('0x2d')]['find']({'where':{'id':_0x389f5a[_0x3f60('0x49')]['id']}})['then'](handleEntityNotFound(_0x77ec62,null))[_0x3f60('0x25')](saveUpdates(_0x389f5a[_0x3f60('0x48')],null))['then'](respondWithResult(_0x77ec62,null))[_0x3f60('0x46')](handleError(_0x77ec62,null));};exports['destroy']=function(_0x193167,_0x5b80ce){return db[_0x3f60('0x2d')][_0x3f60('0x45')]({'where':{'id':_0x193167[_0x3f60('0x49')]['id']}})[_0x3f60('0x25')](handleEntityNotFound(_0x5b80ce,null))[_0x3f60('0x25')](removeEntity(_0x5b80ce,null))['catch'](handleError(_0x5b80ce,null));};exports[_0x3f60('0x4a')]=function(_0x43b2e3,_0x5d9916){return db['VoiceDialReport']['describe']()[_0x3f60('0x25')](respondWithResult(_0x5d9916,null))[_0x3f60('0x46')](handleError(_0x5d9916,null));}; \ No newline at end of file +var _0x5373=['eml-format','rimraf','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','update','destroy','error','stack','name','send','index','map','VoiceDialReport','rawAttributes','type','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','then','includeAll','include','findAll','rows','catch','params','options','create','body','find'];(function(_0x2f998b,_0x3e6b95){var _0x40e949=function(_0x1facf3){while(--_0x1facf3){_0x2f998b['push'](_0x2f998b['shift']());}};_0x40e949(++_0x3e6b95);}(_0x5373,0xe1));var _0x3537=function(_0x45eb57,_0x30b8a2){_0x45eb57=_0x45eb57-0x0;var _0x32fdb=_0x5373[_0x45eb57];return _0x32fdb;};'use strict';var emlformat=require(_0x3537('0x0'));var rimraf=require(_0x3537('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3537('0x2'));var moment=require(_0x3537('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3537('0x4'));var util=require(_0x3537('0x5'));var path=require('path');var sox=require(_0x3537('0x6'));var csv=require(_0x3537('0x7'));var ejs=require(_0x3537('0x8'));var fs=require('fs');var fs_extra=require(_0x3537('0x9'));var _=require(_0x3537('0xa'));var squel=require(_0x3537('0xb'));var crypto=require('crypto');var jsforce=require(_0x3537('0xc'));var deskjs=require(_0x3537('0xd'));var toCsv=require(_0x3537('0x7'));var querystring=require(_0x3537('0xe'));var Papa=require(_0x3537('0xf'));var Redis=require(_0x3537('0x10'));var authService=require(_0x3537('0x11'));var qs=require(_0x3537('0x12'));var as=require(_0x3537('0x13'));var hardwareService=require(_0x3537('0x14'));var logger=require(_0x3537('0x15'))(_0x3537('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3537('0x17'));var db=require(_0x3537('0x18'))['db'];function respondWithStatusCode(_0x345438,_0x56c8d7){_0x56c8d7=_0x56c8d7||0xcc;return function(_0x243cf9){if(_0x243cf9){return _0x345438[_0x3537('0x19')](_0x56c8d7);}return _0x345438['status'](_0x56c8d7)[_0x3537('0x1a')]();};}function respondWithResult(_0x5214eb,_0x2518dc){_0x2518dc=_0x2518dc||0xc8;return function(_0x27528e){if(_0x27528e){return _0x5214eb['status'](_0x2518dc)[_0x3537('0x1b')](_0x27528e);}};}function respondWithFilteredResult(_0x2e5a45,_0x48791e){return function(_0x1fa062){if(_0x1fa062){var _0xedce46=typeof _0x48791e[_0x3537('0x1c')]===_0x3537('0x1d')&&typeof _0x48791e[_0x3537('0x1e')]===_0x3537('0x1d');var _0x2e83c3=_0x1fa062['count'];var _0x551a76=_0xedce46?0x0:_0x48791e[_0x3537('0x1c')];var _0x149dab=_0xedce46?_0x1fa062[_0x3537('0x1f')]:_0x48791e[_0x3537('0x1c')]+_0x48791e['limit'];var _0x59bbf1;if(_0x149dab>=_0x2e83c3){_0x149dab=_0x2e83c3;_0x59bbf1=0xc8;}else{_0x59bbf1=0xce;}_0x2e5a45[_0x3537('0x20')](_0x59bbf1);return _0x2e5a45[_0x3537('0x21')](_0x3537('0x22'),_0x551a76+'-'+_0x149dab+'/'+_0x2e83c3)[_0x3537('0x1b')](_0x1fa062);}return null;};}function patchUpdates(_0xc4627b){return function(_0x102cbc){try{jsonpatch[_0x3537('0x23')](_0x102cbc,_0xc4627b,!![]);}catch(_0x151330){return BPromise['reject'](_0x151330);}return _0x102cbc['save']();};}function saveUpdates(_0x1f38f0,_0x27f07b){return function(_0xb45214){if(_0xb45214){return _0xb45214[_0x3537('0x24')](_0x1f38f0)['then'](function(_0xf42639){return _0xf42639;});}return null;};}function removeEntity(_0xa04c77,_0x13512e){return function(_0x453cac){if(_0x453cac){return _0x453cac[_0x3537('0x25')]()['then'](function(){_0xa04c77[_0x3537('0x20')](0xcc)[_0x3537('0x1a')]();});}};}function handleEntityNotFound(_0x13ca43,_0x1d873c){return function(_0x446b33){if(!_0x446b33){_0x13ca43['sendStatus'](0x194);}return _0x446b33;};}function handleError(_0x4d83b8,_0x596f4c){_0x596f4c=_0x596f4c||0x1f4;return function(_0x5a79f5){logger[_0x3537('0x26')](_0x5a79f5[_0x3537('0x27')]);if(_0x5a79f5[_0x3537('0x28')]){delete _0x5a79f5[_0x3537('0x28')];}_0x4d83b8[_0x3537('0x20')](_0x596f4c)[_0x3537('0x29')](_0x5a79f5);};}exports[_0x3537('0x2a')]=function(_0x34ade2,_0x408655){var _0x589d6e={},_0x46a141={},_0x5dac6e={'count':0x0,'rows':[]};var _0x2a2979=_[_0x3537('0x2b')](db[_0x3537('0x2c')][_0x3537('0x2d')],function(_0x26e986){return{'name':_0x26e986['fieldName'],'type':_0x26e986[_0x3537('0x2e')]['key']};});_0x46a141[_0x3537('0x2f')]=_[_0x3537('0x2b')](_0x2a2979,_0x3537('0x28'));_0x46a141[_0x3537('0x30')]=_[_0x3537('0x31')](_0x34ade2[_0x3537('0x30')]);_0x46a141['filters']=_['intersection'](_0x46a141[_0x3537('0x2f')],_0x46a141['query']);_0x589d6e[_0x3537('0x32')]=_[_0x3537('0x33')](_0x46a141[_0x3537('0x2f')],qs[_0x3537('0x34')](_0x34ade2[_0x3537('0x30')][_0x3537('0x34')]));_0x589d6e[_0x3537('0x32')]=_0x589d6e[_0x3537('0x32')][_0x3537('0x35')]?_0x589d6e['attributes']:_0x46a141[_0x3537('0x2f')];if(!_0x34ade2[_0x3537('0x30')][_0x3537('0x36')](_0x3537('0x37'))){_0x589d6e[_0x3537('0x1e')]=qs[_0x3537('0x1e')](_0x34ade2[_0x3537('0x30')][_0x3537('0x1e')]);_0x589d6e[_0x3537('0x1c')]=qs[_0x3537('0x1c')](_0x34ade2[_0x3537('0x30')][_0x3537('0x1c')]);}_0x589d6e[_0x3537('0x38')]=qs[_0x3537('0x39')](_0x34ade2[_0x3537('0x30')][_0x3537('0x39')]);_0x589d6e[_0x3537('0x3a')]=qs['filters'](_[_0x3537('0x3b')](_0x34ade2[_0x3537('0x30')],_0x46a141[_0x3537('0x3c')]),_0x2a2979);if(_0x34ade2['query'][_0x3537('0x3d')]){_0x589d6e[_0x3537('0x3a')]=_[_0x3537('0x3e')](_0x589d6e[_0x3537('0x3a')],{'$or':_[_0x3537('0x2b')](_0x2a2979,function(_0x26ec83){if(_0x26ec83[_0x3537('0x2e')]!==_0x3537('0x3f')){var _0x4556a9={};_0x4556a9[_0x26ec83[_0x3537('0x28')]]={'$like':'%'+_0x34ade2[_0x3537('0x30')][_0x3537('0x3d')]+'%'};return _0x4556a9;}})});}_0x589d6e=_['merge']({},_0x589d6e,_0x34ade2['options']);var _0xe3faed={'where':_0x589d6e[_0x3537('0x3a')]};return db[_0x3537('0x2c')]['count'](_0xe3faed)[_0x3537('0x40')](function(_0x3f388b){_0x5dac6e['count']=_0x3f388b;if(_0x34ade2[_0x3537('0x30')][_0x3537('0x41')]){_0x589d6e[_0x3537('0x42')]=[{'all':!![]}];}return db['VoiceDialReport'][_0x3537('0x43')](_0x589d6e);})['then'](function(_0x5eb7e7){_0x5dac6e[_0x3537('0x44')]=_0x5eb7e7;return _0x5dac6e;})[_0x3537('0x40')](respondWithFilteredResult(_0x408655,_0x589d6e))[_0x3537('0x45')](handleError(_0x408655,null));};exports['show']=function(_0x17cdae,_0x480e08){var _0x4b0305={'raw':!![],'where':{'id':_0x17cdae[_0x3537('0x46')]['id']}},_0x42d92a={};_0x42d92a[_0x3537('0x2f')]=_[_0x3537('0x31')](db[_0x3537('0x2c')][_0x3537('0x2d')]);_0x42d92a['query']=_[_0x3537('0x31')](_0x17cdae[_0x3537('0x30')]);_0x42d92a[_0x3537('0x3c')]=_[_0x3537('0x33')](_0x42d92a[_0x3537('0x2f')],_0x42d92a[_0x3537('0x30')]);_0x4b0305['attributes']=_['intersection'](_0x42d92a[_0x3537('0x2f')],qs['fields'](_0x17cdae['query'][_0x3537('0x34')]));_0x4b0305[_0x3537('0x32')]=_0x4b0305[_0x3537('0x32')][_0x3537('0x35')]?_0x4b0305[_0x3537('0x32')]:_0x42d92a[_0x3537('0x2f')];if(_0x17cdae[_0x3537('0x30')][_0x3537('0x41')]){_0x4b0305[_0x3537('0x42')]=[{'all':!![]}];}_0x4b0305=_[_0x3537('0x3e')]({},_0x4b0305,_0x17cdae[_0x3537('0x47')]);return db[_0x3537('0x2c')]['find'](_0x4b0305)['then'](handleEntityNotFound(_0x480e08,null))['then'](respondWithResult(_0x480e08,null))['catch'](handleError(_0x480e08,null));};exports[_0x3537('0x48')]=function(_0x158a5d,_0x39a994){return db[_0x3537('0x2c')][_0x3537('0x48')](_0x158a5d[_0x3537('0x49')],{})[_0x3537('0x40')](respondWithResult(_0x39a994,0xc9))['catch'](handleError(_0x39a994,null));};exports[_0x3537('0x24')]=function(_0x3d9119,_0x47648e){if(_0x3d9119['body']['id']){delete _0x3d9119[_0x3537('0x49')]['id'];}return db[_0x3537('0x2c')][_0x3537('0x4a')]({'where':{'id':_0x3d9119[_0x3537('0x46')]['id']}})[_0x3537('0x40')](handleEntityNotFound(_0x47648e,null))['then'](saveUpdates(_0x3d9119[_0x3537('0x49')],null))['then'](respondWithResult(_0x47648e,null))[_0x3537('0x45')](handleError(_0x47648e,null));};exports[_0x3537('0x25')]=function(_0x73c66f,_0x1f2ccf){return db[_0x3537('0x2c')][_0x3537('0x4a')]({'where':{'id':_0x73c66f[_0x3537('0x46')]['id']}})['then'](handleEntityNotFound(_0x1f2ccf,null))[_0x3537('0x40')](removeEntity(_0x1f2ccf,null))['catch'](handleError(_0x1f2ccf,null));};exports['describe']=function(_0x358cbc,_0xbb3a98){return db[_0x3537('0x2c')]['describe']()[_0x3537('0x40')](respondWithResult(_0xbb3a98,null))[_0x3537('0x45')](handleError(_0xbb3a98,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index a46e1bd..d42054c 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 _0x2ea5=['../../config/environment','./voiceDialReport.attributes','VoiceDialReport','report_dial','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0x2ea5,0x1c1));var _0x52ea=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x2ea5[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x52ea('0x0'));var util=require(_0x52ea('0x1'));var logger=require(_0x52ea('0x2'))('api');var moment=require(_0x52ea('0x3'));var BPromise=require(_0x52ea('0x4'));var rp=require(_0x52ea('0x5'));var fs=require('fs');var path=require(_0x52ea('0x6'));var rimraf=require('rimraf');var config=require(_0x52ea('0x7'));var attributes=require(_0x52ea('0x8'));module['exports']=function(_0x112be7,_0x1f0f1f){return _0x112be7['define'](_0x52ea('0x9'),attributes,{'tableName':_0x52ea('0xa'),'paranoid':![],'indexes':[{'fields':[_0x52ea('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2fa9=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','VoiceDialReport','report_dial','uniqueid','lodash'];(function(_0x174ef5,_0x256e8e){var _0x1cc379=function(_0x3eafcf){while(--_0x3eafcf){_0x174ef5['push'](_0x174ef5['shift']());}};_0x1cc379(++_0x256e8e);}(_0x2fa9,0x144));var _0x92fa=function(_0x588011,_0x5e9d11){_0x588011=_0x588011-0x0;var _0x3b3773=_0x2fa9[_0x588011];return _0x3b3773;};'use strict';var _=require(_0x92fa('0x0'));var util=require(_0x92fa('0x1'));var logger=require(_0x92fa('0x2'))(_0x92fa('0x3'));var moment=require(_0x92fa('0x4'));var BPromise=require(_0x92fa('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x92fa('0x6'));var rimraf=require(_0x92fa('0x7'));var config=require(_0x92fa('0x8'));var attributes=require('./voiceDialReport.attributes');module[_0x92fa('0x9')]=function(_0x3fa3cc,_0x1a9f28){return _0x3fa3cc['define'](_0x92fa('0xa'),attributes,{'tableName':_0x92fa('0xb'),'paranoid':![],'indexes':[{'fields':[_0x92fa('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index ad62193..f2c2f97 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 _0x4618=['then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceDialReport','create','options','VoiceDialReport','update','raw','where','limit','UpdateVoiceDialReport','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x282484,_0x4ba766){var _0x316008=function(_0x4f7553){while(--_0x4f7553){_0x282484['push'](_0x282484['shift']());}};_0x316008(++_0x4ba766);}(_0x4618,0x95));var _0x8461=function(_0x3c8e9a,_0x384306){_0x3c8e9a=_0x3c8e9a-0x0;var _0x2d4c57=_0x4618[_0x3c8e9a];return _0x2d4c57;};'use strict';var _=require('lodash');var util=require(_0x8461('0x0'));var moment=require(_0x8461('0x1'));var BPromise=require(_0x8461('0x2'));var rs=require(_0x8461('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8461('0x4'))['db'];var utils=require(_0x8461('0x5'));var logger=require(_0x8461('0x6'))(_0x8461('0x7'));var config=require(_0x8461('0x8'));var jayson=require(_0x8461('0x9'));var client=jayson['client'][_0x8461('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2ddf8d,_0x2e0fe4,_0x374b22){return new BPromise(function(_0x19d31d,_0x1edbfa){return client['request'](_0x2ddf8d,_0x374b22)[_0x8461('0xb')](function(_0x3e1749){logger[_0x8461('0xc')](_0x8461('0xd'),_0x2e0fe4,_0x8461('0xe'));logger[_0x8461('0xf')](_0x8461('0x10'),_0x2e0fe4,_0x8461('0xe'),JSON[_0x8461('0x11')](_0x3e1749));if(_0x3e1749[_0x8461('0x12')]){if(_0x3e1749[_0x8461('0x12')][_0x8461('0x13')]===0x1f4){logger[_0x8461('0x12')](_0x8461('0xd'),_0x2e0fe4,_0x3e1749[_0x8461('0x12')][_0x8461('0x14')]);return _0x1edbfa(_0x3e1749[_0x8461('0x12')]['message']);}logger[_0x8461('0x12')](_0x8461('0xd'),_0x2e0fe4,_0x3e1749[_0x8461('0x12')][_0x8461('0x14')]);return _0x19d31d(_0x3e1749[_0x8461('0x12')]['message']);}else{logger[_0x8461('0xc')](_0x8461('0xd'),_0x2e0fe4,_0x8461('0xe'));_0x19d31d(_0x3e1749[_0x8461('0x15')][_0x8461('0x14')]);}})[_0x8461('0x16')](function(_0x2a8dc2){logger[_0x8461('0x12')](_0x8461('0xd'),_0x2e0fe4,_0x2a8dc2);_0x1edbfa(_0x2a8dc2);});});}exports[_0x8461('0x17')]=function(_0x2ec23d){var _0x38740a=this;return new Promise(function(_0x3f4e34,_0x2bca84){return db['VoiceDialReport'][_0x8461('0x18')](_0x2ec23d['body'],{'raw':_0x2ec23d[_0x8461('0x19')]?_0x2ec23d['options']['raw']===undefined?!![]:![]:!![]})[_0x8461('0xb')](function(_0x47cd78){logger['info'](_0x8461('0x17'),_0x2ec23d);logger[_0x8461('0xf')](_0x8461('0x17'),_0x2ec23d,JSON[_0x8461('0x11')](_0x47cd78));_0x3f4e34(_0x47cd78);})[_0x8461('0x16')](function(_0x4a5cca){logger[_0x8461('0x12')]('CreateVoiceDialReport',_0x4a5cca[_0x8461('0x14')],_0x2ec23d);_0x2bca84(_0x38740a['error'](0x1f4,_0x4a5cca[_0x8461('0x14')]));});});};exports['UpdateVoiceDialReport']=function(_0x36a113){var _0x559af3=this;return new Promise(function(_0x4e3fdf,_0x81f999){return db[_0x8461('0x1a')][_0x8461('0x1b')](_0x36a113['body'],{'raw':_0x36a113[_0x8461('0x19')]?_0x36a113['options'][_0x8461('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x36a113[_0x8461('0x19')]?_0x36a113['options'][_0x8461('0x1d')]||null:null,'attributes':_0x36a113[_0x8461('0x19')]?_0x36a113['options']['attributes']||null:null,'limit':_0x36a113['options']?_0x36a113[_0x8461('0x19')][_0x8461('0x1e')]||null:null})[_0x8461('0xb')](function(_0x2f9bca){logger[_0x8461('0xc')]('UpdateVoiceDialReport',_0x36a113);logger[_0x8461('0xf')](_0x8461('0x1f'),_0x36a113,JSON[_0x8461('0x11')](_0x2f9bca));_0x4e3fdf(_0x2f9bca);})[_0x8461('0x16')](function(_0x4ffacc){logger['error'](_0x8461('0x1f'),_0x4ffacc[_0x8461('0x14')],_0x36a113);_0x81f999(_0x559af3[_0x8461('0x12')](0x1f4,_0x4ffacc[_0x8461('0x14')]));});});}; \ No newline at end of file +var _0x4f90=['CreateVoiceDialReport','create','raw','UpdateVoiceDialReport','VoiceDialReport','options','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceDialReport,\x20%s,\x20%s','message','result','catch'];(function(_0x2345cd,_0x56ec35){var _0x2fc77e=function(_0x48af74){while(--_0x48af74){_0x2345cd['push'](_0x2345cd['shift']());}};_0x2fc77e(++_0x56ec35);}(_0x4f90,0x88));var _0x04f9=function(_0xe7d07d,_0x52e4e3){_0xe7d07d=_0xe7d07d-0x0;var _0x229e46=_0x4f90[_0xe7d07d];return _0x229e46;};'use strict';var _=require(_0x04f9('0x0'));var util=require(_0x04f9('0x1'));var moment=require(_0x04f9('0x2'));var BPromise=require(_0x04f9('0x3'));var rs=require(_0x04f9('0x4'));var fs=require('fs');var Redis=require(_0x04f9('0x5'));var db=require(_0x04f9('0x6'))['db'];var utils=require(_0x04f9('0x7'));var logger=require(_0x04f9('0x8'))(_0x04f9('0x9'));var config=require(_0x04f9('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x04f9('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4f788a,_0x52e881,_0x42f072){return new BPromise(function(_0x185ab8,_0x5e5455){return client['request'](_0x4f788a,_0x42f072)[_0x04f9('0xc')](function(_0x15265a){logger[_0x04f9('0xd')]('VoiceDialReport,\x20%s,\x20%s',_0x52e881,_0x04f9('0xe'));logger[_0x04f9('0xf')](_0x04f9('0x10'),_0x52e881,_0x04f9('0xe'),JSON[_0x04f9('0x11')](_0x15265a));if(_0x15265a[_0x04f9('0x12')]){if(_0x15265a[_0x04f9('0x12')][_0x04f9('0x13')]===0x1f4){logger['error'](_0x04f9('0x14'),_0x52e881,_0x15265a[_0x04f9('0x12')][_0x04f9('0x15')]);return _0x5e5455(_0x15265a[_0x04f9('0x12')][_0x04f9('0x15')]);}logger[_0x04f9('0x12')](_0x04f9('0x14'),_0x52e881,_0x15265a[_0x04f9('0x12')][_0x04f9('0x15')]);return _0x185ab8(_0x15265a[_0x04f9('0x12')][_0x04f9('0x15')]);}else{logger[_0x04f9('0xd')]('VoiceDialReport,\x20%s,\x20%s',_0x52e881,_0x04f9('0xe'));_0x185ab8(_0x15265a[_0x04f9('0x16')]['message']);}})[_0x04f9('0x17')](function(_0x1dfa12){logger[_0x04f9('0x12')](_0x04f9('0x14'),_0x52e881,_0x1dfa12);_0x5e5455(_0x1dfa12);});});}exports[_0x04f9('0x18')]=function(_0x235c5e){var _0x526727=this;return new Promise(function(_0x473584,_0x2cd9e0){return db['VoiceDialReport'][_0x04f9('0x19')](_0x235c5e['body'],{'raw':_0x235c5e['options']?_0x235c5e['options'][_0x04f9('0x1a')]===undefined?!![]:![]:!![]})[_0x04f9('0xc')](function(_0x92acbe){logger[_0x04f9('0xd')]('CreateVoiceDialReport',_0x235c5e);logger[_0x04f9('0xf')](_0x04f9('0x18'),_0x235c5e,JSON['stringify'](_0x92acbe));_0x473584(_0x92acbe);})[_0x04f9('0x17')](function(_0x5de5fe){logger[_0x04f9('0x12')]('CreateVoiceDialReport',_0x5de5fe['message'],_0x235c5e);_0x2cd9e0(_0x526727[_0x04f9('0x12')](0x1f4,_0x5de5fe[_0x04f9('0x15')]));});});};exports[_0x04f9('0x1b')]=function(_0x17e795){var _0x2f0cfb=this;return new Promise(function(_0x415050,_0x306100){return db[_0x04f9('0x1c')]['update'](_0x17e795['body'],{'raw':_0x17e795['options']?_0x17e795[_0x04f9('0x1d')][_0x04f9('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x17e795[_0x04f9('0x1d')]?_0x17e795[_0x04f9('0x1d')]['where']||null:null,'attributes':_0x17e795[_0x04f9('0x1d')]?_0x17e795[_0x04f9('0x1d')][_0x04f9('0x1e')]||null:null,'limit':_0x17e795[_0x04f9('0x1d')]?_0x17e795['options'][_0x04f9('0x1f')]||null:null})[_0x04f9('0xc')](function(_0x39a333){logger[_0x04f9('0xd')]('UpdateVoiceDialReport',_0x17e795);logger[_0x04f9('0xf')](_0x04f9('0x1b'),_0x17e795,JSON['stringify'](_0x39a333));_0x415050(_0x39a333);})[_0x04f9('0x17')](function(_0x163e52){logger['error'](_0x04f9('0x1b'),_0x163e52['message'],_0x17e795);_0x306100(_0x2f0cfb[_0x04f9('0x12')](0x1f4,_0x163e52['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index ef633bc..711e103 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 _0xd4dc=['show','post','create','/:id/applications','addApplications','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','isAuthenticated','get','/:id'];(function(_0x319e54,_0x1137b1){var _0x1a6574=function(_0x5621fc){while(--_0x5621fc){_0x319e54['push'](_0x319e54['shift']());}};_0x1a6574(++_0x1137b1);}(_0xd4dc,0x162));var _0xcd4d=function(_0x576170,_0x1712ae){_0x576170=_0x576170-0x0;var _0x397c70=_0xd4dc[_0x576170];return _0x397c70;};'use strict';var multer=require(_0xcd4d('0x0'));var util=require(_0xcd4d('0x1'));var path=require(_0xcd4d('0x2'));var timeout=require(_0xcd4d('0x3'));var express=require(_0xcd4d('0x4'));var router=express[_0xcd4d('0x5')]();var fs_extra=require(_0xcd4d('0x6'));var auth=require(_0xcd4d('0x7'));var interaction=require(_0xcd4d('0x8'));var config=require(_0xcd4d('0x9'));var controller=require(_0xcd4d('0xa'));router['get']('/',auth[_0xcd4d('0xb')](),controller['index']);router[_0xcd4d('0xc')](_0xcd4d('0xd'),auth['isAuthenticated'](),controller[_0xcd4d('0xe')]);router[_0xcd4d('0xf')]('/',auth[_0xcd4d('0xb')](),controller[_0xcd4d('0x10')]);router[_0xcd4d('0xf')](_0xcd4d('0x11'),auth['isAuthenticated'](),controller[_0xcd4d('0x12')]);router['put'](_0xcd4d('0xd'),auth['isAuthenticated'](),controller[_0xcd4d('0x13')]);router[_0xcd4d('0x14')]('/:id',auth[_0xcd4d('0xb')](),controller[_0xcd4d('0x15')]);module[_0xcd4d('0x16')]=router; \ No newline at end of file +var _0xd9a9=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','/:id','show','post','/:id/applications','addApplications','put','delete','destroy','exports','util','path'];(function(_0x34b7db,_0x299974){var _0x17fb0d=function(_0x95d995){while(--_0x95d995){_0x34b7db['push'](_0x34b7db['shift']());}};_0x17fb0d(++_0x299974);}(_0xd9a9,0x91));var _0x9d9a=function(_0x47cf84,_0x4c4881){_0x47cf84=_0x47cf84-0x0;var _0x497819=_0xd9a9[_0x47cf84];return _0x497819;};'use strict';var multer=require('multer');var util=require(_0x9d9a('0x0'));var path=require(_0x9d9a('0x1'));var timeout=require('connect-timeout');var express=require(_0x9d9a('0x2'));var router=express[_0x9d9a('0x3')]();var fs_extra=require(_0x9d9a('0x4'));var auth=require(_0x9d9a('0x5'));var interaction=require(_0x9d9a('0x6'));var config=require(_0x9d9a('0x7'));var controller=require(_0x9d9a('0x8'));router[_0x9d9a('0x9')]('/',auth[_0x9d9a('0xa')](),controller[_0x9d9a('0xb')]);router[_0x9d9a('0x9')](_0x9d9a('0xc'),auth[_0x9d9a('0xa')](),controller[_0x9d9a('0xd')]);router[_0x9d9a('0xe')]('/',auth[_0x9d9a('0xa')](),controller['create']);router[_0x9d9a('0xe')](_0x9d9a('0xf'),auth['isAuthenticated'](),controller[_0x9d9a('0x10')]);router[_0x9d9a('0x11')](_0x9d9a('0xc'),auth[_0x9d9a('0xa')](),controller['update']);router[_0x9d9a('0x12')](_0x9d9a('0xc'),auth[_0x9d9a('0xa')](),controller[_0x9d9a('0x13')]);module[_0x9d9a('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index a455246..1cbff7e 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 _0x24d1=['internal','inbound-fax','outbound-fax','system','any','*,*,*,*','INTEGER','BOOLEAN','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','inbound','outbound'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x24d1,0x181));var _0x124d=function(_0x3049fd,_0x562d6e){_0x3049fd=_0x3049fd-0x0;var _0x192da0=_0x24d1[_0x3049fd];return _0x192da0;};'use strict';var Sequelize=require(_0x124d('0x0'));module[_0x124d('0x1')]={'context':{'type':Sequelize['STRING'],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize[_0x124d('0x2')],'allowNull':![],'defaultValue':'1','unique':_0x124d('0x3')},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x124d('0x2')],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize[_0x124d('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x124d('0x4'),_0x124d('0x5'),_0x124d('0x6'),_0x124d('0x7'),_0x124d('0x8'),_0x124d('0x9'),_0x124d('0xa')),'allowNull':![]},'description':{'type':Sequelize[_0x124d('0x2')]},'interval':{'type':Sequelize[_0x124d('0x2')],'allowNull':![],'defaultValue':_0x124d('0xb')},'IntervalId':{'type':Sequelize[_0x124d('0xc')]},'isApp':{'type':Sequelize[_0x124d('0xd')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x124d('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x124d('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0x124d('0xd')],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize[_0x124d('0x2')],'defaultValue':'wav'},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize[_0x124d('0xe')],'get':function(_0x40f870){return this[_0x124d('0xf')](_0x124d('0x10'));}},'alias':{'type':Sequelize[_0x124d('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x6a8e=['INTEGER','BOOLEAN','VIRTUAL','getDataValue','sequelize','STRING','compositeIndex','NoOp','ENUM','inbound','outbound','internal','outbound-fax','*,*,*,*'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0x6a8e,0x82));var _0xe6a8=function(_0x4bb010,_0x5c862b){_0x4bb010=_0x4bb010-0x0;var _0x45e1dc=_0x6a8e[_0x4bb010];return _0x45e1dc;};'use strict';var Sequelize=require(_0xe6a8('0x0'));module['exports']={'context':{'type':Sequelize[_0xe6a8('0x1')],'allowNull':![],'unique':_0xe6a8('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xe6a8('0x1')],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize[_0xe6a8('0x1')],'allowNull':![],'defaultValue':'1','unique':_0xe6a8('0x2')},'tag':{'type':Sequelize[_0xe6a8('0x1')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xe6a8('0x1')],'allowNull':![],'defaultValue':_0xe6a8('0x3')},'appdata':{'type':Sequelize[_0xe6a8('0x1')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xe6a8('0x4')](_0xe6a8('0x5'),_0xe6a8('0x6'),_0xe6a8('0x7'),'inbound-fax',_0xe6a8('0x8'),'system','any'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xe6a8('0x1')],'allowNull':![],'defaultValue':_0xe6a8('0x9')},'IntervalId':{'type':Sequelize[_0xe6a8('0xa')]},'isApp':{'type':Sequelize[_0xe6a8('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xe6a8('0x1')],'defaultValue':null},'callerID':{'type':Sequelize[_0xe6a8('0x1')],'allowNull':!![]},'record':{'type':Sequelize[_0xe6a8('0xb')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xe6a8('0xa')]},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':'wav'},'answer':{'type':Sequelize[_0xe6a8('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0xe6a8('0xc')],'get':function(_0x21085f){return this[_0xe6a8('0xd')]('exten');}},'alias':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 66ff43e..45f28f1 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 _0x61f2=['filter','ignore','map','value','includes','type','find','name','UserProfileResource','error','VoiceExtension','rawAttributes','fieldName','model','query','keys','intersection','fields','attributes','length','order','sort','where','filters','pick','merge','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','params','include','create','body','startsWith','exten','concat','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','description','recordingFormat','cutdigits','mandatoryDisposition','addApplications','sequelize','ISOLATION_LEVELS','READ_COMMITTED','VoiceExtensionId','createRouting','bulkCreate','cast(priority\x20as\x20unsigned)','stack','finally','send','ioredis','../../components/parsers/qs','../../config/logger','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./voiceExtension.socket','sendStatus','status','end','offset','undefined','limit','set','Content-Range','json','destroy','then','get','InboundRoutes','inbound','outbound','InternalRoutes','internal'];(function(_0x2fcc44,_0x5ce1bb){var _0x5c00de=function(_0x2fe9a5){while(--_0x2fe9a5){_0x2fcc44['push'](_0x2fcc44['shift']());}};_0x5c00de(++_0x5ce1bb);}(_0x61f2,0x94));var _0x261f=function(_0x576170,_0x1712ae){_0x576170=_0x576170-0x0;var _0x397c70=_0x61f2[_0x576170];return _0x397c70;};'use strict';var _=require('lodash');var Redis=require(_0x261f('0x0'));var qs=require(_0x261f('0x1'));var logger=require(_0x261f('0x2'))('api');var config=require('../../config/environment');var db=require(_0x261f('0x3'))['db'];config['redis']=_[_0x261f('0x4')](config[_0x261f('0x5')],{'host':_0x261f('0x6'),'port':0x18eb});var socket=require(_0x261f('0x7'))(new Redis(config[_0x261f('0x5')]));require(_0x261f('0x8'))['register'](socket);function respondWithStatusCode(_0x32278d,_0x344064){_0x344064=_0x344064||0xcc;return function(_0x4258d5){if(_0x4258d5){return _0x32278d[_0x261f('0x9')](_0x344064);}return _0x32278d[_0x261f('0xa')](_0x344064)[_0x261f('0xb')]();};}function respondWithResult(_0x51369e,_0x598ed8){_0x598ed8=_0x598ed8||0xc8;return function(_0x228f4d){if(_0x228f4d){return _0x51369e[_0x261f('0xa')](_0x598ed8)['json'](_0x228f4d);}};}function respondWithFilteredResult(_0x2e3abe,_0x1028cd){return function(_0x4c5c5d){if(_0x4c5c5d){var _0xfa632d=typeof _0x1028cd[_0x261f('0xc')]===_0x261f('0xd')&&typeof _0x1028cd[_0x261f('0xe')]===_0x261f('0xd');var _0x2cda35=_0x4c5c5d['count'];var _0x3c0526=_0xfa632d?0x0:_0x1028cd[_0x261f('0xc')];var _0x2572f4=_0xfa632d?_0x4c5c5d['count']:_0x1028cd['offset']+_0x1028cd[_0x261f('0xe')];var _0x1c98e7;if(_0x2572f4>=_0x2cda35){_0x2572f4=_0x2cda35;_0x1c98e7=0xc8;}else{_0x1c98e7=0xce;}_0x2e3abe['status'](_0x1c98e7);return _0x2e3abe[_0x261f('0xf')](_0x261f('0x10'),_0x3c0526+'-'+_0x2572f4+'/'+_0x2cda35)[_0x261f('0x11')](_0x4c5c5d);}return null;};}function removeEntity(_0x33ee26){return function(_0x445386){if(_0x445386){return _0x445386[_0x261f('0x12')]()[_0x261f('0x13')](function(){var _0x4d7899=_0x445386[_0x261f('0x14')]({'plain':!![]});var _0x36c95d=[{'name':_0x261f('0x15'),'value':_0x261f('0x16'),'ignore':![]},{'name':'OutboundRoutes','value':_0x261f('0x17'),'ignore':![]},{'name':_0x261f('0x18'),'value':_0x261f('0x19'),'ignore':![]}];var _0x1d7fda=_(_0x36c95d)[_0x261f('0x1a')](_0x261f('0x1b'))[_0x261f('0x1c')](_0x261f('0x1d'))[_0x261f('0x1d')]();if(_[_0x261f('0x1e')](_0x1d7fda,_0x4d7899[_0x261f('0x1f')])){return;}var _0x5a0d56=_[_0x261f('0x20')](_0x36c95d,['value',_0x4d7899[_0x261f('0x1f')]])[_0x261f('0x21')];return db[_0x261f('0x22')][_0x261f('0x12')]({'where':{'type':_0x5a0d56,'resourceId':_0x4d7899['id']}})[_0x261f('0x13')](function(){return _0x445386;});})[_0x261f('0x13')](function(){_0x33ee26['status'](0xcc)[_0x261f('0xb')]();});}};}function handleEntityNotFound(_0x1e932e){return function(_0x2fd3d9){if(!_0x2fd3d9){_0x1e932e[_0x261f('0x9')](0x194);}return _0x2fd3d9;};}function handleError(_0x57e1b4,_0x359a35){_0x359a35=_0x359a35||0x1f4;return function(_0x322710){logger[_0x261f('0x23')](_0x322710['stack']);if(_0x322710['name']){delete _0x322710[_0x261f('0x21')];}_0x57e1b4[_0x261f('0xa')](_0x359a35)['send'](_0x322710);};}exports['index']=function(_0x226133,_0x4523df){var _0x4aa760={},_0x563cc8={},_0x2733d5={'count':0x0,'rows':[]};var _0x4b2a19=_['map'](db[_0x261f('0x24')][_0x261f('0x25')],function(_0x1207f7){return{'name':_0x1207f7[_0x261f('0x26')],'type':_0x1207f7[_0x261f('0x1f')]['key']};});_0x563cc8[_0x261f('0x27')]=_['map'](_0x4b2a19,_0x261f('0x21'));_0x563cc8[_0x261f('0x28')]=_[_0x261f('0x29')](_0x226133[_0x261f('0x28')]);_0x563cc8['filters']=_[_0x261f('0x2a')](_0x563cc8[_0x261f('0x27')],_0x563cc8[_0x261f('0x28')]);_0x4aa760['attributes']=_[_0x261f('0x2a')](_0x563cc8[_0x261f('0x27')],qs[_0x261f('0x2b')](_0x226133['query'][_0x261f('0x2b')]));_0x4aa760['attributes']=_0x4aa760[_0x261f('0x2c')][_0x261f('0x2d')]?_0x4aa760[_0x261f('0x2c')]:_0x563cc8['model'];if(!_0x226133[_0x261f('0x28')]['hasOwnProperty']('nolimit')){_0x4aa760[_0x261f('0xe')]=qs['limit'](_0x226133[_0x261f('0x28')][_0x261f('0xe')]);_0x4aa760[_0x261f('0xc')]=qs['offset'](_0x226133[_0x261f('0x28')][_0x261f('0xc')]);}_0x4aa760[_0x261f('0x2e')]=qs[_0x261f('0x2f')](_0x226133[_0x261f('0x28')]['sort']);_0x4aa760[_0x261f('0x30')]=qs[_0x261f('0x31')](_[_0x261f('0x32')](_0x226133[_0x261f('0x28')],_0x563cc8[_0x261f('0x31')]),_0x4b2a19);if(_0x226133[_0x261f('0x28')][_0x261f('0x1a')]){_0x4aa760[_0x261f('0x30')]=_[_0x261f('0x33')](_0x4aa760[_0x261f('0x30')],{'$or':_['map'](_0x4b2a19,function(_0x235b91){if(_0x235b91[_0x261f('0x1f')]!==_0x261f('0x34')){var _0x45428e={};_0x45428e[_0x235b91[_0x261f('0x21')]]={'$like':'%'+_0x226133[_0x261f('0x28')][_0x261f('0x1a')]+'%'};return _0x45428e;}})});}_0x4aa760=_[_0x261f('0x33')]({},_0x4aa760,_0x226133[_0x261f('0x35')]);var _0x3dcd29={'where':_0x4aa760[_0x261f('0x30')]};return db[_0x261f('0x24')]['count'](_0x3dcd29)['then'](function(_0x380229){_0x2733d5[_0x261f('0x36')]=_0x380229;if(_0x226133['query'][_0x261f('0x37')]){_0x4aa760['include']=[{'all':!![]}];}return db[_0x261f('0x24')][_0x261f('0x38')](_0x4aa760);})['then'](function(_0xe8807){_0x2733d5[_0x261f('0x39')]=_0xe8807;return _0x2733d5;})[_0x261f('0x13')](respondWithFilteredResult(_0x4523df,_0x4aa760))[_0x261f('0x3a')](handleError(_0x4523df,null));};exports[_0x261f('0x3b')]=function(_0x5e4635,_0x38ef8d){var _0x430929={'raw':![],'where':{'id':_0x5e4635[_0x261f('0x3c')]['id']}},_0x456bdf={};_0x456bdf['model']=_[_0x261f('0x29')](db['VoiceExtension'][_0x261f('0x25')]);_0x456bdf[_0x261f('0x28')]=_['keys'](_0x5e4635[_0x261f('0x28')]);_0x456bdf['filters']=_[_0x261f('0x2a')](_0x456bdf[_0x261f('0x27')],_0x456bdf[_0x261f('0x28')]);_0x430929[_0x261f('0x2c')]=_[_0x261f('0x2a')](_0x456bdf['model'],qs[_0x261f('0x2b')](_0x5e4635[_0x261f('0x28')][_0x261f('0x2b')]));_0x430929[_0x261f('0x2c')]=_0x430929[_0x261f('0x2c')][_0x261f('0x2d')]?_0x430929[_0x261f('0x2c')]:_0x456bdf[_0x261f('0x27')];if(_0x5e4635['query']['includeAll']){_0x430929[_0x261f('0x3d')]=[{'all':!![]}];}_0x430929=_[_0x261f('0x33')]({},_0x430929,_0x5e4635[_0x261f('0x35')]);return db['VoiceExtension'][_0x261f('0x20')](_0x430929)[_0x261f('0x13')](handleEntityNotFound(_0x38ef8d,null))[_0x261f('0x13')](respondWithResult(_0x38ef8d,null))[_0x261f('0x3a')](handleError(_0x38ef8d,null));};exports[_0x261f('0x12')]=function(_0x3b2914,_0x2b7773){return db['VoiceExtension']['find']({'where':{'id':_0x3b2914[_0x261f('0x3c')]['id']}})[_0x261f('0x13')](handleEntityNotFound(_0x2b7773,null))['then'](removeEntity(_0x2b7773,null))['catch'](handleError(_0x2b7773,null));};exports[_0x261f('0x3e')]=function(_0x1c2fe0,_0xd16317){if(_0x1c2fe0[_0x261f('0x3f')]['type']===_0x261f('0x17')&&!_[_0x261f('0x40')](_0x1c2fe0[_0x261f('0x3f')]['exten'],'_')){_0x1c2fe0[_0x261f('0x3f')][_0x261f('0x41')]='_'[_0x261f('0x42')](_0x1c2fe0[_0x261f('0x3f')][_0x261f('0x41')]);}return db[_0x261f('0x24')]['create'](_0x1c2fe0[_0x261f('0x3f')],{'raw':![]})[_0x261f('0x13')](function(_0x19e1fa){var _0x1d06f9=_0x1c2fe0['user'][_0x261f('0x14')]({'plain':!![]});if(!_0x1d06f9)throw new Error(_0x261f('0x43'));if(_0x1d06f9[_0x261f('0x44')]==='user'){var _0x5aad00=_0x19e1fa[_0x261f('0x14')]({'plain':!![]});var _0x39b640=[{'name':'InboundRoutes','value':_0x261f('0x16')},{'name':'OutboundRoutes','value':'outbound'},{'name':_0x261f('0x18'),'value':'internal'}];var _0x1cf9c1=_[_0x261f('0x20')](_0x39b640,['value',_0x5aad00[_0x261f('0x1f')]])[_0x261f('0x21')];return db['UserProfileSection']['find']({'where':{'name':_0x1cf9c1,'userProfileId':_0x1d06f9['userProfileId']},'raw':!![]})[_0x261f('0x13')](function(_0x486dc4){if(_0x486dc4&&_0x486dc4['autoAssociation']===0x0){return db['UserProfileResource'][_0x261f('0x3e')]({'name':_0x5aad00[_0x261f('0x21')],'resourceId':_0x5aad00['id'],'type':_0x486dc4[_0x261f('0x21')],'sectionId':_0x486dc4['id']},{})[_0x261f('0x13')](function(){return _0x19e1fa;});}else{return _0x19e1fa;}})[_0x261f('0x3a')](function(_0x2c8d6e){logger[_0x261f('0x23')](_0x261f('0x45'),_0x2c8d6e);throw _0x2c8d6e;});}return _0x19e1fa;})[_0x261f('0x13')](respondWithResult(_0xd16317,0xc9))[_0x261f('0x3a')](handleError(_0xd16317,null));};exports['update']=function(_0x211295,_0xc3d141){if(_0x211295[_0x261f('0x3f')]['id']){delete _0x211295[_0x261f('0x3f')]['id'];}return db[_0x261f('0x24')][_0x261f('0x20')]({'where':{'id':_0x211295[_0x261f('0x3c')]['id']}})['then'](handleEntityNotFound(_0xc3d141,null))[_0x261f('0x13')](function(_0x21d552){if(_0x21d552){return db[_0x261f('0x24')][_0x261f('0x46')](_[_0x261f('0x32')](_0x211295[_0x261f('0x3f')],['exten',_0x261f('0x47'),_0x261f('0x48'),_0x261f('0x49'),_0x261f('0x4a'),_0x261f('0x4b'),'alias']),{'where':{'context':_0x21d552[_0x261f('0x47')],'exten':_0x21d552[_0x261f('0x41')]},'individualHooks':!![]})[_0x261f('0x13')](function(_0x1e967f){return _0x1e967f;});}return null;})[_0x261f('0x13')](respondWithStatusCode(_0xc3d141,null))[_0x261f('0x3a')](handleError(_0xc3d141,null));};exports[_0x261f('0x4c')]=function(_0x3b5fcb,_0x31b366){var _0x47c655=_0x3b5fcb[_0x261f('0x3c')]['id'];var _0x22a24c=_0x3b5fcb[_0x261f('0x3f')];var _0x412066=0xc8;var _0x3a9bbe=null;return db[_0x261f('0x4d')]['transaction']({'isolationLevel':db[_0x261f('0x4d')]['Transaction'][_0x261f('0x4e')][_0x261f('0x4f')]},function(_0x2787d5){return db[_0x261f('0x24')]['findOne']({'where':{'id':_0x47c655},'transaction':_0x2787d5})[_0x261f('0x13')](function(_0x247e8a){if(_0x247e8a){return db[_0x261f('0x24')][_0x261f('0x12')]({'where':{'VoiceExtensionId':_0x47c655},'transaction':_0x2787d5})[_0x261f('0x13')](function(){var _0x5eaa04=_[_0x261f('0x1c')](_0x22a24c,function(_0x297070){_0x297070[_0x261f('0x50')]=_0x47c655;_0x297070['isApp']=!![];return _0x297070;});return _0x247e8a[_0x261f('0x51')](_0x5eaa04);})[_0x261f('0x13')](function(_0x545600){return db[_0x261f('0x24')][_0x261f('0x52')](_0x545600,{'transaction':_0x2787d5});});}else{_0x412066=0x194;_0x3a9bbe=[];}});})[_0x261f('0x13')](function(){if(_0x412066!==0x194){return db[_0x261f('0x24')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x47c655},'order':_0x261f('0x53')})['then'](function(_0x487399){_0x3a9bbe=_0x487399;});}})['catch'](function(_0x3fdb02){_0x412066=0x1f4;logger[_0x261f('0x23')](_0x3fdb02[_0x261f('0x54')]);if(_0x3fdb02['name']){delete _0x3fdb02[_0x261f('0x21')];}_0x3a9bbe=_0x3fdb02;})[_0x261f('0x55')](function(){if(_0x3a9bbe===null){_0x31b366[_0x261f('0x9')](_0x412066);}else{if(_0x412066===0x1f4){_0x31b366[_0x261f('0xa')](_0x412066)[_0x261f('0x56')](_0x3a9bbe);}else{_0x31b366['status'](_0x412066)['json'](_0x3a9bbe);}}});}; \ No newline at end of file +var _0x4201=['set','Content-Range','destroy','get','InboundRoutes','inbound','outbound','InternalRoutes','internal','filter','ignore','map','value','includes','find','type','UserProfileResource','then','stack','name','send','VoiceExtension','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filters','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','length','catch','create','body','startsWith','exten','concat','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','description','recordingFormat','alias','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','VoiceExtensionId','createRouting','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','lodash','../../config/logger','api','../../config/environment','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','end','status','json','offset','undefined','limit','count'];(function(_0x48999d,_0x1e02cb){var _0x1ad0d1=function(_0x3f974e){while(--_0x3f974e){_0x48999d['push'](_0x48999d['shift']());}};_0x1ad0d1(++_0x1e02cb);}(_0x4201,0xa6));var _0x1420=function(_0x2bcd1f,_0x4f1972){_0x2bcd1f=_0x2bcd1f-0x0;var _0x2381ca=_0x4201[_0x2bcd1f];return _0x2381ca;};'use strict';var _=require(_0x1420('0x0'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x1420('0x1'))(_0x1420('0x2'));var config=require(_0x1420('0x3'));var db=require('../../mysqldb')['db'];config[_0x1420('0x4')]=_['defaults'](config[_0x1420('0x4')],{'host':_0x1420('0x5'),'port':0x18eb});var socket=require(_0x1420('0x6'))(new Redis(config['redis']));require(_0x1420('0x7'))[_0x1420('0x8')](socket);function respondWithStatusCode(_0x420a00,_0x425782){_0x425782=_0x425782||0xcc;return function(_0x55facb){if(_0x55facb){return _0x420a00['sendStatus'](_0x425782);}return _0x420a00['status'](_0x425782)[_0x1420('0x9')]();};}function respondWithResult(_0x336936,_0x434cde){_0x434cde=_0x434cde||0xc8;return function(_0x5ebf2a){if(_0x5ebf2a){return _0x336936[_0x1420('0xa')](_0x434cde)[_0x1420('0xb')](_0x5ebf2a);}};}function respondWithFilteredResult(_0x4df520,_0x112315){return function(_0x421939){if(_0x421939){var _0x3a9c84=typeof _0x112315[_0x1420('0xc')]===_0x1420('0xd')&&typeof _0x112315[_0x1420('0xe')]===_0x1420('0xd');var _0x4859e7=_0x421939[_0x1420('0xf')];var _0x5a159c=_0x3a9c84?0x0:_0x112315[_0x1420('0xc')];var _0x48606d=_0x3a9c84?_0x421939[_0x1420('0xf')]:_0x112315[_0x1420('0xc')]+_0x112315[_0x1420('0xe')];var _0x43f0aa;if(_0x48606d>=_0x4859e7){_0x48606d=_0x4859e7;_0x43f0aa=0xc8;}else{_0x43f0aa=0xce;}_0x4df520[_0x1420('0xa')](_0x43f0aa);return _0x4df520[_0x1420('0x10')](_0x1420('0x11'),_0x5a159c+'-'+_0x48606d+'/'+_0x4859e7)[_0x1420('0xb')](_0x421939);}return null;};}function removeEntity(_0x92cb47){return function(_0x4e7cdd){if(_0x4e7cdd){return _0x4e7cdd[_0x1420('0x12')]()['then'](function(){var _0x2a1165=_0x4e7cdd[_0x1420('0x13')]({'plain':!![]});var _0x213bf8=[{'name':_0x1420('0x14'),'value':_0x1420('0x15'),'ignore':![]},{'name':'OutboundRoutes','value':_0x1420('0x16'),'ignore':![]},{'name':_0x1420('0x17'),'value':_0x1420('0x18'),'ignore':![]}];var _0x559cf0=_(_0x213bf8)[_0x1420('0x19')](_0x1420('0x1a'))[_0x1420('0x1b')]('value')[_0x1420('0x1c')]();if(_[_0x1420('0x1d')](_0x559cf0,_0x2a1165['type'])){return;}var _0xb504e3=_[_0x1420('0x1e')](_0x213bf8,[_0x1420('0x1c'),_0x2a1165[_0x1420('0x1f')]])['name'];return db[_0x1420('0x20')][_0x1420('0x12')]({'where':{'type':_0xb504e3,'resourceId':_0x2a1165['id']}})[_0x1420('0x21')](function(){return _0x4e7cdd;});})[_0x1420('0x21')](function(){_0x92cb47[_0x1420('0xa')](0xcc)[_0x1420('0x9')]();});}};}function handleEntityNotFound(_0x4223ed){return function(_0x49b2aa){if(!_0x49b2aa){_0x4223ed['sendStatus'](0x194);}return _0x49b2aa;};}function handleError(_0x54702f,_0x1da04f){_0x1da04f=_0x1da04f||0x1f4;return function(_0x2c2560){logger['error'](_0x2c2560[_0x1420('0x22')]);if(_0x2c2560['name']){delete _0x2c2560[_0x1420('0x23')];}_0x54702f['status'](_0x1da04f)[_0x1420('0x24')](_0x2c2560);};}exports['index']=function(_0x3fc020,_0x2aae4f){var _0x1cff93={},_0xff6157={},_0x267668={'count':0x0,'rows':[]};var _0x40fd15=_[_0x1420('0x1b')](db[_0x1420('0x25')]['rawAttributes'],function(_0x4e147f){return{'name':_0x4e147f[_0x1420('0x26')],'type':_0x4e147f[_0x1420('0x1f')][_0x1420('0x27')]};});_0xff6157[_0x1420('0x28')]=_[_0x1420('0x1b')](_0x40fd15,_0x1420('0x23'));_0xff6157[_0x1420('0x29')]=_[_0x1420('0x2a')](_0x3fc020[_0x1420('0x29')]);_0xff6157['filters']=_[_0x1420('0x2b')](_0xff6157['model'],_0xff6157['query']);_0x1cff93[_0x1420('0x2c')]=_[_0x1420('0x2b')](_0xff6157['model'],qs[_0x1420('0x2d')](_0x3fc020[_0x1420('0x29')]['fields']));_0x1cff93[_0x1420('0x2c')]=_0x1cff93['attributes']['length']?_0x1cff93[_0x1420('0x2c')]:_0xff6157[_0x1420('0x28')];if(!_0x3fc020[_0x1420('0x29')][_0x1420('0x2e')](_0x1420('0x2f'))){_0x1cff93['limit']=qs['limit'](_0x3fc020[_0x1420('0x29')]['limit']);_0x1cff93['offset']=qs[_0x1420('0xc')](_0x3fc020[_0x1420('0x29')][_0x1420('0xc')]);}_0x1cff93[_0x1420('0x30')]=qs[_0x1420('0x31')](_0x3fc020[_0x1420('0x29')][_0x1420('0x31')]);_0x1cff93['where']=qs['filters'](_[_0x1420('0x32')](_0x3fc020[_0x1420('0x29')],_0xff6157[_0x1420('0x33')]),_0x40fd15);if(_0x3fc020['query'][_0x1420('0x19')]){_0x1cff93[_0x1420('0x34')]=_['merge'](_0x1cff93[_0x1420('0x34')],{'$or':_[_0x1420('0x1b')](_0x40fd15,function(_0x5cb9a1){if(_0x5cb9a1[_0x1420('0x1f')]!==_0x1420('0x35')){var _0x3b06eb={};_0x3b06eb[_0x5cb9a1['name']]={'$like':'%'+_0x3fc020[_0x1420('0x29')]['filter']+'%'};return _0x3b06eb;}})});}_0x1cff93=_[_0x1420('0x36')]({},_0x1cff93,_0x3fc020[_0x1420('0x37')]);var _0x5be90a={'where':_0x1cff93[_0x1420('0x34')]};return db[_0x1420('0x25')][_0x1420('0xf')](_0x5be90a)[_0x1420('0x21')](function(_0x563160){_0x267668[_0x1420('0xf')]=_0x563160;if(_0x3fc020[_0x1420('0x29')][_0x1420('0x38')]){_0x1cff93[_0x1420('0x39')]=[{'all':!![]}];}return db[_0x1420('0x25')][_0x1420('0x3a')](_0x1cff93);})[_0x1420('0x21')](function(_0x20abba){_0x267668[_0x1420('0x3b')]=_0x20abba;return _0x267668;})[_0x1420('0x21')](respondWithFilteredResult(_0x2aae4f,_0x1cff93))['catch'](handleError(_0x2aae4f,null));};exports[_0x1420('0x3c')]=function(_0x2eda3d,_0x447e1d){var _0x67c21b={'raw':![],'where':{'id':_0x2eda3d[_0x1420('0x3d')]['id']}},_0x44480d={};_0x44480d['model']=_['keys'](db['VoiceExtension']['rawAttributes']);_0x44480d['query']=_[_0x1420('0x2a')](_0x2eda3d[_0x1420('0x29')]);_0x44480d['filters']=_[_0x1420('0x2b')](_0x44480d['model'],_0x44480d[_0x1420('0x29')]);_0x67c21b[_0x1420('0x2c')]=_['intersection'](_0x44480d['model'],qs[_0x1420('0x2d')](_0x2eda3d[_0x1420('0x29')][_0x1420('0x2d')]));_0x67c21b[_0x1420('0x2c')]=_0x67c21b['attributes'][_0x1420('0x3e')]?_0x67c21b[_0x1420('0x2c')]:_0x44480d[_0x1420('0x28')];if(_0x2eda3d[_0x1420('0x29')]['includeAll']){_0x67c21b['include']=[{'all':!![]}];}_0x67c21b=_[_0x1420('0x36')]({},_0x67c21b,_0x2eda3d[_0x1420('0x37')]);return db[_0x1420('0x25')][_0x1420('0x1e')](_0x67c21b)[_0x1420('0x21')](handleEntityNotFound(_0x447e1d,null))[_0x1420('0x21')](respondWithResult(_0x447e1d,null))['catch'](handleError(_0x447e1d,null));};exports[_0x1420('0x12')]=function(_0xf4d537,_0x5a47a1){return db[_0x1420('0x25')][_0x1420('0x1e')]({'where':{'id':_0xf4d537[_0x1420('0x3d')]['id']}})[_0x1420('0x21')](handleEntityNotFound(_0x5a47a1,null))[_0x1420('0x21')](removeEntity(_0x5a47a1,null))[_0x1420('0x3f')](handleError(_0x5a47a1,null));};exports[_0x1420('0x40')]=function(_0x4571fc,_0x255e48){if(_0x4571fc[_0x1420('0x41')][_0x1420('0x1f')]===_0x1420('0x16')&&!_[_0x1420('0x42')](_0x4571fc['body'][_0x1420('0x43')],'_')){_0x4571fc[_0x1420('0x41')][_0x1420('0x43')]='_'[_0x1420('0x44')](_0x4571fc[_0x1420('0x41')]['exten']);}return db[_0x1420('0x25')]['create'](_0x4571fc['body'],{'raw':![]})['then'](function(_0x376f8c){var _0x23e48c=_0x4571fc['user'][_0x1420('0x13')]({'plain':!![]});if(!_0x23e48c)throw new Error(_0x1420('0x45'));if(_0x23e48c[_0x1420('0x46')]===_0x1420('0x47')){var _0x495d86=_0x376f8c[_0x1420('0x13')]({'plain':!![]});var _0x7ca1d2=[{'name':'InboundRoutes','value':_0x1420('0x15')},{'name':'OutboundRoutes','value':_0x1420('0x16')},{'name':'InternalRoutes','value':_0x1420('0x18')}];var _0x2cad72=_[_0x1420('0x1e')](_0x7ca1d2,[_0x1420('0x1c'),_0x495d86['type']])['name'];return db[_0x1420('0x48')][_0x1420('0x1e')]({'where':{'name':_0x2cad72,'userProfileId':_0x23e48c[_0x1420('0x49')]},'raw':!![]})[_0x1420('0x21')](function(_0x45150b){if(_0x45150b&&_0x45150b[_0x1420('0x4a')]===0x0){return db[_0x1420('0x20')][_0x1420('0x40')]({'name':_0x495d86['name'],'resourceId':_0x495d86['id'],'type':_0x45150b['name'],'sectionId':_0x45150b['id']},{})[_0x1420('0x21')](function(){return _0x376f8c;});}else{return _0x376f8c;}})['catch'](function(_0x3f590b){logger[_0x1420('0x4b')](_0x1420('0x4c'),_0x3f590b);throw _0x3f590b;});}return _0x376f8c;})[_0x1420('0x21')](respondWithResult(_0x255e48,0xc9))[_0x1420('0x3f')](handleError(_0x255e48,null));};exports['update']=function(_0x52af5f,_0x56a37e){if(_0x52af5f[_0x1420('0x41')]['id']){delete _0x52af5f[_0x1420('0x41')]['id'];}return db[_0x1420('0x25')][_0x1420('0x1e')]({'where':{'id':_0x52af5f[_0x1420('0x3d')]['id']}})['then'](handleEntityNotFound(_0x56a37e,null))[_0x1420('0x21')](function(_0x50ddb7){if(_0x50ddb7){return db['VoiceExtension']['update'](_[_0x1420('0x32')](_0x52af5f[_0x1420('0x41')],['exten',_0x1420('0x4d'),_0x1420('0x4e'),_0x1420('0x4f'),'cutdigits','mandatoryDisposition',_0x1420('0x50')]),{'where':{'context':_0x50ddb7[_0x1420('0x4d')],'exten':_0x50ddb7['exten']},'individualHooks':!![]})[_0x1420('0x21')](function(_0x55ecd4){return _0x55ecd4;});}return null;})['then'](respondWithStatusCode(_0x56a37e,null))[_0x1420('0x3f')](handleError(_0x56a37e,null));};exports[_0x1420('0x51')]=function(_0x2f1760,_0x5bf072){var _0x5c558e=_0x2f1760[_0x1420('0x3d')]['id'];var _0x103185=_0x2f1760[_0x1420('0x41')];var _0x22094a=0xc8;var _0x81843d=null;return db[_0x1420('0x52')][_0x1420('0x53')]({'isolationLevel':db['sequelize'][_0x1420('0x54')]['ISOLATION_LEVELS'][_0x1420('0x55')]},function(_0x31ef8f){return db[_0x1420('0x25')]['findOne']({'where':{'id':_0x5c558e},'transaction':_0x31ef8f})[_0x1420('0x21')](function(_0x318dad){if(_0x318dad){return db[_0x1420('0x25')][_0x1420('0x12')]({'where':{'VoiceExtensionId':_0x5c558e},'transaction':_0x31ef8f})[_0x1420('0x21')](function(){var _0x4341b5=_[_0x1420('0x1b')](_0x103185,function(_0x3a74d5){_0x3a74d5[_0x1420('0x56')]=_0x5c558e;_0x3a74d5['isApp']=!![];return _0x3a74d5;});return _0x318dad[_0x1420('0x57')](_0x4341b5);})[_0x1420('0x21')](function(_0x194a46){return db[_0x1420('0x25')]['bulkCreate'](_0x194a46,{'transaction':_0x31ef8f});});}else{_0x22094a=0x194;_0x81843d=[];}});})[_0x1420('0x21')](function(){if(_0x22094a!==0x194){return db[_0x1420('0x25')][_0x1420('0x58')]({'where':{'isApp':!![],'VoiceExtensionId':_0x5c558e},'order':_0x1420('0x59')})[_0x1420('0x21')](function(_0x3c3d6b){_0x81843d=_0x3c3d6b;});}})['catch'](function(_0x4f3a9e){_0x22094a=0x1f4;logger[_0x1420('0x4b')](_0x4f3a9e[_0x1420('0x22')]);if(_0x4f3a9e['name']){delete _0x4f3a9e[_0x1420('0x23')];}_0x81843d=_0x4f3a9e;})[_0x1420('0x5a')](function(){if(_0x81843d===null){_0x5bf072['sendStatus'](_0x22094a);}else{if(_0x22094a===0x1f4){_0x5bf072[_0x1420('0xa')](_0x22094a)[_0x1420('0x24')](_0x81843d);}else{_0x5bf072[_0x1420('0xa')](_0x22094a)[_0x1420('0xb')](_0x81843d);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 011173c..2e4e261 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 _0xd4b7=['VoiceExtension','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x48999d,_0x1e02cb){var _0x1ad0d1=function(_0x3f974e){while(--_0x3f974e){_0x48999d['push'](_0x48999d['shift']());}};_0x1ad0d1(++_0x1e02cb);}(_0xd4b7,0x76));var _0x7d4b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd4b7[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x7d4b('0x0'));var VoiceExtension=require(_0x7d4b('0x1'))['db'][_0x7d4b('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x7d4b('0x3')](0x0);var events={'afterCreate':_0x7d4b('0x4'),'afterUpdate':_0x7d4b('0x5'),'afterDestroy':_0x7d4b('0x6')};function emitEvent(_0xa1a404){return function(_0x5bebfe,_0x29a30d,_0x5b6848){VoiceExtensionEvents[_0x7d4b('0x7')](_0xa1a404+':'+_0x5bebfe['id'],_0x5bebfe);VoiceExtensionEvents[_0x7d4b('0x7')](_0xa1a404,_0x5bebfe);_0x5b6848(null);};}for(var e in events){if(events[_0x7d4b('0x8')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0x7d4b('0x9')]=VoiceExtensionEvents; \ No newline at end of file +var _0x60d0=['hook','exports','events','VoiceExtension','update','remove','emit','hasOwnProperty'];(function(_0x23c811,_0x259bfc){var _0x2d2eda=function(_0x2ef492){while(--_0x2ef492){_0x23c811['push'](_0x23c811['shift']());}};_0x2d2eda(++_0x259bfc);}(_0x60d0,0xc2));var _0x060d=function(_0x470218,_0x50613e){_0x470218=_0x470218-0x0;var _0x31883c=_0x60d0[_0x470218];return _0x31883c;};'use strict';var EventEmitter=require(_0x060d('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0x060d('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x060d('0x2'),'afterDestroy':_0x060d('0x3')};function emitEvent(_0x577547){return function(_0x2e5509,_0x8430e3,_0x555d5a){VoiceExtensionEvents[_0x060d('0x4')](_0x577547+':'+_0x2e5509['id'],_0x2e5509);VoiceExtensionEvents[_0x060d('0x4')](_0x577547,_0x2e5509);_0x555d5a(null);};}for(var e in events){if(events[_0x060d('0x5')](e)){var event=events[e];VoiceExtension[_0x060d('0x6')](e,emitEvent(event));}}module[_0x060d('0x7')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index df158dd..265afde 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 _0x65ac=['XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','appdata','priority','last','concat','catch','define','VoiceExtension','voice_extensions','Hangup','./voiceExtension.attributes','exports','models','type','Set','CDR(type)=','context','exten','alias','NoOp','CDR(routeAlias)=','No\x20alias\x20set','inbound','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','outbound','CDR(type)=outbound','CDR(destination)=','${EXTEN:','${EXTEN}','ExecIf','):Goto(','cutdigits','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','url','split','length','param','prefix','phone','SIP','join','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','interval','IntervalId','then','intervals','map','filter','toLowerCase','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','playback','includes','appType','$[${XCALLY-MOTION-PROGRESS}=0]?Progress'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x65ac,0x100));var _0xc65a=function(_0x58afd5,_0x534a48){_0x58afd5=_0x58afd5-0x0;var _0x3e503b=_0x65ac[_0x58afd5];return _0x3e503b;};'use strict';var _=require('lodash');var attributes=require(_0xc65a('0x0'));module[_0xc65a('0x1')]=function(_0x23bc6a){var _0x513bbe=_0x23bc6a[_0xc65a('0x2')];function _0x4ac309(_0x21b561){var _0x5d98ec=0x2;var _0x3d84d6=[{'type':_0x21b561[_0xc65a('0x3')],'app':_0xc65a('0x4'),'appdata':_0xc65a('0x5')+_0x21b561[_0xc65a('0x3')],'context':_0x21b561[_0xc65a('0x6')],'exten':_0x21b561[_0xc65a('0x7')],'priority':_0x5d98ec++,'VoiceExtensionId':_0x21b561['id']},{'type':_0x21b561[_0xc65a('0x3')],'app':_0x21b561[_0xc65a('0x8')]?_0xc65a('0x4'):_0xc65a('0x9'),'appdata':_0x21b561[_0xc65a('0x8')]?_0xc65a('0xa')+_0x21b561[_0xc65a('0x8')]:_0xc65a('0xb'),'context':_0x21b561[_0xc65a('0x6')],'exten':_0x21b561[_0xc65a('0x7')],'priority':_0x5d98ec++,'VoiceExtensionId':_0x21b561['id']}];if(_0x21b561[_0xc65a('0x3')]===_0xc65a('0xc')){_0x3d84d6[_0xc65a('0xd')]({'type':_0xc65a('0xc'),'app':_0xc65a('0x4'),'appdata':_0xc65a('0xe')+_0x21b561['id'],'context':_0x21b561[_0xc65a('0x6')],'exten':_0x21b561[_0xc65a('0x7')],'priority':_0x5d98ec++,'VoiceExtensionId':_0x21b561['id']});}_0x3d84d6['push']({'type':_0x21b561[_0xc65a('0x3')],'app':_0xc65a('0x4'),'appdata':_0xc65a('0xf'),'context':_0x21b561['context'],'exten':_0x21b561['exten'],'priority':_0x5d98ec++,'VoiceExtensionId':_0x21b561['id']},{'type':_0x21b561[_0xc65a('0x3')],'app':_0xc65a('0x4'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x21b561[_0xc65a('0x6')],'exten':_0x21b561['exten'],'priority':_0x5d98ec++,'VoiceExtensionId':_0x21b561['id']},{'type':_0x21b561[_0xc65a('0x3')],'app':_0xc65a('0x4'),'appdata':'MONITOR_OPTIONS=ab','context':_0x21b561[_0xc65a('0x6')],'exten':_0x21b561['exten'],'priority':_0x5d98ec++,'VoiceExtensionId':_0x21b561['id']});return _0x3d84d6;}function _0x1b6821(_0x54f76e){var _0x40e039=0x2;var _0x4aae84=[{'type':_0xc65a('0x10'),'app':_0xc65a('0x4'),'appdata':_0xc65a('0x11'),'context':_0x54f76e[_0xc65a('0x6')],'exten':_0x54f76e[_0xc65a('0x7')],'priority':_0x40e039++,'VoiceExtensionId':_0x54f76e['id']},{'type':_0xc65a('0x10'),'app':_0x54f76e[_0xc65a('0x8')]?_0xc65a('0x4'):_0xc65a('0x9'),'appdata':_0x54f76e[_0xc65a('0x8')]?_0xc65a('0xa')+_0x54f76e[_0xc65a('0x8')]:'No\x20alias\x20set','context':_0x54f76e[_0xc65a('0x6')],'exten':_0x54f76e[_0xc65a('0x7')],'priority':_0x40e039++,'VoiceExtensionId':_0x54f76e['id']},{'type':_0xc65a('0x10'),'app':_0xc65a('0x4'),'appdata':_0xc65a('0x12')+(_0x54f76e['cutdigits']?_0xc65a('0x13')+_0x54f76e['cutdigits']+'}':_0xc65a('0x14')),'context':_0x54f76e[_0xc65a('0x6')],'exten':_0x54f76e[_0xc65a('0x7')],'priority':_0x40e039++,'VoiceExtensionId':_0x54f76e['id']},{'type':_0xc65a('0x10'),'app':_0xc65a('0x4'),'appdata':_0xc65a('0xe')+_0x54f76e['id'],'context':_0x54f76e[_0xc65a('0x6')],'exten':_0x54f76e[_0xc65a('0x7')],'priority':_0x40e039++,'VoiceExtensionId':_0x54f76e['id']},{'type':_0xc65a('0x10'),'app':_0xc65a('0x15'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x40e039+0x2)+_0xc65a('0x16')+(_0x40e039+0x1)+')','context':_0x54f76e[_0xc65a('0x6')],'exten':_0x54f76e['exten'],'priority':_0x40e039++,'VoiceExtensionId':_0x54f76e['id']},{'type':_0xc65a('0x10'),'app':_0xc65a('0x4'),'appdata':_0x54f76e[_0xc65a('0x17')]?_0xc65a('0x18')+_0x54f76e['cutdigits']+'}':_0xc65a('0x19'),'context':_0x54f76e[_0xc65a('0x6')],'exten':_0x54f76e['exten'],'priority':_0x40e039++,'VoiceExtensionId':_0x54f76e['id']},{'type':_0xc65a('0x10'),'app':_0xc65a('0x4'),'appdata':_0xc65a('0xf'),'context':_0x54f76e[_0xc65a('0x6')],'exten':_0x54f76e[_0xc65a('0x7')],'priority':_0x40e039++,'VoiceExtensionId':_0x54f76e['id']},{'type':'outbound','app':_0xc65a('0x4'),'appdata':_0xc65a('0x1a'),'context':_0x54f76e[_0xc65a('0x6')],'exten':_0x54f76e[_0xc65a('0x7')],'priority':_0x40e039++,'VoiceExtensionId':_0x54f76e['id']},{'type':_0xc65a('0x10'),'app':_0xc65a('0x4'),'appdata':_0xc65a('0x1b'),'context':_0x54f76e['context'],'exten':_0x54f76e[_0xc65a('0x7')],'priority':_0x40e039++,'VoiceExtensionId':_0x54f76e['id']},{'type':_0xc65a('0x10'),'app':_0xc65a('0x4'),'appdata':_0xc65a('0x1c')+_0x54f76e['id'],'context':_0x54f76e[_0xc65a('0x6')],'exten':_0x54f76e[_0xc65a('0x7')],'priority':_0x40e039++,'VoiceExtensionId':_0x54f76e['id']}];if(_0x54f76e[_0xc65a('0x1d')](_0xc65a('0x1e'))&&_0x54f76e['recordingFormat']!==_0xc65a('0x1f')){_0x4aae84[_0xc65a('0xd')]({'type':_0xc65a('0x10'),'app':_0xc65a('0x4'),'appdata':_0xc65a('0x20'),'context':_0x54f76e[_0xc65a('0x6')],'exten':_0x54f76e[_0xc65a('0x7')],'priority':_0x40e039++,'VoiceExtensionId':_0x54f76e['id']},{'type':_0xc65a('0x10'),'app':_0xc65a('0x4'),'appdata':_0xc65a('0x21')+_0x54f76e[_0xc65a('0x1e')]||_0xc65a('0x22'),'context':_0x54f76e[_0xc65a('0x6')],'exten':_0x54f76e[_0xc65a('0x7')],'priority':_0x40e039++,'VoiceExtensionId':_0x54f76e['id']});}return _0x4aae84;}function _0x1340db(_0x2c95af,_0x770f35){var _0x5ab435=[{'name':_0xc65a('0x23'),'param':0x0},{'name':_0xc65a('0x24'),'param':0x1},{'name':_0xc65a('0x25'),'param':0x2},{'name':_0xc65a('0x26'),'param':0x3}];var _0x141466={};var _0x2dbca4=_0x770f35[_0xc65a('0x27')](',');var _0x396ef5=[];for(var _0xa1e762=0x0;_0xa1e762<_0x5ab435[_0xc65a('0x28')];_0xa1e762++){switch(_0x5ab435[_0xa1e762]['name']){case _0xc65a('0x23'):_0x141466[_0xc65a('0x23')]=_0x2dbca4[_0x5ab435[_0xa1e762][_0xc65a('0x29')]][_0xc65a('0x27')]('/')[0x1];_0x141466['phone']=_0x2dbca4[_0x5ab435[_0xa1e762][_0xc65a('0x29')]][_0xc65a('0x27')]('/')[0x2];_0x141466[_0xc65a('0x2a')]=_0x141466[_0xc65a('0x2b')]?_0x141466[_0xc65a('0x2b')][_0xc65a('0x27')]('$')[0x0]:undefined;_0x141466[_0xc65a('0x2b')]=_0x2c95af['cutdigits']?(_0x141466[_0xc65a('0x2a')]||'')+_0xc65a('0x13')+_0x2c95af[_0xc65a('0x17')]+'}':(_0x141466[_0xc65a('0x2a')]||'')+_0xc65a('0x14');_0x396ef5[_0x5ab435[_0xa1e762]['param']]=[_0xc65a('0x2c'),_0x141466[_0xc65a('0x23')],_0x141466[_0xc65a('0x2b')]][_0xc65a('0x2d')]('/');break;case _0xc65a('0x25'):_0x141466[_0xc65a('0x25')]=_0x2dbca4[_0x5ab435[_0xa1e762][_0xc65a('0x29')]];if(_0x2c95af[_0xc65a('0x1e')]!==_0xc65a('0x1f')){if(_0x141466['options'][_0xc65a('0x2e')](_0xc65a('0x2f'))<0x0){_0x141466[_0xc65a('0x25')]+=_0xc65a('0x2f');}}else{_0x141466['options']=_0x141466[_0xc65a('0x25')][_0xc65a('0x30')](_0xc65a('0x2f'),'');}_0x396ef5[_0x5ab435[_0xa1e762][_0xc65a('0x29')]]=_0x141466[_0xc65a('0x25')];break;default:_0x396ef5[_0x5ab435[_0xa1e762][_0xc65a('0x29')]]=_0x2dbca4[_0x5ab435[_0xa1e762]['param']];}}return _0x396ef5['join'](',');}function _0x378973(_0x4ce800,_0x12a100,_0x5eef5e){return new Promise(function(_0x13adb2,_0x2df8a5){var _0x4db4ac=[];if(_[_0xc65a('0x31')](_0x12a100))return _0x13adb2(_0x4db4ac);_0x513bbe['Interval']['findAll']({'attributes':['id',_0xc65a('0x32'),_0xc65a('0x33')],'raw':!![]})[_0xc65a('0x34')](function(_0x40116d){for(var _0x950c56=0x0,_0x193af7=0x0;_0x950c56<_0x12a100[_0xc65a('0x28')];_0x950c56++,_0x193af7=0x0){var _0x24baeb=_0x12a100[_0x950c56];var _0x25992d=[];var _0x41696b=[];delete _0x24baeb['id'];if(_0x24baeb[_0xc65a('0x32')]!=='*,*,*,*'){_0x24baeb[_0xc65a('0x35')]=[_0x24baeb[_0xc65a('0x32')]];}else{_0x24baeb['intervals']=_0x24baeb[_0xc65a('0x33')]?_[_0xc65a('0x36')](_[_0xc65a('0x37')](_0x40116d,{'IntervalId':_0x24baeb[_0xc65a('0x33')]}),_0xc65a('0x32')):[];}_0x24baeb[_0xc65a('0x6')]=_0x4ce800[_0xc65a('0x6')];_0x24baeb[_0xc65a('0x7')]=_0x4ce800[_0xc65a('0x7')];if(_0x24baeb[_0xc65a('0x3')])_0x24baeb['type']=_0x24baeb[_0xc65a('0x3')][_0xc65a('0x38')]();if(_0x4ce800[_0xc65a('0x3')]==='outbound'){if(_0x24baeb[_0xc65a('0x1d')]('tag')&&_0x24baeb[_0xc65a('0x39')]&&_0x24baeb[_0xc65a('0x39')]!=='--'){_0x25992d['push']({'type':_0x24baeb[_0xc65a('0x3')][_0xc65a('0x38')](),'app':'Set','appdata':_0xc65a('0x3a')+_0x24baeb[_0xc65a('0x39')],'context':_0x4ce800['context'],'exten':_0x4ce800[_0xc65a('0x7')],'priority':_0x24baeb[_0xc65a('0x35')][_0xc65a('0x28')]+_0x5eef5e+_0x193af7++,'VoiceExtensionId':_0x4ce800['id']});}_0x25992d['push']({'type':_0x24baeb['type'][_0xc65a('0x38')](),'app':_0xc65a('0x15'),'appdata':_0xc65a('0x3b')+(_0x24baeb[_0xc65a('0x3c')]?_0xc65a('0x3d')+_0x24baeb[_0xc65a('0x3c')]+')':_0xc65a('0x3e')),'context':_0x4ce800['context'],'exten':_0x4ce800[_0xc65a('0x7')],'priority':_0x24baeb[_0xc65a('0x35')][_0xc65a('0x28')]+_0x5eef5e+_0x193af7++,'VoiceExtensionId':_0x4ce800['id']});}else{if(_0x24baeb[_0xc65a('0x1d')](_0xc65a('0x3f'))){if(['queue',_0xc65a('0x40')][_0xc65a('0x41')](_0x24baeb['app'][_0xc65a('0x38')]())&&_0x24baeb[_0xc65a('0x42')]!=='custom'){if(_0x24baeb[_0xc65a('0x3f')]){_0x25992d['push']({'type':_0x24baeb[_0xc65a('0x3')][_0xc65a('0x38')](),'app':'ExecIf','appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x4ce800[_0xc65a('0x6')],'exten':_0x4ce800[_0xc65a('0x7')],'priority':_0x24baeb[_0xc65a('0x35')]['length']+_0x5eef5e+_0x193af7++,'VoiceExtensionId':_0x4ce800['id']});_0x25992d['push']({'type':_0x24baeb['type'][_0xc65a('0x38')](),'app':_0xc65a('0x4'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x4ce800[_0xc65a('0x6')],'exten':_0x4ce800[_0xc65a('0x7')],'priority':_0x24baeb[_0xc65a('0x35')]['length']+_0x5eef5e+_0x193af7++,'VoiceExtensionId':_0x4ce800['id']});}else{_0x25992d[_0xc65a('0xd')]({'type':_0x24baeb[_0xc65a('0x3')][_0xc65a('0x38')](),'app':_0xc65a('0x15'),'appdata':_0xc65a('0x43'),'context':_0x4ce800[_0xc65a('0x6')],'exten':_0x4ce800['exten'],'priority':_0x24baeb['intervals'][_0xc65a('0x28')]+_0x5eef5e+_0x193af7++,'VoiceExtensionId':_0x4ce800['id']});_0x25992d[_0xc65a('0xd')]({'type':_0x24baeb['type'][_0xc65a('0x38')](),'app':_0xc65a('0x4'),'appdata':_0xc65a('0x44'),'context':_0x4ce800['context'],'exten':_0x4ce800[_0xc65a('0x7')],'priority':_0x24baeb[_0xc65a('0x35')][_0xc65a('0x28')]+_0x5eef5e+_0x193af7++,'VoiceExtensionId':_0x4ce800['id']});}}}}for(var _0x287c91=0x0;_0x287c91<_0x24baeb[_0xc65a('0x35')][_0xc65a('0x28')];_0x287c91++){var _0x56a19e=_0x5eef5e+_0x24baeb[_0xc65a('0x35')][_0xc65a('0x28')];var _0x5db8c5=_0x287c91===_0x24baeb[_0xc65a('0x35')][_0xc65a('0x28')]-0x1?_0x5eef5e+_0x25992d[_0xc65a('0x28')]+_0x41696b[_0xc65a('0x28')]+0x2:_0x5eef5e+_0x287c91+0x1;_0x25992d[_0xc65a('0x45')](_0x287c91,0x0,{'type':_0x4ce800['type'],'app':_0xc65a('0x46'),'appdata':_0x24baeb['intervals'][_0x287c91]+'?'+_0x4ce800[_0xc65a('0x6')]+',${EXTEN},'+_0x56a19e+':'+_0x4ce800[_0xc65a('0x6')]+_0xc65a('0x47')+_0x5db8c5,'exten':_0x4ce800[_0xc65a('0x7')],'context':_0x4ce800['context'],'priority':_0x5eef5e+_0x287c91,'VoiceExtensionId':_0x4ce800['id']});}if(_0x24baeb[_0xc65a('0x42')]==='outboundDial')_0x24baeb[_0xc65a('0x48')]=_0x1340db(_0x4ce800,_0x24baeb[_0xc65a('0x48')]);_0x24baeb[_0xc65a('0x49')]=_0x25992d[_0xc65a('0x28')]?_[_0xc65a('0x4a')](_0x25992d)[_0xc65a('0x49')]+0x1:_0x5eef5e;_0x4db4ac=_[_0xc65a('0x4b')](_0x4db4ac,_0x25992d,[_0x24baeb],_0x41696b);_0x5eef5e=_['last'](_0x4db4ac)[_0xc65a('0x49')]+0x1;}return _0x13adb2(_0x4db4ac);})[_0xc65a('0x4c')](function(_0x23b73d){_0x2df8a5(_0x23b73d);});});}return _0x23bc6a[_0xc65a('0x4d')](_0xc65a('0x4e'),attributes,{'tableName':_0xc65a('0x4f'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x12d4df){var _0xd29bef=this['get']({'plain':!![]});var _0x4f377f=_0xd29bef['type']===_0xc65a('0x10')?_0x1b6821(_0xd29bef):_0x4ac309(_0xd29bef);return _0x378973(_0xd29bef,_0x12d4df,_['last'](_0x4f377f)['priority']+0x1)[_0xc65a('0x34')](function(_0x45c1b7){var _0x45356b=_[_0xc65a('0x4b')](_0x4f377f,_0x45c1b7);_0x45356b['push']({'type':_0xd29bef[_0xc65a('0x3')],'app':_0xc65a('0x50'),'exten':_0xd29bef['exten'],'context':_0xd29bef[_0xc65a('0x6')],'priority':_[_0xc65a('0x4a')](_0x45356b)[_0xc65a('0x49')]+0x1,'VoiceExtensionId':_0xd29bef['id']});return _0x45356b;});}}});}; \ No newline at end of file +var _0x95d9=['exten','alias','NoOp','No\x20alias\x20set','context','inbound','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','cutdigits','${EXTEN}','ExecIf','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','url','split','param','phone','prefix','SIP','join','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','findAll','interval','length','intervals','IntervalId','map','filter','toLowerCase','hasOwnProperty','tag','CDR(tag)=','push','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','NoOp(No\x20number\x20available)','answer','queue','app','appType','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','outboundDial','appdata','priority','concat','catch','define','VoiceExtension','get','last','then','Hangup','lodash','./voiceExtension.attributes','exports','models','type','Set','CDR(type)='];(function(_0x5796bf,_0x4f1e83){var _0x4b2d40=function(_0x3a378f){while(--_0x3a378f){_0x5796bf['push'](_0x5796bf['shift']());}};_0x4b2d40(++_0x4f1e83);}(_0x95d9,0x97));var _0x995d=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0x95d9[_0x341e0f];return _0x59555a;};'use strict';var _=require(_0x995d('0x0'));var attributes=require(_0x995d('0x1'));module[_0x995d('0x2')]=function(_0xb29ff5){var _0x568331=_0xb29ff5[_0x995d('0x3')];function _0x3b9a11(_0x1932c3){var _0x5b44d3=0x2;var _0x225c17=[{'type':_0x1932c3[_0x995d('0x4')],'app':_0x995d('0x5'),'appdata':_0x995d('0x6')+_0x1932c3[_0x995d('0x4')],'context':_0x1932c3['context'],'exten':_0x1932c3[_0x995d('0x7')],'priority':_0x5b44d3++,'VoiceExtensionId':_0x1932c3['id']},{'type':_0x1932c3[_0x995d('0x4')],'app':_0x1932c3[_0x995d('0x8')]?_0x995d('0x5'):_0x995d('0x9'),'appdata':_0x1932c3[_0x995d('0x8')]?'CDR(routeAlias)='+_0x1932c3[_0x995d('0x8')]:_0x995d('0xa'),'context':_0x1932c3[_0x995d('0xb')],'exten':_0x1932c3['exten'],'priority':_0x5b44d3++,'VoiceExtensionId':_0x1932c3['id']}];if(_0x1932c3['type']==='inbound'){_0x225c17['push']({'type':_0x995d('0xc'),'app':_0x995d('0x5'),'appdata':_0x995d('0xd')+_0x1932c3['id'],'context':_0x1932c3[_0x995d('0xb')],'exten':_0x1932c3[_0x995d('0x7')],'priority':_0x5b44d3++,'VoiceExtensionId':_0x1932c3['id']});}_0x225c17['push']({'type':_0x1932c3[_0x995d('0x4')],'app':_0x995d('0x5'),'appdata':_0x995d('0xe'),'context':_0x1932c3[_0x995d('0xb')],'exten':_0x1932c3['exten'],'priority':_0x5b44d3++,'VoiceExtensionId':_0x1932c3['id']},{'type':_0x1932c3[_0x995d('0x4')],'app':'Set','appdata':_0x995d('0xf'),'context':_0x1932c3['context'],'exten':_0x1932c3['exten'],'priority':_0x5b44d3++,'VoiceExtensionId':_0x1932c3['id']},{'type':_0x1932c3[_0x995d('0x4')],'app':_0x995d('0x5'),'appdata':_0x995d('0x10'),'context':_0x1932c3[_0x995d('0xb')],'exten':_0x1932c3[_0x995d('0x7')],'priority':_0x5b44d3++,'VoiceExtensionId':_0x1932c3['id']});return _0x225c17;}function _0x183e0c(_0xb99ec5){var _0x294efb=0x2;var _0x29a643=[{'type':_0x995d('0x11'),'app':_0x995d('0x5'),'appdata':_0x995d('0x12'),'context':_0xb99ec5[_0x995d('0xb')],'exten':_0xb99ec5[_0x995d('0x7')],'priority':_0x294efb++,'VoiceExtensionId':_0xb99ec5['id']},{'type':_0x995d('0x11'),'app':_0xb99ec5[_0x995d('0x8')]?_0x995d('0x5'):_0x995d('0x9'),'appdata':_0xb99ec5[_0x995d('0x8')]?'CDR(routeAlias)='+_0xb99ec5[_0x995d('0x8')]:_0x995d('0xa'),'context':_0xb99ec5['context'],'exten':_0xb99ec5[_0x995d('0x7')],'priority':_0x294efb++,'VoiceExtensionId':_0xb99ec5['id']},{'type':_0x995d('0x11'),'app':_0x995d('0x5'),'appdata':'CDR(destination)='+(_0xb99ec5[_0x995d('0x13')]?'${EXTEN:'+_0xb99ec5[_0x995d('0x13')]+'}':_0x995d('0x14')),'context':_0xb99ec5[_0x995d('0xb')],'exten':_0xb99ec5[_0x995d('0x7')],'priority':_0x294efb++,'VoiceExtensionId':_0xb99ec5['id']},{'type':_0x995d('0x11'),'app':'Set','appdata':_0x995d('0xd')+_0xb99ec5['id'],'context':_0xb99ec5[_0x995d('0xb')],'exten':_0xb99ec5['exten'],'priority':_0x294efb++,'VoiceExtensionId':_0xb99ec5['id']},{'type':'outbound','app':_0x995d('0x15'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x294efb+0x2)+'):Goto('+(_0x294efb+0x1)+')','context':_0xb99ec5['context'],'exten':_0xb99ec5[_0x995d('0x7')],'priority':_0x294efb++,'VoiceExtensionId':_0xb99ec5['id']},{'type':_0x995d('0x11'),'app':_0x995d('0x5'),'appdata':_0xb99ec5[_0x995d('0x13')]?_0x995d('0x16')+_0xb99ec5['cutdigits']+'}':_0x995d('0x17'),'context':_0xb99ec5[_0x995d('0xb')],'exten':_0xb99ec5[_0x995d('0x7')],'priority':_0x294efb++,'VoiceExtensionId':_0xb99ec5['id']},{'type':_0x995d('0x11'),'app':'Set','appdata':_0x995d('0xe'),'context':_0xb99ec5[_0x995d('0xb')],'exten':_0xb99ec5['exten'],'priority':_0x294efb++,'VoiceExtensionId':_0xb99ec5['id']},{'type':_0x995d('0x11'),'app':_0x995d('0x5'),'appdata':_0x995d('0xf'),'context':_0xb99ec5[_0x995d('0xb')],'exten':_0xb99ec5[_0x995d('0x7')],'priority':_0x294efb++,'VoiceExtensionId':_0xb99ec5['id']},{'type':_0x995d('0x11'),'app':'Set','appdata':'MONITOR_OPTIONS=ab','context':_0xb99ec5[_0x995d('0xb')],'exten':_0xb99ec5['exten'],'priority':_0x294efb++,'VoiceExtensionId':_0xb99ec5['id']},{'type':_0x995d('0x11'),'app':_0x995d('0x5'),'appdata':_0x995d('0x18')+_0xb99ec5['id'],'context':_0xb99ec5[_0x995d('0xb')],'exten':_0xb99ec5[_0x995d('0x7')],'priority':_0x294efb++,'VoiceExtensionId':_0xb99ec5['id']}];if(_0xb99ec5['hasOwnProperty'](_0x995d('0x19'))&&_0xb99ec5[_0x995d('0x19')]!==_0x995d('0x1a')){_0x29a643['push']({'type':_0x995d('0x11'),'app':'Set','appdata':_0x995d('0x1b'),'context':_0xb99ec5[_0x995d('0xb')],'exten':_0xb99ec5[_0x995d('0x7')],'priority':_0x294efb++,'VoiceExtensionId':_0xb99ec5['id']},{'type':_0x995d('0x11'),'app':_0x995d('0x5'),'appdata':_0x995d('0x1c')+_0xb99ec5[_0x995d('0x19')]||_0x995d('0x1d'),'context':_0xb99ec5[_0x995d('0xb')],'exten':_0xb99ec5[_0x995d('0x7')],'priority':_0x294efb++,'VoiceExtensionId':_0xb99ec5['id']});}return _0x29a643;}function _0x38430e(_0xffe49a,_0x383ea4){var _0x27e238=[{'name':_0x995d('0x1e'),'param':0x0},{'name':_0x995d('0x1f'),'param':0x1},{'name':_0x995d('0x20'),'param':0x2},{'name':_0x995d('0x21'),'param':0x3}];var _0x57ce35={};var _0x7c9b59=_0x383ea4[_0x995d('0x22')](',');var _0x2dcd8a=[];for(var _0x540139=0x0;_0x540139<_0x27e238['length'];_0x540139++){switch(_0x27e238[_0x540139]['name']){case'trunk':_0x57ce35[_0x995d('0x1e')]=_0x7c9b59[_0x27e238[_0x540139][_0x995d('0x23')]][_0x995d('0x22')]('/')[0x1];_0x57ce35[_0x995d('0x24')]=_0x7c9b59[_0x27e238[_0x540139]['param']][_0x995d('0x22')]('/')[0x2];_0x57ce35[_0x995d('0x25')]=_0x57ce35['phone']?_0x57ce35[_0x995d('0x24')][_0x995d('0x22')]('$')[0x0]:undefined;_0x57ce35[_0x995d('0x24')]=_0xffe49a[_0x995d('0x13')]?(_0x57ce35[_0x995d('0x25')]||'')+'${EXTEN:'+_0xffe49a[_0x995d('0x13')]+'}':(_0x57ce35['prefix']||'')+_0x995d('0x14');_0x2dcd8a[_0x27e238[_0x540139][_0x995d('0x23')]]=[_0x995d('0x26'),_0x57ce35[_0x995d('0x1e')],_0x57ce35[_0x995d('0x24')]][_0x995d('0x27')]('/');break;case _0x995d('0x20'):_0x57ce35[_0x995d('0x20')]=_0x7c9b59[_0x27e238[_0x540139]['param']];if(_0xffe49a[_0x995d('0x19')]!==_0x995d('0x1a')){if(_0x57ce35[_0x995d('0x20')]['indexOf'](_0x995d('0x28'))<0x0){_0x57ce35[_0x995d('0x20')]+=_0x995d('0x28');}}else{_0x57ce35[_0x995d('0x20')]=_0x57ce35[_0x995d('0x20')][_0x995d('0x29')](_0x995d('0x28'),'');}_0x2dcd8a[_0x27e238[_0x540139][_0x995d('0x23')]]=_0x57ce35['options'];break;default:_0x2dcd8a[_0x27e238[_0x540139]['param']]=_0x7c9b59[_0x27e238[_0x540139][_0x995d('0x23')]];}}return _0x2dcd8a[_0x995d('0x27')](',');}function _0x5e8485(_0x5efe57,_0x39815e,_0x17ec4c){return new Promise(function(_0xafb93d,_0x50c61e){var _0x1c6f2c=[];if(_[_0x995d('0x2a')](_0x39815e))return _0xafb93d(_0x1c6f2c);_0x568331[_0x995d('0x2b')][_0x995d('0x2c')]({'attributes':['id',_0x995d('0x2d'),'IntervalId'],'raw':!![]})['then'](function(_0x2bce82){for(var _0x37d47c=0x0,_0x1d81e1=0x0;_0x37d47c<_0x39815e[_0x995d('0x2e')];_0x37d47c++,_0x1d81e1=0x0){var _0x2f7192=_0x39815e[_0x37d47c];var _0x5d558d=[];var _0x1fe4c5=[];delete _0x2f7192['id'];if(_0x2f7192['interval']!=='*,*,*,*'){_0x2f7192[_0x995d('0x2f')]=[_0x2f7192[_0x995d('0x2d')]];}else{_0x2f7192[_0x995d('0x2f')]=_0x2f7192[_0x995d('0x30')]?_[_0x995d('0x31')](_[_0x995d('0x32')](_0x2bce82,{'IntervalId':_0x2f7192[_0x995d('0x30')]}),'interval'):[];}_0x2f7192[_0x995d('0xb')]=_0x5efe57[_0x995d('0xb')];_0x2f7192[_0x995d('0x7')]=_0x5efe57[_0x995d('0x7')];if(_0x2f7192[_0x995d('0x4')])_0x2f7192[_0x995d('0x4')]=_0x2f7192[_0x995d('0x4')][_0x995d('0x33')]();if(_0x5efe57[_0x995d('0x4')]==='outbound'){if(_0x2f7192[_0x995d('0x34')]('tag')&&_0x2f7192[_0x995d('0x35')]&&_0x2f7192[_0x995d('0x35')]!=='--'){_0x5d558d['push']({'type':_0x2f7192[_0x995d('0x4')][_0x995d('0x33')](),'app':'Set','appdata':_0x995d('0x36')+_0x2f7192[_0x995d('0x35')],'context':_0x5efe57[_0x995d('0xb')],'exten':_0x5efe57[_0x995d('0x7')],'priority':_0x2f7192['intervals'][_0x995d('0x2e')]+_0x17ec4c+_0x1d81e1++,'VoiceExtensionId':_0x5efe57['id']});}_0x5d558d[_0x995d('0x37')]({'type':_0x2f7192[_0x995d('0x4')][_0x995d('0x33')](),'app':_0x995d('0x15'),'appdata':_0x995d('0x38')+(_0x2f7192[_0x995d('0x39')]?'Set(CALLERID(all)='+_0x2f7192[_0x995d('0x39')]+')':_0x995d('0x3a')),'context':_0x5efe57[_0x995d('0xb')],'exten':_0x5efe57[_0x995d('0x7')],'priority':_0x2f7192[_0x995d('0x2f')]['length']+_0x17ec4c+_0x1d81e1++,'VoiceExtensionId':_0x5efe57['id']});}else{if(_0x2f7192[_0x995d('0x34')](_0x995d('0x3b'))){if([_0x995d('0x3c'),'playback']['includes'](_0x2f7192[_0x995d('0x3d')][_0x995d('0x33')]())&&_0x2f7192[_0x995d('0x3e')]!=='custom'){if(_0x2f7192['answer']){_0x5d558d['push']({'type':_0x2f7192[_0x995d('0x4')][_0x995d('0x33')](),'app':'ExecIf','appdata':_0x995d('0x3f'),'context':_0x5efe57[_0x995d('0xb')],'exten':_0x5efe57[_0x995d('0x7')],'priority':_0x2f7192['intervals'][_0x995d('0x2e')]+_0x17ec4c+_0x1d81e1++,'VoiceExtensionId':_0x5efe57['id']});_0x5d558d[_0x995d('0x37')]({'type':_0x2f7192[_0x995d('0x4')][_0x995d('0x33')](),'app':_0x995d('0x5'),'appdata':_0x995d('0x40'),'context':_0x5efe57[_0x995d('0xb')],'exten':_0x5efe57[_0x995d('0x7')],'priority':_0x2f7192['intervals'][_0x995d('0x2e')]+_0x17ec4c+_0x1d81e1++,'VoiceExtensionId':_0x5efe57['id']});}else{_0x5d558d[_0x995d('0x37')]({'type':_0x2f7192[_0x995d('0x4')]['toLowerCase'](),'app':_0x995d('0x15'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x5efe57[_0x995d('0xb')],'exten':_0x5efe57['exten'],'priority':_0x2f7192[_0x995d('0x2f')][_0x995d('0x2e')]+_0x17ec4c+_0x1d81e1++,'VoiceExtensionId':_0x5efe57['id']});_0x5d558d[_0x995d('0x37')]({'type':_0x2f7192[_0x995d('0x4')][_0x995d('0x33')](),'app':'Set','appdata':_0x995d('0x41'),'context':_0x5efe57[_0x995d('0xb')],'exten':_0x5efe57['exten'],'priority':_0x2f7192['intervals']['length']+_0x17ec4c+_0x1d81e1++,'VoiceExtensionId':_0x5efe57['id']});}}}}for(var _0x79f26a=0x0;_0x79f26a<_0x2f7192[_0x995d('0x2f')][_0x995d('0x2e')];_0x79f26a++){var _0x1c1722=_0x17ec4c+_0x2f7192['intervals']['length'];var _0x456c6c=_0x79f26a===_0x2f7192[_0x995d('0x2f')]['length']-0x1?_0x17ec4c+_0x5d558d['length']+_0x1fe4c5[_0x995d('0x2e')]+0x2:_0x17ec4c+_0x79f26a+0x1;_0x5d558d[_0x995d('0x42')](_0x79f26a,0x0,{'type':_0x5efe57[_0x995d('0x4')],'app':'GotoIfTime','appdata':_0x2f7192[_0x995d('0x2f')][_0x79f26a]+'?'+_0x5efe57[_0x995d('0xb')]+_0x995d('0x43')+_0x1c1722+':'+_0x5efe57['context']+_0x995d('0x43')+_0x456c6c,'exten':_0x5efe57[_0x995d('0x7')],'context':_0x5efe57['context'],'priority':_0x17ec4c+_0x79f26a,'VoiceExtensionId':_0x5efe57['id']});}if(_0x2f7192[_0x995d('0x3e')]===_0x995d('0x44'))_0x2f7192[_0x995d('0x45')]=_0x38430e(_0x5efe57,_0x2f7192[_0x995d('0x45')]);_0x2f7192['priority']=_0x5d558d[_0x995d('0x2e')]?_['last'](_0x5d558d)[_0x995d('0x46')]+0x1:_0x17ec4c;_0x1c6f2c=_[_0x995d('0x47')](_0x1c6f2c,_0x5d558d,[_0x2f7192],_0x1fe4c5);_0x17ec4c=_['last'](_0x1c6f2c)[_0x995d('0x46')]+0x1;}return _0xafb93d(_0x1c6f2c);})[_0x995d('0x48')](function(_0xf275fc){_0x50c61e(_0xf275fc);});});}return _0xb29ff5[_0x995d('0x49')](_0x995d('0x4a'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0xf72ed3){var _0x20aee4=this[_0x995d('0x4b')]({'plain':!![]});var _0x3953fb=_0x20aee4[_0x995d('0x4')]===_0x995d('0x11')?_0x183e0c(_0x20aee4):_0x3b9a11(_0x20aee4);return _0x5e8485(_0x20aee4,_0xf72ed3,_[_0x995d('0x4c')](_0x3953fb)['priority']+0x1)[_0x995d('0x4d')](function(_0x4a8965){var _0x57b530=_[_0x995d('0x47')](_0x3953fb,_0x4a8965);_0x57b530[_0x995d('0x37')]({'type':_0x20aee4['type'],'app':_0x995d('0x4e'),'exten':_0x20aee4[_0x995d('0x7')],'context':_0x20aee4['context'],'priority':_[_0x995d('0x4c')](_0x57b530)[_0x995d('0x46')]+0x1,'VoiceExtensionId':_0x20aee4['id']});return _0x57b530;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index c7f77b5..1fc8e3e 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 _0x8085=['catch','options','raw','where','attributes','limit','map','include','model','GetVoiceExtension','stringify','lodash','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x210603,_0x4adbac){var _0x1bcb7d=function(_0x2cdf89){while(--_0x2cdf89){_0x210603['push'](_0x210603['shift']());}};_0x1bcb7d(++_0x4adbac);}(_0x8085,0x71));var _0x5808=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x8085[_0x255d5b];return _0x3e141a;};'use strict';var _=require(_0x5808('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5808('0x1'));var rs=require(_0x5808('0x2'));var fs=require('fs');var Redis=require(_0x5808('0x3'));var db=require(_0x5808('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5808('0x5'));var config=require(_0x5808('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x5808('0x7')][_0x5808('0x8')]({'port':0x232a});config[_0x5808('0x9')]=_[_0x5808('0xa')](config[_0x5808('0x9')],{'host':_0x5808('0xb'),'port':0x18eb});var socket=require(_0x5808('0xc'))(new Redis(config[_0x5808('0x9')]));require(_0x5808('0xd'))[_0x5808('0xe')](socket);function respondWithRpcPromise(_0x54ab63,_0x422c41,_0x42099d){return new BPromise(function(_0xd55e7d,_0x16d194){return client['request'](_0x54ab63,_0x42099d)['then'](function(_0x3c056e){logger[_0x5808('0xf')](_0x5808('0x10'),_0x422c41,_0x5808('0x11'));logger[_0x5808('0x12')](_0x5808('0x13'),_0x422c41,_0x5808('0x11'),JSON['stringify'](_0x3c056e));if(_0x3c056e['error']){if(_0x3c056e[_0x5808('0x14')][_0x5808('0x15')]===0x1f4){logger[_0x5808('0x14')](_0x5808('0x10'),_0x422c41,_0x3c056e[_0x5808('0x14')][_0x5808('0x16')]);return _0x16d194(_0x3c056e[_0x5808('0x14')][_0x5808('0x16')]);}logger[_0x5808('0x14')](_0x5808('0x10'),_0x422c41,_0x3c056e[_0x5808('0x14')]['message']);return _0xd55e7d(_0x3c056e[_0x5808('0x14')]['message']);}else{logger[_0x5808('0xf')](_0x5808('0x10'),_0x422c41,_0x5808('0x11'));_0xd55e7d(_0x3c056e['result'][_0x5808('0x16')]);}})[_0x5808('0x17')](function(_0x5386eb){logger['error'](_0x5808('0x10'),_0x422c41,_0x5386eb);_0x16d194(_0x5386eb);});});}exports['GetVoiceExtension']=function(_0x40cfbd){var _0x3c0937=this;return new Promise(function(_0x480165,_0xaac16a){return db['VoiceExtension']['findAll']({'raw':_0x40cfbd[_0x5808('0x18')]?_0x40cfbd[_0x5808('0x18')][_0x5808('0x19')]===undefined?!![]:![]:!![],'where':_0x40cfbd[_0x5808('0x18')]?_0x40cfbd[_0x5808('0x18')][_0x5808('0x1a')]||null:null,'attributes':_0x40cfbd[_0x5808('0x18')]?_0x40cfbd[_0x5808('0x18')][_0x5808('0x1b')]||null:null,'limit':_0x40cfbd['options']?_0x40cfbd['options'][_0x5808('0x1c')]||null:null,'include':_0x40cfbd[_0x5808('0x18')]?_0x40cfbd['options']['include']?_[_0x5808('0x1d')](_0x40cfbd[_0x5808('0x18')][_0x5808('0x1e')],function(_0x4a4d05){return{'model':db[_0x4a4d05['model']],'as':_0x4a4d05['as'],'attributes':_0x4a4d05[_0x5808('0x1b')],'include':_0x4a4d05[_0x5808('0x1e')]?_[_0x5808('0x1d')](_0x4a4d05[_0x5808('0x1e')],function(_0x1da724){return{'model':db[_0x1da724['model']],'as':_0x1da724['as'],'attributes':_0x1da724[_0x5808('0x1b')],'include':_0x1da724[_0x5808('0x1e')]?_[_0x5808('0x1d')](_0x1da724[_0x5808('0x1e')],function(_0x28c1eb){return{'model':db[_0x28c1eb[_0x5808('0x1f')]],'as':_0x28c1eb['as'],'attributes':_0x28c1eb[_0x5808('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x560e83){logger[_0x5808('0xf')](_0x5808('0x20'),_0x40cfbd);logger[_0x5808('0x12')]('GetVoiceExtension',_0x40cfbd,JSON[_0x5808('0x21')](_0x560e83));_0x480165(_0x560e83);})[_0x5808('0x17')](function(_0x269810){logger[_0x5808('0x14')](_0x5808('0x20'),_0x269810[_0x5808('0x16')],_0x40cfbd);_0xaac16a(_0x3c0937['error'](0x1f4,_0x269810[_0x5808('0x16')]));});});}; \ No newline at end of file +var _0x1b65=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','register','request','then','VoiceExtension,\x20%s,\x20%s','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','limit','include','map','model','attributes','debug','catch','lodash','util','moment','bluebird'];(function(_0x29c261,_0x3af39a){var _0x1a9335=function(_0x40d1e8){while(--_0x40d1e8){_0x29c261['push'](_0x29c261['shift']());}};_0x1a9335(++_0x3af39a);}(_0x1b65,0x1b4));var _0x51b6=function(_0x1ab178,_0x2fdb60){_0x1ab178=_0x1ab178-0x0;var _0x339a4d=_0x1b65[_0x1ab178];return _0x339a4d;};'use strict';var _=require(_0x51b6('0x0'));var util=require(_0x51b6('0x1'));var moment=require(_0x51b6('0x2'));var BPromise=require(_0x51b6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x51b6('0x4'));var db=require(_0x51b6('0x5'))['db'];var utils=require(_0x51b6('0x6'));var logger=require(_0x51b6('0x7'))(_0x51b6('0x8'));var config=require(_0x51b6('0x9'));var jayson=require(_0x51b6('0xa'));var client=jayson['client'][_0x51b6('0xb')]({'port':0x232a});config[_0x51b6('0xc')]=_[_0x51b6('0xd')](config[_0x51b6('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x51b6('0xe'))(new Redis(config[_0x51b6('0xc')]));require('./voiceExtension.socket')[_0x51b6('0xf')](socket);function respondWithRpcPromise(_0x5a84a2,_0x5e688b,_0x1cf35d){return new BPromise(function(_0x2ecf16,_0xd44293){return client[_0x51b6('0x10')](_0x5a84a2,_0x1cf35d)[_0x51b6('0x11')](function(_0x5f0c78){logger['info'](_0x51b6('0x12'),_0x5e688b,'request\x20sent');logger['debug'](_0x51b6('0x13'),_0x5e688b,'request\x20sent',JSON[_0x51b6('0x14')](_0x5f0c78));if(_0x5f0c78['error']){if(_0x5f0c78[_0x51b6('0x15')][_0x51b6('0x16')]===0x1f4){logger[_0x51b6('0x15')](_0x51b6('0x12'),_0x5e688b,_0x5f0c78[_0x51b6('0x15')][_0x51b6('0x17')]);return _0xd44293(_0x5f0c78['error'][_0x51b6('0x17')]);}logger[_0x51b6('0x15')](_0x51b6('0x12'),_0x5e688b,_0x5f0c78['error'][_0x51b6('0x17')]);return _0x2ecf16(_0x5f0c78['error'][_0x51b6('0x17')]);}else{logger[_0x51b6('0x18')](_0x51b6('0x12'),_0x5e688b,_0x51b6('0x19'));_0x2ecf16(_0x5f0c78[_0x51b6('0x1a')][_0x51b6('0x17')]);}})['catch'](function(_0x3d883e){logger['error'](_0x51b6('0x12'),_0x5e688b,_0x3d883e);_0xd44293(_0x3d883e);});});}exports[_0x51b6('0x1b')]=function(_0x506367){var _0x3e2d90=this;return new Promise(function(_0x25b96d,_0x3fee21){return db[_0x51b6('0x1c')][_0x51b6('0x1d')]({'raw':_0x506367[_0x51b6('0x1e')]?_0x506367[_0x51b6('0x1e')][_0x51b6('0x1f')]===undefined?!![]:![]:!![],'where':_0x506367['options']?_0x506367[_0x51b6('0x1e')][_0x51b6('0x20')]||null:null,'attributes':_0x506367[_0x51b6('0x1e')]?_0x506367[_0x51b6('0x1e')]['attributes']||null:null,'limit':_0x506367[_0x51b6('0x1e')]?_0x506367[_0x51b6('0x1e')][_0x51b6('0x21')]||null:null,'include':_0x506367['options']?_0x506367[_0x51b6('0x1e')][_0x51b6('0x22')]?_[_0x51b6('0x23')](_0x506367['options']['include'],function(_0x22b91b){return{'model':db[_0x22b91b[_0x51b6('0x24')]],'as':_0x22b91b['as'],'attributes':_0x22b91b[_0x51b6('0x25')],'include':_0x22b91b['include']?_[_0x51b6('0x23')](_0x22b91b[_0x51b6('0x22')],function(_0x5a8a5b){return{'model':db[_0x5a8a5b[_0x51b6('0x24')]],'as':_0x5a8a5b['as'],'attributes':_0x5a8a5b[_0x51b6('0x25')],'include':_0x5a8a5b[_0x51b6('0x22')]?_[_0x51b6('0x23')](_0x5a8a5b[_0x51b6('0x22')],function(_0x51b505){return{'model':db[_0x51b505[_0x51b6('0x24')]],'as':_0x51b505['as'],'attributes':_0x51b505[_0x51b6('0x25')]};}):[]};}):[]};}):[]:[]})[_0x51b6('0x11')](function(_0x48eb13){logger[_0x51b6('0x18')](_0x51b6('0x1b'),_0x506367);logger[_0x51b6('0x26')](_0x51b6('0x1b'),_0x506367,JSON['stringify'](_0x48eb13));_0x25b96d(_0x48eb13);})[_0x51b6('0x27')](function(_0x56532b){logger[_0x51b6('0x15')](_0x51b6('0x1b'),_0x56532b['message'],_0x506367);_0x3fee21(_0x3e2d90['error'](0x1f4,_0x56532b[_0x51b6('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 135d919..5457778 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 _0x1261=['save','remove','update','emit','removeListener','voiceExtension:'];(function(_0x1390cf,_0x261dd5){var _0x3e8356=function(_0x4bba98){while(--_0x4bba98){_0x1390cf['push'](_0x1390cf['shift']());}};_0x3e8356(++_0x261dd5);}(_0x1261,0x144));var _0x1126=function(_0x788a54,_0x12450b){_0x788a54=_0x788a54-0x0;var _0x8b73a4=_0x1261[_0x788a54];return _0x8b73a4;};'use strict';var VoiceExtensionEvents=require('./voiceExtension.events');var events=[_0x1126('0x0'),_0x1126('0x1'),_0x1126('0x2')];function createListener(_0x331a2c,_0x39b786){return function(_0x350f3a){_0x39b786[_0x1126('0x3')](_0x331a2c,_0x350f3a);};}function removeListener(_0x4245ca,_0x21a480){return function(){VoiceExtensionEvents[_0x1126('0x4')](_0x4245ca,_0x21a480);};}exports['register']=function(_0x5c68c8){for(var _0x40ba58=0x0,_0x907180=events['length'];_0x40ba58<_0x907180;_0x40ba58++){var _0x17e5f0=events[_0x40ba58];var _0x28772d=createListener(_0x1126('0x5')+_0x17e5f0,_0x5c68c8);VoiceExtensionEvents['on'](_0x17e5f0,_0x28772d);}}; \ No newline at end of file +var _0x326f=['update','emit','removeListener','register','length','./voiceExtension.events'];(function(_0x327bb8,_0xa21646){var _0x40e1c4=function(_0x4efa28){while(--_0x4efa28){_0x327bb8['push'](_0x327bb8['shift']());}};_0x40e1c4(++_0xa21646);}(_0x326f,0xd1));var _0xf326=function(_0x517082,_0xc7d3e8){_0x517082=_0x517082-0x0;var _0x546057=_0x326f[_0x517082];return _0x546057;};'use strict';var VoiceExtensionEvents=require(_0xf326('0x0'));var events=['save','remove',_0xf326('0x1')];function createListener(_0x330ddb,_0x22aabf){return function(_0x408257){_0x22aabf[_0xf326('0x2')](_0x330ddb,_0x408257);};}function removeListener(_0x120a26,_0x9445c6){return function(){VoiceExtensionEvents[_0xf326('0x3')](_0x120a26,_0x9445c6);};}exports[_0xf326('0x4')]=function(_0x3ace29){for(var _0x4c2249=0x0,_0x3c254d=events[_0xf326('0x5')];_0x4c2249<_0x3c254d;_0x4c2249++){var _0x165f95=events[_0x4c2249];var _0x1e7b8a=createListener('voiceExtension:'+_0x165f95,_0x3ace29);VoiceExtensionEvents['on'](_0x165f95,_0x1e7b8a);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 1b2e1e0..8c318f8 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 _0x583c=['fs-extra','../../config/environment','./voiceMail.controller','isAuthenticated','index','get','/:id','show','getMessages','post','create','delete','destroy','exports','multer','util','path','connect-timeout','Router'];(function(_0x4d3a2b,_0x32a224){var _0xdd32c8=function(_0x18f96f){while(--_0x18f96f){_0x4d3a2b['push'](_0x4d3a2b['shift']());}};_0xdd32c8(++_0x32a224);}(_0x583c,0x12b));var _0xc583=function(_0x510c60,_0x50247e){_0x510c60=_0x510c60-0x0;var _0x49c4aa=_0x583c[_0x510c60];return _0x49c4aa;};'use strict';var multer=require(_0xc583('0x0'));var util=require(_0xc583('0x1'));var path=require(_0xc583('0x2'));var timeout=require(_0xc583('0x3'));var express=require('express');var router=express[_0xc583('0x4')]();var fs_extra=require(_0xc583('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc583('0x6'));var controller=require(_0xc583('0x7'));router['get']('/',auth[_0xc583('0x8')](),controller[_0xc583('0x9')]);router[_0xc583('0xa')](_0xc583('0xb'),auth['isAuthenticated'](),controller[_0xc583('0xc')]);router[_0xc583('0xa')]('/:id/messages',auth[_0xc583('0x8')](),controller[_0xc583('0xd')]);router[_0xc583('0xe')]('/',auth[_0xc583('0x8')](),controller[_0xc583('0xf')]);router['put'](_0xc583('0xb'),auth[_0xc583('0x8')](),controller['update']);router[_0xc583('0x10')](_0xc583('0xb'),auth['isAuthenticated'](),controller[_0xc583('0x11')]);module[_0xc583('0x12')]=router; \ No newline at end of file +var _0x8ace=['isAuthenticated','index','/:id','/:id/messages','getMessages','post','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'];(function(_0x24679e,_0x22d9d7){var _0x291f21=function(_0x329529){while(--_0x329529){_0x24679e['push'](_0x24679e['shift']());}};_0x291f21(++_0x22d9d7);}(_0x8ace,0x1bc));var _0xe8ac=function(_0x8c6eee,_0x21f601){_0x8c6eee=_0x8c6eee-0x0;var _0x5a03b5=_0x8ace[_0x8c6eee];return _0x5a03b5;};'use strict';var multer=require(_0xe8ac('0x0'));var util=require(_0xe8ac('0x1'));var path=require(_0xe8ac('0x2'));var timeout=require(_0xe8ac('0x3'));var express=require(_0xe8ac('0x4'));var router=express[_0xe8ac('0x5')]();var fs_extra=require(_0xe8ac('0x6'));var auth=require(_0xe8ac('0x7'));var interaction=require(_0xe8ac('0x8'));var config=require(_0xe8ac('0x9'));var controller=require(_0xe8ac('0xa'));router[_0xe8ac('0xb')]('/',auth[_0xe8ac('0xc')](),controller[_0xe8ac('0xd')]);router['get'](_0xe8ac('0xe'),auth[_0xe8ac('0xc')](),controller['show']);router['get'](_0xe8ac('0xf'),auth['isAuthenticated'](),controller[_0xe8ac('0x10')]);router[_0xe8ac('0x11')]('/',auth[_0xe8ac('0xc')](),controller[_0xe8ac('0x12')]);router[_0xe8ac('0x13')](_0xe8ac('0xe'),auth['isAuthenticated'](),controller[_0xe8ac('0x14')]);router[_0xe8ac('0x15')](_0xe8ac('0xe'),auth['isAuthenticated'](),controller[_0xe8ac('0x16')]);module[_0xe8ac('0x17')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index c284503..f9fc185 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 _0xb8e9=['central','ENUM','yes','TINYINT(4)','INTEGER','VIRTUAL','getDataValue','fullname','mailbox','sequelize','STRING','from-voicemail','contest_mailbox','setDataValue','email','string','trim'];(function(_0x2f07b6,_0x441088){var _0x23c075=function(_0x3922a8){while(--_0x3922a8){_0x2f07b6['push'](_0x2f07b6['shift']());}};_0x23c075(++_0x441088);}(_0xb8e9,0x17f));var _0x9b8e=function(_0x5b17b4,_0x5a3221){_0x5b17b4=_0x5b17b4-0x0;var _0x55af79=_0xb8e9[_0x5b17b4];return _0x55af79;};'use strict';var Sequelize=require(_0x9b8e('0x0'));module['exports']={'customer_id':{'type':Sequelize[_0x9b8e('0x1')]},'context':{'type':Sequelize['STRING'],'defaultValue':_0x9b8e('0x2'),'unique':_0x9b8e('0x3')},'mailbox':{'type':Sequelize[_0x9b8e('0x1')],'defaultValue':'','allowNull':![],'unique':_0x9b8e('0x3')},'password':{'type':Sequelize[_0x9b8e('0x1')]},'fullname':{'type':Sequelize[_0x9b8e('0x1')]},'email':{'type':Sequelize[_0x9b8e('0x1')],'validate':{'isEmail':!![]},'set':function(_0x2db031){this[_0x9b8e('0x4')](_0x9b8e('0x5'),typeof _0x2db031===_0x9b8e('0x6')&&_0x2db031[_0x9b8e('0x7')]()?_0x2db031[_0x9b8e('0x7')]():null);}},'pager':{'type':Sequelize[_0x9b8e('0x1')]},'tz':{'type':Sequelize['STRING'],'defaultValue':_0x9b8e('0x8')},'attach':{'type':Sequelize[_0x9b8e('0x9')](_0x9b8e('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x9b8e('0xa'),'allowNull':![]},'dialout':{'type':Sequelize[_0x9b8e('0x1')]},'callback':{'type':Sequelize[_0x9b8e('0x1')]},'review':{'type':Sequelize[_0x9b8e('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x9b8e('0x9')](_0x9b8e('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x9b8e('0x9')](_0x9b8e('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x9b8e('0x9')](_0x9b8e('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x9b8e('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0x9b8e('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x9b8e('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x9b8e('0x9')](_0x9b8e('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize[_0x9b8e('0x9')](_0x9b8e('0xa'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0x9b8e('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x9b8e('0x9')]('yes','no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0x9b8e('0x1')]},'emailbody':{'type':Sequelize[_0x9b8e('0x1')]},'maxsecs':{'type':Sequelize[_0x9b8e('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x9b8e('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x9b8e('0xd')],'get':function(){return this[_0x9b8e('0xe')](_0x9b8e('0xf'))+'\x20-\x20'+this[_0x9b8e('0xe')](_0x9b8e('0x10'));}}}; \ No newline at end of file +var _0x8719=['central','yes','ENUM','TIMESTAMP','INTEGER','getDataValue','\x20-\x20','mailbox','sequelize','STRING','from-voicemail','contest_mailbox','setDataValue','string'];(function(_0x35ccff,_0x1a9ff2){var _0xa5b35f=function(_0x2a81a6){while(--_0x2a81a6){_0x35ccff['push'](_0x35ccff['shift']());}};_0xa5b35f(++_0x1a9ff2);}(_0x8719,0x166));var _0x9871=function(_0x18a6ee,_0x44fab4){_0x18a6ee=_0x18a6ee-0x0;var _0x28346e=_0x8719[_0x18a6ee];return _0x28346e;};'use strict';var Sequelize=require(_0x9871('0x0'));module['exports']={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x9871('0x1')],'defaultValue':_0x9871('0x2'),'unique':_0x9871('0x3')},'mailbox':{'type':Sequelize[_0x9871('0x1')],'defaultValue':'','allowNull':![],'unique':_0x9871('0x3')},'password':{'type':Sequelize[_0x9871('0x1')]},'fullname':{'type':Sequelize[_0x9871('0x1')]},'email':{'type':Sequelize[_0x9871('0x1')],'validate':{'isEmail':!![]},'set':function(_0x3de5d7){this[_0x9871('0x4')]('email',typeof _0x3de5d7===_0x9871('0x5')&&_0x3de5d7['trim']()?_0x3de5d7['trim']():null);}},'pager':{'type':Sequelize[_0x9871('0x1')]},'tz':{'type':Sequelize[_0x9871('0x1')],'defaultValue':_0x9871('0x6')},'attach':{'type':Sequelize['ENUM'](_0x9871('0x7'),'no'),'defaultValue':_0x9871('0x7'),'allowNull':![]},'saycid':{'type':Sequelize[_0x9871('0x8')](_0x9871('0x7'),'no'),'defaultValue':_0x9871('0x7'),'allowNull':![]},'dialout':{'type':Sequelize[_0x9871('0x1')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0x9871('0x8')](_0x9871('0x7'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x9871('0x8')](_0x9871('0x7'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x9871('0x8')](_0x9871('0x7'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x9871('0x8')](_0x9871('0x7'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x9871('0x8')](_0x9871('0x7'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x9871('0x8')](_0x9871('0x7'),'no'),'defaultValue':_0x9871('0x7'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0x9871('0x7'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x9871('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x9871('0x8')](_0x9871('0x7'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0x9871('0x9')},'emailsubject':{'type':Sequelize[_0x9871('0x1')]},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize[_0x9871('0xa')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x9871('0xa')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x9871('0xb')]('fullname')+_0x9871('0xc')+this[_0x9871('0xb')](_0x9871('0xd'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index b2b6c32..8b65a86 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 _0xa74f=['ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','offset','undefined','limit','count','set','json','reject','save','destroy','then','Voicemails','UserProfileResource','error','stack','send','map','VoiceMail','rawAttributes','fieldName','type','key','model','name','query','intersection','attributes','fields','length','order','sort','where','filters','pick','filter','merge','VIRTUAL','rows','catch','show','params','keys','include','find','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','findOne','VoiceMailMessage','hasOwnProperty','nolimit','mailbox','options','findAndCountAll','zip-dir','moment','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x1bef27,_0x46acf2){var _0x2d7f10=function(_0x12193){while(--_0x12193){_0x1bef27['push'](_0x1bef27['shift']());}};_0x2d7f10(++_0x46acf2);}(_0xa74f,0x9a));var _0xfa74=function(_0x5311a1,_0x304912){_0x5311a1=_0x5311a1-0x0;var _0x2acb9f=_0xa74f[_0x5311a1];return _0x2acb9f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xfa74('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xfa74('0x1'));var BPromise=require(_0xfa74('0x2'));var Mustache=require(_0xfa74('0x3'));var util=require(_0xfa74('0x4'));var path=require('path');var sox=require(_0xfa74('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfa74('0x6'));var _=require(_0xfa74('0x7'));var squel=require(_0xfa74('0x8'));var crypto=require(_0xfa74('0x9'));var jsforce=require(_0xfa74('0xa'));var deskjs=require(_0xfa74('0xb'));var toCsv=require('to-csv');var querystring=require(_0xfa74('0xc'));var Papa=require(_0xfa74('0xd'));var Redis=require(_0xfa74('0xe'));var authService=require(_0xfa74('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xfa74('0x10'));var hardwareService=require(_0xfa74('0x11'));var logger=require('../../config/logger')(_0xfa74('0x12'));var utils=require(_0xfa74('0x13'));var config=require(_0xfa74('0x14'));var licenseUtil=require(_0xfa74('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x23591a,_0x998585){_0x998585=_0x998585||0xcc;return function(_0x78173f){if(_0x78173f){return _0x23591a[_0xfa74('0x16')](_0x998585);}return _0x23591a['status'](_0x998585)[_0xfa74('0x17')]();};}function respondWithResult(_0x33cda3,_0x3eb49b){_0x3eb49b=_0x3eb49b||0xc8;return function(_0x3947ca){if(_0x3947ca){return _0x33cda3[_0xfa74('0x18')](_0x3eb49b)['json'](_0x3947ca);}};}function respondWithFilteredResult(_0x199d20,_0x13d911){return function(_0x947da6){if(_0x947da6){var _0x1f1de0=typeof _0x13d911[_0xfa74('0x19')]===_0xfa74('0x1a')&&typeof _0x13d911[_0xfa74('0x1b')]==='undefined';var _0x58a67a=_0x947da6[_0xfa74('0x1c')];var _0x51dda1=_0x1f1de0?0x0:_0x13d911['offset'];var _0x31d3c1=_0x1f1de0?_0x947da6[_0xfa74('0x1c')]:_0x13d911[_0xfa74('0x19')]+_0x13d911['limit'];var _0x3bede6;if(_0x31d3c1>=_0x58a67a){_0x31d3c1=_0x58a67a;_0x3bede6=0xc8;}else{_0x3bede6=0xce;}_0x199d20[_0xfa74('0x18')](_0x3bede6);return _0x199d20[_0xfa74('0x1d')]('Content-Range',_0x51dda1+'-'+_0x31d3c1+'/'+_0x58a67a)[_0xfa74('0x1e')](_0x947da6);}return null;};}function patchUpdates(_0x302eb4){return function(_0x2e6c33){try{jsonpatch['apply'](_0x2e6c33,_0x302eb4,!![]);}catch(_0x5466ca){return BPromise[_0xfa74('0x1f')](_0x5466ca);}return _0x2e6c33[_0xfa74('0x20')]();};}function saveUpdates(_0x9932db,_0xeaaa19){return function(_0x1a453d){if(_0x1a453d){return _0x1a453d['update'](_0x9932db)['then'](function(_0x3721bf){return _0x3721bf;});}return null;};}function removeEntity(_0x5aa8a7,_0x48cbd3){return function(_0x529810){if(_0x529810){return _0x529810[_0xfa74('0x21')]()[_0xfa74('0x22')](function(){var _0x42d9bf=_0x529810['get']({'plain':!![]});var _0x530f99=_0xfa74('0x23');return db[_0xfa74('0x24')]['destroy']({'where':{'type':_0x530f99,'resourceId':_0x42d9bf['id']}})[_0xfa74('0x22')](function(){return _0x529810;});})['then'](function(){_0x5aa8a7[_0xfa74('0x18')](0xcc)[_0xfa74('0x17')]();});}};}function handleEntityNotFound(_0x55d8e4,_0x298388){return function(_0x1130de){if(!_0x1130de){_0x55d8e4[_0xfa74('0x16')](0x194);}return _0x1130de;};}function handleError(_0x218c86,_0x4f7337){_0x4f7337=_0x4f7337||0x1f4;return function(_0xd9c55d){logger[_0xfa74('0x25')](_0xd9c55d[_0xfa74('0x26')]);if(_0xd9c55d['name']){delete _0xd9c55d['name'];}_0x218c86[_0xfa74('0x18')](_0x4f7337)[_0xfa74('0x27')](_0xd9c55d);};}exports['index']=function(_0x4b38fc,_0x343466){var _0x564060={},_0x2238d4={},_0x4d6d0a={'count':0x0,'rows':[]};var _0x363173=_[_0xfa74('0x28')](db[_0xfa74('0x29')][_0xfa74('0x2a')],function(_0x4c506f){return{'name':_0x4c506f[_0xfa74('0x2b')],'type':_0x4c506f[_0xfa74('0x2c')][_0xfa74('0x2d')]};});_0x2238d4[_0xfa74('0x2e')]=_[_0xfa74('0x28')](_0x363173,_0xfa74('0x2f'));_0x2238d4[_0xfa74('0x30')]=_['keys'](_0x4b38fc[_0xfa74('0x30')]);_0x2238d4['filters']=_[_0xfa74('0x31')](_0x2238d4[_0xfa74('0x2e')],_0x2238d4[_0xfa74('0x30')]);_0x564060[_0xfa74('0x32')]=_['intersection'](_0x2238d4['model'],qs[_0xfa74('0x33')](_0x4b38fc[_0xfa74('0x30')][_0xfa74('0x33')]));_0x564060[_0xfa74('0x32')]=_0x564060['attributes'][_0xfa74('0x34')]?_0x564060[_0xfa74('0x32')]:_0x2238d4['model'];if(!_0x4b38fc['query']['hasOwnProperty']('nolimit')){_0x564060['limit']=qs[_0xfa74('0x1b')](_0x4b38fc[_0xfa74('0x30')][_0xfa74('0x1b')]);_0x564060[_0xfa74('0x19')]=qs[_0xfa74('0x19')](_0x4b38fc[_0xfa74('0x30')][_0xfa74('0x19')]);}_0x564060[_0xfa74('0x35')]=qs[_0xfa74('0x36')](_0x4b38fc['query'][_0xfa74('0x36')]);_0x564060[_0xfa74('0x37')]=qs[_0xfa74('0x38')](_[_0xfa74('0x39')](_0x4b38fc[_0xfa74('0x30')],_0x2238d4[_0xfa74('0x38')]),_0x363173);if(_0x4b38fc['query'][_0xfa74('0x3a')]){_0x564060[_0xfa74('0x37')]=_[_0xfa74('0x3b')](_0x564060[_0xfa74('0x37')],{'$or':_['map'](_0x363173,function(_0x207566){if(_0x207566[_0xfa74('0x2c')]!==_0xfa74('0x3c')){var _0x35f252={};_0x35f252[_0x207566['name']]={'$like':'%'+_0x4b38fc[_0xfa74('0x30')][_0xfa74('0x3a')]+'%'};return _0x35f252;}})});}_0x564060=_[_0xfa74('0x3b')]({},_0x564060,_0x4b38fc['options']);var _0x5d32bc={'where':_0x564060[_0xfa74('0x37')]};return db[_0xfa74('0x29')][_0xfa74('0x1c')](_0x5d32bc)[_0xfa74('0x22')](function(_0x55f4e3){_0x4d6d0a[_0xfa74('0x1c')]=_0x55f4e3;if(_0x4b38fc[_0xfa74('0x30')]['includeAll']){_0x564060['include']=[{'all':!![]}];}return db['VoiceMail']['findAll'](_0x564060);})[_0xfa74('0x22')](function(_0x3098ca){_0x4d6d0a[_0xfa74('0x3d')]=_0x3098ca;return _0x4d6d0a;})[_0xfa74('0x22')](respondWithFilteredResult(_0x343466,_0x564060))[_0xfa74('0x3e')](handleError(_0x343466,null));};exports[_0xfa74('0x3f')]=function(_0x7735c5,_0x5aac45){var _0x274062={'raw':!![],'where':{'id':_0x7735c5[_0xfa74('0x40')]['id']}},_0x3938c1={};_0x3938c1[_0xfa74('0x2e')]=_[_0xfa74('0x41')](db['VoiceMail'][_0xfa74('0x2a')]);_0x3938c1[_0xfa74('0x30')]=_[_0xfa74('0x41')](_0x7735c5[_0xfa74('0x30')]);_0x3938c1[_0xfa74('0x38')]=_[_0xfa74('0x31')](_0x3938c1[_0xfa74('0x2e')],_0x3938c1[_0xfa74('0x30')]);_0x274062[_0xfa74('0x32')]=_[_0xfa74('0x31')](_0x3938c1['model'],qs[_0xfa74('0x33')](_0x7735c5['query'][_0xfa74('0x33')]));_0x274062[_0xfa74('0x32')]=_0x274062[_0xfa74('0x32')][_0xfa74('0x34')]?_0x274062['attributes']:_0x3938c1[_0xfa74('0x2e')];if(_0x7735c5[_0xfa74('0x30')]['includeAll']){_0x274062[_0xfa74('0x42')]=[{'all':!![]}];}_0x274062=_[_0xfa74('0x3b')]({},_0x274062,_0x7735c5['options']);return db[_0xfa74('0x29')][_0xfa74('0x43')](_0x274062)[_0xfa74('0x22')](handleEntityNotFound(_0x5aac45,null))[_0xfa74('0x22')](respondWithResult(_0x5aac45,null))[_0xfa74('0x3e')](handleError(_0x5aac45,null));};exports['create']=function(_0x54e06c,_0x36f6ca){return db[_0xfa74('0x29')]['create'](_0x54e06c[_0xfa74('0x44')],{})[_0xfa74('0x22')](function(_0x3100f2){var _0x4ca49e=_0x54e06c['user'][_0xfa74('0x45')]({'plain':!![]});if(!_0x4ca49e)throw new Error(_0xfa74('0x46'));if(_0x4ca49e[_0xfa74('0x47')]===_0xfa74('0x48')){var _0x36508a=_0x3100f2[_0xfa74('0x45')]({'plain':!![]});var _0x2d217d=_0xfa74('0x23');return db['UserProfileSection'][_0xfa74('0x43')]({'where':{'name':_0x2d217d,'userProfileId':_0x4ca49e[_0xfa74('0x49')]},'raw':!![]})[_0xfa74('0x22')](function(_0x2654b5){if(_0x2654b5&&_0x2654b5['autoAssociation']===0x0){return db['UserProfileResource'][_0xfa74('0x4a')]({'name':_0x36508a['name'],'resourceId':_0x36508a['id'],'type':_0x2654b5[_0xfa74('0x2f')],'sectionId':_0x2654b5['id']},{})[_0xfa74('0x22')](function(){return _0x3100f2;});}else{return _0x3100f2;}})[_0xfa74('0x3e')](function(_0x33e31e){logger[_0xfa74('0x25')](_0xfa74('0x4b'),_0x33e31e);throw _0x33e31e;});}return _0x3100f2;})[_0xfa74('0x22')](respondWithResult(_0x36f6ca,0xc9))['catch'](handleError(_0x36f6ca,null));};exports[_0xfa74('0x4c')]=function(_0x4bcee3,_0x21d7c5){if(_0x4bcee3['body']['id']){delete _0x4bcee3['body']['id'];}return db[_0xfa74('0x29')][_0xfa74('0x43')]({'where':{'id':_0x4bcee3['params']['id']}})['then'](handleEntityNotFound(_0x21d7c5,null))[_0xfa74('0x22')](saveUpdates(_0x4bcee3[_0xfa74('0x44')],null))[_0xfa74('0x22')](respondWithResult(_0x21d7c5,null))[_0xfa74('0x3e')](handleError(_0x21d7c5,null));};exports[_0xfa74('0x21')]=function(_0xfc3547,_0x1198f3){return db[_0xfa74('0x29')][_0xfa74('0x43')]({'where':{'id':_0xfc3547[_0xfa74('0x40')]['id']}})['then'](handleEntityNotFound(_0x1198f3,null))[_0xfa74('0x22')](removeEntity(_0x1198f3,null))[_0xfa74('0x3e')](handleError(_0x1198f3,null));};exports['getMessages']=function(_0x550974,_0x3d88dc,_0x2e7262){return db[_0xfa74('0x29')][_0xfa74('0x4d')]({'where':{'id':_0x550974[_0xfa74('0x40')]['id']}})['then'](handleEntityNotFound(_0x3d88dc,null))[_0xfa74('0x22')](function(_0x4d6235){var _0x26b398;var _0x2fff37={},_0x375bf7={};_0x375bf7['model']=_['keys'](db[_0xfa74('0x4e')][_0xfa74('0x2a')]);_0x375bf7[_0xfa74('0x30')]=_[_0xfa74('0x41')](_0x550974['query']);_0x375bf7[_0xfa74('0x38')]=_[_0xfa74('0x31')](_0x375bf7['model'],_0x375bf7[_0xfa74('0x30')]);_0x2fff37[_0xfa74('0x32')]=_[_0xfa74('0x31')](_0x375bf7[_0xfa74('0x2e')],qs['fields'](_0x550974[_0xfa74('0x30')]['fields']));_0x2fff37[_0xfa74('0x32')]=_0x2fff37[_0xfa74('0x32')][_0xfa74('0x34')]?_0x2fff37[_0xfa74('0x32')]:_0x375bf7[_0xfa74('0x2e')];if(!_0x550974[_0xfa74('0x30')][_0xfa74('0x4f')](_0xfa74('0x50'))){_0x2fff37[_0xfa74('0x1b')]=qs[_0xfa74('0x1b')](_0x550974[_0xfa74('0x30')][_0xfa74('0x1b')]);_0x2fff37[_0xfa74('0x19')]=qs[_0xfa74('0x19')](_0x550974[_0xfa74('0x30')]['offset']);}_0x2fff37[_0xfa74('0x35')]=qs[_0xfa74('0x36')](_0x550974['query']['sort']);_0x2fff37[_0xfa74('0x37')]=qs['filters'](_[_0xfa74('0x39')](_0x550974[_0xfa74('0x30')],_0x375bf7[_0xfa74('0x38')]));if(_0x550974['query'][_0xfa74('0x3a')]){_0x2fff37['where']=_['merge'](_0x2fff37[_0xfa74('0x37')],{'$or':_[_0xfa74('0x28')](_0x2fff37[_0xfa74('0x32')],function(_0x414e31){var _0x474c7d={};_0x474c7d[_0x414e31]={'$like':'%'+_0x550974[_0xfa74('0x30')][_0xfa74('0x3a')]+'%'};return _0x474c7d;})});}_0x2fff37[_0xfa74('0x37')]=_[_0xfa74('0x3b')](_0x2fff37[_0xfa74('0x37')],{'mailboxuser':_0x4d6235[_0xfa74('0x51')]});_0x2fff37=_['merge']({},_0x2fff37,_0x550974[_0xfa74('0x52')]);return db['VoiceMailMessage'][_0xfa74('0x53')](_0x2fff37)[_0xfa74('0x22')](respondWithFilteredResult(_0x3d88dc,_0x2fff37));})[_0xfa74('0x3e')](handleError(_0x3d88dc,null));}; \ No newline at end of file +var _0x2e54=['keys','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','destroy','findOne','VoiceMailMessage','hasOwnProperty','pick','mailbox','findAndCountAll','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','get','Voicemails','stack','name','send','index','map','rawAttributes','fieldName','type','query','filters','intersection','attributes','model','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','VoiceMail','includeAll','include','findAll','rows','catch','show','params'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x2e54,0x1dd));var _0x42e5=function(_0x1270e4,_0x4437ec){_0x1270e4=_0x1270e4-0x0;var _0xc5ef91=_0x2e54[_0x1270e4];return _0xc5ef91;};'use strict';var emlformat=require(_0x42e5('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x42e5('0x1'));var rp=require(_0x42e5('0x2'));var moment=require(_0x42e5('0x3'));var BPromise=require(_0x42e5('0x4'));var Mustache=require(_0x42e5('0x5'));var util=require(_0x42e5('0x6'));var path=require(_0x42e5('0x7'));var sox=require('sox');var csv=require(_0x42e5('0x8'));var ejs=require(_0x42e5('0x9'));var fs=require('fs');var fs_extra=require(_0x42e5('0xa'));var _=require('lodash');var squel=require(_0x42e5('0xb'));var crypto=require('crypto');var jsforce=require(_0x42e5('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x42e5('0x8'));var querystring=require(_0x42e5('0xd'));var Papa=require(_0x42e5('0xe'));var Redis=require(_0x42e5('0xf'));var authService=require(_0x42e5('0x10'));var qs=require(_0x42e5('0x11'));var as=require(_0x42e5('0x12'));var hardwareService=require(_0x42e5('0x13'));var logger=require(_0x42e5('0x14'))('api');var utils=require(_0x42e5('0x15'));var config=require(_0x42e5('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x42e5('0x17'))['db'];function respondWithStatusCode(_0x12385d,_0x4530ba){_0x4530ba=_0x4530ba||0xcc;return function(_0x41598d){if(_0x41598d){return _0x12385d[_0x42e5('0x18')](_0x4530ba);}return _0x12385d[_0x42e5('0x19')](_0x4530ba)[_0x42e5('0x1a')]();};}function respondWithResult(_0x96fae2,_0x447648){_0x447648=_0x447648||0xc8;return function(_0x23957f){if(_0x23957f){return _0x96fae2['status'](_0x447648)[_0x42e5('0x1b')](_0x23957f);}};}function respondWithFilteredResult(_0x1d8e52,_0x4034bd){return function(_0x388300){if(_0x388300){var _0x2f4999=typeof _0x4034bd[_0x42e5('0x1c')]===_0x42e5('0x1d')&&typeof _0x4034bd[_0x42e5('0x1e')]===_0x42e5('0x1d');var _0x3c7b79=_0x388300[_0x42e5('0x1f')];var _0x38282d=_0x2f4999?0x0:_0x4034bd[_0x42e5('0x1c')];var _0x23fe09=_0x2f4999?_0x388300['count']:_0x4034bd[_0x42e5('0x1c')]+_0x4034bd['limit'];var _0x5f4428;if(_0x23fe09>=_0x3c7b79){_0x23fe09=_0x3c7b79;_0x5f4428=0xc8;}else{_0x5f4428=0xce;}_0x1d8e52[_0x42e5('0x19')](_0x5f4428);return _0x1d8e52[_0x42e5('0x20')]('Content-Range',_0x38282d+'-'+_0x23fe09+'/'+_0x3c7b79)[_0x42e5('0x1b')](_0x388300);}return null;};}function patchUpdates(_0x39a3e2){return function(_0x1c2169){try{jsonpatch[_0x42e5('0x21')](_0x1c2169,_0x39a3e2,!![]);}catch(_0x1150f4){return BPromise[_0x42e5('0x22')](_0x1150f4);}return _0x1c2169[_0x42e5('0x23')]();};}function saveUpdates(_0x58eee5,_0x4da508){return function(_0x283d44){if(_0x283d44){return _0x283d44['update'](_0x58eee5)[_0x42e5('0x24')](function(_0x2e9574){return _0x2e9574;});}return null;};}function removeEntity(_0x37d10e,_0x49490f){return function(_0x32380f){if(_0x32380f){return _0x32380f['destroy']()[_0x42e5('0x24')](function(){var _0xf29221=_0x32380f[_0x42e5('0x25')]({'plain':!![]});var _0x275c80=_0x42e5('0x26');return db['UserProfileResource']['destroy']({'where':{'type':_0x275c80,'resourceId':_0xf29221['id']}})[_0x42e5('0x24')](function(){return _0x32380f;});})['then'](function(){_0x37d10e['status'](0xcc)[_0x42e5('0x1a')]();});}};}function handleEntityNotFound(_0x5b1727,_0x392c6b){return function(_0x2d9e65){if(!_0x2d9e65){_0x5b1727[_0x42e5('0x18')](0x194);}return _0x2d9e65;};}function handleError(_0x1c8ee4,_0x27ae27){_0x27ae27=_0x27ae27||0x1f4;return function(_0x2f1edc){logger['error'](_0x2f1edc[_0x42e5('0x27')]);if(_0x2f1edc[_0x42e5('0x28')]){delete _0x2f1edc[_0x42e5('0x28')];}_0x1c8ee4[_0x42e5('0x19')](_0x27ae27)[_0x42e5('0x29')](_0x2f1edc);};}exports[_0x42e5('0x2a')]=function(_0x383e97,_0x282cbf){var _0x5a4930={},_0x2ba9ef={},_0x2c7542={'count':0x0,'rows':[]};var _0x3d9e8b=_[_0x42e5('0x2b')](db['VoiceMail'][_0x42e5('0x2c')],function(_0xf5a3dc){return{'name':_0xf5a3dc[_0x42e5('0x2d')],'type':_0xf5a3dc[_0x42e5('0x2e')]['key']};});_0x2ba9ef['model']=_[_0x42e5('0x2b')](_0x3d9e8b,'name');_0x2ba9ef[_0x42e5('0x2f')]=_['keys'](_0x383e97[_0x42e5('0x2f')]);_0x2ba9ef[_0x42e5('0x30')]=_[_0x42e5('0x31')](_0x2ba9ef['model'],_0x2ba9ef[_0x42e5('0x2f')]);_0x5a4930[_0x42e5('0x32')]=_['intersection'](_0x2ba9ef[_0x42e5('0x33')],qs['fields'](_0x383e97[_0x42e5('0x2f')][_0x42e5('0x34')]));_0x5a4930[_0x42e5('0x32')]=_0x5a4930[_0x42e5('0x32')][_0x42e5('0x35')]?_0x5a4930[_0x42e5('0x32')]:_0x2ba9ef[_0x42e5('0x33')];if(!_0x383e97['query']['hasOwnProperty'](_0x42e5('0x36'))){_0x5a4930[_0x42e5('0x1e')]=qs[_0x42e5('0x1e')](_0x383e97['query']['limit']);_0x5a4930['offset']=qs['offset'](_0x383e97[_0x42e5('0x2f')][_0x42e5('0x1c')]);}_0x5a4930[_0x42e5('0x37')]=qs[_0x42e5('0x38')](_0x383e97[_0x42e5('0x2f')][_0x42e5('0x38')]);_0x5a4930[_0x42e5('0x39')]=qs[_0x42e5('0x30')](_['pick'](_0x383e97[_0x42e5('0x2f')],_0x2ba9ef['filters']),_0x3d9e8b);if(_0x383e97[_0x42e5('0x2f')][_0x42e5('0x3a')]){_0x5a4930[_0x42e5('0x39')]=_[_0x42e5('0x3b')](_0x5a4930[_0x42e5('0x39')],{'$or':_[_0x42e5('0x2b')](_0x3d9e8b,function(_0xd5e7f5){if(_0xd5e7f5['type']!==_0x42e5('0x3c')){var _0x356ff6={};_0x356ff6[_0xd5e7f5['name']]={'$like':'%'+_0x383e97[_0x42e5('0x2f')]['filter']+'%'};return _0x356ff6;}})});}_0x5a4930=_['merge']({},_0x5a4930,_0x383e97['options']);var _0x1105ea={'where':_0x5a4930[_0x42e5('0x39')]};return db[_0x42e5('0x3d')][_0x42e5('0x1f')](_0x1105ea)[_0x42e5('0x24')](function(_0x77aa22){_0x2c7542[_0x42e5('0x1f')]=_0x77aa22;if(_0x383e97['query'][_0x42e5('0x3e')]){_0x5a4930[_0x42e5('0x3f')]=[{'all':!![]}];}return db['VoiceMail'][_0x42e5('0x40')](_0x5a4930);})[_0x42e5('0x24')](function(_0x5db771){_0x2c7542[_0x42e5('0x41')]=_0x5db771;return _0x2c7542;})[_0x42e5('0x24')](respondWithFilteredResult(_0x282cbf,_0x5a4930))[_0x42e5('0x42')](handleError(_0x282cbf,null));};exports[_0x42e5('0x43')]=function(_0x424304,_0x4d32f4){var _0x41e1fd={'raw':!![],'where':{'id':_0x424304[_0x42e5('0x44')]['id']}},_0xc34e51={};_0xc34e51[_0x42e5('0x33')]=_['keys'](db[_0x42e5('0x3d')][_0x42e5('0x2c')]);_0xc34e51[_0x42e5('0x2f')]=_[_0x42e5('0x45')](_0x424304[_0x42e5('0x2f')]);_0xc34e51[_0x42e5('0x30')]=_[_0x42e5('0x31')](_0xc34e51[_0x42e5('0x33')],_0xc34e51['query']);_0x41e1fd[_0x42e5('0x32')]=_['intersection'](_0xc34e51['model'],qs[_0x42e5('0x34')](_0x424304[_0x42e5('0x2f')][_0x42e5('0x34')]));_0x41e1fd[_0x42e5('0x32')]=_0x41e1fd[_0x42e5('0x32')][_0x42e5('0x35')]?_0x41e1fd[_0x42e5('0x32')]:_0xc34e51['model'];if(_0x424304[_0x42e5('0x2f')][_0x42e5('0x3e')]){_0x41e1fd[_0x42e5('0x3f')]=[{'all':!![]}];}_0x41e1fd=_[_0x42e5('0x3b')]({},_0x41e1fd,_0x424304[_0x42e5('0x46')]);return db[_0x42e5('0x3d')][_0x42e5('0x47')](_0x41e1fd)[_0x42e5('0x24')](handleEntityNotFound(_0x4d32f4,null))['then'](respondWithResult(_0x4d32f4,null))[_0x42e5('0x42')](handleError(_0x4d32f4,null));};exports[_0x42e5('0x48')]=function(_0x3616f4,_0x48757e){return db[_0x42e5('0x3d')][_0x42e5('0x48')](_0x3616f4[_0x42e5('0x49')],{})[_0x42e5('0x24')](function(_0x2586b0){var _0x528ddd=_0x3616f4[_0x42e5('0x4a')]['get']({'plain':!![]});if(!_0x528ddd)throw new Error(_0x42e5('0x4b'));if(_0x528ddd[_0x42e5('0x4c')]===_0x42e5('0x4a')){var _0x48b63b=_0x2586b0['get']({'plain':!![]});var _0x4f0639=_0x42e5('0x26');return db[_0x42e5('0x4d')][_0x42e5('0x47')]({'where':{'name':_0x4f0639,'userProfileId':_0x528ddd[_0x42e5('0x4e')]},'raw':!![]})['then'](function(_0x3ae9de){if(_0x3ae9de&&_0x3ae9de[_0x42e5('0x4f')]===0x0){return db[_0x42e5('0x50')]['create']({'name':_0x48b63b[_0x42e5('0x28')],'resourceId':_0x48b63b['id'],'type':_0x3ae9de['name'],'sectionId':_0x3ae9de['id']},{})[_0x42e5('0x24')](function(){return _0x2586b0;});}else{return _0x2586b0;}})[_0x42e5('0x42')](function(_0x53e29b){logger[_0x42e5('0x51')](_0x42e5('0x52'),_0x53e29b);throw _0x53e29b;});}return _0x2586b0;})[_0x42e5('0x24')](respondWithResult(_0x48757e,0xc9))[_0x42e5('0x42')](handleError(_0x48757e,null));};exports[_0x42e5('0x53')]=function(_0x3f043f,_0x41c1dc){if(_0x3f043f[_0x42e5('0x49')]['id']){delete _0x3f043f[_0x42e5('0x49')]['id'];}return db[_0x42e5('0x3d')]['find']({'where':{'id':_0x3f043f[_0x42e5('0x44')]['id']}})[_0x42e5('0x24')](handleEntityNotFound(_0x41c1dc,null))[_0x42e5('0x24')](saveUpdates(_0x3f043f[_0x42e5('0x49')],null))[_0x42e5('0x24')](respondWithResult(_0x41c1dc,null))['catch'](handleError(_0x41c1dc,null));};exports[_0x42e5('0x54')]=function(_0x2b226f,_0x40b633){return db[_0x42e5('0x3d')]['find']({'where':{'id':_0x2b226f['params']['id']}})['then'](handleEntityNotFound(_0x40b633,null))[_0x42e5('0x24')](removeEntity(_0x40b633,null))[_0x42e5('0x42')](handleError(_0x40b633,null));};exports['getMessages']=function(_0x42094e,_0xb73aa8,_0x10346e){return db[_0x42e5('0x3d')][_0x42e5('0x55')]({'where':{'id':_0x42094e[_0x42e5('0x44')]['id']}})[_0x42e5('0x24')](handleEntityNotFound(_0xb73aa8,null))[_0x42e5('0x24')](function(_0x3692fc){var _0x5688a4;var _0x2911e0={},_0x517d03={};_0x517d03[_0x42e5('0x33')]=_[_0x42e5('0x45')](db[_0x42e5('0x56')][_0x42e5('0x2c')]);_0x517d03[_0x42e5('0x2f')]=_[_0x42e5('0x45')](_0x42094e[_0x42e5('0x2f')]);_0x517d03[_0x42e5('0x30')]=_[_0x42e5('0x31')](_0x517d03[_0x42e5('0x33')],_0x517d03[_0x42e5('0x2f')]);_0x2911e0['attributes']=_[_0x42e5('0x31')](_0x517d03['model'],qs[_0x42e5('0x34')](_0x42094e['query'][_0x42e5('0x34')]));_0x2911e0[_0x42e5('0x32')]=_0x2911e0['attributes'][_0x42e5('0x35')]?_0x2911e0[_0x42e5('0x32')]:_0x517d03['model'];if(!_0x42094e[_0x42e5('0x2f')][_0x42e5('0x57')]('nolimit')){_0x2911e0[_0x42e5('0x1e')]=qs[_0x42e5('0x1e')](_0x42094e[_0x42e5('0x2f')]['limit']);_0x2911e0[_0x42e5('0x1c')]=qs[_0x42e5('0x1c')](_0x42094e[_0x42e5('0x2f')][_0x42e5('0x1c')]);}_0x2911e0['order']=qs[_0x42e5('0x38')](_0x42094e['query'][_0x42e5('0x38')]);_0x2911e0[_0x42e5('0x39')]=qs[_0x42e5('0x30')](_[_0x42e5('0x58')](_0x42094e[_0x42e5('0x2f')],_0x517d03[_0x42e5('0x30')]));if(_0x42094e[_0x42e5('0x2f')]['filter']){_0x2911e0[_0x42e5('0x39')]=_[_0x42e5('0x3b')](_0x2911e0[_0x42e5('0x39')],{'$or':_[_0x42e5('0x2b')](_0x2911e0[_0x42e5('0x32')],function(_0x8c4a77){var _0xfef629={};_0xfef629[_0x8c4a77]={'$like':'%'+_0x42094e[_0x42e5('0x2f')][_0x42e5('0x3a')]+'%'};return _0xfef629;})});}_0x2911e0['where']=_[_0x42e5('0x3b')](_0x2911e0[_0x42e5('0x39')],{'mailboxuser':_0x3692fc[_0x42e5('0x59')]});_0x2911e0=_[_0x42e5('0x3b')]({},_0x2911e0,_0x42094e['options']);return db[_0x42e5('0x56')][_0x42e5('0x5a')](_0x2911e0)[_0x42e5('0x24')](respondWithFilteredResult(_0xb73aa8,_0x2911e0));})[_0x42e5('0x42')](handleError(_0xb73aa8,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 17add99..cf55e9e 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 _0x13ba=['lodash','util','api','moment','request-promise','rimraf','./voiceMail.attributes','exports','define','voice_voicemail','mailbox_context','mailbox','context'];(function(_0x3f3fb8,_0x35b42f){var _0xe600d=function(_0x426249){while(--_0x426249){_0x3f3fb8['push'](_0x3f3fb8['shift']());}};_0xe600d(++_0x35b42f);}(_0x13ba,0x16c));var _0xa13b=function(_0x5caf82,_0x9591f7){_0x5caf82=_0x5caf82-0x0;var _0x5cf782=_0x13ba[_0x5caf82];return _0x5cf782;};'use strict';var _=require(_0xa13b('0x0'));var util=require(_0xa13b('0x1'));var logger=require('../../config/logger')(_0xa13b('0x2'));var moment=require(_0xa13b('0x3'));var BPromise=require('bluebird');var rp=require(_0xa13b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa13b('0x5'));var config=require('../../config/environment');var attributes=require(_0xa13b('0x6'));module[_0xa13b('0x7')]=function(_0x2a3237,_0xc2cf17){return _0x2a3237[_0xa13b('0x8')]('VoiceMail',attributes,{'tableName':_0xa13b('0x9'),'paranoid':![],'indexes':[{'name':_0xa13b('0xa'),'fields':[_0xa13b('0xb'),_0xa13b('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4d5c=['bluebird','request-promise','path','../../config/environment','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','mailbox_context','mailbox','context','lodash','../../config/logger','api','moment'];(function(_0x31ec5a,_0x2c3fb3){var _0x5332f7=function(_0x5c2c7f){while(--_0x5c2c7f){_0x31ec5a['push'](_0x31ec5a['shift']());}};_0x5332f7(++_0x2c3fb3);}(_0x4d5c,0x18c));var _0xc4d5=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0x4d5c[_0x2ec461];return _0x28603d;};'use strict';var _=require(_0xc4d5('0x0'));var util=require('util');var logger=require(_0xc4d5('0x1'))(_0xc4d5('0x2'));var moment=require(_0xc4d5('0x3'));var BPromise=require(_0xc4d5('0x4'));var rp=require(_0xc4d5('0x5'));var fs=require('fs');var path=require(_0xc4d5('0x6'));var rimraf=require('rimraf');var config=require(_0xc4d5('0x7'));var attributes=require(_0xc4d5('0x8'));module[_0xc4d5('0x9')]=function(_0x455237,_0x486400){return _0x455237[_0xc4d5('0xa')](_0xc4d5('0xb'),attributes,{'tableName':_0xc4d5('0xc'),'paranoid':![],'indexes':[{'name':_0xc4d5('0xd'),'fields':[_0xc4d5('0xe'),_0xc4d5('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 1bfae2c..d02b54b 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 _0x27f7=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceMail,\x20%s,\x20%s','message','result'];(function(_0x292c23,_0x341359){var _0x71b09b=function(_0x295435){while(--_0x295435){_0x292c23['push'](_0x292c23['shift']());}};_0x71b09b(++_0x341359);}(_0x27f7,0xd9));var _0x727f=function(_0x1d8a36,_0x41bb85){_0x1d8a36=_0x1d8a36-0x0;var _0x344d81=_0x27f7[_0x1d8a36];return _0x344d81;};'use strict';var _=require(_0x727f('0x0'));var util=require(_0x727f('0x1'));var moment=require(_0x727f('0x2'));var BPromise=require(_0x727f('0x3'));var rs=require(_0x727f('0x4'));var fs=require('fs');var Redis=require(_0x727f('0x5'));var db=require(_0x727f('0x6'))['db'];var utils=require(_0x727f('0x7'));var logger=require(_0x727f('0x8'))(_0x727f('0x9'));var config=require(_0x727f('0xa'));var jayson=require(_0x727f('0xb'));var client=jayson[_0x727f('0xc')][_0x727f('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4ad7e3,_0x2584d0,_0x230685){return new BPromise(function(_0xd2994,_0x15080b){return client[_0x727f('0xe')](_0x4ad7e3,_0x230685)[_0x727f('0xf')](function(_0x193336){logger[_0x727f('0x10')]('VoiceMail,\x20%s,\x20%s',_0x2584d0,_0x727f('0x11'));logger[_0x727f('0x12')](_0x727f('0x13'),_0x2584d0,_0x727f('0x11'),JSON[_0x727f('0x14')](_0x193336));if(_0x193336[_0x727f('0x15')]){if(_0x193336[_0x727f('0x15')][_0x727f('0x16')]===0x1f4){logger['error'](_0x727f('0x17'),_0x2584d0,_0x193336[_0x727f('0x15')][_0x727f('0x18')]);return _0x15080b(_0x193336[_0x727f('0x15')][_0x727f('0x18')]);}logger[_0x727f('0x15')]('VoiceMail,\x20%s,\x20%s',_0x2584d0,_0x193336[_0x727f('0x15')][_0x727f('0x18')]);return _0xd2994(_0x193336['error'][_0x727f('0x18')]);}else{logger[_0x727f('0x10')]('VoiceMail,\x20%s,\x20%s',_0x2584d0,_0x727f('0x11'));_0xd2994(_0x193336[_0x727f('0x19')][_0x727f('0x18')]);}})[_0x727f('0x1a')](function(_0x36e116){logger[_0x727f('0x15')](_0x727f('0x17'),_0x2584d0,_0x36e116);_0x15080b(_0x36e116);});});} \ No newline at end of file +var _0x9dc3=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x305c31,_0x466b17){var _0x17f39f=function(_0x53ae03){while(--_0x53ae03){_0x305c31['push'](_0x305c31['shift']());}};_0x17f39f(++_0x466b17);}(_0x9dc3,0x84));var _0x39dc=function(_0x15298e,_0x591c53){_0x15298e=_0x15298e-0x0;var _0x2d1d1a=_0x9dc3[_0x15298e];return _0x2d1d1a;};'use strict';var _=require(_0x39dc('0x0'));var util=require(_0x39dc('0x1'));var moment=require(_0x39dc('0x2'));var BPromise=require(_0x39dc('0x3'));var rs=require(_0x39dc('0x4'));var fs=require('fs');var Redis=require(_0x39dc('0x5'));var db=require(_0x39dc('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x39dc('0x7'));var config=require(_0x39dc('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x39dc('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d5a45,_0x509ba4,_0x2ce268){return new BPromise(function(_0x28e3a2,_0x54bc14){return client['request'](_0x2d5a45,_0x2ce268)[_0x39dc('0xa')](function(_0x2f371e){logger[_0x39dc('0xb')](_0x39dc('0xc'),_0x509ba4,_0x39dc('0xd'));logger[_0x39dc('0xe')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x509ba4,_0x39dc('0xd'),JSON[_0x39dc('0xf')](_0x2f371e));if(_0x2f371e[_0x39dc('0x10')]){if(_0x2f371e[_0x39dc('0x10')][_0x39dc('0x11')]===0x1f4){logger[_0x39dc('0x10')](_0x39dc('0xc'),_0x509ba4,_0x2f371e[_0x39dc('0x10')]['message']);return _0x54bc14(_0x2f371e[_0x39dc('0x10')][_0x39dc('0x12')]);}logger[_0x39dc('0x10')](_0x39dc('0xc'),_0x509ba4,_0x2f371e[_0x39dc('0x10')][_0x39dc('0x12')]);return _0x28e3a2(_0x2f371e['error']['message']);}else{logger[_0x39dc('0xb')](_0x39dc('0xc'),_0x509ba4,'request\x20sent');_0x28e3a2(_0x2f371e[_0x39dc('0x13')][_0x39dc('0x12')]);}})[_0x39dc('0x14')](function(_0x30971d){logger[_0x39dc('0x10')]('VoiceMail,\x20%s,\x20%s',_0x509ba4,_0x30971d);_0x54bc14(_0x30971d);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 659fcdc..8fd7a26 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 _0x483a=['show','/:id/download','download','post','create','delete','/:id','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','isAuthenticated'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x483a,0x129));var _0xa483=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x483a[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xa483('0x0'));var util=require(_0xa483('0x1'));var path=require('path');var timeout=require(_0xa483('0x2'));var express=require(_0xa483('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa483('0x4'));var interaction=require(_0xa483('0x5'));var config=require(_0xa483('0x6'));var controller=require(_0xa483('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth[_0xa483('0x8')](),controller[_0xa483('0x9')]);router['get'](_0xa483('0xa'),auth[_0xa483('0x8')](),controller[_0xa483('0xb')]);router[_0xa483('0xc')]('/',auth[_0xa483('0x8')](),controller[_0xa483('0xd')]);router['put']('/:id',auth[_0xa483('0x8')](),controller['update']);router[_0xa483('0xe')](_0xa483('0xf'),auth[_0xa483('0x8')](),controller[_0xa483('0x10')]);module[_0xa483('0x11')]=router; \ No newline at end of file +var _0xb602=['./voiceMailMessage.controller','get','index','isAuthenticated','/:id/download','post','create','put','/:id','update','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2d1e5c,_0x47b0a4){var _0x5462b2=function(_0x280127){while(--_0x280127){_0x2d1e5c['push'](_0x2d1e5c['shift']());}};_0x5462b2(++_0x47b0a4);}(_0xb602,0x7e));var _0x2b60=function(_0x1a61c1,_0x2f064d){_0x1a61c1=_0x1a61c1-0x0;var _0x2240bf=_0xb602[_0x1a61c1];return _0x2240bf;};'use strict';var multer=require(_0x2b60('0x0'));var util=require('util');var path=require(_0x2b60('0x1'));var timeout=require('connect-timeout');var express=require(_0x2b60('0x2'));var router=express[_0x2b60('0x3')]();var fs_extra=require(_0x2b60('0x4'));var auth=require(_0x2b60('0x5'));var interaction=require(_0x2b60('0x6'));var config=require('../../config/environment');var controller=require(_0x2b60('0x7'));router[_0x2b60('0x8')]('/',auth['isAuthenticated'](),controller[_0x2b60('0x9')]);router[_0x2b60('0x8')]('/:id',auth[_0x2b60('0xa')](),controller['show']);router['get'](_0x2b60('0xb'),auth['isAuthenticated'](),controller['download']);router[_0x2b60('0xc')]('/',auth[_0x2b60('0xa')](),controller[_0x2b60('0xd')]);router[_0x2b60('0xe')](_0x2b60('0xf'),auth[_0x2b60('0xa')](),controller[_0x2b60('0x10')]);router['delete'](_0x2b60('0xf'),auth[_0x2b60('0xa')](),controller[_0x2b60('0x11')]);module[_0x2b60('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 32eb593..de0993f 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 _0x1b80=['sequelize','exports','INTEGER','STRING','BLOB','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP'];(function(_0x129c92,_0xd109dc){var _0x3d0a98=function(_0x40c015){while(--_0x40c015){_0x129c92['push'](_0x129c92['shift']());}};_0x3d0a98(++_0xd109dc);}(_0x1b80,0xb0));var _0x01b8=function(_0x4c0b35,_0x33eaed){_0x4c0b35=_0x4c0b35-0x0;var _0x232467=_0x1b80[_0x4c0b35];return _0x232467;};'use strict';var Sequelize=require(_0x01b8('0x0'));module[_0x01b8('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x13e6c6){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0x01b8('0x2')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x01b8('0x3')],'defaultValue':''},'context':{'type':Sequelize[_0x01b8('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x01b8('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0x01b8('0x3')],'defaultValue':''},'origtime':{'type':Sequelize[_0x01b8('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0x01b8('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x01b8('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0x01b8('0x4')]('long'),'defaultValue':null},'flag':{'type':Sequelize[_0x01b8('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x01b8('0x3')],'defaultValue':''},'stamp':{'type':_0x01b8('0x5'),'defaultValue':Sequelize[_0x01b8('0x6')](_0x01b8('0x7'))}}; \ No newline at end of file +var _0xaa76=['VIRTUAL','getDataValue','INTEGER','STRING','BLOB','long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','exports'];(function(_0x174047,_0x10cdc7){var _0x59b98e=function(_0x2d9010){while(--_0x2d9010){_0x174047['push'](_0x174047['shift']());}};_0x59b98e(++_0x10cdc7);}(_0xaa76,0xef));var _0x6aa7=function(_0x25c774,_0x6fb9d9){_0x25c774=_0x25c774-0x0;var _0x40512c=_0xaa76[_0x25c774];return _0x40512c;};'use strict';var Sequelize=require('sequelize');module[_0x6aa7('0x0')]={'name':{'type':Sequelize[_0x6aa7('0x1')],'get':function(_0x2dfd03){return this[_0x6aa7('0x2')]('id');}},'msgnum':{'type':Sequelize[_0x6aa7('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0x6aa7('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0x6aa7('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0x6aa7('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x6aa7('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x6aa7('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0x6aa7('0x5')](_0x6aa7('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0x6aa7('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x6aa7('0x4')],'defaultValue':''},'stamp':{'type':_0x6aa7('0x7'),'defaultValue':Sequelize[_0x6aa7('0x8')](_0x6aa7('0x9'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 2e002de..0805d8e 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 _0x4dfd=['VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','download','msg_id','recording','ValidationError','VoiceMailMessage\x20not\x20found','Content-Disposition','attachment;\x20filename=\x22','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','VoiceMailMessage','rawAttributes','type','model','query','keys','filters','intersection','fields','length','attributes','sort','pick','filter','where','merge'];(function(_0x134e41,_0x1316b2){var _0x5c46a9=function(_0x317cb2){while(--_0x317cb2){_0x134e41['push'](_0x134e41['shift']());}};_0x5c46a9(++_0x1316b2);}(_0x4dfd,0x15b));var _0xd4df=function(_0x3c420f,_0x411692){_0x3c420f=_0x3c420f-0x0;var _0x10765f=_0x4dfd[_0x3c420f];return _0x10765f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd4df('0x0'));var zipdir=require(_0xd4df('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd4df('0x2'));var moment=require(_0xd4df('0x3'));var BPromise=require(_0xd4df('0x4'));var Mustache=require(_0xd4df('0x5'));var util=require(_0xd4df('0x6'));var path=require(_0xd4df('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd4df('0x8'));var fs=require('fs');var fs_extra=require(_0xd4df('0x9'));var _=require(_0xd4df('0xa'));var squel=require(_0xd4df('0xb'));var crypto=require(_0xd4df('0xc'));var jsforce=require(_0xd4df('0xd'));var deskjs=require(_0xd4df('0xe'));var toCsv=require(_0xd4df('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd4df('0x10'));var authService=require(_0xd4df('0x11'));var qs=require(_0xd4df('0x12'));var as=require(_0xd4df('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd4df('0x14'))(_0xd4df('0x15'));var utils=require(_0xd4df('0x16'));var config=require(_0xd4df('0x17'));var licenseUtil=require(_0xd4df('0x18'));var db=require(_0xd4df('0x19'))['db'];function respondWithStatusCode(_0x21e26a,_0x2d25ff){_0x2d25ff=_0x2d25ff||0xcc;return function(_0x859ea7){if(_0x859ea7){return _0x21e26a[_0xd4df('0x1a')](_0x2d25ff);}return _0x21e26a['status'](_0x2d25ff)[_0xd4df('0x1b')]();};}function respondWithResult(_0x1a224,_0x551382){_0x551382=_0x551382||0xc8;return function(_0x5deb7d){if(_0x5deb7d){return _0x1a224[_0xd4df('0x1c')](_0x551382)[_0xd4df('0x1d')](_0x5deb7d);}};}function respondWithFilteredResult(_0x5e3669,_0x4f4a24){return function(_0x4fe85c){if(_0x4fe85c){var _0x156877=typeof _0x4f4a24[_0xd4df('0x1e')]===_0xd4df('0x1f')&&typeof _0x4f4a24[_0xd4df('0x20')]===_0xd4df('0x1f');var _0x220eff=_0x4fe85c[_0xd4df('0x21')];var _0x4df6f7=_0x156877?0x0:_0x4f4a24[_0xd4df('0x1e')];var _0x4615ff=_0x156877?_0x4fe85c['count']:_0x4f4a24[_0xd4df('0x1e')]+_0x4f4a24[_0xd4df('0x20')];var _0xcad192;if(_0x4615ff>=_0x220eff){_0x4615ff=_0x220eff;_0xcad192=0xc8;}else{_0xcad192=0xce;}_0x5e3669['status'](_0xcad192);return _0x5e3669[_0xd4df('0x22')]('Content-Range',_0x4df6f7+'-'+_0x4615ff+'/'+_0x220eff)[_0xd4df('0x1d')](_0x4fe85c);}return null;};}function patchUpdates(_0x535e49){return function(_0x565032){try{jsonpatch[_0xd4df('0x23')](_0x565032,_0x535e49,!![]);}catch(_0x563439){return BPromise[_0xd4df('0x24')](_0x563439);}return _0x565032[_0xd4df('0x25')]();};}function saveUpdates(_0x85a99d,_0x2d9a47){return function(_0x45566a){if(_0x45566a){return _0x45566a[_0xd4df('0x26')](_0x85a99d)['then'](function(_0x2b540a){return _0x2b540a;});}return null;};}function removeEntity(_0x1919b2,_0x76086b){return function(_0x515509){if(_0x515509){return _0x515509[_0xd4df('0x27')]()[_0xd4df('0x28')](function(){_0x1919b2[_0xd4df('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x667a40,_0x4b1089){return function(_0x530b33){if(!_0x530b33){_0x667a40[_0xd4df('0x1a')](0x194);}return _0x530b33;};}function handleError(_0x2dbb62,_0x88d269){_0x88d269=_0x88d269||0x1f4;return function(_0x24218c){logger[_0xd4df('0x29')](_0x24218c[_0xd4df('0x2a')]);if(_0x24218c[_0xd4df('0x2b')]){delete _0x24218c[_0xd4df('0x2b')];}_0x2dbb62[_0xd4df('0x1c')](_0x88d269)[_0xd4df('0x2c')](_0x24218c);};}exports[_0xd4df('0x2d')]=function(_0x3a4a73,_0x4af38b){var _0x321f63={},_0x198692={},_0x21f4be={'count':0x0,'rows':[]};var _0x187032=_[_0xd4df('0x2e')](db[_0xd4df('0x2f')][_0xd4df('0x30')],function(_0xca2ce){return{'name':_0xca2ce['fieldName'],'type':_0xca2ce[_0xd4df('0x31')]['key']};});_0x198692[_0xd4df('0x32')]=_['differenceBy'](_[_0xd4df('0x2e')](_0x187032,_0xd4df('0x2b')),[_0xd4df('0x2b')]);_0x198692[_0xd4df('0x33')]=_[_0xd4df('0x34')](_0x3a4a73[_0xd4df('0x33')]);_0x198692[_0xd4df('0x35')]=_[_0xd4df('0x36')](_0x198692[_0xd4df('0x32')],_0x198692['query']);_0x321f63['attributes']=_[_0xd4df('0x36')](_0x198692[_0xd4df('0x32')],qs[_0xd4df('0x37')](_0x3a4a73[_0xd4df('0x33')][_0xd4df('0x37')]));_0x321f63['attributes']=_0x321f63['attributes'][_0xd4df('0x38')]?_0x321f63[_0xd4df('0x39')]:_0x198692[_0xd4df('0x32')];if(!_0x3a4a73['query']['hasOwnProperty']('nolimit')){_0x321f63[_0xd4df('0x20')]=qs[_0xd4df('0x20')](_0x3a4a73[_0xd4df('0x33')][_0xd4df('0x20')]);_0x321f63['offset']=qs[_0xd4df('0x1e')](_0x3a4a73[_0xd4df('0x33')]['offset']);}_0x321f63['order']=qs[_0xd4df('0x3a')](_0x3a4a73[_0xd4df('0x33')][_0xd4df('0x3a')]);_0x321f63['where']=qs[_0xd4df('0x35')](_[_0xd4df('0x3b')](_0x3a4a73[_0xd4df('0x33')],_0x198692[_0xd4df('0x35')]),_0x187032);if(_0x3a4a73['query'][_0xd4df('0x3c')]){_0x321f63[_0xd4df('0x3d')]=_[_0xd4df('0x3e')](_0x321f63[_0xd4df('0x3d')],{'$or':_[_0xd4df('0x2e')](_0x187032,function(_0xd9b54){if(_0xd9b54['type']!==_0xd4df('0x3f')){var _0x1a1f01={};_0x1a1f01[_0xd9b54[_0xd4df('0x2b')]]={'$like':'%'+_0x3a4a73[_0xd4df('0x33')][_0xd4df('0x3c')]+'%'};return _0x1a1f01;}})});}_0x321f63=_[_0xd4df('0x3e')]({},_0x321f63,_0x3a4a73[_0xd4df('0x40')]);var _0x2ae53b={'where':_0x321f63['where']};return db['VoiceMailMessage'][_0xd4df('0x21')](_0x2ae53b)[_0xd4df('0x28')](function(_0x557ebf){_0x21f4be['count']=_0x557ebf;if(_0x3a4a73['query'][_0xd4df('0x41')]){_0x321f63[_0xd4df('0x42')]=[{'all':!![]}];}return db['VoiceMailMessage'][_0xd4df('0x43')](_0x321f63);})[_0xd4df('0x28')](function(_0x360eab){_0x21f4be[_0xd4df('0x44')]=_0x360eab;return _0x21f4be;})['then'](respondWithFilteredResult(_0x4af38b,_0x321f63))[_0xd4df('0x45')](handleError(_0x4af38b,null));};exports[_0xd4df('0x46')]=function(_0x40c5ea,_0x4c2cc1){var _0x19dc09={'raw':!![],'where':{'id':_0x40c5ea[_0xd4df('0x47')]['id']}},_0x47ae33={};_0x47ae33[_0xd4df('0x32')]=_[_0xd4df('0x34')](db['VoiceMailMessage'][_0xd4df('0x30')]);_0x47ae33[_0xd4df('0x33')]=_[_0xd4df('0x34')](_0x40c5ea[_0xd4df('0x33')]);_0x47ae33[_0xd4df('0x35')]=_[_0xd4df('0x36')](_0x47ae33[_0xd4df('0x32')],_0x47ae33[_0xd4df('0x33')]);_0x19dc09[_0xd4df('0x39')]=_[_0xd4df('0x36')](_0x47ae33[_0xd4df('0x32')],qs[_0xd4df('0x37')](_0x40c5ea[_0xd4df('0x33')][_0xd4df('0x37')]));_0x19dc09[_0xd4df('0x39')]=_0x19dc09[_0xd4df('0x39')][_0xd4df('0x38')]?_0x19dc09[_0xd4df('0x39')]:_0x47ae33[_0xd4df('0x32')];if(_0x40c5ea[_0xd4df('0x33')][_0xd4df('0x41')]){_0x19dc09[_0xd4df('0x42')]=[{'all':!![]}];}_0x19dc09=_[_0xd4df('0x3e')]({},_0x19dc09,_0x40c5ea[_0xd4df('0x40')]);return db[_0xd4df('0x2f')][_0xd4df('0x48')](_0x19dc09)[_0xd4df('0x28')](handleEntityNotFound(_0x4c2cc1,null))['then'](respondWithResult(_0x4c2cc1,null))[_0xd4df('0x45')](handleError(_0x4c2cc1,null));};exports[_0xd4df('0x49')]=function(_0x49f537,_0x391170){return db['VoiceMailMessage'][_0xd4df('0x49')](_0x49f537[_0xd4df('0x4a')],{})['then'](respondWithResult(_0x391170,0xc9))[_0xd4df('0x45')](handleError(_0x391170,null));};exports[_0xd4df('0x26')]=function(_0xe8ecb8,_0x594491){if(_0xe8ecb8['body']['id']){delete _0xe8ecb8[_0xd4df('0x4a')]['id'];}return db[_0xd4df('0x2f')]['find']({'where':{'id':_0xe8ecb8['params']['id']}})['then'](handleEntityNotFound(_0x594491,null))[_0xd4df('0x28')](saveUpdates(_0xe8ecb8[_0xd4df('0x4a')],null))[_0xd4df('0x28')](respondWithResult(_0x594491,null))[_0xd4df('0x45')](handleError(_0x594491,null));};exports['destroy']=function(_0x1cbf84,_0x5480d3){return db[_0xd4df('0x2f')][_0xd4df('0x48')]({'where':{'id':_0x1cbf84['params']['id']}})[_0xd4df('0x28')](handleEntityNotFound(_0x5480d3,null))[_0xd4df('0x28')](removeEntity(_0x5480d3,null))[_0xd4df('0x45')](handleError(_0x5480d3,null));};exports[_0xd4df('0x4b')]=function(_0x29fc0d,_0x5c17c7,_0x82d00d){return db[_0xd4df('0x2f')][_0xd4df('0x48')]({'where':{'id':_0x29fc0d['params']['id']},'attributes':['id','recording',_0xd4df('0x4c')]})[_0xd4df('0x28')](handleEntityNotFound(_0x5c17c7,null))[_0xd4df('0x28')](function(_0x1c9920){if(_0x1c9920){if(!_0x1c9920[_0xd4df('0x4d')]){throw new db['Sequelize'][(_0xd4df('0x4e'))](_0xd4df('0x4f'));}var _0x976d7d={'Content-Type':'audio/wav','Content-Disposition':'attachment'};if(_0x1c9920[_0xd4df('0x4c')]){_0x976d7d[_0xd4df('0x50')]=_0xd4df('0x51')+_0x1c9920[_0xd4df('0x4c')]+'.wav\x22';}_0x5c17c7[_0xd4df('0x22')](_0x976d7d);return _0x5c17c7[_0xd4df('0x2c')](new Buffer(_0x1c9920[_0xd4df('0x4d')]));}})[_0xd4df('0x45')](handleError(_0x5c17c7,null));}; \ No newline at end of file +var _0x5f7f=['ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','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','index','map','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','show','VoiceMailMessage','rawAttributes','keys','catch','body','find','params','download','msg_id','recording','ValidationError','VoiceMailMessage\x20not\x20found','Content-Disposition','attachment;\x20filename=\x22','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv'];(function(_0xe706b4,_0xb83514){var _0x34172d=function(_0x4bebb0){while(--_0x4bebb0){_0xe706b4['push'](_0xe706b4['shift']());}};_0x34172d(++_0xb83514);}(_0x5f7f,0x133));var _0xf5f7=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x5f7f[_0x2f5ac5];return _0x37c9a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf5f7('0x0'));var zipdir=require(_0xf5f7('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf5f7('0x2'));var moment=require(_0xf5f7('0x3'));var BPromise=require(_0xf5f7('0x4'));var Mustache=require('mustache');var util=require(_0xf5f7('0x5'));var path=require(_0xf5f7('0x6'));var sox=require(_0xf5f7('0x7'));var csv=require(_0xf5f7('0x8'));var ejs=require(_0xf5f7('0x9'));var fs=require('fs');var fs_extra=require(_0xf5f7('0xa'));var _=require('lodash');var squel=require(_0xf5f7('0xb'));var crypto=require(_0xf5f7('0xc'));var jsforce=require(_0xf5f7('0xd'));var deskjs=require(_0xf5f7('0xe'));var toCsv=require(_0xf5f7('0x8'));var querystring=require(_0xf5f7('0xf'));var Papa=require('papaparse');var Redis=require(_0xf5f7('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xf5f7('0x11'));var as=require(_0xf5f7('0x12'));var hardwareService=require(_0xf5f7('0x13'));var logger=require('../../config/logger')(_0xf5f7('0x14'));var utils=require(_0xf5f7('0x15'));var config=require(_0xf5f7('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xf5f7('0x17'))['db'];function respondWithStatusCode(_0x315140,_0x127326){_0x127326=_0x127326||0xcc;return function(_0xa8cce4){if(_0xa8cce4){return _0x315140[_0xf5f7('0x18')](_0x127326);}return _0x315140[_0xf5f7('0x19')](_0x127326)[_0xf5f7('0x1a')]();};}function respondWithResult(_0xb91357,_0x13d5f1){_0x13d5f1=_0x13d5f1||0xc8;return function(_0x248b44){if(_0x248b44){return _0xb91357[_0xf5f7('0x19')](_0x13d5f1)[_0xf5f7('0x1b')](_0x248b44);}};}function respondWithFilteredResult(_0x3787ca,_0x4a0e55){return function(_0x2d4d55){if(_0x2d4d55){var _0x42d728=typeof _0x4a0e55[_0xf5f7('0x1c')]===_0xf5f7('0x1d')&&typeof _0x4a0e55[_0xf5f7('0x1e')]===_0xf5f7('0x1d');var _0x4605a1=_0x2d4d55[_0xf5f7('0x1f')];var _0x1d7e31=_0x42d728?0x0:_0x4a0e55['offset'];var _0x5c2b27=_0x42d728?_0x2d4d55[_0xf5f7('0x1f')]:_0x4a0e55[_0xf5f7('0x1c')]+_0x4a0e55[_0xf5f7('0x1e')];var _0xb51fa1;if(_0x5c2b27>=_0x4605a1){_0x5c2b27=_0x4605a1;_0xb51fa1=0xc8;}else{_0xb51fa1=0xce;}_0x3787ca[_0xf5f7('0x19')](_0xb51fa1);return _0x3787ca[_0xf5f7('0x20')](_0xf5f7('0x21'),_0x1d7e31+'-'+_0x5c2b27+'/'+_0x4605a1)[_0xf5f7('0x1b')](_0x2d4d55);}return null;};}function patchUpdates(_0x40e1fd){return function(_0x1304f6){try{jsonpatch[_0xf5f7('0x22')](_0x1304f6,_0x40e1fd,!![]);}catch(_0x52725b){return BPromise[_0xf5f7('0x23')](_0x52725b);}return _0x1304f6[_0xf5f7('0x24')]();};}function saveUpdates(_0x3aaa10,_0x4c184a){return function(_0x4270db){if(_0x4270db){return _0x4270db[_0xf5f7('0x25')](_0x3aaa10)[_0xf5f7('0x26')](function(_0x3f6230){return _0x3f6230;});}return null;};}function removeEntity(_0x2bac18,_0x41849a){return function(_0x28874f){if(_0x28874f){return _0x28874f[_0xf5f7('0x27')]()['then'](function(){_0x2bac18[_0xf5f7('0x19')](0xcc)[_0xf5f7('0x1a')]();});}};}function handleEntityNotFound(_0x4164c7,_0x20826e){return function(_0x47fe70){if(!_0x47fe70){_0x4164c7['sendStatus'](0x194);}return _0x47fe70;};}function handleError(_0x52d726,_0x5642fc){_0x5642fc=_0x5642fc||0x1f4;return function(_0x597683){logger[_0xf5f7('0x28')](_0x597683['stack']);if(_0x597683[_0xf5f7('0x29')]){delete _0x597683[_0xf5f7('0x29')];}_0x52d726[_0xf5f7('0x19')](_0x5642fc)['send'](_0x597683);};}exports[_0xf5f7('0x2a')]=function(_0x493358,_0x2e29f6){var _0xe47f81={},_0x85998d={},_0x4a08f7={'count':0x0,'rows':[]};var _0x48167f=_[_0xf5f7('0x2b')](db['VoiceMailMessage']['rawAttributes'],function(_0x2c5d66){return{'name':_0x2c5d66[_0xf5f7('0x2c')],'type':_0x2c5d66[_0xf5f7('0x2d')][_0xf5f7('0x2e')]};});_0x85998d[_0xf5f7('0x2f')]=_['differenceBy'](_[_0xf5f7('0x2b')](_0x48167f,'name'),[_0xf5f7('0x29')]);_0x85998d['query']=_['keys'](_0x493358[_0xf5f7('0x30')]);_0x85998d[_0xf5f7('0x31')]=_[_0xf5f7('0x32')](_0x85998d[_0xf5f7('0x2f')],_0x85998d[_0xf5f7('0x30')]);_0xe47f81[_0xf5f7('0x33')]=_[_0xf5f7('0x32')](_0x85998d['model'],qs[_0xf5f7('0x34')](_0x493358[_0xf5f7('0x30')][_0xf5f7('0x34')]));_0xe47f81['attributes']=_0xe47f81[_0xf5f7('0x33')][_0xf5f7('0x35')]?_0xe47f81[_0xf5f7('0x33')]:_0x85998d['model'];if(!_0x493358['query'][_0xf5f7('0x36')]('nolimit')){_0xe47f81[_0xf5f7('0x1e')]=qs[_0xf5f7('0x1e')](_0x493358['query'][_0xf5f7('0x1e')]);_0xe47f81[_0xf5f7('0x1c')]=qs[_0xf5f7('0x1c')](_0x493358[_0xf5f7('0x30')][_0xf5f7('0x1c')]);}_0xe47f81[_0xf5f7('0x37')]=qs[_0xf5f7('0x38')](_0x493358[_0xf5f7('0x30')][_0xf5f7('0x38')]);_0xe47f81[_0xf5f7('0x39')]=qs[_0xf5f7('0x31')](_['pick'](_0x493358[_0xf5f7('0x30')],_0x85998d[_0xf5f7('0x31')]),_0x48167f);if(_0x493358['query'][_0xf5f7('0x3a')]){_0xe47f81[_0xf5f7('0x39')]=_[_0xf5f7('0x3b')](_0xe47f81['where'],{'$or':_['map'](_0x48167f,function(_0x2dead7){if(_0x2dead7[_0xf5f7('0x2d')]!==_0xf5f7('0x3c')){var _0x19b3a5={};_0x19b3a5[_0x2dead7['name']]={'$like':'%'+_0x493358[_0xf5f7('0x30')][_0xf5f7('0x3a')]+'%'};return _0x19b3a5;}})});}_0xe47f81=_[_0xf5f7('0x3b')]({},_0xe47f81,_0x493358[_0xf5f7('0x3d')]);var _0x38f15d={'where':_0xe47f81[_0xf5f7('0x39')]};return db['VoiceMailMessage'][_0xf5f7('0x1f')](_0x38f15d)[_0xf5f7('0x26')](function(_0xed56ed){_0x4a08f7[_0xf5f7('0x1f')]=_0xed56ed;if(_0x493358[_0xf5f7('0x30')]['includeAll']){_0xe47f81[_0xf5f7('0x3e')]=[{'all':!![]}];}return db['VoiceMailMessage'][_0xf5f7('0x3f')](_0xe47f81);})[_0xf5f7('0x26')](function(_0x3f126e){_0x4a08f7['rows']=_0x3f126e;return _0x4a08f7;})[_0xf5f7('0x26')](respondWithFilteredResult(_0x2e29f6,_0xe47f81))['catch'](handleError(_0x2e29f6,null));};exports[_0xf5f7('0x40')]=function(_0x5beb2d,_0x56a8c8){var _0x5c056e={'raw':!![],'where':{'id':_0x5beb2d['params']['id']}},_0x29a7f9={};_0x29a7f9[_0xf5f7('0x2f')]=_['keys'](db[_0xf5f7('0x41')][_0xf5f7('0x42')]);_0x29a7f9[_0xf5f7('0x30')]=_[_0xf5f7('0x43')](_0x5beb2d[_0xf5f7('0x30')]);_0x29a7f9[_0xf5f7('0x31')]=_[_0xf5f7('0x32')](_0x29a7f9[_0xf5f7('0x2f')],_0x29a7f9[_0xf5f7('0x30')]);_0x5c056e[_0xf5f7('0x33')]=_[_0xf5f7('0x32')](_0x29a7f9[_0xf5f7('0x2f')],qs[_0xf5f7('0x34')](_0x5beb2d[_0xf5f7('0x30')][_0xf5f7('0x34')]));_0x5c056e[_0xf5f7('0x33')]=_0x5c056e[_0xf5f7('0x33')][_0xf5f7('0x35')]?_0x5c056e[_0xf5f7('0x33')]:_0x29a7f9[_0xf5f7('0x2f')];if(_0x5beb2d[_0xf5f7('0x30')]['includeAll']){_0x5c056e[_0xf5f7('0x3e')]=[{'all':!![]}];}_0x5c056e=_[_0xf5f7('0x3b')]({},_0x5c056e,_0x5beb2d[_0xf5f7('0x3d')]);return db['VoiceMailMessage']['find'](_0x5c056e)[_0xf5f7('0x26')](handleEntityNotFound(_0x56a8c8,null))[_0xf5f7('0x26')](respondWithResult(_0x56a8c8,null))[_0xf5f7('0x44')](handleError(_0x56a8c8,null));};exports['create']=function(_0x31ee75,_0x4112f2){return db[_0xf5f7('0x41')]['create'](_0x31ee75[_0xf5f7('0x45')],{})[_0xf5f7('0x26')](respondWithResult(_0x4112f2,0xc9))['catch'](handleError(_0x4112f2,null));};exports[_0xf5f7('0x25')]=function(_0x4dd72e,_0x544ea2){if(_0x4dd72e[_0xf5f7('0x45')]['id']){delete _0x4dd72e['body']['id'];}return db[_0xf5f7('0x41')]['find']({'where':{'id':_0x4dd72e['params']['id']}})['then'](handleEntityNotFound(_0x544ea2,null))['then'](saveUpdates(_0x4dd72e['body'],null))[_0xf5f7('0x26')](respondWithResult(_0x544ea2,null))['catch'](handleError(_0x544ea2,null));};exports['destroy']=function(_0x408338,_0x2cddbf){return db[_0xf5f7('0x41')][_0xf5f7('0x46')]({'where':{'id':_0x408338[_0xf5f7('0x47')]['id']}})[_0xf5f7('0x26')](handleEntityNotFound(_0x2cddbf,null))[_0xf5f7('0x26')](removeEntity(_0x2cddbf,null))[_0xf5f7('0x44')](handleError(_0x2cddbf,null));};exports[_0xf5f7('0x48')]=function(_0x108d4b,_0x4eb431,_0xb45bcd){return db[_0xf5f7('0x41')][_0xf5f7('0x46')]({'where':{'id':_0x108d4b[_0xf5f7('0x47')]['id']},'attributes':['id','recording',_0xf5f7('0x49')]})['then'](handleEntityNotFound(_0x4eb431,null))['then'](function(_0x93899a){if(_0x93899a){if(!_0x93899a[_0xf5f7('0x4a')]){throw new db['Sequelize'][(_0xf5f7('0x4b'))](_0xf5f7('0x4c'));}var _0x54c96c={'Content-Type':'audio/wav','Content-Disposition':'attachment'};if(_0x93899a[_0xf5f7('0x49')]){_0x54c96c[_0xf5f7('0x4d')]=_0xf5f7('0x4e')+_0x93899a['msg_id']+'.wav\x22';}_0x4eb431[_0xf5f7('0x20')](_0x54c96c);return _0x4eb431['send'](new Buffer(_0x93899a['recording']));}})[_0xf5f7('0x44')](handleError(_0x4eb431,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index ff516ee..b99e260 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 _0xcda8=['./voiceMailMessage.attributes','exports','define','voice_voicemail_messages','dir','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x4c0252,_0x13e6aa){var _0x157791=function(_0x19d825){while(--_0x19d825){_0x4c0252['push'](_0x4c0252['shift']());}};_0x157791(++_0x13e6aa);}(_0xcda8,0x131));var _0x8cda=function(_0x39488e,_0x4d61cf){_0x39488e=_0x39488e-0x0;var _0x3389cd=_0xcda8[_0x39488e];return _0x3389cd;};'use strict';var _=require('lodash');var util=require(_0x8cda('0x0'));var logger=require(_0x8cda('0x1'))(_0x8cda('0x2'));var moment=require(_0x8cda('0x3'));var BPromise=require(_0x8cda('0x4'));var rp=require(_0x8cda('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8cda('0x6'));var config=require('../../config/environment');var attributes=require(_0x8cda('0x7'));module[_0x8cda('0x8')]=function(_0x1e64d0,_0x16dd42){return _0x1e64d0[_0x8cda('0x9')]('VoiceMailMessage',attributes,{'tableName':_0x8cda('0xa'),'paranoid':![],'indexes':[{'name':_0x8cda('0xb'),'fields':[_0x8cda('0xb')]}],'timestamps':![]});}; \ No newline at end of file +var _0xfa77=['dir','util','api','moment','bluebird','path','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','voice_voicemail_messages'];(function(_0xf8f4fa,_0x4cf6d2){var _0x117289=function(_0x581a9f){while(--_0x581a9f){_0xf8f4fa['push'](_0xf8f4fa['shift']());}};_0x117289(++_0x4cf6d2);}(_0xfa77,0x146));var _0x7fa7=function(_0x3ffb44,_0x4fc665){_0x3ffb44=_0x3ffb44-0x0;var _0x13cecf=_0xfa77[_0x3ffb44];return _0x13cecf;};'use strict';var _=require('lodash');var util=require(_0x7fa7('0x0'));var logger=require('../../config/logger')(_0x7fa7('0x1'));var moment=require(_0x7fa7('0x2'));var BPromise=require(_0x7fa7('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7fa7('0x4'));var rimraf=require(_0x7fa7('0x5'));var config=require(_0x7fa7('0x6'));var attributes=require(_0x7fa7('0x7'));module[_0x7fa7('0x8')]=function(_0x5e936c,_0x3ae45d){return _0x5e936c[_0x7fa7('0x9')](_0x7fa7('0xa'),attributes,{'tableName':_0x7fa7('0xb'),'paranoid':![],'indexes':[{'name':_0x7fa7('0xc'),'fields':[_0x7fa7('0xc')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 0ff4f6a..b69f064 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 _0xa8ee=['request','then','info','VoiceMailMessage,\x20%s,\x20%s','VoiceMailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','moment','randomstring','ioredis','../../config/utils','rpc','http'];(function(_0x21fe11,_0x52f846){var _0x5eb704=function(_0x6be159){while(--_0x6be159){_0x21fe11['push'](_0x21fe11['shift']());}};_0x5eb704(++_0x52f846);}(_0xa8ee,0x9b));var _0xea8e=function(_0x259593,_0x43de6d){_0x259593=_0x259593-0x0;var _0xa107e5=_0xa8ee[_0x259593];return _0xa107e5;};'use strict';var _=require(_0xea8e('0x0'));var util=require('util');var moment=require(_0xea8e('0x1'));var BPromise=require('bluebird');var rs=require(_0xea8e('0x2'));var fs=require('fs');var Redis=require(_0xea8e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xea8e('0x4'));var logger=require('../../config/logger')(_0xea8e('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xea8e('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x344368,_0x68ef45,_0x123f4e){return new BPromise(function(_0x4ca33f,_0x3d7394){return client[_0xea8e('0x7')](_0x344368,_0x123f4e)[_0xea8e('0x8')](function(_0x1b166d){logger[_0xea8e('0x9')](_0xea8e('0xa'),_0x68ef45,'request\x20sent');logger['debug'](_0xea8e('0xb'),_0x68ef45,_0xea8e('0xc'),JSON[_0xea8e('0xd')](_0x1b166d));if(_0x1b166d[_0xea8e('0xe')]){if(_0x1b166d['error']['code']===0x1f4){logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0x68ef45,_0x1b166d['error'][_0xea8e('0xf')]);return _0x3d7394(_0x1b166d[_0xea8e('0xe')][_0xea8e('0xf')]);}logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0x68ef45,_0x1b166d['error'][_0xea8e('0xf')]);return _0x4ca33f(_0x1b166d[_0xea8e('0xe')]['message']);}else{logger['info'](_0xea8e('0xa'),_0x68ef45,'request\x20sent');_0x4ca33f(_0x1b166d[_0xea8e('0x10')][_0xea8e('0xf')]);}})[_0xea8e('0x11')](function(_0x5ba3d1){logger[_0xea8e('0xe')](_0xea8e('0xa'),_0x68ef45,_0x5ba3d1);_0x3d7394(_0x5ba3d1);});});} \ No newline at end of file +var _0x4c87=['info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x35e631,_0x5f222d){var _0x577fa1=function(_0x8e1a5a){while(--_0x8e1a5a){_0x35e631['push'](_0x35e631['shift']());}};_0x577fa1(++_0x5f222d);}(_0x4c87,0x149));var _0x74c8=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4c87[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x74c8('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x74c8('0x1'));var fs=require('fs');var Redis=require(_0x74c8('0x2'));var db=require(_0x74c8('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x74c8('0x4'))(_0x74c8('0x5'));var config=require(_0x74c8('0x6'));var jayson=require(_0x74c8('0x7'));var client=jayson[_0x74c8('0x8')][_0x74c8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xd88976,_0x140256,_0x31c021){return new BPromise(function(_0x55076f,_0x5ec5dc){return client['request'](_0xd88976,_0x31c021)[_0x74c8('0xa')](function(_0x416597){logger[_0x74c8('0xb')](_0x74c8('0xc'),_0x140256,_0x74c8('0xd'));logger[_0x74c8('0xe')](_0x74c8('0xf'),_0x140256,_0x74c8('0xd'),JSON[_0x74c8('0x10')](_0x416597));if(_0x416597[_0x74c8('0x11')]){if(_0x416597['error'][_0x74c8('0x12')]===0x1f4){logger['error'](_0x74c8('0xc'),_0x140256,_0x416597['error']['message']);return _0x5ec5dc(_0x416597[_0x74c8('0x11')]['message']);}logger['error'](_0x74c8('0xc'),_0x140256,_0x416597[_0x74c8('0x11')][_0x74c8('0x13')]);return _0x55076f(_0x416597[_0x74c8('0x11')][_0x74c8('0x13')]);}else{logger[_0x74c8('0xb')]('VoiceMailMessage,\x20%s,\x20%s',_0x140256,_0x74c8('0xd'));_0x55076f(_0x416597['result'][_0x74c8('0x13')]);}})['catch'](function(_0xd1ce02){logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0x140256,_0xd1ce02);_0x5ec5dc(_0xd1ce02);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 18f67de..9e582c3 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 _0x60c7=['./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','/:id/sounds','getSounds','post','addSound','put','update','delete','destroy','removeSound','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x60c7,0xf6));var _0x760c=function(_0x719a8a,_0x4ef135){_0x719a8a=_0x719a8a-0x0;var _0x544545=_0x60c7[_0x719a8a];return _0x544545;};'use strict';var multer=require(_0x760c('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x760c('0x1'));var express=require('express');var router=express[_0x760c('0x2')]();var fs_extra=require(_0x760c('0x3'));var auth=require(_0x760c('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x760c('0x5'));var controller=require(_0x760c('0x6'));router[_0x760c('0x7')]('/',auth[_0x760c('0x8')](),controller[_0x760c('0x9')]);router[_0x760c('0x7')](_0x760c('0xa'),auth[_0x760c('0x8')](),controller['show']);router[_0x760c('0x7')](_0x760c('0xb'),auth[_0x760c('0x8')](),controller[_0x760c('0xc')]);router[_0x760c('0xd')]('/',auth[_0x760c('0x8')](),controller['create']);router[_0x760c('0xd')](_0x760c('0xb'),auth[_0x760c('0x8')](),controller[_0x760c('0xe')]);router[_0x760c('0xf')](_0x760c('0xa'),auth[_0x760c('0x8')](),controller[_0x760c('0x10')]);router[_0x760c('0x11')](_0x760c('0xa'),auth['isAuthenticated'](),controller[_0x760c('0x12')]);router[_0x760c('0x11')]('/:id/sounds/:id2',auth['isAuthenticated'](),controller[_0x760c('0x13')]);module[_0x760c('0x14')]=router; \ No newline at end of file +var _0x3616=['get','isAuthenticated','/:id','show','/:id/sounds','create','addSound','put','update','delete','destroy','/:id/sounds/:id2','removeSound','exports','multer','util','connect-timeout','express','fs-extra','../../config/environment','./voiceMusicOnHold.controller'];(function(_0xbcb22f,_0xd73558){var _0x30c8b7=function(_0x10740e){while(--_0x10740e){_0xbcb22f['push'](_0xbcb22f['shift']());}};_0x30c8b7(++_0xd73558);}(_0x3616,0x15e));var _0x6361=function(_0xb4acbe,_0x5c3a22){_0xb4acbe=_0xb4acbe-0x0;var _0x30b105=_0x3616[_0xb4acbe];return _0x30b105;};'use strict';var multer=require(_0x6361('0x0'));var util=require(_0x6361('0x1'));var path=require('path');var timeout=require(_0x6361('0x2'));var express=require(_0x6361('0x3'));var router=express['Router']();var fs_extra=require(_0x6361('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6361('0x5'));var controller=require(_0x6361('0x6'));router[_0x6361('0x7')]('/',auth[_0x6361('0x8')](),controller['index']);router[_0x6361('0x7')](_0x6361('0x9'),auth[_0x6361('0x8')](),controller[_0x6361('0xa')]);router[_0x6361('0x7')](_0x6361('0xb'),auth['isAuthenticated'](),controller['getSounds']);router['post']('/',auth['isAuthenticated'](),controller[_0x6361('0xc')]);router['post']('/:id/sounds',auth[_0x6361('0x8')](),controller[_0x6361('0xd')]);router[_0x6361('0xe')](_0x6361('0x9'),auth['isAuthenticated'](),controller[_0x6361('0xf')]);router[_0x6361('0x10')](_0x6361('0x9'),auth[_0x6361('0x8')](),controller[_0x6361('0x11')]);router[_0x6361('0x10')](_0x6361('0x12'),auth[_0x6361('0x8')](),controller[_0x6361('0x13')]);module[_0x6361('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index e38bc09..f3538bb 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 _0xe5a1=['mp3nb','quietmp3nb','mp3','alpha','BOOLEAN','exports','STRING','name','custom','files'];(function(_0x51241c,_0x46ab7b){var _0x599267=function(_0x405468){while(--_0x405468){_0x51241c['push'](_0x51241c['shift']());}};_0x599267(++_0x46ab7b);}(_0xe5a1,0x69));var _0x1e5a=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xe5a1[_0x4dbaad];return _0x226c72;};'use strict';var Sequelize=require('sequelize');module[_0x1e5a('0x0')]={'name':{'type':Sequelize[_0x1e5a('0x1')],'allowNull':![],'unique':_0x1e5a('0x2')},'mode':{'type':Sequelize['ENUM'](_0x1e5a('0x3'),_0x1e5a('0x4'),_0x1e5a('0x5'),_0x1e5a('0x6'),'quietmp3',_0x1e5a('0x7')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0x1e5a('0x1')],'allowNull':!![]},'application':{'type':Sequelize[_0x1e5a('0x1')],'allowNull':!![]},'digit':{'type':Sequelize[_0x1e5a('0x1')],'allowNull':!![]},'sort':{'type':Sequelize[_0x1e5a('0x1')],'allowNull':!![],'defaultValue':_0x1e5a('0x8')},'format':{'type':Sequelize[_0x1e5a('0x1')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0x1e5a('0x9')],'defaultValue':0x0}}; \ No newline at end of file +var _0x49e4=['mp3nb','quietmp3nb','quietmp3','alpha','TIMESTAMP','BOOLEAN','sequelize','exports','STRING','name','ENUM','files'];(function(_0x1394d0,_0xeed88f){var _0x1f2a7e=function(_0x26e638){while(--_0x26e638){_0x1394d0['push'](_0x1394d0['shift']());}};_0x1f2a7e(++_0xeed88f);}(_0x49e4,0x1ce));var _0x449e=function(_0x579547,_0x265445){_0x579547=_0x579547-0x0;var _0x1fd8ef=_0x49e4[_0x579547];return _0x1fd8ef;};'use strict';var Sequelize=require(_0x449e('0x0'));module[_0x449e('0x1')]={'name':{'type':Sequelize[_0x449e('0x2')],'allowNull':![],'unique':_0x449e('0x3')},'mode':{'type':Sequelize[_0x449e('0x4')]('custom',_0x449e('0x5'),_0x449e('0x6'),_0x449e('0x7'),_0x449e('0x8'),'mp3'),'allowNull':!![],'defaultValue':_0x449e('0x5')},'directory':{'type':Sequelize[_0x449e('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0x449e('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x449e('0x2')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x449e('0x9')},'format':{'type':Sequelize[_0x449e('0x2')],'allowNull':!![]},'stamp':{'type':_0x449e('0xa')},'defaultEntry':{'type':Sequelize[_0x449e('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 e4a4d2a..dfae8f8 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 _0xdce6=['format','%s.%s','converted_format','findOne','removeSound','id2','getSounds','eml-format','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','get','error','name','send','index','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','hasOwnProperty','nolimit','order','sort','pick','where','merge','filter','options','VoiceMusicOnHold','includeAll','include','findAll','rows','catch','fields','length','find','body','create','sequelize','transaction','mode','files','directory','root','server/files/moh','mkdirSync','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','readdirSync','forEach','unlinkSync','join','rmdirSync','Sequelize','ValidationError','message','addSound','Sound','save_name','createdAt'];(function(_0x2555d0,_0x4150a6){var _0x3bb486=function(_0x1eb89f){while(--_0x1eb89f){_0x2555d0['push'](_0x2555d0['shift']());}};_0x3bb486(++_0x4150a6);}(_0xdce6,0x145));var _0x6dce=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xdce6[_0x1ac595];return _0x455fff;};'use strict';var emlformat=require(_0x6dce('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6dce('0x1'));var moment=require(_0x6dce('0x2'));var BPromise=require(_0x6dce('0x3'));var Mustache=require('mustache');var util=require(_0x6dce('0x4'));var path=require(_0x6dce('0x5'));var sox=require(_0x6dce('0x6'));var csv=require('to-csv');var ejs=require(_0x6dce('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6dce('0x8'));var squel=require(_0x6dce('0x9'));var crypto=require(_0x6dce('0xa'));var jsforce=require(_0x6dce('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x6dce('0xc'));var querystring=require(_0x6dce('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6dce('0xe'));var qs=require(_0x6dce('0xf'));var as=require(_0x6dce('0x10'));var hardwareService=require(_0x6dce('0x11'));var logger=require(_0x6dce('0x12'))(_0x6dce('0x13'));var utils=require(_0x6dce('0x14'));var config=require(_0x6dce('0x15'));var licenseUtil=require(_0x6dce('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x155eed,_0x4db2a8){_0x4db2a8=_0x4db2a8||0xcc;return function(_0xa0ea2a){if(_0xa0ea2a){return _0x155eed[_0x6dce('0x17')](_0x4db2a8);}return _0x155eed[_0x6dce('0x18')](_0x4db2a8)[_0x6dce('0x19')]();};}function respondWithResult(_0x365e0f,_0x41b380){_0x41b380=_0x41b380||0xc8;return function(_0x8da005){if(_0x8da005){return _0x365e0f[_0x6dce('0x18')](_0x41b380)[_0x6dce('0x1a')](_0x8da005);}};}function respondWithFilteredResult(_0x3189d6,_0x2880e9){return function(_0x1b751b){if(_0x1b751b){var _0x54a9df=typeof _0x2880e9[_0x6dce('0x1b')]===_0x6dce('0x1c')&&typeof _0x2880e9[_0x6dce('0x1d')]==='undefined';var _0x591563=_0x1b751b[_0x6dce('0x1e')];var _0x40732f=_0x54a9df?0x0:_0x2880e9[_0x6dce('0x1b')];var _0x12b9c0=_0x54a9df?_0x1b751b[_0x6dce('0x1e')]:_0x2880e9['offset']+_0x2880e9[_0x6dce('0x1d')];var _0x5d0c18;if(_0x12b9c0>=_0x591563){_0x12b9c0=_0x591563;_0x5d0c18=0xc8;}else{_0x5d0c18=0xce;}_0x3189d6['status'](_0x5d0c18);return _0x3189d6[_0x6dce('0x1f')](_0x6dce('0x20'),_0x40732f+'-'+_0x12b9c0+'/'+_0x591563)[_0x6dce('0x1a')](_0x1b751b);}return null;};}function patchUpdates(_0x37f479){return function(_0x5008b9){try{jsonpatch[_0x6dce('0x21')](_0x5008b9,_0x37f479,!![]);}catch(_0x4db353){return BPromise['reject'](_0x4db353);}return _0x5008b9['save']();};}function saveUpdates(_0x5d9f86,_0x25d573){return function(_0x3b33eb){if(_0x3b33eb){return _0x3b33eb[_0x6dce('0x22')](_0x5d9f86)[_0x6dce('0x23')](function(_0x4a1844){return _0x4a1844;});}return null;};}function removeEntity(_0x33320e,_0x31e1c1){return function(_0x13b3d8){if(_0x13b3d8){return _0x13b3d8[_0x6dce('0x24')]()[_0x6dce('0x23')](function(){var _0x66d594=_0x13b3d8[_0x6dce('0x25')]({'plain':!![]});var _0x22f33f='MusicOnHolds';return db['UserProfileResource'][_0x6dce('0x24')]({'where':{'type':_0x22f33f,'resourceId':_0x66d594['id']}})[_0x6dce('0x23')](function(){return _0x13b3d8;});})[_0x6dce('0x23')](function(){_0x33320e[_0x6dce('0x18')](0xcc)[_0x6dce('0x19')]();});}};}function handleEntityNotFound(_0x4764f9,_0xc5c7a2){return function(_0x45f97d){if(!_0x45f97d){_0x4764f9['sendStatus'](0x194);}return _0x45f97d;};}function handleError(_0x11ccfe,_0x4063ad){_0x4063ad=_0x4063ad||0x1f4;return function(_0x3c73af){logger[_0x6dce('0x26')](_0x3c73af['stack']);if(_0x3c73af[_0x6dce('0x27')]){delete _0x3c73af[_0x6dce('0x27')];}_0x11ccfe['status'](_0x4063ad)[_0x6dce('0x28')](_0x3c73af);};}exports[_0x6dce('0x29')]=function(_0x3a6f17,_0x455a46){var _0x124702={},_0xa1a390={},_0x40448f={'count':0x0,'rows':[]};var _0x19c6a0=_['map'](db['VoiceMusicOnHold'][_0x6dce('0x2a')],function(_0x3d97c8){return{'name':_0x3d97c8[_0x6dce('0x2b')],'type':_0x3d97c8[_0x6dce('0x2c')][_0x6dce('0x2d')]};});_0xa1a390['model']=_[_0x6dce('0x2e')](_0x19c6a0,_0x6dce('0x27'));_0xa1a390[_0x6dce('0x2f')]=_[_0x6dce('0x30')](_0x3a6f17[_0x6dce('0x2f')]);_0xa1a390[_0x6dce('0x31')]=_[_0x6dce('0x32')](_0xa1a390[_0x6dce('0x33')],_0xa1a390[_0x6dce('0x2f')]);_0x124702[_0x6dce('0x34')]=_['intersection'](_0xa1a390[_0x6dce('0x33')],qs['fields'](_0x3a6f17['query']['fields']));_0x124702[_0x6dce('0x34')]=_0x124702[_0x6dce('0x34')]['length']?_0x124702[_0x6dce('0x34')]:_0xa1a390['model'];if(!_0x3a6f17[_0x6dce('0x2f')][_0x6dce('0x35')](_0x6dce('0x36'))){_0x124702[_0x6dce('0x1d')]=qs[_0x6dce('0x1d')](_0x3a6f17['query'][_0x6dce('0x1d')]);_0x124702[_0x6dce('0x1b')]=qs[_0x6dce('0x1b')](_0x3a6f17[_0x6dce('0x2f')][_0x6dce('0x1b')]);}_0x124702[_0x6dce('0x37')]=qs[_0x6dce('0x38')](_0x3a6f17[_0x6dce('0x2f')][_0x6dce('0x38')]);delete _0x3a6f17[_0x6dce('0x2f')][_0x6dce('0x38')];_0x124702['where']=qs[_0x6dce('0x31')](_[_0x6dce('0x39')](_0x3a6f17[_0x6dce('0x2f')],_0xa1a390[_0x6dce('0x31')]),_0x19c6a0);if(_0x3a6f17['query']['filter']){_0x124702[_0x6dce('0x3a')]=_[_0x6dce('0x3b')](_0x124702[_0x6dce('0x3a')],{'$or':_[_0x6dce('0x2e')](_0x19c6a0,function(_0x15b6d6){if(_0x15b6d6['type']!=='VIRTUAL'){var _0x51b78d={};_0x51b78d[_0x15b6d6['name']]={'$like':'%'+_0x3a6f17[_0x6dce('0x2f')][_0x6dce('0x3c')]+'%'};return _0x51b78d;}})});}_0x124702=_[_0x6dce('0x3b')]({},_0x124702,_0x3a6f17[_0x6dce('0x3d')]);var _0x16f425={'where':_0x124702[_0x6dce('0x3a')]};return db[_0x6dce('0x3e')][_0x6dce('0x1e')](_0x16f425)[_0x6dce('0x23')](function(_0x24b1e0){_0x40448f[_0x6dce('0x1e')]=_0x24b1e0;if(_0x3a6f17[_0x6dce('0x2f')][_0x6dce('0x3f')]){_0x124702[_0x6dce('0x40')]=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0x6dce('0x41')](_0x124702);})[_0x6dce('0x23')](function(_0x2eeb55){_0x40448f[_0x6dce('0x42')]=_0x2eeb55;return _0x40448f;})[_0x6dce('0x23')](respondWithFilteredResult(_0x455a46,_0x124702))[_0x6dce('0x43')](handleError(_0x455a46,null));};exports['show']=function(_0x9dd8f4,_0x5928a5){var _0x5d8158={'raw':![],'where':{'id':_0x9dd8f4['params']['id']}},_0x3049a2={};_0x3049a2['model']=_[_0x6dce('0x30')](db['VoiceMusicOnHold'][_0x6dce('0x2a')]);_0x3049a2[_0x6dce('0x2f')]=_[_0x6dce('0x30')](_0x9dd8f4[_0x6dce('0x2f')]);_0x3049a2[_0x6dce('0x31')]=_['intersection'](_0x3049a2[_0x6dce('0x33')],_0x3049a2[_0x6dce('0x2f')]);_0x5d8158[_0x6dce('0x34')]=_[_0x6dce('0x32')](_0x3049a2['model'],qs[_0x6dce('0x44')](_0x9dd8f4[_0x6dce('0x2f')][_0x6dce('0x44')]));_0x5d8158['attributes']=_0x5d8158['attributes'][_0x6dce('0x45')]?_0x5d8158['attributes']:_0x3049a2[_0x6dce('0x33')];if(_0x9dd8f4[_0x6dce('0x2f')][_0x6dce('0x3f')]){_0x5d8158[_0x6dce('0x40')]=[{'all':!![]}];}_0x5d8158=_[_0x6dce('0x3b')]({},_0x5d8158,_0x9dd8f4['options']);return db[_0x6dce('0x3e')][_0x6dce('0x46')](_0x5d8158)[_0x6dce('0x23')](handleEntityNotFound(_0x5928a5,null))['then'](respondWithResult(_0x5928a5,null))[_0x6dce('0x43')](handleError(_0x5928a5,null));};exports['update']=function(_0x2ba56d,_0x24f1d5){if(_0x2ba56d[_0x6dce('0x47')]['id']){delete _0x2ba56d[_0x6dce('0x47')]['id'];}return db[_0x6dce('0x3e')]['find']({'where':{'id':_0x2ba56d['params']['id']}})[_0x6dce('0x23')](handleEntityNotFound(_0x24f1d5,null))[_0x6dce('0x23')](saveUpdates(_0x2ba56d['body'],null))[_0x6dce('0x23')](respondWithResult(_0x24f1d5,null))[_0x6dce('0x43')](handleError(_0x24f1d5,null));};exports[_0x6dce('0x48')]=function(_0x57677f,_0x515050,_0x266543){return db[_0x6dce('0x49')][_0x6dce('0x4a')](function(_0x4e5f36){if(_0x57677f[_0x6dce('0x47')][_0x6dce('0x4b')]===_0x6dce('0x4c')){_0x57677f[_0x6dce('0x47')][_0x6dce('0x4d')]=path['join'](config[_0x6dce('0x4e')],_0x6dce('0x4f'),_0x57677f[_0x6dce('0x47')][_0x6dce('0x27')]);}return db['VoiceMusicOnHold'][_0x6dce('0x48')](_0x57677f[_0x6dce('0x47')],{'transaction':_0x4e5f36})['then'](function(_0x32103c){if(_0x57677f[_0x6dce('0x47')]['mode']===_0x6dce('0x4c')){fs[_0x6dce('0x50')](_0x32103c[_0x6dce('0x4d')],parseInt('0777',0x8));}var _0x3c7d6b=_0x57677f['user'][_0x6dce('0x25')]({'plain':!![]});if(!_0x3c7d6b)throw new Error(_0x6dce('0x51'));if(_0x3c7d6b['role']===_0x6dce('0x52')){var _0x58b71c=_0x32103c['get']({'plain':!![]});return db['UserProfileSection'][_0x6dce('0x46')]({'where':{'name':'MusicOnHolds','userProfileId':_0x3c7d6b['userProfileId']},'raw':!![]})[_0x6dce('0x23')](function(_0x121cfe){if(_0x121cfe&&_0x121cfe[_0x6dce('0x53')]===0x0){return db[_0x6dce('0x54')]['create']({'name':_0x58b71c[_0x6dce('0x27')],'resourceId':_0x58b71c['id'],'type':_0x121cfe[_0x6dce('0x27')],'sectionId':_0x121cfe['id']},{})[_0x6dce('0x23')](function(){return _0x32103c;});}else{return _0x32103c;}})[_0x6dce('0x43')](function(_0xd6140b){logger['error'](_0x6dce('0x55'),_0xd6140b);});}return _0x32103c;});})[_0x6dce('0x23')](respondWithResult(_0x515050,0xc9))[_0x6dce('0x43')](handleError(_0x515050,null));};exports['destroy']=function(_0x3aa8ca,_0x3de86d,_0x44f406){var _0x5ddb7d;return db[_0x6dce('0x3e')][_0x6dce('0x46')]({'where':{'id':_0x3aa8ca[_0x6dce('0x56')]['id']}})['then'](function(_0x4d8bea){if(_0x4d8bea){return db[_0x6dce('0x49')][_0x6dce('0x4a')](function(_0x352cdd){return _0x4d8bea[_0x6dce('0x24')]({'transaction':_0x352cdd,'raw':!![]})['then'](function(_0x4a2891){if(_0x4a2891[_0x6dce('0x4d')]){fs[_0x6dce('0x57')](_0x4a2891[_0x6dce('0x4d')])[_0x6dce('0x58')](function(_0x2b038a){fs[_0x6dce('0x59')](path[_0x6dce('0x5a')](_0x4a2891['directory'],_0x2b038a));});fs[_0x6dce('0x5b')](_0x4a2891['directory']);}return _0x4a2891;});})['catch'](function(_0x44373f){throw new db[(_0x6dce('0x5c'))][(_0x6dce('0x5d'))](_0x44373f[_0x6dce('0x5e')]);});}})['then'](handleEntityNotFound(_0x3de86d,null))[_0x6dce('0x23')](removeEntity(_0x3de86d,null))[_0x6dce('0x43')](handleError(_0x3de86d,null));};exports['addSound']=function(_0x3d92bb,_0x1904db,_0x40f41f){return db[_0x6dce('0x49')][_0x6dce('0x4a')](function(_0x22d672){var _0x18edab;return db[_0x6dce('0x3e')]['find']({'where':{'id':_0x3d92bb[_0x6dce('0x56')]['id']}})['then'](function(_0x4bb0c0){if(_0x4bb0c0){_0x18edab=_0x4bb0c0;return _0x4bb0c0[_0x6dce('0x5f')](_0x3d92bb['body']['id'],{'transaction':_0x22d672});}})[_0x6dce('0x23')](function(_0x3d4344){if(_0x3d4344){return db[_0x6dce('0x60')]['findOne']({'where':{'id':_0x3d92bb[_0x6dce('0x47')]['id']},'attributes':['id',_0x6dce('0x27'),_0x6dce('0x61'),'converted_format',_0x6dce('0x62')],'raw':!![]});}})[_0x6dce('0x23')](function(_0x38ace4){if(_0x38ace4){var _0x2cefbb=path['join'](config['root'],'server/files/sounds/converted',util[_0x6dce('0x63')](_0x6dce('0x64'),path['basename'](_0x38ace4[_0x6dce('0x61')],path['extname'](_0x38ace4['save_name'])),_0x38ace4[_0x6dce('0x65')]));var _0x56af6a=path[_0x6dce('0x5a')](config[_0x6dce('0x4e')],_0x6dce('0x4f'),_0x18edab[_0x6dce('0x27')],util[_0x6dce('0x63')](_0x6dce('0x64'),_0x38ace4[_0x6dce('0x27')],_0x38ace4[_0x6dce('0x65')]));fs['symlinkSync'](_0x2cefbb,_0x56af6a);return _0x38ace4;}})[_0x6dce('0x43')](function(_0x180c94){throw new db[(_0x6dce('0x5c'))][(_0x6dce('0x5d'))](_0x180c94[_0x6dce('0x5e')]);});})[_0x6dce('0x23')](handleEntityNotFound(_0x1904db,null))['then'](respondWithResult(_0x1904db,0xc9))['catch'](handleError(_0x1904db,null));};exports['removeSound']=function(_0x811114,_0x5354f6,_0x3790ba){return db[_0x6dce('0x49')][_0x6dce('0x4a')](function(_0x206fc4){var _0x9a0cf6;return db[_0x6dce('0x3e')][_0x6dce('0x66')]({'where':{'id':_0x811114[_0x6dce('0x56')]['id']}})[_0x6dce('0x23')](handleEntityNotFound(_0x5354f6,null))['then'](function(_0x42a659){if(_0x42a659){_0x9a0cf6=_0x42a659;return _0x42a659[_0x6dce('0x67')](_0x811114[_0x6dce('0x56')][_0x6dce('0x68')]);}})[_0x6dce('0x23')](function(_0x42036c){if(_0x42036c){return db[_0x6dce('0x60')][_0x6dce('0x66')]({'where':{'id':_0x811114[_0x6dce('0x56')][_0x6dce('0x68')]},'attributes':['id',_0x6dce('0x27'),_0x6dce('0x61'),_0x6dce('0x65'),_0x6dce('0x62')],'raw':!![]});}})['then'](function(_0x525ea9){if(_0x525ea9){fs[_0x6dce('0x59')](path[_0x6dce('0x5a')](_0x9a0cf6['directory'],util[_0x6dce('0x63')](_0x6dce('0x64'),_0x525ea9[_0x6dce('0x27')],_0x525ea9[_0x6dce('0x65')])));return _0x525ea9;}})[_0x6dce('0x43')](function(_0x4f66ad){throw new db['Sequelize'][(_0x6dce('0x5d'))](_0x4f66ad[_0x6dce('0x5e')]);});})['then'](handleEntityNotFound(_0x5354f6,null))[_0x6dce('0x23')](respondWithStatusCode(_0x5354f6,0xcc))[_0x6dce('0x43')](handleError(_0x5354f6,null));};exports[_0x6dce('0x69')]=function(_0x3d7788,_0x1c4ea3,_0x525198){var _0x45032c={};var _0x26852e={};var _0x16de8f;var _0x50a3e9;return db[_0x6dce('0x3e')][_0x6dce('0x66')]({'where':{'id':_0x3d7788[_0x6dce('0x56')]['id']}})[_0x6dce('0x23')](handleEntityNotFound(_0x1c4ea3,null))[_0x6dce('0x23')](function(_0x5a77ad){if(_0x5a77ad){_0x16de8f=_0x5a77ad;_0x26852e[_0x6dce('0x33')]=_[_0x6dce('0x30')](db[_0x6dce('0x60')]['rawAttributes']);_0x26852e[_0x6dce('0x2f')]=_[_0x6dce('0x30')](_0x3d7788['query']);_0x26852e[_0x6dce('0x31')]=_[_0x6dce('0x32')](_0x26852e[_0x6dce('0x33')],_0x26852e[_0x6dce('0x2f')]);_0x45032c[_0x6dce('0x34')]=_[_0x6dce('0x32')](_0x26852e[_0x6dce('0x33')],qs[_0x6dce('0x44')](_0x3d7788[_0x6dce('0x2f')][_0x6dce('0x44')]));_0x45032c[_0x6dce('0x34')]=_0x45032c['attributes'][_0x6dce('0x45')]?_0x45032c['attributes']:_0x26852e[_0x6dce('0x33')];_0x45032c[_0x6dce('0x37')]=qs[_0x6dce('0x38')](_0x3d7788[_0x6dce('0x2f')][_0x6dce('0x38')]);_0x45032c[_0x6dce('0x3a')]=qs[_0x6dce('0x31')](_['pick'](_0x3d7788[_0x6dce('0x2f')],_0x26852e['filters']));if(_0x3d7788[_0x6dce('0x2f')][_0x6dce('0x3c')]){_0x45032c[_0x6dce('0x3a')]=_['merge'](_0x45032c[_0x6dce('0x3a')],{'$or':_[_0x6dce('0x2e')](_0x45032c['attributes'],function(_0x29d737){var _0x4e549c={};_0x4e549c[_0x29d737]={'$like':'%'+_0x3d7788[_0x6dce('0x2f')][_0x6dce('0x3c')]+'%'};return _0x4e549c;})});}_0x45032c=_[_0x6dce('0x3b')]({},_0x45032c,_0x3d7788[_0x6dce('0x3d')]);return _0x16de8f['getSounds'](_0x45032c);}})[_0x6dce('0x23')](function(_0xb994f6){if(_0xb994f6){_0x50a3e9=_0xb994f6[_0x6dce('0x45')];if(!_0x3d7788[_0x6dce('0x2f')]['hasOwnProperty'](_0x6dce('0x36'))){_0x45032c[_0x6dce('0x1d')]=qs[_0x6dce('0x1d')](_0x3d7788['query'][_0x6dce('0x1d')]);_0x45032c[_0x6dce('0x1b')]=qs[_0x6dce('0x1b')](_0x3d7788[_0x6dce('0x2f')]['offset']);}return _0x16de8f[_0x6dce('0x69')](_0x45032c);}})[_0x6dce('0x23')](function(_0x1761bb){if(_0x1761bb){return _0x1761bb?{'count':_0x50a3e9,'rows':_0x1761bb}:null;}})[_0x6dce('0x23')](respondWithResult(_0x1c4ea3,null))[_0x6dce('0x43')](handleError(_0x1c4ea3,null));}; \ No newline at end of file +var _0xa984=['send','VoiceMusicOnHold','fieldName','type','key','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','keys','rawAttributes','includeAll','find','body','create','sequelize','mode','files','directory','root','mkdirSync','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','transaction','forEach','unlinkSync','rmdirSync','Sequelize','ValidationError','addSound','Sound','findOne','save_name','converted_format','createdAt','join','server/files/sounds/converted','format','%s.%s','basename','extname','server/files/moh','symlinkSync','message','removeSound','id2','getSounds','order','nolimit','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','MusicOnHolds','UserProfileResource','sendStatus','error','stack','name'];(function(_0x2c5cee,_0x958114){var _0x5938dc=function(_0x235aa1){while(--_0x235aa1){_0x2c5cee['push'](_0x2c5cee['shift']());}};_0x5938dc(++_0x958114);}(_0xa984,0x134));var _0x4a98=function(_0x403db1,_0x59018e){_0x403db1=_0x403db1-0x0;var _0x47c48f=_0xa984[_0x403db1];return _0x47c48f;};'use strict';var emlformat=require(_0x4a98('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4a98('0x1'));var jsonpatch=require(_0x4a98('0x2'));var rp=require(_0x4a98('0x3'));var moment=require(_0x4a98('0x4'));var BPromise=require(_0x4a98('0x5'));var Mustache=require(_0x4a98('0x6'));var util=require(_0x4a98('0x7'));var path=require(_0x4a98('0x8'));var sox=require(_0x4a98('0x9'));var csv=require(_0x4a98('0xa'));var ejs=require(_0x4a98('0xb'));var fs=require('fs');var fs_extra=require(_0x4a98('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x4a98('0xd'));var jsforce=require(_0x4a98('0xe'));var deskjs=require(_0x4a98('0xf'));var toCsv=require(_0x4a98('0xa'));var querystring=require(_0x4a98('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4a98('0x11'));var qs=require(_0x4a98('0x12'));var as=require(_0x4a98('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x4a98('0x14'));var config=require(_0x4a98('0x15'));var licenseUtil=require(_0x4a98('0x16'));var db=require(_0x4a98('0x17'))['db'];function respondWithStatusCode(_0x341f77,_0xd4401c){_0xd4401c=_0xd4401c||0xcc;return function(_0x59fd7b){if(_0x59fd7b){return _0x341f77['sendStatus'](_0xd4401c);}return _0x341f77[_0x4a98('0x18')](_0xd4401c)[_0x4a98('0x19')]();};}function respondWithResult(_0x57c9ee,_0x47e685){_0x47e685=_0x47e685||0xc8;return function(_0x314d6b){if(_0x314d6b){return _0x57c9ee[_0x4a98('0x18')](_0x47e685)[_0x4a98('0x1a')](_0x314d6b);}};}function respondWithFilteredResult(_0x33ac32,_0x526f01){return function(_0x471eb6){if(_0x471eb6){var _0x9ba482=typeof _0x526f01[_0x4a98('0x1b')]==='undefined'&&typeof _0x526f01[_0x4a98('0x1c')]===_0x4a98('0x1d');var _0x4a48e4=_0x471eb6['count'];var _0x183425=_0x9ba482?0x0:_0x526f01['offset'];var _0x41a129=_0x9ba482?_0x471eb6[_0x4a98('0x1e')]:_0x526f01[_0x4a98('0x1b')]+_0x526f01['limit'];var _0x4ad5d8;if(_0x41a129>=_0x4a48e4){_0x41a129=_0x4a48e4;_0x4ad5d8=0xc8;}else{_0x4ad5d8=0xce;}_0x33ac32[_0x4a98('0x18')](_0x4ad5d8);return _0x33ac32[_0x4a98('0x1f')](_0x4a98('0x20'),_0x183425+'-'+_0x41a129+'/'+_0x4a48e4)[_0x4a98('0x1a')](_0x471eb6);}return null;};}function patchUpdates(_0x5af49a){return function(_0x1b610e){try{jsonpatch[_0x4a98('0x21')](_0x1b610e,_0x5af49a,!![]);}catch(_0x342faf){return BPromise[_0x4a98('0x22')](_0x342faf);}return _0x1b610e[_0x4a98('0x23')]();};}function saveUpdates(_0x5dded8,_0x57dc7d){return function(_0x3ca7da){if(_0x3ca7da){return _0x3ca7da[_0x4a98('0x24')](_0x5dded8)[_0x4a98('0x25')](function(_0x59020d){return _0x59020d;});}return null;};}function removeEntity(_0xd731ca,_0x2be6b3){return function(_0x31c97f){if(_0x31c97f){return _0x31c97f[_0x4a98('0x26')]()[_0x4a98('0x25')](function(){var _0x479c04=_0x31c97f[_0x4a98('0x27')]({'plain':!![]});var _0xa6f332=_0x4a98('0x28');return db[_0x4a98('0x29')][_0x4a98('0x26')]({'where':{'type':_0xa6f332,'resourceId':_0x479c04['id']}})[_0x4a98('0x25')](function(){return _0x31c97f;});})[_0x4a98('0x25')](function(){_0xd731ca[_0x4a98('0x18')](0xcc)[_0x4a98('0x19')]();});}};}function handleEntityNotFound(_0x37bf51,_0x481107){return function(_0x25e83f){if(!_0x25e83f){_0x37bf51[_0x4a98('0x2a')](0x194);}return _0x25e83f;};}function handleError(_0x4217b8,_0x4185ad){_0x4185ad=_0x4185ad||0x1f4;return function(_0x1008ba){logger[_0x4a98('0x2b')](_0x1008ba[_0x4a98('0x2c')]);if(_0x1008ba[_0x4a98('0x2d')]){delete _0x1008ba[_0x4a98('0x2d')];}_0x4217b8[_0x4a98('0x18')](_0x4185ad)[_0x4a98('0x2e')](_0x1008ba);};}exports['index']=function(_0x13c813,_0x142d98){var _0x3b6c92={},_0x562bf9={},_0x144eed={'count':0x0,'rows':[]};var _0x73390c=_['map'](db[_0x4a98('0x2f')]['rawAttributes'],function(_0x594b2c){return{'name':_0x594b2c[_0x4a98('0x30')],'type':_0x594b2c[_0x4a98('0x31')][_0x4a98('0x32')]};});_0x562bf9['model']=_[_0x4a98('0x33')](_0x73390c,_0x4a98('0x2d'));_0x562bf9[_0x4a98('0x34')]=_['keys'](_0x13c813[_0x4a98('0x34')]);_0x562bf9[_0x4a98('0x35')]=_[_0x4a98('0x36')](_0x562bf9[_0x4a98('0x37')],_0x562bf9[_0x4a98('0x34')]);_0x3b6c92[_0x4a98('0x38')]=_['intersection'](_0x562bf9['model'],qs['fields'](_0x13c813[_0x4a98('0x34')][_0x4a98('0x39')]));_0x3b6c92[_0x4a98('0x38')]=_0x3b6c92[_0x4a98('0x38')][_0x4a98('0x3a')]?_0x3b6c92[_0x4a98('0x38')]:_0x562bf9[_0x4a98('0x37')];if(!_0x13c813[_0x4a98('0x34')][_0x4a98('0x3b')]('nolimit')){_0x3b6c92[_0x4a98('0x1c')]=qs[_0x4a98('0x1c')](_0x13c813[_0x4a98('0x34')][_0x4a98('0x1c')]);_0x3b6c92[_0x4a98('0x1b')]=qs[_0x4a98('0x1b')](_0x13c813[_0x4a98('0x34')]['offset']);}_0x3b6c92['order']=qs[_0x4a98('0x3c')](_0x13c813[_0x4a98('0x34')][_0x4a98('0x3c')]);delete _0x13c813[_0x4a98('0x34')]['sort'];_0x3b6c92[_0x4a98('0x3d')]=qs[_0x4a98('0x35')](_[_0x4a98('0x3e')](_0x13c813[_0x4a98('0x34')],_0x562bf9[_0x4a98('0x35')]),_0x73390c);if(_0x13c813[_0x4a98('0x34')]['filter']){_0x3b6c92[_0x4a98('0x3d')]=_[_0x4a98('0x3f')](_0x3b6c92[_0x4a98('0x3d')],{'$or':_[_0x4a98('0x33')](_0x73390c,function(_0x41ca8f){if(_0x41ca8f[_0x4a98('0x31')]!==_0x4a98('0x40')){var _0x43ac44={};_0x43ac44[_0x41ca8f['name']]={'$like':'%'+_0x13c813[_0x4a98('0x34')][_0x4a98('0x41')]+'%'};return _0x43ac44;}})});}_0x3b6c92=_['merge']({},_0x3b6c92,_0x13c813[_0x4a98('0x42')]);var _0x4ad43a={'where':_0x3b6c92['where']};return db['VoiceMusicOnHold'][_0x4a98('0x1e')](_0x4ad43a)['then'](function(_0x1e38ae){_0x144eed[_0x4a98('0x1e')]=_0x1e38ae;if(_0x13c813['query']['includeAll']){_0x3b6c92[_0x4a98('0x43')]=[{'all':!![]}];}return db[_0x4a98('0x2f')][_0x4a98('0x44')](_0x3b6c92);})[_0x4a98('0x25')](function(_0x525d51){_0x144eed[_0x4a98('0x45')]=_0x525d51;return _0x144eed;})[_0x4a98('0x25')](respondWithFilteredResult(_0x142d98,_0x3b6c92))[_0x4a98('0x46')](handleError(_0x142d98,null));};exports[_0x4a98('0x47')]=function(_0x1cff31,_0xb04f40){var _0x2c8912={'raw':![],'where':{'id':_0x1cff31[_0x4a98('0x48')]['id']}},_0x5ac705={};_0x5ac705[_0x4a98('0x37')]=_[_0x4a98('0x49')](db[_0x4a98('0x2f')][_0x4a98('0x4a')]);_0x5ac705[_0x4a98('0x34')]=_[_0x4a98('0x49')](_0x1cff31[_0x4a98('0x34')]);_0x5ac705[_0x4a98('0x35')]=_[_0x4a98('0x36')](_0x5ac705['model'],_0x5ac705['query']);_0x2c8912[_0x4a98('0x38')]=_['intersection'](_0x5ac705['model'],qs[_0x4a98('0x39')](_0x1cff31[_0x4a98('0x34')]['fields']));_0x2c8912['attributes']=_0x2c8912[_0x4a98('0x38')]['length']?_0x2c8912[_0x4a98('0x38')]:_0x5ac705[_0x4a98('0x37')];if(_0x1cff31[_0x4a98('0x34')][_0x4a98('0x4b')]){_0x2c8912[_0x4a98('0x43')]=[{'all':!![]}];}_0x2c8912=_['merge']({},_0x2c8912,_0x1cff31[_0x4a98('0x42')]);return db['VoiceMusicOnHold'][_0x4a98('0x4c')](_0x2c8912)[_0x4a98('0x25')](handleEntityNotFound(_0xb04f40,null))['then'](respondWithResult(_0xb04f40,null))['catch'](handleError(_0xb04f40,null));};exports[_0x4a98('0x24')]=function(_0x154dd8,_0x2d5735){if(_0x154dd8['body']['id']){delete _0x154dd8[_0x4a98('0x4d')]['id'];}return db[_0x4a98('0x2f')][_0x4a98('0x4c')]({'where':{'id':_0x154dd8[_0x4a98('0x48')]['id']}})['then'](handleEntityNotFound(_0x2d5735,null))[_0x4a98('0x25')](saveUpdates(_0x154dd8['body'],null))['then'](respondWithResult(_0x2d5735,null))[_0x4a98('0x46')](handleError(_0x2d5735,null));};exports[_0x4a98('0x4e')]=function(_0x4f61e5,_0x3ae661,_0x4c28c8){return db[_0x4a98('0x4f')]['transaction'](function(_0x1a443d){if(_0x4f61e5['body'][_0x4a98('0x50')]===_0x4a98('0x51')){_0x4f61e5[_0x4a98('0x4d')][_0x4a98('0x52')]=path['join'](config[_0x4a98('0x53')],'server/files/moh',_0x4f61e5[_0x4a98('0x4d')]['name']);}return db[_0x4a98('0x2f')][_0x4a98('0x4e')](_0x4f61e5['body'],{'transaction':_0x1a443d})[_0x4a98('0x25')](function(_0x523122){if(_0x4f61e5['body']['mode']===_0x4a98('0x51')){fs[_0x4a98('0x54')](_0x523122[_0x4a98('0x52')],parseInt(_0x4a98('0x55'),0x8));}var _0x5263cc=_0x4f61e5[_0x4a98('0x56')][_0x4a98('0x27')]({'plain':!![]});if(!_0x5263cc)throw new Error(_0x4a98('0x57'));if(_0x5263cc['role']===_0x4a98('0x56')){var _0x51b776=_0x523122[_0x4a98('0x27')]({'plain':!![]});return db[_0x4a98('0x58')][_0x4a98('0x4c')]({'where':{'name':_0x4a98('0x28'),'userProfileId':_0x5263cc[_0x4a98('0x59')]},'raw':!![]})[_0x4a98('0x25')](function(_0x2c681c){if(_0x2c681c&&_0x2c681c[_0x4a98('0x5a')]===0x0){return db[_0x4a98('0x29')]['create']({'name':_0x51b776['name'],'resourceId':_0x51b776['id'],'type':_0x2c681c[_0x4a98('0x2d')],'sectionId':_0x2c681c['id']},{})['then'](function(){return _0x523122;});}else{return _0x523122;}})[_0x4a98('0x46')](function(_0x208b3f){logger[_0x4a98('0x2b')](_0x4a98('0x5b'),_0x208b3f);});}return _0x523122;});})[_0x4a98('0x25')](respondWithResult(_0x3ae661,0xc9))['catch'](handleError(_0x3ae661,null));};exports['destroy']=function(_0x5688ef,_0x5e3a25,_0x5a992b){var _0x1c6d04;return db[_0x4a98('0x2f')][_0x4a98('0x4c')]({'where':{'id':_0x5688ef['params']['id']}})[_0x4a98('0x25')](function(_0x49915a){if(_0x49915a){return db[_0x4a98('0x4f')][_0x4a98('0x5c')](function(_0x3fc60d){return _0x49915a['destroy']({'transaction':_0x3fc60d,'raw':!![]})[_0x4a98('0x25')](function(_0x22b6b1){if(_0x22b6b1[_0x4a98('0x52')]){fs['readdirSync'](_0x22b6b1['directory'])[_0x4a98('0x5d')](function(_0x23f8ce){fs[_0x4a98('0x5e')](path['join'](_0x22b6b1[_0x4a98('0x52')],_0x23f8ce));});fs[_0x4a98('0x5f')](_0x22b6b1[_0x4a98('0x52')]);}return _0x22b6b1;});})[_0x4a98('0x46')](function(_0x38731e){throw new db[(_0x4a98('0x60'))][(_0x4a98('0x61'))](_0x38731e['message']);});}})[_0x4a98('0x25')](handleEntityNotFound(_0x5e3a25,null))[_0x4a98('0x25')](removeEntity(_0x5e3a25,null))[_0x4a98('0x46')](handleError(_0x5e3a25,null));};exports[_0x4a98('0x62')]=function(_0x39233e,_0x3a888c,_0x161b9c){return db['sequelize'][_0x4a98('0x5c')](function(_0x542b04){var _0x5d04ee;return db[_0x4a98('0x2f')][_0x4a98('0x4c')]({'where':{'id':_0x39233e[_0x4a98('0x48')]['id']}})[_0x4a98('0x25')](function(_0x1c2256){if(_0x1c2256){_0x5d04ee=_0x1c2256;return _0x1c2256['addSound'](_0x39233e[_0x4a98('0x4d')]['id'],{'transaction':_0x542b04});}})['then'](function(_0x35c1ca){if(_0x35c1ca){return db[_0x4a98('0x63')][_0x4a98('0x64')]({'where':{'id':_0x39233e[_0x4a98('0x4d')]['id']},'attributes':['id',_0x4a98('0x2d'),_0x4a98('0x65'),_0x4a98('0x66'),_0x4a98('0x67')],'raw':!![]});}})['then'](function(_0xc20f9c){if(_0xc20f9c){var _0x201127=path[_0x4a98('0x68')](config[_0x4a98('0x53')],_0x4a98('0x69'),util[_0x4a98('0x6a')](_0x4a98('0x6b'),path[_0x4a98('0x6c')](_0xc20f9c[_0x4a98('0x65')],path[_0x4a98('0x6d')](_0xc20f9c['save_name'])),_0xc20f9c[_0x4a98('0x66')]));var _0x4110d0=path[_0x4a98('0x68')](config[_0x4a98('0x53')],_0x4a98('0x6e'),_0x5d04ee[_0x4a98('0x2d')],util['format'](_0x4a98('0x6b'),_0xc20f9c['name'],_0xc20f9c[_0x4a98('0x66')]));fs[_0x4a98('0x6f')](_0x201127,_0x4110d0);return _0xc20f9c;}})[_0x4a98('0x46')](function(_0x5a7dc5){throw new db[(_0x4a98('0x60'))][(_0x4a98('0x61'))](_0x5a7dc5[_0x4a98('0x70')]);});})[_0x4a98('0x25')](handleEntityNotFound(_0x3a888c,null))[_0x4a98('0x25')](respondWithResult(_0x3a888c,0xc9))[_0x4a98('0x46')](handleError(_0x3a888c,null));};exports[_0x4a98('0x71')]=function(_0x1f1487,_0x21d6fa,_0x5756fc){return db[_0x4a98('0x4f')][_0x4a98('0x5c')](function(_0x27c440){var _0xfb4905;return db[_0x4a98('0x2f')]['findOne']({'where':{'id':_0x1f1487[_0x4a98('0x48')]['id']}})[_0x4a98('0x25')](handleEntityNotFound(_0x21d6fa,null))[_0x4a98('0x25')](function(_0x246075){if(_0x246075){_0xfb4905=_0x246075;return _0x246075[_0x4a98('0x71')](_0x1f1487[_0x4a98('0x48')][_0x4a98('0x72')]);}})[_0x4a98('0x25')](function(_0x1d1e4d){if(_0x1d1e4d){return db[_0x4a98('0x63')][_0x4a98('0x64')]({'where':{'id':_0x1f1487[_0x4a98('0x48')][_0x4a98('0x72')]},'attributes':['id',_0x4a98('0x2d'),'save_name',_0x4a98('0x66'),'createdAt'],'raw':!![]});}})[_0x4a98('0x25')](function(_0x8e2bc6){if(_0x8e2bc6){fs[_0x4a98('0x5e')](path[_0x4a98('0x68')](_0xfb4905[_0x4a98('0x52')],util[_0x4a98('0x6a')](_0x4a98('0x6b'),_0x8e2bc6[_0x4a98('0x2d')],_0x8e2bc6[_0x4a98('0x66')])));return _0x8e2bc6;}})[_0x4a98('0x46')](function(_0x2ea603){throw new db[(_0x4a98('0x60'))][(_0x4a98('0x61'))](_0x2ea603['message']);});})[_0x4a98('0x25')](handleEntityNotFound(_0x21d6fa,null))['then'](respondWithStatusCode(_0x21d6fa,0xcc))['catch'](handleError(_0x21d6fa,null));};exports[_0x4a98('0x73')]=function(_0x1b388f,_0x557983,_0x52694f){var _0x337a6f={};var _0x3c10a2={};var _0x1bf243;var _0x596b09;return db[_0x4a98('0x2f')][_0x4a98('0x64')]({'where':{'id':_0x1b388f[_0x4a98('0x48')]['id']}})[_0x4a98('0x25')](handleEntityNotFound(_0x557983,null))['then'](function(_0x593b2d){if(_0x593b2d){_0x1bf243=_0x593b2d;_0x3c10a2[_0x4a98('0x37')]=_['keys'](db[_0x4a98('0x63')][_0x4a98('0x4a')]);_0x3c10a2[_0x4a98('0x34')]=_[_0x4a98('0x49')](_0x1b388f[_0x4a98('0x34')]);_0x3c10a2['filters']=_[_0x4a98('0x36')](_0x3c10a2['model'],_0x3c10a2[_0x4a98('0x34')]);_0x337a6f[_0x4a98('0x38')]=_[_0x4a98('0x36')](_0x3c10a2[_0x4a98('0x37')],qs[_0x4a98('0x39')](_0x1b388f['query'][_0x4a98('0x39')]));_0x337a6f[_0x4a98('0x38')]=_0x337a6f[_0x4a98('0x38')][_0x4a98('0x3a')]?_0x337a6f['attributes']:_0x3c10a2[_0x4a98('0x37')];_0x337a6f[_0x4a98('0x74')]=qs[_0x4a98('0x3c')](_0x1b388f['query']['sort']);_0x337a6f[_0x4a98('0x3d')]=qs[_0x4a98('0x35')](_['pick'](_0x1b388f[_0x4a98('0x34')],_0x3c10a2[_0x4a98('0x35')]));if(_0x1b388f[_0x4a98('0x34')][_0x4a98('0x41')]){_0x337a6f[_0x4a98('0x3d')]=_[_0x4a98('0x3f')](_0x337a6f[_0x4a98('0x3d')],{'$or':_[_0x4a98('0x33')](_0x337a6f['attributes'],function(_0x6b8b7f){var _0x2b6800={};_0x2b6800[_0x6b8b7f]={'$like':'%'+_0x1b388f['query'][_0x4a98('0x41')]+'%'};return _0x2b6800;})});}_0x337a6f=_[_0x4a98('0x3f')]({},_0x337a6f,_0x1b388f[_0x4a98('0x42')]);return _0x1bf243[_0x4a98('0x73')](_0x337a6f);}})['then'](function(_0x2f777a){if(_0x2f777a){_0x596b09=_0x2f777a[_0x4a98('0x3a')];if(!_0x1b388f[_0x4a98('0x34')][_0x4a98('0x3b')](_0x4a98('0x75'))){_0x337a6f[_0x4a98('0x1c')]=qs[_0x4a98('0x1c')](_0x1b388f[_0x4a98('0x34')][_0x4a98('0x1c')]);_0x337a6f[_0x4a98('0x1b')]=qs[_0x4a98('0x1b')](_0x1b388f[_0x4a98('0x34')][_0x4a98('0x1b')]);}return _0x1bf243[_0x4a98('0x73')](_0x337a6f);}})['then'](function(_0x57ac23){if(_0x57ac23){return _0x57ac23?{'count':_0x596b09,'rows':_0x57ac23}:null;}})[_0x4a98('0x25')](respondWithResult(_0x557983,null))[_0x4a98('0x46')](handleError(_0x557983,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 4aabec1..74975ff 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 _0x4bc6=['util','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','voice_musiconhold','lodash'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0x4bc6,0x6b));var _0x64bc=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0x4bc6[_0x1deb03];return _0x189fe7;};'use strict';var _=require(_0x64bc('0x0'));var util=require(_0x64bc('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x64bc('0x2'));var rp=require(_0x64bc('0x3'));var fs=require('fs');var path=require(_0x64bc('0x4'));var rimraf=require(_0x64bc('0x5'));var config=require(_0x64bc('0x6'));var attributes=require(_0x64bc('0x7'));module[_0x64bc('0x8')]=function(_0x470756,_0x18a92d){return _0x470756[_0x64bc('0x9')](_0x64bc('0xa'),attributes,{'tableName':_0x64bc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x151e=['exports','define','VoiceMusicOnHold','voice_musiconhold','util','../../config/logger','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes'];(function(_0x1e1cee,_0x3aee55){var _0x42798a=function(_0x10f921){while(--_0x10f921){_0x1e1cee['push'](_0x1e1cee['shift']());}};_0x42798a(++_0x3aee55);}(_0x151e,0x13a));var _0xe151=function(_0x2abc3d,_0x48edca){_0x2abc3d=_0x2abc3d-0x0;var _0x252745=_0x151e[_0x2abc3d];return _0x252745;};'use strict';var _=require('lodash');var util=require(_0xe151('0x0'));var logger=require(_0xe151('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe151('0x2'));var rimraf=require(_0xe151('0x3'));var config=require(_0xe151('0x4'));var attributes=require(_0xe151('0x5'));module[_0xe151('0x6')]=function(_0x48c109,_0x198f22){return _0x48c109[_0xe151('0x7')](_0xe151('0x8'),attributes,{'tableName':_0xe151('0x9'),'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 41249d0..9d03132 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','VoiceMusicOnHold,\x20%s,\x20%s','message','catch','util'];(function(_0x5cf19b,_0x4303b5){var _0x49ab19=function(_0x5013a0){while(--_0x5013a0){_0x5cf19b['push'](_0x5cf19b['shift']());}};_0x49ab19(++_0x4303b5);}(_0xedd9,0xfc));var _0x9edd=function(_0xe69b8a,_0x1a2ae0){_0xe69b8a=_0xe69b8a-0x0;var _0x3b93ed=_0xedd9[_0xe69b8a];return _0x3b93ed;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var moment=require(_0x9edd('0x1'));var BPromise=require(_0x9edd('0x2'));var rs=require(_0x9edd('0x3'));var fs=require('fs');var Redis=require(_0x9edd('0x4'));var db=require(_0x9edd('0x5'))['db'];var utils=require(_0x9edd('0x6'));var logger=require(_0x9edd('0x7'))('rpc');var config=require(_0x9edd('0x8'));var jayson=require(_0x9edd('0x9'));var client=jayson[_0x9edd('0xa')][_0x9edd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5319f7,_0xf0b2d8,_0x571af9){return new BPromise(function(_0x172522,_0x190185){return client[_0x9edd('0xc')](_0x5319f7,_0x571af9)[_0x9edd('0xd')](function(_0x49d5e3){logger[_0x9edd('0xe')]('VoiceMusicOnHold,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'));logger[_0x9edd('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'),JSON[_0x9edd('0x11')](_0x49d5e3));if(_0x49d5e3['error']){if(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x13')]===0x1f4){logger[_0x9edd('0x12')](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x190185(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x172522(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}else{logger[_0x9edd('0xe')](_0x9edd('0x14'),_0xf0b2d8,_0x9edd('0xf'));_0x172522(_0x49d5e3['result'][_0x9edd('0x15')]);}})[_0x9edd('0x16')](function(_0x449cee){logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x449cee);_0x190185(_0x449cee);});});} \ No newline at end of file +var _0xa9e0=['http','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x5852ed,_0xeef619){var _0xe61aa2=function(_0x4378b2){while(--_0x4378b2){_0x5852ed['push'](_0x5852ed['shift']());}};_0xe61aa2(++_0xeef619);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 5ea9b29..2ea5dbf 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 _0x847f=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/describe','describe','show','/:id/teams','post','create','/:id/users','addAgents','addTeams','put','/:id','update','destroy','removeAgents','removeTeams','exports','multer','util','path','express'];(function(_0x4cf86e,_0x2856df){var _0x31bfe0=function(_0x5e1648){while(--_0x5e1648){_0x4cf86e['push'](_0x4cf86e['shift']());}};_0x31bfe0(++_0x2856df);}(_0x847f,0x182));var _0xf847=function(_0x1c2051,_0x4cb6b9){_0x1c2051=_0x1c2051-0x0;var _0x2b58a0=_0x847f[_0x1c2051];return _0x2b58a0;};'use strict';var multer=require(_0xf847('0x0'));var util=require(_0xf847('0x1'));var path=require(_0xf847('0x2'));var timeout=require('connect-timeout');var express=require(_0xf847('0x3'));var router=express[_0xf847('0x4')]();var fs_extra=require(_0xf847('0x5'));var auth=require(_0xf847('0x6'));var interaction=require(_0xf847('0x7'));var config=require('../../config/environment');var controller=require('./voicePrefix.controller');router[_0xf847('0x8')]('/',auth[_0xf847('0x9')](),controller['index']);router['get'](_0xf847('0xa'),auth[_0xf847('0x9')](),controller[_0xf847('0xb')]);router[_0xf847('0x8')]('/:id',auth[_0xf847('0x9')](),controller[_0xf847('0xc')]);router[_0xf847('0x8')]('/:id/users',auth[_0xf847('0x9')](),controller['getAgents']);router[_0xf847('0x8')](_0xf847('0xd'),auth[_0xf847('0x9')](),controller['getTeams']);router[_0xf847('0xe')]('/',auth['isAuthenticated'](),controller[_0xf847('0xf')]);router[_0xf847('0xe')](_0xf847('0x10'),auth[_0xf847('0x9')](),controller[_0xf847('0x11')]);router[_0xf847('0xe')](_0xf847('0xd'),auth[_0xf847('0x9')](),controller[_0xf847('0x12')]);router[_0xf847('0x13')](_0xf847('0x14'),auth[_0xf847('0x9')](),controller[_0xf847('0x15')]);router['delete'](_0xf847('0x14'),auth[_0xf847('0x9')](),controller[_0xf847('0x16')]);router['delete']('/:id/users',auth[_0xf847('0x9')](),controller[_0xf847('0x17')]);router['delete'](_0xf847('0xd'),auth[_0xf847('0x9')](),controller[_0xf847('0x18')]);module[_0xf847('0x19')]=router; \ No newline at end of file +var _0x8524=['destroy','removeAgents','removeTeams','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/users','getAgents','/:id/teams','post','create','addAgents','addTeams','put','update','delete'];(function(_0x100e9a,_0x2e257e){var _0x31571e=function(_0x420046){while(--_0x420046){_0x100e9a['push'](_0x100e9a['shift']());}};_0x31571e(++_0x2e257e);}(_0x8524,0x1d4));var _0x4852=function(_0xb172c3,_0x4b3756){_0xb172c3=_0xb172c3-0x0;var _0x16d5c9=_0x8524[_0xb172c3];return _0x16d5c9;};'use strict';var multer=require(_0x4852('0x0'));var util=require(_0x4852('0x1'));var path=require(_0x4852('0x2'));var timeout=require(_0x4852('0x3'));var express=require(_0x4852('0x4'));var router=express[_0x4852('0x5')]();var fs_extra=require(_0x4852('0x6'));var auth=require(_0x4852('0x7'));var interaction=require(_0x4852('0x8'));var config=require(_0x4852('0x9'));var controller=require(_0x4852('0xa'));router['get']('/',auth[_0x4852('0xb')](),controller[_0x4852('0xc')]);router[_0x4852('0xd')](_0x4852('0xe'),auth[_0x4852('0xb')](),controller[_0x4852('0xf')]);router['get'](_0x4852('0x10'),auth[_0x4852('0xb')](),controller[_0x4852('0x11')]);router[_0x4852('0xd')](_0x4852('0x12'),auth[_0x4852('0xb')](),controller[_0x4852('0x13')]);router[_0x4852('0xd')](_0x4852('0x14'),auth['isAuthenticated'](),controller['getTeams']);router[_0x4852('0x15')]('/',auth[_0x4852('0xb')](),controller[_0x4852('0x16')]);router[_0x4852('0x15')](_0x4852('0x12'),auth['isAuthenticated'](),controller[_0x4852('0x17')]);router['post'](_0x4852('0x14'),auth['isAuthenticated'](),controller[_0x4852('0x18')]);router[_0x4852('0x19')](_0x4852('0x10'),auth[_0x4852('0xb')](),controller[_0x4852('0x1a')]);router[_0x4852('0x1b')](_0x4852('0x10'),auth[_0x4852('0xb')](),controller[_0x4852('0x1c')]);router[_0x4852('0x1b')](_0x4852('0x12'),auth[_0x4852('0xb')](),controller[_0x4852('0x1d')]);router[_0x4852('0x1b')](_0x4852('0x14'),auth[_0x4852('0xb')](),controller[_0x4852('0x1e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index ed8bc20..95e7bfd 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 _0xb8dd=['STRING','name','VIRTUAL','system-','INTEGER','sequelize','exports'];(function(_0x253027,_0x4e0910){var _0x1b09a7=function(_0x48cdf7){while(--_0x48cdf7){_0x253027['push'](_0x253027['shift']());}};_0x1b09a7(++_0x4e0910);}(_0xb8dd,0x16a));var _0xdb8d=function(_0x475575,_0x30d540){_0x475575=_0x475575-0x0;var _0x53e8d8=_0xb8dd[_0x475575];return _0x53e8d8;};'use strict';var Sequelize=require(_0xdb8d('0x0'));module[_0xdb8d('0x1')]={'name':{'type':Sequelize[_0xdb8d('0x2')],'allowNull':![],'unique':_0xdb8d('0x3')},'prefix':{'type':Sequelize[_0xdb8d('0x4')],'get':function(_0x2a3a60){return _0xdb8d('0x5')+this['getDataValue']('name')+'-';}},'description':{'type':Sequelize[_0xdb8d('0x2')]},'callerIdAll':{'type':Sequelize[_0xdb8d('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0xdb8d('0x6')]}}; \ No newline at end of file +var _0xe9de=['STRING','INTEGER','exports','name','VIRTUAL','system-'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe9de,0x14c));var _0xee9d=function(_0x1f803d,_0x1c966e){_0x1f803d=_0x1f803d-0x0;var _0x549186=_0xe9de[_0x1f803d];return _0x549186;};'use strict';var Sequelize=require('sequelize');module[_0xee9d('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xee9d('0x1')},'prefix':{'type':Sequelize[_0xee9d('0x2')],'get':function(_0xf1b045){return _0xee9d('0x3')+this['getDataValue'](_0xee9d('0x1'))+'-';}},'description':{'type':Sequelize[_0xee9d('0x4')]},'callerIdAll':{'type':Sequelize[_0xee9d('0x4')]},'VoiceExtensionId':{'type':Sequelize[_0xee9d('0x5')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 1ef4067..056b4aa 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 _0x4213=['limit','count','set','Content-Range','json','apply','reject','update','then','destroy','get','VoicePrefixes','UserProfileResource','end','error','name','index','map','VoicePrefix','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','sort','where','pick','filter','merge','options','includeAll','findAll','show','params','find','catch','describe','create','sequelize','transaction','body','VoiceExtensionId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','app','type','description','Voice\x20Prefix\x20Extension','priority','appdata','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtension','bulkCreate','Extensions\x20creation\x20failed','prefix','CDR(prefix)=','callerIdAll','Set','${EXTEN:','charAt','system-','addAgents','ids','spread','emit','userVoicePrefix:save','removeAgents','userVoicePrefix:remove','getAgents','User','nolimit','Team','order','getTeams','addTeams','Agents','online','voicePause','interface','flatMap','each','TeamVoicePrefix','UserVoicePrefix','findOrCreate','forEach','removeTeams','tq.TeamId','from','team_has_voice_prefixes','join','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','includes','all','union','compact','value','isEmpty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','offset','undefined'];(function(_0x4bccbd,_0xff20ea){var _0x3ba099=function(_0x19f262){while(--_0x19f262){_0x4bccbd['push'](_0x4bccbd['shift']());}};_0x3ba099(++_0xff20ea);}(_0x4213,0x77));var _0x3421=function(_0x1fa9ac,_0xda5bb9){_0x1fa9ac=_0x1fa9ac-0x0;var _0x4f06ad=_0x4213[_0x1fa9ac];return _0x4f06ad;};'use strict';var emlformat=require(_0x3421('0x0'));var rimraf=require(_0x3421('0x1'));var zipdir=require(_0x3421('0x2'));var jsonpatch=require(_0x3421('0x3'));var rp=require(_0x3421('0x4'));var moment=require(_0x3421('0x5'));var BPromise=require(_0x3421('0x6'));var Mustache=require('mustache');var util=require(_0x3421('0x7'));var path=require('path');var sox=require(_0x3421('0x8'));var csv=require(_0x3421('0x9'));var ejs=require(_0x3421('0xa'));var fs=require('fs');var fs_extra=require(_0x3421('0xb'));var _=require('lodash');var squel=require(_0x3421('0xc'));var crypto=require(_0x3421('0xd'));var jsforce=require(_0x3421('0xe'));var deskjs=require(_0x3421('0xf'));var toCsv=require(_0x3421('0x9'));var querystring=require('querystring');var Papa=require(_0x3421('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3421('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3421('0x12'));var logger=require(_0x3421('0x13'))(_0x3421('0x14'));var utils=require(_0x3421('0x15'));var config=require(_0x3421('0x16'));var licenseUtil=require(_0x3421('0x17'));var db=require(_0x3421('0x18'))['db'];config['redis']=_[_0x3421('0x19')](config[_0x3421('0x1a')],{'host':_0x3421('0x1b'),'port':0x18eb});var socket=require(_0x3421('0x1c'))(new Redis(config[_0x3421('0x1a')]));require(_0x3421('0x1d'))[_0x3421('0x1e')](socket);function respondWithStatusCode(_0x59ea4a,_0xafd9e0){_0xafd9e0=_0xafd9e0||0xcc;return function(_0x4b5f43){if(_0x4b5f43){return _0x59ea4a[_0x3421('0x1f')](_0xafd9e0);}return _0x59ea4a[_0x3421('0x20')](_0xafd9e0)['end']();};}function respondWithResult(_0x1e33ab,_0x4c6f7b){_0x4c6f7b=_0x4c6f7b||0xc8;return function(_0x16bc8f){if(_0x16bc8f){return _0x1e33ab[_0x3421('0x20')](_0x4c6f7b)['json'](_0x16bc8f);}};}function respondWithFilteredResult(_0x3584d6,_0x3dec08){return function(_0x130d3c){if(_0x130d3c){var _0x104cc5=typeof _0x3dec08[_0x3421('0x21')]===_0x3421('0x22')&&typeof _0x3dec08[_0x3421('0x23')]===_0x3421('0x22');var _0x197b83=_0x130d3c[_0x3421('0x24')];var _0x538a8b=_0x104cc5?0x0:_0x3dec08['offset'];var _0x420114=_0x104cc5?_0x130d3c['count']:_0x3dec08['offset']+_0x3dec08['limit'];var _0x33155b;if(_0x420114>=_0x197b83){_0x420114=_0x197b83;_0x33155b=0xc8;}else{_0x33155b=0xce;}_0x3584d6[_0x3421('0x20')](_0x33155b);return _0x3584d6[_0x3421('0x25')](_0x3421('0x26'),_0x538a8b+'-'+_0x420114+'/'+_0x197b83)[_0x3421('0x27')](_0x130d3c);}return null;};}function patchUpdates(_0x39bed4){return function(_0x3df305){try{jsonpatch[_0x3421('0x28')](_0x3df305,_0x39bed4,!![]);}catch(_0xb9af5f){return BPromise[_0x3421('0x29')](_0xb9af5f);}return _0x3df305['save']();};}function saveUpdates(_0x57a4af,_0x494423){return function(_0x3fef90){if(_0x3fef90){return _0x3fef90[_0x3421('0x2a')](_0x57a4af)[_0x3421('0x2b')](function(_0x5bc28a){return _0x5bc28a;});}return null;};}function removeEntity(_0x506af4,_0x1b65d0){return function(_0x5b53b6){if(_0x5b53b6){return _0x5b53b6[_0x3421('0x2c')]()['then'](function(){var _0x15e73c=_0x5b53b6[_0x3421('0x2d')]({'plain':!![]});var _0x36d75f=_0x3421('0x2e');return db[_0x3421('0x2f')]['destroy']({'where':{'type':_0x36d75f,'resourceId':_0x15e73c['id']}})[_0x3421('0x2b')](function(){return _0x5b53b6;});})['then'](function(){_0x506af4['status'](0xcc)[_0x3421('0x30')]();});}};}function handleEntityNotFound(_0x5aa96b,_0x5074a2){return function(_0xb4eaf4){if(!_0xb4eaf4){_0x5aa96b['sendStatus'](0x194);}return _0xb4eaf4;};}function handleError(_0x20abc7,_0x5bcd19){_0x5bcd19=_0x5bcd19||0x1f4;return function(_0xc7f9fb){logger[_0x3421('0x31')](_0xc7f9fb['stack']);if(_0xc7f9fb[_0x3421('0x32')]){delete _0xc7f9fb[_0x3421('0x32')];}_0x20abc7[_0x3421('0x20')](_0x5bcd19)['send'](_0xc7f9fb);};}exports[_0x3421('0x33')]=function(_0x50d61b,_0x2b5af4){var _0xf0039={},_0x1045ab={},_0x841e08={'count':0x0,'rows':[]};var _0x3875c6=_[_0x3421('0x34')](db[_0x3421('0x35')][_0x3421('0x36')],function(_0x94559a){return{'name':_0x94559a[_0x3421('0x37')],'type':_0x94559a['type']['key']};});_0x1045ab[_0x3421('0x38')]=_[_0x3421('0x34')](_0x3875c6,'name');_0x1045ab[_0x3421('0x39')]=_[_0x3421('0x3a')](_0x50d61b[_0x3421('0x39')]);_0x1045ab[_0x3421('0x3b')]=_[_0x3421('0x3c')](_0x1045ab['model'],_0x1045ab[_0x3421('0x39')]);_0xf0039[_0x3421('0x3d')]=_[_0x3421('0x3c')](_0x1045ab['model'],qs[_0x3421('0x3e')](_0x50d61b['query'][_0x3421('0x3e')]));_0xf0039[_0x3421('0x3d')]=_0xf0039[_0x3421('0x3d')][_0x3421('0x3f')]?_0xf0039[_0x3421('0x3d')]:_0x1045ab[_0x3421('0x38')];if(!_0x50d61b[_0x3421('0x39')]['hasOwnProperty']('nolimit')){_0xf0039['limit']=qs[_0x3421('0x23')](_0x50d61b['query']['limit']);_0xf0039[_0x3421('0x21')]=qs['offset'](_0x50d61b[_0x3421('0x39')][_0x3421('0x21')]);}_0xf0039['order']=qs[_0x3421('0x40')](_0x50d61b[_0x3421('0x39')][_0x3421('0x40')]);_0xf0039[_0x3421('0x41')]=qs['filters'](_[_0x3421('0x42')](_0x50d61b[_0x3421('0x39')],_0x1045ab[_0x3421('0x3b')]),_0x3875c6);if(_0x50d61b[_0x3421('0x39')][_0x3421('0x43')]){_0xf0039['where']=_[_0x3421('0x44')](_0xf0039[_0x3421('0x41')],{'$or':_['map'](_0x3875c6,function(_0x15551c){if(_0x15551c['type']!=='VIRTUAL'){var _0x486ce8={};_0x486ce8[_0x15551c[_0x3421('0x32')]]={'$like':'%'+_0x50d61b[_0x3421('0x39')][_0x3421('0x43')]+'%'};return _0x486ce8;}})});}_0xf0039=_[_0x3421('0x44')]({},_0xf0039,_0x50d61b[_0x3421('0x45')]);var _0x417d6e={'where':_0xf0039[_0x3421('0x41')]};return db[_0x3421('0x35')][_0x3421('0x24')](_0x417d6e)[_0x3421('0x2b')](function(_0x3b9d15){_0x841e08[_0x3421('0x24')]=_0x3b9d15;if(_0x50d61b[_0x3421('0x39')][_0x3421('0x46')]){_0xf0039['include']=[{'all':!![]}];}return db[_0x3421('0x35')][_0x3421('0x47')](_0xf0039);})[_0x3421('0x2b')](function(_0x4466be){_0x841e08['rows']=_0x4466be;return _0x841e08;})[_0x3421('0x2b')](respondWithFilteredResult(_0x2b5af4,_0xf0039))['catch'](handleError(_0x2b5af4,null));};exports[_0x3421('0x48')]=function(_0x248f84,_0x669cfd){var _0x176aef={'raw':![],'where':{'id':_0x248f84[_0x3421('0x49')]['id']}},_0x2f9a84={};_0x2f9a84[_0x3421('0x38')]=_[_0x3421('0x3a')](db[_0x3421('0x35')][_0x3421('0x36')]);_0x2f9a84[_0x3421('0x39')]=_[_0x3421('0x3a')](_0x248f84[_0x3421('0x39')]);_0x2f9a84['filters']=_[_0x3421('0x3c')](_0x2f9a84['model'],_0x2f9a84[_0x3421('0x39')]);_0x176aef[_0x3421('0x3d')]=_[_0x3421('0x3c')](_0x2f9a84[_0x3421('0x38')],qs[_0x3421('0x3e')](_0x248f84[_0x3421('0x39')][_0x3421('0x3e')]));_0x176aef[_0x3421('0x3d')]=_0x176aef[_0x3421('0x3d')][_0x3421('0x3f')]?_0x176aef['attributes']:_0x2f9a84[_0x3421('0x38')];if(_0x248f84[_0x3421('0x39')][_0x3421('0x46')]){_0x176aef['include']=[{'all':!![]}];}_0x176aef=_['merge']({},_0x176aef,_0x248f84[_0x3421('0x45')]);return db[_0x3421('0x35')][_0x3421('0x4a')](_0x176aef)['then'](handleEntityNotFound(_0x669cfd,null))[_0x3421('0x2b')](respondWithResult(_0x669cfd,null))[_0x3421('0x4b')](handleError(_0x669cfd,null));};exports[_0x3421('0x2c')]=function(_0x356376,_0x57554a){return db[_0x3421('0x35')][_0x3421('0x4a')]({'where':{'id':_0x356376[_0x3421('0x49')]['id']}})['then'](handleEntityNotFound(_0x57554a,null))['then'](removeEntity(_0x57554a,null))['catch'](handleError(_0x57554a,null));};exports[_0x3421('0x4c')]=function(_0x1021f8,_0x5a9ccf){return db['VoicePrefix'][_0x3421('0x4c')]()[_0x3421('0x2b')](respondWithResult(_0x5a9ccf,null))[_0x3421('0x4b')](handleError(_0x5a9ccf,null));};exports[_0x3421('0x4d')]=function(_0x127835,_0x4987e3){var _0x27d284;return db[_0x3421('0x4e')][_0x3421('0x4f')](function(_0x2f9ce1){return db['VoicePrefix'][_0x3421('0x4d')](_0x127835[_0x3421('0x50')],{'transaction':_0x2f9ce1})[_0x3421('0x2b')](function(_0x48a967){_0x27d284=_0x48a967[_0x3421('0x2d')]({'plain':!![]});return db['VoiceExtension']['find']({'where':{'id':_0x27d284[_0x3421('0x51')]},'raw':!![]})['then'](function(_0x4e33a0){return createVoicePrefixExtensions(_0x27d284,_0x4e33a0,_0x2f9ce1);});});})[_0x3421('0x2b')](function(){var _0x12bd9a=_0x127835['user'][_0x3421('0x2d')]({'plain':!![]});if(!_0x12bd9a)throw new Error(_0x3421('0x52'));if(_0x12bd9a[_0x3421('0x53')]===_0x3421('0x54')){var _0x1c73b9=_0x27d284;return db[_0x3421('0x55')][_0x3421('0x4a')]({'where':{'name':_0x3421('0x2e'),'userProfileId':_0x12bd9a[_0x3421('0x56')]},'raw':!![]})['then'](function(_0x1e4add){if(_0x1e4add&&_0x1e4add[_0x3421('0x57')]===0x0){return db['UserProfileResource'][_0x3421('0x4d')]({'name':_0x1c73b9[_0x3421('0x32')],'resourceId':_0x1c73b9['id'],'type':_0x1e4add[_0x3421('0x32')],'sectionId':_0x1e4add['id']},{})['then'](function(){return _0x27d284;});}else{return _0x27d284;}})[_0x3421('0x4b')](function(_0x27085d){logger[_0x3421('0x31')](_0x3421('0x58'),_0x27085d);throw _0x27085d;});}return _0x27d284;})[_0x3421('0x2b')](respondWithResult(_0x4987e3,null))[_0x3421('0x4b')](handleError(_0x4987e3,null));};function Extension(_0x333b86,_0x3254aa,_0x31fd9b,_0x279b44){this[_0x3421('0x59')]=_0x3421('0x5a');this[_0x3421('0x5b')]=_0x333b86;this[_0x3421('0x5c')]=_0x31fd9b;this[_0x3421('0x5d')]='system';this[_0x3421('0x5e')]=_0x3421('0x5f');this[_0x3421('0x60')]=_0x3254aa;this[_0x3421('0x61')]=_0x279b44;}function createVoicePrefixExtensions(_0x1813c9,_0x25a641,_0x32c9a7){return new BPromise(function(_0x374a6a,_0x5d6488){var _0x379673=new Extension(formatPrefixName(_0x1813c9['prefix']),0x1,_0x3421('0x62'),_0x3421('0x63'));_0x379673[_0x3421('0x64')]=_0x1813c9['id'];return db[_0x3421('0x65')]['create'](_0x379673,{'transaction':_0x32c9a7})[_0x3421('0x2b')](function(_0x21e11b){var _0x9def45=_0x21e11b[_0x3421('0x2d')]({'plain':!![]});var _0x9e649=_[_0x3421('0x34')](addVoicePrefixExtensions(_0x1813c9,_0x25a641),function(_0x5e6c4d){_0x5e6c4d[_0x3421('0x51')]=_0x9def45['id'];_0x5e6c4d[_0x3421('0x64')]=_0x1813c9['id'];return _0x5e6c4d;});return db[_0x3421('0x65')][_0x3421('0x66')](_0x9e649,{'transaction':_0x32c9a7})[_0x3421('0x2b')](function(_0x1ba5e1){if(!_0x1ba5e1){return _0x5d6488(_0x3421('0x67'));}else{return _0x374a6a(_0x1ba5e1);}})[_0x3421('0x4b')](function(_0x4edb4e){return _0x5d6488(_0x4edb4e);});});;});};function addVoicePrefixExtensions(_0xfbdb57,_0x46717b){var _0x200958=[];var _0x40ae83=formatPrefixName(_0xfbdb57[_0x3421('0x68')]);_0x200958['push'](new Extension(_0x40ae83,0x2,'Set',_0x3421('0x69')+_0xfbdb57[_0x3421('0x32')]));if(_0xfbdb57[_0x3421('0x6a')]){_0x200958['push'](new Extension(_0x40ae83,0x3,_0x3421('0x6b'),'PREFIX-CALLERIDALL='+_0xfbdb57[_0x3421('0x6a')]));}else{_0x200958['push'](new Extension(_0x40ae83,0x3,'NoOp','No\x20callerid\x20available'));}_0x200958['push'](new Extension(_0x40ae83,0x4,'goto',_0x46717b[_0x3421('0x59')]+','+_0x3421('0x6c')+(0x8+_0xfbdb57[_0x3421('0x32')][_0x3421('0x3f')])+'}'+','+0x1));return _0x200958;}function formatPrefixName(_0xa05828){var _0x3ccb08='_';for(var _0x231067=0x0;_0x231067<_0xa05828[_0x3421('0x3f')];_0x231067++){if(_0xa05828[_0x3421('0x6d')](_0x231067)=='-'){_0x3ccb08+=_0xa05828[_0x3421('0x6d')](_0x231067);}else{_0x3ccb08+='['+_0xa05828['charAt'](_0x231067)+']';}}_0x3ccb08+='.';return _0x3ccb08;}exports[_0x3421('0x2a')]=function(_0x4dce60,_0x252b28,_0x41e5f8){var _0x40e0a6=_0x4dce60[_0x3421('0x50')];_0x40e0a6[_0x3421('0x68')]=_0x3421('0x6e')+_0x40e0a6[_0x3421('0x32')]+'-';return db[_0x3421('0x4e')][_0x3421('0x4f')](function(_0x5c74a8){return db[_0x3421('0x35')][_0x3421('0x2a')](_0x40e0a6,{'where':{'id':_0x40e0a6['id']},'transaction':_0x5c74a8})[_0x3421('0x2b')](function(){return db['VoiceExtension']['destroy']({'where':{'VoicePrefixId':_0x40e0a6['id']},'transaction':_0x5c74a8})['then'](function(){return db['VoiceExtension'][_0x3421('0x4a')]({'where':{'id':_0x40e0a6['VoiceExtensionId']},'raw':!![]})[_0x3421('0x2b')](function(_0x8aee05){return createVoicePrefixExtensions(_0x40e0a6,_0x8aee05,_0x5c74a8);});});});})[_0x3421('0x2b')](function(){return db[_0x3421('0x35')]['findById'](_0x40e0a6['id']);})[_0x3421('0x2b')](respondWithResult(_0x252b28,null))[_0x3421('0x4b')](handleError(_0x252b28,null));};exports[_0x3421('0x6f')]=function(_0xfb8c60,_0x151eaf,_0x4177cc){return db['VoicePrefix'][_0x3421('0x4a')]({'where':{'id':_0xfb8c60[_0x3421('0x49')]['id']}})[_0x3421('0x2b')](handleEntityNotFound(_0x151eaf,null))[_0x3421('0x2b')](function(_0x37e6d8){if(_0x37e6d8){return _0x37e6d8[_0x3421('0x6f')](_0xfb8c60[_0x3421('0x50')]['ids'],_['omit'](_0xfb8c60[_0x3421('0x50')],[_0x3421('0x70'),'id'])||{})[_0x3421('0x71')](function(_0x5d04c6){for(var _0x2dac40=0x0;_0x2dac40<_0xfb8c60['body'][_0x3421('0x70')]['length'];_0x2dac40+=0x1){socket[_0x3421('0x72')](_0x3421('0x73'),{'UserId':Number(_0xfb8c60[_0x3421('0x50')][_0x3421('0x70')][_0x2dac40]),'VoicePrefixId':Number(_0xfb8c60[_0x3421('0x49')]['id'])});}return _0x5d04c6;});}})[_0x3421('0x2b')](respondWithResult(_0x151eaf,null))[_0x3421('0x4b')](handleError(_0x151eaf,null));};exports[_0x3421('0x74')]=function(_0x3f1df5,_0x37ca80,_0x427013){return db[_0x3421('0x35')]['find']({'where':{'id':_0x3f1df5[_0x3421('0x49')]['id']}})[_0x3421('0x2b')](handleEntityNotFound(_0x37ca80,null))[_0x3421('0x2b')](function(_0x387d09){if(_0x387d09){return _0x387d09[_0x3421('0x74')](_0x3f1df5[_0x3421('0x39')][_0x3421('0x70')])[_0x3421('0x2b')](function(){if(_['isArray'](_0x3f1df5[_0x3421('0x39')]['ids'])){for(var _0x4d92ed=0x0;_0x4d92ed<_0x3f1df5['query'][_0x3421('0x70')][_0x3421('0x3f')];_0x4d92ed+=0x1){socket[_0x3421('0x72')](_0x3421('0x75'),{'UserId':Number(_0x3f1df5['query'][_0x3421('0x70')][_0x4d92ed]),'VoicePrefixId':Number(_0x3f1df5[_0x3421('0x49')]['id'])});}}else{socket[_0x3421('0x72')](_0x3421('0x75'),{'UserId':Number(_0x3f1df5[_0x3421('0x39')][_0x3421('0x70')]),'VoicePrefixId':Number(_0x3f1df5[_0x3421('0x49')]['id'])});}});}})[_0x3421('0x2b')](respondWithStatusCode(_0x37ca80,null))[_0x3421('0x4b')](handleError(_0x37ca80,null));};exports[_0x3421('0x76')]=function(_0x19e35d,_0x414218,_0x1d65ba){var _0x170340={};var _0x456644={};var _0x355f47;var _0x826d7c;return db['VoicePrefix']['findOne']({'where':{'id':_0x19e35d[_0x3421('0x49')]['id']}})['then'](handleEntityNotFound(_0x414218,null))[_0x3421('0x2b')](function(_0x2fd442){if(_0x2fd442){_0x355f47=_0x2fd442;_0x456644['model']=_[_0x3421('0x3a')](db[_0x3421('0x77')][_0x3421('0x36')]);_0x456644[_0x3421('0x39')]=_[_0x3421('0x3a')](_0x19e35d[_0x3421('0x39')]);_0x456644[_0x3421('0x3b')]=_[_0x3421('0x3c')](_0x456644[_0x3421('0x38')],_0x456644[_0x3421('0x39')]);_0x170340[_0x3421('0x3d')]=_[_0x3421('0x3c')](_0x456644[_0x3421('0x38')],qs['fields'](_0x19e35d[_0x3421('0x39')]['fields']));_0x170340[_0x3421('0x3d')]=_0x170340[_0x3421('0x3d')]['length']?_0x170340[_0x3421('0x3d')]:_0x456644['model'];_0x170340['order']=qs[_0x3421('0x40')](_0x19e35d[_0x3421('0x39')][_0x3421('0x40')]);_0x170340['where']=qs[_0x3421('0x3b')](_[_0x3421('0x42')](_0x19e35d[_0x3421('0x39')],_0x456644['filters']));if(_0x19e35d['query'][_0x3421('0x43')]){_0x170340[_0x3421('0x41')]=_[_0x3421('0x44')](_0x170340[_0x3421('0x41')],{'$or':_['map'](_0x170340[_0x3421('0x3d')],function(_0x1fcd4b){var _0x298afc={};_0x298afc[_0x1fcd4b]={'$like':'%'+_0x19e35d[_0x3421('0x39')][_0x3421('0x43')]+'%'};return _0x298afc;})});}_0x170340=_[_0x3421('0x44')]({},_0x170340,_0x19e35d[_0x3421('0x45')]);return _0x355f47[_0x3421('0x76')](_0x170340);}})['then'](function(_0x27967d){if(_0x27967d){_0x826d7c=_0x27967d[_0x3421('0x3f')];if(!_0x19e35d['query']['hasOwnProperty'](_0x3421('0x78'))){_0x170340[_0x3421('0x23')]=qs[_0x3421('0x23')](_0x19e35d[_0x3421('0x39')][_0x3421('0x23')]);_0x170340['offset']=qs['offset'](_0x19e35d[_0x3421('0x39')]['offset']);}return _0x355f47['getAgents'](_0x170340);}})[_0x3421('0x2b')](function(_0x1a5b7c){if(_0x1a5b7c){return _0x1a5b7c?{'count':_0x826d7c,'rows':_0x1a5b7c}:null;}})[_0x3421('0x2b')](respondWithResult(_0x414218,null))[_0x3421('0x4b')](handleError(_0x414218,null));};exports['getTeams']=function(_0x595f0a,_0x335331,_0x5a922d){var _0x5af9c9={};var _0x1fb48f={};var _0x3fc2b6;var _0x4289f3;return db['VoicePrefix']['findOne']({'where':{'id':_0x595f0a['params']['id']}})[_0x3421('0x2b')](handleEntityNotFound(_0x335331,null))[_0x3421('0x2b')](function(_0x176b12){if(_0x176b12){_0x3fc2b6=_0x176b12;_0x1fb48f[_0x3421('0x38')]=_[_0x3421('0x3a')](db[_0x3421('0x79')][_0x3421('0x36')]);_0x1fb48f['query']=_[_0x3421('0x3a')](_0x595f0a[_0x3421('0x39')]);_0x1fb48f[_0x3421('0x3b')]=_[_0x3421('0x3c')](_0x1fb48f[_0x3421('0x38')],_0x1fb48f[_0x3421('0x39')]);_0x5af9c9[_0x3421('0x3d')]=_[_0x3421('0x3c')](_0x1fb48f[_0x3421('0x38')],qs['fields'](_0x595f0a['query'][_0x3421('0x3e')]));_0x5af9c9['attributes']=_0x5af9c9[_0x3421('0x3d')]['length']?_0x5af9c9[_0x3421('0x3d')]:_0x1fb48f[_0x3421('0x38')];_0x5af9c9[_0x3421('0x7a')]=qs[_0x3421('0x40')](_0x595f0a[_0x3421('0x39')]['sort']);_0x5af9c9['where']=qs[_0x3421('0x3b')](_[_0x3421('0x42')](_0x595f0a[_0x3421('0x39')],_0x1fb48f[_0x3421('0x3b')]));if(_0x595f0a['query'][_0x3421('0x43')]){_0x5af9c9[_0x3421('0x41')]=_[_0x3421('0x44')](_0x5af9c9[_0x3421('0x41')],{'$or':_[_0x3421('0x34')](_0x5af9c9[_0x3421('0x3d')],function(_0x31095c){var _0x4c3058={};_0x4c3058[_0x31095c]={'$like':'%'+_0x595f0a[_0x3421('0x39')][_0x3421('0x43')]+'%'};return _0x4c3058;})});}_0x5af9c9=_['merge']({},_0x5af9c9,_0x595f0a[_0x3421('0x45')]);return _0x3fc2b6[_0x3421('0x7b')](_0x5af9c9);}})[_0x3421('0x2b')](function(_0x58b3e4){if(_0x58b3e4){_0x4289f3=_0x58b3e4[_0x3421('0x3f')];if(!_0x595f0a[_0x3421('0x39')]['hasOwnProperty'](_0x3421('0x78'))){_0x5af9c9[_0x3421('0x23')]=qs[_0x3421('0x23')](_0x595f0a[_0x3421('0x39')][_0x3421('0x23')]);_0x5af9c9[_0x3421('0x21')]=qs[_0x3421('0x21')](_0x595f0a[_0x3421('0x39')]['offset']);}return _0x3fc2b6[_0x3421('0x7b')](_0x5af9c9);}})['then'](function(_0x5aaa8a){if(_0x5aaa8a){return _0x5aaa8a?{'count':_0x4289f3,'rows':_0x5aaa8a}:null;}})[_0x3421('0x2b')](respondWithResult(_0x335331,null))[_0x3421('0x4b')](handleError(_0x335331,null));};exports[_0x3421('0x7c')]=function(_0x2c62d7,_0x5cbf21,_0x25c6a0){var _0x44e166=_0x2c62d7[_0x3421('0x50')][_0x3421('0x70')];var _0x13b03f;return db[_0x3421('0x79')][_0x3421('0x47')]({'where':{'id':_0x44e166},'attributes':['id'],'include':[{'model':db[_0x3421('0x77')],'as':_0x3421('0x7d'),'attributes':['id',_0x3421('0x32'),_0x3421('0x7e'),_0x3421('0x7f'),_0x3421('0x80')],'raw':!![]}]})[_0x3421('0x2b')](function(_0x1cde5f){if(_0x1cde5f){_0x13b03f=_0x1cde5f;var _0x1ddc33=_[_0x3421('0x81')](_0x1cde5f,function(_0x34f980){var _0x7d7398=_0x34f980[_0x3421('0x2d')]({'plain':!![]});return _0x7d7398[_0x3421('0x7d')];});return db['VoicePrefix']['find']({'where':{'id':_0x2c62d7[_0x3421('0x49')]['id']}})[_0x3421('0x2b')](function(_0x1a7038){return db[_0x3421('0x4e')]['transaction'](function(_0x18f27a){return _0x1a7038[_0x3421('0x7c')](_0x44e166,{'transaction':_0x18f27a})['then'](function(){return BPromise[_0x3421('0x82')](_0x13b03f,function(_0x2eb3f4){return db[_0x3421('0x83')]['upsert']({'TeamId':_0x2eb3f4['id'],'VoicePrefixId':_0x2c62d7[_0x3421('0x49')]['id']},{'transaction':_0x18f27a});});})['then'](function(){return BPromise[_0x3421('0x82')](_0x1ddc33,function(_0x3f6f2c){return db[_0x3421('0x84')][_0x3421('0x85')]({'where':{'UserId':_0x3f6f2c['id'],'VoicePrefixId':_0x2c62d7[_0x3421('0x49')]['id']},'transaction':_0x18f27a});});})[_0x3421('0x2b')](function(){_0x1ddc33[_0x3421('0x86')](function(_0x50607f){socket[_0x3421('0x72')]('userVoicePrefix:save',{'UserId':_0x50607f['id'],'VoicePrefixId':_0x1a7038['id']});});});});});}})['then'](respondWithStatusCode(_0x5cbf21,null))[_0x3421('0x4b')](handleError(_0x5cbf21,null));};exports[_0x3421('0x87')]=function(_0x4a85d1,_0x1b48e1,_0x4c357e){return db[_0x3421('0x79')][_0x3421('0x47')]({'where':{'id':_0x4a85d1[_0x3421('0x39')][_0x3421('0x70')]},'attributes':['id'],'include':[{'model':db[_0x3421('0x77')],'as':_0x3421('0x7d'),'attributes':['id'],'raw':!![]}]})[_0x3421('0x2b')](handleEntityNotFound(_0x1b48e1,null))[_0x3421('0x2b')](function(_0x2f38ec){var _0x11f294=_[_0x3421('0x34')](_0x2f38ec,'id');var _0x2d7330=[];var _0x5bf9a4=[];var _0x36868f=squel['select']();_0x36868f['field'](_0x3421('0x88'))[_0x3421('0x89')](_0x3421('0x8a'),'tq')[_0x3421('0x8b')]('user_has_teams','ut',_0x3421('0x8c'))[_0x3421('0x41')]('VoicePrefixId\x20=\x20?',_0x4a85d1[_0x3421('0x49')]['id']);for(var _0x4a933a=0x0;_0x4a933a<_0x2f38ec[_0x3421('0x3f')];_0x4a933a+=0x1){let _0x2defcb=_0x2f38ec[_0x4a933a];for(var _0x16735e=0x0;_0x16735e<_0x2defcb['Agents'][_0x3421('0x3f')];_0x16735e+=0x1){let _0x303df7=_0x2defcb[_0x3421('0x7d')][_0x16735e];var _0x1d8163=_0x36868f[_0x3421('0x8d')]();_0x1d8163[_0x3421('0x41')](_0x3421('0x8e'),_0x303df7['id']);_0x5bf9a4[_0x3421('0x8f')](db['sequelize'][_0x3421('0x39')](_0x1d8163[_0x3421('0x90')](),{'type':db[_0x3421('0x4e')][_0x3421('0x91')][_0x3421('0x92')]})[_0x3421('0x2b')](function(_0x3a5346){if(_0x3a5346['length']===0x1){return _0x303df7['id'];}else{var _0x3f64d0=_[_0x3421('0x93')](_['map'](_0x3a5346,'TeamId'),function(_0x4aa261){return _[_0x3421('0x94')](_0x11f294,_0x4aa261);});if(_0x3f64d0){return _0x303df7['id'];}}}));}}return BPromise[_0x3421('0x95')](_0x5bf9a4)['then'](function(_0x256976){_0x2d7330=_(_0x2d7330)[_0x3421('0x96')](_0x256976)[_0x3421('0x97')]()[_0x3421('0x98')]();return db[_0x3421('0x35')][_0x3421('0x4a')]({'where':{'id':_0x4a85d1[_0x3421('0x49')]['id']}})['then'](function(_0x224e26){return db[_0x3421('0x4e')][_0x3421('0x4f')](function(_0x1e2a67){return _0x224e26[_0x3421('0x87')](_0x4a85d1[_0x3421('0x39')]['ids'],{'transaction':_0x1e2a67})[_0x3421('0x2b')](function(){if(!_[_0x3421('0x99')](_0x2d7330)){return _0x224e26['removeAgents'](_0x2d7330,{'transaction':_0x1e2a67});}})[_0x3421('0x2b')](function(){_0x2d7330[_0x3421('0x86')](function(_0x25cc13){socket[_0x3421('0x72')](_0x3421('0x75'),{'UserId':_0x25cc13,'VoicePrefixId':_0x224e26['id']});});});});});});})[_0x3421('0x2b')](respondWithStatusCode(_0x1b48e1,null))[_0x3421('0x4b')](handleError(_0x1b48e1,null));}; \ No newline at end of file +var _0xb03e=['from','team_has_voice_prefixes','join','user_has_teams','clone','toString','SELECT','every','TeamId','all','union','compact','value','isEmpty','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','VoicePrefixes','error','stack','index','VoicePrefix','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','name','options','includeAll','include','findAll','rows','catch','show','keys','fields','find','params','describe','create','sequelize','transaction','body','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','app','system','Voice\x20Prefix\x20Extension','priority','prefix','NoOp','VoicePrefixId','Extensions\x20creation\x20failed','push','callerIdAll','Set','PREFIX-CALLERIDALL=','goto','${EXTEN:','charAt','system-','findById','addAgents','omit','ids','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','User','Team','getTeams','addTeams','Agents','online','flatMap','TeamVoicePrefix','upsert','each','findOrCreate','forEach','removeTeams','select','field','tq.TeamId'];(function(_0x3998b3,_0x5ce1bb){var _0x46d190=function(_0x5c131c){while(--_0x5c131c){_0x3998b3['push'](_0x3998b3['shift']());}};_0x46d190(++_0x5ce1bb);}(_0xb03e,0x1eb));var _0xeb03=function(_0xe1dab1,_0x1ba45e){_0xe1dab1=_0xe1dab1-0x0;var _0x1390c6=_0xb03e[_0xe1dab1];return _0x1390c6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xeb03('0x0'));var zipdir=require(_0xeb03('0x1'));var jsonpatch=require(_0xeb03('0x2'));var rp=require(_0xeb03('0x3'));var moment=require(_0xeb03('0x4'));var BPromise=require(_0xeb03('0x5'));var Mustache=require(_0xeb03('0x6'));var util=require(_0xeb03('0x7'));var path=require(_0xeb03('0x8'));var sox=require(_0xeb03('0x9'));var csv=require(_0xeb03('0xa'));var ejs=require(_0xeb03('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeb03('0xc'));var squel=require(_0xeb03('0xd'));var crypto=require(_0xeb03('0xe'));var jsforce=require(_0xeb03('0xf'));var deskjs=require(_0xeb03('0x10'));var toCsv=require(_0xeb03('0xa'));var querystring=require('querystring');var Papa=require(_0xeb03('0x11'));var Redis=require(_0xeb03('0x12'));var authService=require(_0xeb03('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xeb03('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xeb03('0x15'))(_0xeb03('0x16'));var utils=require(_0xeb03('0x17'));var config=require(_0xeb03('0x18'));var licenseUtil=require(_0xeb03('0x19'));var db=require(_0xeb03('0x1a'))['db'];config[_0xeb03('0x1b')]=_[_0xeb03('0x1c')](config[_0xeb03('0x1b')],{'host':_0xeb03('0x1d'),'port':0x18eb});var socket=require(_0xeb03('0x1e'))(new Redis(config[_0xeb03('0x1b')]));require('./voicePrefix.socket')[_0xeb03('0x1f')](socket);function respondWithStatusCode(_0x100bef,_0x372c71){_0x372c71=_0x372c71||0xcc;return function(_0x33f9ba){if(_0x33f9ba){return _0x100bef['sendStatus'](_0x372c71);}return _0x100bef[_0xeb03('0x20')](_0x372c71)[_0xeb03('0x21')]();};}function respondWithResult(_0x3f26ef,_0x478989){_0x478989=_0x478989||0xc8;return function(_0x7ce874){if(_0x7ce874){return _0x3f26ef[_0xeb03('0x20')](_0x478989)[_0xeb03('0x22')](_0x7ce874);}};}function respondWithFilteredResult(_0x44716c,_0x42fa4e){return function(_0x1b4cbd){if(_0x1b4cbd){var _0x167a33=typeof _0x42fa4e[_0xeb03('0x23')]===_0xeb03('0x24')&&typeof _0x42fa4e[_0xeb03('0x25')]===_0xeb03('0x24');var _0x2c238d=_0x1b4cbd[_0xeb03('0x26')];var _0x19bddf=_0x167a33?0x0:_0x42fa4e['offset'];var _0x1bea3f=_0x167a33?_0x1b4cbd[_0xeb03('0x26')]:_0x42fa4e[_0xeb03('0x23')]+_0x42fa4e[_0xeb03('0x25')];var _0xe5a1c2;if(_0x1bea3f>=_0x2c238d){_0x1bea3f=_0x2c238d;_0xe5a1c2=0xc8;}else{_0xe5a1c2=0xce;}_0x44716c[_0xeb03('0x20')](_0xe5a1c2);return _0x44716c[_0xeb03('0x27')](_0xeb03('0x28'),_0x19bddf+'-'+_0x1bea3f+'/'+_0x2c238d)[_0xeb03('0x22')](_0x1b4cbd);}return null;};}function patchUpdates(_0x5a704b){return function(_0x712ac2){try{jsonpatch[_0xeb03('0x29')](_0x712ac2,_0x5a704b,!![]);}catch(_0x11ea85){return BPromise[_0xeb03('0x2a')](_0x11ea85);}return _0x712ac2[_0xeb03('0x2b')]();};}function saveUpdates(_0x5dcda3,_0x638353){return function(_0x406864){if(_0x406864){return _0x406864[_0xeb03('0x2c')](_0x5dcda3)[_0xeb03('0x2d')](function(_0x3f276a){return _0x3f276a;});}return null;};}function removeEntity(_0x119697,_0xb04f34){return function(_0x3f68f3){if(_0x3f68f3){return _0x3f68f3[_0xeb03('0x2e')]()['then'](function(){var _0x832372=_0x3f68f3[_0xeb03('0x2f')]({'plain':!![]});var _0x2683f9=_0xeb03('0x30');return db['UserProfileResource']['destroy']({'where':{'type':_0x2683f9,'resourceId':_0x832372['id']}})[_0xeb03('0x2d')](function(){return _0x3f68f3;});})['then'](function(){_0x119697[_0xeb03('0x20')](0xcc)[_0xeb03('0x21')]();});}};}function handleEntityNotFound(_0x160a37,_0x5db8bb){return function(_0xd4c8ec){if(!_0xd4c8ec){_0x160a37['sendStatus'](0x194);}return _0xd4c8ec;};}function handleError(_0x5cb729,_0x49e316){_0x49e316=_0x49e316||0x1f4;return function(_0x538d19){logger[_0xeb03('0x31')](_0x538d19[_0xeb03('0x32')]);if(_0x538d19['name']){delete _0x538d19['name'];}_0x5cb729['status'](_0x49e316)['send'](_0x538d19);};}exports[_0xeb03('0x33')]=function(_0x3655c3,_0x32aff7){var _0x2d2ddd={},_0x19fa35={},_0x5234dc={'count':0x0,'rows':[]};var _0x13efc6=_['map'](db[_0xeb03('0x34')][_0xeb03('0x35')],function(_0x19ceae){return{'name':_0x19ceae[_0xeb03('0x36')],'type':_0x19ceae[_0xeb03('0x37')][_0xeb03('0x38')]};});_0x19fa35[_0xeb03('0x39')]=_[_0xeb03('0x3a')](_0x13efc6,'name');_0x19fa35[_0xeb03('0x3b')]=_['keys'](_0x3655c3[_0xeb03('0x3b')]);_0x19fa35[_0xeb03('0x3c')]=_[_0xeb03('0x3d')](_0x19fa35[_0xeb03('0x39')],_0x19fa35[_0xeb03('0x3b')]);_0x2d2ddd[_0xeb03('0x3e')]=_['intersection'](_0x19fa35[_0xeb03('0x39')],qs['fields'](_0x3655c3['query']['fields']));_0x2d2ddd[_0xeb03('0x3e')]=_0x2d2ddd[_0xeb03('0x3e')][_0xeb03('0x3f')]?_0x2d2ddd[_0xeb03('0x3e')]:_0x19fa35[_0xeb03('0x39')];if(!_0x3655c3['query'][_0xeb03('0x40')](_0xeb03('0x41'))){_0x2d2ddd[_0xeb03('0x25')]=qs['limit'](_0x3655c3['query'][_0xeb03('0x25')]);_0x2d2ddd[_0xeb03('0x23')]=qs[_0xeb03('0x23')](_0x3655c3['query'][_0xeb03('0x23')]);}_0x2d2ddd[_0xeb03('0x42')]=qs['sort'](_0x3655c3['query'][_0xeb03('0x43')]);_0x2d2ddd[_0xeb03('0x44')]=qs['filters'](_[_0xeb03('0x45')](_0x3655c3[_0xeb03('0x3b')],_0x19fa35[_0xeb03('0x3c')]),_0x13efc6);if(_0x3655c3[_0xeb03('0x3b')][_0xeb03('0x46')]){_0x2d2ddd[_0xeb03('0x44')]=_[_0xeb03('0x47')](_0x2d2ddd[_0xeb03('0x44')],{'$or':_[_0xeb03('0x3a')](_0x13efc6,function(_0x286f48){if(_0x286f48[_0xeb03('0x37')]!==_0xeb03('0x48')){var _0x2a9348={};_0x2a9348[_0x286f48[_0xeb03('0x49')]]={'$like':'%'+_0x3655c3[_0xeb03('0x3b')][_0xeb03('0x46')]+'%'};return _0x2a9348;}})});}_0x2d2ddd=_[_0xeb03('0x47')]({},_0x2d2ddd,_0x3655c3[_0xeb03('0x4a')]);var _0x35e53d={'where':_0x2d2ddd[_0xeb03('0x44')]};return db[_0xeb03('0x34')][_0xeb03('0x26')](_0x35e53d)[_0xeb03('0x2d')](function(_0x5bb7d9){_0x5234dc['count']=_0x5bb7d9;if(_0x3655c3[_0xeb03('0x3b')][_0xeb03('0x4b')]){_0x2d2ddd[_0xeb03('0x4c')]=[{'all':!![]}];}return db[_0xeb03('0x34')][_0xeb03('0x4d')](_0x2d2ddd);})[_0xeb03('0x2d')](function(_0x103c78){_0x5234dc[_0xeb03('0x4e')]=_0x103c78;return _0x5234dc;})['then'](respondWithFilteredResult(_0x32aff7,_0x2d2ddd))[_0xeb03('0x4f')](handleError(_0x32aff7,null));};exports[_0xeb03('0x50')]=function(_0x275d4d,_0xe9dcb0){var _0x528c0f={'raw':![],'where':{'id':_0x275d4d['params']['id']}},_0x57f59e={};_0x57f59e[_0xeb03('0x39')]=_['keys'](db['VoicePrefix']['rawAttributes']);_0x57f59e[_0xeb03('0x3b')]=_[_0xeb03('0x51')](_0x275d4d[_0xeb03('0x3b')]);_0x57f59e[_0xeb03('0x3c')]=_[_0xeb03('0x3d')](_0x57f59e[_0xeb03('0x39')],_0x57f59e['query']);_0x528c0f[_0xeb03('0x3e')]=_['intersection'](_0x57f59e['model'],qs[_0xeb03('0x52')](_0x275d4d[_0xeb03('0x3b')][_0xeb03('0x52')]));_0x528c0f['attributes']=_0x528c0f[_0xeb03('0x3e')][_0xeb03('0x3f')]?_0x528c0f[_0xeb03('0x3e')]:_0x57f59e[_0xeb03('0x39')];if(_0x275d4d[_0xeb03('0x3b')]['includeAll']){_0x528c0f[_0xeb03('0x4c')]=[{'all':!![]}];}_0x528c0f=_['merge']({},_0x528c0f,_0x275d4d[_0xeb03('0x4a')]);return db[_0xeb03('0x34')][_0xeb03('0x53')](_0x528c0f)[_0xeb03('0x2d')](handleEntityNotFound(_0xe9dcb0,null))[_0xeb03('0x2d')](respondWithResult(_0xe9dcb0,null))[_0xeb03('0x4f')](handleError(_0xe9dcb0,null));};exports[_0xeb03('0x2e')]=function(_0x292319,_0x38c993){return db[_0xeb03('0x34')][_0xeb03('0x53')]({'where':{'id':_0x292319[_0xeb03('0x54')]['id']}})[_0xeb03('0x2d')](handleEntityNotFound(_0x38c993,null))[_0xeb03('0x2d')](removeEntity(_0x38c993,null))[_0xeb03('0x4f')](handleError(_0x38c993,null));};exports[_0xeb03('0x55')]=function(_0xf5c1ab,_0x79b7c6){return db[_0xeb03('0x34')][_0xeb03('0x55')]()[_0xeb03('0x2d')](respondWithResult(_0x79b7c6,null))[_0xeb03('0x4f')](handleError(_0x79b7c6,null));};exports[_0xeb03('0x56')]=function(_0x365520,_0x509d79){var _0x17112e;return db[_0xeb03('0x57')][_0xeb03('0x58')](function(_0x5405b4){return db[_0xeb03('0x34')][_0xeb03('0x56')](_0x365520[_0xeb03('0x59')],{'transaction':_0x5405b4})[_0xeb03('0x2d')](function(_0x103da5){_0x17112e=_0x103da5[_0xeb03('0x2f')]({'plain':!![]});return db[_0xeb03('0x5a')][_0xeb03('0x53')]({'where':{'id':_0x17112e[_0xeb03('0x5b')]},'raw':!![]})[_0xeb03('0x2d')](function(_0x46f52e){return createVoicePrefixExtensions(_0x17112e,_0x46f52e,_0x5405b4);});});})[_0xeb03('0x2d')](function(){var _0xf9beaf=_0x365520[_0xeb03('0x5c')]['get']({'plain':!![]});if(!_0xf9beaf)throw new Error(_0xeb03('0x5d'));if(_0xf9beaf[_0xeb03('0x5e')]===_0xeb03('0x5c')){var _0x259db7=_0x17112e;return db[_0xeb03('0x5f')][_0xeb03('0x53')]({'where':{'name':_0xeb03('0x30'),'userProfileId':_0xf9beaf[_0xeb03('0x60')]},'raw':!![]})[_0xeb03('0x2d')](function(_0x23406a){if(_0x23406a&&_0x23406a['autoAssociation']===0x0){return db[_0xeb03('0x61')][_0xeb03('0x56')]({'name':_0x259db7[_0xeb03('0x49')],'resourceId':_0x259db7['id'],'type':_0x23406a[_0xeb03('0x49')],'sectionId':_0x23406a['id']},{})['then'](function(){return _0x17112e;});}else{return _0x17112e;}})[_0xeb03('0x4f')](function(_0x68e1b7){logger[_0xeb03('0x31')](_0xeb03('0x62'),_0x68e1b7);throw _0x68e1b7;});}return _0x17112e;})[_0xeb03('0x2d')](respondWithResult(_0x509d79,null))['catch'](handleError(_0x509d79,null));};function Extension(_0x43efc3,_0x10beeb,_0x28e488,_0x5e1361){this[_0xeb03('0x63')]=_0xeb03('0x64');this['exten']=_0x43efc3;this[_0xeb03('0x65')]=_0x28e488;this[_0xeb03('0x37')]=_0xeb03('0x66');this['description']=_0xeb03('0x67');this[_0xeb03('0x68')]=_0x10beeb;this['appdata']=_0x5e1361;}function createVoicePrefixExtensions(_0x3eb482,_0xfeb8e2,_0x1972fb){return new BPromise(function(_0x3ac2de,_0x3963a7){var _0x38618e=new Extension(formatPrefixName(_0x3eb482[_0xeb03('0x69')]),0x1,_0xeb03('0x6a'),'Voice\x20Prefix');_0x38618e[_0xeb03('0x6b')]=_0x3eb482['id'];return db['VoiceExtension'][_0xeb03('0x56')](_0x38618e,{'transaction':_0x1972fb})[_0xeb03('0x2d')](function(_0x3a9518){var _0x59d0c7=_0x3a9518[_0xeb03('0x2f')]({'plain':!![]});var _0x1508f6=_[_0xeb03('0x3a')](addVoicePrefixExtensions(_0x3eb482,_0xfeb8e2),function(_0x467a9d){_0x467a9d['VoiceExtensionId']=_0x59d0c7['id'];_0x467a9d[_0xeb03('0x6b')]=_0x3eb482['id'];return _0x467a9d;});return db[_0xeb03('0x5a')]['bulkCreate'](_0x1508f6,{'transaction':_0x1972fb})['then'](function(_0x583518){if(!_0x583518){return _0x3963a7(_0xeb03('0x6c'));}else{return _0x3ac2de(_0x583518);}})[_0xeb03('0x4f')](function(_0x9148a6){return _0x3963a7(_0x9148a6);});});;});};function addVoicePrefixExtensions(_0x16ad3a,_0x3da5f4){var _0x461777=[];var _0x443fc9=formatPrefixName(_0x16ad3a[_0xeb03('0x69')]);_0x461777[_0xeb03('0x6d')](new Extension(_0x443fc9,0x2,'Set','CDR(prefix)='+_0x16ad3a[_0xeb03('0x49')]));if(_0x16ad3a[_0xeb03('0x6e')]){_0x461777['push'](new Extension(_0x443fc9,0x3,_0xeb03('0x6f'),_0xeb03('0x70')+_0x16ad3a[_0xeb03('0x6e')]));}else{_0x461777[_0xeb03('0x6d')](new Extension(_0x443fc9,0x3,'NoOp','No\x20callerid\x20available'));}_0x461777[_0xeb03('0x6d')](new Extension(_0x443fc9,0x4,_0xeb03('0x71'),_0x3da5f4[_0xeb03('0x63')]+','+_0xeb03('0x72')+(0x8+_0x16ad3a[_0xeb03('0x49')][_0xeb03('0x3f')])+'}'+','+0x1));return _0x461777;}function formatPrefixName(_0x1a8057){var _0x2ee5c1='_';for(var _0x2e67a4=0x0;_0x2e67a4<_0x1a8057[_0xeb03('0x3f')];_0x2e67a4++){if(_0x1a8057[_0xeb03('0x73')](_0x2e67a4)=='-'){_0x2ee5c1+=_0x1a8057['charAt'](_0x2e67a4);}else{_0x2ee5c1+='['+_0x1a8057['charAt'](_0x2e67a4)+']';}}_0x2ee5c1+='.';return _0x2ee5c1;}exports[_0xeb03('0x2c')]=function(_0x4e52a4,_0x1099ff,_0x4cf4f1){var _0x30623a=_0x4e52a4['body'];_0x30623a[_0xeb03('0x69')]=_0xeb03('0x74')+_0x30623a['name']+'-';return db[_0xeb03('0x57')]['transaction'](function(_0x45f0aa){return db['VoicePrefix'][_0xeb03('0x2c')](_0x30623a,{'where':{'id':_0x30623a['id']},'transaction':_0x45f0aa})['then'](function(){return db['VoiceExtension'][_0xeb03('0x2e')]({'where':{'VoicePrefixId':_0x30623a['id']},'transaction':_0x45f0aa})[_0xeb03('0x2d')](function(){return db[_0xeb03('0x5a')][_0xeb03('0x53')]({'where':{'id':_0x30623a[_0xeb03('0x5b')]},'raw':!![]})[_0xeb03('0x2d')](function(_0x39c15d){return createVoicePrefixExtensions(_0x30623a,_0x39c15d,_0x45f0aa);});});});})['then'](function(){return db[_0xeb03('0x34')][_0xeb03('0x75')](_0x30623a['id']);})[_0xeb03('0x2d')](respondWithResult(_0x1099ff,null))[_0xeb03('0x4f')](handleError(_0x1099ff,null));};exports[_0xeb03('0x76')]=function(_0x126a7f,_0x137a98,_0x4fff6e){return db[_0xeb03('0x34')][_0xeb03('0x53')]({'where':{'id':_0x126a7f[_0xeb03('0x54')]['id']}})[_0xeb03('0x2d')](handleEntityNotFound(_0x137a98,null))[_0xeb03('0x2d')](function(_0xcd7ab1){if(_0xcd7ab1){return _0xcd7ab1[_0xeb03('0x76')](_0x126a7f[_0xeb03('0x59')]['ids'],_[_0xeb03('0x77')](_0x126a7f[_0xeb03('0x59')],[_0xeb03('0x78'),'id'])||{})[_0xeb03('0x79')](function(_0x17c010){for(var _0x5ace77=0x0;_0x5ace77<_0x126a7f[_0xeb03('0x59')][_0xeb03('0x78')][_0xeb03('0x3f')];_0x5ace77+=0x1){socket[_0xeb03('0x7a')](_0xeb03('0x7b'),{'UserId':Number(_0x126a7f[_0xeb03('0x59')][_0xeb03('0x78')][_0x5ace77]),'VoicePrefixId':Number(_0x126a7f['params']['id'])});}return _0x17c010;});}})[_0xeb03('0x2d')](respondWithResult(_0x137a98,null))[_0xeb03('0x4f')](handleError(_0x137a98,null));};exports[_0xeb03('0x7c')]=function(_0x21dfab,_0x396329,_0x48dc21){return db[_0xeb03('0x34')][_0xeb03('0x53')]({'where':{'id':_0x21dfab[_0xeb03('0x54')]['id']}})[_0xeb03('0x2d')](handleEntityNotFound(_0x396329,null))[_0xeb03('0x2d')](function(_0x215759){if(_0x215759){return _0x215759[_0xeb03('0x7c')](_0x21dfab['query'][_0xeb03('0x78')])[_0xeb03('0x2d')](function(){if(_[_0xeb03('0x7d')](_0x21dfab[_0xeb03('0x3b')][_0xeb03('0x78')])){for(var _0x388fbd=0x0;_0x388fbd<_0x21dfab['query'][_0xeb03('0x78')][_0xeb03('0x3f')];_0x388fbd+=0x1){socket[_0xeb03('0x7a')]('userVoicePrefix:remove',{'UserId':Number(_0x21dfab[_0xeb03('0x3b')][_0xeb03('0x78')][_0x388fbd]),'VoicePrefixId':Number(_0x21dfab[_0xeb03('0x54')]['id'])});}}else{socket[_0xeb03('0x7a')](_0xeb03('0x7e'),{'UserId':Number(_0x21dfab[_0xeb03('0x3b')][_0xeb03('0x78')]),'VoicePrefixId':Number(_0x21dfab['params']['id'])});}});}})['then'](respondWithStatusCode(_0x396329,null))[_0xeb03('0x4f')](handleError(_0x396329,null));};exports[_0xeb03('0x7f')]=function(_0x3630a7,_0xe55200,_0x511e5a){var _0x8ba377={};var _0x42c477={};var _0x5b60a4;var _0x45fd83;return db[_0xeb03('0x34')][_0xeb03('0x80')]({'where':{'id':_0x3630a7[_0xeb03('0x54')]['id']}})[_0xeb03('0x2d')](handleEntityNotFound(_0xe55200,null))[_0xeb03('0x2d')](function(_0x5ea593){if(_0x5ea593){_0x5b60a4=_0x5ea593;_0x42c477[_0xeb03('0x39')]=_[_0xeb03('0x51')](db[_0xeb03('0x81')][_0xeb03('0x35')]);_0x42c477[_0xeb03('0x3b')]=_[_0xeb03('0x51')](_0x3630a7[_0xeb03('0x3b')]);_0x42c477[_0xeb03('0x3c')]=_[_0xeb03('0x3d')](_0x42c477[_0xeb03('0x39')],_0x42c477['query']);_0x8ba377[_0xeb03('0x3e')]=_[_0xeb03('0x3d')](_0x42c477['model'],qs[_0xeb03('0x52')](_0x3630a7[_0xeb03('0x3b')]['fields']));_0x8ba377[_0xeb03('0x3e')]=_0x8ba377[_0xeb03('0x3e')][_0xeb03('0x3f')]?_0x8ba377[_0xeb03('0x3e')]:_0x42c477[_0xeb03('0x39')];_0x8ba377['order']=qs['sort'](_0x3630a7['query'][_0xeb03('0x43')]);_0x8ba377['where']=qs[_0xeb03('0x3c')](_[_0xeb03('0x45')](_0x3630a7[_0xeb03('0x3b')],_0x42c477[_0xeb03('0x3c')]));if(_0x3630a7[_0xeb03('0x3b')][_0xeb03('0x46')]){_0x8ba377[_0xeb03('0x44')]=_[_0xeb03('0x47')](_0x8ba377[_0xeb03('0x44')],{'$or':_[_0xeb03('0x3a')](_0x8ba377[_0xeb03('0x3e')],function(_0x27a388){var _0x4ec45c={};_0x4ec45c[_0x27a388]={'$like':'%'+_0x3630a7['query'][_0xeb03('0x46')]+'%'};return _0x4ec45c;})});}_0x8ba377=_['merge']({},_0x8ba377,_0x3630a7['options']);return _0x5b60a4[_0xeb03('0x7f')](_0x8ba377);}})[_0xeb03('0x2d')](function(_0x502b25){if(_0x502b25){_0x45fd83=_0x502b25['length'];if(!_0x3630a7[_0xeb03('0x3b')][_0xeb03('0x40')]('nolimit')){_0x8ba377[_0xeb03('0x25')]=qs[_0xeb03('0x25')](_0x3630a7[_0xeb03('0x3b')][_0xeb03('0x25')]);_0x8ba377[_0xeb03('0x23')]=qs['offset'](_0x3630a7[_0xeb03('0x3b')]['offset']);}return _0x5b60a4['getAgents'](_0x8ba377);}})[_0xeb03('0x2d')](function(_0x2d12eb){if(_0x2d12eb){return _0x2d12eb?{'count':_0x45fd83,'rows':_0x2d12eb}:null;}})[_0xeb03('0x2d')](respondWithResult(_0xe55200,null))[_0xeb03('0x4f')](handleError(_0xe55200,null));};exports['getTeams']=function(_0x4b59f4,_0xf9f2d3,_0x847253){var _0x70343f={};var _0x2d6225={};var _0x388642;var _0x3dc483;return db[_0xeb03('0x34')][_0xeb03('0x80')]({'where':{'id':_0x4b59f4['params']['id']}})['then'](handleEntityNotFound(_0xf9f2d3,null))[_0xeb03('0x2d')](function(_0x5741d4){if(_0x5741d4){_0x388642=_0x5741d4;_0x2d6225[_0xeb03('0x39')]=_['keys'](db[_0xeb03('0x82')][_0xeb03('0x35')]);_0x2d6225[_0xeb03('0x3b')]=_[_0xeb03('0x51')](_0x4b59f4[_0xeb03('0x3b')]);_0x2d6225[_0xeb03('0x3c')]=_[_0xeb03('0x3d')](_0x2d6225[_0xeb03('0x39')],_0x2d6225['query']);_0x70343f['attributes']=_[_0xeb03('0x3d')](_0x2d6225[_0xeb03('0x39')],qs[_0xeb03('0x52')](_0x4b59f4[_0xeb03('0x3b')][_0xeb03('0x52')]));_0x70343f['attributes']=_0x70343f[_0xeb03('0x3e')][_0xeb03('0x3f')]?_0x70343f['attributes']:_0x2d6225[_0xeb03('0x39')];_0x70343f[_0xeb03('0x42')]=qs[_0xeb03('0x43')](_0x4b59f4[_0xeb03('0x3b')][_0xeb03('0x43')]);_0x70343f[_0xeb03('0x44')]=qs[_0xeb03('0x3c')](_[_0xeb03('0x45')](_0x4b59f4[_0xeb03('0x3b')],_0x2d6225[_0xeb03('0x3c')]));if(_0x4b59f4[_0xeb03('0x3b')][_0xeb03('0x46')]){_0x70343f[_0xeb03('0x44')]=_[_0xeb03('0x47')](_0x70343f['where'],{'$or':_[_0xeb03('0x3a')](_0x70343f[_0xeb03('0x3e')],function(_0x4c6b85){var _0x1f3ee1={};_0x1f3ee1[_0x4c6b85]={'$like':'%'+_0x4b59f4['query'][_0xeb03('0x46')]+'%'};return _0x1f3ee1;})});}_0x70343f=_['merge']({},_0x70343f,_0x4b59f4[_0xeb03('0x4a')]);return _0x388642[_0xeb03('0x83')](_0x70343f);}})[_0xeb03('0x2d')](function(_0x1df994){if(_0x1df994){_0x3dc483=_0x1df994[_0xeb03('0x3f')];if(!_0x4b59f4[_0xeb03('0x3b')][_0xeb03('0x40')](_0xeb03('0x41'))){_0x70343f['limit']=qs[_0xeb03('0x25')](_0x4b59f4[_0xeb03('0x3b')][_0xeb03('0x25')]);_0x70343f[_0xeb03('0x23')]=qs['offset'](_0x4b59f4[_0xeb03('0x3b')]['offset']);}return _0x388642[_0xeb03('0x83')](_0x70343f);}})[_0xeb03('0x2d')](function(_0x423ddd){if(_0x423ddd){return _0x423ddd?{'count':_0x3dc483,'rows':_0x423ddd}:null;}})[_0xeb03('0x2d')](respondWithResult(_0xf9f2d3,null))['catch'](handleError(_0xf9f2d3,null));};exports[_0xeb03('0x84')]=function(_0x473d63,_0x1fc15a,_0x45f4d3){var _0x5095a6=_0x473d63[_0xeb03('0x59')]['ids'];var _0x4e0fd8;return db['Team'][_0xeb03('0x4d')]({'where':{'id':_0x5095a6},'attributes':['id'],'include':[{'model':db['User'],'as':_0xeb03('0x85'),'attributes':['id',_0xeb03('0x49'),_0xeb03('0x86'),'voicePause','interface'],'raw':!![]}]})['then'](function(_0x50b2c5){if(_0x50b2c5){_0x4e0fd8=_0x50b2c5;var _0x5c7f6e=_[_0xeb03('0x87')](_0x50b2c5,function(_0x392aaa){var _0x117c5e=_0x392aaa[_0xeb03('0x2f')]({'plain':!![]});return _0x117c5e[_0xeb03('0x85')];});return db[_0xeb03('0x34')]['find']({'where':{'id':_0x473d63[_0xeb03('0x54')]['id']}})[_0xeb03('0x2d')](function(_0x2d8bca){return db[_0xeb03('0x57')]['transaction'](function(_0x5c49c9){return _0x2d8bca[_0xeb03('0x84')](_0x5095a6,{'transaction':_0x5c49c9})[_0xeb03('0x2d')](function(){return BPromise['each'](_0x4e0fd8,function(_0xc7a504){return db[_0xeb03('0x88')][_0xeb03('0x89')]({'TeamId':_0xc7a504['id'],'VoicePrefixId':_0x473d63[_0xeb03('0x54')]['id']},{'transaction':_0x5c49c9});});})[_0xeb03('0x2d')](function(){return BPromise[_0xeb03('0x8a')](_0x5c7f6e,function(_0x11cc99){return db['UserVoicePrefix'][_0xeb03('0x8b')]({'where':{'UserId':_0x11cc99['id'],'VoicePrefixId':_0x473d63[_0xeb03('0x54')]['id']},'transaction':_0x5c49c9});});})[_0xeb03('0x2d')](function(){_0x5c7f6e[_0xeb03('0x8c')](function(_0x1f2ebe){socket[_0xeb03('0x7a')](_0xeb03('0x7b'),{'UserId':_0x1f2ebe['id'],'VoicePrefixId':_0x2d8bca['id']});});});});});}})[_0xeb03('0x2d')](respondWithStatusCode(_0x1fc15a,null))['catch'](handleError(_0x1fc15a,null));};exports[_0xeb03('0x8d')]=function(_0x5e0e2b,_0x497a5b,_0x188d39){return db[_0xeb03('0x82')]['findAll']({'where':{'id':_0x5e0e2b[_0xeb03('0x3b')]['ids']},'attributes':['id'],'include':[{'model':db[_0xeb03('0x81')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xeb03('0x2d')](handleEntityNotFound(_0x497a5b,null))[_0xeb03('0x2d')](function(_0xd6f37b){var _0x1522d4=_[_0xeb03('0x3a')](_0xd6f37b,'id');var _0x47b648=[];var _0x15a726=[];var _0x226569=squel[_0xeb03('0x8e')]();_0x226569[_0xeb03('0x8f')](_0xeb03('0x90'))[_0xeb03('0x91')](_0xeb03('0x92'),'tq')[_0xeb03('0x93')](_0xeb03('0x94'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where']('VoicePrefixId\x20=\x20?',_0x5e0e2b[_0xeb03('0x54')]['id']);for(var _0x40a6ce=0x0;_0x40a6ce<_0xd6f37b[_0xeb03('0x3f')];_0x40a6ce+=0x1){let _0x2f640d=_0xd6f37b[_0x40a6ce];for(var _0x546ebe=0x0;_0x546ebe<_0x2f640d['Agents']['length'];_0x546ebe+=0x1){let _0x3d861f=_0x2f640d[_0xeb03('0x85')][_0x546ebe];var _0x2c89c4=_0x226569[_0xeb03('0x95')]();_0x2c89c4[_0xeb03('0x44')]('ut.UserId\x20=\x20?',_0x3d861f['id']);_0x15a726[_0xeb03('0x6d')](db[_0xeb03('0x57')]['query'](_0x2c89c4[_0xeb03('0x96')](),{'type':db['sequelize']['QueryTypes'][_0xeb03('0x97')]})[_0xeb03('0x2d')](function(_0x123742){if(_0x123742['length']===0x1){return _0x3d861f['id'];}else{var _0x243689=_[_0xeb03('0x98')](_['map'](_0x123742,_0xeb03('0x99')),function(_0x5eb15a){return _['includes'](_0x1522d4,_0x5eb15a);});if(_0x243689){return _0x3d861f['id'];}}}));}}return BPromise[_0xeb03('0x9a')](_0x15a726)[_0xeb03('0x2d')](function(_0x366054){_0x47b648=_(_0x47b648)[_0xeb03('0x9b')](_0x366054)[_0xeb03('0x9c')]()[_0xeb03('0x9d')]();return db['VoicePrefix'][_0xeb03('0x53')]({'where':{'id':_0x5e0e2b[_0xeb03('0x54')]['id']}})[_0xeb03('0x2d')](function(_0x1f0387){return db[_0xeb03('0x57')][_0xeb03('0x58')](function(_0xf0d912){return _0x1f0387[_0xeb03('0x8d')](_0x5e0e2b[_0xeb03('0x3b')][_0xeb03('0x78')],{'transaction':_0xf0d912})[_0xeb03('0x2d')](function(){if(!_[_0xeb03('0x9e')](_0x47b648)){return _0x1f0387[_0xeb03('0x7c')](_0x47b648,{'transaction':_0xf0d912});}})[_0xeb03('0x2d')](function(){_0x47b648[_0xeb03('0x8c')](function(_0x1a0bb5){socket[_0xeb03('0x7a')](_0xeb03('0x7e'),{'UserId':_0x1a0bb5,'VoicePrefixId':_0x1f0387['id']});});});});});});})[_0xeb03('0x2d')](respondWithStatusCode(_0x497a5b,null))[_0xeb03('0x4f')](handleError(_0x497a5b,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 4cf16fd..b10a425 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 _0x4c79=['save','update','remove','emit','hook','exports','events','../../mysqldb','VoicePrefix','setMaxListeners'];(function(_0x31cb5f,_0x2df766){var _0x586042=function(_0x53c807){while(--_0x53c807){_0x31cb5f['push'](_0x31cb5f['shift']());}};_0x586042(++_0x2df766);}(_0x4c79,0xc4));var _0x94c7=function(_0x37a3e0,_0x216b86){_0x37a3e0=_0x37a3e0-0x0;var _0x30ce1d=_0x4c79[_0x37a3e0];return _0x30ce1d;};'use strict';var EventEmitter=require(_0x94c7('0x0'));var VoicePrefix=require(_0x94c7('0x1'))['db'][_0x94c7('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x94c7('0x3')](0x0);var events={'afterCreate':_0x94c7('0x4'),'afterUpdate':_0x94c7('0x5'),'afterDestroy':_0x94c7('0x6')};function emitEvent(_0x3da903){return function(_0x36ba31,_0x5c0443,_0x5656dc){VoicePrefixEvents['emit'](_0x3da903+':'+_0x36ba31['id'],_0x36ba31);VoicePrefixEvents[_0x94c7('0x7')](_0x3da903,_0x36ba31);_0x5656dc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix[_0x94c7('0x8')](e,emitEvent(event));}}module[_0x94c7('0x9')]=VoicePrefixEvents; \ No newline at end of file +var _0x21a1=['hook','exports','events','../../mysqldb','VoicePrefix','update','emit','hasOwnProperty'];(function(_0x206210,_0x48193b){var _0x3aab18=function(_0x21207a){while(--_0x21207a){_0x206210['push'](_0x206210['shift']());}};_0x3aab18(++_0x48193b);}(_0x21a1,0xaa));var _0x121a=function(_0x384171,_0x65c8e2){_0x384171=_0x384171-0x0;var _0x5be6fb=_0x21a1[_0x384171];return _0x5be6fb;};'use strict';var EventEmitter=require(_0x121a('0x0'));var VoicePrefix=require(_0x121a('0x1'))['db'][_0x121a('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x121a('0x3'),'afterDestroy':'remove'};function emitEvent(_0x5609f5){return function(_0x578b0b,_0x33ec04,_0x1f9371){VoicePrefixEvents[_0x121a('0x4')](_0x5609f5+':'+_0x578b0b['id'],_0x578b0b);VoicePrefixEvents[_0x121a('0x4')](_0x5609f5,_0x578b0b);_0x1f9371(null);};}for(var e in events){if(events[_0x121a('0x5')](e)){var event=events[e];VoicePrefix[_0x121a('0x6')](e,emitEvent(event));}}module[_0x121a('0x7')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index e9bcfe0..0f31201 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 _0x421f=['path','rimraf','../../config/environment','./voicePrefix.attributes','exports','define','VoicePrefix','voice_prefixes','lodash','util','api','moment','bluebird','request-promise'];(function(_0x2aee14,_0x974b63){var _0xd65548=function(_0x56700b){while(--_0x56700b){_0x2aee14['push'](_0x2aee14['shift']());}};_0xd65548(++_0x974b63);}(_0x421f,0x94));var _0xf421=function(_0x2cf818,_0x1cd613){_0x2cf818=_0x2cf818-0x0;var _0x4c1fc7=_0x421f[_0x2cf818];return _0x4c1fc7;};'use strict';var _=require(_0xf421('0x0'));var util=require(_0xf421('0x1'));var logger=require('../../config/logger')(_0xf421('0x2'));var moment=require(_0xf421('0x3'));var BPromise=require(_0xf421('0x4'));var rp=require(_0xf421('0x5'));var fs=require('fs');var path=require(_0xf421('0x6'));var rimraf=require(_0xf421('0x7'));var config=require(_0xf421('0x8'));var attributes=require(_0xf421('0x9'));module[_0xf421('0xa')]=function(_0xc528b0,_0x4df4d9){return _0xc528b0[_0xf421('0xb')](_0xf421('0xc'),attributes,{'tableName':_0xf421('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1ab2=['define','voice_prefixes','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voicePrefix.attributes','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1ab2,0x1a2));var _0x21ab=function(_0x4a7561,_0x30d92c){_0x4a7561=_0x4a7561-0x0;var _0x4babcc=_0x1ab2[_0x4a7561];return _0x4babcc;};'use strict';var _=require(_0x21ab('0x0'));var util=require(_0x21ab('0x1'));var logger=require(_0x21ab('0x2'))(_0x21ab('0x3'));var moment=require(_0x21ab('0x4'));var BPromise=require('bluebird');var rp=require(_0x21ab('0x5'));var fs=require('fs');var path=require(_0x21ab('0x6'));var rimraf=require(_0x21ab('0x7'));var config=require(_0x21ab('0x8'));var attributes=require(_0x21ab('0x9'));module[_0x21ab('0xa')]=function(_0x210b24,_0x885ab6){return _0x210b24[_0x21ab('0xb')]('VoicePrefix',attributes,{'tableName':_0x21ab('0xc'),'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 844f66e..9b090c5 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 _0x323f=['register','request','then','info','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','VoicePrefix,\x20%s,\x20%s','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket'];(function(_0x2e9a1b,_0x242835){var _0xc04b3b=function(_0x2dcabe){while(--_0x2dcabe){_0x2e9a1b['push'](_0x2e9a1b['shift']());}};_0xc04b3b(++_0x242835);}(_0x323f,0x1ee));var _0xf323=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x323f[_0xa1e3e3];return _0xc980e9;};'use strict';var _=require('lodash');var util=require(_0xf323('0x0'));var moment=require('moment');var BPromise=require(_0xf323('0x1'));var rs=require(_0xf323('0x2'));var fs=require('fs');var Redis=require(_0xf323('0x3'));var db=require(_0xf323('0x4'))['db'];var utils=require(_0xf323('0x5'));var logger=require(_0xf323('0x6'))(_0xf323('0x7'));var config=require(_0xf323('0x8'));var jayson=require(_0xf323('0x9'));var client=jayson[_0xf323('0xa')]['http']({'port':0x232a});config[_0xf323('0xb')]=_[_0xf323('0xc')](config[_0xf323('0xb')],{'host':_0xf323('0xd'),'port':0x18eb});var socket=require(_0xf323('0xe'))(new Redis(config[_0xf323('0xb')]));require(_0xf323('0xf'))[_0xf323('0x10')](socket);function respondWithRpcPromise(_0x10d1ff,_0x21e82e,_0x22fd48){return new BPromise(function(_0x4196b5,_0x8825ef){return client[_0xf323('0x11')](_0x10d1ff,_0x22fd48)[_0xf323('0x12')](function(_0xb6ec37){logger[_0xf323('0x13')]('VoicePrefix,\x20%s,\x20%s',_0x21e82e,_0xf323('0x14'));logger[_0xf323('0x15')](_0xf323('0x16'),_0x21e82e,'request\x20sent',JSON[_0xf323('0x17')](_0xb6ec37));if(_0xb6ec37[_0xf323('0x18')]){if(_0xb6ec37[_0xf323('0x18')][_0xf323('0x19')]===0x1f4){logger[_0xf323('0x18')](_0xf323('0x1a'),_0x21e82e,_0xb6ec37['error']['message']);return _0x8825ef(_0xb6ec37[_0xf323('0x18')][_0xf323('0x1b')]);}logger[_0xf323('0x18')](_0xf323('0x1a'),_0x21e82e,_0xb6ec37[_0xf323('0x18')]['message']);return _0x4196b5(_0xb6ec37[_0xf323('0x18')][_0xf323('0x1b')]);}else{logger[_0xf323('0x13')](_0xf323('0x1a'),_0x21e82e,'request\x20sent');_0x4196b5(_0xb6ec37[_0xf323('0x1c')][_0xf323('0x1b')]);}})[_0xf323('0x1d')](function(_0x41b2cb){logger['error'](_0xf323('0x1a'),_0x21e82e,_0x41b2cb);_0x8825ef(_0x41b2cb);});});} \ No newline at end of file +var _0x82f8=['../../config/environment','jayson/promise','redis','defaults','localhost','register','request','then','info','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoicePrefix,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x5d31f3,_0x4239b0){var _0x1cc88c=function(_0x1be8fc){while(--_0x1be8fc){_0x5d31f3['push'](_0x5d31f3['shift']());}};_0x1cc88c(++_0x4239b0);}(_0x82f8,0x157));var _0x882f=function(_0x2915d1,_0x54c2df){_0x2915d1=_0x2915d1-0x0;var _0x479be9=_0x82f8[_0x2915d1];return _0x479be9;};'use strict';var _=require('lodash');var util=require(_0x882f('0x0'));var moment=require(_0x882f('0x1'));var BPromise=require('bluebird');var rs=require(_0x882f('0x2'));var fs=require('fs');var Redis=require(_0x882f('0x3'));var db=require(_0x882f('0x4'))['db'];var utils=require(_0x882f('0x5'));var logger=require(_0x882f('0x6'))(_0x882f('0x7'));var config=require(_0x882f('0x8'));var jayson=require(_0x882f('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x882f('0xa')]=_[_0x882f('0xb')](config[_0x882f('0xa')],{'host':_0x882f('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x882f('0xa')]));require('./voicePrefix.socket')[_0x882f('0xd')](socket);function respondWithRpcPromise(_0x478c18,_0x3ead6e,_0x5e9b49){return new BPromise(function(_0x499654,_0x14d89b){return client[_0x882f('0xe')](_0x478c18,_0x5e9b49)[_0x882f('0xf')](function(_0x2f2e51){logger[_0x882f('0x10')]('VoicePrefix,\x20%s,\x20%s',_0x3ead6e,'request\x20sent');logger[_0x882f('0x11')](_0x882f('0x12'),_0x3ead6e,_0x882f('0x13'),JSON[_0x882f('0x14')](_0x2f2e51));if(_0x2f2e51[_0x882f('0x15')]){if(_0x2f2e51[_0x882f('0x15')][_0x882f('0x16')]===0x1f4){logger['error'](_0x882f('0x17'),_0x3ead6e,_0x2f2e51[_0x882f('0x15')][_0x882f('0x18')]);return _0x14d89b(_0x2f2e51[_0x882f('0x15')]['message']);}logger['error']('VoicePrefix,\x20%s,\x20%s',_0x3ead6e,_0x2f2e51[_0x882f('0x15')][_0x882f('0x18')]);return _0x499654(_0x2f2e51[_0x882f('0x15')][_0x882f('0x18')]);}else{logger[_0x882f('0x10')](_0x882f('0x17'),_0x3ead6e,_0x882f('0x13'));_0x499654(_0x2f2e51[_0x882f('0x19')]['message']);}})[_0x882f('0x1a')](function(_0x51e74f){logger['error'](_0x882f('0x17'),_0x3ead6e,_0x51e74f);_0x14d89b(_0x51e74f);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 9707d4a..95a667f 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 _0xbf1a=['remove','update','removeListener','length','voicePrefix:','./voicePrefix.events','save'];(function(_0x4f1d64,_0x41b65c){var _0x5597c2=function(_0x120285){while(--_0x120285){_0x4f1d64['push'](_0x4f1d64['shift']());}};_0x5597c2(++_0x41b65c);}(_0xbf1a,0x7c));var _0xabf1=function(_0x191c45,_0x28f826){_0x191c45=_0x191c45-0x0;var _0x189f39=_0xbf1a[_0x191c45];return _0x189f39;};'use strict';var VoicePrefixEvents=require(_0xabf1('0x0'));var events=[_0xabf1('0x1'),_0xabf1('0x2'),_0xabf1('0x3')];function createListener(_0x690e59,_0x567007){return function(_0x132189){_0x567007['emit'](_0x690e59,_0x132189);};}function removeListener(_0x1b5f1a,_0x288b6c){return function(){VoicePrefixEvents[_0xabf1('0x4')](_0x1b5f1a,_0x288b6c);};}exports['register']=function(_0x5a477e){for(var _0x2a4ebd=0x0,_0x4f5b53=events[_0xabf1('0x5')];_0x2a4ebd<_0x4f5b53;_0x2a4ebd++){var _0x1cc1f6=events[_0x2a4ebd];var _0x1f48f5=createListener(_0xabf1('0x6')+_0x1cc1f6,_0x5a477e);VoicePrefixEvents['on'](_0x1cc1f6,_0x1f48f5);}}; \ No newline at end of file +var _0xa7b5=['length','voicePrefix:','./voicePrefix.events','save','remove','update','emit','register'];(function(_0x3b37cd,_0x2628db){var _0x26cda3=function(_0x11df96){while(--_0x11df96){_0x3b37cd['push'](_0x3b37cd['shift']());}};_0x26cda3(++_0x2628db);}(_0xa7b5,0x162));var _0x5a7b=function(_0x240cf7,_0x2fa316){_0x240cf7=_0x240cf7-0x0;var _0x5c0fb8=_0xa7b5[_0x240cf7];return _0x5c0fb8;};'use strict';var VoicePrefixEvents=require(_0x5a7b('0x0'));var events=[_0x5a7b('0x1'),_0x5a7b('0x2'),_0x5a7b('0x3')];function createListener(_0x2ca65f,_0x5026f5){return function(_0x1a25e1){_0x5026f5[_0x5a7b('0x4')](_0x2ca65f,_0x1a25e1);};}function removeListener(_0x13085a,_0x56b82d){return function(){VoicePrefixEvents['removeListener'](_0x13085a,_0x56b82d);};}exports[_0x5a7b('0x5')]=function(_0x204212){for(var _0x4899da=0x0,_0x38dac6=events[_0x5a7b('0x6')];_0x4899da<_0x38dac6;_0x4899da++){var _0x390a68=events[_0x4899da];var _0x265597=createListener(_0x5a7b('0x7')+_0x390a68,_0x204212);VoicePrefixEvents['on'](_0x390a68,_0x265597);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 5b8cb59..2e05bfa 100644 --- a/server/api/voiceQueue/index.js +++ b/server/api/voiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0x43151a,_0x268542){var _0x4b4a88=function(_0x3c865e){while(--_0x3c865e){_0x43151a['push'](_0x43151a['shift']());}};_0x4b4a88(++_0x268542);}(_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/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file +var _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0x5db09b,_0x5b6402){var _0x4c98f3=function(_0x1154e5){while(--_0x1154e5){_0x5db09b['push'](_0x5db09b['shift']());}};_0x4c98f3(++_0x5b6402);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index ac09c69..4d40bd8 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 _0x3343=['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)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','#AMD\x20Greeting','#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)','Active/Disactive\x20Recall\x20In\x20Queue','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDisposition','sequelize','exports','STRING','ENUM','outbound','inbound','default','fewestcalls','rrmemory','linear','wrandom','rrordered','ringall','setDataValue','strategy','getDataValue','type','dialMethod','preview','booked','roundrobin','includes','INTEGER','yes','all','once','TEXT','join','periodic_announce','split','joinempty','leavewhenempty','BOOLEAN','wrapuptime'];(function(_0x52d193,_0x5e95f7){var _0x1a53ff=function(_0x2fa5e2){while(--_0x2fa5e2){_0x52d193['push'](_0x52d193['shift']());}};_0x1a53ff(++_0x5e95f7);}(_0x3343,0x80));var _0x3334=function(_0x1b640f,_0x215390){_0x1b640f=_0x1b640f-0x0;var _0x560770=_0x3343[_0x1b640f];return _0x560770;};'use strict';var Sequelize=require(_0x3334('0x0'));module[_0x3334('0x1')]={'name':{'type':Sequelize[_0x3334('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x3334('0x3')]('inbound',_0x3334('0x4')),'allowNull':![],'defaultValue':_0x3334('0x5')},'musiconhold':{'type':Sequelize[_0x3334('0x2')],'defaultValue':_0x3334('0x6')},'announce':{'type':Sequelize[_0x3334('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x3334('0x3')]('rr','ringall','leastrecent',_0x3334('0x7'),'random',_0x3334('0x8'),_0x3334('0x9'),_0x3334('0xa'),_0x3334('0xb')),'allowNull':![],'defaultValue':_0x3334('0xc'),'set':function(_0x4919bb){this[_0x3334('0xd')](_0x3334('0xe'),_0x4919bb?_0x4919bb:_0x3334('0x8'));},'get':function(){var _0x223a76=this[_0x3334('0xf')](_0x3334('0x10'));var _0x38d317=this['getDataValue'](_0x3334('0x11'));var _0xfb6628=this[_0x3334('0xf')](_0x3334('0xe'));if(_0x223a76===_0x3334('0x4')){if(_0x38d317===_0x3334('0x12')){return null;}if(_0x38d317===_0x3334('0x13')&&!['rrmemory',_0x3334('0x14')][_0x3334('0x15')](_0xfb6628)){this['setDataValue'](_0x3334('0xe'),_0x3334('0x8'));}}return _0xfb6628;}},'servicelevel':{'type':Sequelize[_0x3334('0x16')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x3334('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x3334('0x16')](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x3334('0x16')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x3334('0x2')]},'weight':{'type':Sequelize[_0x3334('0x16')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x3334('0x3')](_0x3334('0x17'),'no'),'defaultValue':'yes'},'autopause':{'type':Sequelize['ENUM'](_0x3334('0x17'),'no',_0x3334('0x18')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x3334('0x16')](0xb)},'autopausebusy':{'type':Sequelize[_0x3334('0x3')]('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x3334('0x3')](_0x3334('0x17'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x3334('0x16')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x3334('0x3')](_0x3334('0x17'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x3334('0x3')]('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x3334('0x3')](_0x3334('0x17'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM'](_0x3334('0x17'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x3334('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x3334('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x3334('0x16')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x3334('0x16')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x3334('0x16')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x3334('0x3')](_0x3334('0x17'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0x3334('0x17'),'no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize[_0x3334('0x3')](_0x3334('0x17'),'no',_0x3334('0x19')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x3334('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM'](_0x3334('0x17'),'no')},'announce_position_limit':{'type':Sequelize[_0x3334('0x16')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x3334('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x3334('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize[_0x3334('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x3334('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x3334('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x3334('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x3334('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x3334('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x3334('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0x3334('0x2')]},'queue_quantity2':{'type':Sequelize[_0x3334('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x3334('0x2')]},'queue_less_than':{'type':Sequelize[_0x3334('0x2')]},'periodic_announce':{'type':Sequelize[_0x3334('0x1a')],'set':function(_0x1be256){this[_0x3334('0xd')]('periodic_announce',_0x1be256?_0x1be256[_0x3334('0x1b')](','):[]);},'get':function(){return this[_0x3334('0xf')](_0x3334('0x1c'))?this[_0x3334('0xf')](_0x3334('0x1c'))[_0x3334('0x1d')](','):[];}},'joinempty':{'type':Sequelize[_0x3334('0x2')],'defaultValue':_0x3334('0x17'),'set':function(_0x9a3a1b){this['setDataValue'](_0x3334('0x1e'),_0x9a3a1b?_0x9a3a1b['join'](','):undefined);},'get':function(){return this['getDataValue'](_0x3334('0x1e'))?this['getDataValue'](_0x3334('0x1e'))['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x3334('0x2')],'defaultValue':'no','set':function(_0x2b9227){this[_0x3334('0xd')]('leavewhenempty',_0x2b9227?_0x2b9227['join'](','):undefined);},'get':function(){return this[_0x3334('0xf')](_0x3334('0x1f'))?this[_0x3334('0xf')](_0x3334('0x1f'))[_0x3334('0x1d')](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM'](_0x3334('0x17'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0x3334('0x17'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x3334('0x16')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x3334('0x3')]('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x3334('0x2')]},'description':{'type':Sequelize[_0x3334('0x2')]},'acw':{'type':Sequelize[_0x3334('0x20')],'defaultValue':0x0,'set':function(_0x4eaf69){this[_0x3334('0xd')]('acw',_0x4eaf69);if(_0x4eaf69){if(this['getDataValue'](_0x3334('0x21'))<0x2){this['setDataValue'](_0x3334('0x21'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x3334('0x16')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x3334('0x20')],'defaultValue':0x0,'comment':_0x3334('0x22')},'dialMethod':{'type':Sequelize[_0x3334('0x3')](_0x3334('0x12'),_0x3334('0x23'),_0x3334('0x24'),_0x3334('0x25'),_0x3334('0x13')),'defaultValue':_0x3334('0x23'),'comment':_0x3334('0x26')},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)[_0x3334('0x27')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x3334('0x28')},'dialLimitQueue':{'type':Sequelize[_0x3334('0x16')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x3334('0x29')},'dialPowerLevel':{'type':Sequelize[_0x3334('0x2a')](0x2)[_0x3334('0x27')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x3334('0x2b')},'dialPredictiveOptimization':{'type':Sequelize[_0x3334('0x3')](_0x3334('0x2c'),_0x3334('0x2d')),'defaultValue':'dropRate','comment':_0x3334('0x2e')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x3334('0x2a')](0x2)[_0x3334('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x3334('0x2f')},'dialPredictiveInterval':{'type':Sequelize[_0x3334('0x16')](0x3)[_0x3334('0x27')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x3334('0x30')},'dialOriginateCallerIdName':{'type':Sequelize[_0x3334('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x3334('0x2')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3334('0x31')},'dialQueueOptions':{'type':Sequelize[_0x3334('0x2')],'defaultValue':_0x3334('0x32'),'comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize[_0x3334('0x16')](0x3)[_0x3334('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3334('0x33')},'dialQueueProject':{'type':Sequelize['STRING'],'comment':_0x3334('0x34')},'dialCongestionMaxRetry':{'type':Sequelize[_0x3334('0x16')](0x3)[_0x3334('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3334('0x35')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3334('0x36')},'dialBusyMaxRetry':{'type':Sequelize[_0x3334('0x16')](0x3)[_0x3334('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3334('0x37')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x3334('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x3334('0x27')],'defaultValue':0x3,'comment':_0x3334('0x38')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x3334('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3334('0x39')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x3334('0x3a')},'dialTimezone':{'type':Sequelize[_0x3334('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0x3334('0x3b')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x3334('0x3')]('always','never','onlyIfOpen'),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x3334('0x27')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x3334('0x16')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x3334('0x3c')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x3334('0x16')](0x9)[_0x3334('0x27')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x3334('0x27')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x3334('0x3d')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x3334('0x27')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x3334('0x3e')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x3334('0x16')](0x9)[_0x3334('0x27')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x3334('0x3f')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x3334('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x3334('0x40')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x3334('0x16')](0x9)[_0x3334('0x27')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x3334('0x41')},'dialRecallMeTimeout':{'type':Sequelize[_0x3334('0x16')](0x5)[_0x3334('0x27')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x3334('0x42')},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x3334('0x43')},'dialOrderByScheduledAt':{'type':Sequelize[_0x3334('0x3')]('DESC',_0x3334('0x44')),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize[_0x3334('0x2')],'comment':_0x3334('0x34')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x3334('0x20')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x3334('0x16')](0x3)[_0x3334('0x27')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x3334('0x45')},'dialCutDigit':{'type':Sequelize[_0x3334('0x16')](0x3)[_0x3334('0x27')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x3334('0x46')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x3334('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3334('0x47')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x3334('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3334('0x48')},'dialDropMaxRetry':{'type':Sequelize[_0x3334('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3334('0x49')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x3334('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3334('0x4a')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x3334('0x16')](0x3)[_0x3334('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3334('0x4b')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x3334('0x16')](0x3)[_0x3334('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3334('0x4c')},'dialMachineRetryFrequency':{'type':Sequelize[_0x3334('0x16')](0x5)[_0x3334('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3334('0x4d')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x3334('0x16')](0x3)[_0x3334('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3334('0x4e')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x3334('0x16')](0x5)[_0x3334('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0x3334('0x16')],'allowNull':!![],'comment':_0x3334('0x4f')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x3dc2f){if(!_0x3dc2f)this[_0x3334('0xd')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0x3334('0x50'),_0x3dc2f);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x3334('0x16')](0x3)[_0x3334('0x27')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x3334('0x16')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x3334('0x20')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x3334('0x16')](0x3)[_0x3334('0x27')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x3334('0x20')],'defaultValue':![]}}; \ No newline at end of file +var _0x0d68=['Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','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)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM','inbound','outbound','ringall','fewestcalls','random','linear','rrordered','strategy','rrmemory','getDataValue','type','dialMethod','booked','roundrobin','includes','setDataValue','INTEGER','yes','all','once','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','acw','wrapuptime','Active/Disactive\x20Campaign','preview','progressive','power','predictive','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\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)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','never','always','BOOLEAN','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)'];(function(_0x24c154,_0x7089f5){var _0x4fc16e=function(_0x5b1d99){while(--_0x5b1d99){_0x24c154['push'](_0x24c154['shift']());}};_0x4fc16e(++_0x7089f5);}(_0x0d68,0x1ac));var _0x80d6=function(_0x1896c9,_0x3a2d8a){_0x1896c9=_0x1896c9-0x0;var _0x212e66=_0x0d68[_0x1896c9];return _0x212e66;};'use strict';var Sequelize=require(_0x80d6('0x0'));module[_0x80d6('0x1')]={'name':{'type':Sequelize[_0x80d6('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x80d6('0x3')](_0x80d6('0x4'),_0x80d6('0x5')),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize[_0x80d6('0x2')],'defaultValue':'default'},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize[_0x80d6('0x3')]('rr',_0x80d6('0x6'),'leastrecent',_0x80d6('0x7'),_0x80d6('0x8'),'rrmemory',_0x80d6('0x9'),'wrandom',_0x80d6('0xa')),'allowNull':![],'defaultValue':_0x80d6('0x6'),'set':function(_0x2e42f7){this['setDataValue'](_0x80d6('0xb'),_0x2e42f7?_0x2e42f7:_0x80d6('0xc'));},'get':function(){var _0x40188a=this[_0x80d6('0xd')](_0x80d6('0xe'));var _0x5460b6=this['getDataValue'](_0x80d6('0xf'));var _0x7e121f=this[_0x80d6('0xd')](_0x80d6('0xb'));if(_0x40188a===_0x80d6('0x5')){if(_0x5460b6==='preview'){return null;}if(_0x5460b6===_0x80d6('0x10')&&![_0x80d6('0xc'),_0x80d6('0x11')][_0x80d6('0x12')](_0x7e121f)){this[_0x80d6('0x13')](_0x80d6('0xb'),_0x80d6('0xc'));}}return _0x7e121f;}},'servicelevel':{'type':Sequelize[_0x80d6('0x14')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x80d6('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x80d6('0x14')](0xb)},'timeout':{'type':Sequelize[_0x80d6('0x14')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x80d6('0x14')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x80d6('0x2')]},'weight':{'type':Sequelize[_0x80d6('0x14')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x80d6('0x14')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x80d6('0x3')]('yes','no'),'defaultValue':_0x80d6('0x15')},'autopause':{'type':Sequelize[_0x80d6('0x3')](_0x80d6('0x15'),'no',_0x80d6('0x16')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x80d6('0x14')](0xb)},'autopausebusy':{'type':Sequelize['ENUM'](_0x80d6('0x15'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x80d6('0x3')](_0x80d6('0x15'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x80d6('0x14')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x80d6('0x3')](_0x80d6('0x15'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x80d6('0x3')]('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x80d6('0x3')](_0x80d6('0x15'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x80d6('0x3')](_0x80d6('0x15'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x80d6('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x80d6('0x14')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x80d6('0x14')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM'](_0x80d6('0x15'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x80d6('0x3')]('yes','no'),'defaultValue':_0x80d6('0x15')},'announce_holdtime':{'type':Sequelize['ENUM'](_0x80d6('0x15'),'no',_0x80d6('0x17')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x80d6('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x80d6('0x3')](_0x80d6('0x15'),'no')},'announce_position_limit':{'type':Sequelize[_0x80d6('0x14')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x80d6('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x80d6('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x80d6('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x80d6('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x80d6('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x80d6('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x80d6('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0x80d6('0x2')]},'queue_quantity2':{'type':Sequelize[_0x80d6('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x80d6('0x2')]},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize[_0x80d6('0x18')],'set':function(_0x17aa5f){this[_0x80d6('0x13')](_0x80d6('0x19'),_0x17aa5f?_0x17aa5f[_0x80d6('0x1a')](','):[]);},'get':function(){return this[_0x80d6('0xd')]('periodic_announce')?this[_0x80d6('0xd')](_0x80d6('0x19'))[_0x80d6('0x1b')](','):[];}},'joinempty':{'type':Sequelize[_0x80d6('0x2')],'defaultValue':_0x80d6('0x15'),'set':function(_0x4421b9){this['setDataValue'](_0x80d6('0x1c'),_0x4421b9?_0x4421b9['join'](','):undefined);},'get':function(){return this[_0x80d6('0xd')](_0x80d6('0x1c'))?this[_0x80d6('0xd')]('joinempty')[_0x80d6('0x1b')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x80d6('0x2')],'defaultValue':'no','set':function(_0x1dd3d0){this[_0x80d6('0x13')](_0x80d6('0x1d'),_0x1dd3d0?_0x1dd3d0['join'](','):undefined);},'get':function(){return this['getDataValue'](_0x80d6('0x1d'))?this[_0x80d6('0xd')](_0x80d6('0x1d'))[_0x80d6('0x1b')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x80d6('0x3')](_0x80d6('0x15'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0x80d6('0x15'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x80d6('0x14')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x80d6('0x3')](_0x80d6('0x15'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x80d6('0x2')]},'description':{'type':Sequelize[_0x80d6('0x2')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x45516f){this[_0x80d6('0x13')](_0x80d6('0x1e'),_0x45516f);if(_0x45516f){if(this[_0x80d6('0xd')](_0x80d6('0x1f'))<0x2){this['setDataValue']('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize[_0x80d6('0x14')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x80d6('0x20')},'dialMethod':{'type':Sequelize[_0x80d6('0x3')](_0x80d6('0x21'),_0x80d6('0x22'),_0x80d6('0x23'),_0x80d6('0x24'),_0x80d6('0x10')),'defaultValue':_0x80d6('0x22'),'comment':_0x80d6('0x25')},'dialLimitChannel':{'type':Sequelize[_0x80d6('0x14')](0x4)[_0x80d6('0x26')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x80d6('0x27')},'dialLimitQueue':{'type':Sequelize[_0x80d6('0x14')](0x4)[_0x80d6('0x26')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.'},'dialPowerLevel':{'type':Sequelize[_0x80d6('0x28')](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x80d6('0x29')},'dialPredictiveOptimization':{'type':Sequelize['ENUM'](_0x80d6('0x2a'),_0x80d6('0x2b')),'defaultValue':'dropRate','comment':_0x80d6('0x2c')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x80d6('0x28')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x80d6('0x2d')},'dialPredictiveInterval':{'type':Sequelize[_0x80d6('0x14')](0x3)[_0x80d6('0x26')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x80d6('0x2e')},'dialOriginateCallerIdName':{'type':Sequelize[_0x80d6('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x80d6('0x14')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x80d6('0x2f')},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':'tTxX','comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize[_0x80d6('0x14')](0x3)[_0x80d6('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize['STRING'],'comment':_0x80d6('0x30')},'dialCongestionMaxRetry':{'type':Sequelize[_0x80d6('0x14')](0x3)[_0x80d6('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x80d6('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x80d6('0x31')},'dialBusyMaxRetry':{'type':Sequelize[_0x80d6('0x14')](0x3)[_0x80d6('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x80d6('0x32')},'dialBusyRetryFrequency':{'type':Sequelize[_0x80d6('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x80d6('0x33')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x80d6('0x14')](0x3)[_0x80d6('0x26')],'defaultValue':0x3,'comment':_0x80d6('0x34')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x80d6('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x80d6('0x14')](0x3)[_0x80d6('0x26')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x80d6('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x80d6('0x2')],'defaultValue':_0x80d6('0x35')},'dialPrefix':{'type':Sequelize[_0x80d6('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x80d6('0x3')]('always',_0x80d6('0x36'),'onlyIfOpen'),'defaultValue':_0x80d6('0x37')},'dialAMDActive':{'type':Sequelize[_0x80d6('0x38')],'defaultValue':0x0,'comment':_0x80d6('0x39')},'dialAMDInitialSilence':{'type':Sequelize[_0x80d6('0x14')](0x9)[_0x80d6('0x26')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x80d6('0x3a')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x80d6('0x26')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x80d6('0x3b')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x80d6('0x14')](0x9)[_0x80d6('0x26')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x80d6('0x3c')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x80d6('0x14')](0x9)[_0x80d6('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x80d6('0x14')](0x9)[_0x80d6('0x26')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x80d6('0x3d')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x80d6('0x14')](0x9)[_0x80d6('0x26')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x80d6('0x14')](0x9)[_0x80d6('0x26')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x80d6('0x3e')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x80d6('0x3f')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x80d6('0x14')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x80d6('0x40')},'dialRecallMeTimeout':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x80d6('0x41')},'dialRecallInQueue':{'type':Sequelize[_0x80d6('0x38')],'defaultValue':0x0,'comment':_0x80d6('0x42')},'dialOrderByScheduledAt':{'type':Sequelize[_0x80d6('0x3')](_0x80d6('0x43'),_0x80d6('0x44')),'defaultValue':_0x80d6('0x43')},'dialQueueProject2':{'type':Sequelize['STRING'],'comment':_0x80d6('0x30')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x80d6('0x38')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x80d6('0x38')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x80d6('0x14')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x80d6('0x45')},'dialCutDigit':{'type':Sequelize[_0x80d6('0x14')](0x3)[_0x80d6('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x80d6('0x46')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x80d6('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x80d6('0x47')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x80d6('0x48')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x80d6('0x49')},'dialDropRetryFrequency':{'type':Sequelize[_0x80d6('0x14')](0x5)[_0x80d6('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x80d6('0x4a')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x80d6('0x14')](0x3)[_0x80d6('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x80d6('0x4b')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x80d6('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x80d6('0x4c')},'dialMachineMaxRetry':{'type':Sequelize[_0x80d6('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x80d6('0x4d')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x80d6('0x4e')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x80d6('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x80d6('0x14')](0x5)[_0x80d6('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':_0x80d6('0x4f')},'mandatoryDisposition':{'type':Sequelize[_0x80d6('0x38')],'defaultValue':![],'comment':_0x80d6('0x50'),'set':function(_0x5959ec){if(!_0x5959ec)this[_0x80d6('0x13')](_0x80d6('0x51'),null);this[_0x80d6('0x13')](_0x80d6('0x52'),_0x5959ec);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x80d6('0x14')](0x3)[_0x80d6('0x26')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x80d6('0x38')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize['INTEGER'](0x3)[_0x80d6('0x26')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x80d6('0x38')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 300c508..3a72dd9 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 _0x3079=['UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','format','SIP/%s','forEach','emit','removeTeams','ids','select','field','tq.TeamId','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','userVoiceQueue:save','voicePause','isArray','getAgents','getMembers','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','phone','CmListId','ListId','cm_contacts','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','deletedAt\x20IS\x20NULL','cm_hopper_additional_phones','OrderBy','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','CmHopper','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','./voiceQueue.socket','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','get','VoiceQueues','QueueCampaigns','filter','ignore','value','type','name','UserProfileResource','end','error','stack','send','index','map','VoiceQueue','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','nolimit','where','merge','options','includeAll','findAll','rows','catch','show','params','length','include','create','user','role','inbound','find','UserProfileSection','userProfileId','clone','omit','createdAt','updatedAt','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','findOne','order','sort','VoiceQueueId','getHopperHistories','CmHopperHistory','hasOwnProperty','pick','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','addTeams','Team','User','online','interface','Agents','penalty','sequelize','transaction','each','TeamVoiceQueue'];(function(_0x2e54bc,_0x304463){var _0x95de19=function(_0x46fbac){while(--_0x46fbac){_0x2e54bc['push'](_0x2e54bc['shift']());}};_0x95de19(++_0x304463);}(_0x3079,0x110));var _0x9307=function(_0x37c7a5,_0x1c901b){_0x37c7a5=_0x37c7a5-0x0;var _0x3ecbc7=_0x3079[_0x37c7a5];return _0x3ecbc7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9307('0x0'));var zipdir=require(_0x9307('0x1'));var jsonpatch=require(_0x9307('0x2'));var rp=require(_0x9307('0x3'));var moment=require('moment');var BPromise=require(_0x9307('0x4'));var Mustache=require(_0x9307('0x5'));var util=require('util');var path=require('path');var sox=require(_0x9307('0x6'));var csv=require(_0x9307('0x7'));var ejs=require(_0x9307('0x8'));var fs=require('fs');var fs_extra=require(_0x9307('0x9'));var _=require(_0x9307('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9307('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x9307('0x7'));var querystring=require(_0x9307('0xc'));var Papa=require('papaparse');var Redis=require(_0x9307('0xd'));var authService=require(_0x9307('0xe'));var qs=require(_0x9307('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9307('0x10'))(_0x9307('0x11'));var utils=require(_0x9307('0x12'));var config=require(_0x9307('0x13'));var licenseUtil=require(_0x9307('0x14'));var db=require(_0x9307('0x15'))['db'];config['redis']=_[_0x9307('0x16')](config[_0x9307('0x17')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9307('0x17')]));require(_0x9307('0x18'))['register'](socket);function respondWithStatusCode(_0x3d9864,_0x4053e2){_0x4053e2=_0x4053e2||0xcc;return function(_0x545b0a){if(_0x545b0a){return _0x3d9864[_0x9307('0x19')](_0x4053e2);}return _0x3d9864[_0x9307('0x1a')](_0x4053e2)['end']();};}function respondWithResult(_0x3fc6fd,_0x4296e9){_0x4296e9=_0x4296e9||0xc8;return function(_0x100f15){if(_0x100f15){return _0x3fc6fd['status'](_0x4296e9)[_0x9307('0x1b')](_0x100f15);}};}function respondWithFilteredResult(_0x27682a,_0x503338){return function(_0xbba867){if(_0xbba867){var _0x3d84b0=typeof _0x503338[_0x9307('0x1c')]===_0x9307('0x1d')&&typeof _0x503338[_0x9307('0x1e')]===_0x9307('0x1d');var _0x5810d7=_0xbba867[_0x9307('0x1f')];var _0x10aa66=_0x3d84b0?0x0:_0x503338[_0x9307('0x1c')];var _0x58574e=_0x3d84b0?_0xbba867[_0x9307('0x1f')]:_0x503338[_0x9307('0x1c')]+_0x503338['limit'];var _0x307ab9;if(_0x58574e>=_0x5810d7){_0x58574e=_0x5810d7;_0x307ab9=0xc8;}else{_0x307ab9=0xce;}_0x27682a[_0x9307('0x1a')](_0x307ab9);return _0x27682a[_0x9307('0x20')](_0x9307('0x21'),_0x10aa66+'-'+_0x58574e+'/'+_0x5810d7)[_0x9307('0x1b')](_0xbba867);}return null;};}function patchUpdates(_0xf39222){return function(_0x1d671b){try{jsonpatch[_0x9307('0x22')](_0x1d671b,_0xf39222,!![]);}catch(_0x2f5f68){return BPromise[_0x9307('0x23')](_0x2f5f68);}return _0x1d671b[_0x9307('0x24')]();};}function saveUpdates(_0x5d42a0,_0x1e17c5){return function(_0x593f27){if(_0x593f27){return _0x593f27[_0x9307('0x25')](_0x5d42a0)['then'](function(_0x2c59ef){return _0x2c59ef;});}return null;};}function removeEntity(_0x5bb98a,_0x4d1a13){return function(_0x428043){if(_0x428043){return _0x428043[_0x9307('0x26')]()[_0x9307('0x27')](function(){var _0x330d48=_0x428043[_0x9307('0x28')]({'plain':!![]});var _0xd89e2f=[{'name':_0x9307('0x29'),'value':'inbound','ignore':![]},{'name':_0x9307('0x2a'),'value':'outbound','ignore':![]}];var _0x1da3e3=_(_0xd89e2f)[_0x9307('0x2b')](_0x9307('0x2c'))['map'](_0x9307('0x2d'))['value']();if(_['includes'](_0x1da3e3,_0x330d48['type'])){return;}var _0x27faa5=_['find'](_0xd89e2f,[_0x9307('0x2d'),_0x330d48[_0x9307('0x2e')]])[_0x9307('0x2f')];return db[_0x9307('0x30')][_0x9307('0x26')]({'where':{'type':_0x27faa5,'resourceId':_0x330d48['id']}})[_0x9307('0x27')](function(){return _0x428043;});})['then'](function(){_0x5bb98a[_0x9307('0x1a')](0xcc)[_0x9307('0x31')]();});}};}function handleEntityNotFound(_0x824001,_0x1f5ee1){return function(_0x34fa73){if(!_0x34fa73){_0x824001[_0x9307('0x19')](0x194);}return _0x34fa73;};}function handleError(_0x158145,_0x54ffa7){_0x54ffa7=_0x54ffa7||0x1f4;return function(_0x5b79da){logger[_0x9307('0x32')](_0x5b79da[_0x9307('0x33')]);if(_0x5b79da[_0x9307('0x2f')]){delete _0x5b79da[_0x9307('0x2f')];}_0x158145[_0x9307('0x1a')](_0x54ffa7)[_0x9307('0x34')](_0x5b79da);};}exports[_0x9307('0x35')]=function(_0x139c45,_0x8e2cb4){var _0x33a507={},_0x4df3a6={},_0x443d35={'count':0x0,'rows':[]};var _0x42595e=_[_0x9307('0x36')](db[_0x9307('0x37')][_0x9307('0x38')],function(_0x11d342){return{'name':_0x11d342[_0x9307('0x39')],'type':_0x11d342[_0x9307('0x2e')][_0x9307('0x3a')]};});_0x4df3a6[_0x9307('0x3b')]=_[_0x9307('0x36')](_0x42595e,_0x9307('0x2f'));_0x4df3a6[_0x9307('0x3c')]=_[_0x9307('0x3d')](_0x139c45['query']);_0x4df3a6[_0x9307('0x3e')]=_[_0x9307('0x3f')](_0x4df3a6[_0x9307('0x3b')],_0x4df3a6[_0x9307('0x3c')]);_0x33a507[_0x9307('0x40')]=_[_0x9307('0x3f')](_0x4df3a6[_0x9307('0x3b')],qs[_0x9307('0x41')](_0x139c45['query'][_0x9307('0x41')]));_0x33a507[_0x9307('0x40')]=_0x33a507[_0x9307('0x40')]['length']?_0x33a507[_0x9307('0x40')]:_0x4df3a6[_0x9307('0x3b')];if(!_0x139c45[_0x9307('0x3c')]['hasOwnProperty'](_0x9307('0x42'))){_0x33a507[_0x9307('0x1e')]=qs[_0x9307('0x1e')](_0x139c45[_0x9307('0x3c')]['limit']);_0x33a507['offset']=qs[_0x9307('0x1c')](_0x139c45[_0x9307('0x3c')][_0x9307('0x1c')]);}_0x33a507['order']=qs['sort'](_0x139c45[_0x9307('0x3c')]['sort']);_0x33a507[_0x9307('0x43')]=qs[_0x9307('0x3e')](_['pick'](_0x139c45[_0x9307('0x3c')],_0x4df3a6[_0x9307('0x3e')]),_0x42595e);if(_0x139c45[_0x9307('0x3c')][_0x9307('0x2b')]){_0x33a507[_0x9307('0x43')]=_[_0x9307('0x44')](_0x33a507[_0x9307('0x43')],{'$or':_[_0x9307('0x36')](_0x42595e,function(_0x593a19){if(_0x593a19['type']!=='VIRTUAL'){var _0x274598={};_0x274598[_0x593a19[_0x9307('0x2f')]]={'$like':'%'+_0x139c45[_0x9307('0x3c')][_0x9307('0x2b')]+'%'};return _0x274598;}})});}_0x33a507=_[_0x9307('0x44')]({},_0x33a507,_0x139c45[_0x9307('0x45')]);var _0x4fadc9={'where':_0x33a507['where']};return db[_0x9307('0x37')][_0x9307('0x1f')](_0x4fadc9)['then'](function(_0x1d24d3){_0x443d35['count']=_0x1d24d3;if(_0x139c45[_0x9307('0x3c')][_0x9307('0x46')]){_0x33a507['include']=[{'all':!![]}];}return db[_0x9307('0x37')][_0x9307('0x47')](_0x33a507);})[_0x9307('0x27')](function(_0x276ed5){_0x443d35[_0x9307('0x48')]=_0x276ed5;return _0x443d35;})[_0x9307('0x27')](respondWithFilteredResult(_0x8e2cb4,_0x33a507))[_0x9307('0x49')](handleError(_0x8e2cb4,null));};exports[_0x9307('0x4a')]=function(_0x57f146,_0x3ff0a4){var _0x2d2e5b={'raw':![],'where':{'id':_0x57f146[_0x9307('0x4b')]['id']}},_0x390eef={};_0x390eef[_0x9307('0x3b')]=_['keys'](db[_0x9307('0x37')]['rawAttributes']);_0x390eef['query']=_[_0x9307('0x3d')](_0x57f146[_0x9307('0x3c')]);_0x390eef[_0x9307('0x3e')]=_[_0x9307('0x3f')](_0x390eef[_0x9307('0x3b')],_0x390eef['query']);_0x2d2e5b[_0x9307('0x40')]=_['intersection'](_0x390eef[_0x9307('0x3b')],qs[_0x9307('0x41')](_0x57f146['query']['fields']));_0x2d2e5b[_0x9307('0x40')]=_0x2d2e5b[_0x9307('0x40')][_0x9307('0x4c')]?_0x2d2e5b[_0x9307('0x40')]:_0x390eef[_0x9307('0x3b')];if(_0x57f146['query'][_0x9307('0x46')]){_0x2d2e5b[_0x9307('0x4d')]=[{'all':!![]}];}_0x2d2e5b=_[_0x9307('0x44')]({},_0x2d2e5b,_0x57f146[_0x9307('0x45')]);return db['VoiceQueue']['find'](_0x2d2e5b)['then'](handleEntityNotFound(_0x3ff0a4,null))[_0x9307('0x27')](respondWithResult(_0x3ff0a4,null))['catch'](handleError(_0x3ff0a4,null));};exports[_0x9307('0x4e')]=function(_0x5bb358,_0x6272c7){return db[_0x9307('0x37')][_0x9307('0x4e')](_0x5bb358['body'],{})[_0x9307('0x27')](function(_0x1e8e32){var _0x4db0dd=_0x5bb358[_0x9307('0x4f')][_0x9307('0x28')]({'plain':!![]});if(!_0x4db0dd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4db0dd[_0x9307('0x50')]===_0x9307('0x4f')){var _0xf75713=_0x1e8e32[_0x9307('0x28')]({'plain':!![]});var _0x1cca54=[{'name':_0x9307('0x29'),'value':_0x9307('0x51')},{'name':'QueueCampaigns','value':'outbound'}];var _0x2268d2=_[_0x9307('0x52')](_0x1cca54,[_0x9307('0x2d'),_0xf75713['type']])[_0x9307('0x2f')];return db[_0x9307('0x53')]['find']({'where':{'name':_0x2268d2,'userProfileId':_0x4db0dd[_0x9307('0x54')]},'raw':!![]})[_0x9307('0x27')](function(_0x1bb8e1){if(_0x1bb8e1&&_0x1bb8e1['autoAssociation']===0x0){return db[_0x9307('0x30')][_0x9307('0x4e')]({'name':_0xf75713['name'],'resourceId':_0xf75713['id'],'type':_0x1bb8e1[_0x9307('0x2f')],'sectionId':_0x1bb8e1['id']},{})[_0x9307('0x27')](function(){return _0x1e8e32;});}else{return _0x1e8e32;}})[_0x9307('0x49')](function(_0x49fa2b){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x49fa2b);throw _0x49fa2b;});}return _0x1e8e32;})['then'](respondWithResult(_0x6272c7,0xc9))[_0x9307('0x49')](handleError(_0x6272c7,null));};exports[_0x9307('0x55')]=function(_0x34bc1e,_0x5c4907){var _0x5ec1ac={'where':{'id':_0x34bc1e[_0x9307('0x4b')]['id']}},_0x39b01d={};_0x39b01d[_0x9307('0x3b')]=_[_0x9307('0x3d')](db[_0x9307('0x37')][_0x9307('0x38')]);_0x5ec1ac['attributes']=_[_0x9307('0x3f')](_0x39b01d[_0x9307('0x3b')],qs[_0x9307('0x41')](_0x34bc1e[_0x9307('0x3c')][_0x9307('0x41')]));_0x5ec1ac['attributes']=_0x5ec1ac[_0x9307('0x40')][_0x9307('0x4c')]?_0x5ec1ac['attributes']:_0x39b01d[_0x9307('0x3b')];if(_0x34bc1e[_0x9307('0x3c')]['includeAll']){_0x5ec1ac[_0x9307('0x4d')]=[{'all':!![]}];}_0x5ec1ac=_[_0x9307('0x44')]({},_0x5ec1ac,_0x34bc1e['options']);return db[_0x9307('0x37')][_0x9307('0x52')](_0x5ec1ac)[_0x9307('0x27')](handleEntityNotFound(_0x5c4907,null))[_0x9307('0x27')](function(_0x3a6564){if(_0x3a6564){var _0x383e4d=_0x3a6564[_0x9307('0x28')]({'plain':!![]});_0x383e4d=qs[_0x9307('0x56')](_0x383e4d,['id',_0x9307('0x57'),_0x9307('0x58')]);_0x34bc1e[_0x9307('0x59')]=_[_0x9307('0x56')](_0x34bc1e['body'],['id',_0x9307('0x57'),'updatedAt']);return db[_0x9307('0x37')][_0x9307('0x4e')](_['merge'](_0x383e4d,_0x34bc1e[_0x9307('0x59')]),{'include':_0x34bc1e[_0x9307('0x3c')]['includeAll']?[{'all':!![]}]:undefined})[_0x9307('0x27')](function(_0xf5390d){var _0xdb251b=_0x34bc1e[_0x9307('0x4f')][_0x9307('0x28')]({'plain':!![]});if(!_0xdb251b)throw new Error(_0x9307('0x5a'));if(_0xdb251b['role']===_0x9307('0x4f')){var _0x1f0936=_0xf5390d[_0x9307('0x28')]({'plain':!![]});var _0x5041d3=[{'name':_0x9307('0x29'),'value':_0x9307('0x51')},{'name':_0x9307('0x2a'),'value':'outbound'}];var _0x16a62b=_[_0x9307('0x52')](_0x5041d3,['value',_0x1f0936[_0x9307('0x2e')]])[_0x9307('0x2f')];return db[_0x9307('0x53')][_0x9307('0x52')]({'where':{'name':_0x16a62b,'userProfileId':_0xdb251b[_0x9307('0x54')]},'raw':!![]})['then'](function(_0x22fc8c){if(_0x22fc8c&&_0x22fc8c[_0x9307('0x5b')]===0x0){return db['UserProfileResource']['create']({'name':_0x1f0936[_0x9307('0x2f')],'resourceId':_0x1f0936['id'],'type':_0x22fc8c['name'],'sectionId':_0x22fc8c['id']},{})['then'](function(){return _0xf5390d;});}else{return _0xf5390d;}})[_0x9307('0x49')](function(_0x2780a2){logger[_0x9307('0x32')](_0x9307('0x5c'),_0x2780a2);throw _0x2780a2;});}return _0xf5390d;});}})['then'](respondWithResult(_0x5c4907,0xc9))[_0x9307('0x49')](handleError(_0x5c4907,null));};exports[_0x9307('0x25')]=function(_0x1da55c,_0x17e344){if(_0x1da55c['body']['id']){delete _0x1da55c[_0x9307('0x59')]['id'];}return db['VoiceQueue'][_0x9307('0x52')]({'where':{'id':_0x1da55c[_0x9307('0x4b')]['id']}})[_0x9307('0x27')](handleEntityNotFound(_0x17e344,null))['then'](saveUpdates(_0x1da55c[_0x9307('0x59')],null))[_0x9307('0x27')](respondWithResult(_0x17e344,null))['catch'](handleError(_0x17e344,null));};exports[_0x9307('0x26')]=function(_0x53d490,_0x1c1351){return db[_0x9307('0x37')][_0x9307('0x52')]({'where':{'id':_0x53d490[_0x9307('0x4b')]['id']}})[_0x9307('0x27')](handleEntityNotFound(_0x1c1351,null))['then'](removeEntity(_0x1c1351,null))[_0x9307('0x49')](handleError(_0x1c1351,null));};exports[_0x9307('0x5d')]=function(_0x36d456,_0x1224b3,_0x798430){var _0x270afc={'raw':![],'where':{}};var _0x1102c7={};var _0x340e6e={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x9307('0x5e')]({'where':{'id':_0x36d456[_0x9307('0x4b')]['id']}})[_0x9307('0x27')](handleEntityNotFound(_0x1224b3,null))[_0x9307('0x27')](function(_0x4e798d){if(_0x4e798d){_0x1102c7['model']=_[_0x9307('0x3d')](db['CmHopper']['rawAttributes']);_0x1102c7[_0x9307('0x3c')]=_[_0x9307('0x3d')](_0x36d456['query']);_0x1102c7[_0x9307('0x3e')]=_[_0x9307('0x3f')](_0x1102c7['model'],_0x1102c7['query']);_0x270afc[_0x9307('0x40')]=_[_0x9307('0x3f')](_0x1102c7[_0x9307('0x3b')],qs[_0x9307('0x41')](_0x36d456['query']['fields']));_0x270afc['attributes']=_0x270afc[_0x9307('0x40')][_0x9307('0x4c')]?_0x270afc[_0x9307('0x40')]:_0x1102c7[_0x9307('0x3b')];if(!_0x36d456[_0x9307('0x3c')]['hasOwnProperty'](_0x9307('0x42'))){_0x270afc[_0x9307('0x1e')]=qs[_0x9307('0x1e')](_0x36d456[_0x9307('0x3c')]['limit']);_0x270afc[_0x9307('0x1c')]=qs[_0x9307('0x1c')](_0x36d456[_0x9307('0x3c')][_0x9307('0x1c')]);}_0x270afc[_0x9307('0x5f')]=qs['sort'](_0x36d456[_0x9307('0x3c')][_0x9307('0x60')]);_0x270afc['where']=qs[_0x9307('0x3e')](_['pick'](_0x36d456[_0x9307('0x3c')],_0x1102c7[_0x9307('0x3e')]));_0x270afc['where'][_0x9307('0x61')]=_0x4e798d['id'];if(_0x36d456[_0x9307('0x3c')][_0x9307('0x2b')]){_0x270afc[_0x9307('0x43')]=_['merge'](_0x270afc[_0x9307('0x43')],{'$or':_[_0x9307('0x36')](_0x270afc[_0x9307('0x40')],function(_0x2abde0){var _0x3e1d15={};_0x3e1d15[_0x2abde0]={'$like':'%'+_0x36d456[_0x9307('0x3c')][_0x9307('0x2b')]+'%'};return _0x3e1d15;})});}_0x270afc=_[_0x9307('0x44')]({},_0x270afc,_0x36d456[_0x9307('0x45')]);return db['CmHopper'][_0x9307('0x1f')]({'where':_0x270afc[_0x9307('0x43')]})['then'](function(_0x1d37ac){_0x340e6e[_0x9307('0x1f')]=_0x1d37ac;if(_0x36d456[_0x9307('0x3c')][_0x9307('0x46')]){_0x270afc['include']=[{'all':!![]}];}return db['CmHopper'][_0x9307('0x47')](_0x270afc);})[_0x9307('0x27')](function(_0x456095){_0x340e6e[_0x9307('0x48')]=_0x456095;return _0x340e6e;});}})['then'](respondWithFilteredResult(_0x1224b3,_0x270afc))[_0x9307('0x49')](handleError(_0x1224b3,null));};exports[_0x9307('0x62')]=function(_0x4fdda9,_0x3a2290,_0x3207ba){var _0x59a5fa={'raw':!![],'where':{}};var _0x159d6f={};var _0x285d99={'count':0x0,'rows':[]};return db[_0x9307('0x37')][_0x9307('0x5e')]({'where':{'id':_0x4fdda9[_0x9307('0x4b')]['id']}})[_0x9307('0x27')](handleEntityNotFound(_0x3a2290,null))[_0x9307('0x27')](function(_0x4c8349){if(_0x4c8349){_0x159d6f[_0x9307('0x3b')]=_['keys'](db[_0x9307('0x63')][_0x9307('0x38')]);_0x159d6f[_0x9307('0x3c')]=_['keys'](_0x4fdda9[_0x9307('0x3c')]);_0x159d6f[_0x9307('0x3e')]=_['intersection'](_0x159d6f['model'],_0x159d6f[_0x9307('0x3c')]);_0x59a5fa[_0x9307('0x40')]=_[_0x9307('0x3f')](_0x159d6f[_0x9307('0x3b')],qs[_0x9307('0x41')](_0x4fdda9[_0x9307('0x3c')][_0x9307('0x41')]));_0x59a5fa['attributes']=_0x59a5fa[_0x9307('0x40')][_0x9307('0x4c')]?_0x59a5fa[_0x9307('0x40')]:_0x159d6f[_0x9307('0x3b')];if(!_0x4fdda9[_0x9307('0x3c')][_0x9307('0x64')](_0x9307('0x42'))){_0x59a5fa[_0x9307('0x1e')]=qs[_0x9307('0x1e')](_0x4fdda9[_0x9307('0x3c')][_0x9307('0x1e')]);_0x59a5fa[_0x9307('0x1c')]=qs[_0x9307('0x1c')](_0x4fdda9['query'][_0x9307('0x1c')]);}_0x59a5fa[_0x9307('0x5f')]=qs['sort'](_0x4fdda9[_0x9307('0x3c')][_0x9307('0x60')]);_0x59a5fa[_0x9307('0x43')]=qs[_0x9307('0x3e')](_[_0x9307('0x65')](_0x4fdda9[_0x9307('0x3c')],_0x159d6f['filters']));_0x59a5fa['where'][_0x9307('0x61')]=_0x4c8349['id'];if(_0x4fdda9[_0x9307('0x3c')][_0x9307('0x2b')]){_0x59a5fa[_0x9307('0x43')]=_['merge'](_0x59a5fa['where'],{'$or':_['map'](_0x59a5fa['attributes'],function(_0x8e5f70){var _0x4a14af={};_0x4a14af[_0x8e5f70]={'$like':'%'+_0x4fdda9[_0x9307('0x3c')]['filter']+'%'};return _0x4a14af;})});}_0x59a5fa=_[_0x9307('0x44')]({},_0x59a5fa,_0x4fdda9[_0x9307('0x45')]);return db[_0x9307('0x63')]['count']({'where':_0x59a5fa[_0x9307('0x43')]})[_0x9307('0x27')](function(_0x21c818){_0x285d99[_0x9307('0x1f')]=_0x21c818;if(_0x4fdda9[_0x9307('0x3c')][_0x9307('0x46')]){_0x59a5fa[_0x9307('0x4d')]=[{'all':!![]}];}return db[_0x9307('0x63')]['findAll'](_0x59a5fa);})[_0x9307('0x27')](function(_0x2c2806){_0x285d99[_0x9307('0x48')]=_0x2c2806;return _0x285d99;});}})[_0x9307('0x27')](respondWithFilteredResult(_0x3a2290,_0x59a5fa))[_0x9307('0x49')](handleError(_0x3a2290,null));};exports[_0x9307('0x66')]=function(_0x4bc9a0,_0x54b06a,_0x268b52){var _0x21e3da={'raw':!![],'where':{}};var _0x530bb0={};var _0x9e0e88={'count':0x0,'rows':[]};return db[_0x9307('0x37')][_0x9307('0x5e')]({'where':{'id':_0x4bc9a0[_0x9307('0x4b')]['id']}})[_0x9307('0x27')](handleEntityNotFound(_0x54b06a,null))[_0x9307('0x27')](function(_0x4cfdbb){if(_0x4cfdbb){_0x530bb0[_0x9307('0x3b')]=_[_0x9307('0x3d')](db['CmHopperFinal'][_0x9307('0x38')]);_0x530bb0['query']=_[_0x9307('0x3d')](_0x4bc9a0[_0x9307('0x3c')]);_0x530bb0[_0x9307('0x3e')]=_[_0x9307('0x3f')](_0x530bb0[_0x9307('0x3b')],_0x530bb0[_0x9307('0x3c')]);_0x21e3da[_0x9307('0x40')]=_[_0x9307('0x3f')](_0x530bb0[_0x9307('0x3b')],qs[_0x9307('0x41')](_0x4bc9a0[_0x9307('0x3c')][_0x9307('0x41')]));_0x21e3da[_0x9307('0x40')]=_0x21e3da[_0x9307('0x40')]['length']?_0x21e3da[_0x9307('0x40')]:_0x530bb0[_0x9307('0x3b')];if(!_0x4bc9a0[_0x9307('0x3c')][_0x9307('0x64')](_0x9307('0x42'))){_0x21e3da[_0x9307('0x1e')]=qs['limit'](_0x4bc9a0[_0x9307('0x3c')][_0x9307('0x1e')]);_0x21e3da[_0x9307('0x1c')]=qs[_0x9307('0x1c')](_0x4bc9a0[_0x9307('0x3c')][_0x9307('0x1c')]);}_0x21e3da['order']=qs[_0x9307('0x60')](_0x4bc9a0['query'][_0x9307('0x60')]);_0x21e3da[_0x9307('0x43')]=qs[_0x9307('0x3e')](_['pick'](_0x4bc9a0[_0x9307('0x3c')],_0x530bb0[_0x9307('0x3e')]));_0x21e3da[_0x9307('0x43')][_0x9307('0x61')]=_0x4cfdbb['id'];if(_0x4bc9a0[_0x9307('0x3c')][_0x9307('0x2b')]){_0x21e3da['where']=_[_0x9307('0x44')](_0x21e3da[_0x9307('0x43')],{'$or':_[_0x9307('0x36')](_0x21e3da[_0x9307('0x40')],function(_0x50014d){var _0x3bbdd1={};_0x3bbdd1[_0x50014d]={'$like':'%'+_0x4bc9a0[_0x9307('0x3c')][_0x9307('0x2b')]+'%'};return _0x3bbdd1;})});}_0x21e3da=_[_0x9307('0x44')]({},_0x21e3da,_0x4bc9a0[_0x9307('0x45')]);return db[_0x9307('0x67')]['count']({'where':_0x21e3da[_0x9307('0x43')]})['then'](function(_0x52f551){_0x9e0e88[_0x9307('0x1f')]=_0x52f551;if(_0x4bc9a0['query'][_0x9307('0x46')]){_0x21e3da['include']=[{'all':!![]}];}return db[_0x9307('0x67')]['findAll'](_0x21e3da);})[_0x9307('0x27')](function(_0x4f0994){_0x9e0e88[_0x9307('0x48')]=_0x4f0994;return _0x9e0e88;});}})[_0x9307('0x27')](respondWithFilteredResult(_0x54b06a,_0x21e3da))['catch'](handleError(_0x54b06a,null));};exports[_0x9307('0x68')]=function(_0x57c981,_0x5ee5e0,_0x5037ca){var _0x4383cb={'raw':!![],'where':{}};var _0x3e3bbf={};var _0x366e9d={'count':0x0,'rows':[]};return db[_0x9307('0x37')][_0x9307('0x5e')]({'where':{'id':_0x57c981[_0x9307('0x4b')]['id']}})[_0x9307('0x27')](handleEntityNotFound(_0x5ee5e0,null))[_0x9307('0x27')](function(_0x5dd2c3){if(_0x5dd2c3){_0x3e3bbf[_0x9307('0x3b')]=_['keys'](db['CmHopperBlack'][_0x9307('0x38')]);_0x3e3bbf[_0x9307('0x3c')]=_['keys'](_0x57c981[_0x9307('0x3c')]);_0x3e3bbf['filters']=_[_0x9307('0x3f')](_0x3e3bbf[_0x9307('0x3b')],_0x3e3bbf['query']);_0x4383cb[_0x9307('0x40')]=_['intersection'](_0x3e3bbf[_0x9307('0x3b')],qs[_0x9307('0x41')](_0x57c981[_0x9307('0x3c')]['fields']));_0x4383cb['attributes']=_0x4383cb[_0x9307('0x40')][_0x9307('0x4c')]?_0x4383cb[_0x9307('0x40')]:_0x3e3bbf[_0x9307('0x3b')];if(!_0x57c981[_0x9307('0x3c')][_0x9307('0x64')](_0x9307('0x42'))){_0x4383cb[_0x9307('0x1e')]=qs[_0x9307('0x1e')](_0x57c981['query'][_0x9307('0x1e')]);_0x4383cb[_0x9307('0x1c')]=qs[_0x9307('0x1c')](_0x57c981[_0x9307('0x3c')][_0x9307('0x1c')]);}_0x4383cb[_0x9307('0x5f')]=qs[_0x9307('0x60')](_0x57c981[_0x9307('0x3c')]['sort']);_0x4383cb[_0x9307('0x43')]=qs['filters'](_['pick'](_0x57c981[_0x9307('0x3c')],_0x3e3bbf[_0x9307('0x3e')]));_0x4383cb['where'][_0x9307('0x61')]=_0x5dd2c3['id'];if(_0x57c981[_0x9307('0x3c')][_0x9307('0x2b')]){_0x4383cb[_0x9307('0x43')]=_[_0x9307('0x44')](_0x4383cb[_0x9307('0x43')],{'$or':_[_0x9307('0x36')](_0x4383cb[_0x9307('0x40')],function(_0x45e1c1){var _0x4974dd={};_0x4974dd[_0x45e1c1]={'$like':'%'+_0x57c981[_0x9307('0x3c')][_0x9307('0x2b')]+'%'};return _0x4974dd;})});}_0x4383cb=_[_0x9307('0x44')]({},_0x4383cb,_0x57c981[_0x9307('0x45')]);return db[_0x9307('0x69')]['count']({'where':_0x4383cb[_0x9307('0x43')]})[_0x9307('0x27')](function(_0x30af84){_0x366e9d['count']=_0x30af84;if(_0x57c981[_0x9307('0x3c')]['includeAll']){_0x4383cb['include']=[{'all':!![]}];}return db[_0x9307('0x69')][_0x9307('0x47')](_0x4383cb);})[_0x9307('0x27')](function(_0x3f1920){_0x366e9d[_0x9307('0x48')]=_0x3f1920;return _0x366e9d;});}})[_0x9307('0x27')](respondWithFilteredResult(_0x5ee5e0,_0x4383cb))[_0x9307('0x49')](handleError(_0x5ee5e0,null));};exports[_0x9307('0x6a')]=function(_0x3a834d,_0x4fc7f3,_0x593e0e){var _0x19def4={};var _0x4ec335={};var _0x4cd875;var _0x44724c;return db['VoiceQueue'][_0x9307('0x5e')]({'where':{'id':_0x3a834d[_0x9307('0x4b')]['id']}})[_0x9307('0x27')](handleEntityNotFound(_0x4fc7f3,null))[_0x9307('0x27')](function(_0x4e2e2e){if(_0x4e2e2e){_0x4cd875=_0x4e2e2e;_0x4ec335['model']=_[_0x9307('0x3d')](db['Team'][_0x9307('0x38')]);_0x4ec335['query']=_['keys'](_0x3a834d[_0x9307('0x3c')]);_0x4ec335[_0x9307('0x3e')]=_[_0x9307('0x3f')](_0x4ec335[_0x9307('0x3b')],_0x4ec335[_0x9307('0x3c')]);_0x19def4[_0x9307('0x40')]=_[_0x9307('0x3f')](_0x4ec335['model'],qs[_0x9307('0x41')](_0x3a834d['query'][_0x9307('0x41')]));_0x19def4[_0x9307('0x40')]=_0x19def4[_0x9307('0x40')][_0x9307('0x4c')]?_0x19def4['attributes']:_0x4ec335[_0x9307('0x3b')];_0x19def4[_0x9307('0x5f')]=qs['sort'](_0x3a834d[_0x9307('0x3c')][_0x9307('0x60')]);_0x19def4[_0x9307('0x43')]=qs[_0x9307('0x3e')](_[_0x9307('0x65')](_0x3a834d[_0x9307('0x3c')],_0x4ec335[_0x9307('0x3e')]));if(_0x3a834d[_0x9307('0x3c')][_0x9307('0x2b')]){_0x19def4['where']=_[_0x9307('0x44')](_0x19def4[_0x9307('0x43')],{'$or':_[_0x9307('0x36')](_0x19def4[_0x9307('0x40')],function(_0x7a0d7e){var _0xf067f6={};_0xf067f6[_0x7a0d7e]={'$like':'%'+_0x3a834d['query']['filter']+'%'};return _0xf067f6;})});}_0x19def4=_[_0x9307('0x44')]({},_0x19def4,_0x3a834d[_0x9307('0x45')]);return _0x4cd875[_0x9307('0x6a')](_0x19def4);}})[_0x9307('0x27')](function(_0x96c64a){if(_0x96c64a){_0x44724c=_0x96c64a[_0x9307('0x4c')];if(!_0x3a834d[_0x9307('0x3c')][_0x9307('0x64')](_0x9307('0x42'))){_0x19def4[_0x9307('0x1e')]=qs['limit'](_0x3a834d['query'][_0x9307('0x1e')]);_0x19def4[_0x9307('0x1c')]=qs[_0x9307('0x1c')](_0x3a834d[_0x9307('0x3c')]['offset']);}return _0x4cd875[_0x9307('0x6a')](_0x19def4);}})['then'](function(_0x5562a8){if(_0x5562a8){return _0x5562a8?{'count':_0x44724c,'rows':_0x5562a8}:null;}})['then'](respondWithResult(_0x4fc7f3,null))[_0x9307('0x49')](handleError(_0x4fc7f3,null));};exports[_0x9307('0x6b')]=function(_0x216953,_0x9127d,_0x505bb4){var _0x21aeb8=_0x216953[_0x9307('0x59')]['teams'];var _0xa0bfe7=_[_0x9307('0x36')](_0x21aeb8,'id');return db[_0x9307('0x6c')][_0x9307('0x47')]({'where':{'id':_0xa0bfe7},'attributes':['id'],'include':[{'model':db[_0x9307('0x6d')],'as':'Agents','attributes':['id',_0x9307('0x2f'),_0x9307('0x6e'),'voicePause',_0x9307('0x6f')],'raw':!![]}]})['then'](function(_0x195b90){if(_0x195b90){var _0x3e166c=_['flatMap'](_0x195b90,function(_0x12f7db){var _0x4616b2=_0x12f7db['get']({'plain':!![]});_0x4616b2[_0x9307('0x70')]['forEach'](function(_0x5d5cdf){_0x5d5cdf[_0x9307('0x71')]=_['find'](_0x21aeb8,{'id':_0x4616b2['id']})['penalty'];});return _0x4616b2[_0x9307('0x70')];});return db[_0x9307('0x37')]['find']({'where':{'id':_0x216953[_0x9307('0x4b')]['id']}})['then'](function(_0x40ad77){return db[_0x9307('0x72')][_0x9307('0x73')](function(_0x21dba8){return _0x40ad77[_0x9307('0x6b')](_0xa0bfe7,{'transaction':_0x21dba8})['then'](function(){return BPromise[_0x9307('0x74')](_0x21aeb8,function(_0x1614ac){return db[_0x9307('0x75')]['upsert']({'TeamId':_0x1614ac['id'],'VoiceQueueId':_0x216953['params']['id'],'penalty':_0x1614ac[_0x9307('0x71')]},{'transaction':_0x21dba8});});})[_0x9307('0x27')](function(){return BPromise[_0x9307('0x74')](_0x3e166c,function(_0x18a44f){return db[_0x9307('0x76')][_0x9307('0x77')]({'where':{'UserId':_0x18a44f['id'],'VoiceQueueId':_0x216953[_0x9307('0x4b')]['id']},'defaults':{'penalty':_0x18a44f[_0x9307('0x71')]},'transaction':_0x21dba8});});})[_0x9307('0x27')](function(){return BPromise[_0x9307('0x74')](_[_0x9307('0x2b')](_0x3e166c,{'online':!![]}),function(_0x567681){return db[_0x9307('0x78')]['upsert']({'membername':_0x567681[_0x9307('0x2f')],'UserId':_0x567681['id'],'queue_name':_0x40ad77[_0x9307('0x2f')],'VoiceQueueId':_0x40ad77['id'],'interface':_[_0x9307('0x79')](_0x567681['interface'])?util[_0x9307('0x7a')](_0x9307('0x7b'),_0x567681[_0x9307('0x2f')]):_0x567681[_0x9307('0x6f')],'paused':_0x567681['voicePause']||![],'penalty':_0x567681[_0x9307('0x71')]},{'transaction':_0x21dba8});});})['then'](function(){_0x3e166c[_0x9307('0x7c')](function(_0x40fa18){socket[_0x9307('0x7d')]('userVoiceQueue:save',{'UserId':_0x40fa18['id'],'VoiceQueueId':_0x40ad77['id']});});});});});}})[_0x9307('0x27')](respondWithStatusCode(_0x9127d,null))['catch'](handleError(_0x9127d,null));};exports[_0x9307('0x7e')]=function(_0x21a4de,_0x9a6f62,_0x5b946a){return db[_0x9307('0x6c')][_0x9307('0x47')]({'where':{'id':_0x21a4de['query'][_0x9307('0x7f')]},'attributes':['id'],'include':[{'model':db[_0x9307('0x6d')],'as':_0x9307('0x70'),'attributes':['id'],'raw':!![]}]})[_0x9307('0x27')](handleEntityNotFound(_0x9a6f62,null))[_0x9307('0x27')](function(_0x38239d){var _0x4010a5=_[_0x9307('0x36')](_0x38239d,'id');var _0x5e93a2=[];var _0x6c402=[];var _0x157f7e=squel[_0x9307('0x80')]();_0x157f7e[_0x9307('0x81')](_0x9307('0x82'))[_0x9307('0x83')]('team_has_voice_queues','tq')['join'](_0x9307('0x84'),'ut',_0x9307('0x85'))[_0x9307('0x43')](_0x9307('0x86'),_0x21a4de[_0x9307('0x4b')]['id']);for(var _0x4219a1=0x0;_0x4219a1<_0x38239d[_0x9307('0x4c')];_0x4219a1+=0x1){let _0x2f75d3=_0x38239d[_0x4219a1];for(var _0x114cf5=0x0;_0x114cf5<_0x2f75d3[_0x9307('0x70')][_0x9307('0x4c')];_0x114cf5+=0x1){let _0xb2905f=_0x2f75d3[_0x9307('0x70')][_0x114cf5];var _0x10ae91=_0x157f7e[_0x9307('0x55')]();_0x10ae91[_0x9307('0x43')](_0x9307('0x87'),_0xb2905f['id']);_0x6c402[_0x9307('0x88')](db[_0x9307('0x72')][_0x9307('0x3c')](_0x10ae91[_0x9307('0x89')](),{'type':db['sequelize'][_0x9307('0x8a')][_0x9307('0x8b')]})[_0x9307('0x27')](function(_0x4ce6d5){if(_0x4ce6d5['length']===0x1){return _0xb2905f['id'];}else{var _0x359031=_[_0x9307('0x8c')](_[_0x9307('0x36')](_0x4ce6d5,_0x9307('0x8d')),function(_0x4b7d15){return _['includes'](_0x4010a5,_0x4b7d15);});if(_0x359031){return _0xb2905f['id'];}}}));}}return BPromise[_0x9307('0x8e')](_0x6c402)[_0x9307('0x27')](function(_0x49cca6){_0x5e93a2=_(_0x5e93a2)[_0x9307('0x8f')](_0x49cca6)[_0x9307('0x90')]()[_0x9307('0x2d')]();return db[_0x9307('0x37')][_0x9307('0x52')]({'where':{'id':_0x21a4de[_0x9307('0x4b')]['id']}})['then'](function(_0x4c0366){return db[_0x9307('0x72')][_0x9307('0x73')](function(_0x2dfced){return _0x4c0366[_0x9307('0x7e')](_0x21a4de[_0x9307('0x3c')][_0x9307('0x7f')],{'transaction':_0x2dfced})[_0x9307('0x27')](function(){if(!_[_0x9307('0x91')](_0x5e93a2)){return _0x4c0366[_0x9307('0x92')](_0x5e93a2,{'transaction':_0x2dfced})[_0x9307('0x27')](function(){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x21a4de[_0x9307('0x4b')]['id'],'UserId':_0x5e93a2},'transaction':_0x2dfced});});}})[_0x9307('0x27')](function(){_0x5e93a2[_0x9307('0x7c')](function(_0x366059){socket[_0x9307('0x7d')](_0x9307('0x93'),{'UserId':_0x366059,'VoiceQueueId':_0x4c0366['id']});});});});});});})['then'](respondWithStatusCode(_0x9a6f62,null))[_0x9307('0x49')](handleError(_0x9a6f62,null));};exports[_0x9307('0x94')]=function(_0x13a4b7,_0x517ce5,_0x303946){var _0x4daf38,_0xc8877b;return db[_0x9307('0x37')][_0x9307('0x52')]({'where':{'id':_0x13a4b7[_0x9307('0x4b')]['id']}})[_0x9307('0x27')](handleEntityNotFound(_0x517ce5,null))[_0x9307('0x27')](function(_0x1c02fa){if(_0x1c02fa){_0xc8877b=_0x1c02fa;return _0x1c02fa[_0x9307('0x94')](_0x13a4b7['body'][_0x9307('0x7f')],_[_0x9307('0x56')](_0x13a4b7[_0x9307('0x59')],[_0x9307('0x7f'),'id'])||{})[_0x9307('0x95')](function(_0x23bc4a){for(var _0x4175b4=0x0;_0x4175b4<_0x13a4b7[_0x9307('0x59')][_0x9307('0x7f')][_0x9307('0x4c')];_0x4175b4+=0x1){socket[_0x9307('0x7d')](_0x9307('0x96'),{'UserId':Number(_0x13a4b7['body']['ids'][_0x4175b4]),'VoiceQueueId':Number(_0x13a4b7[_0x9307('0x4b')]['id'])});}return _0x23bc4a;});}})[_0x9307('0x27')](function(_0x536930){_0x4daf38=_0x536930||[];if(_0xc8877b){return db[_0x9307('0x6d')][_0x9307('0x47')]({'where':{'id':_0x13a4b7[_0x9307('0x59')][_0x9307('0x7f')]},'attributes':['id',_0x9307('0x2f'),_0x9307('0x6e'),_0x9307('0x97'),_0x9307('0x6f')],'raw':!![]});}})[_0x9307('0x27')](function(_0xa95202){if(!_[_0x9307('0x91')](_0xa95202)){var _0x17b856=[];for(var _0x12f595=0x0;_0x12f595<_0xa95202[_0x9307('0x4c')];_0x12f595++){if(_0xa95202[_0x12f595][_0x9307('0x6e')]){_0x17b856[_0x9307('0x88')](db[_0x9307('0x78')]['upsert']({'membername':_0xa95202[_0x12f595]['name'],'UserId':_0xa95202[_0x12f595]['id'],'queue_name':_0xc8877b[_0x9307('0x2f')],'VoiceQueueId':_0xc8877b['id'],'interface':_[_0x9307('0x79')](_0xa95202[_0x12f595]['interface'])?util[_0x9307('0x7a')](_0x9307('0x7b'),_0xa95202[_0x12f595][_0x9307('0x2f')]):_0xa95202[_0x12f595][_0x9307('0x6f')],'paused':_0xa95202[_0x12f595]['voicePause']||![],'penalty':_0x13a4b7['body'][_0x9307('0x71')]||0x0}));}}return BPromise[_0x9307('0x8e')](_0x17b856);}})['then'](function(){return _0x4daf38;})[_0x9307('0x27')](respondWithResult(_0x517ce5,null))[_0x9307('0x49')](handleError(_0x517ce5,null));};exports[_0x9307('0x92')]=function(_0x2d8ea9,_0x484f1c,_0x310402){return db[_0x9307('0x37')][_0x9307('0x52')]({'where':{'id':_0x2d8ea9[_0x9307('0x4b')]['id']}})[_0x9307('0x27')](handleEntityNotFound(_0x484f1c,null))[_0x9307('0x27')](function(_0x3e4fec){if(_0x3e4fec){return _0x3e4fec[_0x9307('0x92')](_0x2d8ea9['query'][_0x9307('0x7f')])[_0x9307('0x27')](function(){if(_[_0x9307('0x98')](_0x2d8ea9['query'][_0x9307('0x7f')])){for(var _0x51ffd0=0x0;_0x51ffd0<_0x2d8ea9[_0x9307('0x3c')][_0x9307('0x7f')][_0x9307('0x4c')];_0x51ffd0+=0x1){socket[_0x9307('0x7d')]('userVoiceQueue:remove',{'UserId':Number(_0x2d8ea9[_0x9307('0x3c')][_0x9307('0x7f')][_0x51ffd0]),'VoiceQueueId':Number(_0x2d8ea9[_0x9307('0x4b')]['id'])});}}else{socket[_0x9307('0x7d')]('userVoiceQueue:remove',{'UserId':Number(_0x2d8ea9[_0x9307('0x3c')][_0x9307('0x7f')]),'VoiceQueueId':Number(_0x2d8ea9[_0x9307('0x4b')]['id'])});}});}})[_0x9307('0x27')](function(_0x56e69e){return db[_0x9307('0x78')][_0x9307('0x26')]({'where':{'VoiceQueueId':_0x2d8ea9[_0x9307('0x4b')]['id'],'UserId':_0x2d8ea9[_0x9307('0x3c')][_0x9307('0x7f')]}})[_0x9307('0x27')](function(){return _0x56e69e;});})[_0x9307('0x27')](respondWithStatusCode(_0x484f1c,null))['catch'](handleError(_0x484f1c,null));};exports[_0x9307('0x99')]=function(_0x55f414,_0x5d69d6,_0x36c195){var _0x3f020b={};var _0x166c73={};var _0x5c3b81;var _0x229499;return db[_0x9307('0x37')][_0x9307('0x5e')]({'where':{'id':_0x55f414['params']['id']}})[_0x9307('0x27')](handleEntityNotFound(_0x5d69d6,null))['then'](function(_0x193d52){if(_0x193d52){_0x5c3b81=_0x193d52;_0x166c73[_0x9307('0x3b')]=_['keys'](db[_0x9307('0x6d')][_0x9307('0x38')]);_0x166c73['query']=_['keys'](_0x55f414['query']);_0x166c73['filters']=_[_0x9307('0x3f')](_0x166c73[_0x9307('0x3b')],_0x166c73['query']);_0x3f020b[_0x9307('0x40')]=_['intersection'](_0x166c73[_0x9307('0x3b')],qs[_0x9307('0x41')](_0x55f414[_0x9307('0x3c')][_0x9307('0x41')]));_0x3f020b['attributes']=_0x3f020b[_0x9307('0x40')]['length']?_0x3f020b[_0x9307('0x40')]:_0x166c73[_0x9307('0x3b')];_0x3f020b[_0x9307('0x5f')]=qs[_0x9307('0x60')](_0x55f414[_0x9307('0x3c')][_0x9307('0x60')]);_0x3f020b['where']=qs[_0x9307('0x3e')](_['pick'](_0x55f414[_0x9307('0x3c')],_0x166c73[_0x9307('0x3e')]));if(_0x55f414[_0x9307('0x3c')]['filter']){_0x3f020b['where']=_[_0x9307('0x44')](_0x3f020b['where'],{'$or':_[_0x9307('0x36')](_0x3f020b[_0x9307('0x40')],function(_0x1be923){var _0x146962={};_0x146962[_0x1be923]={'$like':'%'+_0x55f414[_0x9307('0x3c')]['filter']+'%'};return _0x146962;})});}_0x3f020b=_[_0x9307('0x44')]({},_0x3f020b,_0x55f414[_0x9307('0x45')]);return _0x5c3b81['getAgents'](_0x3f020b);}})[_0x9307('0x27')](function(_0x375280){if(_0x375280){_0x229499=_0x375280['length'];if(!_0x55f414['query'][_0x9307('0x64')](_0x9307('0x42'))){_0x3f020b[_0x9307('0x1e')]=qs[_0x9307('0x1e')](_0x55f414[_0x9307('0x3c')][_0x9307('0x1e')]);_0x3f020b[_0x9307('0x1c')]=qs[_0x9307('0x1c')](_0x55f414[_0x9307('0x3c')]['offset']);}return _0x5c3b81[_0x9307('0x99')](_0x3f020b);}})[_0x9307('0x27')](function(_0xce8c88){if(_0xce8c88){return _0xce8c88?{'count':_0x229499,'rows':_0xce8c88}:null;}})[_0x9307('0x27')](respondWithResult(_0x5d69d6,null))['catch'](handleError(_0x5d69d6,null));};exports[_0x9307('0x9a')]=function(_0x3301c3,_0x1daf74,_0x3db4cc){var _0x4dd2e4={};var _0x5baf63={};var _0x73d1aa;var _0xed5cfa;return db[_0x9307('0x37')][_0x9307('0x5e')]({'where':{'id':_0x3301c3[_0x9307('0x4b')]['id']}})[_0x9307('0x27')](handleEntityNotFound(_0x1daf74,null))[_0x9307('0x27')](function(_0x1495af){if(_0x1495af){_0x73d1aa=_0x1495af;_0x5baf63['model']=_['keys'](db['UserVoiceQueueRt'][_0x9307('0x38')]);_0x5baf63[_0x9307('0x3c')]=_[_0x9307('0x3d')](_0x3301c3[_0x9307('0x3c')]);_0x5baf63['filters']=_[_0x9307('0x3f')](_0x5baf63['model'],_0x5baf63[_0x9307('0x3c')]);_0x4dd2e4['attributes']=_[_0x9307('0x3f')](_0x5baf63[_0x9307('0x3b')],qs['fields'](_0x3301c3[_0x9307('0x3c')][_0x9307('0x41')]));_0x4dd2e4[_0x9307('0x40')]=_0x4dd2e4[_0x9307('0x40')][_0x9307('0x4c')]?_0x4dd2e4[_0x9307('0x40')]:_0x5baf63[_0x9307('0x3b')];_0x4dd2e4[_0x9307('0x5f')]=qs['sort'](_0x3301c3['query']['sort']);_0x4dd2e4[_0x9307('0x43')]=qs[_0x9307('0x3e')](_[_0x9307('0x65')](_0x3301c3[_0x9307('0x3c')],_0x5baf63[_0x9307('0x3e')]));if(_0x3301c3['query'][_0x9307('0x2b')]){_0x4dd2e4[_0x9307('0x43')]=_['merge'](_0x4dd2e4[_0x9307('0x43')],{'$or':_[_0x9307('0x36')](_0x4dd2e4[_0x9307('0x40')],function(_0x324fa9){var _0x4b106c={};_0x4b106c[_0x324fa9]={'$like':'%'+_0x3301c3[_0x9307('0x3c')]['filter']+'%'};return _0x4b106c;})});}_0x4dd2e4=_[_0x9307('0x44')]({},_0x4dd2e4,_0x3301c3[_0x9307('0x45')]);return _0x73d1aa['getMembers'](_0x4dd2e4);}})[_0x9307('0x27')](function(_0x2743f5){if(_0x2743f5){_0xed5cfa=_0x2743f5[_0x9307('0x4c')];if(!_0x3301c3[_0x9307('0x3c')][_0x9307('0x64')](_0x9307('0x42'))){_0x4dd2e4[_0x9307('0x1e')]=qs[_0x9307('0x1e')](_0x3301c3[_0x9307('0x3c')][_0x9307('0x1e')]);_0x4dd2e4[_0x9307('0x1c')]=qs[_0x9307('0x1c')](_0x3301c3[_0x9307('0x3c')][_0x9307('0x1c')]);}return _0x73d1aa['getMembers'](_0x4dd2e4);}})[_0x9307('0x27')](function(_0x434a7b){return _0x434a7b?{'count':_0xed5cfa,'rows':_0x434a7b}:null;})[_0x9307('0x27')](respondWithResult(_0x1daf74,null))[_0x9307('0x49')](handleError(_0x1daf74,null));};exports[_0x9307('0x9b')]=function(_0x413d86,_0x444e17,_0x4c9cdf){var _0xaf6e35={};var _0x33cd1={};var _0x3e3834;var _0x456589;return db[_0x9307('0x37')][_0x9307('0x5e')]({'where':{'id':_0x413d86[_0x9307('0x4b')]['id']}})[_0x9307('0x27')](handleEntityNotFound(_0x444e17,null))['then'](function(_0x7f93de){if(_0x7f93de){_0x3e3834=_0x7f93de;_0x33cd1[_0x9307('0x3b')]=_[_0x9307('0x3d')](db[_0x9307('0x9c')]['rawAttributes']);_0x33cd1['query']=_['keys'](_0x413d86[_0x9307('0x3c')]);_0x33cd1['filters']=_[_0x9307('0x3f')](_0x33cd1[_0x9307('0x3b')],_0x33cd1[_0x9307('0x3c')]);_0xaf6e35[_0x9307('0x40')]=_['intersection'](_0x33cd1[_0x9307('0x3b')],qs[_0x9307('0x41')](_0x413d86[_0x9307('0x3c')][_0x9307('0x41')]));_0xaf6e35[_0x9307('0x40')]=_0xaf6e35[_0x9307('0x40')][_0x9307('0x4c')]?_0xaf6e35['attributes']:_0x33cd1[_0x9307('0x3b')];_0xaf6e35['order']=qs[_0x9307('0x60')](_0x413d86[_0x9307('0x3c')]['sort']);_0xaf6e35[_0x9307('0x43')]=qs[_0x9307('0x3e')](_[_0x9307('0x65')](_0x413d86['query'],_0x33cd1[_0x9307('0x3e')]));if(_0x413d86[_0x9307('0x3c')][_0x9307('0x2b')]){_0xaf6e35['where']=_['merge'](_0xaf6e35[_0x9307('0x43')],{'$or':_[_0x9307('0x36')](_0xaf6e35[_0x9307('0x40')],function(_0x447171){var _0x560f62={};_0x560f62[_0x447171]={'$like':'%'+_0x413d86['query'][_0x9307('0x2b')]+'%'};return _0x560f62;})});}_0xaf6e35=_[_0x9307('0x44')]({},_0xaf6e35,_0x413d86[_0x9307('0x45')]);return _0x3e3834['getLists'](_0xaf6e35);}})['then'](function(_0x2b054a){if(_0x2b054a){_0x456589=_0x2b054a[_0x9307('0x4c')];if(!_0x413d86[_0x9307('0x3c')][_0x9307('0x64')](_0x9307('0x42'))){_0xaf6e35[_0x9307('0x1e')]=qs[_0x9307('0x1e')](_0x413d86['query'][_0x9307('0x1e')]);_0xaf6e35[_0x9307('0x1c')]=qs[_0x9307('0x1c')](_0x413d86[_0x9307('0x3c')][_0x9307('0x1c')]);}return _0x3e3834[_0x9307('0x9b')](_0xaf6e35);}})[_0x9307('0x27')](function(_0x3373cf){if(_0x3373cf){return _0x3373cf?{'count':_0x456589,'rows':_0x3373cf}:null;}})['then'](respondWithResult(_0x444e17,null))[_0x9307('0x49')](handleError(_0x444e17,null));};exports[_0x9307('0x9d')]=function(_0x1b58c5,_0xa13cd1,_0x58b692){var _0x1b564d=moment()[_0x9307('0x7a')](_0x9307('0x9e'));var _0x1cd08c,_0x4631ec;return db[_0x9307('0x37')][_0x9307('0x52')]({'where':{'id':_0x1b58c5[_0x9307('0x4b')]['id']}})[_0x9307('0x27')](handleEntityNotFound(_0xa13cd1,null))[_0x9307('0x27')](function(_0x2f7ad9){if(_0x2f7ad9){_0x4631ec=_0x2f7ad9;return _0x2f7ad9[_0x9307('0x9d')](_0x1b58c5[_0x9307('0x59')][_0x9307('0x7f')],_[_0x9307('0x56')](_0x1b58c5['body'],[_0x9307('0x7f'),'id'])||{});}return null;})[_0x9307('0x95')](function(_0x3c140e){var _0x4da62e;_0x1cd08c=_0x3c140e||[];var _0x25f206=[];if(_0x3c140e){for(var _0x501875=0x0;_0x501875<_0x3c140e[_0x9307('0x4c')];_0x501875+=0x1){var _0x534638=_0x3c140e[_0x501875][_0x9307('0x28')]({'plain':!![]});_0x4631ec[_0x9307('0x9f')]=_0x1b58c5[_0x9307('0x59')]['dialCheckDuplicateType']?_0x1b58c5[_0x9307('0x59')][_0x9307('0x9f')]:_0x4631ec[_0x9307('0x9f')];switch(_0x4631ec[_0x9307('0x9f')]){case _0x9307('0xa0'):_0x4da62e=squel[_0x9307('0xa1')]()[_0x9307('0xa2')](_0x9307('0xa3'))[_0x9307('0xa4')](['phone',_0x9307('0xa5'),_0x9307('0xa6'),'ListId',_0x9307('0x61'),_0x9307('0x57'),_0x9307('0x58')],squel[_0x9307('0x80')]()[_0x9307('0x81')](_0x9307('0xa7'),_0x9307('0xa7'))[_0x9307('0x81')]('\x27'+_0x1b564d+'\x27',_0x9307('0xa5'))[_0x9307('0x81')]('id',_0x9307('0xa6'))[_0x9307('0x81')](_0x534638[_0x9307('0xa8')]['toString'](),_0x9307('0xa9'))[_0x9307('0x81')](_0x1b58c5['params']['id'][_0x9307('0x89')](),_0x9307('0x61'))[_0x9307('0x81')]('\x27'+_0x1b564d+'\x27',_0x9307('0x57'))[_0x9307('0x81')]('\x27'+_0x1b564d+'\x27',_0x9307('0x58'))[_0x9307('0x83')](_0x9307('0xaa'))[_0x9307('0x43')]('deletedAt\x20IS\x20NULL')[_0x9307('0x43')](_0x9307('0xab'),_0x534638[_0x9307('0xa8')][_0x9307('0x89')]())[_0x9307('0x43')](_0x9307('0xac'))[_0x9307('0x43')](_0x9307('0xad'),squel[_0x9307('0x80')]()[_0x9307('0x81')]('COALESCE(calleridnum,\x27\x27)')[_0x9307('0x83')](_0x9307('0xae'))[_0x9307('0x43')](_0x9307('0x86'),_0x1b58c5[_0x9307('0x4b')]['id'][_0x9307('0x89')]()))[_0x9307('0x43')]('phone\x20NOT\x20IN\x20(?)',squel[_0x9307('0x80')]()[_0x9307('0x81')](_0x9307('0xaf'))['from']('cm_hopper')[_0x9307('0x43')](_0x9307('0x86'),_0x1b58c5['params']['id'][_0x9307('0x89')]())))[_0x9307('0x89')]();break;case _0x9307('0xb0'):_0x4da62e=squel[_0x9307('0xa1')]()[_0x9307('0xa2')](_0x9307('0xa3'))[_0x9307('0xa4')]([_0x9307('0xa7'),'scheduledAt',_0x9307('0xa6'),_0x9307('0xa9'),'VoiceQueueId','createdAt',_0x9307('0x58')],squel[_0x9307('0x80')]()[_0x9307('0x81')](_0x9307('0xa7'),_0x9307('0xa7'))[_0x9307('0x81')]('\x27'+_0x1b564d+'\x27',_0x9307('0xa5'))[_0x9307('0x81')]('id','ContactId')[_0x9307('0x81')](_0x534638[_0x9307('0xa8')][_0x9307('0x89')](),_0x9307('0xa9'))[_0x9307('0x81')](_0x1b58c5[_0x9307('0x4b')]['id'][_0x9307('0x89')](),_0x9307('0x61'))['field']('\x27'+_0x1b564d+'\x27',_0x9307('0x57'))['field']('\x27'+_0x1b564d+'\x27',_0x9307('0x58'))['from'](_0x9307('0xaa'))['where'](_0x9307('0xb1'))[_0x9307('0x43')](_0x9307('0xab'),_0x534638[_0x9307('0xa8')]['toString']())[_0x9307('0x43')](_0x9307('0xac'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x9307('0x80')]()[_0x9307('0x81')]('COALESCE(phone,\x27\x27)')[_0x9307('0x83')](_0x9307('0xa3'))[_0x9307('0x43')](_0x9307('0x86'),_0x1b58c5['params']['id']['toString']())))[_0x9307('0x89')]();break;default:_0x4da62e=squel['insert']()[_0x9307('0xa2')](_0x9307('0xa3'))['fromQuery']([_0x9307('0xa7'),_0x9307('0xa5'),_0x9307('0xa6'),_0x9307('0xa9'),_0x9307('0x61'),_0x9307('0x57'),_0x9307('0x58')],squel['select']()[_0x9307('0x81')](_0x9307('0xa7'),_0x9307('0xa7'))['field']('\x27'+_0x1b564d+'\x27',_0x9307('0xa5'))[_0x9307('0x81')]('id',_0x9307('0xa6'))['field'](_0x534638[_0x9307('0xa8')][_0x9307('0x89')](),_0x9307('0xa9'))['field'](_0x1b58c5[_0x9307('0x4b')]['id'][_0x9307('0x89')](),_0x9307('0x61'))[_0x9307('0x81')]('\x27'+_0x1b564d+'\x27',_0x9307('0x57'))['field']('\x27'+_0x1b564d+'\x27','updatedAt')[_0x9307('0x83')](_0x9307('0xaa'))[_0x9307('0x43')](_0x9307('0xb1'))[_0x9307('0x43')](_0x9307('0xab'),_0x534638[_0x9307('0xa8')]['toString']())[_0x9307('0x43')]('phone\x20IS\x20NOT\x20NULL'))['toString']();}_0x25f206[_0x9307('0x88')](db['sequelize'][_0x9307('0x3c')](_0x4da62e));}return BPromise['all'](_0x25f206);}})[_0x9307('0x27')](function(){var _0x7d82bc=[];var _0x21a33b=squel['insert']()[_0x9307('0xa2')](_0x9307('0xb2'))[_0x9307('0xa4')](['CmHopperId',_0x9307('0xa7'),_0x9307('0xb3'),'createdAt',_0x9307('0x58')],squel[_0x9307('0x80')]()[_0x9307('0x81')](_0x9307('0xb4'))[_0x9307('0x81')](_0x9307('0xb5'))[_0x9307('0x81')](_0x9307('0xb6'))[_0x9307('0x81')]('\x27'+_0x1b564d+'\x27',_0x9307('0x57'))[_0x9307('0x81')]('\x27'+_0x1b564d+'\x27','updatedAt')['from'](_0x9307('0xb7'),'ci')['join']('cm_hopper','h',_0x9307('0xb8'))['where'](_0x9307('0xb9'),_0x1b564d)['where'](_0x9307('0xba'),_0x9307('0xbb')))[_0x9307('0x89')]();_0x7d82bc[_0x9307('0x88')](db[_0x9307('0x72')][_0x9307('0x3c')](_0x21a33b));return BPromise[_0x9307('0x8e')](_0x7d82bc);})[_0x9307('0x27')](function(){return _0x1cd08c;})[_0x9307('0x27')](respondWithResult(_0xa13cd1,null))[_0x9307('0x49')](handleError(_0xa13cd1,null));};exports[_0x9307('0xbc')]=function(_0x4e62f8,_0x40d1c3,_0x33495e){return db['VoiceQueue'][_0x9307('0x52')]({'where':{'id':_0x4e62f8[_0x9307('0x4b')]['id']}})[_0x9307('0x27')](handleEntityNotFound(_0x40d1c3,null))['then'](function(_0xc41ba3){if(_0xc41ba3){return _0xc41ba3['removeLists'](_0x4e62f8[_0x9307('0x3c')]['ids']);}})[_0x9307('0x27')](function(_0x116e55){if(_0x116e55){return db[_0x9307('0xbd')][_0x9307('0x26')]({'where':{'ListId':_0x4e62f8[_0x9307('0x3c')][_0x9307('0x7f')],'VoiceQueueId':_0x4e62f8[_0x9307('0x4b')]['id']}})['then'](function(){return _0x116e55;});}})[_0x9307('0x27')](respondWithStatusCode(_0x40d1c3,null))['catch'](handleError(_0x40d1c3,null));};exports[_0x9307('0xbe')]=function(_0x58167e,_0x2abb5e,_0x1a6cd5){var _0x5ec693={};var _0x4e28ed={};var _0x387e30;var _0x37a9ac;return db[_0x9307('0x37')][_0x9307('0x5e')]({'where':{'id':_0x58167e[_0x9307('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2abb5e,null))['then'](function(_0x1490ff){if(_0x1490ff){_0x387e30=_0x1490ff;_0x4e28ed[_0x9307('0x3b')]=_[_0x9307('0x3d')](db[_0x9307('0x9c')][_0x9307('0x38')]);_0x4e28ed[_0x9307('0x3c')]=_[_0x9307('0x3d')](_0x58167e['query']);_0x4e28ed['filters']=_[_0x9307('0x3f')](_0x4e28ed[_0x9307('0x3b')],_0x4e28ed[_0x9307('0x3c')]);_0x5ec693['attributes']=_[_0x9307('0x3f')](_0x4e28ed[_0x9307('0x3b')],qs[_0x9307('0x41')](_0x58167e[_0x9307('0x3c')]['fields']));_0x5ec693[_0x9307('0x40')]=_0x5ec693['attributes'][_0x9307('0x4c')]?_0x5ec693[_0x9307('0x40')]:_0x4e28ed['model'];_0x5ec693[_0x9307('0x5f')]=qs[_0x9307('0x60')](_0x58167e[_0x9307('0x3c')][_0x9307('0x60')]);_0x5ec693[_0x9307('0x43')]=qs[_0x9307('0x3e')](_[_0x9307('0x65')](_0x58167e[_0x9307('0x3c')],_0x4e28ed[_0x9307('0x3e')]));if(_0x58167e[_0x9307('0x3c')][_0x9307('0x2b')]){_0x5ec693['where']=_[_0x9307('0x44')](_0x5ec693['where'],{'$or':_[_0x9307('0x36')](_0x5ec693['attributes'],function(_0x29b0c3){var _0x1fa8c9={};_0x1fa8c9[_0x29b0c3]={'$like':'%'+_0x58167e[_0x9307('0x3c')][_0x9307('0x2b')]+'%'};return _0x1fa8c9;})});}_0x5ec693=_[_0x9307('0x44')]({},_0x5ec693,_0x58167e['options']);return _0x387e30[_0x9307('0xbe')](_0x5ec693);}})[_0x9307('0x27')](function(_0x33270c){if(_0x33270c){_0x37a9ac=_0x33270c[_0x9307('0x4c')];if(!_0x58167e[_0x9307('0x3c')][_0x9307('0x64')](_0x9307('0x42'))){_0x5ec693[_0x9307('0x1e')]=qs[_0x9307('0x1e')](_0x58167e['query']['limit']);_0x5ec693[_0x9307('0x1c')]=qs[_0x9307('0x1c')](_0x58167e['query']['offset']);}return _0x387e30[_0x9307('0xbe')](_0x5ec693);}})[_0x9307('0x27')](function(_0x4f1234){if(_0x4f1234){return _0x4f1234?{'count':_0x37a9ac,'rows':_0x4f1234}:null;}})[_0x9307('0x27')](respondWithResult(_0x2abb5e,null))[_0x9307('0x49')](handleError(_0x2abb5e,null));};exports[_0x9307('0xbf')]=function(_0x3ac422,_0x31b34e,_0x49774c){var _0x2e6975,_0x1ba90d;return db[_0x9307('0x37')][_0x9307('0x52')]({'where':{'id':_0x3ac422[_0x9307('0x4b')]['id']}})[_0x9307('0x27')](handleEntityNotFound(_0x31b34e,null))['then'](function(_0x2ffb3e){if(_0x2ffb3e){_0x1ba90d=_0x2ffb3e;return _0x2ffb3e[_0x9307('0xbf')](_0x3ac422[_0x9307('0x59')][_0x9307('0x7f')],_[_0x9307('0x56')](_0x3ac422[_0x9307('0x59')],['ids','id'])||{});}return null;})[_0x9307('0x95')](function(_0x242835){var _0x13fd0f;_0x2e6975=_0x242835||[];var _0x4b547f=[];if(_0x242835){for(var _0x4c2086=0x0;_0x4c2086<_0x242835[_0x9307('0x4c')];_0x4c2086+=0x1){var _0x29fdf6=_0x242835[_0x4c2086][_0x9307('0x28')]({'plain':!![]});_0x13fd0f=squel[_0x9307('0xa1')]()[_0x9307('0xa2')](_0x9307('0xc0'))['fromQuery']([_0x9307('0xa7'),_0x9307('0xa6'),_0x9307('0xa9'),'VoiceQueueId',_0x9307('0x57'),_0x9307('0x58')],squel[_0x9307('0x80')]()[_0x9307('0x81')](_0x9307('0xa7'),'phone')[_0x9307('0x81')]('id',_0x9307('0xa6'))[_0x9307('0x81')](_0x29fdf6[_0x9307('0xa8')][_0x9307('0x89')](),_0x9307('0xa9'))[_0x9307('0x81')](_0x3ac422['params']['id'][_0x9307('0x89')](),'VoiceQueueId')[_0x9307('0x81')](_0x9307('0xc1'),_0x9307('0x57'))[_0x9307('0x81')](_0x9307('0xc1'),_0x9307('0x58'))[_0x9307('0x83')](_0x9307('0xaa'))[_0x9307('0x43')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',_0x29fdf6[_0x9307('0xa8')]['toString']())[_0x9307('0x43')](_0x9307('0xac')))[_0x9307('0x89')]();_0x4b547f['push'](db[_0x9307('0x72')][_0x9307('0x3c')](_0x13fd0f));}return BPromise[_0x9307('0x8e')](_0x4b547f);}})['then'](function(){return _0x2e6975;})[_0x9307('0x27')](respondWithResult(_0x31b34e,null))[_0x9307('0x49')](handleError(_0x31b34e,null));};exports[_0x9307('0xc2')]=function(_0x5a9f60,_0x20cb54,_0xfb3a2){return db[_0x9307('0x37')]['find']({'where':{'id':_0x5a9f60['params']['id']}})[_0x9307('0x27')](handleEntityNotFound(_0x20cb54,null))[_0x9307('0x27')](function(_0x4842d4){if(_0x4842d4){return _0x4842d4[_0x9307('0xc2')](_0x5a9f60['query']['ids']);}})[_0x9307('0x27')](function(_0x190875){if(_0x190875){return db['CmHopperBlack'][_0x9307('0x26')]({'where':{'ListId':_0x5a9f60[_0x9307('0x3c')][_0x9307('0x7f')],'VoiceQueueId':_0x5a9f60[_0x9307('0x4b')]['id']}})[_0x9307('0x27')](function(){return _0x190875;});}})['then'](respondWithStatusCode(_0x20cb54,null))['catch'](handleError(_0x20cb54,null));}; \ No newline at end of file +var _0x8f6b=['nolimit','order','sort','where','pick','filters','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','find','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','QueueCampaigns','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','rawAttributes','omit','createdAt','create','user','getHoppers','findOne','CmHopper','VoiceQueueId','findAll','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','User','online','flatMap','Agents','penalty','sequelize','transaction','each','TeamVoiceQueue','upsert','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','interface','format','SIP/%s','voicePause','emit','userVoiceQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','QueryTypes','every','TeamId','all','union','isEmpty','userVoiceQueue:remove','addAgents','ids','spread','push','removeAgents','isArray','getAgents','getMembers','CmList','getLists','addLists','dialCheckDuplicateType','always','insert','fromQuery','phone','scheduledAt','ContactId','ListId','updatedAt','toString','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper','onlyIfOpen','into','COALESCE(phone,\x27\x27)','CmHopperId','OrderBy','h.id','ci.item','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','ejs','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','redis','defaults','localhost','socket.io-emitter','register','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','VoiceQueues','inbound','outbound','filter','ignore','map','includes','value','type','name','UserProfileResource','sendStatus','stack','index','VoiceQueue','key','keys','query','model','attributes','intersection','fields','length','hasOwnProperty'];(function(_0x3a245d,_0x21d769){var _0x4867f2=function(_0x1dd270){while(--_0x1dd270){_0x3a245d['push'](_0x3a245d['shift']());}};_0x4867f2(++_0x21d769);}(_0x8f6b,0x146));var _0xb8f6=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x8f6b[_0x5447fd];return _0x15b28a;};'use strict';var emlformat=require(_0xb8f6('0x0'));var rimraf=require(_0xb8f6('0x1'));var zipdir=require(_0xb8f6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb8f6('0x3'));var moment=require(_0xb8f6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb8f6('0x5'));var util=require(_0xb8f6('0x6'));var path=require('path');var sox=require(_0xb8f6('0x7'));var csv=require('to-csv');var ejs=require(_0xb8f6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb8f6('0x9'));var squel=require('squel');var crypto=require(_0xb8f6('0xa'));var jsforce=require(_0xb8f6('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb8f6('0xc'));var Papa=require(_0xb8f6('0xd'));var Redis=require(_0xb8f6('0xe'));var authService=require(_0xb8f6('0xf'));var qs=require(_0xb8f6('0x10'));var as=require(_0xb8f6('0x11'));var hardwareService=require(_0xb8f6('0x12'));var logger=require(_0xb8f6('0x13'))(_0xb8f6('0x14'));var utils=require(_0xb8f6('0x15'));var config=require(_0xb8f6('0x16'));var licenseUtil=require(_0xb8f6('0x17'));var db=require('../../mysqldb')['db'];config[_0xb8f6('0x18')]=_[_0xb8f6('0x19')](config['redis'],{'host':_0xb8f6('0x1a'),'port':0x18eb});var socket=require(_0xb8f6('0x1b'))(new Redis(config[_0xb8f6('0x18')]));require('./voiceQueue.socket')[_0xb8f6('0x1c')](socket);function respondWithStatusCode(_0x50d3a1,_0x237dc3){_0x237dc3=_0x237dc3||0xcc;return function(_0x2aee53){if(_0x2aee53){return _0x50d3a1['sendStatus'](_0x237dc3);}return _0x50d3a1['status'](_0x237dc3)[_0xb8f6('0x1d')]();};}function respondWithResult(_0x28c214,_0x2db63b){_0x2db63b=_0x2db63b||0xc8;return function(_0x8f42ec){if(_0x8f42ec){return _0x28c214[_0xb8f6('0x1e')](_0x2db63b)[_0xb8f6('0x1f')](_0x8f42ec);}};}function respondWithFilteredResult(_0x2e998b,_0x30c2b3){return function(_0x3592a5){if(_0x3592a5){var _0x537d5e=typeof _0x30c2b3['offset']===_0xb8f6('0x20')&&typeof _0x30c2b3[_0xb8f6('0x21')]===_0xb8f6('0x20');var _0x335e9c=_0x3592a5[_0xb8f6('0x22')];var _0x5c2506=_0x537d5e?0x0:_0x30c2b3[_0xb8f6('0x23')];var _0x13f964=_0x537d5e?_0x3592a5[_0xb8f6('0x22')]:_0x30c2b3[_0xb8f6('0x23')]+_0x30c2b3['limit'];var _0x38c93e;if(_0x13f964>=_0x335e9c){_0x13f964=_0x335e9c;_0x38c93e=0xc8;}else{_0x38c93e=0xce;}_0x2e998b[_0xb8f6('0x1e')](_0x38c93e);return _0x2e998b[_0xb8f6('0x24')](_0xb8f6('0x25'),_0x5c2506+'-'+_0x13f964+'/'+_0x335e9c)[_0xb8f6('0x1f')](_0x3592a5);}return null;};}function patchUpdates(_0x59c5f1){return function(_0x3805d7){try{jsonpatch[_0xb8f6('0x26')](_0x3805d7,_0x59c5f1,!![]);}catch(_0x4e62c0){return BPromise[_0xb8f6('0x27')](_0x4e62c0);}return _0x3805d7[_0xb8f6('0x28')]();};}function saveUpdates(_0x3a4fd2,_0x15e0cb){return function(_0x4ca430){if(_0x4ca430){return _0x4ca430[_0xb8f6('0x29')](_0x3a4fd2)[_0xb8f6('0x2a')](function(_0x4fea2e){return _0x4fea2e;});}return null;};}function removeEntity(_0x3e9b2b,_0x4ee750){return function(_0x126f78){if(_0x126f78){return _0x126f78[_0xb8f6('0x2b')]()[_0xb8f6('0x2a')](function(){var _0x1b0f80=_0x126f78['get']({'plain':!![]});var _0x36ad7a=[{'name':_0xb8f6('0x2c'),'value':_0xb8f6('0x2d'),'ignore':![]},{'name':'QueueCampaigns','value':_0xb8f6('0x2e'),'ignore':![]}];var _0x2c0600=_(_0x36ad7a)[_0xb8f6('0x2f')](_0xb8f6('0x30'))[_0xb8f6('0x31')]('value')['value']();if(_[_0xb8f6('0x32')](_0x2c0600,_0x1b0f80['type'])){return;}var _0x2f98ff=_['find'](_0x36ad7a,[_0xb8f6('0x33'),_0x1b0f80[_0xb8f6('0x34')]])[_0xb8f6('0x35')];return db[_0xb8f6('0x36')][_0xb8f6('0x2b')]({'where':{'type':_0x2f98ff,'resourceId':_0x1b0f80['id']}})[_0xb8f6('0x2a')](function(){return _0x126f78;});})[_0xb8f6('0x2a')](function(){_0x3e9b2b[_0xb8f6('0x1e')](0xcc)[_0xb8f6('0x1d')]();});}};}function handleEntityNotFound(_0x5b509a,_0x23def4){return function(_0x1173cb){if(!_0x1173cb){_0x5b509a[_0xb8f6('0x37')](0x194);}return _0x1173cb;};}function handleError(_0xcb1a51,_0x4c5c52){_0x4c5c52=_0x4c5c52||0x1f4;return function(_0x3bfc5a){logger['error'](_0x3bfc5a[_0xb8f6('0x38')]);if(_0x3bfc5a[_0xb8f6('0x35')]){delete _0x3bfc5a[_0xb8f6('0x35')];}_0xcb1a51[_0xb8f6('0x1e')](_0x4c5c52)['send'](_0x3bfc5a);};}exports[_0xb8f6('0x39')]=function(_0x4b5f65,_0x3b268b){var _0x546081={},_0x238778={},_0x5e9c8f={'count':0x0,'rows':[]};var _0x2bf4d2=_[_0xb8f6('0x31')](db[_0xb8f6('0x3a')]['rawAttributes'],function(_0x2ba31c){return{'name':_0x2ba31c['fieldName'],'type':_0x2ba31c[_0xb8f6('0x34')][_0xb8f6('0x3b')]};});_0x238778['model']=_[_0xb8f6('0x31')](_0x2bf4d2,_0xb8f6('0x35'));_0x238778['query']=_[_0xb8f6('0x3c')](_0x4b5f65[_0xb8f6('0x3d')]);_0x238778['filters']=_['intersection'](_0x238778[_0xb8f6('0x3e')],_0x238778[_0xb8f6('0x3d')]);_0x546081[_0xb8f6('0x3f')]=_[_0xb8f6('0x40')](_0x238778[_0xb8f6('0x3e')],qs[_0xb8f6('0x41')](_0x4b5f65['query'][_0xb8f6('0x41')]));_0x546081[_0xb8f6('0x3f')]=_0x546081[_0xb8f6('0x3f')][_0xb8f6('0x42')]?_0x546081[_0xb8f6('0x3f')]:_0x238778[_0xb8f6('0x3e')];if(!_0x4b5f65['query'][_0xb8f6('0x43')](_0xb8f6('0x44'))){_0x546081['limit']=qs[_0xb8f6('0x21')](_0x4b5f65[_0xb8f6('0x3d')][_0xb8f6('0x21')]);_0x546081[_0xb8f6('0x23')]=qs[_0xb8f6('0x23')](_0x4b5f65['query']['offset']);}_0x546081[_0xb8f6('0x45')]=qs['sort'](_0x4b5f65[_0xb8f6('0x3d')][_0xb8f6('0x46')]);_0x546081[_0xb8f6('0x47')]=qs['filters'](_[_0xb8f6('0x48')](_0x4b5f65[_0xb8f6('0x3d')],_0x238778[_0xb8f6('0x49')]),_0x2bf4d2);if(_0x4b5f65[_0xb8f6('0x3d')][_0xb8f6('0x2f')]){_0x546081[_0xb8f6('0x47')]=_['merge'](_0x546081[_0xb8f6('0x47')],{'$or':_[_0xb8f6('0x31')](_0x2bf4d2,function(_0x7fad7c){if(_0x7fad7c[_0xb8f6('0x34')]!==_0xb8f6('0x4a')){var _0x1a1650={};_0x1a1650[_0x7fad7c[_0xb8f6('0x35')]]={'$like':'%'+_0x4b5f65['query'][_0xb8f6('0x2f')]+'%'};return _0x1a1650;}})});}_0x546081=_[_0xb8f6('0x4b')]({},_0x546081,_0x4b5f65[_0xb8f6('0x4c')]);var _0x2d148f={'where':_0x546081[_0xb8f6('0x47')]};return db[_0xb8f6('0x3a')][_0xb8f6('0x22')](_0x2d148f)['then'](function(_0x5c1a54){_0x5e9c8f[_0xb8f6('0x22')]=_0x5c1a54;if(_0x4b5f65[_0xb8f6('0x3d')][_0xb8f6('0x4d')]){_0x546081[_0xb8f6('0x4e')]=[{'all':!![]}];}return db[_0xb8f6('0x3a')]['findAll'](_0x546081);})[_0xb8f6('0x2a')](function(_0x47e77c){_0x5e9c8f[_0xb8f6('0x4f')]=_0x47e77c;return _0x5e9c8f;})[_0xb8f6('0x2a')](respondWithFilteredResult(_0x3b268b,_0x546081))[_0xb8f6('0x50')](handleError(_0x3b268b,null));};exports[_0xb8f6('0x51')]=function(_0x331539,_0x2191ae){var _0x5702f4={'raw':![],'where':{'id':_0x331539[_0xb8f6('0x52')]['id']}},_0x47723a={};_0x47723a['model']=_[_0xb8f6('0x3c')](db['VoiceQueue']['rawAttributes']);_0x47723a['query']=_[_0xb8f6('0x3c')](_0x331539[_0xb8f6('0x3d')]);_0x47723a[_0xb8f6('0x49')]=_[_0xb8f6('0x40')](_0x47723a['model'],_0x47723a[_0xb8f6('0x3d')]);_0x5702f4[_0xb8f6('0x3f')]=_[_0xb8f6('0x40')](_0x47723a[_0xb8f6('0x3e')],qs[_0xb8f6('0x41')](_0x331539[_0xb8f6('0x3d')][_0xb8f6('0x41')]));_0x5702f4['attributes']=_0x5702f4['attributes'][_0xb8f6('0x42')]?_0x5702f4[_0xb8f6('0x3f')]:_0x47723a[_0xb8f6('0x3e')];if(_0x331539[_0xb8f6('0x3d')][_0xb8f6('0x4d')]){_0x5702f4[_0xb8f6('0x4e')]=[{'all':!![]}];}_0x5702f4=_[_0xb8f6('0x4b')]({},_0x5702f4,_0x331539[_0xb8f6('0x4c')]);return db[_0xb8f6('0x3a')][_0xb8f6('0x53')](_0x5702f4)[_0xb8f6('0x2a')](handleEntityNotFound(_0x2191ae,null))['then'](respondWithResult(_0x2191ae,null))[_0xb8f6('0x50')](handleError(_0x2191ae,null));};exports['create']=function(_0x17b711,_0x5a5180){return db[_0xb8f6('0x3a')]['create'](_0x17b711[_0xb8f6('0x54')],{})['then'](function(_0x50bb2f){var _0x22ea73=_0x17b711['user']['get']({'plain':!![]});if(!_0x22ea73)throw new Error(_0xb8f6('0x55'));if(_0x22ea73[_0xb8f6('0x56')]==='user'){var _0x9440c8=_0x50bb2f[_0xb8f6('0x57')]({'plain':!![]});var _0x1a2328=[{'name':_0xb8f6('0x2c'),'value':_0xb8f6('0x2d')},{'name':_0xb8f6('0x58'),'value':'outbound'}];var _0x242c89=_['find'](_0x1a2328,[_0xb8f6('0x33'),_0x9440c8[_0xb8f6('0x34')]])[_0xb8f6('0x35')];return db['UserProfileSection']['find']({'where':{'name':_0x242c89,'userProfileId':_0x22ea73[_0xb8f6('0x59')]},'raw':!![]})[_0xb8f6('0x2a')](function(_0x5b397d){if(_0x5b397d&&_0x5b397d[_0xb8f6('0x5a')]===0x0){return db['UserProfileResource']['create']({'name':_0x9440c8['name'],'resourceId':_0x9440c8['id'],'type':_0x5b397d[_0xb8f6('0x35')],'sectionId':_0x5b397d['id']},{})[_0xb8f6('0x2a')](function(){return _0x50bb2f;});}else{return _0x50bb2f;}})['catch'](function(_0x362858){logger[_0xb8f6('0x5b')](_0xb8f6('0x5c'),_0x362858);throw _0x362858;});}return _0x50bb2f;})[_0xb8f6('0x2a')](respondWithResult(_0x5a5180,0xc9))[_0xb8f6('0x50')](handleError(_0x5a5180,null));};exports[_0xb8f6('0x5d')]=function(_0x26ceb6,_0x2463ed){var _0x12b485={'where':{'id':_0x26ceb6[_0xb8f6('0x52')]['id']}},_0x401e9f={};_0x401e9f[_0xb8f6('0x3e')]=_[_0xb8f6('0x3c')](db[_0xb8f6('0x3a')][_0xb8f6('0x5e')]);_0x12b485[_0xb8f6('0x3f')]=_[_0xb8f6('0x40')](_0x401e9f[_0xb8f6('0x3e')],qs[_0xb8f6('0x41')](_0x26ceb6[_0xb8f6('0x3d')]['fields']));_0x12b485[_0xb8f6('0x3f')]=_0x12b485['attributes'][_0xb8f6('0x42')]?_0x12b485[_0xb8f6('0x3f')]:_0x401e9f[_0xb8f6('0x3e')];if(_0x26ceb6[_0xb8f6('0x3d')][_0xb8f6('0x4d')]){_0x12b485[_0xb8f6('0x4e')]=[{'all':!![]}];}_0x12b485=_[_0xb8f6('0x4b')]({},_0x12b485,_0x26ceb6[_0xb8f6('0x4c')]);return db['VoiceQueue'][_0xb8f6('0x53')](_0x12b485)[_0xb8f6('0x2a')](handleEntityNotFound(_0x2463ed,null))[_0xb8f6('0x2a')](function(_0x1a1910){if(_0x1a1910){var _0x3587eb=_0x1a1910[_0xb8f6('0x57')]({'plain':!![]});_0x3587eb=qs[_0xb8f6('0x5f')](_0x3587eb,['id',_0xb8f6('0x60'),'updatedAt']);_0x26ceb6[_0xb8f6('0x54')]=_[_0xb8f6('0x5f')](_0x26ceb6[_0xb8f6('0x54')],['id',_0xb8f6('0x60'),'updatedAt']);return db[_0xb8f6('0x3a')][_0xb8f6('0x61')](_[_0xb8f6('0x4b')](_0x3587eb,_0x26ceb6[_0xb8f6('0x54')]),{'include':_0x26ceb6[_0xb8f6('0x3d')][_0xb8f6('0x4d')]?[{'all':!![]}]:undefined})[_0xb8f6('0x2a')](function(_0xce53f){var _0x2312d5=_0x26ceb6[_0xb8f6('0x62')][_0xb8f6('0x57')]({'plain':!![]});if(!_0x2312d5)throw new Error(_0xb8f6('0x55'));if(_0x2312d5[_0xb8f6('0x56')]==='user'){var _0x3dfa2d=_0xce53f['get']({'plain':!![]});var _0x3da374=[{'name':_0xb8f6('0x2c'),'value':_0xb8f6('0x2d')},{'name':'QueueCampaigns','value':_0xb8f6('0x2e')}];var _0x256df0=_[_0xb8f6('0x53')](_0x3da374,['value',_0x3dfa2d[_0xb8f6('0x34')]])['name'];return db['UserProfileSection'][_0xb8f6('0x53')]({'where':{'name':_0x256df0,'userProfileId':_0x2312d5[_0xb8f6('0x59')]},'raw':!![]})[_0xb8f6('0x2a')](function(_0x5556d5){if(_0x5556d5&&_0x5556d5[_0xb8f6('0x5a')]===0x0){return db[_0xb8f6('0x36')][_0xb8f6('0x61')]({'name':_0x3dfa2d[_0xb8f6('0x35')],'resourceId':_0x3dfa2d['id'],'type':_0x5556d5['name'],'sectionId':_0x5556d5['id']},{})['then'](function(){return _0xce53f;});}else{return _0xce53f;}})['catch'](function(_0x37873f){logger[_0xb8f6('0x5b')](_0xb8f6('0x5c'),_0x37873f);throw _0x37873f;});}return _0xce53f;});}})[_0xb8f6('0x2a')](respondWithResult(_0x2463ed,0xc9))[_0xb8f6('0x50')](handleError(_0x2463ed,null));};exports['update']=function(_0x34baf2,_0xf170e3){if(_0x34baf2[_0xb8f6('0x54')]['id']){delete _0x34baf2[_0xb8f6('0x54')]['id'];}return db[_0xb8f6('0x3a')][_0xb8f6('0x53')]({'where':{'id':_0x34baf2[_0xb8f6('0x52')]['id']}})[_0xb8f6('0x2a')](handleEntityNotFound(_0xf170e3,null))[_0xb8f6('0x2a')](saveUpdates(_0x34baf2[_0xb8f6('0x54')],null))[_0xb8f6('0x2a')](respondWithResult(_0xf170e3,null))['catch'](handleError(_0xf170e3,null));};exports[_0xb8f6('0x2b')]=function(_0x55b72e,_0x5b547a){return db[_0xb8f6('0x3a')][_0xb8f6('0x53')]({'where':{'id':_0x55b72e[_0xb8f6('0x52')]['id']}})[_0xb8f6('0x2a')](handleEntityNotFound(_0x5b547a,null))['then'](removeEntity(_0x5b547a,null))[_0xb8f6('0x50')](handleError(_0x5b547a,null));};exports[_0xb8f6('0x63')]=function(_0x442b9d,_0x18967c,_0x3f04b2){var _0x454ca0={'raw':![],'where':{}};var _0x4684fb={};var _0x33f846={'count':0x0,'rows':[]};return db[_0xb8f6('0x3a')][_0xb8f6('0x64')]({'where':{'id':_0x442b9d['params']['id']}})[_0xb8f6('0x2a')](handleEntityNotFound(_0x18967c,null))[_0xb8f6('0x2a')](function(_0x3ae9c4){if(_0x3ae9c4){_0x4684fb[_0xb8f6('0x3e')]=_[_0xb8f6('0x3c')](db[_0xb8f6('0x65')][_0xb8f6('0x5e')]);_0x4684fb[_0xb8f6('0x3d')]=_[_0xb8f6('0x3c')](_0x442b9d[_0xb8f6('0x3d')]);_0x4684fb[_0xb8f6('0x49')]=_[_0xb8f6('0x40')](_0x4684fb[_0xb8f6('0x3e')],_0x4684fb['query']);_0x454ca0[_0xb8f6('0x3f')]=_['intersection'](_0x4684fb[_0xb8f6('0x3e')],qs[_0xb8f6('0x41')](_0x442b9d[_0xb8f6('0x3d')][_0xb8f6('0x41')]));_0x454ca0[_0xb8f6('0x3f')]=_0x454ca0['attributes'][_0xb8f6('0x42')]?_0x454ca0[_0xb8f6('0x3f')]:_0x4684fb[_0xb8f6('0x3e')];if(!_0x442b9d[_0xb8f6('0x3d')][_0xb8f6('0x43')](_0xb8f6('0x44'))){_0x454ca0[_0xb8f6('0x21')]=qs['limit'](_0x442b9d[_0xb8f6('0x3d')]['limit']);_0x454ca0['offset']=qs[_0xb8f6('0x23')](_0x442b9d[_0xb8f6('0x3d')][_0xb8f6('0x23')]);}_0x454ca0[_0xb8f6('0x45')]=qs['sort'](_0x442b9d[_0xb8f6('0x3d')][_0xb8f6('0x46')]);_0x454ca0['where']=qs['filters'](_[_0xb8f6('0x48')](_0x442b9d[_0xb8f6('0x3d')],_0x4684fb['filters']));_0x454ca0[_0xb8f6('0x47')][_0xb8f6('0x66')]=_0x3ae9c4['id'];if(_0x442b9d[_0xb8f6('0x3d')][_0xb8f6('0x2f')]){_0x454ca0[_0xb8f6('0x47')]=_[_0xb8f6('0x4b')](_0x454ca0[_0xb8f6('0x47')],{'$or':_['map'](_0x454ca0[_0xb8f6('0x3f')],function(_0x567190){var _0x42180c={};_0x42180c[_0x567190]={'$like':'%'+_0x442b9d[_0xb8f6('0x3d')][_0xb8f6('0x2f')]+'%'};return _0x42180c;})});}_0x454ca0=_['merge']({},_0x454ca0,_0x442b9d[_0xb8f6('0x4c')]);return db[_0xb8f6('0x65')][_0xb8f6('0x22')]({'where':_0x454ca0[_0xb8f6('0x47')]})[_0xb8f6('0x2a')](function(_0x28998e){_0x33f846['count']=_0x28998e;if(_0x442b9d['query']['includeAll']){_0x454ca0[_0xb8f6('0x4e')]=[{'all':!![]}];}return db[_0xb8f6('0x65')][_0xb8f6('0x67')](_0x454ca0);})[_0xb8f6('0x2a')](function(_0x5926c2){_0x33f846[_0xb8f6('0x4f')]=_0x5926c2;return _0x33f846;});}})[_0xb8f6('0x2a')](respondWithFilteredResult(_0x18967c,_0x454ca0))['catch'](handleError(_0x18967c,null));};exports['getHopperHistories']=function(_0x41bf59,_0x2c8055,_0x37e28c){var _0x164219={'raw':!![],'where':{}};var _0x435e8e={};var _0x4ad371={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x41bf59['params']['id']}})[_0xb8f6('0x2a')](handleEntityNotFound(_0x2c8055,null))[_0xb8f6('0x2a')](function(_0x583afa){if(_0x583afa){_0x435e8e[_0xb8f6('0x3e')]=_['keys'](db['CmHopperHistory'][_0xb8f6('0x5e')]);_0x435e8e['query']=_[_0xb8f6('0x3c')](_0x41bf59['query']);_0x435e8e[_0xb8f6('0x49')]=_[_0xb8f6('0x40')](_0x435e8e[_0xb8f6('0x3e')],_0x435e8e[_0xb8f6('0x3d')]);_0x164219[_0xb8f6('0x3f')]=_['intersection'](_0x435e8e[_0xb8f6('0x3e')],qs[_0xb8f6('0x41')](_0x41bf59[_0xb8f6('0x3d')][_0xb8f6('0x41')]));_0x164219[_0xb8f6('0x3f')]=_0x164219[_0xb8f6('0x3f')][_0xb8f6('0x42')]?_0x164219['attributes']:_0x435e8e[_0xb8f6('0x3e')];if(!_0x41bf59['query'][_0xb8f6('0x43')](_0xb8f6('0x44'))){_0x164219[_0xb8f6('0x21')]=qs[_0xb8f6('0x21')](_0x41bf59['query'][_0xb8f6('0x21')]);_0x164219[_0xb8f6('0x23')]=qs[_0xb8f6('0x23')](_0x41bf59[_0xb8f6('0x3d')]['offset']);}_0x164219[_0xb8f6('0x45')]=qs[_0xb8f6('0x46')](_0x41bf59[_0xb8f6('0x3d')][_0xb8f6('0x46')]);_0x164219['where']=qs['filters'](_[_0xb8f6('0x48')](_0x41bf59[_0xb8f6('0x3d')],_0x435e8e[_0xb8f6('0x49')]));_0x164219[_0xb8f6('0x47')][_0xb8f6('0x66')]=_0x583afa['id'];if(_0x41bf59['query']['filter']){_0x164219[_0xb8f6('0x47')]=_[_0xb8f6('0x4b')](_0x164219[_0xb8f6('0x47')],{'$or':_[_0xb8f6('0x31')](_0x164219['attributes'],function(_0x5347f5){var _0x27622d={};_0x27622d[_0x5347f5]={'$like':'%'+_0x41bf59[_0xb8f6('0x3d')][_0xb8f6('0x2f')]+'%'};return _0x27622d;})});}_0x164219=_[_0xb8f6('0x4b')]({},_0x164219,_0x41bf59[_0xb8f6('0x4c')]);return db[_0xb8f6('0x68')][_0xb8f6('0x22')]({'where':_0x164219[_0xb8f6('0x47')]})[_0xb8f6('0x2a')](function(_0x36ad59){_0x4ad371['count']=_0x36ad59;if(_0x41bf59[_0xb8f6('0x3d')][_0xb8f6('0x4d')]){_0x164219[_0xb8f6('0x4e')]=[{'all':!![]}];}return db[_0xb8f6('0x68')]['findAll'](_0x164219);})[_0xb8f6('0x2a')](function(_0x47ab85){_0x4ad371[_0xb8f6('0x4f')]=_0x47ab85;return _0x4ad371;});}})[_0xb8f6('0x2a')](respondWithFilteredResult(_0x2c8055,_0x164219))['catch'](handleError(_0x2c8055,null));};exports[_0xb8f6('0x69')]=function(_0x34b15c,_0x8cc47c,_0x343168){var _0x910baa={'raw':!![],'where':{}};var _0x25e482={};var _0x562671={'count':0x0,'rows':[]};return db[_0xb8f6('0x3a')]['findOne']({'where':{'id':_0x34b15c[_0xb8f6('0x52')]['id']}})[_0xb8f6('0x2a')](handleEntityNotFound(_0x8cc47c,null))[_0xb8f6('0x2a')](function(_0x2feb9c){if(_0x2feb9c){_0x25e482['model']=_['keys'](db[_0xb8f6('0x6a')][_0xb8f6('0x5e')]);_0x25e482['query']=_[_0xb8f6('0x3c')](_0x34b15c[_0xb8f6('0x3d')]);_0x25e482[_0xb8f6('0x49')]=_['intersection'](_0x25e482[_0xb8f6('0x3e')],_0x25e482[_0xb8f6('0x3d')]);_0x910baa['attributes']=_[_0xb8f6('0x40')](_0x25e482[_0xb8f6('0x3e')],qs[_0xb8f6('0x41')](_0x34b15c[_0xb8f6('0x3d')]['fields']));_0x910baa['attributes']=_0x910baa[_0xb8f6('0x3f')]['length']?_0x910baa[_0xb8f6('0x3f')]:_0x25e482[_0xb8f6('0x3e')];if(!_0x34b15c[_0xb8f6('0x3d')][_0xb8f6('0x43')]('nolimit')){_0x910baa['limit']=qs[_0xb8f6('0x21')](_0x34b15c[_0xb8f6('0x3d')][_0xb8f6('0x21')]);_0x910baa[_0xb8f6('0x23')]=qs['offset'](_0x34b15c['query'][_0xb8f6('0x23')]);}_0x910baa[_0xb8f6('0x45')]=qs[_0xb8f6('0x46')](_0x34b15c['query'][_0xb8f6('0x46')]);_0x910baa[_0xb8f6('0x47')]=qs[_0xb8f6('0x49')](_['pick'](_0x34b15c[_0xb8f6('0x3d')],_0x25e482[_0xb8f6('0x49')]));_0x910baa[_0xb8f6('0x47')]['VoiceQueueId']=_0x2feb9c['id'];if(_0x34b15c[_0xb8f6('0x3d')][_0xb8f6('0x2f')]){_0x910baa[_0xb8f6('0x47')]=_[_0xb8f6('0x4b')](_0x910baa[_0xb8f6('0x47')],{'$or':_[_0xb8f6('0x31')](_0x910baa[_0xb8f6('0x3f')],function(_0x280031){var _0x17aca4={};_0x17aca4[_0x280031]={'$like':'%'+_0x34b15c[_0xb8f6('0x3d')][_0xb8f6('0x2f')]+'%'};return _0x17aca4;})});}_0x910baa=_[_0xb8f6('0x4b')]({},_0x910baa,_0x34b15c[_0xb8f6('0x4c')]);return db[_0xb8f6('0x6a')][_0xb8f6('0x22')]({'where':_0x910baa[_0xb8f6('0x47')]})[_0xb8f6('0x2a')](function(_0x3c2134){_0x562671['count']=_0x3c2134;if(_0x34b15c[_0xb8f6('0x3d')]['includeAll']){_0x910baa[_0xb8f6('0x4e')]=[{'all':!![]}];}return db[_0xb8f6('0x6a')]['findAll'](_0x910baa);})['then'](function(_0x2773f2){_0x562671['rows']=_0x2773f2;return _0x562671;});}})[_0xb8f6('0x2a')](respondWithFilteredResult(_0x8cc47c,_0x910baa))['catch'](handleError(_0x8cc47c,null));};exports[_0xb8f6('0x6b')]=function(_0x240edd,_0x590b72,_0x4433ab){var _0x45addb={'raw':!![],'where':{}};var _0x175cc2={};var _0x380191={'count':0x0,'rows':[]};return db[_0xb8f6('0x3a')]['findOne']({'where':{'id':_0x240edd[_0xb8f6('0x52')]['id']}})[_0xb8f6('0x2a')](handleEntityNotFound(_0x590b72,null))[_0xb8f6('0x2a')](function(_0x230f75){if(_0x230f75){_0x175cc2[_0xb8f6('0x3e')]=_[_0xb8f6('0x3c')](db[_0xb8f6('0x6c')][_0xb8f6('0x5e')]);_0x175cc2['query']=_['keys'](_0x240edd['query']);_0x175cc2[_0xb8f6('0x49')]=_['intersection'](_0x175cc2[_0xb8f6('0x3e')],_0x175cc2[_0xb8f6('0x3d')]);_0x45addb[_0xb8f6('0x3f')]=_[_0xb8f6('0x40')](_0x175cc2[_0xb8f6('0x3e')],qs[_0xb8f6('0x41')](_0x240edd[_0xb8f6('0x3d')]['fields']));_0x45addb[_0xb8f6('0x3f')]=_0x45addb[_0xb8f6('0x3f')][_0xb8f6('0x42')]?_0x45addb[_0xb8f6('0x3f')]:_0x175cc2[_0xb8f6('0x3e')];if(!_0x240edd[_0xb8f6('0x3d')][_0xb8f6('0x43')](_0xb8f6('0x44'))){_0x45addb[_0xb8f6('0x21')]=qs[_0xb8f6('0x21')](_0x240edd[_0xb8f6('0x3d')][_0xb8f6('0x21')]);_0x45addb[_0xb8f6('0x23')]=qs[_0xb8f6('0x23')](_0x240edd[_0xb8f6('0x3d')]['offset']);}_0x45addb[_0xb8f6('0x45')]=qs[_0xb8f6('0x46')](_0x240edd['query'][_0xb8f6('0x46')]);_0x45addb[_0xb8f6('0x47')]=qs[_0xb8f6('0x49')](_[_0xb8f6('0x48')](_0x240edd['query'],_0x175cc2[_0xb8f6('0x49')]));_0x45addb[_0xb8f6('0x47')][_0xb8f6('0x66')]=_0x230f75['id'];if(_0x240edd['query']['filter']){_0x45addb[_0xb8f6('0x47')]=_[_0xb8f6('0x4b')](_0x45addb[_0xb8f6('0x47')],{'$or':_[_0xb8f6('0x31')](_0x45addb['attributes'],function(_0x2a63ae){var _0xa4666f={};_0xa4666f[_0x2a63ae]={'$like':'%'+_0x240edd['query'][_0xb8f6('0x2f')]+'%'};return _0xa4666f;})});}_0x45addb=_['merge']({},_0x45addb,_0x240edd[_0xb8f6('0x4c')]);return db[_0xb8f6('0x6c')]['count']({'where':_0x45addb[_0xb8f6('0x47')]})['then'](function(_0x451740){_0x380191[_0xb8f6('0x22')]=_0x451740;if(_0x240edd[_0xb8f6('0x3d')]['includeAll']){_0x45addb[_0xb8f6('0x4e')]=[{'all':!![]}];}return db[_0xb8f6('0x6c')][_0xb8f6('0x67')](_0x45addb);})[_0xb8f6('0x2a')](function(_0x379f58){_0x380191[_0xb8f6('0x4f')]=_0x379f58;return _0x380191;});}})[_0xb8f6('0x2a')](respondWithFilteredResult(_0x590b72,_0x45addb))['catch'](handleError(_0x590b72,null));};exports[_0xb8f6('0x6d')]=function(_0x12b220,_0x49403d,_0x24a2ec){var _0xbab6b3={};var _0x18a0df={};var _0x2187c0;var _0x5677a6;return db[_0xb8f6('0x3a')][_0xb8f6('0x64')]({'where':{'id':_0x12b220['params']['id']}})[_0xb8f6('0x2a')](handleEntityNotFound(_0x49403d,null))[_0xb8f6('0x2a')](function(_0x4820ac){if(_0x4820ac){_0x2187c0=_0x4820ac;_0x18a0df[_0xb8f6('0x3e')]=_[_0xb8f6('0x3c')](db[_0xb8f6('0x6e')][_0xb8f6('0x5e')]);_0x18a0df['query']=_[_0xb8f6('0x3c')](_0x12b220[_0xb8f6('0x3d')]);_0x18a0df[_0xb8f6('0x49')]=_[_0xb8f6('0x40')](_0x18a0df[_0xb8f6('0x3e')],_0x18a0df['query']);_0xbab6b3['attributes']=_[_0xb8f6('0x40')](_0x18a0df[_0xb8f6('0x3e')],qs[_0xb8f6('0x41')](_0x12b220[_0xb8f6('0x3d')][_0xb8f6('0x41')]));_0xbab6b3['attributes']=_0xbab6b3[_0xb8f6('0x3f')][_0xb8f6('0x42')]?_0xbab6b3[_0xb8f6('0x3f')]:_0x18a0df[_0xb8f6('0x3e')];_0xbab6b3[_0xb8f6('0x45')]=qs['sort'](_0x12b220[_0xb8f6('0x3d')]['sort']);_0xbab6b3[_0xb8f6('0x47')]=qs[_0xb8f6('0x49')](_[_0xb8f6('0x48')](_0x12b220[_0xb8f6('0x3d')],_0x18a0df[_0xb8f6('0x49')]));if(_0x12b220['query'][_0xb8f6('0x2f')]){_0xbab6b3[_0xb8f6('0x47')]=_[_0xb8f6('0x4b')](_0xbab6b3[_0xb8f6('0x47')],{'$or':_['map'](_0xbab6b3[_0xb8f6('0x3f')],function(_0x566fea){var _0x5b402f={};_0x5b402f[_0x566fea]={'$like':'%'+_0x12b220['query'][_0xb8f6('0x2f')]+'%'};return _0x5b402f;})});}_0xbab6b3=_[_0xb8f6('0x4b')]({},_0xbab6b3,_0x12b220['options']);return _0x2187c0[_0xb8f6('0x6d')](_0xbab6b3);}})[_0xb8f6('0x2a')](function(_0x37109d){if(_0x37109d){_0x5677a6=_0x37109d['length'];if(!_0x12b220['query']['hasOwnProperty']('nolimit')){_0xbab6b3[_0xb8f6('0x21')]=qs[_0xb8f6('0x21')](_0x12b220[_0xb8f6('0x3d')][_0xb8f6('0x21')]);_0xbab6b3[_0xb8f6('0x23')]=qs['offset'](_0x12b220[_0xb8f6('0x3d')]['offset']);}return _0x2187c0['getTeams'](_0xbab6b3);}})[_0xb8f6('0x2a')](function(_0xa80e81){if(_0xa80e81){return _0xa80e81?{'count':_0x5677a6,'rows':_0xa80e81}:null;}})[_0xb8f6('0x2a')](respondWithResult(_0x49403d,null))['catch'](handleError(_0x49403d,null));};exports[_0xb8f6('0x6f')]=function(_0x9c9558,_0x164f8a,_0x6e4170){var _0x3927e7=_0x9c9558[_0xb8f6('0x54')][_0xb8f6('0x70')];var _0x254e42=_[_0xb8f6('0x31')](_0x3927e7,'id');return db[_0xb8f6('0x6e')][_0xb8f6('0x67')]({'where':{'id':_0x254e42},'attributes':['id'],'include':[{'model':db[_0xb8f6('0x71')],'as':'Agents','attributes':['id',_0xb8f6('0x35'),_0xb8f6('0x72'),'voicePause','interface'],'raw':!![]}]})['then'](function(_0x41dfc0){if(_0x41dfc0){var _0x117c53=_[_0xb8f6('0x73')](_0x41dfc0,function(_0x4e1696){var _0x2e714b=_0x4e1696[_0xb8f6('0x57')]({'plain':!![]});_0x2e714b[_0xb8f6('0x74')]['forEach'](function(_0x1a3c91){_0x1a3c91[_0xb8f6('0x75')]=_[_0xb8f6('0x53')](_0x3927e7,{'id':_0x2e714b['id']})[_0xb8f6('0x75')];});return _0x2e714b[_0xb8f6('0x74')];});return db[_0xb8f6('0x3a')][_0xb8f6('0x53')]({'where':{'id':_0x9c9558[_0xb8f6('0x52')]['id']}})['then'](function(_0x1685fd){return db[_0xb8f6('0x76')][_0xb8f6('0x77')](function(_0x12f8a){return _0x1685fd[_0xb8f6('0x6f')](_0x254e42,{'transaction':_0x12f8a})['then'](function(){return BPromise[_0xb8f6('0x78')](_0x3927e7,function(_0x55b680){return db[_0xb8f6('0x79')][_0xb8f6('0x7a')]({'TeamId':_0x55b680['id'],'VoiceQueueId':_0x9c9558[_0xb8f6('0x52')]['id'],'penalty':_0x55b680['penalty']},{'transaction':_0x12f8a});});})[_0xb8f6('0x2a')](function(){return BPromise[_0xb8f6('0x78')](_0x117c53,function(_0x437491){return db[_0xb8f6('0x7b')][_0xb8f6('0x7c')]({'where':{'UserId':_0x437491['id'],'VoiceQueueId':_0x9c9558['params']['id']},'defaults':{'penalty':_0x437491[_0xb8f6('0x75')]},'transaction':_0x12f8a});});})['then'](function(){return BPromise[_0xb8f6('0x78')](_[_0xb8f6('0x2f')](_0x117c53,{'online':!![]}),function(_0x1ca744){return db[_0xb8f6('0x7d')][_0xb8f6('0x7a')]({'membername':_0x1ca744[_0xb8f6('0x35')],'UserId':_0x1ca744['id'],'queue_name':_0x1685fd[_0xb8f6('0x35')],'VoiceQueueId':_0x1685fd['id'],'interface':_[_0xb8f6('0x7e')](_0x1ca744[_0xb8f6('0x7f')])?util[_0xb8f6('0x80')](_0xb8f6('0x81'),_0x1ca744['name']):_0x1ca744[_0xb8f6('0x7f')],'paused':_0x1ca744[_0xb8f6('0x82')]||![],'penalty':_0x1ca744[_0xb8f6('0x75')]},{'transaction':_0x12f8a});});})[_0xb8f6('0x2a')](function(){_0x117c53['forEach'](function(_0x2ea673){socket[_0xb8f6('0x83')](_0xb8f6('0x84'),{'UserId':_0x2ea673['id'],'VoiceQueueId':_0x1685fd['id']});});});});});}})[_0xb8f6('0x2a')](respondWithStatusCode(_0x164f8a,null))[_0xb8f6('0x50')](handleError(_0x164f8a,null));};exports[_0xb8f6('0x85')]=function(_0x4c3e2a,_0x2f91cc,_0x5f1cb9){return db[_0xb8f6('0x6e')][_0xb8f6('0x67')]({'where':{'id':_0x4c3e2a[_0xb8f6('0x3d')]['ids']},'attributes':['id'],'include':[{'model':db[_0xb8f6('0x71')],'as':_0xb8f6('0x74'),'attributes':['id'],'raw':!![]}]})[_0xb8f6('0x2a')](handleEntityNotFound(_0x2f91cc,null))[_0xb8f6('0x2a')](function(_0x243b99){var _0x43111a=_[_0xb8f6('0x31')](_0x243b99,'id');var _0x2194c8=[];var _0x2dbbb2=[];var _0x2e585e=squel[_0xb8f6('0x86')]();_0x2e585e[_0xb8f6('0x87')](_0xb8f6('0x88'))[_0xb8f6('0x89')](_0xb8f6('0x8a'),'tq')[_0xb8f6('0x8b')](_0xb8f6('0x8c'),'ut',_0xb8f6('0x8d'))[_0xb8f6('0x47')](_0xb8f6('0x8e'),_0x4c3e2a[_0xb8f6('0x52')]['id']);for(var _0x272257=0x0;_0x272257<_0x243b99[_0xb8f6('0x42')];_0x272257+=0x1){let _0x4bdf28=_0x243b99[_0x272257];for(var _0x27bc7a=0x0;_0x27bc7a<_0x4bdf28[_0xb8f6('0x74')][_0xb8f6('0x42')];_0x27bc7a+=0x1){let _0x58f1c=_0x4bdf28[_0xb8f6('0x74')][_0x27bc7a];var _0x1260fe=_0x2e585e[_0xb8f6('0x5d')]();_0x1260fe['where'](_0xb8f6('0x8f'),_0x58f1c['id']);_0x2dbbb2['push'](db[_0xb8f6('0x76')][_0xb8f6('0x3d')](_0x1260fe['toString'](),{'type':db[_0xb8f6('0x76')][_0xb8f6('0x90')]['SELECT']})['then'](function(_0x24c879){if(_0x24c879[_0xb8f6('0x42')]===0x1){return _0x58f1c['id'];}else{var _0x4fbaa6=_[_0xb8f6('0x91')](_['map'](_0x24c879,_0xb8f6('0x92')),function(_0x4e8c0f){return _[_0xb8f6('0x32')](_0x43111a,_0x4e8c0f);});if(_0x4fbaa6){return _0x58f1c['id'];}}}));}}return BPromise[_0xb8f6('0x93')](_0x2dbbb2)['then'](function(_0x4164f5){_0x2194c8=_(_0x2194c8)[_0xb8f6('0x94')](_0x4164f5)['compact']()[_0xb8f6('0x33')]();return db[_0xb8f6('0x3a')][_0xb8f6('0x53')]({'where':{'id':_0x4c3e2a[_0xb8f6('0x52')]['id']}})[_0xb8f6('0x2a')](function(_0x2ed3d7){return db['sequelize'][_0xb8f6('0x77')](function(_0xdc912f){return _0x2ed3d7[_0xb8f6('0x85')](_0x4c3e2a[_0xb8f6('0x3d')]['ids'],{'transaction':_0xdc912f})[_0xb8f6('0x2a')](function(){if(!_[_0xb8f6('0x95')](_0x2194c8)){return _0x2ed3d7['removeAgents'](_0x2194c8,{'transaction':_0xdc912f})[_0xb8f6('0x2a')](function(){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x4c3e2a['params']['id'],'UserId':_0x2194c8},'transaction':_0xdc912f});});}})[_0xb8f6('0x2a')](function(){_0x2194c8['forEach'](function(_0x4b5007){socket[_0xb8f6('0x83')](_0xb8f6('0x96'),{'UserId':_0x4b5007,'VoiceQueueId':_0x2ed3d7['id']});});});});});});})[_0xb8f6('0x2a')](respondWithStatusCode(_0x2f91cc,null))['catch'](handleError(_0x2f91cc,null));};exports[_0xb8f6('0x97')]=function(_0x2271d4,_0x49c3a6,_0x159c45){var _0x58330f,_0x568960;return db[_0xb8f6('0x3a')][_0xb8f6('0x53')]({'where':{'id':_0x2271d4[_0xb8f6('0x52')]['id']}})[_0xb8f6('0x2a')](handleEntityNotFound(_0x49c3a6,null))['then'](function(_0x5a7274){if(_0x5a7274){_0x568960=_0x5a7274;return _0x5a7274[_0xb8f6('0x97')](_0x2271d4[_0xb8f6('0x54')][_0xb8f6('0x98')],_[_0xb8f6('0x5f')](_0x2271d4[_0xb8f6('0x54')],[_0xb8f6('0x98'),'id'])||{})[_0xb8f6('0x99')](function(_0x2cc0f8){for(var _0x2f0270=0x0;_0x2f0270<_0x2271d4[_0xb8f6('0x54')]['ids'][_0xb8f6('0x42')];_0x2f0270+=0x1){socket['emit']('userVoiceQueue:save',{'UserId':Number(_0x2271d4[_0xb8f6('0x54')][_0xb8f6('0x98')][_0x2f0270]),'VoiceQueueId':Number(_0x2271d4[_0xb8f6('0x52')]['id'])});}return _0x2cc0f8;});}})[_0xb8f6('0x2a')](function(_0x4c2b73){_0x58330f=_0x4c2b73||[];if(_0x568960){return db[_0xb8f6('0x71')]['findAll']({'where':{'id':_0x2271d4[_0xb8f6('0x54')]['ids']},'attributes':['id',_0xb8f6('0x35'),'online',_0xb8f6('0x82'),_0xb8f6('0x7f')],'raw':!![]});}})['then'](function(_0x30add6){if(!_[_0xb8f6('0x95')](_0x30add6)){var _0x10423b=[];for(var _0x365532=0x0;_0x365532<_0x30add6['length'];_0x365532++){if(_0x30add6[_0x365532][_0xb8f6('0x72')]){_0x10423b[_0xb8f6('0x9a')](db['UserVoiceQueueRt']['upsert']({'membername':_0x30add6[_0x365532]['name'],'UserId':_0x30add6[_0x365532]['id'],'queue_name':_0x568960[_0xb8f6('0x35')],'VoiceQueueId':_0x568960['id'],'interface':_[_0xb8f6('0x7e')](_0x30add6[_0x365532][_0xb8f6('0x7f')])?util[_0xb8f6('0x80')](_0xb8f6('0x81'),_0x30add6[_0x365532][_0xb8f6('0x35')]):_0x30add6[_0x365532][_0xb8f6('0x7f')],'paused':_0x30add6[_0x365532][_0xb8f6('0x82')]||![],'penalty':_0x2271d4[_0xb8f6('0x54')]['penalty']||0x0}));}}return BPromise[_0xb8f6('0x93')](_0x10423b);}})[_0xb8f6('0x2a')](function(){return _0x58330f;})['then'](respondWithResult(_0x49c3a6,null))['catch'](handleError(_0x49c3a6,null));};exports[_0xb8f6('0x9b')]=function(_0x3a234a,_0xa55633,_0x391b2e){return db['VoiceQueue'][_0xb8f6('0x53')]({'where':{'id':_0x3a234a[_0xb8f6('0x52')]['id']}})[_0xb8f6('0x2a')](handleEntityNotFound(_0xa55633,null))[_0xb8f6('0x2a')](function(_0x49365a){if(_0x49365a){return _0x49365a[_0xb8f6('0x9b')](_0x3a234a[_0xb8f6('0x3d')][_0xb8f6('0x98')])[_0xb8f6('0x2a')](function(){if(_[_0xb8f6('0x9c')](_0x3a234a[_0xb8f6('0x3d')][_0xb8f6('0x98')])){for(var _0x801f2e=0x0;_0x801f2e<_0x3a234a[_0xb8f6('0x3d')][_0xb8f6('0x98')][_0xb8f6('0x42')];_0x801f2e+=0x1){socket[_0xb8f6('0x83')](_0xb8f6('0x96'),{'UserId':Number(_0x3a234a[_0xb8f6('0x3d')]['ids'][_0x801f2e]),'VoiceQueueId':Number(_0x3a234a[_0xb8f6('0x52')]['id'])});}}else{socket[_0xb8f6('0x83')](_0xb8f6('0x96'),{'UserId':Number(_0x3a234a['query']['ids']),'VoiceQueueId':Number(_0x3a234a[_0xb8f6('0x52')]['id'])});}});}})[_0xb8f6('0x2a')](function(_0xded28c){return db[_0xb8f6('0x7d')][_0xb8f6('0x2b')]({'where':{'VoiceQueueId':_0x3a234a[_0xb8f6('0x52')]['id'],'UserId':_0x3a234a[_0xb8f6('0x3d')]['ids']}})['then'](function(){return _0xded28c;});})[_0xb8f6('0x2a')](respondWithStatusCode(_0xa55633,null))[_0xb8f6('0x50')](handleError(_0xa55633,null));};exports['getAgents']=function(_0x302960,_0xf4e658,_0xc2d373){var _0x22dd7c={};var _0x2c0d95={};var _0x4c1e01;var _0x51d40e;return db[_0xb8f6('0x3a')][_0xb8f6('0x64')]({'where':{'id':_0x302960[_0xb8f6('0x52')]['id']}})['then'](handleEntityNotFound(_0xf4e658,null))[_0xb8f6('0x2a')](function(_0x3c8ed5){if(_0x3c8ed5){_0x4c1e01=_0x3c8ed5;_0x2c0d95[_0xb8f6('0x3e')]=_[_0xb8f6('0x3c')](db[_0xb8f6('0x71')][_0xb8f6('0x5e')]);_0x2c0d95[_0xb8f6('0x3d')]=_['keys'](_0x302960[_0xb8f6('0x3d')]);_0x2c0d95['filters']=_['intersection'](_0x2c0d95[_0xb8f6('0x3e')],_0x2c0d95[_0xb8f6('0x3d')]);_0x22dd7c['attributes']=_[_0xb8f6('0x40')](_0x2c0d95['model'],qs[_0xb8f6('0x41')](_0x302960[_0xb8f6('0x3d')]['fields']));_0x22dd7c[_0xb8f6('0x3f')]=_0x22dd7c[_0xb8f6('0x3f')][_0xb8f6('0x42')]?_0x22dd7c[_0xb8f6('0x3f')]:_0x2c0d95[_0xb8f6('0x3e')];_0x22dd7c['order']=qs[_0xb8f6('0x46')](_0x302960['query'][_0xb8f6('0x46')]);_0x22dd7c[_0xb8f6('0x47')]=qs['filters'](_[_0xb8f6('0x48')](_0x302960['query'],_0x2c0d95['filters']));if(_0x302960[_0xb8f6('0x3d')][_0xb8f6('0x2f')]){_0x22dd7c['where']=_[_0xb8f6('0x4b')](_0x22dd7c[_0xb8f6('0x47')],{'$or':_[_0xb8f6('0x31')](_0x22dd7c['attributes'],function(_0x43a6af){var _0x52d4df={};_0x52d4df[_0x43a6af]={'$like':'%'+_0x302960[_0xb8f6('0x3d')][_0xb8f6('0x2f')]+'%'};return _0x52d4df;})});}_0x22dd7c=_['merge']({},_0x22dd7c,_0x302960[_0xb8f6('0x4c')]);return _0x4c1e01['getAgents'](_0x22dd7c);}})[_0xb8f6('0x2a')](function(_0x52e0ef){if(_0x52e0ef){_0x51d40e=_0x52e0ef[_0xb8f6('0x42')];if(!_0x302960[_0xb8f6('0x3d')][_0xb8f6('0x43')](_0xb8f6('0x44'))){_0x22dd7c[_0xb8f6('0x21')]=qs[_0xb8f6('0x21')](_0x302960[_0xb8f6('0x3d')][_0xb8f6('0x21')]);_0x22dd7c[_0xb8f6('0x23')]=qs[_0xb8f6('0x23')](_0x302960['query'][_0xb8f6('0x23')]);}return _0x4c1e01[_0xb8f6('0x9d')](_0x22dd7c);}})[_0xb8f6('0x2a')](function(_0x5ac6a8){if(_0x5ac6a8){return _0x5ac6a8?{'count':_0x51d40e,'rows':_0x5ac6a8}:null;}})[_0xb8f6('0x2a')](respondWithResult(_0xf4e658,null))[_0xb8f6('0x50')](handleError(_0xf4e658,null));};exports[_0xb8f6('0x9e')]=function(_0x550a63,_0x50dcbe,_0x4563b1){var _0x3f9b3d={};var _0x2d17f6={};var _0x3f0209;var _0x122e64;return db[_0xb8f6('0x3a')][_0xb8f6('0x64')]({'where':{'id':_0x550a63[_0xb8f6('0x52')]['id']}})['then'](handleEntityNotFound(_0x50dcbe,null))[_0xb8f6('0x2a')](function(_0x16f845){if(_0x16f845){_0x3f0209=_0x16f845;_0x2d17f6[_0xb8f6('0x3e')]=_[_0xb8f6('0x3c')](db[_0xb8f6('0x7d')][_0xb8f6('0x5e')]);_0x2d17f6['query']=_[_0xb8f6('0x3c')](_0x550a63[_0xb8f6('0x3d')]);_0x2d17f6['filters']=_['intersection'](_0x2d17f6[_0xb8f6('0x3e')],_0x2d17f6['query']);_0x3f9b3d['attributes']=_[_0xb8f6('0x40')](_0x2d17f6[_0xb8f6('0x3e')],qs[_0xb8f6('0x41')](_0x550a63[_0xb8f6('0x3d')][_0xb8f6('0x41')]));_0x3f9b3d[_0xb8f6('0x3f')]=_0x3f9b3d[_0xb8f6('0x3f')][_0xb8f6('0x42')]?_0x3f9b3d[_0xb8f6('0x3f')]:_0x2d17f6['model'];_0x3f9b3d['order']=qs[_0xb8f6('0x46')](_0x550a63[_0xb8f6('0x3d')]['sort']);_0x3f9b3d[_0xb8f6('0x47')]=qs['filters'](_[_0xb8f6('0x48')](_0x550a63['query'],_0x2d17f6[_0xb8f6('0x49')]));if(_0x550a63[_0xb8f6('0x3d')][_0xb8f6('0x2f')]){_0x3f9b3d[_0xb8f6('0x47')]=_[_0xb8f6('0x4b')](_0x3f9b3d[_0xb8f6('0x47')],{'$or':_[_0xb8f6('0x31')](_0x3f9b3d[_0xb8f6('0x3f')],function(_0x5d8a0b){var _0x20e569={};_0x20e569[_0x5d8a0b]={'$like':'%'+_0x550a63[_0xb8f6('0x3d')][_0xb8f6('0x2f')]+'%'};return _0x20e569;})});}_0x3f9b3d=_[_0xb8f6('0x4b')]({},_0x3f9b3d,_0x550a63[_0xb8f6('0x4c')]);return _0x3f0209[_0xb8f6('0x9e')](_0x3f9b3d);}})[_0xb8f6('0x2a')](function(_0x57edb5){if(_0x57edb5){_0x122e64=_0x57edb5[_0xb8f6('0x42')];if(!_0x550a63[_0xb8f6('0x3d')]['hasOwnProperty'](_0xb8f6('0x44'))){_0x3f9b3d[_0xb8f6('0x21')]=qs[_0xb8f6('0x21')](_0x550a63[_0xb8f6('0x3d')][_0xb8f6('0x21')]);_0x3f9b3d['offset']=qs['offset'](_0x550a63[_0xb8f6('0x3d')][_0xb8f6('0x23')]);}return _0x3f0209[_0xb8f6('0x9e')](_0x3f9b3d);}})[_0xb8f6('0x2a')](function(_0x214b9a){return _0x214b9a?{'count':_0x122e64,'rows':_0x214b9a}:null;})[_0xb8f6('0x2a')](respondWithResult(_0x50dcbe,null))[_0xb8f6('0x50')](handleError(_0x50dcbe,null));};exports['getLists']=function(_0x475791,_0x4cfa57,_0x113a60){var _0x47ebea={};var _0x41db42={};var _0x3c9e30;var _0x2f5bf3;return db[_0xb8f6('0x3a')][_0xb8f6('0x64')]({'where':{'id':_0x475791[_0xb8f6('0x52')]['id']}})[_0xb8f6('0x2a')](handleEntityNotFound(_0x4cfa57,null))[_0xb8f6('0x2a')](function(_0x528156){if(_0x528156){_0x3c9e30=_0x528156;_0x41db42[_0xb8f6('0x3e')]=_[_0xb8f6('0x3c')](db[_0xb8f6('0x9f')][_0xb8f6('0x5e')]);_0x41db42[_0xb8f6('0x3d')]=_[_0xb8f6('0x3c')](_0x475791[_0xb8f6('0x3d')]);_0x41db42['filters']=_[_0xb8f6('0x40')](_0x41db42['model'],_0x41db42['query']);_0x47ebea['attributes']=_[_0xb8f6('0x40')](_0x41db42[_0xb8f6('0x3e')],qs[_0xb8f6('0x41')](_0x475791[_0xb8f6('0x3d')]['fields']));_0x47ebea[_0xb8f6('0x3f')]=_0x47ebea[_0xb8f6('0x3f')][_0xb8f6('0x42')]?_0x47ebea[_0xb8f6('0x3f')]:_0x41db42[_0xb8f6('0x3e')];_0x47ebea['order']=qs[_0xb8f6('0x46')](_0x475791[_0xb8f6('0x3d')][_0xb8f6('0x46')]);_0x47ebea[_0xb8f6('0x47')]=qs[_0xb8f6('0x49')](_[_0xb8f6('0x48')](_0x475791[_0xb8f6('0x3d')],_0x41db42[_0xb8f6('0x49')]));if(_0x475791[_0xb8f6('0x3d')][_0xb8f6('0x2f')]){_0x47ebea[_0xb8f6('0x47')]=_['merge'](_0x47ebea[_0xb8f6('0x47')],{'$or':_['map'](_0x47ebea['attributes'],function(_0x32d87a){var _0x4cbc95={};_0x4cbc95[_0x32d87a]={'$like':'%'+_0x475791[_0xb8f6('0x3d')]['filter']+'%'};return _0x4cbc95;})});}_0x47ebea=_[_0xb8f6('0x4b')]({},_0x47ebea,_0x475791[_0xb8f6('0x4c')]);return _0x3c9e30['getLists'](_0x47ebea);}})[_0xb8f6('0x2a')](function(_0xf54ae9){if(_0xf54ae9){_0x2f5bf3=_0xf54ae9[_0xb8f6('0x42')];if(!_0x475791[_0xb8f6('0x3d')][_0xb8f6('0x43')](_0xb8f6('0x44'))){_0x47ebea[_0xb8f6('0x21')]=qs[_0xb8f6('0x21')](_0x475791[_0xb8f6('0x3d')]['limit']);_0x47ebea[_0xb8f6('0x23')]=qs['offset'](_0x475791['query']['offset']);}return _0x3c9e30[_0xb8f6('0xa0')](_0x47ebea);}})['then'](function(_0x1ad4a3){if(_0x1ad4a3){return _0x1ad4a3?{'count':_0x2f5bf3,'rows':_0x1ad4a3}:null;}})[_0xb8f6('0x2a')](respondWithResult(_0x4cfa57,null))[_0xb8f6('0x50')](handleError(_0x4cfa57,null));};exports[_0xb8f6('0xa1')]=function(_0x44d034,_0x5ba34a,_0xbafd08){var _0x20f45f=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x1ebb54,_0xcf5610;return db['VoiceQueue']['find']({'where':{'id':_0x44d034['params']['id']}})[_0xb8f6('0x2a')](handleEntityNotFound(_0x5ba34a,null))['then'](function(_0x154f01){if(_0x154f01){_0xcf5610=_0x154f01;return _0x154f01[_0xb8f6('0xa1')](_0x44d034[_0xb8f6('0x54')][_0xb8f6('0x98')],_[_0xb8f6('0x5f')](_0x44d034[_0xb8f6('0x54')],[_0xb8f6('0x98'),'id'])||{});}return null;})[_0xb8f6('0x99')](function(_0x2fb788){var _0x489313;_0x1ebb54=_0x2fb788||[];var _0x33ca2a=[];if(_0x2fb788){for(var _0x575018=0x0;_0x575018<_0x2fb788['length'];_0x575018+=0x1){var _0x2e57da=_0x2fb788[_0x575018][_0xb8f6('0x57')]({'plain':!![]});_0xcf5610[_0xb8f6('0xa2')]=_0x44d034['body']['dialCheckDuplicateType']?_0x44d034[_0xb8f6('0x54')][_0xb8f6('0xa2')]:_0xcf5610[_0xb8f6('0xa2')];switch(_0xcf5610['dialCheckDuplicateType']){case _0xb8f6('0xa3'):_0x489313=squel[_0xb8f6('0xa4')]()['into']('cm_hopper')[_0xb8f6('0xa5')]([_0xb8f6('0xa6'),_0xb8f6('0xa7'),_0xb8f6('0xa8'),_0xb8f6('0xa9'),_0xb8f6('0x66'),_0xb8f6('0x60'),_0xb8f6('0xaa')],squel[_0xb8f6('0x86')]()[_0xb8f6('0x87')](_0xb8f6('0xa6'),'phone')['field']('\x27'+_0x20f45f+'\x27',_0xb8f6('0xa7'))[_0xb8f6('0x87')]('id',_0xb8f6('0xa8'))['field'](_0x2e57da['CmListId'][_0xb8f6('0xab')](),'ListId')[_0xb8f6('0x87')](_0x44d034[_0xb8f6('0x52')]['id']['toString'](),_0xb8f6('0x66'))['field']('\x27'+_0x20f45f+'\x27',_0xb8f6('0x60'))['field']('\x27'+_0x20f45f+'\x27',_0xb8f6('0xaa'))[_0xb8f6('0x89')](_0xb8f6('0xac'))[_0xb8f6('0x47')](_0xb8f6('0xad'))[_0xb8f6('0x47')](_0xb8f6('0xae'),_0x2e57da[_0xb8f6('0xaf')][_0xb8f6('0xab')]())[_0xb8f6('0x47')](_0xb8f6('0xb0'))[_0xb8f6('0x47')]('phone\x20NOT\x20IN\x20(?)',squel[_0xb8f6('0x86')]()[_0xb8f6('0x87')](_0xb8f6('0xb1'))[_0xb8f6('0x89')]('cm_hopper_final')[_0xb8f6('0x47')](_0xb8f6('0x8e'),_0x44d034[_0xb8f6('0x52')]['id'][_0xb8f6('0xab')]()))[_0xb8f6('0x47')]('phone\x20NOT\x20IN\x20(?)',squel[_0xb8f6('0x86')]()['field']('COALESCE(phone,\x27\x27)')[_0xb8f6('0x89')](_0xb8f6('0xb2'))[_0xb8f6('0x47')](_0xb8f6('0x8e'),_0x44d034[_0xb8f6('0x52')]['id']['toString']())))[_0xb8f6('0xab')]();break;case _0xb8f6('0xb3'):_0x489313=squel[_0xb8f6('0xa4')]()[_0xb8f6('0xb4')](_0xb8f6('0xb2'))['fromQuery']([_0xb8f6('0xa6'),_0xb8f6('0xa7'),_0xb8f6('0xa8'),_0xb8f6('0xa9'),'VoiceQueueId',_0xb8f6('0x60'),_0xb8f6('0xaa')],squel['select']()[_0xb8f6('0x87')]('phone',_0xb8f6('0xa6'))[_0xb8f6('0x87')]('\x27'+_0x20f45f+'\x27',_0xb8f6('0xa7'))[_0xb8f6('0x87')]('id',_0xb8f6('0xa8'))[_0xb8f6('0x87')](_0x2e57da[_0xb8f6('0xaf')]['toString'](),_0xb8f6('0xa9'))[_0xb8f6('0x87')](_0x44d034[_0xb8f6('0x52')]['id']['toString'](),'VoiceQueueId')[_0xb8f6('0x87')]('\x27'+_0x20f45f+'\x27',_0xb8f6('0x60'))[_0xb8f6('0x87')]('\x27'+_0x20f45f+'\x27','updatedAt')['from'](_0xb8f6('0xac'))[_0xb8f6('0x47')](_0xb8f6('0xad'))[_0xb8f6('0x47')]('ListId\x20=\x20?',_0x2e57da[_0xb8f6('0xaf')]['toString']())[_0xb8f6('0x47')]('phone\x20IS\x20NOT\x20NULL')['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xb8f6('0x86')]()['field'](_0xb8f6('0xb5'))['from'](_0xb8f6('0xb2'))[_0xb8f6('0x47')](_0xb8f6('0x8e'),_0x44d034[_0xb8f6('0x52')]['id'][_0xb8f6('0xab')]())))[_0xb8f6('0xab')]();break;default:_0x489313=squel[_0xb8f6('0xa4')]()[_0xb8f6('0xb4')]('cm_hopper')['fromQuery'](['phone',_0xb8f6('0xa7'),_0xb8f6('0xa8'),'ListId',_0xb8f6('0x66'),_0xb8f6('0x60'),_0xb8f6('0xaa')],squel['select']()[_0xb8f6('0x87')](_0xb8f6('0xa6'),_0xb8f6('0xa6'))[_0xb8f6('0x87')]('\x27'+_0x20f45f+'\x27','scheduledAt')[_0xb8f6('0x87')]('id',_0xb8f6('0xa8'))[_0xb8f6('0x87')](_0x2e57da[_0xb8f6('0xaf')][_0xb8f6('0xab')](),_0xb8f6('0xa9'))[_0xb8f6('0x87')](_0x44d034['params']['id'][_0xb8f6('0xab')](),'VoiceQueueId')[_0xb8f6('0x87')]('\x27'+_0x20f45f+'\x27',_0xb8f6('0x60'))['field']('\x27'+_0x20f45f+'\x27',_0xb8f6('0xaa'))['from'](_0xb8f6('0xac'))[_0xb8f6('0x47')](_0xb8f6('0xad'))[_0xb8f6('0x47')]('ListId\x20=\x20?',_0x2e57da['CmListId'][_0xb8f6('0xab')]())['where'](_0xb8f6('0xb0')))[_0xb8f6('0xab')]();}_0x33ca2a[_0xb8f6('0x9a')](db[_0xb8f6('0x76')][_0xb8f6('0x3d')](_0x489313));}return BPromise['all'](_0x33ca2a);}})[_0xb8f6('0x2a')](function(){var _0x3a1dcc=[];var _0x41c30a=squel['insert']()['into']('cm_hopper_additional_phones')[_0xb8f6('0xa5')]([_0xb8f6('0xb6'),_0xb8f6('0xa6'),_0xb8f6('0xb7'),'createdAt',_0xb8f6('0xaa')],squel['select']()['field'](_0xb8f6('0xb8'))[_0xb8f6('0x87')](_0xb8f6('0xb9'))[_0xb8f6('0x87')]('ci.OrderBy+1')[_0xb8f6('0x87')]('\x27'+_0x20f45f+'\x27',_0xb8f6('0x60'))['field']('\x27'+_0x20f45f+'\x27',_0xb8f6('0xaa'))['from'](_0xb8f6('0xba'),'ci')[_0xb8f6('0x8b')]('cm_hopper','h',_0xb8f6('0xbb'))[_0xb8f6('0x47')](_0xb8f6('0xbc'),_0x20f45f)[_0xb8f6('0x47')](_0xb8f6('0xbd'),_0xb8f6('0xbe')))[_0xb8f6('0xab')]();_0x3a1dcc[_0xb8f6('0x9a')](db[_0xb8f6('0x76')][_0xb8f6('0x3d')](_0x41c30a));return BPromise[_0xb8f6('0x93')](_0x3a1dcc);})[_0xb8f6('0x2a')](function(){return _0x1ebb54;})[_0xb8f6('0x2a')](respondWithResult(_0x5ba34a,null))[_0xb8f6('0x50')](handleError(_0x5ba34a,null));};exports['removeLists']=function(_0x579e0e,_0x431240,_0x245f88){return db[_0xb8f6('0x3a')][_0xb8f6('0x53')]({'where':{'id':_0x579e0e['params']['id']}})[_0xb8f6('0x2a')](handleEntityNotFound(_0x431240,null))['then'](function(_0x2aaf49){if(_0x2aaf49){return _0x2aaf49[_0xb8f6('0xbf')](_0x579e0e[_0xb8f6('0x3d')][_0xb8f6('0x98')]);}})[_0xb8f6('0x2a')](function(_0x21c5b6){if(_0x21c5b6){return db[_0xb8f6('0x65')][_0xb8f6('0x2b')]({'where':{'ListId':_0x579e0e[_0xb8f6('0x3d')][_0xb8f6('0x98')],'VoiceQueueId':_0x579e0e['params']['id']}})[_0xb8f6('0x2a')](function(){return _0x21c5b6;});}})[_0xb8f6('0x2a')](respondWithStatusCode(_0x431240,null))['catch'](handleError(_0x431240,null));};exports[_0xb8f6('0xc0')]=function(_0x40d0f0,_0x22da7a,_0x2df9cb){var _0x50d060={};var _0x3cb302={};var _0x433956;var _0xd39fa4;return db['VoiceQueue'][_0xb8f6('0x64')]({'where':{'id':_0x40d0f0[_0xb8f6('0x52')]['id']}})['then'](handleEntityNotFound(_0x22da7a,null))[_0xb8f6('0x2a')](function(_0x239212){if(_0x239212){_0x433956=_0x239212;_0x3cb302[_0xb8f6('0x3e')]=_[_0xb8f6('0x3c')](db[_0xb8f6('0x9f')][_0xb8f6('0x5e')]);_0x3cb302[_0xb8f6('0x3d')]=_[_0xb8f6('0x3c')](_0x40d0f0['query']);_0x3cb302[_0xb8f6('0x49')]=_[_0xb8f6('0x40')](_0x3cb302[_0xb8f6('0x3e')],_0x3cb302[_0xb8f6('0x3d')]);_0x50d060[_0xb8f6('0x3f')]=_[_0xb8f6('0x40')](_0x3cb302[_0xb8f6('0x3e')],qs[_0xb8f6('0x41')](_0x40d0f0[_0xb8f6('0x3d')]['fields']));_0x50d060[_0xb8f6('0x3f')]=_0x50d060[_0xb8f6('0x3f')][_0xb8f6('0x42')]?_0x50d060[_0xb8f6('0x3f')]:_0x3cb302[_0xb8f6('0x3e')];_0x50d060[_0xb8f6('0x45')]=qs[_0xb8f6('0x46')](_0x40d0f0[_0xb8f6('0x3d')][_0xb8f6('0x46')]);_0x50d060[_0xb8f6('0x47')]=qs['filters'](_[_0xb8f6('0x48')](_0x40d0f0[_0xb8f6('0x3d')],_0x3cb302[_0xb8f6('0x49')]));if(_0x40d0f0[_0xb8f6('0x3d')][_0xb8f6('0x2f')]){_0x50d060[_0xb8f6('0x47')]=_[_0xb8f6('0x4b')](_0x50d060[_0xb8f6('0x47')],{'$or':_[_0xb8f6('0x31')](_0x50d060[_0xb8f6('0x3f')],function(_0x293261){var _0x4e41c7={};_0x4e41c7[_0x293261]={'$like':'%'+_0x40d0f0['query'][_0xb8f6('0x2f')]+'%'};return _0x4e41c7;})});}_0x50d060=_[_0xb8f6('0x4b')]({},_0x50d060,_0x40d0f0[_0xb8f6('0x4c')]);return _0x433956[_0xb8f6('0xc0')](_0x50d060);}})[_0xb8f6('0x2a')](function(_0x445fa2){if(_0x445fa2){_0xd39fa4=_0x445fa2[_0xb8f6('0x42')];if(!_0x40d0f0[_0xb8f6('0x3d')][_0xb8f6('0x43')](_0xb8f6('0x44'))){_0x50d060['limit']=qs[_0xb8f6('0x21')](_0x40d0f0[_0xb8f6('0x3d')]['limit']);_0x50d060[_0xb8f6('0x23')]=qs['offset'](_0x40d0f0['query'][_0xb8f6('0x23')]);}return _0x433956[_0xb8f6('0xc0')](_0x50d060);}})[_0xb8f6('0x2a')](function(_0x226d61){if(_0x226d61){return _0x226d61?{'count':_0xd39fa4,'rows':_0x226d61}:null;}})[_0xb8f6('0x2a')](respondWithResult(_0x22da7a,null))[_0xb8f6('0x50')](handleError(_0x22da7a,null));};exports[_0xb8f6('0xc1')]=function(_0x3f4148,_0x1c17d5,_0x33cee2){var _0x5cdd96,_0x15684a;return db['VoiceQueue']['find']({'where':{'id':_0x3f4148[_0xb8f6('0x52')]['id']}})[_0xb8f6('0x2a')](handleEntityNotFound(_0x1c17d5,null))['then'](function(_0x22c171){if(_0x22c171){_0x15684a=_0x22c171;return _0x22c171[_0xb8f6('0xc1')](_0x3f4148[_0xb8f6('0x54')][_0xb8f6('0x98')],_[_0xb8f6('0x5f')](_0x3f4148[_0xb8f6('0x54')],[_0xb8f6('0x98'),'id'])||{});}return null;})['spread'](function(_0xdc77d7){var _0x2a2c54;_0x5cdd96=_0xdc77d7||[];var _0x80606d=[];if(_0xdc77d7){for(var _0x40a393=0x0;_0x40a393<_0xdc77d7[_0xb8f6('0x42')];_0x40a393+=0x1){var _0x1c2a07=_0xdc77d7[_0x40a393][_0xb8f6('0x57')]({'plain':!![]});_0x2a2c54=squel['insert']()['into'](_0xb8f6('0xc2'))[_0xb8f6('0xa5')]([_0xb8f6('0xa6'),_0xb8f6('0xa8'),_0xb8f6('0xa9'),_0xb8f6('0x66'),_0xb8f6('0x60'),'updatedAt'],squel[_0xb8f6('0x86')]()[_0xb8f6('0x87')](_0xb8f6('0xa6'),'phone')['field']('id',_0xb8f6('0xa8'))[_0xb8f6('0x87')](_0x1c2a07[_0xb8f6('0xaf')][_0xb8f6('0xab')](),_0xb8f6('0xa9'))[_0xb8f6('0x87')](_0x3f4148[_0xb8f6('0x52')]['id'][_0xb8f6('0xab')](),_0xb8f6('0x66'))['field'](_0xb8f6('0xc3'),'createdAt')['field'](_0xb8f6('0xc3'),_0xb8f6('0xaa'))[_0xb8f6('0x89')](_0xb8f6('0xac'))[_0xb8f6('0x47')](_0xb8f6('0xad'))[_0xb8f6('0x47')](_0xb8f6('0xae'),_0x1c2a07[_0xb8f6('0xaf')][_0xb8f6('0xab')]())['where'](_0xb8f6('0xb0')))[_0xb8f6('0xab')]();_0x80606d[_0xb8f6('0x9a')](db[_0xb8f6('0x76')]['query'](_0x2a2c54));}return BPromise[_0xb8f6('0x93')](_0x80606d);}})[_0xb8f6('0x2a')](function(){return _0x5cdd96;})[_0xb8f6('0x2a')](respondWithResult(_0x1c17d5,null))[_0xb8f6('0x50')](handleError(_0x1c17d5,null));};exports['removeBlackLists']=function(_0x33e334,_0x3b7526,_0x1020d7){return db['VoiceQueue'][_0xb8f6('0x53')]({'where':{'id':_0x33e334[_0xb8f6('0x52')]['id']}})[_0xb8f6('0x2a')](handleEntityNotFound(_0x3b7526,null))[_0xb8f6('0x2a')](function(_0x246a2b){if(_0x246a2b){return _0x246a2b[_0xb8f6('0xc4')](_0x33e334['query'][_0xb8f6('0x98')]);}})[_0xb8f6('0x2a')](function(_0xf37127){if(_0xf37127){return db[_0xb8f6('0x6c')][_0xb8f6('0x2b')]({'where':{'ListId':_0x33e334[_0xb8f6('0x3d')][_0xb8f6('0x98')],'VoiceQueueId':_0x33e334[_0xb8f6('0x52')]['id']}})['then'](function(){return _0xf37127;});}})[_0xb8f6('0x2a')](respondWithStatusCode(_0x3b7526,null))['catch'](handleError(_0x3b7526,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index f4d1cea..6d0f303 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 _0x6d4a=['remove','emit','exports','events','../../mysqldb','VoiceQueue','save'];(function(_0x4f6377,_0x348124){var _0x276428=function(_0x45b4b6){while(--_0x45b4b6){_0x4f6377['push'](_0x4f6377['shift']());}};_0x276428(++_0x348124);}(_0x6d4a,0x10d));var _0xa6d4=function(_0x462ea7,_0x37869a){_0x462ea7=_0x462ea7-0x0;var _0x4abbc1=_0x6d4a[_0x462ea7];return _0x4abbc1;};'use strict';var EventEmitter=require(_0xa6d4('0x0'));var VoiceQueue=require(_0xa6d4('0x1'))['db'][_0xa6d4('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa6d4('0x3'),'afterUpdate':'update','afterDestroy':_0xa6d4('0x4')};function emitEvent(_0xed4b03){return function(_0x3a7972,_0x307216,_0x20a824){VoiceQueueEvents[_0xa6d4('0x5')](_0xed4b03+':'+_0x3a7972['id'],_0x3a7972);VoiceQueueEvents['emit'](_0xed4b03,_0x3a7972);_0x20a824(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0xa6d4('0x6')]=VoiceQueueEvents; \ No newline at end of file +var _0x7121=['hook','exports','events','../../mysqldb','VoiceQueue','save','emit','hasOwnProperty'];(function(_0x5bdb83,_0x3605de){var _0x1986bb=function(_0x2d6e94){while(--_0x2d6e94){_0x5bdb83['push'](_0x5bdb83['shift']());}};_0x1986bb(++_0x3605de);}(_0x7121,0xf2));var _0x1712=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x7121[_0x618414];return _0x21c19a;};'use strict';var EventEmitter=require(_0x1712('0x0'));var VoiceQueue=require(_0x1712('0x1'))['db'][_0x1712('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1712('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1a50b0){return function(_0x1ce6df,_0x56b786,_0x1a320e){VoiceQueueEvents[_0x1712('0x4')](_0x1a50b0+':'+_0x1ce6df['id'],_0x1ce6df);VoiceQueueEvents[_0x1712('0x4')](_0x1a50b0,_0x1ce6df);_0x1a320e(null);};}for(var e in events){if(events[_0x1712('0x5')](e)){var event=events[e];VoiceQueue[_0x1712('0x6')](e,emitEvent(event));}}module[_0x1712('0x7')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 61f7a3c..56d738e 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 _0x3e74=['exports','VoiceQueue','voice_queues','lodash','../../config/logger','api','moment','path','../../config/environment','./voiceQueue.attributes'];(function(_0x4941c6,_0x3ca9f8){var _0x4d3654=function(_0x5295c8){while(--_0x5295c8){_0x4941c6['push'](_0x4941c6['shift']());}};_0x4d3654(++_0x3ca9f8);}(_0x3e74,0x175));var _0x43e7=function(_0x421947,_0x54e8f6){_0x421947=_0x421947-0x0;var _0x3feb87=_0x3e74[_0x421947];return _0x3feb87;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./voiceQueue.attributes','exports','define','VoiceQueue','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x11167e,_0x5a69e7){var _0x33f52d=function(_0x3fa91f){while(--_0x3fa91f){_0x11167e['push'](_0x11167e['shift']());}};_0x33f52d(++_0x5a69e7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'voice_queues','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 4ddf5df..0f70206 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 _0x1856=['catch','GetVoiceQueue','VoiceQueue','options','raw','attributes','limit','include','map','model','ShowVoiceQueue','find','where','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./voiceQueue.socket','register','then','info','request\x20sent','debug','stringify','error','code','VoiceQueue,\x20%s,\x20%s','message','result'];(function(_0x3a0ebd,_0x47f368){var _0x51a660=function(_0x4023e6){while(--_0x4023e6){_0x3a0ebd['push'](_0x3a0ebd['shift']());}};_0x51a660(++_0x47f368);}(_0x1856,0x1ed));var _0x6185=function(_0x52d322,_0x3e77d7){_0x52d322=_0x52d322-0x0;var _0x120311=_0x1856[_0x52d322];return _0x120311;};'use strict';var _=require(_0x6185('0x0'));var util=require(_0x6185('0x1'));var moment=require(_0x6185('0x2'));var BPromise=require(_0x6185('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6185('0x4'));var db=require(_0x6185('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6185('0x6'))(_0x6185('0x7'));var config=require(_0x6185('0x8'));var jayson=require(_0x6185('0x9'));var client=jayson[_0x6185('0xa')][_0x6185('0xb')]({'port':0x232a});config[_0x6185('0xc')]=_[_0x6185('0xd')](config['redis'],{'host':_0x6185('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6185('0xc')]));require(_0x6185('0xf'))[_0x6185('0x10')](socket);function respondWithRpcPromise(_0x29f9d0,_0x1c7863,_0x1ef2eb){return new BPromise(function(_0x38ba3b,_0x1853a4){return client['request'](_0x29f9d0,_0x1ef2eb)[_0x6185('0x11')](function(_0xaac9f8){logger[_0x6185('0x12')]('VoiceQueue,\x20%s,\x20%s',_0x1c7863,_0x6185('0x13'));logger[_0x6185('0x14')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x1c7863,'request\x20sent',JSON[_0x6185('0x15')](_0xaac9f8));if(_0xaac9f8[_0x6185('0x16')]){if(_0xaac9f8[_0x6185('0x16')][_0x6185('0x17')]===0x1f4){logger['error'](_0x6185('0x18'),_0x1c7863,_0xaac9f8[_0x6185('0x16')]['message']);return _0x1853a4(_0xaac9f8[_0x6185('0x16')][_0x6185('0x19')]);}logger[_0x6185('0x16')](_0x6185('0x18'),_0x1c7863,_0xaac9f8['error'][_0x6185('0x19')]);return _0x38ba3b(_0xaac9f8[_0x6185('0x16')][_0x6185('0x19')]);}else{logger[_0x6185('0x12')](_0x6185('0x18'),_0x1c7863,'request\x20sent');_0x38ba3b(_0xaac9f8[_0x6185('0x1a')][_0x6185('0x19')]);}})[_0x6185('0x1b')](function(_0x281535){logger[_0x6185('0x16')](_0x6185('0x18'),_0x1c7863,_0x281535);_0x1853a4(_0x281535);});});}exports[_0x6185('0x1c')]=function(_0x4fc6a6){var _0x13cf4d=this;return new Promise(function(_0x1fffef,_0x1d4ea8){return db[_0x6185('0x1d')]['findAll']({'raw':_0x4fc6a6[_0x6185('0x1e')]?_0x4fc6a6['options'][_0x6185('0x1f')]===undefined?!![]:![]:!![],'where':_0x4fc6a6[_0x6185('0x1e')]?_0x4fc6a6[_0x6185('0x1e')]['where']||null:null,'attributes':_0x4fc6a6['options']?_0x4fc6a6[_0x6185('0x1e')][_0x6185('0x20')]||null:null,'limit':_0x4fc6a6[_0x6185('0x1e')]?_0x4fc6a6[_0x6185('0x1e')][_0x6185('0x21')]||null:null,'include':_0x4fc6a6['options']?_0x4fc6a6[_0x6185('0x1e')][_0x6185('0x22')]?_[_0x6185('0x23')](_0x4fc6a6[_0x6185('0x1e')]['include'],function(_0x5df15f){return{'model':db[_0x5df15f[_0x6185('0x24')]],'as':_0x5df15f['as'],'attributes':_0x5df15f[_0x6185('0x20')],'include':_0x5df15f[_0x6185('0x22')]?_[_0x6185('0x23')](_0x5df15f['include'],function(_0xb12ae6){return{'model':db[_0xb12ae6[_0x6185('0x24')]],'as':_0xb12ae6['as'],'attributes':_0xb12ae6[_0x6185('0x20')],'include':_0xb12ae6[_0x6185('0x22')]?_[_0x6185('0x23')](_0xb12ae6[_0x6185('0x22')],function(_0x5c1264){return{'model':db[_0x5c1264[_0x6185('0x24')]],'as':_0x5c1264['as'],'attributes':_0x5c1264[_0x6185('0x20')]};}):[]};}):[]};}):[]:[]})[_0x6185('0x11')](function(_0x3ba52f){logger[_0x6185('0x12')](_0x6185('0x1c'),_0x4fc6a6);logger[_0x6185('0x14')](_0x6185('0x1c'),_0x4fc6a6,JSON['stringify'](_0x3ba52f));_0x1fffef(_0x3ba52f);})['catch'](function(_0x5e11ec){logger[_0x6185('0x16')](_0x6185('0x1c'),_0x5e11ec[_0x6185('0x19')],_0x4fc6a6);_0x1d4ea8(_0x13cf4d[_0x6185('0x16')](0x1f4,_0x5e11ec[_0x6185('0x19')]));});});};exports[_0x6185('0x25')]=function(_0x46e875){var _0x5db602=this;return new Promise(function(_0x3e4398,_0x5cbb06){return db[_0x6185('0x1d')][_0x6185('0x26')]({'raw':_0x46e875[_0x6185('0x1e')]?_0x46e875[_0x6185('0x1e')][_0x6185('0x1f')]===undefined?!![]:![]:!![],'where':_0x46e875['options']?_0x46e875[_0x6185('0x1e')][_0x6185('0x27')]||null:null,'attributes':_0x46e875[_0x6185('0x1e')]?_0x46e875[_0x6185('0x1e')][_0x6185('0x20')]||null:null,'include':_0x46e875[_0x6185('0x1e')]?_0x46e875[_0x6185('0x1e')][_0x6185('0x22')]?_[_0x6185('0x23')](_0x46e875[_0x6185('0x1e')][_0x6185('0x22')],function(_0x4ad3cc){return{'model':db[_0x4ad3cc[_0x6185('0x24')]],'as':_0x4ad3cc['as'],'attributes':_0x4ad3cc[_0x6185('0x20')],'include':_0x4ad3cc[_0x6185('0x22')]?_[_0x6185('0x23')](_0x4ad3cc[_0x6185('0x22')],function(_0x31b0a6){return{'model':db[_0x31b0a6[_0x6185('0x24')]],'as':_0x31b0a6['as'],'attributes':_0x31b0a6[_0x6185('0x20')],'include':_0x31b0a6[_0x6185('0x22')]?_[_0x6185('0x23')](_0x31b0a6['include'],function(_0xfc2280){return{'model':db[_0xfc2280[_0x6185('0x24')]],'as':_0xfc2280['as'],'attributes':_0xfc2280['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x12ee62){logger['info']('ShowVoiceQueue',_0x46e875);logger[_0x6185('0x14')](_0x6185('0x25'),_0x46e875,JSON[_0x6185('0x15')](_0x12ee62));_0x3e4398(_0x12ee62);})[_0x6185('0x1b')](function(_0x3295b9){logger['error'](_0x6185('0x25'),_0x3295b9[_0x6185('0x19')],_0x46e875);_0x5cbb06(_0x5db602['error'](0x1f4,_0x3295b9[_0x6185('0x19')]));});});}; \ No newline at end of file +var _0x746f=['VoiceQueue','findAll','options','raw','attributes','include','map','model','find','ShowVoiceQueue','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./voiceQueue.socket','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetVoiceQueue'];(function(_0x1d74d3,_0x506eda){var _0x5b02e9=function(_0x5ceb84){while(--_0x5ceb84){_0x1d74d3['push'](_0x1d74d3['shift']());}};_0x5b02e9(++_0x506eda);}(_0x746f,0x7c));var _0xf746=function(_0x5c6f45,_0x4d9473){_0x5c6f45=_0x5c6f45-0x0;var _0x59e9e7=_0x746f[_0x5c6f45];return _0x59e9e7;};'use strict';var _=require(_0xf746('0x0'));var util=require(_0xf746('0x1'));var moment=require('moment');var BPromise=require(_0xf746('0x2'));var rs=require(_0xf746('0x3'));var fs=require('fs');var Redis=require(_0xf746('0x4'));var db=require(_0xf746('0x5'))['db'];var utils=require(_0xf746('0x6'));var logger=require(_0xf746('0x7'))(_0xf746('0x8'));var config=require(_0xf746('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf746('0xa')][_0xf746('0xb')]({'port':0x232a});config[_0xf746('0xc')]=_['defaults'](config[_0xf746('0xc')],{'host':_0xf746('0xd'),'port':0x18eb});var socket=require(_0xf746('0xe'))(new Redis(config[_0xf746('0xc')]));require(_0xf746('0xf'))['register'](socket);function respondWithRpcPromise(_0x1d0058,_0x90eab1,_0x2df1ce){return new BPromise(function(_0x1742f6,_0x791143){return client[_0xf746('0x10')](_0x1d0058,_0x2df1ce)[_0xf746('0x11')](function(_0x3a2381){logger[_0xf746('0x12')](_0xf746('0x13'),_0x90eab1,_0xf746('0x14'));logger[_0xf746('0x15')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x90eab1,_0xf746('0x14'),JSON[_0xf746('0x16')](_0x3a2381));if(_0x3a2381[_0xf746('0x17')]){if(_0x3a2381[_0xf746('0x17')][_0xf746('0x18')]===0x1f4){logger[_0xf746('0x17')](_0xf746('0x13'),_0x90eab1,_0x3a2381[_0xf746('0x17')][_0xf746('0x19')]);return _0x791143(_0x3a2381['error'][_0xf746('0x19')]);}logger[_0xf746('0x17')](_0xf746('0x13'),_0x90eab1,_0x3a2381[_0xf746('0x17')][_0xf746('0x19')]);return _0x1742f6(_0x3a2381['error'][_0xf746('0x19')]);}else{logger[_0xf746('0x12')](_0xf746('0x13'),_0x90eab1,_0xf746('0x14'));_0x1742f6(_0x3a2381['result'][_0xf746('0x19')]);}})[_0xf746('0x1a')](function(_0x612640){logger[_0xf746('0x17')](_0xf746('0x13'),_0x90eab1,_0x612640);_0x791143(_0x612640);});});}exports[_0xf746('0x1b')]=function(_0x5b539f){var _0x3976db=this;return new Promise(function(_0x3cf237,_0x55a4b9){return db[_0xf746('0x1c')][_0xf746('0x1d')]({'raw':_0x5b539f['options']?_0x5b539f[_0xf746('0x1e')][_0xf746('0x1f')]===undefined?!![]:![]:!![],'where':_0x5b539f['options']?_0x5b539f[_0xf746('0x1e')]['where']||null:null,'attributes':_0x5b539f[_0xf746('0x1e')]?_0x5b539f[_0xf746('0x1e')][_0xf746('0x20')]||null:null,'limit':_0x5b539f['options']?_0x5b539f[_0xf746('0x1e')]['limit']||null:null,'include':_0x5b539f['options']?_0x5b539f[_0xf746('0x1e')][_0xf746('0x21')]?_[_0xf746('0x22')](_0x5b539f['options'][_0xf746('0x21')],function(_0x5f033f){return{'model':db[_0x5f033f[_0xf746('0x23')]],'as':_0x5f033f['as'],'attributes':_0x5f033f[_0xf746('0x20')],'include':_0x5f033f[_0xf746('0x21')]?_[_0xf746('0x22')](_0x5f033f[_0xf746('0x21')],function(_0x465bb0){return{'model':db[_0x465bb0['model']],'as':_0x465bb0['as'],'attributes':_0x465bb0[_0xf746('0x20')],'include':_0x465bb0[_0xf746('0x21')]?_['map'](_0x465bb0[_0xf746('0x21')],function(_0x2cd6f7){return{'model':db[_0x2cd6f7[_0xf746('0x23')]],'as':_0x2cd6f7['as'],'attributes':_0x2cd6f7['attributes']};}):[]};}):[]};}):[]:[]})[_0xf746('0x11')](function(_0x334b29){logger['info'](_0xf746('0x1b'),_0x5b539f);logger[_0xf746('0x15')](_0xf746('0x1b'),_0x5b539f,JSON['stringify'](_0x334b29));_0x3cf237(_0x334b29);})[_0xf746('0x1a')](function(_0x1daa8b){logger['error'](_0xf746('0x1b'),_0x1daa8b['message'],_0x5b539f);_0x55a4b9(_0x3976db[_0xf746('0x17')](0x1f4,_0x1daa8b[_0xf746('0x19')]));});});};exports['ShowVoiceQueue']=function(_0x4b57ce){var _0x28b86e=this;return new Promise(function(_0x2ddaf6,_0x14c533){return db[_0xf746('0x1c')][_0xf746('0x24')]({'raw':_0x4b57ce[_0xf746('0x1e')]?_0x4b57ce[_0xf746('0x1e')][_0xf746('0x1f')]===undefined?!![]:![]:!![],'where':_0x4b57ce['options']?_0x4b57ce[_0xf746('0x1e')]['where']||null:null,'attributes':_0x4b57ce['options']?_0x4b57ce[_0xf746('0x1e')][_0xf746('0x20')]||null:null,'include':_0x4b57ce[_0xf746('0x1e')]?_0x4b57ce[_0xf746('0x1e')][_0xf746('0x21')]?_[_0xf746('0x22')](_0x4b57ce[_0xf746('0x1e')][_0xf746('0x21')],function(_0x4cc834){return{'model':db[_0x4cc834[_0xf746('0x23')]],'as':_0x4cc834['as'],'attributes':_0x4cc834[_0xf746('0x20')],'include':_0x4cc834[_0xf746('0x21')]?_['map'](_0x4cc834['include'],function(_0x2e0e38){return{'model':db[_0x2e0e38[_0xf746('0x23')]],'as':_0x2e0e38['as'],'attributes':_0x2e0e38[_0xf746('0x20')],'include':_0x2e0e38[_0xf746('0x21')]?_[_0xf746('0x22')](_0x2e0e38['include'],function(_0x3ca8a9){return{'model':db[_0x3ca8a9['model']],'as':_0x3ca8a9['as'],'attributes':_0x3ca8a9[_0xf746('0x20')]};}):[]};}):[]};}):[]:[]})[_0xf746('0x11')](function(_0x3c0ac3){logger['info'](_0xf746('0x25'),_0x4b57ce);logger[_0xf746('0x15')](_0xf746('0x25'),_0x4b57ce,JSON['stringify'](_0x3c0ac3));_0x2ddaf6(_0x3c0ac3);})[_0xf746('0x1a')](function(_0x23cabd){logger[_0xf746('0x17')]('ShowVoiceQueue',_0x23cabd['message'],_0x4b57ce);_0x14c533(_0x28b86e[_0xf746('0x17')](0x1f4,_0x23cabd[_0xf746('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index de757a6..7e2b05e 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 _0xfb6f=['./voiceQueue.events','save','remove','update','emit','removeListener','register','voiceQueue:'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfb6f,0x110));var _0xffb6=function(_0x9c18cc,_0x3d495e){_0x9c18cc=_0x9c18cc-0x0;var _0x254776=_0xfb6f[_0x9c18cc];return _0x254776;};'use strict';var VoiceQueueEvents=require(_0xffb6('0x0'));var events=[_0xffb6('0x1'),_0xffb6('0x2'),_0xffb6('0x3')];function createListener(_0x54fa20,_0x1c3039){return function(_0x12a840){_0x1c3039[_0xffb6('0x4')](_0x54fa20,_0x12a840);};}function removeListener(_0x456e30,_0x15afa2){return function(){VoiceQueueEvents[_0xffb6('0x5')](_0x456e30,_0x15afa2);};}exports[_0xffb6('0x6')]=function(_0x4efe89){for(var _0x2de889=0x0,_0x4b3504=events['length'];_0x2de889<_0x4b3504;_0x2de889++){var _0x2d93de=events[_0x2de889];var _0x1e12d6=createListener(_0xffb6('0x7')+_0x2d93de,_0x4efe89);VoiceQueueEvents['on'](_0x2d93de,_0x1e12d6);}}; \ No newline at end of file +var _0x3da4=['register','voiceQueue:','./voiceQueue.events','save','remove','update','emit','removeListener'];(function(_0x427b8d,_0x107eaa){var _0x643bf2=function(_0x420b0c){while(--_0x420b0c){_0x427b8d['push'](_0x427b8d['shift']());}};_0x643bf2(++_0x107eaa);}(_0x3da4,0xca));var _0x43da=function(_0x550151,_0x49d953){_0x550151=_0x550151-0x0;var _0x1ba3cb=_0x3da4[_0x550151];return _0x1ba3cb;};'use strict';var VoiceQueueEvents=require(_0x43da('0x0'));var events=[_0x43da('0x1'),_0x43da('0x2'),_0x43da('0x3')];function createListener(_0x4c00f7,_0x14ad28){return function(_0x21fae3){_0x14ad28[_0x43da('0x4')](_0x4c00f7,_0x21fae3);};}function removeListener(_0x4f992d,_0x54f65b){return function(){VoiceQueueEvents[_0x43da('0x5')](_0x4f992d,_0x54f65b);};}exports[_0x43da('0x6')]=function(_0x37ca36){for(var _0x4f8ea2=0x0,_0x10b5fd=events['length'];_0x4f8ea2<_0x10b5fd;_0x4f8ea2++){var _0x3b08a9=events[_0x4f8ea2];var _0x3da181=createListener(_0x43da('0x7')+_0x3b08a9,_0x37ca36);VoiceQueueEvents['on'](_0x3b08a9,_0x3da181);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index e2013b1..dcf28c2 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 _0x47c4=['./voiceQueueReport.controller','get','isAuthenticated','/describe','describe','/index','/:id','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x1ebeea,_0x2f54f4){var _0x576465=function(_0x47fc77){while(--_0x47fc77){_0x1ebeea['push'](_0x1ebeea['shift']());}};_0x576465(++_0x2f54f4);}(_0x47c4,0xf1));var _0x447c=function(_0x4d29eb,_0x5ba766){_0x4d29eb=_0x4d29eb-0x0;var _0x53cadb=_0x47c4[_0x4d29eb];return _0x53cadb;};'use strict';var multer=require(_0x447c('0x0'));var util=require(_0x447c('0x1'));var path=require(_0x447c('0x2'));var timeout=require(_0x447c('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x447c('0x4'));var auth=require(_0x447c('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x447c('0x6'));router[_0x447c('0x7')]('/',auth[_0x447c('0x8')](),controller['index']);router[_0x447c('0x7')](_0x447c('0x9'),auth[_0x447c('0x8')](),controller[_0x447c('0xa')]);router[_0x447c('0x7')](_0x447c('0xb'),auth[_0x447c('0x8')](),controller['getVoiceQueuesReport']);router[_0x447c('0x7')](_0x447c('0xc'),auth[_0x447c('0x8')](),controller['show']);router[_0x447c('0xd')]('/',auth[_0x447c('0x8')](),controller[_0x447c('0xe')]);router[_0x447c('0xf')]('/:id',auth[_0x447c('0x8')](),controller[_0x447c('0x10')]);router[_0x447c('0x11')](_0x447c('0xc'),auth['isAuthenticated'](),controller[_0x447c('0x12')]);module['exports']=router; \ No newline at end of file +var _0x6f21=['describe','/index','getVoiceQueuesReport','/:id','show','post','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceQueueReport.controller','get','index','isAuthenticated'];(function(_0x430ec7,_0x144d52){var _0x318851=function(_0x7c00dc){while(--_0x7c00dc){_0x430ec7['push'](_0x430ec7['shift']());}};_0x318851(++_0x144d52);}(_0x6f21,0xac));var _0x16f2=function(_0x3d7516,_0x3109fa){_0x3d7516=_0x3d7516-0x0;var _0xb30d=_0x6f21[_0x3d7516];return _0xb30d;};'use strict';var multer=require(_0x16f2('0x0'));var util=require(_0x16f2('0x1'));var path=require('path');var timeout=require(_0x16f2('0x2'));var express=require(_0x16f2('0x3'));var router=express[_0x16f2('0x4')]();var fs_extra=require(_0x16f2('0x5'));var auth=require(_0x16f2('0x6'));var interaction=require(_0x16f2('0x7'));var config=require('../../config/environment');var controller=require(_0x16f2('0x8'));router[_0x16f2('0x9')]('/',auth['isAuthenticated'](),controller[_0x16f2('0xa')]);router[_0x16f2('0x9')]('/describe',auth[_0x16f2('0xb')](),controller[_0x16f2('0xc')]);router[_0x16f2('0x9')](_0x16f2('0xd'),auth[_0x16f2('0xb')](),controller[_0x16f2('0xe')]);router[_0x16f2('0x9')](_0x16f2('0xf'),auth[_0x16f2('0xb')](),controller[_0x16f2('0x10')]);router[_0x16f2('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x16f2('0x12')]('/:id',auth[_0x16f2('0xb')](),controller[_0x16f2('0x13')]);router[_0x16f2('0x14')](_0x16f2('0xf'),auth[_0x16f2('0xb')](),controller[_0x16f2('0x15')]);module[_0x16f2('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 49d7d60..baa5462 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 _0x0d7f=['FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'];(function(_0x43f61d,_0x559906){var _0x4410ab=function(_0x48fb93){while(--_0x48fb93){_0x43f61d['push'](_0x43f61d['shift']());}};_0x4410ab(++_0x559906);}(_0x0d7f,0x1b1));var _0xf0d7=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x0d7f[_0x13e741];return _0x3f8bb3;};'use strict';var Sequelize=require(_0xf0d7('0x0'));var moment=require(_0xf0d7('0x1'));module[_0xf0d7('0x2')]={'type':{'type':Sequelize[_0xf0d7('0x3')]},'uniqueid':{'type':Sequelize[_0xf0d7('0x3')]},'calleridnum':{'type':Sequelize[_0xf0d7('0x3')]},'calleridname':{'type':Sequelize[_0xf0d7('0x3')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0xf0d7('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0xf0d7('0x4')],'set':function(_0x286853){var _0x5ab5d7=moment(_0x286853);var _0x4d4073=moment(this['getDataValue'](_0xf0d7('0x5')))['format'](_0xf0d7('0x6'));var _0x199cca=_0x5ab5d7[_0xf0d7('0x7')](_0x4d4073,_0xf0d7('0x8'));this[_0xf0d7('0x9')](_0xf0d7('0xa'),_0x286853);this[_0xf0d7('0x9')](_0xf0d7('0xb'),_0x199cca||null);}},'position':{'type':Sequelize[_0xf0d7('0xc')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0xf0d7('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xf0d7('0x4')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0xf0d7('0x3')],'comment':_0xf0d7('0xe')},'originalposition':{'type':Sequelize[_0xf0d7('0xc')]},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xf0d7('0x3')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xf0d7('0x3')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xf0d7('0x3')]},'priority':{'type':Sequelize[_0xf0d7('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0xf0d7('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xf0d7('0x3')]},'transfer':{'type':Sequelize[_0xf0d7('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xf0d7('0x3')],'comment':_0xf0d7('0xf')},'transferexten':{'type':Sequelize[_0xf0d7('0x3')]},'transferuniqueid':{'type':Sequelize[_0xf0d7('0x3')]},'disposition':{'type':Sequelize[_0xf0d7('0x3')]},'secondDisposition':{'type':Sequelize[_0xf0d7('0x3')]},'thirdDisposition':{'type':Sequelize[_0xf0d7('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0xf0d7('0xc')],'defaultValue':0x0},'note':{'type':Sequelize[_0xf0d7('0x3')]}}; \ No newline at end of file +var _0x5e28=['sequelize','moment','exports','STRING','DATE','getDataValue','YYYY-MM-DD\x20HH:mm:ss','diff','setDataValue','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x3620c,_0x4e7acd){var _0x409ef2=function(_0x25b786){while(--_0x25b786){_0x3620c['push'](_0x3620c['shift']());}};_0x409ef2(++_0x4e7acd);}(_0x5e28,0x16c));var _0x85e2=function(_0x23be51,_0xc02a1b){_0x23be51=_0x23be51-0x0;var _0x47a26d=_0x5e28[_0x23be51];return _0x47a26d;};'use strict';var Sequelize=require(_0x85e2('0x0'));var moment=require(_0x85e2('0x1'));module[_0x85e2('0x2')]={'type':{'type':Sequelize[_0x85e2('0x3')]},'uniqueid':{'type':Sequelize[_0x85e2('0x3')]},'calleridnum':{'type':Sequelize[_0x85e2('0x3')]},'calleridname':{'type':Sequelize[_0x85e2('0x3')]},'queue':{'type':Sequelize[_0x85e2('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x85e2('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x85e2('0x4')],'set':function(_0x3723dc){var _0x2e69ee=moment(_0x3723dc);var _0x451aa6=moment(this[_0x85e2('0x5')]('queuecallerjoinAt'))['format'](_0x85e2('0x6'));var _0x24a77f=_0x2e69ee[_0x85e2('0x7')](_0x451aa6,'seconds');this['setDataValue']('queuecallerleaveAt',_0x3723dc);this[_0x85e2('0x8')](_0x85e2('0x9'),_0x24a77f||null);}},'position':{'type':Sequelize[_0x85e2('0xa')]},'count':{'type':Sequelize[_0x85e2('0xa')]},'queuecallerabandon':{'type':Sequelize[_0x85e2('0xb')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0x85e2('0xb')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0x85e2('0xb')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x85e2('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x85e2('0x3')],'comment':_0x85e2('0xc')},'originalposition':{'type':Sequelize[_0x85e2('0xa')]},'channel':{'type':Sequelize[_0x85e2('0x3')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x85e2('0x3')]},'accountcode':{'type':Sequelize[_0x85e2('0x3')]},'context':{'type':Sequelize[_0x85e2('0x3')]},'exten':{'type':Sequelize[_0x85e2('0x3')]},'priority':{'type':Sequelize[_0x85e2('0x3')]},'holdtime':{'type':Sequelize[_0x85e2('0xa')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x85e2('0xb')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x85e2('0xb')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x85e2('0x3')],'comment':_0x85e2('0xd')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x85e2('0x3')]},'disposition':{'type':Sequelize[_0x85e2('0x3')]},'secondDisposition':{'type':Sequelize[_0x85e2('0x3')]},'thirdDisposition':{'type':Sequelize[_0x85e2('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0x85e2('0xa')],'defaultValue':0x0},'note':{'type':Sequelize[_0x85e2('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index a13cda3..43fa600 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 _0xe43c=['rows','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','./voiceQueueReport.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','stack','name','index','map','VoiceQueueReport','rawAttributes','fieldName','key','keys','filters','model','attributes','fields','length','query','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','show','params','intersection','include','find','create','body','catch','describe','getVoiceQueuesReport'];(function(_0x2c7045,_0x1d2a9d){var _0x4b6741=function(_0x5e1c04){while(--_0x5e1c04){_0x2c7045['push'](_0x2c7045['shift']());}};_0x4b6741(++_0x1d2a9d);}(_0xe43c,0x141));var _0xce43=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0xe43c[_0x1928c9];return _0x51b5fb;};'use strict';var emlformat=require(_0xce43('0x0'));var rimraf=require(_0xce43('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xce43('0x2'));var moment=require(_0xce43('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xce43('0x4'));var util=require(_0xce43('0x5'));var path=require(_0xce43('0x6'));var sox=require(_0xce43('0x7'));var csv=require(_0xce43('0x8'));var ejs=require(_0xce43('0x9'));var fs=require('fs');var fs_extra=require(_0xce43('0xa'));var _=require(_0xce43('0xb'));var squel=require(_0xce43('0xc'));var crypto=require(_0xce43('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xce43('0x8'));var querystring=require(_0xce43('0xe'));var Papa=require(_0xce43('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xce43('0x10'));var as=require(_0xce43('0x11'));var hardwareService=require(_0xce43('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xce43('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xce43('0x14'));var db=require(_0xce43('0x15'))['db'];config['redis']=_[_0xce43('0x16')](config[_0xce43('0x17')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xce43('0x18'))[_0xce43('0x19')](socket);function respondWithStatusCode(_0x3fa236,_0x44fdbc){_0x44fdbc=_0x44fdbc||0xcc;return function(_0x5771d3){if(_0x5771d3){return _0x3fa236[_0xce43('0x1a')](_0x44fdbc);}return _0x3fa236[_0xce43('0x1b')](_0x44fdbc)[_0xce43('0x1c')]();};}function respondWithResult(_0x36896f,_0x595f43){_0x595f43=_0x595f43||0xc8;return function(_0x460b3f){if(_0x460b3f){return _0x36896f['status'](_0x595f43)[_0xce43('0x1d')](_0x460b3f);}};}function respondWithFilteredResult(_0x45d250,_0x8680be){return function(_0xcc56be){if(_0xcc56be){var _0x4de439=typeof _0x8680be[_0xce43('0x1e')]===_0xce43('0x1f')&&typeof _0x8680be[_0xce43('0x20')]===_0xce43('0x1f');var _0x9c1e7b=_0xcc56be[_0xce43('0x21')];var _0x4f3027=_0x4de439?0x0:_0x8680be['offset'];var _0x55a812=_0x4de439?_0xcc56be[_0xce43('0x21')]:_0x8680be[_0xce43('0x1e')]+_0x8680be[_0xce43('0x20')];var _0x47cf1e;if(_0x55a812>=_0x9c1e7b){_0x55a812=_0x9c1e7b;_0x47cf1e=0xc8;}else{_0x47cf1e=0xce;}_0x45d250[_0xce43('0x1b')](_0x47cf1e);return _0x45d250[_0xce43('0x22')](_0xce43('0x23'),_0x4f3027+'-'+_0x55a812+'/'+_0x9c1e7b)[_0xce43('0x1d')](_0xcc56be);}return null;};}function patchUpdates(_0x252c7d){return function(_0x489313){try{jsonpatch[_0xce43('0x24')](_0x489313,_0x252c7d,!![]);}catch(_0x3eae88){return BPromise['reject'](_0x3eae88);}return _0x489313[_0xce43('0x25')]();};}function saveUpdates(_0xfd9d7f,_0x3dcb6f){return function(_0x4ee119){if(_0x4ee119){return _0x4ee119[_0xce43('0x26')](_0xfd9d7f)[_0xce43('0x27')](function(_0x269718){return _0x269718;});}return null;};}function removeEntity(_0x29afb8,_0x2a9e7f){return function(_0x5d2fbe){if(_0x5d2fbe){return _0x5d2fbe[_0xce43('0x28')]()[_0xce43('0x27')](function(){_0x29afb8['status'](0xcc)[_0xce43('0x1c')]();});}};}function handleEntityNotFound(_0x4110db,_0x2ee08a){return function(_0x55e56c){if(!_0x55e56c){_0x4110db[_0xce43('0x1a')](0x194);}return _0x55e56c;};}function handleError(_0x48441b,_0x24d1e2){_0x24d1e2=_0x24d1e2||0x1f4;return function(_0x5924f6){logger['error'](_0x5924f6[_0xce43('0x29')]);if(_0x5924f6[_0xce43('0x2a')]){delete _0x5924f6[_0xce43('0x2a')];}_0x48441b[_0xce43('0x1b')](_0x24d1e2)['send'](_0x5924f6);};}exports[_0xce43('0x2b')]=function(_0x427fa0,_0x2c5e88){var _0xe405a={},_0x420138={},_0xfba88={'count':0x0,'rows':[]};var _0x2c340a=_[_0xce43('0x2c')](db[_0xce43('0x2d')][_0xce43('0x2e')],function(_0x3fde24){return{'name':_0x3fde24[_0xce43('0x2f')],'type':_0x3fde24['type'][_0xce43('0x30')]};});_0x420138['model']=_[_0xce43('0x2c')](_0x2c340a,_0xce43('0x2a'));_0x420138['query']=_[_0xce43('0x31')](_0x427fa0['query']);_0x420138[_0xce43('0x32')]=_['intersection'](_0x420138[_0xce43('0x33')],_0x420138['query']);_0xe405a[_0xce43('0x34')]=_['intersection'](_0x420138[_0xce43('0x33')],qs[_0xce43('0x35')](_0x427fa0['query'][_0xce43('0x35')]));_0xe405a['attributes']=_0xe405a['attributes'][_0xce43('0x36')]?_0xe405a[_0xce43('0x34')]:_0x420138[_0xce43('0x33')];if(!_0x427fa0[_0xce43('0x37')][_0xce43('0x38')](_0xce43('0x39'))){_0xe405a[_0xce43('0x20')]=qs['limit'](_0x427fa0[_0xce43('0x37')]['limit']);_0xe405a[_0xce43('0x1e')]=qs[_0xce43('0x1e')](_0x427fa0[_0xce43('0x37')][_0xce43('0x1e')]);}_0xe405a[_0xce43('0x3a')]=qs[_0xce43('0x3b')](_0x427fa0[_0xce43('0x37')]['sort']);_0xe405a[_0xce43('0x3c')]=qs['filters'](_[_0xce43('0x3d')](_0x427fa0[_0xce43('0x37')],_0x420138['filters']),_0x2c340a);if(_0x427fa0[_0xce43('0x37')][_0xce43('0x3e')]){_0xe405a[_0xce43('0x3c')]=_[_0xce43('0x3f')](_0xe405a[_0xce43('0x3c')],{'$or':_[_0xce43('0x2c')](_0x2c340a,function(_0x2dfd3e){if(_0x2dfd3e[_0xce43('0x40')]!==_0xce43('0x41')){var _0x28d61e={};_0x28d61e[_0x2dfd3e[_0xce43('0x2a')]]={'$like':'%'+_0x427fa0[_0xce43('0x37')]['filter']+'%'};return _0x28d61e;}})});}_0xe405a=_['merge']({},_0xe405a,_0x427fa0[_0xce43('0x42')]);var _0x390259={'where':_0xe405a[_0xce43('0x3c')]};return db[_0xce43('0x2d')][_0xce43('0x21')](_0x390259)[_0xce43('0x27')](function(_0xa2ac47){_0xfba88[_0xce43('0x21')]=_0xa2ac47;if(_0x427fa0[_0xce43('0x37')][_0xce43('0x43')]){_0xe405a['include']=[{'all':!![]}];}return db[_0xce43('0x2d')][_0xce43('0x44')](_0xe405a);})[_0xce43('0x27')](function(_0x529217){_0xfba88['rows']=_0x529217;return _0xfba88;})['then'](respondWithFilteredResult(_0x2c5e88,_0xe405a))['catch'](handleError(_0x2c5e88,null));};exports[_0xce43('0x45')]=function(_0xa68238,_0x43669a){var _0x32ae8e={'raw':![],'where':{'id':_0xa68238[_0xce43('0x46')]['id']}},_0x1ac0fa={};_0x1ac0fa[_0xce43('0x33')]=_[_0xce43('0x31')](db['VoiceQueueReport']['rawAttributes']);_0x1ac0fa[_0xce43('0x37')]=_[_0xce43('0x31')](_0xa68238[_0xce43('0x37')]);_0x1ac0fa[_0xce43('0x32')]=_['intersection'](_0x1ac0fa[_0xce43('0x33')],_0x1ac0fa[_0xce43('0x37')]);_0x32ae8e[_0xce43('0x34')]=_[_0xce43('0x47')](_0x1ac0fa['model'],qs[_0xce43('0x35')](_0xa68238[_0xce43('0x37')][_0xce43('0x35')]));_0x32ae8e[_0xce43('0x34')]=_0x32ae8e[_0xce43('0x34')][_0xce43('0x36')]?_0x32ae8e['attributes']:_0x1ac0fa[_0xce43('0x33')];if(_0xa68238[_0xce43('0x37')]['includeAll']){_0x32ae8e[_0xce43('0x48')]=[{'all':!![]}];}_0x32ae8e=_['merge']({},_0x32ae8e,_0xa68238[_0xce43('0x42')]);return db['VoiceQueueReport'][_0xce43('0x49')](_0x32ae8e)[_0xce43('0x27')](handleEntityNotFound(_0x43669a,null))['then'](respondWithResult(_0x43669a,null))['catch'](handleError(_0x43669a,null));};exports[_0xce43('0x4a')]=function(_0x5ced99,_0x26de49){return db[_0xce43('0x2d')]['create'](_0x5ced99[_0xce43('0x4b')],{})['then'](respondWithResult(_0x26de49,0xc9))[_0xce43('0x4c')](handleError(_0x26de49,null));};exports[_0xce43('0x26')]=function(_0x4f0187,_0x52d3c0){if(_0x4f0187[_0xce43('0x4b')]['id']){delete _0x4f0187[_0xce43('0x4b')]['id'];}return db['VoiceQueueReport'][_0xce43('0x49')]({'where':{'id':_0x4f0187[_0xce43('0x46')]['id']}})[_0xce43('0x27')](handleEntityNotFound(_0x52d3c0,null))['then'](saveUpdates(_0x4f0187[_0xce43('0x4b')],null))[_0xce43('0x27')](respondWithResult(_0x52d3c0,null))[_0xce43('0x4c')](handleError(_0x52d3c0,null));};exports[_0xce43('0x28')]=function(_0x50359a,_0x56e64f){return db[_0xce43('0x2d')][_0xce43('0x49')]({'where':{'id':_0x50359a[_0xce43('0x46')]['id']}})[_0xce43('0x27')](handleEntityNotFound(_0x56e64f,null))[_0xce43('0x27')](removeEntity(_0x56e64f,null))['catch'](handleError(_0x56e64f,null));};exports['describe']=function(_0x28dca1,_0x87ff14){return db[_0xce43('0x2d')][_0xce43('0x4d')]()['then'](respondWithResult(_0x87ff14,null))[_0xce43('0x4c')](handleError(_0x87ff14,null));};exports[_0xce43('0x4e')]=function(_0xc450e6,_0x29c71f){var _0x9b78cf={},_0x339ae3={},_0x262bfb={'count':0x0,'rows':[]};_0x339ae3[_0xce43('0x33')]=_['keys'](db[_0xce43('0x2d')][_0xce43('0x2e')]);_0x339ae3['query']=_['keys'](_0xc450e6[_0xce43('0x37')]);_0x339ae3[_0xce43('0x32')]=_['intersection'](_0x339ae3[_0xce43('0x33')],_0x339ae3['query']);_0x9b78cf[_0xce43('0x34')]=_['intersection'](_0x339ae3[_0xce43('0x33')],qs[_0xce43('0x35')](_0xc450e6[_0xce43('0x37')][_0xce43('0x35')]));_0x9b78cf[_0xce43('0x34')]=_0x9b78cf[_0xce43('0x34')]['length']?_0x9b78cf[_0xce43('0x34')]:_0x339ae3[_0xce43('0x33')];if(!_0xc450e6[_0xce43('0x37')][_0xce43('0x38')](_0xce43('0x39'))){_0x9b78cf[_0xce43('0x20')]=qs[_0xce43('0x20')](_0xc450e6['query'][_0xce43('0x20')]);_0x9b78cf[_0xce43('0x1e')]=qs[_0xce43('0x1e')](_0xc450e6[_0xce43('0x37')][_0xce43('0x1e')]);}_0x9b78cf[_0xce43('0x3a')]=qs[_0xce43('0x3b')](_0xc450e6[_0xce43('0x37')][_0xce43('0x3b')]);_0x9b78cf[_0xce43('0x3c')]=qs[_0xce43('0x32')](_['pick'](_0xc450e6[_0xce43('0x37')],_0x339ae3[_0xce43('0x32')]));if(_0xc450e6[_0xce43('0x37')][_0xce43('0x3e')]){_0x9b78cf['where']=_[_0xce43('0x3f')](_0x9b78cf[_0xce43('0x3c')],{'$or':_[_0xce43('0x2c')](_0x9b78cf[_0xce43('0x34')],function(_0x46dc3f){var _0x47e3ce={};_0x47e3ce[_0x46dc3f]={'$like':'%'+_0xc450e6[_0xce43('0x37')]['filter']+'%'};return _0x47e3ce;})});}_0x9b78cf=_[_0xce43('0x3f')]({},_0x9b78cf,_0xc450e6[_0xce43('0x42')]);var _0x104ac5={'where':_0x9b78cf['where']};return db[_0xce43('0x2d')][_0xce43('0x21')](_0x104ac5)[_0xce43('0x27')](function(_0x2575e2){_0x262bfb['count']=_0x2575e2;if(_0xc450e6[_0xce43('0x37')]['includeAll']){_0x9b78cf[_0xce43('0x48')]=[{'all':!![]}];}return db[_0xce43('0x2d')][_0xce43('0x44')](_0x9b78cf);})[_0xce43('0x27')](function(_0x73b6d1){_0x262bfb[_0xce43('0x4f')]=_0x73b6d1;return _0x262bfb;})[_0xce43('0x27')](respondWithFilteredResult(_0x29c71f,_0x9b78cf,'getVoiceQueuesReport'))[_0xce43('0x4c')](handleError(_0x29c71f,null,_0xce43('0x4e')));}; \ No newline at end of file +var _0x04dc=['../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','VoiceQueueReport','includeAll','include','findAll','catch','show','create','body','params','find','describe','getVoiceQueuesReport','rows','rimraf','fast-json-patch','request-promise','mustache','path','sox','to-csv','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/environment'];(function(_0x204c59,_0x5614ee){var _0x4cd35b=function(_0xf20241){while(--_0xf20241){_0x204c59['push'](_0x204c59['shift']());}};_0x4cd35b(++_0x5614ee);}(_0x04dc,0x1d6));var _0xc04d=function(_0x18cebd,_0x5f138f){_0x18cebd=_0x18cebd-0x0;var _0x4c702f=_0x04dc[_0x18cebd];return _0x4c702f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc04d('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc04d('0x1'));var rp=require(_0xc04d('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc04d('0x3'));var util=require('util');var path=require(_0xc04d('0x4'));var sox=require(_0xc04d('0x5'));var csv=require(_0xc04d('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc04d('0x7'));var _=require('lodash');var squel=require(_0xc04d('0x8'));var crypto=require(_0xc04d('0x9'));var jsforce=require(_0xc04d('0xa'));var deskjs=require(_0xc04d('0xb'));var toCsv=require(_0xc04d('0x6'));var querystring=require(_0xc04d('0xc'));var Papa=require('papaparse');var Redis=require(_0xc04d('0xd'));var authService=require(_0xc04d('0xe'));var qs=require(_0xc04d('0xf'));var as=require(_0xc04d('0x10'));var hardwareService=require(_0xc04d('0x11'));var logger=require(_0xc04d('0x12'))(_0xc04d('0x13'));var utils=require(_0xc04d('0x14'));var config=require(_0xc04d('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xc04d('0x16'))['db'];config['redis']=_[_0xc04d('0x17')](config[_0xc04d('0x18')],{'host':_0xc04d('0x19'),'port':0x18eb});var socket=require(_0xc04d('0x1a'))(new Redis(config[_0xc04d('0x18')]));require('./voiceQueueReport.socket')[_0xc04d('0x1b')](socket);function respondWithStatusCode(_0x137c45,_0x44ff6a){_0x44ff6a=_0x44ff6a||0xcc;return function(_0x106485){if(_0x106485){return _0x137c45[_0xc04d('0x1c')](_0x44ff6a);}return _0x137c45['status'](_0x44ff6a)[_0xc04d('0x1d')]();};}function respondWithResult(_0xac521f,_0xb9a701){_0xb9a701=_0xb9a701||0xc8;return function(_0x443f3d){if(_0x443f3d){return _0xac521f[_0xc04d('0x1e')](_0xb9a701)[_0xc04d('0x1f')](_0x443f3d);}};}function respondWithFilteredResult(_0x25aaab,_0x256234){return function(_0x245a98){if(_0x245a98){var _0x16afb3=typeof _0x256234[_0xc04d('0x20')]===_0xc04d('0x21')&&typeof _0x256234[_0xc04d('0x22')]==='undefined';var _0x1cfe72=_0x245a98[_0xc04d('0x23')];var _0x3760ab=_0x16afb3?0x0:_0x256234[_0xc04d('0x20')];var _0x3d5e97=_0x16afb3?_0x245a98['count']:_0x256234[_0xc04d('0x20')]+_0x256234['limit'];var _0x49673e;if(_0x3d5e97>=_0x1cfe72){_0x3d5e97=_0x1cfe72;_0x49673e=0xc8;}else{_0x49673e=0xce;}_0x25aaab[_0xc04d('0x1e')](_0x49673e);return _0x25aaab['set'](_0xc04d('0x24'),_0x3760ab+'-'+_0x3d5e97+'/'+_0x1cfe72)[_0xc04d('0x1f')](_0x245a98);}return null;};}function patchUpdates(_0x3c7ec9){return function(_0x5e8dcd){try{jsonpatch['apply'](_0x5e8dcd,_0x3c7ec9,!![]);}catch(_0x56ae3c){return BPromise['reject'](_0x56ae3c);}return _0x5e8dcd[_0xc04d('0x25')]();};}function saveUpdates(_0x28b86c,_0x55823c){return function(_0x725d36){if(_0x725d36){return _0x725d36[_0xc04d('0x26')](_0x28b86c)[_0xc04d('0x27')](function(_0x2b88c0){return _0x2b88c0;});}return null;};}function removeEntity(_0x3267bb,_0x5bb695){return function(_0x48e2c0){if(_0x48e2c0){return _0x48e2c0[_0xc04d('0x28')]()[_0xc04d('0x27')](function(){_0x3267bb['status'](0xcc)[_0xc04d('0x1d')]();});}};}function handleEntityNotFound(_0x1b01e5,_0x5dffe4){return function(_0x585adf){if(!_0x585adf){_0x1b01e5[_0xc04d('0x1c')](0x194);}return _0x585adf;};}function handleError(_0x5931c9,_0x4e640b){_0x4e640b=_0x4e640b||0x1f4;return function(_0x40c708){logger[_0xc04d('0x29')](_0x40c708[_0xc04d('0x2a')]);if(_0x40c708[_0xc04d('0x2b')]){delete _0x40c708[_0xc04d('0x2b')];}_0x5931c9[_0xc04d('0x1e')](_0x4e640b)[_0xc04d('0x2c')](_0x40c708);};}exports[_0xc04d('0x2d')]=function(_0x514467,_0x3d6e93){var _0x4806db={},_0xcdb6ad={},_0x3ab61e={'count':0x0,'rows':[]};var _0x325cfd=_[_0xc04d('0x2e')](db['VoiceQueueReport'][_0xc04d('0x2f')],function(_0x7c0867){return{'name':_0x7c0867[_0xc04d('0x30')],'type':_0x7c0867[_0xc04d('0x31')][_0xc04d('0x32')]};});_0xcdb6ad[_0xc04d('0x33')]=_[_0xc04d('0x2e')](_0x325cfd,_0xc04d('0x2b'));_0xcdb6ad[_0xc04d('0x34')]=_[_0xc04d('0x35')](_0x514467[_0xc04d('0x34')]);_0xcdb6ad[_0xc04d('0x36')]=_[_0xc04d('0x37')](_0xcdb6ad['model'],_0xcdb6ad['query']);_0x4806db[_0xc04d('0x38')]=_['intersection'](_0xcdb6ad[_0xc04d('0x33')],qs['fields'](_0x514467['query'][_0xc04d('0x39')]));_0x4806db[_0xc04d('0x38')]=_0x4806db[_0xc04d('0x38')][_0xc04d('0x3a')]?_0x4806db[_0xc04d('0x38')]:_0xcdb6ad['model'];if(!_0x514467[_0xc04d('0x34')][_0xc04d('0x3b')](_0xc04d('0x3c'))){_0x4806db[_0xc04d('0x22')]=qs[_0xc04d('0x22')](_0x514467[_0xc04d('0x34')][_0xc04d('0x22')]);_0x4806db['offset']=qs['offset'](_0x514467[_0xc04d('0x34')][_0xc04d('0x20')]);}_0x4806db[_0xc04d('0x3d')]=qs[_0xc04d('0x3e')](_0x514467[_0xc04d('0x34')]['sort']);_0x4806db[_0xc04d('0x3f')]=qs[_0xc04d('0x36')](_[_0xc04d('0x40')](_0x514467[_0xc04d('0x34')],_0xcdb6ad[_0xc04d('0x36')]),_0x325cfd);if(_0x514467[_0xc04d('0x34')][_0xc04d('0x41')]){_0x4806db[_0xc04d('0x3f')]=_[_0xc04d('0x42')](_0x4806db[_0xc04d('0x3f')],{'$or':_[_0xc04d('0x2e')](_0x325cfd,function(_0x28619b){if(_0x28619b[_0xc04d('0x31')]!==_0xc04d('0x43')){var _0x25db0d={};_0x25db0d[_0x28619b[_0xc04d('0x2b')]]={'$like':'%'+_0x514467['query'][_0xc04d('0x41')]+'%'};return _0x25db0d;}})});}_0x4806db=_[_0xc04d('0x42')]({},_0x4806db,_0x514467[_0xc04d('0x44')]);var _0x53c53c={'where':_0x4806db[_0xc04d('0x3f')]};return db[_0xc04d('0x45')][_0xc04d('0x23')](_0x53c53c)[_0xc04d('0x27')](function(_0x53ef29){_0x3ab61e[_0xc04d('0x23')]=_0x53ef29;if(_0x514467[_0xc04d('0x34')][_0xc04d('0x46')]){_0x4806db[_0xc04d('0x47')]=[{'all':!![]}];}return db[_0xc04d('0x45')][_0xc04d('0x48')](_0x4806db);})[_0xc04d('0x27')](function(_0x3212dd){_0x3ab61e['rows']=_0x3212dd;return _0x3ab61e;})[_0xc04d('0x27')](respondWithFilteredResult(_0x3d6e93,_0x4806db))[_0xc04d('0x49')](handleError(_0x3d6e93,null));};exports[_0xc04d('0x4a')]=function(_0x41daed,_0x437dbb){var _0x1ad91e={'raw':![],'where':{'id':_0x41daed['params']['id']}},_0x233249={};_0x233249[_0xc04d('0x33')]=_['keys'](db[_0xc04d('0x45')]['rawAttributes']);_0x233249['query']=_[_0xc04d('0x35')](_0x41daed[_0xc04d('0x34')]);_0x233249[_0xc04d('0x36')]=_[_0xc04d('0x37')](_0x233249['model'],_0x233249[_0xc04d('0x34')]);_0x1ad91e[_0xc04d('0x38')]=_[_0xc04d('0x37')](_0x233249['model'],qs[_0xc04d('0x39')](_0x41daed[_0xc04d('0x34')][_0xc04d('0x39')]));_0x1ad91e['attributes']=_0x1ad91e['attributes'][_0xc04d('0x3a')]?_0x1ad91e['attributes']:_0x233249[_0xc04d('0x33')];if(_0x41daed[_0xc04d('0x34')][_0xc04d('0x46')]){_0x1ad91e[_0xc04d('0x47')]=[{'all':!![]}];}_0x1ad91e=_[_0xc04d('0x42')]({},_0x1ad91e,_0x41daed['options']);return db[_0xc04d('0x45')]['find'](_0x1ad91e)[_0xc04d('0x27')](handleEntityNotFound(_0x437dbb,null))[_0xc04d('0x27')](respondWithResult(_0x437dbb,null))[_0xc04d('0x49')](handleError(_0x437dbb,null));};exports['create']=function(_0x2c6944,_0x281f99){return db[_0xc04d('0x45')][_0xc04d('0x4b')](_0x2c6944[_0xc04d('0x4c')],{})[_0xc04d('0x27')](respondWithResult(_0x281f99,0xc9))[_0xc04d('0x49')](handleError(_0x281f99,null));};exports[_0xc04d('0x26')]=function(_0x543468,_0x3d0396){if(_0x543468['body']['id']){delete _0x543468['body']['id'];}return db[_0xc04d('0x45')]['find']({'where':{'id':_0x543468[_0xc04d('0x4d')]['id']}})[_0xc04d('0x27')](handleEntityNotFound(_0x3d0396,null))[_0xc04d('0x27')](saveUpdates(_0x543468[_0xc04d('0x4c')],null))[_0xc04d('0x27')](respondWithResult(_0x3d0396,null))[_0xc04d('0x49')](handleError(_0x3d0396,null));};exports[_0xc04d('0x28')]=function(_0xb80b2,_0x1c6ae9){return db[_0xc04d('0x45')][_0xc04d('0x4e')]({'where':{'id':_0xb80b2['params']['id']}})['then'](handleEntityNotFound(_0x1c6ae9,null))[_0xc04d('0x27')](removeEntity(_0x1c6ae9,null))['catch'](handleError(_0x1c6ae9,null));};exports[_0xc04d('0x4f')]=function(_0x2a9185,_0x470f7c){return db[_0xc04d('0x45')][_0xc04d('0x4f')]()['then'](respondWithResult(_0x470f7c,null))[_0xc04d('0x49')](handleError(_0x470f7c,null));};exports[_0xc04d('0x50')]=function(_0x4bd7fe,_0x3dfc1d){var _0x2c03bc={},_0x1a91cf={},_0x3ae73e={'count':0x0,'rows':[]};_0x1a91cf[_0xc04d('0x33')]=_[_0xc04d('0x35')](db['VoiceQueueReport'][_0xc04d('0x2f')]);_0x1a91cf[_0xc04d('0x34')]=_['keys'](_0x4bd7fe[_0xc04d('0x34')]);_0x1a91cf[_0xc04d('0x36')]=_['intersection'](_0x1a91cf[_0xc04d('0x33')],_0x1a91cf[_0xc04d('0x34')]);_0x2c03bc[_0xc04d('0x38')]=_[_0xc04d('0x37')](_0x1a91cf[_0xc04d('0x33')],qs[_0xc04d('0x39')](_0x4bd7fe[_0xc04d('0x34')][_0xc04d('0x39')]));_0x2c03bc[_0xc04d('0x38')]=_0x2c03bc[_0xc04d('0x38')]['length']?_0x2c03bc[_0xc04d('0x38')]:_0x1a91cf['model'];if(!_0x4bd7fe['query'][_0xc04d('0x3b')]('nolimit')){_0x2c03bc[_0xc04d('0x22')]=qs[_0xc04d('0x22')](_0x4bd7fe[_0xc04d('0x34')][_0xc04d('0x22')]);_0x2c03bc['offset']=qs[_0xc04d('0x20')](_0x4bd7fe['query']['offset']);}_0x2c03bc['order']=qs['sort'](_0x4bd7fe['query']['sort']);_0x2c03bc[_0xc04d('0x3f')]=qs[_0xc04d('0x36')](_[_0xc04d('0x40')](_0x4bd7fe[_0xc04d('0x34')],_0x1a91cf[_0xc04d('0x36')]));if(_0x4bd7fe[_0xc04d('0x34')]['filter']){_0x2c03bc[_0xc04d('0x3f')]=_[_0xc04d('0x42')](_0x2c03bc['where'],{'$or':_[_0xc04d('0x2e')](_0x2c03bc[_0xc04d('0x38')],function(_0x415958){var _0x1cae8e={};_0x1cae8e[_0x415958]={'$like':'%'+_0x4bd7fe[_0xc04d('0x34')]['filter']+'%'};return _0x1cae8e;})});}_0x2c03bc=_['merge']({},_0x2c03bc,_0x4bd7fe['options']);var _0x2aa8e8={'where':_0x2c03bc[_0xc04d('0x3f')]};return db[_0xc04d('0x45')]['count'](_0x2aa8e8)[_0xc04d('0x27')](function(_0x3f25d9){_0x3ae73e[_0xc04d('0x23')]=_0x3f25d9;if(_0x4bd7fe[_0xc04d('0x34')]['includeAll']){_0x2c03bc[_0xc04d('0x47')]=[{'all':!![]}];}return db[_0xc04d('0x45')][_0xc04d('0x48')](_0x2c03bc);})[_0xc04d('0x27')](function(_0x344c5a){_0x3ae73e[_0xc04d('0x51')]=_0x344c5a;return _0x3ae73e;})['then'](respondWithFilteredResult(_0x3dfc1d,_0x2c03bc,_0xc04d('0x50')))[_0xc04d('0x49')](handleError(_0x3dfc1d,null,'getVoiceQueuesReport'));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index d92c502..2507102 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 _0xf9f6=['save','remove','emit','hasOwnProperty','exports','events','../../mysqldb','VoiceQueueReport'];(function(_0xec7a27,_0x47c037){var _0x85982a=function(_0x7cc5){while(--_0x7cc5){_0xec7a27['push'](_0xec7a27['shift']());}};_0x85982a(++_0x47c037);}(_0xf9f6,0xbd));var _0x6f9f=function(_0x297eea,_0x5060be){_0x297eea=_0x297eea-0x0;var _0x1c42d2=_0xf9f6[_0x297eea];return _0x1c42d2;};'use strict';var EventEmitter=require(_0x6f9f('0x0'));var VoiceQueueReport=require(_0x6f9f('0x1'))['db'][_0x6f9f('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6f9f('0x3'),'afterUpdate':'update','afterDestroy':_0x6f9f('0x4')};function emitEvent(_0x17e927){return function(_0x23295f,_0x372a50,_0x217581){VoiceQueueReportEvents[_0x6f9f('0x5')](_0x17e927+':'+_0x23295f['id'],_0x23295f);VoiceQueueReportEvents[_0x6f9f('0x5')](_0x17e927,_0x23295f);_0x217581(null);};}for(var e in events){if(events[_0x6f9f('0x6')](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0x6f9f('0x7')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x8c63=['setMaxListeners','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoiceQueueReport'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x8c63,0x180));var _0x38c6=function(_0x45d394,_0x12d576){_0x45d394=_0x45d394-0x0;var _0xa947eb=_0x8c63[_0x45d394];return _0xa947eb;};'use strict';var EventEmitter=require(_0x38c6('0x0'));var VoiceQueueReport=require(_0x38c6('0x1'))['db'][_0x38c6('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x38c6('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x38c6('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2a3a92){return function(_0x40815d,_0x34a1b2,_0x57d621){VoiceQueueReportEvents[_0x38c6('0x5')](_0x2a3a92+':'+_0x40815d['id'],_0x40815d);VoiceQueueReportEvents[_0x38c6('0x5')](_0x2a3a92,_0x40815d);_0x57d621(null);};}for(var e in events){if(events[_0x38c6('0x6')](e)){var event=events[e];VoiceQueueReport[_0x38c6('0x7')](e,emitEvent(event));}}module[_0x38c6('0x8')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index a172cdc..62af113 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 _0x27e6=['VoiceQueueReport','report_queue','uniqueid','calleridnum','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x320f31,_0x433146){var _0x3c8b72=function(_0x3f02c4){while(--_0x3f02c4){_0x320f31['push'](_0x320f31['shift']());}};_0x3c8b72(++_0x433146);}(_0x27e6,0x121));var _0x627e=function(_0x2b28b2,_0x3854da){_0x2b28b2=_0x2b28b2-0x0;var _0x31ad01=_0x27e6[_0x2b28b2];return _0x31ad01;};'use strict';var _=require(_0x627e('0x0'));var util=require(_0x627e('0x1'));var logger=require(_0x627e('0x2'))(_0x627e('0x3'));var moment=require(_0x627e('0x4'));var BPromise=require('bluebird');var rp=require(_0x627e('0x5'));var fs=require('fs');var path=require(_0x627e('0x6'));var rimraf=require(_0x627e('0x7'));var config=require(_0x627e('0x8'));var attributes=require('./voiceQueueReport.attributes');module[_0x627e('0x9')]=function(_0x480c11,_0x516027){return _0x480c11[_0x627e('0xa')](_0x627e('0xb'),attributes,{'tableName':_0x627e('0xc'),'paranoid':![],'indexes':[{'fields':[_0x627e('0xd')]},{'fields':[_0x627e('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7f76=['define','VoiceQueueReport','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./voiceQueueReport.attributes','exports'];(function(_0x146b09,_0x345cd3){var _0x4e9e36=function(_0x1d9749){while(--_0x1d9749){_0x146b09['push'](_0x146b09['shift']());}};_0x4e9e36(++_0x345cd3);}(_0x7f76,0x1b2));var _0x67f7=function(_0x11a3c3,_0x59acac){_0x11a3c3=_0x11a3c3-0x0;var _0x7afd2f=_0x7f76[_0x11a3c3];return _0x7afd2f;};'use strict';var _=require(_0x67f7('0x0'));var util=require(_0x67f7('0x1'));var logger=require(_0x67f7('0x2'))('api');var moment=require(_0x67f7('0x3'));var BPromise=require(_0x67f7('0x4'));var rp=require(_0x67f7('0x5'));var fs=require('fs');var path=require(_0x67f7('0x6'));var rimraf=require(_0x67f7('0x7'));var config=require('../../config/environment');var attributes=require(_0x67f7('0x8'));module[_0x67f7('0x9')]=function(_0x303d9b,_0x37dbc5){return _0x303d9b[_0x67f7('0xa')](_0x67f7('0xb'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 122dad4..96128a5 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 _0x0652=['options','raw','where','limit','map','include','model','attributes','GetVoiceQueueReport','debug','CreateVoiceQueueReport','body','stringify','UpdateVoiceQueueReport','update','lodash','util','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s,\x20%s','error','VoiceQueueReport,\x20%s,\x20%s','message','result','catch','VoiceQueueReport'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0652,0xaf));var _0x2065=function(_0x522dde,_0x3d85b3){_0x522dde=_0x522dde-0x0;var _0x5e7231=_0x0652[_0x522dde];return _0x5e7231;};'use strict';var _=require(_0x2065('0x0'));var util=require(_0x2065('0x1'));var moment=require('moment');var BPromise=require(_0x2065('0x2'));var rs=require(_0x2065('0x3'));var fs=require('fs');var Redis=require(_0x2065('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2065('0x5'));var config=require(_0x2065('0x6'));var jayson=require(_0x2065('0x7'));var client=jayson[_0x2065('0x8')][_0x2065('0x9')]({'port':0x232a});config[_0x2065('0xa')]=_['defaults'](config[_0x2065('0xa')],{'host':_0x2065('0xb'),'port':0x18eb});var socket=require(_0x2065('0xc'))(new Redis(config[_0x2065('0xa')]));require(_0x2065('0xd'))[_0x2065('0xe')](socket);function respondWithRpcPromise(_0x43f7c5,_0x22c99a,_0x49475b){return new BPromise(function(_0x296a10,_0x51d12c){return client[_0x2065('0xf')](_0x43f7c5,_0x49475b)[_0x2065('0x10')](function(_0x255491){logger[_0x2065('0x11')]('VoiceQueueReport,\x20%s,\x20%s',_0x22c99a,'request\x20sent');logger['debug'](_0x2065('0x12'),_0x22c99a,'request\x20sent',JSON['stringify'](_0x255491));if(_0x255491[_0x2065('0x13')]){if(_0x255491[_0x2065('0x13')]['code']===0x1f4){logger[_0x2065('0x13')](_0x2065('0x14'),_0x22c99a,_0x255491[_0x2065('0x13')][_0x2065('0x15')]);return _0x51d12c(_0x255491['error']['message']);}logger[_0x2065('0x13')](_0x2065('0x14'),_0x22c99a,_0x255491[_0x2065('0x13')]['message']);return _0x296a10(_0x255491['error'][_0x2065('0x15')]);}else{logger[_0x2065('0x11')](_0x2065('0x14'),_0x22c99a,'request\x20sent');_0x296a10(_0x255491[_0x2065('0x16')][_0x2065('0x15')]);}})[_0x2065('0x17')](function(_0x20e442){logger[_0x2065('0x13')](_0x2065('0x14'),_0x22c99a,_0x20e442);_0x51d12c(_0x20e442);});});}exports['GetVoiceQueueReport']=function(_0x30fa44){var _0x53eb4c=this;return new Promise(function(_0x433aee,_0x1290a2){return db[_0x2065('0x18')]['findAll']({'raw':_0x30fa44['options']?_0x30fa44[_0x2065('0x19')][_0x2065('0x1a')]===undefined?!![]:![]:!![],'where':_0x30fa44[_0x2065('0x19')]?_0x30fa44[_0x2065('0x19')][_0x2065('0x1b')]||null:null,'attributes':_0x30fa44[_0x2065('0x19')]?_0x30fa44[_0x2065('0x19')]['attributes']||null:null,'limit':_0x30fa44[_0x2065('0x19')]?_0x30fa44['options'][_0x2065('0x1c')]||null:null,'include':_0x30fa44[_0x2065('0x19')]?_0x30fa44[_0x2065('0x19')]['include']?_[_0x2065('0x1d')](_0x30fa44[_0x2065('0x19')][_0x2065('0x1e')],function(_0x29866d){return{'model':db[_0x29866d[_0x2065('0x1f')]],'as':_0x29866d['as'],'attributes':_0x29866d[_0x2065('0x20')],'include':_0x29866d[_0x2065('0x1e')]?_['map'](_0x29866d['include'],function(_0x5c1768){return{'model':db[_0x5c1768[_0x2065('0x1f')]],'as':_0x5c1768['as'],'attributes':_0x5c1768[_0x2065('0x20')],'include':_0x5c1768[_0x2065('0x1e')]?_['map'](_0x5c1768[_0x2065('0x1e')],function(_0x164adc){return{'model':db[_0x164adc[_0x2065('0x1f')]],'as':_0x164adc['as'],'attributes':_0x164adc[_0x2065('0x20')]};}):[]};}):[]};}):[]:[]})[_0x2065('0x10')](function(_0x46edf5){logger[_0x2065('0x11')](_0x2065('0x21'),_0x30fa44);logger[_0x2065('0x22')](_0x2065('0x21'),_0x30fa44,JSON['stringify'](_0x46edf5));_0x433aee(_0x46edf5);})['catch'](function(_0x5a3ff3){logger[_0x2065('0x13')](_0x2065('0x21'),_0x5a3ff3[_0x2065('0x15')],_0x30fa44);_0x1290a2(_0x53eb4c[_0x2065('0x13')](0x1f4,_0x5a3ff3['message']));});});};exports[_0x2065('0x23')]=function(_0x2c0465){var _0x3843d2=this;return new Promise(function(_0x21304a,_0x3eeb8c){return db[_0x2065('0x18')]['create'](_0x2c0465[_0x2065('0x24')],{'raw':_0x2c0465[_0x2065('0x19')]?_0x2c0465[_0x2065('0x19')][_0x2065('0x1a')]===undefined?!![]:![]:!![]})[_0x2065('0x10')](function(_0x171857){logger[_0x2065('0x11')]('CreateVoiceQueueReport',_0x2c0465);logger['debug'](_0x2065('0x23'),_0x2c0465,JSON[_0x2065('0x25')](_0x171857));_0x21304a(_0x171857);})['catch'](function(_0x51a496){logger['error'](_0x2065('0x23'),_0x51a496['message'],_0x2c0465);_0x3eeb8c(_0x3843d2[_0x2065('0x13')](0x1f4,_0x51a496[_0x2065('0x15')]));});});};exports[_0x2065('0x26')]=function(_0x42adc2){var _0x3c2ebe=this;return new Promise(function(_0x149bfa,_0x5d7184){return db['VoiceQueueReport'][_0x2065('0x27')](_0x42adc2['body'],{'raw':_0x42adc2[_0x2065('0x19')]?_0x42adc2[_0x2065('0x19')][_0x2065('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x42adc2[_0x2065('0x19')]?_0x42adc2['options'][_0x2065('0x1b')]||null:null,'attributes':_0x42adc2[_0x2065('0x19')]?_0x42adc2[_0x2065('0x19')][_0x2065('0x20')]||null:null,'limit':_0x42adc2['options']?_0x42adc2['options'][_0x2065('0x1c')]||null:null})[_0x2065('0x10')](function(_0x3abf1e){logger['info'](_0x2065('0x26'),_0x42adc2);logger[_0x2065('0x22')](_0x2065('0x26'),_0x42adc2,JSON[_0x2065('0x25')](_0x3abf1e));_0x149bfa(_0x3abf1e);})['catch'](function(_0x346e69){logger[_0x2065('0x13')](_0x2065('0x26'),_0x346e69['message'],_0x42adc2);_0x5d7184(_0x3c2ebe[_0x2065('0x13')](0x1f4,_0x346e69[_0x2065('0x15')]));});});}; \ No newline at end of file +var _0xed0c=['defaults','socket.io-emitter','./voiceQueueReport.socket','register','request','VoiceQueueReport,\x20%s,\x20%s','VoiceQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','GetVoiceQueueReport','VoiceQueueReport','options','raw','where','attributes','limit','include','map','model','then','debug','CreateVoiceQueueReport','body','UpdateVoiceQueueReport','update','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','redis'];(function(_0x4b4f24,_0x5654a8){var _0x1c13d4=function(_0x4940bf){while(--_0x4940bf){_0x4b4f24['push'](_0x4b4f24['shift']());}};_0x1c13d4(++_0x5654a8);}(_0xed0c,0x15f));var _0xced0=function(_0x3446bf,_0x47f1d5){_0x3446bf=_0x3446bf-0x0;var _0x2b051=_0xed0c[_0x3446bf];return _0x2b051;};'use strict';var _=require(_0xced0('0x0'));var util=require(_0xced0('0x1'));var moment=require('moment');var BPromise=require(_0xced0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xced0('0x3'));var db=require(_0xced0('0x4'))['db'];var utils=require(_0xced0('0x5'));var logger=require('../../config/logger')(_0xced0('0x6'));var config=require(_0xced0('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0xced0('0x8')]=_[_0xced0('0x9')](config[_0xced0('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xced0('0xa'))(new Redis(config['redis']));require(_0xced0('0xb'))[_0xced0('0xc')](socket);function respondWithRpcPromise(_0x2ab896,_0x36fc50,_0x205686){return new BPromise(function(_0x1b01d6,_0x2a175a){return client[_0xced0('0xd')](_0x2ab896,_0x205686)['then'](function(_0x5aaecf){logger['info'](_0xced0('0xe'),_0x36fc50,'request\x20sent');logger['debug'](_0xced0('0xf'),_0x36fc50,_0xced0('0x10'),JSON[_0xced0('0x11')](_0x5aaecf));if(_0x5aaecf[_0xced0('0x12')]){if(_0x5aaecf[_0xced0('0x12')][_0xced0('0x13')]===0x1f4){logger['error'](_0xced0('0xe'),_0x36fc50,_0x5aaecf[_0xced0('0x12')][_0xced0('0x14')]);return _0x2a175a(_0x5aaecf[_0xced0('0x12')][_0xced0('0x14')]);}logger[_0xced0('0x12')](_0xced0('0xe'),_0x36fc50,_0x5aaecf[_0xced0('0x12')][_0xced0('0x14')]);return _0x1b01d6(_0x5aaecf[_0xced0('0x12')][_0xced0('0x14')]);}else{logger[_0xced0('0x15')](_0xced0('0xe'),_0x36fc50,_0xced0('0x10'));_0x1b01d6(_0x5aaecf[_0xced0('0x16')][_0xced0('0x14')]);}})[_0xced0('0x17')](function(_0x37bfd2){logger[_0xced0('0x12')](_0xced0('0xe'),_0x36fc50,_0x37bfd2);_0x2a175a(_0x37bfd2);});});}exports[_0xced0('0x18')]=function(_0x2756d6){var _0x3430e5=this;return new Promise(function(_0x4635e5,_0x351d5a){return db[_0xced0('0x19')]['findAll']({'raw':_0x2756d6[_0xced0('0x1a')]?_0x2756d6[_0xced0('0x1a')][_0xced0('0x1b')]===undefined?!![]:![]:!![],'where':_0x2756d6[_0xced0('0x1a')]?_0x2756d6[_0xced0('0x1a')][_0xced0('0x1c')]||null:null,'attributes':_0x2756d6['options']?_0x2756d6[_0xced0('0x1a')][_0xced0('0x1d')]||null:null,'limit':_0x2756d6[_0xced0('0x1a')]?_0x2756d6[_0xced0('0x1a')][_0xced0('0x1e')]||null:null,'include':_0x2756d6['options']?_0x2756d6[_0xced0('0x1a')][_0xced0('0x1f')]?_[_0xced0('0x20')](_0x2756d6[_0xced0('0x1a')][_0xced0('0x1f')],function(_0x55495c){return{'model':db[_0x55495c[_0xced0('0x21')]],'as':_0x55495c['as'],'attributes':_0x55495c[_0xced0('0x1d')],'include':_0x55495c[_0xced0('0x1f')]?_[_0xced0('0x20')](_0x55495c['include'],function(_0x485864){return{'model':db[_0x485864[_0xced0('0x21')]],'as':_0x485864['as'],'attributes':_0x485864[_0xced0('0x1d')],'include':_0x485864[_0xced0('0x1f')]?_[_0xced0('0x20')](_0x485864['include'],function(_0x5baa2f){return{'model':db[_0x5baa2f[_0xced0('0x21')]],'as':_0x5baa2f['as'],'attributes':_0x5baa2f[_0xced0('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xced0('0x22')](function(_0x6cf758){logger['info'](_0xced0('0x18'),_0x2756d6);logger[_0xced0('0x23')](_0xced0('0x18'),_0x2756d6,JSON['stringify'](_0x6cf758));_0x4635e5(_0x6cf758);})[_0xced0('0x17')](function(_0x2a936a){logger[_0xced0('0x12')](_0xced0('0x18'),_0x2a936a[_0xced0('0x14')],_0x2756d6);_0x351d5a(_0x3430e5[_0xced0('0x12')](0x1f4,_0x2a936a[_0xced0('0x14')]));});});};exports[_0xced0('0x24')]=function(_0x548222){var _0x3cdf90=this;return new Promise(function(_0x17cabc,_0xbc552c){return db[_0xced0('0x19')]['create'](_0x548222[_0xced0('0x25')],{'raw':_0x548222[_0xced0('0x1a')]?_0x548222[_0xced0('0x1a')][_0xced0('0x1b')]===undefined?!![]:![]:!![]})[_0xced0('0x22')](function(_0x58793a){logger[_0xced0('0x15')](_0xced0('0x24'),_0x548222);logger[_0xced0('0x23')](_0xced0('0x24'),_0x548222,JSON[_0xced0('0x11')](_0x58793a));_0x17cabc(_0x58793a);})[_0xced0('0x17')](function(_0x45921f){logger['error'](_0xced0('0x24'),_0x45921f['message'],_0x548222);_0xbc552c(_0x3cdf90[_0xced0('0x12')](0x1f4,_0x45921f[_0xced0('0x14')]));});});};exports[_0xced0('0x26')]=function(_0x285f07){var _0x92b6c2=this;return new Promise(function(_0x5468a3,_0x2f36e4){return db[_0xced0('0x19')][_0xced0('0x27')](_0x285f07[_0xced0('0x25')],{'raw':_0x285f07[_0xced0('0x1a')]?_0x285f07[_0xced0('0x1a')][_0xced0('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x285f07[_0xced0('0x1a')]?_0x285f07[_0xced0('0x1a')][_0xced0('0x1c')]||null:null,'attributes':_0x285f07[_0xced0('0x1a')]?_0x285f07['options'][_0xced0('0x1d')]||null:null,'limit':_0x285f07[_0xced0('0x1a')]?_0x285f07[_0xced0('0x1a')][_0xced0('0x1e')]||null:null})[_0xced0('0x22')](function(_0x1fcb76){logger[_0xced0('0x15')]('UpdateVoiceQueueReport',_0x285f07);logger[_0xced0('0x23')](_0xced0('0x26'),_0x285f07,JSON['stringify'](_0x1fcb76));_0x5468a3(_0x1fcb76);})[_0xced0('0x17')](function(_0x45d65a){logger[_0xced0('0x12')](_0xced0('0x26'),_0x45d65a['message'],_0x285f07);_0x2f36e4(_0x92b6c2[_0xced0('0x12')](0x1f4,_0x45d65a[_0xced0('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 3602b30..38fb397 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 _0xf2cf=['save','remove','update','emit','removeListener','length','voiceQueueReport:'];(function(_0x15958f,_0x393bf4){var _0x2f6c79=function(_0x3f51ee){while(--_0x3f51ee){_0x15958f['push'](_0x15958f['shift']());}};_0x2f6c79(++_0x393bf4);}(_0xf2cf,0xf5));var _0xff2c=function(_0xfee57d,_0x2269c6){_0xfee57d=_0xfee57d-0x0;var _0x17bcf1=_0xf2cf[_0xfee57d];return _0x17bcf1;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0xff2c('0x0'),_0xff2c('0x1'),_0xff2c('0x2')];function createListener(_0x5ef2da,_0x8c6724){return function(_0x3d98a5){_0x8c6724[_0xff2c('0x3')](_0x5ef2da,_0x3d98a5);};}function removeListener(_0x2ff0e4,_0x189ac6){return function(){VoiceQueueReportEvents[_0xff2c('0x4')](_0x2ff0e4,_0x189ac6);};}exports['register']=function(_0x8f0f4){for(var _0x68b356=0x0,_0x57ba3d=events[_0xff2c('0x5')];_0x68b356<_0x57ba3d;_0x68b356++){var _0x223a86=events[_0x68b356];var _0x105f4d=createListener(_0xff2c('0x6')+_0x223a86,_0x8f0f4);VoiceQueueReportEvents['on'](_0x223a86,_0x105f4d);}}; \ No newline at end of file +var _0x2fa9=['emit','register','length','voiceQueueReport:','./voiceQueueReport.events','save','remove','update'];(function(_0x21c0de,_0x4a9720){var _0x32229e=function(_0x275c29){while(--_0x275c29){_0x21c0de['push'](_0x21c0de['shift']());}};_0x32229e(++_0x4a9720);}(_0x2fa9,0x144));var _0x92fa=function(_0x46ba50,_0x24068a){_0x46ba50=_0x46ba50-0x0;var _0x4dedef=_0x2fa9[_0x46ba50];return _0x4dedef;};'use strict';var VoiceQueueReportEvents=require(_0x92fa('0x0'));var events=[_0x92fa('0x1'),_0x92fa('0x2'),_0x92fa('0x3')];function createListener(_0x103ebe,_0x3221b5){return function(_0x5d24db){_0x3221b5[_0x92fa('0x4')](_0x103ebe,_0x5d24db);};}function removeListener(_0x2f9f15,_0x361e63){return function(){VoiceQueueReportEvents['removeListener'](_0x2f9f15,_0x361e63);};}exports[_0x92fa('0x5')]=function(_0x3fa3cc){for(var _0x1a9f28=0x0,_0x4a3d25=events[_0x92fa('0x6')];_0x1a9f28<_0x4a3d25;_0x1a9f28++){var _0x30cf75=events[_0x1a9f28];var _0x3f5bd9=createListener(_0x92fa('0x7')+_0x30cf75,_0x3fa3cc);VoiceQueueReportEvents['on'](_0x30cf75,_0x3f5bd9);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 00ad341..2366f98 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 _0x7857=['../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id','post','put','update','destroy','exports','util','express','Router','../../components/interaction/service'];(function(_0x2bf1df,_0x280bc1){var _0x507f7d=function(_0x30e626){while(--_0x30e626){_0x2bf1df['push'](_0x2bf1df['shift']());}};_0x507f7d(++_0x280bc1);}(_0x7857,0x1af));var _0x7785=function(_0x5b032b,_0x2b3ab3){_0x5b032b=_0x5b032b-0x0;var _0x4fec9a=_0x7857[_0x5b032b];return _0x4fec9a;};'use strict';var multer=require('multer');var util=require(_0x7785('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7785('0x1'));var router=express[_0x7785('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x7785('0x3'));var config=require(_0x7785('0x4'));var controller=require(_0x7785('0x5'));router[_0x7785('0x6')]('/',auth[_0x7785('0x7')](),controller[_0x7785('0x8')]);router[_0x7785('0x6')](_0x7785('0x9'),auth[_0x7785('0x7')](),controller['show']);router[_0x7785('0xa')]('/',auth[_0x7785('0x7')](),controller['create']);router[_0x7785('0xb')](_0x7785('0x9'),auth[_0x7785('0x7')](),controller[_0x7785('0xc')]);router['delete'](_0x7785('0x9'),auth[_0x7785('0x7')](),controller[_0x7785('0xd')]);module[_0x7785('0xe')]=router; \ No newline at end of file +var _0xcd1b=['destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','get','/:id','show','post','create','update','delete'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xcd1b,0x18e));var _0xbcd1=function(_0x1c8d4e,_0xe5779b){_0x1c8d4e=_0x1c8d4e-0x0;var _0x29409a=_0xcd1b[_0x1c8d4e];return _0x29409a;};'use strict';var multer=require(_0xbcd1('0x0'));var util=require(_0xbcd1('0x1'));var path=require('path');var timeout=require(_0xbcd1('0x2'));var express=require(_0xbcd1('0x3'));var router=express[_0xbcd1('0x4')]();var fs_extra=require(_0xbcd1('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xbcd1('0x6'));var config=require(_0xbcd1('0x7'));var controller=require('./voiceQueuesLog.controller');router['get']('/',auth[_0xbcd1('0x8')](),controller['index']);router[_0xbcd1('0x9')](_0xbcd1('0xa'),auth[_0xbcd1('0x8')](),controller[_0xbcd1('0xb')]);router[_0xbcd1('0xc')]('/',auth[_0xbcd1('0x8')](),controller[_0xbcd1('0xd')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xbcd1('0xe')]);router[_0xbcd1('0xf')]('/:id',auth[_0xbcd1('0x8')](),controller[_0xbcd1('0x10')]);module[_0xbcd1('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index d56ae8d..ac5d9eb 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 _0x4ade=['sequelize','moment','exports','STRING','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP'];(function(_0x139023,_0x45b7d7){var _0x24ae83=function(_0x487caf){while(--_0x487caf){_0x139023['push'](_0x139023['shift']());}};_0x24ae83(++_0x45b7d7);}(_0x4ade,0xae));var _0xe4ad=function(_0x208d56,_0x5070d7){_0x208d56=_0x208d56-0x0;var _0x3af91a=_0x4ade[_0x208d56];return _0x3af91a;};'use strict';var Sequelize=require(_0xe4ad('0x0'));var moment=require(_0xe4ad('0x1'));module[_0xe4ad('0x2')]={'time':{'type':Sequelize[_0xe4ad('0x3')]},'callid':{'type':Sequelize[_0xe4ad('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xe4ad('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xe4ad('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xe4ad('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xe4ad('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xe4ad('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xe4ad('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xe4ad('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xe4ad('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xe4ad('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0xe4ad('0x4')](_0xe4ad('0x5'))}}; \ No newline at end of file +var _0x5337=['literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','moment','exports','STRING','DATE'];(function(_0x4d189e,_0x2c0a04){var _0x1b36df=function(_0x2d386c){while(--_0x2d386c){_0x4d189e['push'](_0x4d189e['shift']());}};_0x1b36df(++_0x2c0a04);}(_0x5337,0x8e));var _0x7533=function(_0x5a58af,_0x2fd0e0){_0x5a58af=_0x5a58af-0x0;var _0x40b593=_0x5337[_0x5a58af];return _0x40b593;};'use strict';var Sequelize=require(_0x7533('0x0'));var moment=require(_0x7533('0x1'));module[_0x7533('0x2')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0x7533('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x7533('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x7533('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x7533('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x7533('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x7533('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x7533('0x4')],'allowNull':![],'defaultValue':Sequelize[_0x7533('0x5')](_0x7533('0x6'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 10ab9c8..0757b22 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 _0x60e5=['stack','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','nolimit','order','sort','where','pick','merge','filter','options','include','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','destroy','then','sendStatus','error'];(function(_0x370032,_0x4406c6){var _0x5cd605=function(_0x838862){while(--_0x838862){_0x370032['push'](_0x370032['shift']());}};_0x5cd605(++_0x4406c6);}(_0x60e5,0x1a3));var _0x560e=function(_0x5774be,_0x2259d3){_0x5774be=_0x5774be-0x0;var _0x4914b4=_0x60e5[_0x5774be];return _0x4914b4;};'use strict';var emlformat=require(_0x560e('0x0'));var rimraf=require(_0x560e('0x1'));var zipdir=require(_0x560e('0x2'));var jsonpatch=require(_0x560e('0x3'));var rp=require(_0x560e('0x4'));var moment=require(_0x560e('0x5'));var BPromise=require(_0x560e('0x6'));var Mustache=require('mustache');var util=require(_0x560e('0x7'));var path=require('path');var sox=require(_0x560e('0x8'));var csv=require(_0x560e('0x9'));var ejs=require(_0x560e('0xa'));var fs=require('fs');var fs_extra=require(_0x560e('0xb'));var _=require('lodash');var squel=require(_0x560e('0xc'));var crypto=require(_0x560e('0xd'));var jsforce=require(_0x560e('0xe'));var deskjs=require(_0x560e('0xf'));var toCsv=require(_0x560e('0x9'));var querystring=require('querystring');var Papa=require(_0x560e('0x10'));var Redis=require(_0x560e('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x560e('0x12'));var as=require(_0x560e('0x13'));var hardwareService=require(_0x560e('0x14'));var logger=require(_0x560e('0x15'))(_0x560e('0x16'));var utils=require(_0x560e('0x17'));var config=require(_0x560e('0x18'));var licenseUtil=require(_0x560e('0x19'));var db=require(_0x560e('0x1a'))['db'];function respondWithStatusCode(_0x50b3d8,_0x36ef3e){_0x36ef3e=_0x36ef3e||0xcc;return function(_0x3b984b){if(_0x3b984b){return _0x50b3d8['sendStatus'](_0x36ef3e);}return _0x50b3d8[_0x560e('0x1b')](_0x36ef3e)[_0x560e('0x1c')]();};}function respondWithResult(_0xbc55b5,_0x107c58){_0x107c58=_0x107c58||0xc8;return function(_0x1805ea){if(_0x1805ea){return _0xbc55b5[_0x560e('0x1b')](_0x107c58)[_0x560e('0x1d')](_0x1805ea);}};}function respondWithFilteredResult(_0x3d2ab6,_0x4b7c77){return function(_0x4dfc14){if(_0x4dfc14){var _0x165edb=typeof _0x4b7c77[_0x560e('0x1e')]==='undefined'&&typeof _0x4b7c77[_0x560e('0x1f')]===_0x560e('0x20');var _0x50bb06=_0x4dfc14[_0x560e('0x21')];var _0x2d4741=_0x165edb?0x0:_0x4b7c77[_0x560e('0x1e')];var _0x78828c=_0x165edb?_0x4dfc14[_0x560e('0x21')]:_0x4b7c77[_0x560e('0x1e')]+_0x4b7c77['limit'];var _0x232fa2;if(_0x78828c>=_0x50bb06){_0x78828c=_0x50bb06;_0x232fa2=0xc8;}else{_0x232fa2=0xce;}_0x3d2ab6[_0x560e('0x1b')](_0x232fa2);return _0x3d2ab6[_0x560e('0x22')](_0x560e('0x23'),_0x2d4741+'-'+_0x78828c+'/'+_0x50bb06)['json'](_0x4dfc14);}return null;};}function patchUpdates(_0x48ffa9){return function(_0x4eb3b7){try{jsonpatch[_0x560e('0x24')](_0x4eb3b7,_0x48ffa9,!![]);}catch(_0x22af52){return BPromise['reject'](_0x22af52);}return _0x4eb3b7[_0x560e('0x25')]();};}function saveUpdates(_0x53937c,_0x3630fb){return function(_0x43f6ef){if(_0x43f6ef){return _0x43f6ef[_0x560e('0x26')](_0x53937c)['then'](function(_0x3356e8){return _0x3356e8;});}return null;};}function removeEntity(_0x1fe014,_0x55a4de){return function(_0x3bbcd0){if(_0x3bbcd0){return _0x3bbcd0[_0x560e('0x27')]()[_0x560e('0x28')](function(){_0x1fe014['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ac0bb,_0xffcce3){return function(_0x585bcd){if(!_0x585bcd){_0x1ac0bb[_0x560e('0x29')](0x194);}return _0x585bcd;};}function handleError(_0x28e382,_0x5da4ac){_0x5da4ac=_0x5da4ac||0x1f4;return function(_0x1c92bc){logger[_0x560e('0x2a')](_0x1c92bc[_0x560e('0x2b')]);if(_0x1c92bc[_0x560e('0x2c')]){delete _0x1c92bc['name'];}_0x28e382[_0x560e('0x1b')](_0x5da4ac)[_0x560e('0x2d')](_0x1c92bc);};}exports[_0x560e('0x2e')]=function(_0x2ebb99,_0x5e9492){var _0x5145b3={},_0x2c17be={},_0x2df3de={'count':0x0,'rows':[]};var _0x4d0c9a=_[_0x560e('0x2f')](db[_0x560e('0x30')][_0x560e('0x31')],function(_0x2f3dac){return{'name':_0x2f3dac[_0x560e('0x32')],'type':_0x2f3dac[_0x560e('0x33')][_0x560e('0x34')]};});_0x2c17be[_0x560e('0x35')]=_[_0x560e('0x2f')](_0x4d0c9a,'name');_0x2c17be['query']=_[_0x560e('0x36')](_0x2ebb99['query']);_0x2c17be[_0x560e('0x37')]=_[_0x560e('0x38')](_0x2c17be[_0x560e('0x35')],_0x2c17be[_0x560e('0x39')]);_0x5145b3[_0x560e('0x3a')]=_['intersection'](_0x2c17be[_0x560e('0x35')],qs[_0x560e('0x3b')](_0x2ebb99[_0x560e('0x39')]['fields']));_0x5145b3[_0x560e('0x3a')]=_0x5145b3[_0x560e('0x3a')][_0x560e('0x3c')]?_0x5145b3['attributes']:_0x2c17be[_0x560e('0x35')];if(!_0x2ebb99[_0x560e('0x39')]['hasOwnProperty'](_0x560e('0x3d'))){_0x5145b3['limit']=qs['limit'](_0x2ebb99[_0x560e('0x39')][_0x560e('0x1f')]);_0x5145b3[_0x560e('0x1e')]=qs[_0x560e('0x1e')](_0x2ebb99['query'][_0x560e('0x1e')]);}_0x5145b3[_0x560e('0x3e')]=qs[_0x560e('0x3f')](_0x2ebb99[_0x560e('0x39')]['sort']);_0x5145b3[_0x560e('0x40')]=qs[_0x560e('0x37')](_[_0x560e('0x41')](_0x2ebb99[_0x560e('0x39')],_0x2c17be[_0x560e('0x37')]),_0x4d0c9a);if(_0x2ebb99[_0x560e('0x39')]['filter']){_0x5145b3[_0x560e('0x40')]=_[_0x560e('0x42')](_0x5145b3[_0x560e('0x40')],{'$or':_[_0x560e('0x2f')](_0x4d0c9a,function(_0x1a5cbb){if(_0x1a5cbb[_0x560e('0x33')]!=='VIRTUAL'){var _0x735ab0={};_0x735ab0[_0x1a5cbb[_0x560e('0x2c')]]={'$like':'%'+_0x2ebb99[_0x560e('0x39')][_0x560e('0x43')]+'%'};return _0x735ab0;}})});}_0x5145b3=_[_0x560e('0x42')]({},_0x5145b3,_0x2ebb99[_0x560e('0x44')]);var _0x38b0c8={'where':_0x5145b3[_0x560e('0x40')]};return db[_0x560e('0x30')][_0x560e('0x21')](_0x38b0c8)[_0x560e('0x28')](function(_0x5a13d9){_0x2df3de[_0x560e('0x21')]=_0x5a13d9;if(_0x2ebb99[_0x560e('0x39')]['includeAll']){_0x5145b3[_0x560e('0x45')]=[{'all':!![]}];}return db[_0x560e('0x30')]['findAll'](_0x5145b3);})['then'](function(_0x5b4c08){_0x2df3de[_0x560e('0x46')]=_0x5b4c08;return _0x2df3de;})['then'](respondWithFilteredResult(_0x5e9492,_0x5145b3))[_0x560e('0x47')](handleError(_0x5e9492,null));};exports[_0x560e('0x48')]=function(_0x1a282e,_0x490f66){var _0xd98625={'raw':!![],'where':{'id':_0x1a282e[_0x560e('0x49')]['id']}},_0x43af41={};_0x43af41[_0x560e('0x35')]=_[_0x560e('0x36')](db['VoiceQueuesLog'][_0x560e('0x31')]);_0x43af41[_0x560e('0x39')]=_['keys'](_0x1a282e['query']);_0x43af41['filters']=_['intersection'](_0x43af41['model'],_0x43af41[_0x560e('0x39')]);_0xd98625[_0x560e('0x3a')]=_['intersection'](_0x43af41[_0x560e('0x35')],qs[_0x560e('0x3b')](_0x1a282e['query']['fields']));_0xd98625[_0x560e('0x3a')]=_0xd98625['attributes'][_0x560e('0x3c')]?_0xd98625[_0x560e('0x3a')]:_0x43af41[_0x560e('0x35')];if(_0x1a282e['query']['includeAll']){_0xd98625[_0x560e('0x45')]=[{'all':!![]}];}_0xd98625=_[_0x560e('0x42')]({},_0xd98625,_0x1a282e['options']);return db[_0x560e('0x30')][_0x560e('0x4a')](_0xd98625)[_0x560e('0x28')](handleEntityNotFound(_0x490f66,null))[_0x560e('0x28')](respondWithResult(_0x490f66,null))[_0x560e('0x47')](handleError(_0x490f66,null));};exports[_0x560e('0x4b')]=function(_0xb1761,_0x17101c){return db[_0x560e('0x30')]['create'](_0xb1761[_0x560e('0x4c')],{})[_0x560e('0x28')](respondWithResult(_0x17101c,0xc9))[_0x560e('0x47')](handleError(_0x17101c,null));};exports[_0x560e('0x26')]=function(_0x4e0de1,_0x3162b7){if(_0x4e0de1[_0x560e('0x4c')]['id']){delete _0x4e0de1[_0x560e('0x4c')]['id'];}return db[_0x560e('0x30')]['find']({'where':{'id':_0x4e0de1[_0x560e('0x49')]['id']}})['then'](handleEntityNotFound(_0x3162b7,null))[_0x560e('0x28')](saveUpdates(_0x4e0de1[_0x560e('0x4c')],null))[_0x560e('0x28')](respondWithResult(_0x3162b7,null))['catch'](handleError(_0x3162b7,null));};exports[_0x560e('0x27')]=function(_0x553298,_0x359ecf){return db['VoiceQueuesLog'][_0x560e('0x4a')]({'where':{'id':_0x553298['params']['id']}})['then'](handleEntityNotFound(_0x359ecf,null))['then'](removeEntity(_0x359ecf,null))['catch'](handleError(_0x359ecf,null));}; \ No newline at end of file +var _0x88ee=['error','stack','name','send','index','map','VoiceQueuesLog','rawAttributes','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','filter','merge','options','includeAll','findAll','rows','show','params','length','include','catch','create','body','find','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','save','update','then','destroy'];(function(_0x3c9409,_0x2f571a){var _0x3c3770=function(_0x1fbf94){while(--_0x1fbf94){_0x3c9409['push'](_0x3c9409['shift']());}};_0x3c3770(++_0x2f571a);}(_0x88ee,0x1cb));var _0xe88e=function(_0xf0b33a,_0x59019a){_0xf0b33a=_0xf0b33a-0x0;var _0x4d9726=_0x88ee[_0xf0b33a];return _0x4d9726;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe88e('0x0'));var rp=require(_0xe88e('0x1'));var moment=require(_0xe88e('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xe88e('0x3'));var util=require('util');var path=require(_0xe88e('0x4'));var sox=require(_0xe88e('0x5'));var csv=require(_0xe88e('0x6'));var ejs=require(_0xe88e('0x7'));var fs=require('fs');var fs_extra=require(_0xe88e('0x8'));var _=require(_0xe88e('0x9'));var squel=require(_0xe88e('0xa'));var crypto=require(_0xe88e('0xb'));var jsforce=require(_0xe88e('0xc'));var deskjs=require(_0xe88e('0xd'));var toCsv=require(_0xe88e('0x6'));var querystring=require(_0xe88e('0xe'));var Papa=require(_0xe88e('0xf'));var Redis=require(_0xe88e('0x10'));var authService=require(_0xe88e('0x11'));var qs=require(_0xe88e('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe88e('0x13'))(_0xe88e('0x14'));var utils=require(_0xe88e('0x15'));var config=require(_0xe88e('0x16'));var licenseUtil=require(_0xe88e('0x17'));var db=require(_0xe88e('0x18'))['db'];function respondWithStatusCode(_0x149ad1,_0x30f50a){_0x30f50a=_0x30f50a||0xcc;return function(_0x1e3493){if(_0x1e3493){return _0x149ad1[_0xe88e('0x19')](_0x30f50a);}return _0x149ad1[_0xe88e('0x1a')](_0x30f50a)['end']();};}function respondWithResult(_0x1dfcf3,_0x9edda0){_0x9edda0=_0x9edda0||0xc8;return function(_0x44dacd){if(_0x44dacd){return _0x1dfcf3['status'](_0x9edda0)[_0xe88e('0x1b')](_0x44dacd);}};}function respondWithFilteredResult(_0x125d39,_0x23b2dc){return function(_0x1e1afd){if(_0x1e1afd){var _0x4e83e8=typeof _0x23b2dc[_0xe88e('0x1c')]===_0xe88e('0x1d')&&typeof _0x23b2dc[_0xe88e('0x1e')]===_0xe88e('0x1d');var _0x1faf5b=_0x1e1afd['count'];var _0x2a7f86=_0x4e83e8?0x0:_0x23b2dc[_0xe88e('0x1c')];var _0x4c71f4=_0x4e83e8?_0x1e1afd[_0xe88e('0x1f')]:_0x23b2dc[_0xe88e('0x1c')]+_0x23b2dc[_0xe88e('0x1e')];var _0x157cd5;if(_0x4c71f4>=_0x1faf5b){_0x4c71f4=_0x1faf5b;_0x157cd5=0xc8;}else{_0x157cd5=0xce;}_0x125d39['status'](_0x157cd5);return _0x125d39[_0xe88e('0x20')]('Content-Range',_0x2a7f86+'-'+_0x4c71f4+'/'+_0x1faf5b)[_0xe88e('0x1b')](_0x1e1afd);}return null;};}function patchUpdates(_0x26cacf){return function(_0x3ecb82){try{jsonpatch[_0xe88e('0x21')](_0x3ecb82,_0x26cacf,!![]);}catch(_0xa44983){return BPromise['reject'](_0xa44983);}return _0x3ecb82[_0xe88e('0x22')]();};}function saveUpdates(_0x4a83f2,_0x37153f){return function(_0x2401b0){if(_0x2401b0){return _0x2401b0[_0xe88e('0x23')](_0x4a83f2)[_0xe88e('0x24')](function(_0x1ffd0b){return _0x1ffd0b;});}return null;};}function removeEntity(_0x1e943b,_0x21b836){return function(_0x433fd9){if(_0x433fd9){return _0x433fd9[_0xe88e('0x25')]()[_0xe88e('0x24')](function(){_0x1e943b[_0xe88e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x32de4a,_0x1a9392){return function(_0x158229){if(!_0x158229){_0x32de4a[_0xe88e('0x19')](0x194);}return _0x158229;};}function handleError(_0x6ef7e9,_0x1d7f3d){_0x1d7f3d=_0x1d7f3d||0x1f4;return function(_0x327a5d){logger[_0xe88e('0x26')](_0x327a5d[_0xe88e('0x27')]);if(_0x327a5d[_0xe88e('0x28')]){delete _0x327a5d[_0xe88e('0x28')];}_0x6ef7e9['status'](_0x1d7f3d)[_0xe88e('0x29')](_0x327a5d);};}exports[_0xe88e('0x2a')]=function(_0x3b8f27,_0x4dc32e){var _0x1e7607={},_0x26f55f={},_0x17ff77={'count':0x0,'rows':[]};var _0x53bfcf=_[_0xe88e('0x2b')](db[_0xe88e('0x2c')][_0xe88e('0x2d')],function(_0x28e1bc){return{'name':_0x28e1bc['fieldName'],'type':_0x28e1bc['type']['key']};});_0x26f55f['model']=_[_0xe88e('0x2b')](_0x53bfcf,_0xe88e('0x28'));_0x26f55f[_0xe88e('0x2e')]=_[_0xe88e('0x2f')](_0x3b8f27['query']);_0x26f55f[_0xe88e('0x30')]=_[_0xe88e('0x31')](_0x26f55f[_0xe88e('0x32')],_0x26f55f[_0xe88e('0x2e')]);_0x1e7607[_0xe88e('0x33')]=_['intersection'](_0x26f55f[_0xe88e('0x32')],qs['fields'](_0x3b8f27['query'][_0xe88e('0x34')]));_0x1e7607[_0xe88e('0x33')]=_0x1e7607[_0xe88e('0x33')]['length']?_0x1e7607[_0xe88e('0x33')]:_0x26f55f[_0xe88e('0x32')];if(!_0x3b8f27[_0xe88e('0x2e')][_0xe88e('0x35')]('nolimit')){_0x1e7607[_0xe88e('0x1e')]=qs[_0xe88e('0x1e')](_0x3b8f27['query'][_0xe88e('0x1e')]);_0x1e7607['offset']=qs['offset'](_0x3b8f27[_0xe88e('0x2e')]['offset']);}_0x1e7607[_0xe88e('0x36')]=qs['sort'](_0x3b8f27['query'][_0xe88e('0x37')]);_0x1e7607[_0xe88e('0x38')]=qs[_0xe88e('0x30')](_['pick'](_0x3b8f27[_0xe88e('0x2e')],_0x26f55f[_0xe88e('0x30')]),_0x53bfcf);if(_0x3b8f27['query'][_0xe88e('0x39')]){_0x1e7607[_0xe88e('0x38')]=_[_0xe88e('0x3a')](_0x1e7607['where'],{'$or':_[_0xe88e('0x2b')](_0x53bfcf,function(_0x1937f2){if(_0x1937f2['type']!=='VIRTUAL'){var _0xe6fb41={};_0xe6fb41[_0x1937f2[_0xe88e('0x28')]]={'$like':'%'+_0x3b8f27[_0xe88e('0x2e')]['filter']+'%'};return _0xe6fb41;}})});}_0x1e7607=_['merge']({},_0x1e7607,_0x3b8f27[_0xe88e('0x3b')]);var _0x54ce09={'where':_0x1e7607[_0xe88e('0x38')]};return db[_0xe88e('0x2c')][_0xe88e('0x1f')](_0x54ce09)['then'](function(_0x47f9c3){_0x17ff77[_0xe88e('0x1f')]=_0x47f9c3;if(_0x3b8f27[_0xe88e('0x2e')][_0xe88e('0x3c')]){_0x1e7607['include']=[{'all':!![]}];}return db[_0xe88e('0x2c')][_0xe88e('0x3d')](_0x1e7607);})[_0xe88e('0x24')](function(_0x38cf1f){_0x17ff77[_0xe88e('0x3e')]=_0x38cf1f;return _0x17ff77;})[_0xe88e('0x24')](respondWithFilteredResult(_0x4dc32e,_0x1e7607))['catch'](handleError(_0x4dc32e,null));};exports[_0xe88e('0x3f')]=function(_0x3e75d5,_0x2a0bea){var _0x4d3673={'raw':!![],'where':{'id':_0x3e75d5[_0xe88e('0x40')]['id']}},_0x4bf3c4={};_0x4bf3c4[_0xe88e('0x32')]=_[_0xe88e('0x2f')](db[_0xe88e('0x2c')]['rawAttributes']);_0x4bf3c4[_0xe88e('0x2e')]=_[_0xe88e('0x2f')](_0x3e75d5[_0xe88e('0x2e')]);_0x4bf3c4['filters']=_['intersection'](_0x4bf3c4[_0xe88e('0x32')],_0x4bf3c4[_0xe88e('0x2e')]);_0x4d3673[_0xe88e('0x33')]=_[_0xe88e('0x31')](_0x4bf3c4['model'],qs[_0xe88e('0x34')](_0x3e75d5[_0xe88e('0x2e')][_0xe88e('0x34')]));_0x4d3673[_0xe88e('0x33')]=_0x4d3673[_0xe88e('0x33')][_0xe88e('0x41')]?_0x4d3673['attributes']:_0x4bf3c4[_0xe88e('0x32')];if(_0x3e75d5['query'][_0xe88e('0x3c')]){_0x4d3673[_0xe88e('0x42')]=[{'all':!![]}];}_0x4d3673=_[_0xe88e('0x3a')]({},_0x4d3673,_0x3e75d5[_0xe88e('0x3b')]);return db['VoiceQueuesLog']['find'](_0x4d3673)[_0xe88e('0x24')](handleEntityNotFound(_0x2a0bea,null))[_0xe88e('0x24')](respondWithResult(_0x2a0bea,null))[_0xe88e('0x43')](handleError(_0x2a0bea,null));};exports[_0xe88e('0x44')]=function(_0x29cccb,_0x427343){return db[_0xe88e('0x2c')][_0xe88e('0x44')](_0x29cccb[_0xe88e('0x45')],{})[_0xe88e('0x24')](respondWithResult(_0x427343,0xc9))['catch'](handleError(_0x427343,null));};exports[_0xe88e('0x23')]=function(_0x4a6354,_0x239017){if(_0x4a6354[_0xe88e('0x45')]['id']){delete _0x4a6354['body']['id'];}return db[_0xe88e('0x2c')][_0xe88e('0x46')]({'where':{'id':_0x4a6354[_0xe88e('0x40')]['id']}})[_0xe88e('0x24')](handleEntityNotFound(_0x239017,null))[_0xe88e('0x24')](saveUpdates(_0x4a6354['body'],null))[_0xe88e('0x24')](respondWithResult(_0x239017,null))[_0xe88e('0x43')](handleError(_0x239017,null));};exports[_0xe88e('0x25')]=function(_0x2c4b94,_0x4dc7c3){return db[_0xe88e('0x2c')][_0xe88e('0x46')]({'where':{'id':_0x2c4b94['params']['id']}})[_0xe88e('0x24')](handleEntityNotFound(_0x4dc7c3,null))[_0xe88e('0x24')](removeEntity(_0x4dc7c3,null))[_0xe88e('0x43')](handleError(_0x4dc7c3,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index d9eae81..822c3d4 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 _0xa750=['exports','VoiceQueuesLog','voice_queues_log','event_dtm','dtm','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa750,0xaa));var _0x0a75=function(_0x5e28ae,_0x162b93){_0x5e28ae=_0x5e28ae-0x0;var _0x36fb02=_0xa750[_0x5e28ae];return _0x36fb02;};'use strict';var _=require(_0x0a75('0x0'));var util=require(_0x0a75('0x1'));var logger=require(_0x0a75('0x2'))('api');var moment=require(_0x0a75('0x3'));var BPromise=require(_0x0a75('0x4'));var rp=require(_0x0a75('0x5'));var fs=require('fs');var path=require(_0x0a75('0x6'));var rimraf=require(_0x0a75('0x7'));var config=require(_0x0a75('0x8'));var attributes=require(_0x0a75('0x9'));module[_0x0a75('0xa')]=function(_0x22936f,_0x5e1545){return _0x22936f['define'](_0x0a75('0xb'),attributes,{'tableName':_0x0a75('0xc'),'paranoid':![],'indexes':[{'name':_0x0a75('0xd'),'fields':['event',_0x0a75('0xe')]}],'timestamps':![]});}; \ No newline at end of file +var _0x121d=['request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','VoiceQueuesLog','event_dtm','dtm','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4ee89a,_0x56d642){var _0x42aca9=function(_0xa1f425){while(--_0xa1f425){_0x4ee89a['push'](_0x4ee89a['shift']());}};_0x42aca9(++_0x56d642);}(_0x121d,0xea));var _0xd121=function(_0x413fd4,_0x4da888){_0x413fd4=_0x413fd4-0x0;var _0x23c70b=_0x121d[_0x413fd4];return _0x23c70b;};'use strict';var _=require(_0xd121('0x0'));var util=require(_0xd121('0x1'));var logger=require(_0xd121('0x2'))(_0xd121('0x3'));var moment=require(_0xd121('0x4'));var BPromise=require(_0xd121('0x5'));var rp=require(_0xd121('0x6'));var fs=require('fs');var path=require(_0xd121('0x7'));var rimraf=require(_0xd121('0x8'));var config=require(_0xd121('0x9'));var attributes=require(_0xd121('0xa'));module[_0xd121('0xb')]=function(_0x2b2f41,_0x31c727){return _0x2b2f41['define'](_0xd121('0xc'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0xd121('0xd'),'fields':['event',_0xd121('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 cc5bbce..39801ff 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 _0xfa20=['info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then'];(function(_0x4257cb,_0x429557){var _0x43af2a=function(_0x78dd98){while(--_0x78dd98){_0x4257cb['push'](_0x4257cb['shift']());}};_0x43af2a(++_0x429557);}(_0xfa20,0x141));var _0x0fa2=function(_0x5bdb83,_0x3605de){_0x5bdb83=_0x5bdb83-0x0;var _0x1986bb=_0xfa20[_0x5bdb83];return _0x1986bb;};'use strict';var _=require(_0x0fa2('0x0'));var util=require(_0x0fa2('0x1'));var moment=require(_0x0fa2('0x2'));var BPromise=require(_0x0fa2('0x3'));var rs=require(_0x0fa2('0x4'));var fs=require('fs');var Redis=require(_0x0fa2('0x5'));var db=require(_0x0fa2('0x6'))['db'];var utils=require(_0x0fa2('0x7'));var logger=require(_0x0fa2('0x8'))(_0x0fa2('0x9'));var config=require(_0x0fa2('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x0fa2('0xb')][_0x0fa2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x59b8ad,_0xf03dd3,_0x3fde44){return new BPromise(function(_0x1f3223,_0x11979c){return client[_0x0fa2('0xd')](_0x59b8ad,_0x3fde44)[_0x0fa2('0xe')](function(_0x3ec7f3){logger[_0x0fa2('0xf')](_0x0fa2('0x10'),_0xf03dd3,_0x0fa2('0x11'));logger['debug'](_0x0fa2('0x12'),_0xf03dd3,_0x0fa2('0x11'),JSON[_0x0fa2('0x13')](_0x3ec7f3));if(_0x3ec7f3[_0x0fa2('0x14')]){if(_0x3ec7f3[_0x0fa2('0x14')][_0x0fa2('0x15')]===0x1f4){logger[_0x0fa2('0x14')](_0x0fa2('0x10'),_0xf03dd3,_0x3ec7f3['error'][_0x0fa2('0x16')]);return _0x11979c(_0x3ec7f3['error'][_0x0fa2('0x16')]);}logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0xf03dd3,_0x3ec7f3['error'][_0x0fa2('0x16')]);return _0x1f3223(_0x3ec7f3[_0x0fa2('0x14')][_0x0fa2('0x16')]);}else{logger[_0x0fa2('0xf')](_0x0fa2('0x10'),_0xf03dd3,_0x0fa2('0x11'));_0x1f3223(_0x3ec7f3[_0x0fa2('0x17')][_0x0fa2('0x16')]);}})['catch'](function(_0x3cf25f){logger[_0x0fa2('0x14')](_0x0fa2('0x10'),_0xf03dd3,_0x3cf25f);_0x11979c(_0x3cf25f);});});} \ No newline at end of file +var _0xa25c=['message','VoiceQueuesLog,\x20%s,\x20%s','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','info','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x29a55b,_0x5f84c){var _0x52a4d0=function(_0x4d6bd5){while(--_0x4d6bd5){_0x29a55b['push'](_0x29a55b['shift']());}};_0x52a4d0(++_0x5f84c);}(_0xa25c,0x13f));var _0xca25=function(_0x336280,_0x10a45c){_0x336280=_0x336280-0x0;var _0x2a1b5b=_0xa25c[_0x336280];return _0x2a1b5b;};'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});function respondWithRpcPromise(_0x4e9352,_0xb2fc94,_0x3cee89){return new BPromise(function(_0x2c0b8c,_0x42a97a){return client[_0xca25('0xa')](_0x4e9352,_0x3cee89)['then'](function(_0x5d820c){logger[_0xca25('0xb')]('VoiceQueuesLog,\x20%s,\x20%s',_0xb2fc94,_0xca25('0xc'));logger[_0xca25('0xd')](_0xca25('0xe'),_0xb2fc94,'request\x20sent',JSON['stringify'](_0x5d820c));if(_0x5d820c['error']){if(_0x5d820c[_0xca25('0xf')][_0xca25('0x10')]===0x1f4){logger[_0xca25('0xf')]('VoiceQueuesLog,\x20%s,\x20%s',_0xb2fc94,_0x5d820c['error'][_0xca25('0x11')]);return _0x42a97a(_0x5d820c['error'][_0xca25('0x11')]);}logger[_0xca25('0xf')](_0xca25('0x12'),_0xb2fc94,_0x5d820c[_0xca25('0xf')][_0xca25('0x11')]);return _0x2c0b8c(_0x5d820c[_0xca25('0xf')][_0xca25('0x11')]);}else{logger[_0xca25('0xb')](_0xca25('0x12'),_0xb2fc94,_0xca25('0xc'));_0x2c0b8c(_0x5d820c[_0xca25('0x13')]['message']);}})[_0xca25('0x14')](function(_0x340c9b){logger['error'](_0xca25('0x12'),_0xb2fc94,_0x340c9b);_0x42a97a(_0x340c9b);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index dbcf5c7..8f18ca9 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 _0x6a36=['show','/:id/download','download','/:id/downloads','downloadTranscribe','post','runTranscribe','put','delete','destroy','exports','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceRecording.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x6a36,0xb3));var _0x66a3=function(_0x52e995,_0x842254){_0x52e995=_0x52e995-0x0;var _0x596203=_0x6a36[_0x52e995];return _0x596203;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x66a3('0x0'));var express=require(_0x66a3('0x1'));var router=express[_0x66a3('0x2')]();var fs_extra=require(_0x66a3('0x3'));var auth=require(_0x66a3('0x4'));var interaction=require(_0x66a3('0x5'));var config=require('../../config/environment');var controller=require(_0x66a3('0x6'));router[_0x66a3('0x7')]('/',auth[_0x66a3('0x8')](),controller[_0x66a3('0x9')]);router[_0x66a3('0x7')](_0x66a3('0xa'),auth[_0x66a3('0x8')](),controller[_0x66a3('0xb')]);router[_0x66a3('0x7')](_0x66a3('0xc'),auth[_0x66a3('0x8')](),controller[_0x66a3('0xd')]);router[_0x66a3('0x7')](_0x66a3('0xe'),auth[_0x66a3('0x8')](),controller[_0x66a3('0xf')]);router[_0x66a3('0x7')](_0x66a3('0x10'),controller['downloads']);router[_0x66a3('0x7')]('/:id/transcribe',auth[_0x66a3('0x8')](),controller[_0x66a3('0x11')]);router[_0x66a3('0x12')]('/',auth[_0x66a3('0x8')](),controller['create']);router[_0x66a3('0x12')]('/:id/transcribe',auth['isAuthenticated'](),controller[_0x66a3('0x13')]);router[_0x66a3('0x14')](_0x66a3('0xc'),auth[_0x66a3('0x8')](),controller['update']);router[_0x66a3('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x66a3('0x16')]);module[_0x66a3('0x17')]=router; \ No newline at end of file +var _0x203b=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceRecording.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/downloads','/:id/transcribe','downloadTranscribe','post','create','runTranscribe','put','update','delete','exports','multer','util','path'];(function(_0x55c485,_0x3fe77e){var _0x6bb521=function(_0x466a3d){while(--_0x466a3d){_0x55c485['push'](_0x55c485['shift']());}};_0x6bb521(++_0x3fe77e);}(_0x203b,0xcd));var _0xb203=function(_0x4800ad,_0x1337e1){_0x4800ad=_0x4800ad-0x0;var _0x14c2b2=_0x203b[_0x4800ad];return _0x14c2b2;};'use strict';var multer=require(_0xb203('0x0'));var util=require(_0xb203('0x1'));var path=require(_0xb203('0x2'));var timeout=require('connect-timeout');var express=require(_0xb203('0x3'));var router=express[_0xb203('0x4')]();var fs_extra=require(_0xb203('0x5'));var auth=require(_0xb203('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb203('0x7'));var controller=require(_0xb203('0x8'));router['get']('/',auth[_0xb203('0x9')](),controller[_0xb203('0xa')]);router[_0xb203('0xb')](_0xb203('0xc'),auth[_0xb203('0x9')](),controller[_0xb203('0xd')]);router[_0xb203('0xb')](_0xb203('0xe'),auth[_0xb203('0x9')](),controller[_0xb203('0xf')]);router[_0xb203('0xb')]('/:id/download',auth[_0xb203('0x9')](),controller['download']);router['get'](_0xb203('0x10'),controller['downloads']);router[_0xb203('0xb')](_0xb203('0x11'),auth[_0xb203('0x9')](),controller[_0xb203('0x12')]);router[_0xb203('0x13')]('/',auth[_0xb203('0x9')](),controller[_0xb203('0x14')]);router[_0xb203('0x13')](_0xb203('0x11'),auth[_0xb203('0x9')](),controller[_0xb203('0x15')]);router[_0xb203('0x16')](_0xb203('0xe'),auth[_0xb203('0x9')](),controller[_0xb203('0x17')]);router[_0xb203('0x18')](_0xb203('0xe'),auth[_0xb203('0x9')](),controller['destroy']);module[_0xb203('0x19')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 0726bc9..bd5a99a 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(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'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(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'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 8206404..1fc966c 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 _0x7605=['merge','VIRTUAL','options','VoiceRecording','includeAll','include','findAll','rows','show','params','keys','catch','create','body','update','find','describe','download','uniqueid','value','%s.cypher','secrets','recording','existsSync','Sequelize','VoiceRecording\x20not\x20found','filename','extname','unlink','message','../../components/encryptor','sequelize','MD5','push','$and','info','isNil','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','listBuckets','upload','TranscribeService','startTranscriptionJob','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','ValidationError','Setting','transcribe','transcribeAccountId','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','transcribeRegion','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','reject','then','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','differenceBy','format','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','pick','filter','where'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7605,0x185));var _0x5760=function(_0x29a3a8,_0x2cf79a){_0x29a3a8=_0x29a3a8-0x0;var _0x35410c=_0x7605[_0x29a3a8];return _0x35410c;};'use strict';var emlformat=require(_0x5760('0x0'));var rimraf=require(_0x5760('0x1'));var zipdir=require(_0x5760('0x2'));var jsonpatch=require(_0x5760('0x3'));var rp=require(_0x5760('0x4'));var moment=require(_0x5760('0x5'));var BPromise=require(_0x5760('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5760('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5760('0x8'));var fs=require('fs');var fs_extra=require(_0x5760('0x9'));var _=require(_0x5760('0xa'));var squel=require(_0x5760('0xb'));var crypto=require(_0x5760('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x5760('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x5760('0xe'));var AWS=require(_0x5760('0xf'));var uuidv4=require(_0x5760('0x10'));var Redis=require(_0x5760('0x11'));var authService=require(_0x5760('0x12'));var qs=require(_0x5760('0x13'));var as=require(_0x5760('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5760('0x15'));var utils=require(_0x5760('0x16'));var config=require(_0x5760('0x17'));var licenseUtil=require(_0x5760('0x18'));var db=require(_0x5760('0x19'))['db'];function respondWithStatusCode(_0x2087a9,_0x49bed7){_0x49bed7=_0x49bed7||0xcc;return function(_0x42d4e2){if(_0x42d4e2){return _0x2087a9['sendStatus'](_0x49bed7);}return _0x2087a9[_0x5760('0x1a')](_0x49bed7)['end']();};}function respondWithResult(_0x26857f,_0x498902){_0x498902=_0x498902||0xc8;return function(_0x55fd3c){if(_0x55fd3c){return _0x26857f[_0x5760('0x1a')](_0x498902)[_0x5760('0x1b')](_0x55fd3c);}};}function respondWithFilteredResult(_0x33c445,_0x2b4838){return function(_0x2f8793){if(_0x2f8793){var _0x4c1e66=typeof _0x2b4838[_0x5760('0x1c')]===_0x5760('0x1d')&&typeof _0x2b4838[_0x5760('0x1e')]===_0x5760('0x1d');var _0x57b724=_0x2f8793[_0x5760('0x1f')];var _0x1f9745=_0x4c1e66?0x0:_0x2b4838[_0x5760('0x1c')];var _0x168f2a=_0x4c1e66?_0x2f8793[_0x5760('0x1f')]:_0x2b4838[_0x5760('0x1c')]+_0x2b4838[_0x5760('0x1e')];var _0x141ebc;if(_0x168f2a>=_0x57b724){_0x168f2a=_0x57b724;_0x141ebc=0xc8;}else{_0x141ebc=0xce;}_0x33c445[_0x5760('0x1a')](_0x141ebc);return _0x33c445[_0x5760('0x20')](_0x5760('0x21'),_0x1f9745+'-'+_0x168f2a+'/'+_0x57b724)['json'](_0x2f8793);}return null;};}function patchUpdates(_0x62366f){return function(_0x28ac25){try{jsonpatch['apply'](_0x28ac25,_0x62366f,!![]);}catch(_0x484e38){return BPromise[_0x5760('0x22')](_0x484e38);}return _0x28ac25['save']();};}function saveUpdates(_0x4e2367,_0x5ad304){return function(_0x23d58c){if(_0x23d58c){return _0x23d58c['update'](_0x4e2367)[_0x5760('0x23')](function(_0xc13be){return _0xc13be;});}return null;};}function removeEntity(_0x3f37aa,_0x3be85a){return function(_0x462e95){if(_0x462e95){return _0x462e95[_0x5760('0x24')]()['then'](function(){_0x3f37aa[_0x5760('0x1a')](0xcc)[_0x5760('0x25')]();});}};}function handleEntityNotFound(_0x3a9c8c,_0x53b5d9){return function(_0xeef10c){if(!_0xeef10c){_0x3a9c8c['sendStatus'](0x194);}return _0xeef10c;};}function handleError(_0x4a68e1,_0x3229fb){_0x3229fb=_0x3229fb||0x1f4;return function(_0x2ef888){logger['error'](_0x2ef888[_0x5760('0x26')]);if(_0x2ef888[_0x5760('0x27')]){delete _0x2ef888[_0x5760('0x27')];}_0x4a68e1[_0x5760('0x1a')](_0x3229fb)[_0x5760('0x28')](_0x2ef888);};}exports[_0x5760('0x29')]=function(_0x2efd34,_0x268f26){var _0x27d2ff={},_0x2533e7={},_0x5c5c5e={'count':0x0,'rows':[]};var _0x56d97f=_[_0x5760('0x2a')](db['VoiceRecording'][_0x5760('0x2b')],function(_0x1d62a8){return{'name':_0x1d62a8[_0x5760('0x2c')],'type':_0x1d62a8[_0x5760('0x2d')][_0x5760('0x2e')]};});_0x2533e7[_0x5760('0x2f')]=_[_0x5760('0x30')](_[_0x5760('0x2a')](_0x56d97f,_0x5760('0x27')),[_0x5760('0x31')]);_0x2533e7[_0x5760('0x32')]=_['keys'](_0x2efd34[_0x5760('0x32')]);_0x2533e7[_0x5760('0x33')]=_['intersection'](_0x2533e7[_0x5760('0x2f')],_0x2533e7['query']);_0x27d2ff[_0x5760('0x34')]=_[_0x5760('0x35')](_0x2533e7[_0x5760('0x2f')],qs[_0x5760('0x36')](_0x2efd34[_0x5760('0x32')][_0x5760('0x36')]));_0x27d2ff[_0x5760('0x34')]=_0x27d2ff[_0x5760('0x34')][_0x5760('0x37')]?_0x27d2ff[_0x5760('0x34')]:_0x2533e7[_0x5760('0x2f')];if(!_0x2efd34[_0x5760('0x32')][_0x5760('0x38')](_0x5760('0x39'))){_0x27d2ff[_0x5760('0x1e')]=qs[_0x5760('0x1e')](_0x2efd34[_0x5760('0x32')][_0x5760('0x1e')]);_0x27d2ff[_0x5760('0x1c')]=qs[_0x5760('0x1c')](_0x2efd34['query'][_0x5760('0x1c')]);}_0x27d2ff['order']=qs['sort'](_0x2efd34['query']['sort']);_0x27d2ff['where']=qs[_0x5760('0x33')](_[_0x5760('0x3a')](_0x2efd34[_0x5760('0x32')],_0x2533e7[_0x5760('0x33')]),_0x56d97f);if(_0x2efd34[_0x5760('0x32')][_0x5760('0x3b')]){_0x27d2ff[_0x5760('0x3c')]=_[_0x5760('0x3d')](_0x27d2ff[_0x5760('0x3c')],{'$or':_[_0x5760('0x2a')](_0x56d97f,function(_0x203955){if(_0x203955[_0x5760('0x2d')]!==_0x5760('0x3e')){var _0x3537bb={};_0x3537bb[_0x203955['name']]={'$like':'%'+_0x2efd34['query'][_0x5760('0x3b')]+'%'};return _0x3537bb;}})});}_0x27d2ff=_[_0x5760('0x3d')]({},_0x27d2ff,_0x2efd34[_0x5760('0x3f')]);var _0xd047af={'where':_0x27d2ff['where']};return db[_0x5760('0x40')][_0x5760('0x1f')](_0xd047af)[_0x5760('0x23')](function(_0x263014){_0x5c5c5e['count']=_0x263014;if(_0x2efd34['query'][_0x5760('0x41')]){_0x27d2ff[_0x5760('0x42')]=[{'all':!![]}];}return db['VoiceRecording'][_0x5760('0x43')](_0x27d2ff);})[_0x5760('0x23')](function(_0x3c4b28){_0x5c5c5e[_0x5760('0x44')]=_0x3c4b28;return _0x5c5c5e;})[_0x5760('0x23')](respondWithFilteredResult(_0x268f26,_0x27d2ff))['catch'](handleError(_0x268f26,null));};exports[_0x5760('0x45')]=function(_0x1ecabd,_0x32c584){var _0x15df76={'raw':![],'where':{'id':_0x1ecabd[_0x5760('0x46')]['id']}},_0x72b20d={};_0x72b20d[_0x5760('0x2f')]=_[_0x5760('0x47')](db[_0x5760('0x40')][_0x5760('0x2b')]);_0x72b20d['query']=_[_0x5760('0x47')](_0x1ecabd[_0x5760('0x32')]);_0x72b20d['filters']=_['intersection'](_0x72b20d['model'],_0x72b20d[_0x5760('0x32')]);_0x15df76[_0x5760('0x34')]=_['intersection'](_0x72b20d[_0x5760('0x2f')],qs[_0x5760('0x36')](_0x1ecabd[_0x5760('0x32')][_0x5760('0x36')]));_0x15df76['attributes']=_0x15df76[_0x5760('0x34')][_0x5760('0x37')]?_0x15df76[_0x5760('0x34')]:_0x72b20d[_0x5760('0x2f')];if(_0x1ecabd[_0x5760('0x32')][_0x5760('0x41')]){_0x15df76[_0x5760('0x42')]=[{'all':!![]}];}_0x15df76=_[_0x5760('0x3d')]({},_0x15df76,_0x1ecabd[_0x5760('0x3f')]);return db[_0x5760('0x40')]['find'](_0x15df76)['then'](handleEntityNotFound(_0x32c584,null))[_0x5760('0x23')](respondWithResult(_0x32c584,null))[_0x5760('0x48')](handleError(_0x32c584,null));};exports[_0x5760('0x49')]=function(_0x11ac76,_0x168ea9){return db[_0x5760('0x40')][_0x5760('0x49')](_0x11ac76[_0x5760('0x4a')],{})[_0x5760('0x23')](respondWithResult(_0x168ea9,0xc9))['catch'](handleError(_0x168ea9,null));};exports[_0x5760('0x4b')]=function(_0x4ef0cf,_0x3effca){if(_0x4ef0cf[_0x5760('0x4a')]['id']){delete _0x4ef0cf[_0x5760('0x4a')]['id'];}return db[_0x5760('0x40')][_0x5760('0x4c')]({'where':{'id':_0x4ef0cf['params']['id']}})[_0x5760('0x23')](handleEntityNotFound(_0x3effca,null))[_0x5760('0x23')](saveUpdates(_0x4ef0cf[_0x5760('0x4a')],null))[_0x5760('0x23')](respondWithResult(_0x3effca,null))[_0x5760('0x48')](handleError(_0x3effca,null));};exports[_0x5760('0x4d')]=function(_0x987ba1,_0xe2e1e2){return db['VoiceRecording'][_0x5760('0x4d')]()['then'](respondWithResult(_0xe2e1e2,null))['catch'](handleError(_0xe2e1e2,null));};exports[_0x5760('0x4e')]=function(_0x106f38,_0x430adf,_0x4255ab){var _0x2df708=require('../../components/encryptor');var _0x2e3b8d=![];var _0x2ebc5a={};if(_0x106f38[_0x5760('0x32')][_0x5760('0x2d')]&&_0x106f38['query'][_0x5760('0x2d')]===_0x5760('0x4f')){_0x2ebc5a[_0x5760('0x4f')]=_0x106f38['params']['id'];}else{_0x2ebc5a['id']=_0x106f38[_0x5760('0x46')]['id'];}return db[_0x5760('0x40')][_0x5760('0x4c')]({'where':_0x2ebc5a,'attributes':['id',_0x5760('0x50')],'raw':!![]})['then'](handleEntityNotFound(_0x430adf,null))['then'](function(_0x56bba9){if(_0x56bba9){var _0x3b279a=_0x56bba9[_0x5760('0x50')];var _0x2d4112=util[_0x5760('0x31')](_0x5760('0x51'),_0x3b279a);if(fs['existsSync'](_0x2d4112)){_0x2e3b8d=!![];return _0x2df708['decryptFile'](_0x2d4112,_0x3b279a,config[_0x5760('0x52')][_0x5760('0x53')])[_0x5760('0x23')](function(){return _0x56bba9;});}return _0x56bba9;}})['then'](function(_0x3e2d78){if(_0x3e2d78){var _0x777fae=_0x3e2d78[_0x5760('0x50')];if(!fs[_0x5760('0x54')](_0x777fae)){throw new db[(_0x5760('0x55'))]['ValidationError'](_0x5760('0x56'));}if(_0x3e2d78[_0x5760('0x57')]){return _0x430adf['download'](_0x777fae,_0x3e2d78[_0x5760('0x57')]+path[_0x5760('0x58')](_0x777fae),function(){if(_0x2e3b8d){fs[_0x5760('0x59')](_0x777fae);}});}else{return _0x430adf[_0x5760('0x4e')](_0x777fae,function(_0x2c2e97){if(_0x2e3b8d){fs[_0x5760('0x59')](_0x777fae);}});}}})['catch'](function(_0x44712f){if(_0x44712f[_0x5760('0x5a')]===_0x5760('0x56')){_0x430adf[_0x5760('0x1a')](0x194)['send']('Not\x20found');}else{return handleError(_0x430adf,null);}});};exports['downloads']=function(_0x3673c5,_0x280176,_0x38e0d6){var _0x2a5f0f=require(_0x5760('0x5b'));var _0x54127e=![];var _0x2bb43f={'$and':[db[_0x5760('0x5c')][_0x5760('0x3c')](db['sequelize']['fn'](_0x5760('0x5d'),db[_0x5760('0x5c')]['col'](_0x5760('0x4f'))),_0x3673c5[_0x5760('0x32')]['token'])]};if(_0x3673c5['query'][_0x5760('0x2d')]&&_0x3673c5[_0x5760('0x32')][_0x5760('0x2d')]==='uniqueid'){_0x2bb43f['$and'][_0x5760('0x5e')]({'uniqueid':_0x3673c5['params']['id']});}else{_0x2bb43f[_0x5760('0x5f')][_0x5760('0x5e')]({'id':_0x3673c5[_0x5760('0x46')]['id']});}return db['VoiceRecording'][_0x5760('0x4c')]({'where':_0x2bb43f,'attributes':['id',_0x5760('0x50')],'raw':!![]})[_0x5760('0x23')](handleEntityNotFound(_0x280176,null))[_0x5760('0x23')](function(_0x45b162){if(_0x45b162){var _0x2fde1b=util[_0x5760('0x31')](_0x5760('0x51'),_0x45b162[_0x5760('0x50')]);if(fs['existsSync'](_0x2fde1b)){_0x54127e=!![];return _0x2a5f0f['decryptFile'](_0x2fde1b,_0x45b162[_0x5760('0x50')],config[_0x5760('0x52')][_0x5760('0x53')])[_0x5760('0x23')](function(){return _0x45b162;});}return _0x45b162;}})[_0x5760('0x23')](function(_0x5ef80c){if(_0x5ef80c){if(!fs[_0x5760('0x54')](_0x5ef80c['value'])){throw new db[(_0x5760('0x55'))]['ValidationError'](_0x5760('0x56'));}if(_0x5ef80c['filename']){return _0x280176[_0x5760('0x4e')](_0x5ef80c[_0x5760('0x50')],_0x5ef80c[_0x5760('0x57')]+path['extname'](_0x5ef80c[_0x5760('0x50')]),function(){if(_0x54127e){fs[_0x5760('0x59')](_0x5ef80c[_0x5760('0x50')]);}});}else{return _0x280176[_0x5760('0x4e')](_0x5ef80c['value'],function(_0x5d9229){if(_0x54127e){fs[_0x5760('0x59')](_0x5ef80c[_0x5760('0x50')]);}});}}})['catch'](handleError(_0x280176,null));};exports[_0x5760('0x24')]=function(_0x28a9fb,_0x355484){return db['VoiceRecording'][_0x5760('0x4c')]({'where':{'id':_0x28a9fb[_0x5760('0x46')]['id']}})[_0x5760('0x23')](function(_0x4b51cd){if(_['isNil'](_0x4b51cd)){throw new ReferenceError('Entity\x20not\x20found');}return _0x4b51cd;})['then'](function(_0x501718){var _0x2b8a2f=_0x501718[_0x5760('0x50')];logger[_0x5760('0x60')]('cancellazione\x20fisica\x20documento\x20%s',_0x2b8a2f);if(!_[_0x5760('0x61')](_0x501718[_0x5760('0x50')])&&fs[_0x5760('0x54')](_0x2b8a2f)){logger['info'](_0x5760('0x62')+_0x2b8a2f+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x5760('0x63')](_0x2b8a2f);}_0x2b8a2f=_0x2b8a2f+_0x5760('0x64');if(!_[_0x5760('0x61')](_0x501718[_0x5760('0x50')])&&fs['existsSync'](_0x2b8a2f)){logger[_0x5760('0x60')]('File:\x20\x22'+_0x2b8a2f+_0x5760('0x65'));fs['unlinkSync'](_0x2b8a2f);}return _0x501718;})['then'](function(_0x165749){if(!_0x165749)throw new InternalError();return _0x165749['destroy']();})[_0x5760('0x23')](function(){_0x355484[_0x5760('0x1a')](0xcc)[_0x5760('0x25')]();})[_0x5760('0x48')](handleError(_0x355484,null));};function getBucketslist(_0x646f08,_0x43de31,_0x545cf8){return new Promise(function(_0x3c761f,_0x173499){var _0x5a190e=new AWS['S3']({'accessKeyId':_0x43de31,'secretAccessKey':_0x646f08,'region':_0x545cf8});_0x5a190e[_0x5760('0x66')]({},function(_0x49aa14,_0x2d4432){if(_0x49aa14){return _0x173499(_0x49aa14);}else{return _0x3c761f(_0x2d4432);}});});}function createBucket(_0x3af805,_0x1aa047,_0xa5ef45,_0x2c0481){return new Promise(function(_0x578744,_0x4c79ef){var _0x5e5d1f=new AWS['S3']({'accessKeyId':_0x1aa047,'secretAccessKey':_0x3af805,'region':_0xa5ef45});_0x5e5d1f['createBucket']({'Bucket':_0x2c0481},function(_0x52051b,_0x59a732){if(_0x52051b){return _0x4c79ef(_0x52051b);}else{return _0x578744(_0x59a732);}});});}function uploadFile(_0x2473e6,_0x3b074d,_0x2c5de0,_0x43621d,_0x16f21e,_0x526dd7){return new Promise(function(_0x23f003,_0x1e61fc){var _0xeaa9d5=new AWS['S3']({'accessKeyId':_0x3b074d,'secretAccessKey':_0x2473e6,'region':_0x2c5de0});_0xeaa9d5[_0x5760('0x67')]({'Bucket':_0x43621d,'Key':_0x16f21e,'Body':_0x526dd7},function(_0x5dac88,_0x5e8271){if(_0x5dac88){return _0x1e61fc(_0x5dac88);}else{return _0x23f003(_0x5e8271);}});});}function startTranscribe(_0x9f2f8e,_0x180ed7,_0xfd50d0,_0x4c8d34,_0x745036,_0x21073b){return new Promise(function(_0x3a8ed6,_0xaaf360){var _0x748fc0=new AWS[(_0x5760('0x68'))]({'accessKeyId':_0x180ed7,'secretAccessKey':_0x9f2f8e,'region':_0xfd50d0});_0x748fc0[_0x5760('0x69')]({'TranscriptionJobName':_0x4c8d34,'LanguageCode':_0x745036,'Media':{'MediaFileUri':_0x21073b}},function(_0x3362bf,_0x599bc1){if(_0x3362bf){return _0xaaf360(_0x3362bf);}else{return _0x3a8ed6(_0x599bc1);}});});}function transcribe(_0x5daf38,_0x5c1b0d,_0x1ac10e,_0x3b47d7,_0x30e6a1,_0x5fa45f,_0x5236b4){return new Promise(function(_0x26fffc,_0x32ae59){var _0x99a90e={};logger[_0x5760('0x60')](util[_0x5760('0x31')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x5daf38,_0x30e6a1));return uploadFile(_0x5c1b0d,_0x1ac10e,_0x3b47d7,_0x30e6a1,path[_0x5760('0x6a')](_0x5fa45f),fs[_0x5760('0x6b')](_0x5fa45f))['then'](function(_0x27c000){logger[_0x5760('0x60')](util[_0x5760('0x31')](_0x5760('0x6c'),_0x5daf38,_0x30e6a1,_0x27c000[_0x5760('0x6d')]));_0x99a90e[_0x5760('0x6e')]=_0x27c000[_0x5760('0x6f')];_0x99a90e[_0x5760('0x70')]=_0x27c000[_0x5760('0x6d')];logger[_0x5760('0x60')](util[_0x5760('0x31')](_0x5760('0x71'),_0x5daf38));return startTranscribe(_0x5c1b0d,_0x1ac10e,_0x3b47d7,uuidv4(),_0x5236b4,_0x27c000[_0x5760('0x6d')]);})['then'](function(_0x3911f7){logger[_0x5760('0x60')](util[_0x5760('0x31')](_0x5760('0x72'),_0x5daf38,_0x3911f7[_0x5760('0x73')][_0x5760('0x74')]));_0x99a90e[_0x5760('0x75')]=_0x3911f7[_0x5760('0x73')]['TranscriptionJobName'];_0x99a90e[_0x5760('0x76')]=_0x3911f7[_0x5760('0x73')][_0x5760('0x77')];return _0x26fffc(_0x99a90e);})['catch'](function(_0x19397a){return _0x32ae59(_0x19397a);});});}exports[_0x5760('0x78')]=function(_0x63bc24,_0x3dcdbd,_0x536d9f){var _0x3c7387;var _0x452e32;var _0x384f72;var _0x1c573f=require('../../components/encryptor');return db[_0x5760('0x40')][_0x5760('0x79')]({'where':{'id':_0x63bc24[_0x5760('0x46')]['id']}})[_0x5760('0x23')](function(_0x29e500){if(_0x29e500){var _0x1966f8=util[_0x5760('0x31')]('%s.cypher',_0x29e500[_0x5760('0x50')]);if(fs[_0x5760('0x54')](_0x1966f8)){cypher=!![];return _0x1c573f['decryptFile'](_0x1966f8,_0x29e500[_0x5760('0x50')],config[_0x5760('0x52')][_0x5760('0x53')])[_0x5760('0x23')](function(){return _0x29e500;});}return _0x29e500;}})['then'](function(_0x4840ab){if(!_0x4840ab){throw new db[(_0x5760('0x55'))][(_0x5760('0x7a'))]('Voice\x20Recording\x20not\x20found');}_0x452e32=_0x4840ab;return db[_0x5760('0x7b')][_0x5760('0x79')]({'where':{'id':0x1}});})[_0x5760('0x23')](handleEntityNotFound(_0x3dcdbd,null))['then'](function(_0x1d34ce){if(_0x1d34ce){_0x3c7387=_0x1d34ce;if(!_0x3c7387[_0x5760('0x7c')]||!_0x3c7387[_0x5760('0x7d')]||!_0x3c7387['transcribeRegion']||!_0x3c7387[_0x5760('0x7e')]||!_0x3c7387[_0x5760('0x6e')]){throw new db[(_0x5760('0x55'))][(_0x5760('0x7a'))](_0x5760('0x7f'));}if(_0x63bc24[_0x5760('0x4a')][_0x5760('0x80')]&&(!_0x3c7387[_0x5760('0x81')]||!_0x3c7387[_0x5760('0x82')]||!_0x3c7387[_0x5760('0x83')]||!_0x3c7387[_0x5760('0x7e')]||!_0x3c7387['bucket'])){throw new db[(_0x5760('0x55'))][(_0x5760('0x7a'))](_0x5760('0x84'));}return db[_0x5760('0x85')][_0x5760('0x79')]({'where':{'id':_0x3c7387['transcribeAccountId']}});}})[_0x5760('0x23')](function(_0x399588){if(!_0x399588){throw new db[(_0x5760('0x55'))][(_0x5760('0x7a'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x399588[_0x5760('0x86')]||!_0x399588[_0x5760('0x87')]){throw new db[(_0x5760('0x55'))]['ValidationError'](_0x5760('0x88'));}_0x384f72=_0x399588;return getBucketslist(_0x384f72['data1'],_0x384f72[_0x5760('0x87')],_0x3c7387['transcribeRegion']);})['then'](function(_0xdb78cc){if(_0xdb78cc&&_0xdb78cc[_0x5760('0x89')]){var _0x5b9689=_[_0x5760('0x4c')](_0xdb78cc['Buckets'],function(_0x1fb2ac){return _0x1fb2ac[_0x5760('0x8a')]===_0x3c7387['bucket'];});if(!_0x5b9689){logger[_0x5760('0x60')](util['format'](_0x5760('0x8b'),_0x63bc24[_0x5760('0x46')]['id'],_0x3c7387[_0x5760('0x6e')]));return createBucket(_0x384f72[_0x5760('0x86')],_0x384f72['data2'],_0x3c7387[_0x5760('0x8c')],_0x3c7387[_0x5760('0x6e')]);}logger[_0x5760('0x60')](util[_0x5760('0x31')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x63bc24[_0x5760('0x46')]['id'],_0x3c7387[_0x5760('0x6e')]));return;}})['then'](function(_0x483df8){if(_0x452e32[_0x5760('0x76')]==='NEW'){return transcribe(_0x63bc24[_0x5760('0x46')]['id'],_0x384f72[_0x5760('0x86')],_0x384f72['data2'],_0x3c7387['transcribeRegion'],_0x3c7387['bucket'],_0x452e32[_0x5760('0x50')],_0x3c7387[_0x5760('0x7e')]);}else{logger[_0x5760('0x60')](util[_0x5760('0x31')](_0x5760('0x8d'),_0x63bc24[_0x5760('0x46')]['id']));return{'transcribeStatus':_0x5760('0x8e')};}})['then'](function(_0xde723f){if(_0xde723f){_0xde723f[_0x5760('0x8f')]=_0x63bc24['body']['runSentiment'];return _0x452e32[_0x5760('0x90')](_0xde723f);}})[_0x5760('0x23')](respondWithResult(_0x3dcdbd,null))['catch'](handleError(_0x3dcdbd,null));};function writeFile(_0x142682,_0x4ac631){return new Promise(function(_0x51bb77,_0x48259d){fs['writeFile'](_0x4ac631,_0x142682,function(_0x2d2c89,_0x2f75ec){if(_0x2d2c89){return _0x48259d(_0x2d2c89);}else{return _0x51bb77(_0x2f75ec);}});});}exports['downloadTranscribe']=function(_0x258de6,_0xe9bf68,_0x36cd0e){return db[_0x5760('0x40')][_0x5760('0x79')]({'where':{'id':_0x258de6['params']['id']}})['then'](handleEntityNotFound(_0xe9bf68))[_0x5760('0x23')](function(_0x271b5c){if(_0x271b5c&&_0x271b5c['fileText']){var _0x5bb0c7=_0x271b5c[_0x5760('0x91')];var _0x347240=config[_0x5760('0x92')]+_0x5760('0x93')+_0x271b5c['id']+_0x5760('0x94');if(fs[_0x5760('0x54')](_0x347240)){return _0x347240;}return writeFile(_0x5bb0c7,_0x347240)['then'](function(){return _0x347240;});}else{throw new db[(_0x5760('0x55'))]['ValidationError'](_0x5760('0x95'));}})['then'](function(_0x322b11){return _0xe9bf68['download'](_0x322b11);})[_0x5760('0x48')](handleError(_0xe9bf68));}; \ No newline at end of file +var _0x12ee=['format','query','keys','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','intersection','find','create','body','update','describe','../../components/encryptor','uniqueid','value','%s.cypher','decryptFile','secrets','recording','existsSync','Sequelize','filename','download','extname','unlink','VoiceRecording\x20not\x20found','send','Not\x20found','downloads','sequelize','MD5','col','token','push','ValidationError','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','listBuckets','createBucket','upload','TranscribeService','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','TranscriptionJob','TranscriptionJobName','transcribeStatus','runTranscribe','findOne','Setting','transcribeAccountId','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','transcribeRegion','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','downloadTranscribe','fileText','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','aws-sdk','uuid/v4','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','set','save','then','destroy','end','error','stack','name','map','VoiceRecording','rawAttributes','fieldName','type','key','model','differenceBy'];(function(_0x2bbd2d,_0x37c3c4){var _0x257dc9=function(_0x1928ff){while(--_0x1928ff){_0x2bbd2d['push'](_0x2bbd2d['shift']());}};_0x257dc9(++_0x37c3c4);}(_0x12ee,0x192));var _0xe12e=function(_0x4f5479,_0x2f11e6){_0x4f5479=_0x4f5479-0x0;var _0x4eedf6=_0x12ee[_0x4f5479];return _0x4eedf6;};'use strict';var emlformat=require(_0xe12e('0x0'));var rimraf=require(_0xe12e('0x1'));var zipdir=require(_0xe12e('0x2'));var jsonpatch=require(_0xe12e('0x3'));var rp=require(_0xe12e('0x4'));var moment=require(_0xe12e('0x5'));var BPromise=require(_0xe12e('0x6'));var Mustache=require(_0xe12e('0x7'));var util=require(_0xe12e('0x8'));var path=require(_0xe12e('0x9'));var sox=require('sox');var csv=require(_0xe12e('0xa'));var ejs=require(_0xe12e('0xb'));var fs=require('fs');var fs_extra=require(_0xe12e('0xc'));var _=require(_0xe12e('0xd'));var squel=require('squel');var crypto=require(_0xe12e('0xe'));var jsforce=require(_0xe12e('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xe12e('0xa'));var querystring=require(_0xe12e('0x10'));var Papa=require(_0xe12e('0x11'));var AWS=require(_0xe12e('0x12'));var uuidv4=require(_0xe12e('0x13'));var Redis=require(_0xe12e('0x14'));var authService=require(_0xe12e('0x15'));var qs=require(_0xe12e('0x16'));var as=require(_0xe12e('0x17'));var hardwareService=require(_0xe12e('0x18'));var logger=require(_0xe12e('0x19'))(_0xe12e('0x1a'));var utils=require(_0xe12e('0x1b'));var config=require(_0xe12e('0x1c'));var licenseUtil=require(_0xe12e('0x1d'));var db=require(_0xe12e('0x1e'))['db'];function respondWithStatusCode(_0x4b2cb3,_0x226a69){_0x226a69=_0x226a69||0xcc;return function(_0x3bc911){if(_0x3bc911){return _0x4b2cb3[_0xe12e('0x1f')](_0x226a69);}return _0x4b2cb3['status'](_0x226a69)['end']();};}function respondWithResult(_0xb71980,_0x3812f9){_0x3812f9=_0x3812f9||0xc8;return function(_0x17d3dd){if(_0x17d3dd){return _0xb71980[_0xe12e('0x20')](_0x3812f9)[_0xe12e('0x21')](_0x17d3dd);}};}function respondWithFilteredResult(_0x41d27d,_0x13c7d1){return function(_0x455c1e){if(_0x455c1e){var _0x92db6f=typeof _0x13c7d1['offset']===_0xe12e('0x22')&&typeof _0x13c7d1[_0xe12e('0x23')]==='undefined';var _0x1bb462=_0x455c1e[_0xe12e('0x24')];var _0x3b88d1=_0x92db6f?0x0:_0x13c7d1[_0xe12e('0x25')];var _0x495ca9=_0x92db6f?_0x455c1e[_0xe12e('0x24')]:_0x13c7d1[_0xe12e('0x25')]+_0x13c7d1['limit'];var _0x473be4;if(_0x495ca9>=_0x1bb462){_0x495ca9=_0x1bb462;_0x473be4=0xc8;}else{_0x473be4=0xce;}_0x41d27d[_0xe12e('0x20')](_0x473be4);return _0x41d27d[_0xe12e('0x26')]('Content-Range',_0x3b88d1+'-'+_0x495ca9+'/'+_0x1bb462)[_0xe12e('0x21')](_0x455c1e);}return null;};}function patchUpdates(_0x92dce6){return function(_0x5cb9b1){try{jsonpatch['apply'](_0x5cb9b1,_0x92dce6,!![]);}catch(_0x15fd37){return BPromise['reject'](_0x15fd37);}return _0x5cb9b1[_0xe12e('0x27')]();};}function saveUpdates(_0xfe88ac,_0x50040d){return function(_0x4f5ead){if(_0x4f5ead){return _0x4f5ead['update'](_0xfe88ac)[_0xe12e('0x28')](function(_0x1ec532){return _0x1ec532;});}return null;};}function removeEntity(_0x28fcf9,_0x2c6b6c){return function(_0x50184e){if(_0x50184e){return _0x50184e[_0xe12e('0x29')]()[_0xe12e('0x28')](function(){_0x28fcf9['status'](0xcc)[_0xe12e('0x2a')]();});}};}function handleEntityNotFound(_0x2a75c8,_0x2d245d){return function(_0x532a51){if(!_0x532a51){_0x2a75c8['sendStatus'](0x194);}return _0x532a51;};}function handleError(_0x3dcaba,_0x84885b){_0x84885b=_0x84885b||0x1f4;return function(_0x121abb){logger[_0xe12e('0x2b')](_0x121abb[_0xe12e('0x2c')]);if(_0x121abb[_0xe12e('0x2d')]){delete _0x121abb['name'];}_0x3dcaba[_0xe12e('0x20')](_0x84885b)['send'](_0x121abb);};}exports['index']=function(_0x23cb99,_0x55f075){var _0x4f443c={},_0x251c8f={},_0x272ecf={'count':0x0,'rows':[]};var _0xc24c81=_[_0xe12e('0x2e')](db[_0xe12e('0x2f')][_0xe12e('0x30')],function(_0x2d35b0){return{'name':_0x2d35b0[_0xe12e('0x31')],'type':_0x2d35b0[_0xe12e('0x32')][_0xe12e('0x33')]};});_0x251c8f[_0xe12e('0x34')]=_[_0xe12e('0x35')](_[_0xe12e('0x2e')](_0xc24c81,_0xe12e('0x2d')),[_0xe12e('0x36')]);_0x251c8f[_0xe12e('0x37')]=_[_0xe12e('0x38')](_0x23cb99[_0xe12e('0x37')]);_0x251c8f['filters']=_['intersection'](_0x251c8f['model'],_0x251c8f[_0xe12e('0x37')]);_0x4f443c[_0xe12e('0x39')]=_['intersection'](_0x251c8f[_0xe12e('0x34')],qs[_0xe12e('0x3a')](_0x23cb99[_0xe12e('0x37')][_0xe12e('0x3a')]));_0x4f443c[_0xe12e('0x39')]=_0x4f443c[_0xe12e('0x39')][_0xe12e('0x3b')]?_0x4f443c[_0xe12e('0x39')]:_0x251c8f[_0xe12e('0x34')];if(!_0x23cb99[_0xe12e('0x37')][_0xe12e('0x3c')]('nolimit')){_0x4f443c['limit']=qs['limit'](_0x23cb99[_0xe12e('0x37')][_0xe12e('0x23')]);_0x4f443c[_0xe12e('0x25')]=qs['offset'](_0x23cb99['query'][_0xe12e('0x25')]);}_0x4f443c[_0xe12e('0x3d')]=qs[_0xe12e('0x3e')](_0x23cb99[_0xe12e('0x37')]['sort']);_0x4f443c[_0xe12e('0x3f')]=qs['filters'](_[_0xe12e('0x40')](_0x23cb99['query'],_0x251c8f['filters']),_0xc24c81);if(_0x23cb99['query'][_0xe12e('0x41')]){_0x4f443c[_0xe12e('0x3f')]=_[_0xe12e('0x42')](_0x4f443c[_0xe12e('0x3f')],{'$or':_[_0xe12e('0x2e')](_0xc24c81,function(_0x3e3944){if(_0x3e3944[_0xe12e('0x32')]!==_0xe12e('0x43')){var _0x295d5a={};_0x295d5a[_0x3e3944[_0xe12e('0x2d')]]={'$like':'%'+_0x23cb99['query'][_0xe12e('0x41')]+'%'};return _0x295d5a;}})});}_0x4f443c=_[_0xe12e('0x42')]({},_0x4f443c,_0x23cb99[_0xe12e('0x44')]);var _0x40c9b2={'where':_0x4f443c[_0xe12e('0x3f')]};return db[_0xe12e('0x2f')][_0xe12e('0x24')](_0x40c9b2)[_0xe12e('0x28')](function(_0x18538c){_0x272ecf[_0xe12e('0x24')]=_0x18538c;if(_0x23cb99[_0xe12e('0x37')][_0xe12e('0x45')]){_0x4f443c[_0xe12e('0x46')]=[{'all':!![]}];}return db[_0xe12e('0x2f')][_0xe12e('0x47')](_0x4f443c);})[_0xe12e('0x28')](function(_0x38437a){_0x272ecf[_0xe12e('0x48')]=_0x38437a;return _0x272ecf;})['then'](respondWithFilteredResult(_0x55f075,_0x4f443c))[_0xe12e('0x49')](handleError(_0x55f075,null));};exports[_0xe12e('0x4a')]=function(_0x4b22fb,_0xfce7fb){var _0x56f3b5={'raw':![],'where':{'id':_0x4b22fb[_0xe12e('0x4b')]['id']}},_0x5678ab={};_0x5678ab[_0xe12e('0x34')]=_[_0xe12e('0x38')](db[_0xe12e('0x2f')][_0xe12e('0x30')]);_0x5678ab[_0xe12e('0x37')]=_['keys'](_0x4b22fb[_0xe12e('0x37')]);_0x5678ab['filters']=_[_0xe12e('0x4c')](_0x5678ab[_0xe12e('0x34')],_0x5678ab[_0xe12e('0x37')]);_0x56f3b5[_0xe12e('0x39')]=_['intersection'](_0x5678ab['model'],qs[_0xe12e('0x3a')](_0x4b22fb[_0xe12e('0x37')]['fields']));_0x56f3b5[_0xe12e('0x39')]=_0x56f3b5[_0xe12e('0x39')][_0xe12e('0x3b')]?_0x56f3b5[_0xe12e('0x39')]:_0x5678ab[_0xe12e('0x34')];if(_0x4b22fb[_0xe12e('0x37')][_0xe12e('0x45')]){_0x56f3b5['include']=[{'all':!![]}];}_0x56f3b5=_['merge']({},_0x56f3b5,_0x4b22fb[_0xe12e('0x44')]);return db[_0xe12e('0x2f')][_0xe12e('0x4d')](_0x56f3b5)['then'](handleEntityNotFound(_0xfce7fb,null))['then'](respondWithResult(_0xfce7fb,null))[_0xe12e('0x49')](handleError(_0xfce7fb,null));};exports[_0xe12e('0x4e')]=function(_0x6877b9,_0x4a1ec5){return db[_0xe12e('0x2f')][_0xe12e('0x4e')](_0x6877b9[_0xe12e('0x4f')],{})['then'](respondWithResult(_0x4a1ec5,0xc9))[_0xe12e('0x49')](handleError(_0x4a1ec5,null));};exports[_0xe12e('0x50')]=function(_0x2e74bb,_0x43a428){if(_0x2e74bb[_0xe12e('0x4f')]['id']){delete _0x2e74bb[_0xe12e('0x4f')]['id'];}return db[_0xe12e('0x2f')][_0xe12e('0x4d')]({'where':{'id':_0x2e74bb[_0xe12e('0x4b')]['id']}})['then'](handleEntityNotFound(_0x43a428,null))[_0xe12e('0x28')](saveUpdates(_0x2e74bb[_0xe12e('0x4f')],null))[_0xe12e('0x28')](respondWithResult(_0x43a428,null))[_0xe12e('0x49')](handleError(_0x43a428,null));};exports[_0xe12e('0x51')]=function(_0x221379,_0x54907c){return db[_0xe12e('0x2f')][_0xe12e('0x51')]()[_0xe12e('0x28')](respondWithResult(_0x54907c,null))[_0xe12e('0x49')](handleError(_0x54907c,null));};exports['download']=function(_0x202c09,_0x176f94,_0x2e30d5){var _0x2324ac=require(_0xe12e('0x52'));var _0x350d5a=![];var _0x56178c={};if(_0x202c09[_0xe12e('0x37')][_0xe12e('0x32')]&&_0x202c09[_0xe12e('0x37')][_0xe12e('0x32')]===_0xe12e('0x53')){_0x56178c[_0xe12e('0x53')]=_0x202c09['params']['id'];}else{_0x56178c['id']=_0x202c09[_0xe12e('0x4b')]['id'];}return db['VoiceRecording'][_0xe12e('0x4d')]({'where':_0x56178c,'attributes':['id',_0xe12e('0x54')],'raw':!![]})[_0xe12e('0x28')](handleEntityNotFound(_0x176f94,null))[_0xe12e('0x28')](function(_0x3ca15f){if(_0x3ca15f){var _0x3c24c5=_0x3ca15f[_0xe12e('0x54')];var _0x278ee3=util[_0xe12e('0x36')](_0xe12e('0x55'),_0x3c24c5);if(fs['existsSync'](_0x278ee3)){_0x350d5a=!![];return _0x2324ac[_0xe12e('0x56')](_0x278ee3,_0x3c24c5,config[_0xe12e('0x57')][_0xe12e('0x58')])['then'](function(){return _0x3ca15f;});}return _0x3ca15f;}})[_0xe12e('0x28')](function(_0x63851f){if(_0x63851f){var _0x5f248e=_0x63851f[_0xe12e('0x54')];if(!fs[_0xe12e('0x59')](_0x5f248e)){throw new db[(_0xe12e('0x5a'))]['ValidationError']('VoiceRecording\x20not\x20found');}if(_0x63851f[_0xe12e('0x5b')]){return _0x176f94[_0xe12e('0x5c')](_0x5f248e,_0x63851f[_0xe12e('0x5b')]+path[_0xe12e('0x5d')](_0x5f248e),function(){if(_0x350d5a){fs[_0xe12e('0x5e')](_0x5f248e);}});}else{return _0x176f94['download'](_0x5f248e,function(_0x35d7c3){if(_0x350d5a){fs['unlink'](_0x5f248e);}});}}})['catch'](function(_0x1739e8){if(_0x1739e8['message']===_0xe12e('0x5f')){_0x176f94[_0xe12e('0x20')](0x194)[_0xe12e('0x60')](_0xe12e('0x61'));}else{return handleError(_0x176f94,null);}});};exports[_0xe12e('0x62')]=function(_0x3929e5,_0x5c0d07,_0x4b9f4a){var _0x12e1c7=require('../../components/encryptor');var _0x278b51=![];var _0x2d90bd={'$and':[db['sequelize']['where'](db[_0xe12e('0x63')]['fn'](_0xe12e('0x64'),db[_0xe12e('0x63')][_0xe12e('0x65')](_0xe12e('0x53'))),_0x3929e5['query'][_0xe12e('0x66')])]};if(_0x3929e5['query'][_0xe12e('0x32')]&&_0x3929e5[_0xe12e('0x37')][_0xe12e('0x32')]===_0xe12e('0x53')){_0x2d90bd['$and'][_0xe12e('0x67')]({'uniqueid':_0x3929e5[_0xe12e('0x4b')]['id']});}else{_0x2d90bd['$and']['push']({'id':_0x3929e5[_0xe12e('0x4b')]['id']});}return db['VoiceRecording'][_0xe12e('0x4d')]({'where':_0x2d90bd,'attributes':['id',_0xe12e('0x54')],'raw':!![]})[_0xe12e('0x28')](handleEntityNotFound(_0x5c0d07,null))['then'](function(_0x53c805){if(_0x53c805){var _0x3634d7=util[_0xe12e('0x36')](_0xe12e('0x55'),_0x53c805['value']);if(fs['existsSync'](_0x3634d7)){_0x278b51=!![];return _0x12e1c7[_0xe12e('0x56')](_0x3634d7,_0x53c805['value'],config['secrets'][_0xe12e('0x58')])['then'](function(){return _0x53c805;});}return _0x53c805;}})[_0xe12e('0x28')](function(_0x3af46a){if(_0x3af46a){if(!fs[_0xe12e('0x59')](_0x3af46a['value'])){throw new db['Sequelize'][(_0xe12e('0x68'))](_0xe12e('0x5f'));}if(_0x3af46a['filename']){return _0x5c0d07['download'](_0x3af46a[_0xe12e('0x54')],_0x3af46a[_0xe12e('0x5b')]+path[_0xe12e('0x5d')](_0x3af46a[_0xe12e('0x54')]),function(){if(_0x278b51){fs['unlink'](_0x3af46a[_0xe12e('0x54')]);}});}else{return _0x5c0d07['download'](_0x3af46a['value'],function(_0x455937){if(_0x278b51){fs[_0xe12e('0x5e')](_0x3af46a[_0xe12e('0x54')]);}});}}})['catch'](handleError(_0x5c0d07,null));};exports[_0xe12e('0x29')]=function(_0x59fce2,_0x1d7214){return db['VoiceRecording'][_0xe12e('0x4d')]({'where':{'id':_0x59fce2[_0xe12e('0x4b')]['id']}})['then'](function(_0x58a223){if(_['isNil'](_0x58a223)){throw new ReferenceError(_0xe12e('0x69'));}return _0x58a223;})[_0xe12e('0x28')](function(_0x30c943){var _0x5a9139=_0x30c943[_0xe12e('0x54')];logger[_0xe12e('0x6a')](_0xe12e('0x6b'),_0x5a9139);if(!_['isNil'](_0x30c943[_0xe12e('0x54')])&&fs[_0xe12e('0x59')](_0x5a9139)){logger[_0xe12e('0x6a')](_0xe12e('0x6c')+_0x5a9139+_0xe12e('0x6d'));fs[_0xe12e('0x6e')](_0x5a9139);}_0x5a9139=_0x5a9139+'.cypher';if(!_['isNil'](_0x30c943['value'])&&fs['existsSync'](_0x5a9139)){logger['info'](_0xe12e('0x6c')+_0x5a9139+_0xe12e('0x6d'));fs[_0xe12e('0x6e')](_0x5a9139);}return _0x30c943;})[_0xe12e('0x28')](function(_0xae87fd){if(!_0xae87fd)throw new InternalError();return _0xae87fd[_0xe12e('0x29')]();})[_0xe12e('0x28')](function(){_0x1d7214[_0xe12e('0x20')](0xcc)[_0xe12e('0x2a')]();})[_0xe12e('0x49')](handleError(_0x1d7214,null));};function getBucketslist(_0x2bbda1,_0x135e3d,_0x3242bd){return new Promise(function(_0x5efcdd,_0x51e3ba){var _0x40e525=new AWS['S3']({'accessKeyId':_0x135e3d,'secretAccessKey':_0x2bbda1,'region':_0x3242bd});_0x40e525[_0xe12e('0x6f')]({},function(_0x2bc43c,_0x41fefd){if(_0x2bc43c){return _0x51e3ba(_0x2bc43c);}else{return _0x5efcdd(_0x41fefd);}});});}function createBucket(_0xe30af8,_0x268900,_0x13ed18,_0x12260f){return new Promise(function(_0x2cb6f8,_0xccf172){var _0x4b75dc=new AWS['S3']({'accessKeyId':_0x268900,'secretAccessKey':_0xe30af8,'region':_0x13ed18});_0x4b75dc[_0xe12e('0x70')]({'Bucket':_0x12260f},function(_0x2e13d9,_0x21fd9f){if(_0x2e13d9){return _0xccf172(_0x2e13d9);}else{return _0x2cb6f8(_0x21fd9f);}});});}function uploadFile(_0x178805,_0x95f930,_0xd5be23,_0x4226cd,_0x278dba,_0x324f47){return new Promise(function(_0x195681,_0x2270e4){var _0x5a2920=new AWS['S3']({'accessKeyId':_0x95f930,'secretAccessKey':_0x178805,'region':_0xd5be23});_0x5a2920[_0xe12e('0x71')]({'Bucket':_0x4226cd,'Key':_0x278dba,'Body':_0x324f47},function(_0x5d7ed1,_0x422fc9){if(_0x5d7ed1){return _0x2270e4(_0x5d7ed1);}else{return _0x195681(_0x422fc9);}});});}function startTranscribe(_0x93f2d1,_0x53e52f,_0x1b2f9c,_0xbec1ef,_0x31d664,_0x277910){return new Promise(function(_0x1d5857,_0x5cbf04){var _0x2a7b89=new AWS[(_0xe12e('0x72'))]({'accessKeyId':_0x53e52f,'secretAccessKey':_0x93f2d1,'region':_0x1b2f9c});_0x2a7b89['startTranscriptionJob']({'TranscriptionJobName':_0xbec1ef,'LanguageCode':_0x31d664,'Media':{'MediaFileUri':_0x277910}},function(_0x392791,_0x313c08){if(_0x392791){return _0x5cbf04(_0x392791);}else{return _0x1d5857(_0x313c08);}});});}function transcribe(_0x55cac5,_0xb655f6,_0x4993d4,_0xe91a71,_0x1d029b,_0xd6f270,_0x136b82){return new Promise(function(_0x161638,_0x2a67aa){var _0x1a736f={};logger[_0xe12e('0x6a')](util[_0xe12e('0x36')](_0xe12e('0x73'),_0x55cac5,_0x1d029b));return uploadFile(_0xb655f6,_0x4993d4,_0xe91a71,_0x1d029b,path[_0xe12e('0x74')](_0xd6f270),fs['readFileSync'](_0xd6f270))['then'](function(_0x2b0a71){logger[_0xe12e('0x6a')](util[_0xe12e('0x36')](_0xe12e('0x75'),_0x55cac5,_0x1d029b,_0x2b0a71[_0xe12e('0x76')]));_0x1a736f[_0xe12e('0x77')]=_0x2b0a71[_0xe12e('0x78')];_0x1a736f[_0xe12e('0x79')]=_0x2b0a71['Location'];logger[_0xe12e('0x6a')](util[_0xe12e('0x36')](_0xe12e('0x7a'),_0x55cac5));return startTranscribe(_0xb655f6,_0x4993d4,_0xe91a71,uuidv4(),_0x136b82,_0x2b0a71[_0xe12e('0x76')]);})['then'](function(_0x2dda43){logger[_0xe12e('0x6a')](util[_0xe12e('0x36')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x55cac5,_0x2dda43[_0xe12e('0x7b')][_0xe12e('0x7c')]));_0x1a736f['transcribeName']=_0x2dda43['TranscriptionJob'][_0xe12e('0x7c')];_0x1a736f[_0xe12e('0x7d')]=_0x2dda43[_0xe12e('0x7b')]['TranscriptionJobStatus'];return _0x161638(_0x1a736f);})[_0xe12e('0x49')](function(_0x5eb6c0){return _0x2a67aa(_0x5eb6c0);});});}exports[_0xe12e('0x7e')]=function(_0x14d45b,_0x448a6f,_0x30a3a7){var _0x51562d;var _0x4c42ec;var _0x28e3fe;var _0x2ea49f=require(_0xe12e('0x52'));return db['VoiceRecording'][_0xe12e('0x7f')]({'where':{'id':_0x14d45b['params']['id']}})['then'](function(_0x4bb842){if(_0x4bb842){var _0x3130d2=util[_0xe12e('0x36')](_0xe12e('0x55'),_0x4bb842['value']);if(fs[_0xe12e('0x59')](_0x3130d2)){cypher=!![];return _0x2ea49f[_0xe12e('0x56')](_0x3130d2,_0x4bb842['value'],config['secrets'][_0xe12e('0x58')])[_0xe12e('0x28')](function(){return _0x4bb842;});}return _0x4bb842;}})[_0xe12e('0x28')](function(_0x253e99){if(!_0x253e99){throw new db[(_0xe12e('0x5a'))][(_0xe12e('0x68'))]('Voice\x20Recording\x20not\x20found');}_0x4c42ec=_0x253e99;return db[_0xe12e('0x80')]['findOne']({'where':{'id':0x1}});})[_0xe12e('0x28')](handleEntityNotFound(_0x448a6f,null))[_0xe12e('0x28')](function(_0x35973e){if(_0x35973e){_0x51562d=_0x35973e;if(!_0x51562d['transcribe']||!_0x51562d[_0xe12e('0x81')]||!_0x51562d['transcribeRegion']||!_0x51562d[_0xe12e('0x82')]||!_0x51562d[_0xe12e('0x77')]){throw new db[(_0xe12e('0x5a'))][(_0xe12e('0x68'))](_0xe12e('0x83'));}if(_0x14d45b[_0xe12e('0x4f')][_0xe12e('0x84')]&&(!_0x51562d[_0xe12e('0x85')]||!_0x51562d[_0xe12e('0x86')]||!_0x51562d['sentimentRegion']||!_0x51562d[_0xe12e('0x82')]||!_0x51562d['bucket'])){throw new db[(_0xe12e('0x5a'))][(_0xe12e('0x68'))](_0xe12e('0x87'));}return db[_0xe12e('0x88')][_0xe12e('0x7f')]({'where':{'id':_0x51562d[_0xe12e('0x81')]}});}})[_0xe12e('0x28')](function(_0x5b72a9){if(!_0x5b72a9){throw new db[(_0xe12e('0x5a'))][(_0xe12e('0x68'))](_0xe12e('0x89'));}if(!_0x5b72a9[_0xe12e('0x8a')]||!_0x5b72a9[_0xe12e('0x8b')]){throw new db[(_0xe12e('0x5a'))][(_0xe12e('0x68'))](_0xe12e('0x8c'));}_0x28e3fe=_0x5b72a9;return getBucketslist(_0x28e3fe[_0xe12e('0x8a')],_0x28e3fe[_0xe12e('0x8b')],_0x51562d[_0xe12e('0x8d')]);})[_0xe12e('0x28')](function(_0x490619){if(_0x490619&&_0x490619[_0xe12e('0x8e')]){var _0x564e23=_[_0xe12e('0x4d')](_0x490619[_0xe12e('0x8e')],function(_0x2ec631){return _0x2ec631[_0xe12e('0x8f')]===_0x51562d[_0xe12e('0x77')];});if(!_0x564e23){logger['info'](util[_0xe12e('0x36')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x14d45b[_0xe12e('0x4b')]['id'],_0x51562d['bucket']));return createBucket(_0x28e3fe[_0xe12e('0x8a')],_0x28e3fe[_0xe12e('0x8b')],_0x51562d[_0xe12e('0x8d')],_0x51562d[_0xe12e('0x77')]);}logger[_0xe12e('0x6a')](util[_0xe12e('0x36')](_0xe12e('0x90'),_0x14d45b['params']['id'],_0x51562d[_0xe12e('0x77')]));return;}})[_0xe12e('0x28')](function(_0x3e6936){if(_0x4c42ec[_0xe12e('0x7d')]===_0xe12e('0x91')){return transcribe(_0x14d45b[_0xe12e('0x4b')]['id'],_0x28e3fe['data1'],_0x28e3fe[_0xe12e('0x8b')],_0x51562d[_0xe12e('0x8d')],_0x51562d['bucket'],_0x4c42ec[_0xe12e('0x54')],_0x51562d['language']);}else{logger[_0xe12e('0x6a')](util[_0xe12e('0x36')](_0xe12e('0x92'),_0x14d45b[_0xe12e('0x4b')]['id']));return{'transcribeStatus':_0xe12e('0x93')};}})['then'](function(_0x23591e){if(_0x23591e){_0x23591e[_0xe12e('0x94')]=_0x14d45b[_0xe12e('0x4f')][_0xe12e('0x84')];return _0x4c42ec[_0xe12e('0x95')](_0x23591e);}})[_0xe12e('0x28')](respondWithResult(_0x448a6f,null))['catch'](handleError(_0x448a6f,null));};function writeFile(_0x106db0,_0x3c9c48){return new Promise(function(_0x255c1d,_0x33fb2f){fs['writeFile'](_0x3c9c48,_0x106db0,function(_0x512ca3,_0x47df58){if(_0x512ca3){return _0x33fb2f(_0x512ca3);}else{return _0x255c1d(_0x47df58);}});});}exports[_0xe12e('0x96')]=function(_0x1515d8,_0x1ac956,_0x3c5a8a){return db[_0xe12e('0x2f')]['findOne']({'where':{'id':_0x1515d8[_0xe12e('0x4b')]['id']}})[_0xe12e('0x28')](handleEntityNotFound(_0x1ac956))['then'](function(_0x2a692a){if(_0x2a692a&&_0x2a692a[_0xe12e('0x97')]){var _0x3e96ef=_0x2a692a['fileText'];var _0x5d7bec=config['root']+'/server/files/transcribes/transcribe_'+_0x2a692a['id']+'.txt';if(fs[_0xe12e('0x59')](_0x5d7bec)){return _0x5d7bec;}return writeFile(_0x3e96ef,_0x5d7bec)[_0xe12e('0x28')](function(){return _0x5d7bec;});}else{throw new db[(_0xe12e('0x5a'))]['ValidationError']('Transcript\x20not\x20available');}})[_0xe12e('0x28')](function(_0x40fb3e){return _0x1ac956[_0xe12e('0x5c')](_0x40fb3e);})['catch'](handleError(_0x1ac956));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 817ece3..64e411b 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 _0x1f38=['exports','define','VoiceRecording','uniqueid','transcribeStatus','./voiceRecording.attributes'];(function(_0x3aa055,_0x33fcc6){var _0x629941=function(_0x4a179d){while(--_0x4a179d){_0x3aa055['push'](_0x3aa055['shift']());}};_0x629941(++_0x33fcc6);}(_0x1f38,0xd7));var _0x81f3=function(_0x26260c,_0x3a9df0){_0x26260c=_0x26260c-0x0;var _0x21f487=_0x1f38[_0x26260c];return _0x21f487;};'use strict';var attributes=require(_0x81f3('0x0'));module[_0x81f3('0x1')]=function(_0x2a260c,_0x3f167c){return _0x2a260c[_0x81f3('0x2')](_0x81f3('0x3'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0x81f3('0x4'),'fields':[_0x81f3('0x4')]},{'name':_0x81f3('0x5'),'fields':[_0x81f3('0x5')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0834=['uniqueid','transcribeStatus'];(function(_0x1ac71e,_0x12d0b6){var _0x57a246=function(_0x3f6b6b){while(--_0x3f6b6b){_0x1ac71e['push'](_0x1ac71e['shift']());}};_0x57a246(++_0x12d0b6);}(_0x0834,0x18e));var _0x4083=function(_0x51150a,_0x4aeff8){_0x51150a=_0x51150a-0x0;var _0x210086=_0x0834[_0x51150a];return _0x210086;};'use strict';var attributes=require('./voiceRecording.attributes');module['exports']=function(_0x38d73f,_0x318f69){return _0x38d73f['define']('VoiceRecording',attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0x4083('0x0'),'fields':[_0x4083('0x0')]},{'name':'transcribeStatus','fields':[_0x4083('0x1')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 710d41f..d870df6 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 _0x955f=['randomstring','../../mysqldb','rpc','jayson/promise','client','http','request','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','update','body','options','raw','where','attributes','limit','debug','UpdateVoiceRecording','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','VoiceRecording','create','existsSync','%s.cypher','value','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird'];(function(_0x4cb22d,_0x37c46e){var _0x216bdd=function(_0x307bfd){while(--_0x307bfd){_0x4cb22d['push'](_0x4cb22d['shift']());}};_0x216bdd(++_0x37c46e);}(_0x955f,0x1eb));var _0xf955=function(_0x793787,_0x44018c){_0x793787=_0x793787-0x0;var _0x277bc8=_0x955f[_0x793787];return _0x277bc8;};'use strict';var _=require(_0xf955('0x0'));var util=require(_0xf955('0x1'));var moment=require(_0xf955('0x2'));var BPromise=require(_0xf955('0x3'));var rs=require(_0xf955('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf955('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf955('0x6'));var config=require('../../config/environment');var jayson=require(_0xf955('0x7'));var client=jayson[_0xf955('0x8')][_0xf955('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x59d5b3,_0x18432f,_0x20c096){return new BPromise(function(_0x4f58fb,_0x254b38){return client[_0xf955('0xa')](_0x59d5b3,_0x20c096)[_0xf955('0xb')](function(_0x38b190){logger[_0xf955('0xc')](_0xf955('0xd'),_0x18432f,_0xf955('0xe'));logger['debug'](_0xf955('0xf'),_0x18432f,'request\x20sent',JSON[_0xf955('0x10')](_0x38b190));if(_0x38b190[_0xf955('0x11')]){if(_0x38b190[_0xf955('0x11')]['code']===0x1f4){logger[_0xf955('0x11')]('VoiceRecording,\x20%s,\x20%s',_0x18432f,_0x38b190[_0xf955('0x11')]['message']);return _0x254b38(_0x38b190[_0xf955('0x11')][_0xf955('0x12')]);}logger[_0xf955('0x11')](_0xf955('0xd'),_0x18432f,_0x38b190[_0xf955('0x11')][_0xf955('0x12')]);return _0x4f58fb(_0x38b190[_0xf955('0x11')][_0xf955('0x12')]);}else{logger[_0xf955('0xc')](_0xf955('0xd'),_0x18432f,'request\x20sent');_0x4f58fb(_0x38b190[_0xf955('0x13')]['message']);}})[_0xf955('0x14')](function(_0x3a814f){logger[_0xf955('0x11')](_0xf955('0xd'),_0x18432f,_0x3a814f);_0x254b38(_0x3a814f);});});}exports['UpdateVoiceRecording']=function(_0x5ac6cb){var _0x1e20d1=this;return new Promise(function(_0xe6de5c,_0x3c49c0){return db['VoiceRecording'][_0xf955('0x15')](_0x5ac6cb[_0xf955('0x16')],{'raw':_0x5ac6cb[_0xf955('0x17')]?_0x5ac6cb[_0xf955('0x17')][_0xf955('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5ac6cb['options']?_0x5ac6cb[_0xf955('0x17')][_0xf955('0x19')]||null:null,'attributes':_0x5ac6cb[_0xf955('0x17')]?_0x5ac6cb['options'][_0xf955('0x1a')]||null:null,'limit':_0x5ac6cb['options']?_0x5ac6cb[_0xf955('0x17')][_0xf955('0x1b')]||null:null})[_0xf955('0xb')](function(_0xa4ebb4){logger[_0xf955('0xc')]('UpdateVoiceRecording',_0x5ac6cb);logger[_0xf955('0x1c')](_0xf955('0x1d'),_0x5ac6cb,JSON[_0xf955('0x10')](_0xa4ebb4));_0xe6de5c(_0xa4ebb4);})[_0xf955('0x14')](function(_0x17dec2){logger[_0xf955('0x11')](_0xf955('0x1d'),_0x17dec2['message'],_0x5ac6cb);_0x3c49c0(_0x1e20d1[_0xf955('0x11')](0x1f4,_0x17dec2[_0xf955('0x12')]));});});};exports[_0xf955('0x1e')]=function(_0x406632){var _0x2dcd55=this;return new Promise(function(_0x13a86d,_0x3796f7){var _0x51f3ab=require(_0xf955('0x1f'));var _0x145098;return db[_0xf955('0x20')][_0xf955('0x21')]({'attributes':['id',_0xf955('0x22')],'where':{'id':0x1},'raw':!![]})[_0xf955('0xb')](function(_0x4d4af0){_0x145098=_0x4d4af0;return db[_0xf955('0x23')][_0xf955('0x24')](_0x406632['body']);})[_0xf955('0xb')](function(_0x2c8df1){if(_0x145098[_0xf955('0x22')]&&fs[_0xf955('0x25')](_0x2c8df1['value'])){var _0x3a951c=util['format'](_0xf955('0x26'),_0x2c8df1[_0xf955('0x27')]);return _0x51f3ab[_0xf955('0x28')](_0x2c8df1[_0xf955('0x27')],_0x3a951c,config[_0xf955('0x29')][_0xf955('0x2a')])[_0xf955('0xb')](function(){fs[_0xf955('0x2b')](_0x2c8df1['value']);logger[_0xf955('0xc')](_0xf955('0x2c'));return _0x2c8df1;});}return _0x2c8df1;})[_0xf955('0xb')](function(_0x2046c8){logger['info'](_0xf955('0x1e'),_0x406632);logger[_0xf955('0x1c')](_0xf955('0x1e'),_0x406632,JSON[_0xf955('0x10')](_0x2046c8));_0x13a86d(_0x2046c8);})[_0xf955('0x14')](function(_0x4eb2c3){logger['error']('CreateVoiceRecording',_0x4eb2c3[_0xf955('0x12')],_0x406632);_0x3796f7(_0x2dcd55[_0xf955('0x11')](0x1f4,_0x4eb2c3[_0xf955('0x12')]));});});}; \ No newline at end of file +var _0xcaf2=['CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','create','existsSync','value','format','encryptFile','secrets','recording','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','error','code','message','result','VoiceRecording','body','options','raw','where','attributes','limit','UpdateVoiceRecording','stringify','catch'];(function(_0x11faf5,_0x5a7bc2){var _0x265160=function(_0xd989bb){while(--_0xd989bb){_0x11faf5['push'](_0x11faf5['shift']());}};_0x265160(++_0x5a7bc2);}(_0xcaf2,0x8a));var _0x2caf=function(_0x18fdaf,_0x457de2){_0x18fdaf=_0x18fdaf-0x0;var _0x557a9b=_0xcaf2[_0x18fdaf];return _0x557a9b;};'use strict';var _=require(_0x2caf('0x0'));var util=require('util');var moment=require(_0x2caf('0x1'));var BPromise=require(_0x2caf('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2caf('0x3'));var db=require(_0x2caf('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2caf('0x5'))('rpc');var config=require(_0x2caf('0x6'));var jayson=require(_0x2caf('0x7'));var client=jayson[_0x2caf('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc44e4e,_0x314486,_0x4667c6){return new BPromise(function(_0x34e792,_0x5611aa){return client[_0x2caf('0x9')](_0xc44e4e,_0x4667c6)[_0x2caf('0xa')](function(_0x45e520){logger[_0x2caf('0xb')](_0x2caf('0xc'),_0x314486,_0x2caf('0xd'));logger[_0x2caf('0xe')](_0x2caf('0xf'),_0x314486,_0x2caf('0xd'),JSON['stringify'](_0x45e520));if(_0x45e520[_0x2caf('0x10')]){if(_0x45e520[_0x2caf('0x10')][_0x2caf('0x11')]===0x1f4){logger[_0x2caf('0x10')](_0x2caf('0xc'),_0x314486,_0x45e520[_0x2caf('0x10')][_0x2caf('0x12')]);return _0x5611aa(_0x45e520[_0x2caf('0x10')]['message']);}logger[_0x2caf('0x10')](_0x2caf('0xc'),_0x314486,_0x45e520['error']['message']);return _0x34e792(_0x45e520['error'][_0x2caf('0x12')]);}else{logger['info'](_0x2caf('0xc'),_0x314486,_0x2caf('0xd'));_0x34e792(_0x45e520[_0x2caf('0x13')][_0x2caf('0x12')]);}})['catch'](function(_0x184355){logger['error'](_0x2caf('0xc'),_0x314486,_0x184355);_0x5611aa(_0x184355);});});}exports['UpdateVoiceRecording']=function(_0x4a33fc){var _0x3e975f=this;return new Promise(function(_0x58047b,_0xe72440){return db[_0x2caf('0x14')]['update'](_0x4a33fc[_0x2caf('0x15')],{'raw':_0x4a33fc[_0x2caf('0x16')]?_0x4a33fc[_0x2caf('0x16')][_0x2caf('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4a33fc[_0x2caf('0x16')]?_0x4a33fc['options'][_0x2caf('0x18')]||null:null,'attributes':_0x4a33fc[_0x2caf('0x16')]?_0x4a33fc[_0x2caf('0x16')][_0x2caf('0x19')]||null:null,'limit':_0x4a33fc[_0x2caf('0x16')]?_0x4a33fc[_0x2caf('0x16')][_0x2caf('0x1a')]||null:null})[_0x2caf('0xa')](function(_0x3332b1){logger[_0x2caf('0xb')](_0x2caf('0x1b'),_0x4a33fc);logger['debug'](_0x2caf('0x1b'),_0x4a33fc,JSON[_0x2caf('0x1c')](_0x3332b1));_0x58047b(_0x3332b1);})[_0x2caf('0x1d')](function(_0x401ea2){logger[_0x2caf('0x10')](_0x2caf('0x1b'),_0x401ea2[_0x2caf('0x12')],_0x4a33fc);_0xe72440(_0x3e975f[_0x2caf('0x10')](0x1f4,_0x401ea2[_0x2caf('0x12')]));});});};exports[_0x2caf('0x1e')]=function(_0x5ad211){var _0x6a32ac=this;return new Promise(function(_0x325eda,_0xbefce6){var _0x37b08f=require(_0x2caf('0x1f'));var _0x17d3c6;return db[_0x2caf('0x20')][_0x2caf('0x21')]({'attributes':['id',_0x2caf('0x22')],'where':{'id':0x1},'raw':!![]})[_0x2caf('0xa')](function(_0x30da75){_0x17d3c6=_0x30da75;return db[_0x2caf('0x14')][_0x2caf('0x23')](_0x5ad211['body']);})[_0x2caf('0xa')](function(_0xda0ec5){if(_0x17d3c6[_0x2caf('0x22')]&&fs[_0x2caf('0x24')](_0xda0ec5[_0x2caf('0x25')])){var _0x1f52bf=util[_0x2caf('0x26')]('%s.cypher',_0xda0ec5[_0x2caf('0x25')]);return _0x37b08f[_0x2caf('0x27')](_0xda0ec5['value'],_0x1f52bf,config[_0x2caf('0x28')][_0x2caf('0x29')])[_0x2caf('0xa')](function(){fs['unlink'](_0xda0ec5[_0x2caf('0x25')]);logger['info']('CreateVoiceRecording\x20file\x20encrypted');return _0xda0ec5;});}return _0xda0ec5;})[_0x2caf('0xa')](function(_0x28b715){logger[_0x2caf('0xb')](_0x2caf('0x1e'),_0x5ad211);logger[_0x2caf('0xe')](_0x2caf('0x1e'),_0x5ad211,JSON[_0x2caf('0x1c')](_0x28b715));_0x325eda(_0x28b715);})[_0x2caf('0x1d')](function(_0x20818e){logger['error'](_0x2caf('0x1e'),_0x20818e[_0x2caf('0x12')],_0x5ad211);_0xbefce6(_0x6a32ac[_0x2caf('0x10')](0x1f4,_0x20818e[_0x2caf('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 0c80626..a132878 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 _0xb17d=['Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','put','update','/:id','destroy','exports','multer','path','connect-timeout'];(function(_0x3a4e92,_0x3d5009){var _0x31d72b=function(_0x4cbf19){while(--_0x4cbf19){_0x3a4e92['push'](_0x3a4e92['shift']());}};_0x31d72b(++_0x3d5009);}(_0xb17d,0x11d));var _0xdb17=function(_0x31a7a5,_0x134aeb){_0x31a7a5=_0x31a7a5-0x0;var _0xf110da=_0xb17d[_0x31a7a5];return _0xf110da;};'use strict';var multer=require(_0xdb17('0x0'));var util=require('util');var path=require(_0xdb17('0x1'));var timeout=require(_0xdb17('0x2'));var express=require('express');var router=express[_0xdb17('0x3')]();var fs_extra=require(_0xdb17('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xdb17('0x5'));var config=require(_0xdb17('0x6'));var controller=require('./voiceTransferReport.controller');router[_0xdb17('0x7')]('/',auth[_0xdb17('0x8')](),controller[_0xdb17('0x9')]);router[_0xdb17('0x7')](_0xdb17('0xa'),auth['isAuthenticated'](),controller[_0xdb17('0xb')]);router[_0xdb17('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xdb17('0xc')]);router['post']('/',auth[_0xdb17('0x8')](),controller['create']);router[_0xdb17('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xdb17('0xe')]);router['delete'](_0xdb17('0xf'),auth[_0xdb17('0x8')](),controller[_0xdb17('0x10')]);module[_0xdb17('0x11')]=router; \ No newline at end of file +var _0x3aed=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x528622,_0xcb18f0){var _0x1b12a0=function(_0x4d4065){while(--_0x4d4065){_0x528622['push'](_0x528622['shift']());}};_0x1b12a0(++_0xcb18f0);}(_0x3aed,0x1a8));var _0xd3ae=function(_0x2d34d6,_0x397ff9){_0x2d34d6=_0x2d34d6-0x0;var _0x1d3d12=_0x3aed[_0x2d34d6];return _0x1d3d12;};'use strict';var multer=require(_0xd3ae('0x0'));var util=require(_0xd3ae('0x1'));var path=require(_0xd3ae('0x2'));var timeout=require(_0xd3ae('0x3'));var express=require(_0xd3ae('0x4'));var router=express[_0xd3ae('0x5')]();var fs_extra=require(_0xd3ae('0x6'));var auth=require(_0xd3ae('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xd3ae('0x8'));var controller=require(_0xd3ae('0x9'));router[_0xd3ae('0xa')]('/',auth[_0xd3ae('0xb')](),controller[_0xd3ae('0xc')]);router[_0xd3ae('0xa')]('/describe',auth[_0xd3ae('0xb')](),controller['describe']);router[_0xd3ae('0xa')](_0xd3ae('0xd'),auth[_0xd3ae('0xb')](),controller[_0xd3ae('0xe')]);router[_0xd3ae('0xf')]('/',auth[_0xd3ae('0xb')](),controller[_0xd3ae('0x10')]);router[_0xd3ae('0x11')](_0xd3ae('0xd'),auth[_0xd3ae('0xb')](),controller[_0xd3ae('0x12')]);router[_0xd3ae('0x13')](_0xd3ae('0xd'),auth[_0xd3ae('0xb')](),controller[_0xd3ae('0x14')]);module[_0xd3ae('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 11b209d..91d9b30 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 _0xb9bc=['blind','attended','STRING','sequelize','exports','ENUM'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb9bc,0x93));var _0xcb9b=function(_0x1f27df,_0x4f1a64){_0x1f27df=_0x1f27df-0x0;var _0x286ee2=_0xb9bc[_0x1f27df];return _0x286ee2;};'use strict';var Sequelize=require(_0xcb9b('0x0'));var moment=require('moment');module[_0xcb9b('0x1')]={'type':{'type':Sequelize[_0xcb9b('0x2')](_0xcb9b('0x3'),_0xcb9b('0x4'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0xcb9b('0x5')]},'transferercalleridnum':{'type':Sequelize[_0xcb9b('0x5')]},'transferercalleridname':{'type':Sequelize[_0xcb9b('0x5')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize[_0xcb9b('0x5')]},'transferercontext':{'type':Sequelize[_0xcb9b('0x5')]},'transfererexten':{'type':Sequelize[_0xcb9b('0x5')]},'transfererlinkedid':{'type':Sequelize[_0xcb9b('0x5')]},'transfereechannel':{'type':Sequelize[_0xcb9b('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0xcb9b('0x5')]},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0xcb9b('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0xcb9b('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0xcb9b('0x5')]},'transfereecontext':{'type':Sequelize[_0xcb9b('0x5')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0xcb9b('0x5')]},'isexternal':{'type':Sequelize[_0xcb9b('0x2')]('Yes','No')},'context':{'type':Sequelize[_0xcb9b('0x5')]},'extension':{'type':Sequelize[_0xcb9b('0x5')]}}; \ No newline at end of file +var _0xcc13=['attended','STRING','Yes','sequelize','exports'];(function(_0x10be2d,_0x7b1ff6){var _0x7a9389=function(_0x3b8ffc){while(--_0x3b8ffc){_0x10be2d['push'](_0x10be2d['shift']());}};_0x7a9389(++_0x7b1ff6);}(_0xcc13,0x161));var _0x3cc1=function(_0x2c1c4f,_0x34de6c){_0x2c1c4f=_0x2c1c4f-0x0;var _0x1cf1a2=_0xcc13[_0x2c1c4f];return _0x1cf1a2;};'use strict';var Sequelize=require(_0x3cc1('0x0'));var moment=require('moment');module[_0x3cc1('0x1')]={'type':{'type':Sequelize['ENUM']('blind',_0x3cc1('0x2'))},'result':{'type':Sequelize[_0x3cc1('0x3')]},'transfererchannel':{'type':Sequelize[_0x3cc1('0x3')]},'transferercalleridnum':{'type':Sequelize[_0x3cc1('0x3')]},'transferercalleridname':{'type':Sequelize[_0x3cc1('0x3')]},'transfererconnectedlinenum':{'type':Sequelize[_0x3cc1('0x3')]},'transfererconnectedlinename':{'type':Sequelize[_0x3cc1('0x3')]},'transfereraccountcode':{'type':Sequelize[_0x3cc1('0x3')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0x3cc1('0x3')]},'transfererlinkedid':{'type':Sequelize[_0x3cc1('0x3')]},'transfereechannel':{'type':Sequelize[_0x3cc1('0x3')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0x3cc1('0x3')]},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize[_0x3cc1('0x3')]},'transfereeaccountcode':{'type':Sequelize[_0x3cc1('0x3')]},'transfereecontext':{'type':Sequelize[_0x3cc1('0x3')]},'transfereeexten':{'type':Sequelize[_0x3cc1('0x3')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize['ENUM'](_0x3cc1('0x4'),'No')},'context':{'type':Sequelize[_0x3cc1('0x3')]},'extension':{'type':Sequelize[_0x3cc1('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 3f44cf8..fe26bc1 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 _0xf702=['create','body','update','find','params','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','crypto','jsforce','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','undefined','limit','count','offset','Content-Range','json','reject','save','destroy','then','error','stack','name','send','index','map','rawAttributes','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','filter','merge','type','VIRTUAL','where','includeAll','VoiceTransferReport','findAll','rows','options','catch'];(function(_0x44b443,_0x14ae06){var _0x4432bc=function(_0x555ace){while(--_0x555ace){_0x44b443['push'](_0x44b443['shift']());}};_0x4432bc(++_0x14ae06);}(_0xf702,0x173));var _0x2f70=function(_0x25f358,_0x243df3){_0x25f358=_0x25f358-0x0;var _0x584195=_0xf702[_0x25f358];return _0x584195;};'use strict';var emlformat=require(_0x2f70('0x0'));var rimraf=require(_0x2f70('0x1'));var zipdir=require(_0x2f70('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2f70('0x3'));var moment=require(_0x2f70('0x4'));var BPromise=require(_0x2f70('0x5'));var Mustache=require(_0x2f70('0x6'));var util=require(_0x2f70('0x7'));var path=require(_0x2f70('0x8'));var sox=require('sox');var csv=require(_0x2f70('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2f70('0xa'));var _=require(_0x2f70('0xb'));var squel=require('squel');var crypto=require(_0x2f70('0xc'));var jsforce=require(_0x2f70('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2f70('0xe'));var Redis=require('ioredis');var authService=require(_0x2f70('0xf'));var qs=require(_0x2f70('0x10'));var as=require(_0x2f70('0x11'));var hardwareService=require(_0x2f70('0x12'));var logger=require(_0x2f70('0x13'))(_0x2f70('0x14'));var utils=require(_0x2f70('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2f70('0x16'));var db=require(_0x2f70('0x17'))['db'];function respondWithStatusCode(_0x3f2ec1,_0x53990d){_0x53990d=_0x53990d||0xcc;return function(_0xf86afa){if(_0xf86afa){return _0x3f2ec1[_0x2f70('0x18')](_0x53990d);}return _0x3f2ec1[_0x2f70('0x19')](_0x53990d)[_0x2f70('0x1a')]();};}function respondWithResult(_0x211820,_0x28b855){_0x28b855=_0x28b855||0xc8;return function(_0x40af35){if(_0x40af35){return _0x211820[_0x2f70('0x19')](_0x28b855)['json'](_0x40af35);}};}function respondWithFilteredResult(_0x4af2b7,_0x286f3e){return function(_0x11296f){if(_0x11296f){var _0x34d37d=typeof _0x286f3e['offset']===_0x2f70('0x1b')&&typeof _0x286f3e[_0x2f70('0x1c')]===_0x2f70('0x1b');var _0x10e179=_0x11296f[_0x2f70('0x1d')];var _0x2231ec=_0x34d37d?0x0:_0x286f3e[_0x2f70('0x1e')];var _0x43ae14=_0x34d37d?_0x11296f[_0x2f70('0x1d')]:_0x286f3e['offset']+_0x286f3e[_0x2f70('0x1c')];var _0x502ed6;if(_0x43ae14>=_0x10e179){_0x43ae14=_0x10e179;_0x502ed6=0xc8;}else{_0x502ed6=0xce;}_0x4af2b7[_0x2f70('0x19')](_0x502ed6);return _0x4af2b7['set'](_0x2f70('0x1f'),_0x2231ec+'-'+_0x43ae14+'/'+_0x10e179)[_0x2f70('0x20')](_0x11296f);}return null;};}function patchUpdates(_0x30e6d6){return function(_0x2679c8){try{jsonpatch['apply'](_0x2679c8,_0x30e6d6,!![]);}catch(_0x5a79d8){return BPromise[_0x2f70('0x21')](_0x5a79d8);}return _0x2679c8[_0x2f70('0x22')]();};}function saveUpdates(_0x41ed56,_0x204557){return function(_0x6ae987){if(_0x6ae987){return _0x6ae987['update'](_0x41ed56)['then'](function(_0x12f595){return _0x12f595;});}return null;};}function removeEntity(_0x17ff36,_0x541e30){return function(_0xcaab9f){if(_0xcaab9f){return _0xcaab9f[_0x2f70('0x23')]()[_0x2f70('0x24')](function(){_0x17ff36[_0x2f70('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f1449,_0x45153f){return function(_0x44ec3a){if(!_0x44ec3a){_0x3f1449[_0x2f70('0x18')](0x194);}return _0x44ec3a;};}function handleError(_0x59f39d,_0xff997a){_0xff997a=_0xff997a||0x1f4;return function(_0x3d252a){logger[_0x2f70('0x25')](_0x3d252a[_0x2f70('0x26')]);if(_0x3d252a[_0x2f70('0x27')]){delete _0x3d252a[_0x2f70('0x27')];}_0x59f39d[_0x2f70('0x19')](_0xff997a)[_0x2f70('0x28')](_0x3d252a);};}exports[_0x2f70('0x29')]=function(_0x26028c,_0x2a418f){var _0x40876d={},_0x2aeb27={},_0x1f7d13={'count':0x0,'rows':[]};var _0x20fcbf=_[_0x2f70('0x2a')](db['VoiceTransferReport'][_0x2f70('0x2b')],function(_0x62be4d){return{'name':_0x62be4d['fieldName'],'type':_0x62be4d['type'][_0x2f70('0x2c')]};});_0x2aeb27[_0x2f70('0x2d')]=_[_0x2f70('0x2a')](_0x20fcbf,_0x2f70('0x27'));_0x2aeb27[_0x2f70('0x2e')]=_[_0x2f70('0x2f')](_0x26028c[_0x2f70('0x2e')]);_0x2aeb27['filters']=_[_0x2f70('0x30')](_0x2aeb27[_0x2f70('0x2d')],_0x2aeb27[_0x2f70('0x2e')]);_0x40876d[_0x2f70('0x31')]=_[_0x2f70('0x30')](_0x2aeb27[_0x2f70('0x2d')],qs[_0x2f70('0x32')](_0x26028c['query'][_0x2f70('0x32')]));_0x40876d[_0x2f70('0x31')]=_0x40876d['attributes'][_0x2f70('0x33')]?_0x40876d[_0x2f70('0x31')]:_0x2aeb27['model'];if(!_0x26028c[_0x2f70('0x2e')][_0x2f70('0x34')](_0x2f70('0x35'))){_0x40876d[_0x2f70('0x1c')]=qs[_0x2f70('0x1c')](_0x26028c['query'][_0x2f70('0x1c')]);_0x40876d[_0x2f70('0x1e')]=qs['offset'](_0x26028c['query'][_0x2f70('0x1e')]);}_0x40876d['order']=qs['sort'](_0x26028c[_0x2f70('0x2e')][_0x2f70('0x36')]);_0x40876d['where']=qs[_0x2f70('0x37')](_['pick'](_0x26028c[_0x2f70('0x2e')],_0x2aeb27[_0x2f70('0x37')]),_0x20fcbf);if(_0x26028c['query'][_0x2f70('0x38')]){_0x40876d['where']=_[_0x2f70('0x39')](_0x40876d['where'],{'$or':_[_0x2f70('0x2a')](_0x20fcbf,function(_0x53d1e3){if(_0x53d1e3[_0x2f70('0x3a')]!==_0x2f70('0x3b')){var _0x3b5ce9={};_0x3b5ce9[_0x53d1e3[_0x2f70('0x27')]]={'$like':'%'+_0x26028c[_0x2f70('0x2e')][_0x2f70('0x38')]+'%'};return _0x3b5ce9;}})});}_0x40876d=_[_0x2f70('0x39')]({},_0x40876d,_0x26028c['options']);var _0x811c60={'where':_0x40876d[_0x2f70('0x3c')]};return db['VoiceTransferReport'][_0x2f70('0x1d')](_0x811c60)['then'](function(_0x379a69){_0x1f7d13[_0x2f70('0x1d')]=_0x379a69;if(_0x26028c['query'][_0x2f70('0x3d')]){_0x40876d['include']=[{'all':!![]}];}return db[_0x2f70('0x3e')][_0x2f70('0x3f')](_0x40876d);})[_0x2f70('0x24')](function(_0x35156e){_0x1f7d13[_0x2f70('0x40')]=_0x35156e;return _0x1f7d13;})['then'](respondWithFilteredResult(_0x2a418f,_0x40876d))['catch'](handleError(_0x2a418f,null));};exports['show']=function(_0x21d2e1,_0x19935b){var _0x185325={'raw':!![],'where':{'id':_0x21d2e1['params']['id']}},_0x5441b1={};_0x5441b1[_0x2f70('0x2d')]=_[_0x2f70('0x2f')](db['VoiceTransferReport'][_0x2f70('0x2b')]);_0x5441b1[_0x2f70('0x2e')]=_[_0x2f70('0x2f')](_0x21d2e1[_0x2f70('0x2e')]);_0x5441b1[_0x2f70('0x37')]=_['intersection'](_0x5441b1[_0x2f70('0x2d')],_0x5441b1[_0x2f70('0x2e')]);_0x185325[_0x2f70('0x31')]=_[_0x2f70('0x30')](_0x5441b1['model'],qs[_0x2f70('0x32')](_0x21d2e1[_0x2f70('0x2e')][_0x2f70('0x32')]));_0x185325['attributes']=_0x185325[_0x2f70('0x31')][_0x2f70('0x33')]?_0x185325[_0x2f70('0x31')]:_0x5441b1['model'];if(_0x21d2e1['query'][_0x2f70('0x3d')]){_0x185325['include']=[{'all':!![]}];}_0x185325=_['merge']({},_0x185325,_0x21d2e1[_0x2f70('0x41')]);return db[_0x2f70('0x3e')]['find'](_0x185325)['then'](handleEntityNotFound(_0x19935b,null))[_0x2f70('0x24')](respondWithResult(_0x19935b,null))[_0x2f70('0x42')](handleError(_0x19935b,null));};exports['create']=function(_0x1f42d1,_0x161796){return db['VoiceTransferReport'][_0x2f70('0x43')](_0x1f42d1[_0x2f70('0x44')],{})[_0x2f70('0x24')](respondWithResult(_0x161796,0xc9))[_0x2f70('0x42')](handleError(_0x161796,null));};exports[_0x2f70('0x45')]=function(_0x5a00bf,_0x162cbb){if(_0x5a00bf[_0x2f70('0x44')]['id']){delete _0x5a00bf['body']['id'];}return db[_0x2f70('0x3e')][_0x2f70('0x46')]({'where':{'id':_0x5a00bf[_0x2f70('0x47')]['id']}})['then'](handleEntityNotFound(_0x162cbb,null))['then'](saveUpdates(_0x5a00bf[_0x2f70('0x44')],null))[_0x2f70('0x24')](respondWithResult(_0x162cbb,null))[_0x2f70('0x42')](handleError(_0x162cbb,null));};exports['destroy']=function(_0x36e4eb,_0x5cde39){return db['VoiceTransferReport'][_0x2f70('0x46')]({'where':{'id':_0x36e4eb[_0x2f70('0x47')]['id']}})['then'](handleEntityNotFound(_0x5cde39,null))[_0x2f70('0x24')](removeEntity(_0x5cde39,null))['catch'](handleError(_0x5cde39,null));};exports['describe']=function(_0xbd301e,_0x1cbcd5){return db[_0x2f70('0x3e')][_0x2f70('0x48')]()[_0x2f70('0x24')](respondWithResult(_0x1cbcd5,null))[_0x2f70('0x42')](handleError(_0x1cbcd5,null));}; \ No newline at end of file +var _0x38cc=['order','where','filter','merge','options','includeAll','include','findAll','rows','catch','rawAttributes','create','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','VoiceTransferReport','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x38cc,0x187));var _0xc38c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x38cc[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0xc38c('0x0'));var rimraf=require(_0xc38c('0x1'));var zipdir=require(_0xc38c('0x2'));var jsonpatch=require(_0xc38c('0x3'));var rp=require(_0xc38c('0x4'));var moment=require('moment');var BPromise=require(_0xc38c('0x5'));var Mustache=require(_0xc38c('0x6'));var util=require(_0xc38c('0x7'));var path=require('path');var sox=require(_0xc38c('0x8'));var csv=require(_0xc38c('0x9'));var ejs=require(_0xc38c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc38c('0xb'));var squel=require(_0xc38c('0xc'));var crypto=require(_0xc38c('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xc38c('0xe'));var toCsv=require('to-csv');var querystring=require(_0xc38c('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc38c('0x10'));var qs=require(_0xc38c('0x11'));var as=require(_0xc38c('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc38c('0x13'))(_0xc38c('0x14'));var utils=require(_0xc38c('0x15'));var config=require(_0xc38c('0x16'));var licenseUtil=require(_0xc38c('0x17'));var db=require(_0xc38c('0x18'))['db'];function respondWithStatusCode(_0x2fd951,_0x21ce3b){_0x21ce3b=_0x21ce3b||0xcc;return function(_0x1205e2){if(_0x1205e2){return _0x2fd951[_0xc38c('0x19')](_0x21ce3b);}return _0x2fd951[_0xc38c('0x1a')](_0x21ce3b)['end']();};}function respondWithResult(_0x2ea9cd,_0x2fd839){_0x2fd839=_0x2fd839||0xc8;return function(_0x57a0ee){if(_0x57a0ee){return _0x2ea9cd[_0xc38c('0x1a')](_0x2fd839)[_0xc38c('0x1b')](_0x57a0ee);}};}function respondWithFilteredResult(_0x520e16,_0x3b2113){return function(_0x135037){if(_0x135037){var _0x42d2a0=typeof _0x3b2113['offset']==='undefined'&&typeof _0x3b2113[_0xc38c('0x1c')]==='undefined';var _0x5bc5b8=_0x135037['count'];var _0x139fe9=_0x42d2a0?0x0:_0x3b2113[_0xc38c('0x1d')];var _0xac4f03=_0x42d2a0?_0x135037[_0xc38c('0x1e')]:_0x3b2113[_0xc38c('0x1d')]+_0x3b2113['limit'];var _0x147e17;if(_0xac4f03>=_0x5bc5b8){_0xac4f03=_0x5bc5b8;_0x147e17=0xc8;}else{_0x147e17=0xce;}_0x520e16[_0xc38c('0x1a')](_0x147e17);return _0x520e16[_0xc38c('0x1f')](_0xc38c('0x20'),_0x139fe9+'-'+_0xac4f03+'/'+_0x5bc5b8)['json'](_0x135037);}return null;};}function patchUpdates(_0x250869){return function(_0x3eb570){try{jsonpatch[_0xc38c('0x21')](_0x3eb570,_0x250869,!![]);}catch(_0x44ce49){return BPromise[_0xc38c('0x22')](_0x44ce49);}return _0x3eb570[_0xc38c('0x23')]();};}function saveUpdates(_0x224b35,_0x1a1658){return function(_0x3846b0){if(_0x3846b0){return _0x3846b0[_0xc38c('0x24')](_0x224b35)[_0xc38c('0x25')](function(_0x3c08c1){return _0x3c08c1;});}return null;};}function removeEntity(_0x34773a,_0x9e14e6){return function(_0x4e3c97){if(_0x4e3c97){return _0x4e3c97[_0xc38c('0x26')]()[_0xc38c('0x25')](function(){_0x34773a[_0xc38c('0x1a')](0xcc)[_0xc38c('0x27')]();});}};}function handleEntityNotFound(_0x460753,_0x5428b2){return function(_0x42b988){if(!_0x42b988){_0x460753[_0xc38c('0x19')](0x194);}return _0x42b988;};}function handleError(_0x58e63a,_0x519203){_0x519203=_0x519203||0x1f4;return function(_0x934edd){logger[_0xc38c('0x28')](_0x934edd[_0xc38c('0x29')]);if(_0x934edd[_0xc38c('0x2a')]){delete _0x934edd[_0xc38c('0x2a')];}_0x58e63a[_0xc38c('0x1a')](_0x519203)[_0xc38c('0x2b')](_0x934edd);};}exports[_0xc38c('0x2c')]=function(_0x4b7a52,_0x25358d){var _0xf1e7d={},_0x1879f4={},_0x1a8857={'count':0x0,'rows':[]};var _0x299e38=_[_0xc38c('0x2d')](db[_0xc38c('0x2e')]['rawAttributes'],function(_0x444c46){return{'name':_0x444c46[_0xc38c('0x2f')],'type':_0x444c46['type'][_0xc38c('0x30')]};});_0x1879f4[_0xc38c('0x31')]=_[_0xc38c('0x2d')](_0x299e38,_0xc38c('0x2a'));_0x1879f4[_0xc38c('0x32')]=_[_0xc38c('0x33')](_0x4b7a52[_0xc38c('0x32')]);_0x1879f4[_0xc38c('0x34')]=_['intersection'](_0x1879f4[_0xc38c('0x31')],_0x1879f4[_0xc38c('0x32')]);_0xf1e7d['attributes']=_[_0xc38c('0x35')](_0x1879f4[_0xc38c('0x31')],qs['fields'](_0x4b7a52[_0xc38c('0x32')][_0xc38c('0x36')]));_0xf1e7d[_0xc38c('0x37')]=_0xf1e7d['attributes'][_0xc38c('0x38')]?_0xf1e7d[_0xc38c('0x37')]:_0x1879f4[_0xc38c('0x31')];if(!_0x4b7a52[_0xc38c('0x32')][_0xc38c('0x39')](_0xc38c('0x3a'))){_0xf1e7d[_0xc38c('0x1c')]=qs[_0xc38c('0x1c')](_0x4b7a52[_0xc38c('0x32')]['limit']);_0xf1e7d['offset']=qs[_0xc38c('0x1d')](_0x4b7a52[_0xc38c('0x32')][_0xc38c('0x1d')]);}_0xf1e7d[_0xc38c('0x3b')]=qs['sort'](_0x4b7a52['query']['sort']);_0xf1e7d[_0xc38c('0x3c')]=qs['filters'](_['pick'](_0x4b7a52[_0xc38c('0x32')],_0x1879f4['filters']),_0x299e38);if(_0x4b7a52[_0xc38c('0x32')][_0xc38c('0x3d')]){_0xf1e7d['where']=_[_0xc38c('0x3e')](_0xf1e7d[_0xc38c('0x3c')],{'$or':_[_0xc38c('0x2d')](_0x299e38,function(_0x461d70){if(_0x461d70['type']!=='VIRTUAL'){var _0x2ae55c={};_0x2ae55c[_0x461d70[_0xc38c('0x2a')]]={'$like':'%'+_0x4b7a52[_0xc38c('0x32')]['filter']+'%'};return _0x2ae55c;}})});}_0xf1e7d=_[_0xc38c('0x3e')]({},_0xf1e7d,_0x4b7a52[_0xc38c('0x3f')]);var _0x203a6b={'where':_0xf1e7d[_0xc38c('0x3c')]};return db['VoiceTransferReport'][_0xc38c('0x1e')](_0x203a6b)[_0xc38c('0x25')](function(_0x35dcb2){_0x1a8857[_0xc38c('0x1e')]=_0x35dcb2;if(_0x4b7a52[_0xc38c('0x32')][_0xc38c('0x40')]){_0xf1e7d[_0xc38c('0x41')]=[{'all':!![]}];}return db[_0xc38c('0x2e')][_0xc38c('0x42')](_0xf1e7d);})[_0xc38c('0x25')](function(_0x31a3f4){_0x1a8857[_0xc38c('0x43')]=_0x31a3f4;return _0x1a8857;})[_0xc38c('0x25')](respondWithFilteredResult(_0x25358d,_0xf1e7d))[_0xc38c('0x44')](handleError(_0x25358d,null));};exports['show']=function(_0x2e561f,_0x26f827){var _0x1f35c5={'raw':!![],'where':{'id':_0x2e561f['params']['id']}},_0x490d48={};_0x490d48[_0xc38c('0x31')]=_['keys'](db[_0xc38c('0x2e')][_0xc38c('0x45')]);_0x490d48['query']=_[_0xc38c('0x33')](_0x2e561f[_0xc38c('0x32')]);_0x490d48[_0xc38c('0x34')]=_['intersection'](_0x490d48[_0xc38c('0x31')],_0x490d48[_0xc38c('0x32')]);_0x1f35c5[_0xc38c('0x37')]=_['intersection'](_0x490d48[_0xc38c('0x31')],qs[_0xc38c('0x36')](_0x2e561f[_0xc38c('0x32')][_0xc38c('0x36')]));_0x1f35c5['attributes']=_0x1f35c5['attributes'][_0xc38c('0x38')]?_0x1f35c5[_0xc38c('0x37')]:_0x490d48[_0xc38c('0x31')];if(_0x2e561f[_0xc38c('0x32')]['includeAll']){_0x1f35c5['include']=[{'all':!![]}];}_0x1f35c5=_[_0xc38c('0x3e')]({},_0x1f35c5,_0x2e561f[_0xc38c('0x3f')]);return db[_0xc38c('0x2e')]['find'](_0x1f35c5)[_0xc38c('0x25')](handleEntityNotFound(_0x26f827,null))['then'](respondWithResult(_0x26f827,null))['catch'](handleError(_0x26f827,null));};exports['create']=function(_0x2918ef,_0x1cb41b){return db['VoiceTransferReport'][_0xc38c('0x46')](_0x2918ef[_0xc38c('0x47')],{})[_0xc38c('0x25')](respondWithResult(_0x1cb41b,0xc9))[_0xc38c('0x44')](handleError(_0x1cb41b,null));};exports['update']=function(_0x1880be,_0x3bdd4c){if(_0x1880be['body']['id']){delete _0x1880be['body']['id'];}return db[_0xc38c('0x2e')][_0xc38c('0x48')]({'where':{'id':_0x1880be[_0xc38c('0x49')]['id']}})[_0xc38c('0x25')](handleEntityNotFound(_0x3bdd4c,null))[_0xc38c('0x25')](saveUpdates(_0x1880be[_0xc38c('0x47')],null))['then'](respondWithResult(_0x3bdd4c,null))['catch'](handleError(_0x3bdd4c,null));};exports['destroy']=function(_0x53b45e,_0x1de731){return db[_0xc38c('0x2e')][_0xc38c('0x48')]({'where':{'id':_0x53b45e[_0xc38c('0x49')]['id']}})['then'](handleEntityNotFound(_0x1de731,null))[_0xc38c('0x25')](removeEntity(_0x1de731,null))[_0xc38c('0x44')](handleError(_0x1de731,null));};exports[_0xc38c('0x4a')]=function(_0xe0ac0a,_0xa69f87){return db['VoiceTransferReport'][_0xc38c('0x4a')]()[_0xc38c('0x25')](respondWithResult(_0xa69f87,null))['catch'](handleError(_0xa69f87,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 083b379..c5c268e 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 _0x2b01=['api','bluebird','rimraf','../../config/environment','./voiceTransferReport.attributes','exports','define','report_call_transfer','lodash','util','../../config/logger'];(function(_0x4a647a,_0x12cb35){var _0x1d49a7=function(_0x5a2a49){while(--_0x5a2a49){_0x4a647a['push'](_0x4a647a['shift']());}};_0x1d49a7(++_0x12cb35);}(_0x2b01,0x1e1));var _0x12b0=function(_0x429a9f,_0x29981a){_0x429a9f=_0x429a9f-0x0;var _0x59aed4=_0x2b01[_0x429a9f];return _0x59aed4;};'use strict';var _=require(_0x12b0('0x0'));var util=require(_0x12b0('0x1'));var logger=require(_0x12b0('0x2'))(_0x12b0('0x3'));var moment=require('moment');var BPromise=require(_0x12b0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x12b0('0x5'));var config=require(_0x12b0('0x6'));var attributes=require(_0x12b0('0x7'));module[_0x12b0('0x8')]=function(_0x59895d,_0x1c1b73){return _0x59895d[_0x12b0('0x9')]('VoiceTransferReport',attributes,{'tableName':_0x12b0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7fb2=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer','lodash','util'];(function(_0x94fbaf,_0x9a727d){var _0x40fdba=function(_0x22bd52){while(--_0x22bd52){_0x94fbaf['push'](_0x94fbaf['shift']());}};_0x40fdba(++_0x9a727d);}(_0x7fb2,0x15c));var _0x27fb=function(_0x445fd6,_0x44e6e7){_0x445fd6=_0x445fd6-0x0;var _0x4cc76c=_0x7fb2[_0x445fd6];return _0x4cc76c;};'use strict';var _=require(_0x27fb('0x0'));var util=require(_0x27fb('0x1'));var logger=require(_0x27fb('0x2'))(_0x27fb('0x3'));var moment=require('moment');var BPromise=require(_0x27fb('0x4'));var rp=require(_0x27fb('0x5'));var fs=require('fs');var path=require(_0x27fb('0x6'));var rimraf=require(_0x27fb('0x7'));var config=require(_0x27fb('0x8'));var attributes=require(_0x27fb('0x9'));module[_0x27fb('0xa')]=function(_0x48397d,_0x5002af){return _0x48397d[_0x27fb('0xb')](_0x27fb('0xc'),attributes,{'tableName':_0x27fb('0xd'),'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 e510913..5e670f1 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 _0x8459=['body','options','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','CreateVoiceTransferReport','VoiceTransferReport','create'];(function(_0x174bfa,_0x11e35d){var _0x4a5337=function(_0x4f22d8){while(--_0x4f22d8){_0x174bfa['push'](_0x174bfa['shift']());}};_0x4a5337(++_0x11e35d);}(_0x8459,0x89));var _0x9845=function(_0x3f05ce,_0x363031){_0x3f05ce=_0x3f05ce-0x0;var _0x43cc58=_0x8459[_0x3f05ce];return _0x43cc58;};'use strict';var _=require(_0x9845('0x0'));var util=require(_0x9845('0x1'));var moment=require(_0x9845('0x2'));var BPromise=require(_0x9845('0x3'));var rs=require(_0x9845('0x4'));var fs=require('fs');var Redis=require(_0x9845('0x5'));var db=require(_0x9845('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9845('0x7'));var config=require('../../config/environment');var jayson=require(_0x9845('0x8'));var client=jayson[_0x9845('0x9')][_0x9845('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5e874a,_0x4ae9bf,_0x4e9039){return new BPromise(function(_0x2600ee,_0x4ae260){return client[_0x9845('0xb')](_0x5e874a,_0x4e9039)[_0x9845('0xc')](function(_0x29a0e1){logger[_0x9845('0xd')](_0x9845('0xe'),_0x4ae9bf,_0x9845('0xf'));logger[_0x9845('0x10')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x4ae9bf,_0x9845('0xf'),JSON[_0x9845('0x11')](_0x29a0e1));if(_0x29a0e1['error']){if(_0x29a0e1[_0x9845('0x12')]['code']===0x1f4){logger[_0x9845('0x12')](_0x9845('0xe'),_0x4ae9bf,_0x29a0e1[_0x9845('0x12')][_0x9845('0x13')]);return _0x4ae260(_0x29a0e1['error'][_0x9845('0x13')]);}logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x4ae9bf,_0x29a0e1[_0x9845('0x12')][_0x9845('0x13')]);return _0x2600ee(_0x29a0e1[_0x9845('0x12')][_0x9845('0x13')]);}else{logger[_0x9845('0xd')](_0x9845('0xe'),_0x4ae9bf,'request\x20sent');_0x2600ee(_0x29a0e1[_0x9845('0x14')]['message']);}})[_0x9845('0x15')](function(_0x45daee){logger[_0x9845('0x12')]('VoiceTransferReport,\x20%s,\x20%s',_0x4ae9bf,_0x45daee);_0x4ae260(_0x45daee);});});}exports[_0x9845('0x16')]=function(_0x3611b1){var _0x17386b=this;return new Promise(function(_0x132201,_0x258962){return db[_0x9845('0x17')][_0x9845('0x18')](_0x3611b1[_0x9845('0x19')],{'raw':_0x3611b1[_0x9845('0x1a')]?_0x3611b1[_0x9845('0x1a')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x3ae511){logger['info'](_0x9845('0x16'),_0x3611b1);logger['debug'](_0x9845('0x16'),_0x3611b1,JSON[_0x9845('0x11')](_0x3ae511));_0x132201(_0x3ae511);})[_0x9845('0x15')](function(_0x32bfae){logger[_0x9845('0x12')](_0x9845('0x16'),_0x32bfae[_0x9845('0x13')],_0x3611b1);_0x258962(_0x17386b[_0x9845('0x12')](0x1f4,_0x32bfae['message']));});});}; \ No newline at end of file +var _0x530a=['debug','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','error','message','result','CreateVoiceTransferReport','create','body','options','raw'];(function(_0x361a4d,_0x106561){var _0x4a7c9d=function(_0x596788){while(--_0x596788){_0x361a4d['push'](_0x361a4d['shift']());}};_0x4a7c9d(++_0x106561);}(_0x530a,0x1bc));var _0xa530=function(_0x11847f,_0x1b0392){_0x11847f=_0x11847f-0x0;var _0x287d42=_0x530a[_0x11847f];return _0x287d42;};'use strict';var _=require(_0xa530('0x0'));var util=require(_0xa530('0x1'));var moment=require('moment');var BPromise=require(_0xa530('0x2'));var rs=require(_0xa530('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa530('0x4'))['db'];var utils=require(_0xa530('0x5'));var logger=require(_0xa530('0x6'))(_0xa530('0x7'));var config=require('../../config/environment');var jayson=require(_0xa530('0x8'));var client=jayson[_0xa530('0x9')][_0xa530('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x404c38,_0x206424,_0x5638ad){return new BPromise(function(_0x5ce64c,_0x40c594){return client[_0xa530('0xb')](_0x404c38,_0x5638ad)[_0xa530('0xc')](function(_0xd3fe19){logger[_0xa530('0xd')](_0xa530('0xe'),_0x206424,_0xa530('0xf'));logger['debug']('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x206424,_0xa530('0xf'),JSON['stringify'](_0xd3fe19));if(_0xd3fe19[_0xa530('0x10')]){if(_0xd3fe19[_0xa530('0x10')]['code']===0x1f4){logger[_0xa530('0x10')](_0xa530('0xe'),_0x206424,_0xd3fe19['error'][_0xa530('0x11')]);return _0x40c594(_0xd3fe19['error'][_0xa530('0x11')]);}logger['error'](_0xa530('0xe'),_0x206424,_0xd3fe19[_0xa530('0x10')]['message']);return _0x5ce64c(_0xd3fe19[_0xa530('0x10')][_0xa530('0x11')]);}else{logger[_0xa530('0xd')](_0xa530('0xe'),_0x206424,_0xa530('0xf'));_0x5ce64c(_0xd3fe19[_0xa530('0x12')][_0xa530('0x11')]);}})['catch'](function(_0x377dfa){logger[_0xa530('0x10')](_0xa530('0xe'),_0x206424,_0x377dfa);_0x40c594(_0x377dfa);});});}exports[_0xa530('0x13')]=function(_0x423f14){var _0x1bf6b5=this;return new Promise(function(_0x579c0d,_0x141b0a){return db['VoiceTransferReport'][_0xa530('0x14')](_0x423f14[_0xa530('0x15')],{'raw':_0x423f14['options']?_0x423f14[_0xa530('0x16')][_0xa530('0x17')]===undefined?!![]:![]:!![]})[_0xa530('0xc')](function(_0x390433){logger[_0xa530('0xd')]('CreateVoiceTransferReport',_0x423f14);logger[_0xa530('0x18')](_0xa530('0x13'),_0x423f14,JSON['stringify'](_0x390433));_0x579c0d(_0x390433);})[_0xa530('0x19')](function(_0x4de36b){logger['error'](_0xa530('0x13'),_0x4de36b[_0xa530('0x11')],_0x423f14);_0x141b0a(_0x1bf6b5[_0xa530('0x10')](0x1f4,_0x4de36b['message']));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index ff52891..50e1502 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 _0x91a7=['/originate','isWebrtcLicence','/hangup','isAuthenticated','hangup','/answer','answer','post','/hold','/unhold','unhold','/calls','/transfer','transfer','exports','Router','../../components/auth/service','./webbar.controller'];(function(_0x325539,_0x36ad8f){var _0x47401d=function(_0x7ed46c){while(--_0x7ed46c){_0x325539['push'](_0x325539['shift']());}};_0x47401d(++_0x36ad8f);}(_0x91a7,0xe7));var _0x791a=function(_0x2d5d58,_0x233eb5){_0x2d5d58=_0x2d5d58-0x0;var _0x11f034=_0x91a7[_0x2d5d58];return _0x11f034;};'use strict';var express=require('express');var router=express[_0x791a('0x0')]();var auth=require(_0x791a('0x1'));var controller=require(_0x791a('0x2'));router['post'](_0x791a('0x3'),auth['isAuthenticated'](),auth[_0x791a('0x4')](),controller['originate']);router['post'](_0x791a('0x5'),auth[_0x791a('0x6')](),auth['isWebrtcLicence'](),controller[_0x791a('0x7')]);router['post'](_0x791a('0x8'),auth[_0x791a('0x6')](),auth['isWebrtcLicence'](),controller[_0x791a('0x9')]);router[_0x791a('0xa')](_0x791a('0xb'),auth[_0x791a('0x6')](),auth[_0x791a('0x4')](),controller['hold']);router[_0x791a('0xa')](_0x791a('0xc'),auth['isAuthenticated'](),auth[_0x791a('0x4')](),controller[_0x791a('0xd')]);router[_0x791a('0xa')](_0x791a('0xe'),auth[_0x791a('0x6')](),auth[_0x791a('0x4')](),controller['calls']);router['post'](_0x791a('0xf'),auth[_0x791a('0x6')](),auth['isWebrtcLicence'](),controller[_0x791a('0x10')]);module[_0x791a('0x11')]=router; \ No newline at end of file +var _0xe706=['/transfer','express','Router','../../components/auth/service','post','/originate','isAuthenticated','isWebrtcLicence','originate','/hangup','hangup','/answer','answer','/hold','hold','/unhold','/calls','calls'];(function(_0x53ed54,_0xf59959){var _0x1a0d12=function(_0xe88a77){while(--_0xe88a77){_0x53ed54['push'](_0x53ed54['shift']());}};_0x1a0d12(++_0xf59959);}(_0xe706,0xa3));var _0x6e70=function(_0x52711f,_0x4cf48b){_0x52711f=_0x52711f-0x0;var _0x736442=_0xe706[_0x52711f];return _0x736442;};'use strict';var express=require(_0x6e70('0x0'));var router=express[_0x6e70('0x1')]();var auth=require(_0x6e70('0x2'));var controller=require('./webbar.controller');router[_0x6e70('0x3')](_0x6e70('0x4'),auth[_0x6e70('0x5')](),auth[_0x6e70('0x6')](),controller[_0x6e70('0x7')]);router[_0x6e70('0x3')](_0x6e70('0x8'),auth[_0x6e70('0x5')](),auth[_0x6e70('0x6')](),controller[_0x6e70('0x9')]);router[_0x6e70('0x3')](_0x6e70('0xa'),auth[_0x6e70('0x5')](),auth[_0x6e70('0x6')](),controller[_0x6e70('0xb')]);router[_0x6e70('0x3')](_0x6e70('0xc'),auth[_0x6e70('0x5')](),auth[_0x6e70('0x6')](),controller[_0x6e70('0xd')]);router[_0x6e70('0x3')](_0x6e70('0xe'),auth[_0x6e70('0x5')](),auth[_0x6e70('0x6')](),controller['unhold']);router['post'](_0x6e70('0xf'),auth[_0x6e70('0x5')](),auth[_0x6e70('0x6')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x3')](_0x6e70('0x11'),auth[_0x6e70('0x5')](),auth[_0x6e70('0x6')](),controller['transfer']);module['exports']=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index a0a5c9e..5b8e9aa 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 _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(_0x5c3c0b,_0x4ee35e){var _0x52ecd2=function(_0x3cf575){while(--_0x3cf575){_0x5c3c0b['push'](_0x5c3c0b['shift']());}};_0x52ecd2(++_0x4ee35e);}(_0xd3d1,0x172));var _0x1d3d=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xd3d1[_0x502c7d];return _0x30b7ed;};'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 +var _0x9649=['error','name','status','send','NotFound','then','code','message','catch','User','findOne','VoiceChannels','all','filter','length','sessionId\x20','\x20not\x20found!','originate','info','originate\x20fired:','body','json','callerId','callbackUrl','user:%s','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','sessionId','entityFound:','format','webbar:hangup','hangup\x20executed!','answer\x20fired:','userId','webbar:answer','answer\x20executed!','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','calls','calls\x20fired:','rows','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','path','lodash','../../mysqldb','../../config/environment','bluebird','jayson/promise','http','webbarapi','ioredis','redis','defaults','localhost','socket.io-emitter','validate','number','string','callNumber\x20is\x20required','userId\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','stringify','emit','handleError:'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9649,0x19f));var _0x9964=function(_0x34092c,_0x450b06){_0x34092c=_0x34092c-0x0;var _0x5017e6=_0x9649[_0x34092c];return _0x5017e6;};'use strict';var path=require(_0x9964('0x0'));var fs=require('fs');var _=require(_0x9964('0x1'));var db=require(_0x9964('0x2'))['db'];var config=require(_0x9964('0x3'));var util=require('util');var BPromise=require(_0x9964('0x4'));var jayson=require(_0x9964('0x5'));var amiClient=jayson['client'][_0x9964('0x6')]({'port':0x232a});var logger=require('../../config/logger')(_0x9964('0x7'));var Redis=require(_0x9964('0x8'));config[_0x9964('0x9')]=_[_0x9964('0xa')](config[_0x9964('0x9')],{'host':_0x9964('0xb'),'port':0x18eb});var io=require(_0x9964('0xc'))(new Redis(config['redis']));var Schema=require(_0x9964('0xd'));var originateValidation=new Schema({'userId':{'type':_0x9964('0xe'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0x9964('0xf'),'required':[!![],_0x9964('0x10')]},'callerId':{'type':'string'},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0x9964('0xe'),'required':[!![],_0x9964('0x11')]},'sessionId':{'type':_0x9964('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x9964('0xe'),'required':[!![],_0x9964('0x11')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0x9964('0xe'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x9964('0xf'),'required':[!![],_0x9964('0x12')]},'transferNumber':{'type':'string','required':[!![],_0x9964('0x13')]}});var holdValidation=new Schema({'userId':{'type':_0x9964('0xe'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x9964('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x9964('0xe'),'required':[!![],_0x9964('0x11')]},'sessionId':{'type':_0x9964('0xf'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x9964('0xe'),'required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':_0x9964('0xe'),'required':[!![],_0x9964('0x11')]}});function emit(_0x57b330,_0x2fd50d,_0x3fe796){logger['info'](_0x57b330,_0x2fd50d,JSON[_0x9964('0x14')](_0x3fe796));io['to'](_0x57b330)[_0x9964('0x15')](_0x2fd50d,_0x3fe796);}function handleError(_0x69994d){return function(_0x4c18a4){console['log'](_0x9964('0x16'),_0x4c18a4,_0x4c18a4 instanceof RangeError);logger[_0x9964('0x17')](_0x4c18a4['stack']);if(_0x4c18a4 instanceof RangeError){if(_0x4c18a4[_0x9964('0x18')]){delete _0x4c18a4[_0x9964('0x18')];}_0x69994d[_0x9964('0x19')](0x194)[_0x9964('0x1a')](_0x4c18a4);}else{if(_0x4c18a4[_0x9964('0x18')]){delete _0x4c18a4[_0x9964('0x18')];}_0x69994d[_0x9964('0x19')](0x1f4)[_0x9964('0x1a')](_0x4c18a4);}};}function checkError(){return function(_0x1072b5){if(!_0x1072b5){throw new RangeError(_0x9964('0x1b'));}return _0x1072b5;};}function respondWithRpcPromise(_0x4f625e,_0x455b62){return new BPromise(function(_0x447026,_0x4c479f){var _0x2b03a8=amiClient;return _0x2b03a8['request'](_0x4f625e,_0x455b62)[_0x9964('0x1c')](function(_0xdc3ba){if(_0xdc3ba[_0x9964('0x17')]){if(_0xdc3ba[_0x9964('0x17')][_0x9964('0x1d')]===0x1f4){return _0x4c479f(_0xdc3ba[_0x9964('0x17')]['message']);}return _0x447026(_0xdc3ba[_0x9964('0x17')][_0x9964('0x1e')]);}else{_0x447026(_0xdc3ba['result']);}})[_0x9964('0x1f')](function(_0x15a14c){_0x4c479f(_0x15a14c);});});}function getAgent(_0x196812){return db[_0x9964('0x20')][_0x9964('0x21')]({'where':{'id':_0x196812,'role':'agent'}})[_0x9964('0x1c')](checkError());}function getAgentCheckSession(_0x4c2b44,_0x44cb60){return new BPromise(function(_0x512f6b,_0x17b29f){var _0x5dc789=respondWithRpcPromise(_0x9964('0x22'));var _0x162b83=getAgent(_0x4c2b44);Promise[_0x9964('0x23')]([_0x5dc789,_0x162b83])[_0x9964('0x1c')](function(_0x11cdce){var _0x23df5e=_0x11cdce[0x0];var _0x146cf2=_0x11cdce[0x1];var _0x2f6068=_[_0x9964('0x24')](_0x23df5e['rows'],function(_0x498014){return _0x498014['UserId']==_0x146cf2['id']&&_0x498014['sessionId']==_0x44cb60;});if(_0x2f6068[_0x9964('0x25')]==0x1){_0x512f6b(_0x146cf2);}else{_0x17b29f(new RangeError(_0x9964('0x26')+_0x44cb60+_0x9964('0x27')));}});});}exports[_0x9964('0x28')]=function(_0x1a3698,_0x3092b2){logger[_0x9964('0x29')](_0x9964('0x2a'),_0x1a3698[_0x9964('0x2b')]);var _0x5e92a9=originateValidation[_0x9964('0xd')](_0x1a3698[_0x9964('0x2b')]);if(_0x5e92a9['length']>0x0){return _0x3092b2[_0x9964('0x19')](0x190)[_0x9964('0x2c')](_0x5e92a9);}var _0x3e5154=_0x1a3698[_0x9964('0x2b')]['userId'];var _0x55b7a0=_0x1a3698[_0x9964('0x2b')]['callNumber'];var _0x49b3c6=_0x1a3698[_0x9964('0x2b')][_0x9964('0x2d')];var _0x5d28d8=_0x1a3698['body'][_0x9964('0x2e')];return getAgent(_0x3e5154)[_0x9964('0x1c')](function(_0x4df44b){logger[_0x9964('0x29')]('entityFound:',_0x4df44b['name']);emit(util['format'](_0x9964('0x2f'),_0x4df44b[_0x9964('0x18')]),_0x9964('0x30'),{'callNumber':_0x55b7a0,'callerId':_0x49b3c6,'callbackUrl':_0x5d28d8});return _0x3092b2[_0x9964('0x19')](0xc8)[_0x9964('0x2c')]({'error':![],'message':_0x9964('0x31')});})[_0x9964('0x1f')](handleError(_0x3092b2));};exports[_0x9964('0x32')]=function(_0x131073,_0x526c96){logger[_0x9964('0x29')](_0x9964('0x33'),_0x131073[_0x9964('0x2b')]);var _0x132c7c=hangupValidation['validate'](_0x131073['body']);if(_0x132c7c[_0x9964('0x25')]>0x0){return _0x526c96[_0x9964('0x19')](0x190)[_0x9964('0x2c')](_0x132c7c);}var _0x1bad9d=_0x131073[_0x9964('0x2b')]['userId'];var _0x3aac69=_0x131073[_0x9964('0x2b')][_0x9964('0x34')];return getAgent(_0x1bad9d)[_0x9964('0x1c')](function(_0x24d5d9){logger[_0x9964('0x29')](_0x9964('0x35'),_0x24d5d9[_0x9964('0x18')]);emit(util[_0x9964('0x36')](_0x9964('0x2f'),_0x24d5d9[_0x9964('0x18')]),_0x9964('0x37'),{'sessionId':_0x3aac69});return _0x526c96[_0x9964('0x19')](0xc8)[_0x9964('0x2c')]({'error':![],'message':_0x9964('0x38')});})[_0x9964('0x1f')](handleError(_0x526c96));};exports['answer']=function(_0x344c6c,_0x4c5362){logger[_0x9964('0x29')](_0x9964('0x39'),_0x344c6c[_0x9964('0x2b')]);var _0x4c3d38=answerValidation[_0x9964('0xd')](_0x344c6c['body']);if(_0x4c3d38[_0x9964('0x25')]>0x0){return _0x4c5362['status'](0x190)[_0x9964('0x2c')](_0x4c3d38);}var _0x4ad7a6=_0x344c6c[_0x9964('0x2b')][_0x9964('0x3a')];var _0x121059=_0x344c6c[_0x9964('0x2b')][_0x9964('0x34')];return getAgent(_0x4ad7a6)[_0x9964('0x1c')](function(_0x516529){logger[_0x9964('0x29')](_0x9964('0x35'),_0x516529[_0x9964('0x18')]);emit(util[_0x9964('0x36')](_0x9964('0x2f'),_0x516529[_0x9964('0x18')]),_0x9964('0x3b'),{'sessionId':_0x121059});return _0x4c5362[_0x9964('0x19')](0xc8)[_0x9964('0x2c')]({'error':![],'message':_0x9964('0x3c')});})['catch'](handleError(_0x4c5362));};exports['hold']=function(_0x36e684,_0x5d52d8){logger[_0x9964('0x29')]('hold\x20fired:',_0x36e684['body']);var _0x5d8720=holdValidation[_0x9964('0xd')](_0x36e684[_0x9964('0x2b')]);if(_0x5d8720[_0x9964('0x25')]>0x0){return _0x5d52d8['status'](0x190)['json'](_0x5d8720);}var _0x652882=_0x36e684['body'][_0x9964('0x3a')];var _0x159eb7=_0x36e684[_0x9964('0x2b')][_0x9964('0x34')];return getAgent(_0x652882)[_0x9964('0x1c')](function(_0x5b0fa7){logger['info'](_0x9964('0x35'),_0x5b0fa7[_0x9964('0x18')]);emit(util[_0x9964('0x36')](_0x9964('0x2f'),_0x5b0fa7[_0x9964('0x18')]),'webbar:hold',{'sessionId':_0x159eb7});return _0x5d52d8[_0x9964('0x19')](0xc8)[_0x9964('0x2c')]({'error':![],'message':_0x9964('0x3d')});})['catch'](handleError(_0x5d52d8));};exports[_0x9964('0x3e')]=function(_0x2649cc,_0x474631){logger[_0x9964('0x29')](_0x9964('0x3f'),_0x2649cc[_0x9964('0x2b')]);var _0x1a5344=unholdValidation[_0x9964('0xd')](_0x2649cc['body']);if(_0x1a5344[_0x9964('0x25')]>0x0){return _0x474631['status'](0x190)['json'](_0x1a5344);}var _0x160316=_0x2649cc['body'][_0x9964('0x3a')];var _0x45ca09=_0x2649cc[_0x9964('0x2b')]['sessionId'];return getAgent(_0x160316)[_0x9964('0x1c')](function(_0x187004){logger[_0x9964('0x29')](_0x9964('0x35'),_0x187004[_0x9964('0x18')]);emit(util[_0x9964('0x36')](_0x9964('0x2f'),_0x187004[_0x9964('0x18')]),_0x9964('0x40'),{'sessionId':_0x45ca09});return _0x474631['status'](0xc8)[_0x9964('0x2c')]({'error':![],'message':'unhold\x20executed!'});})[_0x9964('0x1f')](handleError(_0x474631));};exports[_0x9964('0x41')]=function(_0x216a88,_0x4f10fd){logger[_0x9964('0x29')](_0x9964('0x42'),_0x4f10fd[_0x9964('0x2b')]);var _0x375ad6=callsValidation[_0x9964('0xd')](_0x216a88['body']);if(_0x375ad6[_0x9964('0x25')]>0x0){return _0x4f10fd[_0x9964('0x19')](0x190)[_0x9964('0x2c')](_0x375ad6);}var _0xde3842=_0x216a88[_0x9964('0x2b')]['userId'];var _0x5a0ece=respondWithRpcPromise('VoiceChannels');var _0x5a57d2=getAgent(_0xde3842);return Promise[_0x9964('0x23')]([_0x5a0ece,_0x5a57d2])['then'](function(_0x5133fc){var _0x5b8892=_0x5133fc[0x0];var _0x275535=_0x5133fc[0x1];var _0x498c8f=_[_0x9964('0x24')](_0x5b8892[_0x9964('0x43')],function(_0x464ab1){return _0x464ab1['UserId']==_0x275535['id'];});return _0x4f10fd[_0x9964('0x19')](0xc8)['json']({'count':_0x498c8f['length'],'rows':_0x498c8f});})[_0x9964('0x1f')](handleError(_0x4f10fd));};exports[_0x9964('0x44')]=function(_0x2ffa8e,_0x4f039e){logger[_0x9964('0x29')](_0x9964('0x45'),_0x2ffa8e[_0x9964('0x2b')]);var _0x5af75e=conferenceValidation[_0x9964('0xd')](_0x2ffa8e[_0x9964('0x2b')]);if(_0x5af75e[_0x9964('0x25')]>0x0){return _0x4f039e['status'](0x190)['json'](_0x5af75e);}var _0x234607=_0x2ffa8e[_0x9964('0x2b')][_0x9964('0x3a')];return getAgent(_0x234607)[_0x9964('0x1c')](function(_0x3001d7){logger[_0x9964('0x29')](_0x9964('0x35'),_0x3001d7[_0x9964('0x18')]);emit(util[_0x9964('0x36')](_0x9964('0x2f'),_0x3001d7[_0x9964('0x18')]),_0x9964('0x46'));return _0x4f039e[_0x9964('0x19')](0xc8)[_0x9964('0x2c')]({'error':![],'message':_0x9964('0x47')});})['catch'](handleError(_0x4f039e));};exports[_0x9964('0x48')]=function(_0x37aa3c,_0x2e2b33){logger[_0x9964('0x29')]('transfer\x20fired:',_0x37aa3c['body']);var _0x58fb4f=transferValidation['validate'](_0x37aa3c['body']);if(_0x58fb4f[_0x9964('0x25')]>0x0){return _0x2e2b33[_0x9964('0x19')](0x190)['json'](_0x58fb4f);}var _0x249fa7=_0x37aa3c[_0x9964('0x2b')][_0x9964('0x3a')];var _0x19608a=_0x37aa3c[_0x9964('0x2b')]['sessionId'];var _0x3446c8=_0x37aa3c[_0x9964('0x2b')]['transferNumber'];return getAgent(_0x249fa7)[_0x9964('0x1c')](function(_0x57b0de){logger[_0x9964('0x29')]('entityFound:',_0x57b0de[_0x9964('0x18')]);emit(util[_0x9964('0x36')]('user:%s',_0x57b0de[_0x9964('0x18')]),'webbar:transfer',{'sessionId':_0x19608a,'transferNumber':_0x3446c8});return _0x2e2b33['status'](0xc8)[_0x9964('0x2c')]({'error':![],'message':'transfer\x20executed!'});})[_0x9964('0x1f')](handleError(_0x2e2b33));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index bbb00a0..2e05ff2 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 _0x5c3c=['../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','describe','show','/:id/dispositions','/:id/canned_answers','/:id/users','getAgents','/:id/applications','getApplications','post','create','addDisposition','addAgents','addApplications','/:id/notify','notify','/:id/send','send','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x300525,_0x3ef4f6){var _0x90177d=function(_0x31a3e9){while(--_0x31a3e9){_0x300525['push'](_0x300525['shift']());}};_0x90177d(++_0x3ef4f6);}(_0x5c3c,0x132));var _0xc5c3=function(_0x9fd887,_0x47f76c){_0x9fd887=_0x9fd887-0x0;var _0x1a54ab=_0x5c3c[_0x9fd887];return _0x1a54ab;};'use strict';var multer=require(_0xc5c3('0x0'));var util=require(_0xc5c3('0x1'));var path=require(_0xc5c3('0x2'));var timeout=require(_0xc5c3('0x3'));var express=require('express');var router=express[_0xc5c3('0x4')]();var fs_extra=require(_0xc5c3('0x5'));var auth=require(_0xc5c3('0x6'));var interaction=require(_0xc5c3('0x7'));var config=require(_0xc5c3('0x8'));var controller=require(_0xc5c3('0x9'));router[_0xc5c3('0xa')]('/',auth[_0xc5c3('0xb')](),controller[_0xc5c3('0xc')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xc5c3('0xd')]);router[_0xc5c3('0xa')]('/:id',auth[_0xc5c3('0xb')](),controller[_0xc5c3('0xe')]);router['get'](_0xc5c3('0xf'),auth[_0xc5c3('0xb')](),controller['getDispositions']);router[_0xc5c3('0xa')](_0xc5c3('0x10'),auth[_0xc5c3('0xb')](),controller['getAnswers']);router[_0xc5c3('0xa')](_0xc5c3('0x11'),auth['isAuthenticated'](),controller[_0xc5c3('0x12')]);router[_0xc5c3('0xa')](_0xc5c3('0x13'),auth['isAuthenticated'](),controller[_0xc5c3('0x14')]);router[_0xc5c3('0x15')]('/',auth[_0xc5c3('0xb')](),controller[_0xc5c3('0x16')]);router[_0xc5c3('0x15')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xc5c3('0x17')]);router[_0xc5c3('0x15')](_0xc5c3('0x10'),auth[_0xc5c3('0xb')](),controller['addAnswer']);router['post'](_0xc5c3('0x11'),auth['isAuthenticated'](),controller[_0xc5c3('0x18')]);router[_0xc5c3('0x15')](_0xc5c3('0x13'),auth[_0xc5c3('0xb')](),controller[_0xc5c3('0x19')]);router['post'](_0xc5c3('0x1a'),controller[_0xc5c3('0x1b')]);router[_0xc5c3('0x15')](_0xc5c3('0x1c'),auth['isAuthenticated'](),controller[_0xc5c3('0x1d')]);router[_0xc5c3('0x1e')](_0xc5c3('0x1f'),auth[_0xc5c3('0xb')](),controller[_0xc5c3('0x20')]);router['delete'](_0xc5c3('0x1f'),auth[_0xc5c3('0xb')](),controller[_0xc5c3('0x21')]);router[_0xc5c3('0x22')](_0xc5c3('0xf'),auth[_0xc5c3('0xb')](),controller[_0xc5c3('0x23')]);router['delete']('/:id/canned_answers',auth[_0xc5c3('0xb')](),controller[_0xc5c3('0x24')]);router['delete']('/:id/users',auth[_0xc5c3('0xb')](),controller[_0xc5c3('0x25')]);module[_0xc5c3('0x26')]=router; \ No newline at end of file +var _0x8f4c=['create','addDisposition','/:id/canned_answers','addAgents','/:id/applications','addApplications','/:id/notify','notify','/:id/send','send','put','update','delete','destroy','removeDispositions','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','describe','/:id','isAuthenticated','show','/:id/dispositions','getDispositions','/:id/users','getAgents','getApplications','post'];(function(_0x21de89,_0x367053){var _0x290b7e=function(_0x540704){while(--_0x540704){_0x21de89['push'](_0x21de89['shift']());}};_0x290b7e(++_0x367053);}(_0x8f4c,0x113));var _0xc8f4=function(_0x59f0f7,_0x423bc4){_0x59f0f7=_0x59f0f7-0x0;var _0xf5ef2a=_0x8f4c[_0x59f0f7];return _0xf5ef2a;};'use strict';var multer=require(_0xc8f4('0x0'));var util=require(_0xc8f4('0x1'));var path=require(_0xc8f4('0x2'));var timeout=require(_0xc8f4('0x3'));var express=require(_0xc8f4('0x4'));var router=express[_0xc8f4('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc8f4('0x6'));var interaction=require(_0xc8f4('0x7'));var config=require(_0xc8f4('0x8'));var controller=require('./whatsappAccount.controller');router[_0xc8f4('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xc8f4('0xa'),auth['isAuthenticated'](),controller[_0xc8f4('0xb')]);router[_0xc8f4('0x9')](_0xc8f4('0xc'),auth[_0xc8f4('0xd')](),controller[_0xc8f4('0xe')]);router['get'](_0xc8f4('0xf'),auth[_0xc8f4('0xd')](),controller[_0xc8f4('0x10')]);router[_0xc8f4('0x9')]('/:id/canned_answers',auth[_0xc8f4('0xd')](),controller['getAnswers']);router[_0xc8f4('0x9')](_0xc8f4('0x11'),auth[_0xc8f4('0xd')](),controller[_0xc8f4('0x12')]);router[_0xc8f4('0x9')]('/:id/applications',auth[_0xc8f4('0xd')](),controller[_0xc8f4('0x13')]);router[_0xc8f4('0x14')]('/',auth[_0xc8f4('0xd')](),controller[_0xc8f4('0x15')]);router[_0xc8f4('0x14')]('/:id/dispositions',auth[_0xc8f4('0xd')](),controller[_0xc8f4('0x16')]);router[_0xc8f4('0x14')](_0xc8f4('0x17'),auth[_0xc8f4('0xd')](),controller['addAnswer']);router[_0xc8f4('0x14')]('/:id/users',auth['isAuthenticated'](),controller[_0xc8f4('0x18')]);router[_0xc8f4('0x14')](_0xc8f4('0x19'),auth[_0xc8f4('0xd')](),controller[_0xc8f4('0x1a')]);router[_0xc8f4('0x14')](_0xc8f4('0x1b'),controller[_0xc8f4('0x1c')]);router[_0xc8f4('0x14')](_0xc8f4('0x1d'),auth[_0xc8f4('0xd')](),controller[_0xc8f4('0x1e')]);router[_0xc8f4('0x1f')]('/:id',auth[_0xc8f4('0xd')](),controller[_0xc8f4('0x20')]);router[_0xc8f4('0x21')](_0xc8f4('0xc'),auth[_0xc8f4('0xd')](),controller[_0xc8f4('0x22')]);router[_0xc8f4('0x21')](_0xc8f4('0xf'),auth['isAuthenticated'](),controller[_0xc8f4('0x23')]);router[_0xc8f4('0x21')](_0xc8f4('0x17'),auth[_0xc8f4('0xd')](),controller['removeAnswers']);router[_0xc8f4('0x21')]('/:id/users',auth[_0xc8f4('0xd')](),controller['removeAgents']);module[_0xc8f4('0x24')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index dba00ae..10fcd0b 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 _0xb693=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','name','STRING','generate','ENUM','twilio','sinch','TEXT'];(function(_0x1cae14,_0x350198){var _0x4b03e7=function(_0x52c200){while(--_0x52c200){_0x1cae14['push'](_0x1cae14['shift']());}};_0x4b03e7(++_0x350198);}(_0xb693,0x1c1));var _0x3b69=function(_0x2136a6,_0x35af63){_0x2136a6=_0x2136a6-0x0;var _0x55b948=_0xb693[_0x2136a6];return _0x55b948;};'use strict';var Sequelize=require(_0x3b69('0x0'));var rs=require(_0x3b69('0x1'));module[_0x3b69('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x3b69('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x3b69('0x4')],'allowNull':![]},'remote':{'type':Sequelize[_0x3b69('0x4')],'allowNull':![]},'token':{'type':Sequelize[_0x3b69('0x4')],'defaultValue':function(){return rs[_0x3b69('0x5')]();}},'phone':{'type':Sequelize[_0x3b69('0x4')]},'type':{'type':Sequelize[_0x3b69('0x6')](_0x3b69('0x7'),_0x3b69('0x8'))},'accountSid':{'type':Sequelize['STRING']},'baseUrl':{'type':Sequelize[_0x3b69('0x4')]},'authToken':{'type':Sequelize[_0x3b69('0x4')]},'notificationTemplate':{'type':Sequelize[_0x3b69('0x9')],'defaultValue':function(){return _0x3b69('0xa');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x3b69('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x3b69('0xc')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x3b69('0xc')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x3b69('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x3b69('0xb')],'comment':_0x3b69('0xd')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x34adce){if(!_0x34adce){this[_0x3b69('0xe')](_0x3b69('0xf'),null);}this[_0x3b69('0xe')](_0x3b69('0x10'),_0x34adce);}},'description':{'type':Sequelize[_0x3b69('0x4')]}}; \ No newline at end of file +var _0x1618=['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','sequelize','randomstring','name','STRING','generate','twilio','TEXT'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x1618,0xc9));var _0x8161=function(_0x5c7cd6,_0xa77e75){_0x5c7cd6=_0x5c7cd6-0x0;var _0x5820da=_0x1618[_0x5c7cd6];return _0x5820da;};'use strict';var Sequelize=require(_0x8161('0x0'));var rs=require(_0x8161('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x8161('0x2'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x8161('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x8161('0x3')],'defaultValue':function(){return rs[_0x8161('0x4')]();}},'phone':{'type':Sequelize[_0x8161('0x3')]},'type':{'type':Sequelize['ENUM'](_0x8161('0x5'),'sinch')},'accountSid':{'type':Sequelize['STRING']},'baseUrl':{'type':Sequelize[_0x8161('0x3')]},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x8161('0x6')],'defaultValue':function(){return _0x8161('0x7');}},'notificationSound':{'type':Sequelize[_0x8161('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x8161('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x8161('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x8161('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8161('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x8161('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8161('0x9')],'comment':_0x8161('0xa')},'mandatoryDisposition':{'type':Sequelize[_0x8161('0x8')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x3ab5f1){if(!_0x3ab5f1){this[_0x8161('0xb')](_0x8161('0xc'),null);}this[_0x8161('0xb')]('mandatoryDisposition',_0x3ab5f1);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 6abef94..62d442e 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 _0x5535=['code','message','result','catch','sendStatus','end','offset','undefined','limit','status','set','Content-Range','json','reject','save','update','then','destroy','get','WhatsappAccounts','UserProfileResource','stack','name','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','include','show','params','Pause','keys','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','body','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findAll','rows','removeDispositions','ids','addAnswer','findOne','CannedAnswer','includeAll','removeAnswers','addAgents','spread','emit','removeAgents','userWhatsappAccount:remove','getAgents','addApplications','transaction','Transaction','ISOLATION_LEVELS','WhatsappApplication','bulkCreate','finally','send','getApplications','notify','Applications','account','statuses','state','read','WhatsappMessage','timestamp','message_id','applications','orderBy','priority','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','mobile','twilio','from','From','whatsapp:','messageId','sinch','notifications','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','omit','contact','WhatsappInteraction','interaction','created','autoclose','close','unmanaged','*,*,*,*','UserId','User','unshift','agent','waitForTheAssignedAgent','startRouting','Start','receiveMessage','entity\x20found','Content-Type','text/xml','\x0a','List','ListId','Messages','dataValues','push','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','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','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','client','http','request','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x357fad,_0x148763){var _0x1ff22a=function(_0x3a6728){while(--_0x3a6728){_0x357fad['push'](_0x357fad['shift']());}};_0x1ff22a(++_0x148763);}(_0x5535,0x9b));var _0x5553=function(_0x45f945,_0x2c5a50){_0x45f945=_0x45f945-0x0;var _0x2866b8=_0x5535[_0x45f945];return _0x2866b8;};'use strict';var emlformat=require(_0x5553('0x0'));var rimraf=require(_0x5553('0x1'));var zipdir=require(_0x5553('0x2'));var jsonpatch=require(_0x5553('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5553('0x4'));var Mustache=require(_0x5553('0x5'));var util=require(_0x5553('0x6'));var path=require(_0x5553('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5553('0x8'));var fs=require('fs');var fs_extra=require(_0x5553('0x9'));var _=require(_0x5553('0xa'));var squel=require('squel');var crypto=require(_0x5553('0xb'));var jsforce=require(_0x5553('0xc'));var deskjs=require(_0x5553('0xd'));var toCsv=require(_0x5553('0xe'));var querystring=require(_0x5553('0xf'));var Papa=require(_0x5553('0x10'));var Redis=require(_0x5553('0x11'));var authService=require(_0x5553('0x12'));var qs=require(_0x5553('0x13'));var as=require(_0x5553('0x14'));var hardwareService=require(_0x5553('0x15'));var logger=require(_0x5553('0x16'))(_0x5553('0x17'));var utils=require(_0x5553('0x18'));var config=require(_0x5553('0x19'));var licenseUtil=require(_0x5553('0x1a'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x5553('0x1b')](config[_0x5553('0x1c')],{'host':_0x5553('0x1d'),'port':0x18eb});var socket=require(_0x5553('0x1e'))(new Redis(config[_0x5553('0x1c')]));require(_0x5553('0x1f'))[_0x5553('0x20')](socket);var jayson=require('jayson/promise');var client=jayson[_0x5553('0x21')][_0x5553('0x22')]({'port':0x232c});function respondWithRpcPromise(_0x359122,_0x39f148,_0x344c64,_0x504f73){return new BPromise(function(_0x2f4726,_0x46f4c1){var _0x181c19=_0x504f73||client;return _0x181c19[_0x5553('0x23')](_0x359122,_0x344c64)['then'](function(_0x3ef30c){logger[_0x5553('0x24')](_0x5553('0x25'),_0x39f148,_0x5553('0x26'));logger[_0x5553('0x27')](_0x5553('0x28'),_0x39f148,_0x5553('0x26'),JSON[_0x5553('0x29')](_0x3ef30c));if(_0x3ef30c[_0x5553('0x2a')]){if(_0x3ef30c[_0x5553('0x2a')][_0x5553('0x2b')]===0x1f4){logger[_0x5553('0x2a')](_0x5553('0x25'),_0x39f148,_0x3ef30c['error'][_0x5553('0x2c')]);return _0x46f4c1(_0x3ef30c[_0x5553('0x2a')][_0x5553('0x2c')]);}logger['error'](_0x5553('0x25'),_0x39f148,_0x3ef30c[_0x5553('0x2a')][_0x5553('0x2c')]);return _0x2f4726(_0x3ef30c[_0x5553('0x2a')]['message']);}else{logger[_0x5553('0x24')](_0x5553('0x25'),_0x39f148,'request\x20sent');_0x2f4726(_0x3ef30c[_0x5553('0x2d')][_0x5553('0x2c')]);}})[_0x5553('0x2e')](function(_0x145273){logger['error'](_0x5553('0x25'),_0x39f148,_0x145273);_0x46f4c1(_0x145273);});});}function respondWithStatusCode(_0x1a9eb6,_0x979d8){_0x979d8=_0x979d8||0xcc;return function(_0x3432ed){if(_0x3432ed){return _0x1a9eb6[_0x5553('0x2f')](_0x979d8);}return _0x1a9eb6['status'](_0x979d8)[_0x5553('0x30')]();};}function respondWithResult(_0x22eb62,_0x51ebc2){_0x51ebc2=_0x51ebc2||0xc8;return function(_0x1753ea){if(_0x1753ea){return _0x22eb62['status'](_0x51ebc2)['json'](_0x1753ea);}};}function respondWithFilteredResult(_0x1f9921,_0x27008b){return function(_0x3bbb31){if(_0x3bbb31){var _0x556c7f=typeof _0x27008b[_0x5553('0x31')]===_0x5553('0x32')&&typeof _0x27008b['limit']==='undefined';var _0x43fc6f=_0x3bbb31['count'];var _0x244f20=_0x556c7f?0x0:_0x27008b[_0x5553('0x31')];var _0x397ad5=_0x556c7f?_0x3bbb31['count']:_0x27008b[_0x5553('0x31')]+_0x27008b[_0x5553('0x33')];var _0x3409de;if(_0x397ad5>=_0x43fc6f){_0x397ad5=_0x43fc6f;_0x3409de=0xc8;}else{_0x3409de=0xce;}_0x1f9921[_0x5553('0x34')](_0x3409de);return _0x1f9921[_0x5553('0x35')](_0x5553('0x36'),_0x244f20+'-'+_0x397ad5+'/'+_0x43fc6f)[_0x5553('0x37')](_0x3bbb31);}return null;};}function patchUpdates(_0x1a41c4){return function(_0x3088cc){try{jsonpatch['apply'](_0x3088cc,_0x1a41c4,!![]);}catch(_0x1064e2){return BPromise[_0x5553('0x38')](_0x1064e2);}return _0x3088cc[_0x5553('0x39')]();};}function saveUpdates(_0x2442d8,_0x5656d5){return function(_0x30a93c){if(_0x30a93c){return _0x30a93c[_0x5553('0x3a')](_0x2442d8)[_0x5553('0x3b')](function(_0x3d2fd7){return _0x3d2fd7;});}return null;};}function removeEntity(_0x291c79,_0x46787b){return function(_0x5263e1){if(_0x5263e1){return _0x5263e1[_0x5553('0x3c')]()[_0x5553('0x3b')](function(){var _0x384ee1=_0x5263e1[_0x5553('0x3d')]({'plain':!![]});var _0x21eb1d=_0x5553('0x3e');return db[_0x5553('0x3f')][_0x5553('0x3c')]({'where':{'type':_0x21eb1d,'resourceId':_0x384ee1['id']}})[_0x5553('0x3b')](function(){return _0x5263e1;});})[_0x5553('0x3b')](function(){_0x291c79[_0x5553('0x34')](0xcc)[_0x5553('0x30')]();});}};}function handleEntityNotFound(_0xb6a3a7,_0x2ee099){return function(_0xc3b9da){if(!_0xc3b9da){_0xb6a3a7[_0x5553('0x2f')](0x194);}return _0xc3b9da;};}function handleError(_0x21d6e5,_0x2336e7){_0x2336e7=_0x2336e7||0x1f4;return function(_0x3ef6e6){logger[_0x5553('0x2a')](_0x3ef6e6[_0x5553('0x40')]);if(_0x3ef6e6[_0x5553('0x41')]){delete _0x3ef6e6['name'];}_0x21d6e5[_0x5553('0x34')](_0x2336e7)['send'](_0x3ef6e6);};}exports['index']=function(_0x2a5fd2,_0x23ef65){var _0x1b9e41={'include':[{'model':db['Pause'],'as':_0x5553('0x42')}]},_0x20213a={},_0x2bd515={'count':0x0,'rows':[]};var _0x1d33e2=_[_0x5553('0x43')](db[_0x5553('0x44')][_0x5553('0x45')],function(_0x7f71bd){return{'name':_0x7f71bd[_0x5553('0x46')],'type':_0x7f71bd[_0x5553('0x47')][_0x5553('0x48')]};});_0x20213a[_0x5553('0x49')]=_[_0x5553('0x43')](_0x1d33e2,_0x5553('0x41'));_0x20213a[_0x5553('0x4a')]=_['keys'](_0x2a5fd2[_0x5553('0x4a')]);_0x20213a[_0x5553('0x4b')]=_[_0x5553('0x4c')](_0x20213a[_0x5553('0x49')],_0x20213a['query']);_0x1b9e41[_0x5553('0x4d')]=_[_0x5553('0x4c')](_0x20213a['model'],qs[_0x5553('0x4e')](_0x2a5fd2['query'][_0x5553('0x4e')]));_0x1b9e41[_0x5553('0x4d')]=_0x1b9e41['attributes']['length']?_0x1b9e41['attributes']:_0x20213a[_0x5553('0x49')];if(!_0x2a5fd2[_0x5553('0x4a')][_0x5553('0x4f')](_0x5553('0x50'))){_0x1b9e41['limit']=qs[_0x5553('0x33')](_0x2a5fd2[_0x5553('0x4a')][_0x5553('0x33')]);_0x1b9e41[_0x5553('0x31')]=qs[_0x5553('0x31')](_0x2a5fd2[_0x5553('0x4a')][_0x5553('0x31')]);}_0x1b9e41[_0x5553('0x51')]=qs[_0x5553('0x52')](_0x2a5fd2[_0x5553('0x4a')][_0x5553('0x52')]);_0x1b9e41[_0x5553('0x53')]=qs[_0x5553('0x4b')](_[_0x5553('0x54')](_0x2a5fd2['query'],_0x20213a[_0x5553('0x4b')]),_0x1d33e2);if(_0x2a5fd2['query'][_0x5553('0x55')]){_0x1b9e41[_0x5553('0x53')]=_[_0x5553('0x56')](_0x1b9e41[_0x5553('0x53')],{'$or':_[_0x5553('0x43')](_0x1d33e2,function(_0x31d59c){if(_0x31d59c[_0x5553('0x47')]!==_0x5553('0x57')){var _0x302024={};_0x302024[_0x31d59c[_0x5553('0x41')]]={'$like':'%'+_0x2a5fd2['query'][_0x5553('0x55')]+'%'};return _0x302024;}})});}_0x1b9e41=_[_0x5553('0x56')]({},_0x1b9e41,_0x2a5fd2[_0x5553('0x58')]);var _0x1ba0a3={'where':_0x1b9e41[_0x5553('0x53')]};return db['WhatsappAccount']['count'](_0x1ba0a3)[_0x5553('0x3b')](function(_0x38360d){_0x2bd515[_0x5553('0x59')]=_0x38360d;if(_0x2a5fd2[_0x5553('0x4a')]['includeAll']){_0x1b9e41[_0x5553('0x5a')]=[{'all':!![]}];}return db[_0x5553('0x44')]['findAll'](_0x1b9e41);})['then'](function(_0x3f52ab){_0x2bd515['rows']=_0x3f52ab;return _0x2bd515;})[_0x5553('0x3b')](respondWithFilteredResult(_0x23ef65,_0x1b9e41))['catch'](handleError(_0x23ef65,null));};exports[_0x5553('0x5b')]=function(_0x5879a0,_0x358ca1){var _0x301b73={'raw':![],'where':{'id':_0x5879a0[_0x5553('0x5c')]['id']},'include':[{'model':db[_0x5553('0x5d')],'as':_0x5553('0x42')}]},_0x1d65d6={};_0x1d65d6[_0x5553('0x49')]=_['keys'](db[_0x5553('0x44')][_0x5553('0x45')]);_0x1d65d6[_0x5553('0x4a')]=_[_0x5553('0x5e')](_0x5879a0[_0x5553('0x4a')]);_0x1d65d6[_0x5553('0x4b')]=_[_0x5553('0x4c')](_0x1d65d6[_0x5553('0x49')],_0x1d65d6[_0x5553('0x4a')]);_0x301b73[_0x5553('0x4d')]=_[_0x5553('0x4c')](_0x1d65d6[_0x5553('0x49')],qs['fields'](_0x5879a0[_0x5553('0x4a')][_0x5553('0x4e')]));_0x301b73['attributes']=_0x301b73[_0x5553('0x4d')][_0x5553('0x5f')]?_0x301b73[_0x5553('0x4d')]:_0x1d65d6[_0x5553('0x49')];if(_0x5879a0['query']['includeAll']){_0x301b73[_0x5553('0x5a')]=[{'all':!![]}];}_0x301b73=_[_0x5553('0x56')]({},_0x301b73,_0x5879a0[_0x5553('0x58')]);return db[_0x5553('0x44')][_0x5553('0x60')](_0x301b73)['then'](handleEntityNotFound(_0x358ca1,null))[_0x5553('0x3b')](respondWithResult(_0x358ca1,null))[_0x5553('0x2e')](handleError(_0x358ca1,null));};exports[_0x5553('0x61')]=function(_0x6a89ba,_0x16c8ba){return db[_0x5553('0x44')][_0x5553('0x61')](_0x6a89ba['body'],{})[_0x5553('0x3b')](function(_0x184d49){var _0x1ffb8a=_0x6a89ba[_0x5553('0x62')][_0x5553('0x3d')]({'plain':!![]});if(!_0x1ffb8a)throw new Error(_0x5553('0x63'));if(_0x1ffb8a[_0x5553('0x64')]==='user'){var _0x59d2ae=_0x184d49[_0x5553('0x3d')]({'plain':!![]});var _0x38de55=_0x5553('0x3e');return db[_0x5553('0x65')]['find']({'where':{'name':_0x38de55,'userProfileId':_0x1ffb8a[_0x5553('0x66')]},'raw':!![]})[_0x5553('0x3b')](function(_0x366fd6){if(_0x366fd6&&_0x366fd6[_0x5553('0x67')]===0x0){return db[_0x5553('0x3f')]['create']({'name':_0x59d2ae[_0x5553('0x41')],'resourceId':_0x59d2ae['id'],'type':_0x366fd6[_0x5553('0x41')],'sectionId':_0x366fd6['id']},{})[_0x5553('0x3b')](function(){return _0x184d49;});}else{return _0x184d49;}})[_0x5553('0x2e')](function(_0x4e44a9){logger[_0x5553('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4e44a9);throw _0x4e44a9;});}return _0x184d49;})['then'](respondWithResult(_0x16c8ba,0xc9))[_0x5553('0x2e')](handleError(_0x16c8ba,null));};exports[_0x5553('0x3a')]=function(_0x11203,_0x5d50c1){if(_0x11203[_0x5553('0x68')]['id']){delete _0x11203['body']['id'];}return db[_0x5553('0x44')][_0x5553('0x60')]({'where':{'id':_0x11203[_0x5553('0x5c')]['id']},'include':[{'model':db[_0x5553('0x5d')],'as':_0x5553('0x42')}]})[_0x5553('0x3b')](handleEntityNotFound(_0x5d50c1,null))[_0x5553('0x3b')](saveUpdates(_0x11203['body'],null))[_0x5553('0x3b')](respondWithResult(_0x5d50c1,null))['catch'](handleError(_0x5d50c1,null));};exports[_0x5553('0x3c')]=function(_0x29ab72,_0x17fb0c){return db[_0x5553('0x44')][_0x5553('0x60')]({'where':{'id':_0x29ab72[_0x5553('0x5c')]['id']}})[_0x5553('0x3b')](handleEntityNotFound(_0x17fb0c,null))[_0x5553('0x3b')](removeEntity(_0x17fb0c,null))[_0x5553('0x2e')](handleError(_0x17fb0c,null));};exports['describe']=function(_0xd12e43,_0x4a44c5){return db[_0x5553('0x44')][_0x5553('0x69')]()[_0x5553('0x3b')](respondWithResult(_0x4a44c5,null))[_0x5553('0x2e')](handleError(_0x4a44c5,null));};exports[_0x5553('0x6a')]=function(_0x320833,_0x25db25,_0x592664){if(_0x320833[_0x5553('0x68')]['id']){delete _0x320833[_0x5553('0x68')]['id'];}return db[_0x5553('0x44')]['find']({'where':{'id':_0x320833['params']['id']}})['then'](handleEntityNotFound(_0x25db25,null))[_0x5553('0x3b')](function(_0x31bfd9){if(_0x31bfd9){_0x320833[_0x5553('0x68')][_0x5553('0x6b')]=_0x31bfd9['id'];return db[_0x5553('0x6c')]['create'](_0x320833['body']);}})['then'](respondWithResult(_0x25db25,null))['catch'](handleError(_0x25db25,null));};exports[_0x5553('0x6d')]=function(_0x2c82d7,_0x328678,_0x2fb688){var _0x4d98d4={'raw':![],'where':{}};var _0x901e9b={};var _0x3495c0={'count':0x0,'rows':[]};return db['WhatsappAccount']['findOne']({'where':{'id':_0x2c82d7[_0x5553('0x5c')]['id']}})[_0x5553('0x3b')](handleEntityNotFound(_0x328678,null))[_0x5553('0x3b')](function(_0xded06){if(_0xded06){_0x901e9b[_0x5553('0x49')]=_[_0x5553('0x5e')](db[_0x5553('0x6c')][_0x5553('0x45')]);_0x901e9b['query']=_[_0x5553('0x5e')](_0x2c82d7[_0x5553('0x4a')]);_0x901e9b['filters']=_['intersection'](_0x901e9b[_0x5553('0x49')],_0x901e9b['query']);_0x4d98d4[_0x5553('0x4d')]=_[_0x5553('0x4c')](_0x901e9b['model'],qs['fields'](_0x2c82d7['query'][_0x5553('0x4e')]));_0x4d98d4[_0x5553('0x4d')]=_0x4d98d4[_0x5553('0x4d')][_0x5553('0x5f')]?_0x4d98d4['attributes']:_0x901e9b[_0x5553('0x49')];if(!_0x2c82d7['query']['hasOwnProperty'](_0x5553('0x50'))){_0x4d98d4[_0x5553('0x33')]=qs[_0x5553('0x33')](_0x2c82d7[_0x5553('0x4a')]['limit']);_0x4d98d4[_0x5553('0x31')]=qs[_0x5553('0x31')](_0x2c82d7[_0x5553('0x4a')]['offset']);}_0x4d98d4['order']=qs[_0x5553('0x52')](_0x2c82d7[_0x5553('0x4a')]['sort']);_0x4d98d4[_0x5553('0x53')]=qs['filters'](_[_0x5553('0x54')](_0x2c82d7[_0x5553('0x4a')],_0x901e9b[_0x5553('0x4b')]));_0x4d98d4[_0x5553('0x53')][_0x5553('0x6b')]=_0xded06['id'];if(_0x2c82d7[_0x5553('0x4a')]['filter']){_0x4d98d4[_0x5553('0x53')]=_['merge'](_0x4d98d4[_0x5553('0x53')],{'$or':_[_0x5553('0x43')](_0x4d98d4['attributes'],function(_0x12f34b){var _0x5e7059={};_0x5e7059[_0x12f34b]={'$like':'%'+_0x2c82d7['query'][_0x5553('0x55')]+'%'};return _0x5e7059;})});}_0x4d98d4=_[_0x5553('0x56')]({},_0x4d98d4,_0x2c82d7[_0x5553('0x58')]);return db[_0x5553('0x6c')][_0x5553('0x59')]({'where':_0x4d98d4['where']})['then'](function(_0x250449){_0x3495c0[_0x5553('0x59')]=_0x250449;if(_0x2c82d7[_0x5553('0x4a')]['includeAll']){_0x4d98d4[_0x5553('0x5a')]=[{'all':!![]}];}return db[_0x5553('0x6c')][_0x5553('0x6e')](_0x4d98d4);})[_0x5553('0x3b')](function(_0x4a2cfa){_0x3495c0[_0x5553('0x6f')]=_0x4a2cfa;return _0x3495c0;});}})['then'](respondWithFilteredResult(_0x328678,_0x4d98d4))[_0x5553('0x2e')](handleError(_0x328678,null));};exports['removeDispositions']=function(_0x4b41cc,_0x1a065c,_0x2d99ff){return db[_0x5553('0x44')][_0x5553('0x60')]({'where':{'id':_0x4b41cc[_0x5553('0x5c')]['id']}})[_0x5553('0x3b')](handleEntityNotFound(_0x1a065c,null))[_0x5553('0x3b')](function(_0xae5c89){if(_0xae5c89){return _0xae5c89[_0x5553('0x70')](_0x4b41cc['query'][_0x5553('0x71')]);}})[_0x5553('0x3b')](respondWithStatusCode(_0x1a065c,null))['catch'](handleError(_0x1a065c,null));};exports[_0x5553('0x72')]=function(_0x4a23fc,_0x258282,_0x52940a){if(_0x4a23fc[_0x5553('0x68')]['id']){delete _0x4a23fc[_0x5553('0x68')]['id'];}return db[_0x5553('0x44')][_0x5553('0x60')]({'where':{'id':_0x4a23fc['params']['id']}})[_0x5553('0x3b')](handleEntityNotFound(_0x258282,null))[_0x5553('0x3b')](function(_0x215220){if(_0x215220){_0x4a23fc[_0x5553('0x68')][_0x5553('0x6b')]=_0x215220['id'];return db['CannedAnswer'][_0x5553('0x61')](_0x4a23fc[_0x5553('0x68')]);}})[_0x5553('0x3b')](respondWithResult(_0x258282,null))[_0x5553('0x2e')](handleError(_0x258282,null));};exports['getAnswers']=function(_0x41aa0d,_0x4e4e66,_0x120450){var _0x4c264d={'raw':![],'where':{}};var _0x2bd1fd={};var _0x1a4b63={'count':0x0,'rows':[]};return db[_0x5553('0x44')][_0x5553('0x73')]({'where':{'id':_0x41aa0d[_0x5553('0x5c')]['id']}})[_0x5553('0x3b')](handleEntityNotFound(_0x4e4e66,null))[_0x5553('0x3b')](function(_0x3db13f){if(_0x3db13f){_0x2bd1fd['model']=_[_0x5553('0x5e')](db[_0x5553('0x74')][_0x5553('0x45')]);_0x2bd1fd[_0x5553('0x4a')]=_[_0x5553('0x5e')](_0x41aa0d[_0x5553('0x4a')]);_0x2bd1fd[_0x5553('0x4b')]=_[_0x5553('0x4c')](_0x2bd1fd[_0x5553('0x49')],_0x2bd1fd[_0x5553('0x4a')]);_0x4c264d['attributes']=_['intersection'](_0x2bd1fd[_0x5553('0x49')],qs[_0x5553('0x4e')](_0x41aa0d[_0x5553('0x4a')][_0x5553('0x4e')]));_0x4c264d['attributes']=_0x4c264d['attributes'][_0x5553('0x5f')]?_0x4c264d['attributes']:_0x2bd1fd[_0x5553('0x49')];if(!_0x41aa0d[_0x5553('0x4a')][_0x5553('0x4f')](_0x5553('0x50'))){_0x4c264d[_0x5553('0x33')]=qs[_0x5553('0x33')](_0x41aa0d['query'][_0x5553('0x33')]);_0x4c264d[_0x5553('0x31')]=qs['offset'](_0x41aa0d[_0x5553('0x4a')][_0x5553('0x31')]);}_0x4c264d[_0x5553('0x51')]=qs[_0x5553('0x52')](_0x41aa0d['query'][_0x5553('0x52')]);_0x4c264d[_0x5553('0x53')]=qs[_0x5553('0x4b')](_[_0x5553('0x54')](_0x41aa0d[_0x5553('0x4a')],_0x2bd1fd[_0x5553('0x4b')]));_0x4c264d[_0x5553('0x53')]['WhatsappAccountId']=_0x3db13f['id'];if(_0x41aa0d[_0x5553('0x4a')][_0x5553('0x55')]){_0x4c264d[_0x5553('0x53')]=_[_0x5553('0x56')](_0x4c264d[_0x5553('0x53')],{'$or':_['map'](_0x4c264d['attributes'],function(_0x28d329){var _0x3e3d77={};_0x3e3d77[_0x28d329]={'$like':'%'+_0x41aa0d[_0x5553('0x4a')][_0x5553('0x55')]+'%'};return _0x3e3d77;})});}_0x4c264d=_[_0x5553('0x56')]({},_0x4c264d,_0x41aa0d[_0x5553('0x58')]);return db[_0x5553('0x74')][_0x5553('0x59')]({'where':_0x4c264d[_0x5553('0x53')]})['then'](function(_0x5abf5f){_0x1a4b63[_0x5553('0x59')]=_0x5abf5f;if(_0x41aa0d['query'][_0x5553('0x75')]){_0x4c264d[_0x5553('0x5a')]=[{'all':!![]}];}return db[_0x5553('0x74')][_0x5553('0x6e')](_0x4c264d);})['then'](function(_0x23342a){_0x1a4b63['rows']=_0x23342a;return _0x1a4b63;});}})[_0x5553('0x3b')](respondWithFilteredResult(_0x4e4e66,_0x4c264d))['catch'](handleError(_0x4e4e66,null));};exports[_0x5553('0x76')]=function(_0xf685ba,_0xc5e988,_0x4b83aa){return db[_0x5553('0x44')]['find']({'where':{'id':_0xf685ba[_0x5553('0x5c')]['id']}})[_0x5553('0x3b')](handleEntityNotFound(_0xc5e988,null))[_0x5553('0x3b')](function(_0x4e6968){if(_0x4e6968){return _0x4e6968[_0x5553('0x76')](_0xf685ba[_0x5553('0x4a')][_0x5553('0x71')]);}})[_0x5553('0x3b')](respondWithStatusCode(_0xc5e988,null))['catch'](handleError(_0xc5e988,null));};exports[_0x5553('0x77')]=function(_0x427572,_0x3e786f,_0x20cd86){return db['WhatsappAccount'][_0x5553('0x60')]({'where':{'id':_0x427572[_0x5553('0x5c')]['id']}})[_0x5553('0x3b')](handleEntityNotFound(_0x3e786f,null))[_0x5553('0x3b')](function(_0x13652a){if(_0x13652a){return _0x13652a[_0x5553('0x77')](_0x427572[_0x5553('0x68')][_0x5553('0x71')],_['omit'](_0x427572[_0x5553('0x68')],['ids','id'])||{})[_0x5553('0x78')](function(_0x311377){for(var _0x1e5456=0x0;_0x1e5456<_0x427572[_0x5553('0x68')]['ids'][_0x5553('0x5f')];_0x1e5456+=0x1){socket[_0x5553('0x79')]('userWhatsappAccount:save',{'UserId':Number(_0x427572[_0x5553('0x68')][_0x5553('0x71')][_0x1e5456]),'WhatsappAccountId':Number(_0x427572[_0x5553('0x5c')]['id'])});}return _0x311377;});}})['then'](respondWithResult(_0x3e786f,null))['catch'](handleError(_0x3e786f,null));};exports['removeAgents']=function(_0x1d5d3a,_0x1ae03c,_0x432558){return db[_0x5553('0x44')][_0x5553('0x60')]({'where':{'id':_0x1d5d3a[_0x5553('0x5c')]['id']}})[_0x5553('0x3b')](handleEntityNotFound(_0x1ae03c,null))[_0x5553('0x3b')](function(_0x2ca77f){if(_0x2ca77f){return _0x2ca77f[_0x5553('0x7a')](_0x1d5d3a[_0x5553('0x4a')][_0x5553('0x71')])[_0x5553('0x3b')](function(){if(_['isArray'](_0x1d5d3a[_0x5553('0x4a')][_0x5553('0x71')])){for(var _0xf3d91e=0x0;_0xf3d91e<_0x1d5d3a['query'][_0x5553('0x71')][_0x5553('0x5f')];_0xf3d91e+=0x1){socket[_0x5553('0x79')](_0x5553('0x7b'),{'UserId':Number(_0x1d5d3a[_0x5553('0x4a')][_0x5553('0x71')][_0xf3d91e]),'WhatsappAccountId':Number(_0x1d5d3a[_0x5553('0x5c')]['id'])});}}else{socket[_0x5553('0x79')](_0x5553('0x7b'),{'UserId':Number(_0x1d5d3a[_0x5553('0x4a')][_0x5553('0x71')]),'WhatsappAccountId':Number(_0x1d5d3a[_0x5553('0x5c')]['id'])});}});}})['then'](respondWithStatusCode(_0x1ae03c,null))[_0x5553('0x2e')](handleError(_0x1ae03c,null));};exports[_0x5553('0x7c')]=function(_0x401b68,_0x37e8cb,_0x2bfd83){var _0x369e82={};var _0x5516ff={};var _0x4fe2db;var _0x42b96b;return db[_0x5553('0x44')][_0x5553('0x73')]({'where':{'id':_0x401b68[_0x5553('0x5c')]['id']}})['then'](handleEntityNotFound(_0x37e8cb,null))['then'](function(_0x1b4727){if(_0x1b4727){_0x4fe2db=_0x1b4727;_0x5516ff[_0x5553('0x49')]=_[_0x5553('0x5e')](db['User'][_0x5553('0x45')]);_0x5516ff[_0x5553('0x4a')]=_['keys'](_0x401b68[_0x5553('0x4a')]);_0x5516ff['filters']=_[_0x5553('0x4c')](_0x5516ff[_0x5553('0x49')],_0x5516ff[_0x5553('0x4a')]);_0x369e82[_0x5553('0x4d')]=_[_0x5553('0x4c')](_0x5516ff[_0x5553('0x49')],qs[_0x5553('0x4e')](_0x401b68[_0x5553('0x4a')]['fields']));_0x369e82[_0x5553('0x4d')]=_0x369e82[_0x5553('0x4d')][_0x5553('0x5f')]?_0x369e82[_0x5553('0x4d')]:_0x5516ff[_0x5553('0x49')];_0x369e82['order']=qs[_0x5553('0x52')](_0x401b68[_0x5553('0x4a')][_0x5553('0x52')]);_0x369e82[_0x5553('0x53')]=qs[_0x5553('0x4b')](_['pick'](_0x401b68[_0x5553('0x4a')],_0x5516ff[_0x5553('0x4b')]));if(_0x401b68[_0x5553('0x4a')][_0x5553('0x55')]){_0x369e82[_0x5553('0x53')]=_[_0x5553('0x56')](_0x369e82[_0x5553('0x53')],{'$or':_[_0x5553('0x43')](_0x369e82[_0x5553('0x4d')],function(_0x534632){var _0x208f42={};_0x208f42[_0x534632]={'$like':'%'+_0x401b68[_0x5553('0x4a')][_0x5553('0x55')]+'%'};return _0x208f42;})});}_0x369e82=_[_0x5553('0x56')]({},_0x369e82,_0x401b68['options']);return _0x4fe2db['getAgents'](_0x369e82);}})['then'](function(_0x26f101){if(_0x26f101){_0x42b96b=_0x26f101[_0x5553('0x5f')];if(!_0x401b68[_0x5553('0x4a')]['hasOwnProperty']('nolimit')){_0x369e82[_0x5553('0x33')]=qs['limit'](_0x401b68[_0x5553('0x4a')][_0x5553('0x33')]);_0x369e82['offset']=qs[_0x5553('0x31')](_0x401b68['query'][_0x5553('0x31')]);}return _0x4fe2db[_0x5553('0x7c')](_0x369e82);}})['then'](function(_0x2ea92a){if(_0x2ea92a){return _0x2ea92a?{'count':_0x42b96b,'rows':_0x2ea92a}:null;}})[_0x5553('0x3b')](respondWithResult(_0x37e8cb,null))[_0x5553('0x2e')](handleError(_0x37e8cb,null));};exports[_0x5553('0x7d')]=function(_0x32c694,_0x48117d){var _0x2b6063=_0x32c694[_0x5553('0x5c')]['id'];var _0x21078d=_0x32c694[_0x5553('0x68')];var _0x3ca35e=0xc8;var _0xdd2729=null;return db['sequelize'][_0x5553('0x7e')]({'isolationLevel':db['sequelize'][_0x5553('0x7f')][_0x5553('0x80')]['READ_COMMITTED']},function(_0x24e557){return db[_0x5553('0x44')][_0x5553('0x73')]({'where':{'id':_0x2b6063},'transaction':_0x24e557})[_0x5553('0x3b')](function(_0x5bbd49){if(_0x5bbd49){return db[_0x5553('0x81')][_0x5553('0x3c')]({'where':{'WhatsappAccountId':_0x2b6063},'transaction':_0x24e557})[_0x5553('0x3b')](function(){var _0x4096d1=_[_0x5553('0x43')](_0x21078d,function(_0x28cbf7){_0x28cbf7['WhatsappAccountId']=_0x2b6063;return _0x28cbf7;});return db[_0x5553('0x81')][_0x5553('0x82')](_0x4096d1,{'transaction':_0x24e557});});}else{_0x3ca35e=0x194;_0xdd2729=[];}});})['then'](function(){if(_0x3ca35e!==0x194){return db[_0x5553('0x81')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x2b6063},'order':'priority'})[_0x5553('0x3b')](function(_0xd70000){_0xdd2729=_0xd70000;});}})['catch'](function(_0x1a0a97){_0x3ca35e=0x1f4;logger[_0x5553('0x2a')](_0x1a0a97[_0x5553('0x40')]);if(_0x1a0a97['name']){delete _0x1a0a97[_0x5553('0x41')];}_0xdd2729=_0x1a0a97;})[_0x5553('0x83')](function(){if(_0xdd2729===null){_0x48117d[_0x5553('0x2f')](_0x3ca35e);}else{if(_0x3ca35e===0x1f4){_0x48117d[_0x5553('0x34')](_0x3ca35e)[_0x5553('0x84')](_0xdd2729);}else{_0x48117d[_0x5553('0x34')](_0x3ca35e)[_0x5553('0x37')](_0xdd2729);}}});};exports[_0x5553('0x85')]=function(_0x39d679,_0x7725e,_0x4a9fbc){var _0xe83b02={};var _0x2e4a23={};var _0x127ee4;var _0x45af0a;return db[_0x5553('0x44')][_0x5553('0x73')]({'where':{'id':_0x39d679['params']['id']}})[_0x5553('0x3b')](handleEntityNotFound(_0x7725e,null))[_0x5553('0x3b')](function(_0x61b25e){if(_0x61b25e){_0x127ee4=_0x61b25e;_0x2e4a23[_0x5553('0x49')]=_[_0x5553('0x5e')](db['WhatsappApplication']['rawAttributes']);_0x2e4a23[_0x5553('0x4a')]=_[_0x5553('0x5e')](_0x39d679[_0x5553('0x4a')]);_0x2e4a23[_0x5553('0x4b')]=_['intersection'](_0x2e4a23[_0x5553('0x49')],_0x2e4a23[_0x5553('0x4a')]);_0xe83b02['attributes']=_[_0x5553('0x4c')](_0x2e4a23[_0x5553('0x49')],qs['fields'](_0x39d679[_0x5553('0x4a')]['fields']));_0xe83b02['attributes']=_0xe83b02['attributes']['length']?_0xe83b02[_0x5553('0x4d')]:_0x2e4a23['model'];_0xe83b02[_0x5553('0x51')]=qs[_0x5553('0x52')](_0x39d679[_0x5553('0x4a')][_0x5553('0x52')]);_0xe83b02[_0x5553('0x53')]=qs[_0x5553('0x4b')](_[_0x5553('0x54')](_0x39d679['query'],_0x2e4a23[_0x5553('0x4b')]));if(_0x39d679[_0x5553('0x4a')][_0x5553('0x55')]){_0xe83b02[_0x5553('0x53')]=_[_0x5553('0x56')](_0xe83b02[_0x5553('0x53')],{'$or':_[_0x5553('0x43')](_0xe83b02[_0x5553('0x4d')],function(_0x407d33){var _0x2a4ba5={};_0x2a4ba5[_0x407d33]={'$like':'%'+_0x39d679['query'][_0x5553('0x55')]+'%'};return _0x2a4ba5;})});}_0xe83b02=_['merge']({},_0xe83b02,_0x39d679[_0x5553('0x58')]);return _0x127ee4[_0x5553('0x85')](_0xe83b02);}})['then'](function(_0x34c81e){if(_0x34c81e){_0x45af0a=_0x34c81e[_0x5553('0x5f')];if(!_0x39d679[_0x5553('0x4a')]['hasOwnProperty'](_0x5553('0x50'))){_0xe83b02['limit']=qs['limit'](_0x39d679[_0x5553('0x4a')]['limit']);_0xe83b02[_0x5553('0x31')]=qs[_0x5553('0x31')](_0x39d679[_0x5553('0x4a')][_0x5553('0x31')]);}return _0x127ee4['getApplications'](_0xe83b02);}})[_0x5553('0x3b')](function(_0x5f207f){if(_0x5f207f){return _0x5f207f?{'count':_0x45af0a,'rows':_0x5f207f}:null;}})[_0x5553('0x3b')](respondWithResult(_0x7725e,null))['catch'](handleError(_0x7725e,null));};exports[_0x5553('0x86')]=function(_0x1fb52b,_0x4aedcb,_0x363046){var _0x51f5fd={'channel':'whatsapp'};var _0x50b405=[];var _0x37a21b=[];var _0x3a0df9={};return db['WhatsappAccount'][_0x5553('0x60')]({'where':{'id':_0x1fb52b[_0x5553('0x5c')]['id']},'include':[{'model':db[_0x5553('0x81')],'as':_0x5553('0x87')}]})[_0x5553('0x3b')](handleEntityNotFound(_0x4aedcb,null))[_0x5553('0x3b')](function(_0xfbcee7){_0x51f5fd['account']=_0xfbcee7;if(_0x51f5fd[_0x5553('0x88')]&&_0x51f5fd[_0x5553('0x88')]['type']==='sinch'&&_0x1fb52b[_0x5553('0x68')][_0x5553('0x89')]){if(_0x1fb52b[_0x5553('0x68')][_0x5553('0x89')][_0x5553('0x5f')]===0x0)return;if(_0x1fb52b[_0x5553('0x68')][_0x5553('0x89')][0x0][_0x5553('0x8a')]!==_0x5553('0x8b'))return;return db[_0x5553('0x8c')]['update']({'read':!![],'readAt':_0x1fb52b[_0x5553('0x68')][_0x5553('0x89')][0x0][_0x5553('0x8d')]},{'where':{'messageId':_0x1fb52b[_0x5553('0x68')][_0x5553('0x89')][0x0][_0x5553('0x8e')]},'individualHooks':!![]})[_0x5553('0x3b')](function(_0x225c7e){return _0x4aedcb[_0x5553('0x34')](0xc8)['json'](_0x225c7e);});}_0x51f5fd[_0x5553('0x8f')]=_[_0x5553('0x90')](_0xfbcee7['Applications'],[_0x5553('0x91')],[_0x5553('0x92')]);if(_0x51f5fd[_0x5553('0x88')][_0x5553('0x87')]){delete _0x51f5fd[_0x5553('0x88')][_0x5553('0x87')];}return db[_0x5553('0x93')]['describe']()[_0x5553('0x3b')](function(_0x179666){if(!_0x179666){throw new db[(_0x5553('0x94'))][(_0x5553('0x95'))](_0x5553('0x96'));}_0x50b405=_[_0x5553('0x97')](_[_0x5553('0x5e')](_0x179666),[_0x5553('0x98'),'updatedAt']);_0x37a21b=_['difference'](_[_0x5553('0x5e')](_0x179666),[_0x5553('0x98'),_0x5553('0x99'),_0x5553('0x9a'),'ListId']);_0x51f5fd[_0x5553('0x68')]={'mapKey':_0x5553('0x9b')};if(_0x51f5fd[_0x5553('0x88')]&&_0x51f5fd[_0x5553('0x88')][_0x5553('0x47')]===_0x5553('0x9c')){_0x51f5fd[_0x5553('0x68')][_0x5553('0x9d')]=_0x1fb52b['body'][_0x5553('0x9e')]['replace'](_0x5553('0x9f'),'');_0x51f5fd[_0x5553('0x68')][_0x5553('0x68')]=_0x1fb52b[_0x5553('0x68')]['Body'];_0x51f5fd[_0x5553('0x68')][_0x5553('0xa0')]=_0x1fb52b[_0x5553('0x68')]['MessageSid'];}if(_0x51f5fd[_0x5553('0x88')]&&_0x51f5fd['account'][_0x5553('0x47')]===_0x5553('0xa1')){_0x51f5fd[_0x5553('0x68')][_0x5553('0x9d')]=_0x1fb52b['body'][_0x5553('0xa2')][0x0][_0x5553('0x9d')];_0x51f5fd[_0x5553('0x68')]['body']=_0x1fb52b[_0x5553('0x68')][_0x5553('0xa2')][0x0][_0x5553('0x2c')][_0x5553('0x68')];_0x51f5fd['body']['messageId']=_0x1fb52b[_0x5553('0x68')]['notifications'][0x0]['message_id'];}if(_0x51f5fd[_0x5553('0x68')]['id']){delete _0x51f5fd[_0x5553('0x68')]['id'];}if(_[_0x5553('0xa3')](_0x51f5fd['body']['from'])){throw new db['Sequelize'][(_0x5553('0x95'))](_0x5553('0xa4'));}if(_[_0x5553('0xa3')](_0x51f5fd[_0x5553('0x68')][_0x5553('0x68')])||_0x51f5fd[_0x5553('0x68')][_0x5553('0x68')]===''){throw new db['Sequelize']['ValidationError'](_0x5553('0xa5'));}if(_[_0x5553('0xa3')](_0x51f5fd[_0x5553('0x68')]['mapKey'])){throw new db['Sequelize'][(_0x5553('0x95'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x37a21b);}if(!_['includes'](_0x37a21b,_0x51f5fd[_0x5553('0x68')][_0x5553('0xa6')])){throw new db[(_0x5553('0x94'))][(_0x5553('0x95'))](_0x5553('0xa7')+_0x37a21b);}_0x3a0df9[_0x51f5fd[_0x5553('0x68')][_0x5553('0xa6')]]=_0x51f5fd[_0x5553('0x68')][_0x5553('0x9d')];return db[_0x5553('0xa8')][_0x5553('0x60')]({'where':{'id':_0x51f5fd[_0x5553('0x88')]['ListId']},'include':[{'model':db[_0x5553('0x93')],'as':_0x5553('0xa9'),'where':_0x3a0df9,'limit':0x1,'order':[[_0x5553('0x99'),_0x5553('0xaa')]]}]});})[_0x5553('0x3b')](handleEntityNotFound(_0x4aedcb,null))['then'](function(_0x387d4a){if(_0x387d4a){_0x51f5fd[_0x5553('0xab')]=_[_0x5553('0xac')](_0x387d4a,['Contacts']);if(_0x387d4a[_0x5553('0xa9')][_0x5553('0x5f')]){return _0x387d4a[_0x5553('0xa9')][0x0];}var _0x1ceb1c=_[_0x5553('0x1b')](_0x51f5fd[_0x5553('0x68')],{'firstName':_0x51f5fd['body'][_0x5553('0x9d')],'ListId':_0x387d4a['id']});_0x1ceb1c[_0x51f5fd[_0x5553('0x68')]['mapKey']]=_0x51f5fd[_0x5553('0x68')]['from'];return db[_0x5553('0x93')][_0x5553('0x61')](_0x1ceb1c,{'fields':_0x50b405,'raw':!![]});}})['then'](handleEntityNotFound(_0x4aedcb,null))[_0x5553('0x3b')](function(_0x34e8d5){if(_0x34e8d5){_0x51f5fd[_0x5553('0xad')]=_0x34e8d5;var _0x39a1d7={'ContactId':_0x34e8d5['id'],'phone':_0x51f5fd[_0x5553('0x68')][_0x5553('0x9d')],'WhatsappAccountId':_0x1fb52b[_0x5553('0x5c')]['id']};var _0x1b5257={'ContactId':_0x34e8d5['id'],'WhatsappAccountId':_0x1fb52b[_0x5553('0x5c')]['id'],'closed':![]};return db[_0x5553('0xae')][_0x5553('0x60')]({'where':_0x1b5257})[_0x5553('0x3b')](function(_0x42f4c7){if(_0x42f4c7){return[_0x42f4c7,![]];}return db[_0x5553('0xae')][_0x5553('0x61')](_0x39a1d7)['then'](function(_0x5d89be){return[_0x5d89be,!![]];});});}})[_0x5553('0x78')](function(_0x11af2a,_0x3ae32a){_0x51f5fd[_0x5553('0xaf')]=_0x11af2a[_0x5553('0x3d')]({'plain':!![]});_0x51f5fd[_0x5553('0xaf')][_0x5553('0xb0')]=![];if(_0x3ae32a){if(_0x51f5fd[_0x5553('0x88')][_0x5553('0xb1')]){_0x51f5fd[_0x5553('0x8f')]['push']({'id':0x0,'priority':_0x51f5fd[_0x5553('0x8f')][_0x5553('0x5f')]+0x1,'app':_0x5553('0xb2'),'appdata':_0x5553('0xb3'),'interval':_0x5553('0xb4')});}_0x51f5fd['interaction'][_0x5553('0xb0')]=!![];}return db['WhatsappMessage'][_0x5553('0x61')]({'phone':_0x51f5fd[_0x5553('0x68')][_0x5553('0x9d')],'messageId':_0x51f5fd[_0x5553('0x68')][_0x5553('0xa0')],'body':_0x51f5fd[_0x5553('0x68')][_0x5553('0x68')],'WhatsappAccountId':_0x1fb52b[_0x5553('0x5c')]['id'],'WhatsappInteractionId':_0x11af2a['id'],'direction':'in','ContactId':_0x11af2a['ContactId'],'AttachmentId':_0x51f5fd[_0x5553('0x68')]['AttachmentId']});})['then'](function(_0x42078a){_0x51f5fd['message']=_0x42078a;if(_0x51f5fd[_0x5553('0xaf')][_0x5553('0xb5')]){return db[_0x5553('0xb6')][_0x5553('0x60')]({'attributes':['id',_0x5553('0x41')],'where':{'id':_0x51f5fd[_0x5553('0xaf')]['UserId']}})[_0x5553('0x3b')](function(_0x3b7194){if(_0x3b7194){_0x51f5fd['applications'][_0x5553('0xb7')]({'id':0x0,'priority':0x0,'app':_0x5553('0xb8'),'appdata':_0x3b7194[_0x5553('0x41')]+','+(_0x51f5fd[_0x5553('0x88')][_0x5553('0xb9')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0x5553('0xba'),_0x51f5fd);});}return respondWithRpcPromise(_0x5553('0xbb'),'startRouting',_0x51f5fd);})[_0x5553('0x3b')](function(_0x5984c4){if(_0x5984c4){var _0x3c508b=0xc8;var _0x2b0f91=_0x5553('0xbc');logger[_0x5553('0x24')](_0x5553('0x28'),_0x2b0f91,_0x3c508b,_0x5553('0xbd'));logger[_0x5553('0x27')]('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x2b0f91,_0x3c508b,_0x5553('0xbd'),JSON[_0x5553('0x29')](_0x5984c4));if(_0x51f5fd[_0x5553('0x88')][_0x5553('0x47')]==='twilio'){return _0x4aedcb[_0x5553('0x34')](_0x3c508b)[_0x5553('0x35')](_0x5553('0xbe'),_0x5553('0xbf'))['send'](_0x5553('0xc0'));}else{return _0x4aedcb[_0x5553('0x34')](_0x3c508b)['json'](_0x5984c4);}}});})[_0x5553('0x2e')](handleError(_0x4aedcb,null));};exports['send']=function(_0x54c7ba,_0x24b5e7,_0xce5a79){var _0x5890dc,_0x35c43d,_0x3ed84a;if(_[_0x5553('0xa3')](_0x54c7ba[_0x5553('0x68')][_0x5553('0x68')])||_0x54c7ba[_0x5553('0x68')][_0x5553('0x68')]===''){throw new db[(_0x5553('0x94'))]['ValidationError'](_0x5553('0xa5'));}if(_[_0x5553('0xa3')](_0x54c7ba['body']['to'])){throw new db[(_0x5553('0x94'))][(_0x5553('0x95'))]('to\x20is\x20mandatory');}_0x5890dc=_0x54c7ba[_0x5553('0x68')]['to'];return db[_0x5553('0x44')][_0x5553('0x60')]({'where':{'id':_0x54c7ba[_0x5553('0x5c')]['id']},'include':[{'model':db[_0x5553('0xa8')],'as':_0x5553('0xc1'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'mobile':_0x5890dc},'limit':0x1,'order':[[_0x5553('0x99'),_0x5553('0xaa')]]}]}]})[_0x5553('0x3b')](handleEntityNotFound(_0x24b5e7,null))[_0x5553('0x3b')](function(_0x1a512b){if(_0x1a512b&&_0x1a512b[_0x5553('0xc1')]){_0x35c43d=_0x1a512b['get']({'plain':!![]});if(_0x35c43d[_0x5553('0xc1')]&&_0x35c43d[_0x5553('0xc1')][_0x5553('0xa9')]['length']){return _0x35c43d[_0x5553('0xc1')]['Contacts'][0x0];}return db[_0x5553('0x93')][_0x5553('0x61')](_['defaults'](_0x54c7ba[_0x5553('0x68')],{'firstName':_0x5890dc,'mobile':_0x5890dc,'phone':_0x5890dc,'ListId':_0x35c43d[_0x5553('0xc2')]}));}})['then'](handleEntityNotFound(_0x24b5e7,null))[_0x5553('0x3b')](function(_0x36c544){if(_0x36c544){_0x3ed84a=_0x36c544;return db[_0x5553('0xae')][_0x5553('0x60')]({'where':{'ContactId':_0x3ed84a['id'],'closed':![],'WhatsappAccountId':_0x35c43d['id']}})[_0x5553('0x3b')](function(_0x2eea8f){if(_0x2eea8f){return[_0x2eea8f,![]];}return db['WhatsappInteraction'][_0x5553('0x61')]({'UserId':_0x54c7ba[_0x5553('0x62')]['id'],'ContactId':_0x3ed84a['id'],'WhatsappAccountId':_0x35c43d['id'],'phone':_0x5890dc,'firstMsgDirection':'out','Messages':[_[_0x5553('0x56')](_0x54c7ba[_0x5553('0x68')],{'read':![],'body':_0x54c7ba[_0x5553('0x68')][_0x5553('0x68')],'phone':_0x5890dc,'WhatsappAccountId':_0x35c43d['id'],'UserId':_0x54c7ba[_0x5553('0x62')]['id'],'ContactId':_0x3ed84a['id']})]},{'include':[{'model':db[_0x5553('0x8c')],'as':_0x5553('0xc3')}]})[_0x5553('0x3b')](function(_0x58ad2d){return[_0x58ad2d,!![]];});});}})['spread'](function(_0x6299a7,_0x1a26ee){if(_0x1a26ee){return _0x6299a7;}return db[_0x5553('0x8c')][_0x5553('0x61')](_[_0x5553('0x56')](_0x54c7ba[_0x5553('0x68')],{'read':![],'body':_0x54c7ba[_0x5553('0x68')][_0x5553('0x68')],'phone':_0x5890dc,'WhatsappAccountId':_0x35c43d['id'],'WhatsappInteractionId':_0x6299a7['id'],'UserId':_0x54c7ba[_0x5553('0x62')]['id'],'ContactId':_0x3ed84a['id']}))['then'](function(_0xb72509){_0x6299a7[_0x5553('0xc4')][_0x5553('0xc3')]=[];_0x6299a7[_0x5553('0xc4')][_0x5553('0xc3')][_0x5553('0xc5')](_0xb72509[_0x5553('0xc4')]);return _0x6299a7;});})[_0x5553('0x3b')](respondWithResult(_0x24b5e7,null))[_0x5553('0x2e')](handleError(_0x24b5e7,null));}; \ No newline at end of file +var _0x1274=['ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','addAgents','omit','userWhatsappAccount:save','removeAgents','isArray','emit','userWhatsappAccount:remove','User','getAgents','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','priority','finally','send','getApplications','notify','whatsapp','Applications','account','statuses','state','WhatsappMessage','update','message_id','applications','orderBy','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','CompanyId','mobile','twilio','replace','whatsapp:','Body','messageId','sinch','from','notifications','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','Contacts','DESC','list','defaults','contact','WhatsappInteraction','spread','created','autoclose','push','unmanaged','*,*,*,*','interaction','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','Start','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','List','updatedAt','out','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','WhatsappAccounts','UserProfileResource','sendStatus','stack','name','index','map','WhatsappAccount','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','mandatoryDispositionPause','include','find','create','body','user','get','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Pause','describe','WhatsappAccountId','Disposition','findOne','order','removeDispositions'];(function(_0xaaa60e,_0x571366){var _0x3dfdae=function(_0x438d70){while(--_0x438d70){_0xaaa60e['push'](_0xaaa60e['shift']());}};_0x3dfdae(++_0x571366);}(_0x1274,0x127));var _0x4127=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1274[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x4127('0x0'));var rimraf=require(_0x4127('0x1'));var zipdir=require(_0x4127('0x2'));var jsonpatch=require(_0x4127('0x3'));var rp=require(_0x4127('0x4'));var moment=require(_0x4127('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4127('0x6'));var util=require('util');var path=require(_0x4127('0x7'));var sox=require(_0x4127('0x8'));var csv=require(_0x4127('0x9'));var ejs=require(_0x4127('0xa'));var fs=require('fs');var fs_extra=require(_0x4127('0xb'));var _=require(_0x4127('0xc'));var squel=require(_0x4127('0xd'));var crypto=require(_0x4127('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x4127('0xf'));var toCsv=require(_0x4127('0x9'));var querystring=require(_0x4127('0x10'));var Papa=require(_0x4127('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4127('0x12'));var hardwareService=require(_0x4127('0x13'));var logger=require(_0x4127('0x14'))(_0x4127('0x15'));var utils=require(_0x4127('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x4127('0x17'));var db=require(_0x4127('0x18'))['db'];config['redis']=_['defaults'](config[_0x4127('0x19')],{'host':_0x4127('0x1a'),'port':0x18eb});var socket=require(_0x4127('0x1b'))(new Redis(config['redis']));require(_0x4127('0x1c'))[_0x4127('0x1d')](socket);var jayson=require(_0x4127('0x1e'));var client=jayson[_0x4127('0x1f')][_0x4127('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x2503cb,_0x3f9477,_0x58e80b,_0x3a244f){return new BPromise(function(_0x1cb51d,_0x17f0d7){var _0x3ee7b1=_0x3a244f||client;return _0x3ee7b1[_0x4127('0x21')](_0x2503cb,_0x58e80b)[_0x4127('0x22')](function(_0x56ee72){logger[_0x4127('0x23')](_0x4127('0x24'),_0x3f9477,_0x4127('0x25'));logger[_0x4127('0x26')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x3f9477,_0x4127('0x25'),JSON[_0x4127('0x27')](_0x56ee72));if(_0x56ee72[_0x4127('0x28')]){if(_0x56ee72[_0x4127('0x28')]['code']===0x1f4){logger[_0x4127('0x28')](_0x4127('0x24'),_0x3f9477,_0x56ee72[_0x4127('0x28')]['message']);return _0x17f0d7(_0x56ee72['error']['message']);}logger[_0x4127('0x28')](_0x4127('0x24'),_0x3f9477,_0x56ee72[_0x4127('0x28')][_0x4127('0x29')]);return _0x1cb51d(_0x56ee72[_0x4127('0x28')][_0x4127('0x29')]);}else{logger[_0x4127('0x23')](_0x4127('0x24'),_0x3f9477,'request\x20sent');_0x1cb51d(_0x56ee72[_0x4127('0x2a')][_0x4127('0x29')]);}})[_0x4127('0x2b')](function(_0x378e19){logger[_0x4127('0x28')](_0x4127('0x24'),_0x3f9477,_0x378e19);_0x17f0d7(_0x378e19);});});}function respondWithStatusCode(_0x187718,_0x49121f){_0x49121f=_0x49121f||0xcc;return function(_0x225515){if(_0x225515){return _0x187718['sendStatus'](_0x49121f);}return _0x187718[_0x4127('0x2c')](_0x49121f)[_0x4127('0x2d')]();};}function respondWithResult(_0x48b06e,_0x454151){_0x454151=_0x454151||0xc8;return function(_0x4d4dd6){if(_0x4d4dd6){return _0x48b06e[_0x4127('0x2c')](_0x454151)[_0x4127('0x2e')](_0x4d4dd6);}};}function respondWithFilteredResult(_0x5f04d8,_0x1b346f){return function(_0x4dd7a2){if(_0x4dd7a2){var _0x1b17b1=typeof _0x1b346f[_0x4127('0x2f')]===_0x4127('0x30')&&typeof _0x1b346f[_0x4127('0x31')]===_0x4127('0x30');var _0x16ae1e=_0x4dd7a2[_0x4127('0x32')];var _0x5513fd=_0x1b17b1?0x0:_0x1b346f[_0x4127('0x2f')];var _0x464746=_0x1b17b1?_0x4dd7a2[_0x4127('0x32')]:_0x1b346f[_0x4127('0x2f')]+_0x1b346f[_0x4127('0x31')];var _0x391b5e;if(_0x464746>=_0x16ae1e){_0x464746=_0x16ae1e;_0x391b5e=0xc8;}else{_0x391b5e=0xce;}_0x5f04d8[_0x4127('0x2c')](_0x391b5e);return _0x5f04d8[_0x4127('0x33')](_0x4127('0x34'),_0x5513fd+'-'+_0x464746+'/'+_0x16ae1e)[_0x4127('0x2e')](_0x4dd7a2);}return null;};}function patchUpdates(_0x15ae51){return function(_0x3f0747){try{jsonpatch[_0x4127('0x35')](_0x3f0747,_0x15ae51,!![]);}catch(_0x550e06){return BPromise[_0x4127('0x36')](_0x550e06);}return _0x3f0747[_0x4127('0x37')]();};}function saveUpdates(_0x33adc4,_0x4ab9b1){return function(_0x5b6e4d){if(_0x5b6e4d){return _0x5b6e4d['update'](_0x33adc4)[_0x4127('0x22')](function(_0x407097){return _0x407097;});}return null;};}function removeEntity(_0x5dc452,_0x4d0af5){return function(_0x530638){if(_0x530638){return _0x530638[_0x4127('0x38')]()[_0x4127('0x22')](function(){var _0x2ea1e7=_0x530638['get']({'plain':!![]});var _0x277820=_0x4127('0x39');return db[_0x4127('0x3a')]['destroy']({'where':{'type':_0x277820,'resourceId':_0x2ea1e7['id']}})[_0x4127('0x22')](function(){return _0x530638;});})[_0x4127('0x22')](function(){_0x5dc452[_0x4127('0x2c')](0xcc)[_0x4127('0x2d')]();});}};}function handleEntityNotFound(_0xebc9c,_0x45f010){return function(_0x445c8a){if(!_0x445c8a){_0xebc9c[_0x4127('0x3b')](0x194);}return _0x445c8a;};}function handleError(_0x15b586,_0xe9d168){_0xe9d168=_0xe9d168||0x1f4;return function(_0x5150ab){logger['error'](_0x5150ab[_0x4127('0x3c')]);if(_0x5150ab[_0x4127('0x3d')]){delete _0x5150ab[_0x4127('0x3d')];}_0x15b586[_0x4127('0x2c')](_0xe9d168)['send'](_0x5150ab);};}exports[_0x4127('0x3e')]=function(_0x1c8486,_0x43e3ed){var _0x109d8e={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x2a7efd={},_0x2c2762={'count':0x0,'rows':[]};var _0x2bcb6f=_[_0x4127('0x3f')](db[_0x4127('0x40')][_0x4127('0x41')],function(_0x497a05){return{'name':_0x497a05[_0x4127('0x42')],'type':_0x497a05[_0x4127('0x43')][_0x4127('0x44')]};});_0x2a7efd[_0x4127('0x45')]=_[_0x4127('0x3f')](_0x2bcb6f,'name');_0x2a7efd[_0x4127('0x46')]=_[_0x4127('0x47')](_0x1c8486['query']);_0x2a7efd['filters']=_[_0x4127('0x48')](_0x2a7efd[_0x4127('0x45')],_0x2a7efd['query']);_0x109d8e['attributes']=_['intersection'](_0x2a7efd['model'],qs[_0x4127('0x49')](_0x1c8486[_0x4127('0x46')][_0x4127('0x49')]));_0x109d8e['attributes']=_0x109d8e[_0x4127('0x4a')][_0x4127('0x4b')]?_0x109d8e['attributes']:_0x2a7efd[_0x4127('0x45')];if(!_0x1c8486[_0x4127('0x46')][_0x4127('0x4c')](_0x4127('0x4d'))){_0x109d8e[_0x4127('0x31')]=qs[_0x4127('0x31')](_0x1c8486[_0x4127('0x46')][_0x4127('0x31')]);_0x109d8e[_0x4127('0x2f')]=qs[_0x4127('0x2f')](_0x1c8486[_0x4127('0x46')][_0x4127('0x2f')]);}_0x109d8e['order']=qs[_0x4127('0x4e')](_0x1c8486['query'][_0x4127('0x4e')]);_0x109d8e[_0x4127('0x4f')]=qs[_0x4127('0x50')](_[_0x4127('0x51')](_0x1c8486[_0x4127('0x46')],_0x2a7efd[_0x4127('0x50')]),_0x2bcb6f);if(_0x1c8486[_0x4127('0x46')][_0x4127('0x52')]){_0x109d8e[_0x4127('0x4f')]=_[_0x4127('0x53')](_0x109d8e['where'],{'$or':_[_0x4127('0x3f')](_0x2bcb6f,function(_0x7e70c4){if(_0x7e70c4[_0x4127('0x43')]!==_0x4127('0x54')){var _0x2b74e6={};_0x2b74e6[_0x7e70c4[_0x4127('0x3d')]]={'$like':'%'+_0x1c8486[_0x4127('0x46')][_0x4127('0x52')]+'%'};return _0x2b74e6;}})});}_0x109d8e=_['merge']({},_0x109d8e,_0x1c8486[_0x4127('0x55')]);var _0x34a459={'where':_0x109d8e[_0x4127('0x4f')]};return db[_0x4127('0x40')][_0x4127('0x32')](_0x34a459)[_0x4127('0x22')](function(_0x539a96){_0x2c2762[_0x4127('0x32')]=_0x539a96;if(_0x1c8486[_0x4127('0x46')][_0x4127('0x56')]){_0x109d8e['include']=[{'all':!![]}];}return db['WhatsappAccount'][_0x4127('0x57')](_0x109d8e);})[_0x4127('0x22')](function(_0x2a1986){_0x2c2762[_0x4127('0x58')]=_0x2a1986;return _0x2c2762;})['then'](respondWithFilteredResult(_0x43e3ed,_0x109d8e))[_0x4127('0x2b')](handleError(_0x43e3ed,null));};exports[_0x4127('0x59')]=function(_0x499d27,_0x2b1e1f){var _0x280bd0={'raw':![],'where':{'id':_0x499d27[_0x4127('0x5a')]['id']},'include':[{'model':db['Pause'],'as':_0x4127('0x5b')}]},_0x1ce9c8={};_0x1ce9c8['model']=_[_0x4127('0x47')](db['WhatsappAccount'][_0x4127('0x41')]);_0x1ce9c8['query']=_[_0x4127('0x47')](_0x499d27['query']);_0x1ce9c8[_0x4127('0x50')]=_[_0x4127('0x48')](_0x1ce9c8['model'],_0x1ce9c8['query']);_0x280bd0[_0x4127('0x4a')]=_['intersection'](_0x1ce9c8[_0x4127('0x45')],qs['fields'](_0x499d27[_0x4127('0x46')][_0x4127('0x49')]));_0x280bd0[_0x4127('0x4a')]=_0x280bd0[_0x4127('0x4a')][_0x4127('0x4b')]?_0x280bd0[_0x4127('0x4a')]:_0x1ce9c8[_0x4127('0x45')];if(_0x499d27['query'][_0x4127('0x56')]){_0x280bd0[_0x4127('0x5c')]=[{'all':!![]}];}_0x280bd0=_[_0x4127('0x53')]({},_0x280bd0,_0x499d27[_0x4127('0x55')]);return db[_0x4127('0x40')][_0x4127('0x5d')](_0x280bd0)[_0x4127('0x22')](handleEntityNotFound(_0x2b1e1f,null))[_0x4127('0x22')](respondWithResult(_0x2b1e1f,null))[_0x4127('0x2b')](handleError(_0x2b1e1f,null));};exports['create']=function(_0xf3983e,_0x59f2c7){return db[_0x4127('0x40')][_0x4127('0x5e')](_0xf3983e[_0x4127('0x5f')],{})[_0x4127('0x22')](function(_0x4018ef){var _0x1e6682=_0xf3983e[_0x4127('0x60')][_0x4127('0x61')]({'plain':!![]});if(!_0x1e6682)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1e6682[_0x4127('0x62')]==='user'){var _0x2edafa=_0x4018ef[_0x4127('0x61')]({'plain':!![]});var _0x4be613=_0x4127('0x39');return db[_0x4127('0x63')][_0x4127('0x5d')]({'where':{'name':_0x4be613,'userProfileId':_0x1e6682[_0x4127('0x64')]},'raw':!![]})[_0x4127('0x22')](function(_0x4b1964){if(_0x4b1964&&_0x4b1964['autoAssociation']===0x0){return db[_0x4127('0x3a')][_0x4127('0x5e')]({'name':_0x2edafa[_0x4127('0x3d')],'resourceId':_0x2edafa['id'],'type':_0x4b1964[_0x4127('0x3d')],'sectionId':_0x4b1964['id']},{})[_0x4127('0x22')](function(){return _0x4018ef;});}else{return _0x4018ef;}})['catch'](function(_0x10bfdc){logger[_0x4127('0x28')](_0x4127('0x65'),_0x10bfdc);throw _0x10bfdc;});}return _0x4018ef;})[_0x4127('0x22')](respondWithResult(_0x59f2c7,0xc9))[_0x4127('0x2b')](handleError(_0x59f2c7,null));};exports['update']=function(_0x32111a,_0x2b7eb7){if(_0x32111a[_0x4127('0x5f')]['id']){delete _0x32111a[_0x4127('0x5f')]['id'];}return db[_0x4127('0x40')]['find']({'where':{'id':_0x32111a[_0x4127('0x5a')]['id']},'include':[{'model':db[_0x4127('0x66')],'as':_0x4127('0x5b')}]})[_0x4127('0x22')](handleEntityNotFound(_0x2b7eb7,null))[_0x4127('0x22')](saveUpdates(_0x32111a[_0x4127('0x5f')],null))[_0x4127('0x22')](respondWithResult(_0x2b7eb7,null))[_0x4127('0x2b')](handleError(_0x2b7eb7,null));};exports[_0x4127('0x38')]=function(_0x149f49,_0x46de23){return db[_0x4127('0x40')]['find']({'where':{'id':_0x149f49[_0x4127('0x5a')]['id']}})[_0x4127('0x22')](handleEntityNotFound(_0x46de23,null))[_0x4127('0x22')](removeEntity(_0x46de23,null))['catch'](handleError(_0x46de23,null));};exports[_0x4127('0x67')]=function(_0x5926b2,_0x5b9a61){return db[_0x4127('0x40')][_0x4127('0x67')]()['then'](respondWithResult(_0x5b9a61,null))['catch'](handleError(_0x5b9a61,null));};exports['addDisposition']=function(_0x4b3491,_0x1595de,_0x565e38){if(_0x4b3491[_0x4127('0x5f')]['id']){delete _0x4b3491[_0x4127('0x5f')]['id'];}return db[_0x4127('0x40')]['find']({'where':{'id':_0x4b3491[_0x4127('0x5a')]['id']}})[_0x4127('0x22')](handleEntityNotFound(_0x1595de,null))[_0x4127('0x22')](function(_0x13ae42){if(_0x13ae42){_0x4b3491[_0x4127('0x5f')][_0x4127('0x68')]=_0x13ae42['id'];return db[_0x4127('0x69')][_0x4127('0x5e')](_0x4b3491[_0x4127('0x5f')]);}})[_0x4127('0x22')](respondWithResult(_0x1595de,null))[_0x4127('0x2b')](handleError(_0x1595de,null));};exports['getDispositions']=function(_0x3b4731,_0xfaf5bf,_0x1725e4){var _0x249189={'raw':![],'where':{}};var _0x4b773={};var _0x1e4952={'count':0x0,'rows':[]};return db[_0x4127('0x40')][_0x4127('0x6a')]({'where':{'id':_0x3b4731[_0x4127('0x5a')]['id']}})[_0x4127('0x22')](handleEntityNotFound(_0xfaf5bf,null))[_0x4127('0x22')](function(_0x12f924){if(_0x12f924){_0x4b773[_0x4127('0x45')]=_[_0x4127('0x47')](db[_0x4127('0x69')][_0x4127('0x41')]);_0x4b773[_0x4127('0x46')]=_[_0x4127('0x47')](_0x3b4731[_0x4127('0x46')]);_0x4b773[_0x4127('0x50')]=_['intersection'](_0x4b773[_0x4127('0x45')],_0x4b773[_0x4127('0x46')]);_0x249189[_0x4127('0x4a')]=_[_0x4127('0x48')](_0x4b773[_0x4127('0x45')],qs['fields'](_0x3b4731[_0x4127('0x46')][_0x4127('0x49')]));_0x249189[_0x4127('0x4a')]=_0x249189['attributes'][_0x4127('0x4b')]?_0x249189[_0x4127('0x4a')]:_0x4b773[_0x4127('0x45')];if(!_0x3b4731[_0x4127('0x46')]['hasOwnProperty']('nolimit')){_0x249189[_0x4127('0x31')]=qs[_0x4127('0x31')](_0x3b4731['query'][_0x4127('0x31')]);_0x249189[_0x4127('0x2f')]=qs[_0x4127('0x2f')](_0x3b4731['query'][_0x4127('0x2f')]);}_0x249189[_0x4127('0x6b')]=qs[_0x4127('0x4e')](_0x3b4731[_0x4127('0x46')][_0x4127('0x4e')]);_0x249189[_0x4127('0x4f')]=qs['filters'](_[_0x4127('0x51')](_0x3b4731[_0x4127('0x46')],_0x4b773[_0x4127('0x50')]));_0x249189['where'][_0x4127('0x68')]=_0x12f924['id'];if(_0x3b4731[_0x4127('0x46')][_0x4127('0x52')]){_0x249189[_0x4127('0x4f')]=_[_0x4127('0x53')](_0x249189[_0x4127('0x4f')],{'$or':_[_0x4127('0x3f')](_0x249189['attributes'],function(_0x1fa7a1){var _0x2235fd={};_0x2235fd[_0x1fa7a1]={'$like':'%'+_0x3b4731[_0x4127('0x46')]['filter']+'%'};return _0x2235fd;})});}_0x249189=_[_0x4127('0x53')]({},_0x249189,_0x3b4731[_0x4127('0x55')]);return db['Disposition'][_0x4127('0x32')]({'where':_0x249189['where']})[_0x4127('0x22')](function(_0x18753e){_0x1e4952[_0x4127('0x32')]=_0x18753e;if(_0x3b4731[_0x4127('0x46')][_0x4127('0x56')]){_0x249189[_0x4127('0x5c')]=[{'all':!![]}];}return db[_0x4127('0x69')]['findAll'](_0x249189);})['then'](function(_0x275dbb){_0x1e4952['rows']=_0x275dbb;return _0x1e4952;});}})[_0x4127('0x22')](respondWithFilteredResult(_0xfaf5bf,_0x249189))[_0x4127('0x2b')](handleError(_0xfaf5bf,null));};exports[_0x4127('0x6c')]=function(_0x411759,_0x3e6175,_0x31a190){return db[_0x4127('0x40')]['find']({'where':{'id':_0x411759[_0x4127('0x5a')]['id']}})[_0x4127('0x22')](handleEntityNotFound(_0x3e6175,null))['then'](function(_0x1ea663){if(_0x1ea663){return _0x1ea663[_0x4127('0x6c')](_0x411759[_0x4127('0x46')][_0x4127('0x6d')]);}})[_0x4127('0x22')](respondWithStatusCode(_0x3e6175,null))[_0x4127('0x2b')](handleError(_0x3e6175,null));};exports[_0x4127('0x6e')]=function(_0x1581a1,_0x42fc94,_0x90079a){if(_0x1581a1[_0x4127('0x5f')]['id']){delete _0x1581a1[_0x4127('0x5f')]['id'];}return db[_0x4127('0x40')][_0x4127('0x5d')]({'where':{'id':_0x1581a1['params']['id']}})[_0x4127('0x22')](handleEntityNotFound(_0x42fc94,null))[_0x4127('0x22')](function(_0x8b132e){if(_0x8b132e){_0x1581a1[_0x4127('0x5f')][_0x4127('0x68')]=_0x8b132e['id'];return db['CannedAnswer'][_0x4127('0x5e')](_0x1581a1['body']);}})[_0x4127('0x22')](respondWithResult(_0x42fc94,null))[_0x4127('0x2b')](handleError(_0x42fc94,null));};exports[_0x4127('0x6f')]=function(_0x232aca,_0x16f97d,_0x21bf36){var _0x3fc6c2={'raw':![],'where':{}};var _0x514d50={};var _0x592a2c={'count':0x0,'rows':[]};return db[_0x4127('0x40')][_0x4127('0x6a')]({'where':{'id':_0x232aca[_0x4127('0x5a')]['id']}})['then'](handleEntityNotFound(_0x16f97d,null))[_0x4127('0x22')](function(_0x3a91c0){if(_0x3a91c0){_0x514d50[_0x4127('0x45')]=_[_0x4127('0x47')](db[_0x4127('0x70')][_0x4127('0x41')]);_0x514d50[_0x4127('0x46')]=_['keys'](_0x232aca['query']);_0x514d50[_0x4127('0x50')]=_[_0x4127('0x48')](_0x514d50[_0x4127('0x45')],_0x514d50[_0x4127('0x46')]);_0x3fc6c2['attributes']=_[_0x4127('0x48')](_0x514d50['model'],qs[_0x4127('0x49')](_0x232aca[_0x4127('0x46')][_0x4127('0x49')]));_0x3fc6c2[_0x4127('0x4a')]=_0x3fc6c2[_0x4127('0x4a')][_0x4127('0x4b')]?_0x3fc6c2['attributes']:_0x514d50[_0x4127('0x45')];if(!_0x232aca[_0x4127('0x46')][_0x4127('0x4c')](_0x4127('0x4d'))){_0x3fc6c2[_0x4127('0x31')]=qs[_0x4127('0x31')](_0x232aca[_0x4127('0x46')][_0x4127('0x31')]);_0x3fc6c2['offset']=qs['offset'](_0x232aca[_0x4127('0x46')][_0x4127('0x2f')]);}_0x3fc6c2[_0x4127('0x6b')]=qs[_0x4127('0x4e')](_0x232aca[_0x4127('0x46')][_0x4127('0x4e')]);_0x3fc6c2[_0x4127('0x4f')]=qs[_0x4127('0x50')](_[_0x4127('0x51')](_0x232aca[_0x4127('0x46')],_0x514d50[_0x4127('0x50')]));_0x3fc6c2[_0x4127('0x4f')][_0x4127('0x68')]=_0x3a91c0['id'];if(_0x232aca[_0x4127('0x46')][_0x4127('0x52')]){_0x3fc6c2[_0x4127('0x4f')]=_['merge'](_0x3fc6c2[_0x4127('0x4f')],{'$or':_['map'](_0x3fc6c2[_0x4127('0x4a')],function(_0x319bca){var _0x7f664f={};_0x7f664f[_0x319bca]={'$like':'%'+_0x232aca[_0x4127('0x46')][_0x4127('0x52')]+'%'};return _0x7f664f;})});}_0x3fc6c2=_[_0x4127('0x53')]({},_0x3fc6c2,_0x232aca[_0x4127('0x55')]);return db['CannedAnswer'][_0x4127('0x32')]({'where':_0x3fc6c2[_0x4127('0x4f')]})['then'](function(_0x4dff19){_0x592a2c['count']=_0x4dff19;if(_0x232aca[_0x4127('0x46')][_0x4127('0x56')]){_0x3fc6c2[_0x4127('0x5c')]=[{'all':!![]}];}return db[_0x4127('0x70')][_0x4127('0x57')](_0x3fc6c2);})[_0x4127('0x22')](function(_0x3050ef){_0x592a2c['rows']=_0x3050ef;return _0x592a2c;});}})[_0x4127('0x22')](respondWithFilteredResult(_0x16f97d,_0x3fc6c2))[_0x4127('0x2b')](handleError(_0x16f97d,null));};exports['removeAnswers']=function(_0x19b418,_0x4262bd,_0x59289c){return db[_0x4127('0x40')][_0x4127('0x5d')]({'where':{'id':_0x19b418[_0x4127('0x5a')]['id']}})['then'](handleEntityNotFound(_0x4262bd,null))['then'](function(_0x484268){if(_0x484268){return _0x484268[_0x4127('0x71')](_0x19b418[_0x4127('0x46')][_0x4127('0x6d')]);}})[_0x4127('0x22')](respondWithStatusCode(_0x4262bd,null))[_0x4127('0x2b')](handleError(_0x4262bd,null));};exports['addAgents']=function(_0x4841ff,_0x590ce2,_0x19f905){return db[_0x4127('0x40')][_0x4127('0x5d')]({'where':{'id':_0x4841ff['params']['id']}})[_0x4127('0x22')](handleEntityNotFound(_0x590ce2,null))[_0x4127('0x22')](function(_0x2693b7){if(_0x2693b7){return _0x2693b7[_0x4127('0x72')](_0x4841ff['body'][_0x4127('0x6d')],_[_0x4127('0x73')](_0x4841ff[_0x4127('0x5f')],['ids','id'])||{})['spread'](function(_0x4bdc1c){for(var _0x5f1e7d=0x0;_0x5f1e7d<_0x4841ff[_0x4127('0x5f')][_0x4127('0x6d')][_0x4127('0x4b')];_0x5f1e7d+=0x1){socket['emit'](_0x4127('0x74'),{'UserId':Number(_0x4841ff['body']['ids'][_0x5f1e7d]),'WhatsappAccountId':Number(_0x4841ff[_0x4127('0x5a')]['id'])});}return _0x4bdc1c;});}})['then'](respondWithResult(_0x590ce2,null))[_0x4127('0x2b')](handleError(_0x590ce2,null));};exports['removeAgents']=function(_0x29270f,_0x565326,_0x43a679){return db[_0x4127('0x40')][_0x4127('0x5d')]({'where':{'id':_0x29270f['params']['id']}})[_0x4127('0x22')](handleEntityNotFound(_0x565326,null))['then'](function(_0xf3e5be){if(_0xf3e5be){return _0xf3e5be[_0x4127('0x75')](_0x29270f[_0x4127('0x46')][_0x4127('0x6d')])[_0x4127('0x22')](function(){if(_[_0x4127('0x76')](_0x29270f['query'][_0x4127('0x6d')])){for(var _0x5269c6=0x0;_0x5269c6<_0x29270f[_0x4127('0x46')][_0x4127('0x6d')][_0x4127('0x4b')];_0x5269c6+=0x1){socket[_0x4127('0x77')](_0x4127('0x78'),{'UserId':Number(_0x29270f[_0x4127('0x46')][_0x4127('0x6d')][_0x5269c6]),'WhatsappAccountId':Number(_0x29270f[_0x4127('0x5a')]['id'])});}}else{socket[_0x4127('0x77')]('userWhatsappAccount:remove',{'UserId':Number(_0x29270f[_0x4127('0x46')][_0x4127('0x6d')]),'WhatsappAccountId':Number(_0x29270f[_0x4127('0x5a')]['id'])});}});}})[_0x4127('0x22')](respondWithStatusCode(_0x565326,null))[_0x4127('0x2b')](handleError(_0x565326,null));};exports['getAgents']=function(_0x1cd0d1,_0xdebe5,_0x541186){var _0x5ca4ce={};var _0x1cc841={};var _0x32a1d0;var _0x2f5e1a;return db[_0x4127('0x40')][_0x4127('0x6a')]({'where':{'id':_0x1cd0d1[_0x4127('0x5a')]['id']}})['then'](handleEntityNotFound(_0xdebe5,null))['then'](function(_0x24cc69){if(_0x24cc69){_0x32a1d0=_0x24cc69;_0x1cc841[_0x4127('0x45')]=_[_0x4127('0x47')](db[_0x4127('0x79')][_0x4127('0x41')]);_0x1cc841[_0x4127('0x46')]=_[_0x4127('0x47')](_0x1cd0d1['query']);_0x1cc841['filters']=_[_0x4127('0x48')](_0x1cc841[_0x4127('0x45')],_0x1cc841['query']);_0x5ca4ce['attributes']=_[_0x4127('0x48')](_0x1cc841[_0x4127('0x45')],qs[_0x4127('0x49')](_0x1cd0d1['query'][_0x4127('0x49')]));_0x5ca4ce['attributes']=_0x5ca4ce[_0x4127('0x4a')][_0x4127('0x4b')]?_0x5ca4ce[_0x4127('0x4a')]:_0x1cc841['model'];_0x5ca4ce[_0x4127('0x6b')]=qs[_0x4127('0x4e')](_0x1cd0d1[_0x4127('0x46')][_0x4127('0x4e')]);_0x5ca4ce['where']=qs['filters'](_[_0x4127('0x51')](_0x1cd0d1[_0x4127('0x46')],_0x1cc841[_0x4127('0x50')]));if(_0x1cd0d1[_0x4127('0x46')][_0x4127('0x52')]){_0x5ca4ce['where']=_['merge'](_0x5ca4ce[_0x4127('0x4f')],{'$or':_[_0x4127('0x3f')](_0x5ca4ce[_0x4127('0x4a')],function(_0x28df1e){var _0x29adfe={};_0x29adfe[_0x28df1e]={'$like':'%'+_0x1cd0d1[_0x4127('0x46')][_0x4127('0x52')]+'%'};return _0x29adfe;})});}_0x5ca4ce=_[_0x4127('0x53')]({},_0x5ca4ce,_0x1cd0d1[_0x4127('0x55')]);return _0x32a1d0['getAgents'](_0x5ca4ce);}})[_0x4127('0x22')](function(_0x3e8f00){if(_0x3e8f00){_0x2f5e1a=_0x3e8f00[_0x4127('0x4b')];if(!_0x1cd0d1[_0x4127('0x46')][_0x4127('0x4c')]('nolimit')){_0x5ca4ce[_0x4127('0x31')]=qs[_0x4127('0x31')](_0x1cd0d1[_0x4127('0x46')][_0x4127('0x31')]);_0x5ca4ce[_0x4127('0x2f')]=qs['offset'](_0x1cd0d1[_0x4127('0x46')][_0x4127('0x2f')]);}return _0x32a1d0[_0x4127('0x7a')](_0x5ca4ce);}})[_0x4127('0x22')](function(_0x4127a6){if(_0x4127a6){return _0x4127a6?{'count':_0x2f5e1a,'rows':_0x4127a6}:null;}})[_0x4127('0x22')](respondWithResult(_0xdebe5,null))[_0x4127('0x2b')](handleError(_0xdebe5,null));};exports[_0x4127('0x7b')]=function(_0x48cb0d,_0x5e5f75){var _0x12aa25=_0x48cb0d[_0x4127('0x5a')]['id'];var _0x4e6767=_0x48cb0d[_0x4127('0x5f')];var _0x5939d9=0xc8;var _0x2f4a8a=null;return db[_0x4127('0x7c')]['transaction']({'isolationLevel':db[_0x4127('0x7c')][_0x4127('0x7d')][_0x4127('0x7e')][_0x4127('0x7f')]},function(_0x389966){return db[_0x4127('0x40')][_0x4127('0x6a')]({'where':{'id':_0x12aa25},'transaction':_0x389966})['then'](function(_0x43abfd){if(_0x43abfd){return db[_0x4127('0x80')][_0x4127('0x38')]({'where':{'WhatsappAccountId':_0x12aa25},'transaction':_0x389966})[_0x4127('0x22')](function(){var _0x51f734=_['map'](_0x4e6767,function(_0x1313e1){_0x1313e1[_0x4127('0x68')]=_0x12aa25;return _0x1313e1;});return db[_0x4127('0x80')][_0x4127('0x81')](_0x51f734,{'transaction':_0x389966});});}else{_0x5939d9=0x194;_0x2f4a8a=[];}});})['then'](function(){if(_0x5939d9!==0x194){return db['WhatsappApplication'][_0x4127('0x82')]({'where':{'WhatsappAccountId':_0x12aa25},'order':_0x4127('0x83')})[_0x4127('0x22')](function(_0x4e33ff){_0x2f4a8a=_0x4e33ff;});}})[_0x4127('0x2b')](function(_0x4c5c14){_0x5939d9=0x1f4;logger[_0x4127('0x28')](_0x4c5c14[_0x4127('0x3c')]);if(_0x4c5c14[_0x4127('0x3d')]){delete _0x4c5c14[_0x4127('0x3d')];}_0x2f4a8a=_0x4c5c14;})[_0x4127('0x84')](function(){if(_0x2f4a8a===null){_0x5e5f75['sendStatus'](_0x5939d9);}else{if(_0x5939d9===0x1f4){_0x5e5f75[_0x4127('0x2c')](_0x5939d9)[_0x4127('0x85')](_0x2f4a8a);}else{_0x5e5f75[_0x4127('0x2c')](_0x5939d9)[_0x4127('0x2e')](_0x2f4a8a);}}});};exports[_0x4127('0x86')]=function(_0x592579,_0x334e56,_0x4567b5){var _0x332e76={};var _0xcaabe3={};var _0x104b66;var _0x27a5c1;return db['WhatsappAccount'][_0x4127('0x6a')]({'where':{'id':_0x592579['params']['id']}})['then'](handleEntityNotFound(_0x334e56,null))[_0x4127('0x22')](function(_0x4e8a84){if(_0x4e8a84){_0x104b66=_0x4e8a84;_0xcaabe3[_0x4127('0x45')]=_[_0x4127('0x47')](db[_0x4127('0x80')][_0x4127('0x41')]);_0xcaabe3[_0x4127('0x46')]=_[_0x4127('0x47')](_0x592579[_0x4127('0x46')]);_0xcaabe3[_0x4127('0x50')]=_[_0x4127('0x48')](_0xcaabe3[_0x4127('0x45')],_0xcaabe3[_0x4127('0x46')]);_0x332e76['attributes']=_[_0x4127('0x48')](_0xcaabe3[_0x4127('0x45')],qs['fields'](_0x592579[_0x4127('0x46')][_0x4127('0x49')]));_0x332e76[_0x4127('0x4a')]=_0x332e76['attributes'][_0x4127('0x4b')]?_0x332e76['attributes']:_0xcaabe3[_0x4127('0x45')];_0x332e76[_0x4127('0x6b')]=qs[_0x4127('0x4e')](_0x592579[_0x4127('0x46')][_0x4127('0x4e')]);_0x332e76['where']=qs[_0x4127('0x50')](_['pick'](_0x592579[_0x4127('0x46')],_0xcaabe3[_0x4127('0x50')]));if(_0x592579[_0x4127('0x46')][_0x4127('0x52')]){_0x332e76[_0x4127('0x4f')]=_['merge'](_0x332e76['where'],{'$or':_['map'](_0x332e76[_0x4127('0x4a')],function(_0x11a035){var _0x2896ab={};_0x2896ab[_0x11a035]={'$like':'%'+_0x592579[_0x4127('0x46')][_0x4127('0x52')]+'%'};return _0x2896ab;})});}_0x332e76=_['merge']({},_0x332e76,_0x592579['options']);return _0x104b66[_0x4127('0x86')](_0x332e76);}})['then'](function(_0x293a7c){if(_0x293a7c){_0x27a5c1=_0x293a7c[_0x4127('0x4b')];if(!_0x592579['query'][_0x4127('0x4c')](_0x4127('0x4d'))){_0x332e76[_0x4127('0x31')]=qs['limit'](_0x592579[_0x4127('0x46')][_0x4127('0x31')]);_0x332e76[_0x4127('0x2f')]=qs[_0x4127('0x2f')](_0x592579[_0x4127('0x46')][_0x4127('0x2f')]);}return _0x104b66[_0x4127('0x86')](_0x332e76);}})[_0x4127('0x22')](function(_0x2887e1){if(_0x2887e1){return _0x2887e1?{'count':_0x27a5c1,'rows':_0x2887e1}:null;}})[_0x4127('0x22')](respondWithResult(_0x334e56,null))['catch'](handleError(_0x334e56,null));};exports[_0x4127('0x87')]=function(_0x74711,_0x53061e,_0x13dd42){var _0x99932f={'channel':_0x4127('0x88')};var _0x5b1a47=[];var _0x3eee4a=[];var _0x6cdc63={};return db['WhatsappAccount'][_0x4127('0x5d')]({'where':{'id':_0x74711[_0x4127('0x5a')]['id']},'include':[{'model':db[_0x4127('0x80')],'as':_0x4127('0x89')}]})[_0x4127('0x22')](handleEntityNotFound(_0x53061e,null))[_0x4127('0x22')](function(_0x56f1af){_0x99932f['account']=_0x56f1af;if(_0x99932f[_0x4127('0x8a')]&&_0x99932f[_0x4127('0x8a')][_0x4127('0x43')]==='sinch'&&_0x74711[_0x4127('0x5f')][_0x4127('0x8b')]){if(_0x74711[_0x4127('0x5f')]['statuses'][_0x4127('0x4b')]===0x0)return;if(_0x74711[_0x4127('0x5f')]['statuses'][0x0][_0x4127('0x8c')]!=='read')return;return db[_0x4127('0x8d')][_0x4127('0x8e')]({'read':!![],'readAt':_0x74711['body'][_0x4127('0x8b')][0x0]['timestamp']},{'where':{'messageId':_0x74711[_0x4127('0x5f')][_0x4127('0x8b')][0x0][_0x4127('0x8f')]},'individualHooks':!![]})['then'](function(_0x2908b9){return _0x53061e[_0x4127('0x2c')](0xc8)['json'](_0x2908b9);});}_0x99932f[_0x4127('0x90')]=_[_0x4127('0x91')](_0x56f1af[_0x4127('0x89')],['priority'],[_0x4127('0x92')]);if(_0x99932f[_0x4127('0x8a')]['Applications']){delete _0x99932f['account'][_0x4127('0x89')];}return db[_0x4127('0x93')][_0x4127('0x67')]()['then'](function(_0x5a65c3){if(!_0x5a65c3){throw new db[(_0x4127('0x94'))][(_0x4127('0x95'))](_0x4127('0x96'));}_0x5b1a47=_[_0x4127('0x97')](_[_0x4127('0x47')](_0x5a65c3),[_0x4127('0x98'),'updatedAt']);_0x3eee4a=_[_0x4127('0x97')](_['keys'](_0x5a65c3),[_0x4127('0x98'),'updatedAt',_0x4127('0x99'),'ListId']);_0x99932f['body']={'mapKey':_0x4127('0x9a')};if(_0x99932f[_0x4127('0x8a')]&&_0x99932f[_0x4127('0x8a')][_0x4127('0x43')]===_0x4127('0x9b')){_0x99932f['body']['from']=_0x74711[_0x4127('0x5f')]['From'][_0x4127('0x9c')](_0x4127('0x9d'),'');_0x99932f[_0x4127('0x5f')][_0x4127('0x5f')]=_0x74711[_0x4127('0x5f')][_0x4127('0x9e')];_0x99932f[_0x4127('0x5f')][_0x4127('0x9f')]=_0x74711[_0x4127('0x5f')]['MessageSid'];}if(_0x99932f[_0x4127('0x8a')]&&_0x99932f[_0x4127('0x8a')]['type']===_0x4127('0xa0')){_0x99932f[_0x4127('0x5f')][_0x4127('0xa1')]=_0x74711['body'][_0x4127('0xa2')][0x0][_0x4127('0xa1')];_0x99932f[_0x4127('0x5f')][_0x4127('0x5f')]=_0x74711[_0x4127('0x5f')][_0x4127('0xa2')][0x0]['message'][_0x4127('0x5f')];_0x99932f[_0x4127('0x5f')][_0x4127('0x9f')]=_0x74711[_0x4127('0x5f')][_0x4127('0xa2')][0x0][_0x4127('0x8f')];}if(_0x99932f['body']['id']){delete _0x99932f[_0x4127('0x5f')]['id'];}if(_[_0x4127('0xa3')](_0x99932f[_0x4127('0x5f')][_0x4127('0xa1')])){throw new db['Sequelize'][(_0x4127('0x95'))](_0x4127('0xa4'));}if(_['isNil'](_0x99932f[_0x4127('0x5f')][_0x4127('0x5f')])||_0x99932f[_0x4127('0x5f')][_0x4127('0x5f')]===''){throw new db[(_0x4127('0x94'))][(_0x4127('0x95'))](_0x4127('0xa5'));}if(_[_0x4127('0xa3')](_0x99932f[_0x4127('0x5f')][_0x4127('0xa6')])){throw new db[(_0x4127('0x94'))]['ValidationError'](_0x4127('0xa7')+_0x3eee4a);}if(!_['includes'](_0x3eee4a,_0x99932f[_0x4127('0x5f')][_0x4127('0xa6')])){throw new db[(_0x4127('0x94'))][(_0x4127('0x95'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3eee4a);}_0x6cdc63[_0x99932f['body']['mapKey']]=_0x99932f[_0x4127('0x5f')]['from'];return db[_0x4127('0xa8')][_0x4127('0x5d')]({'where':{'id':_0x99932f[_0x4127('0x8a')][_0x4127('0xa9')]},'include':[{'model':db[_0x4127('0x93')],'as':_0x4127('0xaa'),'where':_0x6cdc63,'limit':0x1,'order':[['updatedAt',_0x4127('0xab')]]}]});})[_0x4127('0x22')](handleEntityNotFound(_0x53061e,null))['then'](function(_0xfb829f){if(_0xfb829f){_0x99932f[_0x4127('0xac')]=_[_0x4127('0x73')](_0xfb829f,['Contacts']);if(_0xfb829f[_0x4127('0xaa')][_0x4127('0x4b')]){return _0xfb829f[_0x4127('0xaa')][0x0];}var _0x186c76=_[_0x4127('0xad')](_0x99932f[_0x4127('0x5f')],{'firstName':_0x99932f['body'][_0x4127('0xa1')],'ListId':_0xfb829f['id']});_0x186c76[_0x99932f['body'][_0x4127('0xa6')]]=_0x99932f[_0x4127('0x5f')][_0x4127('0xa1')];return db[_0x4127('0x93')]['create'](_0x186c76,{'fields':_0x5b1a47,'raw':!![]});}})[_0x4127('0x22')](handleEntityNotFound(_0x53061e,null))[_0x4127('0x22')](function(_0x471269){if(_0x471269){_0x99932f[_0x4127('0xae')]=_0x471269;var _0x3fa8e7={'ContactId':_0x471269['id'],'phone':_0x99932f['body'][_0x4127('0xa1')],'WhatsappAccountId':_0x74711[_0x4127('0x5a')]['id']};var _0x2d9e53={'ContactId':_0x471269['id'],'WhatsappAccountId':_0x74711['params']['id'],'closed':![]};return db[_0x4127('0xaf')][_0x4127('0x5d')]({'where':_0x2d9e53})['then'](function(_0x353826){if(_0x353826){return[_0x353826,![]];}return db[_0x4127('0xaf')][_0x4127('0x5e')](_0x3fa8e7)[_0x4127('0x22')](function(_0x36419b){return[_0x36419b,!![]];});});}})[_0x4127('0xb0')](function(_0x187f7a,_0x1bfab6){_0x99932f['interaction']=_0x187f7a[_0x4127('0x61')]({'plain':!![]});_0x99932f['interaction'][_0x4127('0xb1')]=![];if(_0x1bfab6){if(_0x99932f['account'][_0x4127('0xb2')]){_0x99932f['applications'][_0x4127('0xb3')]({'id':0x0,'priority':_0x99932f['applications'][_0x4127('0x4b')]+0x1,'app':'close','appdata':_0x4127('0xb4'),'interval':_0x4127('0xb5')});}_0x99932f[_0x4127('0xb6')][_0x4127('0xb1')]=!![];}return db['WhatsappMessage'][_0x4127('0x5e')]({'phone':_0x99932f[_0x4127('0x5f')][_0x4127('0xa1')],'messageId':_0x99932f[_0x4127('0x5f')]['messageId'],'body':_0x99932f[_0x4127('0x5f')][_0x4127('0x5f')],'WhatsappAccountId':_0x74711[_0x4127('0x5a')]['id'],'WhatsappInteractionId':_0x187f7a['id'],'direction':'in','ContactId':_0x187f7a['ContactId'],'AttachmentId':_0x99932f[_0x4127('0x5f')][_0x4127('0xb7')]});})['then'](function(_0x429d0d){_0x99932f[_0x4127('0x29')]=_0x429d0d;if(_0x99932f[_0x4127('0xb6')][_0x4127('0xb8')]){return db[_0x4127('0x79')][_0x4127('0x5d')]({'attributes':['id','name'],'where':{'id':_0x99932f[_0x4127('0xb6')][_0x4127('0xb8')]}})[_0x4127('0x22')](function(_0x1bd366){if(_0x1bd366){_0x99932f['applications'][_0x4127('0xb9')]({'id':0x0,'priority':0x0,'app':_0x4127('0xba'),'appdata':_0x1bd366['name']+','+(_0x99932f[_0x4127('0x8a')][_0x4127('0xbb')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x4127('0xbc'),'startRouting',_0x99932f);});}return respondWithRpcPromise('Start','startRouting',_0x99932f);})[_0x4127('0x22')](function(_0x35ca4b){if(_0x35ca4b){var _0xec1168=0xc8;var _0x12ee13=_0x4127('0xbd');logger['info'](_0x4127('0xbe'),_0x12ee13,_0xec1168,_0x4127('0xbf'));logger[_0x4127('0x26')](_0x4127('0xc0'),_0x12ee13,_0xec1168,'entity\x20found',JSON['stringify'](_0x35ca4b));if(_0x99932f['account'][_0x4127('0x43')]===_0x4127('0x9b')){return _0x53061e[_0x4127('0x2c')](_0xec1168)['set'](_0x4127('0xc1'),_0x4127('0xc2'))[_0x4127('0x85')](_0x4127('0xc3'));}else{return _0x53061e[_0x4127('0x2c')](_0xec1168)[_0x4127('0x2e')](_0x35ca4b);}}});})[_0x4127('0x2b')](handleError(_0x53061e,null));};exports[_0x4127('0x85')]=function(_0xb284e,_0x48d374,_0x39b4f1){var _0x5d82ee,_0x57bc57,_0x110814;if(_[_0x4127('0xa3')](_0xb284e['body'][_0x4127('0x5f')])||_0xb284e[_0x4127('0x5f')][_0x4127('0x5f')]===''){throw new db[(_0x4127('0x94'))][(_0x4127('0x95'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x4127('0xa3')](_0xb284e['body']['to'])){throw new db[(_0x4127('0x94'))]['ValidationError'](_0x4127('0xc4'));}_0x5d82ee=_0xb284e['body']['to'];return db['WhatsappAccount'][_0x4127('0x5d')]({'where':{'id':_0xb284e[_0x4127('0x5a')]['id']},'include':[{'model':db[_0x4127('0xa8')],'as':_0x4127('0xc5'),'include':[{'model':db[_0x4127('0x93')],'as':_0x4127('0xaa'),'where':{'mobile':_0x5d82ee},'limit':0x1,'order':[[_0x4127('0xc6'),_0x4127('0xab')]]}]}]})[_0x4127('0x22')](handleEntityNotFound(_0x48d374,null))[_0x4127('0x22')](function(_0x5d6005){if(_0x5d6005&&_0x5d6005['List']){_0x57bc57=_0x5d6005[_0x4127('0x61')]({'plain':!![]});if(_0x57bc57['List']&&_0x57bc57[_0x4127('0xc5')][_0x4127('0xaa')][_0x4127('0x4b')]){return _0x57bc57[_0x4127('0xc5')]['Contacts'][0x0];}return db[_0x4127('0x93')][_0x4127('0x5e')](_[_0x4127('0xad')](_0xb284e[_0x4127('0x5f')],{'firstName':_0x5d82ee,'mobile':_0x5d82ee,'phone':_0x5d82ee,'ListId':_0x57bc57[_0x4127('0xa9')]}));}})['then'](handleEntityNotFound(_0x48d374,null))[_0x4127('0x22')](function(_0x584a10){if(_0x584a10){_0x110814=_0x584a10;return db[_0x4127('0xaf')]['find']({'where':{'ContactId':_0x110814['id'],'closed':![],'WhatsappAccountId':_0x57bc57['id']}})[_0x4127('0x22')](function(_0xbf6267){if(_0xbf6267){return[_0xbf6267,![]];}return db[_0x4127('0xaf')][_0x4127('0x5e')]({'UserId':_0xb284e[_0x4127('0x60')]['id'],'ContactId':_0x110814['id'],'WhatsappAccountId':_0x57bc57['id'],'phone':_0x5d82ee,'firstMsgDirection':_0x4127('0xc7'),'Messages':[_['merge'](_0xb284e[_0x4127('0x5f')],{'read':![],'body':_0xb284e[_0x4127('0x5f')][_0x4127('0x5f')],'phone':_0x5d82ee,'WhatsappAccountId':_0x57bc57['id'],'UserId':_0xb284e[_0x4127('0x60')]['id'],'ContactId':_0x110814['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':_0x4127('0xc8')}]})[_0x4127('0x22')](function(_0x2df088){return[_0x2df088,!![]];});});}})[_0x4127('0xb0')](function(_0x34b46e,_0x1412dd){if(_0x1412dd){return _0x34b46e;}return db[_0x4127('0x8d')]['create'](_[_0x4127('0x53')](_0xb284e['body'],{'read':![],'body':_0xb284e[_0x4127('0x5f')][_0x4127('0x5f')],'phone':_0x5d82ee,'WhatsappAccountId':_0x57bc57['id'],'WhatsappInteractionId':_0x34b46e['id'],'UserId':_0xb284e[_0x4127('0x60')]['id'],'ContactId':_0x110814['id']}))[_0x4127('0x22')](function(_0x362bf3){_0x34b46e[_0x4127('0xc9')][_0x4127('0xc8')]=[];_0x34b46e['dataValues'][_0x4127('0xc8')][_0x4127('0xb3')](_0x362bf3['dataValues']);return _0x34b46e;});})[_0x4127('0x22')](respondWithResult(_0x48d374,null))[_0x4127('0x2b')](handleError(_0x48d374,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 35bce5c..65afb86 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 _0x6fbb=['emit','hasOwnProperty','hook','exports','../../mysqldb','WhatsappAccount','setMaxListeners','save','update','remove'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x6fbb,0xc2));var _0xb6fb=function(_0x431067,_0x28598e){_0x431067=_0x431067-0x0;var _0x355a84=_0x6fbb[_0x431067];return _0x355a84;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0xb6fb('0x0'))['db'][_0xb6fb('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xb6fb('0x2')](0x0);var events={'afterCreate':_0xb6fb('0x3'),'afterUpdate':_0xb6fb('0x4'),'afterDestroy':_0xb6fb('0x5')};function emitEvent(_0x3be57c){return function(_0x4dc6a0,_0x24268c,_0x334fc2){WhatsappAccountEvents[_0xb6fb('0x6')](_0x3be57c+':'+_0x4dc6a0['id'],_0x4dc6a0);WhatsappAccountEvents['emit'](_0x3be57c,_0x4dc6a0);_0x334fc2(null);};}for(var e in events){if(events[_0xb6fb('0x7')](e)){var event=events[e];WhatsappAccount[_0xb6fb('0x8')](e,emitEvent(event));}}module[_0xb6fb('0x9')]=WhatsappAccountEvents; \ No newline at end of file +var _0x0131=['setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x567a03,_0x4dcf21){var _0x2440a3=function(_0x18416f){while(--_0x18416f){_0x567a03['push'](_0x567a03['shift']());}};_0x2440a3(++_0x4dcf21);}(_0x0131,0xb7));var _0x1013=function(_0x56138f,_0x1e9ebb){_0x56138f=_0x56138f-0x0;var _0x1acaf7=_0x0131[_0x56138f];return _0x1acaf7;};'use strict';var EventEmitter=require(_0x1013('0x0'));var WhatsappAccount=require('../../mysqldb')['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x1013('0x1')](0x0);var events={'afterCreate':_0x1013('0x2'),'afterUpdate':_0x1013('0x3'),'afterDestroy':_0x1013('0x4')};function emitEvent(_0x41b524){return function(_0x56bffa,_0x203f44,_0x1e686e){WhatsappAccountEvents[_0x1013('0x5')](_0x41b524+':'+_0x56bffa['id'],_0x56bffa);WhatsappAccountEvents[_0x1013('0x5')](_0x41b524,_0x56bffa);_0x1e686e(null);};}for(var e in events){if(events[_0x1013('0x6')](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module[_0x1013('0x7')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 1e6ebe4..f6c2f89 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 _0x50b2=['whatsapp_accounts','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','exports','define','WhatsappAccount'];(function(_0x4b856e,_0x21636e){var _0x41b8c1=function(_0x22efa9){while(--_0x22efa9){_0x4b856e['push'](_0x4b856e['shift']());}};_0x41b8c1(++_0x21636e);}(_0x50b2,0x1e5));var _0x250b=function(_0x19faae,_0x5697bc){_0x19faae=_0x19faae-0x0;var _0x363543=_0x50b2[_0x19faae];return _0x363543;};'use strict';var _=require('lodash');var util=require(_0x250b('0x0'));var logger=require(_0x250b('0x1'))('api');var moment=require(_0x250b('0x2'));var BPromise=require(_0x250b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x250b('0x4'));var rimraf=require(_0x250b('0x5'));var config=require(_0x250b('0x6'));var attributes=require('./whatsappAccount.attributes');module[_0x250b('0x7')]=function(_0x4a25e3,_0x2ee4e3){return _0x4a25e3[_0x250b('0x8')](_0x250b('0x9'),attributes,{'tableName':_0x250b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb017=['exports','WhatsappAccount','whatsapp_accounts','lodash','util','api','moment','bluebird','path','rimraf','./whatsappAccount.attributes'];(function(_0x458140,_0x20964a){var _0x5e4ba1=function(_0x240ca4){while(--_0x240ca4){_0x458140['push'](_0x458140['shift']());}};_0x5e4ba1(++_0x20964a);}(_0xb017,0xbe));var _0x7b01=function(_0x4db5e4,_0x746d42){_0x4db5e4=_0x4db5e4-0x0;var _0x5033bc=_0xb017[_0x4db5e4];return _0x5033bc;};'use strict';var _=require(_0x7b01('0x0'));var util=require(_0x7b01('0x1'));var logger=require('../../config/logger')(_0x7b01('0x2'));var moment=require(_0x7b01('0x3'));var BPromise=require(_0x7b01('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7b01('0x5'));var rimraf=require(_0x7b01('0x6'));var config=require('../../config/environment');var attributes=require(_0x7b01('0x7'));module[_0x7b01('0x8')]=function(_0x1b57c5,_0x497f93){return _0x1b57c5['define'](_0x7b01('0x9'),attributes,{'tableName':_0x7b01('0xa'),'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 670cd5b..3c5bf04 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 _0x666f=['WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','WhatsappAccount','find','options','raw','where','attributes','include','map','model','ShowWhatsappAccount','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','http','defaults','redis','localhost','socket.io-emitter','request','then','info'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x666f,0x110));var _0xf666=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x666f[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0xf666('0x0'));var util=require(_0xf666('0x1'));var moment=require('moment');var BPromise=require(_0xf666('0x2'));var rs=require(_0xf666('0x3'));var fs=require('fs');var Redis=require(_0xf666('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf666('0x5'));var logger=require('../../config/logger')(_0xf666('0x6'));var config=require(_0xf666('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf666('0x8')]({'port':0x232a});config['redis']=_[_0xf666('0x9')](config[_0xf666('0xa')],{'host':_0xf666('0xb'),'port':0x18eb});var socket=require(_0xf666('0xc'))(new Redis(config[_0xf666('0xa')]));require('./whatsappAccount.socket')['register'](socket);function respondWithRpcPromise(_0x39596a,_0x58d908,_0x3e5d99){return new BPromise(function(_0x362854,_0x225d6f){return client[_0xf666('0xd')](_0x39596a,_0x3e5d99)[_0xf666('0xe')](function(_0x574e28){logger[_0xf666('0xf')](_0xf666('0x10'),_0x58d908,_0xf666('0x11'));logger[_0xf666('0x12')](_0xf666('0x13'),_0x58d908,_0xf666('0x11'),JSON[_0xf666('0x14')](_0x574e28));if(_0x574e28[_0xf666('0x15')]){if(_0x574e28[_0xf666('0x15')][_0xf666('0x16')]===0x1f4){logger[_0xf666('0x15')]('WhatsappAccount,\x20%s,\x20%s',_0x58d908,_0x574e28['error'][_0xf666('0x17')]);return _0x225d6f(_0x574e28[_0xf666('0x15')][_0xf666('0x17')]);}logger[_0xf666('0x15')]('WhatsappAccount,\x20%s,\x20%s',_0x58d908,_0x574e28['error']['message']);return _0x362854(_0x574e28[_0xf666('0x15')][_0xf666('0x17')]);}else{logger[_0xf666('0xf')]('WhatsappAccount,\x20%s,\x20%s',_0x58d908,_0xf666('0x11'));_0x362854(_0x574e28[_0xf666('0x18')][_0xf666('0x17')]);}})[_0xf666('0x19')](function(_0x2f2454){logger[_0xf666('0x15')](_0xf666('0x10'),_0x58d908,_0x2f2454);_0x225d6f(_0x2f2454);});});}exports['ShowWhatsappAccount']=function(_0x4f7f26){var _0x5c90bd=this;return new Promise(function(_0x24b9f8,_0x3fb34a){return db[_0xf666('0x1a')][_0xf666('0x1b')]({'raw':_0x4f7f26[_0xf666('0x1c')]?_0x4f7f26[_0xf666('0x1c')][_0xf666('0x1d')]===undefined?!![]:![]:!![],'where':_0x4f7f26[_0xf666('0x1c')]?_0x4f7f26[_0xf666('0x1c')][_0xf666('0x1e')]||null:null,'attributes':_0x4f7f26[_0xf666('0x1c')]?_0x4f7f26[_0xf666('0x1c')][_0xf666('0x1f')]||null:null,'include':_0x4f7f26[_0xf666('0x1c')]?_0x4f7f26[_0xf666('0x1c')][_0xf666('0x20')]?_[_0xf666('0x21')](_0x4f7f26[_0xf666('0x1c')][_0xf666('0x20')],function(_0x481f48){return{'model':db[_0x481f48[_0xf666('0x22')]],'as':_0x481f48['as'],'attributes':_0x481f48[_0xf666('0x1f')],'include':_0x481f48[_0xf666('0x20')]?_[_0xf666('0x21')](_0x481f48[_0xf666('0x20')],function(_0x117931){return{'model':db[_0x117931[_0xf666('0x22')]],'as':_0x117931['as'],'attributes':_0x117931[_0xf666('0x1f')],'include':_0x117931['include']?_['map'](_0x117931[_0xf666('0x20')],function(_0x463d2c){return{'model':db[_0x463d2c['model']],'as':_0x463d2c['as'],'attributes':_0x463d2c[_0xf666('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1a05b9){logger[_0xf666('0xf')](_0xf666('0x23'),_0x4f7f26);logger[_0xf666('0x12')](_0xf666('0x23'),_0x4f7f26,JSON[_0xf666('0x14')](_0x1a05b9));_0x24b9f8(_0x1a05b9);})['catch'](function(_0x53b02c){logger[_0xf666('0x15')](_0xf666('0x23'),_0x53b02c[_0xf666('0x17')],_0x4f7f26);_0x3fb34a(_0x5c90bd[_0xf666('0x15')](0x1f4,_0x53b02c['message']));});});}; \ No newline at end of file +var _0xdb18=['catch','WhatsappAccount','find','options','raw','attributes','include','map','model','then','ShowWhatsappAccount','debug','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x158f3a,_0x55fa08){var _0x1ee566=function(_0x578f1f){while(--_0x578f1f){_0x158f3a['push'](_0x158f3a['shift']());}};_0x1ee566(++_0x55fa08);}(_0xdb18,0x1e0));var _0x8db1=function(_0x4e9e44,_0x387069){_0x4e9e44=_0x4e9e44-0x0;var _0x1b0a87=_0xdb18[_0x4e9e44];return _0x1b0a87;};'use strict';var _=require(_0x8db1('0x0'));var util=require(_0x8db1('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8db1('0x2'));var fs=require('fs');var Redis=require(_0x8db1('0x3'));var db=require(_0x8db1('0x4'))['db'];var utils=require(_0x8db1('0x5'));var logger=require(_0x8db1('0x6'))(_0x8db1('0x7'));var config=require(_0x8db1('0x8'));var jayson=require(_0x8db1('0x9'));var client=jayson[_0x8db1('0xa')][_0x8db1('0xb')]({'port':0x232a});config[_0x8db1('0xc')]=_[_0x8db1('0xd')](config[_0x8db1('0xc')],{'host':_0x8db1('0xe'),'port':0x18eb});var socket=require(_0x8db1('0xf'))(new Redis(config['redis']));require('./whatsappAccount.socket')[_0x8db1('0x10')](socket);function respondWithRpcPromise(_0x3b58eb,_0x6da13c,_0x3884e6){return new BPromise(function(_0x400e8d,_0x37f69e){return client[_0x8db1('0x11')](_0x3b58eb,_0x3884e6)['then'](function(_0x683fd3){logger[_0x8db1('0x12')](_0x8db1('0x13'),_0x6da13c,_0x8db1('0x14'));logger['debug'](_0x8db1('0x15'),_0x6da13c,_0x8db1('0x14'),JSON[_0x8db1('0x16')](_0x683fd3));if(_0x683fd3['error']){if(_0x683fd3[_0x8db1('0x17')][_0x8db1('0x18')]===0x1f4){logger[_0x8db1('0x17')](_0x8db1('0x13'),_0x6da13c,_0x683fd3['error'][_0x8db1('0x19')]);return _0x37f69e(_0x683fd3[_0x8db1('0x17')]['message']);}logger['error'](_0x8db1('0x13'),_0x6da13c,_0x683fd3[_0x8db1('0x17')][_0x8db1('0x19')]);return _0x400e8d(_0x683fd3[_0x8db1('0x17')][_0x8db1('0x19')]);}else{logger[_0x8db1('0x12')](_0x8db1('0x13'),_0x6da13c,'request\x20sent');_0x400e8d(_0x683fd3[_0x8db1('0x1a')][_0x8db1('0x19')]);}})[_0x8db1('0x1b')](function(_0x2c13b1){logger[_0x8db1('0x17')](_0x8db1('0x13'),_0x6da13c,_0x2c13b1);_0x37f69e(_0x2c13b1);});});}exports['ShowWhatsappAccount']=function(_0xab6480){var _0x238ab3=this;return new Promise(function(_0x536132,_0x44f2e3){return db[_0x8db1('0x1c')][_0x8db1('0x1d')]({'raw':_0xab6480[_0x8db1('0x1e')]?_0xab6480['options'][_0x8db1('0x1f')]===undefined?!![]:![]:!![],'where':_0xab6480[_0x8db1('0x1e')]?_0xab6480['options']['where']||null:null,'attributes':_0xab6480['options']?_0xab6480[_0x8db1('0x1e')][_0x8db1('0x20')]||null:null,'include':_0xab6480['options']?_0xab6480[_0x8db1('0x1e')][_0x8db1('0x21')]?_[_0x8db1('0x22')](_0xab6480[_0x8db1('0x1e')][_0x8db1('0x21')],function(_0x3a77a6){return{'model':db[_0x3a77a6[_0x8db1('0x23')]],'as':_0x3a77a6['as'],'attributes':_0x3a77a6['attributes'],'include':_0x3a77a6[_0x8db1('0x21')]?_['map'](_0x3a77a6['include'],function(_0x250dcc){return{'model':db[_0x250dcc[_0x8db1('0x23')]],'as':_0x250dcc['as'],'attributes':_0x250dcc[_0x8db1('0x20')],'include':_0x250dcc['include']?_[_0x8db1('0x22')](_0x250dcc[_0x8db1('0x21')],function(_0xac0294){return{'model':db[_0xac0294[_0x8db1('0x23')]],'as':_0xac0294['as'],'attributes':_0xac0294[_0x8db1('0x20')]};}):[]};}):[]};}):[]:[]})[_0x8db1('0x24')](function(_0x560bcb){logger[_0x8db1('0x12')](_0x8db1('0x25'),_0xab6480);logger[_0x8db1('0x26')](_0x8db1('0x25'),_0xab6480,JSON[_0x8db1('0x16')](_0x560bcb));_0x536132(_0x560bcb);})[_0x8db1('0x1b')](function(_0x2e3083){logger['error'](_0x8db1('0x25'),_0x2e3083[_0x8db1('0x19')],_0xab6480);_0x44f2e3(_0x238ab3['error'](0x1f4,_0x2e3083['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 7008a5c..2f8d4c3 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 _0xd418=['register','whatsappAccount:','remove','update','emit'];(function(_0x4429e0,_0xee6f1f){var _0x51a5b3=function(_0x16eb11){while(--_0x16eb11){_0x4429e0['push'](_0x4429e0['shift']());}};_0x51a5b3(++_0xee6f1f);}(_0xd418,0x75));var _0x8d41=function(_0x18d3a2,_0x425380){_0x18d3a2=_0x18d3a2-0x0;var _0x499885=_0xd418[_0x18d3a2];return _0x499885;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=['save',_0x8d41('0x0'),_0x8d41('0x1')];function createListener(_0x55973a,_0x1756e4){return function(_0x248439){_0x1756e4[_0x8d41('0x2')](_0x55973a,_0x248439);};}function removeListener(_0x4a65a7,_0x62072e){return function(){WhatsappAccountEvents['removeListener'](_0x4a65a7,_0x62072e);};}exports[_0x8d41('0x3')]=function(_0x11e843){for(var _0x3576e1=0x0,_0x5e4f00=events['length'];_0x3576e1<_0x5e4f00;_0x3576e1++){var _0x3fda7e=events[_0x3576e1];var _0x5739ef=createListener(_0x8d41('0x4')+_0x3fda7e,_0x11e843);WhatsappAccountEvents['on'](_0x3fda7e,_0x5739ef);}}; \ No newline at end of file +var _0x583e=['whatsappAccount:','./whatsappAccount.events','save','remove','update','removeListener','length'];(function(_0x170b0b,_0x4aa600){var _0x33cd22=function(_0x35263c){while(--_0x35263c){_0x170b0b['push'](_0x170b0b['shift']());}};_0x33cd22(++_0x4aa600);}(_0x583e,0xbe));var _0xe583=function(_0x397694,_0x4e36ef){_0x397694=_0x397694-0x0;var _0x59dcae=_0x583e[_0x397694];return _0x59dcae;};'use strict';var WhatsappAccountEvents=require(_0xe583('0x0'));var events=[_0xe583('0x1'),_0xe583('0x2'),_0xe583('0x3')];function createListener(_0x4e28d7,_0x2ab5fc){return function(_0x4687a1){_0x2ab5fc['emit'](_0x4e28d7,_0x4687a1);};}function removeListener(_0x16ec8a,_0x26cbe1){return function(){WhatsappAccountEvents[_0xe583('0x4')](_0x16ec8a,_0x26cbe1);};}exports['register']=function(_0xa111e8){for(var _0x1bbb91=0x0,_0x3085d9=events[_0xe583('0x5')];_0x1bbb91<_0x3085d9;_0x1bbb91++){var _0x5074cf=events[_0x1bbb91];var _0x3198c8=createListener(_0xe583('0x6')+_0x5074cf,_0xa111e8);WhatsappAccountEvents['on'](_0x5074cf,_0x3198c8);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 3c3f56a..da76a40 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 _0x3124=['isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer','path','Router','../../components/auth/service','../../components/interaction/service','get'];(function(_0x5b5ef8,_0x3f7000){var _0x185118=function(_0x13bfdd){while(--_0x13bfdd){_0x5b5ef8['push'](_0x5b5ef8['shift']());}};_0x185118(++_0x3f7000);}(_0x3124,0x17a));var _0x4312=function(_0x5a9ea9,_0x243c2b){_0x5a9ea9=_0x5a9ea9-0x0;var _0x5b8375=_0x3124[_0x5a9ea9];return _0x5b8375;};'use strict';var multer=require(_0x4312('0x0'));var util=require('util');var path=require(_0x4312('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4312('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x4312('0x3'));var interaction=require(_0x4312('0x4'));var config=require('../../config/environment');var controller=require('./whatsappApplication.controller');router[_0x4312('0x5')]('/',auth[_0x4312('0x6')](),controller['index']);router[_0x4312('0x5')](_0x4312('0x7'),auth[_0x4312('0x6')](),controller[_0x4312('0x8')]);router[_0x4312('0x9')]('/',auth['isAuthenticated'](),controller[_0x4312('0xa')]);router[_0x4312('0xb')](_0x4312('0x7'),auth['isAuthenticated'](),controller[_0x4312('0xc')]);router[_0x4312('0xd')](_0x4312('0x7'),auth['isAuthenticated'](),controller[_0x4312('0xe')]);module[_0x4312('0xf')]=router; \ No newline at end of file +var _0xfc24=['/:id','isAuthenticated','show','post','create','update','destroy','exports','multer','path','Router','../../components/auth/service','../../config/environment','./whatsappApplication.controller','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfc24,0x1d9));var _0x4fc2=function(_0x2962d5,_0x38deda){_0x2962d5=_0x2962d5-0x0;var _0x273406=_0xfc24[_0x2962d5];return _0x273406;};'use strict';var multer=require(_0x4fc2('0x0'));var util=require('util');var path=require(_0x4fc2('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4fc2('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x4fc2('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x4fc2('0x4'));var controller=require(_0x4fc2('0x5'));router[_0x4fc2('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x4fc2('0x6')](_0x4fc2('0x7'),auth[_0x4fc2('0x8')](),controller[_0x4fc2('0x9')]);router[_0x4fc2('0xa')]('/',auth['isAuthenticated'](),controller[_0x4fc2('0xb')]);router['put']('/:id',auth[_0x4fc2('0x8')](),controller[_0x4fc2('0xc')]);router['delete']('/:id',auth[_0x4fc2('0x8')](),controller[_0x4fc2('0xd')]);module[_0x4fc2('0xe')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 40ca90a..f8a760e 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 _0xce94=['TEXT','exports','INTEGER','STRING','noop'];(function(_0x584b15,_0x50a948){var _0x37cb80=function(_0x3c4a03){while(--_0x3c4a03){_0x584b15['push'](_0x584b15['shift']());}};_0x37cb80(++_0x50a948);}(_0xce94,0xdd));var _0x4ce9=function(_0x2fb7da,_0xa1c608){_0x2fb7da=_0x2fb7da-0x0;var _0x326ba5=_0xce94[_0x2fb7da];return _0x326ba5;};'use strict';var Sequelize=require('sequelize');module[_0x4ce9('0x0')]={'priority':{'type':Sequelize[_0x4ce9('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x4ce9('0x2')],'allowNull':![],'defaultValue':_0x4ce9('0x3')},'appdata':{'type':Sequelize[_0x4ce9('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x4ce9('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x8185=['STRING','*,*,*,*','sequelize','exports','INTEGER','noop','TEXT'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x8185,0xb8));var _0x5818=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8185[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x5818('0x0'));module[_0x5818('0x1')]={'priority':{'type':Sequelize[_0x5818('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x5818('0x3')},'appdata':{'type':Sequelize[_0x5818('0x4')]()},'description':{'type':Sequelize[_0x5818('0x5')]},'interval':{'type':Sequelize[_0x5818('0x5')],'defaultValue':_0x5818('0x6')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index eff160e..6813a3c 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 _0x5d0a=['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','undefined','offset','limit','set','Content-Range','apply','save','update','then','error','name','index','map','WhatsappApplication','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','count','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x274e84,_0x306f4e){var _0x3591b0=function(_0x59f1eb){while(--_0x59f1eb){_0x274e84['push'](_0x274e84['shift']());}};_0x3591b0(++_0x306f4e);}(_0x5d0a,0x175));var _0xa5d0=function(_0x43a44e,_0x577662){_0x43a44e=_0x43a44e-0x0;var _0x1c7c4b=_0x5d0a[_0x43a44e];return _0x1c7c4b;};'use strict';var emlformat=require(_0xa5d0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa5d0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa5d0('0x2'));var moment=require(_0xa5d0('0x3'));var BPromise=require(_0xa5d0('0x4'));var Mustache=require(_0xa5d0('0x5'));var util=require('util');var path=require(_0xa5d0('0x6'));var sox=require(_0xa5d0('0x7'));var csv=require(_0xa5d0('0x8'));var ejs=require(_0xa5d0('0x9'));var fs=require('fs');var fs_extra=require(_0xa5d0('0xa'));var _=require(_0xa5d0('0xb'));var squel=require(_0xa5d0('0xc'));var crypto=require(_0xa5d0('0xd'));var jsforce=require(_0xa5d0('0xe'));var deskjs=require(_0xa5d0('0xf'));var toCsv=require(_0xa5d0('0x8'));var querystring=require('querystring');var Papa=require(_0xa5d0('0x10'));var Redis=require(_0xa5d0('0x11'));var authService=require(_0xa5d0('0x12'));var qs=require(_0xa5d0('0x13'));var as=require(_0xa5d0('0x14'));var hardwareService=require(_0xa5d0('0x15'));var logger=require(_0xa5d0('0x16'))(_0xa5d0('0x17'));var utils=require(_0xa5d0('0x18'));var config=require(_0xa5d0('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xa5d0('0x1a'))['db'];function respondWithStatusCode(_0x4bdb6b,_0x566b17){_0x566b17=_0x566b17||0xcc;return function(_0x3ab8b9){if(_0x3ab8b9){return _0x4bdb6b[_0xa5d0('0x1b')](_0x566b17);}return _0x4bdb6b[_0xa5d0('0x1c')](_0x566b17)[_0xa5d0('0x1d')]();};}function respondWithResult(_0x4cb722,_0x56ee85){_0x56ee85=_0x56ee85||0xc8;return function(_0xf06747){if(_0xf06747){return _0x4cb722[_0xa5d0('0x1c')](_0x56ee85)[_0xa5d0('0x1e')](_0xf06747);}};}function respondWithFilteredResult(_0x22afa2,_0x3847bb){return function(_0x146722){if(_0x146722){var _0x1461d5=typeof _0x3847bb['offset']===_0xa5d0('0x1f')&&typeof _0x3847bb['limit']===_0xa5d0('0x1f');var _0x3c00fd=_0x146722['count'];var _0x5bc068=_0x1461d5?0x0:_0x3847bb[_0xa5d0('0x20')];var _0x234254=_0x1461d5?_0x146722['count']:_0x3847bb[_0xa5d0('0x20')]+_0x3847bb[_0xa5d0('0x21')];var _0x9fab4;if(_0x234254>=_0x3c00fd){_0x234254=_0x3c00fd;_0x9fab4=0xc8;}else{_0x9fab4=0xce;}_0x22afa2[_0xa5d0('0x1c')](_0x9fab4);return _0x22afa2[_0xa5d0('0x22')](_0xa5d0('0x23'),_0x5bc068+'-'+_0x234254+'/'+_0x3c00fd)['json'](_0x146722);}return null;};}function patchUpdates(_0x4cf8db){return function(_0x2a56ff){try{jsonpatch[_0xa5d0('0x24')](_0x2a56ff,_0x4cf8db,!![]);}catch(_0x4cc587){return BPromise['reject'](_0x4cc587);}return _0x2a56ff[_0xa5d0('0x25')]();};}function saveUpdates(_0x42a745,_0x27a4cb){return function(_0xde8c41){if(_0xde8c41){return _0xde8c41[_0xa5d0('0x26')](_0x42a745)[_0xa5d0('0x27')](function(_0x518a60){return _0x518a60;});}return null;};}function removeEntity(_0x2de295,_0x307377){return function(_0xefd903){if(_0xefd903){return _0xefd903['destroy']()[_0xa5d0('0x27')](function(){_0x2de295[_0xa5d0('0x1c')](0xcc)[_0xa5d0('0x1d')]();});}};}function handleEntityNotFound(_0x4d5e7a,_0x4916f6){return function(_0x758789){if(!_0x758789){_0x4d5e7a['sendStatus'](0x194);}return _0x758789;};}function handleError(_0x49ca76,_0x55cd15){_0x55cd15=_0x55cd15||0x1f4;return function(_0x2b29a5){logger[_0xa5d0('0x28')](_0x2b29a5['stack']);if(_0x2b29a5[_0xa5d0('0x29')]){delete _0x2b29a5['name'];}_0x49ca76[_0xa5d0('0x1c')](_0x55cd15)['send'](_0x2b29a5);};}exports[_0xa5d0('0x2a')]=function(_0xc3336f,_0x431fea){var _0x48dbd2={},_0x5495cb={},_0x5bcfe1={'count':0x0,'rows':[]};var _0x3d7818=_[_0xa5d0('0x2b')](db[_0xa5d0('0x2c')][_0xa5d0('0x2d')],function(_0x5e876c){return{'name':_0x5e876c[_0xa5d0('0x2e')],'type':_0x5e876c[_0xa5d0('0x2f')]['key']};});_0x5495cb[_0xa5d0('0x30')]=_[_0xa5d0('0x2b')](_0x3d7818,_0xa5d0('0x29'));_0x5495cb[_0xa5d0('0x31')]=_[_0xa5d0('0x32')](_0xc3336f[_0xa5d0('0x31')]);_0x5495cb[_0xa5d0('0x33')]=_[_0xa5d0('0x34')](_0x5495cb[_0xa5d0('0x30')],_0x5495cb[_0xa5d0('0x31')]);_0x48dbd2[_0xa5d0('0x35')]=_['intersection'](_0x5495cb[_0xa5d0('0x30')],qs[_0xa5d0('0x36')](_0xc3336f[_0xa5d0('0x31')][_0xa5d0('0x36')]));_0x48dbd2['attributes']=_0x48dbd2[_0xa5d0('0x35')][_0xa5d0('0x37')]?_0x48dbd2['attributes']:_0x5495cb[_0xa5d0('0x30')];if(!_0xc3336f['query'][_0xa5d0('0x38')](_0xa5d0('0x39'))){_0x48dbd2['limit']=qs['limit'](_0xc3336f['query'][_0xa5d0('0x21')]);_0x48dbd2['offset']=qs[_0xa5d0('0x20')](_0xc3336f[_0xa5d0('0x31')]['offset']);}_0x48dbd2[_0xa5d0('0x3a')]=qs[_0xa5d0('0x3b')](_0xc3336f[_0xa5d0('0x31')][_0xa5d0('0x3b')]);_0x48dbd2[_0xa5d0('0x3c')]=qs[_0xa5d0('0x33')](_[_0xa5d0('0x3d')](_0xc3336f[_0xa5d0('0x31')],_0x5495cb[_0xa5d0('0x33')]),_0x3d7818);if(_0xc3336f[_0xa5d0('0x31')][_0xa5d0('0x3e')]){_0x48dbd2[_0xa5d0('0x3c')]=_['merge'](_0x48dbd2[_0xa5d0('0x3c')],{'$or':_['map'](_0x3d7818,function(_0x393daf){if(_0x393daf[_0xa5d0('0x2f')]!==_0xa5d0('0x3f')){var _0x40c179={};_0x40c179[_0x393daf[_0xa5d0('0x29')]]={'$like':'%'+_0xc3336f[_0xa5d0('0x31')]['filter']+'%'};return _0x40c179;}})});}_0x48dbd2=_[_0xa5d0('0x40')]({},_0x48dbd2,_0xc3336f['options']);var _0x16fe00={'where':_0x48dbd2['where']};return db['WhatsappApplication'][_0xa5d0('0x41')](_0x16fe00)[_0xa5d0('0x27')](function(_0x249b28){_0x5bcfe1[_0xa5d0('0x41')]=_0x249b28;if(_0xc3336f['query'][_0xa5d0('0x42')]){_0x48dbd2[_0xa5d0('0x43')]=[{'all':!![]}];}return db[_0xa5d0('0x2c')][_0xa5d0('0x44')](_0x48dbd2);})[_0xa5d0('0x27')](function(_0x26d37f){_0x5bcfe1[_0xa5d0('0x45')]=_0x26d37f;return _0x5bcfe1;})['then'](respondWithFilteredResult(_0x431fea,_0x48dbd2))[_0xa5d0('0x46')](handleError(_0x431fea,null));};exports[_0xa5d0('0x47')]=function(_0x20ae65,_0x343376){var _0x1090b6={'raw':!![],'where':{'id':_0x20ae65[_0xa5d0('0x48')]['id']}},_0x358b23={};_0x358b23[_0xa5d0('0x30')]=_['keys'](db[_0xa5d0('0x2c')]['rawAttributes']);_0x358b23[_0xa5d0('0x31')]=_['keys'](_0x20ae65[_0xa5d0('0x31')]);_0x358b23['filters']=_[_0xa5d0('0x34')](_0x358b23['model'],_0x358b23[_0xa5d0('0x31')]);_0x1090b6[_0xa5d0('0x35')]=_['intersection'](_0x358b23[_0xa5d0('0x30')],qs[_0xa5d0('0x36')](_0x20ae65[_0xa5d0('0x31')][_0xa5d0('0x36')]));_0x1090b6['attributes']=_0x1090b6['attributes'][_0xa5d0('0x37')]?_0x1090b6[_0xa5d0('0x35')]:_0x358b23[_0xa5d0('0x30')];if(_0x20ae65[_0xa5d0('0x31')]['includeAll']){_0x1090b6['include']=[{'all':!![]}];}_0x1090b6=_[_0xa5d0('0x40')]({},_0x1090b6,_0x20ae65[_0xa5d0('0x49')]);return db[_0xa5d0('0x2c')][_0xa5d0('0x4a')](_0x1090b6)[_0xa5d0('0x27')](handleEntityNotFound(_0x343376,null))['then'](respondWithResult(_0x343376,null))['catch'](handleError(_0x343376,null));};exports[_0xa5d0('0x4b')]=function(_0x9a4c50,_0x2d8551){return db[_0xa5d0('0x2c')][_0xa5d0('0x4b')](_0x9a4c50[_0xa5d0('0x4c')],{})[_0xa5d0('0x27')](respondWithResult(_0x2d8551,0xc9))[_0xa5d0('0x46')](handleError(_0x2d8551,null));};exports[_0xa5d0('0x26')]=function(_0xbb7c45,_0x555ec8){if(_0xbb7c45[_0xa5d0('0x4c')]['id']){delete _0xbb7c45['body']['id'];}return db[_0xa5d0('0x2c')][_0xa5d0('0x4a')]({'where':{'id':_0xbb7c45['params']['id']}})[_0xa5d0('0x27')](handleEntityNotFound(_0x555ec8,null))[_0xa5d0('0x27')](saveUpdates(_0xbb7c45[_0xa5d0('0x4c')],null))[_0xa5d0('0x27')](respondWithResult(_0x555ec8,null))[_0xa5d0('0x46')](handleError(_0x555ec8,null));};exports['destroy']=function(_0x30d13c,_0x54bd94){return db[_0xa5d0('0x2c')][_0xa5d0('0x4a')]({'where':{'id':_0x30d13c[_0xa5d0('0x48')]['id']}})[_0xa5d0('0x27')](handleEntityNotFound(_0x54bd94,null))['then'](removeEntity(_0x54bd94,null))['catch'](handleError(_0x54bd94,null));}; \ No newline at end of file +var _0x6050=['rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','fs-extra','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','name','send','index','map','WhatsappApplication'];(function(_0x19ab39,_0x4e871b){var _0x267b6a=function(_0x149aa3){while(--_0x149aa3){_0x19ab39['push'](_0x19ab39['shift']());}};_0x267b6a(++_0x4e871b);}(_0x6050,0x196));var _0x0605=function(_0x22efb0,_0xd42df6){_0x22efb0=_0x22efb0-0x0;var _0x11ae8e=_0x6050[_0x22efb0];return _0x11ae8e;};'use strict';var emlformat=require(_0x0605('0x0'));var rimraf=require(_0x0605('0x1'));var zipdir=require(_0x0605('0x2'));var jsonpatch=require(_0x0605('0x3'));var rp=require(_0x0605('0x4'));var moment=require(_0x0605('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0605('0x6'));var util=require(_0x0605('0x7'));var path=require(_0x0605('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0605('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0605('0xa'));var deskjs=require(_0x0605('0xb'));var toCsv=require(_0x0605('0xc'));var querystring=require(_0x0605('0xd'));var Papa=require(_0x0605('0xe'));var Redis=require('ioredis');var authService=require(_0x0605('0xf'));var qs=require(_0x0605('0x10'));var as=require(_0x0605('0x11'));var hardwareService=require(_0x0605('0x12'));var logger=require(_0x0605('0x13'))(_0x0605('0x14'));var utils=require(_0x0605('0x15'));var config=require(_0x0605('0x16'));var licenseUtil=require(_0x0605('0x17'));var db=require(_0x0605('0x18'))['db'];function respondWithStatusCode(_0xd22e35,_0x39e288){_0x39e288=_0x39e288||0xcc;return function(_0x34c9e6){if(_0x34c9e6){return _0xd22e35[_0x0605('0x19')](_0x39e288);}return _0xd22e35[_0x0605('0x1a')](_0x39e288)[_0x0605('0x1b')]();};}function respondWithResult(_0x169a70,_0x65a20b){_0x65a20b=_0x65a20b||0xc8;return function(_0x1b944f){if(_0x1b944f){return _0x169a70['status'](_0x65a20b)[_0x0605('0x1c')](_0x1b944f);}};}function respondWithFilteredResult(_0x1a802b,_0x4993ab){return function(_0x5ce56a){if(_0x5ce56a){var _0x4eefe9=typeof _0x4993ab[_0x0605('0x1d')]===_0x0605('0x1e')&&typeof _0x4993ab[_0x0605('0x1f')]===_0x0605('0x1e');var _0xefc557=_0x5ce56a[_0x0605('0x20')];var _0x2b7b5a=_0x4eefe9?0x0:_0x4993ab[_0x0605('0x1d')];var _0x193520=_0x4eefe9?_0x5ce56a[_0x0605('0x20')]:_0x4993ab[_0x0605('0x1d')]+_0x4993ab[_0x0605('0x1f')];var _0x2e2204;if(_0x193520>=_0xefc557){_0x193520=_0xefc557;_0x2e2204=0xc8;}else{_0x2e2204=0xce;}_0x1a802b[_0x0605('0x1a')](_0x2e2204);return _0x1a802b['set'](_0x0605('0x21'),_0x2b7b5a+'-'+_0x193520+'/'+_0xefc557)[_0x0605('0x1c')](_0x5ce56a);}return null;};}function patchUpdates(_0x430f28){return function(_0x443326){try{jsonpatch[_0x0605('0x22')](_0x443326,_0x430f28,!![]);}catch(_0x90b2e1){return BPromise[_0x0605('0x23')](_0x90b2e1);}return _0x443326[_0x0605('0x24')]();};}function saveUpdates(_0x226ef5,_0x5b0d44){return function(_0xc334b8){if(_0xc334b8){return _0xc334b8['update'](_0x226ef5)[_0x0605('0x25')](function(_0x118e9c){return _0x118e9c;});}return null;};}function removeEntity(_0x110098,_0xf182c4){return function(_0x10c575){if(_0x10c575){return _0x10c575[_0x0605('0x26')]()[_0x0605('0x25')](function(){_0x110098[_0x0605('0x1a')](0xcc)[_0x0605('0x1b')]();});}};}function handleEntityNotFound(_0x2896d7,_0x9f2833){return function(_0x1c3722){if(!_0x1c3722){_0x2896d7['sendStatus'](0x194);}return _0x1c3722;};}function handleError(_0x6bc204,_0x3c8e36){_0x3c8e36=_0x3c8e36||0x1f4;return function(_0x4b1e0c){logger['error'](_0x4b1e0c['stack']);if(_0x4b1e0c[_0x0605('0x27')]){delete _0x4b1e0c[_0x0605('0x27')];}_0x6bc204[_0x0605('0x1a')](_0x3c8e36)[_0x0605('0x28')](_0x4b1e0c);};}exports[_0x0605('0x29')]=function(_0x4554df,_0x4e32ef){var _0x34f25d={},_0x5daef6={},_0xa836f2={'count':0x0,'rows':[]};var _0x3640b9=_[_0x0605('0x2a')](db[_0x0605('0x2b')][_0x0605('0x2c')],function(_0x352dd6){return{'name':_0x352dd6['fieldName'],'type':_0x352dd6[_0x0605('0x2d')][_0x0605('0x2e')]};});_0x5daef6[_0x0605('0x2f')]=_[_0x0605('0x2a')](_0x3640b9,_0x0605('0x27'));_0x5daef6[_0x0605('0x30')]=_[_0x0605('0x31')](_0x4554df[_0x0605('0x30')]);_0x5daef6[_0x0605('0x32')]=_[_0x0605('0x33')](_0x5daef6[_0x0605('0x2f')],_0x5daef6[_0x0605('0x30')]);_0x34f25d[_0x0605('0x34')]=_[_0x0605('0x33')](_0x5daef6[_0x0605('0x2f')],qs[_0x0605('0x35')](_0x4554df[_0x0605('0x30')][_0x0605('0x35')]));_0x34f25d[_0x0605('0x34')]=_0x34f25d[_0x0605('0x34')][_0x0605('0x36')]?_0x34f25d[_0x0605('0x34')]:_0x5daef6[_0x0605('0x2f')];if(!_0x4554df[_0x0605('0x30')][_0x0605('0x37')](_0x0605('0x38'))){_0x34f25d[_0x0605('0x1f')]=qs['limit'](_0x4554df[_0x0605('0x30')][_0x0605('0x1f')]);_0x34f25d['offset']=qs[_0x0605('0x1d')](_0x4554df[_0x0605('0x30')]['offset']);}_0x34f25d[_0x0605('0x39')]=qs[_0x0605('0x3a')](_0x4554df[_0x0605('0x30')][_0x0605('0x3a')]);_0x34f25d[_0x0605('0x3b')]=qs[_0x0605('0x32')](_['pick'](_0x4554df['query'],_0x5daef6[_0x0605('0x32')]),_0x3640b9);if(_0x4554df[_0x0605('0x30')][_0x0605('0x3c')]){_0x34f25d['where']=_[_0x0605('0x3d')](_0x34f25d['where'],{'$or':_[_0x0605('0x2a')](_0x3640b9,function(_0x1e98f6){if(_0x1e98f6[_0x0605('0x2d')]!==_0x0605('0x3e')){var _0x42f7ce={};_0x42f7ce[_0x1e98f6[_0x0605('0x27')]]={'$like':'%'+_0x4554df[_0x0605('0x30')][_0x0605('0x3c')]+'%'};return _0x42f7ce;}})});}_0x34f25d=_[_0x0605('0x3d')]({},_0x34f25d,_0x4554df[_0x0605('0x3f')]);var _0x57aa15={'where':_0x34f25d[_0x0605('0x3b')]};return db['WhatsappApplication'][_0x0605('0x20')](_0x57aa15)[_0x0605('0x25')](function(_0x45787e){_0xa836f2['count']=_0x45787e;if(_0x4554df['query'][_0x0605('0x40')]){_0x34f25d['include']=[{'all':!![]}];}return db[_0x0605('0x2b')][_0x0605('0x41')](_0x34f25d);})[_0x0605('0x25')](function(_0x3de34a){_0xa836f2[_0x0605('0x42')]=_0x3de34a;return _0xa836f2;})[_0x0605('0x25')](respondWithFilteredResult(_0x4e32ef,_0x34f25d))[_0x0605('0x43')](handleError(_0x4e32ef,null));};exports[_0x0605('0x44')]=function(_0x3fa553,_0x10bb36){var _0x18d3ce={'raw':!![],'where':{'id':_0x3fa553[_0x0605('0x45')]['id']}},_0x3616a3={};_0x3616a3['model']=_['keys'](db[_0x0605('0x2b')]['rawAttributes']);_0x3616a3[_0x0605('0x30')]=_[_0x0605('0x31')](_0x3fa553['query']);_0x3616a3[_0x0605('0x32')]=_[_0x0605('0x33')](_0x3616a3['model'],_0x3616a3[_0x0605('0x30')]);_0x18d3ce[_0x0605('0x34')]=_['intersection'](_0x3616a3[_0x0605('0x2f')],qs[_0x0605('0x35')](_0x3fa553['query'][_0x0605('0x35')]));_0x18d3ce['attributes']=_0x18d3ce['attributes'][_0x0605('0x36')]?_0x18d3ce[_0x0605('0x34')]:_0x3616a3[_0x0605('0x2f')];if(_0x3fa553[_0x0605('0x30')][_0x0605('0x40')]){_0x18d3ce[_0x0605('0x46')]=[{'all':!![]}];}_0x18d3ce=_[_0x0605('0x3d')]({},_0x18d3ce,_0x3fa553[_0x0605('0x3f')]);return db['WhatsappApplication'][_0x0605('0x47')](_0x18d3ce)[_0x0605('0x25')](handleEntityNotFound(_0x10bb36,null))[_0x0605('0x25')](respondWithResult(_0x10bb36,null))['catch'](handleError(_0x10bb36,null));};exports[_0x0605('0x48')]=function(_0x1fb70b,_0x45cc1a){return db[_0x0605('0x2b')][_0x0605('0x48')](_0x1fb70b[_0x0605('0x49')],{})[_0x0605('0x25')](respondWithResult(_0x45cc1a,0xc9))[_0x0605('0x43')](handleError(_0x45cc1a,null));};exports[_0x0605('0x4a')]=function(_0x4bc55e,_0x3c597c){if(_0x4bc55e[_0x0605('0x49')]['id']){delete _0x4bc55e[_0x0605('0x49')]['id'];}return db[_0x0605('0x2b')][_0x0605('0x47')]({'where':{'id':_0x4bc55e[_0x0605('0x45')]['id']}})[_0x0605('0x25')](handleEntityNotFound(_0x3c597c,null))[_0x0605('0x25')](saveUpdates(_0x4bc55e[_0x0605('0x49')],null))[_0x0605('0x25')](respondWithResult(_0x3c597c,null))['catch'](handleError(_0x3c597c,null));};exports['destroy']=function(_0x4876c7,_0x2687a8){return db[_0x0605('0x2b')][_0x0605('0x47')]({'where':{'id':_0x4876c7[_0x0605('0x45')]['id']}})[_0x0605('0x25')](handleEntityNotFound(_0x2687a8,null))[_0x0605('0x25')](removeEntity(_0x2687a8,null))['catch'](handleError(_0x2687a8,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 2f9f086..e1e399d 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 _0x43fd=['path','../../config/environment','./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','util','moment','bluebird'];(function(_0x21592c,_0x1737a6){var _0x3ac08f=function(_0x11515e){while(--_0x11515e){_0x21592c['push'](_0x21592c['shift']());}};_0x3ac08f(++_0x1737a6);}(_0x43fd,0x1ec));var _0xd43f=function(_0x5994a1,_0x481709){_0x5994a1=_0x5994a1-0x0;var _0x22122a=_0x43fd[_0x5994a1];return _0x22122a;};'use strict';var _=require('lodash');var util=require(_0xd43f('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xd43f('0x1'));var BPromise=require(_0xd43f('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd43f('0x3'));var rimraf=require('rimraf');var config=require(_0xd43f('0x4'));var attributes=require(_0xd43f('0x5'));module[_0xd43f('0x6')]=function(_0x33ddff,_0x52e75f){return _0x33ddff[_0xd43f('0x7')](_0xd43f('0x8'),attributes,{'tableName':_0xd43f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd43f('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x8d0e=['./whatsappApplication.attributes','define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x39d7ca,_0x4b30cc){var _0xf38800=function(_0x2879c1){while(--_0x2879c1){_0x39d7ca['push'](_0x39d7ca['shift']());}};_0xf38800(++_0x4b30cc);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x10faed,_0x14794e){_0x10faed=_0x10faed-0x0;var _0x487171=_0x8d0e[_0x10faed];return _0x487171;};'use strict';var _=require(_0xe8d0('0x0'));var util=require(_0xe8d0('0x1'));var logger=require(_0xe8d0('0x2'))(_0xe8d0('0x3'));var moment=require(_0xe8d0('0x4'));var BPromise=require(_0xe8d0('0x5'));var rp=require(_0xe8d0('0x6'));var fs=require('fs');var path=require(_0xe8d0('0x7'));var rimraf=require(_0xe8d0('0x8'));var config=require('../../config/environment');var attributes=require(_0xe8d0('0x9'));module['exports']=function(_0x560dab,_0x2e2985){return _0x560dab[_0xe8d0('0xa')](_0xe8d0('0xb'),attributes,{'tableName':_0xe8d0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe8d0('0xd'),'collate':_0xe8d0('0xe')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index b6fe555..c42fb1e 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 _0xd6d6=['WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x5a345e,_0x61114e){var _0x182f59=function(_0x1973e5){while(--_0x1973e5){_0x5a345e['push'](_0x5a345e['shift']());}};_0x182f59(++_0x61114e);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x523af4,_0x11496e){_0x523af4=_0x523af4-0x0;var _0x491550=_0xd6d6[_0x523af4];return _0x491550;};'use strict';var _=require(_0x6d6d('0x0'));var util=require(_0x6d6d('0x1'));var moment=require(_0x6d6d('0x2'));var BPromise=require(_0x6d6d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6d6d('0x4'));var db=require(_0x6d6d('0x5'))['db'];var utils=require(_0x6d6d('0x6'));var logger=require(_0x6d6d('0x7'))(_0x6d6d('0x8'));var config=require(_0x6d6d('0x9'));var jayson=require(_0x6d6d('0xa'));var client=jayson['client'][_0x6d6d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1bf731,_0x44f83d,_0x18f824){return new BPromise(function(_0xd49f57,_0x408f88){return client[_0x6d6d('0xc')](_0x1bf731,_0x18f824)['then'](function(_0x51dd38){logger[_0x6d6d('0xd')](_0x6d6d('0xe'),_0x44f83d,_0x6d6d('0xf'));logger[_0x6d6d('0x10')](_0x6d6d('0x11'),_0x44f83d,'request\x20sent',JSON[_0x6d6d('0x12')](_0x51dd38));if(_0x51dd38[_0x6d6d('0x13')]){if(_0x51dd38['error']['code']===0x1f4){logger[_0x6d6d('0x13')](_0x6d6d('0xe'),_0x44f83d,_0x51dd38[_0x6d6d('0x13')][_0x6d6d('0x14')]);return _0x408f88(_0x51dd38[_0x6d6d('0x13')][_0x6d6d('0x14')]);}logger[_0x6d6d('0x13')](_0x6d6d('0xe'),_0x44f83d,_0x51dd38['error'][_0x6d6d('0x14')]);return _0xd49f57(_0x51dd38[_0x6d6d('0x13')][_0x6d6d('0x14')]);}else{logger[_0x6d6d('0xd')](_0x6d6d('0xe'),_0x44f83d,'request\x20sent');_0xd49f57(_0x51dd38[_0x6d6d('0x15')]['message']);}})[_0x6d6d('0x16')](function(_0x2cbc86){logger[_0x6d6d('0x13')]('WhatsappApplication,\x20%s,\x20%s',_0x44f83d,_0x2cbc86);_0x408f88(_0x2cbc86);});});} \ No newline at end of file +var _0x9bde=['code','message','WhatsappApplication,\x20%s,\x20%s','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x24e466,_0xa7f363){var _0x23d286=function(_0x180e62){while(--_0x180e62){_0x24e466['push'](_0x24e466['shift']());}};_0x23d286(++_0xa7f363);}(_0x9bde,0xe1));var _0xe9bd=function(_0x56c037,_0x596f21){_0x56c037=_0x56c037-0x0;var _0x45fd84=_0x9bde[_0x56c037];return _0x45fd84;};'use strict';var _=require('lodash');var util=require(_0xe9bd('0x0'));var moment=require('moment');var BPromise=require(_0xe9bd('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe9bd('0x2'));var db=require(_0xe9bd('0x3'))['db'];var utils=require(_0xe9bd('0x4'));var logger=require(_0xe9bd('0x5'))(_0xe9bd('0x6'));var config=require(_0xe9bd('0x7'));var jayson=require(_0xe9bd('0x8'));var client=jayson['client'][_0xe9bd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5f18fe,_0x22a438,_0xa66ae2){return new BPromise(function(_0x2d5c75,_0x3ef9e3){return client[_0xe9bd('0xa')](_0x5f18fe,_0xa66ae2)[_0xe9bd('0xb')](function(_0x439abc){logger[_0xe9bd('0xc')]('WhatsappApplication,\x20%s,\x20%s',_0x22a438,'request\x20sent');logger[_0xe9bd('0xd')](_0xe9bd('0xe'),_0x22a438,_0xe9bd('0xf'),JSON['stringify'](_0x439abc));if(_0x439abc[_0xe9bd('0x10')]){if(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x11')]===0x1f4){logger[_0xe9bd('0x10')]('WhatsappApplication,\x20%s,\x20%s',_0x22a438,_0x439abc[_0xe9bd('0x10')]['message']);return _0x3ef9e3(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x12')]);}logger[_0xe9bd('0x10')]('WhatsappApplication,\x20%s,\x20%s',_0x22a438,_0x439abc['error'][_0xe9bd('0x12')]);return _0x2d5c75(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x12')]);}else{logger[_0xe9bd('0xc')](_0xe9bd('0x13'),_0x22a438,_0xe9bd('0xf'));_0x2d5c75(_0x439abc[_0xe9bd('0x14')]['message']);}})[_0xe9bd('0x15')](function(_0x464a1b){logger[_0xe9bd('0x10')]('WhatsappApplication,\x20%s,\x20%s',_0x22a438,_0x464a1b);_0x3ef9e3(_0x464a1b);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index d134c61..ff59b62 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 _0xdc97=['/:id/download','download','post','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','put','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','destroy','removeTags','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','describe','/:id','show','/:id/messages','getMessages'];(function(_0x5c9e2b,_0x4dfe92){var _0x1d218e=function(_0x1d89b7){while(--_0x1d89b7){_0x5c9e2b['push'](_0x5c9e2b['shift']());}};_0x1d218e(++_0x4dfe92);}(_0xdc97,0x13b));var _0x7dc9=function(_0x18fc8b,_0x415b5d){_0x18fc8b=_0x18fc8b-0x0;var _0x8bb472=_0xdc97[_0x18fc8b];return _0x8bb472;};'use strict';var multer=require(_0x7dc9('0x0'));var util=require(_0x7dc9('0x1'));var path=require(_0x7dc9('0x2'));var timeout=require('connect-timeout');var express=require(_0x7dc9('0x3'));var router=express['Router']();var fs_extra=require(_0x7dc9('0x4'));var auth=require(_0x7dc9('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7dc9('0x6'));var controller=require(_0x7dc9('0x7'));router[_0x7dc9('0x8')]('/',auth[_0x7dc9('0x9')](),controller['index']);router[_0x7dc9('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x7dc9('0xa')]);router[_0x7dc9('0x8')](_0x7dc9('0xb'),auth[_0x7dc9('0x9')](),controller[_0x7dc9('0xc')]);router['get'](_0x7dc9('0xd'),auth[_0x7dc9('0x9')](),controller[_0x7dc9('0xe')]);router[_0x7dc9('0x8')](_0x7dc9('0xf'),auth[_0x7dc9('0x9')](),controller[_0x7dc9('0x10')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x7dc9('0xd'),auth[_0x7dc9('0x9')](),controller['addMessage']);router[_0x7dc9('0x11')](_0x7dc9('0x12'),auth[_0x7dc9('0x9')](),interaction[_0x7dc9('0x13')](_0x7dc9('0x14'),_0x7dc9('0x15')),controller['addTags']);router[_0x7dc9('0x16')](_0x7dc9('0xb'),auth[_0x7dc9('0x9')](),interaction[_0x7dc9('0x13')](_0x7dc9('0x14'),_0x7dc9('0x17')),controller[_0x7dc9('0x18')]);router[_0x7dc9('0x19')](_0x7dc9('0xb'),auth['isAuthenticated'](),interaction[_0x7dc9('0x13')]('whatsapp',_0x7dc9('0x1a')),controller[_0x7dc9('0x1b')]);router['delete'](_0x7dc9('0x12'),auth[_0x7dc9('0x9')](),controller[_0x7dc9('0x1c')]);module[_0x7dc9('0x1d')]=router; \ No newline at end of file +var _0x6ec2=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','index','isAuthenticated','describe','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','tracked','whatsappinteraction:addtags','addTags','put','/:id','whatsapp','whatsappinteraction:update','update','delete'];(function(_0x28ae42,_0x381c7c){var _0x160d70=function(_0x36631d){while(--_0x36631d){_0x28ae42['push'](_0x28ae42['shift']());}};_0x160d70(++_0x381c7c);}(_0x6ec2,0x78));var _0x26ec=function(_0x108a3a,_0xe4e6c8){_0x108a3a=_0x108a3a-0x0;var _0x3c3be0=_0x6ec2[_0x108a3a];return _0x3c3be0;};'use strict';var multer=require(_0x26ec('0x0'));var util=require(_0x26ec('0x1'));var path=require(_0x26ec('0x2'));var timeout=require(_0x26ec('0x3'));var express=require(_0x26ec('0x4'));var router=express[_0x26ec('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x26ec('0x6'));var interaction=require(_0x26ec('0x7'));var config=require(_0x26ec('0x8'));var controller=require(_0x26ec('0x9'));router[_0x26ec('0xa')]('/',auth['isAuthenticated'](),controller[_0x26ec('0xb')]);router['get']('/describe',auth[_0x26ec('0xc')](),controller[_0x26ec('0xd')]);router[_0x26ec('0xa')]('/:id',auth[_0x26ec('0xc')](),controller['show']);router[_0x26ec('0xa')](_0x26ec('0xe'),auth[_0x26ec('0xc')](),controller[_0x26ec('0xf')]);router[_0x26ec('0xa')](_0x26ec('0x10'),auth[_0x26ec('0xc')](),controller[_0x26ec('0x11')]);router[_0x26ec('0x12')]('/',auth[_0x26ec('0xc')](),controller['create']);router['post'](_0x26ec('0xe'),auth[_0x26ec('0xc')](),controller[_0x26ec('0x13')]);router[_0x26ec('0x12')](_0x26ec('0x14'),auth[_0x26ec('0xc')](),interaction[_0x26ec('0x15')]('whatsapp',_0x26ec('0x16')),controller[_0x26ec('0x17')]);router[_0x26ec('0x18')](_0x26ec('0x19'),auth['isAuthenticated'](),interaction['tracked'](_0x26ec('0x1a'),_0x26ec('0x1b')),controller[_0x26ec('0x1c')]);router[_0x26ec('0x1d')]('/:id',auth[_0x26ec('0xc')](),interaction[_0x26ec('0x15')]('whatsapp','whatsappinteraction:destroy'),controller['destroy']);router[_0x26ec('0x1d')](_0x26ec('0x14'),auth[_0x26ec('0xc')](),controller['removeTags']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index ba00904..e9c4626 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 _0x5d58=['BOOLEAN','STRING','ENUM','out','DATE'];(function(_0x1e6e4e,_0x2b1b09){var _0x3d746b=function(_0x4483dd){while(--_0x4483dd){_0x1e6e4e['push'](_0x1e6e4e['shift']());}};_0x3d746b(++_0x2b1b09);}(_0x5d58,0x187));var _0x85d5=function(_0x1ac2a1,_0x577dc2){_0x1ac2a1=_0x1ac2a1-0x0;var _0x245116=_0x5d58[_0x1ac2a1];return _0x245116;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x85d5('0x0')]},'secondDisposition':{'type':Sequelize[_0x85d5('0x0')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x85d5('0x0')]},'phone':{'type':Sequelize[_0x85d5('0x0')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x85d5('0x1')]('in',_0x85d5('0x2')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x85d5('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x85d5('0x1')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x85d5('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xf3a7=['exports','BOOLEAN','DATE','STRING','out','ENUM','moment'];(function(_0x27c151,_0x52c49b){var _0x5c4bf9=function(_0x45aaee){while(--_0x45aaee){_0x27c151['push'](_0x27c151['shift']());}};_0x5c4bf9(++_0x52c49b);}(_0xf3a7,0x99));var _0x7f3a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf3a7[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x7f3a('0x0'));module[_0x7f3a('0x1')]={'closed':{'type':Sequelize[_0x7f3a('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x7f3a('0x3')]},'disposition':{'type':Sequelize[_0x7f3a('0x4')]},'secondDisposition':{'type':Sequelize[_0x7f3a('0x4')]},'thirdDisposition':{'type':Sequelize[_0x7f3a('0x4')]},'note':{'type':Sequelize[_0x7f3a('0x4')]},'phone':{'type':Sequelize[_0x7f3a('0x4')]},'read1stAt':{'type':Sequelize[_0x7f3a('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x7f3a('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x7f3a('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x7f3a('0x6')]('in',_0x7f3a('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x7f3a('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 9e4301f..7a84eaa 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 _0x9e24=['attributes','fields','length','merge','options','find','then','create','update','body','describe','addMessage','WhatsappMessage','ids','findOne','filters','hasOwnProperty','nolimit','sort','where','pick','WhatsappInteractionId','filter','$gte','split','format','include','rows','addTags','omit','spread','Tag','color','emit','whatsappInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','transcript-%d-%s.zip','push','User','fullname','Contact','lastName','attachments','Attachment','Messages','createdAt','direction','secret','read','WhatsappAccount','Account','Owner','Whatsapp','N.A.','closed','closedAt','disposition','pipe','basename','out','System','firstName','value','renderFile','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','err','unlinkSync','rimraf','moment','bluebird','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/export/pdf','../../config/logger','redis','localhost','./whatsappInteraction.socket','register','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','destroy','error','name','index','map','WhatsappInteraction','fieldName','type','key','findAll','query','catch','show','params','keys','rawAttributes','intersection','model'];(function(_0x2503a0,_0x1df296){var _0x283467=function(_0xa2c16){while(--_0xa2c16){_0x2503a0['push'](_0x2503a0['shift']());}};_0x283467(++_0x1df296);}(_0x9e24,0xc4));var _0x49e2=function(_0x2f9467,_0x40576f){_0x2f9467=_0x2f9467-0x0;var _0x39894c=_0x9e24[_0x2f9467];return _0x39894c;};'use strict';var rimraf=require(_0x49e2('0x0'));var zipdir=require('zip-dir');var moment=require(_0x49e2('0x1'));var BPromise=require(_0x49e2('0x2'));var util=require('util');var path=require(_0x49e2('0x3'));var ejs=require(_0x49e2('0x4'));var fs=require('fs');var _=require(_0x49e2('0x5'));var Redis=require(_0x49e2('0x6'));var interaction=require(_0x49e2('0x7'));var qs=require('../../components/parsers/qs');var pdf=require(_0x49e2('0x8'));var logger=require(_0x49e2('0x9'))('api');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x49e2('0xa')]=_['defaults'](config[_0x49e2('0xa')],{'host':_0x49e2('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x49e2('0xc'))[_0x49e2('0xd')](socket);function respondWithStatusCode(_0x1ff6fc,_0x12d743){_0x12d743=_0x12d743||0xcc;return function(_0x2b1611){if(_0x2b1611){return _0x1ff6fc[_0x49e2('0xe')](_0x12d743);}return _0x1ff6fc[_0x49e2('0xf')](_0x12d743)[_0x49e2('0x10')]();};}function respondWithResult(_0x1166a1,_0x30d9d8){_0x30d9d8=_0x30d9d8||0xc8;return function(_0x103372){if(_0x103372){return _0x1166a1['status'](_0x30d9d8)['json'](_0x103372);}};}function respondWithFilteredResult(_0x43a666,_0x553120){return function(_0x91d7b9){if(_0x91d7b9){var _0x324507=typeof _0x553120['offset']===_0x49e2('0x11')&&typeof _0x553120[_0x49e2('0x12')]===_0x49e2('0x11');var _0x25192f=_0x91d7b9[_0x49e2('0x13')];var _0x3de693=_0x324507?0x0:_0x553120[_0x49e2('0x14')];var _0x2a97b3=_0x324507?_0x91d7b9['count']:_0x553120[_0x49e2('0x14')]+_0x553120[_0x49e2('0x12')];var _0x21c9b6;if(_0x2a97b3>=_0x25192f){_0x2a97b3=_0x25192f;_0x21c9b6=0xc8;}else{_0x21c9b6=0xce;}_0x43a666[_0x49e2('0xf')](_0x21c9b6);return _0x43a666[_0x49e2('0x15')](_0x49e2('0x16'),_0x3de693+'-'+_0x2a97b3+'/'+_0x25192f)[_0x49e2('0x17')](_0x91d7b9);}return null;};}function saveUpdates(_0x45e042){return function(_0x1ba30a){if(_0x1ba30a){return _0x1ba30a['update'](_0x45e042)['then'](function(_0xd34244){return _0xd34244;});}return null;};}function removeEntity(_0x3ada85){return function(_0x5d8384){if(_0x5d8384){return _0x5d8384[_0x49e2('0x18')]()['then'](function(){_0x3ada85['status'](0xcc)[_0x49e2('0x10')]();});}};}function handleEntityNotFound(_0x50c262){return function(_0x4a1d76){if(!_0x4a1d76){_0x50c262['sendStatus'](0x194);}return _0x4a1d76;};}function handleError(_0x5e3145,_0x285311){_0x285311=_0x285311||0x1f4;return function(_0x1e40f2){logger[_0x49e2('0x19')](_0x1e40f2['stack']);if(_0x1e40f2[_0x49e2('0x1a')]){delete _0x1e40f2[_0x49e2('0x1a')];}_0x5e3145['status'](_0x285311)['send'](_0x1e40f2);};}exports[_0x49e2('0x1b')]=function(_0xae301,_0x448086){var _0xb8743f={};var _0x3f4be2=_[_0x49e2('0x1c')](db[_0x49e2('0x1d')]['rawAttributes'],function(_0x514a6d){return{'name':_0x514a6d[_0x49e2('0x1e')],'type':_0x514a6d[_0x49e2('0x1f')][_0x49e2('0x20')]};});_0xb8743f=qs['getOptions'](_0x3f4be2,_0xae301);return interaction[_0x49e2('0x21')]('whatsapp',_0xae301[_0x49e2('0x22')],_0xae301['user'],_0xb8743f,_0x3f4be2)['then'](respondWithFilteredResult(_0x448086,_0xb8743f))[_0x49e2('0x23')](handleError(_0x448086,null));};exports[_0x49e2('0x24')]=function(_0x228c5e,_0x56f910){var _0x53e168={'raw':![],'where':{'id':_0x228c5e[_0x49e2('0x25')]['id']}},_0x450119={};_0x450119['model']=_[_0x49e2('0x26')](db['WhatsappInteraction'][_0x49e2('0x27')]);_0x450119[_0x49e2('0x22')]=_[_0x49e2('0x26')](_0x228c5e[_0x49e2('0x22')]);_0x450119['filters']=_[_0x49e2('0x28')](_0x450119[_0x49e2('0x29')],_0x450119['query']);_0x53e168[_0x49e2('0x2a')]=_[_0x49e2('0x28')](_0x450119[_0x49e2('0x29')],qs[_0x49e2('0x2b')](_0x228c5e[_0x49e2('0x22')][_0x49e2('0x2b')]));_0x53e168[_0x49e2('0x2a')]=_0x53e168[_0x49e2('0x2a')][_0x49e2('0x2c')]?_0x53e168[_0x49e2('0x2a')]:_0x450119['model'];if(_0x228c5e['query']['includeAll']){_0x53e168['include']=[{'all':!![]}];}_0x53e168=_[_0x49e2('0x2d')]({},_0x53e168,_0x228c5e[_0x49e2('0x2e')]);return db['WhatsappInteraction'][_0x49e2('0x2f')](_0x53e168)[_0x49e2('0x30')](handleEntityNotFound(_0x56f910,null))['then'](respondWithResult(_0x56f910,null))['catch'](handleError(_0x56f910,null));};exports[_0x49e2('0x31')]=function(_0x3df45d,_0x4d0f2b){return db[_0x49e2('0x1d')][_0x49e2('0x31')](_0x3df45d['body'],{})[_0x49e2('0x30')](respondWithResult(_0x4d0f2b,0xc9))[_0x49e2('0x23')](handleError(_0x4d0f2b,null));};exports[_0x49e2('0x32')]=function(_0x5087ca,_0x55bca4){if(_0x5087ca[_0x49e2('0x33')]['id']){delete _0x5087ca[_0x49e2('0x33')]['id'];}return db['WhatsappInteraction']['find']({'where':{'id':_0x5087ca[_0x49e2('0x25')]['id']}})[_0x49e2('0x30')](handleEntityNotFound(_0x55bca4,null))[_0x49e2('0x30')](saveUpdates(_0x5087ca[_0x49e2('0x33')],null))['then'](respondWithResult(_0x55bca4,null))['catch'](handleError(_0x55bca4,null));};exports[_0x49e2('0x18')]=function(_0x441dff,_0x5812ec){return db[_0x49e2('0x1d')]['find']({'where':{'id':_0x441dff[_0x49e2('0x25')]['id']}})[_0x49e2('0x30')](handleEntityNotFound(_0x5812ec,null))['then'](removeEntity(_0x5812ec,null))['catch'](handleError(_0x5812ec,null));};exports[_0x49e2('0x34')]=function(_0x30d15f,_0x2f5c01){return db['WhatsappInteraction']['describe']()[_0x49e2('0x30')](respondWithResult(_0x2f5c01,null))[_0x49e2('0x23')](handleError(_0x2f5c01,null));};exports[_0x49e2('0x35')]=function(_0x1f2b35,_0x30fbe3){return db[_0x49e2('0x36')]['find']({'where':{'id':_0x1f2b35['params']['id']}})[_0x49e2('0x30')](handleEntityNotFound(_0x30fbe3,null))[_0x49e2('0x30')](function(_0x59229f){if(_0x59229f){return _0x59229f['addMessage'](_0x1f2b35[_0x49e2('0x33')][_0x49e2('0x37')],_['omit'](_0x1f2b35[_0x49e2('0x33')],[_0x49e2('0x37'),'id'])||{});}})[_0x49e2('0x30')](respondWithResult(_0x30fbe3,null))[_0x49e2('0x23')](handleError(_0x30fbe3,null));};exports['getMessages']=function(_0x469bc9,_0x209d6e){var _0x100012={'raw':![],'where':{}};var _0x110ddd={};var _0x1b1e73={'count':0x0,'rows':[]};return db[_0x49e2('0x1d')][_0x49e2('0x38')]({'where':{'id':_0x469bc9['params']['id']}})[_0x49e2('0x30')](handleEntityNotFound(_0x209d6e,null))['then'](function(_0x47535f){if(_0x47535f){_0x110ddd[_0x49e2('0x29')]=_[_0x49e2('0x26')](db[_0x49e2('0x36')]['rawAttributes']);_0x110ddd['query']=_[_0x49e2('0x26')](_0x469bc9[_0x49e2('0x22')]);_0x110ddd[_0x49e2('0x39')]=_['intersection'](_0x110ddd['model'],_0x110ddd[_0x49e2('0x22')]);_0x100012[_0x49e2('0x2a')]=_[_0x49e2('0x28')](_0x110ddd[_0x49e2('0x29')],qs[_0x49e2('0x2b')](_0x469bc9[_0x49e2('0x22')][_0x49e2('0x2b')]));_0x100012[_0x49e2('0x2a')]=_0x100012['attributes'][_0x49e2('0x2c')]?_0x100012[_0x49e2('0x2a')]:_0x110ddd[_0x49e2('0x29')];if(!_0x469bc9[_0x49e2('0x22')][_0x49e2('0x3a')](_0x49e2('0x3b'))){_0x100012[_0x49e2('0x12')]=qs[_0x49e2('0x12')](_0x469bc9[_0x49e2('0x22')][_0x49e2('0x12')]);_0x100012['offset']=qs[_0x49e2('0x14')](_0x469bc9['query'][_0x49e2('0x14')]);}_0x100012['order']=qs[_0x49e2('0x3c')](_0x469bc9[_0x49e2('0x22')][_0x49e2('0x3c')]);_0x100012[_0x49e2('0x3d')]=qs[_0x49e2('0x39')](_[_0x49e2('0x3e')](_0x469bc9[_0x49e2('0x22')],_0x110ddd[_0x49e2('0x39')]));_0x100012[_0x49e2('0x3d')][_0x49e2('0x3f')]=_0x47535f['id'];if(_0x469bc9[_0x49e2('0x22')]['filter']){_0x100012[_0x49e2('0x3d')]=_[_0x49e2('0x2d')](_0x100012[_0x49e2('0x3d')],{'$or':_['map'](_0x100012[_0x49e2('0x2a')],function(_0x21357e){var _0x426f6e={};_0x426f6e[_0x21357e]={'$like':'%'+_0x469bc9[_0x49e2('0x22')][_0x49e2('0x40')]+'%'};return _0x426f6e;})});}if(_0x469bc9[_0x49e2('0x22')]['$gte']){var _0x25f1f1=_0x469bc9[_0x49e2('0x22')][_0x49e2('0x41')][_0x49e2('0x42')](',');var _0x5e3e18={};_0x5e3e18[_0x25f1f1[0x0]]={'$gte':moment(_0x25f1f1[0x1])[_0x49e2('0x43')]('YYYY-MM-DD\x20HH:mm:ss')};_0x100012[_0x49e2('0x3d')]=_[_0x49e2('0x2d')](_0x100012[_0x49e2('0x3d')],_0x5e3e18);}_0x100012=_[_0x49e2('0x2d')]({},_0x100012,_0x469bc9[_0x49e2('0x2e')]);return db[_0x49e2('0x36')][_0x49e2('0x13')]({'where':_0x100012[_0x49e2('0x3d')]})[_0x49e2('0x30')](function(_0x3aff26){_0x1b1e73['count']=_0x3aff26;if(_0x469bc9[_0x49e2('0x22')]['includeAll']){_0x100012[_0x49e2('0x44')]=[{'all':!![]}];}return db[_0x49e2('0x36')]['findAll'](_0x100012);})[_0x49e2('0x30')](function(_0x3edf7a){_0x1b1e73[_0x49e2('0x45')]=_0x3edf7a;return _0x1b1e73;});}})[_0x49e2('0x30')](respondWithFilteredResult(_0x209d6e,_0x100012))['catch'](handleError(_0x209d6e,null));};exports[_0x49e2('0x46')]=function(_0x5a2b38,_0x462f46){return db[_0x49e2('0x1d')][_0x49e2('0x2f')]({'where':{'id':_0x5a2b38['params']['id']}})[_0x49e2('0x30')](handleEntityNotFound(_0x462f46,null))[_0x49e2('0x30')](function(_0x152c7b){if(_0x152c7b){return _0x152c7b['setTags'](_0x5a2b38[_0x49e2('0x33')][_0x49e2('0x37')],_[_0x49e2('0x47')](_0x5a2b38[_0x49e2('0x33')],['ids','id'])||{})[_0x49e2('0x48')](function(){return db[_0x49e2('0x49')]['findAll']({'attributes':['id',_0x49e2('0x1a'),_0x49e2('0x4a')],'where':{'id':_0x5a2b38['body'][_0x49e2('0x37')]}});})['then'](function(_0xdf6908){socket[_0x49e2('0x4b')](_0x49e2('0x4c'),{'id':Number(_0x5a2b38[_0x49e2('0x25')]['id']),'tags':_0xdf6908||[]});return{'id':Number(_0x5a2b38[_0x49e2('0x25')]['id']),'tags':_0xdf6908||[]};});}})[_0x49e2('0x30')](respondWithResult(_0x462f46,null))[_0x49e2('0x23')](handleError(_0x462f46,null));};exports[_0x49e2('0x4d')]=function(_0x26bae3,_0x42d290){return db[_0x49e2('0x1d')][_0x49e2('0x2f')]({'where':{'id':_0x26bae3['params']['id']}})[_0x49e2('0x30')](handleEntityNotFound(_0x42d290,null))[_0x49e2('0x30')](function(_0x36af48){if(_0x36af48){return _0x36af48['removeTags'](_0x26bae3[_0x49e2('0x22')][_0x49e2('0x37')]);}})[_0x49e2('0x30')](respondWithStatusCode(_0x42d290,null))[_0x49e2('0x23')](handleError(_0x42d290,null));};exports[_0x49e2('0x4e')]=function(_0x40ed8a,_0x57b48e){var _0x14dcb0=moment()[_0x49e2('0x4f')]()[_0x49e2('0x50')]();var _0x39a26c=path[_0x49e2('0x51')](config[_0x49e2('0x52')],_0x49e2('0x53'),_0x49e2('0x54'),'tmp');var _0x532975=path[_0x49e2('0x51')](config['root'],'server','files','attachments');var _0x1dd696=path[_0x49e2('0x51')](_0x39a26c,_0x14dcb0);var _0x236319=util[_0x49e2('0x43')](_0x49e2('0x55'),_0x40ed8a[_0x49e2('0x25')]['id'],_0x14dcb0);var _0x4eb4b7=path['join'](_0x39a26c,_0x236319);var _0x745869=[];_0x745869[_0x49e2('0x56')]({'model':db['User'],'as':_0x49e2('0x57'),'attributes':['id',_0x49e2('0x58')],'raw':!![]});_0x745869[_0x49e2('0x56')]({'model':db['CmContact'],'as':_0x49e2('0x59'),'attributes':['id','firstName',_0x49e2('0x5a')],'raw':!![]});if(_0x40ed8a[_0x49e2('0x22')][_0x49e2('0x5b')]){_0x745869[_0x49e2('0x56')]({'model':db[_0x49e2('0x5c')],'as':'Attachment','raw':!![]});}var _0x47bb5f=[{'model':db[_0x49e2('0x36')],'as':_0x49e2('0x5d'),'attributes':['id',_0x49e2('0x33'),_0x49e2('0x5e'),_0x49e2('0x5f'),_0x49e2('0x60'),_0x49e2('0x61')],'include':_0x745869}];_0x47bb5f[_0x49e2('0x56')]({'model':db[_0x49e2('0x62')],'as':_0x49e2('0x63'),'attributes':['id','name']});_0x47bb5f['push']({'model':db['User'],'as':_0x49e2('0x64'),'attributes':['id',_0x49e2('0x58')]});return db[_0x49e2('0x1d')][_0x49e2('0x2f')]({'where':{'id':_0x40ed8a[_0x49e2('0x25')]['id']},'include':_0x47bb5f})['then'](handleEntityNotFound(_0x57b48e,null))['then'](function(_0x1fe66b){if(_0x1fe66b){var _0x13668e=_0x1fe66b['get']({'plain':!![]});fs['mkdirSync'](_0x1dd696);var _0x462173={'channel':_0x49e2('0x65'),'account':_0x13668e['Account'][_0x49e2('0x1a')],'agent':_0x13668e[_0x49e2('0x64')]?_0x13668e[_0x49e2('0x64')]['fullname']:_0x49e2('0x66'),'createdAt':moment(_0x13668e[_0x49e2('0x5e')])[_0x49e2('0x43')]('YYYY-MM-DD\x20HH:mm:ss')[_0x49e2('0x50')](),'closedAt':_0x13668e[_0x49e2('0x67')]?moment(_0x13668e[_0x49e2('0x68')])[_0x49e2('0x43')]('YYYY-MM-DD\x20HH:mm:ss')[_0x49e2('0x50')]():'','disposition':_0x13668e[_0x49e2('0x69')],'messages':_(_0x13668e[_0x49e2('0x5d')])[_0x49e2('0x40')]({'secret':![]})[_0x49e2('0x1c')](function(_0xb3ea4){if(_0xb3ea4['Attachment']){var _0x2fd2a6=path[_0x49e2('0x51')](_0x532975,_0xb3ea4[_0x49e2('0x5c')]['basename']);if(fs['existsSync'](_0x2fd2a6)){fs['createReadStream'](_0x2fd2a6)[_0x49e2('0x6a')](fs['createWriteStream'](path[_0x49e2('0x51')](_0x1dd696,_0xb3ea4['Attachment'][_0x49e2('0x6b')])));}}return{'date':moment(_0xb3ea4[_0x49e2('0x5e')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x49e2('0x50')](),'sender':_0xb3ea4[_0x49e2('0x5f')]===_0x49e2('0x6c')?_0xb3ea4[_0x49e2('0x57')]?_0xb3ea4[_0x49e2('0x57')][_0x49e2('0x58')]:_0x49e2('0x6d'):_0xb3ea4[_0x49e2('0x59')][_0x49e2('0x6e')]+(_0xb3ea4[_0x49e2('0x59')][_0x49e2('0x5a')]?'\x20'+_0xb3ea4[_0x49e2('0x59')]['lastName']:''),'body':_0xb3ea4['Attachment']?_0xb3ea4[_0x49e2('0x5c')][_0x49e2('0x6b')]:_0xb3ea4['body'],'direction':_0xb3ea4['direction']===_0x49e2('0x6c')?'A':'C','secret':_0xb3ea4[_0x49e2('0x60')],'read':_0xb3ea4[_0x49e2('0x61')],'attachment':_0xb3ea4[_0x49e2('0x5c')]};})[_0x49e2('0x6f')]()};return ejs[_0x49e2('0x70')](path[_0x49e2('0x51')](config[_0x49e2('0x52')],_0x49e2('0x53'),_0x49e2('0x71'),_0x49e2('0x72')),{'interaction':_0x462173})['then'](function(_0x3974d8){var _0x9e7e68=path[_0x49e2('0x51')](_0x1dd696,'transcript-'+_0x13668e['id']+'-'+_0x14dcb0+_0x49e2('0x73'));var _0x140403={'path':_0x9e7e68,'channel':_0x49e2('0x65'),'interactionId':_0x13668e['id']};return pdf[_0x49e2('0x74')](_0x3974d8,_0x140403);})[_0x49e2('0x30')](function(){return new BPromise(function(_0x2623d6,_0x5751f9){zipdir(_0x1dd696,{'saveTo':_0x4eb4b7},function(_0x4d6938,_0xd901d2){if(_0x4d6938)return _0x5751f9(_0x4d6938);return _0x2623d6(_0xd901d2);});})[_0x49e2('0x30')](function(){return new BPromise(function(_0x20273c,_0x5c271f){rimraf(_0x1dd696,function(_0x5c7d71){if(_0x5c7d71)_0x5c271f(_0x5c7d71);return _0x20273c();});});})[_0x49e2('0x30')](function(){return _0x57b48e['download'](_0x4eb4b7,_0x236319,function(_0x50e70f){if(_0x50e70f){console['log'](_0x49e2('0x75'),_0x50e70f);}else{fs[_0x49e2('0x76')](_0x4eb4b7);}});});});}else{return _0x57b48e[_0x49e2('0xe')](0xc8);}})[_0x49e2('0x23')](handleError(_0x57b48e,null));}; \ No newline at end of file +var _0xb7b4=['offset','sort','pick','where','WhatsappInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','rows','addTags','setTags','spread','Tag','color','emit','removeTags','download','join','root','server','files','tmp','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','lastName','attachments','Attachment','Messages','createdAt','direction','read','Account','Owner','N.A.','toString','closed','closedAt','disposition','basename','existsSync','pipe','out','System','secret','renderFile','views','.pdf','Whatsapp','createPdfFromHTML','log','err','unlinkSync','rimraf','zip-dir','moment','path','ejs','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','register','sendStatus','status','end','json','undefined','limit','count','set','Content-Range','update','then','destroy','stack','name','index','map','rawAttributes','fieldName','type','findAll','whatsapp','catch','show','params','keys','WhatsappInteraction','query','filters','intersection','model','attributes','fields','include','merge','options','find','create','body','addMessage','WhatsappMessage','ids','omit','getMessages','length','hasOwnProperty','nolimit'];(function(_0x2808e2,_0x2570fe){var _0x57088f=function(_0x488583){while(--_0x488583){_0x2808e2['push'](_0x2808e2['shift']());}};_0x57088f(++_0x2570fe);}(_0xb7b4,0x1ad));var _0x4b7b=function(_0x385f0e,_0xa10008){_0x385f0e=_0x385f0e-0x0;var _0x41d183=_0xb7b4[_0x385f0e];return _0x41d183;};'use strict';var rimraf=require(_0x4b7b('0x0'));var zipdir=require(_0x4b7b('0x1'));var moment=require(_0x4b7b('0x2'));var BPromise=require('bluebird');var util=require('util');var path=require(_0x4b7b('0x3'));var ejs=require(_0x4b7b('0x4'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x4b7b('0x5'));var interaction=require(_0x4b7b('0x6'));var qs=require(_0x4b7b('0x7'));var pdf=require(_0x4b7b('0x8'));var logger=require(_0x4b7b('0x9'))(_0x4b7b('0xa'));var config=require(_0x4b7b('0xb'));var db=require(_0x4b7b('0xc'))['db'];config[_0x4b7b('0xd')]=_[_0x4b7b('0xe')](config[_0x4b7b('0xd')],{'host':_0x4b7b('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4b7b('0xd')]));require('./whatsappInteraction.socket')[_0x4b7b('0x10')](socket);function respondWithStatusCode(_0x873075,_0x27414b){_0x27414b=_0x27414b||0xcc;return function(_0x5b457f){if(_0x5b457f){return _0x873075[_0x4b7b('0x11')](_0x27414b);}return _0x873075[_0x4b7b('0x12')](_0x27414b)[_0x4b7b('0x13')]();};}function respondWithResult(_0x31f453,_0x469122){_0x469122=_0x469122||0xc8;return function(_0x272280){if(_0x272280){return _0x31f453[_0x4b7b('0x12')](_0x469122)[_0x4b7b('0x14')](_0x272280);}};}function respondWithFilteredResult(_0x24a13b,_0x5e3510){return function(_0x477bb6){if(_0x477bb6){var _0x136e86=typeof _0x5e3510['offset']===_0x4b7b('0x15')&&typeof _0x5e3510[_0x4b7b('0x16')]===_0x4b7b('0x15');var _0x33a7f8=_0x477bb6[_0x4b7b('0x17')];var _0x35a13b=_0x136e86?0x0:_0x5e3510['offset'];var _0x411284=_0x136e86?_0x477bb6['count']:_0x5e3510['offset']+_0x5e3510[_0x4b7b('0x16')];var _0x216b12;if(_0x411284>=_0x33a7f8){_0x411284=_0x33a7f8;_0x216b12=0xc8;}else{_0x216b12=0xce;}_0x24a13b[_0x4b7b('0x12')](_0x216b12);return _0x24a13b[_0x4b7b('0x18')](_0x4b7b('0x19'),_0x35a13b+'-'+_0x411284+'/'+_0x33a7f8)[_0x4b7b('0x14')](_0x477bb6);}return null;};}function saveUpdates(_0x590f83){return function(_0x209215){if(_0x209215){return _0x209215[_0x4b7b('0x1a')](_0x590f83)[_0x4b7b('0x1b')](function(_0x54ef79){return _0x54ef79;});}return null;};}function removeEntity(_0x1a4365){return function(_0x5dcf02){if(_0x5dcf02){return _0x5dcf02[_0x4b7b('0x1c')]()[_0x4b7b('0x1b')](function(){_0x1a4365[_0x4b7b('0x12')](0xcc)[_0x4b7b('0x13')]();});}};}function handleEntityNotFound(_0x918d1b){return function(_0x4bf891){if(!_0x4bf891){_0x918d1b[_0x4b7b('0x11')](0x194);}return _0x4bf891;};}function handleError(_0x59c6bd,_0x4660ea){_0x4660ea=_0x4660ea||0x1f4;return function(_0x70f4fa){logger['error'](_0x70f4fa[_0x4b7b('0x1d')]);if(_0x70f4fa[_0x4b7b('0x1e')]){delete _0x70f4fa[_0x4b7b('0x1e')];}_0x59c6bd[_0x4b7b('0x12')](_0x4660ea)['send'](_0x70f4fa);};}exports[_0x4b7b('0x1f')]=function(_0xfa7452,_0x44925d){var _0x2cf184={};var _0x10ec6b=_[_0x4b7b('0x20')](db['WhatsappInteraction'][_0x4b7b('0x21')],function(_0xa683b4){return{'name':_0xa683b4[_0x4b7b('0x22')],'type':_0xa683b4[_0x4b7b('0x23')]['key']};});_0x2cf184=qs['getOptions'](_0x10ec6b,_0xfa7452);return interaction[_0x4b7b('0x24')](_0x4b7b('0x25'),_0xfa7452['query'],_0xfa7452['user'],_0x2cf184,_0x10ec6b)[_0x4b7b('0x1b')](respondWithFilteredResult(_0x44925d,_0x2cf184))[_0x4b7b('0x26')](handleError(_0x44925d,null));};exports[_0x4b7b('0x27')]=function(_0x4d0df2,_0x59c9e2){var _0x228e96={'raw':![],'where':{'id':_0x4d0df2[_0x4b7b('0x28')]['id']}},_0x1c61d0={};_0x1c61d0['model']=_[_0x4b7b('0x29')](db[_0x4b7b('0x2a')]['rawAttributes']);_0x1c61d0['query']=_[_0x4b7b('0x29')](_0x4d0df2[_0x4b7b('0x2b')]);_0x1c61d0[_0x4b7b('0x2c')]=_[_0x4b7b('0x2d')](_0x1c61d0[_0x4b7b('0x2e')],_0x1c61d0[_0x4b7b('0x2b')]);_0x228e96[_0x4b7b('0x2f')]=_[_0x4b7b('0x2d')](_0x1c61d0[_0x4b7b('0x2e')],qs[_0x4b7b('0x30')](_0x4d0df2[_0x4b7b('0x2b')][_0x4b7b('0x30')]));_0x228e96[_0x4b7b('0x2f')]=_0x228e96[_0x4b7b('0x2f')]['length']?_0x228e96['attributes']:_0x1c61d0[_0x4b7b('0x2e')];if(_0x4d0df2[_0x4b7b('0x2b')]['includeAll']){_0x228e96[_0x4b7b('0x31')]=[{'all':!![]}];}_0x228e96=_[_0x4b7b('0x32')]({},_0x228e96,_0x4d0df2[_0x4b7b('0x33')]);return db[_0x4b7b('0x2a')][_0x4b7b('0x34')](_0x228e96)[_0x4b7b('0x1b')](handleEntityNotFound(_0x59c9e2,null))[_0x4b7b('0x1b')](respondWithResult(_0x59c9e2,null))['catch'](handleError(_0x59c9e2,null));};exports['create']=function(_0x4d611e,_0x5253d0){return db['WhatsappInteraction'][_0x4b7b('0x35')](_0x4d611e[_0x4b7b('0x36')],{})[_0x4b7b('0x1b')](respondWithResult(_0x5253d0,0xc9))[_0x4b7b('0x26')](handleError(_0x5253d0,null));};exports[_0x4b7b('0x1a')]=function(_0x1c1c63,_0xa2c747){if(_0x1c1c63[_0x4b7b('0x36')]['id']){delete _0x1c1c63[_0x4b7b('0x36')]['id'];}return db[_0x4b7b('0x2a')][_0x4b7b('0x34')]({'where':{'id':_0x1c1c63[_0x4b7b('0x28')]['id']}})[_0x4b7b('0x1b')](handleEntityNotFound(_0xa2c747,null))[_0x4b7b('0x1b')](saveUpdates(_0x1c1c63[_0x4b7b('0x36')],null))[_0x4b7b('0x1b')](respondWithResult(_0xa2c747,null))[_0x4b7b('0x26')](handleError(_0xa2c747,null));};exports[_0x4b7b('0x1c')]=function(_0x5edc33,_0x59f0df){return db['WhatsappInteraction'][_0x4b7b('0x34')]({'where':{'id':_0x5edc33[_0x4b7b('0x28')]['id']}})['then'](handleEntityNotFound(_0x59f0df,null))[_0x4b7b('0x1b')](removeEntity(_0x59f0df,null))[_0x4b7b('0x26')](handleError(_0x59f0df,null));};exports['describe']=function(_0x6a496e,_0x14d02d){return db['WhatsappInteraction']['describe']()[_0x4b7b('0x1b')](respondWithResult(_0x14d02d,null))[_0x4b7b('0x26')](handleError(_0x14d02d,null));};exports[_0x4b7b('0x37')]=function(_0x5d9516,_0x509ff8){return db[_0x4b7b('0x38')][_0x4b7b('0x34')]({'where':{'id':_0x5d9516[_0x4b7b('0x28')]['id']}})[_0x4b7b('0x1b')](handleEntityNotFound(_0x509ff8,null))['then'](function(_0x18bb41){if(_0x18bb41){return _0x18bb41[_0x4b7b('0x37')](_0x5d9516[_0x4b7b('0x36')][_0x4b7b('0x39')],_[_0x4b7b('0x3a')](_0x5d9516[_0x4b7b('0x36')],[_0x4b7b('0x39'),'id'])||{});}})[_0x4b7b('0x1b')](respondWithResult(_0x509ff8,null))['catch'](handleError(_0x509ff8,null));};exports[_0x4b7b('0x3b')]=function(_0x2a60b0,_0x112cd1){var _0x3d4716={'raw':![],'where':{}};var _0x50dd4f={};var _0x4bd6a3={'count':0x0,'rows':[]};return db[_0x4b7b('0x2a')]['findOne']({'where':{'id':_0x2a60b0[_0x4b7b('0x28')]['id']}})[_0x4b7b('0x1b')](handleEntityNotFound(_0x112cd1,null))[_0x4b7b('0x1b')](function(_0x387ce2){if(_0x387ce2){_0x50dd4f['model']=_[_0x4b7b('0x29')](db[_0x4b7b('0x38')]['rawAttributes']);_0x50dd4f[_0x4b7b('0x2b')]=_[_0x4b7b('0x29')](_0x2a60b0['query']);_0x50dd4f[_0x4b7b('0x2c')]=_[_0x4b7b('0x2d')](_0x50dd4f[_0x4b7b('0x2e')],_0x50dd4f['query']);_0x3d4716[_0x4b7b('0x2f')]=_[_0x4b7b('0x2d')](_0x50dd4f['model'],qs['fields'](_0x2a60b0['query'][_0x4b7b('0x30')]));_0x3d4716[_0x4b7b('0x2f')]=_0x3d4716[_0x4b7b('0x2f')][_0x4b7b('0x3c')]?_0x3d4716[_0x4b7b('0x2f')]:_0x50dd4f['model'];if(!_0x2a60b0[_0x4b7b('0x2b')][_0x4b7b('0x3d')](_0x4b7b('0x3e'))){_0x3d4716[_0x4b7b('0x16')]=qs['limit'](_0x2a60b0[_0x4b7b('0x2b')][_0x4b7b('0x16')]);_0x3d4716[_0x4b7b('0x3f')]=qs[_0x4b7b('0x3f')](_0x2a60b0['query'][_0x4b7b('0x3f')]);}_0x3d4716['order']=qs['sort'](_0x2a60b0[_0x4b7b('0x2b')][_0x4b7b('0x40')]);_0x3d4716['where']=qs[_0x4b7b('0x2c')](_[_0x4b7b('0x41')](_0x2a60b0[_0x4b7b('0x2b')],_0x50dd4f[_0x4b7b('0x2c')]));_0x3d4716[_0x4b7b('0x42')][_0x4b7b('0x43')]=_0x387ce2['id'];if(_0x2a60b0[_0x4b7b('0x2b')]['filter']){_0x3d4716[_0x4b7b('0x42')]=_[_0x4b7b('0x32')](_0x3d4716[_0x4b7b('0x42')],{'$or':_[_0x4b7b('0x20')](_0x3d4716[_0x4b7b('0x2f')],function(_0x4dd54a){var _0x83e4e4={};_0x83e4e4[_0x4dd54a]={'$like':'%'+_0x2a60b0[_0x4b7b('0x2b')][_0x4b7b('0x44')]+'%'};return _0x83e4e4;})});}if(_0x2a60b0['query'][_0x4b7b('0x45')]){var _0xf62d79=_0x2a60b0[_0x4b7b('0x2b')]['$gte'][_0x4b7b('0x46')](',');var _0xdd0c0f={};_0xdd0c0f[_0xf62d79[0x0]]={'$gte':moment(_0xf62d79[0x1])[_0x4b7b('0x47')](_0x4b7b('0x48'))};_0x3d4716[_0x4b7b('0x42')]=_[_0x4b7b('0x32')](_0x3d4716['where'],_0xdd0c0f);}_0x3d4716=_['merge']({},_0x3d4716,_0x2a60b0[_0x4b7b('0x33')]);return db['WhatsappMessage'][_0x4b7b('0x17')]({'where':_0x3d4716[_0x4b7b('0x42')]})[_0x4b7b('0x1b')](function(_0x25caf1){_0x4bd6a3[_0x4b7b('0x17')]=_0x25caf1;if(_0x2a60b0[_0x4b7b('0x2b')][_0x4b7b('0x49')]){_0x3d4716[_0x4b7b('0x31')]=[{'all':!![]}];}return db[_0x4b7b('0x38')][_0x4b7b('0x24')](_0x3d4716);})[_0x4b7b('0x1b')](function(_0x10002e){_0x4bd6a3[_0x4b7b('0x4a')]=_0x10002e;return _0x4bd6a3;});}})[_0x4b7b('0x1b')](respondWithFilteredResult(_0x112cd1,_0x3d4716))[_0x4b7b('0x26')](handleError(_0x112cd1,null));};exports[_0x4b7b('0x4b')]=function(_0x53888d,_0x42c481){return db['WhatsappInteraction'][_0x4b7b('0x34')]({'where':{'id':_0x53888d[_0x4b7b('0x28')]['id']}})[_0x4b7b('0x1b')](handleEntityNotFound(_0x42c481,null))[_0x4b7b('0x1b')](function(_0x51e7da){if(_0x51e7da){return _0x51e7da[_0x4b7b('0x4c')](_0x53888d['body']['ids'],_['omit'](_0x53888d[_0x4b7b('0x36')],[_0x4b7b('0x39'),'id'])||{})[_0x4b7b('0x4d')](function(){return db[_0x4b7b('0x4e')]['findAll']({'attributes':['id','name',_0x4b7b('0x4f')],'where':{'id':_0x53888d[_0x4b7b('0x36')][_0x4b7b('0x39')]}});})[_0x4b7b('0x1b')](function(_0x43fd8b){socket[_0x4b7b('0x50')]('whatsappInteractionTags:save',{'id':Number(_0x53888d[_0x4b7b('0x28')]['id']),'tags':_0x43fd8b||[]});return{'id':Number(_0x53888d[_0x4b7b('0x28')]['id']),'tags':_0x43fd8b||[]};});}})[_0x4b7b('0x1b')](respondWithResult(_0x42c481,null))[_0x4b7b('0x26')](handleError(_0x42c481,null));};exports[_0x4b7b('0x51')]=function(_0x5bd219,_0x339543){return db['WhatsappInteraction'][_0x4b7b('0x34')]({'where':{'id':_0x5bd219['params']['id']}})[_0x4b7b('0x1b')](handleEntityNotFound(_0x339543,null))[_0x4b7b('0x1b')](function(_0x2a53bf){if(_0x2a53bf){return _0x2a53bf[_0x4b7b('0x51')](_0x5bd219[_0x4b7b('0x2b')][_0x4b7b('0x39')]);}})['then'](respondWithStatusCode(_0x339543,null))[_0x4b7b('0x26')](handleError(_0x339543,null));};exports[_0x4b7b('0x52')]=function(_0x4b2e11,_0x1db915){var _0x24dbe2=moment()['unix']()['toString']();var _0x44a893=path[_0x4b7b('0x53')](config[_0x4b7b('0x54')],_0x4b7b('0x55'),_0x4b7b('0x56'),_0x4b7b('0x57'));var _0x43a93e=path[_0x4b7b('0x53')](config[_0x4b7b('0x54')],_0x4b7b('0x55'),_0x4b7b('0x56'),'attachments');var _0x58a96c=path[_0x4b7b('0x53')](_0x44a893,_0x24dbe2);var _0x515f6e=util[_0x4b7b('0x47')](_0x4b7b('0x58'),_0x4b2e11['params']['id'],_0x24dbe2);var _0x35148a=path[_0x4b7b('0x53')](_0x44a893,_0x515f6e);var _0x2a1270=[];_0x2a1270[_0x4b7b('0x59')]({'model':db[_0x4b7b('0x5a')],'as':_0x4b7b('0x5a'),'attributes':['id',_0x4b7b('0x5b')],'raw':!![]});_0x2a1270['push']({'model':db[_0x4b7b('0x5c')],'as':_0x4b7b('0x5d'),'attributes':['id',_0x4b7b('0x5e'),_0x4b7b('0x5f')],'raw':!![]});if(_0x4b2e11[_0x4b7b('0x2b')][_0x4b7b('0x60')]){_0x2a1270['push']({'model':db['Attachment'],'as':_0x4b7b('0x61'),'raw':!![]});}var _0x40bb8d=[{'model':db[_0x4b7b('0x38')],'as':_0x4b7b('0x62'),'attributes':['id',_0x4b7b('0x36'),_0x4b7b('0x63'),_0x4b7b('0x64'),'secret',_0x4b7b('0x65')],'include':_0x2a1270}];_0x40bb8d[_0x4b7b('0x59')]({'model':db['WhatsappAccount'],'as':_0x4b7b('0x66'),'attributes':['id',_0x4b7b('0x1e')]});_0x40bb8d['push']({'model':db['User'],'as':_0x4b7b('0x67'),'attributes':['id','fullname']});return db[_0x4b7b('0x2a')][_0x4b7b('0x34')]({'where':{'id':_0x4b2e11[_0x4b7b('0x28')]['id']},'include':_0x40bb8d})[_0x4b7b('0x1b')](handleEntityNotFound(_0x1db915,null))['then'](function(_0x258ed5){if(_0x258ed5){var _0x157097=_0x258ed5['get']({'plain':!![]});fs['mkdirSync'](_0x58a96c);var _0x532807={'channel':'Whatsapp','account':_0x157097['Account'][_0x4b7b('0x1e')],'agent':_0x157097['Owner']?_0x157097[_0x4b7b('0x67')][_0x4b7b('0x5b')]:_0x4b7b('0x68'),'createdAt':moment(_0x157097['createdAt'])[_0x4b7b('0x47')]('YYYY-MM-DD\x20HH:mm:ss')[_0x4b7b('0x69')](),'closedAt':_0x157097[_0x4b7b('0x6a')]?moment(_0x157097[_0x4b7b('0x6b')])[_0x4b7b('0x47')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x157097[_0x4b7b('0x6c')],'messages':_(_0x157097[_0x4b7b('0x62')])[_0x4b7b('0x44')]({'secret':![]})['map'](function(_0x169058){if(_0x169058['Attachment']){var _0x36ace4=path['join'](_0x43a93e,_0x169058[_0x4b7b('0x61')][_0x4b7b('0x6d')]);if(fs[_0x4b7b('0x6e')](_0x36ace4)){fs['createReadStream'](_0x36ace4)[_0x4b7b('0x6f')](fs['createWriteStream'](path['join'](_0x58a96c,_0x169058[_0x4b7b('0x61')][_0x4b7b('0x6d')])));}}return{'date':moment(_0x169058[_0x4b7b('0x63')])['format']('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x169058[_0x4b7b('0x64')]===_0x4b7b('0x70')?_0x169058[_0x4b7b('0x5a')]?_0x169058['User']['fullname']:_0x4b7b('0x71'):_0x169058[_0x4b7b('0x5d')][_0x4b7b('0x5e')]+(_0x169058[_0x4b7b('0x5d')][_0x4b7b('0x5f')]?'\x20'+_0x169058['Contact'][_0x4b7b('0x5f')]:''),'body':_0x169058[_0x4b7b('0x61')]?_0x169058[_0x4b7b('0x61')]['basename']:_0x169058[_0x4b7b('0x36')],'direction':_0x169058[_0x4b7b('0x64')]===_0x4b7b('0x70')?'A':'C','secret':_0x169058[_0x4b7b('0x72')],'read':_0x169058[_0x4b7b('0x65')],'attachment':_0x169058[_0x4b7b('0x61')]};})['value']()};return ejs[_0x4b7b('0x73')](path[_0x4b7b('0x53')](config[_0x4b7b('0x54')],_0x4b7b('0x55'),_0x4b7b('0x74'),'downloadInteraction.ejs'),{'interaction':_0x532807})[_0x4b7b('0x1b')](function(_0x607106){var _0x508946=path[_0x4b7b('0x53')](_0x58a96c,'transcript-'+_0x157097['id']+'-'+_0x24dbe2+_0x4b7b('0x75'));var _0x382fdb={'path':_0x508946,'channel':_0x4b7b('0x76'),'interactionId':_0x157097['id']};return pdf[_0x4b7b('0x77')](_0x607106,_0x382fdb);})[_0x4b7b('0x1b')](function(){return new BPromise(function(_0xa2cc74,_0x43ffc6){zipdir(_0x58a96c,{'saveTo':_0x35148a},function(_0x10e810,_0x335583){if(_0x10e810)return _0x43ffc6(_0x10e810);return _0xa2cc74(_0x335583);});})[_0x4b7b('0x1b')](function(){return new BPromise(function(_0x26988e,_0x50e139){rimraf(_0x58a96c,function(_0x21cf63){if(_0x21cf63)_0x50e139(_0x21cf63);return _0x26988e();});});})[_0x4b7b('0x1b')](function(){return _0x1db915[_0x4b7b('0x52')](_0x35148a,_0x515f6e,function(_0x282ec9){if(_0x282ec9){console[_0x4b7b('0x78')](_0x4b7b('0x79'),_0x282ec9);}else{fs[_0x4b7b('0x7a')](_0x35148a);}});});});}else{return _0x1db915['sendStatus'](0xc8);}})[_0x4b7b('0x26')](handleError(_0x1db915,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 270de7c..6665629 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 _0x0269=['catch','hook','exports','events','WhatsappInteraction','WhatsappMessage','save','update','remove','setDataValue','Users','map','findAll','then','unreadMessages','length','emit'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0269,0x135));var _0x9026=function(_0x16ad5b,_0x567685){_0x16ad5b=_0x16ad5b-0x0;var _0x3bb8e4=_0x0269[_0x16ad5b];return _0x3bb8e4;};'use strict';var EventEmitter=require(_0x9026('0x0'));var WhatsappInteraction=require('../../mysqldb')['db'][_0x9026('0x1')];var WhatsappMessage=require('../../mysqldb')['db'][_0x9026('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9026('0x3'),'afterUpdate':_0x9026('0x4'),'afterDestroy':_0x9026('0x5')};function emitEvent(_0xa3ba06){return function(_0x5e9212,_0x314458,_0x15ff31){_0x5e9212['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x97c0c3){_0x5e9212[_0x9026('0x6')](_0x9026('0x7'),_0x97c0c3[_0x9026('0x8')](function(_0x55f4df){return{'id':_0x55f4df['id']};}));return WhatsappMessage[_0x9026('0x9')]({'where':{'WhatsappInteractionId':_0x5e9212['id'],'direction':'in','read':![]},'raw':!![]});})[_0x9026('0xa')](function(_0x1706bf){_0x5e9212['setDataValue'](_0x9026('0xb'),_0x1706bf[_0x9026('0xc')]);WhatsappInteractionEvents[_0x9026('0xd')](_0xa3ba06+':'+_0x5e9212['id'],_0x5e9212);WhatsappInteractionEvents['emit'](_0xa3ba06,_0x5e9212);_0x15ff31(null);})[_0x9026('0xe')](_0x15ff31(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction[_0x9026('0xf')](e,emitEvent(event));}}module[_0x9026('0x10')]=WhatsappInteractionEvents; \ No newline at end of file +var _0xa75b=['setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update','remove','getUsers','then','map'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa75b,0x170));var _0xba75=function(_0x44f1d9,_0x8840f0){_0x44f1d9=_0x44f1d9-0x0;var _0x4712b0=_0xa75b[_0x44f1d9];return _0x4712b0;};'use strict';var EventEmitter=require(_0xba75('0x0'));var WhatsappInteraction=require('../../mysqldb')['db']['WhatsappInteraction'];var WhatsappMessage=require(_0xba75('0x1'))['db'][_0xba75('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xba75('0x3')](0x0);var events={'afterCreate':_0xba75('0x4'),'afterUpdate':_0xba75('0x5'),'afterDestroy':_0xba75('0x6')};function emitEvent(_0x152269){return function(_0x398bd5,_0x32a1e9,_0x41afc9){_0x398bd5[_0xba75('0x7')]({'attributes':['id'],'raw':!![]})[_0xba75('0x8')](function(_0x3ccab5){_0x398bd5['setDataValue']('Users',_0x3ccab5[_0xba75('0x9')](function(_0x52669f){return{'id':_0x52669f['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x398bd5['id'],'direction':'in','read':![]},'raw':!![]});})[_0xba75('0x8')](function(_0x4f4d0a){_0x398bd5[_0xba75('0xa')](_0xba75('0xb'),_0x4f4d0a[_0xba75('0xc')]);WhatsappInteractionEvents[_0xba75('0xd')](_0x152269+':'+_0x398bd5['id'],_0x398bd5);WhatsappInteractionEvents[_0xba75('0xd')](_0x152269,_0x398bd5);_0x41afc9(null);})[_0xba75('0xe')](_0x41afc9(null));};}for(var e in events){if(events[_0xba75('0xf')](e)){var event=events[e];WhatsappInteraction[_0xba75('0x10')](e,emitEvent(event));}}module[_0xba75('0x11')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index b9ae312..88d12f6 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 _0x88e3=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','define','whatsapp_interactions','changed','closed','format','lodash','util','../../config/logger','api'];(function(_0x3e7d35,_0x1fe5f6){var _0x559261=function(_0x2fdde8){while(--_0x2fdde8){_0x3e7d35['push'](_0x3e7d35['shift']());}};_0x559261(++_0x1fe5f6);}(_0x88e3,0x183));var _0x388e=function(_0x34a14d,_0xc49d24){_0x34a14d=_0x34a14d-0x0;var _0x2015f2=_0x88e3[_0x34a14d];return _0x2015f2;};'use strict';var _=require(_0x388e('0x0'));var util=require(_0x388e('0x1'));var logger=require(_0x388e('0x2'))(_0x388e('0x3'));var moment=require(_0x388e('0x4'));var BPromise=require(_0x388e('0x5'));var rp=require(_0x388e('0x6'));var fs=require('fs');var path=require(_0x388e('0x7'));var rimraf=require(_0x388e('0x8'));var config=require(_0x388e('0x9'));var attributes=require(_0x388e('0xa'));module[_0x388e('0xb')]=function(_0x43d8b5,_0x5d01ba){return _0x43d8b5[_0x388e('0xc')]('WhatsappInteraction',attributes,{'tableName':_0x388e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2ac35b,_0x4e5a3a,_0x52998a){if(_0x2ac35b[_0x388e('0xe')](_0x388e('0xf'))){_0x2ac35b['closedAt']=moment()[_0x388e('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}_0x52998a(null,_0x2ac35b);}}});}; \ No newline at end of file +var _0xfb0e=['path','exports','define','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','api','moment','bluebird'];(function(_0x2dbcb2,_0x5729cd){var _0x4f3b0f=function(_0x34a78a){while(--_0x34a78a){_0x2dbcb2['push'](_0x2dbcb2['shift']());}};_0x4f3b0f(++_0x5729cd);}(_0xfb0e,0x1e8));var _0xefb0=function(_0x587fb5,_0x59cb3b){_0x587fb5=_0x587fb5-0x0;var _0x551105=_0xfb0e[_0x587fb5];return _0x551105;};'use strict';var _=require('lodash');var util=require(_0xefb0('0x0'));var logger=require('../../config/logger')(_0xefb0('0x1'));var moment=require(_0xefb0('0x2'));var BPromise=require(_0xefb0('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xefb0('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./whatsappInteraction.attributes');module[_0xefb0('0x5')]=function(_0x2fcfdb,_0x30ed5b){return _0x2fcfdb[_0xefb0('0x6')]('WhatsappInteraction',attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x536618,_0x5e1bae,_0x144b3b){if(_0x536618[_0xefb0('0x7')](_0xefb0('0x8'))){_0x536618[_0xefb0('0x9')]=moment()[_0xefb0('0xa')](_0xefb0('0xb'));}_0x144b3b(null,_0x536618);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index d9a3edd..60859dd 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 _0x7e96=['info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','error','message','result','UpdateWhatsappInteraction','WhatsappInteraction','update','body','raw','options','attributes','debug','catch','find','ids','spread','AddTags','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','defaults','localhost','socket.io-emitter','redis','./whatsappInteraction.socket','request','then'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x7e96,0x1ab));var _0x67e9=function(_0x2e3097,_0x457ec2){_0x2e3097=_0x2e3097-0x0;var _0x5c19bb=_0x7e96[_0x2e3097];return _0x5c19bb;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x67e9('0x0'));var BPromise=require(_0x67e9('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x67e9('0x2'))['db'];var utils=require(_0x67e9('0x3'));var logger=require(_0x67e9('0x4'))(_0x67e9('0x5'));var config=require(_0x67e9('0x6'));var jayson=require(_0x67e9('0x7'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x67e9('0x8')](config['redis'],{'host':_0x67e9('0x9'),'port':0x18eb});var socket=require(_0x67e9('0xa'))(new Redis(config[_0x67e9('0xb')]));require(_0x67e9('0xc'))['register'](socket);function respondWithRpcPromise(_0x19a3a6,_0x1d1c56,_0x43138c){return new BPromise(function(_0x311281,_0x530b14){return client[_0x67e9('0xd')](_0x19a3a6,_0x43138c)[_0x67e9('0xe')](function(_0x349ee3){logger[_0x67e9('0xf')](_0x67e9('0x10'),_0x1d1c56,'request\x20sent');logger['debug']('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x1d1c56,_0x67e9('0x11'),JSON['stringify'](_0x349ee3));if(_0x349ee3['error']){if(_0x349ee3[_0x67e9('0x12')]['code']===0x1f4){logger['error'](_0x67e9('0x10'),_0x1d1c56,_0x349ee3['error'][_0x67e9('0x13')]);return _0x530b14(_0x349ee3[_0x67e9('0x12')][_0x67e9('0x13')]);}logger[_0x67e9('0x12')](_0x67e9('0x10'),_0x1d1c56,_0x349ee3[_0x67e9('0x12')][_0x67e9('0x13')]);return _0x311281(_0x349ee3['error'][_0x67e9('0x13')]);}else{logger[_0x67e9('0xf')](_0x67e9('0x10'),_0x1d1c56,_0x67e9('0x11'));_0x311281(_0x349ee3[_0x67e9('0x14')][_0x67e9('0x13')]);}})['catch'](function(_0x5a101e){logger['error'](_0x67e9('0x10'),_0x1d1c56,_0x5a101e);_0x530b14(_0x5a101e);});});}exports[_0x67e9('0x15')]=function(_0x28309e){var _0xa76971=this;return new Promise(function(_0x50994f,_0x4b021e){return db[_0x67e9('0x16')][_0x67e9('0x17')](_0x28309e[_0x67e9('0x18')],{'raw':_0x28309e['options']?_0x28309e['options'][_0x67e9('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x28309e[_0x67e9('0x1a')]?_0x28309e[_0x67e9('0x1a')]['where']||null:null,'attributes':_0x28309e[_0x67e9('0x1a')]?_0x28309e[_0x67e9('0x1a')][_0x67e9('0x1b')]||null:null,'limit':_0x28309e['options']?_0x28309e[_0x67e9('0x1a')]['limit']||null:null})[_0x67e9('0xe')](function(_0x1eaf5f){logger[_0x67e9('0xf')](_0x67e9('0x15'),_0x28309e);logger[_0x67e9('0x1c')]('UpdateWhatsappInteraction',_0x28309e,JSON['stringify'](_0x1eaf5f));_0x50994f(_0x1eaf5f);})[_0x67e9('0x1d')](function(_0x36aee9){logger['error'](_0x67e9('0x15'),_0x36aee9[_0x67e9('0x13')],_0x28309e);_0x4b021e(_0xa76971[_0x67e9('0x12')](0x1f4,_0x36aee9[_0x67e9('0x13')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x401ec9){return new Promise(function(_0x1f46f0,_0x25cfe6){return db[_0x67e9('0x16')][_0x67e9('0x1e')]({'where':_0x401ec9[_0x67e9('0x1a')]?_0x401ec9['options']['where']||null:null})[_0x67e9('0xe')](function(_0x6d2d11){if(_0x6d2d11){return _0x6d2d11['addTags'](_0x401ec9[_0x67e9('0x18')][_0x67e9('0x1f')],_['omit'](_0x401ec9[_0x67e9('0x18')],[_0x67e9('0x1f'),'id'])||{});}})[_0x67e9('0x20')](function(_0x3d4d4f){logger[_0x67e9('0xf')](_0x67e9('0x21'),_0x401ec9);logger['debug'](_0x67e9('0x21'),_0x401ec9,JSON['stringify'](_0x3d4d4f));_0x1f46f0(_0x3d4d4f);})[_0x67e9('0x1d')](function(_0x167985){logger[_0x67e9('0x12')]('AddTags',_0x167985[_0x67e9('0x13')],_0x401ec9);_0x25cfe6(_this[_0x67e9('0x12')](0x1f4,_0x167985['message']));});});}; \ No newline at end of file +var _0x61e0=['info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','UpdateWhatsappInteraction','update','body','options','attributes','debug','AddTagsToWhatsappInteraction','WhatsappInteraction','find','where','addTags','ids','omit','spread','AddTags','lodash','util','moment','randomstring','../../config/logger','rpc','jayson/promise','http','redis','localhost','socket.io-emitter','request','then'];(function(_0x197065,_0x2e79d0){var _0x3d9404=function(_0xf582a7){while(--_0xf582a7){_0x197065['push'](_0x197065['shift']());}};_0x3d9404(++_0x2e79d0);}(_0x61e0,0x113));var _0x061e=function(_0x1cae6f,_0x5afb6b){_0x1cae6f=_0x1cae6f-0x0;var _0x2bc048=_0x61e0[_0x1cae6f];return _0x2bc048;};'use strict';var _=require(_0x061e('0x0'));var util=require(_0x061e('0x1'));var moment=require(_0x061e('0x2'));var BPromise=require('bluebird');var rs=require(_0x061e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x061e('0x4'))(_0x061e('0x5'));var config=require('../../config/environment');var jayson=require(_0x061e('0x6'));var client=jayson['client'][_0x061e('0x7')]({'port':0x232a});config[_0x061e('0x8')]=_['defaults'](config[_0x061e('0x8')],{'host':_0x061e('0x9'),'port':0x18eb});var socket=require(_0x061e('0xa'))(new Redis(config[_0x061e('0x8')]));require('./whatsappInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x2a62ce,_0x309c78,_0x38f4d0){return new BPromise(function(_0x26f4fc,_0x37cf6b){return client[_0x061e('0xb')](_0x2a62ce,_0x38f4d0)[_0x061e('0xc')](function(_0x195e71){logger[_0x061e('0xd')](_0x061e('0xe'),_0x309c78,'request\x20sent');logger['debug']('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x309c78,_0x061e('0xf'),JSON[_0x061e('0x10')](_0x195e71));if(_0x195e71[_0x061e('0x11')]){if(_0x195e71[_0x061e('0x11')][_0x061e('0x12')]===0x1f4){logger[_0x061e('0x11')](_0x061e('0xe'),_0x309c78,_0x195e71['error'][_0x061e('0x13')]);return _0x37cf6b(_0x195e71['error'][_0x061e('0x13')]);}logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x309c78,_0x195e71[_0x061e('0x11')][_0x061e('0x13')]);return _0x26f4fc(_0x195e71[_0x061e('0x11')][_0x061e('0x13')]);}else{logger[_0x061e('0xd')](_0x061e('0xe'),_0x309c78,_0x061e('0xf'));_0x26f4fc(_0x195e71['result'][_0x061e('0x13')]);}})[_0x061e('0x14')](function(_0x2d786a){logger['error'](_0x061e('0xe'),_0x309c78,_0x2d786a);_0x37cf6b(_0x2d786a);});});}exports[_0x061e('0x15')]=function(_0x8ed898){var _0xbdb8a2=this;return new Promise(function(_0x4ae85f,_0x10b0e9){return db['WhatsappInteraction'][_0x061e('0x16')](_0x8ed898[_0x061e('0x17')],{'raw':_0x8ed898['options']?_0x8ed898[_0x061e('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x8ed898[_0x061e('0x18')]?_0x8ed898[_0x061e('0x18')]['where']||null:null,'attributes':_0x8ed898['options']?_0x8ed898['options'][_0x061e('0x19')]||null:null,'limit':_0x8ed898[_0x061e('0x18')]?_0x8ed898[_0x061e('0x18')]['limit']||null:null})[_0x061e('0xc')](function(_0x926b40){logger[_0x061e('0xd')]('UpdateWhatsappInteraction',_0x8ed898);logger[_0x061e('0x1a')](_0x061e('0x15'),_0x8ed898,JSON[_0x061e('0x10')](_0x926b40));_0x4ae85f(_0x926b40);})[_0x061e('0x14')](function(_0x5d48ff){logger[_0x061e('0x11')](_0x061e('0x15'),_0x5d48ff[_0x061e('0x13')],_0x8ed898);_0x10b0e9(_0xbdb8a2['error'](0x1f4,_0x5d48ff['message']));});});};exports[_0x061e('0x1b')]=function(_0x15b5fb){return new Promise(function(_0x160668,_0x227985){return db[_0x061e('0x1c')][_0x061e('0x1d')]({'where':_0x15b5fb[_0x061e('0x18')]?_0x15b5fb[_0x061e('0x18')][_0x061e('0x1e')]||null:null})[_0x061e('0xc')](function(_0x21c415){if(_0x21c415){return _0x21c415[_0x061e('0x1f')](_0x15b5fb[_0x061e('0x17')][_0x061e('0x20')],_[_0x061e('0x21')](_0x15b5fb[_0x061e('0x17')],[_0x061e('0x20'),'id'])||{});}})[_0x061e('0x22')](function(_0x2a2c54){logger['info'](_0x061e('0x23'),_0x15b5fb);logger['debug']('AddTags',_0x15b5fb,JSON[_0x061e('0x10')](_0x2a2c54));_0x160668(_0x2a2c54);})[_0x061e('0x14')](function(_0x82008d){logger[_0x061e('0x11')]('AddTags',_0x82008d['message'],_0x15b5fb);_0x227985(_this[_0x061e('0x11')](0x1f4,_0x82008d[_0x061e('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 5054106..a4e3a5a 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 _0x3a9a=['register','length','whatsappInteraction:','save','remove','update','emit','removeListener'];(function(_0x299f2c,_0x3e26f3){var _0x3d1389=function(_0x5ab3c0){while(--_0x5ab3c0){_0x299f2c['push'](_0x299f2c['shift']());}};_0x3d1389(++_0x3e26f3);}(_0x3a9a,0x12b));var _0xa3a9=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0x3a9a[_0x344a3f];return _0x264712;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=[_0xa3a9('0x0'),_0xa3a9('0x1'),_0xa3a9('0x2')];function createListener(_0x4b7518,_0x56ab7c){return function(_0x1b4ab0){_0x56ab7c[_0xa3a9('0x3')](_0x4b7518,_0x1b4ab0);};}function removeListener(_0x40e277,_0x3fe0df){return function(){WhatsappInteractionEvents[_0xa3a9('0x4')](_0x40e277,_0x3fe0df);};}exports[_0xa3a9('0x5')]=function(_0x16db77){for(var _0x1a5b13=0x0,_0x344709=events[_0xa3a9('0x6')];_0x1a5b13<_0x344709;_0x1a5b13++){var _0x39a6c3=events[_0x1a5b13];var _0x10c9aa=createListener(_0xa3a9('0x7')+_0x39a6c3,_0x16db77);WhatsappInteractionEvents['on'](_0x39a6c3,_0x10c9aa);}}; \ No newline at end of file +var _0x1cd5=['update','emit','removeListener','length','remove'];(function(_0x1cf052,_0x5df7ec){var _0x117bc0=function(_0x3034cd){while(--_0x3034cd){_0x1cf052['push'](_0x1cf052['shift']());}};_0x117bc0(++_0x5df7ec);}(_0x1cd5,0x1e4));var _0x51cd=function(_0x3b86bd,_0x45c6f9){_0x3b86bd=_0x3b86bd-0x0;var _0x6647af=_0x1cd5[_0x3b86bd];return _0x6647af;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=['save',_0x51cd('0x0'),_0x51cd('0x1')];function createListener(_0x3b4b47,_0x1b90d8){return function(_0x293027){_0x1b90d8[_0x51cd('0x2')](_0x3b4b47,_0x293027);};}function removeListener(_0x287361,_0x568d9f){return function(){WhatsappInteractionEvents[_0x51cd('0x3')](_0x287361,_0x568d9f);};}exports['register']=function(_0x2e3bfc){for(var _0x3ec3ea=0x0,_0x40546e=events[_0x51cd('0x4')];_0x3ec3ea<_0x40546e;_0x3ec3ea++){var _0x1610b7=events[_0x3ec3ea];var _0x11f6ca=createListener('whatsappInteraction:'+_0x1610b7,_0x2e3bfc);WhatsappInteractionEvents['on'](_0x1610b7,_0x11f6ca);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index dfa8d84..880b87c 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 _0x60d2=['index','get','/describe','describe','/:id','show','post','tracked','whatsappmessage:create','create','/:id/status','status','put','/:id/accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','./whatsappMessage.controller','isAuthenticated'];(function(_0x594fee,_0x494894){var _0x21c598=function(_0x28dcad){while(--_0x28dcad){_0x594fee['push'](_0x594fee['shift']());}};_0x21c598(++_0x494894);}(_0x60d2,0x157));var _0x260d=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x60d2[_0x209941];return _0x1e8729;};'use strict';var multer=require(_0x260d('0x0'));var util=require(_0x260d('0x1'));var path=require(_0x260d('0x2'));var timeout=require(_0x260d('0x3'));var express=require('express');var router=express[_0x260d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x260d('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x260d('0x6'));router['get']('/',auth[_0x260d('0x7')](),controller[_0x260d('0x8')]);router[_0x260d('0x9')](_0x260d('0xa'),auth[_0x260d('0x7')](),controller[_0x260d('0xb')]);router[_0x260d('0x9')](_0x260d('0xc'),auth['isAuthenticated'](),controller[_0x260d('0xd')]);router[_0x260d('0xe')]('/',auth[_0x260d('0x7')](),interaction[_0x260d('0xf')]('whatsapp',_0x260d('0x10')),controller[_0x260d('0x11')]);router[_0x260d('0xe')](_0x260d('0x12'),controller[_0x260d('0x13')]);router['put'](_0x260d('0xc'),auth[_0x260d('0x7')](),controller['update']);router[_0x260d('0x14')](_0x260d('0x15'),auth[_0x260d('0x7')](),controller['accept']);router[_0x260d('0x14')](_0x260d('0x16'),auth['isAuthenticated'](),controller[_0x260d('0x17')]);router[_0x260d('0x18')](_0x260d('0xc'),auth[_0x260d('0x7')](),controller[_0x260d('0x19')]);module[_0x260d('0x1a')]=router; \ No newline at end of file +var _0x08e0=['whatsappmessage:create','create','/:id/status','status','/:id','update','put','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','isAuthenticated','index','/describe','show','post','tracked','whatsapp'];(function(_0x353430,_0x5717c9){var _0x213ffb=function(_0x1886d4){while(--_0x1886d4){_0x353430['push'](_0x353430['shift']());}};_0x213ffb(++_0x5717c9);}(_0x08e0,0x1be));var _0x008e=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x08e0[_0x263a74];return _0x2aa86c;};'use strict';var multer=require('multer');var util=require(_0x008e('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x008e('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0x008e('0x2'));var interaction=require(_0x008e('0x3'));var config=require(_0x008e('0x4'));var controller=require(_0x008e('0x5'));router['get']('/',auth[_0x008e('0x6')](),controller[_0x008e('0x7')]);router['get'](_0x008e('0x8'),auth[_0x008e('0x6')](),controller['describe']);router['get']('/:id',auth[_0x008e('0x6')](),controller[_0x008e('0x9')]);router[_0x008e('0xa')]('/',auth[_0x008e('0x6')](),interaction[_0x008e('0xb')](_0x008e('0xc'),_0x008e('0xd')),controller[_0x008e('0xe')]);router[_0x008e('0xa')](_0x008e('0xf'),controller[_0x008e('0x10')]);router['put'](_0x008e('0x11'),auth[_0x008e('0x6')](),controller[_0x008e('0x12')]);router[_0x008e('0x13')](_0x008e('0x14'),auth[_0x008e('0x6')](),controller[_0x008e('0x15')]);router[_0x008e('0x13')](_0x008e('0x16'),auth[_0x008e('0x6')](),controller[_0x008e('0x17')]);router[_0x008e('0x18')](_0x008e('0x11'),auth[_0x008e('0x6')](),controller[_0x008e('0x19')]);module[_0x008e('0x1a')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 36bce6c..079314a 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 _0x3337=['BOOLEAN','ENUM','out','STRING','DATE','TEXT','sequelize','exports'];(function(_0x156515,_0x760da4){var _0x3e1e8b=function(_0x23970a){while(--_0x23970a){_0x156515['push'](_0x156515['shift']());}};_0x3e1e8b(++_0x760da4);}(_0x3337,0x12e));var _0x7333=function(_0x73dcd,_0x482364){_0x73dcd=_0x73dcd-0x0;var _0x4949fa=_0x3337[_0x73dcd];return _0x4949fa;};'use strict';var Sequelize=require(_0x7333('0x0'));module[_0x7333('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x7333('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x7333('0x3')]('in',_0x7333('0x4')),'defaultValue':_0x7333('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x7333('0x5')](0xbe)},'phone':{'type':Sequelize[_0x7333('0x5')]},'readAt':{'type':Sequelize[_0x7333('0x6')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x7333('0x5')]},'providerResponse':{'type':Sequelize[_0x7333('0x7')]}}; \ No newline at end of file +var _0xe06f=['out','STRING','DATE','sequelize','exports','medium','ENUM'];(function(_0x26b622,_0x237e9e){var _0x58a028=function(_0xde1652){while(--_0xde1652){_0x26b622['push'](_0x26b622['shift']());}};_0x58a028(++_0x237e9e);}(_0xe06f,0x65));var _0xfe06=function(_0x3477fe,_0x5f09ba){_0x3477fe=_0x3477fe-0x0;var _0x5a018c=_0xe06f[_0x3477fe];return _0x5a018c;};'use strict';var Sequelize=require(_0xfe06('0x0'));module[_0xfe06('0x1')]={'body':{'type':Sequelize['TEXT'](_0xfe06('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xfe06('0x3')]('in',_0xfe06('0x4')),'defaultValue':_0xfe06('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0xfe06('0x5')](0xbe)},'phone':{'type':Sequelize[_0xfe06('0x5')]},'readAt':{'type':Sequelize[_0xfe06('0x6')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 2170dd4..6c8a384 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 _0x884c=['motionChannel','event','EventManager','role','null','RejectMessage','rejectMessage','ContactId','sequelize','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','MessageStatus','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','client','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','sendStatus','name','index','map','WhatsappMessage','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','rows','show','params','fields','find','create','body','describe','whatsapp-interactions','accept','whatsapp','read','format','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','manual','interface','SIP/%s','channel'];(function(_0x2265f8,_0x2d92c7){var _0x2b14d0=function(_0x91b1d3){while(--_0x91b1d3){_0x2265f8['push'](_0x2265f8['shift']());}};_0x2b14d0(++_0x2d92c7);}(_0x884c,0x1b6));var _0xc884=function(_0x35864a,_0x31a2ca){_0x35864a=_0x35864a-0x0;var _0x21e098=_0x884c[_0x35864a];return _0x21e098;};'use strict';var emlformat=require(_0xc884('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc884('0x1'));var jsonpatch=require(_0xc884('0x2'));var rp=require(_0xc884('0x3'));var moment=require('moment');var BPromise=require(_0xc884('0x4'));var Mustache=require('mustache');var util=require(_0xc884('0x5'));var path=require(_0xc884('0x6'));var sox=require(_0xc884('0x7'));var csv=require(_0xc884('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc884('0x9'));var _=require(_0xc884('0xa'));var squel=require(_0xc884('0xb'));var crypto=require(_0xc884('0xc'));var jsforce=require(_0xc884('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xc884('0x8'));var querystring=require(_0xc884('0xe'));var Papa=require('papaparse');var Redis=require(_0xc884('0xf'));var authService=require(_0xc884('0x10'));var qs=require(_0xc884('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc884('0x12'));var logger=require(_0xc884('0x13'))('api');var utils=require(_0xc884('0x14'));var config=require(_0xc884('0x15'));var licenseUtil=require(_0xc884('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xc884('0x17')](config[_0xc884('0x18')],{'host':_0xc884('0x19'),'port':0x18eb});var socket=require(_0xc884('0x1a'))(new Redis(config[_0xc884('0x18')]));require(_0xc884('0x1b'))[_0xc884('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0xc884('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x448bf1,_0x417541,_0x2c9d09,_0x2ad62d){return new BPromise(function(_0x39017d,_0x587b3e){var _0x158e21=_0x2ad62d||client;return _0x158e21[_0xc884('0x1e')](_0x448bf1,_0x2c9d09)[_0xc884('0x1f')](function(_0x3fab1a){logger[_0xc884('0x20')](_0xc884('0x21'),_0x417541,_0xc884('0x22'));logger[_0xc884('0x23')](_0xc884('0x24'),_0x417541,_0xc884('0x22'),JSON[_0xc884('0x25')](_0x3fab1a));if(_0x3fab1a[_0xc884('0x26')]){if(_0x3fab1a[_0xc884('0x26')][_0xc884('0x27')]===0x1f4){logger[_0xc884('0x26')](_0xc884('0x21'),_0x417541,_0x3fab1a[_0xc884('0x26')]['message']);return _0x587b3e(_0x3fab1a[_0xc884('0x26')][_0xc884('0x28')]);}logger[_0xc884('0x26')](_0xc884('0x21'),_0x417541,_0x3fab1a[_0xc884('0x26')][_0xc884('0x28')]);return _0x39017d(_0x3fab1a[_0xc884('0x26')][_0xc884('0x28')]);}else{logger[_0xc884('0x20')](_0xc884('0x21'),_0x417541,_0xc884('0x22'));_0x39017d(_0x3fab1a[_0xc884('0x29')][_0xc884('0x28')]);}})[_0xc884('0x2a')](function(_0x1aa2ca){logger[_0xc884('0x26')]('WhatsappMessage,\x20%s,\x20%s',_0x417541,_0x1aa2ca);_0x587b3e(_0x1aa2ca);});});}function respondWithStatusCode(_0x2f9511,_0x5c344b){_0x5c344b=_0x5c344b||0xcc;return function(_0x28cadb){if(_0x28cadb){return _0x2f9511['sendStatus'](_0x5c344b);}return _0x2f9511[_0xc884('0x2b')](_0x5c344b)[_0xc884('0x2c')]();};}function respondWithResult(_0x57586e,_0x140606){_0x140606=_0x140606||0xc8;return function(_0x4c3350){if(_0x4c3350){return _0x57586e[_0xc884('0x2b')](_0x140606)[_0xc884('0x2d')](_0x4c3350);}};}function respondWithFilteredResult(_0x3ffd96,_0x31ccbf){return function(_0x540127){if(_0x540127){var _0x2a8002=typeof _0x31ccbf[_0xc884('0x2e')]===_0xc884('0x2f')&&typeof _0x31ccbf['limit']==='undefined';var _0x5dcfee=_0x540127[_0xc884('0x30')];var _0x2405bf=_0x2a8002?0x0:_0x31ccbf[_0xc884('0x2e')];var _0x400e55=_0x2a8002?_0x540127[_0xc884('0x30')]:_0x31ccbf[_0xc884('0x2e')]+_0x31ccbf[_0xc884('0x31')];var _0x4b7548;if(_0x400e55>=_0x5dcfee){_0x400e55=_0x5dcfee;_0x4b7548=0xc8;}else{_0x4b7548=0xce;}_0x3ffd96[_0xc884('0x2b')](_0x4b7548);return _0x3ffd96[_0xc884('0x32')](_0xc884('0x33'),_0x2405bf+'-'+_0x400e55+'/'+_0x5dcfee)[_0xc884('0x2d')](_0x540127);}return null;};}function patchUpdates(_0x42a95b){return function(_0x33b100){try{jsonpatch[_0xc884('0x34')](_0x33b100,_0x42a95b,!![]);}catch(_0x443352){return BPromise[_0xc884('0x35')](_0x443352);}return _0x33b100[_0xc884('0x36')]();};}function saveUpdates(_0x32b45f,_0x303097){return function(_0x36dbc6){if(_0x36dbc6){return _0x36dbc6[_0xc884('0x37')](_0x32b45f)[_0xc884('0x1f')](function(_0x77df40){return _0x77df40;});}return null;};}function removeEntity(_0x3b2c17,_0x2fa281){return function(_0x3de789){if(_0x3de789){return _0x3de789[_0xc884('0x38')]()['then'](function(){_0x3b2c17['status'](0xcc)[_0xc884('0x2c')]();});}};}function handleEntityNotFound(_0x3b7e82,_0x3dc962){return function(_0xf7c72b){if(!_0xf7c72b){_0x3b7e82[_0xc884('0x39')](0x194);}return _0xf7c72b;};}function handleError(_0x11dafb,_0x6d4ee1){_0x6d4ee1=_0x6d4ee1||0x1f4;return function(_0xe5944){logger[_0xc884('0x26')](_0xe5944['stack']);if(_0xe5944[_0xc884('0x3a')]){delete _0xe5944['name'];}_0x11dafb[_0xc884('0x2b')](_0x6d4ee1)['send'](_0xe5944);};}exports[_0xc884('0x3b')]=function(_0x3c83b8,_0xc61967){var _0x264e30={},_0x1d9811={},_0x2057c7={'count':0x0,'rows':[]};var _0xd51f8f=_[_0xc884('0x3c')](db[_0xc884('0x3d')][_0xc884('0x3e')],function(_0x3ff692){return{'name':_0x3ff692[_0xc884('0x3f')],'type':_0x3ff692[_0xc884('0x40')][_0xc884('0x41')]};});_0x1d9811['model']=_[_0xc884('0x3c')](_0xd51f8f,'name');_0x1d9811[_0xc884('0x42')]=_[_0xc884('0x43')](_0x3c83b8['query']);_0x1d9811[_0xc884('0x44')]=_[_0xc884('0x45')](_0x1d9811[_0xc884('0x46')],_0x1d9811[_0xc884('0x42')]);_0x264e30['attributes']=_['intersection'](_0x1d9811[_0xc884('0x46')],qs['fields'](_0x3c83b8[_0xc884('0x42')]['fields']));_0x264e30[_0xc884('0x47')]=_0x264e30[_0xc884('0x47')][_0xc884('0x48')]?_0x264e30[_0xc884('0x47')]:_0x1d9811[_0xc884('0x46')];if(!_0x3c83b8['query'][_0xc884('0x49')](_0xc884('0x4a'))){_0x264e30['limit']=qs[_0xc884('0x31')](_0x3c83b8['query'][_0xc884('0x31')]);_0x264e30[_0xc884('0x2e')]=qs['offset'](_0x3c83b8['query'][_0xc884('0x2e')]);}_0x264e30[_0xc884('0x4b')]=qs[_0xc884('0x4c')](_0x3c83b8[_0xc884('0x42')]['sort']);_0x264e30[_0xc884('0x4d')]=qs[_0xc884('0x44')](_[_0xc884('0x4e')](_0x3c83b8[_0xc884('0x42')],_0x1d9811[_0xc884('0x44')]),_0xd51f8f);if(_0x3c83b8[_0xc884('0x42')][_0xc884('0x4f')]){_0x264e30[_0xc884('0x4d')]=_['merge'](_0x264e30[_0xc884('0x4d')],{'$or':_[_0xc884('0x3c')](_0xd51f8f,function(_0x542bd5){if(_0x542bd5[_0xc884('0x40')]!==_0xc884('0x50')){var _0x4dc4ce={};_0x4dc4ce[_0x542bd5[_0xc884('0x3a')]]={'$like':'%'+_0x3c83b8['query'][_0xc884('0x4f')]+'%'};return _0x4dc4ce;}})});}_0x264e30=_['merge']({},_0x264e30,_0x3c83b8[_0xc884('0x51')]);var _0x1c9e77={'where':_0x264e30[_0xc884('0x4d')]};return db['WhatsappMessage'][_0xc884('0x30')](_0x1c9e77)[_0xc884('0x1f')](function(_0x54d8f2){_0x2057c7[_0xc884('0x30')]=_0x54d8f2;if(_0x3c83b8['query'][_0xc884('0x52')]){_0x264e30[_0xc884('0x53')]=[{'all':!![]}];}return db[_0xc884('0x3d')]['findAll'](_0x264e30);})[_0xc884('0x1f')](function(_0x349939){_0x2057c7[_0xc884('0x54')]=_0x349939;return _0x2057c7;})['then'](respondWithFilteredResult(_0xc61967,_0x264e30))[_0xc884('0x2a')](handleError(_0xc61967,null));};exports[_0xc884('0x55')]=function(_0x4b4500,_0x4198db){var _0x598569={'raw':!![],'where':{'id':_0x4b4500[_0xc884('0x56')]['id']}},_0x310c1c={};_0x310c1c['model']=_['keys'](db[_0xc884('0x3d')][_0xc884('0x3e')]);_0x310c1c[_0xc884('0x42')]=_[_0xc884('0x43')](_0x4b4500['query']);_0x310c1c[_0xc884('0x44')]=_['intersection'](_0x310c1c[_0xc884('0x46')],_0x310c1c[_0xc884('0x42')]);_0x598569[_0xc884('0x47')]=_[_0xc884('0x45')](_0x310c1c[_0xc884('0x46')],qs[_0xc884('0x57')](_0x4b4500[_0xc884('0x42')]['fields']));_0x598569[_0xc884('0x47')]=_0x598569['attributes'][_0xc884('0x48')]?_0x598569['attributes']:_0x310c1c[_0xc884('0x46')];if(_0x4b4500['query']['includeAll']){_0x598569[_0xc884('0x53')]=[{'all':!![]}];}_0x598569=_['merge']({},_0x598569,_0x4b4500[_0xc884('0x51')]);return db[_0xc884('0x3d')][_0xc884('0x58')](_0x598569)[_0xc884('0x1f')](handleEntityNotFound(_0x4198db,null))[_0xc884('0x1f')](respondWithResult(_0x4198db,null))[_0xc884('0x2a')](handleError(_0x4198db,null));};exports[_0xc884('0x59')]=function(_0x14c160,_0x4d218f){return db[_0xc884('0x3d')][_0xc884('0x59')](_0x14c160[_0xc884('0x5a')],{})[_0xc884('0x1f')](respondWithResult(_0x4d218f,0xc9))[_0xc884('0x2a')](handleError(_0x4d218f,null));};exports[_0xc884('0x37')]=function(_0x9484b9,_0x2f78ce){if(_0x9484b9['body']['id']){delete _0x9484b9[_0xc884('0x5a')]['id'];}return db[_0xc884('0x3d')][_0xc884('0x58')]({'where':{'id':_0x9484b9[_0xc884('0x56')]['id']}})['then'](handleEntityNotFound(_0x2f78ce,null))[_0xc884('0x1f')](saveUpdates(_0x9484b9[_0xc884('0x5a')],null))[_0xc884('0x1f')](respondWithResult(_0x2f78ce,null))[_0xc884('0x2a')](handleError(_0x2f78ce,null));};exports['destroy']=function(_0x1a310f,_0x508eb0){return db[_0xc884('0x3d')][_0xc884('0x58')]({'where':{'id':_0x1a310f[_0xc884('0x56')]['id']}})['then'](handleEntityNotFound(_0x508eb0,null))['then'](removeEntity(_0x508eb0,null))[_0xc884('0x2a')](handleError(_0x508eb0,null));};exports[_0xc884('0x5b')]=function(_0x536ce8,_0x3971be){return db[_0xc884('0x3d')][_0xc884('0x5b')]()[_0xc884('0x1f')](respondWithResult(_0x3971be,null))[_0xc884('0x2a')](handleError(_0x3971be,null));};var interaction_log=require(_0xc884('0x13'))(_0xc884('0x5c'));exports[_0xc884('0x5d')]=function(_0x5a607a,_0x5a63bb,_0x145a0e){var _0x56dc77={'agent':{},'channel':_0xc884('0x5e')};if(_0x5a607a[_0xc884('0x5a')]['id']){delete _0x5a607a[_0xc884('0x5a')]['id'];}_0x5a607a[_0xc884('0x5a')][_0xc884('0x5f')]=!![];_0x5a607a[_0xc884('0x5a')]['readAt']=moment()[_0xc884('0x60')]('YYYY-MM-DD\x20HH:mm:ss');_0x5a607a[_0xc884('0x5a')][_0xc884('0x61')]=_0x5a607a['body'][_0xc884('0x61')]||_0x5a607a[_0xc884('0x62')]['id'];_0x56dc77[_0xc884('0x63')]['id']=_0x5a607a[_0xc884('0x5a')][_0xc884('0x61')];return db[_0xc884('0x3d')][_0xc884('0x58')]({'where':{'id':_0x5a607a['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5a63bb,null))['then'](saveUpdates(_0x5a607a[_0xc884('0x5a')],null))[_0xc884('0x1f')](function(_0x36400a){if(_0x36400a){_0x56dc77[_0xc884('0x28')]=_0x36400a[_0xc884('0x64')]({'plain':!![]});return db[_0xc884('0x65')][_0xc884('0x58')]({'where':{'id':_0x36400a[_0xc884('0x66')]}});}return null;})[_0xc884('0x1f')](handleEntityNotFound(_0x5a63bb,null))[_0xc884('0x1f')](function(_0x494798){if(_0x494798){return _0x494798[_0xc884('0x37')]({'UserId':_0x5a607a['body']['UserId'],'read1stAt':_[_0xc884('0x67')](_0x494798[_0xc884('0x68')])?moment()[_0xc884('0x60')](_0xc884('0x69')):undefined});}return null;})[_0xc884('0x1f')](function(_0x53c2ca){if(_0x53c2ca){_0x56dc77['interaction']=_0x53c2ca[_0xc884('0x64')]({'plain':!![]});interaction_log[_0xc884('0x20')](_0xc884('0x6a'),_0x5a607a[_0xc884('0x62')]['id'],_0x5a607a['user'][_0xc884('0x3a')],_0x5a607a[_0xc884('0x62')]['role'],_0x56dc77[_0xc884('0x6b')]['id'],_0x5a607a['body']?JSON[_0xc884('0x25')](_0x5a607a[_0xc884('0x5a')]):'null');return respondWithRpcPromise(_0xc884('0x6c'),_0xc884('0x6d'),_0x56dc77);}return null;})[_0xc884('0x1f')](function(_0x12087b){var _0x303422=_0xc884('0x6e')+_0x12087b[_0xc884('0x28')]['ContactId'];return db['sequelize']['query'](_0x303422,{'type':db[_0xc884('0x6f')][_0xc884('0x70')][_0xc884('0x71')],'raw':!![]})[_0xc884('0x1f')](function(_0x551a1f){return _0x551a1f;});})[_0xc884('0x1f')](function(_0x2be784){if(_0x2be784){_0x56dc77[_0xc884('0x28')][_0xc884('0x72')]=_0x2be784[0x0];if(!_0x5a607a[_0xc884('0x5a')][_0xc884('0x61')])return;return db[_0xc884('0x73')][_0xc884('0x58')]({'where':{'id':_0x5a607a[_0xc884('0x5a')]['UserId'],'role':'agent'},'attributes':['id',_0xc884('0x3a'),_0xc884('0x74'),_0xc884('0x75'),'internal'],'raw':!![]});}return null;})['then'](function(_0x3fc00d){if(!_0x3fc00d)return null;_0x56dc77[_0xc884('0x28')][_0xc884('0x63')]=_0x3fc00d;return _0x56dc77;})['then'](function(_0x1f4616){if(_0x1f4616){if(_0x5a607a[_0xc884('0x5a')][_0xc884('0x76')]){_0x56dc77['message'][_0xc884('0x77')]=util[_0xc884('0x60')](_0xc884('0x78'),_0x5a607a[_0xc884('0x62')][_0xc884('0x3a')]);_0x56dc77[_0xc884('0x28')][_0xc884('0x79')]=_0x56dc77[_0xc884('0x79')];_0x56dc77[_0xc884('0x28')][_0xc884('0x7a')]=_0x56dc77[_0xc884('0x79')];_0x56dc77[_0xc884('0x28')][_0xc884('0x7b')]=_0xc884('0x5d');return respondWithRpcPromise(_0xc884('0x7c'),'EventManager',{'event':'acceptmessage','message':_0x56dc77[_0xc884('0x28')]},client9002)[_0xc884('0x1f')](function(){return _0x56dc77;});}return _0x56dc77;}return null;})[_0xc884('0x1f')](respondWithResult(_0x5a63bb,null))[_0xc884('0x2a')](handleError(_0x5a63bb,null));};var interaction_log=require(_0xc884('0x13'))('whatsapp-interactions');exports[_0xc884('0x35')]=function(_0x48e978,_0x5180f8,_0x1043e4){var _0x7a110b={'agent':{},'channel':_0xc884('0x5e')};if(_0x48e978['body']['id']){delete _0x48e978[_0xc884('0x5a')]['id'];}_0x48e978['body'][_0xc884('0x61')]=_0x48e978[_0xc884('0x5a')][_0xc884('0x61')]||_0x48e978['user']['id'];_0x7a110b[_0xc884('0x63')]['id']=_0x48e978['body'][_0xc884('0x61')];return db[_0xc884('0x3d')]['find']({'where':{'id':_0x48e978[_0xc884('0x56')]['id'],'UserId':null}})[_0xc884('0x1f')](handleEntityNotFound(_0x5180f8,null))['then'](function(_0x405a61){if(_0x405a61){_0x7a110b[_0xc884('0x28')]=_0x405a61[_0xc884('0x64')]({'plain':!![]});return db[_0xc884('0x65')][_0xc884('0x58')]({'where':{'id':_0x405a61['WhatsappInteractionId']}});}return null;})[_0xc884('0x1f')](handleEntityNotFound(_0x5180f8,null))[_0xc884('0x1f')](function(_0x4adbcf){if(_0x4adbcf){_0x7a110b['interaction']=_0x4adbcf['get']({'plain':!![]});interaction_log['info']('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x48e978[_0xc884('0x62')]['id'],_0x48e978['user'][_0xc884('0x3a')],_0x48e978['user'][_0xc884('0x7d')],_0x7a110b[_0xc884('0x6b')]['id'],_0x48e978['body']?JSON[_0xc884('0x25')](_0x48e978[_0xc884('0x5a')]):_0xc884('0x7e'));return respondWithRpcPromise(_0xc884('0x7f'),_0xc884('0x80'),_0x7a110b);}return null;})['then'](function(_0x4407c5){var _0x3af5d5='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4407c5['message'][_0xc884('0x81')];return db[_0xc884('0x82')][_0xc884('0x42')](_0x3af5d5,{'type':db[_0xc884('0x6f')][_0xc884('0x70')]['SELECT'],'raw':!![]})[_0xc884('0x1f')](function(_0xa9430a){return _0xa9430a;});})[_0xc884('0x1f')](function(_0x298a4d){if(_0x298a4d){_0x7a110b['message'][_0xc884('0x72')]=_0x298a4d[0x0];if(!_0x48e978[_0xc884('0x5a')][_0xc884('0x61')])return;return db[_0xc884('0x73')][_0xc884('0x58')]({'where':{'id':_0x48e978['body']['UserId'],'role':_0xc884('0x63')},'attributes':['id',_0xc884('0x3a'),_0xc884('0x74'),_0xc884('0x75'),'internal'],'raw':!![]});}return null;})['then'](function(_0x545322){if(!_0x545322)return null;_0x7a110b[_0xc884('0x28')][_0xc884('0x63')]=_0x545322;return _0x7a110b;})[_0xc884('0x1f')](function(_0x2b183f){if(_0x2b183f){_0x2b183f['message']['interface']=util[_0xc884('0x60')](_0xc884('0x78'),_0x48e978[_0xc884('0x62')][_0xc884('0x3a')]);_0x2b183f[_0xc884('0x28')][_0xc884('0x79')]=_0x7a110b[_0xc884('0x79')];_0x2b183f['message'][_0xc884('0x7a')]=_0x7a110b[_0xc884('0x79')];_0x2b183f['message'][_0xc884('0x7b')]=_0xc884('0x35');respondWithRpcPromise(_0xc884('0x7c'),_0xc884('0x7c'),{'event':_0xc884('0x83'),'message':_0x2b183f[_0xc884('0x28')]},client9002);return _0x7a110b;}return null;})[_0xc884('0x1f')](respondWithResult(_0x5180f8,null))[_0xc884('0x2a')](handleError(_0x5180f8,null));};exports[_0xc884('0x2b')]=function(_0x4f594e,_0x49db9d,_0x343cc5){if(_0x4f594e[_0xc884('0x5a')]['id']){delete _0x4f594e[_0xc884('0x5a')]['id'];}var _0x5bd141;return db[_0xc884('0x3d')]['find']({'where':{'id':_0x4f594e[_0xc884('0x56')]['id']}})['then'](handleEntityNotFound(_0x49db9d,null))[_0xc884('0x1f')](function(_0x6c2d87){if(_0x6c2d87){_0x5bd141=_0x6c2d87;return db[_0xc884('0x84')][_0xc884('0x58')]({'where':{'id':_0x6c2d87[_0xc884('0x85')]}});}})['then'](handleEntityNotFound(_0x49db9d,null))['then'](function(_0x2c5316){if(_0x2c5316){logger['debug'](_0xc884('0x86'),'status',_0xc884('0x87'),_0x2c5316[_0xc884('0x40')],util[_0xc884('0x88')](_0x4f594e['body'],{'showHidden':![],'depth':null}));switch(_0x2c5316[_0xc884('0x40')]){case _0xc884('0x89'):if(_0x4f594e[_0xc884('0x5a')][_0xc884('0x8a')]&&_0x4f594e[_0xc884('0x5a')][_0xc884('0x8a')]===_0x5bd141['messageId']&&_0x4f594e[_0xc884('0x5a')][_0xc884('0x8b')]&&_0x4f594e[_0xc884('0x5a')][_0xc884('0x8b')]===_0xc884('0x5f')){return _0x5bd141['update']({'read':!![]});}else{logger[_0xc884('0x26')]('WhatsappAccount,\x20%s,\x20%s,\x20%s','status',_0xc884('0x89'),util[_0xc884('0x88')](_0x4f594e['body'],{'showHidden':![],'depth':null}));}break;}return _0x5bd141;}})[_0xc884('0x1f')](respondWithResult(_0x49db9d,null))['catch'](handleError(_0x49db9d,null));}; \ No newline at end of file +var _0x9b0b=['fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','accept','EventManager','acceptmessage','null','RejectMessage','sequelize','Sequelize','QueryTypes','event','rejectmessage','WhatsappAccount','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','messageId','MessageStatus','read','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappMessage.socket','jayson/promise','client','http','request','then','info','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','limit','undefined','count','offset','json','apply','reject','update','destroy','stack','name','send','rawAttributes','fieldName','type','map','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','sort','where','filter','merge','VIRTUAL','includeAll','include','WhatsappMessage','rows','show','params','keys','find','create','body','describe','whatsapp-interactions','whatsapp','readAt','format','YYYY-MM-DD\x20HH:mm:ss','user','get','WhatsappInteraction','WhatsappInteractionId','UserId','isNil','read1stAt','interaction','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','SELECT','contact','User','agent'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x9b0b,0x1b0));var _0xb9b0=function(_0x42020e,_0x4b92fb){_0x42020e=_0x42020e-0x0;var _0x561551=_0x9b0b[_0x42020e];return _0x561551;};'use strict';var emlformat=require(_0xb9b0('0x0'));var rimraf=require(_0xb9b0('0x1'));var zipdir=require(_0xb9b0('0x2'));var jsonpatch=require(_0xb9b0('0x3'));var rp=require('request-promise');var moment=require(_0xb9b0('0x4'));var BPromise=require(_0xb9b0('0x5'));var Mustache=require(_0xb9b0('0x6'));var util=require('util');var path=require(_0xb9b0('0x7'));var sox=require(_0xb9b0('0x8'));var csv=require(_0xb9b0('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb9b0('0xa'));var _=require(_0xb9b0('0xb'));var squel=require(_0xb9b0('0xc'));var crypto=require(_0xb9b0('0xd'));var jsforce=require(_0xb9b0('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb9b0('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb9b0('0xf'));var authService=require(_0xb9b0('0x10'));var qs=require(_0xb9b0('0x11'));var as=require(_0xb9b0('0x12'));var hardwareService=require(_0xb9b0('0x13'));var logger=require(_0xb9b0('0x14'))(_0xb9b0('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb9b0('0x16'));var db=require(_0xb9b0('0x17'))['db'];config[_0xb9b0('0x18')]=_[_0xb9b0('0x19')](config[_0xb9b0('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xb9b0('0x1a'))(new Redis(config[_0xb9b0('0x18')]));require(_0xb9b0('0x1b'))['register'](socket);var jayson=require(_0xb9b0('0x1c'));var client=jayson[_0xb9b0('0x1d')][_0xb9b0('0x1e')]({'port':0x232c});var client9002=jayson[_0xb9b0('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2b3f31,_0x9b53ad,_0x41d8d1,_0x20e382){return new BPromise(function(_0x2a1834,_0x34a955){var _0x261d77=_0x20e382||client;return _0x261d77[_0xb9b0('0x1f')](_0x2b3f31,_0x41d8d1)[_0xb9b0('0x20')](function(_0x517de2){logger[_0xb9b0('0x21')]('WhatsappMessage,\x20%s,\x20%s',_0x9b53ad,_0xb9b0('0x22'));logger[_0xb9b0('0x23')](_0xb9b0('0x24'),_0x9b53ad,'request\x20sent',JSON[_0xb9b0('0x25')](_0x517de2));if(_0x517de2[_0xb9b0('0x26')]){if(_0x517de2[_0xb9b0('0x26')]['code']===0x1f4){logger[_0xb9b0('0x26')](_0xb9b0('0x27'),_0x9b53ad,_0x517de2[_0xb9b0('0x26')][_0xb9b0('0x28')]);return _0x34a955(_0x517de2[_0xb9b0('0x26')][_0xb9b0('0x28')]);}logger['error'](_0xb9b0('0x27'),_0x9b53ad,_0x517de2['error'][_0xb9b0('0x28')]);return _0x2a1834(_0x517de2[_0xb9b0('0x26')]['message']);}else{logger[_0xb9b0('0x21')](_0xb9b0('0x27'),_0x9b53ad,_0xb9b0('0x22'));_0x2a1834(_0x517de2[_0xb9b0('0x29')][_0xb9b0('0x28')]);}})[_0xb9b0('0x2a')](function(_0x51337d){logger['error'](_0xb9b0('0x27'),_0x9b53ad,_0x51337d);_0x34a955(_0x51337d);});});}function respondWithStatusCode(_0x1b9dc6,_0x1d7097){_0x1d7097=_0x1d7097||0xcc;return function(_0x388a4b){if(_0x388a4b){return _0x1b9dc6[_0xb9b0('0x2b')](_0x1d7097);}return _0x1b9dc6[_0xb9b0('0x2c')](_0x1d7097)[_0xb9b0('0x2d')]();};}function respondWithResult(_0x547807,_0x31d258){_0x31d258=_0x31d258||0xc8;return function(_0x1e9a85){if(_0x1e9a85){return _0x547807[_0xb9b0('0x2c')](_0x31d258)['json'](_0x1e9a85);}};}function respondWithFilteredResult(_0x1e421e,_0x19d216){return function(_0x18d87e){if(_0x18d87e){var _0xa1644=typeof _0x19d216['offset']==='undefined'&&typeof _0x19d216[_0xb9b0('0x2e')]===_0xb9b0('0x2f');var _0x39728c=_0x18d87e['count'];var _0x390ff5=_0xa1644?0x0:_0x19d216['offset'];var _0xce3d87=_0xa1644?_0x18d87e[_0xb9b0('0x30')]:_0x19d216[_0xb9b0('0x31')]+_0x19d216['limit'];var _0x3882c4;if(_0xce3d87>=_0x39728c){_0xce3d87=_0x39728c;_0x3882c4=0xc8;}else{_0x3882c4=0xce;}_0x1e421e['status'](_0x3882c4);return _0x1e421e['set']('Content-Range',_0x390ff5+'-'+_0xce3d87+'/'+_0x39728c)[_0xb9b0('0x32')](_0x18d87e);}return null;};}function patchUpdates(_0x2817af){return function(_0x4647b9){try{jsonpatch[_0xb9b0('0x33')](_0x4647b9,_0x2817af,!![]);}catch(_0x2eb138){return BPromise[_0xb9b0('0x34')](_0x2eb138);}return _0x4647b9['save']();};}function saveUpdates(_0x41fd5a,_0x511f33){return function(_0x5c32a3){if(_0x5c32a3){return _0x5c32a3[_0xb9b0('0x35')](_0x41fd5a)[_0xb9b0('0x20')](function(_0x5785d0){return _0x5785d0;});}return null;};}function removeEntity(_0x7ed98c,_0x1dec84){return function(_0x223db1){if(_0x223db1){return _0x223db1[_0xb9b0('0x36')]()[_0xb9b0('0x20')](function(){_0x7ed98c['status'](0xcc)[_0xb9b0('0x2d')]();});}};}function handleEntityNotFound(_0x525d83,_0x593b79){return function(_0x777b04){if(!_0x777b04){_0x525d83[_0xb9b0('0x2b')](0x194);}return _0x777b04;};}function handleError(_0x953c92,_0x350556){_0x350556=_0x350556||0x1f4;return function(_0x5d5125){logger[_0xb9b0('0x26')](_0x5d5125[_0xb9b0('0x37')]);if(_0x5d5125[_0xb9b0('0x38')]){delete _0x5d5125['name'];}_0x953c92['status'](_0x350556)[_0xb9b0('0x39')](_0x5d5125);};}exports['index']=function(_0x25a8b1,_0x5d43aa){var _0x443339={},_0x496469={},_0x37e067={'count':0x0,'rows':[]};var _0x15cab0=_['map'](db['WhatsappMessage'][_0xb9b0('0x3a')],function(_0x4e71ee){return{'name':_0x4e71ee[_0xb9b0('0x3b')],'type':_0x4e71ee[_0xb9b0('0x3c')]['key']};});_0x496469['model']=_[_0xb9b0('0x3d')](_0x15cab0,'name');_0x496469[_0xb9b0('0x3e')]=_['keys'](_0x25a8b1[_0xb9b0('0x3e')]);_0x496469[_0xb9b0('0x3f')]=_[_0xb9b0('0x40')](_0x496469[_0xb9b0('0x41')],_0x496469['query']);_0x443339['attributes']=_[_0xb9b0('0x40')](_0x496469['model'],qs[_0xb9b0('0x42')](_0x25a8b1[_0xb9b0('0x3e')][_0xb9b0('0x42')]));_0x443339[_0xb9b0('0x43')]=_0x443339[_0xb9b0('0x43')][_0xb9b0('0x44')]?_0x443339[_0xb9b0('0x43')]:_0x496469[_0xb9b0('0x41')];if(!_0x25a8b1[_0xb9b0('0x3e')][_0xb9b0('0x45')]('nolimit')){_0x443339[_0xb9b0('0x2e')]=qs[_0xb9b0('0x2e')](_0x25a8b1[_0xb9b0('0x3e')][_0xb9b0('0x2e')]);_0x443339[_0xb9b0('0x31')]=qs[_0xb9b0('0x31')](_0x25a8b1[_0xb9b0('0x3e')][_0xb9b0('0x31')]);}_0x443339['order']=qs[_0xb9b0('0x46')](_0x25a8b1[_0xb9b0('0x3e')]['sort']);_0x443339[_0xb9b0('0x47')]=qs[_0xb9b0('0x3f')](_['pick'](_0x25a8b1['query'],_0x496469['filters']),_0x15cab0);if(_0x25a8b1[_0xb9b0('0x3e')][_0xb9b0('0x48')]){_0x443339[_0xb9b0('0x47')]=_[_0xb9b0('0x49')](_0x443339['where'],{'$or':_[_0xb9b0('0x3d')](_0x15cab0,function(_0x160272){if(_0x160272['type']!==_0xb9b0('0x4a')){var _0x139930={};_0x139930[_0x160272[_0xb9b0('0x38')]]={'$like':'%'+_0x25a8b1[_0xb9b0('0x3e')]['filter']+'%'};return _0x139930;}})});}_0x443339=_['merge']({},_0x443339,_0x25a8b1['options']);var _0x2fafa9={'where':_0x443339[_0xb9b0('0x47')]};return db['WhatsappMessage'][_0xb9b0('0x30')](_0x2fafa9)[_0xb9b0('0x20')](function(_0x39d1b6){_0x37e067[_0xb9b0('0x30')]=_0x39d1b6;if(_0x25a8b1[_0xb9b0('0x3e')][_0xb9b0('0x4b')]){_0x443339[_0xb9b0('0x4c')]=[{'all':!![]}];}return db[_0xb9b0('0x4d')]['findAll'](_0x443339);})[_0xb9b0('0x20')](function(_0x5e3b91){_0x37e067[_0xb9b0('0x4e')]=_0x5e3b91;return _0x37e067;})[_0xb9b0('0x20')](respondWithFilteredResult(_0x5d43aa,_0x443339))['catch'](handleError(_0x5d43aa,null));};exports[_0xb9b0('0x4f')]=function(_0x11cf92,_0x5bc969){var _0x1f0a92={'raw':!![],'where':{'id':_0x11cf92[_0xb9b0('0x50')]['id']}},_0x34fffc={};_0x34fffc[_0xb9b0('0x41')]=_[_0xb9b0('0x51')](db[_0xb9b0('0x4d')][_0xb9b0('0x3a')]);_0x34fffc[_0xb9b0('0x3e')]=_['keys'](_0x11cf92[_0xb9b0('0x3e')]);_0x34fffc[_0xb9b0('0x3f')]=_[_0xb9b0('0x40')](_0x34fffc[_0xb9b0('0x41')],_0x34fffc[_0xb9b0('0x3e')]);_0x1f0a92['attributes']=_[_0xb9b0('0x40')](_0x34fffc[_0xb9b0('0x41')],qs['fields'](_0x11cf92[_0xb9b0('0x3e')]['fields']));_0x1f0a92['attributes']=_0x1f0a92[_0xb9b0('0x43')][_0xb9b0('0x44')]?_0x1f0a92['attributes']:_0x34fffc[_0xb9b0('0x41')];if(_0x11cf92[_0xb9b0('0x3e')]['includeAll']){_0x1f0a92[_0xb9b0('0x4c')]=[{'all':!![]}];}_0x1f0a92=_['merge']({},_0x1f0a92,_0x11cf92['options']);return db[_0xb9b0('0x4d')][_0xb9b0('0x52')](_0x1f0a92)[_0xb9b0('0x20')](handleEntityNotFound(_0x5bc969,null))[_0xb9b0('0x20')](respondWithResult(_0x5bc969,null))['catch'](handleError(_0x5bc969,null));};exports[_0xb9b0('0x53')]=function(_0x3dcde2,_0x5efbc6){return db['WhatsappMessage'][_0xb9b0('0x53')](_0x3dcde2[_0xb9b0('0x54')],{})[_0xb9b0('0x20')](respondWithResult(_0x5efbc6,0xc9))['catch'](handleError(_0x5efbc6,null));};exports[_0xb9b0('0x35')]=function(_0x15b2ae,_0x4d8fbf){if(_0x15b2ae[_0xb9b0('0x54')]['id']){delete _0x15b2ae[_0xb9b0('0x54')]['id'];}return db[_0xb9b0('0x4d')]['find']({'where':{'id':_0x15b2ae[_0xb9b0('0x50')]['id']}})[_0xb9b0('0x20')](handleEntityNotFound(_0x4d8fbf,null))['then'](saveUpdates(_0x15b2ae[_0xb9b0('0x54')],null))['then'](respondWithResult(_0x4d8fbf,null))[_0xb9b0('0x2a')](handleError(_0x4d8fbf,null));};exports[_0xb9b0('0x36')]=function(_0x3b5efa,_0x351b37){return db[_0xb9b0('0x4d')][_0xb9b0('0x52')]({'where':{'id':_0x3b5efa[_0xb9b0('0x50')]['id']}})[_0xb9b0('0x20')](handleEntityNotFound(_0x351b37,null))[_0xb9b0('0x20')](removeEntity(_0x351b37,null))[_0xb9b0('0x2a')](handleError(_0x351b37,null));};exports[_0xb9b0('0x55')]=function(_0x5cc4ba,_0x1f2700){return db[_0xb9b0('0x4d')][_0xb9b0('0x55')]()[_0xb9b0('0x20')](respondWithResult(_0x1f2700,null))['catch'](handleError(_0x1f2700,null));};var interaction_log=require('../../config/logger')(_0xb9b0('0x56'));exports['accept']=function(_0x7b9efd,_0x56ac7b,_0x35f7b4){var _0x3fd255={'agent':{},'channel':_0xb9b0('0x57')};if(_0x7b9efd[_0xb9b0('0x54')]['id']){delete _0x7b9efd[_0xb9b0('0x54')]['id'];}_0x7b9efd[_0xb9b0('0x54')]['read']=!![];_0x7b9efd[_0xb9b0('0x54')][_0xb9b0('0x58')]=moment()[_0xb9b0('0x59')](_0xb9b0('0x5a'));_0x7b9efd[_0xb9b0('0x54')]['UserId']=_0x7b9efd['body']['UserId']||_0x7b9efd[_0xb9b0('0x5b')]['id'];_0x3fd255['agent']['id']=_0x7b9efd[_0xb9b0('0x54')]['UserId'];return db[_0xb9b0('0x4d')][_0xb9b0('0x52')]({'where':{'id':_0x7b9efd[_0xb9b0('0x50')]['id'],'UserId':null}})[_0xb9b0('0x20')](handleEntityNotFound(_0x56ac7b,null))[_0xb9b0('0x20')](saveUpdates(_0x7b9efd[_0xb9b0('0x54')],null))['then'](function(_0x2ed49d){if(_0x2ed49d){_0x3fd255[_0xb9b0('0x28')]=_0x2ed49d[_0xb9b0('0x5c')]({'plain':!![]});return db[_0xb9b0('0x5d')]['find']({'where':{'id':_0x2ed49d[_0xb9b0('0x5e')]}});}return null;})['then'](handleEntityNotFound(_0x56ac7b,null))[_0xb9b0('0x20')](function(_0x2ad3d2){if(_0x2ad3d2){return _0x2ad3d2['update']({'UserId':_0x7b9efd[_0xb9b0('0x54')][_0xb9b0('0x5f')],'read1stAt':_[_0xb9b0('0x60')](_0x2ad3d2[_0xb9b0('0x61')])?moment()[_0xb9b0('0x59')](_0xb9b0('0x5a')):undefined});}return null;})[_0xb9b0('0x20')](function(_0x19afcf){if(_0x19afcf){_0x3fd255[_0xb9b0('0x62')]=_0x19afcf[_0xb9b0('0x5c')]({'plain':!![]});interaction_log[_0xb9b0('0x21')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x7b9efd[_0xb9b0('0x5b')]['id'],_0x7b9efd[_0xb9b0('0x5b')][_0xb9b0('0x38')],_0x7b9efd[_0xb9b0('0x5b')][_0xb9b0('0x63')],_0x3fd255['interaction']['id'],_0x7b9efd[_0xb9b0('0x54')]?JSON[_0xb9b0('0x25')](_0x7b9efd['body']):'null');return respondWithRpcPromise(_0xb9b0('0x64'),_0xb9b0('0x65'),_0x3fd255);}return null;})['then'](function(_0x5283b7){var _0x225fd3=_0xb9b0('0x66')+_0x5283b7['message'][_0xb9b0('0x67')];return db['sequelize'][_0xb9b0('0x3e')](_0x225fd3,{'type':db['Sequelize']['QueryTypes'][_0xb9b0('0x68')],'raw':!![]})[_0xb9b0('0x20')](function(_0x3dcd44){return _0x3dcd44;});})['then'](function(_0x5db619){if(_0x5db619){_0x3fd255[_0xb9b0('0x28')][_0xb9b0('0x69')]=_0x5db619[0x0];if(!_0x7b9efd[_0xb9b0('0x54')]['UserId'])return;return db[_0xb9b0('0x6a')]['find']({'where':{'id':_0x7b9efd[_0xb9b0('0x54')][_0xb9b0('0x5f')],'role':_0xb9b0('0x6b')},'attributes':['id',_0xb9b0('0x38'),_0xb9b0('0x6c'),_0xb9b0('0x6d'),_0xb9b0('0x6e')],'raw':!![]});}return null;})[_0xb9b0('0x20')](function(_0x6e7b00){if(!_0x6e7b00)return null;_0x3fd255[_0xb9b0('0x28')]['agent']=_0x6e7b00;return _0x3fd255;})[_0xb9b0('0x20')](function(_0x263071){if(_0x263071){if(_0x7b9efd['body'][_0xb9b0('0x6f')]){_0x3fd255['message'][_0xb9b0('0x70')]=util[_0xb9b0('0x59')](_0xb9b0('0x71'),_0x7b9efd['user'][_0xb9b0('0x38')]);_0x3fd255[_0xb9b0('0x28')][_0xb9b0('0x72')]=_0x3fd255[_0xb9b0('0x72')];_0x3fd255['message'][_0xb9b0('0x73')]=_0x3fd255[_0xb9b0('0x72')];_0x3fd255['message']['event']=_0xb9b0('0x74');return respondWithRpcPromise(_0xb9b0('0x75'),_0xb9b0('0x75'),{'event':_0xb9b0('0x76'),'message':_0x3fd255[_0xb9b0('0x28')]},client9002)[_0xb9b0('0x20')](function(){return _0x3fd255;});}return _0x3fd255;}return null;})[_0xb9b0('0x20')](respondWithResult(_0x56ac7b,null))[_0xb9b0('0x2a')](handleError(_0x56ac7b,null));};var interaction_log=require(_0xb9b0('0x14'))(_0xb9b0('0x56'));exports[_0xb9b0('0x34')]=function(_0x53e2e1,_0x1c2c97,_0x5470dc){var _0x577781={'agent':{},'channel':_0xb9b0('0x57')};if(_0x53e2e1[_0xb9b0('0x54')]['id']){delete _0x53e2e1[_0xb9b0('0x54')]['id'];}_0x53e2e1['body'][_0xb9b0('0x5f')]=_0x53e2e1[_0xb9b0('0x54')][_0xb9b0('0x5f')]||_0x53e2e1[_0xb9b0('0x5b')]['id'];_0x577781[_0xb9b0('0x6b')]['id']=_0x53e2e1['body']['UserId'];return db['WhatsappMessage'][_0xb9b0('0x52')]({'where':{'id':_0x53e2e1[_0xb9b0('0x50')]['id'],'UserId':null}})[_0xb9b0('0x20')](handleEntityNotFound(_0x1c2c97,null))[_0xb9b0('0x20')](function(_0x3dec85){if(_0x3dec85){_0x577781[_0xb9b0('0x28')]=_0x3dec85['get']({'plain':!![]});return db['WhatsappInteraction']['find']({'where':{'id':_0x3dec85[_0xb9b0('0x5e')]}});}return null;})[_0xb9b0('0x20')](handleEntityNotFound(_0x1c2c97,null))['then'](function(_0x38c7e1){if(_0x38c7e1){_0x577781[_0xb9b0('0x62')]=_0x38c7e1[_0xb9b0('0x5c')]({'plain':!![]});interaction_log['info']('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x53e2e1['user']['id'],_0x53e2e1[_0xb9b0('0x5b')][_0xb9b0('0x38')],_0x53e2e1[_0xb9b0('0x5b')][_0xb9b0('0x63')],_0x577781[_0xb9b0('0x62')]['id'],_0x53e2e1['body']?JSON['stringify'](_0x53e2e1['body']):_0xb9b0('0x77'));return respondWithRpcPromise(_0xb9b0('0x78'),'rejectMessage',_0x577781);}return null;})[_0xb9b0('0x20')](function(_0x3ba57f){var _0x5d65ad=_0xb9b0('0x66')+_0x3ba57f[_0xb9b0('0x28')]['ContactId'];return db[_0xb9b0('0x79')]['query'](_0x5d65ad,{'type':db[_0xb9b0('0x7a')][_0xb9b0('0x7b')][_0xb9b0('0x68')],'raw':!![]})['then'](function(_0x179b36){return _0x179b36;});})['then'](function(_0x3a34fc){if(_0x3a34fc){_0x577781['message'][_0xb9b0('0x69')]=_0x3a34fc[0x0];if(!_0x53e2e1['body'][_0xb9b0('0x5f')])return;return db[_0xb9b0('0x6a')][_0xb9b0('0x52')]({'where':{'id':_0x53e2e1[_0xb9b0('0x54')][_0xb9b0('0x5f')],'role':_0xb9b0('0x6b')},'attributes':['id','name',_0xb9b0('0x6c'),_0xb9b0('0x6d'),_0xb9b0('0x6e')],'raw':!![]});}return null;})['then'](function(_0x2e4e68){if(!_0x2e4e68)return null;_0x577781[_0xb9b0('0x28')]['agent']=_0x2e4e68;return _0x577781;})[_0xb9b0('0x20')](function(_0x4c67de){if(_0x4c67de){_0x4c67de[_0xb9b0('0x28')]['interface']=util[_0xb9b0('0x59')](_0xb9b0('0x71'),_0x53e2e1[_0xb9b0('0x5b')]['name']);_0x4c67de[_0xb9b0('0x28')][_0xb9b0('0x72')]=_0x577781[_0xb9b0('0x72')];_0x4c67de['message'][_0xb9b0('0x73')]=_0x577781[_0xb9b0('0x72')];_0x4c67de[_0xb9b0('0x28')][_0xb9b0('0x7c')]=_0xb9b0('0x34');respondWithRpcPromise(_0xb9b0('0x75'),_0xb9b0('0x75'),{'event':_0xb9b0('0x7d'),'message':_0x4c67de[_0xb9b0('0x28')]},client9002);return _0x577781;}return null;})[_0xb9b0('0x20')](respondWithResult(_0x1c2c97,null))[_0xb9b0('0x2a')](handleError(_0x1c2c97,null));};exports['status']=function(_0x509b60,_0x16bbd1,_0x190ab8){if(_0x509b60[_0xb9b0('0x54')]['id']){delete _0x509b60[_0xb9b0('0x54')]['id'];}var _0x4543b8;return db[_0xb9b0('0x4d')][_0xb9b0('0x52')]({'where':{'id':_0x509b60[_0xb9b0('0x50')]['id']}})[_0xb9b0('0x20')](handleEntityNotFound(_0x16bbd1,null))[_0xb9b0('0x20')](function(_0x4ad978){if(_0x4ad978){_0x4543b8=_0x4ad978;return db[_0xb9b0('0x7e')][_0xb9b0('0x52')]({'where':{'id':_0x4ad978['WhatsappAccountId']}});}})[_0xb9b0('0x20')](handleEntityNotFound(_0x16bbd1,null))[_0xb9b0('0x20')](function(_0x4cae69){if(_0x4cae69){logger[_0xb9b0('0x23')](_0xb9b0('0x7f'),'status',_0xb9b0('0x80'),_0x4cae69[_0xb9b0('0x3c')],util[_0xb9b0('0x81')](_0x509b60[_0xb9b0('0x54')],{'showHidden':![],'depth':null}));switch(_0x4cae69[_0xb9b0('0x3c')]){case _0xb9b0('0x82'):if(_0x509b60[_0xb9b0('0x54')]['MessageSid']&&_0x509b60['body']['MessageSid']===_0x4543b8[_0xb9b0('0x83')]&&_0x509b60[_0xb9b0('0x54')]['MessageStatus']&&_0x509b60[_0xb9b0('0x54')][_0xb9b0('0x84')]===_0xb9b0('0x85')){return _0x4543b8[_0xb9b0('0x35')]({'read':!![]});}else{logger[_0xb9b0('0x26')](_0xb9b0('0x86'),_0xb9b0('0x2c'),_0xb9b0('0x82'),util['inspect'](_0x509b60[_0xb9b0('0x54')],{'showHidden':![],'depth':null}));}break;}return _0x4543b8;}})[_0xb9b0('0x20')](respondWithResult(_0x16bbd1,null))[_0xb9b0('0x2a')](handleError(_0x16bbd1,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index e110f64..6d5d665 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 _0x0c5d=['remove','emit','hook','events','../../mysqldb','setMaxListeners','update'];(function(_0xdc6b54,_0x5d78fd){var _0x449e79=function(_0x7f08a0){while(--_0x7f08a0){_0xdc6b54['push'](_0xdc6b54['shift']());}};_0x449e79(++_0x5d78fd);}(_0x0c5d,0x6c));var _0xd0c5=function(_0x12c119,_0x3306a3){_0x12c119=_0x12c119-0x0;var _0x41595a=_0x0c5d[_0x12c119];return _0x41595a;};'use strict';var EventEmitter=require(_0xd0c5('0x0'));var WhatsappMessage=require(_0xd0c5('0x1'))['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xd0c5('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd0c5('0x3'),'afterDestroy':_0xd0c5('0x4')};function emitEvent(_0x83f28){return function(_0x177811,_0x4664bc,_0xc3a9b9){WhatsappMessageEvents[_0xd0c5('0x5')](_0x83f28+':'+_0x177811['id'],_0x177811);WhatsappMessageEvents[_0xd0c5('0x5')](_0x83f28,_0x177811);_0xc3a9b9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappMessage[_0xd0c5('0x6')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file +var _0x80ed=['remove','emit','hasOwnProperty','exports','events','WhatsappMessage','setMaxListeners','save'];(function(_0x25662e,_0x4cec68){var _0x59b7bc=function(_0xafb159){while(--_0xafb159){_0x25662e['push'](_0x25662e['shift']());}};_0x59b7bc(++_0x4cec68);}(_0x80ed,0x11c));var _0xd80e=function(_0xc58be2,_0x24a757){_0xc58be2=_0xc58be2-0x0;var _0x1e45c6=_0x80ed[_0xc58be2];return _0x1e45c6;};'use strict';var EventEmitter=require(_0xd80e('0x0'));var WhatsappMessage=require('../../mysqldb')['db'][_0xd80e('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xd80e('0x2')](0x0);var events={'afterCreate':_0xd80e('0x3'),'afterUpdate':'update','afterDestroy':_0xd80e('0x4')};function emitEvent(_0x46876f){return function(_0x2b742b,_0x3413d4,_0x5ae6c6){WhatsappMessageEvents[_0xd80e('0x5')](_0x46876f+':'+_0x2b742b['id'],_0x2b742b);WhatsappMessageEvents[_0xd80e('0x5')](_0x46876f,_0x2b742b);_0x5ae6c6(null);};}for(var e in events){if(events[_0xd80e('0x6')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0xd80e('0x7')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index f692a86..43d87fa 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 _0x19b9=['remote','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','sinch','baseUrl','/whatsapp/v1/','/messages/','text','application/json','statuses','message_id','err','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','node-fetch','path','rimraf','../../config/environment','whatsapp_messages','fti_whatsapp_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','UserId','WhatsappInteraction','WhatsappInteractionId','then','update','createdAt','catch','error','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','authToken','phone','messages','create','whatsapp:'];(function(_0x5cf52f,_0x2304cc){var _0x5b4b76=function(_0x3c408b){while(--_0x3c408b){_0x5cf52f['push'](_0x5cf52f['shift']());}};_0x5b4b76(++_0x2304cc);}(_0x19b9,0x169));var _0x919b=function(_0x83f0a,_0x2b33d7){_0x83f0a=_0x83f0a-0x0;var _0x22b0a9=_0x19b9[_0x83f0a];return _0x22b0a9;};'use strict';var _=require(_0x919b('0x0'));var util=require(_0x919b('0x1'));var logger=require(_0x919b('0x2'))(_0x919b('0x3'));var moment=require(_0x919b('0x4'));var BPromise=require('bluebird');var rp=require(_0x919b('0x5'));var fetch=require(_0x919b('0x6'));var fs=require('fs');var path=require(_0x919b('0x7'));var rimraf=require(_0x919b('0x8'));var config=require(_0x919b('0x9'));var attributes=require('./whatsappMessage.attributes');module['exports']=function(_0x4c1e92,_0x4ff831){return _0x4c1e92['define']('WhatsappMessage',attributes,{'tableName':_0x919b('0xa'),'paranoid':![],'indexes':[{'name':'messageId','fields':['messageId']},{'name':_0x919b('0xb'),'fields':[_0x919b('0xc')],'type':_0x919b('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4765fd,_0x2ae705,_0x41383e){var _0x2f97cb=_0x4c1e92[_0x919b('0xe')];var _0x5f1392=_0x4765fd['get']({'plain':!![]});if(_0x5f1392[_0x919b('0xf')][_0x919b('0x10')]()==='in'||_0x5f1392[_0x919b('0xf')][_0x919b('0x10')]()===_0x919b('0x11')&&!_0x5f1392[_0x919b('0x12')]&&!_['isNil'](_0x5f1392[_0x919b('0x13')])){_0x2f97cb[_0x919b('0x14')]['findOne']({'where':{'id':_0x5f1392[_0x919b('0x15')]}})[_0x919b('0x16')](function(_0x4a2a69){if(_0x4a2a69){_0x4a2a69[_0x919b('0x17')]({'lastMsgAt':_0x5f1392[_0x919b('0x18')],'lastMsgDirection':_0x5f1392[_0x919b('0xf')][_0x919b('0x10')]()});}})[_0x919b('0x19')](function(_0x1bf3c1){console[_0x919b('0x1a')](_0x1bf3c1);});}if(_0x5f1392[_0x919b('0xf')]==='out'&&!_0x5f1392[_0x919b('0x12')]){var _0x2623b9;_0x2f97cb[_0x919b('0x1b')][_0x919b('0x1c')]({'where':{'id':_0x5f1392[_0x919b('0x1d')]},'raw':!![]})[_0x919b('0x16')](function(_0x30c34e){_0x2623b9=_0x30c34e;if(_0x2623b9&&_0x2623b9['type']){switch(_0x2623b9[_0x919b('0x1e')]){case _0x919b('0x1f'):var _0x59a9fd=require(_0x919b('0x1f'));if(_0x2623b9[_0x919b('0x20')]&&_0x2623b9[_0x919b('0x21')]&&_0x2623b9[_0x919b('0x22')]){var _0x7506fa=new _0x59a9fd(_0x2623b9['accountSid'],_0x2623b9[_0x919b('0x21')]);_0x7506fa[_0x919b('0x23')][_0x919b('0x24')]({'body':_0x5f1392[_0x919b('0xc')],'to':_0x919b('0x25')+_0x5f1392[_0x919b('0x22')],'from':_0x919b('0x25')+_0x2623b9[_0x919b('0x22')],'statusCallback':_0x2623b9[_0x919b('0x26')]+'/api/whatsapp/messages/'+_0x5f1392['id']+_0x919b('0x27')+_0x2623b9[_0x919b('0x28')]})['then'](function(_0x2b29ff){if(_0x2b29ff['sid']){return _0x4765fd[_0x919b('0x17')]({'messageId':_0x2b29ff[_0x919b('0x29')]});}})['catch'](function(_0x3afd18){logger[_0x919b('0x1a')](_0x919b('0x2a'),_0x919b('0x2b'),_0x919b('0x1f'),util[_0x919b('0x2c')](_0x3afd18,{'showHidden':![],'depth':null}));});}else{logger[_0x919b('0x1a')](_0x919b('0x2a'),_0x919b('0x2b'),_0x919b('0x1f'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x919b('0x2d'):var _0x103dfb=_0x2623b9['accountSid'];var _0xdaf96f=_0x2623b9['authToken'];var _0x44b31d=_0x2623b9[_0x919b('0x2e')]+_0x919b('0x2f')+_0x103dfb+_0x919b('0x30');var _0x4f1a3b={'to':[_0x5f1392[_0x919b('0x22')]],'message':{'type':_0x919b('0x31'),'text':_0x5f1392[_0x919b('0xc')]}};var _0x9a862d={'method':'POST','uri':_0x44b31d,'headers':{'Authorization':'Bearer\x20'+_0xdaf96f,'Content-Type':_0x919b('0x32')},'body':_0x4f1a3b,'json':!![]};rp(_0x9a862d)[_0x919b('0x16')](function(_0x5a7c87){if(_0x5a7c87[_0x919b('0x33')][0x0][_0x919b('0x34')]){return _0x4765fd[_0x919b('0x17')]({'messageId':_0x5a7c87[_0x919b('0x33')][0x0]['message_id']});}})[_0x919b('0x19')](function(_0x1a622d){logger[_0x919b('0x35')]('WhatsappMessage,\x20%s',_0x1a622d);});break;}}})[_0x919b('0x36')](function(){_0x41383e();});}else{_0x41383e();}}},'charset':_0x919b('0x37'),'collate':_0x919b('0x38')});}; \ No newline at end of file +var _0xeed4=['remote','/status?token=','token','then','sid','afterCreate','WhatsappMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','baseUrl','/whatsapp/v1/','/messages/','Bearer\x20','statuses','catch','err','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','node-fetch','path','rimraf','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','messageId','body','FULLTEXT','get','direction','toLowerCase','secret','UserId','WhatsappInteractionId','update','createdAt','error','out','find','WhatsappAccountId','type','twilio','accountSid','authToken','phone','messages','create','whatsapp:'];(function(_0x1dc687,_0x26106f){var _0x4c757f=function(_0x4fa24f){while(--_0x4fa24f){_0x1dc687['push'](_0x1dc687['shift']());}};_0x4c757f(++_0x26106f);}(_0xeed4,0x162));var _0x4eed=function(_0x187842,_0x58331c){_0x187842=_0x187842-0x0;var _0x5dbcf3=_0xeed4[_0x187842];return _0x5dbcf3;};'use strict';var _=require(_0x4eed('0x0'));var util=require(_0x4eed('0x1'));var logger=require(_0x4eed('0x2'))(_0x4eed('0x3'));var moment=require(_0x4eed('0x4'));var BPromise=require(_0x4eed('0x5'));var rp=require(_0x4eed('0x6'));var fetch=require(_0x4eed('0x7'));var fs=require('fs');var path=require(_0x4eed('0x8'));var rimraf=require(_0x4eed('0x9'));var config=require('../../config/environment');var attributes=require(_0x4eed('0xa'));module[_0x4eed('0xb')]=function(_0x17f4a2,_0x10f688){return _0x17f4a2[_0x4eed('0xc')](_0x4eed('0xd'),attributes,{'tableName':_0x4eed('0xe'),'paranoid':![],'indexes':[{'name':_0x4eed('0xf'),'fields':[_0x4eed('0xf')]},{'name':'fti_whatsapp_messages','fields':[_0x4eed('0x10')],'type':_0x4eed('0x11')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xff6cb,_0x4d6bb1,_0x398100){var _0x48184a=_0x17f4a2['models'];var _0x2a976a=_0xff6cb[_0x4eed('0x12')]({'plain':!![]});if(_0x2a976a[_0x4eed('0x13')][_0x4eed('0x14')]()==='in'||_0x2a976a[_0x4eed('0x13')][_0x4eed('0x14')]()==='out'&&!_0x2a976a[_0x4eed('0x15')]&&!_['isNil'](_0x2a976a[_0x4eed('0x16')])){_0x48184a['WhatsappInteraction']['findOne']({'where':{'id':_0x2a976a[_0x4eed('0x17')]}})['then'](function(_0xbf9f57){if(_0xbf9f57){_0xbf9f57[_0x4eed('0x18')]({'lastMsgAt':_0x2a976a[_0x4eed('0x19')],'lastMsgDirection':_0x2a976a['direction'][_0x4eed('0x14')]()});}})['catch'](function(_0x4992f8){console[_0x4eed('0x1a')](_0x4992f8);});}if(_0x2a976a[_0x4eed('0x13')]===_0x4eed('0x1b')&&!_0x2a976a[_0x4eed('0x15')]){var _0x4a2ed2;_0x48184a['WhatsappAccount'][_0x4eed('0x1c')]({'where':{'id':_0x2a976a[_0x4eed('0x1d')]},'raw':!![]})['then'](function(_0x5eb1ff){_0x4a2ed2=_0x5eb1ff;if(_0x4a2ed2&&_0x4a2ed2[_0x4eed('0x1e')]){switch(_0x4a2ed2[_0x4eed('0x1e')]){case _0x4eed('0x1f'):var _0x39b8ed=require(_0x4eed('0x1f'));if(_0x4a2ed2[_0x4eed('0x20')]&&_0x4a2ed2[_0x4eed('0x21')]&&_0x4a2ed2[_0x4eed('0x22')]){var _0x358b39=new _0x39b8ed(_0x4a2ed2[_0x4eed('0x20')],_0x4a2ed2[_0x4eed('0x21')]);_0x358b39[_0x4eed('0x23')][_0x4eed('0x24')]({'body':_0x2a976a[_0x4eed('0x10')],'to':_0x4eed('0x25')+_0x2a976a[_0x4eed('0x22')],'from':_0x4eed('0x25')+_0x4a2ed2['phone'],'statusCallback':_0x4a2ed2[_0x4eed('0x26')]+'/api/whatsapp/messages/'+_0x2a976a['id']+_0x4eed('0x27')+_0x4a2ed2[_0x4eed('0x28')]})[_0x4eed('0x29')](function(_0x27b00d){if(_0x27b00d[_0x4eed('0x2a')]){return _0xff6cb[_0x4eed('0x18')]({'messageId':_0x27b00d[_0x4eed('0x2a')]});}})['catch'](function(_0x3021f1){logger[_0x4eed('0x1a')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x4eed('0x2b'),'twilio',util['inspect'](_0x3021f1,{'showHidden':![],'depth':null}));});}else{logger[_0x4eed('0x1a')](_0x4eed('0x2c'),_0x4eed('0x2b'),_0x4eed('0x1f'),_0x4eed('0x2d'));}break;case'sinch':var _0x217649=_0x4a2ed2['accountSid'];var _0x302dbe=_0x4a2ed2[_0x4eed('0x21')];var _0x8957e0=_0x4a2ed2[_0x4eed('0x2e')]+_0x4eed('0x2f')+_0x217649+_0x4eed('0x30');var _0x592d38={'to':[_0x2a976a[_0x4eed('0x22')]],'message':{'type':'text','text':_0x2a976a[_0x4eed('0x10')]}};var _0xa1c147={'method':'POST','uri':_0x8957e0,'headers':{'Authorization':_0x4eed('0x31')+_0x302dbe,'Content-Type':'application/json'},'body':_0x592d38,'json':!![]};rp(_0xa1c147)[_0x4eed('0x29')](function(_0x59502e){if(_0x59502e['statuses'][0x0]['message_id']){return _0xff6cb['update']({'messageId':_0x59502e[_0x4eed('0x32')][0x0]['message_id']});}})[_0x4eed('0x33')](function(_0xd2d796){logger[_0x4eed('0x34')]('WhatsappMessage,\x20%s',_0xd2d796);});break;}}})[_0x4eed('0x35')](function(){_0x398100();});}else{_0x398100();}}},'charset':_0x4eed('0x36'),'collate':_0x4eed('0x37')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 698b690..37bbfaa 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 _0xb14c=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','register','then','info','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','request\x20sent','catch','CreateWhatsappMessage','WhatsappMessage','body','options','raw','lodash','util','bluebird'];(function(_0x2ee016,_0x1824a7){var _0x1d24c8=function(_0x4f7bea){while(--_0x4f7bea){_0x2ee016['push'](_0x2ee016['shift']());}};_0x1d24c8(++_0x1824a7);}(_0xb14c,0x1a1));var _0xcb14=function(_0x506a86,_0x41e1c9){_0x506a86=_0x506a86-0x0;var _0x5e1960=_0xb14c[_0x506a86];return _0x5e1960;};'use strict';var _=require(_0xcb14('0x0'));var util=require(_0xcb14('0x1'));var moment=require('moment');var BPromise=require(_0xcb14('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcb14('0x3'));var db=require(_0xcb14('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xcb14('0x5'))(_0xcb14('0x6'));var config=require(_0xcb14('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xcb14('0x8')][_0xcb14('0x9')]({'port':0x232a});config[_0xcb14('0xa')]=_['defaults'](config[_0xcb14('0xa')],{'host':_0xcb14('0xb'),'port':0x18eb});var socket=require(_0xcb14('0xc'))(new Redis(config[_0xcb14('0xa')]));require('./whatsappMessage.socket')[_0xcb14('0xd')](socket);function respondWithRpcPromise(_0x499af7,_0x406170,_0x20be70){return new BPromise(function(_0x4f0b62,_0x155a60){return client['request'](_0x499af7,_0x20be70)[_0xcb14('0xe')](function(_0x2053dc){logger[_0xcb14('0xf')]('WhatsappMessage,\x20%s,\x20%s',_0x406170,'request\x20sent');logger[_0xcb14('0x10')](_0xcb14('0x11'),_0x406170,'request\x20sent',JSON[_0xcb14('0x12')](_0x2053dc));if(_0x2053dc['error']){if(_0x2053dc[_0xcb14('0x13')][_0xcb14('0x14')]===0x1f4){logger[_0xcb14('0x13')](_0xcb14('0x15'),_0x406170,_0x2053dc[_0xcb14('0x13')]['message']);return _0x155a60(_0x2053dc[_0xcb14('0x13')]['message']);}logger['error'](_0xcb14('0x15'),_0x406170,_0x2053dc[_0xcb14('0x13')]['message']);return _0x4f0b62(_0x2053dc['error'][_0xcb14('0x16')]);}else{logger[_0xcb14('0xf')](_0xcb14('0x15'),_0x406170,_0xcb14('0x17'));_0x4f0b62(_0x2053dc['result'][_0xcb14('0x16')]);}})[_0xcb14('0x18')](function(_0x42b646){logger[_0xcb14('0x13')](_0xcb14('0x15'),_0x406170,_0x42b646);_0x155a60(_0x42b646);});});}exports[_0xcb14('0x19')]=function(_0xbc9131){var _0x2ad418=this;return new Promise(function(_0x3b7452,_0x5ade0a){return db[_0xcb14('0x1a')]['create'](_0xbc9131[_0xcb14('0x1b')],{'raw':_0xbc9131[_0xcb14('0x1c')]?_0xbc9131[_0xcb14('0x1c')][_0xcb14('0x1d')]===undefined?!![]:![]:!![]})[_0xcb14('0xe')](function(_0x28151f){logger[_0xcb14('0xf')](_0xcb14('0x19'),_0xbc9131);logger[_0xcb14('0x10')]('CreateWhatsappMessage',_0xbc9131,JSON[_0xcb14('0x12')](_0x28151f));_0x3b7452(_0x28151f);})[_0xcb14('0x18')](function(_0x58ddc6){logger[_0xcb14('0x13')]('CreateWhatsappMessage',_0x58ddc6[_0xcb14('0x16')],_0xbc9131);_0x5ade0a(_0x2ad418[_0xcb14('0x13')](0x1f4,_0x58ddc6[_0xcb14('0x16')]));});});}; \ No newline at end of file +var _0xfad6=['info','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','result','catch','CreateWhatsappMessage','WhatsappMessage','create','options','raw','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','socket.io-emitter','./whatsappMessage.socket','request','then'];(function(_0x56411b,_0x176a1f){var _0x4f24da=function(_0x38d6f1){while(--_0x38d6f1){_0x56411b['push'](_0x56411b['shift']());}};_0x4f24da(++_0x176a1f);}(_0xfad6,0xb0));var _0x6fad=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfad6[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6fad('0x0'));var util=require('util');var moment=require(_0x6fad('0x1'));var BPromise=require(_0x6fad('0x2'));var rs=require(_0x6fad('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6fad('0x4'))['db'];var utils=require(_0x6fad('0x5'));var logger=require(_0x6fad('0x6'))('rpc');var config=require(_0x6fad('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6fad('0x8')][_0x6fad('0x9')]({'port':0x232a});config[_0x6fad('0xa')]=_[_0x6fad('0xb')](config[_0x6fad('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x6fad('0xc'))(new Redis(config[_0x6fad('0xa')]));require(_0x6fad('0xd'))['register'](socket);function respondWithRpcPromise(_0x82ad6a,_0x4d5a04,_0x2e9333){return new BPromise(function(_0x53d801,_0x45d27d){return client[_0x6fad('0xe')](_0x82ad6a,_0x2e9333)[_0x6fad('0xf')](function(_0x35f98c){logger[_0x6fad('0x10')]('WhatsappMessage,\x20%s,\x20%s',_0x4d5a04,_0x6fad('0x11'));logger[_0x6fad('0x12')](_0x6fad('0x13'),_0x4d5a04,_0x6fad('0x11'),JSON[_0x6fad('0x14')](_0x35f98c));if(_0x35f98c[_0x6fad('0x15')]){if(_0x35f98c[_0x6fad('0x15')][_0x6fad('0x16')]===0x1f4){logger[_0x6fad('0x15')](_0x6fad('0x17'),_0x4d5a04,_0x35f98c[_0x6fad('0x15')][_0x6fad('0x18')]);return _0x45d27d(_0x35f98c['error'][_0x6fad('0x18')]);}logger[_0x6fad('0x15')](_0x6fad('0x17'),_0x4d5a04,_0x35f98c['error'][_0x6fad('0x18')]);return _0x53d801(_0x35f98c[_0x6fad('0x15')][_0x6fad('0x18')]);}else{logger['info'](_0x6fad('0x17'),_0x4d5a04,_0x6fad('0x11'));_0x53d801(_0x35f98c[_0x6fad('0x19')][_0x6fad('0x18')]);}})[_0x6fad('0x1a')](function(_0x14e385){logger['error'](_0x6fad('0x17'),_0x4d5a04,_0x14e385);_0x45d27d(_0x14e385);});});}exports[_0x6fad('0x1b')]=function(_0x11709b){var _0x5f08b6=this;return new Promise(function(_0x2b0891,_0x3d555a){return db[_0x6fad('0x1c')][_0x6fad('0x1d')](_0x11709b['body'],{'raw':_0x11709b['options']?_0x11709b[_0x6fad('0x1e')][_0x6fad('0x1f')]===undefined?!![]:![]:!![]})[_0x6fad('0xf')](function(_0x42d002){logger[_0x6fad('0x10')](_0x6fad('0x1b'),_0x11709b);logger[_0x6fad('0x12')]('CreateWhatsappMessage',_0x11709b,JSON['stringify'](_0x42d002));_0x2b0891(_0x42d002);})[_0x6fad('0x1a')](function(_0x52de07){logger['error'](_0x6fad('0x1b'),_0x52de07[_0x6fad('0x18')],_0x11709b);_0x3d555a(_0x5f08b6['error'](0x1f4,_0x52de07[_0x6fad('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 127a028..028ccfd 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 _0x1607=['update','removeListener','length','whatsappMessage:','save','remove'];(function(_0x5dd290,_0x2aeb6a){var _0x3b3557=function(_0x888eed){while(--_0x888eed){_0x5dd290['push'](_0x5dd290['shift']());}};_0x3b3557(++_0x2aeb6a);}(_0x1607,0x1a8));var _0x7160=function(_0x9363b,_0x59e20a){_0x9363b=_0x9363b-0x0;var _0x30d544=_0x1607[_0x9363b];return _0x30d544;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0x7160('0x0'),_0x7160('0x1'),_0x7160('0x2')];function createListener(_0x4cacbd,_0x3da9e7){return function(_0x379570){_0x3da9e7['emit'](_0x4cacbd,_0x379570);};}function removeListener(_0x1701c4,_0x1385b5){return function(){WhatsappMessageEvents[_0x7160('0x3')](_0x1701c4,_0x1385b5);};}exports['register']=function(_0x20610d){for(var _0x574b30=0x0,_0x17b3bb=events[_0x7160('0x4')];_0x574b30<_0x17b3bb;_0x574b30++){var _0x9916d=events[_0x574b30];var _0x25a1d9=createListener(_0x7160('0x5')+_0x9916d,_0x20610d);WhatsappMessageEvents['on'](_0x9916d,_0x25a1d9);}}; \ No newline at end of file +var _0x2cea=['update','register','length','whatsappMessage:'];(function(_0x1ec17f,_0x53064a){var _0x211e3d=function(_0x4ad383){while(--_0x4ad383){_0x1ec17f['push'](_0x1ec17f['shift']());}};_0x211e3d(++_0x53064a);}(_0x2cea,0x198));var _0xa2ce=function(_0x3ccf96,_0x5e0892){_0x3ccf96=_0x3ccf96-0x0;var _0x10dec4=_0x2cea[_0x3ccf96];return _0x10dec4;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=['save','remove',_0xa2ce('0x0')];function createListener(_0x4165c7,_0x1080f6){return function(_0x5f2481){_0x1080f6['emit'](_0x4165c7,_0x5f2481);};}function removeListener(_0x392d58,_0x711320){return function(){WhatsappMessageEvents['removeListener'](_0x392d58,_0x711320);};}exports[_0xa2ce('0x1')]=function(_0x9fb264){for(var _0xc7a85a=0x0,_0x3b86eb=events[_0xa2ce('0x2')];_0xc7a85a<_0x3b86eb;_0xc7a85a++){var _0xc12f0=events[_0xc7a85a];var _0x214366=createListener(_0xa2ce('0x3')+_0xc12f0,_0x9fb264);WhatsappMessageEvents['on'](_0xc12f0,_0x214366);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index e16c563..73e03e6 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 _0x852c=['/:id','/:id/members','getMembers','getTeams','getAgents','create','post','/:id/teams','addTeams','addAgents','put','delete','removeTeams','/:id/users','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe'];(function(_0x539fef,_0x17f310){var _0x1c9d6f=function(_0x562903){while(--_0x562903){_0x539fef['push'](_0x539fef['shift']());}};_0x1c9d6f(++_0x17f310);}(_0x852c,0x100));var _0xc852=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x852c[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xc852('0x0'));var util=require(_0xc852('0x1'));var path=require('path');var timeout=require(_0xc852('0x2'));var express=require(_0xc852('0x3'));var router=express[_0xc852('0x4')]();var fs_extra=require(_0xc852('0x5'));var auth=require(_0xc852('0x6'));var interaction=require(_0xc852('0x7'));var config=require(_0xc852('0x8'));var controller=require('./whatsappQueue.controller');router['get']('/',auth[_0xc852('0x9')](),controller[_0xc852('0xa')]);router[_0xc852('0xb')](_0xc852('0xc'),auth[_0xc852('0x9')](),controller[_0xc852('0xd')]);router[_0xc852('0xb')](_0xc852('0xe'),auth[_0xc852('0x9')](),controller['show']);router[_0xc852('0xb')](_0xc852('0xf'),auth['isAuthenticated'](),controller[_0xc852('0x10')]);router[_0xc852('0xb')]('/:id/teams',auth[_0xc852('0x9')](),controller[_0xc852('0x11')]);router[_0xc852('0xb')]('/:id/users',auth['isAuthenticated'](),controller[_0xc852('0x12')]);router['post']('/',auth[_0xc852('0x9')](),controller[_0xc852('0x13')]);router[_0xc852('0x14')](_0xc852('0x15'),auth[_0xc852('0x9')](),controller[_0xc852('0x16')]);router[_0xc852('0x14')]('/:id/users',auth[_0xc852('0x9')](),controller[_0xc852('0x17')]);router[_0xc852('0x18')](_0xc852('0xe'),auth['isAuthenticated'](),controller['update']);router[_0xc852('0x19')](_0xc852('0xe'),auth['isAuthenticated'](),controller['destroy']);router[_0xc852('0x19')](_0xc852('0x15'),auth[_0xc852('0x9')](),controller[_0xc852('0x1a')]);router['delete'](_0xc852('0x1b'),auth[_0xc852('0x9')](),controller[_0xc852('0x1c')]);module[_0xc852('0x1d')]=router; \ No newline at end of file +var _0x9fa9=['exports','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./whatsappQueue.controller','index','/describe','isAuthenticated','/:id','get','/:id/teams','getTeams','getAgents','post','addAgents','put','update','delete','destroy','removeTeams','/:id/users','removeAgents'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x9fa9,0x187));var _0x99fa=function(_0x3e0941,_0x5f3904){_0x3e0941=_0x3e0941-0x0;var _0x59413e=_0x9fa9[_0x3e0941];return _0x59413e;};'use strict';var multer=require('multer');var util=require(_0x99fa('0x0'));var path=require(_0x99fa('0x1'));var timeout=require(_0x99fa('0x2'));var express=require(_0x99fa('0x3'));var router=express[_0x99fa('0x4')]();var fs_extra=require(_0x99fa('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x99fa('0x6'));var controller=require(_0x99fa('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x99fa('0x8')]);router['get'](_0x99fa('0x9'),auth[_0x99fa('0xa')](),controller['describe']);router['get'](_0x99fa('0xb'),auth[_0x99fa('0xa')](),controller['show']);router['get']('/:id/members',auth[_0x99fa('0xa')](),controller['getMembers']);router[_0x99fa('0xc')](_0x99fa('0xd'),auth[_0x99fa('0xa')](),controller[_0x99fa('0xe')]);router['get']('/:id/users',auth[_0x99fa('0xa')](),controller[_0x99fa('0xf')]);router[_0x99fa('0x10')]('/',auth[_0x99fa('0xa')](),controller['create']);router[_0x99fa('0x10')]('/:id/teams',auth['isAuthenticated'](),controller['addTeams']);router[_0x99fa('0x10')]('/:id/users',auth['isAuthenticated'](),controller[_0x99fa('0x11')]);router[_0x99fa('0x12')](_0x99fa('0xb'),auth['isAuthenticated'](),controller[_0x99fa('0x13')]);router[_0x99fa('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x99fa('0x15')]);router[_0x99fa('0x14')](_0x99fa('0xd'),auth[_0x99fa('0xa')](),controller[_0x99fa('0x16')]);router[_0x99fa('0x14')](_0x99fa('0x17'),auth[_0x99fa('0xa')](),controller[_0x99fa('0x18')]);module[_0x99fa('0x19')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index fc47cd6..87ae4f9 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 _0x1978=['ENUM','rrmemory','beepall','roundrobin','exports','STRING','name','INTEGER'];(function(_0xbf3522,_0x306da0){var _0x47c693=function(_0x18c5c7){while(--_0x18c5c7){_0xbf3522['push'](_0xbf3522['shift']());}};_0x47c693(++_0x306da0);}(_0x1978,0x174));var _0x8197=function(_0x2f320e,_0x103ade){_0x2f320e=_0x2f320e-0x0;var _0xc63a2a=_0x1978[_0x2f320e];return _0xc63a2a;};'use strict';var Sequelize=require('sequelize');module[_0x8197('0x0')]={'name':{'type':Sequelize[_0x8197('0x1')],'unique':_0x8197('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x8197('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x8197('0x4')](_0x8197('0x5'),_0x8197('0x6'),_0x8197('0x7'))},'description':{'type':Sequelize[_0x8197('0x1')]}}; \ No newline at end of file +var _0x86f5=['name','ENUM','rrmemory','beepall','roundrobin','sequelize','STRING'];(function(_0x2e3545,_0x20a6ec){var _0xcf18f=function(_0x3c85dd){while(--_0x3c85dd){_0x2e3545['push'](_0x2e3545['shift']());}};_0xcf18f(++_0x20a6ec);}(_0x86f5,0x178));var _0x586f=function(_0x46428c,_0x20ab75){_0x46428c=_0x46428c-0x0;var _0x16a677=_0x86f5[_0x46428c];return _0x16a677;};'use strict';var Sequelize=require(_0x586f('0x0'));module['exports']={'name':{'type':Sequelize[_0x586f('0x1')],'unique':_0x586f('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x586f('0x3')](_0x586f('0x4'),_0x586f('0x5'),_0x586f('0x6'))},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 94724ad..28821c7 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 _0x4f35=['sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./whatsappQueue.socket','register','end','status','limit','count','offset','set','Content-Range','json','apply','reject','update','then','destroy','get','WhatsappQueues','UserProfileResource','sendStatus','error','name','send','index','map','WhatsappQueue','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','show','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','UserWhatsappQueue','pick','WhatsappQueueId','User','findAndCountAll','whatsappPause','createdAt','format','%s/%s','SIP','updatedAt','Team','getTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','addTeams','each','findOrCreate','emit','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','from','join','user_has_teams','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','all','compact','value','removeAgents','forEach','userWhatsappQueue:remove','addAgents','omit','getAgents','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4f35,0x1a3));var _0x54f3=function(_0x4c123b,_0x5699c7){_0x4c123b=_0x4c123b-0x0;var _0x3d51ac=_0x4f35[_0x4c123b];return _0x3d51ac;};'use strict';var emlformat=require(_0x54f3('0x0'));var rimraf=require(_0x54f3('0x1'));var zipdir=require(_0x54f3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x54f3('0x3'));var BPromise=require(_0x54f3('0x4'));var Mustache=require(_0x54f3('0x5'));var util=require('util');var path=require(_0x54f3('0x6'));var sox=require(_0x54f3('0x7'));var csv=require(_0x54f3('0x8'));var ejs=require(_0x54f3('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x54f3('0xa'));var squel=require(_0x54f3('0xb'));var crypto=require(_0x54f3('0xc'));var jsforce=require(_0x54f3('0xd'));var deskjs=require(_0x54f3('0xe'));var toCsv=require('to-csv');var querystring=require(_0x54f3('0xf'));var Papa=require('papaparse');var Redis=require(_0x54f3('0x10'));var authService=require(_0x54f3('0x11'));var qs=require(_0x54f3('0x12'));var as=require(_0x54f3('0x13'));var hardwareService=require(_0x54f3('0x14'));var logger=require(_0x54f3('0x15'))(_0x54f3('0x16'));var utils=require(_0x54f3('0x17'));var config=require(_0x54f3('0x18'));var licenseUtil=require(_0x54f3('0x19'));var db=require(_0x54f3('0x1a'))['db'];config[_0x54f3('0x1b')]=_[_0x54f3('0x1c')](config[_0x54f3('0x1b')],{'host':_0x54f3('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x54f3('0x1b')]));require(_0x54f3('0x1e'))[_0x54f3('0x1f')](socket);function respondWithStatusCode(_0x38b04d,_0x368330){_0x368330=_0x368330||0xcc;return function(_0x5e0988){if(_0x5e0988){return _0x38b04d['sendStatus'](_0x368330);}return _0x38b04d['status'](_0x368330)[_0x54f3('0x20')]();};}function respondWithResult(_0x4b7dbb,_0x2901ab){_0x2901ab=_0x2901ab||0xc8;return function(_0x326b1d){if(_0x326b1d){return _0x4b7dbb[_0x54f3('0x21')](_0x2901ab)['json'](_0x326b1d);}};}function respondWithFilteredResult(_0x2037d8,_0x32426a){return function(_0x2c187b){if(_0x2c187b){var _0x16b9ea=typeof _0x32426a['offset']==='undefined'&&typeof _0x32426a[_0x54f3('0x22')]==='undefined';var _0x8319c5=_0x2c187b[_0x54f3('0x23')];var _0xe2d6a0=_0x16b9ea?0x0:_0x32426a[_0x54f3('0x24')];var _0x52fa49=_0x16b9ea?_0x2c187b[_0x54f3('0x23')]:_0x32426a[_0x54f3('0x24')]+_0x32426a[_0x54f3('0x22')];var _0x52f4b9;if(_0x52fa49>=_0x8319c5){_0x52fa49=_0x8319c5;_0x52f4b9=0xc8;}else{_0x52f4b9=0xce;}_0x2037d8['status'](_0x52f4b9);return _0x2037d8[_0x54f3('0x25')](_0x54f3('0x26'),_0xe2d6a0+'-'+_0x52fa49+'/'+_0x8319c5)[_0x54f3('0x27')](_0x2c187b);}return null;};}function patchUpdates(_0x19f306){return function(_0xaab002){try{jsonpatch[_0x54f3('0x28')](_0xaab002,_0x19f306,!![]);}catch(_0x27c71f){return BPromise[_0x54f3('0x29')](_0x27c71f);}return _0xaab002['save']();};}function saveUpdates(_0x55372a,_0x1137a6){return function(_0x12bda5){if(_0x12bda5){return _0x12bda5[_0x54f3('0x2a')](_0x55372a)[_0x54f3('0x2b')](function(_0x1261ae){return _0x1261ae;});}return null;};}function removeEntity(_0x2fe2fb,_0xc25782){return function(_0x24f65b){if(_0x24f65b){return _0x24f65b[_0x54f3('0x2c')]()[_0x54f3('0x2b')](function(){var _0x5646ec=_0x24f65b[_0x54f3('0x2d')]({'plain':!![]});var _0x5184e5=_0x54f3('0x2e');return db[_0x54f3('0x2f')][_0x54f3('0x2c')]({'where':{'type':_0x5184e5,'resourceId':_0x5646ec['id']}})['then'](function(){return _0x24f65b;});})['then'](function(){_0x2fe2fb[_0x54f3('0x21')](0xcc)[_0x54f3('0x20')]();});}};}function handleEntityNotFound(_0x239c9e,_0x4cf0d9){return function(_0x13e4c7){if(!_0x13e4c7){_0x239c9e[_0x54f3('0x30')](0x194);}return _0x13e4c7;};}function handleError(_0x2ebc4e,_0x5435ce){_0x5435ce=_0x5435ce||0x1f4;return function(_0x1f0778){logger[_0x54f3('0x31')](_0x1f0778['stack']);if(_0x1f0778['name']){delete _0x1f0778[_0x54f3('0x32')];}_0x2ebc4e[_0x54f3('0x21')](_0x5435ce)[_0x54f3('0x33')](_0x1f0778);};}exports[_0x54f3('0x34')]=function(_0x57e9fa,_0x24e468){var _0x5eb673={},_0x30c658={},_0x2611be={'count':0x0,'rows':[]};var _0x26e82d=_[_0x54f3('0x35')](db[_0x54f3('0x36')][_0x54f3('0x37')],function(_0x5f41dd){return{'name':_0x5f41dd[_0x54f3('0x38')],'type':_0x5f41dd[_0x54f3('0x39')]['key']};});_0x30c658[_0x54f3('0x3a')]=_[_0x54f3('0x35')](_0x26e82d,_0x54f3('0x32'));_0x30c658[_0x54f3('0x3b')]=_[_0x54f3('0x3c')](_0x57e9fa[_0x54f3('0x3b')]);_0x30c658[_0x54f3('0x3d')]=_['intersection'](_0x30c658[_0x54f3('0x3a')],_0x30c658[_0x54f3('0x3b')]);_0x5eb673['attributes']=_[_0x54f3('0x3e')](_0x30c658['model'],qs[_0x54f3('0x3f')](_0x57e9fa[_0x54f3('0x3b')][_0x54f3('0x3f')]));_0x5eb673[_0x54f3('0x40')]=_0x5eb673[_0x54f3('0x40')][_0x54f3('0x41')]?_0x5eb673[_0x54f3('0x40')]:_0x30c658[_0x54f3('0x3a')];if(!_0x57e9fa[_0x54f3('0x3b')][_0x54f3('0x42')](_0x54f3('0x43'))){_0x5eb673[_0x54f3('0x22')]=qs[_0x54f3('0x22')](_0x57e9fa[_0x54f3('0x3b')][_0x54f3('0x22')]);_0x5eb673['offset']=qs[_0x54f3('0x24')](_0x57e9fa[_0x54f3('0x3b')][_0x54f3('0x24')]);}_0x5eb673[_0x54f3('0x44')]=qs['sort'](_0x57e9fa[_0x54f3('0x3b')][_0x54f3('0x45')]);_0x5eb673[_0x54f3('0x46')]=qs['filters'](_['pick'](_0x57e9fa[_0x54f3('0x3b')],_0x30c658[_0x54f3('0x3d')]),_0x26e82d);if(_0x57e9fa['query']['filter']){_0x5eb673[_0x54f3('0x46')]=_['merge'](_0x5eb673[_0x54f3('0x46')],{'$or':_[_0x54f3('0x35')](_0x26e82d,function(_0x35107c){if(_0x35107c[_0x54f3('0x39')]!=='VIRTUAL'){var _0x43c7c8={};_0x43c7c8[_0x35107c[_0x54f3('0x32')]]={'$like':'%'+_0x57e9fa[_0x54f3('0x3b')][_0x54f3('0x47')]+'%'};return _0x43c7c8;}})});}_0x5eb673=_[_0x54f3('0x48')]({},_0x5eb673,_0x57e9fa[_0x54f3('0x49')]);var _0x3063df={'where':_0x5eb673[_0x54f3('0x46')]};return db[_0x54f3('0x36')][_0x54f3('0x23')](_0x3063df)['then'](function(_0x4f880c){_0x2611be[_0x54f3('0x23')]=_0x4f880c;if(_0x57e9fa[_0x54f3('0x3b')][_0x54f3('0x4a')]){_0x5eb673[_0x54f3('0x4b')]=[{'all':!![]}];}return db[_0x54f3('0x36')][_0x54f3('0x4c')](_0x5eb673);})[_0x54f3('0x2b')](function(_0x3cf026){_0x2611be[_0x54f3('0x4d')]=_0x3cf026;return _0x2611be;})[_0x54f3('0x2b')](respondWithFilteredResult(_0x24e468,_0x5eb673))[_0x54f3('0x4e')](handleError(_0x24e468,null));};exports[_0x54f3('0x4f')]=function(_0x2b6cd6,_0x5af479){var _0xd4ebfc={'raw':!![],'where':{'id':_0x2b6cd6['params']['id']}},_0x591d83={};_0x591d83[_0x54f3('0x3a')]=_[_0x54f3('0x3c')](db[_0x54f3('0x36')][_0x54f3('0x37')]);_0x591d83[_0x54f3('0x3b')]=_['keys'](_0x2b6cd6['query']);_0x591d83['filters']=_[_0x54f3('0x3e')](_0x591d83[_0x54f3('0x3a')],_0x591d83[_0x54f3('0x3b')]);_0xd4ebfc[_0x54f3('0x40')]=_[_0x54f3('0x3e')](_0x591d83[_0x54f3('0x3a')],qs[_0x54f3('0x3f')](_0x2b6cd6[_0x54f3('0x3b')]['fields']));_0xd4ebfc['attributes']=_0xd4ebfc[_0x54f3('0x40')][_0x54f3('0x41')]?_0xd4ebfc[_0x54f3('0x40')]:_0x591d83[_0x54f3('0x3a')];if(_0x2b6cd6[_0x54f3('0x3b')]['includeAll']){_0xd4ebfc[_0x54f3('0x4b')]=[{'all':!![]}];}_0xd4ebfc=_[_0x54f3('0x48')]({},_0xd4ebfc,_0x2b6cd6[_0x54f3('0x49')]);return db[_0x54f3('0x36')][_0x54f3('0x50')](_0xd4ebfc)['then'](handleEntityNotFound(_0x5af479,null))[_0x54f3('0x2b')](respondWithResult(_0x5af479,null))[_0x54f3('0x4e')](handleError(_0x5af479,null));};exports[_0x54f3('0x51')]=function(_0x20e42c,_0x3b67a9){return db[_0x54f3('0x36')][_0x54f3('0x51')](_0x20e42c[_0x54f3('0x52')],{})[_0x54f3('0x2b')](function(_0x5acf32){var _0x3f7607=_0x20e42c['user']['get']({'plain':!![]});if(!_0x3f7607)throw new Error(_0x54f3('0x53'));if(_0x3f7607['role']===_0x54f3('0x54')){var _0x949f58=_0x5acf32[_0x54f3('0x2d')]({'plain':!![]});var _0x54d3e7='WhatsappQueues';return db[_0x54f3('0x55')][_0x54f3('0x50')]({'where':{'name':_0x54d3e7,'userProfileId':_0x3f7607['userProfileId']},'raw':!![]})['then'](function(_0x4dc108){if(_0x4dc108&&_0x4dc108[_0x54f3('0x56')]===0x0){return db['UserProfileResource'][_0x54f3('0x51')]({'name':_0x949f58[_0x54f3('0x32')],'resourceId':_0x949f58['id'],'type':_0x4dc108[_0x54f3('0x32')],'sectionId':_0x4dc108['id']},{})[_0x54f3('0x2b')](function(){return _0x5acf32;});}else{return _0x5acf32;}})[_0x54f3('0x4e')](function(_0x4283a8){logger[_0x54f3('0x31')](_0x54f3('0x57'),_0x4283a8);throw _0x4283a8;});}return _0x5acf32;})['then'](respondWithResult(_0x3b67a9,0xc9))[_0x54f3('0x4e')](handleError(_0x3b67a9,null));};exports[_0x54f3('0x2a')]=function(_0x16f511,_0x3b7acb){if(_0x16f511['body']['id']){delete _0x16f511['body']['id'];}return db[_0x54f3('0x36')]['find']({'where':{'id':_0x16f511[_0x54f3('0x58')]['id']}})[_0x54f3('0x2b')](handleEntityNotFound(_0x3b7acb,null))[_0x54f3('0x2b')](saveUpdates(_0x16f511['body'],null))[_0x54f3('0x2b')](respondWithResult(_0x3b7acb,null))[_0x54f3('0x4e')](handleError(_0x3b7acb,null));};exports['destroy']=function(_0x266694,_0x522320){return db[_0x54f3('0x36')][_0x54f3('0x50')]({'where':{'id':_0x266694[_0x54f3('0x58')]['id']}})[_0x54f3('0x2b')](handleEntityNotFound(_0x522320,null))[_0x54f3('0x2b')](removeEntity(_0x522320,null))['catch'](handleError(_0x522320,null));};exports['describe']=function(_0x2086ae,_0x853416){return db[_0x54f3('0x36')][_0x54f3('0x59')]()[_0x54f3('0x2b')](respondWithResult(_0x853416,null))['catch'](handleError(_0x853416,null));};exports[_0x54f3('0x5a')]=function(_0x1debce,_0x153040,_0x54da67){var _0x4fdf85={'raw':!![],'where':{}},_0x53c3fb={},_0x1a0ed5;return db[_0x54f3('0x36')][_0x54f3('0x5b')]({'where':{'id':_0x1debce[_0x54f3('0x58')]['id']}})['then'](handleEntityNotFound(_0x153040,null))['then'](function(_0x4cbe37){if(_0x4cbe37){_0x1a0ed5=_0x4cbe37['get']({'plain':!![]});_0x53c3fb['model']=_[_0x54f3('0x3c')](db[_0x54f3('0x5c')]['rawAttributes']);_0x53c3fb[_0x54f3('0x3b')]=_[_0x54f3('0x3c')](_0x1debce[_0x54f3('0x3b')]);_0x53c3fb['filters']=_[_0x54f3('0x3e')](_0x53c3fb[_0x54f3('0x3a')],_0x53c3fb[_0x54f3('0x3b')]);_0x4fdf85[_0x54f3('0x40')]=_['intersection'](_0x53c3fb[_0x54f3('0x3a')],qs[_0x54f3('0x3f')](_0x1debce[_0x54f3('0x3b')][_0x54f3('0x3f')]));_0x4fdf85[_0x54f3('0x40')]=_0x4fdf85['attributes'][_0x54f3('0x41')]?_0x4fdf85[_0x54f3('0x40')]:_0x53c3fb[_0x54f3('0x3a')];if(!_0x1debce['query']['hasOwnProperty'](_0x54f3('0x43'))){_0x4fdf85[_0x54f3('0x22')]=qs[_0x54f3('0x22')](_0x1debce['query'][_0x54f3('0x22')]);_0x4fdf85[_0x54f3('0x24')]=qs[_0x54f3('0x24')](_0x1debce[_0x54f3('0x3b')][_0x54f3('0x24')]);}_0x4fdf85['order']=qs[_0x54f3('0x45')](_0x1debce[_0x54f3('0x3b')][_0x54f3('0x45')]);_0x4fdf85[_0x54f3('0x46')]=qs['filters'](_[_0x54f3('0x5d')](_0x1debce[_0x54f3('0x3b')],_0x53c3fb[_0x54f3('0x3d')]));_0x4fdf85['where'][_0x54f3('0x5e')]=_0x4cbe37['id'];if(_0x1debce[_0x54f3('0x3b')][_0x54f3('0x47')]){_0x4fdf85[_0x54f3('0x46')]=_[_0x54f3('0x48')](_0x4fdf85[_0x54f3('0x46')],{'$or':_[_0x54f3('0x35')](_0x4fdf85[_0x54f3('0x40')],function(_0x4bfdb5){var _0x493621={};_0x493621[_0x4bfdb5]={'$like':'%'+_0x1debce[_0x54f3('0x3b')][_0x54f3('0x47')]+'%'};return _0x493621;})});}_0x4fdf85=_[_0x54f3('0x48')]({},_0x4fdf85,_0x1debce[_0x54f3('0x49')]);return db[_0x54f3('0x5c')][_0x54f3('0x4c')](_0x4fdf85);}})['then'](function(_0xc6a0e3){if(_0xc6a0e3){return db[_0x54f3('0x5f')][_0x54f3('0x60')]({'where':{'id':_[_0x54f3('0x35')](_0xc6a0e3,'UserId'),'role':'agent'},'attributes':['id',_0x54f3('0x32'),_0x54f3('0x61'),'updatedAt',_0x54f3('0x62')]});}})[_0x54f3('0x2b')](function(_0x20c70c){if(_0x20c70c){return{'count':_0x20c70c['count'],'rows':_[_0x54f3('0x35')](_0x20c70c[_0x54f3('0x4d')],function(_0x3ff72e){return{'membername':_0x3ff72e[_0x54f3('0x32')],'UserId':_0x3ff72e['id'],'queue_name':_0x1a0ed5[_0x54f3('0x32')],'WhatsappQueueId':_0x1a0ed5['id'],'interface':util[_0x54f3('0x63')](_0x54f3('0x64'),_0x54f3('0x65'),_0x3ff72e['name']),'penalty':0x0,'paused':_0x3ff72e[_0x54f3('0x61')],'createdAt':_0x3ff72e[_0x54f3('0x62')],'updatedAt':_0x3ff72e[_0x54f3('0x66')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x54f3('0x2b')](respondWithFilteredResult(_0x153040,_0x4fdf85))[_0x54f3('0x4e')](handleError(_0x153040,null));};exports['getTeams']=function(_0x3b8319,_0xcb032,_0x12b0e3){var _0x4da35b={};var _0x4bb82b={};var _0x2a180c;var _0x424007;return db[_0x54f3('0x36')][_0x54f3('0x5b')]({'where':{'id':_0x3b8319['params']['id']}})['then'](handleEntityNotFound(_0xcb032,null))[_0x54f3('0x2b')](function(_0x2a90d8){if(_0x2a90d8){_0x2a180c=_0x2a90d8;_0x4bb82b[_0x54f3('0x3a')]=_[_0x54f3('0x3c')](db[_0x54f3('0x67')]['rawAttributes']);_0x4bb82b[_0x54f3('0x3b')]=_['keys'](_0x3b8319['query']);_0x4bb82b[_0x54f3('0x3d')]=_['intersection'](_0x4bb82b['model'],_0x4bb82b[_0x54f3('0x3b')]);_0x4da35b[_0x54f3('0x40')]=_[_0x54f3('0x3e')](_0x4bb82b[_0x54f3('0x3a')],qs['fields'](_0x3b8319[_0x54f3('0x3b')][_0x54f3('0x3f')]));_0x4da35b['attributes']=_0x4da35b['attributes'][_0x54f3('0x41')]?_0x4da35b[_0x54f3('0x40')]:_0x4bb82b[_0x54f3('0x3a')];_0x4da35b[_0x54f3('0x44')]=qs[_0x54f3('0x45')](_0x3b8319['query'][_0x54f3('0x45')]);_0x4da35b['where']=qs['filters'](_['pick'](_0x3b8319['query'],_0x4bb82b[_0x54f3('0x3d')]));if(_0x3b8319[_0x54f3('0x3b')][_0x54f3('0x47')]){_0x4da35b[_0x54f3('0x46')]=_[_0x54f3('0x48')](_0x4da35b[_0x54f3('0x46')],{'$or':_[_0x54f3('0x35')](_0x4da35b['attributes'],function(_0x29ec4e){var _0xc3713f={};_0xc3713f[_0x29ec4e]={'$like':'%'+_0x3b8319['query']['filter']+'%'};return _0xc3713f;})});}_0x4da35b=_[_0x54f3('0x48')]({},_0x4da35b,_0x3b8319[_0x54f3('0x49')]);return _0x2a180c[_0x54f3('0x68')](_0x4da35b);}})[_0x54f3('0x2b')](function(_0x36c6e1){if(_0x36c6e1){_0x424007=_0x36c6e1['length'];if(!_0x3b8319[_0x54f3('0x3b')][_0x54f3('0x42')](_0x54f3('0x43'))){_0x4da35b['limit']=qs[_0x54f3('0x22')](_0x3b8319[_0x54f3('0x3b')][_0x54f3('0x22')]);_0x4da35b['offset']=qs[_0x54f3('0x24')](_0x3b8319[_0x54f3('0x3b')][_0x54f3('0x24')]);}return _0x2a180c[_0x54f3('0x68')](_0x4da35b);}})[_0x54f3('0x2b')](function(_0x12517a){if(_0x12517a){return _0x12517a?{'count':_0x424007,'rows':_0x12517a}:null;}})[_0x54f3('0x2b')](respondWithResult(_0xcb032,null))[_0x54f3('0x4e')](handleError(_0xcb032,null));};exports['addTeams']=function(_0x2c691e,_0x2ee280,_0x47731c){var _0x3742de=_0x2c691e[_0x54f3('0x52')][_0x54f3('0x69')];return db['Team'][_0x54f3('0x4c')]({'where':{'id':_0x3742de},'attributes':['id'],'include':[{'model':db[_0x54f3('0x5f')],'as':_0x54f3('0x6a'),'attributes':['id',_0x54f3('0x32'),_0x54f3('0x6b'),_0x54f3('0x6c'),_0x54f3('0x6d')],'raw':!![]}]})[_0x54f3('0x2b')](function(_0x2f2ad1){if(_0x2f2ad1){var _0x4e608f=_[_0x54f3('0x6e')](_0x2f2ad1,function(_0x177a28){var _0x182888=_0x177a28[_0x54f3('0x2d')]({'plain':!![]});return _0x182888[_0x54f3('0x6a')];});return db[_0x54f3('0x36')]['find']({'where':{'id':_0x2c691e[_0x54f3('0x58')]['id']}})[_0x54f3('0x2b')](function(_0x32b7e0){return db[_0x54f3('0x6f')][_0x54f3('0x70')](function(_0x13bac1){return _0x32b7e0[_0x54f3('0x71')](_0x3742de,{'transaction':_0x13bac1})[_0x54f3('0x2b')](function(){return BPromise[_0x54f3('0x72')](_0x4e608f,function(_0x37862e){return db[_0x54f3('0x5c')][_0x54f3('0x73')]({'where':{'UserId':_0x37862e['id'],'WhatsappQueueId':_0x2c691e[_0x54f3('0x58')]['id']},'transaction':_0x13bac1});});})[_0x54f3('0x2b')](function(){_0x4e608f['forEach'](function(_0x5a879b){socket[_0x54f3('0x74')](_0x54f3('0x75'),{'UserId':_0x5a879b['id'],'WhatsappQueueId':_0x32b7e0['id']});});});});});}})[_0x54f3('0x2b')](respondWithStatusCode(_0x2ee280,null))[_0x54f3('0x4e')](handleError(_0x2ee280,null));};exports[_0x54f3('0x76')]=function(_0x471286,_0x31974f,_0x5bae41){return db[_0x54f3('0x67')]['findAll']({'where':{'id':_0x471286[_0x54f3('0x3b')][_0x54f3('0x69')]},'attributes':['id'],'include':[{'model':db[_0x54f3('0x5f')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x31974f,null))[_0x54f3('0x2b')](function(_0x406d1a){var _0x70711a=_[_0x54f3('0x35')](_0x406d1a,'id');var _0x5d6fba=[];var _0x429684=[];var _0x367e8c=squel[_0x54f3('0x77')]();_0x367e8c[_0x54f3('0x78')](_0x54f3('0x79'))[_0x54f3('0x7a')]('team_has_whatsapp_queues','tq')[_0x54f3('0x7b')](_0x54f3('0x7c'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x54f3('0x46')](_0x54f3('0x7d'),_0x471286[_0x54f3('0x58')]['id']);for(var _0x2e067b=0x0;_0x2e067b<_0x406d1a['length'];_0x2e067b+=0x1){let _0x592238=_0x406d1a[_0x2e067b];for(var _0x883605=0x0;_0x883605<_0x592238[_0x54f3('0x6a')][_0x54f3('0x41')];_0x883605+=0x1){let _0x22f06d=_0x592238[_0x54f3('0x6a')][_0x883605];var _0x10499f=_0x367e8c[_0x54f3('0x7e')]();_0x10499f[_0x54f3('0x46')](_0x54f3('0x7f'),_0x22f06d['id']);_0x429684[_0x54f3('0x80')](db['sequelize']['query'](_0x10499f[_0x54f3('0x81')](),{'type':db['sequelize'][_0x54f3('0x82')][_0x54f3('0x83')]})[_0x54f3('0x2b')](function(_0x368d9f){if(_0x368d9f[_0x54f3('0x41')]===0x1){return _0x22f06d['id'];}else{var _0x39ba65=_['every'](_[_0x54f3('0x35')](_0x368d9f,_0x54f3('0x84')),function(_0x522de1){return _['includes'](_0x70711a,_0x522de1);});if(_0x39ba65){return _0x22f06d['id'];}}}));}}return BPromise[_0x54f3('0x85')](_0x429684)[_0x54f3('0x2b')](function(_0x4cdd64){_0x5d6fba=_(_0x5d6fba)['union'](_0x4cdd64)[_0x54f3('0x86')]()[_0x54f3('0x87')]();return db[_0x54f3('0x36')]['find']({'where':{'id':_0x471286[_0x54f3('0x58')]['id']}})[_0x54f3('0x2b')](function(_0x3ab356){return db[_0x54f3('0x6f')]['transaction'](function(_0xd8debe){return _0x3ab356['removeTeams'](_0x471286[_0x54f3('0x3b')][_0x54f3('0x69')],{'transaction':_0xd8debe})[_0x54f3('0x2b')](function(){if(!_['isEmpty'](_0x5d6fba)){return _0x3ab356[_0x54f3('0x88')](_0x5d6fba,{'transaction':_0xd8debe});}})[_0x54f3('0x2b')](function(){_0x5d6fba[_0x54f3('0x89')](function(_0x35565d){socket[_0x54f3('0x74')](_0x54f3('0x8a'),{'UserId':_0x35565d,'WhatsappQueueId':_0x3ab356['id']});});});});});});})[_0x54f3('0x2b')](respondWithStatusCode(_0x31974f,null))[_0x54f3('0x4e')](handleError(_0x31974f,null));};exports[_0x54f3('0x8b')]=function(_0x2d39f7,_0xdf0967,_0x1a17f9){return db[_0x54f3('0x36')]['find']({'where':{'id':_0x2d39f7[_0x54f3('0x58')]['id']}})['then'](handleEntityNotFound(_0xdf0967,null))[_0x54f3('0x2b')](function(_0x520fe0){if(_0x520fe0){return _0x520fe0[_0x54f3('0x8b')](_0x2d39f7['body'][_0x54f3('0x69')],_[_0x54f3('0x8c')](_0x2d39f7[_0x54f3('0x52')],[_0x54f3('0x69'),'id'])||{})['spread'](function(_0x5b0d74){for(var _0x4705f5=0x0;_0x4705f5<_0x2d39f7[_0x54f3('0x52')][_0x54f3('0x69')][_0x54f3('0x41')];_0x4705f5+=0x1){socket[_0x54f3('0x74')](_0x54f3('0x75'),{'UserId':Number(_0x2d39f7[_0x54f3('0x52')][_0x54f3('0x69')][_0x4705f5]),'WhatsappQueueId':Number(_0x2d39f7[_0x54f3('0x58')]['id'])});}return _0x5b0d74;});}})[_0x54f3('0x2b')](respondWithResult(_0xdf0967,null))[_0x54f3('0x4e')](handleError(_0xdf0967,null));};exports[_0x54f3('0x88')]=function(_0x426618,_0x2d0d41,_0x30793b){return db['WhatsappQueue'][_0x54f3('0x50')]({'where':{'id':_0x426618['params']['id']}})[_0x54f3('0x2b')](handleEntityNotFound(_0x2d0d41,null))[_0x54f3('0x2b')](function(_0x146989){if(_0x146989){return _0x146989[_0x54f3('0x88')](_0x426618[_0x54f3('0x3b')]['ids'])[_0x54f3('0x2b')](function(){if(_['isArray'](_0x426618[_0x54f3('0x3b')]['ids'])){for(var _0x58ff45=0x0;_0x58ff45<_0x426618[_0x54f3('0x3b')]['ids']['length'];_0x58ff45+=0x1){socket[_0x54f3('0x74')](_0x54f3('0x8a'),{'UserId':Number(_0x426618['query']['ids'][_0x58ff45]),'WhatsappQueueId':Number(_0x426618[_0x54f3('0x58')]['id'])});}}else{socket[_0x54f3('0x74')]('userWhatsappQueue:remove',{'UserId':Number(_0x426618[_0x54f3('0x3b')][_0x54f3('0x69')]),'WhatsappQueueId':Number(_0x426618['params']['id'])});}});}})[_0x54f3('0x2b')](respondWithStatusCode(_0x2d0d41,null))['catch'](handleError(_0x2d0d41,null));};exports[_0x54f3('0x8d')]=function(_0x5e3b5e,_0x55c01a,_0x325c9e){var _0x50024e={};var _0x277b02={};var _0x3e8d69;var _0x1f4726;return db[_0x54f3('0x36')][_0x54f3('0x5b')]({'where':{'id':_0x5e3b5e[_0x54f3('0x58')]['id']}})[_0x54f3('0x2b')](handleEntityNotFound(_0x55c01a,null))['then'](function(_0x1a0ceb){if(_0x1a0ceb){_0x3e8d69=_0x1a0ceb;_0x277b02[_0x54f3('0x3a')]=_[_0x54f3('0x3c')](db['User'][_0x54f3('0x37')]);_0x277b02[_0x54f3('0x3b')]=_['keys'](_0x5e3b5e['query']);_0x277b02[_0x54f3('0x3d')]=_['intersection'](_0x277b02[_0x54f3('0x3a')],_0x277b02[_0x54f3('0x3b')]);_0x50024e['attributes']=_['intersection'](_0x277b02[_0x54f3('0x3a')],qs[_0x54f3('0x3f')](_0x5e3b5e[_0x54f3('0x3b')][_0x54f3('0x3f')]));_0x50024e[_0x54f3('0x40')]=_0x50024e[_0x54f3('0x40')][_0x54f3('0x41')]?_0x50024e['attributes']:_0x277b02[_0x54f3('0x3a')];_0x50024e[_0x54f3('0x44')]=qs[_0x54f3('0x45')](_0x5e3b5e[_0x54f3('0x3b')][_0x54f3('0x45')]);_0x50024e[_0x54f3('0x46')]=qs[_0x54f3('0x3d')](_[_0x54f3('0x5d')](_0x5e3b5e[_0x54f3('0x3b')],_0x277b02['filters']));if(_0x5e3b5e[_0x54f3('0x3b')]['filter']){_0x50024e['where']=_['merge'](_0x50024e[_0x54f3('0x46')],{'$or':_[_0x54f3('0x35')](_0x50024e[_0x54f3('0x40')],function(_0x5c51f5){var _0x5620c1={};_0x5620c1[_0x5c51f5]={'$like':'%'+_0x5e3b5e[_0x54f3('0x3b')][_0x54f3('0x47')]+'%'};return _0x5620c1;})});}_0x50024e=_['merge']({},_0x50024e,_0x5e3b5e['options']);return _0x3e8d69[_0x54f3('0x8d')](_0x50024e);}})['then'](function(_0x4c1c9b){if(_0x4c1c9b){_0x1f4726=_0x4c1c9b['length'];if(!_0x5e3b5e[_0x54f3('0x3b')][_0x54f3('0x42')](_0x54f3('0x43'))){_0x50024e['limit']=qs[_0x54f3('0x22')](_0x5e3b5e[_0x54f3('0x3b')][_0x54f3('0x22')]);_0x50024e[_0x54f3('0x24')]=qs[_0x54f3('0x24')](_0x5e3b5e['query'][_0x54f3('0x24')]);}return _0x3e8d69['getAgents'](_0x50024e);}})['then'](function(_0xbfc63f){if(_0xbfc63f){return _0xbfc63f?{'count':_0x1f4726,'rows':_0xbfc63f}:null;}})[_0x54f3('0x2b')](respondWithResult(_0x55c01a,null))[_0x54f3('0x4e')](handleError(_0x55c01a,null));}; \ No newline at end of file +var _0x3cb7=['isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','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','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','reject','update','destroy','then','WhatsappQueues','UserProfileResource','stack','name','send','index','map','type','key','model','query','keys','attributes','intersection','fields','nolimit','sort','where','filters','pick','filter','merge','WhatsappQueue','includeAll','include','findAll','rows','catch','show','params','length','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','get','UserWhatsappQueue','rawAttributes','hasOwnProperty','order','WhatsappQueueId','User','findAndCountAll','UserId','agent','whatsappPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','findOne','ids','Team','Agents','online','voicePause','interface','sequelize','each','forEach','emit','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','team_has_whatsapp_queues','join','user_has_teams','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','transaction','removeAgents','userWhatsappQueue:remove','addAgents','omit','spread'];(function(_0x5df033,_0x29458b){var _0x445829=function(_0x2c795b){while(--_0x2c795b){_0x5df033['push'](_0x5df033['shift']());}};_0x445829(++_0x29458b);}(_0x3cb7,0x1af));var _0x73cb=function(_0x24693e,_0x2ba888){_0x24693e=_0x24693e-0x0;var _0x53e672=_0x3cb7[_0x24693e];return _0x53e672;};'use strict';var emlformat=require(_0x73cb('0x0'));var rimraf=require(_0x73cb('0x1'));var zipdir=require(_0x73cb('0x2'));var jsonpatch=require(_0x73cb('0x3'));var rp=require('request-promise');var moment=require(_0x73cb('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x73cb('0x5'));var util=require(_0x73cb('0x6'));var path=require(_0x73cb('0x7'));var sox=require('sox');var csv=require(_0x73cb('0x8'));var ejs=require(_0x73cb('0x9'));var fs=require('fs');var fs_extra=require(_0x73cb('0xa'));var _=require(_0x73cb('0xb'));var squel=require('squel');var crypto=require(_0x73cb('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x73cb('0x8'));var querystring=require(_0x73cb('0xd'));var Papa=require('papaparse');var Redis=require(_0x73cb('0xe'));var authService=require(_0x73cb('0xf'));var qs=require(_0x73cb('0x10'));var as=require(_0x73cb('0x11'));var hardwareService=require(_0x73cb('0x12'));var logger=require(_0x73cb('0x13'))(_0x73cb('0x14'));var utils=require(_0x73cb('0x15'));var config=require(_0x73cb('0x16'));var licenseUtil=require(_0x73cb('0x17'));var db=require(_0x73cb('0x18'))['db'];config[_0x73cb('0x19')]=_[_0x73cb('0x1a')](config['redis'],{'host':_0x73cb('0x1b'),'port':0x18eb});var socket=require(_0x73cb('0x1c'))(new Redis(config['redis']));require(_0x73cb('0x1d'))['register'](socket);function respondWithStatusCode(_0x4162ca,_0x33bba9){_0x33bba9=_0x33bba9||0xcc;return function(_0x58cadd){if(_0x58cadd){return _0x4162ca[_0x73cb('0x1e')](_0x33bba9);}return _0x4162ca[_0x73cb('0x1f')](_0x33bba9)[_0x73cb('0x20')]();};}function respondWithResult(_0xdeaa42,_0x432d98){_0x432d98=_0x432d98||0xc8;return function(_0x58a871){if(_0x58a871){return _0xdeaa42[_0x73cb('0x1f')](_0x432d98)['json'](_0x58a871);}};}function respondWithFilteredResult(_0x4e54be,_0x24ea91){return function(_0x4d1796){if(_0x4d1796){var _0x1470f3=typeof _0x24ea91[_0x73cb('0x21')]==='undefined'&&typeof _0x24ea91['limit']===_0x73cb('0x22');var _0x21f85c=_0x4d1796[_0x73cb('0x23')];var _0x42b508=_0x1470f3?0x0:_0x24ea91[_0x73cb('0x21')];var _0x4c6f7f=_0x1470f3?_0x4d1796[_0x73cb('0x23')]:_0x24ea91['offset']+_0x24ea91[_0x73cb('0x24')];var _0x1d72ce;if(_0x4c6f7f>=_0x21f85c){_0x4c6f7f=_0x21f85c;_0x1d72ce=0xc8;}else{_0x1d72ce=0xce;}_0x4e54be[_0x73cb('0x1f')](_0x1d72ce);return _0x4e54be[_0x73cb('0x25')](_0x73cb('0x26'),_0x42b508+'-'+_0x4c6f7f+'/'+_0x21f85c)['json'](_0x4d1796);}return null;};}function patchUpdates(_0x1c31af){return function(_0x23eab7){try{jsonpatch['apply'](_0x23eab7,_0x1c31af,!![]);}catch(_0x29bd05){return BPromise[_0x73cb('0x27')](_0x29bd05);}return _0x23eab7['save']();};}function saveUpdates(_0x27d127,_0xe174c2){return function(_0x4537a4){if(_0x4537a4){return _0x4537a4[_0x73cb('0x28')](_0x27d127)['then'](function(_0x50cf73){return _0x50cf73;});}return null;};}function removeEntity(_0x4a42f8,_0xa7ff3c){return function(_0x421f29){if(_0x421f29){return _0x421f29[_0x73cb('0x29')]()[_0x73cb('0x2a')](function(){var _0x297c54=_0x421f29['get']({'plain':!![]});var _0x48dab1=_0x73cb('0x2b');return db[_0x73cb('0x2c')]['destroy']({'where':{'type':_0x48dab1,'resourceId':_0x297c54['id']}})['then'](function(){return _0x421f29;});})['then'](function(){_0x4a42f8['status'](0xcc)[_0x73cb('0x20')]();});}};}function handleEntityNotFound(_0x5755b0,_0x5f212b){return function(_0xa87b8f){if(!_0xa87b8f){_0x5755b0[_0x73cb('0x1e')](0x194);}return _0xa87b8f;};}function handleError(_0x46061a,_0x2b459d){_0x2b459d=_0x2b459d||0x1f4;return function(_0x212b32){logger['error'](_0x212b32[_0x73cb('0x2d')]);if(_0x212b32[_0x73cb('0x2e')]){delete _0x212b32[_0x73cb('0x2e')];}_0x46061a[_0x73cb('0x1f')](_0x2b459d)[_0x73cb('0x2f')](_0x212b32);};}exports[_0x73cb('0x30')]=function(_0x1943f8,_0x4f73ca){var _0x1a6825={},_0x3667fa={},_0x53a020={'count':0x0,'rows':[]};var _0x368ed4=_[_0x73cb('0x31')](db['WhatsappQueue']['rawAttributes'],function(_0x20f1ea){return{'name':_0x20f1ea['fieldName'],'type':_0x20f1ea[_0x73cb('0x32')][_0x73cb('0x33')]};});_0x3667fa[_0x73cb('0x34')]=_['map'](_0x368ed4,'name');_0x3667fa[_0x73cb('0x35')]=_[_0x73cb('0x36')](_0x1943f8[_0x73cb('0x35')]);_0x3667fa['filters']=_['intersection'](_0x3667fa[_0x73cb('0x34')],_0x3667fa['query']);_0x1a6825[_0x73cb('0x37')]=_[_0x73cb('0x38')](_0x3667fa['model'],qs[_0x73cb('0x39')](_0x1943f8[_0x73cb('0x35')][_0x73cb('0x39')]));_0x1a6825[_0x73cb('0x37')]=_0x1a6825['attributes']['length']?_0x1a6825[_0x73cb('0x37')]:_0x3667fa['model'];if(!_0x1943f8[_0x73cb('0x35')]['hasOwnProperty'](_0x73cb('0x3a'))){_0x1a6825[_0x73cb('0x24')]=qs[_0x73cb('0x24')](_0x1943f8[_0x73cb('0x35')]['limit']);_0x1a6825['offset']=qs[_0x73cb('0x21')](_0x1943f8[_0x73cb('0x35')]['offset']);}_0x1a6825['order']=qs[_0x73cb('0x3b')](_0x1943f8[_0x73cb('0x35')]['sort']);_0x1a6825[_0x73cb('0x3c')]=qs[_0x73cb('0x3d')](_[_0x73cb('0x3e')](_0x1943f8[_0x73cb('0x35')],_0x3667fa[_0x73cb('0x3d')]),_0x368ed4);if(_0x1943f8[_0x73cb('0x35')][_0x73cb('0x3f')]){_0x1a6825['where']=_[_0x73cb('0x40')](_0x1a6825[_0x73cb('0x3c')],{'$or':_['map'](_0x368ed4,function(_0x1d3d90){if(_0x1d3d90[_0x73cb('0x32')]!=='VIRTUAL'){var _0x5dc684={};_0x5dc684[_0x1d3d90['name']]={'$like':'%'+_0x1943f8['query'][_0x73cb('0x3f')]+'%'};return _0x5dc684;}})});}_0x1a6825=_[_0x73cb('0x40')]({},_0x1a6825,_0x1943f8['options']);var _0x37cb8d={'where':_0x1a6825['where']};return db[_0x73cb('0x41')][_0x73cb('0x23')](_0x37cb8d)['then'](function(_0x37ee82){_0x53a020[_0x73cb('0x23')]=_0x37ee82;if(_0x1943f8[_0x73cb('0x35')][_0x73cb('0x42')]){_0x1a6825[_0x73cb('0x43')]=[{'all':!![]}];}return db[_0x73cb('0x41')][_0x73cb('0x44')](_0x1a6825);})[_0x73cb('0x2a')](function(_0x97188a){_0x53a020[_0x73cb('0x45')]=_0x97188a;return _0x53a020;})[_0x73cb('0x2a')](respondWithFilteredResult(_0x4f73ca,_0x1a6825))[_0x73cb('0x46')](handleError(_0x4f73ca,null));};exports[_0x73cb('0x47')]=function(_0x57677a,_0x161466){var _0x36e42e={'raw':!![],'where':{'id':_0x57677a[_0x73cb('0x48')]['id']}},_0x18dd2b={};_0x18dd2b['model']=_[_0x73cb('0x36')](db[_0x73cb('0x41')]['rawAttributes']);_0x18dd2b[_0x73cb('0x35')]=_['keys'](_0x57677a['query']);_0x18dd2b[_0x73cb('0x3d')]=_[_0x73cb('0x38')](_0x18dd2b[_0x73cb('0x34')],_0x18dd2b['query']);_0x36e42e[_0x73cb('0x37')]=_[_0x73cb('0x38')](_0x18dd2b['model'],qs[_0x73cb('0x39')](_0x57677a[_0x73cb('0x35')][_0x73cb('0x39')]));_0x36e42e[_0x73cb('0x37')]=_0x36e42e[_0x73cb('0x37')][_0x73cb('0x49')]?_0x36e42e[_0x73cb('0x37')]:_0x18dd2b[_0x73cb('0x34')];if(_0x57677a[_0x73cb('0x35')]['includeAll']){_0x36e42e[_0x73cb('0x43')]=[{'all':!![]}];}_0x36e42e=_['merge']({},_0x36e42e,_0x57677a[_0x73cb('0x4a')]);return db['WhatsappQueue']['find'](_0x36e42e)[_0x73cb('0x2a')](handleEntityNotFound(_0x161466,null))[_0x73cb('0x2a')](respondWithResult(_0x161466,null))[_0x73cb('0x46')](handleError(_0x161466,null));};exports[_0x73cb('0x4b')]=function(_0x3f9b59,_0xc59f35){return db[_0x73cb('0x41')][_0x73cb('0x4b')](_0x3f9b59[_0x73cb('0x4c')],{})[_0x73cb('0x2a')](function(_0x452769){var _0x36191c=_0x3f9b59[_0x73cb('0x4d')]['get']({'plain':!![]});if(!_0x36191c)throw new Error(_0x73cb('0x4e'));if(_0x36191c[_0x73cb('0x4f')]==='user'){var _0x3b9adf=_0x452769['get']({'plain':!![]});var _0x2d06d4=_0x73cb('0x2b');return db[_0x73cb('0x50')][_0x73cb('0x51')]({'where':{'name':_0x2d06d4,'userProfileId':_0x36191c['userProfileId']},'raw':!![]})['then'](function(_0x5c47ba){if(_0x5c47ba&&_0x5c47ba[_0x73cb('0x52')]===0x0){return db['UserProfileResource'][_0x73cb('0x4b')]({'name':_0x3b9adf[_0x73cb('0x2e')],'resourceId':_0x3b9adf['id'],'type':_0x5c47ba[_0x73cb('0x2e')],'sectionId':_0x5c47ba['id']},{})[_0x73cb('0x2a')](function(){return _0x452769;});}else{return _0x452769;}})[_0x73cb('0x46')](function(_0x4ff208){logger['error'](_0x73cb('0x53'),_0x4ff208);throw _0x4ff208;});}return _0x452769;})[_0x73cb('0x2a')](respondWithResult(_0xc59f35,0xc9))[_0x73cb('0x46')](handleError(_0xc59f35,null));};exports[_0x73cb('0x28')]=function(_0x3e6814,_0x2b957e){if(_0x3e6814['body']['id']){delete _0x3e6814[_0x73cb('0x4c')]['id'];}return db[_0x73cb('0x41')][_0x73cb('0x51')]({'where':{'id':_0x3e6814[_0x73cb('0x48')]['id']}})[_0x73cb('0x2a')](handleEntityNotFound(_0x2b957e,null))[_0x73cb('0x2a')](saveUpdates(_0x3e6814[_0x73cb('0x4c')],null))['then'](respondWithResult(_0x2b957e,null))['catch'](handleError(_0x2b957e,null));};exports[_0x73cb('0x29')]=function(_0x287621,_0x513254){return db[_0x73cb('0x41')][_0x73cb('0x51')]({'where':{'id':_0x287621[_0x73cb('0x48')]['id']}})[_0x73cb('0x2a')](handleEntityNotFound(_0x513254,null))['then'](removeEntity(_0x513254,null))['catch'](handleError(_0x513254,null));};exports[_0x73cb('0x54')]=function(_0xfa7a23,_0x18a4ee){return db[_0x73cb('0x41')]['describe']()['then'](respondWithResult(_0x18a4ee,null))[_0x73cb('0x46')](handleError(_0x18a4ee,null));};exports[_0x73cb('0x55')]=function(_0x3676a0,_0x58be25,_0x3d191d){var _0x4f1828={'raw':!![],'where':{}},_0x525332={},_0x5a9028;return db[_0x73cb('0x41')]['findOne']({'where':{'id':_0x3676a0[_0x73cb('0x48')]['id']}})[_0x73cb('0x2a')](handleEntityNotFound(_0x58be25,null))['then'](function(_0x30f888){if(_0x30f888){_0x5a9028=_0x30f888[_0x73cb('0x56')]({'plain':!![]});_0x525332[_0x73cb('0x34')]=_['keys'](db[_0x73cb('0x57')][_0x73cb('0x58')]);_0x525332[_0x73cb('0x35')]=_[_0x73cb('0x36')](_0x3676a0['query']);_0x525332[_0x73cb('0x3d')]=_[_0x73cb('0x38')](_0x525332[_0x73cb('0x34')],_0x525332['query']);_0x4f1828[_0x73cb('0x37')]=_[_0x73cb('0x38')](_0x525332[_0x73cb('0x34')],qs['fields'](_0x3676a0[_0x73cb('0x35')]['fields']));_0x4f1828[_0x73cb('0x37')]=_0x4f1828[_0x73cb('0x37')][_0x73cb('0x49')]?_0x4f1828[_0x73cb('0x37')]:_0x525332['model'];if(!_0x3676a0['query'][_0x73cb('0x59')](_0x73cb('0x3a'))){_0x4f1828[_0x73cb('0x24')]=qs[_0x73cb('0x24')](_0x3676a0['query']['limit']);_0x4f1828[_0x73cb('0x21')]=qs[_0x73cb('0x21')](_0x3676a0[_0x73cb('0x35')]['offset']);}_0x4f1828[_0x73cb('0x5a')]=qs[_0x73cb('0x3b')](_0x3676a0[_0x73cb('0x35')][_0x73cb('0x3b')]);_0x4f1828[_0x73cb('0x3c')]=qs['filters'](_[_0x73cb('0x3e')](_0x3676a0[_0x73cb('0x35')],_0x525332[_0x73cb('0x3d')]));_0x4f1828[_0x73cb('0x3c')][_0x73cb('0x5b')]=_0x30f888['id'];if(_0x3676a0['query'][_0x73cb('0x3f')]){_0x4f1828[_0x73cb('0x3c')]=_['merge'](_0x4f1828['where'],{'$or':_[_0x73cb('0x31')](_0x4f1828[_0x73cb('0x37')],function(_0x58527d){var _0x205e96={};_0x205e96[_0x58527d]={'$like':'%'+_0x3676a0[_0x73cb('0x35')][_0x73cb('0x3f')]+'%'};return _0x205e96;})});}_0x4f1828=_[_0x73cb('0x40')]({},_0x4f1828,_0x3676a0[_0x73cb('0x4a')]);return db[_0x73cb('0x57')][_0x73cb('0x44')](_0x4f1828);}})[_0x73cb('0x2a')](function(_0xd7b042){if(_0xd7b042){return db[_0x73cb('0x5c')][_0x73cb('0x5d')]({'where':{'id':_[_0x73cb('0x31')](_0xd7b042,_0x73cb('0x5e')),'role':_0x73cb('0x5f')},'attributes':['id',_0x73cb('0x2e'),_0x73cb('0x60'),_0x73cb('0x61'),_0x73cb('0x62')]});}})[_0x73cb('0x2a')](function(_0x37ff6e){if(_0x37ff6e){return{'count':_0x37ff6e[_0x73cb('0x23')],'rows':_[_0x73cb('0x31')](_0x37ff6e[_0x73cb('0x45')],function(_0x24a5fd){return{'membername':_0x24a5fd[_0x73cb('0x2e')],'UserId':_0x24a5fd['id'],'queue_name':_0x5a9028['name'],'WhatsappQueueId':_0x5a9028['id'],'interface':util[_0x73cb('0x63')](_0x73cb('0x64'),_0x73cb('0x65'),_0x24a5fd[_0x73cb('0x2e')]),'penalty':0x0,'paused':_0x24a5fd['whatsappPause'],'createdAt':_0x24a5fd['createdAt'],'updatedAt':_0x24a5fd[_0x73cb('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x58be25,_0x4f1828))['catch'](handleError(_0x58be25,null));};exports[_0x73cb('0x66')]=function(_0x4ed871,_0x1f9530,_0x2c4d8e){var _0x1a89bd={};var _0x2f6912={};var _0x375cae;var _0x1c1ff0;return db[_0x73cb('0x41')][_0x73cb('0x67')]({'where':{'id':_0x4ed871[_0x73cb('0x48')]['id']}})['then'](handleEntityNotFound(_0x1f9530,null))[_0x73cb('0x2a')](function(_0x4cc590){if(_0x4cc590){_0x375cae=_0x4cc590;_0x2f6912[_0x73cb('0x34')]=_['keys'](db['Team'][_0x73cb('0x58')]);_0x2f6912[_0x73cb('0x35')]=_['keys'](_0x4ed871[_0x73cb('0x35')]);_0x2f6912[_0x73cb('0x3d')]=_[_0x73cb('0x38')](_0x2f6912[_0x73cb('0x34')],_0x2f6912['query']);_0x1a89bd[_0x73cb('0x37')]=_[_0x73cb('0x38')](_0x2f6912[_0x73cb('0x34')],qs[_0x73cb('0x39')](_0x4ed871[_0x73cb('0x35')][_0x73cb('0x39')]));_0x1a89bd[_0x73cb('0x37')]=_0x1a89bd['attributes'][_0x73cb('0x49')]?_0x1a89bd[_0x73cb('0x37')]:_0x2f6912[_0x73cb('0x34')];_0x1a89bd[_0x73cb('0x5a')]=qs['sort'](_0x4ed871[_0x73cb('0x35')]['sort']);_0x1a89bd['where']=qs[_0x73cb('0x3d')](_['pick'](_0x4ed871[_0x73cb('0x35')],_0x2f6912[_0x73cb('0x3d')]));if(_0x4ed871[_0x73cb('0x35')][_0x73cb('0x3f')]){_0x1a89bd['where']=_[_0x73cb('0x40')](_0x1a89bd[_0x73cb('0x3c')],{'$or':_[_0x73cb('0x31')](_0x1a89bd[_0x73cb('0x37')],function(_0x49e279){var _0x126810={};_0x126810[_0x49e279]={'$like':'%'+_0x4ed871[_0x73cb('0x35')]['filter']+'%'};return _0x126810;})});}_0x1a89bd=_[_0x73cb('0x40')]({},_0x1a89bd,_0x4ed871['options']);return _0x375cae[_0x73cb('0x66')](_0x1a89bd);}})['then'](function(_0x5d6cc6){if(_0x5d6cc6){_0x1c1ff0=_0x5d6cc6[_0x73cb('0x49')];if(!_0x4ed871[_0x73cb('0x35')]['hasOwnProperty'](_0x73cb('0x3a'))){_0x1a89bd['limit']=qs[_0x73cb('0x24')](_0x4ed871[_0x73cb('0x35')][_0x73cb('0x24')]);_0x1a89bd[_0x73cb('0x21')]=qs[_0x73cb('0x21')](_0x4ed871[_0x73cb('0x35')][_0x73cb('0x21')]);}return _0x375cae[_0x73cb('0x66')](_0x1a89bd);}})['then'](function(_0x1666b1){if(_0x1666b1){return _0x1666b1?{'count':_0x1c1ff0,'rows':_0x1666b1}:null;}})[_0x73cb('0x2a')](respondWithResult(_0x1f9530,null))[_0x73cb('0x46')](handleError(_0x1f9530,null));};exports['addTeams']=function(_0xfadd53,_0x4ff6c4,_0x2bedd5){var _0xbe167f=_0xfadd53[_0x73cb('0x4c')][_0x73cb('0x68')];return db[_0x73cb('0x69')]['findAll']({'where':{'id':_0xbe167f},'attributes':['id'],'include':[{'model':db[_0x73cb('0x5c')],'as':_0x73cb('0x6a'),'attributes':['id',_0x73cb('0x2e'),_0x73cb('0x6b'),_0x73cb('0x6c'),_0x73cb('0x6d')],'raw':!![]}]})['then'](function(_0x1a4017){if(_0x1a4017){var _0x3e00e8=_['flatMap'](_0x1a4017,function(_0x428e23){var _0x1057fa=_0x428e23['get']({'plain':!![]});return _0x1057fa[_0x73cb('0x6a')];});return db[_0x73cb('0x41')]['find']({'where':{'id':_0xfadd53[_0x73cb('0x48')]['id']}})[_0x73cb('0x2a')](function(_0x1796da){return db[_0x73cb('0x6e')]['transaction'](function(_0x1087a3){return _0x1796da['addTeams'](_0xbe167f,{'transaction':_0x1087a3})['then'](function(){return BPromise[_0x73cb('0x6f')](_0x3e00e8,function(_0x3fd8e8){return db[_0x73cb('0x57')]['findOrCreate']({'where':{'UserId':_0x3fd8e8['id'],'WhatsappQueueId':_0xfadd53[_0x73cb('0x48')]['id']},'transaction':_0x1087a3});});})[_0x73cb('0x2a')](function(){_0x3e00e8[_0x73cb('0x70')](function(_0x30f051){socket[_0x73cb('0x71')](_0x73cb('0x72'),{'UserId':_0x30f051['id'],'WhatsappQueueId':_0x1796da['id']});});});});});}})['then'](respondWithStatusCode(_0x4ff6c4,null))[_0x73cb('0x46')](handleError(_0x4ff6c4,null));};exports[_0x73cb('0x73')]=function(_0x202d8c,_0x57be64,_0x59674e){return db[_0x73cb('0x69')]['findAll']({'where':{'id':_0x202d8c[_0x73cb('0x35')][_0x73cb('0x68')]},'attributes':['id'],'include':[{'model':db[_0x73cb('0x5c')],'as':_0x73cb('0x6a'),'attributes':['id'],'raw':!![]}]})[_0x73cb('0x2a')](handleEntityNotFound(_0x57be64,null))[_0x73cb('0x2a')](function(_0x423287){var _0x34d410=_[_0x73cb('0x31')](_0x423287,'id');var _0x275e7d=[];var _0x353db9=[];var _0x2249b2=squel[_0x73cb('0x74')]();_0x2249b2[_0x73cb('0x75')](_0x73cb('0x76'))['from'](_0x73cb('0x77'),'tq')[_0x73cb('0x78')](_0x73cb('0x79'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x73cb('0x3c')](_0x73cb('0x7a'),_0x202d8c[_0x73cb('0x48')]['id']);for(var _0x1515e6=0x0;_0x1515e6<_0x423287['length'];_0x1515e6+=0x1){let _0x272a2a=_0x423287[_0x1515e6];for(var _0x3fbb53=0x0;_0x3fbb53<_0x272a2a[_0x73cb('0x6a')][_0x73cb('0x49')];_0x3fbb53+=0x1){let _0x52e2e2=_0x272a2a[_0x73cb('0x6a')][_0x3fbb53];var _0xe1e3a=_0x2249b2[_0x73cb('0x7b')]();_0xe1e3a[_0x73cb('0x3c')](_0x73cb('0x7c'),_0x52e2e2['id']);_0x353db9[_0x73cb('0x7d')](db[_0x73cb('0x6e')][_0x73cb('0x35')](_0xe1e3a['toString'](),{'type':db[_0x73cb('0x6e')][_0x73cb('0x7e')][_0x73cb('0x7f')]})[_0x73cb('0x2a')](function(_0x3f1965){if(_0x3f1965[_0x73cb('0x49')]===0x1){return _0x52e2e2['id'];}else{var _0xa661a9=_[_0x73cb('0x80')](_[_0x73cb('0x31')](_0x3f1965,_0x73cb('0x81')),function(_0x11bfb2){return _[_0x73cb('0x82')](_0x34d410,_0x11bfb2);});if(_0xa661a9){return _0x52e2e2['id'];}}}));}}return BPromise[_0x73cb('0x83')](_0x353db9)[_0x73cb('0x2a')](function(_0x346c9e){_0x275e7d=_(_0x275e7d)[_0x73cb('0x84')](_0x346c9e)[_0x73cb('0x85')]()[_0x73cb('0x86')]();return db[_0x73cb('0x41')][_0x73cb('0x51')]({'where':{'id':_0x202d8c['params']['id']}})[_0x73cb('0x2a')](function(_0x1ce5ec){return db[_0x73cb('0x6e')][_0x73cb('0x87')](function(_0x103b94){return _0x1ce5ec[_0x73cb('0x73')](_0x202d8c[_0x73cb('0x35')]['ids'],{'transaction':_0x103b94})[_0x73cb('0x2a')](function(){if(!_['isEmpty'](_0x275e7d)){return _0x1ce5ec[_0x73cb('0x88')](_0x275e7d,{'transaction':_0x103b94});}})['then'](function(){_0x275e7d[_0x73cb('0x70')](function(_0x54dd0e){socket[_0x73cb('0x71')](_0x73cb('0x89'),{'UserId':_0x54dd0e,'WhatsappQueueId':_0x1ce5ec['id']});});});});});});})[_0x73cb('0x2a')](respondWithStatusCode(_0x57be64,null))[_0x73cb('0x46')](handleError(_0x57be64,null));};exports[_0x73cb('0x8a')]=function(_0x39d31d,_0x2379e9,_0x33613f){return db[_0x73cb('0x41')]['find']({'where':{'id':_0x39d31d[_0x73cb('0x48')]['id']}})[_0x73cb('0x2a')](handleEntityNotFound(_0x2379e9,null))[_0x73cb('0x2a')](function(_0x41003b){if(_0x41003b){return _0x41003b[_0x73cb('0x8a')](_0x39d31d[_0x73cb('0x4c')][_0x73cb('0x68')],_[_0x73cb('0x8b')](_0x39d31d[_0x73cb('0x4c')],[_0x73cb('0x68'),'id'])||{})[_0x73cb('0x8c')](function(_0x46c0a6){for(var _0x516ef5=0x0;_0x516ef5<_0x39d31d['body'][_0x73cb('0x68')][_0x73cb('0x49')];_0x516ef5+=0x1){socket[_0x73cb('0x71')](_0x73cb('0x72'),{'UserId':Number(_0x39d31d[_0x73cb('0x4c')]['ids'][_0x516ef5]),'WhatsappQueueId':Number(_0x39d31d[_0x73cb('0x48')]['id'])});}return _0x46c0a6;});}})['then'](respondWithResult(_0x2379e9,null))[_0x73cb('0x46')](handleError(_0x2379e9,null));};exports[_0x73cb('0x88')]=function(_0x258e99,_0x5e6764,_0x1b9470){return db[_0x73cb('0x41')][_0x73cb('0x51')]({'where':{'id':_0x258e99[_0x73cb('0x48')]['id']}})[_0x73cb('0x2a')](handleEntityNotFound(_0x5e6764,null))[_0x73cb('0x2a')](function(_0x563f08){if(_0x563f08){return _0x563f08[_0x73cb('0x88')](_0x258e99['query'][_0x73cb('0x68')])[_0x73cb('0x2a')](function(){if(_[_0x73cb('0x8d')](_0x258e99[_0x73cb('0x35')][_0x73cb('0x68')])){for(var _0x31740a=0x0;_0x31740a<_0x258e99[_0x73cb('0x35')]['ids'][_0x73cb('0x49')];_0x31740a+=0x1){socket['emit']('userWhatsappQueue:remove',{'UserId':Number(_0x258e99[_0x73cb('0x35')][_0x73cb('0x68')][_0x31740a]),'WhatsappQueueId':Number(_0x258e99['params']['id'])});}}else{socket[_0x73cb('0x71')](_0x73cb('0x89'),{'UserId':Number(_0x258e99['query']['ids']),'WhatsappQueueId':Number(_0x258e99[_0x73cb('0x48')]['id'])});}});}})[_0x73cb('0x2a')](respondWithStatusCode(_0x5e6764,null))[_0x73cb('0x46')](handleError(_0x5e6764,null));};exports[_0x73cb('0x8e')]=function(_0x3aeeae,_0x36a924,_0x26c216){var _0xc63a0f={};var _0x4ea4eb={};var _0x19d7b3;var _0x350ab9;return db[_0x73cb('0x41')][_0x73cb('0x67')]({'where':{'id':_0x3aeeae[_0x73cb('0x48')]['id']}})[_0x73cb('0x2a')](handleEntityNotFound(_0x36a924,null))[_0x73cb('0x2a')](function(_0x1ae43e){if(_0x1ae43e){_0x19d7b3=_0x1ae43e;_0x4ea4eb[_0x73cb('0x34')]=_[_0x73cb('0x36')](db[_0x73cb('0x5c')][_0x73cb('0x58')]);_0x4ea4eb[_0x73cb('0x35')]=_[_0x73cb('0x36')](_0x3aeeae[_0x73cb('0x35')]);_0x4ea4eb[_0x73cb('0x3d')]=_[_0x73cb('0x38')](_0x4ea4eb['model'],_0x4ea4eb[_0x73cb('0x35')]);_0xc63a0f[_0x73cb('0x37')]=_[_0x73cb('0x38')](_0x4ea4eb[_0x73cb('0x34')],qs[_0x73cb('0x39')](_0x3aeeae['query'][_0x73cb('0x39')]));_0xc63a0f[_0x73cb('0x37')]=_0xc63a0f[_0x73cb('0x37')][_0x73cb('0x49')]?_0xc63a0f[_0x73cb('0x37')]:_0x4ea4eb[_0x73cb('0x34')];_0xc63a0f[_0x73cb('0x5a')]=qs[_0x73cb('0x3b')](_0x3aeeae[_0x73cb('0x35')][_0x73cb('0x3b')]);_0xc63a0f[_0x73cb('0x3c')]=qs[_0x73cb('0x3d')](_[_0x73cb('0x3e')](_0x3aeeae[_0x73cb('0x35')],_0x4ea4eb[_0x73cb('0x3d')]));if(_0x3aeeae[_0x73cb('0x35')]['filter']){_0xc63a0f[_0x73cb('0x3c')]=_[_0x73cb('0x40')](_0xc63a0f[_0x73cb('0x3c')],{'$or':_['map'](_0xc63a0f[_0x73cb('0x37')],function(_0x3a31ee){var _0x4df591={};_0x4df591[_0x3a31ee]={'$like':'%'+_0x3aeeae['query'][_0x73cb('0x3f')]+'%'};return _0x4df591;})});}_0xc63a0f=_[_0x73cb('0x40')]({},_0xc63a0f,_0x3aeeae['options']);return _0x19d7b3[_0x73cb('0x8e')](_0xc63a0f);}})['then'](function(_0x57c885){if(_0x57c885){_0x350ab9=_0x57c885['length'];if(!_0x3aeeae[_0x73cb('0x35')][_0x73cb('0x59')](_0x73cb('0x3a'))){_0xc63a0f[_0x73cb('0x24')]=qs[_0x73cb('0x24')](_0x3aeeae[_0x73cb('0x35')][_0x73cb('0x24')]);_0xc63a0f[_0x73cb('0x21')]=qs[_0x73cb('0x21')](_0x3aeeae[_0x73cb('0x35')][_0x73cb('0x21')]);}return _0x19d7b3[_0x73cb('0x8e')](_0xc63a0f);}})[_0x73cb('0x2a')](function(_0x54fc5f){if(_0x54fc5f){return _0x54fc5f?{'count':_0x350ab9,'rows':_0x54fc5f}:null;}})[_0x73cb('0x2a')](respondWithResult(_0x36a924,null))[_0x73cb('0x46')](handleError(_0x36a924,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 17e2548..08ae3f3 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 _0x4c74=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappQueue','setMaxListeners','save','update','remove'];(function(_0x3008ba,_0x31eb74){var _0x213537=function(_0x1210c1){while(--_0x1210c1){_0x3008ba['push'](_0x3008ba['shift']());}};_0x213537(++_0x31eb74);}(_0x4c74,0xa9));var _0x44c7=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x4c74[_0x40a045];return _0x1a687c;};'use strict';var EventEmitter=require(_0x44c7('0x0'));var WhatsappQueue=require(_0x44c7('0x1'))['db'][_0x44c7('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x44c7('0x3')](0x0);var events={'afterCreate':_0x44c7('0x4'),'afterUpdate':_0x44c7('0x5'),'afterDestroy':_0x44c7('0x6')};function emitEvent(_0x519711){return function(_0x444f85,_0x2d0a6d,_0x189663){WhatsappQueueEvents[_0x44c7('0x7')](_0x519711+':'+_0x444f85['id'],_0x444f85);WhatsappQueueEvents[_0x44c7('0x7')](_0x519711,_0x444f85);_0x189663(null);};}for(var e in events){if(events[_0x44c7('0x8')](e)){var event=events[e];WhatsappQueue[_0x44c7('0x9')](e,emitEvent(event));}}module[_0x44c7('0xa')]=WhatsappQueueEvents; \ No newline at end of file +var _0xbd18=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','WhatsappQueue','setMaxListeners','save','update'];(function(_0x280212,_0x16a957){var _0xd39f9e=function(_0x42f234){while(--_0x42f234){_0x280212['push'](_0x280212['shift']());}};_0xd39f9e(++_0x16a957);}(_0xbd18,0x11d));var _0x8bd1=function(_0x224786,_0x4fc240){_0x224786=_0x224786-0x0;var _0x3e348c=_0xbd18[_0x224786];return _0x3e348c;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0x8bd1('0x0'))['db'][_0x8bd1('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x8bd1('0x2')](0x0);var events={'afterCreate':_0x8bd1('0x3'),'afterUpdate':_0x8bd1('0x4'),'afterDestroy':_0x8bd1('0x5')};function emitEvent(_0x4f21c2){return function(_0x245527,_0x164114,_0x4d3688){WhatsappQueueEvents[_0x8bd1('0x6')](_0x4f21c2+':'+_0x245527['id'],_0x245527);WhatsappQueueEvents[_0x8bd1('0x6')](_0x4f21c2,_0x245527);_0x4d3688(null);};}for(var e in events){if(events[_0x8bd1('0x7')](e)){var event=events[e];WhatsappQueue[_0x8bd1('0x8')](e,emitEvent(event));}}module[_0x8bd1('0x9')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index c65bdd8..07f10a0 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 _0x3604=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueue.attributes','define','WhatsappQueue','whatsapp_queues'];(function(_0x4e18a,_0x2d220a){var _0x56cc08=function(_0x1a5e7e){while(--_0x1a5e7e){_0x4e18a['push'](_0x4e18a['shift']());}};_0x56cc08(++_0x2d220a);}(_0x3604,0x70));var _0x4360=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x3604[_0x543084];return _0x306a57;};'use strict';var _=require(_0x4360('0x0'));var util=require(_0x4360('0x1'));var logger=require(_0x4360('0x2'))(_0x4360('0x3'));var moment=require(_0x4360('0x4'));var BPromise=require(_0x4360('0x5'));var rp=require(_0x4360('0x6'));var fs=require('fs');var path=require(_0x4360('0x7'));var rimraf=require(_0x4360('0x8'));var config=require(_0x4360('0x9'));var attributes=require(_0x4360('0xa'));module['exports']=function(_0x1a2fe5,_0x2fa08d){return _0x1a2fe5[_0x4360('0xb')](_0x4360('0xc'),attributes,{'tableName':_0x4360('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2c8c=['exports','define','WhatsappQueue','whatsapp_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueue.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2c8c,0x15d));var _0xc2c8=function(_0x188393,_0x5ab950){_0x188393=_0x188393-0x0;var _0x74083b=_0x2c8c[_0x188393];return _0x74083b;};'use strict';var _=require(_0xc2c8('0x0'));var util=require(_0xc2c8('0x1'));var logger=require(_0xc2c8('0x2'))(_0xc2c8('0x3'));var moment=require(_0xc2c8('0x4'));var BPromise=require(_0xc2c8('0x5'));var rp=require(_0xc2c8('0x6'));var fs=require('fs');var path=require(_0xc2c8('0x7'));var rimraf=require(_0xc2c8('0x8'));var config=require(_0xc2c8('0x9'));var attributes=require(_0xc2c8('0xa'));module[_0xc2c8('0xb')]=function(_0x51118e,_0x258faa){return _0x51118e[_0xc2c8('0xc')](_0xc2c8('0xd'),attributes,{'tableName':_0xc2c8('0xe'),'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 215a887..43b4f6f 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 _0x9186=['model','attributes','ShowWhatsappQueue','find','then','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','register','request','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where','limit','include','map'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9186,0x1c8));var _0x6918=function(_0x1d426f,_0x37e919){_0x1d426f=_0x1d426f-0x0;var _0x17f71a=_0x9186[_0x1d426f];return _0x17f71a;};'use strict';var _=require(_0x6918('0x0'));var util=require(_0x6918('0x1'));var moment=require(_0x6918('0x2'));var BPromise=require('bluebird');var rs=require(_0x6918('0x3'));var fs=require('fs');var Redis=require(_0x6918('0x4'));var db=require(_0x6918('0x5'))['db'];var utils=require(_0x6918('0x6'));var logger=require(_0x6918('0x7'))(_0x6918('0x8'));var config=require(_0x6918('0x9'));var jayson=require(_0x6918('0xa'));var client=jayson[_0x6918('0xb')][_0x6918('0xc')]({'port':0x232a});config[_0x6918('0xd')]=_['defaults'](config['redis'],{'host':_0x6918('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6918('0xd')]));require('./whatsappQueue.socket')[_0x6918('0xf')](socket);function respondWithRpcPromise(_0x144eb0,_0x2d7be4,_0xf020f1){return new BPromise(function(_0x3e9423,_0x5acf41){return client[_0x6918('0x10')](_0x144eb0,_0xf020f1)['then'](function(_0x21a7e5){logger[_0x6918('0x11')](_0x6918('0x12'),_0x2d7be4,_0x6918('0x13'));logger[_0x6918('0x14')]('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x2d7be4,'request\x20sent',JSON[_0x6918('0x15')](_0x21a7e5));if(_0x21a7e5['error']){if(_0x21a7e5[_0x6918('0x16')][_0x6918('0x17')]===0x1f4){logger[_0x6918('0x16')](_0x6918('0x12'),_0x2d7be4,_0x21a7e5['error'][_0x6918('0x18')]);return _0x5acf41(_0x21a7e5[_0x6918('0x16')]['message']);}logger[_0x6918('0x16')](_0x6918('0x12'),_0x2d7be4,_0x21a7e5[_0x6918('0x16')]['message']);return _0x3e9423(_0x21a7e5['error']['message']);}else{logger[_0x6918('0x11')](_0x6918('0x12'),_0x2d7be4,'request\x20sent');_0x3e9423(_0x21a7e5[_0x6918('0x19')][_0x6918('0x18')]);}})[_0x6918('0x1a')](function(_0x105d5d){logger['error'](_0x6918('0x12'),_0x2d7be4,_0x105d5d);_0x5acf41(_0x105d5d);});});}exports[_0x6918('0x1b')]=function(_0x38ba89){var _0x3df535=this;return new Promise(function(_0x46ec10,_0x3ffe08){return db[_0x6918('0x1c')][_0x6918('0x1d')]({'raw':_0x38ba89[_0x6918('0x1e')]?_0x38ba89[_0x6918('0x1e')][_0x6918('0x1f')]===undefined?!![]:![]:!![],'where':_0x38ba89[_0x6918('0x1e')]?_0x38ba89[_0x6918('0x1e')][_0x6918('0x20')]||null:null,'attributes':_0x38ba89[_0x6918('0x1e')]?_0x38ba89[_0x6918('0x1e')]['attributes']||null:null,'limit':_0x38ba89[_0x6918('0x1e')]?_0x38ba89['options'][_0x6918('0x21')]||null:null,'include':_0x38ba89['options']?_0x38ba89[_0x6918('0x1e')][_0x6918('0x22')]?_[_0x6918('0x23')](_0x38ba89['options'][_0x6918('0x22')],function(_0x13f1ca){return{'model':db[_0x13f1ca[_0x6918('0x24')]],'as':_0x13f1ca['as'],'attributes':_0x13f1ca['attributes'],'include':_0x13f1ca[_0x6918('0x22')]?_[_0x6918('0x23')](_0x13f1ca['include'],function(_0x3cdbe0){return{'model':db[_0x3cdbe0[_0x6918('0x24')]],'as':_0x3cdbe0['as'],'attributes':_0x3cdbe0[_0x6918('0x25')],'include':_0x3cdbe0[_0x6918('0x22')]?_[_0x6918('0x23')](_0x3cdbe0[_0x6918('0x22')],function(_0xe6bbca){return{'model':db[_0xe6bbca[_0x6918('0x24')]],'as':_0xe6bbca['as'],'attributes':_0xe6bbca[_0x6918('0x25')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x352c6e){logger[_0x6918('0x11')](_0x6918('0x1b'),_0x38ba89);logger[_0x6918('0x14')](_0x6918('0x1b'),_0x38ba89,JSON[_0x6918('0x15')](_0x352c6e));_0x46ec10(_0x352c6e);})[_0x6918('0x1a')](function(_0x3d3f2a){logger[_0x6918('0x16')](_0x6918('0x1b'),_0x3d3f2a['message'],_0x38ba89);_0x3ffe08(_0x3df535[_0x6918('0x16')](0x1f4,_0x3d3f2a['message']));});});};exports[_0x6918('0x26')]=function(_0x10140c){var _0x13b456=this;return new Promise(function(_0x11b44a,_0x13670f){return db[_0x6918('0x1c')][_0x6918('0x27')]({'raw':_0x10140c[_0x6918('0x1e')]?_0x10140c['options'][_0x6918('0x1f')]===undefined?!![]:![]:!![],'where':_0x10140c[_0x6918('0x1e')]?_0x10140c[_0x6918('0x1e')][_0x6918('0x20')]||null:null,'attributes':_0x10140c['options']?_0x10140c[_0x6918('0x1e')][_0x6918('0x25')]||null:null,'include':_0x10140c[_0x6918('0x1e')]?_0x10140c[_0x6918('0x1e')][_0x6918('0x22')]?_[_0x6918('0x23')](_0x10140c[_0x6918('0x1e')]['include'],function(_0x22c4ba){return{'model':db[_0x22c4ba[_0x6918('0x24')]],'as':_0x22c4ba['as'],'attributes':_0x22c4ba[_0x6918('0x25')],'include':_0x22c4ba[_0x6918('0x22')]?_['map'](_0x22c4ba[_0x6918('0x22')],function(_0x2d5575){return{'model':db[_0x2d5575[_0x6918('0x24')]],'as':_0x2d5575['as'],'attributes':_0x2d5575[_0x6918('0x25')],'include':_0x2d5575[_0x6918('0x22')]?_[_0x6918('0x23')](_0x2d5575[_0x6918('0x22')],function(_0x4f0cd5){return{'model':db[_0x4f0cd5[_0x6918('0x24')]],'as':_0x4f0cd5['as'],'attributes':_0x4f0cd5[_0x6918('0x25')]};}):[]};}):[]};}):[]:[]})[_0x6918('0x28')](function(_0x6b582e){logger['info'](_0x6918('0x26'),_0x10140c);logger['debug'](_0x6918('0x26'),_0x10140c,JSON[_0x6918('0x15')](_0x6b582e));_0x11b44a(_0x6b582e);})[_0x6918('0x1a')](function(_0x3820a8){logger[_0x6918('0x16')](_0x6918('0x26'),_0x3820a8[_0x6918('0x18')],_0x10140c);_0x13670f(_0x13b456[_0x6918('0x16')](0x1f4,_0x3820a8['message']));});});}; \ No newline at end of file +var _0x377c=['debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetWhatsappQueue','findAll','options','attributes','limit','include','model','map','ShowWhatsappQueue','WhatsappQueue','find','where','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent'];(function(_0xdd2bfa,_0x5bd304){var _0x55397e=function(_0x196f7d){while(--_0x196f7d){_0xdd2bfa['push'](_0xdd2bfa['shift']());}};_0x55397e(++_0x5bd304);}(_0x377c,0x98));var _0xc377=function(_0x471196,_0x4fdcea){_0x471196=_0x471196-0x0;var _0x3971c0=_0x377c[_0x471196];return _0x3971c0;};'use strict';var _=require(_0xc377('0x0'));var util=require(_0xc377('0x1'));var moment=require(_0xc377('0x2'));var BPromise=require(_0xc377('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc377('0x4'));var db=require(_0xc377('0x5'))['db'];var utils=require(_0xc377('0x6'));var logger=require(_0xc377('0x7'))(_0xc377('0x8'));var config=require(_0xc377('0x9'));var jayson=require(_0xc377('0xa'));var client=jayson[_0xc377('0xb')][_0xc377('0xc')]({'port':0x232a});config[_0xc377('0xd')]=_[_0xc377('0xe')](config[_0xc377('0xd')],{'host':_0xc377('0xf'),'port':0x18eb});var socket=require(_0xc377('0x10'))(new Redis(config[_0xc377('0xd')]));require(_0xc377('0x11'))[_0xc377('0x12')](socket);function respondWithRpcPromise(_0x3138ee,_0x433bf1,_0x765025){return new BPromise(function(_0xb11faf,_0x324560){return client[_0xc377('0x13')](_0x3138ee,_0x765025)[_0xc377('0x14')](function(_0x3fcbd3){logger[_0xc377('0x15')](_0xc377('0x16'),_0x433bf1,_0xc377('0x17'));logger[_0xc377('0x18')](_0xc377('0x19'),_0x433bf1,_0xc377('0x17'),JSON[_0xc377('0x1a')](_0x3fcbd3));if(_0x3fcbd3[_0xc377('0x1b')]){if(_0x3fcbd3[_0xc377('0x1b')][_0xc377('0x1c')]===0x1f4){logger[_0xc377('0x1b')](_0xc377('0x16'),_0x433bf1,_0x3fcbd3[_0xc377('0x1b')][_0xc377('0x1d')]);return _0x324560(_0x3fcbd3[_0xc377('0x1b')][_0xc377('0x1d')]);}logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x433bf1,_0x3fcbd3['error'][_0xc377('0x1d')]);return _0xb11faf(_0x3fcbd3[_0xc377('0x1b')][_0xc377('0x1d')]);}else{logger[_0xc377('0x15')](_0xc377('0x16'),_0x433bf1,_0xc377('0x17'));_0xb11faf(_0x3fcbd3[_0xc377('0x1e')][_0xc377('0x1d')]);}})[_0xc377('0x1f')](function(_0x48fb36){logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x433bf1,_0x48fb36);_0x324560(_0x48fb36);});});}exports[_0xc377('0x20')]=function(_0x469b18){var _0x4f70b6=this;return new Promise(function(_0x1648ac,_0x28fd29){return db['WhatsappQueue'][_0xc377('0x21')]({'raw':_0x469b18[_0xc377('0x22')]?_0x469b18[_0xc377('0x22')]['raw']===undefined?!![]:![]:!![],'where':_0x469b18[_0xc377('0x22')]?_0x469b18[_0xc377('0x22')]['where']||null:null,'attributes':_0x469b18['options']?_0x469b18[_0xc377('0x22')][_0xc377('0x23')]||null:null,'limit':_0x469b18['options']?_0x469b18[_0xc377('0x22')][_0xc377('0x24')]||null:null,'include':_0x469b18[_0xc377('0x22')]?_0x469b18[_0xc377('0x22')][_0xc377('0x25')]?_['map'](_0x469b18[_0xc377('0x22')][_0xc377('0x25')],function(_0x34dfee){return{'model':db[_0x34dfee[_0xc377('0x26')]],'as':_0x34dfee['as'],'attributes':_0x34dfee['attributes'],'include':_0x34dfee[_0xc377('0x25')]?_[_0xc377('0x27')](_0x34dfee[_0xc377('0x25')],function(_0x2699f4){return{'model':db[_0x2699f4['model']],'as':_0x2699f4['as'],'attributes':_0x2699f4[_0xc377('0x23')],'include':_0x2699f4['include']?_[_0xc377('0x27')](_0x2699f4[_0xc377('0x25')],function(_0x1b9d73){return{'model':db[_0x1b9d73[_0xc377('0x26')]],'as':_0x1b9d73['as'],'attributes':_0x1b9d73[_0xc377('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x539285){logger[_0xc377('0x15')](_0xc377('0x20'),_0x469b18);logger[_0xc377('0x18')]('GetWhatsappQueue',_0x469b18,JSON[_0xc377('0x1a')](_0x539285));_0x1648ac(_0x539285);})[_0xc377('0x1f')](function(_0xdb997c){logger[_0xc377('0x1b')](_0xc377('0x20'),_0xdb997c[_0xc377('0x1d')],_0x469b18);_0x28fd29(_0x4f70b6[_0xc377('0x1b')](0x1f4,_0xdb997c[_0xc377('0x1d')]));});});};exports[_0xc377('0x28')]=function(_0x43f402){var _0x114d66=this;return new Promise(function(_0x15b7df,_0x228f68){return db[_0xc377('0x29')][_0xc377('0x2a')]({'raw':_0x43f402[_0xc377('0x22')]?_0x43f402[_0xc377('0x22')]['raw']===undefined?!![]:![]:!![],'where':_0x43f402['options']?_0x43f402[_0xc377('0x22')][_0xc377('0x2b')]||null:null,'attributes':_0x43f402['options']?_0x43f402[_0xc377('0x22')][_0xc377('0x23')]||null:null,'include':_0x43f402[_0xc377('0x22')]?_0x43f402[_0xc377('0x22')][_0xc377('0x25')]?_[_0xc377('0x27')](_0x43f402[_0xc377('0x22')][_0xc377('0x25')],function(_0x11329e){return{'model':db[_0x11329e[_0xc377('0x26')]],'as':_0x11329e['as'],'attributes':_0x11329e['attributes'],'include':_0x11329e[_0xc377('0x25')]?_[_0xc377('0x27')](_0x11329e[_0xc377('0x25')],function(_0x1d6060){return{'model':db[_0x1d6060[_0xc377('0x26')]],'as':_0x1d6060['as'],'attributes':_0x1d6060[_0xc377('0x23')],'include':_0x1d6060[_0xc377('0x25')]?_['map'](_0x1d6060['include'],function(_0x371489){return{'model':db[_0x371489[_0xc377('0x26')]],'as':_0x371489['as'],'attributes':_0x371489[_0xc377('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xf8f1d1){logger[_0xc377('0x15')](_0xc377('0x28'),_0x43f402);logger[_0xc377('0x18')](_0xc377('0x28'),_0x43f402,JSON[_0xc377('0x1a')](_0xf8f1d1));_0x15b7df(_0xf8f1d1);})['catch'](function(_0x3bee49){logger[_0xc377('0x1b')](_0xc377('0x28'),_0x3bee49[_0xc377('0x1d')],_0x43f402);_0x228f68(_0x114d66['error'](0x1f4,_0x3bee49[_0xc377('0x1d')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 76a8c08..f34d6f7 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 _0x919a=['update','removeListener','register','length','whatsappQueue:','./whatsappQueue.events','save','remove'];(function(_0x254076,_0x5e7b8d){var _0x21a93e=function(_0x26aa78){while(--_0x26aa78){_0x254076['push'](_0x254076['shift']());}};_0x21a93e(++_0x5e7b8d);}(_0x919a,0x185));var _0xa919=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x919a[_0x263a74];return _0x2aa86c;};'use strict';var WhatsappQueueEvents=require(_0xa919('0x0'));var events=[_0xa919('0x1'),_0xa919('0x2'),_0xa919('0x3')];function createListener(_0x3cb3c3,_0x370311){return function(_0x180caf){_0x370311['emit'](_0x3cb3c3,_0x180caf);};}function removeListener(_0x366686,_0x4e921c){return function(){WhatsappQueueEvents[_0xa919('0x4')](_0x366686,_0x4e921c);};}exports[_0xa919('0x5')]=function(_0x331416){for(var _0x3fb88c=0x0,_0x5f1d3a=events[_0xa919('0x6')];_0x3fb88c<_0x5f1d3a;_0x3fb88c++){var _0x1187cb=events[_0x3fb88c];var _0x9c554f=createListener(_0xa919('0x7')+_0x1187cb,_0x331416);WhatsappQueueEvents['on'](_0x1187cb,_0x9c554f);}}; \ No newline at end of file +var _0x513b=['removeListener','register','length','whatsappQueue:','./whatsappQueue.events','remove','update','emit'];(function(_0x59c2cb,_0x671ebb){var _0x4d2910=function(_0x50c769){while(--_0x50c769){_0x59c2cb['push'](_0x59c2cb['shift']());}};_0x4d2910(++_0x671ebb);}(_0x513b,0xdc));var _0xb513=function(_0x1b7d42,_0x176be6){_0x1b7d42=_0x1b7d42-0x0;var _0x33b0af=_0x513b[_0x1b7d42];return _0x33b0af;};'use strict';var WhatsappQueueEvents=require(_0xb513('0x0'));var events=['save',_0xb513('0x1'),_0xb513('0x2')];function createListener(_0x2197f6,_0xeb43b8){return function(_0xde9902){_0xeb43b8[_0xb513('0x3')](_0x2197f6,_0xde9902);};}function removeListener(_0x167749,_0x3740cc){return function(){WhatsappQueueEvents[_0xb513('0x4')](_0x167749,_0x3740cc);};}exports[_0xb513('0x5')]=function(_0x1fc04e){for(var _0x395ff1=0x0,_0x4704d7=events[_0xb513('0x6')];_0x395ff1<_0x4704d7;_0x395ff1++){var _0x15af81=events[_0x395ff1];var _0x2ccc3b=createListener(_0xb513('0x7')+_0x15af81,_0x1fc04e);WhatsappQueueEvents['on'](_0x15af81,_0x2ccc3b);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 74b2101..a1d4ab8 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 _0xaf2e=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x1c3a25,_0x377fcd){var _0x45b02c=function(_0x3fa81b){while(--_0x3fa81b){_0x1c3a25['push'](_0x1c3a25['shift']());}};_0x45b02c(++_0x377fcd);}(_0xaf2e,0x104));var _0xeaf2=function(_0x2fd9e1,_0x3f336b){_0x2fd9e1=_0x2fd9e1-0x0;var _0x1b1074=_0xaf2e[_0x2fd9e1];return _0x1b1074;};'use strict';var multer=require(_0xeaf2('0x0'));var util=require(_0xeaf2('0x1'));var path=require(_0xeaf2('0x2'));var timeout=require(_0xeaf2('0x3'));var express=require(_0xeaf2('0x4'));var router=express['Router']();var fs_extra=require(_0xeaf2('0x5'));var auth=require(_0xeaf2('0x6'));var interaction=require(_0xeaf2('0x7'));var config=require(_0xeaf2('0x8'));var controller=require(_0xeaf2('0x9'));router[_0xeaf2('0xa')]('/',auth[_0xeaf2('0xb')](),controller['index']);router[_0xeaf2('0xa')]('/describe',auth[_0xeaf2('0xb')](),controller[_0xeaf2('0xc')]);router[_0xeaf2('0xa')](_0xeaf2('0xd'),auth['isAuthenticated'](),controller[_0xeaf2('0xe')]);router[_0xeaf2('0xf')]('/',auth[_0xeaf2('0xb')](),controller[_0xeaf2('0x10')]);router[_0xeaf2('0x11')](_0xeaf2('0xd'),auth[_0xeaf2('0xb')](),controller[_0xeaf2('0x12')]);router[_0xeaf2('0x13')]('/:id',auth[_0xeaf2('0xb')](),controller[_0xeaf2('0x14')]);module[_0xeaf2('0x15')]=router; \ No newline at end of file +var _0x3e27=['express','Router','fs-extra','../../components/interaction/service','./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0x109946,_0x3494b7){var _0x4ed20b=function(_0x578aa4){while(--_0x578aa4){_0x109946['push'](_0x109946['shift']());}};_0x4ed20b(++_0x3494b7);}(_0x3e27,0xed));var _0x73e2=function(_0x4c2895,_0x140000){_0x4c2895=_0x4c2895-0x0;var _0x589bc3=_0x3e27[_0x4c2895];return _0x589bc3;};'use strict';var multer=require('multer');var util=require(_0x73e2('0x0'));var path=require(_0x73e2('0x1'));var timeout=require(_0x73e2('0x2'));var express=require(_0x73e2('0x3'));var router=express[_0x73e2('0x4')]();var fs_extra=require(_0x73e2('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x73e2('0x6'));var config=require('../../config/environment');var controller=require(_0x73e2('0x7'));router[_0x73e2('0x8')]('/',auth[_0x73e2('0x9')](),controller[_0x73e2('0xa')]);router[_0x73e2('0x8')](_0x73e2('0xb'),auth[_0x73e2('0x9')](),controller[_0x73e2('0xc')]);router[_0x73e2('0x8')](_0x73e2('0xd'),auth[_0x73e2('0x9')](),controller['show']);router[_0x73e2('0xe')]('/',auth[_0x73e2('0x9')](),controller[_0x73e2('0xf')]);router['put']('/:id',auth[_0x73e2('0x9')](),controller[_0x73e2('0x10')]);router[_0x73e2('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x73e2('0x12')]);module[_0x73e2('0x13')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 8e41eab..d157711 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(_0x556afd,_0x5b3d07){var _0x3e0cdc=function(_0x3fc0dd){while(--_0x3fc0dd){_0x556afd['push'](_0x556afd['shift']());}};_0x3e0cdc(++_0x5b3d07);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'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(_0x55ac0e,_0x3e71bd){var _0x579995=function(_0x3def97){while(--_0x3def97){_0x55ac0e['push'](_0x55ac0e['shift']());}};_0x579995(++_0x3e71bd);}(_0x7a54,0x106));var _0x47a5=function(_0x2b6d6a,_0x4b61d0){_0x2b6d6a=_0x2b6d6a-0x0;var _0x56a70d=_0x7a54[_0x2b6d6a];return _0x56a70d;};'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 54c2620..7ddbb7e 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 _0xf45e=['Content-Range','json','apply','reject','save','destroy','then','sendStatus','stack','index','map','rawAttributes','type','key','model','name','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','WhatsappQueueReport','includeAll','include','findAll','rows','show','params','keys','length','merge','find','create','body','update','catch','eml-format','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/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','offset','undefined','limit','count','set'];(function(_0x557f08,_0x4826e2){var _0x21885a=function(_0x428360){while(--_0x428360){_0x557f08['push'](_0x557f08['shift']());}};_0x21885a(++_0x4826e2);}(_0xf45e,0x115));var _0xef45=function(_0x573e18,_0x21bfee){_0x573e18=_0x573e18-0x0;var _0x58a314=_0xf45e[_0x573e18];return _0x58a314;};'use strict';var emlformat=require(_0xef45('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xef45('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xef45('0x2'));var moment=require(_0xef45('0x3'));var BPromise=require(_0xef45('0x4'));var Mustache=require(_0xef45('0x5'));var util=require(_0xef45('0x6'));var path=require(_0xef45('0x7'));var sox=require(_0xef45('0x8'));var csv=require(_0xef45('0x9'));var ejs=require(_0xef45('0xa'));var fs=require('fs');var fs_extra=require(_0xef45('0xb'));var _=require(_0xef45('0xc'));var squel=require(_0xef45('0xd'));var crypto=require(_0xef45('0xe'));var jsforce=require(_0xef45('0xf'));var deskjs=require(_0xef45('0x10'));var toCsv=require(_0xef45('0x9'));var querystring=require(_0xef45('0x11'));var Papa=require(_0xef45('0x12'));var Redis=require(_0xef45('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xef45('0x14'));var as=require(_0xef45('0x15'));var hardwareService=require(_0xef45('0x16'));var logger=require(_0xef45('0x17'))(_0xef45('0x18'));var utils=require(_0xef45('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xef45('0x1a'));var db=require(_0xef45('0x1b'))['db'];function respondWithStatusCode(_0x30babb,_0x433be9){_0x433be9=_0x433be9||0xcc;return function(_0x476739){if(_0x476739){return _0x30babb['sendStatus'](_0x433be9);}return _0x30babb['status'](_0x433be9)[_0xef45('0x1c')]();};}function respondWithResult(_0x47fd96,_0x2ae89a){_0x2ae89a=_0x2ae89a||0xc8;return function(_0xb0fc43){if(_0xb0fc43){return _0x47fd96[_0xef45('0x1d')](_0x2ae89a)['json'](_0xb0fc43);}};}function respondWithFilteredResult(_0x5b3136,_0x29c0c4){return function(_0x5530e6){if(_0x5530e6){var _0x11cd3a=typeof _0x29c0c4[_0xef45('0x1e')]===_0xef45('0x1f')&&typeof _0x29c0c4[_0xef45('0x20')]==='undefined';var _0x560b2f=_0x5530e6[_0xef45('0x21')];var _0x219778=_0x11cd3a?0x0:_0x29c0c4[_0xef45('0x1e')];var _0x258785=_0x11cd3a?_0x5530e6['count']:_0x29c0c4['offset']+_0x29c0c4[_0xef45('0x20')];var _0x20ef26;if(_0x258785>=_0x560b2f){_0x258785=_0x560b2f;_0x20ef26=0xc8;}else{_0x20ef26=0xce;}_0x5b3136[_0xef45('0x1d')](_0x20ef26);return _0x5b3136[_0xef45('0x22')](_0xef45('0x23'),_0x219778+'-'+_0x258785+'/'+_0x560b2f)[_0xef45('0x24')](_0x5530e6);}return null;};}function patchUpdates(_0x375cbd){return function(_0x4a6217){try{jsonpatch[_0xef45('0x25')](_0x4a6217,_0x375cbd,!![]);}catch(_0x3e2a47){return BPromise[_0xef45('0x26')](_0x3e2a47);}return _0x4a6217[_0xef45('0x27')]();};}function saveUpdates(_0x27322f,_0x5205bf){return function(_0x40abc8){if(_0x40abc8){return _0x40abc8['update'](_0x27322f)['then'](function(_0x7707a1){return _0x7707a1;});}return null;};}function removeEntity(_0x2b41d8,_0xbb859b){return function(_0x7817d0){if(_0x7817d0){return _0x7817d0[_0xef45('0x28')]()[_0xef45('0x29')](function(){_0x2b41d8[_0xef45('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x208b35,_0x5f0593){return function(_0x38b470){if(!_0x38b470){_0x208b35[_0xef45('0x2a')](0x194);}return _0x38b470;};}function handleError(_0x578f03,_0x46e423){_0x46e423=_0x46e423||0x1f4;return function(_0x2c356d){logger['error'](_0x2c356d[_0xef45('0x2b')]);if(_0x2c356d['name']){delete _0x2c356d['name'];}_0x578f03['status'](_0x46e423)['send'](_0x2c356d);};}exports[_0xef45('0x2c')]=function(_0x2f72ef,_0x217e8d){var _0x15ad38={},_0x5782d0={},_0x18f304={'count':0x0,'rows':[]};var _0x4f028c=_[_0xef45('0x2d')](db['WhatsappQueueReport'][_0xef45('0x2e')],function(_0x5bfd2d){return{'name':_0x5bfd2d['fieldName'],'type':_0x5bfd2d[_0xef45('0x2f')][_0xef45('0x30')]};});_0x5782d0[_0xef45('0x31')]=_[_0xef45('0x2d')](_0x4f028c,_0xef45('0x32'));_0x5782d0['query']=_['keys'](_0x2f72ef['query']);_0x5782d0[_0xef45('0x33')]=_[_0xef45('0x34')](_0x5782d0[_0xef45('0x31')],_0x5782d0[_0xef45('0x35')]);_0x15ad38[_0xef45('0x36')]=_[_0xef45('0x34')](_0x5782d0[_0xef45('0x31')],qs['fields'](_0x2f72ef['query'][_0xef45('0x37')]));_0x15ad38['attributes']=_0x15ad38[_0xef45('0x36')]['length']?_0x15ad38[_0xef45('0x36')]:_0x5782d0[_0xef45('0x31')];if(!_0x2f72ef[_0xef45('0x35')][_0xef45('0x38')](_0xef45('0x39'))){_0x15ad38['limit']=qs[_0xef45('0x20')](_0x2f72ef[_0xef45('0x35')][_0xef45('0x20')]);_0x15ad38['offset']=qs['offset'](_0x2f72ef[_0xef45('0x35')][_0xef45('0x1e')]);}_0x15ad38['order']=qs[_0xef45('0x3a')](_0x2f72ef['query']['sort']);_0x15ad38[_0xef45('0x3b')]=qs[_0xef45('0x33')](_[_0xef45('0x3c')](_0x2f72ef['query'],_0x5782d0[_0xef45('0x33')]),_0x4f028c);if(_0x2f72ef[_0xef45('0x35')][_0xef45('0x3d')]){_0x15ad38[_0xef45('0x3b')]=_['merge'](_0x15ad38['where'],{'$or':_[_0xef45('0x2d')](_0x4f028c,function(_0x474be1){if(_0x474be1[_0xef45('0x2f')]!==_0xef45('0x3e')){var _0x269a11={};_0x269a11[_0x474be1[_0xef45('0x32')]]={'$like':'%'+_0x2f72ef[_0xef45('0x35')][_0xef45('0x3d')]+'%'};return _0x269a11;}})});}_0x15ad38=_['merge']({},_0x15ad38,_0x2f72ef['options']);var _0x13f8b2={'where':_0x15ad38[_0xef45('0x3b')]};return db[_0xef45('0x3f')][_0xef45('0x21')](_0x13f8b2)[_0xef45('0x29')](function(_0x3bcada){_0x18f304[_0xef45('0x21')]=_0x3bcada;if(_0x2f72ef[_0xef45('0x35')][_0xef45('0x40')]){_0x15ad38[_0xef45('0x41')]=[{'all':!![]}];}return db[_0xef45('0x3f')][_0xef45('0x42')](_0x15ad38);})[_0xef45('0x29')](function(_0xd7d217){_0x18f304[_0xef45('0x43')]=_0xd7d217;return _0x18f304;})[_0xef45('0x29')](respondWithFilteredResult(_0x217e8d,_0x15ad38))['catch'](handleError(_0x217e8d,null));};exports[_0xef45('0x44')]=function(_0x5bdfad,_0x1b9d45){var _0x82c123={'raw':!![],'where':{'id':_0x5bdfad[_0xef45('0x45')]['id']}},_0x54ccb8={};_0x54ccb8['model']=_[_0xef45('0x46')](db['WhatsappQueueReport'][_0xef45('0x2e')]);_0x54ccb8[_0xef45('0x35')]=_[_0xef45('0x46')](_0x5bdfad[_0xef45('0x35')]);_0x54ccb8[_0xef45('0x33')]=_[_0xef45('0x34')](_0x54ccb8[_0xef45('0x31')],_0x54ccb8['query']);_0x82c123[_0xef45('0x36')]=_[_0xef45('0x34')](_0x54ccb8[_0xef45('0x31')],qs[_0xef45('0x37')](_0x5bdfad[_0xef45('0x35')][_0xef45('0x37')]));_0x82c123[_0xef45('0x36')]=_0x82c123[_0xef45('0x36')][_0xef45('0x47')]?_0x82c123[_0xef45('0x36')]:_0x54ccb8[_0xef45('0x31')];if(_0x5bdfad[_0xef45('0x35')][_0xef45('0x40')]){_0x82c123[_0xef45('0x41')]=[{'all':!![]}];}_0x82c123=_[_0xef45('0x48')]({},_0x82c123,_0x5bdfad['options']);return db[_0xef45('0x3f')][_0xef45('0x49')](_0x82c123)[_0xef45('0x29')](handleEntityNotFound(_0x1b9d45,null))['then'](respondWithResult(_0x1b9d45,null))['catch'](handleError(_0x1b9d45,null));};exports['create']=function(_0x29aeab,_0x18143c){return db[_0xef45('0x3f')][_0xef45('0x4a')](_0x29aeab[_0xef45('0x4b')],{})[_0xef45('0x29')](respondWithResult(_0x18143c,0xc9))['catch'](handleError(_0x18143c,null));};exports[_0xef45('0x4c')]=function(_0x463796,_0x2b2419){if(_0x463796['body']['id']){delete _0x463796['body']['id'];}return db[_0xef45('0x3f')][_0xef45('0x49')]({'where':{'id':_0x463796['params']['id']}})[_0xef45('0x29')](handleEntityNotFound(_0x2b2419,null))[_0xef45('0x29')](saveUpdates(_0x463796[_0xef45('0x4b')],null))[_0xef45('0x29')](respondWithResult(_0x2b2419,null))[_0xef45('0x4d')](handleError(_0x2b2419,null));};exports[_0xef45('0x28')]=function(_0x23581f,_0xfa5fdd){return db[_0xef45('0x3f')][_0xef45('0x49')]({'where':{'id':_0x23581f[_0xef45('0x45')]['id']}})[_0xef45('0x29')](handleEntityNotFound(_0xfa5fdd,null))[_0xef45('0x29')](removeEntity(_0xfa5fdd,null))[_0xef45('0x4d')](handleError(_0xfa5fdd,null));};exports['describe']=function(_0x22b75e,_0x24aceb){return db[_0xef45('0x3f')]['describe']()[_0xef45('0x29')](respondWithResult(_0x24aceb,null))[_0xef45('0x4d')](handleError(_0x24aceb,null));}; \ No newline at end of file +var _0x02ce=['then','destroy','error','name','index','map','WhatsappQueueReport','rawAttributes','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','findAll','rows','catch','show','keys','includeAll','options','find','create','body','params','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','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','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','count','limit','status','Content-Range','apply','reject','save','update'];(function(_0x540699,_0x584204){var _0x4b1fec=function(_0x40b9da){while(--_0x40b9da){_0x540699['push'](_0x540699['shift']());}};_0x4b1fec(++_0x584204);}(_0x02ce,0x1ac));var _0xe02c=function(_0x8ad505,_0x53a340){_0x8ad505=_0x8ad505-0x0;var _0x48f62c=_0x02ce[_0x8ad505];return _0x48f62c;};'use strict';var emlformat=require(_0xe02c('0x0'));var rimraf=require(_0xe02c('0x1'));var zipdir=require(_0xe02c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe02c('0x3'));var moment=require('moment');var BPromise=require(_0xe02c('0x4'));var Mustache=require(_0xe02c('0x5'));var util=require(_0xe02c('0x6'));var path=require(_0xe02c('0x7'));var sox=require(_0xe02c('0x8'));var csv=require(_0xe02c('0x9'));var ejs=require(_0xe02c('0xa'));var fs=require('fs');var fs_extra=require(_0xe02c('0xb'));var _=require(_0xe02c('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe02c('0xd'));var deskjs=require(_0xe02c('0xe'));var toCsv=require(_0xe02c('0x9'));var querystring=require(_0xe02c('0xf'));var Papa=require(_0xe02c('0x10'));var Redis=require(_0xe02c('0x11'));var authService=require(_0xe02c('0x12'));var qs=require(_0xe02c('0x13'));var as=require(_0xe02c('0x14'));var hardwareService=require(_0xe02c('0x15'));var logger=require(_0xe02c('0x16'))(_0xe02c('0x17'));var utils=require(_0xe02c('0x18'));var config=require(_0xe02c('0x19'));var licenseUtil=require(_0xe02c('0x1a'));var db=require(_0xe02c('0x1b'))['db'];function respondWithStatusCode(_0x23d886,_0x32fc45){_0x32fc45=_0x32fc45||0xcc;return function(_0x5d6d13){if(_0x5d6d13){return _0x23d886[_0xe02c('0x1c')](_0x32fc45);}return _0x23d886['status'](_0x32fc45)['end']();};}function respondWithResult(_0x3f4e28,_0x56405a){_0x56405a=_0x56405a||0xc8;return function(_0x221910){if(_0x221910){return _0x3f4e28['status'](_0x56405a)[_0xe02c('0x1d')](_0x221910);}};}function respondWithFilteredResult(_0x4e9c6d,_0x256311){return function(_0x366893){if(_0x366893){var _0x59f2f6=typeof _0x256311[_0xe02c('0x1e')]===_0xe02c('0x1f')&&typeof _0x256311['limit']===_0xe02c('0x1f');var _0x20f492=_0x366893['count'];var _0x52917f=_0x59f2f6?0x0:_0x256311[_0xe02c('0x1e')];var _0x49604a=_0x59f2f6?_0x366893[_0xe02c('0x20')]:_0x256311[_0xe02c('0x1e')]+_0x256311[_0xe02c('0x21')];var _0x36fed0;if(_0x49604a>=_0x20f492){_0x49604a=_0x20f492;_0x36fed0=0xc8;}else{_0x36fed0=0xce;}_0x4e9c6d[_0xe02c('0x22')](_0x36fed0);return _0x4e9c6d['set'](_0xe02c('0x23'),_0x52917f+'-'+_0x49604a+'/'+_0x20f492)['json'](_0x366893);}return null;};}function patchUpdates(_0x4ea9b5){return function(_0x393621){try{jsonpatch[_0xe02c('0x24')](_0x393621,_0x4ea9b5,!![]);}catch(_0x480b9a){return BPromise[_0xe02c('0x25')](_0x480b9a);}return _0x393621[_0xe02c('0x26')]();};}function saveUpdates(_0x4ce5ee,_0x38dce2){return function(_0x45fd82){if(_0x45fd82){return _0x45fd82[_0xe02c('0x27')](_0x4ce5ee)[_0xe02c('0x28')](function(_0x2d44c8){return _0x2d44c8;});}return null;};}function removeEntity(_0x557142,_0x3e80e3){return function(_0xf41d4c){if(_0xf41d4c){return _0xf41d4c[_0xe02c('0x29')]()[_0xe02c('0x28')](function(){_0x557142[_0xe02c('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0xefd882,_0x4411d8){return function(_0x3592ca){if(!_0x3592ca){_0xefd882[_0xe02c('0x1c')](0x194);}return _0x3592ca;};}function handleError(_0x16dfa3,_0x303d24){_0x303d24=_0x303d24||0x1f4;return function(_0x43dc78){logger[_0xe02c('0x2a')](_0x43dc78['stack']);if(_0x43dc78[_0xe02c('0x2b')]){delete _0x43dc78[_0xe02c('0x2b')];}_0x16dfa3[_0xe02c('0x22')](_0x303d24)['send'](_0x43dc78);};}exports[_0xe02c('0x2c')]=function(_0x2d1d98,_0x445421){var _0x287f7e={},_0x1e7eab={},_0x35a309={'count':0x0,'rows':[]};var _0x22a285=_[_0xe02c('0x2d')](db[_0xe02c('0x2e')][_0xe02c('0x2f')],function(_0x17d5b3){return{'name':_0x17d5b3['fieldName'],'type':_0x17d5b3[_0xe02c('0x30')][_0xe02c('0x31')]};});_0x1e7eab[_0xe02c('0x32')]=_[_0xe02c('0x2d')](_0x22a285,_0xe02c('0x2b'));_0x1e7eab[_0xe02c('0x33')]=_['keys'](_0x2d1d98[_0xe02c('0x33')]);_0x1e7eab[_0xe02c('0x34')]=_['intersection'](_0x1e7eab[_0xe02c('0x32')],_0x1e7eab[_0xe02c('0x33')]);_0x287f7e[_0xe02c('0x35')]=_[_0xe02c('0x36')](_0x1e7eab[_0xe02c('0x32')],qs['fields'](_0x2d1d98['query'][_0xe02c('0x37')]));_0x287f7e[_0xe02c('0x35')]=_0x287f7e['attributes'][_0xe02c('0x38')]?_0x287f7e['attributes']:_0x1e7eab[_0xe02c('0x32')];if(!_0x2d1d98[_0xe02c('0x33')][_0xe02c('0x39')](_0xe02c('0x3a'))){_0x287f7e[_0xe02c('0x21')]=qs['limit'](_0x2d1d98[_0xe02c('0x33')]['limit']);_0x287f7e[_0xe02c('0x1e')]=qs[_0xe02c('0x1e')](_0x2d1d98[_0xe02c('0x33')][_0xe02c('0x1e')]);}_0x287f7e[_0xe02c('0x3b')]=qs[_0xe02c('0x3c')](_0x2d1d98['query'][_0xe02c('0x3c')]);_0x287f7e[_0xe02c('0x3d')]=qs['filters'](_[_0xe02c('0x3e')](_0x2d1d98[_0xe02c('0x33')],_0x1e7eab['filters']),_0x22a285);if(_0x2d1d98[_0xe02c('0x33')]['filter']){_0x287f7e[_0xe02c('0x3d')]=_[_0xe02c('0x3f')](_0x287f7e['where'],{'$or':_[_0xe02c('0x2d')](_0x22a285,function(_0x1eeddb){if(_0x1eeddb[_0xe02c('0x30')]!==_0xe02c('0x40')){var _0x3c4a65={};_0x3c4a65[_0x1eeddb[_0xe02c('0x2b')]]={'$like':'%'+_0x2d1d98['query'][_0xe02c('0x41')]+'%'};return _0x3c4a65;}})});}_0x287f7e=_['merge']({},_0x287f7e,_0x2d1d98['options']);var _0x3db057={'where':_0x287f7e[_0xe02c('0x3d')]};return db[_0xe02c('0x2e')][_0xe02c('0x20')](_0x3db057)['then'](function(_0x37e4fe){_0x35a309[_0xe02c('0x20')]=_0x37e4fe;if(_0x2d1d98[_0xe02c('0x33')]['includeAll']){_0x287f7e['include']=[{'all':!![]}];}return db[_0xe02c('0x2e')][_0xe02c('0x42')](_0x287f7e);})[_0xe02c('0x28')](function(_0x2313d2){_0x35a309[_0xe02c('0x43')]=_0x2313d2;return _0x35a309;})[_0xe02c('0x28')](respondWithFilteredResult(_0x445421,_0x287f7e))[_0xe02c('0x44')](handleError(_0x445421,null));};exports[_0xe02c('0x45')]=function(_0x21d66e,_0x53d123){var _0xc7e935={'raw':!![],'where':{'id':_0x21d66e['params']['id']}},_0x5ef4a1={};_0x5ef4a1[_0xe02c('0x32')]=_[_0xe02c('0x46')](db[_0xe02c('0x2e')][_0xe02c('0x2f')]);_0x5ef4a1[_0xe02c('0x33')]=_[_0xe02c('0x46')](_0x21d66e[_0xe02c('0x33')]);_0x5ef4a1[_0xe02c('0x34')]=_['intersection'](_0x5ef4a1['model'],_0x5ef4a1[_0xe02c('0x33')]);_0xc7e935[_0xe02c('0x35')]=_[_0xe02c('0x36')](_0x5ef4a1['model'],qs[_0xe02c('0x37')](_0x21d66e[_0xe02c('0x33')][_0xe02c('0x37')]));_0xc7e935[_0xe02c('0x35')]=_0xc7e935[_0xe02c('0x35')][_0xe02c('0x38')]?_0xc7e935[_0xe02c('0x35')]:_0x5ef4a1[_0xe02c('0x32')];if(_0x21d66e[_0xe02c('0x33')][_0xe02c('0x47')]){_0xc7e935['include']=[{'all':!![]}];}_0xc7e935=_[_0xe02c('0x3f')]({},_0xc7e935,_0x21d66e[_0xe02c('0x48')]);return db[_0xe02c('0x2e')][_0xe02c('0x49')](_0xc7e935)[_0xe02c('0x28')](handleEntityNotFound(_0x53d123,null))[_0xe02c('0x28')](respondWithResult(_0x53d123,null))[_0xe02c('0x44')](handleError(_0x53d123,null));};exports[_0xe02c('0x4a')]=function(_0x30dc90,_0x1176c9){return db[_0xe02c('0x2e')][_0xe02c('0x4a')](_0x30dc90[_0xe02c('0x4b')],{})['then'](respondWithResult(_0x1176c9,0xc9))[_0xe02c('0x44')](handleError(_0x1176c9,null));};exports['update']=function(_0x15b05c,_0x324911){if(_0x15b05c[_0xe02c('0x4b')]['id']){delete _0x15b05c[_0xe02c('0x4b')]['id'];}return db[_0xe02c('0x2e')][_0xe02c('0x49')]({'where':{'id':_0x15b05c[_0xe02c('0x4c')]['id']}})[_0xe02c('0x28')](handleEntityNotFound(_0x324911,null))[_0xe02c('0x28')](saveUpdates(_0x15b05c[_0xe02c('0x4b')],null))['then'](respondWithResult(_0x324911,null))[_0xe02c('0x44')](handleError(_0x324911,null));};exports[_0xe02c('0x29')]=function(_0xeb4214,_0x536cf7){return db[_0xe02c('0x2e')]['find']({'where':{'id':_0xeb4214[_0xe02c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x536cf7,null))['then'](removeEntity(_0x536cf7,null))['catch'](handleError(_0x536cf7,null));};exports['describe']=function(_0x51d540,_0x5740df){return db[_0xe02c('0x2e')][_0xe02c('0x4d')]()[_0xe02c('0x28')](respondWithResult(_0x5740df,null))[_0xe02c('0x44')](handleError(_0x5740df,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index adf91eb..7e9edfc 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 _0xc359=['exports','define','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./whatsappQueueReport.attributes'];(function(_0x221ba2,_0x79208){var _0x47d08e=function(_0xaf14ee){while(--_0xaf14ee){_0x221ba2['push'](_0x221ba2['shift']());}};_0x47d08e(++_0x79208);}(_0xc359,0x1bf));var _0x9c35=function(_0x4b6804,_0x301b24){_0x4b6804=_0x4b6804-0x0;var _0x11b4f1=_0xc359[_0x4b6804];return _0x11b4f1;};'use strict';var _=require(_0x9c35('0x0'));var util=require(_0x9c35('0x1'));var logger=require(_0x9c35('0x2'))(_0x9c35('0x3'));var moment=require(_0x9c35('0x4'));var BPromise=require(_0x9c35('0x5'));var rp=require(_0x9c35('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9c35('0x7'));var attributes=require(_0x9c35('0x8'));module[_0x9c35('0x9')]=function(_0x1f6d32,_0x41406a){return _0x1f6d32[_0x9c35('0xa')]('WhatsappQueueReport',attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0x9c35('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x7502=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define','report_whatsapp_queue','uniqueid','lodash','util'];(function(_0x40d11b,_0x217dc5){var _0x3c3e13=function(_0x12e823){while(--_0x12e823){_0x40d11b['push'](_0x40d11b['shift']());}};_0x3c3e13(++_0x217dc5);}(_0x7502,0xb4));var _0x2750=function(_0x410d21,_0x211141){_0x410d21=_0x410d21-0x0;var _0x2d8b8=_0x7502[_0x410d21];return _0x2d8b8;};'use strict';var _=require(_0x2750('0x0'));var util=require(_0x2750('0x1'));var logger=require('../../config/logger')(_0x2750('0x2'));var moment=require(_0x2750('0x3'));var BPromise=require(_0x2750('0x4'));var rp=require(_0x2750('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2750('0x6'));var config=require(_0x2750('0x7'));var attributes=require(_0x2750('0x8'));module[_0x2750('0x9')]=function(_0x277312,_0xbff98a){return _0x277312[_0x2750('0xa')]('WhatsappQueueReport',attributes,{'tableName':_0x2750('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x2750('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 94d2db1..a59c460 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 _0x3711=['jayson/promise','client','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','catch','UpdateWhatsappQueueReport','update','where','attributes','limit','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x3711,0x75));var _0x1371=function(_0x4c7adc,_0x2d03bd){_0x4c7adc=_0x4c7adc-0x0;var _0x59fc77=_0x3711[_0x4c7adc];return _0x59fc77;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x1371('0x0'));var rs=require(_0x1371('0x1'));var fs=require('fs');var Redis=require(_0x1371('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x1371('0x3'));var logger=require(_0x1371('0x4'))(_0x1371('0x5'));var config=require(_0x1371('0x6'));var jayson=require(_0x1371('0x7'));var client=jayson[_0x1371('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x33391c,_0x4bcff1,_0x2771ab){return new BPromise(function(_0x5ae9e5,_0x2bfc10){return client[_0x1371('0x9')](_0x33391c,_0x2771ab)[_0x1371('0xa')](function(_0x256f93){logger[_0x1371('0xb')](_0x1371('0xc'),_0x4bcff1,_0x1371('0xd'));logger[_0x1371('0xe')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x4bcff1,_0x1371('0xd'),JSON[_0x1371('0xf')](_0x256f93));if(_0x256f93['error']){if(_0x256f93[_0x1371('0x10')][_0x1371('0x11')]===0x1f4){logger[_0x1371('0x10')](_0x1371('0xc'),_0x4bcff1,_0x256f93[_0x1371('0x10')][_0x1371('0x12')]);return _0x2bfc10(_0x256f93[_0x1371('0x10')][_0x1371('0x12')]);}logger[_0x1371('0x10')](_0x1371('0xc'),_0x4bcff1,_0x256f93[_0x1371('0x10')][_0x1371('0x12')]);return _0x5ae9e5(_0x256f93[_0x1371('0x10')][_0x1371('0x12')]);}else{logger['info']('WhatsappQueueReport,\x20%s,\x20%s',_0x4bcff1,_0x1371('0xd'));_0x5ae9e5(_0x256f93['result'][_0x1371('0x12')]);}})['catch'](function(_0x10f862){logger[_0x1371('0x10')](_0x1371('0xc'),_0x4bcff1,_0x10f862);_0x2bfc10(_0x10f862);});});}exports[_0x1371('0x13')]=function(_0x3452d7){var _0x56d249=this;return new Promise(function(_0x4bc1f6,_0x1cc0c4){return db[_0x1371('0x14')][_0x1371('0x15')](_0x3452d7[_0x1371('0x16')],{'raw':_0x3452d7[_0x1371('0x17')]?_0x3452d7[_0x1371('0x17')][_0x1371('0x18')]===undefined?!![]:![]:!![]})[_0x1371('0xa')](function(_0x3ae5c2){logger['info'](_0x1371('0x13'),_0x3452d7);logger['debug'](_0x1371('0x13'),_0x3452d7,JSON['stringify'](_0x3ae5c2));_0x4bc1f6(_0x3ae5c2);})[_0x1371('0x19')](function(_0x59495b){logger['error'](_0x1371('0x13'),_0x59495b['message'],_0x3452d7);_0x1cc0c4(_0x56d249[_0x1371('0x10')](0x1f4,_0x59495b[_0x1371('0x12')]));});});};exports[_0x1371('0x1a')]=function(_0x362178){var _0x44925a=this;return new Promise(function(_0x42d5df,_0x197a50){return db[_0x1371('0x14')][_0x1371('0x1b')](_0x362178[_0x1371('0x16')],{'raw':_0x362178[_0x1371('0x17')]?_0x362178[_0x1371('0x17')][_0x1371('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x362178['options']?_0x362178[_0x1371('0x17')][_0x1371('0x1c')]||null:null,'attributes':_0x362178['options']?_0x362178[_0x1371('0x17')][_0x1371('0x1d')]||null:null,'limit':_0x362178[_0x1371('0x17')]?_0x362178[_0x1371('0x17')][_0x1371('0x1e')]||null:null})[_0x1371('0xa')](function(_0x34ba0c){logger[_0x1371('0xb')](_0x1371('0x1a'),_0x362178);logger[_0x1371('0xe')](_0x1371('0x1a'),_0x362178,JSON[_0x1371('0xf')](_0x34ba0c));_0x42d5df(_0x34ba0c);})[_0x1371('0x19')](function(_0xbeb240){logger[_0x1371('0x10')](_0x1371('0x1a'),_0xbeb240[_0x1371('0x12')],_0x362178);_0x197a50(_0x44925a[_0x1371('0x10')](0x1f4,_0xbeb240[_0x1371('0x12')]));});});}; \ No newline at end of file +var _0xbc01=['update','body','raw','where','attributes','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateWhatsappQueueReport','create','options','info','UpdateWhatsappQueueReport','WhatsappQueueReport'];(function(_0x2aef62,_0xa94a63){var _0xe430ad=function(_0x1f250c){while(--_0x1f250c){_0x2aef62['push'](_0x2aef62['shift']());}};_0xe430ad(++_0xa94a63);}(_0xbc01,0xaf));var _0x1bc0=function(_0x537add,_0x15160c){_0x537add=_0x537add-0x0;var _0xe88ec7=_0xbc01[_0x537add];return _0xe88ec7;};'use strict';var _=require(_0x1bc0('0x0'));var util=require(_0x1bc0('0x1'));var moment=require(_0x1bc0('0x2'));var BPromise=require('bluebird');var rs=require(_0x1bc0('0x3'));var fs=require('fs');var Redis=require(_0x1bc0('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1bc0('0x5'));var logger=require(_0x1bc0('0x6'))(_0x1bc0('0x7'));var config=require(_0x1bc0('0x8'));var jayson=require(_0x1bc0('0x9'));var client=jayson[_0x1bc0('0xa')][_0x1bc0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x273469,_0x20f5e5,_0x2f7940){return new BPromise(function(_0x16a877,_0x307c8a){return client[_0x1bc0('0xc')](_0x273469,_0x2f7940)[_0x1bc0('0xd')](function(_0x58815e){logger['info'](_0x1bc0('0xe'),_0x20f5e5,_0x1bc0('0xf'));logger[_0x1bc0('0x10')](_0x1bc0('0x11'),_0x20f5e5,_0x1bc0('0xf'),JSON[_0x1bc0('0x12')](_0x58815e));if(_0x58815e[_0x1bc0('0x13')]){if(_0x58815e['error'][_0x1bc0('0x14')]===0x1f4){logger['error'](_0x1bc0('0xe'),_0x20f5e5,_0x58815e[_0x1bc0('0x13')][_0x1bc0('0x15')]);return _0x307c8a(_0x58815e[_0x1bc0('0x13')]['message']);}logger['error'](_0x1bc0('0xe'),_0x20f5e5,_0x58815e[_0x1bc0('0x13')][_0x1bc0('0x15')]);return _0x16a877(_0x58815e['error']['message']);}else{logger['info'](_0x1bc0('0xe'),_0x20f5e5,'request\x20sent');_0x16a877(_0x58815e['result'][_0x1bc0('0x15')]);}})[_0x1bc0('0x16')](function(_0x34aaba){logger[_0x1bc0('0x13')](_0x1bc0('0xe'),_0x20f5e5,_0x34aaba);_0x307c8a(_0x34aaba);});});}exports[_0x1bc0('0x17')]=function(_0x2f9e0b){var _0x4165e7=this;return new Promise(function(_0x23d259,_0x1f2f4c){return db['WhatsappQueueReport'][_0x1bc0('0x18')](_0x2f9e0b['body'],{'raw':_0x2f9e0b['options']?_0x2f9e0b[_0x1bc0('0x19')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x5bff4d){logger[_0x1bc0('0x1a')]('CreateWhatsappQueueReport',_0x2f9e0b);logger[_0x1bc0('0x10')](_0x1bc0('0x17'),_0x2f9e0b,JSON['stringify'](_0x5bff4d));_0x23d259(_0x5bff4d);})[_0x1bc0('0x16')](function(_0x8d0d55){logger[_0x1bc0('0x13')](_0x1bc0('0x17'),_0x8d0d55['message'],_0x2f9e0b);_0x1f2f4c(_0x4165e7['error'](0x1f4,_0x8d0d55[_0x1bc0('0x15')]));});});};exports[_0x1bc0('0x1b')]=function(_0x503d3a){var _0x5c5c53=this;return new Promise(function(_0x52cc32,_0x5a726f){return db[_0x1bc0('0x1c')][_0x1bc0('0x1d')](_0x503d3a[_0x1bc0('0x1e')],{'raw':_0x503d3a[_0x1bc0('0x19')]?_0x503d3a[_0x1bc0('0x19')][_0x1bc0('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x503d3a[_0x1bc0('0x19')]?_0x503d3a[_0x1bc0('0x19')][_0x1bc0('0x20')]||null:null,'attributes':_0x503d3a[_0x1bc0('0x19')]?_0x503d3a['options'][_0x1bc0('0x21')]||null:null,'limit':_0x503d3a[_0x1bc0('0x19')]?_0x503d3a[_0x1bc0('0x19')]['limit']||null:null})[_0x1bc0('0xd')](function(_0x51b353){logger[_0x1bc0('0x1a')](_0x1bc0('0x1b'),_0x503d3a);logger['debug'](_0x1bc0('0x1b'),_0x503d3a,JSON['stringify'](_0x51b353));_0x52cc32(_0x51b353);})[_0x1bc0('0x16')](function(_0x141bef){logger[_0x1bc0('0x13')](_0x1bc0('0x1b'),_0x141bef[_0x1bc0('0x15')],_0x503d3a);_0x5a726f(_0x5c5c53[_0x1bc0('0x13')](0x1f4,_0x141bef[_0x1bc0('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 24a4f97..9593714 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 _0xe838=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','./whatsappTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','delete','destroy','exports','multer','path'];(function(_0x1c5e7d,_0x2ecf14){var _0x5a2a3f=function(_0x475c63){while(--_0x475c63){_0x1c5e7d['push'](_0x1c5e7d['shift']());}};_0x5a2a3f(++_0x2ecf14);}(_0xe838,0x8a));var _0x8e83=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe838[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x8e83('0x0'));var util=require('util');var path=require(_0x8e83('0x1'));var timeout=require(_0x8e83('0x2'));var express=require(_0x8e83('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8e83('0x4'));var interaction=require(_0x8e83('0x5'));var config=require('../../config/environment');var controller=require(_0x8e83('0x6'));router[_0x8e83('0x7')]('/',auth['isAuthenticated'](),controller[_0x8e83('0x8')]);router['get'](_0x8e83('0x9'),auth[_0x8e83('0xa')](),controller[_0x8e83('0xb')]);router[_0x8e83('0x7')](_0x8e83('0xc'),auth[_0x8e83('0xa')](),controller[_0x8e83('0xd')]);router[_0x8e83('0xe')]('/',auth[_0x8e83('0xa')](),controller[_0x8e83('0xf')]);router[_0x8e83('0x10')](_0x8e83('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x8e83('0x11')](_0x8e83('0xc'),auth[_0x8e83('0xa')](),controller[_0x8e83('0x12')]);module[_0x8e83('0x13')]=router; \ No newline at end of file +var _0xa965=['Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','put','update','destroy','exports','util','path','connect-timeout','express'];(function(_0x2b676e,_0x4760e1){var _0x255e2d=function(_0xd33989){while(--_0xd33989){_0x2b676e['push'](_0x2b676e['shift']());}};_0x255e2d(++_0x4760e1);}(_0xa965,0x13f));var _0x5a96=function(_0x7d5a8b,_0x2aedef){_0x7d5a8b=_0x7d5a8b-0x0;var _0x56ac46=_0xa965[_0x7d5a8b];return _0x56ac46;};'use strict';var multer=require('multer');var util=require(_0x5a96('0x0'));var path=require(_0x5a96('0x1'));var timeout=require(_0x5a96('0x2'));var express=require(_0x5a96('0x3'));var router=express[_0x5a96('0x4')]();var fs_extra=require(_0x5a96('0x5'));var auth=require(_0x5a96('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5a96('0x7'));var controller=require(_0x5a96('0x8'));router[_0x5a96('0x9')]('/',auth[_0x5a96('0xa')](),controller[_0x5a96('0xb')]);router[_0x5a96('0x9')](_0x5a96('0xc'),auth[_0x5a96('0xa')](),controller[_0x5a96('0xd')]);router[_0x5a96('0x9')](_0x5a96('0xe'),auth[_0x5a96('0xa')](),controller['show']);router['post']('/',auth[_0x5a96('0xa')](),controller['create']);router[_0x5a96('0xf')](_0x5a96('0xe'),auth[_0x5a96('0xa')](),controller[_0x5a96('0x10')]);router['delete'](_0x5a96('0xe'),auth[_0x5a96('0xa')](),controller[_0x5a96('0x11')]);module[_0x5a96('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 94703f0..b3a3191 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 _0x49aa=['sequelize','exports','STRING','account','agent','queue','DATE'];(function(_0x5d2e28,_0x6fe58a){var _0x2a74ce=function(_0x303191){while(--_0x303191){_0x5d2e28['push'](_0x5d2e28['shift']());}};_0x2a74ce(++_0x6fe58a);}(_0x49aa,0x173));var _0xa49a=function(_0x4f9b0e,_0xfa2589){_0x4f9b0e=_0x4f9b0e-0x0;var _0x128e55=_0x49aa[_0x4f9b0e];return _0x128e55;};'use strict';var Sequelize=require(_0xa49a('0x0'));module[_0xa49a('0x1')]={'uniqueid':{'type':Sequelize[_0xa49a('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xa49a('0x3'),_0xa49a('0x4'),_0xa49a('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xa49a('0x6')]}}; \ No newline at end of file +var _0x6739=['agent','sequelize','exports','STRING','ENUM','account'];(function(_0x5caa9a,_0x3e9265){var _0x233303=function(_0x2035d6){while(--_0x2035d6){_0x5caa9a['push'](_0x5caa9a['shift']());}};_0x233303(++_0x3e9265);}(_0x6739,0xd3));var _0x9673=function(_0x483fd1,_0x5b8054){_0x483fd1=_0x483fd1-0x0;var _0x5c1205=_0x6739[_0x483fd1];return _0x5c1205;};'use strict';var Sequelize=require(_0x9673('0x0'));module[_0x9673('0x1')]={'uniqueid':{'type':Sequelize[_0x9673('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9673('0x3')](_0x9673('0x4'),_0x9673('0x5'),'queue'),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 6be93cc..7048e94 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 _0x3260=['find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','json','offset','undefined','count','limit','status','set','Content-Range','apply','update','then','error','stack','name','index','map','WhatsappTransferReport','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','options','includeAll','include','findAll','catch','show','rawAttributes'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0x3260,0xd7));var _0x0326=function(_0x221b48,_0x18067f){_0x221b48=_0x221b48-0x0;var _0x360677=_0x3260[_0x221b48];return _0x360677;};'use strict';var emlformat=require(_0x0326('0x0'));var rimraf=require(_0x0326('0x1'));var zipdir=require(_0x0326('0x2'));var jsonpatch=require(_0x0326('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0326('0x4'));var Mustache=require(_0x0326('0x5'));var util=require(_0x0326('0x6'));var path=require(_0x0326('0x7'));var sox=require('sox');var csv=require(_0x0326('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0326('0x9'));var squel=require(_0x0326('0xa'));var crypto=require(_0x0326('0xb'));var jsforce=require(_0x0326('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x0326('0x8'));var querystring=require(_0x0326('0xd'));var Papa=require(_0x0326('0xe'));var Redis=require(_0x0326('0xf'));var authService=require(_0x0326('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x0326('0x11'));var hardwareService=require(_0x0326('0x12'));var logger=require(_0x0326('0x13'))(_0x0326('0x14'));var utils=require('../../config/utils');var config=require(_0x0326('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x0326('0x16'))['db'];function respondWithStatusCode(_0x1a9442,_0xd8548e){_0xd8548e=_0xd8548e||0xcc;return function(_0x3d99ee){if(_0x3d99ee){return _0x1a9442[_0x0326('0x17')](_0xd8548e);}return _0x1a9442['status'](_0xd8548e)[_0x0326('0x18')]();};}function respondWithResult(_0x311ccb,_0x5f06ca){_0x5f06ca=_0x5f06ca||0xc8;return function(_0x49ce42){if(_0x49ce42){return _0x311ccb['status'](_0x5f06ca)[_0x0326('0x19')](_0x49ce42);}};}function respondWithFilteredResult(_0x489809,_0x56da2b){return function(_0x148bb3){if(_0x148bb3){var _0x1f53c2=typeof _0x56da2b[_0x0326('0x1a')]===_0x0326('0x1b')&&typeof _0x56da2b['limit']===_0x0326('0x1b');var _0x412e40=_0x148bb3[_0x0326('0x1c')];var _0x5d5064=_0x1f53c2?0x0:_0x56da2b[_0x0326('0x1a')];var _0x358c66=_0x1f53c2?_0x148bb3[_0x0326('0x1c')]:_0x56da2b['offset']+_0x56da2b[_0x0326('0x1d')];var _0x6433fb;if(_0x358c66>=_0x412e40){_0x358c66=_0x412e40;_0x6433fb=0xc8;}else{_0x6433fb=0xce;}_0x489809[_0x0326('0x1e')](_0x6433fb);return _0x489809[_0x0326('0x1f')](_0x0326('0x20'),_0x5d5064+'-'+_0x358c66+'/'+_0x412e40)[_0x0326('0x19')](_0x148bb3);}return null;};}function patchUpdates(_0x51efee){return function(_0x27a6e5){try{jsonpatch[_0x0326('0x21')](_0x27a6e5,_0x51efee,!![]);}catch(_0x25ae0c){return BPromise['reject'](_0x25ae0c);}return _0x27a6e5['save']();};}function saveUpdates(_0x1feb41,_0x3a6e4b){return function(_0x1ae0e8){if(_0x1ae0e8){return _0x1ae0e8[_0x0326('0x22')](_0x1feb41)[_0x0326('0x23')](function(_0x1e5a93){return _0x1e5a93;});}return null;};}function removeEntity(_0x259278,_0x388235){return function(_0x7eaf4c){if(_0x7eaf4c){return _0x7eaf4c['destroy']()[_0x0326('0x23')](function(){_0x259278[_0x0326('0x1e')](0xcc)[_0x0326('0x18')]();});}};}function handleEntityNotFound(_0x3246dd,_0x5bf286){return function(_0x20c8fa){if(!_0x20c8fa){_0x3246dd[_0x0326('0x17')](0x194);}return _0x20c8fa;};}function handleError(_0x2bc3b3,_0x286dc8){_0x286dc8=_0x286dc8||0x1f4;return function(_0x48125e){logger[_0x0326('0x24')](_0x48125e[_0x0326('0x25')]);if(_0x48125e['name']){delete _0x48125e[_0x0326('0x26')];}_0x2bc3b3[_0x0326('0x1e')](_0x286dc8)['send'](_0x48125e);};}exports[_0x0326('0x27')]=function(_0x316beb,_0x26925f){var _0x54a834={},_0x3923f6={},_0x44a579={'count':0x0,'rows':[]};var _0x13e903=_[_0x0326('0x28')](db[_0x0326('0x29')]['rawAttributes'],function(_0x5d2555){return{'name':_0x5d2555['fieldName'],'type':_0x5d2555[_0x0326('0x2a')][_0x0326('0x2b')]};});_0x3923f6[_0x0326('0x2c')]=_[_0x0326('0x28')](_0x13e903,_0x0326('0x26'));_0x3923f6[_0x0326('0x2d')]=_[_0x0326('0x2e')](_0x316beb[_0x0326('0x2d')]);_0x3923f6[_0x0326('0x2f')]=_[_0x0326('0x30')](_0x3923f6[_0x0326('0x2c')],_0x3923f6['query']);_0x54a834[_0x0326('0x31')]=_['intersection'](_0x3923f6[_0x0326('0x2c')],qs[_0x0326('0x32')](_0x316beb[_0x0326('0x2d')]['fields']));_0x54a834[_0x0326('0x31')]=_0x54a834[_0x0326('0x31')][_0x0326('0x33')]?_0x54a834['attributes']:_0x3923f6[_0x0326('0x2c')];if(!_0x316beb[_0x0326('0x2d')][_0x0326('0x34')](_0x0326('0x35'))){_0x54a834['limit']=qs['limit'](_0x316beb[_0x0326('0x2d')][_0x0326('0x1d')]);_0x54a834[_0x0326('0x1a')]=qs['offset'](_0x316beb[_0x0326('0x2d')]['offset']);}_0x54a834['order']=qs['sort'](_0x316beb[_0x0326('0x2d')][_0x0326('0x36')]);_0x54a834[_0x0326('0x37')]=qs[_0x0326('0x2f')](_['pick'](_0x316beb['query'],_0x3923f6['filters']),_0x13e903);if(_0x316beb[_0x0326('0x2d')][_0x0326('0x38')]){_0x54a834[_0x0326('0x37')]=_['merge'](_0x54a834[_0x0326('0x37')],{'$or':_[_0x0326('0x28')](_0x13e903,function(_0x419e09){if(_0x419e09[_0x0326('0x2a')]!=='VIRTUAL'){var _0x205510={};_0x205510[_0x419e09[_0x0326('0x26')]]={'$like':'%'+_0x316beb[_0x0326('0x2d')][_0x0326('0x38')]+'%'};return _0x205510;}})});}_0x54a834=_[_0x0326('0x39')]({},_0x54a834,_0x316beb[_0x0326('0x3a')]);var _0x15be6b={'where':_0x54a834[_0x0326('0x37')]};return db[_0x0326('0x29')][_0x0326('0x1c')](_0x15be6b)[_0x0326('0x23')](function(_0x5b2124){_0x44a579['count']=_0x5b2124;if(_0x316beb[_0x0326('0x2d')][_0x0326('0x3b')]){_0x54a834[_0x0326('0x3c')]=[{'all':!![]}];}return db['WhatsappTransferReport'][_0x0326('0x3d')](_0x54a834);})[_0x0326('0x23')](function(_0xaa0014){_0x44a579['rows']=_0xaa0014;return _0x44a579;})[_0x0326('0x23')](respondWithFilteredResult(_0x26925f,_0x54a834))[_0x0326('0x3e')](handleError(_0x26925f,null));};exports[_0x0326('0x3f')]=function(_0x1970be,_0x210708){var _0x18d02b={'raw':!![],'where':{'id':_0x1970be['params']['id']}},_0x4b9414={};_0x4b9414[_0x0326('0x2c')]=_['keys'](db[_0x0326('0x29')][_0x0326('0x40')]);_0x4b9414[_0x0326('0x2d')]=_['keys'](_0x1970be[_0x0326('0x2d')]);_0x4b9414['filters']=_[_0x0326('0x30')](_0x4b9414[_0x0326('0x2c')],_0x4b9414[_0x0326('0x2d')]);_0x18d02b[_0x0326('0x31')]=_['intersection'](_0x4b9414[_0x0326('0x2c')],qs[_0x0326('0x32')](_0x1970be['query'][_0x0326('0x32')]));_0x18d02b[_0x0326('0x31')]=_0x18d02b['attributes'][_0x0326('0x33')]?_0x18d02b[_0x0326('0x31')]:_0x4b9414['model'];if(_0x1970be[_0x0326('0x2d')][_0x0326('0x3b')]){_0x18d02b[_0x0326('0x3c')]=[{'all':!![]}];}_0x18d02b=_['merge']({},_0x18d02b,_0x1970be[_0x0326('0x3a')]);return db[_0x0326('0x29')][_0x0326('0x41')](_0x18d02b)[_0x0326('0x23')](handleEntityNotFound(_0x210708,null))[_0x0326('0x23')](respondWithResult(_0x210708,null))[_0x0326('0x3e')](handleError(_0x210708,null));};exports[_0x0326('0x42')]=function(_0x38fd3d,_0x23ff58){return db[_0x0326('0x29')][_0x0326('0x42')](_0x38fd3d[_0x0326('0x43')],{})['then'](respondWithResult(_0x23ff58,0xc9))[_0x0326('0x3e')](handleError(_0x23ff58,null));};exports[_0x0326('0x22')]=function(_0x2f4919,_0x2b729c){if(_0x2f4919[_0x0326('0x43')]['id']){delete _0x2f4919['body']['id'];}return db['WhatsappTransferReport'][_0x0326('0x41')]({'where':{'id':_0x2f4919[_0x0326('0x44')]['id']}})[_0x0326('0x23')](handleEntityNotFound(_0x2b729c,null))[_0x0326('0x23')](saveUpdates(_0x2f4919[_0x0326('0x43')],null))[_0x0326('0x23')](respondWithResult(_0x2b729c,null))[_0x0326('0x3e')](handleError(_0x2b729c,null));};exports['destroy']=function(_0x19f567,_0x5a5374){return db['WhatsappTransferReport']['find']({'where':{'id':_0x19f567[_0x0326('0x44')]['id']}})[_0x0326('0x23')](handleEntityNotFound(_0x5a5374,null))[_0x0326('0x23')](removeEntity(_0x5a5374,null))[_0x0326('0x3e')](handleError(_0x5a5374,null));};exports[_0x0326('0x45')]=function(_0x18e96,_0x546570){return db['WhatsappTransferReport'][_0x0326('0x45')]()['then'](respondWithResult(_0x546570,null))[_0x0326('0x3e')](handleError(_0x546570,null));}; \ No newline at end of file +var _0x1b62=['query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','include','catch','show','params','rawAttributes','find','create','body','describe','eml-format','rimraf','zip-dir','bluebird','util','to-csv','fs-extra','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','sendStatus','stack','name','index','WhatsappTransferReport','fieldName','key','model','map'];(function(_0x3478dd,_0x34c7e7){var _0x439dc0=function(_0x5673ac){while(--_0x5673ac){_0x3478dd['push'](_0x3478dd['shift']());}};_0x439dc0(++_0x34c7e7);}(_0x1b62,0x199));var _0x21b6=function(_0x9729d7,_0x1b79a8){_0x9729d7=_0x9729d7-0x0;var _0x3c4ac6=_0x1b62[_0x9729d7];return _0x3c4ac6;};'use strict';var emlformat=require(_0x21b6('0x0'));var rimraf=require(_0x21b6('0x1'));var zipdir=require(_0x21b6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x21b6('0x3'));var Mustache=require('mustache');var util=require(_0x21b6('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x21b6('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x21b6('0x6'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x21b6('0x7'));var deskjs=require('desk.js');var toCsv=require(_0x21b6('0x5'));var querystring=require('querystring');var Papa=require(_0x21b6('0x8'));var Redis=require(_0x21b6('0x9'));var authService=require(_0x21b6('0xa'));var qs=require(_0x21b6('0xb'));var as=require(_0x21b6('0xc'));var hardwareService=require(_0x21b6('0xd'));var logger=require('../../config/logger')(_0x21b6('0xe'));var utils=require('../../config/utils');var config=require(_0x21b6('0xf'));var licenseUtil=require('../../config/license/util');var db=require(_0x21b6('0x10'))['db'];function respondWithStatusCode(_0x2d7aff,_0x34282e){_0x34282e=_0x34282e||0xcc;return function(_0x135c57){if(_0x135c57){return _0x2d7aff['sendStatus'](_0x34282e);}return _0x2d7aff[_0x21b6('0x11')](_0x34282e)[_0x21b6('0x12')]();};}function respondWithResult(_0x1d0ee5,_0x4bba16){_0x4bba16=_0x4bba16||0xc8;return function(_0xd8f0a4){if(_0xd8f0a4){return _0x1d0ee5[_0x21b6('0x11')](_0x4bba16)[_0x21b6('0x13')](_0xd8f0a4);}};}function respondWithFilteredResult(_0x3f0c65,_0x56266d){return function(_0x27f679){if(_0x27f679){var _0x10095d=typeof _0x56266d[_0x21b6('0x14')]===_0x21b6('0x15')&&typeof _0x56266d[_0x21b6('0x16')]==='undefined';var _0x31ab63=_0x27f679[_0x21b6('0x17')];var _0x90d55c=_0x10095d?0x0:_0x56266d[_0x21b6('0x14')];var _0x14e100=_0x10095d?_0x27f679['count']:_0x56266d[_0x21b6('0x14')]+_0x56266d[_0x21b6('0x16')];var _0x158331;if(_0x14e100>=_0x31ab63){_0x14e100=_0x31ab63;_0x158331=0xc8;}else{_0x158331=0xce;}_0x3f0c65[_0x21b6('0x11')](_0x158331);return _0x3f0c65['set']('Content-Range',_0x90d55c+'-'+_0x14e100+'/'+_0x31ab63)[_0x21b6('0x13')](_0x27f679);}return null;};}function patchUpdates(_0x8e9ce1){return function(_0x18ae33){try{jsonpatch[_0x21b6('0x18')](_0x18ae33,_0x8e9ce1,!![]);}catch(_0x2ecfc7){return BPromise[_0x21b6('0x19')](_0x2ecfc7);}return _0x18ae33[_0x21b6('0x1a')]();};}function saveUpdates(_0x3fa192,_0x47466a){return function(_0x1d88bd){if(_0x1d88bd){return _0x1d88bd[_0x21b6('0x1b')](_0x3fa192)[_0x21b6('0x1c')](function(_0x2a3786){return _0x2a3786;});}return null;};}function removeEntity(_0x59abe6,_0x8b8783){return function(_0x12c958){if(_0x12c958){return _0x12c958[_0x21b6('0x1d')]()[_0x21b6('0x1c')](function(){_0x59abe6[_0x21b6('0x11')](0xcc)[_0x21b6('0x12')]();});}};}function handleEntityNotFound(_0x2a58b3,_0x258dca){return function(_0x27cfa){if(!_0x27cfa){_0x2a58b3[_0x21b6('0x1e')](0x194);}return _0x27cfa;};}function handleError(_0xe68d3f,_0x20b084){_0x20b084=_0x20b084||0x1f4;return function(_0xcee47e){logger['error'](_0xcee47e[_0x21b6('0x1f')]);if(_0xcee47e[_0x21b6('0x20')]){delete _0xcee47e[_0x21b6('0x20')];}_0xe68d3f['status'](_0x20b084)['send'](_0xcee47e);};}exports[_0x21b6('0x21')]=function(_0x2e21f6,_0x1ccfb2){var _0x4c533f={},_0x3cf57f={},_0x1ff2a6={'count':0x0,'rows':[]};var _0x2de567=_['map'](db[_0x21b6('0x22')]['rawAttributes'],function(_0x2f5a7e){return{'name':_0x2f5a7e[_0x21b6('0x23')],'type':_0x2f5a7e['type'][_0x21b6('0x24')]};});_0x3cf57f[_0x21b6('0x25')]=_[_0x21b6('0x26')](_0x2de567,_0x21b6('0x20'));_0x3cf57f[_0x21b6('0x27')]=_[_0x21b6('0x28')](_0x2e21f6[_0x21b6('0x27')]);_0x3cf57f[_0x21b6('0x29')]=_[_0x21b6('0x2a')](_0x3cf57f['model'],_0x3cf57f[_0x21b6('0x27')]);_0x4c533f[_0x21b6('0x2b')]=_[_0x21b6('0x2a')](_0x3cf57f[_0x21b6('0x25')],qs[_0x21b6('0x2c')](_0x2e21f6[_0x21b6('0x27')][_0x21b6('0x2c')]));_0x4c533f['attributes']=_0x4c533f[_0x21b6('0x2b')]['length']?_0x4c533f[_0x21b6('0x2b')]:_0x3cf57f['model'];if(!_0x2e21f6[_0x21b6('0x27')][_0x21b6('0x2d')](_0x21b6('0x2e'))){_0x4c533f[_0x21b6('0x16')]=qs[_0x21b6('0x16')](_0x2e21f6[_0x21b6('0x27')][_0x21b6('0x16')]);_0x4c533f[_0x21b6('0x14')]=qs[_0x21b6('0x14')](_0x2e21f6['query'][_0x21b6('0x14')]);}_0x4c533f[_0x21b6('0x2f')]=qs[_0x21b6('0x30')](_0x2e21f6[_0x21b6('0x27')][_0x21b6('0x30')]);_0x4c533f['where']=qs[_0x21b6('0x29')](_[_0x21b6('0x31')](_0x2e21f6[_0x21b6('0x27')],_0x3cf57f[_0x21b6('0x29')]),_0x2de567);if(_0x2e21f6[_0x21b6('0x27')][_0x21b6('0x32')]){_0x4c533f[_0x21b6('0x33')]=_['merge'](_0x4c533f[_0x21b6('0x33')],{'$or':_[_0x21b6('0x26')](_0x2de567,function(_0xa19bbb){if(_0xa19bbb['type']!==_0x21b6('0x34')){var _0x184710={};_0x184710[_0xa19bbb[_0x21b6('0x20')]]={'$like':'%'+_0x2e21f6[_0x21b6('0x27')][_0x21b6('0x32')]+'%'};return _0x184710;}})});}_0x4c533f=_[_0x21b6('0x35')]({},_0x4c533f,_0x2e21f6[_0x21b6('0x36')]);var _0x2e8a82={'where':_0x4c533f[_0x21b6('0x33')]};return db[_0x21b6('0x22')][_0x21b6('0x17')](_0x2e8a82)[_0x21b6('0x1c')](function(_0x37ac61){_0x1ff2a6[_0x21b6('0x17')]=_0x37ac61;if(_0x2e21f6[_0x21b6('0x27')]['includeAll']){_0x4c533f[_0x21b6('0x37')]=[{'all':!![]}];}return db[_0x21b6('0x22')]['findAll'](_0x4c533f);})[_0x21b6('0x1c')](function(_0x1f8176){_0x1ff2a6['rows']=_0x1f8176;return _0x1ff2a6;})[_0x21b6('0x1c')](respondWithFilteredResult(_0x1ccfb2,_0x4c533f))[_0x21b6('0x38')](handleError(_0x1ccfb2,null));};exports[_0x21b6('0x39')]=function(_0x47d0c0,_0x1e5881){var _0x5095f2={'raw':!![],'where':{'id':_0x47d0c0[_0x21b6('0x3a')]['id']}},_0x520577={};_0x520577[_0x21b6('0x25')]=_[_0x21b6('0x28')](db[_0x21b6('0x22')][_0x21b6('0x3b')]);_0x520577[_0x21b6('0x27')]=_[_0x21b6('0x28')](_0x47d0c0[_0x21b6('0x27')]);_0x520577['filters']=_['intersection'](_0x520577[_0x21b6('0x25')],_0x520577[_0x21b6('0x27')]);_0x5095f2['attributes']=_[_0x21b6('0x2a')](_0x520577['model'],qs[_0x21b6('0x2c')](_0x47d0c0['query'][_0x21b6('0x2c')]));_0x5095f2[_0x21b6('0x2b')]=_0x5095f2[_0x21b6('0x2b')]['length']?_0x5095f2['attributes']:_0x520577[_0x21b6('0x25')];if(_0x47d0c0[_0x21b6('0x27')]['includeAll']){_0x5095f2[_0x21b6('0x37')]=[{'all':!![]}];}_0x5095f2=_['merge']({},_0x5095f2,_0x47d0c0['options']);return db[_0x21b6('0x22')][_0x21b6('0x3c')](_0x5095f2)[_0x21b6('0x1c')](handleEntityNotFound(_0x1e5881,null))[_0x21b6('0x1c')](respondWithResult(_0x1e5881,null))[_0x21b6('0x38')](handleError(_0x1e5881,null));};exports[_0x21b6('0x3d')]=function(_0x1479d4,_0x50185d){return db[_0x21b6('0x22')][_0x21b6('0x3d')](_0x1479d4[_0x21b6('0x3e')],{})[_0x21b6('0x1c')](respondWithResult(_0x50185d,0xc9))[_0x21b6('0x38')](handleError(_0x50185d,null));};exports[_0x21b6('0x1b')]=function(_0x3040ee,_0x3de8be){if(_0x3040ee[_0x21b6('0x3e')]['id']){delete _0x3040ee[_0x21b6('0x3e')]['id'];}return db[_0x21b6('0x22')][_0x21b6('0x3c')]({'where':{'id':_0x3040ee[_0x21b6('0x3a')]['id']}})['then'](handleEntityNotFound(_0x3de8be,null))[_0x21b6('0x1c')](saveUpdates(_0x3040ee[_0x21b6('0x3e')],null))['then'](respondWithResult(_0x3de8be,null))[_0x21b6('0x38')](handleError(_0x3de8be,null));};exports['destroy']=function(_0x4d227b,_0x175251){return db[_0x21b6('0x22')]['find']({'where':{'id':_0x4d227b['params']['id']}})[_0x21b6('0x1c')](handleEntityNotFound(_0x175251,null))[_0x21b6('0x1c')](removeEntity(_0x175251,null))[_0x21b6('0x38')](handleError(_0x175251,null));};exports[_0x21b6('0x3f')]=function(_0x543e90,_0x2d0e57){return db['WhatsappTransferReport']['describe']()['then'](respondWithResult(_0x2d0e57,null))['catch'](handleError(_0x2d0e57,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 6322473..9c892cd 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 _0xd0e0=['request-promise','path','rimraf','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','uniqueid','lodash','util','../../config/logger','moment'];(function(_0x2d7836,_0x5a5412){var _0x491179=function(_0xaafd3){while(--_0xaafd3){_0x2d7836['push'](_0x2d7836['shift']());}};_0x491179(++_0x5a5412);}(_0xd0e0,0xf8));var _0x0d0e=function(_0xef3bf0,_0x2eceee){_0xef3bf0=_0xef3bf0-0x0;var _0x469220=_0xd0e0[_0xef3bf0];return _0x469220;};'use strict';var _=require(_0x0d0e('0x0'));var util=require(_0x0d0e('0x1'));var logger=require(_0x0d0e('0x2'))('api');var moment=require(_0x0d0e('0x3'));var BPromise=require('bluebird');var rp=require(_0x0d0e('0x4'));var fs=require('fs');var path=require(_0x0d0e('0x5'));var rimraf=require(_0x0d0e('0x6'));var config=require('../../config/environment');var attributes=require(_0x0d0e('0x7'));module[_0x0d0e('0x8')]=function(_0x2a4b8b,_0x1c2dac){return _0x2a4b8b[_0x0d0e('0x9')](_0x0d0e('0xa'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':_0x0d0e('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x4ee8=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','WhatsappTransferReport','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x2b9c78,_0x1e51d9){var _0x333762=function(_0x2b9c35){while(--_0x2b9c35){_0x2b9c78['push'](_0x2b9c78['shift']());}};_0x333762(++_0x1e51d9);}(_0x4ee8,0x79));var _0x84ee=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x4ee8[_0x5d6456];return _0x4d66c1;};'use strict';var _=require(_0x84ee('0x0'));var util=require(_0x84ee('0x1'));var logger=require(_0x84ee('0x2'))(_0x84ee('0x3'));var moment=require(_0x84ee('0x4'));var BPromise=require(_0x84ee('0x5'));var rp=require(_0x84ee('0x6'));var fs=require('fs');var path=require(_0x84ee('0x7'));var rimraf=require(_0x84ee('0x8'));var config=require(_0x84ee('0x9'));var attributes=require('./whatsappTransferReport.attributes');module[_0x84ee('0xa')]=function(_0x348018,_0x186685){return _0x348018[_0x84ee('0xb')](_0x84ee('0xc'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':_0x84ee('0xd'),'fields':[_0x84ee('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 1499038..ef0f574 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 _0x6bbc=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','WhatsappTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x28f32c,_0x4cc342){var _0x355402=function(_0xdb5032){while(--_0xdb5032){_0x28f32c['push'](_0x28f32c['shift']());}};_0x355402(++_0x4cc342);}(_0x6bbc,0xcc));var _0xc6bb=function(_0x182456,_0x1d9d59){_0x182456=_0x182456-0x0;var _0x433c23=_0x6bbc[_0x182456];return _0x433c23;};'use strict';var _=require(_0xc6bb('0x0'));var util=require(_0xc6bb('0x1'));var moment=require(_0xc6bb('0x2'));var BPromise=require(_0xc6bb('0x3'));var rs=require(_0xc6bb('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc6bb('0x5'));var logger=require(_0xc6bb('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc6bb('0x7'));var client=jayson[_0xc6bb('0x8')][_0xc6bb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x61a6fd,_0x4dd655,_0x4df101){return new BPromise(function(_0x2a3c72,_0x514aee){return client[_0xc6bb('0xa')](_0x61a6fd,_0x4df101)[_0xc6bb('0xb')](function(_0x5547d0){logger[_0xc6bb('0xc')](_0xc6bb('0xd'),_0x4dd655,_0xc6bb('0xe'));logger['debug'](_0xc6bb('0xf'),_0x4dd655,_0xc6bb('0xe'),JSON[_0xc6bb('0x10')](_0x5547d0));if(_0x5547d0[_0xc6bb('0x11')]){if(_0x5547d0[_0xc6bb('0x11')][_0xc6bb('0x12')]===0x1f4){logger[_0xc6bb('0x11')](_0xc6bb('0xd'),_0x4dd655,_0x5547d0['error'][_0xc6bb('0x13')]);return _0x514aee(_0x5547d0['error'][_0xc6bb('0x13')]);}logger[_0xc6bb('0x11')](_0xc6bb('0xd'),_0x4dd655,_0x5547d0[_0xc6bb('0x11')][_0xc6bb('0x13')]);return _0x2a3c72(_0x5547d0[_0xc6bb('0x11')][_0xc6bb('0x13')]);}else{logger['info']('WhatsappTransferReport,\x20%s,\x20%s',_0x4dd655,_0xc6bb('0xe'));_0x2a3c72(_0x5547d0[_0xc6bb('0x14')][_0xc6bb('0x13')]);}})[_0xc6bb('0x15')](function(_0x1c370d){logger[_0xc6bb('0x11')](_0xc6bb('0xd'),_0x4dd655,_0x1c370d);_0x514aee(_0x1c370d);});});} \ No newline at end of file +var _0x6583=['rpc','client','then','WhatsappTransferReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x1b2b7e,_0x543746){var _0x598f57=function(_0x5bfd9f){while(--_0x5bfd9f){_0x1b2b7e['push'](_0x1b2b7e['shift']());}};_0x598f57(++_0x543746);}(_0x6583,0x6c));var _0x3658=function(_0x4978de,_0x5912e4){_0x4978de=_0x4978de-0x0;var _0x675221=_0x6583[_0x4978de];return _0x675221;};'use strict';var _=require(_0x3658('0x0'));var util=require('util');var moment=require(_0x3658('0x1'));var BPromise=require(_0x3658('0x2'));var rs=require(_0x3658('0x3'));var fs=require('fs');var Redis=require(_0x3658('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3658('0x5'));var logger=require('../../config/logger')(_0x3658('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3658('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x50316f,_0x1e6aad,_0x1a48e2){return new BPromise(function(_0x22e3d1,_0xe68c81){return client['request'](_0x50316f,_0x1a48e2)[_0x3658('0x8')](function(_0x27a49a){logger['info'](_0x3658('0x9'),_0x1e6aad,'request\x20sent');logger[_0x3658('0xa')]('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0x1e6aad,_0x3658('0xb'),JSON[_0x3658('0xc')](_0x27a49a));if(_0x27a49a[_0x3658('0xd')]){if(_0x27a49a[_0x3658('0xd')][_0x3658('0xe')]===0x1f4){logger['error']('WhatsappTransferReport,\x20%s,\x20%s',_0x1e6aad,_0x27a49a['error'][_0x3658('0xf')]);return _0xe68c81(_0x27a49a['error'][_0x3658('0xf')]);}logger[_0x3658('0xd')](_0x3658('0x9'),_0x1e6aad,_0x27a49a['error'][_0x3658('0xf')]);return _0x22e3d1(_0x27a49a['error'][_0x3658('0xf')]);}else{logger[_0x3658('0x10')](_0x3658('0x9'),_0x1e6aad,_0x3658('0xb'));_0x22e3d1(_0x27a49a[_0x3658('0x11')][_0x3658('0xf')]);}})[_0x3658('0x12')](function(_0x432d12){logger[_0x3658('0xd')](_0x3658('0x9'),_0x1e6aad,_0x432d12);_0xe68c81(_0x432d12);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 500a109..8a270d0 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa1f6=['number','length','\x20processes\x20failed\x20at\x20startup:\x20','pm2_env','name','Online\x20apps:','map','online','join','Offline\x20apps:','status','None','log','App\x20Ready!','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','lodash','./mysqldb','./config/seedDB','./config/license','./rpc','./config/environment','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','sync','then','default','listen','info','start','filter','exitCode'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xa1f6,0x19d));var _0x6a1f=function(_0x4b5813,_0x5769de){_0x4b5813=_0x4b5813-0x0;var _0x423465=_0xa1f6[_0x4b5813];return _0x423465;};'use strict';var _=require(_0x6a1f('0x0'));var db=require(_0x6a1f('0x1'))['db'];var seedDb=require(_0x6a1f('0x2'));var checkLicense=require(_0x6a1f('0x3'));var rpc=require(_0x6a1f('0x4'));var config=require(_0x6a1f('0x5'));var logger=require('./config/logger')('app');var pm2=require('./config/pm2');var pm2Config=require('./config/pm2/config');var schedule=require('./config/schedule');var chat=require(_0x6a1f('0x6'));var whatsapp=require(_0x6a1f('0x7'));var transcribe=require(_0x6a1f('0x8'));var provider=require(_0x6a1f('0x9'));function main(){return db[_0x6a1f('0xa')][_0x6a1f('0xb')]()[_0x6a1f('0xc')](function(){if(config['seedDB']){return seedDb[_0x6a1f('0xd')]();}})[_0x6a1f('0xc')](function(){return checkLicense[_0x6a1f('0xd')]();})[_0x6a1f('0xc')](function(){return rpc[_0x6a1f('0xe')]();})['then'](function(_0x30fd4e){logger[_0x6a1f('0xf')](_0x30fd4e);return chat[_0x6a1f('0x10')]();})[_0x6a1f('0xc')](function(){return whatsapp['start']();})[_0x6a1f('0xc')](function(){return schedule['start']();})[_0x6a1f('0xc')](function(){return transcribe[_0x6a1f('0x10')]();})[_0x6a1f('0xc')](function(){return provider[_0x6a1f('0x10')]();})[_0x6a1f('0xc')](function(_0x271342){logger[_0x6a1f('0xf')](_0x271342);return pm2[_0x6a1f('0x10')](pm2Config);})[_0x6a1f('0xc')](function(_0x27d8f8){var _0x2d2b79=_0x27d8f8[_0x6a1f('0x11')](function(_0x253305){return typeof _0x253305[_0x6a1f('0x12')]===_0x6a1f('0x13')&&_0x253305[_0x6a1f('0x12')]>=0x0;});if(_0x2d2b79[_0x6a1f('0x14')]>0x0){throw new Error(_0x2d2b79[_0x6a1f('0x14')]+_0x6a1f('0x15')+_['map'](_0x2d2b79,function(_0x392ccb){return'\x22'+_0x392ccb[_0x6a1f('0x16')][_0x6a1f('0x17')]+'\x22';}));}logger[_0x6a1f('0xf')](_0x6a1f('0x18'),_[_0x6a1f('0x19')](_[_0x6a1f('0x11')](_0x27d8f8,{'status':_0x6a1f('0x1a')}),'name')[_0x6a1f('0x1b')]());logger['info'](_0x6a1f('0x1c'),_[_0x6a1f('0x19')](_[_0x6a1f('0x11')](_0x27d8f8,function(_0x1b5856){return _0x1b5856[_0x6a1f('0x1d')]!=='online';}),_0x6a1f('0x17'))[_0x6a1f('0x1b')]()||_0x6a1f('0x1e'));console[_0x6a1f('0x1f')](_0x6a1f('0x20'));})[_0x6a1f('0x21')](function(_0x298830){console[_0x6a1f('0x1f')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error!',_0x298830);logger[_0x6a1f('0x22')](_0x6a1f('0x23'),_0x298830);process['exit'](0x1);});}main(); \ No newline at end of file +var _0x1ffe=['catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./config/seedDB','./config/license','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/cloud-provider','sequelize','sync','then','seedDB','default','listen','info','start','filter','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','Online\x20apps:','online','join','Offline\x20apps:','status','name','None','log','App\x20Ready!'];(function(_0x76c90b,_0x4f75e8){var _0x5c5030=function(_0x1ff29e){while(--_0x1ff29e){_0x76c90b['push'](_0x76c90b['shift']());}};_0x5c5030(++_0x4f75e8);}(_0x1ffe,0xa5));var _0xe1ff=function(_0x3020c0,_0x5d2ca4){_0x3020c0=_0x3020c0-0x0;var _0x171c01=_0x1ffe[_0x3020c0];return _0x171c01;};'use strict';var _=require(_0xe1ff('0x0'));var db=require(_0xe1ff('0x1'))['db'];var seedDb=require(_0xe1ff('0x2'));var checkLicense=require(_0xe1ff('0x3'));var rpc=require(_0xe1ff('0x4'));var config=require(_0xe1ff('0x5'));var logger=require(_0xe1ff('0x6'))(_0xe1ff('0x7'));var pm2=require(_0xe1ff('0x8'));var pm2Config=require(_0xe1ff('0x9'));var schedule=require(_0xe1ff('0xa'));var chat=require(_0xe1ff('0xb'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require('./config/schedule/transcribe');var provider=require(_0xe1ff('0xc'));function main(){return db[_0xe1ff('0xd')][_0xe1ff('0xe')]()[_0xe1ff('0xf')](function(){if(config[_0xe1ff('0x10')]){return seedDb[_0xe1ff('0x11')]();}})[_0xe1ff('0xf')](function(){return checkLicense[_0xe1ff('0x11')]();})[_0xe1ff('0xf')](function(){return rpc[_0xe1ff('0x12')]();})[_0xe1ff('0xf')](function(_0x5f51d3){logger[_0xe1ff('0x13')](_0x5f51d3);return chat[_0xe1ff('0x14')]();})[_0xe1ff('0xf')](function(){return whatsapp[_0xe1ff('0x14')]();})[_0xe1ff('0xf')](function(){return schedule[_0xe1ff('0x14')]();})[_0xe1ff('0xf')](function(){return transcribe[_0xe1ff('0x14')]();})[_0xe1ff('0xf')](function(){return provider[_0xe1ff('0x14')]();})[_0xe1ff('0xf')](function(_0x1010ef){logger['info'](_0x1010ef);return pm2[_0xe1ff('0x14')](pm2Config);})[_0xe1ff('0xf')](function(_0x26511f){var _0x486942=_0x26511f[_0xe1ff('0x15')](function(_0x45597a){return typeof _0x45597a['exitCode']==='number'&&_0x45597a['exitCode']>=0x0;});if(_0x486942[_0xe1ff('0x16')]>0x0){throw new Error(_0x486942[_0xe1ff('0x16')]+_0xe1ff('0x17')+_[_0xe1ff('0x18')](_0x486942,function(_0x45c3be){return'\x22'+_0x45c3be[_0xe1ff('0x19')]['name']+'\x22';}));}logger['info'](_0xe1ff('0x1a'),_[_0xe1ff('0x18')](_[_0xe1ff('0x15')](_0x26511f,{'status':_0xe1ff('0x1b')}),'name')[_0xe1ff('0x1c')]());logger[_0xe1ff('0x13')](_0xe1ff('0x1d'),_[_0xe1ff('0x18')](_[_0xe1ff('0x15')](_0x26511f,function(_0x149cd7){return _0x149cd7[_0xe1ff('0x1e')]!==_0xe1ff('0x1b');}),_0xe1ff('0x1f'))[_0xe1ff('0x1c')]()||_0xe1ff('0x20'));console[_0xe1ff('0x21')](_0xe1ff('0x22'));})[_0xe1ff('0x23')](function(_0x37face){console[_0xe1ff('0x21')](_0xe1ff('0x24'),_0x37face);logger[_0xe1ff('0x25')](_0xe1ff('0x26'),_0x37face);process[_0xe1ff('0x27')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 915ffbe..493da62 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 _0xf3cd=['role','name','userpic','permissions','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','privacyEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','faxAutoanswerDelay','whatsappAutoanswerDelay','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','params','closed','disposition','then','status','unmanaged','json','authorization','startsWith','Basic','User','authenticate','catch','Bearer','query','apikey','getUuid','find','sub','allowedLoginAttempts','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','blockDuration','add','minutes','Invalid\x20API\x20access\x20key','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','Forbidden','isWebrtcLicence','webrtc','isMiddleware','cookie','motion.token','send','retrieveApiKey','isNil','apiKeyIat','regenerateApiKey','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','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','ValidationError','updatePasswordsHistory','length','splice','encryptString','promisify','sign','secret','payload','options','verify','randomBytes','toString','hex','floor','now','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','express-jwt','composable-middleware','basic-auth','bluebird','util','moment','secrets','session'];(function(_0x243004,_0x43999a){var _0x1bfbfc=function(_0x3b5fa2){while(--_0x3b5fa2){_0x243004['push'](_0x243004['shift']());}};_0x1bfbfc(++_0x43999a);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x258fb0,_0x5362dc){_0x258fb0=_0x258fb0-0x0;var _0x4d1afe=_0xf3cd[_0x258fb0];return _0x4d1afe;};'use strict';var db=require(_0xdf3c('0x0'))['db'];var config=require(_0xdf3c('0x1'));var hardwareConf=require(_0xdf3c('0x2'));var licenseUtil=require(_0xdf3c('0x3'));var encryptor=require(_0xdf3c('0x4'));var _=require(_0xdf3c('0x5'));var jwt=require('jsonwebtoken');var expressJwt=require(_0xdf3c('0x6'));var compose=require(_0xdf3c('0x7'));var basicAuth=require(_0xdf3c('0x8'));var crypto=require('crypto');var BPromise=require(_0xdf3c('0x9'));var util=require(_0xdf3c('0xa'));var moment=require(_0xdf3c('0xb'));var validateJwt=expressJwt({'secret':config[_0xdf3c('0xc')][_0xdf3c('0xd')]});var userAttributes=['id',_0xdf3c('0xe'),'fullname',_0xdf3c('0xf'),'internal','email',_0xdf3c('0x10'),_0xdf3c('0x11'),'md5secret',_0xdf3c('0x12'),_0xdf3c('0x13'),_0xdf3c('0x14'),_0xdf3c('0x15'),_0xdf3c('0x16'),_0xdf3c('0x17'),_0xdf3c('0x18'),_0xdf3c('0x19'),'lastLoginAt',_0xdf3c('0x1a'),_0xdf3c('0x1b'),_0xdf3c('0x1c'),_0xdf3c('0x1d'),'alias',_0xdf3c('0x1e'),_0xdf3c('0x1f'),_0xdf3c('0x20'),'phoneBarEnableRecording',_0xdf3c('0x21'),_0xdf3c('0x22'),_0xdf3c('0x23'),_0xdf3c('0x24'),_0xdf3c('0x25'),_0xdf3c('0x26'),_0xdf3c('0x27'),_0xdf3c('0x28'),_0xdf3c('0x29'),_0xdf3c('0x2a'),'settingsEnabled',_0xdf3c('0x2b'),_0xdf3c('0x2c'),_0xdf3c('0x2d'),_0xdf3c('0x2e'),_0xdf3c('0x2f'),_0xdf3c('0x30'),_0xdf3c('0x31'),_0xdf3c('0x32'),_0xdf3c('0x33'),_0xdf3c('0x34'),_0xdf3c('0x35'),_0xdf3c('0x36'),_0xdf3c('0x37'),'openchannelAutoanswerDelay','faxAutoanswer',_0xdf3c('0x38'),'whatsappAutoanswer',_0xdf3c('0x39')];exports[_0xdf3c('0x3a')]=function(){return this[_0xdf3c('0x3b')](!![])[_0xdf3c('0x3c')](function(_0x33652f,_0x36ba1c,_0x50d8ca){if(_0x33652f[_0xdf3c('0x3d')]){_0x50d8ca();}else{return db[_0xdf3c('0x3e')][_0xdf3c('0x3f')]({'where':{'id':_0x33652f[_0xdf3c('0x40')]['id']},'attributes':['id',_0xdf3c('0x41'),_0xdf3c('0x42')],'raw':!![]})[_0xdf3c('0x43')](function(_0x155f54){if(_0x155f54&&_0x155f54[_0xdf3c('0x41')]){return _0x36ba1c[_0xdf3c('0x44')](_0x155f54['disposition']===_0xdf3c('0x45')?0x195:0x193)[_0xdf3c('0x46')]({'message':_0x155f54['disposition']===_0xdf3c('0x45')?'Unmanaged.':'Forbidden.'});}else{_0x50d8ca();}})['catch'](function(_0x14aac9){_0x50d8ca(_0x14aac9);});}});};exports[_0xdf3c('0x3b')]=function isAuthenticated(_0x52b8f6){return compose()['use'](function(_0x37ecfd,_0x1f2ce4,_0xd3cfcb){var _0x1ccdd4;if(_0x37ecfd['headers'][_0xdf3c('0x47')]){if(_[_0xdf3c('0x48')](_0x37ecfd['headers']['authorization'],_0xdf3c('0x49'))){var _0x46f0e3=basicAuth(_0x37ecfd);db[_0xdf3c('0x4a')]['find']({'where':{'name':_0x46f0e3[_0xdf3c('0xf')]}})[_0xdf3c('0x43')](function(_0x21e7b8){if(!_0x21e7b8||!_0x21e7b8[_0xdf3c('0x4b')](_0x46f0e3['pass'])){return _0x1f2ce4[_0xdf3c('0x44')](0x191)[_0xdf3c('0x46')]({'message':'Wrong\x20credentials.'});}_0x37ecfd[_0xdf3c('0x3d')]={'id':_0x21e7b8['id']};_0xd3cfcb();})[_0xdf3c('0x4c')](function(_0x217a65){_0xd3cfcb(_0x217a65);});}else if(_[_0xdf3c('0x48')](_0x37ecfd['headers'][_0xdf3c('0x47')],_0xdf3c('0x4d'))){validateJwt(_0x37ecfd,_0x1f2ce4,_0xd3cfcb);}else{if(_0x52b8f6){_0xd3cfcb();}else{return _0x1f2ce4[_0xdf3c('0x44')](0x193)[_0xdf3c('0x46')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x37ecfd[_0xdf3c('0x4e')][_0xdf3c('0x4f')]){try{var _0x5ddd21={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xdf3c('0x50')]()};verifyJwt(_0x37ecfd['query'][_0xdf3c('0x4f')],_0x5ddd21)['then'](function(_0x57faba){return db['User'][_0xdf3c('0x51')]({'where':{'id':_0x57faba[_0xdf3c('0x52')]}})[_0xdf3c('0x43')](function(_0x29b5b7){_0x1ccdd4=_0x29b5b7;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0xdf3c('0x53'),'blockDuration'],'raw':!![]});})[_0xdf3c('0x43')](function(_0x17b502){if(!_0x1ccdd4||!_[_0xdf3c('0x54')](_0x1ccdd4[_0xdf3c('0x55')],_0x57faba[_0xdf3c('0x56')])){return _0x1f2ce4[_0xdf3c('0x44')](0x191)[_0xdf3c('0x46')]({'message':_0xdf3c('0x57')});}if(_0x1ccdd4[_0xdf3c('0x58')]){return _0x1f2ce4['status'](0x191)[_0xdf3c('0x46')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x1ccdd4['blocked']){if(_0x17b502[_0xdf3c('0x59')]>0x0){if(moment(_0x1ccdd4['blockedAt'])[_0xdf3c('0x5a')](_0x17b502['blockDuration'],_0xdf3c('0x5b'))>moment()){return _0x1f2ce4[_0xdf3c('0x44')](0x191)[_0xdf3c('0x46')]({'message':_0xdf3c('0x5c')});}}else{return _0x1f2ce4[_0xdf3c('0x44')](0x191)[_0xdf3c('0x46')]({'message':_0xdf3c('0x5c')});}}_0x37ecfd[_0xdf3c('0x3d')]={'id':_0x1ccdd4['id']};_0xd3cfcb();});})[_0xdf3c('0x4c')](function(){return _0x1f2ce4[_0xdf3c('0x44')](0x191)[_0xdf3c('0x46')]({'message':_0xdf3c('0x5c')});});}catch(_0x57e0ab){_0xd3cfcb(_0x57e0ab);}}else if(_0x52b8f6){_0xd3cfcb();}else{return _0x1f2ce4['status'](0x193)[_0xdf3c('0x46')]({'message':'Unknown\x20authorization\x20format'});}})[_0xdf3c('0x3c')](function(_0x14d8e1,_0x46194d,_0x328b18){if(_0x14d8e1['user']){db['User'][_0xdf3c('0x51')]({'where':{'id':_0x14d8e1[_0xdf3c('0x3d')]['id']},'attributes':userAttributes})[_0xdf3c('0x43')](function(_0x4c59ef){if(!_0x4c59ef){return _0x46194d[_0xdf3c('0x44')](0x194)[_0xdf3c('0x46')]({'message':_0xdf3c('0x5d')});}_0x14d8e1[_0xdf3c('0x3d')]=_0x4c59ef;_0x328b18();})['catch'](function(_0x127685){_0x328b18(_0x127685);});}else if(_0x52b8f6){_0x328b18();}else{return _0x46194d[_0xdf3c('0x44')](0x194)[_0xdf3c('0x46')]({'message':_0xdf3c('0x5e')});}});};exports[_0xdf3c('0x5f')]=function canUpdate(){return compose()['use'](function(_0x410aaf,_0x286b72,_0x437443){return licenseUtil[_0xdf3c('0x60')]()[_0xdf3c('0x43')](function(_0x344f1e){if(_0x344f1e['update']){_0x437443();}else{return _0x286b72['status'](0x193)[_0xdf3c('0x46')]({'message':_0xdf3c('0x61')});}})['catch'](function(_0x5c9885){_0x437443(_0x5c9885);});});};exports[_0xdf3c('0x62')]=function isWebrtcLicence(){return compose()[_0xdf3c('0x3c')](function(_0x46b2bd,_0x2aeb29,_0xaae4bc){return licenseUtil[_0xdf3c('0x60')]()[_0xdf3c('0x43')](function(_0x84c5c2){if(_0x84c5c2[_0xdf3c('0x63')]){_0xaae4bc();}else{return _0x2aeb29['status'](0x193)[_0xdf3c('0x46')]({'message':_0xdf3c('0x61')});}})[_0xdf3c('0x4c')](function(_0xe760dd){_0xaae4bc(_0xe760dd);});});};exports[_0xdf3c('0x64')]=function(_0x385824,_0x28a468,_0x553f70){_0x385824[_0xdf3c('0x64')]=!![];return _0x553f70();};exports['signToken']=function signToken(_0xa4e137){return signJwt(_0xa4e137);};exports['setTokenCookie']=function(_0x41b78c,_0x28144f){if(!_0x41b78c[_0xdf3c('0x3d')]){return _0x28144f[_0xdf3c('0x44')](0x194)['json']({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x4a068a={'payload':{'id':_0x41b78c[_0xdf3c('0x3d')]['id'],'role':_0x41b78c['user'][_0xdf3c('0xe')]},'options':{'expiresIn':0x15180}};return signJwt(_0x4a068a)[_0xdf3c('0x43')](function(_0x446713){_0x28144f[_0xdf3c('0x65')](_0xdf3c('0x66'),_0x446713);_0x28144f['redirect']('/dashboards/general');})[_0xdf3c('0x4c')](function(_0x27a541){return _0x28144f['status'](0x1f4)[_0xdf3c('0x67')](_0x27a541);});};exports[_0xdf3c('0x68')]=function(_0x168eaf){if(_[_0xdf3c('0x69')](_0x168eaf[_0xdf3c('0x55')])||_[_0xdf3c('0x69')](_0x168eaf[_0xdf3c('0x6a')])){return null;}else{return createJwt(_0x168eaf);}};exports['generateApiKey']=function(_0x4c98dc){_0x4c98dc[_0xdf3c('0x55')]=generateNonce();_0x4c98dc[_0xdf3c('0x6a')]=generateIssuedAt();return createJwt(_0x4c98dc);};exports[_0xdf3c('0x6b')]=function(_0x1ad771,_0x22de6c){var _0x39f38f=_0x1ad771[_0xdf3c('0x4e')][_0xdf3c('0x4f')];if(_0x39f38f){var _0x143d01={'nonce':_0x22de6c[_0xdf3c('0x55')],'iat':_0x22de6c[_0xdf3c('0x6a')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xdf3c('0x50')]()};return verifyJwt(_0x39f38f,_0x143d01)['then'](function(){return generateApiKey(_0x22de6c);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports['validatePasswordPattern']=function(_0x58fcbf){var _0x541c57=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x541c57[_0xdf3c('0x6c')](_0x58fcbf))throw new db[(_0xdf3c('0x6d'))]['ValidationError'](_0xdf3c('0x6e'));return;};exports[_0xdf3c('0x6f')]=function(_0x51f8dd,_0xa8dddb,_0x28f935){var _0x10e9d5=encryptor[_0xdf3c('0x70')](_0xa8dddb)[_0xdf3c('0x71')](',');for(var _0x28f387=0x0;_0x28f387<_0x28f935;_0x28f387++){if(!_0x10e9d5[_0x28f387])break;if(_0x51f8dd[_0xdf3c('0x72')]()===_0x10e9d5[_0x28f387][_0xdf3c('0x72')]()){var _0x42efa2=util[_0xdf3c('0x73')](_0xdf3c('0x74'),_0x28f935);if(_0x28f935===0x1){_0x42efa2='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db[(_0xdf3c('0x6d'))][(_0xdf3c('0x75'))](_0x42efa2);}}return;};exports[_0xdf3c('0x76')]=function(_0x5a3d63,_0x245c68){var _0x3e327e=_0x245c68?encryptor[_0xdf3c('0x70')](_0x245c68)['split'](','):[];if(_0x3e327e[_0xdf3c('0x77')]===0x5){_0x3e327e[_0xdf3c('0x78')](-0x1,0x1);}_0x3e327e['unshift'](_0x5a3d63);return encryptor[_0xdf3c('0x79')](_0x3e327e['join'](','));};function signJwt(_0x28c296){var _0x1b03e7=BPromise[_0xdf3c('0x7a')](jwt[_0xdf3c('0x7b')],{'context':jwt});var _0xed2a78=_0x28c296[_0xdf3c('0x7c')]||config[_0xdf3c('0xc')][_0xdf3c('0xd')];return new BPromise(function(_0x2922d8,_0x330730){_0x1b03e7(_0x28c296[_0xdf3c('0x7d')],_0xed2a78,_0x28c296[_0xdf3c('0x7e')])[_0xdf3c('0x43')](function(_0x206a18){_0x2922d8(_0x206a18);})[_0xdf3c('0x4c')](function(_0xe42432){_0x330730(_0xe42432);});});}function verifyJwt(_0xd7fb2d,_0x510538,_0x4dade5){var _0x2e8511=BPromise[_0xdf3c('0x7a')](jwt[_0xdf3c('0x7f')],{'context':jwt});var _0x596282=_0x4dade5||config[_0xdf3c('0xc')]['session'];return new BPromise(function(_0x574852,_0x184952){_0x2e8511(_0xd7fb2d,_0x596282,_0x510538)[_0xdf3c('0x43')](function(_0x1121b9){_0x574852(_0x1121b9);})[_0xdf3c('0x4c')](function(_0x68f487){_0x184952(_0x68f487);});});}function generateNonce(){return crypto[_0xdf3c('0x80')](0x10)[_0xdf3c('0x81')](_0xdf3c('0x82'));}function generateIssuedAt(){return Math[_0xdf3c('0x83')](Date[_0xdf3c('0x84')]()/0x3e8)[_0xdf3c('0x81')]();}function createJwt(_0x5a2dad){var _0x34000c={'payload':{'iat':_0x5a2dad['apiKeyIat'],'nonce':_0x5a2dad[_0xdf3c('0x55')]},'options':{'algorithm':_0xdf3c('0x85'),'subject':_0x5a2dad['id'][_0xdf3c('0x81')](),'issuer':hardwareConf[_0xdf3c('0x50')](),'audience':hardwareConf[_0xdf3c('0x50')]()}};return signJwt(_0x34000c)['then'](function(_0x18bf4f){return{'iat':_0x5a2dad[_0xdf3c('0x6a')],'nonce':_0x5a2dad[_0xdf3c('0x55')],'token':_0x18bf4f};});} \ No newline at end of file +var _0x70e0=['express-jwt','composable-middleware','crypto','util','role','fullname','name','internal','email','userpic','permissions','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','phoneBarAutoAnswer','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswerDelay','isAuthenticated','use','user','ChatInteraction','findOne','closed','disposition','then','unmanaged','json','Unmanaged.','catch','headers','authorization','startsWith','Basic','User','authenticate','Bearer','status','query','apikey','getUuid','find','sub','Setting','allowedLoginAttempts','blockDuration','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','blockedAt','add','minutes','Unknown\x20authorization\x20format','User\x20not\x20found.','canUpdate','getLicense','update','Forbidden','webrtc','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','motion.token','redirect','send','retrieveApiKey','isNil','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','ValidationError','decryptString','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','split','splice','encryptString','promisify','sign','secret','secrets','session','options','verify','randomBytes','hex','floor','now','toString','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','lodash','jsonwebtoken'];(function(_0x1531ea,_0x4a3022){var _0x93314b=function(_0x1c4ea2){while(--_0x1c4ea2){_0x1531ea['push'](_0x1531ea['shift']());}};_0x93314b(++_0x4a3022);}(_0x70e0,0x17b));var _0x070e=function(_0x5b1022,_0x3d12d3){_0x5b1022=_0x5b1022-0x0;var _0x10f404=_0x70e0[_0x5b1022];return _0x10f404;};'use strict';var db=require(_0x070e('0x0'))['db'];var config=require(_0x070e('0x1'));var hardwareConf=require(_0x070e('0x2'));var licenseUtil=require('../../config/license/util');var encryptor=require('../encryptor');var _=require(_0x070e('0x3'));var jwt=require(_0x070e('0x4'));var expressJwt=require(_0x070e('0x5'));var compose=require(_0x070e('0x6'));var basicAuth=require('basic-auth');var crypto=require(_0x070e('0x7'));var BPromise=require('bluebird');var util=require(_0x070e('0x8'));var moment=require('moment');var validateJwt=expressJwt({'secret':config['secrets']['session']});var userAttributes=['id',_0x070e('0x9'),_0x070e('0xa'),_0x070e('0xb'),_0x070e('0xc'),_0x070e('0xd'),_0x070e('0xe'),_0x070e('0xf'),'md5secret','voicePause',_0x070e('0x10'),_0x070e('0x11'),_0x070e('0x12'),_0x070e('0x13'),_0x070e('0x14'),_0x070e('0x15'),_0x070e('0x16'),_0x070e('0x17'),_0x070e('0x18'),_0x070e('0x19'),_0x070e('0x1a'),'passwordResetAt','alias',_0x070e('0x1b'),'phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording',_0x070e('0x1c'),_0x070e('0x1d'),'phoneBarExpires','phoneBarPrefixRequired',_0x070e('0x1e'),_0x070e('0x1f'),_0x070e('0x20'),_0x070e('0x21'),'userProfileId','privacyEnabled',_0x070e('0x22'),_0x070e('0x23'),_0x070e('0x24'),_0x070e('0x25'),_0x070e('0x26'),'ignorePauseForPreviewCalls',_0x070e('0x27'),_0x070e('0x28'),_0x070e('0x29'),_0x070e('0x2a'),_0x070e('0x2b'),'smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer',_0x070e('0x2c'),_0x070e('0x2d'),_0x070e('0x2e'),'whatsappAutoanswer',_0x070e('0x2f')];exports['isChatInteractionAuthorized']=function(){return this[_0x070e('0x30')](!![])[_0x070e('0x31')](function(_0x27a01e,_0x33e8c6,_0x28a1c3){if(_0x27a01e[_0x070e('0x32')]){_0x28a1c3();}else{return db[_0x070e('0x33')][_0x070e('0x34')]({'where':{'id':_0x27a01e['params']['id']},'attributes':['id',_0x070e('0x35'),_0x070e('0x36')],'raw':!![]})[_0x070e('0x37')](function(_0x503f4d){if(_0x503f4d&&_0x503f4d[_0x070e('0x35')]){return _0x33e8c6['status'](_0x503f4d['disposition']===_0x070e('0x38')?0x195:0x193)[_0x070e('0x39')]({'message':_0x503f4d[_0x070e('0x36')]===_0x070e('0x38')?_0x070e('0x3a'):'Forbidden.'});}else{_0x28a1c3();}})[_0x070e('0x3b')](function(_0x219e48){_0x28a1c3(_0x219e48);});}});};exports[_0x070e('0x30')]=function isAuthenticated(_0x1d2a34){return compose()[_0x070e('0x31')](function(_0x28d7f2,_0x1a1892,_0x26373b){var _0x5e8326;if(_0x28d7f2[_0x070e('0x3c')][_0x070e('0x3d')]){if(_[_0x070e('0x3e')](_0x28d7f2['headers']['authorization'],_0x070e('0x3f'))){var _0x46065c=basicAuth(_0x28d7f2);db[_0x070e('0x40')]['find']({'where':{'name':_0x46065c[_0x070e('0xb')]}})[_0x070e('0x37')](function(_0x3a9425){if(!_0x3a9425||!_0x3a9425[_0x070e('0x41')](_0x46065c['pass'])){return _0x1a1892['status'](0x191)['json']({'message':'Wrong\x20credentials.'});}_0x28d7f2[_0x070e('0x32')]={'id':_0x3a9425['id']};_0x26373b();})['catch'](function(_0x1dff97){_0x26373b(_0x1dff97);});}else if(_[_0x070e('0x3e')](_0x28d7f2['headers']['authorization'],_0x070e('0x42'))){validateJwt(_0x28d7f2,_0x1a1892,_0x26373b);}else{if(_0x1d2a34){_0x26373b();}else{return _0x1a1892[_0x070e('0x43')](0x193)['json']({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x28d7f2[_0x070e('0x44')][_0x070e('0x45')]){try{var _0x444d02={'audience':hardwareConf[_0x070e('0x46')](),'issuer':hardwareConf[_0x070e('0x46')]()};verifyJwt(_0x28d7f2['query']['apikey'],_0x444d02)[_0x070e('0x37')](function(_0x3011c4){return db[_0x070e('0x40')][_0x070e('0x47')]({'where':{'id':_0x3011c4[_0x070e('0x48')]}})['then'](function(_0x22f3a9){_0x5e8326=_0x22f3a9;return db[_0x070e('0x49')]['findOne']({'where':{'id':0x1},'attributes':[_0x070e('0x4a'),_0x070e('0x4b')],'raw':!![]});})['then'](function(_0x4d4ee8){if(!_0x5e8326||!_['isEqual'](_0x5e8326[_0x070e('0x4c')],_0x3011c4[_0x070e('0x4d')])){return _0x1a1892[_0x070e('0x43')](0x191)[_0x070e('0x39')]({'message':_0x070e('0x4e')});}if(_0x5e8326['disabled']){return _0x1a1892[_0x070e('0x43')](0x191)[_0x070e('0x39')]({'message':_0x070e('0x4f')});}if(_0x5e8326['blocked']){if(_0x4d4ee8[_0x070e('0x4b')]>0x0){if(moment(_0x5e8326[_0x070e('0x50')])[_0x070e('0x51')](_0x4d4ee8['blockDuration'],_0x070e('0x52'))>moment()){return _0x1a1892[_0x070e('0x43')](0x191)['json']({'message':_0x070e('0x4f')});}}else{return _0x1a1892['status'](0x191)[_0x070e('0x39')]({'message':_0x070e('0x4f')});}}_0x28d7f2[_0x070e('0x32')]={'id':_0x5e8326['id']};_0x26373b();});})[_0x070e('0x3b')](function(){return _0x1a1892[_0x070e('0x43')](0x191)['json']({'message':_0x070e('0x4f')});});}catch(_0x5db2ce){_0x26373b(_0x5db2ce);}}else if(_0x1d2a34){_0x26373b();}else{return _0x1a1892['status'](0x193)[_0x070e('0x39')]({'message':_0x070e('0x53')});}})[_0x070e('0x31')](function(_0x4d52ff,_0x2ad56c,_0x1223be){if(_0x4d52ff[_0x070e('0x32')]){db[_0x070e('0x40')]['find']({'where':{'id':_0x4d52ff[_0x070e('0x32')]['id']},'attributes':userAttributes})['then'](function(_0x544b53){if(!_0x544b53){return _0x2ad56c['status'](0x194)[_0x070e('0x39')]({'message':_0x070e('0x54')});}_0x4d52ff[_0x070e('0x32')]=_0x544b53;_0x1223be();})[_0x070e('0x3b')](function(_0x34f23e){_0x1223be(_0x34f23e);});}else if(_0x1d2a34){_0x1223be();}else{return _0x2ad56c['status'](0x194)[_0x070e('0x39')]({'message':'User\x20object\x20not\x20found.'});}});};exports[_0x070e('0x55')]=function canUpdate(){return compose()[_0x070e('0x31')](function(_0xff760c,_0x52fcea,_0x54285a){return licenseUtil[_0x070e('0x56')]()['then'](function(_0x35349f){if(_0x35349f[_0x070e('0x57')]){_0x54285a();}else{return _0x52fcea[_0x070e('0x43')](0x193)['json']({'message':_0x070e('0x58')});}})[_0x070e('0x3b')](function(_0x48d836){_0x54285a(_0x48d836);});});};exports['isWebrtcLicence']=function isWebrtcLicence(){return compose()[_0x070e('0x31')](function(_0x945901,_0x2d43ce,_0x1fc7c4){return licenseUtil[_0x070e('0x56')]()['then'](function(_0x20b80e){if(_0x20b80e[_0x070e('0x59')]){_0x1fc7c4();}else{return _0x2d43ce[_0x070e('0x43')](0x193)[_0x070e('0x39')]({'message':_0x070e('0x58')});}})[_0x070e('0x3b')](function(_0x1f54d5){_0x1fc7c4(_0x1f54d5);});});};exports[_0x070e('0x5a')]=function(_0xd67987,_0x66a3f3,_0x210c4d){_0xd67987[_0x070e('0x5a')]=!![];return _0x210c4d();};exports[_0x070e('0x5b')]=function signToken(_0x216d27){return signJwt(_0x216d27);};exports[_0x070e('0x5c')]=function(_0x5e051a,_0x171621){if(!_0x5e051a[_0x070e('0x32')]){return _0x171621[_0x070e('0x43')](0x194)[_0x070e('0x39')]({'message':_0x070e('0x5d')});}var _0x3bd738={'payload':{'id':_0x5e051a[_0x070e('0x32')]['id'],'role':_0x5e051a[_0x070e('0x32')][_0x070e('0x9')]},'options':{'expiresIn':0x15180}};return signJwt(_0x3bd738)['then'](function(_0x251696){_0x171621['cookie'](_0x070e('0x5e'),_0x251696);_0x171621[_0x070e('0x5f')]('/dashboards/general');})[_0x070e('0x3b')](function(_0x130a50){return _0x171621[_0x070e('0x43')](0x1f4)[_0x070e('0x60')](_0x130a50);});};exports[_0x070e('0x61')]=function(_0x1e8a4f){if(_[_0x070e('0x62')](_0x1e8a4f['apiKeyNonce'])||_[_0x070e('0x62')](_0x1e8a4f['apiKeyIat'])){return null;}else{return createJwt(_0x1e8a4f);}};exports['generateApiKey']=function(_0x3a06c6){_0x3a06c6[_0x070e('0x4c')]=generateNonce();_0x3a06c6[_0x070e('0x63')]=generateIssuedAt();return createJwt(_0x3a06c6);};exports[_0x070e('0x64')]=function(_0x202015,_0x7948ed){var _0x440fa1=_0x202015[_0x070e('0x44')]['apikey'];if(_0x440fa1){var _0x477e69={'nonce':_0x7948ed['apiKeyNonce'],'iat':_0x7948ed['apiKeyIat'],'audience':hardwareConf[_0x070e('0x46')](),'issuer':hardwareConf[_0x070e('0x46')]()};return verifyJwt(_0x440fa1,_0x477e69)['then'](function(){return generateApiKey(_0x7948ed);});}else{throw{'message':_0x070e('0x65')};}};exports[_0x070e('0x66')]=function(_0x210f4a){var _0x2f8104=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x2f8104[_0x070e('0x67')](_0x210f4a))throw new db[(_0x070e('0x68'))][(_0x070e('0x69'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');return;};exports['validatePasswordHistory']=function(_0x5943e3,_0x3087e5,_0x1948a5){var _0x29f497=encryptor[_0x070e('0x6a')](_0x3087e5)['split'](',');for(var _0x25f34c=0x0;_0x25f34c<_0x1948a5;_0x25f34c++){if(!_0x29f497[_0x25f34c])break;if(_0x5943e3['toLowerCase']()===_0x29f497[_0x25f34c][_0x070e('0x6b')]()){var _0x1cbb7e=util[_0x070e('0x6c')](_0x070e('0x6d'),_0x1948a5);if(_0x1948a5===0x1){_0x1cbb7e=_0x070e('0x6e');}throw new db[(_0x070e('0x68'))]['ValidationError'](_0x1cbb7e);}}return;};exports[_0x070e('0x6f')]=function(_0x18e8d0,_0x8aaf00){var _0x533431=_0x8aaf00?encryptor[_0x070e('0x6a')](_0x8aaf00)[_0x070e('0x70')](','):[];if(_0x533431['length']===0x5){_0x533431[_0x070e('0x71')](-0x1,0x1);}_0x533431['unshift'](_0x18e8d0);return encryptor[_0x070e('0x72')](_0x533431['join'](','));};function signJwt(_0x4cb86f){var _0x4b354d=BPromise[_0x070e('0x73')](jwt[_0x070e('0x74')],{'context':jwt});var _0x1100d8=_0x4cb86f[_0x070e('0x75')]||config[_0x070e('0x76')][_0x070e('0x77')];return new BPromise(function(_0x498bc6,_0x841c89){_0x4b354d(_0x4cb86f['payload'],_0x1100d8,_0x4cb86f[_0x070e('0x78')])['then'](function(_0x2e10f7){_0x498bc6(_0x2e10f7);})[_0x070e('0x3b')](function(_0x5b0b46){_0x841c89(_0x5b0b46);});});}function verifyJwt(_0x1bcdc3,_0x50399e,_0x1a9e25){var _0x139630=BPromise[_0x070e('0x73')](jwt[_0x070e('0x79')],{'context':jwt});var _0x764b06=_0x1a9e25||config[_0x070e('0x76')][_0x070e('0x77')];return new BPromise(function(_0x148f1d,_0x3ef9cc){_0x139630(_0x1bcdc3,_0x764b06,_0x50399e)[_0x070e('0x37')](function(_0x40c560){_0x148f1d(_0x40c560);})[_0x070e('0x3b')](function(_0x455bf2){_0x3ef9cc(_0x455bf2);});});}function generateNonce(){return crypto[_0x070e('0x7a')](0x10)['toString'](_0x070e('0x7b'));}function generateIssuedAt(){return Math[_0x070e('0x7c')](Date[_0x070e('0x7d')]()/0x3e8)[_0x070e('0x7e')]();}function createJwt(_0x5712d1){var _0x2ccd8d={'payload':{'iat':_0x5712d1[_0x070e('0x63')],'nonce':_0x5712d1[_0x070e('0x4c')]},'options':{'algorithm':_0x070e('0x7f'),'subject':_0x5712d1['id'][_0x070e('0x7e')](),'issuer':hardwareConf[_0x070e('0x46')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x2ccd8d)[_0x070e('0x37')](function(_0x7d154){return{'iat':_0x5712d1[_0x070e('0x63')],'nonce':_0x5712d1[_0x070e('0x4c')],'token':_0x7d154};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index 0098e53..311c8e3 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 _0xbfbc=['getFilteredContacts','rows','catch','describe','CmContact','keys','startsWith','cf_','findOne','slice','fieldType','type','lodash','findAll','skipContactsQuery','getContactsSubquery','then','search','parseAdvancedSearchFilter','parseQueryParameters','where','default','fields','filter','user','clause','tags','skip','checkListsRestrictions','ids','tag','countFilteredContacts','count'];(function(_0x39cef5,_0x174919){var _0x4657ca=function(_0x1d0c00){while(--_0x1d0c00){_0x39cef5['push'](_0x39cef5['shift']());}};_0x4657ca(++_0x174919);}(_0xbfbc,0x1b9));var _0xcbfb=function(_0x459814,_0x503f99){_0x459814=_0x459814-0x0;var _0x83be16=_0xbfbc[_0x459814];return _0x83be16;};'use strict';var _=require(_0xcbfb('0x0'));var sqlUtils=require('./sql-utils');var db=require('../../mysqldb')['db'];exports[_0xcbfb('0x1')]=function(_0x13b5c3,_0x357de6,_0xd7d7c5,_0x23c546){var _0x3df248={'count':0x0,'rows':[]};var _0x3202ce=sqlUtils[_0xcbfb('0x2')](_0x357de6,_0x13b5c3);if(_0x3202ce){return Promise['resolve'](_0x3df248);}var _0x188cb4=sqlUtils[_0xcbfb('0x3')]();var _0x3d7668={};var _0x22aecc=![];var _0x54f9ce=![];return Promise['resolve']()[_0xcbfb('0x4')](function(){if(_0x13b5c3[_0xcbfb('0x5')]){return sqlUtils[_0xcbfb('0x6')](_0x13b5c3[_0xcbfb('0x5')],_0x23c546);}else{return sqlUtils[_0xcbfb('0x7')](_0x13b5c3,_0x23c546);}})['then'](function(_0x62b34d){_0x188cb4[_0xcbfb('0x8')](_0x62b34d[_0xcbfb('0x9')]);_0x188cb4['where'](_0x62b34d[_0xcbfb('0xa')]);_0x188cb4[_0xcbfb('0x8')](_0x62b34d[_0xcbfb('0xb')]);_0x188cb4[_0xcbfb('0x8')](_0x62b34d[_0xcbfb('0xc')][_0xcbfb('0xd')]);_0x3d7668=_0x62b34d[_0xcbfb('0xe')];_0x54f9ce=_0x62b34d[_0xcbfb('0xc')][_0xcbfb('0xf')];return sqlUtils[_0xcbfb('0x10')](_0x357de6,_0x13b5c3,_0x54f9ce);})[_0xcbfb('0x4')](function(_0x3e5947){_0x188cb4['where'](_0x3e5947);var _0x1ae573=_0x13b5c3['search']?_0x3d7668[_0xcbfb('0x11')]:_0x13b5c3[_0xcbfb('0x12')];_0x22aecc=_0x1ae573?!![]:![];return sqlUtils[_0xcbfb('0x13')](_0x188cb4,_0x1ae573);})[_0xcbfb('0x4')](function(_0x1227fb){_0x3df248[_0xcbfb('0x14')]=_0x1227fb;if(_0x3df248[_0xcbfb('0x14')]===0x0){return;}if(_0x13b5c3['User']){_0x54f9ce=!![];}return sqlUtils['buildContactsQuery'](_0x188cb4,_0x13b5c3[_0xcbfb('0xa')],_0xd7d7c5,_0x22aecc,_0x3d7668[_0xcbfb('0xd')],_0x54f9ce);})['then'](function(_0x4f6112){if(!_0x4f6112){return[];}return sqlUtils[_0xcbfb('0x15')](_0x4f6112,_0x13b5c3,_0xd7d7c5);})[_0xcbfb('0x4')](function(_0xd876fa){_0x3df248[_0xcbfb('0x16')]=_0xd876fa;return _0x3df248;})[_0xcbfb('0x17')](function(_0x4dcb2d){throw _0x4dcb2d;});};exports[_0xcbfb('0x18')]=function(){var _0x227528={};var _0xfd289c=[];return db[_0xcbfb('0x19')]['describe']()['then'](function(_0xeaf57a){_0x227528=_0xeaf57a;var _0x1ceec7=Object[_0xcbfb('0x1a')](_0x227528)[_0xcbfb('0xb')](function(_0x4537c8){return _[_0xcbfb('0x1b')](_0x4537c8,_0xcbfb('0x1c'))?_0x4537c8:undefined;});var _0x3b6de3=_0x1ceec7['map'](function(_0x20a93e){return db['CmCustomField'][_0xcbfb('0x1d')]({'where':{'id':_0x20a93e[_0xcbfb('0x1e')](0x3)},'raw':!![]});});return Promise['all'](_0x3b6de3);})[_0xcbfb('0x4')](function(_0x53e706){for(var _0x5a7793=0x0;_0x5a7793<_0x53e706['length'];_0x5a7793++){if(_0x53e706[_0x5a7793]){var _0x3cc83a=_0xcbfb('0x1c')+_0x53e706[_0x5a7793]['id'];_0x227528[_0x3cc83a][_0xcbfb('0x1f')]=_0x53e706[_0x5a7793][_0xcbfb('0x20')];}}_0xfd289c=_['map'](Object[_0xcbfb('0x1a')](_0x227528),function(_0x4718fd){return{'name':_0x4718fd,'type':_0x227528[_0x4718fd]['type']};});return _0xfd289c;})[_0xcbfb('0x17')](function(_0x349888){throw _0x349888;});}; \ No newline at end of file +var _0x289f=['./sql-utils','../../mysqldb','findAll','resolve','getContactsSubquery','search','parseAdvancedSearchFilter','parseQueryParameters','then','where','default','filter','clause','tags','user','skip','ids','tag','countFilteredContacts','count','User','getFilteredContacts','rows','catch','describe','CmContact','keys','startsWith','map','CmCustomField','slice','all','length','fieldType','type'];(function(_0x278312,_0x40ba8e){var _0x11d4d4=function(_0x301928){while(--_0x301928){_0x278312['push'](_0x278312['shift']());}};_0x11d4d4(++_0x40ba8e);}(_0x289f,0xf5));var _0xf289=function(_0x8a969d,_0x339d9f){_0x8a969d=_0x8a969d-0x0;var _0x1d8dc7=_0x289f[_0x8a969d];return _0x1d8dc7;};'use strict';var _=require('lodash');var sqlUtils=require(_0xf289('0x0'));var db=require(_0xf289('0x1'))['db'];exports[_0xf289('0x2')]=function(_0x116659,_0x45fe82,_0x385013,_0xbf6023){var _0x1a6609={'count':0x0,'rows':[]};var _0x22d83e=sqlUtils['skipContactsQuery'](_0x45fe82,_0x116659);if(_0x22d83e){return Promise[_0xf289('0x3')](_0x1a6609);}var _0x2d6ab3=sqlUtils[_0xf289('0x4')]();var _0x242769={};var _0x2e7527=![];var _0x2ebf60=![];return Promise[_0xf289('0x3')]()['then'](function(){if(_0x116659[_0xf289('0x5')]){return sqlUtils[_0xf289('0x6')](_0x116659[_0xf289('0x5')],_0xbf6023);}else{return sqlUtils[_0xf289('0x7')](_0x116659,_0xbf6023);}})[_0xf289('0x8')](function(_0x172c2c){_0x2d6ab3[_0xf289('0x9')](_0x172c2c[_0xf289('0xa')]);_0x2d6ab3[_0xf289('0x9')](_0x172c2c['fields']);_0x2d6ab3[_0xf289('0x9')](_0x172c2c[_0xf289('0xb')]);_0x2d6ab3[_0xf289('0x9')](_0x172c2c['user'][_0xf289('0xc')]);_0x242769=_0x172c2c[_0xf289('0xd')];_0x2ebf60=_0x172c2c[_0xf289('0xe')][_0xf289('0xf')];return sqlUtils['checkListsRestrictions'](_0x45fe82,_0x116659,_0x2ebf60);})[_0xf289('0x8')](function(_0x12ab9f){_0x2d6ab3['where'](_0x12ab9f);var _0x395753=_0x116659[_0xf289('0x5')]?_0x242769[_0xf289('0x10')]:_0x116659[_0xf289('0x11')];_0x2e7527=_0x395753?!![]:![];return sqlUtils[_0xf289('0x12')](_0x2d6ab3,_0x395753);})['then'](function(_0x1d6868){_0x1a6609[_0xf289('0x13')]=_0x1d6868;if(_0x1a6609[_0xf289('0x13')]===0x0){return;}if(_0x116659[_0xf289('0x14')]){_0x2ebf60=!![];}return sqlUtils['buildContactsQuery'](_0x2d6ab3,_0x116659['fields'],_0x385013,_0x2e7527,_0x242769[_0xf289('0xc')],_0x2ebf60);})[_0xf289('0x8')](function(_0x27d2e6){if(!_0x27d2e6){return[];}return sqlUtils[_0xf289('0x15')](_0x27d2e6,_0x116659,_0x385013);})['then'](function(_0x597389){_0x1a6609[_0xf289('0x16')]=_0x597389;return _0x1a6609;})[_0xf289('0x17')](function(_0x2dfb78){throw _0x2dfb78;});};exports[_0xf289('0x18')]=function(){var _0x43a6fe={};var _0x5ba23d=[];return db[_0xf289('0x19')][_0xf289('0x18')]()[_0xf289('0x8')](function(_0x535d66){_0x43a6fe=_0x535d66;var _0x25e7a7=Object[_0xf289('0x1a')](_0x43a6fe)[_0xf289('0xb')](function(_0x4de4ab){return _[_0xf289('0x1b')](_0x4de4ab,'cf_')?_0x4de4ab:undefined;});var _0x28cb47=_0x25e7a7[_0xf289('0x1c')](function(_0x5719ab){return db[_0xf289('0x1d')]['findOne']({'where':{'id':_0x5719ab[_0xf289('0x1e')](0x3)},'raw':!![]});});return Promise[_0xf289('0x1f')](_0x28cb47);})['then'](function(_0x4d326f){for(var _0x23866a=0x0;_0x23866a<_0x4d326f[_0xf289('0x20')];_0x23866a++){if(_0x4d326f[_0x23866a]){var _0x292f01='cf_'+_0x4d326f[_0x23866a]['id'];_0x43a6fe[_0x292f01][_0xf289('0x21')]=_0x4d326f[_0x23866a][_0xf289('0x22')];}}_0x5ba23d=_['map'](Object[_0xf289('0x1a')](_0x43a6fe),function(_0x3402e7){return{'name':_0x3402e7,'type':_0x43a6fe[_0x3402e7][_0xf289('0x22')]};});return _0x5ba23d;})[_0xf289('0x17')](function(_0x60b856){throw _0x60b856;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index ced9fd1..7328322 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 _0xe9f5=['type','default','text','value','start','end','Tag','split','map','tags','clause','ids','User','uc.UserId\x20=\x20?','user','keys','some','compact','Contact','and','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','resolve','then','tag','filter','role','getLists','c.ListId\x20IS\x20NULL','c.ListId\x20IN\x20?','attributes','group','c.id','limit','offset','subqry.id','having','order','DESC','subqry.','findAll','color','Sequelize','QueryTypes','CmContact','toString','Tags','COUNT(*)','isEmpty','t.id\x20IN\x20?','SELECT','sequelize','query','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','../interaction/utils','agent','search','ListId','autocomplete','true','select','from','cm_contacts','where','c.deletedAt\x20IS\x20NULL','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','left_join','cm_contact_has_tags','ct.CmContactId\x20=\x20','tools_tags','t.id\x20=\x20ct.TagId','subqry','firstName','lastName','phone','mobile','email','CompanyId','createdAt','updatedAt','deletedAt','TagIds','includes','push','forEach','field','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','sqlOperator','conditions','find','name','dateOfBirth','fieldType','castTo','buildExpression'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xe9f5,0xaa));var _0x5e9f=function(_0x513344,_0x168b27){_0x513344=_0x513344-0x0;var _0x4ced74=_0xe9f5[_0x513344];return _0x4ced74;};'use strict';var _=require(_0x5e9f('0x0'));var squel=require(_0x5e9f('0x1'));var as=require(_0x5e9f('0x2'));var qs=require(_0x5e9f('0x3'));var utils=require(_0x5e9f('0x4'));var db=require('../../mysqldb')['db'];function skipContactsQuery(_0x486d00,_0x27c7ca){var _0x5321a8=![];if(_0x486d00['role']===_0x5e9f('0x5')&&!_0x27c7ca[_0x5e9f('0x6')]&&!_0x27c7ca[_0x5e9f('0x7')]&&_0x27c7ca[_0x5e9f('0x8')]!==_0x5e9f('0x9')){_0x5321a8=!![];}return _0x5321a8;}function getContactsSubquery(){return squel[_0x5e9f('0xa')]()[_0x5e9f('0xb')](_0x5e9f('0xc'),'c')[_0x5e9f('0xd')](_0x5e9f('0xe'));}function applyJoinClauses(_0x4cfe5f,_0x10b219){var _0x938435=_0x10b219?'c':'subqry';_0x4cfe5f['left_join'](_0x5e9f('0xf'),'uc',_0x5e9f('0x10')+_0x938435+_0x5e9f('0x11'))[_0x5e9f('0x12')](_0x5e9f('0x13'),'ct',_0x5e9f('0x14')+_0x938435+_0x5e9f('0x11'))[_0x5e9f('0x12')](_0x5e9f('0x15'),'t',_0x5e9f('0x16'));return _0x4cfe5f;}function addFieldsToQuery(_0x4c5475,_0x38ba5f,_0x2bbcdd,_0x429b2f,_0x2c663c){var _0x1142a1=_0x2c663c?'c':_0x5e9f('0x17');if(!_0x38ba5f){_0x38ba5f=['id',_0x5e9f('0x18'),_0x5e9f('0x19'),_0x5e9f('0x1a'),_0x5e9f('0x1b'),'fax',_0x5e9f('0x1c'),_0x5e9f('0x7'),_0x5e9f('0x1d'),_0x5e9f('0x1e'),_0x5e9f('0x1f'),_0x5e9f('0x20'),_0x5e9f('0x21')];}else if(!_0x38ba5f[_0x5e9f('0x22')]('id')){_0x38ba5f[_0x5e9f('0x23')]('id');}var _0x330dea=_0x2bbcdd&&_0x2c663c||!_0x2bbcdd&&!_0x2c663c;if(_0x429b2f){_0x330dea=_0x429b2f&&_0x2c663c||!_0x429b2f&&!_0x2c663c;}_0x38ba5f[_0x5e9f('0x24')](function(_0x72bbd4){if(_0x72bbd4===_0x5e9f('0x21')){if(_0x330dea){_0x4c5475[_0x5e9f('0x25')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x72bbd4);}else if(_0x2bbcdd||_0x429b2f){_0x4c5475[_0x5e9f('0x25')](_0x1142a1+'.'+_0x72bbd4);}}else{_0x4c5475[_0x5e9f('0x25')](_0x1142a1+'.'+_0x72bbd4);}});return _0x4c5475;}function getSqlClauses(){var _0x49401d={'default':squel['expr'](),'fields':squel['expr'](),'filter':squel[_0x5e9f('0x26')](),'tags':{'clause':squel[_0x5e9f('0x26')](),'ids':null},'user':{'clause':squel[_0x5e9f('0x26')](),'skip':![]}};return _0x49401d;}function parseTagParameter(_0x4d625c){var _0x17fc5b=squel[_0x5e9f('0x26')]();if(_0x4d625c){var _0x5cb2ad=utils[_0x5e9f('0x27')](_0x4d625c);_0x5cb2ad[_0x5e9f('0x24')](function(_0x44444b){_0x17fc5b['or'](_0x5e9f('0x28'),'%,'+_0x44444b+',%');});}return _0x17fc5b;}function parseSearchFilter(_0x371233){var _0x42254e=squel[_0x5e9f('0x26')]();if(_0x371233){var _0x4ba05e=_0x371233[_0x5e9f('0x29')]('\x5c','\x5c\x5c')[_0x5e9f('0x29')](/'/g,'\x27\x27');if(_0x4ba05e['split']('\x20')[_0x5e9f('0x2a')]>0x1){_0x42254e['or'](_0x5e9f('0x2b'),qs[_0x5e9f('0x2c')](_0x4ba05e,!![]),null);}else{if(qs['isNumeric'](_0x4ba05e)){_0x42254e['or'](_0x5e9f('0x2d'),_0x4ba05e+'%');_0x42254e['or'](_0x5e9f('0x2e'),_0x4ba05e+'%');_0x42254e['or'](_0x5e9f('0x2f'),_0x4ba05e+'%');_0x42254e['or'](_0x5e9f('0x30'),_0x4ba05e+'%');}else if(qs[_0x5e9f('0x31')](_0x4ba05e)){_0x42254e['or'](_0x5e9f('0x32'),_0x4ba05e+'%');}else{_0x42254e['or'](_0x5e9f('0x33'),'%'+_0x4ba05e+'%');_0x42254e['or'](_0x5e9f('0x34'),'%'+_0x4ba05e+'%');_0x42254e['or']('c.email\x20LIKE\x20?','%'+_0x4ba05e+'%');}}}return _0x42254e;}function parseAdvancedSearchFilter(_0x1a0d2d,_0x23e406){var _0x3dbff6=getSqlClauses();var _0x34246d=as[_0x5e9f('0x35')](_0x1a0d2d);var _0x2e18a7=_0x34246d[_0x5e9f('0x36')];for(var _0x5aed18=0x0;_0x5aed18<_0x34246d[_0x5e9f('0x37')]['length'];_0x5aed18++){var _0x7cb5e8=_0x34246d[_0x5e9f('0x37')][_0x5aed18];var _0xa3a3a='c';var _0x246560=_[_0x5e9f('0x38')](_0x23e406,[_0x5e9f('0x39'),_0x7cb5e8[_0x5e9f('0x25')]]);if(_0x246560){if(_0x7cb5e8['field']===_0x5e9f('0x3a')||_0x246560[_0x5e9f('0x3b')]==='datetime'){_0x7cb5e8[_0x5e9f('0x3c')]='DATE';}var _0x1f9bad=as[_0x5e9f('0x3d')](_0xa3a3a,_0x246560[_0x5e9f('0x3e')],_0x7cb5e8);_0x3dbff6[_0x5e9f('0x3f')][_0x2e18a7](_0x1f9bad[_0x5e9f('0x40')],_0x1f9bad[_0x5e9f('0x41')][_0x5e9f('0x42')],_0x1f9bad[_0x5e9f('0x41')][_0x5e9f('0x43')]);}else{if(_0x7cb5e8[_0x5e9f('0x25')]===_0x5e9f('0x44')){var _0x2212a6=_0x7cb5e8[_0x5e9f('0x41')][_0x5e9f('0x45')](',')[_0x5e9f('0x46')](function(_0x86afcf){return Number(_0x86afcf);});var _0x18fe55=parseTagParameter(_0x2212a6);_0x3dbff6[_0x5e9f('0x47')][_0x5e9f('0x48')]['and'](_0x18fe55);_0x3dbff6[_0x5e9f('0x47')][_0x5e9f('0x49')]=_0x2212a6;}else if(_0x7cb5e8[_0x5e9f('0x25')]===_0x5e9f('0x4a')){_0x3dbff6['user'][_0x5e9f('0x48')]['and'](_0x5e9f('0x4b'),_0x7cb5e8['value']);_0x3dbff6[_0x5e9f('0x4c')]['skip']=!![];}}}return _0x3dbff6;}function parseModelFields(_0xb5d4f4,_0x50008d){var _0x494442=squel[_0x5e9f('0x26')]();var _0x49e3ee=_(_0xb5d4f4)[_0x5e9f('0x4d')]()['map'](function(_0x39243b){return _[_0x5e9f('0x4e')](_0x50008d,['name',_0x39243b])?_0x39243b:undefined;})[_0x5e9f('0x4f')]()['value']();if(_0xb5d4f4['Contact']){_0x49e3ee[_0x5e9f('0x23')](_0x5e9f('0x50'));}if(_0xb5d4f4[_0x5e9f('0x4a')]){_0x49e3ee[_0x5e9f('0x23')](_0x5e9f('0x4a'));}if(_0x49e3ee[_0x5e9f('0x2a')]>0x0){_0x49e3ee[_0x5e9f('0x24')](function(_0xd5dcd){if(_0xd5dcd==='ListId'){_0x494442[_0x5e9f('0x51')]('c.ListId\x20IN\x20?',[][_0x5e9f('0x52')](_0xb5d4f4[_0xd5dcd]));}else if(_0xd5dcd===_0x5e9f('0x50')){var _0x1ee0ae='%'+_0xb5d4f4[_0xd5dcd]+'%';_0x494442['and'](_0x5e9f('0x53'),_0x1ee0ae);}else if(_0xd5dcd===_0x5e9f('0x4a')){_0x494442['and'](_0x5e9f('0x4b'),_0xb5d4f4[_0xd5dcd]);}else{_0x494442[_0x5e9f('0x51')]('c.'+_0xd5dcd+'\x20=\x20?',_0xb5d4f4[_0xd5dcd]);}});}return _0x494442;}function parseQueryParameters(_0x3245b2,_0x585293){var _0x4f69c1=getSqlClauses();return Promise[_0x5e9f('0x54')]()[_0x5e9f('0x55')](function(){return parseModelFields(_0x3245b2,_0x585293);})[_0x5e9f('0x55')](function(_0x27adc0){_0x4f69c1['fields'][_0x5e9f('0x51')](_0x27adc0);return parseTagParameter(_0x3245b2[_0x5e9f('0x56')]);})[_0x5e9f('0x55')](function(_0x496791){_0x4f69c1[_0x5e9f('0x47')][_0x5e9f('0x48')][_0x5e9f('0x51')](_0x496791);return parseSearchFilter(_0x3245b2[_0x5e9f('0x57')]);})[_0x5e9f('0x55')](function(_0x41eabf){_0x4f69c1['filter']=_0x41eabf;return _0x4f69c1;});}function checkListsRestrictions(_0x2c862c,_0x1f0914,_0x458e1b){var _0x3587c3=squel[_0x5e9f('0x26')]();return Promise[_0x5e9f('0x54')]()[_0x5e9f('0x55')](function(){if(_0x1f0914[_0x5e9f('0x6')]&&_0x2c862c[_0x5e9f('0x58')]===_0x5e9f('0x5')&&!_0x458e1b){return _0x2c862c[_0x5e9f('0x59')]({'attributes':['id'],'raw':!![]});}})[_0x5e9f('0x55')](function(_0x2ba977){if(_0x2ba977){if(_0x2ba977[_0x5e9f('0x2a')]===0x0){_0x3587c3[_0x5e9f('0x51')](_0x5e9f('0x5a'));}else{_0x3587c3['and'](_0x5e9f('0x5b'),_[_0x5e9f('0x46')](_0x2ba977,'id'));}}})[_0x5e9f('0x55')](function(){return _0x3587c3;});}function buildContactsQuery(_0x27d387,_0x295609,_0x25eef9,_0x1a3f0a,_0x19c849,_0x51fd4e){if(_0x295609){_0x295609=_0x25eef9[_0x5e9f('0x5c')];}_0x27d387=addFieldsToQuery(_0x27d387,_0x295609,_0x1a3f0a,_0x51fd4e,!![]);var _0x1dfd7f=squel[_0x5e9f('0xa')]();_0x1dfd7f=addFieldsToQuery(_0x1dfd7f,_0x295609,_0x1a3f0a,_0x51fd4e,![]);if(_0x1a3f0a||_0x51fd4e){_0x27d387=applyJoinClauses(_0x27d387,!![]);_0x27d387[_0x5e9f('0x5d')](_0x5e9f('0x5e'));if(_0x25eef9[_0x5e9f('0x5f')]){_0x1dfd7f[_0x5e9f('0x5f')](_0x25eef9[_0x5e9f('0x5f')]);}if(_0x25eef9['offset']){_0x1dfd7f['offset'](_0x25eef9[_0x5e9f('0x60')]);}}else{_0x1dfd7f=applyJoinClauses(_0x1dfd7f,![]);_0x1dfd7f[_0x5e9f('0x5d')](_0x5e9f('0x61'));if(_0x25eef9[_0x5e9f('0x5f')]){_0x27d387[_0x5e9f('0x5f')](_0x25eef9[_0x5e9f('0x5f')]);}if(_0x25eef9['offset']){_0x27d387[_0x5e9f('0x60')](_0x25eef9[_0x5e9f('0x60')]);}}_0x1dfd7f[_0x5e9f('0x62')](_0x19c849);if(_0x25eef9[_0x5e9f('0x63')]){_0x25eef9[_0x5e9f('0x63')]['forEach'](function(_0x202305){_0x27d387[_0x5e9f('0x63')]('c.'+_0x202305[0x0],_0x202305[0x1]===_0x5e9f('0x64')?![]:!![]);_0x1dfd7f[_0x5e9f('0x63')](_0x5e9f('0x65')+_0x202305[0x0],_0x202305[0x1]===_0x5e9f('0x64')?![]:!![]);});}_0x1dfd7f[_0x5e9f('0xb')](_0x27d387,_0x5e9f('0x17'));return _0x1dfd7f;}function getFilteredContacts(_0x2adf08){var _0x79a5e0=[];return db[_0x5e9f('0x44')][_0x5e9f('0x66')]({'attributes':['id',_0x5e9f('0x39'),_0x5e9f('0x67')],'raw':!![]})[_0x5e9f('0x55')](function(_0x5d4542){_0x79a5e0=_['keyBy'](_0x5d4542,'id');var _0x297f8e={'type':db[_0x5e9f('0x68')][_0x5e9f('0x69')]['SELECT'],'model':db[_0x5e9f('0x6a')],'mapToModel':!![],'nest':!![],'raw':!![]};return db['sequelize']['query'](_0x2adf08[_0x5e9f('0x6b')](),_0x297f8e);})['then'](function(_0x186c05){_0x186c05[_0x5e9f('0x24')](function(_0x27d233){if(_0x27d233[_0x5e9f('0x21')]){_0x27d233['Tags']=[];_0x27d233[_0x5e9f('0x21')]['split'](',')[_0x5e9f('0x24')](function(_0x34f4dd){_0x27d233[_0x5e9f('0x6c')][_0x5e9f('0x23')](_0x79a5e0[_0x34f4dd]);});}delete _0x27d233[_0x5e9f('0x21')];});return _0x186c05;});}function countFilteredContacts(_0x88e050,_0xeff64a){var _0x307e0b=_0x88e050['clone']();_0x307e0b[_0x5e9f('0x25')](_0x5e9f('0x6d'));_0x307e0b=applyJoinClauses(_0x307e0b,!![]);_0x88e050[_0x5e9f('0x5d')](_0x5e9f('0x5e'));var _0x1711ca=utils[_0x5e9f('0x27')](_0xeff64a);if(!_[_0x5e9f('0x6e')](_0x1711ca)){_0x307e0b[_0x5e9f('0xd')](_0x5e9f('0x6f'),_0x1711ca);}var _0x5a56ab={'type':db['Sequelize'][_0x5e9f('0x69')][_0x5e9f('0x70')],'raw':!![]};return db[_0x5e9f('0x71')][_0x5e9f('0x72')](_0x307e0b[_0x5e9f('0x6b')](),_0x5a56ab)['then'](function(_0x557b2a){return _0x557b2a[0x0]['COUNT(*)'];});}module[_0x5e9f('0x73')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0xe6d2=['order','findAll','color','keyBy','QueryTypes','SELECT','CmContact','toString','Tags','clone','COUNT(*)','Sequelize','sequelize','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','../interaction/utils','../../mysqldb','agent','autocomplete','true','from','where','subqry','left_join','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','email','CompanyId','createdAt','deletedAt','TagIds','includes','push','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','sqlOperator','conditions','find','name','dateOfBirth','fieldType','datetime','castTo','DATE','buildExpression','default','text','value','start','end','Tag','map','tags','and','clause','uc.UserId\x20=\x20?','skip','keys','compact','Contact','User','ListId','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','then','tag','filter','resolve','search','role','getLists','c.ListId\x20IS\x20NULL','c.ListId\x20IN\x20?','attributes','group','c.id','limit','offset','subqry.id','having'];(function(_0x21aec3,_0x5c97e9){var _0x288bbc=function(_0x2283fe){while(--_0x2283fe){_0x21aec3['push'](_0x21aec3['shift']());}};_0x288bbc(++_0x5c97e9);}(_0xe6d2,0xe8));var _0x2e6d=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0xe6d2[_0xdea41a];return _0x15d0d8;};'use strict';var _=require(_0x2e6d('0x0'));var squel=require(_0x2e6d('0x1'));var as=require(_0x2e6d('0x2'));var qs=require(_0x2e6d('0x3'));var utils=require(_0x2e6d('0x4'));var db=require(_0x2e6d('0x5'))['db'];function skipContactsQuery(_0x302edd,_0xec6a48){var _0x4c6969=![];if(_0x302edd['role']===_0x2e6d('0x6')&&!_0xec6a48['search']&&!_0xec6a48['ListId']&&_0xec6a48[_0x2e6d('0x7')]!==_0x2e6d('0x8')){_0x4c6969=!![];}return _0x4c6969;}function getContactsSubquery(){return squel['select']()[_0x2e6d('0x9')]('cm_contacts','c')[_0x2e6d('0xa')]('c.deletedAt\x20IS\x20NULL');}function applyJoinClauses(_0x23185b,_0x384bc8){var _0x2c74be=_0x384bc8?'c':_0x2e6d('0xb');_0x23185b[_0x2e6d('0xc')]('cm_user_has_contacts','uc',_0x2e6d('0xd')+_0x2c74be+_0x2e6d('0xe'))[_0x2e6d('0xc')](_0x2e6d('0xf'),'ct',_0x2e6d('0x10')+_0x2c74be+'.id')[_0x2e6d('0xc')](_0x2e6d('0x11'),'t',_0x2e6d('0x12'));return _0x23185b;}function addFieldsToQuery(_0xed7b4d,_0x4e97a6,_0x177579,_0x25230d,_0xbb911a){var _0x20255a=_0xbb911a?'c':_0x2e6d('0xb');if(!_0x4e97a6){_0x4e97a6=['id',_0x2e6d('0x13'),_0x2e6d('0x14'),_0x2e6d('0x15'),_0x2e6d('0x16'),_0x2e6d('0x17'),_0x2e6d('0x18'),'ListId',_0x2e6d('0x19'),_0x2e6d('0x1a'),'updatedAt',_0x2e6d('0x1b'),_0x2e6d('0x1c')];}else if(!_0x4e97a6[_0x2e6d('0x1d')]('id')){_0x4e97a6[_0x2e6d('0x1e')]('id');}var _0x42b8b6=_0x177579&&_0xbb911a||!_0x177579&&!_0xbb911a;if(_0x25230d){_0x42b8b6=_0x25230d&&_0xbb911a||!_0x25230d&&!_0xbb911a;}_0x4e97a6['forEach'](function(_0x38a820){if(_0x38a820===_0x2e6d('0x1c')){if(_0x42b8b6){_0xed7b4d[_0x2e6d('0x1f')](_0x2e6d('0x20'),_0x38a820);}else if(_0x177579||_0x25230d){_0xed7b4d[_0x2e6d('0x1f')](_0x20255a+'.'+_0x38a820);}}else{_0xed7b4d[_0x2e6d('0x1f')](_0x20255a+'.'+_0x38a820);}});return _0xed7b4d;}function getSqlClauses(){var _0x1018fb={'default':squel[_0x2e6d('0x21')](),'fields':squel[_0x2e6d('0x21')](),'filter':squel[_0x2e6d('0x21')](),'tags':{'clause':squel[_0x2e6d('0x21')](),'ids':null},'user':{'clause':squel[_0x2e6d('0x21')](),'skip':![]}};return _0x1018fb;}function parseTagParameter(_0x343d57){var _0x26a12d=squel[_0x2e6d('0x21')]();if(_0x343d57){var _0x23d5fa=utils[_0x2e6d('0x22')](_0x343d57);_0x23d5fa[_0x2e6d('0x23')](function(_0x2d5b3d){_0x26a12d['or'](_0x2e6d('0x24'),'%,'+_0x2d5b3d+',%');});}return _0x26a12d;}function parseSearchFilter(_0x174f15){var _0x422900=squel[_0x2e6d('0x21')]();if(_0x174f15){var _0xc0743e=_0x174f15[_0x2e6d('0x25')]('\x5c','\x5c\x5c')[_0x2e6d('0x25')](/'/g,'\x27\x27');if(_0xc0743e[_0x2e6d('0x26')]('\x20')[_0x2e6d('0x27')]>0x1){_0x422900['or'](_0x2e6d('0x28'),qs[_0x2e6d('0x29')](_0xc0743e,!![]),null);}else{if(qs['isNumeric'](_0xc0743e)){_0x422900['or'](_0x2e6d('0x2a'),_0xc0743e+'%');_0x422900['or'](_0x2e6d('0x2b'),_0xc0743e+'%');_0x422900['or']('c.mobile\x20LIKE\x20?',_0xc0743e+'%');_0x422900['or'](_0x2e6d('0x2c'),_0xc0743e+'%');}else if(qs[_0x2e6d('0x2d')](_0xc0743e)){_0x422900['or'](_0x2e6d('0x2e'),_0xc0743e+'%');}else{_0x422900['or']('c.firstName\x20LIKE\x20?','%'+_0xc0743e+'%');_0x422900['or'](_0x2e6d('0x2f'),'%'+_0xc0743e+'%');_0x422900['or'](_0x2e6d('0x2e'),'%'+_0xc0743e+'%');}}}return _0x422900;}function parseAdvancedSearchFilter(_0x536f2a,_0x215e51){var _0x37b63a=getSqlClauses();var _0x4c14d3=as[_0x2e6d('0x30')](_0x536f2a);var _0x4d055d=_0x4c14d3[_0x2e6d('0x31')];for(var _0x460932=0x0;_0x460932<_0x4c14d3[_0x2e6d('0x32')]['length'];_0x460932++){var _0x47d269=_0x4c14d3['conditions'][_0x460932];var _0x3426cb='c';var _0x5f2196=_[_0x2e6d('0x33')](_0x215e51,[_0x2e6d('0x34'),_0x47d269[_0x2e6d('0x1f')]]);if(_0x5f2196){if(_0x47d269['field']===_0x2e6d('0x35')||_0x5f2196[_0x2e6d('0x36')]===_0x2e6d('0x37')){_0x47d269[_0x2e6d('0x38')]=_0x2e6d('0x39');}var _0x4e7221=as[_0x2e6d('0x3a')](_0x3426cb,_0x5f2196['type'],_0x47d269);_0x37b63a[_0x2e6d('0x3b')][_0x4d055d](_0x4e7221[_0x2e6d('0x3c')],_0x4e7221[_0x2e6d('0x3d')][_0x2e6d('0x3e')],_0x4e7221[_0x2e6d('0x3d')][_0x2e6d('0x3f')]);}else{if(_0x47d269[_0x2e6d('0x1f')]===_0x2e6d('0x40')){var _0x3b7884=_0x47d269[_0x2e6d('0x3d')][_0x2e6d('0x26')](',')[_0x2e6d('0x41')](function(_0x5f2744){return Number(_0x5f2744);});var _0x21d53c=parseTagParameter(_0x3b7884);_0x37b63a[_0x2e6d('0x42')]['clause'][_0x2e6d('0x43')](_0x21d53c);_0x37b63a['tags']['ids']=_0x3b7884;}else if(_0x47d269[_0x2e6d('0x1f')]==='User'){_0x37b63a['user'][_0x2e6d('0x44')][_0x2e6d('0x43')](_0x2e6d('0x45'),_0x47d269[_0x2e6d('0x3d')]);_0x37b63a['user'][_0x2e6d('0x46')]=!![];}}}return _0x37b63a;}function parseModelFields(_0x3fe76c,_0x2c3334){var _0x5e6f2d=squel[_0x2e6d('0x21')]();var _0x1bb20a=_(_0x3fe76c)[_0x2e6d('0x47')]()[_0x2e6d('0x41')](function(_0xdbe72){return _['some'](_0x2c3334,[_0x2e6d('0x34'),_0xdbe72])?_0xdbe72:undefined;})[_0x2e6d('0x48')]()[_0x2e6d('0x3d')]();if(_0x3fe76c['Contact']){_0x1bb20a['push'](_0x2e6d('0x49'));}if(_0x3fe76c[_0x2e6d('0x4a')]){_0x1bb20a['push']('User');}if(_0x1bb20a[_0x2e6d('0x27')]>0x0){_0x1bb20a['forEach'](function(_0x203f08){if(_0x203f08===_0x2e6d('0x4b')){_0x5e6f2d[_0x2e6d('0x43')]('c.ListId\x20IN\x20?',[][_0x2e6d('0x4c')](_0x3fe76c[_0x203f08]));}else if(_0x203f08===_0x2e6d('0x49')){var _0x23b0b7='%'+_0x3fe76c[_0x203f08]+'%';_0x5e6f2d[_0x2e6d('0x43')](_0x2e6d('0x4d'),_0x23b0b7);}else if(_0x203f08==='User'){_0x5e6f2d[_0x2e6d('0x43')](_0x2e6d('0x45'),_0x3fe76c[_0x203f08]);}else{_0x5e6f2d[_0x2e6d('0x43')]('c.'+_0x203f08+_0x2e6d('0x4e'),_0x3fe76c[_0x203f08]);}});}return _0x5e6f2d;}function parseQueryParameters(_0x4ad7e1,_0x520b26){var _0x19b2b5=getSqlClauses();return Promise['resolve']()[_0x2e6d('0x4f')](function(){return parseModelFields(_0x4ad7e1,_0x520b26);})[_0x2e6d('0x4f')](function(_0x3c3cad){_0x19b2b5['fields'][_0x2e6d('0x43')](_0x3c3cad);return parseTagParameter(_0x4ad7e1[_0x2e6d('0x50')]);})[_0x2e6d('0x4f')](function(_0x8c6c4d){_0x19b2b5[_0x2e6d('0x42')][_0x2e6d('0x44')][_0x2e6d('0x43')](_0x8c6c4d);return parseSearchFilter(_0x4ad7e1[_0x2e6d('0x51')]);})[_0x2e6d('0x4f')](function(_0x52f36a){_0x19b2b5['filter']=_0x52f36a;return _0x19b2b5;});}function checkListsRestrictions(_0x2aa2b9,_0x5b022d,_0x4989f9){var _0x2ccb2f=squel[_0x2e6d('0x21')]();return Promise[_0x2e6d('0x52')]()[_0x2e6d('0x4f')](function(){if(_0x5b022d[_0x2e6d('0x53')]&&_0x2aa2b9[_0x2e6d('0x54')]===_0x2e6d('0x6')&&!_0x4989f9){return _0x2aa2b9[_0x2e6d('0x55')]({'attributes':['id'],'raw':!![]});}})[_0x2e6d('0x4f')](function(_0x23de88){if(_0x23de88){if(_0x23de88['length']===0x0){_0x2ccb2f['and'](_0x2e6d('0x56'));}else{_0x2ccb2f['and'](_0x2e6d('0x57'),_[_0x2e6d('0x41')](_0x23de88,'id'));}}})[_0x2e6d('0x4f')](function(){return _0x2ccb2f;});}function buildContactsQuery(_0x25a9c6,_0x2b2fd0,_0xae0037,_0xea2f90,_0x2cf4a6,_0x39b862){if(_0x2b2fd0){_0x2b2fd0=_0xae0037[_0x2e6d('0x58')];}_0x25a9c6=addFieldsToQuery(_0x25a9c6,_0x2b2fd0,_0xea2f90,_0x39b862,!![]);var _0x14b898=squel['select']();_0x14b898=addFieldsToQuery(_0x14b898,_0x2b2fd0,_0xea2f90,_0x39b862,![]);if(_0xea2f90||_0x39b862){_0x25a9c6=applyJoinClauses(_0x25a9c6,!![]);_0x25a9c6[_0x2e6d('0x59')](_0x2e6d('0x5a'));if(_0xae0037['limit']){_0x14b898[_0x2e6d('0x5b')](_0xae0037['limit']);}if(_0xae0037[_0x2e6d('0x5c')]){_0x14b898[_0x2e6d('0x5c')](_0xae0037[_0x2e6d('0x5c')]);}}else{_0x14b898=applyJoinClauses(_0x14b898,![]);_0x14b898['group'](_0x2e6d('0x5d'));if(_0xae0037[_0x2e6d('0x5b')]){_0x25a9c6[_0x2e6d('0x5b')](_0xae0037[_0x2e6d('0x5b')]);}if(_0xae0037[_0x2e6d('0x5c')]){_0x25a9c6[_0x2e6d('0x5c')](_0xae0037[_0x2e6d('0x5c')]);}}_0x14b898[_0x2e6d('0x5e')](_0x2cf4a6);if(_0xae0037[_0x2e6d('0x5f')]){_0xae0037['order']['forEach'](function(_0x1790a6){_0x25a9c6['order']('c.'+_0x1790a6[0x0],_0x1790a6[0x1]==='DESC'?![]:!![]);_0x14b898['order']('subqry.'+_0x1790a6[0x0],_0x1790a6[0x1]==='DESC'?![]:!![]);});}_0x14b898[_0x2e6d('0x9')](_0x25a9c6,_0x2e6d('0xb'));return _0x14b898;}function getFilteredContacts(_0x12d4be){var _0x241d48=[];return db[_0x2e6d('0x40')][_0x2e6d('0x60')]({'attributes':['id','name',_0x2e6d('0x61')],'raw':!![]})['then'](function(_0x4dd8d3){_0x241d48=_[_0x2e6d('0x62')](_0x4dd8d3,'id');var _0x170b6f={'type':db['Sequelize'][_0x2e6d('0x63')][_0x2e6d('0x64')],'model':db[_0x2e6d('0x65')],'mapToModel':!![],'nest':!![],'raw':!![]};return db['sequelize']['query'](_0x12d4be[_0x2e6d('0x66')](),_0x170b6f);})[_0x2e6d('0x4f')](function(_0x53adf1){_0x53adf1[_0x2e6d('0x23')](function(_0x4336f2){if(_0x4336f2['TagIds']){_0x4336f2[_0x2e6d('0x67')]=[];_0x4336f2['TagIds']['split'](',')['forEach'](function(_0x22d9f9){_0x4336f2[_0x2e6d('0x67')]['push'](_0x241d48[_0x22d9f9]);});}delete _0x4336f2['TagIds'];});return _0x53adf1;});}function countFilteredContacts(_0x4d80ce,_0x4b6271){var _0x6c30d4=_0x4d80ce[_0x2e6d('0x68')]();_0x6c30d4[_0x2e6d('0x1f')](_0x2e6d('0x69'));_0x6c30d4=applyJoinClauses(_0x6c30d4,!![]);_0x4d80ce['group'](_0x2e6d('0x5a'));var _0x22b43a=utils[_0x2e6d('0x22')](_0x4b6271);if(!_['isEmpty'](_0x22b43a)){_0x6c30d4[_0x2e6d('0xa')]('t.id\x20IN\x20?',_0x22b43a);}var _0x371588={'type':db[_0x2e6d('0x6a')][_0x2e6d('0x63')][_0x2e6d('0x64')],'raw':!![]};return db[_0x2e6d('0x6b')]['query'](_0x6c30d4[_0x2e6d('0x66')](),_0x371588)[_0x2e6d('0x4f')](function(_0x382817){return _0x382817[0x0][_0x2e6d('0x69')];});}module[_0x2e6d('0x6c')]={'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 70ae97e..3d45fa0 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 _0x49a1=['data','binary','end','final','write','close','unlink','decryptFile','createWriteStream','createDecipher','update','utf8','decryptString','secret','base64','bluebird','lodash','../../config/environment','../../config/logger','app','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','indexOf','hasOwnProperty','encryptFile','createReadStream','createCipher'];(function(_0x2e726e,_0x3faf87){var _0x273748=function(_0x3d9fbb){while(--_0x3d9fbb){_0x2e726e['push'](_0x2e726e['shift']());}};_0x273748(++_0x3faf87);}(_0x49a1,0xb9));var _0x149a=function(_0x2f5800,_0xe42578){_0x2f5800=_0x2f5800-0x0;var _0x5010bd=_0x49a1[_0x2f5800];return _0x5010bd;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require(_0x149a('0x0'));var _=require(_0x149a('0x1'));var config=require(_0x149a('0x2'));var logger=require(_0x149a('0x3'))(_0x149a('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x149a('0x5')][_0x149a('0x6')],'algorithm':_0x149a('0x7')};const fileOptions={'algorithm':_0x149a('0x8')};if(config['encrypt']&&config[_0x149a('0x9')][_0x149a('0xa')]){var isSupported=isAlgorithmSupported(config[_0x149a('0x9')]['algorithm']);if(isSupported){fileOptions[_0x149a('0xa')]=config['encrypt'][_0x149a('0xa')];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger['error'](config['encrypt'][_0x149a('0xa')],_0x149a('0xb'),supportedAlgorithms);}}function isASupportedCipher(_0x43fc52){return AES_SUPPORTED_RX[_0x149a('0xc')](_0x43fc52);}function getSupportedCiphers(){return crypto[_0x149a('0xd')]()['filter'](isASupportedCipher);}function isAlgorithmSupported(_0xf8ed87){return getSupportedCiphers()[_0x149a('0xe')](_0xf8ed87)>-0x1;}function combineOptions(_0x7ad33a){var _0x2598ed={};for(var _0x41d8ce in fileOptions){if(fileOptions[_0x149a('0xf')](_0x41d8ce)){_0x2598ed[_0x41d8ce]=fileOptions[_0x41d8ce];}}if(_0x7ad33a){for(var _0x441011 in _0x7ad33a){if(_0x7ad33a[_0x149a('0xf')](_0x441011)){_0x2598ed[_0x441011]=_0x7ad33a[_0x441011];}}}return _0x2598ed;}exports[_0x149a('0x10')]=function(_0x3009ef,_0x1edc94,_0x440851,_0x4a0e29){return new BPromise(function(_0x45b1df,_0x5a7044){_0x4a0e29=combineOptions(_0x4a0e29);var _0x2101c9=new Buffer(_0x440851);var _0x35dd03=fs[_0x149a('0x11')](_0x3009ef);var _0x47d50b=fs['createWriteStream'](_0x1edc94);var _0x114bdf=crypto[_0x149a('0x12')](_0x4a0e29['algorithm'],_0x2101c9);_0x35dd03['on'](_0x149a('0x13'),function(_0x212fef){var _0x4b6732=new Buffer(_0x114bdf['update'](_0x212fef),_0x149a('0x14'));_0x47d50b['write'](_0x4b6732);});_0x35dd03['on'](_0x149a('0x15'),function(){try{var _0x106b4f=new Buffer(_0x114bdf[_0x149a('0x16')](_0x149a('0x14')),'binary');_0x47d50b[_0x149a('0x17')](_0x106b4f);_0x47d50b[_0x149a('0x15')]();_0x47d50b['on'](_0x149a('0x18'),function(){return _0x45b1df(_0x1edc94);});}catch(_0x4fea1c){fs[_0x149a('0x19')](_0x1edc94);return _0x5a7044(_0x4fea1c);}});});};exports[_0x149a('0x1a')]=function(_0x5d95ea,_0x10ddf0,_0x4945d7,_0x3b63c9){return new BPromise(function(_0x4da4de,_0x2d33ab){_0x3b63c9=combineOptions(_0x3b63c9);var _0x23bfba=new Buffer(_0x4945d7);var _0x4ecb81=fs['createReadStream'](_0x5d95ea);var _0x280043=fs[_0x149a('0x1b')](_0x10ddf0);var _0x58ab8d=crypto[_0x149a('0x1c')](_0x3b63c9['algorithm'],_0x23bfba);_0x4ecb81['on'](_0x149a('0x13'),function(_0x4d99b5){var _0x5d32c0=new Buffer(_0x58ab8d[_0x149a('0x1d')](_0x4d99b5),_0x149a('0x14'));_0x280043[_0x149a('0x17')](_0x5d32c0);});_0x4ecb81['on']('end',function(){try{var _0x176fd1=new Buffer(_0x58ab8d[_0x149a('0x16')](_0x149a('0x14')),_0x149a('0x14'));_0x280043[_0x149a('0x17')](_0x176fd1);_0x280043[_0x149a('0x15')]();_0x280043['on']('close',function(){return _0x4da4de(_0x10ddf0);});}catch(_0x607dce){fs[_0x149a('0x19')](_0x10ddf0);return _0x2d33ab(_0x607dce);}});});};exports['encryptString']=function(_0x39b55f,_0x108235,_0xf17458){var _0x418323=_0xf17458||stringOptions[_0x149a('0xa')];var _0x1d226b=_0x108235||stringOptions['secret'];var _0x4df5b0=crypto['createCipher'](_0x418323,_0x1d226b);var _0x53b5af=_0x4df5b0[_0x149a('0x1d')](_0x39b55f,_0x149a('0x1e'),'base64');_0x53b5af+=_0x4df5b0[_0x149a('0x16')]('base64');return _0x53b5af;};exports[_0x149a('0x1f')]=function(_0x2cea96,_0x1ab8d6,_0xf34676){var _0x237123=_0xf34676||stringOptions[_0x149a('0xa')];var _0x53ac0b=_0x1ab8d6||stringOptions[_0x149a('0x20')];var _0x308df6=crypto[_0x149a('0x1c')](_0x237123,_0x53ac0b);var _0x157960=_0x308df6[_0x149a('0x1d')](_0x2cea96,_0x149a('0x21'),_0x149a('0x1e'));_0x157960+=_0x308df6[_0x149a('0x16')](_0x149a('0x1e'));return _0x157960;}; \ No newline at end of file +var _0x4e0e=['decryptString','crypto','bluebird','lodash','../../config/environment','../../config/logger','app','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','data','update','binary','write','end','final','close','decryptFile','unlink','encryptString','secret','utf8','base64'];(function(_0x18bee8,_0x15e890){var _0x4301a9=function(_0x36c7d3){while(--_0x36c7d3){_0x18bee8['push'](_0x18bee8['shift']());}};_0x4301a9(++_0x15e890);}(_0x4e0e,0x1eb));var _0xe4e0=function(_0x50e766,_0x14d9f5){_0x50e766=_0x50e766-0x0;var _0x29fb8d=_0x4e0e[_0x50e766];return _0x29fb8d;};'use strict';var crypto=require(_0xe4e0('0x0'));var fs=require('fs');var BPromise=require(_0xe4e0('0x1'));var _=require(_0xe4e0('0x2'));var config=require(_0xe4e0('0x3'));var logger=require(_0xe4e0('0x4'))(_0xe4e0('0x5'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xe4e0('0x6')][_0xe4e0('0x7')],'algorithm':_0xe4e0('0x8')};const fileOptions={'algorithm':_0xe4e0('0x9')};if(config[_0xe4e0('0xa')]&&config[_0xe4e0('0xa')][_0xe4e0('0xb')]){var isSupported=isAlgorithmSupported(config[_0xe4e0('0xa')][_0xe4e0('0xb')]);if(isSupported){fileOptions[_0xe4e0('0xb')]=config[_0xe4e0('0xa')][_0xe4e0('0xb')];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger[_0xe4e0('0xc')](config[_0xe4e0('0xa')][_0xe4e0('0xb')],_0xe4e0('0xd'),supportedAlgorithms);}}function isASupportedCipher(_0x387211){return AES_SUPPORTED_RX[_0xe4e0('0xe')](_0x387211);}function getSupportedCiphers(){return crypto[_0xe4e0('0xf')]()['filter'](isASupportedCipher);}function isAlgorithmSupported(_0x3314a3){return getSupportedCiphers()['indexOf'](_0x3314a3)>-0x1;}function combineOptions(_0x45052c){var _0x83523={};for(var _0x5e05fd in fileOptions){if(fileOptions['hasOwnProperty'](_0x5e05fd)){_0x83523[_0x5e05fd]=fileOptions[_0x5e05fd];}}if(_0x45052c){for(var _0x102629 in _0x45052c){if(_0x45052c[_0xe4e0('0x10')](_0x102629)){_0x83523[_0x102629]=_0x45052c[_0x102629];}}}return _0x83523;}exports[_0xe4e0('0x11')]=function(_0x460fee,_0x3845bc,_0x1aca89,_0x269ae6){return new BPromise(function(_0x5108f3,_0x1ccf97){_0x269ae6=combineOptions(_0x269ae6);var _0x493c31=new Buffer(_0x1aca89);var _0x1fa3bf=fs[_0xe4e0('0x12')](_0x460fee);var _0x22deca=fs[_0xe4e0('0x13')](_0x3845bc);var _0x21d032=crypto[_0xe4e0('0x14')](_0x269ae6[_0xe4e0('0xb')],_0x493c31);_0x1fa3bf['on'](_0xe4e0('0x15'),function(_0x4d09d5){var _0x2cc3e2=new Buffer(_0x21d032[_0xe4e0('0x16')](_0x4d09d5),_0xe4e0('0x17'));_0x22deca[_0xe4e0('0x18')](_0x2cc3e2);});_0x1fa3bf['on'](_0xe4e0('0x19'),function(){try{var _0x1356c6=new Buffer(_0x21d032[_0xe4e0('0x1a')](_0xe4e0('0x17')),_0xe4e0('0x17'));_0x22deca[_0xe4e0('0x18')](_0x1356c6);_0x22deca[_0xe4e0('0x19')]();_0x22deca['on'](_0xe4e0('0x1b'),function(){return _0x5108f3(_0x3845bc);});}catch(_0x17b920){fs['unlink'](_0x3845bc);return _0x1ccf97(_0x17b920);}});});};exports[_0xe4e0('0x1c')]=function(_0x45dc97,_0xc9c0af,_0x5cb3e3,_0x18c9d7){return new BPromise(function(_0x2149fc,_0x47e28c){_0x18c9d7=combineOptions(_0x18c9d7);var _0x28172b=new Buffer(_0x5cb3e3);var _0x1ff84a=fs[_0xe4e0('0x12')](_0x45dc97);var _0x84d311=fs[_0xe4e0('0x13')](_0xc9c0af);var _0x35743e=crypto['createDecipher'](_0x18c9d7[_0xe4e0('0xb')],_0x28172b);_0x1ff84a['on']('data',function(_0x29eeba){var _0x78f0ac=new Buffer(_0x35743e['update'](_0x29eeba),'binary');_0x84d311['write'](_0x78f0ac);});_0x1ff84a['on'](_0xe4e0('0x19'),function(){try{var _0x71a66c=new Buffer(_0x35743e[_0xe4e0('0x1a')](_0xe4e0('0x17')),_0xe4e0('0x17'));_0x84d311[_0xe4e0('0x18')](_0x71a66c);_0x84d311[_0xe4e0('0x19')]();_0x84d311['on'](_0xe4e0('0x1b'),function(){return _0x2149fc(_0xc9c0af);});}catch(_0x9c95ba){fs[_0xe4e0('0x1d')](_0xc9c0af);return _0x47e28c(_0x9c95ba);}});});};exports[_0xe4e0('0x1e')]=function(_0x448af5,_0x3ec58c,_0xcf1f48){var _0x165fe3=_0xcf1f48||stringOptions[_0xe4e0('0xb')];var _0x594f6c=_0x3ec58c||stringOptions[_0xe4e0('0x1f')];var _0x5784ca=crypto[_0xe4e0('0x14')](_0x165fe3,_0x594f6c);var _0x1a4a8c=_0x5784ca[_0xe4e0('0x16')](_0x448af5,_0xe4e0('0x20'),_0xe4e0('0x21'));_0x1a4a8c+=_0x5784ca[_0xe4e0('0x1a')](_0xe4e0('0x21'));return _0x1a4a8c;};exports[_0xe4e0('0x22')]=function(_0x2dd1ee,_0x3918c9,_0x47d733){var _0xbe10da=_0x47d733||stringOptions['algorithm'];var _0x30bc10=_0x3918c9||stringOptions[_0xe4e0('0x1f')];var _0x1c24ee=crypto['createDecipher'](_0xbe10da,_0x30bc10);var _0x3afd09=_0x1c24ee['update'](_0x2dd1ee,_0xe4e0('0x21'),'utf8');_0x3afd09+=_0x1c24ee[_0xe4e0('0x1a')](_0xe4e0('0x20'));return _0x3afd09;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 86e8624..7e35ff1 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 _0xff56=['dirname','basename','.csv','existsSync','join','each','%s%d.%s','csv','writeFileSync','zip','zip\x20finished','Completed','%s.%s','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','path','lodash','bluebird','zip-dir','rimraf','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','CSV','find','splitSizeCsv','then','sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','split','length','range','isInteger','forEach','%s\x20limit\x20%d\x20OFFSET\x20%d','push'];(function(_0x2c5d57,_0x593528){var _0x27578d=function(_0x59a464){while(--_0x59a464){_0x2c5d57['push'](_0x2c5d57['shift']());}};_0x27578d(++_0x593528);}(_0xff56,0x79));var _0x6ff5=function(_0x39078d,_0x258226){_0x39078d=_0x39078d-0x0;var _0x25d9ac=_0xff56[_0x39078d];return _0x25d9ac;};'use strict';var util=require('util');var path=require(_0x6ff5('0x0'));var _=require(_0x6ff5('0x1'));var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0x6ff5('0x2'));var zipdir=require(_0x6ff5('0x3'));var rimraf=require(_0x6ff5('0x4'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0x6ff5('0x5')];var logger=require(_0x6ff5('0x6'))(_0x6ff5('0x7'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x6ff5('0x8')][0x3];var PATH=process[_0x6ff5('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x532675,_0xd139bc){var _0xfc87e5={'status':_0x532675};var _0x26eb34={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xd139bc){_0xfc87e5[_0x6ff5('0x9')]=_0xd139bc;}return db[_0x6ff5('0xa')][_0x6ff5('0xb')](_0xfc87e5,_0x26eb34);}function main(){var _0x21fc5f=0x1388;var _0x305225;logger[_0x6ff5('0xc')](util['format']('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x6ff5('0xd')));return db['Setting'][_0x6ff5('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x6ff5('0xf')]})[_0x6ff5('0x10')](function(_0xb258da){if(_0xb258da){_0x305225=_0xb258da;_0x21fc5f=_0x305225[_0x6ff5('0xf')]||0x1388;}})['then'](function(){return dbH[_0x6ff5('0x11')][_0x6ff5('0x12')](util[_0x6ff5('0x13')](_0x6ff5('0x14'),QUERY),{'type':dbH[_0x6ff5('0x11')][_0x6ff5('0x15')][_0x6ff5('0x16')]});})[_0x6ff5('0x10')](function(_0x2a0f7e){if(!_0x2a0f7e[0x0][_0x6ff5('0x17')]){return analyticExtractedReport(_0x6ff5('0x18'));}var _0x34d342=[];var _0x822da7=0x0;if(_0x305225[_0x6ff5('0x19')]){if(_0x2a0f7e&&_0x2a0f7e[_0x6ff5('0x1a')]){var _0xd922a2=_[_0x6ff5('0x1b')](_0x2a0f7e[0x0][_0x6ff5('0x17')]/_0x21fc5f);var _0x13c2a6=Number[_0x6ff5('0x1c')](_0x2a0f7e[0x0][_0x6ff5('0x17')]/_0x21fc5f)?_0x2a0f7e[0x0][_0x6ff5('0x17')]%_0x21fc5f:0x0;_0xd922a2[_0x6ff5('0x1d')](function(_0x1b614f){if(_0x1b614f>0x0){_0x822da7+=_0x21fc5f;}_0x34d342['push'](dbH[_0x6ff5('0x11')][_0x6ff5('0x12')](util['format'](_0x6ff5('0x1e'),QUERY,_0x21fc5f,_0x822da7),{'type':dbH[_0x6ff5('0x11')][_0x6ff5('0x15')][_0x6ff5('0x16')]}));});if(_0x13c2a6>0x0){_0x822da7+=_0x21fc5f;_0x34d342[_0x6ff5('0x1f')](dbH['sequelize']['query'](util[_0x6ff5('0x13')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x13c2a6,_0x822da7),{'type':dbH[_0x6ff5('0x11')][_0x6ff5('0x15')]['SELECT']}));}}}else{_0x34d342[_0x6ff5('0x1f')](dbH['sequelize'][_0x6ff5('0x12')](QUERY,{'type':dbH[_0x6ff5('0x11')][_0x6ff5('0x15')][_0x6ff5('0x16')]}));}var _0x105dd3=path[_0x6ff5('0x20')](PATH);var _0xd9232e=path[_0x6ff5('0x21')](PATH,_0x6ff5('0x22'));var _0x586168=_0x305225['split']&&_0x34d342[_0x6ff5('0x1a')]>0x1;var _0x3ab847=[];if(!fs[_0x6ff5('0x23')](path[_0x6ff5('0x24')](_0x105dd3,_0xd9232e))&&_0x586168){fs['mkdirSync'](path[_0x6ff5('0x24')](_0x105dd3,_0xd9232e));}return BPromise[_0x6ff5('0x25')](_0x34d342,function(_0x38db15){_0x3ab847['push'](_0x38db15);})[_0x6ff5('0x10')](function(){for(var _0x23c46f=0x0;_0x23c46f<_0x3ab847[_0x6ff5('0x1a')];_0x23c46f+=0x1){var _0xb8e845;var _0x4ea0a7=_0x3ab847[_0x23c46f];if(_0x586168){_0xb8e845=path['join'](_0x105dd3,_0xd9232e,util[_0x6ff5('0x13')](_0x6ff5('0x26'),_0xd9232e,_0x23c46f,_0x6ff5('0x27')));}else{_0xb8e845=path['join'](_0x105dd3,util[_0x6ff5('0x13')]('%s.%s',_0xd9232e,_0x6ff5('0x27')));}fs[_0x6ff5('0x28')](_0xb8e845,csv(_0x4ea0a7));}})[_0x6ff5('0x10')](function(){if(_0x586168){return new Promise(function(_0x2e989e){zipdir(path[_0x6ff5('0x24')](_0x105dd3,_0xd9232e),{'saveTo':path[_0x6ff5('0x24')](_0x105dd3,util[_0x6ff5('0x13')]('%s.%s',_0xd9232e,_0x6ff5('0x29')))},function(_0x1928b3,_0x384e0e){rimraf(path[_0x6ff5('0x24')](_0x105dd3,_0xd9232e),function(){});_0x2e989e(_0x6ff5('0x2a'));});});}})[_0x6ff5('0x10')](function(){logger[_0x6ff5('0xc')](util[_0x6ff5('0x13')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x6ff5('0xd')));return analyticExtractedReport(_0x6ff5('0x2b'),_0x586168?util[_0x6ff5('0x13')](_0x6ff5('0x2c'),_0xd9232e,_0x586168?_0x6ff5('0x29'):_0x6ff5('0x27')):null);});})[_0x6ff5('0x2d')](function(_0x4c7439){logger['info'](util[_0x6ff5('0x13')](_0x6ff5('0x2e'),EXTRACTED_REPORT_ID,_0x6ff5('0xd')),util[_0x6ff5('0x2f')](_0x4c7439,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x6ff5('0x30'));})[_0x6ff5('0x31')](function(){process[_0x6ff5('0x32')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xddb2=['CSV','inspect','Failed','util','path','lodash','to-csv','zip-dir','rimraf','../../mysqldb','dbH','analytics','argv','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','then','splitSizeCsv','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','num','Empty','split','length','range','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','dirname','basename','.csv','existsSync','join','each','%s%d.%s','%s.%s','csv','writeFileSync','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format'];(function(_0x2586df,_0x17558e){var _0x5bc581=function(_0x2f6b47){while(--_0x2f6b47){_0x2586df['push'](_0x2586df['shift']());}};_0x5bc581(++_0x17558e);}(_0xddb2,0xcb));var _0x2ddb=function(_0x3015ea,_0x2791b3){_0x3015ea=_0x3015ea-0x0;var _0x44b126=_0xddb2[_0x3015ea];return _0x44b126;};'use strict';var util=require(_0x2ddb('0x0'));var path=require(_0x2ddb('0x1'));var _=require(_0x2ddb('0x2'));var csv=require(_0x2ddb('0x3'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0x2ddb('0x4'));var rimraf=require(_0x2ddb('0x5'));var db=require(_0x2ddb('0x6'))['db'];var dbH=require(_0x2ddb('0x6'))[_0x2ddb('0x7')];var logger=require('../../config/logger')(_0x2ddb('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x2ddb('0x9')][0x2]);var QUERY=process[_0x2ddb('0x9')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x5ea902,_0x1df0fe){var _0x21747c={'status':_0x5ea902};var _0x51d36e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1df0fe){_0x21747c['savename']=_0x1df0fe;}return db[_0x2ddb('0xa')][_0x2ddb('0xb')](_0x21747c,_0x51d36e);}function main(){var _0x598de5=0x1388;var _0x3a2d89;logger[_0x2ddb('0xc')](util[_0x2ddb('0xd')](_0x2ddb('0xe'),EXTRACTED_REPORT_ID,'CSV'));return db[_0x2ddb('0xf')][_0x2ddb('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split','splitSizeCsv']})[_0x2ddb('0x11')](function(_0x1c1374){if(_0x1c1374){_0x3a2d89=_0x1c1374;_0x598de5=_0x3a2d89[_0x2ddb('0x12')]||0x1388;}})[_0x2ddb('0x11')](function(){return dbH[_0x2ddb('0x13')][_0x2ddb('0x14')](util[_0x2ddb('0xd')](_0x2ddb('0x15'),QUERY),{'type':dbH['sequelize']['QueryTypes'][_0x2ddb('0x16')]});})[_0x2ddb('0x11')](function(_0x20753b){if(!_0x20753b[0x0][_0x2ddb('0x17')]){return analyticExtractedReport(_0x2ddb('0x18'));}var _0x47599b=[];var _0x2f6f88=0x0;if(_0x3a2d89[_0x2ddb('0x19')]){if(_0x20753b&&_0x20753b[_0x2ddb('0x1a')]){var _0x627f7b=_[_0x2ddb('0x1b')](_0x20753b[0x0]['num']/_0x598de5);var _0x305fe8=Number['isInteger'](_0x20753b[0x0][_0x2ddb('0x17')]/_0x598de5)?_0x20753b[0x0][_0x2ddb('0x17')]%_0x598de5:0x0;_0x627f7b[_0x2ddb('0x1c')](function(_0x3562ed){if(_0x3562ed>0x0){_0x2f6f88+=_0x598de5;}_0x47599b[_0x2ddb('0x1d')](dbH[_0x2ddb('0x13')][_0x2ddb('0x14')](util['format'](_0x2ddb('0x1e'),QUERY,_0x598de5,_0x2f6f88),{'type':dbH[_0x2ddb('0x13')][_0x2ddb('0x1f')][_0x2ddb('0x16')]}));});if(_0x305fe8>0x0){_0x2f6f88+=_0x598de5;_0x47599b[_0x2ddb('0x1d')](dbH[_0x2ddb('0x13')]['query'](util['format'](_0x2ddb('0x1e'),QUERY,_0x305fe8,_0x2f6f88),{'type':dbH[_0x2ddb('0x13')][_0x2ddb('0x1f')][_0x2ddb('0x16')]}));}}}else{_0x47599b[_0x2ddb('0x1d')](dbH[_0x2ddb('0x13')][_0x2ddb('0x14')](QUERY,{'type':dbH[_0x2ddb('0x13')][_0x2ddb('0x1f')][_0x2ddb('0x16')]}));}var _0x2ae3c7=path[_0x2ddb('0x20')](PATH);var _0x27dc4e=path[_0x2ddb('0x21')](PATH,_0x2ddb('0x22'));var _0x3a899c=_0x3a2d89[_0x2ddb('0x19')]&&_0x47599b['length']>0x1;var _0x5a8466=[];if(!fs[_0x2ddb('0x23')](path[_0x2ddb('0x24')](_0x2ae3c7,_0x27dc4e))&&_0x3a899c){fs['mkdirSync'](path[_0x2ddb('0x24')](_0x2ae3c7,_0x27dc4e));}return BPromise[_0x2ddb('0x25')](_0x47599b,function(_0x2293f4){_0x5a8466['push'](_0x2293f4);})[_0x2ddb('0x11')](function(){for(var _0x5dbb2a=0x0;_0x5dbb2a<_0x5a8466['length'];_0x5dbb2a+=0x1){var _0x32a0a9;var _0x90a69c=_0x5a8466[_0x5dbb2a];if(_0x3a899c){_0x32a0a9=path[_0x2ddb('0x24')](_0x2ae3c7,_0x27dc4e,util[_0x2ddb('0xd')](_0x2ddb('0x26'),_0x27dc4e,_0x5dbb2a,'csv'));}else{_0x32a0a9=path[_0x2ddb('0x24')](_0x2ae3c7,util[_0x2ddb('0xd')](_0x2ddb('0x27'),_0x27dc4e,_0x2ddb('0x28')));}fs[_0x2ddb('0x29')](_0x32a0a9,csv(_0x90a69c));}})[_0x2ddb('0x11')](function(){if(_0x3a899c){return new Promise(function(_0x5816b7){zipdir(path[_0x2ddb('0x24')](_0x2ae3c7,_0x27dc4e),{'saveTo':path['join'](_0x2ae3c7,util[_0x2ddb('0xd')](_0x2ddb('0x27'),_0x27dc4e,'zip'))},function(_0x38de9b,_0x99f325){rimraf(path[_0x2ddb('0x24')](_0x2ae3c7,_0x27dc4e),function(){});_0x5816b7('zip\x20finished');});});}})['then'](function(){logger[_0x2ddb('0xc')](util['format'](_0x2ddb('0x2a'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0x2ddb('0x2b'),_0x3a899c?util[_0x2ddb('0xd')](_0x2ddb('0x27'),_0x27dc4e,_0x3a899c?_0x2ddb('0x2c'):'csv'):null);});})[_0x2ddb('0x2d')](function(_0x5e16d2){logger[_0x2ddb('0xc')](util[_0x2ddb('0xd')](_0x2ddb('0x2e'),EXTRACTED_REPORT_ID,_0x2ddb('0x2f')),util[_0x2ddb('0x30')](_0x5e16d2,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x2ddb('0x31'));})['finally'](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index c46b8cc..37de14c 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 _0xaafc=['/fonts/arial-bold-italic.ttf','channel','interactionId','YYYY-MM-DD','Arial','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','end','createPdfFromHTML','catch','util','path','moment','html-to-pdfmake','pdfmake/src/printer','rimraf','JSDOM','window','bluebird','../../mysqldb','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','pick','toString','fill','length','auto','body','concat','chunk','keys','forEach','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','format','endDate','push','header','pageBreak','before','landscape','footer','black','right','num','Setting','split','then','splitSizePdf','range','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','basename','.pdf','existsSync','each','flatten','createPdfKitDocument','join','pdf','%s.%s','all','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','/fonts/arial-bold.ttf'];(function(_0x16da99,_0x9a31f4){var _0x9636fa=function(_0x43b80b){while(--_0x43b80b){_0x16da99['push'](_0x16da99['shift']());}};_0x9636fa(++_0x9a31f4);}(_0xaafc,0xbc));var _0xcaaf=function(_0x310750,_0x50a0c7){_0x310750=_0x310750-0x0;var _0x1a9f70=_0xaafc[_0x310750];return _0x1a9f70;};'use strict';var _=require('lodash');var fs=require('fs');var util=require(_0xcaaf('0x0'));var path=require(_0xcaaf('0x1'));var moment=require(_0xcaaf('0x2'));var htmlToPdfmake=require(_0xcaaf('0x3'));var PdfPrinter=require(_0xcaaf('0x4'));var zipdir=require('zip-dir');var rimraf=require(_0xcaaf('0x5'));var JSDOM=require('jsdom')[_0xcaaf('0x6')];var window=new JSDOM('')[_0xcaaf('0x7')];var BPromise=require(_0xcaaf('0x8'));var db=require(_0xcaaf('0x9'))['db'];var dbH=require(_0xcaaf('0x9'))['dbH'];var logger=require('../../config/logger')(_0xcaaf('0xa'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xcaaf('0xb')][0x3];var PATH=process[_0xcaaf('0xb')][0x4];var NAME=process['argv'][0x5];var FORMAT=_0xcaaf('0xc');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0xa8454b,_0x530f11){var _0x4c19a2={'status':_0xa8454b};var _0x1d2f25={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x530f11){_0x4c19a2[_0xcaaf('0xd')]=_0x530f11;}return db[_0xcaaf('0xe')][_0xcaaf('0xf')](_0x4c19a2,_0x1d2f25);}function getHeaders(_0x364f33){return _[_0xcaaf('0x10')](_0x364f33,function(_0x3236be){return{'text':_0x3236be,'style':'tableHeader'};});}function getRows(_0x407025,_0x4ad29a){return _['map'](_0x4ad29a,function(_0x3c4628){return _(_0x3c4628)[_0xcaaf('0x11')](_0x407025)[_0xcaaf('0x10')](function(_0x1c19b2){return _0x1c19b2?_[_0xcaaf('0x12')](_0x1c19b2):'';})['value']();});}function createTable(_0x326c09,_0xe59bfe){var _0x532ddf={'widths':_[_0xcaaf('0x13')](Array(_0x326c09[_0xcaaf('0x14')]),0x91),'heights':function(_0x5f0f9c){return _0x5f0f9c===0x0?_0xcaaf('0x15'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x4b7b7a=getHeaders(_0x326c09);_0x532ddf[_0xcaaf('0x16')]['push'](_0x4b7b7a);var _0x4f6f38=getRows(_0x326c09,_0xe59bfe);_0x532ddf[_0xcaaf('0x16')]=_0x532ddf[_0xcaaf('0x16')][_0xcaaf('0x17')](_0x4f6f38);return _0x532ddf;}function createTables(_0x134414){var _0x289210=[];var _0x1bce29=_[_0xcaaf('0x18')](Object[_0xcaaf('0x19')](_0x134414[0x0]),0x5);_0x1bce29[_0xcaaf('0x1a')](function(_0x3b0f03){_0x289210['push'](createTable(_0x3b0f03,_0x134414));});return _0x289210;}function getPDFDocDefinition(_0x3c6abe){var _0xdeb94a=util['format'](_0xcaaf('0x1b'),NAME,EXTRACTED_REPORT[_0xcaaf('0x1c')],moment(EXTRACTED_REPORT[_0xcaaf('0x1d')])[_0xcaaf('0x1e')](FORMAT),moment(EXTRACTED_REPORT[_0xcaaf('0x1f')])[_0xcaaf('0x1e')](FORMAT));var _0x3ca1d4=[];for(var _0x3d5b62=0x0;_0x3d5b62<_0x3c6abe[_0xcaaf('0x14')];_0x3d5b62++){var _0x182dfa=[];if(_0x3d5b62===0x0){_0x182dfa[_0xcaaf('0x20')]({'text':_0xdeb94a,'style':_0xcaaf('0x21')});}var _0x24302a={'table':_0x3c6abe[_0x3d5b62]};if(_0x3d5b62>0x0){_0x24302a[_0xcaaf('0x22')]=_0xcaaf('0x23');_0x24302a['margin']=[0x0,0x46,0x0,0x0];}_0x182dfa[_0xcaaf('0x20')](_0x24302a);_0x3ca1d4[_0xcaaf('0x20')](_0x182dfa);}return{'pageSize':'A4','pageOrientation':_0xcaaf('0x24'),'content':_0x3ca1d4,'footer':function(_0x5cce6c,_0x4f223f){return{'text':_0x5cce6c[_0xcaaf('0x12')]()+'\x20/\x20'+_0x4f223f,'style':_0xcaaf('0x25')};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xcaaf('0x26')},'footer':{'alignment':_0xcaaf('0x27'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x5597a1){var _0x4f0205=0x1388;var _0x151331;if(!_0x5597a1[0x0][_0xcaaf('0x28')]){return analyticExtractedReport('Empty');}return db[_0xcaaf('0x29')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xcaaf('0x2a'),'splitSizePdf']})[_0xcaaf('0x2b')](function(_0x26352f){if(_0x26352f){_0x151331=_0x26352f;_0x4f0205=_0x151331[_0xcaaf('0x2c')]||0x3e8;}})['then'](function(){var _0x5bdaf3=[];var _0x3c770f=0x0;if(_0x151331[_0xcaaf('0x2a')]){if(_0x5597a1&&_0x5597a1[_0xcaaf('0x14')]){var _0xf2bb69=_[_0xcaaf('0x2d')](_0x5597a1[0x0][_0xcaaf('0x28')]/_0x4f0205);var _0x2645da=Number['isInteger'](_0x5597a1[0x0][_0xcaaf('0x28')]/_0x4f0205)?_0x5597a1[0x0][_0xcaaf('0x28')]%_0x4f0205:0x0;_0xf2bb69['forEach'](function(_0x370f58){if(_0x370f58>0x0){_0x3c770f+=_0x4f0205;}_0x5bdaf3[_0xcaaf('0x20')](dbH[_0xcaaf('0x2e')][_0xcaaf('0x2f')](util['format'](_0xcaaf('0x30'),QUERY,_0x4f0205,_0x3c770f),{'type':dbH['sequelize'][_0xcaaf('0x31')][_0xcaaf('0x32')]}));});if(_0x2645da>0x0){_0x3c770f+=_0x4f0205;_0x5bdaf3[_0xcaaf('0x20')](dbH['sequelize'][_0xcaaf('0x2f')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x2645da,_0x3c770f),{'type':dbH[_0xcaaf('0x2e')][_0xcaaf('0x31')][_0xcaaf('0x32')]}));}}}else{_0x5bdaf3['push'](dbH[_0xcaaf('0x2e')]['query'](QUERY,{'type':dbH[_0xcaaf('0x2e')][_0xcaaf('0x31')]['SELECT']}));}var _0x10b9d5=path['dirname'](PATH);var _0x5ba770=path[_0xcaaf('0x33')](PATH,_0xcaaf('0x34'));var _0x585d9a=_0x151331['split']&&_0x5bdaf3[_0xcaaf('0x14')]>0x1;var _0x496f67=[];if(!fs[_0xcaaf('0x35')](path['join'](_0x10b9d5,_0x5ba770))&&_0x585d9a){fs['mkdirSync'](path['join'](_0x10b9d5,_0x5ba770));}return BPromise[_0xcaaf('0x36')](_0x5bdaf3,function(_0x4b2e19){_0x496f67[_0xcaaf('0x20')](_0x4b2e19);})[_0xcaaf('0x2b')](function(){var _0x34aff8=[];for(var _0x12e326=0x0;_0x12e326<_0x496f67[_0xcaaf('0x14')];_0x12e326+=0x1){var _0x58e777=_0x496f67[_0x12e326];var _0x48ec1d=createTables(_[_0xcaaf('0x37')](_0x58e777));var _0x1ae0c9;var _0x1c0887=getPDFDocDefinition(_0x48ec1d);var _0xa41906=getPDFPrinter();var _0x4f8539=_0xa41906[_0xcaaf('0x38')](_0x1c0887);if(_0x585d9a){_0x1ae0c9=path[_0xcaaf('0x39')](_0x10b9d5,_0x5ba770,util[_0xcaaf('0x1e')]('%s%d.%s',_0x5ba770,_0x12e326,_0xcaaf('0x3a')));}else{_0x1ae0c9=path[_0xcaaf('0x39')](_0x10b9d5,util[_0xcaaf('0x1e')](_0xcaaf('0x3b'),_0x5ba770,_0xcaaf('0x3a')));}_0x34aff8[_0xcaaf('0x20')](writePDFDocument(_0x4f8539,_0x1ae0c9));}return Promise[_0xcaaf('0x3c')](_0x34aff8);})[_0xcaaf('0x2b')](function(){if(_0x585d9a){return new Promise(function(_0xbd06ee){zipdir(path[_0xcaaf('0x39')](_0x10b9d5,_0x5ba770),{'saveTo':path[_0xcaaf('0x39')](_0x10b9d5,util['format']('%s.%s',_0x5ba770,_0xcaaf('0x3d')))},function(){rimraf(path[_0xcaaf('0x39')](_0x10b9d5,_0x5ba770),function(){});_0xbd06ee(_0xcaaf('0x3e'));});});}})[_0xcaaf('0x2b')](function(){if(!_0x585d9a)return;rimraf(path['join'](_0x10b9d5,_0x5ba770),function(){});})[_0xcaaf('0x2b')](function(){logger[_0xcaaf('0x3f')](util[_0xcaaf('0x1e')](_0xcaaf('0x40'),EXTRACTED_REPORT_ID,_0xcaaf('0x41')));return analyticExtractedReport(_0xcaaf('0x42'),_0x585d9a?util[_0xcaaf('0x1e')](_0xcaaf('0x3b'),_0x5ba770,_0x585d9a?'zip':_0xcaaf('0x3a')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xcaaf('0x3f')](util[_0xcaaf('0x1e')](_0xcaaf('0x43'),EXTRACTED_REPORT_ID,'PDF'));return db['AnalyticExtractedReport'][_0xcaaf('0x44')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xcaaf('0x2b')](function(_0x414ac3){EXTRACTED_REPORT=_0x414ac3;return dbH[_0xcaaf('0x2e')][_0xcaaf('0x2f')](util['format']('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH['sequelize']['QueryTypes'][_0xcaaf('0x32')]});})[_0xcaaf('0x2b')](extractReport)['catch'](function(_0x5af973){logger['info'](util[_0xcaaf('0x1e')](_0xcaaf('0x45'),EXTRACTED_REPORT_ID,_0xcaaf('0x41')),util[_0xcaaf('0x46')](_0x5af973,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xcaaf('0x47'));})['finally'](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x2337ab=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+_0xcaaf('0x48'),'italics':__dirname+'/fonts/arial-italic.ttf','bolditalics':__dirname+_0xcaaf('0x49')}});return _0x2337ab;}function getPDFDocDefinitionFromHTML(_0x42c34e,_0x33e001){var _0x4b4065=util[_0xcaaf('0x1e')]('%s\x20#%d',_0x33e001[_0xcaaf('0x4a')],_0x33e001[_0xcaaf('0x4b')]);var _0xb83070=moment()[_0xcaaf('0x1e')](_0xcaaf('0x4c'))[_0xcaaf('0x12')]();var _0x37e5cb=htmlToPdfmake(_0x42c34e,{'window':window,'tableAutoSize':!![]});return{'content':[_0x37e5cb],'defaultStyle':{'font':_0xcaaf('0x4d')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':'center','margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xcaaf('0x4e'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xcaaf('0x4e')}},'header':function(){return[{'text':_0xcaaf('0x4f'),'style':_0xcaaf('0x21')}];},'footer':function(_0x70f94a,_0xb6e5ca){return[{'text':util[_0xcaaf('0x1e')](_0xcaaf('0x50'),_0x4b4065,_0x70f94a,_0xb6e5ca,_0xb83070),'style':_0xcaaf('0x25')}];}};}function writePDFDocument(_0x1d42a0,_0x43ca48){return new Promise(function(_0x94c0fb,_0x5b1040){var _0x4d88eb=_0x1d42a0[_0xcaaf('0x51')](fs[_0xcaaf('0x52')](_0x43ca48));_0x4d88eb['on'](_0xcaaf('0x53'),function(){_0x94c0fb(_0xcaaf('0x53'));});_0x4d88eb['on']('error',function(_0x25ff6d){_0x5b1040(_0x25ff6d);});_0x1d42a0[_0xcaaf('0x54')]();});}exports[_0xcaaf('0x55')]=function(_0x1fffe9,_0x24d8ae){var _0x5a2aa2=getPDFPrinter();var _0x2fdb03=getPDFDocDefinitionFromHTML(_0x1fffe9,_0x24d8ae);var _0x58f728=_0x5a2aa2['createPdfKitDocument'](_0x2fdb03);return writePDFDocument(_0x58f728,_0x24d8ae[_0xcaaf('0x1')])[_0xcaaf('0x56')](function(_0x333cc2){throw _0x333cc2;});}; \ No newline at end of file +var _0x051f=['format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','endDate','header','margin','landscape','footer','Arial','black','right','Empty','Setting','split','splitSizePdf','then','range','num','isInteger','forEach','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','QueryTypes','dirname','basename','.pdf','existsSync','join','mkdirSync','flatten','createPdfKitDocument','%s%d.%s','pdf','%s.%s','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','zip','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','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-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','createWriteStream','finish','end','lodash','util','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','jsdom','../../mysqldb','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','AnalyticExtractedReport','update','map','pick','toString','value','fill','length','auto','body','push','concat','chunk'];(function(_0x1a2465,_0x510369){var _0x53391f=function(_0x53268b){while(--_0x53268b){_0x1a2465['push'](_0x1a2465['shift']());}};_0x53391f(++_0x510369);}(_0x051f,0xee));var _0xf051=function(_0x5bfd3b,_0x4f9a9f){_0x5bfd3b=_0x5bfd3b-0x0;var _0x1f37f5=_0x051f[_0x5bfd3b];return _0x1f37f5;};'use strict';var _=require(_0xf051('0x0'));var fs=require('fs');var util=require(_0xf051('0x1'));var path=require(_0xf051('0x2'));var moment=require(_0xf051('0x3'));var htmlToPdfmake=require(_0xf051('0x4'));var PdfPrinter=require(_0xf051('0x5'));var zipdir=require(_0xf051('0x6'));var rimraf=require('rimraf');var JSDOM=require(_0xf051('0x7'))['JSDOM'];var window=new JSDOM('')['window'];var BPromise=require('bluebird');var db=require('../../mysqldb')['db'];var dbH=require(_0xf051('0x8'))['dbH'];var logger=require(_0xf051('0x9'))(_0xf051('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0xf051('0xb')][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];var NAME=process[_0xf051('0xb')][0x5];var FORMAT=_0xf051('0xc');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x1c34f9,_0x59ff14){var _0x428682={'status':_0x1c34f9};var _0x49e293={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x59ff14){_0x428682['savename']=_0x59ff14;}return db[_0xf051('0xd')][_0xf051('0xe')](_0x428682,_0x49e293);}function getHeaders(_0x316ebd){return _[_0xf051('0xf')](_0x316ebd,function(_0x5de662){return{'text':_0x5de662,'style':'tableHeader'};});}function getRows(_0x27e1d6,_0xd80310){return _['map'](_0xd80310,function(_0x53536c){return _(_0x53536c)[_0xf051('0x10')](_0x27e1d6)[_0xf051('0xf')](function(_0x1723ea){return _0x1723ea?_[_0xf051('0x11')](_0x1723ea):'';})[_0xf051('0x12')]();});}function createTable(_0x3c478b,_0xb22771){var _0x2b7fe2={'widths':_[_0xf051('0x13')](Array(_0x3c478b[_0xf051('0x14')]),0x91),'heights':function(_0xf97e53){return _0xf97e53===0x0?_0xf051('0x15'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x55a84d=getHeaders(_0x3c478b);_0x2b7fe2[_0xf051('0x16')][_0xf051('0x17')](_0x55a84d);var _0x4b62d1=getRows(_0x3c478b,_0xb22771);_0x2b7fe2[_0xf051('0x16')]=_0x2b7fe2[_0xf051('0x16')][_0xf051('0x18')](_0x4b62d1);return _0x2b7fe2;}function createTables(_0xb0fed4){var _0x30df0d=[];var _0x183194=_[_0xf051('0x19')](Object['keys'](_0xb0fed4[0x0]),0x5);_0x183194['forEach'](function(_0x2d5c5b){_0x30df0d[_0xf051('0x17')](createTable(_0x2d5c5b,_0xb0fed4));});return _0x30df0d;}function getPDFDocDefinition(_0x4b1e90){var _0x4158d1=util[_0xf051('0x1a')](_0xf051('0x1b'),NAME,EXTRACTED_REPORT[_0xf051('0x1c')],moment(EXTRACTED_REPORT[_0xf051('0x1d')])['format'](FORMAT),moment(EXTRACTED_REPORT[_0xf051('0x1e')])[_0xf051('0x1a')](FORMAT));var _0x1f5631=[];for(var _0xaac2a3=0x0;_0xaac2a3<_0x4b1e90[_0xf051('0x14')];_0xaac2a3++){var _0x4a1198=[];if(_0xaac2a3===0x0){_0x4a1198[_0xf051('0x17')]({'text':_0x4158d1,'style':_0xf051('0x1f')});}var _0x49b17d={'table':_0x4b1e90[_0xaac2a3]};if(_0xaac2a3>0x0){_0x49b17d['pageBreak']='before';_0x49b17d[_0xf051('0x20')]=[0x0,0x46,0x0,0x0];}_0x4a1198[_0xf051('0x17')](_0x49b17d);_0x1f5631[_0xf051('0x17')](_0x4a1198);}return{'pageSize':'A4','pageOrientation':_0xf051('0x21'),'content':_0x1f5631,'footer':function(_0x5243e6,_0x3cb7b0){return{'text':_0x5243e6[_0xf051('0x11')]()+'\x20/\x20'+_0x3cb7b0,'style':_0xf051('0x22')};},'defaultStyle':{'font':_0xf051('0x23')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xf051('0x24')},'footer':{'alignment':_0xf051('0x25'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x243df2){var _0x2ef1f2=0x1388;var _0x1fb1a2;if(!_0x243df2[0x0]['num']){return analyticExtractedReport(_0xf051('0x26'));}return db[_0xf051('0x27')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xf051('0x28'),_0xf051('0x29')]})[_0xf051('0x2a')](function(_0x3674b2){if(_0x3674b2){_0x1fb1a2=_0x3674b2;_0x2ef1f2=_0x1fb1a2[_0xf051('0x29')]||0x3e8;}})[_0xf051('0x2a')](function(){var _0xd53cfc=[];var _0x46b926=0x0;if(_0x1fb1a2[_0xf051('0x28')]){if(_0x243df2&&_0x243df2[_0xf051('0x14')]){var _0x370352=_[_0xf051('0x2b')](_0x243df2[0x0][_0xf051('0x2c')]/_0x2ef1f2);var _0x2bd232=Number[_0xf051('0x2d')](_0x243df2[0x0][_0xf051('0x2c')]/_0x2ef1f2)?_0x243df2[0x0][_0xf051('0x2c')]%_0x2ef1f2:0x0;_0x370352[_0xf051('0x2e')](function(_0x4d7454){if(_0x4d7454>0x0){_0x46b926+=_0x2ef1f2;}_0xd53cfc[_0xf051('0x17')](dbH[_0xf051('0x2f')][_0xf051('0x30')](util[_0xf051('0x1a')](_0xf051('0x31'),QUERY,_0x2ef1f2,_0x46b926),{'type':dbH[_0xf051('0x2f')]['QueryTypes'][_0xf051('0x32')]}));});if(_0x2bd232>0x0){_0x46b926+=_0x2ef1f2;_0xd53cfc[_0xf051('0x17')](dbH[_0xf051('0x2f')][_0xf051('0x30')](util[_0xf051('0x1a')](_0xf051('0x31'),QUERY,_0x2bd232,_0x46b926),{'type':dbH[_0xf051('0x2f')][_0xf051('0x33')][_0xf051('0x32')]}));}}}else{_0xd53cfc[_0xf051('0x17')](dbH['sequelize'][_0xf051('0x30')](QUERY,{'type':dbH[_0xf051('0x2f')][_0xf051('0x33')]['SELECT']}));}var _0x4c4f6e=path[_0xf051('0x34')](PATH);var _0x422acc=path[_0xf051('0x35')](PATH,_0xf051('0x36'));var _0x1b4d6e=_0x1fb1a2['split']&&_0xd53cfc[_0xf051('0x14')]>0x1;var _0x2c1b3a=[];if(!fs[_0xf051('0x37')](path[_0xf051('0x38')](_0x4c4f6e,_0x422acc))&&_0x1b4d6e){fs[_0xf051('0x39')](path[_0xf051('0x38')](_0x4c4f6e,_0x422acc));}return BPromise['each'](_0xd53cfc,function(_0x5233b1){_0x2c1b3a['push'](_0x5233b1);})[_0xf051('0x2a')](function(){var _0x1eef21=[];for(var _0x49176d=0x0;_0x49176d<_0x2c1b3a[_0xf051('0x14')];_0x49176d+=0x1){var _0x126af6=_0x2c1b3a[_0x49176d];var _0x5e14d0=createTables(_[_0xf051('0x3a')](_0x126af6));var _0x4d85a9;var _0x1b3992=getPDFDocDefinition(_0x5e14d0);var _0x31db8e=getPDFPrinter();var _0x3fcd16=_0x31db8e[_0xf051('0x3b')](_0x1b3992);if(_0x1b4d6e){_0x4d85a9=path['join'](_0x4c4f6e,_0x422acc,util[_0xf051('0x1a')](_0xf051('0x3c'),_0x422acc,_0x49176d,_0xf051('0x3d')));}else{_0x4d85a9=path[_0xf051('0x38')](_0x4c4f6e,util[_0xf051('0x1a')](_0xf051('0x3e'),_0x422acc,_0xf051('0x3d')));}_0x1eef21[_0xf051('0x17')](writePDFDocument(_0x3fcd16,_0x4d85a9));}return Promise['all'](_0x1eef21);})['then'](function(){if(_0x1b4d6e){return new Promise(function(_0x5adf07){zipdir(path[_0xf051('0x38')](_0x4c4f6e,_0x422acc),{'saveTo':path[_0xf051('0x38')](_0x4c4f6e,util[_0xf051('0x1a')]('%s.%s',_0x422acc,'zip'))},function(){rimraf(path[_0xf051('0x38')](_0x4c4f6e,_0x422acc),function(){});_0x5adf07('zip\x20finished');});});}})['then'](function(){if(!_0x1b4d6e)return;rimraf(path[_0xf051('0x38')](_0x4c4f6e,_0x422acc),function(){});})[_0xf051('0x2a')](function(){logger[_0xf051('0x3f')](util[_0xf051('0x1a')](_0xf051('0x40'),EXTRACTED_REPORT_ID,_0xf051('0x41')));return analyticExtractedReport(_0xf051('0x42'),_0x1b4d6e?util[_0xf051('0x1a')](_0xf051('0x3e'),_0x422acc,_0x1b4d6e?_0xf051('0x43'):_0xf051('0x3d')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xf051('0x3f')](util[_0xf051('0x1a')](_0xf051('0x44'),EXTRACTED_REPORT_ID,'PDF'));return db[_0xf051('0xd')][_0xf051('0x45')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xf051('0x2a')](function(_0x13108f){EXTRACTED_REPORT=_0x13108f;return dbH[_0xf051('0x2f')][_0xf051('0x30')](util[_0xf051('0x1a')](_0xf051('0x46'),QUERY),{'type':dbH['sequelize'][_0xf051('0x33')][_0xf051('0x32')]});})[_0xf051('0x2a')](extractReport)[_0xf051('0x47')](function(_0x402e81){logger[_0xf051('0x3f')](util[_0xf051('0x1a')](_0xf051('0x48'),EXTRACTED_REPORT_ID,'PDF'),util['inspect'](_0x402e81,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xf051('0x49'));})[_0xf051('0x4a')](function(){process[_0xf051('0x4b')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x387407=new PdfPrinter({'Arial':{'normal':__dirname+_0xf051('0x4c'),'bold':__dirname+_0xf051('0x4d'),'italics':__dirname+_0xf051('0x4e'),'bolditalics':__dirname+_0xf051('0x4f')}});return _0x387407;}function getPDFDocDefinitionFromHTML(_0x1ddf94,_0x41713a){var _0x3e7fe2=util['format'](_0xf051('0x50'),_0x41713a['channel'],_0x41713a[_0xf051('0x51')]);var _0x9fcc1e=moment()[_0xf051('0x1a')](_0xf051('0x52'))['toString']();var _0x3fbde3=htmlToPdfmake(_0x1ddf94,{'window':window,'tableAutoSize':!![]});return{'content':[_0x3fbde3],'defaultStyle':{'font':_0xf051('0x23')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':'center','margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xf051('0x53'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':_0xf051('0x54'),'style':'header'}];},'footer':function(_0x23b48d,_0x3bc633){return[{'text':util[_0xf051('0x1a')]('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0x3e7fe2,_0x23b48d,_0x3bc633,_0x9fcc1e),'style':_0xf051('0x22')}];}};}function writePDFDocument(_0x2f2710,_0x99541){return new Promise(function(_0x28922e,_0x284047){var _0x5cceed=_0x2f2710['pipe'](fs[_0xf051('0x55')](_0x99541));_0x5cceed['on'](_0xf051('0x56'),function(){_0x28922e(_0xf051('0x56'));});_0x5cceed['on']('error',function(_0x25709c){_0x284047(_0x25709c);});_0x2f2710[_0xf051('0x57')]();});}exports['createPdfFromHTML']=function(_0x1ed584,_0x201ad6){var _0x178cd8=getPDFPrinter();var _0x2b8770=getPDFDocDefinitionFromHTML(_0x1ed584,_0x201ad6);var _0x52d807=_0x178cd8[_0xf051('0x3b')](_0x2b8770);return writePDFDocument(_0x52d807,_0x201ad6[_0xf051('0x2')])[_0xf051('0x47')](function(_0x541069){throw _0x541069;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 9e21c25..9c53346 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 _0xa7fa=['inspect','exit','util','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','then','splitSizeXlsx','sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','num','Empty','split','length','range','forEach','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','push','dirname','existsSync','mkdirSync','each','join','%s%d.%s','xlsx','%s.%s','binary','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch'];(function(_0x593952,_0x5e87e3){var _0x1fd3b1=function(_0x2295fc){while(--_0x2295fc){_0x593952['push'](_0x593952['shift']());}};_0x1fd3b1(++_0x5e87e3);}(_0xa7fa,0xfc));var _0xaa7f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa7fa[_0x14add3];return _0x4a174f;};'use strict';var util=require(_0xaa7f('0x0'));var path=require('path');var _=require('lodash');var fs=require('fs');var json2xls=require(_0xaa7f('0x1'));var BPromise=require(_0xaa7f('0x2'));var zipdir=require(_0xaa7f('0x3'));var rimraf=require(_0xaa7f('0x4'));var db=require('../../mysqldb')['db'];var dbH=require(_0xaa7f('0x5'))[_0xaa7f('0x6')];var logger=require(_0xaa7f('0x7'))(_0xaa7f('0x8'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xaa7f('0x9')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x50bab6,_0x3898a3){var _0x506a91={'status':_0x50bab6};var _0x3ac236={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3898a3){_0x506a91[_0xaa7f('0xa')]=_0x3898a3;}return db[_0xaa7f('0xb')][_0xaa7f('0xc')](_0x506a91,_0x3ac236);}function main(){var _0x5de597=0x1388;var _0x38c907;logger[_0xaa7f('0xd')](util['format'](_0xaa7f('0xe'),EXTRACTED_REPORT_ID,_0xaa7f('0xf')));return db[_0xaa7f('0x10')][_0xaa7f('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split','splitSizeXlsx']})[_0xaa7f('0x12')](function(_0x7e736){if(_0x7e736){_0x38c907=_0x7e736;_0x5de597=_0x38c907[_0xaa7f('0x13')]||0x1388;}})[_0xaa7f('0x12')](function(){return dbH[_0xaa7f('0x14')][_0xaa7f('0x15')](util[_0xaa7f('0x16')](_0xaa7f('0x17'),QUERY),{'type':dbH[_0xaa7f('0x14')]['QueryTypes'][_0xaa7f('0x18')]});})['then'](function(_0x3c1615){if(!_0x3c1615[0x0][_0xaa7f('0x19')]){return analyticExtractedReport(_0xaa7f('0x1a'));}var _0x48844f=[];var _0x7276be=0x0;if(_0x38c907[_0xaa7f('0x1b')]){if(_0x3c1615&&_0x3c1615[_0xaa7f('0x1c')]){var _0x2f09e1=_[_0xaa7f('0x1d')](_0x3c1615[0x0][_0xaa7f('0x19')]/_0x5de597);var _0x2c17c4=Number['isInteger'](_0x3c1615[0x0][_0xaa7f('0x19')]/_0x5de597)?_0x3c1615[0x0][_0xaa7f('0x19')]%_0x5de597:0x0;_0x2f09e1[_0xaa7f('0x1e')](function(_0x2a0171){if(_0x2a0171>0x0){_0x7276be+=_0x5de597;}_0x48844f['push'](dbH['sequelize'][_0xaa7f('0x15')](util['format'](_0xaa7f('0x1f'),QUERY,_0x5de597,_0x7276be),{'type':dbH[_0xaa7f('0x14')]['QueryTypes'][_0xaa7f('0x18')]}));});if(_0x2c17c4>0x0){_0x7276be+=_0x5de597;_0x48844f['push'](dbH[_0xaa7f('0x14')][_0xaa7f('0x15')](util[_0xaa7f('0x16')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x2c17c4,_0x7276be),{'type':dbH[_0xaa7f('0x14')][_0xaa7f('0x20')][_0xaa7f('0x18')]}));}}}else{_0x48844f[_0xaa7f('0x21')](dbH['sequelize']['query'](QUERY,{'type':dbH[_0xaa7f('0x14')][_0xaa7f('0x20')][_0xaa7f('0x18')]}));}var _0x246a18=path[_0xaa7f('0x22')](PATH);var _0x1bd627=path['basename'](PATH,'.xlsx');var _0x525df7=_0x38c907[_0xaa7f('0x1b')]&&_0x48844f['length']>0x1;var _0xbff8a0=[];if(!fs[_0xaa7f('0x23')](path['join'](_0x246a18,_0x1bd627))&&_0x525df7){fs[_0xaa7f('0x24')](path['join'](_0x246a18,_0x1bd627));}return BPromise[_0xaa7f('0x25')](_0x48844f,function(_0xa26af){_0xbff8a0[_0xaa7f('0x21')](_0xa26af);})[_0xaa7f('0x12')](function(){for(var _0x223321=0x0;_0x223321<_0xbff8a0['length'];_0x223321+=0x1){var _0x1541e1;var _0x3e0223=_0xbff8a0[_0x223321];if(_0x525df7){_0x1541e1=path[_0xaa7f('0x26')](_0x246a18,_0x1bd627,util['format'](_0xaa7f('0x27'),_0x1bd627,_0x223321,_0xaa7f('0x28')));}else{_0x1541e1=path[_0xaa7f('0x26')](_0x246a18,util[_0xaa7f('0x16')](_0xaa7f('0x29'),_0x1bd627,_0xaa7f('0x28')));}fs['writeFileSync'](_0x1541e1,json2xls(_0x3e0223),_0xaa7f('0x2a'));}})[_0xaa7f('0x12')](function(){if(_0x525df7){return new Promise(function(_0x48f099){zipdir(path[_0xaa7f('0x26')](_0x246a18,_0x1bd627),{'saveTo':path[_0xaa7f('0x26')](_0x246a18,util[_0xaa7f('0x16')](_0xaa7f('0x29'),_0x1bd627,_0xaa7f('0x2b')))},function(_0x1c9199,_0x279d9c){rimraf(path[_0xaa7f('0x26')](_0x246a18,_0x1bd627),function(){});_0x48f099(_0xaa7f('0x2c'));});});}})[_0xaa7f('0x12')](function(){logger[_0xaa7f('0xd')](util[_0xaa7f('0x16')](_0xaa7f('0x2d'),EXTRACTED_REPORT_ID,_0xaa7f('0xf')));return analyticExtractedReport(_0xaa7f('0x2e'),_0x525df7?util['format'](_0xaa7f('0x29'),_0x1bd627,_0x525df7?'zip':_0xaa7f('0x28')):null);});})[_0xaa7f('0x2f')](function(_0x496344){logger[_0xaa7f('0xd')](util[_0xaa7f('0x16')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xaa7f('0xf')),util[_0xaa7f('0x30')](_0x496344,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})['finally'](function(){process[_0xaa7f('0x31')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x1477=['splitSizeXlsx','then','sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','split','length','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.xlsx','existsSync','join','mkdirSync','each','%s%d.%s','xlsx','%s.%s','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','XLSX','Completed','catch','inspect','Failed','finally','util','path','lodash','json2xls','bluebird','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','find'];(function(_0x4b1838,_0xa594c7){var _0x372879=function(_0x5a9689){while(--_0x5a9689){_0x4b1838['push'](_0x4b1838['shift']());}};_0x372879(++_0xa594c7);}(_0x1477,0x122));var _0x7147=function(_0x5dc3cc,_0x5ea4bb){_0x5dc3cc=_0x5dc3cc-0x0;var _0x1ad47d=_0x1477[_0x5dc3cc];return _0x1ad47d;};'use strict';var util=require(_0x7147('0x0'));var path=require(_0x7147('0x1'));var _=require(_0x7147('0x2'));var fs=require('fs');var json2xls=require(_0x7147('0x3'));var BPromise=require(_0x7147('0x4'));var zipdir=require('zip-dir');var rimraf=require(_0x7147('0x5'));var db=require(_0x7147('0x6'))['db'];var dbH=require('../../mysqldb')[_0x7147('0x7')];var logger=require(_0x7147('0x8'))(_0x7147('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0x7147('0xa')][0x2]);var QUERY=process[_0x7147('0xa')][0x3];var PATH=process[_0x7147('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x538d62,_0x5207ba){var _0x5a1a99={'status':_0x538d62};var _0x5c0e1a={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5207ba){_0x5a1a99[_0x7147('0xb')]=_0x5207ba;}return db[_0x7147('0xc')]['update'](_0x5a1a99,_0x5c0e1a);}function main(){var _0x263d6a=0x1388;var _0x110dd9;logger[_0x7147('0xd')](util['format'](_0x7147('0xe'),EXTRACTED_REPORT_ID,'XLSX'));return db['Setting'][_0x7147('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x7147('0x10')]})[_0x7147('0x11')](function(_0x50e05e){if(_0x50e05e){_0x110dd9=_0x50e05e;_0x263d6a=_0x110dd9['splitSizeXlsx']||0x1388;}})[_0x7147('0x11')](function(){return dbH[_0x7147('0x12')][_0x7147('0x13')](util[_0x7147('0x14')](_0x7147('0x15'),QUERY),{'type':dbH['sequelize'][_0x7147('0x16')][_0x7147('0x17')]});})[_0x7147('0x11')](function(_0xd3fabf){if(!_0xd3fabf[0x0][_0x7147('0x18')]){return analyticExtractedReport(_0x7147('0x19'));}var _0x32fdc9=[];var _0x4ee0bd=0x0;if(_0x110dd9[_0x7147('0x1a')]){if(_0xd3fabf&&_0xd3fabf[_0x7147('0x1b')]){var _0x1226a9=_['range'](_0xd3fabf[0x0][_0x7147('0x18')]/_0x263d6a);var _0x4ae0d3=Number['isInteger'](_0xd3fabf[0x0][_0x7147('0x18')]/_0x263d6a)?_0xd3fabf[0x0][_0x7147('0x18')]%_0x263d6a:0x0;_0x1226a9[_0x7147('0x1c')](function(_0x1f5044){if(_0x1f5044>0x0){_0x4ee0bd+=_0x263d6a;}_0x32fdc9[_0x7147('0x1d')](dbH[_0x7147('0x12')][_0x7147('0x13')](util['format'](_0x7147('0x1e'),QUERY,_0x263d6a,_0x4ee0bd),{'type':dbH[_0x7147('0x12')]['QueryTypes'][_0x7147('0x17')]}));});if(_0x4ae0d3>0x0){_0x4ee0bd+=_0x263d6a;_0x32fdc9[_0x7147('0x1d')](dbH[_0x7147('0x12')][_0x7147('0x13')](util[_0x7147('0x14')](_0x7147('0x1e'),QUERY,_0x4ae0d3,_0x4ee0bd),{'type':dbH[_0x7147('0x12')]['QueryTypes'][_0x7147('0x17')]}));}}}else{_0x32fdc9[_0x7147('0x1d')](dbH[_0x7147('0x12')][_0x7147('0x13')](QUERY,{'type':dbH[_0x7147('0x12')][_0x7147('0x16')][_0x7147('0x17')]}));}var _0x2b8e0a=path[_0x7147('0x1f')](PATH);var _0x5ecc40=path[_0x7147('0x20')](PATH,_0x7147('0x21'));var _0x36c126=_0x110dd9['split']&&_0x32fdc9[_0x7147('0x1b')]>0x1;var _0x2092ad=[];if(!fs[_0x7147('0x22')](path[_0x7147('0x23')](_0x2b8e0a,_0x5ecc40))&&_0x36c126){fs[_0x7147('0x24')](path[_0x7147('0x23')](_0x2b8e0a,_0x5ecc40));}return BPromise[_0x7147('0x25')](_0x32fdc9,function(_0x4f6ca4){_0x2092ad[_0x7147('0x1d')](_0x4f6ca4);})[_0x7147('0x11')](function(){for(var _0x34cb07=0x0;_0x34cb07<_0x2092ad[_0x7147('0x1b')];_0x34cb07+=0x1){var _0x30c86a;var _0xe5ff17=_0x2092ad[_0x34cb07];if(_0x36c126){_0x30c86a=path[_0x7147('0x23')](_0x2b8e0a,_0x5ecc40,util[_0x7147('0x14')](_0x7147('0x26'),_0x5ecc40,_0x34cb07,_0x7147('0x27')));}else{_0x30c86a=path[_0x7147('0x23')](_0x2b8e0a,util[_0x7147('0x14')](_0x7147('0x28'),_0x5ecc40,_0x7147('0x27')));}fs[_0x7147('0x29')](_0x30c86a,json2xls(_0xe5ff17),'binary');}})['then'](function(){if(_0x36c126){return new Promise(function(_0x4c11bc){zipdir(path['join'](_0x2b8e0a,_0x5ecc40),{'saveTo':path[_0x7147('0x23')](_0x2b8e0a,util[_0x7147('0x14')](_0x7147('0x28'),_0x5ecc40,_0x7147('0x2a')))},function(_0x5eb689,_0x11d37c){rimraf(path[_0x7147('0x23')](_0x2b8e0a,_0x5ecc40),function(){});_0x4c11bc(_0x7147('0x2b'));});});}})[_0x7147('0x11')](function(){logger['info'](util[_0x7147('0x14')](_0x7147('0x2c'),EXTRACTED_REPORT_ID,_0x7147('0x2d')));return analyticExtractedReport(_0x7147('0x2e'),_0x36c126?util['format'](_0x7147('0x28'),_0x5ecc40,_0x36c126?_0x7147('0x2a'):'xlsx'):null);});})[_0x7147('0x2f')](function(_0x498652){logger[_0x7147('0xd')](util[_0x7147('0x14')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x7147('0x2d')),util[_0x7147('0x30')](_0x498652,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x7147('0x31'));})[_0x7147('0x32')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 59c07f3..066c39e 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 _0x5725=['destroy','bulkCreate','sortBy','error','rewrite','lodash','util','models','findAll','then','VoiceExtension','IntervalId','uniq','filter','groupBy','hasOwnProperty','extensions','find','push','Set','format','CDR(type)=%s','type','context','VoiceExtensionId','inbound','CDR(routeid)=','exten','priority','extension','CDR(destination)=','cutdigits','${EXTEN}','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','length','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','map','intervals','tag','CDR(tag)=','outbound','callerID','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','appType','custom','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','transaction'];(function(_0x159492,_0x1bcb9b){var _0x4c63b6=function(_0x3e8f8d){while(--_0x3e8f8d){_0x159492['push'](_0x159492['shift']());}};_0x4c63b6(++_0x1bcb9b);}(_0x5725,0x95));var _0x5572=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x5725[_0x2be8c2];return _0x97f531;};'use strict';var _=require(_0x5572('0x0'));var util=require(_0x5572('0x1'));function rewrite(_0x3407d6,_0x247189){var _0x1c8e33=this;return _0x3407d6[_0x5572('0x2')]['Interval'][_0x5572('0x3')]({'raw':!![]})[_0x5572('0x4')](function(_0x2b396f){_0x1c8e33['intervals']=_0x2b396f;return _0x3407d6['models'][_0x5572('0x5')][_0x5572('0x3')]({'where':{'IntervalId':_0x247189[_0x5572('0x6')]},'raw':!![]});})[_0x5572('0x4')](function(_0xfd4a73){return _0x3407d6['models'][_0x5572('0x5')][_0x5572('0x3')]({'where':{'exten':{'$in':_[_0x5572('0x7')](_['map'](_0xfd4a73,'exten'))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0x5572('0x4')](function(_0x1aeb23){var _0x4d8a21=_[_0x5572('0x8')](_0x1aeb23,{'priority':'1'});var _0x28bb10=_[_0x5572('0x8')](_0x1aeb23,{'isApp':0x1});var _0x15d4b7=_[_0x5572('0x9')](_0x28bb10,'exten');var _0x489af7=['queue','playback'];var _0x5a1fba=[];var _0x3fc69a=[];for(var _0x4dea96 in _0x15d4b7){if(_0x15d4b7[_0x5572('0xa')](_0x4dea96)){_0x1c8e33['priority']=0x2;_0x1c8e33[_0x5572('0xb')]=[];_0x1c8e33['extension']=_[_0x5572('0xc')](_0x4d8a21,{'exten':_0x15d4b7[_0x4dea96][0x0]['exten']});_0x1c8e33[_0x5572('0xb')][_0x5572('0xd')]({'type':_0x15d4b7[_0x4dea96][0x0]['type'],'app':_0x5572('0xe'),'appdata':util[_0x5572('0xf')](_0x5572('0x10'),_0x15d4b7[_0x4dea96][0x0][_0x5572('0x11')]),'context':_0x15d4b7[_0x4dea96][0x0][_0x5572('0x12')],'exten':_0x15d4b7[_0x4dea96][0x0]['exten'],'priority':_0x1c8e33['priority']++,'VoiceExtensionId':_0x15d4b7[_0x4dea96][0x0][_0x5572('0x13')]});if(_0x15d4b7[_0x4dea96][0x0][_0x5572('0x11')]===_0x5572('0x14')){_0x1c8e33[_0x5572('0xb')][_0x5572('0xd')]({'type':_0x15d4b7[_0x4dea96][0x0][_0x5572('0x11')],'app':_0x5572('0xe'),'appdata':_0x5572('0x15')+_0x15d4b7[_0x4dea96][0x0][_0x5572('0x13')],'context':_0x15d4b7[_0x4dea96][0x0]['context'],'exten':_0x15d4b7[_0x4dea96][0x0][_0x5572('0x16')],'priority':_0x1c8e33[_0x5572('0x17')]++,'VoiceExtensionId':_0x15d4b7[_0x4dea96][0x0][_0x5572('0x13')]});}else if(_0x15d4b7[_0x4dea96][0x0]['type']==='outbound'){if(_0x1c8e33[_0x5572('0x18')]){_0x1c8e33['extensions'][_0x5572('0xd')]({'type':_0x15d4b7[_0x4dea96][0x0]['type'],'app':_0x5572('0xe'),'appdata':_0x5572('0x19')+(_0x1c8e33[_0x5572('0x18')]['cutdigits']?'${EXTEN:'+_0x1c8e33[_0x5572('0x18')][_0x5572('0x1a')]+'}':_0x5572('0x1b')),'context':_0x15d4b7[_0x4dea96][0x0][_0x5572('0x12')],'exten':_0x15d4b7[_0x4dea96][0x0][_0x5572('0x16')],'priority':_0x1c8e33[_0x5572('0x17')]++,'VoiceExtensionId':_0x15d4b7[_0x4dea96][0x0]['VoiceExtensionId']});}_0x1c8e33[_0x5572('0xb')][_0x5572('0xd')]({'type':_0x15d4b7[_0x4dea96][0x0][_0x5572('0x11')],'app':'Set','appdata':_0x5572('0x15')+_0x15d4b7[_0x4dea96][0x0][_0x5572('0x13')],'context':_0x15d4b7[_0x4dea96][0x0]['context'],'exten':_0x15d4b7[_0x4dea96][0x0]['exten'],'priority':_0x1c8e33[_0x5572('0x17')]++,'VoiceExtensionId':_0x15d4b7[_0x4dea96][0x0][_0x5572('0x13')]});var _0x17f5b0=_0x1c8e33[_0x5572('0x17')]++;_0x1c8e33[_0x5572('0xb')][_0x5572('0xd')]({'type':_0x15d4b7[_0x4dea96][0x0][_0x5572('0x11')],'app':'ExecIf','appdata':_0x5572('0x1c')+(_0x17f5b0+0x2)+_0x5572('0x1d')+(_0x17f5b0+0x1)+')','context':_0x15d4b7[_0x4dea96][0x0][_0x5572('0x12')],'exten':_0x15d4b7[_0x4dea96][0x0][_0x5572('0x16')],'priority':_0x17f5b0,'VoiceExtensionId':_0x15d4b7[_0x4dea96][0x0][_0x5572('0x13')]});if(_0x1c8e33[_0x5572('0x18')]){_0x1c8e33['extensions'][_0x5572('0xd')]({'type':_0x15d4b7[_0x4dea96][0x0]['type'],'app':_0x5572('0xe'),'appdata':_0x1c8e33[_0x5572('0x18')]['cutdigits']?_0x5572('0x1e')+_0x1c8e33[_0x5572('0x18')][_0x5572('0x1a')]+'}':_0x5572('0x1f'),'context':_0x15d4b7[_0x4dea96][0x0][_0x5572('0x12')],'exten':_0x15d4b7[_0x4dea96][0x0][_0x5572('0x16')],'priority':_0x1c8e33[_0x5572('0x17')]++,'VoiceExtensionId':_0x15d4b7[_0x4dea96][0x0][_0x5572('0x13')]});}_0x1c8e33[_0x5572('0xb')][_0x5572('0xd')]({'type':_0x15d4b7[_0x4dea96][0x0][_0x5572('0x11')],'app':_0x5572('0xe'),'appdata':_0x5572('0x20')+_0x15d4b7[_0x4dea96][0x0][_0x5572('0x13')],'context':_0x15d4b7[_0x4dea96][0x0][_0x5572('0x12')],'exten':_0x15d4b7[_0x4dea96][0x0][_0x5572('0x16')],'priority':_0x1c8e33[_0x5572('0x17')]++,'VoiceExtensionId':_0x15d4b7[_0x4dea96][0x0]['VoiceExtensionId']});if(_0x1c8e33[_0x5572('0x18')]&&_0x1c8e33[_0x5572('0x18')][_0x5572('0xa')](_0x5572('0x21'))&&_0x1c8e33[_0x5572('0x18')][_0x5572('0x21')]!==_0x5572('0x22')){_0x1c8e33[_0x5572('0xb')][_0x5572('0xd')]({'type':_0x15d4b7[_0x4dea96][0x0][_0x5572('0x11')],'app':'Set','appdata':_0x5572('0x23'),'context':_0x15d4b7[_0x4dea96][0x0][_0x5572('0x12')],'exten':_0x15d4b7[_0x4dea96][0x0][_0x5572('0x16')],'priority':_0x1c8e33['priority']++,'VoiceExtensionId':_0x15d4b7[_0x4dea96][0x0][_0x5572('0x13')]});_0x1c8e33[_0x5572('0xb')][_0x5572('0xd')]({'type':_0x15d4b7[_0x4dea96][0x0][_0x5572('0x11')],'app':'Set','appdata':_0x5572('0x24')+_0x1c8e33[_0x5572('0x18')][_0x5572('0x21')]||_0x5572('0x25'),'context':_0x15d4b7[_0x4dea96][0x0][_0x5572('0x12')],'exten':_0x15d4b7[_0x4dea96][0x0][_0x5572('0x16')],'priority':_0x1c8e33[_0x5572('0x17')]++,'VoiceExtensionId':_0x15d4b7[_0x4dea96][0x0][_0x5572('0x13')]});}}_0x1c8e33['extensions'][_0x5572('0xd')]({'type':_0x15d4b7[_0x4dea96][0x0][_0x5572('0x11')],'app':'Set','appdata':_0x5572('0x26'),'context':_0x15d4b7[_0x4dea96][0x0][_0x5572('0x12')],'exten':_0x15d4b7[_0x4dea96][0x0][_0x5572('0x16')],'priority':_0x1c8e33[_0x5572('0x17')]++,'VoiceExtensionId':_0x15d4b7[_0x4dea96][0x0]['VoiceExtensionId']});_0x1c8e33[_0x5572('0xb')][_0x5572('0xd')]({'type':_0x15d4b7[_0x4dea96][0x0][_0x5572('0x11')],'app':_0x5572('0xe'),'appdata':_0x5572('0x27'),'context':_0x15d4b7[_0x4dea96][0x0][_0x5572('0x12')],'exten':_0x15d4b7[_0x4dea96][0x0]['exten'],'priority':_0x1c8e33[_0x5572('0x17')]++,'VoiceExtensionId':_0x15d4b7[_0x4dea96][0x0]['VoiceExtensionId']});_0x1c8e33[_0x5572('0xb')][_0x5572('0xd')]({'type':_0x15d4b7[_0x4dea96][0x0]['type'],'app':_0x5572('0xe'),'appdata':'MONITOR_OPTIONS=ab','context':_0x15d4b7[_0x4dea96][0x0]['context'],'exten':_0x15d4b7[_0x4dea96][0x0][_0x5572('0x16')],'priority':_0x1c8e33[_0x5572('0x17')]++,'VoiceExtensionId':_0x15d4b7[_0x4dea96][0x0][_0x5572('0x13')]});for(var _0x64dfd9=0x0,_0x591a4e=0x0;_0x64dfd9<_0x15d4b7[_0x4dea96][_0x5572('0x28')];_0x64dfd9+=0x1,_0x591a4e=0x0){var _0x2fb7d1=_0x15d4b7[_0x4dea96][_0x64dfd9];if(_0x2fb7d1[_0x5572('0x11')]){_0x2fb7d1[_0x5572('0x11')]=_0x2fb7d1[_0x5572('0x11')][_0x5572('0x29')]();}var _0x12e8e3=[];var _0x33d2d0=[];delete _0x2fb7d1['id'];delete _0x2fb7d1[_0x5572('0x2a')];delete _0x2fb7d1[_0x5572('0x2b')];var _0x4c30f6=_0x2fb7d1[_0x5572('0x2c')]!==_0x5572('0x2d')?[_0x2fb7d1[_0x5572('0x2c')]]:_0x2fb7d1[_0x5572('0x6')]?_[_0x5572('0x2e')](_['filter'](_0x1c8e33[_0x5572('0x2f')],{'IntervalId':_0x2fb7d1[_0x5572('0x6')]}),'interval'):[];if(_0x2fb7d1[_0x5572('0xa')](_0x5572('0x30'))){if(_0x2fb7d1[_0x5572('0x30')]&&_0x2fb7d1[_0x5572('0x30')]!=='--'){_0x12e8e3[_0x5572('0xd')]({'type':_0x2fb7d1[_0x5572('0x11')],'app':_0x5572('0xe'),'appdata':_0x5572('0x31')+_0x2fb7d1['tag'],'context':_0x2fb7d1[_0x5572('0x12')],'exten':_0x2fb7d1[_0x5572('0x16')],'priority':_0x4c30f6[_0x5572('0x28')]+_0x1c8e33['priority']+_0x591a4e++,'VoiceExtensionId':_0x2fb7d1[_0x5572('0x13')]});}}if(_0x2fb7d1[_0x5572('0x11')]===_0x5572('0x32')&&_0x2fb7d1[_0x5572('0xa')](_0x5572('0x33'))){if(_0x2fb7d1[_0x5572('0x33')]){_0x12e8e3[_0x5572('0xd')]({'type':_0x2fb7d1[_0x5572('0x11')],'app':_0x5572('0x34'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x2fb7d1['callerID']+')','context':_0x2fb7d1[_0x5572('0x12')],'exten':_0x2fb7d1[_0x5572('0x16')],'priority':_0x4c30f6[_0x5572('0x28')]+_0x1c8e33[_0x5572('0x17')]+_0x591a4e++,'VoiceExtensionId':_0x2fb7d1['VoiceExtensionId']});}else{_0x12e8e3['push']({'type':_0x2fb7d1['type'],'app':'ExecIf','appdata':_0x5572('0x35'),'context':_0x2fb7d1['context'],'exten':_0x2fb7d1[_0x5572('0x16')],'priority':_0x4c30f6[_0x5572('0x28')]+_0x1c8e33[_0x5572('0x17')]+_0x591a4e++,'VoiceExtensionId':_0x2fb7d1[_0x5572('0x13')]});}}if(_0x2fb7d1[_0x5572('0xa')](_0x5572('0x36'))){if(_0x489af7[_0x5572('0x37')](_0x2fb7d1[_0x5572('0x38')][_0x5572('0x29')]())>=0x0&&_0x2fb7d1[_0x5572('0x39')]!==_0x5572('0x3a')){if(_0x2fb7d1[_0x5572('0x36')]){_0x12e8e3[_0x5572('0xd')]({'type':_0x2fb7d1[_0x5572('0x11')],'app':_0x5572('0x34'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x2fb7d1[_0x5572('0x12')],'exten':_0x2fb7d1['exten'],'priority':_0x4c30f6[_0x5572('0x28')]+_0x1c8e33[_0x5572('0x17')]+_0x591a4e++,'VoiceExtensionId':_0x2fb7d1['VoiceExtensionId']});_0x12e8e3[_0x5572('0xd')]({'type':_0x2fb7d1[_0x5572('0x11')],'app':_0x5572('0xe'),'appdata':_0x5572('0x3b'),'context':_0x2fb7d1[_0x5572('0x12')],'exten':_0x2fb7d1[_0x5572('0x16')],'priority':_0x4c30f6['length']+_0x1c8e33[_0x5572('0x17')]+_0x591a4e++,'VoiceExtensionId':_0x2fb7d1[_0x5572('0x13')]});}else{_0x12e8e3[_0x5572('0xd')]({'type':_0x2fb7d1[_0x5572('0x11')],'app':_0x5572('0x34'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x2fb7d1[_0x5572('0x12')],'exten':_0x2fb7d1['exten'],'priority':_0x4c30f6[_0x5572('0x28')]+_0x1c8e33[_0x5572('0x17')]+_0x591a4e++,'VoiceExtensionId':_0x2fb7d1[_0x5572('0x13')]});_0x12e8e3[_0x5572('0xd')]({'type':_0x2fb7d1['type'],'app':_0x5572('0xe'),'appdata':_0x5572('0x3c'),'context':_0x2fb7d1['context'],'exten':_0x2fb7d1[_0x5572('0x16')],'priority':_0x4c30f6[_0x5572('0x28')]+_0x1c8e33[_0x5572('0x17')]+_0x591a4e++,'VoiceExtensionId':_0x2fb7d1[_0x5572('0x13')]});}}}for(var _0x20ef7f=0x0;_0x20ef7f<_0x4c30f6[_0x5572('0x28')];_0x20ef7f+=0x1){var _0x133c74=_0x1c8e33[_0x5572('0x17')]+_0x4c30f6[_0x5572('0x28')];var _0xc9ad53=_0x20ef7f===_0x4c30f6[_0x5572('0x28')]-0x1?_0x1c8e33['priority']+_0x12e8e3[_0x5572('0x28')]+_0x33d2d0['length']+0x2:_0x1c8e33[_0x5572('0x17')]+_0x20ef7f+0x1;_0x12e8e3[_0x5572('0x3d')](_0x20ef7f,0x0,{'type':_0x2fb7d1[_0x5572('0x11')],'app':_0x5572('0x3e'),'appdata':_0x4c30f6[_0x20ef7f]+'?'+_0x2fb7d1['context']+_0x5572('0x3f')+_0x133c74+':'+_0x2fb7d1[_0x5572('0x12')]+_0x5572('0x3f')+_0xc9ad53,'exten':_0x2fb7d1[_0x5572('0x16')],'context':_0x2fb7d1[_0x5572('0x12')],'priority':_0x1c8e33[_0x5572('0x17')]+_0x20ef7f,'VoiceExtensionId':_0x15d4b7[_0x4dea96][0x0][_0x5572('0x13')]});}_0x2fb7d1[_0x5572('0x17')]=_0x12e8e3[_0x5572('0x28')]?_[_0x5572('0x40')](_0x12e8e3)['priority']+0x1:_0x1c8e33[_0x5572('0x17')];_0x1c8e33[_0x5572('0x17')]=(_0x33d2d0['length']?_['last'](_0x33d2d0)[_0x5572('0x17')]:_0x2fb7d1[_0x5572('0x17')])+0x1;_0x1c8e33[_0x5572('0xb')]=_[_0x5572('0x41')](_0x1c8e33[_0x5572('0xb')],_0x12e8e3,[_0x2fb7d1],_0x33d2d0);}_0x1c8e33[_0x5572('0xb')][_0x5572('0xd')]({'type':_0x15d4b7[_0x4dea96][0x0][_0x5572('0x11')],'app':'Hangup','exten':_0x15d4b7[_0x4dea96][0x0]['exten'],'context':_0x15d4b7[_0x4dea96][0x0][_0x5572('0x12')],'priority':_0x1c8e33[_0x5572('0x17')],'VoiceExtensionId':_0x15d4b7[_0x4dea96][0x0]['VoiceExtensionId']});_0x5a1fba[_0x5572('0xd')](_0x15d4b7[_0x4dea96][0x0][_0x5572('0x13')]);_0x3fc69a=_[_0x5572('0x41')](_0x3fc69a,_0x1c8e33['extensions']);}}return _0x3407d6[_0x5572('0x42')](function(_0x208b7f){return _0x3407d6[_0x5572('0x2')]['VoiceExtension'][_0x5572('0x43')]({'where':{'VoiceExtensionId':{'$in':_0x5a1fba}},'transaction':_0x208b7f})['then'](function(_0x2ba381){return _0x3407d6[_0x5572('0x2')][_0x5572('0x5')][_0x5572('0x44')](_[_0x5572('0x45')](_0x3fc69a,'priority'),{'transaction':_0x208b7f});});});})['catch'](function(_0x2525d2){console[_0x5572('0x46')](_0x2525d2);});}exports[_0x5572('0x47')]=rewrite; \ No newline at end of file +var _0xc2c3=['_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','toLowerCase','createdAt','updatedAt','interval','tag','CDR(tag)=','outbound','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','length','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','indexOf','app','custom','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','sortBy','catch','error','rewrite','lodash','util','models','Interval','then','intervals','VoiceExtension','findAll','IntervalId','uniq','map','exten','filter','groupBy','queue','hasOwnProperty','priority','extensions','extension','find','push','type','Set','format','CDR(type)=%s','context','inbound','CDR(routeid)=','VoiceExtensionId','cutdigits','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}'];(function(_0x281bbf,_0x5a9912){var _0x4e1446=function(_0x26f687){while(--_0x26f687){_0x281bbf['push'](_0x281bbf['shift']());}};_0x4e1446(++_0x5a9912);}(_0xc2c3,0x17f));var _0x3c2c=function(_0x339844,_0x2ed765){_0x339844=_0x339844-0x0;var _0x3200f3=_0xc2c3[_0x339844];return _0x3200f3;};'use strict';var _=require(_0x3c2c('0x0'));var util=require(_0x3c2c('0x1'));function rewrite(_0xfbc5ec,_0x1ff7c4){var _0x165174=this;return _0xfbc5ec[_0x3c2c('0x2')][_0x3c2c('0x3')]['findAll']({'raw':!![]})[_0x3c2c('0x4')](function(_0x24ae95){_0x165174[_0x3c2c('0x5')]=_0x24ae95;return _0xfbc5ec[_0x3c2c('0x2')][_0x3c2c('0x6')][_0x3c2c('0x7')]({'where':{'IntervalId':_0x1ff7c4[_0x3c2c('0x8')]},'raw':!![]});})['then'](function(_0x4632f8){return _0xfbc5ec[_0x3c2c('0x2')][_0x3c2c('0x6')]['findAll']({'where':{'exten':{'$in':_[_0x3c2c('0x9')](_[_0x3c2c('0xa')](_0x4632f8,_0x3c2c('0xb')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0x3c2c('0x4')](function(_0x5431b4){var _0x2dbcda=_[_0x3c2c('0xc')](_0x5431b4,{'priority':'1'});var _0xf5bc64=_[_0x3c2c('0xc')](_0x5431b4,{'isApp':0x1});var _0x27fbea=_[_0x3c2c('0xd')](_0xf5bc64,_0x3c2c('0xb'));var _0xc0ac0c=[_0x3c2c('0xe'),'playback'];var _0x1db795=[];var _0x511ef2=[];for(var _0x2ff898 in _0x27fbea){if(_0x27fbea[_0x3c2c('0xf')](_0x2ff898)){_0x165174[_0x3c2c('0x10')]=0x2;_0x165174[_0x3c2c('0x11')]=[];_0x165174[_0x3c2c('0x12')]=_[_0x3c2c('0x13')](_0x2dbcda,{'exten':_0x27fbea[_0x2ff898][0x0][_0x3c2c('0xb')]});_0x165174[_0x3c2c('0x11')][_0x3c2c('0x14')]({'type':_0x27fbea[_0x2ff898][0x0][_0x3c2c('0x15')],'app':_0x3c2c('0x16'),'appdata':util[_0x3c2c('0x17')](_0x3c2c('0x18'),_0x27fbea[_0x2ff898][0x0]['type']),'context':_0x27fbea[_0x2ff898][0x0][_0x3c2c('0x19')],'exten':_0x27fbea[_0x2ff898][0x0][_0x3c2c('0xb')],'priority':_0x165174[_0x3c2c('0x10')]++,'VoiceExtensionId':_0x27fbea[_0x2ff898][0x0]['VoiceExtensionId']});if(_0x27fbea[_0x2ff898][0x0][_0x3c2c('0x15')]===_0x3c2c('0x1a')){_0x165174[_0x3c2c('0x11')]['push']({'type':_0x27fbea[_0x2ff898][0x0][_0x3c2c('0x15')],'app':_0x3c2c('0x16'),'appdata':_0x3c2c('0x1b')+_0x27fbea[_0x2ff898][0x0][_0x3c2c('0x1c')],'context':_0x27fbea[_0x2ff898][0x0][_0x3c2c('0x19')],'exten':_0x27fbea[_0x2ff898][0x0]['exten'],'priority':_0x165174[_0x3c2c('0x10')]++,'VoiceExtensionId':_0x27fbea[_0x2ff898][0x0][_0x3c2c('0x1c')]});}else if(_0x27fbea[_0x2ff898][0x0][_0x3c2c('0x15')]==='outbound'){if(_0x165174[_0x3c2c('0x12')]){_0x165174[_0x3c2c('0x11')][_0x3c2c('0x14')]({'type':_0x27fbea[_0x2ff898][0x0][_0x3c2c('0x15')],'app':_0x3c2c('0x16'),'appdata':'CDR(destination)='+(_0x165174[_0x3c2c('0x12')]['cutdigits']?'${EXTEN:'+_0x165174[_0x3c2c('0x12')][_0x3c2c('0x1d')]+'}':_0x3c2c('0x1e')),'context':_0x27fbea[_0x2ff898][0x0][_0x3c2c('0x19')],'exten':_0x27fbea[_0x2ff898][0x0][_0x3c2c('0xb')],'priority':_0x165174[_0x3c2c('0x10')]++,'VoiceExtensionId':_0x27fbea[_0x2ff898][0x0][_0x3c2c('0x1c')]});}_0x165174['extensions'][_0x3c2c('0x14')]({'type':_0x27fbea[_0x2ff898][0x0][_0x3c2c('0x15')],'app':_0x3c2c('0x16'),'appdata':_0x3c2c('0x1b')+_0x27fbea[_0x2ff898][0x0][_0x3c2c('0x1c')],'context':_0x27fbea[_0x2ff898][0x0][_0x3c2c('0x19')],'exten':_0x27fbea[_0x2ff898][0x0][_0x3c2c('0xb')],'priority':_0x165174[_0x3c2c('0x10')]++,'VoiceExtensionId':_0x27fbea[_0x2ff898][0x0][_0x3c2c('0x1c')]});var _0x5b83f3=_0x165174[_0x3c2c('0x10')]++;_0x165174[_0x3c2c('0x11')][_0x3c2c('0x14')]({'type':_0x27fbea[_0x2ff898][0x0]['type'],'app':_0x3c2c('0x1f'),'appdata':_0x3c2c('0x20')+(_0x5b83f3+0x2)+_0x3c2c('0x21')+(_0x5b83f3+0x1)+')','context':_0x27fbea[_0x2ff898][0x0][_0x3c2c('0x19')],'exten':_0x27fbea[_0x2ff898][0x0][_0x3c2c('0xb')],'priority':_0x5b83f3,'VoiceExtensionId':_0x27fbea[_0x2ff898][0x0]['VoiceExtensionId']});if(_0x165174[_0x3c2c('0x12')]){_0x165174[_0x3c2c('0x11')][_0x3c2c('0x14')]({'type':_0x27fbea[_0x2ff898][0x0]['type'],'app':_0x3c2c('0x16'),'appdata':_0x165174['extension']['cutdigits']?_0x3c2c('0x22')+_0x165174['extension'][_0x3c2c('0x1d')]+'}':'CDR(prefix)=noprefix','context':_0x27fbea[_0x2ff898][0x0]['context'],'exten':_0x27fbea[_0x2ff898][0x0]['exten'],'priority':_0x165174['priority']++,'VoiceExtensionId':_0x27fbea[_0x2ff898][0x0][_0x3c2c('0x1c')]});}_0x165174['extensions'][_0x3c2c('0x14')]({'type':_0x27fbea[_0x2ff898][0x0][_0x3c2c('0x15')],'app':_0x3c2c('0x16'),'appdata':'outboundrouteid='+_0x27fbea[_0x2ff898][0x0]['VoiceExtensionId'],'context':_0x27fbea[_0x2ff898][0x0][_0x3c2c('0x19')],'exten':_0x27fbea[_0x2ff898][0x0][_0x3c2c('0xb')],'priority':_0x165174[_0x3c2c('0x10')]++,'VoiceExtensionId':_0x27fbea[_0x2ff898][0x0][_0x3c2c('0x1c')]});if(_0x165174[_0x3c2c('0x12')]&&_0x165174['extension'][_0x3c2c('0xf')]('recordingFormat')&&_0x165174['extension']['recordingFormat']!==_0x3c2c('0x23')){_0x165174[_0x3c2c('0x11')]['push']({'type':_0x27fbea[_0x2ff898][0x0][_0x3c2c('0x15')],'app':'Set','appdata':_0x3c2c('0x24'),'context':_0x27fbea[_0x2ff898][0x0][_0x3c2c('0x19')],'exten':_0x27fbea[_0x2ff898][0x0]['exten'],'priority':_0x165174[_0x3c2c('0x10')]++,'VoiceExtensionId':_0x27fbea[_0x2ff898][0x0][_0x3c2c('0x1c')]});_0x165174[_0x3c2c('0x11')]['push']({'type':_0x27fbea[_0x2ff898][0x0][_0x3c2c('0x15')],'app':_0x3c2c('0x16'),'appdata':_0x3c2c('0x25')+_0x165174[_0x3c2c('0x12')]['recordingFormat']||_0x3c2c('0x26'),'context':_0x27fbea[_0x2ff898][0x0]['context'],'exten':_0x27fbea[_0x2ff898][0x0]['exten'],'priority':_0x165174['priority']++,'VoiceExtensionId':_0x27fbea[_0x2ff898][0x0][_0x3c2c('0x1c')]});}}_0x165174[_0x3c2c('0x11')][_0x3c2c('0x14')]({'type':_0x27fbea[_0x2ff898][0x0]['type'],'app':_0x3c2c('0x16'),'appdata':_0x3c2c('0x27'),'context':_0x27fbea[_0x2ff898][0x0][_0x3c2c('0x19')],'exten':_0x27fbea[_0x2ff898][0x0][_0x3c2c('0xb')],'priority':_0x165174['priority']++,'VoiceExtensionId':_0x27fbea[_0x2ff898][0x0][_0x3c2c('0x1c')]});_0x165174['extensions'][_0x3c2c('0x14')]({'type':_0x27fbea[_0x2ff898][0x0][_0x3c2c('0x15')],'app':_0x3c2c('0x16'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x27fbea[_0x2ff898][0x0]['context'],'exten':_0x27fbea[_0x2ff898][0x0][_0x3c2c('0xb')],'priority':_0x165174['priority']++,'VoiceExtensionId':_0x27fbea[_0x2ff898][0x0]['VoiceExtensionId']});_0x165174['extensions'][_0x3c2c('0x14')]({'type':_0x27fbea[_0x2ff898][0x0][_0x3c2c('0x15')],'app':_0x3c2c('0x16'),'appdata':'MONITOR_OPTIONS=ab','context':_0x27fbea[_0x2ff898][0x0][_0x3c2c('0x19')],'exten':_0x27fbea[_0x2ff898][0x0][_0x3c2c('0xb')],'priority':_0x165174[_0x3c2c('0x10')]++,'VoiceExtensionId':_0x27fbea[_0x2ff898][0x0][_0x3c2c('0x1c')]});for(var _0x461d12=0x0,_0x2d40f1=0x0;_0x461d12<_0x27fbea[_0x2ff898]['length'];_0x461d12+=0x1,_0x2d40f1=0x0){var _0x1a8d02=_0x27fbea[_0x2ff898][_0x461d12];if(_0x1a8d02['type']){_0x1a8d02['type']=_0x1a8d02['type'][_0x3c2c('0x28')]();}var _0x25ecf0=[];var _0x2ac757=[];delete _0x1a8d02['id'];delete _0x1a8d02[_0x3c2c('0x29')];delete _0x1a8d02[_0x3c2c('0x2a')];var _0x16d28a=_0x1a8d02['interval']!=='*,*,*,*'?[_0x1a8d02[_0x3c2c('0x2b')]]:_0x1a8d02['IntervalId']?_['map'](_[_0x3c2c('0xc')](_0x165174['intervals'],{'IntervalId':_0x1a8d02['IntervalId']}),_0x3c2c('0x2b')):[];if(_0x1a8d02[_0x3c2c('0xf')](_0x3c2c('0x2c'))){if(_0x1a8d02['tag']&&_0x1a8d02[_0x3c2c('0x2c')]!=='--'){_0x25ecf0['push']({'type':_0x1a8d02[_0x3c2c('0x15')],'app':'Set','appdata':_0x3c2c('0x2d')+_0x1a8d02[_0x3c2c('0x2c')],'context':_0x1a8d02[_0x3c2c('0x19')],'exten':_0x1a8d02[_0x3c2c('0xb')],'priority':_0x16d28a['length']+_0x165174['priority']+_0x2d40f1++,'VoiceExtensionId':_0x1a8d02['VoiceExtensionId']});}}if(_0x1a8d02[_0x3c2c('0x15')]===_0x3c2c('0x2e')&&_0x1a8d02['hasOwnProperty'](_0x3c2c('0x2f'))){if(_0x1a8d02[_0x3c2c('0x2f')]){_0x25ecf0[_0x3c2c('0x14')]({'type':_0x1a8d02[_0x3c2c('0x15')],'app':'ExecIf','appdata':_0x3c2c('0x30')+_0x1a8d02[_0x3c2c('0x2f')]+')','context':_0x1a8d02[_0x3c2c('0x19')],'exten':_0x1a8d02[_0x3c2c('0xb')],'priority':_0x16d28a[_0x3c2c('0x31')]+_0x165174[_0x3c2c('0x10')]+_0x2d40f1++,'VoiceExtensionId':_0x1a8d02['VoiceExtensionId']});}else{_0x25ecf0[_0x3c2c('0x14')]({'type':_0x1a8d02[_0x3c2c('0x15')],'app':_0x3c2c('0x1f'),'appdata':_0x3c2c('0x32'),'context':_0x1a8d02[_0x3c2c('0x19')],'exten':_0x1a8d02[_0x3c2c('0xb')],'priority':_0x16d28a[_0x3c2c('0x31')]+_0x165174['priority']+_0x2d40f1++,'VoiceExtensionId':_0x1a8d02['VoiceExtensionId']});}}if(_0x1a8d02[_0x3c2c('0xf')]('answer')){if(_0xc0ac0c[_0x3c2c('0x33')](_0x1a8d02[_0x3c2c('0x34')]['toLowerCase']())>=0x0&&_0x1a8d02['appType']!==_0x3c2c('0x35')){if(_0x1a8d02[_0x3c2c('0x36')]){_0x25ecf0['push']({'type':_0x1a8d02[_0x3c2c('0x15')],'app':_0x3c2c('0x1f'),'appdata':_0x3c2c('0x37'),'context':_0x1a8d02[_0x3c2c('0x19')],'exten':_0x1a8d02[_0x3c2c('0xb')],'priority':_0x16d28a[_0x3c2c('0x31')]+_0x165174[_0x3c2c('0x10')]+_0x2d40f1++,'VoiceExtensionId':_0x1a8d02[_0x3c2c('0x1c')]});_0x25ecf0[_0x3c2c('0x14')]({'type':_0x1a8d02[_0x3c2c('0x15')],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=1','context':_0x1a8d02[_0x3c2c('0x19')],'exten':_0x1a8d02[_0x3c2c('0xb')],'priority':_0x16d28a[_0x3c2c('0x31')]+_0x165174[_0x3c2c('0x10')]+_0x2d40f1++,'VoiceExtensionId':_0x1a8d02[_0x3c2c('0x1c')]});}else{_0x25ecf0[_0x3c2c('0x14')]({'type':_0x1a8d02['type'],'app':_0x3c2c('0x1f'),'appdata':_0x3c2c('0x38'),'context':_0x1a8d02['context'],'exten':_0x1a8d02[_0x3c2c('0xb')],'priority':_0x16d28a[_0x3c2c('0x31')]+_0x165174[_0x3c2c('0x10')]+_0x2d40f1++,'VoiceExtensionId':_0x1a8d02[_0x3c2c('0x1c')]});_0x25ecf0[_0x3c2c('0x14')]({'type':_0x1a8d02[_0x3c2c('0x15')],'app':_0x3c2c('0x16'),'appdata':_0x3c2c('0x39'),'context':_0x1a8d02[_0x3c2c('0x19')],'exten':_0x1a8d02[_0x3c2c('0xb')],'priority':_0x16d28a[_0x3c2c('0x31')]+_0x165174[_0x3c2c('0x10')]+_0x2d40f1++,'VoiceExtensionId':_0x1a8d02['VoiceExtensionId']});}}}for(var _0xfc3362=0x0;_0xfc3362<_0x16d28a[_0x3c2c('0x31')];_0xfc3362+=0x1){var _0x3435d6=_0x165174[_0x3c2c('0x10')]+_0x16d28a['length'];var _0x214538=_0xfc3362===_0x16d28a[_0x3c2c('0x31')]-0x1?_0x165174[_0x3c2c('0x10')]+_0x25ecf0[_0x3c2c('0x31')]+_0x2ac757[_0x3c2c('0x31')]+0x2:_0x165174[_0x3c2c('0x10')]+_0xfc3362+0x1;_0x25ecf0[_0x3c2c('0x3a')](_0xfc3362,0x0,{'type':_0x1a8d02[_0x3c2c('0x15')],'app':_0x3c2c('0x3b'),'appdata':_0x16d28a[_0xfc3362]+'?'+_0x1a8d02[_0x3c2c('0x19')]+_0x3c2c('0x3c')+_0x3435d6+':'+_0x1a8d02[_0x3c2c('0x19')]+_0x3c2c('0x3c')+_0x214538,'exten':_0x1a8d02['exten'],'context':_0x1a8d02['context'],'priority':_0x165174[_0x3c2c('0x10')]+_0xfc3362,'VoiceExtensionId':_0x27fbea[_0x2ff898][0x0][_0x3c2c('0x1c')]});}_0x1a8d02[_0x3c2c('0x10')]=_0x25ecf0[_0x3c2c('0x31')]?_[_0x3c2c('0x3d')](_0x25ecf0)[_0x3c2c('0x10')]+0x1:_0x165174[_0x3c2c('0x10')];_0x165174[_0x3c2c('0x10')]=(_0x2ac757[_0x3c2c('0x31')]?_[_0x3c2c('0x3d')](_0x2ac757)[_0x3c2c('0x10')]:_0x1a8d02['priority'])+0x1;_0x165174[_0x3c2c('0x11')]=_[_0x3c2c('0x3e')](_0x165174[_0x3c2c('0x11')],_0x25ecf0,[_0x1a8d02],_0x2ac757);}_0x165174[_0x3c2c('0x11')][_0x3c2c('0x14')]({'type':_0x27fbea[_0x2ff898][0x0][_0x3c2c('0x15')],'app':_0x3c2c('0x3f'),'exten':_0x27fbea[_0x2ff898][0x0]['exten'],'context':_0x27fbea[_0x2ff898][0x0][_0x3c2c('0x19')],'priority':_0x165174[_0x3c2c('0x10')],'VoiceExtensionId':_0x27fbea[_0x2ff898][0x0][_0x3c2c('0x1c')]});_0x1db795[_0x3c2c('0x14')](_0x27fbea[_0x2ff898][0x0]['VoiceExtensionId']);_0x511ef2=_[_0x3c2c('0x3e')](_0x511ef2,_0x165174[_0x3c2c('0x11')]);}}return _0xfbc5ec[_0x3c2c('0x40')](function(_0x24fa36){return _0xfbc5ec[_0x3c2c('0x2')][_0x3c2c('0x6')][_0x3c2c('0x41')]({'where':{'VoiceExtensionId':{'$in':_0x1db795}},'transaction':_0x24fa36})[_0x3c2c('0x4')](function(_0x1abf76){return _0xfbc5ec['models'][_0x3c2c('0x6')]['bulkCreate'](_[_0x3c2c('0x42')](_0x511ef2,_0x3c2c('0x10')),{'transaction':_0x24fa36});});});})[_0x3c2c('0x43')](function(_0x342fb3){console[_0x3c2c('0x44')](_0x342fb3);});}exports[_0x3c2c('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 861eb11..35ed4a3 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 _0x72f8=['catch','sequelize','all','outbound','BlackLists','CampaignId','findAll','Error\x20processing\x20rows\x20block:','finally','contact:csv_','resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','info','CSV\x20import\x20process\x20stopped!','CmContact','parse','duplicate','pause','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','squel','papaparse','ioredis','../../../mysqldb','api','redis','defaults','localhost','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','error','contact','index','test','errors','length','map','message','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','birthDate','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','ListId','CompanyId','Duplicate\x20Contact','create','keys','then','push','pick','stringify','cmContact','checkHopper','inspect','insert','scheduledAt','ContactId','updatedAt','select','field','createdAt','NOW()','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','toString','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper','\x20=\x20?','fromQuery','str','calleridnum','into','id\x20IN\x20?','cm_hopper_black','VoiceQueue','dialCheckDuplicateType','CmList','Lists','get','always','query','VoiceQueueId'];(function(_0x36fe55,_0x75f5d){var _0x2701e4=function(_0xce9362){while(--_0xce9362){_0x36fe55['push'](_0x36fe55['shift']());}};_0x2701e4(++_0x75f5d);}(_0x72f8,0xe3));var _0x872f=function(_0x367e5b,_0x5721e4){_0x367e5b=_0x367e5b-0x0;var _0x4b909e=_0x72f8[_0x367e5b];return _0x4b909e;};'use strict';var BPromise=require(_0x872f('0x0'));var util=require(_0x872f('0x1'));var _=require(_0x872f('0x2'));var fs=require('fs');var squel=require(_0x872f('0x3'));var Papa=require(_0x872f('0x4'));var Redis=require(_0x872f('0x5'));var db=require(_0x872f('0x6'))['db'];var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x872f('0x7'));config[_0x872f('0x8')]=_[_0x872f('0x9')](config[_0x872f('0x8')],{'host':_0x872f('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x872f('0xb'))[_0x872f('0xc')](socket);try{if(!process[_0x872f('0xd')][0x2]||process['argv'][0x2]===_0x872f('0xe')||process['argv'][0x2]===_0x872f('0xf')){throw new Error(_0x872f('0x10'));}var FILEPATH=process[_0x872f('0xd')][0x2];if(!process[_0x872f('0xd')][0x3]||process[_0x872f('0xd')][0x3]===_0x872f('0xe')||process[_0x872f('0xd')][0x3]===_0x872f('0xf')||!process[_0x872f('0xd')][0x4]||process['argv'][0x4]===_0x872f('0xe')||process['argv'][0x4]===_0x872f('0xf')){throw new Error(_0x872f('0x11'));}var FIELDS=_[_0x872f('0x12')](process['argv'][0x3]['split'](','),process[_0x872f('0xd')][0x4][_0x872f('0x13')](','));if(!process['argv'][0x5]||process['argv'][0x5]===_0x872f('0xe')||process[_0x872f('0xd')][0x5]===_0x872f('0xf')){throw new Error(_0x872f('0x14'));}var LISTID=process[_0x872f('0xd')][0x5];var COMPANYID=process[_0x872f('0xd')][0x6]&&process[_0x872f('0xd')][0x6]!==_0x872f('0xe')&&process['argv'][0x6]!==_0x872f('0xf')?process['argv'][0x6]:null;var DUPLICATES=process[_0x872f('0xd')][0x7]&&process[_0x872f('0xd')][0x7]!==_0x872f('0xe')&&process[_0x872f('0xd')][0x7]!==_0x872f('0xf')?process[_0x872f('0xd')][0x7]:null;if(!process[_0x872f('0xd')][0x8]||process['argv'][0x8]===_0x872f('0xe')||process[_0x872f('0xd')][0x8]==='null'){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x4435a1){logger[_0x872f('0x15')](_0x4435a1);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(_0x11cc31,_0xc564e8,_0x300470,_0x433c22){var _0x3cac31={'message':_0xc564e8};_0x3cac31[_0x11cc31]=!![];if(_0x300470){_0x3cac31[_0x872f('0x16')]=_0x300470;}if(_0x433c22){_0x3cac31[_0x872f('0x17')]=_0x433c22;}return _0x3cac31;}function isEmail(_0x52dc4f){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))*$/[_0x872f('0x18')](_0x52dc4f);}function checkRow(_0x5f1fb2,_0x3e557b,_0x22c244){return new BPromise(function(_0xec3405,_0x16ca9e){if(_['isNil'](_0x5f1fb2)){return _0x16ca9e(handleCheckRowError(_0x872f('0x15'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x22c244));}if(_0x5f1fb2['errors']&&_0x5f1fb2[_0x872f('0x19')][_0x872f('0x1a')]){var _0x40dd64=_[_0x872f('0x1b')](_0x5f1fb2[_0x872f('0x19')],_0x872f('0x1c'))['join'](';');return _0x16ca9e(handleCheckRowError(_0x872f('0x15'),_0x40dd64,null,_0x22c244));}var _0x11fa75={};for(var _0x3e5833 in FIELDS){if(FIELDS[_0x872f('0x1d')](_0x3e5833)&&FIELDS[_0x3e5833]){_0x11fa75[_0x3e5833]=_0x5f1fb2[_0x872f('0x1e')][0x0][FIELDS[_0x3e5833]]||_0x5f1fb2[_0x872f('0x1e')][0x0]['\ufeff'+FIELDS[_0x3e5833]];}}if(!_0x11fa75[_0x872f('0x1f')]){return _0x16ca9e(handleCheckRowError('error',_0x872f('0x20'),null,_0x22c244));}if(!_0x11fa75[_0x872f('0x21')]){return _0x16ca9e(handleCheckRowError(_0x872f('0x15'),'phone\x20not\x20specified!',null,_0x22c244));}if(_0x11fa75['birthDate']){var _0x46c01b=moment(_0x11fa75[_0x872f('0x22')],'YYYY-MM-DD');if(!_0x46c01b[_0x872f('0x23')]()){return _0x16ca9e(handleCheckRowError(_0x872f('0x15'),_0x872f('0x24'),null,_0x22c244));}}if(_0x11fa75[_0x872f('0x25')]){if(!isEmail(_0x11fa75[_0x872f('0x25')])){return _0x16ca9e(handleCheckRowError(_0x872f('0x15'),'email\x20format\x20is\x20not\x20valid!',null,_0x22c244));}}_0x11fa75[_0x872f('0x26')]=LISTID;_0x11fa75[_0x872f('0x27')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x872f('0x1a')]&&_0x3e557b){var _0x11dc65={};for(var _0x12c0d3=0x0,_0x17c0fb=DUPLICATES['length'];_0x12c0d3<_0x17c0fb;_0x12c0d3+=0x1){_0x11dc65[DUPLICATES[_0x12c0d3]]=_0x11fa75[DUPLICATES[_0x12c0d3]];}var _0xefb780=_['find'](_0x3e557b,_0x11dc65);if(_0xefb780){return _0x16ca9e(handleCheckRowError('duplicate',_0x872f('0x28'),_0xefb780,_0x22c244));}}return db['CmContact'][_0x872f('0x29')](_0x11fa75,{'raw':!![],'hooks':![],'fields':_[_0x872f('0x2a')](_0x11fa75)})[_0x872f('0x2b')](function(_0x2d616c){if(DUPLICATES&&DUPLICATES[_0x872f('0x1a')]&&_0x3e557b){_0x3e557b[_0x872f('0x2c')](_[_0x872f('0x2d')](_0x11fa75,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x2d616c['id'];return _0xec3405();})['catch'](function(_0x544441){return _0x16ca9e(handleCheckRowError(_0x872f('0x15'),'Error\x20while\x20creating\x20contact:\x20'+(_0x544441[_0x872f('0x1c')]||JSON[_0x872f('0x2e')](_0x544441)),null,_0x22c244));});});}function checkHopper(){function _0x2d377d(){return function(_0x18ed95){logger[_0x872f('0x15')](_0x872f('0x2f'),_0x872f('0x30'),util[_0x872f('0x31')](_0x18ed95,{'showHidden':![],'depth':null}));};}var _0x2de6c5=function(_0x16bdad,_0x56d883){var _0x1672ea=squel[_0x872f('0x32')]()['into']('cm_hopper')['fromQuery']([_0x872f('0x21'),_0x872f('0x33'),_0x872f('0x34'),_0x872f('0x26'),_0x56d883,'createdAt',_0x872f('0x35')],squel[_0x872f('0x36')]()['field'](_0x872f('0x21'),_0x872f('0x21'))['field']('NOW()',_0x872f('0x33'))[_0x872f('0x37')]('id',_0x872f('0x34'))['field'](LISTID['toString'](),_0x872f('0x26'))[_0x872f('0x37')](_0x16bdad['id']['toString'](),_0x56d883)[_0x872f('0x37')]('NOW()',_0x872f('0x38'))[_0x872f('0x37')](_0x872f('0x39'),_0x872f('0x35'))[_0x872f('0x3a')](_0x872f('0x3b'))[_0x872f('0x3c')](_0x872f('0x3d'))[_0x872f('0x3c')](_0x872f('0x3e'),LISTID[_0x872f('0x3f')]())[_0x872f('0x3c')](_0x872f('0x40'))['where'](_0x872f('0x41'),squel[_0x872f('0x36')]()['field'](_0x872f('0x21'))['from'](_0x872f('0x42'))[_0x872f('0x3c')](_0x56d883+_0x872f('0x43'),_0x16bdad['id'][_0x872f('0x3f')]())))['toString']();return _0x1672ea;};var _0x1cdcc5=function(_0x54796b,_0x16eb13){var _0x1547b7=squel[_0x872f('0x32')]()['into'](_0x872f('0x42'))[_0x872f('0x44')]([_0x872f('0x21'),_0x872f('0x33'),_0x872f('0x34'),_0x872f('0x26'),_0x16eb13,_0x872f('0x38'),_0x872f('0x35')],squel[_0x872f('0x36')]()[_0x872f('0x37')](_0x872f('0x21'),_0x872f('0x21'))[_0x872f('0x37')](_0x872f('0x39'),'scheduledAt')['field']('id',_0x872f('0x34'))['field'](LISTID[_0x872f('0x3f')](),_0x872f('0x26'))[_0x872f('0x37')](_0x54796b['id'][_0x872f('0x3f')](),_0x16eb13)[_0x872f('0x37')]('NOW()',_0x872f('0x38'))[_0x872f('0x37')]('NOW()',_0x872f('0x35'))[_0x872f('0x3a')]('cm_contacts')[_0x872f('0x3c')](_0x872f('0x3d'))['where'](_0x872f('0x3e'),LISTID['toString']())[_0x872f('0x3c')]('id\x20IN\x20?',squel[_0x872f('0x45')](hopperContacts))[_0x872f('0x3c')](_0x872f('0x40'))[_0x872f('0x3c')](_0x872f('0x41'),squel['select']()[_0x872f('0x37')](_0x872f('0x46'))[_0x872f('0x3a')]('cm_hopper_final')['where'](_0x16eb13+_0x872f('0x43'),_0x54796b['id'][_0x872f('0x3f')]()))[_0x872f('0x3c')]('phone\x20NOT\x20IN\x20(?)',squel[_0x872f('0x36')]()['field'](_0x872f('0x21'))[_0x872f('0x3a')](_0x872f('0x42'))['where'](_0x16eb13+_0x872f('0x43'),_0x54796b['id'][_0x872f('0x3f')]())))['toString']();return _0x1547b7;};function _0x19f996(_0x1fdcf4,_0x25a06c){var _0x1a0cc0=squel['insert']()[_0x872f('0x47')](_0x872f('0x42'))[_0x872f('0x44')]([_0x872f('0x21'),_0x872f('0x33'),'ContactId','ListId',_0x25a06c,_0x872f('0x38'),_0x872f('0x35')],squel[_0x872f('0x36')]()[_0x872f('0x37')](_0x872f('0x21'),'phone')[_0x872f('0x37')]('NOW()',_0x872f('0x33'))['field']('id','ContactId')[_0x872f('0x37')](LISTID[_0x872f('0x3f')](),'ListId')['field'](_0x1fdcf4['id'][_0x872f('0x3f')](),_0x25a06c)[_0x872f('0x37')](_0x872f('0x39'),_0x872f('0x38'))[_0x872f('0x37')](_0x872f('0x39'),_0x872f('0x35'))[_0x872f('0x3a')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')[_0x872f('0x3c')](_0x872f('0x3e'),LISTID['toString']())[_0x872f('0x3c')](_0x872f('0x48'),squel['str'](hopperContacts))[_0x872f('0x3c')](_0x872f('0x40')))[_0x872f('0x3f')]();return _0x1a0cc0;}function _0x5b297e(_0x528c14,_0x327376){var _0x4f3d98=squel['insert']()[_0x872f('0x47')](_0x872f('0x49'))[_0x872f('0x44')]([_0x872f('0x21'),'ContactId','ListId',_0x327376,_0x872f('0x38'),_0x872f('0x35')],squel[_0x872f('0x36')]()[_0x872f('0x37')](_0x872f('0x21'),_0x872f('0x21'))[_0x872f('0x37')]('id',_0x872f('0x34'))[_0x872f('0x37')](LISTID[_0x872f('0x3f')](),'ListId')[_0x872f('0x37')](_0x528c14['id']['toString'](),_0x327376)[_0x872f('0x37')](_0x872f('0x39'),_0x872f('0x38'))['field'](_0x872f('0x39'),'updatedAt')[_0x872f('0x3a')](_0x872f('0x3b'))[_0x872f('0x3c')](_0x872f('0x3d'))['where'](_0x872f('0x3e'),LISTID['toString']())[_0x872f('0x3c')](_0x872f('0x48'),squel[_0x872f('0x45')](hopperContacts))[_0x872f('0x3c')](_0x872f('0x40')))[_0x872f('0x3f')]();return _0x4f3d98;}return db[_0x872f('0x4a')]['findAll']({'where':{'type':'outbound'},'attributes':['id',_0x872f('0x4b')],'include':[{'model':db[_0x872f('0x4c')],'as':_0x872f('0x4d'),'where':{'id':LISTID}}]})[_0x872f('0x2b')](function(_0xbca2b0){var _0x389d14=[];if(_0xbca2b0){var _0x437f23;for(var _0x53d5bd=0x0,_0x1be5df;_0x53d5bd<_0xbca2b0[_0x872f('0x1a')];_0x53d5bd+=0x1){_0x1be5df=_0xbca2b0[_0x53d5bd][_0x872f('0x4e')]({'plain':!![]});switch(_0x1be5df['dialCheckDuplicateType']){case _0x872f('0x4f'):_0x389d14[_0x872f('0x2c')](db['sequelize'][_0x872f('0x50')](_0x1cdcc5(_0x1be5df,_0x872f('0x51')))[_0x872f('0x2b')](function(){})[_0x872f('0x52')](_0x2d377d()));break;case'onlyIfOpen':_0x389d14[_0x872f('0x2c')](db[_0x872f('0x53')][_0x872f('0x50')](_0x2de6c5(_0x1be5df,'VoiceQueueId'))['then'](function(){})['catch'](_0x2d377d()));break;default:_0x389d14['push'](db[_0x872f('0x53')][_0x872f('0x50')](_0x19f996(_0x1be5df,_0x872f('0x51')))[_0x872f('0x2b')](function(){})[_0x872f('0x52')](_0x2d377d()));}}}return _0x389d14;})[_0x872f('0x54')]()[_0x872f('0x2b')](function(){return db[_0x872f('0x4a')]['findAll']({'where':{'type':_0x872f('0x55')},'attributes':['id'],'include':[{'model':db[_0x872f('0x4c')],'as':_0x872f('0x56'),'where':{'id':LISTID}}]})[_0x872f('0x2b')](function(_0xfc9ff3){var _0x1e5129=[];if(_0xfc9ff3){var _0x266f60;for(var _0x106826=0x0,_0x10282c;_0x106826<_0xfc9ff3[_0x872f('0x1a')];_0x106826+=0x1){_0x10282c=_0xfc9ff3[_0x106826]['get']({'plain':!![]});_0x1e5129['push'](db[_0x872f('0x53')][_0x872f('0x50')](_0x5b297e(_0x10282c,_0x872f('0x51')))[_0x872f('0x2b')](function(){})[_0x872f('0x52')](_0x2d377d()));}}return _0x1e5129;})[_0x872f('0x54')]();})[_0x872f('0x2b')](function(){return db['Campaign']['findAll']({'attributes':['id',_0x872f('0x4b')],'include':[{'model':db[_0x872f('0x4c')],'as':_0x872f('0x4d'),'where':{'id':LISTID}}]})[_0x872f('0x2b')](function(_0xc3e011){var _0x43f387=[];if(_0xc3e011){for(var _0x54b5a3=0x0,_0x2284d2;_0x54b5a3<_0xc3e011[_0x872f('0x1a')];_0x54b5a3+=0x1){_0x2284d2=_0xc3e011[_0x54b5a3][_0x872f('0x4e')]({'plain':!![]});switch(_0x2284d2[_0x872f('0x4b')]){case _0x872f('0x4f'):_0x43f387['push'](db[_0x872f('0x53')][_0x872f('0x50')](_0x1cdcc5(_0x2284d2,_0x872f('0x57')))[_0x872f('0x2b')](function(){})[_0x872f('0x52')](_0x2d377d()));break;case'onlyIfOpen':_0x43f387[_0x872f('0x2c')](db[_0x872f('0x53')][_0x872f('0x50')](_0x2de6c5(_0x2284d2,_0x872f('0x57')))['then'](function(){})['catch'](_0x2d377d()));break;default:_0x43f387[_0x872f('0x2c')](db[_0x872f('0x53')]['query'](_0x19f996(_0x2284d2,_0x872f('0x57')))[_0x872f('0x2b')](function(){})[_0x872f('0x52')](_0x2d377d()));}}}return _0x43f387;})['all']();})['then'](function(){return db['Campaign'][_0x872f('0x58')]({'attributes':['id'],'include':[{'model':db[_0x872f('0x4c')],'as':_0x872f('0x56'),'where':{'id':LISTID}}]})[_0x872f('0x2b')](function(_0xdf9d31){var _0x205cc3=[];if(_0xdf9d31){for(var _0x2db836=0x0,_0x370037;_0x2db836<_0xdf9d31[_0x872f('0x1a')];_0x2db836+=0x1){_0x370037=_0xdf9d31[_0x2db836][_0x872f('0x4e')]({'plain':!![]});_0x205cc3[_0x872f('0x2c')](db[_0x872f('0x53')]['query'](_0x5b297e(_0x370037,_0x872f('0x57')))[_0x872f('0x2b')](function(){})[_0x872f('0x52')](_0x2d377d()));}}return _0x205cc3;})[_0x872f('0x54')]();})[_0x872f('0x52')](function(_0x294f51){logger[_0x872f('0x15')]('cmContact,\x20%s,\x20%s','generalCheckHopper',_0x294f51[_0x872f('0x1c')]);});}var processPromises=function(_0x477735){return BPromise[_0x872f('0x54')](promises)[_0x872f('0x2b')](function(_0x34c245){})[_0x872f('0x52')](function(_0x26c2e6){logger['error'](_0x872f('0x59'),JSON[_0x872f('0x2e')](_0x26c2e6));})[_0x872f('0x5a')](function(){socket['emit'](_0x872f('0x5b')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x477735){return _0x477735[_0x872f('0x5c')]();}});};var endCsv=function(){return BPromise[_0x872f('0x5d')]()[_0x872f('0x2b')](function(){if(hopperContacts){return checkHopper();}})[_0x872f('0x2b')](function(){socket['emit']('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x872f('0x5e')](FILEPATH);}catch(_0x35c0fe){logger[_0x872f('0x15')](_0x872f('0x5f'),JSON['stringify'](_0x35c0fe));}finally{process['exit'](0x0);}});};process['on']('SIGINT',function(){logger[_0x872f('0x60')](_0x872f('0x61'));endCsv();});function main(){return BPromise['resolve']()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x872f('0x13')](',');return db[_0x872f('0x62')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x872f('0x2b')](function(_0x506077){var _0x5f122b=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x872f('0x63')](_0x5f122b,{'header':!![],'skipEmptyLines':!![],'step':function(_0x4cdf04,_0x28e6c9){total+=0x1;var _0x18e924=total;promises[_0x872f('0x2c')](checkRow(_0x4cdf04,_0x506077,_0x18e924)['then'](function(){success+=0x1;})[_0x872f('0x52')](function(_0x4eafd0){if(_0x4eafd0[_0x872f('0x15')]){errors+=0x1;delete _0x4eafd0['error'];}else if(_0x4eafd0[_0x872f('0x64')]){duplicates+=0x1;delete _0x4eafd0[_0x872f('0x64')];}rows[_0x872f('0x2c')](_0x4eafd0);}));if(total%0xc8===0x0){_0x28e6c9[_0x872f('0x65')]();return processPromises(_0x28e6c9);}},'complete':function(){return processPromises()['then'](function(){logger[_0x872f('0x60')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x2c01f8,_0x1cdc0d){logger[_0x872f('0x60')]('CSV\x20parse\x20error',JSON[_0x872f('0x2e')](_0x2c01f8));endCsv();}});})[_0x872f('0x52')](function(_0xd98351){logger['error'](_0x872f('0x66'),JSON['stringify'](_0xd98351));});}main(); \ No newline at end of file +var _0x6022=['generalCheckHopper','message','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','resolve','unlinkSync','exit','info','CSV\x20import\x20process\x20stopped!','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','squel','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','localhost','../../../api/cmContact/cmContact.socket','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','error','index','test','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','hasOwnProperty','data','firstName','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','duplicate','Duplicate\x20Contact','CmContact','keys','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','checkHopper','inspect','into','cm_hopper','fromQuery','ContactId','createdAt','updatedAt','select','field','NOW()','toString','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','\x20=\x20?','insert','scheduledAt','id\x20IN\x20?','str','phone\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_black','VoiceQueue','outbound','dialCheckDuplicateType','CmList','Lists','then','get','sequelize','query','VoiceQueueId','onlyIfOpen','all','findAll','BlackLists','always','CampaignId','Campaign','cmContact,\x20%s,\x20%s'];(function(_0x247dc0,_0x3a2bb){var _0x554e23=function(_0x33f75e){while(--_0x33f75e){_0x247dc0['push'](_0x247dc0['shift']());}};_0x554e23(++_0x3a2bb);}(_0x6022,0x162));var _0x2602=function(_0xe8bc84,_0x54f2ca){_0xe8bc84=_0xe8bc84-0x0;var _0x298c0b=_0x6022[_0xe8bc84];return _0x298c0b;};'use strict';var BPromise=require(_0x2602('0x0'));var util=require(_0x2602('0x1'));var _=require(_0x2602('0x2'));var fs=require('fs');var squel=require(_0x2602('0x3'));var Papa=require(_0x2602('0x4'));var Redis=require(_0x2602('0x5'));var db=require(_0x2602('0x6'))['db'];var config=require(_0x2602('0x7'));var logger=require(_0x2602('0x8'))(_0x2602('0x9'));config[_0x2602('0xa')]=_['defaults'](config[_0x2602('0xa')],{'host':_0x2602('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2602('0xa')]));require(_0x2602('0xc'))['register'](socket);try{if(!process[_0x2602('0xd')][0x2]||process[_0x2602('0xd')][0x2]===_0x2602('0xe')||process[_0x2602('0xd')][0x2]===_0x2602('0xf')){throw new Error(_0x2602('0x10'));}var FILEPATH=process['argv'][0x2];if(!process[_0x2602('0xd')][0x3]||process['argv'][0x3]==='undefined'||process[_0x2602('0xd')][0x3]===_0x2602('0xf')||!process[_0x2602('0xd')][0x4]||process[_0x2602('0xd')][0x4]==='undefined'||process[_0x2602('0xd')][0x4]===_0x2602('0xf')){throw new Error(_0x2602('0x11'));}var FIELDS=_[_0x2602('0x12')](process[_0x2602('0xd')][0x3][_0x2602('0x13')](','),process[_0x2602('0xd')][0x4][_0x2602('0x13')](','));if(!process[_0x2602('0xd')][0x5]||process[_0x2602('0xd')][0x5]===_0x2602('0xe')||process[_0x2602('0xd')][0x5]===_0x2602('0xf')){throw new Error(_0x2602('0x14'));}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x2602('0xd')][0x6]&&process[_0x2602('0xd')][0x6]!=='undefined'&&process[_0x2602('0xd')][0x6]!==_0x2602('0xf')?process['argv'][0x6]:null;var DUPLICATES=process[_0x2602('0xd')][0x7]&&process[_0x2602('0xd')][0x7]!=='undefined'&&process['argv'][0x7]!==_0x2602('0xf')?process['argv'][0x7]:null;if(!process[_0x2602('0xd')][0x8]||process[_0x2602('0xd')][0x8]===_0x2602('0xe')||process[_0x2602('0xd')][0x8]==='null'){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x11700e){logger[_0x2602('0x15')](_0x11700e);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(_0x36fc4f,_0x2bf2ad,_0xea3ac4,_0x1b8e6f){var _0x38f447={'message':_0x2bf2ad};_0x38f447[_0x36fc4f]=!![];if(_0xea3ac4){_0x38f447['contact']=_0xea3ac4;}if(_0x1b8e6f){_0x38f447[_0x2602('0x16')]=_0x1b8e6f;}return _0x38f447;}function isEmail(_0x2997e4){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))*$/[_0x2602('0x17')](_0x2997e4);}function checkRow(_0xc56548,_0x559de1,_0x4add6d){return new BPromise(function(_0xfe2444,_0x2650c7){if(_['isNil'](_0xc56548)){return _0x2650c7(handleCheckRowError(_0x2602('0x15'),_0x2602('0x18'),null,_0x4add6d));}if(_0xc56548['errors']&&_0xc56548[_0x2602('0x19')][_0x2602('0x1a')]){var _0x405339=_['map'](_0xc56548[_0x2602('0x19')],'message')['join'](';');return _0x2650c7(handleCheckRowError('error',_0x405339,null,_0x4add6d));}var _0x51bd4a={};for(var _0x529e3c in FIELDS){if(FIELDS[_0x2602('0x1b')](_0x529e3c)&&FIELDS[_0x529e3c]){_0x51bd4a[_0x529e3c]=_0xc56548[_0x2602('0x1c')][0x0][FIELDS[_0x529e3c]]||_0xc56548['data'][0x0]['\ufeff'+FIELDS[_0x529e3c]];}}if(!_0x51bd4a[_0x2602('0x1d')]){return _0x2650c7(handleCheckRowError(_0x2602('0x15'),'firstName\x20not\x20specified!',null,_0x4add6d));}if(!_0x51bd4a[_0x2602('0x1e')]){return _0x2650c7(handleCheckRowError(_0x2602('0x15'),_0x2602('0x1f'),null,_0x4add6d));}if(_0x51bd4a[_0x2602('0x20')]){var _0x16f144=moment(_0x51bd4a[_0x2602('0x20')],_0x2602('0x21'));if(!_0x16f144[_0x2602('0x22')]()){return _0x2650c7(handleCheckRowError('error',_0x2602('0x23'),null,_0x4add6d));}}if(_0x51bd4a[_0x2602('0x24')]){if(!isEmail(_0x51bd4a['email'])){return _0x2650c7(handleCheckRowError(_0x2602('0x15'),_0x2602('0x25'),null,_0x4add6d));}}_0x51bd4a[_0x2602('0x26')]=LISTID;_0x51bd4a[_0x2602('0x27')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x559de1){var _0x55d1b9={};for(var _0x4925b4=0x0,_0x4a05c0=DUPLICATES[_0x2602('0x1a')];_0x4925b4<_0x4a05c0;_0x4925b4+=0x1){_0x55d1b9[DUPLICATES[_0x4925b4]]=_0x51bd4a[DUPLICATES[_0x4925b4]];}var _0x514664=_[_0x2602('0x28')](_0x559de1,_0x55d1b9);if(_0x514664){return _0x2650c7(handleCheckRowError(_0x2602('0x29'),_0x2602('0x2a'),_0x514664,_0x4add6d));}}return db[_0x2602('0x2b')]['create'](_0x51bd4a,{'raw':!![],'hooks':![],'fields':_[_0x2602('0x2c')](_0x51bd4a)})['then'](function(_0xdc9ce5){if(DUPLICATES&&DUPLICATES['length']&&_0x559de1){_0x559de1[_0x2602('0x2d')](_[_0x2602('0x2e')](_0x51bd4a,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0xdc9ce5['id'];return _0xfe2444();})[_0x2602('0x2f')](function(_0x24acbe){return _0x2650c7(handleCheckRowError(_0x2602('0x15'),_0x2602('0x30')+(_0x24acbe['message']||JSON[_0x2602('0x31')](_0x24acbe)),null,_0x4add6d));});});}function checkHopper(){function _0x2f2a16(){return function(_0x5b9731){logger[_0x2602('0x15')]('cmContact',_0x2602('0x32'),util[_0x2602('0x33')](_0x5b9731,{'showHidden':![],'depth':null}));};}var _0x41e3bb=function(_0x577278,_0x229b7){var _0xf4e3c9=squel['insert']()[_0x2602('0x34')](_0x2602('0x35'))[_0x2602('0x36')](['phone','scheduledAt',_0x2602('0x37'),_0x2602('0x26'),_0x229b7,_0x2602('0x38'),_0x2602('0x39')],squel[_0x2602('0x3a')]()[_0x2602('0x3b')](_0x2602('0x1e'),_0x2602('0x1e'))[_0x2602('0x3b')](_0x2602('0x3c'),'scheduledAt')[_0x2602('0x3b')]('id',_0x2602('0x37'))['field'](LISTID['toString'](),_0x2602('0x26'))[_0x2602('0x3b')](_0x577278['id'][_0x2602('0x3d')](),_0x229b7)[_0x2602('0x3b')]('NOW()',_0x2602('0x38'))['field']('NOW()',_0x2602('0x39'))[_0x2602('0x3e')](_0x2602('0x3f'))[_0x2602('0x40')](_0x2602('0x41'))[_0x2602('0x40')](_0x2602('0x42'),LISTID[_0x2602('0x3d')]())[_0x2602('0x40')](_0x2602('0x43'))[_0x2602('0x40')]('phone\x20NOT\x20IN\x20(?)',squel[_0x2602('0x3a')]()['field'](_0x2602('0x1e'))[_0x2602('0x3e')]('cm_hopper')[_0x2602('0x40')](_0x229b7+_0x2602('0x44'),_0x577278['id'][_0x2602('0x3d')]())))[_0x2602('0x3d')]();return _0xf4e3c9;};var _0xc7ece2=function(_0x4d842f,_0x120378){var _0x3d68b7=squel[_0x2602('0x45')]()[_0x2602('0x34')](_0x2602('0x35'))[_0x2602('0x36')]([_0x2602('0x1e'),_0x2602('0x46'),_0x2602('0x37'),_0x2602('0x26'),_0x120378,'createdAt','updatedAt'],squel[_0x2602('0x3a')]()[_0x2602('0x3b')](_0x2602('0x1e'),_0x2602('0x1e'))[_0x2602('0x3b')]('NOW()',_0x2602('0x46'))[_0x2602('0x3b')]('id',_0x2602('0x37'))[_0x2602('0x3b')](LISTID[_0x2602('0x3d')](),_0x2602('0x26'))['field'](_0x4d842f['id'][_0x2602('0x3d')](),_0x120378)[_0x2602('0x3b')]('NOW()','createdAt')[_0x2602('0x3b')](_0x2602('0x3c'),_0x2602('0x39'))[_0x2602('0x3e')](_0x2602('0x3f'))[_0x2602('0x40')](_0x2602('0x41'))[_0x2602('0x40')](_0x2602('0x42'),LISTID[_0x2602('0x3d')]())[_0x2602('0x40')](_0x2602('0x47'),squel[_0x2602('0x48')](hopperContacts))[_0x2602('0x40')](_0x2602('0x43'))[_0x2602('0x40')](_0x2602('0x49'),squel[_0x2602('0x3a')]()[_0x2602('0x3b')](_0x2602('0x4a'))[_0x2602('0x3e')]('cm_hopper_final')['where'](_0x120378+_0x2602('0x44'),_0x4d842f['id'][_0x2602('0x3d')]()))[_0x2602('0x40')](_0x2602('0x49'),squel[_0x2602('0x3a')]()[_0x2602('0x3b')](_0x2602('0x1e'))['from'](_0x2602('0x35'))[_0x2602('0x40')](_0x120378+_0x2602('0x44'),_0x4d842f['id'][_0x2602('0x3d')]())))['toString']();return _0x3d68b7;};function _0x337863(_0x34babd,_0xda1eaa){var _0x2cb921=squel[_0x2602('0x45')]()['into']('cm_hopper')[_0x2602('0x36')]([_0x2602('0x1e'),_0x2602('0x46'),_0x2602('0x37'),_0x2602('0x26'),_0xda1eaa,_0x2602('0x38'),_0x2602('0x39')],squel[_0x2602('0x3a')]()['field'](_0x2602('0x1e'),_0x2602('0x1e'))[_0x2602('0x3b')](_0x2602('0x3c'),_0x2602('0x46'))['field']('id',_0x2602('0x37'))['field'](LISTID[_0x2602('0x3d')](),_0x2602('0x26'))['field'](_0x34babd['id']['toString'](),_0xda1eaa)['field'](_0x2602('0x3c'),'createdAt')[_0x2602('0x3b')]('NOW()','updatedAt')[_0x2602('0x3e')](_0x2602('0x3f'))[_0x2602('0x40')]('deletedAt\x20IS\x20NULL')[_0x2602('0x40')](_0x2602('0x42'),LISTID['toString']())[_0x2602('0x40')](_0x2602('0x47'),squel[_0x2602('0x48')](hopperContacts))['where'](_0x2602('0x43')))['toString']();return _0x2cb921;}function _0x360c2a(_0x730599,_0x4a66dc){var _0x23e4c3=squel[_0x2602('0x45')]()['into'](_0x2602('0x4b'))['fromQuery']([_0x2602('0x1e'),_0x2602('0x37'),'ListId',_0x4a66dc,_0x2602('0x38'),_0x2602('0x39')],squel[_0x2602('0x3a')]()[_0x2602('0x3b')](_0x2602('0x1e'),_0x2602('0x1e'))[_0x2602('0x3b')]('id',_0x2602('0x37'))['field'](LISTID[_0x2602('0x3d')](),_0x2602('0x26'))[_0x2602('0x3b')](_0x730599['id']['toString'](),_0x4a66dc)['field'](_0x2602('0x3c'),'createdAt')['field'](_0x2602('0x3c'),'updatedAt')[_0x2602('0x3e')](_0x2602('0x3f'))['where'](_0x2602('0x41'))[_0x2602('0x40')](_0x2602('0x42'),LISTID[_0x2602('0x3d')]())[_0x2602('0x40')](_0x2602('0x47'),squel[_0x2602('0x48')](hopperContacts))[_0x2602('0x40')](_0x2602('0x43')))[_0x2602('0x3d')]();return _0x23e4c3;}return db[_0x2602('0x4c')]['findAll']({'where':{'type':_0x2602('0x4d')},'attributes':['id',_0x2602('0x4e')],'include':[{'model':db[_0x2602('0x4f')],'as':_0x2602('0x50'),'where':{'id':LISTID}}]})[_0x2602('0x51')](function(_0x590c22){var _0x1e632a=[];if(_0x590c22){var _0x2faaa8;for(var _0x210094=0x0,_0x2cf84c;_0x210094<_0x590c22[_0x2602('0x1a')];_0x210094+=0x1){_0x2cf84c=_0x590c22[_0x210094][_0x2602('0x52')]({'plain':!![]});switch(_0x2cf84c[_0x2602('0x4e')]){case'always':_0x1e632a[_0x2602('0x2d')](db[_0x2602('0x53')][_0x2602('0x54')](_0xc7ece2(_0x2cf84c,_0x2602('0x55')))[_0x2602('0x51')](function(){})[_0x2602('0x2f')](_0x2f2a16()));break;case _0x2602('0x56'):_0x1e632a[_0x2602('0x2d')](db[_0x2602('0x53')][_0x2602('0x54')](_0x41e3bb(_0x2cf84c,'VoiceQueueId'))[_0x2602('0x51')](function(){})['catch'](_0x2f2a16()));break;default:_0x1e632a[_0x2602('0x2d')](db['sequelize']['query'](_0x337863(_0x2cf84c,_0x2602('0x55')))[_0x2602('0x51')](function(){})['catch'](_0x2f2a16()));}}}return _0x1e632a;})[_0x2602('0x57')]()[_0x2602('0x51')](function(){return db[_0x2602('0x4c')][_0x2602('0x58')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db[_0x2602('0x4f')],'as':_0x2602('0x59'),'where':{'id':LISTID}}]})[_0x2602('0x51')](function(_0x4270ae){var _0x5e358b=[];if(_0x4270ae){var _0x1f785e;for(var _0xd7a48=0x0,_0x3c5826;_0xd7a48<_0x4270ae[_0x2602('0x1a')];_0xd7a48+=0x1){_0x3c5826=_0x4270ae[_0xd7a48][_0x2602('0x52')]({'plain':!![]});_0x5e358b[_0x2602('0x2d')](db[_0x2602('0x53')][_0x2602('0x54')](_0x360c2a(_0x3c5826,_0x2602('0x55')))['then'](function(){})[_0x2602('0x2f')](_0x2f2a16()));}}return _0x5e358b;})[_0x2602('0x57')]();})[_0x2602('0x51')](function(){return db['Campaign']['findAll']({'attributes':['id',_0x2602('0x4e')],'include':[{'model':db[_0x2602('0x4f')],'as':_0x2602('0x50'),'where':{'id':LISTID}}]})[_0x2602('0x51')](function(_0x533c4c){var _0x40f546=[];if(_0x533c4c){for(var _0x125007=0x0,_0x185d24;_0x125007<_0x533c4c[_0x2602('0x1a')];_0x125007+=0x1){_0x185d24=_0x533c4c[_0x125007]['get']({'plain':!![]});switch(_0x185d24[_0x2602('0x4e')]){case _0x2602('0x5a'):_0x40f546[_0x2602('0x2d')](db[_0x2602('0x53')][_0x2602('0x54')](_0xc7ece2(_0x185d24,_0x2602('0x5b')))[_0x2602('0x51')](function(){})[_0x2602('0x2f')](_0x2f2a16()));break;case'onlyIfOpen':_0x40f546[_0x2602('0x2d')](db[_0x2602('0x53')][_0x2602('0x54')](_0x41e3bb(_0x185d24,'CampaignId'))['then'](function(){})['catch'](_0x2f2a16()));break;default:_0x40f546[_0x2602('0x2d')](db[_0x2602('0x53')][_0x2602('0x54')](_0x337863(_0x185d24,_0x2602('0x5b')))[_0x2602('0x51')](function(){})['catch'](_0x2f2a16()));}}}return _0x40f546;})['all']();})[_0x2602('0x51')](function(){return db[_0x2602('0x5c')][_0x2602('0x58')]({'attributes':['id'],'include':[{'model':db[_0x2602('0x4f')],'as':_0x2602('0x59'),'where':{'id':LISTID}}]})[_0x2602('0x51')](function(_0x23f497){var _0x22b346=[];if(_0x23f497){for(var _0x411c0a=0x0,_0x40eb40;_0x411c0a<_0x23f497[_0x2602('0x1a')];_0x411c0a+=0x1){_0x40eb40=_0x23f497[_0x411c0a][_0x2602('0x52')]({'plain':!![]});_0x22b346[_0x2602('0x2d')](db[_0x2602('0x53')][_0x2602('0x54')](_0x360c2a(_0x40eb40,_0x2602('0x5b')))['then'](function(){})['catch'](_0x2f2a16()));}}return _0x22b346;})[_0x2602('0x57')]();})[_0x2602('0x2f')](function(_0x24052c){logger[_0x2602('0x15')](_0x2602('0x5d'),_0x2602('0x5e'),_0x24052c[_0x2602('0x5f')]);});}var processPromises=function(_0x44dd15){return BPromise['all'](promises)[_0x2602('0x51')](function(_0x5f2c02){})[_0x2602('0x2f')](function(_0x3fbc9f){logger[_0x2602('0x15')](_0x2602('0x60'),JSON[_0x2602('0x31')](_0x3fbc9f));})[_0x2602('0x61')](function(){socket[_0x2602('0x62')](_0x2602('0x63')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x44dd15){return _0x44dd15[_0x2602('0x64')]();}});};var endCsv=function(){return BPromise[_0x2602('0x65')]()[_0x2602('0x51')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket[_0x2602('0x62')]('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x2602('0x66')](FILEPATH);}catch(_0x40fabb){logger[_0x2602('0x15')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0x2602('0x31')](_0x40fabb));}finally{process[_0x2602('0x67')](0x0);}});};process['on']('SIGINT',function(){logger[_0x2602('0x68')](_0x2602('0x69'));endCsv();});function main(){return BPromise[_0x2602('0x65')]()[_0x2602('0x51')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x2602('0x13')](',');return db['CmContact'][_0x2602('0x58')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x2602('0x51')](function(_0x126429){var _0x3d80b0=fs[_0x2602('0x6a')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x2602('0x6b')](_0x3d80b0,{'header':!![],'skipEmptyLines':!![],'step':function(_0x30e40,_0xea2ab8){total+=0x1;var _0xea0d9c=total;promises[_0x2602('0x2d')](checkRow(_0x30e40,_0x126429,_0xea0d9c)[_0x2602('0x51')](function(){success+=0x1;})['catch'](function(_0x5ccb5d){if(_0x5ccb5d[_0x2602('0x15')]){errors+=0x1;delete _0x5ccb5d[_0x2602('0x15')];}else if(_0x5ccb5d[_0x2602('0x29')]){duplicates+=0x1;delete _0x5ccb5d[_0x2602('0x29')];}rows['push'](_0x5ccb5d);}));if(total%0xc8===0x0){_0xea2ab8[_0x2602('0x6c')]();return processPromises(_0xea2ab8);}},'complete':function(){return processPromises()[_0x2602('0x51')](function(){logger[_0x2602('0x68')](_0x2602('0x6d'));endCsv();});},'error':function(_0x2cd538,_0x117799){logger[_0x2602('0x68')](_0x2602('0x6e'),JSON[_0x2602('0x31')](_0x2cd538));endCsv();}});})[_0x2602('0x2f')](function(_0x32f3e6){logger[_0x2602('0x15')](_0x2602('0x6f'),JSON['stringify'](_0x32f3e6));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index eefe0ab..ada0eaf 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 _0xb897=['name','_description','writeFileSync','parse','createReadStream','data','rows','errors','find','isNil','hasOwnProperty','trim','replace','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','priority','isNumber','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','isValid','firstName','\x20not\x20specified','itemTypeId','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','CompanyId',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','contactId','contactTypeId','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns_has_cm_blacklists','finish','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','binding','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','papaparse','bluebird','moment','squel','ioredis','../../../config/environment/shared','../../../config/logger','import','redis','defaults','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','CmContact','findAll','then','push','all','AdditionalPhones','split','length','findOne','CmContactHasItem','update','updated','create','PHONE','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','insert','into','cm_hopper','fromQuery','phone','ContactId','ListId','createdAt','updatedAt','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','toString','cm_hopper_black','ListId\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.priority','cm_contacts.UserId','scheduledat','UserId','\x22onlyIfOpen\x22','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','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','keys','scheduledAt',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','exit','message','query','spread','catch','campaigns.id','campaigns','campaigns_has_cm_lists','campaigns_has_cm_lists.CmListId=','sequelize','voice_queues.id','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','error','timezones','dialTimezone','utcOffset','set','send','start','clone','socket_timestamp','root','server/files/tmp','.csv','header'];(function(_0x1c0490,_0x11ec08){var _0x48098e=function(_0x1ca60a){while(--_0x1ca60a){_0x1c0490['push'](_0x1c0490['shift']());}};_0x48098e(++_0x11ec08);}(_0xb897,0x1b2));var _0x7b89=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xb897[_0x110c3d];return _0x226d67;};'use strict';var fs=require('fs');var path=require(_0x7b89('0x0'));var _=require('lodash');var Papa=require(_0x7b89('0x1'));var util=require('util');var BPromise=require(_0x7b89('0x2'));var moment=require(_0x7b89('0x3'));var squel=require(_0x7b89('0x4'));var Redis=require(_0x7b89('0x5'));var db=require('../../../mysqldb')['db'];var config=require('../../../config/environment');var shared=require(_0x7b89('0x6'));var logger=require(_0x7b89('0x7'))(_0x7b89('0x8'));config[_0x7b89('0x9')]=_[_0x7b89('0xa')](config[_0x7b89('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x7b89('0xb'))(new Redis(config[_0x7b89('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x7b89('0xc')](_0x7b89('0xd'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x7b89('0xc')](_0x7b89('0xd'));function isEmail(_0x5c0fca){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))*$/[_0x7b89('0xe')](_0x5c0fca);}function selectNotIn(_0x14edf3,_0x223674,_0x234b4e,_0x56dff7,_0x4678a3){return squel[_0x7b89('0xf')]()[_0x7b89('0x10')]('phone')[_0x7b89('0x11')](_0x56dff7)[_0x7b89('0x12')](_0x223674,null,_0x223674+_0x7b89('0x13')+_0x56dff7+'.'+_0x234b4e)[_0x7b89('0x14')](_0x56dff7+'.'+_0x234b4e+_0x7b89('0x15')+_0x14edf3+'.'+_0x234b4e)[_0x7b89('0x14')](_0x223674+_0x7b89('0x16')+_0x4678a3['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x2f71ce,_0x1531ad){promisesAdditionalPhones=[];return db[_0x7b89('0x17')][_0x7b89('0x18')]({'raw':!![],'attributes':['id','AdditionalPhones'],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x7b89('0x19')](function(_0xd3b443){if(_0xd3b443!==null){var _0x34b025=[];for(var _0x3143c7=0x0;_0x3143c7<_0xd3b443['length'];_0x3143c7++){var _0x12ad9c=_0xd3b443[_0x3143c7];_0x34b025[_0x7b89('0x1a')](insertAdditionalPhones(_0x12ad9c));}}Promise[_0x7b89('0x1b')](_0x34b025)['then'](function(){_0x2f71ce({'val':0x1});});});});}function insertAdditionalPhones(_0x150e67){return new Promise(function(_0x519ce5,_0x57af20){var _0x45903c=_0x150e67[_0x7b89('0x1c')];var _0x277cae=_0x45903c[_0x7b89('0x1d')](';');var _0x3b87d2=[];orderBy=0x0;for(var _0x5e4e51=0x0;_0x5e4e51<_0x277cae[_0x7b89('0x1e')];_0x5e4e51++){_0x3b87d2[_0x7b89('0x1a')](splitAdditionalPhone(_0x150e67['id'],_0x277cae[_0x5e4e51]));}Promise[_0x7b89('0x1b')](_0x3b87d2)[_0x7b89('0x19')](function(){_0x519ce5({'val':_0x277cae['length']});});});}function splitAdditionalPhone(_0x4bf36e,_0xbb9152){return new Promise(function(_0x4a5d19,_0x11675c){var _0x22780e=_0xbb9152[_0x7b89('0x1d')](':');var _0x27dc21=_0x22780e[0x0];var _0x81ff19=_0x22780e[0x1];if(!_['isNil'](_0x81ff19)){var _0x5e5366=_0x81ff19[_0x7b89('0x1d')]('|');var _0x3d8873=[];for(var _0x1a255f=0x0;_0x1a255f<_0x5e5366[_0x7b89('0x1e')];_0x1a255f++){if(_0x5e5366[_0x1a255f]!==''){var _0x567334=_['filter'](promisesAdditionalPhones,{'contactId':_0x4bf36e,'phone':_0x5e5366[_0x1a255f]});if(_0x567334['length']==0x0){orderBy++;promisesAdditionalPhones[_0x7b89('0x1a')]({'contactId':_0x4bf36e,'contactTypeId':_0x27dc21,'phone':_0x5e5366[_0x1a255f],'orderBy':orderBy});}}}_0x4a5d19({'ok':0x1});}else _0x4a5d19({'res':0x0});});}function createAdditionalPhone(_0x588c3a,_0x44df99,_0x55241c,_0x1004ca){var _0x2f12e4='';var _0x51782d='';var _0x47ce98=_0x55241c[_0x7b89('0x1d')]('§');_0x2f12e4=_0x47ce98[0x0];if(_0x47ce98[_0x7b89('0x1e')]==0x2)_0x51782d=_0x47ce98[0x1];return new Promise(function(_0x16b29a,_0x668136){return db['CmContactHasItem'][_0x7b89('0x1f')]({'where':{'CmContactId':_0x588c3a,'item':_0x2f12e4}})[_0x7b89('0x19')](function(_0x4623ab){if(_0x4623ab){return db[_0x7b89('0x20')][_0x7b89('0x21')]({'ItemTypeId':_0x44df99,'description':_0x51782d,'OrderBy':_0x1004ca},{'where':{'CmContactId':_0x588c3a,'item':_0x2f12e4}})[_0x7b89('0x19')](function(_0x21e426){_0x16b29a({'res':_0x7b89('0x22')});});}else{return db['CmContactHasItem'][_0x7b89('0x23')]({'CmContactId':_0x588c3a,'item':_0x2f12e4,'description':_0x51782d,'ItemTypeId':_0x44df99,'OrderBy':_0x1004ca,'ItemClass':_0x7b89('0x24')})[_0x7b89('0x19')](function(_0x2a4db1){_0x16b29a({'res':_0x7b89('0x25')});});}});});}function insertCmHopper(_0x21c1b1,_0x1c93ae,_0x54fbd7,_0x39f6c4,_0x1b45e7){var _0x2580f9=[_0x7b89('0x26'),_0x7b89('0x27'),_0x7b89('0x28'),_0x7b89('0x29'),_0x1c93ae+'.'+_0x39f6c4,_0x7b89('0x2a'),_0x7b89('0x2b'),'cm_contacts.priority','cm_contacts.UserId','\x22'+_0x1b45e7+'\x22'];return squel[_0x7b89('0x2c')]()[_0x7b89('0x2d')](_0x7b89('0x2e'))[_0x7b89('0x2f')]([_0x7b89('0x30'),'scheduledat',_0x7b89('0x31'),_0x7b89('0x32'),_0x39f6c4,_0x7b89('0x33'),_0x7b89('0x34'),'priority','UserId',_0x7b89('0x35')],squel[_0x7b89('0xf')]()[_0x7b89('0x36')](_0x2580f9)['from'](_0x1c93ae)[_0x7b89('0x12')](_0x7b89('0x37'),null,_0x7b89('0x38')+_0x1c93ae+_0x7b89('0x39'))[_0x7b89('0x12')](_0x54fbd7,null,_0x54fbd7+_0x7b89('0x13')+_0x1c93ae+'.'+_0x39f6c4)[_0x7b89('0x14')](_0x1c93ae+_0x7b89('0x3a'),_0x21c1b1)[_0x7b89('0x14')](_0x7b89('0x3b'),NOW)[_0x7b89('0x14')](_0x7b89('0x3c'),selectNotIn(_0x1c93ae,_0x54fbd7,_0x39f6c4,'cm_hopper',[_0x7b89('0x3d'),'\x22onlyIfOpen\x22']))[_0x7b89('0x14')](_0x7b89('0x3c'),selectNotIn(_0x1c93ae,_0x54fbd7,_0x39f6c4,_0x7b89('0x2e'),['\x22always\x22'])))[_0x7b89('0x3e')]();}function insertCmHopperBlack(_0x3ce0b7,_0x373432,_0x5d4f5e,_0x271c6d){var _0x4ac4f4=[_0x7b89('0x26'),'cm_contacts.id','cm_contacts.ListId',_0x373432+'.'+_0x271c6d,_0x7b89('0x2a'),'cm_contacts.updatedAt'];return squel[_0x7b89('0x2c')]()[_0x7b89('0x2d')](_0x7b89('0x3f'))[_0x7b89('0x2f')]([_0x7b89('0x30'),'ContactId','ListId',_0x271c6d,'createdAt',_0x7b89('0x34')],squel['select']()['fields'](_0x4ac4f4)[_0x7b89('0x11')](_0x373432)[_0x7b89('0x12')]('cm_contacts',null,_0x7b89('0x38')+_0x373432+_0x7b89('0x39'))[_0x7b89('0x12')](_0x5d4f5e,null,_0x5d4f5e+'.id\x20=\x20'+_0x373432+'.'+_0x271c6d)['where'](_0x373432+_0x7b89('0x3a'),_0x3ce0b7)[_0x7b89('0x14')](_0x7b89('0x3b'),NOW)[_0x7b89('0x14')](_0x7b89('0x3c'),squel[_0x7b89('0xf')]()['field']('phone')[_0x7b89('0x11')](_0x7b89('0x3f'))[_0x7b89('0x14')](_0x7b89('0x40'),_0x3ce0b7)[_0x7b89('0x14')](_0x271c6d+_0x7b89('0x15')+_0x373432+'.'+_0x271c6d)))[_0x7b89('0x3e')]();}function insertTzCmHopper(_0x3105e7,_0x43587e,_0x4764c7,_0x258657,_0x477bcb,_0x52ea5c){var _0x490c07=[_0x7b89('0x26'),_0x7b89('0x41')+_0x52ea5c+_0x7b89('0x42'),_0x7b89('0x28'),_0x7b89('0x29'),_0x43587e+'.'+_0x258657,_0x7b89('0x2a'),_0x7b89('0x2b'),_0x7b89('0x43'),_0x7b89('0x44'),'\x22'+_0x477bcb+'\x22'];var _0x463aff=squel[_0x7b89('0x2c')]()[_0x7b89('0x2d')](_0x7b89('0x2e'))[_0x7b89('0x2f')](['phone',_0x7b89('0x45'),_0x7b89('0x31'),_0x7b89('0x32'),_0x258657,_0x7b89('0x33'),_0x7b89('0x34'),'priority',_0x7b89('0x46'),_0x7b89('0x35')],squel[_0x7b89('0xf')]()[_0x7b89('0x36')](_0x490c07)['from'](_0x43587e)[_0x7b89('0x12')]('cm_contacts',null,_0x7b89('0x38')+_0x43587e+_0x7b89('0x39'))[_0x7b89('0x12')](_0x4764c7,null,_0x4764c7+_0x7b89('0x13')+_0x43587e+'.'+_0x258657)[_0x7b89('0x12')](_0x52ea5c,null,_0x52ea5c+_0x7b89('0x13')+_0x43587e+'.'+_0x258657)['where'](_0x43587e+_0x7b89('0x3a'),_0x3105e7)['where'](_0x7b89('0x3b'),NOW)[_0x7b89('0x14')](_0x7b89('0x3c'),selectNotIn(_0x43587e,_0x4764c7,_0x258657,'cm_hopper',[_0x7b89('0x3d'),_0x7b89('0x47')]))[_0x7b89('0x14')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x43587e,_0x4764c7,_0x258657,_0x7b89('0x2e'),['\x22always\x22'])))['toString']();return _0x463aff;}function insertTzCmHopperBlack(_0x141956,_0x549c8f,_0xa35861,_0x39846e){var _0x13a717=['cm_contacts.phone',_0x7b89('0x28'),_0x7b89('0x29'),_0x549c8f+'.'+_0x39846e,_0x7b89('0x2a'),_0x7b89('0x2b')];return squel[_0x7b89('0x2c')]()[_0x7b89('0x2d')]('cm_hopper_black')[_0x7b89('0x2f')]([_0x7b89('0x30'),_0x7b89('0x31'),'ListId',_0x39846e,_0x7b89('0x33'),'updatedAt'],squel[_0x7b89('0xf')]()[_0x7b89('0x36')](_0x13a717)['from'](_0x549c8f)[_0x7b89('0x12')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x549c8f+_0x7b89('0x39'))[_0x7b89('0x12')](_0xa35861,null,_0xa35861+_0x7b89('0x13')+_0x549c8f+'.'+_0x39846e)[_0x7b89('0x14')](_0x549c8f+'.CmListId\x20=\x20?',_0x141956)[_0x7b89('0x14')](_0x7b89('0x3b'),NOW)['where'](_0x7b89('0x3c'),squel[_0x7b89('0xf')]()[_0x7b89('0x10')](_0x7b89('0x30'))[_0x7b89('0x11')](_0x7b89('0x3f'))[_0x7b89('0x14')](_0x7b89('0x40'),_0x141956)[_0x7b89('0x14')](_0x39846e+'\x20=\x20'+_0x549c8f+'.'+_0x39846e)))[_0x7b89('0x3e')]();}function insertCmHopperAdditionalPhones(_0x15af71){var _0x150657=[_0x7b89('0x48'),_0x7b89('0x49'),_0x7b89('0x4a'),_0x7b89('0x4b'),_0x7b89('0x4c')];return squel[_0x7b89('0x2c')]()[_0x7b89('0x2d')]('cm_hopper_additional_phones')[_0x7b89('0x2f')](['CmHopperId','phone',_0x7b89('0x4d'),'createdAt',_0x7b89('0x34')],squel[_0x7b89('0xf')]()[_0x7b89('0x36')](_0x150657)['from']('cm_hopper')[_0x7b89('0x12')](_0x7b89('0x37'),null,_0x7b89('0x4e'))[_0x7b89('0x12')](_0x7b89('0x4f'),null,_0x7b89('0x50'))[_0x7b89('0x14')](_0x7b89('0x51'),_0x15af71)[_0x7b89('0x14')](_0x7b89('0x3b'),NOW))[_0x7b89('0x3e')]();}function insertCmContact(_0x5037b,_0x55dfed,_0xa46ccd,_0x18bf49){var _0x286ada=_[_0x7b89('0x52')](_[_0x7b89('0x53')](_0x18bf49),[_0x7b89('0x32'),'CompanyId',_0x7b89('0x33'),_0x7b89('0x34'),_0x7b89('0x54')]);return squel['insert']()[_0x7b89('0x2d')](_0x7b89('0x37'))[_0x7b89('0x2f')](_0x286ada,squel[_0x7b89('0xf')]()[_0x7b89('0x36')](_0x286ada)['from'](_0x55dfed)[_0x7b89('0x14')]('('+_0xa46ccd[_0x7b89('0x12')](',')+_0x7b89('0x55'),squel[_0x7b89('0xf')]()['fields'](_0xa46ccd)[_0x7b89('0x11')](_0x7b89('0x37'))[_0x7b89('0x14')](_0x7b89('0x40'),_0x5037b)[_0x7b89('0x14')](_0x7b89('0x56')))[_0x7b89('0x14')](_0x7b89('0x57'),squel[_0x7b89('0xf')]()[_0x7b89('0x10')](_0x7b89('0x58'),_0x7b89('0x59'))[_0x7b89('0x11')](_0x55dfed)[_0x7b89('0x5a')](_0xa46ccd[_0x7b89('0x12')](','))))[_0x7b89('0x3e')]();}function handleStop(){logger[_0x7b89('0x5b')](_0x7b89('0x5c'));stopped=!![];}function handleUncaughtException(_0x327c77){logger['error'](_0x327c77['message']);process[_0x7b89('0x5d')](0x1);}function handleError(_0x386bac,_0x277756){stats['errors']['push']({'name':_0x277756['code'],'message':_0x277756[_0x7b89('0x5e')],'row':_0x386bac});}function handleQuery(_0x1bd7d1){logger[_0x7b89('0x5b')](_0x1bd7d1);return db['sequelize'][_0x7b89('0x5f')](_0x1bd7d1)[_0x7b89('0x60')](function(_0x51e196){results[_0x7b89('0x1a')](_0x51e196);})[_0x7b89('0x61')](function(_0x81d41c){logger['error'](_0x81d41c[_0x7b89('0x5e')]);});}function updateTzCampaigns(_0x184664){return new Promise(function(_0x39c5c4,_0x1bd147){var _0x171bbe=squel[_0x7b89('0xf')]()['fields']([_0x7b89('0x62'),'campaigns.dialTimezone'])['from'](_0x7b89('0x63'))[_0x7b89('0x12')](_0x7b89('0x64'),null,'campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId')[_0x7b89('0x14')](_0x7b89('0x65')+_0x184664);db[_0x7b89('0x66')][_0x7b89('0x5f')](_0x171bbe['toString']())[_0x7b89('0x60')](function(_0x55915d){var _0x55404d=[];for(var _0x2db702=0x0;_0x2db702<_0x55915d[_0x7b89('0x1e')];_0x2db702++){_0x55404d['push'](getTimezoneData(_0x55915d[_0x2db702],tmp_campaigns));}BPromise[_0x7b89('0x1b')](_0x55404d)['then'](function(){_0x39c5c4({'val':0x1});});})[_0x7b89('0x61')](function(_0x546f40){logger['error'](_0x546f40[_0x7b89('0x5e')]);_0x39c5c4({'val':0x0});});});}function updateTzVoiceQueues(_0x13250b){return new Promise(function(_0x5a8462,_0x1931d4){var _0x26e1eb=squel[_0x7b89('0xf')]()[_0x7b89('0x36')]([_0x7b89('0x67'),'voice_queues.dialTimezone'])['from'](_0x7b89('0x68'))[_0x7b89('0x12')](_0x7b89('0x69'),null,_0x7b89('0x6a'))[_0x7b89('0x14')](_0x7b89('0x6b')+_0x13250b);db[_0x7b89('0x66')][_0x7b89('0x5f')](_0x26e1eb['toString']())[_0x7b89('0x60')](function(_0x5e8c12){var _0x1a87ac=[];for(var _0x13c718=0x0;_0x13c718<_0x5e8c12['length'];_0x13c718++){_0x1a87ac['push'](getTimezoneData(_0x5e8c12[_0x13c718],tmp_voice_queues));}BPromise[_0x7b89('0x1b')](_0x1a87ac)[_0x7b89('0x19')](function(){_0x5a8462({'val':0x1});});})[_0x7b89('0x61')](function(_0x4f232b){logger[_0x7b89('0x6c')](_0x4f232b[_0x7b89('0x5e')]);_0x5a8462({'val':0x0});});});}function getTimezoneData(_0x3daccb,_0x4c98e7){return new Promise(function(_0xfca8fb,_0x58252f){var _0x271467=shared[_0x7b89('0x6d')];var _0x2d4854=_0x271467[_0x3daccb[_0x7b89('0x6e')]];if(_['isNil'](_0x2d4854)){_0xfca8fb({'ret':0x1});}else{var _0x4b6d29=_0x2d4854[_0x7b89('0x6f')];var _0x1c9578=squel[_0x7b89('0x2c')]()[_0x7b89('0x2d')](_0x4c98e7)['set']('id',_0x3daccb['id'])[_0x7b89('0x70')]('offset',_0x4b6d29)[_0x7b89('0x70')](_0x7b89('0x6e'),_0x3daccb['dialTimezone'])[_0x7b89('0x3e')]();return db[_0x7b89('0x66')][_0x7b89('0x5f')](_0x1c9578)[_0x7b89('0x60')](function(_0xd59d74){_0xfca8fb({'ret':0x1});})[_0x7b89('0x61')](function(_0x103282){logger[_0x7b89('0x6c')](_0x103282[_0x7b89('0x5e')]);_0x58252f({'ret':0x1});});}});}function handleTZQuery(_0xf69d07){logger[_0x7b89('0x5b')](_0xf69d07);return db[_0x7b89('0x66')][_0x7b89('0x5f')](_0xf69d07)[_0x7b89('0x60')](function(_0x504041){})['catch'](function(_0x2a8278){logger['error'](_0x2a8278[_0x7b89('0x5e')]);});}function main(_0x2d0d34,_0x5d71ee,_0x4a6a3f,_0x6572e8){logger[_0x7b89('0x5b')]('main',_0x2d0d34,JSON['stringify'](_0x5d71ee));process[_0x7b89('0x71')](_0x7b89('0x72'));var _0x4a0919=_0x5d71ee['binding'];var _0x4e14e5=_[_0x7b89('0x73')](_0x4a0919);var _0x2075ca=_0x5d71ee[_0x7b89('0x74')];var _0x4958bf=path[_0x7b89('0x12')](config[_0x7b89('0x75')],_0x7b89('0x76'),_0x2075ca+_0x7b89('0x77'));hasTZ=_[_0x7b89('0x53')](_0x4a0919)['includes'](_0x7b89('0x6e'));var _0x3004e6=_[_0x7b89('0x53')](_0x4a0919)[_0x7b89('0x12')]();logger[_0x7b89('0x5b')](_0x7b89('0x78'),_0x3004e6);db['ContactItemType'][_0x7b89('0x18')]({'raw':!![],'attributes':['id',_0x7b89('0x79')]})[_0x7b89('0x19')](function(_0x4f0d44){for(var _0x5a2929=0x0;_0x5a2929<_0x4f0d44[_0x7b89('0x1e')];_0x5a2929++){if(_0x4f0d44[_0x5a2929][_0x7b89('0x79')]in _0x4a0919){contactItemTypes[_0x7b89('0x1a')](_0x4f0d44[_0x5a2929]);delete _0x4e14e5[_0x4f0d44[_0x5a2929][_0x7b89('0x79')]];hasAdditionalPhones=!![];}for(var _0x250e13 in _0x4a0919){if(_0x4f0d44[_0x5a2929]['name']+_0x7b89('0x7a')===_0x250e13){phoneDescriptions[_0x7b89('0x1a')]({'itemTypeId':_0x4f0d44[_0x5a2929]['id'],'description':_0x250e13});delete _0x4e14e5[_0x250e13];}}}if(hasAdditionalPhones)_0x4e14e5[_0x7b89('0x1c')]='';var _0x488fb7=_['keys'](_0x4e14e5)[_0x7b89('0x12')]();logger[_0x7b89('0x5b')](_0x7b89('0x78'),_0x488fb7);fs[_0x7b89('0x7b')](_0x4958bf,_0x488fb7+'\x0a');Papa[_0x7b89('0x7c')](fs[_0x7b89('0x7d')](_0x2d0d34),{'header':!![],'skipEmptyLines':!![],'step':function(_0x1bc676,_0x4d4c72){try{for(var _0x478b27=0x0,_0x16bc95=[];_0x478b27<_0x1bc676[_0x7b89('0x7e')][_0x7b89('0x1e')];_0x478b27++){stats[_0x7b89('0x7f')]+=0x1;if(_0x1bc676[_0x7b89('0x80')][_0x478b27]){handleError(_0x1bc676[_0x7b89('0x7e')][_0x478b27],_0x1bc676[_0x7b89('0x80')][_0x478b27]);}else{var _0x4b612b=[];var _0x162702=[];var _0x475a83={};for(var _0x3c20fe in _0x4a0919){let _0x2e2963=contactItemTypes[_0x7b89('0x81')](_0x510491=>_0x510491[_0x7b89('0x79')]===_0x3c20fe);let _0x3b6bc2=contactItemTypes[_0x7b89('0x81')](_0x3fe630=>_0x3fe630[_0x7b89('0x79')]+_0x7b89('0x7a')===_0x3c20fe);if(_[_0x7b89('0x82')](_0x2e2963)&&_['isNil'](_0x3b6bc2)){if(_0x4a0919[_0x7b89('0x83')](_0x3c20fe)){if(_0x1bc676[_0x7b89('0x7e')][_0x478b27][_0x4a0919[_0x3c20fe]]){var _0x4710c7=_[_0x7b89('0x84')](_0x1bc676[_0x7b89('0x7e')][_0x478b27][_0x4a0919[_0x3c20fe]][_0x7b89('0x85')](/"/g,'\x27'));switch(_0x3c20fe){case'scheduledat':var _0x20bcd8=moment(_0x4710c7,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x20bcd8['isValid']()){_0x16bc95['push']('\x22'+_0x4710c7+'\x22');}else{_0x4b612b[_0x7b89('0x1a')](_0x7b89('0x86'));}break;case _0x7b89('0x87'):var _0x148c68=parseInt(_0x4710c7);_0x4710c7=_['isNaN'](_0x148c68)||_0x148c68<0x0||_0x148c68>0x4?_0x6572e8?0x3:0x2:_0x148c68;_0x16bc95['push']('\x22'+_0x4710c7+'\x22');break;case'UserId':var _0x5993ad=parseInt(_0x4710c7);if(_[_0x7b89('0x88')](_0x5993ad)&&_[_0x7b89('0x89')](_0x4a6a3f,_0x5993ad)){_0x16bc95[_0x7b89('0x1a')]('\x22'+_0x5993ad+'\x22');}else{_0x4b612b['push'](_0x7b89('0x8a'));}break;case _0x7b89('0x8b'):if(isEmail(_0x4710c7)){_0x16bc95[_0x7b89('0x1a')]('\x22'+_0x4710c7+'\x22');}else{_0x4b612b[_0x7b89('0x1a')](_0x7b89('0x8c'));}break;case _0x7b89('0x8d'):var _0x554e21=moment(_0x4710c7,_0x7b89('0x8e'),!![]);if(_0x554e21[_0x7b89('0x8f')]()){_0x16bc95[_0x7b89('0x1a')]('\x22'+_0x4710c7+'\x22');}else{_0x4b612b[_0x7b89('0x1a')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;case _0x7b89('0x6e'):var _0x3f81ee=shared[_0x7b89('0x6d')];var _0x30c3f1=_0x3f81ee[_0x4710c7];if(!_[_0x7b89('0x82')](_0x30c3f1)){var _0x8b5d86=_0x30c3f1[_0x7b89('0x6f')];_0x16bc95[_0x7b89('0x1a')]('\x22'+_0x4710c7+'\x22');_0x16bc95[_0x7b89('0x1a')]('\x22'+_0x8b5d86+'\x22');}break;default:_0x16bc95[_0x7b89('0x1a')]('\x22'+_0x4710c7+'\x22');}}else{switch(_0x3c20fe){case _0x7b89('0x90'):case _0x7b89('0x30'):_0x4b612b[_0x7b89('0x1a')](_0x3c20fe+_0x7b89('0x91'));break;default:_0x16bc95[_0x7b89('0x1a')]('\x22\x22');}}}}else{var _0x53fab1='';if(!_[_0x7b89('0x82')](_0x2e2963)){if(!_0x475a83[_0x7b89('0x83')](_0x2e2963['id'])){if(!_['isNil'](_0x1bc676[_0x7b89('0x7e')][_0x478b27][_0x4a0919[_0x3c20fe]])){var _0x4710c7=_[_0x7b89('0x84')](_0x1bc676['data'][_0x478b27][_0x4a0919[_0x3c20fe]][_0x7b89('0x85')](/"/g,'\x27'));var _0x46747c=phoneDescriptions[_0x7b89('0x81')](_0x452319=>_0x452319[_0x7b89('0x92')]===_0x2e2963['id']);if(!_[_0x7b89('0x82')](_0x46747c)){var _0x57def1=_['trim'](_0x1bc676['data'][_0x478b27][_0x4a0919[_0x46747c['description']]][_0x7b89('0x85')](/"/g,'\x27'));if(!_['isNil'](_0x57def1))_0x4710c7=_0x4710c7+'§'+_0x57def1;}if(_0x53fab1=='')_0x53fab1=_0x4710c7;else _0x53fab1+='|'+_0x4710c7;}_0x162702[_0x7b89('0x1a')](_0x2e2963['id']+':'+_0x53fab1);_0x475a83[_0x2e2963['id']]=0x1;}}}}if(hasAdditionalPhones){_0x16bc95[_0x7b89('0x1a')]('\x22'+_0x162702['join'](';')+'\x22');}if(_0x4b612b['length']){handleError(_0x1bc676[_0x7b89('0x7e')][_0x478b27],{'code':_0x7b89('0x93'),'message':_0x4b612b[_0x7b89('0x12')]()});}else{fs[_0x7b89('0x94')](_0x4958bf,_0x16bc95['join']()+'\x0a');}_0x16bc95=[];}if(!(stats[_0x7b89('0x7f')]%0xc8)){socket[_0x7b89('0x95')](_0x7b89('0x96')+_0x2075ca,stats);stats[_0x7b89('0x80')]=[];}}if(stopped){logger[_0x7b89('0x5b')](_0x7b89('0x97'));_0x4d4c72[_0x7b89('0x98')]();}}catch(_0x42bdb8){handleError(_0x1bc676[_0x7b89('0x7e')][_0x478b27],{'code':_0x7b89('0x99'),'message':_0x42bdb8[_0x7b89('0x5e')]});logger[_0x7b89('0x6c')](_0x7b89('0x9a'),_0x42bdb8[_0x7b89('0x5e')]);}},'complete':function(){try{var _0x2892d5=[];var _0x168f13=[];var _0x48cbd9=_0x7b89('0x37');if(_0x5d71ee[_0x7b89('0x9b')]&&_0x5d71ee[_0x7b89('0x9b')][_0x7b89('0x1e')]){_0x48cbd9=_0x7b89('0x9c')+_0x2075ca;_0x2892d5['push'](_0x7b89('0x9d')+_0x48cbd9+_0x7b89('0x9e'));}tmp_campaigns=_0x7b89('0x9f')+_0x2075ca;tmp_voice_queues='voice_queues_'+_0x2075ca;_0x168f13[_0x7b89('0x1a')]('CREATE\x20TABLE\x20'+tmp_campaigns+_0x7b89('0xa0'));_0x168f13[_0x7b89('0x1a')](_0x7b89('0x9d')+tmp_voice_queues+_0x7b89('0xa0'));BPromise[_0x7b89('0xa1')](_0x168f13,handleTZQuery)[_0x7b89('0x19')](function(_0x1a1920){updateTzCampaigns(_0x5d71ee['ListId'])[_0x7b89('0x19')](function(_0x50f1f6){updateTzVoiceQueues(_0x5d71ee[_0x7b89('0x32')])[_0x7b89('0x19')](function(_0x2786e2){if(hasTZ)_0x488fb7=_0x488fb7[_0x7b89('0x85')](_0x7b89('0x6e'),'dialTimezone,utcOffset');var _0x31e400=util[_0x7b89('0xc')]('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',_0x4958bf,_0x48cbd9,_0x488fb7,_0x5d71ee[_0x7b89('0x32')],_0x5d71ee[_0x7b89('0xa2')]||null,NOW,NOW);if(_[_0x7b89('0x82')](_0x4a0919[_0x7b89('0x45')])){_0x31e400+=_0x7b89('0xa3');}_0x2892d5[_0x7b89('0x1a')](_0x31e400);if(_0x5d71ee[_0x7b89('0x9b')]&&_0x5d71ee['duplicates'][_0x7b89('0x1e')]){_0x2892d5[_0x7b89('0x1a')](insertCmContact(_0x5d71ee[_0x7b89('0x32')],_0x48cbd9,_0x5d71ee[_0x7b89('0x9b')],_0x4a0919));_0x2892d5['push'](_0x7b89('0xa4')+_0x48cbd9+';');}BPromise[_0x7b89('0xa1')](_0x2892d5,handleQuery)[_0x7b89('0x19')](function(_0x5ce213){BPromise[_0x7b89('0x1b')]([handleAdditionalPhones()])[_0x7b89('0x19')](function(){_0x2892d5=[];for(var _0x58636e=0x0;_0x58636e\x20\x20','existsSync','file\x20doesn\x27t\x20exists','parse','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','papaparse','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment/shared','../../../config/logger','import','redis','defaults','format','YYYY-MM-DD\x20HH:mm:ss','test','select','phone','from','join','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','CmContact','findAll','AdditionalPhones','then','length','push','split','isNil','filter','CmContactHasItem','findOne','update','updated','create','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','into','cm_hopper','fromQuery','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_hopper_black','\x20=\x20','.offset-cm_contacts.utcOffset\x20minute)','insert','scheduledat','ListId\x20=\x20?','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','CmHopperId','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_hopper.ListId\x20=\x20?','concat','keys','scheduledAt',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','group','info','Received\x20SIGINT','error','message','exit','errors','code','sequelize','campaigns.id','campaigns.dialTimezone','campaigns_has_cm_lists','campaigns_has_cm_lists.CmListId=','query','all','catch','voice_queues.id','spread','timezones','dialTimezone','set','offset','stringify','send','start','binding','clone','socket_timestamp','root'];(function(_0x16c467,_0x53d6fa){var _0x22db4f=function(_0x498d3f){while(--_0x498d3f){_0x16c467['push'](_0x16c467['shift']());}};_0x22db4f(++_0x53d6fa);}(_0xe0cf,0x1b5));var _0xfe0c=function(_0x4d9bb2,_0x3db50d){_0x4d9bb2=_0x4d9bb2-0x0;var _0x3179fe=_0xe0cf[_0x4d9bb2];return _0x3179fe;};'use strict';var fs=require('fs');var path=require(_0xfe0c('0x0'));var _=require('lodash');var Papa=require(_0xfe0c('0x1'));var util=require(_0xfe0c('0x2'));var BPromise=require(_0xfe0c('0x3'));var moment=require(_0xfe0c('0x4'));var squel=require(_0xfe0c('0x5'));var Redis=require(_0xfe0c('0x6'));var db=require(_0xfe0c('0x7'))['db'];var config=require('../../../config/environment');var shared=require(_0xfe0c('0x8'));var logger=require(_0xfe0c('0x9'))(_0xfe0c('0xa'));config[_0xfe0c('0xb')]=_[_0xfe0c('0xc')](config[_0xfe0c('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfe0c('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0xfe0c('0xd')](_0xfe0c('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0xfe0c('0xd')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x21de1e){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))*$/[_0xfe0c('0xf')](_0x21de1e);}function selectNotIn(_0x56f079,_0x3babc0,_0x4d7e1e,_0x370a9b,_0x14074a){return squel[_0xfe0c('0x10')]()['field'](_0xfe0c('0x11'))[_0xfe0c('0x12')](_0x370a9b)[_0xfe0c('0x13')](_0x3babc0,null,_0x3babc0+_0xfe0c('0x14')+_0x370a9b+'.'+_0x4d7e1e)[_0xfe0c('0x15')](_0x370a9b+'.'+_0x4d7e1e+'\x20=\x20'+_0x56f079+'.'+_0x4d7e1e)[_0xfe0c('0x15')](_0x3babc0+_0xfe0c('0x16')+_0x14074a[_0xfe0c('0x13')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0xc154df,_0x2b4687){promisesAdditionalPhones=[];return db[_0xfe0c('0x17')][_0xfe0c('0x18')]({'raw':!![],'attributes':['id',_0xfe0c('0x19')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0xfe0c('0x1a')](function(_0xf95c4b){if(_0xf95c4b!==null){var _0x5e42eb=[];for(var _0xa6715f=0x0;_0xa6715f<_0xf95c4b[_0xfe0c('0x1b')];_0xa6715f++){var _0x2c2ddb=_0xf95c4b[_0xa6715f];_0x5e42eb[_0xfe0c('0x1c')](insertAdditionalPhones(_0x2c2ddb));}}Promise['all'](_0x5e42eb)[_0xfe0c('0x1a')](function(){_0xc154df({'val':0x1});});});});}function insertAdditionalPhones(_0x4bfa95){return new Promise(function(_0x1e74ba,_0x2e1298){var _0x57573d=_0x4bfa95[_0xfe0c('0x19')];var _0x233c50=_0x57573d[_0xfe0c('0x1d')](';');var _0x2430e8=[];orderBy=0x0;for(var _0x1efaa6=0x0;_0x1efaa6<_0x233c50[_0xfe0c('0x1b')];_0x1efaa6++){_0x2430e8['push'](splitAdditionalPhone(_0x4bfa95['id'],_0x233c50[_0x1efaa6]));}Promise['all'](_0x2430e8)['then'](function(){_0x1e74ba({'val':_0x233c50[_0xfe0c('0x1b')]});});});}function splitAdditionalPhone(_0x1830cf,_0xa320ca){return new Promise(function(_0x2fd105,_0x342649){var _0x3465a4=_0xa320ca['split'](':');var _0x4444af=_0x3465a4[0x0];var _0x30b182=_0x3465a4[0x1];if(!_[_0xfe0c('0x1e')](_0x30b182)){var _0x1615c0=_0x30b182[_0xfe0c('0x1d')]('|');var _0x54c2e3=[];for(var _0x38c3c2=0x0;_0x38c3c2<_0x1615c0[_0xfe0c('0x1b')];_0x38c3c2++){if(_0x1615c0[_0x38c3c2]!==''){var _0x4b91e6=_[_0xfe0c('0x1f')](promisesAdditionalPhones,{'contactId':_0x1830cf,'phone':_0x1615c0[_0x38c3c2]});if(_0x4b91e6['length']==0x0){orderBy++;promisesAdditionalPhones[_0xfe0c('0x1c')]({'contactId':_0x1830cf,'contactTypeId':_0x4444af,'phone':_0x1615c0[_0x38c3c2],'orderBy':orderBy});}}}_0x2fd105({'ok':0x1});}else _0x2fd105({'res':0x0});});}function createAdditionalPhone(_0x3d5325,_0x7f8b8,_0x26f58e,_0x23fae1){var _0x206232='';var _0x18398b='';var _0x3e1ace=_0x26f58e[_0xfe0c('0x1d')]('§');_0x206232=_0x3e1ace[0x0];if(_0x3e1ace[_0xfe0c('0x1b')]==0x2)_0x18398b=_0x3e1ace[0x1];return new Promise(function(_0x22c074,_0x3d52de){return db[_0xfe0c('0x20')][_0xfe0c('0x21')]({'where':{'CmContactId':_0x3d5325,'item':_0x206232}})['then'](function(_0x1b6163){if(_0x1b6163){return db[_0xfe0c('0x20')][_0xfe0c('0x22')]({'ItemTypeId':_0x7f8b8,'description':_0x18398b,'OrderBy':_0x23fae1},{'where':{'CmContactId':_0x3d5325,'item':_0x206232}})[_0xfe0c('0x1a')](function(_0x1f781a){_0x22c074({'res':_0xfe0c('0x23')});});}else{return db[_0xfe0c('0x20')][_0xfe0c('0x24')]({'CmContactId':_0x3d5325,'item':_0x206232,'description':_0x18398b,'ItemTypeId':_0x7f8b8,'OrderBy':_0x23fae1,'ItemClass':'PHONE'})[_0xfe0c('0x1a')](function(_0x308c37){_0x22c074({'res':_0xfe0c('0x25')});});}});});}function insertCmHopper(_0x3f993d,_0xf9d3bf,_0x153db7,_0x5876fc,_0x48ee1c){var _0x4e1476=[_0xfe0c('0x26'),_0xfe0c('0x27'),_0xfe0c('0x28'),_0xfe0c('0x29'),_0xf9d3bf+'.'+_0x5876fc,_0xfe0c('0x2a'),_0xfe0c('0x2b'),_0xfe0c('0x2c'),_0xfe0c('0x2d'),'\x22'+_0x48ee1c+'\x22'];return squel['insert']()[_0xfe0c('0x2e')](_0xfe0c('0x2f'))[_0xfe0c('0x30')]([_0xfe0c('0x11'),'scheduledat',_0xfe0c('0x31'),_0xfe0c('0x32'),_0x5876fc,_0xfe0c('0x33'),_0xfe0c('0x34'),_0xfe0c('0x35'),_0xfe0c('0x36'),_0xfe0c('0x37')],squel['select']()[_0xfe0c('0x38')](_0x4e1476)[_0xfe0c('0x12')](_0xf9d3bf)[_0xfe0c('0x13')](_0xfe0c('0x39'),null,_0xfe0c('0x3a')+_0xf9d3bf+_0xfe0c('0x3b'))[_0xfe0c('0x13')](_0x153db7,null,_0x153db7+'.id\x20=\x20'+_0xf9d3bf+'.'+_0x5876fc)[_0xfe0c('0x15')](_0xf9d3bf+_0xfe0c('0x3c'),_0x3f993d)[_0xfe0c('0x15')](_0xfe0c('0x3d'),NOW)[_0xfe0c('0x15')](_0xfe0c('0x3e'),selectNotIn(_0xf9d3bf,_0x153db7,_0x5876fc,'cm_hopper',[_0xfe0c('0x3f'),_0xfe0c('0x40')]))[_0xfe0c('0x15')](_0xfe0c('0x3e'),selectNotIn(_0xf9d3bf,_0x153db7,_0x5876fc,_0xfe0c('0x2f'),[_0xfe0c('0x3f')])))[_0xfe0c('0x41')]();}function insertCmHopperBlack(_0x40e491,_0x44829d,_0x252e96,_0x27f307){var _0x1ac9f6=[_0xfe0c('0x26'),_0xfe0c('0x28'),_0xfe0c('0x29'),_0x44829d+'.'+_0x27f307,_0xfe0c('0x2a'),_0xfe0c('0x2b')];return squel['insert']()[_0xfe0c('0x2e')](_0xfe0c('0x42'))[_0xfe0c('0x30')]([_0xfe0c('0x11'),'ContactId',_0xfe0c('0x32'),_0x27f307,_0xfe0c('0x33'),'updatedAt'],squel['select']()[_0xfe0c('0x38')](_0x1ac9f6)['from'](_0x44829d)[_0xfe0c('0x13')](_0xfe0c('0x39'),null,'cm_contacts.ListId\x20=\x20'+_0x44829d+_0xfe0c('0x3b'))['join'](_0x252e96,null,_0x252e96+'.id\x20=\x20'+_0x44829d+'.'+_0x27f307)[_0xfe0c('0x15')](_0x44829d+'.CmListId\x20=\x20?',_0x40e491)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0xfe0c('0x15')](_0xfe0c('0x3e'),squel[_0xfe0c('0x10')]()['field'](_0xfe0c('0x11'))['from'](_0xfe0c('0x42'))[_0xfe0c('0x15')]('ListId\x20=\x20?',_0x40e491)[_0xfe0c('0x15')](_0x27f307+_0xfe0c('0x43')+_0x44829d+'.'+_0x27f307)))[_0xfe0c('0x41')]();}function insertTzCmHopper(_0x4404d6,_0x18abd9,_0x2a4e14,_0x16e62c,_0x23071b,_0x3a1908){var _0x9c2b0c=[_0xfe0c('0x26'),'date_add(cm_contacts.scheduledat,interval\x20'+_0x3a1908+_0xfe0c('0x44'),'cm_contacts.id','cm_contacts.ListId',_0x18abd9+'.'+_0x16e62c,_0xfe0c('0x2a'),_0xfe0c('0x2b'),_0xfe0c('0x2c'),_0xfe0c('0x2d'),'\x22'+_0x23071b+'\x22'];var _0x1b25ea=squel[_0xfe0c('0x45')]()['into']('cm_hopper')[_0xfe0c('0x30')]([_0xfe0c('0x11'),_0xfe0c('0x46'),_0xfe0c('0x31'),_0xfe0c('0x32'),_0x16e62c,_0xfe0c('0x33'),_0xfe0c('0x34'),_0xfe0c('0x35'),_0xfe0c('0x36'),_0xfe0c('0x37')],squel[_0xfe0c('0x10')]()['fields'](_0x9c2b0c)[_0xfe0c('0x12')](_0x18abd9)[_0xfe0c('0x13')](_0xfe0c('0x39'),null,_0xfe0c('0x3a')+_0x18abd9+'.CmListId')[_0xfe0c('0x13')](_0x2a4e14,null,_0x2a4e14+'.id\x20=\x20'+_0x18abd9+'.'+_0x16e62c)[_0xfe0c('0x13')](_0x3a1908,null,_0x3a1908+'.id\x20=\x20'+_0x18abd9+'.'+_0x16e62c)[_0xfe0c('0x15')](_0x18abd9+_0xfe0c('0x3c'),_0x4404d6)['where']('cm_contacts.createdAt\x20=\x20?',NOW)['where'](_0xfe0c('0x3e'),selectNotIn(_0x18abd9,_0x2a4e14,_0x16e62c,_0xfe0c('0x2f'),[_0xfe0c('0x3f'),_0xfe0c('0x40')]))[_0xfe0c('0x15')](_0xfe0c('0x3e'),selectNotIn(_0x18abd9,_0x2a4e14,_0x16e62c,'cm_hopper',[_0xfe0c('0x3f')])))[_0xfe0c('0x41')]();return _0x1b25ea;}function insertTzCmHopperBlack(_0x3aea08,_0x1e0175,_0xf72c37,_0x849944){var _0x312473=[_0xfe0c('0x26'),'cm_contacts.id',_0xfe0c('0x29'),_0x1e0175+'.'+_0x849944,_0xfe0c('0x2a'),_0xfe0c('0x2b')];return squel[_0xfe0c('0x45')]()[_0xfe0c('0x2e')](_0xfe0c('0x42'))[_0xfe0c('0x30')]([_0xfe0c('0x11'),_0xfe0c('0x31'),_0xfe0c('0x32'),_0x849944,_0xfe0c('0x33'),'updatedAt'],squel[_0xfe0c('0x10')]()[_0xfe0c('0x38')](_0x312473)[_0xfe0c('0x12')](_0x1e0175)[_0xfe0c('0x13')](_0xfe0c('0x39'),null,'cm_contacts.ListId\x20=\x20'+_0x1e0175+_0xfe0c('0x3b'))[_0xfe0c('0x13')](_0xf72c37,null,_0xf72c37+_0xfe0c('0x14')+_0x1e0175+'.'+_0x849944)['where'](_0x1e0175+'.CmListId\x20=\x20?',_0x3aea08)[_0xfe0c('0x15')](_0xfe0c('0x3d'),NOW)['where'](_0xfe0c('0x3e'),squel[_0xfe0c('0x10')]()['field']('phone')[_0xfe0c('0x12')]('cm_hopper_black')[_0xfe0c('0x15')](_0xfe0c('0x47'),_0x3aea08)['where'](_0x849944+_0xfe0c('0x43')+_0x1e0175+'.'+_0x849944)))[_0xfe0c('0x41')]();}function insertCmHopperAdditionalPhones(_0x24c77c){var _0x1c6e10=['cm_hopper.id',_0xfe0c('0x48'),_0xfe0c('0x49'),_0xfe0c('0x4a'),_0xfe0c('0x4b')];return squel[_0xfe0c('0x45')]()[_0xfe0c('0x2e')]('cm_hopper_additional_phones')[_0xfe0c('0x30')]([_0xfe0c('0x4c'),_0xfe0c('0x11'),'OrderBy',_0xfe0c('0x33'),_0xfe0c('0x34')],squel[_0xfe0c('0x10')]()[_0xfe0c('0x38')](_0x1c6e10)[_0xfe0c('0x12')](_0xfe0c('0x2f'))[_0xfe0c('0x13')]('cm_contacts',null,_0xfe0c('0x4d'))[_0xfe0c('0x13')]('cm_contact_has_items',null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0xfe0c('0x15')](_0xfe0c('0x4e'),_0x24c77c)[_0xfe0c('0x15')](_0xfe0c('0x3d'),NOW))[_0xfe0c('0x41')]();}function insertCmContact(_0x4663af,_0x5744a4,_0x1334a7,_0x2f27f0){var _0x440d7a=_[_0xfe0c('0x4f')](_[_0xfe0c('0x50')](_0x2f27f0),[_0xfe0c('0x32'),'CompanyId',_0xfe0c('0x33'),_0xfe0c('0x34'),_0xfe0c('0x51')]);return squel['insert']()[_0xfe0c('0x2e')](_0xfe0c('0x39'))[_0xfe0c('0x30')](_0x440d7a,squel[_0xfe0c('0x10')]()[_0xfe0c('0x38')](_0x440d7a)[_0xfe0c('0x12')](_0x5744a4)[_0xfe0c('0x15')]('('+_0x1334a7['join'](',')+_0xfe0c('0x52'),squel['select']()[_0xfe0c('0x38')](_0x1334a7)[_0xfe0c('0x12')](_0xfe0c('0x39'))[_0xfe0c('0x15')](_0xfe0c('0x47'),_0x4663af)[_0xfe0c('0x15')](_0xfe0c('0x53')))[_0xfe0c('0x15')](_0xfe0c('0x54'),squel['select']()['field'](_0xfe0c('0x55'),'min_id')[_0xfe0c('0x12')](_0x5744a4)[_0xfe0c('0x56')](_0x1334a7[_0xfe0c('0x13')](','))))[_0xfe0c('0x41')]();}function handleStop(){logger[_0xfe0c('0x57')](_0xfe0c('0x58'));stopped=!![];}function handleUncaughtException(_0x3fe3aa){logger[_0xfe0c('0x59')](_0x3fe3aa[_0xfe0c('0x5a')]);process[_0xfe0c('0x5b')](0x1);}function handleError(_0x5409e5,_0x38a528){stats[_0xfe0c('0x5c')]['push']({'name':_0x38a528[_0xfe0c('0x5d')],'message':_0x38a528[_0xfe0c('0x5a')],'row':_0x5409e5});}function handleQuery(_0x413dd5){logger['info'](_0x413dd5);return db[_0xfe0c('0x5e')]['query'](_0x413dd5)['spread'](function(_0x3ccdbc){results[_0xfe0c('0x1c')](_0x3ccdbc);})['catch'](function(_0x544d68){logger[_0xfe0c('0x59')](_0x544d68['message']);});}function updateTzCampaigns(_0xb8b88f){return new Promise(function(_0x945ecf,_0x2bdb55){var _0x526622=squel[_0xfe0c('0x10')]()[_0xfe0c('0x38')]([_0xfe0c('0x5f'),_0xfe0c('0x60')])[_0xfe0c('0x12')]('campaigns')[_0xfe0c('0x13')](_0xfe0c('0x61'),null,'campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId')[_0xfe0c('0x15')](_0xfe0c('0x62')+_0xb8b88f);db[_0xfe0c('0x5e')][_0xfe0c('0x63')](_0x526622[_0xfe0c('0x41')]())['spread'](function(_0x290b97){var _0x2488b=[];for(var _0x81549=0x0;_0x81549<_0x290b97[_0xfe0c('0x1b')];_0x81549++){_0x2488b[_0xfe0c('0x1c')](getTimezoneData(_0x290b97[_0x81549],tmp_campaigns));}BPromise[_0xfe0c('0x64')](_0x2488b)[_0xfe0c('0x1a')](function(){_0x945ecf({'val':0x1});});})[_0xfe0c('0x65')](function(_0x4e92f2){logger[_0xfe0c('0x59')](_0x4e92f2[_0xfe0c('0x5a')]);_0x945ecf({'val':0x0});});});}function updateTzVoiceQueues(_0x349451){return new Promise(function(_0x2fdab1,_0x589aad){var _0x1953ca=squel[_0xfe0c('0x10')]()[_0xfe0c('0x38')]([_0xfe0c('0x66'),'voice_queues.dialTimezone'])['from']('voice_queues')[_0xfe0c('0x13')]('voice_queues_has_cm_lists',null,'voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId')['where']('voice_queues_has_cm_lists.CmListId='+_0x349451);db[_0xfe0c('0x5e')][_0xfe0c('0x63')](_0x1953ca[_0xfe0c('0x41')]())[_0xfe0c('0x67')](function(_0x2166f1){var _0x3c8fec=[];for(var _0x473a24=0x0;_0x473a24<_0x2166f1[_0xfe0c('0x1b')];_0x473a24++){_0x3c8fec['push'](getTimezoneData(_0x2166f1[_0x473a24],tmp_voice_queues));}BPromise['all'](_0x3c8fec)[_0xfe0c('0x1a')](function(){_0x2fdab1({'val':0x1});});})[_0xfe0c('0x65')](function(_0x5b3027){logger[_0xfe0c('0x59')](_0x5b3027[_0xfe0c('0x5a')]);_0x2fdab1({'val':0x0});});});}function getTimezoneData(_0x21c53e,_0xca697){return new Promise(function(_0x31250d,_0x2892d3){var _0x8640da=shared[_0xfe0c('0x68')];var _0x692dea=_0x8640da[_0x21c53e[_0xfe0c('0x69')]];if(_[_0xfe0c('0x1e')](_0x692dea)){_0x31250d({'ret':0x1});}else{var _0x24f23c=_0x692dea['utcOffset'];var _0x41b02d=squel[_0xfe0c('0x45')]()[_0xfe0c('0x2e')](_0xca697)[_0xfe0c('0x6a')]('id',_0x21c53e['id'])[_0xfe0c('0x6a')](_0xfe0c('0x6b'),_0x24f23c)['set'](_0xfe0c('0x69'),_0x21c53e[_0xfe0c('0x69')])[_0xfe0c('0x41')]();return db[_0xfe0c('0x5e')][_0xfe0c('0x63')](_0x41b02d)[_0xfe0c('0x67')](function(_0x55a2a0){_0x31250d({'ret':0x1});})[_0xfe0c('0x65')](function(_0x1470a5){logger[_0xfe0c('0x59')](_0x1470a5[_0xfe0c('0x5a')]);_0x2892d3({'ret':0x1});});}});}function handleTZQuery(_0x57f895){logger[_0xfe0c('0x57')](_0x57f895);return db[_0xfe0c('0x5e')]['query'](_0x57f895)[_0xfe0c('0x67')](function(_0x5f2c66){})[_0xfe0c('0x65')](function(_0x5a4dee){logger[_0xfe0c('0x59')](_0x5a4dee[_0xfe0c('0x5a')]);});}function main(_0x20c18f,_0x34a971,_0x3c85d4,_0x5f1ab7){logger[_0xfe0c('0x57')]('main',_0x20c18f,JSON[_0xfe0c('0x6c')](_0x34a971));process[_0xfe0c('0x6d')](_0xfe0c('0x6e'));var _0x6a47e9=_0x34a971[_0xfe0c('0x6f')];var _0xb826b0=_[_0xfe0c('0x70')](_0x6a47e9);var _0x43fdc9=_0x34a971[_0xfe0c('0x71')];var _0x3c61a7=path[_0xfe0c('0x13')](config[_0xfe0c('0x72')],_0xfe0c('0x73'),_0x43fdc9+_0xfe0c('0x74'));hasTZ=_[_0xfe0c('0x50')](_0x6a47e9)[_0xfe0c('0x75')]('dialTimezone');var _0x550de9=_[_0xfe0c('0x50')](_0x6a47e9)[_0xfe0c('0x13')]();logger[_0xfe0c('0x57')](_0xfe0c('0x76'),_0x550de9);db[_0xfe0c('0x77')]['findAll']({'raw':!![],'attributes':['id',_0xfe0c('0x78')]})['then'](function(_0x161acc){for(var _0x5060bd=0x0;_0x5060bd<_0x161acc['length'];_0x5060bd++){if(_0x161acc[_0x5060bd][_0xfe0c('0x78')]in _0x6a47e9){contactItemTypes[_0xfe0c('0x1c')](_0x161acc[_0x5060bd]);delete _0xb826b0[_0x161acc[_0x5060bd][_0xfe0c('0x78')]];hasAdditionalPhones=!![];}for(var _0x15183a in _0x6a47e9){if(_0x161acc[_0x5060bd][_0xfe0c('0x78')]+_0xfe0c('0x79')===_0x15183a){phoneDescriptions[_0xfe0c('0x1c')]({'itemTypeId':_0x161acc[_0x5060bd]['id'],'description':_0x15183a});delete _0xb826b0[_0x15183a];}}}if(hasAdditionalPhones)_0xb826b0[_0xfe0c('0x19')]='';var _0x54375c=_[_0xfe0c('0x50')](_0xb826b0)['join']();logger[_0xfe0c('0x57')](_0xfe0c('0x76'),_0x54375c);fs[_0xfe0c('0x7a')](_0x3c61a7,_0x54375c+'\x0a');Papa['parse'](fs[_0xfe0c('0x7b')](_0x20c18f),{'header':!![],'skipEmptyLines':!![],'step':function(_0x1b8e1b,_0x342889){try{for(var _0x30caa6=0x0,_0x53ad00=[];_0x30caa6<_0x1b8e1b[_0xfe0c('0x7c')][_0xfe0c('0x1b')];_0x30caa6++){stats[_0xfe0c('0x7d')]+=0x1;if(_0x1b8e1b[_0xfe0c('0x5c')][_0x30caa6]){handleError(_0x1b8e1b[_0xfe0c('0x7c')][_0x30caa6],_0x1b8e1b['errors'][_0x30caa6]);}else{var _0x2e932d=[];var _0x1127e6=[];var _0x337150={};for(var _0x212524 in _0x6a47e9){let _0x49f860=contactItemTypes[_0xfe0c('0x7e')](_0x3882e4=>_0x3882e4[_0xfe0c('0x78')]===_0x212524);let _0x42d4c5=contactItemTypes[_0xfe0c('0x7e')](_0x3327e0=>_0x3327e0[_0xfe0c('0x78')]+_0xfe0c('0x79')===_0x212524);if(_['isNil'](_0x49f860)&&_[_0xfe0c('0x1e')](_0x42d4c5)){if(_0x6a47e9[_0xfe0c('0x7f')](_0x212524)){if(_0x1b8e1b[_0xfe0c('0x7c')][_0x30caa6][_0x6a47e9[_0x212524]]){var _0x5c3d97=_[_0xfe0c('0x80')](_0x1b8e1b[_0xfe0c('0x7c')][_0x30caa6][_0x6a47e9[_0x212524]][_0xfe0c('0x81')](/"/g,'\x27'));switch(_0x212524){case _0xfe0c('0x46'):var _0xcbdeb6=moment(_0x5c3d97,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0xcbdeb6[_0xfe0c('0x82')]()){_0x53ad00[_0xfe0c('0x1c')]('\x22'+_0x5c3d97+'\x22');}else{_0x2e932d['push'](_0xfe0c('0x83'));}break;case _0xfe0c('0x35'):var _0x584624=parseInt(_0x5c3d97);_0x5c3d97=_[_0xfe0c('0x84')](_0x584624)||_0x584624<0x0||_0x584624>0x4?_0x5f1ab7?0x3:0x2:_0x584624;_0x53ad00['push']('\x22'+_0x5c3d97+'\x22');break;case _0xfe0c('0x36'):var _0x4d3d36=parseInt(_0x5c3d97);if(_['isNumber'](_0x4d3d36)&&_[_0xfe0c('0x75')](_0x3c85d4,_0x4d3d36)){_0x53ad00[_0xfe0c('0x1c')]('\x22'+_0x4d3d36+'\x22');}else{_0x2e932d[_0xfe0c('0x1c')](_0xfe0c('0x85'));}break;case _0xfe0c('0x86'):if(isEmail(_0x5c3d97)){_0x53ad00['push']('\x22'+_0x5c3d97+'\x22');}else{_0x2e932d[_0xfe0c('0x1c')](_0xfe0c('0x87'));}break;case _0xfe0c('0x88'):var _0x156692=moment(_0x5c3d97,_0xfe0c('0x89'),!![]);if(_0x156692[_0xfe0c('0x82')]()){_0x53ad00[_0xfe0c('0x1c')]('\x22'+_0x5c3d97+'\x22');}else{_0x2e932d[_0xfe0c('0x1c')](_0xfe0c('0x8a'));}break;case'dialTimezone':var _0x615d25=shared[_0xfe0c('0x68')];var _0x2567b3=_0x615d25[_0x5c3d97];if(!_[_0xfe0c('0x1e')](_0x2567b3)){var _0xc7f100=_0x2567b3[_0xfe0c('0x8b')];_0x53ad00[_0xfe0c('0x1c')]('\x22'+_0x5c3d97+'\x22');_0x53ad00['push']('\x22'+_0xc7f100+'\x22');}break;default:_0x53ad00[_0xfe0c('0x1c')]('\x22'+_0x5c3d97+'\x22');}}else{switch(_0x212524){case _0xfe0c('0x8c'):case _0xfe0c('0x11'):_0x2e932d[_0xfe0c('0x1c')](_0x212524+_0xfe0c('0x8d'));break;default:_0x53ad00['push']('\x22\x22');}}}}else{var _0x391e5e='';if(!_[_0xfe0c('0x1e')](_0x49f860)){if(!_0x337150['hasOwnProperty'](_0x49f860['id'])){if(!_[_0xfe0c('0x1e')](_0x1b8e1b[_0xfe0c('0x7c')][_0x30caa6][_0x6a47e9[_0x212524]])){var _0x5c3d97=_[_0xfe0c('0x80')](_0x1b8e1b[_0xfe0c('0x7c')][_0x30caa6][_0x6a47e9[_0x212524]][_0xfe0c('0x81')](/"/g,'\x27'));var _0x2e648d=phoneDescriptions[_0xfe0c('0x7e')](_0x369a73=>_0x369a73[_0xfe0c('0x8e')]===_0x49f860['id']);if(!_[_0xfe0c('0x1e')](_0x2e648d)){var _0x39e9dd=_[_0xfe0c('0x80')](_0x1b8e1b[_0xfe0c('0x7c')][_0x30caa6][_0x6a47e9[_0x2e648d[_0xfe0c('0x8f')]]]['replace'](/"/g,'\x27'));if(!_[_0xfe0c('0x1e')](_0x39e9dd))_0x5c3d97=_0x5c3d97+'§'+_0x39e9dd;}if(_0x391e5e=='')_0x391e5e=_0x5c3d97;else _0x391e5e+='|'+_0x5c3d97;}_0x1127e6[_0xfe0c('0x1c')](_0x49f860['id']+':'+_0x391e5e);_0x337150[_0x49f860['id']]=0x1;}}}}if(hasAdditionalPhones){_0x53ad00[_0xfe0c('0x1c')]('\x22'+_0x1127e6[_0xfe0c('0x13')](';')+'\x22');}if(_0x2e932d[_0xfe0c('0x1b')]){handleError(_0x1b8e1b[_0xfe0c('0x7c')][_0x30caa6],{'code':_0xfe0c('0x90'),'message':_0x2e932d[_0xfe0c('0x13')]()});}else{fs[_0xfe0c('0x91')](_0x3c61a7,_0x53ad00[_0xfe0c('0x13')]()+'\x0a');}_0x53ad00=[];}if(!(stats[_0xfe0c('0x7d')]%0xc8)){socket[_0xfe0c('0x92')](_0xfe0c('0x93')+_0x43fdc9,stats);stats[_0xfe0c('0x5c')]=[];}}if(stopped){logger['info'](_0xfe0c('0x94'));_0x342889[_0xfe0c('0x95')]();}}catch(_0x11f6f8){handleError(_0x1b8e1b[_0xfe0c('0x7c')][_0x30caa6],{'code':'SystemError','message':_0x11f6f8[_0xfe0c('0x5a')]});logger[_0xfe0c('0x59')](_0xfe0c('0x96'),_0x11f6f8[_0xfe0c('0x5a')]);}},'complete':function(){try{var _0x553a39=[];var _0x519910=[];var _0x45e7e6=_0xfe0c('0x39');if(_0x34a971['duplicates']&&_0x34a971[_0xfe0c('0x97')][_0xfe0c('0x1b')]){_0x45e7e6=_0xfe0c('0x98')+_0x43fdc9;_0x553a39[_0xfe0c('0x1c')](_0xfe0c('0x99')+_0x45e7e6+'\x20LIKE\x20cm_contacts;');}tmp_campaigns=_0xfe0c('0x9a')+_0x43fdc9;tmp_voice_queues='voice_queues_'+_0x43fdc9;_0x519910[_0xfe0c('0x1c')](_0xfe0c('0x99')+tmp_campaigns+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');_0x519910[_0xfe0c('0x1c')](_0xfe0c('0x99')+tmp_voice_queues+_0xfe0c('0x9b'));BPromise[_0xfe0c('0x9c')](_0x519910,handleTZQuery)[_0xfe0c('0x1a')](function(_0x168d3d){updateTzCampaigns(_0x34a971['ListId'])[_0xfe0c('0x1a')](function(_0xd45af7){updateTzVoiceQueues(_0x34a971['ListId'])[_0xfe0c('0x1a')](function(_0x306811){if(hasTZ)_0x54375c=_0x54375c[_0xfe0c('0x81')]('dialTimezone','dialTimezone,utcOffset');var _0xfbe119=util[_0xfe0c('0xd')](_0xfe0c('0x9d'),_0x3c61a7,_0x45e7e6,_0x54375c,_0x34a971[_0xfe0c('0x32')],_0x34a971['CompanyId']||null,NOW,NOW);if(_[_0xfe0c('0x1e')](_0x6a47e9['scheduledat'])){_0xfbe119+=',\x20scheduledAt\x20=\x20NOW()';}_0x553a39[_0xfe0c('0x1c')](_0xfbe119);if(_0x34a971['duplicates']&&_0x34a971[_0xfe0c('0x97')][_0xfe0c('0x1b')]){_0x553a39[_0xfe0c('0x1c')](insertCmContact(_0x34a971[_0xfe0c('0x32')],_0x45e7e6,_0x34a971[_0xfe0c('0x97')],_0x6a47e9));_0x553a39['push'](_0xfe0c('0x9e')+_0x45e7e6+';');}BPromise[_0xfe0c('0x9c')](_0x553a39,handleQuery)[_0xfe0c('0x1a')](function(_0x24a6eb){BPromise[_0xfe0c('0x64')]([handleAdditionalPhones()])[_0xfe0c('0x1a')](function(){_0x553a39=[];for(var _0x5df501=0x0;_0x5df501\x20\x20','file\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0xf79b,0xa0));var _0xbf79=function(_0x2f59e6,_0x5225df){_0x2f59e6=_0x2f59e6-0x0;var _0x17af4e=_0xf79b[_0x2f59e6];return _0x17af4e;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0xbf79('0x0'));var Papa=require(_0xbf79('0x1'));var util=require('util');var BPromise=require(_0xbf79('0x2'));var moment=require(_0xbf79('0x3'));var squel=require(_0xbf79('0x4'));var Redis=require('ioredis');var db=require(_0xbf79('0x5'))['db'];var config=require(_0xbf79('0x6'));var logger=require(_0xbf79('0x7'))(_0xbf79('0x8'));config[_0xbf79('0x9')]=_[_0xbf79('0xa')](config[_0xbf79('0x9')],{'host':_0xbf79('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbf79('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0xbf79('0xc')]('YYYY-MM-DD\x20HH:mm:ss');var tempTableName=_0xbf79('0xd')+moment()['format'](_0xbf79('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x5211fa){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))*$/[_0xbf79('0xf')](_0x5211fa);}function selectNotIn(_0x53ca23,_0x484dae,_0x57cb76,_0x30f8cf,_0x37b698){return squel[_0xbf79('0x10')]()[_0xbf79('0x11')](_0xbf79('0x12'))[_0xbf79('0x13')](_0x30f8cf)[_0xbf79('0x14')](_0x484dae,null,_0x484dae+_0xbf79('0x15')+_0x30f8cf+'.'+_0x57cb76)[_0xbf79('0x16')](_0x30f8cf+'.'+_0x57cb76+_0xbf79('0x17')+_0x53ca23+'.'+_0x57cb76)[_0xbf79('0x16')](_0x484dae+_0xbf79('0x18')+_0x37b698[_0xbf79('0x14')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x47cc95,_0x3ca33b){promisesAdditionalPhones=[];promisesContact=[];return db[_0xbf79('0x19')][_0xbf79('0x1a')](_0xbf79('0x1b')+tempTableName)['spread'](function(_0x5474f1){if(_0x5474f1!==null){var _0x27c409=[];for(var _0x4b0c1a=0x0;_0x4b0c1a<_0x5474f1[_0xbf79('0x1c')];_0x4b0c1a++){var _0x809582=_0x5474f1[_0x4b0c1a];if(!_[_0xbf79('0x1d')](_0x809582['phone'])){if(!_[_0xbf79('0x1d')](_0x809582[_0xbf79('0x1e')]))_0x27c409[_0xbf79('0x1f')](insertAdditionalPhones(_0x809582));promisesContact['push']({'contact':_0x809582});}}}Promise[_0xbf79('0x20')](_0x27c409)[_0xbf79('0x21')](function(){_0x47cc95({'val':0x1});});})[_0xbf79('0x22')](function(_0x38b78d){logger[_0xbf79('0x23')](_0x38b78d[_0xbf79('0x24')]);});});}function insertAdditionalPhones(_0x353f12){return new Promise(function(_0xf36665,_0x19a504){var _0x27c236=_0x353f12[_0xbf79('0x1e')];if(_['isNil'](_0x27c236))_0x19a504({'val':0x0});else{var _0x2c3017=_0x27c236[_0xbf79('0x25')](';');var _0x10e8e9=[];orderBy=0x0;for(var _0x588e3a=0x0;_0x588e3a<_0x2c3017['length'];_0x588e3a++){_0x10e8e9[_0xbf79('0x1f')](splitAdditionalPhone(_0x353f12['id'],_0x2c3017[_0x588e3a]));}Promise[_0xbf79('0x20')](_0x10e8e9)['then'](function(){_0xf36665({'val':_0x2c3017['length']});});}});}function splitAdditionalPhone(_0x187a86,_0x47ec57){return new Promise(function(_0x437499,_0x1c6d07){var _0x1fb682=_0x47ec57[_0xbf79('0x25')](':');var _0x41146b=_0x1fb682[0x0];var _0x5f30bd=_0x1fb682[0x1];if(_0x5f30bd!==''){var _0x3c3213=_0x5f30bd['split']('|');var _0x49f57d=[];for(var _0x36f889=0x0;_0x36f889<_0x3c3213['length'];_0x36f889++){if(_0x3c3213[_0x36f889]!==''){var _0x1317c0=_[_0xbf79('0x26')](promisesAdditionalPhones,{'contactId':_0x187a86,'phone':_0x3c3213[_0x36f889]});if(_0x1317c0['length']==0x0){orderBy++;promisesAdditionalPhones[_0xbf79('0x1f')]({'contactId':_0x187a86,'contactTypeId':_0x41146b,'phone':_0x3c3213[_0x36f889],'orderBy':orderBy});}}}_0x437499({'ok':0x1});}else _0x437499({'res':0x0});});}function createAdditionalPhone(_0x5aa22d,_0x5de916,_0x320f6e,_0x30b132){var _0x35e80e='';var _0xad364e='';var _0x5dba78=_0x320f6e['split']('§');_0x35e80e=_0x5dba78[0x0];if(_0x5dba78[_0xbf79('0x1c')]==0x2)_0xad364e=_0x5dba78[0x1];return new Promise(function(_0x262b9b,_0x2bbf5c){return db['CmContactHasItem']['findOne']({'where':{'CmContactId':_0x5aa22d,'item':_0x35e80e}})[_0xbf79('0x21')](function(_0x227a84){if(_0x227a84){return db[_0xbf79('0x27')][_0xbf79('0x28')]({'ItemTypeId':_0x5de916,'description':_0xad364e,'OrderBy':_0x30b132},{'where':{'CmContactId':_0x5aa22d,'item':_0x35e80e}})[_0xbf79('0x21')](function(_0x2d0575){_0x262b9b({'res':_0xbf79('0x29')});});}else{return db[_0xbf79('0x27')][_0xbf79('0x2a')]({'CmContactId':_0x5aa22d,'item':_0x35e80e,'ItemTypeId':_0x5de916,'description':_0xad364e,'OrderBy':_0x30b132,'ItemClass':_0xbf79('0x2b')})[_0xbf79('0x21')](function(_0x3b07f5){_0x262b9b({'res':_0xbf79('0x2c')});});}});});}function updateContact(_0x446dc3){return new Promise(function(_0x1ac0fb,_0x3f49e3){var _0x13bdfe=_0x446dc3['id'];delete _0x446dc3['id'];return db[_0xbf79('0x2d')][_0xbf79('0x28')](_0x446dc3,{'where':{'id':_0x13bdfe}})[_0xbf79('0x21')](function(_0xac56b7){updatedRows+=0x1;return db[_0xbf79('0x2e')][_0xbf79('0x28')]({'phone':_0x446dc3['phone']},{'where':{'ContactId':_0x13bdfe}})[_0xbf79('0x21')](function(_0x613da8){_0x1ac0fb({'ret':'OK'});});});});}function insertCmHopper(_0x174baa,_0x33c930,_0x2e1e5b,_0x31a75b,_0x361705){var _0x4121fc=['cm_contacts.phone',_0xbf79('0x2f'),_0xbf79('0x30'),'cm_contacts.ListId',_0x33c930+'.'+_0x31a75b,'cm_contacts.createdAt','cm_contacts.updatedAt',_0xbf79('0x31'),_0xbf79('0x32'),'\x22'+_0x361705+'\x22'];return squel['insert']()['into'](_0xbf79('0x33'))[_0xbf79('0x34')]([_0xbf79('0x12'),_0xbf79('0x35'),_0xbf79('0x36'),'ListId',_0x31a75b,_0xbf79('0x37'),_0xbf79('0x38'),'priority',_0xbf79('0x39'),_0xbf79('0x3a')],squel['select']()[_0xbf79('0x3b')](_0x4121fc)[_0xbf79('0x13')](_0x33c930)['join']('cm_contacts',null,_0xbf79('0x3c')+_0x33c930+'.CmListId')['join'](_0x2e1e5b,null,_0x2e1e5b+_0xbf79('0x15')+_0x33c930+'.'+_0x31a75b)[_0xbf79('0x16')](_0x33c930+'.CmListId\x20=\x20?',_0x174baa)[_0xbf79('0x16')](_0xbf79('0x3d'),NOW)[_0xbf79('0x16')](_0xbf79('0x3e'),selectNotIn(_0x33c930,_0x2e1e5b,_0x31a75b,_0xbf79('0x33'),[_0xbf79('0x3f'),_0xbf79('0x40')]))[_0xbf79('0x16')](_0xbf79('0x3e'),selectNotIn(_0x33c930,_0x2e1e5b,_0x31a75b,_0xbf79('0x33'),[_0xbf79('0x3f')])))[_0xbf79('0x41')]();}function insertCmHopperBlack(_0x3b3ace,_0x3e241e,_0xe8a4f7,_0xf49e1b){var _0x489d52=[_0xbf79('0x42'),_0xbf79('0x30'),_0xbf79('0x43'),_0x3e241e+'.'+_0xf49e1b,_0xbf79('0x44'),_0xbf79('0x45')];return squel[_0xbf79('0x46')]()[_0xbf79('0x47')]('cm_hopper_black')[_0xbf79('0x34')](['phone','ContactId',_0xbf79('0x48'),_0xf49e1b,_0xbf79('0x37'),_0xbf79('0x38')],squel[_0xbf79('0x10')]()['fields'](_0x489d52)[_0xbf79('0x13')](_0x3e241e)[_0xbf79('0x14')]('cm_contacts',null,_0xbf79('0x3c')+_0x3e241e+_0xbf79('0x49'))[_0xbf79('0x14')](_0xe8a4f7,null,_0xe8a4f7+_0xbf79('0x15')+_0x3e241e+'.'+_0xf49e1b)[_0xbf79('0x16')](_0x3e241e+'.CmListId\x20=\x20?',_0x3b3ace)[_0xbf79('0x16')](_0xbf79('0x3d'),NOW)['where'](_0xbf79('0x3e'),squel[_0xbf79('0x10')]()[_0xbf79('0x11')](_0xbf79('0x12'))[_0xbf79('0x13')]('cm_hopper_black')['where'](_0xbf79('0x4a'),_0x3b3ace)[_0xbf79('0x16')](_0xf49e1b+_0xbf79('0x4b'),_0x3e241e+'.'+_0xf49e1b)))['toString']();}function insertCmHopperAdditionalPhones(_0x22df73){var _0x93ccea=[_0xbf79('0x4c'),_0xbf79('0x4d'),_0xbf79('0x4e'),_0xbf79('0x4f'),'cm_contact_has_items.updatedAt'];return squel['insert']()[_0xbf79('0x47')](_0xbf79('0x50'))[_0xbf79('0x34')](['CmHopperId',_0xbf79('0x12'),_0xbf79('0x51'),_0xbf79('0x37'),'updatedAt'],squel[_0xbf79('0x10')]()[_0xbf79('0x3b')](_0x93ccea)[_0xbf79('0x13')]('cm_hopper')[_0xbf79('0x14')]('cm_contacts',null,_0xbf79('0x52'))['join']('cm_contact_has_items',null,_0xbf79('0x53'))['where'](_0xbf79('0x54'),_0x22df73)[_0xbf79('0x16')](_0xbf79('0x3d'),NOW))[_0xbf79('0x41')]();}function insertCmContact(_0x557d26,_0x2c302b,_0x26fd8f,_0x35a60c){var _0xe56fdd=_[_0xbf79('0x55')](_[_0xbf79('0x56')](_0x35a60c),[_0xbf79('0x48'),'CompanyId',_0xbf79('0x37'),_0xbf79('0x38')]);return squel[_0xbf79('0x46')]()[_0xbf79('0x47')](_0xbf79('0x57'))['fromQuery'](_0xe56fdd,squel[_0xbf79('0x10')]()[_0xbf79('0x3b')](_0xe56fdd)[_0xbf79('0x13')](_0x2c302b)[_0xbf79('0x16')]('('+_0x26fd8f[_0xbf79('0x14')](',')+_0xbf79('0x58'),squel['select']()['fields'](_0x26fd8f)['from']('cm_contacts')[_0xbf79('0x16')](_0xbf79('0x4a'),_0x557d26))[_0xbf79('0x16')](_0xbf79('0x59'),squel[_0xbf79('0x10')]()[_0xbf79('0x11')](_0xbf79('0x5a'),_0xbf79('0x5b'))[_0xbf79('0x13')](_0x2c302b)[_0xbf79('0x5c')](_0x26fd8f['join'](','))))[_0xbf79('0x41')]();}function handleStop(){logger[_0xbf79('0x5d')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x5a5424){logger[_0xbf79('0x23')](_0x5a5424[_0xbf79('0x24')]);process[_0xbf79('0x5e')](0x1);}function handleError(_0x59de2a,_0x2059ec){stats[_0xbf79('0x5f')]['push']({'name':_0x2059ec[_0xbf79('0x60')],'message':_0x2059ec[_0xbf79('0x24')],'row':_0x59de2a});}function handleQuery(_0x5d73b6){logger['info'](_0x5d73b6);return db['sequelize'][_0xbf79('0x1a')](_0x5d73b6)[_0xbf79('0x61')](function(_0x354985){results[_0xbf79('0x1f')](_0x354985);})[_0xbf79('0x22')](function(_0x4d0369){logger[_0xbf79('0x23')](_0x4d0369[_0xbf79('0x24')]);});}function main(_0x19b3f4,_0x4647a4,_0xd5622f,_0x43ab09){logger[_0xbf79('0x5d')](_0xbf79('0x62'),_0x19b3f4,JSON['stringify'](_0x4647a4));process[_0xbf79('0x63')]('start');var _0x58c4b0=_0x4647a4[_0xbf79('0x64')];var _0x41fba9=_[_0xbf79('0x65')](_0x58c4b0);var _0xacf57f=_0x4647a4['socket_timestamp'];var _0x2e81e9=path[_0xbf79('0x14')](config[_0xbf79('0x66')],_0xbf79('0x67'),_0xacf57f+_0xbf79('0x68'));logger[_0xbf79('0x5d')](_0xbf79('0x69'),_0x4647a4);db[_0xbf79('0x6a')]['findAll']({'raw':!![],'attributes':['id',_0xbf79('0x6b')]})['then'](function(_0x59f40c){for(var _0x4b8b65=0x0;_0x4b8b65<_0x59f40c[_0xbf79('0x1c')];_0x4b8b65++){if(_0x59f40c[_0x4b8b65][_0xbf79('0x6b')]in _0x58c4b0){contactItemTypes[_0xbf79('0x1f')](_0x59f40c[_0x4b8b65]);delete _0x41fba9[_0x59f40c[_0x4b8b65]['name']];hasAdditionalPhones=!![];}for(var _0x194ffb in _0x58c4b0){if(_0x59f40c[_0x4b8b65][_0xbf79('0x6b')]+_0xbf79('0x6c')===_0x194ffb){phoneDescriptions[_0xbf79('0x1f')]({'itemTypeId':_0x59f40c[_0x4b8b65]['id'],'description':_0x194ffb});delete _0x41fba9[_0x194ffb];}}}if(hasAdditionalPhones)_0x41fba9[_0xbf79('0x1e')]='';var _0x11cfc2=_['keys'](_0x41fba9)[_0xbf79('0x14')]();logger['info']('header',_0x11cfc2);fs['writeFileSync'](_0x2e81e9,_0x11cfc2+'\x0a');Papa[_0xbf79('0x6d')](fs[_0xbf79('0x6e')](_0x19b3f4),{'header':!![],'skipEmptyLines':!![],'step':function(_0x130bf5,_0x29b4d0){try{for(var _0x18038c=0x0,_0x4e6fdd=[];_0x18038c<_0x130bf5[_0xbf79('0x6f')]['length'];_0x18038c++){stats['rows']+=0x1;if(_0x130bf5['errors'][_0x18038c]){handleError(_0x130bf5['data'][_0x18038c],_0x130bf5[_0xbf79('0x5f')][_0x18038c]);}else{var _0x4e3417=[];var _0x56b809=[];var _0x590d1c={};for(var _0x4769a7 in _0x58c4b0){let _0x1237cb=contactItemTypes[_0xbf79('0x70')](_0x3747f6=>_0x3747f6[_0xbf79('0x6b')]===_0x4769a7);let _0x23e67d=contactItemTypes['find'](_0x2f3bb1=>_0x2f3bb1['name']+'_description'===_0x4769a7);if(_[_0xbf79('0x1d')](_0x1237cb)&&_[_0xbf79('0x1d')](_0x23e67d)){if(_0x58c4b0['hasOwnProperty'](_0x4769a7)){if(_0x130bf5[_0xbf79('0x6f')][_0x18038c][_0x58c4b0[_0x4769a7]]){var _0x341c92=_[_0xbf79('0x71')](_0x130bf5[_0xbf79('0x6f')][_0x18038c][_0x58c4b0[_0x4769a7]][_0xbf79('0x72')](/"/g,'\x27'));switch(_0x4769a7){case _0xbf79('0x35'):var _0x5d328b=moment(_0x341c92,_0xbf79('0x73'),!![]);if(_0x5d328b[_0xbf79('0x74')]()){_0x4e6fdd[_0xbf79('0x1f')]('\x22'+_0x341c92+'\x22');}else{_0x4e3417[_0xbf79('0x1f')](_0xbf79('0x75'));}break;case _0xbf79('0x76'):var _0x1291a2=parseInt(_0x341c92);_0x341c92=_[_0xbf79('0x77')](_0x1291a2)||_0x1291a2<0x0||_0x1291a2>0x4?_0x43ab09?0x3:0x2:_0x1291a2;_0x4e6fdd[_0xbf79('0x1f')]('\x22'+_0x341c92+'\x22');break;case _0xbf79('0x39'):var _0x2a1517=parseInt(_0x341c92);if(_['isNumber'](_0x2a1517)&&_[_0xbf79('0x78')](_0xd5622f,_0x2a1517)){_0x4e6fdd[_0xbf79('0x1f')]('\x22'+_0x2a1517+'\x22');}else{_0x4e3417[_0xbf79('0x1f')]('agent\x20not\x20exists');}break;case _0xbf79('0x79'):if(isEmail(_0x341c92)){_0x4e6fdd[_0xbf79('0x1f')]('\x22'+_0x341c92+'\x22');}else{_0x4e3417[_0xbf79('0x1f')](_0xbf79('0x7a'));}break;case _0xbf79('0x7b'):var _0x12c86c=moment(_0x341c92,_0xbf79('0x7c'),!![]);if(_0x12c86c['isValid']()){_0x4e6fdd[_0xbf79('0x1f')]('\x22'+_0x341c92+'\x22');}else{_0x4e3417[_0xbf79('0x1f')](_0xbf79('0x7d'));}break;default:_0x4e6fdd[_0xbf79('0x1f')]('\x22'+_0x341c92+'\x22');}}else{switch(_0x4769a7){case _0xbf79('0x7e'):case _0xbf79('0x12'):_0x4e3417[_0xbf79('0x1f')](_0x4769a7+_0xbf79('0x7f'));break;default:_0x4e6fdd['push']('\x22\x22');}}}}else{var _0x2a6da5='';if(!_[_0xbf79('0x1d')](_0x1237cb)){if(!_0x590d1c[_0xbf79('0x80')](_0x1237cb['id'])){for(var _0x3fd454=0x0;_0x3fd454<_0x58c4b0[_0x4769a7][_0xbf79('0x1c')];_0x3fd454++){var _0x341c92=_[_0xbf79('0x71')](_0x130bf5['data'][_0x18038c][_0x58c4b0[_0x4769a7][_0x3fd454]][_0xbf79('0x72')](/"/g,'\x27'));var _0x2d8c40=phoneDescriptions[_0xbf79('0x70')](_0x3fd0e2=>_0x3fd0e2[_0xbf79('0x81')]===_0x1237cb['id']);if(!_[_0xbf79('0x1d')](_0x2d8c40)){var _0x34659b=_[_0xbf79('0x71')](_0x130bf5[_0xbf79('0x6f')][_0x18038c][_0x58c4b0[_0x2d8c40[_0xbf79('0x82')]][0x0]][_0xbf79('0x72')](/"/g,'\x27'));if(!_[_0xbf79('0x1d')](_0x34659b))_0x341c92=_0x341c92+'§'+_0x34659b;}if(_0x2a6da5=='')_0x2a6da5=_0x341c92;else _0x2a6da5+='|'+_0x341c92;}_0x56b809[_0xbf79('0x1f')](_0x1237cb['id']+':'+_0x2a6da5);_0x590d1c[_0x1237cb['id']]=0x1;}}}}if(hasAdditionalPhones){_0x4e6fdd[_0xbf79('0x1f')]('\x22'+_0x56b809['join'](';')+'\x22');}if(_0x4e3417[_0xbf79('0x1c')]){handleError(_0x130bf5[_0xbf79('0x6f')][_0x18038c],{'code':_0xbf79('0x83'),'message':_0x4e3417[_0xbf79('0x14')]()});}else{fs[_0xbf79('0x84')](_0x2e81e9,_0x4e6fdd['join']()+'\x0a');}_0x4e6fdd=[];}if(!(stats[_0xbf79('0x85')]%0xc8)){socket[_0xbf79('0x86')](_0xbf79('0x87')+_0xacf57f,stats);stats[_0xbf79('0x5f')]=[];}}if(stopped){logger[_0xbf79('0x5d')](_0xbf79('0x88'));_0x29b4d0[_0xbf79('0x89')]();}}catch(_0x4edb9a){handleError(_0x130bf5[_0xbf79('0x6f')][_0x18038c],{'code':_0xbf79('0x8a'),'message':_0x4edb9a['message']});logger['error'](_0xbf79('0x8b'),_0x4edb9a[_0xbf79('0x24')]);}},'complete':function(){try{var _0x2a7689=[];var _0x43479c=tempTableName;_0x2a7689['push'](_0xbf79('0x8c')+_0x43479c+_0xbf79('0x8d'));logger[_0xbf79('0x5d')](_0xbf79('0x8e'),contactItemTypes[_0xbf79('0x1c')]);var _0x3560d0=util[_0xbf79('0xc')](_0xbf79('0x8f'),_0x2e81e9,_0x43479c,_0x11cfc2,_0x4647a4[_0xbf79('0x48')],_0x4647a4[_0xbf79('0x90')]||null,NOW,NOW);if(_[_0xbf79('0x1d')](_0x58c4b0[_0xbf79('0x35')])){_0x3560d0+=_0xbf79('0x91');}_0x2a7689[_0xbf79('0x1f')](_0x3560d0);BPromise['each'](_0x2a7689,handleQuery)[_0xbf79('0x21')](function(_0x2b3ff7){BPromise[_0xbf79('0x20')]([handleAdditionalPhones()])[_0xbf79('0x21')](function(){_0x2a7689=[];for(var _0x5d395a=0x0;_0x5d395a_0x2cba6e[_0x21e8('0x68')]===_0x595fa3);let _0x5aed5d=contactItemTypes[_0x21e8('0x6f')](_0x1974fc=>_0x1974fc[_0x21e8('0x68')]+'_description'===_0x595fa3);if(_[_0x21e8('0x18')](_0x238001)&&_[_0x21e8('0x18')](_0x5aed5d)){if(_0xb26591[_0x21e8('0x70')](_0x595fa3)){if(_0x41e2e3[_0x21e8('0x6e')][_0x30730a][_0xb26591[_0x595fa3]]){var _0x1e3384=_['trim'](_0x41e2e3[_0x21e8('0x6e')][_0x30730a][_0xb26591[_0x595fa3]][_0x21e8('0x71')](/"/g,'\x27'));switch(_0x595fa3){case'scheduledat':var _0x53a8a8=moment(_0x1e3384,_0x21e8('0xd'),!![]);if(_0x53a8a8[_0x21e8('0x72')]()){_0x590a9f[_0x21e8('0x1e')]('\x22'+_0x1e3384+'\x22');}else{_0x31cf80[_0x21e8('0x1e')](_0x21e8('0x73'));}break;case'priority':var _0x365cbf=parseInt(_0x1e3384);_0x1e3384=_[_0x21e8('0x74')](_0x365cbf)||_0x365cbf<0x0||_0x365cbf>0x4?_0x159adf?0x3:0x2:_0x365cbf;_0x590a9f['push']('\x22'+_0x1e3384+'\x22');break;case _0x21e8('0x39'):var _0xf99d0e=parseInt(_0x1e3384);if(_[_0x21e8('0x75')](_0xf99d0e)&&_[_0x21e8('0x76')](_0x1e3e24,_0xf99d0e)){_0x590a9f['push']('\x22'+_0xf99d0e+'\x22');}else{_0x31cf80[_0x21e8('0x1e')](_0x21e8('0x77'));}break;case _0x21e8('0x78'):if(isEmail(_0x1e3384)){_0x590a9f[_0x21e8('0x1e')]('\x22'+_0x1e3384+'\x22');}else{_0x31cf80[_0x21e8('0x1e')]('email\x20wrong\x20format');}break;case'dateOfBirth':var _0x94a132=moment(_0x1e3384,_0x21e8('0x79'),!![]);if(_0x94a132[_0x21e8('0x72')]()){_0x590a9f[_0x21e8('0x1e')]('\x22'+_0x1e3384+'\x22');}else{_0x31cf80['push']('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x590a9f[_0x21e8('0x1e')]('\x22'+_0x1e3384+'\x22');}}else{switch(_0x595fa3){case _0x21e8('0x7a'):case _0x21e8('0x11'):_0x31cf80[_0x21e8('0x1e')](_0x595fa3+_0x21e8('0x7b'));break;default:_0x590a9f[_0x21e8('0x1e')]('\x22\x22');}}}}else{var _0x50d9be='';if(!_['isNil'](_0x238001)){if(!_0x2c0230[_0x21e8('0x70')](_0x238001['id'])){for(var _0x15aaf4=0x0;_0x15aaf4<_0xb26591[_0x595fa3][_0x21e8('0x17')];_0x15aaf4++){var _0x1e3384=_[_0x21e8('0x7c')](_0x41e2e3[_0x21e8('0x6e')][_0x30730a][_0xb26591[_0x595fa3][_0x15aaf4]]['replace'](/"/g,'\x27'));var _0x491596=phoneDescriptions[_0x21e8('0x6f')](_0x441c88=>_0x441c88[_0x21e8('0x7d')]===_0x238001['id']);if(!_[_0x21e8('0x18')](_0x491596)){var _0x1fa20e=_[_0x21e8('0x7c')](_0x41e2e3[_0x21e8('0x6e')][_0x30730a][_0xb26591[_0x491596[_0x21e8('0x7e')]][0x0]]['replace'](/"/g,'\x27'));if(!_[_0x21e8('0x18')](_0x1fa20e))_0x1e3384=_0x1e3384+'§'+_0x1fa20e;}if(_0x50d9be=='')_0x50d9be=_0x1e3384;else _0x50d9be+='|'+_0x1e3384;}_0x436f6a['push'](_0x238001['id']+':'+_0x50d9be);_0x2c0230[_0x238001['id']]=0x1;}}}}if(hasAdditionalPhones){_0x590a9f[_0x21e8('0x1e')]('\x22'+_0x436f6a[_0x21e8('0x12')](';')+'\x22');}if(_0x31cf80[_0x21e8('0x17')]){handleError(_0x41e2e3[_0x21e8('0x6e')][_0x30730a],{'code':_0x21e8('0x7f'),'message':_0x31cf80[_0x21e8('0x12')]()});}else{fs[_0x21e8('0x80')](_0x448c95,_0x590a9f['join']()+'\x0a');}_0x590a9f=[];}if(!(stats[_0x21e8('0x81')]%0xc8)){socket[_0x21e8('0x82')]('contact:import:'+_0x3af8a1,stats);stats['errors']=[];}}if(stopped){logger[_0x21e8('0x5b')](_0x21e8('0x83'));_0xb0553a[_0x21e8('0x84')]();}}catch(_0x547880){handleError(_0x41e2e3[_0x21e8('0x6e')][_0x30730a],{'code':_0x21e8('0x85'),'message':_0x547880['message']});logger[_0x21e8('0x5d')](_0x21e8('0x86'),_0x547880[_0x21e8('0x1d')]);}},'complete':function(){try{var _0x53b4df=[];var _0x2537b0=tempTableName;_0x53b4df[_0x21e8('0x1e')]('CREATE\x20TABLE\x20'+_0x2537b0+_0x21e8('0x87'));logger[_0x21e8('0x5b')](_0x21e8('0x88'),contactItemTypes['length']);var _0x346d55=util['format']('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x448c95,_0x2537b0,_0x990898,_0x10e95a[_0x21e8('0x35')],_0x10e95a[_0x21e8('0x89')]||null,NOW,NOW);if(_['isNil'](_0xb26591[_0x21e8('0x8a')])){_0x346d55+=',\x20scheduledAt\x20=\x20NOW()';}_0x53b4df['push'](_0x346d55);BPromise[_0x21e8('0x8b')](_0x53b4df,handleQuery)['then'](function(_0x2ddd66){BPromise[_0x21e8('0x1a')]([handleAdditionalPhones()])['then'](function(){_0x53b4df=[];for(var _0x742181=0x0;_0x742181\x20\x20');}var _0x307851=path[_0x21e8('0x12')](config[_0x21e8('0x95')],'server/files/tmp',process['argv'][0x2]);if(!fs['existsSync'](_0x307851)){throw new Error(_0x21e8('0x96'));}var _0x2fac3a={};try{_0x2fac3a=JSON[_0x21e8('0x6c')](process[_0x21e8('0x94')][0x3]);if(!_0x2fac3a[_0x21e8('0x62')]){throw new Error(_0x21e8('0x97'));}var _0x17ae6c=0x0;if(_0x2fac3a[_0x21e8('0x62')][_0x21e8('0x39')]){_0x17ae6c=0x1;}if(!_0x2fac3a[_0x21e8('0x35')]){throw new Error('ListId\x20is\x20mandatory');}}catch(_0x1f5c23){throw new Error(_0x21e8('0x98'));}var _0x322ef8=[];try{_0x322ef8=_[_0x21e8('0x99')](JSON[_0x21e8('0x6c')](process[_0x21e8('0x94')][0x4]),'id');}catch(_0x585e8c){logger[_0x21e8('0x5b')](_0x21e8('0x9a'));}main(_0x307851,_0x2fac3a,_0x322ef8,_0x17ae6c);}validate();process['on'](_0x21e8('0x9b'),handleStop);process['on'](_0x21e8('0x9c'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index cb954d8..9b4bd62 100644 --- a/server/components/integrations/configuration.js +++ b/server/components/integrations/configuration.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe71a=['destexten','Queue','UniqueId','uniqueid','Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Connect','agentconnectAt','Agent\x20Complete','Hold\x20Time','holdtime','talktime','Called\x20Number','membername','starttime','***\x20Time\x20Info\x20***','answertime','Complete\x20Time','Duration','duration','Billable\x20Time','billableseconds','getSubjects','string','[xCALLY\x20Ticket]','toLowerCase','inbound','push','queue','variable','calleridnum','outbound','Outbound\x20Call','destcalleridnum','voice','***\x20Call\x20Info\x20***','keyValue','Caller\x20Name','Call\x20To'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xe71a,0x1e7));var _0xae71=function(_0x5e8aeb,_0x1d2720){_0x5e8aeb=_0x5e8aeb-0x0;var _0x5e411b=_0xe71a[_0x5e8aeb];return _0x5e411b;};'use strict';exports[_0xae71('0x0')]=function(_0x2da0a4,_0x4df06e){var _0x2b62e4=[{'type':_0xae71('0x1'),'content':_0xae71('0x2'),'variableName':null}];switch(_0x2da0a4[_0xae71('0x3')]()){case'voice':switch(_0x4df06e[_0xae71('0x3')]()){case _0xae71('0x4'):_0x2b62e4[_0xae71('0x5')]({'type':'variable','content':'','variableName':_0xae71('0x6')});_0x2b62e4[_0xae71('0x5')]({'type':_0xae71('0x7'),'content':'','variableName':_0xae71('0x8')});break;case _0xae71('0x9'):_0x2b62e4[_0xae71('0x5')]({'type':_0xae71('0x1'),'content':_0xae71('0xa'),'variableName':null});_0x2b62e4[_0xae71('0x5')]({'type':_0xae71('0x7'),'content':'','variableName':_0xae71('0xb')});break;}}return _0x2b62e4;};exports['getDescriptions']=function(_0x176483,_0x5b054e){var _0x186558=[];switch(_0x176483[_0xae71('0x3')]()){case _0xae71('0xc'):switch(_0x5b054e[_0xae71('0x3')]()){case _0xae71('0x4'):_0x186558=[{'type':'string','content':_0xae71('0xd'),'key':null,'keyType':null,'variableName':null},{'type':_0xae71('0xe'),'content':'','key':'Caller\x20Number','keyType':'variable','variableName':_0xae71('0x8')},{'type':_0xae71('0xe'),'content':'','key':_0xae71('0xf'),'keyType':'variable','variableName':'calleridname'},{'type':_0xae71('0xe'),'content':'','key':_0xae71('0x10'),'keyType':_0xae71('0x7'),'variableName':_0xae71('0x11')},{'type':_0xae71('0xe'),'content':'','key':_0xae71('0x12'),'keyType':_0xae71('0x7'),'variableName':_0xae71('0x6')},{'type':_0xae71('0xe'),'content':'','key':_0xae71('0x13'),'keyType':_0xae71('0x7'),'variableName':_0xae71('0x14')},{'type':_0xae71('0xe'),'content':'','key':_0xae71('0x15'),'keyType':_0xae71('0x7'),'variableName':_0xae71('0x16')},{'type':_0xae71('0x1'),'content':_0xae71('0x17'),'key':null,'keyType':null,'variableName':null},{'type':_0xae71('0xe'),'content':'','key':_0xae71('0x18'),'keyType':_0xae71('0x7'),'variableName':_0xae71('0x19')},{'type':_0xae71('0xe'),'content':'','key':'Agent\x20Number','keyType':_0xae71('0x7'),'variableName':'destcalleridnum'},{'type':_0xae71('0x1'),'content':'***\x20Time\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0xae71('0xe'),'content':'','key':'Agent\x20Ring','keyType':_0xae71('0x7'),'variableName':_0xae71('0x16')},{'type':'keyValue','content':'','key':_0xae71('0x1a'),'keyType':_0xae71('0x7'),'variableName':_0xae71('0x1b')},{'type':'keyValue','content':'','key':_0xae71('0x1c'),'keyType':_0xae71('0x7'),'variableName':'agentcompleteAt'},{'type':_0xae71('0xe'),'content':'','key':_0xae71('0x1d'),'keyType':'variable','variableName':_0xae71('0x1e')},{'type':_0xae71('0xe'),'content':'','key':'Talk\x20Time','keyType':_0xae71('0x7'),'variableName':_0xae71('0x1f')}];break;case'outbound':_0x186558=[{'type':'string','content':_0xae71('0xd'),'variableName':null},{'type':_0xae71('0xe'),'content':'','key':_0xae71('0x20'),'keyType':_0xae71('0x7'),'keyContent':'','variableName':_0xae71('0xb')},{'type':_0xae71('0xe'),'content':'','key':'Member\x20Name','keyType':_0xae71('0x7'),'keyContent':'','variableName':_0xae71('0x21')},{'type':_0xae71('0xe'),'content':'','key':_0xae71('0x13'),'keyType':_0xae71('0x7'),'keyContent':'','variableName':'uniqueid'},{'type':_0xae71('0xe'),'content':'','key':'Date','keyType':'variable','keyContent':'','variableName':_0xae71('0x22')},{'type':_0xae71('0x1'),'content':_0xae71('0x23')},{'type':_0xae71('0xe'),'content':'','key':'Answer\x20Time','keyType':_0xae71('0x7'),'keyContent':'','variableName':_0xae71('0x24')},{'type':_0xae71('0xe'),'content':'','key':_0xae71('0x25'),'keyType':_0xae71('0x7'),'keyContent':'','variableName':'endtime'},{'type':'keyValue','content':'','key':_0xae71('0x26'),'keyType':_0xae71('0x7'),'keyContent':'','variableName':_0xae71('0x27')},{'type':_0xae71('0xe'),'content':'','key':_0xae71('0x28'),'keyType':_0xae71('0x7'),'keyContent':'','variableName':_0xae71('0x29')}];break;}}return _0x186558;}; \ No newline at end of file +var _0xc6a3=['keyValue','Caller\x20Name','Call\x20To','destexten','Queue','queue','UniqueId','Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','***\x20Time\x20Info\x20***','agentconnectAt','Agent\x20Complete','Hold\x20Time','holdtime','Talk\x20Time','Called\x20Number','Member\x20Name','membername','answertime','endtime','Duration','duration','billableseconds','getSubjects','string','[xCALLY\x20Ticket]','toLowerCase','voice','inbound','push','variable','calleridnum','outbound','destcalleridnum','getDescriptions','***\x20Call\x20Info\x20***','Caller\x20Number'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc6a3,0xba));var _0x3c6a=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xc6a3[_0x6131cd];return _0x47e916;};'use strict';exports[_0x3c6a('0x0')]=function(_0x1df030,_0x1aecbe){var _0x42d194=[{'type':_0x3c6a('0x1'),'content':_0x3c6a('0x2'),'variableName':null}];switch(_0x1df030[_0x3c6a('0x3')]()){case _0x3c6a('0x4'):switch(_0x1aecbe[_0x3c6a('0x3')]()){case _0x3c6a('0x5'):_0x42d194[_0x3c6a('0x6')]({'type':_0x3c6a('0x7'),'content':'','variableName':'queue'});_0x42d194[_0x3c6a('0x6')]({'type':_0x3c6a('0x7'),'content':'','variableName':_0x3c6a('0x8')});break;case _0x3c6a('0x9'):_0x42d194['push']({'type':_0x3c6a('0x1'),'content':'Outbound\x20Call','variableName':null});_0x42d194[_0x3c6a('0x6')]({'type':_0x3c6a('0x7'),'content':'','variableName':_0x3c6a('0xa')});break;}}return _0x42d194;};exports[_0x3c6a('0xb')]=function(_0x42f41f,_0x1350cf){var _0x5857ad=[];switch(_0x42f41f['toLowerCase']()){case _0x3c6a('0x4'):switch(_0x1350cf[_0x3c6a('0x3')]()){case'inbound':_0x5857ad=[{'type':_0x3c6a('0x1'),'content':_0x3c6a('0xc'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x3c6a('0xd'),'keyType':_0x3c6a('0x7'),'variableName':_0x3c6a('0x8')},{'type':_0x3c6a('0xe'),'content':'','key':_0x3c6a('0xf'),'keyType':_0x3c6a('0x7'),'variableName':'calleridname'},{'type':_0x3c6a('0xe'),'content':'','key':_0x3c6a('0x10'),'keyType':_0x3c6a('0x7'),'variableName':_0x3c6a('0x11')},{'type':_0x3c6a('0xe'),'content':'','key':_0x3c6a('0x12'),'keyType':_0x3c6a('0x7'),'variableName':_0x3c6a('0x13')},{'type':_0x3c6a('0xe'),'content':'','key':_0x3c6a('0x14'),'keyType':_0x3c6a('0x7'),'variableName':'uniqueid'},{'type':_0x3c6a('0xe'),'content':'','key':_0x3c6a('0x15'),'keyType':_0x3c6a('0x7'),'variableName':_0x3c6a('0x16')},{'type':_0x3c6a('0x1'),'content':_0x3c6a('0x17'),'key':null,'keyType':null,'variableName':null},{'type':_0x3c6a('0xe'),'content':'','key':_0x3c6a('0x18'),'keyType':'variable','variableName':_0x3c6a('0x19')},{'type':'keyValue','content':'','key':'Agent\x20Number','keyType':_0x3c6a('0x7'),'variableName':'destcalleridnum'},{'type':_0x3c6a('0x1'),'content':_0x3c6a('0x1a'),'key':null,'keyType':null,'variableName':null},{'type':_0x3c6a('0xe'),'content':'','key':'Agent\x20Ring','keyType':_0x3c6a('0x7'),'variableName':_0x3c6a('0x16')},{'type':'keyValue','content':'','key':'Agent\x20Connect','keyType':'variable','variableName':_0x3c6a('0x1b')},{'type':_0x3c6a('0xe'),'content':'','key':_0x3c6a('0x1c'),'keyType':_0x3c6a('0x7'),'variableName':'agentcompleteAt'},{'type':_0x3c6a('0xe'),'content':'','key':_0x3c6a('0x1d'),'keyType':_0x3c6a('0x7'),'variableName':_0x3c6a('0x1e')},{'type':_0x3c6a('0xe'),'content':'','key':_0x3c6a('0x1f'),'keyType':_0x3c6a('0x7'),'variableName':'talktime'}];break;case _0x3c6a('0x9'):_0x5857ad=[{'type':_0x3c6a('0x1'),'content':_0x3c6a('0xc'),'variableName':null},{'type':_0x3c6a('0xe'),'content':'','key':_0x3c6a('0x20'),'keyType':_0x3c6a('0x7'),'keyContent':'','variableName':_0x3c6a('0xa')},{'type':'keyValue','content':'','key':_0x3c6a('0x21'),'keyType':'variable','keyContent':'','variableName':_0x3c6a('0x22')},{'type':_0x3c6a('0xe'),'content':'','key':_0x3c6a('0x14'),'keyType':_0x3c6a('0x7'),'keyContent':'','variableName':'uniqueid'},{'type':_0x3c6a('0xe'),'content':'','key':'Date','keyType':_0x3c6a('0x7'),'keyContent':'','variableName':'starttime'},{'type':_0x3c6a('0x1'),'content':'***\x20Time\x20Info\x20***'},{'type':'keyValue','content':'','key':'Answer\x20Time','keyType':_0x3c6a('0x7'),'keyContent':'','variableName':_0x3c6a('0x23')},{'type':_0x3c6a('0xe'),'content':'','key':'Complete\x20Time','keyType':_0x3c6a('0x7'),'keyContent':'','variableName':_0x3c6a('0x24')},{'type':'keyValue','content':'','key':_0x3c6a('0x25'),'keyType':_0x3c6a('0x7'),'keyContent':'','variableName':_0x3c6a('0x26')},{'type':_0x3c6a('0xe'),'content':'','key':'Billable\x20Time','keyType':_0x3c6a('0x7'),'keyContent':'','variableName':_0x3c6a('0x27')}];break;}}return _0x5857ad;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index 3e5887a..38291fe 100644 --- a/server/components/interaction/service.js +++ b/server/components/interaction/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x58ab=['fax','updateUser','lodash','findAll','skipInteractionsQuery','resolve','getInteractionsQuery','parseAdvancedSearchFilter','search','parseQueryParameters','then','body','where','contact','default','fields','filter','user','having','tags','checkAccountsRestrictions','group','ids','tag','countFilteredInteractions','count','order','forEach','contactName','closed','getFilteredInteractions','rows','catch','tracked','query','clone','omit','html','phone'];(function(_0x5282cb,_0x1f555c){var _0x1d42bc=function(_0x30b684){while(--_0x30b684){_0x5282cb['push'](_0x5282cb['shift']());}};_0x1d42bc(++_0x1f555c);}(_0x58ab,0x77));var _0xb58a=function(_0x374aa4,_0x4246f0){_0x374aa4=_0x374aa4-0x0;var _0xde6036=_0x58ab[_0x374aa4];return _0xde6036;};'use strict';var _=require(_0xb58a('0x0'));var sqlUtils=require('./sql-utils');var utils=require('./utils');exports[_0xb58a('0x1')]=function(_0xda708d,_0x3939d2,_0x6cd97d,_0x5b602d,_0x28fd8a){var _0x4e4877={'count':0x0,'rows':[]};var _0x4e06a8=sqlUtils[_0xb58a('0x2')](_0xda708d,_0x6cd97d,_0x3939d2);if(_0x4e06a8){return Promise[_0xb58a('0x3')](_0x4e4877);}var _0x3d7f24=sqlUtils[_0xb58a('0x4')](_0xda708d);var _0x4c2874={};return Promise[_0xb58a('0x3')]()['then'](function(){if(_0x3939d2['search']){return sqlUtils[_0xb58a('0x5')](_0x3939d2[_0xb58a('0x6')],_0x28fd8a);}else{return sqlUtils[_0xb58a('0x7')](_0xda708d,_0x3939d2,_0x28fd8a);}})[_0xb58a('0x8')](function(_0x579d86){_0x3d7f24['where'](_0x579d86[_0xb58a('0x9')]);_0x3d7f24[_0xb58a('0xa')](_0x579d86[_0xb58a('0xb')]);_0x3d7f24['where'](_0x579d86[_0xb58a('0xc')]);_0x3d7f24[_0xb58a('0xa')](_0x579d86[_0xb58a('0xd')]);_0x3d7f24[_0xb58a('0xa')](_0x579d86[_0xb58a('0xe')]);_0x3d7f24[_0xb58a('0xa')](_0x579d86[_0xb58a('0xf')]);_0x3d7f24[_0xb58a('0x10')](_0x579d86['read']);_0x4c2874=_0x579d86[_0xb58a('0x11')];return sqlUtils[_0xb58a('0x12')](_0xda708d,_0x6cd97d,_0x3939d2);})[_0xb58a('0x8')](function(_0x450b66){_0x3d7f24[_0xb58a('0xa')](_0x450b66);_0x3d7f24[_0xb58a('0x13')]('i.id');var _0x16c100=_0x3939d2[_0xb58a('0x6')]?_0x4c2874[_0xb58a('0x14')]:_0x3939d2[_0xb58a('0x15')];return sqlUtils[_0xb58a('0x16')](_0x3d7f24,_0x16c100);})['then'](function(_0x51fbce){_0x4e4877['count']=_0x51fbce['length'];if(_0x4e4877[_0xb58a('0x17')]===0x0){return[];}_0x3d7f24['having'](_0x4c2874['clause']);if(_0x5b602d[_0xb58a('0x18')]){_0x5b602d[_0xb58a('0x18')][_0xb58a('0x19')](function(_0x2b7b84){var _0x4fd7cd=_0x2b7b84[0x0]===_0xb58a('0x1a')?_0x2b7b84[0x0]:'i.'+_0x2b7b84[0x0];_0x3d7f24['order'](_0x4fd7cd,_0x2b7b84[0x1]==='DESC'?![]:!![]);if(_0x2b7b84[0x0]===_0xb58a('0x1b')){var _0x534a97=sqlUtils['getClosedOrderClause'](_0xda708d,_0x3939d2);_0x3d7f24[_0xb58a('0x18')](_0x534a97,_0x2b7b84[0x1]==='DESC'?![]:!![]);}});}return sqlUtils[_0xb58a('0x1c')](_0xda708d,_0x3d7f24,_0x3939d2,_0x5b602d);})[_0xb58a('0x8')](function(_0x2e9b29){_0x4e4877[_0xb58a('0x1d')]=_0x2e9b29;return _0x4e4877;})[_0xb58a('0x1e')](function(_0x2df1ed){throw _0x2df1ed;});};exports[_0xb58a('0x1f')]=function(_0x13aac5,_0x1ebdcc){return function(_0x5ea14a,_0x3a77bf,_0x500795){var _0x432e40=_0x5ea14a[_0xb58a('0xf')];var _0xc3a12b={};var _0x16519e=_0x5ea14a[_0xb58a('0x20')];if(_0xc3a12b){_0xc3a12b=_[_0xb58a('0x21')](_0x5ea14a['body']);_0xc3a12b=_[_0xb58a('0x22')](_0xc3a12b,[_0xb58a('0x9'),_0xb58a('0x23'),_0xb58a('0x24'),_0xb58a('0x25'),'mobile']);}utils[_0xb58a('0x26')](_0x432e40,_0xc3a12b,_0x16519e,_0x13aac5,_0x1ebdcc);_0x500795(null);};}; \ No newline at end of file +var _0x1f62=['i.id','ids','tag','count','clause','order','forEach','DESC','closed','getFilteredInteractions','catch','query','omit','html','fax','mobile','updateUser','./sql-utils','findAll','resolve','then','search','parseAdvancedSearchFilter','parseQueryParameters','body','where','contact','default','fields','filter','user','having','read','tags','checkAccountsRestrictions','group'];(function(_0x34021d,_0x753aa6){var _0x16597b=function(_0x2d040a){while(--_0x2d040a){_0x34021d['push'](_0x34021d['shift']());}};_0x16597b(++_0x753aa6);}(_0x1f62,0x1c1));var _0x21f6=function(_0x32c98a,_0x5e6eb0){_0x32c98a=_0x32c98a-0x0;var _0x1796d3=_0x1f62[_0x32c98a];return _0x1796d3;};'use strict';var _=require('lodash');var sqlUtils=require(_0x21f6('0x0'));var utils=require('./utils');exports[_0x21f6('0x1')]=function(_0x50593e,_0x156436,_0x4de686,_0x1cbd95,_0x27ed5f){var _0x3fe8b5={'count':0x0,'rows':[]};var _0x17a23b=sqlUtils['skipInteractionsQuery'](_0x50593e,_0x4de686,_0x156436);if(_0x17a23b){return Promise[_0x21f6('0x2')](_0x3fe8b5);}var _0x42dba0=sqlUtils['getInteractionsQuery'](_0x50593e);var _0x32713e={};return Promise['resolve']()[_0x21f6('0x3')](function(){if(_0x156436[_0x21f6('0x4')]){return sqlUtils[_0x21f6('0x5')](_0x156436[_0x21f6('0x4')],_0x27ed5f);}else{return sqlUtils[_0x21f6('0x6')](_0x50593e,_0x156436,_0x27ed5f);}})['then'](function(_0x1f6c9f){_0x42dba0['where'](_0x1f6c9f[_0x21f6('0x7')]);_0x42dba0[_0x21f6('0x8')](_0x1f6c9f[_0x21f6('0x9')]);_0x42dba0['where'](_0x1f6c9f[_0x21f6('0xa')]);_0x42dba0[_0x21f6('0x8')](_0x1f6c9f[_0x21f6('0xb')]);_0x42dba0['where'](_0x1f6c9f[_0x21f6('0xc')]);_0x42dba0[_0x21f6('0x8')](_0x1f6c9f[_0x21f6('0xd')]);_0x42dba0[_0x21f6('0xe')](_0x1f6c9f[_0x21f6('0xf')]);_0x32713e=_0x1f6c9f[_0x21f6('0x10')];return sqlUtils[_0x21f6('0x11')](_0x50593e,_0x4de686,_0x156436);})[_0x21f6('0x3')](function(_0x36de4a){_0x42dba0[_0x21f6('0x8')](_0x36de4a);_0x42dba0[_0x21f6('0x12')](_0x21f6('0x13'));var _0x445cd2=_0x156436['search']?_0x32713e[_0x21f6('0x14')]:_0x156436[_0x21f6('0x15')];return sqlUtils['countFilteredInteractions'](_0x42dba0,_0x445cd2);})['then'](function(_0x1dba6b){_0x3fe8b5[_0x21f6('0x16')]=_0x1dba6b['length'];if(_0x3fe8b5['count']===0x0){return[];}_0x42dba0[_0x21f6('0xe')](_0x32713e[_0x21f6('0x17')]);if(_0x1cbd95[_0x21f6('0x18')]){_0x1cbd95[_0x21f6('0x18')][_0x21f6('0x19')](function(_0x26a51e){var _0x11d619=_0x26a51e[0x0]==='contactName'?_0x26a51e[0x0]:'i.'+_0x26a51e[0x0];_0x42dba0[_0x21f6('0x18')](_0x11d619,_0x26a51e[0x1]===_0x21f6('0x1a')?![]:!![]);if(_0x26a51e[0x0]===_0x21f6('0x1b')){var _0x4616df=sqlUtils['getClosedOrderClause'](_0x50593e,_0x156436);_0x42dba0[_0x21f6('0x18')](_0x4616df,_0x26a51e[0x1]===_0x21f6('0x1a')?![]:!![]);}});}return sqlUtils[_0x21f6('0x1c')](_0x50593e,_0x42dba0,_0x156436,_0x1cbd95);})['then'](function(_0x569b31){_0x3fe8b5['rows']=_0x569b31;return _0x3fe8b5;})[_0x21f6('0x1d')](function(_0x2ba551){throw _0x2ba551;});};exports['tracked']=function(_0x559fd6,_0x5b04b1){return function(_0x398b43,_0x272a38,_0x4c0ec6){var _0x223179=_0x398b43[_0x21f6('0xd')];var _0x52ca8f={};var _0x5025e6=_0x398b43[_0x21f6('0x1e')];if(_0x52ca8f){_0x52ca8f=_['clone'](_0x398b43[_0x21f6('0x7')]);_0x52ca8f=_[_0x21f6('0x1f')](_0x52ca8f,[_0x21f6('0x7'),_0x21f6('0x20'),'phone',_0x21f6('0x21'),_0x21f6('0x22')]);}utils[_0x21f6('0x23')](_0x223179,_0x52ca8f,_0x5025e6,_0x559fd6,_0x5b04b1);_0x4c0ec6(null);};}; \ No newline at end of file diff --git a/server/components/interaction/sql-utils.js b/server/components/interaction/sql-utils.js index d2e756e..142d255 100644 --- a/server/components/interaction/sql-utils.js +++ b/server/components/interaction/sql-utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ad8=['agent','\x20IS\x20NOT\x20NULL','i.secondDisposition','i.disposition','unshift','i.substatus','closed','CONCAT_WS(\x27\x27,\x20','join','capitalize','Sequelize','QueryTypes','SELECT','sequelize','query','toString','keyBy','attributes','forEach','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','a.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.thirdDisposition','i.to','i.MailAccountId','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','Contact.firstName','c.lastName','Contact.email','c.mobile','Contact.mobile','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','limit','offset','groupBy','enableEmailPreview','clone','COUNT(*)','isEmpty','t.id\x20IN\x20?','exports','squel','../parsers/advancedSearch','updateInteraction','./utils','../../mysqldb','role','search','field','name','color','from','getInteractionFK','user_has_','_interactions','select','u.id','u.fullname','ui.','left_join','u.id\x20=\x20ui.UserId','where','\x20IN\x20?','map','getAccountFK','interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','a.id\x20=\x20i.','messages','\x20=\x20i.id','interactionsTags','it.','expr','getSelectedTags','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','i.id\x20LIKE\x20?','sms','whatsapp','includes','i.phone\x20LIKE\x20?','openchannel','i.from\x20LIKE\x20?','mail','isEmail','c.email\x20LIKE\x20?','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','fax','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)','conditions','length','buildExpression','type','text','value','start','end','unreadMessages','read','and','Contact','operator','split','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','Tag','tags','clause','ids','$substring','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','plainBody','keys','some','compact','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','then','fields','filter','get','chat','Websites','Accounts','resolve'];(function(_0x26a906,_0x3d135c){var _0x495575=function(_0x2365af){while(--_0x2365af){_0x26a906['push'](_0x26a906['shift']());}};_0x495575(++_0x3d135c);}(_0x2ad8,0x178));var _0x82ad=function(_0x2697d9,_0x26806a){_0x2697d9=_0x2697d9-0x0;var _0x25e6ae=_0x2ad8[_0x2697d9];return _0x25e6ae;};'use strict';var _=require('lodash');var squel=require(_0x82ad('0x0'));var as=require(_0x82ad('0x1'));var qs=require('../parsers/qs');var updateInteraction=require('./update-interaction')[_0x82ad('0x2')];var utils=require(_0x82ad('0x3'));var db=require(_0x82ad('0x4'))['db'];function skipInteractionsQuery(_0x198ed0,_0x27a784,_0x20f42e){var _0x29338=![];var _0x598c96=utils['getAccountFK'](_0x198ed0);if(_0x27a784[_0x82ad('0x5')]==='agent'&&!_0x20f42e[_0x82ad('0x6')]&&!_0x20f42e[_0x598c96]){_0x29338=!![];}return _0x29338;}function getTagsQuery(){return squel['select']()[_0x82ad('0x7')]('id')[_0x82ad('0x7')](_0x82ad('0x8'))[_0x82ad('0x7')](_0x82ad('0x9'))[_0x82ad('0xa')]('tools_tags');}function getUsersQuery(_0xf1e13c,_0x1adb42){var _0xa6cb0a=utils[_0x82ad('0xb')](_0xf1e13c);var _0x1f8976=_0x82ad('0xc')+_0xf1e13c+_0x82ad('0xd');var _0x1e8046=squel[_0x82ad('0xe')]()[_0x82ad('0x7')](_0x82ad('0xf'))[_0x82ad('0x7')](_0x82ad('0x10'))[_0x82ad('0x7')](_0x82ad('0x11')+_0xa6cb0a)[_0x82ad('0xa')](_0x1f8976,'ui')[_0x82ad('0x12')]('users','u',_0x82ad('0x13'));if(_0x1adb42['length']>0x0){_0x1e8046[_0x82ad('0x14')](_0x82ad('0x11')+_0xa6cb0a+_0x82ad('0x15'),_[_0x82ad('0x16')](_0x1adb42,'id'));}return _0x1e8046;}function getInteractionsQuery(_0x128130){var _0x4119a8=utils['getInteractionsTables'](_0x128130);var _0x5cccd0=utils[_0x82ad('0x17')](_0x128130);var _0x8c8145=utils[_0x82ad('0xb')](_0x128130);return squel['select']()[_0x82ad('0xa')](_0x4119a8[_0x82ad('0x18')],'i')[_0x82ad('0x12')]('cm_contacts','c',_0x82ad('0x19'))[_0x82ad('0x12')](_0x82ad('0x1a'),'o',_0x82ad('0x1b'))['left_join'](_0x4119a8['accounts'],'a',_0x82ad('0x1c')+_0x5cccd0)[_0x82ad('0x12')](_0x4119a8[_0x82ad('0x1d')],'me','me.'+_0x8c8145+_0x82ad('0x1e'))[_0x82ad('0x12')](_0x4119a8[_0x82ad('0x1f')],'it',_0x82ad('0x20')+_0x8c8145+_0x82ad('0x1e'))[_0x82ad('0x12')]('tools_tags','t','t.id\x20=\x20it.TagId');}function getSqlClauses(){var _0x5e5d55={'body':squel[_0x82ad('0x21')](),'contact':squel[_0x82ad('0x21')](),'default':squel[_0x82ad('0x21')](),'fields':squel[_0x82ad('0x21')](),'filter':squel[_0x82ad('0x21')](),'read':squel[_0x82ad('0x21')](),'tags':{'clause':squel['expr'](),'ids':null},'user':squel[_0x82ad('0x21')]()};return _0x5e5d55;}function parseTagParameter(_0x5b3d83){var _0x4d2fb7=squel[_0x82ad('0x21')]();if(_0x5b3d83){var _0x2bcf73=utils[_0x82ad('0x22')](_0x5b3d83);_0x2bcf73['forEach'](function(_0x2a5e4f){_0x4d2fb7['or'](_0x82ad('0x23'),'%,'+_0x2a5e4f+',%');});}return _0x4d2fb7;}function parseReadParameter(_0xa7a281){var _0x2e2060='';if(_0xa7a281){_0x2e2060=_0x82ad('0x24');if(_0xa7a281==='1'){_0x2e2060=_0x2e2060['replace']('{OPERATOR}','=');}else{_0x2e2060=_0x2e2060[_0x82ad('0x25')](_0x82ad('0x26'),'>');}}return _0x2e2060;}function parseSearchFilter(_0xa331be,_0xb91717){var _0x45cc7d=squel[_0x82ad('0x21')]();if(_0xb91717){var _0x3d2211=_0xb91717[_0x82ad('0x25')]('\x5c','\x5c\x5c')[_0x82ad('0x25')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x3d2211)){_0x45cc7d['or'](_0x82ad('0x27'),_0x3d2211+'%');if([_0x82ad('0x28'),_0x82ad('0x29')][_0x82ad('0x2a')](_0xa331be)){_0x45cc7d['or'](_0x82ad('0x2b'),_0x3d2211+'%');}else if(_0xa331be==='fax'){_0x45cc7d['or']('i.fax\x20LIKE\x20?',_0x3d2211+'%');}else if(_0xa331be===_0x82ad('0x2c')){_0x45cc7d['or'](_0x82ad('0x2d'),_0x3d2211+'%');}}else if(_0xa331be===_0x82ad('0x2e')&&qs[_0x82ad('0x2f')](_0x3d2211)){_0x45cc7d['or'](_0x82ad('0x30'),_0x3d2211+'%');}else{if(_0xa331be==='mail'){_0x45cc7d['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x82ad('0x31')](_0x3d2211,!![]))['or'](_0x82ad('0x32'),qs[_0x82ad('0x31')](_0x3d2211));}else if(_0xa331be!==_0x82ad('0x33')){_0x45cc7d['or'](_0x82ad('0x34'),qs[_0x82ad('0x31')](_0x3d2211));}_0x45cc7d['or'](_0x82ad('0x35'),qs[_0x82ad('0x31')](_0x3d2211,!![]),null);}}return _0x45cc7d;}function parseAdvancedSearchFilter(_0x15868c,_0x9f484b){var _0x560189=getSqlClauses();var _0x53efa2=as['parseSearch'](_0x15868c);var _0x53e490=_0x53efa2['sqlOperator'];for(var _0x20dddb=0x0;_0x20dddb<_0x53efa2[_0x82ad('0x36')][_0x82ad('0x37')];_0x20dddb++){var _0x1d0594=_0x53efa2[_0x82ad('0x36')][_0x20dddb];var _0x24c505='i';var _0x34194=_['find'](_0x9f484b,['name',_0x1d0594[_0x82ad('0x7')]]);if(_0x34194){var _0x5734c0=as[_0x82ad('0x38')](_0x24c505,_0x34194[_0x82ad('0x39')],_0x1d0594);_0x560189['default'][_0x53e490](_0x5734c0[_0x82ad('0x3a')],_0x5734c0[_0x82ad('0x3b')][_0x82ad('0x3c')],_0x5734c0['value'][_0x82ad('0x3d')]);}else{switch(_0x1d0594[_0x82ad('0x7')]){case _0x82ad('0x3e'):var _0x451b56=parseReadParameter(_0x1d0594[_0x82ad('0x3b')]);_0x560189[_0x82ad('0x3f')][_0x82ad('0x40')](_0x451b56);break;case _0x82ad('0x41'):if(_0x1d0594[_0x82ad('0x42')]==='$substring'){if(_0x1d0594[_0x82ad('0x3b')][_0x82ad('0x43')]('\x20')[_0x82ad('0x37')]>0x1){_0x560189[_0x82ad('0x44')][_0x53e490]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x82ad('0x31')](_0x1d0594[_0x82ad('0x3b')],!![]),null);}else{var _0x493a68='%'+_0x1d0594[_0x82ad('0x3b')]+'%';_0x560189[_0x82ad('0x44')][_0x53e490](_0x82ad('0x45'),_0x493a68,_0x493a68,_0x493a68);}}else{_0x34194=_[_0x82ad('0x46')](_0x9f484b,[_0x82ad('0x8'),'ContactId']);_0x1d0594[_0x82ad('0x7')]='ContactId';_0x5734c0=as['buildExpression'](_0x24c505,_0x34194['type'],_0x1d0594);_0x560189['contact'][_0x53e490](_0x5734c0[_0x82ad('0x3a')],_0x5734c0[_0x82ad('0x3b')][_0x82ad('0x3c')],_0x5734c0['value'][_0x82ad('0x3d')]);}break;case _0x82ad('0x47'):var _0x3ca03d=_0x1d0594[_0x82ad('0x3b')]['split'](',')['map'](function(_0x4b0703){return Number(_0x4b0703);});var _0x4572ca=parseTagParameter(_0x3ca03d);_0x560189[_0x82ad('0x48')][_0x82ad('0x49')][_0x82ad('0x40')](_0x4572ca);_0x560189[_0x82ad('0x48')][_0x82ad('0x4a')]=_0x3ca03d;break;case'User':if(_0x1d0594[_0x82ad('0x42')]===_0x82ad('0x4b')){_0x560189[_0x82ad('0x4c')][_0x53e490](_0x82ad('0x4d'),'%'+_0x1d0594[_0x82ad('0x3b')]+'%',null);}else{_0x34194=_['find'](_0x9f484b,[_0x82ad('0x8'),'UserId']);_0x1d0594[_0x82ad('0x7')]=_0x82ad('0x4e');_0x5734c0=as[_0x82ad('0x38')](_0x24c505,_0x34194[_0x82ad('0x39')],_0x1d0594);_0x560189[_0x82ad('0x4c')][_0x53e490](_0x5734c0[_0x82ad('0x3a')],_0x5734c0['value']['start'],_0x5734c0[_0x82ad('0x3b')][_0x82ad('0x3d')]);}break;case _0x82ad('0x4f'):case _0x82ad('0x50'):_0x5734c0=as[_0x82ad('0x38')]('me',null,_0x1d0594);_0x560189['body'][_0x53e490](_0x5734c0[_0x82ad('0x3a')],_0x5734c0[_0x82ad('0x3b')][_0x82ad('0x3c')],_0x5734c0[_0x82ad('0x3b')][_0x82ad('0x3d')]);break;}}}return _0x560189;}function parseModelFields(_0x4b9101,_0x3d6307,_0x40cd66){var _0x52081f=utils[_0x82ad('0x17')](_0x4b9101);var _0x4e561c=squel[_0x82ad('0x21')]();var _0x290498=_(_0x3d6307)[_0x82ad('0x51')]()[_0x82ad('0x16')](function(_0x3262ef){return _[_0x82ad('0x52')](_0x40cd66,['name',_0x3262ef])?_0x3262ef:undefined;})[_0x82ad('0x53')]()[_0x82ad('0x3b')]();if(_0x290498[_0x82ad('0x37')]>0x0){_0x290498['forEach'](function(_0x3d81c5){if(_0x3d81c5===_0x52081f){_0x4e561c['and']('i.'+_0x52081f+_0x82ad('0x15'),[][_0x82ad('0x54')](_0x3d6307[_0x3d81c5]));}else if(_0x3d81c5===_0x82ad('0x55')){var _0x25ce9e=JSON[_0x82ad('0x56')](_0x3d6307[_0x3d81c5])[_0x82ad('0x57')];var _0x55d199=JSON[_0x82ad('0x56')](_0x3d6307[_0x3d81c5])[_0x82ad('0x58')];_0x4e561c[_0x82ad('0x40')](_0x82ad('0x59'),_0x25ce9e,_0x55d199);}else{if(_0x3d6307[_0x3d81c5]===_0x82ad('0x5a')){_0x4e561c[_0x82ad('0x40')]('i.'+_0x3d81c5+_0x82ad('0x5b'));}else{_0x4e561c[_0x82ad('0x40')]('i.'+_0x3d81c5+_0x82ad('0x5c'),_0x3d6307[_0x3d81c5]);}}});}return _0x4e561c;}function parseQueryParameters(_0x9f78ef,_0x16aff7,_0x1314f9){var _0x2d0795=getSqlClauses();return Promise['resolve']()[_0x82ad('0x5d')](function(){return parseModelFields(_0x9f78ef,_0x16aff7,_0x1314f9);})[_0x82ad('0x5d')](function(_0x1f4f84){_0x2d0795[_0x82ad('0x5e')]['and'](_0x1f4f84);return parseReadParameter(_0x16aff7['read']);})[_0x82ad('0x5d')](function(_0x101fc2){_0x2d0795[_0x82ad('0x3f')][_0x82ad('0x40')](_0x101fc2);return parseTagParameter(_0x16aff7['tag']);})[_0x82ad('0x5d')](function(_0x726f20){_0x2d0795['tags'][_0x82ad('0x49')][_0x82ad('0x40')](_0x726f20);return parseSearchFilter(_0x9f78ef,_0x16aff7[_0x82ad('0x5f')]);})['then'](function(_0x33ce71){_0x2d0795[_0x82ad('0x5f')]=_0x33ce71;return _0x2d0795;});}function checkAccountsRestrictions(_0x157168,_0x394e0f,_0x55e040){var _0x403cb8=utils['getAccountFK'](_0x157168);var _0x2ff391=_0x82ad('0x60')+_['capitalize'](_0x157168)+(_0x157168===_0x82ad('0x61')?_0x82ad('0x62'):_0x82ad('0x63'));var _0x3c6428=squel[_0x82ad('0x21')]();return Promise[_0x82ad('0x64')]()[_0x82ad('0x5d')](function(){if(_0x55e040[_0x82ad('0x6')]&&_0x394e0f['role']===_0x82ad('0x65')){return _0x394e0f[_0x2ff391]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x924456){if(_0x924456){if(_0x924456[_0x82ad('0x37')]===0x0){_0x3c6428['and']('i.'+_0x403cb8+_0x82ad('0x5b'));}else{_0x3c6428[_0x82ad('0x40')]('i.'+_0x403cb8+_0x82ad('0x15'),_[_0x82ad('0x16')](_0x924456,'id'));}}else if(!_0x55e040[_0x403cb8]){_0x3c6428[_0x82ad('0x40')]('i.'+_0x403cb8+_0x82ad('0x66'));}})[_0x82ad('0x5d')](function(){return _0x3c6428;});}function getClosedOrderClause(_0x457ef9,_0x409ccf){var _0x49e1e2='';var _0x144430=['i.thirdDisposition',_0x82ad('0x67'),_0x82ad('0x68')];if(_0x457ef9==='mail'){_0x144430[_0x82ad('0x69')](_0x82ad('0x6a'));}if(_0x409ccf['closed']==='0'&&_0x457ef9===_0x82ad('0x2e')){_0x49e1e2='i.substatus';}else{if(_0x409ccf[_0x82ad('0x6b')]==='1'){_0x144430['shift']();}_0x49e1e2=_0x82ad('0x6c')+_0x144430[_0x82ad('0x6d')](',\x20')+')';}return _0x49e1e2;}function getFilteredInteractions(_0x192863,_0x1ef61f,_0x386d71,_0x4113d8){var _0x5458f3=utils[_0x82ad('0xb')](_0x192863);var _0x1ee56c=_[_0x82ad('0x6e')](_0x192863)+'Interaction';var _0x1078b6=[];var _0xcf4ce0=getTagsQuery();var _0x223a7f={'type':db[_0x82ad('0x6f')][_0x82ad('0x70')][_0x82ad('0x71')],'raw':!![]};var _0x55f01d=[];var _0x5a8a1c=[];return db[_0x82ad('0x72')][_0x82ad('0x73')](_0xcf4ce0[_0x82ad('0x74')](),_0x223a7f)[_0x82ad('0x5d')](function(_0x2e2445){_0x1078b6=_[_0x82ad('0x75')](_0x2e2445,'id');_0x223a7f=_['merge'](_0x223a7f,{'model':db[_0x1ee56c],'mapToModel':!![],'nest':!![]});if(_0x386d71['fields']){_0x4113d8[_0x82ad('0x76')][_0x82ad('0x77')](function(_0x3cd991){_0x1ef61f['field']('i.'+_0x3cd991);});}else{_0x1ef61f[_0x82ad('0x7')](_0x82ad('0x78'),_0x82ad('0x3e'));_0x1ef61f[_0x82ad('0x7')](_0x82ad('0x79'),_0x82ad('0x7a'));_0x1ef61f['field'](_0x82ad('0x7b'),_0x82ad('0x7c'));if(_0x192863==='mail'){_0x1ef61f['field'](_0x82ad('0x7d'),'Account.email');_0x1ef61f[_0x82ad('0x7')](_0x82ad('0x7e'),_0x82ad('0x7f'));_0x1ef61f[_0x82ad('0x7')]('i.id');_0x1ef61f[_0x82ad('0x7')]('i.createdAt');_0x1ef61f[_0x82ad('0x7')](_0x82ad('0x80'));_0x1ef61f['field'](_0x82ad('0x81'));_0x1ef61f[_0x82ad('0x7')](_0x82ad('0x82'));_0x1ef61f['field'](_0x82ad('0x83'));_0x1ef61f['field'](_0x82ad('0x84'));_0x1ef61f[_0x82ad('0x7')](_0x82ad('0x85'));_0x1ef61f['field'](_0x82ad('0x86'));_0x1ef61f[_0x82ad('0x7')](_0x82ad('0x68'));_0x1ef61f[_0x82ad('0x7')](_0x82ad('0x67'));_0x1ef61f[_0x82ad('0x7')](_0x82ad('0x87'));_0x1ef61f[_0x82ad('0x7')](_0x82ad('0x6a'));_0x1ef61f[_0x82ad('0x7')](_0x82ad('0x88'));_0x1ef61f[_0x82ad('0x7')]('i.ContactId');_0x1ef61f['field'](_0x82ad('0x89'));_0x1ef61f[_0x82ad('0x7')]('i.UserId');}else if(_0x192863===_0x82ad('0x2c')){_0x1ef61f[_0x82ad('0x7')](_0x82ad('0x8a'),_0x82ad('0x7f'));}else{_0x1ef61f[_0x82ad('0x7')]('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',_0x82ad('0x7f'));}if(_0x192863!=='mail'){_0x1ef61f[_0x82ad('0x7')]('i.*');}_0x1ef61f[_0x82ad('0x7')](_0x82ad('0x8b'),_0x82ad('0x8c'));_0x1ef61f['field'](_0x82ad('0x8d'),'Contact.lastName');_0x1ef61f['field']('c.email',_0x82ad('0x8e'));_0x1ef61f[_0x82ad('0x7')]('c.phone','Contact.phone');_0x1ef61f['field'](_0x82ad('0x8f'),_0x82ad('0x90'));_0x1ef61f[_0x82ad('0x7')]('c.fax','Contact.fax');_0x1ef61f['field'](_0x82ad('0x91'),_0x82ad('0x92'));_0x1ef61f[_0x82ad('0x7')](_0x82ad('0x93'),_0x82ad('0x94'));_0x1ef61f[_0x82ad('0x7')](_0x82ad('0x95'),'TagIds');}if(_0x4113d8[_0x82ad('0x96')]){_0x1ef61f[_0x82ad('0x96')](_0x4113d8[_0x82ad('0x96')]);}if(_0x4113d8['offset']){_0x1ef61f[_0x82ad('0x97')](_0x4113d8[_0x82ad('0x97')]);}return db['sequelize']['query'](_0x1ef61f[_0x82ad('0x74')](),_0x223a7f);})['then'](function(_0x5a3fd1){_0x55f01d=_0x5a3fd1;var _0x215c54=getUsersQuery(_0x192863,_0x55f01d);return db['sequelize']['query'](_0x215c54[_0x82ad('0x74')](),_0x223a7f);})[_0x82ad('0x5d')](function(_0x570f0d){_0x5a8a1c=_[_0x82ad('0x98')](_0x570f0d,_0x5458f3);if(_0x192863==='mail'){return db['Setting']['findOne']({'attributes':[_0x82ad('0x99')],'raw':!![]});}})[_0x82ad('0x5d')](function(_0x18ed88){var _0x5157bd=_0x18ed88?_0x18ed88[_0x82ad('0x99')]:undefined;var _0x5d98ab=_0x55f01d[_0x82ad('0x16')](function(_0x2a3d5a){return updateInteraction(_0x2a3d5a,_0x1078b6,_0x5a8a1c,_0x5157bd);});return Promise['all'](_0x5d98ab);});}function countFilteredInteractions(_0x3e6069,_0x18ae5b){var _0x915b3=_0x3e6069[_0x82ad('0x9a')]();_0x915b3[_0x82ad('0x7')](_0x82ad('0x9b'));_0x915b3[_0x82ad('0x7')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x82ad('0x3e'));var _0x2913f5=utils['getSelectedTags'](_0x18ae5b);if(!_[_0x82ad('0x9c')](_0x2913f5)){_0x915b3[_0x82ad('0x14')](_0x82ad('0x9d'),_0x2913f5);}var _0x4b9223={'type':db['Sequelize'][_0x82ad('0x70')]['SELECT'],'raw':!![]};return db[_0x82ad('0x72')][_0x82ad('0x73')](_0x915b3['toString'](),_0x4b9223);}module[_0x82ad('0x9e')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0xfdbf=['users','u.id\x20=\x20ui.UserId','length','where','map','getInteractionsTables','interactions','cm_contacts','o.id\x20=\x20i.UserId','accounts','a.id\x20=\x20i.','messages','me.','\x20=\x20i.id','interactionsTags','it.','expr','getSelectedTags','forEach','replace','{OPERATOR}','isNumeric','whatsapp','includes','i.phone\x20LIKE\x20?','fax','i.fax\x20LIKE\x20?','openchannel','i.from\x20LIKE\x20?','mail','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','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','find','type','default','text','start','value','end','unreadMessages','read','and','Contact','operator','$substring','split','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','Tag','tags','ids','User','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','keys','some','compact','concat','createdAt','parse','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','then','fields','tag','filter','chat','Websites','Accounts','resolve','\x20IS\x20NOT\x20NULL','i.thirdDisposition','i.secondDisposition','i.disposition','unshift','i.substatus','closed','shift','CONCAT_WS(\x27\x27,\x20','capitalize','Interaction','QueryTypes','sequelize','query','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','a.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.id','i.closed','i.lastMsgAt','i.subject','i.to','i.ContactId','i.MailAccountId','i.UserId','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','groupBy','findOne','enableEmailPreview','COUNT(*)','isEmpty','t.id\x20IN\x20?','Sequelize','SELECT','exports','lodash','../parsers/advancedSearch','./update-interaction','updateInteraction','./utils','../../mysqldb','getAccountFK','role','agent','search','select','field','name','color','from','tools_tags','getInteractionFK','user_has_','_interactions','u.id','u.fullname','ui.','left_join'];(function(_0x2a8037,_0x41f312){var _0x1904cf=function(_0x5662f0){while(--_0x5662f0){_0x2a8037['push'](_0x2a8037['shift']());}};_0x1904cf(++_0x41f312);}(_0xfdbf,0x139));var _0xffdb=function(_0x18afca,_0x4219d9){_0x18afca=_0x18afca-0x0;var _0x11603f=_0xfdbf[_0x18afca];return _0x11603f;};'use strict';var _=require(_0xffdb('0x0'));var squel=require('squel');var as=require(_0xffdb('0x1'));var qs=require('../parsers/qs');var updateInteraction=require(_0xffdb('0x2'))[_0xffdb('0x3')];var utils=require(_0xffdb('0x4'));var db=require(_0xffdb('0x5'))['db'];function skipInteractionsQuery(_0x1df64e,_0x8c8fe9,_0x41fff3){var _0x30df68=![];var _0x23e4e5=utils[_0xffdb('0x6')](_0x1df64e);if(_0x8c8fe9[_0xffdb('0x7')]===_0xffdb('0x8')&&!_0x41fff3[_0xffdb('0x9')]&&!_0x41fff3[_0x23e4e5]){_0x30df68=!![];}return _0x30df68;}function getTagsQuery(){return squel[_0xffdb('0xa')]()[_0xffdb('0xb')]('id')['field'](_0xffdb('0xc'))[_0xffdb('0xb')](_0xffdb('0xd'))[_0xffdb('0xe')](_0xffdb('0xf'));}function getUsersQuery(_0x3301f3,_0x427334){var _0x3426c4=utils[_0xffdb('0x10')](_0x3301f3);var _0xa15930=_0xffdb('0x11')+_0x3301f3+_0xffdb('0x12');var _0x1ca7e=squel[_0xffdb('0xa')]()[_0xffdb('0xb')](_0xffdb('0x13'))[_0xffdb('0xb')](_0xffdb('0x14'))[_0xffdb('0xb')](_0xffdb('0x15')+_0x3426c4)[_0xffdb('0xe')](_0xa15930,'ui')[_0xffdb('0x16')](_0xffdb('0x17'),'u',_0xffdb('0x18'));if(_0x427334[_0xffdb('0x19')]>0x0){_0x1ca7e[_0xffdb('0x1a')]('ui.'+_0x3426c4+'\x20IN\x20?',_[_0xffdb('0x1b')](_0x427334,'id'));}return _0x1ca7e;}function getInteractionsQuery(_0x329bf6){var _0x4dca29=utils[_0xffdb('0x1c')](_0x329bf6);var _0xcb86d6=utils['getAccountFK'](_0x329bf6);var _0x477f65=utils['getInteractionFK'](_0x329bf6);return squel[_0xffdb('0xa')]()[_0xffdb('0xe')](_0x4dca29[_0xffdb('0x1d')],'i')[_0xffdb('0x16')](_0xffdb('0x1e'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xffdb('0x16')]('users','o',_0xffdb('0x1f'))['left_join'](_0x4dca29[_0xffdb('0x20')],'a',_0xffdb('0x21')+_0xcb86d6)[_0xffdb('0x16')](_0x4dca29[_0xffdb('0x22')],'me',_0xffdb('0x23')+_0x477f65+_0xffdb('0x24'))[_0xffdb('0x16')](_0x4dca29[_0xffdb('0x25')],'it',_0xffdb('0x26')+_0x477f65+_0xffdb('0x24'))[_0xffdb('0x16')](_0xffdb('0xf'),'t','t.id\x20=\x20it.TagId');}function getSqlClauses(){var _0x4bf320={'body':squel[_0xffdb('0x27')](),'contact':squel[_0xffdb('0x27')](),'default':squel[_0xffdb('0x27')](),'fields':squel['expr'](),'filter':squel[_0xffdb('0x27')](),'read':squel[_0xffdb('0x27')](),'tags':{'clause':squel[_0xffdb('0x27')](),'ids':null},'user':squel[_0xffdb('0x27')]()};return _0x4bf320;}function parseTagParameter(_0x1f959f){var _0x252888=squel[_0xffdb('0x27')]();if(_0x1f959f){var _0x3f68cf=utils[_0xffdb('0x28')](_0x1f959f);_0x3f68cf[_0xffdb('0x29')](function(_0x3956bc){_0x252888['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3956bc+',%');});}return _0x252888;}function parseReadParameter(_0x4d98db){var _0x1fdc81='';if(_0x4d98db){_0x1fdc81='unreadMessages\x20{OPERATOR}\x200';if(_0x4d98db==='1'){_0x1fdc81=_0x1fdc81[_0xffdb('0x2a')](_0xffdb('0x2b'),'=');}else{_0x1fdc81=_0x1fdc81[_0xffdb('0x2a')](_0xffdb('0x2b'),'>');}}return _0x1fdc81;}function parseSearchFilter(_0x6c73d1,_0x2332cf){var _0x105feb=squel['expr']();if(_0x2332cf){var _0x15be07=_0x2332cf['replace']('\x5c','\x5c\x5c')[_0xffdb('0x2a')](/'/g,'\x27\x27');if(qs[_0xffdb('0x2c')](_0x15be07)){_0x105feb['or']('i.id\x20LIKE\x20?',_0x15be07+'%');if(['sms',_0xffdb('0x2d')][_0xffdb('0x2e')](_0x6c73d1)){_0x105feb['or'](_0xffdb('0x2f'),_0x15be07+'%');}else if(_0x6c73d1===_0xffdb('0x30')){_0x105feb['or'](_0xffdb('0x31'),_0x15be07+'%');}else if(_0x6c73d1===_0xffdb('0x32')){_0x105feb['or'](_0xffdb('0x33'),_0x15be07+'%');}}else if(_0x6c73d1===_0xffdb('0x34')&&qs[_0xffdb('0x35')](_0x15be07)){_0x105feb['or'](_0xffdb('0x36'),_0x15be07+'%');}else{if(_0x6c73d1==='mail'){_0x105feb['or'](_0xffdb('0x37'),qs[_0xffdb('0x38')](_0x15be07,!![]))['or'](_0xffdb('0x39'),qs[_0xffdb('0x38')](_0x15be07));}else if(_0x6c73d1!==_0xffdb('0x30')){_0x105feb['or'](_0xffdb('0x3a'),qs[_0xffdb('0x38')](_0x15be07));}_0x105feb['or'](_0xffdb('0x3b'),qs[_0xffdb('0x38')](_0x15be07,!![]),null);}}return _0x105feb;}function parseAdvancedSearchFilter(_0x17ef13,_0x120132){var _0x5179a7=getSqlClauses();var _0x46b4db=as['parseSearch'](_0x17ef13);var _0x253f9a=_0x46b4db[_0xffdb('0x3c')];for(var _0x46c84e=0x0;_0x46c84e<_0x46b4db[_0xffdb('0x3d')]['length'];_0x46c84e++){var _0x1e24c4=_0x46b4db[_0xffdb('0x3d')][_0x46c84e];var _0x339d05='i';var _0x2f9e66=_[_0xffdb('0x3e')](_0x120132,[_0xffdb('0xc'),_0x1e24c4['field']]);if(_0x2f9e66){var _0x42be8e=as['buildExpression'](_0x339d05,_0x2f9e66[_0xffdb('0x3f')],_0x1e24c4);_0x5179a7[_0xffdb('0x40')][_0x253f9a](_0x42be8e[_0xffdb('0x41')],_0x42be8e['value'][_0xffdb('0x42')],_0x42be8e[_0xffdb('0x43')][_0xffdb('0x44')]);}else{switch(_0x1e24c4[_0xffdb('0xb')]){case _0xffdb('0x45'):var _0x250a8b=parseReadParameter(_0x1e24c4[_0xffdb('0x43')]);_0x5179a7[_0xffdb('0x46')][_0xffdb('0x47')](_0x250a8b);break;case _0xffdb('0x48'):if(_0x1e24c4[_0xffdb('0x49')]===_0xffdb('0x4a')){if(_0x1e24c4[_0xffdb('0x43')][_0xffdb('0x4b')]('\x20')['length']>0x1){_0x5179a7[_0xffdb('0x4c')][_0x253f9a](_0xffdb('0x3b'),qs['getFullTextValue'](_0x1e24c4[_0xffdb('0x43')],!![]),null);}else{var _0x2203b5='%'+_0x1e24c4[_0xffdb('0x43')]+'%';_0x5179a7[_0xffdb('0x4c')][_0x253f9a](_0xffdb('0x4d'),_0x2203b5,_0x2203b5,_0x2203b5);}}else{_0x2f9e66=_['find'](_0x120132,[_0xffdb('0xc'),_0xffdb('0x4e')]);_0x1e24c4[_0xffdb('0xb')]=_0xffdb('0x4e');_0x42be8e=as[_0xffdb('0x4f')](_0x339d05,_0x2f9e66[_0xffdb('0x3f')],_0x1e24c4);_0x5179a7[_0xffdb('0x4c')][_0x253f9a](_0x42be8e[_0xffdb('0x41')],_0x42be8e['value'][_0xffdb('0x42')],_0x42be8e[_0xffdb('0x43')][_0xffdb('0x44')]);}break;case _0xffdb('0x50'):var _0x4bb072=_0x1e24c4['value']['split'](',')[_0xffdb('0x1b')](function(_0x69e06c){return Number(_0x69e06c);});var _0x886be8=parseTagParameter(_0x4bb072);_0x5179a7[_0xffdb('0x51')]['clause'][_0xffdb('0x47')](_0x886be8);_0x5179a7[_0xffdb('0x51')][_0xffdb('0x52')]=_0x4bb072;break;case _0xffdb('0x53'):if(_0x1e24c4[_0xffdb('0x49')]==='$substring'){_0x5179a7[_0xffdb('0x54')][_0x253f9a](_0xffdb('0x55'),'%'+_0x1e24c4[_0xffdb('0x43')]+'%',null);}else{_0x2f9e66=_[_0xffdb('0x3e')](_0x120132,[_0xffdb('0xc'),'UserId']);_0x1e24c4[_0xffdb('0xb')]=_0xffdb('0x56');_0x42be8e=as[_0xffdb('0x4f')](_0x339d05,_0x2f9e66[_0xffdb('0x3f')],_0x1e24c4);_0x5179a7[_0xffdb('0x54')][_0x253f9a](_0x42be8e[_0xffdb('0x41')],_0x42be8e['value'][_0xffdb('0x42')],_0x42be8e['value'][_0xffdb('0x44')]);}break;case _0xffdb('0x57'):case'plainBody':_0x42be8e=as[_0xffdb('0x4f')]('me',null,_0x1e24c4);_0x5179a7[_0xffdb('0x57')][_0x253f9a](_0x42be8e[_0xffdb('0x41')],_0x42be8e[_0xffdb('0x43')][_0xffdb('0x42')],_0x42be8e['value'][_0xffdb('0x44')]);break;}}}return _0x5179a7;}function parseModelFields(_0x5e66f3,_0x5590c3,_0x476bee){var _0x84ff91=utils[_0xffdb('0x6')](_0x5e66f3);var _0x502ab9=squel[_0xffdb('0x27')]();var _0x1d8520=_(_0x5590c3)[_0xffdb('0x58')]()['map'](function(_0x2eae0c){return _[_0xffdb('0x59')](_0x476bee,[_0xffdb('0xc'),_0x2eae0c])?_0x2eae0c:undefined;})[_0xffdb('0x5a')]()[_0xffdb('0x43')]();if(_0x1d8520[_0xffdb('0x19')]>0x0){_0x1d8520[_0xffdb('0x29')](function(_0x222b6e){if(_0x222b6e===_0x84ff91){_0x502ab9[_0xffdb('0x47')]('i.'+_0x84ff91+'\x20IN\x20?',[][_0xffdb('0x5b')](_0x5590c3[_0x222b6e]));}else if(_0x222b6e===_0xffdb('0x5c')){var _0x51d6a8=JSON[_0xffdb('0x5d')](_0x5590c3[_0x222b6e])[_0xffdb('0x5e')];var _0x5bd198=JSON[_0xffdb('0x5d')](_0x5590c3[_0x222b6e])[_0xffdb('0x5f')];_0x502ab9['and']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x51d6a8,_0x5bd198);}else{if(_0x5590c3[_0x222b6e]===_0xffdb('0x60')){_0x502ab9[_0xffdb('0x47')]('i.'+_0x222b6e+_0xffdb('0x61'));}else{_0x502ab9[_0xffdb('0x47')]('i.'+_0x222b6e+_0xffdb('0x62'),_0x5590c3[_0x222b6e]);}}});}return _0x502ab9;}function parseQueryParameters(_0x145139,_0x52398f,_0x5d303e){var _0x5eb183=getSqlClauses();return Promise['resolve']()['then'](function(){return parseModelFields(_0x145139,_0x52398f,_0x5d303e);})[_0xffdb('0x63')](function(_0x177a0d){_0x5eb183[_0xffdb('0x64')]['and'](_0x177a0d);return parseReadParameter(_0x52398f['read']);})[_0xffdb('0x63')](function(_0x39c846){_0x5eb183[_0xffdb('0x46')][_0xffdb('0x47')](_0x39c846);return parseTagParameter(_0x52398f[_0xffdb('0x65')]);})[_0xffdb('0x63')](function(_0x4efa9c){_0x5eb183['tags']['clause'][_0xffdb('0x47')](_0x4efa9c);return parseSearchFilter(_0x145139,_0x52398f[_0xffdb('0x66')]);})[_0xffdb('0x63')](function(_0x4d966a){_0x5eb183[_0xffdb('0x66')]=_0x4d966a;return _0x5eb183;});}function checkAccountsRestrictions(_0xb40d38,_0x1b5690,_0x311671){var _0x1ca955=utils['getAccountFK'](_0xb40d38);var _0x134f17='get'+_['capitalize'](_0xb40d38)+(_0xb40d38===_0xffdb('0x67')?_0xffdb('0x68'):_0xffdb('0x69'));var _0x416501=squel[_0xffdb('0x27')]();return Promise[_0xffdb('0x6a')]()[_0xffdb('0x63')](function(){if(_0x311671['search']&&_0x1b5690['role']===_0xffdb('0x8')){return _0x1b5690[_0x134f17]({'attributes':['id'],'raw':!![]});}})[_0xffdb('0x63')](function(_0x4920c2){if(_0x4920c2){if(_0x4920c2[_0xffdb('0x19')]===0x0){_0x416501[_0xffdb('0x47')]('i.'+_0x1ca955+_0xffdb('0x61'));}else{_0x416501[_0xffdb('0x47')]('i.'+_0x1ca955+'\x20IN\x20?',_[_0xffdb('0x1b')](_0x4920c2,'id'));}}else if(!_0x311671[_0x1ca955]){_0x416501[_0xffdb('0x47')]('i.'+_0x1ca955+_0xffdb('0x6b'));}})['then'](function(){return _0x416501;});}function getClosedOrderClause(_0x12d6e5,_0x22fbf2){var _0x4acf94='';var _0x218e56=[_0xffdb('0x6c'),_0xffdb('0x6d'),_0xffdb('0x6e')];if(_0x12d6e5===_0xffdb('0x34')){_0x218e56[_0xffdb('0x6f')](_0xffdb('0x70'));}if(_0x22fbf2[_0xffdb('0x71')]==='0'&&_0x12d6e5===_0xffdb('0x34')){_0x4acf94=_0xffdb('0x70');}else{if(_0x22fbf2['closed']==='1'){_0x218e56[_0xffdb('0x72')]();}_0x4acf94=_0xffdb('0x73')+_0x218e56['join'](',\x20')+')';}return _0x4acf94;}function getFilteredInteractions(_0x12a86d,_0xbff3df,_0x16f57b,_0x4606ac){var _0x5454fe=utils[_0xffdb('0x10')](_0x12a86d);var _0x28f75c=_[_0xffdb('0x74')](_0x12a86d)+_0xffdb('0x75');var _0x1e59d7=[];var _0x49a2a2=getTagsQuery();var _0x2c4bf1={'type':db['Sequelize'][_0xffdb('0x76')]['SELECT'],'raw':!![]};var _0x5a5ab3=[];var _0x1e603c=[];return db[_0xffdb('0x77')][_0xffdb('0x78')](_0x49a2a2[_0xffdb('0x79')](),_0x2c4bf1)['then'](function(_0x27bd50){_0x1e59d7=_[_0xffdb('0x7a')](_0x27bd50,'id');_0x2c4bf1=_[_0xffdb('0x7b')](_0x2c4bf1,{'model':db[_0x28f75c],'mapToModel':!![],'nest':!![]});if(_0x16f57b[_0xffdb('0x64')]){_0x4606ac['attributes'][_0xffdb('0x29')](function(_0x32942c){_0xbff3df['field']('i.'+_0x32942c);});}else{_0xbff3df['field'](_0xffdb('0x7c'),_0xffdb('0x45'));_0xbff3df['field'](_0xffdb('0x7d'),_0xffdb('0x7e'));_0xbff3df[_0xffdb('0xb')](_0xffdb('0x7f'),'Account.mandatoryDisposition');if(_0x12a86d==='mail'){_0xbff3df[_0xffdb('0xb')](_0xffdb('0x80'),'Account.email');_0xbff3df[_0xffdb('0xb')](_0xffdb('0x81'),'contactName');_0xbff3df[_0xffdb('0xb')](_0xffdb('0x82'));_0xbff3df[_0xffdb('0xb')]('i.createdAt');_0xbff3df[_0xffdb('0xb')]('i.updatedAt');_0xbff3df[_0xffdb('0xb')](_0xffdb('0x83'));_0xbff3df[_0xffdb('0xb')]('i.closedAt');_0xbff3df[_0xffdb('0xb')]('i.attach');_0xbff3df[_0xffdb('0xb')](_0xffdb('0x84'));_0xbff3df[_0xffdb('0xb')]('i.lastMsgDirection');_0xbff3df[_0xffdb('0xb')](_0xffdb('0x85'));_0xbff3df[_0xffdb('0xb')](_0xffdb('0x6e'));_0xbff3df[_0xffdb('0xb')](_0xffdb('0x6d'));_0xbff3df['field'](_0xffdb('0x6c'));_0xbff3df[_0xffdb('0xb')](_0xffdb('0x70'));_0xbff3df[_0xffdb('0xb')](_0xffdb('0x86'));_0xbff3df[_0xffdb('0xb')](_0xffdb('0x87'));_0xbff3df['field'](_0xffdb('0x88'));_0xbff3df[_0xffdb('0xb')](_0xffdb('0x89'));}else if(_0x12a86d===_0xffdb('0x32')){_0xbff3df[_0xffdb('0xb')](_0xffdb('0x8a'),_0xffdb('0x8b'));}else{_0xbff3df[_0xffdb('0xb')](_0xffdb('0x8c'),_0xffdb('0x8b'));}if(_0x12a86d!==_0xffdb('0x34')){_0xbff3df['field'](_0xffdb('0x8d'));}_0xbff3df[_0xffdb('0xb')](_0xffdb('0x8e'),_0xffdb('0x8f'));_0xbff3df[_0xffdb('0xb')](_0xffdb('0x90'),_0xffdb('0x91'));_0xbff3df[_0xffdb('0xb')](_0xffdb('0x92'),'Contact.email');_0xbff3df['field'](_0xffdb('0x93'),_0xffdb('0x94'));_0xbff3df['field'](_0xffdb('0x95'),_0xffdb('0x96'));_0xbff3df[_0xffdb('0xb')]('c.fax','Contact.fax');_0xbff3df[_0xffdb('0xb')](_0xffdb('0x97'),_0xffdb('0x98'));_0xbff3df[_0xffdb('0xb')](_0xffdb('0x99'),_0xffdb('0x9a'));_0xbff3df['field'](_0xffdb('0x9b'),_0xffdb('0x9c'));}if(_0x4606ac[_0xffdb('0x9d')]){_0xbff3df[_0xffdb('0x9d')](_0x4606ac['limit']);}if(_0x4606ac['offset']){_0xbff3df[_0xffdb('0x9e')](_0x4606ac[_0xffdb('0x9e')]);}return db[_0xffdb('0x77')][_0xffdb('0x78')](_0xbff3df[_0xffdb('0x79')](),_0x2c4bf1);})[_0xffdb('0x63')](function(_0x3a2beb){_0x5a5ab3=_0x3a2beb;var _0xd82483=getUsersQuery(_0x12a86d,_0x5a5ab3);return db[_0xffdb('0x77')][_0xffdb('0x78')](_0xd82483['toString'](),_0x2c4bf1);})[_0xffdb('0x63')](function(_0x5b23d7){_0x1e603c=_[_0xffdb('0x9f')](_0x5b23d7,_0x5454fe);if(_0x12a86d===_0xffdb('0x34')){return db['Setting'][_0xffdb('0xa0')]({'attributes':[_0xffdb('0xa1')],'raw':!![]});}})[_0xffdb('0x63')](function(_0x57f3c1){var _0x1036cf=_0x57f3c1?_0x57f3c1[_0xffdb('0xa1')]:undefined;var _0x38e78c=_0x5a5ab3[_0xffdb('0x1b')](function(_0x4f6aef){return updateInteraction(_0x4f6aef,_0x1e59d7,_0x1e603c,_0x1036cf);});return Promise['all'](_0x38e78c);});}function countFilteredInteractions(_0x217fb4,_0x55197d){var _0x49bd46=_0x217fb4['clone']();_0x49bd46['field'](_0xffdb('0xa2'));_0x49bd46[_0xffdb('0xb')](_0xffdb('0x7c'),_0xffdb('0x45'));var _0x2d47b8=utils[_0xffdb('0x28')](_0x55197d);if(!_[_0xffdb('0xa3')](_0x2d47b8)){_0x49bd46['where'](_0xffdb('0xa4'),_0x2d47b8);}var _0x1cfe50={'type':db[_0xffdb('0xa5')][_0xffdb('0x76')][_0xffdb('0xa6')],'raw':!![]};return db['sequelize'][_0xffdb('0x78')](_0x49bd46[_0xffdb('0x79')](),_0x1cfe50);}module[_0xffdb('0xa7')]={'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 f4c8314..bd7b6ab 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 _0x1f98=['out','plainBody','-id','lastMsgText','catch','then','Users','TagIds','Tags','lodash','map','fullname','split','forEach','push','waiting','talking','answered','abandoned','total','closed','disposition','UserId','unmanaged','MailMessage'];(function(_0x2e4b84,_0x19ad5a){var _0x3a0444=function(_0x2a86db){while(--_0x2a86db){_0x2e4b84['push'](_0x2e4b84['shift']());}};_0x3a0444(++_0x19ad5a);}(_0x1f98,0xb8));var _0x81f9=function(_0x399453,_0x5aaf3a){_0x399453=_0x399453-0x0;var _0x56dc72=_0x1f98[_0x399453];return _0x56dc72;};'use strict';var _=require(_0x81f9('0x0'));var db=require('../../mysqldb')['db'];function getInteractionUsers(_0x3ce163,_0x42a574){return new Promise(function(_0x522f6,_0x4032e5){try{var _0x28e63b=[];if(_0x42a574[_0x3ce163]){_0x28e63b=_0x42a574[_0x3ce163][_0x81f9('0x1')](function(_0x569465){return{'id':_0x569465['id'],'fullname':_0x569465[_0x81f9('0x2')]};});}return _0x522f6(_0x28e63b);}catch(_0x29ca97){_0x4032e5(_0x29ca97);}});}function getInteractionTags(_0x21fb62,_0x5db466){var _0x3b692c=[];if(_0x21fb62){_0x21fb62[_0x81f9('0x3')](',')[_0x81f9('0x4')](function(_0x497565){_0x3b692c[_0x81f9('0x5')](_0x5db466[_0x497565]);});}return _0x3b692c;}function updateWaitingCounter(_0x3ed64e){if(_0x3ed64e['waiting']){_0x3ed64e['waiting']-=0x1;}}function updateInteractionCounters(_0x56d9af){_0x56d9af[_0x81f9('0x6')]=0x0;_0x56d9af[_0x81f9('0x7')]=0x0;_0x56d9af[_0x81f9('0x8')]=0x0;_0x56d9af['unmanaged']=0x0;_0x56d9af[_0x81f9('0x9')]=0x0;_0x56d9af[_0x81f9('0xa')]=0x0;if(_0x56d9af[_0x81f9('0xb')]){if(_0x56d9af[_0x81f9('0xc')]===_0x81f9('0x9')){_0x56d9af['abandoned']+=0x1;updateWaitingCounter(_0x56d9af);}if(_0x56d9af[_0x81f9('0xd')]){_0x56d9af[_0x81f9('0x8')]+=0x1;if(_0x56d9af[_0x81f9('0x7')]){_0x56d9af['talking']-=0x1;}}else{if(_0x56d9af[_0x81f9('0xc')]){_0x56d9af[_0x81f9('0xe')]+=0x1;updateWaitingCounter(_0x56d9af);}}}else{if(!_0x56d9af['UserId']){_0x56d9af[_0x81f9('0x6')]+=0x1;}if(_0x56d9af[_0x81f9('0xd')]){_0x56d9af['talking']+=0x1;updateWaitingCounter(_0x56d9af);}}_0x56d9af[_0x81f9('0xa')]+=0x1;return _0x56d9af;}function getLastMessageText(_0x597c10){return db[_0x81f9('0xf')]['findOne']({'where':{'$and':[{'MailInteractionId':_0x597c10['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x81f9('0x10')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x81f9('0x11')],'order':_0x81f9('0x12'),'raw':!![]})['then'](function(_0x192917){if(_0x192917&&_0x192917['plainBody']){_0x597c10[_0x81f9('0x13')]=_['trimStart'](_0x192917[_0x81f9('0x11')]);}return _0x597c10;})[_0x81f9('0x14')](function(_0x567d03){throw _0x567d03;});}exports['updateInteraction']=function(_0x40c5c2,_0x4fff5e,_0xd65509,_0x4396a2){return new Promise(function(_0x3cc6a8,_0x5d80d6){return getInteractionUsers(_0x40c5c2['id'],_0xd65509)[_0x81f9('0x15')](function(_0x3956a4){_0x40c5c2[_0x81f9('0x16')]=_0x3956a4;return getInteractionTags(_0x40c5c2[_0x81f9('0x17')],_0x4fff5e);})[_0x81f9('0x15')](function(_0x10adea){_0x40c5c2[_0x81f9('0x18')]=_0x10adea;delete _0x40c5c2['TagIds'];return updateInteractionCounters(_0x40c5c2);})[_0x81f9('0x15')](function(_0x53ef81){if(_0x4396a2){return getLastMessageText(_0x53ef81);}else{return _0x53ef81;}})['then'](function(_0xf9a77){_0x3cc6a8(_0xf9a77);})[_0x81f9('0x14')](function(_0xffaf94){_0x5d80d6(_0xffaf94);});});}; \ No newline at end of file +var _0x3af5=['talking','disposition','MailMessage','findOne','out','plainBody','-id','then','lastMsgText','catch','updateInteraction','TagIds','Tags','lodash','map','fullname','split','forEach','push','waiting','answered','unmanaged','abandoned','total','UserId'];(function(_0x139a3c,_0x4fc883){var _0x2b375b=function(_0x525dbf){while(--_0x525dbf){_0x139a3c['push'](_0x139a3c['shift']());}};_0x2b375b(++_0x4fc883);}(_0x3af5,0x8a));var _0x53af=function(_0xa711b,_0x81a280){_0xa711b=_0xa711b-0x0;var _0x1f061d=_0x3af5[_0xa711b];return _0x1f061d;};'use strict';var _=require(_0x53af('0x0'));var db=require('../../mysqldb')['db'];function getInteractionUsers(_0x161b56,_0x16631f){return new Promise(function(_0x3d9633,_0x12cd40){try{var _0x106d24=[];if(_0x16631f[_0x161b56]){_0x106d24=_0x16631f[_0x161b56][_0x53af('0x1')](function(_0x81513e){return{'id':_0x81513e['id'],'fullname':_0x81513e[_0x53af('0x2')]};});}return _0x3d9633(_0x106d24);}catch(_0x4a0bd4){_0x12cd40(_0x4a0bd4);}});}function getInteractionTags(_0x5d0ec5,_0x44b039){var _0x23dc12=[];if(_0x5d0ec5){_0x5d0ec5[_0x53af('0x3')](',')[_0x53af('0x4')](function(_0x54eb82){_0x23dc12[_0x53af('0x5')](_0x44b039[_0x54eb82]);});}return _0x23dc12;}function updateWaitingCounter(_0x8cb9ae){if(_0x8cb9ae[_0x53af('0x6')]){_0x8cb9ae[_0x53af('0x6')]-=0x1;}}function updateInteractionCounters(_0x2f7d71){_0x2f7d71[_0x53af('0x6')]=0x0;_0x2f7d71['talking']=0x0;_0x2f7d71[_0x53af('0x7')]=0x0;_0x2f7d71[_0x53af('0x8')]=0x0;_0x2f7d71[_0x53af('0x9')]=0x0;_0x2f7d71[_0x53af('0xa')]=0x0;if(_0x2f7d71['closed']){if(_0x2f7d71['disposition']===_0x53af('0x9')){_0x2f7d71[_0x53af('0x9')]+=0x1;updateWaitingCounter(_0x2f7d71);}if(_0x2f7d71[_0x53af('0xb')]){_0x2f7d71[_0x53af('0x7')]+=0x1;if(_0x2f7d71['talking']){_0x2f7d71[_0x53af('0xc')]-=0x1;}}else{if(_0x2f7d71[_0x53af('0xd')]){_0x2f7d71[_0x53af('0x8')]+=0x1;updateWaitingCounter(_0x2f7d71);}}}else{if(!_0x2f7d71[_0x53af('0xb')]){_0x2f7d71[_0x53af('0x6')]+=0x1;}if(_0x2f7d71['UserId']){_0x2f7d71[_0x53af('0xc')]+=0x1;updateWaitingCounter(_0x2f7d71);}}_0x2f7d71[_0x53af('0xa')]+=0x1;return _0x2f7d71;}function getLastMessageText(_0x19c3d7){return db[_0x53af('0xe')][_0x53af('0xf')]({'where':{'$and':[{'MailInteractionId':_0x19c3d7['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x53af('0x10')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x53af('0x11')],'order':_0x53af('0x12'),'raw':!![]})[_0x53af('0x13')](function(_0x357c6b){if(_0x357c6b&&_0x357c6b[_0x53af('0x11')]){_0x19c3d7[_0x53af('0x14')]=_['trimStart'](_0x357c6b['plainBody']);}return _0x19c3d7;})[_0x53af('0x15')](function(_0x17ce47){throw _0x17ce47;});}exports[_0x53af('0x16')]=function(_0x5d9210,_0x294f15,_0x1fa7b9,_0x23b8e2){return new Promise(function(_0x1e54c4,_0x1a0b3c){return getInteractionUsers(_0x5d9210['id'],_0x1fa7b9)[_0x53af('0x13')](function(_0x36288a){_0x5d9210['Users']=_0x36288a;return getInteractionTags(_0x5d9210[_0x53af('0x17')],_0x294f15);})['then'](function(_0x3e82e6){_0x5d9210[_0x53af('0x18')]=_0x3e82e6;delete _0x5d9210['TagIds'];return updateInteractionCounters(_0x5d9210);})[_0x53af('0x13')](function(_0x2ca615){if(_0x23b8e2){return getLastMessageText(_0x2ca615);}else{return _0x2ca615;}})[_0x53af('0x13')](function(_0x56aadb){_0x1e54c4(_0x56aadb);})[_0x53af('0x15')](function(_0x1f4ce0){_0x1a0b3c(_0x1f4ce0);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index ab8af1c..f27d228 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 _0xf1e0=['catch','error','exports','lodash','../../mysqldb','openchannel-interactions','../../config/logger','chat-interactions','whatsapp-interactions','capitalize','chat','Website','Account','InteractionId','upperFirst','unknown','accounts','_interactions','_interaction_has_tags','isArray','toLowerCase','toUpperCase','name','Interaction','findOne','then','update'];(function(_0x3b9e52,_0x303893){var _0x2a6c2d=function(_0x28fc41){while(--_0x28fc41){_0x3b9e52['push'](_0x3b9e52['shift']());}};_0x2a6c2d(++_0x303893);}(_0xf1e0,0xa5));var _0x0f1e=function(_0x4b3368,_0x45aa76){_0x4b3368=_0x4b3368-0x0;var _0x2ef835=_0xf1e0[_0x4b3368];return _0x2ef835;};'use strict';var _=require(_0x0f1e('0x0'));var db=require(_0x0f1e('0x1'))['db'];var loggers={'openchannel':require('../../config/logger')(_0x0f1e('0x2')),'mail':require(_0x0f1e('0x3'))('mail-interactions'),'fax':require(_0x0f1e('0x3'))('fax-interactions'),'sms':require(_0x0f1e('0x3'))('sms-interactions'),'chat':require(_0x0f1e('0x3'))(_0x0f1e('0x4')),'whatsapp':require(_0x0f1e('0x3'))(_0x0f1e('0x5'))};function getAccountFK(_0x3253cf){return _[_0x0f1e('0x6')](_0x3253cf)+(_0x3253cf===_0x0f1e('0x7')?_0x0f1e('0x8'):_0x0f1e('0x9'))+'Id';}function getInteractionFK(_0x3f27a9){return _[_0x0f1e('0x6')](_0x3f27a9)+_0x0f1e('0xa');}function getInteractionId(_0x253aac,_0x10ae80,_0x5af9d8){if(_0x253aac&&_0x253aac[_['upperFirst'](_0x5af9d8)+'InteractionId']){return _0x253aac[_[_0x0f1e('0xb')](_0x5af9d8)+_0x0f1e('0xa')];}else if(_0x253aac&&_0x253aac['id']){return _0x253aac['id'];}else if(_0x10ae80&&_0x10ae80['id']){return _0x10ae80['id'];}else{return _0x0f1e('0xc');}}function getInteractionsTables(_0x11181f){return{'accounts':_0x11181f+'_'+(_0x11181f==='chat'?'websites':_0x0f1e('0xd')),'interactions':_0x11181f+_0x0f1e('0xe'),'interactionsTags':_0x11181f+_0x0f1e('0xf'),'messages':_0x11181f+'_messages','userInteractions':'user_has_'+_0x11181f+_0x0f1e('0xe')};}function getSelectedTags(_0x471fe1){var _0x1d3e95=[];if(_0x471fe1){_0x1d3e95=Array[_0x0f1e('0x10')](_0x471fe1)?_0x471fe1:[_0x471fe1];}return _0x1d3e95;}function log(_0x4647a2,_0x35f9e2,_0x2e1926,_0x3a9c36,_0x234a97,_0x23ed19){loggers[_0x234a97[_0x0f1e('0x11')]()][_0x4647a2]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x23ed19[_0x0f1e('0x12')](),_0x35f9e2?_0x35f9e2['id']:null,_0x35f9e2?_0x35f9e2[_0x0f1e('0x13')]:null,_0x35f9e2?_0x35f9e2['role']:null,getInteractionId(_0x2e1926,_0x3a9c36,_0x234a97),_0x2e1926?JSON['stringify'](_0x2e1926):'null');}function updateUser(_0x442e41,_0x128632,_0x63fe95,_0x1a8a5b,_0x2e7983){db[_[_0x0f1e('0xb')](_0x1a8a5b)+_0x0f1e('0x14')][_0x0f1e('0x15')]({'where':{'id':getInteractionId(_0x128632,_0x63fe95,_0x1a8a5b)}})[_0x0f1e('0x16')](function(_0x115c62){if(_0x115c62){return _0x115c62[_0x0f1e('0x17')]({'UserId':_0x442e41?_0x442e41['id']:null});}})['then'](function(_0x465427){if(_0x465427){log('info',_0x442e41,_0x128632,_0x63fe95,_0x1a8a5b,_0x2e7983);}})[_0x0f1e('0x18')](function(){log(_0x0f1e('0x19'),_0x442e41,_0x128632,_0x63fe95,_0x1a8a5b,_0x2e7983);});}module[_0x0f1e('0x1a')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0x14e5=['capitalize','chat','Website','InteractionId','upperFirst','unknown','websites','_interactions','_interaction_has_tags','_messages','user_has_','isArray','toUpperCase','name','role','stringify','null','Interaction','then','info','exports','../../config/logger','openchannel-interactions','mail-interactions','sms-interactions','chat-interactions','whatsapp-interactions'];(function(_0x327352,_0x2dbf17){var _0x58e9ba=function(_0x3eb94b){while(--_0x3eb94b){_0x327352['push'](_0x327352['shift']());}};_0x58e9ba(++_0x2dbf17);}(_0x14e5,0x174));var _0x514e=function(_0x32bb6b,_0x1a5fbe){_0x32bb6b=_0x32bb6b-0x0;var _0x58dcb4=_0x14e5[_0x32bb6b];return _0x58dcb4;};'use strict';var _=require('lodash');var db=require('../../mysqldb')['db'];var loggers={'openchannel':require(_0x514e('0x0'))(_0x514e('0x1')),'mail':require(_0x514e('0x0'))(_0x514e('0x2')),'fax':require('../../config/logger')('fax-interactions'),'sms':require(_0x514e('0x0'))(_0x514e('0x3')),'chat':require('../../config/logger')(_0x514e('0x4')),'whatsapp':require(_0x514e('0x0'))(_0x514e('0x5'))};function getAccountFK(_0x1b4b5c){return _[_0x514e('0x6')](_0x1b4b5c)+(_0x1b4b5c===_0x514e('0x7')?_0x514e('0x8'):'Account')+'Id';}function getInteractionFK(_0x16fb21){return _[_0x514e('0x6')](_0x16fb21)+_0x514e('0x9');}function getInteractionId(_0x2edaca,_0xd90a59,_0x452265){if(_0x2edaca&&_0x2edaca[_[_0x514e('0xa')](_0x452265)+'InteractionId']){return _0x2edaca[_[_0x514e('0xa')](_0x452265)+_0x514e('0x9')];}else if(_0x2edaca&&_0x2edaca['id']){return _0x2edaca['id'];}else if(_0xd90a59&&_0xd90a59['id']){return _0xd90a59['id'];}else{return _0x514e('0xb');}}function getInteractionsTables(_0x5f7140){return{'accounts':_0x5f7140+'_'+(_0x5f7140===_0x514e('0x7')?_0x514e('0xc'):'accounts'),'interactions':_0x5f7140+_0x514e('0xd'),'interactionsTags':_0x5f7140+_0x514e('0xe'),'messages':_0x5f7140+_0x514e('0xf'),'userInteractions':_0x514e('0x10')+_0x5f7140+_0x514e('0xd')};}function getSelectedTags(_0x5f440){var _0x2a5f64=[];if(_0x5f440){_0x2a5f64=Array[_0x514e('0x11')](_0x5f440)?_0x5f440:[_0x5f440];}return _0x2a5f64;}function log(_0x3bd4a6,_0x3d4f98,_0x235e2b,_0x23f6a,_0x5b529f,_0x7fc8e2){loggers[_0x5b529f['toLowerCase']()][_0x3bd4a6]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x7fc8e2[_0x514e('0x12')](),_0x3d4f98?_0x3d4f98['id']:null,_0x3d4f98?_0x3d4f98[_0x514e('0x13')]:null,_0x3d4f98?_0x3d4f98[_0x514e('0x14')]:null,getInteractionId(_0x235e2b,_0x23f6a,_0x5b529f),_0x235e2b?JSON[_0x514e('0x15')](_0x235e2b):_0x514e('0x16'));}function updateUser(_0x32d4ef,_0x1847bb,_0x279391,_0x4892d5,_0xa69a1c){db[_[_0x514e('0xa')](_0x4892d5)+_0x514e('0x17')]['findOne']({'where':{'id':getInteractionId(_0x1847bb,_0x279391,_0x4892d5)}})['then'](function(_0x1b9464){if(_0x1b9464){return _0x1b9464['update']({'UserId':_0x32d4ef?_0x32d4ef['id']:null});}})[_0x514e('0x18')](function(_0x1314d1){if(_0x1314d1){log(_0x514e('0x19'),_0x32d4ef,_0x1847bb,_0x279391,_0x4892d5,_0xa69a1c);}})['catch'](function(){log('error',_0x32d4ef,_0x1847bb,_0x279391,_0x4892d5,_0xa69a1c);});}module[_0x514e('0x1a')]={'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 a1c9303..25040f5 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 _0x0353=['user','isUserLimit','util','composable-middleware','../../config/environment','license','data1','split','format','%s:%s:%s','update','base64','utf8','final','hasOwnProperty','use','License','findOne','then','count','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin'];(function(_0x28d8bd,_0x2a9333){var _0x4eacd4=function(_0x52d2a0){while(--_0x52d2a0){_0x28d8bd['push'](_0x28d8bd['shift']());}};_0x4eacd4(++_0x2a9333);}(_0x0353,0x1dd));var _0x3035=function(_0x31cb5f,_0x2df766){_0x31cb5f=_0x31cb5f-0x0;var _0x586042=_0x0353[_0x31cb5f];return _0x586042;};'use strict';var crypto=require('crypto');var util=require(_0x3035('0x0'));var compose=require(_0x3035('0x1'));var db=require('../../mysqldb')['db'];var config=require(_0x3035('0x2'));function getValueFromLicense(_0x3d53f4,_0x12be89){if(_0x3d53f4&&_0x12be89){if(_0x12be89['data1']&&_0x12be89[_0x3035('0x3')]){var _0x2c1c09=_0x12be89[_0x3035('0x4')];var _0x36bb8c=_0x12be89[_0x3035('0x3')];var _0x30cac6=_0x2c1c09['split']('-')[0x4];var _0x24726a=_0x2c1c09[_0x3035('0x5')]('-')[0x0];var _0x346887=crypto['createDecipher']('aes-256-ctr',util[_0x3035('0x6')](_0x3035('0x7'),_0x30cac6,_0x2c1c09,_0x24726a));var _0x25589b=_0x346887[_0x3035('0x8')](_0x36bb8c,_0x3035('0x9'),_0x3035('0xa'));_0x25589b+=_0x346887[_0x3035('0xb')]('utf8');var _0xac1715=JSON['parse'](_0x25589b);return _0xac1715[_0x3035('0xc')](_0x3d53f4)?_0xac1715[_0x3d53f4]:null;}}return null;}function isLimit(_0x33a525,_0x3483f5,_0x452ab2,_0x29b2d4){var _0x47cb20=_0x3483f5;return compose()[_0x3035('0xd')](function(_0x81f3e3,_0x36acab,_0x57657c){return db[_0x3035('0xe')][_0x3035('0xf')]({'where':{'id':0x1},'raw':!![]})[_0x3035('0x10')](function(_0x1cedbb){var _0x28985b=getValueFromLicense(_0x33a525,_0x1cedbb);return _0x28985b?_0x28985b:_0x47cb20;})[_0x3035('0x10')](function(_0x17cd35){_0x47cb20=_0x17cd35;return _0x452ab2[_0x3035('0x11')](_0x29b2d4);})[_0x3035('0x10')](function(_0x3243fc){if(_0x3243fc>=_0x47cb20){return _0x36acab['status'](0x193)['json']({'message':util['format'](_0x3035('0x12'),_0x33a525)});}_0x57657c();})[_0x3035('0x13')](function(_0x5e6857){_0x57657c(_0x5e6857);});});}function isUserLimit(){return isLimit(_0x3035('0x14'),0x1,db[_0x3035('0x15')],{'where':{'$or':[{'role':_0x3035('0x16')},{'role':_0x3035('0x17')}]}});}exports[_0x3035('0x18')]=isUserLimit; \ No newline at end of file +var _0xb6a7=['catch','users','User','admin','user','isUserLimit','crypto','util','../../mysqldb','../../config/environment','data1','license','split','createDecipher','%s:%s:%s','base64','utf8','final','parse','hasOwnProperty','use','License','then','count','status','json','format','Maximum\x20%s\x20limit\x20have\x20been\x20reached'];(function(_0x15f3c0,_0x165a64){var _0x1adfe0=function(_0x212cfc){while(--_0x212cfc){_0x15f3c0['push'](_0x15f3c0['shift']());}};_0x1adfe0(++_0x165a64);}(_0xb6a7,0x18e));var _0x7b6a=function(_0x4b4f24,_0x5654a8){_0x4b4f24=_0x4b4f24-0x0;var _0x1c13d4=_0xb6a7[_0x4b4f24];return _0x1c13d4;};'use strict';var crypto=require(_0x7b6a('0x0'));var util=require(_0x7b6a('0x1'));var compose=require('composable-middleware');var db=require(_0x7b6a('0x2'))['db'];var config=require(_0x7b6a('0x3'));function getValueFromLicense(_0x17bdf7,_0x1ed80c){if(_0x17bdf7&&_0x1ed80c){if(_0x1ed80c[_0x7b6a('0x4')]&&_0x1ed80c['license']){var _0x362b88=_0x1ed80c[_0x7b6a('0x4')];var _0x148d5c=_0x1ed80c[_0x7b6a('0x5')];var _0x20ccfa=_0x362b88[_0x7b6a('0x6')]('-')[0x4];var _0x3a087e=_0x362b88[_0x7b6a('0x6')]('-')[0x0];var _0x5649a2=crypto[_0x7b6a('0x7')]('aes-256-ctr',util['format'](_0x7b6a('0x8'),_0x20ccfa,_0x362b88,_0x3a087e));var _0x43ef5c=_0x5649a2['update'](_0x148d5c,_0x7b6a('0x9'),_0x7b6a('0xa'));_0x43ef5c+=_0x5649a2[_0x7b6a('0xb')](_0x7b6a('0xa'));var _0x1cc2fc=JSON[_0x7b6a('0xc')](_0x43ef5c);return _0x1cc2fc[_0x7b6a('0xd')](_0x17bdf7)?_0x1cc2fc[_0x17bdf7]:null;}}return null;}function isLimit(_0x5df7d2,_0x2ce613,_0x431b6b,_0x4b97fb){var _0x5ef4b1=_0x2ce613;return compose()[_0x7b6a('0xe')](function(_0x261bf7,_0x4ec2d1,_0x1dfa3e){return db[_0x7b6a('0xf')]['findOne']({'where':{'id':0x1},'raw':!![]})['then'](function(_0x4fda69){var _0x44026d=getValueFromLicense(_0x5df7d2,_0x4fda69);return _0x44026d?_0x44026d:_0x5ef4b1;})[_0x7b6a('0x10')](function(_0x3952b7){_0x5ef4b1=_0x3952b7;return _0x431b6b[_0x7b6a('0x11')](_0x4b97fb);})[_0x7b6a('0x10')](function(_0x15964e){if(_0x15964e>=_0x5ef4b1){return _0x4ec2d1[_0x7b6a('0x12')](0x193)[_0x7b6a('0x13')]({'message':util[_0x7b6a('0x14')](_0x7b6a('0x15'),_0x5df7d2)});}_0x1dfa3e();})[_0x7b6a('0x16')](function(_0x477841){_0x1dfa3e(_0x477841);});});}function isUserLimit(){return isLimit(_0x7b6a('0x17'),0x1,db[_0x7b6a('0x18')],{'where':{'$or':[{'role':_0x7b6a('0x19')},{'role':_0x7b6a('0x1a')}]}});}exports[_0x7b6a('0x1b')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 0f95f74..fb855a4 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 _0x2b32=['split','slice','forEach','shift','match','map','operator','$eq','$between','value','$gt','add','days','format','text','CAST(','field','\x20AS\x20','includes','$notIn','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','$ne','<>\x20?','$substring','$endsWith','LIKE\x20?','>\x20?','$lte','<=\x20?','$gte','>=\x20?','start','$startsWith','pop','DATE','utcOffset','minutes','seconds','lodash','moment','parseSearch','startsWith','[$or]','replace','[$and]','length'];(function(_0x5e8d3a,_0x2ac363){var _0x3a0dbb=function(_0x1bb32c){while(--_0x1bb32c){_0x5e8d3a['push'](_0x5e8d3a['shift']());}};_0x3a0dbb(++_0x2ac363);}(_0x2b32,0xc0));var _0x22b3=function(_0x328ac9,_0x2f7225){_0x328ac9=_0x328ac9-0x0;var _0x2b3a0a=_0x2b32[_0x328ac9];return _0x2b3a0a;};'use strict';var _=require(_0x22b3('0x0'));var moment=require(_0x22b3('0x1'));exports[_0x22b3('0x2')]=function(_0x21cdb4){var _0x3d6441={'conditions':[]};_0x3d6441['sqlOperator']=_[_0x22b3('0x3')](_0x21cdb4,_0x22b3('0x4'))?'or':'and';var _0x147721=_0x21cdb4[_0x22b3('0x5')](_0x22b3('0x6'),'')['replace'](_0x22b3('0x4'),'')['split']('||');for(var _0x3daf82=0x0;_0x3daf82<_0x147721[_0x22b3('0x7')];_0x3daf82++){var _0x36c158=_0x147721[_0x3daf82][_0x22b3('0x8')](':=');var _0x2d52e7=_0x36c158[0x0];var _0x345c05=_0x36c158[_0x22b3('0x9')](0x1);_0x345c05[_0x22b3('0xa')](function(_0x4fb906){var _0x83dbae=_0x4fb906[_0x22b3('0x8')]('[')[_0x22b3('0xb')]();var _0x1a3936=_0x4fb906[_0x22b3('0xc')](/\[(.*?)\]/g);_0x1a3936[_0x22b3('0xa')](function(_0x463b14){var _0x48390f=_0x463b14[_0x22b3('0x8')]('[')['filter'](function(_0x461bbb){return _0x461bbb['indexOf'](']')>-0x1;})[_0x22b3('0xd')](function(_0x450f23){return _0x450f23[_0x22b3('0x8')](']')[0x0];})[0x0];_0x3d6441['conditions']['push']({'field':_0x2d52e7,'operator':_0x83dbae,'value':_0x48390f});});});}return _0x3d6441;};exports['buildExpression']=function(_0x375915,_0x5c14c9,_0x6c72cd){var _0x3b4a15={};if(_0x5c14c9==='DATE'){if(_0x6c72cd[_0x22b3('0xe')]===_0x22b3('0xf')){_0x6c72cd[_0x22b3('0xe')]=_0x22b3('0x10');_0x6c72cd[_0x22b3('0x11')]+=','+_0x6c72cd['value'];}else if(_['includes']([_0x22b3('0x12'),'$lte'],_0x6c72cd[_0x22b3('0xe')])){_0x6c72cd[_0x22b3('0x11')]=moment(_0x6c72cd[_0x22b3('0x11')])[_0x22b3('0x13')](0x1,_0x22b3('0x14'))[_0x22b3('0x15')]('YYYY-MM-DD');}}if(_0x6c72cd['castTo']){_0x5c14c9=_0x6c72cd['castTo'];_0x3b4a15[_0x22b3('0x16')]=_0x22b3('0x17')+_0x375915+'.'+_0x6c72cd[_0x22b3('0x18')]+_0x22b3('0x19')+_0x6c72cd['castTo']+')\x20'+parseOperator(_0x6c72cd['operator']);}else{_0x3b4a15['text']=_0x375915+'.'+_0x6c72cd[_0x22b3('0x18')]+'\x20'+parseOperator(_0x6c72cd[_0x22b3('0xe')]);}if(_[_0x22b3('0x1a')](['$ne',_0x22b3('0x1b')],_0x6c72cd['operator']))_0x3b4a15[_0x22b3('0x16')]='('+_0x3b4a15[_0x22b3('0x16')]+'\x20OR\x20'+_0x375915+'.'+_0x6c72cd[_0x22b3('0x18')]+_0x22b3('0x1c');_0x3b4a15['value']=parseValue(_0x5c14c9,_0x6c72cd['operator'],_0x6c72cd[_0x22b3('0x11')]);return _0x3b4a15;};function parseOperator(_0x378a1d){var _0x12c73c;switch(_0x378a1d){case _0x22b3('0x1d'):_0x12c73c=_0x22b3('0x1e');break;case'$notIn':_0x12c73c=_0x22b3('0x1f');break;case _0x22b3('0xf'):_0x12c73c=_0x22b3('0x20');break;case _0x22b3('0x21'):_0x12c73c=_0x22b3('0x22');break;case _0x22b3('0x23'):case'$startsWith':case _0x22b3('0x24'):_0x12c73c=_0x22b3('0x25');break;case'$lt':_0x12c73c='<\x20?';break;case _0x22b3('0x12'):_0x12c73c=_0x22b3('0x26');break;case _0x22b3('0x27'):_0x12c73c=_0x22b3('0x28');break;case _0x22b3('0x29'):_0x12c73c=_0x22b3('0x2a');break;case _0x22b3('0x10'):_0x12c73c='BETWEEN\x20?\x20AND\x20?';break;}return _0x12c73c;}function parseValue(_0x1de29,_0xe87a38,_0x2d38f1){var _0x4096ae={'start':undefined,'end':undefined};switch(_0xe87a38){case _0x22b3('0x1d'):case _0x22b3('0x1b'):_0x4096ae[_0x22b3('0x2b')]=_0x2d38f1[_0x22b3('0x8')](',');break;case _0x22b3('0x23'):_0x4096ae[_0x22b3('0x2b')]='%'+_0x2d38f1+'%';break;case _0x22b3('0x2c'):_0x4096ae['start']=_0x2d38f1+'%';break;case _0x22b3('0x24'):_0x4096ae[_0x22b3('0x2b')]='%'+_0x2d38f1;break;case _0x22b3('0x10'):var _0x4f6cb8=_0x2d38f1[_0x22b3('0x8')](',');var _0x2d38f1=_0x4f6cb8[_0x22b3('0xb')]();var _0x40a1be=_0x4f6cb8[_0x22b3('0x2d')]();if(_0x1de29===_0x22b3('0x2e')){_0x2d38f1=moment(_0x2d38f1)[_0x22b3('0x2f')](0x0,!![])[_0x22b3('0x15')]();_0x40a1be=moment(_0x40a1be)['utcOffset'](0x0,!![])[_0x22b3('0x13')](0x17,'hours')[_0x22b3('0x13')](0x3b,_0x22b3('0x30'))[_0x22b3('0x13')](0x3b,_0x22b3('0x31'))['format']();}_0x4096ae={'start':_0x2d38f1,'end':_0x40a1be};break;default:_0x4096ae['start']=_0x2d38f1;break;}return _0x4096ae;} \ No newline at end of file +var _0xa3d7=['hours','seconds','lodash','parseSearch','sqlOperator','startsWith','[$or]','and','replace','[$and]','length','split','slice','forEach','shift','filter','indexOf','map','conditions','push','buildExpression','DATE','operator','$eq','$between','value','includes','$gt','add','days','format','castTo','text','CAST(','\x20AS\x20','field','$ne','$notIn','\x20IS\x20NULL)','NOT\x20IN\x20?','=\x20?','<>\x20?','$substring','LIKE\x20?','$lt','<\x20?','>\x20?','$lte','$gte','>=\x20?','$in','start','$startsWith','$endsWith','utcOffset'];(function(_0x5d9e81,_0x157f6b){var _0x5d4d20=function(_0x287faa){while(--_0x287faa){_0x5d9e81['push'](_0x5d9e81['shift']());}};_0x5d4d20(++_0x157f6b);}(_0xa3d7,0xa7));var _0x7a3d=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa3d7[_0x298ed3];return _0x5aad28;};'use strict';var _=require(_0x7a3d('0x0'));var moment=require('moment');exports[_0x7a3d('0x1')]=function(_0x50df5a){var _0x249a68={'conditions':[]};_0x249a68[_0x7a3d('0x2')]=_[_0x7a3d('0x3')](_0x50df5a,_0x7a3d('0x4'))?'or':_0x7a3d('0x5');var _0xedb860=_0x50df5a[_0x7a3d('0x6')](_0x7a3d('0x7'),'')['replace'](_0x7a3d('0x4'),'')['split']('||');for(var _0x2815e9=0x0;_0x2815e9<_0xedb860[_0x7a3d('0x8')];_0x2815e9++){var _0x59a5b3=_0xedb860[_0x2815e9][_0x7a3d('0x9')](':=');var _0x4574cd=_0x59a5b3[0x0];var _0x7aa088=_0x59a5b3[_0x7a3d('0xa')](0x1);_0x7aa088[_0x7a3d('0xb')](function(_0x1afd0d){var _0x2045e0=_0x1afd0d[_0x7a3d('0x9')]('[')[_0x7a3d('0xc')]();var _0x53be07=_0x1afd0d['match'](/\[(.*?)\]/g);_0x53be07['forEach'](function(_0x48dc72){var _0x4c4490=_0x48dc72[_0x7a3d('0x9')]('[')[_0x7a3d('0xd')](function(_0x31dfaf){return _0x31dfaf[_0x7a3d('0xe')](']')>-0x1;})[_0x7a3d('0xf')](function(_0x49bc76){return _0x49bc76['split'](']')[0x0];})[0x0];_0x249a68[_0x7a3d('0x10')][_0x7a3d('0x11')]({'field':_0x4574cd,'operator':_0x2045e0,'value':_0x4c4490});});});}return _0x249a68;};exports[_0x7a3d('0x12')]=function(_0x3858bf,_0x336f8d,_0x5ca658){var _0x2bfef1={};if(_0x336f8d===_0x7a3d('0x13')){if(_0x5ca658[_0x7a3d('0x14')]===_0x7a3d('0x15')){_0x5ca658['operator']=_0x7a3d('0x16');_0x5ca658[_0x7a3d('0x17')]+=','+_0x5ca658[_0x7a3d('0x17')];}else if(_[_0x7a3d('0x18')]([_0x7a3d('0x19'),'$lte'],_0x5ca658[_0x7a3d('0x14')])){_0x5ca658['value']=moment(_0x5ca658[_0x7a3d('0x17')])[_0x7a3d('0x1a')](0x1,_0x7a3d('0x1b'))[_0x7a3d('0x1c')]('YYYY-MM-DD');}}if(_0x5ca658[_0x7a3d('0x1d')]){_0x336f8d=_0x5ca658['castTo'];_0x2bfef1[_0x7a3d('0x1e')]=_0x7a3d('0x1f')+_0x3858bf+'.'+_0x5ca658['field']+_0x7a3d('0x20')+_0x5ca658[_0x7a3d('0x1d')]+')\x20'+parseOperator(_0x5ca658[_0x7a3d('0x14')]);}else{_0x2bfef1['text']=_0x3858bf+'.'+_0x5ca658[_0x7a3d('0x21')]+'\x20'+parseOperator(_0x5ca658[_0x7a3d('0x14')]);}if(_[_0x7a3d('0x18')]([_0x7a3d('0x22'),_0x7a3d('0x23')],_0x5ca658[_0x7a3d('0x14')]))_0x2bfef1[_0x7a3d('0x1e')]='('+_0x2bfef1[_0x7a3d('0x1e')]+'\x20OR\x20'+_0x3858bf+'.'+_0x5ca658['field']+_0x7a3d('0x24');_0x2bfef1['value']=parseValue(_0x336f8d,_0x5ca658['operator'],_0x5ca658[_0x7a3d('0x17')]);return _0x2bfef1;};function parseOperator(_0x41ed7e){var _0x8c965b;switch(_0x41ed7e){case'$in':_0x8c965b='IN\x20?';break;case _0x7a3d('0x23'):_0x8c965b=_0x7a3d('0x25');break;case _0x7a3d('0x15'):_0x8c965b=_0x7a3d('0x26');break;case _0x7a3d('0x22'):_0x8c965b=_0x7a3d('0x27');break;case _0x7a3d('0x28'):case'$startsWith':case'$endsWith':_0x8c965b=_0x7a3d('0x29');break;case _0x7a3d('0x2a'):_0x8c965b=_0x7a3d('0x2b');break;case _0x7a3d('0x19'):_0x8c965b=_0x7a3d('0x2c');break;case _0x7a3d('0x2d'):_0x8c965b='<=\x20?';break;case _0x7a3d('0x2e'):_0x8c965b=_0x7a3d('0x2f');break;case _0x7a3d('0x16'):_0x8c965b='BETWEEN\x20?\x20AND\x20?';break;}return _0x8c965b;}function parseValue(_0x324023,_0x193ed0,_0x1a63a8){var _0x12bf5b={'start':undefined,'end':undefined};switch(_0x193ed0){case _0x7a3d('0x30'):case _0x7a3d('0x23'):_0x12bf5b['start']=_0x1a63a8[_0x7a3d('0x9')](',');break;case _0x7a3d('0x28'):_0x12bf5b[_0x7a3d('0x31')]='%'+_0x1a63a8+'%';break;case _0x7a3d('0x32'):_0x12bf5b[_0x7a3d('0x31')]=_0x1a63a8+'%';break;case _0x7a3d('0x33'):_0x12bf5b['start']='%'+_0x1a63a8;break;case'$between':var _0x1b3e28=_0x1a63a8['split'](',');var _0x1a63a8=_0x1b3e28[_0x7a3d('0xc')]();var _0x239e85=_0x1b3e28['pop']();if(_0x324023===_0x7a3d('0x13')){_0x1a63a8=moment(_0x1a63a8)['utcOffset'](0x0,!![])['format']();_0x239e85=moment(_0x239e85)[_0x7a3d('0x34')](0x0,!![])[_0x7a3d('0x1a')](0x17,_0x7a3d('0x35'))[_0x7a3d('0x1a')](0x3b,'minutes')[_0x7a3d('0x1a')](0x3b,_0x7a3d('0x36'))[_0x7a3d('0x1c')]();}_0x12bf5b={'start':_0x1a63a8,'end':_0x239e85};break;default:_0x12bf5b[_0x7a3d('0x31')]=_0x1a63a8;break;}return _0x12bf5b;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 7ae68f1..8a72817 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 _0x8407=['split','forOwn','find','type','DATE','isPlainObject','$gte','format','YYYY-MM-DD','$lte','subtract','name','isArray','limit','indexOf','priority','col','unsigned','substr','DESC','cast','isEmpty','isObject','isString','length','unset','omit','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','{EXPR}','replace','push','join','query','$id','model','map','filters','intersection','attributes','hasOwnProperty','nolimit','offset','order','pick','filter','object','includes','columns','value','where','merge','VIRTUAL','lower','options','moment','keys','parse','fields'];(function(_0x1b0906,_0x713076){var _0x43e194=function(_0x4f28cf){while(--_0x4f28cf){_0x1b0906['push'](_0x1b0906['shift']());}};_0x43e194(++_0x713076);}(_0x8407,0x78));var _0x7840=function(_0xbda9f3,_0x7f7694){_0xbda9f3=_0xbda9f3-0x0;var _0x441c0b=_0x8407[_0xbda9f3];return _0x441c0b;};'use strict';var _=require('lodash');var sequelize=require('sequelize');var moment=require(_0x7840('0x0'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x491f80){var _0x333911=['ne'];try{var _0x328421=JSON['parse'](_0x491f80);var _0x1d8e0c=Object[_0x7840('0x1')](_0x328421)[0x0];return _0x333911['includes'](_0x1d8e0c);}catch(_0x50c927){return![];}}function getOperatorValue(_0x3a2308){var _0x237794=JSON[_0x7840('0x2')](_0x3a2308);var _0x2d91ce=Object['keys'](_0x237794)[0x0];var _0x3616d4=_0x237794[_0x2d91ce];return{['$'+_0x2d91ce]:_0x3616d4};}exports[_0x7840('0x3')]=function(_0x1e163f){var _0x6e9b43=null;if(_0x1e163f){_0x6e9b43=_0x1e163f[_0x7840('0x4')](',');}return _0x6e9b43;};exports['filters']=function(_0x13bc2f,_0x5de98c){var _0x66cb94={};if(!_['isEmpty'](_0x13bc2f)){_[_0x7840('0x5')](_0x13bc2f,function(_0x9ab78b,_0x1228b3){try{if(_0x5de98c){var _0x183a2d=_[_0x7840('0x6')](_0x5de98c,{'name':_0x1228b3})||{};if(hasSequelizeOperator(_0x9ab78b)){_0x66cb94[_0x1228b3]=getOperatorValue(_0x9ab78b);}else if(_0x183a2d[_0x7840('0x7')]===_0x7840('0x8')&&_[_0x7840('0x9')](_0x9ab78b)){var _0xc38c0e=JSON[_0x7840('0x2')](_0x9ab78b);var _0x4bb3fe={'$gte':moment(moment(_0xc38c0e[_0x7840('0xa')])[_0x7840('0xb')](_0x7840('0xc')))['utc']()[_0x7840('0xb')](),'$lte':moment(moment(_0xc38c0e[_0x7840('0xd')])[_0x7840('0xb')](_0x7840('0xc')))['utc']()[_0x7840('0xe')](0x1,'s')['format']()};_0x66cb94[_0x1228b3]=_0x4bb3fe;}else if(_0x183a2d[_0x7840('0xf')]==='uniqueid'){_0x66cb94[_0x1228b3]=_0x9ab78b;}else{_0x66cb94[_0x1228b3]=_[_0x7840('0x10')](_0x9ab78b)?_0x9ab78b:JSON[_0x7840('0x2')](_0x9ab78b);}}else{_0x66cb94[_0x1228b3]=_[_0x7840('0x10')](_0x9ab78b)?_0x9ab78b:JSON[_0x7840('0x2')](_0x9ab78b);}}catch(_0x357b68){_0x66cb94[_0x1228b3]=_0x9ab78b['split'](',');}});}return _0x66cb94;};exports[_0x7840('0x11')]=function(_0x13c5a9){_0x13c5a9=parseInt(_0x13c5a9,0xa);if(!_0x13c5a9||_0x13c5a9<0x0){_0x13c5a9=LIMIT_VALUE;}return _0x13c5a9;};exports['offset']=function(_0x38c156){_0x38c156=parseInt(_0x38c156,0xa);if(!_0x38c156||_0x38c156<0x0){_0x38c156=0x0;}return _0x38c156;};exports['sort']=function(_0xf7f91e){var _0x2faf9d,_0x508823=null;if(_0xf7f91e){_0x2faf9d=_0xf7f91e[_0x7840('0x4')](',');_0x508823=_['map'](_0x2faf9d,function(_0x4c6b55){if(_0x4c6b55[_0x7840('0x12')]('-')===0x0){return[_0x4c6b55===_0x7840('0x13')?sequelize['cast'](sequelize[_0x7840('0x14')](_0x7840('0x13')),_0x7840('0x15')):_0x4c6b55[_0x7840('0x16')](0x1),_0x7840('0x17')];}else{return[_0x4c6b55===_0x7840('0x13')?sequelize[_0x7840('0x18')](sequelize[_0x7840('0x14')](_0x7840('0x13')),_0x7840('0x15')):_0x4c6b55,'ASC'];}});}return _0x508823;};exports['omit']=function(_0x1b89e5,_0x3a4446){if(_[_0x7840('0x19')](_0x1b89e5)){return _0x1b89e5;}if(_[_0x7840('0x10')](_0x1b89e5)){for(var _0x236f75=0x0;_0x236f75<_0x1b89e5['length'];_0x236f75+=0x1){_0x1b89e5[_0x236f75]=this['omit'](_0x1b89e5[_0x236f75],_0x3a4446);}return _0x1b89e5;}if(!_[_0x7840('0x1a')](_0x1b89e5)){return _0x1b89e5;}if(_[_0x7840('0x1b')](_0x3a4446)){_0x3a4446=[_0x3a4446];}if(!_[_0x7840('0x10')](_0x3a4446)){return _0x1b89e5;}for(var _0x3da930=0x0;_0x3da930<_0x3a4446[_0x7840('0x1c')];_0x3da930+=0x1){_[_0x7840('0x1d')](_0x1b89e5,_0x3a4446[_0x3da930]);}for(var _0x9f391 in _0x1b89e5){if(_0x1b89e5['hasOwnProperty'](_0x9f391)){_0x1b89e5[_0x9f391]=this[_0x7840('0x1e')](_0x1b89e5[_0x9f391],_0x3a4446);}}return _0x1b89e5;};exports[_0x7840('0x1f')]=function(_0x3c1611){return _0x3c1611[_0x7840('0x20')](RegExp(_0x7840('0x21')))?!![]:![];};exports[_0x7840('0x22')]=function(_0x551c47){return _0x551c47[_0x7840('0x20')](/^\S+@\S+$/)?!![]:![];};exports[_0x7840('0x23')]=function(_0x40c5dd,_0x45d435){var _0x3ffe89=[];var _0x1b798d=/[ `!@#$%^&*()_\-?~]/;var _0xb5486e=_0x45d435?'\x22{EXPR}\x22':_0x7840('0x24');_0x40c5dd[_0x7840('0x4')](/[ ,]+/)['forEach'](function(_0x1e1c3e){_0x1e1c3e=_0x1e1c3e[_0x7840('0x25')](/([^:]")"+/g,'$1');_0x1e1c3e='+'+_0x1e1c3e+'*';var _0x268b7a=_0x1e1c3e[_0x7840('0x20')](_0x1b798d);if(_0x268b7a){_0x1e1c3e='\x22'+_0x1e1c3e+'\x22';}_0x3ffe89[_0x7840('0x26')](_0x1e1c3e);});_0xb5486e=_0xb5486e[_0x7840('0x25')]('{EXPR}',_0x3ffe89[_0x7840('0x27')]('\x20'));return _0xb5486e;};exports['getOptions']=function(_0x383369,_0x4b9f40,_0xf59d39){var _0xf02e51={},_0x475cbb={};if(_0x4b9f40['query']['$id']){_0x4b9f40[_0x7840('0x28')]['id']=_0x4b9f40['query'][_0x7840('0x29')];delete _0x4b9f40[_0x7840('0x28')]['$id'];}_0xf02e51[_0x7840('0x2a')]=_[_0x7840('0x2b')](_0x383369,_0x7840('0xf'));_0xf02e51[_0x7840('0x28')]=_[_0x7840('0x1')](_0x4b9f40[_0x7840('0x28')]);_0xf02e51[_0x7840('0x2c')]=_[_0x7840('0x2d')](_0xf02e51[_0x7840('0x2a')],_0xf02e51['query']);_0x475cbb['attributes']=_['intersection'](_0xf02e51[_0x7840('0x2a')],this[_0x7840('0x3')](_0x4b9f40[_0x7840('0x28')][_0x7840('0x3')]));_0x475cbb[_0x7840('0x2e')]=_0x475cbb[_0x7840('0x2e')][_0x7840('0x1c')]?_0x475cbb[_0x7840('0x2e')]:_0xf02e51[_0x7840('0x2a')];if(!_0x4b9f40[_0x7840('0x28')][_0x7840('0x2f')](_0x7840('0x30'))){_0x475cbb[_0x7840('0x11')]=this[_0x7840('0x11')](_0x4b9f40[_0x7840('0x28')][_0x7840('0x11')]);_0x475cbb['offset']=this[_0x7840('0x31')](_0x4b9f40[_0x7840('0x28')][_0x7840('0x31')]);}_0x475cbb[_0x7840('0x32')]=this['sort'](_0x4b9f40[_0x7840('0x28')]['sort']);_0x475cbb['where']=this[_0x7840('0x2c')](_[_0x7840('0x33')](_0x4b9f40['query'],_0xf02e51[_0x7840('0x2c')]),_0x383369);if(_0x4b9f40[_0x7840('0x28')][_0x7840('0x34')]){var _0x2f4f2b=_0x383369;var _0x36a688=_0x4b9f40[_0x7840('0x28')][_0x7840('0x34')];if(typeof _0x36a688===_0x7840('0x35')){_0x2f4f2b=_[_0x7840('0x34')](_0x383369,function(_0x37e736){return _[_0x7840('0x36')](_0x36a688[_0x7840('0x37')],_0x37e736[_0x7840('0xf')]);});_0x36a688=_0x36a688[_0x7840('0x38')];}_0x475cbb[_0x7840('0x39')]=_[_0x7840('0x3a')](_0x475cbb['where'],{'$or':_[_0x7840('0x2b')](_0x2f4f2b,function(_0x33ce0a){if(_0x33ce0a[_0x7840('0x7')]!==_0x7840('0x3b')){if(_0xf59d39){return sequelize[_0x7840('0x39')](sequelize['fn'](_0x7840('0x3c'),sequelize['col'](_0x33ce0a[_0x7840('0xf')])),{'$like':sequelize['fn'](_0x7840('0x3c'),'%'+_0x4b9f40['query']['filter']+'%')});}else{var _0xc5ff5a={};_0xc5ff5a[_0x33ce0a[_0x7840('0xf')]]={'$like':'%'+_0x4b9f40[_0x7840('0x28')][_0x7840('0x34')]+'%'};return _0xc5ff5a;}}})});}_0x475cbb=_[_0x7840('0x3a')]({},_0x475cbb,_0x4b9f40[_0x7840('0x3d')]);return _0x475cbb;}; \ No newline at end of file +var _0xd09e=['isObject','isString','unset','hasOwnProperty','isNumeric','match','getFullTextValue','\x22{EXPR}\x22','{EXPR}','forEach','replace','getOptions','query','$id','intersection','model','attributes','length','nolimit','order','sort','where','pick','filter','object','value','merge','type','VIRTUAL','lower','options','lodash','sequelize','keys','includes','parse','fields','filters','isEmpty','forOwn','find','DATE','isPlainObject','$gte','format','YYYY-MM-DD','utc','$lte','subtract','isArray','split','limit','offset','map','indexOf','priority','cast','substr','DESC','col','unsigned','ASC','omit'];(function(_0x161f59,_0x42e9ff){var _0x3ffa0e=function(_0x3aef14){while(--_0x3aef14){_0x161f59['push'](_0x161f59['shift']());}};_0x3ffa0e(++_0x42e9ff);}(_0xd09e,0xdc));var _0xed09=function(_0x1833a5,_0x166312){_0x1833a5=_0x1833a5-0x0;var _0x1385b5=_0xd09e[_0x1833a5];return _0x1385b5;};'use strict';var _=require(_0xed09('0x0'));var sequelize=require(_0xed09('0x1'));var moment=require('moment');var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x1f0210){var _0x4c331b=['ne'];try{var _0x181ca4=JSON['parse'](_0x1f0210);var _0x51612b=Object[_0xed09('0x2')](_0x181ca4)[0x0];return _0x4c331b[_0xed09('0x3')](_0x51612b);}catch(_0x2226e5){return![];}}function getOperatorValue(_0x1e0b1e){var _0x27ba52=JSON[_0xed09('0x4')](_0x1e0b1e);var _0x3252ed=Object[_0xed09('0x2')](_0x27ba52)[0x0];var _0x1168fd=_0x27ba52[_0x3252ed];return{['$'+_0x3252ed]:_0x1168fd};}exports[_0xed09('0x5')]=function(_0x3bf636){var _0x10e243=null;if(_0x3bf636){_0x10e243=_0x3bf636['split'](',');}return _0x10e243;};exports[_0xed09('0x6')]=function(_0x47d757,_0x167c80){var _0x47ce53={};if(!_[_0xed09('0x7')](_0x47d757)){_[_0xed09('0x8')](_0x47d757,function(_0x300aa1,_0x5f466b){try{if(_0x167c80){var _0x57f78e=_[_0xed09('0x9')](_0x167c80,{'name':_0x5f466b})||{};if(hasSequelizeOperator(_0x300aa1)){_0x47ce53[_0x5f466b]=getOperatorValue(_0x300aa1);}else if(_0x57f78e['type']===_0xed09('0xa')&&_[_0xed09('0xb')](_0x300aa1)){var _0x92dbf1=JSON[_0xed09('0x4')](_0x300aa1);var _0x4bdd61={'$gte':moment(moment(_0x92dbf1[_0xed09('0xc')])[_0xed09('0xd')](_0xed09('0xe')))[_0xed09('0xf')]()['format'](),'$lte':moment(moment(_0x92dbf1[_0xed09('0x10')])[_0xed09('0xd')]('YYYY-MM-DD'))[_0xed09('0xf')]()[_0xed09('0x11')](0x1,'s')[_0xed09('0xd')]()};_0x47ce53[_0x5f466b]=_0x4bdd61;}else if(_0x57f78e['name']==='uniqueid'){_0x47ce53[_0x5f466b]=_0x300aa1;}else{_0x47ce53[_0x5f466b]=_[_0xed09('0x12')](_0x300aa1)?_0x300aa1:JSON[_0xed09('0x4')](_0x300aa1);}}else{_0x47ce53[_0x5f466b]=_[_0xed09('0x12')](_0x300aa1)?_0x300aa1:JSON[_0xed09('0x4')](_0x300aa1);}}catch(_0x15ab3e){_0x47ce53[_0x5f466b]=_0x300aa1[_0xed09('0x13')](',');}});}return _0x47ce53;};exports[_0xed09('0x14')]=function(_0x1feec7){_0x1feec7=parseInt(_0x1feec7,0xa);if(!_0x1feec7||_0x1feec7<0x0){_0x1feec7=LIMIT_VALUE;}return _0x1feec7;};exports[_0xed09('0x15')]=function(_0x19a566){_0x19a566=parseInt(_0x19a566,0xa);if(!_0x19a566||_0x19a566<0x0){_0x19a566=0x0;}return _0x19a566;};exports['sort']=function(_0x4afd63){var _0x3899b5,_0x637368=null;if(_0x4afd63){_0x3899b5=_0x4afd63[_0xed09('0x13')](',');_0x637368=_[_0xed09('0x16')](_0x3899b5,function(_0xad5b5){if(_0xad5b5[_0xed09('0x17')]('-')===0x0){return[_0xad5b5===_0xed09('0x18')?sequelize[_0xed09('0x19')](sequelize['col']('priority'),'unsigned'):_0xad5b5[_0xed09('0x1a')](0x1),_0xed09('0x1b')];}else{return[_0xad5b5===_0xed09('0x18')?sequelize[_0xed09('0x19')](sequelize[_0xed09('0x1c')](_0xed09('0x18')),_0xed09('0x1d')):_0xad5b5,_0xed09('0x1e')];}});}return _0x637368;};exports[_0xed09('0x1f')]=function(_0x3fcb42,_0x514e9e){if(_[_0xed09('0x7')](_0x3fcb42)){return _0x3fcb42;}if(_[_0xed09('0x12')](_0x3fcb42)){for(var _0x28f647=0x0;_0x28f647<_0x3fcb42['length'];_0x28f647+=0x1){_0x3fcb42[_0x28f647]=this[_0xed09('0x1f')](_0x3fcb42[_0x28f647],_0x514e9e);}return _0x3fcb42;}if(!_[_0xed09('0x20')](_0x3fcb42)){return _0x3fcb42;}if(_[_0xed09('0x21')](_0x514e9e)){_0x514e9e=[_0x514e9e];}if(!_['isArray'](_0x514e9e)){return _0x3fcb42;}for(var _0x1626aa=0x0;_0x1626aa<_0x514e9e['length'];_0x1626aa+=0x1){_[_0xed09('0x22')](_0x3fcb42,_0x514e9e[_0x1626aa]);}for(var _0x1329df in _0x3fcb42){if(_0x3fcb42[_0xed09('0x23')](_0x1329df)){_0x3fcb42[_0x1329df]=this[_0xed09('0x1f')](_0x3fcb42[_0x1329df],_0x514e9e);}}return _0x3fcb42;};exports[_0xed09('0x24')]=function(_0xe02db7){return _0xe02db7[_0xed09('0x25')](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports['isEmail']=function(_0x585ec7){return _0x585ec7['match'](/^\S+@\S+$/)?!![]:![];};exports[_0xed09('0x26')]=function(_0xaea332,_0x1c05d0){var _0x42e4fd=[];var _0x3648bc=/[ `!@#$%^&*()_\-?~]/;var _0x1923de=_0x1c05d0?_0xed09('0x27'):_0xed09('0x28');_0xaea332[_0xed09('0x13')](/[ ,]+/)[_0xed09('0x29')](function(_0x4a6d45){_0x4a6d45=_0x4a6d45[_0xed09('0x2a')](/([^:]")"+/g,'$1');_0x4a6d45='+'+_0x4a6d45+'*';var _0x348331=_0x4a6d45[_0xed09('0x25')](_0x3648bc);if(_0x348331){_0x4a6d45='\x22'+_0x4a6d45+'\x22';}_0x42e4fd['push'](_0x4a6d45);});_0x1923de=_0x1923de[_0xed09('0x2a')](_0xed09('0x28'),_0x42e4fd['join']('\x20'));return _0x1923de;};exports[_0xed09('0x2b')]=function(_0x55008d,_0x3f5221,_0x2fcc92){var _0x49021a={},_0x45a7be={};if(_0x3f5221[_0xed09('0x2c')][_0xed09('0x2d')]){_0x3f5221[_0xed09('0x2c')]['id']=_0x3f5221['query'][_0xed09('0x2d')];delete _0x3f5221[_0xed09('0x2c')][_0xed09('0x2d')];}_0x49021a['model']=_[_0xed09('0x16')](_0x55008d,'name');_0x49021a['query']=_[_0xed09('0x2')](_0x3f5221['query']);_0x49021a['filters']=_[_0xed09('0x2e')](_0x49021a[_0xed09('0x2f')],_0x49021a['query']);_0x45a7be[_0xed09('0x30')]=_[_0xed09('0x2e')](_0x49021a[_0xed09('0x2f')],this[_0xed09('0x5')](_0x3f5221[_0xed09('0x2c')][_0xed09('0x5')]));_0x45a7be[_0xed09('0x30')]=_0x45a7be['attributes'][_0xed09('0x31')]?_0x45a7be[_0xed09('0x30')]:_0x49021a[_0xed09('0x2f')];if(!_0x3f5221[_0xed09('0x2c')][_0xed09('0x23')](_0xed09('0x32'))){_0x45a7be[_0xed09('0x14')]=this['limit'](_0x3f5221[_0xed09('0x2c')][_0xed09('0x14')]);_0x45a7be['offset']=this['offset'](_0x3f5221['query'][_0xed09('0x15')]);}_0x45a7be[_0xed09('0x33')]=this['sort'](_0x3f5221[_0xed09('0x2c')][_0xed09('0x34')]);_0x45a7be[_0xed09('0x35')]=this['filters'](_[_0xed09('0x36')](_0x3f5221[_0xed09('0x2c')],_0x49021a[_0xed09('0x6')]),_0x55008d);if(_0x3f5221[_0xed09('0x2c')]['filter']){var _0x54d335=_0x55008d;var _0xbe1831=_0x3f5221['query'][_0xed09('0x37')];if(typeof _0xbe1831===_0xed09('0x38')){_0x54d335=_[_0xed09('0x37')](_0x55008d,function(_0x241f76){return _[_0xed09('0x3')](_0xbe1831['columns'],_0x241f76['name']);});_0xbe1831=_0xbe1831[_0xed09('0x39')];}_0x45a7be[_0xed09('0x35')]=_[_0xed09('0x3a')](_0x45a7be[_0xed09('0x35')],{'$or':_[_0xed09('0x16')](_0x54d335,function(_0x75113){if(_0x75113[_0xed09('0x3b')]!==_0xed09('0x3c')){if(_0x2fcc92){return sequelize['where'](sequelize['fn'](_0xed09('0x3d'),sequelize[_0xed09('0x1c')](_0x75113['name'])),{'$like':sequelize['fn'](_0xed09('0x3d'),'%'+_0x3f5221['query']['filter']+'%')});}else{var _0x5778aa={};_0x5778aa[_0x75113['name']]={'$like':'%'+_0x3f5221['query'][_0xed09('0x37')]+'%'};return _0x5778aa;}}})});}_0x45a7be=_['merge']({},_0x45a7be,_0x3f5221[_0xed09('0x3e')]);return _0x45a7be;}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index 4b45068..7541ff9 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 _0xf3d5=['sort','toLowerCase','userpic','lastLoginAt','address','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','faxCurrentCapacity','openchannelStatus','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','pick','filterAgentAttributes','lodash','jayson/promise','../../mysqldb','http','client','faxPause','mailPause','smsPause','voicePause','whatsappPause','filter','length','idle','unknown','isNil','voiceStatus','pause','chatStatus','faxStatus','mailStatus','smsStatus','whatsappStatus','request','Agents','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','*pause','busy','isArray','startCase','getAgents','all','uniq','value','getAgentIdsByQueues','includes','map','getAgentIdsByStatus','resolve','User','findAll','name','fullname','chatPause','openchannelPause','pauseType','find','globalStatus','getSortedAgentsIdsByStatus','fields','order','startsWith','DESC','ASC','getUpdatedSortOptions','internal','substring','indexOf','validateSortParameter'];(function(_0x273d65,_0x2d06e6){var _0x25429a=function(_0xa90be8){while(--_0xa90be8){_0x273d65['push'](_0x273d65['shift']());}};_0x25429a(++_0x2d06e6);}(_0xf3d5,0xce));var _0x5f3d=function(_0xe1fa6b,_0x24c4c9){_0xe1fa6b=_0xe1fa6b-0x0;var _0x16e21f=_0xf3d5[_0xe1fa6b];return _0x16e21f;};'use strict';var _=require(_0x5f3d('0x0'));var jayson=require(_0x5f3d('0x1'));var db=require(_0x5f3d('0x2'))['db'];var amiClient=jayson['client'][_0x5f3d('0x3')]({'port':0x232a});var routingClient=jayson[_0x5f3d('0x4')][_0x5f3d('0x3')]({'port':0x232c});function isAgentPaused(_0x55d05c,_0x43156c){var _0x30dcc9=[_0x55d05c['chatPause'],_0x55d05c[_0x5f3d('0x5')],_0x55d05c[_0x5f3d('0x6')],_0x55d05c['openchannelPause'],_0x55d05c[_0x5f3d('0x7')],_0x55d05c[_0x5f3d('0x8')],_0x55d05c[_0x5f3d('0x9')]];if(!_0x43156c)return _['every'](_0x30dcc9);var _0x5bfd1d=_[_0x5f3d('0xa')](_0x30dcc9);return _0x5bfd1d[_0x5f3d('0xb')]>0x0&&_0x5bfd1d['length']<_0x30dcc9['length']?!![]:![];}function isIdle(_0x542aac){return _0x542aac===_0x5f3d('0xc')||_0x542aac===_0x5f3d('0xd')||_0x542aac==='unavailable'||_0x542aac==='ringing'||_[_0x5f3d('0xe')](_0x542aac);}function isAgentIdle(_0x80f2d9){if(_0x80f2d9[_0x5f3d('0xf')]!==_0x5f3d('0xc')&&_0x80f2d9[_0x5f3d('0x8')]){_0x80f2d9['voiceStatus']=_0x5f3d('0x10');return![];}return _['every']([_0x80f2d9[_0x5f3d('0x11')],_0x80f2d9[_0x5f3d('0x12')],_0x80f2d9[_0x5f3d('0x13')],_0x80f2d9['openchannelStatus'],_0x80f2d9[_0x5f3d('0x14')],_0x80f2d9['voiceStatus'],_0x80f2d9[_0x5f3d('0x15')]],isIdle);}function getRealtimeAgents(){return amiClient[_0x5f3d('0x16')](_0x5f3d('0x17'),{})[_0x5f3d('0x18')](function(_0x1fb3a5){if(_0x1fb3a5[_0x5f3d('0x19')]){throw new Error(_0x5f3d('0x1a'));}var _0x423513=_0x1fb3a5[_0x5f3d('0x1b')];return routingClient[_0x5f3d('0x16')](_0x5f3d('0x17'),{})[_0x5f3d('0x18')](function(_0x3ec2ed){if(_0x3ec2ed['error']){throw new Error(_0x5f3d('0x1c'));}var _0xe44720=_0x3ec2ed[_0x5f3d('0x1b')];return _[_0x5f3d('0x1d')]({},_0x423513,_0xe44720);});})[_0x5f3d('0x1e')](function(_0x2b30d2){throw _0x2b30d2;});}exports['getRealtimeAgents']=getRealtimeAgents;function getAgentStatus(_0x3539f9){var _0x171aae='unknown';if(isAgentPaused(_0x3539f9))_0x171aae=_0x5f3d('0x10');else if(isAgentPaused(_0x3539f9,!![]))_0x171aae=_0x5f3d('0x1f');else if(isAgentIdle(_0x3539f9))_0x171aae=_0x5f3d('0xc');else _0x171aae=_0x5f3d('0x20');return _0x171aae;}exports['getAgentStatus']=getAgentStatus;function getAgentIdsByQueues(_0x3cb09b,_0x1d4618){var _0x49d6c8=_[_0x5f3d('0x21')](_0x3cb09b)?_0x3cb09b:[_0x3cb09b];var _0x2a68f8=_[_0x5f3d('0x22')](_0x1d4618)+'Queue';var _0x4942eb=_['map'](_0x49d6c8,function(_0x9c9429){return db[_0x2a68f8]['findOne']({'where':{'id':_0x9c9429}})[_0x5f3d('0x18')](function(_0x110e59){if(!_0x110e59)return[];return _0x110e59[_0x5f3d('0x23')]({'attributes':['id'],'raw':!![]});});});return Promise[_0x5f3d('0x24')](_0x4942eb)['then'](function(_0xfb8875){var _0x102b4e=_(_0xfb8875)['flatten']()['map']('id')[_0x5f3d('0x25')]()[_0x5f3d('0x26')]();return _0x102b4e;});}exports[_0x5f3d('0x27')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x432c46,_0x23aabd,_0x1b9e64){try{if(_0x23aabd[_0x5f3d('0xb')]>0x0){_0x432c46=_0x432c46[_0x5f3d('0xa')](function(_0x59e82b){return _0x23aabd[_0x5f3d('0x28')](_0x59e82b['id']);});}var _0x40bb40=_0x432c46[_0x5f3d('0xa')](function(_0x5bcc44){var _0x2b7db5=_0x5f3d('0x20');if(isAgentIdle(_0x5bcc44)){_0x2b7db5=_0x5f3d('0xc');}return _0x2b7db5===_0x1b9e64;});return _[_0x5f3d('0x29')](_0x40bb40,'id');}catch(_0xc601e2){throw _0xc601e2;}}exports[_0x5f3d('0x2a')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x103a68,_0x3a2efb,_0xf53dd0){return Promise[_0x5f3d('0x2b')]()[_0x5f3d('0x18')](function(){if(_0x3a2efb[_0x5f3d('0xb')]>0x0){_0x103a68=_0x103a68[_0x5f3d('0xa')](function(_0x5e3984){return _0x3a2efb['includes'](_0x5e3984['id']);});}return _0x103a68;})[_0x5f3d('0x18')](function(){return db[_0x5f3d('0x2c')][_0x5f3d('0x2d')]({'attributes':['id',_0x5f3d('0x2e'),_0x5f3d('0x2f'),_0x5f3d('0x30'),_0x5f3d('0x5'),_0x5f3d('0x6'),_0x5f3d('0x31'),_0x5f3d('0x7'),'voicePause',_0x5f3d('0x9'),_0x5f3d('0x32')],'where':{'id':{'$in':_[_0x5f3d('0x29')](_0x103a68,'id')}},'raw':!![]});})[_0x5f3d('0x18')](function(_0x56f545){return _0x56f545['map'](function(_0x188c6e){var _0x11c4b1=_[_0x5f3d('0x33')](_0x103a68,['id',_0x188c6e['id']]);var _0x4283db=filterAgentAttributes(_0x11c4b1);_['merge'](_0x188c6e,_0x4283db);_0x188c6e[_0x5f3d('0x34')]=getAgentStatus(_0x188c6e);return _0x188c6e;});})[_0x5f3d('0x18')](function(_0x33f690){var _0x351034=sortAgentsByStatus(_0x33f690,_0xf53dd0);return _[_0x5f3d('0x29')](_0x351034,'id');})[_0x5f3d('0x1e')](function(_0x4853a8){throw _0x4853a8;});}exports[_0x5f3d('0x35')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x3c7e5d){var _0x447c9a={'fields':[],'order':null};var _0x84787d=_0x3c7e5d['split'](',');_0x447c9a[_0x5f3d('0x36')]=_[_0x5f3d('0xa')](_0x84787d,function(_0x49d36a){if(!_0x49d36a[_0x5f3d('0x28')]('globalStatus')){return!![];}_0x447c9a[_0x5f3d('0x37')]=_[_0x5f3d('0x38')](_0x49d36a,'-')?_0x5f3d('0x39'):_0x5f3d('0x3a');return![];});return _0x447c9a;}exports[_0x5f3d('0x3b')]=getUpdatedSortOptions;function validateSortParameter(_0x316d65){if(_0x316d65[_0x5f3d('0x28')](_0x5f3d('0x2f'))&&!_0x316d65[_0x5f3d('0x28')](_0x5f3d('0x3c'))){var _0x34a6ae=_0x316d65[_0x5f3d('0x3d')](0x0,_0x316d65[_0x5f3d('0x3e')]('fullname'));_0x316d65+=','+_0x34a6ae+_0x5f3d('0x3c');}return _0x316d65;}exports[_0x5f3d('0x3f')]=validateSortParameter;function sortAgentsByStatus(_0x17240f,_0x271683){var _0x1d187c=_0x17240f[_0x5f3d('0x40')](function(_0x354678,_0x3a60b3){if(_0x354678[_0x5f3d('0x34')]===_0x3a60b3[_0x5f3d('0x34')]){if(_0x354678[_0x5f3d('0x34')]===_0x5f3d('0x10')){if(_0x271683===_0x5f3d('0x39')){return(_0x354678['pauseType']||'')<(_0x3a60b3[_0x5f3d('0x32')]||'')||_0x354678[_0x5f3d('0x2f')][_0x5f3d('0x41')]()>_0x3a60b3[_0x5f3d('0x2f')][_0x5f3d('0x41')]()?0x1:-0x1;}else{return(_0x354678[_0x5f3d('0x32')]||'')<(_0x3a60b3[_0x5f3d('0x32')]||'')||_0x354678['fullname']['toLowerCase']()>_0x3a60b3[_0x5f3d('0x2f')][_0x5f3d('0x41')]()?-0x1:0x1;}}else{if(_0x271683===_0x5f3d('0x39')){return _0x354678[_0x5f3d('0x2f')]['toLowerCase']()<_0x3a60b3[_0x5f3d('0x2f')]['toLowerCase']()?0x1:-0x1;}else{return _0x354678['fullname'][_0x5f3d('0x41')]()<_0x3a60b3[_0x5f3d('0x2f')][_0x5f3d('0x41')]()?-0x1:0x1;}}}else{if(_0x271683==='DESC'){return _0x354678[_0x5f3d('0x34')]<_0x3a60b3[_0x5f3d('0x34')]?0x1:-0x1;}else{return _0x354678[_0x5f3d('0x34')]<_0x3a60b3['globalStatus']?-0x1:0x1;}}});return _0x1d187c;}exports['sortAgentsByStatus']=sortAgentsByStatus;function filterAgentAttributes(_0x5f3060){var _0x802f=[_0x5f3d('0x42'),'online',_0x5f3d('0x43'),'lastPauseAt','pauseType','lastPauseAt',_0x5f3d('0x3c'),_0x5f3d('0x44'),_0x5f3d('0x30'),'openchannelPause',_0x5f3d('0x6'),'smsPause',_0x5f3d('0x9'),_0x5f3d('0x5'),_0x5f3d('0x8'),'chatCapacity',_0x5f3d('0x45'),_0x5f3d('0x46'),_0x5f3d('0x47'),_0x5f3d('0x48'),'faxCapacity',_0x5f3d('0x49'),_0x5f3d('0x4a'),_0x5f3d('0x4b'),'smsCurrentCapacity','whatsappCurrentCapacity',_0x5f3d('0x4c'),_0x5f3d('0x11'),_0x5f3d('0x4d'),_0x5f3d('0x13'),_0x5f3d('0x14'),_0x5f3d('0x15'),'faxStatus',_0x5f3d('0xf'),'chatStatusTime',_0x5f3d('0x4e'),_0x5f3d('0x4f'),_0x5f3d('0x50'),_0x5f3d('0x51'),_0x5f3d('0x52'),_0x5f3d('0x53'),'queue','destconnectedlinenum',_0x5f3d('0x54'),_0x5f3d('0x55'),_0x5f3d('0x56'),_0x5f3d('0x57')];var _0x36a22c=[_0x5f3d('0x30'),_0x5f3d('0x31'),_0x5f3d('0x6'),_0x5f3d('0x7'),'whatsappPause',_0x5f3d('0x5'),'voicePause','online'];var _0xa359bf=_(_0x5f3060)['omit'](_0x36a22c)[_0x5f3d('0x58')](_0x802f)['value']();return _0xa359bf;}exports[_0x5f3d('0x59')]=filterAgentAttributes; \ No newline at end of file +var _0xea52=['client','http','chatPause','faxPause','mailPause','openchannelPause','smsPause','voicePause','whatsappPause','filter','length','idle','unknown','unavailable','voiceStatus','pause','every','chatStatus','faxStatus','openchannelStatus','whatsappStatus','request','Agents','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','then','getRealtimeAgents','*pause','busy','getAgentStatus','isArray','startCase','Queue','map','findOne','all','flatten','uniq','getAgentIdsByQueues','getAgentIdsByStatus','resolve','User','findAll','fullname','find','merge','globalStatus','getSortedAgentsIdsByStatus','split','fields','startsWith','DESC','ASC','getUpdatedSortOptions','includes','internal','substring','validateSortParameter','sort','pauseType','toLowerCase','userpic','lastPauseAt','address','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','chatStatusTime','openchannelStatusTime','mailStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','online','omit','pick','value','lodash','jayson/promise'];(function(_0x49fa98,_0x11accf){var _0x1698f1=function(_0x22f95f){while(--_0x22f95f){_0x49fa98['push'](_0x49fa98['shift']());}};_0x1698f1(++_0x11accf);}(_0xea52,0xb6));var _0x2ea5=function(_0x25b7bc,_0x4cb6bf){_0x25b7bc=_0x25b7bc-0x0;var _0x479fdb=_0xea52[_0x25b7bc];return _0x479fdb;};'use strict';var _=require(_0x2ea5('0x0'));var jayson=require(_0x2ea5('0x1'));var db=require('../../mysqldb')['db'];var amiClient=jayson[_0x2ea5('0x2')][_0x2ea5('0x3')]({'port':0x232a});var routingClient=jayson[_0x2ea5('0x2')][_0x2ea5('0x3')]({'port':0x232c});function isAgentPaused(_0x2c3792,_0x4bacaf){var _0x10b8cb=[_0x2c3792[_0x2ea5('0x4')],_0x2c3792[_0x2ea5('0x5')],_0x2c3792[_0x2ea5('0x6')],_0x2c3792[_0x2ea5('0x7')],_0x2c3792[_0x2ea5('0x8')],_0x2c3792[_0x2ea5('0x9')],_0x2c3792[_0x2ea5('0xa')]];if(!_0x4bacaf)return _['every'](_0x10b8cb);var _0x4293e0=_[_0x2ea5('0xb')](_0x10b8cb);return _0x4293e0['length']>0x0&&_0x4293e0[_0x2ea5('0xc')]<_0x10b8cb['length']?!![]:![];}function isIdle(_0x554e7f){return _0x554e7f===_0x2ea5('0xd')||_0x554e7f===_0x2ea5('0xe')||_0x554e7f===_0x2ea5('0xf')||_0x554e7f==='ringing'||_['isNil'](_0x554e7f);}function isAgentIdle(_0x373c71){if(_0x373c71[_0x2ea5('0x10')]!==_0x2ea5('0xd')&&_0x373c71[_0x2ea5('0x9')]){_0x373c71[_0x2ea5('0x10')]=_0x2ea5('0x11');return![];}return _[_0x2ea5('0x12')]([_0x373c71[_0x2ea5('0x13')],_0x373c71[_0x2ea5('0x14')],_0x373c71['mailStatus'],_0x373c71[_0x2ea5('0x15')],_0x373c71['smsStatus'],_0x373c71[_0x2ea5('0x10')],_0x373c71[_0x2ea5('0x16')]],isIdle);}function getRealtimeAgents(){return amiClient[_0x2ea5('0x17')](_0x2ea5('0x18'),{})['then'](function(_0x98fc){if(_0x98fc[_0x2ea5('0x19')]){throw new Error(_0x2ea5('0x1a'));}var _0x4dd0c0=_0x98fc[_0x2ea5('0x1b')];return routingClient[_0x2ea5('0x17')]('Agents',{})[_0x2ea5('0x1c')](function(_0x187665){if(_0x187665[_0x2ea5('0x19')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)');}var _0x3a368b=_0x187665[_0x2ea5('0x1b')];return _['merge']({},_0x4dd0c0,_0x3a368b);});})['catch'](function(_0x1cd726){throw _0x1cd726;});}exports[_0x2ea5('0x1d')]=getRealtimeAgents;function getAgentStatus(_0x5b059c){var _0xff829f=_0x2ea5('0xe');if(isAgentPaused(_0x5b059c))_0xff829f=_0x2ea5('0x11');else if(isAgentPaused(_0x5b059c,!![]))_0xff829f=_0x2ea5('0x1e');else if(isAgentIdle(_0x5b059c))_0xff829f=_0x2ea5('0xd');else _0xff829f=_0x2ea5('0x1f');return _0xff829f;}exports[_0x2ea5('0x20')]=getAgentStatus;function getAgentIdsByQueues(_0x5606ba,_0x1b0493){var _0x545cf1=_[_0x2ea5('0x21')](_0x5606ba)?_0x5606ba:[_0x5606ba];var _0x3eb768=_[_0x2ea5('0x22')](_0x1b0493)+_0x2ea5('0x23');var _0xc1a727=_[_0x2ea5('0x24')](_0x545cf1,function(_0x3ec00c){return db[_0x3eb768][_0x2ea5('0x25')]({'where':{'id':_0x3ec00c}})['then'](function(_0x2cf169){if(!_0x2cf169)return[];return _0x2cf169['getAgents']({'attributes':['id'],'raw':!![]});});});return Promise[_0x2ea5('0x26')](_0xc1a727)[_0x2ea5('0x1c')](function(_0x4c1f89){var _0x414fdb=_(_0x4c1f89)[_0x2ea5('0x27')]()[_0x2ea5('0x24')]('id')[_0x2ea5('0x28')]()['value']();return _0x414fdb;});}exports[_0x2ea5('0x29')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x4efc83,_0x3b23ca,_0x2674ef){try{if(_0x3b23ca[_0x2ea5('0xc')]>0x0){_0x4efc83=_0x4efc83[_0x2ea5('0xb')](function(_0x4b9edb){return _0x3b23ca['includes'](_0x4b9edb['id']);});}var _0x426e9b=_0x4efc83[_0x2ea5('0xb')](function(_0x45fefb){var _0x3f2795=_0x2ea5('0x1f');if(isAgentIdle(_0x45fefb)){_0x3f2795=_0x2ea5('0xd');}return _0x3f2795===_0x2674ef;});return _[_0x2ea5('0x24')](_0x426e9b,'id');}catch(_0x143daf){throw _0x143daf;}}exports[_0x2ea5('0x2a')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x1a42ba,_0x1c547b,_0x3a22ad){return Promise[_0x2ea5('0x2b')]()['then'](function(){if(_0x1c547b[_0x2ea5('0xc')]>0x0){_0x1a42ba=_0x1a42ba['filter'](function(_0x3600b8){return _0x1c547b['includes'](_0x3600b8['id']);});}return _0x1a42ba;})[_0x2ea5('0x1c')](function(){return db[_0x2ea5('0x2c')][_0x2ea5('0x2d')]({'attributes':['id','name',_0x2ea5('0x2e'),_0x2ea5('0x4'),_0x2ea5('0x5'),'mailPause',_0x2ea5('0x7'),'smsPause',_0x2ea5('0x9'),_0x2ea5('0xa'),'pauseType'],'where':{'id':{'$in':_[_0x2ea5('0x24')](_0x1a42ba,'id')}},'raw':!![]});})[_0x2ea5('0x1c')](function(_0xfbadb){return _0xfbadb[_0x2ea5('0x24')](function(_0x20a640){var _0x5475ce=_[_0x2ea5('0x2f')](_0x1a42ba,['id',_0x20a640['id']]);var _0x1c5fd5=filterAgentAttributes(_0x5475ce);_[_0x2ea5('0x30')](_0x20a640,_0x1c5fd5);_0x20a640[_0x2ea5('0x31')]=getAgentStatus(_0x20a640);return _0x20a640;});})[_0x2ea5('0x1c')](function(_0x5cf275){var _0x3bd99a=sortAgentsByStatus(_0x5cf275,_0x3a22ad);return _['map'](_0x3bd99a,'id');})['catch'](function(_0x529486){throw _0x529486;});}exports[_0x2ea5('0x32')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x5e3540){var _0x6b0093={'fields':[],'order':null};var _0x35556b=_0x5e3540[_0x2ea5('0x33')](',');_0x6b0093[_0x2ea5('0x34')]=_['filter'](_0x35556b,function(_0x18518a){if(!_0x18518a['includes'](_0x2ea5('0x31'))){return!![];}_0x6b0093['order']=_[_0x2ea5('0x35')](_0x18518a,'-')?_0x2ea5('0x36'):_0x2ea5('0x37');return![];});return _0x6b0093;}exports[_0x2ea5('0x38')]=getUpdatedSortOptions;function validateSortParameter(_0xa83646){if(_0xa83646[_0x2ea5('0x39')]('fullname')&&!_0xa83646[_0x2ea5('0x39')](_0x2ea5('0x3a'))){var _0x4d9388=_0xa83646[_0x2ea5('0x3b')](0x0,_0xa83646['indexOf'](_0x2ea5('0x2e')));_0xa83646+=','+_0x4d9388+_0x2ea5('0x3a');}return _0xa83646;}exports[_0x2ea5('0x3c')]=validateSortParameter;function sortAgentsByStatus(_0x36b105,_0x34485b){var _0xccabf0=_0x36b105[_0x2ea5('0x3d')](function(_0x146eea,_0x38240c){if(_0x146eea[_0x2ea5('0x31')]===_0x38240c[_0x2ea5('0x31')]){if(_0x146eea['globalStatus']===_0x2ea5('0x11')){if(_0x34485b==='DESC'){return(_0x146eea[_0x2ea5('0x3e')]||'')<(_0x38240c[_0x2ea5('0x3e')]||'')||_0x146eea[_0x2ea5('0x2e')][_0x2ea5('0x3f')]()>_0x38240c[_0x2ea5('0x2e')][_0x2ea5('0x3f')]()?0x1:-0x1;}else{return(_0x146eea['pauseType']||'')<(_0x38240c['pauseType']||'')||_0x146eea[_0x2ea5('0x2e')][_0x2ea5('0x3f')]()>_0x38240c['fullname'][_0x2ea5('0x3f')]()?-0x1:0x1;}}else{if(_0x34485b===_0x2ea5('0x36')){return _0x146eea[_0x2ea5('0x2e')][_0x2ea5('0x3f')]()<_0x38240c[_0x2ea5('0x2e')]['toLowerCase']()?0x1:-0x1;}else{return _0x146eea[_0x2ea5('0x2e')][_0x2ea5('0x3f')]()<_0x38240c['fullname'][_0x2ea5('0x3f')]()?-0x1:0x1;}}}else{if(_0x34485b===_0x2ea5('0x36')){return _0x146eea[_0x2ea5('0x31')]<_0x38240c['globalStatus']?0x1:-0x1;}else{return _0x146eea[_0x2ea5('0x31')]<_0x38240c[_0x2ea5('0x31')]?-0x1:0x1;}}});return _0xccabf0;}exports['sortAgentsByStatus']=sortAgentsByStatus;function filterAgentAttributes(_0x599706){var _0x575869=[_0x2ea5('0x40'),'online','lastLoginAt',_0x2ea5('0x41'),_0x2ea5('0x3e'),_0x2ea5('0x41'),_0x2ea5('0x3a'),_0x2ea5('0x42'),'chatPause',_0x2ea5('0x7'),_0x2ea5('0x6'),_0x2ea5('0x8'),'whatsappPause','faxPause',_0x2ea5('0x9'),'chatCapacity',_0x2ea5('0x43'),_0x2ea5('0x44'),_0x2ea5('0x45'),_0x2ea5('0x46'),'faxCapacity',_0x2ea5('0x47'),_0x2ea5('0x48'),_0x2ea5('0x49'),_0x2ea5('0x4a'),_0x2ea5('0x4b'),'faxCurrentCapacity',_0x2ea5('0x13'),_0x2ea5('0x15'),'mailStatus','smsStatus','whatsappStatus',_0x2ea5('0x14'),'voiceStatus',_0x2ea5('0x4c'),_0x2ea5('0x4d'),_0x2ea5('0x4e'),'smsStatusTime',_0x2ea5('0x4f'),_0x2ea5('0x50'),_0x2ea5('0x51'),_0x2ea5('0x52'),_0x2ea5('0x53'),_0x2ea5('0x54'),_0x2ea5('0x55'),_0x2ea5('0x56'),_0x2ea5('0x57')];var _0xd2859=[_0x2ea5('0x4'),_0x2ea5('0x7'),_0x2ea5('0x6'),'smsPause',_0x2ea5('0xa'),'faxPause','voicePause',_0x2ea5('0x58')];var _0x17fdd1=_(_0x599706)[_0x2ea5('0x59')](_0xd2859)[_0x2ea5('0x5a')](_0x575869)[_0x2ea5('0x5b')]();return _0x17fdd1;}exports['filterAgentAttributes']=filterAgentAttributes; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index 9143ef0..929ad12 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 _0x3f21=['initializeQueues','lodash','jayson/promise','util','client','http','available','loggedIn','paused','busy','inUse','invalid','loggedInDb','notInUse','onHold','ringing','ringInUse','talking','unavailable','unknown','pTalking','originated','statusMessage','dialActive','Trunk','startPredictive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','startCase','Queues','then','error','result','concat','outbound','map','get','waiting','find','merge','pick'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3f21,0x174));var _0x13f2=function(_0xb9280f,_0x14f5f4){_0xb9280f=_0xb9280f-0x0;var _0x539e83=_0x3f21[_0xb9280f];return _0x539e83;};'use strict';var _=require(_0x13f2('0x0'));var jayson=require(_0x13f2('0x1'));var util=require(_0x13f2('0x2'));var amiClient=jayson[_0x13f2('0x3')]['http']({'port':0x232a});var routingClient=jayson['client'][_0x13f2('0x4')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x13f2('0x5'),_0x13f2('0x6'),_0x13f2('0x7'),'waiting'];var VOICE_QUEUE_ATTRIBUTES=[_0x13f2('0x8'),_0x13f2('0x9'),_0x13f2('0xa'),_0x13f2('0xb'),_0x13f2('0xc'),_0x13f2('0xd'),_0x13f2('0xe'),_0x13f2('0xf'),_0x13f2('0x10'),_0x13f2('0x11'),_0x13f2('0x12')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x13f2('0x13'),_0x13f2('0x14'),'message',_0x13f2('0x15'),_0x13f2('0x16'),'dialMethod',_0x13f2('0x17'),_0x13f2('0x18'),'startProgressive',_0x13f2('0x19'),_0x13f2('0x1a'),_0x13f2('0x1b'),_0x13f2('0x1c'),_0x13f2('0x1d'),'dialPredictiveIntervalMaxThreshold',_0x13f2('0x1e'),_0x13f2('0x1f'),_0x13f2('0x20'),_0x13f2('0x21'),_0x13f2('0x22'),_0x13f2('0x23'),_0x13f2('0x24'),_0x13f2('0x25')];function getRealtimeQueues(_0x33deb5,_0x114bab){var _0x3b66d4=_0x114bab===_0x13f2('0x26')?amiClient:routingClient;return _0x3b66d4['request'](_[_0x13f2('0x27')](_0x114bab)+_0x13f2('0x28'),_0x33deb5)[_0x13f2('0x29')](function(_0x2eb8d1){if(_0x2eb8d1[_0x13f2('0x2a')])throw new Error(util['format']('Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues',_0x114bab));return _0x2eb8d1[_0x13f2('0x2b')];})['catch'](function(_0x4a5fe8){throw _0x4a5fe8;});}exports['getRealtimeQueues']=getRealtimeQueues;function initializeQueues(_0x3b7867,_0x293167,_0x1e26d7,_0x47a490){var _0x7917ab=DEFAULT_QUEUE_ATTRIBUTES;if(_0x1e26d7===_0x13f2('0x26')){if(_0x47a490==='inbound'){_0x7917ab=_0x7917ab[_0x13f2('0x2c')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x47a490===_0x13f2('0x2d')){_0x7917ab=_0x7917ab[_0x13f2('0x2c')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x3b7867[_0x13f2('0x2e')](function(_0xd0b1d9){var _0x6ba8b2=_0xd0b1d9[_0x13f2('0x2f')]({'plain':!![]});_0x6ba8b2[_0x13f2('0x7')]=0x0;_0x6ba8b2['loggedInDb']=0x0;_0x6ba8b2[_0x13f2('0x6')]=0x0;_0x6ba8b2['available']=0x0;_0x6ba8b2[_0x13f2('0x30')]=0x0;if(_0x1e26d7==='voice'){_0x6ba8b2[_0x13f2('0x10')]=0x0;_0x6ba8b2[_0x13f2('0x8')]=0x0;if(_0x47a490===_0x13f2('0x2d')){_0x6ba8b2[_0x13f2('0x13')]=0x0;_0x6ba8b2['originated']=0x0;}}var _0x5ae9b6=_[_0x13f2('0x31')](_0x293167,['id',_0x6ba8b2['id']]);if(_0x5ae9b6){_[_0x13f2('0x32')](_0x6ba8b2,_[_0x13f2('0x33')](_0x5ae9b6,_0x7917ab));}return _0x6ba8b2;});}exports[_0x13f2('0x34')]=initializeQueues; \ No newline at end of file +var _0x8ce6=['waiting','busy','inUse','invalid','loggedInDb','ringing','unavailable','pTalking','originated','message','statusMessage','dialActive','dialMethod','Trunk','startPredictive','startProgressive','erlangCallToSecond','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgTalktime','voice','request','startCase','Queues','error','result','catch','getRealtimeQueues','concat','outbound','paused','merge','pick','lodash','jayson/promise','util','client','http','available','loggedIn'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8ce6,0xb1));var _0x68ce=function(_0xd89753,_0x1073cd){_0xd89753=_0xd89753-0x0;var _0xf347d=_0x8ce6[_0xd89753];return _0xf347d;};'use strict';var _=require(_0x68ce('0x0'));var jayson=require(_0x68ce('0x1'));var util=require(_0x68ce('0x2'));var amiClient=jayson[_0x68ce('0x3')][_0x68ce('0x4')]({'port':0x232a});var routingClient=jayson['client'][_0x68ce('0x4')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x68ce('0x5'),_0x68ce('0x6'),'paused',_0x68ce('0x7')];var VOICE_QUEUE_ATTRIBUTES=[_0x68ce('0x8'),_0x68ce('0x9'),_0x68ce('0xa'),_0x68ce('0xb'),'notInUse','onHold',_0x68ce('0xc'),'ringInUse','talking',_0x68ce('0xd'),'unknown'];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x68ce('0xe'),_0x68ce('0xf'),_0x68ce('0x10'),_0x68ce('0x11'),_0x68ce('0x12'),_0x68ce('0x13'),_0x68ce('0x14'),_0x68ce('0x15'),_0x68ce('0x16'),'erlangCalls',_0x68ce('0x17'),'erlangAbandonmentRate',_0x68ce('0x18'),_0x68ce('0x19'),_0x68ce('0x1a'),_0x68ce('0x1b'),'predictiveIntervalAvailable',_0x68ce('0x1c'),_0x68ce('0x1d'),_0x68ce('0x1e'),_0x68ce('0x1f'),'predictiveIntervalAvgHoldtime',_0x68ce('0x20')];function getRealtimeQueues(_0x1d8922,_0x282d6d){var _0x215306=_0x282d6d===_0x68ce('0x21')?amiClient:routingClient;return _0x215306[_0x68ce('0x22')](_[_0x68ce('0x23')](_0x282d6d)+_0x68ce('0x24'),_0x1d8922)['then'](function(_0x25ea4b){if(_0x25ea4b[_0x68ce('0x25')])throw new Error(util['format']('Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues',_0x282d6d));return _0x25ea4b[_0x68ce('0x26')];})[_0x68ce('0x27')](function(_0x57d0dc){throw _0x57d0dc;});}exports[_0x68ce('0x28')]=getRealtimeQueues;function initializeQueues(_0x4b34f5,_0x373824,_0x53f913,_0x122490){var _0x524d75=DEFAULT_QUEUE_ATTRIBUTES;if(_0x53f913==='voice'){if(_0x122490==='inbound'){_0x524d75=_0x524d75[_0x68ce('0x29')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x122490===_0x68ce('0x2a')){_0x524d75=_0x524d75[_0x68ce('0x29')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x4b34f5['map'](function(_0x46aab1){var _0x48aec0=_0x46aab1['get']({'plain':!![]});_0x48aec0[_0x68ce('0x2b')]=0x0;_0x48aec0['loggedInDb']=0x0;_0x48aec0[_0x68ce('0x6')]=0x0;_0x48aec0[_0x68ce('0x5')]=0x0;_0x48aec0[_0x68ce('0x7')]=0x0;if(_0x53f913===_0x68ce('0x21')){_0x48aec0['talking']=0x0;_0x48aec0[_0x68ce('0x8')]=0x0;if(_0x122490===_0x68ce('0x2a')){_0x48aec0['pTalking']=0x0;_0x48aec0[_0x68ce('0xf')]=0x0;}}var _0x39e693=_['find'](_0x373824,['id',_0x48aec0['id']]);if(_0x39e693){_[_0x68ce('0x2c')](_0x48aec0,_[_0x68ce('0x2d')](_0x39e693,_0x524d75));}return _0x48aec0;});}exports['initializeQueues']=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 8fb62fa..f3d82e9 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['get','production','set','appPath','public','join','root','client','use','toISOString','split','static','views','/server/views','engine','html','ejs','urlencoded','50mb','json','initialize','express','method-override','cookie-parser','passport','./environment','default'];(function(_0x16d411,_0x5e0970){var _0x20336d=function(_0x15d8aa){while(--_0x15d8aa){_0x16d411['push'](_0x16d411['shift']());}};_0x20336d(++_0x5e0970);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'use strict';var express=require(_0x0a9e('0x0'));var methodOverride=require(_0x0a9e('0x1'));var cookieParser=require(_0x0a9e('0x2'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0x0a9e('0x3'));var cors=require('cors');var config=require(_0x0a9e('0x4'));exports[_0x0a9e('0x5')]=function(_0x2ab90b){var _0x991246=_0x2ab90b[_0x0a9e('0x6')]('env');if(_0x991246===_0x0a9e('0x7')){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path['join'](config['root'],_0x0a9e('0xa')));}if(_0x991246==='development'||_0x991246==='test'){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path[_0x0a9e('0xb')](config[_0x0a9e('0xc')],_0x0a9e('0xd')));_0x2ab90b[_0x0a9e('0xe')](errorHandler());}_0x2ab90b['set']('json\x20replacer',function(_0x527cdd,_0x4cfe67){if(this[_0x527cdd]instanceof Date){_0x4cfe67=this[_0x527cdd][_0x0a9e('0xf')]()[_0x0a9e('0x10')]('.')[0x0]+'Z';}return _0x4cfe67;});_0x2ab90b[_0x0a9e('0xe')](express[_0x0a9e('0x11')](_0x2ab90b[_0x0a9e('0x6')](_0x0a9e('0x9'))));_0x2ab90b['set'](_0x0a9e('0x12'),config[_0x0a9e('0xc')]+_0x0a9e('0x13'));_0x2ab90b[_0x0a9e('0x14')](_0x0a9e('0x15'),require(_0x0a9e('0x16'))['renderFile']);_0x2ab90b[_0x0a9e('0x8')]('view\x20engine',_0x0a9e('0x15'));_0x2ab90b['use'](express[_0x0a9e('0x17')]({'limit':_0x0a9e('0x18'),'extended':!![]}));_0x2ab90b['use'](express[_0x0a9e('0x19')]({'limit':'50mb'}));_0x2ab90b[_0x0a9e('0xe')](cors());_0x2ab90b[_0x0a9e('0xe')](methodOverride());_0x2ab90b[_0x0a9e('0xe')](cookieParser());_0x2ab90b[_0x0a9e('0xe')](passport[_0x0a9e('0x1a')]());}; \ No newline at end of file +var _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(_0x5d869e,_0x1731bd){var _0x13a90b=function(_0x21719e){while(--_0x21719e){_0x5d869e['push'](_0x5d869e['shift']());}};_0x13a90b(++_0x1731bd);}(_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 diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 9fa9417..85cf9e5 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 _0xd925=['filter','family','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','map','model','join','createHash','update','digest','getUuid','platform','licenseToken','win32','dmidecode\x20--string\x20system-uuid','utf8','macAddress','ipAddress','md5','hex','substring','lodash','crypto','execSync','../environment','networkInterfaces','orderBy','keys','length'];(function(_0xf0bcac,_0x531755){var _0x4e4c65=function(_0x35a77a){while(--_0x35a77a){_0xf0bcac['push'](_0xf0bcac['shift']());}};_0x4e4c65(++_0x531755);}(_0xd925,0xed));var _0x5d92=function(_0x51f5a6,_0x4cdf08){_0x51f5a6=_0x51f5a6-0x0;var _0x3f318f=_0xd925[_0x51f5a6];return _0x3f318f;};'use strict';var _=require(_0x5d92('0x0'));var os=require('os');var crypto=require(_0x5d92('0x1'));var machine=require('bimedia-machine-uuid');var exec=require('child_process')[_0x5d92('0x2')];var config=require(_0x5d92('0x3'));function getInterfaces(){var _0x4f2463=[];var _0x32f691=os[_0x5d92('0x4')]();var _0x40f2c9=_[_0x5d92('0x5')](_[_0x5d92('0x6')](_0x32f691));for(var _0x492554=0x0;_0x492554<_0x40f2c9[_0x5d92('0x7')];_0x492554++){var _0x583bf4=_0x32f691[_0x40f2c9[_0x492554]][_0x5d92('0x8')](function(_0x4ad363){return _0x4ad363[_0x5d92('0x9')]==='IPv4'&&_0x4ad363['internal']===![];});_0x4f2463=_0x4f2463[_0x5d92('0xa')](_0x583bf4);}return _0x4f2463;}function getFirstInterface(){var _0x263183=_[_0x5d92('0xb')](getInterfaces());return{'macAddress':_0x263183&&_0x263183[_0x5d92('0xc')]?_0x263183[_0x5d92('0xc')]:_0x5d92('0xd'),'ipAddress':_0x263183&&_0x263183[_0x5d92('0xe')]?_0x263183[_0x5d92('0xe')]:_0x5d92('0xf')};}exports[_0x5d92('0x10')]=getFirstInterface;function getCPUhash(){var _0xb340ef=_[_0x5d92('0x5')](os[_0x5d92('0x11')]()[_0x5d92('0x12')](function(_0x39cb36){return _0x39cb36[_0x5d92('0x13')];}))[_0x5d92('0x14')](':');return crypto[_0x5d92('0x15')]('md5')[_0x5d92('0x16')](_0xb340ef)[_0x5d92('0x17')]('hex');}exports[_0x5d92('0x18')]=function(){var _0xccbd09=os[_0x5d92('0x19')]();var _0x513d4=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x513d4['test'](config[_0x5d92('0x1a')])){return config[_0x5d92('0x1a')];}else if(_0xccbd09===_0x5d92('0x1b')){return exec(_0x5d92('0x1c'),{'encoding':_0x5d92('0x1d')})['replace']('\x0d\x0a','');}else{var _0x24755b=getFirstInterface();var _0x23fe57=getCPUhash();var _0x277971=_0x23fe57+'|'+os['hostname']()+'|'+_0x24755b[_0x5d92('0x1e')]+'|'+_0x24755b[_0x5d92('0x1f')];var _0x10f05b=crypto[_0x5d92('0x15')](_0x5d92('0x20'))['update'](_0x277971)[_0x5d92('0x17')](_0x5d92('0x21'));return _0x10f05b['substring'](0x0,0x8)+'-'+_0x10f05b[_0x5d92('0x22')](0x8,0xc)+'-'+_0x10f05b[_0x5d92('0x22')](0xc,0x10)+'-'+_0x10f05b[_0x5d92('0x22')](0x10,0x14)+'-'+_0x10f05b[_0x5d92('0x22')](0x14);}}; \ No newline at end of file +var _0x4eca=['keys','filter','family','IPv4','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','orderBy','map','model','join','createHash','update','getUuid','test','licenseToken','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','md5','digest','hex','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces'];(function(_0x84bd8c,_0x498d95){var _0x9a8624=function(_0x162357){while(--_0x162357){_0x84bd8c['push'](_0x84bd8c['shift']());}};_0x9a8624(++_0x498d95);}(_0x4eca,0x109));var _0xa4ec=function(_0x17dfcc,_0x4cd857){_0x17dfcc=_0x17dfcc-0x0;var _0x55254c=_0x4eca[_0x17dfcc];return _0x55254c;};'use strict';var _=require(_0xa4ec('0x0'));var os=require('os');var crypto=require(_0xa4ec('0x1'));var machine=require(_0xa4ec('0x2'));var exec=require(_0xa4ec('0x3'))[_0xa4ec('0x4')];var config=require(_0xa4ec('0x5'));function getInterfaces(){var _0x447dee=[];var _0x37ceea=os[_0xa4ec('0x6')]();var _0x3ad854=_['orderBy'](_[_0xa4ec('0x7')](_0x37ceea));for(var _0x3c3994=0x0;_0x3c3994<_0x3ad854['length'];_0x3c3994++){var _0xdd0900=_0x37ceea[_0x3ad854[_0x3c3994]][_0xa4ec('0x8')](function(_0x7c5ecf){return _0x7c5ecf[_0xa4ec('0x9')]===_0xa4ec('0xa')&&_0x7c5ecf['internal']===![];});_0x447dee=_0x447dee[_0xa4ec('0xb')](_0xdd0900);}return _0x447dee;}function getFirstInterface(){var _0x1657dc=_[_0xa4ec('0xc')](getInterfaces());return{'macAddress':_0x1657dc&&_0x1657dc[_0xa4ec('0xd')]?_0x1657dc[_0xa4ec('0xd')]:_0xa4ec('0xe'),'ipAddress':_0x1657dc&&_0x1657dc[_0xa4ec('0xf')]?_0x1657dc[_0xa4ec('0xf')]:_0xa4ec('0x10')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0xb575f6=_[_0xa4ec('0x11')](os['cpus']()[_0xa4ec('0x12')](function(_0x2eb5af){return _0x2eb5af[_0xa4ec('0x13')];}))[_0xa4ec('0x14')](':');return crypto[_0xa4ec('0x15')]('md5')[_0xa4ec('0x16')](_0xb575f6)['digest']('hex');}exports[_0xa4ec('0x17')]=function(){var _0xae62ca=os['platform']();var _0x538137=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x538137[_0xa4ec('0x18')](config[_0xa4ec('0x19')])){return config['licenseToken'];}else if(_0xae62ca===_0xa4ec('0x1a')){return exec(_0xa4ec('0x1b'),{'encoding':_0xa4ec('0x1c')})[_0xa4ec('0x1d')]('\x0d\x0a','');}else{var _0x318ebf=getFirstInterface();var _0x26e826=getCPUhash();var _0x1f294b=_0x26e826+'|'+os['hostname']()+'|'+_0x318ebf['macAddress']+'|'+_0x318ebf['ipAddress'];var _0x5c89b2=crypto['createHash'](_0xa4ec('0x1e'))[_0xa4ec('0x16')](_0x1f294b)[_0xa4ec('0x1f')](_0xa4ec('0x20'));return _0x5c89b2[_0xa4ec('0x21')](0x0,0x8)+'-'+_0x5c89b2[_0xa4ec('0x21')](0x8,0xc)+'-'+_0x5c89b2[_0xa4ec('0x21')](0xc,0x10)+'-'+_0x5c89b2[_0xa4ec('0x21')](0x10,0x14)+'-'+_0x5c89b2['substring'](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index fec7ea7..afdc8b2 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 _0x0c7f=['bluebird','version','../../mysqldb','../../components/encryptor','./hardware','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','catch','get','data1','data2','then','active','license','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','YYYY-MM-DD\x20HH:mm','update','encryptString','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','error','message','finally','getUuid','findOrCreate','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','moment','request-promise'];(function(_0x2d8fc2,_0x1c461d){var _0x3a9e53=function(_0x18941c){while(--_0x18941c){_0x2d8fc2['push'](_0x2d8fc2['shift']());}};_0x3a9e53(++_0x1c461d);}(_0x0c7f,0x1e9));var _0xf0c7=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x0c7f[_0x14add3];return _0x4a174f;};'use strict';var util=require(_0xf0c7('0x0'));var moment=require(_0xf0c7('0x1'));var rp=require(_0xf0c7('0x2'));var BPromise=require(_0xf0c7('0x3'));var pkginfo=require('pkginfo')(module,_0xf0c7('0x4'));var db=require(_0xf0c7('0x5'))['db'];var encryptor=require(_0xf0c7('0x6'));var hardware=require(_0xf0c7('0x7'));var logger=require('../logger')('license');var HOST=_0xf0c7('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x230f31){return new BPromise(function(_0x3c9751,_0x132c0c){var _0x34c579=util[_0xf0c7('0x9')](_0xf0c7('0xa'),HOST,_0x230f31,module[_0xf0c7('0xb')][_0xf0c7('0x4')]);if(oldToken){_0x34c579=util['format'](_0xf0c7('0xc'),HOST,_0x230f31,module[_0xf0c7('0xb')][_0xf0c7('0x4')],oldToken);}var _0x14ad0b={'uri':_0x34c579,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x14ad0b)['then'](function(_0x3ed815){_0x3c9751(_0x3ed815);})[_0xf0c7('0xd')](function(_0x53e13d){_0x132c0c(_0x53e13d);});});}function manageLicense(_0x14c269,_0x408f13){var _0x57a114=_0x408f13[_0xf0c7('0xe')]({'plain':!![]});if(!isOldTokenSent&&_0x57a114[_0xf0c7('0xf')]!==_0x14c269&&!_0x57a114[_0xf0c7('0x10')]){oldToken=_0x57a114[_0xf0c7('0xf')];}httpRequest(_0x14c269)[_0xf0c7('0x11')](function(_0x3ee2ed){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x3ee2ed[_0xf0c7('0x12')]){isOldTokenSent=![];if(!_0x57a114[_0xf0c7('0x13')]&&_0x57a114[_0xf0c7('0x13')]!=_0x3ee2ed[_0xf0c7('0x13')]||_0x57a114['license']&&_0x57a114['data2']){logger[_0xf0c7('0x14')](_0xf0c7('0x15'));}if(_0x57a114[_0xf0c7('0x13')]&&!_0x57a114[_0xf0c7('0x10')]&&_0x57a114['license']!=_0x3ee2ed['license']){logger['info'](_0xf0c7('0x16'));}if(_0x57a114[_0xf0c7('0x13')]&&!_0x57a114[_0xf0c7('0x10')]&&_0x57a114[_0xf0c7('0x13')]==_0x3ee2ed[_0xf0c7('0x13')]){return _0x408f13;}return _0x408f13['update']({'data1':_0x14c269,'data2':null,'license':_0x3ee2ed[_0xf0c7('0x13')]});}else{if(_0x3ee2ed[_0xf0c7('0x13')]||_0x57a114[_0xf0c7('0x13')]){if(!_0x57a114[_0xf0c7('0x10')]){if(_0x57a114[_0xf0c7('0xf')]==_0x14c269){GRAY_PERIOD_REASON=_0xf0c7('0x17');logger['info'](_0xf0c7('0x18'));}else{GRAY_PERIOD_REASON=_0xf0c7('0x19');logger[_0xf0c7('0x14')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x57a114[_0xf0c7('0xf')],_0x14c269);}logger[_0xf0c7('0x14')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0xf0c7('0x9')](_0xf0c7('0x1a')));return _0x408f13[_0xf0c7('0x1b')]({'data2':encryptor[_0xf0c7('0x1c')](moment()[_0xf0c7('0x9')](_0xf0c7('0x1a')))});}else{if(moment()[_0xf0c7('0x1d')](encryptor[_0xf0c7('0x1e')](_0x57a114[_0xf0c7('0x10')]),_0xf0c7('0x1f'))>DAYS){logger[_0xf0c7('0x14')](_0xf0c7('0x20'),moment()[_0xf0c7('0x9')](_0xf0c7('0x1a')));isOldTokenSent=![];return _0x408f13[_0xf0c7('0x1b')]({'data1':_0x14c269,'data2':null,'license':null});}}}else{if(_0x57a114[_0xf0c7('0xf')]!=_0x14c269){logger[_0xf0c7('0x14')](_0xf0c7('0x21'),_0x57a114[_0xf0c7('0xf')],_0x14c269);return _0x408f13[_0xf0c7('0x1b')]({'data1':_0x14c269,'data2':null,'license':null});}}}return _0x408f13;})[_0xf0c7('0x11')](function(_0x2bd3d2){_0x408f13=_0x2bd3d2;})['catch'](function(_0x360a5b){logger[_0xf0c7('0x22')](_0x360a5b[_0xf0c7('0x23')]);})[_0xf0c7('0x24')](function(){setTimeout(function(){manageLicense(hardware[_0xf0c7('0x25')](),_0x408f13);},TIME);});}function defaultLicense(){var _0x20ed4c=hardware[_0xf0c7('0x25')]();if(_0x20ed4c){return db['License'][_0xf0c7('0x26')]({'where':{'id':0x1},'defaults':{'data1':_0x20ed4c}})['spread'](function(_0x2920bc,_0x1d154d){logger[_0xf0c7('0x14')](_0xf0c7('0x27'),_0x20ed4c);manageLicense(_0x20ed4c,_0x2920bc);})['catch'](function(_0x19ac03){logger[_0xf0c7('0x22')](_0x19ac03[_0xf0c7('0x23')]);});}}exports[_0xf0c7('0x28')]=defaultLicense; \ No newline at end of file +var _0x6806=['SERVICE\x20LICENSE\x20STARTED\x20%s','message','default','util','moment','request-promise','bluebird','pkginfo','version','../../components/encryptor','./hardware','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','get','data1','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','update','encryptString','diff','decryptString','DEMO\x20START\x20AT\x20%s','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','error','finally','getUuid','License','spread'];(function(_0x47f14c,_0x18fe67){var _0x119dc9=function(_0x335cbf){while(--_0x335cbf){_0x47f14c['push'](_0x47f14c['shift']());}};_0x119dc9(++_0x18fe67);}(_0x6806,0x174));var _0x6680=function(_0x4aecf1,_0x4b2396){_0x4aecf1=_0x4aecf1-0x0;var _0x21af74=_0x6806[_0x4aecf1];return _0x21af74;};'use strict';var util=require(_0x6680('0x0'));var moment=require(_0x6680('0x1'));var rp=require(_0x6680('0x2'));var BPromise=require(_0x6680('0x3'));var pkginfo=require(_0x6680('0x4'))(module,_0x6680('0x5'));var db=require('../../mysqldb')['db'];var encryptor=require(_0x6680('0x6'));var hardware=require(_0x6680('0x7'));var logger=require('../logger')(_0x6680('0x8'));var HOST=_0x6680('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x2e4471){return new BPromise(function(_0x230d00,_0x759254){var _0x105ee1=util[_0x6680('0xa')](_0x6680('0xb'),HOST,_0x2e4471,module['exports'][_0x6680('0x5')]);if(oldToken){_0x105ee1=util['format'](_0x6680('0xc'),HOST,_0x2e4471,module['exports'][_0x6680('0x5')],oldToken);}var _0x139ef9={'uri':_0x105ee1,'method':_0x6680('0xd'),'timeout':0xea60,'json':!![]};return rp(_0x139ef9)[_0x6680('0xe')](function(_0x2de7e8){_0x230d00(_0x2de7e8);})[_0x6680('0xf')](function(_0xbfdaaf){_0x759254(_0xbfdaaf);});});}function manageLicense(_0xc51332,_0x25d4c0){var _0x5d8ad8=_0x25d4c0[_0x6680('0x10')]({'plain':!![]});if(!isOldTokenSent&&_0x5d8ad8[_0x6680('0x11')]!==_0xc51332&&!_0x5d8ad8[_0x6680('0x12')]){oldToken=_0x5d8ad8[_0x6680('0x11')];}httpRequest(_0xc51332)['then'](function(_0x7b651e){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x7b651e['active']){isOldTokenSent=![];if(!_0x5d8ad8[_0x6680('0x8')]&&_0x5d8ad8[_0x6680('0x8')]!=_0x7b651e[_0x6680('0x8')]||_0x5d8ad8[_0x6680('0x8')]&&_0x5d8ad8[_0x6680('0x12')]){logger[_0x6680('0x13')](_0x6680('0x14'));}if(_0x5d8ad8[_0x6680('0x8')]&&!_0x5d8ad8[_0x6680('0x12')]&&_0x5d8ad8[_0x6680('0x8')]!=_0x7b651e[_0x6680('0x8')]){logger[_0x6680('0x13')](_0x6680('0x15'));}if(_0x5d8ad8[_0x6680('0x8')]&&!_0x5d8ad8[_0x6680('0x12')]&&_0x5d8ad8['license']==_0x7b651e[_0x6680('0x8')]){return _0x25d4c0;}return _0x25d4c0['update']({'data1':_0xc51332,'data2':null,'license':_0x7b651e[_0x6680('0x8')]});}else{if(_0x7b651e[_0x6680('0x8')]||_0x5d8ad8['license']){if(!_0x5d8ad8[_0x6680('0x12')]){if(_0x5d8ad8[_0x6680('0x11')]==_0xc51332){GRAY_PERIOD_REASON='Disabled';logger[_0x6680('0x13')](_0x6680('0x16'));}else{GRAY_PERIOD_REASON=_0x6680('0x17');logger[_0x6680('0x13')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x5d8ad8[_0x6680('0x11')],_0xc51332);}logger[_0x6680('0x13')](_0x6680('0x18'),GRAY_PERIOD_REASON[_0x6680('0x19')](),moment()[_0x6680('0xa')](_0x6680('0x1a')));return _0x25d4c0[_0x6680('0x1b')]({'data2':encryptor[_0x6680('0x1c')](moment()['format'](_0x6680('0x1a')))});}else{if(moment()[_0x6680('0x1d')](encryptor[_0x6680('0x1e')](_0x5d8ad8[_0x6680('0x12')]),'days')>DAYS){logger[_0x6680('0x13')](_0x6680('0x1f'),moment()[_0x6680('0xa')](_0x6680('0x1a')));isOldTokenSent=![];return _0x25d4c0['update']({'data1':_0xc51332,'data2':null,'license':null});}}}else{if(_0x5d8ad8[_0x6680('0x11')]!=_0xc51332){logger[_0x6680('0x13')](_0x6680('0x20'),_0x5d8ad8[_0x6680('0x11')],_0xc51332);return _0x25d4c0['update']({'data1':_0xc51332,'data2':null,'license':null});}}}return _0x25d4c0;})[_0x6680('0xe')](function(_0x4590fa){_0x25d4c0=_0x4590fa;})['catch'](function(_0x226722){logger[_0x6680('0x21')](_0x226722['message']);})[_0x6680('0x22')](function(){setTimeout(function(){manageLicense(hardware[_0x6680('0x23')](),_0x25d4c0);},TIME);});}function defaultLicense(){var _0x39baab=hardware[_0x6680('0x23')]();if(_0x39baab){return db[_0x6680('0x24')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x39baab}})[_0x6680('0x25')](function(_0x56c838,_0x120032){logger['info'](_0x6680('0x26'),_0x39baab);manageLicense(_0x39baab,_0x56c838);})['catch'](function(_0x21c3bf){logger[_0x6680('0x21')](_0x21c3bf[_0x6680('0x27')]);});}}exports[_0x6680('0x28')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 5ecc432..643e451 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 _0xc0ec=['changed','disabled','message','User','role','sequelize','COUNT','col','count','admin','user','users','telephones','forEach','catch','pick','telephone','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','Demo\x20license','2027-01-01T00:00:00.000Z','Breaking\x20license','getUuid','License','find','defaults','then','uuid','data1','license','data2','split','decryptString','parse','demo','machineUuid','deadline','add','days','grayReason'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xc0ec,0x18b));var _0xcc0e=function(_0x503f41,_0x30b4e9){_0x503f41=_0x503f41-0x0;var _0x496c79=_0xc0ec[_0x503f41];return _0x496c79;};'use strict';var util=require(_0xcc0e('0x0'));var _=require(_0xcc0e('0x1'));var moment=require(_0xcc0e('0x2'));var BPromise=require(_0xcc0e('0x3'));var hardware=require(_0xcc0e('0x4'));var encryptor=require(_0xcc0e('0x5'));var db=require(_0xcc0e('0x6'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xcc0e('0x7'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xcc0e('0x8'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xcc0e('0x9'),'machineUuid':hardware[_0xcc0e('0xa')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x44788d){return new BPromise(function(_0x505160,_0x4d9caa){return db[_0xcc0e('0xb')][_0xcc0e('0xc')](_[_0xcc0e('0xd')](_0x44788d,{'raw':!![],'where':{'id':0x1}}))[_0xcc0e('0xe')](function(_0x34fd52){return checkLicense(_0x34fd52,null);})['then'](function(_0x3f193e){_0x505160(_0x3f193e);return;})['catch'](function(_0xdca32b){_0x4d9caa(_0xdca32b);});});}function checkLicense(_0x99d21e,_0x5d008c){if(!_0x99d21e){demoLicense[_0xcc0e('0xf')]=_0x99d21e[_0xcc0e('0x10')];return demoLicense;}try{var _0x49940b=_0x5d008c||_0x99d21e[_0xcc0e('0x11')];if(_['isEmpty'](_0x49940b)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x1ab971=_0x99d21e[_0xcc0e('0x10')];var _0x31b728=_0x99d21e[_0xcc0e('0x12')];var _0x2c86ca=_0x1ab971[_0xcc0e('0x13')]('-')[0x4];var _0x2e7996=_0x1ab971[_0xcc0e('0x13')]('-')[0x0];var _0x3bbf29=encryptor[_0xcc0e('0x14')](_0x49940b,util['format']('%s:%s:%s',_0x2c86ca,_0x1ab971,_0x2e7996));var _0x33ec7e=JSON[_0xcc0e('0x15')](_0x3bbf29);_0x33ec7e[_0xcc0e('0x16')]=![];_0x33ec7e[_0xcc0e('0xf')]=_0x1ab971;_0x33ec7e[_0xcc0e('0x17')]=hardware[_0xcc0e('0xa')]();if(_0x31b728){var _0x943334=encryptor[_0xcc0e('0x14')](_0x31b728);_0x33ec7e['gray']=_0x943334;_0x33ec7e[_0xcc0e('0x18')]=moment(_0x943334)[_0xcc0e('0x19')](0x7,_0xcc0e('0x1a'))['format']();_0x33ec7e[_0xcc0e('0x1b')]=_0x33ec7e[_0xcc0e('0xf')]!=_0x33ec7e[_0xcc0e('0x17')]?_0xcc0e('0x1c'):_0xcc0e('0x1d');}return _0x33ec7e;}catch(_0x50f665){breakingLicense[_0xcc0e('0xf')]=_0x99d21e[_0xcc0e('0x10')];breakingLicense[_0xcc0e('0x1e')]=_0x50f665[_0xcc0e('0x1e')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x107aa1,_0x2042f){getLicense()[_0xcc0e('0xe')](function(_0x121406){return db[_0xcc0e('0x1f')]['findAll']({'attributes':[_0xcc0e('0x20'),[db[_0xcc0e('0x21')]['fn'](_0xcc0e('0x22'),db[_0xcc0e('0x21')][_0xcc0e('0x23')](_0xcc0e('0x20'))),_0xcc0e('0x24')]],'group':_0xcc0e('0x20'),'where':{'role':{'$or':[_0xcc0e('0x25'),_0xcc0e('0x26'),'telephone']}},'raw':!![]})[_0xcc0e('0xe')](function(_0x1e5f17){var _0x12d351={'user':_0x121406[_0xcc0e('0x27')]||0x0,'telephone':_0x121406[_0xcc0e('0x28')]||0x0};_0x1e5f17[_0xcc0e('0x29')](function(_0x149f55){var _0x57d69e=_0x149f55['role']===_0xcc0e('0x25')?_0xcc0e('0x26'):_0x149f55[_0xcc0e('0x20')];_0x12d351[_0x57d69e]-=_0x149f55['count'];if(_0x12d351[_0x57d69e]<0x0)_0x12d351[_0x57d69e]=0x0;});_0x107aa1(_0x12d351);return;});})[_0xcc0e('0x2a')](function(_0x5522d5){_0x2042f(_0x5522d5);});});}function checkUserLimits(_0x101ac2){return new BPromise(function(_0x2a7d55,_0xe70763){getLimits()['then'](function(_0x516f08){var _0x2a6b1e=_[_0xcc0e('0x2b')](_['countBy'](_0x101ac2,_0xcc0e('0x20')),[_0xcc0e('0x25'),_0xcc0e('0x26'),'telephone']);var _0x5b3ea1=(_0x2a6b1e[_0xcc0e('0x25')]||0x0)+(_0x2a6b1e['user']||0x0);var _0x1ec29b=_0x2a6b1e[_0xcc0e('0x2c')]||0x0;if(_0x5b3ea1>_0x516f08[_0xcc0e('0x26')])return _0xe70763('License\x20limit\x20reached\x20for\x20users');if(_0x1ec29b>_0x516f08[_0xcc0e('0x2c')])return _0xe70763(_0xcc0e('0x2d'));return _0x2a7d55();})['catch'](function(_0x1509d0){_0xe70763(_0x1509d0);});});}module[_0xcc0e('0x2e')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x9c56=['User','findAll','sequelize','COUNT','col','role','count','admin','telephone','users','telephones','forEach','countBy','user','License\x20limit\x20reached\x20for\x20telephones','exports','util','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','getUuid','Breaking\x20license','find','then','catch','uuid','license','isEmpty','data1','data2','split','decryptString','format','%s:%s:%s','parse','demo','machineUuid','gray','deadline','add','days','changed','disabled','message'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0x9c56,0xfb));var _0x69c5=function(_0x51b42e,_0x8dea09){_0x51b42e=_0x51b42e-0x0;var _0x43ed23=_0x9c56[_0x51b42e];return _0x43ed23;};'use strict';var util=require(_0x69c5('0x0'));var _=require('lodash');var moment=require(_0x69c5('0x1'));var BPromise=require(_0x69c5('0x2'));var hardware=require(_0x69c5('0x3'));var encryptor=require(_0x69c5('0x4'));var db=require(_0x69c5('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x69c5('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware[_0x69c5('0x7')](),'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':_0x69c5('0x8'),'machineUuid':hardware[_0x69c5('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x1d07e6){return new BPromise(function(_0x259367,_0x425233){return db['License'][_0x69c5('0x9')](_['defaults'](_0x1d07e6,{'raw':!![],'where':{'id':0x1}}))[_0x69c5('0xa')](function(_0x2bc821){return checkLicense(_0x2bc821,null);})[_0x69c5('0xa')](function(_0x402793){_0x259367(_0x402793);return;})[_0x69c5('0xb')](function(_0x40c2cf){_0x425233(_0x40c2cf);});});}function checkLicense(_0x357f5a,_0x4ba271){if(!_0x357f5a){demoLicense[_0x69c5('0xc')]=_0x357f5a['data1'];return demoLicense;}try{var _0x38ac0c=_0x4ba271||_0x357f5a[_0x69c5('0xd')];if(_[_0x69c5('0xe')](_0x38ac0c)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x39a7dc=_0x357f5a[_0x69c5('0xf')];var _0x5c67af=_0x357f5a[_0x69c5('0x10')];var _0x3aca27=_0x39a7dc[_0x69c5('0x11')]('-')[0x4];var _0x5d2a9b=_0x39a7dc[_0x69c5('0x11')]('-')[0x0];var _0x27ff73=encryptor[_0x69c5('0x12')](_0x38ac0c,util[_0x69c5('0x13')](_0x69c5('0x14'),_0x3aca27,_0x39a7dc,_0x5d2a9b));var _0x35a1ba=JSON[_0x69c5('0x15')](_0x27ff73);_0x35a1ba[_0x69c5('0x16')]=![];_0x35a1ba['uuid']=_0x39a7dc;_0x35a1ba[_0x69c5('0x17')]=hardware[_0x69c5('0x7')]();if(_0x5c67af){var _0x21212c=encryptor[_0x69c5('0x12')](_0x5c67af);_0x35a1ba[_0x69c5('0x18')]=_0x21212c;_0x35a1ba[_0x69c5('0x19')]=moment(_0x21212c)[_0x69c5('0x1a')](0x7,_0x69c5('0x1b'))[_0x69c5('0x13')]();_0x35a1ba['grayReason']=_0x35a1ba[_0x69c5('0xc')]!=_0x35a1ba[_0x69c5('0x17')]?_0x69c5('0x1c'):_0x69c5('0x1d');}return _0x35a1ba;}catch(_0x499287){breakingLicense[_0x69c5('0xc')]=_0x357f5a[_0x69c5('0xf')];breakingLicense[_0x69c5('0x1e')]=_0x499287['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x500266,_0x52b7c0){getLicense()[_0x69c5('0xa')](function(_0x517a82){return db[_0x69c5('0x1f')][_0x69c5('0x20')]({'attributes':['role',[db[_0x69c5('0x21')]['fn'](_0x69c5('0x22'),db[_0x69c5('0x21')][_0x69c5('0x23')](_0x69c5('0x24'))),_0x69c5('0x25')]],'group':_0x69c5('0x24'),'where':{'role':{'$or':[_0x69c5('0x26'),'user',_0x69c5('0x27')]}},'raw':!![]})[_0x69c5('0xa')](function(_0x1313ca){var _0x3d1c12={'user':_0x517a82[_0x69c5('0x28')]||0x0,'telephone':_0x517a82[_0x69c5('0x29')]||0x0};_0x1313ca[_0x69c5('0x2a')](function(_0x250338){var _0x22c76e=_0x250338[_0x69c5('0x24')]===_0x69c5('0x26')?'user':_0x250338[_0x69c5('0x24')];_0x3d1c12[_0x22c76e]-=_0x250338[_0x69c5('0x25')];if(_0x3d1c12[_0x22c76e]<0x0)_0x3d1c12[_0x22c76e]=0x0;});_0x500266(_0x3d1c12);return;});})['catch'](function(_0x4d4fb1){_0x52b7c0(_0x4d4fb1);});});}function checkUserLimits(_0x2e6692){return new BPromise(function(_0x6220f4,_0xdb09b3){getLimits()[_0x69c5('0xa')](function(_0x101770){var _0xa0e1ff=_['pick'](_[_0x69c5('0x2b')](_0x2e6692,'role'),[_0x69c5('0x26'),_0x69c5('0x2c'),_0x69c5('0x27')]);var _0x31544f=(_0xa0e1ff[_0x69c5('0x26')]||0x0)+(_0xa0e1ff[_0x69c5('0x2c')]||0x0);var _0x31c505=_0xa0e1ff[_0x69c5('0x27')]||0x0;if(_0x31544f>_0x101770[_0x69c5('0x2c')])return _0xdb09b3('License\x20limit\x20reached\x20for\x20users');if(_0x31c505>_0x101770[_0x69c5('0x27')])return _0xdb09b3(_0x69c5('0x2d'));return _0x6220f4();})[_0x69c5('0xb')](function(_0x46b5eb){_0xdb09b3(_0x46b5eb);});});}module[_0x69c5('0x2e')]={'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 a948445..96e5413 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 _0xaebd=['secret','exports','myappanuglar-secret','app-id'];(function(_0x14a2cb,_0x1509a9){var _0x485660=function(_0x1cc926){while(--_0x1cc926){_0x14a2cb['push'](_0x14a2cb['shift']());}};_0x485660(++_0x1509a9);}(_0xaebd,0x1e9));var _0xdaeb=function(_0x4b36fd,_0x5347d9){_0x4b36fd=_0x4b36fd-0x0;var _0x32c362=_0xaebd[_0x4b36fd];return _0x32c362;};'use strict';module[_0xdaeb('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0xdaeb('0x1'),'GOOGLE_ID':_0xdaeb('0x2'),'GOOGLE_SECRET':_0xdaeb('0x3'),'DEBUG':''}; \ No newline at end of file +var _0xd7d1=['exports','http://localhost:9000','myappanuglar-secret','app-id','secret'];(function(_0x4a917f,_0x3fef08){var _0x2e488e=function(_0xffeeb7){while(--_0xffeeb7){_0x4a917f['push'](_0x4a917f['shift']());}};_0x2e488e(++_0x3fef08);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x967ab5,_0xd9fa74){_0x967ab5=_0x967ab5-0x0;var _0x185a44=_0xd7d1[_0x967ab5];return _0x185a44;};'use strict';module[_0x1d7d('0x0')]={'DOMAIN':_0x1d7d('0x1'),'SESSION_SECRET':_0x1d7d('0x2'),'GOOGLE_ID':_0x1d7d('0x3'),'GOOGLE_SECRET':_0x1d7d('0x4'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 65b5a3b..5751169 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -'use strict';var fileLogger=require('../utils/loggers')['fileLogger'];module['exports']=fileLogger; \ No newline at end of file +var _0x50df=['fileLogger','exports'];(function(_0x497cd0,_0x30b14f){var _0x5c74d5=function(_0x1b13aa){while(--_0x1b13aa){_0x497cd0['push'](_0x497cd0['shift']());}};_0x5c74d5(++_0x30b14f);}(_0x50df,0xec));var _0xf50d=function(_0x2c58b2,_0x33f59d){_0x2c58b2=_0x2c58b2-0x0;var _0x43b269=_0x50df[_0x2c58b2];return _0x43b269;};'use strict';var fileLogger=require('../utils/loggers')[_0xf50d('0x0')];module[_0xf50d('0x1')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index c6a7d41..2f38183 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 _0xbe83=['../../services/xdr/index.js','../../config/environment','resolve','join','legacy-libs','../../services/express/index.js','ami','../../services/ami/index.js','agi','../../services/agi/index.js','email','routing','../../services/routing/index.js','xdr'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0xbe83,0xef));var _0x3be8=function(_0x1ca250,_0x2c5a76){_0x1ca250=_0x1ca250-0x0;var _0x25ea4c=_0xbe83[_0x1ca250];return _0x25ea4c;};'use strict';var path=require('path');var cfg=require(_0x3be8('0x0'));var env={'NODE_PATH':path[_0x3be8('0x1')](path[_0x3be8('0x2')](cfg['root'],_0x3be8('0x3')))};var pm2config={'apps':[{'name':'express','script':path['join'](__dirname,_0x3be8('0x4')),'env':env},{'name':_0x3be8('0x5'),'script':path[_0x3be8('0x2')](__dirname,_0x3be8('0x6')),'env':env},{'name':_0x3be8('0x7'),'script':path[_0x3be8('0x2')](__dirname,_0x3be8('0x8')),'env':env},{'name':_0x3be8('0x9'),'script':path[_0x3be8('0x2')](__dirname,'../../services/email/index.js'),'env':env},{'name':_0x3be8('0xa'),'script':path[_0x3be8('0x2')](__dirname,_0x3be8('0xb')),'env':env},{'name':_0x3be8('0xc'),'script':path['join'](__dirname,_0x3be8('0xd')),'env':env}]};module['exports']=pm2config; \ No newline at end of file +var _0x40cd=['../../services/email/index.js','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','path','../../config/environment','resolve','join','root','legacy-libs','../../services/express/index.js','../../services/ami/index.js','agi','../../services/agi/index.js'];(function(_0x16c16a,_0x89b4a5){var _0x4feaaa=function(_0x3f1b21){while(--_0x3f1b21){_0x16c16a['push'](_0x16c16a['shift']());}};_0x4feaaa(++_0x89b4a5);}(_0x40cd,0xaa));var _0xd40c=function(_0x24cb10,_0x58bc58){_0x24cb10=_0x24cb10-0x0;var _0x5deab7=_0x40cd[_0x24cb10];return _0x5deab7;};'use strict';var path=require(_0xd40c('0x0'));var cfg=require(_0xd40c('0x1'));var env={'NODE_PATH':path[_0xd40c('0x2')](path[_0xd40c('0x3')](cfg[_0xd40c('0x4')],_0xd40c('0x5')))};var pm2config={'apps':[{'name':'express','script':path['join'](__dirname,_0xd40c('0x6')),'env':env},{'name':'ami','script':path[_0xd40c('0x3')](__dirname,_0xd40c('0x7')),'env':env},{'name':_0xd40c('0x8'),'script':path[_0xd40c('0x3')](__dirname,_0xd40c('0x9')),'env':env},{'name':'email','script':path[_0xd40c('0x3')](__dirname,_0xd40c('0xa')),'env':env},{'name':_0xd40c('0xb'),'script':path['join'](__dirname,_0xd40c('0xc')),'env':env},{'name':_0xd40c('0xd'),'script':path[_0xd40c('0x3')](__dirname,_0xd40c('0xe')),'env':env}]};module['exports']=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 2a3e34f..0096235 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 _0xd311=['then','disconnect','stop','restart','list','delete','saved','pm2','bluebird','./config','connect','connected'];(function(_0x14b1e9,_0xdef18c){var _0x132088=function(_0x17e3ba){while(--_0x17e3ba){_0x14b1e9['push'](_0x14b1e9['shift']());}};_0x132088(++_0xdef18c);}(_0xd311,0x1c3));var _0x1d31=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd311[_0x321bb2];return _0x9c12ed;};'use strict';var pm2=require(_0x1d31('0x0'));var BPromise=require(_0x1d31('0x1'));var config=require(_0x1d31('0x2'));function connect(){return new BPromise(function(_0x5db1da,_0x2cfac9){return pm2[_0x1d31('0x3')](function(_0x3b12c8){if(_0x3b12c8){return _0x2cfac9(_0x3b12c8);}return _0x5db1da(_0x1d31('0x4'));});});};exports['start']=function(_0x4f4a0d){return connect()[_0x1d31('0x5')](function(){return new BPromise(function(_0xe18062,_0x5e333b){return pm2['start'](_0x4f4a0d,function(_0x3add34,_0x30d96b){if(_0x3add34){return _0x5e333b(_0x3add34);}pm2[_0x1d31('0x6')]();return _0xe18062(_0x30d96b);});});});};exports[_0x1d31('0x7')]=function(_0x425e74){return connect()[_0x1d31('0x5')](function(){return new BPromise(function(_0x52875b,_0x1f2acd){return pm2[_0x1d31('0x7')](_0x425e74,function(_0x2b3999,_0x509f9e){if(_0x2b3999){return _0x1f2acd(_0x2b3999);}pm2[_0x1d31('0x6')]();return _0x52875b(_0x509f9e);});});});};exports[_0x1d31('0x8')]=function(_0x43c893){return connect()[_0x1d31('0x5')](function(){return new BPromise(function(_0xd8e64d,_0x4def55){return pm2[_0x1d31('0x8')](_0x43c893,function(_0x3b6ee3,_0x1e4821){if(_0x3b6ee3){return _0x4def55(_0x3b6ee3);}pm2['disconnect']();return _0xd8e64d(_0x1e4821);});});});};exports[_0x1d31('0x9')]=function(){return connect()[_0x1d31('0x5')](function(){return new BPromise(function(_0x1d6089,_0x4f6cfb){return pm2['list'](function(_0x1e7faf,_0x45c076){if(_0x1e7faf){return _0x4f6cfb(_0x1e7faf);}pm2[_0x1d31('0x6')]();return _0x1d6089(_0x45c076);});});});};exports['describe']=function(_0x31f2c9){return connect()[_0x1d31('0x5')](function(){return new BPromise(function(_0x3df46d,_0x5df49e){return pm2['describe'](_0x31f2c9,function(_0x3318b7,_0x287461){if(_0x3318b7){return _0x5df49e(_0x3318b7);}pm2[_0x1d31('0x6')]();return _0x3df46d(_0x287461);});});});};exports[_0x1d31('0xa')]=function(_0x5dee46){return connect()[_0x1d31('0x5')](function(){return new BPromise(function(_0x1c0690,_0x46d804){return pm2['delete'](_0x5dee46,function(_0x1bcec3,_0x36477){if(_0x1bcec3){return _0x46d804(_0x1bcec3);}pm2[_0x1d31('0x6')]();return _0x1c0690(_0x36477);});});});};exports['dump']=function(){return connect()[_0x1d31('0x5')](function(){return new BPromise(function(_0x44b088,_0x4d6cc9){return pm2['dump'](function(_0x1e0a63){if(_0x1e0a63){return _0x4d6cc9(_0x1e0a63);}return _0x44b088(_0x1d31('0xb'));});});});}; \ No newline at end of file +var _0x789c=['dump','saved','pm2','bluebird','./config','connect','connected','start','then','disconnect','stop','restart','list','describe','delete'];(function(_0x4698c8,_0x348019){var _0x20b25b=function(_0x7a9d61){while(--_0x7a9d61){_0x4698c8['push'](_0x4698c8['shift']());}};_0x20b25b(++_0x348019);}(_0x789c,0xc5));var _0xc789=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x789c[_0x3dd15e];return _0x231fd0;};'use strict';var pm2=require(_0xc789('0x0'));var BPromise=require(_0xc789('0x1'));var config=require(_0xc789('0x2'));function connect(){return new BPromise(function(_0x3d3c3c,_0xc6ae8b){return pm2[_0xc789('0x3')](function(_0x1b9d9c){if(_0x1b9d9c){return _0xc6ae8b(_0x1b9d9c);}return _0x3d3c3c(_0xc789('0x4'));});});};exports[_0xc789('0x5')]=function(_0x47c864){return connect()[_0xc789('0x6')](function(){return new BPromise(function(_0x44a021,_0x4ea3b8){return pm2[_0xc789('0x5')](_0x47c864,function(_0x402149,_0x2e7de4){if(_0x402149){return _0x4ea3b8(_0x402149);}pm2[_0xc789('0x7')]();return _0x44a021(_0x2e7de4);});});});};exports[_0xc789('0x8')]=function(_0x215f69){return connect()[_0xc789('0x6')](function(){return new BPromise(function(_0x2f0e21,_0x3f5aaa){return pm2[_0xc789('0x8')](_0x215f69,function(_0x1add2e,_0x4a9a7b){if(_0x1add2e){return _0x3f5aaa(_0x1add2e);}pm2[_0xc789('0x7')]();return _0x2f0e21(_0x4a9a7b);});});});};exports[_0xc789('0x9')]=function(_0x2f15e5){return connect()[_0xc789('0x6')](function(){return new BPromise(function(_0x31fc1c,_0x15be14){return pm2[_0xc789('0x9')](_0x2f15e5,function(_0x1202cc,_0x9de09f){if(_0x1202cc){return _0x15be14(_0x1202cc);}pm2[_0xc789('0x7')]();return _0x31fc1c(_0x9de09f);});});});};exports[_0xc789('0xa')]=function(){return connect()[_0xc789('0x6')](function(){return new BPromise(function(_0x35d1ae,_0x47b01f){return pm2[_0xc789('0xa')](function(_0x7b253,_0x4674b1){if(_0x7b253){return _0x47b01f(_0x7b253);}pm2[_0xc789('0x7')]();return _0x35d1ae(_0x4674b1);});});});};exports['describe']=function(_0x418f29){return connect()[_0xc789('0x6')](function(){return new BPromise(function(_0x180f41,_0x4acbf8){return pm2[_0xc789('0xb')](_0x418f29,function(_0x55db8e,_0x188ec2){if(_0x55db8e){return _0x4acbf8(_0x55db8e);}pm2[_0xc789('0x7')]();return _0x180f41(_0x188ec2);});});});};exports['delete']=function(_0x4e767c){return connect()[_0xc789('0x6')](function(){return new BPromise(function(_0x4c7042,_0x5713ed){return pm2[_0xc789('0xc')](_0x4e767c,function(_0xd367c6,_0x58ddac){if(_0xd367c6){return _0x5713ed(_0xd367c6);}pm2[_0xc789('0x7')]();return _0x4c7042(_0x58ddac);});});});};exports[_0xc789('0xd')]=function(){return connect()[_0xc789('0x6')](function(){return new BPromise(function(_0x514b08,_0x14ae91){return pm2['dump'](function(_0x3d1ae7){if(_0x3d1ae7){return _0x14ae91(_0x3d1ae7);}return _0x514b08(_0xc789('0xe'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index c1206ef..d4ec3cf 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 _0x43a4=['findAll','lastMsgAt','subtract','minutes','then','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','ChatInteraction','update','system','timeout','format','length','emit','catch','error','inspect','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','Setting','find','chatTimeout'];(function(_0x18ec8e,_0xdae297){var _0x532091=function(_0x5a0e62){while(--_0x5a0e62){_0x18ec8e['push'](_0x18ec8e['shift']());}};_0x532091(++_0xdae297);}(_0x43a4,0xc3));var _0x443a=function(_0x20fa11,_0x48b0ca){_0x20fa11=_0x20fa11-0x0;var _0x2759c1=_0x43a4[_0x20fa11];return _0x2759c1;};'use strict';var _=require(_0x443a('0x0'));var moment=require(_0x443a('0x1'));var Redis=require(_0x443a('0x2'));var util=require(_0x443a('0x3'));var config=require(_0x443a('0x4'));var db=require(_0x443a('0x5'))['db'];var logger=require(_0x443a('0x6'))(_0x443a('0x7'));config[_0x443a('0x8')]=_[_0x443a('0x9')](config[_0x443a('0x8')],{'host':_0x443a('0xa'),'port':0x18eb});var io=require(_0x443a('0xb'))(new Redis(config['redis']));function closeInteractions(){var _0xecf555=0x0;var _0x3947bf=[];return db[_0x443a('0xc')][_0x443a('0xd')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})['then'](function(_0x884669){_0xecf555=_0x884669[_0x443a('0xe')];if(_0xecf555){return db['ChatInteraction'][_0x443a('0xf')]({'raw':!![],'attributes':['id',_0x443a('0x10')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x443a('0x11')](_0x884669[_0x443a('0xe')],_0x443a('0x12'))}}});}else{return[];}})[_0x443a('0x13')](function(_0x11dcf1){if(_0x11dcf1&&_0x11dcf1['length']){_0x3947bf=_[_0x443a('0x14')](_0x11dcf1||[],'id');logger[_0x443a('0x15')](_0x443a('0x16'),_0x3947bf[_0x443a('0x17')]());return db[_0x443a('0x18')][_0x443a('0x19')]({'closeReason':_0x443a('0x1a'),'disposition':_0x443a('0x1b'),'closed':!![],'closedAt':moment()[_0x443a('0x1c')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x3947bf}});}})[_0x443a('0x13')](function(){if(_0x3947bf&&_0x3947bf[_0x443a('0x1d')]){logger[_0x443a('0x15')]('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x3947bf['join']());for(var _0xda9128=0x0;_0xda9128<_0x3947bf[_0x443a('0x1d')];_0xda9128++){io[_0x443a('0x1e')]('chatInteraction:update',{'id':_0x3947bf[_0xda9128],'closed':!![]});}}})[_0x443a('0x1f')](function(_0x66b4e7){logger[_0x443a('0x20')]('[CHAT]\x20Error\x20closing\x20interactions',_0x66b4e7?util[_0x443a('0x21')](_0x66b4e7,{'showHidden':![],'depth':null}):'');});}exports[_0x443a('0x22')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x02c3=['then','ChatInteraction','lastMsgAt','minutes','length','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','timeout','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','ioredis','util','../../config/environment','../../mysqldb','../logger','redis','localhost','socket.io-emitter','Setting','find','chatTimeout'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x02c3,0x15c));var _0x302c=function(_0x389a89,_0x1f4311){_0x389a89=_0x389a89-0x0;var _0x4d83f4=_0x02c3[_0x389a89];return _0x4d83f4;};'use strict';var _=require(_0x302c('0x0'));var moment=require('moment');var Redis=require(_0x302c('0x1'));var util=require(_0x302c('0x2'));var config=require(_0x302c('0x3'));var db=require(_0x302c('0x4'))['db'];var logger=require(_0x302c('0x5'))('schedule');config[_0x302c('0x6')]=_['defaults'](config[_0x302c('0x6')],{'host':_0x302c('0x7'),'port':0x18eb});var io=require(_0x302c('0x8'))(new Redis(config[_0x302c('0x6')]));function closeInteractions(){var _0x1889d2=0x0;var _0x5bb474=[];return db[_0x302c('0x9')][_0x302c('0xa')]({'raw':!![],'attributes':['id',_0x302c('0xb')],'where':{'id':0x1}})[_0x302c('0xc')](function(_0x49013c){_0x1889d2=_0x49013c[_0x302c('0xb')];if(_0x1889d2){return db[_0x302c('0xd')]['findAll']({'raw':!![],'attributes':['id',_0x302c('0xe')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x49013c[_0x302c('0xb')],_0x302c('0xf'))}}});}else{return[];}})['then'](function(_0x242c35){if(_0x242c35&&_0x242c35[_0x302c('0x10')]){_0x5bb474=_['map'](_0x242c35||[],'id');logger[_0x302c('0x11')](_0x302c('0x12'),_0x5bb474[_0x302c('0x13')]());return db[_0x302c('0xd')][_0x302c('0x14')]({'closeReason':_0x302c('0x15'),'disposition':_0x302c('0x16'),'closed':!![],'closedAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x5bb474}});}})[_0x302c('0xc')](function(){if(_0x5bb474&&_0x5bb474[_0x302c('0x10')]){logger[_0x302c('0x11')](_0x302c('0x17'),_0x5bb474[_0x302c('0x13')]());for(var _0x2bb2a0=0x0;_0x2bb2a0<_0x5bb474[_0x302c('0x10')];_0x2bb2a0++){io[_0x302c('0x18')]('chatInteraction:update',{'id':_0x5bb474[_0x2bb2a0],'closed':!![]});}}})[_0x302c('0x19')](function(_0x479c00){logger[_0x302c('0x1a')](_0x302c('0x1b'),_0x479c00?util[_0x302c('0x1c')](_0x479c00,{'showHidden':![],'depth':null}):'');});}exports[_0x302c('0x1d')]=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 d18f669..eaf4d72 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 _0x1830=['startAllRefreshIntervals','../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0x1830,0x191));var _0x0183=function(_0x4fb452,_0x32f7b3){_0x4fb452=_0x4fb452-0x0;var _0x35b1bd=_0x1830[_0x4fb452];return _0x35b1bd;};'use strict';function start(){var _0x2a33c6=require(_0x0183('0x0'));return _0x2a33c6[_0x0183('0x1')]();}module['exports']={'intervals':{},'start':start}; \ No newline at end of file +var _0x08e5=['exports'];(function(_0x8ca632,_0x5d485b){var _0x112a34=function(_0x298cf5){while(--_0x298cf5){_0x8ca632['push'](_0x8ca632['shift']());}};_0x112a34(++_0x5d485b);}(_0x08e5,0xff));var _0x508e=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0x08e5[_0x1e4360];return _0x31e6b4;};'use strict';function start(){var _0x1e0a9f=require('../../api/cloudProvider/cloudProvider.oauth.js');return _0x1e0a9f['startAllRefreshIntervals']();}module[_0x508e('0x0')]={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 9eaf5e8..a448e44 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 _0x58f6=['name','subtractUnit','join','../../files/reports','%s.%s','savename','extname','zip','status','Sent','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','existsSync','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','empty\x20file,\x20email\x20not\x20sent','request','SendMail','error','error\x20mail','email\x20sent','data','isNil','subtractNumber','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','then','catch','CustomReportId','runReport','no\x20report\x20id','Schedule','findAll','MailServerOut','CloudProvider','keys','map','toString','difference','intersection','exists','stop','deleteJob','delete\x20cron','toRun','my\x20id','resolve','run\x20job','cron','active','isBetween','startAt','endAt','add','start','add\x20cron','length','update\x20cron','stop\x20cron','run','util','path','lodash','moment','jayson/promise','bluebird','../logger','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','info','email','MailAccount','getSmtpOptions','\x22%s\x22\x20<%s>','Smtp','bcc','format','Report\x20%s\x20last\x20%s\x20%s'];(function(_0x442cff,_0x2e24fd){var _0x1ccf05=function(_0x45deae){while(--_0x45deae){_0x442cff['push'](_0x442cff['shift']());}};_0x1ccf05(++_0x2e24fd);}(_0x58f6,0x148));var _0x658f=function(_0x79c1f3,_0x51835f){_0x79c1f3=_0x79c1f3-0x0;var _0x46592d=_0x58f6[_0x79c1f3];return _0x46592d;};'use strict';var fs=require('fs');var util=require(_0x658f('0x0'));var path=require(_0x658f('0x1'));var _=require(_0x658f('0x2'));var moment=require(_0x658f('0x3'));var CronJobManager=require('cron-job-manager');var jayson=require(_0x658f('0x4'));var BPromise=require(_0x658f('0x5'));var logger=require(_0x658f('0x6'))('schedule');var db=require(_0x658f('0x7'))['db'];var analyticCustomReportController=require(_0x658f('0x8'));var analyticDefaultReportController=require(_0x658f('0x9'));var client=jayson[_0x658f('0xa')]['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x5729a9,_0x63f920){return function(){logger[_0x658f('0xb')]('Try\x20to\x20send\x20a\x20mail\x20to',_0x5729a9[_0x658f('0xc')]);var _0x302171=!![];var _0xd8ac15=_0x5729a9[_0x658f('0xd')][_0x658f('0xe')]();var _0x126b31={'account':_0xd8ac15,'message':{'from':util['format'](_0x658f('0xf'),_0x5729a9[_0x658f('0xd')]['name'],_0x5729a9[_0x658f('0xd')][_0x658f('0xc')]||_0x5729a9[_0x658f('0xd')][_0x658f('0x10')]['user']),'to':_0x5729a9[_0x658f('0xc')],'cc':_0x5729a9['cc'],'bcc':_0x5729a9[_0x658f('0x11')],'subject':util[_0x658f('0x12')](_0x658f('0x13'),_0x63f920[_0x658f('0x14')],_0x5729a9['subtractNumber'],_0x5729a9[_0x658f('0x15')])}};var _0x2fa55d=path[_0x658f('0x16')](__dirname,_0x658f('0x17'));var _0x5d7d10=_0x63f920['savename'];var _0x36aa07=util[_0x658f('0x12')](_0x658f('0x18'),path['basename'](_0x63f920[_0x658f('0x19')],path[_0x658f('0x1a')](_0x63f920[_0x658f('0x19')])),_0x658f('0x1b'));var _0x1d413f=path['join'](_0x2fa55d,_0x5d7d10);var _0x3392c4=path['join'](_0x2fa55d,_0x36aa07);if(fs['existsSync'](_0x1d413f)){_0x63f920[_0x658f('0x1c')]=_0x658f('0x1d');_0x126b31[_0x658f('0x1e')][_0x658f('0x1f')]=[{'filename':_0x5d7d10,'path':_0x1d413f}];_0x126b31['message'][_0x658f('0x20')]=util[_0x658f('0x12')](_0x658f('0x21'),JSON[_0x658f('0x22')](_0x63f920,null,0x2));}else if(fs[_0x658f('0x23')](_0x3392c4)){_0x63f920['status']=_0x658f('0x1d');_0x126b31[_0x658f('0x1e')][_0x658f('0x1f')]=[{'filename':_0x36aa07,'path':_0x3392c4}];}else{_0x126b31[_0x658f('0x1e')][_0x658f('0x20')]=_0x658f('0x24');if(!_0x5729a9['sendIfEmpty']){_0x302171=![];logger['info'](_0x658f('0x25'));}}if(_0x302171){return client[_0x658f('0x26')](_0x658f('0x27'),_0x126b31)['then'](function(_0x153bd0){if(_0x153bd0[_0x658f('0x28')]){return logger['error'](_0x658f('0x29'),JSON['stringify'](_0x153bd0));}return logger[_0x658f('0xb')](_0x658f('0x2a'));})['catch'](function(_0x2053a6){return logger[_0x658f('0x28')](_0x658f('0x29'),JSON['stringify'](_0x2053a6));});}};}function handleError(){return function(_0x1c106c){return logger[_0x658f('0x28')](JSON[_0x658f('0x22')](_0x1c106c));};}function handleResult(_0x581713){return function(_0x21cab2){logger[_0x658f('0xb')](_0x658f('0x2b'),JSON[_0x658f('0x22')](_0x21cab2));if(_0x581713[_0x658f('0xd')]&&_0x581713[_0x658f('0xd')][_0x658f('0x10')]&&!_[_0x658f('0x2c')](_0x581713[_0x658f('0xc')])){setTimeout(handleSendEmail(_0x581713,_0x21cab2),0x3c*0x3e8);}};}function handleJob(_0x3aca0d){return function(){try{if(_[_0x658f('0x2c')](_0x3aca0d[_0x658f('0x2d')])){return logger['info'](_0x658f('0x2e'));}if(_['isNil'](_0x3aca0d[_0x658f('0x15')])){return logger[_0x658f('0xb')](_0x658f('0x2f'));}var _0x45d6ac={'startDate':moment()[_0x658f('0x30')](_0x3aca0d['subtractNumber'],_0x3aca0d['subtractUnit'])[_0x658f('0x12')](_0x658f('0x31')),'endDate':moment()['format'](_0x658f('0x31')),'type':_0x658f('0x32'),'output':_0x3aca0d[_0x658f('0x33')],'name':_0x3aca0d[_0x658f('0x14')]};if(!_['isNil'](_0x3aca0d['DefaultReportId'])){logger['info']('exec\x20defaul\x20report\x20id:%s',_0x3aca0d[_0x658f('0x34')]);return analyticDefaultReportController['runReport']({'id':_0x3aca0d[_0x658f('0x34')]},_0x45d6ac)[_0x658f('0x35')](handleResult(_0x3aca0d))[_0x658f('0x36')](handleError());}if(!_['isNil'](_0x3aca0d[_0x658f('0x37')])){logger[_0x658f('0xb')]('exec\x20custom\x20report\x20id:%s',_0x3aca0d[_0x658f('0x37')]);return analyticCustomReportController[_0x658f('0x38')]({'id':_0x3aca0d[_0x658f('0x37')]},_0x45d6ac)[_0x658f('0x35')](handleResult(_0x3aca0d))[_0x658f('0x36')](handleError());}}catch(_0x147f4c){logger[_0x658f('0x28')](JSON['stringify'](_0x147f4c));}return logger['info'](_0x658f('0x39'));};}function getJobs(_0x2c23db){var _0x50a497={};if(_0x2c23db){_0x50a497['id']=_0x2c23db;}return db[_0x658f('0x3a')][_0x658f('0x3b')]({'where':_0x50a497,'include':[{'model':db[_0x658f('0xd')],'attributes':['id','name',_0x658f('0xc')],'include':[{'model':db[_0x658f('0x3c')],'as':_0x658f('0x10'),'include':[{'model':db[_0x658f('0x3d')],'as':'CloudProvider'}]}]}]})[_0x658f('0x35')](function(_0x4ea2cb){var _0x26256f=_[_0x658f('0x3e')](manager['jobs']);var _0x178355=_[_0x658f('0x3f')](_0x4ea2cb,function(_0x5f00ab){return _0x5f00ab['id'][_0x658f('0x40')]();});var _0x28d714=_['keyBy'](_0x4ea2cb,function(_0x548986){return _0x548986['id'][_0x658f('0x40')]();});var _0x408c61=_0x2c23db?_0x178355:_[_0x658f('0x41')](_0x178355,_0x26256f);var _0x15180d=_[_0x658f('0x42')](_0x178355,_0x26256f);var _0x202317=_[_0x658f('0x41')](_0x26256f,_0x178355);var _0x447ac1;var _0x29f3c5;for(_0x447ac1=0x0;_0x447ac1<_0x202317['length']&&!_0x2c23db;_0x447ac1+=0x1){_0x29f3c5=_0x202317[_0x447ac1][_0x658f('0x40')]();if(manager[_0x658f('0x43')](_0x29f3c5)){manager[_0x658f('0x44')](_0x29f3c5);manager[_0x658f('0x45')](_0x29f3c5);logger[_0x658f('0xb')](_0x658f('0x46'),_0x29f3c5);}}logger[_0x658f('0xb')](_0x658f('0x47'),JSON[_0x658f('0x22')](_0x408c61));for(_0x447ac1=0x0;_0x447ac1<_0x408c61['length'];_0x447ac1+=0x1){_0x29f3c5=_0x408c61[_0x447ac1][_0x658f('0x40')]();logger[_0x658f('0xb')]('index',_0x29f3c5);if(_0x2c23db){logger['info'](_0x658f('0x48'),_0x2c23db);logger[_0x658f('0xb')](JSON['stringify'](_0x28d714[_0x29f3c5]));BPromise[_0x658f('0x49')]()[_0x658f('0x35')](handleJob(_0x28d714[_0x29f3c5]));logger['info'](_0x658f('0x4a'),_0x28d714[_0x29f3c5]['name'],_0x28d714[_0x29f3c5][_0x658f('0x4b')]);}else if(_0x28d714[_0x29f3c5][_0x658f('0x4b')]&&_0x28d714[_0x29f3c5][_0x658f('0x4c')]&&moment()[_0x658f('0x4d')](_0x28d714[_0x29f3c5][_0x658f('0x4e')],_0x28d714[_0x29f3c5][_0x658f('0x4f')])){manager[_0x658f('0x50')](_0x29f3c5,_0x28d714[_0x29f3c5][_0x658f('0x4b')],handleJob(_0x28d714[_0x29f3c5]));manager[_0x658f('0x51')](_0x29f3c5);logger['info'](_0x658f('0x52'),_0x28d714[_0x29f3c5][_0x658f('0x14')],_0x28d714[_0x29f3c5][_0x658f('0x4b')]);}else if(manager[_0x658f('0x43')](_0x29f3c5)){manager[_0x658f('0x44')](_0x29f3c5);manager[_0x658f('0x45')](_0x29f3c5);logger[_0x658f('0xb')]('stop\x20cron',_0x28d714[_0x29f3c5]['name'],_0x28d714[_0x29f3c5][_0x658f('0x4b')]);}}for(_0x447ac1=0x0,_0x29f3c5;_0x447ac1<_0x15180d[_0x658f('0x53')]&&!_0x2c23db;_0x447ac1+=0x1){_0x29f3c5=_0x15180d[_0x447ac1]['toString']();if(manager[_0x658f('0x43')](_0x29f3c5)){if(_0x28d714[_0x29f3c5][_0x658f('0x4b')]&&_0x28d714[_0x29f3c5][_0x658f('0x4c')]&&moment()['isBetween'](_0x28d714[_0x29f3c5]['startAt'],_0x28d714[_0x29f3c5][_0x658f('0x4f')])){manager['update'](_0x29f3c5,_0x28d714[_0x29f3c5][_0x658f('0x4b')],handleJob(_0x28d714[_0x29f3c5]));logger[_0x658f('0xb')](_0x658f('0x54'),_0x28d714[_0x29f3c5][_0x658f('0x14')],_0x28d714[_0x29f3c5]['cron']);}else{manager['stop'](_0x29f3c5);manager[_0x658f('0x45')](_0x29f3c5);logger['info'](_0x658f('0x55'),_0x28d714[_0x29f3c5][_0x658f('0x14')],_0x28d714[_0x29f3c5]['cron']);}}}})['catch'](function(_0x5bb125){logger[_0x658f('0x28')](JSON[_0x658f('0x22')](_0x5bb125));});}exports[_0x658f('0x56')]=function(_0x287a45){return getJobs(_0x287a45);};exports[_0x658f('0x51')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x9320=['keyBy','toString','difference','length','stop','deleteJob','toRun','index','resolve','cron','startAt','endAt','add','exists','stop\x20cron','isBetween','update\x20cron','run','start','util','path','lodash','moment','cron-job-manager','jayson/promise','../logger','schedule','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','getSmtpOptions','format','\x22%s\x22\x20<%s>','MailAccount','Smtp','user','bcc','name','subtractNumber','join','../../files/reports','savename','basename','zip','status','Sent','message','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','existsSync','attachments','empty\x20file,\x20email\x20not\x20sent','error','error\x20mail','email\x20sent','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','then','catch','CustomReportId','no\x20report\x20id','Schedule','CloudProvider','jobs','map'];(function(_0xb52ec4,_0x594a54){var _0xea5904=function(_0x408f97){while(--_0x408f97){_0xb52ec4['push'](_0xb52ec4['shift']());}};_0xea5904(++_0x594a54);}(_0x9320,0xfd));var _0x0932=function(_0x3c686b,_0x4c01b7){_0x3c686b=_0x3c686b-0x0;var _0x551f82=_0x9320[_0x3c686b];return _0x551f82;};'use strict';var fs=require('fs');var util=require(_0x0932('0x0'));var path=require(_0x0932('0x1'));var _=require(_0x0932('0x2'));var moment=require(_0x0932('0x3'));var CronJobManager=require(_0x0932('0x4'));var jayson=require(_0x0932('0x5'));var BPromise=require('bluebird');var logger=require(_0x0932('0x6'))(_0x0932('0x7'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0x0932('0x8'));var analyticDefaultReportController=require(_0x0932('0x9'));var client=jayson[_0x0932('0xa')][_0x0932('0xb')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0xe52d8d,_0x2298a1){return function(){logger[_0x0932('0xc')](_0x0932('0xd'),_0xe52d8d[_0x0932('0xe')]);var _0x415d36=!![];var _0x282510=_0xe52d8d['MailAccount'][_0x0932('0xf')]();var _0x41249c={'account':_0x282510,'message':{'from':util[_0x0932('0x10')](_0x0932('0x11'),_0xe52d8d['MailAccount']['name'],_0xe52d8d['MailAccount'][_0x0932('0xe')]||_0xe52d8d[_0x0932('0x12')][_0x0932('0x13')][_0x0932('0x14')]),'to':_0xe52d8d[_0x0932('0xe')],'cc':_0xe52d8d['cc'],'bcc':_0xe52d8d[_0x0932('0x15')],'subject':util[_0x0932('0x10')]('Report\x20%s\x20last\x20%s\x20%s',_0x2298a1[_0x0932('0x16')],_0xe52d8d[_0x0932('0x17')],_0xe52d8d['subtractUnit'])}};var _0x51d540=path[_0x0932('0x18')](__dirname,_0x0932('0x19'));var _0x24bf01=_0x2298a1[_0x0932('0x1a')];var _0x50ceb5=util['format']('%s.%s',path[_0x0932('0x1b')](_0x2298a1[_0x0932('0x1a')],path['extname'](_0x2298a1['savename'])),_0x0932('0x1c'));var _0x1f72dd=path[_0x0932('0x18')](_0x51d540,_0x24bf01);var _0xf61fc9=path[_0x0932('0x18')](_0x51d540,_0x50ceb5);if(fs['existsSync'](_0x1f72dd)){_0x2298a1[_0x0932('0x1d')]=_0x0932('0x1e');_0x41249c[_0x0932('0x1f')]['attachments']=[{'filename':_0x24bf01,'path':_0x1f72dd}];_0x41249c[_0x0932('0x1f')][_0x0932('0x20')]=util['format'](_0x0932('0x21'),JSON[_0x0932('0x22')](_0x2298a1,null,0x2));}else if(fs[_0x0932('0x23')](_0xf61fc9)){_0x2298a1[_0x0932('0x1d')]=_0x0932('0x1e');_0x41249c[_0x0932('0x1f')][_0x0932('0x24')]=[{'filename':_0x50ceb5,'path':_0xf61fc9}];}else{_0x41249c['message'][_0x0932('0x20')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0xe52d8d['sendIfEmpty']){_0x415d36=![];logger[_0x0932('0xc')](_0x0932('0x25'));}}if(_0x415d36){return client['request']('SendMail',_0x41249c)['then'](function(_0x312000){if(_0x312000[_0x0932('0x26')]){return logger['error'](_0x0932('0x27'),JSON[_0x0932('0x22')](_0x312000));}return logger[_0x0932('0xc')](_0x0932('0x28'));})['catch'](function(_0x11b179){return logger['error'](_0x0932('0x27'),JSON['stringify'](_0x11b179));});}};}function handleError(){return function(_0x3b92df){return logger[_0x0932('0x26')](JSON['stringify'](_0x3b92df));};}function handleResult(_0x45410a){return function(_0x748b43){logger[_0x0932('0xc')](_0x0932('0x29'),JSON[_0x0932('0x22')](_0x748b43));if(_0x45410a[_0x0932('0x12')]&&_0x45410a[_0x0932('0x12')]['Smtp']&&!_[_0x0932('0x2a')](_0x45410a['email'])){setTimeout(handleSendEmail(_0x45410a,_0x748b43),0x3c*0x3e8);}};}function handleJob(_0x363bea){return function(){try{if(_['isNil'](_0x363bea[_0x0932('0x17')])){return logger[_0x0932('0xc')](_0x0932('0x2b'));}if(_[_0x0932('0x2a')](_0x363bea[_0x0932('0x2c')])){return logger[_0x0932('0xc')](_0x0932('0x2d'));}var _0x2035c1={'startDate':moment()[_0x0932('0x2e')](_0x363bea['subtractNumber'],_0x363bea['subtractUnit'])[_0x0932('0x10')](_0x0932('0x2f')),'endDate':moment()['format'](_0x0932('0x2f')),'type':'scheduled','output':_0x363bea['output'],'name':_0x363bea[_0x0932('0x16')]};if(!_[_0x0932('0x2a')](_0x363bea[_0x0932('0x30')])){logger[_0x0932('0xc')](_0x0932('0x31'),_0x363bea[_0x0932('0x30')]);return analyticDefaultReportController[_0x0932('0x32')]({'id':_0x363bea[_0x0932('0x30')]},_0x2035c1)[_0x0932('0x33')](handleResult(_0x363bea))[_0x0932('0x34')](handleError());}if(!_['isNil'](_0x363bea[_0x0932('0x35')])){logger[_0x0932('0xc')]('exec\x20custom\x20report\x20id:%s',_0x363bea['CustomReportId']);return analyticCustomReportController[_0x0932('0x32')]({'id':_0x363bea['CustomReportId']},_0x2035c1)[_0x0932('0x33')](handleResult(_0x363bea))['catch'](handleError());}}catch(_0x3aa022){logger[_0x0932('0x26')](JSON[_0x0932('0x22')](_0x3aa022));}return logger[_0x0932('0xc')](_0x0932('0x36'));};}function getJobs(_0x21da61){var _0x4ef5d2={};if(_0x21da61){_0x4ef5d2['id']=_0x21da61;}return db[_0x0932('0x37')]['findAll']({'where':_0x4ef5d2,'include':[{'model':db['MailAccount'],'attributes':['id','name',_0x0932('0xe')],'include':[{'model':db['MailServerOut'],'as':_0x0932('0x13'),'include':[{'model':db[_0x0932('0x38')],'as':_0x0932('0x38')}]}]}]})[_0x0932('0x33')](function(_0xdee1a8){var _0x6bd3cd=_['keys'](manager[_0x0932('0x39')]);var _0xdd32e5=_[_0x0932('0x3a')](_0xdee1a8,function(_0x2a7767){return _0x2a7767['id']['toString']();});var _0x16972c=_[_0x0932('0x3b')](_0xdee1a8,function(_0x5df8e6){return _0x5df8e6['id'][_0x0932('0x3c')]();});var _0x4280f1=_0x21da61?_0xdd32e5:_[_0x0932('0x3d')](_0xdd32e5,_0x6bd3cd);var _0x9c9afa=_['intersection'](_0xdd32e5,_0x6bd3cd);var _0x10a039=_[_0x0932('0x3d')](_0x6bd3cd,_0xdd32e5);var _0x4bd680;var _0x1ce6da;for(_0x4bd680=0x0;_0x4bd680<_0x10a039[_0x0932('0x3e')]&&!_0x21da61;_0x4bd680+=0x1){_0x1ce6da=_0x10a039[_0x4bd680]['toString']();if(manager['exists'](_0x1ce6da)){manager[_0x0932('0x3f')](_0x1ce6da);manager[_0x0932('0x40')](_0x1ce6da);logger[_0x0932('0xc')]('delete\x20cron',_0x1ce6da);}}logger[_0x0932('0xc')](_0x0932('0x41'),JSON[_0x0932('0x22')](_0x4280f1));for(_0x4bd680=0x0;_0x4bd680<_0x4280f1[_0x0932('0x3e')];_0x4bd680+=0x1){_0x1ce6da=_0x4280f1[_0x4bd680][_0x0932('0x3c')]();logger[_0x0932('0xc')](_0x0932('0x42'),_0x1ce6da);if(_0x21da61){logger[_0x0932('0xc')]('my\x20id',_0x21da61);logger[_0x0932('0xc')](JSON[_0x0932('0x22')](_0x16972c[_0x1ce6da]));BPromise[_0x0932('0x43')]()[_0x0932('0x33')](handleJob(_0x16972c[_0x1ce6da]));logger['info']('run\x20job',_0x16972c[_0x1ce6da][_0x0932('0x16')],_0x16972c[_0x1ce6da]['cron']);}else if(_0x16972c[_0x1ce6da][_0x0932('0x44')]&&_0x16972c[_0x1ce6da]['active']&&moment()['isBetween'](_0x16972c[_0x1ce6da][_0x0932('0x45')],_0x16972c[_0x1ce6da][_0x0932('0x46')])){manager[_0x0932('0x47')](_0x1ce6da,_0x16972c[_0x1ce6da][_0x0932('0x44')],handleJob(_0x16972c[_0x1ce6da]));manager['start'](_0x1ce6da);logger['info']('add\x20cron',_0x16972c[_0x1ce6da][_0x0932('0x16')],_0x16972c[_0x1ce6da]['cron']);}else if(manager[_0x0932('0x48')](_0x1ce6da)){manager[_0x0932('0x3f')](_0x1ce6da);manager['deleteJob'](_0x1ce6da);logger[_0x0932('0xc')](_0x0932('0x49'),_0x16972c[_0x1ce6da][_0x0932('0x16')],_0x16972c[_0x1ce6da][_0x0932('0x44')]);}}for(_0x4bd680=0x0,_0x1ce6da;_0x4bd680<_0x9c9afa[_0x0932('0x3e')]&&!_0x21da61;_0x4bd680+=0x1){_0x1ce6da=_0x9c9afa[_0x4bd680]['toString']();if(manager[_0x0932('0x48')](_0x1ce6da)){if(_0x16972c[_0x1ce6da]['cron']&&_0x16972c[_0x1ce6da]['active']&&moment()[_0x0932('0x4a')](_0x16972c[_0x1ce6da][_0x0932('0x45')],_0x16972c[_0x1ce6da][_0x0932('0x46')])){manager['update'](_0x1ce6da,_0x16972c[_0x1ce6da][_0x0932('0x44')],handleJob(_0x16972c[_0x1ce6da]));logger[_0x0932('0xc')](_0x0932('0x4b'),_0x16972c[_0x1ce6da]['name'],_0x16972c[_0x1ce6da]['cron']);}else{manager[_0x0932('0x3f')](_0x1ce6da);manager[_0x0932('0x40')](_0x1ce6da);logger[_0x0932('0xc')](_0x0932('0x49'),_0x16972c[_0x1ce6da][_0x0932('0x16')],_0x16972c[_0x1ce6da][_0x0932('0x44')]);}}}})[_0x0932('0x34')](function(_0x5809d0){logger[_0x0932('0x26')](JSON[_0x0932('0x22')](_0x5809d0));});}exports[_0x0932('0x4c')]=function(_0x1a0782){return getJobs(_0x1a0782);};exports[_0x0932('0x4d')]=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 37cd514..fd9907f 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 _0xe9f9=['Mixed','catch','name','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribe','Transcribe\x20not\x20configured','transcribeAccountId','forEach','push','all','SequelizeValidationError','lodash','request-promise','util','bluebird','../../mysqldb','../../config/logger','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','info','transcribeName','data1','data2','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','fileText','TranscriptionJob','TranscriptionJobStatus','COMPLETED','TranscriptFileUri','format','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentimentAccountId','sentimentRegion','language','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','Positive','SentimentScore','Neutral','FAILED','update','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','sentiment','bucket','Cloud\x20Provider\x20not\x20available','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Negative'];(function(_0x1f40ff,_0x447764){var _0x5efa13=function(_0x4a34c7){while(--_0x4a34c7){_0x1f40ff['push'](_0x1f40ff['shift']());}};_0x5efa13(++_0x447764);}(_0xe9f9,0x174));var _0x9e9f=function(_0x5c2400,_0x32146e){_0x5c2400=_0x5c2400-0x0;var _0x351583=_0xe9f9[_0x5c2400];return _0x351583;};var _=require(_0x9e9f('0x0'));var AWS=require('aws-sdk');var rp=require(_0x9e9f('0x1'));var util=require(_0x9e9f('0x2'));var BPromise=require(_0x9e9f('0x3'));var db=require(_0x9e9f('0x4'))['db'];var logger=require(_0x9e9f('0x5'))('transcribe');function getTranscriptionJob(_0x2020b3,_0x47f4c7,_0x372526,_0xde96fc){return new Promise(function(_0x549ea5,_0x32da7a){var _0x54f87c=new AWS[(_0x9e9f('0x6'))]({'accessKeyId':_0x47f4c7,'secretAccessKey':_0x2020b3,'region':_0x372526});_0x54f87c[_0x9e9f('0x7')]({'TranscriptionJobName':_0xde96fc},function(_0x10d43b,_0x5256b3){if(_0x10d43b){return _0x32da7a(_0x10d43b);}else{return _0x549ea5(_0x5256b3);}});});}function sentiment(_0x1170bb,_0x3a4291,_0x2e1e8e,_0x29aebc,_0xa837dd){return new Promise(function(_0x140b9b,_0x54a20a){var _0x18faca=new AWS[(_0x9e9f('0x8'))]({'accessKeyId':_0x3a4291,'secretAccessKey':_0x1170bb,'region':_0x2e1e8e});_0x18faca[_0x9e9f('0x9')]({'Text':_0x29aebc,'LanguageCode':_0xa837dd['substring'](0x0,0x2)},function(_0x3db1c7,_0x1997f5){if(_0x3db1c7){return _0x54a20a(_0x3db1c7);}else{return _0x140b9b(_0x1997f5);}});});}function checkTranscribeJob(_0x38aaf8,_0x43603d,_0x1320b2){var _0x35a622;return new BPromise(function(_0x52c423,_0x35e630){logger[_0x9e9f('0xa')](util['format']('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x38aaf8['id'],_0x38aaf8[_0x9e9f('0xb')]));return getTranscriptionJob(_0x1320b2[_0x9e9f('0xc')],_0x1320b2[_0x9e9f('0xd')],_0x43603d[_0x9e9f('0xe')],_0x38aaf8[_0x9e9f('0xb')])[_0x9e9f('0xf')](function(_0x4c5d54){logger[_0x9e9f('0xa')](util['format'](_0x9e9f('0x10'),_0x38aaf8['id'],_0x38aaf8['transcribeName'],_0x4c5d54['TranscriptionJob']['TranscriptionJobStatus']));if(!_0x38aaf8[_0x9e9f('0x11')]){switch(_0x4c5d54[_0x9e9f('0x12')][_0x9e9f('0x13')]){case _0x9e9f('0x14'):var _0x4d3a5f={'transcribeStatus':_0x4c5d54[_0x9e9f('0x12')][_0x9e9f('0x13')],'fileUri':_0x4c5d54[_0x9e9f('0x12')]['Transcript'][_0x9e9f('0x15')]};logger[_0x9e9f('0xa')](util[_0x9e9f('0x16')](_0x9e9f('0x17'),_0x38aaf8['id']));return rp({'uri':_0x4c5d54['TranscriptionJob']['Transcript'][_0x9e9f('0x15')],'json':!![]})[_0x9e9f('0xf')](function(_0x54f288){logger[_0x9e9f('0xa')](util[_0x9e9f('0x16')](_0x9e9f('0x18'),_0x38aaf8['id']));if(_0x54f288&&_0x54f288[_0x9e9f('0x19')]&&_0x54f288['results'][_0x9e9f('0x1a')]&&_0x54f288[_0x9e9f('0x19')]['transcripts']['length']){_0x4d3a5f[_0x9e9f('0x11')]='';for(var _0x2ea441=0x0;_0x2ea441<_0x54f288['results'][_0x9e9f('0x1a')][_0x9e9f('0x1b')];_0x2ea441++){_0x4d3a5f['fileText']+=_0x54f288[_0x9e9f('0x19')][_0x9e9f('0x1a')][_0x2ea441]['transcript']+'';}}return _0x38aaf8['update'](_0x4d3a5f);})[_0x9e9f('0xf')](function(){logger[_0x9e9f('0xa')](util[_0x9e9f('0x16')](_0x9e9f('0x1c'),_0x38aaf8['id']));if(!_0x38aaf8['tempSentiment']){throw new db[(_0x9e9f('0x1d'))][(_0x9e9f('0x1e'))](_0x9e9f('0x1f'));}if(!_0x43603d['sentiment']||!_0x43603d[_0x9e9f('0x20')]||!_0x43603d[_0x9e9f('0x21')]||!_0x43603d[_0x9e9f('0x22')]||!_0x43603d['bucket']){throw new db[(_0x9e9f('0x1d'))][(_0x9e9f('0x1e'))](_0x9e9f('0x23'));}if(!_0x4d3a5f[_0x9e9f('0x11')]){throw new Error(_0x9e9f('0x24'));}if(_0x43603d[_0x9e9f('0x20')]===_0x1320b2['id']){return _0x1320b2;}else{return db[_0x9e9f('0x25')][_0x9e9f('0x26')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x9e9f('0xf')](function(_0x1a46d3){if(!_0x1a46d3){throw new db[(_0x9e9f('0x1d'))][(_0x9e9f('0x1e'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x1a46d3[_0x9e9f('0xc')]||!_0x1a46d3[_0x9e9f('0xd')]){throw new db[(_0x9e9f('0x1d'))][(_0x9e9f('0x1e'))](_0x9e9f('0x27'));}_0x35a622=_0x1a46d3;logger[_0x9e9f('0xa')](util[_0x9e9f('0x16')](_0x9e9f('0x28'),_0x38aaf8['id']));return sentiment(_0x35a622[_0x9e9f('0xc')],_0x35a622[_0x9e9f('0xd')],_0x43603d[_0x9e9f('0x21')],_0x4d3a5f[_0x9e9f('0x11')],_0x43603d[_0x9e9f('0x22')]);})[_0x9e9f('0xf')](function(_0x41b153){logger[_0x9e9f('0xa')](util[_0x9e9f('0x16')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x38aaf8['id']));return _0x38aaf8['update']({'sentiment':_0x41b153['Sentiment'],'sPositive':_0x41b153['SentimentScore'][_0x9e9f('0x29')],'sNegative':_0x41b153[_0x9e9f('0x2a')]['Negative'],'sMixed':_0x41b153[_0x9e9f('0x2a')]['Mixed'],'sNeutral':_0x41b153[_0x9e9f('0x2a')][_0x9e9f('0x2b')]});})[_0x9e9f('0xf')](function(){logger[_0x9e9f('0xa')](util[_0x9e9f('0x16')](_0x9e9f('0x1c'),_0x38aaf8['id']));_0x52c423();});case _0x9e9f('0x2c'):return _0x38aaf8[_0x9e9f('0x2d')]({'transcribeStatus':_0x9e9f('0x2c'),'failureReason':_0x4c5d54[_0x9e9f('0x12')][_0x9e9f('0x2e')]})[_0x9e9f('0xf')](function(){logger[_0x9e9f('0xa')](util[_0x9e9f('0x16')](_0x9e9f('0x1c'),_0x38aaf8['id']));_0x52c423();});default:logger[_0x9e9f('0xa')](util[_0x9e9f('0x16')](_0x9e9f('0x2f'),_0x38aaf8['id']));break;}}else{return BPromise[_0x9e9f('0x30')]()[_0x9e9f('0xf')](function(){if(!_0x38aaf8['tempSentiment']){throw new db[(_0x9e9f('0x1d'))][(_0x9e9f('0x1e'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x43603d[_0x9e9f('0x31')]||!_0x43603d[_0x9e9f('0x20')]||!_0x43603d[_0x9e9f('0x21')]||!_0x43603d[_0x9e9f('0x22')]||!_0x43603d[_0x9e9f('0x32')]){throw new db['Sequelize']['ValidationError'](_0x9e9f('0x23'));}if(!_0x38aaf8['fileText']){throw new Error(_0x9e9f('0x24'));}if(_0x43603d[_0x9e9f('0x20')]===_0x1320b2['id']){return _0x1320b2;}else{return db[_0x9e9f('0x25')]['findOne']({'where':{'id':_settings[_0x9e9f('0x20')]}});}})['then'](function(_0x3f4fb9){if(!_0x3f4fb9){throw new db[(_0x9e9f('0x1d'))][(_0x9e9f('0x1e'))](_0x9e9f('0x33'));}if(!_0x3f4fb9[_0x9e9f('0xc')]||!_0x3f4fb9[_0x9e9f('0xd')]){throw new db[(_0x9e9f('0x1d'))][(_0x9e9f('0x1e'))](_0x9e9f('0x27'));}_0x35a622=_0x3f4fb9;logger['info'](util[_0x9e9f('0x16')](_0x9e9f('0x28'),_0x38aaf8['id']));return sentiment(_0x35a622[_0x9e9f('0xc')],_0x35a622[_0x9e9f('0xd')],_0x43603d['sentimentRegion'],_0x38aaf8['fileText'],_0x43603d[_0x9e9f('0x22')]);})['then'](function(_0x4ef460){logger[_0x9e9f('0xa')](util['format'](_0x9e9f('0x34'),_0x38aaf8['id']));return _0x38aaf8[_0x9e9f('0x2d')]({'sentiment':_0x4ef460['Sentiment'],'sPositive':_0x4ef460[_0x9e9f('0x2a')]['Positive'],'sNegative':_0x4ef460[_0x9e9f('0x2a')][_0x9e9f('0x35')],'sMixed':_0x4ef460[_0x9e9f('0x2a')][_0x9e9f('0x36')],'sNeutral':_0x4ef460[_0x9e9f('0x2a')]['Neutral'],'transcribeStatus':_0x9e9f('0x14')});})[_0x9e9f('0xf')](function(){logger[_0x9e9f('0xa')](util[_0x9e9f('0x16')](_0x9e9f('0x1c'),_0x38aaf8['id']));_0x52c423();});}})[_0x9e9f('0x37')](function(_0x3889ff){if(_0x3889ff){if(!_0x3889ff[_0x9e9f('0x38')]||_0x3889ff[_0x9e9f('0x38')]!=='SequelizeValidationError'){logger['error'](util[_0x9e9f('0x16')](_0x9e9f('0x39'),_0x38aaf8['id']),util['inspect'](_0x3889ff,{'showHidden':![],'depth':null}));}}_0x52c423();});});}function checkTranscribe(){var _0x2c9ada;var _0x44e631;var _0x22bec9;return db[_0x9e9f('0x3a')][_0x9e9f('0x3b')]({'where':{'transcribeStatus':_0x9e9f('0x3c')}})[_0x9e9f('0xf')](function(_0x304dff){if(!_0x304dff||!_0x304dff[_0x9e9f('0x1b')]){throw new db['Sequelize']['ValidationError'](_0x9e9f('0x3d'));}_0x2c9ada=_0x304dff;return db[_0x9e9f('0x3e')][_0x9e9f('0x26')]({'where':{'id':0x1}});})[_0x9e9f('0xf')](function(_0x37dbd6){if(!_0x37dbd6){throw new db['Sequelize'][(_0x9e9f('0x1e'))](_0x9e9f('0x3f'));}_0x44e631=_0x37dbd6;if(!_0x44e631[_0x9e9f('0x40')]||!_0x44e631['transcribeAccountId']||!_0x44e631[_0x9e9f('0xe')]||!_0x44e631['language']||!_0x44e631[_0x9e9f('0x32')]){throw new db[(_0x9e9f('0x1d'))]['ValidationError'](_0x9e9f('0x41'));}return db['CloudProvider']['findOne']({'where':{'id':_0x44e631[_0x9e9f('0x42')]}});})['then'](function(_0x1b41ef){if(!_0x1b41ef){throw new db[(_0x9e9f('0x1d'))][(_0x9e9f('0x1e'))](_0x9e9f('0x33'));}if(!_0x1b41ef['data1']||!_0x1b41ef[_0x9e9f('0xd')]){throw new db[(_0x9e9f('0x1d'))][(_0x9e9f('0x1e'))]('Cloud\x20Provider\x20not\x20configured');}_0x22bec9=_0x1b41ef;var _0x57cba8=[];_0x2c9ada[_0x9e9f('0x43')](function(_0x43592e){_0x57cba8[_0x9e9f('0x44')](checkTranscribeJob(_0x43592e,_0x44e631,_0x22bec9));});return BPromise[_0x9e9f('0x45')](_0x57cba8);})[_0x9e9f('0x37')](function(_0x7fae40){if(_0x7fae40){if(!_0x7fae40[_0x9e9f('0x38')]||_0x7fae40[_0x9e9f('0x38')]!==_0x9e9f('0x46')){logger['error'](util['inspect'](_0x7fae40,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0xede3=['substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','data2','transcribeName','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','COMPLETED','[RECORDING:%d]\x20Get\x20transcript','Transcript','TranscriptFileUri','then','results','transcripts','length','fileText','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','language','ValidationError','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','data1','sentimentRegion','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','Positive','SentimentScore','Negative','Neutral','FAILED','FailureReason','Sentiment\x20Analysis\x20not\x20configured','Mixed','catch','name','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','start','aws-sdk','util','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','detectSentiment'];(function(_0x568ff7,_0x2b7aaf){var _0x3d2984=function(_0x2b25c7){while(--_0x2b25c7){_0x568ff7['push'](_0x568ff7['shift']());}};_0x3d2984(++_0x2b7aaf);}(_0xede3,0xc0));var _0x3ede=function(_0x35b2e1,_0xd3621e){_0x35b2e1=_0x35b2e1-0x0;var _0x5f2650=_0xede3[_0x35b2e1];return _0x5f2650;};var _=require('lodash');var AWS=require(_0x3ede('0x0'));var rp=require('request-promise');var util=require(_0x3ede('0x1'));var BPromise=require(_0x3ede('0x2'));var db=require(_0x3ede('0x3'))['db'];var logger=require(_0x3ede('0x4'))(_0x3ede('0x5'));function getTranscriptionJob(_0x1e463b,_0x10dbc8,_0x450f99,_0xf6f567){return new Promise(function(_0x365db9,_0x328085){var _0x150182=new AWS[(_0x3ede('0x6'))]({'accessKeyId':_0x10dbc8,'secretAccessKey':_0x1e463b,'region':_0x450f99});_0x150182[_0x3ede('0x7')]({'TranscriptionJobName':_0xf6f567},function(_0x583272,_0x428a4b){if(_0x583272){return _0x328085(_0x583272);}else{return _0x365db9(_0x428a4b);}});});}function sentiment(_0x3d308f,_0x4168b5,_0x58ceae,_0x35cea4,_0x555bd){return new Promise(function(_0x177db,_0x377182){var _0x1e5240=new AWS['Comprehend']({'accessKeyId':_0x4168b5,'secretAccessKey':_0x3d308f,'region':_0x58ceae});_0x1e5240[_0x3ede('0x8')]({'Text':_0x35cea4,'LanguageCode':_0x555bd[_0x3ede('0x9')](0x0,0x2)},function(_0x3a22b8,_0xdeba4e){if(_0x3a22b8){return _0x377182(_0x3a22b8);}else{return _0x177db(_0xdeba4e);}});});}function checkTranscribeJob(_0x4a9c49,_0x35c8d4,_0x3b2697){var _0xf1a93b;return new BPromise(function(_0x449111,_0x3875f0){logger[_0x3ede('0xa')](util[_0x3ede('0xb')](_0x3ede('0xc'),_0x4a9c49['id'],_0x4a9c49['transcribeName']));return getTranscriptionJob(_0x3b2697['data1'],_0x3b2697[_0x3ede('0xd')],_0x35c8d4['transcribeRegion'],_0x4a9c49[_0x3ede('0xe')])['then'](function(_0x54ae57){logger[_0x3ede('0xa')](util[_0x3ede('0xb')](_0x3ede('0xf'),_0x4a9c49['id'],_0x4a9c49['transcribeName'],_0x54ae57[_0x3ede('0x10')]['TranscriptionJobStatus']));if(!_0x4a9c49['fileText']){switch(_0x54ae57[_0x3ede('0x10')][_0x3ede('0x11')]){case _0x3ede('0x12'):var _0x54aeb9={'transcribeStatus':_0x54ae57[_0x3ede('0x10')][_0x3ede('0x11')],'fileUri':_0x54ae57[_0x3ede('0x10')]['Transcript']['TranscriptFileUri']};logger[_0x3ede('0xa')](util['format'](_0x3ede('0x13'),_0x4a9c49['id']));return rp({'uri':_0x54ae57['TranscriptionJob'][_0x3ede('0x14')][_0x3ede('0x15')],'json':!![]})[_0x3ede('0x16')](function(_0xf821d9){logger[_0x3ede('0xa')](util[_0x3ede('0xb')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x4a9c49['id']));if(_0xf821d9&&_0xf821d9[_0x3ede('0x17')]&&_0xf821d9[_0x3ede('0x17')][_0x3ede('0x18')]&&_0xf821d9[_0x3ede('0x17')][_0x3ede('0x18')][_0x3ede('0x19')]){_0x54aeb9[_0x3ede('0x1a')]='';for(var _0x44713b=0x0;_0x44713b<_0xf821d9[_0x3ede('0x17')][_0x3ede('0x18')]['length'];_0x44713b++){_0x54aeb9['fileText']+=_0xf821d9[_0x3ede('0x17')][_0x3ede('0x18')][_0x44713b][_0x3ede('0x1b')]+'';}}return _0x4a9c49[_0x3ede('0x1c')](_0x54aeb9);})[_0x3ede('0x16')](function(){logger[_0x3ede('0xa')](util['format'](_0x3ede('0x1d'),_0x4a9c49['id']));if(!_0x4a9c49[_0x3ede('0x1e')]){throw new db[(_0x3ede('0x1f'))]['ValidationError'](_0x3ede('0x20'));}if(!_0x35c8d4[_0x3ede('0x21')]||!_0x35c8d4[_0x3ede('0x22')]||!_0x35c8d4['sentimentRegion']||!_0x35c8d4[_0x3ede('0x23')]||!_0x35c8d4['bucket']){throw new db[(_0x3ede('0x1f'))][(_0x3ede('0x24'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x54aeb9['fileText']){throw new Error(_0x3ede('0x25'));}if(_0x35c8d4[_0x3ede('0x22')]===_0x3b2697['id']){return _0x3b2697;}else{return db[_0x3ede('0x26')][_0x3ede('0x27')]({'where':{'id':_settings[_0x3ede('0x22')]}});}})[_0x3ede('0x16')](function(_0x41c790){if(!_0x41c790){throw new db[(_0x3ede('0x1f'))][(_0x3ede('0x24'))](_0x3ede('0x28'));}if(!_0x41c790['data1']||!_0x41c790[_0x3ede('0xd')]){throw new db[(_0x3ede('0x1f'))]['ValidationError'](_0x3ede('0x29'));}_0xf1a93b=_0x41c790;logger[_0x3ede('0xa')](util[_0x3ede('0xb')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x4a9c49['id']));return sentiment(_0xf1a93b[_0x3ede('0x2a')],_0xf1a93b['data2'],_0x35c8d4[_0x3ede('0x2b')],_0x54aeb9[_0x3ede('0x1a')],_0x35c8d4[_0x3ede('0x23')]);})['then'](function(_0x518543){logger[_0x3ede('0xa')](util[_0x3ede('0xb')](_0x3ede('0x2c'),_0x4a9c49['id']));return _0x4a9c49[_0x3ede('0x1c')]({'sentiment':_0x518543[_0x3ede('0x2d')],'sPositive':_0x518543['SentimentScore'][_0x3ede('0x2e')],'sNegative':_0x518543[_0x3ede('0x2f')][_0x3ede('0x30')],'sMixed':_0x518543[_0x3ede('0x2f')]['Mixed'],'sNeutral':_0x518543[_0x3ede('0x2f')][_0x3ede('0x31')]});})[_0x3ede('0x16')](function(){logger['info'](util['format'](_0x3ede('0x1d'),_0x4a9c49['id']));_0x449111();});case _0x3ede('0x32'):return _0x4a9c49[_0x3ede('0x1c')]({'transcribeStatus':_0x3ede('0x32'),'failureReason':_0x54ae57[_0x3ede('0x10')][_0x3ede('0x33')]})[_0x3ede('0x16')](function(){logger['info'](util[_0x3ede('0xb')](_0x3ede('0x1d'),_0x4a9c49['id']));_0x449111();});default:logger[_0x3ede('0xa')](util['format']('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x4a9c49['id']));break;}}else{return BPromise['resolve']()[_0x3ede('0x16')](function(){if(!_0x4a9c49[_0x3ede('0x1e')]){throw new db[(_0x3ede('0x1f'))][(_0x3ede('0x24'))](_0x3ede('0x20'));}if(!_0x35c8d4[_0x3ede('0x21')]||!_0x35c8d4[_0x3ede('0x22')]||!_0x35c8d4[_0x3ede('0x2b')]||!_0x35c8d4[_0x3ede('0x23')]||!_0x35c8d4['bucket']){throw new db[(_0x3ede('0x1f'))][(_0x3ede('0x24'))](_0x3ede('0x34'));}if(!_0x4a9c49['fileText']){throw new Error(_0x3ede('0x25'));}if(_0x35c8d4[_0x3ede('0x22')]===_0x3b2697['id']){return _0x3b2697;}else{return db[_0x3ede('0x26')][_0x3ede('0x27')]({'where':{'id':_settings['sentimentAccountId']}});}})['then'](function(_0x222a85){if(!_0x222a85){throw new db[(_0x3ede('0x1f'))][(_0x3ede('0x24'))](_0x3ede('0x28'));}if(!_0x222a85['data1']||!_0x222a85[_0x3ede('0xd')]){throw new db[(_0x3ede('0x1f'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0xf1a93b=_0x222a85;logger['info'](util[_0x3ede('0xb')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x4a9c49['id']));return sentiment(_0xf1a93b['data1'],_0xf1a93b['data2'],_0x35c8d4[_0x3ede('0x2b')],_0x4a9c49[_0x3ede('0x1a')],_0x35c8d4[_0x3ede('0x23')]);})[_0x3ede('0x16')](function(_0x22ae1a){logger[_0x3ede('0xa')](util['format'](_0x3ede('0x2c'),_0x4a9c49['id']));return _0x4a9c49['update']({'sentiment':_0x22ae1a['Sentiment'],'sPositive':_0x22ae1a[_0x3ede('0x2f')][_0x3ede('0x2e')],'sNegative':_0x22ae1a[_0x3ede('0x2f')]['Negative'],'sMixed':_0x22ae1a['SentimentScore'][_0x3ede('0x35')],'sNeutral':_0x22ae1a[_0x3ede('0x2f')][_0x3ede('0x31')],'transcribeStatus':'COMPLETED'});})[_0x3ede('0x16')](function(){logger[_0x3ede('0xa')](util[_0x3ede('0xb')](_0x3ede('0x1d'),_0x4a9c49['id']));_0x449111();});}})[_0x3ede('0x36')](function(_0x34f94a){if(_0x34f94a){if(!_0x34f94a[_0x3ede('0x37')]||_0x34f94a['name']!=='SequelizeValidationError'){logger['error'](util['format']('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x4a9c49['id']),util[_0x3ede('0x38')](_0x34f94a,{'showHidden':![],'depth':null}));}}_0x449111();});});}function checkTranscribe(){var _0x44ba2a;var _0x13b7a0;var _0x29f801;return db[_0x3ede('0x39')][_0x3ede('0x3a')]({'where':{'transcribeStatus':_0x3ede('0x3b')}})['then'](function(_0x52d97e){if(!_0x52d97e||!_0x52d97e[_0x3ede('0x19')]){throw new db[(_0x3ede('0x1f'))][(_0x3ede('0x24'))](_0x3ede('0x3c'));}_0x44ba2a=_0x52d97e;return db[_0x3ede('0x3d')][_0x3ede('0x27')]({'where':{'id':0x1}});})['then'](function(_0x3dc3a5){if(!_0x3dc3a5){throw new db[(_0x3ede('0x1f'))][(_0x3ede('0x24'))](_0x3ede('0x3e'));}_0x13b7a0=_0x3dc3a5;if(!_0x13b7a0[_0x3ede('0x5')]||!_0x13b7a0[_0x3ede('0x3f')]||!_0x13b7a0[_0x3ede('0x40')]||!_0x13b7a0[_0x3ede('0x23')]||!_0x13b7a0['bucket']){throw new db['Sequelize']['ValidationError'](_0x3ede('0x41'));}return db[_0x3ede('0x26')][_0x3ede('0x27')]({'where':{'id':_0x13b7a0[_0x3ede('0x3f')]}});})['then'](function(_0x253773){if(!_0x253773){throw new db[(_0x3ede('0x1f'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x253773[_0x3ede('0x2a')]||!_0x253773['data2']){throw new db['Sequelize'][(_0x3ede('0x24'))](_0x3ede('0x29'));}_0x29f801=_0x253773;var _0x148c96=[];_0x44ba2a['forEach'](function(_0x2c6981){_0x148c96['push'](checkTranscribeJob(_0x2c6981,_0x13b7a0,_0x29f801));});return BPromise['all'](_0x148c96);})[_0x3ede('0x36')](function(_0x37fbbb){if(_0x37fbbb){if(!_0x37fbbb[_0x3ede('0x37')]||_0x37fbbb['name']!=='SequelizeValidationError'){logger['error'](util[_0x3ede('0x38')](_0x37fbbb,{'showHidden':![],'depth':null}));}}});}exports[_0x3ede('0x42')]=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 f9bb6e1..6f37687 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 _0xd545=['redis','defaults','localhost','socket.io-emitter','subtract','hours','then','length','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','WhatsappInteraction','system','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','util','../../config/environment','../logger','schedule'];(function(_0x418c1f,_0x24d850){var _0x2bdcac=function(_0x4bed0b){while(--_0x4bed0b){_0x418c1f['push'](_0x418c1f['shift']());}};_0x2bdcac(++_0x24d850);}(_0xd545,0xff));var _0x5d54=function(_0x3fe9d2,_0x5cf1ee){_0x3fe9d2=_0x3fe9d2-0x0;var _0x39c1fb=_0xd545[_0x3fe9d2];return _0x39c1fb;};'use strict';var _=require(_0x5d54('0x0'));var moment=require('moment');var Redis=require('ioredis');var util=require(_0x5d54('0x1'));var config=require(_0x5d54('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0x5d54('0x3'))(_0x5d54('0x4'));config[_0x5d54('0x5')]=_[_0x5d54('0x6')](config[_0x5d54('0x5')],{'host':_0x5d54('0x7'),'port':0x18eb});var io=require(_0x5d54('0x8'))(new Redis(config[_0x5d54('0x5')]));function closeInteractions(){var _0x45b434=[];return db['WhatsappInteraction']['findAll']({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x5d54('0x9')](0x18,_0x5d54('0xa'))}}})[_0x5d54('0xb')](function(_0x18d75b){if(_0x18d75b&&_0x18d75b[_0x5d54('0xc')]){_0x45b434=_['map'](_0x18d75b||[],'id');logger[_0x5d54('0xd')](_0x5d54('0xe'),_0x45b434[_0x5d54('0xf')]());return db[_0x5d54('0x10')]['update']({'closeReason':_0x5d54('0x11'),'disposition':'timeout','closed':!![],'closedAt':moment()['format'](_0x5d54('0x12'))},{'where':{'id':_0x45b434}});}})['then'](function(){if(_0x45b434&&_0x45b434[_0x5d54('0xc')]){logger[_0x5d54('0xd')](_0x5d54('0x13'),_0x45b434[_0x5d54('0xf')]());for(var _0x1e8b17=0x0;_0x1e8b17<_0x45b434[_0x5d54('0xc')];_0x1e8b17++){io[_0x5d54('0x14')](_0x5d54('0x15'),{'id':_0x45b434[_0x1e8b17],'closed':!![]});}}})[_0x5d54('0x16')](function(_0x297556){logger['error'](_0x5d54('0x17'),_0x297556?util[_0x5d54('0x18')](_0x297556,{'showHidden':![],'depth':null}):'');});}exports[_0x5d54('0x19')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x5f1f=['findAll','lastMsgAt','subtract','then','length','map','info','join','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','whatsappInteraction:update','catch','error','inspect','start','lodash','moment','ioredis','util','../../config/environment','../logger','defaults','redis','localhost','socket.io-emitter','WhatsappInteraction'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x5f1f,0x129));var _0xf5f1=function(_0x25ea25,_0x570998){_0x25ea25=_0x25ea25-0x0;var _0x1d453c=_0x5f1f[_0x25ea25];return _0x1d453c;};'use strict';var _=require(_0xf5f1('0x0'));var moment=require(_0xf5f1('0x1'));var Redis=require(_0xf5f1('0x2'));var util=require(_0xf5f1('0x3'));var config=require(_0xf5f1('0x4'));var db=require('../../mysqldb')['db'];var logger=require(_0xf5f1('0x5'))('schedule');config['redis']=_[_0xf5f1('0x6')](config[_0xf5f1('0x7')],{'host':_0xf5f1('0x8'),'port':0x18eb});var io=require(_0xf5f1('0x9'))(new Redis(config[_0xf5f1('0x7')]));function closeInteractions(){var _0x4f36ee=[];return db[_0xf5f1('0xa')][_0xf5f1('0xb')]({'raw':!![],'attributes':['id',_0xf5f1('0xc')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xf5f1('0xd')](0x18,'hours')}}})[_0xf5f1('0xe')](function(_0x2f98d5){if(_0x2f98d5&&_0x2f98d5[_0xf5f1('0xf')]){_0x4f36ee=_[_0xf5f1('0x10')](_0x2f98d5||[],'id');logger[_0xf5f1('0x11')]('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x4f36ee[_0xf5f1('0x12')]());return db[_0xf5f1('0xa')]['update']({'closeReason':'system','disposition':_0xf5f1('0x13'),'closed':!![],'closedAt':moment()[_0xf5f1('0x14')](_0xf5f1('0x15'))},{'where':{'id':_0x4f36ee}});}})[_0xf5f1('0xe')](function(){if(_0x4f36ee&&_0x4f36ee[_0xf5f1('0xf')]){logger['info'](_0xf5f1('0x16'),_0x4f36ee[_0xf5f1('0x12')]());for(var _0x19a235=0x0;_0x19a235<_0x4f36ee[_0xf5f1('0xf')];_0x19a235++){io['emit'](_0xf5f1('0x17'),{'id':_0x4f36ee[_0x19a235],'closed':!![]});}}})[_0xf5f1('0x18')](function(_0x2200ef){logger[_0xf5f1('0x19')]('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x2200ef?util[_0xf5f1('0x1a')](_0x2200ef,{'showHidden':![],'depth':null}):'');});}exports[_0xf5f1('0x1b')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index 2c7088a..ad25598 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1a49=['bulkCreate','log','contacts1','CmHopper','finished\x20populating','hopper1','contacts2','hopper2','catch','util','../mysqldb','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','push','now','destroy','then','CmContact'];(function(_0x58664a,_0x559e66){var _0x1db7e1=function(_0x250161){while(--_0x250161){_0x58664a['push'](_0x58664a['shift']());}};_0x1db7e1(++_0x559e66);}(_0x1a49,0x149));var _0x91a4=function(_0x263bda,_0x400597){_0x263bda=_0x263bda-0x0;var _0x578e81=_0x1a49[_0x263bda];return _0x578e81;};'use strict';var util=require(_0x91a4('0x0'));var db=require(_0x91a4('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0x91a4('0x2')+i,'lastName':_0x91a4('0x3')+i,'phone':0xf879fb460+i,'email':_0x91a4('0x4')+i+_0x91a4('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x91a4('0x6')]({'id':i,'active':![],'scheduledat':Date[_0x91a4('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x91a4('0x7')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x91a4('0x6')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x91a4('0x3')+i,'phone':0xf879fb460+i,'email':_0x91a4('0x4')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x91a4('0x6')]({'id':i,'active':![],'scheduledat':Date[_0x91a4('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x91a4('0x7')](),'updatedAt':Date[_0x91a4('0x7')]()});}db['CmContact'][_0x91a4('0x8')]({'where':{}})[_0x91a4('0x9')](function(){return db[_0x91a4('0xa')][_0x91a4('0xb')](contacts);})[_0x91a4('0x9')](function(){console[_0x91a4('0xc')]('finished\x20populating',_0x91a4('0xd'));return db[_0x91a4('0xe')][_0x91a4('0x8')]({'where':{}});})[_0x91a4('0x9')](function(){return db['CmHopper']['bulkCreate'](hopper);})['then'](function(){console[_0x91a4('0xc')](_0x91a4('0xf'),_0x91a4('0x10'));return db['CmContact'][_0x91a4('0xb')](contacts2);})[_0x91a4('0x9')](function(){console[_0x91a4('0xc')](_0x91a4('0xf'),_0x91a4('0x11'));return db['CmHopper'][_0x91a4('0xb')](hopper2);})[_0x91a4('0x9')](function(){console[_0x91a4('0xc')](_0x91a4('0xf'),_0x91a4('0x12'));})[_0x91a4('0x13')](function(_0x5e2798){console[_0x91a4('0xc')](_0x5e2798);}); \ No newline at end of file +var _0xf215=['contacts1','CmHopper','then','log','hopper1','finished\x20populating','contacts2','catch','util','../mysqldb','push','innocenzo.biondo','@xcally.com','now','Biondo','CmContact','destroy','bulkCreate'];(function(_0x473734,_0x4dbc14){var _0x10ffa8=function(_0x20bb61){while(--_0x20bb61){_0x473734['push'](_0x473734['shift']());}};_0x10ffa8(++_0x4dbc14);}(_0xf215,0x1ee));var _0x5f21=function(_0x2e49ae,_0x2ce021){_0x2e49ae=_0x2e49ae-0x0;var _0x217ac0=_0xf215[_0x2e49ae];return _0x217ac0;};'use strict';var util=require(_0x5f21('0x0'));var db=require(_0x5f21('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x5f21('0x2')]({'id':i,'firstName':'Innocenzo'+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x5f21('0x3')+i+_0x5f21('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x5f21('0x2')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x5f21('0x5')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x5f21('0x2')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x5f21('0x6')+i,'phone':0xf879fb460+i,'email':_0x5f21('0x3')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0x5f21('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x5f21('0x5')](),'updatedAt':Date[_0x5f21('0x5')]()});}db[_0x5f21('0x7')][_0x5f21('0x8')]({'where':{}})['then'](function(){return db[_0x5f21('0x7')][_0x5f21('0x9')](contacts);})['then'](function(){console['log']('finished\x20populating',_0x5f21('0xa'));return db[_0x5f21('0xb')][_0x5f21('0x8')]({'where':{}});})[_0x5f21('0xc')](function(){return db[_0x5f21('0xb')][_0x5f21('0x9')](hopper);})[_0x5f21('0xc')](function(){console[_0x5f21('0xd')]('finished\x20populating',_0x5f21('0xe'));return db[_0x5f21('0x7')][_0x5f21('0x9')](contacts2);})['then'](function(){console['log'](_0x5f21('0xf'),_0x5f21('0x10'));return db[_0x5f21('0xb')]['bulkCreate'](hopper2);})[_0x5f21('0xc')](function(){console[_0x5f21('0xd')]('finished\x20populating','hopper2');})[_0x5f21('0x11')](function(_0x392364){console[_0x5f21('0xd')](_0x392364);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 268cda4..ec523d6 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x803b=['User','bulkCreate','then','add\x20user','log','util','../mysqldb','push','format','%s%s','agent','%s%s@xcally.com','friend','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key'];(function(_0x17ce2f,_0x4ca1f1){var _0x393d6f=function(_0x346379){while(--_0x346379){_0x17ce2f['push'](_0x17ce2f['shift']());}};_0x393d6f(++_0x4ca1f1);}(_0x803b,0xe9));var _0xb803=function(_0x10fb61,_0x17f608){_0x10fb61=_0x10fb61-0x0;var _0x4817ee=_0x803b[_0x10fb61];return _0x4817ee;};'use strict';var util=require(_0xb803('0x0'));var db=require(_0xb803('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xb803('0x2')]({'name':util[_0xb803('0x3')](_0xb803('0x4'),_0xb803('0x5'),i),'fullname':util[_0xb803('0x3')](_0xb803('0x4'),_0xb803('0x5'),i),'email':util['format'](_0xb803('0x6'),_0xb803('0x5'),i),'role':_0xb803('0x5'),'password':'password','internal':0xfa0+i,'type':_0xb803('0x7'),'transport':['udp','ws',_0xb803('0x8')],'disallow':[_0xb803('0x9')],'allow':[_0xb803('0xa')],'defaultuser':util[_0xb803('0x3')](_0xb803('0x4'),'agent',i),'encryption':_0xb803('0xb'),'avpf':_0xb803('0xb'),'force_avp':_0xb803('0xb'),'icesupport':_0xb803('0xb'),'dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0xb803('0xc'),'dtlsprivatekey':_0xb803('0xd'),'dtlssetup':'actpass','callerid':util['format']('\x22%s\x22\x20<%s>',util[_0xb803('0x3')](_0xb803('0x4'),'agent',i),0xfa0+i)});}db[_0xb803('0xe')][_0xb803('0xf')](users)[_0xb803('0x10')](function(){console['log'](_0xb803('0x11'));})['catch'](function(_0x3cf015){console[_0xb803('0x12')](_0x3cf015);}); \ No newline at end of file +var _0x54d2=['catch','util','../mysqldb','push','format','%s%s','agent','%s%s@xcally.com','password','udp','wss','all','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','add\x20user'];(function(_0x1d6a82,_0x37c315){var _0x5834ac=function(_0x2402ba){while(--_0x2402ba){_0x1d6a82['push'](_0x1d6a82['shift']());}};_0x5834ac(++_0x37c315);}(_0x54d2,0xdd));var _0x254d=function(_0x29d60f,_0x13d20c){_0x29d60f=_0x29d60f-0x0;var _0x4d7d5c=_0x54d2[_0x29d60f];return _0x4d7d5c;};'use strict';var util=require(_0x254d('0x0'));var db=require(_0x254d('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x254d('0x2')]({'name':util[_0x254d('0x3')](_0x254d('0x4'),_0x254d('0x5'),i),'fullname':util[_0x254d('0x3')](_0x254d('0x4'),_0x254d('0x5'),i),'email':util[_0x254d('0x3')](_0x254d('0x6'),_0x254d('0x5'),i),'role':_0x254d('0x5'),'password':_0x254d('0x7'),'internal':0xfa0+i,'type':'friend','transport':[_0x254d('0x8'),'ws',_0x254d('0x9')],'disallow':[_0x254d('0xa')],'allow':['ulaw'],'defaultuser':util[_0x254d('0x3')]('%s%s',_0x254d('0x5'),i),'encryption':_0x254d('0xb'),'avpf':'yes','force_avp':'yes','icesupport':_0x254d('0xb'),'dtlsenable':_0x254d('0xb'),'dtlsverify':'no','dtlscertfile':_0x254d('0xc'),'dtlsprivatekey':_0x254d('0xd'),'dtlssetup':_0x254d('0xe'),'callerid':util[_0x254d('0x3')](_0x254d('0xf'),util[_0x254d('0x3')](_0x254d('0x4'),'agent',i),0xfa0+i)});}db[_0x254d('0x10')][_0x254d('0x11')](users)[_0x254d('0x12')](function(){console[_0x254d('0x13')](_0x254d('0x14'));})[_0x254d('0x15')](function(_0x4d824c){console['log'](_0x4d824c);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 303d5f7..74bd9f5 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa4e3=['setMaxListeners','address','request','connectedAt','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','bluebird','./environment','name','Agents','User','role','agent','telephone','ivr','findOne','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','where','Campaign','type','format','%s:queue:%s','length','user:%s','query','ChatInteraction','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteractions','admin','voice:inbound','voice:outbound','include','push','ChatQueue','FaxQueue','SmsQueue','MailQueue','Trunk','user','userProfileId','VoiceQueue','SmsQueues','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getOpenchannelQueues','all','voice','sms','mail','openchannel','whatsapp','campaign:%s:%s','leave','ChatInteractions','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','SmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','connection'];(function(_0x22d045,_0x13fd64){var _0x2460b1=function(_0x3e0ddf){while(--_0x3e0ddf){_0x22d045['push'](_0x22d045['shift']());}};_0x2460b1(++_0x13fd64);}(_0xa4e3,0x129));var _0x3a4e=function(_0xea860d,_0x2e012c){_0xea860d=_0xea860d-0x0;var _0xe43d14=_0xa4e3[_0xea860d];return _0xe43d14;};'use strict';var _=require(_0x3a4e('0x0'));var util=require('util');var BPromise=require(_0x3a4e('0x1'));var db=require('../mysqldb')['db'];var config=require(_0x3a4e('0x2'));var queryQueues={'attributes':['id',_0x3a4e('0x3')],'include':[{'as':_0x3a4e('0x4'),'model':db[_0x3a4e('0x5')],'attributes':['id',_0x3a4e('0x3'),_0x3a4e('0x6')],'raw':!![],'where':{'role':_0x3a4e('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x3a4e('0x3')],'where':{'role':_0x3a4e('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0x3a4e('0x3')]};var queryAgents={'raw':!![],'attributes':['id',_0x3a4e('0x3')],'where':{'role':_0x3a4e('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x3a4e('0x3'),'type'],'where':{'type':_0x3a4e('0x9')}};function getAssociatedResources(_0x54b924,_0x4c5b69,_0x494185){return db['UserProfileSection'][_0x3a4e('0xa')]({'where':{'name':_0x54b924,'userProfileId':_0x4c5b69},'raw':!![]})[_0x3a4e('0xb')](function(_0x2f1e5e){if(_0x2f1e5e){if(_0x2f1e5e[_0x3a4e('0xc')]){switch(_0x54b924){case _0x3a4e('0xd'):case _0x3a4e('0xe'):case _0x3a4e('0xf'):case'SmsQueues':case _0x3a4e('0x10'):case _0x3a4e('0x11'):case _0x3a4e('0x12'):return db[_0x494185][_0x3a4e('0x13')](queryQueues);case _0x3a4e('0x14'):return db[_0x494185][_0x3a4e('0x13')](queryTelephones);case _0x3a4e('0x15'):return db[_0x494185][_0x3a4e('0x13')](queryTrunks);case _0x3a4e('0x16'):return db[_0x494185]['findAll'](queryCampaigns);}}else{return db[_0x3a4e('0x17')][_0x3a4e('0x13')]({'attributes':[_0x3a4e('0x18')],'where':{'sectionId':_0x2f1e5e['id']},'raw':!![]})['then'](function(_0x27f333){if(_0x27f333){var _0x1e55eb={'where':{'id':_[_0x3a4e('0x19')](_0x27f333,_0x3a4e('0x18'))},'raw':!![]};switch(_0x494185){case _0x3a4e('0x5'):_0x1e55eb[_0x3a4e('0x1a')][_0x3a4e('0x6')]=_0x3a4e('0x8');break;case _0x3a4e('0x1b'):_0x1e55eb[_0x3a4e('0x1a')][_0x3a4e('0x1c')]=_0x3a4e('0x9');break;}return db[_0x494185]['findAll'](_0x1e55eb);}else{return[];}});}}else{return[];}})[_0x3a4e('0xb')](function(_0x4fcbd4){return _0x4fcbd4;});}function joinOrLeaveQueues(_0x544054,_0x55bd0b,_0x1ea78b,_0x4063b6){_0x544054[_0x55bd0b](util[_0x3a4e('0x1d')](_0x3a4e('0x1e'),_0x1ea78b,_0x4063b6[_0x3a4e('0x3')]));if(_0x4063b6[_0x3a4e('0x4')]){for(var _0x398449=0x0;_0x398449<_0x4063b6[_0x3a4e('0x4')][_0x3a4e('0x1f')];_0x398449+=0x1){_0x544054[_0x55bd0b](util[_0x3a4e('0x1d')](_0x3a4e('0x20'),_0x4063b6['Agents'][_0x398449][_0x3a4e('0x3')]));}}}function joinOrLeave(_0x45421f,_0x11f047,_0x26df6f){var _0x1ab7c5;if(_0x45421f['handshake'][_0x3a4e('0x21')]['id']){db[_0x3a4e('0x5')]['find']({'attributes':['id','name',_0x3a4e('0x6'),'userProfileId'],'where':{'id':_0x45421f['handshake']['query']['id']},'include':[{'model':db[_0x3a4e('0x22')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x3a4e('0x23')],'as':_0x3a4e('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x3a4e('0x25')],'as':_0x3a4e('0x26'),'attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x3a4e('0x27')],'as':_0x3a4e('0x28'),'attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0x3a4e('0x29'),'attributes':['id'],'raw':!![]}]})[_0x3a4e('0xb')](function(_0x21f13d){if(_0x21f13d){_0x1ab7c5=_0x21f13d;_0x45421f[_0x11f047](util[_0x3a4e('0x1d')](_0x3a4e('0x20'),_0x21f13d['name']));var _0x3e45c8=[];switch(_0x21f13d[_0x3a4e('0x6')]){case _0x3a4e('0x2a'):_0x45421f[_0x11f047](_0x3a4e('0x2b'));_0x45421f[_0x11f047](_0x3a4e('0x2c'));if(queryQueues['hasOwnProperty'](_0x3a4e('0x2d'))){delete queryQueues[_0x3a4e('0x2d')];}_0x3e45c8[_0x3a4e('0x2e')](db['VoiceQueue'][_0x3a4e('0x13')](queryQueues));_0x3e45c8[_0x3a4e('0x2e')](db[_0x3a4e('0x2f')][_0x3a4e('0x13')](queryQueues));_0x3e45c8[_0x3a4e('0x2e')](db[_0x3a4e('0x30')][_0x3a4e('0x13')](queryQueues));_0x3e45c8[_0x3a4e('0x2e')](db[_0x3a4e('0x31')][_0x3a4e('0x13')](queryQueues));_0x3e45c8[_0x3a4e('0x2e')](db[_0x3a4e('0x32')][_0x3a4e('0x13')](queryQueues));_0x3e45c8[_0x3a4e('0x2e')](db['OpenchannelQueue']['findAll'](queryQueues));_0x3e45c8[_0x3a4e('0x2e')](db['WhatsappQueue'][_0x3a4e('0x13')](queryQueues));_0x3e45c8[_0x3a4e('0x2e')](db[_0x3a4e('0x5')][_0x3a4e('0x13')](queryTelephones));_0x3e45c8['push'](db[_0x3a4e('0x33')]['findAll'](queryTrunks));_0x3e45c8[_0x3a4e('0x2e')](db[_0x3a4e('0x1b')]['findAll'](queryCampaigns));_0x3e45c8[_0x3a4e('0x2e')](db[_0x3a4e('0x5')][_0x3a4e('0x13')](queryAgents));break;case _0x3a4e('0x34'):_0x45421f[_0x11f047](_0x3a4e('0x2b'));_0x45421f[_0x11f047]('voice:outbound');_0x3e45c8[_0x3a4e('0x2e')](getAssociatedResources(_0x3a4e('0xd'),_0x21f13d[_0x3a4e('0x35')],_0x3a4e('0x36')));_0x3e45c8[_0x3a4e('0x2e')](getAssociatedResources(_0x3a4e('0xe'),_0x21f13d[_0x3a4e('0x35')],'ChatQueue'));_0x3e45c8[_0x3a4e('0x2e')](getAssociatedResources(_0x3a4e('0xf'),_0x21f13d['userProfileId'],'FaxQueue'));_0x3e45c8[_0x3a4e('0x2e')](getAssociatedResources(_0x3a4e('0x37'),_0x21f13d[_0x3a4e('0x35')],'SmsQueue'));_0x3e45c8[_0x3a4e('0x2e')](getAssociatedResources(_0x3a4e('0x10'),_0x21f13d[_0x3a4e('0x35')],_0x3a4e('0x32')));_0x3e45c8['push'](getAssociatedResources(_0x3a4e('0x11'),_0x21f13d[_0x3a4e('0x35')],'OpenchannelQueue'));_0x3e45c8['push'](getAssociatedResources(_0x3a4e('0x12'),_0x21f13d['userProfileId'],'WhatsappQueue'));_0x3e45c8[_0x3a4e('0x2e')](getAssociatedResources(_0x3a4e('0x14'),_0x21f13d[_0x3a4e('0x35')],_0x3a4e('0x5')));_0x3e45c8[_0x3a4e('0x2e')](getAssociatedResources(_0x3a4e('0x15'),_0x21f13d[_0x3a4e('0x35')],'Trunk'));_0x3e45c8['push'](getAssociatedResources(_0x3a4e('0x16'),_0x21f13d['userProfileId'],'Campaign'));_0x3e45c8[_0x3a4e('0x2e')](db[_0x3a4e('0x5')][_0x3a4e('0x13')](queryAgents));break;case'agent':_0x45421f[_0x11f047](_0x3a4e('0x2b'));_0x45421f[_0x11f047](_0x3a4e('0x2c'));_0x3e45c8[_0x3a4e('0x2e')](_0x21f13d[_0x3a4e('0x38')]({'attributes':['id','name']}));_0x3e45c8[_0x3a4e('0x2e')](_0x21f13d[_0x3a4e('0x39')]({'attributes':['id',_0x3a4e('0x3')]}));_0x3e45c8[_0x3a4e('0x2e')](_0x21f13d[_0x3a4e('0x3a')]({'attributes':['id',_0x3a4e('0x3')]}));_0x3e45c8[_0x3a4e('0x2e')](_0x21f13d[_0x3a4e('0x3b')]({'attributes':['id',_0x3a4e('0x3')]}));_0x3e45c8[_0x3a4e('0x2e')](_0x21f13d['getMailQueues']({'attributes':['id',_0x3a4e('0x3')]}));_0x3e45c8[_0x3a4e('0x2e')](_0x21f13d[_0x3a4e('0x3c')]({'attributes':['id',_0x3a4e('0x3')]}));_0x3e45c8['push'](_0x21f13d['getWhatsappQueues']({'attributes':['id',_0x3a4e('0x3')]}));break;}return BPromise[_0x3a4e('0x3d')](_0x3e45c8);}})[_0x3a4e('0xb')](function(_0x365807){if(_0x365807&&_0x365807[_0x3a4e('0x1f')]){for(var _0x3b90f2=0x0;_0x3b90f2<_0x365807['length'];_0x3b90f2+=0x1){for(var _0x20129b=0x0;_0x20129b<_0x365807[_0x3b90f2]['length'];_0x20129b+=0x1){switch(_0x3b90f2){case 0x0:joinOrLeaveQueues(_0x45421f,_0x11f047,_0x3a4e('0x3e'),_0x365807[_0x3b90f2][_0x20129b]);break;case 0x1:joinOrLeaveQueues(_0x45421f,_0x11f047,'chat',_0x365807[_0x3b90f2][_0x20129b]);break;case 0x2:joinOrLeaveQueues(_0x45421f,_0x11f047,'fax',_0x365807[_0x3b90f2][_0x20129b]);break;case 0x3:joinOrLeaveQueues(_0x45421f,_0x11f047,_0x3a4e('0x3f'),_0x365807[_0x3b90f2][_0x20129b]);break;case 0x4:joinOrLeaveQueues(_0x45421f,_0x11f047,_0x3a4e('0x40'),_0x365807[_0x3b90f2][_0x20129b]);break;case 0x5:joinOrLeaveQueues(_0x45421f,_0x11f047,_0x3a4e('0x41'),_0x365807[_0x3b90f2][_0x20129b]);break;case 0x6:joinOrLeaveQueues(_0x45421f,_0x11f047,_0x3a4e('0x42'),_0x365807[_0x3b90f2][_0x20129b]);break;case 0x7:if(_0x1ab7c5['role']!==_0x3a4e('0x7'))_0x45421f[_0x11f047](util['format']('telephone:%s',_0x365807[_0x3b90f2][_0x20129b][_0x3a4e('0x3')]));break;case 0x8:if(_0x1ab7c5[_0x3a4e('0x6')]!==_0x3a4e('0x7'))_0x45421f[_0x11f047](util[_0x3a4e('0x1d')]('trunk:%s',_0x365807[_0x3b90f2][_0x20129b][_0x3a4e('0x3')]));break;case 0x9:if(_0x1ab7c5['role']!==_0x3a4e('0x7'))_0x45421f[_0x11f047](util[_0x3a4e('0x1d')](_0x3a4e('0x43'),_0x365807[_0x3b90f2][_0x20129b][_0x3a4e('0x1c')],_0x365807[_0x3b90f2][_0x20129b][_0x3a4e('0x3')]));break;case 0xa:_0x45421f[_0x11f047](util['format'](_0x3a4e('0x20'),_0x365807[_0x3b90f2][_0x20129b][_0x3a4e('0x3')]));break;}}}}})['then'](function(){if(_0x11f047===_0x3a4e('0x44')){var _0x586f35=_[_0x3a4e('0x19')](_0x1ab7c5[_0x3a4e('0x45')],'id');return _0x1ab7c5['removeChatInteractions'](_0x586f35)['then'](function(){for(var _0x1935e8=0x0;_0x1935e8<_0x586f35['length'];_0x1935e8+=0x1){_0x26df6f[_0x3a4e('0x46')](_0x3a4e('0x47'),{'ChatInteractionId':Number(_0x586f35[_0x1935e8]),'UserId':Number(_0x1ab7c5['id'])});}});}})[_0x3a4e('0xb')](function(){if(_0x11f047==='leave'){var _0x528196=_[_0x3a4e('0x19')](_0x1ab7c5[_0x3a4e('0x24')],'id');return _0x1ab7c5[_0x3a4e('0x48')](_0x528196)[_0x3a4e('0xb')](function(){for(var _0x479b5d=0x0;_0x479b5d<_0x528196[_0x3a4e('0x1f')];_0x479b5d+=0x1){_0x26df6f[_0x3a4e('0x46')](_0x3a4e('0x49'),{'MailInteractionId':Number(_0x528196[_0x479b5d]),'UserId':Number(_0x1ab7c5['id'])});}});}})[_0x3a4e('0xb')](function(){if(_0x11f047==='leave'){var _0x267c86=_[_0x3a4e('0x19')](_0x1ab7c5['FaxInteractions'],'id');return _0x1ab7c5[_0x3a4e('0x4a')](_0x267c86)[_0x3a4e('0xb')](function(){for(var _0x2581a7=0x0;_0x2581a7<_0x267c86['length'];_0x2581a7+=0x1){_0x26df6f[_0x3a4e('0x46')](_0x3a4e('0x4b'),{'FaxInteractionId':Number(_0x267c86[_0x2581a7]),'UserId':Number(_0x1ab7c5['id'])});}});}})[_0x3a4e('0xb')](function(){if(_0x11f047==='leave'){var _0x220a62=_['map'](_0x1ab7c5[_0x3a4e('0x4c')],'id');return _0x1ab7c5[_0x3a4e('0x4d')](_0x220a62)[_0x3a4e('0xb')](function(){for(var _0x23bfed=0x0;_0x23bfed<_0x220a62[_0x3a4e('0x1f')];_0x23bfed+=0x1){_0x26df6f[_0x3a4e('0x46')](_0x3a4e('0x4e'),{'SmsInteractionId':Number(_0x220a62[_0x23bfed]),'UserId':Number(_0x1ab7c5['id'])});}});}})[_0x3a4e('0xb')](function(){if(_0x11f047===_0x3a4e('0x44')){var _0x534353=_[_0x3a4e('0x19')](_0x1ab7c5[_0x3a4e('0x28')],'id');return _0x1ab7c5[_0x3a4e('0x4f')](_0x534353)[_0x3a4e('0xb')](function(){for(var _0x31234e=0x0;_0x31234e<_0x534353[_0x3a4e('0x1f')];_0x31234e+=0x1){_0x26df6f[_0x3a4e('0x46')](_0x3a4e('0x50'),{'OpenchannelInteractionId':Number(_0x534353[_0x31234e]),'UserId':Number(_0x1ab7c5['id'])});}});}})[_0x3a4e('0xb')](function(){if(_0x11f047===_0x3a4e('0x44')){var _0x12bfdb=_[_0x3a4e('0x19')](_0x1ab7c5[_0x3a4e('0x29')],'id');return _0x1ab7c5[_0x3a4e('0x51')](_0x12bfdb)['then'](function(){for(var _0xf75b8c=0x0;_0xf75b8c<_0x12bfdb['length'];_0xf75b8c+=0x1){_0x26df6f['emit'](_0x3a4e('0x52'),{'WhatsappInteractionId':Number(_0x12bfdb[_0xf75b8c]),'UserId':Number(_0x1ab7c5['id'])});}});}})[_0x3a4e('0x53')](function(_0x14f89b){_0x45421f[_0x3a4e('0x54')](_0x14f89b);});}}function onDisconnect(_0x810e18,_0x1fdacd){joinOrLeave(_0x810e18,_0x3a4e('0x44'),_0x1fdacd);}function onConnect(_0x6445a9){joinOrLeave(_0x6445a9,_0x3a4e('0x55'));}exports['default']=function(_0x507479){_0x507479['on'](_0x3a4e('0x56'),function(_0x36e5d1){_0x36e5d1[_0x3a4e('0x57')](0x0);_0x36e5d1[_0x3a4e('0x58')]=_0x36e5d1[_0x3a4e('0x59')][_0x3a4e('0x56')]['remoteAddress']+':'+_0x36e5d1['request'][_0x3a4e('0x56')]['remotePort'];_0x36e5d1[_0x3a4e('0x5a')]=new Date();_0x36e5d1[_0x3a4e('0x54')]=function(_0x4290a1){console[_0x3a4e('0x54')](_0x3a4e('0x5b')+_0x36e5d1[_0x3a4e('0x5c')][_0x3a4e('0x3')]+'['+_0x36e5d1[_0x3a4e('0x58')]+']',_0x4290a1);};_0x36e5d1['on'](_0x3a4e('0x5d'),function(){onDisconnect(_0x36e5d1,_0x507479);_0x36e5d1[_0x3a4e('0x54')](_0x3a4e('0x5e'));});onConnect(_0x36e5d1);_0x36e5d1[_0x3a4e('0x54')](_0x3a4e('0x5f'));});}; \ No newline at end of file +var _0xc401=['VoiceQueue','ChatQueue','push','FaxQueue','SmsQueue','user','MailQueue','OpenchannelQueue','WhatsappQueue','IvrCampaigns','getVoiceQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','chat','fax','sms','mail','openchannel','whatsapp','trunk:%s','removeChatInteractions','user_has_chat_interactions:remove','leave','emit','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','join','setMaxListeners','connection','remoteAddress','request','remotePort','log','SocketIO\x20','nsp','address','disconnect','DISCONNECTED','CONNECTED','util','bluebird','../mysqldb','./environment','name','Agents','User','role','telephone','agent','ivr','UserProfileSection','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','Telephones','findAll','Trunks','resourceId','map','where','Campaign','type','format','%s:queue:%s','length','user:%s','query','userProfileId','handshake','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','include'];(function(_0x1b4b23,_0x5dd6d6){var _0x2a325b=function(_0x175462){while(--_0x175462){_0x1b4b23['push'](_0x1b4b23['shift']());}};_0x2a325b(++_0x5dd6d6);}(_0xc401,0x15d));var _0x1c40=function(_0x1f789c,_0x4defdd){_0x1f789c=_0x1f789c-0x0;var _0x1a7ebf=_0xc401[_0x1f789c];return _0x1a7ebf;};'use strict';var _=require('lodash');var util=require(_0x1c40('0x0'));var BPromise=require(_0x1c40('0x1'));var db=require(_0x1c40('0x2'))['db'];var config=require(_0x1c40('0x3'));var queryQueues={'attributes':['id',_0x1c40('0x4')],'include':[{'as':_0x1c40('0x5'),'model':db[_0x1c40('0x6')],'attributes':['id',_0x1c40('0x4'),_0x1c40('0x7')],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x1c40('0x4')],'where':{'role':_0x1c40('0x8')}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0x1c40('0x9')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x1c40('0x4'),'type'],'where':{'type':_0x1c40('0xa')}};function getAssociatedResources(_0x3b82af,_0x5bdd3f,_0x1b2d27){return db[_0x1c40('0xb')]['findOne']({'where':{'name':_0x3b82af,'userProfileId':_0x5bdd3f},'raw':!![]})[_0x1c40('0xc')](function(_0x516f60){if(_0x516f60){if(_0x516f60[_0x1c40('0xd')]){switch(_0x3b82af){case _0x1c40('0xe'):case _0x1c40('0xf'):case _0x1c40('0x10'):case _0x1c40('0x11'):case _0x1c40('0x12'):case _0x1c40('0x13'):case _0x1c40('0x14'):return db[_0x1b2d27]['findAll'](queryQueues);case _0x1c40('0x15'):return db[_0x1b2d27][_0x1c40('0x16')](queryTelephones);case _0x1c40('0x17'):return db[_0x1b2d27][_0x1c40('0x16')](queryTrunks);case'IvrCampaigns':return db[_0x1b2d27][_0x1c40('0x16')](queryCampaigns);}}else{return db['UserProfileResource']['findAll']({'attributes':[_0x1c40('0x18')],'where':{'sectionId':_0x516f60['id']},'raw':!![]})[_0x1c40('0xc')](function(_0x4a3efa){if(_0x4a3efa){var _0x3b5209={'where':{'id':_[_0x1c40('0x19')](_0x4a3efa,_0x1c40('0x18'))},'raw':!![]};switch(_0x1b2d27){case _0x1c40('0x6'):_0x3b5209[_0x1c40('0x1a')]['role']=_0x1c40('0x8');break;case _0x1c40('0x1b'):_0x3b5209[_0x1c40('0x1a')][_0x1c40('0x1c')]=_0x1c40('0xa');break;}return db[_0x1b2d27]['findAll'](_0x3b5209);}else{return[];}});}}else{return[];}})[_0x1c40('0xc')](function(_0x5c8d4b){return _0x5c8d4b;});}function joinOrLeaveQueues(_0x4cd09f,_0x206453,_0x56ba0b,_0x3f314d){_0x4cd09f[_0x206453](util[_0x1c40('0x1d')](_0x1c40('0x1e'),_0x56ba0b,_0x3f314d[_0x1c40('0x4')]));if(_0x3f314d['Agents']){for(var _0x105e9c=0x0;_0x105e9c<_0x3f314d[_0x1c40('0x5')][_0x1c40('0x1f')];_0x105e9c+=0x1){_0x4cd09f[_0x206453](util[_0x1c40('0x1d')](_0x1c40('0x20'),_0x3f314d[_0x1c40('0x5')][_0x105e9c][_0x1c40('0x4')]));}}}function joinOrLeave(_0x333668,_0x41d29f,_0x154859){var _0x5058f5;if(_0x333668['handshake'][_0x1c40('0x21')]['id']){db[_0x1c40('0x6')]['find']({'attributes':['id','name',_0x1c40('0x7'),_0x1c40('0x22')],'where':{'id':_0x333668[_0x1c40('0x23')][_0x1c40('0x21')]['id']},'include':[{'model':db[_0x1c40('0x24')],'as':_0x1c40('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x1c40('0x26')],'as':_0x1c40('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x1c40('0x28')],'as':_0x1c40('0x29'),'attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':_0x1c40('0x2a'),'attributes':['id'],'raw':!![]},{'model':db[_0x1c40('0x2b')],'as':_0x1c40('0x2c'),'attributes':['id'],'raw':!![]},{'model':db[_0x1c40('0x2d')],'as':_0x1c40('0x2e'),'attributes':['id'],'raw':!![]}]})[_0x1c40('0xc')](function(_0x40facf){if(_0x40facf){_0x5058f5=_0x40facf;_0x333668[_0x41d29f](util[_0x1c40('0x1d')]('user:%s',_0x40facf[_0x1c40('0x4')]));var _0xe8bff9=[];switch(_0x40facf[_0x1c40('0x7')]){case _0x1c40('0x2f'):_0x333668[_0x41d29f](_0x1c40('0x30'));_0x333668[_0x41d29f](_0x1c40('0x31'));if(queryQueues['hasOwnProperty']('include')){delete queryQueues[_0x1c40('0x32')];}_0xe8bff9['push'](db[_0x1c40('0x33')][_0x1c40('0x16')](queryQueues));_0xe8bff9['push'](db[_0x1c40('0x34')][_0x1c40('0x16')](queryQueues));_0xe8bff9[_0x1c40('0x35')](db[_0x1c40('0x36')][_0x1c40('0x16')](queryQueues));_0xe8bff9[_0x1c40('0x35')](db[_0x1c40('0x37')][_0x1c40('0x16')](queryQueues));_0xe8bff9[_0x1c40('0x35')](db['MailQueue'][_0x1c40('0x16')](queryQueues));_0xe8bff9[_0x1c40('0x35')](db['OpenchannelQueue'][_0x1c40('0x16')](queryQueues));_0xe8bff9[_0x1c40('0x35')](db['WhatsappQueue']['findAll'](queryQueues));_0xe8bff9[_0x1c40('0x35')](db[_0x1c40('0x6')][_0x1c40('0x16')](queryTelephones));_0xe8bff9[_0x1c40('0x35')](db['Trunk'][_0x1c40('0x16')](queryTrunks));_0xe8bff9[_0x1c40('0x35')](db[_0x1c40('0x1b')][_0x1c40('0x16')](queryCampaigns));_0xe8bff9[_0x1c40('0x35')](db['User'][_0x1c40('0x16')](queryAgents));break;case _0x1c40('0x38'):_0x333668[_0x41d29f](_0x1c40('0x30'));_0x333668[_0x41d29f](_0x1c40('0x31'));_0xe8bff9[_0x1c40('0x35')](getAssociatedResources('VoiceQueues',_0x40facf[_0x1c40('0x22')],_0x1c40('0x33')));_0xe8bff9[_0x1c40('0x35')](getAssociatedResources(_0x1c40('0xf'),_0x40facf[_0x1c40('0x22')],_0x1c40('0x34')));_0xe8bff9[_0x1c40('0x35')](getAssociatedResources(_0x1c40('0x10'),_0x40facf[_0x1c40('0x22')],_0x1c40('0x36')));_0xe8bff9[_0x1c40('0x35')](getAssociatedResources(_0x1c40('0x11'),_0x40facf[_0x1c40('0x22')],_0x1c40('0x37')));_0xe8bff9[_0x1c40('0x35')](getAssociatedResources(_0x1c40('0x12'),_0x40facf[_0x1c40('0x22')],_0x1c40('0x39')));_0xe8bff9['push'](getAssociatedResources(_0x1c40('0x13'),_0x40facf[_0x1c40('0x22')],_0x1c40('0x3a')));_0xe8bff9['push'](getAssociatedResources('WhatsappQueues',_0x40facf[_0x1c40('0x22')],_0x1c40('0x3b')));_0xe8bff9['push'](getAssociatedResources('Telephones',_0x40facf[_0x1c40('0x22')],_0x1c40('0x6')));_0xe8bff9[_0x1c40('0x35')](getAssociatedResources(_0x1c40('0x17'),_0x40facf['userProfileId'],'Trunk'));_0xe8bff9[_0x1c40('0x35')](getAssociatedResources(_0x1c40('0x3c'),_0x40facf['userProfileId'],_0x1c40('0x1b')));_0xe8bff9['push'](db[_0x1c40('0x6')][_0x1c40('0x16')](queryAgents));break;case _0x1c40('0x9'):_0x333668[_0x41d29f](_0x1c40('0x30'));_0x333668[_0x41d29f](_0x1c40('0x31'));_0xe8bff9['push'](_0x40facf[_0x1c40('0x3d')]({'attributes':['id',_0x1c40('0x4')]}));_0xe8bff9[_0x1c40('0x35')](_0x40facf['getChatQueues']({'attributes':['id','name']}));_0xe8bff9[_0x1c40('0x35')](_0x40facf[_0x1c40('0x3e')]({'attributes':['id',_0x1c40('0x4')]}));_0xe8bff9[_0x1c40('0x35')](_0x40facf[_0x1c40('0x3f')]({'attributes':['id',_0x1c40('0x4')]}));_0xe8bff9[_0x1c40('0x35')](_0x40facf[_0x1c40('0x40')]({'attributes':['id','name']}));_0xe8bff9[_0x1c40('0x35')](_0x40facf[_0x1c40('0x41')]({'attributes':['id',_0x1c40('0x4')]}));_0xe8bff9['push'](_0x40facf[_0x1c40('0x42')]({'attributes':['id','name']}));break;}return BPromise[_0x1c40('0x43')](_0xe8bff9);}})[_0x1c40('0xc')](function(_0x110dc1){if(_0x110dc1&&_0x110dc1['length']){for(var _0x9c82e3=0x0;_0x9c82e3<_0x110dc1[_0x1c40('0x1f')];_0x9c82e3+=0x1){for(var _0x44ad74=0x0;_0x44ad74<_0x110dc1[_0x9c82e3][_0x1c40('0x1f')];_0x44ad74+=0x1){switch(_0x9c82e3){case 0x0:joinOrLeaveQueues(_0x333668,_0x41d29f,_0x1c40('0x44'),_0x110dc1[_0x9c82e3][_0x44ad74]);break;case 0x1:joinOrLeaveQueues(_0x333668,_0x41d29f,_0x1c40('0x45'),_0x110dc1[_0x9c82e3][_0x44ad74]);break;case 0x2:joinOrLeaveQueues(_0x333668,_0x41d29f,_0x1c40('0x46'),_0x110dc1[_0x9c82e3][_0x44ad74]);break;case 0x3:joinOrLeaveQueues(_0x333668,_0x41d29f,_0x1c40('0x47'),_0x110dc1[_0x9c82e3][_0x44ad74]);break;case 0x4:joinOrLeaveQueues(_0x333668,_0x41d29f,_0x1c40('0x48'),_0x110dc1[_0x9c82e3][_0x44ad74]);break;case 0x5:joinOrLeaveQueues(_0x333668,_0x41d29f,_0x1c40('0x49'),_0x110dc1[_0x9c82e3][_0x44ad74]);break;case 0x6:joinOrLeaveQueues(_0x333668,_0x41d29f,_0x1c40('0x4a'),_0x110dc1[_0x9c82e3][_0x44ad74]);break;case 0x7:if(_0x5058f5[_0x1c40('0x7')]!=='agent')_0x333668[_0x41d29f](util['format']('telephone:%s',_0x110dc1[_0x9c82e3][_0x44ad74]['name']));break;case 0x8:if(_0x5058f5[_0x1c40('0x7')]!==_0x1c40('0x9'))_0x333668[_0x41d29f](util['format'](_0x1c40('0x4b'),_0x110dc1[_0x9c82e3][_0x44ad74][_0x1c40('0x4')]));break;case 0x9:if(_0x5058f5[_0x1c40('0x7')]!==_0x1c40('0x9'))_0x333668[_0x41d29f](util[_0x1c40('0x1d')]('campaign:%s:%s',_0x110dc1[_0x9c82e3][_0x44ad74][_0x1c40('0x1c')],_0x110dc1[_0x9c82e3][_0x44ad74][_0x1c40('0x4')]));break;case 0xa:_0x333668[_0x41d29f](util[_0x1c40('0x1d')](_0x1c40('0x20'),_0x110dc1[_0x9c82e3][_0x44ad74]['name']));break;}}}}})[_0x1c40('0xc')](function(){if(_0x41d29f==='leave'){var _0x42d885=_[_0x1c40('0x19')](_0x5058f5[_0x1c40('0x25')],'id');return _0x5058f5[_0x1c40('0x4c')](_0x42d885)[_0x1c40('0xc')](function(){for(var _0x10cfbb=0x0;_0x10cfbb<_0x42d885[_0x1c40('0x1f')];_0x10cfbb+=0x1){_0x154859['emit'](_0x1c40('0x4d'),{'ChatInteractionId':Number(_0x42d885[_0x10cfbb]),'UserId':Number(_0x5058f5['id'])});}});}})[_0x1c40('0xc')](function(){if(_0x41d29f==='leave'){var _0x1ed296=_[_0x1c40('0x19')](_0x5058f5[_0x1c40('0x27')],'id');return _0x5058f5['removeMailInteractions'](_0x1ed296)['then'](function(){for(var _0x10e529=0x0;_0x10e529<_0x1ed296[_0x1c40('0x1f')];_0x10e529+=0x1){_0x154859['emit']('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x1ed296[_0x10e529]),'UserId':Number(_0x5058f5['id'])});}});}})[_0x1c40('0xc')](function(){if(_0x41d29f===_0x1c40('0x4e')){var _0x203740=_[_0x1c40('0x19')](_0x5058f5[_0x1c40('0x29')],'id');return _0x5058f5['removeFaxInteractions'](_0x203740)[_0x1c40('0xc')](function(){for(var _0x131d36=0x0;_0x131d36<_0x203740[_0x1c40('0x1f')];_0x131d36+=0x1){_0x154859[_0x1c40('0x4f')](_0x1c40('0x50'),{'FaxInteractionId':Number(_0x203740[_0x131d36]),'UserId':Number(_0x5058f5['id'])});}});}})[_0x1c40('0xc')](function(){if(_0x41d29f===_0x1c40('0x4e')){var _0x41f234=_[_0x1c40('0x19')](_0x5058f5['SmsInteractions'],'id');return _0x5058f5[_0x1c40('0x51')](_0x41f234)[_0x1c40('0xc')](function(){for(var _0x150423=0x0;_0x150423<_0x41f234[_0x1c40('0x1f')];_0x150423+=0x1){_0x154859[_0x1c40('0x4f')](_0x1c40('0x52'),{'SmsInteractionId':Number(_0x41f234[_0x150423]),'UserId':Number(_0x5058f5['id'])});}});}})[_0x1c40('0xc')](function(){if(_0x41d29f===_0x1c40('0x4e')){var _0x289bfe=_['map'](_0x5058f5['OpenchannelInteractions'],'id');return _0x5058f5[_0x1c40('0x53')](_0x289bfe)[_0x1c40('0xc')](function(){for(var _0x4ebfba=0x0;_0x4ebfba<_0x289bfe[_0x1c40('0x1f')];_0x4ebfba+=0x1){_0x154859[_0x1c40('0x4f')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x289bfe[_0x4ebfba]),'UserId':Number(_0x5058f5['id'])});}});}})[_0x1c40('0xc')](function(){if(_0x41d29f===_0x1c40('0x4e')){var _0x943593=_['map'](_0x5058f5[_0x1c40('0x2e')],'id');return _0x5058f5[_0x1c40('0x54')](_0x943593)['then'](function(){for(var _0x59909a=0x0;_0x59909a<_0x943593[_0x1c40('0x1f')];_0x59909a+=0x1){_0x154859[_0x1c40('0x4f')](_0x1c40('0x55'),{'WhatsappInteractionId':Number(_0x943593[_0x59909a]),'UserId':Number(_0x5058f5['id'])});}});}})[_0x1c40('0x56')](function(_0x3e4e7b){_0x333668['log'](_0x3e4e7b);});}}function onDisconnect(_0x11e775,_0x4f8fbd){joinOrLeave(_0x11e775,_0x1c40('0x4e'),_0x4f8fbd);}function onConnect(_0x1942f7){joinOrLeave(_0x1942f7,_0x1c40('0x57'));}exports['default']=function(_0x180442){_0x180442['on']('connection',function(_0x4263cd){_0x4263cd[_0x1c40('0x58')](0x0);_0x4263cd['address']=_0x4263cd['request'][_0x1c40('0x59')][_0x1c40('0x5a')]+':'+_0x4263cd[_0x1c40('0x5b')][_0x1c40('0x59')][_0x1c40('0x5c')];_0x4263cd['connectedAt']=new Date();_0x4263cd[_0x1c40('0x5d')]=function(_0x3ac71d){console[_0x1c40('0x5d')](_0x1c40('0x5e')+_0x4263cd[_0x1c40('0x5f')]['name']+'['+_0x4263cd[_0x1c40('0x60')]+']',_0x3ac71d);};_0x4263cd['on'](_0x1c40('0x61'),function(){onDisconnect(_0x4263cd,_0x180442);_0x4263cd[_0x1c40('0x5d')](_0x1c40('0x62'));});onConnect(_0x4263cd);_0x4263cd[_0x1c40('0x5d')](_0x1c40('0x63'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 2933af3..e0fd0c3 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 _0x6032=['AfterCreate','changed','closed','substatus','AfterUpdate','User','find','name','fullname','email','internal','default','length','hasOwnProperty','model','callback','condition','util','../../mysqldb','jayson/promise','../logger','triggers','client','http','afterCreate','newinteraction','Chat','ChatInteraction','afterUpdate','ChatMessage','newmessage','ChatOfflineMessage','Sms','SmsInteraction','closedinteraction','SmsMessage','Whatsapp','WhatsappInteraction','Fax','FaxInteraction','FaxMessage','MailInteraction','Mail','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','EventManager','info','Trigger,\x20%s','code','error','get','channel','motionChannel','event','direction','then','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','query','Sequelize','QueryTypes','SELECT','contact','UserId','interface','format','SIP/%s','agent','incomingmessage','catch','AfterCreateMessage','resolve'];(function(_0x240292,_0x171ae7){var _0xb27306=function(_0x4638ea){while(--_0x4638ea){_0x240292['push'](_0x240292['shift']());}};_0xb27306(++_0x171ae7);}(_0x6032,0x192));var _0x2603=function(_0x571dbf,_0x6c2de3){_0x571dbf=_0x571dbf-0x0;var _0x197b73=_0x6032[_0x571dbf];return _0x197b73;};'use strict';var util=require(_0x2603('0x0'));var db=require(_0x2603('0x1'))['db'];var jayson=require(_0x2603('0x2'));var logger=require(_0x2603('0x3'))(_0x2603('0x4'));var client=jayson[_0x2603('0x5')][_0x2603('0x6')]({'port':0x232a});var triggers=[{'channel':'Chat','model':'ChatInteraction','event':_0x2603('0x7'),'condition':_0x2603('0x8'),'callback':afterCreate},{'channel':_0x2603('0x9'),'model':_0x2603('0xa'),'event':_0x2603('0xb'),'condition':'closedinteraction','callback':afterUpdate},{'channel':'Chat','model':_0x2603('0xc'),'event':_0x2603('0x7'),'condition':_0x2603('0xd'),'callback':afterCreateMessage},{'channel':_0x2603('0x9'),'model':_0x2603('0xe'),'event':'afterCreate','condition':_0x2603('0xd'),'callback':afterCreateOfflineMessage},{'channel':_0x2603('0xf'),'model':_0x2603('0x10'),'event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':_0x2603('0xf'),'model':_0x2603('0x10'),'event':'afterUpdate','condition':_0x2603('0x11'),'callback':afterUpdate},{'channel':_0x2603('0xf'),'model':_0x2603('0x12'),'event':'afterCreate','condition':_0x2603('0xd'),'callback':afterCreateMessage},{'channel':_0x2603('0x13'),'model':'WhatsappInteraction','event':_0x2603('0x7'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x2603('0x13'),'model':_0x2603('0x14'),'event':_0x2603('0xb'),'condition':_0x2603('0x11'),'callback':afterUpdate},{'channel':'Whatsapp','model':'WhatsappMessage','event':_0x2603('0x7'),'condition':_0x2603('0xd'),'callback':afterCreateMessage},{'channel':_0x2603('0x15'),'model':_0x2603('0x16'),'event':_0x2603('0x7'),'condition':_0x2603('0x8'),'callback':afterCreate},{'channel':'Fax','model':_0x2603('0x16'),'event':_0x2603('0xb'),'condition':'closedinteraction','callback':afterUpdate},{'channel':'Fax','model':_0x2603('0x17'),'event':_0x2603('0x7'),'condition':'newmessage','callback':afterCreateMessage},{'channel':'Mail','model':_0x2603('0x18'),'event':_0x2603('0x7'),'condition':_0x2603('0x8'),'callback':afterCreate},{'channel':_0x2603('0x19'),'model':_0x2603('0x18'),'event':'afterUpdate','condition':_0x2603('0x11'),'callback':afterUpdate},{'channel':_0x2603('0x19'),'model':_0x2603('0x1a'),'event':_0x2603('0x7'),'condition':_0x2603('0xd'),'callback':afterCreateMessage},{'channel':_0x2603('0x1b'),'model':_0x2603('0x1c'),'event':_0x2603('0x7'),'condition':_0x2603('0x8'),'callback':afterCreate},{'channel':_0x2603('0x1b'),'model':'OpenchannelInteraction','event':_0x2603('0xb'),'condition':_0x2603('0x11'),'callback':afterUpdate},{'channel':_0x2603('0x1b'),'model':_0x2603('0x1d'),'event':_0x2603('0x7'),'condition':_0x2603('0xd'),'callback':afterCreateMessage}];function request(_0x526d9e){return client[_0x2603('0x1e')](_0x2603('0x1f'),_0x526d9e)['then'](function(_0x1e57bf){logger[_0x2603('0x20')](_0x2603('0x21'),_0x2603('0x1f'),_0x1e57bf);if(_0x1e57bf['error']){if(_0x1e57bf['error'][_0x2603('0x22')]===0x1f4){logger[_0x2603('0x23')]('Trigger,\x20%s',_0x2603('0x1f'),_0x1e57bf[_0x2603('0x23')]);}}})['catch'](function(_0x24b56f){logger['error'](_0x2603('0x21'),'EventManager',_0x24b56f);});}function afterCreateMessage(_0x2cfd9a){return function(_0x4f8546){_0x4f8546=_0x4f8546[_0x2603('0x24')]({'plain':!![]});_0x4f8546[_0x2603('0x25')]=_0x2cfd9a;_0x4f8546[_0x2603('0x26')]=_0x2cfd9a;_0x4f8546[_0x2603('0x27')]=_0x4f8546[_0x2603('0x28')];Promise['resolve']()[_0x2603('0x29')](function(){if(typeof _0x4f8546['ContactId']===_0x2603('0x2a'))return null;var _0x194019=_0x2603('0x2b')+_0x4f8546[_0x2603('0x2c')];return db[_0x2603('0x2d')][_0x2603('0x2e')](_0x194019,{'type':db[_0x2603('0x2f')][_0x2603('0x30')][_0x2603('0x31')],'raw':!![]});})['then'](function(_0x5574d1){if(_0x5574d1){_0x4f8546[_0x2603('0x32')]=_0x5574d1[0x0];}if(typeof _0x4f8546[_0x2603('0x33')]===_0x2603('0x2a'))return;return getAgent(_0x4f8546[_0x2603('0x33')]);})['then'](function(_0x4b1725){if(_0x4b1725){_0x4f8546[_0x2603('0x34')]=util[_0x2603('0x35')](_0x2603('0x36'),_0x4b1725['name']);_0x4f8546[_0x2603('0x37')]=_0x4b1725;_0x4f8546[_0x2603('0x25')]=_0x2cfd9a;return request({'event':_0x2603('0x38'),'message':_0x4f8546});}else{return request({'event':'outgoingmessage','message':_0x4f8546});}})[_0x2603('0x39')](function(_0x13d7ac){logger[_0x2603('0x23')](_0x2603('0x21'),_0x2603('0x3a'),_0x13d7ac);});};}function afterCreateOfflineMessage(_0x19b348){return function(_0x42cc71){_0x42cc71=_0x42cc71[_0x2603('0x24')]({'plain':!![]});_0x42cc71['channel']=_0x19b348;_0x42cc71[_0x2603('0x26')]=_0x19b348;_0x42cc71['event']='offlineMessage';return request({'event':_0x42cc71[_0x2603('0x27')],'message':_0x42cc71});};}function afterCreate(_0x3820cb,_0x201c02){return function(_0x4d89af){_0x4d89af=_0x4d89af['get']({'plain':!![]});_0x4d89af['channel']=_0x3820cb;_0x4d89af['motionChannel']=_0x3820cb;_0x4d89af[_0x2603('0x27')]='opened';Promise[_0x2603('0x3b')]()['then'](function(){var _0x1c8c42=_0x2603('0x2b')+_0x4d89af['ContactId'];return db[_0x2603('0x2d')][_0x2603('0x2e')](_0x1c8c42,{'type':db[_0x2603('0x2f')][_0x2603('0x30')]['SELECT'],'raw':!![]});})[_0x2603('0x29')](function(_0x1c5531){if(_0x1c5531){_0x4d89af[_0x2603('0x32')]=_0x1c5531[0x0];}if(typeof _0x4d89af[_0x2603('0x33')]===_0x2603('0x2a'))return;return getAgent(_0x4d89af[_0x2603('0x33')]);})[_0x2603('0x29')](function(_0x26be9e){if(_0x26be9e){_0x4d89af['interface']=util[_0x2603('0x35')]('SIP/%s',_0x26be9e['name']);_0x4d89af[_0x2603('0x37')]=_0x26be9e;}return request({'event':_0x201c02,'message':_0x4d89af});})[_0x2603('0x39')](function(_0x3701a3){logger['error']('Trigger,\x20%s',_0x2603('0x3c'),_0x3701a3);});};}function afterUpdate(_0x3f31da){return function(_0x14fa85){var _0xbafe34=_0x14fa85[_0x2603('0x3d')](_0x2603('0x3e'))&&_0x14fa85[_0x2603('0x3e')];var _0xf6ed0d=_0x14fa85[_0x2603('0x3d')]('substatus');if(_0xbafe34||_0xf6ed0d){var _0x211df1=_0xbafe34?_0x2603('0x11'):_0x2603('0x3f');var _0x311164=_0x14fa85[_0x2603('0x24')]({'plain':!![]});_0x311164['channel']=_0x3f31da;_0x311164[_0x2603('0x26')]=_0x3f31da;_0x311164[_0x2603('0x27')]=_0xbafe34?_0x2603('0x3e'):'substatus';var _0x5c8840=_0x2603('0x2b')+_0x311164[_0x2603('0x2c')];return db[_0x2603('0x2d')][_0x2603('0x2e')](_0x5c8840,{'type':db[_0x2603('0x2f')][_0x2603('0x30')][_0x2603('0x31')],'raw':!![]})[_0x2603('0x29')](function(_0x88f01c){if(_0x88f01c){_0x311164[_0x2603('0x32')]=_0x88f01c[0x0];}if(typeof _0x311164[_0x2603('0x33')]==='undefined')return;return getAgent(_0x311164[_0x2603('0x33')]);})[_0x2603('0x29')](function(_0x257532){if(_0x257532){_0x311164[_0x2603('0x34')]=util[_0x2603('0x35')](_0x2603('0x36'),_0x257532['name']);_0x311164[_0x2603('0x37')]=_0x257532;}return request({'event':_0x211df1,'message':_0x311164});})['catch'](function(_0x34e2c9){logger['error'](_0x2603('0x21'),_0x2603('0x40'),_0x34e2c9);});}};}function getAgent(_0x2d6a88){return db[_0x2603('0x41')][_0x2603('0x42')]({'where':{'id':_0x2d6a88},'attributes':['id',_0x2603('0x43'),_0x2603('0x44'),_0x2603('0x45'),_0x2603('0x46')],'raw':!![]})[_0x2603('0x29')](function(_0x5afdef){return _0x5afdef;});}exports[_0x2603('0x47')]=function(){for(var _0xf05c8e=0x0;_0xf05c8e=_0x2fd228[_0x8412('0x12')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x269e03(_0x36c727);})[_0x8412('0x13')](function(_0x4c39c2){_0x314a25(_0x4c39c2);});});}; \ No newline at end of file +var _0x5fd4=['voice','mail','fax','sms','whatsapp','openchannel','getChannels','toLowerCase','includes','clearBlockUser','isUndefined','blockedAt','updateAttributes','getLicense','role','agent','User','count','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','bluebird','../mysqldb','./license/util'];(function(_0x3135d0,_0x4289b8){var _0xb3f367=function(_0x45d92d){while(--_0x45d92d){_0x3135d0['push'](_0x3135d0['shift']());}};_0xb3f367(++_0x4289b8);}(_0x5fd4,0x7e));var _0x45fd=function(_0x473426,_0x573a48){_0x473426=_0x473426-0x0;var _0x3c9a44=_0x5fd4[_0x473426];return _0x3c9a44;};'use strict';var _=require(_0x45fd('0x0'));var BPromise=require(_0x45fd('0x1'));var db=require(_0x45fd('0x2'))['db'];var util=require(_0x45fd('0x3'));var channels=[_0x45fd('0x4'),_0x45fd('0x5'),'chat',_0x45fd('0x6'),_0x45fd('0x7'),_0x45fd('0x8'),_0x45fd('0x9')];exports[_0x45fd('0xa')]=function(){return channels;};exports['isValidChannel']=function(_0x144d6e){_0x144d6e=_0x144d6e[_0x45fd('0xb')]();return _[_0x45fd('0xc')](channels,_0x144d6e);};exports[_0x45fd('0xd')]=function(_0x51c0a9,_0x4bf761,_0x57b50a,_0x31b84d){var _0x5db378={'loginAttempts':_0x4bf761,'blocked':_0x57b50a};if(!_[_0x45fd('0xe')](_0x31b84d)){_0x5db378[_0x45fd('0xf')]=_0x31b84d;}return _0x51c0a9[_0x45fd('0x10')](_0x5db378);};exports[_0x45fd('0x11')]=function(_0xcd6ac5){return new BPromise(function(_0x11f173,_0x1ada04){var _0x1a79d3=0x0;if(_0xcd6ac5[_0x45fd('0x12')]!==_0x45fd('0x13')){_0x11f173(_0xcd6ac5);}db[_0x45fd('0x14')][_0x45fd('0x15')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0xcd6ac5['id']}}})['then'](function(_0x18e050){_0x1a79d3=_0x18e050;return util[_0x45fd('0x11')]();})[_0x45fd('0x16')](function(_0x2a8e47){if(_0x2a8e47&&_0x2a8e47[_0x45fd('0x17')]&&_0x1a79d3>=_0x2a8e47[_0x45fd('0x17')]){throw Error(_0x45fd('0x18'));}_0x11f173(_0xcd6ac5);})[_0x45fd('0x19')](function(_0x56f7db){_0x1ada04(_0x56f7db);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index 48f4250..d30c8b8 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf109=['status','exports','util','../config/logger','api','Internal\x20Server\x20Error','name','Error','inherits','message','Bad\x20Request','Entity\x20not\x20found','Not\x20Found','Forbidden','OutOfInterval','error','stack'];(function(_0xa388a2,_0x40bde6){var _0x7ce7f6=function(_0x5a242a){while(--_0x5a242a){_0xa388a2['push'](_0xa388a2['shift']());}};_0x7ce7f6(++_0x40bde6);}(_0xf109,0xce));var _0x9f10=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0xf109[_0x4ae6ef];return _0x3cbb4e;};'use strict';var util=require(_0x9f10('0x0'));var logger=require(_0x9f10('0x1'))(_0x9f10('0x2'));var APIError=function(_0x5d2950,_0x5b381d){this['message']=_0x5d2950||_0x9f10('0x3');this[_0x9f10('0x4')]=_0x5b381d||_0x9f10('0x5');util[_0x9f10('0x6')](APIError,Error);};var APIBadRequestError=function(_0x4027f4){this[_0x9f10('0x7')]=_0x4027f4||_0x9f10('0x8');this[_0x9f10('0x4')]=_0x9f10('0x8');util[_0x9f10('0x6')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x3fd82f){this['message']=_0x3fd82f||_0x9f10('0x9');this[_0x9f10('0x4')]=_0x9f10('0xa');util[_0x9f10('0x6')](APINotFoundError,APIError);};function getStatusCode(_0x325f22){switch(_0x325f22){case'Bad\x20Request':return 0x190;case _0x9f10('0xb'),_0x9f10('0xc'):return 0x193;case _0x9f10('0xa'):return 0x194;default:return 0x1f4;}}function handleError(_0x4e577d){return function(_0x50215f){logger[_0x9f10('0xd')](_0x50215f[_0x9f10('0xe')]);var _0x407336=getStatusCode(_0x50215f['name']);if(_0x50215f[_0x9f10('0x4')])delete _0x50215f[_0x9f10('0x4')];return _0x4e577d[_0x9f10('0xf')](_0x407336)['send'](_0x50215f);};}module[_0x9f10('0x10')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file +var _0xb43b=['error','status','util','../config/logger','message','name','Error','inherits','Entity\x20not\x20found','Forbidden','OutOfInterval','Not\x20Found'];(function(_0x22331f,_0xa28899){var _0x4a40e3=function(_0x2bb43b){while(--_0x2bb43b){_0x22331f['push'](_0x22331f['shift']());}};_0x4a40e3(++_0xa28899);}(_0xb43b,0x1b2));var _0xbb43=function(_0x5c7877,_0x2250d9){_0x5c7877=_0x5c7877-0x0;var _0x244250=_0xb43b[_0x5c7877];return _0x244250;};'use strict';var util=require(_0xbb43('0x0'));var logger=require(_0xbb43('0x1'))('api');var APIError=function(_0x1bdcfc,_0x1995f8){this[_0xbb43('0x2')]=_0x1bdcfc||'Internal\x20Server\x20Error';this[_0xbb43('0x3')]=_0x1995f8||_0xbb43('0x4');util[_0xbb43('0x5')](APIError,Error);};var APIBadRequestError=function(_0x16432a){this['message']=_0x16432a||'Bad\x20Request';this[_0xbb43('0x3')]='Bad\x20Request';util[_0xbb43('0x5')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x1ccd49){this[_0xbb43('0x2')]=_0x1ccd49||_0xbb43('0x6');this[_0xbb43('0x3')]='Not\x20Found';util[_0xbb43('0x5')](APINotFoundError,APIError);};function getStatusCode(_0xf54ac5){switch(_0xf54ac5){case'Bad\x20Request':return 0x190;case _0xbb43('0x7'),_0xbb43('0x8'):return 0x193;case _0xbb43('0x9'):return 0x194;default:return 0x1f4;}}function handleError(_0x5e3611){return function(_0xfac791){logger[_0xbb43('0xa')](_0xfac791['stack']);var _0x36a473=getStatusCode(_0xfac791[_0xbb43('0x3')]);if(_0xfac791['name'])delete _0xfac791['name'];return _0x5e3611[_0xbb43('0xb')](_0x36a473)['send'](_0xfac791);};}module['exports']={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 38c596c..94e9ca1 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0c53=['send','exports','404','status','render','json'];(function(_0x49c68e,_0x1c1673){var _0x33032b=function(_0x42ac31){while(--_0x42ac31){_0x49c68e['push'](_0x49c68e['shift']());}};_0x33032b(++_0x1c1673);}(_0x0c53,0x1e1));var _0x30c5=function(_0x635044,_0x2dddde){_0x635044=_0x635044-0x0;var _0x25c98d=_0x0c53[_0x635044];return _0x25c98d;};'use strict';module[_0x30c5('0x0')][0x194]=function pageNotFound(_0x3799ea,_0x54e492){var _0xdb284c=_0x30c5('0x1');var _0x305580=0x194;var _0x1423d0={'status':_0x305580};_0x54e492[_0x30c5('0x2')](_0x1423d0['status']);_0x54e492[_0x30c5('0x3')](_0xdb284c,{},function(_0x12e881,_0x2bc3fa){if(_0x12e881){return _0x54e492['status'](_0x1423d0[_0x30c5('0x2')])[_0x30c5('0x4')](_0x1423d0);}_0x54e492[_0x30c5('0x5')](_0x2bc3fa);});}; \ No newline at end of file +var _0xf8db=['status','render','json','send','exports','404'];(function(_0x1a5742,_0x11d5a2){var _0x1c4058=function(_0x4c4191){while(--_0x4c4191){_0x1a5742['push'](_0x1a5742['shift']());}};_0x1c4058(++_0x11d5a2);}(_0xf8db,0x106));var _0xbf8d=function(_0x24609e,_0xb54b5f){_0x24609e=_0x24609e-0x0;var _0x458471=_0xf8db[_0x24609e];return _0x458471;};'use strict';module[_0xbf8d('0x0')][0x194]=function pageNotFound(_0x22071f,_0x48252e){var _0xee2ae3=_0xbf8d('0x1');var _0x41cc75=0x194;var _0x4b2275={'status':_0x41cc75};_0x48252e[_0xbf8d('0x2')](_0x4b2275[_0xbf8d('0x2')]);_0x48252e[_0xbf8d('0x3')](_0xee2ae3,{},function(_0xb15dbc,_0x27b5dd){if(_0xb15dbc){return _0x48252e[_0xbf8d('0x2')](_0x4b2275['status'])[_0xbf8d('0x4')](_0x4b2275);}_0x48252e[_0xbf8d('0x5')](_0x27b5dd);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 70b1ac1..2804a51 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(_0x2338fa,_0x80579a){var _0x42df9b=function(_0x13fe56){while(--_0x13fe56){_0x2338fa['push'](_0x2338fa['shift']());}};_0x42df9b(++_0x80579a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'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(_0x25fc41,_0x250864){var _0x1371d1=function(_0x8ab2e3){while(--_0x8ab2e3){_0x25fc41['push'](_0x25fc41['shift']());}};_0x1371d1(++_0x250864);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xa9e0[_0x5037ab];return _0x512adb;};'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 207a98e..0e1a724 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd3ed=['/api/integrations/zendesk/fields','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','./api/intFreshdeskField','./api/intVtigerAccount','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','/api/square/details/reports','./api/squareReportDetail','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','./api/chatTransferReport','/api/fax/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','./api/whatsappMessage','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','/api/auth/local','./api/authLocal','./api/authGoogle','./api/authActiveDirectory','./api/jira','/api/rpc','/api/version','./api/version','/api/system','./api/system','./api/pm2','/api/webbar','./api/webbar','/api/logs','/apidoc','join','root','/www','static','/demo','/snippet','snippet','3.1.0','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','/index.html','path','express','./config/environment','setupLoggers','./api/client-side-logs','use','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','/api/voice/extensions','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','/api/trunks','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','./api/faxApplication','./api/faxMessage','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','/api/sms/messages','/api/sms/queues','./api/smsQueue','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_history','/api/cm/custom_fields','./api/cmCustomField','/api/actions','/api/automations','/api/canned_answers','./api/cannedAnswer','/api/dispositions','/api/conditions','/api/intervals','./api/interval','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations/reports','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','./api/analyticTreeReport','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','/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'];(function(_0x5d0de8,_0x5af6b2){var _0xcdd4f3=function(_0x4d60ec){while(--_0x4d60ec){_0x5d0de8['push'](_0x5d0de8['shift']());}};_0xcdd4f3(++_0x5af6b2);}(_0xd3ed,0x19b));var _0xdd3e=function(_0x30e1e9,_0xf19b5){_0x30e1e9=_0x30e1e9-0x0;var _0x37d1c7=_0xd3ed[_0x30e1e9];return _0x37d1c7;};'use strict';var path=require(_0xdd3e('0x0'));var express=require(_0xdd3e('0x1'));var errors=require('./errors');var config=require(_0xdd3e('0x2'));var setupLoggers=require('./utils/client-side-logger')[_0xdd3e('0x3')];var clientSideLogs=require(_0xdd3e('0x4'));exports['default']=function(_0x46362e){return setupLoggers(_0x46362e)['then'](function(){_0x46362e[_0xdd3e('0x5')](_0xdd3e('0x6'),require(_0xdd3e('0x7')));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0x8'),require(_0xdd3e('0x9')));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0xa'),require('./api/voiceContext'));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0xb'),require('./api/voiceExtension'));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0xc'),require(_0xdd3e('0xd')));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0xe'),require(_0xdd3e('0xf')));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0x10'),require(_0xdd3e('0x11')));_0x46362e['use'](_0xdd3e('0x12'),require(_0xdd3e('0x13')));_0x46362e['use'](_0xdd3e('0x14'),require(_0xdd3e('0x15')));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0x16'),require(_0xdd3e('0x17')));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0x18'),require(_0xdd3e('0x19')));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0x1a'),require(_0xdd3e('0x1b')));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0x1c'),require(_0xdd3e('0x1d')));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0x1e'),require(_0xdd3e('0x1f')));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0x20'),require('./api/memberReport'));_0x46362e['use'](_0xdd3e('0x21'),require('./api/trunk'));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0x22'),require(_0xdd3e('0x23')));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0x24'),require(_0xdd3e('0x25')));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0x26'),require(_0xdd3e('0x27')));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0x28'),require(_0xdd3e('0x29')));_0x46362e[_0xdd3e('0x5')]('/api/mail/substatuses',require('./api/mailSubstatus'));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0x2a'),require(_0xdd3e('0x2b')));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0x2c'),require(_0xdd3e('0x2d')));_0x46362e['use'](_0xdd3e('0x2e'),require(_0xdd3e('0x2f')));_0x46362e['use'](_0xdd3e('0x30'),require(_0xdd3e('0x31')));_0x46362e[_0xdd3e('0x5')]('/api/dashboards',require(_0xdd3e('0x32')));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0x33'),require(_0xdd3e('0x34')));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0x35'),require(_0xdd3e('0x36')));_0x46362e[_0xdd3e('0x5')]('/api/fax/applications',require(_0xdd3e('0x37')));_0x46362e[_0xdd3e('0x5')]('/api/fax/interactions',require('./api/faxInteraction'));_0x46362e[_0xdd3e('0x5')]('/api/fax/messages',require(_0xdd3e('0x38')));_0x46362e[_0xdd3e('0x5')]('/api/fax/queues',require('./api/faxQueue'));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0x39'),require(_0xdd3e('0x3a')));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0x3b'),require(_0xdd3e('0x3c')));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0x3d'),require('./api/smsApplication'));_0x46362e['use']('/api/sms/interactions',require('./api/smsInteraction'));_0x46362e['use'](_0xdd3e('0x3e'),require('./api/smsMessage'));_0x46362e['use'](_0xdd3e('0x3f'),require(_0xdd3e('0x40')));_0x46362e[_0xdd3e('0x5')]('/api/openchannel/accounts',require(_0xdd3e('0x41')));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0x42'),require(_0xdd3e('0x43')));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0x44'),require(_0xdd3e('0x45')));_0x46362e['use'](_0xdd3e('0x46'),require(_0xdd3e('0x47')));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0x48'),require(_0xdd3e('0x49')));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0x4a'),require(_0xdd3e('0x4b')));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0x4c'),require(_0xdd3e('0x4d')));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0x4e'),require('./api/chatApplication'));_0x46362e['use'](_0xdd3e('0x4f'),require(_0xdd3e('0x50')));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0x51'),require(_0xdd3e('0x52')));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0x53'),require(_0xdd3e('0x54')));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0x55'),require(_0xdd3e('0x56')));_0x46362e['use']('/api/chat/groups',require('./api/chatGroup'));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0x57'),require(_0xdd3e('0x58')));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0x59'),require(_0xdd3e('0x5a')));_0x46362e['use']('/api/cm/contacts',require(_0xdd3e('0x5b')));_0x46362e['use'](_0xdd3e('0x5c'),require(_0xdd3e('0x5d')));_0x46362e['use'](_0xdd3e('0x5e'),require(_0xdd3e('0x5f')));_0x46362e[_0xdd3e('0x5')]('/api/cm/hopper_final',require('./api/cmHopperFinal'));_0x46362e['use'](_0xdd3e('0x60'),require('./api/cmHopperHistory'));_0x46362e['use'](_0xdd3e('0x61'),require(_0xdd3e('0x62')));_0x46362e['use'](_0xdd3e('0x63'),require('./api/action'));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0x64'),require('./api/automation'));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0x65'),require(_0xdd3e('0x66')));_0x46362e['use'](_0xdd3e('0x67'),require('./api/disposition'));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0x68'),require('./api/condition'));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0x69'),require(_0xdd3e('0x6a')));_0x46362e['use']('/api/pauses',require('./api/pause'));_0x46362e['use'](_0xdd3e('0x6b'),require(_0xdd3e('0x6c')));_0x46362e['use'](_0xdd3e('0x6d'),require(_0xdd3e('0x6e')));_0x46362e['use'](_0xdd3e('0x6f'),require(_0xdd3e('0x70')));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0x71'),require(_0xdd3e('0x72')));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0x73'),require(_0xdd3e('0x74')));_0x46362e['use'](_0xdd3e('0x75'),require(_0xdd3e('0x76')));_0x46362e['use'](_0xdd3e('0x77'),require(_0xdd3e('0x78')));_0x46362e['use'](_0xdd3e('0x79'),require(_0xdd3e('0x7a')));_0x46362e['use'](_0xdd3e('0x7b'),require('./api/template'));_0x46362e['use'](_0xdd3e('0x7c'),require(_0xdd3e('0x7d')));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0x7e'),require(_0xdd3e('0x7f')));_0x46362e['use']('/api/integrations',require('./api/integration'));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0x80'),require('./api/integrationReport'));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0x81'),require(_0xdd3e('0x82')));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0x83'),require(_0xdd3e('0x84')));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0x85'),require(_0xdd3e('0x86')));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0x87'),require(_0xdd3e('0x88')));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0x89'),require(_0xdd3e('0x8a')));_0x46362e[_0xdd3e('0x5')]('/api/analytics/tree_reports',require(_0xdd3e('0x8b')));_0x46362e[_0xdd3e('0x5')]('/api/integrations/salesforce/accounts',require(_0xdd3e('0x8c')));_0x46362e['use'](_0xdd3e('0x8d'),require(_0xdd3e('0x8e')));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0x8f'),require(_0xdd3e('0x90')));_0x46362e[_0xdd3e('0x5')]('/api/integrations/sugarcrm/accounts',require(_0xdd3e('0x91')));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0x92'),require(_0xdd3e('0x93')));_0x46362e['use'](_0xdd3e('0x94'),require(_0xdd3e('0x95')));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0x96'),require('./api/intDeskAccount'));_0x46362e['use'](_0xdd3e('0x97'),require('./api/intDeskConfiguration'));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0x98'),require(_0xdd3e('0x99')));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0x9a'),require(_0xdd3e('0x9b')));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0x9c'),require(_0xdd3e('0x9d')));_0x46362e['use']('/api/integrations/zoho/fields',require(_0xdd3e('0x9e')));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0x9f'),require(_0xdd3e('0xa0')));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0xa1'),require(_0xdd3e('0xa2')));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0xa3'),require('./api/intZendeskField'));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0xa4'),require(_0xdd3e('0xa5')));_0x46362e['use'](_0xdd3e('0xa6'),require(_0xdd3e('0xa7')));_0x46362e[_0xdd3e('0x5')]('/api/integrations/freshdesk/fields',require(_0xdd3e('0xa8')));_0x46362e['use']('/api/integrations/vtiger/accounts',require(_0xdd3e('0xa9')));_0x46362e[_0xdd3e('0x5')]('/api/integrations/vtiger/configurations',require('./api/intVtigerConfiguration'));_0x46362e[_0xdd3e('0x5')]('/api/integrations/vtiger/fields',require(_0xdd3e('0xaa')));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0xab'),require(_0xdd3e('0xac')));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0xad'),require(_0xdd3e('0xae')));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0xaf'),require(_0xdd3e('0xb0')));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0xb1'),require('./api/intDynamics365Account'));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0xb2'),require(_0xdd3e('0xb3')));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0xb4'),require(_0xdd3e('0xb5')));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0xb6'),require('./api/intFreshsalesAccount'));_0x46362e['use'](_0xdd3e('0xb7'),require(_0xdd3e('0xb8')));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0xb9'),require('./api/intFreshsalesField'));_0x46362e['use']('/api/networks',require(_0xdd3e('0xba')));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0xbb'),require(_0xdd3e('0xbc')));_0x46362e['use'](_0xdd3e('0xbd'),require('./api/chatInternalMessage'));_0x46362e['use'](_0xdd3e('0xbe'),require(_0xdd3e('0xbf')));_0x46362e['use'](_0xdd3e('0xc0'),require(_0xdd3e('0xc1')));_0x46362e['use'](_0xdd3e('0xc2'),require(_0xdd3e('0xc3')));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0xc4'),require(_0xdd3e('0xc5')));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0xc6'),require('./api/squareReport'));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0xc7'),require(_0xdd3e('0xc8')));_0x46362e['use']('/api/jscripty/projects',require(_0xdd3e('0xc9')));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0xca'),require(_0xdd3e('0xcb')));_0x46362e['use'](_0xdd3e('0xcc'),require(_0xdd3e('0xcd')));_0x46362e['use'](_0xdd3e('0xce'),require(_0xdd3e('0xcf')));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0xd0'),require(_0xdd3e('0xd1')));_0x46362e['use'](_0xdd3e('0xd2'),require(_0xdd3e('0xd3')));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0xd4'),require(_0xdd3e('0xd5')));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0xd6'),require(_0xdd3e('0xd7')));_0x46362e[_0xdd3e('0x5')]('/api/campaigns',require(_0xdd3e('0xd8')));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0xd9'),require(_0xdd3e('0xda')));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0xdb'),require(_0xdd3e('0xdc')));_0x46362e['use'](_0xdd3e('0xdd'),require(_0xdd3e('0xde')));_0x46362e['use'](_0xdd3e('0xdf'),require(_0xdd3e('0xe0')));_0x46362e['use']('/api/chat/reports/transfer',require(_0xdd3e('0xe1')));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0xe2'),require('./api/faxTransferReport'));_0x46362e[_0xdd3e('0x5')]('/api/openchannel/reports/transfer',require(_0xdd3e('0xe3')));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0xe4'),require(_0xdd3e('0xe5')));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0xe6'),require(_0xdd3e('0xe7')));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0xe8'),require(_0xdd3e('0xe9')));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0xea'),require(_0xdd3e('0xeb')));_0x46362e['use'](_0xdd3e('0xec'),require('./api/userProfileSection'));_0x46362e['use']('/api/userProfile/resources',require('./api/userProfileResource'));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0xed'),require(_0xdd3e('0xee')));_0x46362e['use'](_0xdd3e('0xef'),require(_0xdd3e('0xf0')));_0x46362e[_0xdd3e('0x5')]('/api/whatsapp/applications',require(_0xdd3e('0xf1')));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0xf2'),require(_0xdd3e('0xf3')));_0x46362e[_0xdd3e('0x5')]('/api/whatsapp/messages',require(_0xdd3e('0xf4')));_0x46362e[_0xdd3e('0x5')]('/api/whatsapp/reports/queue',require(_0xdd3e('0xf5')));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0xf6'),require(_0xdd3e('0xf7')));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0xf8'),require(_0xdd3e('0xf9')));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0xfa'),require(_0xdd3e('0xfb')));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0xfc'),require(_0xdd3e('0xfd')));_0x46362e['use'](_0xdd3e('0xfe'),require(_0xdd3e('0xff')));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0x100'),require(_0xdd3e('0x101')));_0x46362e['use']('/api/auth/google',require(_0xdd3e('0x102')));_0x46362e[_0xdd3e('0x5')]('/api/auth/activedirectory',require(_0xdd3e('0x103')));_0x46362e[_0xdd3e('0x5')]('/api/jira',require(_0xdd3e('0x104')));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0x105'),require('./api/rpc'));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0x106'),require(_0xdd3e('0x107')));_0x46362e['use'](_0xdd3e('0x108'),require(_0xdd3e('0x109')));_0x46362e[_0xdd3e('0x5')]('/api/pm2',require(_0xdd3e('0x10a')));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0x10b'),require(_0xdd3e('0x10c')));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0x10d'),clientSideLogs);_0x46362e[_0xdd3e('0x5')](_0xdd3e('0x10e'),express['static'](path[_0xdd3e('0x10f')](config[_0xdd3e('0x110')],_0xdd3e('0x10e'))));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0x111'),express[_0xdd3e('0x112')](path[_0xdd3e('0x10f')](config[_0xdd3e('0x110')],_0xdd3e('0x111'))));_0x46362e['use'](_0xdd3e('0x113'),express[_0xdd3e('0x112')](path['join'](config['root'],_0xdd3e('0x113'))));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0x114'),express[_0xdd3e('0x112')](path[_0xdd3e('0x10f')](config[_0xdd3e('0x110')],_0xdd3e('0x115'),_0xdd3e('0x116'))));_0x46362e[_0xdd3e('0x5')](_0xdd3e('0x117'),express['static'](path[_0xdd3e('0x10f')](config[_0xdd3e('0x110')],_0xdd3e('0x118'))));_0x46362e[_0xdd3e('0x119')](_0xdd3e('0x11a'))[_0xdd3e('0x11b')](errors[0x194]);_0x46362e[_0xdd3e('0x119')]('/*')[_0xdd3e('0x11b')](function(_0x52f921,_0x3e34b4){_0x3e34b4[_0xdd3e('0x11c')](path[_0xdd3e('0x11d')](_0x46362e[_0xdd3e('0x11b')]('appPath')+_0xdd3e('0x11e')));});return _0x46362e;});}; \ No newline at end of file +var _0x4d24=['/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','./api/intZendeskField','/api/integrations/freshdesk/accounts','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/square/reports','./api/squareReport','/api/square/details/reports','/api/jscripty/projects','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','./api/campaign','/api/migrations','/api/attachments','./api/attachment','/api/plugins','./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/voice/prefixes','./api/voicePrefix','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','/api/whatsapp/reports/transfer','/api/whatsapp/queues','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','/api/user-settings','/api/auth/local','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','./api/pm2','./api/webbar','/apidoc','join','/www','static','root','/demo','/snippet','3.1.0','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','/index.html','express','./errors','./config/environment','./utils/client-side-logger','./api/client-side-logs','then','use','./api/user','/api/voice/chanspy','./api/voiceChanSpy','./api/voiceContext','/api/voice/extensions','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/substatuses','./api/mailSubstatus','/api/mail/messages','./api/mailMessage','/api/mail/applications','/api/mail/reports/queue','/api/dashboards','./api/dashboard','./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/smsAccount','./api/smsApplication','./api/smsInteraction','/api/sms/messages','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatInteraction','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','./api/chatProactiveAction','/api/cm/companies','/api/cm/contacts','/api/cm/hopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','/api/cm/custom_fields','./api/cmCustomField','/api/actions','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','/api/tags','./api/tag','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','/api/triggers','./api/trigger','/api/variables','/api/integrations','/api/integrations/reports','./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/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','./api/intDeskAccount','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZendeskAccount'];(function(_0x51b045,_0x5f3d50){var _0x20cf96=function(_0x4d3f96){while(--_0x4d3f96){_0x51b045['push'](_0x51b045['shift']());}};_0x20cf96(++_0x5f3d50);}(_0x4d24,0x184));var _0x44d2=function(_0x26d000,_0x3e7c7e){_0x26d000=_0x26d000-0x0;var _0x37c3ac=_0x4d24[_0x26d000];return _0x37c3ac;};'use strict';var path=require('path');var express=require(_0x44d2('0x0'));var errors=require(_0x44d2('0x1'));var config=require(_0x44d2('0x2'));var setupLoggers=require(_0x44d2('0x3'))['setupLoggers'];var clientSideLogs=require(_0x44d2('0x4'));exports['default']=function(_0x3c985b){return setupLoggers(_0x3c985b)[_0x44d2('0x5')](function(){_0x3c985b[_0x44d2('0x6')]('/api/users',require(_0x44d2('0x7')));_0x3c985b[_0x44d2('0x6')](_0x44d2('0x8'),require(_0x44d2('0x9')));_0x3c985b['use']('/api/voice/contexts',require(_0x44d2('0xa')));_0x3c985b[_0x44d2('0x6')](_0x44d2('0xb'),require('./api/voiceExtension'));_0x3c985b[_0x44d2('0x6')](_0x44d2('0xc'),require(_0x44d2('0xd')));_0x3c985b['use'](_0x44d2('0xe'),require(_0x44d2('0xf')));_0x3c985b[_0x44d2('0x6')](_0x44d2('0x10'),require(_0x44d2('0x11')));_0x3c985b[_0x44d2('0x6')]('/api/screen/recordings',require(_0x44d2('0x12')));_0x3c985b['use'](_0x44d2('0x13'),require(_0x44d2('0x14')));_0x3c985b[_0x44d2('0x6')](_0x44d2('0x15'),require(_0x44d2('0x16')));_0x3c985b[_0x44d2('0x6')]('/api/voice/calls/reports',require(_0x44d2('0x17')));_0x3c985b[_0x44d2('0x6')](_0x44d2('0x18'),require(_0x44d2('0x19')));_0x3c985b[_0x44d2('0x6')](_0x44d2('0x1a'),require(_0x44d2('0x1b')));_0x3c985b['use'](_0x44d2('0x1c'),require(_0x44d2('0x1d')));_0x3c985b[_0x44d2('0x6')](_0x44d2('0x1e'),require('./api/memberReport'));_0x3c985b[_0x44d2('0x6')]('/api/trunks',require(_0x44d2('0x1f')));_0x3c985b['use'](_0x44d2('0x20'),require(_0x44d2('0x21')));_0x3c985b[_0x44d2('0x6')]('/api/mail/out_servers',require(_0x44d2('0x22')));_0x3c985b[_0x44d2('0x6')](_0x44d2('0x23'),require(_0x44d2('0x24')));_0x3c985b[_0x44d2('0x6')]('/api/mail/queues',require('./api/mailQueue'));_0x3c985b[_0x44d2('0x6')](_0x44d2('0x25'),require(_0x44d2('0x26')));_0x3c985b[_0x44d2('0x6')]('/api/mail/interactions',require('./api/mailInteraction'));_0x3c985b[_0x44d2('0x6')](_0x44d2('0x27'),require(_0x44d2('0x28')));_0x3c985b[_0x44d2('0x6')](_0x44d2('0x29'),require('./api/mailApplication'));_0x3c985b[_0x44d2('0x6')](_0x44d2('0x2a'),require('./api/mailQueueReport'));_0x3c985b['use'](_0x44d2('0x2b'),require(_0x44d2('0x2c')));_0x3c985b[_0x44d2('0x6')]('/api/dashboards/items',require(_0x44d2('0x2d')));_0x3c985b[_0x44d2('0x6')](_0x44d2('0x2e'),require('./api/faxAccount'));_0x3c985b[_0x44d2('0x6')](_0x44d2('0x2f'),require(_0x44d2('0x30')));_0x3c985b[_0x44d2('0x6')]('/api/fax/interactions',require(_0x44d2('0x31')));_0x3c985b[_0x44d2('0x6')](_0x44d2('0x32'),require(_0x44d2('0x33')));_0x3c985b[_0x44d2('0x6')](_0x44d2('0x34'),require(_0x44d2('0x35')));_0x3c985b['use'](_0x44d2('0x36'),require('./api/faxQueueReport'));_0x3c985b['use']('/api/sms/accounts',require(_0x44d2('0x37')));_0x3c985b[_0x44d2('0x6')]('/api/sms/applications',require(_0x44d2('0x38')));_0x3c985b[_0x44d2('0x6')]('/api/sms/interactions',require(_0x44d2('0x39')));_0x3c985b[_0x44d2('0x6')](_0x44d2('0x3a'),require('./api/smsMessage'));_0x3c985b[_0x44d2('0x6')]('/api/sms/queues',require(_0x44d2('0x3b')));_0x3c985b[_0x44d2('0x6')](_0x44d2('0x3c'),require(_0x44d2('0x3d')));_0x3c985b['use']('/api/openchannel/applications',require(_0x44d2('0x3e')));_0x3c985b['use'](_0x44d2('0x3f'),require(_0x44d2('0x40')));_0x3c985b['use'](_0x44d2('0x41'),require(_0x44d2('0x42')));_0x3c985b[_0x44d2('0x6')](_0x44d2('0x43'),require(_0x44d2('0x44')));_0x3c985b[_0x44d2('0x6')](_0x44d2('0x45'),require(_0x44d2('0x46')));_0x3c985b[_0x44d2('0x6')](_0x44d2('0x47'),require(_0x44d2('0x48')));_0x3c985b[_0x44d2('0x6')](_0x44d2('0x49'),require('./api/chatApplication'));_0x3c985b[_0x44d2('0x6')]('/api/chat/interactions',require(_0x44d2('0x4a')));_0x3c985b[_0x44d2('0x6')]('/api/chat/messages',require('./api/chatMessage'));_0x3c985b[_0x44d2('0x6')](_0x44d2('0x4b'),require(_0x44d2('0x4c')));_0x3c985b['use'](_0x44d2('0x4d'),require(_0x44d2('0x4e')));_0x3c985b['use'](_0x44d2('0x4f'),require(_0x44d2('0x50')));_0x3c985b['use']('/api/chat/proactive_actions',require(_0x44d2('0x51')));_0x3c985b['use'](_0x44d2('0x52'),require('./api/cmCompany'));_0x3c985b[_0x44d2('0x6')](_0x44d2('0x53'),require('./api/cmContact'));_0x3c985b['use'](_0x44d2('0x54'),require('./api/cmHopper'));_0x3c985b[_0x44d2('0x6')](_0x44d2('0x55'),require(_0x44d2('0x56')));_0x3c985b[_0x44d2('0x6')](_0x44d2('0x57'),require(_0x44d2('0x58')));_0x3c985b['use'](_0x44d2('0x59'),require('./api/cmHopperHistory'));_0x3c985b[_0x44d2('0x6')](_0x44d2('0x5a'),require(_0x44d2('0x5b')));_0x3c985b['use'](_0x44d2('0x5c'),require('./api/action'));_0x3c985b[_0x44d2('0x6')](_0x44d2('0x5d'),require(_0x44d2('0x5e')));_0x3c985b[_0x44d2('0x6')](_0x44d2('0x5f'),require(_0x44d2('0x60')));_0x3c985b['use']('/api/dispositions',require(_0x44d2('0x61')));_0x3c985b[_0x44d2('0x6')](_0x44d2('0x62'),require(_0x44d2('0x63')));_0x3c985b['use'](_0x44d2('0x64'),require(_0x44d2('0x65')));_0x3c985b['use'](_0x44d2('0x66'),require('./api/pause'));_0x3c985b[_0x44d2('0x6')]('/api/cdr',require('./api/cdr'));_0x3c985b[_0x44d2('0x6')](_0x44d2('0x67'),require(_0x44d2('0x68')));_0x3c985b[_0x44d2('0x6')](_0x44d2('0x69'),require(_0x44d2('0x6a')));_0x3c985b[_0x44d2('0x6')](_0x44d2('0x6b'),require('./api/sound'));_0x3c985b[_0x44d2('0x6')](_0x44d2('0x6c'),require(_0x44d2('0x6d')));_0x3c985b[_0x44d2('0x6')](_0x44d2('0x6e'),require(_0x44d2('0x6f')));_0x3c985b[_0x44d2('0x6')](_0x44d2('0x70'),require(_0x44d2('0x71')));_0x3c985b['use'](_0x44d2('0x72'),require(_0x44d2('0x73')));_0x3c985b['use'](_0x44d2('0x74'),require('./api/template'));_0x3c985b['use'](_0x44d2('0x75'),require(_0x44d2('0x76')));_0x3c985b[_0x44d2('0x6')](_0x44d2('0x77'),require('./api/variable'));_0x3c985b[_0x44d2('0x6')](_0x44d2('0x78'),require('./api/integration'));_0x3c985b['use'](_0x44d2('0x79'),require(_0x44d2('0x7a')));_0x3c985b[_0x44d2('0x6')](_0x44d2('0x7b'),require(_0x44d2('0x7c')));_0x3c985b['use'](_0x44d2('0x7d'),require(_0x44d2('0x7e')));_0x3c985b[_0x44d2('0x6')](_0x44d2('0x7f'),require(_0x44d2('0x80')));_0x3c985b['use'](_0x44d2('0x81'),require(_0x44d2('0x82')));_0x3c985b[_0x44d2('0x6')](_0x44d2('0x83'),require(_0x44d2('0x84')));_0x3c985b[_0x44d2('0x6')](_0x44d2('0x85'),require('./api/analyticTreeReport'));_0x3c985b[_0x44d2('0x6')]('/api/integrations/salesforce/accounts',require(_0x44d2('0x86')));_0x3c985b[_0x44d2('0x6')](_0x44d2('0x87'),require(_0x44d2('0x88')));_0x3c985b['use'](_0x44d2('0x89'),require(_0x44d2('0x8a')));_0x3c985b[_0x44d2('0x6')](_0x44d2('0x8b'),require(_0x44d2('0x8c')));_0x3c985b[_0x44d2('0x6')](_0x44d2('0x8d'),require(_0x44d2('0x8e')));_0x3c985b['use'](_0x44d2('0x8f'),require(_0x44d2('0x90')));_0x3c985b['use']('/api/integrations/desk/accounts',require(_0x44d2('0x91')));_0x3c985b[_0x44d2('0x6')]('/api/integrations/desk/configurations',require(_0x44d2('0x92')));_0x3c985b[_0x44d2('0x6')](_0x44d2('0x93'),require(_0x44d2('0x94')));_0x3c985b[_0x44d2('0x6')]('/api/integrations/zoho/accounts',require(_0x44d2('0x95')));_0x3c985b[_0x44d2('0x6')](_0x44d2('0x96'),require(_0x44d2('0x97')));_0x3c985b[_0x44d2('0x6')](_0x44d2('0x98'),require('./api/intZohoField'));_0x3c985b[_0x44d2('0x6')]('/api/integrations/zendesk/accounts',require(_0x44d2('0x99')));_0x3c985b[_0x44d2('0x6')](_0x44d2('0x9a'),require(_0x44d2('0x9b')));_0x3c985b['use']('/api/integrations/zendesk/fields',require(_0x44d2('0x9c')));_0x3c985b['use'](_0x44d2('0x9d'),require('./api/intFreshdeskAccount'));_0x3c985b['use'](_0x44d2('0x9e'),require(_0x44d2('0x9f')));_0x3c985b[_0x44d2('0x6')](_0x44d2('0xa0'),require('./api/intFreshdeskField'));_0x3c985b['use']('/api/integrations/vtiger/accounts',require(_0x44d2('0xa1')));_0x3c985b[_0x44d2('0x6')](_0x44d2('0xa2'),require(_0x44d2('0xa3')));_0x3c985b[_0x44d2('0x6')]('/api/integrations/vtiger/fields',require('./api/intVtigerField'));_0x3c985b[_0x44d2('0x6')](_0x44d2('0xa4'),require(_0x44d2('0xa5')));_0x3c985b['use'](_0x44d2('0xa6'),require('./api/intServicenowConfiguration'));_0x3c985b[_0x44d2('0x6')](_0x44d2('0xa7'),require(_0x44d2('0xa8')));_0x3c985b[_0x44d2('0x6')](_0x44d2('0xa9'),require(_0x44d2('0xaa')));_0x3c985b[_0x44d2('0x6')](_0x44d2('0xab'),require('./api/intDynamics365Configuration'));_0x3c985b[_0x44d2('0x6')](_0x44d2('0xac'),require(_0x44d2('0xad')));_0x3c985b['use'](_0x44d2('0xae'),require('./api/intFreshsalesAccount'));_0x3c985b['use'](_0x44d2('0xaf'),require(_0x44d2('0xb0')));_0x3c985b[_0x44d2('0x6')](_0x44d2('0xb1'),require(_0x44d2('0xb2')));_0x3c985b[_0x44d2('0x6')](_0x44d2('0xb3'),require('./api/network'));_0x3c985b['use'](_0x44d2('0xb4'),require(_0x44d2('0xb5')));_0x3c985b[_0x44d2('0x6')](_0x44d2('0xb6'),require(_0x44d2('0xb7')));_0x3c985b[_0x44d2('0x6')](_0x44d2('0xb8'),require(_0x44d2('0xb9')));_0x3c985b[_0x44d2('0x6')](_0x44d2('0xba'),require(_0x44d2('0xbb')));_0x3c985b[_0x44d2('0x6')](_0x44d2('0xbc'),require(_0x44d2('0xbd')));_0x3c985b[_0x44d2('0x6')]('/api/sms/reports/queue',require('./api/smsQueueReport'));_0x3c985b[_0x44d2('0x6')](_0x44d2('0xbe'),require(_0x44d2('0xbf')));_0x3c985b[_0x44d2('0x6')](_0x44d2('0xc0'),require('./api/squareReportDetail'));_0x3c985b[_0x44d2('0x6')](_0x44d2('0xc1'),require('./api/jscriptyProject'));_0x3c985b[_0x44d2('0x6')](_0x44d2('0xc2'),require(_0x44d2('0xc3')));_0x3c985b[_0x44d2('0x6')](_0x44d2('0xc4'),require(_0x44d2('0xc5')));_0x3c985b[_0x44d2('0x6')](_0x44d2('0xc6'),require('./api/squareProject'));_0x3c985b[_0x44d2('0x6')]('/api/square/recordings',require('./api/squareRecording'));_0x3c985b[_0x44d2('0x6')](_0x44d2('0xc7'),require(_0x44d2('0xc8')));_0x3c985b[_0x44d2('0x6')](_0x44d2('0xc9'),require(_0x44d2('0xca')));_0x3c985b[_0x44d2('0x6')](_0x44d2('0xcb'),require(_0x44d2('0xcc')));_0x3c985b[_0x44d2('0x6')]('/api/campaigns',require(_0x44d2('0xcd')));_0x3c985b[_0x44d2('0x6')](_0x44d2('0xce'),require('./api/migration'));_0x3c985b[_0x44d2('0x6')](_0x44d2('0xcf'),require(_0x44d2('0xd0')));_0x3c985b['use'](_0x44d2('0xd1'),require('./api/plugin'));_0x3c985b[_0x44d2('0x6')]('/api/mail/reports/transfer',require(_0x44d2('0xd2')));_0x3c985b[_0x44d2('0x6')](_0x44d2('0xd3'),require(_0x44d2('0xd4')));_0x3c985b[_0x44d2('0x6')](_0x44d2('0xd5'),require(_0x44d2('0xd6')));_0x3c985b[_0x44d2('0x6')](_0x44d2('0xd7'),require(_0x44d2('0xd8')));_0x3c985b[_0x44d2('0x6')](_0x44d2('0xd9'),require(_0x44d2('0xda')));_0x3c985b['use'](_0x44d2('0xdb'),require('./api/cmList'));_0x3c985b[_0x44d2('0x6')](_0x44d2('0xdc'),require(_0x44d2('0xdd')));_0x3c985b[_0x44d2('0x6')]('/api/userProfiles',require('./api/userProfile'));_0x3c985b[_0x44d2('0x6')](_0x44d2('0xde'),require(_0x44d2('0xdf')));_0x3c985b[_0x44d2('0x6')](_0x44d2('0xe0'),require(_0x44d2('0xe1')));_0x3c985b[_0x44d2('0x6')]('/api/userNotifications',require('./api/userNotification'));_0x3c985b[_0x44d2('0x6')](_0x44d2('0xe2'),require(_0x44d2('0xe3')));_0x3c985b[_0x44d2('0x6')](_0x44d2('0xe4'),require(_0x44d2('0xe5')));_0x3c985b[_0x44d2('0x6')](_0x44d2('0xe6'),require(_0x44d2('0xe7')));_0x3c985b['use'](_0x44d2('0xe8'),require(_0x44d2('0xe9')));_0x3c985b[_0x44d2('0x6')](_0x44d2('0xea'),require('./api/whatsappQueueReport'));_0x3c985b[_0x44d2('0x6')](_0x44d2('0xeb'),require('./api/whatsappTransferReport'));_0x3c985b[_0x44d2('0x6')](_0x44d2('0xec'),require('./api/whatsappQueue'));_0x3c985b['use'](_0x44d2('0xed'),require(_0x44d2('0xee')));_0x3c985b[_0x44d2('0x6')](_0x44d2('0xef'),require(_0x44d2('0xf0')));_0x3c985b[_0x44d2('0x6')](_0x44d2('0xf1'),require('./api/user-setting'));_0x3c985b[_0x44d2('0x6')](_0x44d2('0xf2'),require('./api/authLocal'));_0x3c985b['use']('/api/auth/google',require('./api/authGoogle'));_0x3c985b['use'](_0x44d2('0xf3'),require(_0x44d2('0xf4')));_0x3c985b['use'](_0x44d2('0xf5'),require(_0x44d2('0xf6')));_0x3c985b[_0x44d2('0x6')](_0x44d2('0xf7'),require(_0x44d2('0xf8')));_0x3c985b[_0x44d2('0x6')](_0x44d2('0xf9'),require(_0x44d2('0xfa')));_0x3c985b['use'](_0x44d2('0xfb'),require(_0x44d2('0xfc')));_0x3c985b[_0x44d2('0x6')]('/api/pm2',require(_0x44d2('0xfd')));_0x3c985b[_0x44d2('0x6')]('/api/webbar',require(_0x44d2('0xfe')));_0x3c985b[_0x44d2('0x6')]('/api/logs',clientSideLogs);_0x3c985b[_0x44d2('0x6')](_0x44d2('0xff'),express['static'](path[_0x44d2('0x100')](config['root'],_0x44d2('0xff'))));_0x3c985b[_0x44d2('0x6')](_0x44d2('0x101'),express[_0x44d2('0x102')](path[_0x44d2('0x100')](config[_0x44d2('0x103')],_0x44d2('0x101'))));_0x3c985b[_0x44d2('0x6')]('/demo',express['static'](path[_0x44d2('0x100')](config[_0x44d2('0x103')],_0x44d2('0x104'))));_0x3c985b[_0x44d2('0x6')](_0x44d2('0x105'),express[_0x44d2('0x102')](path[_0x44d2('0x100')](config[_0x44d2('0x103')],'snippet',_0x44d2('0x106'))));_0x3c985b[_0x44d2('0x6')]('/plugins',express[_0x44d2('0x102')](path['join'](config[_0x44d2('0x103')],_0x44d2('0x107'))));_0x3c985b[_0x44d2('0x108')](_0x44d2('0x109'))[_0x44d2('0x10a')](errors[0x194]);_0x3c985b[_0x44d2('0x108')]('/*')['get'](function(_0x4a3cae,_0x83dfb0){_0x83dfb0[_0x44d2('0x10b')](path[_0x44d2('0x10c')](_0x3c985b[_0x44d2('0x10a')](_0x44d2('0x10d'))+_0x44d2('0x10e')));});return _0x3c985b;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 03eb5b8..a235806 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1014=['../api/squareReport/squareReport.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost','error','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','lodash','listen','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.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/cmHopperFinal/cmHopperFinal.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc'];(function(_0x3bab09,_0x217c29){var _0x164376=function(_0x277730){while(--_0x277730){_0x3bab09['push'](_0x3bab09['shift']());}};_0x164376(++_0x217c29);}(_0x1014,0x1c7));var _0x4101=function(_0x4d91a2,_0xbc3b85){_0x4d91a2=_0x4d91a2-0x0;var _0x551394=_0x1014[_0x4d91a2];return _0x551394;};'use strict';var jayson=require('jayson/promise');var _=require(_0x4101('0x0'));var config=require('../config/environment');exports[_0x4101('0x1')]=function(){return new Promise(function(_0x9c22d7,_0x4f69a3){var _0x2fc0b6={};_0x2fc0b6=_[_0x4101('0x2')](_0x2fc0b6,require('../api/user/user.rpc'));_0x2fc0b6=_[_0x4101('0x2')](_0x2fc0b6,require(_0x4101('0x3')));_0x2fc0b6=_[_0x4101('0x2')](_0x2fc0b6,require(_0x4101('0x4')));_0x2fc0b6=_[_0x4101('0x2')](_0x2fc0b6,require(_0x4101('0x5')));_0x2fc0b6=_[_0x4101('0x2')](_0x2fc0b6,require(_0x4101('0x6')));_0x2fc0b6=_[_0x4101('0x2')](_0x2fc0b6,require(_0x4101('0x7')));_0x2fc0b6=_[_0x4101('0x2')](_0x2fc0b6,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x2fc0b6=_[_0x4101('0x2')](_0x2fc0b6,require(_0x4101('0x8')));_0x2fc0b6=_['merge'](_0x2fc0b6,require(_0x4101('0x9')));_0x2fc0b6=_[_0x4101('0x2')](_0x2fc0b6,require(_0x4101('0xa')));_0x2fc0b6=_[_0x4101('0x2')](_0x2fc0b6,require(_0x4101('0xb')));_0x2fc0b6=_[_0x4101('0x2')](_0x2fc0b6,require(_0x4101('0xc')));_0x2fc0b6=_['merge'](_0x2fc0b6,require('../api/mailServerIn/mailServerIn.rpc'));_0x2fc0b6=_[_0x4101('0x2')](_0x2fc0b6,require('../api/mailAccount/mailAccount.rpc'));_0x2fc0b6=_['merge'](_0x2fc0b6,require('../api/mailQueue/mailQueue.rpc'));_0x2fc0b6=_[_0x4101('0x2')](_0x2fc0b6,require(_0x4101('0xd')));_0x2fc0b6=_['merge'](_0x2fc0b6,require(_0x4101('0xe')));_0x2fc0b6=_[_0x4101('0x2')](_0x2fc0b6,require(_0x4101('0xf')));_0x2fc0b6=_[_0x4101('0x2')](_0x2fc0b6,require(_0x4101('0x10')));_0x2fc0b6=_[_0x4101('0x2')](_0x2fc0b6,require(_0x4101('0x11')));_0x2fc0b6=_[_0x4101('0x2')](_0x2fc0b6,require(_0x4101('0x12')));_0x2fc0b6=_[_0x4101('0x2')](_0x2fc0b6,require(_0x4101('0x13')));_0x2fc0b6=_['merge'](_0x2fc0b6,require(_0x4101('0x14')));_0x2fc0b6=_[_0x4101('0x2')](_0x2fc0b6,require(_0x4101('0x15')));_0x2fc0b6=_['merge'](_0x2fc0b6,require(_0x4101('0x16')));_0x2fc0b6=_[_0x4101('0x2')](_0x2fc0b6,require(_0x4101('0x17')));_0x2fc0b6=_[_0x4101('0x2')](_0x2fc0b6,require('../api/smsInteraction/smsInteraction.rpc'));_0x2fc0b6=_[_0x4101('0x2')](_0x2fc0b6,require(_0x4101('0x18')));_0x2fc0b6=_[_0x4101('0x2')](_0x2fc0b6,require(_0x4101('0x19')));_0x2fc0b6=_[_0x4101('0x2')](_0x2fc0b6,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x2fc0b6=_[_0x4101('0x2')](_0x2fc0b6,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x2fc0b6=_[_0x4101('0x2')](_0x2fc0b6,require(_0x4101('0x1a')));_0x2fc0b6=_[_0x4101('0x2')](_0x2fc0b6,require(_0x4101('0x1b')));_0x2fc0b6=_[_0x4101('0x2')](_0x2fc0b6,require(_0x4101('0x1c')));_0x2fc0b6=_[_0x4101('0x2')](_0x2fc0b6,require(_0x4101('0x1d')));_0x2fc0b6=_[_0x4101('0x2')](_0x2fc0b6,require(_0x4101('0x1e')));_0x2fc0b6=_[_0x4101('0x2')](_0x2fc0b6,require(_0x4101('0x1f')));_0x2fc0b6=_[_0x4101('0x2')](_0x2fc0b6,require('../api/cmContact/cmContact.rpc'));_0x2fc0b6=_['merge'](_0x2fc0b6,require(_0x4101('0x20')));_0x2fc0b6=_['merge'](_0x2fc0b6,require(_0x4101('0x21')));_0x2fc0b6=_['merge'](_0x2fc0b6,require(_0x4101('0x22')));_0x2fc0b6=_[_0x4101('0x2')](_0x2fc0b6,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x2fc0b6=_['merge'](_0x2fc0b6,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x2fc0b6=_[_0x4101('0x2')](_0x2fc0b6,require('../api/interval/interval.rpc'));_0x2fc0b6=_[_0x4101('0x2')](_0x2fc0b6,require(_0x4101('0x23')));_0x2fc0b6=_[_0x4101('0x2')](_0x2fc0b6,require(_0x4101('0x24')));_0x2fc0b6=_['merge'](_0x2fc0b6,require(_0x4101('0x25')));_0x2fc0b6=_['merge'](_0x2fc0b6,require(_0x4101('0x26')));_0x2fc0b6=_['merge'](_0x2fc0b6,require(_0x4101('0x27')));_0x2fc0b6=_[_0x4101('0x2')](_0x2fc0b6,require('../api/variable/variable.rpc'));_0x2fc0b6=_[_0x4101('0x2')](_0x2fc0b6,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x2fc0b6=_[_0x4101('0x2')](_0x2fc0b6,require(_0x4101('0x28')));_0x2fc0b6=_[_0x4101('0x2')](_0x2fc0b6,require(_0x4101('0x29')));_0x2fc0b6=_[_0x4101('0x2')](_0x2fc0b6,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x2fc0b6=_[_0x4101('0x2')](_0x2fc0b6,require(_0x4101('0x2a')));_0x2fc0b6=_[_0x4101('0x2')](_0x2fc0b6,require(_0x4101('0x2b')));_0x2fc0b6=_[_0x4101('0x2')](_0x2fc0b6,require(_0x4101('0x2c')));_0x2fc0b6=_['merge'](_0x2fc0b6,require(_0x4101('0x2d')));_0x2fc0b6=_[_0x4101('0x2')](_0x2fc0b6,require(_0x4101('0x2e')));_0x2fc0b6=_[_0x4101('0x2')](_0x2fc0b6,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x2fc0b6=_['merge'](_0x2fc0b6,require(_0x4101('0x2f')));_0x2fc0b6=_[_0x4101('0x2')](_0x2fc0b6,require(_0x4101('0x30')));_0x2fc0b6=_[_0x4101('0x2')](_0x2fc0b6,require(_0x4101('0x31')));_0x2fc0b6=_['merge'](_0x2fc0b6,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x2fc0b6=_['merge'](_0x2fc0b6,require(_0x4101('0x32')));_0x2fc0b6=_[_0x4101('0x2')](_0x2fc0b6,require(_0x4101('0x33')));_0x2fc0b6=_[_0x4101('0x2')](_0x2fc0b6,require(_0x4101('0x34')));_0x2fc0b6=_[_0x4101('0x2')](_0x2fc0b6,require(_0x4101('0x35')));_0x2fc0b6=_[_0x4101('0x2')](_0x2fc0b6,require(_0x4101('0x36')));_0x2fc0b6=_[_0x4101('0x2')](_0x2fc0b6,require(_0x4101('0x37')));_0x2fc0b6=_['merge'](_0x2fc0b6,require('../api/attachment/attachment.rpc'));_0x2fc0b6=_[_0x4101('0x2')](_0x2fc0b6,require(_0x4101('0x38')));_0x2fc0b6=_[_0x4101('0x2')](_0x2fc0b6,require(_0x4101('0x39')));_0x2fc0b6=_['merge'](_0x2fc0b6,require(_0x4101('0x3a')));_0x2fc0b6=_[_0x4101('0x2')](_0x2fc0b6,require(_0x4101('0x3b')));_0x2fc0b6=_[_0x4101('0x2')](_0x2fc0b6,require(_0x4101('0x3c')));_0x2fc0b6=_[_0x4101('0x2')](_0x2fc0b6,require(_0x4101('0x3d')));var _0xfb00f4=jayson[_0x4101('0x3e')](_0x2fc0b6)[_0x4101('0x3f')]();var _0x2ab401=config[_0x4101('0x40')][_0x4101('0x41')]||config[_0x4101('0x41')]+0x1;var _0x506dd4=config[_0x4101('0x40')]['ip']||_0x4101('0x42');_0xfb00f4['on'](_0x4101('0x43'),function(_0x2400a4){return _0x4f69a3(_0x2400a4);});_0xfb00f4['listen'](_0x2ab401,_0x506dd4,function(){console['log'](_0x4101('0x44'),_0x506dd4,_0x2ab401);require(_0x4101('0x45'))[_0x4101('0x46')]();return _0x9c22d7(_0x4101('0x47')+_0x506dd4+':'+_0x2ab401);});});}; \ No newline at end of file +var _0x8c47=['../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.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/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.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/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.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/interval/interval.rpc','../api/template/template.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','server','rpc','port','localhost','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','jayson/promise','../config/environment','merge','../api/user/user.rpc'];(function(_0x5223bf,_0x109da4){var _0x181da4=function(_0x5d7047){while(--_0x5d7047){_0x5223bf['push'](_0x5223bf['shift']());}};_0x181da4(++_0x109da4);}(_0x8c47,0xc5));var _0x78c4=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x8c47[_0x1694f5];return _0x5b4321;};'use strict';var jayson=require(_0x78c4('0x0'));var _=require('lodash');var config=require(_0x78c4('0x1'));exports['listen']=function(){return new Promise(function(_0x35f43d,_0x5849dc){var _0x434422={};_0x434422=_[_0x78c4('0x2')](_0x434422,require(_0x78c4('0x3')));_0x434422=_[_0x78c4('0x2')](_0x434422,require(_0x78c4('0x4')));_0x434422=_[_0x78c4('0x2')](_0x434422,require(_0x78c4('0x5')));_0x434422=_['merge'](_0x434422,require('../api/voiceRecording/voiceRecording.rpc'));_0x434422=_[_0x78c4('0x2')](_0x434422,require(_0x78c4('0x6')));_0x434422=_[_0x78c4('0x2')](_0x434422,require(_0x78c4('0x7')));_0x434422=_[_0x78c4('0x2')](_0x434422,require(_0x78c4('0x8')));_0x434422=_[_0x78c4('0x2')](_0x434422,require(_0x78c4('0x9')));_0x434422=_[_0x78c4('0x2')](_0x434422,require(_0x78c4('0xa')));_0x434422=_['merge'](_0x434422,require(_0x78c4('0xb')));_0x434422=_[_0x78c4('0x2')](_0x434422,require(_0x78c4('0xc')));_0x434422=_[_0x78c4('0x2')](_0x434422,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x434422=_[_0x78c4('0x2')](_0x434422,require(_0x78c4('0xd')));_0x434422=_[_0x78c4('0x2')](_0x434422,require('../api/mailAccount/mailAccount.rpc'));_0x434422=_[_0x78c4('0x2')](_0x434422,require(_0x78c4('0xe')));_0x434422=_[_0x78c4('0x2')](_0x434422,require(_0x78c4('0xf')));_0x434422=_[_0x78c4('0x2')](_0x434422,require(_0x78c4('0x10')));_0x434422=_['merge'](_0x434422,require('../api/mailApplication/mailApplication.rpc'));_0x434422=_[_0x78c4('0x2')](_0x434422,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x434422=_['merge'](_0x434422,require(_0x78c4('0x11')));_0x434422=_[_0x78c4('0x2')](_0x434422,require(_0x78c4('0x12')));_0x434422=_[_0x78c4('0x2')](_0x434422,require(_0x78c4('0x13')));_0x434422=_[_0x78c4('0x2')](_0x434422,require(_0x78c4('0x14')));_0x434422=_[_0x78c4('0x2')](_0x434422,require(_0x78c4('0x15')));_0x434422=_[_0x78c4('0x2')](_0x434422,require(_0x78c4('0x16')));_0x434422=_['merge'](_0x434422,require('../api/smsAccount/smsAccount.rpc'));_0x434422=_[_0x78c4('0x2')](_0x434422,require(_0x78c4('0x17')));_0x434422=_[_0x78c4('0x2')](_0x434422,require(_0x78c4('0x18')));_0x434422=_['merge'](_0x434422,require(_0x78c4('0x19')));_0x434422=_[_0x78c4('0x2')](_0x434422,require(_0x78c4('0x1a')));_0x434422=_['merge'](_0x434422,require(_0x78c4('0x1b')));_0x434422=_['merge'](_0x434422,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x434422=_[_0x78c4('0x2')](_0x434422,require(_0x78c4('0x1c')));_0x434422=_['merge'](_0x434422,require(_0x78c4('0x1d')));_0x434422=_[_0x78c4('0x2')](_0x434422,require('../api/chatInteraction/chatInteraction.rpc'));_0x434422=_['merge'](_0x434422,require(_0x78c4('0x1e')));_0x434422=_[_0x78c4('0x2')](_0x434422,require(_0x78c4('0x1f')));_0x434422=_[_0x78c4('0x2')](_0x434422,require('../api/cmContact/cmContact.rpc'));_0x434422=_[_0x78c4('0x2')](_0x434422,require(_0x78c4('0x20')));_0x434422=_[_0x78c4('0x2')](_0x434422,require(_0x78c4('0x21')));_0x434422=_[_0x78c4('0x2')](_0x434422,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x434422=_[_0x78c4('0x2')](_0x434422,require(_0x78c4('0x22')));_0x434422=_[_0x78c4('0x2')](_0x434422,require(_0x78c4('0x23')));_0x434422=_[_0x78c4('0x2')](_0x434422,require(_0x78c4('0x24')));_0x434422=_['merge'](_0x434422,require('../api/pause/pause.rpc'));_0x434422=_[_0x78c4('0x2')](_0x434422,require('../api/sound/sound.rpc'));_0x434422=_['merge'](_0x434422,require('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc'));_0x434422=_[_0x78c4('0x2')](_0x434422,require(_0x78c4('0x25')));_0x434422=_[_0x78c4('0x2')](_0x434422,require('../api/trigger/trigger.rpc'));_0x434422=_[_0x78c4('0x2')](_0x434422,require(_0x78c4('0x26')));_0x434422=_[_0x78c4('0x2')](_0x434422,require(_0x78c4('0x27')));_0x434422=_['merge'](_0x434422,require(_0x78c4('0x28')));_0x434422=_[_0x78c4('0x2')](_0x434422,require(_0x78c4('0x29')));_0x434422=_[_0x78c4('0x2')](_0x434422,require(_0x78c4('0x2a')));_0x434422=_[_0x78c4('0x2')](_0x434422,require(_0x78c4('0x2b')));_0x434422=_['merge'](_0x434422,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x434422=_[_0x78c4('0x2')](_0x434422,require(_0x78c4('0x2c')));_0x434422=_[_0x78c4('0x2')](_0x434422,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x434422=_[_0x78c4('0x2')](_0x434422,require(_0x78c4('0x2d')));_0x434422=_[_0x78c4('0x2')](_0x434422,require(_0x78c4('0x2e')));_0x434422=_[_0x78c4('0x2')](_0x434422,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x434422=_[_0x78c4('0x2')](_0x434422,require(_0x78c4('0x2f')));_0x434422=_[_0x78c4('0x2')](_0x434422,require(_0x78c4('0x30')));_0x434422=_[_0x78c4('0x2')](_0x434422,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x434422=_[_0x78c4('0x2')](_0x434422,require('../api/setting/setting.rpc'));_0x434422=_[_0x78c4('0x2')](_0x434422,require(_0x78c4('0x31')));_0x434422=_[_0x78c4('0x2')](_0x434422,require(_0x78c4('0x32')));_0x434422=_['merge'](_0x434422,require(_0x78c4('0x33')));_0x434422=_[_0x78c4('0x2')](_0x434422,require(_0x78c4('0x34')));_0x434422=_[_0x78c4('0x2')](_0x434422,require(_0x78c4('0x35')));_0x434422=_[_0x78c4('0x2')](_0x434422,require(_0x78c4('0x36')));_0x434422=_[_0x78c4('0x2')](_0x434422,require(_0x78c4('0x37')));_0x434422=_[_0x78c4('0x2')](_0x434422,require(_0x78c4('0x38')));_0x434422=_[_0x78c4('0x2')](_0x434422,require(_0x78c4('0x39')));_0x434422=_[_0x78c4('0x2')](_0x434422,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x434422=_['merge'](_0x434422,require(_0x78c4('0x3a')));_0x434422=_['merge'](_0x434422,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x34883e=jayson[_0x78c4('0x3b')](_0x434422)['http']();var _0x2716a5=config[_0x78c4('0x3c')]['port']||config[_0x78c4('0x3d')]+0x1;var _0x3c899f=config[_0x78c4('0x3c')]['ip']||_0x78c4('0x3e');_0x34883e['on']('error',function(_0x30068c){return _0x5849dc(_0x30068c);});_0x34883e['listen'](_0x2716a5,_0x3c899f,function(){console[_0x78c4('0x3f')](_0x78c4('0x40'),_0x3c899f,_0x2716a5);require(_0x78c4('0x41'))[_0x78c4('0x42')]();return _0x35f43d('RPC\x20listening\x20on\x20'+_0x3c899f+':'+_0x2716a5);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index ed9dd98..278ce0c 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 _0xa8be=['AGI','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','events','EventEmitter','./error','call','setEncoding','utf8','headers','emit','line','toLowerCase','hangup','substring','520-Invalid','search','function','no\x20code','indexOf','substr','split','length','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','pipe','write','destroy','inherits','sync','prototype','answer','sendRequest','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','VERBOSE\x20\x22%s\x22','exec','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','replace','sayNumber','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','GOTO\x20%s\x20%s\x20%s','getVariable','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','agi'];(function(_0x22a2fe,_0x11f917){var _0x2331f7=function(_0x2d36ee){while(--_0x2d36ee){_0x22a2fe['push'](_0x22a2fe['shift']());}};_0x2331f7(++_0x11f917);}(_0xa8be,0x9b));var _0xea8b=function(_0x262075,_0x3b7aa5){_0x262075=_0x262075-0x0;var _0x3e230e=_0xa8be[_0x262075];return _0x3e230e;};'use strict';var util=require(_0xea8b('0x0'));var _=require(_0xea8b('0x1'));var EventEmitter=require(_0xea8b('0x2'))[_0xea8b('0x3')];var AGIReply=require('./reply');var AGIError=require(_0xea8b('0x4'));function AGIChannel(_0xf5e44e){var _0x463f9f=this,_0x3fba27=new AGIReply(),_0x1da649=![],_0x205514={};EventEmitter[_0xea8b('0x5')](_0x463f9f);_0xf5e44e[_0xea8b('0x6')]('utf8');_0xf5e44e['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x3fba27[_0xea8b('0x6')](_0xea8b('0x7'));_0x3fba27['on'](_0xea8b('0x8'),function(_0x2be511){for(var _0x2ea33b in _0x2be511){_0x463f9f[_0x2ea33b]=_0x2be511[_0x2ea33b];}_0x463f9f[_0xea8b('0x9')]('ready');});_0x3fba27['on'](_0xea8b('0xa'),function(_0xd8600f){if(_0xd8600f[_0xea8b('0xb')]()==_0xea8b('0xc')){_0x463f9f[_0xea8b('0x9')](_0xea8b('0xc'));return;}if(_0xd8600f[_0xea8b('0xd')](0x0,0xb)==_0xea8b('0xe')){_0x1da649=!![];}if(_0x1da649){_0x205514['rx']+=_0xd8600f+'\x0a';if(_0xd8600f[_0xea8b('0xf')]('520\x20End\x20of\x20proper')!=-0x1){_0x1da649=![];}}else{_0x205514['rx']=_0xd8600f;}if(_0x1da649){return;}if(typeof _0x205514['cb']==_0xea8b('0x10')){var _0x78646=_0x205514['rx'][_0xea8b('0xd')](0x0,0x3),_0x39058b=null,_0x32d0f9=null;_0x78646=parseInt(_0x78646);if(isNaN(_0x78646)){_0x205514['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xea8b('0x11')});return;}if(_0x78646!=0xc8){_0x205514['cb'](null,{'code':_0x78646,'result':-0x1,'extra':'KO'});return;}_0x39058b=_0x205514['rx'][_0xea8b('0xd')](0x4)['replace']('result=','');if(_0x39058b[_0xea8b('0x12')]('\x20')!=-0x1){_0x39058b=_0x39058b[_0xea8b('0x13')](0x0,_0x39058b[_0xea8b('0x12')]('\x20'));}if(_['startsWith'](_0x39058b,'-1')){_0x39058b=parseInt(_0x39058b);}_0x32d0f9=_0x205514['rx'][_0xea8b('0x14')]('\x20');if(_0x32d0f9[_0xea8b('0x15')]==0x3){_0x32d0f9=_0x32d0f9[0x2][_0xea8b('0xd')](0x1,_0x32d0f9[0x2][_0xea8b('0x15')]-0x1);}else if(_0x32d0f9[_0xea8b('0x15')]>0x3){var _0x3f46eb=/\((.+)\)/;var _0x49a1f2=_0x205514['rx']['match'](_0x3f46eb);if(_0x49a1f2){_0x32d0f9=_0x49a1f2[0x1];}else{_0x32d0f9=null;}}else{_0x32d0f9=null;}_0x205514['cb'](null,{'code':_0x78646,'result':_0x39058b,'extra':_0x32d0f9});}});_0xf5e44e['on'](_0xea8b('0x16'),function(_0x53e79d){_0x463f9f[_0xea8b('0x9')](_0xea8b('0x16'),new AGIError(_0xea8b('0x17'),_0x53e79d[_0xea8b('0x18')]));});_0xf5e44e['on'](_0xea8b('0x19'),function(){_0x463f9f[_0xea8b('0x9')](_0xea8b('0x19'),new AGIError(_0xea8b('0x1a')));});_0xf5e44e['on'](_0xea8b('0x1b'),function(){_0x463f9f[_0xea8b('0x9')](_0xea8b('0x1b'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0xf5e44e['destroy']();});_0xf5e44e[_0xea8b('0x1c')](_0x3fba27);this['command']=function(_0x3b2894,_0x28faf6){var _0x3b2894=_0x3b2894||'',_0x28faf6=typeof _0x28faf6==_0xea8b('0x10')?_0x28faf6:new Function();_0x205514={'tx':_0x3b2894,'rx':'','cb':_0x28faf6};_0xf5e44e[_0xea8b('0x1d')](_0x3b2894+'\x0a');},this[_0xea8b('0x19')]=function(){_0xf5e44e[_0xea8b('0x1e')]();};}util[_0xea8b('0x1f')](AGIChannel,EventEmitter);AGIChannel['prototype']['sendRequest']=function(_0x185d1d){return this['command'][_0xea8b('0x20')](this,_0x185d1d);};AGIChannel[_0xea8b('0x21')][_0xea8b('0x22')]=function(){return this[_0xea8b('0x23')]('ANSWER');};AGIChannel[_0xea8b('0x21')][_0xea8b('0x24')]=function(_0x1b100b,_0x353010,_0x2b0180){_0x1b100b=_0x1b100b===undefined?_0xea8b('0x25'):_0x1b100b;_0x353010=_0x353010===undefined?'5':_0x353010;_0x2b0180=_0x2b0180===undefined?'1':_0x2b0180;return this[_0xea8b('0x23')](util[_0xea8b('0x26')](_0xea8b('0x27'),_0x1b100b,_0x353010*0x3e8,_0x2b0180));};AGIChannel[_0xea8b('0x21')][_0xea8b('0x28')]=function(_0x1a73a6){_0x1a73a6=_0x1a73a6||'NO\x20MESSAGE';return this['sendRequest'](util[_0xea8b('0x26')](_0xea8b('0x29'),_0x1a73a6));};AGIChannel[_0xea8b('0x21')][_0xea8b('0x2a')]=function(_0x288cdc,_0x453d05){if(_['isArray'](_0x453d05)){return this[_0xea8b('0x23')](util[_0xea8b('0x26')](_0xea8b('0x2b'),_0x288cdc,_0x453d05[_0xea8b('0x2c')](',')));}return this['sendRequest'](util[_0xea8b('0x26')]('EXEC\x20%s\x20%s',_0x288cdc,_0x453d05));};AGIChannel[_0xea8b('0x21')][_0xea8b('0x2d')]=function(_0x2df582){return this[_0xea8b('0x23')](util[_0xea8b('0x26')](_0xea8b('0x2e'),_0x2df582));};AGIChannel[_0xea8b('0x21')][_0xea8b('0x2f')]=function(_0x55777d){return this[_0xea8b('0x23')](util[_0xea8b('0x26')](_0xea8b('0x30'),_0x55777d));};AGIChannel[_0xea8b('0x21')][_0xea8b('0x31')]=function(_0x4cb78c){return this['sendRequest'](util[_0xea8b('0x26')](_0xea8b('0x32'),_0x4cb78c));};AGIChannel[_0xea8b('0x21')][_0xea8b('0xc')]=function(){return this[_0xea8b('0x23')](_0xea8b('0x33'));};AGIChannel[_0xea8b('0x21')][_0xea8b('0x34')]=function(_0x1ba01e,_0x5547bf){var _0xc6959c=_[_0xea8b('0x35')](_0x5547bf)||_['isNumber'](_0x5547bf)?_0x5547bf[_0xea8b('0x36')]():_0x5547bf;return this['sendRequest'](util[_0xea8b('0x26')](_0xea8b('0x37'),_0x1ba01e,_0xc6959c?_0xc6959c[_0xea8b('0x36')]()[_0xea8b('0x38')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xea8b('0x21')][_0xea8b('0x39')]=function(_0x4f743f,_0x17ff60){return this[_0xea8b('0x23')](util[_0xea8b('0x26')]('SAY\x20NUMBER\x20%s\x20%s',_0x4f743f,_0x17ff60));};AGIChannel[_0xea8b('0x21')]['sayDigits']=function(_0x4219b0,_0x3df4e0){return this[_0xea8b('0x23')](util[_0xea8b('0x26')](_0xea8b('0x3a'),_0x4219b0,_0x3df4e0));};AGIChannel[_0xea8b('0x21')][_0xea8b('0x3b')]=function(_0x2530b2,_0x3568f1){return this['sendRequest'](util[_0xea8b('0x26')](_0xea8b('0x3c'),_0x2530b2,_0x3568f1));};AGIChannel[_0xea8b('0x21')][_0xea8b('0x3d')]=function(_0x2015df,_0x40e187,_0xf4b861){_0x40e187=_0x40e187||this['extension'];_0xf4b861=_0xf4b861||0x1;this[_0xea8b('0x2d')](_0x2015df);this[_0xea8b('0x2f')](_0x40e187);this[_0xea8b('0x31')](_0xf4b861);return this[_0xea8b('0x28')](util[_0xea8b('0x26')](_0xea8b('0x3e'),_0x2015df,_0x40e187,_0xf4b861));};AGIChannel[_0xea8b('0x21')][_0xea8b('0x3f')]=function(_0x2fa0cd){return this[_0xea8b('0x23')](util['format']('GET\x20VARIABLE\x20\x22%s\x22',_0x2fa0cd));};AGIChannel[_0xea8b('0x21')][_0xea8b('0x40')]=function(_0x301f4e,_0x25111d,_0x2081f9,_0x5ed643,_0x4fb5f7,_0x1cf3e0){_0x25111d=_0x25111d||_0xea8b('0x41');_0x2081f9=_0x2081f9||'';_0x5ed643=_0x5ed643===undefined?-0x1:_0x5ed643==='-1'?-0x1:_0x5ed643*0x3e8;_0x4fb5f7=_0x4fb5f7===undefined?'':'s='+_0x4fb5f7;_0x1cf3e0=_0x1cf3e0?_0xea8b('0x42'):'';return this[_0xea8b('0x23')](util[_0xea8b('0x26')](_0xea8b('0x43'),_0x301f4e,_0x25111d,_0x2081f9,_0x5ed643,_0x1cf3e0,_0x4fb5f7));};AGIChannel[_0xea8b('0x21')][_0xea8b('0x44')]=function(_0x5bf61d,_0x48449b){_0x48449b=_0x48449b||'';return this[_0xea8b('0x23')](util[_0xea8b('0x26')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x5bf61d,_0x48449b));};AGIChannel['prototype'][_0xea8b('0x45')]=function(_0x511316){return this[_0xea8b('0x2a')](_0xea8b('0x46'),_0x511316);};AGIChannel[_0xea8b('0x21')]['wait']=function(_0x1f84cd){return this[_0xea8b('0x2a')](_0xea8b('0x47'),_0x1f84cd);};AGIChannel[_0xea8b('0x21')]['error']=function(_0x513b41,_0x6de796){this['noop'](util[_0xea8b('0x26')](_0xea8b('0x48'),_0x513b41['id'],_0x513b41[_0xea8b('0x49')],_0x6de796));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xea8b('0x4a')]=AGIChannel; \ No newline at end of file +var _0xeefe=['call','setEncoding','setTimeout','utf8','headers','emit','ready','line','hangup','substring','520-Invalid','520\x20End\x20of\x20proper','function','result=','indexOf','substr','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','write','inherits','prototype','sendRequest','sync','answer','ANSWER','getData','beep','noop','NO\x20MESSAGE','format','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setContext','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','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','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','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','exports','util','events','./reply','./error'];(function(_0xc8f61e,_0x220e98){var _0x519790=function(_0x55c6ca){while(--_0x55c6ca){_0xc8f61e['push'](_0xc8f61e['shift']());}};_0x519790(++_0x220e98);}(_0xeefe,0xf2));var _0xeeef=function(_0x3b88b8,_0x32be3c){_0x3b88b8=_0x3b88b8-0x0;var _0x299be1=_0xeefe[_0x3b88b8];return _0x299be1;};'use strict';var util=require(_0xeeef('0x0'));var _=require('lodash');var EventEmitter=require(_0xeeef('0x1'))['EventEmitter'];var AGIReply=require(_0xeeef('0x2'));var AGIError=require(_0xeeef('0x3'));function AGIChannel(_0x546218){var _0x20bd76=this,_0x58512c=new AGIReply(),_0xf7b46c=![],_0x1d5b38={};EventEmitter[_0xeeef('0x4')](_0x20bd76);_0x546218[_0xeeef('0x5')]('utf8');_0x546218[_0xeeef('0x6')](0x8*0x3c*0x3c*0x3e8);_0x58512c[_0xeeef('0x5')](_0xeeef('0x7'));_0x58512c['on'](_0xeeef('0x8'),function(_0x214f24){for(var _0x1b2759 in _0x214f24){_0x20bd76[_0x1b2759]=_0x214f24[_0x1b2759];}_0x20bd76[_0xeeef('0x9')](_0xeeef('0xa'));});_0x58512c['on'](_0xeeef('0xb'),function(_0x3a7729){if(_0x3a7729['toLowerCase']()==_0xeeef('0xc')){_0x20bd76[_0xeeef('0x9')](_0xeeef('0xc'));return;}if(_0x3a7729[_0xeeef('0xd')](0x0,0xb)==_0xeeef('0xe')){_0xf7b46c=!![];}if(_0xf7b46c){_0x1d5b38['rx']+=_0x3a7729+'\x0a';if(_0x3a7729['search'](_0xeeef('0xf'))!=-0x1){_0xf7b46c=![];}}else{_0x1d5b38['rx']=_0x3a7729;}if(_0xf7b46c){return;}if(typeof _0x1d5b38['cb']==_0xeeef('0x10')){var _0x11cfe4=_0x1d5b38['rx']['substring'](0x0,0x3),_0x342c49=null,_0x29352a=null;_0x11cfe4=parseInt(_0x11cfe4);if(isNaN(_0x11cfe4)){_0x1d5b38['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x11cfe4!=0xc8){_0x1d5b38['cb'](null,{'code':_0x11cfe4,'result':-0x1,'extra':'KO'});return;}_0x342c49=_0x1d5b38['rx'][_0xeeef('0xd')](0x4)['replace'](_0xeeef('0x11'),'');if(_0x342c49[_0xeeef('0x12')]('\x20')!=-0x1){_0x342c49=_0x342c49[_0xeeef('0x13')](0x0,_0x342c49[_0xeeef('0x12')]('\x20'));}if(_[_0xeeef('0x14')](_0x342c49,'-1')){_0x342c49=parseInt(_0x342c49);}_0x29352a=_0x1d5b38['rx'][_0xeeef('0x15')]('\x20');if(_0x29352a[_0xeeef('0x16')]==0x3){_0x29352a=_0x29352a[0x2][_0xeeef('0xd')](0x1,_0x29352a[0x2][_0xeeef('0x16')]-0x1);}else if(_0x29352a[_0xeeef('0x16')]>0x3){var _0xafdb76=/\((.+)\)/;var _0x4657f9=_0x1d5b38['rx'][_0xeeef('0x17')](_0xafdb76);if(_0x4657f9){_0x29352a=_0x4657f9[0x1];}else{_0x29352a=null;}}else{_0x29352a=null;}_0x1d5b38['cb'](null,{'code':_0x11cfe4,'result':_0x342c49,'extra':_0x29352a});}});_0x546218['on'](_0xeeef('0x18'),function(_0x42b775){_0x20bd76[_0xeeef('0x9')](_0xeeef('0x18'),new AGIError(_0xeeef('0x19'),_0x42b775[_0xeeef('0x1a')]));});_0x546218['on'](_0xeeef('0x1b'),function(){_0x20bd76[_0xeeef('0x9')](_0xeeef('0x1b'),new AGIError(_0xeeef('0x1c')));});_0x546218['on']('timeout',function(){_0x20bd76['emit']('timeout',new AGIError(_0xeeef('0x1d')));_0x546218[_0xeeef('0x1e')]();});_0x546218[_0xeeef('0x1f')](_0x58512c);this[_0xeeef('0x20')]=function(_0x60b53b,_0x32788e){var _0x60b53b=_0x60b53b||'',_0x32788e=typeof _0x32788e==_0xeeef('0x10')?_0x32788e:new Function();_0x1d5b38={'tx':_0x60b53b,'rx':'','cb':_0x32788e};_0x546218[_0xeeef('0x21')](_0x60b53b+'\x0a');},this[_0xeeef('0x1b')]=function(){_0x546218['destroy']();};}util[_0xeeef('0x22')](AGIChannel,EventEmitter);AGIChannel[_0xeeef('0x23')][_0xeeef('0x24')]=function(_0x220718){return this['command'][_0xeeef('0x25')](this,_0x220718);};AGIChannel['prototype'][_0xeeef('0x26')]=function(){return this[_0xeeef('0x24')](_0xeeef('0x27'));};AGIChannel[_0xeeef('0x23')][_0xeeef('0x28')]=function(_0x44c891,_0x498993,_0x9debdc){_0x44c891=_0x44c891===undefined?_0xeeef('0x29'):_0x44c891;_0x498993=_0x498993===undefined?'5':_0x498993;_0x9debdc=_0x9debdc===undefined?'1':_0x9debdc;return this[_0xeeef('0x24')](util['format']('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x44c891,_0x498993*0x3e8,_0x9debdc));};AGIChannel['prototype'][_0xeeef('0x2a')]=function(_0x287af7){_0x287af7=_0x287af7||_0xeeef('0x2b');return this['sendRequest'](util[_0xeeef('0x2c')](_0xeeef('0x2d'),_0x287af7));};AGIChannel['prototype'][_0xeeef('0x2e')]=function(_0x1d96c2,_0x2bc95f){if(_[_0xeeef('0x2f')](_0x2bc95f)){return this[_0xeeef('0x24')](util[_0xeeef('0x2c')](_0xeeef('0x30'),_0x1d96c2,_0x2bc95f[_0xeeef('0x31')](',')));}return this[_0xeeef('0x24')](util[_0xeeef('0x2c')](_0xeeef('0x30'),_0x1d96c2,_0x2bc95f));};AGIChannel[_0xeeef('0x23')][_0xeeef('0x32')]=function(_0x296e67){return this[_0xeeef('0x24')](util['format']('SET\x20CONTEXT\x20%s',_0x296e67));};AGIChannel[_0xeeef('0x23')][_0xeeef('0x33')]=function(_0x48ecf8){return this[_0xeeef('0x24')](util[_0xeeef('0x2c')](_0xeeef('0x34'),_0x48ecf8));};AGIChannel[_0xeeef('0x23')][_0xeeef('0x35')]=function(_0x4ffac7){return this[_0xeeef('0x24')](util[_0xeeef('0x2c')](_0xeeef('0x36'),_0x4ffac7));};AGIChannel[_0xeeef('0x23')][_0xeeef('0xc')]=function(){return this[_0xeeef('0x24')](_0xeeef('0x37'));};AGIChannel[_0xeeef('0x23')]['setVariable']=function(_0xb1ca99,_0x16b6bc){var _0x2ca6cd=_[_0xeeef('0x38')](_0x16b6bc)||_['isNumber'](_0x16b6bc)?_0x16b6bc[_0xeeef('0x39')]():_0x16b6bc;return this[_0xeeef('0x24')](util[_0xeeef('0x2c')](_0xeeef('0x3a'),_0xb1ca99,_0x2ca6cd?_0x2ca6cd[_0xeeef('0x39')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0xeeef('0x3b')]=function(_0x15681e,_0x4897b9){return this['sendRequest'](util['format'](_0xeeef('0x3c'),_0x15681e,_0x4897b9));};AGIChannel[_0xeeef('0x23')][_0xeeef('0x3d')]=function(_0x10736b,_0x1e374f){return this[_0xeeef('0x24')](util[_0xeeef('0x2c')](_0xeeef('0x3e'),_0x10736b,_0x1e374f));};AGIChannel[_0xeeef('0x23')][_0xeeef('0x3f')]=function(_0x50a34b,_0x8ab526){return this['sendRequest'](util['format'](_0xeeef('0x40'),_0x50a34b,_0x8ab526));};AGIChannel['prototype'][_0xeeef('0x41')]=function(_0x52cfc8,_0x4a0f19,_0x5977b3){_0x4a0f19=_0x4a0f19||this[_0xeeef('0x42')];_0x5977b3=_0x5977b3||0x1;this[_0xeeef('0x32')](_0x52cfc8);this[_0xeeef('0x33')](_0x4a0f19);this[_0xeeef('0x35')](_0x5977b3);return this[_0xeeef('0x2a')](util[_0xeeef('0x2c')](_0xeeef('0x43'),_0x52cfc8,_0x4a0f19,_0x5977b3));};AGIChannel[_0xeeef('0x23')][_0xeeef('0x44')]=function(_0x52d5f5){return this[_0xeeef('0x24')](util[_0xeeef('0x2c')](_0xeeef('0x45'),_0x52d5f5));};AGIChannel['prototype'][_0xeeef('0x46')]=function(_0x482184,_0x125361,_0x5346ce,_0x160446,_0x368dbd,_0x283c3c){_0x125361=_0x125361||_0xeeef('0x47');_0x5346ce=_0x5346ce||'';_0x160446=_0x160446===undefined?-0x1:_0x160446==='-1'?-0x1:_0x160446*0x3e8;_0x368dbd=_0x368dbd===undefined?'':'s='+_0x368dbd;_0x283c3c=_0x283c3c?'BEEP':'';return this[_0xeeef('0x24')](util[_0xeeef('0x2c')](_0xeeef('0x48'),_0x482184,_0x125361,_0x5346ce,_0x160446,_0x283c3c,_0x368dbd));};AGIChannel['prototype'][_0xeeef('0x49')]=function(_0x2dfff9,_0x47b900){_0x47b900=_0x47b900||'';return this['sendRequest'](util['format'](_0xeeef('0x4a'),_0x2dfff9,_0x47b900));};AGIChannel[_0xeeef('0x23')][_0xeeef('0x4b')]=function(_0x59f3f9){return this[_0xeeef('0x2e')](_0xeeef('0x4c'),_0x59f3f9);};AGIChannel['prototype'][_0xeeef('0x4d')]=function(_0x5cb234){return this[_0xeeef('0x2e')](_0xeeef('0x4e'),_0x5cb234);};AGIChannel['prototype'][_0xeeef('0x18')]=function(_0x48b05d,_0x4241c8){this[_0xeeef('0x2a')](util['format'](_0xeeef('0x4f'),_0x48b05d['id'],_0x48b05d[_0xeeef('0x50')],_0x4241c8));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xeeef('0x51')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 56daa6b..d0a6340 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 _0xdd47=['Undefined\x20error.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Empty\x20command.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','message','exports','util'];(function(_0x5d27f2,_0x4628f3){var _0x4c8b1b=function(_0x54e850){while(--_0x54e850){_0x5d27f2['push'](_0x5d27f2['shift']());}};_0x4c8b1b(++_0x4628f3);}(_0xdd47,0xe0));var _0x7dd4=function(_0x2c5340,_0x5c86e5){_0x2c5340=_0x2c5340-0x0;var _0x3c505e=_0xdd47[_0x2c5340];return _0x3c505e;};'use strict';var util=require(_0x7dd4('0x0'));var error={'E_AGI_UNDEFINED':_0x7dd4('0x1'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0x7dd4('0x2'),'E_AGI_SERVER_CLOSE':_0x7dd4('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0x7dd4('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0x7dd4('0x5'),'E_AGI_SOCKET_ERROR':_0x7dd4('0x6'),'E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':_0x7dd4('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0x7dd4('0x8')};function AGIError(_0x405155){var _0x405155=_0x405155||null,_0x3d52ec=_0x3d52ec||[],_0x263037=0x1,_0x17214a='';if(!error[_0x405155]){_0x405155=_0x7dd4('0x9');}_0x3d52ec['push'](error[_0x405155]);while(arguments[_0x263037]){_0x3d52ec[_0x7dd4('0xa')](arguments[_0x263037]);_0x263037++;}_0x17214a=util[_0x7dd4('0xb')][_0x7dd4('0xc')](util,_0x3d52ec);this[_0x7dd4('0xd')]=_0x17214a;this['name']=_0x405155;}module[_0x7dd4('0xe')]=AGIError; \ No newline at end of file +var _0x3b87=['Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','message','exports','util','Undefined\x20error.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','Socket\x20error.\x20Code:\x20%s.'];(function(_0x17406e,_0x1049fd){var _0x2bfc5a=function(_0x2aae05){while(--_0x2aae05){_0x17406e['push'](_0x17406e['shift']());}};_0x2bfc5a(++_0x1049fd);}(_0x3b87,0x14e));var _0x73b8=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x3b87[_0x1d1779];return _0x2377e9;};'use strict';var util=require(_0x73b8('0x0'));var error={'E_AGI_UNDEFINED':_0x73b8('0x1'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0x73b8('0x2'),'E_AGI_SERVER_CLOSE':_0x73b8('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0x73b8('0x4'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0x73b8('0x5'),'E_AGI_SOCKET_CLOSE':_0x73b8('0x6'),'E_AGI_SOCKET_TIMEOUT':_0x73b8('0x7'),'E_AGI_COMMAND_EMPTY':_0x73b8('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x73b8('0x9'),'E_AGI_IVR_ENTRY':_0x73b8('0xa')};function AGIError(_0x3c6a62){var _0x3c6a62=_0x3c6a62||null,_0x4a3f51=_0x4a3f51||[],_0x258d66=0x1,_0x1cdaed='';if(!error[_0x3c6a62]){_0x3c6a62=_0x73b8('0xb');}_0x4a3f51['push'](error[_0x3c6a62]);while(arguments[_0x258d66]){_0x4a3f51[_0x73b8('0xc')](arguments[_0x258d66]);_0x258d66++;}_0x1cdaed=util[_0x73b8('0xd')][_0x73b8('0xe')](util,_0x4a3f51);this[_0x73b8('0xf')]=_0x1cdaed;this['name']=_0x3c6a62;}module[_0x73b8('0x10')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index 64f7d6e..7b84ae5 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 _0x4b5a=['ioredis','./error','../../config/environment','defaults','redis','subscribe','agi','emit','E_AGI_SERVER_ERROR','parse','projectUpdate','error','exports','lodash','events','EventEmitter'];(function(_0x1be57b,_0x1c815c){var _0xb45a63=function(_0x2eb526){while(--_0x2eb526){_0x1be57b['push'](_0x1be57b['shift']());}};_0xb45a63(++_0x1c815c);}(_0x4b5a,0x1ed));var _0xa4b5=function(_0x504259,_0x37478c){_0x504259=_0x504259-0x0;var _0x82a590=_0x4b5a[_0x504259];return _0x82a590;};'use strict';var _=require(_0xa4b5('0x0'));var EventEmitter=require(_0xa4b5('0x1'))[_0xa4b5('0x2')];var Redis=require(_0xa4b5('0x3'));var AGIError=require(_0xa4b5('0x4'));var config=require(_0xa4b5('0x5'));config['redis']=_[_0xa4b5('0x6')](config[_0xa4b5('0x7')],{'host':'localhost','port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config['redis']);sub[_0xa4b5('0x8')](_0xa4b5('0x9'),function(_0x4a3173){if(_0x4a3173)return eventEmitter[_0xa4b5('0xa')]('error',new AGIError(_0xa4b5('0xb'),_0x4a3173));});sub['on']('message',function(_0x537e7b,_0x43b77c){if(_0x537e7b!==_0xa4b5('0x9'))return;try{var _0x21f101=JSON[_0xa4b5('0xc')](_0x43b77c);eventEmitter[_0xa4b5('0xa')](_0xa4b5('0xd'),_0x21f101);}catch(_0x6c8a6a){eventEmitter[_0xa4b5('0xa')](_0xa4b5('0xe'),new AGIError(_0xa4b5('0xb'),_0x6c8a6a));}});module[_0xa4b5('0xf')]={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0xe515=['subscribe','emit','agi','parse','projectUpdate','error','exports','lodash','events','EventEmitter','ioredis','./error','redis','localhost'];(function(_0x354df3,_0x528300){var _0x53ac34=function(_0x345af1){while(--_0x345af1){_0x354df3['push'](_0x354df3['shift']());}};_0x53ac34(++_0x528300);}(_0xe515,0x1b9));var _0x5e51=function(_0x43edd1,_0xf14003){_0x43edd1=_0x43edd1-0x0;var _0x43bb9e=_0xe515[_0x43edd1];return _0x43bb9e;};'use strict';var _=require(_0x5e51('0x0'));var EventEmitter=require(_0x5e51('0x1'))[_0x5e51('0x2')];var Redis=require(_0x5e51('0x3'));var AGIError=require(_0x5e51('0x4'));var config=require('../../config/environment');config['redis']=_['defaults'](config[_0x5e51('0x5')],{'host':_0x5e51('0x6'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x5e51('0x5')]);sub[_0x5e51('0x7')]('agi',function(_0x27fcc6){if(_0x27fcc6)return eventEmitter[_0x5e51('0x8')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x27fcc6));});sub['on']('message',function(_0x592aac,_0x11fa8d){if(_0x592aac!==_0x5e51('0x9'))return;try{var _0x161a76=JSON[_0x5e51('0xa')](_0x11fa8d);eventEmitter[_0x5e51('0x8')](_0x5e51('0xb'),_0x161a76);}catch(_0x315165){eventEmitter[_0x5e51('0x8')](_0x5e51('0xc'),new AGIError('E_AGI_SERVER_ERROR',_0x315165));}});module[_0x5e51('0xd')]={'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 581643e..3a2c364 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 _0x5269=['no\x20edge/s\x20available','condition','agicommand','vswitch','default','target','length','default\x20on\x20switch\x20not\x20found','max\x20retry\x20reach','condition\x20not\x20found','exports','lodash','getsecretdigits','vertices','edges','addVertex','prototype','addEdge','push','numberOfEdges','size','getVertex','traverseBFS','no\x20vertex\x20found','info'];(function(_0x609095,_0x76edbd){var _0x35e4bb=function(_0x8e7d98){while(--_0x8e7d98){_0x609095['push'](_0x609095['shift']());}};_0x35e4bb(++_0x76edbd);}(_0x5269,0x150));var _0x9526=function(_0x541d5e,_0x4d73f9){_0x541d5e=_0x541d5e-0x0;var _0x32086c=_0x5269[_0x541d5e];return _0x32086c;};'use strict';var _=require(_0x9526('0x0'));var logger=require('../../../config/logger')('agi');var verticesWithRetry=['menu','getdigits',_0x9526('0x1')];var Graph=function(){this[_0x9526('0x2')]={};this[_0x9526('0x3')]={};this['numberOfEdges']=0x0;};Graph['prototype'][_0x9526('0x4')]=function(_0x59bf4c){this[_0x9526('0x2')][_0x59bf4c['id']]=_0x59bf4c;this[_0x9526('0x3')][_0x59bf4c['id']]=[];};Graph[_0x9526('0x5')][_0x9526('0x6')]=function(_0x1d4acf,_0x4569a0,_0x161880){this[_0x9526('0x3')][_0x1d4acf][_0x9526('0x7')]({'target':_0x4569a0,'condition':_0x161880});this[_0x9526('0x8')]+=0x1;};Graph[_0x9526('0x5')][_0x9526('0x9')]=function(){return _['size'](this[_0x9526('0x2')]);};Graph[_0x9526('0x5')]['relations']=function(){return this[_0x9526('0x8')];};Graph[_0x9526('0x5')][_0x9526('0xa')]=function(_0x7c8bfb){return this[_0x9526('0x2')][_0x7c8bfb];};Graph[_0x9526('0x5')][_0x9526('0xb')]=function(_0x487158,_0x14ce60){if(!this[_0x9526('0x2')][_0x487158]){return logger['info'](_0x9526('0xc'));}var _0x13ca39=_0x14ce60(this['vertices'][_0x487158]);if(!_0x13ca39){return logger['info']('stop\x20traverse');}if(this[_0x9526('0x3')][_0x487158]['length']===0x0){return logger[_0x9526('0xd')](_0x9526('0xe'));}for(var _0x3c99df=0x0,_0x10f8ce=[],_0x3108ba=![];_0x3c99df\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','hasOwnProperty','agi_','substring','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','hangup','find','production','handleUnpublished','initialize','then'];(function(_0x1a014b,_0x48acae){var _0x462258=function(_0x1473be){while(--_0x1473be){_0x1a014b['push'](_0x1a014b['shift']());}};_0x462258(++_0x48acae);}(_0xeb84,0x133));var _0x4eb8=function(_0x28fbbf,_0x11f896){_0x28fbbf=_0x28fbbf-0x0;var _0x543af6=_0xeb84[_0x28fbbf];return _0x543af6;};'use strict';var _=require('lodash');var syncho=require(_0x4eb8('0x0'));var util=require('util');var config=require(_0x4eb8('0x1'));var logger=require(_0x4eb8('0x2'))(_0x4eb8('0x3'));var utilLicense=require(_0x4eb8('0x4'));var rpc=require(_0x4eb8('0x5'));var Project=require(_0x4eb8('0x6'));var AGIEmitter=require(_0x4eb8('0x7'))[_0x4eb8('0x8')];var projects=[];config[_0x4eb8('0x3')]=_[_0x4eb8('0x9')](config[_0x4eb8('0x3')],{'ip':_0x4eb8('0xa'),'port':0x11dd});AGIEmitter['on'](_0x4eb8('0xb'),projectUpdateHandler);function connectionHandler(_0x793dc1){process[_0x4eb8('0xc')](function(){syncho(function(){try{setChannelVariables(_0x793dc1);agiHandler(_0x793dc1);}catch(_0x441587){logger[_0x4eb8('0xd')](_0x441587[_0x4eb8('0xe')]);}});});}function projectUpdateHandler(_0x53722b){try{var _0x4eecfd=_[_0x4eb8('0xf')](projects,['id',_0x53722b['id']]);if(_0x4eecfd>-0x1){if(_0x53722b[_0x4eb8('0x10')]===!![]){projects[_0x4eb8('0x11')](_0x4eecfd,0x1);}else{projects[_0x4eecfd]=_0x53722b;}}else{projects[_0x4eb8('0x12')](_0x53722b);}}catch(_0x36e2bd){logger['error'](_0x36e2bd['stack']);}}function listeningHandler(){console[_0x4eb8('0x13')](_0x4eb8('0x14'),config[_0x4eb8('0x3')][_0x4eb8('0x15')]);logger[_0x4eb8('0x16')](util[_0x4eb8('0x17')](_0x4eb8('0x18'),config[_0x4eb8('0x3')]['ip'],config[_0x4eb8('0x3')][_0x4eb8('0x15')]));}function errorHandler(_0x5349d9){if(_0x5349d9&&_0x5349d9['name']&&_0x5349d9[_0x4eb8('0x19')]){logger[_0x4eb8('0xd')](util[_0x4eb8('0x17')](_0x4eb8('0x1a'),_0x5349d9[_0x4eb8('0x1b')],_0x5349d9['message']));}else{logger['error'](util[_0x4eb8('0x17')](_0x4eb8('0x1c'),_0x5349d9['stack']));}}function closeHandler(){logger[_0x4eb8('0x16')](util[_0x4eb8('0x17')](_0x4eb8('0x1d'),this[_0x4eb8('0x1e')],this['calleridname'],this[_0x4eb8('0x1f')],this[_0x4eb8('0x20')],this[_0x4eb8('0x21')]));try{createSquareReport(this);}catch(_0x1f298d){logger[_0x4eb8('0xd')](_0x1f298d[_0x4eb8('0xe')]);}}function timeoutHandler(){logger[_0x4eb8('0x16')](util[_0x4eb8('0x17')](_0x4eb8('0x22'),this[_0x4eb8('0x1e')],this[_0x4eb8('0x23')],this[_0x4eb8('0x1f')],this[_0x4eb8('0x20')],this[_0x4eb8('0x21')]));}function hangupHandler(){logger['info'](util[_0x4eb8('0x17')](_0x4eb8('0x24'),this[_0x4eb8('0x1e')],this[_0x4eb8('0x23')],this[_0x4eb8('0x1f')],this[_0x4eb8('0x20')],this['uniqueid']));this[_0x4eb8('0x25')]=!![];}function createSquareReport(_0x406521,_0x590091){rpc[_0x4eb8('0x26')](_0x406521)['then'](function(_0x400dc7){if(_0x590091){_0x590091(null,_0x400dc7);}})['catch'](function(_0x4d729b){if(_0x590091){_0x590091(null,_0x4d729b);}});}function setChannelVariables(_0x5cdd6f){for(var _0x1dff92 in _0x5cdd6f){if(_0x5cdd6f[_0x4eb8('0x27')](_0x1dff92)){if(_0x1dff92['indexOf'](_0x4eb8('0x28'))===0x0){_0x5cdd6f[_0x1dff92[_0x4eb8('0x29')](0x4)]=_0x5cdd6f[_0x1dff92];delete _0x5cdd6f[_0x1dff92];}}}}function agiHandler(_0x620828){logger[_0x4eb8('0x2a')](_0x4eb8('0x2b'),JSON[_0x4eb8('0x2c')](_0x620828,null,0x2));logger[_0x4eb8('0x16')](util[_0x4eb8('0x17')](_0x4eb8('0x2d'),_0x620828['arg_1'],_0x620828[_0x4eb8('0x23')],_0x620828[_0x4eb8('0x1f')],_0x620828[_0x4eb8('0x20')],_0x620828[_0x4eb8('0x21')]));_0x620828['on'](_0x4eb8('0xd'),errorHandler);_0x620828['on'](_0x4eb8('0x2e'),closeHandler);_0x620828['on']('timeout',timeoutHandler);_0x620828[_0x4eb8('0x25')]=![];_0x620828['on'](_0x4eb8('0x2f'),hangupHandler);var _0x54abc3=_[_0x4eb8('0x30')](projects,['name',_0x620828['arg_1']]);if(!_0x54abc3)return Project['handleNotFound'](_0x620828);if(!_0x54abc3[_0x4eb8('0x31')])return Project[_0x4eb8('0x32')](_0x620828);return Project[_0x4eb8('0x33')](_0x54abc3,_0x620828);}function main(){var _0x95667b;return utilLicense['getLicense']()[_0x4eb8('0x34')](function(_0xeb194f){if(!_0xeb194f)return;if(_0xeb194f[_0x4eb8('0x35')]){if(_0xeb194f[_0x4eb8('0x36')]&&_0xeb194f[_0x4eb8('0x36')]>0x0){logger[_0x4eb8('0x16')](util[_0x4eb8('0x17')](_0x4eb8('0x37'),_0xeb194f[_0x4eb8('0x36')]));_0x95667b=_0xeb194f['callysquare'];}else{logger[_0x4eb8('0x16')](_0x4eb8('0x38'));}}else{logger['info']('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x95667b=-0x1;}})['then'](function(){return Project['getAll']();})[_0x4eb8('0x34')](function(_0x1fc675){projects=_0x1fc675;return;})['catch'](function(_0x49e01a){logger['error'](_0x4eb8('0x39'),_0x49e01a[_0x4eb8('0xe')]);})['finally'](function(){var _0x4bb7a9=require(_0x4eb8('0x3a'))(config[_0x4eb8('0x3')][_0x4eb8('0x15')],config[_0x4eb8('0x3')]['ip'],_0x95667b);_0x4bb7a9['on'](_0x4eb8('0xd'),errorHandler);_0x4bb7a9['on']('listening',listeningHandler);_0x4bb7a9['on'](_0x4eb8('0x3b'),connectionHandler);_0x4bb7a9['on'](_0x4eb8('0x2e'),closeHandler);});}main(); \ No newline at end of file +var _0x95cd=['port','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[%s]\x20%s','format','[ERROR]\x20%s','info','arg_1','calleridname','callerid','dnid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','uniqueid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','then','catch','hasOwnProperty','indexOf','substring','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','find','production','initialize','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20VOICE\x20IS\x20DISABLED','listening','connection','lodash','util','../../config/environment','../../config/logger','../../config/license/util','./rpc','./project','./events','agi','127.0.0.1','projectUpdate','nextTick','findIndex','deleted','splice','push','error','stack','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!'];(function(_0x3df871,_0xda2e11){var _0x570f7b=function(_0xfaac78){while(--_0xfaac78){_0x3df871['push'](_0x3df871['shift']());}};_0x570f7b(++_0xda2e11);}(_0x95cd,0x10e));var _0xd95c=function(_0x4caf9e,_0xae9ebe){_0x4caf9e=_0x4caf9e-0x0;var _0x1bcb17=_0x95cd[_0x4caf9e];return _0x1bcb17;};'use strict';var _=require(_0xd95c('0x0'));var syncho=require('syncho');var util=require(_0xd95c('0x1'));var config=require(_0xd95c('0x2'));var logger=require(_0xd95c('0x3'))('agi');var utilLicense=require(_0xd95c('0x4'));var rpc=require(_0xd95c('0x5'));var Project=require(_0xd95c('0x6'));var AGIEmitter=require(_0xd95c('0x7'))['EventEmitter'];var projects=[];config[_0xd95c('0x8')]=_['defaults'](config['agi'],{'ip':_0xd95c('0x9'),'port':0x11dd});AGIEmitter['on'](_0xd95c('0xa'),projectUpdateHandler);function connectionHandler(_0x4fa641){process[_0xd95c('0xb')](function(){syncho(function(){try{setChannelVariables(_0x4fa641);agiHandler(_0x4fa641);}catch(_0x121790){logger['error'](_0x121790['stack']);}});});}function projectUpdateHandler(_0x2e45bb){try{var _0x219529=_[_0xd95c('0xc')](projects,['id',_0x2e45bb['id']]);if(_0x219529>-0x1){if(_0x2e45bb[_0xd95c('0xd')]===!![]){projects[_0xd95c('0xe')](_0x219529,0x1);}else{projects[_0x219529]=_0x2e45bb;}}else{projects[_0xd95c('0xf')](_0x2e45bb);}}catch(_0x39ab67){logger[_0xd95c('0x10')](_0x39ab67[_0xd95c('0x11')]);}}function listeningHandler(){console[_0xd95c('0x12')](_0xd95c('0x13'),config['agi'][_0xd95c('0x14')]);logger['info'](util['format'](_0xd95c('0x15'),config[_0xd95c('0x8')]['ip'],config[_0xd95c('0x8')][_0xd95c('0x14')]));}function errorHandler(_0x2c1464){if(_0x2c1464&&_0x2c1464[_0xd95c('0x16')]&&_0x2c1464[_0xd95c('0x17')]){logger['error'](util['format'](_0xd95c('0x18'),_0x2c1464[_0xd95c('0x16')],_0x2c1464[_0xd95c('0x17')]));}else{logger[_0xd95c('0x10')](util[_0xd95c('0x19')](_0xd95c('0x1a'),_0x2c1464[_0xd95c('0x11')]));}}function closeHandler(){logger[_0xd95c('0x1b')](util[_0xd95c('0x19')]('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xd95c('0x1c')],this[_0xd95c('0x1d')],this[_0xd95c('0x1e')],this[_0xd95c('0x1f')],this['uniqueid']));try{createSquareReport(this);}catch(_0x18c849){logger['error'](_0x18c849[_0xd95c('0x11')]);}}function timeoutHandler(){logger['info'](util['format'](_0xd95c('0x20'),this[_0xd95c('0x1c')],this[_0xd95c('0x1d')],this[_0xd95c('0x1e')],this[_0xd95c('0x1f')],this[_0xd95c('0x21')]));}function hangupHandler(){logger[_0xd95c('0x1b')](util[_0xd95c('0x19')](_0xd95c('0x22'),this['arg_1'],this['calleridname'],this[_0xd95c('0x1e')],this[_0xd95c('0x1f')],this[_0xd95c('0x21')]));this[_0xd95c('0x23')]=!![];}function createSquareReport(_0x319aca,_0x1ecf2c){rpc[_0xd95c('0x24')](_0x319aca)[_0xd95c('0x25')](function(_0x3a2e46){if(_0x1ecf2c){_0x1ecf2c(null,_0x3a2e46);}})[_0xd95c('0x26')](function(_0x2098e3){if(_0x1ecf2c){_0x1ecf2c(null,_0x2098e3);}});}function setChannelVariables(_0x3762e1){for(var _0x9d8f69 in _0x3762e1){if(_0x3762e1[_0xd95c('0x27')](_0x9d8f69)){if(_0x9d8f69[_0xd95c('0x28')]('agi_')===0x0){_0x3762e1[_0x9d8f69[_0xd95c('0x29')](0x4)]=_0x3762e1[_0x9d8f69];delete _0x3762e1[_0x9d8f69];}}}}function agiHandler(_0x3d2a6a){logger['debug'](_0xd95c('0x2a'),JSON[_0xd95c('0x2b')](_0x3d2a6a,null,0x2));logger[_0xd95c('0x1b')](util[_0xd95c('0x19')](_0xd95c('0x2c'),_0x3d2a6a[_0xd95c('0x1c')],_0x3d2a6a['calleridname'],_0x3d2a6a[_0xd95c('0x1e')],_0x3d2a6a[_0xd95c('0x1f')],_0x3d2a6a[_0xd95c('0x21')]));_0x3d2a6a['on']('error',errorHandler);_0x3d2a6a['on'](_0xd95c('0x2d'),closeHandler);_0x3d2a6a['on'](_0xd95c('0x2e'),timeoutHandler);_0x3d2a6a[_0xd95c('0x23')]=![];_0x3d2a6a['on'](_0xd95c('0x2f'),hangupHandler);var _0x3b5945=_[_0xd95c('0x30')](projects,['name',_0x3d2a6a['arg_1']]);if(!_0x3b5945)return Project['handleNotFound'](_0x3d2a6a);if(!_0x3b5945[_0xd95c('0x31')])return Project['handleUnpublished'](_0x3d2a6a);return Project[_0xd95c('0x32')](_0x3b5945,_0x3d2a6a);}function main(){var _0x44b007;return utilLicense[_0xd95c('0x33')]()[_0xd95c('0x25')](function(_0x3f4889){if(!_0x3f4889)return;if(_0x3f4889[_0xd95c('0x34')]){if(_0x3f4889[_0xd95c('0x35')]&&_0x3f4889[_0xd95c('0x35')]>0x0){logger['info'](util['format'](_0xd95c('0x36'),_0x3f4889['callysquare']));_0x44b007=_0x3f4889[_0xd95c('0x35')];}else{logger[_0xd95c('0x1b')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0xd95c('0x1b')](_0xd95c('0x37'));_0x44b007=-0x1;}})[_0xd95c('0x25')](function(){return Project['getAll']();})[_0xd95c('0x25')](function(_0x5be53a){projects=_0x5be53a;return;})[_0xd95c('0x26')](function(_0x13e691){logger['error']('[LICENSE]',_0x13e691[_0xd95c('0x11')]);})['finally'](function(){var _0x4a2319=require('./server')(config[_0xd95c('0x8')][_0xd95c('0x14')],config[_0xd95c('0x8')]['ip'],_0x44b007);_0x4a2319['on']('error',errorHandler);_0x4a2319['on'](_0xd95c('0x38'),listeningHandler);_0x4a2319['on'](_0xd95c('0x39'),connectionHandler);_0x4a2319['on'](_0xd95c('0x2d'),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 b28abff..5a3159a 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 _0xe959=['error','message','result','sendMailMessage','bluebird','jayson/promise','client','request','then'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0xe959,0x175));var _0x9e95=function(_0x580f00,_0x22a86d){_0x580f00=_0x580f00-0x0;var _0x3e9f6f=_0xe959[_0x580f00];return _0x3e9f6f;};'use strict';var BPromise=require(_0x9e95('0x0'));var jayson=require(_0x9e95('0x1'));var client=jayson[_0x9e95('0x2')]['http']({'port':0x232b});function request(_0x3c3a8c,_0x5584c5){return new BPromise(function(_0x32e8c9,_0x762b8e){return client[_0x9e95('0x3')](_0x3c3a8c,_0x5584c5)[_0x9e95('0x4')](function(_0x509369){if(_0x509369[_0x9e95('0x5')]){return _0x762b8e(_0x509369[_0x9e95('0x5')][_0x9e95('0x6')]);}else{return _0x32e8c9(_0x509369[_0x9e95('0x7')]);}})['catch'](function(_0x457cad){return _0x762b8e(_0x457cad);});});}exports[_0x9e95('0x8')]=function(_0x4da265,_0x23b477){return request('SendMail',{'account':_0x4da265,'message':_0x23b477});}; \ No newline at end of file +var _0x141b=['error','message','result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','request','then'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x141b,0xa0));var _0xb141=function(_0x5f2ba2,_0x48d4ce){_0x5f2ba2=_0x5f2ba2-0x0;var _0x2936f8=_0x141b[_0x5f2ba2];return _0x2936f8;};'use strict';var BPromise=require(_0xb141('0x0'));var jayson=require(_0xb141('0x1'));var client=jayson[_0xb141('0x2')]['http']({'port':0x232b});function request(_0xcd74,_0x336008){return new BPromise(function(_0x4f377e,_0x521864){return client[_0xb141('0x3')](_0xcd74,_0x336008)[_0xb141('0x4')](function(_0x398cb9){if(_0x398cb9[_0xb141('0x5')]){return _0x521864(_0x398cb9['error'][_0xb141('0x6')]);}else{return _0x4f377e(_0x398cb9[_0xb141('0x7')]);}})[_0xb141('0x8')](function(_0x38ece3){return _0x521864(_0x38ece3);});});}exports[_0xb141('0x9')]=function(_0x48fc52,_0x17f170){return request(_0xb141('0xa'),{'account':_0x48fc52,'message':_0x17f170});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index bb8214b..ac292e6 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 _0xbb29=['uniqueid','start','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','code','result','evtHangup','response','isUndefined','toString','error','agicommand\x20not\x20found','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','traverseBFS','finally','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close','Project\x20%s\x20not\x20published','exports','lodash','moment','xml2json','util','../../config/logger','./mailRpc','./graph','./vertices','getSquareProjects','catch','stack','agicommand','retry','maxRetry','omit','mxCell','hasOwnProperty','length','source','target','addEdge','value','mxGraphModel','root','inspect','debug','stringify','joinAt','format','YYYY-MM-DD\x20HH:mm:ss','info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','callerid','dnid'];(function(_0x14139f,_0x4c8b38){var _0x533dab=function(_0x52c842){while(--_0x52c842){_0x14139f['push'](_0x14139f['shift']());}};_0x533dab(++_0x4c8b38);}(_0xbb29,0x18f));var _0x9bb2=function(_0x54c0ee,_0x45aa93){_0x54c0ee=_0x54c0ee-0x0;var _0x3fe258=_0xbb29[_0x54c0ee];return _0x3fe258;};'use strict';var _=require(_0x9bb2('0x0'));var moment=require(_0x9bb2('0x1'));var parser=require(_0x9bb2('0x2'));var util=require(_0x9bb2('0x3'));var logger=require(_0x9bb2('0x4'))('agi');var rpc=require('./rpc');var mailRpc=require(_0x9bb2('0x5'));var Graph=require(_0x9bb2('0x6'));var Vertices=require(_0x9bb2('0x7'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x9bb2('0x8')]()[_0x9bb2('0x9')](function(_0x352d71){logger['error']('Unable\x20to\x20download\x20CallySquare\x20projects',_0x352d71[_0x9bb2('0xa')]);return[];});}function addVertex(_0x307e5a,_0x1f24bd,_0x2784ca){_0x1f24bd[_0x9bb2('0xb')]=_0x2784ca;if(_0x1f24bd['hasOwnProperty'](_0x9bb2('0xc'))){_0x1f24bd[_0x9bb2('0xd')]=parseInt(_0x1f24bd[_0x9bb2('0xc')],0xa);}_0x307e5a['addVertex'](_[_0x9bb2('0xe')](_0x1f24bd,_0x9bb2('0xf')));}function initGraph(_0x27c698,_0x5e70cb){var _0x196363=new Graph();for(var _0x359ac6 in _0x27c698){if(_0x27c698[_0x9bb2('0x10')](_0x359ac6)){if(_['isArray'](_0x27c698[_0x359ac6])){for(var _0x3202b7=0x0;_0x3202b7<_0x27c698[_0x359ac6]['length'];_0x3202b7+=0x1){addVertex(_0x196363,_0x27c698[_0x359ac6][_0x3202b7],_0x359ac6);}}else{addVertex(_0x196363,_0x27c698[_0x359ac6],_0x359ac6);}}}for(var _0x272613=0x0;_0x272613<_0x5e70cb[_0x9bb2('0x11')];_0x272613+=0x1){if(_0x5e70cb[_0x272613][_0x9bb2('0x12')]&&_0x5e70cb[_0x272613][_0x9bb2('0x13')]){_0x196363[_0x9bb2('0x14')](_0x5e70cb[_0x272613][_0x9bb2('0x12')],_0x5e70cb[_0x272613][_0x9bb2('0x13')],_0x5e70cb[_0x272613][_0x9bb2('0x15')]);}}return _0x196363;}function getRoot(_0x41cbea){return parser['toJson'](_0x41cbea,{'object':!![]})[_0x9bb2('0x16')][_0x9bb2('0x17')];}function inspect(_0x3f2905){return util[_0x9bb2('0x18')](_0x3f2905,{'showHidden':![],'depth':null});}function initialize(_0x292773,_0x22ecf8){var _0x34bad1=getRoot(_0x292773['production']);if(!_0x34bad1||!_0x34bad1['start'])return;var _0x4ff43f,_0x3bc4d9,_0x5bc1fb;logger[_0x9bb2('0x19')]('root',JSON[_0x9bb2('0x1a')](_0x34bad1,null,0x2));_0x22ecf8[_0x9bb2('0x1b')]=moment()[_0x9bb2('0x1c')](_0x9bb2('0x1d'));_0x4ff43f=initGraph(_[_0x9bb2('0xe')](_0x34bad1,_0x9bb2('0xf')),_0x34bad1[_0x9bb2('0xf')]);_0x3bc4d9=new Vertices(_0x22ecf8,rpc,mailRpc);logger[_0x9bb2('0x1e')](util['format'](_0x9bb2('0x1f'),_0x22ecf8[_0x9bb2('0x20')],_0x22ecf8['calleridname'],_0x22ecf8[_0x9bb2('0x21')],_0x22ecf8[_0x9bb2('0x22')],_0x22ecf8[_0x9bb2('0x23')]));_0x4ff43f['traverseBFS'](_0x34bad1[_0x9bb2('0x24')]['id'],function(_0x387b45){try{_0x387b45=_0x3bc4d9[_0x9bb2('0x25')](_0x387b45);logger[_0x9bb2('0x19')](_0x9bb2('0x26'),JSON[_0x9bb2('0x1a')](_0x387b45,null,0x2));if(_0x387b45[_0x9bb2('0xb')]===_0x9bb2('0x27')){logger[_0x9bb2('0x1e')](_0x9bb2('0x28'));_0x22ecf8[_0x9bb2('0x29')]=_0x387b45[_0x9bb2('0x29')]||_0x22ecf8[_0x9bb2('0x29')];_0x22ecf8[_0x9bb2('0x2a')]=_0x387b45[_0x9bb2('0x2a')];_0x22ecf8[_0x9bb2('0x2b')]=_0x387b45[_0x9bb2('0x2b')]?_0x387b45[_0x9bb2('0x2b')]-0x1:0x1;return null;}else if(_0x387b45&&_0x3bc4d9[_0x387b45['agicommand']]){_0x5bc1fb=_0x3bc4d9[_0x387b45[_0x9bb2('0xb')]](_0x387b45);logger[_0x9bb2('0x1e')]('response',JSON['stringify'](_0x5bc1fb,null,0x2));if(_0x5bc1fb&&_0x5bc1fb[_0x9bb2('0x2c')]===AGI_CODE_SUCCESS&&_0x5bc1fb[_0x9bb2('0x2d')]!==AGI_RESULT_ERROR&&!_0x22ecf8[_0x9bb2('0x2e')]){logger['debug'](_0x9bb2('0x2f'),inspect(_0x5bc1fb));return _[_0x9bb2('0x30')](_0x5bc1fb['result'])?null:_0x5bc1fb[_0x9bb2('0x2d')][_0x9bb2('0x31')]();}else{logger['error'](_0x9bb2('0x2f'),inspect(_0x5bc1fb));return null;}}else{logger[_0x9bb2('0x32')](_0x9bb2('0x33'));return null;}}catch(_0x40fc35){logger[_0x9bb2('0x32')](_0x40fc35[_0x9bb2('0xa')]);return null;}});if(_0x34bad1['finally']){logger[_0x9bb2('0x1e')](util[_0x9bb2('0x1c')](_0x9bb2('0x34'),_0x22ecf8[_0x9bb2('0x20')],_0x22ecf8[_0x9bb2('0x35')],_0x22ecf8[_0x9bb2('0x21')],_0x22ecf8['dnid'],_0x22ecf8[_0x9bb2('0x23')]));_0x4ff43f[_0x9bb2('0x36')](_0x34bad1[_0x9bb2('0x37')]['id'],function(_0x23ac68){try{_0x23ac68=_0x3bc4d9[_0x9bb2('0x25')](_0x23ac68);logger[_0x9bb2('0x19')](_0x9bb2('0x26'),JSON[_0x9bb2('0x1a')](_0x23ac68,null,0x2));if(_0x23ac68&&_0x3bc4d9[_0x23ac68[_0x9bb2('0xb')]]){_0x5bc1fb=_0x3bc4d9[_0x23ac68[_0x9bb2('0xb')]](_0x23ac68);if(_0x5bc1fb){logger[_0x9bb2('0x19')]('response',inspect(_0x5bc1fb));return _[_0x9bb2('0x30')](_0x5bc1fb[_0x9bb2('0x2d')])?null:_0x5bc1fb['result']['toString']();}else{logger[_0x9bb2('0x32')](_0x9bb2('0x2f'),inspect(_0x5bc1fb));return null;}}else{logger[_0x9bb2('0x32')]('agicommand\x20not\x20found');return null;}}catch(_0x457f3d){logger[_0x9bb2('0x32')](_0x457f3d[_0x9bb2('0xa')]);return null;}});}logger[_0x9bb2('0x1e')](util[_0x9bb2('0x1c')](_0x9bb2('0x38'),_0x22ecf8['arg_1'],_0x22ecf8[_0x9bb2('0x35')],_0x22ecf8[_0x9bb2('0x21')],_0x22ecf8['dnid'],_0x22ecf8['uniqueid']));logger['info'](util[_0x9bb2('0x1c')](_0x9bb2('0x39'),_0x22ecf8['context'],_0x22ecf8[_0x9bb2('0x2a')],parseInt(_0x22ecf8['priority'],0xa)+0x1));_0x22ecf8[_0x9bb2('0x3a')](_0x22ecf8[_0x9bb2('0x29')],_0x22ecf8[_0x9bb2('0x2a')],parseInt(_0x22ecf8[_0x9bb2('0x2b')],0xa)+0x1);_0x22ecf8[_0x9bb2('0x3b')]();}function handleNotFound(_0x48ecca){logger[_0x9bb2('0x32')](util[_0x9bb2('0x1c')]('Project\x20%s\x20not\x20found',_0x48ecca['arg_1']));_0x48ecca['continueAt'](_0x48ecca[_0x9bb2('0x29')],_0x48ecca[_0x9bb2('0x2a')],parseInt(_0x48ecca[_0x9bb2('0x2b')],0xa)+0x1);_0x48ecca[_0x9bb2('0x3b')]();}function handleUnpublished(_0x323501){logger['error'](util[_0x9bb2('0x1c')](_0x9bb2('0x3c'),_0x323501[_0x9bb2('0x20')]));_0x323501[_0x9bb2('0x3a')](_0x323501['context'],_0x323501['extension'],parseInt(_0x323501[_0x9bb2('0x2b')],0xa)+0x1);_0x323501[_0x9bb2('0x3b')]();}module[_0x9bb2('0x3d')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0x10c8=['evtHangup','result','toString','error','response','agicommand\x20not\x20found','finally','calleridname','callerid','isUndefined','continueAt','Project\x20%s\x20not\x20published','close','exports','xml2json','util','agi','./rpc','./mailRpc','./graph','./vertices','getSquareProjects','catch','Unable\x20to\x20download\x20CallySquare\x20projects','stack','hasOwnProperty','retry','addVertex','omit','isArray','length','source','target','addEdge','toJson','root','inspect','debug','stringify','joinAt','format','mxCell','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','dnid','uniqueid','traverseBFS','start','clear','vertex','agicommand','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','info','code'];(function(_0x30a1fc,_0x4a98b8){var _0x19fe40=function(_0x577bae){while(--_0x577bae){_0x30a1fc['push'](_0x30a1fc['shift']());}};_0x19fe40(++_0x4a98b8);}(_0x10c8,0x1a4));var _0x810c=function(_0x33f18d,_0x3f8aa5){_0x33f18d=_0x33f18d-0x0;var _0x37c5a5=_0x10c8[_0x33f18d];return _0x37c5a5;};'use strict';var _=require('lodash');var moment=require('moment');var parser=require(_0x810c('0x0'));var util=require(_0x810c('0x1'));var logger=require('../../config/logger')(_0x810c('0x2'));var rpc=require(_0x810c('0x3'));var mailRpc=require(_0x810c('0x4'));var Graph=require(_0x810c('0x5'));var Vertices=require(_0x810c('0x6'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x810c('0x7')]()[_0x810c('0x8')](function(_0xa8cf45){logger['error'](_0x810c('0x9'),_0xa8cf45[_0x810c('0xa')]);return[];});}function addVertex(_0x3c86fa,_0x40ff58,_0x5acb64){_0x40ff58['agicommand']=_0x5acb64;if(_0x40ff58[_0x810c('0xb')](_0x810c('0xc'))){_0x40ff58['maxRetry']=parseInt(_0x40ff58['retry'],0xa);}_0x3c86fa[_0x810c('0xd')](_[_0x810c('0xe')](_0x40ff58,'mxCell'));}function initGraph(_0x58fede,_0x2aa562){var _0x26cfbf=new Graph();for(var _0x1a3ac1 in _0x58fede){if(_0x58fede['hasOwnProperty'](_0x1a3ac1)){if(_[_0x810c('0xf')](_0x58fede[_0x1a3ac1])){for(var _0x42b1f7=0x0;_0x42b1f7<_0x58fede[_0x1a3ac1][_0x810c('0x10')];_0x42b1f7+=0x1){addVertex(_0x26cfbf,_0x58fede[_0x1a3ac1][_0x42b1f7],_0x1a3ac1);}}else{addVertex(_0x26cfbf,_0x58fede[_0x1a3ac1],_0x1a3ac1);}}}for(var _0x32f2a2=0x0;_0x32f2a2<_0x2aa562['length'];_0x32f2a2+=0x1){if(_0x2aa562[_0x32f2a2][_0x810c('0x11')]&&_0x2aa562[_0x32f2a2][_0x810c('0x12')]){_0x26cfbf[_0x810c('0x13')](_0x2aa562[_0x32f2a2][_0x810c('0x11')],_0x2aa562[_0x32f2a2][_0x810c('0x12')],_0x2aa562[_0x32f2a2]['value']);}}return _0x26cfbf;}function getRoot(_0x4bf9aa){return parser[_0x810c('0x14')](_0x4bf9aa,{'object':!![]})['mxGraphModel'][_0x810c('0x15')];}function inspect(_0x4bcb0c){return util[_0x810c('0x16')](_0x4bcb0c,{'showHidden':![],'depth':null});}function initialize(_0xa0ac70,_0x4b1871){var _0x1ec037=getRoot(_0xa0ac70['production']);if(!_0x1ec037||!_0x1ec037['start'])return;var _0x5bcb06,_0x574a14,_0x2490e3;logger[_0x810c('0x17')](_0x810c('0x15'),JSON[_0x810c('0x18')](_0x1ec037,null,0x2));_0x4b1871[_0x810c('0x19')]=moment()[_0x810c('0x1a')]('YYYY-MM-DD\x20HH:mm:ss');_0x5bcb06=initGraph(_[_0x810c('0xe')](_0x1ec037,'mxCell'),_0x1ec037[_0x810c('0x1b')]);_0x574a14=new Vertices(_0x4b1871,rpc,mailRpc);logger['info'](util[_0x810c('0x1a')](_0x810c('0x1c'),_0x4b1871[_0x810c('0x1d')],_0x4b1871['calleridname'],_0x4b1871['callerid'],_0x4b1871[_0x810c('0x1e')],_0x4b1871[_0x810c('0x1f')]));_0x5bcb06[_0x810c('0x20')](_0x1ec037[_0x810c('0x21')]['id'],function(_0x274fc8){try{_0x274fc8=_0x574a14[_0x810c('0x22')](_0x274fc8);logger[_0x810c('0x17')](_0x810c('0x23'),JSON[_0x810c('0x18')](_0x274fc8,null,0x2));if(_0x274fc8[_0x810c('0x24')]===_0x810c('0x25')){logger['info'](_0x810c('0x26'));_0x4b1871[_0x810c('0x27')]=_0x274fc8['context']||_0x4b1871[_0x810c('0x27')];_0x4b1871[_0x810c('0x28')]=_0x274fc8[_0x810c('0x28')];_0x4b1871[_0x810c('0x29')]=_0x274fc8[_0x810c('0x29')]?_0x274fc8['priority']-0x1:0x1;return null;}else if(_0x274fc8&&_0x574a14[_0x274fc8[_0x810c('0x24')]]){_0x2490e3=_0x574a14[_0x274fc8[_0x810c('0x24')]](_0x274fc8);logger[_0x810c('0x2a')]('response',JSON[_0x810c('0x18')](_0x2490e3,null,0x2));if(_0x2490e3&&_0x2490e3[_0x810c('0x2b')]===AGI_CODE_SUCCESS&&_0x2490e3['result']!==AGI_RESULT_ERROR&&!_0x4b1871[_0x810c('0x2c')]){logger[_0x810c('0x17')]('response',inspect(_0x2490e3));return _['isUndefined'](_0x2490e3[_0x810c('0x2d')])?null:_0x2490e3[_0x810c('0x2d')][_0x810c('0x2e')]();}else{logger[_0x810c('0x2f')](_0x810c('0x30'),inspect(_0x2490e3));return null;}}else{logger[_0x810c('0x2f')](_0x810c('0x31'));return null;}}catch(_0x4775ea){logger['error'](_0x4775ea[_0x810c('0xa')]);return null;}});if(_0x1ec037[_0x810c('0x32')]){logger[_0x810c('0x2a')](util[_0x810c('0x1a')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x4b1871['arg_1'],_0x4b1871[_0x810c('0x33')],_0x4b1871[_0x810c('0x34')],_0x4b1871[_0x810c('0x1e')],_0x4b1871[_0x810c('0x1f')]));_0x5bcb06[_0x810c('0x20')](_0x1ec037[_0x810c('0x32')]['id'],function(_0x53cc4b){try{_0x53cc4b=_0x574a14[_0x810c('0x22')](_0x53cc4b);logger[_0x810c('0x17')](_0x810c('0x23'),JSON[_0x810c('0x18')](_0x53cc4b,null,0x2));if(_0x53cc4b&&_0x574a14[_0x53cc4b[_0x810c('0x24')]]){_0x2490e3=_0x574a14[_0x53cc4b[_0x810c('0x24')]](_0x53cc4b);if(_0x2490e3){logger[_0x810c('0x17')](_0x810c('0x30'),inspect(_0x2490e3));return _[_0x810c('0x35')](_0x2490e3[_0x810c('0x2d')])?null:_0x2490e3[_0x810c('0x2d')][_0x810c('0x2e')]();}else{logger[_0x810c('0x2f')](_0x810c('0x30'),inspect(_0x2490e3));return null;}}else{logger[_0x810c('0x2f')](_0x810c('0x31'));return null;}}catch(_0x2010a7){logger['error'](_0x2010a7[_0x810c('0xa')]);return null;}});}logger[_0x810c('0x2a')](util[_0x810c('0x1a')]('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x4b1871[_0x810c('0x1d')],_0x4b1871[_0x810c('0x33')],_0x4b1871[_0x810c('0x34')],_0x4b1871['dnid'],_0x4b1871[_0x810c('0x1f')]));logger[_0x810c('0x2a')](util[_0x810c('0x1a')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x4b1871['context'],_0x4b1871['extension'],parseInt(_0x4b1871[_0x810c('0x29')],0xa)+0x1));_0x4b1871[_0x810c('0x36')](_0x4b1871[_0x810c('0x27')],_0x4b1871[_0x810c('0x28')],parseInt(_0x4b1871[_0x810c('0x29')],0xa)+0x1);_0x4b1871['close']();}function handleNotFound(_0x411332){logger['error'](util['format']('Project\x20%s\x20not\x20found',_0x411332[_0x810c('0x1d')]));_0x411332[_0x810c('0x36')](_0x411332[_0x810c('0x27')],_0x411332[_0x810c('0x28')],parseInt(_0x411332['priority'],0xa)+0x1);_0x411332['close']();}function handleUnpublished(_0x554a17){logger[_0x810c('0x2f')](util[_0x810c('0x1a')](_0x810c('0x37'),_0x554a17[_0x810c('0x1d')]));_0x554a17[_0x810c('0x36')](_0x554a17[_0x810c('0x27')],_0x554a17[_0x810c('0x28')],parseInt(_0x554a17['priority'],0xa)+0x1);_0x554a17[_0x810c('0x38')]();}module[_0x810c('0x39')]={'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 739f370..912f4fb 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 _0x99f4=['inherits','prototype','_transform','\x0d\x0a\x0d\x0a','toString','_inBody','indexOf','substring','length','trim','slice','emit','exports','util','Transform','call','_localBuffer'];(function(_0x4bce4d,_0x14a1e1){var _0xd6dce4=function(_0x58d4c9){while(--_0x58d4c9){_0x4bce4d['push'](_0x4bce4d['shift']());}};_0xd6dce4(++_0x14a1e1);}(_0x99f4,0x161));var _0x499f=function(_0x4dd232,_0x2a5d02){_0x4dd232=_0x4dd232-0x0;var _0x24898b=_0x99f4[_0x4dd232];return _0x24898b;};'use strict';var util=require(_0x499f('0x0'));var Transform=require('stream')[_0x499f('0x1')];function AGIReply(_0x291359){Transform[_0x499f('0x2')](this,_0x291359);this[_0x499f('0x3')]='';this['_inBody']=![];}util[_0x499f('0x4')](AGIReply,Transform);AGIReply[_0x499f('0x5')][_0x499f('0x6')]=function(_0x34c65d,_0x2da88f,_0x25a590){var _0x1a61c0='\x0a',_0x17f0c9=['\x0a\x0a',_0x499f('0x7')],_0x5af6af=-0x1,_0x478b79=-0x1,_0x3c3315='',_0x1a2840=0x0,_0x2b5b2b='',_0x243372='';this[_0x499f('0x3')]+=_0x34c65d[_0x499f('0x8')]();_0x2b5b2b=this['_localBuffer'];if(!this[_0x499f('0x9')]){_0x1a2840=0x0;while(_0x17f0c9[_0x1a2840]){while((_0x478b79=_0x2b5b2b[_0x499f('0xa')](_0x17f0c9[_0x1a2840]))!=-0x1){_0x3c3315=_0x17f0c9[_0x1a2840];_0x243372=_0x2b5b2b[_0x499f('0xb')](0x0,_0x478b79);_0x2b5b2b=_0x2b5b2b[_0x499f('0xb')](_0x478b79+_0x3c3315[_0x499f('0xc')]);var _0x1ff561=_0x243372['split'](_0x1a61c0),_0xd511e7=0x0,_0xe9b328={},_0x57c01b='',_0x3caf6f='',_0x224ad6=-0x1;while(_0x1ff561[_0xd511e7]){_0x224ad6=_0x1ff561[_0xd511e7][_0x499f('0xa')](':');if(_0x224ad6!=-0x1){_0x57c01b=_0x1ff561[_0xd511e7]['slice'](0x0,_0x224ad6)[_0x499f('0xd')]();_0x3caf6f=_0x1ff561[_0xd511e7][_0x499f('0xe')](_0x224ad6+0x1)[_0x499f('0xd')]();if(_0x57c01b['length']>0x0){_0xe9b328[_0x57c01b]=_0x3caf6f;}}else{}_0xd511e7++;}this['emit']('headers',_0xe9b328);this[_0x499f('0x9')]=!![];}_0x1a2840++;}this[_0x499f('0x3')]=_0x2b5b2b;}else{while((_0x5af6af=_0x2b5b2b[_0x499f('0xa')](_0x1a61c0))!=-0x1){_0x243372=_0x2b5b2b[_0x499f('0xb')](0x0,_0x5af6af);this[_0x499f('0xf')]('line',_0x243372);_0x2b5b2b=_0x2b5b2b['substring'](_0x5af6af+_0x1a61c0[_0x499f('0xc')]);}this[_0x499f('0x3')]=_0x2b5b2b;}_0x25a590();};module[_0x499f('0x10')]=AGIReply; \ No newline at end of file +var _0xf91d=['stream','Transform','call','_localBuffer','_inBody','inherits','prototype','toString','indexOf','substring','length','split','slice','trim','headers','line','exports','util'];(function(_0x224f8c,_0x192f2b){var _0x14cdd7=function(_0x1c66a8){while(--_0x1c66a8){_0x224f8c['push'](_0x224f8c['shift']());}};_0x14cdd7(++_0x192f2b);}(_0xf91d,0x155));var _0xdf91=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xf91d[_0x2c91e9];return _0x13f0ff;};'use strict';var util=require(_0xdf91('0x0'));var Transform=require(_0xdf91('0x1'))[_0xdf91('0x2')];function AGIReply(_0x95d77d){Transform[_0xdf91('0x3')](this,_0x95d77d);this[_0xdf91('0x4')]='';this[_0xdf91('0x5')]=![];}util[_0xdf91('0x6')](AGIReply,Transform);AGIReply[_0xdf91('0x7')]['_transform']=function(_0x9e88e5,_0x293539,_0x224ff8){var _0x487cb8='\x0a',_0x71f381=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x5cc25a=-0x1,_0x482672=-0x1,_0x460774='',_0x40d9eb=0x0,_0x5d710a='',_0x32f329='';this[_0xdf91('0x4')]+=_0x9e88e5[_0xdf91('0x8')]();_0x5d710a=this[_0xdf91('0x4')];if(!this['_inBody']){_0x40d9eb=0x0;while(_0x71f381[_0x40d9eb]){while((_0x482672=_0x5d710a[_0xdf91('0x9')](_0x71f381[_0x40d9eb]))!=-0x1){_0x460774=_0x71f381[_0x40d9eb];_0x32f329=_0x5d710a[_0xdf91('0xa')](0x0,_0x482672);_0x5d710a=_0x5d710a[_0xdf91('0xa')](_0x482672+_0x460774[_0xdf91('0xb')]);var _0x59868e=_0x32f329[_0xdf91('0xc')](_0x487cb8),_0x52646d=0x0,_0x5b7a10={},_0x469cc3='',_0x4bad36='',_0x39a056=-0x1;while(_0x59868e[_0x52646d]){_0x39a056=_0x59868e[_0x52646d][_0xdf91('0x9')](':');if(_0x39a056!=-0x1){_0x469cc3=_0x59868e[_0x52646d][_0xdf91('0xd')](0x0,_0x39a056)[_0xdf91('0xe')]();_0x4bad36=_0x59868e[_0x52646d][_0xdf91('0xd')](_0x39a056+0x1)['trim']();if(_0x469cc3[_0xdf91('0xb')]>0x0){_0x5b7a10[_0x469cc3]=_0x4bad36;}}else{}_0x52646d++;}this['emit'](_0xdf91('0xf'),_0x5b7a10);this['_inBody']=!![];}_0x40d9eb++;}this['_localBuffer']=_0x5d710a;}else{while((_0x5cc25a=_0x5d710a[_0xdf91('0x9')](_0x487cb8))!=-0x1){_0x32f329=_0x5d710a[_0xdf91('0xa')](0x0,_0x5cc25a);this['emit'](_0xdf91('0x10'),_0x32f329);_0x5d710a=_0x5d710a[_0xdf91('0xa')](_0x5cc25a+_0x487cb8[_0xdf91('0xb')]);}this[_0xdf91('0x4')]=_0x5d710a;}_0x224ff8();};module[_0xdf91('0x11')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index eaa1805..a3224c7 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 _0xbe22=['MailServerOut','CloudProvider','getSquareProjectById','getVoiceQueueById','getVariableById','ShowVariable','dsn','getUserById','ShowUser','getContactByPhone','GetContactByPhone','phone','getTrunkById','ShowSound','save_name','getIntervalById','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','format','YYYY-MM-DD\x20HH:mm:ss','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','LogoutUser','lodash','moment','http','request','then','error','result','catch','GetSquareProjects','name','production','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount'];(function(_0x657e67,_0x518f58){var _0x29e86d=function(_0x3afc81){while(--_0x3afc81){_0x657e67['push'](_0x657e67['shift']());}};_0x29e86d(++_0x518f58);}(_0xbe22,0x1c1));var _0x2be2=function(_0xd930b0,_0x29ce84){_0xd930b0=_0xd930b0-0x0;var _0x5d435d=_0xbe22[_0xd930b0];return _0x5d435d;};'use strict';var _=require(_0x2be2('0x0'));var moment=require(_0x2be2('0x1'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2be2('0x2')]({'port':0x2329});function request(_0x20a08c,_0xf16dc5){return new Promise(function(_0x409a41,_0x1729d7){return client[_0x2be2('0x3')](_0x20a08c,_0xf16dc5)[_0x2be2('0x4')](function(_0x2030e3){if(_0x2030e3[_0x2be2('0x5')]){return _0x1729d7(_0x2030e3[_0x2be2('0x5')]['message']);}else{return _0x409a41(_0x2030e3[_0x2be2('0x6')]);}})[_0x2be2('0x7')](function(_0x12d9b4){return _0x1729d7(_0x12d9b4);});});}exports['getSquareProjects']=function(){return request(_0x2be2('0x8'),{'options':{'raw':![],'attributes':['id',_0x2be2('0x9'),_0x2be2('0xa')]}});};exports[_0x2be2('0xb')]=function(_0x40d8b2){return request(_0x2be2('0xc'),{'options':{'raw':![],'where':{'name':_0x40d8b2},'attributes':[_0x2be2('0xa')]}});};exports[_0x2be2('0xd')]=function(_0x4f3ec4){return request(_0x2be2('0xe'),{'options':{'raw':![],'where':{'id':_0x4f3ec4},'include':[{'model':_0x2be2('0xf'),'as':'Smtp','include':[{'model':_0x2be2('0x10'),'as':_0x2be2('0x10')}]}],'attributes':['id',_0x2be2('0x9'),'email'],'smtp':!![]}});};exports[_0x2be2('0x11')]=function(_0xaacc53){return request('ShowSquareProject',{'options':{'where':{'id':_0xaacc53},'attributes':[_0x2be2('0x9')]}});};exports[_0x2be2('0x12')]=function(_0x1a3ae0){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x1a3ae0},'attributes':[_0x2be2('0x9')]}});};exports[_0x2be2('0x13')]=function(_0x528d4e){return request(_0x2be2('0x14'),{'options':{'where':{'id':_0x528d4e},'attributes':[_0x2be2('0x9')]}});};exports['getSquareOdbcById']=function(_0x2fd029){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x2fd029},'attributes':[_0x2be2('0x15')]}});};exports[_0x2be2('0x16')]=function(_0x564371){return request(_0x2be2('0x17'),{'options':{'where':{'id':_0x564371},'attributes':[_0x2be2('0x9')]}});};exports[_0x2be2('0x18')]=function(_0x504b07){return request(_0x2be2('0x19'),{'options':{'where':{'phone':_0x504b07[_0x2be2('0x1a')]},'attributes':['id']}});};exports[_0x2be2('0x1b')]=function(_0x59e2c6){return request('ShowTrunk',{'options':{'where':{'id':_0x59e2c6},'attributes':[_0x2be2('0x9')]}});};exports['getSoundById']=function(_0x1bb818){return request(_0x2be2('0x1c'),{'options':{'where':{'id':_0x1bb818},'attributes':[_0x2be2('0x1d')]}});};exports[_0x2be2('0x1e')]=function(_0x173862){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x173862},'include':[{'model':'Interval','as':'Intervals'}]}});};exports[_0x2be2('0x1f')]=function(_0x155755){return request(_0x2be2('0x20'),{'options':{'where':{'id':_0x155755},'attributes':['id',_0x2be2('0x9')]}});};exports[_0x2be2('0x21')]=function(_0x16a512){return request(_0x2be2('0x22'),{'body':_0x16a512});};exports[_0x2be2('0x23')]=function(_0x4ef62c){return request(_0x2be2('0x24'),{'body':_0x4ef62c});};exports[_0x2be2('0x25')]=function(_0x55fd4c){return request(_0x2be2('0x26'),{'body':_[_0x2be2('0x27')](_0x55fd4c,{'project_name':_0x55fd4c[_0x2be2('0x28')],'prev_project_name':_0x55fd4c['arg_2']||'','is_subproject':_0x55fd4c['arg_2']?!![]:![],'leaveAt':moment()[_0x2be2('0x29')](_0x2be2('0x2a'))})});};exports['createSquareRecording']=function(_0x4ccee6){return request(_0x2be2('0x2b'),{'body':_0x4ccee6});};exports[_0x2be2('0x2c')]=function(_0x594b05){return request(_0x2be2('0x2d'),{'body':_0x594b05});};exports[_0x2be2('0x2e')]=function(_0x42015b){return request(_0x2be2('0x2f'),{'options':{'raw':![],'where':{'phone':_0x42015b[_0x2be2('0x1a')],'ListId':_0x42015b[_0x2be2('0x30')]}}})[_0x2be2('0x4')](function(_0x26658d){if(_0x26658d){return _0x26658d;}return request('CreateCmContact',{'body':_0x42015b});});};exports[_0x2be2('0x31')]=function(_0x36dc2d){return request(_0x2be2('0x32'),{'options':{'where':{'id':_0x36dc2d},'attributes':['name']}});};exports[_0x2be2('0x33')]=function(_0x4fb592,_0x25c01c){return request(_0x2be2('0x34'),{'body':{'interface':_0x25c01c},'options':{'where':_0x4fb592}});};exports[_0x2be2('0x35')]=function(_0x397429,_0x273696,_0x3cb4f3){return request(_0x2be2('0x36'),{'body':{'type':_0x273696,'uniqueid':_0x3cb4f3},'options':{'where':_0x397429}});};exports[_0x2be2('0x37')]=function(_0x4ac200){return request(_0x2be2('0x38'),{'body':{},'options':{'where':_0x4ac200}});};exports['agentLogout']=function(_0x2bc93f){return request(_0x2be2('0x39'),{'body':{},'options':{'where':_0x2bc93f}});}; \ No newline at end of file +var _0x871e=['Smtp','CloudProvider','name','email','getSquareProjectById','ShowSquareProject','getVoiceQueueById','ShowVoiceQueue','getVariableById','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','phone','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','ShowCmHopper','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','agentPause','agentUnpause','UnpauseUser','agentLogout','LogoutUser','lodash','jayson/promise','client','http','request','then','error','message','result','catch','getSquareProjects','production','getSquareProject','getMailAccountById','ShowMailAccount','MailServerOut'];(function(_0x353b00,_0x4500e9){var _0x59288c=function(_0x4d2b30){while(--_0x4d2b30){_0x353b00['push'](_0x353b00['shift']());}};_0x59288c(++_0x4500e9);}(_0x871e,0x1b0));var _0xe871=function(_0x1c147a,_0x20a137){_0x1c147a=_0x1c147a-0x0;var _0xa4b6e9=_0x871e[_0x1c147a];return _0xa4b6e9;};'use strict';var _=require(_0xe871('0x0'));var moment=require('moment');var jayson=require(_0xe871('0x1'));var client=jayson[_0xe871('0x2')][_0xe871('0x3')]({'port':0x2329});function request(_0x352807,_0x510e9d){return new Promise(function(_0xc9353,_0x27f82b){return client[_0xe871('0x4')](_0x352807,_0x510e9d)[_0xe871('0x5')](function(_0x4ec1dd){if(_0x4ec1dd[_0xe871('0x6')]){return _0x27f82b(_0x4ec1dd[_0xe871('0x6')][_0xe871('0x7')]);}else{return _0xc9353(_0x4ec1dd[_0xe871('0x8')]);}})[_0xe871('0x9')](function(_0x4cf6af){return _0x27f82b(_0x4cf6af);});});}exports[_0xe871('0xa')]=function(){return request('GetSquareProjects',{'options':{'raw':![],'attributes':['id','name',_0xe871('0xb')]}});};exports[_0xe871('0xc')]=function(_0x17a913){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x17a913},'attributes':[_0xe871('0xb')]}});};exports[_0xe871('0xd')]=function(_0x33881e){return request(_0xe871('0xe'),{'options':{'raw':![],'where':{'id':_0x33881e},'include':[{'model':_0xe871('0xf'),'as':_0xe871('0x10'),'include':[{'model':_0xe871('0x11'),'as':'CloudProvider'}]}],'attributes':['id',_0xe871('0x12'),_0xe871('0x13')],'smtp':!![]}});};exports[_0xe871('0x14')]=function(_0x5c8726){return request(_0xe871('0x15'),{'options':{'where':{'id':_0x5c8726},'attributes':[_0xe871('0x12')]}});};exports[_0xe871('0x16')]=function(_0x3f560a){return request(_0xe871('0x17'),{'options':{'where':{'id':_0x3f560a},'attributes':['name']}});};exports[_0xe871('0x18')]=function(_0x48ebad){return request('ShowVariable',{'options':{'where':{'id':_0x48ebad},'attributes':[_0xe871('0x12')]}});};exports[_0xe871('0x19')]=function(_0x271da1){return request(_0xe871('0x1a'),{'options':{'where':{'id':_0x271da1},'attributes':[_0xe871('0x1b')]}});};exports[_0xe871('0x1c')]=function(_0x415937){return request(_0xe871('0x1d'),{'options':{'where':{'id':_0x415937},'attributes':[_0xe871('0x12')]}});};exports['getContactByPhone']=function(_0x31319f){return request('GetContactByPhone',{'options':{'where':{'phone':_0x31319f[_0xe871('0x1e')]},'attributes':['id']}});};exports[_0xe871('0x1f')]=function(_0x48eb94){return request(_0xe871('0x20'),{'options':{'where':{'id':_0x48eb94},'attributes':[_0xe871('0x12')]}});};exports[_0xe871('0x21')]=function(_0x157293){return request(_0xe871('0x22'),{'options':{'where':{'id':_0x157293},'attributes':[_0xe871('0x23')]}});};exports[_0xe871('0x24')]=function(_0x1a316d){return request(_0xe871('0x25'),{'options':{'raw':![],'where':{'id':_0x1a316d},'include':[{'model':_0xe871('0x26'),'as':_0xe871('0x27')}]}});};exports[_0xe871('0x28')]=function(_0x3e6d9b){return request(_0xe871('0x29'),{'options':{'where':{'id':_0x3e6d9b},'attributes':['id',_0xe871('0x12')]}});};exports[_0xe871('0x2a')]=function(_0x2007a7){return request(_0xe871('0x2b'),{'body':_0x2007a7});};exports[_0xe871('0x2c')]=function(_0x3e00f5){return request(_0xe871('0x2d'),{'body':_0x3e00f5});};exports[_0xe871('0x2e')]=function(_0xd5b0c5){return request(_0xe871('0x2f'),{'body':_[_0xe871('0x30')](_0xd5b0c5,{'project_name':_0xd5b0c5[_0xe871('0x31')],'prev_project_name':_0xd5b0c5['arg_2']||'','is_subproject':_0xd5b0c5['arg_2']?!![]:![],'leaveAt':moment()['format'](_0xe871('0x32'))})});};exports[_0xe871('0x33')]=function(_0x39b109){return request(_0xe871('0x34'),{'body':_0x39b109});};exports['createSquareMessage']=function(_0x17e851){return request('CreateSquareMessage',{'body':_0x17e851});};exports['createCmContact']=function(_0x50ac1e){return request(_0xe871('0x35'),{'options':{'raw':![],'where':{'phone':_0x50ac1e[_0xe871('0x1e')],'ListId':_0x50ac1e[_0xe871('0x36')]}}})[_0xe871('0x5')](function(_0x1a3afa){if(_0x1a3afa){return _0x1a3afa;}return request(_0xe871('0x37'),{'body':_0x50ac1e});});};exports[_0xe871('0x38')]=function(_0x470b0d){return request(_0xe871('0x39'),{'options':{'where':{'id':_0x470b0d},'attributes':[_0xe871('0x12')]}});};exports[_0xe871('0x3a')]=function(_0x47911c,_0x59ab04){return request('LoginUser',{'body':{'interface':_0x59ab04},'options':{'where':_0x47911c}});};exports[_0xe871('0x3b')]=function(_0x5b6550,_0x2f56c8,_0x5a8bc2){return request('PauseUser',{'body':{'type':_0x2f56c8,'uniqueid':_0x5a8bc2},'options':{'where':_0x5b6550}});};exports[_0xe871('0x3c')]=function(_0x4cb239){return request(_0xe871('0x3d'),{'body':{},'options':{'where':_0x4cb239}});};exports[_0xe871('0x3e')]=function(_0x22946a){return request(_0xe871('0x3f'),{'body':{},'options':{'where':_0x22946a}});}; \ 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 565ab14..9dc23fa 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 _0x4312=['exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4312,0xaf));var _0x2431=function(_0x57a8dc,_0x52b2b2){_0x57a8dc=_0x57a8dc-0x0;var _0x4dff43=_0x4312[_0x57a8dc];return _0x4dff43;};var polly=require('./polly');var lex=require('./lex');module[_0x2431('0x0')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0xac0a=['exports'];(function(_0x4f1de3,_0x4f748e){var _0x34f1e9=function(_0x498dda){while(--_0x498dda){_0x4f1de3['push'](_0x4f1de3['shift']());}};_0x34f1e9(++_0x4f748e);}(_0xac0a,0x11e));var _0xaac0=function(_0x1efa36,_0x444000){_0x1efa36=_0x1efa36-0x0;var _0x2b05d8=_0xac0a[_0x1efa36];return _0x2b05d8;};var polly=require('./polly');var lex=require('./lex');module[_0xaac0('0x0')]={'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 ec4be4e..65f4054 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 _0x6324=['./lib/api','exports'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x6324,0x142));var _0x4632=function(_0x2bddf9,_0x22c873){_0x2bddf9=_0x2bddf9-0x0;var _0x3f3ae9=_0x6324[_0x2bddf9];return _0x3f3ae9;};'use strict';var lex=require(_0x4632('0x0'));module[_0x4632('0x1')]=function(_0xb0927d,_0x2fc528,_0x551054,_0x1805c5,_0x48e508,_0x3bea40){return lex(_0xb0927d,_0x2fc528,_0x551054,_0x1805c5,_0x48e508,_0x3bea40);}; \ No newline at end of file +var _0xf4eb=['./lib/api'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0xf4eb,0xec));var _0xbf4e=function(_0x32e034,_0x11d0da){_0x32e034=_0x32e034-0x0;var _0x378d10=_0xf4eb[_0x32e034];return _0x378d10;};'use strict';var lex=require(_0xbf4e('0x0'));module['exports']=function(_0x50f2fc,_0x479210,_0x5ed5b9,_0xbbbf01,_0x49d80e,_0x4e7fa7){return lex(_0x50f2fc,_0x479210,_0x5ed5b9,_0xbbbf01,_0x49d80e,_0x4e7fa7);}; \ 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 43a1f37..40d5e40 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(_0x4e9251,_0x4d3b98){var _0x200390=function(_0x488abf){while(--_0x488abf){_0x4e9251['push'](_0x4e9251['shift']());}};_0x200390(++_0x4d3b98);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'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(_0x1ba3ed,_0x3a8276){var _0x5abff5=function(_0x8b41ae){while(--_0x8b41ae){_0x1ba3ed['push'](_0x1ba3ed['shift']());}};_0x5abff5(++_0x3a8276);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'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 f5d9d5f..0d2b94e 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 _0x1aa6=['exports','./lib/api'];(function(_0x291eaa,_0x13301c){var _0x461806=function(_0x1c009c){while(--_0x1c009c){_0x291eaa['push'](_0x291eaa['shift']());}};_0x461806(++_0x13301c);}(_0x1aa6,0x179));var _0x61aa=function(_0x25a42a,_0x3d489b){_0x25a42a=_0x25a42a-0x0;var _0x1129b1=_0x1aa6[_0x25a42a];return _0x1129b1;};'use strict';var polly=require(_0x61aa('0x0'));module[_0x61aa('0x1')]=function(_0x3d8c2d,_0x2adb69,_0x21a830,_0x416d02,_0x1915e1,_0x3656ac,_0x4f1234){return polly(_0x3d8c2d,_0x2adb69,_0x21a830,_0x416d02,_0x1915e1,_0x3656ac,_0x4f1234);}; \ No newline at end of file +var _0x1b86=['./lib/api'];(function(_0x24522c,_0xc24752){var _0x4ebb95=function(_0x51717b){while(--_0x51717b){_0x24522c['push'](_0x24522c['shift']());}};_0x4ebb95(++_0xc24752);}(_0x1b86,0x134));var _0x61b8=function(_0x1e2663,_0x2116c5){_0x1e2663=_0x1e2663-0x0;var _0x4b8877=_0x1b86[_0x1e2663];return _0x4b8877;};'use strict';var polly=require(_0x61b8('0x0'));module['exports']=function(_0x3da3a,_0x4b9019,_0x1da102,_0x46a7c5,_0x6f9987,_0x209ed4,_0x38cee6){return polly(_0x3da3a,_0x4b9019,_0x1da102,_0x46a7c5,_0x6f9987,_0x209ed4,_0x38cee6);}; \ 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 94780ec..83c9c00 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 _0x5e03=['AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','path','randomstring','aws-sdk','synthesizeSpeech'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0x5e03,0x16d));var _0x35e0=function(_0x25c668,_0x2718f2){_0x25c668=_0x25c668-0x0;var _0x54e5f9=_0x5e03[_0x25c668];return _0x54e5f9;};'use strict';var fs=require('fs');var path=require(_0x35e0('0x0'));var BPromise=require('bluebird');var rs=require(_0x35e0('0x1'));var AWS=require(_0x35e0('0x2'));function pollyResult(_0x130578,_0x1b91ad,_0x1a342a){return new BPromise(function(_0x17a257,_0x44f114){_0x130578[_0x35e0('0x3')](_0x1b91ad,function(_0x59f6a0,_0x4afeb0){if(_0x59f6a0){_0x44f114(_0x59f6a0);}else if(_0x4afeb0){if(_0x4afeb0[_0x35e0('0x4')]instanceof Buffer){fs[_0x35e0('0x5')](_0x1a342a,_0x4afeb0['AudioStream'],function(_0x46527b){if(_0x46527b){_0x44f114(_0x46527b);}else{_0x17a257();}});}else{_0x44f114(new Error(_0x35e0('0x6')));}}else{_0x44f114(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module[_0x35e0('0x7')]=function(_0xb161f9,_0xb02563,_0x1541a1,_0x6bfed9,_0x1b96cc,_0x4ce1f5,_0xeb3b9d){var _0xfec944=new AWS[(_0x35e0('0x8'))]({'accessKeyId':_0xb161f9,'secretAccessKey':_0xb02563,'region':_0x1541a1});var _0xa1c3c2={'Text':_0x1b96cc,'TextType':_0x4ce1f5||'text','OutputFormat':'mp3','VoiceId':_0x6bfed9};return pollyResult(_0xfec944,_0xa1c3c2,_0xeb3b9d);}; \ No newline at end of file +var _0x995b=['text','bluebird','randomstring','aws-sdk','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','Polly'];(function(_0x2f02d2,_0x4ea243){var _0x308fa7=function(_0x186f1f){while(--_0x186f1f){_0x2f02d2['push'](_0x2f02d2['shift']());}};_0x308fa7(++_0x4ea243);}(_0x995b,0x119));var _0xb995=function(_0x276b0e,_0xc4958d){_0x276b0e=_0x276b0e-0x0;var _0x11ada1=_0x995b[_0x276b0e];return _0x11ada1;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0xb995('0x0'));var rs=require(_0xb995('0x1'));var AWS=require(_0xb995('0x2'));function pollyResult(_0x1dbe82,_0x374ca2,_0x5e8969){return new BPromise(function(_0x313823,_0x3721df){_0x1dbe82['synthesizeSpeech'](_0x374ca2,function(_0x2022d0,_0x5adab2){if(_0x2022d0){_0x3721df(_0x2022d0);}else if(_0x5adab2){if(_0x5adab2[_0xb995('0x3')]instanceof Buffer){fs['writeFile'](_0x5e8969,_0x5adab2[_0xb995('0x3')],function(_0x1016f6){if(_0x1016f6){_0x3721df(_0x1016f6);}else{_0x313823();}});}else{_0x3721df(new Error(_0xb995('0x4')));}}else{_0x3721df(new Error(_0xb995('0x5')));}});});}module['exports']=function(_0x4c657f,_0x48766f,_0x3c0b4c,_0x432c7a,_0x33746b,_0x5fe67a,_0x305583){var _0x138beb=new AWS[(_0xb995('0x6'))]({'accessKeyId':_0x4c657f,'secretAccessKey':_0x48766f,'region':_0x3c0b4c});var _0x4d2fd6={'Text':_0x33746b,'TextType':_0x5fe67a||_0xb995('0x7'),'OutputFormat':'mp3','VoiceId':_0x432c7a};return pollyResult(_0x138beb,_0x4d2fd6,_0x305583);}; \ 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 5302261..6de94ae 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. * // * * // ************************************************************************* -'use strict';var asr=require('./lib/api');module['exports']=function(_0x46b38f,_0x5bfb5d,_0x229ab8,_0x277a24){return asr(_0x46b38f,_0x5bfb5d,_0x229ab8);}; \ No newline at end of file +var _0x51d3=['exports','./lib/api'];(function(_0x1d40d5,_0x1ee7a0){var _0x28bdcb=function(_0x355f48){while(--_0x355f48){_0x1d40d5['push'](_0x1d40d5['shift']());}};_0x28bdcb(++_0x1ee7a0);}(_0x51d3,0x13d));var _0x351d=function(_0x407bc2,_0x35ff16){_0x407bc2=_0x407bc2-0x0;var _0x480e24=_0x51d3[_0x407bc2];return _0x480e24;};'use strict';var asr=require(_0x351d('0x0'));module[_0x351d('0x1')]=function(_0x9067,_0x244983,_0x5a9458,_0x306dc6){return asr(_0x9067,_0x244983,_0x5a9458);}; \ 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 322c661..5cd6db8 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 _0x515d=['undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','LINEAR16','8000','bluebird','https://speech.googleapis.com','exports','string','length','key\x20should\x20be\x20a\x20string'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x515d,0x104));var _0xd515=function(_0xc002ca,_0x7bd073){_0xc002ca=_0xc002ca-0x0;var _0x20c1b7=_0x515d[_0xc002ca];return _0x20c1b7;};'use strict';var url=require('url');var BPromise=require(_0xd515('0x0'));var fs=require('fs');var host=_0xd515('0x1');module[_0xd515('0x2')]=function(_0x2241af,_0x153f6a,_0x4240ce){return new BPromise(function(_0x23aa98,_0x442530){var _0x51e08b;if(typeof _0x2241af!==_0xd515('0x3')||_0x2241af['length']===0x0){return _0x442530('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x153f6a!==_0xd515('0x3')||_0x153f6a[_0xd515('0x4')]===0x0){return _0x442530(_0xd515('0x5'));}if(typeof _0x4240ce!==_0xd515('0x6')&&(typeof _0x4240ce!==_0xd515('0x3')||_0x4240ce['length']===0x0)){return _0x442530(_0xd515('0x7'));}try{_0x51e08b=fs[_0xd515('0x8')](_0x2241af)[_0xd515('0x9')](_0xd515('0xa'));}catch(_0x21d6ce){return _0x442530(_0x21d6ce);}return _0x23aa98({'method':_0xd515('0xb'),'uri':host+'/v1/speech:recognize?key='+_0x153f6a,'body':{'config':{'encoding':_0xd515('0xc'),'sampleRateHertz':_0xd515('0xd'),'languageCode':_0x4240ce},'audio':{'content':_0x51e08b}},'json':!![]});});}; \ No newline at end of file +var _0x0cfa=['string','length','filepath\x20should\x20be\x20a\x20string','undefined','readFileSync','toString','base64','POST','/v1/speech:recognize?key=','url','bluebird','https://speech.googleapis.com','exports'];(function(_0x32a767,_0x4e3e76){var _0x2b4e6d=function(_0x5e0702){while(--_0x5e0702){_0x32a767['push'](_0x32a767['shift']());}};_0x2b4e6d(++_0x4e3e76);}(_0x0cfa,0x18f));var _0xa0cf=function(_0x34dcec,_0x11d4a6){_0x34dcec=_0x34dcec-0x0;var _0x4e13d4=_0x0cfa[_0x34dcec];return _0x4e13d4;};'use strict';var url=require(_0xa0cf('0x0'));var BPromise=require(_0xa0cf('0x1'));var fs=require('fs');var host=_0xa0cf('0x2');module[_0xa0cf('0x3')]=function(_0x4d6a1c,_0x525629,_0x4d8758){return new BPromise(function(_0x37c4e1,_0x5cd2e7){var _0x469112;if(typeof _0x4d6a1c!==_0xa0cf('0x4')||_0x4d6a1c[_0xa0cf('0x5')]===0x0){return _0x5cd2e7(_0xa0cf('0x6'));}if(typeof _0x525629!=='string'||_0x525629[_0xa0cf('0x5')]===0x0){return _0x5cd2e7('key\x20should\x20be\x20a\x20string');}if(typeof _0x4d8758!==_0xa0cf('0x7')&&(typeof _0x4d8758!=='string'||_0x4d8758[_0xa0cf('0x5')]===0x0)){return _0x5cd2e7('lang\x20should\x20be\x20a\x20string');}try{_0x469112=fs[_0xa0cf('0x8')](_0x4d6a1c)[_0xa0cf('0x9')](_0xa0cf('0xa'));}catch(_0x544364){return _0x5cd2e7(_0x544364);}return _0x37c4e1({'method':_0xa0cf('0xb'),'uri':host+_0xa0cf('0xc')+_0x525629,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':'8000','languageCode':_0x4d8758},'audio':{'content':_0x469112}},'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 acb53d2..50505cf 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 _0x8aea=['./asr'];(function(_0x1abd7d,_0x17e2d8){var _0x5923c6=function(_0x3df741){while(--_0x3df741){_0x1abd7d['push'](_0x1abd7d['shift']());}};_0x5923c6(++_0x17e2d8);}(_0x8aea,0x15f));var _0xa8ae=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x8aea[_0x501510];return _0x1e6ee5;};var asr=require(_0xa8ae('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0xf5e2=['exports'];(function(_0x5d11f4,_0x39535c){var _0x49c541=function(_0x1f1041){while(--_0x1f1041){_0x5d11f4['push'](_0x5d11f4['shift']());}};_0x49c541(++_0x39535c);}(_0xf5e2,0x13a));var _0x2f5e=function(_0x507ba9,_0x2e8af5){_0x507ba9=_0x507ba9-0x0;var _0x390abe=_0xf5e2[_0x507ba9];return _0x390abe;};var asr=require('./asr');module[_0x2f5e('0x0')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 16a5ba3..0fcac9f 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 _0xd6a6=['result','source','resolvedQuery','action','actionIncomplete','speech','code','metadata','isFallbackIntent','googleDialogflowV2','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','end_conversation','boolValue','intent','name','displayName','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20confidence','awsPolly','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','freeform=3','parse','sestekNDA','channelData','CustomActionData','AudioFromTts','Data','dirName','apiai-promise','bluebird','dialogflow','http','md5','path','randomstring','sox','google-tts-api','url','util','./aws','./google','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','get','statusCode','error','\x20failed,\x20status\x20code\x20=\x20','statusMessage','request\x20to\x20','createWriteStream','finish','info','close','pipe','end','start','resolve','tmp','generate','writeFileSync','base64','unlink','chmodSync','777','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','ssml','input','voice','MP3','text:synthesize','POST','then','from','audioContent','.wav','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','application/x-www-form-urlencoded','stringify','jQ1olc','null','generic','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','\x22\x20might\x20not\x20exist','data','.mp3','googleASR','asr','results','map','alternatives','transcript','confidence','join','googleASR\x20transcription','googleASR\x20confidence','catch','message','textRequest'];(function(_0x4de950,_0x2bc8f8){var _0x312e51=function(_0x2ac86e){while(--_0x2ac86e){_0x4de950['push'](_0x4de950['shift']());}};_0x312e51(++_0x2bc8f8);}(_0xd6a6,0x126));var _0x6d6a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd6a6[_0x20a584];return _0x4b41a8;};'use strict';var apiai=require(_0x6d6a('0x0'));var BPromise=require(_0x6d6a('0x1'));var dialogflow=require(_0x6d6a('0x2'));var fs=require('fs');var http=require(_0x6d6a('0x3'));var https=require('https');var md5=require(_0x6d6a('0x4'));var path=require(_0x6d6a('0x5'));var querystring=require('querystring');var rp=require('request-promise');var rs=require(_0x6d6a('0x6'));var sox=require(_0x6d6a('0x7'));var tts=require(_0x6d6a('0x8'));var urlParse=require(_0x6d6a('0x9'))['parse'];var util=require(_0x6d6a('0xa'));var aws=require(_0x6d6a('0xb'));var google=require(_0x6d6a('0xc'));var sestek=require(_0x6d6a('0xd'));var tilde=require(_0x6d6a('0xe'));var logger=require(_0x6d6a('0xf'))(_0x6d6a('0x10'));var ISPEECH_API=_0x6d6a('0x11');function downloadFile(_0xb34ca5,_0x562266){return new BPromise(function(_0x1705c0,_0x594ea5){var _0x114798=urlParse(_0xb34ca5);var _0x39d7e4=_0x114798[_0x6d6a('0x12')]===_0x6d6a('0x13')?https:http;var _0x586820={'host':_0x114798[_0x6d6a('0x14')],'path':_0x114798['path'],'headers':{'user-agent':_0x6d6a('0x15')}};_0x39d7e4[_0x6d6a('0x16')](_0x586820,function(_0x443454){if(_0x443454[_0x6d6a('0x17')]!==0xc8){logger[_0x6d6a('0x18')]('request\x20to\x20'+_0xb34ca5+_0x6d6a('0x19')+_0x443454[_0x6d6a('0x17')]+'\x20('+_0x443454[_0x6d6a('0x1a')]+')');_0x594ea5(new Error(_0x6d6a('0x1b')+_0xb34ca5+'\x20failed,\x20status\x20code\x20=\x20'+_0x443454['statusCode']+'\x20('+_0x443454[_0x6d6a('0x1a')]+')'));return;}var _0x17938a=fs[_0x6d6a('0x1c')](_0x562266);_0x17938a['on'](_0x6d6a('0x1d'),function(){logger[_0x6d6a('0x1e')]('finish\x20download\x20file');_0x17938a[_0x6d6a('0x1f')](_0x1705c0);});_0x17938a['on']('error',function(_0x146535){fs['unlink'](_0x562266);logger['error']('download\x20error',_0x146535);_0x594ea5(_0x146535);});_0x443454[_0x6d6a('0x20')](_0x17938a);})['on'](_0x6d6a('0x18'),function(_0x478bf8){logger[_0x6d6a('0x18')](_0x478bf8);_0x594ea5(_0x478bf8);})[_0x6d6a('0x21')]();});}function uploadFile(_0x58dd6f){return new BPromise(function(_0x1d488c,_0x1346f3){var _0x589204=urlParse(_0x58dd6f);var _0xe2e87e=_0x589204[_0x6d6a('0x12')]===_0x6d6a('0x13')?https:http;var _0x3c21ce={'host':_0x589204[_0x6d6a('0x14')],'path':_0x589204[_0x6d6a('0x5')],'headers':{'user-agent':'WHAT_EVER'}};_0xe2e87e[_0x6d6a('0x16')](_0x3c21ce,function(_0x1d28de){if(_0x1d28de[_0x6d6a('0x17')]!==0xc8){_0x1346f3(new Error(_0x6d6a('0x1b')+_0x58dd6f+'\x20failed,\x20status\x20code\x20=\x20'+_0x1d28de[_0x6d6a('0x17')]+'\x20('+_0x1d28de[_0x6d6a('0x1a')]+')'));return;}var _0x4234b6='';_0x1d28de['on']('data',function(_0x5e4ce0){_0x4234b6+=_0x5e4ce0;});_0x1d28de['on'](_0x6d6a('0x21'),function(){_0x1d488c(_0x4234b6);});})['on'](_0x6d6a('0x18'),function(_0x2bfaf0){_0x1346f3(_0x2bfaf0);})[_0x6d6a('0x21')]();});}function convertFile(_0x57eba0,_0x28f6f0){return new BPromise(function(_0x12845a,_0x398a03){var _0x397277=sox['transcode'](_0x57eba0,_0x28f6f0,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x397277['on'](_0x6d6a('0x18'),function(_0x55a6ca){logger['error']('error\x20convert',_0x55a6ca);_0x398a03(_0x55a6ca);});_0x397277['on'](_0x6d6a('0x21'),function(){logger['info']('finish\x20to\x20convert');_0x12845a();});_0x397277[_0x6d6a('0x22')]();});}function base64Decode(_0x2e7614,_0x26d6fe){var _0x5c988e=path[_0x6d6a('0x23')](__dirname,_0x6d6a('0x24'),rs[_0x6d6a('0x25')](0x4)+'.wav');fs[_0x6d6a('0x26')](_0x5c988e,_0x2e7614,_0x6d6a('0x27'));return convertFile(_0x5c988e,_0x26d6fe)['then'](function(){try{fs[_0x6d6a('0x28')](_0x5c988e);fs[_0x6d6a('0x29')](_0x26d6fe,_0x6d6a('0x2a'));}catch(_0x25569b){logger[_0x6d6a('0x18')](_0x25569b);}return _0x26d6fe[_0x6d6a('0x2b')]('.')[0x0];});}function base64Encode(_0x174c7c){var _0x14f2f6=fs[_0x6d6a('0x2c')](_0x174c7c);return new Buffer(_0x14f2f6)[_0x6d6a('0x2d')](_0x6d6a('0x27'));}exports[_0x6d6a('0x2e')]=function(_0x544d9c,_0x5689a8,_0x33b910,_0x4240f6,_0x357292,_0x4c9517){var _0x290693,_0x2eb095;var _0x38b0ed=_0x6d6a('0x2f');var _0x487fbe='?key='+_0x544d9c;var _0x28198f={};if(_0x5689a8===_0x6d6a('0x30')){_0x28198f['input']={'ssml':_0x33b910};}else{_0x28198f[_0x6d6a('0x31')]={'text':_0x33b910};};_0x28198f[_0x6d6a('0x32')]={'languageCode':_0x4240f6,'ssmlGender':_0x357292};_0x28198f['audioConfig']={'audioEncoding':_0x6d6a('0x33'),'sampleRateHertz':0x1f40};var _0xc49c8b={'url':_0x38b0ed+_0x6d6a('0x34')+_0x487fbe,'method':_0x6d6a('0x35'),'json':!![],'body':_0x28198f};return rp(_0xc49c8b)[_0x6d6a('0x36')](function(_0x1f53e1){return new BPromise(function(_0x2c54b0,_0xed0b6b){_0x290693=path['resolve'](__dirname,_0x6d6a('0x24'),rs[_0x6d6a('0x25')](0x4)+'.mp3');var _0xfbf04f=Buffer[_0x6d6a('0x37')](_0x1f53e1[_0x6d6a('0x38')],'base64');return fs['writeFile'](_0x290693,_0xfbf04f,function(_0x3dac5c){_0xed0b6b(_0x3dac5c);},function(_0x363b26){fs[_0x6d6a('0x29')](_0x290693,_0x6d6a('0x2a'));_0x2c54b0(_0x363b26);});});})[_0x6d6a('0x36')](function(_0x459286){_0x2eb095=path[_0x6d6a('0x23')](__dirname,'tmp',rs[_0x6d6a('0x25')](0x4)+_0x6d6a('0x39'));return convertFile(_0x290693,_0x2eb095);})['then'](function(){try{fs['unlink'](_0x290693);fs[_0x6d6a('0x29')](_0x2eb095,'777');}catch(_0x2e39ba){logger[_0x6d6a('0x18')](_0x2e39ba);}logger[_0x6d6a('0x1e')]('googleCloudTTS\x20path',_0x2eb095[_0x6d6a('0x2b')]('.')[0x0]);return _0x2eb095[_0x6d6a('0x2b')]('.')[0x0];});};exports[_0x6d6a('0x3a')]=function(_0x3a37dd,_0x3489a1){var _0x2d2878=_0x6d6a('0x3b');var _0x302c7b,_0x412616;var _0xe58923;var _0x5b84d2={'encoding':'utf8','method':_0x6d6a('0x35'),'timeout':0x2710,'url':_0x2d2878,'headers':{'Content-Type':_0x6d6a('0x3c')},'body':'f.req='+encodeURIComponent(JSON[_0x6d6a('0x3d')]([[[_0x6d6a('0x3e'),JSON[_0x6d6a('0x3d')]([_0x3a37dd,_0x3489a1||'en',![],_0x6d6a('0x3f')]),null,_0x6d6a('0x40')]]]))};return rp(_0x5b84d2)[_0x6d6a('0x36')](function(_0x5645a6){try{_0xe58923=eval(_0x5645a6['slice'](0x5))[0x0][0x2];}catch(_0x5320ee){throw new Error(_0x6d6a('0x41')+_0x5645a6['data']);}if(!_0xe58923){if(_0x3a37dd[_0x6d6a('0x42')]>0xc8){throw new Error(_0x6d6a('0x43'));}else{throw new Error('lang\x20\x22'+_0x3489a1+_0x6d6a('0x44'));}}try{_0xe58923=eval(_0xe58923)[0x0];}catch(_0x25c5f8){throw new Error(_0x6d6a('0x41')+res[_0x6d6a('0x45')]);}const _0x5a95e8=_0xe58923;_0x302c7b=path[_0x6d6a('0x23')](__dirname,_0x6d6a('0x24'),rs[_0x6d6a('0x25')](0x4)+_0x6d6a('0x46'));fs[_0x6d6a('0x26')](_0x302c7b,_0xe58923,{'encoding':_0x6d6a('0x27')});_0x412616=path[_0x6d6a('0x23')](__dirname,'tmp',rs['generate'](0x4)+'.wav');return convertFile(_0x302c7b,_0x412616);})[_0x6d6a('0x36')](function(){try{fs[_0x6d6a('0x28')](_0x302c7b);fs[_0x6d6a('0x29')](_0x412616,'777');}catch(_0x4f5da4){logger[_0x6d6a('0x18')](_0x4f5da4);}logger['info']('goggleTTS\x20path',_0x412616['split']('.')[0x0]);return _0x412616[_0x6d6a('0x2b')]('.')[0x0];});};exports[_0x6d6a('0x47')]=function(_0x5f4c33,_0x35bb6f,_0xe800ca){return google[_0x6d6a('0x48')](_0x5f4c33,_0x35bb6f,_0xe800ca)[_0x6d6a('0x36')](function(_0x3ef58e){logger[_0x6d6a('0x1e')](_0x3ef58e['uri']);return rp(_0x3ef58e);})[_0x6d6a('0x36')](function(_0x527a26){var _0x1016b0='';var _0x2dc4c9=0x0;try{fs[_0x6d6a('0x28')](_0x5f4c33);}catch(_0x536a49){logger['error'](_0x536a49);}if(_0x527a26&&_0x527a26[_0x6d6a('0x49')]){_0x1016b0=_0x527a26['results'][_0x6d6a('0x4a')](function(_0x35713a){return _0x35713a&&_0x35713a['alternatives'][0x0]&&_0x35713a['alternatives'][0x0]['transcript']?_0x35713a[_0x6d6a('0x4b')][0x0][_0x6d6a('0x4c')]:'';})['join']('\x0a');_0x2dc4c9=_0x527a26[_0x6d6a('0x49')][_0x6d6a('0x4a')](function(_0x3ce6af){return _0x3ce6af&&_0x3ce6af[_0x6d6a('0x4b')][0x0]&&_0x3ce6af['alternatives'][0x0][_0x6d6a('0x4d')]?_0x3ce6af[_0x6d6a('0x4b')][0x0][_0x6d6a('0x4d')]:0x0;})[_0x6d6a('0x4e')]('\x0a');}logger['info'](_0x6d6a('0x4f'),_0x1016b0);logger[_0x6d6a('0x1e')](_0x6d6a('0x50'),_0x2dc4c9);return{'transcript':_0x1016b0,'confidence':_0x2dc4c9};})[_0x6d6a('0x51')](function(_0x5c581c){logger[_0x6d6a('0x18')]('[%s]\x20%s:%s',_0x5c581c['statusCode'],_0x5c581c['name'],_0x5c581c[_0x6d6a('0x52')]);});};exports['googleDialogflow']=function(_0x2db07b,_0x2d29f1,_0x18b5ff,_0x5034d3){var _0x2fcde0=apiai(_0x2d29f1,{'language':_0x5034d3||'en'});return _0x2fcde0[_0x6d6a('0x53')](_0x18b5ff,{'sessionId':md5(_0x2db07b)})[_0x6d6a('0x36')](function(_0x1d3bad){logger[_0x6d6a('0x1e')](JSON['stringify'](_0x1d3bad));return{'source':_0x1d3bad[_0x6d6a('0x54')][_0x6d6a('0x55')],'resolvedQuery':_0x1d3bad[_0x6d6a('0x54')][_0x6d6a('0x56')],'action':_0x1d3bad[_0x6d6a('0x54')][_0x6d6a('0x57')],'actionIncomplete':_0x1d3bad[_0x6d6a('0x54')][_0x6d6a('0x58')],'speech':_0x1d3bad['result']['fulfillment'][_0x6d6a('0x59')],'score':_0x1d3bad['result']['score'],'statusCode':_0x1d3bad['status'][_0x6d6a('0x5a')],'endConversation':_0x1d3bad[_0x6d6a('0x54')]['metadata']['endConversation']||![],'isFallbackIntent':_0x1d3bad[_0x6d6a('0x54')][_0x6d6a('0x5b')][_0x6d6a('0x5c')]};});};exports[_0x6d6a('0x5d')]=function(_0x4a8d45,_0x1c0b74,_0x5811bd,_0x5ba38c,_0x555679,_0x21d552){var _0x1b1619=_0x5ba38c['replace'](/\\n/g,'\x0a');var _0x2d7055={'credentials':{'private_key':_0x1b1619,'client_email':_0x5811bd}};var _0x33fd6a=new dialogflow[(_0x6d6a('0x5e'))](_0x2d7055);var _0x2294cc=_0x33fd6a[_0x6d6a('0x5f')](_0x1c0b74,md5(_0x4a8d45));var _0x4ce047={'session':_0x2294cc,'queryInput':{'text':{'text':_0x555679,'languageCode':_0x21d552}}};return _0x33fd6a[_0x6d6a('0x60')](_0x4ce047)['then'](function(_0x24e1f5){if(_0x24e1f5&&_0x24e1f5['length']){logger[_0x6d6a('0x1e')](_0x6d6a('0x61'),JSON['stringify'](_0x24e1f5));var _0x36888d=_0x24e1f5[0x0];if(_0x36888d){var _0x4ee21c={'action':_0x36888d[_0x6d6a('0x62')][_0x6d6a('0x57')],'allRequiredParamsPresent':_0x36888d['queryResult'][_0x6d6a('0x63')],'endConversation':_0x36888d[_0x6d6a('0x62')][_0x6d6a('0x64')]&&_0x36888d['queryResult']['diagnosticInfo']['fields']?_0x36888d[_0x6d6a('0x62')]['diagnosticInfo']['fields'][_0x6d6a('0x65')][_0x6d6a('0x66')]:![],'fulfillmentText':_0x36888d[_0x6d6a('0x62')]['fulfillmentText'],'intentName':_0x36888d['queryResult'][_0x6d6a('0x67')][_0x6d6a('0x68')],'intentDisplayName':_0x36888d[_0x6d6a('0x62')][_0x6d6a('0x67')][_0x6d6a('0x69')],'isFallbackIntent':_0x36888d[_0x6d6a('0x62')][_0x6d6a('0x67')]['isFallback'],'languageCode':_0x36888d[_0x6d6a('0x62')][_0x6d6a('0x6a')],'queryText':_0x36888d[_0x6d6a('0x62')][_0x6d6a('0x6b')],'responseId':_0x36888d[_0x6d6a('0x6c')],'score':_0x36888d[_0x6d6a('0x62')][_0x6d6a('0x6d')],'speech':_0x36888d[_0x6d6a('0x62')]['fulfillmentText'],'providerResponse':JSON[_0x6d6a('0x3d')](_0x24e1f5)};return _0x4ee21c;}}});};exports[_0x6d6a('0x6e')]=function(_0x4bda85,_0x4cd495,_0xa58032,_0x5532f1){return tilde['asr'](_0x4bda85,_0x4cd495,_0xa58032,_0x5532f1)[_0x6d6a('0x36')](function(_0x57a963){try{fs[_0x6d6a('0x28')](_0x4bda85);}catch(_0x235460){logger['error'](_0x235460);}logger[_0x6d6a('0x1e')]('Tilde\x20ASR\x20transcription',_0x57a963['transcript']);logger[_0x6d6a('0x1e')](_0x6d6a('0x6f'),_0x57a963[_0x6d6a('0x4d')]);return _0x57a963;});};exports[_0x6d6a('0x70')]=function(_0x247e12,_0x455400,_0x31048e,_0x197b45,_0x3f9a8e,_0x33d536){var _0x26ff46=path['resolve'](__dirname,_0x6d6a('0x24'),rs[_0x6d6a('0x25')](0x4)+_0x6d6a('0x46'));var _0x2803fc;return aws['polly'](_0x247e12,_0x455400,_0x31048e,_0x197b45,_0x3f9a8e,_0x33d536,_0x26ff46)[_0x6d6a('0x36')](function(){_0x2803fc=path[_0x6d6a('0x23')](__dirname,'tmp',rs['generate'](0x4)+_0x6d6a('0x39'));return convertFile(_0x26ff46,_0x2803fc);})[_0x6d6a('0x36')](function(){try{fs[_0x6d6a('0x28')](_0x26ff46);fs[_0x6d6a('0x29')](_0x2803fc,'777');}catch(_0x46a21b){logger[_0x6d6a('0x18')](_0x46a21b);}return _0x2803fc['split']('.')[0x0];});};exports['awsLex']=function(_0x276934,_0x248d0c,_0x1e872a,_0x5343e6,_0x57e1e5,_0x573efb){return aws[_0x6d6a('0x71')](_0x276934,_0x248d0c,_0x1e872a,_0x5343e6,_0x57e1e5,_0x573efb)[_0x6d6a('0x36')](function(_0x19f3c1){logger['info'](JSON[_0x6d6a('0x3d')](_0x19f3c1));return _0x19f3c1;});};exports[_0x6d6a('0x72')]=function(_0x4a2d45,_0xc0fd96,_0x31cd77,_0x23bea6){var _0x5604e7=util[_0x6d6a('0x73')](_0x6d6a('0x74'),ISPEECH_API,_0x4a2d45,encodeURIComponent(_0xc0fd96),_0x31cd77,_0x23bea6);var _0x4466c4=path[_0x6d6a('0x23')](__dirname,_0x6d6a('0x24'),rs['generate'](0x4)+_0x6d6a('0x46'));var _0x26514f;return downloadFile(_0x5604e7,_0x4466c4)['then'](function(){_0x26514f=path[_0x6d6a('0x23')](__dirname,_0x6d6a('0x24'),rs['generate'](0x4)+_0x6d6a('0x39'));return convertFile(_0x4466c4,_0x26514f);})[_0x6d6a('0x36')](function(){try{fs[_0x6d6a('0x28')](_0x4466c4);fs[_0x6d6a('0x29')](_0x26514f,_0x6d6a('0x2a'));}catch(_0x33a1b6){logger['error'](_0x33a1b6);}return _0x26514f[_0x6d6a('0x2b')]('.')[0x0];});};exports['ispeechASR']=function(_0x2648e8,_0x23281a,_0x150175,_0x3744e9){var _0x362ba7=util[_0x6d6a('0x73')](_0x6d6a('0x75'),ISPEECH_API,_0x23281a,_0x150175,base64Encode(_0x2648e8),_0x3744e9?util[_0x6d6a('0x73')]('model=%s',encodeURIComponent(_0x3744e9)):_0x6d6a('0x76'));return uploadFile(_0x362ba7)[_0x6d6a('0x36')](function(_0x3996f7){return querystring[_0x6d6a('0x77')](_0x3996f7);});};exports[_0x6d6a('0x78')]=function(_0x103a3d,_0x2d0757){return sestek['nda'](_0x103a3d,_0x2d0757)[_0x6d6a('0x36')](function(_0x498896){logger[_0x6d6a('0x1e')](JSON[_0x6d6a('0x3d')](_0x498896));var _0x21d019={'speech':_0x498896['text'],'action':_0x498896['channelData']?_0x498896[_0x6d6a('0x79')]['CustomAction']:undefined,'actiondata':_0x498896[_0x6d6a('0x79')]?_0x498896['channelData'][_0x6d6a('0x7a')]:undefined};if(_0x498896['channelData']&&_0x498896[_0x6d6a('0x79')][_0x6d6a('0x7b')]){return base64Decode(_0x498896[_0x6d6a('0x79')][_0x6d6a('0x7b')][_0x6d6a('0x7c')],path[_0x6d6a('0x23')](__dirname,_0x6d6a('0x24'),rs[_0x6d6a('0x25')](0x4)+'.wav'))['then'](function(_0x1ee294){_0x21d019['audiofile']=_0x1ee294;return _0x21d019;});}return _0x21d019;});};exports[_0x6d6a('0x7d')]=function(){return __dirname;}; \ No newline at end of file +var _0x4e38=['null','generic','parse\x20response\x20failed:\x0a','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','goggleTTS\x20path','googleASR','asr','results','map','alternatives','transcript','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','message','textRequest','result','source','actionIncomplete','fulfillment','speech','status','code','metadata','isFallbackIntent','googleDialogflowV2','replace','detectIntent','Dialogflow\x20V2\x20response:','queryResult','action','allRequiredParamsPresent','diagnosticInfo','fields','boolValue','fulfillmentText','name','intent','displayName','isFallback','queryText','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','freeform=3','sestekNDA','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','dialogflow','md5','path','querystring','request-promise','sox','parse','util','./aws','./google','./sestek','../../../config/logger','protocol','https:','WHAT_EVER','get','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusCode','statusMessage','createWriteStream','close','unlink','download\x20error','data','end','transcode','error\x20convert','info','finish\x20to\x20convert','start','resolve','.wav','writeFileSync','base64','then','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','ssml','input','voice','text:synthesize','POST','tmp','generate','.mp3','from','audioContent','chmodSync','777','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','application/x-www-form-urlencoded','stringify','jQ1olc'];(function(_0x53a6c0,_0x53df9a){var _0x30c452=function(_0x34f3ed){while(--_0x34f3ed){_0x53a6c0['push'](_0x53a6c0['shift']());}};_0x30c452(++_0x53df9a);}(_0x4e38,0xbf));var _0x84e3=function(_0x499abc,_0x294679){_0x499abc=_0x499abc-0x0;var _0x1c6bef=_0x4e38[_0x499abc];return _0x1c6bef;};'use strict';var apiai=require(_0x84e3('0x0'));var BPromise=require(_0x84e3('0x1'));var dialogflow=require(_0x84e3('0x2'));var fs=require('fs');var http=require('http');var https=require('https');var md5=require(_0x84e3('0x3'));var path=require(_0x84e3('0x4'));var querystring=require(_0x84e3('0x5'));var rp=require(_0x84e3('0x6'));var rs=require('randomstring');var sox=require(_0x84e3('0x7'));var tts=require('google-tts-api');var urlParse=require('url')[_0x84e3('0x8')];var util=require(_0x84e3('0x9'));var aws=require(_0x84e3('0xa'));var google=require(_0x84e3('0xb'));var sestek=require(_0x84e3('0xc'));var tilde=require('./tilde');var logger=require(_0x84e3('0xd'))('agi');var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x5c14f0,_0x5d01ed){return new BPromise(function(_0x191a25,_0x120c7b){var _0x2619e6=urlParse(_0x5c14f0);var _0x149174=_0x2619e6[_0x84e3('0xe')]===_0x84e3('0xf')?https:http;var _0x340f53={'host':_0x2619e6['host'],'path':_0x2619e6[_0x84e3('0x4')],'headers':{'user-agent':_0x84e3('0x10')}};_0x149174[_0x84e3('0x11')](_0x340f53,function(_0x40fac9){if(_0x40fac9['statusCode']!==0xc8){logger[_0x84e3('0x12')](_0x84e3('0x13')+_0x5c14f0+_0x84e3('0x14')+_0x40fac9[_0x84e3('0x15')]+'\x20('+_0x40fac9[_0x84e3('0x16')]+')');_0x120c7b(new Error(_0x84e3('0x13')+_0x5c14f0+_0x84e3('0x14')+_0x40fac9[_0x84e3('0x15')]+'\x20('+_0x40fac9[_0x84e3('0x16')]+')'));return;}var _0x2546f7=fs[_0x84e3('0x17')](_0x5d01ed);_0x2546f7['on']('finish',function(){logger['info']('finish\x20download\x20file');_0x2546f7[_0x84e3('0x18')](_0x191a25);});_0x2546f7['on']('error',function(_0x4fdcdf){fs[_0x84e3('0x19')](_0x5d01ed);logger[_0x84e3('0x12')](_0x84e3('0x1a'),_0x4fdcdf);_0x120c7b(_0x4fdcdf);});_0x40fac9['pipe'](_0x2546f7);})['on'](_0x84e3('0x12'),function(_0x11e8c3){logger['error'](_0x11e8c3);_0x120c7b(_0x11e8c3);})['end']();});}function uploadFile(_0x189090){return new BPromise(function(_0x24a426,_0x5947dc){var _0x3b1080=urlParse(_0x189090);var _0x5180c0=_0x3b1080[_0x84e3('0xe')]===_0x84e3('0xf')?https:http;var _0x529f11={'host':_0x3b1080['host'],'path':_0x3b1080[_0x84e3('0x4')],'headers':{'user-agent':_0x84e3('0x10')}};_0x5180c0[_0x84e3('0x11')](_0x529f11,function(_0x4544b3){if(_0x4544b3['statusCode']!==0xc8){_0x5947dc(new Error('request\x20to\x20'+_0x189090+_0x84e3('0x14')+_0x4544b3[_0x84e3('0x15')]+'\x20('+_0x4544b3['statusMessage']+')'));return;}var _0x5acd49='';_0x4544b3['on'](_0x84e3('0x1b'),function(_0x4baafb){_0x5acd49+=_0x4baafb;});_0x4544b3['on'](_0x84e3('0x1c'),function(){_0x24a426(_0x5acd49);});})['on'](_0x84e3('0x12'),function(_0xd4f4e8){_0x5947dc(_0xd4f4e8);})['end']();});}function convertFile(_0x198146,_0x558069){return new BPromise(function(_0xe0d677,_0x3316c9){var _0x766f4e=sox[_0x84e3('0x1d')](_0x198146,_0x558069,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x766f4e['on']('error',function(_0x5a93ed){logger[_0x84e3('0x12')](_0x84e3('0x1e'),_0x5a93ed);_0x3316c9(_0x5a93ed);});_0x766f4e['on']('end',function(){logger[_0x84e3('0x1f')](_0x84e3('0x20'));_0xe0d677();});_0x766f4e[_0x84e3('0x21')]();});}function base64Decode(_0x14bf00,_0x2a96b7){var _0x229427=path[_0x84e3('0x22')](__dirname,'tmp',rs['generate'](0x4)+_0x84e3('0x23'));fs[_0x84e3('0x24')](_0x229427,_0x14bf00,_0x84e3('0x25'));return convertFile(_0x229427,_0x2a96b7)[_0x84e3('0x26')](function(){try{fs['unlink'](_0x229427);fs['chmodSync'](_0x2a96b7,'777');}catch(_0x30c9b8){logger[_0x84e3('0x12')](_0x30c9b8);}return _0x2a96b7[_0x84e3('0x27')]('.')[0x0];});}function base64Encode(_0x592bc0){var _0x53fed0=fs[_0x84e3('0x28')](_0x592bc0);return new Buffer(_0x53fed0)[_0x84e3('0x29')](_0x84e3('0x25'));}exports[_0x84e3('0x2a')]=function(_0x887ff8,_0x33c65f,_0x4150d7,_0x5c6e71,_0x556e50,_0x4c392e){var _0x435116,_0x506656;var _0x18060e=_0x84e3('0x2b');var _0x4643e0='?key='+_0x887ff8;var _0x58692d={};if(_0x33c65f===_0x84e3('0x2c')){_0x58692d[_0x84e3('0x2d')]={'ssml':_0x4150d7};}else{_0x58692d[_0x84e3('0x2d')]={'text':_0x4150d7};};_0x58692d[_0x84e3('0x2e')]={'languageCode':_0x5c6e71,'ssmlGender':_0x556e50};_0x58692d['audioConfig']={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x2d42f3={'url':_0x18060e+_0x84e3('0x2f')+_0x4643e0,'method':_0x84e3('0x30'),'json':!![],'body':_0x58692d};return rp(_0x2d42f3)[_0x84e3('0x26')](function(_0x109229){return new BPromise(function(_0x3b325b,_0x1a8a0a){_0x435116=path[_0x84e3('0x22')](__dirname,_0x84e3('0x31'),rs[_0x84e3('0x32')](0x4)+_0x84e3('0x33'));var _0x3c9546=Buffer[_0x84e3('0x34')](_0x109229[_0x84e3('0x35')],_0x84e3('0x25'));return fs['writeFile'](_0x435116,_0x3c9546,function(_0xdc75c6){_0x1a8a0a(_0xdc75c6);},function(_0x106218){fs[_0x84e3('0x36')](_0x435116,_0x84e3('0x37'));_0x3b325b(_0x106218);});});})[_0x84e3('0x26')](function(_0x463eac){_0x506656=path['resolve'](__dirname,'tmp',rs[_0x84e3('0x32')](0x4)+_0x84e3('0x23'));return convertFile(_0x435116,_0x506656);})['then'](function(){try{fs[_0x84e3('0x19')](_0x435116);fs['chmodSync'](_0x506656,_0x84e3('0x37'));}catch(_0x441f45){logger[_0x84e3('0x12')](_0x441f45);}logger[_0x84e3('0x1f')]('googleCloudTTS\x20path',_0x506656[_0x84e3('0x27')]('.')[0x0]);return _0x506656[_0x84e3('0x27')]('.')[0x0];});};exports[_0x84e3('0x38')]=function(_0x2913fd,_0x2c60a1){var _0x3eb1ae=_0x84e3('0x39');var _0x5c69f2,_0x4dd455;var _0x4f1123;var _0x5990a1={'encoding':'utf8','method':_0x84e3('0x30'),'timeout':0x2710,'url':_0x3eb1ae,'headers':{'Content-Type':_0x84e3('0x3a')},'body':'f.req='+encodeURIComponent(JSON[_0x84e3('0x3b')]([[[_0x84e3('0x3c'),JSON[_0x84e3('0x3b')]([_0x2913fd,_0x2c60a1||'en',![],_0x84e3('0x3d')]),null,_0x84e3('0x3e')]]]))};return rp(_0x5990a1)[_0x84e3('0x26')](function(_0x59f701){try{_0x4f1123=eval(_0x59f701['slice'](0x5))[0x0][0x2];}catch(_0xa1cd6f){throw new Error(_0x84e3('0x3f')+_0x59f701[_0x84e3('0x1b')]);}if(!_0x4f1123){if(_0x2913fd['length']>0xc8){throw new Error(_0x84e3('0x40'));}else{throw new Error(_0x84e3('0x41')+_0x2c60a1+_0x84e3('0x42'));}}try{_0x4f1123=eval(_0x4f1123)[0x0];}catch(_0x510bf0){throw new Error(_0x84e3('0x3f')+res[_0x84e3('0x1b')]);}const _0x2c3b59=_0x4f1123;_0x5c69f2=path[_0x84e3('0x22')](__dirname,_0x84e3('0x31'),rs[_0x84e3('0x32')](0x4)+_0x84e3('0x33'));fs[_0x84e3('0x24')](_0x5c69f2,_0x4f1123,{'encoding':_0x84e3('0x25')});_0x4dd455=path[_0x84e3('0x22')](__dirname,_0x84e3('0x31'),rs['generate'](0x4)+_0x84e3('0x23'));return convertFile(_0x5c69f2,_0x4dd455);})[_0x84e3('0x26')](function(){try{fs[_0x84e3('0x19')](_0x5c69f2);fs[_0x84e3('0x36')](_0x4dd455,_0x84e3('0x37'));}catch(_0x53f11c){logger[_0x84e3('0x12')](_0x53f11c);}logger[_0x84e3('0x1f')](_0x84e3('0x43'),_0x4dd455['split']('.')[0x0]);return _0x4dd455[_0x84e3('0x27')]('.')[0x0];});};exports[_0x84e3('0x44')]=function(_0x621b53,_0x25d4ef,_0x29989e){return google[_0x84e3('0x45')](_0x621b53,_0x25d4ef,_0x29989e)[_0x84e3('0x26')](function(_0x45124d){logger[_0x84e3('0x1f')](_0x45124d['uri']);return rp(_0x45124d);})[_0x84e3('0x26')](function(_0x5a3877){var _0x1ed4ce='';var _0x36c69b=0x0;try{fs[_0x84e3('0x19')](_0x621b53);}catch(_0x1b9ffd){logger['error'](_0x1b9ffd);}if(_0x5a3877&&_0x5a3877[_0x84e3('0x46')]){_0x1ed4ce=_0x5a3877[_0x84e3('0x46')][_0x84e3('0x47')](function(_0x15869b){return _0x15869b&&_0x15869b[_0x84e3('0x48')][0x0]&&_0x15869b[_0x84e3('0x48')][0x0]['transcript']?_0x15869b['alternatives'][0x0][_0x84e3('0x49')]:'';})['join']('\x0a');_0x36c69b=_0x5a3877[_0x84e3('0x46')][_0x84e3('0x47')](function(_0x499f99){return _0x499f99&&_0x499f99[_0x84e3('0x48')][0x0]&&_0x499f99[_0x84e3('0x48')][0x0][_0x84e3('0x4a')]?_0x499f99[_0x84e3('0x48')][0x0][_0x84e3('0x4a')]:0x0;})['join']('\x0a');}logger[_0x84e3('0x1f')](_0x84e3('0x4b'),_0x1ed4ce);logger[_0x84e3('0x1f')](_0x84e3('0x4c'),_0x36c69b);return{'transcript':_0x1ed4ce,'confidence':_0x36c69b};})[_0x84e3('0x4d')](function(_0x2fb4e0){logger[_0x84e3('0x12')](_0x84e3('0x4e'),_0x2fb4e0[_0x84e3('0x15')],_0x2fb4e0['name'],_0x2fb4e0[_0x84e3('0x4f')]);});};exports['googleDialogflow']=function(_0x5fbfa1,_0x160736,_0xed5396,_0x3451fa){var _0x44c6e3=apiai(_0x160736,{'language':_0x3451fa||'en'});return _0x44c6e3[_0x84e3('0x50')](_0xed5396,{'sessionId':md5(_0x5fbfa1)})['then'](function(_0x43ccb2){logger[_0x84e3('0x1f')](JSON[_0x84e3('0x3b')](_0x43ccb2));return{'source':_0x43ccb2[_0x84e3('0x51')][_0x84e3('0x52')],'resolvedQuery':_0x43ccb2[_0x84e3('0x51')]['resolvedQuery'],'action':_0x43ccb2[_0x84e3('0x51')]['action'],'actionIncomplete':_0x43ccb2[_0x84e3('0x51')][_0x84e3('0x53')],'speech':_0x43ccb2[_0x84e3('0x51')][_0x84e3('0x54')][_0x84e3('0x55')],'score':_0x43ccb2['result']['score'],'statusCode':_0x43ccb2[_0x84e3('0x56')][_0x84e3('0x57')],'endConversation':_0x43ccb2[_0x84e3('0x51')][_0x84e3('0x58')]['endConversation']||![],'isFallbackIntent':_0x43ccb2[_0x84e3('0x51')]['metadata'][_0x84e3('0x59')]};});};exports[_0x84e3('0x5a')]=function(_0x199f13,_0x466a4d,_0x52f605,_0x108158,_0x5842ee,_0x28691a){var _0x22d494=_0x108158[_0x84e3('0x5b')](/\\n/g,'\x0a');var _0x16ffe6={'credentials':{'private_key':_0x22d494,'client_email':_0x52f605}};var _0x3787db=new dialogflow['SessionsClient'](_0x16ffe6);var _0x38e79a=_0x3787db['sessionPath'](_0x466a4d,md5(_0x199f13));var _0x92942={'session':_0x38e79a,'queryInput':{'text':{'text':_0x5842ee,'languageCode':_0x28691a}}};return _0x3787db[_0x84e3('0x5c')](_0x92942)[_0x84e3('0x26')](function(_0x5e562a){if(_0x5e562a&&_0x5e562a['length']){logger[_0x84e3('0x1f')](_0x84e3('0x5d'),JSON['stringify'](_0x5e562a));var _0x4782af=_0x5e562a[0x0];if(_0x4782af){var _0x236140={'action':_0x4782af[_0x84e3('0x5e')][_0x84e3('0x5f')],'allRequiredParamsPresent':_0x4782af[_0x84e3('0x5e')][_0x84e3('0x60')],'endConversation':_0x4782af[_0x84e3('0x5e')][_0x84e3('0x61')]&&_0x4782af[_0x84e3('0x5e')]['diagnosticInfo'][_0x84e3('0x62')]?_0x4782af['queryResult'][_0x84e3('0x61')][_0x84e3('0x62')]['end_conversation'][_0x84e3('0x63')]:![],'fulfillmentText':_0x4782af[_0x84e3('0x5e')][_0x84e3('0x64')],'intentName':_0x4782af['queryResult']['intent'][_0x84e3('0x65')],'intentDisplayName':_0x4782af[_0x84e3('0x5e')][_0x84e3('0x66')][_0x84e3('0x67')],'isFallbackIntent':_0x4782af[_0x84e3('0x5e')][_0x84e3('0x66')][_0x84e3('0x68')],'languageCode':_0x4782af[_0x84e3('0x5e')]['languageCode'],'queryText':_0x4782af[_0x84e3('0x5e')][_0x84e3('0x69')],'responseId':_0x4782af['responseId'],'score':_0x4782af[_0x84e3('0x5e')][_0x84e3('0x6a')],'speech':_0x4782af[_0x84e3('0x5e')][_0x84e3('0x64')],'providerResponse':JSON[_0x84e3('0x3b')](_0x5e562a)};return _0x236140;}}});};exports[_0x84e3('0x6b')]=function(_0x1fbe7f,_0x33642a,_0x20bf3a,_0x29db6f){return tilde['asr'](_0x1fbe7f,_0x33642a,_0x20bf3a,_0x29db6f)['then'](function(_0x25b9ce){try{fs[_0x84e3('0x19')](_0x1fbe7f);}catch(_0x2835b3){logger[_0x84e3('0x12')](_0x2835b3);}logger[_0x84e3('0x1f')](_0x84e3('0x6c'),_0x25b9ce['transcript']);logger[_0x84e3('0x1f')](_0x84e3('0x6d'),_0x25b9ce[_0x84e3('0x4a')]);return _0x25b9ce;});};exports[_0x84e3('0x6e')]=function(_0x36e937,_0x1125f2,_0x474ce0,_0x29a58a,_0x5498d3,_0x1930ab){var _0x1f4c46=path['resolve'](__dirname,'tmp',rs[_0x84e3('0x32')](0x4)+_0x84e3('0x33'));var _0x24c715;return aws[_0x84e3('0x6f')](_0x36e937,_0x1125f2,_0x474ce0,_0x29a58a,_0x5498d3,_0x1930ab,_0x1f4c46)[_0x84e3('0x26')](function(){_0x24c715=path[_0x84e3('0x22')](__dirname,_0x84e3('0x31'),rs['generate'](0x4)+_0x84e3('0x23'));return convertFile(_0x1f4c46,_0x24c715);})[_0x84e3('0x26')](function(){try{fs[_0x84e3('0x19')](_0x1f4c46);fs[_0x84e3('0x36')](_0x24c715,_0x84e3('0x37'));}catch(_0x3fda27){logger[_0x84e3('0x12')](_0x3fda27);}return _0x24c715[_0x84e3('0x27')]('.')[0x0];});};exports[_0x84e3('0x70')]=function(_0x7d5974,_0x5251a5,_0x11df80,_0x6d1fc8,_0x299d46,_0x534785){return aws['lex'](_0x7d5974,_0x5251a5,_0x11df80,_0x6d1fc8,_0x299d46,_0x534785)[_0x84e3('0x26')](function(_0x230ae8){logger[_0x84e3('0x1f')](JSON[_0x84e3('0x3b')](_0x230ae8));return _0x230ae8;});};exports['ispeechTTS']=function(_0x11bb88,_0x2d02ac,_0x5622b6,_0x460612){var _0x1b8297=util[_0x84e3('0x71')](_0x84e3('0x72'),ISPEECH_API,_0x11bb88,encodeURIComponent(_0x2d02ac),_0x5622b6,_0x460612);var _0x2fe1ac=path['resolve'](__dirname,'tmp',rs[_0x84e3('0x32')](0x4)+_0x84e3('0x33'));var _0x1570cc;return downloadFile(_0x1b8297,_0x2fe1ac)[_0x84e3('0x26')](function(){_0x1570cc=path[_0x84e3('0x22')](__dirname,_0x84e3('0x31'),rs[_0x84e3('0x32')](0x4)+_0x84e3('0x23'));return convertFile(_0x2fe1ac,_0x1570cc);})['then'](function(){try{fs[_0x84e3('0x19')](_0x2fe1ac);fs[_0x84e3('0x36')](_0x1570cc,_0x84e3('0x37'));}catch(_0x1a840b){logger[_0x84e3('0x12')](_0x1a840b);}return _0x1570cc[_0x84e3('0x27')]('.')[0x0];});};exports[_0x84e3('0x73')]=function(_0x382137,_0x3c82fe,_0x5717a4,_0x5bf5e1){var _0x230274=util[_0x84e3('0x71')](_0x84e3('0x74'),ISPEECH_API,_0x3c82fe,_0x5717a4,base64Encode(_0x382137),_0x5bf5e1?util[_0x84e3('0x71')]('model=%s',encodeURIComponent(_0x5bf5e1)):_0x84e3('0x75'));return uploadFile(_0x230274)[_0x84e3('0x26')](function(_0x5879c0){return querystring[_0x84e3('0x8')](_0x5879c0);});};exports[_0x84e3('0x76')]=function(_0xe458a1,_0x5f3012){return sestek['nda'](_0xe458a1,_0x5f3012)[_0x84e3('0x26')](function(_0x4d6ba3){logger[_0x84e3('0x1f')](JSON[_0x84e3('0x3b')](_0x4d6ba3));var _0x44df15={'speech':_0x4d6ba3['text'],'action':_0x4d6ba3['channelData']?_0x4d6ba3[_0x84e3('0x77')][_0x84e3('0x78')]:undefined,'actiondata':_0x4d6ba3[_0x84e3('0x77')]?_0x4d6ba3[_0x84e3('0x77')][_0x84e3('0x79')]:undefined};if(_0x4d6ba3[_0x84e3('0x77')]&&_0x4d6ba3[_0x84e3('0x77')]['AudioFromTts']){return base64Decode(_0x4d6ba3[_0x84e3('0x77')][_0x84e3('0x7a')][_0x84e3('0x7b')],path[_0x84e3('0x22')](__dirname,_0x84e3('0x31'),rs['generate'](0x4)+_0x84e3('0x23')))[_0x84e3('0x26')](function(_0x7312f8){_0x44df15[_0x84e3('0x7c')]=_0x7312f8;return _0x44df15;});}return _0x44df15;});};exports[_0x84e3('0x7d')]=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 78c93e6..840bf16 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 _0x3896=['exports','./nda'];(function(_0x48095d,_0x54d773){var _0x3bdd13=function(_0x2ba6c0){while(--_0x2ba6c0){_0x48095d['push'](_0x48095d['shift']());}};_0x3bdd13(++_0x54d773);}(_0x3896,0x19d));var _0x6389=function(_0x23fc11,_0x45cc62){_0x23fc11=_0x23fc11-0x0;var _0x37adff=_0x3896[_0x23fc11];return _0x37adff;};var nda=require(_0x6389('0x0'));module[_0x6389('0x1')]={'nda':nda}; \ No newline at end of file +var _0x7a57=['./nda'];(function(_0x1c7932,_0x5446d1){var _0x37ecec=function(_0x504c5b){while(--_0x504c5b){_0x1c7932['push'](_0x1c7932['shift']());}};_0x37ecec(++_0x5446d1);}(_0x7a57,0x1d6));var _0x77a5=function(_0x49123d,_0x125058){_0x49123d=_0x49123d-0x0;var _0x1ffa42=_0x7a57[_0x49123d];return _0x1ffa42;};var nda=require(_0x77a5('0x0'));module['exports']={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index e552080..5b72910 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 _0x3df4=['callerid','calleridname','dnid','extension','text','access_token','project','channelData','ndagenerate_audio','custom_action','body','CustomAction','custom_action_data','CustomActionData','info','../../../../../config/logger','agi','exports','POST','/token','password','username','resolve','ndassistant_url','ndaactivity_type','Nda','uniqueid'];(function(_0x56e383,_0x2f844f){var _0x4a2156=function(_0x34f534){while(--_0x34f534){_0x56e383['push'](_0x56e383['shift']());}};_0x4a2156(++_0x2f844f);}(_0x3df4,0x102));var _0x43df=function(_0x5a28ae,_0x31bcf3){_0x5a28ae=_0x5a28ae-0x0;var _0x2f5156=_0x3df4[_0x5a28ae];return _0x2f5156;};'use strict';var rp=require('request-promise');var url=require('url');var logger=require(_0x43df('0x0'))(_0x43df('0x1'));module[_0x43df('0x2')]=function(_0x206707,_0x38a050){var _0x2985bf={'method':_0x43df('0x3'),'uri':url['resolve'](_0x38a050['ndauth_url'],_0x43df('0x4')),'form':{'grant_type':_0x43df('0x5'),'username':_0x38a050[_0x43df('0x6')],'password':_0x38a050[_0x43df('0x5')]},'json':!![]};return rp(_0x2985bf)['then'](function(_0x5863be){var _0x2492a9={'method':_0x43df('0x3'),'uri':url[_0x43df('0x7')](_0x38a050[_0x43df('0x8')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x38a050[_0x43df('0x9')]||'message','channelId':_0x43df('0xa'),'conversation':{'id':_0x206707[_0x43df('0xb')]},'from':{'id':_0x206707[_0x43df('0xc')],'name':_0x206707[_0x43df('0xd')]},'recipient':{'id':_0x206707[_0x43df('0xe')],'name':_0x206707[_0x43df('0xf')]},'text':_0x38a050[_0x43df('0x10')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x5863be[_0x43df('0x11')]},'json':!![]};if(_0x38a050[_0x43df('0x12')]){_0x2492a9['body'][_0x43df('0x13')]['ProjectName']=_0x38a050[_0x43df('0x12')];}if(_0x38a050[_0x43df('0x14')]=='1'){_0x2492a9['body'][_0x43df('0x13')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x38a050[_0x43df('0x15')]){_0x2492a9[_0x43df('0x16')]['channelData'][_0x43df('0x17')]=_0x38a050['custom_action'];if(_0x38a050[_0x43df('0x18')]){_0x2492a9[_0x43df('0x16')][_0x43df('0x13')][_0x43df('0x19')]=_0x38a050[_0x43df('0x18')];}}logger[_0x43df('0x1a')](JSON['stringify'](_0x2492a9));return rp(_0x2492a9);});}; \ No newline at end of file +var _0x7d98=['ndagenerate_audio','AudioOutputSettings','CustomAction','CustomActionData','custom_action_data','info','stringify','request-promise','../../../../../config/logger','agi','exports','POST','ndauth_url','password','then','resolve','ndassistant_url','ndaactivity_type','message','Nda','uniqueid','callerid','calleridname','dnid','extension','text','Bearer\x20','access_token','project','body','channelData','ProjectName'];(function(_0x161bd5,_0x3bbc97){var _0x560baf=function(_0x34ad65){while(--_0x34ad65){_0x161bd5['push'](_0x161bd5['shift']());}};_0x560baf(++_0x3bbc97);}(_0x7d98,0xe7));var _0x87d9=function(_0x15fc7a,_0xd21741){_0x15fc7a=_0x15fc7a-0x0;var _0x3aa9f4=_0x7d98[_0x15fc7a];return _0x3aa9f4;};'use strict';var rp=require(_0x87d9('0x0'));var url=require('url');var logger=require(_0x87d9('0x1'))(_0x87d9('0x2'));module[_0x87d9('0x3')]=function(_0xbee750,_0x47cceb){var _0x417ed2={'method':_0x87d9('0x4'),'uri':url['resolve'](_0x47cceb[_0x87d9('0x5')],'/token'),'form':{'grant_type':'password','username':_0x47cceb['username'],'password':_0x47cceb[_0x87d9('0x6')]},'json':!![]};return rp(_0x417ed2)[_0x87d9('0x7')](function(_0x2dc542){var _0x5f2693={'method':_0x87d9('0x4'),'uri':url[_0x87d9('0x8')](_0x47cceb[_0x87d9('0x9')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x47cceb[_0x87d9('0xa')]||_0x87d9('0xb'),'channelId':_0x87d9('0xc'),'conversation':{'id':_0xbee750[_0x87d9('0xd')]},'from':{'id':_0xbee750[_0x87d9('0xe')],'name':_0xbee750[_0x87d9('0xf')]},'recipient':{'id':_0xbee750[_0x87d9('0x10')],'name':_0xbee750[_0x87d9('0x11')]},'text':_0x47cceb[_0x87d9('0x12')],'channelData':{}},'headers':{'Authorization':_0x87d9('0x13')+_0x2dc542[_0x87d9('0x14')]},'json':!![]};if(_0x47cceb[_0x87d9('0x15')]){_0x5f2693[_0x87d9('0x16')][_0x87d9('0x17')][_0x87d9('0x18')]=_0x47cceb[_0x87d9('0x15')];}if(_0x47cceb[_0x87d9('0x19')]=='1'){_0x5f2693[_0x87d9('0x16')][_0x87d9('0x17')][_0x87d9('0x1a')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x47cceb['custom_action']){_0x5f2693[_0x87d9('0x16')][_0x87d9('0x17')][_0x87d9('0x1b')]=_0x47cceb['custom_action'];if(_0x47cceb['custom_action_data']){_0x5f2693[_0x87d9('0x16')][_0x87d9('0x17')][_0x87d9('0x1c')]=_0x47cceb[_0x87d9('0x1d')];}}logger[_0x87d9('0x1e')](JSON[_0x87d9('0x1f')](_0x5f2693));return rp(_0x5f2693);});}; \ 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 29fd6ed..f2e4d9b 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 _0x4953=['./lib/api'];(function(_0x4cb0e0,_0x3352bc){var _0xb2d738=function(_0x4ec722){while(--_0x4ec722){_0x4cb0e0['push'](_0x4cb0e0['shift']());}};_0xb2d738(++_0x3352bc);}(_0x4953,0x115));var _0x3495=function(_0xba0a86,_0x210dff){_0xba0a86=_0xba0a86-0x0;var _0x37bdf9=_0x4953[_0xba0a86];return _0x37bdf9;};'use strict';var asr=require(_0x3495('0x0'));module['exports']=function(_0x3be05a,_0x386988,_0x275160,_0x2c724c){return asr(_0x3be05a,_0x386988,_0x275160,_0x2c724c);}; \ No newline at end of file +var _0x5e6b=['./lib/api'];(function(_0x16b962,_0x1e8b75){var _0x5b8877=function(_0x451ea6){while(--_0x451ea6){_0x16b962['push'](_0x16b962['shift']());}};_0x5b8877(++_0x1e8b75);}(_0x5e6b,0x16c));var _0xb5e6=function(_0x19b3f9,_0xade753){_0x19b3f9=_0x19b3f9-0x0;var _0x18c3f6=_0x5e6b[_0x19b3f9];return _0x18c3f6;};'use strict';var asr=require(_0xb5e6('0x0'));module['exports']=function(_0x563d45,_0x59dafc,_0x2dfa39,_0x196121){return asr(_0x563d45,_0x59dafc,_0x2dfa39,_0x196121);}; \ 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 269a2b1..7c5295e 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 _0xf2b1=['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','unix','send','stringify','createReadStream','data','close','EOS','error','terminate','parse','result','final','hypotheses','transcript','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','bluebird','moment','crypto','../../../../../../config/logger','exports','info','Tilde\x20URI'];(function(_0x9c86d6,_0x1eb9d0){var _0x40e800=function(_0x422a0b){while(--_0x422a0b){_0x9c86d6['push'](_0x9c86d6['shift']());}};_0x40e800(++_0x1eb9d0);}(_0xf2b1,0x121));var _0x1f2b=function(_0x3d5db9,_0x2dbe0a){_0x3d5db9=_0x3d5db9-0x0;var _0x3c114c=_0xf2b1[_0x3d5db9];return _0x3c114c;};'use strict';var BPromise=require(_0x1f2b('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x1f2b('0x1'));var crypto=require(_0x1f2b('0x2'));var logger=require(_0x1f2b('0x3'))('agi');module[_0x1f2b('0x4')]=function(_0x1adf3d,_0x36ab96,_0x334075,_0x1edec2){return new BPromise(function(_0x547f22,_0x4eef98){logger[_0x1f2b('0x5')](_0x1f2b('0x6'),_0x1edec2||_0x1f2b('0x7'));var _0x48068a=new WebSocket(_0x1edec2||_0x1f2b('0x7'),{'perMessageDeflate':![]});var _0x23aef7='';var _0x504433='0';var _0x29200a='1';var _0x5e6a4c=_0x1f2b('0x8');function _0x592a8c(_0x5d04f3){var _0x45cc3e=crypto[_0x1f2b('0x9')](_0x1f2b('0xa'));_0x45cc3e['update'](_0x5d04f3);return _0x45cc3e[_0x1f2b('0xb')]('hex');}function _0x14f8fd(){try{logger[_0x1f2b('0x5')]('Open\x20Tilde\x20ASR\x20socket');var _0x3bdd80=moment()[_0x1f2b('0xc')]();var _0x2a380f=_0x592a8c(_0x3bdd80+_0x36ab96+_0x334075);_0x48068a[_0x1f2b('0xd')](JSON[_0x1f2b('0xe')]({'appID':_0x36ab96,'timestamp':_0x3bdd80,'appKey':_0x2a380f}));var _0x48e41e=fs[_0x1f2b('0xf')](_0x1adf3d);_0x48e41e['on'](_0x1f2b('0x10'),function(_0x6d18df){_0x48068a[_0x1f2b('0xd')](_0x6d18df);});_0x48e41e['on'](_0x1f2b('0x11'),function(){_0x48068a[_0x1f2b('0xd')](_0x1f2b('0x12'));});}catch(_0x36c990){logger[_0x1f2b('0x13')]('Tilde\x20ASR\x20send\x20error',JSON[_0x1f2b('0xe')](_0x36c990));_0x48068a[_0x1f2b('0x14')]();}}function _0x202858(_0x2c01b5){try{if(_0x2c01b5){var _0x4ca780=JSON[_0x1f2b('0x15')](_0x2c01b5);switch(_0x4ca780['status']){case 0x0:if(_0x4ca780[_0x1f2b('0x16')]){if(_0x4ca780['result'][_0x1f2b('0x17')]){logger['info']('Tilde\x20ASR\x20hypoteses',JSON[_0x1f2b('0xe')](_0x4ca780[_0x1f2b('0x16')]['hypotheses']));_0x23aef7=_0x4ca780[_0x1f2b('0x16')][_0x1f2b('0x18')][0x0][_0x1f2b('0x19')];_0x504433=_0x4ca780[_0x1f2b('0x16')][_0x1f2b('0x18')][0x0]['likelihood'];_0x29200a='0';_0x5e6a4c=_0x1f2b('0x1a');_0x48068a['terminate']();}}break;case 0x1:logger[_0x1f2b('0x5')](_0x1f2b('0x8'));_0x29200a='1';_0x5e6a4c=_0x1f2b('0x8');break;case 0x2:logger[_0x1f2b('0x5')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x29200a='2';_0x5e6a4c=_0x1f2b('0x1b');break;case 0x9:logger[_0x1f2b('0x5')](_0x1f2b('0x1c'));_0x29200a='9';_0x5e6a4c=_0x1f2b('0x1c');break;case 0xa:logger[_0x1f2b('0x5')](_0x1f2b('0x1d'));_0x29200a='10';_0x5e6a4c=_0x1f2b('0x1d');break;case 0xb:logger[_0x1f2b('0x5')](_0x1f2b('0x1e'));_0x29200a='11';_0x5e6a4c=_0x1f2b('0x1e');}}}catch(_0x53807f){logger[_0x1f2b('0x13')](_0x1f2b('0x1f'),JSON['stringify'](_0x53807f));_0x48068a[_0x1f2b('0x14')]();}}function _0x5f3150(){logger['info'](_0x1f2b('0x20'));_0x547f22({'transcript':_0x23aef7,'confidence':_0x504433,'status':_0x29200a,'status_message':_0x5e6a4c});}function _0x2c70ba(_0x58101e){logger[_0x1f2b('0x13')](_0x1f2b('0x21'));if(!_[_0x1f2b('0x22')](_0x58101e)){logger['error'](_[_0x1f2b('0x23')](_0x58101e)?JSON[_0x1f2b('0xe')](_0x58101e):_0x58101e);}}_0x48068a['on'](_0x1f2b('0x24'),_0x14f8fd);_0x48068a['on']('message',_0x202858);_0x48068a['on'](_0x1f2b('0x11'),_0x5f3150);_0x48068a['on'](_0x1f2b('0x13'),_0x2c70ba);});}; \ No newline at end of file +var _0x08ab=['createHash','update','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','close','EOS','error','terminate','parse','status','result','final','hypotheses','transcript','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','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','moment','crypto','../../../../../../config/logger','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'];(function(_0x511f13,_0x2b3950){var _0x13393c=function(_0x61ef7b){while(--_0x61ef7b){_0x511f13['push'](_0x511f13['shift']());}};_0x13393c(++_0x2b3950);}(_0x08ab,0xa1));var _0xb08a=function(_0x54697e,_0x98860f){_0x54697e=_0x54697e-0x0;var _0x23a41d=_0x08ab[_0x54697e];return _0x23a41d;};'use strict';var BPromise=require(_0xb08a('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xb08a('0x1'));var crypto=require(_0xb08a('0x2'));var logger=require(_0xb08a('0x3'))('agi');module[_0xb08a('0x4')]=function(_0x199ecc,_0x3e6fdf,_0x2c2899,_0x3c219e){return new BPromise(function(_0x1a3199,_0x2c05fc){logger[_0xb08a('0x5')](_0xb08a('0x6'),_0x3c219e||_0xb08a('0x7'));var _0x4c6807=new WebSocket(_0x3c219e||_0xb08a('0x7'),{'perMessageDeflate':![]});var _0x39663e='';var _0x2b549d='0';var _0x336e6c='1';var _0x48c0ce=_0xb08a('0x8');function _0x35ae4c(_0x350533){var _0x53ab44=crypto[_0xb08a('0x9')]('sha1');_0x53ab44[_0xb08a('0xa')](_0x350533);return _0x53ab44['digest']('hex');}function _0x4fb024(){try{logger[_0xb08a('0x5')](_0xb08a('0xb'));var _0x1c1ca1=moment()[_0xb08a('0xc')]();var _0x37da31=_0x35ae4c(_0x1c1ca1+_0x3e6fdf+_0x2c2899);_0x4c6807[_0xb08a('0xd')](JSON[_0xb08a('0xe')]({'appID':_0x3e6fdf,'timestamp':_0x1c1ca1,'appKey':_0x37da31}));var _0x325f99=fs['createReadStream'](_0x199ecc);_0x325f99['on']('data',function(_0x26be55){_0x4c6807[_0xb08a('0xd')](_0x26be55);});_0x325f99['on'](_0xb08a('0xf'),function(){_0x4c6807['send'](_0xb08a('0x10'));});}catch(_0x471764){logger[_0xb08a('0x11')]('Tilde\x20ASR\x20send\x20error',JSON[_0xb08a('0xe')](_0x471764));_0x4c6807[_0xb08a('0x12')]();}}function _0x36ff4e(_0x39677c){try{if(_0x39677c){var _0x50e427=JSON[_0xb08a('0x13')](_0x39677c);switch(_0x50e427[_0xb08a('0x14')]){case 0x0:if(_0x50e427[_0xb08a('0x15')]){if(_0x50e427[_0xb08a('0x15')][_0xb08a('0x16')]){logger[_0xb08a('0x5')]('Tilde\x20ASR\x20hypoteses',JSON[_0xb08a('0xe')](_0x50e427[_0xb08a('0x15')][_0xb08a('0x17')]));_0x39663e=_0x50e427['result'][_0xb08a('0x17')][0x0][_0xb08a('0x18')];_0x2b549d=_0x50e427['result']['hypotheses'][0x0]['likelihood'];_0x336e6c='0';_0x48c0ce='Success.';_0x4c6807[_0xb08a('0x12')]();}}break;case 0x1:logger[_0xb08a('0x5')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x336e6c='1';_0x48c0ce=_0xb08a('0x8');break;case 0x2:logger[_0xb08a('0x5')](_0xb08a('0x19'));_0x336e6c='2';_0x48c0ce=_0xb08a('0x19');break;case 0x9:logger['info']('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x336e6c='9';_0x48c0ce='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger[_0xb08a('0x5')]('Authentication\x20failed.');_0x336e6c='10';_0x48c0ce=_0xb08a('0x1a');break;case 0xb:logger[_0xb08a('0x5')](_0xb08a('0x1b'));_0x336e6c='11';_0x48c0ce='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x77435a){logger[_0xb08a('0x11')](_0xb08a('0x1c'),JSON[_0xb08a('0xe')](_0x77435a));_0x4c6807['terminate']();}}function _0x343f6f(){logger[_0xb08a('0x5')](_0xb08a('0x1d'));_0x1a3199({'transcript':_0x39663e,'confidence':_0x2b549d,'status':_0x336e6c,'status_message':_0x48c0ce});}function _0x184fda(_0x3405a0){logger[_0xb08a('0x11')](_0xb08a('0x1e'));if(!_[_0xb08a('0x1f')](_0x3405a0)){logger[_0xb08a('0x11')](_[_0xb08a('0x20')](_0x3405a0)?JSON[_0xb08a('0xe')](_0x3405a0):_0x3405a0);}}_0x4c6807['on']('open',_0x4fb024);_0x4c6807['on'](_0xb08a('0x21'),_0x36ff4e);_0x4c6807['on'](_0xb08a('0xf'),_0x343f6f);_0x4c6807['on'](_0xb08a('0x11'),_0x184fda);});}; \ 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 c2c6319..10cb4be 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 _0xc951=['./asr','exports'];(function(_0x2ddd13,_0x4dd0bd){var _0x8b928b=function(_0x129516){while(--_0x129516){_0x2ddd13['push'](_0x2ddd13['shift']());}};_0x8b928b(++_0x4dd0bd);}(_0xc951,0x116));var _0x1c95=function(_0x2d3c67,_0x5b7aa9){_0x2d3c67=_0x2d3c67-0x0;var _0x572371=_0xc951[_0x2d3c67];return _0x572371;};var asr=require(_0x1c95('0x0'));module[_0x1c95('0x1')]={'asr':asr}; \ No newline at end of file +var asr=require('./asr');module['exports']={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 893bd98..8bd2229 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(_0x1de641,_0x44d464){var _0xccacbc=function(_0x1ed9fb){while(--_0x1ed9fb){_0x1de641['push'](_0x1de641['shift']());}};_0xccacbc(++_0x44d464);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'use strict';var util=require(_0x0a9e('0x0'));var net=require(_0x0a9e('0x1'));var EventEmitter=require(_0x0a9e('0x2'))['EventEmitter'];var AGIError=require('./error');var AGIChannel=require(_0x0a9e('0x3'));var AGIServer=function(_0x4ce2f1,_0x333808,_0x432180){var _0x2ab90b=this;var _0x991246=null;var _0x981158=0x0;if(!_0x4ce2f1)_0x4ce2f1=0x11dd;if(!_0x333808)_0x333808='127.0.0.1';EventEmitter[_0x0a9e('0x4')](_0x2ab90b);function _0x441e3a(){if(!_0x4ce2f1){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x991246=net[_0x0a9e('0x6')]();_0x991246['listen'](_0x4ce2f1,_0x333808);_0x991246['on']('listening',function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x7'));});_0x991246['on'](_0x0a9e('0x8'),function(_0x3ab53f){_0x991246[_0x0a9e('0x9')](function(_0xbd1168,_0x4a4c56){if(_0xbd1168){_0x2ab90b['emit']('error',new AGIError('E_AGI_SERVER_ERROR',_0xbd1168));}else if(_0x432180&&_0x432180<0x0){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError(_0x0a9e('0xb')));_0x3ab53f[_0x0a9e('0xc')]();}else if(_0x432180&&_0x432180>0x0&&_0x432180<_0x4a4c56){_0x981158+=0x1;_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x981158));_0x3ab53f[_0x0a9e('0xc')]();}else{var _0x239b12=new AGIChannel(_0x3ab53f);_0x239b12['on'](_0x0a9e('0xd'),function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x8'),_0x239b12);});}});});_0x991246['on'](_0x0a9e('0xa'),function(_0x52a03d){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError(_0x0a9e('0xe'),_0x52a03d['code']));});_0x991246['on'](_0x0a9e('0xf'),function(){_0x2ab90b[_0x0a9e('0x5')]('close',new AGIError(_0x0a9e('0x10')));});}process['nextTick'](function(){_0x441e3a();});};util[_0x0a9e('0x11')](AGIServer,EventEmitter);module[_0x0a9e('0x12')]=function(_0x106033,_0x205fd6,_0x31b1ca){return new AGIServer(_0x106033,_0x205fd6,_0x31b1ca);}; \ No newline at end of file +var _0xe706=['connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','close','nextTick','exports','util','net','events','./error','./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening'];(function(_0x1559a5,_0x41924e){var _0x17a783=function(_0x152c63){while(--_0x152c63){_0x1559a5['push'](_0x1559a5['shift']());}};_0x17a783(++_0x41924e);}(_0xe706,0xa3));var _0x6e70=function(_0x5abb00,_0x342d70){_0x5abb00=_0x5abb00-0x0;var _0xf9b854=_0xe706[_0x5abb00];return _0xf9b854;};'use strict';var util=require(_0x6e70('0x0'));var net=require(_0x6e70('0x1'));var EventEmitter=require(_0x6e70('0x2'))['EventEmitter'];var AGIError=require(_0x6e70('0x3'));var AGIChannel=require(_0x6e70('0x4'));var AGIServer=function(_0x2ca810,_0x7dfbc3,_0x142c27){var _0x2164a4=this;var _0x376a8d=null;var _0x506db9=0x0;if(!_0x2ca810)_0x2ca810=0x11dd;if(!_0x7dfbc3)_0x7dfbc3=_0x6e70('0x5');EventEmitter[_0x6e70('0x6')](_0x2164a4);function _0x36357b(){if(!_0x2ca810){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x9')));return![];}_0x376a8d=net[_0x6e70('0xa')]();_0x376a8d[_0x6e70('0xb')](_0x2ca810,_0x7dfbc3);_0x376a8d['on'](_0x6e70('0xc'),function(){_0x2164a4[_0x6e70('0x7')](_0x6e70('0xc'));});_0x376a8d['on'](_0x6e70('0xd'),function(_0x743eb5){_0x376a8d[_0x6e70('0xe')](function(_0x37b3e0,_0x4600f9){if(_0x37b3e0){_0x2164a4['emit']('error',new AGIError(_0x6e70('0xf'),_0x37b3e0));}else if(_0x142c27&&_0x142c27<0x0){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x10')));_0x743eb5[_0x6e70('0x11')]();}else if(_0x142c27&&_0x142c27>0x0&&_0x142c27<_0x4600f9){_0x506db9+=0x1;_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x12'),_0x506db9));_0x743eb5['destroy']();}else{var _0x52737e=new AGIChannel(_0x743eb5);_0x52737e['on']('ready',function(){_0x2164a4[_0x6e70('0x7')]('connection',_0x52737e);});}});});_0x376a8d['on']('error',function(_0x304716){_0x2164a4[_0x6e70('0x7')]('error',new AGIError(_0x6e70('0xf'),_0x304716['code']));});_0x376a8d['on'](_0x6e70('0x13'),function(){_0x2164a4[_0x6e70('0x7')]('close',new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x6e70('0x14')](function(){_0x36357b();});};util['inherits'](AGIServer,EventEmitter);module[_0x6e70('0x15')]=function(_0x173afe,_0x53acdc,_0x497d61){return new AGIServer(_0x173afe,_0x53acdc,_0x497d61);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index c201e1e..2620b55 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 _0x6a00=['dialogflowV2','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','sesteknda','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','audiofile','unlink','.wav','Enter\x20in\x20END\x20(%s)\x20block','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','getTrunk','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','file_id','getData','response','maxdigit','test','hiddendigitsnum','substr','generate','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','aws_access_key_id','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20Result\x20%s','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','NOBEEP','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','recordFile','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','Enter\x20in\x20GOTOIF\x20(%s)\x20block','no\x20condition\x20configured','condition','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','no\x20interval\x20configured','interval_id','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','math','Enter\x20in\x20MATH\x20(%s)\x20block','variable\x20%s[key]\x20set','menu','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','digit','output','pause','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','toLowerCase','QUEUE','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayPhonetic','sendMail','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','subject','template_id','debug','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','no\x20sms\x20account\x20configured','sms_account_id','no\x20sms\x20account\x20found','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','yes','Answer','Skipped\x20Answer','subproject','no\x20subproject\x20selected','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','agi://%s/square,\x22%s\x22,\x22%s\x22','host','AGI','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','google_cloud_tts','no\x20apiKey\x20configured','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','util','lodash','odbc','randomstring','moment','mustache','request-promise','../../config/environment','../../config/environment/shared','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','getdigits','getsecretdigits','channel','rpc','mailRpc','prototype','getVariable','getVariableById','then','name','catch','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','getUser','getSound','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervalById','IntervalId','map','Intervals','format','getQueryOdbc','error','info','query','Error\x20executing\x20query\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','createSquareRecording','uniqueid','callerid','calleridname','extension','priority','accountcode','dnid','arg_1','file','createCmContact','isNil','callback_','random','lastName','phone','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','internal','%s/%s@from-sip/n','agentLogin','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','ssmlGender','MP3','googleTTS','google_tts_language','restAPI','url','method','timeout','number','includes','POST','PUT','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','uri','render','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','dialogflowV2_language','sestekNDA','ispeechTTS','en-US','speed','ispeechASR','ispeech_asr_language','model','awsPolly','aws_secret_access_key','aws_polly_voice','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','agicommand','hasOwnProperty','isString','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','isEmpty','saveRestApiResult','%s.%s','setVariable','replaceObjectAllVariables','split','replaceAll','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','extra','maxRetry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','label','isConfigured','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','Executed\x20command\x20MRCPRecog\x20%s','agi','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','list_id','no\x20list\x20selected','delay','add','sync','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','application','Executed\x20command\x20%s\x20%s','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','odbc_id','no\x20query\x20configured','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','createSquareMessage','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','client_email','no\x20client_email\x20configured','private_key','providerResponse'];(function(_0xd7a7a6,_0x1b0988){var _0x2460e9=function(_0x5edeb8){while(--_0x5edeb8){_0xd7a7a6['push'](_0xd7a7a6['shift']());}};_0x2460e9(++_0x1b0988);}(_0x6a00,0xc9));var _0x06a0=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0x6a00[_0x43d11d];return _0x38cd08;};'use strict';var fs=require('fs');var util=require(_0x06a0('0x0'));var _=require(_0x06a0('0x1'));var sh=require('shelljs');var odbc=require(_0x06a0('0x2'))();var rs=require(_0x06a0('0x3'));var moment=require(_0x06a0('0x4'));var Mustache=require(_0x06a0('0x5'));var rp=require(_0x06a0('0x6'));var logger=require('../../config/logger')('agi');var config=require(_0x06a0('0x7'));var shared=require(_0x06a0('0x8'));var scripts=require(_0x06a0('0x9'));var FILES_PATH=_0x06a0('0xa');var recursiveMapAttributes=[_0x06a0('0xb'),_0x06a0('0xc')];var verticesWithRetry=['menu',_0x06a0('0xd'),_0x06a0('0xe')];var AGIVertices=function(_0x91eaab,_0x35af04,_0x38a7d3){this[_0x06a0('0xf')]=_0x91eaab;this[_0x06a0('0x10')]=_0x35af04;this[_0x06a0('0x11')]=_0x38a7d3;};AGIVertices[_0x06a0('0x12')][_0x06a0('0x13')]=function(_0x323cf4,_0x519ba3){this['rpc'][_0x06a0('0x14')](_0x323cf4)[_0x06a0('0x15')](function(_0x43279d){_0x519ba3(null,_0x43279d?_0x43279d[_0x06a0('0x16')]:![]);})[_0x06a0('0x17')](function(_0x177234){_0x519ba3(_0x177234);});};AGIVertices[_0x06a0('0x12')][_0x06a0('0x18')]=function(_0x486bfd,_0x44c82a){this[_0x06a0('0x10')][_0x06a0('0x19')](_0x486bfd)['then'](function(_0x9ef686){_0x44c82a(null,_0x9ef686?_0x9ef686[_0x06a0('0x16')]:![]);})[_0x06a0('0x17')](function(_0x5560e3){_0x44c82a(_0x5560e3);});};AGIVertices[_0x06a0('0x12')][_0x06a0('0x1a')]=function(_0x58edad,_0x578f39){this[_0x06a0('0x10')][_0x06a0('0x1b')](_0x58edad)[_0x06a0('0x15')](function(_0x3d8836){_0x578f39(null,_0x3d8836?_0x3d8836['name']:![]);})[_0x06a0('0x17')](function(_0x3f16fa){_0x578f39(_0x3f16fa);});};AGIVertices[_0x06a0('0x12')][_0x06a0('0x1c')]=function(_0x3bce23,_0x22cc77){this[_0x06a0('0x10')][_0x06a0('0x1d')](_0x3bce23)[_0x06a0('0x15')](function(_0x9772f5){_0x22cc77(null,_0x9772f5?_0x9772f5['dsn']:![]);})[_0x06a0('0x17')](function(_0x2b18b3){_0x22cc77(_0x2b18b3);});};AGIVertices[_0x06a0('0x12')][_0x06a0('0x1e')]=function(_0x422603,_0x304f8d){this['rpc']['getUserById'](_0x422603)[_0x06a0('0x15')](function(_0x2ab1a2){_0x304f8d(null,_0x2ab1a2?_0x2ab1a2['name']:![]);})[_0x06a0('0x17')](function(_0x1ae968){_0x304f8d(_0x1ae968);});};AGIVertices[_0x06a0('0x12')]['getTrunk']=function(_0x98ae05,_0x2441f3){this['rpc']['getTrunkById'](_0x98ae05)['then'](function(_0x22798f){_0x2441f3(null,_0x22798f?_0x22798f[_0x06a0('0x16')]:![]);})[_0x06a0('0x17')](function(_0x26f605){_0x2441f3(_0x26f605);});};AGIVertices[_0x06a0('0x12')][_0x06a0('0x1f')]=function(_0xcc78b9,_0x123958){var _0x406173=this;this['rpc'][_0x06a0('0x20')](_0xcc78b9)['then'](function(_0xe26741){_0x123958(null,_0xe26741?_0x406173[_0x06a0('0x21')](_0xe26741[_0x06a0('0x22')]):![]);})[_0x06a0('0x17')](function(_0xc0a5f0){_0x123958(_0xc0a5f0);});};AGIVertices[_0x06a0('0x12')][_0x06a0('0x23')]=function(_0x3984eb,_0x10933e){this['rpc'][_0x06a0('0x24')](_0x3984eb)[_0x06a0('0x15')](function(_0x1a9e50){_0x10933e(null,_0x1a9e50?_0x1a9e50:![]);})[_0x06a0('0x17')](function(_0x19ae90){_0x10933e(_0x19ae90);});};AGIVertices['prototype'][_0x06a0('0x25')]=function(_0x57829d,_0x35d2fc,_0x433335){this['mailRpc']['sendMailMessage'](_0x57829d,_0x35d2fc)[_0x06a0('0x15')](function(){_0x433335(null);})[_0x06a0('0x17')](function(_0x301e02){_0x433335(_0x301e02);});};AGIVertices[_0x06a0('0x12')]['getIntervals']=function(_0x4d273c,_0x53f481){this[_0x06a0('0x10')][_0x06a0('0x26')](_0x4d273c)['then'](function(_0x2e57c9){if(_0x2e57c9){if(_0x2e57c9[_0x06a0('0x27')]){_0x53f481(null,[_0x2e57c9['interval']]);}else{_0x53f481(null,_[_0x06a0('0x28')](_0x2e57c9[_0x06a0('0x29')],'interval'));}}else{_0x53f481(null,![]);}})['catch'](function(_0x985e4e){_0x53f481(_0x985e4e);});};AGIVertices[_0x06a0('0x12')]['getSoundPath']=function(_0x34a8c0){return util[_0x06a0('0x2a')]('%s/sounds/converted/%s',FILES_PATH,_0x34a8c0);};AGIVertices[_0x06a0('0x12')][_0x06a0('0x2b')]=function(_0x35a246,_0x26687c,_0x2fd85b){odbc['open'](_0x35a246,function(_0x10d30a){if(_0x10d30a){logger[_0x06a0('0x2c')]('Error\x20getting\x20ODBC\x20connection\x20%s',_0x10d30a);_0x2fd85b(_0x10d30a);}else{logger[_0x06a0('0x2d')]('ODBC\x20connection\x20successfully');odbc[_0x06a0('0x2e')](_0x26687c,function(_0x30e380,_0xc89e22){if(_0x30e380){logger[_0x06a0('0x2d')](_0x06a0('0x2f'),_0x26687c);_0x2fd85b(_0x30e380);}else{logger['info']('Query\x20executed\x20correctly\x20%s',_0x26687c);odbc[_0x06a0('0x30')](function(_0x6c4220){if(_0x6c4220){logger[_0x06a0('0x2c')](_0x06a0('0x31'),_0x6c4220);}_0x2fd85b(null,_0xc89e22);});}});}});};AGIVertices[_0x06a0('0x12')][_0x06a0('0x32')]=function(_0x948ded,_0x49a6b2){this['rpc'][_0x06a0('0x33')](_0x948ded)['then'](function(_0x51fbaa){_0x49a6b2(null,_0x51fbaa?_0x51fbaa:![]);})['catch'](function(_0x159fc1){_0x49a6b2(_0x159fc1);});};AGIVertices['prototype'][_0x06a0('0x34')]=function(_0x21be0a,_0x39874f){this[_0x06a0('0x10')][_0x06a0('0x34')](_0x21be0a)[_0x06a0('0x15')](function(_0x5ce0dd){_0x39874f(null,_0x5ce0dd);})['catch'](function(_0x1f2beb){_0x39874f(_0x1f2beb);});};AGIVertices[_0x06a0('0x12')][_0x06a0('0x35')]=function(_0x4d0343,_0x52390e,_0x563c93){this['rpc'][_0x06a0('0x35')]({'uniqueid':this[_0x06a0('0xf')]['uniqueid'],'node':_0x4d0343['label'],'application':_0x4d0343['agicommand'],'data':_0x52390e||null,'project_name':this[_0x06a0('0xf')]['arg_1'],'callerid':this[_0x06a0('0xf')]['callerid']})[_0x06a0('0x15')](function(_0x301528){if(_0x563c93){_0x563c93(null,_0x301528);}})['catch'](function(_0x2a99d6){if(_0x563c93){_0x563c93(_0x2a99d6);}});};AGIVertices['prototype'][_0x06a0('0x36')]=function(_0x719018,_0x20da5d,_0x2d47d6,_0x2decbf){this[_0x06a0('0x10')]['createSquareRecording']({'uniqueid':this[_0x06a0('0xf')][_0x06a0('0x37')],'callerid':this['channel'][_0x06a0('0x38')],'calleridname':this[_0x06a0('0xf')][_0x06a0('0x39')],'context':this['channel']['context'],'extension':this[_0x06a0('0xf')][_0x06a0('0x3a')],'priority':this[_0x06a0('0xf')][_0x06a0('0x3b')],'accountcode':this[_0x06a0('0xf')][_0x06a0('0x3c')],'dnid':this['channel'][_0x06a0('0x3d')],'projectName':this[_0x06a0('0xf')][_0x06a0('0x3e')],'saveName':_0x20da5d,'filename':_0x719018[_0x06a0('0x3f')]||_0x20da5d,'savePath':_0x2d47d6})[_0x06a0('0x15')](function(_0x206ce8){_0x2decbf(null,_0x206ce8);})[_0x06a0('0x17')](function(_0x360d94){_0x2decbf(_0x360d94);});};AGIVertices[_0x06a0('0x12')]['createSquareMessage']=function(_0xcce2a6,_0x16fca0,_0x290f80,_0x32a677,_0x30eb32){this[_0x06a0('0x10')]['createSquareMessage']({'uniqueid':this['channel'][_0x06a0('0x37')],'body':_0xcce2a6,'direction':_0x16fca0,'providerName':_0x290f80,'providerResponse':_0x32a677})[_0x06a0('0x15')](function(_0x1c21fe){if(_0x30eb32){_0x30eb32(null,_0x1c21fe);}})[_0x06a0('0x17')](function(_0x15f005){if(_0x30eb32){_0x30eb32(_0x15f005);}});};AGIVertices['prototype'][_0x06a0('0x40')]=function(_0x4e7e91,_0x30f770){this[_0x06a0('0x10')][_0x06a0('0x40')]({'firstName':_['isEmpty'](_0x4e7e91[_0x06a0('0x16')])||_[_0x06a0('0x41')](_0x4e7e91[_0x06a0('0x16')])?_0x06a0('0x42')+Math[_0x06a0('0x43')]():_0x4e7e91[_0x06a0('0x16')],'lastName':_['isEmpty'](_0x4e7e91[_0x06a0('0x44')])||_['isNil'](_0x4e7e91['lastName'])?null:_0x4e7e91[_0x06a0('0x44')],'phone':_0x4e7e91[_0x06a0('0x45')],'ListId':_0x4e7e91['list_id'],'scheduledat':_0x4e7e91[_0x06a0('0x46')],'callbackUniqueid':this['channel'][_0x06a0('0x37')],'tags':_0x06a0('0x47'),'description':_0x06a0('0x48')+_0x4e7e91[_0x06a0('0x46')][_0x06a0('0x49')](),'priority':_0x4e7e91[_0x06a0('0x4a')]})['then'](function(_0x3c138e){_0x30f770(null,_0x3c138e);})['catch'](function(_0x186c07){_0x30f770(_0x186c07);});};AGIVertices['prototype'][_0x06a0('0x4b')]=function(_0x20237e,_0xb668f8){this['rpc'][_0x06a0('0x4c')](_0x20237e)[_0x06a0('0x15')](function(_0x20a378){_0xb668f8(null,_0x20a378?_0x20a378[_0x06a0('0x16')]:![]);})[_0x06a0('0x17')](function(_0x245d21){_0xb668f8(_0x245d21);});};AGIVertices[_0x06a0('0x12')][_0x06a0('0x4d')]=function(_0x23a231,_0x39aeec,_0xfa235){var _0x36b972={'role':_0x06a0('0x4e')};_0x36b972[_0x23a231]=this[_0x06a0('0xf')][_0x06a0('0x38')];this['rpc'][_0x06a0('0x4d')](_0x36b972,_0x39aeec,this[_0x06a0('0xf')][_0x06a0('0x37')])[_0x06a0('0x15')](function(_0x4d18f5){_0xfa235(null,_[_0x06a0('0x41')](_0x4d18f5)?![]:!![]);})[_0x06a0('0x17')](function(_0x1ba5f5){logger['error'](_0x1ba5f5);_0xfa235(null,![]);});};AGIVertices[_0x06a0('0x12')][_0x06a0('0x4f')]=function(_0x4cf4f0,_0x4571a4){var _0x5e16cd={'role':'agent'};_0x5e16cd[_0x4cf4f0]=this['channel']['callerid'];this[_0x06a0('0x10')][_0x06a0('0x4f')](_0x5e16cd)[_0x06a0('0x15')](function(_0x18f8f9){_0x4571a4(null,_['isNil'](_0x18f8f9)?![]:!![]);})['catch'](function(_0x3c20e3){logger[_0x06a0('0x2c')](_0x3c20e3);_0x4571a4(null,![]);});};AGIVertices[_0x06a0('0x12')][_0x06a0('0x50')]=function(_0x10a65a,_0x167df0){var _0x2958d1={'role':_0x06a0('0x4e')};_0x2958d1[_0x10a65a]=this[_0x06a0('0xf')][_0x06a0('0x38')];this['rpc']['agentLogout'](_0x2958d1)['then'](function(_0x5711c3){_0x167df0(null,_[_0x06a0('0x41')](_0x5711c3)?![]:!![]);})[_0x06a0('0x17')](function(_0x7bad01){logger['error'](_0x7bad01);_0x167df0(null,![]);});};AGIVertices['prototype']['agentLogin']=function(_0x143545,_0x1e3b75){var _0x136bf0={'role':'agent'};_0x136bf0[_0x143545]=this['channel'][_0x06a0('0x38')];var _0x500075=_0x143545!=_0x06a0('0x51')?util[_0x06a0('0x2a')](_0x06a0('0x52'),'LOCAL',this[_0x06a0('0xf')][_0x06a0('0x38')]):undefined;this[_0x06a0('0x10')][_0x06a0('0x53')](_0x136bf0,_0x500075)[_0x06a0('0x15')](function(_0xe8b0c7){_0x1e3b75(null,_['isNil'](_0xe8b0c7)?![]:!![]);})[_0x06a0('0x17')](function(_0x4b4679){logger['error'](_0x4b4679);_0x1e3b75(null,![]);});};AGIVertices[_0x06a0('0x12')][_0x06a0('0x54')]=function(_0xac5036,_0x75f287){sh[_0x06a0('0x55')](_[_0x06a0('0x56')](_0xac5036),function(_0x178559,_0x5e6108){var _0x36f271=_0x5e6108[_0x06a0('0x57')](/(\r\n|\n|\r)/gm,'');_0x75f287(null,_0x36f271);});};AGIVertices[_0x06a0('0x12')][_0x06a0('0x58')]=function(_0x22d32d,_0x30c5a0){scripts['googleCloudTTS'](_0x22d32d[_0x06a0('0x59')],_0x22d32d[_0x06a0('0x5a')]||'text',_0x22d32d[_0x06a0('0x5b')],_0x22d32d['languageCode']||'en-US',_0x22d32d[_0x06a0('0x5c')]||'MALE',_0x22d32d['audioEncoding']||_0x06a0('0x5d'))['then'](function(_0x5bd49f){_0x30c5a0(null,_0x5bd49f);})['catch'](function(_0x15f523){_0x30c5a0(_0x15f523);});};AGIVertices[_0x06a0('0x12')][_0x06a0('0x5e')]=function(_0x4fc20d,_0x4b9789){scripts[_0x06a0('0x5e')](_0x4fc20d[_0x06a0('0x5b')],_0x4fc20d[_0x06a0('0x5f')]||'en',0x1)[_0x06a0('0x15')](function(_0x2688ed){_0x4b9789(null,_0x2688ed);})['catch'](function(_0x469198){_0x4b9789(_0x469198);});};AGIVertices['prototype'][_0x06a0('0x60')]=function(_0x4b2c84,_0x948adb){var _0x5bada4={'uri':_0x4b2c84[_0x06a0('0x61')],'method':_0x4b2c84[_0x06a0('0x62')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x4b2c84[_0x06a0('0x63')])===_0x06a0('0x64')&&parseInt(_0x4b2c84['timeout'])>=0x1?parseInt(_0x4b2c84['timeout'])*0x3e8:0x5*0x3e8};if(_[_0x06a0('0x65')]([_0x06a0('0x66'),_0x06a0('0x67')],_0x5bada4['method'][_0x06a0('0x68')]())){try{_0x5bada4[_0x06a0('0x69')]=_0x4b2c84[_0x06a0('0xc')]?JSON[_0x06a0('0x6a')](_0x4b2c84[_0x06a0('0xc')]):{};}catch(_0x530064){logger[_0x06a0('0x2c')](_0x06a0('0x6b'),_0x530064);}}try{_0x5bada4[_0x06a0('0x6c')]=_0x4b2c84[_0x06a0('0xb')]?JSON[_0x06a0('0x6a')](_0x4b2c84[_0x06a0('0xb')]):{};}catch(_0xff63ad){logger['error'](_0x06a0('0x6d'),_0xff63ad);}if(_0x4b2c84[_0x06a0('0x6e')]){try{var _0x20a7c8=require(_0x4b2c84[_0x06a0('0x6e')])['sync'](this,_0x5bada4);_0x5bada4[_0x06a0('0x6f')]=Mustache[_0x06a0('0x70')](_0x4b2c84[_0x06a0('0x61')],_0x20a7c8,{},['$$','$$']);if(_0x5bada4[_0x06a0('0x6c')]){_0x5bada4[_0x06a0('0x6c')]=JSON[_0x06a0('0x6a')](Mustache[_0x06a0('0x70')](JSON[_0x06a0('0x71')](_0x5bada4['headers']),_0x20a7c8,{},['$$','$$']));}if(_0x5bada4[_0x06a0('0x69')]){_0x5bada4[_0x06a0('0x69')]=JSON['parse'](Mustache[_0x06a0('0x70')](JSON[_0x06a0('0x71')](_0x5bada4['body']),_0x20a7c8,{},['$$','$$']));}}catch(_0x5f30bb){logger[_0x06a0('0x2c')](_0x06a0('0x72'),_0x5f30bb);}}rp(_0x5bada4)[_0x06a0('0x15')](function(_0x29a402){var _0x39ba1f={'statusCode':_0x29a402[_0x06a0('0x73')]||0xc8,'statusMessage':_0x29a402[_0x06a0('0x74')]||'OK','headers':_0x29a402['headers']||{},'body':_0x29a402[_0x06a0('0x69')]||{}};_0x948adb(null,_0x39ba1f);})[_0x06a0('0x17')](function(_0x1ec648){var _0x332f1c={'statusCode':_0x1ec648[_0x06a0('0x73')]||0x1f4,'statusMessage':_0x1ec648[_0x06a0('0x75')]||_0x06a0('0x76'),'headers':_0x1ec648['options'][_0x06a0('0x6c')]||{},'body':_0x1ec648[_0x06a0('0x77')][_0x06a0('0x69')]||{}};_0x948adb(null,_0x332f1c);});};AGIVertices[_0x06a0('0x12')][_0x06a0('0x78')]=function(_0x5c24d8,_0x27d681){scripts['googleDialogflow'](this[_0x06a0('0xf')][_0x06a0('0x37')],_0x5c24d8[_0x06a0('0x79')],_0x5c24d8['text'],_0x5c24d8[_0x06a0('0x7a')]||'en')[_0x06a0('0x15')](function(_0x4eb2d8){_0x27d681(null,_0x4eb2d8);})[_0x06a0('0x17')](function(_0x22d141){_0x27d681(_0x22d141);});};AGIVertices[_0x06a0('0x12')][_0x06a0('0x7b')]=function(_0x3272ed,_0x176391){scripts[_0x06a0('0x7b')](this['channel'][_0x06a0('0x37')],_0x3272ed[_0x06a0('0x7c')],_0x3272ed['client_email'],_0x3272ed['private_key'],_0x3272ed[_0x06a0('0x5b')],_0x3272ed[_0x06a0('0x7d')]||'en')[_0x06a0('0x15')](function(_0x1ce317){_0x176391(null,_0x1ce317);})[_0x06a0('0x17')](function(_0x35d621){_0x176391(_0x35d621);});};AGIVertices['prototype'][_0x06a0('0x7e')]=function(_0x3bfcc3,_0x2dca67){scripts[_0x06a0('0x7e')](this[_0x06a0('0xf')],_0x3bfcc3)[_0x06a0('0x15')](function(_0x556f56){_0x2dca67(null,_0x556f56);})[_0x06a0('0x17')](function(_0xcf2a43){_0x2dca67(_0xcf2a43);});};AGIVertices[_0x06a0('0x12')][_0x06a0('0x7f')]=function(_0x93f5ed,_0x411604){scripts[_0x06a0('0x7f')](_0x93f5ed[_0x06a0('0x79')],_0x93f5ed[_0x06a0('0x5b')],_0x93f5ed['ispeech_tts_language']||_0x06a0('0x80'),_0x93f5ed[_0x06a0('0x81')])[_0x06a0('0x15')](function(_0x261784){_0x411604(null,_0x261784);})[_0x06a0('0x17')](function(_0x1eba78){_0x411604(_0x1eba78);});};AGIVertices[_0x06a0('0x12')][_0x06a0('0x82')]=function(_0x3afc79,_0x378906,_0x3a9a2f){scripts[_0x06a0('0x82')](_0x378906,_0x3afc79[_0x06a0('0x79')],_0x3afc79[_0x06a0('0x83')]||_0x06a0('0x80'),this['isConfigured'](_0x3afc79[_0x06a0('0x84')])?_0x3afc79[_0x06a0('0x84')]:undefined)['then'](function(_0x19c445){_0x3a9a2f(null,_0x19c445);})[_0x06a0('0x17')](function(_0x3eccc8){_0x3a9a2f(_0x3eccc8);});};AGIVertices[_0x06a0('0x12')]['awsPolly']=function(_0x1f31be,_0x9776e3){scripts[_0x06a0('0x85')](_0x1f31be['aws_access_key_id'],_0x1f31be[_0x06a0('0x86')],_0x1f31be['aws_polly_region'],_0x1f31be[_0x06a0('0x87')]||'Amy',_0x1f31be['text'],_0x1f31be[_0x06a0('0x88')]||_0x06a0('0x5b'))['then'](function(_0x104745){_0x9776e3(null,_0x104745);})[_0x06a0('0x17')](function(_0x8bc029){_0x9776e3(_0x8bc029);});};AGIVertices[_0x06a0('0x12')][_0x06a0('0x89')]=function(_0x14f01d,_0x23177b){scripts[_0x06a0('0x89')](this[_0x06a0('0xf')][_0x06a0('0x37')],_0x14f01d['aws_access_key_id'],_0x14f01d[_0x06a0('0x86')],_0x14f01d[_0x06a0('0x8a')],_0x14f01d[_0x06a0('0x5b')],_0x14f01d[_0x06a0('0x8b')])[_0x06a0('0x15')](function(_0x15b4eb){_0x23177b(null,_0x15b4eb);})['catch'](function(_0x18b9f2){_0x23177b(_0x18b9f2);});};AGIVertices['prototype'][_0x06a0('0x8c')]=function(_0x5de67f,_0x1041db,_0x2aaadd){scripts[_0x06a0('0x8c')](_0x1041db,_0x5de67f[_0x06a0('0x79')],_0x5de67f[_0x06a0('0x8d')]||_0x06a0('0x80'))['then'](function(_0xd136e6){_0x2aaadd(null,_0xd136e6);})[_0x06a0('0x17')](function(_0x3ee0c2){_0x2aaadd(_0x3ee0c2);});};AGIVertices[_0x06a0('0x12')][_0x06a0('0x8e')]=function(_0x544f9a,_0x4675a4,_0x3785eb){scripts[_0x06a0('0x8e')](_0x4675a4,_0x544f9a[_0x06a0('0x8f')],_0x544f9a[_0x06a0('0x90')],_0x544f9a[_0x06a0('0x6f')])[_0x06a0('0x15')](function(_0x22af79){_0x3785eb(null,_0x22af79);})[_0x06a0('0x17')](function(_0x3b9121){_0x3785eb(_0x3b9121);});};AGIVertices[_0x06a0('0x12')][_0x06a0('0x91')]=function(_0x1e460f){var _0x364f64=_[_0x06a0('0x65')](verticesWithRetry,_0x1e460f[_0x06a0('0x92')])?_0x1e460f:_['clone'](_0x1e460f);for(var _0x1d26e5 in _0x364f64){if(_0x364f64[_0x06a0('0x93')](_0x1d26e5)){if(_0x364f64[_0x1d26e5]&&_[_0x06a0('0x94')](_0x364f64[_0x1d26e5])){if(_['includes'](recursiveMapAttributes,_0x1d26e5)){_0x364f64[_0x1d26e5]=this['replaceObjectAllVariables'](_0x364f64[_0x1d26e5]);}else{_0x364f64[_0x1d26e5]=this[_0x06a0('0x95')](_0x364f64[_0x1d26e5]);}}}}return _0x364f64;};AGIVertices[_0x06a0('0x12')][_0x06a0('0x96')]=function(_0x4bff47){for(var _0xfff03e in _0x4bff47){if(_0x4bff47[_0x06a0('0x93')](_0xfff03e)){if(_[_0x06a0('0x97')](_0x4bff47[_0xfff03e])){this['recursiveNodeIndex'](_0x4bff47[_0xfff03e]);}else if(_[_0x06a0('0x98')](_0x4bff47[_0xfff03e])){for(var _0x397d6e=0x0;_0x397d6e<_0x4bff47[_0xfff03e][_0x06a0('0x99')];_0x397d6e++){this[_0x06a0('0x96')](_0x4bff47[_0xfff03e][_0x397d6e]);}}else if(_[_0x06a0('0x94')](_0x4bff47[_0xfff03e])){_0x4bff47[_0xfff03e]=this[_0x06a0('0x95')](_0x4bff47[_0xfff03e]);}}}};AGIVertices[_0x06a0('0x12')]['saveRestApiResult']=function(_0x3ab38c,_0x39cf8d){for(var _0x191ddb in _0x3ab38c){if(_0x3ab38c[_0x06a0('0x93')](_0x191ddb)){if(_[_0x06a0('0x97')](_0x3ab38c[_0x191ddb])){if(!_[_0x06a0('0x9a')](_0x3ab38c[_0x191ddb])){this[_0x06a0('0x9b')](_0x3ab38c[_0x191ddb],util[_0x06a0('0x2a')]('%s.%s',_0x39cf8d,_0x191ddb));}}else if(_[_0x06a0('0x98')](_0x3ab38c[_0x191ddb])){for(var _0x22ed07=0x0;_0x22ed07<_0x3ab38c[_0x191ddb]['length'];_0x22ed07++){this['saveRestApiResult'](_0x3ab38c[_0x191ddb][_0x22ed07],util['format'](_0x06a0('0x9c'),_0x39cf8d,_0x191ddb+'['+_0x22ed07+']'));}}else{if(!_['isNil'](_0x3ab38c[_0x191ddb])){this[_0x06a0('0xf')][_0x06a0('0x9d')](util[_0x06a0('0x2a')](_0x06a0('0x9c'),_0x39cf8d,_0x191ddb),_0x3ab38c[_0x191ddb]);}}}}};AGIVertices[_0x06a0('0x12')][_0x06a0('0x9e')]=function(_0x289aba){try{var _0x3bbedf=JSON['parse'](_0x289aba);this['recursiveNodeIndex'](_0x3bbedf);return JSON['stringify'](_0x3bbedf);}catch(_0x4211aa){return this[_0x06a0('0x95')](_0x289aba);}};AGIVertices[_0x06a0('0x12')][_0x06a0('0x95')]=function(_0x17cf86){var _0x26415f=_0x17cf86[_0x06a0('0x9f')]('{');for(var _0x313568=0x1;_0x313568<_0x26415f[_0x06a0('0x99')];_0x313568+=0x1){var _0x183946=_0x26415f[_0x313568]['split']('}');if(_0x183946['length']>0x1){_0x17cf86=_0x17cf86[_0x06a0('0xa0')]('{'+_0x183946[0x0]+'}',this[_0x06a0('0xf')]['getVariable'](_0x183946[0x0])['extra']||_0x183946[0x0]);}}if(_0x26415f[_0x06a0('0x99')]===0x1){return _0x17cf86[_0x06a0('0x49')]();}return this[_0x06a0('0x95')](_0x17cf86);};AGIVertices[_0x06a0('0x12')][_0x06a0('0xa1')]=function(_0x1efb27,_0x3fc70d){var _0x2f7ddc=this[_0x06a0('0xf')][_0x06a0('0x13')](_0x1efb27);if(_0x2f7ddc[_0x06a0('0xa2')]===-0x1){return _0x2f7ddc;}logger[_0x06a0('0x2d')](util[_0x06a0('0x2a')](_0x06a0('0xa3'),_0x3fc70d,_0x2f7ddc['extra']));return this['channel'][_0x06a0('0x9d')](_0x3fc70d,_0x2f7ddc[_0x06a0('0xa4')]);};AGIVertices[_0x06a0('0x12')]['isConfigured']=function(_0x553ff8){return _0x553ff8&&_0x553ff8!=='0'&&_0x553ff8!=='-1'&&_0x553ff8!=='';};AGIVertices['prototype'][_0x06a0('0xa5')]=function(_0x33cc66){this[_0x06a0('0x35')]['sync'](this,_0x33cc66,'-');_0x33cc66['retry']=_0x33cc66[_0x06a0('0xa5')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x06a0('0x12')][_0x06a0('0xa6')]=function(_0x16b175){logger[_0x06a0('0x2d')](util[_0x06a0('0x2a')](_0x06a0('0xa7'),_0x16b175[_0x06a0('0xa8')]));if(!this[_0x06a0('0xa9')](_0x16b175[_0x06a0('0x5b')])){return this[_0x06a0('0xf')][_0x06a0('0xaa')](_0x06a0('0xab'));}var _0x15cfa2='\x22'+_0x16b175[_0x06a0('0x5b')]+'\x22';if(this[_0x06a0('0xa9')](_0x16b175[_0x06a0('0x77')])){_0x15cfa2+=','+_0x16b175['options'];}var _0x47f255=this['channel'][_0x06a0('0x55')](_0x06a0('0xac'),_0x15cfa2);if(_0x47f255['result']===-0x1){return _0x47f255;}return this['channel'][_0x06a0('0xaa')](util[_0x06a0('0x2a')](_0x06a0('0xad'),_0x15cfa2));};AGIVertices[_0x06a0('0x12')][_0x06a0('0xae')]=function(_0x26a4bc){logger[_0x06a0('0x2d')](util[_0x06a0('0x2a')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x26a4bc[_0x06a0('0xa8')]));if(!this[_0x06a0('0xa9')](_0x26a4bc[_0x06a0('0xaf')])){return this[_0x06a0('0xf')]['noop'](_0x06a0('0xb0'));}var _0x4da7a0=_0x26a4bc['grammar'];if(this['isConfigured'](_0x26a4bc['options'])){_0x4da7a0+=','+_0x26a4bc[_0x06a0('0x77')];}var _0x5829c9=this[_0x06a0('0xf')][_0x06a0('0x55')](_0x06a0('0xb1'),_0x4da7a0);if(_0x5829c9[_0x06a0('0xa2')]===-0x1){return _0x5829c9;}var _0x5d256b=this['getAndSetVariable'](_0x06a0('0xb2'),_0x06a0('0xb3'));if(_0x5d256b['result']===-0x1){return _0x5d256b;}var _0xc07402=this[_0x06a0('0xa1')](_0x06a0('0xb4'),_0x06a0('0xb5'));if(_0xc07402['result']===-0x1){return _0xc07402;}var _0x346f17=this[_0x06a0('0xa1')](_0x06a0('0xb6'),'MRCP_RECOG_INSTANCE');if(_0x346f17['result']===-0x1){return _0x346f17;}return this[_0x06a0('0xf')]['noop'](util[_0x06a0('0x2a')](_0x06a0('0xb7'),_0x4da7a0));};AGIVertices[_0x06a0('0x12')][_0x06a0('0xb8')]=function(_0x14592f){logger[_0x06a0('0x2d')](util['format'](_0x06a0('0xb9'),_0x14592f[_0x06a0('0xa8')]));return this[_0x06a0('0xf')]['agi']([_0x14592f[_0x06a0('0xba')],_0x14592f[_0x06a0('0xbb')]]);};AGIVertices['prototype'][_0x06a0('0xbc')]=function(_0x5c2262){logger[_0x06a0('0x2d')](util['format']('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x5c2262[_0x06a0('0xa8')]));if(this['isConfigured'](_0x5c2262[_0x06a0('0x63')])){logger['info'](util['format'](_0x06a0('0xbd'),_0x5c2262[_0x06a0('0x63')]));var _0x5cd9d6=this[_0x06a0('0xf')][_0x06a0('0xbe')](_0x5c2262['timeout']);if(_0x5cd9d6[_0x06a0('0xa2')]===-0x1){return _0x5cd9d6;}}return this['channel']['answer']();};AGIVertices['prototype']['callback']=function(_0x4227b8){logger[_0x06a0('0x2d')](util[_0x06a0('0x2a')](_0x06a0('0xbf'),_0x4227b8[_0x06a0('0xa8')]));if(!this['isConfigured'](_0x4227b8[_0x06a0('0xc0')])){return this[_0x06a0('0xf')][_0x06a0('0x2c')](_0x4227b8,_0x06a0('0xc1'));}_0x4227b8[_0x06a0('0x46')]=moment();if(this[_0x06a0('0xa9')](_0x4227b8[_0x06a0('0xc2')])){_0x4227b8[_0x06a0('0x46')]=moment()[_0x06a0('0xc3')](_0x4227b8[_0x06a0('0xc2')],'minutes');}if(!this['isConfigured'](_0x4227b8[_0x06a0('0x4a')])){_0x4227b8[_0x06a0('0x4a')]=0x2;}this[_0x06a0('0x40')][_0x06a0('0xc4')](this,_0x4227b8);return this['channel']['noop'](util[_0x06a0('0x2a')](_0x06a0('0xc5'),_0x4227b8[_0x06a0('0x45')],_0x4227b8[_0x06a0('0xc0')],_0x4227b8['scheduledAt']));};AGIVertices[_0x06a0('0x12')]['custom_app']=function(_0x57bb60){logger[_0x06a0('0x2d')](util[_0x06a0('0x2a')]('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x57bb60['label']));var _0x553441=this[_0x06a0('0xf')][_0x06a0('0x55')](_0x57bb60[_0x06a0('0xc6')],_0x57bb60[_0x06a0('0x77')]);if(_0x553441[_0x06a0('0xa2')]===-0x1){return _0x553441;}return this[_0x06a0('0xf')][_0x06a0('0xaa')](util['format'](_0x06a0('0xc7'),_0x57bb60[_0x06a0('0xc6')],_0x57bb60[_0x06a0('0x77')]));};AGIVertices[_0x06a0('0x12')]['lumenvoxtts']=function(_0x1e20bf){logger[_0x06a0('0x2d')](util[_0x06a0('0x2a')](_0x06a0('0xc8'),_0x1e20bf[_0x06a0('0xa8')]));if(!this['isConfigured'](_0x1e20bf[_0x06a0('0x5b')])){return this[_0x06a0('0xf')]['noop']('no\x20text\x20configured');}var _0x5e3d6b='\x22'+_0x1e20bf['text']+'\x22';if(this[_0x06a0('0xa9')](_0x1e20bf[_0x06a0('0x77')])){_0x5e3d6b+=','+_0x1e20bf[_0x06a0('0x77')];}var _0x3e6ff0=this[_0x06a0('0xf')]['exec']('MRCPSynth',_0x5e3d6b);if(_0x3e6ff0[_0x06a0('0xa2')]===-0x1){return _0x3e6ff0;}return this[_0x06a0('0xf')][_0x06a0('0xaa')](util['format'](_0x06a0('0xad'),_0x5e3d6b));};AGIVertices['prototype']['sestektts']=function(_0x5bbbfd){logger[_0x06a0('0x2d')](util[_0x06a0('0x2a')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x5bbbfd[_0x06a0('0xa8')]));if(!this[_0x06a0('0xa9')](_0x5bbbfd[_0x06a0('0x5b')])){return this[_0x06a0('0xf')][_0x06a0('0xaa')](_0x06a0('0xab'));}var _0x4dbc6b='\x22'+_0x5bbbfd[_0x06a0('0x5b')]+'\x22';if(this[_0x06a0('0xa9')](_0x5bbbfd[_0x06a0('0x77')])){_0x4dbc6b+=','+_0x5bbbfd[_0x06a0('0x77')];}var _0x1c3451=this[_0x06a0('0xf')][_0x06a0('0x55')]('MRCPSynth',_0x4dbc6b);if(_0x1c3451[_0x06a0('0xa2')]===-0x1){return _0x1c3451;}return this['channel'][_0x06a0('0xaa')](util[_0x06a0('0x2a')](_0x06a0('0xad'),_0x4dbc6b));};AGIVertices[_0x06a0('0x12')][_0x06a0('0xc9')]=function(_0x4ad259){logger['info'](util[_0x06a0('0x2a')](_0x06a0('0xca'),_0x4ad259[_0x06a0('0xa8')]));if(!this['isConfigured'](_0x4ad259[_0x06a0('0xaf')])){return this[_0x06a0('0xf')]['noop'](_0x06a0('0xb0'));}var _0x17e4bd=_0x4ad259[_0x06a0('0xaf')];if(this[_0x06a0('0xa9')](_0x4ad259[_0x06a0('0x77')])){_0x17e4bd+=','+_0x4ad259[_0x06a0('0x77')];}var _0x3b48aa=this[_0x06a0('0xf')][_0x06a0('0x55')](_0x06a0('0xb1'),_0x17e4bd);if(_0x3b48aa[_0x06a0('0xa2')]===-0x1){return _0x3b48aa;}var _0x3f191f=this['getAndSetVariable'](_0x06a0('0xb2'),_0x06a0('0xcb'));if(_0x3f191f[_0x06a0('0xa2')]===-0x1){return _0x3f191f;}var _0x33d007=this[_0x06a0('0xa1')](_0x06a0('0xb4'),_0x06a0('0xcc'));if(_0x33d007[_0x06a0('0xa2')]===-0x1){return _0x33d007;}var _0x7b1f78=this['getAndSetVariable'](_0x06a0('0xb6'),'LUMENVOX_ASR_INSTANCE');if(_0x7b1f78[_0x06a0('0xa2')]===-0x1){return _0x7b1f78;}return this['channel'][_0x06a0('0xaa')](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0x17e4bd));};AGIVertices[_0x06a0('0x12')]['sestekasr']=function(_0x546f45){logger[_0x06a0('0x2d')](util[_0x06a0('0x2a')](_0x06a0('0xcd'),_0x546f45['label']));if(!this[_0x06a0('0xa9')](_0x546f45[_0x06a0('0xaf')])){return this[_0x06a0('0xf')][_0x06a0('0xaa')]('no\x20grammar\x20configured');}var _0x578131=_0x546f45[_0x06a0('0xaf')];if(this[_0x06a0('0xa9')](_0x546f45[_0x06a0('0x77')])){_0x578131+=','+_0x546f45[_0x06a0('0x77')];}var _0x483b7e=this[_0x06a0('0xf')]['exec']('MRCPRecog',_0x578131);if(_0x483b7e[_0x06a0('0xa2')]===-0x1){return _0x483b7e;}var _0xdfb8cd=this['getAndSetVariable'](_0x06a0('0xb2'),_0x06a0('0xce'));if(_0xdfb8cd['result']===-0x1){return _0xdfb8cd;}var _0xae9210=this[_0x06a0('0xa1')]('RECOG_INPUT()',_0x06a0('0xcf'));if(_0xae9210['result']===-0x1){return _0xae9210;}var _0x3f5ce8=this[_0x06a0('0xa1')](_0x06a0('0xb6'),_0x06a0('0xd0'));if(_0x3f5ce8[_0x06a0('0xa2')]===-0x1){return _0x3f5ce8;}return this[_0x06a0('0xf')][_0x06a0('0xaa')](util[_0x06a0('0x2a')](_0x06a0('0xb7'),_0x578131));};AGIVertices[_0x06a0('0x12')][_0x06a0('0xd1')]=function(_0x431893){logger[_0x06a0('0x2d')](util['format']('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x431893['label']));if(!this['isConfigured'](_0x431893[_0x06a0('0xd2')])){return this[_0x06a0('0xf')]['error'](_0x431893,'no\x20database\x20selected');}var _0x4e2432=this[_0x06a0('0x1c')][_0x06a0('0xc4')](this,_0x431893['odbc_id']);if(!_0x4e2432){return this['channel'][_0x06a0('0x2c')](_0x431893,'no\x20odbc\x20database\x20found');}if(!this[_0x06a0('0xa9')](_0x431893[_0x06a0('0x2e')])){return this[_0x06a0('0xf')][_0x06a0('0x2c')](_0x431893,_0x06a0('0xd3'));}var _0x37a08d=_0x431893[_0x06a0('0x2e')][_0x06a0('0x57')](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0x06a0('0xaa')](util[_0x06a0('0x2a')]('query:\x20%s',_0x37a08d));var _0x38e2d9=this[_0x06a0('0x2b')][_0x06a0('0xc4')](this,_0x4e2432,_0x37a08d);this[_0x06a0('0x35')][_0x06a0('0xc4')](this,_0x431893,_0x37a08d);if(!this[_0x06a0('0xa9')](_0x431893[_0x06a0('0xd4')])){return this[_0x06a0('0xf')][_0x06a0('0xaa')](_0x06a0('0xd5'));}var _0x1e392c=this[_0x06a0('0x13')][_0x06a0('0xc4')](this,_0x431893[_0x06a0('0xd4')]);if(!_0x1e392c){return this[_0x06a0('0xf')][_0x06a0('0x2c')](_0x431893,_0x06a0('0xd6'));}var _0x4e3049=this;_0x38e2d9[_0x06a0('0xd7')](function(_0x5c7017,_0x4c76bb){Object['keys'](_0x5c7017)[_0x06a0('0xd7')](function(_0x291949){_0x4e3049['channel'][_0x06a0('0x9d')](util[_0x06a0('0x2a')](_0x06a0('0xd8'),_0x1e392c,_0x4c76bb,_0x291949),_0x5c7017[_0x291949]);});});this[_0x06a0('0xf')][_0x06a0('0x9d')](util[_0x06a0('0x2a')](_0x06a0('0xd9'),_0x1e392c),_0x38e2d9[_0x06a0('0x99')]);return this[_0x06a0('0xf')][_0x06a0('0xaa')](util[_0x06a0('0x2a')](_0x06a0('0xda'),_0x1e392c));};AGIVertices[_0x06a0('0x12')][_0x06a0('0xdb')]=function(_0x332558){logger['debug'](util[_0x06a0('0x2a')](_0x06a0('0xdc'),_0x332558['label']));if(!this['isConfigured'](_0x332558[_0x06a0('0xdd')])){return this[_0x06a0('0xf')][_0x06a0('0x2c')](_0x332558,_0x06a0('0xde'));}var _0x5d1225=this[_0x06a0('0x1e')][_0x06a0('0xc4')](this,_0x332558[_0x06a0('0xdd')]);if(!_0x5d1225){return this[_0x06a0('0xf')]['error'](_0x332558,_0x06a0('0xdf'));}var _0x2e6b93=this[_0x06a0('0xf')][_0x06a0('0x55')](_0x06a0('0xe0'),[util[_0x06a0('0x2a')](_0x06a0('0xe1'),_0x5d1225),_0x332558['timeout'],_0x332558[_0x06a0('0xe2')],_0x332558[_0x06a0('0x61')]]);if(_0x2e6b93[_0x06a0('0xa2')]===-0x1){return _0x2e6b93;}return this['channel']['noop'](util['format'](_0x06a0('0xe3'),_0x06a0('0xe0')));};AGIVertices['prototype'][_0x06a0('0xe4')]=function(_0x352f10){logger['info'](util['format'](_0x06a0('0xe5'),_0x352f10['label']));if(!this[_0x06a0('0xa9')](_0x352f10[_0x06a0('0x79')])){return this['channel']['noop'](_0x06a0('0xe6'));}if(!this[_0x06a0('0xa9')](_0x352f10[_0x06a0('0x5b')])){return this[_0x06a0('0xf')][_0x06a0('0xaa')]('no\x20text\x20configured');}this[_0x06a0('0xf')][_0x06a0('0xe7')]=!![];this[_0x06a0('0x35')](_0x352f10);this[_0x06a0('0xe8')](_0x352f10[_0x06a0('0x5b')],'in','','');this['channel']['noop'](util['format'](_0x06a0('0xe9'),_0x352f10[_0x06a0('0x5b')]));var _0xbea4dd=this[_0x06a0('0x78')][_0x06a0('0xc4')](this,_0x352f10);if(_0xbea4dd){for(var _0x3f86a6 in _0xbea4dd){if(_0xbea4dd[_0x06a0('0x93')](_0x3f86a6)){this[_0x06a0('0xf')][_0x06a0('0x9d')](util[_0x06a0('0x2a')](_0x06a0('0xea'),_0x3f86a6['toUpperCase']()),_0xbea4dd[_0x3f86a6]);}}this[_0x06a0('0xe8')](_0xbea4dd[_0x06a0('0xeb')],_0x06a0('0xec'),'dialogflow','');return this[_0x06a0('0xf')][_0x06a0('0xaa')](util['format'](_0x06a0('0xed'),_0xbea4dd[_0x06a0('0xeb')]));}return this[_0x06a0('0xf')][_0x06a0('0x2c')](_0x352f10,_0x06a0('0xee'));};AGIVertices['prototype']['dialogflowV2']=function(_0xe016db){logger['info'](util[_0x06a0('0x2a')](_0x06a0('0xef'),_0xe016db[_0x06a0('0xa8')]));if(!this[_0x06a0('0xa9')](_0xe016db['dialogflowV2_project_id'])){return this['channel'][_0x06a0('0xaa')](_0x06a0('0xf0'));}if(!this[_0x06a0('0xa9')](_0xe016db[_0x06a0('0xf1')])){return this['channel'][_0x06a0('0xaa')](_0x06a0('0xf2'));}if(!this[_0x06a0('0xa9')](_0xe016db[_0x06a0('0xf3')])){return this['channel'][_0x06a0('0xaa')]('no\x20private_key\x20configured');}if(!this['isConfigured'](_0xe016db['dialogflowV2_language'])){return this['channel'][_0x06a0('0xaa')]('no\x20anguage\x20configured');}if(!this[_0x06a0('0xa9')](_0xe016db[_0x06a0('0x5b')])){return this[_0x06a0('0xf')][_0x06a0('0xaa')](_0x06a0('0xab'));}this[_0x06a0('0xf')][_0x06a0('0xe7')]=!![];this[_0x06a0('0x35')](_0xe016db);this[_0x06a0('0xe8')](_0xe016db[_0x06a0('0x5b')],'in','','');this[_0x06a0('0xf')][_0x06a0('0xaa')](util[_0x06a0('0x2a')]('Trying\x20DialogflowV2:\x20%s',_0xe016db[_0x06a0('0x5b')]));var _0x2a25f7=this['googleDialogflowV2'][_0x06a0('0xc4')](this,_0xe016db);if(_0x2a25f7){for(var _0x569f43 in _0x2a25f7){if(_0x2a25f7[_0x06a0('0x93')](_0x569f43)){if(_0x569f43!==_0x06a0('0xf4')){this[_0x06a0('0xf')][_0x06a0('0x9d')](util[_0x06a0('0x2a')]('DIALOGFLOW_%s',_0x569f43['toUpperCase']()),_0x2a25f7[_0x569f43]);}}}this['createSquareMessage'](_0x2a25f7['speech'],_0x06a0('0xec'),_0x06a0('0xf5'),_0x2a25f7[_0x06a0('0xf4')]);return this[_0x06a0('0xf')][_0x06a0('0xaa')](util['format'](_0x06a0('0xf6'),_0x2a25f7[_0x06a0('0xeb')]));}return this[_0x06a0('0xf')][_0x06a0('0x2c')](_0xe016db,_0x06a0('0xf7'));};AGIVertices[_0x06a0('0x12')]['sesteknda']=function(_0x525505){logger[_0x06a0('0x2d')](util[_0x06a0('0x2a')](_0x06a0('0xf8'),_0x525505[_0x06a0('0xa8')]));if(!this[_0x06a0('0xa9')](_0x525505[_0x06a0('0xf9')])){return this[_0x06a0('0xf')]['noop'](_0x06a0('0xfa'));}if(!this[_0x06a0('0xa9')](_0x525505[_0x06a0('0xfb')])){return this[_0x06a0('0xf')][_0x06a0('0xaa')](_0x06a0('0xfc'));}if(!this['isConfigured'](_0x525505[_0x06a0('0xfd')])){return this[_0x06a0('0xf')][_0x06a0('0xaa')](_0x06a0('0xfe'));}if(!this['isConfigured'](_0x525505[_0x06a0('0xff')])){return this[_0x06a0('0xf')][_0x06a0('0xaa')](_0x06a0('0xab'));}this[_0x06a0('0xf')][_0x06a0('0xe7')]=!![];this[_0x06a0('0x35')](_0x525505);this[_0x06a0('0xe8')](_0x525505[_0x06a0('0x5b')],'in','','');this['channel'][_0x06a0('0xaa')](util[_0x06a0('0x2a')](_0x06a0('0x100'),_0x525505[_0x06a0('0x5b')]));var _0x444807=this[_0x06a0('0x7e')][_0x06a0('0xc4')](this,_0x525505);if(_0x444807){for(var _0x30d3f1 in _0x444807){if(_0x444807[_0x06a0('0x93')](_0x30d3f1)){this[_0x06a0('0xf')][_0x06a0('0x9d')](util[_0x06a0('0x2a')](_0x06a0('0x101'),_0x30d3f1[_0x06a0('0x68')]()),_0x444807[_0x30d3f1]);}}this[_0x06a0('0xe8')](_0x444807['speech'],_0x06a0('0xec'),_0x06a0('0x102'),'');if(_0x444807['audiofile']){this['channel'][_0x06a0('0xaa')](util[_0x06a0('0x2a')](_0x06a0('0x103'),_0x444807['audiofile']));var _0x2bd24a=this[_0x06a0('0xf')][_0x06a0('0x104')](_0x444807[_0x06a0('0x105')]);try{fs[_0x06a0('0x106')](_0x444807[_0x06a0('0x105')]+_0x06a0('0x107'));}catch(_0x30b340){logger['error'](_0x30b340);}return _0x2bd24a;}else{return this['channel'][_0x06a0('0xaa')](util[_0x06a0('0x2a')]('SestekNDA\x20Result\x20%s',_0x444807[_0x06a0('0xeb')]));}}return this[_0x06a0('0xf')][_0x06a0('0x2c')](_0x525505,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0x06a0('0x12')]['end']=function(_0x9c27a9){logger[_0x06a0('0x2d')](util[_0x06a0('0x2a')](_0x06a0('0x108'),_0x9c27a9[_0x06a0('0xa8')]));return this['channel'][_0x06a0('0xaa')]('end');};AGIVertices['prototype']['ext_dial']=function(_0x36af08){logger[_0x06a0('0x2d')](util['format'](_0x06a0('0x109'),_0x36af08[_0x06a0('0xa8')]));var _0x3a4d08='';if(_0x36af08['trunk_id']){if(!this['isConfigured'](_0x36af08[_0x06a0('0x10a')])){return this[_0x06a0('0xf')][_0x06a0('0x2c')](_0x36af08,_0x06a0('0x10b'));}else{var _0x4ba3ad=parseInt(_0x36af08['trunk_id'],0xa);if(isNaN(_0x4ba3ad)){_0x3a4d08=_0x36af08[_0x06a0('0x10a')];}else{_0x3a4d08=this[_0x06a0('0x10c')][_0x06a0('0xc4')](this,_0x36af08[_0x06a0('0x10a')]);if(!_0x3a4d08){return this[_0x06a0('0xf')][_0x06a0('0x2c')](_0x36af08,_0x06a0('0x10d'));}}}}else if(_0x36af08['trunk_name']){_0x3a4d08=_0x36af08[_0x06a0('0x10e')];}else{return this[_0x06a0('0xf')][_0x06a0('0x2c')](_0x36af08,_0x06a0('0x10b'));}var _0xd71462=this['channel'][_0x06a0('0x55')](_0x06a0('0xe0'),[util[_0x06a0('0x2a')](_0x06a0('0x10f'),_0x3a4d08,_0x36af08[_0x06a0('0x45')]),_0x36af08[_0x06a0('0x63')],_0x36af08[_0x06a0('0xe2')],_0x36af08[_0x06a0('0x61')]]);if(_0xd71462['result']===-0x1){return _0xd71462;}return this[_0x06a0('0xf')][_0x06a0('0xaa')](util['format'](_0x06a0('0xe3'),_0x06a0('0xe0')));};AGIVertices[_0x06a0('0x12')][_0x06a0('0x110')]=function(_0x44aa1b){logger[_0x06a0('0x2d')](util[_0x06a0('0x2a')](_0x06a0('0x111'),_0x44aa1b['label']));return this[_0x06a0('0xf')][_0x06a0('0xaa')](_0x06a0('0x110'));};AGIVertices[_0x06a0('0x12')][_0x06a0('0xd')]=function(_0x491ca7){logger[_0x06a0('0x2d')](util['format'](_0x06a0('0x112'),_0x491ca7[_0x06a0('0xa8')]));if(_0x491ca7[_0x06a0('0x113')]===0x0){return this[_0x06a0('0xa5')](_0x491ca7);}_0x491ca7[_0x06a0('0x113')]-=0x1;if(!this[_0x06a0('0xa9')](_0x491ca7[_0x06a0('0x114')])){return this[_0x06a0('0xf')]['error'](_0x491ca7,'no\x20file\x20audio\x20selected');}var _0x376392=this[_0x06a0('0x1f')][_0x06a0('0xc4')](this,_0x491ca7['file_id']);if(!_0x376392){return this[_0x06a0('0xf')][_0x06a0('0x2c')](_0x491ca7,'no\x20file\x20audio\x20found');}if(!this[_0x06a0('0xa9')](_0x491ca7[_0x06a0('0xd4')])){return this[_0x06a0('0xf')][_0x06a0('0x2c')](_0x06a0('0xd5'));}var _0x2e4433=this[_0x06a0('0xf')][_0x06a0('0x115')](_0x376392,_0x491ca7[_0x06a0('0x116')],_0x491ca7[_0x06a0('0x117')]);var _0x153d66=_0x2e4433['result']?_0x2e4433[_0x06a0('0xa2')]['toString']():'';logger[_0x06a0('0x2d')](_0x06a0('0x118'),JSON[_0x06a0('0x71')](_0x2e4433));if(_0x2e4433[_0x06a0('0xa2')]===-0x1){this[_0x06a0('0x35')][_0x06a0('0xc4')](this,_0x491ca7,_0x153d66);return _0x2e4433;}else if(_0x2e4433[_0x06a0('0xa4')]===_0x06a0('0x63')){_0x2e4433[_0x06a0('0xa2')]=_0x153d66[_0x06a0('0x99')]>=parseInt(_0x491ca7['mindigit'])?'x':'i';}else{_0x2e4433[_0x06a0('0xa2')]=_0x153d66['length']>=parseInt(_0x491ca7['mindigit'])&&_0x153d66[_0x06a0('0x99')]<=parseInt(_0x491ca7[_0x06a0('0x117')])?'x':'i';}var _0x3ff20b=this[_0x06a0('0x13')][_0x06a0('0xc4')](this,_0x491ca7[_0x06a0('0xd4')]);if(!_0x3ff20b){return this[_0x06a0('0xf')]['error'](_0x491ca7,_0x06a0('0xd6'));}this[_0x06a0('0xf')][_0x06a0('0x9d')](_0x3ff20b,_0x153d66);if(this[_0x06a0('0xa9')](_0x491ca7[_0x06a0('0x119')])){var _0x1ad8dc=parseInt(_0x491ca7[_0x06a0('0x119')],0xa);var _0xacf227=rs['generate']({'charset':'*','length':_0x1ad8dc});var _0x5be871=_0x153d66['length'];if(_0x5be871>0x0){if(_0x5be871>_0x1ad8dc){this[_0x06a0('0x35')][_0x06a0('0xc4')](this,_0x491ca7,_0x491ca7['hiddendigitspos']==='first'?_0xacf227+_0x153d66[_0x06a0('0x11a')](_0x1ad8dc):_0x153d66['substr'](0x0,_0x5be871-_0x1ad8dc)+_0xacf227);}else{this[_0x06a0('0x35')][_0x06a0('0xc4')](this,_0x491ca7,rs[_0x06a0('0x11b')]({'charset':'*','length':_0x5be871}));}}else{this[_0x06a0('0x35')][_0x06a0('0xc4')](this,_0x491ca7,'');}}else{this[_0x06a0('0x35')][_0x06a0('0xc4')](this,_0x491ca7,_0x153d66);}return _0x2e4433;};AGIVertices[_0x06a0('0x12')]['getsecretdigits']=function(_0x55aa45){logger[_0x06a0('0x2d')](util[_0x06a0('0x2a')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x55aa45['label']));return this['getdigits'](_0x55aa45);};AGIVertices[_0x06a0('0x12')]['goal']=function(_0x11c54d){logger[_0x06a0('0x2d')](util[_0x06a0('0x2a')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x11c54d['label']));this[_0x06a0('0x35')]['sync'](this,_0x11c54d,_0x11c54d[_0x06a0('0x11c')]);return this[_0x06a0('0xf')][_0x06a0('0xaa')](util[_0x06a0('0x2a')](_0x06a0('0x11d'),_0x11c54d[_0x06a0('0x11c')]));};AGIVertices[_0x06a0('0x12')][_0x06a0('0x11e')]=function(_0x1407b1){logger[_0x06a0('0x2d')](util[_0x06a0('0x2a')](_0x06a0('0x11f'),_0x1407b1[_0x06a0('0xa8')]));if(!this[_0x06a0('0xa9')](_0x1407b1['aws_access_key_id'])||!this[_0x06a0('0xa9')](_0x1407b1[_0x06a0('0x86')])){return this[_0x06a0('0xf')][_0x06a0('0xaa')](_0x06a0('0x120'));}if(!this[_0x06a0('0xa9')](_0x1407b1[_0x06a0('0x5b')])){return this[_0x06a0('0xf')][_0x06a0('0xaa')]('no\x20text\x20configured');}this[_0x06a0('0xf')][_0x06a0('0xaa')](util[_0x06a0('0x2a')](_0x06a0('0x121'),_0x1407b1['text']));var _0x56edc2=this['awsPolly'][_0x06a0('0xc4')](this,_0x1407b1);if(_0x56edc2){this[_0x06a0('0xf')][_0x06a0('0xaa')](util['format'](_0x06a0('0x122'),_0x56edc2));var _0x2bd134=this[_0x06a0('0xf')][_0x06a0('0x104')](_0x56edc2);try{fs['unlink'](_0x56edc2+_0x06a0('0x107'));}catch(_0x213391){logger[_0x06a0('0x2c')](_0x213391);}return _0x2bd134;}return this[_0x06a0('0xf')][_0x06a0('0x2c')](_0x1407b1,_0x06a0('0x123'));};AGIVertices['prototype'][_0x06a0('0x124')]=function(_0xa48ad2){logger[_0x06a0('0x2d')](util[_0x06a0('0x2a')](_0x06a0('0x125'),_0xa48ad2[_0x06a0('0xa8')]));if(!this['isConfigured'](_0xa48ad2[_0x06a0('0x126')])||!this[_0x06a0('0xa9')](_0xa48ad2['aws_secret_access_key'])){return this['channel']['noop']('no\x20valid\x20credentials\x20configured');}if(!this['isConfigured'](_0xa48ad2[_0x06a0('0x8b')])){return this['channel']['noop'](_0x06a0('0x127'));}if(!this[_0x06a0('0xa9')](_0xa48ad2[_0x06a0('0x5b')])){return this[_0x06a0('0xf')][_0x06a0('0xaa')](_0x06a0('0xab'));}this['channel']['bot']=!![];this[_0x06a0('0x35')](_0xa48ad2);this['createSquareMessage'](_0xa48ad2[_0x06a0('0x5b')],'in','','');this[_0x06a0('0xf')]['noop'](util[_0x06a0('0x2a')](_0x06a0('0x128'),_0xa48ad2[_0x06a0('0x5b')]));var _0x5bb7fd=this[_0x06a0('0x89')][_0x06a0('0xc4')](this,_0xa48ad2);if(_0x5bb7fd){for(var _0x4223cf in _0x5bb7fd){if(_0x5bb7fd[_0x06a0('0x93')](_0x4223cf)&&_[_0x06a0('0x94')](_0x5bb7fd[_0x4223cf])){this['channel'][_0x06a0('0x9d')](util[_0x06a0('0x2a')](_0x06a0('0x129'),_0x4223cf[_0x06a0('0x68')]()),_0x5bb7fd[_0x4223cf]);}}if(_['isNil'](_0x5bb7fd[_0x06a0('0x75')])){return this[_0x06a0('0xf')][_0x06a0('0xaa')](_0x06a0('0x12a'));}else{this[_0x06a0('0xe8')](_0x5bb7fd['message'],_0x06a0('0xec'),'amazonlex','');return this[_0x06a0('0xf')][_0x06a0('0xaa')](util[_0x06a0('0x2a')](_0x06a0('0x12b'),_0x5bb7fd[_0x06a0('0x75')]));}}return this[_0x06a0('0xf')][_0x06a0('0x2c')](_0xa48ad2,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0x06a0('0x12')]['googleasr']=function(_0x3c840a){logger[_0x06a0('0x2d')](util[_0x06a0('0x2a')](_0x06a0('0x12c'),_0x3c840a[_0x06a0('0xa8')],_0x3c840a[_0x06a0('0x63')]));if(!this[_0x06a0('0xa9')](_0x3c840a[_0x06a0('0x79')])){return this[_0x06a0('0xf')]['noop'](_0x06a0('0xe6'));}var _0x1b0ba7=_0x06a0('0x12d');var _0x20cbb0=util[_0x06a0('0x2a')](_0x06a0('0x12e'),FILES_PATH,rs[_0x06a0('0x11b')](0x4));var _0x5be864=util[_0x06a0('0x2a')](_0x06a0('0x9c'),_0x20cbb0,_0x1b0ba7);var _0x18d3fb=!![];if(_0x3c840a[_0x06a0('0x12f')]===_0x06a0('0x130')){_0x18d3fb=![];}var _0xc13df8=this[_0x06a0('0xf')]['recordFile'](_0x20cbb0,_0x1b0ba7,_0x3c840a[_0x06a0('0x131')],_0x3c840a[_0x06a0('0x63')],undefined,_0x18d3fb);if(_0xc13df8[_0x06a0('0xa2')]!==-0x1){this[_0x06a0('0xf')][_0x06a0('0xaa')](util[_0x06a0('0x2a')](_0x06a0('0x132'),_0x5be864));var _0x25196e=this[_0x06a0('0x8c')][_0x06a0('0xc4')](this,_0x3c840a,_0x5be864);if(_0x25196e){for(var _0x168db4 in _0x25196e){if(_0x25196e['hasOwnProperty'](_0x168db4)){this[_0x06a0('0xf')][_0x06a0('0x9d')](util[_0x06a0('0x2a')](_0x06a0('0x133'),_0x168db4[_0x06a0('0x68')]()),_0x25196e[_0x168db4]);}}return this[_0x06a0('0xf')][_0x06a0('0xaa')](util[_0x06a0('0x2a')](_0x06a0('0x134'),JSON[_0x06a0('0x71')](_0x25196e)));}}return _0xc13df8;};AGIVertices['prototype'][_0x06a0('0x135')]=function(_0x58fd6a){logger[_0x06a0('0x2d')](util[_0x06a0('0x2a')](_0x06a0('0x136'),_0x58fd6a[_0x06a0('0xa8')]));if(!this[_0x06a0('0xa9')](_0x58fd6a['appid'])){return this[_0x06a0('0xf')][_0x06a0('0xaa')](_0x06a0('0x137'));}if(!this[_0x06a0('0xa9')](_0x58fd6a['appsecret'])){return this['channel'][_0x06a0('0xaa')](_0x06a0('0x138'));}var _0x4cdd63=_0x06a0('0x12d');var _0x1dc28d=util[_0x06a0('0x2a')](_0x06a0('0x12e'),FILES_PATH,rs[_0x06a0('0x11b')](0x4));var _0x1b04f0=util[_0x06a0('0x2a')](_0x06a0('0x9c'),_0x1dc28d,_0x4cdd63);var _0x18f2fe=!![];if(_0x58fd6a['beep']===_0x06a0('0x130')){_0x18f2fe=![];}var _0x2871c9=this[_0x06a0('0xf')][_0x06a0('0x139')](_0x1dc28d,_0x4cdd63,_0x58fd6a[_0x06a0('0x131')],_0x58fd6a[_0x06a0('0x63')],undefined,_0x18f2fe);if(_0x2871c9['result']!==-0x1){this[_0x06a0('0xf')][_0x06a0('0xaa')](util[_0x06a0('0x2a')](_0x06a0('0x13a'),_0x1b04f0));var _0x35f4cb=this[_0x06a0('0x8e')][_0x06a0('0xc4')](this,_0x58fd6a,_0x1b04f0);if(_0x35f4cb){for(var _0x5813ad in _0x35f4cb){if(_0x35f4cb['hasOwnProperty'](_0x5813ad)){this[_0x06a0('0xf')][_0x06a0('0x9d')](util[_0x06a0('0x2a')](_0x06a0('0x13b'),_0x5813ad[_0x06a0('0x68')]()),_0x35f4cb[_0x5813ad]);}}return this[_0x06a0('0xf')]['noop'](util['format'](_0x06a0('0x13c'),JSON['stringify'](_0x35f4cb)));}}return _0x2871c9;};AGIVertices[_0x06a0('0x12')][_0x06a0('0x13d')]=function(_0xdf5ba3){logger[_0x06a0('0x2d')](util[_0x06a0('0x2a')](_0x06a0('0x13e'),_0xdf5ba3[_0x06a0('0xa8')]));return this[_0x06a0('0xf')][_0x06a0('0x13f')](_0xdf5ba3['context'],_0xdf5ba3[_0x06a0('0x3a')],_0xdf5ba3[_0x06a0('0x3b')]);};AGIVertices['prototype']['gotoif']=function(_0x3ad4d9){logger[_0x06a0('0x2d')](util['format'](_0x06a0('0x140'),_0x3ad4d9['label']));if(!this[_0x06a0('0xa9')](_0x3ad4d9['condition'])){return this[_0x06a0('0xf')][_0x06a0('0x2c')](_0x3ad4d9,_0x06a0('0x141'));}try{var _0x5c934a=eval(_0x3ad4d9[_0x06a0('0x142')])?_0x06a0('0x143'):_0x06a0('0x144');this[_0x06a0('0xf')]['noop'](util[_0x06a0('0x2a')](_0x06a0('0x145'),_0x3ad4d9[_0x06a0('0x142')],_0x5c934a));return{'code':0xc8,'result':_0x5c934a};}catch(_0xa3c7af){return{'code':0xc8,'result':_0x06a0('0x144')};}};AGIVertices['prototype'][_0x06a0('0x146')]=function(_0x3bd9cf){logger[_0x06a0('0x2d')](util[_0x06a0('0x2a')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x3bd9cf[_0x06a0('0xa8')]));if(!this[_0x06a0('0xa9')](_0x3bd9cf['interval_id'])){return this[_0x06a0('0xf')][_0x06a0('0x2c')](_0x3bd9cf,_0x06a0('0x147'));}var _0x23bead=this['getIntervals']['sync'](this,_0x3bd9cf[_0x06a0('0x148')]);if(!_0x23bead){return this[_0x06a0('0xf')][_0x06a0('0x2c')](_0x3bd9cf,'no\x20intervals\x20found');}for(var _0x47d9e1=0x0;_0x47d9e1<_0x23bead[_0x06a0('0x99')];_0x47d9e1+=0x1){var _0x32335a=this[_0x06a0('0xf')][_0x06a0('0x13')](util[_0x06a0('0x2a')](_0x06a0('0x149'),_0x23bead[_0x47d9e1]));if(_0x32335a['result']===-0x1){return _0x32335a;}logger[_0x06a0('0x2d')](util[_0x06a0('0x2a')](_0x06a0('0x14a'),_0x23bead[_0x47d9e1],_0x32335a[_0x06a0('0xa4')]));if(_0x32335a[_0x06a0('0xa4')]===_0x06a0('0x143')){logger[_0x06a0('0x2d')](util[_0x06a0('0x2a')]('IFTIME\x20%s\x20%s',_0x23bead[_0x47d9e1],'true'));this['channel']['noop'](util[_0x06a0('0x2a')](_0x06a0('0x14a'),_0x23bead[_0x47d9e1],'true'));return{'code':0xc8,'result':'true'};}else{logger[_0x06a0('0x2d')](util[_0x06a0('0x2a')](_0x06a0('0x14a'),_0x23bead[_0x47d9e1],_0x06a0('0x144')));this[_0x06a0('0xf')][_0x06a0('0xaa')](util['format'](_0x06a0('0x14a'),_0x23bead[_0x47d9e1],_0x06a0('0x144')));}}return{'code':0xc8,'result':'false'};};AGIVertices[_0x06a0('0x12')][_0x06a0('0x14b')]=function(_0x4c109e){logger['info'](util[_0x06a0('0x2a')](_0x06a0('0x14c'),_0x4c109e[_0x06a0('0xa8')]));return this[_0x06a0('0xf')]['hangup']();};AGIVertices[_0x06a0('0x12')][_0x06a0('0x14d')]=function(_0x4afaaa){logger['info'](util['format'](_0x06a0('0x14e'),_0x4afaaa[_0x06a0('0xa8')]));if(!this[_0x06a0('0xa9')](_0x4afaaa[_0x06a0('0x79')])){return this[_0x06a0('0xf')]['noop'](_0x06a0('0xe6'));}var _0x401a4b='wav';var _0x51b8af=util[_0x06a0('0x2a')](_0x06a0('0x12e'),FILES_PATH,rs[_0x06a0('0x11b')](0x4));var _0x1942a5=util[_0x06a0('0x2a')](_0x06a0('0x9c'),_0x51b8af,_0x401a4b);var _0x1d5768=!![];if(_0x4afaaa[_0x06a0('0x12f')]===_0x06a0('0x130')){_0x1d5768=![];}var _0x345b45=this[_0x06a0('0xf')]['recordFile'](_0x51b8af,_0x401a4b,_0x4afaaa[_0x06a0('0x131')],_0x4afaaa[_0x06a0('0x63')],undefined,_0x1d5768);if(_0x345b45[_0x06a0('0xa2')]!==-0x1){this[_0x06a0('0xf')]['noop'](util[_0x06a0('0x2a')](_0x06a0('0x14f'),_0x1942a5));var _0x2744dc=this[_0x06a0('0x82')][_0x06a0('0xc4')](this,_0x4afaaa,_0x1942a5);if(_0x2744dc){for(var _0x1c47fe in _0x2744dc){if(_0x2744dc[_0x06a0('0x93')](_0x1c47fe)){this[_0x06a0('0xf')][_0x06a0('0x9d')](util[_0x06a0('0x2a')](_0x06a0('0x150'),_0x1c47fe[_0x06a0('0x68')]()),_0x2744dc[_0x1c47fe]);}}return this[_0x06a0('0xf')]['noop'](util[_0x06a0('0x2a')]('IspeechASR\x20Result\x20%s',JSON[_0x06a0('0x71')](_0x2744dc)));}}return _0x345b45;};AGIVertices['prototype'][_0x06a0('0x151')]=function(_0x1ac6dc){logger[_0x06a0('0x2d')](util['format'](_0x06a0('0x152'),_0x1ac6dc[_0x06a0('0xa8')]));if(!this[_0x06a0('0xa9')](_0x1ac6dc['key'])){return this[_0x06a0('0xf')][_0x06a0('0xaa')](_0x06a0('0xe6'));}if(!this[_0x06a0('0xa9')](_0x1ac6dc[_0x06a0('0x5b')])){return this[_0x06a0('0xf')][_0x06a0('0xaa')](_0x06a0('0xab'));}this[_0x06a0('0xf')][_0x06a0('0xaa')](util[_0x06a0('0x2a')]('Trying\x20ispeech\x20TTS\x20%s',_0x1ac6dc[_0x06a0('0x5b')]));var _0xc12dd7=this[_0x06a0('0x7f')][_0x06a0('0xc4')](this,_0x1ac6dc);if(_0xc12dd7){this[_0x06a0('0xf')][_0x06a0('0xaa')](util[_0x06a0('0x2a')](_0x06a0('0x14f'),_0xc12dd7));var _0x1ca0e9=this[_0x06a0('0xf')][_0x06a0('0x104')](_0xc12dd7,_0x1ac6dc[_0x06a0('0x131')]);try{fs[_0x06a0('0x106')](_0xc12dd7+_0x06a0('0x107'));}catch(_0x2081da){logger[_0x06a0('0x2c')](_0x2081da);}return _0x1ca0e9;}return this[_0x06a0('0xf')][_0x06a0('0x2c')](_0x1ac6dc,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0x06a0('0x12')][_0x06a0('0x153')]=function(_0x474043){logger['info'](util[_0x06a0('0x2a')](_0x06a0('0x154'),_0x474043['label']));if(!this[_0x06a0('0xa9')](_0x474043[_0x06a0('0x155')])){return this[_0x06a0('0xf')]['error'](_0x474043,_0x06a0('0x156'));}logger[_0x06a0('0x2d')](util[_0x06a0('0x2a')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x06a0('0xf')][_0x06a0('0x38')],_0x474043['findBy']));var _0x3c5282=this[_0x06a0('0x53')][_0x06a0('0xc4')](this,_0x474043['findBy']);if(_0x3c5282){logger[_0x06a0('0x2d')](util[_0x06a0('0x2a')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x06a0('0xf')]['callerid'],_0x474043[_0x06a0('0x155')]));this[_0x06a0('0xf')]['noop'](util[_0x06a0('0x2a')](_0x06a0('0x157'),this['channel'][_0x06a0('0x38')],_0x474043['findBy']));return{'code':0xc8,'result':_0x06a0('0x158')};}else{logger[_0x06a0('0x2d')](util[_0x06a0('0x2a')](_0x06a0('0x159'),this[_0x06a0('0xf')][_0x06a0('0x38')],_0x474043['findBy']));this[_0x06a0('0xf')]['noop'](util[_0x06a0('0x2a')](_0x06a0('0x159'),this[_0x06a0('0xf')][_0x06a0('0x38')],_0x474043[_0x06a0('0x155')]));return{'code':0xc8,'result':_0x06a0('0x15a')};}};AGIVertices[_0x06a0('0x12')][_0x06a0('0x15b')]=function(_0xcce2cc){logger[_0x06a0('0x2d')](util[_0x06a0('0x2a')](_0x06a0('0x15c'),_0xcce2cc[_0x06a0('0xa8')]));if(!this['isConfigured'](_0xcce2cc[_0x06a0('0x155')])){return this[_0x06a0('0xf')][_0x06a0('0x2c')](_0xcce2cc,'no\x20find\x20by\x20configured');}logger[_0x06a0('0x2d')](util[_0x06a0('0x2a')](_0x06a0('0x15d'),this[_0x06a0('0xf')][_0x06a0('0x38')],_0xcce2cc[_0x06a0('0x155')]));var _0x266469=this[_0x06a0('0x50')][_0x06a0('0xc4')](this,_0xcce2cc[_0x06a0('0x155')]);if(_0x266469){logger[_0x06a0('0x2d')](util[_0x06a0('0x2a')](_0x06a0('0x157'),this[_0x06a0('0xf')]['callerid'],_0xcce2cc[_0x06a0('0x155')]));this[_0x06a0('0xf')][_0x06a0('0xaa')](util[_0x06a0('0x2a')](_0x06a0('0x157'),this[_0x06a0('0xf')][_0x06a0('0x38')],_0xcce2cc[_0x06a0('0x155')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x06a0('0x38')],_0xcce2cc['findBy']));this['channel'][_0x06a0('0xaa')](util[_0x06a0('0x2a')](_0x06a0('0x159'),this['channel'][_0x06a0('0x38')],_0xcce2cc[_0x06a0('0x155')]));return{'code':0xc8,'result':_0x06a0('0x15a')};}};AGIVertices[_0x06a0('0x12')][_0x06a0('0x15e')]=function(_0x59b9ba){logger[_0x06a0('0x2d')](util[_0x06a0('0x2a')](_0x06a0('0x15f'),_0x59b9ba[_0x06a0('0xa8')]));if(!this[_0x06a0('0xa9')](_0x59b9ba['operation'])){return this[_0x06a0('0xf')][_0x06a0('0x2c')](_0x59b9ba,'no\x20operation\x20configured');}this[_0x06a0('0xf')][_0x06a0('0xaa')](util[_0x06a0('0x2a')]('math\x20%s',_0x59b9ba['operation']));var _0x26837e=eval(_0x59b9ba['operation']);if(!this[_0x06a0('0xa9')](_0x59b9ba[_0x06a0('0xd4')])){return this['channel'][_0x06a0('0xaa')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x4bd604=this[_0x06a0('0x13')][_0x06a0('0xc4')](this,_0x59b9ba[_0x06a0('0xd4')]);if(!_0x4bd604){return this[_0x06a0('0xf')][_0x06a0('0x2c')](_0x59b9ba,'no\x20variable\x20found');}if(_[_0x06a0('0x98')](_0x26837e)){var _0x2cb5d0=this;_0x26837e[_0x06a0('0xd7')](function(_0x3b3b3c,_0x46b6be){_0x2cb5d0[_0x06a0('0xf')][_0x06a0('0x9d')](util[_0x06a0('0x2a')]('%s[%s]',_0x4bd604,_0x46b6be),_0x3b3b3c);});return this['channel'][_0x06a0('0xaa')](util[_0x06a0('0x2a')](_0x06a0('0x160'),_0x4bd604));}else{return this[_0x06a0('0xf')][_0x06a0('0x9d')](_0x4bd604,_0x26837e);}};AGIVertices['prototype'][_0x06a0('0x161')]=function(_0x2807e1){logger[_0x06a0('0x2d')](util[_0x06a0('0x2a')](_0x06a0('0x162'),_0x2807e1[_0x06a0('0xa8')]));if(_0x2807e1[_0x06a0('0x113')]===0x0){return this[_0x06a0('0xa5')](_0x2807e1);}_0x2807e1[_0x06a0('0x113')]-=0x1;if(!this[_0x06a0('0xa9')](_0x2807e1['file_id'])){return this[_0x06a0('0xf')][_0x06a0('0x2c')](_0x2807e1,_0x06a0('0x163'));}var _0x2522e5=this[_0x06a0('0x1f')][_0x06a0('0xc4')](this,_0x2807e1['file_id']);if(!_0x2522e5){return this[_0x06a0('0xf')][_0x06a0('0x2c')](_0x2807e1,_0x06a0('0x164'));}var _0x53cb43=this[_0x06a0('0xf')][_0x06a0('0x115')](_0x2522e5,_0x2807e1[_0x06a0('0x116')],_0x2807e1[_0x06a0('0x165')]);var _0x22dc74=_0x53cb43[_0x06a0('0xa2')];if(_0x53cb43['result']===-0x1){this[_0x06a0('0x35')]['sync'](this,_0x2807e1,'-1');return _0x53cb43;}else if(_0x53cb43[_0x06a0('0xa4')]===_0x06a0('0x63')){_0x53cb43[_0x06a0('0xa2')]=_0x53cb43[_0x06a0('0xa2')][_0x06a0('0x99')]>0x0?_0x53cb43[_0x06a0('0xa2')]:'t';}else if(_['isEmpty'](_0x53cb43[_0x06a0('0xa2')])){_0x53cb43[_0x06a0('0xa2')]='#';_0x22dc74='#';}if(!this['isConfigured'](_0x2807e1[_0x06a0('0xd4')])){this[_0x06a0('0xf')][_0x06a0('0xaa')](_0x06a0('0xd5'));}else{var _0x52f2c2=this[_0x06a0('0x13')][_0x06a0('0xc4')](this,_0x2807e1[_0x06a0('0xd4')]);if(!_0x52f2c2){return this[_0x06a0('0xf')][_0x06a0('0x2c')](_0x2807e1,_0x06a0('0xd6'));}this[_0x06a0('0xf')][_0x06a0('0x9d')](_0x52f2c2,_0x22dc74);}this[_0x06a0('0x35')][_0x06a0('0xc4')](this,_0x2807e1,_0x22dc74);return _0x53cb43;};AGIVertices['prototype'][_0x06a0('0xaa')]=function(_0x4b72ee){logger[_0x06a0('0x2d')](util[_0x06a0('0x2a')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x4b72ee[_0x06a0('0xa8')]));return this[_0x06a0('0xf')][_0x06a0('0xaa')](_0x4b72ee[_0x06a0('0x166')]||_0x4b72ee[_0x06a0('0xa8')]);};AGIVertices[_0x06a0('0x12')][_0x06a0('0x167')]=function(_0x5ecdfd){logger[_0x06a0('0x2d')](util[_0x06a0('0x2a')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x5ecdfd['label']));if(!this[_0x06a0('0xa9')](_0x5ecdfd[_0x06a0('0x155')])){return this[_0x06a0('0xf')]['error'](_0x5ecdfd,_0x06a0('0x156'));}logger['info'](util[_0x06a0('0x2a')](_0x06a0('0x15d'),this[_0x06a0('0xf')][_0x06a0('0x38')],_0x5ecdfd[_0x06a0('0x155')]));var _0x68d997=this[_0x06a0('0x4b')][_0x06a0('0xc4')](this,_0x5ecdfd[_0x06a0('0x168')]);var _0xdb4119=this[_0x06a0('0x4d')][_0x06a0('0xc4')](this,_0x5ecdfd[_0x06a0('0x155')],_0x68d997);if(_0xdb4119){logger[_0x06a0('0x2d')](util[_0x06a0('0x2a')](_0x06a0('0x157'),this['channel'][_0x06a0('0x38')],_0x5ecdfd[_0x06a0('0x155')]));this['channel']['noop'](util[_0x06a0('0x2a')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x06a0('0xf')]['callerid'],_0x5ecdfd[_0x06a0('0x155')]));return{'code':0xc8,'result':'success'};}else{logger[_0x06a0('0x2d')](util[_0x06a0('0x2a')](_0x06a0('0x159'),this[_0x06a0('0xf')][_0x06a0('0x38')],_0x5ecdfd[_0x06a0('0x155')]));this[_0x06a0('0xf')]['noop'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x06a0('0xf')][_0x06a0('0x38')],_0x5ecdfd[_0x06a0('0x155')]));return{'code':0xc8,'result':_0x06a0('0x15a')};}};AGIVertices['prototype'][_0x06a0('0x169')]=function(_0x54e0cf){logger[_0x06a0('0x2d')](util[_0x06a0('0x2a')](_0x06a0('0x16a'),_0x54e0cf[_0x06a0('0xa8')]));if(!this[_0x06a0('0xa9')](_0x54e0cf[_0x06a0('0x114')])){return this[_0x06a0('0xf')][_0x06a0('0x2c')](_0x54e0cf,_0x06a0('0x163'));}var _0x2a3438=this[_0x06a0('0x1f')]['sync'](this,_0x54e0cf[_0x06a0('0x114')]);if(!_0x2a3438){return this[_0x06a0('0xf')][_0x06a0('0x2c')](_0x54e0cf,_0x06a0('0x164'));}var _0x32b145=this['channel'][_0x06a0('0x55')](_0x06a0('0x16b'),[_0x2a3438,_0x54e0cf[_0x06a0('0xe2')]]);if(_0x32b145[_0x06a0('0xa2')]===-0x1){return _0x32b145;}return this[_0x06a0('0xf')][_0x06a0('0xaa')](util['format'](_0x06a0('0xc7'),_0x06a0('0x16b'),_0x2a3438));};AGIVertices[_0x06a0('0x12')]['queue']=function(_0x2e45e9){logger[_0x06a0('0x2d')](util[_0x06a0('0x2a')](_0x06a0('0x16c'),_0x2e45e9[_0x06a0('0xa8')]));if(!this['isConfigured'](_0x2e45e9[_0x06a0('0x16d')])){return this[_0x06a0('0xf')]['error'](_0x2e45e9,_0x06a0('0x16e'));}var _0x19fe31='';var _0x5eeb8a=parseInt(_0x2e45e9[_0x06a0('0x16d')],0xa);if(isNaN(_0x5eeb8a)){_0x19fe31=_0x2e45e9['queue_id'];}else{_0x19fe31=this[_0x06a0('0x18')][_0x06a0('0xc4')](this,_0x2e45e9[_0x06a0('0x16d')]);if(!_0x19fe31){return this['channel'][_0x06a0('0x2c')](_0x2e45e9,_0x06a0('0x16f'));}}var _0x3157bd='';if(this[_0x06a0('0xa9')](_0x2e45e9['file_id'])){var _0x349f24=this[_0x06a0('0x1f')]['sync'](this,_0x2e45e9[_0x06a0('0x114')]);if(_0x349f24){_0x3157bd=_0x349f24;}}this['createSquareDetailsReport'][_0x06a0('0xc4')](this,_0x2e45e9,_0x19fe31);if(_0x2e45e9[_0x06a0('0xe2')]['indexOf']('x')<0x0){_0x2e45e9[_0x06a0('0xe2')]+='x';}if(_0x2e45e9[_0x06a0('0xe2')][_0x06a0('0x170')]('X')<0x0){_0x2e45e9[_0x06a0('0xe2')]+='X';}this[_0x06a0('0xf')]['setVariable']('XMCS-QUEUE',_0x19fe31?_0x19fe31[_0x06a0('0x171')]():'');var _0x29c835=this[_0x06a0('0xf')][_0x06a0('0x55')](_0x06a0('0x172'),[_0x19fe31,_0x2e45e9[_0x06a0('0xe2')],_0x2e45e9['url'],_0x3157bd,_0x2e45e9['timeout'],_0x2e45e9['agi'],_0x2e45e9['macro'],_0x2e45e9['gosub'],'',_0x2e45e9['position']]);if(_0x29c835['result']===-0x1){return _0x29c835;}return this[_0x06a0('0xf')]['noop'](util[_0x06a0('0x2a')]('Executed\x20command\x20%s\x20%s',_0x06a0('0x172'),_0x19fe31));};AGIVertices[_0x06a0('0x12')][_0x06a0('0x173')]=function(_0x3940db){logger[_0x06a0('0x2d')](util[_0x06a0('0x2a')](_0x06a0('0x174'),_0x3940db[_0x06a0('0xa8')]));var _0x345af4=_0x3940db[_0x06a0('0x175')]||'wav';var _0x38bb3b=util[_0x06a0('0x2a')]('%s_%s',this[_0x06a0('0xf')][_0x06a0('0x37')],rs[_0x06a0('0x11b')](0x5));var _0x45afa0=util[_0x06a0('0x2a')]('%s/recordings/%s.%s',FILES_PATH,_0x38bb3b,_0x345af4);var _0x29dc71=util['format']('%s/recordings/%s',FILES_PATH,_0x38bb3b);this[_0x06a0('0x36')][_0x06a0('0xc4')](this,_0x3940db,_0x38bb3b,_0x45afa0);this[_0x06a0('0xf')][_0x06a0('0x9d')](_0x06a0('0x176'),_0x38bb3b);logger[_0x06a0('0x2d')](_0x06a0('0x177'),_0x29dc71,_0x345af4,_0x3940db[_0x06a0('0x178')],_0x3940db['timeout']);return this[_0x06a0('0xf')][_0x06a0('0x139')](_0x29dc71,_0x345af4,_0x3940db['escape_digits'],_0x3940db['timeout'],undefined,!![]);};AGIVertices[_0x06a0('0x12')][_0x06a0('0x179')]=function(_0x108ea1){logger[_0x06a0('0x2d')](util[_0x06a0('0x2a')](_0x06a0('0x17a'),_0x108ea1[_0x06a0('0xa8')]));if(!this[_0x06a0('0xa9')](_0x108ea1[_0x06a0('0x61')])){return this[_0x06a0('0xf')][_0x06a0('0xaa')](_0x06a0('0x17b'));}var _0x56aacd=this[_0x06a0('0x60')][_0x06a0('0xc4')](this,_0x108ea1);logger['info'](util[_0x06a0('0x2a')](_0x06a0('0x17c'),util['inspect'](_0x56aacd,{'showHidden':![],'depth':null})));if(!this[_0x06a0('0xa9')](_0x108ea1[_0x06a0('0xd4')])){return this[_0x06a0('0xf')][_0x06a0('0xaa')](_0x06a0('0x17d'));}var _0xe3d18c=this['getVariable'][_0x06a0('0xc4')](this,_0x108ea1['variable_id']);if(!_0xe3d18c){return this[_0x06a0('0xf')][_0x06a0('0x2c')](_0x108ea1,_0x06a0('0xd6'));}this[_0x06a0('0xf')][_0x06a0('0x9d')](util[_0x06a0('0x2a')](_0x06a0('0x17e'),_0xe3d18c),_0x56aacd[_0x06a0('0x73')]?_0x56aacd[_0x06a0('0x73')]:_0x06a0('0x17f'));this[_0x06a0('0xf')][_0x06a0('0x9d')](util[_0x06a0('0x2a')]('%s_STATUS_MESSAGE',_0xe3d18c),_0x56aacd[_0x06a0('0x74')]?_0x56aacd[_0x06a0('0x74')]:'OK');if(_0x56aacd[_0x06a0('0x69')]){try{this['saveRestApiResult'](_0x56aacd[_0x06a0('0x69')],_0xe3d18c);}catch(_0x2bf76a){logger[_0x06a0('0x2c')](util[_0x06a0('0x2a')](_0x06a0('0x180'),_0xe3d18c));}}return this[_0x06a0('0xf')][_0x06a0('0xaa')](util[_0x06a0('0x2a')](_0x06a0('0xda'),_0xe3d18c));};AGIVertices[_0x06a0('0x12')]['saydigits']=function(_0x3b29e1){logger[_0x06a0('0x2d')](util[_0x06a0('0x2a')](_0x06a0('0x181'),_0x3b29e1[_0x06a0('0xa8')]));return this[_0x06a0('0xf')][_0x06a0('0x182')](_0x3b29e1[_0x06a0('0x183')][_0x06a0('0x57')](/\s+/g,''),_0x3b29e1['escape_digits']);};AGIVertices[_0x06a0('0x12')]['saynumber']=function(_0x5680ee){logger[_0x06a0('0x2d')](util[_0x06a0('0x2a')](_0x06a0('0x184'),_0x5680ee[_0x06a0('0xa8')]));return this[_0x06a0('0xf')]['sayNumber'](_0x5680ee[_0x06a0('0x64')][_0x06a0('0x57')](/\s+/g,''),_0x5680ee[_0x06a0('0x178')]);};AGIVertices[_0x06a0('0x12')]['sayphonetic']=function(_0x493a1e){logger['info'](util[_0x06a0('0x2a')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x493a1e['label']));return this[_0x06a0('0xf')][_0x06a0('0x185')](_0x493a1e['text'],_0x493a1e[_0x06a0('0x178')]);};AGIVertices['prototype'][_0x06a0('0x186')]=function(_0x27fb7b){logger[_0x06a0('0x2d')](util['format']('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x27fb7b[_0x06a0('0xa8')]));if(!this[_0x06a0('0xa9')](_0x27fb7b[_0x06a0('0x187')])){return this[_0x06a0('0xf')]['noop'](_0x06a0('0x188'));}var _0x257b4b=this[_0x06a0('0x23')][_0x06a0('0xc4')](this,_0x27fb7b[_0x06a0('0x187')]);if(!_0x257b4b||!_0x257b4b[_0x06a0('0x189')]){return this['channel']['error'](_0x27fb7b,_0x06a0('0x18a'));}var _0x1009b2={'from':util['format'](_0x06a0('0x18b'),_0x257b4b[_0x06a0('0x16')],_0x257b4b[_0x06a0('0x18c')]||_0x257b4b[_0x06a0('0x189')][_0x06a0('0x18d')]),'to':_0x27fb7b['to']||'','cc':_0x27fb7b['cc']||'','bcc':_0x27fb7b['bcc']||'','subject':_0x27fb7b[_0x06a0('0x18e')],'html':_0x27fb7b[_0x06a0('0x5b')],'text':_0x27fb7b['text']};if(this['isConfigured'](_0x27fb7b[_0x06a0('0x18f')])){}logger[_0x06a0('0x190')](_0x06a0('0x191'),JSON['stringify'](_0x1009b2));this[_0x06a0('0x35')]['sync'](this,_0x27fb7b,_0x27fb7b[_0x06a0('0x187')]);this[_0x06a0('0xf')]['noop'](util[_0x06a0('0x2a')](_0x06a0('0x192'),_0x257b4b[_0x06a0('0x16')]));this[_0x06a0('0x25')][_0x06a0('0xc4')](this,_0x257b4b[_0x06a0('0x193')],_0x1009b2);return this[_0x06a0('0xf')][_0x06a0('0xaa')](_0x06a0('0x194'));};AGIVertices[_0x06a0('0x12')]['sendFax']=function(_0x13ce30){logger[_0x06a0('0x2d')](util[_0x06a0('0x2a')](_0x06a0('0x195'),_0x13ce30[_0x06a0('0xa8')]));return this[_0x06a0('0xf')][_0x06a0('0xaa')](_0x06a0('0x196'));};AGIVertices['prototype'][_0x06a0('0x197')]=function(_0x5b459a){logger[_0x06a0('0x2d')](util['format'](_0x06a0('0x198'),_0x5b459a[_0x06a0('0xa8')]));if(!this[_0x06a0('0xa9')](_0x5b459a['sms_account_id'])){return this[_0x06a0('0xf')][_0x06a0('0xaa')](_0x06a0('0x199'));}var _0x2c984d=this[_0x06a0('0x32')]['sync'](this,_0x5b459a[_0x06a0('0x19a')]);if(!_0x2c984d){return this['channel'][_0x06a0('0x2c')](_0x5b459a,_0x06a0('0x19b'));}var _0x1e60ba={'body':_0x5b459a['sms_text'],'phone':_0x5b459a['to']||'','SmsAccountId':_0x2c984d['id']};logger['debug']('sendSMS\x20message',JSON['stringify'](_0x1e60ba));this['createSquareDetailsReport'][_0x06a0('0xc4')](this,_0x5b459a,_0x5b459a['sms_account_id']);this[_0x06a0('0xf')][_0x06a0('0xaa')](util[_0x06a0('0x2a')](_0x06a0('0x19c'),_0x2c984d[_0x06a0('0x16')]));this['createSmsMessage'][_0x06a0('0xc4')](this,_0x1e60ba);return this[_0x06a0('0xf')][_0x06a0('0xaa')](_0x06a0('0x19d'));};AGIVertices[_0x06a0('0x12')][_0x06a0('0x19e')]=function(_0x567d34){logger[_0x06a0('0x2d')](util['format'](_0x06a0('0x19f'),_0x567d34[_0x06a0('0xa8')]));if(!this[_0x06a0('0xa9')](_0x567d34[_0x06a0('0xd4')])){return this[_0x06a0('0xf')][_0x06a0('0x2c')](_0x567d34,_0x06a0('0x1a0'));}var _0x2d9465=this[_0x06a0('0x13')]['sync'](this,_0x567d34['variable_id']);if(!_0x2d9465){return this['channel'][_0x06a0('0x2c')](_0x567d34,_0x06a0('0xd6'));}return this[_0x06a0('0xf')][_0x06a0('0x9d')](_0x2d9465,_0x567d34[_0x06a0('0x1a1')]);};AGIVertices['prototype'][_0x06a0('0x1a2')]=function(_0x1b53df){logger[_0x06a0('0x2d')](util[_0x06a0('0x2a')](_0x06a0('0x1a3'),_0x1b53df['label']));this[_0x06a0('0xf')][_0x06a0('0xaa')]('START\x20CALLY\x20SQUARE');if(_0x1b53df[_0x06a0('0xbc')]===_0x06a0('0x1a4')){this['channel']['noop'](_0x06a0('0x1a5'));return this[_0x06a0('0xf')][_0x06a0('0xbc')]();}return this[_0x06a0('0xf')]['noop'](_0x06a0('0x1a6'));};AGIVertices[_0x06a0('0x12')][_0x06a0('0x1a7')]=function(_0x115e26){logger[_0x06a0('0x2d')](util[_0x06a0('0x2a')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x115e26[_0x06a0('0xa8')]));if(!this[_0x06a0('0xa9')](_0x115e26['project_id'])){return this['channel']['error'](_0x115e26,_0x06a0('0x1a8'));}var _0x5d2f31=this[_0x06a0('0x1a')][_0x06a0('0xc4')](this,_0x115e26[_0x06a0('0x1a9')]);if(!this[_0x06a0('0xa9')](_0x5d2f31)){return this[_0x06a0('0xf')]['error'](_0x115e26,util[_0x06a0('0x2a')](_0x06a0('0x1aa'),_0x115e26[_0x06a0('0x1a9')]));}if(_0x5d2f31===this[_0x06a0('0xf')]['arg_1']){return this[_0x06a0('0xf')][_0x06a0('0x2c')](_0x115e26,_0x06a0('0x1ab'));}this[_0x06a0('0x35')]['sync'](this,_0x115e26,_0x5d2f31);var _0x3edcc5=this[_0x06a0('0xf')][_0x06a0('0x55')]('AGI',util[_0x06a0('0x2a')](_0x06a0('0x1ac'),config[_0x06a0('0xb8')][_0x06a0('0x1ad')]||'127.0.0.1',_0x5d2f31,this[_0x06a0('0xf')][_0x06a0('0x3e')]));if(_0x3edcc5[_0x06a0('0xa2')]===-0x1){return _0x3edcc5;}return this[_0x06a0('0xf')]['noop'](util[_0x06a0('0x2a')]('Executed\x20command\x20%s\x20%s',_0x06a0('0x1ae'),_0x5d2f31));};AGIVertices['prototype'][_0x06a0('0x1af')]=function(_0x388803){logger[_0x06a0('0x2d')](util[_0x06a0('0x2a')](_0x06a0('0x1b0'),_0x388803[_0x06a0('0xa8')]));var _0x361dc7=this['shellCommand'][_0x06a0('0xc4')](this,_0x388803[_0x06a0('0xba')]);this[_0x06a0('0x35')][_0x06a0('0xc4')](this,_0x388803,_0x388803[_0x06a0('0xba')]);if(this[_0x06a0('0xa9')](_0x388803[_0x06a0('0xd4')])){var _0x3cb883=this['getVariable'][_0x06a0('0xc4')](this,_0x388803[_0x06a0('0xd4')]);if(_0x3cb883){this[_0x06a0('0xf')][_0x06a0('0x9d')](_0x3cb883,_0x361dc7);return this[_0x06a0('0xf')][_0x06a0('0xaa')](util[_0x06a0('0x2a')](_0x06a0('0x1b1'),_0x388803['command'],_0x3cb883));}}return this['channel'][_0x06a0('0xaa')](util[_0x06a0('0x2a')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x388803[_0x06a0('0xba')]));};AGIVertices[_0x06a0('0x12')][_0x06a0('0x1b2')]=function(_0x15a14d){logger['info'](util[_0x06a0('0x2a')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x15a14d[_0x06a0('0xa8')]));_0x15a14d[_0x06a0('0x5b')]=_0x15a14d[_0x06a0('0x5b')][_0x06a0('0x57')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x06a0('0xa9')](_0x15a14d[_0x06a0('0x59')])){return this[_0x06a0('0xf')][_0x06a0('0xaa')](_0x06a0('0x1b3'));}if(!this[_0x06a0('0xa9')](_0x15a14d[_0x06a0('0x5b')])){return this[_0x06a0('0xf')]['noop'](_0x06a0('0xab'));}this[_0x06a0('0xf')][_0x06a0('0xaa')](util[_0x06a0('0x2a')]('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x15a14d[_0x06a0('0x5b')]));var _0x4cf5f8=this[_0x06a0('0x58')][_0x06a0('0xc4')](this,_0x15a14d);if(_0x4cf5f8){this[_0x06a0('0xf')][_0x06a0('0xaa')](util[_0x06a0('0x2a')](_0x06a0('0x1b4'),_0x4cf5f8));var _0x50e628=this[_0x06a0('0xf')][_0x06a0('0x104')](_0x4cf5f8);try{fs[_0x06a0('0x106')](_0x4cf5f8+_0x06a0('0x107'));}catch(_0x23783f){logger['error'](_0x23783f);}return _0x50e628;}return this[_0x06a0('0xf')]['error'](_0x15a14d,_0x06a0('0x1b5'));};AGIVertices[_0x06a0('0x12')]['tts']=function(_0x4b1aaa){logger[_0x06a0('0x2d')](util[_0x06a0('0x2a')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x4b1aaa[_0x06a0('0xa8')]));_0x4b1aaa[_0x06a0('0x5b')]=_0x4b1aaa[_0x06a0('0x5b')][_0x06a0('0x57')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x06a0('0xa9')](_0x4b1aaa[_0x06a0('0x5b')])){return this['channel']['noop'](_0x06a0('0xab'));}this['channel'][_0x06a0('0xaa')](util['format'](_0x06a0('0x1b6'),_0x4b1aaa['text']));var _0x33bf8a=this[_0x06a0('0x5e')][_0x06a0('0xc4')](this,_0x4b1aaa);if(_0x33bf8a){this[_0x06a0('0xf')][_0x06a0('0xaa')](util[_0x06a0('0x2a')](_0x06a0('0x1b7'),_0x33bf8a));var _0x5d4d49=this[_0x06a0('0xf')][_0x06a0('0x104')](_0x33bf8a);try{fs[_0x06a0('0x106')](_0x33bf8a+_0x06a0('0x107'));}catch(_0x3bfecd){logger[_0x06a0('0x2c')](_0x3bfecd);}return _0x5d4d49;}return this[_0x06a0('0xf')][_0x06a0('0x2c')](_0x4b1aaa,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0x06a0('0x12')]['unpause']=function(_0x54c605){logger[_0x06a0('0x2d')](util[_0x06a0('0x2a')]('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x54c605[_0x06a0('0xa8')]));if(!this[_0x06a0('0xa9')](_0x54c605[_0x06a0('0x155')])){return this[_0x06a0('0xf')]['error'](_0x54c605,'no\x20find\x20by\x20configured');}logger[_0x06a0('0x2d')](util[_0x06a0('0x2a')](_0x06a0('0x15d'),this[_0x06a0('0xf')][_0x06a0('0x38')],_0x54c605[_0x06a0('0x155')]));var _0x294726=this[_0x06a0('0x4f')][_0x06a0('0xc4')](this,_0x54c605[_0x06a0('0x155')]);if(_0x294726){logger[_0x06a0('0x2d')](util[_0x06a0('0x2a')](_0x06a0('0x157'),this['channel'][_0x06a0('0x38')],_0x54c605[_0x06a0('0x155')]));this[_0x06a0('0xf')][_0x06a0('0xaa')](util['format'](_0x06a0('0x157'),this[_0x06a0('0xf')][_0x06a0('0x38')],_0x54c605[_0x06a0('0x155')]));return{'code':0xc8,'result':_0x06a0('0x158')};}else{logger['info'](util[_0x06a0('0x2a')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x06a0('0xf')][_0x06a0('0x38')],_0x54c605[_0x06a0('0x155')]));this[_0x06a0('0xf')][_0x06a0('0xaa')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x06a0('0xf')][_0x06a0('0x38')],_0x54c605['findBy']));return{'code':0xc8,'result':_0x06a0('0x15a')};}};AGIVertices['prototype']['voicemail']=function(_0x2c09fd){logger[_0x06a0('0x2d')](util[_0x06a0('0x2a')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x2c09fd[_0x06a0('0xa8')]));var _0x29869f=this[_0x06a0('0xf')][_0x06a0('0x55')](_0x06a0('0x1b8'),[_0x2c09fd[_0x06a0('0x1b9')],_0x2c09fd[_0x06a0('0x77')]]);if(_0x29869f[_0x06a0('0xa2')]===-0x1){return _0x29869f;}return this[_0x06a0('0xf')][_0x06a0('0xaa')](util[_0x06a0('0x2a')](_0x06a0('0xc7'),_0x06a0('0x1b8'),_0x2c09fd[_0x06a0('0x1b9')]));};AGIVertices[_0x06a0('0x12')][_0x06a0('0x1ba')]=function(_0x59c41d){logger[_0x06a0('0x2d')](util[_0x06a0('0x2a')](_0x06a0('0x1bb'),_0x59c41d[_0x06a0('0xa8')]));if(!this[_0x06a0('0xa9')](_0x59c41d[_0x06a0('0xd4')])){return this[_0x06a0('0xf')]['error'](_0x59c41d,'no\x20variable\x20selected');}var _0x1847f7=this[_0x06a0('0x13')][_0x06a0('0xc4')](this,_0x59c41d[_0x06a0('0xd4')]);if(!_0x1847f7){return this[_0x06a0('0xf')][_0x06a0('0x2c')](_0x59c41d,_0x06a0('0xd6'));}var _0x4e4976=this['channel']['getVariable'](_0x1847f7);return{'code':0xc8,'result':_0x4e4976['extra']?_0x4e4976[_0x06a0('0xa4')]:'-'};};String[_0x06a0('0x12')]['replaceAll']=function(_0x2ba5b2,_0x2bad5c){return this[_0x06a0('0x9f')](_0x2ba5b2)[_0x06a0('0x1bc')](_0x2bad5c);};module[_0x06a0('0x1bd')]=AGIVertices; \ No newline at end of file +var _0xeb3f=['no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','awsLex','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','%s/recordings/%s','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','wav','beep','tilde\x20%s\x20file\x20created','TildeASR\x20Result\x20%s','gotoc','extension','priority','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','getPause','pause_id','playback','PLAYBACK','opts','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','QUEUE','macro','position','record','%s_%s','RECORDING_SAVENAME','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','no\x20mail\x20account\x20configured','account_id','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','Smtp','user','template_id','Trying\x20SendMail\x20with\x20account\x20%s','sendMailMessage','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','no\x20sms\x20account\x20configured','getSmsAccount','sms_account_id','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Answer','Skipped\x20Answer','subproject','no\x20subproject\x20selected','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\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','googleCloudTTS','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','unpause','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','util','lodash','shelljs','odbc','randomstring','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','../../config/environment/shared','./scripts','/var/opt/motion2/server/files','rawHeaders','menu','getdigits','getsecretdigits','channel','rpc','mailRpc','getVariable','getVariableById','then','name','prototype','getVoiceQueue','catch','getSquareProject','getSquareOdbc','dsn','getUser','getUserById','getTrunk','getSound','getSoundById','getSoundPath','getMailAccount','getMailAccountById','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','callerid','createSquareRecording','calleridname','context','dnid','arg_1','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','list_id','callback','Callback\x20scheduled\x20at\x20','callback_priority','getPauseById','agentPause','agentUnpause','agent','agentLogout','agentLogin','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','replace','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','MALE','audioEncoding','MP3','googleTTS','restAPI','url','timeout','number','POST','PUT','method','toUpperCase','body','rawBody','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','computedVariables','sync','uri','render','stringify','statusMessage','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_polly_voice','Amy','aws_text_type','aws_secret_access_key','aws_lex_region','aws_bot_name','googleASR','tildeASR','appid','clear','includes','agicommand','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult','%s.%s','setVariable','split','replaceAll','extra','toString','result','maxRetry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','label','noop','no\x20text\x20configured','MRCPSynth','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','getAndSetVariable','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','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','scheduledAt','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','Executed\x20command\x20MRCPSynth\x20%s','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','no\x20database\x20selected','odbc_id','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','forEach','keys','%s[%s][%s]','variable\x20%s\x20set','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\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','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','password','no\x20password\x20configured','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','streamFile','unlink','.wav','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','response','maxdigit','test','no\x20variable\x20found','hiddendigitsnum','generate','first','substr','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xeb3f,0xa8));var _0xfeb3=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xeb3f[_0x19e35c];return _0x3e1fe8;};'use strict';var fs=require('fs');var util=require(_0xfeb3('0x0'));var _=require(_0xfeb3('0x1'));var sh=require(_0xfeb3('0x2'));var odbc=require(_0xfeb3('0x3'))();var rs=require(_0xfeb3('0x4'));var moment=require(_0xfeb3('0x5'));var Mustache=require(_0xfeb3('0x6'));var rp=require(_0xfeb3('0x7'));var logger=require(_0xfeb3('0x8'))(_0xfeb3('0x9'));var config=require(_0xfeb3('0xa'));var shared=require(_0xfeb3('0xb'));var scripts=require(_0xfeb3('0xc'));var FILES_PATH=_0xfeb3('0xd');var recursiveMapAttributes=[_0xfeb3('0xe'),'rawBody'];var verticesWithRetry=[_0xfeb3('0xf'),_0xfeb3('0x10'),_0xfeb3('0x11')];var AGIVertices=function(_0x379c8b,_0x4632bf,_0x2877c4){this[_0xfeb3('0x12')]=_0x379c8b;this[_0xfeb3('0x13')]=_0x4632bf;this[_0xfeb3('0x14')]=_0x2877c4;};AGIVertices['prototype'][_0xfeb3('0x15')]=function(_0x211b73,_0x438541){this[_0xfeb3('0x13')][_0xfeb3('0x16')](_0x211b73)[_0xfeb3('0x17')](function(_0x350416){_0x438541(null,_0x350416?_0x350416[_0xfeb3('0x18')]:![]);})['catch'](function(_0x33285d){_0x438541(_0x33285d);});};AGIVertices[_0xfeb3('0x19')][_0xfeb3('0x1a')]=function(_0x35f9b5,_0x491e52){this[_0xfeb3('0x13')]['getVoiceQueueById'](_0x35f9b5)[_0xfeb3('0x17')](function(_0x231a57){_0x491e52(null,_0x231a57?_0x231a57[_0xfeb3('0x18')]:![]);})[_0xfeb3('0x1b')](function(_0x1b6df3){_0x491e52(_0x1b6df3);});};AGIVertices['prototype'][_0xfeb3('0x1c')]=function(_0x363a9c,_0x3937f2){this['rpc']['getSquareProjectById'](_0x363a9c)['then'](function(_0x1465d4){_0x3937f2(null,_0x1465d4?_0x1465d4['name']:![]);})[_0xfeb3('0x1b')](function(_0x1fdb64){_0x3937f2(_0x1fdb64);});};AGIVertices[_0xfeb3('0x19')][_0xfeb3('0x1d')]=function(_0x573395,_0x338c37){this['rpc']['getSquareOdbcById'](_0x573395)['then'](function(_0x3c714b){_0x338c37(null,_0x3c714b?_0x3c714b[_0xfeb3('0x1e')]:![]);})[_0xfeb3('0x1b')](function(_0x4de2fe){_0x338c37(_0x4de2fe);});};AGIVertices[_0xfeb3('0x19')][_0xfeb3('0x1f')]=function(_0x421ccd,_0x43a21f){this[_0xfeb3('0x13')][_0xfeb3('0x20')](_0x421ccd)[_0xfeb3('0x17')](function(_0x115d14){_0x43a21f(null,_0x115d14?_0x115d14['name']:![]);})[_0xfeb3('0x1b')](function(_0x460a28){_0x43a21f(_0x460a28);});};AGIVertices[_0xfeb3('0x19')][_0xfeb3('0x21')]=function(_0x133e2a,_0x17b5f4){this[_0xfeb3('0x13')]['getTrunkById'](_0x133e2a)[_0xfeb3('0x17')](function(_0x5d6b65){_0x17b5f4(null,_0x5d6b65?_0x5d6b65[_0xfeb3('0x18')]:![]);})[_0xfeb3('0x1b')](function(_0x53192b){_0x17b5f4(_0x53192b);});};AGIVertices[_0xfeb3('0x19')][_0xfeb3('0x22')]=function(_0x3d31c2,_0x2a6df6){var _0x4a7478=this;this[_0xfeb3('0x13')][_0xfeb3('0x23')](_0x3d31c2)[_0xfeb3('0x17')](function(_0x4c3781){_0x2a6df6(null,_0x4c3781?_0x4a7478[_0xfeb3('0x24')](_0x4c3781['save_name']):![]);})[_0xfeb3('0x1b')](function(_0x342a91){_0x2a6df6(_0x342a91);});};AGIVertices[_0xfeb3('0x19')][_0xfeb3('0x25')]=function(_0x388987,_0x379384){this[_0xfeb3('0x13')][_0xfeb3('0x26')](_0x388987)[_0xfeb3('0x17')](function(_0x3582d8){_0x379384(null,_0x3582d8?_0x3582d8:![]);})[_0xfeb3('0x1b')](function(_0x25f6b3){_0x379384(_0x25f6b3);});};AGIVertices['prototype']['sendMailMessage']=function(_0x24452a,_0x31bbff,_0x2c77da){this[_0xfeb3('0x14')]['sendMailMessage'](_0x24452a,_0x31bbff)['then'](function(){_0x2c77da(null);})[_0xfeb3('0x1b')](function(_0x1430bb){_0x2c77da(_0x1430bb);});};AGIVertices[_0xfeb3('0x19')][_0xfeb3('0x27')]=function(_0x2fa449,_0x1cc943){this[_0xfeb3('0x13')][_0xfeb3('0x28')](_0x2fa449)[_0xfeb3('0x17')](function(_0xa0a33c){if(_0xa0a33c){if(_0xa0a33c[_0xfeb3('0x29')]){_0x1cc943(null,[_0xa0a33c[_0xfeb3('0x2a')]]);}else{_0x1cc943(null,_[_0xfeb3('0x2b')](_0xa0a33c[_0xfeb3('0x2c')],_0xfeb3('0x2a')));}}else{_0x1cc943(null,![]);}})[_0xfeb3('0x1b')](function(_0x2a6115){_0x1cc943(_0x2a6115);});};AGIVertices[_0xfeb3('0x19')]['getSoundPath']=function(_0x413bd4){return util[_0xfeb3('0x2d')](_0xfeb3('0x2e'),FILES_PATH,_0x413bd4);};AGIVertices[_0xfeb3('0x19')][_0xfeb3('0x2f')]=function(_0x3eb108,_0x504527,_0x5cec67){odbc[_0xfeb3('0x30')](_0x3eb108,function(_0x6d3617){if(_0x6d3617){logger[_0xfeb3('0x31')](_0xfeb3('0x32'),_0x6d3617);_0x5cec67(_0x6d3617);}else{logger[_0xfeb3('0x33')](_0xfeb3('0x34'));odbc[_0xfeb3('0x35')](_0x504527,function(_0x4f3d0a,_0x49ac31){if(_0x4f3d0a){logger['info'](_0xfeb3('0x36'),_0x504527);_0x5cec67(_0x4f3d0a);}else{logger['info'](_0xfeb3('0x37'),_0x504527);odbc[_0xfeb3('0x38')](function(_0xee3ef0){if(_0xee3ef0){logger[_0xfeb3('0x31')](_0xfeb3('0x39'),_0xee3ef0);}_0x5cec67(null,_0x49ac31);});}});}});};AGIVertices[_0xfeb3('0x19')]['getSmsAccount']=function(_0x3dc06a,_0x5dc530){this[_0xfeb3('0x13')][_0xfeb3('0x3a')](_0x3dc06a)[_0xfeb3('0x17')](function(_0x18fd2e){_0x5dc530(null,_0x18fd2e?_0x18fd2e:![]);})[_0xfeb3('0x1b')](function(_0x327b37){_0x5dc530(_0x327b37);});};AGIVertices[_0xfeb3('0x19')][_0xfeb3('0x3b')]=function(_0x34bf32,_0x196b03){this[_0xfeb3('0x13')]['createSmsMessage'](_0x34bf32)[_0xfeb3('0x17')](function(_0x468a15){_0x196b03(null,_0x468a15);})['catch'](function(_0x436ffa){_0x196b03(_0x436ffa);});};AGIVertices['prototype'][_0xfeb3('0x3c')]=function(_0x596772,_0x220cf8,_0x49b481){this[_0xfeb3('0x13')]['createSquareDetailsReport']({'uniqueid':this[_0xfeb3('0x12')][_0xfeb3('0x3d')],'node':_0x596772['label'],'application':_0x596772['agicommand'],'data':_0x220cf8||null,'project_name':this[_0xfeb3('0x12')]['arg_1'],'callerid':this[_0xfeb3('0x12')][_0xfeb3('0x3e')]})[_0xfeb3('0x17')](function(_0x2787e6){if(_0x49b481){_0x49b481(null,_0x2787e6);}})[_0xfeb3('0x1b')](function(_0x4f44cd){if(_0x49b481){_0x49b481(_0x4f44cd);}});};AGIVertices[_0xfeb3('0x19')][_0xfeb3('0x3f')]=function(_0x18683e,_0x96f5e6,_0x46f52b,_0xfb0cdc){this[_0xfeb3('0x13')]['createSquareRecording']({'uniqueid':this[_0xfeb3('0x12')]['uniqueid'],'callerid':this[_0xfeb3('0x12')]['callerid'],'calleridname':this[_0xfeb3('0x12')][_0xfeb3('0x40')],'context':this[_0xfeb3('0x12')][_0xfeb3('0x41')],'extension':this[_0xfeb3('0x12')]['extension'],'priority':this[_0xfeb3('0x12')]['priority'],'accountcode':this[_0xfeb3('0x12')]['accountcode'],'dnid':this[_0xfeb3('0x12')][_0xfeb3('0x42')],'projectName':this[_0xfeb3('0x12')][_0xfeb3('0x43')],'saveName':_0x96f5e6,'filename':_0x18683e['file']||_0x96f5e6,'savePath':_0x46f52b})[_0xfeb3('0x17')](function(_0x45ec71){_0xfb0cdc(null,_0x45ec71);})[_0xfeb3('0x1b')](function(_0x1fbead){_0xfb0cdc(_0x1fbead);});};AGIVertices[_0xfeb3('0x19')][_0xfeb3('0x44')]=function(_0x3d1ff9,_0xd4784c,_0x115378,_0x3393bb,_0x407632){this[_0xfeb3('0x13')]['createSquareMessage']({'uniqueid':this[_0xfeb3('0x12')][_0xfeb3('0x3d')],'body':_0x3d1ff9,'direction':_0xd4784c,'providerName':_0x115378,'providerResponse':_0x3393bb})[_0xfeb3('0x17')](function(_0x1cca40){if(_0x407632){_0x407632(null,_0x1cca40);}})[_0xfeb3('0x1b')](function(_0x81bc87){if(_0x407632){_0x407632(_0x81bc87);}});};AGIVertices[_0xfeb3('0x19')][_0xfeb3('0x45')]=function(_0x4e0562,_0x29b91e){this[_0xfeb3('0x13')]['createCmContact']({'firstName':_[_0xfeb3('0x46')](_0x4e0562['name'])||_[_0xfeb3('0x47')](_0x4e0562['name'])?_0xfeb3('0x48')+Math[_0xfeb3('0x49')]():_0x4e0562['name'],'lastName':_[_0xfeb3('0x46')](_0x4e0562[_0xfeb3('0x4a')])||_[_0xfeb3('0x47')](_0x4e0562[_0xfeb3('0x4a')])?null:_0x4e0562[_0xfeb3('0x4a')],'phone':_0x4e0562[_0xfeb3('0x4b')],'ListId':_0x4e0562[_0xfeb3('0x4c')],'scheduledat':_0x4e0562['scheduledAt'],'callbackUniqueid':this[_0xfeb3('0x12')][_0xfeb3('0x3d')],'tags':_0xfeb3('0x4d'),'description':_0xfeb3('0x4e')+_0x4e0562['scheduledAt']['toString'](),'priority':_0x4e0562[_0xfeb3('0x4f')]})[_0xfeb3('0x17')](function(_0x544d44){_0x29b91e(null,_0x544d44);})['catch'](function(_0x24f556){_0x29b91e(_0x24f556);});};AGIVertices[_0xfeb3('0x19')]['getPause']=function(_0x1af7c9,_0x5f3685){this[_0xfeb3('0x13')][_0xfeb3('0x50')](_0x1af7c9)['then'](function(_0x260008){_0x5f3685(null,_0x260008?_0x260008[_0xfeb3('0x18')]:![]);})[_0xfeb3('0x1b')](function(_0x4c8ac7){_0x5f3685(_0x4c8ac7);});};AGIVertices[_0xfeb3('0x19')][_0xfeb3('0x51')]=function(_0x28aed4,_0x1159f4,_0xee7a85){var _0x1c7929={'role':'agent'};_0x1c7929[_0x28aed4]=this[_0xfeb3('0x12')][_0xfeb3('0x3e')];this[_0xfeb3('0x13')][_0xfeb3('0x51')](_0x1c7929,_0x1159f4,this[_0xfeb3('0x12')]['uniqueid'])[_0xfeb3('0x17')](function(_0x1871f2){_0xee7a85(null,_[_0xfeb3('0x47')](_0x1871f2)?![]:!![]);})['catch'](function(_0x73745e){logger[_0xfeb3('0x31')](_0x73745e);_0xee7a85(null,![]);});};AGIVertices['prototype'][_0xfeb3('0x52')]=function(_0x43bd3a,_0x49eb34){var _0x4c4d24={'role':_0xfeb3('0x53')};_0x4c4d24[_0x43bd3a]=this[_0xfeb3('0x12')][_0xfeb3('0x3e')];this[_0xfeb3('0x13')][_0xfeb3('0x52')](_0x4c4d24)[_0xfeb3('0x17')](function(_0x5db14b){_0x49eb34(null,_[_0xfeb3('0x47')](_0x5db14b)?![]:!![]);})[_0xfeb3('0x1b')](function(_0x633140){logger[_0xfeb3('0x31')](_0x633140);_0x49eb34(null,![]);});};AGIVertices[_0xfeb3('0x19')]['agentLogout']=function(_0x9aef79,_0x1f09e7){var _0x1e5535={'role':'agent'};_0x1e5535[_0x9aef79]=this[_0xfeb3('0x12')]['callerid'];this['rpc'][_0xfeb3('0x54')](_0x1e5535)[_0xfeb3('0x17')](function(_0x41102e){_0x1f09e7(null,_[_0xfeb3('0x47')](_0x41102e)?![]:!![]);})[_0xfeb3('0x1b')](function(_0x14dd3c){logger[_0xfeb3('0x31')](_0x14dd3c);_0x1f09e7(null,![]);});};AGIVertices['prototype'][_0xfeb3('0x55')]=function(_0x527dfc,_0x38d173){var _0x159159={'role':'agent'};_0x159159[_0x527dfc]=this['channel'][_0xfeb3('0x3e')];var _0xdd3b42=_0x527dfc!='internal'?util['format'](_0xfeb3('0x56'),_0xfeb3('0x57'),this[_0xfeb3('0x12')][_0xfeb3('0x3e')]):undefined;this['rpc'][_0xfeb3('0x55')](_0x159159,_0xdd3b42)['then'](function(_0x460574){_0x38d173(null,_[_0xfeb3('0x47')](_0x460574)?![]:!![]);})[_0xfeb3('0x1b')](function(_0x222b4a){logger[_0xfeb3('0x31')](_0x222b4a);_0x38d173(null,![]);});};AGIVertices['prototype'][_0xfeb3('0x58')]=function(_0x472c2e,_0x13ee06){sh[_0xfeb3('0x59')](_[_0xfeb3('0x5a')](_0x472c2e),function(_0x1f89a9,_0x35e9a9){var _0x4de0a3=_0x35e9a9[_0xfeb3('0x5b')](/(\r\n|\n|\r)/gm,'');_0x13ee06(null,_0x4de0a3);});};AGIVertices['prototype']['googleCloudTTS']=function(_0x5ebe28,_0x5b9372){scripts['googleCloudTTS'](_0x5ebe28[_0xfeb3('0x5c')],_0x5ebe28[_0xfeb3('0x5d')]||_0xfeb3('0x5e'),_0x5ebe28[_0xfeb3('0x5e')],_0x5ebe28[_0xfeb3('0x5f')]||_0xfeb3('0x60'),_0x5ebe28['ssmlGender']||_0xfeb3('0x61'),_0x5ebe28[_0xfeb3('0x62')]||_0xfeb3('0x63'))[_0xfeb3('0x17')](function(_0x9e305c){_0x5b9372(null,_0x9e305c);})[_0xfeb3('0x1b')](function(_0x2f70d0){_0x5b9372(_0x2f70d0);});};AGIVertices[_0xfeb3('0x19')]['googleTTS']=function(_0x59ff2f,_0x1e75de){scripts[_0xfeb3('0x64')](_0x59ff2f[_0xfeb3('0x5e')],_0x59ff2f['google_tts_language']||'en',0x1)[_0xfeb3('0x17')](function(_0x56eeac){_0x1e75de(null,_0x56eeac);})[_0xfeb3('0x1b')](function(_0x5194e5){_0x1e75de(_0x5194e5);});};AGIVertices[_0xfeb3('0x19')][_0xfeb3('0x65')]=function(_0x491eb1,_0x168c41){var _0x20309d={'uri':_0x491eb1[_0xfeb3('0x66')],'method':_0x491eb1['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x491eb1[_0xfeb3('0x67')])===_0xfeb3('0x68')&&parseInt(_0x491eb1['timeout'])>=0x1?parseInt(_0x491eb1[_0xfeb3('0x67')])*0x3e8:0x5*0x3e8};if(_['includes']([_0xfeb3('0x69'),_0xfeb3('0x6a')],_0x20309d[_0xfeb3('0x6b')][_0xfeb3('0x6c')]())){try{_0x20309d[_0xfeb3('0x6d')]=_0x491eb1[_0xfeb3('0x6e')]?JSON[_0xfeb3('0x6f')](_0x491eb1[_0xfeb3('0x6e')]):{};}catch(_0x4bd241){logger['error'](_0xfeb3('0x70'),_0x4bd241);}}try{_0x20309d[_0xfeb3('0x71')]=_0x491eb1[_0xfeb3('0xe')]?JSON['parse'](_0x491eb1[_0xfeb3('0xe')]):{};}catch(_0x351737){logger['error']('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x351737);}if(_0x491eb1[_0xfeb3('0x72')]){try{var _0x5445a0=require(_0x491eb1[_0xfeb3('0x72')])[_0xfeb3('0x73')](this,_0x20309d);_0x20309d[_0xfeb3('0x74')]=Mustache[_0xfeb3('0x75')](_0x491eb1[_0xfeb3('0x66')],_0x5445a0,{},['$$','$$']);if(_0x20309d[_0xfeb3('0x71')]){_0x20309d[_0xfeb3('0x71')]=JSON[_0xfeb3('0x6f')](Mustache[_0xfeb3('0x75')](JSON[_0xfeb3('0x76')](_0x20309d[_0xfeb3('0x71')]),_0x5445a0,{},['$$','$$']));}if(_0x20309d[_0xfeb3('0x6d')]){_0x20309d[_0xfeb3('0x6d')]=JSON[_0xfeb3('0x6f')](Mustache['render'](JSON['stringify'](_0x20309d[_0xfeb3('0x6d')]),_0x5445a0,{},['$$','$$']));}}catch(_0x52ad0b){logger[_0xfeb3('0x31')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x52ad0b);}}rp(_0x20309d)[_0xfeb3('0x17')](function(_0x6d4cb4){var _0x286dae={'statusCode':_0x6d4cb4['statusCode']||0xc8,'statusMessage':_0x6d4cb4[_0xfeb3('0x77')]||'OK','headers':_0x6d4cb4['headers']||{},'body':_0x6d4cb4[_0xfeb3('0x6d')]||{}};_0x168c41(null,_0x286dae);})['catch'](function(_0x1dc069){var _0x25b2db={'statusCode':_0x1dc069[_0xfeb3('0x78')]||0x1f4,'statusMessage':_0x1dc069[_0xfeb3('0x79')]||_0xfeb3('0x7a'),'headers':_0x1dc069[_0xfeb3('0x7b')][_0xfeb3('0x71')]||{},'body':_0x1dc069[_0xfeb3('0x7b')][_0xfeb3('0x6d')]||{}};_0x168c41(null,_0x25b2db);});};AGIVertices[_0xfeb3('0x19')]['googleDialogflow']=function(_0x356c5c,_0x56a184){scripts[_0xfeb3('0x7c')](this[_0xfeb3('0x12')][_0xfeb3('0x3d')],_0x356c5c[_0xfeb3('0x7d')],_0x356c5c[_0xfeb3('0x5e')],_0x356c5c[_0xfeb3('0x7e')]||'en')[_0xfeb3('0x17')](function(_0x7e9e8a){_0x56a184(null,_0x7e9e8a);})[_0xfeb3('0x1b')](function(_0x5b4583){_0x56a184(_0x5b4583);});};AGIVertices[_0xfeb3('0x19')][_0xfeb3('0x7f')]=function(_0x5af0b6,_0x1666f5){scripts[_0xfeb3('0x7f')](this[_0xfeb3('0x12')][_0xfeb3('0x3d')],_0x5af0b6[_0xfeb3('0x80')],_0x5af0b6[_0xfeb3('0x81')],_0x5af0b6[_0xfeb3('0x82')],_0x5af0b6[_0xfeb3('0x5e')],_0x5af0b6[_0xfeb3('0x83')]||'en')[_0xfeb3('0x17')](function(_0x45b942){_0x1666f5(null,_0x45b942);})[_0xfeb3('0x1b')](function(_0x412c2b){_0x1666f5(_0x412c2b);});};AGIVertices[_0xfeb3('0x19')][_0xfeb3('0x84')]=function(_0x4c56f8,_0x58a4e5){scripts[_0xfeb3('0x84')](this['channel'],_0x4c56f8)[_0xfeb3('0x17')](function(_0x41306f){_0x58a4e5(null,_0x41306f);})[_0xfeb3('0x1b')](function(_0x535f3e){_0x58a4e5(_0x535f3e);});};AGIVertices[_0xfeb3('0x19')][_0xfeb3('0x85')]=function(_0x2cabf4,_0x3f0c6c){scripts['ispeechTTS'](_0x2cabf4['key'],_0x2cabf4[_0xfeb3('0x5e')],_0x2cabf4[_0xfeb3('0x86')]||_0xfeb3('0x60'),_0x2cabf4['speed'])['then'](function(_0x370c64){_0x3f0c6c(null,_0x370c64);})[_0xfeb3('0x1b')](function(_0x4ef43e){_0x3f0c6c(_0x4ef43e);});};AGIVertices['prototype'][_0xfeb3('0x87')]=function(_0x2fb4bb,_0x4f3620,_0xbb5e74){scripts[_0xfeb3('0x87')](_0x4f3620,_0x2fb4bb[_0xfeb3('0x7d')],_0x2fb4bb[_0xfeb3('0x88')]||_0xfeb3('0x60'),this[_0xfeb3('0x89')](_0x2fb4bb[_0xfeb3('0x8a')])?_0x2fb4bb[_0xfeb3('0x8a')]:undefined)[_0xfeb3('0x17')](function(_0x221bad){_0xbb5e74(null,_0x221bad);})['catch'](function(_0x55150a){_0xbb5e74(_0x55150a);});};AGIVertices[_0xfeb3('0x19')][_0xfeb3('0x8b')]=function(_0x1b8600,_0x370534){scripts['awsPolly'](_0x1b8600[_0xfeb3('0x8c')],_0x1b8600['aws_secret_access_key'],_0x1b8600['aws_polly_region'],_0x1b8600[_0xfeb3('0x8d')]||_0xfeb3('0x8e'),_0x1b8600[_0xfeb3('0x5e')],_0x1b8600[_0xfeb3('0x8f')]||_0xfeb3('0x5e'))[_0xfeb3('0x17')](function(_0x4bedc7){_0x370534(null,_0x4bedc7);})['catch'](function(_0x48c4c9){_0x370534(_0x48c4c9);});};AGIVertices['prototype']['awsLex']=function(_0x405670,_0x7b1096){scripts['awsLex'](this[_0xfeb3('0x12')]['uniqueid'],_0x405670['aws_access_key_id'],_0x405670[_0xfeb3('0x90')],_0x405670[_0xfeb3('0x91')],_0x405670['text'],_0x405670[_0xfeb3('0x92')])[_0xfeb3('0x17')](function(_0x81c171){_0x7b1096(null,_0x81c171);})[_0xfeb3('0x1b')](function(_0x4f4f29){_0x7b1096(_0x4f4f29);});};AGIVertices['prototype']['googleASR']=function(_0x458727,_0x592646,_0x158357){scripts[_0xfeb3('0x93')](_0x592646,_0x458727['key'],_0x458727['google_asr_language']||'en-US')[_0xfeb3('0x17')](function(_0x491ae3){_0x158357(null,_0x491ae3);})[_0xfeb3('0x1b')](function(_0x5f44ea){_0x158357(_0x5f44ea);});};AGIVertices[_0xfeb3('0x19')][_0xfeb3('0x94')]=function(_0x51c472,_0x5d3c3a,_0x3ee02b){scripts[_0xfeb3('0x94')](_0x5d3c3a,_0x51c472[_0xfeb3('0x95')],_0x51c472['appsecret'],_0x51c472[_0xfeb3('0x74')])[_0xfeb3('0x17')](function(_0x50c896){_0x3ee02b(null,_0x50c896);})['catch'](function(_0x4bb43d){_0x3ee02b(_0x4bb43d);});};AGIVertices[_0xfeb3('0x19')][_0xfeb3('0x96')]=function(_0x576596){var _0x3f0b23=_[_0xfeb3('0x97')](verticesWithRetry,_0x576596[_0xfeb3('0x98')])?_0x576596:_[_0xfeb3('0x99')](_0x576596);for(var _0x3f0b36 in _0x3f0b23){if(_0x3f0b23[_0xfeb3('0x9a')](_0x3f0b36)){if(_0x3f0b23[_0x3f0b36]&&_[_0xfeb3('0x9b')](_0x3f0b23[_0x3f0b36])){if(_[_0xfeb3('0x97')](recursiveMapAttributes,_0x3f0b36)){_0x3f0b23[_0x3f0b36]=this[_0xfeb3('0x9c')](_0x3f0b23[_0x3f0b36]);}else{_0x3f0b23[_0x3f0b36]=this[_0xfeb3('0x9d')](_0x3f0b23[_0x3f0b36]);}}}}return _0x3f0b23;};AGIVertices['prototype'][_0xfeb3('0x9e')]=function(_0x9cde74){for(var _0x6ca796 in _0x9cde74){if(_0x9cde74[_0xfeb3('0x9a')](_0x6ca796)){if(_[_0xfeb3('0x9f')](_0x9cde74[_0x6ca796])){this[_0xfeb3('0x9e')](_0x9cde74[_0x6ca796]);}else if(_[_0xfeb3('0xa0')](_0x9cde74[_0x6ca796])){for(var _0x473994=0x0;_0x473994<_0x9cde74[_0x6ca796][_0xfeb3('0xa1')];_0x473994++){this[_0xfeb3('0x9e')](_0x9cde74[_0x6ca796][_0x473994]);}}else if(_[_0xfeb3('0x9b')](_0x9cde74[_0x6ca796])){_0x9cde74[_0x6ca796]=this['replaceAllVariables'](_0x9cde74[_0x6ca796]);}}}};AGIVertices[_0xfeb3('0x19')][_0xfeb3('0xa2')]=function(_0x6ca523,_0xce0310){for(var _0x446393 in _0x6ca523){if(_0x6ca523[_0xfeb3('0x9a')](_0x446393)){if(_[_0xfeb3('0x9f')](_0x6ca523[_0x446393])){if(!_[_0xfeb3('0x46')](_0x6ca523[_0x446393])){this['saveRestApiResult'](_0x6ca523[_0x446393],util[_0xfeb3('0x2d')](_0xfeb3('0xa3'),_0xce0310,_0x446393));}}else if(_[_0xfeb3('0xa0')](_0x6ca523[_0x446393])){for(var _0x1233c4=0x0;_0x1233c4<_0x6ca523[_0x446393]['length'];_0x1233c4++){this[_0xfeb3('0xa2')](_0x6ca523[_0x446393][_0x1233c4],util[_0xfeb3('0x2d')](_0xfeb3('0xa3'),_0xce0310,_0x446393+'['+_0x1233c4+']'));}}else{if(!_['isNil'](_0x6ca523[_0x446393])){this[_0xfeb3('0x12')][_0xfeb3('0xa4')](util['format']('%s.%s',_0xce0310,_0x446393),_0x6ca523[_0x446393]);}}}}};AGIVertices[_0xfeb3('0x19')]['replaceObjectAllVariables']=function(_0x45d480){try{var _0x44906b=JSON[_0xfeb3('0x6f')](_0x45d480);this[_0xfeb3('0x9e')](_0x44906b);return JSON[_0xfeb3('0x76')](_0x44906b);}catch(_0x55948f){return this[_0xfeb3('0x9d')](_0x45d480);}};AGIVertices[_0xfeb3('0x19')][_0xfeb3('0x9d')]=function(_0x403183){var _0x3e10ce=_0x403183[_0xfeb3('0xa5')]('{');for(var _0x51016e=0x1;_0x51016e<_0x3e10ce[_0xfeb3('0xa1')];_0x51016e+=0x1){var _0x6a680f=_0x3e10ce[_0x51016e]['split']('}');if(_0x6a680f[_0xfeb3('0xa1')]>0x1){_0x403183=_0x403183[_0xfeb3('0xa6')]('{'+_0x6a680f[0x0]+'}',this[_0xfeb3('0x12')][_0xfeb3('0x15')](_0x6a680f[0x0])[_0xfeb3('0xa7')]||_0x6a680f[0x0]);}}if(_0x3e10ce[_0xfeb3('0xa1')]===0x1){return _0x403183[_0xfeb3('0xa8')]();}return this['replaceAllVariables'](_0x403183);};AGIVertices[_0xfeb3('0x19')]['getAndSetVariable']=function(_0xb906ed,_0x1d61b7){var _0x275f14=this['channel'][_0xfeb3('0x15')](_0xb906ed);if(_0x275f14[_0xfeb3('0xa9')]===-0x1){return _0x275f14;}logger[_0xfeb3('0x33')](util['format']('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x1d61b7,_0x275f14[_0xfeb3('0xa7')]));return this['channel']['setVariable'](_0x1d61b7,_0x275f14[_0xfeb3('0xa7')]);};AGIVertices[_0xfeb3('0x19')][_0xfeb3('0x89')]=function(_0x4a4e8a){return _0x4a4e8a&&_0x4a4e8a!=='0'&&_0x4a4e8a!=='-1'&&_0x4a4e8a!=='';};AGIVertices['prototype']['maxRetry']=function(_0x45bc83){this['createSquareDetailsReport'][_0xfeb3('0x73')](this,_0x45bc83,'-');_0x45bc83['retry']=_0x45bc83[_0xfeb3('0xaa')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xfeb3('0x19')]['mrcpsynth']=function(_0x484b48){logger[_0xfeb3('0x33')](util[_0xfeb3('0x2d')](_0xfeb3('0xab'),_0x484b48[_0xfeb3('0xac')]));if(!this['isConfigured'](_0x484b48[_0xfeb3('0x5e')])){return this[_0xfeb3('0x12')][_0xfeb3('0xad')](_0xfeb3('0xae'));}var _0x5606ef='\x22'+_0x484b48['text']+'\x22';if(this[_0xfeb3('0x89')](_0x484b48['options'])){_0x5606ef+=','+_0x484b48[_0xfeb3('0x7b')];}var _0xdb217a=this[_0xfeb3('0x12')][_0xfeb3('0x59')](_0xfeb3('0xaf'),_0x5606ef);if(_0xdb217a[_0xfeb3('0xa9')]===-0x1){return _0xdb217a;}return this[_0xfeb3('0x12')][_0xfeb3('0xad')](util[_0xfeb3('0x2d')]('Executed\x20command\x20MRCPSynth\x20%s',_0x5606ef));};AGIVertices['prototype'][_0xfeb3('0xb0')]=function(_0x1d08f9){logger[_0xfeb3('0x33')](util['format'](_0xfeb3('0xb1'),_0x1d08f9['label']));if(!this[_0xfeb3('0x89')](_0x1d08f9[_0xfeb3('0xb2')])){return this[_0xfeb3('0x12')][_0xfeb3('0xad')](_0xfeb3('0xb3'));}var _0x31424d=_0x1d08f9[_0xfeb3('0xb2')];if(this[_0xfeb3('0x89')](_0x1d08f9[_0xfeb3('0x7b')])){_0x31424d+=','+_0x1d08f9[_0xfeb3('0x7b')];}var _0x3be1ae=this[_0xfeb3('0x12')][_0xfeb3('0x59')](_0xfeb3('0xb4'),_0x31424d);if(_0x3be1ae[_0xfeb3('0xa9')]===-0x1){return _0x3be1ae;}var _0x1d2eb5=this['getAndSetVariable'](_0xfeb3('0xb5'),_0xfeb3('0xb6'));if(_0x1d2eb5[_0xfeb3('0xa9')]===-0x1){return _0x1d2eb5;}var _0x1bca34=this[_0xfeb3('0xb7')](_0xfeb3('0xb8'),_0xfeb3('0xb9'));if(_0x1bca34['result']===-0x1){return _0x1bca34;}var _0x1245b6=this[_0xfeb3('0xb7')](_0xfeb3('0xba'),_0xfeb3('0xbb'));if(_0x1245b6[_0xfeb3('0xa9')]===-0x1){return _0x1245b6;}return this[_0xfeb3('0x12')]['noop'](util[_0xfeb3('0x2d')](_0xfeb3('0xbc'),_0x31424d));};AGIVertices[_0xfeb3('0x19')][_0xfeb3('0x9')]=function(_0x5c07f7){logger[_0xfeb3('0x33')](util[_0xfeb3('0x2d')](_0xfeb3('0xbd'),_0x5c07f7['label']));return this[_0xfeb3('0x12')]['agi']([_0x5c07f7[_0xfeb3('0xbe')],_0x5c07f7['args']]);};AGIVertices[_0xfeb3('0x19')][_0xfeb3('0xbf')]=function(_0x3c814c){logger[_0xfeb3('0x33')](util[_0xfeb3('0x2d')](_0xfeb3('0xc0'),_0x3c814c[_0xfeb3('0xac')]));if(this[_0xfeb3('0x89')](_0x3c814c[_0xfeb3('0x67')])){logger[_0xfeb3('0x33')](util[_0xfeb3('0x2d')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x3c814c[_0xfeb3('0x67')]));var _0x39830b=this[_0xfeb3('0x12')][_0xfeb3('0xc1')](_0x3c814c[_0xfeb3('0x67')]);if(_0x39830b[_0xfeb3('0xa9')]===-0x1){return _0x39830b;}}return this[_0xfeb3('0x12')][_0xfeb3('0xbf')]();};AGIVertices[_0xfeb3('0x19')][_0xfeb3('0x4d')]=function(_0x36cb0f){logger[_0xfeb3('0x33')](util[_0xfeb3('0x2d')](_0xfeb3('0xc2'),_0x36cb0f[_0xfeb3('0xac')]));if(!this[_0xfeb3('0x89')](_0x36cb0f[_0xfeb3('0x4c')])){return this['channel'][_0xfeb3('0x31')](_0x36cb0f,_0xfeb3('0xc3'));}_0x36cb0f['scheduledAt']=moment();if(this['isConfigured'](_0x36cb0f[_0xfeb3('0xc4')])){_0x36cb0f['scheduledAt']=moment()[_0xfeb3('0xc5')](_0x36cb0f[_0xfeb3('0xc4')],'minutes');}if(!this[_0xfeb3('0x89')](_0x36cb0f[_0xfeb3('0x4f')])){_0x36cb0f[_0xfeb3('0x4f')]=0x2;}this[_0xfeb3('0x45')][_0xfeb3('0x73')](this,_0x36cb0f);return this[_0xfeb3('0x12')]['noop'](util[_0xfeb3('0x2d')](_0xfeb3('0xc6'),_0x36cb0f['phone'],_0x36cb0f[_0xfeb3('0x4c')],_0x36cb0f[_0xfeb3('0xc7')]));};AGIVertices[_0xfeb3('0x19')][_0xfeb3('0xc8')]=function(_0x5db7f3){logger[_0xfeb3('0x33')](util[_0xfeb3('0x2d')](_0xfeb3('0xc9'),_0x5db7f3[_0xfeb3('0xac')]));var _0x26da28=this['channel']['exec'](_0x5db7f3[_0xfeb3('0xca')],_0x5db7f3['options']);if(_0x26da28[_0xfeb3('0xa9')]===-0x1){return _0x26da28;}return this[_0xfeb3('0x12')][_0xfeb3('0xad')](util['format'](_0xfeb3('0xcb'),_0x5db7f3[_0xfeb3('0xca')],_0x5db7f3[_0xfeb3('0x7b')]));};AGIVertices['prototype'][_0xfeb3('0xcc')]=function(_0x5c3680){logger[_0xfeb3('0x33')](util[_0xfeb3('0x2d')](_0xfeb3('0xcd'),_0x5c3680[_0xfeb3('0xac')]));if(!this['isConfigured'](_0x5c3680[_0xfeb3('0x5e')])){return this['channel']['noop']('no\x20text\x20configured');}var _0x471a5e='\x22'+_0x5c3680[_0xfeb3('0x5e')]+'\x22';if(this['isConfigured'](_0x5c3680[_0xfeb3('0x7b')])){_0x471a5e+=','+_0x5c3680['options'];}var _0x3320a4=this[_0xfeb3('0x12')][_0xfeb3('0x59')](_0xfeb3('0xaf'),_0x471a5e);if(_0x3320a4[_0xfeb3('0xa9')]===-0x1){return _0x3320a4;}return this[_0xfeb3('0x12')][_0xfeb3('0xad')](util[_0xfeb3('0x2d')](_0xfeb3('0xce'),_0x471a5e));};AGIVertices[_0xfeb3('0x19')][_0xfeb3('0xcf')]=function(_0x1f96eb){logger[_0xfeb3('0x33')](util[_0xfeb3('0x2d')](_0xfeb3('0xd0'),_0x1f96eb['label']));if(!this['isConfigured'](_0x1f96eb[_0xfeb3('0x5e')])){return this[_0xfeb3('0x12')][_0xfeb3('0xad')](_0xfeb3('0xae'));}var _0xe0ff03='\x22'+_0x1f96eb[_0xfeb3('0x5e')]+'\x22';if(this[_0xfeb3('0x89')](_0x1f96eb[_0xfeb3('0x7b')])){_0xe0ff03+=','+_0x1f96eb[_0xfeb3('0x7b')];}var _0x38720b=this['channel'][_0xfeb3('0x59')](_0xfeb3('0xaf'),_0xe0ff03);if(_0x38720b[_0xfeb3('0xa9')]===-0x1){return _0x38720b;}return this[_0xfeb3('0x12')][_0xfeb3('0xad')](util[_0xfeb3('0x2d')](_0xfeb3('0xce'),_0xe0ff03));};AGIVertices[_0xfeb3('0x19')][_0xfeb3('0xd1')]=function(_0x409966){logger['info'](util[_0xfeb3('0x2d')](_0xfeb3('0xd2'),_0x409966[_0xfeb3('0xac')]));if(!this['isConfigured'](_0x409966[_0xfeb3('0xb2')])){return this[_0xfeb3('0x12')]['noop'](_0xfeb3('0xb3'));}var _0x240da1=_0x409966[_0xfeb3('0xb2')];if(this['isConfigured'](_0x409966[_0xfeb3('0x7b')])){_0x240da1+=','+_0x409966['options'];}var _0x4404eb=this['channel']['exec'](_0xfeb3('0xb4'),_0x240da1);if(_0x4404eb['result']===-0x1){return _0x4404eb;}var _0x32ecd9=this['getAndSetVariable'](_0xfeb3('0xb5'),_0xfeb3('0xd3'));if(_0x32ecd9[_0xfeb3('0xa9')]===-0x1){return _0x32ecd9;}var _0x221be0=this['getAndSetVariable'](_0xfeb3('0xb8'),_0xfeb3('0xd4'));if(_0x221be0['result']===-0x1){return _0x221be0;}var _0x14030a=this[_0xfeb3('0xb7')](_0xfeb3('0xba'),'LUMENVOX_ASR_INSTANCE');if(_0x14030a[_0xfeb3('0xa9')]===-0x1){return _0x14030a;}return this['channel']['noop'](util[_0xfeb3('0x2d')](_0xfeb3('0xbc'),_0x240da1));};AGIVertices['prototype']['sestekasr']=function(_0x2dbb51){logger['info'](util[_0xfeb3('0x2d')](_0xfeb3('0xd5'),_0x2dbb51['label']));if(!this[_0xfeb3('0x89')](_0x2dbb51[_0xfeb3('0xb2')])){return this[_0xfeb3('0x12')][_0xfeb3('0xad')](_0xfeb3('0xb3'));}var _0x5e24cb=_0x2dbb51[_0xfeb3('0xb2')];if(this[_0xfeb3('0x89')](_0x2dbb51[_0xfeb3('0x7b')])){_0x5e24cb+=','+_0x2dbb51['options'];}var _0x4e4d7e=this['channel'][_0xfeb3('0x59')](_0xfeb3('0xb4'),_0x5e24cb);if(_0x4e4d7e[_0xfeb3('0xa9')]===-0x1){return _0x4e4d7e;}var _0x433d01=this[_0xfeb3('0xb7')](_0xfeb3('0xb5'),_0xfeb3('0xd6'));if(_0x433d01[_0xfeb3('0xa9')]===-0x1){return _0x433d01;}var _0x5179a6=this[_0xfeb3('0xb7')](_0xfeb3('0xb8'),_0xfeb3('0xd7'));if(_0x5179a6[_0xfeb3('0xa9')]===-0x1){return _0x5179a6;}var _0x1666b3=this[_0xfeb3('0xb7')]('RECOG_INSTANCE()','SESTEK_ASR_INSTANCE');if(_0x1666b3[_0xfeb3('0xa9')]===-0x1){return _0x1666b3;}return this[_0xfeb3('0x12')][_0xfeb3('0xad')](util[_0xfeb3('0x2d')](_0xfeb3('0xbc'),_0x5e24cb));};AGIVertices[_0xfeb3('0x19')]['database']=function(_0x3b31cd){logger[_0xfeb3('0x33')](util['format']('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x3b31cd[_0xfeb3('0xac')]));if(!this['isConfigured'](_0x3b31cd['odbc_id'])){return this[_0xfeb3('0x12')][_0xfeb3('0x31')](_0x3b31cd,_0xfeb3('0xd8'));}var _0x317095=this[_0xfeb3('0x1d')]['sync'](this,_0x3b31cd[_0xfeb3('0xd9')]);if(!_0x317095){return this['channel'][_0xfeb3('0x31')](_0x3b31cd,_0xfeb3('0xda'));}if(!this['isConfigured'](_0x3b31cd[_0xfeb3('0x35')])){return this[_0xfeb3('0x12')]['error'](_0x3b31cd,_0xfeb3('0xdb'));}var _0x3a0b5a=_0x3b31cd[_0xfeb3('0x35')][_0xfeb3('0x5b')](/(\r\n|\n|\r)/gm,'\x20');this[_0xfeb3('0x12')][_0xfeb3('0xad')](util[_0xfeb3('0x2d')](_0xfeb3('0xdc'),_0x3a0b5a));var _0x1979f2=this[_0xfeb3('0x2f')][_0xfeb3('0x73')](this,_0x317095,_0x3a0b5a);this[_0xfeb3('0x3c')]['sync'](this,_0x3b31cd,_0x3a0b5a);if(!this[_0xfeb3('0x89')](_0x3b31cd[_0xfeb3('0xdd')])){return this[_0xfeb3('0x12')][_0xfeb3('0xad')](_0xfeb3('0xde'));}var _0x5d6c77=this[_0xfeb3('0x15')][_0xfeb3('0x73')](this,_0x3b31cd[_0xfeb3('0xdd')]);if(!_0x5d6c77){return this[_0xfeb3('0x12')][_0xfeb3('0x31')](_0x3b31cd,'no\x20variable\x20found');}var _0x3c47ec=this;_0x1979f2[_0xfeb3('0xdf')](function(_0x2f1b8b,_0x32a0c5){Object[_0xfeb3('0xe0')](_0x2f1b8b)[_0xfeb3('0xdf')](function(_0x20d6ba){_0x3c47ec[_0xfeb3('0x12')][_0xfeb3('0xa4')](util['format'](_0xfeb3('0xe1'),_0x5d6c77,_0x32a0c5,_0x20d6ba),_0x2f1b8b[_0x20d6ba]);});});this[_0xfeb3('0x12')][_0xfeb3('0xa4')](util['format']('%s_ROWS_COUNT',_0x5d6c77),_0x1979f2[_0xfeb3('0xa1')]);return this[_0xfeb3('0x12')][_0xfeb3('0xad')](util[_0xfeb3('0x2d')](_0xfeb3('0xe2'),_0x5d6c77));};AGIVertices[_0xfeb3('0x19')]['dial']=function(_0x3bae6a){logger[_0xfeb3('0xe3')](util['format'](_0xfeb3('0xe4'),_0x3bae6a[_0xfeb3('0xac')]));if(!this['isConfigured'](_0x3bae6a[_0xfeb3('0xe5')])){return this['channel'][_0xfeb3('0x31')](_0x3bae6a,_0xfeb3('0xe6'));}var _0x54e040=this[_0xfeb3('0x1f')][_0xfeb3('0x73')](this,_0x3bae6a[_0xfeb3('0xe5')]);if(!_0x54e040){return this[_0xfeb3('0x12')][_0xfeb3('0x31')](_0x3bae6a,_0xfeb3('0xe7'));}var _0x2867ce=this[_0xfeb3('0x12')][_0xfeb3('0x59')](_0xfeb3('0xe8'),[util['format'](_0xfeb3('0xe9'),_0x54e040),_0x3bae6a['timeout'],_0x3bae6a['opts'],_0x3bae6a[_0xfeb3('0x66')]]);if(_0x2867ce[_0xfeb3('0xa9')]===-0x1){return _0x2867ce;}return this[_0xfeb3('0x12')][_0xfeb3('0xad')](util[_0xfeb3('0x2d')]('Executed\x20command\x20%s',_0xfeb3('0xe8')));};AGIVertices['prototype'][_0xfeb3('0xea')]=function(_0x3ab560){logger[_0xfeb3('0x33')](util[_0xfeb3('0x2d')](_0xfeb3('0xeb'),_0x3ab560[_0xfeb3('0xac')]));if(!this['isConfigured'](_0x3ab560[_0xfeb3('0x7d')])){return this[_0xfeb3('0x12')][_0xfeb3('0xad')](_0xfeb3('0xec'));}if(!this[_0xfeb3('0x89')](_0x3ab560[_0xfeb3('0x5e')])){return this[_0xfeb3('0x12')][_0xfeb3('0xad')](_0xfeb3('0xae'));}this[_0xfeb3('0x12')][_0xfeb3('0xed')]=!![];this[_0xfeb3('0x3c')](_0x3ab560);this['createSquareMessage'](_0x3ab560['text'],'in','','');this[_0xfeb3('0x12')][_0xfeb3('0xad')](util[_0xfeb3('0x2d')](_0xfeb3('0xee'),_0x3ab560[_0xfeb3('0x5e')]));var _0xe94b88=this[_0xfeb3('0x7c')][_0xfeb3('0x73')](this,_0x3ab560);if(_0xe94b88){for(var _0x1f2581 in _0xe94b88){if(_0xe94b88['hasOwnProperty'](_0x1f2581)){this['channel'][_0xfeb3('0xa4')](util['format'](_0xfeb3('0xef'),_0x1f2581[_0xfeb3('0x6c')]()),_0xe94b88[_0x1f2581]);}}this[_0xfeb3('0x44')](_0xe94b88[_0xfeb3('0xf0')],_0xfeb3('0xf1'),_0xfeb3('0xea'),'');return this['channel'][_0xfeb3('0xad')](util['format'](_0xfeb3('0xf2'),_0xe94b88[_0xfeb3('0xf0')]));}return this['channel']['error'](_0x3ab560,_0xfeb3('0xf3'));};AGIVertices[_0xfeb3('0x19')][_0xfeb3('0xf4')]=function(_0xcbfa45){logger[_0xfeb3('0x33')](util[_0xfeb3('0x2d')](_0xfeb3('0xf5'),_0xcbfa45[_0xfeb3('0xac')]));if(!this[_0xfeb3('0x89')](_0xcbfa45[_0xfeb3('0x80')])){return this[_0xfeb3('0x12')][_0xfeb3('0xad')](_0xfeb3('0xf6'));}if(!this[_0xfeb3('0x89')](_0xcbfa45[_0xfeb3('0x81')])){return this[_0xfeb3('0x12')][_0xfeb3('0xad')](_0xfeb3('0xf7'));}if(!this[_0xfeb3('0x89')](_0xcbfa45[_0xfeb3('0x82')])){return this[_0xfeb3('0x12')][_0xfeb3('0xad')](_0xfeb3('0xf8'));}if(!this[_0xfeb3('0x89')](_0xcbfa45[_0xfeb3('0x83')])){return this['channel'][_0xfeb3('0xad')](_0xfeb3('0xf9'));}if(!this[_0xfeb3('0x89')](_0xcbfa45[_0xfeb3('0x5e')])){return this['channel'][_0xfeb3('0xad')]('no\x20text\x20configured');}this['channel'][_0xfeb3('0xed')]=!![];this[_0xfeb3('0x3c')](_0xcbfa45);this['createSquareMessage'](_0xcbfa45['text'],'in','','');this['channel'][_0xfeb3('0xad')](util[_0xfeb3('0x2d')](_0xfeb3('0xfa'),_0xcbfa45[_0xfeb3('0x5e')]));var _0x1f30ca=this[_0xfeb3('0x7f')]['sync'](this,_0xcbfa45);if(_0x1f30ca){for(var _0x4cb0bc in _0x1f30ca){if(_0x1f30ca[_0xfeb3('0x9a')](_0x4cb0bc)){if(_0x4cb0bc!=='providerResponse'){this[_0xfeb3('0x12')][_0xfeb3('0xa4')](util[_0xfeb3('0x2d')](_0xfeb3('0xef'),_0x4cb0bc[_0xfeb3('0x6c')]()),_0x1f30ca[_0x4cb0bc]);}}}this[_0xfeb3('0x44')](_0x1f30ca[_0xfeb3('0xf0')],_0xfeb3('0xf1'),'dialogflowV2',_0x1f30ca[_0xfeb3('0xfb')]);return this[_0xfeb3('0x12')][_0xfeb3('0xad')](util['format'](_0xfeb3('0xfc'),_0x1f30ca['speech']));}return this[_0xfeb3('0x12')][_0xfeb3('0x31')](_0xcbfa45,_0xfeb3('0xfd'));};AGIVertices[_0xfeb3('0x19')][_0xfeb3('0xfe')]=function(_0x3cd95b){logger[_0xfeb3('0x33')](util[_0xfeb3('0x2d')](_0xfeb3('0xff'),_0x3cd95b[_0xfeb3('0xac')]));if(!this[_0xfeb3('0x89')](_0x3cd95b[_0xfeb3('0x100')])){return this[_0xfeb3('0x12')][_0xfeb3('0xad')](_0xfeb3('0x101'));}if(!this[_0xfeb3('0x89')](_0x3cd95b[_0xfeb3('0x102')])){return this['channel'][_0xfeb3('0xad')]('no\x20username\x20configured');}if(!this['isConfigured'](_0x3cd95b[_0xfeb3('0x103')])){return this[_0xfeb3('0x12')]['noop'](_0xfeb3('0x104'));}if(!this['isConfigured'](_0x3cd95b['ndassistant_url'])){return this[_0xfeb3('0x12')]['noop'](_0xfeb3('0xae'));}this[_0xfeb3('0x12')][_0xfeb3('0xed')]=!![];this[_0xfeb3('0x3c')](_0x3cd95b);this[_0xfeb3('0x44')](_0x3cd95b[_0xfeb3('0x5e')],'in','','');this['channel'][_0xfeb3('0xad')](util[_0xfeb3('0x2d')](_0xfeb3('0x105'),_0x3cd95b[_0xfeb3('0x5e')]));var _0x2186d6=this['sestekNDA'][_0xfeb3('0x73')](this,_0x3cd95b);if(_0x2186d6){for(var _0x32348d in _0x2186d6){if(_0x2186d6[_0xfeb3('0x9a')](_0x32348d)){this[_0xfeb3('0x12')][_0xfeb3('0xa4')](util[_0xfeb3('0x2d')](_0xfeb3('0x106'),_0x32348d['toUpperCase']()),_0x2186d6[_0x32348d]);}}this[_0xfeb3('0x44')](_0x2186d6['speech'],_0xfeb3('0xf1'),_0xfeb3('0xfe'),'');if(_0x2186d6[_0xfeb3('0x107')]){this[_0xfeb3('0x12')][_0xfeb3('0xad')](util[_0xfeb3('0x2d')]('Sestek\x20NDA\x20%s\x20file\x20created',_0x2186d6[_0xfeb3('0x107')]));var _0x28cc5a=this[_0xfeb3('0x12')][_0xfeb3('0x108')](_0x2186d6[_0xfeb3('0x107')]);try{fs[_0xfeb3('0x109')](_0x2186d6[_0xfeb3('0x107')]+_0xfeb3('0x10a'));}catch(_0x220e7b){logger[_0xfeb3('0x31')](_0x220e7b);}return _0x28cc5a;}else{return this['channel'][_0xfeb3('0xad')](util[_0xfeb3('0x2d')]('SestekNDA\x20Result\x20%s',_0x2186d6[_0xfeb3('0xf0')]));}}return this[_0xfeb3('0x12')][_0xfeb3('0x31')](_0x3cd95b,_0xfeb3('0x10b'));};AGIVertices['prototype'][_0xfeb3('0x10c')]=function(_0x2b19e0){logger[_0xfeb3('0x33')](util[_0xfeb3('0x2d')](_0xfeb3('0x10d'),_0x2b19e0['label']));return this['channel'][_0xfeb3('0xad')](_0xfeb3('0x10c'));};AGIVertices[_0xfeb3('0x19')][_0xfeb3('0x10e')]=function(_0x3503fc){logger['info'](util['format']('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x3503fc[_0xfeb3('0xac')]));var _0x5708f8='';if(_0x3503fc[_0xfeb3('0x10f')]){if(!this['isConfigured'](_0x3503fc[_0xfeb3('0x10f')])){return this[_0xfeb3('0x12')][_0xfeb3('0x31')](_0x3503fc,_0xfeb3('0x110'));}else{var _0x488995=parseInt(_0x3503fc[_0xfeb3('0x10f')],0xa);if(isNaN(_0x488995)){_0x5708f8=_0x3503fc['trunk_id'];}else{_0x5708f8=this[_0xfeb3('0x21')][_0xfeb3('0x73')](this,_0x3503fc['trunk_id']);if(!_0x5708f8){return this['channel'][_0xfeb3('0x31')](_0x3503fc,_0xfeb3('0x111'));}}}}else if(_0x3503fc[_0xfeb3('0x112')]){_0x5708f8=_0x3503fc[_0xfeb3('0x112')];}else{return this[_0xfeb3('0x12')][_0xfeb3('0x31')](_0x3503fc,_0xfeb3('0x110'));}var _0x12a4d7=this[_0xfeb3('0x12')][_0xfeb3('0x59')](_0xfeb3('0xe8'),[util[_0xfeb3('0x2d')](_0xfeb3('0x113'),_0x5708f8,_0x3503fc[_0xfeb3('0x4b')]),_0x3503fc['timeout'],_0x3503fc['opts'],_0x3503fc[_0xfeb3('0x66')]]);if(_0x12a4d7[_0xfeb3('0xa9')]===-0x1){return _0x12a4d7;}return this[_0xfeb3('0x12')][_0xfeb3('0xad')](util[_0xfeb3('0x2d')]('Executed\x20command\x20%s',_0xfeb3('0xe8')));};AGIVertices[_0xfeb3('0x19')][_0xfeb3('0x114')]=function(_0x106f5d){logger[_0xfeb3('0x33')](util[_0xfeb3('0x2d')](_0xfeb3('0x115'),_0x106f5d[_0xfeb3('0xac')]));return this['channel'][_0xfeb3('0xad')](_0xfeb3('0x114'));};AGIVertices[_0xfeb3('0x19')][_0xfeb3('0x10')]=function(_0x45f6b4){logger[_0xfeb3('0x33')](util[_0xfeb3('0x2d')](_0xfeb3('0x116'),_0x45f6b4[_0xfeb3('0xac')]));if(_0x45f6b4[_0xfeb3('0x117')]===0x0){return this[_0xfeb3('0xaa')](_0x45f6b4);}_0x45f6b4['retry']-=0x1;if(!this[_0xfeb3('0x89')](_0x45f6b4[_0xfeb3('0x118')])){return this[_0xfeb3('0x12')]['error'](_0x45f6b4,_0xfeb3('0x119'));}var _0x1788cc=this[_0xfeb3('0x22')][_0xfeb3('0x73')](this,_0x45f6b4[_0xfeb3('0x118')]);if(!_0x1788cc){return this[_0xfeb3('0x12')][_0xfeb3('0x31')](_0x45f6b4,_0xfeb3('0x11a'));}if(!this[_0xfeb3('0x89')](_0x45f6b4['variable_id'])){return this['channel'][_0xfeb3('0x31')](_0xfeb3('0xde'));}var _0x3bd05c=this[_0xfeb3('0x12')]['getData'](_0x1788cc,_0x45f6b4[_0xfeb3('0x11b')],_0x45f6b4[_0xfeb3('0x11c')]);var _0x2b87af=_0x3bd05c[_0xfeb3('0xa9')]?_0x3bd05c[_0xfeb3('0xa9')][_0xfeb3('0xa8')]():'';logger['info'](_0xfeb3('0x11d'),JSON[_0xfeb3('0x76')](_0x3bd05c));if(_0x3bd05c['result']===-0x1){this[_0xfeb3('0x3c')]['sync'](this,_0x45f6b4,_0x2b87af);return _0x3bd05c;}else if(_0x3bd05c[_0xfeb3('0xa7')]===_0xfeb3('0x67')){_0x3bd05c[_0xfeb3('0xa9')]=_0x2b87af['length']>=parseInt(_0x45f6b4['mindigit'])?'x':'i';}else{_0x3bd05c[_0xfeb3('0xa9')]=_0x2b87af['length']>=parseInt(_0x45f6b4['mindigit'])&&_0x2b87af[_0xfeb3('0xa1')]<=parseInt(_0x45f6b4[_0xfeb3('0x11c')])?'x':'i';}var _0x10355a=this[_0xfeb3('0x15')][_0xfeb3('0x73')](this,_0x45f6b4[_0xfeb3('0xdd')]);if(!_0x10355a){return this['channel'][_0xfeb3('0x31')](_0x45f6b4,_0xfeb3('0x11e'));}this[_0xfeb3('0x12')]['setVariable'](_0x10355a,_0x2b87af);if(this[_0xfeb3('0x89')](_0x45f6b4[_0xfeb3('0x11f')])){var _0x3fbf6c=parseInt(_0x45f6b4[_0xfeb3('0x11f')],0xa);var _0x3c8cc0=rs[_0xfeb3('0x120')]({'charset':'*','length':_0x3fbf6c});var _0x5bc6e8=_0x2b87af[_0xfeb3('0xa1')];if(_0x5bc6e8>0x0){if(_0x5bc6e8>_0x3fbf6c){this[_0xfeb3('0x3c')][_0xfeb3('0x73')](this,_0x45f6b4,_0x45f6b4['hiddendigitspos']===_0xfeb3('0x121')?_0x3c8cc0+_0x2b87af[_0xfeb3('0x122')](_0x3fbf6c):_0x2b87af[_0xfeb3('0x122')](0x0,_0x5bc6e8-_0x3fbf6c)+_0x3c8cc0);}else{this[_0xfeb3('0x3c')][_0xfeb3('0x73')](this,_0x45f6b4,rs[_0xfeb3('0x120')]({'charset':'*','length':_0x5bc6e8}));}}else{this[_0xfeb3('0x3c')][_0xfeb3('0x73')](this,_0x45f6b4,'');}}else{this[_0xfeb3('0x3c')][_0xfeb3('0x73')](this,_0x45f6b4,_0x2b87af);}return _0x3bd05c;};AGIVertices[_0xfeb3('0x19')]['getsecretdigits']=function(_0x47990b){logger[_0xfeb3('0x33')](util[_0xfeb3('0x2d')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x47990b[_0xfeb3('0xac')]));return this[_0xfeb3('0x10')](_0x47990b);};AGIVertices[_0xfeb3('0x19')][_0xfeb3('0x123')]=function(_0x6c6826){logger['info'](util[_0xfeb3('0x2d')](_0xfeb3('0x124'),_0x6c6826['label']));this[_0xfeb3('0x3c')]['sync'](this,_0x6c6826,_0x6c6826[_0xfeb3('0x125')]);return this[_0xfeb3('0x12')]['noop'](util['format'](_0xfeb3('0x126'),_0x6c6826['goalname']));};AGIVertices[_0xfeb3('0x19')][_0xfeb3('0x127')]=function(_0x56e84b){logger[_0xfeb3('0x33')](util[_0xfeb3('0x2d')]('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x56e84b[_0xfeb3('0xac')]));if(!this[_0xfeb3('0x89')](_0x56e84b[_0xfeb3('0x8c')])||!this['isConfigured'](_0x56e84b[_0xfeb3('0x90')])){return this[_0xfeb3('0x12')][_0xfeb3('0xad')](_0xfeb3('0x128'));}if(!this[_0xfeb3('0x89')](_0x56e84b['text'])){return this['channel']['noop'](_0xfeb3('0xae'));}this[_0xfeb3('0x12')][_0xfeb3('0xad')](util[_0xfeb3('0x2d')](_0xfeb3('0x129'),_0x56e84b['text']));var _0x47c436=this[_0xfeb3('0x8b')][_0xfeb3('0x73')](this,_0x56e84b);if(_0x47c436){this[_0xfeb3('0x12')][_0xfeb3('0xad')](util['format'](_0xfeb3('0x12a'),_0x47c436));var _0x9bba6a=this[_0xfeb3('0x12')][_0xfeb3('0x108')](_0x47c436);try{fs[_0xfeb3('0x109')](_0x47c436+'.wav');}catch(_0x47f518){logger[_0xfeb3('0x31')](_0x47f518);}return _0x9bba6a;}return this[_0xfeb3('0x12')][_0xfeb3('0x31')](_0x56e84b,_0xfeb3('0x12b'));};AGIVertices['prototype'][_0xfeb3('0x12c')]=function(_0x5d1a5e){logger[_0xfeb3('0x33')](util[_0xfeb3('0x2d')](_0xfeb3('0x12d'),_0x5d1a5e[_0xfeb3('0xac')]));if(!this[_0xfeb3('0x89')](_0x5d1a5e[_0xfeb3('0x8c')])||!this[_0xfeb3('0x89')](_0x5d1a5e['aws_secret_access_key'])){return this[_0xfeb3('0x12')][_0xfeb3('0xad')]('no\x20valid\x20credentials\x20configured');}if(!this['isConfigured'](_0x5d1a5e[_0xfeb3('0x92')])){return this[_0xfeb3('0x12')][_0xfeb3('0xad')](_0xfeb3('0x12e'));}if(!this['isConfigured'](_0x5d1a5e[_0xfeb3('0x5e')])){return this[_0xfeb3('0x12')][_0xfeb3('0xad')](_0xfeb3('0xae'));}this['channel']['bot']=!![];this[_0xfeb3('0x3c')](_0x5d1a5e);this[_0xfeb3('0x44')](_0x5d1a5e[_0xfeb3('0x5e')],'in','','');this[_0xfeb3('0x12')][_0xfeb3('0xad')](util['format'](_0xfeb3('0x12f'),_0x5d1a5e['text']));var _0x236a67=this[_0xfeb3('0x130')]['sync'](this,_0x5d1a5e);if(_0x236a67){for(var _0x23c46d in _0x236a67){if(_0x236a67[_0xfeb3('0x9a')](_0x23c46d)&&_[_0xfeb3('0x9b')](_0x236a67[_0x23c46d])){this[_0xfeb3('0x12')]['setVariable'](util[_0xfeb3('0x2d')](_0xfeb3('0x131'),_0x23c46d[_0xfeb3('0x6c')]()),_0x236a67[_0x23c46d]);}}if(_[_0xfeb3('0x47')](_0x236a67[_0xfeb3('0x79')])){return this[_0xfeb3('0x12')][_0xfeb3('0xad')](_0xfeb3('0x132'));}else{this[_0xfeb3('0x44')](_0x236a67['message'],_0xfeb3('0xf1'),_0xfeb3('0x133'),'');return this[_0xfeb3('0x12')][_0xfeb3('0xad')](util[_0xfeb3('0x2d')](_0xfeb3('0x134'),_0x236a67[_0xfeb3('0x79')]));}}return this['channel'][_0xfeb3('0x31')](_0x5d1a5e,_0xfeb3('0x135'));};AGIVertices[_0xfeb3('0x19')][_0xfeb3('0x136')]=function(_0x42d63b){logger[_0xfeb3('0x33')](util[_0xfeb3('0x2d')](_0xfeb3('0x137'),_0x42d63b['label'],_0x42d63b[_0xfeb3('0x67')]));if(!this[_0xfeb3('0x89')](_0x42d63b['key'])){return this[_0xfeb3('0x12')][_0xfeb3('0xad')]('no\x20key\x20configured');}var _0x1df550='wav';var _0x23781f=util[_0xfeb3('0x2d')](_0xfeb3('0x138'),FILES_PATH,rs[_0xfeb3('0x120')](0x4));var _0xc3b3e5=util['format'](_0xfeb3('0xa3'),_0x23781f,_0x1df550);var _0x504131=!![];if(_0x42d63b['beep']===_0xfeb3('0x139')){_0x504131=![];}var _0x34762c=this['channel'][_0xfeb3('0x13a')](_0x23781f,_0x1df550,_0x42d63b[_0xfeb3('0x13b')],_0x42d63b[_0xfeb3('0x67')],undefined,_0x504131);if(_0x34762c[_0xfeb3('0xa9')]!==-0x1){this[_0xfeb3('0x12')]['noop'](util[_0xfeb3('0x2d')](_0xfeb3('0x13c'),_0xc3b3e5));var _0x413813=this[_0xfeb3('0x93')]['sync'](this,_0x42d63b,_0xc3b3e5);if(_0x413813){for(var _0x3c65f5 in _0x413813){if(_0x413813[_0xfeb3('0x9a')](_0x3c65f5)){this[_0xfeb3('0x12')][_0xfeb3('0xa4')](util[_0xfeb3('0x2d')](_0xfeb3('0x13d'),_0x3c65f5[_0xfeb3('0x6c')]()),_0x413813[_0x3c65f5]);}}return this['channel'][_0xfeb3('0xad')](util[_0xfeb3('0x2d')]('GoogleASR\x20Result\x20%s',JSON[_0xfeb3('0x76')](_0x413813)));}}return _0x34762c;};AGIVertices[_0xfeb3('0x19')][_0xfeb3('0x13e')]=function(_0x3f8263){logger[_0xfeb3('0x33')](util['format'](_0xfeb3('0x13f'),_0x3f8263[_0xfeb3('0xac')]));if(!this[_0xfeb3('0x89')](_0x3f8263[_0xfeb3('0x95')])){return this[_0xfeb3('0x12')]['noop'](_0xfeb3('0x140'));}if(!this[_0xfeb3('0x89')](_0x3f8263['appsecret'])){return this[_0xfeb3('0x12')][_0xfeb3('0xad')](_0xfeb3('0x141'));}var _0x514335=_0xfeb3('0x142');var _0xd9bf23=util[_0xfeb3('0x2d')](_0xfeb3('0x138'),FILES_PATH,rs[_0xfeb3('0x120')](0x4));var _0x364c14=util['format'](_0xfeb3('0xa3'),_0xd9bf23,_0x514335);var _0x101e57=!![];if(_0x3f8263[_0xfeb3('0x143')]===_0xfeb3('0x139')){_0x101e57=![];}var _0x1076aa=this['channel'][_0xfeb3('0x13a')](_0xd9bf23,_0x514335,_0x3f8263[_0xfeb3('0x13b')],_0x3f8263['timeout'],undefined,_0x101e57);if(_0x1076aa[_0xfeb3('0xa9')]!==-0x1){this[_0xfeb3('0x12')]['noop'](util[_0xfeb3('0x2d')](_0xfeb3('0x144'),_0x364c14));var _0x35a8ce=this[_0xfeb3('0x94')][_0xfeb3('0x73')](this,_0x3f8263,_0x364c14);if(_0x35a8ce){for(var _0x543af2 in _0x35a8ce){if(_0x35a8ce['hasOwnProperty'](_0x543af2)){this[_0xfeb3('0x12')][_0xfeb3('0xa4')](util['format']('TILDE_ASR_%s',_0x543af2[_0xfeb3('0x6c')]()),_0x35a8ce[_0x543af2]);}}return this[_0xfeb3('0x12')][_0xfeb3('0xad')](util['format'](_0xfeb3('0x145'),JSON[_0xfeb3('0x76')](_0x35a8ce)));}}return _0x1076aa;};AGIVertices['prototype'][_0xfeb3('0x146')]=function(_0x558b97){logger[_0xfeb3('0x33')](util['format']('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x558b97[_0xfeb3('0xac')]));return this[_0xfeb3('0x12')]['continueAt'](_0x558b97[_0xfeb3('0x41')],_0x558b97[_0xfeb3('0x147')],_0x558b97[_0xfeb3('0x148')]);};AGIVertices['prototype'][_0xfeb3('0x149')]=function(_0x44b580){logger[_0xfeb3('0x33')](util[_0xfeb3('0x2d')](_0xfeb3('0x14a'),_0x44b580[_0xfeb3('0xac')]));if(!this[_0xfeb3('0x89')](_0x44b580[_0xfeb3('0x14b')])){return this[_0xfeb3('0x12')][_0xfeb3('0x31')](_0x44b580,'no\x20condition\x20configured');}try{var _0x5e203d=eval(_0x44b580[_0xfeb3('0x14b')])?_0xfeb3('0x14c'):_0xfeb3('0x14d');this['channel'][_0xfeb3('0xad')](util[_0xfeb3('0x2d')](_0xfeb3('0x14e'),_0x44b580['condition'],_0x5e203d));return{'code':0xc8,'result':_0x5e203d};}catch(_0x4cfea3){return{'code':0xc8,'result':'false'};}};AGIVertices[_0xfeb3('0x19')][_0xfeb3('0x14f')]=function(_0x38669e){logger['info'](util[_0xfeb3('0x2d')](_0xfeb3('0x150'),_0x38669e[_0xfeb3('0xac')]));if(!this[_0xfeb3('0x89')](_0x38669e[_0xfeb3('0x151')])){return this[_0xfeb3('0x12')][_0xfeb3('0x31')](_0x38669e,_0xfeb3('0x152'));}var _0x45e3a6=this[_0xfeb3('0x27')][_0xfeb3('0x73')](this,_0x38669e[_0xfeb3('0x151')]);if(!_0x45e3a6){return this[_0xfeb3('0x12')][_0xfeb3('0x31')](_0x38669e,'no\x20intervals\x20found');}for(var _0x1dbe71=0x0;_0x1dbe71<_0x45e3a6['length'];_0x1dbe71+=0x1){var _0xecaace=this[_0xfeb3('0x12')][_0xfeb3('0x15')](util[_0xfeb3('0x2d')]('IFTIME(%s?true:false)',_0x45e3a6[_0x1dbe71]));if(_0xecaace[_0xfeb3('0xa9')]===-0x1){return _0xecaace;}logger['info'](util[_0xfeb3('0x2d')]('IFTIME\x20%s\x20%s',_0x45e3a6[_0x1dbe71],_0xecaace[_0xfeb3('0xa7')]));if(_0xecaace[_0xfeb3('0xa7')]===_0xfeb3('0x14c')){logger[_0xfeb3('0x33')](util['format']('IFTIME\x20%s\x20%s',_0x45e3a6[_0x1dbe71],_0xfeb3('0x14c')));this[_0xfeb3('0x12')][_0xfeb3('0xad')](util[_0xfeb3('0x2d')](_0xfeb3('0x153'),_0x45e3a6[_0x1dbe71],_0xfeb3('0x14c')));return{'code':0xc8,'result':_0xfeb3('0x14c')};}else{logger[_0xfeb3('0x33')](util[_0xfeb3('0x2d')]('IFTIME\x20%s\x20%s',_0x45e3a6[_0x1dbe71],_0xfeb3('0x14d')));this['channel']['noop'](util[_0xfeb3('0x2d')](_0xfeb3('0x153'),_0x45e3a6[_0x1dbe71],_0xfeb3('0x14d')));}}return{'code':0xc8,'result':_0xfeb3('0x14d')};};AGIVertices['prototype'][_0xfeb3('0x154')]=function(_0x181364){logger[_0xfeb3('0x33')](util[_0xfeb3('0x2d')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x181364[_0xfeb3('0xac')]));return this[_0xfeb3('0x12')][_0xfeb3('0x154')]();};AGIVertices['prototype']['ispeechasr']=function(_0x375d82){logger[_0xfeb3('0x33')](util['format'](_0xfeb3('0x155'),_0x375d82[_0xfeb3('0xac')]));if(!this[_0xfeb3('0x89')](_0x375d82[_0xfeb3('0x7d')])){return this[_0xfeb3('0x12')][_0xfeb3('0xad')]('no\x20key\x20configured');}var _0x31f41e=_0xfeb3('0x142');var _0x48d8aa=util[_0xfeb3('0x2d')](_0xfeb3('0x138'),FILES_PATH,rs[_0xfeb3('0x120')](0x4));var _0x4f9545=util[_0xfeb3('0x2d')](_0xfeb3('0xa3'),_0x48d8aa,_0x31f41e);var _0x4bcba5=!![];if(_0x375d82[_0xfeb3('0x143')]===_0xfeb3('0x139')){_0x4bcba5=![];}var _0xe5beee=this[_0xfeb3('0x12')]['recordFile'](_0x48d8aa,_0x31f41e,_0x375d82[_0xfeb3('0x13b')],_0x375d82[_0xfeb3('0x67')],undefined,_0x4bcba5);if(_0xe5beee[_0xfeb3('0xa9')]!==-0x1){this['channel']['noop'](util[_0xfeb3('0x2d')](_0xfeb3('0x156'),_0x4f9545));var _0x3a03f8=this[_0xfeb3('0x87')]['sync'](this,_0x375d82,_0x4f9545);if(_0x3a03f8){for(var _0x299cf5 in _0x3a03f8){if(_0x3a03f8[_0xfeb3('0x9a')](_0x299cf5)){this[_0xfeb3('0x12')]['setVariable'](util[_0xfeb3('0x2d')](_0xfeb3('0x157'),_0x299cf5[_0xfeb3('0x6c')]()),_0x3a03f8[_0x299cf5]);}}return this[_0xfeb3('0x12')]['noop'](util[_0xfeb3('0x2d')](_0xfeb3('0x158'),JSON[_0xfeb3('0x76')](_0x3a03f8)));}}return _0xe5beee;};AGIVertices[_0xfeb3('0x19')]['ispeechtts']=function(_0x1d593b){logger[_0xfeb3('0x33')](util['format'](_0xfeb3('0x159'),_0x1d593b[_0xfeb3('0xac')]));if(!this[_0xfeb3('0x89')](_0x1d593b[_0xfeb3('0x7d')])){return this[_0xfeb3('0x12')][_0xfeb3('0xad')](_0xfeb3('0xec'));}if(!this[_0xfeb3('0x89')](_0x1d593b['text'])){return this[_0xfeb3('0x12')][_0xfeb3('0xad')](_0xfeb3('0xae'));}this['channel'][_0xfeb3('0xad')](util[_0xfeb3('0x2d')](_0xfeb3('0x15a'),_0x1d593b[_0xfeb3('0x5e')]));var _0x41dd8c=this['ispeechTTS'][_0xfeb3('0x73')](this,_0x1d593b);if(_0x41dd8c){this[_0xfeb3('0x12')][_0xfeb3('0xad')](util[_0xfeb3('0x2d')](_0xfeb3('0x156'),_0x41dd8c));var _0x51179b=this['channel']['streamFile'](_0x41dd8c,_0x1d593b[_0xfeb3('0x13b')]);try{fs['unlink'](_0x41dd8c+_0xfeb3('0x10a'));}catch(_0x3988c2){logger[_0xfeb3('0x31')](_0x3988c2);}return _0x51179b;}return this[_0xfeb3('0x12')]['error'](_0x1d593b,_0xfeb3('0x15b'));};AGIVertices[_0xfeb3('0x19')]['login']=function(_0x12c63f){logger[_0xfeb3('0x33')](util[_0xfeb3('0x2d')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x12c63f['label']));if(!this['isConfigured'](_0x12c63f[_0xfeb3('0x15c')])){return this[_0xfeb3('0x12')][_0xfeb3('0x31')](_0x12c63f,_0xfeb3('0x15d'));}logger[_0xfeb3('0x33')](util[_0xfeb3('0x2d')](_0xfeb3('0x15e'),this[_0xfeb3('0x12')][_0xfeb3('0x3e')],_0x12c63f['findBy']));var _0x443816=this[_0xfeb3('0x55')][_0xfeb3('0x73')](this,_0x12c63f[_0xfeb3('0x15c')]);if(_0x443816){logger[_0xfeb3('0x33')](util[_0xfeb3('0x2d')](_0xfeb3('0x15f'),this['channel'][_0xfeb3('0x3e')],_0x12c63f[_0xfeb3('0x15c')]));this[_0xfeb3('0x12')][_0xfeb3('0xad')](util[_0xfeb3('0x2d')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xfeb3('0x12')][_0xfeb3('0x3e')],_0x12c63f[_0xfeb3('0x15c')]));return{'code':0xc8,'result':_0xfeb3('0x160')};}else{logger[_0xfeb3('0x33')](util[_0xfeb3('0x2d')](_0xfeb3('0x161'),this[_0xfeb3('0x12')][_0xfeb3('0x3e')],_0x12c63f[_0xfeb3('0x15c')]));this[_0xfeb3('0x12')][_0xfeb3('0xad')](util['format'](_0xfeb3('0x161'),this['channel'][_0xfeb3('0x3e')],_0x12c63f['findBy']));return{'code':0xc8,'result':_0xfeb3('0x162')};}};AGIVertices[_0xfeb3('0x19')]['logout']=function(_0x1e1455){logger[_0xfeb3('0x33')](util[_0xfeb3('0x2d')](_0xfeb3('0x163'),_0x1e1455[_0xfeb3('0xac')]));if(!this[_0xfeb3('0x89')](_0x1e1455[_0xfeb3('0x15c')])){return this[_0xfeb3('0x12')]['error'](_0x1e1455,_0xfeb3('0x15d'));}logger[_0xfeb3('0x33')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xfeb3('0x12')][_0xfeb3('0x3e')],_0x1e1455[_0xfeb3('0x15c')]));var _0x4f35d5=this[_0xfeb3('0x54')][_0xfeb3('0x73')](this,_0x1e1455[_0xfeb3('0x15c')]);if(_0x4f35d5){logger[_0xfeb3('0x33')](util[_0xfeb3('0x2d')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xfeb3('0x12')]['callerid'],_0x1e1455[_0xfeb3('0x15c')]));this[_0xfeb3('0x12')][_0xfeb3('0xad')](util[_0xfeb3('0x2d')](_0xfeb3('0x15f'),this[_0xfeb3('0x12')][_0xfeb3('0x3e')],_0x1e1455[_0xfeb3('0x15c')]));return{'code':0xc8,'result':'success'};}else{logger[_0xfeb3('0x33')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0xfeb3('0x3e')],_0x1e1455[_0xfeb3('0x15c')]));this[_0xfeb3('0x12')][_0xfeb3('0xad')](util[_0xfeb3('0x2d')](_0xfeb3('0x161'),this[_0xfeb3('0x12')]['callerid'],_0x1e1455['findBy']));return{'code':0xc8,'result':_0xfeb3('0x162')};}};AGIVertices['prototype'][_0xfeb3('0x164')]=function(_0x265b3f){logger['info'](util[_0xfeb3('0x2d')]('Enter\x20in\x20MATH\x20(%s)\x20block',_0x265b3f[_0xfeb3('0xac')]));if(!this['isConfigured'](_0x265b3f[_0xfeb3('0x165')])){return this['channel'][_0xfeb3('0x31')](_0x265b3f,_0xfeb3('0x166'));}this[_0xfeb3('0x12')]['noop'](util[_0xfeb3('0x2d')](_0xfeb3('0x167'),_0x265b3f[_0xfeb3('0x165')]));var _0x2e2347=eval(_0x265b3f['operation']);if(!this[_0xfeb3('0x89')](_0x265b3f[_0xfeb3('0xdd')])){return this['channel']['noop'](_0xfeb3('0xde'));}var _0xe6cd0a=this['getVariable'][_0xfeb3('0x73')](this,_0x265b3f[_0xfeb3('0xdd')]);if(!_0xe6cd0a){return this['channel']['error'](_0x265b3f,_0xfeb3('0x11e'));}if(_[_0xfeb3('0xa0')](_0x2e2347)){var _0xc91f98=this;_0x2e2347[_0xfeb3('0xdf')](function(_0x61a715,_0x5c905a){_0xc91f98['channel'][_0xfeb3('0xa4')](util['format'](_0xfeb3('0x168'),_0xe6cd0a,_0x5c905a),_0x61a715);});return this['channel']['noop'](util['format'](_0xfeb3('0x169'),_0xe6cd0a));}else{return this[_0xfeb3('0x12')][_0xfeb3('0xa4')](_0xe6cd0a,_0x2e2347);}};AGIVertices[_0xfeb3('0x19')][_0xfeb3('0xf')]=function(_0x4744b2){logger[_0xfeb3('0x33')](util[_0xfeb3('0x2d')](_0xfeb3('0x16a'),_0x4744b2[_0xfeb3('0xac')]));if(_0x4744b2[_0xfeb3('0x117')]===0x0){return this['maxRetry'](_0x4744b2);}_0x4744b2[_0xfeb3('0x117')]-=0x1;if(!this[_0xfeb3('0x89')](_0x4744b2[_0xfeb3('0x118')])){return this[_0xfeb3('0x12')][_0xfeb3('0x31')](_0x4744b2,_0xfeb3('0x119'));}var _0x326ede=this['getSound'][_0xfeb3('0x73')](this,_0x4744b2['file_id']);if(!_0x326ede){return this[_0xfeb3('0x12')][_0xfeb3('0x31')](_0x4744b2,'no\x20file\x20audio\x20found');}var _0x5a53ab=this[_0xfeb3('0x12')]['getData'](_0x326ede,_0x4744b2[_0xfeb3('0x11b')],_0x4744b2[_0xfeb3('0x16b')]);var _0x1e3644=_0x5a53ab[_0xfeb3('0xa9')];if(_0x5a53ab['result']===-0x1){this['createSquareDetailsReport']['sync'](this,_0x4744b2,'-1');return _0x5a53ab;}else if(_0x5a53ab[_0xfeb3('0xa7')]==='timeout'){_0x5a53ab[_0xfeb3('0xa9')]=_0x5a53ab[_0xfeb3('0xa9')][_0xfeb3('0xa1')]>0x0?_0x5a53ab[_0xfeb3('0xa9')]:'t';}else if(_[_0xfeb3('0x46')](_0x5a53ab[_0xfeb3('0xa9')])){_0x5a53ab[_0xfeb3('0xa9')]='#';_0x1e3644='#';}if(!this[_0xfeb3('0x89')](_0x4744b2['variable_id'])){this[_0xfeb3('0x12')]['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x3cac4c=this[_0xfeb3('0x15')][_0xfeb3('0x73')](this,_0x4744b2[_0xfeb3('0xdd')]);if(!_0x3cac4c){return this[_0xfeb3('0x12')][_0xfeb3('0x31')](_0x4744b2,_0xfeb3('0x11e'));}this[_0xfeb3('0x12')][_0xfeb3('0xa4')](_0x3cac4c,_0x1e3644);}this[_0xfeb3('0x3c')][_0xfeb3('0x73')](this,_0x4744b2,_0x1e3644);return _0x5a53ab;};AGIVertices[_0xfeb3('0x19')][_0xfeb3('0xad')]=function(_0x334b35){logger[_0xfeb3('0x33')](util[_0xfeb3('0x2d')](_0xfeb3('0x16c'),_0x334b35['label']));return this[_0xfeb3('0x12')][_0xfeb3('0xad')](_0x334b35[_0xfeb3('0x16d')]||_0x334b35[_0xfeb3('0xac')]);};AGIVertices[_0xfeb3('0x19')][_0xfeb3('0x16e')]=function(_0x4259eb){logger[_0xfeb3('0x33')](util[_0xfeb3('0x2d')](_0xfeb3('0x16f'),_0x4259eb['label']));if(!this[_0xfeb3('0x89')](_0x4259eb[_0xfeb3('0x15c')])){return this[_0xfeb3('0x12')][_0xfeb3('0x31')](_0x4259eb,_0xfeb3('0x15d'));}logger[_0xfeb3('0x33')](util[_0xfeb3('0x2d')](_0xfeb3('0x15e'),this['channel'][_0xfeb3('0x3e')],_0x4259eb[_0xfeb3('0x15c')]));var _0x1afdc8=this[_0xfeb3('0x170')]['sync'](this,_0x4259eb[_0xfeb3('0x171')]);var _0x2a302e=this['agentPause']['sync'](this,_0x4259eb[_0xfeb3('0x15c')],_0x1afdc8);if(_0x2a302e){logger[_0xfeb3('0x33')](util['format'](_0xfeb3('0x15f'),this[_0xfeb3('0x12')][_0xfeb3('0x3e')],_0x4259eb[_0xfeb3('0x15c')]));this[_0xfeb3('0x12')]['noop'](util[_0xfeb3('0x2d')](_0xfeb3('0x15f'),this[_0xfeb3('0x12')][_0xfeb3('0x3e')],_0x4259eb['findBy']));return{'code':0xc8,'result':_0xfeb3('0x160')};}else{logger[_0xfeb3('0x33')](util[_0xfeb3('0x2d')](_0xfeb3('0x161'),this[_0xfeb3('0x12')][_0xfeb3('0x3e')],_0x4259eb[_0xfeb3('0x15c')]));this['channel']['noop'](util[_0xfeb3('0x2d')](_0xfeb3('0x15f'),this['channel'][_0xfeb3('0x3e')],_0x4259eb[_0xfeb3('0x15c')]));return{'code':0xc8,'result':_0xfeb3('0x162')};}};AGIVertices[_0xfeb3('0x19')][_0xfeb3('0x172')]=function(_0x117b1e){logger['info'](util[_0xfeb3('0x2d')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x117b1e[_0xfeb3('0xac')]));if(!this['isConfigured'](_0x117b1e[_0xfeb3('0x118')])){return this[_0xfeb3('0x12')][_0xfeb3('0x31')](_0x117b1e,'no\x20file\x20audio\x20selected');}var _0x59479d=this[_0xfeb3('0x22')][_0xfeb3('0x73')](this,_0x117b1e['file_id']);if(!_0x59479d){return this[_0xfeb3('0x12')]['error'](_0x117b1e,_0xfeb3('0x11a'));}var _0x222284=this[_0xfeb3('0x12')][_0xfeb3('0x59')](_0xfeb3('0x173'),[_0x59479d,_0x117b1e[_0xfeb3('0x174')]]);if(_0x222284[_0xfeb3('0xa9')]===-0x1){return _0x222284;}return this['channel']['noop'](util[_0xfeb3('0x2d')](_0xfeb3('0xcb'),_0xfeb3('0x173'),_0x59479d));};AGIVertices[_0xfeb3('0x19')][_0xfeb3('0x175')]=function(_0x2ee3fa){logger['info'](util[_0xfeb3('0x2d')](_0xfeb3('0x176'),_0x2ee3fa['label']));if(!this[_0xfeb3('0x89')](_0x2ee3fa[_0xfeb3('0x177')])){return this[_0xfeb3('0x12')][_0xfeb3('0x31')](_0x2ee3fa,_0xfeb3('0x178'));}var _0x496b5b='';var _0x471da6=parseInt(_0x2ee3fa[_0xfeb3('0x177')],0xa);if(isNaN(_0x471da6)){_0x496b5b=_0x2ee3fa['queue_id'];}else{_0x496b5b=this['getVoiceQueue'][_0xfeb3('0x73')](this,_0x2ee3fa[_0xfeb3('0x177')]);if(!_0x496b5b){return this[_0xfeb3('0x12')][_0xfeb3('0x31')](_0x2ee3fa,_0xfeb3('0x179'));}}var _0xe46472='';if(this['isConfigured'](_0x2ee3fa[_0xfeb3('0x118')])){var _0x4eec58=this[_0xfeb3('0x22')][_0xfeb3('0x73')](this,_0x2ee3fa['file_id']);if(_0x4eec58){_0xe46472=_0x4eec58;}}this['createSquareDetailsReport']['sync'](this,_0x2ee3fa,_0x496b5b);if(_0x2ee3fa[_0xfeb3('0x174')]['indexOf']('x')<0x0){_0x2ee3fa[_0xfeb3('0x174')]+='x';}if(_0x2ee3fa[_0xfeb3('0x174')][_0xfeb3('0x17a')]('X')<0x0){_0x2ee3fa['opts']+='X';}this[_0xfeb3('0x12')][_0xfeb3('0xa4')](_0xfeb3('0x17b'),_0x496b5b?_0x496b5b['toLowerCase']():'');var _0x331b07=this[_0xfeb3('0x12')][_0xfeb3('0x59')](_0xfeb3('0x17c'),[_0x496b5b,_0x2ee3fa[_0xfeb3('0x174')],_0x2ee3fa[_0xfeb3('0x66')],_0xe46472,_0x2ee3fa[_0xfeb3('0x67')],_0x2ee3fa['agi'],_0x2ee3fa[_0xfeb3('0x17d')],_0x2ee3fa['gosub'],'',_0x2ee3fa[_0xfeb3('0x17e')]]);if(_0x331b07[_0xfeb3('0xa9')]===-0x1){return _0x331b07;}return this[_0xfeb3('0x12')][_0xfeb3('0xad')](util[_0xfeb3('0x2d')](_0xfeb3('0xcb'),_0xfeb3('0x17c'),_0x496b5b));};AGIVertices[_0xfeb3('0x19')][_0xfeb3('0x17f')]=function(_0x4f41f4){logger[_0xfeb3('0x33')](util[_0xfeb3('0x2d')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x4f41f4[_0xfeb3('0xac')]));var _0x527983=_0x4f41f4['recordingFormat']||'wav';var _0x1c912b=util[_0xfeb3('0x2d')](_0xfeb3('0x180'),this[_0xfeb3('0x12')][_0xfeb3('0x3d')],rs['generate'](0x5));var _0x37e27c=util[_0xfeb3('0x2d')]('%s/recordings/%s.%s',FILES_PATH,_0x1c912b,_0x527983);var _0xeba014=util[_0xfeb3('0x2d')](_0xfeb3('0x138'),FILES_PATH,_0x1c912b);this[_0xfeb3('0x3f')][_0xfeb3('0x73')](this,_0x4f41f4,_0x1c912b,_0x37e27c);this[_0xfeb3('0x12')][_0xfeb3('0xa4')](_0xfeb3('0x181'),_0x1c912b);logger[_0xfeb3('0x33')]('Recording\x20%s\x20%s\x20%s\x20%s',_0xeba014,_0x527983,_0x4f41f4[_0xfeb3('0x182')],_0x4f41f4['timeout']);return this[_0xfeb3('0x12')][_0xfeb3('0x13a')](_0xeba014,_0x527983,_0x4f41f4[_0xfeb3('0x182')],_0x4f41f4[_0xfeb3('0x67')],undefined,!![]);};AGIVertices['prototype'][_0xfeb3('0x183')]=function(_0x8db2cd){logger['info'](util['format'](_0xfeb3('0x184'),_0x8db2cd[_0xfeb3('0xac')]));if(!this['isConfigured'](_0x8db2cd[_0xfeb3('0x66')])){return this[_0xfeb3('0x12')]['noop'](_0xfeb3('0x185'));}var _0x5f0cd4=this[_0xfeb3('0x65')][_0xfeb3('0x73')](this,_0x8db2cd);logger[_0xfeb3('0x33')](util[_0xfeb3('0x2d')](_0xfeb3('0x186'),util[_0xfeb3('0x187')](_0x5f0cd4,{'showHidden':![],'depth':null})));if(!this[_0xfeb3('0x89')](_0x8db2cd[_0xfeb3('0xdd')])){return this[_0xfeb3('0x12')][_0xfeb3('0xad')](_0xfeb3('0x188'));}var _0x1f20fa=this[_0xfeb3('0x15')][_0xfeb3('0x73')](this,_0x8db2cd[_0xfeb3('0xdd')]);if(!_0x1f20fa){return this[_0xfeb3('0x12')]['error'](_0x8db2cd,_0xfeb3('0x11e'));}this[_0xfeb3('0x12')]['setVariable'](util[_0xfeb3('0x2d')](_0xfeb3('0x189'),_0x1f20fa),_0x5f0cd4[_0xfeb3('0x78')]?_0x5f0cd4['statusCode']:_0xfeb3('0x18a'));this[_0xfeb3('0x12')][_0xfeb3('0xa4')](util['format'](_0xfeb3('0x18b'),_0x1f20fa),_0x5f0cd4['statusMessage']?_0x5f0cd4[_0xfeb3('0x77')]:'OK');if(_0x5f0cd4[_0xfeb3('0x6d')]){try{this[_0xfeb3('0xa2')](_0x5f0cd4[_0xfeb3('0x6d')],_0x1f20fa);}catch(_0x470381){logger[_0xfeb3('0x31')](util[_0xfeb3('0x2d')](_0xfeb3('0x18c'),_0x1f20fa));}}return this[_0xfeb3('0x12')][_0xfeb3('0xad')](util[_0xfeb3('0x2d')](_0xfeb3('0xe2'),_0x1f20fa));};AGIVertices[_0xfeb3('0x19')][_0xfeb3('0x18d')]=function(_0x10e9c7){logger[_0xfeb3('0x33')](util['format']('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x10e9c7[_0xfeb3('0xac')]));return this[_0xfeb3('0x12')][_0xfeb3('0x18e')](_0x10e9c7[_0xfeb3('0x18f')][_0xfeb3('0x5b')](/\s+/g,''),_0x10e9c7[_0xfeb3('0x182')]);};AGIVertices[_0xfeb3('0x19')][_0xfeb3('0x190')]=function(_0x52ba10){logger[_0xfeb3('0x33')](util[_0xfeb3('0x2d')](_0xfeb3('0x191'),_0x52ba10[_0xfeb3('0xac')]));return this[_0xfeb3('0x12')]['sayNumber'](_0x52ba10[_0xfeb3('0x68')]['replace'](/\s+/g,''),_0x52ba10[_0xfeb3('0x182')]);};AGIVertices[_0xfeb3('0x19')]['sayphonetic']=function(_0x2a85fd){logger[_0xfeb3('0x33')](util[_0xfeb3('0x2d')](_0xfeb3('0x192'),_0x2a85fd[_0xfeb3('0xac')]));return this[_0xfeb3('0x12')]['sayPhonetic'](_0x2a85fd['text'],_0x2a85fd[_0xfeb3('0x182')]);};AGIVertices[_0xfeb3('0x19')][_0xfeb3('0x193')]=function(_0x257898){logger[_0xfeb3('0x33')](util['format'](_0xfeb3('0x194'),_0x257898[_0xfeb3('0xac')]));if(!this[_0xfeb3('0x89')](_0x257898['account_id'])){return this[_0xfeb3('0x12')][_0xfeb3('0xad')](_0xfeb3('0x195'));}var _0x32673a=this[_0xfeb3('0x25')][_0xfeb3('0x73')](this,_0x257898[_0xfeb3('0x196')]);if(!_0x32673a||!_0x32673a['Smtp']){return this[_0xfeb3('0x12')][_0xfeb3('0x31')](_0x257898,_0xfeb3('0x197'));}var _0x5cb03e={'from':util['format'](_0xfeb3('0x198'),_0x32673a[_0xfeb3('0x18')],_0x32673a[_0xfeb3('0x199')]||_0x32673a[_0xfeb3('0x19a')][_0xfeb3('0x19b')]),'to':_0x257898['to']||'','cc':_0x257898['cc']||'','bcc':_0x257898['bcc']||'','subject':_0x257898['subject'],'html':_0x257898[_0xfeb3('0x5e')],'text':_0x257898[_0xfeb3('0x5e')]};if(this[_0xfeb3('0x89')](_0x257898[_0xfeb3('0x19c')])){}logger[_0xfeb3('0xe3')]('sendMail\x20message',JSON['stringify'](_0x5cb03e));this[_0xfeb3('0x3c')][_0xfeb3('0x73')](this,_0x257898,_0x257898['account_id']);this[_0xfeb3('0x12')][_0xfeb3('0xad')](util['format'](_0xfeb3('0x19d'),_0x32673a[_0xfeb3('0x18')]));this[_0xfeb3('0x19e')][_0xfeb3('0x73')](this,_0x32673a['smtpOptions'],_0x5cb03e);return this[_0xfeb3('0x12')][_0xfeb3('0xad')](_0xfeb3('0x19f'));};AGIVertices[_0xfeb3('0x19')][_0xfeb3('0x1a0')]=function(_0x46a260){logger['info'](util['format'](_0xfeb3('0x1a1'),_0x46a260[_0xfeb3('0xac')]));return this[_0xfeb3('0x12')]['noop']('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0xfeb3('0x19')][_0xfeb3('0x1a2')]=function(_0x50fd6e){logger[_0xfeb3('0x33')](util[_0xfeb3('0x2d')](_0xfeb3('0x1a3'),_0x50fd6e[_0xfeb3('0xac')]));if(!this['isConfigured'](_0x50fd6e['sms_account_id'])){return this[_0xfeb3('0x12')][_0xfeb3('0xad')](_0xfeb3('0x1a4'));}var _0x264fae=this[_0xfeb3('0x1a5')][_0xfeb3('0x73')](this,_0x50fd6e[_0xfeb3('0x1a6')]);if(!_0x264fae){return this[_0xfeb3('0x12')][_0xfeb3('0x31')](_0x50fd6e,_0xfeb3('0x1a7'));}var _0x55f0b4={'body':_0x50fd6e[_0xfeb3('0x1a8')],'phone':_0x50fd6e['to']||'','SmsAccountId':_0x264fae['id']};logger[_0xfeb3('0xe3')](_0xfeb3('0x1a9'),JSON[_0xfeb3('0x76')](_0x55f0b4));this[_0xfeb3('0x3c')][_0xfeb3('0x73')](this,_0x50fd6e,_0x50fd6e[_0xfeb3('0x1a6')]);this[_0xfeb3('0x12')]['noop'](util['format'](_0xfeb3('0x1aa'),_0x264fae[_0xfeb3('0x18')]));this[_0xfeb3('0x3b')][_0xfeb3('0x73')](this,_0x55f0b4);return this[_0xfeb3('0x12')]['noop'](_0xfeb3('0x1ab'));};AGIVertices[_0xfeb3('0x19')][_0xfeb3('0x1ac')]=function(_0x5666e0){logger[_0xfeb3('0x33')](util[_0xfeb3('0x2d')](_0xfeb3('0x1ad'),_0x5666e0[_0xfeb3('0xac')]));if(!this['isConfigured'](_0x5666e0[_0xfeb3('0xdd')])){return this[_0xfeb3('0x12')]['error'](_0x5666e0,_0xfeb3('0x1ae'));}var _0x38f9b7=this['getVariable'][_0xfeb3('0x73')](this,_0x5666e0[_0xfeb3('0xdd')]);if(!_0x38f9b7){return this[_0xfeb3('0x12')][_0xfeb3('0x31')](_0x5666e0,_0xfeb3('0x11e'));}return this[_0xfeb3('0x12')][_0xfeb3('0xa4')](_0x38f9b7,_0x5666e0[_0xfeb3('0x1af')]);};AGIVertices[_0xfeb3('0x19')][_0xfeb3('0x1b0')]=function(_0x2d360b){logger['info'](util[_0xfeb3('0x2d')]('Enter\x20in\x20START\x20(%s)\x20block',_0x2d360b[_0xfeb3('0xac')]));this[_0xfeb3('0x12')][_0xfeb3('0xad')]('START\x20CALLY\x20SQUARE');if(_0x2d360b[_0xfeb3('0xbf')]==='yes'){this['channel'][_0xfeb3('0xad')](_0xfeb3('0x1b1'));return this[_0xfeb3('0x12')][_0xfeb3('0xbf')]();}return this[_0xfeb3('0x12')]['noop'](_0xfeb3('0x1b2'));};AGIVertices[_0xfeb3('0x19')][_0xfeb3('0x1b3')]=function(_0x55cf68){logger[_0xfeb3('0x33')](util[_0xfeb3('0x2d')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x55cf68[_0xfeb3('0xac')]));if(!this[_0xfeb3('0x89')](_0x55cf68['project_id'])){return this['channel']['error'](_0x55cf68,_0xfeb3('0x1b4'));}var _0x22d7cc=this[_0xfeb3('0x1c')][_0xfeb3('0x73')](this,_0x55cf68['project_id']);if(!this['isConfigured'](_0x22d7cc)){return this[_0xfeb3('0x12')][_0xfeb3('0x31')](_0x55cf68,util[_0xfeb3('0x2d')](_0xfeb3('0x1b5'),_0x55cf68['project_id']));}if(_0x22d7cc===this['channel'][_0xfeb3('0x43')]){return this[_0xfeb3('0x12')]['error'](_0x55cf68,_0xfeb3('0x1b6'));}this['createSquareDetailsReport'][_0xfeb3('0x73')](this,_0x55cf68,_0x22d7cc);var _0x42a99c=this[_0xfeb3('0x12')][_0xfeb3('0x59')](_0xfeb3('0x1b7'),util[_0xfeb3('0x2d')](_0xfeb3('0x1b8'),config[_0xfeb3('0x9')][_0xfeb3('0x1b9')]||_0xfeb3('0x1ba'),_0x22d7cc,this[_0xfeb3('0x12')][_0xfeb3('0x43')]));if(_0x42a99c['result']===-0x1){return _0x42a99c;}return this[_0xfeb3('0x12')][_0xfeb3('0xad')](util['format']('Executed\x20command\x20%s\x20%s',_0xfeb3('0x1b7'),_0x22d7cc));};AGIVertices[_0xfeb3('0x19')]['system']=function(_0x5a0b2f){logger[_0xfeb3('0x33')](util[_0xfeb3('0x2d')](_0xfeb3('0x1bb'),_0x5a0b2f[_0xfeb3('0xac')]));var _0x49560a=this['shellCommand'][_0xfeb3('0x73')](this,_0x5a0b2f[_0xfeb3('0xbe')]);this[_0xfeb3('0x3c')][_0xfeb3('0x73')](this,_0x5a0b2f,_0x5a0b2f['command']);if(this[_0xfeb3('0x89')](_0x5a0b2f[_0xfeb3('0xdd')])){var _0x3abd6e=this['getVariable'][_0xfeb3('0x73')](this,_0x5a0b2f[_0xfeb3('0xdd')]);if(_0x3abd6e){this[_0xfeb3('0x12')][_0xfeb3('0xa4')](_0x3abd6e,_0x49560a);return this[_0xfeb3('0x12')][_0xfeb3('0xad')](util[_0xfeb3('0x2d')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x5a0b2f[_0xfeb3('0xbe')],_0x3abd6e));}}return this['channel'][_0xfeb3('0xad')](util[_0xfeb3('0x2d')](_0xfeb3('0x1bc'),_0x5a0b2f[_0xfeb3('0xbe')]));};AGIVertices[_0xfeb3('0x19')][_0xfeb3('0x1bd')]=function(_0x59e32b){logger['info'](util[_0xfeb3('0x2d')](_0xfeb3('0x1be'),_0x59e32b[_0xfeb3('0xac')]));_0x59e32b['text']=_0x59e32b[_0xfeb3('0x5e')][_0xfeb3('0x5b')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x59e32b['apiKey'])){return this[_0xfeb3('0x12')][_0xfeb3('0xad')](_0xfeb3('0x1bf'));}if(!this['isConfigured'](_0x59e32b[_0xfeb3('0x5e')])){return this[_0xfeb3('0x12')][_0xfeb3('0xad')]('no\x20text\x20configured');}this['channel'][_0xfeb3('0xad')](util[_0xfeb3('0x2d')](_0xfeb3('0x1c0'),_0x59e32b[_0xfeb3('0x5e')]));var _0x24f884=this[_0xfeb3('0x1c1')][_0xfeb3('0x73')](this,_0x59e32b);if(_0x24f884){this[_0xfeb3('0x12')][_0xfeb3('0xad')](util[_0xfeb3('0x2d')](_0xfeb3('0x1c2'),_0x24f884));var _0x32cc98=this['channel'][_0xfeb3('0x108')](_0x24f884);try{fs[_0xfeb3('0x109')](_0x24f884+_0xfeb3('0x10a'));}catch(_0x5002c6){logger[_0xfeb3('0x31')](_0x5002c6);}return _0x32cc98;}return this['channel'][_0xfeb3('0x31')](_0x59e32b,_0xfeb3('0x1c3'));};AGIVertices[_0xfeb3('0x19')][_0xfeb3('0x1c4')]=function(_0x317f2a){logger[_0xfeb3('0x33')](util[_0xfeb3('0x2d')](_0xfeb3('0x1c5'),_0x317f2a[_0xfeb3('0xac')]));_0x317f2a[_0xfeb3('0x5e')]=_0x317f2a[_0xfeb3('0x5e')][_0xfeb3('0x5b')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x317f2a[_0xfeb3('0x5e')])){return this[_0xfeb3('0x12')][_0xfeb3('0xad')](_0xfeb3('0xae'));}this[_0xfeb3('0x12')][_0xfeb3('0xad')](util[_0xfeb3('0x2d')](_0xfeb3('0x1c6'),_0x317f2a['text']));var _0x422287=this[_0xfeb3('0x64')][_0xfeb3('0x73')](this,_0x317f2a);if(_0x422287){this[_0xfeb3('0x12')][_0xfeb3('0xad')](util[_0xfeb3('0x2d')](_0xfeb3('0x1c7'),_0x422287));var _0x14b1b6=this['channel']['streamFile'](_0x422287);try{fs[_0xfeb3('0x109')](_0x422287+_0xfeb3('0x10a'));}catch(_0x2e8ffa){logger[_0xfeb3('0x31')](_0x2e8ffa);}return _0x14b1b6;}return this[_0xfeb3('0x12')][_0xfeb3('0x31')](_0x317f2a,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0xfeb3('0x19')][_0xfeb3('0x1c8')]=function(_0x3e6c68){logger['info'](util[_0xfeb3('0x2d')]('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x3e6c68[_0xfeb3('0xac')]));if(!this['isConfigured'](_0x3e6c68[_0xfeb3('0x15c')])){return this['channel'][_0xfeb3('0x31')](_0x3e6c68,'no\x20find\x20by\x20configured');}logger[_0xfeb3('0x33')](util[_0xfeb3('0x2d')](_0xfeb3('0x15e'),this['channel'][_0xfeb3('0x3e')],_0x3e6c68[_0xfeb3('0x15c')]));var _0x2849d4=this[_0xfeb3('0x52')]['sync'](this,_0x3e6c68[_0xfeb3('0x15c')]);if(_0x2849d4){logger['info'](util['format'](_0xfeb3('0x15f'),this['channel'][_0xfeb3('0x3e')],_0x3e6c68[_0xfeb3('0x15c')]));this[_0xfeb3('0x12')]['noop'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xfeb3('0x12')][_0xfeb3('0x3e')],_0x3e6c68[_0xfeb3('0x15c')]));return{'code':0xc8,'result':_0xfeb3('0x160')};}else{logger[_0xfeb3('0x33')](util[_0xfeb3('0x2d')](_0xfeb3('0x161'),this[_0xfeb3('0x12')][_0xfeb3('0x3e')],_0x3e6c68[_0xfeb3('0x15c')]));this['channel'][_0xfeb3('0xad')](util[_0xfeb3('0x2d')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xfeb3('0x12')]['callerid'],_0x3e6c68[_0xfeb3('0x15c')]));return{'code':0xc8,'result':_0xfeb3('0x162')};}};AGIVertices['prototype']['voicemail']=function(_0x52a11a){logger['info'](util[_0xfeb3('0x2d')](_0xfeb3('0x1c9'),_0x52a11a[_0xfeb3('0xac')]));var _0x500547=this['channel'][_0xfeb3('0x59')](_0xfeb3('0x1ca'),[_0x52a11a[_0xfeb3('0x1cb')],_0x52a11a[_0xfeb3('0x7b')]]);if(_0x500547['result']===-0x1){return _0x500547;}return this[_0xfeb3('0x12')][_0xfeb3('0xad')](util[_0xfeb3('0x2d')](_0xfeb3('0xcb'),_0xfeb3('0x1ca'),_0x52a11a[_0xfeb3('0x1cb')]));};AGIVertices[_0xfeb3('0x19')][_0xfeb3('0x1cc')]=function(_0x9fff63){logger[_0xfeb3('0x33')](util['format'](_0xfeb3('0x1cd'),_0x9fff63[_0xfeb3('0xac')]));if(!this[_0xfeb3('0x89')](_0x9fff63[_0xfeb3('0xdd')])){return this[_0xfeb3('0x12')][_0xfeb3('0x31')](_0x9fff63,_0xfeb3('0x1ae'));}var _0x30a0f1=this['getVariable']['sync'](this,_0x9fff63[_0xfeb3('0xdd')]);if(!_0x30a0f1){return this['channel'][_0xfeb3('0x31')](_0x9fff63,_0xfeb3('0x11e'));}var _0xd67da=this[_0xfeb3('0x12')][_0xfeb3('0x15')](_0x30a0f1);return{'code':0xc8,'result':_0xd67da[_0xfeb3('0xa7')]?_0xd67da[_0xfeb3('0xa7')]:'-'};};String[_0xfeb3('0x19')][_0xfeb3('0xa6')]=function(_0x42bba0,_0x943a6f){return this[_0xfeb3('0xa5')](_0x42bba0)[_0xfeb3('0x1ce')](_0x943a6f);};module[_0xfeb3('0x1cf')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 198a542..ff91d5d 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 _0x71ab=['[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','syncAgentRingNoAnswer','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','savePause','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','moment','../../../config/logger','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','attendedtransfer','syncAttendedTransfer','blindtransfer','milliseconds','seconds','prototype','updateAcw','lastPauseAt','timer','update','uniqueid','then','info','[%s][UPDATE][ACWTIME:%s]','catch','[%s][UPDATE][ERRORS:%s]','finally','startAcw','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','resolve','getAgent','voicePause','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','YYYY-MM-DD\x20HH:mm:ss','error','[ACW][START]\x20%s','[%s][TIMER][STOP][AGENT:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','message','acw','[ACW][syncAgentConnect]\x20%s','syncAgentConnectPreview','isUndefined','[%s][HANGUP:UNIQUEID]','[%s][HANGUP:LINKEDID]','linkedid','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','syncBlindTransfer','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid'];(function(_0x208d75,_0x92d742){var _0x382d27=function(_0x3aaba3){while(--_0x3aaba3){_0x208d75['push'](_0x208d75['shift']());}};_0x382d27(++_0x92d742);}(_0x71ab,0x64));var _0xb71a=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x71ab[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var moment=require(_0xb71a('0x0'));var ami=require('../ami');var logger=require(_0xb71a('0x1'))('acw');var RpcUser=require(_0xb71a('0x2'));var RpcVoiceAgentReport=require(_0xb71a('0x3'));function Acw(_0x20fd9c){this[_0xb71a('0x4')]=_0x20fd9c[_0xb71a('0x4')];this[_0xb71a('0x5')]=_0x20fd9c[_0xb71a('0x5')];this[_0xb71a('0x6')]=_0x20fd9c[_0xb71a('0x6')];this[_0xb71a('0x7')]={};ami['on'](_0xb71a('0x8'),this[_0xb71a('0x9')][_0xb71a('0xa')](this));ami['on'](_0xb71a('0xb'),this[_0xb71a('0xc')][_0xb71a('0xa')](this));ami['on'](_0xb71a('0xd'),this[_0xb71a('0xe')]['bind'](this));ami['on'](_0xb71a('0xf'),this['syncAgentRingNoAnswer'][_0xb71a('0xa')](this));ami['on'](_0xb71a('0x10'),this[_0xb71a('0x11')]['bind'](this));ami['on'](_0xb71a('0x12'),this['syncBlindTransfer'][_0xb71a('0xa')](this));ami['on']('custom:agentConnectPreview',this['syncAgentConnectPreview'][_0xb71a('0xa')](this));}function getDiff(_0x2f5fd5){var _0x315ca8=moment()[_0xb71a('0x13')](0x0);var _0x483d77=moment(_0x2f5fd5)['milliseconds'](0x0);return _0x315ca8['diff'](_0x483d77,_0xb71a('0x14'));}Acw[_0xb71a('0x15')][_0xb71a('0x16')]=function(_0x42fc55,_0x3cd0f0){var _0x1e9363=this;var _0x31def2=getDiff(_0x1e9363[_0xb71a('0x6')][_0x42fc55][_0xb71a('0x17')]);clearTimeout(_0x1e9363['timers'][_0x42fc55][_0xb71a('0x18')]);_0x1e9363[_0xb71a('0x6')][_0x42fc55][_0xb71a('0x18')]=![];return RpcVoiceAgentReport[_0xb71a('0x19')]({'acwtime':_0x31def2},_0x1e9363[_0xb71a('0x6')][_0x42fc55][_0xb71a('0x1a')],_0x42fc55)[_0xb71a('0x1b')](function(_0x7cd1f9){logger[_0xb71a('0x1c')](_0xb71a('0x1d'),_0x3cd0f0,_0x31def2,_0x7cd1f9);})[_0xb71a('0x1e')](function(_0x494899){logger['error'](_0xb71a('0x1f'),_0x3cd0f0,_0x494899);})[_0xb71a('0x20')](function(){delete _0x1e9363['timers'][_0x42fc55];});};Acw['prototype'][_0xb71a('0x21')]=function(_0x4fe4fb){try{var _0x76d6dc=this;var _0x4227c7=this[_0xb71a('0x7')][_0x4fe4fb][_0xb71a('0x22')];var _0x38a728=this[_0xb71a('0x7')][_0x4fe4fb][_0xb71a('0x23')];var _0x14aac7=this['voiceQueues'][_0x38a728];var _0xd40f86=![];var _0x2c15bc=_0xb71a('0x24');if(_0x14aac7[_0xb71a('0x25')]&&_0x14aac7[_0xb71a('0x26')][_0xb71a('0x27')]){_0xd40f86=!![];_0x2c15bc=_0x14aac7[_0xb71a('0x26')][_0xb71a('0x27')];}if(!_0x76d6dc[_0xb71a('0x5')][_0x4227c7]){return Promise[_0xb71a('0x28')]();}return RpcUser[_0xb71a('0x29')](_0x76d6dc[_0xb71a('0x5')][_0x4227c7]['id'])[_0xb71a('0x1b')](function(_0x5ae0ed){if(!_0x5ae0ed||_0x5ae0ed[_0xb71a('0x2a')]){logger[_0xb71a('0x1c')](_0xb71a('0x2b'),_0x4fe4fb,_0x4227c7,_0x38a728);return;}logger[_0xb71a('0x1c')](_0xb71a('0x2c'),_0x4fe4fb,_0x4227c7,_0x38a728);var _0x38178c=_0x76d6dc[_0xb71a('0x7')][_0x4fe4fb][_0xb71a('0x2d')]&&_0x76d6dc[_0xb71a('0x7')][_0x4fe4fb][_0xb71a('0x2e')]?_0x76d6dc[_0xb71a('0x7')][_0x4fe4fb]['destlinkedid']:_0x4fe4fb;return RpcUser['savePause'](_0x76d6dc[_0xb71a('0x5')][_0x4227c7],_0x2c15bc,_0x38178c);})['then'](function(_0x70299a){if(_0xd40f86||!_0x70299a){return;}_0x76d6dc[_0xb71a('0x6')][_0x4227c7]={};logger['info'](_0xb71a('0x2f'),_0x4fe4fb,_0x76d6dc[_0xb71a('0x4')][_0x38a728][_0xb71a('0x30')],_0x4227c7,_0x38a728);_0x76d6dc[_0xb71a('0x6')][_0x4227c7][_0xb71a('0x18')]=setTimeout(_0x76d6dc[_0xb71a('0x31')]['bind'](_0x76d6dc,_0x4227c7),_0x76d6dc[_0xb71a('0x4')][_0x38a728][_0xb71a('0x30')]*0x3e8);_0x76d6dc[_0xb71a('0x6')][_0x4227c7][_0xb71a('0x17')]=moment()['format'](_0xb71a('0x32'));_0x76d6dc[_0xb71a('0x6')][_0x4227c7][_0xb71a('0x1a')]=_0x4fe4fb;_0x76d6dc[_0xb71a('0x6')][_0x4227c7][_0xb71a('0x23')]=_0x38a728;_0x76d6dc[_0xb71a('0x6')][_0x4227c7][_0xb71a('0x16')]=_0x76d6dc[_0xb71a('0x16')][_0xb71a('0xa')](_0x76d6dc,_0x4227c7,_0x4fe4fb);})[_0xb71a('0x1e')](function(){logger['error']('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x4fe4fb,_0x76d6dc[_0xb71a('0x4')][_0x38a728][_0xb71a('0x30')],_0x4227c7,_0x38a728);})[_0xb71a('0x20')](function(){delete _0x76d6dc[_0xb71a('0x7')][_0x4fe4fb];});}catch(_0xb5d842){logger[_0xb71a('0x33')](_0xb71a('0x34'),_0xb5d842['message']);}};Acw[_0xb71a('0x15')]['stopAcw']=function(_0x3143c9){try{var _0xaebdc3=this;if(_0xaebdc3[_0xb71a('0x6')][_0x3143c9]){_0xaebdc3[_0xb71a('0x6')][_0x3143c9]['timer']=![];var _0x39d12c=_0xaebdc3[_0xb71a('0x6')][_0x3143c9][_0xb71a('0x1a')];var _0x1fa15c=_0xaebdc3[_0xb71a('0x6')][_0x3143c9][_0xb71a('0x23')];var _0x4571c0=_0xaebdc3[_0xb71a('0x4')][_0x1fa15c][_0xb71a('0x30')];logger['info'](_0xb71a('0x35'),_0x39d12c,_0x3143c9);RpcUser['saveUnpause'](this[_0xb71a('0x5')][_0x3143c9]);RpcVoiceAgentReport[_0xb71a('0x19')]({'acwtime':_0x4571c0,'agentacw':!![]},_0x39d12c,_0x3143c9)[_0xb71a('0x1b')](function(_0x3cca63){logger[_0xb71a('0x1c')](_0xb71a('0x1d'),_0x39d12c,_0x4571c0,_0x3cca63);})['catch'](function(_0x47d2b1){logger['error'](_0xb71a('0x1f'),_0x39d12c,_0x47d2b1);});}else{logger['error'](_0xb71a('0x36'),_0x3143c9);if(_0xaebdc3[_0xb71a('0x6')]){logger[_0xb71a('0x1c')](_0xb71a('0x37'),JSON[_0xb71a('0x38')](_0xaebdc3[_0xb71a('0x6')]));}}}catch(_0x59530a){logger[_0xb71a('0x33')](_0xb71a('0x39'),_0x59530a[_0xb71a('0x3a')]);}};Acw[_0xb71a('0x15')][_0xb71a('0x9')]=function(_0x2f08d2){try{if(this['voiceQueues'][_0x2f08d2[_0xb71a('0x23')]]&&(this[_0xb71a('0x4')][_0x2f08d2[_0xb71a('0x23')]][_0xb71a('0x3b')]||this[_0xb71a('0x4')][_0x2f08d2[_0xb71a('0x23')]][_0xb71a('0x25')])){if(this['agents'][_0x2f08d2['interface']]){this[_0xb71a('0x7')][_0x2f08d2[_0xb71a('0x1a')]]={'queue':_0x2f08d2[_0xb71a('0x23')],'interface':_0x2f08d2[_0xb71a('0x22')],'destlinkedid':_0x2f08d2['destlinkedid']};}}}catch(_0x2316c8){logger['error'](_0xb71a('0x3c'),_0x2316c8[_0xb71a('0x3a')]);}};Acw['prototype'][_0xb71a('0x3d')]=function(_0x274a94){try{if(this[_0xb71a('0x4')][_0x274a94[_0xb71a('0x23')]]&&(this['voiceQueues'][_0x274a94[_0xb71a('0x23')]][_0xb71a('0x3b')]||this[_0xb71a('0x4')][_0x274a94['queue']][_0xb71a('0x25')])){if(this[_0xb71a('0x5')][_0x274a94[_0xb71a('0x22')]]){this['channels'][_0x274a94[_0xb71a('0x1a')]]={'queue':_0x274a94[_0xb71a('0x23')],'interface':_0x274a94[_0xb71a('0x22')]};}}}catch(_0x1f29b7){logger[_0xb71a('0x33')]('[ACW][syncAgentConnectPreview]\x20%s',_0x1f29b7[_0xb71a('0x3a')]);}};Acw[_0xb71a('0x15')][_0xb71a('0xc')]=function(_0x3ebc7d){try{if(this['channels'][_0x3ebc7d['uniqueid']]&&_[_0xb71a('0x3e')](this[_0xb71a('0x7')][_0x3ebc7d[_0xb71a('0x1a')]][_0xb71a('0x2d')])){logger[_0xb71a('0x1c')](_0xb71a('0x3f'),_0x3ebc7d[_0xb71a('0x1a')]);this[_0xb71a('0x21')](_0x3ebc7d[_0xb71a('0x1a')]);}else if(this[_0xb71a('0x7')][_0x3ebc7d['linkedid']]&&_[_0xb71a('0x3e')](this[_0xb71a('0x7')][_0x3ebc7d['linkedid']][_0xb71a('0x2d')])){logger['info'](_0xb71a('0x40'),_0x3ebc7d[_0xb71a('0x41')]);this[_0xb71a('0x21')](_0x3ebc7d[_0xb71a('0x41')]);}}catch(_0x84c587){logger['error'](_0xb71a('0x42'),_0x84c587['message']);}};Acw[_0xb71a('0x15')][_0xb71a('0xe')]=function(_0x5cb91e){try{if(this['channels'][_0x5cb91e[_0xb71a('0x1a')]]&&this[_0xb71a('0x7')][_0x5cb91e['uniqueid']]['attended']){logger['info'](_0xb71a('0x43'),_0x5cb91e['uniqueid']);this['startAcw'](_0x5cb91e[_0xb71a('0x1a')]);}else if(this[_0xb71a('0x7')][_0x5cb91e[_0xb71a('0x41')]]&&this[_0xb71a('0x7')][_0x5cb91e['linkedid']][_0xb71a('0x2d')]){logger[_0xb71a('0x1c')](_0xb71a('0x44'),_0x5cb91e['linkedid']);this[_0xb71a('0x21')](_0x5cb91e[_0xb71a('0x41')]);}}catch(_0x4dee60){logger[_0xb71a('0x33')](_0xb71a('0x45'),_0x4dee60[_0xb71a('0x3a')]);}};Acw['prototype'][_0xb71a('0x11')]=function(_0x51112b){try{if(!_[_0xb71a('0x46')](this[_0xb71a('0x7')][_0x51112b['transfereeuniqueid']])){this[_0xb71a('0x21')](_0x51112b[_0xb71a('0x47')]);if(this[_0xb71a('0x7')][_0x51112b[_0xb71a('0x48')]]){this[_0xb71a('0x7')][_0x51112b[_0xb71a('0x48')]][_0xb71a('0x2d')]=!![];this['channels'][_0x51112b['transfertargetuniqueid']]=this[_0xb71a('0x7')][_0x51112b[_0xb71a('0x48')]];delete this[_0xb71a('0x7')][_0x51112b[_0xb71a('0x48')]];}}else if(!_[_0xb71a('0x46')](this['channels'][_0x51112b['transfertargetuniqueid']])){this[_0xb71a('0x21')](_0x51112b[_0xb71a('0x49')]);if(this['channels'][_0x51112b[_0xb71a('0x4a')]]){this[_0xb71a('0x7')][_0x51112b['origtransfereruniqueid']][_0xb71a('0x2d')]=!![];this[_0xb71a('0x7')][_0x51112b[_0xb71a('0x47')]]=this[_0xb71a('0x7')][_0x51112b['origtransfereruniqueid']];delete this[_0xb71a('0x7')][_0x51112b[_0xb71a('0x4a')]];}}}catch(_0x4c80f8){logger[_0xb71a('0x33')](_0xb71a('0x4b'),_0x4c80f8[_0xb71a('0x3a')]);}};Acw[_0xb71a('0x15')][_0xb71a('0x4c')]=function(_0x1c4a15){try{if(this[_0xb71a('0x7')][_0x1c4a15[_0xb71a('0x4d')]]){logger['info'](_0xb71a('0x4e'),JSON[_0xb71a('0x38')](_0x1c4a15['transfereruniqueid']));this[_0xb71a('0x21')](_0x1c4a15[_0xb71a('0x4d')]);}else if(this['channels'][_0x1c4a15[_0xb71a('0x4f')]]){logger[_0xb71a('0x1c')](_0xb71a('0x50'),JSON[_0xb71a('0x38')](_0x1c4a15[_0xb71a('0x4f')]));this[_0xb71a('0x21')](_0x1c4a15['transfererlinkedid']);}}catch(_0x59b1b4){logger[_0xb71a('0x33')](_0xb71a('0x51'),_0x59b1b4[_0xb71a('0x3a')]);}};Acw['prototype'][_0xb71a('0x52')]=function(_0x5e58f7){try{if(this[_0xb71a('0x4')][_0x5e58f7['queue']]&&this['voiceQueues'][_0x5e58f7[_0xb71a('0x23')]][_0xb71a('0x53')]===_0xb71a('0x54')){if(this[_0xb71a('0x5')][_0x5e58f7[_0xb71a('0x22')]]){logger['info'](_0xb71a('0x55'),_0x5e58f7['uniqueid'],_0x5e58f7[_0xb71a('0x22')],_0x5e58f7[_0xb71a('0x23')]);return RpcUser[_0xb71a('0x56')](this['agents'][_0x5e58f7['interface']],_0xb71a('0x57'),_0x5e58f7[_0xb71a('0x1a')]);}}}catch(_0x1a96fc){logger[_0xb71a('0x33')](_0xb71a('0x58'),_0x1a96fc['message']);}};module[_0xb71a('0x59')]=Acw; \ No newline at end of file +var _0x2542=['transfertargetuniqueid','isNil','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','Auto-Pause','exports','lodash','moment','../ami','../../../config/logger','../rpc/user','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','updateAcw','lastPauseAt','timer','update','info','[%s][UPDATE][ACWTIME:%s]','catch','error','finally','interface','ACW','mandatoryDisposition','mandatoryDispositionPause','name','resolve','then','voicePause','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','format','YYYY-MM-DD\x20HH:mm:ss','queue','[ACW][START]\x20%s','message','uniqueid','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','acw','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','startAcw','linkedid','[%s][HANGUP:LINKEDID]','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','transfereeuniqueid','secondtransfereruniqueid'];(function(_0x21e171,_0x5d4b9c){var _0x359aa0=function(_0x20f191){while(--_0x20f191){_0x21e171['push'](_0x21e171['shift']());}};_0x359aa0(++_0x5d4b9c);}(_0x2542,0x169));var _0x2254=function(_0x35c2a9,_0x4e8953){_0x35c2a9=_0x35c2a9-0x0;var _0x5ab481=_0x2542[_0x35c2a9];return _0x5ab481;};'use strict';var _=require(_0x2254('0x0'));var moment=require(_0x2254('0x1'));var ami=require(_0x2254('0x2'));var logger=require(_0x2254('0x3'))('acw');var RpcUser=require(_0x2254('0x4'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x4059d1){this[_0x2254('0x5')]=_0x4059d1[_0x2254('0x5')];this[_0x2254('0x6')]=_0x4059d1[_0x2254('0x6')];this['timers']=_0x4059d1[_0x2254('0x7')];this[_0x2254('0x8')]={};ami['on'](_0x2254('0x9'),this[_0x2254('0xa')][_0x2254('0xb')](this));ami['on'](_0x2254('0xc'),this[_0x2254('0xd')][_0x2254('0xb')](this));ami['on'](_0x2254('0xe'),this[_0x2254('0xf')][_0x2254('0xb')](this));ami['on']('agentringnoanswer',this[_0x2254('0x10')][_0x2254('0xb')](this));ami['on'](_0x2254('0x11'),this[_0x2254('0x12')]['bind'](this));ami['on']('blindtransfer',this[_0x2254('0x13')][_0x2254('0xb')](this));ami['on'](_0x2254('0x14'),this[_0x2254('0x15')][_0x2254('0xb')](this));}function getDiff(_0x381efe){var _0x592a4f=moment()[_0x2254('0x16')](0x0);var _0x7c7ab0=moment(_0x381efe)['milliseconds'](0x0);return _0x592a4f[_0x2254('0x17')](_0x7c7ab0,_0x2254('0x18'));}Acw[_0x2254('0x19')][_0x2254('0x1a')]=function(_0x26285a,_0xbc5548){var _0x50f137=this;var _0x18baf4=getDiff(_0x50f137['timers'][_0x26285a][_0x2254('0x1b')]);clearTimeout(_0x50f137[_0x2254('0x7')][_0x26285a][_0x2254('0x1c')]);_0x50f137[_0x2254('0x7')][_0x26285a][_0x2254('0x1c')]=![];return RpcVoiceAgentReport[_0x2254('0x1d')]({'acwtime':_0x18baf4},_0x50f137['timers'][_0x26285a]['uniqueid'],_0x26285a)['then'](function(_0xb05559){logger[_0x2254('0x1e')](_0x2254('0x1f'),_0xbc5548,_0x18baf4,_0xb05559);})[_0x2254('0x20')](function(_0x2801d9){logger[_0x2254('0x21')]('[%s][UPDATE][ERRORS:%s]',_0xbc5548,_0x2801d9);})[_0x2254('0x22')](function(){delete _0x50f137[_0x2254('0x7')][_0x26285a];});};Acw[_0x2254('0x19')]['startAcw']=function(_0x52fedc){try{var _0x5bd982=this;var _0x1e8a98=this[_0x2254('0x8')][_0x52fedc][_0x2254('0x23')];var _0x56b91e=this['channels'][_0x52fedc]['queue'];var _0x540020=this['voiceQueues'][_0x56b91e];var _0x4f797d=![];var _0x1aa71f=_0x2254('0x24');if(_0x540020[_0x2254('0x25')]&&_0x540020[_0x2254('0x26')][_0x2254('0x27')]){_0x4f797d=!![];_0x1aa71f=_0x540020[_0x2254('0x26')]['name'];}if(!_0x5bd982['agents'][_0x1e8a98]){return Promise[_0x2254('0x28')]();}return RpcUser['getAgent'](_0x5bd982[_0x2254('0x6')][_0x1e8a98]['id'])[_0x2254('0x29')](function(_0x31a543){if(!_0x31a543||_0x31a543[_0x2254('0x2a')]){logger[_0x2254('0x1e')]('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x52fedc,_0x1e8a98,_0x56b91e);return;}logger[_0x2254('0x1e')](_0x2254('0x2b'),_0x52fedc,_0x1e8a98,_0x56b91e);var _0x21285d=_0x5bd982[_0x2254('0x8')][_0x52fedc][_0x2254('0x2c')]&&_0x5bd982[_0x2254('0x8')][_0x52fedc][_0x2254('0x2d')]?_0x5bd982[_0x2254('0x8')][_0x52fedc][_0x2254('0x2d')]:_0x52fedc;return RpcUser[_0x2254('0x2e')](_0x5bd982[_0x2254('0x6')][_0x1e8a98],_0x1aa71f,_0x21285d);})[_0x2254('0x29')](function(_0x220f2a){if(_0x4f797d||!_0x220f2a){return;}_0x5bd982[_0x2254('0x7')][_0x1e8a98]={};logger[_0x2254('0x1e')](_0x2254('0x2f'),_0x52fedc,_0x5bd982[_0x2254('0x5')][_0x56b91e][_0x2254('0x30')],_0x1e8a98,_0x56b91e);_0x5bd982[_0x2254('0x7')][_0x1e8a98]['timer']=setTimeout(_0x5bd982[_0x2254('0x31')][_0x2254('0xb')](_0x5bd982,_0x1e8a98),_0x5bd982[_0x2254('0x5')][_0x56b91e][_0x2254('0x30')]*0x3e8);_0x5bd982[_0x2254('0x7')][_0x1e8a98][_0x2254('0x1b')]=moment()[_0x2254('0x32')](_0x2254('0x33'));_0x5bd982[_0x2254('0x7')][_0x1e8a98]['uniqueid']=_0x52fedc;_0x5bd982[_0x2254('0x7')][_0x1e8a98][_0x2254('0x34')]=_0x56b91e;_0x5bd982['timers'][_0x1e8a98][_0x2254('0x1a')]=_0x5bd982[_0x2254('0x1a')][_0x2254('0xb')](_0x5bd982,_0x1e8a98,_0x52fedc);})[_0x2254('0x20')](function(){logger['error']('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x52fedc,_0x5bd982[_0x2254('0x5')][_0x56b91e]['acwTimeout'],_0x1e8a98,_0x56b91e);})[_0x2254('0x22')](function(){delete _0x5bd982[_0x2254('0x8')][_0x52fedc];});}catch(_0x2ba6a1){logger[_0x2254('0x21')](_0x2254('0x35'),_0x2ba6a1[_0x2254('0x36')]);}};Acw[_0x2254('0x19')]['stopAcw']=function(_0x3234d4){try{var _0x192e9f=this;if(_0x192e9f[_0x2254('0x7')][_0x3234d4]){_0x192e9f[_0x2254('0x7')][_0x3234d4][_0x2254('0x1c')]=![];var _0x3f6007=_0x192e9f[_0x2254('0x7')][_0x3234d4][_0x2254('0x37')];var _0x122314=_0x192e9f[_0x2254('0x7')][_0x3234d4]['queue'];var _0x2ce9bf=_0x192e9f[_0x2254('0x5')][_0x122314][_0x2254('0x30')];logger[_0x2254('0x1e')]('[%s][TIMER][STOP][AGENT:%s]',_0x3f6007,_0x3234d4);RpcUser[_0x2254('0x38')](this[_0x2254('0x6')][_0x3234d4]);RpcVoiceAgentReport[_0x2254('0x1d')]({'acwtime':_0x2ce9bf,'agentacw':!![]},_0x3f6007,_0x3234d4)[_0x2254('0x29')](function(_0x216199){logger[_0x2254('0x1e')](_0x2254('0x1f'),_0x3f6007,_0x2ce9bf,_0x216199);})[_0x2254('0x20')](function(_0x4db9a8){logger[_0x2254('0x21')]('[%s][UPDATE][ERRORS:%s]',_0x3f6007,_0x4db9a8);});}else{logger[_0x2254('0x21')](_0x2254('0x39'),_0x3234d4);if(_0x192e9f[_0x2254('0x7')]){logger[_0x2254('0x1e')](_0x2254('0x3a'),JSON[_0x2254('0x3b')](_0x192e9f[_0x2254('0x7')]));}}}catch(_0x568ec9){logger[_0x2254('0x21')](_0x2254('0x3c'),_0x568ec9[_0x2254('0x36')]);}};Acw[_0x2254('0x19')][_0x2254('0xa')]=function(_0x57cda2){try{if(this[_0x2254('0x5')][_0x57cda2[_0x2254('0x34')]]&&(this[_0x2254('0x5')][_0x57cda2[_0x2254('0x34')]][_0x2254('0x3d')]||this['voiceQueues'][_0x57cda2[_0x2254('0x34')]]['mandatoryDisposition'])){if(this[_0x2254('0x6')][_0x57cda2[_0x2254('0x23')]]){this[_0x2254('0x8')][_0x57cda2[_0x2254('0x37')]]={'queue':_0x57cda2[_0x2254('0x34')],'interface':_0x57cda2[_0x2254('0x23')],'destlinkedid':_0x57cda2[_0x2254('0x2d')]};}}}catch(_0x132ef2){logger[_0x2254('0x21')](_0x2254('0x3e'),_0x132ef2[_0x2254('0x36')]);}};Acw[_0x2254('0x19')][_0x2254('0x15')]=function(_0x4a2e6d){try{if(this[_0x2254('0x5')][_0x4a2e6d[_0x2254('0x34')]]&&(this[_0x2254('0x5')][_0x4a2e6d['queue']][_0x2254('0x3d')]||this[_0x2254('0x5')][_0x4a2e6d[_0x2254('0x34')]][_0x2254('0x25')])){if(this[_0x2254('0x6')][_0x4a2e6d[_0x2254('0x23')]]){this[_0x2254('0x8')][_0x4a2e6d[_0x2254('0x37')]]={'queue':_0x4a2e6d[_0x2254('0x34')],'interface':_0x4a2e6d['interface']};}}}catch(_0x239ba0){logger[_0x2254('0x21')](_0x2254('0x3f'),_0x239ba0[_0x2254('0x36')]);}};Acw[_0x2254('0x19')][_0x2254('0xd')]=function(_0x3396c2){try{if(this[_0x2254('0x8')][_0x3396c2[_0x2254('0x37')]]&&_[_0x2254('0x40')](this['channels'][_0x3396c2[_0x2254('0x37')]][_0x2254('0x2c')])){logger['info'](_0x2254('0x41'),_0x3396c2[_0x2254('0x37')]);this[_0x2254('0x42')](_0x3396c2[_0x2254('0x37')]);}else if(this['channels'][_0x3396c2[_0x2254('0x43')]]&&_[_0x2254('0x40')](this['channels'][_0x3396c2[_0x2254('0x43')]][_0x2254('0x2c')])){logger[_0x2254('0x1e')](_0x2254('0x44'),_0x3396c2['linkedid']);this[_0x2254('0x42')](_0x3396c2[_0x2254('0x43')]);}}catch(_0x222a4e){logger['error']('[ACW][syncHangupRequest]\x20%s',_0x222a4e[_0x2254('0x36')]);}};Acw[_0x2254('0x19')]['syncHangup']=function(_0x1cf2a0){try{if(this['channels'][_0x1cf2a0['uniqueid']]&&this[_0x2254('0x8')][_0x1cf2a0[_0x2254('0x37')]][_0x2254('0x2c')]){logger[_0x2254('0x1e')](_0x2254('0x45'),_0x1cf2a0['uniqueid']);this['startAcw'](_0x1cf2a0[_0x2254('0x37')]);}else if(this['channels'][_0x1cf2a0[_0x2254('0x43')]]&&this[_0x2254('0x8')][_0x1cf2a0[_0x2254('0x43')]][_0x2254('0x2c')]){logger['info'](_0x2254('0x46'),_0x1cf2a0[_0x2254('0x43')]);this['startAcw'](_0x1cf2a0['linkedid']);}}catch(_0x1a2973){logger['error'](_0x2254('0x47'),_0x1a2973[_0x2254('0x36')]);}};Acw[_0x2254('0x19')][_0x2254('0x12')]=function(_0x301a12){try{if(!_['isNil'](this['channels'][_0x301a12[_0x2254('0x48')]])){this['startAcw'](_0x301a12[_0x2254('0x48')]);if(this['channels'][_0x301a12['secondtransfereruniqueid']]){this['channels'][_0x301a12[_0x2254('0x49')]][_0x2254('0x2c')]=!![];this[_0x2254('0x8')][_0x301a12[_0x2254('0x4a')]]=this[_0x2254('0x8')][_0x301a12[_0x2254('0x49')]];delete this[_0x2254('0x8')][_0x301a12[_0x2254('0x49')]];}}else if(!_[_0x2254('0x4b')](this[_0x2254('0x8')][_0x301a12[_0x2254('0x4a')]])){this[_0x2254('0x42')](_0x301a12[_0x2254('0x4a')]);if(this[_0x2254('0x8')][_0x301a12[_0x2254('0x4c')]]){this[_0x2254('0x8')][_0x301a12[_0x2254('0x4c')]][_0x2254('0x2c')]=!![];this[_0x2254('0x8')][_0x301a12['transfereeuniqueid']]=this[_0x2254('0x8')][_0x301a12[_0x2254('0x4c')]];delete this[_0x2254('0x8')][_0x301a12[_0x2254('0x4c')]];}}}catch(_0x4c966a){logger['error'](_0x2254('0x4d'),_0x4c966a[_0x2254('0x36')]);}};Acw[_0x2254('0x19')][_0x2254('0x13')]=function(_0x1021b2){try{if(this['channels'][_0x1021b2[_0x2254('0x4e')]]){logger[_0x2254('0x1e')](_0x2254('0x4f'),JSON['stringify'](_0x1021b2['transfereruniqueid']));this[_0x2254('0x42')](_0x1021b2['transfereruniqueid']);}else if(this[_0x2254('0x8')][_0x1021b2[_0x2254('0x50')]]){logger['info'](_0x2254('0x51'),JSON[_0x2254('0x3b')](_0x1021b2['transfererlinkedid']));this[_0x2254('0x42')](_0x1021b2[_0x2254('0x50')]);}}catch(_0x4c6104){logger['error'](_0x2254('0x52'),_0x4c6104[_0x2254('0x36')]);}};Acw['prototype']['syncAgentRingNoAnswer']=function(_0x48406e){try{if(this['voiceQueues'][_0x48406e[_0x2254('0x34')]]&&this['voiceQueues'][_0x48406e[_0x2254('0x34')]][_0x2254('0x53')]===_0x2254('0x54')){if(this[_0x2254('0x6')][_0x48406e['interface']]){logger[_0x2254('0x1e')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x48406e[_0x2254('0x37')],_0x48406e[_0x2254('0x23')],_0x48406e['queue']);return RpcUser[_0x2254('0x2e')](this[_0x2254('0x6')][_0x48406e['interface']],_0x2254('0x55'),_0x48406e[_0x2254('0x37')]);}}}catch(_0x28ef48){logger[_0x2254('0x21')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x28ef48[_0x2254('0x36')]);}};module[_0x2254('0x56')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 191e2e9..e572752 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 _0xde8c=['sippeerstatus','actionQueueSummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','connect','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionSipPeerStatus','[ami.js][fullybooted]','close','asterisk-manager','bluebird','util','../../config/logger','ami','../../config/environment','port','username','password','keepConnected','Action','promisify','action','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','asterisk','inspect','error','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist'];(function(_0x11036a,_0x1c5cc0){var _0x112314=function(_0x208db1){while(--_0x208db1){_0x11036a['push'](_0x11036a['shift']());}};_0x112314(++_0x1c5cc0);}(_0xde8c,0x1cb));var _0xcde8=function(_0x172133,_0x10246b){_0x172133=_0x172133-0x0;var _0x2460e5=_0xde8c[_0x172133];return _0x2460e5;};'use strict';var Manager=require(_0xcde8('0x0'));var BPromise=require(_0xcde8('0x1'));var util=require(_0xcde8('0x2'));var logger=require(_0xcde8('0x3'))(_0xcde8('0x4'));var config=require(_0xcde8('0x5'));var ami=new Manager(config['asterisk'][_0xcde8('0x6')],config['asterisk']['ip'],config['asterisk'][_0xcde8('0x7')],config['asterisk'][_0xcde8('0x8')],!![]);ami[_0xcde8('0x9')]();ami[_0xcde8('0xa')]=BPromise[_0xcde8('0xb')](ami[_0xcde8('0xc')]);function error(_0x5a010e){logger['error'](util[_0xcde8('0xd')](_0xcde8('0xe'),config[_0xcde8('0xf')][_0xcde8('0x7')],config[_0xcde8('0xf')]['ip'],config[_0xcde8('0xf')][_0xcde8('0x6')],util[_0xcde8('0x10')](_0x5a010e,![],null)));}function close(){logger[_0xcde8('0x11')](util[_0xcde8('0xd')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config['asterisk']['username'],config[_0xcde8('0xf')]['ip'],config[_0xcde8('0xf')]['port']));}ami[_0xcde8('0x12')]=function(){return function(){return ami[_0xcde8('0xa')]({'action':_0xcde8('0x13')});};};ami[_0xcde8('0x14')]=function(){return function(){return ami['Action']({'action':_0xcde8('0x15')});};};ami['actionSipPeerStatus']=function(){return function(){return ami['Action']({'action':_0xcde8('0x16')});};};ami[_0xcde8('0x17')]=function(){return function(){return ami[_0xcde8('0xa')]({'action':'queuesummary'});};};ami[_0xcde8('0x18')]=function(){return function(){return ami['Action']({'action':_0xcde8('0x19')});};};function connect(){logger[_0xcde8('0x1a')](util[_0xcde8('0xd')](_0xcde8('0x1b'),config['asterisk'][_0xcde8('0x7')],config[_0xcde8('0xf')]['ip'],config[_0xcde8('0xf')][_0xcde8('0x6')]));ami[_0xcde8('0x1c')](_0xcde8('0x11'),error);ami['once']('close',close);}ami['on'](_0xcde8('0x1d'),connect);ami['on']('shutdown',function(_0x1eb576){logger[_0xcde8('0x1a')](util['format'](_0xcde8('0x1e'),config[_0xcde8('0xf')]['username'],config[_0xcde8('0xf')]['ip'],config['asterisk']['port'],util[_0xcde8('0x10')](_0x1eb576,![],null)));});ami['on']('fullybooted',function(){logger[_0xcde8('0x1a')](util[_0xcde8('0xd')](_0xcde8('0x1f'),config[_0xcde8('0xf')][_0xcde8('0x7')],config['asterisk']['ip'],config[_0xcde8('0xf')][_0xcde8('0x6')]));return Promise[_0xcde8('0x20')]()[_0xcde8('0x21')](ami[_0xcde8('0x12')]())['then'](ami[_0xcde8('0x14')]())[_0xcde8('0x21')](ami[_0xcde8('0x22')]())['then'](ami[_0xcde8('0x17')]())['then'](ami['actionCoreShowChannels']())['catch'](function(_0x4ad996){logger['error'](_0xcde8('0x23'),util['inspect'](_0x4ad996,{'showHidden':![],'depth':null}));});});ami[_0xcde8('0x1c')](_0xcde8('0x11'),error);ami['once'](_0xcde8('0x24'),close);module['exports']=ami; \ No newline at end of file +var _0xe3c5=['info','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionSipShowRegistry','catch','exports','bluebird','../../config/logger','../../config/environment','asterisk','port','username','password','keepConnected','Action','promisify','action','error','format','inspect','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','actionCoreShowChannels','once','close','connect','shutdown'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe3c5,0x1d7));var _0x5e3c=function(_0x3fba9f,_0x3b7b9b){_0x3fba9f=_0x3fba9f-0x0;var _0x192cf1=_0xe3c5[_0x3fba9f];return _0x192cf1;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0x5e3c('0x0'));var util=require('util');var logger=require(_0x5e3c('0x1'))('ami');var config=require(_0x5e3c('0x2'));var ami=new Manager(config[_0x5e3c('0x3')][_0x5e3c('0x4')],config[_0x5e3c('0x3')]['ip'],config[_0x5e3c('0x3')][_0x5e3c('0x5')],config[_0x5e3c('0x3')][_0x5e3c('0x6')],!![]);ami[_0x5e3c('0x7')]();ami[_0x5e3c('0x8')]=BPromise[_0x5e3c('0x9')](ami[_0x5e3c('0xa')]);function error(_0x277858){logger[_0x5e3c('0xb')](util[_0x5e3c('0xc')]('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config[_0x5e3c('0x3')]['username'],config[_0x5e3c('0x3')]['ip'],config[_0x5e3c('0x3')][_0x5e3c('0x4')],util[_0x5e3c('0xd')](_0x277858,![],null)));}function close(){logger[_0x5e3c('0xb')](util[_0x5e3c('0xc')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0x5e3c('0x3')]['username'],config[_0x5e3c('0x3')]['ip'],config[_0x5e3c('0x3')][_0x5e3c('0x4')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x5e3c('0x8')]({'action':'sipshowregistry'});};};ami[_0x5e3c('0xe')]=function(){return function(){return ami['Action']({'action':_0x5e3c('0xf')});};};ami[_0x5e3c('0x10')]=function(){return function(){return ami['Action']({'action':_0x5e3c('0x11')});};};ami[_0x5e3c('0x12')]=function(){return function(){return ami[_0x5e3c('0x8')]({'action':'queuesummary'});};};ami[_0x5e3c('0x13')]=function(){return function(){return ami[_0x5e3c('0x8')]({'action':'coreshowchannels'});};};function connect(){logger['info'](util[_0x5e3c('0xc')]('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config[_0x5e3c('0x3')]['username'],config['asterisk']['ip'],config[_0x5e3c('0x3')][_0x5e3c('0x4')]));ami[_0x5e3c('0x14')]('error',error);ami[_0x5e3c('0x14')](_0x5e3c('0x15'),close);}ami['on'](_0x5e3c('0x16'),connect);ami['on'](_0x5e3c('0x17'),function(_0x33cf08){logger[_0x5e3c('0x18')](util[_0x5e3c('0xc')](_0x5e3c('0x19'),config[_0x5e3c('0x3')][_0x5e3c('0x5')],config[_0x5e3c('0x3')]['ip'],config[_0x5e3c('0x3')][_0x5e3c('0x4')],util['inspect'](_0x33cf08,![],null)));});ami['on'](_0x5e3c('0x1a'),function(){logger[_0x5e3c('0x18')](util[_0x5e3c('0xc')](_0x5e3c('0x1b'),config[_0x5e3c('0x3')][_0x5e3c('0x5')],config[_0x5e3c('0x3')]['ip'],config[_0x5e3c('0x3')][_0x5e3c('0x4')]));return Promise[_0x5e3c('0x1c')]()[_0x5e3c('0x1d')](ami[_0x5e3c('0x1e')]())[_0x5e3c('0x1d')](ami[_0x5e3c('0xe')]())[_0x5e3c('0x1d')](ami['actionSipPeerStatus']())[_0x5e3c('0x1d')](ami[_0x5e3c('0x12')]())['then'](ami[_0x5e3c('0x13')]())[_0x5e3c('0x1f')](function(_0x1e96d3){logger['error']('[ami.js][fullybooted]',util[_0x5e3c('0xd')](_0x1e96d3,{'showHidden':![],'depth':null}));});});ami['once'](_0x5e3c('0xb'),error);ami[_0x5e3c('0x14')]('close',close);module[_0x5e3c('0x20')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 2bda70c..b5cbd46 100644 --- a/server/services/ami/client.js +++ b/server/services/ami/client.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['exports','jayson/promise','../../config/logger','client','Request','debug','rpc','error','memberReport','message','result','catch'];(function(_0x5c2e5e,_0x2bc00e){var _0x46a5da=function(_0xf0fa38){while(--_0xf0fa38){_0x5c2e5e['push'](_0x5c2e5e['shift']());}};_0x46a5da(++_0x2bc00e);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1fc122,_0x5e2c17){_0x1fc122=_0x1fc122-0x0;var _0xa2cb13=_0xb7e7[_0x1fc122];return _0xa2cb13;};'use strict';var jayson=require(_0x7b7e('0x0'));var BPromise=require('bluebird');var logger=require(_0x7b7e('0x1'))('ami');var client=jayson[_0x7b7e('0x2')]['http']({'port':0x2329});client[_0x7b7e('0x3')]=function(_0x556d68,_0x31d0ed){return new BPromise(function(_0x118577,_0x1d9384){return client['request'](_0x556d68,_0x31d0ed)['then'](function(_0x333fa4){logger[_0x7b7e('0x4')](_0x7b7e('0x5'),'memberReport',_0x556d68,_0x31d0ed,_0x333fa4);if(_0x333fa4[_0x7b7e('0x6')]){logger[_0x7b7e('0x6')](_0x7b7e('0x5'),_0x7b7e('0x7'),_0x556d68,_0x333fa4[_0x7b7e('0x6')][_0x7b7e('0x8')],_0x31d0ed);return _0x1d9384(_0x333fa4[_0x7b7e('0x6')]['message']);}else{return _0x118577(_0x333fa4[_0x7b7e('0x9')]);}})[_0x7b7e('0xa')](function(_0x10a666){logger[_0x7b7e('0x6')](_0x7b7e('0x5'),_0x7b7e('0x7'),_0x556d68,_0x10a666,_0x31d0ed);return _0x1d9384(_0x10a666);});});};module[_0x7b7e('0xb')]=client; \ No newline at end of file +var _0xa9e0=['result','catch','exports','jayson/promise','bluebird','../../config/logger','http','request','debug','rpc','error','message'];(function(_0x327e47,_0x1f69a3){var _0xd2b5cd=function(_0x53feec){while(--_0x53feec){_0x327e47['push'](_0x327e47['shift']());}};_0xd2b5cd(++_0x1f69a3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'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 diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index f58299c..1e0ecfe 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 _0x7537=['AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','erlangCalls','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','erlangBusyFactor','merge','getSeconds','debug','name','startProgressive\x20value\x20cleared','startPredictive','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','inspect','contactsRescheduled','message','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contacts','NO_AVAILABLE_CONTACTS','state','statedesc','endtime','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','stringify','pick','Interval','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Intervals','isIVRCampaignActive','INACTIVE','isIVRCampaign','campaign:save','sendMessageOneNotActive','originated','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','is\x20disactive','[ifTime][Action]','Error','isTrunkReachable','active','SIP/%s','status','reachable','unmonitored','prototype','checkIsTrunkReachable','Trunk','TrunkBackup','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','ifTime','Failure','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','push','Action','command','iftime\x20%s,%s','interval','content','indexOf','true','catch','all','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','resetActiveCalls','syncCampaigns','undefined','resolve','dialGlobalInterval','dialTimezone','[syncCampaigns]','checkDialMethod','dialMethod','predictive','progressive','handlePower','dialPowerLevel','Queue','method\x20not\x20recognized','silly','Voice\x20Queue\x20%s\x20$s','intervalIftime','isGlobal','AMI\x20IfTime','queue','uniqueid','ivr','updateOriginated','YYYY-MM-DD\x20HH:mm:ss','outboundAnswerCallsDay','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','moveContactManagedDialer','droptime','responsetime','dialQueueTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','TIMEOUT','dialDropRetryFrequency','callAdditionalPhoneAfterMin','verifyAdditionalPhones','voiceQueue','countdropretry','dialDropMaxRetry','queueCallerAbandonCreateState','additional','rescheduleContact','minutes','ContactId','VoiceQueueId','starttime','calleridname','calleridnum','swapAdditionalPhones','outboundDropCallsDayCallersExit','Abandoned','CALLEREXIT','countabandonedretry','countglobal','dialAbandonedMaxRetry','add','dialAbandonedRetryFrequency','ListId','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','channel','syncQueueMember','actionid','strategy','rrmemory','roundrobin','isNil','locked','stateinterface','idHopper','run','CampaignId','_rr','length','paused','[booked][RR]','Agent:\x20','unlockRR','contactAgent-idHopper:\x20','[Catch][Preview][syncQueueStatusComplete]','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','syncVarSet','amdstatus','xcally-motion-dialer','dialAMDActive','value','HANGUP','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','buildObj','saveInDb','[syncHangupInAMD]','MACHINE','Machine','countmachineretry','amd','createHistory','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','[rescheduleContact][Machine]','custom:amd','[syncHangupInAMDIvr][createHistory]','countagentrejectretry','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','outboundUnknownCallsDay','cause-txt','queuesSummary','running','statusMessage','getQueueCampaignStatusMessage','available','inUse','talking','ACTIVE','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','[syncQueueSummary]','throttle','filter','dialPreviewRecallmeReminder','online','handlePreviewRecallNotifications','map','Agent','user:dialPreviewRecallReminder','checkPreviewRecallReminder','clearZombieChannels','[uniqueid]','[actions]','enqueue','[Dialer][checkChannel]','getVoiceQueueRtPauses','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','emptyContact','notFound','UserId','[emptyContact][createHistory]','launchHandleIvr','handleIvr','object','voiceQueue\x20is\x20undefine','phone','originate','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDAfterGreetingSilence','XMD-AMDMINWORDLENGTH','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','isOutboundQueue','setXMDContactVariables','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','XMD-ORIGINATECALLERIDNAME','extractCalleridName','XMD-ORIGINATECALLERIDNUM','variables','dialPrefix','trim','substring','SIP/%s/%s%s','dialCutDigit','from-sip','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','checkRetriveMax','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','[rescheduleContact][Drop]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','reason','outboundNoSuchCallsDay','NoSuchNumber','reason\x200\x20no\x20such\x20number....','buildNoAnswerEventPayload','custom:agentnoanswer','dialNoAnswerRetryFrequency','[syncAgentComplete][createHistory][3]','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','AgentReject','custom:agentreject','reason\x2020\x20agentreject','Global','Success','[moveContactManagedDialer][0]','outboundDropCallsDayTimeout','round','predictiveIntervalAvailable','predictiveIntervalMinThreshold','floor','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','avgHandleTime','getDataPredictive','startMethodPredictive','recalculate\x20predictive\x20at','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','busyFactor','[getDataPredictive]','check\x20failure','outboundQueuePauses','dialPredictiveOptimizationPercentage','predictiveIntervalPauses','[CatchErlangB]','loggedIn','one\x20call\x20every:','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','unlockContact','outboundReCallsDay','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','getContactDialerIvr','checkContactEmpty','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','checkIsBlackListIvr','loggerHandler','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','temp','not_inuse','getContactDialer','countReScheduled','[countReScheduled]\x20','checkIsBlackList','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','checkContactLowerLimitOriginate','Contact','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','interval\x20=\x20','erlangb','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','p\x20=\x20','exports','util','lodash','moment','ioredis','./utils','./utils/hopper','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/voiceQueueRt','../rpc/interval','./models/action','./models/history','./models/final','./models/agentComplete','./models/queueCallerAbandon','./models/hangup','env','XCALLY_IP_AGI','127.0.0.1','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','startProgressive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','syncHangup','newexten','syncNewExten','queuemember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','then','previewRecallmeReminderInterval','isUndefined','emit','type','outbound','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','format','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','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime'];(function(_0x984ff7,_0x3b21ee){var _0x41942a=function(_0x2c95d9){while(--_0x2c95d9){_0x984ff7['push'](_0x984ff7['shift']());}};_0x41942a(++_0x3b21ee);}(_0x7537,0x1c0));var _0x7753=function(_0x54c9ae,_0x1dd556){_0x54c9ae=_0x54c9ae-0x0;var _0x103004=_0x7537[_0x54c9ae];return _0x103004;};'use strict';var util=require(_0x7753('0x0'));var _=require(_0x7753('0x1'));var uuid=require('uuid');var moment=require(_0x7753('0x2'));var rr=require('rr');var Redis=require(_0x7753('0x3'));var utils=require(_0x7753('0x4'));var hopperUtils=require(_0x7753('0x5'));var ut=require(_0x7753('0x6'));var config=require(_0x7753('0x7'));var logger=require(_0x7753('0x8'))(_0x7753('0x9'));var loggerBooked=require('../../../config/logger')(_0x7753('0xa'));var loggerPredictive=require('../../../config/logger')('predictive');var loggerPredictiveCalls=require(_0x7753('0x8'))('predictiveCalls');var loggerSyncQueueSummary=require(_0x7753('0x8'))(_0x7753('0xb'));var ami=require(_0x7753('0xc'));config[_0x7753('0xd')]=_[_0x7753('0xe')](config['redis'],{'host':_0x7753('0xf'),'port':0x18eb});var io=require(_0x7753('0x10'))(new Redis(config[_0x7753('0xd')]));var cmHopper=require('../rpc/cmHopper');var voiceQueueRt=require(_0x7753('0x11'));var RpcSetting=require('../rpc/setting');var Interval=require(_0x7753('0x12'));var Action=require(_0x7753('0x13'));var History=require(_0x7753('0x14'));var Final=require(_0x7753('0x15'));var AgentComplete=require(_0x7753('0x16'));var QueueCallerAbandon=require(_0x7753('0x17'));var Hangup=require(_0x7753('0x18'));var ipAgi=process[_0x7753('0x19')][_0x7753('0x1a')]||_0x7753('0x1b');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence['prototype']['enqueue']=function(_0x5ee92b){this[_0x7753('0x1c')]=this[_0x7753('0x1c')]?this[_0x7753('0x1c')][_0x7753('0x1d')](_0x5ee92b):_0x5ee92b();};function Dialer(_0x47b000,_0x1e7d7f){this[_0x7753('0x1e')]=new Sequence();this[_0x7753('0x1f')]=_0x1e7d7f;this[_0x7753('0x20')]=_0x47b000[_0x7753('0x20')];this[_0x7753('0x21')]=_0x47b000['campaigns'];this[_0x7753('0x22')]=_0x47b000['agents'];this[_0x7753('0x23')]=_0x47b000[_0x7753('0x23')];this['maxNumberOriginate']=config[_0x7753('0x24')]||0x2;this[_0x7753('0x25')]={};this[_0x7753('0x26')]={};this[_0x7753('0x27')]={};this[_0x7753('0x28')]={};this['optionPredictive']={};this['startPredictive']={};this[_0x7753('0x29')]={};this[_0x7753('0x2a')]={};this[_0x7753('0x2b')]={};this[_0x7753('0x2c')]={};this['queuesSummary']={};ami['on'](_0x7753('0x2d'),this[_0x7753('0x2e')][_0x7753('0x2f')](this));ami['on'](_0x7753('0x30'),this[_0x7753('0x31')][_0x7753('0x2f')](this));ami['on'](_0x7753('0x32'),this[_0x7753('0x33')][_0x7753('0x2f')](this));ami['on'](_0x7753('0x34'),this['syncAgentComplete'][_0x7753('0x2f')](this));ami['on']('custom:queuesummary',this[_0x7753('0xb')][_0x7753('0x2f')](this));ami['on'](_0x7753('0x35'),this[_0x7753('0x36')][_0x7753('0x2f')](this));ami['on'](_0x7753('0x37'),this[_0x7753('0x38')][_0x7753('0x2f')](this));ami['on'](_0x7753('0x39'),this[_0x7753('0x3a')]['bind'](this));ami['on']('varset',this['syncVarSet'][_0x7753('0x2f')](this));ami['on'](_0x7753('0x3b'),this['syncQueueMember'][_0x7753('0x2f')](this));ami['on'](_0x7753('0x3c'),this[_0x7753('0x3d')]['bind'](this));this[_0x7753('0x3e')]();this[_0x7753('0x3f')]();RpcSetting[_0x7753('0x40')]()[_0x7753('0x41')](function(_0x39ac27){previewRecallmeReminderInterval=_0x39ac27[_0x7753('0x42')];});}function isNotNull(_0x3772dd){return _0x3772dd!==null&&!_[_0x7753('0x43')](_0x3772dd);}function msgResponse(_0x40bd12,_0x27bd6d,_0x39f811){return{'action':_0x40bd12,'response':_0x27bd6d,'message':_0x39f811,'stack':_0x39f811};}function emit(_0x43ad11,_0x572c53,_0x36d777){io['to'](_0x43ad11)[_0x7753('0x44')](_0x572c53,_0x36d777);}function emitOutboundVoiceQueueSummary(_0x838e05){if(_0x838e05[_0x7753('0x45')]===_0x7753('0x46')){logger['debug'](_0x7753('0x47'),util['inspect'](_0x838e05,{'showHidden':![],'depth':null}));emit(util[_0x7753('0x48')]('voice:queue:%s',_0x838e05['name']),_0x7753('0x49'),_0x838e05);}}function checkGetDataPredictive(_0x3746d7){if(isNotNull(_0x3746d7)&&!_[_0x7753('0x4a')](_0x3746d7)){loggerPredictive[_0x7753('0x4b')](_0x7753('0x4c'));loggerPredictive[_0x7753('0x4b')](_0x7753('0x4d'),_0x3746d7[_0x7753('0x4e')]);loggerPredictive[_0x7753('0x4b')](_0x7753('0x4f'),_0x3746d7[_0x7753('0x50')]);loggerPredictive[_0x7753('0x4b')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3746d7[_0x7753('0x51')]);loggerPredictive['info']('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3746d7[_0x7753('0x52')]);loggerPredictive[_0x7753('0x4b')](_0x7753('0x53'),_0x3746d7[_0x7753('0x54')]);loggerPredictive[_0x7753('0x4b')](_0x7753('0x55'),_0x3746d7[_0x7753('0x56')]);loggerPredictive[_0x7753('0x4b')](_0x7753('0x57'));if(_0x3746d7[_0x7753('0x4e')]>0x0){if(!_['isUndefined'](_0x3746d7[_0x7753('0x56')])&&_0x3746d7[_0x7753('0x56')]>0x0){return!![];}loggerPredictive[_0x7753('0x4b')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_['isUndefined'](_0x3746d7['predictiveIntervalAvgHoldtime'])&&_0x3746d7['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive[_0x7753('0x4b')](_0x7753('0x58'));}else{loggerPredictive[_0x7753('0x4b')](_0x7753('0x59'));}}else{loggerPredictive['info'](_0x7753('0x5a'));}return![];}function mergeDataErlangB(_0x2dfbaf){return function(_0x4e866c){loggerPredictive['info'](_0x7753('0x5b'));loggerPredictive['info']('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4e866c[_0x7753('0x5c')]);loggerPredictive[_0x7753('0x4b')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4e866c[_0x7753('0x5d')]);loggerPredictive[_0x7753('0x4b')](_0x7753('0x5e'),_0x4e866c[_0x7753('0x5f')]);loggerPredictive['info']('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4e866c[_0x7753('0x60')]);loggerPredictive[_0x7753('0x4b')](_0x7753('0x5e'),_0x4e866c[_0x7753('0x5f')]);loggerPredictive[_0x7753('0x4b')](_0x7753('0x57'));_[_0x7753('0x61')](_0x2dfbaf,_0x4e866c);};}function ifInterval(_0x53ef2f,_0x32ce2e){if(_[_0x7753('0x43')](_0x32ce2e)){return![];}return utils[_0x7753('0x62')](undefined,_0x32ce2e)<_0x53ef2f*0x3c;}function clearPredictiveAttributes(_0x3c8aea){if(_0x3c8aea[_0x7753('0x29')]){_0x3c8aea[_0x7753('0x29')]=undefined;loggerPredictive[_0x7753('0x63')](_0x3c8aea[_0x7753('0x64')],_0x7753('0x65'));}if(_0x3c8aea[_0x7753('0x66')]){_0x3c8aea[_0x7753('0x66')]=undefined;loggerPredictive[_0x7753('0x63')](_0x3c8aea[_0x7753('0x64')],'startPredictive\x20value\x20cleared');}if(_0x3c8aea[_0x7753('0x67')]){clearInterval(_0x3c8aea[_0x7753('0x67')]);_0x3c8aea['handlePredictive']=undefined;loggerPredictive[_0x7753('0x63')](_0x3c8aea['name'],_0x7753('0x68'));}}function loggerCatchPredictive(_0x472a62,_0x14f0f9){return function(_0x27f8dc){loggerPredictive[_0x7753('0x69')](_0x14f0f9[_0x7753('0x64')],_0x472a62);loggerPredictive[_0x7753('0x69')](_0x27f8dc[_0x7753('0x6a')]);clearPredictiveAttributes(_0x14f0f9);};}function loggerCatch(_0x4f9284){return function(_0x2ea058){logger[_0x7753('0x69')](_0x4f9284,util[_0x7753('0x6b')](_0x2ea058,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x48c62b,_0x36ade6,_0x49edc3){return function(_0x585dd6){utils['checkContactLowerLimitOriginate'](_0x36ade6,_0x49edc3,0x0);logger['error'](_0x48c62b,util[_0x7753('0x6b')](_0x585dd6,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x24d9e3){return function(_0x2a3443){if(isNotNull(_0x2a3443)&&isNotNull(_0x2a3443[0x0])){if(_0x2a3443[0x0][_0x7753('0x6c')]>0x0){_0x24d9e3[_0x7753('0x6d')]=utils[_0x7753('0x6e')][_0x7753('0x6f')];logger[_0x7753('0x4b')](_0x7753('0x70')+_0x24d9e3['name'],_0x2a3443[0x0][_0x7753('0x6c')],_0x7753('0x71'));}else{_0x24d9e3[_0x7753('0x6d')]=utils['CAMPAIGN_STATUS'][_0x7753('0x72')];logger[_0x7753('0x4b')]('[getContactDialer2][Empty]'+_0x24d9e3[_0x7753('0x64')]);}}};}function createObjHistory(_0x335c71,_0x39e16f,_0x5506ee,_0x481aea,_0x2a8fc0){_0x335c71[_0x7753('0x6d')]=_0x5506ee;var _0x4ae735=new Action(_0x335c71,_0x39e16f);var _0x1690e1=new History(_0x4ae735);_0x1690e1[_0x7753('0x73')]=_0x481aea;_0x1690e1[_0x7753('0x74')]=_0x2a8fc0;_0x1690e1[_0x7753('0x75')]=_0x4ae735['starttime'];return _0x1690e1;}function unlockQueueStatus(_0x1b9c1a,_0x1f9825){setTimeout(function(){if(_[_0x7753('0x43')](_0x1b9c1a[_0x7753('0x76')])){loggerBooked[_0x7753('0x69')](_0x7753('0x77'),_0x1f9825);}_0x1b9c1a[_0x7753('0x76')]=!![];loggerBooked[_0x7753('0x4b')](_0x7753('0x78'),_0x1f9825,JSON[_0x7753('0x79')](_[_0x7753('0x7a')](_0x1b9c1a,[_0x7753('0x64'),_0x7753('0x76')])));},0x1f3);}function checkInterval(_0x134f99){return function(){if(!isNotNull(_0x134f99[_0x7753('0x7b')])){_0x134f99[_0x7753('0x6d')]=utils[_0x7753('0x6e')][_0x7753('0x7c')];throw _0x134f99['name']+_0x7753('0x7d');}if(!isNotNull(_0x134f99['Interval'][_0x7753('0x7e')])){_0x134f99[_0x7753('0x6d')]=utils['CAMPAIGN_STATUS'][_0x7753('0x7c')];throw _0x134f99['name']+_0x7753('0x7d');}if(!isNotNull(_['isEmpty'](_0x134f99[_0x7753('0x7b')][_0x7753('0x7e')]))){_0x134f99[_0x7753('0x6d')]=utils[_0x7753('0x6e')]['NULL_INTERVAL'];throw _0x134f99[_0x7753('0x64')]+'\x20INTERVAL_IS_NULL';}};}function checkIsIVRCampaignActive(_0xd4d088){return function(){if(!utils[_0x7753('0x7f')](_0xd4d088)){_0xd4d088[_0x7753('0x6d')]=utils[_0x7753('0x6e')][_0x7753('0x80')];throw _0xd4d088['name']+'\x20NOT\x20Active';}};}function emitCampaignSummary(_0x3ba7c2){if(utils[_0x7753('0x81')](_0x3ba7c2)){emit(util[_0x7753('0x48')]('campaign:ivr:%s',_0x3ba7c2['name']),_0x7753('0x82'),_0x3ba7c2);}}function loggerCatchQueueSummary(_0x29cca1,_0xe61899){return function(_0x3911ed){clearPredictiveAttributes(_0xe61899);emitCampaignSummary(_0xe61899);loggerSyncQueueSummary[_0x7753('0x63')](_0x29cca1,util[_0x7753('0x6b')](_0x3911ed,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x266b8b){if(_0x266b8b[_0x7753('0x83')]){if(_0x266b8b[_0x7753('0x84')]===0x0){_0x266b8b[_0x7753('0x83')]=![];_0x266b8b[_0x7753('0x6d')]=utils['CAMPAIGN_STATUS']['INACTIVE'];loggerSyncQueueSummary[_0x7753('0x63')](_0x7753('0x85'),_0x266b8b[_0x7753('0x64')],_0x7753('0x86'));}else{_0x266b8b[_0x7753('0x6d')]=utils[_0x7753('0x6e')]['DISACTIVED'];loggerSyncQueueSummary[_0x7753('0x63')](_0x7753('0x85'),_0x266b8b[_0x7753('0x64')],_0x7753('0x87'));}emitCampaignSummary(_0x266b8b);}}function myreject(_0x489a8c){return function(_0x2b3031){return _0x489a8c(msgResponse(_0x7753('0x88'),_0x7753('0x89'),JSON[_0x7753('0x79')](_0x2b3031)));};}Dialer['prototype'][_0x7753('0x8a')]=function(_0x9abf45){return!_['isUndefined'](_0x9abf45)&&_0x9abf45&&!_['isUndefined'](_0x9abf45[_0x7753('0x64')])&&!_[_0x7753('0x43')](_0x9abf45['active'])&&_0x9abf45[_0x7753('0x8b')]&&(this[_0x7753('0x23')][util['format'](_0x7753('0x8c'),_0x9abf45['name'])][_0x7753('0x8d')]===_0x7753('0x8e')||this[_0x7753('0x23')][util[_0x7753('0x48')](_0x7753('0x8c'),_0x9abf45[_0x7753('0x64')])][_0x7753('0x8d')]===_0x7753('0x8f'));};Dialer[_0x7753('0x90')][_0x7753('0x91')]=function(_0x5a6f2d){var _0x3dddc6=this;return function(){if(!_0x3dddc6[_0x7753('0x8a')](_0x5a6f2d[_0x7753('0x92')])){if(!_0x3dddc6[_0x7753('0x8a')](_0x5a6f2d[_0x7753('0x93')])){_0x5a6f2d['message']=utils['CAMPAIGN_STATUS'][_0x7753('0x94')];throw _0x5a6f2d['name']+_0x7753('0x95');}}};};Dialer[_0x7753('0x90')][_0x7753('0x96')]=function(_0x36c50d,_0x1e37ec,_0x29529f,_0x33830b){var _0x49c13f=this;return function(){var _0x350658=!![];return _0x49c13f['ifTimeIvr'](_0x36c50d,_0x1e37ec,_0x29529f,_0x33830b,_0x350658);};};Dialer[_0x7753('0x90')]['checkIfTimeIntervals']=function(_0x18ba95,_0x37eba1,_0x11d305,_0x589fa1){var _0xfef30a=this;return function(){var _0x51ba09=![];return _0xfef30a['ifTimeIvr'](_0x18ba95[_0x7753('0x7e')],_0x37eba1,_0x11d305,_0x589fa1,_0x51ba09);};};Dialer[_0x7753('0x90')][_0x7753('0x97')]=function(_0x32515a,_0x47066d,_0x3989e3,_0xf0092b,_0x19f9e4){var _0xc16310=[];return new Promise(function(_0x1e37e0,_0x396fc0){if(!isNotNull(_0x32515a)){_0xf0092b['message']=utils[_0x7753('0x6e')]['NULL_INTERVAL'];return _0x396fc0(msgResponse(_0x7753('0x98'),_0x7753('0x99'),_0x3989e3+_0x7753('0x9a')));}if(_[_0x7753('0x4a')](_0x32515a)){_0xf0092b[_0x7753('0x6d')]=utils[_0x7753('0x6e')][_0x7753('0x9b')];return _0x396fc0(msgResponse(_0x7753('0x98'),_0x7753('0x99'),_0x3989e3+_0x7753('0x9c')));}if(_0x47066d&&_['isUndefined'](config[_0x7753('0x9d')][_0x47066d])){_0xf0092b[_0x7753('0x6d')]=utils[_0x7753('0x6e')][_0x7753('0x9e')];return _0x396fc0(msgResponse(_0x7753('0x98'),_0x7753('0x99'),_0x3989e3+_0x7753('0x9f')+_0x47066d));}if(_['isArray'](_0x32515a)){for(var _0x574e1e=0x0;_0x574e1e<_0x32515a['length'];_0x574e1e+=0x1){_0xc16310[_0x7753('0xa0')](ami[_0x7753('0xa1')]({'action':_0x7753('0xa2'),'command':util[_0x7753('0x48')](_0x7753('0xa3'),_0x32515a[_0x574e1e][_0x7753('0xa4')],!_['isUndefined'](config['timezones'][_0x47066d])?_0x47066d:'')})[_0x7753('0x41')](function(_0x43ab70){return _0x43ab70[_0x7753('0xa5')][_0x7753('0xa6')](_0x7753('0xa7'))>=0x0;})[_0x7753('0xa8')](myreject(_0x396fc0)));}}else{_0xc16310[_0x7753('0xa0')](ami[_0x7753('0xa1')]({'action':_0x7753('0xa2'),'command':util[_0x7753('0x48')](_0x7753('0xa3'),_0x32515a,!_[_0x7753('0x43')](config['timezones'][_0x47066d])?_0x47066d:'')})[_0x7753('0x41')](function(_0x4a510c){return _0x4a510c[_0x7753('0xa5')][_0x7753('0xa6')](_0x7753('0xa7'))>=0x0;})['catch'](myreject(_0x396fc0)));}Promise[_0x7753('0xa9')](_0xc16310)['then'](function(_0x410b65){var _0x3b58f8=_['some'](_0x410b65);if(_0x3b58f8){return _0x1e37e0(_0x3b58f8);}else{_0xf0092b['message']=_0x19f9e4?utils['CAMPAIGN_STATUS'][_0x7753('0xaa')]:utils[_0x7753('0x6e')][_0x7753('0xab')];return _0x396fc0(msgResponse(_0x7753('0xac'),_0x7753('0x99'),_0x7753('0xad')+_0x19f9e4+'\x20'+_0x3989e3+_0x7753('0xae')+util[_0x7753('0x6b')](_0x32515a,{'showHidden':![],'depth':null})+_0x7753('0xaf')+_0x47066d));}})[_0x7753('0xa8')](function(_0x54ddb5){return _0x396fc0(msgResponse(_0x7753('0x98'),'Failure',JSON['stringify'](_0x54ddb5)));});});};Dialer[_0x7753('0x90')]['loopCampaigns']=function(){var _0x18866f=this;return cmHopper[_0x7753('0xb0')]({'active':![]},{'where':{'active':!![]}})[_0x7753('0x41')](function(){setInterval(function(){_0x18866f[_0x7753('0xb1')]();},0x3e8);});};Dialer[_0x7753('0x90')][_0x7753('0xb1')]=function(){var _0x27ab94=this;var _0x3e31a9;for(var _0x18ab20 in this[_0x7753('0x21')]){if(typeof this['campaigns'][_0x18ab20]!==_0x7753('0xb2')){_0x3e31a9=this[_0x7753('0x21')][_0x18ab20];if(utils[_0x7753('0x81')](_0x3e31a9)&&utils[_0x7753('0x7f')](_0x3e31a9)){_0x3e31a9[_0x7753('0x83')]=!![];Promise[_0x7753('0xb3')]()[_0x7753('0x41')](checkIsIVRCampaignActive(_0x3e31a9))['then'](checkInterval(_0x3e31a9))['then'](_0x27ab94[_0x7753('0x91')](_0x3e31a9))[_0x7753('0x41')](_0x27ab94['checkIfTime'](_0x3e31a9[_0x7753('0xb4')],_0x3e31a9[_0x7753('0xb5')],_0x3e31a9[_0x7753('0x64')],_0x3e31a9))[_0x7753('0x41')](_0x27ab94['checkIfTimeIntervals'](_0x3e31a9[_0x7753('0x7b')],_0x3e31a9[_0x7753('0xb5')],_0x3e31a9['name'],_0x3e31a9))[_0x7753('0x41')](_0x27ab94['launchHandleIvr'](_0x3e31a9))[_0x7753('0xa8')](loggerCatchQueueSummary(_0x7753('0xb6'),_0x3e31a9));}else{notSendMessagesCampaign(_0x3e31a9);}}}};Dialer[_0x7753('0x90')][_0x7753('0xb7')]=function(_0x261a94){if(_0x261a94[_0x7753('0xb8')]!==_0x7753('0xb9')){clearPredictiveAttributes(_0x261a94);}switch(_0x261a94[_0x7753('0xb8')]){case _0x7753('0xba'):this[_0x7753('0xbb')](_0x261a94,0x1);break;case'power':this[_0x7753('0xbb')](_0x261a94,_0x261a94[_0x7753('0xbc')]);break;case _0x7753('0xb9'):this[_0x7753('0xb9')](_0x261a94);break;case'booked':this[_0x7753('0xbb')](_0x261a94,0x1);break;default:logger[_0x7753('0x69')](_0x7753('0xbd'),_0x261a94[_0x7753('0x64')],_0x7753('0xbe'));}};Dialer[_0x7753('0x90')]['ifTime']=function(_0x49a03f,_0x1ff093){var _0x300ae3=_0x49a03f[_0x7753('0xb5')];var _0x521a08=_0x1ff093?_0x49a03f[_0x7753('0xb4')]:_0x49a03f[_0x7753('0x7b')][_0x7753('0x7e')];logger[_0x7753('0xbf')]('Dialer::ifTime()',_0x521a08,_0x300ae3,_0x49a03f[_0x7753('0x64')],util['format'](_0x7753('0xc0'),_0x49a03f['name'],_0x49a03f['id']));var _0x23b7d7=null;return Interval[_0x7753('0xc1')](_0x521a08,_0x300ae3)[_0x7753('0x41')](function(_0x4d9a7b){if(_0x4d9a7b===!![]){return _0x4d9a7b;}else{_0x49a03f[_0x7753('0x6d')]=_0x1ff093?utils[_0x7753('0x6e')]['OVERTIME_GLOBAL_INTERVAL']:utils[_0x7753('0x6e')][_0x7753('0xab')];_0x23b7d7=msgResponse(_0x7753('0xac'),_0x7753('0x99'),_0x7753('0xad')+_0x1ff093+'\x20'+_0x49a03f['name']+_0x7753('0xae')+util[_0x7753('0x6b')](_0x521a08,{'showHidden':![],'depth':null})+_0x7753('0xaf')+_0x300ae3);}if(_0x23b7d7!==null){logger[_0x7753('0xbf')]('Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:',_0x23b7d7);_0x23b7d7[_0x7753('0xc2')]=_0x1ff093;throw _0x23b7d7;}})['catch'](function(_0x35b821){logger['error'](_0x7753('0xc3'),_0x35b821);throw msgResponse(_0x7753('0x88'),_0x7753('0x89'),util[_0x7753('0x6b')](_0x35b821,{'showHidden':![],'depth':null}));});};Dialer[_0x7753('0x90')][_0x7753('0x2e')]=function(_0x9ecedf){if(this['voiceQueues'][_0x9ecedf[_0x7753('0xc4')]]){if(this[_0x7753('0x28')][_0x9ecedf['uniqueid']]&&this[_0x7753('0x28')][_0x9ecedf[_0x7753('0xc5')]][_0x7753('0x45')]!==_0x7753('0xc6')){this[_0x7753('0xc7')](this[_0x7753('0x20')][_0x9ecedf[_0x7753('0xc4')]]);this[_0x7753('0x28')][_0x9ecedf[_0x7753('0xc5')]]['answertime']=moment()['format'](_0x7753('0xc8'));}}};Dialer[_0x7753('0x90')]['syncAgentComplete']=function(_0x4fc0ba){var _0x4d640a=this[_0x7753('0x28')][_0x4fc0ba['uniqueid']];if(this[_0x7753('0x20')][_0x4fc0ba[_0x7753('0xc4')]]){if(_0x4d640a&&_0x4d640a[_0x7753('0x45')]!==_0x7753('0xc6')){delete this[_0x7753('0x28')][_0x4fc0ba[_0x7753('0xc5')]];this[_0x7753('0x20')][_0x4fc0ba[_0x7753('0xc4')]][_0x7753('0xc9')]+=0x1;var _0x4eea51=new AgentComplete(_0x4d640a,_0x4fc0ba);if(_0x4fc0ba['reason']===_0x7753('0xca')){_0x4eea51[_0x7753('0xcb')]=this[_0x7753('0x20')][_0x4fc0ba['queue']][_0x7753('0xcc')]&&this[_0x7753('0x20')][_0x4fc0ba[_0x7753('0xc4')]][_0x7753('0xcd')]?moment()[_0x7753('0x48')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}hopperUtils['createHistory'](_0x4eea51)[_0x7753('0xa8')](loggerCatch(_0x7753('0xce')));hopperUtils[_0x7753('0xcf')](_0x4eea51)[_0x7753('0xa8')](loggerCatch('[syncAgentComplete]'));}}};Dialer[_0x7753('0x90')][_0x7753('0x31')]=function(_0x4a3a7f){var _0x104fcf=this['uniqueId'][_0x4a3a7f['uniqueid']];var _0xf2c375=this;var _0xa5eb8a=![];var _0x565118;var _0x4630dd;if(this[_0x7753('0x20')][_0x4a3a7f['queue']]){if(_0x104fcf&&_0x104fcf[_0x7753('0x45')]!=='ivr'){delete this['uniqueId'][_0x4a3a7f['uniqueid']];this[_0x7753('0xc7')](this[_0x7753('0x20')][_0x4a3a7f[_0x7753('0xc4')]]);_0x104fcf[_0x7753('0xd0')]=moment()[_0x7753('0x48')]('YYYY-MM-DD\x20HH:mm:ss');var _0x3de8bc=new QueueCallerAbandon(_0x104fcf,_0x4a3a7f);if(utils[_0x7753('0x62')](_0x104fcf[_0x7753('0xd0')],_0x104fcf[_0x7753('0xd1')])>=_0x104fcf[_0x7753('0xd2')]){this[_0x7753('0x20')][_0x4a3a7f[_0x7753('0xc4')]][_0x7753('0x51')]+=0x1;this['voiceQueues'][_0x4a3a7f['queue']]['outboundDropCallsDayTimeout']+=0x1;this[_0x7753('0x20')][_0x4a3a7f[_0x7753('0xc4')]][_0x7753('0xd3')]+=0x1;_0x3de8bc[_0x7753('0x73')]=0xa;_0x3de8bc[_0x7753('0x74')]=_0x7753('0xd4');_0x3de8bc['dropreason']=_0x7753('0xd5');_0x3de8bc[_0x7753('0xcb')]=this['voiceQueues'][_0x4a3a7f[_0x7753('0xc4')]][_0x7753('0xcc')]?moment()[_0x7753('0x48')](_0x7753('0xc8')):undefined;_0x3de8bc['countdropretry']+=0x1;_0x3de8bc['countglobal']+=0x1;_0x565118=this['voiceQueues'][_0x4a3a7f[_0x7753('0xc4')]][_0x7753('0xd6')];_0x4630dd=this['voiceQueues'][_0x4a3a7f[_0x7753('0xc4')]][_0x7753('0xd7')];hopperUtils[_0x7753('0xd8')](_0x3de8bc,_0x3de8bc[_0x7753('0x73')],_0x104fcf[_0x7753('0xd9')])[_0x7753('0x41')](function(_0x17e58c){_0xa5eb8a=_0x17e58c['additional']==0x1;if(_0x3de8bc[_0x7753('0xda')]>=_0xf2c375[_0x7753('0x20')][_0x4a3a7f[_0x7753('0xc4')]][_0x7753('0xdb')]){_0xf2c375[_0x7753('0xdc')](_0x3de8bc,_0x17e58c[_0x7753('0xdd')]);}else{hopperUtils[_0x7753('0xde')]({'active':![],'countdropretry':_0x3de8bc[_0x7753('0xda')],'scheduledat':moment()['add'](_0xf2c375[_0x7753('0x20')][_0x4a3a7f[_0x7753('0xc4')]][_0x7753('0xd6')],_0x7753('0xdf'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x104fcf[_0x7753('0xe0')],'ListId':_0x104fcf['ListId'],'VoiceQueueId':_0x104fcf[_0x7753('0xe1')]||undefined,'CampaignId':_0x104fcf['CampaignId']||undefined})[_0x7753('0xa8')](loggerCatch('[rescheduleContact][Drop]'));var _0xd8a0cd=new History(_0x3de8bc);_0xd8a0cd[_0x7753('0x73')]=0xa;_0xd8a0cd['statedesc']=_0x7753('0xd4');_0xd8a0cd[_0x7753('0xe2')]=moment()[_0x7753('0x48')](_0x7753('0xc8'));_0xd8a0cd[_0x7753('0x75')]=_0xd8a0cd[_0x7753('0xe2')];_0xd8a0cd[_0x7753('0xe3')]=_0x3de8bc[_0x7753('0xe3')];_0xd8a0cd[_0x7753('0xe4')]=_0x3de8bc[_0x7753('0xe4')];hopperUtils['createHistory'](_0xd8a0cd)[_0x7753('0xa8')](loggerCatch('[syncAgentComplete][createHistory][10]'));}})[_0x7753('0x41')](function(){if(_0xa5eb8a)hopperUtils[_0x7753('0xe5')](_0x3de8bc,_0x565118,_0x4630dd)[_0x7753('0x41')](function(){return 0x1;});});}else{this['voiceQueues'][_0x4a3a7f['queue']]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0x7753('0x20')][_0x4a3a7f['queue']][_0x7753('0xe6')]+=0x1;_0x3de8bc[_0x7753('0x73')]=0xb;_0x3de8bc[_0x7753('0x74')]=_0x7753('0xe7');_0x3de8bc['dropreason']=_0x7753('0xe8');_0x3de8bc[_0x7753('0xe9')]+=0x1;_0x3de8bc[_0x7753('0xea')]+=0x1;_0x565118=this[_0x7753('0x20')][_0x4a3a7f['queue']]['dialAbandonedRetryFrequency'];_0x4630dd=this[_0x7753('0x20')][_0x4a3a7f[_0x7753('0xc4')]][_0x7753('0xd7')];hopperUtils[_0x7753('0xd8')](_0x3de8bc,_0x3de8bc[_0x7753('0x73')],_0x104fcf[_0x7753('0xd9')])[_0x7753('0x41')](function(_0x1e7eac){if(_0x3de8bc[_0x7753('0xe9')]>=_0xf2c375[_0x7753('0x20')][_0x4a3a7f[_0x7753('0xc4')]][_0x7753('0xeb')]){_0xf2c375[_0x7753('0xdc')](_0x3de8bc,_0x1e7eac['additional']);}else{hopperUtils[_0x7753('0xde')]({'active':![],'countabandonedretry':_0x3de8bc[_0x7753('0xe9')],'scheduledat':moment()[_0x7753('0xec')](_0xf2c375[_0x7753('0x20')][_0x4a3a7f[_0x7753('0xc4')]][_0x7753('0xed')],_0x7753('0xdf'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x104fcf[_0x7753('0xe0')],'ListId':_0x104fcf[_0x7753('0xee')],'VoiceQueueId':_0x104fcf[_0x7753('0xe1')]||undefined,'CampaignId':_0x104fcf['CampaignId']||undefined})[_0x7753('0xa8')](loggerCatch(_0x7753('0xef')));var _0x74ef6a=new History(_0x3de8bc);_0x74ef6a[_0x7753('0x73')]=0xb;_0x74ef6a['statedesc']=_0x7753('0xe7');_0x74ef6a[_0x7753('0xe2')]=moment()['format'](_0x7753('0xc8'));_0x74ef6a['endtime']=_0x74ef6a[_0x7753('0xe2')];_0x74ef6a['calleridname']=_0x3de8bc[_0x7753('0xe3')];_0x74ef6a['calleridnum']=_0x3de8bc['calleridnum'];hopperUtils['createHistory'](_0x74ef6a)[_0x7753('0xa8')](loggerCatch(_0x7753('0xf0')));}})[_0x7753('0x41')](function(){if(_0xa5eb8a)hopperUtils['swapAdditionalPhones'](_0x3de8bc,_0x565118,_0x4630dd)[_0x7753('0x41')](function(){return 0x1;});});}}}};Dialer[_0x7753('0x90')][_0x7753('0x3a')]=function(_0x4054f6){if(this[_0x7753('0x26')][_0x4054f6[_0x7753('0xc5')]]){this[_0x7753('0x26')][_0x4054f6[_0x7753('0xc5')]][_0x7753('0xf1')]=_0x4054f6['channel'];}if(this[_0x7753('0x28')][_0x4054f6[_0x7753('0xc5')]]){this[_0x7753('0x28')][_0x4054f6[_0x7753('0xc5')]]['channel']=_0x4054f6[_0x7753('0xf1')];}};Dialer[_0x7753('0x90')][_0x7753('0xf2')]=function(_0x2decbb){if(!this[_0x7753('0x26')][_0x2decbb[_0x7753('0xf3')]]){return;}var _0x8e830b=this[_0x7753('0x20')][this['actions'][_0x2decbb[_0x7753('0xf3')]][_0x7753('0xc4')]][_0x7753('0xf4')]||_0x7753('0xf5');if(_0x8e830b===_0x7753('0xf6')){if(this[_0x7753('0x26')][_0x2decbb[_0x7753('0xf3')]]&&_[_0x7753('0xf7')](this[_0x7753('0x26')][_0x2decbb['actionid']][_0x7753('0xf8')])&&_0x2decbb[_0x7753('0x8d')]==='1'&&_0x2decbb['paused']==='0'){if(this[_0x7753('0x22')][_0x2decbb[_0x7753('0xf9')]]){if(!this[_0x7753('0x22')][_0x2decbb[_0x7753('0xf9')]]['locked']){this[_0x7753('0x22')][_0x2decbb[_0x7753('0xf9')]][_0x7753('0xf8')]=!![];this[_0x7753('0x26')][_0x2decbb[_0x7753('0xf3')]][_0x7753('0xf8')]=!![];this[_0x7753('0x26')][_0x2decbb[_0x7753('0xf3')]][_0x7753('0xf9')]=_0x2decbb[_0x7753('0xf9')];}}}}else if(_0x8e830b==='rrmemory'){if(this[_0x7753('0x26')][_0x2decbb[_0x7753('0xf3')]]){if(this[_0x7753('0x22')][_0x2decbb[_0x7753('0xf9')]]){this[_0x7753('0x26')][_0x2decbb[_0x7753('0xf3')]][_0x7753('0xf9')]=_0x2decbb[_0x7753('0xf9')];if(_[_0x7753('0xf7')](this['queueBooked'][this[_0x7753('0x26')][_0x2decbb['actionid']][_0x7753('0xc4')]])){this[_0x7753('0x2b')][this[_0x7753('0x26')][_0x2decbb['actionid']][_0x7753('0xc4')]]=[];}this[_0x7753('0x2b')][this[_0x7753('0x26')][_0x2decbb['actionid']]['queue']][_0x7753('0xa0')](_[_0x7753('0x61')](_[_0x7753('0x7a')](this['actions'][_0x2decbb[_0x7753('0xf3')]],[_0x7753('0xfa'),_0x7753('0xf9')]),{'status':_0x2decbb[_0x7753('0x8d')],'paused':_0x2decbb['paused']}));}}}};Dialer[_0x7753('0x90')][_0x7753('0x3d')]=function(_0x507c1c){if(!this[_0x7753('0x26')][_0x507c1c['actionid']]){return;}var _0xa433d5=this;var _0x168fca=this[_0x7753('0x20')][this[_0x7753('0x26')][_0x507c1c['actionid']][_0x7753('0xc4')]];var _0x236055=_0x168fca['strategy']||'rrmemory';if(_0x236055===_0x7753('0xf6')){if(this[_0x7753('0x26')][_0x507c1c[_0x7753('0xf3')]]&&this[_0x7753('0x26')][_0x507c1c[_0x7753('0xf3')]]['stateinterface']){this['preview'][_0x7753('0xfb')](this[_0x7753('0x26')][_0x507c1c[_0x7753('0xf3')]][_0x7753('0xfa')],this[_0x7753('0x26')][_0x507c1c[_0x7753('0xf3')]]['stateinterface'])[_0x7753('0xa8')](function(_0x135af0){logger['error']('[Catch][Preview][syncQueueStatusComplete]',util['inspect'](_0x135af0,{'showHidden':![],'depth':null}));})[_0x7753('0x1d')](function(){_0xa433d5[_0x7753('0xc7')](_0xa433d5[_0x7753('0x20')][_0xa433d5[_0x7753('0x26')][_0x507c1c[_0x7753('0xf3')]][_0x7753('0xc4')]]);_0xa433d5[_0x7753('0x22')][_0xa433d5[_0x7753('0x26')][_0x507c1c['actionid']][_0x7753('0xf9')]][_0x7753('0xf8')]=![];delete _0xa433d5[_0x7753('0x26')][_0x507c1c['actionid']];unlockQueueStatus(_0x168fca);});}else{this[_0x7753('0xc7')](this[_0x7753('0x20')][this[_0x7753('0x26')][_0x507c1c['actionid']][_0x7753('0xc4')]]);hopperUtils[_0x7753('0xde')]({'active':![],'ContactId':this[_0x7753('0x26')][_0x507c1c['actionid']][_0x7753('0xe0')],'ListId':this[_0x7753('0x26')][_0x507c1c['actionid']][_0x7753('0xee')],'VoiceQueueId':this[_0x7753('0x26')][_0x507c1c['actionid']][_0x7753('0xe1')]||undefined,'CampaignId':this[_0x7753('0x26')][_0x507c1c['actionid']][_0x7753('0xfc')]||undefined})[_0x7753('0xa8')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0x7753('0x26')][_0x507c1c[_0x7753('0xf3')]];unlockQueueStatus(_0x168fca);}}else if(_0x236055===_0x7753('0xf5')){var _0x5a8bff;if(this[_0x7753('0x26')][_0x507c1c[_0x7753('0xf3')]]&&!_[_0x7753('0x4a')](this[_0x7753('0x2b')][this[_0x7753('0x26')][_0x507c1c['actionid']][_0x7753('0xc4')]])){if(this[_0x7753('0x2c')][_0xa433d5[_0x7753('0x26')][_0x507c1c[_0x7753('0xf3')]][_0x7753('0xc4')]]){this['queueBookedRR'][_0xa433d5[_0x7753('0x26')][_0x507c1c[_0x7753('0xf3')]][_0x7753('0xc4')]]=this[_0x7753('0x2c')][this[_0x7753('0x26')][_0x507c1c['actionid']][_0x7753('0xc4')]]?this['queueBookedRR'][this['actions'][_0x507c1c['actionid']][_0x7753('0xc4')]]:this[_0x7753('0x2b')][this[_0x7753('0x26')][_0x507c1c[_0x7753('0xf3')]][_0x7753('0xc4')]]?this[_0x7753('0x2b')][this['actions'][_0x507c1c[_0x7753('0xf3')]][_0x7753('0xc4')]][_0x7753('0xfd')]||0x0:0x0;}this[_0x7753('0x2b')][this[_0x7753('0x26')][_0x507c1c[_0x7753('0xf3')]][_0x7753('0xc4')]]['_rr']=this[_0x7753('0x2c')][this[_0x7753('0x26')][_0x507c1c[_0x7753('0xf3')]][_0x7753('0xc4')]];for(var _0x3d3a87=0x0;_0x3d3a87=_0x4eb6e2[_0x7753('0x125')]){_0x50ecc6[_0x7753('0x126')](_0x40a90d,_0x5d0481,_0x1930e7,_0x7753('0x127'));}else{if(_0x40a90d[_0x7753('0x11d')]>=_0x4eb6e2[_0x7753('0x128')]){_0x50ecc6[_0x7753('0x129')](_0x40a90d,_0x5d0481,_0x1930e7,_0x7753('0x12a'));}else{hopperUtils[_0x7753('0xde')]({'active':![],'countmachineretry':_0x40a90d[_0x7753('0x11d')],'scheduledat':moment()[_0x7753('0xec')](_0x4eb6e2[_0x7753('0x12b')],_0x7753('0xdf'))[_0x7753('0x48')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x40a90d[_0x7753('0xe0')],'ListId':_0x40a90d['ListId'],'VoiceQueueId':_0x40a90d['VoiceQueueId']||undefined,'CampaignId':_0x40a90d[_0x7753('0xfc')]||undefined})[_0x7753('0xa8')](loggerCatch(_0x7753('0x12c')));_0x5d0481({'reschedule':0x1});}}});}if(_0x214881[_0x7753('0x45')]==='ivr'&&this[_0x7753('0x21')][_0x214881[_0x7753('0xc4')]][_0x7753('0x111')]&&_0x21a1eb[_0x7753('0x112')]==='HANGUP'){delete this[_0x7753('0x28')][_0x21a1eb[_0x7753('0xc5')]];this[_0x7753('0xc7')](this[_0x7753('0x21')][_0x214881[_0x7753('0xc4')]]);_0x5582cc=new Hangup(_0x214881,_0x21a1eb);_0x5582cc[_0x7753('0x73')]=0x12;_0x5582cc[_0x7753('0x74')]=_0x7753('0x115');_0x5582cc['membername']=_0x7753('0x117');ami[_0x7753('0x44')](_0x7753('0x12d'),ut[_0x7753('0x118')](_0x5582cc,_0x7753('0x11e')));this[_0x7753('0x119')](_0x5582cc,_0x7753('0x12e'),'[syncHangupInAMDIvr]');}if(_0x214881[_0x7753('0x45')]===_0x7753('0xc6')&&this[_0x7753('0x21')][_0x214881[_0x7753('0xc4')]][_0x7753('0x111')]&&_0x21a1eb['value']===_0x7753('0x11b')){return new Promise(function(_0x304c51,_0x4fe865){delete _0x50ecc6[_0x7753('0x28')][_0x21a1eb['uniqueid']];_0x50ecc6['updateOriginated'](_0x50ecc6[_0x7753('0x21')][_0x214881[_0x7753('0xc4')]]);_0x50ecc6[_0x7753('0x21')][_0x214881[_0x7753('0xc4')]][_0x7753('0xc9')]+=0x1;_0x50ecc6[_0x7753('0x21')][_0x214881[_0x7753('0xc4')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x4b47ab=_0x50ecc6[_0x7753('0x21')][_0x214881[_0x7753('0xc4')]];var _0x25a225=new Hangup(_0x214881,_0x21a1eb);_0x25a225[_0x7753('0x73')]=0x13;_0x25a225[_0x7753('0x74')]='Machine';_0x25a225['membername']=_0x7753('0x117');_0x25a225['countmachineretry']+=0x1;_0x25a225[_0x7753('0xea')]+=0x1;_0x25a225[_0x7753('0x11e')]=!![];ami[_0x7753('0x44')]('custom:amd',ut[_0x7753('0x118')](_0x25a225,_0x7753('0x11e')));hopperUtils[_0x7753('0x11f')](_0x25a225)[_0x7753('0xa8')](loggerCatch(_0x7753('0x120')));if(_0x25a225['countbusyretry']+_0x25a225[_0x7753('0x122')]+_0x25a225[_0x7753('0x123')]+_0x25a225[_0x7753('0x124')]+_0x25a225[_0x7753('0xda')]+_0x25a225[_0x7753('0xe9')]+_0x25a225[_0x7753('0x11d')]+_0x25a225[_0x7753('0x12f')]>=_0x4b47ab[_0x7753('0x125')]){_0x50ecc6[_0x7753('0x126')](_0x25a225,_0x304c51,_0x4fe865,_0x7753('0x127'));}else{if(_0x25a225['countmachineretry']>=_0x4b47ab[_0x7753('0x128')]){_0x50ecc6[_0x7753('0x129')](_0x25a225,_0x304c51,_0x4fe865,_0x7753('0x12a'));}else{hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x25a225[_0x7753('0x11d')],'scheduledat':moment()[_0x7753('0xec')](_0x4b47ab[_0x7753('0x12b')],_0x7753('0xdf'))[_0x7753('0x48')](_0x7753('0xc8')),'ContactId':_0x25a225[_0x7753('0xe0')],'ListId':_0x25a225['ListId'],'VoiceQueueId':_0x25a225[_0x7753('0xe1')]||undefined,'CampaignId':_0x25a225[_0x7753('0xfc')]||undefined})[_0x7753('0xa8')](loggerCatch('[rescheduleContact][Machine]'));_0x304c51({'reschedule':0x1});}}});}}};Dialer[_0x7753('0x90')][_0x7753('0x38')]=function(_0x3fad26){var _0x37dbab=this['uniqueId'][_0x3fad26[_0x7753('0xc5')]];var _0x5ea8be;if(_0x37dbab&&_0x37dbab[_0x7753('0x45')]==='ivr'){delete this[_0x7753('0x28')][_0x3fad26['uniqueid']];this[_0x7753('0xc7')](this[_0x7753('0x21')][_0x37dbab[_0x7753('0xc4')]]);this[_0x7753('0x21')][_0x37dbab[_0x7753('0xc4')]][_0x7753('0x130')]+=0x1;_0x5ea8be=new Hangup(_0x37dbab,_0x3fad26);hopperUtils['createHistory'](_0x5ea8be)['catch'](loggerCatch(_0x7753('0x131')));hopperUtils[_0x7753('0xcf')](_0x5ea8be)[_0x7753('0xa8')](loggerCatch(_0x7753('0x132')));}if(_0x37dbab&&_0x37dbab[_0x7753('0x45')]!==_0x7753('0xc6')&&isNotNull(this[_0x7753('0x20')][_0x37dbab[_0x7753('0xc4')]][_0x7753('0x133')])){delete this['uniqueId'][_0x3fad26['uniqueid']];this[_0x7753('0xc7')](this[_0x7753('0x20')][_0x37dbab[_0x7753('0xc4')]]);this[_0x7753('0x20')][_0x37dbab[_0x7753('0xc4')]][_0x7753('0xc9')]+=0x1;this[_0x7753('0x20')][_0x37dbab[_0x7753('0xc4')]][_0x7753('0x114')]+=0x1;_0x5ea8be=new Hangup(_0x37dbab,_0x3fad26);_0x5ea8be['state']=0x10;_0x5ea8be[_0x7753('0x74')]=_0x7753('0x134');_0x5ea8be[_0x7753('0x116')]=_0x7753('0x135');hopperUtils[_0x7753('0x11f')](_0x5ea8be)[_0x7753('0xa8')](loggerCatch(_0x7753('0x131')));hopperUtils[_0x7753('0xcf')](_0x5ea8be)['catch'](loggerCatch(_0x7753('0x132')));}if(_0x37dbab&&_0x37dbab[_0x7753('0x45')]!=='ivr'&&!isNotNull(this[_0x7753('0x20')][_0x37dbab[_0x7753('0xc4')]][_0x7753('0x133')])){delete this[_0x7753('0x28')][_0x3fad26['uniqueid']];this[_0x7753('0xc7')](this[_0x7753('0x20')][_0x37dbab[_0x7753('0xc4')]]);this[_0x7753('0x20')][_0x37dbab[_0x7753('0xc4')]][_0x7753('0x136')]+=0x1;_0x5ea8be=new Hangup(_0x37dbab,_0x3fad26);_0x5ea8be[_0x7753('0x73')]=0xc;_0x5ea8be[_0x7753('0x74')]=_0x3fad26[_0x7753('0x137')];_0x5ea8be[_0x7753('0x116')]='Unknow';hopperUtils[_0x7753('0x11f')](_0x5ea8be)[_0x7753('0xa8')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0x7753('0xcf')](_0x5ea8be)[_0x7753('0xa8')](loggerCatch(_0x7753('0x132')));}};Dialer[_0x7753('0x90')][_0x7753('0xb')]=function(_0x5e7d53){var _0x342c7d=this;if(!_0x342c7d[_0x7753('0x138')][_0x5e7d53[_0x7753('0x64')]]){_0x342c7d[_0x7753('0x138')][_0x5e7d53[_0x7753('0x64')]]={'running':![]};}else if(_0x342c7d[_0x7753('0x138')][_0x5e7d53[_0x7753('0x64')]][_0x7753('0x139')]===!![]){return;}else if(_0x342c7d[_0x7753('0x138')][_0x5e7d53['name']][_0x7753('0x139')]===![]){_0x342c7d[_0x7753('0x138')][_0x5e7d53['name']][_0x7753('0x139')]=!![];}var _0x1df937=_0x342c7d[_0x7753('0x20')][_0x5e7d53['name']];var _0x3d8081=_0x1df937['message']!==utils[_0x7753('0x6e')]['INACTIVE'];var _0x5de821=utils['isPreviewCampaign'](_0x1df937);_0x1df937[_0x7753('0x13a')]=utils[_0x7753('0x13b')](_0x1df937,_0x342c7d['trunks']);Promise[_0x7753('0xb3')]()[_0x7753('0x41')](function(){if(_0x1df937[_0x7753('0x13a')]===utils[_0x7753('0x6e')][_0x7753('0x80')]){if(_0x3d8081){clearPredictiveAttributes(_0x1df937);_0x5e7d53[_0x7753('0x66')]=undefined;_0x5e7d53['startProgressive']=undefined;}if(_0x1df937['statusMessage']===utils['CAMPAIGN_STATUS']['INACTIVE']){_0x5e7d53[_0x7753('0x13c')]=0x0;_0x5e7d53[_0x7753('0xff')]=0x0;_0x5e7d53[_0x7753('0x13d')]=0x0;_0x5e7d53[_0x7753('0x13e')]=0x0;_0x5e7d53['pTalking']=0x0;}}else if(_0x1df937[_0x7753('0x13a')]===utils[_0x7753('0x6e')][_0x7753('0x13f')]&&!_0x5de821){return _0x342c7d[_0x7753('0x98')](_0x1df937,!![])[_0x7753('0x41')](function(){return _0x342c7d[_0x7753('0x98')](_0x1df937,![]);})[_0x7753('0x41')](function(){return _0x342c7d[_0x7753('0xb7')](_0x1df937);})[_0x7753('0xa8')](function(_0x4de41f){loggerSyncQueueSummary[_0x7753('0x63')]('[syncQueueSummary]',util[_0x7753('0x6b')](_0x4de41f,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x1df937);});}else{clearPredictiveAttributes(_0x1df937);}})['then'](function(){var _0x108ba7=_0x5e7d53['compareToOutboundQueue'](_0x1df937);if(_0x108ba7||_0x1df937[_0x7753('0x140')]){_0x1df937[_0x7753('0x140')]=![];_0x5e7d53[_0x7753('0x141')](_0x1df937);Object[_0x7753('0x142')](_0x1df937,_0x5e7d53);emitOutboundVoiceQueueSummary(_0x5e7d53);}_0x342c7d[_0x7753('0x138')][_0x1df937[_0x7753('0x64')]][_0x7753('0x139')]=![];})['catch'](function(_0x4518b8){logger['error'](_0x7753('0x143'),util[_0x7753('0x6b')](_0x4518b8,{'showHidden':![],'depth':null}));_0x342c7d[_0x7753('0x138')][_0x1df937[_0x7753('0x64')]][_0x7753('0x139')]=![];});};Dialer[_0x7753('0x90')][_0x7753('0x36')]=_[_0x7753('0x144')](function(){var _0x374f9d=_[_0x7753('0x145')](this['voiceQueues'],function(_0x5f5b2a){return _0x5f5b2a[_0x7753('0x146')];});var _0x22760c=_[_0x7753('0x145')](this[_0x7753('0x22')],function(_0x5613f9){return _0x5613f9[_0x7753('0x147')]&&_0x5613f9['status']===_0x7753('0x8e');});if(_0x374f9d[_0x7753('0xfe')]>0x0&&_0x22760c['length']>0x0){return Promise[_0x7753('0xb3')]()['then'](cmHopper[_0x7753('0x148')](_[_0x7753('0x149')](_0x374f9d,'id'),previewRecallmeReminderInterval,_[_0x7753('0x149')](_0x22760c,'id')))['then'](function(_0x5ab250){for(var _0x1dcbb4=0x0;_0x1dcbb4<_0x5ab250[_0x7753('0xfe')];_0x1dcbb4++){var _0xa63683=_0x5ab250[_0x1dcbb4][_0x7753('0x14a')][_0x7753('0x64')];if(_0xa63683)io['to'](util[_0x7753('0x48')]('user:%s',_0xa63683))['emit'](_0x7753('0x14b'),{'hopper':_0x5ab250[_0x1dcbb4]});}})['catch'](function(_0x284d9c){logger[_0x7753('0x69')](_0x7753('0x14c'),_0x284d9c);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x7753('0x90')]['loopClearZombieChannels']=function(){var _0x257a6b=this;setInterval(function(){_0x257a6b[_0x7753('0x14d')](_0x257a6b['uniqueId'],_0x7753('0x14e'));_0x257a6b[_0x7753('0x14d')](_0x257a6b['actions'],_0x7753('0x14f'));},0x32c8);};Dialer[_0x7753('0x90')][_0x7753('0x14d')]=function(_0x28ed43,_0x54566a){var _0x23816b=this;for(var _0x535b54 in _0x28ed43){if(typeof _0x28ed43[_0x535b54]!==_0x7753('0xb2')){this[_0x7753('0x1e')][_0x7753('0x150')](function(){if(!_['isNil'](_0x28ed43[_0x535b54])){return ami[_0x7753('0xa1')]({'action':_0x7753('0x8d'),'channel':_0x28ed43[_0x535b54][_0x7753('0xf1')]})['catch'](function(_0x5b3a02){if(_0x5b3a02[_0x7753('0x6d')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x28ed43[_0x535b54]&&_0x28ed43[_0x535b54]['type']!==_0x7753('0xc6')){_0x23816b[_0x7753('0xc7')](_0x23816b[_0x7753('0x20')][_0x28ed43[_0x535b54][_0x7753('0xc4')]]);logger['error'](_0x7753('0x151'),_0x54566a,_0x535b54,_0x28ed43[_0x535b54][_0x7753('0xc4')]);delete _0x28ed43[_0x535b54];}if(_0x28ed43[_0x535b54]&&_0x28ed43[_0x535b54]['type']===_0x7753('0xc6')){_0x23816b[_0x7753('0xc7')](_0x23816b[_0x7753('0x21')][_0x28ed43[_0x535b54]['queue']]);logger[_0x7753('0x69')]('[Dialer][checkChannel][ivr]',_0x54566a,_0x535b54,_0x28ed43[_0x535b54][_0x7753('0xc4')]);delete _0x28ed43[_0x535b54];}},0x2328);}});}});}}};Dialer[_0x7753('0x90')][_0x7753('0x152')]=function(_0x56aa2f){return Promise[_0x7753('0xb3')]()[_0x7753('0x41')](voiceQueueRt[_0x7753('0x152')](_0x56aa2f))[_0x7753('0xa8')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0x7753('0x90')]['updateOriginated']=function(_0x1c2c19){if(!_[_0x7753('0x43')](_0x1c2c19)&&_0x1c2c19!==null){if(typeof _0x1c2c19['originated']!=='undefined'){if(_0x1c2c19[_0x7753('0x84')]>0x0){_0x1c2c19[_0x7753('0x84')]-=0x1;}else{logger[_0x7753('0x69')](_0x7753('0x153'));}}}else{logger[_0x7753('0x69')](_0x7753('0x154'));}};Dialer[_0x7753('0x90')]['loggerHandler']=function(_0x502e86,_0x3ea466){var _0x3b95f1=this;return function(_0x24ac3f){_0x3b95f1['updateOriginated'](_0x3ea466);logger['error'](_0x502e86,util['inspect'](_0x24ac3f,{'showHidden':![],'depth':null}));};};Dialer[_0x7753('0x90')][_0x7753('0x155')]=function(_0x475d6f,_0x11fcc0,_0x879545){var _0x5130ef={'state':0x19,'statedesc':_0x7753('0x156')};this['updateOriginated'](_0x11fcc0);this[_0x7753('0x119')](_[_0x7753('0x61')](_0x5130ef,_[_0x7753('0x7a')](_0x879545,[_0x7753('0xe0'),_0x7753('0xee'),_0x7753('0x157'),_0x7753('0xe1'),_0x7753('0xfc')])),_0x7753('0x158'),'[emptyContact]');logger[_0x7753('0x69')](_0x475d6f);};Dialer['prototype'][_0x7753('0x119')]=function(_0x3fa1fa,_0x11cf73,_0x3cf0f7){hopperUtils[_0x7753('0x11f')](_0x3fa1fa)[_0x7753('0xa8')](loggerCatch(_0x11cf73));hopperUtils[_0x7753('0xcf')](_0x3fa1fa)[_0x7753('0xa8')](loggerCatch(_0x3cf0f7));};Dialer[_0x7753('0x90')][_0x7753('0xdc')]=function(_0x3afcff,_0x1ca155){hopperUtils[_0x7753('0x11f')](_0x3afcff)['catch'](loggerCatch(_0x7753('0xce')));if(_0x1ca155==0x0){hopperUtils[_0x7753('0xcf')](_0x3afcff)[_0x7753('0xa8')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));}};Dialer[_0x7753('0x90')][_0x7753('0x14c')]=function(_0x20b5a8){return Promise[_0x7753('0xb3')]()[_0x7753('0x41')](cmHopper[_0x7753('0x148')](_0x20b5a8['id'],previewRecallmeReminderInterval))['then'](function(_0x5b7007){for(var _0x3835b5=0x0;_0x3835b5<_0x5b7007[_0x7753('0xfe')];_0x3835b5++){var _0x424255=_0x5b7007[_0x3835b5][_0x7753('0x14a')]['name'];if(_0x424255)io['to'](util['format']('user:%s',_0x424255))['emit'](_0x7753('0x14b'),{'hopper':_0x5b7007[_0x3835b5]});}})[_0x7753('0xa8')](function(){});};Dialer['prototype'][_0x7753('0x159')]=function(_0x319657){var _0x6c343=this;return function(){_0x6c343[_0x7753('0x15a')](_0x319657);};};Dialer[_0x7753('0x90')]['actionOriginate']=function(_0x2f4ee1,_0x3195e5){var _0x2c46d8=this;var _0x45d722=uuid['v4']();this[_0x7753('0x26')][_0x45d722]=new Action(_0x2f4ee1,_0x3195e5,_0x45d722);return new Promise(function(_0x45c1de,_0x2ba012){if(_['isUndefined'](_0x2f4ee1)&&typeof _0x2f4ee1!==_0x7753('0x15b')){return _0x2ba012(msgResponse('originate','Failure',_0x7753('0x15c')));}if(_[_0x7753('0x43')](_0x3195e5[_0x7753('0x15d')])||_0x3195e5[_0x7753('0x15d')]===null){return _0x2ba012(msgResponse(_0x7753('0x15e'),_0x7753('0x99'),_0x7753('0x15f')));}var _0x183116={'XMD-CALLERID':_0x2c46d8[_0x7753('0x26')][_0x45d722][_0x7753('0x160')](),'XMD-AGI':_0x2f4ee1[_0x7753('0x133')]?util['format'](_0x7753('0x161'),ipAgi,_0x2f4ee1[_0x7753('0x133')]):_0x7753('0x162'),'XMD-AGIAFTER':_0x2f4ee1[_0x7753('0xcc')]?util[_0x7753('0x48')]('\x22agi://%s/square,%s\x22',ipAgi,_0x2f4ee1[_0x7753('0xcc')]):_0x7753('0x162'),'XMD-QUEUE':utils['isOutboundQueue'](_0x2f4ee1)?util[_0x7753('0x48')](_0x7753('0x163'),_0x2f4ee1[_0x7753('0x64')],_0x2f4ee1[_0x7753('0x164')]||'',_0x2f4ee1['dialAgiAfterHangupAgent']?'c':'',_0x2f4ee1[_0x7753('0xd2')]||0x3):_0x7753('0x162'),'XMD-CONTACTID':_0x3195e5[_0x7753('0xe0')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x2c46d8[_0x7753('0x26')][_0x45d722][_0x7753('0x160')](),'XMD-AMD':_0x2f4ee1[_0x7753('0x111')]?'ACTIVE':_0x7753('0x162'),'XMD-DESTINATION':_0x7753('0x110')};if(_0x2f4ee1[_0x7753('0x111')]){_0x183116[_0x7753('0x165')]=_0x2f4ee1[_0x7753('0x166')]||0x9c4;_0x183116[_0x7753('0x167')]=_0x2f4ee1['dialAMDGreeting']||0x5dc;_0x183116['XMD-AMDAFTERGREETINGSILENCE']=_0x2f4ee1[_0x7753('0x168')]||0x320;_0x183116['XMD-AMDTOTALANALYSISTIME']=_0x2f4ee1['dialAMDTotalAnalysisTime']||0x1388;_0x183116[_0x7753('0x169')]=_0x2f4ee1['dialAMDMinWordLength']||0x64;_0x183116[_0x7753('0x16a')]=_0x2f4ee1[_0x7753('0x16b')]||0x32;_0x183116['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x2f4ee1[_0x7753('0x16c')]||0x3;_0x183116[_0x7753('0x16d')]=_0x2f4ee1['dialAMDSilenceThreshold']||0x100;_0x183116[_0x7753('0x16e')]=_0x2f4ee1[_0x7753('0x16f')]||0x1388;}if(utils[_0x7753('0x170')](_0x2f4ee1)){_0x183116['XMD-VOICEQUEUEID']=_0x3195e5['VoiceQueueId'];}else{_0x183116['XMD-CAMPAIGNID']=_0x3195e5[_0x7753('0xfc')];}var _0x395412=utils[_0x7753('0x171')](_0x3195e5['Contact']);Object[_0x7753('0x142')](_0x183116,_0x395412);var _0x3a9095=_0x2c46d8['isTrunkReachable'](_0x2f4ee1['Trunk'])?utils[_0x7753('0x172')](_0x2f4ee1[_0x7753('0x92')][_0x7753('0x173')],_0x2f4ee1[_0x7753('0x174')],_0x2f4ee1[_0x7753('0x175')]>0x0?utils[_0x7753('0x176')](_0x2f4ee1['dialOriginateCallerIdNumber'],_0x2f4ee1[_0x7753('0x175')]):_0x2f4ee1[_0x7753('0x177')]):utils[_0x7753('0x172')](_[_0x7753('0xf7')](_0x2f4ee1[_0x7753('0x93')])?_0x2f4ee1[_0x7753('0x92')][_0x7753('0x173')]:_0x2f4ee1[_0x7753('0x93')][_0x7753('0x173')],_0x2f4ee1[_0x7753('0x174')],_0x2f4ee1[_0x7753('0x175')]>0x0?utils[_0x7753('0x176')](_0x2f4ee1[_0x7753('0x177')],_0x2f4ee1['dialRandomLastDigitCallerIdNumber']):_0x2f4ee1[_0x7753('0x177')]);if(_0x3a9095){_0x183116[_0x7753('0x178')]=_0x2c46d8[_0x7753('0x26')][_0x45d722]['originatecalleridname']=utils[_0x7753('0x179')](_0x3a9095);_0x183116[_0x7753('0x17a')]=_0x3195e5['phone'];}_0x2f4ee1[_0x7753('0x17b')]=_0x183116;return ami[_0x7753('0xa1')]({'actionid':_0x45d722,'action':'originate','channel':_0x2c46d8[_0x7753('0x8a')](_0x2f4ee1[_0x7753('0x92')])?util[_0x7753('0x48')]('SIP/%s/%s%s',_0x2f4ee1[_0x7753('0x92')][_0x7753('0x64')],isNotNull(_0x2f4ee1[_0x7753('0x17c')])?_0x2f4ee1[_0x7753('0x17c')][_0x7753('0x17d')]()||'':'',_0x2f4ee1['dialCutDigit']>0x0?_0x3195e5[_0x7753('0x15d')][_0x7753('0x17e')](_0x2f4ee1['dialCutDigit']):_0x3195e5['phone']):util[_0x7753('0x48')](_0x7753('0x17f'),_[_0x7753('0xf7')](_0x2f4ee1[_0x7753('0x93')])?_0x2f4ee1['Trunk']['name']:_0x2f4ee1[_0x7753('0x93')][_0x7753('0x64')],isNotNull(_0x2f4ee1[_0x7753('0x17c')])?_0x2f4ee1[_0x7753('0x17c')][_0x7753('0x17d')]()||'':'',_0x2f4ee1[_0x7753('0x180')]>0x0?_0x3195e5[_0x7753('0x15d')]['substring'](_0x2f4ee1[_0x7753('0x180')]):_0x3195e5[_0x7753('0x15d')]),'callerid':_0x3a9095,'Exten':_0x7753('0x110'),'Context':_0x7753('0x181'),'Priority':'1','variable':_0x183116,'timeout':(_0x2f4ee1['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x45d722})['then'](function(_0x31b590){return _0x45c1de(_0x31b590);})[_0x7753('0xa8')](function(_0x5e730a){_0x2f4ee1[_0x7753('0x182')]+=0x1;var _0x85bbc9=new History(_0x2c46d8[_0x7753('0x26')][_0x45d722]);logger[_0x7753('0x69')](util[_0x7753('0x48')](_0x7753('0x183'),JSON[_0x7753('0x79')](_0x5e730a)));_0x85bbc9[_0x7753('0x73')]=0xe;_0x85bbc9[_0x7753('0x74')]=_0x7753('0x184');_0x85bbc9[_0x7753('0xe2')]=moment()[_0x7753('0x48')]('YYYY-MM-DD\x20HH:mm:ss');_0x85bbc9[_0x7753('0x75')]=_0x85bbc9[_0x7753('0xe2')];hopperUtils[_0x7753('0x11f')](_0x85bbc9)['catch'](loggerCatch(_0x7753('0x185')));_0x2c46d8[_0x7753('0xcf')](_0x85bbc9)[_0x7753('0xa8')](loggerCatch(_0x7753('0x185')))[_0x7753('0x1d')](function(){delete _0x2c46d8[_0x7753('0x26')][_0x45d722];return _0x2ba012(msgResponse(_0x7753('0x15e'),'Error',_0x7753('0x186')));});});});};Dialer[_0x7753('0x90')][_0x7753('0x187')]=function(_0x116d95,_0x5d3e29,_0x2756ef){var _0x1c500e=new History(_0x5d3e29);if(_0x1c500e[_0x7753('0x121')]+_0x1c500e['countcongestionretry']+_0x1c500e[_0x7753('0x123')]+_0x1c500e[_0x7753('0x124')]+_0x1c500e[_0x7753('0xda')]+_0x1c500e['countabandonedretry']+_0x1c500e[_0x7753('0x11d')]+_0x1c500e[_0x7753('0x12f')]>=_0x2756ef['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x116d95){case 0x3:if(_0x1c500e[_0x7753('0x123')]>=_0x2756ef['dialNoAnswerMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countnoanswerretry':_0x1c500e[_0x7753('0x123')]+=0x1,'scheduledat':moment()['add'](_0x2756ef['dialNoAnswerRetryFrequency'],_0x7753('0xdf'))['format'](_0x7753('0xc8')),'ContactId':_0x1c500e[_0x7753('0xe0')],'ListId':_0x1c500e[_0x7753('0xee')],'VoiceQueueId':_0x1c500e[_0x7753('0xe1')]||undefined,'CampaignId':_0x1c500e[_0x7753('0xfc')]||undefined})['catch'](loggerCatch(_0x7753('0x188')));break;case 0x5:if(_0x1c500e[_0x7753('0x121')]>=_0x2756ef[_0x7753('0x189')]-0x1){return!![];}hopperUtils[_0x7753('0xde')]({'active':![],'countbusyretry':_0x1c500e[_0x7753('0x121')]+=0x1,'scheduledat':moment()[_0x7753('0xec')](_0x2756ef[_0x7753('0x18a')],_0x7753('0xdf'))[_0x7753('0x48')](_0x7753('0xc8')),'ContactId':_0x1c500e['ContactId'],'ListId':_0x1c500e[_0x7753('0xee')],'VoiceQueueId':_0x1c500e['VoiceQueueId']||undefined,'CampaignId':_0x1c500e['CampaignId']||undefined})[_0x7753('0xa8')](loggerCatch(_0x7753('0x18b')));break;case 0x8:if(_0x1c500e[_0x7753('0x122')]>=_0x2756ef[_0x7753('0x18c')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countcongestionretry':_0x1c500e[_0x7753('0x122')]+=0x1,'scheduledat':moment()[_0x7753('0xec')](_0x2756ef[_0x7753('0x18d')],_0x7753('0xdf'))[_0x7753('0x48')](_0x7753('0xc8')),'ContactId':_0x1c500e['ContactId'],'ListId':_0x1c500e[_0x7753('0xee')],'VoiceQueueId':_0x1c500e['VoiceQueueId']||undefined,'CampaignId':_0x1c500e['CampaignId']||undefined})[_0x7753('0xa8')](loggerCatch(_0x7753('0x18e')));break;case 0x0:if(_0x1c500e[_0x7753('0x124')]>=_0x2756ef[_0x7753('0x18f')]-0x1){return!![];}else{hopperUtils[_0x7753('0xde')]({'active':![],'countnosuchnumberretry':_0x1c500e[_0x7753('0x124')]+=0x1,'scheduledat':moment()[_0x7753('0xec')](_0x2756ef['dialNoSuchNumberRetryFrequency'],'minutes')[_0x7753('0x48')](_0x7753('0xc8')),'ContactId':_0x1c500e[_0x7753('0xe0')],'ListId':_0x1c500e[_0x7753('0xee')],'VoiceQueueId':_0x1c500e[_0x7753('0xe1')]||undefined,'CampaignId':_0x1c500e[_0x7753('0xfc')]||undefined})['catch'](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x1c500e['countdropretry']>=_0x2756ef[_0x7753('0xdb')]-0x1){return!![];}hopperUtils[_0x7753('0xde')]({'active':![],'countdropretry':_0x1c500e[_0x7753('0xda')]+=0x1,'scheduledat':moment()[_0x7753('0xec')](_0x2756ef[_0x7753('0xd6')],_0x7753('0xdf'))[_0x7753('0x48')](_0x7753('0xc8')),'ContactId':_0x1c500e[_0x7753('0xe0')],'ListId':_0x1c500e[_0x7753('0xee')],'VoiceQueueId':_0x1c500e[_0x7753('0xe1')]||undefined,'CampaignId':_0x1c500e[_0x7753('0xfc')]||undefined})['catch'](loggerCatch(_0x7753('0x190')));break;case 0xb:if(_0x1c500e[_0x7753('0xe9')]>=_0x2756ef[_0x7753('0xeb')]-0x1){return!![];}hopperUtils[_0x7753('0xde')]({'active':![],'countabandonedretry':_0x1c500e[_0x7753('0xe9')]+=0x1,'scheduledat':moment()[_0x7753('0xec')](_0x2756ef[_0x7753('0xed')],'minutes')[_0x7753('0x48')](_0x7753('0xc8')),'ContactId':_0x1c500e[_0x7753('0xe0')],'ListId':_0x1c500e['ListId'],'VoiceQueueId':_0x1c500e[_0x7753('0xe1')]||undefined,'CampaignId':_0x1c500e[_0x7753('0xfc')]||undefined})[_0x7753('0xa8')](loggerCatch(_0x7753('0xef')));break;case 0x13:if(_0x1c500e[_0x7753('0x11d')]>=_0x2756ef[_0x7753('0x128')]-0x1){return!![];}hopperUtils[_0x7753('0xde')]({'active':![],'countmachineretry':_0x1c500e[_0x7753('0x11d')]+=0x1,'scheduledat':moment()[_0x7753('0xec')](_0x2756ef[_0x7753('0x12b')],_0x7753('0xdf'))['format'](_0x7753('0xc8')),'ContactId':_0x1c500e[_0x7753('0xe0')],'ListId':_0x1c500e[_0x7753('0xee')],'VoiceQueueId':_0x1c500e[_0x7753('0xe1')]||undefined,'CampaignId':_0x1c500e[_0x7753('0xfc')]||undefined})[_0x7753('0xa8')](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x1c500e[_0x7753('0x12f')]>=_0x2756ef[_0x7753('0x191')]-0x1){return!![];}hopperUtils[_0x7753('0xde')]({'active':![],'countagentrejectretry':_0x1c500e[_0x7753('0x12f')]+=0x1,'scheduledat':moment()['add'](_0x2756ef[_0x7753('0x192')],_0x7753('0xdf'))[_0x7753('0x48')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1c500e['ContactId'],'ListId':_0x1c500e[_0x7753('0xee')],'VoiceQueueId':_0x1c500e['VoiceQueueId']||undefined,'CampaignId':_0x1c500e[_0x7753('0xfc')]||undefined})['catch'](loggerCatch(_0x7753('0x193')));break;default:return!![];}};Dialer[_0x7753('0x90')][_0x7753('0x10c')]=function(_0x23c024,_0x5098a5,_0x4dc686){var _0x9220cf=this;var _0xa52616=new History(_0x23c024);var _0x3fc778=![];var _0x53cb6b;var _0x5c32ac;return new Promise(function(_0x286e71,_0x410e11){if(_['isUndefined'](_0x5098a5)&&typeof _0x5098a5!=='object'){return _0x410e11(msgResponse(_0x7753('0x194'),_0x7753('0x99'),_0x7753('0x195')));}if(_[_0x7753('0x43')](_0x4dc686)&&typeof _0x4dc686!==_0x7753('0x15b')){return _0x410e11(msgResponse('[callProgressDetecting]','Failure',_0x7753('0x196')));}hopperUtils[_0x7753('0xd8')](_0xa52616,_0x4dc686[_0x7753('0x197')],_0x5098a5)[_0x7753('0x41')](function(_0x4302e2){if(_0x4302e2['additional']==0x1)_0x3fc778=!![];switch(_0x4dc686[_0x7753('0x197')]){case'0':_0x5098a5[_0x7753('0x198')]+=0x1;_0xa52616[_0x7753('0x73')]=0x0;_0xa52616['statedesc']=_0x7753('0x199');_0xa52616[_0x7753('0x124')]+=0x1;_0xa52616[_0x7753('0xea')]+=0x1;ami[_0x7753('0x44')]('custom:agentnosuchnumber',ut[_0x7753('0x118')](_0x23c024,'nosuchnumber'));_0x53cb6b=_0x5098a5['dialNoSuchNumberRetryFrequency'];_0x5c32ac=_0x5098a5[_0x7753('0xd7')];hopperUtils[_0x7753('0x11f')](_0xa52616)[_0x7753('0xa8')](loggerCatch(_0x7753('0x120')));if(_0x9220cf['checkRetriveMax'](0x0,_0x23c024,_0x5098a5)&&!_0x3fc778){if(_0xa52616['countnosuchnumberretry']>=_0x5098a5['dialNoSuchNumberMaxRetry']){_0x9220cf['createStateFinal'](_0xa52616,_0x286e71,_0x410e11,_0x7753('0x19a'));}else{_0x9220cf[_0x7753('0x126')](_0xa52616,_0x286e71,_0x410e11,_0x7753('0x19a'));}}break;case'3':_0x5098a5['outboundNoAnswerCallsDay']+=0x1;_0xa52616['state']=0x3;_0xa52616[_0x7753('0x74')]='NoAnswer';_0xa52616[_0x7753('0x123')]+=0x1;_0xa52616['countglobal']+=0x1;var _0x3f7b46=ut[_0x7753('0x19b')](_0x23c024,_0x5098a5);ami['emit'](_0x7753('0x19c'),_0x3f7b46);_0x53cb6b=_0x5098a5[_0x7753('0x19d')];_0x5c32ac=_0x5098a5[_0x7753('0xd7')];hopperUtils[_0x7753('0x11f')](_0xa52616)[_0x7753('0xa8')](loggerCatch(_0x7753('0x19e')));if(_0x9220cf['checkRetriveMax'](0x3,_0x23c024,_0x5098a5)&&!_0x3fc778){if(_0xa52616[_0x7753('0x123')]>=_0x5098a5[_0x7753('0x19f')]){_0x9220cf[_0x7753('0x129')](_0xa52616,_0x286e71,_0x410e11,_0x7753('0x1a0'));}else{_0x9220cf['stateGlobal'](_0xa52616,_0x286e71,_0x410e11,_0x7753('0x1a0'));}}break;case'5':_0x5098a5[_0x7753('0x1a1')]+=0x1;_0xa52616[_0x7753('0x73')]=0x5;_0xa52616['statedesc']=_0x7753('0x1a2');_0xa52616[_0x7753('0x121')]+=0x1;_0xa52616[_0x7753('0xea')]+=0x1;ami[_0x7753('0x44')](_0x7753('0x1a3'),ut[_0x7753('0x118')](_0x23c024,'busy'));_0x53cb6b=_0x5098a5[_0x7753('0x18a')];_0x5c32ac=_0x5098a5[_0x7753('0xd7')];hopperUtils[_0x7753('0x11f')](_0xa52616)[_0x7753('0xa8')](loggerCatch(_0x7753('0x1a4')));if(_0x9220cf[_0x7753('0x187')](0x5,_0x23c024,_0x5098a5)&&!_0x3fc778){if(_0xa52616[_0x7753('0x121')]>=_0x5098a5[_0x7753('0x189')]){_0x9220cf[_0x7753('0x129')](_0xa52616,_0x286e71,_0x410e11,_0x7753('0x1a5'));}else{_0x9220cf[_0x7753('0x126')](_0xa52616,_0x286e71,_0x410e11,'reason\x205\x20busy');}}break;case'8':_0x5098a5[_0x7753('0x1a6')]+=0x1;_0xa52616[_0x7753('0x73')]=0x8;_0xa52616[_0x7753('0x74')]=_0x7753('0x1a7');_0xa52616[_0x7753('0x122')]+=0x1;_0xa52616[_0x7753('0xea')]+=0x1;_0x53cb6b=_0x5098a5['dialCongestionRetryFrequency'];_0x5c32ac=_0x5098a5[_0x7753('0xd7')];ami[_0x7753('0x44')](_0x7753('0x1a8'),ut[_0x7753('0x118')](_0x23c024,_0x7753('0x1a9')));hopperUtils[_0x7753('0x11f')](_0xa52616)[_0x7753('0xa8')](loggerCatch(_0x7753('0x1aa')));if(_0x9220cf[_0x7753('0x187')](0x8,_0x23c024,_0x5098a5)&&!_0x3fc778){if(_0xa52616['countcongestionretry']>=_0x5098a5['dialCongestionMaxRetry']){_0x9220cf[_0x7753('0x129')](_0xa52616,_0x286e71,_0x410e11,'reason\x208\x20congestion');}else{_0x9220cf[_0x7753('0x126')](_0xa52616,_0x286e71,_0x410e11,_0x7753('0x1ab'));}}break;case'11':_0x5098a5[_0x7753('0x1ac')]+=0x1;_0xa52616['state']=0xb;_0xa52616[_0x7753('0x74')]=_0x7753('0xe7');_0xa52616['countabandonedretry']+=0x1;_0xa52616[_0x7753('0xea')]+=0x1;_0x53cb6b=_0x5098a5[_0x7753('0xed')];_0x5c32ac=_0x5098a5[_0x7753('0xd7')];hopperUtils[_0x7753('0x11f')](_0xa52616)['catch'](loggerCatch(_0x7753('0xf0')));if(_0x9220cf[_0x7753('0x187')](0xb,_0x23c024,_0x5098a5)&&!_0x3fc778){if(_0xa52616['countabandonedretry']>=_0x5098a5[_0x7753('0xeb')]){_0x9220cf['createStateFinal'](_0xa52616,_0x286e71,_0x410e11,_0x7753('0x1ad'));}else{_0x9220cf[_0x7753('0x126')](_0xa52616,_0x286e71,_0x410e11,_0x7753('0x1ad'));}}break;case'20':_0x5098a5['outboundRejectCallsDay']+=0x1;_0xa52616[_0x7753('0x73')]=0x14;_0xa52616[_0x7753('0x74')]=_0x7753('0x1ae');_0xa52616[_0x7753('0x12f')]+=0x1;_0xa52616[_0x7753('0xea')]+=0x1;_0x53cb6b=_0x5098a5['dialAgentRejectRetryFrequency'];_0x5c32ac=_0x5098a5['callAdditionalPhoneAfterMin'];ami[_0x7753('0x44')](_0x7753('0x1af'),ut[_0x7753('0x118')](_0x23c024,'agentreject'));hopperUtils['createHistory'](_0xa52616)[_0x7753('0xa8')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x9220cf['checkRetriveMax'](0x14,_0x23c024,_0x5098a5)&&!_0x3fc778){if(_0xa52616['countagentrejectretry']>=_0x5098a5[_0x7753('0x191')]){_0x9220cf[_0x7753('0x129')](_0xa52616,_0x286e71,_0x410e11,_0x7753('0x1b0'));}else{_0x9220cf[_0x7753('0x126')](_0xa52616,_0x286e71,_0x410e11,'reason\x2020\x20agentreject');}}break;default:_0x5098a5[_0x7753('0x136')]+=0x1;_0xa52616[_0x7753('0x73')]=0xc;_0xa52616['statedesc']=_0x4dc686[_0x7753('0x197')];_0x53cb6b=_0x5098a5['dialAgentRejectRetryFrequency'];_0x5c32ac=_0x5098a5['callAdditionalPhoneAfterMin'];hopperUtils[_0x7753('0x11f')](_0xa52616)[_0x7753('0xa8')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x9220cf[_0x7753('0x187')](_0x4dc686[_0x7753('0x197')],_0x23c024,_0x5098a5)&&!_0x3fc778){if(_0xa52616['countbusyretry']+_0xa52616['countcongestionretry']+_0xa52616['countnoanswerretry']+_0xa52616[_0x7753('0x124')]+_0xa52616[_0x7753('0xda')]+_0xa52616[_0x7753('0xe9')]+_0xa52616[_0x7753('0x11d')]+_0xa52616[_0x7753('0x12f')]>=_0x5098a5[_0x7753('0x125')]){_0x9220cf[_0x7753('0x126')](_0xa52616,_0x286e71,_0x410e11,_0x4dc686[_0x7753('0x197')]);}else{_0x9220cf[_0x7753('0x129')](_0xa52616,_0x286e71,_0x410e11,_0x4dc686['reason']);}}}})['then'](function(){if(_0x3fc778){hopperUtils['swapAdditionalPhones'](_0xa52616,_0x53cb6b,_0x5c32ac)[_0x7753('0x41')](function(){return _0x286e71(0x1);});}});});};Dialer[_0x7753('0x90')][_0x7753('0x126')]=function(_0x3860a1,_0x5d4b6b,_0x2e91f5,_0x58877f){var _0x2ee966=new Final(_0x3860a1);_0x2ee966[_0x7753('0x73')]=0xf;_0x2ee966[_0x7753('0x74')]=_0x7753('0x1b1');this['createStateFinal'](_0x2ee966,_0x5d4b6b,_0x2e91f5,_0x58877f);};Dialer[_0x7753('0x90')][_0x7753('0x129')]=function(_0x5ed6ab,_0x2108a7,_0xf8e141,_0x13c489){hopperUtils[_0x7753('0xcf')](_0x5ed6ab)[_0x7753('0x41')](function(){return _0x2108a7(msgResponse(_0x7753('0x194'),_0x7753('0x1b2'),_0x13c489));})[_0x7753('0xa8')](function(){return _0xf8e141(msgResponse(_0x7753('0x1b3'),_0x7753('0x99'),'contact\x20not\x20moved'));});};Dialer[_0x7753('0x90')]['predictive']=function(_0x5cdbc6){var _0x3820f5=_0x5cdbc6['dialPredictiveOptimizationPercentage']/0x64;var _0x54eee0=_0x5cdbc6['outboundDropCallsDayTimeout']/(_0x5cdbc6[_0x7753('0x1b4')]+_0x5cdbc6['outboundAnswerCallsDay']);var _0x3f8007=Math[_0x7753('0x1b5')](_0x5cdbc6[_0x7753('0x1b6')]*(_0x5cdbc6['predictiveIntervalMaxThreshold']/0x64));var _0x546f3f=Math[_0x7753('0x1b5')](_0x5cdbc6[_0x7753('0x1b6')]*(_0x5cdbc6[_0x7753('0x1b7')]/0x64));var _0x2e9cf6=_0x5cdbc6[_0x7753('0x13c')]+_0x5cdbc6['talking'];var _0x2a7b82=Math[_0x7753('0x1b8')](_0x5cdbc6[_0x7753('0x5c')]*_0x5cdbc6[_0x7753('0x5f')]*_0x5cdbc6[_0x7753('0x1b9')]*_0x5cdbc6[_0x7753('0x1ba')]);if(_[_0x7753('0x43')](_0x5cdbc6['startProgressive'])){if(!_['isUndefined'](_0x5cdbc6[_0x7753('0x66')])){_0x5cdbc6['startPredictive']=undefined;loggerPredictive[_0x7753('0x69')](_0x7753('0x1bb'),_0x7753('0x1bc'));}if(!_['isUndefined'](_0x5cdbc6[_0x7753('0x67')])){loggerPredictive[_0x7753('0x69')]('[startMethodPredictive][StartProgressive]',_0x7753('0x1bd'));clearInterval(_0x5cdbc6['handlePredictive']);_0x5cdbc6[_0x7753('0x67')]=undefined;}_0x5cdbc6['startProgressive']=moment()[_0x7753('0x48')](_0x7753('0xc8'));loggerPredictive[_0x7753('0x4b')](_0x5cdbc6[_0x7753('0x64')],'collection\x20data\x20in\x20progressive\x20at',_0x5cdbc6[_0x7753('0x29')]);this[_0x7753('0xbb')](_0x5cdbc6,0x1);}else if(ifInterval(_0x5cdbc6[_0x7753('0x1be')],_0x5cdbc6['startProgressive'])){this['handlePower'](_0x5cdbc6,0x1);loggerPredictiveCalls[_0x7753('0x4b')](_0x7753('0x1bf'),_0x5cdbc6[_0x7753('0x29')],_0x5cdbc6[_0x7753('0x64')]);_0x5cdbc6[_0x7753('0x5c')]=0x0;_0x5cdbc6['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x3820f5<_0x54eee0&&_0x5cdbc6['dialPredictiveOptimization']===_0x7753('0x1c0')){clearPredictiveAttributes(_0x5cdbc6);loggerPredictive[_0x7753('0x4b')](_0x7753('0x1c1'),_0x7753('0x1c2'),_0x54eee0,_0x7753('0x29'),_0x5cdbc6[_0x7753('0x64')]);}else if(_0x2a7b82<_0x5cdbc6[_0x7753('0xd3')]&&_0x5cdbc6[_0x7753('0x1c3')]===_0x7753('0x1c0')){clearPredictiveAttributes(_0x5cdbc6);loggerPredictive[_0x7753('0x4b')](_0x7753('0x1c4'),_0x7753('0x1c5'),_0x2a7b82,_0x7753('0x1c6'),_0x5cdbc6['predictiveIntervalErlangCallsDroppedCalls'],'startProgressive',_0x5cdbc6[_0x7753('0x64')]);}else if(!ifInterval(_0x5cdbc6[_0x7753('0x1be')],_0x5cdbc6['startProgressive'])&&_['isUndefined'](_0x5cdbc6[_0x7753('0x66')])&&!_[_0x7753('0x43')](_0x5cdbc6['startProgressive'])){_0x5cdbc6[_0x7753('0x66')]=moment()[_0x7753('0x48')](_0x7753('0xc8'));loggerPredictive[_0x7753('0x4b')](_0x5cdbc6[_0x7753('0x64')],'started\x20in\x20predictive\x20at',_0x5cdbc6[_0x7753('0x66')]);hopperUtils[_0x7753('0x1c7')](_0x5cdbc6[_0x7753('0x1be')])['then'](this[_0x7753('0x1c8')](_0x5cdbc6))[_0x7753('0x41')](mergeDataErlangB(_0x5cdbc6))[_0x7753('0x41')](this[_0x7753('0x1c9')](_0x5cdbc6))[_0x7753('0xa8')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x5cdbc6));}else if(!ifInterval(_0x5cdbc6[_0x7753('0x1be')],_0x5cdbc6['startPredictive'])){_0x5cdbc6['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x5cdbc6[_0x7753('0x66')]=moment()[_0x7753('0x48')](_0x7753('0xc8'));loggerPredictive[_0x7753('0x4b')](_0x5cdbc6[_0x7753('0x64')],_0x7753('0x1ca'),_0x5cdbc6[_0x7753('0x66')]);clearInterval(_0x5cdbc6[_0x7753('0x67')]);_0x5cdbc6['handlePredictive']=undefined;hopperUtils[_0x7753('0x1c7')](_0x5cdbc6['dialPredictiveInterval'])['then'](this[_0x7753('0x1c8')](_0x5cdbc6))['then'](mergeDataErlangB(_0x5cdbc6))[_0x7753('0x41')](this['startMethodPredictive'](_0x5cdbc6))[_0x7753('0xa8')](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x5cdbc6));}else if(_0x5cdbc6[_0x7753('0x1b6')]&&_0x2e9cf6<_0x5cdbc6[_0x7753('0x1b6')]-_0x546f3f){clearPredictiveAttributes(_0x5cdbc6);loggerPredictive[_0x7753('0x4b')](_0x5cdbc6[_0x7753('0x64')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x2e9cf6,')\x20are\x20less\x20than\x20threshold\x20(',_0x5cdbc6[_0x7753('0x1b6')],'-',_0x546f3f,'=',_0x5cdbc6[_0x7753('0x1b6')]-_0x546f3f,')');}else if(_0x5cdbc6['predictiveIntervalAvailable']&&_0x2e9cf6>_0x5cdbc6['predictiveIntervalAvailable']+_0x3f8007){clearPredictiveAttributes(_0x5cdbc6);loggerPredictive[_0x7753('0x4b')](_0x5cdbc6[_0x7753('0x64')],_0x7753('0x1cb'),_0x2e9cf6,_0x7753('0x1cc'),_0x5cdbc6[_0x7753('0x1b6')],'+',_0x3f8007,'=',_0x5cdbc6[_0x7753('0x1b6')]+_0x3f8007,')');}};Dialer[_0x7753('0x90')][_0x7753('0x1c8')]=function(_0x5e73d8){var _0xa45a6a=this;return function(_0x3e4a42){return new Promise(function(_0x1d8db4,_0x1126fe){_['merge'](_0x5e73d8,_0x3e4a42[0x0]);if(checkGetDataPredictive(_0x3e4a42[0x0])){var _0x275710=_0x5e73d8[_0x7753('0x1b6')]=_0x5e73d8[_0x7753('0x13e')]+_0x5e73d8[_0x7753('0x13c')];var _0x19b296=_0x5e73d8[_0x7753('0x1be')]*0x3c;var _0x45e799=_0x3e4a42[0x0][_0x7753('0x56')]+_0x3e4a42[0x0]['predictiveIntervalAvgHoldtime'];var _0x53d043=(_0x3e4a42[0x0][_0x7753('0x50')]+_0x3e4a42[0x0][_0x7753('0x51')]+_0x3e4a42[0x0][_0x7753('0x52')])/_0x3e4a42[0x0]['predictiveIntervalTotalCalls'];_0x5e73d8['predictiveIntervalHitRate']=_0x53d043>0x0?_0x53d043:0x1;switch(_0x5e73d8[_0x7753('0x1c3')]){case _0x7753('0x1c0'):var _0xbe9c9=_0x5e73d8['dialPredictiveOptimizationPercentage']/0x64;return _0xa45a6a[_0x7753('0x1cd')](_0x275710,_0x19b296,_0x45e799,_0x53d043,_0xbe9c9)[_0x7753('0x41')](function(_0x5a60e7){return _0x1d8db4(_0x5a60e7);});case'agentBusyFactor':var _0x565cb3=_0x5e73d8['dialPredictiveOptimizationPercentage']/0x64;return _0xa45a6a[_0x7753('0x1ce')](_0x275710,_0x19b296,_0x45e799,_0x53d043,_0x565cb3)[_0x7753('0x41')](function(_0x4ab785){return _0x1d8db4(_0x4ab785);});default:return _0x1126fe(msgResponse(_0x7753('0x1cf'),_0x7753('0x99'),'Unknown\x20Predictive'));}}else{return _0x1126fe(msgResponse('[getDataPredictive]',_0x7753('0x99'),_0x7753('0x1d0')));}});};};Dialer[_0x7753('0x90')]['getDataPredictiveOld']=function(_0x4a1ff0){var _0x362d06=this;return function(_0x8091f1){return new Promise(function(_0x318d6e,_0x25a45e){_[_0x7753('0x61')](_0x4a1ff0,_0x8091f1[0x0]);if(checkGetDataPredictive(_0x8091f1[0x0])){loggerPredictive[_0x7753('0x4b')](JSON[_0x7753('0x79')](_0x8091f1[0x0]));if(_0x4a1ff0[_0x7753('0x1c3')]===_0x7753('0x1c0')){return _0x362d06[_0x7753('0x152')](_0x4a1ff0['id'])[_0x7753('0x41')](function(_0x53b6ab){var _0x4b8681=_0x4a1ff0['loggedIn']-_0x53b6ab[0x0][_0x7753('0x1d1')];var _0x1ee4b9=_0x4a1ff0['dialPredictiveInterval']*0x3c;var _0x543952=_0x8091f1[0x0][_0x7753('0x56')]+_0x8091f1[0x0][_0x7753('0x54')];var _0x32a964=(_0x8091f1[0x0][_0x7753('0x50')]+_0x8091f1[0x0][_0x7753('0x51')]+_0x8091f1[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x8091f1[0x0][_0x7753('0x4e')];var _0x18b3e3=_0x4a1ff0[_0x7753('0x1d2')]/0x64;_0x4a1ff0[_0x7753('0x1d3')]=_0x53b6ab[0x0][_0x7753('0x1d1')]||0x0;_0x4a1ff0[_0x7753('0x1b9')]=_0x32a964>0x0?_0x32a964:0x1;return _0x362d06[_0x7753('0x1cd')](_0x4b8681,_0x1ee4b9,_0x543952,_0x32a964,_0x18b3e3);})['then'](function(_0x493c15){return _0x318d6e(_0x493c15);})[_0x7753('0xa8')](function(_0x3b8ac9){return _0x25a45e(msgResponse(_0x7753('0x1d4'),_0x7753('0x99'),JSON[_0x7753('0x79')](_0x3b8ac9)));});}if(_0x4a1ff0[_0x7753('0x1c3')]==='agentBusyFactor'){return _0x362d06[_0x7753('0x152')](_0x4a1ff0['id'])[_0x7753('0x41')](function(_0x3d47dd){var _0x2b20de=_0x4a1ff0[_0x7753('0x1d5')]-_0x3d47dd[0x0]['outboundQueuePauses'];var _0x237f0e=_0x4a1ff0['dialPredictiveInterval']*0x3c;var _0x2cd493=_0x8091f1[0x0][_0x7753('0x56')]+_0x8091f1[0x0]['predictiveIntervalAvgHoldtime'];var _0x4a283c=(_0x8091f1[0x0][_0x7753('0x50')]+_0x8091f1[0x0][_0x7753('0x51')]+_0x8091f1[0x0][_0x7753('0x52')])/_0x8091f1[0x0][_0x7753('0x4e')];var _0x3b268a=_0x4a1ff0[_0x7753('0x1d2')]/0x64;_0x4a1ff0[_0x7753('0x1d3')]=_0x3d47dd[0x0][_0x7753('0x1d1')]||0x0;_0x4a1ff0[_0x7753('0x1b9')]=_0x4a283c>0x0?_0x4a283c:0x1;return _0x362d06['busyFactor'](_0x2b20de,_0x237f0e,_0x2cd493,_0x4a283c,_0x3b268a);})[_0x7753('0x41')](function(_0x3f0b13){return _0x318d6e(_0x3f0b13);})['catch'](function(_0x1e28ca){return _0x25a45e(msgResponse(_0x7753('0x1d4'),_0x7753('0x99'),JSON['stringify'](_0x1e28ca)));});}}else{return _0x25a45e(msgResponse(_0x7753('0x1cf'),'Failure',_0x7753('0x1d0')));}});};};Dialer[_0x7753('0x90')][_0x7753('0x1c9')]=function(_0x6c1c99){var _0x351e1e=this;return function(){var _0x98c9ee=0x0;var _0x5d6194=Math['floor'](_0x6c1c99[_0x7753('0x5d')]*0x3e8);if(_0x5d6194>0x0){_0x5d6194=_0x5d6194<0x64?0x64:_0x5d6194;loggerPredictive['info'](_0x6c1c99[_0x7753('0x64')],_0x7753('0x1d6'),_0x5d6194,_0x7753('0x1d7'));_0x6c1c99[_0x7753('0x67')]=setInterval(function(){_0x351e1e[_0x7753('0x67')](_0x6c1c99);loggerPredictiveCalls[_0x7753('0x4b')](_0x7753('0x1d8'),_0x98c9ee+=0x1);},_0x5d6194);}else{loggerPredictive[_0x7753('0x4b')](_0x6c1c99['name'],_0x7753('0x1d9'));}};};Dialer[_0x7753('0x90')][_0x7753('0x1da')]=function(_0x636f37,_0x1b232a){var _0x2667bb=this;return function(_0x2a218c){if(_[_0x7753('0x4a')](_0x2a218c)){if(_[_0x7753('0xf7')](_0x1b232a[_0x7753('0x157')])||!_0x1b232a[_0x7753('0x1db')]){if(_0x636f37['dialMethod']==='booked'){_0x636f37[_0x7753('0x76')]=_['isUndefined'](_0x636f37[_0x7753('0x76')])?!![]:_0x636f37['queueStatusComplete'];var _0x605d6a=uuid['v4']();_0x2667bb[_0x7753('0x26')][_0x605d6a]=new Action(_0x636f37,_0x1b232a,_0x605d6a);loggerBooked[_0x7753('0x4b')]('[booked][checkContactBlack]',_0x605d6a,_0x7753('0x1dc'),JSON[_0x7753('0x79')](_0x636f37[_0x7753('0x76')]),_0x7753('0x1dd'),_0x636f37['name']);if(_0x636f37[_0x7753('0x76')]){_0x636f37[_0x7753('0x76')]=![];_0x2667bb['queueBooked'][_0x2667bb[_0x7753('0x26')][_0x605d6a][_0x7753('0xc4')]]=[];ami['Action']({'actionid':_0x605d6a,'action':_0x7753('0x1de'),'queue':_0x636f37[_0x7753('0x64')]})[_0x7753('0xa8')](function(){_0x2667bb[_0x7753('0xc7')](_0x636f37);hopperUtils['rescheduleContact']({'active':![],'ContactId':_0x2667bb[_0x7753('0x26')][_0x605d6a][_0x7753('0xe0')],'ListId':_0x2667bb[_0x7753('0x26')][_0x605d6a][_0x7753('0xee')],'VoiceQueueId':_0x2667bb[_0x7753('0x26')][_0x605d6a]['VoiceQueueId']||undefined,'CampaignId':_0x2667bb[_0x7753('0x26')][_0x605d6a][_0x7753('0xfc')]||undefined})[_0x7753('0xa8')](loggerCatch(_0x7753('0x1df')));delete _0x2667bb[_0x7753('0x26')][_0x605d6a];});}else{loggerBooked[_0x7753('0x4b')](_0x7753('0x1e0'),JSON[_0x7753('0x79')](_0x636f37['queueStatusComplete']),_0x7753('0x1dd'),_0x636f37[_0x7753('0x64')]);_0x2667bb[_0x7753('0xc7')](_0x636f37);hopperUtils[_0x7753('0xde')]({'active':![],'ContactId':_0x2667bb['actions'][_0x605d6a][_0x7753('0xe0')],'ListId':_0x2667bb[_0x7753('0x26')][_0x605d6a][_0x7753('0xee')],'VoiceQueueId':_0x2667bb['actions'][_0x605d6a][_0x7753('0xe1')]||undefined,'CampaignId':_0x2667bb[_0x7753('0x26')][_0x605d6a][_0x7753('0xfc')]||undefined})['catch'](loggerCatch(_0x7753('0x1df')));delete _0x2667bb[_0x7753('0x26')][_0x605d6a];}}else{return _0x2667bb['actionOriginate'](_0x636f37,_0x1b232a);}}else{if(utils[_0x7753('0x62')](undefined,_0x1b232a[_0x7753('0x1e1')])<_0x636f37[_0x7753('0x1e2')]*0x3c){if(_0x1b232a[_0x7753('0x14a')]&&!_0x1b232a[_0x7753('0x14a')]['voicePause']){_0x2667bb['preview']['run'](_0x1b232a['id'])['finally'](function(){_0x2667bb['updateOriginated'](_0x636f37);});}else{hopperUtils[_0x7753('0x1e3')]({'active':![]},_0x1b232a['id'],0x1)[_0x7753('0x1d')](function(){_0x2667bb[_0x7753('0xc7')](_0x636f37);});}}else{_0x636f37[_0x7753('0x1e4')]+=0x1;_0x2667bb[_0x7753('0xc7')](_0x636f37);if(_0x636f37['dialRecallInQueue']){hopperUtils[_0x7753('0xde')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x1b232a[_0x7753('0xe0')],'ListId':_0x1b232a[_0x7753('0xee')],'VoiceQueueId':_0x1b232a[_0x7753('0xe1')]||undefined,'CampaignId':_0x1b232a[_0x7753('0xfc')]||undefined})['catch'](loggerCatch(_0x7753('0x1e5')));hopperUtils['createHistory'](createObjHistory(_0x636f37,_0x1b232a,utils[_0x7753('0x6e')][_0x7753('0x1e6')],0x17,_0x7753('0x1e7')))['catch'](loggerCatch(_0x7753('0x1e8')));}else{_0x2667bb['saveInDb'](createObjHistory(_0x636f37,_0x1b232a,utils['CAMPAIGN_STATUS']['RECALL_TIMEOUT'],0x16,_0x7753('0x1e9')),_0x7753('0x1ea'),_0x7753('0x1eb'));}}}}else{_0x636f37[_0x7753('0x1ec')]+=0x1;_0x2667bb[_0x7753('0x119')](createObjHistory(_0x636f37,_0x1b232a,utils['CAMPAIGN_STATUS']['BLACKLIST'],0xd,'Blacklist'),_0x7753('0x1ed'),_0x7753('0x1ee'));throw _0x7753('0x1ef');}};};Dialer['prototype'][_0x7753('0x15a')]=function(_0x24c782){var _0x2ce434=this;var _0x5464cc=_0x24c782[_0x7753('0x1f0')]-_0x24c782[_0x7753('0x84')];emitCampaignSummary(_0x24c782);if(_0x5464cc>0x0&&_0x24c782['temp']==0x0){if(_0x5464cc>this['maxNumberOriginate']){_0x5464cc=this[_0x7753('0x24')];}_0x24c782['temp']=0x1;hopperUtils[_0x7753('0x1f1')](_0x24c782,_0x5464cc)[_0x7753('0x41')](function(_0xb89539){_0x24c782['temp']=0x0;if(_0xb89539){if(!utils[_0x7753('0x1f2')](_0xb89539)){_0x24c782['message']=utils['CAMPAIGN_STATUS']['NO_AVAILABLE_CONTACTS'];logger[_0x7753('0x4b')]('[getContactCampaign2][Empty]'+_0x24c782['name']);}else{_0x24c782[_0x7753('0x84')]+=_0xb89539[_0x7753('0xfe')];_0x24c782[_0x7753('0x6d')]=utils[_0x7753('0x6e')][_0x7753('0x1f3')];for(var _0x4829e6=0x0;_0x4829e6<_0xb89539[_0x7753('0xfe')];_0x4829e6+=0x1){_0x24c782[_0x7753('0x1f4')]+=0x1;if(_[_0x7753('0xf7')](_0xb89539[_0x4829e6])||_[_0x7753('0xf7')](_0xb89539[_0x4829e6]['Contact'])||_['isNil'](_0xb89539[_0x4829e6][_0x7753('0x15d')])){_0x2ce434['emptyContact'](_0x7753('0x1f5'),_0x24c782,_0xb89539[_0x4829e6]);}else{hopperUtils[_0x7753('0x1f6')](_[_0x7753('0x7a')](_0xb89539[_0x4829e6],[_0x7753('0xfc'),_0x7753('0x15d')]))['then'](_0x2ce434[_0x7753('0x1da')](_0x24c782,_0xb89539[_0x4829e6]))[_0x7753('0xa8')](_0x2ce434[_0x7753('0x1f7')](_0x7753('0x1f8'),_0x24c782));}}}}})[_0x7753('0xa8')](loggerGetContactDialer(_0x7753('0x1f9'),_0x24c782,_0x5464cc));}};Dialer[_0x7753('0x90')]['handlePower']=function(_0x7b9be3,_0x4fa25c){var _0x48061f=this;var _0x5d1b61=[];if(_0x4fa25c<0x1||_0x7b9be3['dialMethod']===_0x7753('0xa')){_0x4fa25c=0x1;}var _0xc1f210=Math[_0x7753('0x1b8')](_0x7b9be3['available']*_0x4fa25c)-_0x7b9be3[_0x7753('0x84')];if(_0x7b9be3['dialLimitQueue']>0x0){var _0x211d3d=_0x7b9be3[_0x7753('0x1fa')]-_0x7b9be3[_0x7753('0x84')]-_0x7b9be3[_0x7753('0x13e')]-_0x7b9be3['pTalking'];if(_0xc1f210>_0x211d3d){_0xc1f210=_0x211d3d;}}if(_0xc1f210>0x0&&_0x7b9be3[_0x7753('0x1fb')]==0x0){if(_0x7b9be3[_0x7753('0xb8')]==='booked'){_0xc1f210=0x1;}if(_0xc1f210>this[_0x7753('0x24')]){_0xc1f210=this[_0x7753('0x24')];}for(var _0x54939f in this[_0x7753('0x22')]){if(typeof this[_0x7753('0x22')][_0x54939f]!==_0x7753('0xb2')){if(this[_0x7753('0x22')][_0x54939f][_0x7753('0x73')]===_0x7753('0x1fc')&&this[_0x7753('0x22')][_0x54939f][_0x7753('0x8d')]===_0x7753('0x8e')){_0x5d1b61['push'](this['agents'][_0x54939f]['id']);}}}_0x7b9be3[_0x7753('0x1fb')]=0x1;hopperUtils[_0x7753('0x1fd')](_0x7b9be3,_0x5d1b61,_0xc1f210)[_0x7753('0x41')](function(_0x5e30d2){_0x7b9be3[_0x7753('0x1fb')]=0x0;if(_0x5e30d2){if(!utils[_0x7753('0x1f2')](_0x5e30d2)){hopperUtils[_0x7753('0x1fe')](_0x7b9be3)[_0x7753('0x41')](sendMessageReschedule(_0x7b9be3))[_0x7753('0xa8')](loggerCatch(_0x7753('0x1ff')));}else{_0x7b9be3[_0x7753('0x84')]+=_0x5e30d2[_0x7753('0xfe')];_0x7b9be3[_0x7753('0x6d')]=_0x7b9be3[_0x7753('0xb8')]===_0x7753('0xa')?utils[_0x7753('0x6e')][_0x7753('0x13f')]:utils[_0x7753('0x6e')][_0x7753('0x1f3')];for(var _0x40c3e2=0x0;_0x40c3e2<_0x5e30d2['length'];_0x40c3e2+=0x1){if(_[_0x7753('0xf7')](_0x5e30d2[_0x40c3e2])||_[_0x7753('0xf7')](_0x5e30d2[_0x40c3e2]['Contact'])||_[_0x7753('0xf7')](_0x5e30d2[_0x40c3e2][_0x7753('0x15d')])){_0x48061f['emptyContact'](_0x7753('0x1f5'),_0x7b9be3,_0x5e30d2[_0x40c3e2]);}else{hopperUtils[_0x7753('0x200')](_[_0x7753('0x7a')](_0x5e30d2[_0x40c3e2],['VoiceQueueId',_0x7753('0x15d')]))[_0x7753('0x41')](_0x48061f[_0x7753('0x1da')](_0x7b9be3,_0x5e30d2[_0x40c3e2]))['catch'](_0x48061f[_0x7753('0x1f7')]('[actionOriginate]\x20',_0x7b9be3));}}}}})[_0x7753('0xa8')](loggerGetContactDialer(_0x7753('0x201'),_0x7b9be3,_0xc1f210));}};Dialer[_0x7753('0x90')][_0x7753('0x67')]=function(_0x2f40c6){if(_0x2f40c6[_0x7753('0x1fa')]>0x0){var _0x2093fb=_0x2f40c6[_0x7753('0x1fa')]-_0x2f40c6[_0x7753('0x84')]-_0x2f40c6['talking'];if(_0x2093fb>0x0&&_0x2f40c6['temp']==0x0){this[_0x7753('0x202')](_0x2f40c6);}else{loggerPredictiveCalls[_0x7753('0x4b')](_0x7753('0x203'));}}else{this['tryOriginatePredictive'](_0x2f40c6);}};Dialer['prototype'][_0x7753('0x202')]=function(_0x83243d){var _0x349143=this;var _0x287903=[];_0x83243d['originated']+=0x1;for(var _0x4a7425 in this[_0x7753('0x22')]){if(typeof this['agents'][_0x4a7425]!==_0x7753('0xb2')){if(this[_0x7753('0x22')][_0x4a7425][_0x7753('0x73')]===_0x7753('0x1fc')&&this[_0x7753('0x22')][_0x4a7425]['status']===_0x7753('0x8e')){_0x287903[_0x7753('0xa0')](this['agents'][_0x4a7425]['id']);}}}_0x83243d[_0x7753('0x1fb')]=0x1;return this[_0x7753('0x1fd')](_0x83243d['id'],_0x287903,0x1,_0x83243d['dialOrderByScheduledAt'],_0x83243d)['then'](function(_0x39d3ae){_0x83243d[_0x7753('0x1fb')]=0x1;if(_0x39d3ae){if(!utils[_0x7753('0x1f2')](_0x39d3ae)){utils[_0x7753('0x204')](_0x83243d,0x1,0x0);return hopperUtils[_0x7753('0x1fe')](_0x83243d)['then'](sendMessageReschedule(_0x83243d))[_0x7753('0xa8')](loggerCatch('[countReScheduled]\x20'));}else{_0x83243d[_0x7753('0x6d')]=utils['CAMPAIGN_STATUS']['RUNNING'];if(_[_0x7753('0xf7')](_0x39d3ae[0x0])||_['isNil'](_0x39d3ae[0x0][_0x7753('0x205')])||_[_0x7753('0xf7')](_0x39d3ae[0x0][_0x7753('0x15d')])){_0x349143[_0x7753('0x155')](_0x7753('0x1f5'),_0x83243d,_0x39d3ae[0x0]);}else{return hopperUtils[_0x7753('0x200')](_[_0x7753('0x7a')](_0x39d3ae[0x0],[_0x7753('0xe1'),_0x7753('0x15d')]))[_0x7753('0x41')](_0x349143['checkContactBlack'](_0x83243d,_0x39d3ae[0x0]))[_0x7753('0xa8')](_0x349143[_0x7753('0x1f7')](_0x7753('0x206'),_0x83243d));}}}})[_0x7753('0xa8')](loggerGetContactDialer(_0x7753('0x207'),_0x83243d,0x1));};Dialer['prototype'][_0x7753('0x1cd')]=function(_0x351647,_0x6a48f8,_0x53e55e,_0x12e111,_0x5447ef,_0x847433){loggerPredictive[_0x7753('0x4b')]('--------\x20Drop\x20Rate\x20--------');loggerPredictive['info']('M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x351647);loggerPredictive[_0x7753('0x4b')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x6a48f8);loggerPredictive[_0x7753('0x4b')]('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',_0x53e55e);loggerPredictive[_0x7753('0x4b')](_0x7753('0x208'),_0x12e111);loggerPredictive[_0x7753('0x4b')](_0x7753('0x209'),_0x5447ef);loggerPredictive[_0x7753('0x4b')]('---------------------------');return new Promise(function(_0xc2fa06,_0x31029a){if(_0x351647<=0x0||isNaN(_0x351647)){return _0x31029a(msgResponse(_0x7753('0x20a'),_0x7753('0x89'),_0x7753('0x20b')+_0x351647));}if(_0x53e55e<=0x0||isNaN(_0x53e55e)){return _0x31029a(msgResponse(_0x7753('0x20a'),'Error','Ts\x20=\x20'+_0x53e55e));}if(_0x12e111<=0x0||isNaN(_0x12e111)){return _0x31029a(msgResponse('[abandonmentRate]',_0x7753('0x89'),'p\x20=\x20'+_0x12e111));}if(_0x6a48f8<=0x0||isNaN(_0x6a48f8)){return _0x31029a(msgResponse(_0x7753('0x20a'),_0x7753('0x89'),_0x7753('0x20c')+_0x6a48f8));}if(_0x5447ef<=0x0||isNaN(_0x5447ef)){return _0x31029a(msgResponse(_0x7753('0x20a'),_0x7753('0x89'),'Amax\x20=\x20'+_0x5447ef));}_0x847433=_0x847433||0x0;var _0x4b786d=0x1/_0x53e55e;var _0x3c3c54=0x0;var _0x48ddd1=0x0;var _0x5e9be2=0x0;var _0x506f53=0x0;for(var _0xa91dd1=0x0;_0x5e9be2<_0x5447ef;_0xa91dd1+=0x1){_0x48ddd1=_0xa91dd1/_0x6a48f8;_0x3c3c54=(_0x12e111*_0x48ddd1+_0x847433)/_0x4b786d;_0x5e9be2=utils['erlangb'](_0x3c3c54,_0x351647);_0x506f53=_0x3c3c54/_0x351647*(0x1-utils[_0x7753('0x20d')](_0x3c3c54,_0x351647));}return _0xc2fa06({'erlangCalls':_0xa91dd1,'erlangCallToSecond':_0x6a48f8/_0xa91dd1,'erlangAbandonmentRate':_0x5e9be2,'erlangBusyFactor':_0x506f53});});};Dialer[_0x7753('0x90')][_0x7753('0x1ce')]=function(_0x450388,_0x1bdcda,_0x5ab13a,_0x5b6cb8,_0x480ad7,_0x196a9d){loggerPredictive['info']('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0x7753('0x4b')](_0x7753('0x20e'),_0x450388);loggerPredictive['info'](_0x7753('0x20f'),_0x1bdcda);loggerPredictive[_0x7753('0x4b')](_0x7753('0x210'),_0x5ab13a);loggerPredictive['info'](_0x7753('0x208'),_0x5b6cb8);loggerPredictive[_0x7753('0x4b')](_0x7753('0x211'),_0x480ad7);loggerPredictive[_0x7753('0x4b')](_0x7753('0x57'));return new Promise(function(_0x49d729,_0x595f43){if(_0x450388<=0x0||isNaN(_0x450388)){return _0x595f43(msgResponse(_0x7753('0x212'),'Error',_0x7753('0x20b')+_0x450388));}if(_0x5ab13a<=0x0||isNaN(_0x5ab13a)){return _0x595f43(msgResponse(_0x7753('0x212'),_0x7753('0x89'),'Ts\x20=\x20'+_0x5ab13a));}if(_0x5b6cb8<=0x0||isNaN(_0x5b6cb8)){return _0x595f43(msgResponse('[busyFactor]','Error',_0x7753('0x213')+_0x5b6cb8));}if(_0x1bdcda<=0x0||isNaN(_0x1bdcda)){return _0x595f43(msgResponse(_0x7753('0x212'),_0x7753('0x89'),_0x7753('0x20c')+_0x1bdcda));}if(_0x480ad7<=0x0||isNaN(_0x480ad7)){return _0x595f43(msgResponse(_0x7753('0x212'),_0x7753('0x89'),'Umin\x20=\x20'+_0x480ad7));}_0x196a9d=_0x196a9d||0x0;var _0x26e153=0x1/_0x5ab13a;var _0xd2927b=0x0;var _0x3342e3=0x0;var _0x508910=0x0;var _0x3d8844=0x0;for(var _0x157fc7=0x0;_0x3d8844<_0x480ad7;_0x157fc7+=0x1){_0x3342e3=_0x157fc7/_0x1bdcda;_0xd2927b=(_0x5b6cb8*_0x3342e3+_0x196a9d)/_0x26e153;_0x508910=utils['erlangb'](_0xd2927b,_0x450388);_0x3d8844=_0xd2927b/_0x450388*(0x1-utils[_0x7753('0x20d')](_0xd2927b,_0x450388));}return _0x49d729({'erlangCalls':_0x157fc7,'erlangCallToSecond':_0x1bdcda/_0x157fc7,'erlangAbandonmentRate':_0x508910,'erlangBusyFactor':_0x3d8844});});};module[_0x7753('0x214')]=Dialer; \ No newline at end of file +var _0xb5aa=['YYYY-MM-DD\x20HH:mm:ss','createHistory','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','droptime','responsetime','dialQueueTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','TIMEOUT','countglobal','dialDropRetryFrequency','callAdditionalPhoneAfterMin','voiceQueue','dialDropMaxRetry','additional','countdropretry','add','minutes','ContactId','ListId','VoiceQueueId','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','Abandoned','dropreason','CALLEREXIT','dialAbandonedRetryFrequency','verifyAdditionalPhones','countabandonedretry','rescheduleContact','CampaignId','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','channel','actionid','rrmemory','roundrobin','isNil','locked','paused','stateinterface','syncQueueStatusComplete','preview','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','idHopper','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncOriginateResponse','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','variable','exten','xcally-motion-dialer','value','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','amd','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','dialAMDActive','Machine','countmachineretry','buildObj','countbusyretry','countcongestionretry','countnoanswerretry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','[rescheduleContact][Machine]','HANGUP','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','custom:amd','[syncAgentComplete][createHistory][0]','countnosuchnumberretry','dialGlobalMaxRetry','dialMachineRetryFrequency','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','dialQueueProject','AnswerAGI','AGI','[syncHangupIvr]','cause-txt','Unknow','queuesSummary','running','isPreviewCampaign','getQueueCampaignStatusMessage','resolve','statusMessage','INACTIVE','inUse','talking','pTalking','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','assign','throttle','filter','reachable','map','Agent','user:dialPreviewRecallReminder','loopClearZombieChannels','clearZombieChannels','[uniqueid]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','notFound','UserId','[emptyContact][createHistory]','[emptyContact]','[syncQueueCallerAbandon]\x20[Drop]','checkPreviewRecallReminder','handlePreviewRecallNotifications','user:%s','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialer','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','XMD-CAMPAIGNID','setXMDContactVariables','Contact','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','getCallerId','callerid','XMD-ORIGINATECALLERIDNAME','extractCalleridName','SIP/%s/%s%s','trim','dialCutDigit','substring','dialPrefix','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','checkRetriveMax','countagentrejectretry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAgentRejectMaxRetry','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','reason','outboundNoSuchCallsDay','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','NoAnswer','buildNoAnswerEventPayload','custom:agentnoanswer','reason\x203\x20ringing\x20no\x20answer','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','custom:agentcongestion','[syncAgentComplete][createHistory][8]','dialCongestionMaxRetry','reason\x208\x20congestion','outboundAbandonedCallsDay','dialAbandonedMaxRetry','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','outboundUnknownCallsDay','[syncAgentComplete][createHistory][?]','Global','Success','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','outboundDropCallsDayTimeout','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','round','predictiveIntervalMinThreshold','available','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','dialPredictiveInterval','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','avgHandleTime','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','getDataPredictiveOld','loggedIn','outboundQueuePauses','abandonmentRate','predictiveIntervalPauses','check\x20failure','erlangCallToSecond','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','voicePause','unlockContact','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][historyBlacklist]','inBlackList','handleIvr','limitCalls','temp','getContactDialerIvr','checkContactEmpty','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','emptyContact','[actionOriginate]\x20','checkIsBlackListIvr','loggerHandler','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','[countReScheduled]\x20','checkIsBlackList','tryOriginatePredictive','[handlePredictive][limitChannel]','not_inuse','getContactDialer','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','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]','Umin\x20=\x20','exports','util','lodash','uuid','moment','ioredis','./utils','../preview/util/util','booked','predictive','../../../config/logger','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/setting','../rpc/interval','./models/action','./models/history','./models/agentComplete','./models/hangup','env','prototype','enqueue','tail','finally','sequence','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','syncAgentConnect','bind','syncQueueCallerAbandon','originateresponse','agentcomplete','syncAgentComplete','custom:queuesummary','syncQueueSummaryComplete','hangup','syncHangup','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','loopCampaigns','then','previewRecallmeReminderInterval','isUndefined','emit','outbound','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','voice:queue:%s','name','voice_queue:save','isEmpty','info','-----\x20Stats\x20Predictive\x20---','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','predictiveIntervalAvgHoldtime','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','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','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','erlangBusyFactor','merge','getSeconds','startProgressive\x20value\x20cleared','handlePredictive','error','stack','checkContactLowerLimitOriginate','contactsRescheduled','message','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][Empty]','state','statedesc','endtime','starttime','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','stringify','pick','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Interval','Intervals','isIVRCampaignActive','\x20NOT\x20Active','isIVRCampaign','format','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','DISACTIVED','is\x20disactive','[ifTime][Action]','isTrunkReachable','active','SIP/%s','status','unmonitored','Trunk','TrunkBackup','TRUNK_NOT_REACHABLE','checkIfTime','ifTimeIvr','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','ifTime','\x20Intervals\x20is\x20empty\x20','timezones','\x20Timezone\x20unknow\x20','isArray','length','push','Action','command','iftime\x20%s,%s','interval','indexOf','true','catch','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','[ifTime][promiseAll]','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','resetActiveCalls','syncCampaigns','undefined','checkIsTrunkReachable','dialGlobalInterval','dialTimezone','launchHandleIvr','checkDialMethod','dialMethod','progressive','power','handlePower','dialPowerLevel','silly','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','intervalIftime','Global:\x20','isGlobal','AMI\x20IfTime','Error','queue','uniqueid','type','ivr','updateOriginated','answertime','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent'];(function(_0xba0cf0,_0x43eab4){var _0xa2368c=function(_0x57229d){while(--_0x57229d){_0xba0cf0['push'](_0xba0cf0['shift']());}};_0xa2368c(++_0x43eab4);}(_0xb5aa,0x15d));var _0xab5a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb5aa[_0x20a584];return _0x4b41a8;};'use strict';var util=require(_0xab5a('0x0'));var _=require(_0xab5a('0x1'));var uuid=require(_0xab5a('0x2'));var moment=require(_0xab5a('0x3'));var rr=require('rr');var Redis=require(_0xab5a('0x4'));var utils=require(_0xab5a('0x5'));var hopperUtils=require('./utils/hopper');var ut=require(_0xab5a('0x6'));var config=require('../../../config/environment/');var logger=require('../../../config/logger')('dialer');var loggerBooked=require('../../../config/logger')(_0xab5a('0x7'));var loggerPredictive=require('../../../config/logger')(_0xab5a('0x8'));var loggerPredictiveCalls=require(_0xab5a('0x9'))('predictiveCalls');var loggerSyncQueueSummary=require(_0xab5a('0x9'))(_0xab5a('0xa'));var ami=require(_0xab5a('0xb'));config[_0xab5a('0xc')]=_[_0xab5a('0xd')](config[_0xab5a('0xc')],{'host':_0xab5a('0xe'),'port':0x18eb});var io=require(_0xab5a('0xf'))(new Redis(config['redis']));var cmHopper=require(_0xab5a('0x10'));var voiceQueueRt=require('../rpc/voiceQueueRt');var RpcSetting=require(_0xab5a('0x11'));var Interval=require(_0xab5a('0x12'));var Action=require(_0xab5a('0x13'));var History=require(_0xab5a('0x14'));var Final=require('./models/final');var AgentComplete=require(_0xab5a('0x15'));var QueueCallerAbandon=require('./models/queueCallerAbandon');var Hangup=require(_0xab5a('0x16'));var ipAgi=process[_0xab5a('0x17')]['XCALLY_IP_AGI']||'127.0.0.1';var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0xab5a('0x18')][_0xab5a('0x19')]=function(_0x4d8e2d){this[_0xab5a('0x1a')]=this[_0xab5a('0x1a')]?this[_0xab5a('0x1a')][_0xab5a('0x1b')](_0x4d8e2d):_0x4d8e2d();};function Dialer(_0xad7bbb,_0x595d4a){this[_0xab5a('0x1c')]=new Sequence();this['preview']=_0x595d4a;this[_0xab5a('0x1d')]=_0xad7bbb[_0xab5a('0x1d')];this[_0xab5a('0x1e')]=_0xad7bbb[_0xab5a('0x1e')];this[_0xab5a('0x1f')]=_0xad7bbb['agents'];this['trunks']=_0xad7bbb[_0xab5a('0x20')];this[_0xab5a('0x21')]=config[_0xab5a('0x21')]||0x2;this[_0xab5a('0x22')]={};this[_0xab5a('0x23')]={};this[_0xab5a('0x24')]={};this[_0xab5a('0x25')]={};this[_0xab5a('0x26')]={};this[_0xab5a('0x27')]={};this[_0xab5a('0x28')]={};this[_0xab5a('0x29')]={};this[_0xab5a('0x2a')]={};this[_0xab5a('0x2b')]={};this['queuesSummary']={};ami['on']('agentconnect',this[_0xab5a('0x2c')][_0xab5a('0x2d')](this));ami['on']('queuecallerabandon',this[_0xab5a('0x2e')][_0xab5a('0x2d')](this));ami['on'](_0xab5a('0x2f'),this['syncOriginateResponse'][_0xab5a('0x2d')](this));ami['on'](_0xab5a('0x30'),this[_0xab5a('0x31')]['bind'](this));ami['on'](_0xab5a('0x32'),this['syncQueueSummary']['bind'](this));ami['on']('custom:queuesummarycomplete',this[_0xab5a('0x33')][_0xab5a('0x2d')](this));ami['on'](_0xab5a('0x34'),this[_0xab5a('0x35')][_0xab5a('0x2d')](this));ami['on']('newexten',this[_0xab5a('0x36')][_0xab5a('0x2d')](this));ami['on'](_0xab5a('0x37'),this[_0xab5a('0x38')][_0xab5a('0x2d')](this));ami['on'](_0xab5a('0x39'),this[_0xab5a('0x3a')][_0xab5a('0x2d')](this));ami['on'](_0xab5a('0x3b'),this['syncQueueStatusComplete'][_0xab5a('0x2d')](this));this[_0xab5a('0x3c')]();this['loopClearZombieChannels']();RpcSetting['getSettings']()[_0xab5a('0x3d')](function(_0x2f2dc5){previewRecallmeReminderInterval=_0x2f2dc5[_0xab5a('0x3e')];});}function isNotNull(_0x133026){return _0x133026!==null&&!_[_0xab5a('0x3f')](_0x133026);}function msgResponse(_0x352629,_0x58645b,_0x5c14ec){return{'action':_0x352629,'response':_0x58645b,'message':_0x5c14ec,'stack':_0x5c14ec};}function emit(_0x58672a,_0x1ee38d,_0x264197){io['to'](_0x58672a)[_0xab5a('0x40')](_0x1ee38d,_0x264197);}function emitOutboundVoiceQueueSummary(_0x20d69b){if(_0x20d69b['type']===_0xab5a('0x41')){logger[_0xab5a('0x42')](_0xab5a('0x43'),util[_0xab5a('0x44')](_0x20d69b,{'showHidden':![],'depth':null}));emit(util['format'](_0xab5a('0x45'),_0x20d69b[_0xab5a('0x46')]),_0xab5a('0x47'),_0x20d69b);}}function checkGetDataPredictive(_0x2a0698){if(isNotNull(_0x2a0698)&&!_[_0xab5a('0x48')](_0x2a0698)){loggerPredictive[_0xab5a('0x49')](_0xab5a('0x4a'));loggerPredictive['info']('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2a0698[_0xab5a('0x4b')]);loggerPredictive['info']('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2a0698[_0xab5a('0x4c')]);loggerPredictive[_0xab5a('0x49')](_0xab5a('0x4d'),_0x2a0698[_0xab5a('0x4e')]);loggerPredictive[_0xab5a('0x49')](_0xab5a('0x4f'),_0x2a0698[_0xab5a('0x50')]);loggerPredictive[_0xab5a('0x49')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2a0698['predictiveIntervalAvgHoldtime']);loggerPredictive[_0xab5a('0x49')](_0xab5a('0x51'),_0x2a0698[_0xab5a('0x52')]);loggerPredictive['info'](_0xab5a('0x53'));if(_0x2a0698[_0xab5a('0x4b')]>0x0){if(!_['isUndefined'](_0x2a0698['predictiveIntervalAvgTalktime'])&&_0x2a0698[_0xab5a('0x52')]>0x0){return!![];}loggerPredictive['info'](_0xab5a('0x54'));if(!_['isUndefined'](_0x2a0698[_0xab5a('0x55')])&&_0x2a0698[_0xab5a('0x55')]>0x0){return!![];}loggerPredictive['info'](_0xab5a('0x56'));}else{loggerPredictive['info'](_0xab5a('0x57'));}}else{loggerPredictive['info']('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x560816){return function(_0x3c477c){loggerPredictive[_0xab5a('0x49')]('---------\x20ErlangB\x20---------');loggerPredictive['info'](_0xab5a('0x58'),_0x3c477c[_0xab5a('0x59')]);loggerPredictive['info'](_0xab5a('0x5a'),_0x3c477c['erlangCallToSecond']);loggerPredictive['info'](_0xab5a('0x5b'),_0x3c477c[_0xab5a('0x5c')]);loggerPredictive[_0xab5a('0x49')]('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3c477c[_0xab5a('0x5d')]);loggerPredictive[_0xab5a('0x49')](_0xab5a('0x5b'),_0x3c477c[_0xab5a('0x5c')]);loggerPredictive['info'](_0xab5a('0x53'));_[_0xab5a('0x5e')](_0x560816,_0x3c477c);};}function ifInterval(_0x1dfb63,_0xb84b6f){if(_[_0xab5a('0x3f')](_0xb84b6f)){return![];}return utils[_0xab5a('0x5f')](undefined,_0xb84b6f)<_0x1dfb63*0x3c;}function clearPredictiveAttributes(_0x4e20b3){if(_0x4e20b3[_0xab5a('0x28')]){_0x4e20b3[_0xab5a('0x28')]=undefined;loggerPredictive[_0xab5a('0x42')](_0x4e20b3[_0xab5a('0x46')],_0xab5a('0x60'));}if(_0x4e20b3[_0xab5a('0x27')]){_0x4e20b3[_0xab5a('0x27')]=undefined;loggerPredictive[_0xab5a('0x42')](_0x4e20b3['name'],'startPredictive\x20value\x20cleared');}if(_0x4e20b3[_0xab5a('0x61')]){clearInterval(_0x4e20b3['handlePredictive']);_0x4e20b3[_0xab5a('0x61')]=undefined;loggerPredictive[_0xab5a('0x42')](_0x4e20b3[_0xab5a('0x46')],'handlePredictive\x20interval\x20cleared');}}function loggerCatchPredictive(_0x416abc,_0x37b9fe){return function(_0x55c674){loggerPredictive[_0xab5a('0x62')](_0x37b9fe[_0xab5a('0x46')],_0x416abc);loggerPredictive[_0xab5a('0x62')](_0x55c674[_0xab5a('0x63')]);clearPredictiveAttributes(_0x37b9fe);};}function loggerCatch(_0x1e833f){return function(_0x748a5a){logger[_0xab5a('0x62')](_0x1e833f,util[_0xab5a('0x44')](_0x748a5a,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x413c39,_0x3591d6,_0x74b782){return function(_0x3601e5){utils[_0xab5a('0x64')](_0x3591d6,_0x74b782,0x0);logger[_0xab5a('0x62')](_0x413c39,util[_0xab5a('0x44')](_0x3601e5,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0xebef16){return function(_0x9eaf46){if(isNotNull(_0x9eaf46)&&isNotNull(_0x9eaf46[0x0])){if(_0x9eaf46[0x0][_0xab5a('0x65')]>0x0){_0xebef16[_0xab5a('0x66')]=utils[_0xab5a('0x67')][_0xab5a('0x68')];logger[_0xab5a('0x49')]('[getContactDialer2][ReScheduled]'+_0xebef16[_0xab5a('0x46')],_0x9eaf46[0x0][_0xab5a('0x65')],'contacts');}else{_0xebef16[_0xab5a('0x66')]=utils['CAMPAIGN_STATUS']['NO_AVAILABLE_CONTACTS'];logger['info'](_0xab5a('0x69')+_0xebef16[_0xab5a('0x46')]);}}};}function createObjHistory(_0x48ee98,_0x215414,_0x34ea2e,_0x51f086,_0x2b5e1c){_0x48ee98[_0xab5a('0x66')]=_0x34ea2e;var _0x1a5e49=new Action(_0x48ee98,_0x215414);var _0x4567e5=new History(_0x1a5e49);_0x4567e5[_0xab5a('0x6a')]=_0x51f086;_0x4567e5[_0xab5a('0x6b')]=_0x2b5e1c;_0x4567e5[_0xab5a('0x6c')]=_0x1a5e49[_0xab5a('0x6d')];return _0x4567e5;}function unlockQueueStatus(_0x3fb107,_0x43b50b){setTimeout(function(){if(_[_0xab5a('0x3f')](_0x3fb107[_0xab5a('0x6e')])){loggerBooked[_0xab5a('0x62')](_0xab5a('0x6f'),_0x43b50b);}_0x3fb107[_0xab5a('0x6e')]=!![];loggerBooked[_0xab5a('0x49')](_0xab5a('0x70'),_0x43b50b,JSON[_0xab5a('0x71')](_[_0xab5a('0x72')](_0x3fb107,[_0xab5a('0x46'),_0xab5a('0x6e')])));},0x1f3);}function checkInterval(_0x224853){return function(){if(!isNotNull(_0x224853['Interval'])){_0x224853['message']=utils[_0xab5a('0x67')][_0xab5a('0x73')];throw _0x224853[_0xab5a('0x46')]+_0xab5a('0x74');}if(!isNotNull(_0x224853[_0xab5a('0x75')][_0xab5a('0x76')])){_0x224853['message']=utils[_0xab5a('0x67')][_0xab5a('0x73')];throw _0x224853[_0xab5a('0x46')]+_0xab5a('0x74');}if(!isNotNull(_[_0xab5a('0x48')](_0x224853[_0xab5a('0x75')][_0xab5a('0x76')]))){_0x224853[_0xab5a('0x66')]=utils[_0xab5a('0x67')][_0xab5a('0x73')];throw _0x224853['name']+_0xab5a('0x74');}};}function checkIsIVRCampaignActive(_0xc2cc5c){return function(){if(!utils[_0xab5a('0x77')](_0xc2cc5c)){_0xc2cc5c['message']=utils['CAMPAIGN_STATUS']['INACTIVE'];throw _0xc2cc5c['name']+_0xab5a('0x78');}};}function emitCampaignSummary(_0x3cb89c){if(utils[_0xab5a('0x79')](_0x3cb89c)){emit(util[_0xab5a('0x7a')](_0xab5a('0x7b'),_0x3cb89c[_0xab5a('0x46')]),_0xab5a('0x7c'),_0x3cb89c);}}function loggerCatchQueueSummary(_0x5aae65,_0x5ea160){return function(_0x2386e5){clearPredictiveAttributes(_0x5ea160);emitCampaignSummary(_0x5ea160);loggerSyncQueueSummary[_0xab5a('0x42')](_0x5aae65,util[_0xab5a('0x44')](_0x2386e5,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x201df9){if(_0x201df9[_0xab5a('0x7d')]){if(_0x201df9['originated']===0x0){_0x201df9[_0xab5a('0x7d')]=![];_0x201df9[_0xab5a('0x66')]=utils[_0xab5a('0x67')]['INACTIVE'];loggerSyncQueueSummary[_0xab5a('0x42')](_0xab5a('0x7e'),_0x201df9[_0xab5a('0x46')],_0xab5a('0x7f'));}else{_0x201df9['message']=utils['CAMPAIGN_STATUS'][_0xab5a('0x80')];loggerSyncQueueSummary[_0xab5a('0x42')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x201df9[_0xab5a('0x46')],_0xab5a('0x81'));}emitCampaignSummary(_0x201df9);}}function myreject(_0x20ee50){return function(_0x19294f){return _0x20ee50(msgResponse(_0xab5a('0x82'),'Error',JSON['stringify'](_0x19294f)));};}Dialer[_0xab5a('0x18')][_0xab5a('0x83')]=function(_0x418b32){return!_[_0xab5a('0x3f')](_0x418b32)&&_0x418b32&&!_[_0xab5a('0x3f')](_0x418b32[_0xab5a('0x46')])&&!_[_0xab5a('0x3f')](_0x418b32['active'])&&_0x418b32[_0xab5a('0x84')]&&(this['trunks'][util[_0xab5a('0x7a')]('SIP/%s',_0x418b32[_0xab5a('0x46')])]['status']==='reachable'||this['trunks'][util[_0xab5a('0x7a')](_0xab5a('0x85'),_0x418b32['name'])][_0xab5a('0x86')]===_0xab5a('0x87'));};Dialer[_0xab5a('0x18')]['checkIsTrunkReachable']=function(_0x423ee5){var _0x3aae7b=this;return function(){if(!_0x3aae7b[_0xab5a('0x83')](_0x423ee5[_0xab5a('0x88')])){if(!_0x3aae7b[_0xab5a('0x83')](_0x423ee5[_0xab5a('0x89')])){_0x423ee5['message']=utils['CAMPAIGN_STATUS'][_0xab5a('0x8a')];throw _0x423ee5['name']+'\x20trunk\x20is\x20not\x20reachable';}}};};Dialer[_0xab5a('0x18')][_0xab5a('0x8b')]=function(_0x3f1107,_0x3e3916,_0x1a0e8f,_0x4e9ff3){var _0x108afe=this;return function(){var _0x28e307=!![];return _0x108afe[_0xab5a('0x8c')](_0x3f1107,_0x3e3916,_0x1a0e8f,_0x4e9ff3,_0x28e307);};};Dialer[_0xab5a('0x18')][_0xab5a('0x8d')]=function(_0x130069,_0x3ccaf1,_0x31ac9f,_0x36b43c){var _0x3848ae=this;return function(){var _0x1763e6=![];return _0x3848ae[_0xab5a('0x8c')](_0x130069['Intervals'],_0x3ccaf1,_0x31ac9f,_0x36b43c,_0x1763e6);};};Dialer['prototype'][_0xab5a('0x8c')]=function(_0x10833a,_0x496ef4,_0x218b39,_0x112781,_0x4e2a71){var _0x3b946d=[];return new Promise(function(_0x10a9be,_0xc6f54b){if(!isNotNull(_0x10833a)){_0x112781[_0xab5a('0x66')]=utils['CAMPAIGN_STATUS']['NULL_INTERVAL'];return _0xc6f54b(msgResponse('ifTime',_0xab5a('0x8e'),_0x218b39+_0xab5a('0x8f')));}if(_[_0xab5a('0x48')](_0x10833a)){_0x112781[_0xab5a('0x66')]=utils[_0xab5a('0x67')][_0xab5a('0x90')];return _0xc6f54b(msgResponse(_0xab5a('0x91'),_0xab5a('0x8e'),_0x218b39+_0xab5a('0x92')));}if(_0x496ef4&&_[_0xab5a('0x3f')](config[_0xab5a('0x93')][_0x496ef4])){_0x112781['message']=utils['CAMPAIGN_STATUS']['UNKNOWN_TIMEZONE'];return _0xc6f54b(msgResponse(_0xab5a('0x91'),_0xab5a('0x8e'),_0x218b39+_0xab5a('0x94')+_0x496ef4));}if(_[_0xab5a('0x95')](_0x10833a)){for(var _0x473717=0x0;_0x473717<_0x10833a[_0xab5a('0x96')];_0x473717+=0x1){_0x3b946d[_0xab5a('0x97')](ami[_0xab5a('0x98')]({'action':_0xab5a('0x99'),'command':util[_0xab5a('0x7a')](_0xab5a('0x9a'),_0x10833a[_0x473717][_0xab5a('0x9b')],!_[_0xab5a('0x3f')](config[_0xab5a('0x93')][_0x496ef4])?_0x496ef4:'')})[_0xab5a('0x3d')](function(_0x1b5e10){return _0x1b5e10['content'][_0xab5a('0x9c')](_0xab5a('0x9d'))>=0x0;})[_0xab5a('0x9e')](myreject(_0xc6f54b)));}}else{_0x3b946d[_0xab5a('0x97')](ami['Action']({'action':_0xab5a('0x99'),'command':util['format']('iftime\x20%s,%s',_0x10833a,!_[_0xab5a('0x3f')](config[_0xab5a('0x93')][_0x496ef4])?_0x496ef4:'')})[_0xab5a('0x3d')](function(_0x4117cd){return _0x4117cd['content']['indexOf'](_0xab5a('0x9d'))>=0x0;})['catch'](myreject(_0xc6f54b)));}Promise['all'](_0x3b946d)[_0xab5a('0x3d')](function(_0x12cffe){var _0x2dc8da=_['some'](_0x12cffe);if(_0x2dc8da){return _0x10a9be(_0x2dc8da);}else{_0x112781[_0xab5a('0x66')]=_0x4e2a71?utils[_0xab5a('0x67')][_0xab5a('0x9f')]:utils['CAMPAIGN_STATUS'][_0xab5a('0xa0')];return _0xc6f54b(msgResponse(_0xab5a('0xa1'),_0xab5a('0x8e'),'Global:\x20'+_0x4e2a71+'\x20'+_0x218b39+_0xab5a('0xa2')+util[_0xab5a('0x44')](_0x10833a,{'showHidden':![],'depth':null})+_0xab5a('0xa3')+_0x496ef4));}})[_0xab5a('0x9e')](function(_0x4e3d1b){return _0xc6f54b(msgResponse('ifTime',_0xab5a('0x8e'),JSON[_0xab5a('0x71')](_0x4e3d1b)));});});};Dialer['prototype'][_0xab5a('0x3c')]=function(){var _0x1d8e6d=this;return cmHopper[_0xab5a('0xa4')]({'active':![]},{'where':{'active':!![]}})[_0xab5a('0x3d')](function(){setInterval(function(){_0x1d8e6d[_0xab5a('0xa5')]();},0x3e8);});};Dialer[_0xab5a('0x18')][_0xab5a('0xa5')]=function(){var _0x3b9a83=this;var _0x2505b7;for(var _0x3d8f70 in this[_0xab5a('0x1e')]){if(typeof this['campaigns'][_0x3d8f70]!==_0xab5a('0xa6')){_0x2505b7=this[_0xab5a('0x1e')][_0x3d8f70];if(utils[_0xab5a('0x79')](_0x2505b7)&&utils[_0xab5a('0x77')](_0x2505b7)){_0x2505b7[_0xab5a('0x7d')]=!![];Promise['resolve']()[_0xab5a('0x3d')](checkIsIVRCampaignActive(_0x2505b7))[_0xab5a('0x3d')](checkInterval(_0x2505b7))[_0xab5a('0x3d')](_0x3b9a83[_0xab5a('0xa7')](_0x2505b7))[_0xab5a('0x3d')](_0x3b9a83[_0xab5a('0x8b')](_0x2505b7[_0xab5a('0xa8')],_0x2505b7[_0xab5a('0xa9')],_0x2505b7[_0xab5a('0x46')],_0x2505b7))[_0xab5a('0x3d')](_0x3b9a83[_0xab5a('0x8d')](_0x2505b7[_0xab5a('0x75')],_0x2505b7[_0xab5a('0xa9')],_0x2505b7['name'],_0x2505b7))['then'](_0x3b9a83[_0xab5a('0xaa')](_0x2505b7))['catch'](loggerCatchQueueSummary('[syncCampaigns]',_0x2505b7));}else{notSendMessagesCampaign(_0x2505b7);}}}};Dialer[_0xab5a('0x18')][_0xab5a('0xab')]=function(_0x1e6403){if(_0x1e6403[_0xab5a('0xac')]!==_0xab5a('0x8')){clearPredictiveAttributes(_0x1e6403);}switch(_0x1e6403[_0xab5a('0xac')]){case _0xab5a('0xad'):this['handlePower'](_0x1e6403,0x1);break;case _0xab5a('0xae'):this[_0xab5a('0xaf')](_0x1e6403,_0x1e6403[_0xab5a('0xb0')]);break;case _0xab5a('0x8'):this[_0xab5a('0x8')](_0x1e6403);break;case'booked':this['handlePower'](_0x1e6403,0x1);break;default:logger[_0xab5a('0x62')]('Queue',_0x1e6403['name'],'method\x20not\x20recognized');}};Dialer[_0xab5a('0x18')][_0xab5a('0x91')]=function(_0x1b199d,_0xa1d3ff){var _0x3fe5a0=_0x1b199d[_0xab5a('0xa9')];var _0x4f0f94=_0xa1d3ff?_0x1b199d['dialGlobalInterval']:_0x1b199d[_0xab5a('0x75')][_0xab5a('0x76')];logger[_0xab5a('0xb1')](_0xab5a('0xb2'),_0x4f0f94,_0x3fe5a0,_0x1b199d[_0xab5a('0x46')],util['format'](_0xab5a('0xb3'),_0x1b199d['name'],_0x1b199d['id']));var _0x872c7d=null;return Interval[_0xab5a('0xb4')](_0x4f0f94,_0x3fe5a0)['then'](function(_0x1da346){if(_0x1da346===!![]){return _0x1da346;}else{_0x1b199d[_0xab5a('0x66')]=_0xa1d3ff?utils[_0xab5a('0x67')][_0xab5a('0x9f')]:utils[_0xab5a('0x67')][_0xab5a('0xa0')];_0x872c7d=msgResponse(_0xab5a('0xa1'),'Failure',_0xab5a('0xb5')+_0xa1d3ff+'\x20'+_0x1b199d[_0xab5a('0x46')]+'\x20Interval\x20is\x20overtime:\x20'+util[_0xab5a('0x44')](_0x4f0f94,{'showHidden':![],'depth':null})+_0xab5a('0xa3')+_0x3fe5a0);}if(_0x872c7d!==null){logger[_0xab5a('0xb1')]('Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:',_0x872c7d);_0x872c7d[_0xab5a('0xb6')]=_0xa1d3ff;throw _0x872c7d;}})[_0xab5a('0x9e')](function(_0x40e5b5){logger['error'](_0xab5a('0xb7'),_0x40e5b5);throw msgResponse(_0xab5a('0x82'),_0xab5a('0xb8'),util[_0xab5a('0x44')](_0x40e5b5,{'showHidden':![],'depth':null}));});};Dialer['prototype'][_0xab5a('0x2c')]=function(_0x323dc6){if(this[_0xab5a('0x1d')][_0x323dc6[_0xab5a('0xb9')]]){if(this[_0xab5a('0x25')][_0x323dc6[_0xab5a('0xba')]]&&this[_0xab5a('0x25')][_0x323dc6['uniqueid']][_0xab5a('0xbb')]!==_0xab5a('0xbc')){this[_0xab5a('0xbd')](this[_0xab5a('0x1d')][_0x323dc6[_0xab5a('0xb9')]]);this['uniqueId'][_0x323dc6[_0xab5a('0xba')]][_0xab5a('0xbe')]=moment()[_0xab5a('0x7a')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0xab5a('0x18')][_0xab5a('0x31')]=function(_0x36eca9){var _0x36c324=this['uniqueId'][_0x36eca9['uniqueid']];if(this[_0xab5a('0x1d')][_0x36eca9[_0xab5a('0xb9')]]){if(_0x36c324&&_0x36c324[_0xab5a('0xbb')]!==_0xab5a('0xbc')){delete this[_0xab5a('0x25')][_0x36eca9['uniqueid']];this[_0xab5a('0x1d')][_0x36eca9[_0xab5a('0xb9')]]['outboundAnswerCallsDay']+=0x1;var _0x43147c=new AgentComplete(_0x36c324,_0x36eca9);if(_0x36eca9['reason']===_0xab5a('0xbf')){_0x43147c[_0xab5a('0xc0')]=this[_0xab5a('0x1d')][_0x36eca9['queue']][_0xab5a('0xc1')]&&this['voiceQueues'][_0x36eca9[_0xab5a('0xb9')]][_0xab5a('0xc2')]?moment()[_0xab5a('0x7a')](_0xab5a('0xc3')):undefined;}hopperUtils[_0xab5a('0xc4')](_0x43147c)[_0xab5a('0x9e')](loggerCatch(_0xab5a('0xc5')));hopperUtils[_0xab5a('0xc6')](_0x43147c)[_0xab5a('0x9e')](loggerCatch(_0xab5a('0xc7')));}}};Dialer[_0xab5a('0x18')]['syncQueueCallerAbandon']=function(_0xb13730){var _0x247ed7=this[_0xab5a('0x25')][_0xb13730[_0xab5a('0xba')]];var _0x178848=this;var _0x240f69=![];var _0x37cf71;var _0xe6924f;if(this[_0xab5a('0x1d')][_0xb13730[_0xab5a('0xb9')]]){if(_0x247ed7&&_0x247ed7[_0xab5a('0xbb')]!==_0xab5a('0xbc')){delete this['uniqueId'][_0xb13730['uniqueid']];this[_0xab5a('0xbd')](this['voiceQueues'][_0xb13730[_0xab5a('0xb9')]]);_0x247ed7[_0xab5a('0xc8')]=moment()[_0xab5a('0x7a')](_0xab5a('0xc3'));var _0x22b6b3=new QueueCallerAbandon(_0x247ed7,_0xb13730);if(utils[_0xab5a('0x5f')](_0x247ed7[_0xab5a('0xc8')],_0x247ed7[_0xab5a('0xc9')])>=_0x247ed7[_0xab5a('0xca')]){this[_0xab5a('0x1d')][_0xb13730[_0xab5a('0xb9')]][_0xab5a('0x4e')]+=0x1;this[_0xab5a('0x1d')][_0xb13730[_0xab5a('0xb9')]]['outboundDropCallsDayTimeout']+=0x1;this['voiceQueues'][_0xb13730[_0xab5a('0xb9')]][_0xab5a('0xcb')]+=0x1;_0x22b6b3['state']=0xa;_0x22b6b3['statedesc']=_0xab5a('0xcc');_0x22b6b3['dropreason']=_0xab5a('0xcd');_0x22b6b3['agiafterat']=this['voiceQueues'][_0xb13730[_0xab5a('0xb9')]][_0xab5a('0xc1')]?moment()[_0xab5a('0x7a')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x22b6b3['countdropretry']+=0x1;_0x22b6b3[_0xab5a('0xce')]+=0x1;_0x37cf71=this[_0xab5a('0x1d')][_0xb13730[_0xab5a('0xb9')]][_0xab5a('0xcf')];_0xe6924f=this['voiceQueues'][_0xb13730['queue']][_0xab5a('0xd0')];hopperUtils['verifyAdditionalPhones'](_0x22b6b3,_0x22b6b3[_0xab5a('0x6a')],_0x247ed7[_0xab5a('0xd1')])[_0xab5a('0x3d')](function(_0x304841){_0x240f69=_0x304841['additional']==0x1;if(_0x22b6b3['countdropretry']>=_0x178848[_0xab5a('0x1d')][_0xb13730['queue']][_0xab5a('0xd2')]){_0x178848['queueCallerAbandonCreateState'](_0x22b6b3,_0x304841[_0xab5a('0xd3')]);}else{hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x22b6b3[_0xab5a('0xd4')],'scheduledat':moment()[_0xab5a('0xd5')](_0x178848[_0xab5a('0x1d')][_0xb13730['queue']][_0xab5a('0xcf')],_0xab5a('0xd6'))['format'](_0xab5a('0xc3')),'ContactId':_0x247ed7[_0xab5a('0xd7')],'ListId':_0x247ed7[_0xab5a('0xd8')],'VoiceQueueId':_0x247ed7[_0xab5a('0xd9')]||undefined,'CampaignId':_0x247ed7['CampaignId']||undefined})[_0xab5a('0x9e')](loggerCatch(_0xab5a('0xda')));var _0x4297a6=new History(_0x22b6b3);_0x4297a6[_0xab5a('0x6a')]=0xa;_0x4297a6[_0xab5a('0x6b')]=_0xab5a('0xcc');_0x4297a6[_0xab5a('0x6d')]=moment()['format'](_0xab5a('0xc3'));_0x4297a6[_0xab5a('0x6c')]=_0x4297a6[_0xab5a('0x6d')];_0x4297a6[_0xab5a('0xdb')]=_0x22b6b3[_0xab5a('0xdb')];_0x4297a6[_0xab5a('0xdc')]=_0x22b6b3[_0xab5a('0xdc')];hopperUtils[_0xab5a('0xc4')](_0x4297a6)[_0xab5a('0x9e')](loggerCatch(_0xab5a('0xdd')));}})[_0xab5a('0x3d')](function(){if(_0x240f69)hopperUtils[_0xab5a('0xde')](_0x22b6b3,_0x37cf71,_0xe6924f)[_0xab5a('0x3d')](function(){return 0x1;});});}else{this[_0xab5a('0x1d')][_0xb13730[_0xab5a('0xb9')]][_0xab5a('0x50')]+=0x1;this[_0xab5a('0x1d')][_0xb13730[_0xab5a('0xb9')]]['outboundDropCallsDayCallersExit']+=0x1;_0x22b6b3[_0xab5a('0x6a')]=0xb;_0x22b6b3[_0xab5a('0x6b')]=_0xab5a('0xdf');_0x22b6b3[_0xab5a('0xe0')]=_0xab5a('0xe1');_0x22b6b3['countabandonedretry']+=0x1;_0x22b6b3['countglobal']+=0x1;_0x37cf71=this[_0xab5a('0x1d')][_0xb13730['queue']][_0xab5a('0xe2')];_0xe6924f=this['voiceQueues'][_0xb13730[_0xab5a('0xb9')]]['callAdditionalPhoneAfterMin'];hopperUtils[_0xab5a('0xe3')](_0x22b6b3,_0x22b6b3[_0xab5a('0x6a')],_0x247ed7['voiceQueue'])[_0xab5a('0x3d')](function(_0x2a1656){if(_0x22b6b3[_0xab5a('0xe4')]>=_0x178848['voiceQueues'][_0xb13730[_0xab5a('0xb9')]]['dialAbandonedMaxRetry']){_0x178848['queueCallerAbandonCreateState'](_0x22b6b3,_0x2a1656[_0xab5a('0xd3')]);}else{hopperUtils[_0xab5a('0xe5')]({'active':![],'countabandonedretry':_0x22b6b3[_0xab5a('0xe4')],'scheduledat':moment()[_0xab5a('0xd5')](_0x178848['voiceQueues'][_0xb13730[_0xab5a('0xb9')]][_0xab5a('0xe2')],_0xab5a('0xd6'))[_0xab5a('0x7a')](_0xab5a('0xc3')),'ContactId':_0x247ed7[_0xab5a('0xd7')],'ListId':_0x247ed7['ListId'],'VoiceQueueId':_0x247ed7['VoiceQueueId']||undefined,'CampaignId':_0x247ed7[_0xab5a('0xe6')]||undefined})[_0xab5a('0x9e')](loggerCatch(_0xab5a('0xe7')));var _0x424e8c=new History(_0x22b6b3);_0x424e8c[_0xab5a('0x6a')]=0xb;_0x424e8c[_0xab5a('0x6b')]=_0xab5a('0xdf');_0x424e8c[_0xab5a('0x6d')]=moment()[_0xab5a('0x7a')](_0xab5a('0xc3'));_0x424e8c['endtime']=_0x424e8c[_0xab5a('0x6d')];_0x424e8c[_0xab5a('0xdb')]=_0x22b6b3['calleridname'];_0x424e8c[_0xab5a('0xdc')]=_0x22b6b3[_0xab5a('0xdc')];hopperUtils[_0xab5a('0xc4')](_0x424e8c)['catch'](loggerCatch(_0xab5a('0xe8')));}})[_0xab5a('0x3d')](function(){if(_0x240f69)hopperUtils['swapAdditionalPhones'](_0x22b6b3,_0x37cf71,_0xe6924f)['then'](function(){return 0x1;});});}}}};Dialer[_0xab5a('0x18')]['syncNewExten']=function(_0x5382c5){if(this[_0xab5a('0x23')][_0x5382c5['uniqueid']]){this[_0xab5a('0x23')][_0x5382c5[_0xab5a('0xba')]][_0xab5a('0xe9')]=_0x5382c5[_0xab5a('0xe9')];}if(this[_0xab5a('0x25')][_0x5382c5[_0xab5a('0xba')]]){this['uniqueId'][_0x5382c5[_0xab5a('0xba')]][_0xab5a('0xe9')]=_0x5382c5['channel'];}};Dialer[_0xab5a('0x18')][_0xab5a('0x3a')]=function(_0x431184){if(!this[_0xab5a('0x23')][_0x431184[_0xab5a('0xea')]]){return;}var _0x291709=this[_0xab5a('0x1d')][this[_0xab5a('0x23')][_0x431184[_0xab5a('0xea')]][_0xab5a('0xb9')]]['strategy']||_0xab5a('0xeb');if(_0x291709===_0xab5a('0xec')){if(this[_0xab5a('0x23')][_0x431184[_0xab5a('0xea')]]&&_[_0xab5a('0xed')](this[_0xab5a('0x23')][_0x431184[_0xab5a('0xea')]][_0xab5a('0xee')])&&_0x431184[_0xab5a('0x86')]==='1'&&_0x431184[_0xab5a('0xef')]==='0'){if(this[_0xab5a('0x1f')][_0x431184[_0xab5a('0xf0')]]){if(!this[_0xab5a('0x1f')][_0x431184[_0xab5a('0xf0')]][_0xab5a('0xee')]){this['agents'][_0x431184[_0xab5a('0xf0')]][_0xab5a('0xee')]=!![];this[_0xab5a('0x23')][_0x431184[_0xab5a('0xea')]][_0xab5a('0xee')]=!![];this[_0xab5a('0x23')][_0x431184[_0xab5a('0xea')]][_0xab5a('0xf0')]=_0x431184[_0xab5a('0xf0')];}}}}else if(_0x291709===_0xab5a('0xeb')){if(this[_0xab5a('0x23')][_0x431184['actionid']]){if(this[_0xab5a('0x1f')][_0x431184[_0xab5a('0xf0')]]){this['actions'][_0x431184[_0xab5a('0xea')]][_0xab5a('0xf0')]=_0x431184[_0xab5a('0xf0')];if(_[_0xab5a('0xed')](this['queueBooked'][this[_0xab5a('0x23')][_0x431184['actionid']][_0xab5a('0xb9')]])){this[_0xab5a('0x2a')][this[_0xab5a('0x23')][_0x431184[_0xab5a('0xea')]][_0xab5a('0xb9')]]=[];}this[_0xab5a('0x2a')][this[_0xab5a('0x23')][_0x431184['actionid']]['queue']][_0xab5a('0x97')](_[_0xab5a('0x5e')](_[_0xab5a('0x72')](this[_0xab5a('0x23')][_0x431184[_0xab5a('0xea')]],['idHopper',_0xab5a('0xf0')]),{'status':_0x431184[_0xab5a('0x86')],'paused':_0x431184[_0xab5a('0xef')]}));}}}};Dialer[_0xab5a('0x18')][_0xab5a('0xf1')]=function(_0x149afd){if(!this[_0xab5a('0x23')][_0x149afd[_0xab5a('0xea')]]){return;}var _0x5e5abb=this;var _0x1c3921=this[_0xab5a('0x1d')][this['actions'][_0x149afd[_0xab5a('0xea')]][_0xab5a('0xb9')]];var _0x9cf5a4=_0x1c3921['strategy']||'rrmemory';if(_0x9cf5a4===_0xab5a('0xec')){if(this['actions'][_0x149afd['actionid']]&&this[_0xab5a('0x23')][_0x149afd[_0xab5a('0xea')]][_0xab5a('0xf0')]){this[_0xab5a('0xf2')][_0xab5a('0xf3')](this[_0xab5a('0x23')][_0x149afd['actionid']]['idHopper'],this['actions'][_0x149afd[_0xab5a('0xea')]][_0xab5a('0xf0')])[_0xab5a('0x9e')](function(_0x7c35d7){logger[_0xab5a('0x62')](_0xab5a('0xf4'),util['inspect'](_0x7c35d7,{'showHidden':![],'depth':null}));})[_0xab5a('0x1b')](function(){_0x5e5abb[_0xab5a('0xbd')](_0x5e5abb[_0xab5a('0x1d')][_0x5e5abb[_0xab5a('0x23')][_0x149afd[_0xab5a('0xea')]][_0xab5a('0xb9')]]);_0x5e5abb[_0xab5a('0x1f')][_0x5e5abb[_0xab5a('0x23')][_0x149afd[_0xab5a('0xea')]][_0xab5a('0xf0')]][_0xab5a('0xee')]=![];delete _0x5e5abb[_0xab5a('0x23')][_0x149afd[_0xab5a('0xea')]];unlockQueueStatus(_0x1c3921);});}else{this[_0xab5a('0xbd')](this[_0xab5a('0x1d')][this[_0xab5a('0x23')][_0x149afd[_0xab5a('0xea')]][_0xab5a('0xb9')]]);hopperUtils[_0xab5a('0xe5')]({'active':![],'ContactId':this[_0xab5a('0x23')][_0x149afd[_0xab5a('0xea')]]['ContactId'],'ListId':this[_0xab5a('0x23')][_0x149afd[_0xab5a('0xea')]][_0xab5a('0xd8')],'VoiceQueueId':this[_0xab5a('0x23')][_0x149afd['actionid']][_0xab5a('0xd9')]||undefined,'CampaignId':this[_0xab5a('0x23')][_0x149afd[_0xab5a('0xea')]][_0xab5a('0xe6')]||undefined})[_0xab5a('0x9e')](loggerCatch(_0xab5a('0xf5')));delete this[_0xab5a('0x23')][_0x149afd[_0xab5a('0xea')]];unlockQueueStatus(_0x1c3921);}}else if(_0x9cf5a4===_0xab5a('0xeb')){var _0x27c3ee;if(this['actions'][_0x149afd[_0xab5a('0xea')]]&&!_[_0xab5a('0x48')](this[_0xab5a('0x2a')][this['actions'][_0x149afd[_0xab5a('0xea')]][_0xab5a('0xb9')]])){if(this[_0xab5a('0x2b')][_0x5e5abb[_0xab5a('0x23')][_0x149afd['actionid']][_0xab5a('0xb9')]]){this[_0xab5a('0x2b')][_0x5e5abb[_0xab5a('0x23')][_0x149afd[_0xab5a('0xea')]][_0xab5a('0xb9')]]=this[_0xab5a('0x2b')][this[_0xab5a('0x23')][_0x149afd['actionid']]['queue']]?this[_0xab5a('0x2b')][this[_0xab5a('0x23')][_0x149afd[_0xab5a('0xea')]]['queue']]:this[_0xab5a('0x2a')][this[_0xab5a('0x23')][_0x149afd[_0xab5a('0xea')]][_0xab5a('0xb9')]]?this[_0xab5a('0x2a')][this['actions'][_0x149afd[_0xab5a('0xea')]][_0xab5a('0xb9')]]['_rr']||0x0:0x0;}this[_0xab5a('0x2a')][this[_0xab5a('0x23')][_0x149afd[_0xab5a('0xea')]][_0xab5a('0xb9')]]['_rr']=this[_0xab5a('0x2b')][this['actions'][_0x149afd['actionid']][_0xab5a('0xb9')]];for(var _0x5cf709=0x0;_0x5cf709=_0x1ee383['dialGlobalMaxRetry']){_0x29cd1c[_0xab5a('0x11a')](_0x54ec0d,_0x437b10,_0x21197a,_0xab5a('0x11b'));}else{if(_0x54ec0d[_0xab5a('0x115')]>=_0x1ee383[_0xab5a('0x11c')]){_0x29cd1c[_0xab5a('0x11d')](_0x54ec0d,_0x437b10,_0x21197a,_0xab5a('0x11e'));}else{hopperUtils[_0xab5a('0xe5')]({'active':![],'countmachineretry':_0x54ec0d[_0xab5a('0x115')],'scheduledat':moment()[_0xab5a('0xd5')](_0x1ee383['dialMachineRetryFrequency'],'minutes')[_0xab5a('0x7a')](_0xab5a('0xc3')),'ContactId':_0x54ec0d[_0xab5a('0xd7')],'ListId':_0x54ec0d[_0xab5a('0xd8')],'VoiceQueueId':_0x54ec0d[_0xab5a('0xd9')]||undefined,'CampaignId':_0x54ec0d[_0xab5a('0xe6')]||undefined})[_0xab5a('0x9e')](loggerCatch(_0xab5a('0x11f')));_0x437b10({'reschedule':0x1});}}});}if(_0x1d927f[_0xab5a('0xbb')]===_0xab5a('0xbc')&&this['campaigns'][_0x1d927f[_0xab5a('0xb9')]][_0xab5a('0x113')]&&_0x2c9459[_0xab5a('0x109')]===_0xab5a('0x120')){delete this[_0xab5a('0x25')][_0x2c9459[_0xab5a('0xba')]];this[_0xab5a('0xbd')](this[_0xab5a('0x1e')][_0x1d927f['queue']]);_0x49ada2=new Hangup(_0x1d927f,_0x2c9459);_0x49ada2['state']=0x12;_0x49ada2[_0xab5a('0x6b')]=_0xab5a('0x10c');_0x49ada2[_0xab5a('0x10d')]=_0xab5a('0x10e');ami[_0xab5a('0x40')]('custom:amd',ut['buildObj'](_0x49ada2,_0xab5a('0x10f')));this[_0xab5a('0x110')](_0x49ada2,_0xab5a('0x121'),_0xab5a('0x122'));}if(_0x1d927f['type']===_0xab5a('0xbc')&&this[_0xab5a('0x1e')][_0x1d927f[_0xab5a('0xb9')]][_0xab5a('0x113')]&&_0x2c9459[_0xab5a('0x109')]==='MACHINE'){return new Promise(function(_0x1706ad,_0x37bf29){delete _0x29cd1c[_0xab5a('0x25')][_0x2c9459[_0xab5a('0xba')]];_0x29cd1c[_0xab5a('0xbd')](_0x29cd1c['campaigns'][_0x1d927f[_0xab5a('0xb9')]]);_0x29cd1c['campaigns'][_0x1d927f[_0xab5a('0xb9')]][_0xab5a('0x10a')]+=0x1;_0x29cd1c['campaigns'][_0x1d927f['queue']][_0xab5a('0x10b')]+=0x1;var _0x54b0bb=_0x29cd1c[_0xab5a('0x1e')][_0x1d927f[_0xab5a('0xb9')]];var _0x404128=new Hangup(_0x1d927f,_0x2c9459);_0x404128[_0xab5a('0x6a')]=0x13;_0x404128[_0xab5a('0x6b')]=_0xab5a('0x114');_0x404128[_0xab5a('0x10d')]=_0xab5a('0x10e');_0x404128['countmachineretry']+=0x1;_0x404128[_0xab5a('0xce')]+=0x1;_0x404128['amd']=!![];ami[_0xab5a('0x40')](_0xab5a('0x123'),ut[_0xab5a('0x116')](_0x404128,_0xab5a('0x10f')));hopperUtils[_0xab5a('0xc4')](_0x404128)[_0xab5a('0x9e')](loggerCatch(_0xab5a('0x124')));if(_0x404128[_0xab5a('0x117')]+_0x404128[_0xab5a('0x118')]+_0x404128[_0xab5a('0x119')]+_0x404128[_0xab5a('0x125')]+_0x404128[_0xab5a('0xd4')]+_0x404128[_0xab5a('0xe4')]+_0x404128[_0xab5a('0x115')]+_0x404128['countagentrejectretry']>=_0x54b0bb[_0xab5a('0x126')]){_0x29cd1c[_0xab5a('0x11a')](_0x404128,_0x1706ad,_0x37bf29,_0xab5a('0x11b'));}else{if(_0x404128[_0xab5a('0x115')]>=_0x54b0bb['dialMachineMaxRetry']){_0x29cd1c[_0xab5a('0x11d')](_0x404128,_0x1706ad,_0x37bf29,_0xab5a('0x11e'));}else{hopperUtils[_0xab5a('0xe5')]({'active':![],'countmachineretry':_0x404128[_0xab5a('0x115')],'scheduledat':moment()[_0xab5a('0xd5')](_0x54b0bb[_0xab5a('0x127')],'minutes')[_0xab5a('0x7a')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x404128[_0xab5a('0xd7')],'ListId':_0x404128['ListId'],'VoiceQueueId':_0x404128['VoiceQueueId']||undefined,'CampaignId':_0x404128['CampaignId']||undefined})[_0xab5a('0x9e')](loggerCatch(_0xab5a('0x11f')));_0x1706ad({'reschedule':0x1});}}});}}};Dialer[_0xab5a('0x18')][_0xab5a('0x35')]=function(_0x14b2c4){var _0x1aaffb=this['uniqueId'][_0x14b2c4[_0xab5a('0xba')]];var _0x4f9715;if(_0x1aaffb&&_0x1aaffb['type']===_0xab5a('0xbc')){delete this['uniqueId'][_0x14b2c4[_0xab5a('0xba')]];this[_0xab5a('0xbd')](this['campaigns'][_0x1aaffb['queue']]);this['campaigns'][_0x1aaffb[_0xab5a('0xb9')]][_0xab5a('0x128')]+=0x1;_0x4f9715=new Hangup(_0x1aaffb,_0x14b2c4);hopperUtils['createHistory'](_0x4f9715)[_0xab5a('0x9e')](loggerCatch(_0xab5a('0x129')));hopperUtils[_0xab5a('0xc6')](_0x4f9715)[_0xab5a('0x9e')](loggerCatch('[syncHangupIvr]'));}if(_0x1aaffb&&_0x1aaffb[_0xab5a('0xbb')]!==_0xab5a('0xbc')&&isNotNull(this[_0xab5a('0x1d')][_0x1aaffb['queue']][_0xab5a('0x12a')])){delete this[_0xab5a('0x25')][_0x14b2c4['uniqueid']];this[_0xab5a('0xbd')](this[_0xab5a('0x1d')][_0x1aaffb[_0xab5a('0xb9')]]);this[_0xab5a('0x1d')][_0x1aaffb['queue']][_0xab5a('0x10a')]+=0x1;this[_0xab5a('0x1d')][_0x1aaffb[_0xab5a('0xb9')]]['outboundAnswerAgiCallsDay']+=0x1;_0x4f9715=new Hangup(_0x1aaffb,_0x14b2c4);_0x4f9715[_0xab5a('0x6a')]=0x10;_0x4f9715[_0xab5a('0x6b')]=_0xab5a('0x12b');_0x4f9715[_0xab5a('0x10d')]=_0xab5a('0x12c');hopperUtils[_0xab5a('0xc4')](_0x4f9715)[_0xab5a('0x9e')](loggerCatch(_0xab5a('0x129')));hopperUtils['moveContactManagedDialer'](_0x4f9715)[_0xab5a('0x9e')](loggerCatch(_0xab5a('0x12d')));}if(_0x1aaffb&&_0x1aaffb[_0xab5a('0xbb')]!==_0xab5a('0xbc')&&!isNotNull(this[_0xab5a('0x1d')][_0x1aaffb['queue']][_0xab5a('0x12a')])){delete this['uniqueId'][_0x14b2c4[_0xab5a('0xba')]];this[_0xab5a('0xbd')](this['voiceQueues'][_0x1aaffb[_0xab5a('0xb9')]]);this[_0xab5a('0x1d')][_0x1aaffb[_0xab5a('0xb9')]]['outboundUnknownCallsDay']+=0x1;_0x4f9715=new Hangup(_0x1aaffb,_0x14b2c4);_0x4f9715[_0xab5a('0x6a')]=0xc;_0x4f9715['statedesc']=_0x14b2c4[_0xab5a('0x12e')];_0x4f9715['membername']=_0xab5a('0x12f');hopperUtils[_0xab5a('0xc4')](_0x4f9715)['catch'](loggerCatch(_0xab5a('0x129')));hopperUtils[_0xab5a('0xc6')](_0x4f9715)['catch'](loggerCatch(_0xab5a('0x12d')));}};Dialer[_0xab5a('0x18')]['syncQueueSummary']=function(_0x2d02cd){var _0x25f8c6=this;if(!_0x25f8c6['queuesSummary'][_0x2d02cd[_0xab5a('0x46')]]){_0x25f8c6[_0xab5a('0x130')][_0x2d02cd['name']]={'running':![]};}else if(_0x25f8c6[_0xab5a('0x130')][_0x2d02cd[_0xab5a('0x46')]]['running']===!![]){return;}else if(_0x25f8c6[_0xab5a('0x130')][_0x2d02cd['name']]['running']===![]){_0x25f8c6[_0xab5a('0x130')][_0x2d02cd[_0xab5a('0x46')]][_0xab5a('0x131')]=!![];}var _0x4ba092=_0x25f8c6['voiceQueues'][_0x2d02cd[_0xab5a('0x46')]];var _0x4b9658=_0x4ba092[_0xab5a('0x66')]!==utils[_0xab5a('0x67')]['INACTIVE'];var _0x4992d2=utils[_0xab5a('0x132')](_0x4ba092);_0x4ba092['statusMessage']=utils[_0xab5a('0x133')](_0x4ba092,_0x25f8c6['trunks']);Promise[_0xab5a('0x134')]()[_0xab5a('0x3d')](function(){if(_0x4ba092[_0xab5a('0x135')]===utils[_0xab5a('0x67')][_0xab5a('0x136')]){if(_0x4b9658){clearPredictiveAttributes(_0x4ba092);_0x2d02cd[_0xab5a('0x27')]=undefined;_0x2d02cd[_0xab5a('0x28')]=undefined;}if(_0x4ba092['statusMessage']===utils[_0xab5a('0x67')][_0xab5a('0x136')]){_0x2d02cd['available']=0x0;_0x2d02cd[_0xab5a('0xef')]=0x0;_0x2d02cd[_0xab5a('0x137')]=0x0;_0x2d02cd[_0xab5a('0x138')]=0x0;_0x2d02cd[_0xab5a('0x139')]=0x0;}}else if(_0x4ba092[_0xab5a('0x135')]===utils[_0xab5a('0x67')]['ACTIVE']&&!_0x4992d2){return _0x25f8c6['ifTime'](_0x4ba092,!![])['then'](function(){return _0x25f8c6['ifTime'](_0x4ba092,![]);})[_0xab5a('0x3d')](function(){return _0x25f8c6[_0xab5a('0xab')](_0x4ba092);})['catch'](function(_0x1325b8){loggerSyncQueueSummary['debug'](_0xab5a('0x13a'),util['inspect'](_0x1325b8,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x4ba092);});}else{clearPredictiveAttributes(_0x4ba092);}})['then'](function(){var _0x528f5d=_0x2d02cd[_0xab5a('0x13b')](_0x4ba092);if(_0x528f5d||_0x4ba092[_0xab5a('0x13c')]){_0x4ba092['queueSummaryCountersUpdated']=![];_0x2d02cd['updateReportFromOutboundQueue'](_0x4ba092);Object[_0xab5a('0x13d')](_0x4ba092,_0x2d02cd);emitOutboundVoiceQueueSummary(_0x2d02cd);}_0x25f8c6[_0xab5a('0x130')][_0x4ba092[_0xab5a('0x46')]][_0xab5a('0x131')]=![];})[_0xab5a('0x9e')](function(_0x209f5f){logger[_0xab5a('0x62')](_0xab5a('0x13a'),util[_0xab5a('0x44')](_0x209f5f,{'showHidden':![],'depth':null}));_0x25f8c6[_0xab5a('0x130')][_0x4ba092[_0xab5a('0x46')]]['running']=![];});};Dialer[_0xab5a('0x18')][_0xab5a('0x33')]=_[_0xab5a('0x13e')](function(){var _0x5f0b75=_[_0xab5a('0x13f')](this['voiceQueues'],function(_0x35a4bc){return _0x35a4bc['dialPreviewRecallmeReminder'];});var _0x5795be=_[_0xab5a('0x13f')](this[_0xab5a('0x1f')],function(_0x1d09fe){return _0x1d09fe['online']&&_0x1d09fe[_0xab5a('0x86')]===_0xab5a('0x140');});if(_0x5f0b75[_0xab5a('0x96')]>0x0&&_0x5795be[_0xab5a('0x96')]>0x0){return Promise['resolve']()['then'](cmHopper['handlePreviewRecallNotifications'](_['map'](_0x5f0b75,'id'),previewRecallmeReminderInterval,_[_0xab5a('0x141')](_0x5795be,'id')))[_0xab5a('0x3d')](function(_0x1d5a43){for(var _0x1347bf=0x0;_0x1347bf<_0x1d5a43[_0xab5a('0x96')];_0x1347bf++){var _0x40dbc3=_0x1d5a43[_0x1347bf][_0xab5a('0x142')][_0xab5a('0x46')];if(_0x40dbc3)io['to'](util[_0xab5a('0x7a')]('user:%s',_0x40dbc3))[_0xab5a('0x40')](_0xab5a('0x143'),{'hopper':_0x1d5a43[_0x1347bf]});}})[_0xab5a('0x9e')](function(_0x242a52){logger['error']('checkPreviewRecallReminder',_0x242a52);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0xab5a('0x18')][_0xab5a('0x144')]=function(){var _0x280083=this;setInterval(function(){_0x280083[_0xab5a('0x145')](_0x280083[_0xab5a('0x25')],_0xab5a('0x146'));_0x280083[_0xab5a('0x145')](_0x280083[_0xab5a('0x23')],'[actions]');},0x32c8);};Dialer[_0xab5a('0x18')][_0xab5a('0x145')]=function(_0x5935d5,_0x55cfed){var _0x30652c=this;for(var _0x32c9d2 in _0x5935d5){if(typeof _0x5935d5[_0x32c9d2]!=='undefined'){this[_0xab5a('0x1c')]['enqueue'](function(){if(!_[_0xab5a('0xed')](_0x5935d5[_0x32c9d2])){return ami[_0xab5a('0x98')]({'action':_0xab5a('0x86'),'channel':_0x5935d5[_0x32c9d2][_0xab5a('0xe9')]})[_0xab5a('0x9e')](function(_0x5d0f7f){if(_0x5d0f7f['message']==='No\x20such\x20channel'){setTimeout(function(){if(_0x5935d5[_0x32c9d2]&&_0x5935d5[_0x32c9d2][_0xab5a('0xbb')]!==_0xab5a('0xbc')){_0x30652c['updateOriginated'](_0x30652c[_0xab5a('0x1d')][_0x5935d5[_0x32c9d2][_0xab5a('0xb9')]]);logger[_0xab5a('0x62')]('[Dialer][checkChannel]',_0x55cfed,_0x32c9d2,_0x5935d5[_0x32c9d2]['queue']);delete _0x5935d5[_0x32c9d2];}if(_0x5935d5[_0x32c9d2]&&_0x5935d5[_0x32c9d2][_0xab5a('0xbb')]===_0xab5a('0xbc')){_0x30652c[_0xab5a('0xbd')](_0x30652c[_0xab5a('0x1e')][_0x5935d5[_0x32c9d2][_0xab5a('0xb9')]]);logger[_0xab5a('0x62')](_0xab5a('0x147'),_0x55cfed,_0x32c9d2,_0x5935d5[_0x32c9d2][_0xab5a('0xb9')]);delete _0x5935d5[_0x32c9d2];}},0x2328);}});}});}}};Dialer[_0xab5a('0x18')][_0xab5a('0x148')]=function(_0x3b4e61){return Promise['resolve']()[_0xab5a('0x3d')](voiceQueueRt['getVoiceQueueRtPauses'](_0x3b4e61))[_0xab5a('0x9e')](loggerCatch(_0xab5a('0x149')));};Dialer[_0xab5a('0x18')][_0xab5a('0xbd')]=function(_0x3ea620){if(!_[_0xab5a('0x3f')](_0x3ea620)&&_0x3ea620!==null){if(typeof _0x3ea620[_0xab5a('0x14a')]!=='undefined'){if(_0x3ea620[_0xab5a('0x14a')]>0x0){_0x3ea620[_0xab5a('0x14a')]-=0x1;}else{logger[_0xab5a('0x62')](_0xab5a('0x14b'));}}}else{logger[_0xab5a('0x62')]('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0xab5a('0x18')]['loggerHandler']=function(_0x5b8642,_0x2c2187){var _0x1e138c=this;return function(_0x5692f5){_0x1e138c['updateOriginated'](_0x2c2187);logger['error'](_0x5b8642,util[_0xab5a('0x44')](_0x5692f5,{'showHidden':![],'depth':null}));};};Dialer['prototype']['emptyContact']=function(_0xf95522,_0x7ec3ef,_0x313702){var _0x1694e7={'state':0x19,'statedesc':_0xab5a('0x14c')};this['updateOriginated'](_0x7ec3ef);this[_0xab5a('0x110')](_['merge'](_0x1694e7,_[_0xab5a('0x72')](_0x313702,[_0xab5a('0xd7'),_0xab5a('0xd8'),_0xab5a('0x14d'),_0xab5a('0xd9'),_0xab5a('0xe6')])),_0xab5a('0x14e'),_0xab5a('0x14f'));logger[_0xab5a('0x62')](_0xf95522);};Dialer[_0xab5a('0x18')][_0xab5a('0x110')]=function(_0x4456ad,_0x21eea6,_0xbda9bf){hopperUtils['createHistory'](_0x4456ad)[_0xab5a('0x9e')](loggerCatch(_0x21eea6));hopperUtils[_0xab5a('0xc6')](_0x4456ad)[_0xab5a('0x9e')](loggerCatch(_0xbda9bf));};Dialer[_0xab5a('0x18')]['queueCallerAbandonCreateState']=function(_0x2f7867,_0x29c046){hopperUtils['createHistory'](_0x2f7867)[_0xab5a('0x9e')](loggerCatch(_0xab5a('0xc5')));if(_0x29c046==0x0){hopperUtils[_0xab5a('0xc6')](_0x2f7867)[_0xab5a('0x9e')](loggerCatch(_0xab5a('0x150')));}};Dialer[_0xab5a('0x18')][_0xab5a('0x151')]=function(_0x1064b5){return Promise['resolve']()[_0xab5a('0x3d')](cmHopper[_0xab5a('0x152')](_0x1064b5['id'],previewRecallmeReminderInterval))['then'](function(_0x26770d){for(var _0x20bb15=0x0;_0x20bb15<_0x26770d[_0xab5a('0x96')];_0x20bb15++){var _0x2429dd=_0x26770d[_0x20bb15][_0xab5a('0x142')]['name'];if(_0x2429dd)io['to'](util['format'](_0xab5a('0x153'),_0x2429dd))[_0xab5a('0x40')](_0xab5a('0x143'),{'hopper':_0x26770d[_0x20bb15]});}})['catch'](function(){});};Dialer[_0xab5a('0x18')][_0xab5a('0xaa')]=function(_0x321b2f){var _0x1d22d1=this;return function(){_0x1d22d1['handleIvr'](_0x321b2f);};};Dialer[_0xab5a('0x18')][_0xab5a('0x154')]=function(_0x5a6f39,_0x278e1c){var _0x33e920=this;var _0x2dcddc=uuid['v4']();this['actions'][_0x2dcddc]=new Action(_0x5a6f39,_0x278e1c,_0x2dcddc);return new Promise(function(_0x28c534,_0x58e5b7){if(_[_0xab5a('0x3f')](_0x5a6f39)&&typeof _0x5a6f39!==_0xab5a('0x155')){return _0x58e5b7(msgResponse(_0xab5a('0x156'),_0xab5a('0x8e'),_0xab5a('0x157')));}if(_[_0xab5a('0x3f')](_0x278e1c['phone'])||_0x278e1c[_0xab5a('0x158')]===null){return _0x58e5b7(msgResponse(_0xab5a('0x156'),_0xab5a('0x8e'),_0xab5a('0x159')));}var _0x2f7a04={'XMD-CALLERID':_0x33e920[_0xab5a('0x23')][_0x2dcddc][_0xab5a('0x15a')](),'XMD-AGI':_0x5a6f39[_0xab5a('0x12a')]?util['format'](_0xab5a('0x15b'),ipAgi,_0x5a6f39[_0xab5a('0x12a')]):_0xab5a('0x15c'),'XMD-AGIAFTER':_0x5a6f39['dialQueueProject2']?util[_0xab5a('0x7a')]('\x22agi://%s/square,%s\x22',ipAgi,_0x5a6f39[_0xab5a('0xc1')]):'NONE','XMD-QUEUE':utils[_0xab5a('0x15d')](_0x5a6f39)?util[_0xab5a('0x7a')](_0xab5a('0x15e'),_0x5a6f39[_0xab5a('0x46')],_0x5a6f39[_0xab5a('0x15f')]||'',_0x5a6f39[_0xab5a('0xc2')]?'c':'',_0x5a6f39['dialQueueTimeout']||0x3):'NONE','XMD-CONTACTID':_0x278e1c[_0xab5a('0xd7')],'XMD-CDRTYPE':_0xab5a('0x160'),'CALLERID(all)':_0x33e920[_0xab5a('0x23')][_0x2dcddc][_0xab5a('0x15a')](),'XMD-AMD':_0x5a6f39['dialAMDActive']?_0xab5a('0x161'):_0xab5a('0x15c'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x5a6f39[_0xab5a('0x113')]){_0x2f7a04[_0xab5a('0x162')]=_0x5a6f39[_0xab5a('0x163')]||0x9c4;_0x2f7a04[_0xab5a('0x164')]=_0x5a6f39['dialAMDGreeting']||0x5dc;_0x2f7a04[_0xab5a('0x165')]=_0x5a6f39[_0xab5a('0x166')]||0x320;_0x2f7a04[_0xab5a('0x167')]=_0x5a6f39[_0xab5a('0x168')]||0x1388;_0x2f7a04[_0xab5a('0x169')]=_0x5a6f39[_0xab5a('0x16a')]||0x64;_0x2f7a04['XMD-AMDBETWEENWORDSSILENCE']=_0x5a6f39[_0xab5a('0x16b')]||0x32;_0x2f7a04['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x5a6f39[_0xab5a('0x16c')]||0x3;_0x2f7a04['XMD-AMDSILENCETHRESHOLD']=_0x5a6f39[_0xab5a('0x16d')]||0x100;_0x2f7a04['XMD-AMDMAXIMUMWORDLENGTH']=_0x5a6f39[_0xab5a('0x16e')]||0x1388;}if(utils[_0xab5a('0x15d')](_0x5a6f39)){_0x2f7a04['XMD-VOICEQUEUEID']=_0x278e1c[_0xab5a('0xd9')];}else{_0x2f7a04[_0xab5a('0x16f')]=_0x278e1c[_0xab5a('0xe6')];}var _0x3fba39=utils[_0xab5a('0x170')](_0x278e1c[_0xab5a('0x171')]);Object['assign'](_0x2f7a04,_0x3fba39);var _0x40d49c=_0x33e920[_0xab5a('0x83')](_0x5a6f39['Trunk'])?utils['getCallerId'](_0x5a6f39['Trunk']['callerid'],_0x5a6f39[_0xab5a('0x172')],_0x5a6f39[_0xab5a('0x173')]>0x0?utils[_0xab5a('0x174')](_0x5a6f39[_0xab5a('0x175')],_0x5a6f39[_0xab5a('0x173')]):_0x5a6f39['dialOriginateCallerIdNumber']):utils[_0xab5a('0x176')](_[_0xab5a('0xed')](_0x5a6f39[_0xab5a('0x89')])?_0x5a6f39[_0xab5a('0x88')][_0xab5a('0x177')]:_0x5a6f39[_0xab5a('0x89')][_0xab5a('0x177')],_0x5a6f39[_0xab5a('0x172')],_0x5a6f39[_0xab5a('0x173')]>0x0?utils['getCallerIdRandom'](_0x5a6f39['dialOriginateCallerIdNumber'],_0x5a6f39[_0xab5a('0x173')]):_0x5a6f39['dialOriginateCallerIdNumber']);if(_0x40d49c){_0x2f7a04[_0xab5a('0x178')]=_0x33e920[_0xab5a('0x23')][_0x2dcddc]['originatecalleridname']=utils[_0xab5a('0x179')](_0x40d49c);_0x2f7a04['XMD-ORIGINATECALLERIDNUM']=_0x278e1c['phone'];}_0x5a6f39['variables']=_0x2f7a04;return ami[_0xab5a('0x98')]({'actionid':_0x2dcddc,'action':_0xab5a('0x156'),'channel':_0x33e920['isTrunkReachable'](_0x5a6f39[_0xab5a('0x88')])?util[_0xab5a('0x7a')](_0xab5a('0x17a'),_0x5a6f39[_0xab5a('0x88')]['name'],isNotNull(_0x5a6f39['dialPrefix'])?_0x5a6f39['dialPrefix'][_0xab5a('0x17b')]()||'':'',_0x5a6f39[_0xab5a('0x17c')]>0x0?_0x278e1c['phone'][_0xab5a('0x17d')](_0x5a6f39['dialCutDigit']):_0x278e1c[_0xab5a('0x158')]):util[_0xab5a('0x7a')](_0xab5a('0x17a'),_[_0xab5a('0xed')](_0x5a6f39['TrunkBackup'])?_0x5a6f39[_0xab5a('0x88')][_0xab5a('0x46')]:_0x5a6f39[_0xab5a('0x89')][_0xab5a('0x46')],isNotNull(_0x5a6f39[_0xab5a('0x17e')])?_0x5a6f39[_0xab5a('0x17e')]['trim']()||'':'',_0x5a6f39[_0xab5a('0x17c')]>0x0?_0x278e1c['phone']['substring'](_0x5a6f39[_0xab5a('0x17c')]):_0x278e1c[_0xab5a('0x158')]),'callerid':_0x40d49c,'Exten':_0xab5a('0x108'),'Context':'from-sip','Priority':'1','variable':_0x2f7a04,'timeout':(_0x5a6f39['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x2dcddc})[_0xab5a('0x3d')](function(_0x37734f){return _0x28c534(_0x37734f);})[_0xab5a('0x9e')](function(_0x59719b){_0x5a6f39[_0xab5a('0x17f')]+=0x1;var _0x4c1afb=new History(_0x33e920[_0xab5a('0x23')][_0x2dcddc]);logger['error'](util[_0xab5a('0x7a')](_0xab5a('0x180'),JSON[_0xab5a('0x71')](_0x59719b)));_0x4c1afb['state']=0xe;_0x4c1afb[_0xab5a('0x6b')]=_0xab5a('0x181');_0x4c1afb['starttime']=moment()[_0xab5a('0x7a')](_0xab5a('0xc3'));_0x4c1afb['endtime']=_0x4c1afb[_0xab5a('0x6d')];hopperUtils[_0xab5a('0xc4')](_0x4c1afb)['catch'](loggerCatch(_0xab5a('0x182')));_0x33e920['moveContactManagedDialer'](_0x4c1afb)[_0xab5a('0x9e')](loggerCatch('[originate][error]'))[_0xab5a('0x1b')](function(){delete _0x33e920[_0xab5a('0x23')][_0x2dcddc];return _0x58e5b7(msgResponse(_0xab5a('0x156'),'Error',_0xab5a('0x183')));});});});};Dialer['prototype'][_0xab5a('0x184')]=function(_0x33b288,_0x138df5,_0x425431){var _0x2acb67=new History(_0x138df5);if(_0x2acb67[_0xab5a('0x117')]+_0x2acb67[_0xab5a('0x118')]+_0x2acb67[_0xab5a('0x119')]+_0x2acb67[_0xab5a('0x125')]+_0x2acb67[_0xab5a('0xd4')]+_0x2acb67[_0xab5a('0xe4')]+_0x2acb67[_0xab5a('0x115')]+_0x2acb67[_0xab5a('0x185')]>=_0x425431['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x33b288){case 0x3:if(_0x2acb67[_0xab5a('0x119')]>=_0x425431[_0xab5a('0x186')]-0x1){return!![];}hopperUtils[_0xab5a('0xe5')]({'active':![],'countnoanswerretry':_0x2acb67[_0xab5a('0x119')]+=0x1,'scheduledat':moment()[_0xab5a('0xd5')](_0x425431[_0xab5a('0x187')],_0xab5a('0xd6'))[_0xab5a('0x7a')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2acb67['ContactId'],'ListId':_0x2acb67[_0xab5a('0xd8')],'VoiceQueueId':_0x2acb67[_0xab5a('0xd9')]||undefined,'CampaignId':_0x2acb67[_0xab5a('0xe6')]||undefined})[_0xab5a('0x9e')](loggerCatch(_0xab5a('0x188')));break;case 0x5:if(_0x2acb67['countbusyretry']>=_0x425431[_0xab5a('0x189')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countbusyretry':_0x2acb67['countbusyretry']+=0x1,'scheduledat':moment()[_0xab5a('0xd5')](_0x425431[_0xab5a('0x18a')],'minutes')[_0xab5a('0x7a')](_0xab5a('0xc3')),'ContactId':_0x2acb67[_0xab5a('0xd7')],'ListId':_0x2acb67[_0xab5a('0xd8')],'VoiceQueueId':_0x2acb67[_0xab5a('0xd9')]||undefined,'CampaignId':_0x2acb67[_0xab5a('0xe6')]||undefined})[_0xab5a('0x9e')](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x2acb67[_0xab5a('0x118')]>=_0x425431['dialCongestionMaxRetry']-0x1){return!![];}hopperUtils[_0xab5a('0xe5')]({'active':![],'countcongestionretry':_0x2acb67[_0xab5a('0x118')]+=0x1,'scheduledat':moment()[_0xab5a('0xd5')](_0x425431[_0xab5a('0x18b')],'minutes')[_0xab5a('0x7a')](_0xab5a('0xc3')),'ContactId':_0x2acb67['ContactId'],'ListId':_0x2acb67[_0xab5a('0xd8')],'VoiceQueueId':_0x2acb67['VoiceQueueId']||undefined,'CampaignId':_0x2acb67[_0xab5a('0xe6')]||undefined})[_0xab5a('0x9e')](loggerCatch(_0xab5a('0x18c')));break;case 0x0:if(_0x2acb67[_0xab5a('0x125')]>=_0x425431[_0xab5a('0x18d')]-0x1){return!![];}else{hopperUtils[_0xab5a('0xe5')]({'active':![],'countnosuchnumberretry':_0x2acb67[_0xab5a('0x125')]+=0x1,'scheduledat':moment()[_0xab5a('0xd5')](_0x425431[_0xab5a('0x18e')],_0xab5a('0xd6'))[_0xab5a('0x7a')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2acb67['ContactId'],'ListId':_0x2acb67[_0xab5a('0xd8')],'VoiceQueueId':_0x2acb67[_0xab5a('0xd9')]||undefined,'CampaignId':_0x2acb67[_0xab5a('0xe6')]||undefined})[_0xab5a('0x9e')](loggerCatch(_0xab5a('0x18f')));}break;case 0xa:if(_0x2acb67[_0xab5a('0xd4')]>=_0x425431[_0xab5a('0xd2')]-0x1){return!![];}hopperUtils[_0xab5a('0xe5')]({'active':![],'countdropretry':_0x2acb67['countdropretry']+=0x1,'scheduledat':moment()['add'](_0x425431[_0xab5a('0xcf')],_0xab5a('0xd6'))[_0xab5a('0x7a')](_0xab5a('0xc3')),'ContactId':_0x2acb67[_0xab5a('0xd7')],'ListId':_0x2acb67[_0xab5a('0xd8')],'VoiceQueueId':_0x2acb67[_0xab5a('0xd9')]||undefined,'CampaignId':_0x2acb67[_0xab5a('0xe6')]||undefined})[_0xab5a('0x9e')](loggerCatch(_0xab5a('0xda')));break;case 0xb:if(_0x2acb67[_0xab5a('0xe4')]>=_0x425431['dialAbandonedMaxRetry']-0x1){return!![];}hopperUtils[_0xab5a('0xe5')]({'active':![],'countabandonedretry':_0x2acb67[_0xab5a('0xe4')]+=0x1,'scheduledat':moment()['add'](_0x425431['dialAbandonedRetryFrequency'],_0xab5a('0xd6'))[_0xab5a('0x7a')](_0xab5a('0xc3')),'ContactId':_0x2acb67[_0xab5a('0xd7')],'ListId':_0x2acb67['ListId'],'VoiceQueueId':_0x2acb67[_0xab5a('0xd9')]||undefined,'CampaignId':_0x2acb67['CampaignId']||undefined})[_0xab5a('0x9e')](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x2acb67[_0xab5a('0x115')]>=_0x425431['dialMachineMaxRetry']-0x1){return!![];}hopperUtils[_0xab5a('0xe5')]({'active':![],'countmachineretry':_0x2acb67[_0xab5a('0x115')]+=0x1,'scheduledat':moment()['add'](_0x425431[_0xab5a('0x127')],'minutes')['format'](_0xab5a('0xc3')),'ContactId':_0x2acb67[_0xab5a('0xd7')],'ListId':_0x2acb67['ListId'],'VoiceQueueId':_0x2acb67[_0xab5a('0xd9')]||undefined,'CampaignId':_0x2acb67[_0xab5a('0xe6')]||undefined})[_0xab5a('0x9e')](loggerCatch(_0xab5a('0x11f')));break;case 0x14:if(_0x2acb67['countagentrejectretry']>=_0x425431[_0xab5a('0x190')]-0x1){return!![];}hopperUtils[_0xab5a('0xe5')]({'active':![],'countagentrejectretry':_0x2acb67[_0xab5a('0x185')]+=0x1,'scheduledat':moment()[_0xab5a('0xd5')](_0x425431['dialAgentRejectRetryFrequency'],_0xab5a('0xd6'))[_0xab5a('0x7a')](_0xab5a('0xc3')),'ContactId':_0x2acb67[_0xab5a('0xd7')],'ListId':_0x2acb67[_0xab5a('0xd8')],'VoiceQueueId':_0x2acb67['VoiceQueueId']||undefined,'CampaignId':_0x2acb67[_0xab5a('0xe6')]||undefined})[_0xab5a('0x9e')](loggerCatch(_0xab5a('0x191')));break;default:return!![];}};Dialer[_0xab5a('0x18')][_0xab5a('0x104')]=function(_0x4b3365,_0x315102,_0xe0de3d){var _0x2387d3=this;var _0x3a62ab=new History(_0x4b3365);var _0x43189a=![];var _0x2aeebf;var _0x29bfc8;return new Promise(function(_0x1557c6,_0x2841a5){if(_[_0xab5a('0x3f')](_0x315102)&&typeof _0x315102!==_0xab5a('0x155')){return _0x2841a5(msgResponse(_0xab5a('0x192'),'Failure',_0xab5a('0x193')));}if(_[_0xab5a('0x3f')](_0xe0de3d)&&typeof _0xe0de3d!==_0xab5a('0x155')){return _0x2841a5(msgResponse(_0xab5a('0x192'),_0xab5a('0x8e'),_0xab5a('0x194')));}hopperUtils[_0xab5a('0xe3')](_0x3a62ab,_0xe0de3d[_0xab5a('0x195')],_0x315102)[_0xab5a('0x3d')](function(_0x49fad7){if(_0x49fad7['additional']==0x1)_0x43189a=!![];switch(_0xe0de3d[_0xab5a('0x195')]){case'0':_0x315102[_0xab5a('0x196')]+=0x1;_0x3a62ab['state']=0x0;_0x3a62ab[_0xab5a('0x6b')]='NoSuchNumber';_0x3a62ab['countnosuchnumberretry']+=0x1;_0x3a62ab[_0xab5a('0xce')]+=0x1;ami[_0xab5a('0x40')](_0xab5a('0x197'),ut[_0xab5a('0x116')](_0x4b3365,_0xab5a('0x198')));_0x2aeebf=_0x315102['dialNoSuchNumberRetryFrequency'];_0x29bfc8=_0x315102[_0xab5a('0xd0')];hopperUtils[_0xab5a('0xc4')](_0x3a62ab)[_0xab5a('0x9e')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x2387d3[_0xab5a('0x184')](0x0,_0x4b3365,_0x315102)&&!_0x43189a){if(_0x3a62ab[_0xab5a('0x125')]>=_0x315102[_0xab5a('0x18d')]){_0x2387d3[_0xab5a('0x11d')](_0x3a62ab,_0x1557c6,_0x2841a5,_0xab5a('0x199'));}else{_0x2387d3[_0xab5a('0x11a')](_0x3a62ab,_0x1557c6,_0x2841a5,_0xab5a('0x199'));}}break;case'3':_0x315102['outboundNoAnswerCallsDay']+=0x1;_0x3a62ab[_0xab5a('0x6a')]=0x3;_0x3a62ab['statedesc']=_0xab5a('0x19a');_0x3a62ab['countnoanswerretry']+=0x1;_0x3a62ab[_0xab5a('0xce')]+=0x1;var _0x4fd99d=ut[_0xab5a('0x19b')](_0x4b3365,_0x315102);ami[_0xab5a('0x40')](_0xab5a('0x19c'),_0x4fd99d);_0x2aeebf=_0x315102[_0xab5a('0x187')];_0x29bfc8=_0x315102[_0xab5a('0xd0')];hopperUtils[_0xab5a('0xc4')](_0x3a62ab)[_0xab5a('0x9e')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x2387d3[_0xab5a('0x184')](0x3,_0x4b3365,_0x315102)&&!_0x43189a){if(_0x3a62ab['countnoanswerretry']>=_0x315102[_0xab5a('0x186')]){_0x2387d3[_0xab5a('0x11d')](_0x3a62ab,_0x1557c6,_0x2841a5,_0xab5a('0x19d'));}else{_0x2387d3[_0xab5a('0x11a')](_0x3a62ab,_0x1557c6,_0x2841a5,_0xab5a('0x19d'));}}break;case'5':_0x315102['outboundBusyCallsDay']+=0x1;_0x3a62ab[_0xab5a('0x6a')]=0x5;_0x3a62ab[_0xab5a('0x6b')]='Busy';_0x3a62ab[_0xab5a('0x117')]+=0x1;_0x3a62ab[_0xab5a('0xce')]+=0x1;ami[_0xab5a('0x40')](_0xab5a('0x19e'),ut['buildObj'](_0x4b3365,_0xab5a('0x19f')));_0x2aeebf=_0x315102[_0xab5a('0x18a')];_0x29bfc8=_0x315102[_0xab5a('0xd0')];hopperUtils[_0xab5a('0xc4')](_0x3a62ab)[_0xab5a('0x9e')](loggerCatch(_0xab5a('0x1a0')));if(_0x2387d3[_0xab5a('0x184')](0x5,_0x4b3365,_0x315102)&&!_0x43189a){if(_0x3a62ab['countbusyretry']>=_0x315102[_0xab5a('0x189')]){_0x2387d3['createStateFinal'](_0x3a62ab,_0x1557c6,_0x2841a5,'reason\x205\x20busy');}else{_0x2387d3[_0xab5a('0x11a')](_0x3a62ab,_0x1557c6,_0x2841a5,_0xab5a('0x1a1'));}}break;case'8':_0x315102['outboundCongestionCallsDay']+=0x1;_0x3a62ab[_0xab5a('0x6a')]=0x8;_0x3a62ab[_0xab5a('0x6b')]='Congestion';_0x3a62ab[_0xab5a('0x118')]+=0x1;_0x3a62ab['countglobal']+=0x1;_0x2aeebf=_0x315102[_0xab5a('0x18b')];_0x29bfc8=_0x315102[_0xab5a('0xd0')];ami[_0xab5a('0x40')](_0xab5a('0x1a2'),ut[_0xab5a('0x116')](_0x4b3365,'congestion'));hopperUtils[_0xab5a('0xc4')](_0x3a62ab)[_0xab5a('0x9e')](loggerCatch(_0xab5a('0x1a3')));if(_0x2387d3[_0xab5a('0x184')](0x8,_0x4b3365,_0x315102)&&!_0x43189a){if(_0x3a62ab[_0xab5a('0x118')]>=_0x315102[_0xab5a('0x1a4')]){_0x2387d3[_0xab5a('0x11d')](_0x3a62ab,_0x1557c6,_0x2841a5,_0xab5a('0x1a5'));}else{_0x2387d3[_0xab5a('0x11a')](_0x3a62ab,_0x1557c6,_0x2841a5,_0xab5a('0x1a5'));}}break;case'11':_0x315102[_0xab5a('0x1a6')]+=0x1;_0x3a62ab[_0xab5a('0x6a')]=0xb;_0x3a62ab[_0xab5a('0x6b')]='Abandoned';_0x3a62ab[_0xab5a('0xe4')]+=0x1;_0x3a62ab[_0xab5a('0xce')]+=0x1;_0x2aeebf=_0x315102[_0xab5a('0xe2')];_0x29bfc8=_0x315102[_0xab5a('0xd0')];hopperUtils['createHistory'](_0x3a62ab)[_0xab5a('0x9e')](loggerCatch(_0xab5a('0xe8')));if(_0x2387d3[_0xab5a('0x184')](0xb,_0x4b3365,_0x315102)&&!_0x43189a){if(_0x3a62ab[_0xab5a('0xe4')]>=_0x315102[_0xab5a('0x1a7')]){_0x2387d3[_0xab5a('0x11d')](_0x3a62ab,_0x1557c6,_0x2841a5,_0xab5a('0x1a8'));}else{_0x2387d3[_0xab5a('0x11a')](_0x3a62ab,_0x1557c6,_0x2841a5,_0xab5a('0x1a8'));}}break;case'20':_0x315102[_0xab5a('0x1a9')]+=0x1;_0x3a62ab[_0xab5a('0x6a')]=0x14;_0x3a62ab[_0xab5a('0x6b')]=_0xab5a('0x1aa');_0x3a62ab[_0xab5a('0x185')]+=0x1;_0x3a62ab[_0xab5a('0xce')]+=0x1;_0x2aeebf=_0x315102[_0xab5a('0x1ab')];_0x29bfc8=_0x315102[_0xab5a('0xd0')];ami['emit'](_0xab5a('0x1ac'),ut[_0xab5a('0x116')](_0x4b3365,'agentreject'));hopperUtils[_0xab5a('0xc4')](_0x3a62ab)[_0xab5a('0x9e')](loggerCatch(_0xab5a('0x1ad')));if(_0x2387d3[_0xab5a('0x184')](0x14,_0x4b3365,_0x315102)&&!_0x43189a){if(_0x3a62ab[_0xab5a('0x185')]>=_0x315102[_0xab5a('0x190')]){_0x2387d3[_0xab5a('0x11d')](_0x3a62ab,_0x1557c6,_0x2841a5,'reason\x2020\x20agentreject');}else{_0x2387d3['stateGlobal'](_0x3a62ab,_0x1557c6,_0x2841a5,_0xab5a('0x1ae'));}}break;default:_0x315102[_0xab5a('0x1af')]+=0x1;_0x3a62ab[_0xab5a('0x6a')]=0xc;_0x3a62ab[_0xab5a('0x6b')]=_0xe0de3d['reason'];_0x2aeebf=_0x315102[_0xab5a('0x1ab')];_0x29bfc8=_0x315102[_0xab5a('0xd0')];hopperUtils[_0xab5a('0xc4')](_0x3a62ab)[_0xab5a('0x9e')](loggerCatch(_0xab5a('0x1b0')));if(_0x2387d3[_0xab5a('0x184')](_0xe0de3d[_0xab5a('0x195')],_0x4b3365,_0x315102)&&!_0x43189a){if(_0x3a62ab[_0xab5a('0x117')]+_0x3a62ab[_0xab5a('0x118')]+_0x3a62ab[_0xab5a('0x119')]+_0x3a62ab[_0xab5a('0x125')]+_0x3a62ab[_0xab5a('0xd4')]+_0x3a62ab[_0xab5a('0xe4')]+_0x3a62ab[_0xab5a('0x115')]+_0x3a62ab[_0xab5a('0x185')]>=_0x315102[_0xab5a('0x126')]){_0x2387d3[_0xab5a('0x11a')](_0x3a62ab,_0x1557c6,_0x2841a5,_0xe0de3d[_0xab5a('0x195')]);}else{_0x2387d3['createStateFinal'](_0x3a62ab,_0x1557c6,_0x2841a5,_0xe0de3d[_0xab5a('0x195')]);}}}})[_0xab5a('0x3d')](function(){if(_0x43189a){hopperUtils[_0xab5a('0xde')](_0x3a62ab,_0x2aeebf,_0x29bfc8)[_0xab5a('0x3d')](function(){return _0x1557c6(0x1);});}});});};Dialer[_0xab5a('0x18')][_0xab5a('0x11a')]=function(_0x3b20ab,_0x19055d,_0x299cd8,_0x5cb94e){var _0x1f8780=new Final(_0x3b20ab);_0x1f8780[_0xab5a('0x6a')]=0xf;_0x1f8780[_0xab5a('0x6b')]=_0xab5a('0x1b1');this[_0xab5a('0x11d')](_0x1f8780,_0x19055d,_0x299cd8,_0x5cb94e);};Dialer['prototype']['createStateFinal']=function(_0x165c10,_0x4af85b,_0x471ff4,_0x566fa4){hopperUtils[_0xab5a('0xc6')](_0x165c10)[_0xab5a('0x3d')](function(){return _0x4af85b(msgResponse('[callProgressDetecting]',_0xab5a('0x1b2'),_0x566fa4));})['catch'](function(){return _0x471ff4(msgResponse(_0xab5a('0x1b3'),_0xab5a('0x8e'),_0xab5a('0x1b4')));});};Dialer[_0xab5a('0x18')][_0xab5a('0x8')]=function(_0x2b1c4e){var _0x133983=_0x2b1c4e[_0xab5a('0x1b5')]/0x64;var _0x12c8b7=_0x2b1c4e[_0xab5a('0x1b6')]/(_0x2b1c4e['outboundDropCallsDayTimeout']+_0x2b1c4e[_0xab5a('0x10a')]);var _0x3b0e37=Math['round'](_0x2b1c4e[_0xab5a('0x1b7')]*(_0x2b1c4e[_0xab5a('0x1b8')]/0x64));var _0x2816af=Math[_0xab5a('0x1b9')](_0x2b1c4e[_0xab5a('0x1b7')]*(_0x2b1c4e[_0xab5a('0x1ba')]/0x64));var _0x956ce3=_0x2b1c4e[_0xab5a('0x1bb')]+_0x2b1c4e[_0xab5a('0x138')];var _0x386822=Math['floor'](_0x2b1c4e['erlangCalls']*_0x2b1c4e['erlangAbandonmentRate']*_0x2b1c4e[_0xab5a('0x1bc')]*_0x2b1c4e[_0xab5a('0x1bd')]);if(_[_0xab5a('0x3f')](_0x2b1c4e[_0xab5a('0x28')])){if(!_[_0xab5a('0x3f')](_0x2b1c4e[_0xab5a('0x27')])){_0x2b1c4e[_0xab5a('0x27')]=undefined;loggerPredictive['error'](_0xab5a('0x1be'),_0xab5a('0x1bf'));}if(!_['isUndefined'](_0x2b1c4e[_0xab5a('0x61')])){loggerPredictive['error'](_0xab5a('0x1be'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x2b1c4e[_0xab5a('0x61')]);_0x2b1c4e[_0xab5a('0x61')]=undefined;}_0x2b1c4e['startProgressive']=moment()[_0xab5a('0x7a')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xab5a('0x49')](_0x2b1c4e[_0xab5a('0x46')],_0xab5a('0x1c0'),_0x2b1c4e[_0xab5a('0x28')]);this[_0xab5a('0xaf')](_0x2b1c4e,0x1);}else if(ifInterval(_0x2b1c4e['dialPredictiveInterval'],_0x2b1c4e[_0xab5a('0x28')])){this['handlePower'](_0x2b1c4e,0x1);loggerPredictiveCalls['info'](_0xab5a('0x1c1'),_0x2b1c4e[_0xab5a('0x28')],_0x2b1c4e[_0xab5a('0x46')]);_0x2b1c4e['erlangCalls']=0x0;_0x2b1c4e['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x133983<_0x12c8b7&&_0x2b1c4e[_0xab5a('0x1c2')]===_0xab5a('0x1c3')){clearPredictiveAttributes(_0x2b1c4e);loggerPredictive[_0xab5a('0x49')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day',_0x12c8b7,_0xab5a('0x28'),_0x2b1c4e[_0xab5a('0x46')]);}else if(_0x386822<_0x2b1c4e[_0xab5a('0xcb')]&&_0x2b1c4e[_0xab5a('0x1c2')]===_0xab5a('0x1c3')){clearPredictiveAttributes(_0x2b1c4e);loggerPredictive['info'](_0xab5a('0x1c4'),_0xab5a('0x1c5'),_0x386822,_0xab5a('0x1c6'),_0x2b1c4e[_0xab5a('0xcb')],_0xab5a('0x28'),_0x2b1c4e[_0xab5a('0x46')]);}else if(!ifInterval(_0x2b1c4e[_0xab5a('0x1c7')],_0x2b1c4e['startProgressive'])&&_[_0xab5a('0x3f')](_0x2b1c4e['startPredictive'])&&!_[_0xab5a('0x3f')](_0x2b1c4e['startProgressive'])){_0x2b1c4e[_0xab5a('0x27')]=moment()[_0xab5a('0x7a')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xab5a('0x49')](_0x2b1c4e[_0xab5a('0x46')],'started\x20in\x20predictive\x20at',_0x2b1c4e[_0xab5a('0x27')]);hopperUtils['avgHandleTime'](_0x2b1c4e[_0xab5a('0x1c7')])['then'](this[_0xab5a('0x1c8')](_0x2b1c4e))[_0xab5a('0x3d')](mergeDataErlangB(_0x2b1c4e))['then'](this[_0xab5a('0x1c9')](_0x2b1c4e))[_0xab5a('0x9e')](loggerCatchPredictive(_0xab5a('0x1ca'),_0x2b1c4e));}else if(!ifInterval(_0x2b1c4e[_0xab5a('0x1c7')],_0x2b1c4e[_0xab5a('0x27')])){_0x2b1c4e[_0xab5a('0xcb')]=0x0;_0x2b1c4e[_0xab5a('0x27')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xab5a('0x49')](_0x2b1c4e['name'],_0xab5a('0x1cb'),_0x2b1c4e[_0xab5a('0x27')]);clearInterval(_0x2b1c4e[_0xab5a('0x61')]);_0x2b1c4e[_0xab5a('0x61')]=undefined;hopperUtils[_0xab5a('0x1cc')](_0x2b1c4e[_0xab5a('0x1c7')])[_0xab5a('0x3d')](this[_0xab5a('0x1c8')](_0x2b1c4e))['then'](mergeDataErlangB(_0x2b1c4e))['then'](this[_0xab5a('0x1c9')](_0x2b1c4e))[_0xab5a('0x9e')](loggerCatchPredictive(_0xab5a('0x1cd'),_0x2b1c4e));}else if(_0x2b1c4e[_0xab5a('0x1b7')]&&_0x956ce3<_0x2b1c4e['predictiveIntervalAvailable']-_0x2816af){clearPredictiveAttributes(_0x2b1c4e);loggerPredictive[_0xab5a('0x49')](_0x2b1c4e['name'],_0xab5a('0x1ce'),_0x956ce3,_0xab5a('0x1cf'),_0x2b1c4e[_0xab5a('0x1b7')],'-',_0x2816af,'=',_0x2b1c4e[_0xab5a('0x1b7')]-_0x2816af,')');}else if(_0x2b1c4e[_0xab5a('0x1b7')]&&_0x956ce3>_0x2b1c4e[_0xab5a('0x1b7')]+_0x3b0e37){clearPredictiveAttributes(_0x2b1c4e);loggerPredictive[_0xab5a('0x49')](_0x2b1c4e['name'],_0xab5a('0x1ce'),_0x956ce3,_0xab5a('0x1d0'),_0x2b1c4e[_0xab5a('0x1b7')],'+',_0x3b0e37,'=',_0x2b1c4e[_0xab5a('0x1b7')]+_0x3b0e37,')');}};Dialer[_0xab5a('0x18')]['getDataPredictive']=function(_0x4222d2){var _0x3ca3d8=this;return function(_0x31539c){return new Promise(function(_0x7b8223,_0x364dfe){_[_0xab5a('0x5e')](_0x4222d2,_0x31539c[0x0]);if(checkGetDataPredictive(_0x31539c[0x0])){var _0x20cec8=_0x4222d2[_0xab5a('0x1b7')]=_0x4222d2[_0xab5a('0x138')]+_0x4222d2[_0xab5a('0x1bb')];var _0x150cac=_0x4222d2[_0xab5a('0x1c7')]*0x3c;var _0x3b54e8=_0x31539c[0x0][_0xab5a('0x52')]+_0x31539c[0x0][_0xab5a('0x55')];var _0x271c92=(_0x31539c[0x0]['predictiveIntervalAnsweredCalls']+_0x31539c[0x0][_0xab5a('0x4e')]+_0x31539c[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x31539c[0x0]['predictiveIntervalTotalCalls'];_0x4222d2[_0xab5a('0x1bc')]=_0x271c92>0x0?_0x271c92:0x1;switch(_0x4222d2[_0xab5a('0x1c2')]){case'dropRate':var _0x516ed9=_0x4222d2['dialPredictiveOptimizationPercentage']/0x64;return _0x3ca3d8['abandonmentRate'](_0x20cec8,_0x150cac,_0x3b54e8,_0x271c92,_0x516ed9)['then'](function(_0x3a9188){return _0x7b8223(_0x3a9188);});case _0xab5a('0x1d1'):var _0x3df529=_0x4222d2['dialPredictiveOptimizationPercentage']/0x64;return _0x3ca3d8[_0xab5a('0x1d2')](_0x20cec8,_0x150cac,_0x3b54e8,_0x271c92,_0x3df529)[_0xab5a('0x3d')](function(_0xf7d10b){return _0x7b8223(_0xf7d10b);});default:return _0x364dfe(msgResponse(_0xab5a('0x1d3'),_0xab5a('0x8e'),_0xab5a('0x1d4')));}}else{return _0x364dfe(msgResponse(_0xab5a('0x1d3'),_0xab5a('0x8e'),'check\x20failure'));}});};};Dialer[_0xab5a('0x18')][_0xab5a('0x1d5')]=function(_0x28c004){var _0x58c1f3=this;return function(_0x3a9779){return new Promise(function(_0x4675eb,_0x2b86ea){_[_0xab5a('0x5e')](_0x28c004,_0x3a9779[0x0]);if(checkGetDataPredictive(_0x3a9779[0x0])){loggerPredictive[_0xab5a('0x49')](JSON[_0xab5a('0x71')](_0x3a9779[0x0]));if(_0x28c004[_0xab5a('0x1c2')]===_0xab5a('0x1c3')){return _0x58c1f3['getVoiceQueueRtPauses'](_0x28c004['id'])[_0xab5a('0x3d')](function(_0x34579e){var _0x15a675=_0x28c004[_0xab5a('0x1d6')]-_0x34579e[0x0][_0xab5a('0x1d7')];var _0x2fe3c9=_0x28c004[_0xab5a('0x1c7')]*0x3c;var _0x5e386d=_0x3a9779[0x0][_0xab5a('0x52')]+_0x3a9779[0x0][_0xab5a('0x55')];var _0x515be9=(_0x3a9779[0x0][_0xab5a('0x4c')]+_0x3a9779[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x3a9779[0x0][_0xab5a('0x50')])/_0x3a9779[0x0]['predictiveIntervalTotalCalls'];var _0x4c1314=_0x28c004[_0xab5a('0x1b5')]/0x64;_0x28c004['predictiveIntervalPauses']=_0x34579e[0x0][_0xab5a('0x1d7')]||0x0;_0x28c004[_0xab5a('0x1bc')]=_0x515be9>0x0?_0x515be9:0x1;return _0x58c1f3[_0xab5a('0x1d8')](_0x15a675,_0x2fe3c9,_0x5e386d,_0x515be9,_0x4c1314);})[_0xab5a('0x3d')](function(_0x293bcb){return _0x4675eb(_0x293bcb);})[_0xab5a('0x9e')](function(_0x1f3fe4){return _0x2b86ea(msgResponse('[CatchErlangB]','Failure',JSON[_0xab5a('0x71')](_0x1f3fe4)));});}if(_0x28c004[_0xab5a('0x1c2')]==='agentBusyFactor'){return _0x58c1f3[_0xab5a('0x148')](_0x28c004['id'])[_0xab5a('0x3d')](function(_0x289e79){var _0x419b1c=_0x28c004[_0xab5a('0x1d6')]-_0x289e79[0x0][_0xab5a('0x1d7')];var _0x59034c=_0x28c004[_0xab5a('0x1c7')]*0x3c;var _0xe7b801=_0x3a9779[0x0][_0xab5a('0x52')]+_0x3a9779[0x0][_0xab5a('0x55')];var _0xcf5cc3=(_0x3a9779[0x0]['predictiveIntervalAnsweredCalls']+_0x3a9779[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x3a9779[0x0][_0xab5a('0x50')])/_0x3a9779[0x0][_0xab5a('0x4b')];var _0x376240=_0x28c004['dialPredictiveOptimizationPercentage']/0x64;_0x28c004[_0xab5a('0x1d9')]=_0x289e79[0x0][_0xab5a('0x1d7')]||0x0;_0x28c004[_0xab5a('0x1bc')]=_0xcf5cc3>0x0?_0xcf5cc3:0x1;return _0x58c1f3[_0xab5a('0x1d2')](_0x419b1c,_0x59034c,_0xe7b801,_0xcf5cc3,_0x376240);})['then'](function(_0x8f1e5a){return _0x4675eb(_0x8f1e5a);})[_0xab5a('0x9e')](function(_0x114438){return _0x2b86ea(msgResponse('[CatchErlangB]',_0xab5a('0x8e'),JSON['stringify'](_0x114438)));});}}else{return _0x2b86ea(msgResponse(_0xab5a('0x1d3'),_0xab5a('0x8e'),_0xab5a('0x1da')));}});};};Dialer[_0xab5a('0x18')][_0xab5a('0x1c9')]=function(_0x272c5c){var _0x5649ff=this;return function(){var _0x3b77ce=0x0;var _0x20b3d3=Math['floor'](_0x272c5c[_0xab5a('0x1db')]*0x3e8);if(_0x20b3d3>0x0){_0x20b3d3=_0x20b3d3<0x64?0x64:_0x20b3d3;loggerPredictive[_0xab5a('0x49')](_0x272c5c[_0xab5a('0x46')],'one\x20call\x20every:',_0x20b3d3,_0xab5a('0x1dc'));_0x272c5c[_0xab5a('0x61')]=setInterval(function(){_0x5649ff[_0xab5a('0x61')](_0x272c5c);loggerPredictiveCalls[_0xab5a('0x49')](_0xab5a('0x1dd'),_0x3b77ce+=0x1);},_0x20b3d3);}else{loggerPredictive[_0xab5a('0x49')](_0x272c5c[_0xab5a('0x46')],_0xab5a('0x1de'));}};};Dialer[_0xab5a('0x18')][_0xab5a('0x1df')]=function(_0x2f20b4,_0x3af9e5){var _0x395220=this;return function(_0x1ffa54){if(_[_0xab5a('0x48')](_0x1ffa54)){if(_[_0xab5a('0xed')](_0x3af9e5[_0xab5a('0x14d')])||!_0x3af9e5['recallme']){if(_0x2f20b4['dialMethod']==='booked'){_0x2f20b4['queueStatusComplete']=_['isUndefined'](_0x2f20b4['queueStatusComplete'])?!![]:_0x2f20b4[_0xab5a('0x6e')];var _0x2348e8=uuid['v4']();_0x395220['actions'][_0x2348e8]=new Action(_0x2f20b4,_0x3af9e5,_0x2348e8);loggerBooked[_0xab5a('0x49')](_0xab5a('0x1e0'),_0x2348e8,_0xab5a('0x1e1'),JSON[_0xab5a('0x71')](_0x2f20b4[_0xab5a('0x6e')]),_0xab5a('0x1e2'),_0x2f20b4[_0xab5a('0x46')]);if(_0x2f20b4[_0xab5a('0x6e')]){_0x2f20b4['queueStatusComplete']=![];_0x395220[_0xab5a('0x2a')][_0x395220['actions'][_0x2348e8][_0xab5a('0xb9')]]=[];ami[_0xab5a('0x98')]({'actionid':_0x2348e8,'action':_0xab5a('0x1e3'),'queue':_0x2f20b4[_0xab5a('0x46')]})['catch'](function(){_0x395220[_0xab5a('0xbd')](_0x2f20b4);hopperUtils[_0xab5a('0xe5')]({'active':![],'ContactId':_0x395220[_0xab5a('0x23')][_0x2348e8][_0xab5a('0xd7')],'ListId':_0x395220[_0xab5a('0x23')][_0x2348e8][_0xab5a('0xd8')],'VoiceQueueId':_0x395220[_0xab5a('0x23')][_0x2348e8][_0xab5a('0xd9')]||undefined,'CampaignId':_0x395220[_0xab5a('0x23')][_0x2348e8]['CampaignId']||undefined})[_0xab5a('0x9e')](loggerCatch(_0xab5a('0x1e4')));delete _0x395220[_0xab5a('0x23')][_0x2348e8];});}else{loggerBooked[_0xab5a('0x49')](_0xab5a('0x1e5'),JSON['stringify'](_0x2f20b4['queueStatusComplete']),_0xab5a('0x1e2'),_0x2f20b4[_0xab5a('0x46')]);_0x395220[_0xab5a('0xbd')](_0x2f20b4);hopperUtils[_0xab5a('0xe5')]({'active':![],'ContactId':_0x395220[_0xab5a('0x23')][_0x2348e8]['ContactId'],'ListId':_0x395220[_0xab5a('0x23')][_0x2348e8][_0xab5a('0xd8')],'VoiceQueueId':_0x395220[_0xab5a('0x23')][_0x2348e8]['VoiceQueueId']||undefined,'CampaignId':_0x395220[_0xab5a('0x23')][_0x2348e8][_0xab5a('0xe6')]||undefined})['catch'](loggerCatch(_0xab5a('0x1e4')));delete _0x395220[_0xab5a('0x23')][_0x2348e8];}}else{return _0x395220[_0xab5a('0x154')](_0x2f20b4,_0x3af9e5);}}else{if(utils[_0xab5a('0x5f')](undefined,_0x3af9e5[_0xab5a('0x1e6')])<_0x2f20b4['dialRecallMeTimeout']*0x3c){if(_0x3af9e5[_0xab5a('0x142')]&&!_0x3af9e5[_0xab5a('0x142')][_0xab5a('0x1e7')]){_0x395220[_0xab5a('0xf2')]['run'](_0x3af9e5['id'])['finally'](function(){_0x395220[_0xab5a('0xbd')](_0x2f20b4);});}else{hopperUtils[_0xab5a('0x1e8')]({'active':![]},_0x3af9e5['id'],0x1)[_0xab5a('0x1b')](function(){_0x395220[_0xab5a('0xbd')](_0x2f20b4);});}}else{_0x2f20b4[_0xab5a('0x1e9')]+=0x1;_0x395220[_0xab5a('0xbd')](_0x2f20b4);if(_0x2f20b4[_0xab5a('0x1ea')]){hopperUtils[_0xab5a('0xe5')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x3af9e5[_0xab5a('0xd7')],'ListId':_0x3af9e5[_0xab5a('0xd8')],'VoiceQueueId':_0x3af9e5[_0xab5a('0xd9')]||undefined,'CampaignId':_0x3af9e5['CampaignId']||undefined})[_0xab5a('0x9e')](loggerCatch(_0xab5a('0x1eb')));hopperUtils[_0xab5a('0xc4')](createObjHistory(_0x2f20b4,_0x3af9e5,utils[_0xab5a('0x67')][_0xab5a('0x1ec')],0x17,_0xab5a('0x1ed')))['catch'](loggerCatch(_0xab5a('0x1ee')));}else{_0x395220[_0xab5a('0x110')](createObjHistory(_0x2f20b4,_0x3af9e5,utils[_0xab5a('0x67')][_0xab5a('0x1ef')],0x16,'RecallFailedTimeout'),'[Originate][HistoryRecallClose][historyCatch]',_0xab5a('0x1f0'));}}}}else{_0x2f20b4[_0xab5a('0x1f1')]+=0x1;_0x395220[_0xab5a('0x110')](createObjHistory(_0x2f20b4,_0x3af9e5,utils[_0xab5a('0x67')][_0xab5a('0x1f2')],0xd,_0xab5a('0x1f3')),_0xab5a('0x1f4'),'[Originate][MoveBlacklist]');throw _0xab5a('0x1f5');}};};Dialer[_0xab5a('0x18')][_0xab5a('0x1f6')]=function(_0x561337){var _0x38bfb1=this;var _0x35a4dd=_0x561337[_0xab5a('0x1f7')]-_0x561337[_0xab5a('0x14a')];emitCampaignSummary(_0x561337);if(_0x35a4dd>0x0&&_0x561337[_0xab5a('0x1f8')]==0x0){if(_0x35a4dd>this[_0xab5a('0x21')]){_0x35a4dd=this[_0xab5a('0x21')];}_0x561337[_0xab5a('0x1f8')]=0x1;hopperUtils[_0xab5a('0x1f9')](_0x561337,_0x35a4dd)['then'](function(_0x397e70){_0x561337[_0xab5a('0x1f8')]=0x0;if(_0x397e70){if(!utils[_0xab5a('0x1fa')](_0x397e70)){_0x561337[_0xab5a('0x66')]=utils['CAMPAIGN_STATUS']['NO_AVAILABLE_CONTACTS'];logger[_0xab5a('0x49')](_0xab5a('0x1fb')+_0x561337[_0xab5a('0x46')]);}else{_0x561337['originated']+=_0x397e70[_0xab5a('0x96')];_0x561337[_0xab5a('0x66')]=utils[_0xab5a('0x67')][_0xab5a('0x1fc')];for(var _0x35e1e1=0x0;_0x35e1e1<_0x397e70[_0xab5a('0x96')];_0x35e1e1+=0x1){_0x561337[_0xab5a('0x1fd')]+=0x1;if(_['isNil'](_0x397e70[_0x35e1e1])||_['isNil'](_0x397e70[_0x35e1e1][_0xab5a('0x171')])||_[_0xab5a('0xed')](_0x397e70[_0x35e1e1]['phone'])){_0x38bfb1[_0xab5a('0x1fe')](_0xab5a('0x1ff'),_0x561337,_0x397e70[_0x35e1e1]);}else{hopperUtils[_0xab5a('0x200')](_[_0xab5a('0x72')](_0x397e70[_0x35e1e1],[_0xab5a('0xe6'),'phone']))[_0xab5a('0x3d')](_0x38bfb1[_0xab5a('0x1df')](_0x561337,_0x397e70[_0x35e1e1]))[_0xab5a('0x9e')](_0x38bfb1[_0xab5a('0x201')](_0xab5a('0x202'),_0x561337));}}}}})[_0xab5a('0x9e')](loggerGetContactDialer(_0xab5a('0x203'),_0x561337,_0x35a4dd));}};Dialer['prototype'][_0xab5a('0xaf')]=function(_0x3ee86c,_0x146af6){var _0x2747c9=this;var _0x40c152=[];if(_0x146af6<0x1||_0x3ee86c[_0xab5a('0xac')]===_0xab5a('0x7')){_0x146af6=0x1;}var _0xff857f=Math['floor'](_0x3ee86c[_0xab5a('0x1bb')]*_0x146af6)-_0x3ee86c[_0xab5a('0x14a')];if(_0x3ee86c[_0xab5a('0x204')]>0x0){var _0x43c7e2=_0x3ee86c[_0xab5a('0x204')]-_0x3ee86c[_0xab5a('0x14a')]-_0x3ee86c[_0xab5a('0x138')]-_0x3ee86c[_0xab5a('0x139')];if(_0xff857f>_0x43c7e2){_0xff857f=_0x43c7e2;}}if(_0xff857f>0x0&&_0x3ee86c[_0xab5a('0x1f8')]==0x0){if(_0x3ee86c['dialMethod']===_0xab5a('0x7')){_0xff857f=0x1;}if(_0xff857f>this[_0xab5a('0x21')]){_0xff857f=this[_0xab5a('0x21')];}for(var _0x522210 in this[_0xab5a('0x1f')]){if(typeof this[_0xab5a('0x1f')][_0x522210]!==_0xab5a('0xa6')){if(this[_0xab5a('0x1f')][_0x522210][_0xab5a('0x6a')]==='not_inuse'&&this[_0xab5a('0x1f')][_0x522210]['status']===_0xab5a('0x140')){_0x40c152[_0xab5a('0x97')](this[_0xab5a('0x1f')][_0x522210]['id']);}}}_0x3ee86c['temp']=0x1;hopperUtils['getContactDialer'](_0x3ee86c,_0x40c152,_0xff857f)['then'](function(_0x1e1961){_0x3ee86c[_0xab5a('0x1f8')]=0x0;if(_0x1e1961){if(!utils[_0xab5a('0x1fa')](_0x1e1961)){hopperUtils['countReScheduled'](_0x3ee86c)[_0xab5a('0x3d')](sendMessageReschedule(_0x3ee86c))[_0xab5a('0x9e')](loggerCatch(_0xab5a('0x205')));}else{_0x3ee86c[_0xab5a('0x14a')]+=_0x1e1961[_0xab5a('0x96')];_0x3ee86c['message']=_0x3ee86c[_0xab5a('0xac')]===_0xab5a('0x7')?utils[_0xab5a('0x67')][_0xab5a('0x161')]:utils[_0xab5a('0x67')][_0xab5a('0x1fc')];for(var _0x547766=0x0;_0x547766<_0x1e1961[_0xab5a('0x96')];_0x547766+=0x1){if(_['isNil'](_0x1e1961[_0x547766])||_[_0xab5a('0xed')](_0x1e1961[_0x547766][_0xab5a('0x171')])||_[_0xab5a('0xed')](_0x1e1961[_0x547766][_0xab5a('0x158')])){_0x2747c9[_0xab5a('0x1fe')]('[actionOriginate]\x20',_0x3ee86c,_0x1e1961[_0x547766]);}else{hopperUtils[_0xab5a('0x206')](_['pick'](_0x1e1961[_0x547766],[_0xab5a('0xd9'),_0xab5a('0x158')]))[_0xab5a('0x3d')](_0x2747c9['checkContactBlack'](_0x3ee86c,_0x1e1961[_0x547766]))[_0xab5a('0x9e')](_0x2747c9[_0xab5a('0x201')](_0xab5a('0x1ff'),_0x3ee86c));}}}}})[_0xab5a('0x9e')](loggerGetContactDialer('[getContactDialer2]',_0x3ee86c,_0xff857f));}};Dialer[_0xab5a('0x18')][_0xab5a('0x61')]=function(_0x3f0c08){if(_0x3f0c08[_0xab5a('0x204')]>0x0){var _0x17b75e=_0x3f0c08[_0xab5a('0x204')]-_0x3f0c08[_0xab5a('0x14a')]-_0x3f0c08['talking'];if(_0x17b75e>0x0&&_0x3f0c08['temp']==0x0){this[_0xab5a('0x207')](_0x3f0c08);}else{loggerPredictiveCalls[_0xab5a('0x49')](_0xab5a('0x208'));}}else{this[_0xab5a('0x207')](_0x3f0c08);}};Dialer[_0xab5a('0x18')][_0xab5a('0x207')]=function(_0x4bf97f){var _0x4559c2=this;var _0x2be919=[];_0x4bf97f[_0xab5a('0x14a')]+=0x1;for(var _0x43330f in this['agents']){if(typeof this['agents'][_0x43330f]!==_0xab5a('0xa6')){if(this['agents'][_0x43330f][_0xab5a('0x6a')]===_0xab5a('0x209')&&this['agents'][_0x43330f][_0xab5a('0x86')]===_0xab5a('0x140')){_0x2be919[_0xab5a('0x97')](this[_0xab5a('0x1f')][_0x43330f]['id']);}}}_0x4bf97f['temp']=0x1;return this[_0xab5a('0x20a')](_0x4bf97f['id'],_0x2be919,0x1,_0x4bf97f[_0xab5a('0x20b')],_0x4bf97f)[_0xab5a('0x3d')](function(_0x293ba6){_0x4bf97f[_0xab5a('0x1f8')]=0x1;if(_0x293ba6){if(!utils['checkContactEmpty'](_0x293ba6)){utils[_0xab5a('0x64')](_0x4bf97f,0x1,0x0);return hopperUtils['countReScheduled'](_0x4bf97f)['then'](sendMessageReschedule(_0x4bf97f))[_0xab5a('0x9e')](loggerCatch('[countReScheduled]\x20'));}else{_0x4bf97f[_0xab5a('0x66')]=utils[_0xab5a('0x67')]['RUNNING'];if(_[_0xab5a('0xed')](_0x293ba6[0x0])||_[_0xab5a('0xed')](_0x293ba6[0x0][_0xab5a('0x171')])||_[_0xab5a('0xed')](_0x293ba6[0x0][_0xab5a('0x158')])){_0x4559c2[_0xab5a('0x1fe')](_0xab5a('0x1ff'),_0x4bf97f,_0x293ba6[0x0]);}else{return hopperUtils['checkIsBlackList'](_[_0xab5a('0x72')](_0x293ba6[0x0],['VoiceQueueId',_0xab5a('0x158')]))[_0xab5a('0x3d')](_0x4559c2['checkContactBlack'](_0x4bf97f,_0x293ba6[0x0]))['catch'](_0x4559c2[_0xab5a('0x201')](_0xab5a('0x20c'),_0x4bf97f));}}}})[_0xab5a('0x9e')](loggerGetContactDialer(_0xab5a('0x20d'),_0x4bf97f,0x1));};Dialer[_0xab5a('0x18')][_0xab5a('0x1d8')]=function(_0x4115ac,_0x384baf,_0x581179,_0x2aaffa,_0x4e491b,_0x50d659){loggerPredictive[_0xab5a('0x49')](_0xab5a('0x20e'));loggerPredictive[_0xab5a('0x49')](_0xab5a('0x20f'),_0x4115ac);loggerPredictive[_0xab5a('0x49')](_0xab5a('0x210'),_0x384baf);loggerPredictive[_0xab5a('0x49')](_0xab5a('0x211'),_0x581179);loggerPredictive[_0xab5a('0x49')](_0xab5a('0x212'),_0x2aaffa);loggerPredictive[_0xab5a('0x49')](_0xab5a('0x213'),_0x4e491b);loggerPredictive[_0xab5a('0x49')](_0xab5a('0x53'));return new Promise(function(_0xc12b09,_0x50508d){if(_0x4115ac<=0x0||isNaN(_0x4115ac)){return _0x50508d(msgResponse('[abandonmentRate]','Error',_0xab5a('0x214')+_0x4115ac));}if(_0x581179<=0x0||isNaN(_0x581179)){return _0x50508d(msgResponse(_0xab5a('0x215'),_0xab5a('0xb8'),_0xab5a('0x216')+_0x581179));}if(_0x2aaffa<=0x0||isNaN(_0x2aaffa)){return _0x50508d(msgResponse(_0xab5a('0x215'),_0xab5a('0xb8'),_0xab5a('0x217')+_0x2aaffa));}if(_0x384baf<=0x0||isNaN(_0x384baf)){return _0x50508d(msgResponse(_0xab5a('0x215'),_0xab5a('0xb8'),_0xab5a('0x218')+_0x384baf));}if(_0x4e491b<=0x0||isNaN(_0x4e491b)){return _0x50508d(msgResponse(_0xab5a('0x215'),'Error',_0xab5a('0x219')+_0x4e491b));}_0x50d659=_0x50d659||0x0;var _0xe326a=0x1/_0x581179;var _0x5e68cb=0x0;var _0x3cc663=0x0;var _0x5ca53e=0x0;var _0x48b87b=0x0;for(var _0x49c828=0x0;_0x5ca53e<_0x4e491b;_0x49c828+=0x1){_0x3cc663=_0x49c828/_0x384baf;_0x5e68cb=(_0x2aaffa*_0x3cc663+_0x50d659)/_0xe326a;_0x5ca53e=utils[_0xab5a('0x21a')](_0x5e68cb,_0x4115ac);_0x48b87b=_0x5e68cb/_0x4115ac*(0x1-utils[_0xab5a('0x21a')](_0x5e68cb,_0x4115ac));}return _0xc12b09({'erlangCalls':_0x49c828,'erlangCallToSecond':_0x384baf/_0x49c828,'erlangAbandonmentRate':_0x5ca53e,'erlangBusyFactor':_0x48b87b});});};Dialer[_0xab5a('0x18')][_0xab5a('0x1d2')]=function(_0x14fb8c,_0x35e2be,_0x30e70d,_0x149627,_0x3e545a,_0x4b93e9){loggerPredictive[_0xab5a('0x49')](_0xab5a('0x21b'));loggerPredictive[_0xab5a('0x49')]('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',_0x14fb8c);loggerPredictive['info']('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x35e2be);loggerPredictive[_0xab5a('0x49')](_0xab5a('0x211'),_0x30e70d);loggerPredictive[_0xab5a('0x49')]('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',_0x149627);loggerPredictive[_0xab5a('0x49')](_0xab5a('0x21c'),_0x3e545a);loggerPredictive['info'](_0xab5a('0x53'));return new Promise(function(_0x5f5b1a,_0x32af97){if(_0x14fb8c<=0x0||isNaN(_0x14fb8c)){return _0x32af97(msgResponse(_0xab5a('0x21d'),_0xab5a('0xb8'),_0xab5a('0x214')+_0x14fb8c));}if(_0x30e70d<=0x0||isNaN(_0x30e70d)){return _0x32af97(msgResponse('[busyFactor]',_0xab5a('0xb8'),'Ts\x20=\x20'+_0x30e70d));}if(_0x149627<=0x0||isNaN(_0x149627)){return _0x32af97(msgResponse(_0xab5a('0x21d'),_0xab5a('0xb8'),'p\x20=\x20'+_0x149627));}if(_0x35e2be<=0x0||isNaN(_0x35e2be)){return _0x32af97(msgResponse(_0xab5a('0x21d'),'Error',_0xab5a('0x218')+_0x35e2be));}if(_0x3e545a<=0x0||isNaN(_0x3e545a)){return _0x32af97(msgResponse('[busyFactor]',_0xab5a('0xb8'),_0xab5a('0x21e')+_0x3e545a));}_0x4b93e9=_0x4b93e9||0x0;var _0x41b4be=0x1/_0x30e70d;var _0x445da9=0x0;var _0x3eeb69=0x0;var _0x52a6d3=0x0;var _0x635f45=0x0;for(var _0xd2d2d8=0x0;_0x635f45<_0x3e545a;_0xd2d2d8+=0x1){_0x3eeb69=_0xd2d2d8/_0x35e2be;_0x445da9=(_0x149627*_0x3eeb69+_0x4b93e9)/_0x41b4be;_0x52a6d3=utils[_0xab5a('0x21a')](_0x445da9,_0x14fb8c);_0x635f45=_0x445da9/_0x14fb8c*(0x1-utils[_0xab5a('0x21a')](_0x445da9,_0x14fb8c));}return _0x5f5b1a({'erlangCalls':_0xd2d2d8,'erlangCallToSecond':_0x35e2be/_0xd2d2d8,'erlangAbandonmentRate':_0x52a6d3,'erlangBusyFactor':_0x635f45});});};module[_0xab5a('0x21f')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/models/action.js b/server/services/ami/dialer/models/action.js index 5cc5cbc..9c79485 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 _0xc5a9=['util','lodash','moment','isNil','string','voiceQueue','uniqueid','Contact','phone','firstName','lastName','number','queue','name','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','dialCutDigit','substring','exports'];(function(_0x6fea4c,_0x3f33c3){var _0x222265=function(_0x5d8816){while(--_0x5d8816){_0x6fea4c['push'](_0x6fea4c['shift']());}};_0x222265(++_0x3f33c3);}(_0xc5a9,0x114));var _0x9c5a=function(_0x489b87,_0xd51c93){_0x489b87=_0x489b87-0x0;var _0x1823b6=_0xc5a9[_0x489b87];return _0x1823b6;};'use strict';var util=require(_0x9c5a('0x0'));var _=require(_0x9c5a('0x1'));var moment=require(_0x9c5a('0x2'));function checkNameSurname(_0x1f8f8f,_0x3c146e,_0x54c21f){var _0x3229c2='';if(!_[_0x9c5a('0x3')](_0x3c146e)&&_0x9c5a('0x4')===typeof _0x3c146e){_0x3229c2+=_0x3c146e;}if(!_[_0x9c5a('0x3')](_0x54c21f)&&'string'===typeof _0x54c21f){_0x3229c2+='\x20'+_0x54c21f;}if(_0x3229c2!==''){return _0x3229c2;}return _0x1f8f8f;}function Action(_0x21c59b,_0x389395,_0x36eb0d){this[_0x9c5a('0x5')]=_0x21c59b;this[_0x9c5a('0x6')]=_0x36eb0d||undefined;this['name']=checkNameSurname(_0x389395[_0x9c5a('0x7')][_0x9c5a('0x8')],_0x389395['Contact'][_0x9c5a('0x9')],_0x389395[_0x9c5a('0x7')][_0x9c5a('0xa')]);this[_0x9c5a('0xb')]=_0x389395['phone'];this[_0x9c5a('0xc')]=_0x21c59b[_0x9c5a('0xd')];this[_0x9c5a('0xe')]=_0x389395[_0x9c5a('0xe')]||![];this[_0x9c5a('0xf')]=_0x21c59b[_0x9c5a('0xf')];this['dialQueueTimeout']=_0x21c59b[_0x9c5a('0x10')]||0x3;this[_0x9c5a('0x11')]=_0x389395[_0x9c5a('0x11')];this[_0x9c5a('0x12')]=_0x389395[_0x9c5a('0x12')];this[_0x9c5a('0x13')]=_0x389395[_0x9c5a('0x13')];this[_0x9c5a('0x14')]=_0x389395[_0x9c5a('0x14')];this['countnosuchnumberretry']=_0x389395[_0x9c5a('0x15')];this[_0x9c5a('0x16')]=_0x389395['countdropretry'];this[_0x9c5a('0x17')]=_0x389395[_0x9c5a('0x17')];this[_0x9c5a('0x18')]=_0x389395[_0x9c5a('0x18')];this['countagentrejectretry']=_0x389395[_0x9c5a('0x19')];this[_0x9c5a('0x1a')]=_0x389395[_0x9c5a('0x1a')];this[_0x9c5a('0x1b')]=_0x389395[_0x9c5a('0x1b')];this[_0x9c5a('0x1c')]=_0x389395[_0x9c5a('0x1c')];this[_0x9c5a('0x1d')]=_0x389395[_0x9c5a('0x1d')];this[_0x9c5a('0x1e')]=_0x389395['CampaignId'];this['idHopper']=_0x389395['id'];this[_0x9c5a('0x1f')]=_0x389395[_0x9c5a('0x7')][_0x9c5a('0x9')]||'';this[_0x9c5a('0x20')]=moment()[_0x9c5a('0x21')](_0x9c5a('0x22'));this['callback']=_0x389395[_0x9c5a('0x23')];this[_0x9c5a('0x24')]=_0x389395[_0x9c5a('0x24')];this['callbackat']=_0x389395[_0x9c5a('0x25')];this[_0x9c5a('0x26')]=_0x389395['recallme'];this[_0x9c5a('0x27')]='';this[_0x9c5a('0x28')]='';}Action[_0x9c5a('0x29')][_0x9c5a('0x2a')]=function(){return util[_0x9c5a('0x21')]('\x22%s\x22\x20<%s>',this[_0x9c5a('0xd')],this[_0x9c5a('0x5')][_0x9c5a('0x2b')]>0x0?this['number'][_0x9c5a('0x2c')](this['voiceQueue'][_0x9c5a('0x2b')]):this[_0x9c5a('0xb')]);};Action[_0x9c5a('0x29')]['getQueue']=function(){return this['queue'];};module[_0x9c5a('0x2d')]=Action; \ No newline at end of file +var _0x3737=['UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','format','YYYY-MM-DD\x20HH:mm:ss','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','\x22%s\x22\x20<%s>','name','substring','dialCutDigit','getQueue','exports','lodash','moment','isNil','string','voiceQueue','Contact','phone','firstName','lastName','number','queue','active','type','dialQueueTimeout','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x3737,0xea));var _0x7373=function(_0x29b802,_0x42e3ae){_0x29b802=_0x29b802-0x0;var _0x4b91af=_0x3737[_0x29b802];return _0x4b91af;};'use strict';var util=require('util');var _=require(_0x7373('0x0'));var moment=require(_0x7373('0x1'));function checkNameSurname(_0x33ec2b,_0x4251ce,_0x3b35c5){var _0x321d82='';if(!_[_0x7373('0x2')](_0x4251ce)&&_0x7373('0x3')===typeof _0x4251ce){_0x321d82+=_0x4251ce;}if(!_[_0x7373('0x2')](_0x3b35c5)&&_0x7373('0x3')===typeof _0x3b35c5){_0x321d82+='\x20'+_0x3b35c5;}if(_0x321d82!==''){return _0x321d82;}return _0x33ec2b;}function Action(_0x310270,_0x31f9b6,_0x553657){this[_0x7373('0x4')]=_0x310270;this['uniqueid']=_0x553657||undefined;this['name']=checkNameSurname(_0x31f9b6[_0x7373('0x5')][_0x7373('0x6')],_0x31f9b6[_0x7373('0x5')][_0x7373('0x7')],_0x31f9b6[_0x7373('0x5')][_0x7373('0x8')]);this[_0x7373('0x9')]=_0x31f9b6[_0x7373('0x6')];this[_0x7373('0xa')]=_0x310270['name'];this[_0x7373('0xb')]=_0x31f9b6[_0x7373('0xb')]||![];this[_0x7373('0xc')]=_0x310270[_0x7373('0xc')];this[_0x7373('0xd')]=_0x310270['dialQueueTimeout']||0x3;this['scheduledat']=_0x31f9b6['scheduledat'];this['countbusyretry']=_0x31f9b6[_0x7373('0xe')];this[_0x7373('0xf')]=_0x31f9b6['countcongestionretry'];this['countnoanswerretry']=_0x31f9b6[_0x7373('0x10')];this[_0x7373('0x11')]=_0x31f9b6[_0x7373('0x11')];this[_0x7373('0x12')]=_0x31f9b6[_0x7373('0x12')];this['countabandonedretry']=_0x31f9b6[_0x7373('0x13')];this[_0x7373('0x14')]=_0x31f9b6[_0x7373('0x14')];this[_0x7373('0x15')]=_0x31f9b6['countagentrejectretry'];this['ContactId']=_0x31f9b6[_0x7373('0x16')];this[_0x7373('0x17')]=_0x31f9b6[_0x7373('0x17')];this['UserId']=_0x31f9b6[_0x7373('0x18')];this['VoiceQueueId']=_0x31f9b6[_0x7373('0x19')];this[_0x7373('0x1a')]=_0x31f9b6[_0x7373('0x1a')];this[_0x7373('0x1b')]=_0x31f9b6['id'];this[_0x7373('0x1c')]=_0x31f9b6['Contact'][_0x7373('0x7')]||'';this['starttime']=moment()[_0x7373('0x1d')](_0x7373('0x1e'));this['callback']=_0x31f9b6['callback'];this[_0x7373('0x1f')]=_0x31f9b6[_0x7373('0x1f')];this[_0x7373('0x20')]=_0x31f9b6[_0x7373('0x20')];this[_0x7373('0x21')]=_0x31f9b6[_0x7373('0x21')];this[_0x7373('0x22')]='';this[_0x7373('0x23')]='';}Action[_0x7373('0x24')]['getCaller']=function(){return util[_0x7373('0x1d')](_0x7373('0x25'),this[_0x7373('0x26')],this[_0x7373('0x4')]['dialCutDigit']>0x0?this[_0x7373('0x9')][_0x7373('0x27')](this[_0x7373('0x4')][_0x7373('0x28')]):this[_0x7373('0x9')]);};Action[_0x7373('0x24')][_0x7373('0x29')]=function(){return this[_0x7373('0xa')];};module[_0x7373('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 98d1a63..e9947d4 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 _0x40f5=['starttime','responsetime','answertime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','talktime','endtime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','agiafterat','exports','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum','number'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x40f5,0x14c));var _0x540f=function(_0x293e7a,_0x1792a2){_0x293e7a=_0x293e7a-0x0;var _0xb78342=_0x40f5[_0x293e7a];return _0xb78342;};'use strict';var moment=require('moment');var utils=require('../utils');function AgentComplete(_0x132e5d,_0xddb966){this[_0x540f('0x0')]=0x4;this[_0x540f('0x1')]=_0x540f('0x2');this[_0x540f('0x3')]=_0x132e5d['scheduledat'];this['type']=_0x132e5d[_0x540f('0x4')];this[_0x540f('0x5')]=_0x132e5d[_0x540f('0x4')]===_0x540f('0x6')?_0x540f('0x7'):_0x132e5d[_0x540f('0x4')];this['countbusyretry']=_0x132e5d[_0x540f('0x8')];this[_0x540f('0x9')]=_0x132e5d[_0x540f('0x9')];this[_0x540f('0xa')]=_0x132e5d[_0x540f('0xa')];this[_0x540f('0xb')]=_0x132e5d[_0x540f('0x8')]+_0x132e5d[_0x540f('0x9')]+_0x132e5d[_0x540f('0xa')]+_0x132e5d['countnosuchnumberretry']+_0x132e5d[_0x540f('0xc')]+_0x132e5d['countabandonedretry']+_0x132e5d['countmachineretry']+_0x132e5d['countagentrejectretry'];this[_0x540f('0xd')]=_0x132e5d[_0x540f('0xd')];this['countdropretry']=_0x132e5d[_0x540f('0xc')];this['countabandonedretry']=_0x132e5d['countabandonedretry'];this[_0x540f('0xe')]=_0x132e5d[_0x540f('0xe')];this[_0x540f('0xf')]=_0x132e5d[_0x540f('0xf')];this['uniqueid']=_0xddb966['uniqueid'];this[_0x540f('0x10')]=_0x132e5d[_0x540f('0x11')];this[_0x540f('0x12')]=_0x132e5d[_0x540f('0x13')];this[_0x540f('0x14')]=_0x132e5d[_0x540f('0x14')];this[_0x540f('0x15')]=_0x132e5d[_0x540f('0x15')];this['answertime']=_0x132e5d[_0x540f('0x16')];this['endtime']=moment()[_0x540f('0x17')](_0x540f('0x18'));this[_0x540f('0x19')]=utils[_0x540f('0x1a')](_0x132e5d[_0x540f('0x15')],_0x132e5d['starttime']);this[_0x540f('0x1b')]=utils[_0x540f('0x1a')](_0x132e5d[_0x540f('0x16')],_0x132e5d['responsetime']);this[_0x540f('0x1c')]=utils['getSeconds'](this[_0x540f('0x1d')],_0x132e5d[_0x540f('0x16')]);this[_0x540f('0x7')]=_0xddb966['queue'];this['membername']=_0xddb966[_0x540f('0x1e')];this['reason']=_0xddb966[_0x540f('0x1f')];this[_0x540f('0x20')]=_0x132e5d[_0x540f('0x20')];this[_0x540f('0x21')]=_0x132e5d[_0x540f('0x21')];this[_0x540f('0x22')]=_0x132e5d[_0x540f('0x22')];this[_0x540f('0x23')]=_0x132e5d[_0x540f('0x23')];this[_0x540f('0x24')]=_0x132e5d[_0x540f('0x24')];this[_0x540f('0x25')]=_0x132e5d['ListId'];this[_0x540f('0x26')]=_0x132e5d[_0x540f('0x26')];this[_0x540f('0x27')]=_0x132e5d[_0x540f('0x27')];this['CampaignId']=_0x132e5d['CampaignId'];this[_0x540f('0x28')]=_0x132e5d['originatecalleridnum']||'';this[_0x540f('0x29')]=_0x132e5d[_0x540f('0x29')]||'';this[_0x540f('0x2a')]=_0x132e5d[_0x540f('0x2a')];}module[_0x540f('0x2b')]=AgentComplete; \ No newline at end of file +var _0xc59e=['recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','../utils','statedesc','Answer','scheduledat','type','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','getSeconds','talktime','reason','callback','callbackuniqueid','callbackat'];(function(_0x4d6d82,_0x29ee30){var _0x11212c=function(_0x3b16ad){while(--_0x3b16ad){_0x4d6d82['push'](_0x4d6d82['shift']());}};_0x11212c(++_0x29ee30);}(_0xc59e,0xff));var _0xec59=function(_0xe957e3,_0x2f333e){_0xe957e3=_0xe957e3-0x0;var _0x21e397=_0xc59e[_0xe957e3];return _0x21e397;};'use strict';var moment=require('moment');var utils=require(_0xec59('0x0'));function AgentComplete(_0x4f9ad0,_0xa60d30){this['state']=0x4;this[_0xec59('0x1')]=_0xec59('0x2');this[_0xec59('0x3')]=_0x4f9ad0[_0xec59('0x3')];this['type']=_0x4f9ad0[_0xec59('0x4')];this['campaigntype']=_0x4f9ad0['type']==='outbound'?_0xec59('0x5'):_0x4f9ad0[_0xec59('0x4')];this[_0xec59('0x6')]=_0x4f9ad0[_0xec59('0x6')];this[_0xec59('0x7')]=_0x4f9ad0['countcongestionretry'];this[_0xec59('0x8')]=_0x4f9ad0[_0xec59('0x8')];this['countglobal']=_0x4f9ad0[_0xec59('0x6')]+_0x4f9ad0[_0xec59('0x7')]+_0x4f9ad0[_0xec59('0x8')]+_0x4f9ad0[_0xec59('0x9')]+_0x4f9ad0[_0xec59('0xa')]+_0x4f9ad0[_0xec59('0xb')]+_0x4f9ad0[_0xec59('0xc')]+_0x4f9ad0['countagentrejectretry'];this['countnosuchnumberretry']=_0x4f9ad0[_0xec59('0x9')];this['countdropretry']=_0x4f9ad0[_0xec59('0xa')];this[_0xec59('0xb')]=_0x4f9ad0['countabandonedretry'];this[_0xec59('0xc')]=_0x4f9ad0[_0xec59('0xc')];this[_0xec59('0xd')]=_0x4f9ad0[_0xec59('0xd')];this['uniqueid']=_0xa60d30['uniqueid'];this[_0xec59('0xe')]=_0x4f9ad0[_0xec59('0xf')];this[_0xec59('0x10')]=_0x4f9ad0[_0xec59('0x11')];this[_0xec59('0x12')]=_0x4f9ad0[_0xec59('0x12')];this[_0xec59('0x13')]=_0x4f9ad0[_0xec59('0x13')];this['answertime']=_0x4f9ad0[_0xec59('0x14')];this[_0xec59('0x15')]=moment()[_0xec59('0x16')](_0xec59('0x17'));this[_0xec59('0x18')]=utils['getSeconds'](_0x4f9ad0['responsetime'],_0x4f9ad0[_0xec59('0x12')]);this[_0xec59('0x19')]=utils[_0xec59('0x1a')](_0x4f9ad0['answertime'],_0x4f9ad0[_0xec59('0x13')]);this[_0xec59('0x1b')]=utils['getSeconds'](this[_0xec59('0x15')],_0x4f9ad0[_0xec59('0x14')]);this[_0xec59('0x5')]=_0xa60d30[_0xec59('0x5')];this['membername']=_0xa60d30['membername'];this[_0xec59('0x1c')]=_0xa60d30[_0xec59('0x1c')];this[_0xec59('0x1d')]=_0x4f9ad0[_0xec59('0x1d')];this[_0xec59('0x1e')]=_0x4f9ad0[_0xec59('0x1e')];this['callbackat']=_0x4f9ad0[_0xec59('0x1f')];this['recallme']=_0x4f9ad0[_0xec59('0x20')];this[_0xec59('0x21')]=_0x4f9ad0[_0xec59('0x21')];this[_0xec59('0x22')]=_0x4f9ad0[_0xec59('0x22')];this['UserId']=_0x4f9ad0[_0xec59('0x23')];this['VoiceQueueId']=_0x4f9ad0[_0xec59('0x24')];this[_0xec59('0x25')]=_0x4f9ad0[_0xec59('0x25')];this[_0xec59('0x26')]=_0x4f9ad0[_0xec59('0x26')]||'';this[_0xec59('0x27')]=_0x4f9ad0[_0xec59('0x27')]||'';this[_0xec59('0x28')]=_0x4f9ad0[_0xec59('0x28')];}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 5452379..188b771 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 _0xa994=['originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','calleridname','calleridnum','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId'];(function(_0x214ff9,_0x4780da){var _0xdb0edc=function(_0x4f1b58){while(--_0x4f1b58){_0x214ff9['push'](_0x214ff9['shift']());}};_0xdb0edc(++_0x4780da);}(_0xa994,0xec));var _0x4a99=function(_0x470883,_0x1bb7dc){_0x470883=_0x470883-0x0;var _0x59336a=_0xa994[_0x470883];return _0x59336a;};'use strict';function Final(_0x43b5b9){this['uniqueid']=_0x43b5b9[_0x4a99('0x0')];this[_0x4a99('0x1')]=_0x43b5b9[_0x4a99('0x1')];this[_0x4a99('0x2')]=_0x43b5b9[_0x4a99('0x2')];this['campaigntype']=_0x43b5b9[_0x4a99('0x2')]===_0x4a99('0x3')?_0x4a99('0x4'):_0x43b5b9[_0x4a99('0x2')];this[_0x4a99('0x5')]=_0x43b5b9[_0x4a99('0x5')];this['countcongestionretry']=_0x43b5b9[_0x4a99('0x6')];this['countnoanswerretry']=_0x43b5b9['countnoanswerretry'];this['countglobal']=_0x43b5b9[_0x4a99('0x5')]+_0x43b5b9['countcongestionretry']+_0x43b5b9[_0x4a99('0x7')]+_0x43b5b9['countnosuchnumberretry']+_0x43b5b9[_0x4a99('0x8')]+_0x43b5b9['countabandonedretry']+_0x43b5b9[_0x4a99('0x9')]+_0x43b5b9[_0x4a99('0xa')];this['countnosuchnumberretry']=_0x43b5b9['countnosuchnumberretry'];this[_0x4a99('0x8')]=_0x43b5b9[_0x4a99('0x8')];this[_0x4a99('0xb')]=_0x43b5b9['countabandonedretry'];this['countmachineretry']=_0x43b5b9[_0x4a99('0x9')];this['countagentrejectretry']=_0x43b5b9[_0x4a99('0xa')];this['queue']=_0x43b5b9[_0x4a99('0x4')];this[_0x4a99('0xc')]=_0x43b5b9[_0x4a99('0xc')];this[_0x4a99('0xd')]=_0x43b5b9[_0x4a99('0xd')];this['starttime']=_0x43b5b9['starttime'];this[_0x4a99('0xe')]=_0x43b5b9['responsetime'];this[_0x4a99('0xf')]=_0x43b5b9[_0x4a99('0xe')];this[_0x4a99('0x10')]=_0x43b5b9['ringtime']||0x0;this[_0x4a99('0x11')]=_0x43b5b9['holdtime']||0x0;this[_0x4a99('0x12')]=_0x43b5b9[_0x4a99('0x12')]||0x0;this[_0x4a99('0x13')]=_0x43b5b9[_0x4a99('0x13')];this[_0x4a99('0x14')]=_0x43b5b9[_0x4a99('0x14')];this['callbackat']=_0x43b5b9[_0x4a99('0x15')];this[_0x4a99('0x16')]=_0x43b5b9['recallme'];this['ContactId']=_0x43b5b9[_0x4a99('0x17')];this['ListId']=_0x43b5b9[_0x4a99('0x18')];this[_0x4a99('0x19')]=_0x43b5b9[_0x4a99('0x19')];this[_0x4a99('0x1a')]=_0x43b5b9[_0x4a99('0x1a')];this[_0x4a99('0x1b')]=_0x43b5b9[_0x4a99('0x1b')];this[_0x4a99('0x1c')]=_0x43b5b9[_0x4a99('0x1c')]||'';this[_0x4a99('0x1d')]=_0x43b5b9['originatecalleridname']||'';this[_0x4a99('0x1e')]=_0x43b5b9[_0x4a99('0x1e')];this[_0x4a99('0x1f')]=_0x43b5b9[_0x4a99('0x1f')];}module[_0x4a99('0x20')]=Final; \ No newline at end of file +var _0x3431=['originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','queue','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum'];(function(_0x1a94ad,_0x4b721c){var _0x3919c3=function(_0x6d6142){while(--_0x6d6142){_0x1a94ad['push'](_0x1a94ad['shift']());}};_0x3919c3(++_0x4b721c);}(_0x3431,0x1b4));var _0x1343=function(_0x20a558,_0x160e0e){_0x20a558=_0x20a558-0x0;var _0x53d3f7=_0x3431[_0x20a558];return _0x53d3f7;};'use strict';function Final(_0x1b3be0){this[_0x1343('0x0')]=_0x1b3be0['uniqueid'];this[_0x1343('0x1')]=_0x1b3be0[_0x1343('0x1')];this[_0x1343('0x2')]=_0x1b3be0[_0x1343('0x2')];this[_0x1343('0x3')]=_0x1b3be0['type']===_0x1343('0x4')?'queue':_0x1b3be0[_0x1343('0x2')];this[_0x1343('0x5')]=_0x1b3be0[_0x1343('0x5')];this[_0x1343('0x6')]=_0x1b3be0[_0x1343('0x6')];this[_0x1343('0x7')]=_0x1b3be0[_0x1343('0x7')];this[_0x1343('0x8')]=_0x1b3be0[_0x1343('0x5')]+_0x1b3be0[_0x1343('0x6')]+_0x1b3be0[_0x1343('0x7')]+_0x1b3be0[_0x1343('0x9')]+_0x1b3be0[_0x1343('0xa')]+_0x1b3be0[_0x1343('0xb')]+_0x1b3be0['countmachineretry']+_0x1b3be0['countagentrejectretry'];this[_0x1343('0x9')]=_0x1b3be0[_0x1343('0x9')];this[_0x1343('0xa')]=_0x1b3be0['countdropretry'];this[_0x1343('0xb')]=_0x1b3be0[_0x1343('0xb')];this['countmachineretry']=_0x1b3be0[_0x1343('0xc')];this[_0x1343('0xd')]=_0x1b3be0[_0x1343('0xd')];this[_0x1343('0xe')]=_0x1b3be0['queue'];this[_0x1343('0xf')]=_0x1b3be0['calleridname'];this[_0x1343('0x10')]=_0x1b3be0[_0x1343('0x10')];this[_0x1343('0x11')]=_0x1b3be0[_0x1343('0x11')];this[_0x1343('0x12')]=_0x1b3be0[_0x1343('0x12')];this[_0x1343('0x13')]=_0x1b3be0['responsetime'];this[_0x1343('0x14')]=_0x1b3be0[_0x1343('0x14')]||0x0;this['holdtime']=_0x1b3be0[_0x1343('0x15')]||0x0;this[_0x1343('0x16')]=_0x1b3be0[_0x1343('0x16')]||0x0;this[_0x1343('0x17')]=_0x1b3be0[_0x1343('0x17')];this[_0x1343('0x18')]=_0x1b3be0[_0x1343('0x18')];this[_0x1343('0x19')]=_0x1b3be0['callbackat'];this[_0x1343('0x1a')]=_0x1b3be0['recallme'];this['ContactId']=_0x1b3be0['ContactId'];this[_0x1343('0x1b')]=_0x1b3be0[_0x1343('0x1b')];this[_0x1343('0x1c')]=_0x1b3be0['UserId'];this[_0x1343('0x1d')]=_0x1b3be0[_0x1343('0x1d')];this[_0x1343('0x1e')]=_0x1b3be0[_0x1343('0x1e')];this[_0x1343('0x1f')]=_0x1b3be0[_0x1343('0x1f')]||'';this[_0x1343('0x20')]=_0x1b3be0[_0x1343('0x20')]||'';this[_0x1343('0x21')]=_0x1b3be0[_0x1343('0x21')];this[_0x1343('0x22')]=_0x1b3be0[_0x1343('0x22')];}module[_0x1343('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 93e1da8..fd138fc 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 _0xcf38=['ringtime','getSeconds','holdtime','talktime','membername','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','CampaignId','moment','../utils','state','Answer','scheduledat','type','outbound','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0xcf38,0x12c));var _0x8cf3=function(_0x4250b4,_0x3fd543){_0x4250b4=_0x4250b4-0x0;var _0x8a4807=_0xcf38[_0x4250b4];return _0x8a4807;};'use strict';var moment=require(_0x8cf3('0x0'));var utils=require(_0x8cf3('0x1'));function Hangup(_0x382b2d,_0x2e9a42){this[_0x8cf3('0x2')]=0x4;this['statedesc']=_0x8cf3('0x3');this[_0x8cf3('0x4')]=_0x382b2d[_0x8cf3('0x4')];this[_0x8cf3('0x5')]=_0x382b2d[_0x8cf3('0x5')];this['campaigntype']=_0x382b2d[_0x8cf3('0x5')]===_0x8cf3('0x6')?_0x8cf3('0x7'):_0x382b2d[_0x8cf3('0x5')];this[_0x8cf3('0x8')]=_0x382b2d['amd']||![];this[_0x8cf3('0x9')]=_0x382b2d[_0x8cf3('0x9')];this[_0x8cf3('0xa')]=_0x382b2d[_0x8cf3('0xa')];this[_0x8cf3('0xb')]=_0x382b2d[_0x8cf3('0xb')];this[_0x8cf3('0xc')]=_0x382b2d[_0x8cf3('0x9')]+_0x382b2d[_0x8cf3('0xa')]+_0x382b2d['countnoanswerretry']+_0x382b2d['countnosuchnumberretry']+_0x382b2d[_0x8cf3('0xd')]+_0x382b2d[_0x8cf3('0xe')]+_0x382b2d[_0x8cf3('0xf')]+_0x382b2d[_0x8cf3('0x10')];this[_0x8cf3('0x11')]=_0x382b2d[_0x8cf3('0x11')];this['countdropretry']=_0x382b2d[_0x8cf3('0xd')];this['countabandonedretry']=_0x382b2d[_0x8cf3('0xe')];this[_0x8cf3('0xf')]=_0x382b2d['countmachineretry'];this['countagentrejectretry']=_0x382b2d['countagentrejectretry'];this['uniqueid']=_0x2e9a42[_0x8cf3('0x12')];this[_0x8cf3('0x13')]=_0x382b2d[_0x8cf3('0x14')];this[_0x8cf3('0x15')]=_0x382b2d[_0x8cf3('0x16')];this[_0x8cf3('0x17')]=_0x382b2d[_0x8cf3('0x17')];this['responsetime']=_0x382b2d[_0x8cf3('0x18')];this[_0x8cf3('0x19')]=moment()[_0x8cf3('0x1a')](_0x8cf3('0x1b'));this[_0x8cf3('0x1c')]=utils[_0x8cf3('0x1d')](_0x382b2d['responsetime'],_0x382b2d[_0x8cf3('0x17')]);this[_0x8cf3('0x1e')]=0x0;this[_0x8cf3('0x1f')]=utils[_0x8cf3('0x1d')](this['endtime'],_0x382b2d[_0x8cf3('0x18')]);this[_0x8cf3('0x7')]=_0x382b2d['queue'];this[_0x8cf3('0x20')]='IVR';this['reason']=_0x2e9a42[_0x8cf3('0x21')];this[_0x8cf3('0x22')]=_0x382b2d[_0x8cf3('0x22')];this[_0x8cf3('0x23')]=_0x382b2d[_0x8cf3('0x23')];this['callbackat']=_0x382b2d[_0x8cf3('0x24')];this[_0x8cf3('0x25')]=_0x382b2d[_0x8cf3('0x25')];this[_0x8cf3('0x26')]=_0x382b2d[_0x8cf3('0x26')];this[_0x8cf3('0x27')]=_0x382b2d[_0x8cf3('0x27')];this['UserId']=_0x382b2d['UserId'];this['VoiceQueueId']=_0x382b2d['VoiceQueueId'];this[_0x8cf3('0x28')]=_0x382b2d[_0x8cf3('0x28')];}module['exports']=Hangup; \ No newline at end of file +var _0x455a=['recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','moment','../utils','state','statedesc','scheduledat','campaigntype','outbound','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','getSeconds','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat'];(function(_0x25f4f7,_0x1fbc47){var _0x5d223e=function(_0x32680d){while(--_0x32680d){_0x25f4f7['push'](_0x25f4f7['shift']());}};_0x5d223e(++_0x1fbc47);}(_0x455a,0x8a));var _0xa455=function(_0x45518f,_0x475a6b){_0x45518f=_0x45518f-0x0;var _0x198175=_0x455a[_0x45518f];return _0x198175;};'use strict';var moment=require(_0xa455('0x0'));var utils=require(_0xa455('0x1'));function Hangup(_0x324159,_0x538b23){this[_0xa455('0x2')]=0x4;this[_0xa455('0x3')]='Answer';this['scheduledat']=_0x324159[_0xa455('0x4')];this['type']=_0x324159['type'];this[_0xa455('0x5')]=_0x324159['type']===_0xa455('0x6')?_0xa455('0x7'):_0x324159['type'];this[_0xa455('0x8')]=_0x324159[_0xa455('0x8')]||![];this[_0xa455('0x9')]=_0x324159[_0xa455('0x9')];this[_0xa455('0xa')]=_0x324159[_0xa455('0xa')];this['countnoanswerretry']=_0x324159[_0xa455('0xb')];this[_0xa455('0xc')]=_0x324159['countbusyretry']+_0x324159['countcongestionretry']+_0x324159[_0xa455('0xb')]+_0x324159[_0xa455('0xd')]+_0x324159[_0xa455('0xe')]+_0x324159[_0xa455('0xf')]+_0x324159['countmachineretry']+_0x324159['countagentrejectretry'];this[_0xa455('0xd')]=_0x324159['countnosuchnumberretry'];this[_0xa455('0xe')]=_0x324159[_0xa455('0xe')];this[_0xa455('0xf')]=_0x324159[_0xa455('0xf')];this[_0xa455('0x10')]=_0x324159[_0xa455('0x10')];this[_0xa455('0x11')]=_0x324159[_0xa455('0x11')];this[_0xa455('0x12')]=_0x538b23[_0xa455('0x12')];this[_0xa455('0x13')]=_0x324159[_0xa455('0x14')];this[_0xa455('0x15')]=_0x324159[_0xa455('0x16')];this['starttime']=_0x324159[_0xa455('0x17')];this[_0xa455('0x18')]=_0x324159[_0xa455('0x18')];this[_0xa455('0x19')]=moment()[_0xa455('0x1a')](_0xa455('0x1b'));this[_0xa455('0x1c')]=utils['getSeconds'](_0x324159[_0xa455('0x18')],_0x324159['starttime']);this[_0xa455('0x1d')]=0x0;this[_0xa455('0x1e')]=utils[_0xa455('0x1f')](this['endtime'],_0x324159[_0xa455('0x18')]);this[_0xa455('0x7')]=_0x324159[_0xa455('0x7')];this['membername']=_0xa455('0x20');this[_0xa455('0x21')]=_0x538b23[_0xa455('0x22')];this[_0xa455('0x23')]=_0x324159[_0xa455('0x23')];this[_0xa455('0x24')]=_0x324159['callbackuniqueid'];this['callbackat']=_0x324159[_0xa455('0x25')];this[_0xa455('0x26')]=_0x324159[_0xa455('0x26')];this[_0xa455('0x27')]=_0x324159[_0xa455('0x27')];this[_0xa455('0x28')]=_0x324159[_0xa455('0x28')];this[_0xa455('0x29')]=_0x324159[_0xa455('0x29')];this[_0xa455('0x2a')]=_0x324159[_0xa455('0x2a')];this[_0xa455('0x2b')]=_0x324159['CampaignId'];}module['exports']=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 5bfdf1b..3d29097 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 _0x2c6a=['starttime','responsetime','endtime','ringtime','getSeconds','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','../utils','uniqueid','type','queue','countbusyretry','countcongestionretry','countglobal','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','number'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0x2c6a,0x187));var _0xa2c6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2c6a[_0x3dd15e];return _0x231fd0;};'use strict';var utils=require(_0xa2c6('0x0'));function History(_0x4aa183){this['uniqueid']=_0x4aa183[_0xa2c6('0x1')];this['scheduledat']=_0x4aa183['scheduledat']||undefined;this[_0xa2c6('0x2')]=_0x4aa183[_0xa2c6('0x2')];this['campaigntype']=_0x4aa183['type']==='outbound'?_0xa2c6('0x3'):_0x4aa183[_0xa2c6('0x2')];this[_0xa2c6('0x4')]=_0x4aa183['countbusyretry'];this[_0xa2c6('0x5')]=_0x4aa183['countcongestionretry'];this['countnoanswerretry']=_0x4aa183['countnoanswerretry'];this[_0xa2c6('0x6')]=_0x4aa183[_0xa2c6('0x4')]+_0x4aa183['countcongestionretry']+_0x4aa183[_0xa2c6('0x7')]+_0x4aa183[_0xa2c6('0x8')]+_0x4aa183[_0xa2c6('0x9')]+_0x4aa183[_0xa2c6('0xa')]+_0x4aa183[_0xa2c6('0xb')]+_0x4aa183[_0xa2c6('0xc')];this[_0xa2c6('0x8')]=_0x4aa183['countnosuchnumberretry'];this[_0xa2c6('0x9')]=_0x4aa183[_0xa2c6('0x9')];this['countabandonedretry']=_0x4aa183['countabandonedretry'];this['countmachineretry']=_0x4aa183['countmachineretry'];this['countagentrejectretry']=_0x4aa183[_0xa2c6('0xc')];this[_0xa2c6('0x3')]=_0x4aa183[_0xa2c6('0x3')];this[_0xa2c6('0xd')]=_0x4aa183['name'];this[_0xa2c6('0xe')]=_0x4aa183[_0xa2c6('0xf')];this[_0xa2c6('0x10')]=_0x4aa183[_0xa2c6('0x10')];this[_0xa2c6('0x11')]=_0x4aa183[_0xa2c6('0x11')];this[_0xa2c6('0x12')]=_0x4aa183[_0xa2c6('0x11')];this[_0xa2c6('0x13')]=utils[_0xa2c6('0x14')](_0x4aa183[_0xa2c6('0x11')],_0x4aa183[_0xa2c6('0x10')]);this[_0xa2c6('0x15')]=0x0;this[_0xa2c6('0x16')]=0x0;this['callback']=_0x4aa183[_0xa2c6('0x17')];this[_0xa2c6('0x18')]=_0x4aa183[_0xa2c6('0x18')];this[_0xa2c6('0x19')]=_0x4aa183['callbackat'];this[_0xa2c6('0x1a')]=_0x4aa183[_0xa2c6('0x1a')];this['ContactId']=_0x4aa183[_0xa2c6('0x1b')];this[_0xa2c6('0x1c')]=_0x4aa183[_0xa2c6('0x1c')];this[_0xa2c6('0x1d')]=_0x4aa183['UserId'];this[_0xa2c6('0x1e')]=_0x4aa183[_0xa2c6('0x1e')];this['CampaignId']=_0x4aa183[_0xa2c6('0x1f')];this['originatecalleridnum']=_0x4aa183[_0xa2c6('0x20')]||'';this[_0xa2c6('0x21')]=_0x4aa183['originatecalleridname']||'';this[_0xa2c6('0x22')]=_0x4aa183['state'];this[_0xa2c6('0x23')]=_0x4aa183[_0xa2c6('0x23')];}module[_0xa2c6('0x24')]=History; \ No newline at end of file +var _0x3298=['originatecalleridnum','originatecalleridname','state','statedesc','exports','../utils','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime','getSeconds','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId'];(function(_0x15bab2,_0x1785a6){var _0x2ca599=function(_0x6c4518){while(--_0x6c4518){_0x15bab2['push'](_0x15bab2['shift']());}};_0x2ca599(++_0x1785a6);}(_0x3298,0x1bd));var _0x8329=function(_0x5896b6,_0x3bbd01){_0x5896b6=_0x5896b6-0x0;var _0x40b984=_0x3298[_0x5896b6];return _0x40b984;};'use strict';var utils=require(_0x8329('0x0'));function History(_0x574cbd){this[_0x8329('0x1')]=_0x574cbd[_0x8329('0x1')];this[_0x8329('0x2')]=_0x574cbd['scheduledat']||undefined;this[_0x8329('0x3')]=_0x574cbd['type'];this[_0x8329('0x4')]=_0x574cbd['type']===_0x8329('0x5')?_0x8329('0x6'):_0x574cbd['type'];this['countbusyretry']=_0x574cbd[_0x8329('0x7')];this['countcongestionretry']=_0x574cbd[_0x8329('0x8')];this[_0x8329('0x9')]=_0x574cbd[_0x8329('0x9')];this[_0x8329('0xa')]=_0x574cbd[_0x8329('0x7')]+_0x574cbd[_0x8329('0x8')]+_0x574cbd[_0x8329('0x9')]+_0x574cbd[_0x8329('0xb')]+_0x574cbd[_0x8329('0xc')]+_0x574cbd[_0x8329('0xd')]+_0x574cbd[_0x8329('0xe')]+_0x574cbd['countagentrejectretry'];this[_0x8329('0xb')]=_0x574cbd['countnosuchnumberretry'];this[_0x8329('0xc')]=_0x574cbd[_0x8329('0xc')];this[_0x8329('0xd')]=_0x574cbd[_0x8329('0xd')];this[_0x8329('0xe')]=_0x574cbd[_0x8329('0xe')];this[_0x8329('0xf')]=_0x574cbd['countagentrejectretry'];this['queue']=_0x574cbd['queue'];this[_0x8329('0x10')]=_0x574cbd[_0x8329('0x11')];this[_0x8329('0x12')]=_0x574cbd[_0x8329('0x13')];this[_0x8329('0x14')]=_0x574cbd[_0x8329('0x14')];this[_0x8329('0x15')]=_0x574cbd[_0x8329('0x15')];this[_0x8329('0x16')]=_0x574cbd[_0x8329('0x15')];this['ringtime']=utils[_0x8329('0x17')](_0x574cbd['responsetime'],_0x574cbd[_0x8329('0x14')]);this[_0x8329('0x18')]=0x0;this[_0x8329('0x19')]=0x0;this['callback']=_0x574cbd[_0x8329('0x1a')];this[_0x8329('0x1b')]=_0x574cbd[_0x8329('0x1b')];this[_0x8329('0x1c')]=_0x574cbd[_0x8329('0x1c')];this['recallme']=_0x574cbd[_0x8329('0x1d')];this[_0x8329('0x1e')]=_0x574cbd['ContactId'];this[_0x8329('0x1f')]=_0x574cbd[_0x8329('0x1f')];this[_0x8329('0x20')]=_0x574cbd[_0x8329('0x20')];this[_0x8329('0x21')]=_0x574cbd[_0x8329('0x21')];this[_0x8329('0x22')]=_0x574cbd['CampaignId'];this[_0x8329('0x23')]=_0x574cbd[_0x8329('0x23')]||'';this[_0x8329('0x24')]=_0x574cbd[_0x8329('0x24')]||'';this[_0x8329('0x25')]=_0x574cbd[_0x8329('0x25')];this['statedesc']=_0x574cbd[_0x8329('0x26')];}module[_0x8329('0x27')]=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 c307acc..63f074f 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 _0x487b=['originatecalleridnum','agiafterat','state','statedesc','exports','scheduledat','type','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countagentrejectretry','countabandonedretry','countmachineretry','uniqueid','calleridnum','number','responsetime','droptime','dropreason','ringtime','getSeconds','starttime','holdtime','talktime','membername','connectedlinename','reason','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId'];(function(_0x20796b,_0x5c6ae1){var _0xd161e2=function(_0xf4c5ad){while(--_0xf4c5ad){_0x20796b['push'](_0x20796b['shift']());}};_0xd161e2(++_0x5c6ae1);}(_0x487b,0x1b2));var _0xb487=function(_0x53e905,_0x584360){_0x53e905=_0x53e905-0x0;var _0x115231=_0x487b[_0x53e905];return _0x115231;};'use strict';var utils=require('../utils');function QueueCallerAbandon(_0x16b8c3,_0x3dd754){this['scheduledat']=_0x16b8c3[_0xb487('0x0')];this[_0xb487('0x1')]=_0x16b8c3[_0xb487('0x1')];this['campaigntype']=_0x16b8c3[_0xb487('0x1')]==='outbound'?_0xb487('0x2'):_0x16b8c3[_0xb487('0x1')];this[_0xb487('0x3')]=_0x16b8c3['countbusyretry'];this[_0xb487('0x4')]=_0x16b8c3[_0xb487('0x4')];this[_0xb487('0x5')]=_0x16b8c3[_0xb487('0x5')];this[_0xb487('0x6')]=_0x16b8c3[_0xb487('0x3')]+_0x16b8c3[_0xb487('0x4')]+_0x16b8c3['countnoanswerretry']+_0x16b8c3[_0xb487('0x7')]+_0x16b8c3[_0xb487('0x8')]+_0x16b8c3['countabandonedretry']+_0x16b8c3['countmachineretry']+_0x16b8c3[_0xb487('0x9')];this[_0xb487('0x7')]=_0x16b8c3[_0xb487('0x7')];this[_0xb487('0x8')]=_0x16b8c3['countdropretry'];this['countabandonedretry']=_0x16b8c3[_0xb487('0xa')];this[_0xb487('0xb')]=_0x16b8c3[_0xb487('0xb')];this[_0xb487('0x9')]=_0x16b8c3['countagentrejectretry'];this[_0xb487('0xc')]=_0x3dd754['uniqueid'];this['calleridname']=_0x16b8c3['name'];this[_0xb487('0xd')]=_0x16b8c3[_0xb487('0xe')];this['starttime']=_0x16b8c3['starttime'];this[_0xb487('0xf')]=_0x16b8c3[_0xb487('0xf')];this[_0xb487('0x10')]=_0x16b8c3[_0xb487('0x10')];this[_0xb487('0x11')]=_0x16b8c3[_0xb487('0x11')];this['endtime']=this[_0xb487('0x10')];this[_0xb487('0x12')]=utils[_0xb487('0x13')](_0x16b8c3[_0xb487('0xf')],_0x16b8c3[_0xb487('0x14')]);this[_0xb487('0x15')]=utils[_0xb487('0x13')](this['droptime'],_0x16b8c3[_0xb487('0xf')]);this[_0xb487('0x16')]=0x0;this[_0xb487('0x2')]=_0x3dd754['queue'];this[_0xb487('0x17')]=_0x3dd754[_0xb487('0x18')];this[_0xb487('0x19')]=_0x3dd754[_0xb487('0x19')];this['callback']=_0x16b8c3['callback'];this[_0xb487('0x1a')]=_0x16b8c3[_0xb487('0x1a')];this[_0xb487('0x1b')]=_0x16b8c3[_0xb487('0x1b')];this[_0xb487('0x1c')]=_0x16b8c3[_0xb487('0x1c')];this[_0xb487('0x1d')]=_0x16b8c3[_0xb487('0x1d')];this[_0xb487('0x1e')]=_0x16b8c3['ListId'];this['UserId']=_0x16b8c3[_0xb487('0x1f')];this[_0xb487('0x20')]=_0x16b8c3[_0xb487('0x20')];this[_0xb487('0x21')]=_0x16b8c3[_0xb487('0x21')];this[_0xb487('0x22')]=_0x16b8c3[_0xb487('0x22')]||'';this['originatecalleridname']=_0x16b8c3['originatecalleridname']||'';this[_0xb487('0x23')]=_0x16b8c3[_0xb487('0x23')];this[_0xb487('0x24')]=_0x16b8c3[_0xb487('0x24')];this[_0xb487('0x25')]=_0x16b8c3[_0xb487('0x25')];}module[_0xb487('0x26')]=QueueCallerAbandon; \ No newline at end of file +var _0xeb01=['number','starttime','responsetime','dropreason','endtime','ringtime','getSeconds','holdtime','droptime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','../utils','scheduledat','type','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countagentrejectretry','countnosuchnumberretry','countmachineretry','uniqueid','calleridname','name','calleridnum'];(function(_0x152830,_0x2e821f){var _0x3ec194=function(_0x177d1a){while(--_0x177d1a){_0x152830['push'](_0x152830['shift']());}};_0x3ec194(++_0x2e821f);}(_0xeb01,0x17b));var _0x1eb0=function(_0x3c632d,_0x1eb291){_0x3c632d=_0x3c632d-0x0;var _0x18e9a5=_0xeb01[_0x3c632d];return _0x18e9a5;};'use strict';var utils=require(_0x1eb0('0x0'));function QueueCallerAbandon(_0x307ce4,_0x11acf5){this[_0x1eb0('0x1')]=_0x307ce4[_0x1eb0('0x1')];this['type']=_0x307ce4[_0x1eb0('0x2')];this['campaigntype']=_0x307ce4[_0x1eb0('0x2')]==='outbound'?_0x1eb0('0x3'):_0x307ce4[_0x1eb0('0x2')];this[_0x1eb0('0x4')]=_0x307ce4[_0x1eb0('0x4')];this[_0x1eb0('0x5')]=_0x307ce4[_0x1eb0('0x5')];this[_0x1eb0('0x6')]=_0x307ce4[_0x1eb0('0x6')];this[_0x1eb0('0x7')]=_0x307ce4['countbusyretry']+_0x307ce4[_0x1eb0('0x5')]+_0x307ce4[_0x1eb0('0x6')]+_0x307ce4['countnosuchnumberretry']+_0x307ce4[_0x1eb0('0x8')]+_0x307ce4[_0x1eb0('0x9')]+_0x307ce4['countmachineretry']+_0x307ce4[_0x1eb0('0xa')];this[_0x1eb0('0xb')]=_0x307ce4['countnosuchnumberretry'];this[_0x1eb0('0x8')]=_0x307ce4[_0x1eb0('0x8')];this[_0x1eb0('0x9')]=_0x307ce4['countabandonedretry'];this[_0x1eb0('0xc')]=_0x307ce4[_0x1eb0('0xc')];this[_0x1eb0('0xa')]=_0x307ce4[_0x1eb0('0xa')];this['uniqueid']=_0x11acf5[_0x1eb0('0xd')];this[_0x1eb0('0xe')]=_0x307ce4[_0x1eb0('0xf')];this[_0x1eb0('0x10')]=_0x307ce4[_0x1eb0('0x11')];this[_0x1eb0('0x12')]=_0x307ce4[_0x1eb0('0x12')];this[_0x1eb0('0x13')]=_0x307ce4[_0x1eb0('0x13')];this['droptime']=_0x307ce4['droptime'];this[_0x1eb0('0x14')]=_0x307ce4['dropreason'];this[_0x1eb0('0x15')]=this['droptime'];this[_0x1eb0('0x16')]=utils[_0x1eb0('0x17')](_0x307ce4[_0x1eb0('0x13')],_0x307ce4[_0x1eb0('0x12')]);this[_0x1eb0('0x18')]=utils[_0x1eb0('0x17')](this[_0x1eb0('0x19')],_0x307ce4[_0x1eb0('0x13')]);this[_0x1eb0('0x1a')]=0x0;this['queue']=_0x11acf5[_0x1eb0('0x3')];this[_0x1eb0('0x1b')]=_0x11acf5[_0x1eb0('0x1c')];this[_0x1eb0('0x1d')]=_0x11acf5[_0x1eb0('0x1d')];this[_0x1eb0('0x1e')]=_0x307ce4[_0x1eb0('0x1e')];this[_0x1eb0('0x1f')]=_0x307ce4[_0x1eb0('0x1f')];this['callbackat']=_0x307ce4[_0x1eb0('0x20')];this[_0x1eb0('0x21')]=_0x307ce4['recallme'];this[_0x1eb0('0x22')]=_0x307ce4[_0x1eb0('0x22')];this['ListId']=_0x307ce4['ListId'];this[_0x1eb0('0x23')]=_0x307ce4[_0x1eb0('0x23')];this[_0x1eb0('0x24')]=_0x307ce4[_0x1eb0('0x24')];this[_0x1eb0('0x25')]=_0x307ce4[_0x1eb0('0x25')];this[_0x1eb0('0x26')]=_0x307ce4['originatecalleridnum']||'';this['originatecalleridname']=_0x307ce4[_0x1eb0('0x27')]||'';this[_0x1eb0('0x28')]=_0x307ce4[_0x1eb0('0x28')];this['state']=_0x307ce4[_0x1eb0('0x29')];this['statedesc']=_0x307ce4[_0x1eb0('0x2a')];}module[_0x1eb0('0x2b')]=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 238be8f..3d60e69 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 _0x4888=['[avgHandleTime]','createHistory','../../../../config/logger','dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','getContactDialer','dialOrderByScheduledAt','catch','getContactDialerIvr','error','[getContactDialerIvr]','countReScheduled','[rescheduleContact]','rescheduleContact','unlockContact','[unlockContact]','moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','[checkIsBlackList]','checkIsBlackListIvr','[checkIsBlackListIvr]','verifyAdditionalPhones','[swapAdditionalPhone]','swapAdditionalPhones','avgHandleTime'];(function(_0x174301,_0x1d4bd2){var _0x5c1d58=function(_0x45ca84){while(--_0x45ca84){_0x174301['push'](_0x174301['shift']());}};_0x5c1d58(++_0x1d4bd2);}(_0x4888,0x198));var _0x8488=function(_0x142020,_0x1f7233){_0x142020=_0x142020-0x0;var _0x40da8f=_0x4888[_0x142020];return _0x40da8f;};'use strict';var util=require('util');var logger=require(_0x8488('0x0'))(_0x8488('0x1'));var cmHopper=require(_0x8488('0x2'));var cmHopperAdditionalPhone=require(_0x8488('0x3'));var cmHopperBlack=require(_0x8488('0x4'));var cmHopperHistory=require(_0x8488('0x5'));function inspectError(_0x19e51d){return util['inspect'](_0x19e51d,{'showHidden':![],'depth':null});}function getContactDialer(_0x267093,_0xf45c3f,_0x1a97f4){return cmHopper[_0x8488('0x6')](_0x267093['id'],_0xf45c3f,_0x1a97f4,_0x267093[_0x8488('0x7')])[_0x8488('0x8')](function(_0x5250a1){_0x267093['temp']=0x0;logger['error']('[getContactDialer]',inspectError(_0x5250a1));});}exports[_0x8488('0x6')]=getContactDialer;function getContactDialerIvr(_0x1bae81,_0x542bd8){return cmHopper[_0x8488('0x9')](_0x1bae81['id'],_0x542bd8,_0x1bae81[_0x8488('0x7')])[_0x8488('0x8')](function(_0x19a2ee){_0x1bae81['temp']=0x0;logger[_0x8488('0xa')](_0x8488('0xb'),inspectError(_0x19a2ee));});}exports[_0x8488('0x9')]=getContactDialerIvr;function countReScheduled(_0x256bab){return cmHopper[_0x8488('0xc')](_0x256bab)['catch'](function(_0x14462e){logger[_0x8488('0xa')]('[countReScheduled]',inspectError(_0x14462e));});}exports['countReScheduled']=countReScheduled;function rescheduleContact(_0x150b52){return cmHopper['rescheduleContact'](_0x150b52)[_0x8488('0x8')](function(_0x4e94fc){logger['error'](_0x8488('0xd'),inspectError(_0x4e94fc));});}exports[_0x8488('0xe')]=rescheduleContact;function unlockContact(_0x5700b,_0x2bcb7c,_0x3b3cfa){return cmHopper[_0x8488('0xf')](_0x5700b,_0x2bcb7c,_0x3b3cfa)[_0x8488('0x8')](function(_0x4e44af){logger[_0x8488('0xa')](_0x8488('0x10'),inspectError(_0x4e44af));});}exports[_0x8488('0xf')]=unlockContact;function moveContactManagedDialer(_0x37361d){return cmHopper[_0x8488('0x11')](_0x37361d)[_0x8488('0x8')](function(_0x1aedb1){logger[_0x8488('0xa')](_0x8488('0x12'),inspectError(_0x1aedb1));});}exports[_0x8488('0x11')]=moveContactManagedDialer;function checkIsBlackList(_0x10bfd6){return cmHopperBlack[_0x8488('0x13')](_0x10bfd6)[_0x8488('0x8')](function(_0x554ec6){logger['error'](_0x8488('0x14'),inspectError(_0x554ec6));});}exports[_0x8488('0x13')]=checkIsBlackList;function checkIsBlackListIvr(_0xbb10fe){return cmHopperBlack[_0x8488('0x15')](_0xbb10fe)[_0x8488('0x8')](function(_0x1bef99){logger[_0x8488('0xa')](_0x8488('0x16'),inspectError(_0x1bef99));});}exports[_0x8488('0x15')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x5123d0,_0x476a14,_0x4e07e1){return cmHopperAdditionalPhone[_0x8488('0x17')](_0x5123d0,_0x476a14,_0x4e07e1)[_0x8488('0x8')](function(_0x290b33){logger['error']('[verifyAdditionalPhone]',inspectError(_0x290b33));});}exports['verifyAdditionalPhones']=verifyAdditionalPhones;function swapAdditionalPhones(_0x59b5e2,_0x472624,_0x51fe30){return cmHopperAdditionalPhone['swapAdditionalPhones'](_0x59b5e2,_0x472624,_0x51fe30)[_0x8488('0x8')](function(_0x2f350a){logger[_0x8488('0xa')](_0x8488('0x18'),inspectError(_0x2f350a));});}exports[_0x8488('0x19')]=swapAdditionalPhones;function avgHandleTime(_0x503b83){return cmHopperHistory[_0x8488('0x1a')](_0x503b83)[_0x8488('0x8')](function(_0xf9720e){logger[_0x8488('0xa')](_0x8488('0x1b'),inspectError(_0xf9720e));});}exports[_0x8488('0x1a')]=avgHandleTime;function createHistory(_0x2c15ff){return cmHopperHistory[_0x8488('0x1c')](_0x2c15ff)[_0x8488('0x8')](function(_0x1d9317){logger[_0x8488('0xa')]('[createHistory]',inspectError(_0x1d9317));});}exports['createHistory']=createHistory; \ No newline at end of file +var _0xd117=['rescheduleContact','[unlockContact]','unlockContact','moveContactManagedDialer','[moveContactManagedDialer]','[checkIsBlackList]','checkIsBlackList','checkIsBlackListIvr','verifyAdditionalPhones','[verifyAdditionalPhone]','[swapAdditionalPhone]','swapAdditionalPhones','avgHandleTime','createHistory','util','../../../../config/logger','dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','inspect','getContactDialer','dialOrderByScheduledAt','catch','error','[getContactDialer]','getContactDialerIvr','[getContactDialerIvr]','countReScheduled','[rescheduleContact]'];(function(_0x31b195,_0x5aaa50){var _0x28bfca=function(_0x3fe480){while(--_0x3fe480){_0x31b195['push'](_0x31b195['shift']());}};_0x28bfca(++_0x5aaa50);}(_0xd117,0x182));var _0x7d11=function(_0x545bed,_0x221e96){_0x545bed=_0x545bed-0x0;var _0x16c79c=_0xd117[_0x545bed];return _0x16c79c;};'use strict';var util=require(_0x7d11('0x0'));var logger=require(_0x7d11('0x1'))(_0x7d11('0x2'));var cmHopper=require(_0x7d11('0x3'));var cmHopperAdditionalPhone=require(_0x7d11('0x4'));var cmHopperBlack=require(_0x7d11('0x5'));var cmHopperHistory=require(_0x7d11('0x6'));function inspectError(_0x254bb4){return util[_0x7d11('0x7')](_0x254bb4,{'showHidden':![],'depth':null});}function getContactDialer(_0x31fcb0,_0x589c51,_0x2689c6){return cmHopper[_0x7d11('0x8')](_0x31fcb0['id'],_0x589c51,_0x2689c6,_0x31fcb0[_0x7d11('0x9')])[_0x7d11('0xa')](function(_0x3c8d66){_0x31fcb0['temp']=0x0;logger[_0x7d11('0xb')](_0x7d11('0xc'),inspectError(_0x3c8d66));});}exports[_0x7d11('0x8')]=getContactDialer;function getContactDialerIvr(_0x5bdf01,_0x305eef){return cmHopper[_0x7d11('0xd')](_0x5bdf01['id'],_0x305eef,_0x5bdf01[_0x7d11('0x9')])['catch'](function(_0x37047f){_0x5bdf01['temp']=0x0;logger['error'](_0x7d11('0xe'),inspectError(_0x37047f));});}exports['getContactDialerIvr']=getContactDialerIvr;function countReScheduled(_0x4a8668){return cmHopper[_0x7d11('0xf')](_0x4a8668)['catch'](function(_0x4767d5){logger[_0x7d11('0xb')]('[countReScheduled]',inspectError(_0x4767d5));});}exports[_0x7d11('0xf')]=countReScheduled;function rescheduleContact(_0x20f519){return cmHopper['rescheduleContact'](_0x20f519)[_0x7d11('0xa')](function(_0x16949d){logger[_0x7d11('0xb')](_0x7d11('0x10'),inspectError(_0x16949d));});}exports[_0x7d11('0x11')]=rescheduleContact;function unlockContact(_0xeae744,_0x2a269e,_0xb1669e){return cmHopper['unlockContact'](_0xeae744,_0x2a269e,_0xb1669e)[_0x7d11('0xa')](function(_0x12c2ff){logger[_0x7d11('0xb')](_0x7d11('0x12'),inspectError(_0x12c2ff));});}exports[_0x7d11('0x13')]=unlockContact;function moveContactManagedDialer(_0x528fdc){return cmHopper[_0x7d11('0x14')](_0x528fdc)[_0x7d11('0xa')](function(_0x4d1306){logger['error'](_0x7d11('0x15'),inspectError(_0x4d1306));});}exports['moveContactManagedDialer']=moveContactManagedDialer;function checkIsBlackList(_0x1f9990){return cmHopperBlack['checkIsBlackList'](_0x1f9990)[_0x7d11('0xa')](function(_0x17e539){logger[_0x7d11('0xb')](_0x7d11('0x16'),inspectError(_0x17e539));});}exports[_0x7d11('0x17')]=checkIsBlackList;function checkIsBlackListIvr(_0x117bb9){return cmHopperBlack[_0x7d11('0x18')](_0x117bb9)[_0x7d11('0xa')](function(_0x5680cb){logger[_0x7d11('0xb')]('[checkIsBlackListIvr]',inspectError(_0x5680cb));});}exports['checkIsBlackListIvr']=checkIsBlackListIvr;function verifyAdditionalPhones(_0x5c3898,_0x27a818,_0x3545dc){return cmHopperAdditionalPhone[_0x7d11('0x19')](_0x5c3898,_0x27a818,_0x3545dc)[_0x7d11('0xa')](function(_0x355d14){logger[_0x7d11('0xb')](_0x7d11('0x1a'),inspectError(_0x355d14));});}exports[_0x7d11('0x19')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x5e2f2f,_0x36c2b4,_0x577ca9){return cmHopperAdditionalPhone['swapAdditionalPhones'](_0x5e2f2f,_0x36c2b4,_0x577ca9)['catch'](function(_0x3ba092){logger['error'](_0x7d11('0x1b'),inspectError(_0x3ba092));});}exports[_0x7d11('0x1c')]=swapAdditionalPhones;function avgHandleTime(_0x328ab7){return cmHopperHistory['avgHandleTime'](_0x328ab7)[_0x7d11('0xa')](function(_0x3bb9b8){logger[_0x7d11('0xb')]('[avgHandleTime]',inspectError(_0x3bb9b8));});}exports[_0x7d11('0x1d')]=avgHandleTime;function createHistory(_0x35a789){return cmHopperHistory[_0x7d11('0x1e')](_0x35a789)[_0x7d11('0xa')](function(_0x4c7d6a){logger[_0x7d11('0xb')]('[createHistory]',inspectError(_0x4c7d6a));});}exports[_0x7d11('0x1e')]=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 cd838bd..c8498a5 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 _0xe68f=['updatedAt','undefined','%s%s','XMD-','toUpperCase','setXMDContactVariables','lodash','dialer','../../../../config/environment/shared','timezones','BLACKLIST','RESCHEDULED_CONTACTS','DEACTIVATED','INTERVAL_IS_EMPTY','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','INTERVAL_IS_OVERTIME','RUNNING','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS','dialMethod','isPreviewCampaign','type','isIVRCampaign','outbound','isOutboundQueue','dialActive','active','milliseconds','getSeconds','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','hasQueueCampaignDataChanged','dialTimezone','isNil','dialGlobalInterval','Interval','NULL_INTERVAL','isEmpty','Intervals','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','SIP/','reachable','unmonitored','TrunkBackup','includes','ACTIVE','INACTIVE','DISACTIVED','getQueueCampaignStatusMessage','getQueueCampaignActiveStatusMessage','match','extractCalleridName','string','format','\x22%s\x22\x20<%s>','isUndefined','\x22\x22\x20<>','getCallerId','\x5cw{0,','pow','replace','toString','getCallerIdRandom','error','decrementOriginate','length','checkContactEmpty','erlangb','checkContactLowerLimitOriginate','createdAt'];(function(_0x2dbbf2,_0x34c336){var _0x2b40ce=function(_0x1566c4){while(--_0x1566c4){_0x2dbbf2['push'](_0x2dbbf2['shift']());}};_0x2b40ce(++_0x34c336);}(_0xe68f,0x1a5));var _0xfe68=function(_0x14eda0,_0x584d82){_0x14eda0=_0x14eda0-0x0;var _0x491eb8=_0xe68f[_0x14eda0];return _0x491eb8;};'use strict';var _=require(_0xfe68('0x0'));var moment=require('moment');var util=require('util');var logger=require('../../../../config/logger')(_0xfe68('0x1'));var timezones=require(_0xfe68('0x2'))[_0xfe68('0x3')];var CAMPAIGN_STATUS={'ACTIVE':'ACTIVE','BLACKLIST':_0xfe68('0x4'),'CONTACTS_RESCHEDULED':_0xfe68('0x5'),'DEACTIVATED':_0xfe68('0x6'),'DISACTIVED':'IS_DISACTIVED','EMPTY_INTERVAL':_0xfe68('0x7'),'INACTIVE':'NOT_ACTIVE','NO_AGENTS_LOGGED':'AGENTS_NOT_LOGGED','NO_AVAILABLE_CONTACTS':_0xfe68('0x8'),'NULL_INTERVAL':_0xfe68('0x9'),'OVERTIME_INTERVAL':_0xfe68('0xa'),'OVERTIME_GLOBAL_INTERVAL':'GLOBAL_INTERVAL_IS_OVERTIME','QUEUE_RECALL':'RECALLINQUEUE','RECALL_TIMEOUT':'RECALLFAILEDTIMEOUT','RUNNING':_0xfe68('0xb'),'UNKNOWN_TIMEZONE':_0xfe68('0xc'),'UNREACHABLE_TRUNK':_0xfe68('0xd')};exports[_0xfe68('0xe')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x439d7d){return _0x439d7d[_0xfe68('0xf')]==='preview';}exports[_0xfe68('0x10')]=isPreviewCampaign;function isIVRCampaign(_0x12723d){return _0x12723d[_0xfe68('0x11')]==='ivr';}exports[_0xfe68('0x12')]=isIVRCampaign;function isOutboundQueue(_0x29e3be){return _0x29e3be['type']===_0xfe68('0x13');}exports[_0xfe68('0x14')]=isOutboundQueue;function isQueueCampaignActive(_0x91716e){return _0x91716e[_0xfe68('0x15')];}exports['isQueueCampaignActive']=isQueueCampaignActive;function isIVRCampaignActive(_0x1166ca){return _0x1166ca[_0xfe68('0x16')];}exports['isIVRCampaignActive']=isIVRCampaignActive;function getSeconds(_0x34fbd8,_0x54254b){var _0x53c600=moment(_0x34fbd8)[_0xfe68('0x17')](0x0);var _0x353d8d=moment(_0x54254b)[_0xfe68('0x17')](0x0);return _0x53c600['diff'](_0x353d8d,'seconds');}exports[_0xfe68('0x18')]=getSeconds;function hasQueueCampaignDataChanged(_0x17ae63,_0x4f43d7){var _0x3aeb96=![];var _0x1cc571=_0x17ae63[_0xfe68('0xf')]!==_0x4f43d7[_0xfe68('0xf')]||_0x17ae63[_0xfe68('0x15')]!==_0x4f43d7[_0xfe68('0x15')]||_0x17ae63['message']!==_0x4f43d7[_0xfe68('0x19')];var _0x1265d3=_0x17ae63[_0xfe68('0x1a')]!==_0x4f43d7['available']||_0x17ae63[_0xfe68('0x1b')]!==_0x4f43d7['loggedIn']||_0x17ae63[_0xfe68('0x1c')]!==_0x4f43d7[_0xfe68('0x1c')]||_0x17ae63['paused']!==_0x4f43d7[_0xfe68('0x1d')]||_0x17ae63[_0xfe68('0x1e')]!==_0x4f43d7[_0xfe68('0x1e')]||_0x17ae63[_0xfe68('0x1f')]!==_0x4f43d7[_0xfe68('0x1f')]||_0x17ae63['waiting']!==_0x4f43d7[_0xfe68('0x20')]||_0x17ae63[_0xfe68('0x21')]!==_0x4f43d7[_0xfe68('0x21')]||_0x17ae63[_0xfe68('0x22')]!==_0x4f43d7[_0xfe68('0x22')];if(_0x17ae63[_0xfe68('0x23')]&&_0x4f43d7['Trunk']){_0x3aeb96=_0x17ae63[_0xfe68('0x23')][_0xfe68('0x24')]!==_0x4f43d7[_0xfe68('0x23')][_0xfe68('0x24')]||_0x17ae63[_0xfe68('0x23')][_0xfe68('0x16')]!==_0x4f43d7[_0xfe68('0x23')][_0xfe68('0x16')];}return _0x1cc571||_0x1265d3||_0x3aeb96;}exports[_0xfe68('0x25')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x35dcfe){var _0x145df6=null;var _0x212d05=_0x35dcfe[_0xfe68('0x26')];if(_[_0xfe68('0x27')](_0x35dcfe[_0xfe68('0x28')])||_[_0xfe68('0x27')](_0x35dcfe[_0xfe68('0x29')])||_[_0xfe68('0x27')](_0x35dcfe['Interval']['Intervals'])){_0x145df6=CAMPAIGN_STATUS[_0xfe68('0x2a')];}else if(_[_0xfe68('0x2b')](_0x35dcfe['dialGlobalInterval'])||_[_0xfe68('0x2b')](_0x35dcfe['Interval'][_0xfe68('0x2c')])){_0x145df6=CAMPAIGN_STATUS[_0xfe68('0x2d')];}else if(_0x212d05&&!timezones[_0x212d05]){_0x145df6=CAMPAIGN_STATUS[_0xfe68('0x2e')];}return _0x145df6;}function checkAnyValidTrunk(_0x4b4ba2,_0x15d341){var _0x16c67d=null;var _0x1b9f9b=_0xfe68('0x2f');var _0x47ecfd=[_0xfe68('0x30'),_0xfe68('0x31')];var _0xd93791=!![];if(_0x4b4ba2[_0xfe68('0x23')]&&_0x4b4ba2['Trunk'][_0xfe68('0x16')]){_0x1b9f9b+=_0x4b4ba2[_0xfe68('0x23')]['name'];_0x16c67d=_0x15d341[_0x1b9f9b];_0xd93791=_0x47ecfd['includes'](_0x16c67d['status']);}else if(_0x4b4ba2[_0xfe68('0x32')]&&_0x4b4ba2[_0xfe68('0x32')][_0xfe68('0x16')]){_0x1b9f9b+=_0x4b4ba2[_0xfe68('0x32')]['name'];_0x16c67d=_0x15d341[_0x1b9f9b];_0xd93791=_0x47ecfd[_0xfe68('0x33')](_0x16c67d['status']);}return _0xd93791;}function getQueueCampaignStatusMessage(_0x55d17a,_0x3091dc){var _0x179f17=CAMPAIGN_STATUS[_0xfe68('0x34')];var _0x1e3bcc=isPreviewCampaign(_0x55d17a);if(!isQueueCampaignActive(_0x55d17a)){if(_0x1e3bcc){_0x179f17=CAMPAIGN_STATUS[_0xfe68('0x35')];}else{if(_0x55d17a[_0xfe68('0x22')]===0x0&&_0x55d17a[_0xfe68('0x1e')]===0x0&&_0x55d17a['waiting']===0x0&&(_0x55d17a[_0xfe68('0x1f')]||0x0)===0x0){_0x179f17=CAMPAIGN_STATUS['INACTIVE'];}else{_0x179f17=CAMPAIGN_STATUS[_0xfe68('0x36')];}}}else if(_0x55d17a['loggedIn']===0x0){_0x179f17=CAMPAIGN_STATUS['NO_AGENTS_LOGGED'];}else if(!checkAnyValidTrunk(_0x55d17a,_0x3091dc)){_0x179f17=CAMPAIGN_STATUS['UNREACHABLE_TRUNK'];}else if(!isPreviewCampaign(_0x55d17a)){var _0x5e5141=checkAnyValidQueueCampaignInterval(_0x55d17a);if(_0x5e5141){_0x179f17=_0x5e5141;}}return _0x179f17;}exports[_0xfe68('0x37')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x479a01){var _0x372068=CAMPAIGN_STATUS[_0xfe68('0x36')];if(_0x479a01['originated']===0x0&&_0x479a01['talking']===0x0&&_0x479a01['waiting']===0x0&&(_0x479a01['pTalking']||0x0)===0x0){_0x372068=CAMPAIGN_STATUS[_0xfe68('0x35')];}return _0x372068;}exports[_0xfe68('0x38')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x47fcca){var _0x652555=_0x47fcca[_0xfe68('0x39')](/"(.*?)"/);return _0x652555?_0x652555[0x1]:_0x47fcca;}exports[_0xfe68('0x3a')]=extractCalleridName;function getCallerId(_0x107857,_0x50879c,_0x34df86){if(!_['isUndefined'](_0x34df86)&&typeof _0x34df86===_0xfe68('0x3b')&&!_[_0xfe68('0x2b')](_0x34df86)){if(!_['isUndefined'](_0x50879c)&&typeof _0x50879c===_0xfe68('0x3b')&&!_[_0xfe68('0x2b')](_0x50879c)){return util[_0xfe68('0x3c')](_0xfe68('0x3d'),_0x50879c,_0x34df86);}return util[_0xfe68('0x3c')](_0xfe68('0x3d'),_0x34df86,_0x34df86);}if(!_[_0xfe68('0x3e')](_0x107857)&&typeof _0x107857==='string'&&!_['isEmpty'](_0x107857)){return _0x107857;}return _0xfe68('0x3f');}exports[_0xfe68('0x40')]=getCallerId;function getCallerIdRandom(_0x2c06ae,_0x37c0d7){var _0x414cd0;var _0x5cfef3;var _0x9db124;if(_0x37c0d7<=0x0){_0x37c0d7=0x1;}_0x414cd0=new RegExp(_0xfe68('0x41')+_0x37c0d7+'}$');_0x5cfef3=Math[_0xfe68('0x42')](0xa,_0x37c0d7-0x1);_0x9db124=Math[_0xfe68('0x42')](0xa,_0x37c0d7)-0x1;return util['format']('%s',_[_0xfe68('0x43')](_0x2c06ae,_0x414cd0,_['random'](_0x5cfef3,_0x9db124)[_0xfe68('0x44')]()));}exports[_0xfe68('0x45')]=getCallerIdRandom;function decrementOriginate(_0x2ff1ab){if(_0x2ff1ab[_0xfe68('0x22')]&&_0x2ff1ab['originated']>0x0){_0x2ff1ab[_0xfe68('0x22')]-=0x1;}else{logger[_0xfe68('0x46')]('[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative');}}exports[_0xfe68('0x47')]=decrementOriginate;function checkContactEmpty(_0x542868){return _0x542868&&_0x542868[_0xfe68('0x48')]>0x0;}exports[_0xfe68('0x49')]=checkContactEmpty;function erlangb(_0x1dea16,_0x5f1b1c){if(_0x5f1b1c===0x0){return 0x0;}var _0x97d5c2=0x1;for(var _0x1b8e9a=0x1;_0x1b8e9a<=_0x5f1b1c;_0x1b8e9a+=0x1){_0x97d5c2=0x1+_0x97d5c2*_0x1b8e9a/_0x1dea16;}return 0x1/_0x97d5c2;}exports[_0xfe68('0x4a')]=erlangb;function checkContactLowerLimitOriginate(_0x5da47e,_0x43c268,_0x2249a1){if(_0x43c268>_0x2249a1){for(var _0xaf79c3=0x0;_0xaf79c3<_0x43c268-_0x2249a1;_0xaf79c3+=0x1){decrementOriginate(_0x5da47e);}}}exports[_0xfe68('0x4b')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x494621){var _0x3d92dc={};var _0x554269=['id',_0xfe68('0x4c'),'description','tags',_0xfe68('0x4d')];if(_0x494621){for(var _0xd018a9 in _0x494621){if(typeof _0x494621[_0xd018a9]!==_0xfe68('0x4e')){if(!_['isNil'](_0x494621[_0xd018a9])&&!_0x554269['includes'](_0xd018a9)){_0x3d92dc[util[_0xfe68('0x3c')](_0xfe68('0x4f'),_0xfe68('0x50'),_0xd018a9[_0xfe68('0x51')]())]=_0x494621[_0xd018a9];}}}}return _0x3d92dc;}exports[_0xfe68('0x52')]=setXMDContactVariables; \ No newline at end of file +var _0x32e0=['ivr','isIVRCampaign','outbound','isOutboundQueue','isQueueCampaignActive','active','isIVRCampaignActive','milliseconds','diff','seconds','dialActive','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','originated','Trunk','name','hasQueueCampaignDataChanged','dialTimezone','isNil','dialGlobalInterval','Interval','Intervals','NULL_INTERVAL','isEmpty','EMPTY_INTERVAL','SIP/','unmonitored','status','TrunkBackup','includes','DISACTIVED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','INACTIVE','getQueueCampaignActiveStatusMessage','match','isUndefined','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','getCallerId','pow','replace','random','toString','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','length','checkContactEmpty','checkContactLowerLimitOriginate','description','tags','updatedAt','undefined','%s%s','XMD-','toUpperCase','setXMDContactVariables','lodash','moment','util','dialer','timezones','ACTIVE','BLACKLIST','RESCHEDULED_CONTACTS','IS_DISACTIVED','NOT_ACTIVE','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','RUNNING','TIMEZONE_UNKNOW','CAMPAIGN_STATUS','dialMethod','preview','isPreviewCampaign','type'];(function(_0xafadef,_0x2a5075){var _0x2d6530=function(_0x2307a1){while(--_0x2307a1){_0xafadef['push'](_0xafadef['shift']());}};_0x2d6530(++_0x2a5075);}(_0x32e0,0x19a));var _0x032e=function(_0x11155f,_0x57b687){_0x11155f=_0x11155f-0x0;var _0xd07e48=_0x32e0[_0x11155f];return _0xd07e48;};'use strict';var _=require(_0x032e('0x0'));var moment=require(_0x032e('0x1'));var util=require(_0x032e('0x2'));var logger=require('../../../../config/logger')(_0x032e('0x3'));var timezones=require('../../../../config/environment/shared')[_0x032e('0x4')];var CAMPAIGN_STATUS={'ACTIVE':_0x032e('0x5'),'BLACKLIST':_0x032e('0x6'),'CONTACTS_RESCHEDULED':_0x032e('0x7'),'DEACTIVATED':'DEACTIVATED','DISACTIVED':_0x032e('0x8'),'EMPTY_INTERVAL':'INTERVAL_IS_EMPTY','INACTIVE':_0x032e('0x9'),'NO_AGENTS_LOGGED':_0x032e('0xa'),'NO_AVAILABLE_CONTACTS':_0x032e('0xb'),'NULL_INTERVAL':_0x032e('0xc'),'OVERTIME_INTERVAL':'INTERVAL_IS_OVERTIME','OVERTIME_GLOBAL_INTERVAL':'GLOBAL_INTERVAL_IS_OVERTIME','QUEUE_RECALL':'RECALLINQUEUE','RECALL_TIMEOUT':'RECALLFAILEDTIMEOUT','RUNNING':_0x032e('0xd'),'UNKNOWN_TIMEZONE':_0x032e('0xe'),'UNREACHABLE_TRUNK':'TRUNK_IS_NOT_REACHABLE'};exports[_0x032e('0xf')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x1034a3){return _0x1034a3[_0x032e('0x10')]===_0x032e('0x11');}exports[_0x032e('0x12')]=isPreviewCampaign;function isIVRCampaign(_0xeb1c9f){return _0xeb1c9f[_0x032e('0x13')]===_0x032e('0x14');}exports[_0x032e('0x15')]=isIVRCampaign;function isOutboundQueue(_0x299e15){return _0x299e15['type']===_0x032e('0x16');}exports[_0x032e('0x17')]=isOutboundQueue;function isQueueCampaignActive(_0x502f42){return _0x502f42['dialActive'];}exports[_0x032e('0x18')]=isQueueCampaignActive;function isIVRCampaignActive(_0x2a25db){return _0x2a25db[_0x032e('0x19')];}exports[_0x032e('0x1a')]=isIVRCampaignActive;function getSeconds(_0x3ecce9,_0xbbbe53){var _0x2ed146=moment(_0x3ecce9)['milliseconds'](0x0);var _0xc0cb6=moment(_0xbbbe53)[_0x032e('0x1b')](0x0);return _0x2ed146[_0x032e('0x1c')](_0xc0cb6,_0x032e('0x1d'));}exports['getSeconds']=getSeconds;function hasQueueCampaignDataChanged(_0x271823,_0x824d62){var _0x4f7e04=![];var _0x52713d=_0x271823[_0x032e('0x10')]!==_0x824d62['dialMethod']||_0x271823[_0x032e('0x1e')]!==_0x824d62['dialActive']||_0x271823[_0x032e('0x1f')]!==_0x824d62['message'];var _0xf8decc=_0x271823[_0x032e('0x20')]!==_0x824d62['available']||_0x271823[_0x032e('0x21')]!==_0x824d62[_0x032e('0x21')]||_0x271823[_0x032e('0x22')]!==_0x824d62[_0x032e('0x22')]||_0x271823[_0x032e('0x23')]!==_0x824d62[_0x032e('0x23')]||_0x271823[_0x032e('0x24')]!==_0x824d62[_0x032e('0x24')]||_0x271823[_0x032e('0x25')]!==_0x824d62[_0x032e('0x25')]||_0x271823[_0x032e('0x26')]!==_0x824d62['waiting']||_0x271823['inUse']!==_0x824d62['inUse']||_0x271823[_0x032e('0x27')]!==_0x824d62[_0x032e('0x27')];if(_0x271823[_0x032e('0x28')]&&_0x824d62[_0x032e('0x28')]){_0x4f7e04=_0x271823[_0x032e('0x28')][_0x032e('0x29')]!==_0x824d62[_0x032e('0x28')][_0x032e('0x29')]||_0x271823['Trunk'][_0x032e('0x19')]!==_0x824d62['Trunk'][_0x032e('0x19')];}return _0x52713d||_0xf8decc||_0x4f7e04;}exports[_0x032e('0x2a')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x53f922){var _0x242b2f=null;var _0x1e2b1b=_0x53f922[_0x032e('0x2b')];if(_[_0x032e('0x2c')](_0x53f922[_0x032e('0x2d')])||_[_0x032e('0x2c')](_0x53f922[_0x032e('0x2e')])||_[_0x032e('0x2c')](_0x53f922[_0x032e('0x2e')][_0x032e('0x2f')])){_0x242b2f=CAMPAIGN_STATUS[_0x032e('0x30')];}else if(_[_0x032e('0x31')](_0x53f922[_0x032e('0x2d')])||_[_0x032e('0x31')](_0x53f922[_0x032e('0x2e')][_0x032e('0x2f')])){_0x242b2f=CAMPAIGN_STATUS[_0x032e('0x32')];}else if(_0x1e2b1b&&!timezones[_0x1e2b1b]){_0x242b2f=CAMPAIGN_STATUS['UNKNOWN_TIMEZONE'];}return _0x242b2f;}function checkAnyValidTrunk(_0x3fb1fd,_0x8dfa7a){var _0x4ac1c9=null;var _0x666762=_0x032e('0x33');var _0x48ec6c=['reachable',_0x032e('0x34')];var _0x5dafe7=!![];if(_0x3fb1fd[_0x032e('0x28')]&&_0x3fb1fd[_0x032e('0x28')][_0x032e('0x19')]){_0x666762+=_0x3fb1fd[_0x032e('0x28')][_0x032e('0x29')];_0x4ac1c9=_0x8dfa7a[_0x666762];_0x5dafe7=_0x48ec6c['includes'](_0x4ac1c9[_0x032e('0x35')]);}else if(_0x3fb1fd['TrunkBackup']&&_0x3fb1fd[_0x032e('0x36')][_0x032e('0x19')]){_0x666762+=_0x3fb1fd['TrunkBackup'][_0x032e('0x29')];_0x4ac1c9=_0x8dfa7a[_0x666762];_0x5dafe7=_0x48ec6c[_0x032e('0x37')](_0x4ac1c9['status']);}return _0x5dafe7;}function getQueueCampaignStatusMessage(_0x20b73e,_0x4ea4c4){var _0x3d1029=CAMPAIGN_STATUS[_0x032e('0x5')];var _0x300b03=isPreviewCampaign(_0x20b73e);if(!isQueueCampaignActive(_0x20b73e)){if(_0x300b03){_0x3d1029=CAMPAIGN_STATUS['INACTIVE'];}else{if(_0x20b73e[_0x032e('0x27')]===0x0&&_0x20b73e[_0x032e('0x24')]===0x0&&_0x20b73e['waiting']===0x0&&(_0x20b73e['pTalking']||0x0)===0x0){_0x3d1029=CAMPAIGN_STATUS['INACTIVE'];}else{_0x3d1029=CAMPAIGN_STATUS[_0x032e('0x38')];}}}else if(_0x20b73e[_0x032e('0x21')]===0x0){_0x3d1029=CAMPAIGN_STATUS['NO_AGENTS_LOGGED'];}else if(!checkAnyValidTrunk(_0x20b73e,_0x4ea4c4)){_0x3d1029=CAMPAIGN_STATUS[_0x032e('0x39')];}else if(!isPreviewCampaign(_0x20b73e)){var _0xcf988c=checkAnyValidQueueCampaignInterval(_0x20b73e);if(_0xcf988c){_0x3d1029=_0xcf988c;}}return _0x3d1029;}exports[_0x032e('0x3a')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x30a4e8){var _0x3c2554=CAMPAIGN_STATUS[_0x032e('0x38')];if(_0x30a4e8['originated']===0x0&&_0x30a4e8[_0x032e('0x24')]===0x0&&_0x30a4e8[_0x032e('0x26')]===0x0&&(_0x30a4e8['pTalking']||0x0)===0x0){_0x3c2554=CAMPAIGN_STATUS[_0x032e('0x3b')];}return _0x3c2554;}exports[_0x032e('0x3c')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x3e70e5){var _0x2ae058=_0x3e70e5[_0x032e('0x3d')](/"(.*?)"/);return _0x2ae058?_0x2ae058[0x1]:_0x3e70e5;}exports['extractCalleridName']=extractCalleridName;function getCallerId(_0x40fb40,_0x385be2,_0x366a1c){if(!_[_0x032e('0x3e')](_0x366a1c)&&typeof _0x366a1c===_0x032e('0x3f')&&!_[_0x032e('0x31')](_0x366a1c)){if(!_[_0x032e('0x3e')](_0x385be2)&&typeof _0x385be2==='string'&&!_[_0x032e('0x31')](_0x385be2)){return util[_0x032e('0x40')](_0x032e('0x41'),_0x385be2,_0x366a1c);}return util[_0x032e('0x40')](_0x032e('0x41'),_0x366a1c,_0x366a1c);}if(!_[_0x032e('0x3e')](_0x40fb40)&&typeof _0x40fb40===_0x032e('0x3f')&&!_['isEmpty'](_0x40fb40)){return _0x40fb40;}return _0x032e('0x42');}exports[_0x032e('0x43')]=getCallerId;function getCallerIdRandom(_0x2bcab3,_0x26534b){var _0x474158;var _0xff5ccb;var _0x64e471;if(_0x26534b<=0x0){_0x26534b=0x1;}_0x474158=new RegExp('\x5cw{0,'+_0x26534b+'}$');_0xff5ccb=Math['pow'](0xa,_0x26534b-0x1);_0x64e471=Math[_0x032e('0x44')](0xa,_0x26534b)-0x1;return util[_0x032e('0x40')]('%s',_[_0x032e('0x45')](_0x2bcab3,_0x474158,_[_0x032e('0x46')](_0xff5ccb,_0x64e471)[_0x032e('0x47')]()));}exports[_0x032e('0x48')]=getCallerIdRandom;function decrementOriginate(_0x296d8c){if(_0x296d8c[_0x032e('0x27')]&&_0x296d8c[_0x032e('0x27')]>0x0){_0x296d8c[_0x032e('0x27')]-=0x1;}else{logger[_0x032e('0x49')](_0x032e('0x4a'));}}exports['decrementOriginate']=decrementOriginate;function checkContactEmpty(_0xe4ba0d){return _0xe4ba0d&&_0xe4ba0d[_0x032e('0x4b')]>0x0;}exports[_0x032e('0x4c')]=checkContactEmpty;function erlangb(_0x349223,_0x20e60a){if(_0x20e60a===0x0){return 0x0;}var _0x4b0402=0x1;for(var _0x4fb868=0x1;_0x4fb868<=_0x20e60a;_0x4fb868+=0x1){_0x4b0402=0x1+_0x4b0402*_0x4fb868/_0x349223;}return 0x1/_0x4b0402;}exports['erlangb']=erlangb;function checkContactLowerLimitOriginate(_0x2f7937,_0x55015d,_0xdcffc){if(_0x55015d>_0xdcffc){for(var _0x1858f1=0x0;_0x1858f1<_0x55015d-_0xdcffc;_0x1858f1+=0x1){decrementOriginate(_0x2f7937);}}}exports[_0x032e('0x4d')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x4ef16b){var _0x3154d8={};var _0x2d8c9b=['id','createdAt',_0x032e('0x4e'),_0x032e('0x4f'),_0x032e('0x50')];if(_0x4ef16b){for(var _0x25682f in _0x4ef16b){if(typeof _0x4ef16b[_0x25682f]!==_0x032e('0x51')){if(!_[_0x032e('0x2c')](_0x4ef16b[_0x25682f])&&!_0x2d8c9b[_0x032e('0x37')](_0x25682f)){_0x3154d8[util[_0x032e('0x40')](_0x032e('0x52'),_0x032e('0x53'),_0x25682f[_0x032e('0x54')]())]=_0x4ef16b[_0x25682f];}}}}return _0x3154d8;}exports[_0x032e('0x55')]=setXMDContactVariables; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 9217685..5882190 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(_0x26a02e,_0x940624){var _0x5d5ecf=function(_0x24f5b9){while(--_0x24f5b9){_0x26a02e['push'](_0x26a02e['shift']());}};_0x5d5ecf(++_0x940624);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'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(_0x536faa,_0x225174){var _0x1963c6=function(_0x2f4c5f){while(--_0x2f4c5f){_0x536faa['push'](_0x536faa['shift']());}};_0x1963c6(++_0x225174);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'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 4642e0b..609e606 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 _0x4ad4=['info','\x20result\x20conversion\x20file\x20','message','parse','application/pdf','notify','fax','.pdf','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','actions','merge','pick','response','reason','AttachmentId','then','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','dir','Action','variablesAction','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','checkTrunk','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Is\x20Valid','exports','lodash','bluebird','uuid','moment','path','./util/gs','../../../config/logger','./rpcDb','./util/util','./action','../rpc/attachment','../rpc/faxMessage','faxAccounts','trunks','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate','newexten','syncNewExten','receivefax','hangup','syncHangup','originateresponse','syncOriginateResponse','context','from-voip-provider','hasOwnProperty','localstationid','channels','uniqueid','channel','name','\x20syncNewchannel\x20','prototype','value','syncNewState','channelstate','channelstatedesc','variable','syncFaxStatus','operation','status','filename','syncReceiveFax','remotestationid','pagestransferred','resolution','transferrate','calleridnum'];(function(_0x20cb20,_0x256051){var _0x2fcf4b=function(_0x26200b){while(--_0x26200b){_0x20cb20['push'](_0x20cb20['shift']());}};_0x2fcf4b(++_0x256051);}(_0x4ad4,0xb4));var _0x44ad=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x4ad4[_0x413feb];return _0x40ee88;};'use strict';var util=require('util');var _=require(_0x44ad('0x0'));var BPromise=require(_0x44ad('0x1'));var uuid=require(_0x44ad('0x2'));var moment=require(_0x44ad('0x3'));var path=require(_0x44ad('0x4'));var tiff2pdf=require('tiff2pdf');var gs=require(_0x44ad('0x5'));var logger=require(_0x44ad('0x6'))('fax');var ami=require('../ami');var rpcDb=require(_0x44ad('0x7'));var Channel=require('./channel');var ut=require(_0x44ad('0x8'));var Action=require(_0x44ad('0x9'));var faxAccount=require('../rpc/faxAccount');var attachment=require(_0x44ad('0xa'));var faxMessage=require(_0x44ad('0xb'));function Fax(_0x1ed16a){this['channels']={};this[_0x44ad('0xc')]=_0x1ed16a[_0x44ad('0xc')];this['trunks']=_0x1ed16a[_0x44ad('0xd')];this['actions']={};ami['on'](_0x44ad('0xe'),this[_0x44ad('0xf')][_0x44ad('0x10')](this));ami['on'](_0x44ad('0x11'),this[_0x44ad('0x12')][_0x44ad('0x10')](this));ami['on'](_0x44ad('0x13'),this['syncNewState']['bind'](this));ami['on'](_0x44ad('0x14'),this[_0x44ad('0x15')][_0x44ad('0x10')](this));ami['on']('faxstatus',this['syncFaxStatus'][_0x44ad('0x10')](this));ami['on'](_0x44ad('0x16'),this['syncReceiveFax'][_0x44ad('0x10')](this));ami['on'](_0x44ad('0x17'),this[_0x44ad('0x18')]['bind'](this));ami['on'](_0x44ad('0x19'),this[_0x44ad('0x1a')][_0x44ad('0x10')](this));}Fax['prototype'][_0x44ad('0xf')]=function(_0x53e9){if(_0x53e9[_0x44ad('0x1b')]===_0x44ad('0x1c')){for(var _0x24be33 in this[_0x44ad('0xc')]){if(this[_0x44ad('0xc')][_0x44ad('0x1d')](_0x24be33)){if(_0x53e9['exten']===this['faxAccounts'][_0x24be33][_0x44ad('0x1e')]){this[_0x44ad('0x1f')][_0x53e9[_0x44ad('0x20')]]={};this[_0x44ad('0x1f')][_0x53e9[_0x44ad('0x20')]][_0x44ad('0x21')]=_0x53e9[_0x44ad('0x21')];this[_0x44ad('0x1f')][_0x53e9[_0x44ad('0x20')]]['id']=this['faxAccounts'][_0x24be33]['id'];this[_0x44ad('0x1f')][_0x53e9['uniqueid']][_0x44ad('0x22')]=this[_0x44ad('0xc')][_0x24be33][_0x44ad('0x22')];logger['info'](_0x53e9[_0x44ad('0x20')],_0x44ad('0x23'));}}}}if(this['actions'][_0x53e9[_0x44ad('0x20')]]){this['channels'][_0x53e9['uniqueid']]={};this[_0x44ad('0x1f')][_0x53e9[_0x44ad('0x20')]][_0x44ad('0x21')]=_0x53e9[_0x44ad('0x21')];logger['info'](_0x53e9[_0x44ad('0x20')],'\x20syncNewchannel\x20');}};Fax[_0x44ad('0x24')][_0x44ad('0x12')]=function(_0x39b344){if(this[_0x44ad('0x1f')][_0x39b344[_0x44ad('0x20')]]){for(var _0x2440e9 in _0x39b344['variable']){if(_0x39b344['variable']['hasOwnProperty'](_0x2440e9)){this[_0x44ad('0x1f')][_0x39b344[_0x44ad('0x20')]][_0x2440e9]=_0x39b344[_0x44ad('0x25')];}}}};Fax[_0x44ad('0x24')][_0x44ad('0x26')]=function(_0x1edd9a){if(this['channels'][_0x1edd9a['uniqueid']]){this['channels'][_0x1edd9a[_0x44ad('0x20')]]['channelstate']=_0x1edd9a[_0x44ad('0x27')];this[_0x44ad('0x1f')][_0x1edd9a['uniqueid']]['channelstatedesc']=_0x1edd9a[_0x44ad('0x28')];}};Fax[_0x44ad('0x24')][_0x44ad('0x15')]=function(_0x2964fc){if(this['channels'][_0x2964fc['uniqueid']]){for(var _0x51ef57 in _0x2964fc[_0x44ad('0x29')]){if(_0x2964fc[_0x44ad('0x29')]['hasOwnProperty'](_0x51ef57)){this[_0x44ad('0x1f')][_0x2964fc[_0x44ad('0x20')]][_0x51ef57]=_0x2964fc[_0x44ad('0x25')];}}}};Fax[_0x44ad('0x24')][_0x44ad('0x2a')]=function(_0x5b4c89){if(this[_0x44ad('0x1f')][_0x5b4c89[_0x44ad('0x20')]]){this[_0x44ad('0x1f')][_0x5b4c89['uniqueid']][_0x44ad('0x2b')]=_0x5b4c89['operation'];this[_0x44ad('0x1f')][_0x5b4c89[_0x44ad('0x20')]][_0x44ad('0x2c')]=_0x5b4c89[_0x44ad('0x2c')];this[_0x44ad('0x1f')][_0x5b4c89[_0x44ad('0x20')]]['localstationid']=_0x5b4c89[_0x44ad('0x1e')];this[_0x44ad('0x1f')][_0x5b4c89[_0x44ad('0x20')]][_0x44ad('0x2d')]=_0x5b4c89[_0x44ad('0x2d')];logger['info'](_0x5b4c89['uniqueid'],'\x20syncFaxStatus\x20');}};Fax[_0x44ad('0x24')][_0x44ad('0x2e')]=function(_0xdbf4f){var _0x195c5f=this;if(this[_0x44ad('0x1f')][_0xdbf4f[_0x44ad('0x20')]]){var _0x4361c3=this[_0x44ad('0x1f')][_0xdbf4f[_0x44ad('0x20')]]['id'];this[_0x44ad('0x1f')][_0xdbf4f[_0x44ad('0x20')]][_0x44ad('0x2f')]=_0xdbf4f['remotestationid'];this[_0x44ad('0x1f')][_0xdbf4f['uniqueid']][_0x44ad('0x30')]=_0xdbf4f['pagestransferred'];this[_0x44ad('0x1f')][_0xdbf4f[_0x44ad('0x20')]]['localstationid']=_0xdbf4f[_0x44ad('0x1e')];this[_0x44ad('0x1f')][_0xdbf4f[_0x44ad('0x20')]][_0x44ad('0x31')]=_0xdbf4f[_0x44ad('0x31')];this[_0x44ad('0x1f')][_0xdbf4f[_0x44ad('0x20')]][_0x44ad('0x32')]=_0xdbf4f[_0x44ad('0x32')];this['channels'][_0xdbf4f[_0x44ad('0x20')]][_0x44ad('0x2d')]=_0xdbf4f[_0x44ad('0x2d')];this[_0x44ad('0x1f')][_0xdbf4f[_0x44ad('0x20')]]['calleridnum']=_0xdbf4f[_0x44ad('0x33')];if(this[_0x44ad('0x1f')][_0xdbf4f['uniqueid']]['pagestransferred']>0x0){tiff2pdf(_0xdbf4f[_0x44ad('0x2d')],'/var/opt/motion2/server/files/attachments/',function(_0x5ab0bf){logger[_0x44ad('0x34')](_0xdbf4f['uniqueid'],_0x44ad('0x35'),_0x5ab0bf[_0x44ad('0x36')]);attachment['create']({'name':path[_0x44ad('0x37')](_0xdbf4f['filename'])[_0x44ad('0x22')],'basename':path['parse'](_0xdbf4f[_0x44ad('0x2d')])['name']+'.pdf','type':_0x44ad('0x38')})['then'](function(_0x4e8d98){faxAccount[_0x44ad('0x39')](_0x4361c3,{'from':_0xdbf4f['calleridnum'],'mapKey':_0x44ad('0x3a'),'body':path[_0x44ad('0x37')](_0xdbf4f['filename'])[_0x44ad('0x22')]+_0x44ad('0x3b'),'AttachmentId':_0x4e8d98['id']})[_0x44ad('0x3c')](function(_0x61b66a){logger[_0x44ad('0x3d')](_0xdbf4f[_0x44ad('0x20')],_0x44ad('0x3e'),JSON[_0x44ad('0x3f')](_0x61b66a));});})[_0x44ad('0x3c')](function(_0x239374){logger[_0x44ad('0x3d')](_0xdbf4f[_0x44ad('0x20')],_0x44ad('0x40'),JSON[_0x44ad('0x3f')](_0x239374));});});}logger[_0x44ad('0x34')](_0xdbf4f[_0x44ad('0x20')],_0x44ad('0x40'));}};Fax[_0x44ad('0x24')]['syncOriginateResponse']=function(_0x1cb437){if(this[_0x44ad('0x41')][_0x1cb437[_0x44ad('0x20')]]){_[_0x44ad('0x42')](this[_0x44ad('0x1f')][_0x1cb437[_0x44ad('0x20')]],_[_0x44ad('0x43')](_0x1cb437,[_0x44ad('0x44'),_0x44ad('0x45')]));}};function updateStatus(_0x3dcc50){if(_0x3dcc50['AttachmentId']){faxMessage['update'](_0x3dcc50[_0x44ad('0x46')],{'failMessage':'SENDING\x20FAILED\x20'})[_0x44ad('0x47')](function(_0x475795){ut[_0x44ad('0x48')]('[Fax][Message][Error][Updated]',_0x475795);})[_0x44ad('0x3c')](function(_0x5d90a9){ut[_0x44ad('0x48')](_0x44ad('0x49'),_0x5d90a9);});}else{ut[_0x44ad('0x48')](_0x44ad('0x4a'));}}Fax[_0x44ad('0x24')][_0x44ad('0x4b')]=function(_0x1ff721,_0x1435dc,_0x250fe2){var _0x4955ab=this;var _0x4e2b39={};if(_0x1435dc){_0x4e2b39={'read':_0x1435dc};}else{_0x4e2b39={'failMessage':_0x250fe2};}if(this[_0x44ad('0x41')][_0x1ff721][_0x44ad('0x46')]){faxMessage['update'](this[_0x44ad('0x41')][_0x1ff721][_0x44ad('0x46')],_0x4e2b39)[_0x44ad('0x47')](function(_0x58b672){ut[_0x44ad('0x48')](_0x44ad('0x4c'),_0x58b672);})['catch'](function(_0x2cc5e5){ut['logger'](_0x44ad('0x4d'),_0x2cc5e5);})[_0x44ad('0x4e')](function(){delete _0x4955ab[_0x44ad('0x1f')][_0x1ff721];delete _0x4955ab['actions'][_0x1ff721];});}else{ut['logger'](_0x44ad('0x4f'));delete this['channels'][_0x1ff721];delete this[_0x44ad('0x41')][_0x1ff721];}};Fax[_0x44ad('0x24')][_0x44ad('0x18')]=function(_0x4aa196){var _0x10cdc0=this;if(this[_0x44ad('0x1f')][_0x4aa196[_0x44ad('0x20')]]){if(this['actions'][_0x4aa196[_0x44ad('0x20')]]){this[_0x44ad('0x1f')][_0x4aa196['uniqueid']]['id']=this[_0x44ad('0x41')][_0x4aa196['uniqueid']]['id'];this[_0x44ad('0x1f')][_0x4aa196[_0x44ad('0x20')]]['name']=this[_0x44ad('0x41')][_0x4aa196[_0x44ad('0x20')]][_0x44ad('0x22')];}logger[_0x44ad('0x34')](_0x4aa196[_0x44ad('0x20')],this[_0x44ad('0x41')][_0x4aa196[_0x44ad('0x20')]]?_0x44ad('0x50'):_0x44ad('0x51'),JSON[_0x44ad('0x3f')](this[_0x44ad('0x1f')][_0x4aa196['uniqueid']]));if(this[_0x44ad('0x41')][_0x4aa196[_0x44ad('0x20')]]){if(this['channels'][_0x4aa196['uniqueid']][_0x44ad('0x52')]>0x0&&this[_0x44ad('0x1f')][_0x4aa196['uniqueid']]['faxstatus']==='SUCCESS'){this[_0x44ad('0x4b')](_0x4aa196[_0x44ad('0x20')],!![]);}else{this[_0x44ad('0x4b')](_0x4aa196[_0x44ad('0x20')],![],this['channels'][_0x4aa196[_0x44ad('0x20')]][_0x44ad('0x53')]?_0x44ad('0x54')+this[_0x44ad('0x1f')][_0x4aa196[_0x44ad('0x20')]][_0x44ad('0x53')]:_0x44ad('0x55'));}}}};Fax[_0x44ad('0x24')][_0x44ad('0x56')]=function(_0x523945){var _0x22128b=this;return new BPromise(function(_0x5bdd32,_0x5d5569){_0x22128b[_0x44ad('0x57')](_0x523945,_0x22128b[_0x44ad('0xc')][_0x523945[_0x44ad('0x58')]])['then'](function(_0x43dbb1){ut[_0x44ad('0x48')]('[Fax][execOriginate][success]',_0x43dbb1);_0x5bdd32(ut[_0x44ad('0x36')](_0x44ad('0x59')));})[_0x44ad('0x3c')](function(_0x2d13a7){ut[_0x44ad('0x48')](_0x44ad('0x5a'),_0x2d13a7);updateStatus(_0x523945);_0x5d5569(ut[_0x44ad('0x36')](_0x44ad('0x5b')));});});};Fax[_0x44ad('0x24')]['checkAfterSend']=function(_0x4e14d7){var _0x30c2a5=this;return new BPromise(function(_0x1ba0a2,_0x241a1c){var _0x5ce020=_0x30c2a5['checkTrunk'](_0x30c2a5['faxAccounts'][_0x4e14d7[_0x44ad('0x58')]][_0x44ad('0x5c')],_0x4e14d7);if(_0x5ce020[_0x44ad('0x5d')]){_0x1ba0a2(ut[_0x44ad('0x36')](_0x44ad('0x5e')));}else{_0x241a1c(ut[_0x44ad('0x36')](_0x5ce020[_0x44ad('0x36')]));}});};function originate(_0x23db09,_0x47424c,_0x5f04c1){return new BPromise(function(_0x13d782,_0x35bc51){if(_0x5f04c1){var _0x2d64a9=util[_0x44ad('0x5f')](_0x44ad('0x60'),path['parse'](_0x23db09[_0x44ad('0x4')])[_0x44ad('0x22')],_0x23db09[_0x44ad('0x4')]);gs[_0x44ad('0x61')](_0x2d64a9)[_0x44ad('0x47')](function(){_0x23db09['path']=util[_0x44ad('0x5f')](_0x44ad('0x62'),path['parse'](_0x23db09[_0x44ad('0x4')])[_0x44ad('0x63')],path[_0x44ad('0x37')](_0x23db09[_0x44ad('0x4')])[_0x44ad('0x22')]);_0x47424c['XMF-PATH']=_0x23db09[_0x44ad('0x4')];ut[_0x44ad('0x48')]('Convert\x20pdf\x20to\x20tif','');ami[_0x44ad('0x64')](ut[_0x44ad('0x65')](_0x23db09,_0x47424c))[_0x44ad('0x47')](function(_0x445845){_0x13d782(_0x445845);})[_0x44ad('0x3c')](function(_0x46c709){_0x35bc51(_0x46c709);});})['catch'](function(_0x1cb428){_0x35bc51(_0x1cb428);});}else{ami[_0x44ad('0x64')](ut[_0x44ad('0x65')](_0x23db09,_0x47424c))['then'](function(_0x13b931){_0x13d782(_0x13b931);})[_0x44ad('0x3c')](function(_0x1b1433){_0x35bc51(_0x1b1433);});}});}Fax['prototype'][_0x44ad('0x57')]=function(_0x45e78a,_0x2130f8){var _0x564001=this;return new BPromise(function(_0x2d22c9,_0x273e4c){var _0x2cfb15=uuid['v4']();var _0x3442e9=ut['addVariables'](_0x45e78a,_0x2130f8);_0x564001[_0x44ad('0x41')][_0x2cfb15]=new Action(_0x2cfb15,_0x2130f8,_0x45e78a);var _0x3ea270=_0x564001[_0x44ad('0x41')][_0x2cfb15];if(path['parse'](_0x45e78a[_0x44ad('0x4')])[_0x44ad('0x66')]===_0x44ad('0x3b')){originate(_0x3ea270,_0x3442e9,!![])[_0x44ad('0x47')](function(_0x4be708){_0x2d22c9(_0x4be708);})[_0x44ad('0x3c')](function(_0x521c7d){_0x273e4c(_0x521c7d);});}else{originate(_0x3ea270,_0x3442e9,![])[_0x44ad('0x47')](function(_0x1f02b1){_0x2d22c9(_0x1f02b1);})[_0x44ad('0x3c')](function(_0x1649dd){_0x273e4c(_0x1649dd);});}});};Fax[_0x44ad('0x24')][_0x44ad('0x67')]=function(_0x4ac598){return!_[_0x44ad('0x68')](_0x4ac598)&&!_[_0x44ad('0x68')](_0x4ac598[_0x44ad('0x22')])&&!_[_0x44ad('0x68')](_0x4ac598[_0x44ad('0x69')])&&_0x4ac598['active']&&!_[_0x44ad('0x68')](this[_0x44ad('0xd')][util['format'](_0x44ad('0x6a'),_0x4ac598[_0x44ad('0x22')])])&&!_[_0x44ad('0x68')](this['trunks'][util[_0x44ad('0x5f')](_0x44ad('0x6a'),_0x4ac598['name'])]['status'])&&(this[_0x44ad('0xd')][util[_0x44ad('0x5f')]('SIP/%s',_0x4ac598[_0x44ad('0x22')])][_0x44ad('0x2c')]===_0x44ad('0x6b')||this[_0x44ad('0xd')][util[_0x44ad('0x5f')](_0x44ad('0x6a'),_0x4ac598[_0x44ad('0x22')])][_0x44ad('0x2c')]===_0x44ad('0x6c'));};Fax['prototype'][_0x44ad('0x6d')]=function(_0x1b69d0,_0x469077){if(!this[_0x44ad('0x67')](_0x1b69d0)){ut[_0x44ad('0x48')](_0x44ad('0x6e'),_[_0x44ad('0x68')](_0x1b69d0)?'':_0x1b69d0[_0x44ad('0x22')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}if(_[_0x44ad('0x68')](_0x469077['fax'])){ut[_0x44ad('0x48')](_0x44ad('0x6f'),JSON['stringify'](_0x469077));return{'isValid':![],'message':_0x44ad('0x70')};}if(_[_0x44ad('0x68')](_0x469077[_0x44ad('0x4')])){ut[_0x44ad('0x48')](_0x44ad('0x71'),JSON[_0x44ad('0x3f')](_0x469077));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0x44ad('0x72')};};module[_0x44ad('0x73')]=Fax; \ No newline at end of file +var _0x3504=['syncVarSet','variable','syncNewState','channelstate','channelstatedesc','value','operation','status','localstationid','filename','\x20syncFaxStatus\x20','resolution','transferrate','calleridnum','pagestransferred','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','application/pdf','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','pick','response','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][NoUpdate2]','then','[Fax][Message][NoUpdate1]','[Fax][Message][NoUpdate2]','syncHangup','\x20hangup\x20faxRiceive\x20','faxpages','updateStatus','SENDING\x20FAILED:\x20','faxstatusstring','SENDING\x20FAILED','send','execOriginate','FaxAccountId','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkTrunk','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','path','execute','%s/%s.tif','dir','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','.pdf','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','bluebird','uuid','moment','tiff2pdf','./util/gs','fax','../ami','./rpcDb','./channel','./action','../rpc/faxAccount','../rpc/faxMessage','channels','faxAccounts','trunks','newchannel','syncNewchannel','bind','varset','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','originateresponse','syncOriginateResponse','context','from-voip-provider','hasOwnProperty','exten','uniqueid','channel','name','info','\x20syncNewchannel\x20','actions','prototype'];(function(_0x3bb2f9,_0x5f06f5){var _0x4aceb2=function(_0x3bc488){while(--_0x3bc488){_0x3bb2f9['push'](_0x3bb2f9['shift']());}};_0x4aceb2(++_0x5f06f5);}(_0x3504,0x1b4));var _0x4350=function(_0x256cc1,_0x2e9adf){_0x256cc1=_0x256cc1-0x0;var _0x3f280e=_0x3504[_0x256cc1];return _0x3f280e;};'use strict';var util=require(_0x4350('0x0'));var _=require('lodash');var BPromise=require(_0x4350('0x1'));var uuid=require(_0x4350('0x2'));var moment=require(_0x4350('0x3'));var path=require('path');var tiff2pdf=require(_0x4350('0x4'));var gs=require(_0x4350('0x5'));var logger=require('../../../config/logger')(_0x4350('0x6'));var ami=require(_0x4350('0x7'));var rpcDb=require(_0x4350('0x8'));var Channel=require(_0x4350('0x9'));var ut=require('./util/util');var Action=require(_0x4350('0xa'));var faxAccount=require(_0x4350('0xb'));var attachment=require('../rpc/attachment');var faxMessage=require(_0x4350('0xc'));function Fax(_0x4d15d0){this[_0x4350('0xd')]={};this[_0x4350('0xe')]=_0x4d15d0[_0x4350('0xe')];this[_0x4350('0xf')]=_0x4d15d0[_0x4350('0xf')];this['actions']={};ami['on'](_0x4350('0x10'),this[_0x4350('0x11')][_0x4350('0x12')](this));ami['on'](_0x4350('0x13'),this['syncVarSet'][_0x4350('0x12')](this));ami['on']('newstate',this['syncNewState'][_0x4350('0x12')](this));ami['on'](_0x4350('0x14'),this[_0x4350('0x15')][_0x4350('0x12')](this));ami['on'](_0x4350('0x16'),this[_0x4350('0x17')][_0x4350('0x12')](this));ami['on'](_0x4350('0x18'),this[_0x4350('0x19')][_0x4350('0x12')](this));ami['on'](_0x4350('0x1a'),this['syncHangup'][_0x4350('0x12')](this));ami['on'](_0x4350('0x1b'),this[_0x4350('0x1c')]['bind'](this));}Fax['prototype'][_0x4350('0x11')]=function(_0x17acf7){if(_0x17acf7[_0x4350('0x1d')]===_0x4350('0x1e')){for(var _0x2ce155 in this[_0x4350('0xe')]){if(this[_0x4350('0xe')][_0x4350('0x1f')](_0x2ce155)){if(_0x17acf7[_0x4350('0x20')]===this[_0x4350('0xe')][_0x2ce155]['localstationid']){this[_0x4350('0xd')][_0x17acf7['uniqueid']]={};this[_0x4350('0xd')][_0x17acf7[_0x4350('0x21')]][_0x4350('0x22')]=_0x17acf7[_0x4350('0x22')];this[_0x4350('0xd')][_0x17acf7[_0x4350('0x21')]]['id']=this[_0x4350('0xe')][_0x2ce155]['id'];this[_0x4350('0xd')][_0x17acf7['uniqueid']][_0x4350('0x23')]=this[_0x4350('0xe')][_0x2ce155][_0x4350('0x23')];logger[_0x4350('0x24')](_0x17acf7['uniqueid'],_0x4350('0x25'));}}}}if(this[_0x4350('0x26')][_0x17acf7[_0x4350('0x21')]]){this[_0x4350('0xd')][_0x17acf7[_0x4350('0x21')]]={};this[_0x4350('0xd')][_0x17acf7[_0x4350('0x21')]]['channel']=_0x17acf7['channel'];logger[_0x4350('0x24')](_0x17acf7[_0x4350('0x21')],'\x20syncNewchannel\x20');}};Fax[_0x4350('0x27')][_0x4350('0x28')]=function(_0x5cb02b){if(this[_0x4350('0xd')][_0x5cb02b['uniqueid']]){for(var _0x18ba4e in _0x5cb02b[_0x4350('0x29')]){if(_0x5cb02b[_0x4350('0x29')][_0x4350('0x1f')](_0x18ba4e)){this[_0x4350('0xd')][_0x5cb02b['uniqueid']][_0x18ba4e]=_0x5cb02b['value'];}}}};Fax[_0x4350('0x27')][_0x4350('0x2a')]=function(_0x32862c){if(this[_0x4350('0xd')][_0x32862c[_0x4350('0x21')]]){this['channels'][_0x32862c[_0x4350('0x21')]][_0x4350('0x2b')]=_0x32862c[_0x4350('0x2b')];this[_0x4350('0xd')][_0x32862c[_0x4350('0x21')]]['channelstatedesc']=_0x32862c[_0x4350('0x2c')];}};Fax['prototype'][_0x4350('0x15')]=function(_0x42d6b0){if(this[_0x4350('0xd')][_0x42d6b0[_0x4350('0x21')]]){for(var _0x3c88ff in _0x42d6b0[_0x4350('0x29')]){if(_0x42d6b0[_0x4350('0x29')][_0x4350('0x1f')](_0x3c88ff)){this['channels'][_0x42d6b0[_0x4350('0x21')]][_0x3c88ff]=_0x42d6b0[_0x4350('0x2d')];}}}};Fax[_0x4350('0x27')]['syncFaxStatus']=function(_0x4f5108){if(this['channels'][_0x4f5108[_0x4350('0x21')]]){this[_0x4350('0xd')][_0x4f5108[_0x4350('0x21')]][_0x4350('0x2e')]=_0x4f5108[_0x4350('0x2e')];this[_0x4350('0xd')][_0x4f5108[_0x4350('0x21')]][_0x4350('0x2f')]=_0x4f5108['status'];this[_0x4350('0xd')][_0x4f5108[_0x4350('0x21')]][_0x4350('0x30')]=_0x4f5108['localstationid'];this[_0x4350('0xd')][_0x4f5108[_0x4350('0x21')]][_0x4350('0x31')]=_0x4f5108[_0x4350('0x31')];logger[_0x4350('0x24')](_0x4f5108[_0x4350('0x21')],_0x4350('0x32'));}};Fax[_0x4350('0x27')][_0x4350('0x19')]=function(_0x218bf2){var _0x375dc7=this;if(this['channels'][_0x218bf2[_0x4350('0x21')]]){var _0x200805=this[_0x4350('0xd')][_0x218bf2[_0x4350('0x21')]]['id'];this[_0x4350('0xd')][_0x218bf2[_0x4350('0x21')]]['remotestationid']=_0x218bf2['remotestationid'];this[_0x4350('0xd')][_0x218bf2[_0x4350('0x21')]]['pagestransferred']=_0x218bf2['pagestransferred'];this[_0x4350('0xd')][_0x218bf2[_0x4350('0x21')]][_0x4350('0x30')]=_0x218bf2[_0x4350('0x30')];this[_0x4350('0xd')][_0x218bf2[_0x4350('0x21')]][_0x4350('0x33')]=_0x218bf2['resolution'];this['channels'][_0x218bf2[_0x4350('0x21')]][_0x4350('0x34')]=_0x218bf2[_0x4350('0x34')];this[_0x4350('0xd')][_0x218bf2[_0x4350('0x21')]][_0x4350('0x31')]=_0x218bf2[_0x4350('0x31')];this['channels'][_0x218bf2['uniqueid']]['calleridnum']=_0x218bf2[_0x4350('0x35')];if(this[_0x4350('0xd')][_0x218bf2[_0x4350('0x21')]][_0x4350('0x36')]>0x0){tiff2pdf(_0x218bf2[_0x4350('0x31')],_0x4350('0x37'),function(_0x27d55f){logger[_0x4350('0x24')](_0x218bf2[_0x4350('0x21')],_0x4350('0x38'),_0x27d55f[_0x4350('0x39')]);attachment[_0x4350('0x3a')]({'name':path['parse'](_0x218bf2[_0x4350('0x31')])['name'],'basename':path[_0x4350('0x3b')](_0x218bf2[_0x4350('0x31')])[_0x4350('0x23')]+'.pdf','type':_0x4350('0x3c')})['then'](function(_0x1f227e){faxAccount['notify'](_0x200805,{'from':_0x218bf2[_0x4350('0x35')],'mapKey':_0x4350('0x6'),'body':path[_0x4350('0x3b')](_0x218bf2[_0x4350('0x31')])[_0x4350('0x23')]+'.pdf','AttachmentId':_0x1f227e['id']})[_0x4350('0x3d')](function(_0x3b0eb9){logger[_0x4350('0x3e')](_0x218bf2[_0x4350('0x21')],_0x4350('0x3f'),JSON[_0x4350('0x40')](_0x3b0eb9));});})[_0x4350('0x3d')](function(_0x321ec2){logger['error'](_0x218bf2[_0x4350('0x21')],_0x4350('0x41'),JSON[_0x4350('0x40')](_0x321ec2));});});}logger[_0x4350('0x24')](_0x218bf2[_0x4350('0x21')],_0x4350('0x41'));}};Fax['prototype']['syncOriginateResponse']=function(_0xab774b){if(this[_0x4350('0x26')][_0xab774b[_0x4350('0x21')]]){_['merge'](this[_0x4350('0xd')][_0xab774b['uniqueid']],_[_0x4350('0x42')](_0xab774b,[_0x4350('0x43'),'reason']));}};function updateStatus(_0x408125){if(_0x408125[_0x4350('0x44')]){faxMessage[_0x4350('0x45')](_0x408125[_0x4350('0x44')],{'failMessage':_0x4350('0x46')})['then'](function(_0x192217){ut['logger']('[Fax][Message][Error][Updated]',_0x192217);})[_0x4350('0x3d')](function(_0x47181a){ut[_0x4350('0x47')]('[Fax][Message][Error][NoUpdate1]',_0x47181a);});}else{ut[_0x4350('0x47')](_0x4350('0x48'));}}Fax[_0x4350('0x27')]['updateStatus']=function(_0x2580f5,_0x37c33f,_0x228351){var _0x490274=this;var _0xa9c9cf={};if(_0x37c33f){_0xa9c9cf={'read':_0x37c33f};}else{_0xa9c9cf={'failMessage':_0x228351};}if(this['actions'][_0x2580f5][_0x4350('0x44')]){faxMessage[_0x4350('0x45')](this[_0x4350('0x26')][_0x2580f5]['AttachmentId'],_0xa9c9cf)[_0x4350('0x49')](function(_0x37e71e){ut[_0x4350('0x47')]('[Fax][Message][Updated]',_0x37e71e);})[_0x4350('0x3d')](function(_0x3de882){ut[_0x4350('0x47')](_0x4350('0x4a'),_0x3de882);})['finally'](function(){delete _0x490274['channels'][_0x2580f5];delete _0x490274[_0x4350('0x26')][_0x2580f5];});}else{ut[_0x4350('0x47')](_0x4350('0x4b'));delete this[_0x4350('0xd')][_0x2580f5];delete this[_0x4350('0x26')][_0x2580f5];}};Fax[_0x4350('0x27')][_0x4350('0x4c')]=function(_0x5e6d1d){var _0x12a45c=this;if(this[_0x4350('0xd')][_0x5e6d1d[_0x4350('0x21')]]){if(this[_0x4350('0x26')][_0x5e6d1d[_0x4350('0x21')]]){this[_0x4350('0xd')][_0x5e6d1d['uniqueid']]['id']=this[_0x4350('0x26')][_0x5e6d1d[_0x4350('0x21')]]['id'];this[_0x4350('0xd')][_0x5e6d1d[_0x4350('0x21')]]['name']=this[_0x4350('0x26')][_0x5e6d1d[_0x4350('0x21')]]['name'];}logger[_0x4350('0x24')](_0x5e6d1d[_0x4350('0x21')],this['actions'][_0x5e6d1d[_0x4350('0x21')]]?'\x20hangup\x20sendFile\x20':_0x4350('0x4d'),JSON[_0x4350('0x40')](this[_0x4350('0xd')][_0x5e6d1d[_0x4350('0x21')]]));if(this[_0x4350('0x26')][_0x5e6d1d[_0x4350('0x21')]]){if(this[_0x4350('0xd')][_0x5e6d1d[_0x4350('0x21')]][_0x4350('0x4e')]>0x0&&this[_0x4350('0xd')][_0x5e6d1d[_0x4350('0x21')]][_0x4350('0x16')]==='SUCCESS'){this[_0x4350('0x4f')](_0x5e6d1d[_0x4350('0x21')],!![]);}else{this[_0x4350('0x4f')](_0x5e6d1d[_0x4350('0x21')],![],this[_0x4350('0xd')][_0x5e6d1d['uniqueid']]['faxstatusstring']?_0x4350('0x50')+this['channels'][_0x5e6d1d[_0x4350('0x21')]][_0x4350('0x51')]:_0x4350('0x52'));}}}};Fax[_0x4350('0x27')][_0x4350('0x53')]=function(_0x2b93ad){var _0x4647e3=this;return new BPromise(function(_0x2d0f5b,_0x18227b){_0x4647e3[_0x4350('0x54')](_0x2b93ad,_0x4647e3[_0x4350('0xe')][_0x2b93ad[_0x4350('0x55')]])[_0x4350('0x49')](function(_0x3bd9e0){ut[_0x4350('0x47')]('[Fax][execOriginate][success]',_0x3bd9e0);_0x2d0f5b(ut[_0x4350('0x39')](_0x4350('0x56')));})[_0x4350('0x3d')](function(_0x27206b){ut[_0x4350('0x47')](_0x4350('0x57'),_0x27206b);updateStatus(_0x2b93ad);_0x18227b(ut[_0x4350('0x39')](_0x4350('0x58')));});});};Fax[_0x4350('0x27')]['checkAfterSend']=function(_0x30c331){var _0x17c640=this;return new BPromise(function(_0x35fb27,_0xc195ff){var _0x387d2d=_0x17c640[_0x4350('0x59')](_0x17c640[_0x4350('0xe')][_0x30c331[_0x4350('0x55')]][_0x4350('0x5a')],_0x30c331);if(_0x387d2d[_0x4350('0x5b')]){_0x35fb27(ut[_0x4350('0x39')](_0x4350('0x5c')));}else{_0xc195ff(ut['message'](_0x387d2d[_0x4350('0x39')]));}});};function originate(_0x44d2a6,_0x183bc5,_0x56a8f2){return new BPromise(function(_0x898388,_0x4feccb){if(_0x56a8f2){var _0x136b89=util[_0x4350('0x5d')](_0x4350('0x5e'),path[_0x4350('0x3b')](_0x44d2a6[_0x4350('0x5f')])[_0x4350('0x23')],_0x44d2a6['path']);gs[_0x4350('0x60')](_0x136b89)[_0x4350('0x49')](function(){_0x44d2a6[_0x4350('0x5f')]=util[_0x4350('0x5d')](_0x4350('0x61'),path[_0x4350('0x3b')](_0x44d2a6[_0x4350('0x5f')])[_0x4350('0x62')],path['parse'](_0x44d2a6['path'])['name']);_0x183bc5['XMF-PATH']=_0x44d2a6[_0x4350('0x5f')];ut[_0x4350('0x47')](_0x4350('0x63'),'');ami[_0x4350('0x64')](ut[_0x4350('0x65')](_0x44d2a6,_0x183bc5))[_0x4350('0x49')](function(_0x24ec63){_0x898388(_0x24ec63);})[_0x4350('0x3d')](function(_0x45aa23){_0x4feccb(_0x45aa23);});})[_0x4350('0x3d')](function(_0x7f50ea){_0x4feccb(_0x7f50ea);});}else{ami[_0x4350('0x64')](ut['variablesAction'](_0x44d2a6,_0x183bc5))['then'](function(_0xdefb94){_0x898388(_0xdefb94);})[_0x4350('0x3d')](function(_0x3f8012){_0x4feccb(_0x3f8012);});}});}Fax[_0x4350('0x27')]['execOriginate']=function(_0x547fb6,_0x26db90){var _0x49b0fe=this;return new BPromise(function(_0x2f42fc,_0x5f322a){var _0x151b56=uuid['v4']();var _0xc64221=ut[_0x4350('0x66')](_0x547fb6,_0x26db90);_0x49b0fe['actions'][_0x151b56]=new Action(_0x151b56,_0x26db90,_0x547fb6);var _0x15c531=_0x49b0fe[_0x4350('0x26')][_0x151b56];if(path['parse'](_0x547fb6[_0x4350('0x5f')])[_0x4350('0x67')]===_0x4350('0x68')){originate(_0x15c531,_0xc64221,!![])[_0x4350('0x49')](function(_0x222c25){_0x2f42fc(_0x222c25);})[_0x4350('0x3d')](function(_0x132650){_0x5f322a(_0x132650);});}else{originate(_0x15c531,_0xc64221,![])[_0x4350('0x49')](function(_0xc1255c){_0x2f42fc(_0xc1255c);})['catch'](function(_0x2a0611){_0x5f322a(_0x2a0611);});}});};Fax[_0x4350('0x27')][_0x4350('0x69')]=function(_0x35877c){return!_[_0x4350('0x6a')](_0x35877c)&&!_['isNil'](_0x35877c[_0x4350('0x23')])&&!_[_0x4350('0x6a')](_0x35877c[_0x4350('0x6b')])&&_0x35877c[_0x4350('0x6b')]&&!_[_0x4350('0x6a')](this[_0x4350('0xf')][util[_0x4350('0x5d')](_0x4350('0x6c'),_0x35877c['name'])])&&!_[_0x4350('0x6a')](this[_0x4350('0xf')][util[_0x4350('0x5d')](_0x4350('0x6c'),_0x35877c[_0x4350('0x23')])][_0x4350('0x2f')])&&(this[_0x4350('0xf')][util['format'](_0x4350('0x6c'),_0x35877c[_0x4350('0x23')])]['status']===_0x4350('0x6d')||this[_0x4350('0xf')][util['format'](_0x4350('0x6c'),_0x35877c[_0x4350('0x23')])]['status']===_0x4350('0x6e'));};Fax[_0x4350('0x27')][_0x4350('0x59')]=function(_0x2ded32,_0x325f39){if(!this[_0x4350('0x69')](_0x2ded32)){ut[_0x4350('0x47')](_0x4350('0x6f'),_[_0x4350('0x6a')](_0x2ded32)?'':_0x2ded32[_0x4350('0x23')]+_0x4350('0x70'));return{'isValid':![],'message':_0x4350('0x71')};}if(_[_0x4350('0x6a')](_0x325f39['fax'])){ut[_0x4350('0x47')](_0x4350('0x72'),JSON[_0x4350('0x40')](_0x325f39));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0x4350('0x6a')](_0x325f39[_0x4350('0x5f')])){ut[_0x4350('0x47')](_0x4350('0x73'),JSON['stringify'](_0x325f39));return{'isValid':![],'message':_0x4350('0x74')};}return{'isValid':!![],'message':_0x4350('0x75')};};module[_0x4350('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 38f438c..3c0ca43 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 _0xc787=['resolve','then','catch','util','bluebird','../../../config/logger','preview','lodash','../rpc/faxAccount','error','inspect','notify'];(function(_0x451015,_0x330bba){var _0x36e656=function(_0x5935de){while(--_0x5935de){_0x451015['push'](_0x451015['shift']());}};_0x36e656(++_0x330bba);}(_0xc787,0x1cb));var _0x7c78=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0xc787[_0x5d4607];return _0x5e4a86;};'use strict';var util=require(_0x7c78('0x0'));var BPromise=require(_0x7c78('0x1'));var logger=require(_0x7c78('0x2'))(_0x7c78('0x3'));var _=require(_0x7c78('0x4'));var faxAccount=require(_0x7c78('0x5'));function loggerCatch(_0x4f50e2){return function(_0x4e170a){logger[_0x7c78('0x6')](_0x4f50e2,util[_0x7c78('0x7')](_0x4e170a,{'showHidden':![],'depth':null}));};}exports[_0x7c78('0x8')]=function(_0x5ddf02,_0x7b6ac){return BPromise[_0x7c78('0x9')]()[_0x7c78('0xa')](faxAccount[_0x7c78('0x8')](_0x5ddf02,_0x7b6ac))[_0x7c78('0xb')](loggerCatch('[Notify]\x20'));}; \ No newline at end of file +var _0xa72a=['preview','lodash','../rpc/faxAccount','error','notify','resolve','then','catch','[Notify]\x20','util','bluebird'];(function(_0x3cec15,_0x121af4){var _0x239080=function(_0x52c61b){while(--_0x52c61b){_0x3cec15['push'](_0x3cec15['shift']());}};_0x239080(++_0x121af4);}(_0xa72a,0x77));var _0xaa72=function(_0x1f87a3,_0x3799c5){_0x1f87a3=_0x1f87a3-0x0;var _0x17ebae=_0xa72a[_0x1f87a3];return _0x17ebae;};'use strict';var util=require(_0xaa72('0x0'));var BPromise=require(_0xaa72('0x1'));var logger=require('../../../config/logger')(_0xaa72('0x2'));var _=require(_0xaa72('0x3'));var faxAccount=require(_0xaa72('0x4'));function loggerCatch(_0x219623){return function(_0x3da8c6){logger[_0xaa72('0x5')](_0x219623,util['inspect'](_0x3da8c6,{'showHidden':![],'depth':null}));};}exports[_0xaa72('0x6')]=function(_0x7712cb,_0x1f1277){return BPromise[_0xaa72('0x7')]()[_0xaa72('0x8')](faxAccount[_0xaa72('0x6')](_0x7712cb,_0x1f1277))[_0xaa72('0x9')](loggerCatch(_0xaa72('0xa')));}; \ 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 f6344a9..c00a069 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 _0x33a5=['util','../../../../config/logger','fax','bluebird','child_process','exec','info','Exec\x20gs','\x20Error\x20:'];(function(_0x54975a,_0x5713fa){var _0xb43347=function(_0x708ac8){while(--_0x708ac8){_0x54975a['push'](_0x54975a['shift']());}};_0xb43347(++_0x5713fa);}(_0x33a5,0x1c2));var _0x533a=function(_0x267e68,_0x2ca075){_0x267e68=_0x267e68-0x0;var _0x22b44e=_0x33a5[_0x267e68];return _0x22b44e;};'use strict';var util=require(_0x533a('0x0'));var logger=require(_0x533a('0x1'))(_0x533a('0x2'));var BPromise=require(_0x533a('0x3'));var exec=require(_0x533a('0x4'))[_0x533a('0x5')];exports['execute']=function(_0x4f9e7b){return new BPromise(function(_0x69fc6e,_0x444845){exec(_0x4f9e7b,function(_0x4093b5,_0x574356,_0x2e30c8){logger[_0x533a('0x6')](_0x533a('0x7'),_0x574356);if(_0x4093b5){logger['info'](_0x533a('0x7'),_0x533a('0x8'),util['inspect'](_0x4093b5,{'showHidden':![],'depth':null}),_0x574356,_0x2e30c8);_0x444845(_0x4093b5);}_0x69fc6e(_0x574356);});});}; \ No newline at end of file +var _0x4eda=['inspect','util','../../../../config/logger','fax','bluebird','child_process','exec','execute','info','Exec\x20gs','\x20Error\x20:'];(function(_0x2983ec,_0x5285e0){var _0xf1bcab=function(_0x3e3147){while(--_0x3e3147){_0x2983ec['push'](_0x2983ec['shift']());}};_0xf1bcab(++_0x5285e0);}(_0x4eda,0x1f0));var _0xa4ed=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4eda[_0x20a584];return _0x4b41a8;};'use strict';var util=require(_0xa4ed('0x0'));var logger=require(_0xa4ed('0x1'))(_0xa4ed('0x2'));var BPromise=require(_0xa4ed('0x3'));var exec=require(_0xa4ed('0x4'))[_0xa4ed('0x5')];exports[_0xa4ed('0x6')]=function(_0x5dda08){return new BPromise(function(_0x223839,_0x532185){exec(_0x5dda08,function(_0x3a48ac,_0x5d65bc,_0x4f0135){logger[_0xa4ed('0x7')](_0xa4ed('0x8'),_0x5d65bc);if(_0x3a48ac){logger['info']('Exec\x20gs',_0xa4ed('0x9'),util[_0xa4ed('0xa')](_0x3a48ac,{'showHidden':![],'depth':null}),_0x5d65bc,_0x4f0135);_0x532185(_0x3a48ac);}_0x223839(_0x5d65bc);});});}; \ 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 bf9eebd..9d1b107 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 _0x7daf=['t38timeout','localstationid','path','variablesAction','uniqueid','originate','channel','xcally-motion-fax','from-sip','lodash','../../../../config/logger','fax','logger','info','addVariables','ecm','headerinfo','maxrate','format','\x22%s\x22','modem','gateway','faxdetect'];(function(_0x579668,_0x54d375){var _0x129754=function(_0x32aac1){while(--_0x32aac1){_0x579668['push'](_0x579668['shift']());}};_0x129754(++_0x54d375);}(_0x7daf,0xaa));var _0xf7da=function(_0x2189a5,_0x5abd42){_0x2189a5=_0x2189a5-0x0;var _0x418db7=_0x7daf[_0x2189a5];return _0x418db7;};'use strict';var util=require('util');var _=require(_0xf7da('0x0'));var moment=require('moment');var logger=require(_0xf7da('0x1'))(_0xf7da('0x2'));exports['message']=function(_0x26d541){return{'message':_0x26d541};};exports[_0xf7da('0x3')]=function(_0x41f84d,_0x282d6b){logger[_0xf7da('0x4')](_0x41f84d,util['inspect'](_0x282d6b,{'showHidden':![],'depth':null}));};exports[_0xf7da('0x5')]=function(_0x36a1d8,_0x1b35ec){var _0x110cad={'XMF-ECM':_0x1b35ec[_0xf7da('0x6')],'XMF-HEADERINFO':_0x1b35ec[_0xf7da('0x7')],'XMF-MINRATE':_0x1b35ec['minrate'],'XMF-MAXRATE':_0x1b35ec[_0xf7da('0x8')],'XMF-MODEM':util[_0xf7da('0x9')](_0xf7da('0xa'),_0x1b35ec[_0xf7da('0xb')]),'XMF-GATEWAY':_0x1b35ec[_0xf7da('0xc')],'XMF-FAXDETECT':_0x1b35ec[_0xf7da('0xd')],'XMF-T38TIMEOUT':_0x1b35ec[_0xf7da('0xe')],'XMF-LOCALSTATIONID':_0x1b35ec[_0xf7da('0xf')],'XMF-PATH':_0x36a1d8[_0xf7da('0x10')]};return _0x110cad;};exports[_0xf7da('0x11')]=function(_0x514c1e,_0x5821bf){return{'actionid':_0x514c1e[_0xf7da('0x12')],'action':_0xf7da('0x13'),'channel':_0x514c1e[_0xf7da('0x14')],'Exten':_0xf7da('0x15'),'Context':_0xf7da('0x16'),'Priority':'1','callerid':util[_0xf7da('0x9')]('\x22%s\x22\x20<%s>',_0x514c1e[_0xf7da('0x7')]?_0x514c1e[_0xf7da('0x7')]:'',_0x514c1e['localstationid']),'variable':_0x5821bf,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x514c1e[_0xf7da('0x12')]};}; \ No newline at end of file +var _0x8b5d=['faxdetect','t38timeout','localstationid','variablesAction','uniqueid','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','lodash','moment','../../../../config/logger','fax','message','logger','inspect','headerinfo','minrate','maxrate','format','\x22%s\x22','modem','gateway'];(function(_0x1f3520,_0x1131c2){var _0x13b410=function(_0x6e3f){while(--_0x6e3f){_0x1f3520['push'](_0x1f3520['shift']());}};_0x13b410(++_0x1131c2);}(_0x8b5d,0x65));var _0xd8b5=function(_0x438434,_0x36f21f){_0x438434=_0x438434-0x0;var _0x3b97c9=_0x8b5d[_0x438434];return _0x3b97c9;};'use strict';var util=require('util');var _=require(_0xd8b5('0x0'));var moment=require(_0xd8b5('0x1'));var logger=require(_0xd8b5('0x2'))(_0xd8b5('0x3'));exports[_0xd8b5('0x4')]=function(_0x28943e){return{'message':_0x28943e};};exports[_0xd8b5('0x5')]=function(_0xdea986,_0x440926){logger['info'](_0xdea986,util[_0xd8b5('0x6')](_0x440926,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x4ae6cd,_0x3fabca){var _0x11f220={'XMF-ECM':_0x3fabca['ecm'],'XMF-HEADERINFO':_0x3fabca[_0xd8b5('0x7')],'XMF-MINRATE':_0x3fabca[_0xd8b5('0x8')],'XMF-MAXRATE':_0x3fabca[_0xd8b5('0x9')],'XMF-MODEM':util[_0xd8b5('0xa')](_0xd8b5('0xb'),_0x3fabca[_0xd8b5('0xc')]),'XMF-GATEWAY':_0x3fabca[_0xd8b5('0xd')],'XMF-FAXDETECT':_0x3fabca[_0xd8b5('0xe')],'XMF-T38TIMEOUT':_0x3fabca[_0xd8b5('0xf')],'XMF-LOCALSTATIONID':_0x3fabca[_0xd8b5('0x10')],'XMF-PATH':_0x4ae6cd['path']};return _0x11f220;};exports[_0xd8b5('0x11')]=function(_0x49c60b,_0xc7c813){return{'actionid':_0x49c60b[_0xd8b5('0x12')],'action':'originate','channel':_0x49c60b[_0xd8b5('0x13')],'Exten':_0xd8b5('0x14'),'Context':_0xd8b5('0x15'),'Priority':'1','callerid':util[_0xd8b5('0xa')](_0xd8b5('0x16'),_0x49c60b[_0xd8b5('0x7')]?_0x49c60b[_0xd8b5('0x7')]:'',_0x49c60b['localstationid']),'variable':_0xc7c813,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x49c60b[_0xd8b5('0x12')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 692bf08..a259e7c 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 _0x4e83=['getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','[index.js][initParams]','inspect','listen','sync','[index.js][main]','util','moment','./server','./report','./trigger','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/template','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','ami','hour','get','resolve','then','getAgents','getTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','initTriggers','getTemplates','getZendeskAccounts','initZendeskAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','getDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts'];(function(_0x5cd78a,_0x41d0f0){var _0x262508=function(_0x48b519){while(--_0x48b519){_0x5cd78a['push'](_0x5cd78a['shift']());}};_0x262508(++_0x41d0f0);}(_0x4e83,0xf3));var _0x34e8=function(_0x1877f6,_0x36065d){_0x1877f6=_0x1877f6-0x0;var _0xc063c5=_0x4e83[_0x1877f6];return _0xc063c5;};'use strict';var util=require(_0x34e8('0x0'));var moment=require(_0x34e8('0x1'));var server=require(_0x34e8('0x2'));var Realtime=require('./realtime');var Report=require(_0x34e8('0x3'));var Acw=require('./acw');var Trigger=require(_0x34e8('0x4'));var Dialer=require('./dialer');var Preview=require(_0x34e8('0x5'));var Fax=require(_0x34e8('0x6'));var user=require(_0x34e8('0x7'));var voiceQueue=require(_0x34e8('0x8'));var voiceQueueReport=require(_0x34e8('0x9'));var voiceCallReport=require(_0x34e8('0xa'));var trunk=require(_0x34e8('0xb'));var trigger=require('./rpc/trigger');var template=require(_0x34e8('0xc'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0x34e8('0xd'));var voiceExtension=require(_0x34e8('0xe'));var faxAccount=require(_0x34e8('0xf'));var zendesk=require(_0x34e8('0x10'));var salesforce=require(_0x34e8('0x11'));var sugarcrm=require(_0x34e8('0x12'));var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0x34e8('0x13'));var zoho=require(_0x34e8('0x14'));var vtiger=require(_0x34e8('0x15'));var freshsales=require(_0x34e8('0x16'));var servicenow=require(_0x34e8('0x17'));var dynamics365=require(_0x34e8('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(_0x34e8('0x19'))(_0x34e8('0x1a'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0x34e8('0x1b'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x34e8('0x1c')]('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x34e8('0x1d')]()[_0x34e8('0x1e')](user[_0x34e8('0x1f')]())[_0x34e8('0x1e')](realtime['initAgents']())[_0x34e8('0x1e')](user[_0x34e8('0x20')]())['then'](realtime['initTelephones']())[_0x34e8('0x1e')](trunk[_0x34e8('0x21')]())['then'](realtime[_0x34e8('0x22')]())['then'](voiceQueue[_0x34e8('0x23')]())[_0x34e8('0x1e')](realtime[_0x34e8('0x24')]())['then'](trigger['getTriggers']())[_0x34e8('0x1e')](realtime[_0x34e8('0x25')]())[_0x34e8('0x1e')](template[_0x34e8('0x26')]())[_0x34e8('0x1e')](realtime['initTemplates']())[_0x34e8('0x1e')](zendesk[_0x34e8('0x27')]())[_0x34e8('0x1e')](realtime[_0x34e8('0x28')]())[_0x34e8('0x1e')](salesforce['getSalesforceAccounts']())[_0x34e8('0x1e')](realtime[_0x34e8('0x29')]())['then'](sugarcrm[_0x34e8('0x2a')]())[_0x34e8('0x1e')](realtime[_0x34e8('0x2b')]())[_0x34e8('0x1e')](freshdesk[_0x34e8('0x2c')]())[_0x34e8('0x1e')](realtime['initFreshdeskAccounts']())[_0x34e8('0x1e')](desk[_0x34e8('0x2d')]())[_0x34e8('0x1e')](realtime['initDeskAccounts']())['then'](zoho[_0x34e8('0x2e')]())[_0x34e8('0x1e')](realtime[_0x34e8('0x2f')]())['then'](vtiger[_0x34e8('0x30')]())['then'](realtime[_0x34e8('0x31')]())[_0x34e8('0x1e')](freshsales[_0x34e8('0x32')]())[_0x34e8('0x1e')](realtime[_0x34e8('0x33')]())[_0x34e8('0x1e')](servicenow[_0x34e8('0x34')]())[_0x34e8('0x1e')](realtime['initServicenowAccounts']())['then'](dynamics365[_0x34e8('0x35')]())[_0x34e8('0x1e')](realtime[_0x34e8('0x36')]())[_0x34e8('0x1e')](campaign[_0x34e8('0x37')]())['then'](realtime[_0x34e8('0x38')]())['then'](voiceExtension[_0x34e8('0x39')]())[_0x34e8('0x1e')](realtime['initVoiceExtensions']())[_0x34e8('0x1e')](faxAccount[_0x34e8('0x3a')]())[_0x34e8('0x1e')](realtime[_0x34e8('0x3b')]())[_0x34e8('0x1e')](function(){return realtime;});}function initParams(){return Promise[_0x34e8('0x1d')]()[_0x34e8('0x1e')](voiceQueueReport[_0x34e8('0x3c')]())[_0x34e8('0x1e')](realtime[_0x34e8('0x3d')]())[_0x34e8('0x1e')](cmHopperHistory[_0x34e8('0x3e')]())[_0x34e8('0x1e')](realtime['initVoiceQueueHopperHistory']())[_0x34e8('0x1e')](cmHopperHistory[_0x34e8('0x3f')]())[_0x34e8('0x1e')](realtime[_0x34e8('0x40')]())[_0x34e8('0x1e')](voiceCallReport[_0x34e8('0x41')]())['then'](realtime[_0x34e8('0x42')]())[_0x34e8('0x43')](function(_0x116f7d){logger[_0x34e8('0x44')](_0x34e8('0x45'),util[_0x34e8('0x46')](_0x116f7d,{'showHidden':![],'depth':null}));});}function main(){return server[_0x34e8('0x47')](realtime,preview,fax)[_0x34e8('0x1e')](function(){return initRealtime();})[_0x34e8('0x1e')](function(){return initParams();})[_0x34e8('0x1e')](function(){report[_0x34e8('0x48')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x2d87d7){logger['error'](_0x34e8('0x49'),util[_0x34e8('0x46')](_0x2d87d7,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0xd4ed=['initDeskAccounts','getZohoAccounts','initVtigerAccounts','getFreshsalesAccounts','getDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','initFaxAccounts','getVoiceQueueReports','getVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','initVoiceCallReports','catch','error','[index.js][initParams]','inspect','listen','sync','[index.js][main]','util','moment','./server','./realtime','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/trunk','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','ami','get','resolve','then','initAgents','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts'];(function(_0x19b709,_0x373b44){var _0x29eb28=function(_0x4a66c4){while(--_0x4a66c4){_0x19b709['push'](_0x19b709['shift']());}};_0x29eb28(++_0x373b44);}(_0xd4ed,0xe8));var _0xdd4e=function(_0x39dac2,_0x13589f){_0x39dac2=_0x39dac2-0x0;var _0x4fffcf=_0xd4ed[_0x39dac2];return _0x4fffcf;};'use strict';var util=require(_0xdd4e('0x0'));var moment=require(_0xdd4e('0x1'));var server=require(_0xdd4e('0x2'));var Realtime=require(_0xdd4e('0x3'));var Report=require(_0xdd4e('0x4'));var Acw=require(_0xdd4e('0x5'));var Trigger=require(_0xdd4e('0x6'));var Dialer=require(_0xdd4e('0x7'));var Preview=require(_0xdd4e('0x8'));var Fax=require(_0xdd4e('0x9'));var user=require(_0xdd4e('0xa'));var voiceQueue=require(_0xdd4e('0xb'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0xdd4e('0xc'));var trigger=require('./rpc/trigger');var template=require(_0xdd4e('0xd'));var cmHopperHistory=require(_0xdd4e('0xe'));var campaign=require(_0xdd4e('0xf'));var voiceExtension=require(_0xdd4e('0x10'));var faxAccount=require(_0xdd4e('0x11'));var zendesk=require(_0xdd4e('0x12'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0xdd4e('0x13'));var freshdesk=require(_0xdd4e('0x14'));var desk=require(_0xdd4e('0x15'));var zoho=require(_0xdd4e('0x16'));var vtiger=require(_0xdd4e('0x17'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0xdd4e('0x18'));var dynamics365=require(_0xdd4e('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(_0xdd4e('0x1a'))(_0xdd4e('0x1b'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xdd4e('0x1c')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get']('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0xdd4e('0x1d')]()[_0xdd4e('0x1e')](user['getAgents']())[_0xdd4e('0x1e')](realtime[_0xdd4e('0x1f')]())['then'](user['getTelephones']())[_0xdd4e('0x1e')](realtime[_0xdd4e('0x20')]())[_0xdd4e('0x1e')](trunk[_0xdd4e('0x21')]())[_0xdd4e('0x1e')](realtime[_0xdd4e('0x22')]())[_0xdd4e('0x1e')](voiceQueue[_0xdd4e('0x23')]())[_0xdd4e('0x1e')](realtime[_0xdd4e('0x24')]())[_0xdd4e('0x1e')](trigger[_0xdd4e('0x25')]())['then'](realtime[_0xdd4e('0x26')]())[_0xdd4e('0x1e')](template[_0xdd4e('0x27')]())[_0xdd4e('0x1e')](realtime[_0xdd4e('0x28')]())[_0xdd4e('0x1e')](zendesk[_0xdd4e('0x29')]())[_0xdd4e('0x1e')](realtime[_0xdd4e('0x2a')]())['then'](salesforce['getSalesforceAccounts']())[_0xdd4e('0x1e')](realtime['initSalesforceAccounts']())[_0xdd4e('0x1e')](sugarcrm[_0xdd4e('0x2b')]())[_0xdd4e('0x1e')](realtime[_0xdd4e('0x2c')]())[_0xdd4e('0x1e')](freshdesk[_0xdd4e('0x2d')]())[_0xdd4e('0x1e')](realtime[_0xdd4e('0x2e')]())[_0xdd4e('0x1e')](desk[_0xdd4e('0x2f')]())[_0xdd4e('0x1e')](realtime[_0xdd4e('0x30')]())[_0xdd4e('0x1e')](zoho[_0xdd4e('0x31')]())[_0xdd4e('0x1e')](realtime['initZohoAccounts']())[_0xdd4e('0x1e')](vtiger['getVtigerAccounts']())[_0xdd4e('0x1e')](realtime[_0xdd4e('0x32')]())[_0xdd4e('0x1e')](freshsales[_0xdd4e('0x33')]())[_0xdd4e('0x1e')](realtime['initFreshsalesAccounts']())[_0xdd4e('0x1e')](servicenow['getServicenowAccounts']())[_0xdd4e('0x1e')](realtime['initServicenowAccounts']())[_0xdd4e('0x1e')](dynamics365[_0xdd4e('0x34')]())['then'](realtime['initDynamics365Accounts']())['then'](campaign[_0xdd4e('0x35')]())[_0xdd4e('0x1e')](realtime[_0xdd4e('0x36')]())['then'](voiceExtension[_0xdd4e('0x37')]())[_0xdd4e('0x1e')](realtime[_0xdd4e('0x38')]())[_0xdd4e('0x1e')](faxAccount['getFaxAccounts']())['then'](realtime[_0xdd4e('0x39')]())[_0xdd4e('0x1e')](function(){return realtime;});}function initParams(){return Promise['resolve']()['then'](voiceQueueReport[_0xdd4e('0x3a')]())['then'](realtime['initVoiceQueueReports']())[_0xdd4e('0x1e')](cmHopperHistory[_0xdd4e('0x3b')]())[_0xdd4e('0x1e')](realtime['initVoiceQueueHopperHistory']())[_0xdd4e('0x1e')](cmHopperHistory[_0xdd4e('0x3c')]())['then'](realtime[_0xdd4e('0x3d')]())[_0xdd4e('0x1e')](voiceCallReport['getVoiceCallReports']())[_0xdd4e('0x1e')](realtime[_0xdd4e('0x3e')]())[_0xdd4e('0x3f')](function(_0x4a120e){logger[_0xdd4e('0x40')](_0xdd4e('0x41'),util[_0xdd4e('0x42')](_0x4a120e,{'showHidden':![],'depth':null}));});}function main(){return server[_0xdd4e('0x43')](realtime,preview,fax)[_0xdd4e('0x1e')](function(){return initRealtime();})['then'](function(){return initParams();})[_0xdd4e('0x1e')](function(){report[_0xdd4e('0x44')]();setInterval(initRealtime,0x1388);})[_0xdd4e('0x3f')](function(_0x1c96eb){logger[_0xdd4e('0x40')](_0xdd4e('0x45'),util[_0xdd4e('0x42')](_0x1c96eb,{'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 ce1c150..23c8d3c 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 _0x248f=['voiceStatusCallerIdNumber','onhold','local','prototype','updateStatusRealtime','not_inuse','idle','inuse','talking','statePause','voiceStatusQueue','stringify','md5','format','user:%s','emit','user:presence','exports','lodash','util','moment','ioredis','../../../config/environment','redis','defaults','localhost','name','email','accountcode','fullname','state','unknown','stateTime','status','address','phone','mobile','interface','online','voiceStatus','voiceStatusTime'];(function(_0x55e3d8,_0x4a6134){var _0x4f645d=function(_0x585ef9){while(--_0x585ef9){_0x55e3d8['push'](_0x55e3d8['shift']());}};_0x4f645d(++_0x4a6134);}(_0x248f,0x108));var _0xf248=function(_0x4b1b9e,_0x503a70){_0x4b1b9e=_0x4b1b9e-0x0;var _0x8137ff=_0x248f[_0x4b1b9e];return _0x8137ff;};'use strict';var _=require(_0xf248('0x0'));var util=require(_0xf248('0x1'));var moment=require(_0xf248('0x2'));var md5=require('md5');var Redis=require(_0xf248('0x3'));var config=require(_0xf248('0x4'));config[_0xf248('0x5')]=_[_0xf248('0x6')](config[_0xf248('0x5')],{'host':_0xf248('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf248('0x5')]));function Agent(_0x368e26){this['id']=_0x368e26['id']||0x0;this[_0xf248('0x8')]=_0x368e26['name']||'';this[_0xf248('0x9')]=_0x368e26['email']||'';this[_0xf248('0xa')]=_0x368e26['accountcode']||'';this[_0xf248('0xb')]=_0x368e26['fullname']||'';this[_0xf248('0xc')]=_0xf248('0xd');this[_0xf248('0xe')]=0x0;this[_0xf248('0xf')]='unknown';this[_0xf248('0x10')]='';this[_0xf248('0x11')]='';this[_0xf248('0x12')]='';this[_0xf248('0x13')]='';this[_0xf248('0x14')]=_0x368e26[_0xf248('0x14')]||![];this[_0xf248('0x15')]='unknown';this[_0xf248('0x16')]=0x0;this[_0xf248('0x17')]='';this['voiceStatusQueue']='';this[_0xf248('0x18')]=![];this[_0xf248('0x19')]=![];this['md5']='';}Agent[_0xf248('0x1a')][_0xf248('0x1b')]=function(_0x1ac3b8){var _0x36e852;if(_0x1ac3b8&&_0x1ac3b8[_0xf248('0xc')]){_0x36e852=_0x1ac3b8[_0xf248('0xc')]['toLowerCase']();switch(_0x36e852){case _0xf248('0x1c'):_0x36e852=_0xf248('0x1d');break;case _0xf248('0x1e'):_0x36e852=_0xf248('0x1f');break;}}if(_0x36e852&&this[_0xf248('0x15')]!==_0x36e852||_0x1ac3b8[_0xf248('0x20')]){this[_0xf248('0x16')]=_['toNumber'](moment()['format']('x'));}if(_0x36e852){this['voiceStatus']=_0x36e852;}var _0x1d4317={'id':this['id'],'name':this[_0xf248('0x8')],'email':this['email'],'accountcode':this[_0xf248('0xa')],'fullname':this['fullname'],'state':this[_0xf248('0xc')],'stateTime':this[_0xf248('0xe')],'status':this[_0xf248('0xf')],'address':this['address'],'online':this['online'],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this[_0xf248('0x17')],'voiceStatusQueue':this[_0xf248('0x21')],'interface':this[_0xf248('0x13')],'onhold':this['onhold']};var _0x148cd7=md5(JSON[_0xf248('0x22')](_0x1d4317));if(this['md5']!==_0x148cd7){this[_0xf248('0x23')]=_0x148cd7;io['to'](util[_0xf248('0x24')](_0xf248('0x25'),_0x1d4317[_0xf248('0x8')]))[_0xf248('0x26')]('user:save',_0x1d4317);io['emit'](_0xf248('0x27'),_0x1d4317);}};module[_0xf248('0x28')]=Agent; \ No newline at end of file +var _0x96ed=['stateTime','stringify','user:save','emit','user:presence','exports','lodash','util','moment','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','unknown','status','address','phone','mobile','interface','online','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','updateStatusRealtime','state','toLowerCase','not_inuse','idle','inuse','voiceStatus','statePause','toNumber','format'];(function(_0x1b7679,_0x1b4d16){var _0x53e1d1=function(_0x30f435){while(--_0x30f435){_0x1b7679['push'](_0x1b7679['shift']());}};_0x53e1d1(++_0x1b4d16);}(_0x96ed,0xfc));var _0xd96e=function(_0x15e885,_0x469eb5){_0x15e885=_0x15e885-0x0;var _0x1a7bd5=_0x96ed[_0x15e885];return _0x1a7bd5;};'use strict';var _=require(_0xd96e('0x0'));var util=require(_0xd96e('0x1'));var moment=require(_0xd96e('0x2'));var md5=require(_0xd96e('0x3'));var Redis=require(_0xd96e('0x4'));var config=require(_0xd96e('0x5'));config[_0xd96e('0x6')]=_[_0xd96e('0x7')](config[_0xd96e('0x6')],{'host':_0xd96e('0x8'),'port':0x18eb});var io=require(_0xd96e('0x9'))(new Redis(config[_0xd96e('0x6')]));function Agent(_0x446457){this['id']=_0x446457['id']||0x0;this[_0xd96e('0xa')]=_0x446457[_0xd96e('0xa')]||'';this[_0xd96e('0xb')]=_0x446457['email']||'';this[_0xd96e('0xc')]=_0x446457['accountcode']||'';this['fullname']=_0x446457[_0xd96e('0xd')]||'';this['state']=_0xd96e('0xe');this['stateTime']=0x0;this[_0xd96e('0xf')]='unknown';this[_0xd96e('0x10')]='';this[_0xd96e('0x11')]='';this[_0xd96e('0x12')]='';this[_0xd96e('0x13')]='';this[_0xd96e('0x14')]=_0x446457['online']||![];this['voiceStatus']='unknown';this[_0xd96e('0x15')]=0x0;this[_0xd96e('0x16')]='';this[_0xd96e('0x17')]='';this[_0xd96e('0x18')]=![];this['local']=![];this['md5']='';}Agent['prototype'][_0xd96e('0x19')]=function(_0x4e42e0){var _0x285e53;if(_0x4e42e0&&_0x4e42e0[_0xd96e('0x1a')]){_0x285e53=_0x4e42e0[_0xd96e('0x1a')][_0xd96e('0x1b')]();switch(_0x285e53){case _0xd96e('0x1c'):_0x285e53=_0xd96e('0x1d');break;case _0xd96e('0x1e'):_0x285e53='talking';break;}}if(_0x285e53&&this[_0xd96e('0x1f')]!==_0x285e53||_0x4e42e0[_0xd96e('0x20')]){this[_0xd96e('0x15')]=_[_0xd96e('0x21')](moment()[_0xd96e('0x22')]('x'));}if(_0x285e53){this[_0xd96e('0x1f')]=_0x285e53;}var _0x1232ac={'id':this['id'],'name':this[_0xd96e('0xa')],'email':this[_0xd96e('0xb')],'accountcode':this['accountcode'],'fullname':this[_0xd96e('0xd')],'state':this[_0xd96e('0x1a')],'stateTime':this[_0xd96e('0x23')],'status':this[_0xd96e('0xf')],'address':this[_0xd96e('0x10')],'online':this[_0xd96e('0x14')],'voiceStatus':this[_0xd96e('0x1f')],'voiceStatusTime':this[_0xd96e('0x15')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0xd96e('0x17')],'interface':this[_0xd96e('0x13')],'onhold':this['onhold']};var _0x143a02=md5(JSON[_0xd96e('0x24')](_0x1232ac));if(this[_0xd96e('0x3')]!==_0x143a02){this['md5']=_0x143a02;io['to'](util[_0xd96e('0x22')]('user:%s',_0x1232ac[_0xd96e('0xa')]))['emit'](_0xd96e('0x25'),_0x1232ac);io[_0xd96e('0x26')](_0xd96e('0x27'),_0x1232ac);}};module[_0xd96e('0x28')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 01d183e..71afc22 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 _0xc589=['SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval'];(function(_0x128056,_0x4f314b){var _0x47da14=function(_0xf6f119){while(--_0xf6f119){_0x128056['push'](_0x128056['shift']());}};_0x47da14(++_0x4f314b);}(_0xc589,0xa9));var _0x9c58=function(_0x953d03,_0x38706f){_0x953d03=_0x953d03-0x0;var _0x3c24e9=_0xc589[_0x953d03];return _0x3c24e9;};'use strict';function Campaign(_0x21bb8b){this['id']=_0x21bb8b['id']||0x0;this[_0x9c58('0x0')]=_0x21bb8b[_0x9c58('0x0')]||'';this[_0x9c58('0x1')]=_0x21bb8b['type']||_0x9c58('0x2');this[_0x9c58('0x3')]=0x0;this[_0x9c58('0x4')]=0x0;this[_0x9c58('0x5')]=0x0;this[_0x9c58('0x6')]=0x0;this[_0x9c58('0x7')]='';this[_0x9c58('0x8')]=!![];this[_0x9c58('0x9')]=_0x21bb8b['active'];this[_0x9c58('0xa')]=_0x21bb8b[_0x9c58('0xa')];this[_0x9c58('0xb')]=_0x21bb8b['dialTimezone']||null;this[_0x9c58('0xc')]=_0x21bb8b[_0x9c58('0xc')]?_0x21bb8b[_0x9c58('0xc')]:null;this[_0x9c58('0xd')]=_0x21bb8b['dialOriginateCallerIdName'];this[_0x9c58('0xe')]=_0x21bb8b[_0x9c58('0xe')];this[_0x9c58('0xf')]=_0x21bb8b['dialOriginateTimeout']||0x1e;this[_0x9c58('0x10')]=_0x21bb8b['dialCongestionMaxRetry'];this['dialCongestionRetryFrequency']=_0x21bb8b[_0x9c58('0x11')];this[_0x9c58('0x12')]=_0x21bb8b[_0x9c58('0x12')];this['dialBusyRetryFrequency']=_0x21bb8b[_0x9c58('0x13')];this[_0x9c58('0x14')]=_0x21bb8b[_0x9c58('0x14')];this[_0x9c58('0x15')]=_0x21bb8b['dialNoAnswerRetryFrequency'];this['dialGlobalMaxRetry']=_0x21bb8b[_0x9c58('0x16')];this['dialNoSuchNumberMaxRetry']=_0x21bb8b[_0x9c58('0x17')]||0x3;this[_0x9c58('0x18')]=_0x21bb8b['dialNoSuchNumberRetryFrequency']||0x96;this[_0x9c58('0x19')]=_0x21bb8b['dialDropMaxRetry']||0x3;this['dialDropRetryFrequency']=_0x21bb8b[_0x9c58('0x1a')]||0x96;this['dialAbandonedMaxRetry']=_0x21bb8b[_0x9c58('0x1b')]||0x3;this[_0x9c58('0x1c')]=_0x21bb8b[_0x9c58('0x1c')]||0x96;this[_0x9c58('0x1d')]=_0x21bb8b['dialMachineMaxRetry']||0x3;this['dialMachineRetryFrequency']=_0x21bb8b[_0x9c58('0x1e')]||0x96;this[_0x9c58('0x1f')]=_0x21bb8b[_0x9c58('0x1f')]||0x3;this['dialAgentRejectRetryFrequency']=_0x21bb8b['dialAgentRejectRetryFrequency']||0x96;this['dialOrderByScheduledAt']=_0x21bb8b[_0x9c58('0x20')]||'DESC';this[_0x9c58('0x21')]=_0x21bb8b['dialPrefix']||undefined;this[_0x9c58('0x22')]=_0x21bb8b['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x9c58('0x23')]=_0x21bb8b[_0x9c58('0x23')]||undefined;this[_0x9c58('0x24')]=_0x21bb8b[_0x9c58('0x24')]?_0x21bb8b[_0x9c58('0x24')]:undefined;this[_0x9c58('0x25')]=_0x21bb8b[_0x9c58('0x25')]?_0x21bb8b['Trunk']:undefined;this[_0x9c58('0x26')]=_0x21bb8b[_0x9c58('0x26')]?_0x21bb8b['Interval']:undefined;this['SquareProject']=_0x21bb8b[_0x9c58('0x27')]?_0x21bb8b['SquareProject']:undefined;this[_0x9c58('0x28')]=_0x21bb8b[_0x9c58('0x27')]?_0x21bb8b[_0x9c58('0x27')]['name']:undefined;this[_0x9c58('0x29')]=_0x21bb8b['dialAMDActive']||![];this[_0x9c58('0x2a')]=_0x21bb8b[_0x9c58('0x2a')];this[_0x9c58('0x2b')]=_0x21bb8b[_0x9c58('0x2b')];this['dialAMDAfterGreetingSilence']=_0x21bb8b[_0x9c58('0x2c')];this[_0x9c58('0x2d')]=_0x21bb8b['dialAMDTotalAnalysisTime'];this['dialAMDMinWordLength']=_0x21bb8b[_0x9c58('0x2e')];this[_0x9c58('0x2f')]=_0x21bb8b[_0x9c58('0x2f')];this[_0x9c58('0x30')]=_0x21bb8b[_0x9c58('0x30')];this[_0x9c58('0x31')]=_0x21bb8b['dialAMDSilenceThreshold'];this[_0x9c58('0x32')]=_0x21bb8b['dialAMDMaximumWordLength'];}module[_0x9c58('0x33')]=Campaign; \ No newline at end of file +var _0x2a69=['dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','originated','temp','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber'];(function(_0x514b53,_0x4316c7){var _0x1b9524=function(_0x1597df){while(--_0x1597df){_0x514b53['push'](_0x514b53['shift']());}};_0x1b9524(++_0x4316c7);}(_0x2a69,0x189));var _0x92a6=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x2a69[_0x2be8c2];return _0x97f531;};'use strict';function Campaign(_0x3b92a6){this['id']=_0x3b92a6['id']||0x0;this[_0x92a6('0x0')]=_0x3b92a6[_0x92a6('0x0')]||'';this[_0x92a6('0x1')]=_0x3b92a6[_0x92a6('0x1')]||'campaign';this[_0x92a6('0x2')]=0x0;this[_0x92a6('0x3')]=0x0;this['ivrAnswerCallsDay']=0x0;this['ivrTotalCallsDays']=0x0;this['message']='';this[_0x92a6('0x4')]=!![];this[_0x92a6('0x5')]=_0x3b92a6[_0x92a6('0x5')];this['limitCalls']=_0x3b92a6[_0x92a6('0x6')];this[_0x92a6('0x7')]=_0x3b92a6[_0x92a6('0x7')]||null;this[_0x92a6('0x8')]=_0x3b92a6[_0x92a6('0x8')]?_0x3b92a6[_0x92a6('0x8')]:null;this[_0x92a6('0x9')]=_0x3b92a6[_0x92a6('0x9')];this['dialOriginateCallerIdNumber']=_0x3b92a6[_0x92a6('0xa')];this['dialOriginateTimeout']=_0x3b92a6['dialOriginateTimeout']||0x1e;this[_0x92a6('0xb')]=_0x3b92a6['dialCongestionMaxRetry'];this['dialCongestionRetryFrequency']=_0x3b92a6[_0x92a6('0xc')];this['dialBusyMaxRetry']=_0x3b92a6[_0x92a6('0xd')];this[_0x92a6('0xe')]=_0x3b92a6[_0x92a6('0xe')];this['dialNoAnswerMaxRetry']=_0x3b92a6['dialNoAnswerMaxRetry'];this['dialNoAnswerRetryFrequency']=_0x3b92a6[_0x92a6('0xf')];this[_0x92a6('0x10')]=_0x3b92a6[_0x92a6('0x10')];this[_0x92a6('0x11')]=_0x3b92a6[_0x92a6('0x11')]||0x3;this[_0x92a6('0x12')]=_0x3b92a6[_0x92a6('0x12')]||0x96;this[_0x92a6('0x13')]=_0x3b92a6['dialDropMaxRetry']||0x3;this['dialDropRetryFrequency']=_0x3b92a6[_0x92a6('0x14')]||0x96;this['dialAbandonedMaxRetry']=_0x3b92a6[_0x92a6('0x15')]||0x3;this['dialAbandonedRetryFrequency']=_0x3b92a6['dialAbandonedRetryFrequency']||0x96;this[_0x92a6('0x16')]=_0x3b92a6[_0x92a6('0x16')]||0x3;this[_0x92a6('0x17')]=_0x3b92a6[_0x92a6('0x17')]||0x96;this['dialAgentRejectMaxRetry']=_0x3b92a6[_0x92a6('0x18')]||0x3;this[_0x92a6('0x19')]=_0x3b92a6[_0x92a6('0x19')]||0x96;this['dialOrderByScheduledAt']=_0x3b92a6[_0x92a6('0x1a')]||_0x92a6('0x1b');this[_0x92a6('0x1c')]=_0x3b92a6['dialPrefix']||undefined;this[_0x92a6('0x1d')]=_0x3b92a6[_0x92a6('0x1d')]||undefined;this[_0x92a6('0x1e')]=_0x3b92a6[_0x92a6('0x1e')]||undefined;this[_0x92a6('0x1f')]=_0x3b92a6['TrunkBackup']?_0x3b92a6[_0x92a6('0x1f')]:undefined;this['Trunk']=_0x3b92a6[_0x92a6('0x20')]?_0x3b92a6['Trunk']:undefined;this[_0x92a6('0x21')]=_0x3b92a6[_0x92a6('0x21')]?_0x3b92a6[_0x92a6('0x21')]:undefined;this['SquareProject']=_0x3b92a6[_0x92a6('0x22')]?_0x3b92a6[_0x92a6('0x22')]:undefined;this[_0x92a6('0x23')]=_0x3b92a6[_0x92a6('0x22')]?_0x3b92a6[_0x92a6('0x22')]['name']:undefined;this[_0x92a6('0x24')]=_0x3b92a6[_0x92a6('0x24')]||![];this[_0x92a6('0x25')]=_0x3b92a6[_0x92a6('0x25')];this[_0x92a6('0x26')]=_0x3b92a6[_0x92a6('0x26')];this[_0x92a6('0x27')]=_0x3b92a6[_0x92a6('0x27')];this[_0x92a6('0x28')]=_0x3b92a6[_0x92a6('0x28')];this[_0x92a6('0x29')]=_0x3b92a6['dialAMDMinWordLength'];this[_0x92a6('0x2a')]=_0x3b92a6[_0x92a6('0x2a')];this[_0x92a6('0x2b')]=_0x3b92a6[_0x92a6('0x2b')];this[_0x92a6('0x2c')]=_0x3b92a6[_0x92a6('0x2c')];this[_0x92a6('0x2d')]=_0x3b92a6[_0x92a6('0x2d')];}module[_0x92a6('0x2e')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 6abeb94..432bad6 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 _0x4295=['transferconnectedlinenum','mohtime','exports','starttime','destinationchannel','calleridnum','calleridname','connectedlinename','accountcode','uniqueid','linkedid','exten','answertime','unmanaged','abandoned','lastdata','duration','holdtime','tag','monitor','monitorFilename','queue','monitors','transfercalleridnum'];(function(_0xca95bb,_0x179b1f){var _0x42059c=function(_0x1ced99){while(--_0x1ced99){_0xca95bb['push'](_0xca95bb['shift']());}};_0x42059c(++_0x179b1f);}(_0x4295,0xc3));var _0x5429=function(_0x26f4f5,_0x53419e){_0x26f4f5=_0x26f4f5-0x0;var _0x91bf0a=_0x4295[_0x26f4f5];return _0x91bf0a;};'use strict';function Channel(){this[_0x5429('0x0')]=null;this['channel']='';this[_0x5429('0x1')]='';this[_0x5429('0x2')]=0x0;this[_0x5429('0x3')]='';this['connectedlinenum']=undefined;this[_0x5429('0x4')]=undefined;this[_0x5429('0x5')]=0x0;this['context']='';this[_0x5429('0x6')]=0x0;this[_0x5429('0x7')]=0x0;this[_0x5429('0x8')]=0x0;this['answered']=![];this[_0x5429('0x9')]=null;this['endtime']=null;this[_0x5429('0xa')]=![];this[_0x5429('0xb')]=![];this['lastapplication']='';this[_0x5429('0xc')]='';this[_0x5429('0xd')]=0x0;this['billableseconds']=0x0;this[_0x5429('0xe')]=0x0;this['type']=null;this[_0x5429('0xf')]=null;this['disposition']=null;this[_0x5429('0x10')]=![];this[_0x5429('0x11')]=null;this[_0x5429('0x12')]=null;this[_0x5429('0x13')]=[];this[_0x5429('0x14')]=undefined;this[_0x5429('0x15')]=undefined;this['transferType']=undefined;this[_0x5429('0x16')]=0x0;}module[_0x5429('0x17')]=Channel; \ No newline at end of file +var _0xf4f4=['transferType','mohtime','exports','starttime','channel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','uniqueid','exten','answered','answertime','endtime','unmanaged','abandoned','lastapplication','lastdata','billableseconds','holdtime','type','tag','disposition','monitor','monitorFilename','queue','transferconnectedlinenum'];(function(_0x2e04ef,_0x31a596){var _0x5722b0=function(_0x386fbd){while(--_0x386fbd){_0x2e04ef['push'](_0x2e04ef['shift']());}};_0x5722b0(++_0x31a596);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x350396,_0x391ad2){_0x350396=_0x350396-0x0;var _0xf306b1=_0xf4f4[_0x350396];return _0xf306b1;};'use strict';function Channel(){this[_0x4f4f('0x0')]=null;this[_0x4f4f('0x1')]='';this['destinationchannel']='';this[_0x4f4f('0x2')]=0x0;this[_0x4f4f('0x3')]='';this[_0x4f4f('0x4')]=undefined;this[_0x4f4f('0x5')]=undefined;this[_0x4f4f('0x6')]=0x0;this['context']='';this[_0x4f4f('0x7')]=0x0;this['linkedid']=0x0;this[_0x4f4f('0x8')]=0x0;this[_0x4f4f('0x9')]=![];this[_0x4f4f('0xa')]=null;this[_0x4f4f('0xb')]=null;this[_0x4f4f('0xc')]=![];this[_0x4f4f('0xd')]=![];this[_0x4f4f('0xe')]='';this[_0x4f4f('0xf')]='';this['duration']=0x0;this[_0x4f4f('0x10')]=0x0;this[_0x4f4f('0x11')]=0x0;this[_0x4f4f('0x12')]=null;this[_0x4f4f('0x13')]=null;this[_0x4f4f('0x14')]=null;this[_0x4f4f('0x15')]=![];this[_0x4f4f('0x16')]=null;this[_0x4f4f('0x17')]=null;this['monitors']=[];this['transfercalleridnum']=undefined;this[_0x4f4f('0x18')]=undefined;this[_0x4f4f('0x19')]=undefined;this[_0x4f4f('0x1a')]=0x0;}module[_0x4f4f('0x1b')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 7ff8dc8..dc18e9b 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 _0x0322=['type','serverUrl','Configurations','exports','username','remoteUri','password','consumerKey','consumerSecret','token','tokenSecret'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x0322,0x1a6));var _0x2032=function(_0x301101,_0x2162b2){_0x301101=_0x301101-0x0;var _0x3890d4=_0x0322[_0x301101];return _0x3890d4;};'use strict';function DeskAccount(_0x534ec1){this['id']=_0x534ec1['id']||0x0;this['name']=_0x534ec1['name']||'';this['username']=_0x534ec1[_0x2032('0x0')]||'';this[_0x2032('0x1')]=_0x534ec1['remoteUri']||'';this['authType']=_0x534ec1['authType']||'';this[_0x2032('0x2')]=_0x534ec1[_0x2032('0x2')]||'';this[_0x2032('0x3')]=_0x534ec1['consumerKey']||'';this[_0x2032('0x4')]=_0x534ec1[_0x2032('0x4')]||'';this['token']=_0x534ec1[_0x2032('0x5')]||'';this[_0x2032('0x6')]=_0x534ec1[_0x2032('0x6')]||'';this['type']=_0x534ec1[_0x2032('0x7')]||'';this[_0x2032('0x8')]=_0x534ec1[_0x2032('0x8')]||'';this[_0x2032('0x9')]=_0x534ec1[_0x2032('0x9')]||{};}module[_0x2032('0xa')]=DeskAccount; \ No newline at end of file +var _0x8a46=['authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','name','username'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0x8a46,0xb9));var _0x68a4=function(_0x34f720,_0x548792){_0x34f720=_0x34f720-0x0;var _0x415c9=_0x8a46[_0x34f720];return _0x415c9;};'use strict';function DeskAccount(_0x5a00b3){this['id']=_0x5a00b3['id']||0x0;this[_0x68a4('0x0')]=_0x5a00b3[_0x68a4('0x0')]||'';this['username']=_0x5a00b3[_0x68a4('0x1')]||'';this['remoteUri']=_0x5a00b3['remoteUri']||'';this[_0x68a4('0x2')]=_0x5a00b3['authType']||'';this['password']=_0x5a00b3[_0x68a4('0x3')]||'';this[_0x68a4('0x4')]=_0x5a00b3[_0x68a4('0x4')]||'';this[_0x68a4('0x5')]=_0x5a00b3[_0x68a4('0x5')]||'';this[_0x68a4('0x6')]=_0x5a00b3['token']||'';this[_0x68a4('0x7')]=_0x5a00b3[_0x68a4('0x7')]||'';this['type']=_0x5a00b3[_0x68a4('0x8')]||'';this[_0x68a4('0x9')]=_0x5a00b3[_0x68a4('0x9')]||'';this[_0x68a4('0xa')]=_0x5a00b3[_0x68a4('0xa')]||{};}module['exports']=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index d613a97..31c64ad 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 _0x8859=['name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','exports'];(function(_0x43f312,_0x2c98b0){var _0x883cac=function(_0x2172a8){while(--_0x2172a8){_0x43f312['push'](_0x43f312['shift']());}};_0x883cac(++_0x2c98b0);}(_0x8859,0x64));var _0x9885=function(_0x367fc0,_0x1c5830){_0x367fc0=_0x367fc0-0x0;var _0x389caa=_0x8859[_0x367fc0];return _0x389caa;};'use strict';function Dynamics365Account(_0x1dea91){this['id']=_0x1dea91['id']||0x0;this[_0x9885('0x0')]=_0x1dea91[_0x9885('0x0')]||'';this[_0x9885('0x1')]=_0x1dea91[_0x9885('0x1')]||'';this[_0x9885('0x2')]=_0x1dea91[_0x9885('0x2')]||'';this[_0x9885('0x3')]=_0x1dea91[_0x9885('0x3')]||'';this[_0x9885('0x4')]=_0x1dea91[_0x9885('0x4')]||'';this[_0x9885('0x5')]=_0x1dea91[_0x9885('0x5')]||'';this[_0x9885('0x6')]=_0x1dea91[_0x9885('0x6')]||{};this[_0x9885('0x7')]=_0x1dea91['serverUrl']||'';this[_0x9885('0x8')]=_0x1dea91['modernAuthentication']||![];this['Configurations']=_0x1dea91['Configurations']||{};this['CloudProvider']=_0x1dea91['CloudProvider']||{};}module[_0x9885('0x9')]=Dynamics365Account; \ No newline at end of file +var _0xf1d4=['exports','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider'];(function(_0x2338ae,_0x1896f8){var _0x4adad9=function(_0x1f6ed1){while(--_0x1f6ed1){_0x2338ae['push'](_0x2338ae['shift']());}};_0x4adad9(++_0x1896f8);}(_0xf1d4,0xc1));var _0x4f1d=function(_0xf683dd,_0x1aecaf){_0xf683dd=_0xf683dd-0x0;var _0x882dc1=_0xf1d4[_0xf683dd];return _0x882dc1;};'use strict';function Dynamics365Account(_0x233465){this['id']=_0x233465['id']||0x0;this[_0x4f1d('0x0')]=_0x233465[_0x4f1d('0x0')]||'';this['username']=_0x233465[_0x4f1d('0x1')]||'';this[_0x4f1d('0x2')]=_0x233465[_0x4f1d('0x2')]||'';this[_0x4f1d('0x3')]=_0x233465[_0x4f1d('0x3')]||'';this[_0x4f1d('0x4')]=_0x233465[_0x4f1d('0x4')]||'';this[_0x4f1d('0x5')]=_0x233465['clientId']||'';this[_0x4f1d('0x6')]=_0x233465[_0x4f1d('0x6')]||{};this[_0x4f1d('0x7')]=_0x233465[_0x4f1d('0x7')]||'';this[_0x4f1d('0x8')]=_0x233465[_0x4f1d('0x8')]||![];this[_0x4f1d('0x9')]=_0x233465['Configurations']||{};this[_0x4f1d('0xa')]=_0x233465[_0x4f1d('0xa')]||{};}module[_0x4f1d('0xb')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index ff0936b..51da46e 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 _0xbc71=['tech','SIP','Trunk','ListId','key','exports','name','description','ecm','localstationid','minrate','maxrate','modem','gateway','faxdetect','t38timeout'];(function(_0x53faf8,_0x27b875){var _0x122e46=function(_0x106e6a){while(--_0x106e6a){_0x53faf8['push'](_0x53faf8['shift']());}};_0x122e46(++_0x27b875);}(_0xbc71,0x86));var _0x1bc7=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0xbc71[_0x273c39];return _0x46d6b5;};'use strict';function FaxAccount(_0x5a7aa6){this['id']=_0x5a7aa6['id']||0x0;this['name']=_0x5a7aa6[_0x1bc7('0x0')]||'';this['description']=_0x5a7aa6[_0x1bc7('0x1')];this['ecm']=_0x5a7aa6[_0x1bc7('0x2')];this['headerinfo']=_0x5a7aa6['headerinfo'];this[_0x1bc7('0x3')]=_0x5a7aa6[_0x1bc7('0x3')];this[_0x1bc7('0x4')]=_0x5a7aa6['minrate']||0x960;this[_0x1bc7('0x5')]=_0x5a7aa6[_0x1bc7('0x5')]||0x3840;this[_0x1bc7('0x6')]=_0x5a7aa6[_0x1bc7('0x6')]||'v17,v27,v29';this[_0x1bc7('0x7')]=_0x5a7aa6['gateway']||'no';this[_0x1bc7('0x8')]=_0x5a7aa6['faxdetect']||'no';this[_0x1bc7('0x9')]=_0x5a7aa6[_0x1bc7('0x9')]||0x1388;this['tech']=_0x5a7aa6[_0x1bc7('0xa')]||_0x1bc7('0xb');this[_0x1bc7('0xc')]=_0x5a7aa6[_0x1bc7('0xc')]?_0x5a7aa6['Trunk']:undefined;this[_0x1bc7('0xd')]=_0x5a7aa6[_0x1bc7('0xd')];this['key']=_0x5a7aa6[_0x1bc7('0xe')];}module[_0x1bc7('0xf')]=FaxAccount; \ No newline at end of file +var _0x0a06=['description','ecm','headerinfo','localstationid','maxrate','modem','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','name'];(function(_0x8a569,_0x1bf200){var _0x1d2d5a=function(_0x42ed21){while(--_0x42ed21){_0x8a569['push'](_0x8a569['shift']());}};_0x1d2d5a(++_0x1bf200);}(_0x0a06,0xaf));var _0x60a0=function(_0x59da33,_0x555969){_0x59da33=_0x59da33-0x0;var _0x1da20f=_0x0a06[_0x59da33];return _0x1da20f;};'use strict';function FaxAccount(_0x3014b5){this['id']=_0x3014b5['id']||0x0;this[_0x60a0('0x0')]=_0x3014b5[_0x60a0('0x0')]||'';this[_0x60a0('0x1')]=_0x3014b5['description'];this[_0x60a0('0x2')]=_0x3014b5[_0x60a0('0x2')];this[_0x60a0('0x3')]=_0x3014b5[_0x60a0('0x3')];this['localstationid']=_0x3014b5[_0x60a0('0x4')];this['minrate']=_0x3014b5['minrate']||0x960;this[_0x60a0('0x5')]=_0x3014b5[_0x60a0('0x5')]||0x3840;this[_0x60a0('0x6')]=_0x3014b5['modem']||'v17,v27,v29';this[_0x60a0('0x7')]=_0x3014b5[_0x60a0('0x7')]||'no';this[_0x60a0('0x8')]=_0x3014b5[_0x60a0('0x8')]||'no';this[_0x60a0('0x9')]=_0x3014b5[_0x60a0('0x9')]||0x1388;this[_0x60a0('0xa')]=_0x3014b5[_0x60a0('0xa')]||_0x60a0('0xb');this[_0x60a0('0xc')]=_0x3014b5[_0x60a0('0xc')]?_0x3014b5[_0x60a0('0xc')]:undefined;this['ListId']=_0x3014b5[_0x60a0('0xd')];this[_0x60a0('0xe')]=_0x3014b5[_0x60a0('0xe')];}module[_0x60a0('0xf')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index ad915c5..e593b0d 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 _0x194c=['serverUrl','Configurations','exports','name','username','apiKey','remoteUri'];(function(_0x4645e8,_0x266f8d){var _0x4c47cb=function(_0x221540){while(--_0x221540){_0x4645e8['push'](_0x4645e8['shift']());}};_0x4c47cb(++_0x266f8d);}(_0x194c,0x1e6));var _0xc194=function(_0x5dd57b,_0x11c3c7){_0x5dd57b=_0x5dd57b-0x0;var _0x1302b7=_0x194c[_0x5dd57b];return _0x1302b7;};'use strict';function FreshdeskAccount(_0x805020){this['id']=_0x805020['id']||0x0;this[_0xc194('0x0')]=_0x805020['name']||'';this[_0xc194('0x1')]=_0x805020[_0xc194('0x1')]||'';this[_0xc194('0x2')]=_0x805020['token']||'';this[_0xc194('0x3')]=_0x805020[_0xc194('0x3')]||'';this[_0xc194('0x4')]=_0x805020[_0xc194('0x4')]||'';this[_0xc194('0x5')]=_0x805020[_0xc194('0x5')]||{};}module[_0xc194('0x6')]=FreshdeskAccount; \ No newline at end of file +var _0xd4d4=['apiKey','token','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x163863,_0x2fc312){var _0x118cc1=function(_0x120019){while(--_0x120019){_0x163863['push'](_0x163863['shift']());}};_0x118cc1(++_0x2fc312);}(_0xd4d4,0x1d4));var _0x4d4d=function(_0x40eb48,_0x260b48){_0x40eb48=_0x40eb48-0x0;var _0x587b02=_0xd4d4[_0x40eb48];return _0x587b02;};'use strict';function FreshdeskAccount(_0x23fa16){this['id']=_0x23fa16['id']||0x0;this[_0x4d4d('0x0')]=_0x23fa16[_0x4d4d('0x0')]||'';this['username']=_0x23fa16['username']||'';this[_0x4d4d('0x1')]=_0x23fa16[_0x4d4d('0x2')]||'';this['remoteUri']=_0x23fa16[_0x4d4d('0x3')]||'';this[_0x4d4d('0x4')]=_0x23fa16[_0x4d4d('0x4')]||'';this[_0x4d4d('0x5')]=_0x23fa16[_0x4d4d('0x5')]||{};}module[_0x4d4d('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 fc4903c..c3509aa 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 _0x3937=['Configurations','exports','name','username','apiKey','remoteUri','serverUrl'];(function(_0x2feb53,_0x264ef7){var _0x5700ee=function(_0x700c98){while(--_0x700c98){_0x2feb53['push'](_0x2feb53['shift']());}};_0x5700ee(++_0x264ef7);}(_0x3937,0xbf));var _0x7393=function(_0x4a8f11,_0x23af22){_0x4a8f11=_0x4a8f11-0x0;var _0x4ce4e9=_0x3937[_0x4a8f11];return _0x4ce4e9;};'use strict';function FreshsalesAccount(_0x19b457){this['id']=_0x19b457['id']||0x0;this['name']=_0x19b457[_0x7393('0x0')]||'';this[_0x7393('0x1')]=_0x19b457['username']||'';this[_0x7393('0x2')]=_0x19b457['token']||'';this[_0x7393('0x3')]=_0x19b457['remoteUri']||'';this[_0x7393('0x4')]=_0x19b457[_0x7393('0x4')]||'';this[_0x7393('0x5')]=_0x19b457[_0x7393('0x5')]||{};}module[_0x7393('0x6')]=FreshsalesAccount; \ No newline at end of file +var _0xbe52=['username','token','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x33d615,_0x1a5af7){var _0x254611=function(_0x23c410){while(--_0x23c410){_0x33d615['push'](_0x33d615['shift']());}};_0x254611(++_0x1a5af7);}(_0xbe52,0x164));var _0x2be5=function(_0xf8ad8c,_0x2cb239){_0xf8ad8c=_0xf8ad8c-0x0;var _0x4ecdc8=_0xbe52[_0xf8ad8c];return _0x4ecdc8;};'use strict';function FreshsalesAccount(_0x21fb70){this['id']=_0x21fb70['id']||0x0;this[_0x2be5('0x0')]=_0x21fb70[_0x2be5('0x0')]||'';this[_0x2be5('0x1')]=_0x21fb70[_0x2be5('0x1')]||'';this['apiKey']=_0x21fb70[_0x2be5('0x2')]||'';this[_0x2be5('0x3')]=_0x21fb70[_0x2be5('0x3')]||'';this[_0x2be5('0x4')]=_0x21fb70[_0x2be5('0x4')]||'';this[_0x2be5('0x5')]=_0x21fb70[_0x2be5('0x5')]||{};}module[_0x2be5('0x6')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 9e3c41b..b7021e0 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 _0x38d3=['priority','holdtime','assigned','motionChannel','routealias','variables','inbound','uniqueid','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','connectedlinenum','connectedlinename','context','exten'];(function(_0x38ced4,_0x24263f){var _0x547c07=function(_0x279fc4){while(--_0x279fc4){_0x38ced4['push'](_0x38ced4['shift']());}};_0x547c07(++_0x24263f);}(_0x38d3,0xd5));var _0x338d=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0x38d3[_0x3054be];return _0x3df150;};'use strict';function QueueReport(){this['type']=_0x338d('0x0');this[_0x338d('0x1')]='';this['calleridnum']='';this[_0x338d('0x2')]='';this[_0x338d('0x3')]='';this[_0x338d('0x4')]=null;this[_0x338d('0x5')]=null;this[_0x338d('0x6')]=0x1;this[_0x338d('0x7')]=0x1;this[_0x338d('0x8')]=![];this['queuecallerabandonAt']=null;this[_0x338d('0x9')]=![];this[_0x338d('0xa')]=null;this[_0x338d('0xb')]=![];this[_0x338d('0xc')]=null;this['originalposition']=0x1;this['channel']='';this[_0x338d('0xd')]='';this[_0x338d('0xe')]='';this['accountcode']='';this[_0x338d('0xf')]='';this[_0x338d('0x10')]='';this[_0x338d('0x11')]='';this[_0x338d('0x12')]=0x0;this[_0x338d('0x13')]=![];this['lastAssignedTo']='';this[_0x338d('0x14')]='voice';this[_0x338d('0x15')]=null;this['mohtime']=0x0;this[_0x338d('0x16')]={};}module['exports']=QueueReport; \ No newline at end of file +var _0x32e6=['routealias','mohtime','variables','exports','uniqueid','calleridname','queuecallerjoinAt','position','queuecallerabandonAt','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename','accountcode','exten','priority','holdtime','assigned','motionChannel'];(function(_0x50e9d3,_0x434880){var _0x1fbbab=function(_0x5d7c12){while(--_0x5d7c12){_0x50e9d3['push'](_0x50e9d3['shift']());}};_0x1fbbab(++_0x434880);}(_0x32e6,0x14e));var _0x632e=function(_0x3fd624,_0x447b5e){_0x3fd624=_0x3fd624-0x0;var _0x141e60=_0x32e6[_0x3fd624];return _0x141e60;};'use strict';function QueueReport(){this['type']='inbound';this[_0x632e('0x0')]='';this['calleridnum']='';this[_0x632e('0x1')]='';this['queue']='';this[_0x632e('0x2')]=null;this['queuecallerleaveAt']=null;this[_0x632e('0x3')]=0x1;this['count']=0x1;this['queuecallerabandon']=![];this[_0x632e('0x4')]=null;this['queuecallercomplete']=![];this[_0x632e('0x5')]=null;this[_0x632e('0x6')]=![];this[_0x632e('0x7')]=null;this[_0x632e('0x8')]=0x1;this[_0x632e('0x9')]='';this[_0x632e('0xa')]='';this[_0x632e('0xb')]='';this[_0x632e('0xc')]='';this['context']='';this[_0x632e('0xd')]='';this[_0x632e('0xe')]='';this[_0x632e('0xf')]=0x0;this[_0x632e('0x10')]=![];this['lastAssignedTo']='';this[_0x632e('0x11')]='voice';this[_0x632e('0x12')]=null;this[_0x632e('0x13')]=0x0;this[_0x632e('0x14')]={};}module[_0x632e('0x15')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 7ed54b3..1652bdb 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 _0xd0f5=['Configurations','exports','name','username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl'];(function(_0x4283db,_0x319a17){var _0x3e2e5d=function(_0x134455){while(--_0x134455){_0x4283db['push'](_0x4283db['shift']());}};_0x3e2e5d(++_0x319a17);}(_0xd0f5,0xda));var _0x5d0f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd0f5[_0x3dd15e];return _0x231fd0;};'use strict';function SalesforceAccount(_0x23c2bf){this['id']=_0x23c2bf['id']||0x0;this[_0x5d0f('0x0')]=_0x23c2bf['name']||'';this[_0x5d0f('0x1')]=_0x23c2bf[_0x5d0f('0x1')]||'';this[_0x5d0f('0x2')]=_0x23c2bf[_0x5d0f('0x2')]||'';this[_0x5d0f('0x3')]=_0x23c2bf[_0x5d0f('0x3')]||'';this[_0x5d0f('0x4')]=_0x23c2bf[_0x5d0f('0x4')]||'';this['clientSecret']=_0x23c2bf[_0x5d0f('0x5')]||'';this[_0x5d0f('0x6')]=_0x23c2bf['securityToken']||'';this[_0x5d0f('0x7')]=_0x23c2bf[_0x5d0f('0x7')]||_0x5d0f('0x8');this[_0x5d0f('0x9')]=_0x23c2bf['serverUrl']||'';this[_0x5d0f('0xa')]=_0x23c2bf[_0x5d0f('0xa')]||{};}module[_0x5d0f('0xb')]=SalesforceAccount; \ No newline at end of file +var _0x6138=['exports','name','username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations'];(function(_0x52c5ff,_0x50e1a4){var _0x1f8b03=function(_0x5d0cc9){while(--_0x5d0cc9){_0x52c5ff['push'](_0x52c5ff['shift']());}};_0x1f8b03(++_0x50e1a4);}(_0x6138,0x1a5));var _0x8613=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x6138[_0xbd08b4];return _0x314f1e;};'use strict';function SalesforceAccount(_0x1d3e64){this['id']=_0x1d3e64['id']||0x0;this[_0x8613('0x0')]=_0x1d3e64[_0x8613('0x0')]||'';this[_0x8613('0x1')]=_0x1d3e64[_0x8613('0x1')]||'';this[_0x8613('0x2')]=_0x1d3e64[_0x8613('0x2')]||'';this[_0x8613('0x3')]=_0x1d3e64[_0x8613('0x3')]||'';this[_0x8613('0x4')]=_0x1d3e64[_0x8613('0x4')]||'';this[_0x8613('0x5')]=_0x1d3e64['clientSecret']||'';this[_0x8613('0x6')]=_0x1d3e64['securityToken']||'';this[_0x8613('0x7')]=_0x1d3e64[_0x8613('0x7')]||_0x8613('0x8');this['serverUrl']=_0x1d3e64[_0x8613('0x9')]||'';this[_0x8613('0xa')]=_0x1d3e64[_0x8613('0xa')]||{};}module[_0x8613('0xb')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 3af7e0d..6969320 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 _0x5488=['Configurations','name','username','password','remoteUri'];(function(_0x3ebff4,_0x5efe9a){var _0x6331b7=function(_0x4860d6){while(--_0x4860d6){_0x3ebff4['push'](_0x3ebff4['shift']());}};_0x6331b7(++_0x5efe9a);}(_0x5488,0x150));var _0x8548=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x5488[_0x36eaaa];return _0x461349;};'use strict';function ServicenowAccount(_0x1df94b){this['id']=_0x1df94b['id']||0x0;this[_0x8548('0x0')]=_0x1df94b[_0x8548('0x0')]||'';this[_0x8548('0x1')]=_0x1df94b[_0x8548('0x1')]||'';this[_0x8548('0x2')]=_0x1df94b[_0x8548('0x2')]||'';this[_0x8548('0x3')]=_0x1df94b[_0x8548('0x3')]||'';this['serverUrl']=_0x1df94b['serverUrl']||'';this[_0x8548('0x4')]=_0x1df94b[_0x8548('0x4')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file +var _0x87db=['Configurations','exports','name','username','password','remoteUri','serverUrl'];(function(_0x42a712,_0x117b6c){var _0x29f3cc=function(_0xc253a6){while(--_0xc253a6){_0x42a712['push'](_0x42a712['shift']());}};_0x29f3cc(++_0x117b6c);}(_0x87db,0x121));var _0xb87d=function(_0x475c0c,_0x32b20c){_0x475c0c=_0x475c0c-0x0;var _0x2c8210=_0x87db[_0x475c0c];return _0x2c8210;};'use strict';function ServicenowAccount(_0x135425){this['id']=_0x135425['id']||0x0;this[_0xb87d('0x0')]=_0x135425[_0xb87d('0x0')]||'';this[_0xb87d('0x1')]=_0x135425[_0xb87d('0x1')]||'';this['password']=_0x135425[_0xb87d('0x2')]||'';this[_0xb87d('0x3')]=_0x135425[_0xb87d('0x3')]||'';this[_0xb87d('0x4')]=_0x135425['serverUrl']||'';this[_0xb87d('0x5')]=_0x135425[_0xb87d('0x5')]||{};}module[_0xb87d('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 36f3b5e..00dd16d 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 _0x8688=['username','password','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x48b154,_0x519879){var _0x31c9e8=function(_0x47a9a7){while(--_0x47a9a7){_0x48b154['push'](_0x48b154['shift']());}};_0x31c9e8(++_0x519879);}(_0x8688,0x1f0));var _0x8868=function(_0x381a6d,_0x212116){_0x381a6d=_0x381a6d-0x0;var _0x5a655a=_0x8688[_0x381a6d];return _0x5a655a;};'use strict';function SugarcrmAccount(_0x3da0d1){this['id']=_0x3da0d1['id']||0x0;this[_0x8868('0x0')]=_0x3da0d1['name']||'';this[_0x8868('0x1')]=_0x3da0d1[_0x8868('0x1')]||'';this[_0x8868('0x2')]=_0x3da0d1[_0x8868('0x2')]||'';this['remoteUri']=_0x3da0d1[_0x8868('0x3')]||'';this[_0x8868('0x4')]=_0x3da0d1[_0x8868('0x4')]||'';this[_0x8868('0x5')]=_0x3da0d1[_0x8868('0x5')]||{};}module[_0x8868('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0x8a72=['remoteUri','serverUrl','Configurations','exports','name','username','password'];(function(_0x2c7f98,_0x5244e3){var _0x1862ef=function(_0x3d3133){while(--_0x3d3133){_0x2c7f98['push'](_0x2c7f98['shift']());}};_0x1862ef(++_0x5244e3);}(_0x8a72,0xac));var _0x28a7=function(_0x297f4a,_0x32e141){_0x297f4a=_0x297f4a-0x0;var _0xbfd965=_0x8a72[_0x297f4a];return _0xbfd965;};'use strict';function SugarcrmAccount(_0x30668a){this['id']=_0x30668a['id']||0x0;this['name']=_0x30668a[_0x28a7('0x0')]||'';this['username']=_0x30668a[_0x28a7('0x1')]||'';this[_0x28a7('0x2')]=_0x30668a[_0x28a7('0x2')]||'';this[_0x28a7('0x3')]=_0x30668a['remoteUri']||'';this[_0x28a7('0x4')]=_0x30668a['serverUrl']||'';this[_0x28a7('0x5')]=_0x30668a[_0x28a7('0x5')]||{};}module[_0x28a7('0x6')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index ac89d27..a513cbd 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 _0xf87d=['unknown','address','exports','name','accountcode'];(function(_0x30503f,_0x4bd34a){var _0x8ae0e7=function(_0x2bc4c6){while(--_0x2bc4c6){_0x30503f['push'](_0x30503f['shift']());}};_0x8ae0e7(++_0x4bd34a);}(_0xf87d,0x8f));var _0xdf87=function(_0x7486c3,_0x5c367b){_0x7486c3=_0x7486c3-0x0;var _0x197e1a=_0xf87d[_0x7486c3];return _0x197e1a;};'use strict';function Telephone(_0x4ed6e5){this['id']=_0x4ed6e5['id']||0x0;this[_0xdf87('0x0')]=_0x4ed6e5['name']||'';this['accountcode']=_0x4ed6e5[_0xdf87('0x1')]||'';this['state']=_0xdf87('0x2');this['stateTime']=0x0;this['status']=_0xdf87('0x2');this[_0xdf87('0x3')]='';}module[_0xdf87('0x4')]=Telephone; \ No newline at end of file +var _0x1eba=['address','exports','name','accountcode','stateTime','status','unknown'];(function(_0x53a7af,_0x1408a5){var _0x3cc7f6=function(_0x4bf101){while(--_0x4bf101){_0x53a7af['push'](_0x53a7af['shift']());}};_0x3cc7f6(++_0x1408a5);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x4f3b2d,_0x3bbf46){_0x4f3b2d=_0x4f3b2d-0x0;var _0x3dddfa=_0x1eba[_0x4f3b2d];return _0x3dddfa;};'use strict';function Telephone(_0x2de228){this['id']=_0x2de228['id']||0x0;this[_0xa1eb('0x0')]=_0x2de228[_0xa1eb('0x0')]||'';this[_0xa1eb('0x1')]=_0x2de228[_0xa1eb('0x1')]||'';this['state']='unknown';this[_0xa1eb('0x2')]=0x0;this[_0xa1eb('0x3')]=_0xa1eb('0x4');this[_0xa1eb('0x5')]='';}module[_0xa1eb('0x6')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index fd14683..5a2616a 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(_0x744f9a,_0x318e3a){var _0x5d8d17=function(_0x4b091f){while(--_0x4b091f){_0x744f9a['push'](_0x744f9a['shift']());}};_0x5d8d17(++_0x318e3a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file +var _0xb10b=['name','html'];(function(_0x26ce4f,_0x13189d){var _0x1779af=function(_0x3e2f71){while(--_0x3e2f71){_0x26ce4f['push'](_0x26ce4f['shift']());}};_0x1779af(++_0x13189d);}(_0xb10b,0x12a));var _0xbb10=function(_0x213518,_0x51e022){_0x213518=_0x213518-0x0;var _0x1baf75=_0xb10b[_0x213518];return _0x1baf75;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 276646f..429bd58 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 _0x0b0e=['channel','voice','status','AllConditions','AnyConditions','Actions','exports','name'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0b0e,0x187));var _0xe0b0=function(_0x3034ce,_0x1421b6){_0x3034ce=_0x3034ce-0x0;var _0x4bc0e3=_0x0b0e[_0x3034ce];return _0x4bc0e3;};'use strict';function Trigger(_0x29cd1e){this['id']=_0x29cd1e['id']||0x0;this['name']=_0x29cd1e[_0xe0b0('0x0')]||'';this['channel']=_0x29cd1e[_0xe0b0('0x1')]||_0xe0b0('0x2');this[_0xe0b0('0x3')]=_0x29cd1e[_0xe0b0('0x3')]||![];this[_0xe0b0('0x4')]=_0x29cd1e[_0xe0b0('0x4')]||[];this[_0xe0b0('0x5')]=_0x29cd1e[_0xe0b0('0x5')]||[];this[_0xe0b0('0x6')]=_0x29cd1e[_0xe0b0('0x6')]||[];}module[_0xe0b0('0x7')]=Trigger; \ No newline at end of file +var _0x1a85=['status','AllConditions','AnyConditions','Actions','name','channel'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x1a85,0x178));var _0x51a8=function(_0x154584,_0x421e12){_0x154584=_0x154584-0x0;var _0x969074=_0x1a85[_0x154584];return _0x969074;};'use strict';function Trigger(_0x4570ac){this['id']=_0x4570ac['id']||0x0;this['name']=_0x4570ac[_0x51a8('0x0')]||'';this[_0x51a8('0x1')]=_0x4570ac[_0x51a8('0x1')]||'voice';this['status']=_0x4570ac[_0x51a8('0x2')]||![];this[_0x51a8('0x3')]=_0x4570ac[_0x51a8('0x3')]||[];this['AnyConditions']=_0x4570ac[_0x51a8('0x4')]||[];this['Actions']=_0x4570ac[_0x51a8('0x5')]||[];}module['exports']=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index b0c1d43..4f451bc 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 _0xe834=['address','defaultuser','exports','active','name','unknown','stateTime','status','registry','port','domainport','refresh','stateRegistry'];(function(_0x2097e1,_0x4bce62){var _0x3e8963=function(_0x5daea6){while(--_0x5daea6){_0x2097e1['push'](_0x2097e1['shift']());}};_0x3e8963(++_0x4bce62);}(_0xe834,0xe0));var _0x4e83=function(_0x2cde2a,_0x4325c4){_0x2cde2a=_0x2cde2a-0x0;var _0x110f55=_0xe834[_0x2cde2a];return _0x110f55;};'use strict';function Trunk(_0x423aa1){this['id']=_0x423aa1['id']||0x0;this[_0x4e83('0x0')]=_0x423aa1['active']||![];this[_0x4e83('0x1')]=_0x423aa1[_0x4e83('0x1')]||'';this['state']=_0x4e83('0x2');this[_0x4e83('0x3')]=0x0;this[_0x4e83('0x4')]=_0x4e83('0x2');this[_0x4e83('0x5')]=_0x423aa1['registry']&&_0x423aa1[_0x4e83('0x5')]['indexOf'](':')?_0x423aa1[_0x4e83('0x5')]['split'](':')[0x0]:'';this['host']='';this[_0x4e83('0x6')]='';this['domain']='';this[_0x4e83('0x7')]='';this[_0x4e83('0x8')]='';this[_0x4e83('0x9')]='unknown';this['registrationtime']='';this[_0x4e83('0xa')]='';this[_0x4e83('0xb')]=_0x423aa1[_0x4e83('0xb')]||'';}module[_0x4e83('0xc')]=Trunk; \ No newline at end of file +var _0x560a=['stateRegistry','registrationtime','defaultuser','active','name','state','unknown','stateTime','status','registry','indexOf','split','host','port','domainport','refresh'];(function(_0x32f44a,_0x155480){var _0x4fad4b=function(_0x499a08){while(--_0x499a08){_0x32f44a['push'](_0x32f44a['shift']());}};_0x4fad4b(++_0x155480);}(_0x560a,0xd3));var _0xa560=function(_0x15db7e,_0x1333e4){_0x15db7e=_0x15db7e-0x0;var _0x3ef26d=_0x560a[_0x15db7e];return _0x3ef26d;};'use strict';function Trunk(_0xfbd15e){this['id']=_0xfbd15e['id']||0x0;this['active']=_0xfbd15e[_0xa560('0x0')]||![];this['name']=_0xfbd15e[_0xa560('0x1')]||'';this[_0xa560('0x2')]=_0xa560('0x3');this[_0xa560('0x4')]=0x0;this[_0xa560('0x5')]='unknown';this[_0xa560('0x6')]=_0xfbd15e[_0xa560('0x6')]&&_0xfbd15e[_0xa560('0x6')][_0xa560('0x7')](':')?_0xfbd15e[_0xa560('0x6')][_0xa560('0x8')](':')[0x0]:'';this[_0xa560('0x9')]='';this[_0xa560('0xa')]='';this['domain']='';this[_0xa560('0xb')]='';this[_0xa560('0xc')]='';this[_0xa560('0xd')]=_0xa560('0x3');this[_0xa560('0xe')]='';this['address']='';this[_0xa560('0xf')]=_0xfbd15e[_0xa560('0xf')]||'';}module['exports']=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 005d0ca..bb8c025 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 _0x76ce=['exports','exten','recordingFormat','mandatoryDisposition'];(function(_0x515a57,_0x286493){var _0x42a37c=function(_0x3ed7ad){while(--_0x3ed7ad){_0x515a57['push'](_0x515a57['shift']());}};_0x42a37c(++_0x286493);}(_0x76ce,0x161));var _0xe76c=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x76ce[_0x4243a3];return _0x1b2a33;};'use strict';function voiceExtension(_0xb9ba4){this['id']=_0xb9ba4['id']||0x0;this[_0xe76c('0x0')]=_0xb9ba4['exten']||'';this['recordingFormat']=_0xb9ba4[_0xe76c('0x1')]||'none';this['mandatoryDisposition']=_0xb9ba4[_0xe76c('0x2')]||![];}module[_0xe76c('0x3')]=voiceExtension; \ No newline at end of file +var _0xa445=['exports','exten','recordingFormat','mandatoryDisposition'];(function(_0x2da137,_0x31648e){var _0x47567d=function(_0x4c3cc3){while(--_0x4c3cc3){_0x2da137['push'](_0x2da137['shift']());}};_0x47567d(++_0x31648e);}(_0xa445,0x1a5));var _0x5a44=function(_0x5b626d,_0x315663){_0x5b626d=_0x5b626d-0x0;var _0x9b3026=_0xa445[_0x5b626d];return _0x9b3026;};'use strict';function voiceExtension(_0x3282c4){this['id']=_0x3282c4['id']||0x0;this[_0x5a44('0x0')]=_0x3282c4[_0x5a44('0x0')]||'';this[_0x5a44('0x1')]=_0x3282c4[_0x5a44('0x1')]||'none';this[_0x5a44('0x2')]=_0x3282c4[_0x5a44('0x2')]||![];}module[_0x5a44('0x3')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 196f420..8f36aca 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 _0x6657=['rrmemory','rrordered','wrandom','name','monitor_format','type','inbound','waiting','total','answered','sumDuration','sumBillable','unmanaged','abandoned','busy','invalid','loggedIn','onHold','paused','ringInUse','talking','unknown','acw','acwTimeout','autopause','sendMessageOneNotActive','message','statusMessage','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgTalktime','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCallToSecond','erlangBusyFactor','dialRecallMeTimeout','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','gsm','fewestcalls','leastrecent','linear','ringall','roundrobin'];(function(_0x52a769,_0x5868cb){var _0x451be4=function(_0x2ef98f){while(--_0x2ef98f){_0x52a769['push'](_0x52a769['shift']());}};_0x451be4(++_0x5868cb);}(_0x6657,0x17f));var _0x7665=function(_0x27ca80,_0x20a064){_0x27ca80=_0x27ca80-0x0;var _0x176f0a=_0x6657[_0x27ca80];return _0x176f0a;};'use strict';var monitorFormat={'wav':_0x7665('0x0'),'wav49':'wav49','gsm':_0x7665('0x1')};var strategy={'fewestcalls':_0x7665('0x2'),'leastrecent':_0x7665('0x3'),'linear':_0x7665('0x4'),'random':'random','ringall':_0x7665('0x5'),'rr':_0x7665('0x6'),'rrmemory':_0x7665('0x7'),'rrordered':_0x7665('0x8'),'wrandom':_0x7665('0x9')};function VoiceQueue(_0x28b410){this['id']=_0x28b410['id']||0x0;this[_0x7665('0xa')]=_0x28b410[_0x7665('0xa')]||'';this['monitor_format']=_0x28b410[_0x7665('0xb')]||'';this[_0x7665('0xc')]=_0x28b410[_0x7665('0xc')]||_0x7665('0xd');this[_0x7665('0xe')]=0x0;this[_0x7665('0xf')]=0x0;this[_0x7665('0x10')]=0x0;this[_0x7665('0x11')]=0x0;this['sumHoldTime']=0x0;this[_0x7665('0x12')]=0x0;this[_0x7665('0x13')]=0x0;this[_0x7665('0x14')]=0x0;this['available']=0x0;this[_0x7665('0x15')]=0x0;this['inUse']=0x0;this[_0x7665('0x16')]=0x0;this[_0x7665('0x17')]=0x0;this['notInUse']=0x0;this[_0x7665('0x18')]=0x0;this[_0x7665('0x19')]=0x0;this['ringing']=0x0;this[_0x7665('0x1a')]=0x0;this[_0x7665('0x1b')]=0x0;this['unavailable']=0x0;this[_0x7665('0x1c')]=0x0;this[_0x7665('0x1d')]=_0x28b410[_0x7665('0x1d')]||![];this[_0x7665('0x1e')]=_0x28b410[_0x7665('0x1e')]||0xa;this[_0x7665('0x1f')]=_0x28b410[_0x7665('0x1f')]||'no';this[_0x7665('0x20')]=!![];this[_0x7665('0x21')]='';this[_0x7665('0x22')]='';this[_0x7665('0x23')]=0x0;this[_0x7665('0x24')]=0x0;this[_0x7665('0x25')]=_0x28b410[_0x7665('0x25')]||null;this[_0x7665('0x26')]=_0x28b410[_0x7665('0x26')]?_0x28b410['dialGlobalInterval']:null;this[_0x7665('0x27')]=_0x28b410[_0x7665('0x27')];this['dialMethod']=_0x28b410[_0x7665('0x28')]||_0x7665('0x29');this[_0x7665('0x2a')]=_0x28b410[_0x7665('0x2a')]||0x0;this['dialLimitQueue']=_0x28b410[_0x7665('0x2b')]||0x0;this[_0x7665('0x2c')]=_0x28b410[_0x7665('0x2c')]||0x1;this[_0x7665('0x2d')]=_0x28b410[_0x7665('0x2d')]||'dropRate';this[_0x7665('0x2e')]=_0x28b410['dialPredictiveOptimizationPercentage']||0.03;this[_0x7665('0x2f')]=_0x28b410[_0x7665('0x2f')]||0x258;this['dialOriginateCallerIdName']=_0x28b410['dialOriginateCallerIdName']||_0x7665('0x30');this[_0x7665('0x31')]=_0x28b410['dialOriginateCallerIdNumber']||_0x7665('0x30');this[_0x7665('0x32')]=_0x28b410[_0x7665('0x32')]||0x1e;this['dialQueueOptions']=_0x28b410['dialQueueOptions']||'tTxX';this['dialQueueTimeout']=_0x28b410[_0x7665('0x33')]||0x3;this[_0x7665('0x34')]=_0x28b410[_0x7665('0x34')]||undefined;this['dialCongestionMaxRetry']=_0x28b410[_0x7665('0x35')]||0x3;this[_0x7665('0x36')]=_0x28b410['dialCongestionRetryFrequency']||0x96;this['dialBusyMaxRetry']=_0x28b410[_0x7665('0x37')]||0x3;this[_0x7665('0x38')]=_0x28b410[_0x7665('0x38')]||0x96;this[_0x7665('0x39')]=_0x28b410[_0x7665('0x39')]||0x3;this[_0x7665('0x3a')]=_0x28b410['dialNoAnswerRetryFrequency']||0x96;this[_0x7665('0x3b')]=_0x28b410['dialNoSuchNumberMaxRetry']||0x3;this['dialNoSuchNumberRetryFrequency']=_0x28b410[_0x7665('0x3c')]||0x96;this[_0x7665('0x3d')]=_0x28b410[_0x7665('0x3d')]||0x3;this[_0x7665('0x3e')]=_0x28b410[_0x7665('0x3e')]||0x96;this[_0x7665('0x3f')]=_0x28b410[_0x7665('0x3f')]||0x3;this[_0x7665('0x40')]=_0x28b410[_0x7665('0x40')]||0x96;this[_0x7665('0x41')]=_0x28b410[_0x7665('0x41')]||0x3;this[_0x7665('0x42')]=_0x28b410[_0x7665('0x42')]||0x96;this[_0x7665('0x43')]=_0x28b410[_0x7665('0x43')]||0x3;this[_0x7665('0x44')]=_0x28b410[_0x7665('0x44')]||0x96;this[_0x7665('0x45')]=_0x28b410[_0x7665('0x45')]||0x3;this['dialGlobalMaxRetry']=_0x28b410[_0x7665('0x46')]||0x4;this[_0x7665('0x47')]=_0x28b410[_0x7665('0x47')]?_0x28b410[_0x7665('0x47')]:undefined;this[_0x7665('0x48')]=_0x28b410[_0x7665('0x48')]?_0x28b410['TrunkBackup']:undefined;this[_0x7665('0x49')]=_0x28b410[_0x7665('0x49')]||undefined;this[_0x7665('0x4a')]=_0x28b410[_0x7665('0x4a')]?_0x28b410[_0x7665('0x4a')]:undefined;this['dialOrderByScheduledAt']=_0x28b410[_0x7665('0x4b')]||'DESC';this[_0x7665('0x4c')]=_0x28b410['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x7665('0x4d')]=_0x28b410[_0x7665('0x4d')]||undefined;this[_0x7665('0x4e')]=strategy[_0x28b410[_0x7665('0x4e')]];this[_0x7665('0x4f')]=!![];this[_0x7665('0x50')]=_0x28b410['dialAMDActive']||![];this[_0x7665('0x51')]=_0x28b410[_0x7665('0x51')];this[_0x7665('0x52')]=_0x28b410[_0x7665('0x52')];this['dialAMDAfterGreetingSilence']=_0x28b410[_0x7665('0x53')];this[_0x7665('0x54')]=_0x28b410[_0x7665('0x54')];this[_0x7665('0x55')]=_0x28b410[_0x7665('0x55')];this['dialAMDBetweenWordsSilence']=_0x28b410[_0x7665('0x56')];this[_0x7665('0x57')]=_0x28b410[_0x7665('0x57')];this[_0x7665('0x58')]=_0x28b410[_0x7665('0x58')];this[_0x7665('0x59')]=_0x28b410[_0x7665('0x59')];this[_0x7665('0x5a')]=0x0;this[_0x7665('0x5b')]=0x0;this[_0x7665('0x5c')]=_0x28b410['timeout'];this['outboundAnswerCallsDay']=0x0;this[_0x7665('0x5d')]=0x0;this[_0x7665('0x5e')]=0x0;this['outboundBusyCallsDay']=0x0;this['outboundCongestionCallsDay']=0x0;this[_0x7665('0x5f')]=0x0;this[_0x7665('0x60')]=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0x7665('0x61')]=0x0;this[_0x7665('0x62')]=0x0;this[_0x7665('0x63')]=0x0;this[_0x7665('0x64')]=0x0;this[_0x7665('0x65')]=0x0;this[_0x7665('0x66')]=0x0;this[_0x7665('0x67')]=undefined;this[_0x7665('0x68')]=undefined;this[_0x7665('0x69')]=undefined;this[_0x7665('0x6a')]=1.05;this[_0x7665('0x6b')]=0x0;this[_0x7665('0x6c')]=0x0;this[_0x7665('0x6d')]=0x0;this[_0x7665('0x6e')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0x7665('0x6f')]=0x0;this['predictiveIntervalPauses']=0x0;this[_0x7665('0x70')]=0x0;this[_0x7665('0x71')]=_0x28b410[_0x7665('0x72')]||0x14;this[_0x7665('0x73')]=_0x28b410[_0x7665('0x72')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0x7665('0x74')]=0x0;this[_0x7665('0x75')]=0x1;this['erlangCalls']=0x0;this[_0x7665('0x76')]=0x0;this['erlangAbandonmentRate']=0x0;this[_0x7665('0x77')]=0x0;this[_0x7665('0x78')]=_0x28b410[_0x7665('0x78')]||0x1e;this['dialRecallInQueue']=_0x28b410['dialRecallInQueue']||![];this[_0x7665('0x79')]=!!_0x28b410[_0x7665('0x79')]||![];this['dialPreviewRecallmeReminder']=!!_0x28b410[_0x7665('0x7a')]||![];this[_0x7665('0x7b')]=_0x28b410[_0x7665('0x7b')]||undefined;this[_0x7665('0x7c')]=_0x28b410[_0x7665('0x7c')]||![];this[_0x7665('0x7d')]=_0x28b410[_0x7665('0x7d')]||![];this[_0x7665('0xb')]=monitorFormat[_0x28b410[_0x7665('0xb')]]?monitorFormat[_0x28b410[_0x7665('0xb')]]:undefined;this[_0x7665('0x7e')]=_0x28b410['mandatoryDisposition']||![];this[_0x7665('0x7f')]=_0x28b410['mandatoryDispositionPause']?_0x28b410[_0x7665('0x7f')]:undefined;this[_0x7665('0x80')]=![];}module[_0x7665('0x81')]=VoiceQueue; \ No newline at end of file +var _0x39c7=['dialAgiAfterHangupAgent','monitor_format','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','wav49','gsm','fewestcalls','leastrecent','linear','random','roundrobin','rrmemory','rrordered','name','type','waiting','total','sumHoldTime','sumBillable','unmanaged','abandoned','available','busy','inUse','invalid','loggedIn','notInUse','onHold','paused','ringInUse','talking','unavailable','unknown','acw','acwTimeout','autopause','statusMessage','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','outboundRejectCallsDay','timeout','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startPredictive','handlePredictive','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient'];(function(_0x2b374c,_0x456710){var _0x5dd3ed=function(_0x41a249){while(--_0x41a249){_0x2b374c['push'](_0x2b374c['shift']());}};_0x5dd3ed(++_0x456710);}(_0x39c7,0x85));var _0x739c=function(_0x561ff7,_0x156137){_0x561ff7=_0x561ff7-0x0;var _0x33e6a7=_0x39c7[_0x561ff7];return _0x33e6a7;};'use strict';var monitorFormat={'wav':'wav','wav49':_0x739c('0x0'),'gsm':_0x739c('0x1')};var strategy={'fewestcalls':_0x739c('0x2'),'leastrecent':_0x739c('0x3'),'linear':_0x739c('0x4'),'random':_0x739c('0x5'),'ringall':'ringall','rr':_0x739c('0x6'),'rrmemory':_0x739c('0x7'),'rrordered':_0x739c('0x8'),'wrandom':'wrandom'};function VoiceQueue(_0x4c5030){this['id']=_0x4c5030['id']||0x0;this[_0x739c('0x9')]=_0x4c5030[_0x739c('0x9')]||'';this['monitor_format']=_0x4c5030['monitor_format']||'';this[_0x739c('0xa')]=_0x4c5030[_0x739c('0xa')]||'inbound';this[_0x739c('0xb')]=0x0;this[_0x739c('0xc')]=0x0;this['answered']=0x0;this['sumDuration']=0x0;this[_0x739c('0xd')]=0x0;this[_0x739c('0xe')]=0x0;this[_0x739c('0xf')]=0x0;this[_0x739c('0x10')]=0x0;this[_0x739c('0x11')]=0x0;this[_0x739c('0x12')]=0x0;this[_0x739c('0x13')]=0x0;this[_0x739c('0x14')]=0x0;this[_0x739c('0x15')]=0x0;this[_0x739c('0x16')]=0x0;this[_0x739c('0x17')]=0x0;this[_0x739c('0x18')]=0x0;this['ringing']=0x0;this[_0x739c('0x19')]=0x0;this[_0x739c('0x1a')]=0x0;this[_0x739c('0x1b')]=0x0;this[_0x739c('0x1c')]=0x0;this[_0x739c('0x1d')]=_0x4c5030[_0x739c('0x1d')]||![];this[_0x739c('0x1e')]=_0x4c5030[_0x739c('0x1e')]||0xa;this[_0x739c('0x1f')]=_0x4c5030[_0x739c('0x1f')]||'no';this['sendMessageOneNotActive']=!![];this['message']='';this[_0x739c('0x20')]='';this[_0x739c('0x21')]=0x0;this[_0x739c('0x22')]=0x0;this['dialTimezone']=_0x4c5030[_0x739c('0x23')]||null;this[_0x739c('0x24')]=_0x4c5030[_0x739c('0x24')]?_0x4c5030[_0x739c('0x24')]:null;this[_0x739c('0x25')]=_0x4c5030['dialActive'];this[_0x739c('0x26')]=_0x4c5030[_0x739c('0x26')]||_0x739c('0x27');this['dialLimitChannel']=_0x4c5030[_0x739c('0x28')]||0x0;this['dialLimitQueue']=_0x4c5030['dialLimitQueue']||0x0;this[_0x739c('0x29')]=_0x4c5030['dialPowerLevel']||0x1;this[_0x739c('0x2a')]=_0x4c5030[_0x739c('0x2a')]||'dropRate';this[_0x739c('0x2b')]=_0x4c5030['dialPredictiveOptimizationPercentage']||0.03;this[_0x739c('0x2c')]=_0x4c5030['dialPredictiveInterval']||0x258;this[_0x739c('0x2d')]=_0x4c5030[_0x739c('0x2d')]||_0x739c('0x2e');this[_0x739c('0x2f')]=_0x4c5030[_0x739c('0x2f')]||_0x739c('0x2e');this[_0x739c('0x30')]=_0x4c5030[_0x739c('0x30')]||0x1e;this['dialQueueOptions']=_0x4c5030[_0x739c('0x31')]||_0x739c('0x32');this['dialQueueTimeout']=_0x4c5030[_0x739c('0x33')]||0x3;this['dialQueueProject']=_0x4c5030['dialQueueProject']||undefined;this[_0x739c('0x34')]=_0x4c5030[_0x739c('0x34')]||0x3;this[_0x739c('0x35')]=_0x4c5030[_0x739c('0x35')]||0x96;this[_0x739c('0x36')]=_0x4c5030[_0x739c('0x36')]||0x3;this[_0x739c('0x37')]=_0x4c5030['dialBusyRetryFrequency']||0x96;this[_0x739c('0x38')]=_0x4c5030[_0x739c('0x38')]||0x3;this[_0x739c('0x39')]=_0x4c5030[_0x739c('0x39')]||0x96;this[_0x739c('0x3a')]=_0x4c5030[_0x739c('0x3a')]||0x3;this[_0x739c('0x3b')]=_0x4c5030['dialNoSuchNumberRetryFrequency']||0x96;this['dialDropMaxRetry']=_0x4c5030['dialDropMaxRetry']||0x3;this['dialDropRetryFrequency']=_0x4c5030[_0x739c('0x3c')]||0x96;this[_0x739c('0x3d')]=_0x4c5030[_0x739c('0x3d')]||0x3;this[_0x739c('0x3e')]=_0x4c5030[_0x739c('0x3e')]||0x96;this[_0x739c('0x3f')]=_0x4c5030[_0x739c('0x3f')]||0x3;this[_0x739c('0x40')]=_0x4c5030[_0x739c('0x40')]||0x96;this[_0x739c('0x41')]=_0x4c5030[_0x739c('0x41')]||0x3;this[_0x739c('0x42')]=_0x4c5030[_0x739c('0x42')]||0x96;this[_0x739c('0x43')]=_0x4c5030[_0x739c('0x43')]||0x3;this[_0x739c('0x44')]=_0x4c5030[_0x739c('0x44')]||0x4;this[_0x739c('0x45')]=_0x4c5030[_0x739c('0x45')]?_0x4c5030[_0x739c('0x45')]:undefined;this[_0x739c('0x46')]=_0x4c5030[_0x739c('0x46')]?_0x4c5030[_0x739c('0x46')]:undefined;this[_0x739c('0x47')]=_0x4c5030[_0x739c('0x47')]||undefined;this[_0x739c('0x48')]=_0x4c5030[_0x739c('0x48')]?_0x4c5030[_0x739c('0x48')]:undefined;this[_0x739c('0x49')]=_0x4c5030[_0x739c('0x49')]||_0x739c('0x4a');this[_0x739c('0x4b')]=_0x4c5030[_0x739c('0x4b')]||undefined;this[_0x739c('0x4c')]=_0x4c5030[_0x739c('0x4c')]||undefined;this['strategy']=strategy[_0x4c5030[_0x739c('0x4d')]];this[_0x739c('0x4e')]=!![];this['dialAMDActive']=_0x4c5030[_0x739c('0x4f')]||![];this[_0x739c('0x50')]=_0x4c5030['dialAMDInitialSilence'];this['dialAMDGreeting']=_0x4c5030[_0x739c('0x51')];this[_0x739c('0x52')]=_0x4c5030['dialAMDAfterGreetingSilence'];this[_0x739c('0x53')]=_0x4c5030[_0x739c('0x53')];this[_0x739c('0x54')]=_0x4c5030[_0x739c('0x54')];this[_0x739c('0x55')]=_0x4c5030['dialAMDBetweenWordsSilence'];this[_0x739c('0x56')]=_0x4c5030[_0x739c('0x56')];this['dialAMDSilenceThreshold']=_0x4c5030['dialAMDSilenceThreshold'];this['dialAMDMaximumWordLength']=_0x4c5030[_0x739c('0x57')];this[_0x739c('0x58')]=0x0;this['pTalking']=0x0;this[_0x739c('0x59')]=_0x4c5030['timeout'];this['outboundAnswerCallsDay']=0x0;this[_0x739c('0x5a')]=0x0;this[_0x739c('0x5b')]=0x0;this[_0x739c('0x5c')]=0x0;this[_0x739c('0x5d')]=0x0;this[_0x739c('0x5e')]=0x0;this[_0x739c('0x5f')]=0x0;this[_0x739c('0x60')]=0x0;this[_0x739c('0x61')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0x739c('0x62')]=0x0;this[_0x739c('0x63')]=0x0;this[_0x739c('0x64')]=0x0;this[_0x739c('0x65')]=0x0;this['startProgressive']=undefined;this[_0x739c('0x66')]=undefined;this[_0x739c('0x67')]=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this[_0x739c('0x68')]=0x0;this[_0x739c('0x69')]=0x0;this[_0x739c('0x6a')]=0x0;this[_0x739c('0x6b')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0x739c('0x6c')]=0x0;this[_0x739c('0x6d')]=0x0;this[_0x739c('0x6e')]=0x0;this[_0x739c('0x6f')]=_0x4c5030['dialPredictiveIntervalMaxThreshold']||0x14;this[_0x739c('0x70')]=_0x4c5030['dialPredictiveIntervalMaxThreshold']||0xa;this['predictiveIntervalErlangCalls']=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this[_0x739c('0x71')]=0x1;this[_0x739c('0x72')]=0x0;this[_0x739c('0x73')]=0x0;this[_0x739c('0x74')]=0x0;this[_0x739c('0x75')]=0x0;this[_0x739c('0x76')]=_0x4c5030['dialRecallMeTimeout']||0x1e;this['dialRecallInQueue']=_0x4c5030['dialRecallInQueue']||![];this[_0x739c('0x77')]=!!_0x4c5030[_0x739c('0x77')]||![];this['dialPreviewRecallmeReminder']=!!_0x4c5030[_0x739c('0x78')]||![];this['dialQueueProject2']=_0x4c5030[_0x739c('0x79')]||undefined;this['dialAgiAfterHangupClient']=_0x4c5030[_0x739c('0x7a')]||![];this[_0x739c('0x7b')]=_0x4c5030[_0x739c('0x7b')]||![];this['monitor_format']=monitorFormat[_0x4c5030[_0x739c('0x7c')]]?monitorFormat[_0x4c5030[_0x739c('0x7c')]]:undefined;this['mandatoryDisposition']=_0x4c5030[_0x739c('0x7d')]||![];this[_0x739c('0x7e')]=_0x4c5030[_0x739c('0x7e')]?_0x4c5030[_0x739c('0x7e')]:undefined;this[_0x739c('0x7f')]=![];}module['exports']=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index dbe8e24..2c55ead 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 _0xe132=['preview','exports','available','loggedInDb','paused','ringing','talking','waiting','answered','inUse','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','pTalking','sumBillable','sumDuration','total','name','strategy','abandoned','busy','invalid','loggedIn','onHold','notInUse','ringInUse','type','unavailable','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundOriginateFailureCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','prototype','loggedin','callers','SIP/','incall','status','booked','keys','length','queue','dialer','exten','compareToInboundQueue','some','compareToOutboundQueue','updateReportFromOutboundQueue'];(function(_0x4808d3,_0x3353c6){var _0x3057fa=function(_0x535a58){while(--_0x535a58){_0x4808d3['push'](_0x4808d3['shift']());}};_0x3057fa(++_0x3353c6);}(_0xe132,0x162));var _0x2e13=function(_0x1b64c1,_0x54627b){_0x1b64c1=_0x1b64c1-0x0;var _0x2f6725=_0xe132[_0x1b64c1];return _0x2f6725;};'use strict';var INBOUND_COUNTERS=[_0x2e13('0x0'),'loggedIn',_0x2e13('0x1'),_0x2e13('0x2'),_0x2e13('0x3'),_0x2e13('0x4'),_0x2e13('0x5')];var OUTBOUND_COUNTERS=['available',_0x2e13('0x6'),_0x2e13('0x7'),'loggedIn','loggedInDb',_0x2e13('0x8'),_0x2e13('0x9'),_0x2e13('0xa'),_0x2e13('0xb'),_0x2e13('0xc'),_0x2e13('0xd'),_0x2e13('0xe'),_0x2e13('0xf'),_0x2e13('0x10'),_0x2e13('0x11'),'outboundUnknownCallsDay',_0x2e13('0x2'),_0x2e13('0x12'),_0x2e13('0x4'),_0x2e13('0x13'),_0x2e13('0x14'),_0x2e13('0x15'),_0x2e13('0x5')];function VoiceQueueSummary(_0x5f4ee2){this['id']=_0x5f4ee2['id'];this[_0x2e13('0x16')]=_0x5f4ee2[_0x2e13('0x16')];this[_0x2e13('0x17')]=_0x5f4ee2[_0x2e13('0x17')];this[_0x2e13('0x18')]=_0x5f4ee2[_0x2e13('0x18')]||0x0;this[_0x2e13('0x6')]=_0x5f4ee2['answered']||0x0;this[_0x2e13('0x0')]=_0x5f4ee2[_0x2e13('0x0')]||0x0;this[_0x2e13('0x19')]=_0x5f4ee2['busy']||0x0;this[_0x2e13('0x7')]=_0x5f4ee2[_0x2e13('0x7')]||0x0;this[_0x2e13('0x1a')]=_0x5f4ee2['invalid']||0x0;this[_0x2e13('0x1b')]=_0x5f4ee2[_0x2e13('0x1b')]||0x0;this[_0x2e13('0x1')]=_0x5f4ee2['loggedInDb']||0x0;this['onHold']=_0x5f4ee2[_0x2e13('0x1c')]||0x0;this[_0x2e13('0x1d')]=_0x5f4ee2[_0x2e13('0x1d')]||0x0;this[_0x2e13('0x2')]=_0x5f4ee2[_0x2e13('0x2')]||0x0;this[_0x2e13('0x3')]=_0x5f4ee2[_0x2e13('0x3')]||0x0;this[_0x2e13('0x1e')]=_0x5f4ee2['ringInUse'];this[_0x2e13('0x13')]=_0x5f4ee2[_0x2e13('0x13')];this[_0x2e13('0x14')]=_0x5f4ee2[_0x2e13('0x14')];this['sumHoldTime']=_0x5f4ee2['sumHoldTime']||0x0;this[_0x2e13('0x4')]=_0x5f4ee2[_0x2e13('0x4')]||0x0;this['total']=_0x5f4ee2['total']||0x0;this['type']=_0x5f4ee2[_0x2e13('0x1f')];this[_0x2e13('0x20')]=_0x5f4ee2[_0x2e13('0x20')]||0x0;this[_0x2e13('0x21')]=_0x5f4ee2[_0x2e13('0x21')]||0x0;this[_0x2e13('0x22')]=_0x5f4ee2['unmanaged']||0x0;this[_0x2e13('0x5')]=_0x5f4ee2[_0x2e13('0x5')]||0x0;if(_0x5f4ee2[_0x2e13('0x1f')]===_0x2e13('0x23')){this[_0x2e13('0x12')]=_0x5f4ee2[_0x2e13('0x12')]||0x0;this['dialActive']=_0x5f4ee2[_0x2e13('0x24')];this[_0x2e13('0x25')]=_0x5f4ee2['dialMethod'];this['dialOriginateCallerIdName']=_0x5f4ee2[_0x2e13('0x26')];this[_0x2e13('0x27')]=_0x5f4ee2[_0x2e13('0x27')];this['dialOriginateTimeout']=_0x5f4ee2[_0x2e13('0x28')];this[_0x2e13('0x29')]=_0x5f4ee2[_0x2e13('0x29')];this[_0x2e13('0x2a')]=_0x5f4ee2[_0x2e13('0x2a')];this[_0x2e13('0x2b')]=_0x5f4ee2[_0x2e13('0x2b')];this[_0x2e13('0xa')]=_0x5f4ee2[_0x2e13('0xa')];this[_0x2e13('0xb')]=_0x5f4ee2[_0x2e13('0xb')];this[_0x2e13('0xc')]=_0x5f4ee2[_0x2e13('0xc')];this[_0x2e13('0xd')]=_0x5f4ee2[_0x2e13('0xd')];this['outboundDropCallsDayACS']=_0x5f4ee2[_0x2e13('0x2c')];this[_0x2e13('0x2d')]=_0x5f4ee2[_0x2e13('0x2d')];this['outboundDropCallsDayTimeout']=_0x5f4ee2['outboundDropCallsDayTimeout'];this[_0x2e13('0xe')]=_0x5f4ee2[_0x2e13('0xe')];this[_0x2e13('0xf')]=_0x5f4ee2[_0x2e13('0xf')];this[_0x2e13('0x2e')]=_0x5f4ee2[_0x2e13('0x2e')];this['outboundReCallsDay']=_0x5f4ee2['outboundReCallsDay'];this[_0x2e13('0x11')]=_0x5f4ee2[_0x2e13('0x11')];this[_0x2e13('0x2f')]=_0x5f4ee2[_0x2e13('0x2f')];this[_0x2e13('0x30')]=_0x5f4ee2[_0x2e13('0x30')];this[_0x2e13('0x31')]=_0x5f4ee2[_0x2e13('0x31')];this['predictiveIntervalAvgTalktime']=_0x5f4ee2[_0x2e13('0x32')];this[_0x2e13('0x33')]=_0x5f4ee2[_0x2e13('0x33')];this[_0x2e13('0x34')]=_0x5f4ee2[_0x2e13('0x34')];this['predictiveIntervalErlangCalls']=_0x5f4ee2[_0x2e13('0x35')];this[_0x2e13('0x36')]=_0x5f4ee2['predictiveIntervalErlangCallsDroppedCalls'];this[_0x2e13('0x37')]=_0x5f4ee2[_0x2e13('0x37')];this[_0x2e13('0x38')]=_0x5f4ee2['predictiveIntervalMultiplicativeFactor'];this[_0x2e13('0x39')]=_0x5f4ee2[_0x2e13('0x39')];this['predictiveIntervalAvailable']=_0x5f4ee2[_0x2e13('0x3a')];this[_0x2e13('0x3b')]=_0x5f4ee2['predictiveIntervalTotalCalls'];this[_0x2e13('0x8')]=_0x5f4ee2['originated'];this[_0x2e13('0x3c')]=_0x5f4ee2[_0x2e13('0x3c')];this['erlangCallToSecond']=_0x5f4ee2[_0x2e13('0x3d')];this[_0x2e13('0x3e')]=_0x5f4ee2[_0x2e13('0x3e')];this[_0x2e13('0x3f')]=_0x5f4ee2[_0x2e13('0x3f')];this[_0x2e13('0x40')]=_0x5f4ee2[_0x2e13('0x40')];this[_0x2e13('0x41')]=_0x5f4ee2[_0x2e13('0x41')];this[_0x2e13('0x42')]=_0x5f4ee2['message'];this[_0x2e13('0x43')]=_0x5f4ee2[_0x2e13('0x43')];}if(_0x5f4ee2[_0x2e13('0x44')]){this[_0x2e13('0x44')]={'id':_0x5f4ee2[_0x2e13('0x44')]['id'],'name':_0x5f4ee2['Trunk'][_0x2e13('0x16')],'active':_0x5f4ee2['Trunk'][_0x2e13('0x45')],'callerid':_0x5f4ee2[_0x2e13('0x44')]['callerid']};}}VoiceQueueSummary[_0x2e13('0x46')]['createReport']=function(_0x73f6a2,_0x790564,_0x3f473f,_0x230f94){this[_0x2e13('0x1')]=0x0;this['talking']=0x0;this[_0x2e13('0x2')]=0x0;this['unknown']=0x0;this[_0x2e13('0x1d')]=0x0;this[_0x2e13('0x7')]=0x0;this[_0x2e13('0x19')]=0x0;this[_0x2e13('0x1a')]=0x0;this[_0x2e13('0x20')]=0x0;this[_0x2e13('0x3')]=0x0;this['ringInUse']=0x0;this['onHold']=0x0;if(_0x3f473f){if(_0x3f473f[_0x2e13('0x0')]){this[_0x2e13('0x0')]=Number(_0x3f473f['available']);}if(_0x3f473f[_0x2e13('0x47')]){this[_0x2e13('0x1b')]=Number(_0x3f473f[_0x2e13('0x47')]);}if(_0x3f473f['callers']){this['waiting']=Number(_0x3f473f[_0x2e13('0x48')]);}}for(var _0x59ae24=0x0;_0x59ae24<_0x73f6a2['length'];_0x59ae24++){var _0x8a6f35=_0x790564[_0x2e13('0x49')+_0x73f6a2[_0x59ae24][_0x2e13('0x16')]];if(_0x8a6f35&&_0x8a6f35['online']){this[_0x2e13('0x1')]+=0x1;}if(_0x73f6a2[_0x59ae24][_0x2e13('0x4a')]==='1'){this[_0x2e13('0x4')]+=0x1;}if(_0x73f6a2[_0x59ae24][_0x2e13('0x2')]==='1'&&!['2','7','8']['includes'](_0x73f6a2[_0x59ae24][_0x2e13('0x4b')])){this['paused']+=0x1;}switch(_0x73f6a2[_0x59ae24][_0x2e13('0x4b')]){case'0':this[_0x2e13('0x21')]+=0x1;break;case'1':this[_0x2e13('0x1d')]+=0x1;break;case'2':this[_0x2e13('0x7')]+=0x1;break;case'3':this[_0x2e13('0x19')]+=0x1;break;case'4':this[_0x2e13('0x1a')]+=0x1;break;case'5':this[_0x2e13('0x20')]+=0x1;break;case'6':this[_0x2e13('0x3')]+=0x1;break;case'7':this[_0x2e13('0x1e')]+=0x1;break;case'8':this[_0x2e13('0x1c')]+=0x1;break;}}if(this['dialMethod']===_0x2e13('0x4c')){var _0x10352e=Object[_0x2e13('0x4d')](_0x230f94);for(var _0x1d13ec=0x0;_0x1d13ec<_0x10352e[_0x2e13('0x4e')];_0x1d13ec++){var _0xcc5495=_0x10352e[_0x1d13ec];var _0x2cd6d4=_0x230f94[_0xcc5495];if(_0x2cd6d4[_0x2e13('0x4f')]===this[_0x2e13('0x16')]&&_0x2cd6d4[_0x2e13('0x1f')]===_0x2e13('0x50')&&_0x2cd6d4[_0x2e13('0x51')]==='xcally-motion-preview'){this[_0x2e13('0x4')]+=0x1;}}if(this[_0x2e13('0x4')]>this[_0x2e13('0x7')]){this[_0x2e13('0x4')]=this[_0x2e13('0x7')];}this[_0x2e13('0x12')]=0x0;}return this;};VoiceQueueSummary['prototype'][_0x2e13('0x52')]=function(_0x1682ad){var _0xb63ed4=![];if(_0x1682ad){_0xb63ed4=INBOUND_COUNTERS[_0x2e13('0x53')](function(_0x2a9587){return this[_0x2a9587]!==_0x1682ad[_0x2a9587];},this);}return _0xb63ed4;};VoiceQueueSummary[_0x2e13('0x46')][_0x2e13('0x54')]=function(_0x5aefda){var _0x2ee749=![];var _0x3a1a9c=![];var _0x252b14=![];if(_0x5aefda){_0x2ee749=this['dialMethod']!==_0x5aefda[_0x2e13('0x25')]||this[_0x2e13('0x24')]!==_0x5aefda['dialActive']||this[_0x2e13('0x42')]!==_0x5aefda['message']||this['statusMessage']!==_0x5aefda[_0x2e13('0x43')];_0x3a1a9c=OUTBOUND_COUNTERS[_0x2e13('0x53')](function(_0x448680){return this[_0x448680]!==_0x5aefda[_0x448680];},this);if(this[_0x2e13('0x44')]&&_0x5aefda[_0x2e13('0x44')]){_0x252b14=this['Trunk'][_0x2e13('0x16')]!==_0x5aefda['Trunk']['name']||this[_0x2e13('0x44')]['active']!==_0x5aefda[_0x2e13('0x44')][_0x2e13('0x45')];}}return _0x2ee749||_0x3a1a9c||_0x252b14;};VoiceQueueSummary[_0x2e13('0x46')][_0x2e13('0x55')]=function(_0x3dbc75){this[_0x2e13('0x6')]=_0x3dbc75[_0x2e13('0x6')];this[_0x2e13('0x42')]=_0x3dbc75['message'];this[_0x2e13('0x43')]=_0x3dbc75[_0x2e13('0x43')];this['originated']=_0x3dbc75['originated'];this[_0x2e13('0x9')]=_0x3dbc75[_0x2e13('0x9')];this[_0x2e13('0xa')]=_0x3dbc75['outboundAnswerCallsDay'];this[_0x2e13('0xb')]=_0x3dbc75['outboundBlacklistCallsDay'];this[_0x2e13('0xc')]=_0x3dbc75[_0x2e13('0xc')];this[_0x2e13('0xd')]=_0x3dbc75['outboundCongestionCallsDay'];this[_0x2e13('0xe')]=_0x3dbc75['outboundNoAnswerCallsDay'];this[_0x2e13('0xf')]=_0x3dbc75[_0x2e13('0xf')];this[_0x2e13('0x10')]=_0x3dbc75[_0x2e13('0x10')];this[_0x2e13('0x11')]=_0x3dbc75[_0x2e13('0x11')];this['outboundUnknownCallsDay']=_0x3dbc75[_0x2e13('0x2f')];this[_0x2e13('0x13')]=_0x3dbc75['sumBillable'];this['sumDuration']=_0x3dbc75[_0x2e13('0x14')];this[_0x2e13('0x15')]=_0x3dbc75['total'];if(this['dialMethod']===_0x2e13('0x56')){this['pTalking']=_0x3dbc75[_0x2e13('0x12')];}};module[_0x2e13('0x57')]=VoiceQueueSummary; \ No newline at end of file +var _0x8efc=['unavailable','unknown','unmanaged','outbound','pTalking','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','temp','outboundAnswerAgiCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startProgressive','message','statusMessage','Trunk','active','callerid','loggedin','callers','length','SIP/','online','includes','status','keys','queue','dialer','xcally-motion-preview','prototype','compareToInboundQueue','compareToOutboundQueue','dialActive','outboundNoSuchCallsDay','preview','exports','loggedInDb','ringing','waiting','available','loggedIn','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundNoAnswerCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','paused','sumDuration','total','name','strategy','abandoned','answered','busy','inUse','invalid','onHold','notInUse','ringInUse','sumBillable','sumHoldTime','talking','type'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0x8efc,0x8f));var _0xc8ef=function(_0x55abd9,_0x1148af){_0x55abd9=_0x55abd9-0x0;var _0x3e5669=_0x8efc[_0x55abd9];return _0x3e5669;};'use strict';var INBOUND_COUNTERS=['available','loggedIn',_0xc8ef('0x0'),'paused',_0xc8ef('0x1'),'talking',_0xc8ef('0x2')];var OUTBOUND_COUNTERS=[_0xc8ef('0x3'),'answered','inUse',_0xc8ef('0x4'),'loggedInDb',_0xc8ef('0x5'),_0xc8ef('0x6'),_0xc8ef('0x7'),_0xc8ef('0x8'),_0xc8ef('0x9'),'outboundCongestionCallsDay',_0xc8ef('0xa'),'outboundNoSuchCallsDay',_0xc8ef('0xb'),_0xc8ef('0xc'),_0xc8ef('0xd'),_0xc8ef('0xe'),'pTalking','talking','sumBillable',_0xc8ef('0xf'),_0xc8ef('0x10'),_0xc8ef('0x2')];function VoiceQueueSummary(_0x3518cd){this['id']=_0x3518cd['id'];this['name']=_0x3518cd[_0xc8ef('0x11')];this[_0xc8ef('0x12')]=_0x3518cd[_0xc8ef('0x12')];this[_0xc8ef('0x13')]=_0x3518cd[_0xc8ef('0x13')]||0x0;this[_0xc8ef('0x14')]=_0x3518cd[_0xc8ef('0x14')]||0x0;this[_0xc8ef('0x3')]=_0x3518cd['available']||0x0;this['busy']=_0x3518cd[_0xc8ef('0x15')]||0x0;this[_0xc8ef('0x16')]=_0x3518cd[_0xc8ef('0x16')]||0x0;this[_0xc8ef('0x17')]=_0x3518cd[_0xc8ef('0x17')]||0x0;this[_0xc8ef('0x4')]=_0x3518cd[_0xc8ef('0x4')]||0x0;this[_0xc8ef('0x0')]=_0x3518cd['loggedInDb']||0x0;this['onHold']=_0x3518cd[_0xc8ef('0x18')]||0x0;this[_0xc8ef('0x19')]=_0x3518cd[_0xc8ef('0x19')]||0x0;this[_0xc8ef('0xe')]=_0x3518cd['paused']||0x0;this['ringing']=_0x3518cd['ringing']||0x0;this['ringInUse']=_0x3518cd[_0xc8ef('0x1a')];this['sumBillable']=_0x3518cd[_0xc8ef('0x1b')];this[_0xc8ef('0xf')]=_0x3518cd[_0xc8ef('0xf')];this['sumHoldTime']=_0x3518cd[_0xc8ef('0x1c')]||0x0;this[_0xc8ef('0x1d')]=_0x3518cd[_0xc8ef('0x1d')]||0x0;this[_0xc8ef('0x10')]=_0x3518cd[_0xc8ef('0x10')]||0x0;this[_0xc8ef('0x1e')]=_0x3518cd[_0xc8ef('0x1e')];this[_0xc8ef('0x1f')]=_0x3518cd[_0xc8ef('0x1f')]||0x0;this[_0xc8ef('0x20')]=_0x3518cd[_0xc8ef('0x20')]||0x0;this[_0xc8ef('0x21')]=_0x3518cd['unmanaged']||0x0;this['waiting']=_0x3518cd[_0xc8ef('0x2')]||0x0;if(_0x3518cd[_0xc8ef('0x1e')]===_0xc8ef('0x22')){this[_0xc8ef('0x23')]=_0x3518cd[_0xc8ef('0x23')]||0x0;this['dialActive']=_0x3518cd['dialActive'];this[_0xc8ef('0x24')]=_0x3518cd[_0xc8ef('0x24')];this[_0xc8ef('0x25')]=_0x3518cd['dialOriginateCallerIdName'];this[_0xc8ef('0x26')]=_0x3518cd[_0xc8ef('0x26')];this[_0xc8ef('0x27')]=_0x3518cd[_0xc8ef('0x27')];this['dialPrefix']=_0x3518cd['dialPrefix'];this[_0xc8ef('0x28')]=_0x3518cd[_0xc8ef('0x28')];this[_0xc8ef('0x29')]=_0x3518cd['outboundAnswerAgiCallsDay'];this[_0xc8ef('0x7')]=_0x3518cd[_0xc8ef('0x7')];this[_0xc8ef('0x8')]=_0x3518cd['outboundBlacklistCallsDay'];this[_0xc8ef('0x9')]=_0x3518cd[_0xc8ef('0x9')];this[_0xc8ef('0x2a')]=_0x3518cd[_0xc8ef('0x2a')];this[_0xc8ef('0x2b')]=_0x3518cd['outboundDropCallsDayACS'];this[_0xc8ef('0x2c')]=_0x3518cd['outboundDropCallsDayCallersExit'];this['outboundDropCallsDayTimeout']=_0x3518cd[_0xc8ef('0x2d')];this['outboundNoAnswerCallsDay']=_0x3518cd[_0xc8ef('0xa')];this['outboundNoSuchCallsDay']=_0x3518cd['outboundNoSuchCallsDay'];this[_0xc8ef('0x2e')]=_0x3518cd[_0xc8ef('0x2e')];this[_0xc8ef('0xb')]=_0x3518cd[_0xc8ef('0xb')];this[_0xc8ef('0xc')]=_0x3518cd[_0xc8ef('0xc')];this['outboundUnknownCallsDay']=_0x3518cd[_0xc8ef('0xd')];this[_0xc8ef('0x2f')]=_0x3518cd['predictiveIntervalAnsweredCalls'];this[_0xc8ef('0x30')]=_0x3518cd['predictiveIntervalAvgHoldtime'];this['predictiveIntervalAvgTalktime']=_0x3518cd[_0xc8ef('0x31')];this[_0xc8ef('0x32')]=_0x3518cd[_0xc8ef('0x32')];this[_0xc8ef('0x33')]=_0x3518cd['predictiveIntervalDroppedCallsTimeout'];this[_0xc8ef('0x34')]=_0x3518cd[_0xc8ef('0x34')];this[_0xc8ef('0x35')]=_0x3518cd[_0xc8ef('0x35')];this[_0xc8ef('0x36')]=_0x3518cd[_0xc8ef('0x36')];this[_0xc8ef('0x37')]=_0x3518cd['predictiveIntervalMultiplicativeFactor'];this[_0xc8ef('0x38')]=_0x3518cd['predictiveIntervalPauses'];this['predictiveIntervalAvailable']=_0x3518cd[_0xc8ef('0x39')];this[_0xc8ef('0x3a')]=_0x3518cd[_0xc8ef('0x3a')];this[_0xc8ef('0x5')]=_0x3518cd[_0xc8ef('0x5')];this[_0xc8ef('0x3b')]=_0x3518cd[_0xc8ef('0x3b')];this[_0xc8ef('0x3c')]=_0x3518cd[_0xc8ef('0x3c')];this[_0xc8ef('0x3d')]=_0x3518cd[_0xc8ef('0x3d')];this[_0xc8ef('0x3e')]=_0x3518cd[_0xc8ef('0x3e')];this['startPredictive']=_0x3518cd['startPredictive'];this[_0xc8ef('0x3f')]=_0x3518cd[_0xc8ef('0x3f')];this[_0xc8ef('0x40')]=_0x3518cd[_0xc8ef('0x40')];this[_0xc8ef('0x41')]=_0x3518cd['statusMessage'];}if(_0x3518cd[_0xc8ef('0x42')]){this[_0xc8ef('0x42')]={'id':_0x3518cd['Trunk']['id'],'name':_0x3518cd[_0xc8ef('0x42')][_0xc8ef('0x11')],'active':_0x3518cd[_0xc8ef('0x42')][_0xc8ef('0x43')],'callerid':_0x3518cd[_0xc8ef('0x42')][_0xc8ef('0x44')]};}}VoiceQueueSummary['prototype']['createReport']=function(_0x23d924,_0x4698f6,_0x14fdc8,_0x1d59b1){this['loggedInDb']=0x0;this[_0xc8ef('0x1d')]=0x0;this[_0xc8ef('0xe')]=0x0;this['unknown']=0x0;this[_0xc8ef('0x19')]=0x0;this[_0xc8ef('0x16')]=0x0;this[_0xc8ef('0x15')]=0x0;this[_0xc8ef('0x17')]=0x0;this['unavailable']=0x0;this[_0xc8ef('0x1')]=0x0;this[_0xc8ef('0x1a')]=0x0;this[_0xc8ef('0x18')]=0x0;if(_0x14fdc8){if(_0x14fdc8[_0xc8ef('0x3')]){this[_0xc8ef('0x3')]=Number(_0x14fdc8[_0xc8ef('0x3')]);}if(_0x14fdc8[_0xc8ef('0x45')]){this[_0xc8ef('0x4')]=Number(_0x14fdc8[_0xc8ef('0x45')]);}if(_0x14fdc8[_0xc8ef('0x46')]){this[_0xc8ef('0x2')]=Number(_0x14fdc8[_0xc8ef('0x46')]);}}for(var _0x2667a4=0x0;_0x2667a4<_0x23d924[_0xc8ef('0x47')];_0x2667a4++){var _0x10aa0d=_0x4698f6[_0xc8ef('0x48')+_0x23d924[_0x2667a4]['name']];if(_0x10aa0d&&_0x10aa0d[_0xc8ef('0x49')]){this[_0xc8ef('0x0')]+=0x1;}if(_0x23d924[_0x2667a4]['incall']==='1'){this[_0xc8ef('0x1d')]+=0x1;}if(_0x23d924[_0x2667a4]['paused']==='1'&&!['2','7','8'][_0xc8ef('0x4a')](_0x23d924[_0x2667a4]['status'])){this[_0xc8ef('0xe')]+=0x1;}switch(_0x23d924[_0x2667a4][_0xc8ef('0x4b')]){case'0':this['unknown']+=0x1;break;case'1':this['notInUse']+=0x1;break;case'2':this['inUse']+=0x1;break;case'3':this['busy']+=0x1;break;case'4':this[_0xc8ef('0x17')]+=0x1;break;case'5':this[_0xc8ef('0x1f')]+=0x1;break;case'6':this[_0xc8ef('0x1')]+=0x1;break;case'7':this[_0xc8ef('0x1a')]+=0x1;break;case'8':this[_0xc8ef('0x18')]+=0x1;break;}}if(this['dialMethod']==='booked'){var _0x55063d=Object[_0xc8ef('0x4c')](_0x1d59b1);for(var _0x3517a8=0x0;_0x3517a8<_0x55063d[_0xc8ef('0x47')];_0x3517a8++){var _0x427e72=_0x55063d[_0x3517a8];var _0x331f3b=_0x1d59b1[_0x427e72];if(_0x331f3b[_0xc8ef('0x4d')]===this['name']&&_0x331f3b[_0xc8ef('0x1e')]===_0xc8ef('0x4e')&&_0x331f3b['exten']===_0xc8ef('0x4f')){this['talking']+=0x1;}}if(this[_0xc8ef('0x1d')]>this['inUse']){this['talking']=this[_0xc8ef('0x16')];}this['pTalking']=0x0;}return this;};VoiceQueueSummary[_0xc8ef('0x50')][_0xc8ef('0x51')]=function(_0x71fa5){var _0x226713=![];if(_0x71fa5){_0x226713=INBOUND_COUNTERS['some'](function(_0x2a15fb){return this[_0x2a15fb]!==_0x71fa5[_0x2a15fb];},this);}return _0x226713;};VoiceQueueSummary[_0xc8ef('0x50')][_0xc8ef('0x52')]=function(_0x5ae3ae){var _0x987dc7=![];var _0x5bdef1=![];var _0x472f65=![];if(_0x5ae3ae){_0x987dc7=this[_0xc8ef('0x24')]!==_0x5ae3ae[_0xc8ef('0x24')]||this[_0xc8ef('0x53')]!==_0x5ae3ae[_0xc8ef('0x53')]||this[_0xc8ef('0x40')]!==_0x5ae3ae[_0xc8ef('0x40')]||this[_0xc8ef('0x41')]!==_0x5ae3ae[_0xc8ef('0x41')];_0x5bdef1=OUTBOUND_COUNTERS['some'](function(_0x599cf1){return this[_0x599cf1]!==_0x5ae3ae[_0x599cf1];},this);if(this[_0xc8ef('0x42')]&&_0x5ae3ae['Trunk']){_0x472f65=this[_0xc8ef('0x42')]['name']!==_0x5ae3ae['Trunk'][_0xc8ef('0x11')]||this['Trunk']['active']!==_0x5ae3ae[_0xc8ef('0x42')]['active'];}}return _0x987dc7||_0x5bdef1||_0x472f65;};VoiceQueueSummary['prototype']['updateReportFromOutboundQueue']=function(_0x201b4c){this['answered']=_0x201b4c['answered'];this[_0xc8ef('0x40')]=_0x201b4c['message'];this['statusMessage']=_0x201b4c[_0xc8ef('0x41')];this[_0xc8ef('0x5')]=_0x201b4c[_0xc8ef('0x5')];this[_0xc8ef('0x6')]=_0x201b4c[_0xc8ef('0x6')];this['outboundAnswerCallsDay']=_0x201b4c['outboundAnswerCallsDay'];this[_0xc8ef('0x8')]=_0x201b4c[_0xc8ef('0x8')];this['outboundBusyCallsDay']=_0x201b4c[_0xc8ef('0x9')];this[_0xc8ef('0x2a')]=_0x201b4c['outboundCongestionCallsDay'];this['outboundNoAnswerCallsDay']=_0x201b4c['outboundNoAnswerCallsDay'];this[_0xc8ef('0x54')]=_0x201b4c['outboundNoSuchCallsDay'];this[_0xc8ef('0xb')]=_0x201b4c[_0xc8ef('0xb')];this[_0xc8ef('0xc')]=_0x201b4c[_0xc8ef('0xc')];this['outboundUnknownCallsDay']=_0x201b4c[_0xc8ef('0xd')];this[_0xc8ef('0x1b')]=_0x201b4c['sumBillable'];this[_0xc8ef('0xf')]=_0x201b4c[_0xc8ef('0xf')];this[_0xc8ef('0x10')]=_0x201b4c[_0xc8ef('0x10')];if(this[_0xc8ef('0x24')]===_0xc8ef('0x55')){this['pTalking']=_0x201b4c['pTalking'];}};module[_0xc8ef('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 e74946b..258d274 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 _0xd5bd=['username','accessKey','remoteUri','serverUrl','Configurations','name'];(function(_0x48a73e,_0x39f1ac){var _0x390c0b=function(_0x369beb){while(--_0x369beb){_0x48a73e['push'](_0x48a73e['shift']());}};_0x390c0b(++_0x39f1ac);}(_0xd5bd,0x1b5));var _0xdd5b=function(_0x53a167,_0x4bf6c7){_0x53a167=_0x53a167-0x0;var _0x150263=_0xd5bd[_0x53a167];return _0x150263;};'use strict';function VtigerAccount(_0x3d873b){this['id']=_0x3d873b['id']||0x0;this[_0xdd5b('0x0')]=_0x3d873b[_0xdd5b('0x0')]||'';this[_0xdd5b('0x1')]=_0x3d873b[_0xdd5b('0x1')]||'';this[_0xdd5b('0x2')]=_0x3d873b[_0xdd5b('0x2')]||'';this[_0xdd5b('0x3')]=_0x3d873b[_0xdd5b('0x3')]||'';this[_0xdd5b('0x4')]=_0x3d873b['serverUrl']||'';this[_0xdd5b('0x5')]=_0x3d873b['Configurations']||{};}module['exports']=VtigerAccount; \ No newline at end of file +var _0x00e1=['exports','name','username','accessKey','remoteUri','serverUrl','Configurations'];(function(_0x4e1eac,_0x258749){var _0x2994db=function(_0x4a6038){while(--_0x4a6038){_0x4e1eac['push'](_0x4e1eac['shift']());}};_0x2994db(++_0x258749);}(_0x00e1,0x151));var _0x100e=function(_0x3cbd61,_0x407444){_0x3cbd61=_0x3cbd61-0x0;var _0x362082=_0x00e1[_0x3cbd61];return _0x362082;};'use strict';function VtigerAccount(_0x436f44){this['id']=_0x436f44['id']||0x0;this[_0x100e('0x0')]=_0x436f44[_0x100e('0x0')]||'';this[_0x100e('0x1')]=_0x436f44[_0x100e('0x1')]||'';this[_0x100e('0x2')]=_0x436f44[_0x100e('0x2')]||'';this[_0x100e('0x3')]=_0x436f44[_0x100e('0x3')]||'';this[_0x100e('0x4')]=_0x436f44[_0x100e('0x4')]||'';this[_0x100e('0x5')]=_0x436f44['Configurations']||{};}module[_0x100e('0x6')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index ad98ca0..30922ea 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 _0x3c22=['type','serverUrl','Configurations','exports','name','token','remoteUri','authType'];(function(_0xee8438,_0x261ac6){var _0x251ee8=function(_0x1ea637){while(--_0x1ea637){_0xee8438['push'](_0xee8438['shift']());}};_0x251ee8(++_0x261ac6);}(_0x3c22,0x164));var _0x23c2=function(_0x44da7b,_0x4fb36d){_0x44da7b=_0x44da7b-0x0;var _0xb35527=_0x3c22[_0x44da7b];return _0xb35527;};'use strict';function ZendeskAccount(_0x3e32bb){this['id']=_0x3e32bb['id']||0x0;this['name']=_0x3e32bb[_0x23c2('0x0')]||'';this['username']=_0x3e32bb['username']||'';this['password']=_0x3e32bb['password']||'';this[_0x23c2('0x1')]=_0x3e32bb[_0x23c2('0x1')]||'';this['remoteUri']=_0x3e32bb[_0x23c2('0x2')]||'';this['authType']=_0x3e32bb[_0x23c2('0x3')]||'';this['type']=_0x3e32bb[_0x23c2('0x4')]||'integrationTab';this[_0x23c2('0x5')]=_0x3e32bb[_0x23c2('0x5')]||'';this['Configurations']=_0x3e32bb[_0x23c2('0x6')]||{};}module[_0x23c2('0x7')]=ZendeskAccount; \ No newline at end of file +var _0xf63f=['token','remoteUri','authType','type','serverUrl','Configurations','name','username','password'];(function(_0x3940c7,_0x35fe3b){var _0x9c80ed=function(_0x46e8c5){while(--_0x46e8c5){_0x3940c7['push'](_0x3940c7['shift']());}};_0x9c80ed(++_0x35fe3b);}(_0xf63f,0x138));var _0xff63=function(_0x378fb2,_0x5b3eed){_0x378fb2=_0x378fb2-0x0;var _0x592ffc=_0xf63f[_0x378fb2];return _0x592ffc;};'use strict';function ZendeskAccount(_0x383658){this['id']=_0x383658['id']||0x0;this[_0xff63('0x0')]=_0x383658[_0xff63('0x0')]||'';this[_0xff63('0x1')]=_0x383658[_0xff63('0x1')]||'';this['password']=_0x383658[_0xff63('0x2')]||'';this[_0xff63('0x3')]=_0x383658[_0xff63('0x3')]||'';this[_0xff63('0x4')]=_0x383658['remoteUri']||'';this[_0xff63('0x5')]=_0x383658[_0xff63('0x5')]||'';this[_0xff63('0x6')]=_0x383658['type']||'integrationTab';this[_0xff63('0x7')]=_0x383658[_0xff63('0x7')]||'';this[_0xff63('0x8')]=_0x383658[_0xff63('0x8')]||{};}module['exports']=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 1b42362..95aaa76 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 _0xb7e7=['clientId','clientSecret','serverUrl','code','refreshToken','Configurations','name','description','host','zone'];(function(_0x3a6f2a,_0x4fe258){var _0x5c3430=function(_0x360e92){while(--_0x360e92){_0x3a6f2a['push'](_0x3a6f2a['shift']());}};_0x5c3430(++_0x4fe258);}(_0xb7e7,0x18c));var _0x7b7e=function(_0x42bc91,_0x41f40a){_0x42bc91=_0x42bc91-0x0;var _0x3f5507=_0xb7e7[_0x42bc91];return _0x3f5507;};'use strict';function ZohoAccount(_0x2ee0ea){this['id']=_0x2ee0ea['id']||0x0;this['name']=_0x2ee0ea[_0x7b7e('0x0')]||'';this[_0x7b7e('0x1')]=_0x2ee0ea[_0x7b7e('0x1')]||'';this[_0x7b7e('0x2')]=_0x2ee0ea['host']||'';this[_0x7b7e('0x3')]=_0x2ee0ea[_0x7b7e('0x3')]||'';this[_0x7b7e('0x4')]=_0x2ee0ea[_0x7b7e('0x4')]||'';this[_0x7b7e('0x5')]=_0x2ee0ea[_0x7b7e('0x5')]||'';this[_0x7b7e('0x6')]=_0x2ee0ea['serverUrl']||'';this[_0x7b7e('0x7')]=_0x2ee0ea[_0x7b7e('0x7')]||'';this['refreshToken']=_0x2ee0ea[_0x7b7e('0x8')]||'';this['Configurations']=_0x2ee0ea[_0x7b7e('0x9')]||{};}module['exports']=ZohoAccount; \ No newline at end of file +var _0x35ad=['description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports','name'];(function(_0x106ef9,_0x59f2d3){var _0xe0ccc2=function(_0x5741ce){while(--_0x5741ce){_0x106ef9['push'](_0x106ef9['shift']());}};_0xe0ccc2(++_0x59f2d3);}(_0x35ad,0x128));var _0xd35a=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0x35ad[_0x1da527];return _0x40fc7c;};'use strict';function ZohoAccount(_0x163200){this['id']=_0x163200['id']||0x0;this[_0xd35a('0x0')]=_0x163200['name']||'';this[_0xd35a('0x1')]=_0x163200[_0xd35a('0x1')]||'';this[_0xd35a('0x2')]=_0x163200['host']||'';this['zone']=_0x163200[_0xd35a('0x3')]||'';this[_0xd35a('0x4')]=_0x163200[_0xd35a('0x4')]||'';this[_0xd35a('0x5')]=_0x163200[_0xd35a('0x5')]||'';this[_0xd35a('0x6')]=_0x163200[_0xd35a('0x6')]||'';this[_0xd35a('0x7')]=_0x163200['code']||'';this[_0xd35a('0x8')]=_0x163200['refreshToken']||'';this[_0xd35a('0x9')]=_0x163200[_0xd35a('0x9')]||{};}module[_0xd35a('0xa')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 97ca032..77233d5 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 _0xcf66=['membername','calleridname','Contact','phone','active','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','number','exports','util','lodash','moment','string','isNil','uniqueid','idContact','queue','name','type','dialAnswer','Agent','SIP/%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcf66,0x71));var _0x6cf6=function(_0x1c3db6,_0xba999e){_0x1c3db6=_0x1c3db6-0x0;var _0x477e17=_0xcf66[_0x1c3db6];return _0x477e17;};'use strict';var util=require(_0x6cf6('0x0'));var _=require(_0x6cf6('0x1'));var moment=require(_0x6cf6('0x2'));function checkNameSurname(_0x56f1fd,_0x7ed4c0,_0x1af283){var _0x49ce88='';if(!_['isNil'](_0x7ed4c0)&&_0x6cf6('0x3')===typeof _0x7ed4c0){_0x49ce88+=_0x7ed4c0;}if(!_[_0x6cf6('0x4')](_0x1af283)&&'string'===typeof _0x1af283){_0x49ce88+='\x20'+_0x1af283;}if(_0x49ce88!==''){return _0x49ce88;}return _0x56f1fd;}function Action(_0x39f1d6,_0x1fbedd,_0x2a573e,_0x5eb082,_0x94c6a9){this[_0x6cf6('0x5')]=_0x2a573e||undefined;this[_0x6cf6('0x6')]=_0x39f1d6['id'];this[_0x6cf6('0x7')]=_0x1fbedd[_0x6cf6('0x8')];this[_0x6cf6('0x9')]=_0x1fbedd['type'];this['campaigntype']='queue';this[_0x6cf6('0xa')]=![];this['membername']=_[_0x6cf6('0x4')](_0x39f1d6[_0x6cf6('0xb')])?undefined:_0x39f1d6[_0x6cf6('0xb')][_0x6cf6('0x8')];this['channelAgent']=this['membername']?util['format'](_0x6cf6('0xc'),this[_0x6cf6('0xd')]):_0x5eb082||undefined;this[_0x6cf6('0xe')]=checkNameSurname(_0x39f1d6[_0x6cf6('0xf')][_0x6cf6('0x10')],_0x39f1d6[_0x6cf6('0xf')]['firstName'],_0x39f1d6[_0x6cf6('0xf')]['lastName']);this[_0x6cf6('0x11')]=_0x39f1d6[_0x6cf6('0x11')]||![];this['calleridnum']=_0x39f1d6[_0x6cf6('0x10')];this[_0x6cf6('0x12')]=_0x39f1d6[_0x6cf6('0x12')];this[_0x6cf6('0x13')]=_0x39f1d6[_0x6cf6('0x13')]||0x0;this[_0x6cf6('0x14')]=_0x39f1d6[_0x6cf6('0x14')]||0x0;this[_0x6cf6('0x15')]=_0x39f1d6[_0x6cf6('0x15')]||0x0;this[_0x6cf6('0x16')]=(_0x39f1d6['countbusyretry']||0x0)+(_0x39f1d6[_0x6cf6('0x14')]||0x0)+(_0x39f1d6[_0x6cf6('0x15')]||0x0)+(_0x39f1d6[_0x6cf6('0x17')]||0x0)+(_0x39f1d6['countdropretry']||0x0)+(_0x39f1d6[_0x6cf6('0x18')]||0x0)+(_0x39f1d6[_0x6cf6('0x19')]||0x0)+(_0x39f1d6[_0x6cf6('0x1a')]||0x0);this[_0x6cf6('0x17')]=_0x39f1d6[_0x6cf6('0x17')]||0x0;this[_0x6cf6('0x1b')]=_0x39f1d6[_0x6cf6('0x1b')]||0x0;this['countabandonedretry']=_0x39f1d6[_0x6cf6('0x18')]||0x0;this[_0x6cf6('0x19')]=_0x39f1d6[_0x6cf6('0x19')]||0x0;this[_0x6cf6('0x1a')]=_0x39f1d6[_0x6cf6('0x1a')]||0x0;this[_0x6cf6('0x1c')]=_0x39f1d6[_0x6cf6('0x1c')];this[_0x6cf6('0x1d')]=_0x39f1d6['callbackuniqueid'];this['callbackat']=_0x39f1d6[_0x6cf6('0x1e')];this['recallme']=_0x39f1d6[_0x6cf6('0x1f')];this[_0x6cf6('0x20')]=_0x39f1d6[_0x6cf6('0x20')];this[_0x6cf6('0x21')]=_0x39f1d6[_0x6cf6('0x21')];this[_0x6cf6('0x22')]=_[_0x6cf6('0x4')](_0x39f1d6['Agent'])?_0x39f1d6[_0x6cf6('0x22')]:_0x39f1d6[_0x6cf6('0xb')]['id'];this[_0x6cf6('0x23')]=_0x39f1d6['VoiceQueueId'];this[_0x6cf6('0x24')]='';this[_0x6cf6('0x25')]='';}Action[_0x6cf6('0x26')][_0x6cf6('0x27')]=function(){return util['format']('\x22%s\x22\x20<%s>',this[_0x6cf6('0xe')],this[_0x6cf6('0x28')]);};module[_0x6cf6('0x29')]=Action; \ No newline at end of file +var _0xfb11=['originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','number','exports','util','moment','isNil','string','uniqueid','idContact','queue','name','type','campaigntype','dialAnswer','Agent','channelAgent','membername','format','SIP/%s','calleridname','phone','Contact','firstName','lastName','active','calleridnum','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0xfb11,0x1ad));var _0x1fb1=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xfb11[_0x21aec3];return _0x288bbc;};'use strict';var util=require(_0x1fb1('0x0'));var _=require('lodash');var moment=require(_0x1fb1('0x1'));function checkNameSurname(_0x34e2d6,_0x51c055,_0x1461ad){var _0x5af9cc='';if(!_[_0x1fb1('0x2')](_0x51c055)&&'string'===typeof _0x51c055){_0x5af9cc+=_0x51c055;}if(!_[_0x1fb1('0x2')](_0x1461ad)&&_0x1fb1('0x3')===typeof _0x1461ad){_0x5af9cc+='\x20'+_0x1461ad;}if(_0x5af9cc!==''){return _0x5af9cc;}return _0x34e2d6;}function Action(_0x5af469,_0x25d44f,_0x133727,_0x4c098d,_0x1859da){this[_0x1fb1('0x4')]=_0x133727||undefined;this[_0x1fb1('0x5')]=_0x5af469['id'];this[_0x1fb1('0x6')]=_0x25d44f[_0x1fb1('0x7')];this[_0x1fb1('0x8')]=_0x25d44f[_0x1fb1('0x8')];this[_0x1fb1('0x9')]=_0x1fb1('0x6');this[_0x1fb1('0xa')]=![];this['membername']=_[_0x1fb1('0x2')](_0x5af469['Agent'])?undefined:_0x5af469[_0x1fb1('0xb')]['name'];this[_0x1fb1('0xc')]=this[_0x1fb1('0xd')]?util[_0x1fb1('0xe')](_0x1fb1('0xf'),this[_0x1fb1('0xd')]):_0x4c098d||undefined;this[_0x1fb1('0x10')]=checkNameSurname(_0x5af469['Contact'][_0x1fb1('0x11')],_0x5af469[_0x1fb1('0x12')][_0x1fb1('0x13')],_0x5af469[_0x1fb1('0x12')][_0x1fb1('0x14')]);this[_0x1fb1('0x15')]=_0x5af469[_0x1fb1('0x15')]||![];this[_0x1fb1('0x16')]=_0x5af469[_0x1fb1('0x11')];this['scheduledat']=_0x5af469['scheduledat'];this[_0x1fb1('0x17')]=_0x5af469[_0x1fb1('0x17')]||0x0;this[_0x1fb1('0x18')]=_0x5af469['countcongestionretry']||0x0;this[_0x1fb1('0x19')]=_0x5af469[_0x1fb1('0x19')]||0x0;this[_0x1fb1('0x1a')]=(_0x5af469[_0x1fb1('0x17')]||0x0)+(_0x5af469[_0x1fb1('0x18')]||0x0)+(_0x5af469[_0x1fb1('0x19')]||0x0)+(_0x5af469[_0x1fb1('0x1b')]||0x0)+(_0x5af469[_0x1fb1('0x1c')]||0x0)+(_0x5af469[_0x1fb1('0x1d')]||0x0)+(_0x5af469['countmachineretry']||0x0)+(_0x5af469[_0x1fb1('0x1e')]||0x0);this['countnosuchnumberretry']=_0x5af469['countnosuchnumberretry']||0x0;this[_0x1fb1('0x1c')]=_0x5af469[_0x1fb1('0x1c')]||0x0;this[_0x1fb1('0x1d')]=_0x5af469['countabandonedretry']||0x0;this[_0x1fb1('0x1f')]=_0x5af469['countmachineretry']||0x0;this['countagentrejectretry']=_0x5af469['countagentrejectretry']||0x0;this[_0x1fb1('0x20')]=_0x5af469[_0x1fb1('0x20')];this[_0x1fb1('0x21')]=_0x5af469[_0x1fb1('0x21')];this[_0x1fb1('0x22')]=_0x5af469['callbackat'];this[_0x1fb1('0x23')]=_0x5af469[_0x1fb1('0x23')];this[_0x1fb1('0x24')]=_0x5af469[_0x1fb1('0x24')];this[_0x1fb1('0x25')]=_0x5af469[_0x1fb1('0x25')];this[_0x1fb1('0x26')]=_[_0x1fb1('0x2')](_0x5af469['Agent'])?_0x5af469[_0x1fb1('0x26')]:_0x5af469[_0x1fb1('0xb')]['id'];this[_0x1fb1('0x27')]=_0x5af469[_0x1fb1('0x27')];this[_0x1fb1('0x28')]='';this[_0x1fb1('0x29')]='';}Action[_0x1fb1('0x2a')][_0x1fb1('0x2b')]=function(){return util[_0x1fb1('0xe')](_0x1fb1('0x2c'),this[_0x1fb1('0x10')],this[_0x1fb1('0x2d')]);};module[_0x1fb1('0x2e')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 8b270c4..94f78e6 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 _0x21e3=['queueSummaryCountersUpdated','callProgressDetectingAgent','isUndefined','object','reason','[callProgressDetectingAgent][logNoSuch]','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[swapAdditionalPhone]\x20','resolve','isNil','Contact','VoiceQueueId','isEmpty','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','logBlacklist','createHistory','Contact\x20in\x20black\x20List','active','SIP/%s','reachable','unmonitored','execRun','unlock','unlockContact','getContactPreview','recallme','validateContact','isValid','phone','checkInBlack','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','Empty\x20Contact','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','\x20Not\x20Active','execCall','Trunk','SIP/%s/%s%s','dialPrefix','substring','dialCutDigit','trim','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','extractCalleridName','originatecalleridnum','addVariables','assign','merge','toLowerVariables','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','lookAgent','logLookAgent','clone','isFailure','response','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','callProgressDetectingCustomer','statedesc','dialQueueProject','channelstate','transfer','destuniqueid','variables','filterKey','keys','variable','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','uuid','../../../config/logger','preview','actionPreview','../ami','../rpc/cmHopperAdditionalPhone','./util/util','../dialer/utils','defaults','redis','localhost','socket.io-emitter','prototype','tail','sequence','trunks','actions','agents','syncOriginateResponse','hangup','syncHangup','bind','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','syncVarSet','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','format','voice:queue:%s','name','voice_queue_channel:remove','emit','voice_queue_presence:remove','pTalking','sendMessageOneNotActive','available','paused','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','DEACTIVATED','syncCampaigns','campaignsPreview','clockClearZombieChannels','hasOwnProperty','dialMethod','type','outbound','clearZombieChannels','setMessage','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','enqueue','[clearZombieChannels][talking]','Queue','queue','originated','pTalking:\x20','pick','contactId','ListId','Action','status','channel','message','No\x20such\x20channel','updateOriginated','dialAnswer','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][Preview]','info','[action]','size','getContactRecallMe','agentReadyId','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','logger2','[RecallMe]','catch','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','NO_AGENTS_LOGGED','isActive','dialActive','isTrunkReachable','TrunkBackup','ACTIVE','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','cloneAction','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','unlockAgent','activeContact','linkedid','actioncountonusuch','idContact','incrementPreviewCounters','swapAdditionalPhones','then','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','\x20Queue','connect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','answered','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','crateCustomerReportQueue','sumDuration','sumBillable','talktime','uniqueid','BUSY','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','scheduledAt','countnoanswerretry','NoAnswer','buildNoAnswerEventPayload','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerRetryFrequency','CONGESTION','outboundCongestionCallsDay','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','countcongestionretry','dialCongestionMaxRetry','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[callProgressDetectingCustomer][logAgentReject]','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','dialAbandonedRetryFrequency','outboundUnknownCallsDay','cause-txt','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[default]','dialstatus','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','originated:\x20','destlinkedid'];(function(_0x5bdf7b,_0xf64255){var _0x19572f=function(_0x494a5c){while(--_0x494a5c){_0x5bdf7b['push'](_0x5bdf7b['shift']());}};_0x19572f(++_0xf64255);}(_0x21e3,0x1ab));var _0x321e=function(_0x1b914b,_0x440b7d){_0x1b914b=_0x1b914b-0x0;var _0x5e21b6=_0x21e3[_0x1b914b];return _0x5e21b6;};'use strict';var util=require('util');var _=require('lodash');var uuid=require(_0x321e('0x0'));var moment=require('moment');var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x321e('0x1'))(_0x321e('0x2'));var loggerAction=require(_0x321e('0x1'))(_0x321e('0x3'));var ami=require(_0x321e('0x4'));var rpcDb=require('./rpcDb');var cmHopperAdditionalPhone=require(_0x321e('0x5'));var Action=require('./action');var ut=require(_0x321e('0x6'));var utils=require(_0x321e('0x7'));config['redis']=_[_0x321e('0x8')](config[_0x321e('0x9')],{'host':_0x321e('0xa'),'port':0x18eb});var io=require(_0x321e('0xb'))(new Redis(config['redis']));var Sequence=function(){};Sequence[_0x321e('0xc')]['enqueue']=function(_0x2814eb){this[_0x321e('0xd')]=this[_0x321e('0xd')]?this[_0x321e('0xd')]['finally'](_0x2814eb):_0x2814eb();};function Preview(_0x28fdcb){this[_0x321e('0xe')]=new Sequence();this['campaignsPreview']=_0x28fdcb['voiceQueues'];this[_0x321e('0xf')]=_0x28fdcb['trunks'];this[_0x321e('0x10')]={};this[_0x321e('0x11')]=_0x28fdcb[_0x321e('0x11')];this['clockClearZombieChannels']=0x0;ami['on']('originateresponse',this[_0x321e('0x12')]['bind'](this));ami['on'](_0x321e('0x13'),this[_0x321e('0x14')][_0x321e('0x15')](this));ami['on']('hanguprequest',this[_0x321e('0x16')]['bind'](this));ami['on'](_0x321e('0x17'),this[_0x321e('0x18')][_0x321e('0x15')](this));ami['on'](_0x321e('0x19'),this[_0x321e('0x1a')][_0x321e('0x15')](this));ami['on']('varset',this[_0x321e('0x1b')][_0x321e('0x15')](this));ami['on']('attendedtransfer',this[_0x321e('0x1c')][_0x321e('0x15')](this));ami['on'](_0x321e('0x1d'),this[_0x321e('0x1e')]['bind'](this));this[_0x321e('0x1f')](this['campaignsPreview']);}function emit(_0x50d5ea,_0x5b6ad5,_0x14a75b){io['to'](_0x50d5ea)['emit'](_0x5b6ad5,_0x14a75b);}function emitVoiceQueueChannelRemove(_0x3ccf23){logger['info'](_0x321e('0x20'),JSON[_0x321e('0x21')](_0x3ccf23));emit(util[_0x321e('0x22')](_0x321e('0x23'),_0x3ccf23[_0x321e('0x24')]),_0x321e('0x25'),_0x3ccf23);io[_0x321e('0x26')](_0x321e('0x27'),_0x3ccf23);}function notSendMessagesQueue(_0x38d8b3){if(_0x38d8b3['sendMessageOneNotActive']){if(_0x38d8b3['originated']===0x0&&_0x38d8b3[_0x321e('0x28')]===0x0){_0x38d8b3[_0x321e('0x29')]=![];_0x38d8b3[_0x321e('0x2a')]=0x0;_0x38d8b3[_0x321e('0x2b')]=0x0;_0x38d8b3['message']=utils[_0x321e('0x2c')][_0x321e('0x2d')];ut[_0x321e('0x2e')](_0x321e('0x2f'),_0x38d8b3['name']+_0x321e('0x30'));}else{_0x38d8b3['message']=utils[_0x321e('0x2c')][_0x321e('0x31')];ut[_0x321e('0x2e')](_0x321e('0x2f'),_0x38d8b3['name']+'\x20is\x20deactivated');}}}Preview[_0x321e('0xc')][_0x321e('0x1f')]=function(){var _0x1335c4=this;setInterval(function(){_0x1335c4[_0x321e('0x32')]();},0x7cf);};Preview[_0x321e('0xc')][_0x321e('0x32')]=function(){var _0x5d5d3f=this[_0x321e('0x33')];this[_0x321e('0x34')]+=0x1;for(var _0x23fa9d in _0x5d5d3f){if(_0x5d5d3f[_0x321e('0x35')](_0x23fa9d)&&(_0x5d5d3f[_0x23fa9d][_0x321e('0x36')]===_0x321e('0x2')||_0x5d5d3f[_0x23fa9d][_0x321e('0x36')]==='booked')&&_0x5d5d3f[_0x23fa9d][_0x321e('0x37')]===_0x321e('0x38')){if(this[_0x321e('0x34')]>0x7){this[_0x321e('0x34')]=0x0;this[_0x321e('0x39')]();}}if(_0x5d5d3f[_0x321e('0x35')](_0x23fa9d)&&_0x5d5d3f[_0x23fa9d][_0x321e('0x36')]===_0x321e('0x2')&&_0x5d5d3f[_0x23fa9d][_0x321e('0x37')]===_0x321e('0x38')){if(_0x5d5d3f[_0x23fa9d]['dialActive']){this[_0x321e('0x3a')](_0x5d5d3f[_0x23fa9d]);if(_0x5d5d3f[_0x23fa9d][_0x321e('0x3b')])this[_0x321e('0x3c')](_0x5d5d3f[_0x23fa9d]);}else{notSendMessagesQueue(_0x5d5d3f[_0x23fa9d]);}}}};Preview[_0x321e('0xc')][_0x321e('0x3d')]=function(_0x10481d){var _0x245257=this;this['sequence'][_0x321e('0x3e')](function(){if(!_['isNil'](_0x245257['actions'][_0x10481d])){loggerAction['info'](_0x321e('0x3f'),_0x10481d,_0x321e('0x40'),_0x245257[_0x321e('0x10')][_0x10481d][_0x321e('0x41')],'originated:\x20',JSON[_0x321e('0x21')](_0x245257[_0x321e('0x33')][_0x245257['actions'][_0x10481d][_0x321e('0x41')]][_0x321e('0x42')]),_0x321e('0x43'),JSON[_0x321e('0x21')](_0x245257[_0x321e('0x33')][_0x245257[_0x321e('0x10')][_0x10481d][_0x321e('0x41')]][_0x321e('0x28')]),JSON[_0x321e('0x21')](_0x245257[_0x321e('0x10')][_0x10481d]['dialAnswer']),JSON[_0x321e('0x21')](_[_0x321e('0x44')](_0x245257[_0x321e('0x10')][_0x10481d],[_0x321e('0x45'),'UserId','VoiceQueueId',_0x321e('0x46')])));return ami[_0x321e('0x47')]({'action':_0x321e('0x48'),'channel':_0x245257['actions'][_0x10481d][_0x321e('0x49')]})['catch'](function(_0x4f480f){if(_0x4f480f[_0x321e('0x4a')]===_0x321e('0x4b')){setTimeout(function(){if(_0x245257[_0x321e('0x10')][_0x10481d]){ut[_0x321e('0x4c')](_0x245257[_0x321e('0x33')][_0x245257[_0x321e('0x10')][_0x10481d][_0x321e('0x41')]],'[clearZombieChannel]');if(_0x245257[_0x321e('0x10')][_0x10481d][_0x321e('0x4d')]===!![]){ut[_0x321e('0x4e')](_0x245257[_0x321e('0x33')][_0x245257[_0x321e('0x10')][_0x10481d][_0x321e('0x41')]],_0x321e('0x4f'));ut[_0x321e('0x50')]('[Dialer][checkChannel][pTalking][Preview]'+_0x10481d,_0x245257[_0x321e('0x10')][_0x10481d][_0x321e('0x41')]);}ut[_0x321e('0x50')](_0x321e('0x51')+_0x10481d,_0x245257[_0x321e('0x10')][_0x10481d][_0x321e('0x41')]);delete _0x245257[_0x321e('0x10')][_0x10481d];}},0x2328);}});}});};Preview[_0x321e('0xc')][_0x321e('0x39')]=function(){var _0x193ba8=this;loggerAction[_0x321e('0x52')](_0x321e('0x53'),_[_0x321e('0x54')](this['actions']));for(var _0x306d44 in this[_0x321e('0x10')]){if(_0x193ba8['actions']['hasOwnProperty'](_0x306d44)){_0x193ba8[_0x321e('0x3d')](_0x306d44);}}};Preview[_0x321e('0xc')][_0x321e('0x3c')]=function(_0x1e35fe){var _0x536a88=this;rpcDb[_0x321e('0x55')](_0x1e35fe['id'],ut[_0x321e('0x56')](this[_0x321e('0x11')]))['then'](function(_0x3de703){if(!_['isNil'](_0x3de703)){for(var _0x390d63=0x0;_0x390d63<_0x3de703['length'];_0x390d63+=0x1){if(ut[_0x321e('0x57')](_0x3de703[_0x390d63][_0x321e('0x58')])<_0x1e35fe[_0x321e('0x59')]*0x3c){if(_0x3de703[_0x390d63][_0x321e('0x5a')]&&!_0x3de703[_0x390d63][_0x321e('0x5a')][_0x321e('0x5b')]){_0x536a88[_0x321e('0x5c')](_0x3de703[_0x390d63]['id'])['then'](ut[_0x321e('0x5d')](_0x321e('0x5e')))[_0x321e('0x5f')](ut['logger2'](_0x321e('0x5e')));}else{rpcDb[_0x321e('0x60')](_0x3de703[_0x390d63]['id']);}}else{var _0x4050bf=new Action(_0x3de703[_0x390d63],_0x1e35fe);_0x4050bf[_0x321e('0x61')]=moment()[_0x321e('0x22')](_0x321e('0x62'));_0x1e35fe[_0x321e('0x63')]+=0x1;ut[_0x321e('0x64')](_0x4050bf,0x17,_0x321e('0x65'));if(_0x1e35fe[_0x321e('0x66')]){rpcDb[_0x321e('0x67')](ut[_0x321e('0x68')](_0x3de703[_0x390d63]));rpcDb[_0x321e('0x69')](_0x4050bf,_0x321e('0x6a'));}else{ut[_0x321e('0x64')](_0x4050bf,0x16,'RecallFailedTimeout');rpcDb[_0x321e('0x69')](_0x4050bf,'[HistoryRecallClose]');rpcDb[_0x321e('0x6b')](_0x4050bf,'[HistoryRecallClose]');}}}}})[_0x321e('0x5f')](ut[_0x321e('0x5d')](_0x321e('0x6c')));};Preview[_0x321e('0xc')]['setMessage']=function(_0x5abdad){_0x5abdad[_0x321e('0x29')]=!![];if(ut[_0x321e('0x6d')](_0x5abdad['loggedIn'])){_0x5abdad['message']=utils['CAMPAIGN_STATUS'][_0x321e('0x6e')];}else if(!ut[_0x321e('0x6f')](_0x5abdad[_0x321e('0x70')])){_0x5abdad[_0x321e('0x4a')]=utils['CAMPAIGN_STATUS'][_0x321e('0x2d')];}else if(!this[_0x321e('0x71')](_0x5abdad['Trunk'])){if(!this[_0x321e('0x71')](_0x5abdad[_0x321e('0x72')])){_0x5abdad[_0x321e('0x4a')]=utils[_0x321e('0x2c')]['UNREACHABLE_TRUNK'];}else{_0x5abdad['message']=utils[_0x321e('0x2c')][_0x321e('0x73')];}}else{_0x5abdad[_0x321e('0x4a')]=utils[_0x321e('0x2c')][_0x321e('0x73')];}};Preview[_0x321e('0xc')]['callProgressDetectingCustomer']=function(_0x1d55a1,_0x2788b3,_0x212471){var _0x4a458c=this;var _0x6b0250=this['actions'][_0x2788b3];var _0x2d0b14=this[_0x321e('0x33')][_0x6b0250['queue']];var _0x4dbd97;var _0x1e91af=![];var _0x3a566d=0x2;var _0x282940=0x3;if(_0x2d0b14){switch(_0x212471){case'1':_0x2d0b14['outboundNoSuchCallsDay']+=0x1;_0x6b0250[_0x321e('0x74')]+=0x1;_0x6b0250[_0x321e('0x75')]=ut[_0x321e('0x76')](_0x6b0250);ut[_0x321e('0x64')](_0x6b0250,0x0,_0x321e('0x77'));ami[_0x321e('0x26')]('custom:agentnosuchnumber',ut[_0x321e('0x78')](_0x6b0250,_0x321e('0x79')));rpcDb['createCustomerHistory'](_0x6b0250,'[callProgressDetectingCustomer][logNoSuch]');_0x4a458c[_0x321e('0x7a')](_0x6b0250,'0',_0x2d0b14)['then'](function(_0x2084c7){_0x1e91af=_0x2084c7[_0x321e('0x7b')]==0x1;_0x3a566d=_0x2d0b14[_0x321e('0x7c')];_0x282940=_0x2d0b14[_0x321e('0x7d')];if(!_0x1e91af){if(ut['totalGlobal'](_0x6b0250)>=_0x2d0b14[_0x321e('0x7e')]){_0x4dbd97=ut[_0x321e('0x7f')](_0x6b0250,0xf,'Global');rpcDb[_0x321e('0x6b')](_0x4dbd97,_0x321e('0x80'));}else{if(_0x6b0250[_0x321e('0x74')]>=_0x2d0b14[_0x321e('0x81')]){rpcDb[_0x321e('0x6b')](_0x6b0250,_0x321e('0x80'));}else{rpcDb[_0x321e('0x82')](ut['scheduledAt'](_0x6b0250,'countnosuchnumberretry',_0x2d0b14['dialNoSuchNumberRetryFrequency']),_0x6b0250[_0x321e('0x83')],_0x6b0250[_0x321e('0x84')]);}}delete this[_0x321e('0x10')][_0x1d55a1[_0x321e('0x85')]];}else{_0x6b0250[_0x321e('0x74')]++;logger['info'](_0x321e('0x86'),_0x6b0250['countnosuchnumberretry']);logger[_0x321e('0x52')]('id',_0x6b0250[_0x321e('0x87')]);_0x4a458c[_0x321e('0x88')]({'id':_0x6b0250[_0x321e('0x87')],'field':{'countnosuchnumberretry':_0x6b0250[_0x321e('0x74')]}})['then'](function(){_0x4a458c[_0x321e('0x89')](_0x6b0250,_0x3a566d,_0x282940)[_0x321e('0x8a')](function(){});});}});break;case _0x321e('0x8b'):var _0x27d352=moment()[_0x321e('0x22')](_0x321e('0x62'));_0x6b0250[_0x321e('0x8c')]=_0x27d352;_0x6b0250[_0x321e('0x8d')]=_0x27d352;_0x6b0250[_0x321e('0x4d')]=!![];_0x2d0b14[_0x321e('0x28')]+=0x1;logger[_0x321e('0x52')](_0x321e('0x8e'),_0x6b0250['uniqueid'],_0x321e('0x8f'),_0x2d0b14[_0x321e('0x24')],_0x321e('0x43'),_0x2d0b14[_0x321e('0x28')]);ami[_0x321e('0x26')]('custom:agentconnect',ut[_0x321e('0x78')](_0x6b0250,_0x321e('0x90'),this['campaignsPreview'][_0x6b0250[_0x321e('0x41')]]));if(_0x2d0b14[_0x321e('0x91')]){ami[_0x321e('0x26')](_0x321e('0x92'),ut[_0x321e('0x93')](_0x6b0250));}break;case'16':ami[_0x321e('0x26')](_0x321e('0x94'),ut[_0x321e('0x78')](_0x6b0250,_0x321e('0x95'),this['campaignsPreview'][_0x6b0250[_0x321e('0x41')]]));emitVoiceQueueChannelRemove(ut[_0x321e('0x78')](_0x6b0250,_0x321e('0x95')));_0x2d0b14['outboundAnswerCallsDay']+=0x1;_0x2d0b14['total']+=0x1;_0x2d0b14[_0x321e('0x96')]+=0x1;ut[_0x321e('0x4e')](_0x2d0b14,_0x321e('0x97'));_0x6b0250['countglobal']=ut['totalGlobal'](_0x6b0250);ut[_0x321e('0x64')](_0x6b0250,0x4,_0x321e('0x98'));rpcDb['createCustomerHistory'](_0x6b0250,_0x321e('0x99'));rpcDb[_0x321e('0x6b')](_0x6b0250,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0x321e('0x9a')](_0x6b0250);_0x2d0b14[_0x321e('0x9b')]+=_0x6b0250['talktime'];_0x2d0b14[_0x321e('0x9c')]+=_0x6b0250[_0x321e('0x9d')];logger['info']('[syncHangup][talking][decrement]',_0x6b0250[_0x321e('0x9e')],_0x321e('0x8f'),_0x2d0b14[_0x321e('0x24')],_0x321e('0x43'),_0x2d0b14[_0x321e('0x28')]);delete this[_0x321e('0x10')][_0x1d55a1[_0x321e('0x85')]];break;case _0x321e('0x9f'):_0x2d0b14[_0x321e('0xa0')]+=0x1;_0x6b0250[_0x321e('0xa1')]+=0x1;_0x6b0250[_0x321e('0x75')]=ut['totalGlobal'](_0x6b0250);ut[_0x321e('0x64')](_0x6b0250,0x5,_0x321e('0xa2'));_0x3a566d=_0x2d0b14[_0x321e('0xa3')];_0x282940=_0x2d0b14[_0x321e('0x7d')];ami[_0x321e('0x26')](_0x321e('0xa4'),ut[_0x321e('0x78')](_0x6b0250,_0x321e('0xa5')));rpcDb['createCustomerHistory'](_0x6b0250,_0x321e('0xa6'));_0x4a458c[_0x321e('0x7a')](_0x6b0250,'5',_0x2d0b14)[_0x321e('0x8a')](function(_0x166cc4){_0x1e91af=_0x166cc4[_0x321e('0x7b')]==0x1;if(!_0x1e91af){if(ut[_0x321e('0x76')](_0x6b0250)>=_0x2d0b14[_0x321e('0x7e')]){_0x4dbd97=ut['cloneAction'](_0x6b0250,0xf,_0x321e('0xa7'));rpcDb['createCustomerFinal'](_0x4dbd97,_0x321e('0xa8'));}else{if(_0x6b0250[_0x321e('0xa1')]>=_0x2d0b14[_0x321e('0xa9')]){rpcDb[_0x321e('0x6b')](_0x6b0250,_0x321e('0xa6'));}else{rpcDb[_0x321e('0x82')](ut[_0x321e('0xaa')](_0x6b0250,_0x321e('0xa1'),_0x2d0b14[_0x321e('0xa3')]),_0x6b0250['unlockAgent'],_0x6b0250[_0x321e('0x84')]);}}}else{_0x6b0250[_0x321e('0xa1')]++;_0x4a458c[_0x321e('0x88')]({'id':_0x6b0250[_0x321e('0x87')],'field':{'countbusyretry':_0x6b0250[_0x321e('0xa1')]}})[_0x321e('0x8a')](function(){_0x4a458c[_0x321e('0x89')](_0x6b0250,_0x3a566d,_0x282940)['then'](function(){});});}});break;case'NOANSWER':_0x2d0b14['outboundNoAnswerCallsDay']+=0x1;_0x6b0250[_0x321e('0xab')]+=0x1;_0x6b0250[_0x321e('0x75')]=ut[_0x321e('0x76')](_0x6b0250);ut['logCustomer'](_0x6b0250,0x3,_0x321e('0xac'));_0x3a566d=_0x2d0b14['dialNoAnswerRetryFrequency'];_0x282940=_0x2d0b14['callAdditionalPhoneAfterMin'];var _0x19f7b1=ut[_0x321e('0xad')](_0x6b0250,_0x2d0b14);ami[_0x321e('0x26')](_0x321e('0xae'),_0x19f7b1);rpcDb[_0x321e('0x69')](_0x6b0250,_0x321e('0xaf'));_0x4a458c['verifyAdditionalPhones'](_0x6b0250,'3',_0x2d0b14)['then'](function(_0x3cd786){_0x1e91af=_0x3cd786[_0x321e('0x7b')]==0x1;if(!_0x1e91af){if(ut[_0x321e('0x76')](_0x6b0250)>=_0x2d0b14['dialGlobalMaxRetry']){_0x4dbd97=ut['cloneAction'](_0x6b0250,0xf,'Global');rpcDb[_0x321e('0x6b')](_0x4dbd97,_0x321e('0xb0'));}else{if(_0x6b0250['countnoanswerretry']>=_0x2d0b14['dialNoAnswerMaxRetry']){rpcDb[_0x321e('0x6b')](_0x6b0250,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0x321e('0x82')](ut[_0x321e('0xaa')](_0x6b0250,_0x321e('0xab'),_0x2d0b14[_0x321e('0xb1')]),_0x6b0250[_0x321e('0x83')],_0x6b0250[_0x321e('0x84')]);}}}else{_0x6b0250[_0x321e('0xab')]++;_0x4a458c[_0x321e('0x88')]({'id':_0x6b0250[_0x321e('0x87')],'field':{'countnoanswerretry':_0x6b0250[_0x321e('0xab')]}})[_0x321e('0x8a')](function(){_0x4a458c['swapAdditionalPhones'](_0x6b0250,_0x3a566d,_0x282940)[_0x321e('0x8a')](function(){});});}});break;case _0x321e('0xb2'):_0x2d0b14[_0x321e('0xb3')]+=0x1;_0x6b0250['countcongestionretry']+=0x1;_0x6b0250[_0x321e('0x75')]=ut['totalGlobal'](_0x6b0250);ut[_0x321e('0x64')](_0x6b0250,0x8,_0x321e('0xb4'));_0x3a566d=_0x2d0b14[_0x321e('0xb5')];_0x282940=_0x2d0b14[_0x321e('0x7d')];ami[_0x321e('0x26')](_0x321e('0xb6'),ut['buildObj'](_0x6b0250,_0x321e('0xb7')));rpcDb[_0x321e('0x69')](_0x6b0250,_0x321e('0xb8'));_0x4a458c[_0x321e('0x7a')](_0x6b0250,'8',_0x2d0b14)[_0x321e('0x8a')](function(_0x12d643){_0x1e91af=_0x12d643[_0x321e('0x7b')]==0x1;if(!_0x1e91af){if(ut[_0x321e('0x76')](_0x6b0250)>=_0x2d0b14['dialGlobalMaxRetry']){_0x4dbd97=ut[_0x321e('0x7f')](_0x6b0250,0xf,_0x321e('0xa7'));rpcDb['createCustomerFinal'](_0x4dbd97,_0x321e('0xb9'));}else{if(_0x6b0250[_0x321e('0xba')]>=_0x2d0b14[_0x321e('0xbb')]){rpcDb['createCustomerFinal'](_0x6b0250,_0x321e('0xb8'));}else{rpcDb['rescheduleContact'](ut[_0x321e('0xaa')](_0x6b0250,_0x321e('0xba'),_0x2d0b14[_0x321e('0xa3')]),_0x6b0250[_0x321e('0x83')],_0x6b0250[_0x321e('0x84')]);}}}else{_0x6b0250[_0x321e('0xba')]++;_0x4a458c[_0x321e('0x88')]({'id':_0x6b0250[_0x321e('0x87')],'field':{'countcongestionretry':_0x6b0250[_0x321e('0xba')]}})[_0x321e('0x8a')](function(){_0x4a458c[_0x321e('0x89')](_0x6b0250,_0x3a566d,_0x282940)[_0x321e('0x8a')](function(){});});}});break;case _0x321e('0xbc'):_0x2d0b14[_0x321e('0xbd')]+=0x1;_0x6b0250[_0x321e('0xbe')]+=0x1;_0x6b0250[_0x321e('0x75')]=ut[_0x321e('0x76')](_0x6b0250);ut[_0x321e('0x64')](_0x6b0250,0x14,_0x321e('0xbf'));_0x3a566d=_0x2d0b14[_0x321e('0xc0')];_0x282940=_0x2d0b14[_0x321e('0x7d')];ami[_0x321e('0x26')](_0x321e('0xc1'),ut[_0x321e('0x78')](_0x6b0250,_0x321e('0xc2')));rpcDb[_0x321e('0x69')](_0x6b0250,'[syncHangupRequest][logAgentReject]');_0x4a458c[_0x321e('0x7a')](_0x6b0250,'20',_0x2d0b14)['then'](function(_0x1cafee){_0x1e91af=_0x1cafee['additional']==0x1;if(!_0x1e91af){if(ut['totalGlobal'](_0x6b0250)>=_0x2d0b14[_0x321e('0x7e')]){_0x4dbd97=ut[_0x321e('0x7f')](_0x6b0250,0x14,_0x321e('0xbf'));rpcDb['createCustomerFinal'](_0x4dbd97,_0x321e('0xc3'));}else{if(_0x6b0250[_0x321e('0xbe')]>=_0x2d0b14['dialAgentRejectMaxRetry']){rpcDb[_0x321e('0x6b')](_0x6b0250,_0x321e('0xc3'));}else{rpcDb[_0x321e('0x82')](ut[_0x321e('0xaa')](_0x6b0250,_0x321e('0xbe'),_0x2d0b14[_0x321e('0xc0')]),_0x6b0250[_0x321e('0x83')],_0x6b0250['activeContact']);}}}else{_0x6b0250[_0x321e('0xab')]++;_0x4a458c['incrementPreviewCounters']({'id':_0x6b0250[_0x321e('0x87')],'field':{'countnoanswerretry':_0x6b0250[_0x321e('0xab')]}})[_0x321e('0x8a')](function(){_0x4a458c['swapAdditionalPhones'](_0x6b0250,_0x3a566d,_0x282940)[_0x321e('0x8a')](function(){});});}});break;case _0x321e('0xc4'):_0x2d0b14[_0x321e('0xc5')]+=0x1;_0x6b0250[_0x321e('0xc6')]+=0x1;_0x6b0250[_0x321e('0x75')]=ut[_0x321e('0x76')](_0x6b0250);ut[_0x321e('0x64')](_0x6b0250,0xb,_0x321e('0xc7'));rpcDb[_0x321e('0x69')](_0x6b0250,_0x321e('0xc8'));_0x4a458c[_0x321e('0x7a')](_0x6b0250,'11',_0x2d0b14)[_0x321e('0x8a')](function(_0x136491){_0x1e91af=_0x136491['additional']==0x1;if(!_0x1e91af){if(ut[_0x321e('0x76')](_0x6b0250)>=_0x2d0b14['dialGlobalMaxRetry']){_0x4dbd97=ut[_0x321e('0x7f')](_0x6b0250,0xf,'Global');rpcDb[_0x321e('0x6b')](_0x4dbd97,_0x321e('0xc8'));}else{if(_0x6b0250['countabandonedetry']>=_0x2d0b14[_0x321e('0xc9')]){rpcDb[_0x321e('0x6b')](_0x6b0250,_0x321e('0xc8'));}else{rpcDb[_0x321e('0x82')](ut[_0x321e('0xaa')](_0x6b0250,_0x321e('0xc6'),_0x2d0b14[_0x321e('0xca')]),_0x6b0250[_0x321e('0x83')],_0x6b0250[_0x321e('0x84')]);}}}else{_0x6b0250[_0x321e('0xab')]++;_0x4a458c['incrementPreviewCounters']({'id':_0x6b0250[_0x321e('0x87')],'field':{'countnoanswerretry':_0x6b0250[_0x321e('0xab')]}})[_0x321e('0x8a')](function(){_0x4a458c[_0x321e('0x89')](_0x6b0250,_0x3a566d,_0x282940)[_0x321e('0x8a')](function(){});});}});break;case'18':_0x2d0b14[_0x321e('0xcb')]+=0x1;_0x6b0250['countmachineretry']+=0x1;_0x6b0250[_0x321e('0x75')]=ut[_0x321e('0x76')](_0x6b0250);ut[_0x321e('0x64')](_0x6b0250,0x12,_0x1d55a1[_0x321e('0xcc')]||_0x1d55a1['dialstatus']);ami[_0x321e('0x26')](_0x321e('0xcd'),ut[_0x321e('0x78')](_0x6b0250,_0x321e('0xce')));rpcDb[_0x321e('0x69')](_0x6b0250,_0x321e('0xcf'));_0x4a458c[_0x321e('0x7a')](_0x6b0250,'18',_0x2d0b14)[_0x321e('0x8a')](function(_0xddc63f){_0x1e91af=_0xddc63f[_0x321e('0x7b')]==0x1;if(!_0x1e91af){if(ut[_0x321e('0x76')](_0x6b0250)>=_0x2d0b14[_0x321e('0x7e')]){_0x4dbd97=ut[_0x321e('0x7f')](_0x6b0250,0x12,'Global');rpcDb[_0x321e('0x6b')](_0x4dbd97,_0x321e('0xcf'));}else{rpcDb[_0x321e('0x6b')](_0x6b0250,_0x321e('0xcf'));}}else{_0x6b0250['countnoanswerretry']++;_0x4a458c[_0x321e('0x88')]({'id':_0x6b0250[_0x321e('0x87')],'field':{'countnoanswerretry':_0x6b0250['countnoanswerretry']}})['then'](function(){_0x4a458c[_0x321e('0x89')](_0x6b0250,_0x3a566d,_0x282940)['then'](function(){});});}});delete this['actions'][_0x1d55a1[_0x321e('0x85')]];break;case'19':_0x2d0b14[_0x321e('0xcb')]+=0x1;_0x6b0250[_0x321e('0x75')]=ut[_0x321e('0x76')](_0x6b0250);ut['logCustomer'](_0x6b0250,0x13,_0x1d55a1[_0x321e('0xcc')]||_0x1d55a1['dialstatus']);ami[_0x321e('0x26')](_0x321e('0xcd'),ut[_0x321e('0x78')](_0x6b0250,_0x321e('0xce')));rpcDb[_0x321e('0x69')](_0x6b0250,_0x321e('0xd0'));_0x4a458c[_0x321e('0x7a')](_0x6b0250,'18',_0x2d0b14)['then'](function(_0x5ec0d7){_0x1e91af=_0x5ec0d7[_0x321e('0x7b')]==0x1;if(!_0x1e91af){if(ut[_0x321e('0x76')](_0x6b0250)>=_0x2d0b14[_0x321e('0x7e')]){_0x4dbd97=ut[_0x321e('0x7f')](_0x6b0250,0xf,'Global');rpcDb[_0x321e('0x6b')](_0x4dbd97,_0x321e('0xd0'));}else{rpcDb[_0x321e('0x6b')](_0x6b0250,_0x321e('0xd0'));}}else{_0x6b0250['countnoanswerretry']++;_0x4a458c[_0x321e('0x88')]({'id':_0x6b0250[_0x321e('0x87')],'field':{'countnoanswerretry':_0x6b0250[_0x321e('0xab')]}})['then'](function(){_0x4a458c['swapAdditionalPhones'](_0x6b0250,_0x3a566d,_0x282940)[_0x321e('0x8a')](function(){});});}});delete this[_0x321e('0x10')][_0x1d55a1[_0x321e('0x85')]];break;default:if(_0x6b0250['dialAnswer']){ut[_0x321e('0x4e')](_0x2d0b14,_0x321e('0xd1'));ut[_0x321e('0x50')]('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x2d0b14[_0x321e('0x24')],_0x1d55a1);}_0x2d0b14[_0x321e('0xcb')]+=0x1;_0x6b0250[_0x321e('0x75')]=ut[_0x321e('0x76')](_0x6b0250);ut[_0x321e('0x64')](_0x6b0250,0xc,_0x1d55a1[_0x321e('0xcc')]||_0x1d55a1[_0x321e('0xd2')]);_0x3a566d=_0x2d0b14[_0x321e('0xc0')];_0x282940=_0x2d0b14[_0x321e('0x7d')];rpcDb['createCustomerHistory'](_0x6b0250,_0x321e('0xd3'));_0x4a458c[_0x321e('0x7a')](_0x6b0250,'20',_0x2d0b14)[_0x321e('0x8a')](function(_0x559f13){_0x1e91af=_0x559f13[_0x321e('0x7b')]==0x1;if(!_0x1e91af){if(ut[_0x321e('0x76')](_0x6b0250)>=_0x2d0b14[_0x321e('0x7e')]){_0x4dbd97=ut[_0x321e('0x7f')](_0x6b0250,0xf,'Global');rpcDb[_0x321e('0x6b')](_0x4dbd97,_0x321e('0xd4'));}else{rpcDb['createCustomerFinal'](_0x6b0250,_0x321e('0xd4'));}delete this[_0x321e('0x10')][_0x1d55a1[_0x321e('0x85')]];}else{_0x4a458c[_0x321e('0x89')](_0x6b0250,_0x3a566d,_0x282940)[_0x321e('0x8a')](function(){});}});}if(!(_0x6b0250['dialAnswer']&&_0x212471==='16')){ut[_0x321e('0x4c')](_0x2d0b14,_0x321e('0xd5'));logger[_0x321e('0x52')](_0x321e('0xd6'),_0x6b0250[_0x321e('0x9e')],_0x321e('0x8f'),_0x2d0b14['name'],_0x321e('0xd7'),_0x2d0b14[_0x321e('0x42')]);}if(_0x212471!==_0x321e('0x8b')){delete this['actions'][_0x1d55a1[_0x321e('0x85')]];delete this[_0x321e('0x10')][_0x1d55a1[_0x321e('0xd8')]];}_0x2d0b14[_0x321e('0xd9')]=!![];}};Preview[_0x321e('0xc')][_0x321e('0xda')]=function(_0xcedffb,_0x40f45a,_0x39a8d3){if(_[_0x321e('0xdb')](_0x40f45a)&&_0x321e('0xdc')!==typeof _0x40f45a){return;}if(_['isUndefined'](_0x39a8d3)&&_0x321e('0xdc')!==typeof _0x39a8d3){return;}switch(_0x39a8d3[_0x321e('0xdd')]){case'0':ut['logAgent'](_0xcedffb,0x0,_0x321e('0x77'));rpcDb['createAgentHistory'](_0xcedffb,_0x321e('0xde'));break;case'3':ut[_0x321e('0xdf')](_0xcedffb,0x3,_0x321e('0xac'));rpcDb[_0x321e('0xe0')](_0xcedffb,_0x321e('0xe1'));break;case'5':ut['logAgent'](_0xcedffb,0x5,_0x321e('0xa2'));rpcDb['createAgentHistory'](_0xcedffb,_0x321e('0xe2'));break;case'8':ut['logAgent'](_0xcedffb,0x8,_0x321e('0xb4'));rpcDb[_0x321e('0xe0')](_0xcedffb,_0x321e('0xe3'));break;case'22':ut[_0x321e('0xdf')](_0xcedffb,0x16,_0x321e('0xe4'));rpcDb['createAgentHistory'](_0xcedffb,_0x321e('0xe5'));break;default:ut[_0x321e('0xdf')](_0xcedffb,0xc,_0x39a8d3[_0x321e('0xdd')]);rpcDb[_0x321e('0xe0')](_0xcedffb,_0x321e('0xe3'));}ut[_0x321e('0x4c')](_0x40f45a,_0x321e('0xe6'));logger['info'](_0x321e('0xe7'),_0xcedffb[_0x321e('0x9e')],_0x321e('0x8f'),_0x40f45a[_0x321e('0x24')],'originated:\x20',_0x40f45a['originated']);delete this[_0x321e('0x10')][_0xcedffb[_0x321e('0x9e')]];};Preview[_0x321e('0xc')][_0x321e('0x7a')]=function(_0x48d43e,_0x1a2f90,_0x503d5b){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x48d43e,_0x1a2f90,_0x503d5b)[_0x321e('0x5f')](logger[_0x321e('0x52')]('[verifyAdditionalPhone]\x20'));};Preview[_0x321e('0xc')][_0x321e('0x89')]=function(_0xc42608,_0x263e07,_0x472753){return cmHopperAdditionalPhone[_0x321e('0x89')](_0xc42608,_0x263e07,_0x472753)[_0x321e('0x5f')](logger[_0x321e('0x52')](_0x321e('0xe8')));};Preview[_0x321e('0xc')][_0x321e('0x88')]=function(_0x5512){return Promise[_0x321e('0xe9')]()[_0x321e('0x8a')](cmHopperAdditionalPhone['incrementPreviewCounters'](_0x5512))['catch'](logger[_0x321e('0x52')]('[incrementPreviewCounters]\x20'));};Preview[_0x321e('0xc')]['checkInBlack']=function(_0x390af6,_0x2f9000,_0x63ef3d,_0x12547a,_0x2719dd){var _0x8d645d=this;return new Promise(function(_0x4dbdf8,_0x188a2d){if(_[_0x321e('0xea')](_0x2f9000)||_[_0x321e('0xea')](_0x2f9000[_0x321e('0xeb')])||_['isNil'](_0x2f9000['phone'])||_['isNil'](_0x2f9000[_0x321e('0xec')])){_0x188a2d(ut['message']('Contact\x20is\x20undefined',_0x12547a,_0x2719dd));return;}var _0x3d82e3=uuid['v4']();var _0x175b44=_0x8d645d[_0x321e('0x33')][_0x2f9000[_0x321e('0x40')][_0x321e('0x24')]];var _0x33e352=_0x63ef3d?_0x8d645d[_0x321e('0x11')][_0x63ef3d]['id']:undefined;_0x8d645d[_0x321e('0x10')][_0x3d82e3]=new Action(_0x2f9000,_0x175b44,_0x3d82e3,_0x63ef3d,_0x33e352);var _0x5c93f6=_0x8d645d[_0x321e('0x10')][_0x3d82e3];_0x5c93f6[_0x321e('0x83')]=_0x12547a;_0x5c93f6[_0x321e('0x84')]=_0x2719dd;_0x5c93f6['lookAgent']=_0x63ef3d;if(_[_0x321e('0xed')](_0x390af6)){_0x8d645d['execCall'](_0x5c93f6,_0x175b44,_0x2f9000,_0x63ef3d)[_0x321e('0x8a')](function(_0x25d6d0){logger[_0x321e('0x52')]('[Preview][execCall][success]',_0x321e('0xee')+_0x5c93f6[_0x321e('0x41')]+_0x321e('0xef')+_0x5c93f6[_0x321e('0x87')],JSON[_0x321e('0x21')](_0x25d6d0));ami[_0x321e('0x26')](_0x321e('0xf0'),ut['buildObj'](_0x5c93f6,_0x321e('0xf1'),_0x8d645d[_0x321e('0x33')][_0x5c93f6[_0x321e('0x41')]]));_0x4dbdf8(ut[_0x321e('0x4a')](_0x321e('0xf2')));})[_0x321e('0x5f')](function(_0xa21c4f){ut[_0x321e('0x2e')](_0x321e('0xf3'),_0xa21c4f);_0x188a2d(ut[_0x321e('0x4a')](_0x321e('0xf4'),_0x12547a,_0x2719dd));});}else{_0x175b44[_0x321e('0xf5')]+=0x1;ut[_0x321e('0xf6')](_0x5c93f6);rpcDb[_0x321e('0xf7')](_0x5c93f6,'[Blacklist][error]');delete _0x8d645d['actions'][_0x3d82e3];_0x188a2d(ut[_0x321e('0x4a')](_0x321e('0xf8'),_0x12547a,_0x2719dd));}});};Preview[_0x321e('0xc')][_0x321e('0x71')]=function(_0x449a13){return!_[_0x321e('0xea')](_0x449a13)&&!_[_0x321e('0xea')](_0x449a13[_0x321e('0x24')])&&!_['isNil'](_0x449a13[_0x321e('0xf9')])&&_0x449a13[_0x321e('0xf9')]&&!_[_0x321e('0xea')](this[_0x321e('0xf')][util['format']('SIP/%s',_0x449a13[_0x321e('0x24')])])&&!_['isNil'](this[_0x321e('0xf')][util[_0x321e('0x22')]('SIP/%s',_0x449a13[_0x321e('0x24')])][_0x321e('0x48')])&&(this[_0x321e('0xf')][util[_0x321e('0x22')](_0x321e('0xfa'),_0x449a13['name'])][_0x321e('0x48')]===_0x321e('0xfb')||this[_0x321e('0xf')][util['format'](_0x321e('0xfa'),_0x449a13['name'])][_0x321e('0x48')]===_0x321e('0xfc'));};Preview['prototype'][_0x321e('0x5c')]=function(_0xaf74fe,_0x24d1ee){return this[_0x321e('0xfd')](_0xaf74fe,_0x24d1ee)[_0x321e('0x8a')](function(_0x4328a7){return _[_0x321e('0x44')](_0x4328a7,['message']);})[_0x321e('0x5f')](function(_0x28a208){if(_0x28a208[_0x321e('0xfe')]){rpcDb[_0x321e('0xff')](_0xaf74fe);}if(_0x28a208['active']){rpcDb['disableContact'](_0xaf74fe);}throw _[_0x321e('0x44')](_0x28a208,[_0x321e('0x4a')]);});};Preview[_0x321e('0xc')][_0x321e('0xfd')]=function(_0x17e7a0,_0x5cfa5a){var _0x10ff42=this;var _0x3bc15f,_0x500372;return rpcDb[_0x321e('0x100')](_0x17e7a0)['then'](function(_0x509b2c){if(!_['isNil'](_0x509b2c[0x0])){_0x500372=_0x509b2c[0x0][_0x321e('0x101')]?![]:!![];_0x3bc15f=_0x509b2c[0x0][_0x321e('0x101')]?!![]:![];_0x3bc15f=_0x5cfa5a?!![]:_0x3bc15f;}var _0x368014=_0x10ff42[_0x321e('0x102')](_0x509b2c);if(_0x368014[_0x321e('0x103')]){rpcDb['checkIsBlackList'](_[_0x321e('0x44')](_0x509b2c[0x0],[_0x321e('0xec'),_0x321e('0x104')]))[_0x321e('0x8a')](function(_0x86f203){_0x10ff42[_0x321e('0x105')](_0x86f203,_0x509b2c[0x0],_0x5cfa5a,_0x500372,_0x3bc15f)['then'](function(_0x12df4f){return _0x12df4f;})['catch'](function(_0x571144){throw _0x571144;});})['catch'](function(_0x2ef6c0){ut[_0x321e('0x2e')](_0x321e('0x106'),_0x2ef6c0);throw ut[_0x321e('0x4a')](_0x321e('0x107'),_0x500372,_0x3bc15f);});}else{throw ut[_0x321e('0x4a')](_0x368014[_0x321e('0x4a')],_0x500372,_0x3bc15f);}})[_0x321e('0x5f')](function(_0x5b27a5){ut[_0x321e('0x2e')](_0x321e('0x108'),_0x5b27a5);throw ut['message'](_0x321e('0x107'),![],!![]);});};Preview[_0x321e('0xc')][_0x321e('0x102')]=function(_0x52132f){if(_[_0x321e('0xea')](_0x52132f)||_[_0x321e('0xed')](_0x52132f)||!_[_0x321e('0xea')](_0x52132f[0x0][_0x321e('0x5a')])&&_['isNil'](_0x52132f[0x0][_0x321e('0x5a')][_0x321e('0x24')])){ut['logger']('[Preview][validateContact][Empty\x20Contact]',_0x52132f);return{'isValid':![],'message':_0x321e('0x109')};}var _0x51a5e6=this[_0x321e('0x33')][_0x52132f[0x0][_0x321e('0x40')]['name']];_0x51a5e6[_0x321e('0x4a')]=utils[_0x321e('0x2c')][_0x321e('0x73')];if(_[_0x321e('0xea')](_0x51a5e6)){ut[_0x321e('0x2e')]('[Preview][validateContact][Empty\x20Campaign]',_0x51a5e6);return{'isValid':![],'message':_0x321e('0x10a')};}if(!this['isTrunkReachable'](_0x51a5e6['Trunk'])){ut[_0x321e('0x2e')](_0x321e('0x10b'),_0x321e('0x10c')+_0x51a5e6[_0x321e('0x24')]+_0x321e('0x10d'));if(!this[_0x321e('0x71')](_0x51a5e6[_0x321e('0x72')])){ut[_0x321e('0x2e')](_0x321e('0x10b'),_0x51a5e6[_0x321e('0x24')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0x321e('0x10e')};}}if(!ut[_0x321e('0x6f')](_0x51a5e6['dialActive'])){ut['logger']('[Preview][validateContact][Campaign\x20Active]',_0x51a5e6[_0x321e('0x24')]+_0x321e('0x10f'));return{'isValid':![],'message':_0x321e('0x10c')+_0x51a5e6[_0x321e('0x24')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x321e('0xc')][_0x321e('0x110')]=function(_0x11b4e7,_0x25c6e7,_0x291d5c,_0x1614c2){var _0x5789ee=this;return new Promise(function(_0x50d93c,_0x5852e0){var _0x3f5dd4=_0x11b4e7[_0x321e('0x9e')];var _0x538129=_0x5789ee[_0x321e('0x71')](_0x25c6e7[_0x321e('0x111')])?util[_0x321e('0x22')](_0x321e('0x112'),_0x25c6e7[_0x321e('0x111')][_0x321e('0x24')],_['isNil'](_0x25c6e7[_0x321e('0x113')])?'':_0x25c6e7[_0x321e('0x113')]['trim']()||'',_0x25c6e7['dialCutDigit']>0x0?_0x291d5c[_0x321e('0x104')][_0x321e('0x114')](_0x25c6e7[_0x321e('0x115')]):_0x291d5c[_0x321e('0x104')]):util[_0x321e('0x22')](_0x321e('0x112'),_[_0x321e('0xea')](_0x25c6e7['TrunkBackup'])?_0x25c6e7['Trunk'][_0x321e('0x24')]:_0x25c6e7[_0x321e('0x72')][_0x321e('0x24')],_[_0x321e('0xea')](_0x25c6e7[_0x321e('0x113')])?'':_0x25c6e7[_0x321e('0x113')][_0x321e('0x116')]()||'',_0x25c6e7[_0x321e('0x115')]>0x0?_0x291d5c[_0x321e('0x104')][_0x321e('0x114')](_0x25c6e7[_0x321e('0x115')]):_0x291d5c[_0x321e('0x104')]);var _0x7814fe=_0x5789ee[_0x321e('0x71')](_0x25c6e7[_0x321e('0x111')])?ut[_0x321e('0x117')](_0x25c6e7[_0x321e('0x111')][_0x321e('0x118')],_0x25c6e7[_0x321e('0x119')],_0x25c6e7[_0x321e('0x11a')]>0x0?ut[_0x321e('0x11b')](_0x25c6e7[_0x321e('0x11c')],_0x25c6e7[_0x321e('0x11a')]):_0x25c6e7[_0x321e('0x11c')]):ut[_0x321e('0x117')](_[_0x321e('0xea')](_0x25c6e7[_0x321e('0x72')])?_0x25c6e7['Trunk']['callerid']:_0x25c6e7[_0x321e('0x72')][_0x321e('0x118')],_0x25c6e7['dialOriginateCallerIdName'],_0x25c6e7[_0x321e('0x11a')]>0x0?ut[_0x321e('0x11b')](_0x25c6e7[_0x321e('0x11c')],_0x25c6e7[_0x321e('0x11a')]):_0x25c6e7['dialOriginateCallerIdNumber']);if(_0x7814fe){_0x11b4e7['originatecalleridname']=ut[_0x321e('0x11d')](_0x7814fe);_0x11b4e7[_0x321e('0x11e')]=ut['extractCalleridNumber'](_0x7814fe);}var _0x22c59a=ut[_0x321e('0x11f')](_0x25c6e7,_0x291d5c,_0x538129,_0x7814fe,_0x3f5dd4,_0x11b4e7);var _0x28d03d=utils['setXMDContactVariables'](_0x291d5c[_0x321e('0xeb')]);Object[_0x321e('0x120')](_0x22c59a,_0x28d03d);_[_0x321e('0x121')](_0x11b4e7,ut[_0x321e('0x122')](_0x22c59a));_0x11b4e7[_0x321e('0x61')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x25c6e7['variables']=_0x22c59a;var _0x90598b=ut[_0x321e('0x123')](_0x11b4e7,_0x25c6e7,_0x22c59a,_0x11b4e7['activeContact'],_0x1614c2);return ami[_0x321e('0x47')](_0x90598b)['then'](function(_0x2285fc){_0x25c6e7[_0x321e('0x42')]+=0x1;logger[_0x321e('0x52')](_0x321e('0x124'),_0x3f5dd4,_0x321e('0x8f'),_0x25c6e7[_0x321e('0x24')],_0x321e('0xd7'),_0x25c6e7[_0x321e('0x42')]);_0x50d93c(_0x2285fc);})[_0x321e('0x5f')](function(_0x32ac21){ut[_0x321e('0xdf')](_0x11b4e7,0xe,_0x321e('0x125'));rpcDb[_0x321e('0xe0')](_0x11b4e7,_0x321e('0x126'));_0x5852e0(_0x32ac21);});});};Preview['prototype'][_0x321e('0x1a')]=function(_0x5f09e2){if(this[_0x321e('0x10')][_0x5f09e2[_0x321e('0x85')]]){this[_0x321e('0x10')][_0x5f09e2[_0x321e('0x85')]][_0x321e('0x49')]=_0x5f09e2['channel'];}};Preview['prototype'][_0x321e('0x12')]=function(_0x49b1a3){var _0x49aa98=this;var _0x54f9b0=this[_0x321e('0x10')][_0x49b1a3[_0x321e('0x127')]];if(_0x54f9b0){if(_0x54f9b0[_0x321e('0x128')]&&this[_0x321e('0x11')][_0x54f9b0[_0x321e('0x128')]]){ut[_0x321e('0x129')](_0x54f9b0,this['agents'][_0x54f9b0[_0x321e('0x128')]]['name'],this[_0x321e('0x11')][_0x54f9b0[_0x321e('0x128')]]['id']);}var _0x3e51b2=_[_0x321e('0x12a')](_0x54f9b0);_0x3e51b2[_0x321e('0x8c')]=moment()[_0x321e('0x22')](_0x321e('0x62'));var _0x431234=_0x49aa98['campaignsPreview'][_0x54f9b0[_0x321e('0x41')]];if(ut[_0x321e('0x12b')](_0x49b1a3[_0x321e('0x12c')])){if(_0x54f9b0[_0x321e('0x83')]){rpcDb[_0x321e('0xff')](_0x54f9b0[_0x321e('0x87')]);}if(_0x54f9b0[_0x321e('0x84')]){rpcDb[_0x321e('0x60')](_0x54f9b0[_0x321e('0x87')]);}ami[_0x321e('0x26')](_0x321e('0x12d'),ut[_0x321e('0x78')](_0x54f9b0,_0x321e('0x12e'),this[_0x321e('0x33')][_0x54f9b0['queue']]));this[_0x321e('0xda')](_0x3e51b2,_0x431234,_0x49b1a3);}else{_0x54f9b0['starttime']=moment()[_0x321e('0x22')](_0x321e('0x62'));ut[_0x321e('0xdf')](_0x3e51b2,0x4,_0x321e('0x98'));rpcDb['createAgentHistory'](_0x3e51b2,_0x321e('0x12f'));}}};Preview[_0x321e('0xc')][_0x321e('0x14')]=function(_0x321328){var _0x24019d=this[_0x321e('0x10')][_0x321328[_0x321e('0x85')]];var _0x1a1025;if(_0x24019d){_0x1a1025=this[_0x321e('0x33')][_0x24019d['queue']];logger['info'](_0x321e('0x130'),_0x321328[_0x321e('0x85')],_0x321e('0x8f'),_0x1a1025[_0x321e('0x24')],'pTalking:\x20',_0x1a1025[_0x321e('0x28')]);}if(this[_0x321e('0x10')][_0x321328['linkedid']]&&_0x321328['linkedid']!==_0x321328[_0x321e('0x9e')]){if(_0x321328[_0x321e('0x131')]==='16'&&this[_0x321e('0x10')][_0x321328[_0x321e('0x85')]]['dialAnswer']){this['callProgressDetectingCustomer'](_0x321328,_0x321328['linkedid'],_0x321328[_0x321e('0x131')]);}else if(this[_0x321e('0x10')][_0x321328[_0x321e('0x85')]][_0x321e('0x4d')]){logger[_0x321e('0x52')](_0x321e('0x132'),_0x321328[_0x321e('0x85')],_0x321328[_0x321e('0x131')],_0x321e('0x8f'),_0x1a1025[_0x321e('0x24')],_0x321e('0x43'),_0x1a1025[_0x321e('0x28')]);this[_0x321e('0x133')](_0x321328,_0x321328['linkedid'],_0x321328[_0x321e('0x131')]);}}else if(_0x24019d&&_['isNil'](_0x24019d[_0x321e('0x134')])&&_0x1a1025[_0x321e('0x135')]&&_0x321328[_0x321e('0x85')]===_0x321328[_0x321e('0x9e')]&&_[_0x321e('0xea')](_0x321328[_0x321e('0xdd')])&&_0x321328[_0x321e('0x131')]==='16'&&_0x321328[_0x321e('0x136')]==='6'&&_['isUndefined'](_0x24019d[_0x321e('0x137')])){if(_0x24019d[_0x321e('0x83')]){rpcDb[_0x321e('0xff')](_0x24019d['idContact']);}if(_0x24019d[_0x321e('0x84')]){rpcDb['disableContact'](_0x24019d[_0x321e('0x87')]);}_0x321328['reason']='22';this[_0x321e('0xda')](_0x24019d,_0x1a1025,_0x321328);}else if(_0x24019d&&_0x24019d['transfer']){if(_0x321328['cause']==='16'&&this['actions'][_0x321328[_0x321e('0x85')]][_0x321e('0x4d')]){logger['info']('[syncHangup][talking][transfer]',_0x321328[_0x321e('0x85')],_0x321328['cause'],_0x321e('0x8f'),_0x1a1025[_0x321e('0x24')],_0x321e('0x43'),_0x1a1025[_0x321e('0x28')]);this[_0x321e('0x133')](_0x321328,_0x321328['linkedid'],_0x321328[_0x321e('0x131')]);}else if(this[_0x321e('0x10')][_0x321328[_0x321e('0x85')]][_0x321e('0x4d')]){logger[_0x321e('0x52')](_0x321e('0x132'),_0x321328[_0x321e('0x85')],_0x321328[_0x321e('0x131')],'\x20Queue',_0x1a1025[_0x321e('0x24')],_0x321e('0x43'),_0x1a1025[_0x321e('0x28')]);this[_0x321e('0x133')](_0x321328,_0x321328[_0x321e('0x85')],_0x321328[_0x321e('0x131')]);}}};Preview['prototype']['syncDialEnd']=function(_0x4da150){if(this['actions'][_0x4da150[_0x321e('0xd8')]]&&_0x4da150[_0x321e('0xd8')]!==_0x4da150[_0x321e('0x138')]){this[_0x321e('0x133')](_0x4da150,_0x4da150[_0x321e('0xd8')],_0x4da150['dialstatus']);}};Preview[_0x321e('0xc')][_0x321e('0x16')]=function(_0x2496b2){if(this[_0x321e('0x10')][_0x2496b2['linkedid']]&&_0x2496b2[_0x321e('0x85')]!==_0x2496b2[_0x321e('0x9e')]&&!this[_0x321e('0x10')][_0x2496b2['linkedid']]['dialAnswer']){if(_0x2496b2[_0x321e('0x131')]==='1'){this[_0x321e('0x133')](_0x2496b2,_0x2496b2[_0x321e('0x85')],_0x2496b2['cause']);}}};Preview[_0x321e('0xc')]['addVariable']=function(_0x24d9b8,_0x3bc3d1,_0x2a5d86){if(this['actions'][_0x24d9b8]){if(_[_0x321e('0xea')](this[_0x321e('0x10')][_0x24d9b8][_0x321e('0x139')])){this[_0x321e('0x10')][_0x24d9b8]['variables']={};}this[_0x321e('0x10')][_0x24d9b8][_0x321e('0x139')][_0x3bc3d1]=_0x2a5d86;}};Preview['prototype'][_0x321e('0x1b')]=function(_0x5d990c){try{if(!_[_0x321e('0xea')](_0x5d990c)){if(ut[_0x321e('0x13a')](_[_0x321e('0x13b')](_0x5d990c[_0x321e('0x13c')])[0x0])){this['addVariable'](_0x5d990c['uniqueid'],_[_0x321e('0x13b')](_0x5d990c[_0x321e('0x13c')])[0x0],_0x5d990c['value']);}}}catch(_0x586040){logger[_0x321e('0x13d')](_0x321e('0x13e'),util[_0x321e('0x13f')](_0x586040,{'showHidden':![],'depth':null}));}};Preview[_0x321e('0xc')][_0x321e('0x1c')]=function(_0x43a9a8){if(_0x43a9a8){if(this[_0x321e('0x10')][_0x43a9a8[_0x321e('0x140')]]){this[_0x321e('0x10')][_0x43a9a8[_0x321e('0x140')]][_0x321e('0x137')]=!![];}}};Preview[_0x321e('0xc')]['syncBlindTransfer']=function(_0x155f78){if(_0x155f78){if(this[_0x321e('0x10')][_0x155f78[_0x321e('0x141')]]){this[_0x321e('0x10')][_0x155f78['transfererlinkedid']]['transfer']=!![];}}};module['exports']=Preview; \ No newline at end of file +var _0xd965=['getCallerIdRandom','dialOriginateCallerIdNumber','dialRandomLastDigitCallerIdNumber','extractCalleridName','addVariables','Contact','assign','merge','toLowerVariables','starttime','variables','variablesAction','[originated][increment]','actionid','logLookAgent','clone','response','custom:agentringnoanswer','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','[syncHangup][talking][transfer]','destlinkedid','destuniqueid','addVariable','filterKey','variable','keys','value','error','[syncVarSet][Preview]','syncAttendedTransfer','transfertargetlinkedid','transfer','lodash','ioredis','../../../config/environment','preview','../../../config/logger','actionPreview','./rpcDb','../rpc/cmHopperAdditionalPhone','./action','./util/util','../dialer/utils','redis','defaults','socket.io-emitter','prototype','tail','finally','sequence','campaignsPreview','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','syncHangupRequest','syncDialEnd','syncNewExten','varset','syncVarSet','blindtransfer','syncBlindTransfer','loopCampaigns','emit','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','format','name','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','paused','CAMPAIGN_STATUS','[CampaignPreview]\x20Campaign\x20Queue:\x20','logger','syncCampaigns','hasOwnProperty','dialMethod','booked','type','outbound','clearZombieChannels','dialActive','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','enqueue','isNil','[clearZombieChannels][talking]','originated:\x20','queue','dialAnswer','pick','contactId','UserId','ListId','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','[Dialer][checkChannel][pTalking][Preview]','loggerError','[Dialer][checkChannel][Preview]','[action]','size','getContactRecallMe','agentReadyId','then','length','getDiff','dialRecallMeTimeout','Agent','run','logger2','[RecallMe]','disableContact','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','createCustomerHistory','createCustomerFinal','[HistoryRecallClose]','[getContactRecallMe]','loggedIn','isActive','message','INACTIVE','isTrunkReachable','Trunk','callProgressDetectingCustomer','countglobal','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','additional','dialNoSuchNumberRetryFrequency','totalGlobal','dialGlobalMaxRetry','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','unlockAgent','activeContact','linkedid','countnosuchnumberretry','incrementPreviewCounters','idContact','swapAdditionalPhones','ANSWER','YYYY-MM-DD\x20HH:mm:ss','responsetime','answertime','uniqueid','\x20Queue','pTalking:\x20','custom:agentconnect','buildObj','connect','custom:agentcomplete','complete','outboundAnswerCallsDay','total','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','sumDuration','sumBillable','talktime','[syncHangup][talking][decrement]','BUSY','countbusyretry','Busy','dialBusyRetryFrequency','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','verifyAdditionalPhones','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','NOANSWER','outboundNoAnswerCallsDay','countnoanswerretry','NoAnswer','dialNoAnswerRetryFrequency','callAdditionalPhoneAfterMin','buildNoAnswerEventPayload','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','cloneAction','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','CANCEL','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','ABANDONED','outboundAbandonedCallsDay','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','countabandonedretry','dialAbandonedRetryFrequency','countmachineretry','cause-txt','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','outboundUnknownCallsDay','dialstatus','[callProgressDetectingCustomer][machine]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','queueSummaryCountersUpdated','callProgressDetectingAgent','isUndefined','object','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','reason','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','resolve','[incrementPreviewCounters]\x20','checkInBlack','phone','VoiceQueueId','Contact\x20is\x20undefined','lookAgent','isEmpty','[Preview][execCall][success]','Queue:\x20','Calling','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','reachable','unmonitored','unlock','unlockContact','getContactPreview','recallme','validateContact','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','Queue','ACTIVE','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','TrunkBackup','getCallerId','callerid','dialOriginateCallerIdName'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xd965,0x15b));var _0x5d96=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd965[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var _=require(_0x5d96('0x0'));var uuid=require('uuid');var moment=require('moment');var Redis=require(_0x5d96('0x1'));var config=require(_0x5d96('0x2'));var logger=require('../../../config/logger')(_0x5d96('0x3'));var loggerAction=require(_0x5d96('0x4'))(_0x5d96('0x5'));var ami=require('../ami');var rpcDb=require(_0x5d96('0x6'));var cmHopperAdditionalPhone=require(_0x5d96('0x7'));var Action=require(_0x5d96('0x8'));var ut=require(_0x5d96('0x9'));var utils=require(_0x5d96('0xa'));config[_0x5d96('0xb')]=_[_0x5d96('0xc')](config[_0x5d96('0xb')],{'host':'localhost','port':0x18eb});var io=require(_0x5d96('0xd'))(new Redis(config[_0x5d96('0xb')]));var Sequence=function(){};Sequence[_0x5d96('0xe')]['enqueue']=function(_0xeabe81){this[_0x5d96('0xf')]=this[_0x5d96('0xf')]?this[_0x5d96('0xf')][_0x5d96('0x10')](_0xeabe81):_0xeabe81();};function Preview(_0x3375b5){this[_0x5d96('0x11')]=new Sequence();this[_0x5d96('0x12')]=_0x3375b5['voiceQueues'];this[_0x5d96('0x13')]=_0x3375b5[_0x5d96('0x13')];this[_0x5d96('0x14')]={};this['agents']=_0x3375b5[_0x5d96('0x15')];this[_0x5d96('0x16')]=0x0;ami['on'](_0x5d96('0x17'),this[_0x5d96('0x18')][_0x5d96('0x19')](this));ami['on'](_0x5d96('0x1a'),this[_0x5d96('0x1b')]['bind'](this));ami['on']('hanguprequest',this[_0x5d96('0x1c')][_0x5d96('0x19')](this));ami['on']('dialend',this[_0x5d96('0x1d')][_0x5d96('0x19')](this));ami['on']('newexten',this[_0x5d96('0x1e')][_0x5d96('0x19')](this));ami['on'](_0x5d96('0x1f'),this[_0x5d96('0x20')][_0x5d96('0x19')](this));ami['on']('attendedtransfer',this['syncAttendedTransfer']['bind'](this));ami['on'](_0x5d96('0x21'),this[_0x5d96('0x22')]['bind'](this));this[_0x5d96('0x23')](this[_0x5d96('0x12')]);}function emit(_0x4e674a,_0xcbe0be,_0x40f44a){io['to'](_0x4e674a)[_0x5d96('0x24')](_0xcbe0be,_0x40f44a);}function emitVoiceQueueChannelRemove(_0x48d391){logger[_0x5d96('0x25')](_0x5d96('0x26'),JSON[_0x5d96('0x27')](_0x48d391));emit(util[_0x5d96('0x28')]('voice:queue:%s',_0x48d391[_0x5d96('0x29')]),_0x5d96('0x2a'),_0x48d391);io[_0x5d96('0x24')](_0x5d96('0x2b'),_0x48d391);}function notSendMessagesQueue(_0x56af95){if(_0x56af95[_0x5d96('0x2c')]){if(_0x56af95[_0x5d96('0x2d')]===0x0&&_0x56af95[_0x5d96('0x2e')]===0x0){_0x56af95[_0x5d96('0x2c')]=![];_0x56af95['available']=0x0;_0x56af95[_0x5d96('0x2f')]=0x0;_0x56af95['message']=utils[_0x5d96('0x30')]['INACTIVE'];ut['logger'](_0x5d96('0x31'),_0x56af95[_0x5d96('0x29')]+'\x20is\x20not\x20active');}else{_0x56af95['message']=utils[_0x5d96('0x30')]['DEACTIVATED'];ut[_0x5d96('0x32')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x56af95[_0x5d96('0x29')]+'\x20is\x20deactivated');}}}Preview['prototype'][_0x5d96('0x23')]=function(){var _0x2415c2=this;setInterval(function(){_0x2415c2[_0x5d96('0x33')]();},0x7cf);};Preview[_0x5d96('0xe')]['syncCampaigns']=function(){var _0x3a4a93=this[_0x5d96('0x12')];this[_0x5d96('0x16')]+=0x1;for(var _0x278e78 in _0x3a4a93){if(_0x3a4a93[_0x5d96('0x34')](_0x278e78)&&(_0x3a4a93[_0x278e78][_0x5d96('0x35')]===_0x5d96('0x3')||_0x3a4a93[_0x278e78][_0x5d96('0x35')]===_0x5d96('0x36'))&&_0x3a4a93[_0x278e78][_0x5d96('0x37')]===_0x5d96('0x38')){if(this[_0x5d96('0x16')]>0x7){this['clockClearZombieChannels']=0x0;this[_0x5d96('0x39')]();}}if(_0x3a4a93[_0x5d96('0x34')](_0x278e78)&&_0x3a4a93[_0x278e78][_0x5d96('0x35')]==='preview'&&_0x3a4a93[_0x278e78][_0x5d96('0x37')]===_0x5d96('0x38')){if(_0x3a4a93[_0x278e78][_0x5d96('0x3a')]){this['setMessage'](_0x3a4a93[_0x278e78]);if(_0x3a4a93[_0x278e78][_0x5d96('0x3b')])this[_0x5d96('0x3c')](_0x3a4a93[_0x278e78]);}else{notSendMessagesQueue(_0x3a4a93[_0x278e78]);}}}};Preview[_0x5d96('0xe')][_0x5d96('0x3d')]=function(_0x292d8e){var _0x2de94b=this;this[_0x5d96('0x11')][_0x5d96('0x3e')](function(){if(!_[_0x5d96('0x3f')](_0x2de94b[_0x5d96('0x14')][_0x292d8e])){loggerAction[_0x5d96('0x25')](_0x5d96('0x40'),_0x292d8e,'Queue',_0x2de94b[_0x5d96('0x14')][_0x292d8e]['queue'],_0x5d96('0x41'),JSON['stringify'](_0x2de94b[_0x5d96('0x12')][_0x2de94b[_0x5d96('0x14')][_0x292d8e][_0x5d96('0x42')]][_0x5d96('0x2d')]),'pTalking:\x20',JSON[_0x5d96('0x27')](_0x2de94b[_0x5d96('0x12')][_0x2de94b[_0x5d96('0x14')][_0x292d8e][_0x5d96('0x42')]][_0x5d96('0x2e')]),JSON[_0x5d96('0x27')](_0x2de94b[_0x5d96('0x14')][_0x292d8e][_0x5d96('0x43')]),JSON['stringify'](_[_0x5d96('0x44')](_0x2de94b[_0x5d96('0x14')][_0x292d8e],[_0x5d96('0x45'),_0x5d96('0x46'),'VoiceQueueId',_0x5d96('0x47')])));return ami[_0x5d96('0x48')]({'action':_0x5d96('0x49'),'channel':_0x2de94b[_0x5d96('0x14')][_0x292d8e][_0x5d96('0x4a')]})[_0x5d96('0x4b')](function(_0x148676){if(_0x148676['message']===_0x5d96('0x4c')){setTimeout(function(){if(_0x2de94b[_0x5d96('0x14')][_0x292d8e]){ut[_0x5d96('0x4d')](_0x2de94b[_0x5d96('0x12')][_0x2de94b[_0x5d96('0x14')][_0x292d8e][_0x5d96('0x42')]],_0x5d96('0x4e'));if(_0x2de94b[_0x5d96('0x14')][_0x292d8e][_0x5d96('0x43')]===!![]){ut[_0x5d96('0x4f')](_0x2de94b[_0x5d96('0x12')][_0x2de94b['actions'][_0x292d8e][_0x5d96('0x42')]],_0x5d96('0x4e'));ut['loggerError'](_0x5d96('0x50')+_0x292d8e,_0x2de94b[_0x5d96('0x14')][_0x292d8e][_0x5d96('0x42')]);}ut[_0x5d96('0x51')](_0x5d96('0x52')+_0x292d8e,_0x2de94b['actions'][_0x292d8e][_0x5d96('0x42')]);delete _0x2de94b[_0x5d96('0x14')][_0x292d8e];}},0x2328);}});}});};Preview[_0x5d96('0xe')][_0x5d96('0x39')]=function(){var _0x2af07c=this;loggerAction[_0x5d96('0x25')](_0x5d96('0x53'),_[_0x5d96('0x54')](this[_0x5d96('0x14')]));for(var _0x1e9d08 in this[_0x5d96('0x14')]){if(_0x2af07c[_0x5d96('0x14')][_0x5d96('0x34')](_0x1e9d08)){_0x2af07c[_0x5d96('0x3d')](_0x1e9d08);}}};Preview[_0x5d96('0xe')]['recallMe']=function(_0x8b213f){var _0xf5b385=this;rpcDb[_0x5d96('0x55')](_0x8b213f['id'],ut[_0x5d96('0x56')](this['agents']))[_0x5d96('0x57')](function(_0x489230){if(!_[_0x5d96('0x3f')](_0x489230)){for(var _0x1a1bd4=0x0;_0x1a1bd4<_0x489230[_0x5d96('0x58')];_0x1a1bd4+=0x1){if(ut[_0x5d96('0x59')](_0x489230[_0x1a1bd4]['scheduledat'])<_0x8b213f[_0x5d96('0x5a')]*0x3c){if(_0x489230[_0x1a1bd4]['Agent']&&!_0x489230[_0x1a1bd4][_0x5d96('0x5b')]['voicePause']){_0xf5b385[_0x5d96('0x5c')](_0x489230[_0x1a1bd4]['id'])[_0x5d96('0x57')](ut[_0x5d96('0x5d')]('[RecallMe]'))[_0x5d96('0x4b')](ut[_0x5d96('0x5d')](_0x5d96('0x5e')));}else{rpcDb[_0x5d96('0x5f')](_0x489230[_0x1a1bd4]['id']);}}else{var _0xd4da5=new Action(_0x489230[_0x1a1bd4],_0x8b213f);_0xd4da5['starttime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x8b213f[_0x5d96('0x60')]+=0x1;ut[_0x5d96('0x61')](_0xd4da5,0x17,_0x5d96('0x62'));if(_0x8b213f[_0x5d96('0x63')]){rpcDb['rescheduleContactInQueue'](ut['createBody'](_0x489230[_0x1a1bd4]));rpcDb[_0x5d96('0x64')](_0xd4da5,'[HistoryDialRecallInQueue][historyCatch]');}else{ut['logCustomer'](_0xd4da5,0x16,'RecallFailedTimeout');rpcDb[_0x5d96('0x64')](_0xd4da5,'[HistoryRecallClose]');rpcDb[_0x5d96('0x65')](_0xd4da5,_0x5d96('0x66'));}}}}})[_0x5d96('0x4b')](ut[_0x5d96('0x5d')](_0x5d96('0x67')));};Preview[_0x5d96('0xe')]['setMessage']=function(_0x6072e5){_0x6072e5[_0x5d96('0x2c')]=!![];if(ut['IsNotLoggedIn'](_0x6072e5[_0x5d96('0x68')])){_0x6072e5['message']=utils[_0x5d96('0x30')]['NO_AGENTS_LOGGED'];}else if(!ut[_0x5d96('0x69')](_0x6072e5[_0x5d96('0x3a')])){_0x6072e5[_0x5d96('0x6a')]=utils['CAMPAIGN_STATUS'][_0x5d96('0x6b')];}else if(!this[_0x5d96('0x6c')](_0x6072e5[_0x5d96('0x6d')])){if(!this[_0x5d96('0x6c')](_0x6072e5['TrunkBackup'])){_0x6072e5['message']=utils['CAMPAIGN_STATUS']['UNREACHABLE_TRUNK'];}else{_0x6072e5[_0x5d96('0x6a')]=utils[_0x5d96('0x30')]['ACTIVE'];}}else{_0x6072e5[_0x5d96('0x6a')]=utils[_0x5d96('0x30')]['ACTIVE'];}};Preview[_0x5d96('0xe')][_0x5d96('0x6e')]=function(_0x3166ee,_0x440b34,_0x3de06f){var _0x4333ff=this;var _0x1c34e0=this[_0x5d96('0x14')][_0x440b34];var _0x1ee01f=this[_0x5d96('0x12')][_0x1c34e0['queue']];var _0x3d2599;var _0x4f0a89=![];var _0x3d836b=0x2;var _0x25d8b2=0x3;if(_0x1ee01f){switch(_0x3de06f){case'1':_0x1ee01f['outboundNoSuchCallsDay']+=0x1;_0x1c34e0['countnosuchnumberretry']+=0x1;_0x1c34e0[_0x5d96('0x6f')]=ut['totalGlobal'](_0x1c34e0);ut['logCustomer'](_0x1c34e0,0x0,_0x5d96('0x70'));ami[_0x5d96('0x24')](_0x5d96('0x71'),ut['buildObj'](_0x1c34e0,_0x5d96('0x72')));rpcDb[_0x5d96('0x64')](_0x1c34e0,_0x5d96('0x73'));_0x4333ff['verifyAdditionalPhones'](_0x1c34e0,'0',_0x1ee01f)[_0x5d96('0x57')](function(_0x41e0bc){_0x4f0a89=_0x41e0bc[_0x5d96('0x74')]==0x1;_0x3d836b=_0x1ee01f[_0x5d96('0x75')];_0x25d8b2=_0x1ee01f['callAdditionalPhoneAfterMin'];if(!_0x4f0a89){if(ut[_0x5d96('0x76')](_0x1c34e0)>=_0x1ee01f[_0x5d96('0x77')]){_0x3d2599=ut['cloneAction'](_0x1c34e0,0xf,'Global');rpcDb[_0x5d96('0x65')](_0x3d2599,_0x5d96('0x78'));}else{if(_0x1c34e0['countnosuchnumberretry']>=_0x1ee01f[_0x5d96('0x79')]){rpcDb[_0x5d96('0x65')](_0x1c34e0,_0x5d96('0x78'));}else{rpcDb[_0x5d96('0x7a')](ut[_0x5d96('0x7b')](_0x1c34e0,'countnosuchnumberretry',_0x1ee01f['dialNoSuchNumberRetryFrequency']),_0x1c34e0[_0x5d96('0x7c')],_0x1c34e0[_0x5d96('0x7d')]);}}delete this[_0x5d96('0x14')][_0x3166ee[_0x5d96('0x7e')]];}else{_0x1c34e0[_0x5d96('0x7f')]++;logger['info']('actioncountonusuch',_0x1c34e0[_0x5d96('0x7f')]);logger['info']('id',_0x1c34e0['idContact']);_0x4333ff[_0x5d96('0x80')]({'id':_0x1c34e0[_0x5d96('0x81')],'field':{'countnosuchnumberretry':_0x1c34e0['countnosuchnumberretry']}})['then'](function(){_0x4333ff[_0x5d96('0x82')](_0x1c34e0,_0x3d836b,_0x25d8b2)[_0x5d96('0x57')](function(){});});}});break;case _0x5d96('0x83'):var _0x8568c7=moment()['format'](_0x5d96('0x84'));_0x1c34e0[_0x5d96('0x85')]=_0x8568c7;_0x1c34e0[_0x5d96('0x86')]=_0x8568c7;_0x1c34e0['dialAnswer']=!![];_0x1ee01f[_0x5d96('0x2e')]+=0x1;logger[_0x5d96('0x25')]('[syncHangup][talking][increment]',_0x1c34e0[_0x5d96('0x87')],_0x5d96('0x88'),_0x1ee01f[_0x5d96('0x29')],_0x5d96('0x89'),_0x1ee01f[_0x5d96('0x2e')]);ami[_0x5d96('0x24')](_0x5d96('0x8a'),ut[_0x5d96('0x8b')](_0x1c34e0,_0x5d96('0x8c'),this[_0x5d96('0x12')][_0x1c34e0[_0x5d96('0x42')]]));if(_0x1ee01f['acw']){ami['emit']('custom:agentConnectPreview',ut['buildAcw'](_0x1c34e0));}break;case'16':ami[_0x5d96('0x24')](_0x5d96('0x8d'),ut[_0x5d96('0x8b')](_0x1c34e0,_0x5d96('0x8e'),this[_0x5d96('0x12')][_0x1c34e0[_0x5d96('0x42')]]));emitVoiceQueueChannelRemove(ut[_0x5d96('0x8b')](_0x1c34e0,_0x5d96('0x8e')));_0x1ee01f[_0x5d96('0x8f')]+=0x1;_0x1ee01f[_0x5d96('0x90')]+=0x1;_0x1ee01f['answered']+=0x1;ut['decrementTalkink'](_0x1ee01f,'[16]');_0x1c34e0[_0x5d96('0x6f')]=ut['totalGlobal'](_0x1c34e0);ut[_0x5d96('0x61')](_0x1c34e0,0x4,_0x5d96('0x91'));rpcDb[_0x5d96('0x64')](_0x1c34e0,_0x5d96('0x92'));rpcDb[_0x5d96('0x65')](_0x1c34e0,_0x5d96('0x93'));rpcDb['crateCustomerReportQueue'](_0x1c34e0);_0x1ee01f[_0x5d96('0x94')]+=_0x1c34e0['talktime'];_0x1ee01f[_0x5d96('0x95')]+=_0x1c34e0[_0x5d96('0x96')];logger[_0x5d96('0x25')](_0x5d96('0x97'),_0x1c34e0[_0x5d96('0x87')],_0x5d96('0x88'),_0x1ee01f[_0x5d96('0x29')],_0x5d96('0x89'),_0x1ee01f[_0x5d96('0x2e')]);delete this[_0x5d96('0x14')][_0x3166ee[_0x5d96('0x7e')]];break;case _0x5d96('0x98'):_0x1ee01f['outboundBusyCallsDay']+=0x1;_0x1c34e0[_0x5d96('0x99')]+=0x1;_0x1c34e0[_0x5d96('0x6f')]=ut['totalGlobal'](_0x1c34e0);ut[_0x5d96('0x61')](_0x1c34e0,0x5,_0x5d96('0x9a'));_0x3d836b=_0x1ee01f[_0x5d96('0x9b')];_0x25d8b2=_0x1ee01f['callAdditionalPhoneAfterMin'];ami[_0x5d96('0x24')](_0x5d96('0x9c'),ut[_0x5d96('0x8b')](_0x1c34e0,_0x5d96('0x9d')));rpcDb['createCustomerHistory'](_0x1c34e0,_0x5d96('0x9e'));_0x4333ff[_0x5d96('0x9f')](_0x1c34e0,'5',_0x1ee01f)[_0x5d96('0x57')](function(_0x460aae){_0x4f0a89=_0x460aae['additional']==0x1;if(!_0x4f0a89){if(ut[_0x5d96('0x76')](_0x1c34e0)>=_0x1ee01f[_0x5d96('0x77')]){_0x3d2599=ut['cloneAction'](_0x1c34e0,0xf,_0x5d96('0xa0'));rpcDb[_0x5d96('0x65')](_0x3d2599,_0x5d96('0xa1'));}else{if(_0x1c34e0[_0x5d96('0x99')]>=_0x1ee01f[_0x5d96('0xa2')]){rpcDb[_0x5d96('0x65')](_0x1c34e0,_0x5d96('0x9e'));}else{rpcDb['rescheduleContact'](ut[_0x5d96('0x7b')](_0x1c34e0,_0x5d96('0x99'),_0x1ee01f[_0x5d96('0x9b')]),_0x1c34e0[_0x5d96('0x7c')],_0x1c34e0[_0x5d96('0x7d')]);}}}else{_0x1c34e0[_0x5d96('0x99')]++;_0x4333ff[_0x5d96('0x80')]({'id':_0x1c34e0[_0x5d96('0x81')],'field':{'countbusyretry':_0x1c34e0[_0x5d96('0x99')]}})[_0x5d96('0x57')](function(){_0x4333ff[_0x5d96('0x82')](_0x1c34e0,_0x3d836b,_0x25d8b2)['then'](function(){});});}});break;case _0x5d96('0xa3'):_0x1ee01f[_0x5d96('0xa4')]+=0x1;_0x1c34e0[_0x5d96('0xa5')]+=0x1;_0x1c34e0[_0x5d96('0x6f')]=ut[_0x5d96('0x76')](_0x1c34e0);ut[_0x5d96('0x61')](_0x1c34e0,0x3,_0x5d96('0xa6'));_0x3d836b=_0x1ee01f[_0x5d96('0xa7')];_0x25d8b2=_0x1ee01f[_0x5d96('0xa8')];var _0x2e543e=ut[_0x5d96('0xa9')](_0x1c34e0,_0x1ee01f);ami['emit'](_0x5d96('0xaa'),_0x2e543e);rpcDb[_0x5d96('0x64')](_0x1c34e0,_0x5d96('0xab'));_0x4333ff[_0x5d96('0x9f')](_0x1c34e0,'3',_0x1ee01f)[_0x5d96('0x57')](function(_0x137798){_0x4f0a89=_0x137798[_0x5d96('0x74')]==0x1;if(!_0x4f0a89){if(ut[_0x5d96('0x76')](_0x1c34e0)>=_0x1ee01f['dialGlobalMaxRetry']){_0x3d2599=ut[_0x5d96('0xac')](_0x1c34e0,0xf,_0x5d96('0xa0'));rpcDb[_0x5d96('0x65')](_0x3d2599,_0x5d96('0xad'));}else{if(_0x1c34e0[_0x5d96('0xa5')]>=_0x1ee01f[_0x5d96('0xae')]){rpcDb[_0x5d96('0x65')](_0x1c34e0,_0x5d96('0xab'));}else{rpcDb['rescheduleContact'](ut[_0x5d96('0x7b')](_0x1c34e0,_0x5d96('0xa5'),_0x1ee01f[_0x5d96('0xa7')]),_0x1c34e0[_0x5d96('0x7c')],_0x1c34e0['activeContact']);}}}else{_0x1c34e0[_0x5d96('0xa5')]++;_0x4333ff[_0x5d96('0x80')]({'id':_0x1c34e0[_0x5d96('0x81')],'field':{'countnoanswerretry':_0x1c34e0[_0x5d96('0xa5')]}})[_0x5d96('0x57')](function(){_0x4333ff[_0x5d96('0x82')](_0x1c34e0,_0x3d836b,_0x25d8b2)['then'](function(){});});}});break;case'CONGESTION':_0x1ee01f['outboundCongestionCallsDay']+=0x1;_0x1c34e0[_0x5d96('0xaf')]+=0x1;_0x1c34e0[_0x5d96('0x6f')]=ut[_0x5d96('0x76')](_0x1c34e0);ut[_0x5d96('0x61')](_0x1c34e0,0x8,_0x5d96('0xb0'));_0x3d836b=_0x1ee01f['dialCongestionRetryFrequency'];_0x25d8b2=_0x1ee01f[_0x5d96('0xa8')];ami[_0x5d96('0x24')](_0x5d96('0xb1'),ut['buildObj'](_0x1c34e0,_0x5d96('0xb2')));rpcDb['createCustomerHistory'](_0x1c34e0,_0x5d96('0xb3'));_0x4333ff[_0x5d96('0x9f')](_0x1c34e0,'8',_0x1ee01f)[_0x5d96('0x57')](function(_0x3d6ff5){_0x4f0a89=_0x3d6ff5[_0x5d96('0x74')]==0x1;if(!_0x4f0a89){if(ut[_0x5d96('0x76')](_0x1c34e0)>=_0x1ee01f['dialGlobalMaxRetry']){_0x3d2599=ut[_0x5d96('0xac')](_0x1c34e0,0xf,_0x5d96('0xa0'));rpcDb[_0x5d96('0x65')](_0x3d2599,_0x5d96('0xb4'));}else{if(_0x1c34e0[_0x5d96('0xaf')]>=_0x1ee01f['dialCongestionMaxRetry']){rpcDb[_0x5d96('0x65')](_0x1c34e0,_0x5d96('0xb3'));}else{rpcDb[_0x5d96('0x7a')](ut[_0x5d96('0x7b')](_0x1c34e0,'countcongestionretry',_0x1ee01f[_0x5d96('0x9b')]),_0x1c34e0[_0x5d96('0x7c')],_0x1c34e0[_0x5d96('0x7d')]);}}}else{_0x1c34e0['countcongestionretry']++;_0x4333ff['incrementPreviewCounters']({'id':_0x1c34e0[_0x5d96('0x81')],'field':{'countcongestionretry':_0x1c34e0[_0x5d96('0xaf')]}})['then'](function(){_0x4333ff[_0x5d96('0x82')](_0x1c34e0,_0x3d836b,_0x25d8b2)[_0x5d96('0x57')](function(){});});}});break;case _0x5d96('0xb5'):_0x1ee01f['outboundRejectCallsDay']+=0x1;_0x1c34e0[_0x5d96('0xb6')]+=0x1;_0x1c34e0['countglobal']=ut['totalGlobal'](_0x1c34e0);ut[_0x5d96('0x61')](_0x1c34e0,0x14,_0x5d96('0xb7'));_0x3d836b=_0x1ee01f[_0x5d96('0xb8')];_0x25d8b2=_0x1ee01f[_0x5d96('0xa8')];ami['emit']('custom:agentreject',ut[_0x5d96('0x8b')](_0x1c34e0,'agentreject'));rpcDb[_0x5d96('0x64')](_0x1c34e0,_0x5d96('0xb9'));_0x4333ff[_0x5d96('0x9f')](_0x1c34e0,'20',_0x1ee01f)[_0x5d96('0x57')](function(_0xfbed28){_0x4f0a89=_0xfbed28[_0x5d96('0x74')]==0x1;if(!_0x4f0a89){if(ut[_0x5d96('0x76')](_0x1c34e0)>=_0x1ee01f[_0x5d96('0x77')]){_0x3d2599=ut[_0x5d96('0xac')](_0x1c34e0,0x14,_0x5d96('0xb7'));rpcDb[_0x5d96('0x65')](_0x3d2599,_0x5d96('0xba'));}else{if(_0x1c34e0['countagentrejectretry']>=_0x1ee01f[_0x5d96('0xbb')]){rpcDb[_0x5d96('0x65')](_0x1c34e0,_0x5d96('0xba'));}else{rpcDb[_0x5d96('0x7a')](ut[_0x5d96('0x7b')](_0x1c34e0,_0x5d96('0xb6'),_0x1ee01f['dialAgentRejectRetryFrequency']),_0x1c34e0['unlockAgent'],_0x1c34e0[_0x5d96('0x7d')]);}}}else{_0x1c34e0[_0x5d96('0xa5')]++;_0x4333ff[_0x5d96('0x80')]({'id':_0x1c34e0['idContact'],'field':{'countnoanswerretry':_0x1c34e0[_0x5d96('0xa5')]}})[_0x5d96('0x57')](function(){_0x4333ff[_0x5d96('0x82')](_0x1c34e0,_0x3d836b,_0x25d8b2)[_0x5d96('0x57')](function(){});});}});break;case _0x5d96('0xbc'):_0x1ee01f[_0x5d96('0xbd')]+=0x1;_0x1c34e0['countabandonedretry']+=0x1;_0x1c34e0[_0x5d96('0x6f')]=ut['totalGlobal'](_0x1c34e0);ut[_0x5d96('0x61')](_0x1c34e0,0xb,_0x5d96('0xbe'));rpcDb['createCustomerHistory'](_0x1c34e0,_0x5d96('0xbf'));_0x4333ff[_0x5d96('0x9f')](_0x1c34e0,'11',_0x1ee01f)[_0x5d96('0x57')](function(_0x3e35bf){_0x4f0a89=_0x3e35bf[_0x5d96('0x74')]==0x1;if(!_0x4f0a89){if(ut['totalGlobal'](_0x1c34e0)>=_0x1ee01f[_0x5d96('0x77')]){_0x3d2599=ut['cloneAction'](_0x1c34e0,0xf,_0x5d96('0xa0'));rpcDb[_0x5d96('0x65')](_0x3d2599,_0x5d96('0xbf'));}else{if(_0x1c34e0[_0x5d96('0xc0')]>=_0x1ee01f[_0x5d96('0xc1')]){rpcDb[_0x5d96('0x65')](_0x1c34e0,_0x5d96('0xbf'));}else{rpcDb[_0x5d96('0x7a')](ut[_0x5d96('0x7b')](_0x1c34e0,_0x5d96('0xc2'),_0x1ee01f[_0x5d96('0xc3')]),_0x1c34e0[_0x5d96('0x7c')],_0x1c34e0[_0x5d96('0x7d')]);}}}else{_0x1c34e0[_0x5d96('0xa5')]++;_0x4333ff[_0x5d96('0x80')]({'id':_0x1c34e0[_0x5d96('0x81')],'field':{'countnoanswerretry':_0x1c34e0[_0x5d96('0xa5')]}})[_0x5d96('0x57')](function(){_0x4333ff['swapAdditionalPhones'](_0x1c34e0,_0x3d836b,_0x25d8b2)['then'](function(){});});}});break;case'18':_0x1ee01f['outboundUnknownCallsDay']+=0x1;_0x1c34e0[_0x5d96('0xc4')]+=0x1;_0x1c34e0['countglobal']=ut['totalGlobal'](_0x1c34e0);ut[_0x5d96('0x61')](_0x1c34e0,0x12,_0x3166ee[_0x5d96('0xc5')]||_0x3166ee['dialstatus']);ami[_0x5d96('0x24')](_0x5d96('0xc6'),ut[_0x5d96('0x8b')](_0x1c34e0,_0x5d96('0xc7')));rpcDb[_0x5d96('0x64')](_0x1c34e0,'[callProgressDetectingCustomer][hangupInAMD]');_0x4333ff[_0x5d96('0x9f')](_0x1c34e0,'18',_0x1ee01f)['then'](function(_0x2cd773){_0x4f0a89=_0x2cd773[_0x5d96('0x74')]==0x1;if(!_0x4f0a89){if(ut[_0x5d96('0x76')](_0x1c34e0)>=_0x1ee01f[_0x5d96('0x77')]){_0x3d2599=ut[_0x5d96('0xac')](_0x1c34e0,0x12,_0x5d96('0xa0'));rpcDb[_0x5d96('0x65')](_0x3d2599,_0x5d96('0xc8'));}else{rpcDb[_0x5d96('0x65')](_0x1c34e0,_0x5d96('0xc8'));}}else{_0x1c34e0[_0x5d96('0xa5')]++;_0x4333ff['incrementPreviewCounters']({'id':_0x1c34e0[_0x5d96('0x81')],'field':{'countnoanswerretry':_0x1c34e0['countnoanswerretry']}})[_0x5d96('0x57')](function(){_0x4333ff['swapAdditionalPhones'](_0x1c34e0,_0x3d836b,_0x25d8b2)['then'](function(){});});}});delete this['actions'][_0x3166ee['linkedid']];break;case'19':_0x1ee01f[_0x5d96('0xc9')]+=0x1;_0x1c34e0['countglobal']=ut[_0x5d96('0x76')](_0x1c34e0);ut['logCustomer'](_0x1c34e0,0x13,_0x3166ee['cause-txt']||_0x3166ee[_0x5d96('0xca')]);ami[_0x5d96('0x24')](_0x5d96('0xc6'),ut[_0x5d96('0x8b')](_0x1c34e0,'amd'));rpcDb[_0x5d96('0x64')](_0x1c34e0,_0x5d96('0xcb'));_0x4333ff['verifyAdditionalPhones'](_0x1c34e0,'18',_0x1ee01f)[_0x5d96('0x57')](function(_0xee4a4b){_0x4f0a89=_0xee4a4b[_0x5d96('0x74')]==0x1;if(!_0x4f0a89){if(ut[_0x5d96('0x76')](_0x1c34e0)>=_0x1ee01f['dialGlobalMaxRetry']){_0x3d2599=ut['cloneAction'](_0x1c34e0,0xf,_0x5d96('0xa0'));rpcDb[_0x5d96('0x65')](_0x3d2599,_0x5d96('0xcb'));}else{rpcDb[_0x5d96('0x65')](_0x1c34e0,_0x5d96('0xcb'));}}else{_0x1c34e0[_0x5d96('0xa5')]++;_0x4333ff[_0x5d96('0x80')]({'id':_0x1c34e0[_0x5d96('0x81')],'field':{'countnoanswerretry':_0x1c34e0[_0x5d96('0xa5')]}})['then'](function(){_0x4333ff[_0x5d96('0x82')](_0x1c34e0,_0x3d836b,_0x25d8b2)['then'](function(){});});}});delete this[_0x5d96('0x14')][_0x3166ee[_0x5d96('0x7e')]];break;default:if(_0x1c34e0['dialAnswer']){ut[_0x5d96('0x4f')](_0x1ee01f,'[default]');ut[_0x5d96('0x51')](_0x5d96('0xcc')+_0x1ee01f['name'],_0x3166ee);}_0x1ee01f[_0x5d96('0xc9')]+=0x1;_0x1c34e0[_0x5d96('0x6f')]=ut[_0x5d96('0x76')](_0x1c34e0);ut['logCustomer'](_0x1c34e0,0xc,_0x3166ee[_0x5d96('0xc5')]||_0x3166ee[_0x5d96('0xca')]);_0x3d836b=_0x1ee01f[_0x5d96('0xb8')];_0x25d8b2=_0x1ee01f[_0x5d96('0xa8')];rpcDb[_0x5d96('0x64')](_0x1c34e0,_0x5d96('0xcd'));_0x4333ff[_0x5d96('0x9f')](_0x1c34e0,'20',_0x1ee01f)[_0x5d96('0x57')](function(_0x3cb4eb){_0x4f0a89=_0x3cb4eb[_0x5d96('0x74')]==0x1;if(!_0x4f0a89){if(ut[_0x5d96('0x76')](_0x1c34e0)>=_0x1ee01f[_0x5d96('0x77')]){_0x3d2599=ut[_0x5d96('0xac')](_0x1c34e0,0xf,_0x5d96('0xa0'));rpcDb[_0x5d96('0x65')](_0x3d2599,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x5d96('0x65')](_0x1c34e0,_0x5d96('0xce'));}delete this[_0x5d96('0x14')][_0x3166ee[_0x5d96('0x7e')]];}else{_0x4333ff[_0x5d96('0x82')](_0x1c34e0,_0x3d836b,_0x25d8b2)[_0x5d96('0x57')](function(){});}});}if(!(_0x1c34e0['dialAnswer']&&_0x3de06f==='16')){ut[_0x5d96('0x4d')](_0x1ee01f,_0x5d96('0xcf'));logger[_0x5d96('0x25')]('[originated][decrement][callProgressDetectingCustomer]',_0x1c34e0['uniqueid'],_0x5d96('0x88'),_0x1ee01f['name'],_0x5d96('0x41'),_0x1ee01f[_0x5d96('0x2d')]);}if(_0x3de06f!==_0x5d96('0x83')){delete this[_0x5d96('0x14')][_0x3166ee['linkedid']];delete this[_0x5d96('0x14')][_0x3166ee['destlinkedid']];}_0x1ee01f[_0x5d96('0xd0')]=!![];}};Preview[_0x5d96('0xe')][_0x5d96('0xd1')]=function(_0x21d512,_0x361de5,_0x57a1f0){if(_[_0x5d96('0xd2')](_0x361de5)&&_0x5d96('0xd3')!==typeof _0x361de5){return;}if(_['isUndefined'](_0x57a1f0)&&_0x5d96('0xd3')!==typeof _0x57a1f0){return;}switch(_0x57a1f0['reason']){case'0':ut[_0x5d96('0xd4')](_0x21d512,0x0,_0x5d96('0x70'));rpcDb[_0x5d96('0xd5')](_0x21d512,_0x5d96('0xd6'));break;case'3':ut['logAgent'](_0x21d512,0x3,_0x5d96('0xa6'));rpcDb[_0x5d96('0xd5')](_0x21d512,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut[_0x5d96('0xd4')](_0x21d512,0x5,'Busy');rpcDb[_0x5d96('0xd5')](_0x21d512,_0x5d96('0xd7'));break;case'8':ut[_0x5d96('0xd4')](_0x21d512,0x8,_0x5d96('0xb0'));rpcDb[_0x5d96('0xd5')](_0x21d512,_0x5d96('0xd8'));break;case'22':ut['logAgent'](_0x21d512,0x16,_0x5d96('0xd9'));rpcDb[_0x5d96('0xd5')](_0x21d512,_0x5d96('0xda'));break;default:ut[_0x5d96('0xd4')](_0x21d512,0xc,_0x57a1f0[_0x5d96('0xdb')]);rpcDb[_0x5d96('0xd5')](_0x21d512,_0x5d96('0xd8'));}ut[_0x5d96('0x4d')](_0x361de5,_0x5d96('0xdc'));logger['info'](_0x5d96('0xdd'),_0x21d512[_0x5d96('0x87')],_0x5d96('0x88'),_0x361de5[_0x5d96('0x29')],_0x5d96('0x41'),_0x361de5[_0x5d96('0x2d')]);delete this[_0x5d96('0x14')][_0x21d512['uniqueid']];};Preview[_0x5d96('0xe')]['verifyAdditionalPhones']=function(_0x480407,_0x3cf63b,_0x411fba){return cmHopperAdditionalPhone[_0x5d96('0x9f')](_0x480407,_0x3cf63b,_0x411fba)[_0x5d96('0x4b')](logger[_0x5d96('0x25')]('[verifyAdditionalPhone]\x20'));};Preview[_0x5d96('0xe')]['swapAdditionalPhones']=function(_0x4491d6,_0x24d4b2,_0x10e729){return cmHopperAdditionalPhone[_0x5d96('0x82')](_0x4491d6,_0x24d4b2,_0x10e729)[_0x5d96('0x4b')](logger[_0x5d96('0x25')]('[swapAdditionalPhone]\x20'));};Preview[_0x5d96('0xe')][_0x5d96('0x80')]=function(_0x2ee58f){return Promise[_0x5d96('0xde')]()['then'](cmHopperAdditionalPhone[_0x5d96('0x80')](_0x2ee58f))[_0x5d96('0x4b')](logger[_0x5d96('0x25')](_0x5d96('0xdf')));};Preview['prototype'][_0x5d96('0xe0')]=function(_0x579bbc,_0x3feb2a,_0x3c7194,_0x1ef56d,_0x27db0a){var _0x530f8b=this;return new Promise(function(_0x347647,_0xa3a12c){if(_[_0x5d96('0x3f')](_0x3feb2a)||_[_0x5d96('0x3f')](_0x3feb2a['Contact'])||_['isNil'](_0x3feb2a[_0x5d96('0xe1')])||_[_0x5d96('0x3f')](_0x3feb2a[_0x5d96('0xe2')])){_0xa3a12c(ut[_0x5d96('0x6a')](_0x5d96('0xe3'),_0x1ef56d,_0x27db0a));return;}var _0x4f91c4=uuid['v4']();var _0x237aac=_0x530f8b['campaignsPreview'][_0x3feb2a['Queue']['name']];var _0x165e61=_0x3c7194?_0x530f8b[_0x5d96('0x15')][_0x3c7194]['id']:undefined;_0x530f8b[_0x5d96('0x14')][_0x4f91c4]=new Action(_0x3feb2a,_0x237aac,_0x4f91c4,_0x3c7194,_0x165e61);var _0x51e430=_0x530f8b['actions'][_0x4f91c4];_0x51e430[_0x5d96('0x7c')]=_0x1ef56d;_0x51e430[_0x5d96('0x7d')]=_0x27db0a;_0x51e430[_0x5d96('0xe4')]=_0x3c7194;if(_[_0x5d96('0xe5')](_0x579bbc)){_0x530f8b['execCall'](_0x51e430,_0x237aac,_0x3feb2a,_0x3c7194)[_0x5d96('0x57')](function(_0x4ef6f0){logger[_0x5d96('0x25')](_0x5d96('0xe6'),_0x5d96('0xe7')+_0x51e430[_0x5d96('0x42')]+'\x20IdHopper:\x20'+_0x51e430[_0x5d96('0x81')],JSON[_0x5d96('0x27')](_0x4ef6f0));ami[_0x5d96('0x24')]('custom:agentcalled',ut[_0x5d96('0x8b')](_0x51e430,'called',_0x530f8b['campaignsPreview'][_0x51e430['queue']]));_0x347647(ut['message'](_0x5d96('0xe8')));})['catch'](function(_0x14f623){ut[_0x5d96('0x32')](_0x5d96('0xe9'),_0x14f623);_0xa3a12c(ut[_0x5d96('0x6a')](_0x5d96('0xea'),_0x1ef56d,_0x27db0a));});}else{_0x237aac[_0x5d96('0xeb')]+=0x1;ut['logBlacklist'](_0x51e430);rpcDb[_0x5d96('0xec')](_0x51e430,_0x5d96('0xed'));delete _0x530f8b[_0x5d96('0x14')][_0x4f91c4];_0xa3a12c(ut['message'](_0x5d96('0xee'),_0x1ef56d,_0x27db0a));}});};Preview[_0x5d96('0xe')][_0x5d96('0x6c')]=function(_0x3f8119){return!_[_0x5d96('0x3f')](_0x3f8119)&&!_[_0x5d96('0x3f')](_0x3f8119[_0x5d96('0x29')])&&!_[_0x5d96('0x3f')](_0x3f8119[_0x5d96('0xef')])&&_0x3f8119['active']&&!_[_0x5d96('0x3f')](this[_0x5d96('0x13')][util[_0x5d96('0x28')](_0x5d96('0xf0'),_0x3f8119[_0x5d96('0x29')])])&&!_[_0x5d96('0x3f')](this['trunks'][util[_0x5d96('0x28')](_0x5d96('0xf0'),_0x3f8119[_0x5d96('0x29')])]['status'])&&(this[_0x5d96('0x13')][util[_0x5d96('0x28')]('SIP/%s',_0x3f8119[_0x5d96('0x29')])][_0x5d96('0x49')]===_0x5d96('0xf1')||this[_0x5d96('0x13')][util['format'](_0x5d96('0xf0'),_0x3f8119[_0x5d96('0x29')])]['status']===_0x5d96('0xf2'));};Preview[_0x5d96('0xe')][_0x5d96('0x5c')]=function(_0x23b5e1,_0x358d30){return this['execRun'](_0x23b5e1,_0x358d30)[_0x5d96('0x57')](function(_0x1345c4){return _['pick'](_0x1345c4,[_0x5d96('0x6a')]);})[_0x5d96('0x4b')](function(_0x55561f){if(_0x55561f[_0x5d96('0xf3')]){rpcDb[_0x5d96('0xf4')](_0x23b5e1);}if(_0x55561f[_0x5d96('0xef')]){rpcDb[_0x5d96('0x5f')](_0x23b5e1);}throw _[_0x5d96('0x44')](_0x55561f,[_0x5d96('0x6a')]);});};Preview[_0x5d96('0xe')]['execRun']=function(_0x2b8ece,_0x5c057a){var _0x415c83=this;var _0x54a640,_0x294d6d;return rpcDb[_0x5d96('0xf5')](_0x2b8ece)['then'](function(_0x5d8816){if(!_[_0x5d96('0x3f')](_0x5d8816[0x0])){_0x294d6d=_0x5d8816[0x0]['recallme']?![]:!![];_0x54a640=_0x5d8816[0x0][_0x5d96('0xf6')]?!![]:![];_0x54a640=_0x5c057a?!![]:_0x54a640;}var _0x2f6116=_0x415c83[_0x5d96('0xf7')](_0x5d8816);if(_0x2f6116['isValid']){rpcDb['checkIsBlackList'](_[_0x5d96('0x44')](_0x5d8816[0x0],[_0x5d96('0xe2'),_0x5d96('0xe1')]))[_0x5d96('0x57')](function(_0x1de282){_0x415c83[_0x5d96('0xe0')](_0x1de282,_0x5d8816[0x0],_0x5c057a,_0x294d6d,_0x54a640)[_0x5d96('0x57')](function(_0x338154){return _0x338154;})['catch'](function(_0x56eaf1){throw _0x56eaf1;});})[_0x5d96('0x4b')](function(_0x4dd3c8){ut['logger'](_0x5d96('0xf8'),_0x4dd3c8);throw ut[_0x5d96('0x6a')]('Call\x20unsuccessful',_0x294d6d,_0x54a640);});}else{throw ut[_0x5d96('0x6a')](_0x2f6116[_0x5d96('0x6a')],_0x294d6d,_0x54a640);}})[_0x5d96('0x4b')](function(_0x5978a1){ut[_0x5d96('0x32')](_0x5d96('0xf9'),_0x5978a1);throw ut[_0x5d96('0x6a')](_0x5d96('0xfa'),![],!![]);});};Preview[_0x5d96('0xe')][_0x5d96('0xf7')]=function(_0xb9a030){if(_[_0x5d96('0x3f')](_0xb9a030)||_['isEmpty'](_0xb9a030)||!_[_0x5d96('0x3f')](_0xb9a030[0x0][_0x5d96('0x5b')])&&_[_0x5d96('0x3f')](_0xb9a030[0x0][_0x5d96('0x5b')][_0x5d96('0x29')])){ut[_0x5d96('0x32')](_0x5d96('0xfb'),_0xb9a030);return{'isValid':![],'message':_0x5d96('0xfc')};}var _0x49a190=this[_0x5d96('0x12')][_0xb9a030[0x0][_0x5d96('0xfd')]['name']];_0x49a190[_0x5d96('0x6a')]=utils[_0x5d96('0x30')][_0x5d96('0xfe')];if(_[_0x5d96('0x3f')](_0x49a190)){ut[_0x5d96('0x32')](_0x5d96('0xff'),_0x49a190);return{'isValid':![],'message':_0x5d96('0x100')};}if(!this['isTrunkReachable'](_0x49a190[_0x5d96('0x6d')])){ut['logger'](_0x5d96('0x101'),_0x5d96('0x102')+_0x49a190['name']+_0x5d96('0x103'));if(!this[_0x5d96('0x6c')](_0x49a190['TrunkBackup'])){ut[_0x5d96('0x32')](_0x5d96('0x101'),_0x49a190['name']+_0x5d96('0x104'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0x5d96('0x69')](_0x49a190[_0x5d96('0x3a')])){ut[_0x5d96('0x32')](_0x5d96('0x105'),_0x49a190[_0x5d96('0x29')]+_0x5d96('0x106'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x49a190['name']+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0x5d96('0x107')};};Preview[_0x5d96('0xe')]['execCall']=function(_0x3ebd06,_0x4bd44a,_0x435349,_0x322619){var _0x5d17fc=this;return new Promise(function(_0x3e25c0,_0x466548){var _0x86321f=_0x3ebd06[_0x5d96('0x87')];var _0x570efe=_0x5d17fc[_0x5d96('0x6c')](_0x4bd44a['Trunk'])?util[_0x5d96('0x28')](_0x5d96('0x108'),_0x4bd44a[_0x5d96('0x6d')][_0x5d96('0x29')],_[_0x5d96('0x3f')](_0x4bd44a[_0x5d96('0x109')])?'':_0x4bd44a[_0x5d96('0x109')][_0x5d96('0x10a')]()||'',_0x4bd44a[_0x5d96('0x10b')]>0x0?_0x435349[_0x5d96('0xe1')][_0x5d96('0x10c')](_0x4bd44a[_0x5d96('0x10b')]):_0x435349[_0x5d96('0xe1')]):util[_0x5d96('0x28')](_0x5d96('0x108'),_['isNil'](_0x4bd44a[_0x5d96('0x10d')])?_0x4bd44a['Trunk']['name']:_0x4bd44a[_0x5d96('0x10d')]['name'],_[_0x5d96('0x3f')](_0x4bd44a[_0x5d96('0x109')])?'':_0x4bd44a[_0x5d96('0x109')][_0x5d96('0x10a')]()||'',_0x4bd44a[_0x5d96('0x10b')]>0x0?_0x435349[_0x5d96('0xe1')]['substring'](_0x4bd44a[_0x5d96('0x10b')]):_0x435349[_0x5d96('0xe1')]);var _0x2a5915=_0x5d17fc['isTrunkReachable'](_0x4bd44a[_0x5d96('0x6d')])?ut[_0x5d96('0x10e')](_0x4bd44a[_0x5d96('0x6d')][_0x5d96('0x10f')],_0x4bd44a[_0x5d96('0x110')],_0x4bd44a['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x5d96('0x111')](_0x4bd44a['dialOriginateCallerIdNumber'],_0x4bd44a['dialRandomLastDigitCallerIdNumber']):_0x4bd44a[_0x5d96('0x112')]):ut[_0x5d96('0x10e')](_[_0x5d96('0x3f')](_0x4bd44a[_0x5d96('0x10d')])?_0x4bd44a['Trunk'][_0x5d96('0x10f')]:_0x4bd44a[_0x5d96('0x10d')][_0x5d96('0x10f')],_0x4bd44a['dialOriginateCallerIdName'],_0x4bd44a[_0x5d96('0x113')]>0x0?ut['getCallerIdRandom'](_0x4bd44a[_0x5d96('0x112')],_0x4bd44a[_0x5d96('0x113')]):_0x4bd44a[_0x5d96('0x112')]);if(_0x2a5915){_0x3ebd06['originatecalleridname']=ut[_0x5d96('0x114')](_0x2a5915);_0x3ebd06['originatecalleridnum']=ut['extractCalleridNumber'](_0x2a5915);}var _0x29004b=ut[_0x5d96('0x115')](_0x4bd44a,_0x435349,_0x570efe,_0x2a5915,_0x86321f,_0x3ebd06);var _0x10c975=utils['setXMDContactVariables'](_0x435349[_0x5d96('0x116')]);Object[_0x5d96('0x117')](_0x29004b,_0x10c975);_[_0x5d96('0x118')](_0x3ebd06,ut[_0x5d96('0x119')](_0x29004b));_0x3ebd06[_0x5d96('0x11a')]=moment()[_0x5d96('0x28')](_0x5d96('0x84'));_0x4bd44a[_0x5d96('0x11b')]=_0x29004b;var _0x48a549=ut[_0x5d96('0x11c')](_0x3ebd06,_0x4bd44a,_0x29004b,_0x3ebd06[_0x5d96('0x7d')],_0x322619);return ami[_0x5d96('0x48')](_0x48a549)['then'](function(_0x96d6e1){_0x4bd44a[_0x5d96('0x2d')]+=0x1;logger['info'](_0x5d96('0x11d'),_0x86321f,_0x5d96('0x88'),_0x4bd44a[_0x5d96('0x29')],_0x5d96('0x41'),_0x4bd44a[_0x5d96('0x2d')]);_0x3e25c0(_0x96d6e1);})[_0x5d96('0x4b')](function(_0x5d8afa){ut[_0x5d96('0xd4')](_0x3ebd06,0xe,'OriginateError');rpcDb[_0x5d96('0xd5')](_0x3ebd06,'[originateFailure][logOriginateFailure]');_0x466548(_0x5d8afa);});});};Preview[_0x5d96('0xe')][_0x5d96('0x1e')]=function(_0x5a29c9){if(this[_0x5d96('0x14')][_0x5a29c9['linkedid']]){this[_0x5d96('0x14')][_0x5a29c9[_0x5d96('0x7e')]]['channel']=_0x5a29c9[_0x5d96('0x4a')];}};Preview[_0x5d96('0xe')][_0x5d96('0x18')]=function(_0x21781c){var _0x2bd10f=this;var _0x4da0cc=this[_0x5d96('0x14')][_0x21781c[_0x5d96('0x11e')]];if(_0x4da0cc){if(_0x4da0cc[_0x5d96('0xe4')]&&this[_0x5d96('0x15')][_0x4da0cc[_0x5d96('0xe4')]]){ut[_0x5d96('0x11f')](_0x4da0cc,this[_0x5d96('0x15')][_0x4da0cc[_0x5d96('0xe4')]][_0x5d96('0x29')],this[_0x5d96('0x15')][_0x4da0cc['lookAgent']]['id']);}var _0x22499e=_[_0x5d96('0x120')](_0x4da0cc);_0x22499e[_0x5d96('0x85')]=moment()[_0x5d96('0x28')](_0x5d96('0x84'));var _0x11a1b4=_0x2bd10f[_0x5d96('0x12')][_0x4da0cc[_0x5d96('0x42')]];if(ut['isFailure'](_0x21781c[_0x5d96('0x121')])){if(_0x4da0cc[_0x5d96('0x7c')]){rpcDb[_0x5d96('0xf4')](_0x4da0cc[_0x5d96('0x81')]);}if(_0x4da0cc['activeContact']){rpcDb[_0x5d96('0x5f')](_0x4da0cc[_0x5d96('0x81')]);}ami[_0x5d96('0x24')](_0x5d96('0x122'),ut['buildObj'](_0x4da0cc,'rejected',this[_0x5d96('0x12')][_0x4da0cc[_0x5d96('0x42')]]));this[_0x5d96('0xd1')](_0x22499e,_0x11a1b4,_0x21781c);}else{_0x4da0cc[_0x5d96('0x11a')]=moment()[_0x5d96('0x28')](_0x5d96('0x84'));ut[_0x5d96('0xd4')](_0x22499e,0x4,'Answer');rpcDb[_0x5d96('0xd5')](_0x22499e,'[callProgressDetectingAgent][logAnswer]');}}};Preview[_0x5d96('0xe')][_0x5d96('0x1b')]=function(_0x4ee0f9){var _0x8375e0=this[_0x5d96('0x14')][_0x4ee0f9[_0x5d96('0x7e')]];var _0x554587;if(_0x8375e0){_0x554587=this[_0x5d96('0x12')][_0x8375e0[_0x5d96('0x42')]];logger[_0x5d96('0x25')](_0x5d96('0x123'),_0x4ee0f9[_0x5d96('0x7e')],'\x20Queue',_0x554587['name'],'pTalking:\x20',_0x554587['pTalking']);}if(this[_0x5d96('0x14')][_0x4ee0f9[_0x5d96('0x7e')]]&&_0x4ee0f9[_0x5d96('0x7e')]!==_0x4ee0f9[_0x5d96('0x87')]){if(_0x4ee0f9[_0x5d96('0x124')]==='16'&&this['actions'][_0x4ee0f9[_0x5d96('0x7e')]][_0x5d96('0x43')]){this[_0x5d96('0x6e')](_0x4ee0f9,_0x4ee0f9[_0x5d96('0x7e')],_0x4ee0f9['cause']);}else if(this[_0x5d96('0x14')][_0x4ee0f9[_0x5d96('0x7e')]][_0x5d96('0x43')]){logger[_0x5d96('0x25')](_0x5d96('0x125'),_0x4ee0f9[_0x5d96('0x7e')],_0x4ee0f9[_0x5d96('0x124')],_0x5d96('0x88'),_0x554587[_0x5d96('0x29')],_0x5d96('0x89'),_0x554587['pTalking']);this['callProgressDetectingCustomer'](_0x4ee0f9,_0x4ee0f9[_0x5d96('0x7e')],_0x4ee0f9['cause']);}}else if(_0x8375e0&&_[_0x5d96('0x3f')](_0x8375e0[_0x5d96('0x126')])&&_0x554587[_0x5d96('0x127')]&&_0x4ee0f9[_0x5d96('0x7e')]===_0x4ee0f9[_0x5d96('0x87')]&&_['isNil'](_0x4ee0f9[_0x5d96('0xdb')])&&_0x4ee0f9[_0x5d96('0x124')]==='16'&&_0x4ee0f9[_0x5d96('0x128')]==='6'&&_[_0x5d96('0xd2')](_0x8375e0['transfer'])){if(_0x8375e0[_0x5d96('0x7c')]){rpcDb['unlockContact'](_0x8375e0['idContact']);}if(_0x8375e0['activeContact']){rpcDb[_0x5d96('0x5f')](_0x8375e0[_0x5d96('0x81')]);}_0x4ee0f9[_0x5d96('0xdb')]='22';this[_0x5d96('0xd1')](_0x8375e0,_0x554587,_0x4ee0f9);}else if(_0x8375e0&&_0x8375e0['transfer']){if(_0x4ee0f9[_0x5d96('0x124')]==='16'&&this[_0x5d96('0x14')][_0x4ee0f9[_0x5d96('0x7e')]][_0x5d96('0x43')]){logger[_0x5d96('0x25')](_0x5d96('0x129'),_0x4ee0f9['linkedid'],_0x4ee0f9[_0x5d96('0x124')],_0x5d96('0x88'),_0x554587[_0x5d96('0x29')],_0x5d96('0x89'),_0x554587[_0x5d96('0x2e')]);this[_0x5d96('0x6e')](_0x4ee0f9,_0x4ee0f9[_0x5d96('0x7e')],_0x4ee0f9[_0x5d96('0x124')]);}else if(this['actions'][_0x4ee0f9['linkedid']]['dialAnswer']){logger[_0x5d96('0x25')](_0x5d96('0x125'),_0x4ee0f9[_0x5d96('0x7e')],_0x4ee0f9['cause'],_0x5d96('0x88'),_0x554587[_0x5d96('0x29')],'pTalking:\x20',_0x554587[_0x5d96('0x2e')]);this['callProgressDetectingCustomer'](_0x4ee0f9,_0x4ee0f9[_0x5d96('0x7e')],_0x4ee0f9['cause']);}}};Preview['prototype'][_0x5d96('0x1d')]=function(_0x4b54e2){if(this[_0x5d96('0x14')][_0x4b54e2[_0x5d96('0x12a')]]&&_0x4b54e2[_0x5d96('0x12a')]!==_0x4b54e2[_0x5d96('0x12b')]){this[_0x5d96('0x6e')](_0x4b54e2,_0x4b54e2[_0x5d96('0x12a')],_0x4b54e2['dialstatus']);}};Preview[_0x5d96('0xe')][_0x5d96('0x1c')]=function(_0x2bd957){if(this['actions'][_0x2bd957[_0x5d96('0x7e')]]&&_0x2bd957[_0x5d96('0x7e')]!==_0x2bd957[_0x5d96('0x87')]&&!this[_0x5d96('0x14')][_0x2bd957[_0x5d96('0x7e')]][_0x5d96('0x43')]){if(_0x2bd957[_0x5d96('0x124')]==='1'){this['callProgressDetectingCustomer'](_0x2bd957,_0x2bd957[_0x5d96('0x7e')],_0x2bd957['cause']);}}};Preview['prototype'][_0x5d96('0x12c')]=function(_0x368877,_0x1fbbab,_0x3dc82b){if(this[_0x5d96('0x14')][_0x368877]){if(_['isNil'](this[_0x5d96('0x14')][_0x368877][_0x5d96('0x11b')])){this[_0x5d96('0x14')][_0x368877][_0x5d96('0x11b')]={};}this['actions'][_0x368877]['variables'][_0x1fbbab]=_0x3dc82b;}};Preview[_0x5d96('0xe')]['syncVarSet']=function(_0x3854ff){try{if(!_[_0x5d96('0x3f')](_0x3854ff)){if(ut[_0x5d96('0x12d')](_['keys'](_0x3854ff[_0x5d96('0x12e')])[0x0])){this['addVariable'](_0x3854ff[_0x5d96('0x87')],_[_0x5d96('0x12f')](_0x3854ff['variable'])[0x0],_0x3854ff[_0x5d96('0x130')]);}}}catch(_0x1f3ad4){logger[_0x5d96('0x131')](_0x5d96('0x132'),util['inspect'](_0x1f3ad4,{'showHidden':![],'depth':null}));}};Preview[_0x5d96('0xe')][_0x5d96('0x133')]=function(_0x2d59ba){if(_0x2d59ba){if(this[_0x5d96('0x14')][_0x2d59ba[_0x5d96('0x134')]]){this[_0x5d96('0x14')][_0x2d59ba[_0x5d96('0x134')]][_0x5d96('0x135')]=!![];}}};Preview[_0x5d96('0xe')][_0x5d96('0x22')]=function(_0x3b9ce1){if(_0x3b9ce1){if(this['actions'][_0x3b9ce1['transfererlinkedid']]){this[_0x5d96('0x14')][_0x3b9ce1['transfererlinkedid']][_0x5d96('0x135')]=!![];}}};module['exports']=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 5751814..99111b5 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 _0x022a=['COMPLETED','create','[voiceQueueReport]\x20','then','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','../rpc/cmHopperHistory','../rpc/voiceQueueReport','error','inspect','[createHistory]\x20','resolve','createHistory','catch','moveContactManagedDialer','[moveContactManagedDialer]\x20','[checkIsBlackList]\x20','getContactPreview','createAgentHistory','createCustomerHistory','createCustomerFinal','UserId','active','rescheduleContact','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercompleteAt','endtime','connectedlinename','context','from-sip','exten','xcally-motion-preview','assigned','lastAssignedTo','membername','queuecallerexitreason'];(function(_0x231e16,_0x67347b){var _0x570a7c=function(_0x2c35b4){while(--_0x2c35b4){_0x231e16['push'](_0x231e16['shift']());}};_0x570a7c(++_0x67347b);}(_0x022a,0x7a));var _0xa022=function(_0x5651ef,_0x4fd99a){_0x5651ef=_0x5651ef-0x0;var _0x392fba=_0x022a[_0x5651ef];return _0x392fba;};'use strict';var util=require(_0xa022('0x0'));var BPromise=require(_0xa022('0x1'));var logger=require(_0xa022('0x2'))(_0xa022('0x3'));var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require(_0xa022('0x4'));var cmHopperBlack=require('../rpc/cmHopperBlack');var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0xa022('0x5'));function loggerCatch(_0x12e008){return function(_0x40bdf9){logger[_0xa022('0x6')](_0x12e008,util[_0xa022('0x7')](_0x40bdf9,{'showHidden':![],'depth':null}));};}function create(_0x25c86e){return cmHopperHistory['createHistory'](_0x25c86e)['catch'](loggerCatch(_0xa022('0x8')));}function createAgent(_0x29911c){return BPromise[_0xa022('0x9')]()['then'](agentReportPreview[_0xa022('0xa')](_0x29911c))[_0xa022('0xb')](loggerCatch(_0xa022('0x8')));}function moveContact(_0x58cc16){return cmHopper[_0xa022('0xc')](_0x58cc16,!![])[_0xa022('0xb')](loggerCatch(_0xa022('0xd')));}exports['checkIsBlackList']=function(_0x286a77){return cmHopperBlack['checkIsBlackList'](_0x286a77)[_0xa022('0xb')](loggerCatch(_0xa022('0xe')));};exports['getContactPreview']=function(_0x517240){return BPromise[_0xa022('0x9')]()['then'](cmHopper[_0xa022('0xf')](_0x517240))[_0xa022('0xb')](loggerCatch('[getContactPreview]\x20'));};exports[_0xa022('0xa')]=function(_0x8a05c6,_0x51c450){create(_0x8a05c6)[_0xa022('0xb')](loggerCatch(_0x51c450));moveContact(_0x8a05c6)[_0xa022('0xb')](loggerCatch(_0x51c450));};exports[_0xa022('0x10')]=function(_0x3a20ba,_0x10c571){createAgent(_0x3a20ba)[_0xa022('0xb')](loggerCatch(_0x10c571));};exports[_0xa022('0x11')]=function(_0x50addb,_0x5471f0){create(_0x50addb)['catch'](loggerCatch(_0x5471f0));};exports[_0xa022('0x12')]=function(_0x2e3dad,_0x52f7fa){moveContact(_0x2e3dad)[_0xa022('0xb')](loggerCatch(_0x52f7fa));};exports['rescheduleContact']=function(_0x434629,_0x5719da,_0x418389){if(_0x5719da){_0x434629[_0xa022('0x13')]=null;}if(_0x418389){_0x434629[_0xa022('0x14')]=![];}return cmHopper[_0xa022('0x15')](_0x434629)[_0xa022('0xb')](loggerCatch(_0xa022('0x16')));};exports['countReScheduled']=function(_0x43938a){return cmHopper[_0xa022('0x17')](_0x43938a)[_0xa022('0xb')](loggerCatch(_0xa022('0x18')));};exports[_0xa022('0x19')]=function(_0x464fcb){return cmHopper['unlockContact']({'UserId':null},_0x464fcb,0x1)[_0xa022('0xb')](loggerCatch(_0xa022('0x1a')));};exports[_0xa022('0x1b')]=function(_0x1412e6){return cmHopper[_0xa022('0x19')]({'active':![]},_0x1412e6,0x1)['catch'](loggerCatch(_0xa022('0x1c')));};exports[_0xa022('0x1d')]=function(_0x1c7a71){var _0x469c86={};_0x469c86[_0xa022('0x1e')]=_0x1c7a71['type'];_0x469c86[_0xa022('0x1f')]=_0x1c7a71[_0xa022('0x1f')];_0x469c86[_0xa022('0x20')]=_0x1c7a71[_0xa022('0x20')];_0x469c86[_0xa022('0x21')]=_0x1c7a71[_0xa022('0x21')];_0x469c86[_0xa022('0x22')]=_0x1c7a71[_0xa022('0x22')];_0x469c86[_0xa022('0x23')]=_0x1c7a71[_0xa022('0x24')];_0x469c86[_0xa022('0x25')]=_0x1c7a71[_0xa022('0x24')];_0x469c86['queuecallercomplete']=0x1;_0x469c86[_0xa022('0x26')]=_0x1c7a71[_0xa022('0x27')];_0x469c86[_0xa022('0x28')]=_0x1c7a71['membername'];_0x469c86[_0xa022('0x29')]=_0xa022('0x2a');_0x469c86[_0xa022('0x2b')]=_0xa022('0x2c');_0x469c86['holdtime']=0x0;_0x469c86[_0xa022('0x2d')]=0x1;_0x469c86[_0xa022('0x2e')]=_0x1c7a71[_0xa022('0x2f')];_0x469c86[_0xa022('0x30')]=_0xa022('0x31');return BPromise[_0xa022('0x9')]()['then'](voiceQueueReport[_0xa022('0x32')](_0x469c86))[_0xa022('0xb')](loggerCatch(_0xa022('0x33')));};exports['getContactRecallMe']=function(_0x493492,_0x4b0642){return BPromise[_0xa022('0x9')]()[_0xa022('0x34')](cmHopper[_0xa022('0x35')](_0x493492,_0x4b0642))['catch'](loggerCatch(_0xa022('0x36')));};exports[_0xa022('0x37')]=function(_0x28c5b6){return cmHopper[_0xa022('0x15')](_0x28c5b6,!![],!![])[_0xa022('0xb')](loggerCatch(_0xa022('0x38')));}; \ No newline at end of file +var _0x1436=['then','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','endtime','membername','context','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','util','bluebird','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueReport','error','inspect','createHistory','catch','[createHistory]\x20','resolve'];(function(_0x421c7d,_0x4ba011){var _0x51acd7=function(_0xe46884){while(--_0xe46884){_0x421c7d['push'](_0x421c7d['shift']());}};_0x51acd7(++_0x4ba011);}(_0x1436,0x17b));var _0x6143=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x1436[_0x321bb2];return _0x9c12ed;};'use strict';var util=require(_0x6143('0x0'));var BPromise=require(_0x6143('0x1'));var logger=require('../../../config/logger')(_0x6143('0x2'));var cmHopper=require(_0x6143('0x3'));var cmHopperHistory=require(_0x6143('0x4'));var cmHopperBlack=require(_0x6143('0x5'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0x6143('0x6'));function loggerCatch(_0x23c991){return function(_0x21b5e9){logger[_0x6143('0x7')](_0x23c991,util[_0x6143('0x8')](_0x21b5e9,{'showHidden':![],'depth':null}));};}function create(_0x3ff076){return cmHopperHistory[_0x6143('0x9')](_0x3ff076)[_0x6143('0xa')](loggerCatch(_0x6143('0xb')));}function createAgent(_0x4c8191){return BPromise[_0x6143('0xc')]()[_0x6143('0xd')](agentReportPreview[_0x6143('0x9')](_0x4c8191))[_0x6143('0xa')](loggerCatch(_0x6143('0xb')));}function moveContact(_0x12b687){return cmHopper[_0x6143('0xe')](_0x12b687,!![])['catch'](loggerCatch(_0x6143('0xf')));}exports[_0x6143('0x10')]=function(_0x537a2e){return cmHopperBlack[_0x6143('0x10')](_0x537a2e)[_0x6143('0xa')](loggerCatch('[checkIsBlackList]\x20'));};exports[_0x6143('0x11')]=function(_0xb06f3e){return BPromise[_0x6143('0xc')]()[_0x6143('0xd')](cmHopper[_0x6143('0x11')](_0xb06f3e))[_0x6143('0xa')](loggerCatch(_0x6143('0x12')));};exports['createHistory']=function(_0x2fd2ba,_0x1b144f){create(_0x2fd2ba)['catch'](loggerCatch(_0x1b144f));moveContact(_0x2fd2ba)[_0x6143('0xa')](loggerCatch(_0x1b144f));};exports[_0x6143('0x13')]=function(_0x1ce1ff,_0x43397f){createAgent(_0x1ce1ff)[_0x6143('0xa')](loggerCatch(_0x43397f));};exports[_0x6143('0x14')]=function(_0x527ce3,_0x32ed9e){create(_0x527ce3)[_0x6143('0xa')](loggerCatch(_0x32ed9e));};exports[_0x6143('0x15')]=function(_0x4312cf,_0x419aa9){moveContact(_0x4312cf)[_0x6143('0xa')](loggerCatch(_0x419aa9));};exports[_0x6143('0x16')]=function(_0x20b88f,_0x4666f8,_0x5d8cf2){if(_0x4666f8){_0x20b88f[_0x6143('0x17')]=null;}if(_0x5d8cf2){_0x20b88f[_0x6143('0x18')]=![];}return cmHopper[_0x6143('0x16')](_0x20b88f)[_0x6143('0xa')](loggerCatch(_0x6143('0x19')));};exports[_0x6143('0x1a')]=function(_0x578372){return cmHopper[_0x6143('0x1a')](_0x578372)[_0x6143('0xa')](loggerCatch(_0x6143('0x1b')));};exports[_0x6143('0x1c')]=function(_0x247551){return cmHopper[_0x6143('0x1c')]({'UserId':null},_0x247551,0x1)[_0x6143('0xa')](loggerCatch(_0x6143('0x1d')));};exports[_0x6143('0x1e')]=function(_0x440abc){return cmHopper[_0x6143('0x1c')]({'active':![]},_0x440abc,0x1)['catch'](loggerCatch(_0x6143('0x1f')));};exports[_0x6143('0x20')]=function(_0x10baed){var _0x2dd71f={};_0x2dd71f[_0x6143('0x21')]=_0x10baed['type'];_0x2dd71f[_0x6143('0x22')]=_0x10baed[_0x6143('0x22')];_0x2dd71f[_0x6143('0x23')]=_0x10baed['calleridnum'];_0x2dd71f[_0x6143('0x24')]=_0x10baed['calleridname'];_0x2dd71f[_0x6143('0x25')]=_0x10baed[_0x6143('0x25')];_0x2dd71f[_0x6143('0x26')]=_0x10baed[_0x6143('0x27')];_0x2dd71f[_0x6143('0x28')]=_0x10baed[_0x6143('0x27')];_0x2dd71f[_0x6143('0x29')]=0x1;_0x2dd71f['queuecallercompleteAt']=_0x10baed[_0x6143('0x2a')];_0x2dd71f['connectedlinename']=_0x10baed[_0x6143('0x2b')];_0x2dd71f[_0x6143('0x2c')]='from-sip';_0x2dd71f[_0x6143('0x2d')]=_0x6143('0x2e');_0x2dd71f[_0x6143('0x2f')]=0x0;_0x2dd71f[_0x6143('0x30')]=0x1;_0x2dd71f[_0x6143('0x31')]=_0x10baed[_0x6143('0x2b')];_0x2dd71f[_0x6143('0x32')]=_0x6143('0x33');return BPromise[_0x6143('0xc')]()['then'](voiceQueueReport[_0x6143('0x34')](_0x2dd71f))['catch'](loggerCatch(_0x6143('0x35')));};exports[_0x6143('0x36')]=function(_0x89b20e,_0x581f79){return BPromise[_0x6143('0xc')]()[_0x6143('0xd')](cmHopper['getContactRecallMe'](_0x89b20e,_0x581f79))[_0x6143('0xa')](loggerCatch(_0x6143('0x37')));};exports['rescheduleContactInQueue']=function(_0x463f07){return cmHopper[_0x6143('0x16')](_0x463f07,!![],!![])['catch'](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 2ac198a..219a312 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 _0x60a5=['bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','random','extractCalleridNumber','match','noanswer','variables','keys','toLowerCase','buildNoAnswerEventPayload','util','lodash','moment','../../../../config/logger','XCALLY_IP_AGI','loggerCatch','error','inspect','logger','info','loggerError','logger2','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridname','calleridnum','ContactId','dialer','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','hasOwnProperty','toLower','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','statedesc','Blacklist','responsetime','endtime','ringtime','getSeconds','starttime','logLookAgent','membername','logCustomer','state','answertime','isFailure','Failure','variablesAction','BOOKED','uniqueid','originate','timeout','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','clone','Global','scheduledAt','active','scheduledat','add','minutes','ListId','VoiceQueueId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','queue','interface','channelAgent','voice','mandatoryDisposition','buildObj','buildAcw','agentReadyId','not_inuse','reachable','push','getDiff','milliseconds','diff','seconds','createBody','CampaignId','filterKey','idContact','type','countglobal','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-cdrtype','xmd-callerid','xmd-agiafter','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrttbridged','rtpaudioqosjitter','rtpaudioqosloss'];(function(_0x4bb93d,_0x1cda9a){var _0x106b4f=function(_0x4aa8d1){while(--_0x4aa8d1){_0x4bb93d['push'](_0x4bb93d['shift']());}};_0x106b4f(++_0x1cda9a);}(_0x60a5,0x1b7));var _0x560a=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x60a5[_0x1ac595];return _0x455fff;};'use strict';var util=require(_0x560a('0x0'));var _=require(_0x560a('0x1'));var moment=require(_0x560a('0x2'));var logger=require(_0x560a('0x3'))('preview');var ipAgi=process['env'][_0x560a('0x4')]||'127.0.0.1';var utils=require('../../dialer/utils');exports[_0x560a('0x5')]=function(_0x13a00d){return function(_0x2fa912){logger[_0x560a('0x6')](_0x13a00d,util[_0x560a('0x7')](_0x2fa912,{'showHidden':![],'depth':null}));};};exports[_0x560a('0x8')]=function(_0x160d17,_0x4284eb){logger[_0x560a('0x9')](_0x160d17,util[_0x560a('0x7')](_0x4284eb,{'showHidden':![],'depth':null}));};exports[_0x560a('0xa')]=function(_0x437820,_0x3628a1){logger['error'](_0x437820,util[_0x560a('0x7')](_0x3628a1,{'showHidden':![],'depth':null}));};exports[_0x560a('0xb')]=function(_0x27be38){return function(_0x2a183d){logger['info'](_0x27be38,util[_0x560a('0x7')](_0x2a183d,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x50d19b,_0x4e69af,_0x1ec794){return{'message':_0x50d19b,'unlock':_0x4e69af,'active':_0x1ec794};};exports[_0x560a('0xc')]=function(_0x139e4e,_0x5571da,_0x3a1ab5){if(!_[_0x560a('0xd')](_0x3a1ab5)&&_0x560a('0xe')===typeof _0x3a1ab5&&!_['isEmpty'](_0x3a1ab5)){if(!_['isUndefined'](_0x5571da)&&_0x560a('0xe')===typeof _0x5571da&&!_[_0x560a('0xf')](_0x5571da)){return util[_0x560a('0x10')](_0x560a('0x11'),_0x5571da,_0x3a1ab5);}return util[_0x560a('0x10')](_0x560a('0x11'),_0x3a1ab5,_0x3a1ab5);}if(!_[_0x560a('0xd')](_0x139e4e)&&_0x560a('0xe')===typeof _0x139e4e&&!_[_0x560a('0xf')](_0x139e4e)){return _0x139e4e;}return _0x560a('0x12');};exports[_0x560a('0x13')]=function(_0x3c76a5){if(_[_0x560a('0x14')](_0x3c76a5)){return![];}return _0x3c76a5;};exports[_0x560a('0x15')]=function(_0x1a2f99,_0x32a9a0,_0x48f1b8,_0x379a81,_0x136580,_0x10df83){var _0x38b5e9={'XMD-QUEUE':_0x32a9a0['Queue']?_0x32a9a0[_0x560a('0x16')][_0x560a('0x17')]:'','XMD-CALLERID':_0x379a81,'XMD-CALLERID-PREVIEW':_0x10df83?util['format'](_0x560a('0x11'),_0x10df83[_0x560a('0x18')],_0x10df83[_0x560a('0x19')]):_0x379a81,'XMD-DIALID':_0x136580,'XMD-CONTACTID':_0x32a9a0[_0x560a('0x1a')],'XMD-CDRTYPE':_0x560a('0x1b'),'CALLERID(all)':_0x379a81,'XMD-VOICEQUEUEID':_0x32a9a0['VoiceQueueId'],'XMD-DIALCHANNEL':_0x48f1b8,'XMD-DIALTIMEOUT':_0x1a2f99[_0x560a('0x1c')]||0x1e,'XMD-DIALOPTIONS':util[_0x560a('0x10')](_0x560a('0x1d'),_0x1a2f99[_0x560a('0x1e')]?'g':'',_['isEmpty'](_0x1a2f99[_0x560a('0x1f')])?'':_0x560a('0x20')),'XMD-DIALURL':_0x1a2f99['dialPreviewUrl']||'','XMD-AGI':_0x1a2f99[_0x560a('0x21')]?util[_0x560a('0x10')](_0x560a('0x22'),ipAgi,_0x1a2f99[_0x560a('0x21')]):_0x560a('0x23'),'XMD-AGIAFTER':_0x1a2f99[_0x560a('0x1e')]?util[_0x560a('0x10')](_0x560a('0x22'),ipAgi,_0x1a2f99[_0x560a('0x1e')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x10df83?_0x10df83[_0x560a('0x24')]:'','XMD-ORIGINATECALLERIDNAME':_0x10df83?_0x10df83['originatecalleridname']:'','XMD-DESTINATION':_0x560a('0x25'),'SIPADDHEADER':_0x560a('0x26')};if(!_['isEmpty'](_0x1a2f99[_0x560a('0x1f')])){_0x38b5e9[util[_0x560a('0x10')]('%s',_0x560a('0x27'))]=_0x1a2f99['monitor_format'];_0x38b5e9[util[_0x560a('0x10')]('%s',_0x560a('0x28'))]=_0x136580;}return _0x38b5e9;};exports[_0x560a('0x29')]=function(_0x1e3c76){var _0x2e5516={};for(var _0x499061 in _0x1e3c76){if(_0x1e3c76[_0x560a('0x2a')](_0x499061)){_0x2e5516[util[_0x560a('0x10')]('%s',_[_0x560a('0x2b')](_0x499061))]=_0x1e3c76[_0x499061];}}return{'variables':_0x2e5516};};exports['updateOriginated']=function(_0x81653f,_0xbcfe60){if(!_[_0x560a('0x14')](_0x81653f)){if(_0x81653f[_0x560a('0x2a')](_0x560a('0x2c'))){if(_0x81653f[_0x560a('0x2c')]>0x0){_0x81653f[_0x560a('0x2c')]-=0x1;}else{logger[_0x560a('0x6')](_0x560a('0x2d'),_0xbcfe60);}}}else{logger[_0x560a('0x6')](_0x560a('0x2e'),_0xbcfe60);}};exports[_0x560a('0x2f')]=function(_0x18743e){var _0x282141=moment()[_0x560a('0x10')](_0x560a('0x30'));_0x18743e['state']=0xd;_0x18743e[_0x560a('0x31')]=_0x560a('0x32');_0x18743e['starttime']=_0x282141;_0x18743e[_0x560a('0x33')]=_0x282141;_0x18743e[_0x560a('0x34')]=_0x282141;};exports['logAgent']=function(_0x19b10e,_0x3a399f,_0x5a4a58){var _0x9f838b=moment()[_0x560a('0x10')]('YYYY-MM-DD\x20HH:mm:ss');_0x19b10e['state']=_0x3a399f;_0x19b10e['statedesc']=_0x5a4a58;_0x19b10e[_0x560a('0x33')]=_0x9f838b;_0x19b10e[_0x560a('0x35')]=utils[_0x560a('0x36')](_0x19b10e[_0x560a('0x33')],_0x19b10e[_0x560a('0x37')]);};exports[_0x560a('0x38')]=function(_0x588c90,_0x3608fd,_0x1040b6){_0x588c90[_0x560a('0x39')]=_0x3608fd;_0x588c90['UserId']=_0x1040b6;};exports[_0x560a('0x3a')]=function(_0x2ac5b0,_0xb28e74,_0x4ac52b){var _0x6b707f=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x2ac5b0[_0x560a('0x3b')]=_0xb28e74;_0x2ac5b0[_0x560a('0x31')]=_0x4ac52b;_0x2ac5b0[_0x560a('0x33')]=_0x2ac5b0[_0x560a('0x33')]?_0x2ac5b0['responsetime']:_0x6b707f;_0x2ac5b0['endtime']=_0x2ac5b0[_0x560a('0x34')]?_0x2ac5b0[_0x560a('0x34')]:_0x6b707f;_0x2ac5b0['ringtime']=utils['getSeconds'](_0x2ac5b0[_0x560a('0x33')]||0x0,_0x2ac5b0['starttime']||0x0);_0x2ac5b0['talktime']=_0x2ac5b0['answertime']?utils[_0x560a('0x36')](_0x2ac5b0[_0x560a('0x34')],_0x2ac5b0[_0x560a('0x3c')]):0x0;};exports[_0x560a('0x3d')]=function(_0xd07d95){return _0xd07d95===_0x560a('0x3e');};exports[_0x560a('0x3f')]=function(_0x3aaa89,_0x3bad7f,_0x371395,_0x334918,_0x552ab7){var _0xdbe4e1=_0x334918?'RECALL':_0x3aaa89[_0x560a('0x18')];_0xdbe4e1=_0x552ab7?_0x560a('0x40'):_0xdbe4e1;return{'actionid':_0x3aaa89[_0x560a('0x41')],'action':_0x560a('0x42'),'channel':_0x3aaa89['channelAgent'],'callerid':util[_0x560a('0x10')](_0x560a('0x11'),_0xdbe4e1,_0x3aaa89['calleridnum']),'Exten':_0x560a('0x25'),'Context':'from-sip','Priority':'1','variable':_0x371395,'timeout':(_0x3bad7f[_0x560a('0x43')]||0x1e)*0x3e8,'async':!![],'channelid':_0x3aaa89['uniqueid']};};exports['totalGlobal']=function(_0x3e47ae){return _0x3e47ae[_0x560a('0x44')]+_0x3e47ae[_0x560a('0x45')]+_0x3e47ae[_0x560a('0x46')]+_0x3e47ae['countagentrejectretry']+_0x3e47ae[_0x560a('0x47')];};exports['cloneAction']=function(_0x24567c){var _0x2f961a=_[_0x560a('0x48')](_0x24567c);_0x2f961a[_0x560a('0x3b')]=0xf;_0x2f961a[_0x560a('0x31')]=_0x560a('0x49');return _0x2f961a;};exports[_0x560a('0x4a')]=function(_0x499b13,_0x5ead2c,_0x31d3e8){var _0x37da32={};_0x37da32[_0x5ead2c]=_0x499b13[_0x5ead2c];_0x37da32[_0x560a('0x4b')]=![];_0x37da32[_0x560a('0x4c')]=moment()[_0x560a('0x4d')](_0x31d3e8,_0x560a('0x4e'))['format'](_0x560a('0x30'));_0x37da32['ContactId']=_0x499b13[_0x560a('0x1a')];_0x37da32[_0x560a('0x4f')]=_0x499b13[_0x560a('0x4f')];_0x37da32[_0x560a('0x50')]=_0x499b13[_0x560a('0x50')]||undefined;return _0x37da32;};exports[_0x560a('0x51')]=function(_0x4d7ac0,_0x4467ed){if(!_[_0x560a('0x14')](_0x4d7ac0)){if(_0x4d7ac0[_0x560a('0x52')]>0x0){_0x4d7ac0[_0x560a('0x52')]-=0x1;}else{logger[_0x560a('0x6')](_0x4467ed,_0x560a('0x53'));}}else{logger[_0x560a('0x6')](_0x4467ed,_0x560a('0x54'));}};exports[_0x560a('0x55')]=function(_0x56a340){if(_0x56a340<=0x0){return!![];}return![];};function buildObj(_0x4c6338,_0x353423,_0x43ef74){_0x4c6338['lastevent']=_0x353423;_0x4c6338['name']=_0x4c6338[_0x560a('0x56')];_0x4c6338[_0x560a('0x57')]=_0x4c6338[_0x560a('0x58')];_0x4c6338['motionChannel']=_0x560a('0x59');if(_0x43ef74){_0x4c6338[_0x560a('0x5a')]=_0x43ef74['mandatoryDisposition'];}return _0x4c6338;}exports[_0x560a('0x5b')]=buildObj;exports[_0x560a('0x5c')]=function(_0x39dc0b){var _0x3f6216={};_0x3f6216['queue']=_0x39dc0b[_0x560a('0x56')];_0x3f6216[_0x560a('0x57')]=_0x39dc0b[_0x560a('0x58')];_0x3f6216[_0x560a('0x41')]=_0x39dc0b['uniqueid'];return _0x3f6216;};exports[_0x560a('0x5d')]=function(_0x512125){var _0x4cd885=[];for(var _0x4b5cf9 in _0x512125){if(_0x512125[_0x560a('0x2a')](_0x4b5cf9)){if(!_[_0x560a('0x14')](_0x512125[_0x4b5cf9])&&_0x512125[_0x4b5cf9][_0x560a('0x3b')]===_0x560a('0x5e')&&_0x512125[_0x4b5cf9]['status']===_0x560a('0x5f')){_0x4cd885[_0x560a('0x60')](_0x512125[_0x4b5cf9]['id']);}}}return _0x4cd885;};exports[_0x560a('0x61')]=function(_0x594158){var _0x9d3834=moment()[_0x560a('0x62')](0x0);var _0x33872c=moment(_0x594158)['milliseconds'](0x0);return _0x9d3834[_0x560a('0x63')](_0x33872c,_0x560a('0x64'));};exports[_0x560a('0x65')]=function(_0x5c5606){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x5c5606[_0x560a('0x1a')],'ListId':_0x5c5606[_0x560a('0x4f')],'VoiceQueueId':_0x5c5606['VoiceQueueId']||undefined,'CampaignId':_0x5c5606[_0x560a('0x66')]||undefined};};exports[_0x560a('0x67')]=function(_0x2cf3c7){if(_0x2cf3c7===_0x560a('0x41')||_0x2cf3c7===_0x560a('0x68')||_0x2cf3c7===_0x560a('0x56')||_0x2cf3c7===_0x560a('0x69')||_0x2cf3c7==='campaigntype'||_0x2cf3c7==='dialAnswer'||_0x2cf3c7==='membername'||_0x2cf3c7===_0x560a('0x58')||_0x2cf3c7==='calleridname'||_0x2cf3c7===_0x560a('0x4b')||_0x2cf3c7==='calleridnum'||_0x2cf3c7===_0x560a('0x4c')||_0x2cf3c7===_0x560a('0x44')||_0x2cf3c7===_0x560a('0x45')||_0x2cf3c7===_0x560a('0x46')||_0x2cf3c7===_0x560a('0x6a')||_0x2cf3c7===_0x560a('0x6b')||_0x2cf3c7===_0x560a('0x6c')||_0x2cf3c7===_0x560a('0x6d')||_0x2cf3c7===_0x560a('0x6e')||_0x2cf3c7==='ContactId'||_0x2cf3c7===_0x560a('0x4f')||_0x2cf3c7==='UserId'||_0x2cf3c7===_0x560a('0x50')||_0x2cf3c7===_0x560a('0x6f')||_0x2cf3c7===_0x560a('0x70')||_0x2cf3c7==='xmd-queue'||_0x2cf3c7===_0x560a('0x71')||_0x2cf3c7===_0x560a('0x72')||_0x2cf3c7===_0x560a('0x73')||_0x2cf3c7===_0x560a('0x74')||_0x2cf3c7===_0x560a('0x75')||_0x2cf3c7===_0x560a('0x76')||_0x2cf3c7==='xmd-dialchannel'||_0x2cf3c7==='xmd-contactid'||_0x2cf3c7===_0x560a('0x77')||_0x2cf3c7===_0x560a('0x78')||_0x2cf3c7===_0x560a('0x79')||_0x2cf3c7==='xmd-agi'||_0x2cf3c7===_0x560a('0x7a')||_0x2cf3c7===_0x560a('0x7b')||_0x2cf3c7==='rtpaudioqosjitter'||_0x2cf3c7===_0x560a('0x7c')||_0x2cf3c7==='rtpaudioqosloss'||_0x2cf3c7===_0x560a('0x7d')||_0x2cf3c7==='rtpaudioqosrtt'||_0x2cf3c7===_0x560a('0x7e')||_0x2cf3c7===_0x560a('0x7a')||_0x2cf3c7===_0x560a('0x7b')||_0x2cf3c7===_0x560a('0x7f')||_0x2cf3c7==='rtpaudioqosjitterbridged'||_0x2cf3c7===_0x560a('0x80')||_0x2cf3c7==='rtpaudioqoslossbridged'||_0x2cf3c7==='rtpaudioqosrtt'||_0x2cf3c7===_0x560a('0x7e')||_0x2cf3c7===_0x560a('0x81')||_0x2cf3c7===_0x560a('0x82')||_0x2cf3c7===_0x560a('0x3b')||_0x2cf3c7===_0x560a('0x31')){return![];}return!![];};exports[_0x560a('0x83')]=function(_0x233e21,_0x55cbd2){var _0x368527,_0xea7483,_0x3855d4;if(_0x55cbd2<=0x0){_0x55cbd2=0x1;}_0x368527=new RegExp(_0x560a('0x84')+_0x55cbd2+'}$');_0xea7483=Math[_0x560a('0x85')](0xa,_0x55cbd2-0x1);_0x3855d4=Math[_0x560a('0x85')](0xa,_0x55cbd2)-0x1;return util['format']('%s',_['replace'](_0x233e21,_0x368527,_[_0x560a('0x86')](_0xea7483,_0x3855d4)));};exports['extractCalleridName']=function(_0x20c908){var _0x8588ad=_0x20c908['match'](/"(.*?)"/);return _0x8588ad?_0x8588ad[0x1]:_0x20c908;};exports[_0x560a('0x87')]=function(_0x454d73){var _0x22a420=_0x454d73[_0x560a('0x88')](/<(.*?)>/);return _0x22a420?_0x22a420[0x1]:_0x454d73;};function buildNoAnswerEventPayload(_0x46648c,_0x323c75){var _0x5e8cce=buildObj(_0x46648c,_0x560a('0x89'));if(!_['isEmpty'](_0x323c75[_0x560a('0x8a')])){Object[_0x560a('0x8b')](_0x323c75[_0x560a('0x8a')])['forEach'](function(_0xbb67d2){_0x5e8cce[_0xbb67d2[_0x560a('0x8c')]()]=_0x323c75[_0x560a('0x8a')][_0xbb67d2];});}return _0x5e8cce;}exports[_0x560a('0x8d')]=buildNoAnswerEventPayload; \ No newline at end of file +var _0x26c8=['rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqosrttbridged','bridgepeer','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','match','extractCalleridNumber','noanswer','variables','keys','toLowerCase','util','lodash','moment','../../../../config/logger','env','XCALLY_IP_AGI','loggerCatch','inspect','logger','logger2','info','message','getCallerId','isUndefined','string','isEmpty','\x22%s\x22\x20<%s>','format','isActive','isNil','addVariables','Queue','name','calleridname','ContactId','dialer','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','Blacklist','starttime','responsetime','endtime','logAgent','statedesc','ringtime','getSeconds','logLookAgent','membername','talktime','answertime','isFailure','Failure','RECALL','BOOKED','originate','channelAgent','calleridnum','xcally-motion-preview','from-sip','timeout','uniqueid','countbusyretry','countcongestionretry','countagentrejectretry','cloneAction','clone','Global','scheduledAt','scheduledat','add','VoiceQueueId','pTalking','error','IsNotLoggedIn','lastevent','interface','motionChannel','voice','mandatoryDisposition','buildObj','queue','hasOwnProperty','not_inuse','status','reachable','getDiff','milliseconds','diff','seconds','createBody','ListId','CampaignId','filterKey','type','dialAnswer','countnoanswerretry','countglobal','callback','callbackuniqueid','callbackat','recallme','UserId','sipcallid','xmd-voicequeueid','xmd-queue','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-agiafter','rtpaudioqos','rtpaudioqosbridged','rtpaudioqoslossbridged','rtpaudioqosrtt'];(function(_0xf8e7fe,_0x5325bb){var _0x4975d5=function(_0x3d7660){while(--_0x3d7660){_0xf8e7fe['push'](_0xf8e7fe['shift']());}};_0x4975d5(++_0x5325bb);}(_0x26c8,0x128));var _0x826c=function(_0x284da7,_0x5a8125){_0x284da7=_0x284da7-0x0;var _0x84a9d1=_0x26c8[_0x284da7];return _0x84a9d1;};'use strict';var util=require(_0x826c('0x0'));var _=require(_0x826c('0x1'));var moment=require(_0x826c('0x2'));var logger=require(_0x826c('0x3'))('preview');var ipAgi=process[_0x826c('0x4')][_0x826c('0x5')]||'127.0.0.1';var utils=require('../../dialer/utils');exports[_0x826c('0x6')]=function(_0x22d415){return function(_0x53a9bf){logger['error'](_0x22d415,util[_0x826c('0x7')](_0x53a9bf,{'showHidden':![],'depth':null}));};};exports[_0x826c('0x8')]=function(_0x13c0fb,_0x1d14ab){logger['info'](_0x13c0fb,util[_0x826c('0x7')](_0x1d14ab,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x55426d,_0x30aa94){logger['error'](_0x55426d,util[_0x826c('0x7')](_0x30aa94,{'showHidden':![],'depth':null}));};exports[_0x826c('0x9')]=function(_0x5d6c6e){return function(_0x20faa5){logger[_0x826c('0xa')](_0x5d6c6e,util[_0x826c('0x7')](_0x20faa5,{'showHidden':![],'depth':null}));};};exports[_0x826c('0xb')]=function(_0x24889a,_0x32ee84,_0x191c83){return{'message':_0x24889a,'unlock':_0x32ee84,'active':_0x191c83};};exports[_0x826c('0xc')]=function(_0x50c0b7,_0x361a1c,_0x3b71f7){if(!_[_0x826c('0xd')](_0x3b71f7)&&_0x826c('0xe')===typeof _0x3b71f7&&!_[_0x826c('0xf')](_0x3b71f7)){if(!_[_0x826c('0xd')](_0x361a1c)&&_0x826c('0xe')===typeof _0x361a1c&&!_[_0x826c('0xf')](_0x361a1c)){return util['format'](_0x826c('0x10'),_0x361a1c,_0x3b71f7);}return util[_0x826c('0x11')](_0x826c('0x10'),_0x3b71f7,_0x3b71f7);}if(!_[_0x826c('0xd')](_0x50c0b7)&&_0x826c('0xe')===typeof _0x50c0b7&&!_[_0x826c('0xf')](_0x50c0b7)){return _0x50c0b7;}return'\x22\x22\x20<>';};exports[_0x826c('0x12')]=function(_0x1220ef){if(_[_0x826c('0x13')](_0x1220ef)){return![];}return _0x1220ef;};exports[_0x826c('0x14')]=function(_0x5c4e5e,_0x1699b4,_0x6dfbb4,_0xdbad27,_0x4f9de9,_0x96bc52){var _0x325668={'XMD-QUEUE':_0x1699b4[_0x826c('0x15')]?_0x1699b4[_0x826c('0x15')][_0x826c('0x16')]:'','XMD-CALLERID':_0xdbad27,'XMD-CALLERID-PREVIEW':_0x96bc52?util[_0x826c('0x11')](_0x826c('0x10'),_0x96bc52[_0x826c('0x17')],_0x96bc52['calleridnum']):_0xdbad27,'XMD-DIALID':_0x4f9de9,'XMD-CONTACTID':_0x1699b4[_0x826c('0x18')],'XMD-CDRTYPE':_0x826c('0x19'),'CALLERID(all)':_0xdbad27,'XMD-VOICEQUEUEID':_0x1699b4['VoiceQueueId'],'XMD-DIALCHANNEL':_0x6dfbb4,'XMD-DIALTIMEOUT':_0x5c4e5e[_0x826c('0x1a')]||0x1e,'XMD-DIALOPTIONS':util['format'](_0x826c('0x1b'),_0x5c4e5e[_0x826c('0x1c')]?'g':'',_[_0x826c('0xf')](_0x5c4e5e[_0x826c('0x1d')])?'':_0x826c('0x1e')),'XMD-DIALURL':_0x5c4e5e[_0x826c('0x1f')]||'','XMD-AGI':_0x5c4e5e[_0x826c('0x20')]?util['format'](_0x826c('0x21'),ipAgi,_0x5c4e5e[_0x826c('0x20')]):'NONE','XMD-AGIAFTER':_0x5c4e5e[_0x826c('0x1c')]?util[_0x826c('0x11')](_0x826c('0x21'),ipAgi,_0x5c4e5e[_0x826c('0x1c')]):_0x826c('0x22'),'XMD-ORIGINATECALLERIDNUM':_0x96bc52?_0x96bc52[_0x826c('0x23')]:'','XMD-ORIGINATECALLERIDNAME':_0x96bc52?_0x96bc52[_0x826c('0x24')]:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':'Call-Type:\x20PREVIEW'};if(!_[_0x826c('0xf')](_0x5c4e5e['monitor_format'])){_0x325668[util[_0x826c('0x11')]('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x5c4e5e[_0x826c('0x1d')];_0x325668[util['format']('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x4f9de9;}return _0x325668;};exports[_0x826c('0x25')]=function(_0x1c1b1d){var _0xa93257={};for(var _0x1ccb90 in _0x1c1b1d){if(_0x1c1b1d['hasOwnProperty'](_0x1ccb90)){_0xa93257[util[_0x826c('0x11')]('%s',_[_0x826c('0x26')](_0x1ccb90))]=_0x1c1b1d[_0x1ccb90];}}return{'variables':_0xa93257};};exports[_0x826c('0x27')]=function(_0xfa21f4,_0x3e640f){if(!_['isNil'](_0xfa21f4)){if(_0xfa21f4['hasOwnProperty'](_0x826c('0x28'))){if(_0xfa21f4[_0x826c('0x28')]>0x0){_0xfa21f4['originated']-=0x1;}else{logger['error']('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x3e640f);}}}else{logger['error'](_0x826c('0x29'),_0x3e640f);}};exports[_0x826c('0x2a')]=function(_0x5c902d){var _0x2a88d4=moment()[_0x826c('0x11')](_0x826c('0x2b'));_0x5c902d[_0x826c('0x2c')]=0xd;_0x5c902d['statedesc']=_0x826c('0x2d');_0x5c902d[_0x826c('0x2e')]=_0x2a88d4;_0x5c902d[_0x826c('0x2f')]=_0x2a88d4;_0x5c902d[_0x826c('0x30')]=_0x2a88d4;};exports[_0x826c('0x31')]=function(_0x2e90f0,_0x4f6e11,_0x2864ac){var _0x30bd50=moment()[_0x826c('0x11')](_0x826c('0x2b'));_0x2e90f0['state']=_0x4f6e11;_0x2e90f0[_0x826c('0x32')]=_0x2864ac;_0x2e90f0[_0x826c('0x2f')]=_0x30bd50;_0x2e90f0[_0x826c('0x33')]=utils[_0x826c('0x34')](_0x2e90f0[_0x826c('0x2f')],_0x2e90f0[_0x826c('0x2e')]);};exports[_0x826c('0x35')]=function(_0x441a53,_0x24f61a,_0x4c06fa){_0x441a53[_0x826c('0x36')]=_0x24f61a;_0x441a53['UserId']=_0x4c06fa;};exports['logCustomer']=function(_0x32f3df,_0x6a5524,_0x3bd4b6){var _0x1ff61b=moment()['format'](_0x826c('0x2b'));_0x32f3df[_0x826c('0x2c')]=_0x6a5524;_0x32f3df[_0x826c('0x32')]=_0x3bd4b6;_0x32f3df['responsetime']=_0x32f3df[_0x826c('0x2f')]?_0x32f3df[_0x826c('0x2f')]:_0x1ff61b;_0x32f3df[_0x826c('0x30')]=_0x32f3df[_0x826c('0x30')]?_0x32f3df[_0x826c('0x30')]:_0x1ff61b;_0x32f3df[_0x826c('0x33')]=utils[_0x826c('0x34')](_0x32f3df['responsetime']||0x0,_0x32f3df[_0x826c('0x2e')]||0x0);_0x32f3df[_0x826c('0x37')]=_0x32f3df[_0x826c('0x38')]?utils[_0x826c('0x34')](_0x32f3df[_0x826c('0x30')],_0x32f3df[_0x826c('0x38')]):0x0;};exports[_0x826c('0x39')]=function(_0x32524c){return _0x32524c===_0x826c('0x3a');};exports['variablesAction']=function(_0x30f620,_0x36a1a5,_0x23f213,_0x1aaf6b,_0x3179c7){var _0x3aa466=_0x1aaf6b?_0x826c('0x3b'):_0x30f620[_0x826c('0x17')];_0x3aa466=_0x3179c7?_0x826c('0x3c'):_0x3aa466;return{'actionid':_0x30f620['uniqueid'],'action':_0x826c('0x3d'),'channel':_0x30f620[_0x826c('0x3e')],'callerid':util[_0x826c('0x11')](_0x826c('0x10'),_0x3aa466,_0x30f620[_0x826c('0x3f')]),'Exten':_0x826c('0x40'),'Context':_0x826c('0x41'),'Priority':'1','variable':_0x23f213,'timeout':(_0x36a1a5[_0x826c('0x42')]||0x1e)*0x3e8,'async':!![],'channelid':_0x30f620[_0x826c('0x43')]};};exports['totalGlobal']=function(_0x2485ca){return _0x2485ca[_0x826c('0x44')]+_0x2485ca[_0x826c('0x45')]+_0x2485ca['countnoanswerretry']+_0x2485ca[_0x826c('0x46')]+_0x2485ca['countnosuchnumberretry'];};exports[_0x826c('0x47')]=function(_0x315028){var _0x56875d=_[_0x826c('0x48')](_0x315028);_0x56875d[_0x826c('0x2c')]=0xf;_0x56875d[_0x826c('0x32')]=_0x826c('0x49');return _0x56875d;};exports[_0x826c('0x4a')]=function(_0x2dbdca,_0x588e2d,_0x54be1){var _0x51ccbe={};_0x51ccbe[_0x588e2d]=_0x2dbdca[_0x588e2d];_0x51ccbe['active']=![];_0x51ccbe[_0x826c('0x4b')]=moment()[_0x826c('0x4c')](_0x54be1,'minutes')[_0x826c('0x11')](_0x826c('0x2b'));_0x51ccbe[_0x826c('0x18')]=_0x2dbdca[_0x826c('0x18')];_0x51ccbe['ListId']=_0x2dbdca['ListId'];_0x51ccbe[_0x826c('0x4d')]=_0x2dbdca['VoiceQueueId']||undefined;return _0x51ccbe;};exports['decrementTalkink']=function(_0x4a63be,_0x3dc538){if(!_[_0x826c('0x13')](_0x4a63be)){if(_0x4a63be[_0x826c('0x4e')]>0x0){_0x4a63be[_0x826c('0x4e')]-=0x1;}else{logger[_0x826c('0x4f')](_0x3dc538,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0x826c('0x4f')](_0x3dc538,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0x826c('0x50')]=function(_0x5da3fa){if(_0x5da3fa<=0x0){return!![];}return![];};function buildObj(_0x49e9ca,_0x1bdc4f,_0xea4cd6){_0x49e9ca[_0x826c('0x51')]=_0x1bdc4f;_0x49e9ca[_0x826c('0x16')]=_0x49e9ca['queue'];_0x49e9ca[_0x826c('0x52')]=_0x49e9ca[_0x826c('0x3e')];_0x49e9ca[_0x826c('0x53')]=_0x826c('0x54');if(_0xea4cd6){_0x49e9ca[_0x826c('0x55')]=_0xea4cd6[_0x826c('0x55')];}return _0x49e9ca;}exports[_0x826c('0x56')]=buildObj;exports['buildAcw']=function(_0x550ae4){var _0x5b513e={};_0x5b513e[_0x826c('0x57')]=_0x550ae4['queue'];_0x5b513e[_0x826c('0x52')]=_0x550ae4[_0x826c('0x3e')];_0x5b513e[_0x826c('0x43')]=_0x550ae4[_0x826c('0x43')];return _0x5b513e;};exports['agentReadyId']=function(_0x4195ea){var _0x57bb0f=[];for(var _0x4d58c9 in _0x4195ea){if(_0x4195ea[_0x826c('0x58')](_0x4d58c9)){if(!_[_0x826c('0x13')](_0x4195ea[_0x4d58c9])&&_0x4195ea[_0x4d58c9][_0x826c('0x2c')]===_0x826c('0x59')&&_0x4195ea[_0x4d58c9][_0x826c('0x5a')]===_0x826c('0x5b')){_0x57bb0f['push'](_0x4195ea[_0x4d58c9]['id']);}}}return _0x57bb0f;};exports[_0x826c('0x5c')]=function(_0x2720b4){var _0x538bf0=moment()[_0x826c('0x5d')](0x0);var _0x4a416d=moment(_0x2720b4)[_0x826c('0x5d')](0x0);return _0x538bf0[_0x826c('0x5e')](_0x4a416d,_0x826c('0x5f'));};exports[_0x826c('0x60')]=function(_0x245a5d){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x245a5d[_0x826c('0x18')],'ListId':_0x245a5d[_0x826c('0x61')],'VoiceQueueId':_0x245a5d[_0x826c('0x4d')]||undefined,'CampaignId':_0x245a5d[_0x826c('0x62')]||undefined};};exports[_0x826c('0x63')]=function(_0x22a8aa){if(_0x22a8aa==='uniqueid'||_0x22a8aa==='idContact'||_0x22a8aa===_0x826c('0x57')||_0x22a8aa===_0x826c('0x64')||_0x22a8aa==='campaigntype'||_0x22a8aa===_0x826c('0x65')||_0x22a8aa==='membername'||_0x22a8aa===_0x826c('0x3e')||_0x22a8aa===_0x826c('0x17')||_0x22a8aa==='active'||_0x22a8aa===_0x826c('0x3f')||_0x22a8aa==='scheduledat'||_0x22a8aa==='countbusyretry'||_0x22a8aa===_0x826c('0x45')||_0x22a8aa===_0x826c('0x66')||_0x22a8aa===_0x826c('0x67')||_0x22a8aa===_0x826c('0x68')||_0x22a8aa===_0x826c('0x69')||_0x22a8aa===_0x826c('0x6a')||_0x22a8aa===_0x826c('0x6b')||_0x22a8aa==='ContactId'||_0x22a8aa===_0x826c('0x61')||_0x22a8aa===_0x826c('0x6c')||_0x22a8aa===_0x826c('0x4d')||_0x22a8aa===_0x826c('0x6d')||_0x22a8aa===_0x826c('0x6e')||_0x22a8aa===_0x826c('0x6f')||_0x22a8aa==='xmd-phone'||_0x22a8aa===_0x826c('0x70')||_0x22a8aa===_0x826c('0x71')||_0x22a8aa===_0x826c('0x72')||_0x22a8aa===_0x826c('0x73')||_0x22a8aa===_0x826c('0x74')||_0x22a8aa===_0x826c('0x75')||_0x22a8aa===_0x826c('0x76')||_0x22a8aa==='xmd-cdrtype'||_0x22a8aa==='xmd-callerid'||_0x22a8aa===_0x826c('0x77')||_0x22a8aa==='xmd-agi'||_0x22a8aa===_0x826c('0x78')||_0x22a8aa===_0x826c('0x79')||_0x22a8aa==='rtpaudioqosjitter'||_0x22a8aa==='rtpaudioqosjitterbridged'||_0x22a8aa==='rtpaudioqosloss'||_0x22a8aa===_0x826c('0x7a')||_0x22a8aa===_0x826c('0x7b')||_0x22a8aa==='rtpaudioqosrttbridged'||_0x22a8aa===_0x826c('0x78')||_0x22a8aa===_0x826c('0x79')||_0x22a8aa===_0x826c('0x7c')||_0x22a8aa==='rtpaudioqosjitterbridged'||_0x22a8aa===_0x826c('0x7d')||_0x22a8aa==='rtpaudioqoslossbridged'||_0x22a8aa===_0x826c('0x7b')||_0x22a8aa===_0x826c('0x7e')||_0x22a8aa===_0x826c('0x7f')||_0x22a8aa==='bridgepvtcallid'||_0x22a8aa===_0x826c('0x2c')||_0x22a8aa===_0x826c('0x32')){return![];}return!![];};exports[_0x826c('0x80')]=function(_0x59aa10,_0x50a741){var _0x57a090,_0xcbbd1f,_0xd458d4;if(_0x50a741<=0x0){_0x50a741=0x1;}_0x57a090=new RegExp(_0x826c('0x81')+_0x50a741+'}$');_0xcbbd1f=Math[_0x826c('0x82')](0xa,_0x50a741-0x1);_0xd458d4=Math[_0x826c('0x82')](0xa,_0x50a741)-0x1;return util[_0x826c('0x11')]('%s',_[_0x826c('0x83')](_0x59aa10,_0x57a090,_[_0x826c('0x84')](_0xcbbd1f,_0xd458d4)));};exports[_0x826c('0x85')]=function(_0x20010a){var _0x31aee3=_0x20010a[_0x826c('0x86')](/"(.*?)"/);return _0x31aee3?_0x31aee3[0x1]:_0x20010a;};exports[_0x826c('0x87')]=function(_0x59f786){var _0x55ef98=_0x59f786[_0x826c('0x86')](/<(.*?)>/);return _0x55ef98?_0x55ef98[0x1]:_0x59f786;};function buildNoAnswerEventPayload(_0x33e17f,_0x2c4712){var _0x575d7b=buildObj(_0x33e17f,_0x826c('0x88'));if(!_[_0x826c('0xf')](_0x2c4712[_0x826c('0x89')])){Object[_0x826c('0x8a')](_0x2c4712[_0x826c('0x89')])['forEach'](function(_0x11aa62){_0x575d7b[_0x11aa62[_0x826c('0x8b')]()]=_0x2c4712[_0x826c('0x89')][_0x11aa62];});}return _0x575d7b;}exports['buildNoAnswerEventPayload']=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 922109e..4d65e92 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 _0xeda8=['string','number','boolean','queueremove','queuepause','reload','voicechannel','voicequeuechannelredirect','queueadd'];(function(_0x377fdb,_0x582d9f){var _0x4d62a1=function(_0x44723){while(--_0x44723){_0x377fdb['push'](_0x377fdb['shift']());}};_0x4d62a1(++_0x582d9f);}(_0xeda8,0x104));var _0x8eda=function(_0x59ff48,_0xb5c9de){_0x59ff48=_0x59ff48-0x0;var _0x4ec3f0=_0xeda8[_0x59ff48];return _0x4ec3f0;};'use strict';exports[_0x8eda('0x0')]={'queue':{'type':_0x8eda('0x1'),'required':!![]},'interface':{'type':'string','required':!![]},'membername':{'type':_0x8eda('0x1'),'required':!![]},'penalty':{'type':_0x8eda('0x2'),'required':![]},'paused':{'type':_0x8eda('0x3'),'required':![]}};exports[_0x8eda('0x4')]={'queue':{'type':_0x8eda('0x1'),'required':!![]},'interface':{'type':_0x8eda('0x1'),'required':!![]}};exports[_0x8eda('0x5')]={'interface':{'type':_0x8eda('0x1'),'required':!![]},'paused':{'type':_0x8eda('0x3')},'reason':{'type':_0x8eda('0x1'),'required':![]}};exports[_0x8eda('0x6')]={'module':{'type':_0x8eda('0x1'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0x8eda('0x1'),'required':!![]}};exports[_0x8eda('0x7')]={'uniqueid':{'type':_0x8eda('0x1'),'required':!![]},'filename':{'type':_0x8eda('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':'string'}};exports['voicequeuechannelhangup']={'uniqueid':{'type':'string','required':!![]}};exports[_0x8eda('0x8')]={'uniqueid':{'type':_0x8eda('0x1'),'required':!![]},'exten':{'type':_0x8eda('0x1'),'required':!![]},'context':{'type':'string'}}; \ No newline at end of file +var _0x61d3=['voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','boolean','queueremove','queuepause','reload'];(function(_0x51bbd3,_0x19faba){var _0x40c217=function(_0x4f7252){while(--_0x4f7252){_0x51bbd3['push'](_0x51bbd3['shift']());}};_0x40c217(++_0x19faba);}(_0x61d3,0x1e9));var _0x361d=function(_0x52542c,_0x1f9526){_0x52542c=_0x52542c-0x0;var _0x12c8f0=_0x61d3[_0x52542c];return _0x12c8f0;};'use strict';exports[_0x361d('0x0')]={'queue':{'type':_0x361d('0x1'),'required':!![]},'interface':{'type':_0x361d('0x1'),'required':!![]},'membername':{'type':_0x361d('0x1'),'required':!![]},'penalty':{'type':'number','required':![]},'paused':{'type':_0x361d('0x2'),'required':![]}};exports[_0x361d('0x3')]={'queue':{'type':_0x361d('0x1'),'required':!![]},'interface':{'type':_0x361d('0x1'),'required':!![]}};exports[_0x361d('0x4')]={'interface':{'type':_0x361d('0x1'),'required':!![]},'paused':{'type':_0x361d('0x2')},'reason':{'type':'string','required':![]}};exports[_0x361d('0x5')]={'module':{'type':_0x361d('0x1'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0x361d('0x1'),'required':!![]}};exports[_0x361d('0x6')]={'uniqueid':{'type':_0x361d('0x1'),'required':!![]},'filename':{'type':_0x361d('0x1')},'format':{'type':_0x361d('0x1')},'mixmonitorid':{'type':_0x361d('0x1')}};exports[_0x361d('0x7')]={'uniqueid':{'type':_0x361d('0x1'),'required':!![]}};exports[_0x361d('0x8')]={'uniqueid':{'type':_0x361d('0x1'),'required':!![]},'exten':{'type':_0x361d('0x1'),'required':!![]},'context':{'type':_0x361d('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 443cad4..bc5e932 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 _0xdb28=['initTriggers','triggers','initTemplates','initZendeskAccounts','zendeskAccounts','initFreshdeskAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','groupBy','uniqueid','queuecallerexit','queuecallerabandon','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','diff','queuecallercomplete','queuecallerleaveAt','initVoiceCallReports','outbound','duration','disposition','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initVoiceQueues','exports','lodash','moment','util','../model/agent','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','telephones','trunks','voiceQueues','campaigns','templates','voiceExtensions','channels','queueChannels','outboundChannels','timers','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','isNil','interface','sumDuration','sumBillable','isEmpty','ivrAnswerCallsDay','total','answered','unmanaged','abandoned','sumHoldTime','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','initAgents','agents','length','isUndefined','mergeFromDatabase','initTelephones','initTrunks'];(function(_0x136742,_0x4c876e){var _0x14c4bb=function(_0x2912b9){while(--_0x2912b9){_0x136742['push'](_0x136742['shift']());}};_0x14c4bb(++_0x4c876e);}(_0xdb28,0x106));var _0x8db2=function(_0x418715,_0x344d2e){_0x418715=_0x418715-0x0;var _0x39e4bb=_0xdb28[_0x418715];return _0x39e4bb;};'use strict';var _=require(_0x8db2('0x0'));var moment=require(_0x8db2('0x1'));var util=require(_0x8db2('0x2'));var Agent=require(_0x8db2('0x3'));var Telephone=require('../model/telephone');var Trunk=require(_0x8db2('0x4'));var VoiceQueue=require(_0x8db2('0x5'));var Trigger=require(_0x8db2('0x6'));var Template=require(_0x8db2('0x7'));var Campaign=require(_0x8db2('0x8'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x8db2('0x9'));var SalesforceAccount=require(_0x8db2('0xa'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0x8db2('0xb'));var DeskAccount=require(_0x8db2('0xc'));var VtigerAccount=require(_0x8db2('0xd'));var ServicenowAccount=require(_0x8db2('0xe'));var Dynamics365Account=require(_0x8db2('0xf'));var FreshsalesAccount=require(_0x8db2('0x10'));var FaxAccount=require(_0x8db2('0x11'));function Realtime(){this['agents']={};this[_0x8db2('0x12')]={};this[_0x8db2('0x13')]={};this[_0x8db2('0x14')]={};this['triggers']={};this[_0x8db2('0x15')]={};this[_0x8db2('0x16')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x8db2('0x17')]={};this[_0x8db2('0x18')]={};this[_0x8db2('0x19')]={};this[_0x8db2('0x1a')]={};this[_0x8db2('0x1b')]={};this['settings']={};this['zendeskAccounts']={};this[_0x8db2('0x1c')]={};this[_0x8db2('0x1d')]={};this[_0x8db2('0x1e')]={};this[_0x8db2('0x1f')]={};this[_0x8db2('0x20')]={};this[_0x8db2('0x21')]={};this[_0x8db2('0x22')]={};this[_0x8db2('0x23')]={};this[_0x8db2('0x24')]={};this[_0x8db2('0x25')]={};}function freeIsNotKey(_0x5489a9,_0x13b0f5,_0x24da1b){var _0x48101e=_[_0x8db2('0x26')](_0x5489a9,function(_0x44957d){return _0x44957d[_0x24da1b];});for(var _0x21db8c in _0x13b0f5){if(_0x13b0f5[_0x8db2('0x27')](_0x21db8c)){if(!_0x48101e[_0x21db8c]){delete _0x13b0f5[_0x21db8c];}}}}function freeIsNotKeySip(_0x2efd06,_0x46ce14){var _0x51d60d=_['mapKeys'](_0x2efd06,function(_0x77789){return util[_0x8db2('0x28')](_0x8db2('0x29'),_0x77789[_0x8db2('0x2a')]);});for(var _0x58562e in _0x46ce14){if(_0x46ce14[_0x8db2('0x27')](_0x58562e)){if(!_0x51d60d[_0x58562e]){delete _0x46ce14[_0x58562e];}}}}function freeIsNotKeyAgent(_0x36a9ff,_0x260940){var _0x297ba3=_[_0x8db2('0x26')](_0x36a9ff,function(_0x597260){var _0x124467=_[_0x8db2('0x2b')](_0x597260[_0x8db2('0x2c')])?util[_0x8db2('0x28')](_0x8db2('0x29'),_0x597260[_0x8db2('0x2a')]):_0x597260[_0x8db2('0x2c')];return _0x124467;});for(var _0x5c6614 in _0x260940){if(_0x260940[_0x8db2('0x27')](_0x5c6614)){if(!_0x297ba3[_0x5c6614]){delete _0x260940[_0x5c6614];}}}}function clearVoiceCallReports(_0x4f6516){_0x4f6516['total']=0x0;_0x4f6516['answered']=0x0;_0x4f6516['sumHoldTime']=0x0;_0x4f6516[_0x8db2('0x2d')]=0x0;_0x4f6516[_0x8db2('0x2e')]=0x0;}function clearCampaigns(_0x3be281){if(!_[_0x8db2('0x2f')](_0x3be281)){for(var _0x145328 in _0x3be281){if(_0x3be281[_0x8db2('0x27')](_0x145328)){_0x3be281[_0x145328]['ivrTotalCallsDays']=0x0;_0x3be281[_0x145328][_0x8db2('0x30')]=0x0;}}}}function clearVoiceQueues(_0x372311){if(!_[_0x8db2('0x2f')](_0x372311)){for(var _0x8b7cec in _0x372311){if(_0x372311['hasOwnProperty'](_0x8b7cec)){_0x372311[_0x8b7cec][_0x8db2('0x31')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x32')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x33')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x34')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x35')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x2d')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x2e')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x36')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x37')]=0x0;_0x372311[_0x8b7cec]['outboundBusyCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x38')]=0x0;_0x372311[_0x8b7cec]['outboundNoSuchCallsDay']=0x0;_0x372311[_0x8b7cec]['outboundUnknownCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x39')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3a')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3b')]=0x0;_0x372311[_0x8b7cec]['outboundOriginateFailureCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3c')]=0x0;_0x372311[_0x8b7cec]['outboundReCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x36')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3d')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3e')]=!![];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x35d337,_0x1a460b){for(var _0x4df530 in _0x1a460b){if(_0x35d337['hasOwnProperty'](_0x4df530)){_0x35d337[_0x4df530]=_0x1a460b[_0x4df530];}}};Realtime[_0x8db2('0x3f')][_0x8db2('0x40')]=function(){var _0xc884a=this;return function(_0x2a2d65){if(_0x2a2d65){freeIsNotKeyAgent(_0x2a2d65,_0xc884a[_0x8db2('0x41')]);for(var _0xd39848=0x0,_0x101711={};_0xd39848<_0x2a2d65[_0x8db2('0x42')];_0xd39848+=0x1){_0x101711=_0x2a2d65[_0xd39848];var _0x46e0c8=_[_0x8db2('0x2b')](_0x101711['interface'])?util[_0x8db2('0x28')](_0x8db2('0x29'),_0x101711['name']):_0x101711[_0x8db2('0x2c')];if(_[_0x8db2('0x43')](_0xc884a['agents'][_0x46e0c8])){_0xc884a['agents'][_0x46e0c8]=new Agent(_0x101711);}else{_0xc884a[_0x8db2('0x44')](_0xc884a['agents'][_0x46e0c8],_0x101711);}}}return _0xc884a[_0x8db2('0x41')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x45')]=function(){var _0x22c896=this;return function(_0x5cc419){if(_0x5cc419){freeIsNotKeySip(_0x5cc419,_0x22c896[_0x8db2('0x12')]);for(var _0x5e34e0=0x0,_0x227a08={};_0x5e34e0<_0x5cc419[_0x8db2('0x42')];_0x5e34e0+=0x1){_0x227a08=_0x5cc419[_0x5e34e0];if(_[_0x8db2('0x43')](_0x22c896[_0x8db2('0x12')][util['format']('SIP/%s',_0x227a08[_0x8db2('0x2a')])])){_0x22c896[_0x8db2('0x12')][util['format'](_0x8db2('0x29'),_0x227a08[_0x8db2('0x2a')])]=new Telephone(_0x227a08);}else{_0x22c896[_0x8db2('0x44')](_0x22c896['telephones'][util[_0x8db2('0x28')](_0x8db2('0x29'),_0x227a08[_0x8db2('0x2a')])],_0x227a08);}}}return _0x22c896[_0x8db2('0x12')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x46')]=function(){var _0x380046=this;return function(_0x1575ea){if(_0x1575ea){freeIsNotKeySip(_0x1575ea,_0x380046[_0x8db2('0x13')]);for(var _0x63c561=0x0,_0x21cf7c={};_0x63c561<_0x1575ea[_0x8db2('0x42')];_0x63c561+=0x1){_0x21cf7c=_0x1575ea[_0x63c561];if(_[_0x8db2('0x43')](_0x380046['trunks'][util[_0x8db2('0x28')](_0x8db2('0x29'),_0x21cf7c['name'])])){_0x380046['trunks'][util[_0x8db2('0x28')]('SIP/%s',_0x21cf7c[_0x8db2('0x2a')])]=new Trunk(_0x21cf7c);}else{_0x380046[_0x8db2('0x44')](_0x380046[_0x8db2('0x13')][util[_0x8db2('0x28')](_0x8db2('0x29'),_0x21cf7c[_0x8db2('0x2a')])],_0x21cf7c);}}}return _0x380046[_0x8db2('0x13')];};};Realtime['prototype'][_0x8db2('0x47')]=function(){var _0x3d44de=this;return function(_0x40c69e){if(_0x40c69e){freeIsNotKey(_0x40c69e,_0x3d44de[_0x8db2('0x48')],'id');for(var _0x482b26=0x0,_0x424c27={};_0x482b26<_0x40c69e[_0x8db2('0x42')];_0x482b26+=0x1){_0x424c27=_0x40c69e[_0x482b26];if(_[_0x8db2('0x43')](_0x3d44de[_0x8db2('0x48')][_0x424c27['id']])){_0x3d44de['triggers'][_0x424c27['id']]=new Trigger(_0x424c27);}else{_0x3d44de[_0x8db2('0x44')](_0x3d44de['triggers'][_0x424c27['id']],_0x424c27);}}}return _0x3d44de[_0x8db2('0x48')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x49')]=function(){var _0x4d2164=this;return function(_0x4b0e72){if(_0x4b0e72){freeIsNotKey(_0x4b0e72,_0x4d2164[_0x8db2('0x16')],'id');for(var _0x47c556=0x0,_0x173cc7={};_0x47c556<_0x4b0e72[_0x8db2('0x42')];_0x47c556+=0x1){_0x173cc7=_0x4b0e72[_0x47c556];if(_[_0x8db2('0x43')](_0x4d2164[_0x8db2('0x16')][_0x173cc7['id']])){_0x4d2164[_0x8db2('0x16')][_0x173cc7['id']]=new Template(_0x173cc7);}else{_0x4d2164[_0x8db2('0x44')](_0x4d2164[_0x8db2('0x16')][_0x173cc7['id']],_0x173cc7);}}}return _0x4d2164[_0x8db2('0x16')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4a')]=function(){var _0x1362ed=this;return function(_0x36f9d6){if(_0x36f9d6){freeIsNotKey(_0x36f9d6,_0x1362ed['zendeskAccounts'],'id');for(var _0x449109=0x0,_0x2ada52={};_0x449109<_0x36f9d6[_0x8db2('0x42')];_0x449109+=0x1){_0x2ada52=_0x36f9d6[_0x449109];if(_[_0x8db2('0x43')](_0x1362ed['zendeskAccounts'][_0x2ada52['id']])){_0x1362ed['zendeskAccounts'][_0x2ada52['id']]=new ZendeskAccount(_0x2ada52);}else{_0x1362ed[_0x8db2('0x44')](_0x1362ed[_0x8db2('0x4b')][_0x2ada52['id']],_0x2ada52);}}}return _0x1362ed[_0x8db2('0x4b')];};};Realtime['prototype']['initSalesforceAccounts']=function(){var _0x494d6e=this;return function(_0x44ac56){if(_0x44ac56){freeIsNotKey(_0x44ac56,_0x494d6e[_0x8db2('0x1c')],'id');for(var _0x55c7dd=0x0,_0x383fa1={};_0x55c7dd<_0x44ac56[_0x8db2('0x42')];_0x55c7dd+=0x1){_0x383fa1=_0x44ac56[_0x55c7dd];if(_[_0x8db2('0x43')](_0x494d6e[_0x8db2('0x1c')][_0x383fa1['id']])){_0x494d6e['salesforceAccounts'][_0x383fa1['id']]=new SalesforceAccount(_0x383fa1);}else{_0x494d6e['mergeFromDatabase'](_0x494d6e[_0x8db2('0x1c')][_0x383fa1['id']],_0x383fa1);}}}return _0x494d6e[_0x8db2('0x1c')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4c')]=function(){var _0x3daed6=this;return function(_0x2bf408){if(_0x2bf408){freeIsNotKey(_0x2bf408,_0x3daed6[_0x8db2('0x1e')],'id');for(var _0x3ca2a7=0x0,_0x4187d6={};_0x3ca2a7<_0x2bf408[_0x8db2('0x42')];_0x3ca2a7+=0x1){_0x4187d6=_0x2bf408[_0x3ca2a7];if(_[_0x8db2('0x43')](_0x3daed6[_0x8db2('0x1e')][_0x4187d6['id']])){_0x3daed6[_0x8db2('0x1e')][_0x4187d6['id']]=new FreshdeskAccount(_0x4187d6);}else{_0x3daed6[_0x8db2('0x44')](_0x3daed6[_0x8db2('0x1e')][_0x4187d6['id']],_0x4187d6);}}}return _0x3daed6['freshdeskAccounts'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4d')]=function(){var _0x579317=this;return function(_0x27b644){if(_0x27b644){freeIsNotKey(_0x27b644,_0x579317[_0x8db2('0x1f')],'id');for(var _0x3af298=0x0,_0x547215={};_0x3af298<_0x27b644[_0x8db2('0x42')];_0x3af298+=0x1){_0x547215=_0x27b644[_0x3af298];if(_[_0x8db2('0x43')](_0x579317[_0x8db2('0x1f')][_0x547215['id']])){_0x579317[_0x8db2('0x1f')][_0x547215['id']]=new ZohoAccount(_0x547215);}else{_0x579317[_0x8db2('0x44')](_0x579317['zohoAccounts'][_0x547215['id']],_0x547215);}}}return _0x579317[_0x8db2('0x1f')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4e')]=function(){var _0x58bb60=this;return function(_0x1e7d1a){if(_0x1e7d1a){freeIsNotKey(_0x1e7d1a,_0x58bb60[_0x8db2('0x20')],'id');for(var _0x33dddd=0x0,_0x7b0de8={};_0x33dddd<_0x1e7d1a[_0x8db2('0x42')];_0x33dddd+=0x1){_0x7b0de8=_0x1e7d1a[_0x33dddd];if(_[_0x8db2('0x43')](_0x58bb60[_0x8db2('0x20')][_0x7b0de8['id']])){_0x58bb60['deskAccounts'][_0x7b0de8['id']]=new DeskAccount(_0x7b0de8);}else{_0x58bb60[_0x8db2('0x44')](_0x58bb60[_0x8db2('0x20')][_0x7b0de8['id']],_0x7b0de8);}}}return _0x58bb60['deskAccounts'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4f')]=function(){var _0x533e41=this;return function(_0x107bbe){if(_0x107bbe){freeIsNotKey(_0x107bbe,_0x533e41[_0x8db2('0x1d')],'id');for(var _0x63e8f7=0x0,_0x30f4f3={};_0x63e8f7<_0x107bbe[_0x8db2('0x42')];_0x63e8f7+=0x1){_0x30f4f3=_0x107bbe[_0x63e8f7];if(_[_0x8db2('0x43')](_0x533e41[_0x8db2('0x1d')][_0x30f4f3['id']])){_0x533e41[_0x8db2('0x1d')][_0x30f4f3['id']]=new SugarcrmAccount(_0x30f4f3);}else{_0x533e41[_0x8db2('0x44')](_0x533e41[_0x8db2('0x1d')][_0x30f4f3['id']],_0x30f4f3);}}}return _0x533e41[_0x8db2('0x1d')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x50')]=function(){var _0x1ce89f=this;return function(_0x64ec90){if(_0x64ec90){freeIsNotKey(_0x64ec90,_0x1ce89f[_0x8db2('0x21')],'id');for(var _0x4a20a7=0x0,_0xe0c3e={};_0x4a20a7<_0x64ec90[_0x8db2('0x42')];_0x4a20a7+=0x1){_0xe0c3e=_0x64ec90[_0x4a20a7];if(_[_0x8db2('0x43')](_0x1ce89f[_0x8db2('0x21')][_0xe0c3e['id']])){_0x1ce89f[_0x8db2('0x21')][_0xe0c3e['id']]=new VtigerAccount(_0xe0c3e);}else{_0x1ce89f['mergeFromDatabase'](_0x1ce89f[_0x8db2('0x21')][_0xe0c3e['id']],_0xe0c3e);}}}return _0x1ce89f[_0x8db2('0x21')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x51')]=function(){var _0x2ad70f=this;return function(_0x348da8){if(_0x348da8){freeIsNotKey(_0x348da8,_0x2ad70f[_0x8db2('0x22')],'id');for(var _0x2c7b04=0x0,_0x24cfe9={};_0x2c7b04<_0x348da8[_0x8db2('0x42')];_0x2c7b04+=0x1){_0x24cfe9=_0x348da8[_0x2c7b04];if(_[_0x8db2('0x43')](_0x2ad70f[_0x8db2('0x22')][_0x24cfe9['id']])){_0x2ad70f[_0x8db2('0x22')][_0x24cfe9['id']]=new ServicenowAccount(_0x24cfe9);}else{_0x2ad70f[_0x8db2('0x44')](_0x2ad70f[_0x8db2('0x22')][_0x24cfe9['id']],_0x24cfe9);}}}return _0x2ad70f[_0x8db2('0x22')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x52')]=function(){var _0x5a719f=this;return function(_0x3273dd){if(_0x3273dd){freeIsNotKey(_0x3273dd,_0x5a719f['dynamics365Accounts'],'id');for(var _0x364176=0x0,_0x570c53={};_0x364176<_0x3273dd[_0x8db2('0x42')];_0x364176+=0x1){_0x570c53=_0x3273dd[_0x364176];if(_[_0x8db2('0x43')](_0x5a719f[_0x8db2('0x23')][_0x570c53['id']])){_0x5a719f[_0x8db2('0x23')][_0x570c53['id']]=new Dynamics365Account(_0x570c53);}else{_0x5a719f[_0x8db2('0x44')](_0x5a719f['dynamics365Accounts'][_0x570c53['id']],_0x570c53);}}}return _0x5a719f['dynamics365Accounts'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x53')]=function(){var _0x21ec87=this;return function(_0x3ba1d2){if(_0x3ba1d2){freeIsNotKey(_0x3ba1d2,_0x21ec87[_0x8db2('0x24')],'id');for(var _0x1f28d2=0x0,_0x3e3de3={};_0x1f28d2<_0x3ba1d2[_0x8db2('0x42')];_0x1f28d2+=0x1){_0x3e3de3=_0x3ba1d2[_0x1f28d2];if(_['isUndefined'](_0x21ec87[_0x8db2('0x24')][_0x3e3de3['id']])){_0x21ec87[_0x8db2('0x24')][_0x3e3de3['id']]=new FreshsalesAccount(_0x3e3de3);}else{_0x21ec87[_0x8db2('0x44')](_0x21ec87[_0x8db2('0x24')][_0x3e3de3['id']],_0x3e3de3);}}}return _0x21ec87[_0x8db2('0x24')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x54')]=function(){var _0x20caf0=this;return function(_0x4938bb){for(var _0x54318c=0x0;_0x54318c<_0x4938bb[_0x8db2('0x42')];_0x54318c+=0x1){_[_0x8db2('0x55')](_0x20caf0[_0x8db2('0x14')][_0x4938bb[_0x54318c][_0x8db2('0x2a')]],_0x4938bb[_0x54318c]);}return _0x20caf0[_0x8db2('0x14')];};};Realtime['prototype']['initVoiceQueueReports']=function(){var _0x3611da=this;return function(_0x364807){clearVoiceQueues(_0x3611da['voiceQueues']);if(_0x364807){_0x364807=_[_0x8db2('0x56')](_0x364807,_0x8db2('0x57'));for(var _0x1ab84c in _0x364807){if(_0x364807['hasOwnProperty'](_0x1ab84c)){for(var _0x26523b=0x0;_0x26523b<_0x364807[_0x1ab84c][_0x8db2('0x42')];_0x26523b+=0x1){var _0x2cf731=_0x364807[_0x1ab84c][_0x26523b]['queue'];if(_0x3611da[_0x8db2('0x14')][_0x2cf731]){if(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x58')]){_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x33')]+=0x1;}if(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x59')]){_0x3611da['voiceQueues'][_0x2cf731][_0x8db2('0x34')]+=0x1;}_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x35')]+=moment(_0x364807[_0x1ab84c][_0x26523b]['queuecallerleaveAt'])['diff'](moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5a')]),_0x8db2('0x5b'))||0x0;if(_0x26523b===_0x364807[_0x1ab84c]['length']-0x1){_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x2d')]+=moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5c')]||_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5d')]||_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5e')])[_0x8db2('0x5f')](moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5a')]),_0x8db2('0x5b'))||0x0;_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x31')]+=0x1;if(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x60')]){_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x32')]+=0x1;_0x3611da['voiceQueues'][_0x2cf731][_0x8db2('0x2e')]+=moment(_0x364807[_0x1ab84c][_0x26523b]['queuecallercompleteAt'])[_0x8db2('0x5f')](moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x61')]),'seconds')||0x0;}}else{_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x2d')]+=_0x3611da['voiceQueues'][_0x2cf731][_0x8db2('0x35')]||0x0;}}}}}}return _0x3611da[_0x8db2('0x14')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x62')]=function(){var _0x242379=this;return function(_0x31a095){clearVoiceCallReports(_0x242379[_0x8db2('0x63')]);if(_0x31a095){for(var _0x3ac0fa=0x0;_0x3ac0fa<_0x31a095[_0x8db2('0x42')];_0x3ac0fa+=0x1){_0x242379['outbound']['total']+=0x1;_0x242379[_0x8db2('0x63')]['sumDuration']+=_0x31a095[_0x3ac0fa][_0x8db2('0x64')];if(_0x31a095[_0x3ac0fa][_0x8db2('0x65')]===_0x8db2('0x66')){_0x242379['outbound'][_0x8db2('0x32')]+=0x1;_0x242379[_0x8db2('0x63')][_0x8db2('0x35')]+=_0x31a095[_0x3ac0fa]['duration']-_0x31a095[_0x3ac0fa][_0x8db2('0x67')]||0x0;_0x242379[_0x8db2('0x63')][_0x8db2('0x2e')]+=_0x31a095[_0x3ac0fa][_0x8db2('0x67')];}}}return _0x242379['outbound'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x68')]=function(){var _0x299640=this;return function(_0x1edb1a){if(_0x1edb1a){freeIsNotKey(_0x1edb1a,_0x299640[_0x8db2('0x15')],_0x8db2('0x2a'));for(var _0x1aadfb=0x0,_0x3682bf={};_0x1aadfb<_0x1edb1a[_0x8db2('0x42')];_0x1aadfb+=0x1){_0x3682bf=_0x1edb1a[_0x1aadfb];if(_[_0x8db2('0x43')](_0x299640[_0x8db2('0x15')][_0x3682bf['name']])){_0x299640[_0x8db2('0x15')][_0x3682bf[_0x8db2('0x2a')]]=new Campaign(_0x3682bf);}else{_0x299640[_0x8db2('0x44')](_0x299640['campaigns'][_0x3682bf['name']],_0x3682bf);_0x299640['campaigns'][_0x3682bf[_0x8db2('0x2a')]][_0x8db2('0x69')]=_0x3682bf[_0x8db2('0x6a')]?_0x3682bf[_0x8db2('0x6a')][_0x8db2('0x2a')]:undefined;}}}return _0x299640[_0x8db2('0x15')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x6b')]=function(){var _0x3b1929=this;return function(_0x37cf6d){if(_0x37cf6d){freeIsNotKey(_0x37cf6d,_0x3b1929[_0x8db2('0x17')],'id');for(var _0x4d0ff6=0x0,_0x360a06={};_0x4d0ff6<_0x37cf6d[_0x8db2('0x42')];_0x4d0ff6+=0x1){_0x360a06=_0x37cf6d[_0x4d0ff6];if(_[_0x8db2('0x43')](_0x3b1929[_0x8db2('0x17')][_0x360a06['id']])){_0x3b1929['voiceExtensions'][_0x360a06['id']]=new VoiceExtension(_0x360a06);}else{_0x3b1929['mergeFromDatabase'](_0x3b1929[_0x8db2('0x17')][_0x360a06['id']],_0x360a06);}}}return _0x3b1929[_0x8db2('0x17')];};};Realtime['prototype'][_0x8db2('0x6c')]=function(){var _0x121f31=this;return function(_0x9132b4){clearCampaigns(_0x121f31['campaigns']);for(var _0x5dc46c=0x0;_0x5dc46c<_0x9132b4['length'];_0x5dc46c+=0x1){_[_0x8db2('0x55')](_0x121f31[_0x8db2('0x15')][_0x9132b4[_0x5dc46c][_0x8db2('0x2a')]],_0x9132b4[_0x5dc46c]);}return _0x121f31[_0x8db2('0x15')];};};Realtime[_0x8db2('0x3f')]['initFaxAccounts']=function(){var _0x30930a=this;return function(_0x5e349c){if(_0x5e349c){freeIsNotKey(_0x5e349c,_0x30930a[_0x8db2('0x25')],'id');for(var _0x353101=0x0,_0xa083b1={};_0x353101<_0x5e349c[_0x8db2('0x42')];_0x353101+=0x1){_0xa083b1=_0x5e349c[_0x353101];if(_[_0x8db2('0x43')](_0x30930a['faxAccounts'][_0xa083b1['id']])){_0x30930a['faxAccounts'][_0xa083b1['id']]=new FaxAccount(_0xa083b1);}else{_0x30930a[_0x8db2('0x44')](_0x30930a['faxAccounts'][_0xa083b1['id']],_0xa083b1);}}}return _0x30930a[_0x8db2('0x25')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x6d')]=function(){var _0x1e7bc2=this;return function(_0x2b7224){if(_0x2b7224){freeIsNotKey(_0x2b7224,_0x1e7bc2[_0x8db2('0x14')],'name');for(var _0x19f9a0=0x0,_0x222ea2={};_0x19f9a0<_0x2b7224[_0x8db2('0x42')];_0x19f9a0+=0x1){_0x222ea2=_0x2b7224[_0x19f9a0];if(_['isUndefined'](_0x1e7bc2[_0x8db2('0x14')][_0x222ea2[_0x8db2('0x2a')]])){_0x1e7bc2['voiceQueues'][_0x222ea2[_0x8db2('0x2a')]]=new VoiceQueue(_0x222ea2);}else{_0x1e7bc2[_0x8db2('0x44')](_0x1e7bc2[_0x8db2('0x14')][_0x222ea2[_0x8db2('0x2a')]],_0x222ea2);}}}return _0x1e7bc2[_0x8db2('0x14')];};};module[_0x8db2('0x6e')]=Realtime; \ No newline at end of file +var _0x5f2f=['initCampaignHopperHistory','merge','initFaxAccounts','initVoiceQueues','exports','lodash','moment','util','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/faxAccount','agents','telephones','voiceQueues','templates','outbound','channels','queueChannels','outboundChannels','timers','settings','zendeskAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','name','isNil','interface','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','total','answered','unmanaged','outboundAnswerAgiCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundRejectCallsDay','queueStatusComplete','prototype','mergeFromDatabase','length','isUndefined','initTelephones','SIP/%s','trunks','initTriggers','triggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','salesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','servicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','abandoned','queuecallerleaveAt','diff','seconds','queuecallercompleteAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','initCampaigns','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','voiceExtensions'];(function(_0x1b0da1,_0x501aa6){var _0x19aeb5=function(_0x3334fa){while(--_0x3334fa){_0x1b0da1['push'](_0x1b0da1['shift']());}};_0x19aeb5(++_0x501aa6);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4ee754,_0x503c21){_0x4ee754=_0x4ee754-0x0;var _0x61d356=_0x5f2f[_0x4ee754];return _0x61d356;};'use strict';var _=require(_0xf5f2('0x0'));var moment=require(_0xf5f2('0x1'));var util=require(_0xf5f2('0x2'));var Agent=require(_0xf5f2('0x3'));var Telephone=require(_0xf5f2('0x4'));var Trunk=require(_0xf5f2('0x5'));var VoiceQueue=require(_0xf5f2('0x6'));var Trigger=require(_0xf5f2('0x7'));var Template=require('../model/template');var Campaign=require('../model/campaign');var VoiceExtension=require(_0xf5f2('0x8'));var ZendeskAccount=require(_0xf5f2('0x9'));var SalesforceAccount=require(_0xf5f2('0xa'));var FreshdeskAccount=require(_0xf5f2('0xb'));var SugarcrmAccount=require(_0xf5f2('0xc'));var ZohoAccount=require(_0xf5f2('0xd'));var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0xf5f2('0xe'));var ServicenowAccount=require(_0xf5f2('0xf'));var Dynamics365Account=require(_0xf5f2('0x10'));var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0xf5f2('0x11'));function Realtime(){this[_0xf5f2('0x12')]={};this[_0xf5f2('0x13')]={};this['trunks']={};this[_0xf5f2('0x14')]={};this['triggers']={};this['campaigns']={};this[_0xf5f2('0x15')]={};this[_0xf5f2('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0xf5f2('0x17')]={};this[_0xf5f2('0x18')]={};this[_0xf5f2('0x19')]={};this[_0xf5f2('0x1a')]={};this[_0xf5f2('0x1b')]={};this[_0xf5f2('0x1c')]={};this['salesforceAccounts']={};this[_0xf5f2('0x1d')]={};this[_0xf5f2('0x1e')]={};this[_0xf5f2('0x1f')]={};this[_0xf5f2('0x20')]={};this[_0xf5f2('0x21')]={};this['servicenowAccounts']={};this[_0xf5f2('0x22')]={};this[_0xf5f2('0x23')]={};this[_0xf5f2('0x24')]={};}function freeIsNotKey(_0x1b6dd2,_0x23e23a,_0x3a9dbb){var _0xdb61b3=_[_0xf5f2('0x25')](_0x1b6dd2,function(_0x11f702){return _0x11f702[_0x3a9dbb];});for(var _0x228ace in _0x23e23a){if(_0x23e23a[_0xf5f2('0x26')](_0x228ace)){if(!_0xdb61b3[_0x228ace]){delete _0x23e23a[_0x228ace];}}}}function freeIsNotKeySip(_0x28e097,_0x4ff59b){var _0x3ee69=_[_0xf5f2('0x25')](_0x28e097,function(_0x626999){return util[_0xf5f2('0x27')]('SIP/%s',_0x626999[_0xf5f2('0x28')]);});for(var _0x47101e in _0x4ff59b){if(_0x4ff59b['hasOwnProperty'](_0x47101e)){if(!_0x3ee69[_0x47101e]){delete _0x4ff59b[_0x47101e];}}}}function freeIsNotKeyAgent(_0x47acfc,_0x2d2805){var _0x388e6c=_['mapKeys'](_0x47acfc,function(_0x45b74f){var _0x170042=_[_0xf5f2('0x29')](_0x45b74f[_0xf5f2('0x2a')])?util[_0xf5f2('0x27')]('SIP/%s',_0x45b74f[_0xf5f2('0x28')]):_0x45b74f[_0xf5f2('0x2a')];return _0x170042;});for(var _0x4e8bda in _0x2d2805){if(_0x2d2805[_0xf5f2('0x26')](_0x4e8bda)){if(!_0x388e6c[_0x4e8bda]){delete _0x2d2805[_0x4e8bda];}}}}function clearVoiceCallReports(_0x287ad5){_0x287ad5['total']=0x0;_0x287ad5['answered']=0x0;_0x287ad5[_0xf5f2('0x2b')]=0x0;_0x287ad5[_0xf5f2('0x2c')]=0x0;_0x287ad5[_0xf5f2('0x2d')]=0x0;}function clearCampaigns(_0x1a5bb3){if(!_[_0xf5f2('0x2e')](_0x1a5bb3)){for(var _0x788a8d in _0x1a5bb3){if(_0x1a5bb3[_0xf5f2('0x26')](_0x788a8d)){_0x1a5bb3[_0x788a8d][_0xf5f2('0x2f')]=0x0;_0x1a5bb3[_0x788a8d][_0xf5f2('0x30')]=0x0;}}}}function clearVoiceQueues(_0x4ab014){if(!_[_0xf5f2('0x2e')](_0x4ab014)){for(var _0x102449 in _0x4ab014){if(_0x4ab014[_0xf5f2('0x26')](_0x102449)){_0x4ab014[_0x102449][_0xf5f2('0x31')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x32')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x33')]=0x0;_0x4ab014[_0x102449]['abandoned']=0x0;_0x4ab014[_0x102449]['sumHoldTime']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x2c')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x2d')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x34')]=0x0;_0x4ab014[_0x102449]['outboundNoAnswerCallsDay']=0x0;_0x4ab014[_0x102449]['outboundBusyCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x35')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x36')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x37')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x38')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x39')]=0x0;_0x4ab014[_0x102449]['outboundBlacklistCallsDay']=0x0;_0x4ab014[_0x102449]['outboundOriginateFailureCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x3a')]=0x0;_0x4ab014[_0x102449]['outboundReCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x34')]=0x0;_0x4ab014[_0x102449]['outboundAnswerCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x3b')]=!![];}}}}Realtime[_0xf5f2('0x3c')][_0xf5f2('0x3d')]=function(_0x428770,_0x256bd9){for(var _0x277eee in _0x256bd9){if(_0x428770[_0xf5f2('0x26')](_0x277eee)){_0x428770[_0x277eee]=_0x256bd9[_0x277eee];}}};Realtime[_0xf5f2('0x3c')]['initAgents']=function(){var _0x4149e6=this;return function(_0x43e4ff){if(_0x43e4ff){freeIsNotKeyAgent(_0x43e4ff,_0x4149e6[_0xf5f2('0x12')]);for(var _0x43c77d=0x0,_0x1408b9={};_0x43c77d<_0x43e4ff[_0xf5f2('0x3e')];_0x43c77d+=0x1){_0x1408b9=_0x43e4ff[_0x43c77d];var _0x297c0c=_['isNil'](_0x1408b9[_0xf5f2('0x2a')])?util[_0xf5f2('0x27')]('SIP/%s',_0x1408b9[_0xf5f2('0x28')]):_0x1408b9['interface'];if(_[_0xf5f2('0x3f')](_0x4149e6[_0xf5f2('0x12')][_0x297c0c])){_0x4149e6[_0xf5f2('0x12')][_0x297c0c]=new Agent(_0x1408b9);}else{_0x4149e6[_0xf5f2('0x3d')](_0x4149e6['agents'][_0x297c0c],_0x1408b9);}}}return _0x4149e6['agents'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x40')]=function(){var _0x20eb74=this;return function(_0x4ec8fb){if(_0x4ec8fb){freeIsNotKeySip(_0x4ec8fb,_0x20eb74[_0xf5f2('0x13')]);for(var _0x4f7f80=0x0,_0x9da533={};_0x4f7f80<_0x4ec8fb['length'];_0x4f7f80+=0x1){_0x9da533=_0x4ec8fb[_0x4f7f80];if(_[_0xf5f2('0x3f')](_0x20eb74[_0xf5f2('0x13')][util['format'](_0xf5f2('0x41'),_0x9da533[_0xf5f2('0x28')])])){_0x20eb74[_0xf5f2('0x13')][util[_0xf5f2('0x27')]('SIP/%s',_0x9da533['name'])]=new Telephone(_0x9da533);}else{_0x20eb74[_0xf5f2('0x3d')](_0x20eb74[_0xf5f2('0x13')][util[_0xf5f2('0x27')](_0xf5f2('0x41'),_0x9da533[_0xf5f2('0x28')])],_0x9da533);}}}return _0x20eb74[_0xf5f2('0x13')];};};Realtime[_0xf5f2('0x3c')]['initTrunks']=function(){var _0x110fe5=this;return function(_0x3b4ea6){if(_0x3b4ea6){freeIsNotKeySip(_0x3b4ea6,_0x110fe5['trunks']);for(var _0xc6a1ae=0x0,_0x3f3895={};_0xc6a1ae<_0x3b4ea6[_0xf5f2('0x3e')];_0xc6a1ae+=0x1){_0x3f3895=_0x3b4ea6[_0xc6a1ae];if(_[_0xf5f2('0x3f')](_0x110fe5[_0xf5f2('0x42')][util[_0xf5f2('0x27')](_0xf5f2('0x41'),_0x3f3895[_0xf5f2('0x28')])])){_0x110fe5['trunks'][util[_0xf5f2('0x27')](_0xf5f2('0x41'),_0x3f3895[_0xf5f2('0x28')])]=new Trunk(_0x3f3895);}else{_0x110fe5['mergeFromDatabase'](_0x110fe5['trunks'][util['format'](_0xf5f2('0x41'),_0x3f3895[_0xf5f2('0x28')])],_0x3f3895);}}}return _0x110fe5['trunks'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x43')]=function(){var _0x28e33f=this;return function(_0x31f86c){if(_0x31f86c){freeIsNotKey(_0x31f86c,_0x28e33f[_0xf5f2('0x44')],'id');for(var _0x2b3b1c=0x0,_0x1a6ec1={};_0x2b3b1c<_0x31f86c[_0xf5f2('0x3e')];_0x2b3b1c+=0x1){_0x1a6ec1=_0x31f86c[_0x2b3b1c];if(_[_0xf5f2('0x3f')](_0x28e33f[_0xf5f2('0x44')][_0x1a6ec1['id']])){_0x28e33f[_0xf5f2('0x44')][_0x1a6ec1['id']]=new Trigger(_0x1a6ec1);}else{_0x28e33f[_0xf5f2('0x3d')](_0x28e33f[_0xf5f2('0x44')][_0x1a6ec1['id']],_0x1a6ec1);}}}return _0x28e33f[_0xf5f2('0x44')];};};Realtime['prototype'][_0xf5f2('0x45')]=function(){var _0x578c93=this;return function(_0x3d62c1){if(_0x3d62c1){freeIsNotKey(_0x3d62c1,_0x578c93[_0xf5f2('0x15')],'id');for(var _0x218def=0x0,_0x36a4b0={};_0x218def<_0x3d62c1[_0xf5f2('0x3e')];_0x218def+=0x1){_0x36a4b0=_0x3d62c1[_0x218def];if(_[_0xf5f2('0x3f')](_0x578c93['templates'][_0x36a4b0['id']])){_0x578c93[_0xf5f2('0x15')][_0x36a4b0['id']]=new Template(_0x36a4b0);}else{_0x578c93[_0xf5f2('0x3d')](_0x578c93[_0xf5f2('0x15')][_0x36a4b0['id']],_0x36a4b0);}}}return _0x578c93[_0xf5f2('0x15')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x46')]=function(){var _0xf638ff=this;return function(_0x297f07){if(_0x297f07){freeIsNotKey(_0x297f07,_0xf638ff['zendeskAccounts'],'id');for(var _0x35dece=0x0,_0x33ec29={};_0x35dece<_0x297f07[_0xf5f2('0x3e')];_0x35dece+=0x1){_0x33ec29=_0x297f07[_0x35dece];if(_['isUndefined'](_0xf638ff[_0xf5f2('0x1c')][_0x33ec29['id']])){_0xf638ff[_0xf5f2('0x1c')][_0x33ec29['id']]=new ZendeskAccount(_0x33ec29);}else{_0xf638ff[_0xf5f2('0x3d')](_0xf638ff['zendeskAccounts'][_0x33ec29['id']],_0x33ec29);}}}return _0xf638ff['zendeskAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x47')]=function(){var _0x5db519=this;return function(_0x14aa81){if(_0x14aa81){freeIsNotKey(_0x14aa81,_0x5db519['salesforceAccounts'],'id');for(var _0x740321=0x0,_0x497eb8={};_0x740321<_0x14aa81[_0xf5f2('0x3e')];_0x740321+=0x1){_0x497eb8=_0x14aa81[_0x740321];if(_['isUndefined'](_0x5db519[_0xf5f2('0x48')][_0x497eb8['id']])){_0x5db519[_0xf5f2('0x48')][_0x497eb8['id']]=new SalesforceAccount(_0x497eb8);}else{_0x5db519[_0xf5f2('0x3d')](_0x5db519[_0xf5f2('0x48')][_0x497eb8['id']],_0x497eb8);}}}return _0x5db519['salesforceAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x49')]=function(){var _0x4f6b01=this;return function(_0x58213b){if(_0x58213b){freeIsNotKey(_0x58213b,_0x4f6b01[_0xf5f2('0x1e')],'id');for(var _0x3dc0c4=0x0,_0x57782c={};_0x3dc0c4<_0x58213b[_0xf5f2('0x3e')];_0x3dc0c4+=0x1){_0x57782c=_0x58213b[_0x3dc0c4];if(_[_0xf5f2('0x3f')](_0x4f6b01[_0xf5f2('0x1e')][_0x57782c['id']])){_0x4f6b01[_0xf5f2('0x1e')][_0x57782c['id']]=new FreshdeskAccount(_0x57782c);}else{_0x4f6b01['mergeFromDatabase'](_0x4f6b01['freshdeskAccounts'][_0x57782c['id']],_0x57782c);}}}return _0x4f6b01[_0xf5f2('0x1e')];};};Realtime[_0xf5f2('0x3c')]['initZohoAccounts']=function(){var _0x40eef=this;return function(_0x43fc49){if(_0x43fc49){freeIsNotKey(_0x43fc49,_0x40eef[_0xf5f2('0x1f')],'id');for(var _0x14029e=0x0,_0x2b038e={};_0x14029e<_0x43fc49[_0xf5f2('0x3e')];_0x14029e+=0x1){_0x2b038e=_0x43fc49[_0x14029e];if(_[_0xf5f2('0x3f')](_0x40eef['zohoAccounts'][_0x2b038e['id']])){_0x40eef['zohoAccounts'][_0x2b038e['id']]=new ZohoAccount(_0x2b038e);}else{_0x40eef[_0xf5f2('0x3d')](_0x40eef[_0xf5f2('0x1f')][_0x2b038e['id']],_0x2b038e);}}}return _0x40eef[_0xf5f2('0x1f')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x4a')]=function(){var _0x5a861d=this;return function(_0xdb1106){if(_0xdb1106){freeIsNotKey(_0xdb1106,_0x5a861d[_0xf5f2('0x20')],'id');for(var _0x18b124=0x0,_0x519c24={};_0x18b124<_0xdb1106[_0xf5f2('0x3e')];_0x18b124+=0x1){_0x519c24=_0xdb1106[_0x18b124];if(_['isUndefined'](_0x5a861d[_0xf5f2('0x20')][_0x519c24['id']])){_0x5a861d[_0xf5f2('0x20')][_0x519c24['id']]=new DeskAccount(_0x519c24);}else{_0x5a861d[_0xf5f2('0x3d')](_0x5a861d[_0xf5f2('0x20')][_0x519c24['id']],_0x519c24);}}}return _0x5a861d['deskAccounts'];};};Realtime['prototype'][_0xf5f2('0x4b')]=function(){var _0x4de303=this;return function(_0xa39c65){if(_0xa39c65){freeIsNotKey(_0xa39c65,_0x4de303[_0xf5f2('0x1d')],'id');for(var _0x572ec1=0x0,_0x3f0579={};_0x572ec1<_0xa39c65[_0xf5f2('0x3e')];_0x572ec1+=0x1){_0x3f0579=_0xa39c65[_0x572ec1];if(_[_0xf5f2('0x3f')](_0x4de303['sugarcrmAccounts'][_0x3f0579['id']])){_0x4de303[_0xf5f2('0x1d')][_0x3f0579['id']]=new SugarcrmAccount(_0x3f0579);}else{_0x4de303[_0xf5f2('0x3d')](_0x4de303[_0xf5f2('0x1d')][_0x3f0579['id']],_0x3f0579);}}}return _0x4de303[_0xf5f2('0x1d')];};};Realtime['prototype'][_0xf5f2('0x4c')]=function(){var _0x506fe5=this;return function(_0x2cbe1e){if(_0x2cbe1e){freeIsNotKey(_0x2cbe1e,_0x506fe5[_0xf5f2('0x21')],'id');for(var _0x2e6f5d=0x0,_0x380c08={};_0x2e6f5d<_0x2cbe1e[_0xf5f2('0x3e')];_0x2e6f5d+=0x1){_0x380c08=_0x2cbe1e[_0x2e6f5d];if(_['isUndefined'](_0x506fe5[_0xf5f2('0x21')][_0x380c08['id']])){_0x506fe5[_0xf5f2('0x21')][_0x380c08['id']]=new VtigerAccount(_0x380c08);}else{_0x506fe5[_0xf5f2('0x3d')](_0x506fe5[_0xf5f2('0x21')][_0x380c08['id']],_0x380c08);}}}return _0x506fe5[_0xf5f2('0x21')];};};Realtime['prototype'][_0xf5f2('0x4d')]=function(){var _0x5ee6bc=this;return function(_0x4c96ee){if(_0x4c96ee){freeIsNotKey(_0x4c96ee,_0x5ee6bc[_0xf5f2('0x4e')],'id');for(var _0x4802c5=0x0,_0x10f2b8={};_0x4802c5<_0x4c96ee[_0xf5f2('0x3e')];_0x4802c5+=0x1){_0x10f2b8=_0x4c96ee[_0x4802c5];if(_[_0xf5f2('0x3f')](_0x5ee6bc[_0xf5f2('0x4e')][_0x10f2b8['id']])){_0x5ee6bc['servicenowAccounts'][_0x10f2b8['id']]=new ServicenowAccount(_0x10f2b8);}else{_0x5ee6bc[_0xf5f2('0x3d')](_0x5ee6bc[_0xf5f2('0x4e')][_0x10f2b8['id']],_0x10f2b8);}}}return _0x5ee6bc[_0xf5f2('0x4e')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x4f')]=function(){var _0x35d868=this;return function(_0x158768){if(_0x158768){freeIsNotKey(_0x158768,_0x35d868['dynamics365Accounts'],'id');for(var _0x1f55af=0x0,_0x2d171d={};_0x1f55af<_0x158768[_0xf5f2('0x3e')];_0x1f55af+=0x1){_0x2d171d=_0x158768[_0x1f55af];if(_[_0xf5f2('0x3f')](_0x35d868['dynamics365Accounts'][_0x2d171d['id']])){_0x35d868[_0xf5f2('0x22')][_0x2d171d['id']]=new Dynamics365Account(_0x2d171d);}else{_0x35d868['mergeFromDatabase'](_0x35d868[_0xf5f2('0x22')][_0x2d171d['id']],_0x2d171d);}}}return _0x35d868[_0xf5f2('0x22')];};};Realtime['prototype'][_0xf5f2('0x50')]=function(){var _0x975bd8=this;return function(_0xa0c139){if(_0xa0c139){freeIsNotKey(_0xa0c139,_0x975bd8[_0xf5f2('0x23')],'id');for(var _0x146462=0x0,_0x4bd113={};_0x146462<_0xa0c139[_0xf5f2('0x3e')];_0x146462+=0x1){_0x4bd113=_0xa0c139[_0x146462];if(_[_0xf5f2('0x3f')](_0x975bd8[_0xf5f2('0x23')][_0x4bd113['id']])){_0x975bd8[_0xf5f2('0x23')][_0x4bd113['id']]=new FreshsalesAccount(_0x4bd113);}else{_0x975bd8[_0xf5f2('0x3d')](_0x975bd8[_0xf5f2('0x23')][_0x4bd113['id']],_0x4bd113);}}}return _0x975bd8['freshsalesAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x51')]=function(){var _0x4800fe=this;return function(_0x3f677e){for(var _0x36503c=0x0;_0x36503c<_0x3f677e[_0xf5f2('0x3e')];_0x36503c+=0x1){_['merge'](_0x4800fe['voiceQueues'][_0x3f677e[_0x36503c]['name']],_0x3f677e[_0x36503c]);}return _0x4800fe[_0xf5f2('0x14')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x52')]=function(){var _0x450691=this;return function(_0x55da4d){clearVoiceQueues(_0x450691['voiceQueues']);if(_0x55da4d){_0x55da4d=_[_0xf5f2('0x53')](_0x55da4d,_0xf5f2('0x54'));for(var _0xc10cf3 in _0x55da4d){if(_0x55da4d[_0xf5f2('0x26')](_0xc10cf3)){for(var _0x794e0c=0x0;_0x794e0c<_0x55da4d[_0xc10cf3][_0xf5f2('0x3e')];_0x794e0c+=0x1){var _0x11c302=_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x55')];if(_0x450691[_0xf5f2('0x14')][_0x11c302]){if(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x56')]){_0x450691[_0xf5f2('0x14')][_0x11c302]['unmanaged']+=0x1;}if(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerabandon']){_0x450691['voiceQueues'][_0x11c302][_0xf5f2('0x57')]+=0x1;}_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2b')]+=moment(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x58')])[_0xf5f2('0x59')](moment(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerjoinAt']),_0xf5f2('0x5a'))||0x0;if(_0x794e0c===_0x55da4d[_0xc10cf3][_0xf5f2('0x3e')]-0x1){_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2c')]+=moment(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5b')]||_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerabandonAt']||_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5c')])[_0xf5f2('0x59')](moment(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerjoinAt']),_0xf5f2('0x5a'))||0x0;_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x31')]+=0x1;if(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5d')]){_0x450691['voiceQueues'][_0x11c302][_0xf5f2('0x32')]+=0x1;_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2d')]+=moment(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5b')])[_0xf5f2('0x59')](moment(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerleaveAt']),'seconds')||0x0;}}else{_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2c')]+=_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2b')]||0x0;}}}}}}return _0x450691['voiceQueues'];};};Realtime['prototype'][_0xf5f2('0x5e')]=function(){var _0x4f2fcc=this;return function(_0x4c4420){clearVoiceCallReports(_0x4f2fcc['outbound']);if(_0x4c4420){for(var _0x57cb18=0x0;_0x57cb18<_0x4c4420[_0xf5f2('0x3e')];_0x57cb18+=0x1){_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x31')]+=0x1;_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x2c')]+=_0x4c4420[_0x57cb18][_0xf5f2('0x5f')];if(_0x4c4420[_0x57cb18][_0xf5f2('0x60')]===_0xf5f2('0x61')){_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x32')]+=0x1;_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x2b')]+=_0x4c4420[_0x57cb18][_0xf5f2('0x5f')]-_0x4c4420[_0x57cb18][_0xf5f2('0x62')]||0x0;_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x2d')]+=_0x4c4420[_0x57cb18][_0xf5f2('0x62')];}}}return _0x4f2fcc[_0xf5f2('0x16')];};};Realtime['prototype'][_0xf5f2('0x63')]=function(){var _0x35299d=this;return function(_0x21043b){if(_0x21043b){freeIsNotKey(_0x21043b,_0x35299d[_0xf5f2('0x64')],_0xf5f2('0x28'));for(var _0x308220=0x0,_0x16491c={};_0x308220<_0x21043b[_0xf5f2('0x3e')];_0x308220+=0x1){_0x16491c=_0x21043b[_0x308220];if(_['isUndefined'](_0x35299d[_0xf5f2('0x64')][_0x16491c['name']])){_0x35299d['campaigns'][_0x16491c['name']]=new Campaign(_0x16491c);}else{_0x35299d['mergeFromDatabase'](_0x35299d['campaigns'][_0x16491c['name']],_0x16491c);_0x35299d[_0xf5f2('0x64')][_0x16491c[_0xf5f2('0x28')]][_0xf5f2('0x65')]=_0x16491c[_0xf5f2('0x66')]?_0x16491c[_0xf5f2('0x66')][_0xf5f2('0x28')]:undefined;}}}return _0x35299d['campaigns'];};};Realtime['prototype'][_0xf5f2('0x67')]=function(){var _0x578a22=this;return function(_0x418ece){if(_0x418ece){freeIsNotKey(_0x418ece,_0x578a22[_0xf5f2('0x68')],'id');for(var _0x59161c=0x0,_0x4f3ad4={};_0x59161c<_0x418ece[_0xf5f2('0x3e')];_0x59161c+=0x1){_0x4f3ad4=_0x418ece[_0x59161c];if(_[_0xf5f2('0x3f')](_0x578a22['voiceExtensions'][_0x4f3ad4['id']])){_0x578a22[_0xf5f2('0x68')][_0x4f3ad4['id']]=new VoiceExtension(_0x4f3ad4);}else{_0x578a22[_0xf5f2('0x3d')](_0x578a22['voiceExtensions'][_0x4f3ad4['id']],_0x4f3ad4);}}}return _0x578a22[_0xf5f2('0x68')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x69')]=function(){var _0x4c1678=this;return function(_0x33e9ad){clearCampaigns(_0x4c1678[_0xf5f2('0x64')]);for(var _0x14db86=0x0;_0x14db86<_0x33e9ad[_0xf5f2('0x3e')];_0x14db86+=0x1){_[_0xf5f2('0x6a')](_0x4c1678[_0xf5f2('0x64')][_0x33e9ad[_0x14db86][_0xf5f2('0x28')]],_0x33e9ad[_0x14db86]);}return _0x4c1678[_0xf5f2('0x64')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x6b')]=function(){var _0x191af3=this;return function(_0x2601aa){if(_0x2601aa){freeIsNotKey(_0x2601aa,_0x191af3[_0xf5f2('0x24')],'id');for(var _0x407dd8=0x0,_0xe900ea={};_0x407dd8<_0x2601aa[_0xf5f2('0x3e')];_0x407dd8+=0x1){_0xe900ea=_0x2601aa[_0x407dd8];if(_[_0xf5f2('0x3f')](_0x191af3[_0xf5f2('0x24')][_0xe900ea['id']])){_0x191af3[_0xf5f2('0x24')][_0xe900ea['id']]=new FaxAccount(_0xe900ea);}else{_0x191af3[_0xf5f2('0x3d')](_0x191af3[_0xf5f2('0x24')][_0xe900ea['id']],_0xe900ea);}}}return _0x191af3['faxAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x6c')]=function(){var _0x5d6c6e=this;return function(_0x2e49ce){if(_0x2e49ce){freeIsNotKey(_0x2e49ce,_0x5d6c6e[_0xf5f2('0x14')],'name');for(var _0xb56304=0x0,_0x2f54eb={};_0xb56304<_0x2e49ce[_0xf5f2('0x3e')];_0xb56304+=0x1){_0x2f54eb=_0x2e49ce[_0xb56304];if(_['isUndefined'](_0x5d6c6e['voiceQueues'][_0x2f54eb[_0xf5f2('0x28')]])){_0x5d6c6e[_0xf5f2('0x14')][_0x2f54eb[_0xf5f2('0x28')]]=new VoiceQueue(_0x2f54eb);}else{_0x5d6c6e['mergeFromDatabase'](_0x5d6c6e['voiceQueues'][_0x2f54eb[_0xf5f2('0x28')]],_0x2f54eb);}}}return _0x5d6c6e[_0xf5f2('0x14')];};};module[_0xf5f2('0x6d')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index 20a87b9..a7ebbdf 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 _0x767b=['mergeDBDataToRealtime','assign'];(function(_0x3034c0,_0x84d9f3){var _0x2d485b=function(_0x5df1e0){while(--_0x5df1e0){_0x3034c0['push'](_0x3034c0['shift']());}};_0x2d485b(++_0x84d9f3);}(_0x767b,0x143));var _0xb767=function(_0x1599cb,_0x5bb2e2){_0x1599cb=_0x1599cb-0x0;var _0x1b4c09=_0x767b[_0x1599cb];return _0x1b4c09;};'use strict';function mergeDBDataToRealtime(_0x5e665d,_0x1da961){var _0x9221a5=Object[_0xb767('0x0')]({},_0x5e665d);for(var _0x3598fb in _0x1da961){if(_0x9221a5['hasOwnProperty'](_0x3598fb)){_0x9221a5[_0x3598fb]=_0x1da961[_0x3598fb];}}return _0x9221a5;}exports[_0xb767('0x1')]=mergeDBDataToRealtime; \ No newline at end of file +var _0x0490=['assign','hasOwnProperty'];(function(_0x4cb582,_0x2d744a){var _0x2580e2=function(_0x5676e2){while(--_0x5676e2){_0x4cb582['push'](_0x4cb582['shift']());}};_0x2580e2(++_0x2d744a);}(_0x0490,0x17e));var _0x0049=function(_0x3f31e8,_0x244d08){_0x3f31e8=_0x3f31e8-0x0;var _0x4daa96=_0x0490[_0x3f31e8];return _0x4daa96;};'use strict';function mergeDBDataToRealtime(_0x1b7007,_0x5daeb9){var _0x3bc894=Object[_0x0049('0x0')]({},_0x1b7007);for(var _0x49777 in _0x5daeb9){if(_0x3bc894[_0x0049('0x1')](_0x49777)){_0x3bc894[_0x49777]=_0x5daeb9[_0x49777];}}return _0x3bc894;}exports['mergeDBDataToRealtime']=mergeDBDataToRealtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index c61366a..6eaac47 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 _0xadd9=['uniqueid','getCallType','UserId','monitor','monitors','monitorFilename','filename','connectedlinename','membername','isArray','forEach','startsWith','Local','substring','indexOf','mobile','phone','transfererlinkedid','exports','lodash','moment','util','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/memberReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceAgentReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','voiceAgentReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','name','isNil','accountcode','format','SIP/%s','length','connectedlinenum','assigned','interface','queuecallercomplete','YYYY-MM-DD\x20HH:mm:ss','create','match','getAgentByInternal','keys','split','calleridnum','outbound','destination','exten','type','dialer','lastapplication','queue','lastdata','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','originatecalleridnum','destinationchannel','channel','calleridpreview','disposition','ANSWERED','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid'];(function(_0x411db2,_0x35c3db){var _0x2f760a=function(_0x4464c7){while(--_0x4464c7){_0x411db2['push'](_0x411db2['shift']());}};_0x2f760a(++_0x35c3db);}(_0xadd9,0xc5));var _0x9add=function(_0x4ac007,_0x3632ae){_0x4ac007=_0x4ac007-0x0;var _0x42e227=_0xadd9[_0x4ac007];return _0x42e227;};'use strict';var _=require(_0x9add('0x0'));var moment=require(_0x9add('0x1'));var util=require(_0x9add('0x2'));var config=require('../../../config/environment');var ami=require('../ami');var RpcVoiceAgentReport=require(_0x9add('0x3'));var RpcVoiceCallReport=require(_0x9add('0x4'));var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0x9add('0x5'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0x9add('0x6'));var RpcVoiceTransferReport=require(_0x9add('0x7'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0x9add('0x8'));var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0x9add('0x9'));function Report(_0x5eb360){this[_0x9add('0xa')]=_0x5eb360;this[_0x9add('0xb')]=_0x5eb360[_0x9add('0xb')];this[_0x9add('0xc')]=_0x5eb360[_0x9add('0xc')];}Report[_0x9add('0xd')][_0x9add('0xe')]=function(_0x1b0629){var _0x488a1c=new VoiceQueueReport(this[_0x9add('0xa')]);var _0x4f30a5=new VoiceAgentReport(this[_0x9add('0xa')]);var _0x2a054c=new VoiceDialReport(this[_0x9add('0xa')]);var _0x3c5026=new VoiceCallReport(this[_0x9add('0xa')]);var _0x222031=new UserReport(this['realtime']);if(config[_0x9add('0xf')]&&config[_0x9add('0xf')]['disabled']){ami['on'](_0x9add('0x10'),this[_0x9add('0x11')][_0x9add('0x12')](this));ami['on'](_0x9add('0x13'),this[_0x9add('0x14')][_0x9add('0x12')](this));ami['on']('custom:voiceAgentReport',this[_0x9add('0x15')]['bind'](this));ami['on']('custom:voiceDialReport',this[_0x9add('0x16')]['bind'](this));ami['on'](_0x9add('0x17'),this[_0x9add('0x18')]['bind'](this));ami['on'](_0x9add('0x19'),this[_0x9add('0x1a')][_0x9add('0x12')](this));}};Report[_0x9add('0xd')][_0x9add('0x1b')]=function(_0x5e9ddf){var _0x3e76bb;_0x3e76bb=_[_0x9add('0x1c')](this[_0x9add('0xb')],function(_0x44c6d6){return _0x44c6d6['accountcode']==_0x5e9ddf||_0x44c6d6[_0x9add('0x1d')]==_0x5e9ddf;});if(_[_0x9add('0x1e')](_0x3e76bb)){var _0x4615ac=_['find'](this[_0x9add('0xc')],function(_0x2a5a12){return _0x2a5a12[_0x9add('0x1f')]==_0x5e9ddf||_0x2a5a12[_0x9add('0x1d')]==_0x5e9ddf;});if(_0x4615ac){_0x3e76bb=_[_0x9add('0x1c')](this[_0x9add('0xb')],function(_0xffaa5d){return _0xffaa5d['interface']==util[_0x9add('0x20')](_0x9add('0x21'),_0x4615ac[_0x9add('0x1d')]);});}}return _0x3e76bb;};Report['prototype'][_0x9add('0x11')]=function(_0xf58f4b){for(var _0x178236=0x0;_0x178236<_0xf58f4b[_0x9add('0x22')];_0x178236+=0x1){var _0x5af983=this[_0x9add('0x1b')](_0xf58f4b[_0x178236][_0x9add('0x23')]);if(_0x5af983){_0xf58f4b[_0x178236]['accountcode']=_0x5af983[_0x9add('0x1f')];_0xf58f4b[_0x178236][_0x9add('0x24')]=!![];_0xf58f4b[_0x178236]['lastAssignedTo']=_0x5af983['name'];_0xf58f4b[_0x178236][_0x9add('0x25')]=_['isNil'](_0x5af983[_0x9add('0x25')])?util[_0x9add('0x20')](_0x9add('0x21'),_0x5af983[_0x9add('0x1d')]):_0x5af983[_0x9add('0x25')];if(_0xf58f4b[_0x178236][_0x9add('0x26')]){_0xf58f4b[_0x178236]['queuecallercompleteAt']=moment()[_0x9add('0x20')](_0x9add('0x27'));}if(_0xf58f4b[_0x178236]['queuecallerexit']){_0xf58f4b[_0x178236]['queuecallerexitAt']=moment()[_0x9add('0x20')](_0x9add('0x27'));}RpcMemberReport['voiceQueueReport'](_0xf58f4b[_0x178236]);}RpcVoiceQueueReport[_0x9add('0x28')](_0xf58f4b[_0x178236]);}};function extractCalleridNumber(_0x5a27d1){var _0x16be0e=_0x5a27d1[_0x9add('0x29')](/<(.*?)>/);return _0x16be0e?_0x16be0e[0x1]:_0x5a27d1;}Report[_0x9add('0xd')][_0x9add('0x2a')]=function(_0x3565b2){for(var _0x1fd545=0x0;_0x1fd545/);return _0x461237?_0x461237[0x1]:_0x5ee12b;}Report[_0x4473('0x12')][_0x4473('0x2e')]=function(_0xe70192){for(var _0x5f311e=0x0;_0x5f311e',_0x345b02[_0x4473('0x46')],_0x345b02[_0x4473('0x33')]);}if(RpcVoiceTransferReport['transfers'][_0x345b02[_0x4473('0x47')]]){var _0x2161ff=RpcVoiceTransferReport[_0x4473('0x48')][_0x345b02['linkedid']];_0x2161ff[_0x4473('0x49')]=_0x345b02[_0x4473('0x4a')];RpcVoiceTransferReport['blindTransfer'](_0x2161ff);delete RpcVoiceTransferReport['transfers'][_0x345b02[_0x4473('0x47')]];}if(_[_0x4473('0x21')](_0x345b02[_0x4473('0x38')])){_0x345b02[_0x4473('0x38')]=this[_0x4473('0x30')](_0x345b02);}if(_[_0x4473('0x21')](_0x345b02[_0x4473('0x4b')])){var _0x1d01c4=_0x345b02['channel'][_0x4473('0x32')]('-')[0x0];var _0x54218c=this[_0x4473('0x10')][_0x1d01c4];if(!_0x54218c)_0x54218c=this[_0x4473('0x2e')](_0x345b02[_0x4473('0x1f')]);if(_0x54218c){_0x345b02[_0x4473('0x4b')]=_0x54218c['id'];_0x345b02[_0x4473('0x4c')]=_0x54218c['name'];}}RpcVoiceCallReport[_0x4473('0x4d')](_0x345b02);if(_0x345b02[_0x4473('0x4e')]){for(var _0x4df89f=0x0;_0x4df89f<_0x345b02['monitors']['length'];_0x4df89f+=0x1){_0x345b02[_0x4473('0x4f')]=_0x345b02[_0x4473('0x50')][_0x4df89f][_0x4473('0x51')];_0x345b02[_0x4473('0x52')]=_0x345b02[_0x4473('0x50')][_0x4df89f]['createdAt'];if(_0x345b02[_0x4473('0x37')]==_0x4473('0x41')){_0x345b02[_0x4473('0x33')]=_0x345b02['connectedlinenum'];_0x345b02[_0x4473('0x46')]=_0x345b02[_0x4473('0x53')];_0x345b02[_0x4473('0x24')]=_0x345b02[_0x4473('0x1f')];_0x345b02[_0x4473('0x53')]=_0x345b02['membername'];_0x345b02['exten']=_0x345b02['originatecalleridnum'];}else if(_0x345b02[_0x4473('0x37')]==_0x4473('0x54')){_0x345b02[_0x4473('0x33')]=_0x345b02['destination'];_0x345b02[_0x4473('0x37')]=_0x345b02[_0x4473('0x43')];}RpcVoiceRecording['create'](_0x345b02);}}};Report['prototype'][_0x4473('0x19')]=function(_0x5138ff){if(_[_0x4473('0x55')](_0x5138ff)){_0x5138ff[_0x4473('0x56')](function(_0x25b269){RpcVoiceAgentReport[_0x4473('0x4d')](_0x25b269);});}else{RpcVoiceAgentReport[_0x4473('0x4d')](_0x5138ff);}};Report[_0x4473('0x12')]['voiceDialReport']=function(_0x14bc27){RpcVoiceDialReport[_0x4473('0x4d')](_0x14bc27);var _0x443368;var _0x1e2e4d;var _0x22de97=_0x14bc27['channel'];if(_['startsWith'](_0x22de97,_0x4473('0x57'))){_0x1e2e4d=_0x22de97[_0x4473('0x58')](_0x22de97[_0x4473('0x59')]('/')+0x1,_0x22de97[_0x4473('0x59')]('@'));_0x443368=_[_0x4473('0x1e')](this[_0x4473('0x10')],function(_0x1a64b7){return _0x1a64b7[_0x4473('0x5a')]==_0x1e2e4d||_0x1a64b7[_0x4473('0x5b')]==_0x1e2e4d||_0x1a64b7[_0x4473('0x1f')]==_0x1e2e4d;});}else{_0x1e2e4d=_0x22de97[_0x4473('0x58')](_0x22de97['indexOf']('/')+0x1,_0x22de97['lastIndexOf']('-'));_0x443368=this[_0x4473('0x1d')](_0x1e2e4d);}if(_0x443368){_0x14bc27['interface']=_[_0x4473('0x21')](_0x443368['interface'])?util[_0x4473('0x27')](_0x4473('0x28'),_0x443368[_0x4473('0x20')]):_0x443368[_0x4473('0x22')];_0x14bc27[_0x4473('0x4c')]=_0x443368['name'];_0x14bc27[_0x4473('0x1f')]=_0x443368[_0x4473('0x1f')];RpcMemberReport[_0x4473('0x1a')](_0x14bc27);}};Report[_0x4473('0x12')][_0x4473('0x1b')]=function(_0xdda3df){RpcVoiceTransferReport[_0x4473('0x48')][_0xdda3df[_0x4473('0x5c')]]=_0xdda3df;};Report['prototype']['attendedTransfer']=function(_0x3101ae){RpcVoiceTransferReport[_0x4473('0x5d')](_0x3101ae);};module[_0x4473('0x5e')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index 4a80a3c..8ac77b6 100644 --- a/server/services/ami/report/userReport.js +++ b/server/services/ami/report/userReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe1a7=['format','trunk:%s','name','syncDeviceState','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','[userReport][devicestatechange]','local','toLowerCase','inuse','toNumber','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','startsWith','Local','substring','indexOf','accountcode','stateTime','updateStatusRealtime','syncPeerStatus','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','address','registered','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','trunk:save','[userReport][peerstatus]','exports','lodash','moment','ioredis','bluebird','../../../config/environment','../../../config/logger','ami','../ami','redis','localhost','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','bind','registry','devicestatechange','peerstatus','resolve','catch','error','[userReport][sipshowregistry]','inspect','then','[userReport][devicestatelist]','actionSipPeerStatus','prototype','syncRealtimeShow','isNotNull','isUndefined','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','state','debug','[userReport][registry]','find','omit','event','actionid','username'];(function(_0x5ba6fd,_0x36db67){var _0x6709ab=function(_0x2a18a9){while(--_0x2a18a9){_0x5ba6fd['push'](_0x5ba6fd['shift']());}};_0x6709ab(++_0x36db67);}(_0xe1a7,0x151));var _0x7e1a=function(_0x5b567b,_0x19093b){_0x5b567b=_0x5b567b-0x0;var _0x5bc321=_0xe1a7[_0x5b567b];return _0x5bc321;};'use strict';var _=require(_0x7e1a('0x0'));var moment=require(_0x7e1a('0x1'));var util=require('util');var Redis=require(_0x7e1a('0x2'));var BPromise=require(_0x7e1a('0x3'));var config=require(_0x7e1a('0x4'));var logger=require(_0x7e1a('0x5'))(_0x7e1a('0x6'));var ami=require(_0x7e1a('0x7'));config[_0x7e1a('0x8')]=_['defaults'](config[_0x7e1a('0x8')],{'host':_0x7e1a('0x9'),'port':0x18eb});var io=require(_0x7e1a('0xa'))(new Redis(config[_0x7e1a('0x8')]));function UserReport(_0x3cfb60){this[_0x7e1a('0xb')]=_0x3cfb60[_0x7e1a('0xb')];this[_0x7e1a('0xc')]=_0x3cfb60[_0x7e1a('0xc')];this[_0x7e1a('0xd')]=_0x3cfb60['telephones'];ami['on'](_0x7e1a('0xe'),this[_0x7e1a('0xf')][_0x7e1a('0x10')](this));ami['on'](_0x7e1a('0x11'),this['syncRegistry'][_0x7e1a('0x10')](this));ami['on'](_0x7e1a('0x12'),this['syncDeviceState']['bind'](this));ami['on'](_0x7e1a('0x13'),this['syncPeerStatus']['bind'](this));return this['syncRealtimeShow']();}function showSipRegistrations(){Promise[_0x7e1a('0x14')]()['then'](ami['actionSipShowRegistry']())[_0x7e1a('0x15')](function(_0x26799a){logger[_0x7e1a('0x16')](_0x7e1a('0x17'),util[_0x7e1a('0x18')](_0x26799a,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x7e1a('0x14')]()[_0x7e1a('0x19')](ami['actionDeviceStateList']())[_0x7e1a('0x15')](function(_0x480935){logger['error'](_0x7e1a('0x1a'),util[_0x7e1a('0x18')](_0x480935,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise['resolve']()[_0x7e1a('0x19')](ami[_0x7e1a('0x1b')]())[_0x7e1a('0x15')](function(_0x43fbee){logger[_0x7e1a('0x16')]('[userReport][sippeerstatus]',util['inspect'](_0x43fbee,{'showHidden':![],'depth':null}));});}UserReport[_0x7e1a('0x1c')][_0x7e1a('0x1d')]=function(){setInterval(function(){BPromise['resolve']()['then'](showSipRegistrations())['then'](listDeviceStates())['then'](showPeersStatus());},0x32c8);};UserReport[_0x7e1a('0x1c')][_0x7e1a('0x1e')]=function(_0x52d5c4){return _0x52d5c4!==null&&!_[_0x7e1a('0x1f')](_0x52d5c4);};UserReport['prototype']['emit']=function(_0x31c4b6,_0x85b427,_0x2da209){io['to'](_0x31c4b6)[_0x7e1a('0x20')](_0x85b427,_0x2da209);};UserReport['prototype'][_0x7e1a('0xf')]=function(_0x1fb713){try{if(this[_0x7e1a('0x1e')](_0x1fb713)){logger[_0x7e1a('0x21')](_0x7e1a('0x22'),_0x1fb713['username'],_0x1fb713[_0x7e1a('0x23')]);logger[_0x7e1a('0x24')](_0x7e1a('0x25'),util['inspect'](_0x1fb713,{'showHidden':![],'depth':null}));var _0x5b911f=_[_0x7e1a('0x26')](this[_0x7e1a('0xb')],{'defaultuser':_0x1fb713['username']});if(_0x5b911f){_0x1fb713['stateRegistry']=_0x1fb713[_0x7e1a('0x23')];_['merge'](_0x5b911f,_[_0x7e1a('0x27')](_0x1fb713,[_0x7e1a('0x28'),_0x7e1a('0x29'),_0x7e1a('0x2a'),'state']));logger[_0x7e1a('0x24')]('[userReport][registry]\x20sending\x20trunk:save\x20event:',util[_0x7e1a('0x18')](_0x5b911f,{'showHidden':![],'depth':null}));this[_0x7e1a('0x20')](util[_0x7e1a('0x2b')](_0x7e1a('0x2c'),_0x5b911f[_0x7e1a('0x2d')]),'trunk:save',_0x5b911f);}}}catch(_0x1701b9){logger['error'](_0x7e1a('0x25'),util[_0x7e1a('0x18')](_0x1701b9,{'showHidden':![],'depth':null}));}};UserReport[_0x7e1a('0x1c')][_0x7e1a('0x2e')]=function(_0x10430e){try{if(this[_0x7e1a('0x1e')](_0x10430e)){logger[_0x7e1a('0x21')](_0x7e1a('0x2f'),_0x10430e[_0x7e1a('0x30')],_0x10430e[_0x7e1a('0x23')]);logger['debug'](_0x7e1a('0x31'),util[_0x7e1a('0x18')](_0x10430e,{'showHidden':![],'depth':null}));if(this[_0x7e1a('0xc')][_0x10430e['device']]){if(!this[_0x7e1a('0xc')][_0x10430e[_0x7e1a('0x30')]][_0x7e1a('0x32')]||_0x10430e[_0x7e1a('0x23')][_0x7e1a('0x33')]()==_0x7e1a('0x34')){this['agents'][_0x10430e[_0x7e1a('0x30')]][_0x7e1a('0x32')]=![];if(this['agents'][_0x10430e['device']][_0x7e1a('0x23')]!==_0x10430e['state'][_0x7e1a('0x33')]()){this[_0x7e1a('0xc')][_0x10430e[_0x7e1a('0x30')]]['stateTime']=_[_0x7e1a('0x35')](moment()[_0x7e1a('0x2b')]('x'));}this[_0x7e1a('0xc')][_0x10430e[_0x7e1a('0x30')]][_0x7e1a('0x23')]=_0x10430e[_0x7e1a('0x23')][_0x7e1a('0x33')]();this['agents'][_0x10430e[_0x7e1a('0x30')]]['updateStatusRealtime'](_0x10430e);}}else if(this['telephones'][_0x10430e[_0x7e1a('0x30')]]){if(this['telephones'][_0x10430e[_0x7e1a('0x30')]]['state']!==_0x10430e[_0x7e1a('0x23')]['toLowerCase']()){this['telephones'][_0x10430e['device']]['stateTime']=_['toNumber'](moment()['format']('x'));}this[_0x7e1a('0xd')][_0x10430e[_0x7e1a('0x30')]][_0x7e1a('0x23')]=_0x10430e[_0x7e1a('0x23')][_0x7e1a('0x33')]();logger[_0x7e1a('0x24')](_0x7e1a('0x36'),util[_0x7e1a('0x18')](this[_0x7e1a('0xd')][_0x10430e[_0x7e1a('0x30')]],{'showHidden':![],'depth':null}));this[_0x7e1a('0x20')](util[_0x7e1a('0x2b')](_0x7e1a('0x37'),this['telephones'][_0x10430e[_0x7e1a('0x30')]][_0x7e1a('0x2d')]),_0x7e1a('0x38'),this['telephones'][_0x10430e[_0x7e1a('0x30')]]);}else if(this[_0x7e1a('0xb')][_0x10430e[_0x7e1a('0x30')]]){if(this['trunks'][_0x10430e['device']][_0x7e1a('0x23')]!==_0x10430e[_0x7e1a('0x23')][_0x7e1a('0x33')]()){this[_0x7e1a('0xb')][_0x10430e[_0x7e1a('0x30')]]['stateTime']=_[_0x7e1a('0x35')](moment()[_0x7e1a('0x2b')]('x'));}this[_0x7e1a('0xb')][_0x10430e[_0x7e1a('0x30')]][_0x7e1a('0x23')]=_0x10430e[_0x7e1a('0x23')][_0x7e1a('0x33')]();logger[_0x7e1a('0x24')](_0x7e1a('0x39'),util[_0x7e1a('0x18')](this[_0x7e1a('0xb')][_0x10430e[_0x7e1a('0x30')]],{'showHidden':![],'depth':null}));this['emit'](util['format'](_0x7e1a('0x2c'),this['trunks'][_0x10430e[_0x7e1a('0x30')]][_0x7e1a('0x2d')]),'trunk:save',this[_0x7e1a('0xb')][_0x10430e['device']]);}else if(_[_0x7e1a('0x3a')](_0x10430e['device'],_0x7e1a('0x3b'))){var _0x430a0c=_0x10430e['device'];var _0x1587e1=_0x430a0c[_0x7e1a('0x3c')](_0x430a0c[_0x7e1a('0x3d')]('/')+0x1,_0x430a0c[_0x7e1a('0x3d')]('@'));var _0x2a03f5=_['find'](this[_0x7e1a('0xc')],function(_0x4d8a76){return _0x4d8a76['mobile']==_0x1587e1||_0x4d8a76['phone']==_0x1587e1||_0x4d8a76[_0x7e1a('0x3e')]==_0x1587e1;});if(_0x2a03f5){if(_0x2a03f5[_0x7e1a('0x23')]!==_0x10430e[_0x7e1a('0x23')][_0x7e1a('0x33')]()){_0x2a03f5[_0x7e1a('0x3f')]=_[_0x7e1a('0x35')](moment()[_0x7e1a('0x2b')]('x'));}_0x2a03f5['state']=_0x10430e[_0x7e1a('0x23')]['toLowerCase']();_0x2a03f5['local']=!![];_0x2a03f5[_0x7e1a('0x40')](_0x10430e);}}}}catch(_0x5dd25f){logger[_0x7e1a('0x16')]('[userReport][devicestatechange]',util[_0x7e1a('0x18')](_0x5dd25f,{'showHidden':![],'depth':null}));}};UserReport[_0x7e1a('0x1c')][_0x7e1a('0x41')]=function(_0x444f03){try{if(this[_0x7e1a('0x1e')](_0x444f03)&&this[_0x7e1a('0x1e')](_0x444f03[_0x7e1a('0x13')])){logger['info'](_0x7e1a('0x42'),_0x444f03[_0x7e1a('0x43')],_0x444f03[_0x7e1a('0x44')],_0x444f03['peerstatus']);logger[_0x7e1a('0x24')]('[userReport][peerstatus]',util['inspect'](_0x444f03,{'showHidden':![],'depth':null}));if(this['agents'][_0x444f03['peer']]){if(!this[_0x7e1a('0xc')][_0x444f03[_0x7e1a('0x43')]][_0x7e1a('0x32')]||_0x444f03[_0x7e1a('0x13')][_0x7e1a('0x33')]()==_0x7e1a('0x45')){this['agents'][_0x444f03[_0x7e1a('0x43')]][_0x7e1a('0x32')]=![];this[_0x7e1a('0xc')][_0x444f03['peer']][_0x7e1a('0x46')]=_0x444f03[_0x7e1a('0x13')]['toLowerCase']();this[_0x7e1a('0xc')][_0x444f03[_0x7e1a('0x43')]]['address']=_0x444f03['address'];this[_0x7e1a('0xc')][_0x444f03[_0x7e1a('0x43')]][_0x7e1a('0x40')](_0x444f03);}}else if(this[_0x7e1a('0xd')][_0x444f03['peer']]){this[_0x7e1a('0xd')][_0x444f03[_0x7e1a('0x43')]][_0x7e1a('0x46')]=_0x444f03[_0x7e1a('0x13')][_0x7e1a('0x33')]();this[_0x7e1a('0xd')][_0x444f03[_0x7e1a('0x43')]]['address']=_0x444f03[_0x7e1a('0x44')];logger[_0x7e1a('0x24')](_0x7e1a('0x47'),util[_0x7e1a('0x18')](this['telephones'][_0x444f03['peer']],{'showHidden':![],'depth':null}));this[_0x7e1a('0x20')](util['format']('telephone:%s',this['telephones'][_0x444f03['peer']][_0x7e1a('0x2d')]),_0x7e1a('0x38'),this['telephones'][_0x444f03[_0x7e1a('0x43')]]);}else if(this[_0x7e1a('0xb')][_0x444f03[_0x7e1a('0x43')]]){this[_0x7e1a('0xb')][_0x444f03[_0x7e1a('0x43')]][_0x7e1a('0x46')]=_0x444f03[_0x7e1a('0x13')]['toLowerCase']();this['trunks'][_0x444f03['peer']][_0x7e1a('0x44')]=_0x444f03[_0x7e1a('0x44')];logger[_0x7e1a('0x24')](_0x7e1a('0x48'),util[_0x7e1a('0x18')](this[_0x7e1a('0xb')][_0x444f03['peer']],{'showHidden':![],'depth':null}));this[_0x7e1a('0x20')](util[_0x7e1a('0x2b')](_0x7e1a('0x2c'),this[_0x7e1a('0xb')][_0x444f03[_0x7e1a('0x43')]][_0x7e1a('0x2d')]),_0x7e1a('0x49'),this['trunks'][_0x444f03['peer']]);}}}catch(_0x4d6107){logger[_0x7e1a('0x16')](_0x7e1a('0x4a'),util[_0x7e1a('0x18')](_0x4d6107,{'showHidden':![],'depth':null}));}};module[_0x7e1a('0x4b')]=UserReport; \ No newline at end of file +var _0x8c50=['state','debug','find','username','stateRegistry','merge','omit','actionid','[userReport][registry]\x20sending\x20trunk:save\x20event:','name','syncDeviceState','[userReport][devicestatechange]\x20device:%s\x20state:%s','[userReport][devicestatechange]','local','device','toNumber','toLowerCase','format','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','stateTime','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','trunk:%s','trunk:save','startsWith','Local','substring','indexOf','mobile','phone','accountcode','updateStatusRealtime','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','[userReport][peerstatus]','registered','status','address','telephone:save','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','exports','lodash','moment','ioredis','bluebird','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','bind','registry','peerstatus','syncPeerStatus','syncRealtimeShow','then','actionSipShowRegistry','error','[userReport][sipshowregistry]','inspect','resolve','actionDeviceStateList','catch','[userReport][devicestatelist]','[userReport][sippeerstatus]','prototype','isNotNull','isUndefined','emit','info','[userReport][registry]\x20registry:%s\x20state:%s'];(function(_0x161e12,_0x33035f){var _0x45fc17=function(_0x31c1fc){while(--_0x31c1fc){_0x161e12['push'](_0x161e12['shift']());}};_0x45fc17(++_0x33035f);}(_0x8c50,0x113));var _0x08c5=function(_0x4dee77,_0x426fa7){_0x4dee77=_0x4dee77-0x0;var _0x1bce43=_0x8c50[_0x4dee77];return _0x1bce43;};'use strict';var _=require(_0x08c5('0x0'));var moment=require(_0x08c5('0x1'));var util=require('util');var Redis=require(_0x08c5('0x2'));var BPromise=require(_0x08c5('0x3'));var config=require(_0x08c5('0x4'));var logger=require(_0x08c5('0x5'))(_0x08c5('0x6'));var ami=require(_0x08c5('0x7'));config[_0x08c5('0x8')]=_[_0x08c5('0x9')](config[_0x08c5('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x08c5('0xa'))(new Redis(config[_0x08c5('0x8')]));function UserReport(_0x9f9959){this[_0x08c5('0xb')]=_0x9f9959[_0x08c5('0xb')];this[_0x08c5('0xc')]=_0x9f9959['agents'];this[_0x08c5('0xd')]=_0x9f9959[_0x08c5('0xd')];ami['on'](_0x08c5('0xe'),this[_0x08c5('0xf')][_0x08c5('0x10')](this));ami['on'](_0x08c5('0x11'),this[_0x08c5('0xf')][_0x08c5('0x10')](this));ami['on']('devicestatechange',this['syncDeviceState'][_0x08c5('0x10')](this));ami['on'](_0x08c5('0x12'),this[_0x08c5('0x13')][_0x08c5('0x10')](this));return this[_0x08c5('0x14')]();}function showSipRegistrations(){Promise['resolve']()[_0x08c5('0x15')](ami[_0x08c5('0x16')]())['catch'](function(_0x40c94f){logger[_0x08c5('0x17')](_0x08c5('0x18'),util[_0x08c5('0x19')](_0x40c94f,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x08c5('0x1a')]()['then'](ami[_0x08c5('0x1b')]())[_0x08c5('0x1c')](function(_0x1d5963){logger[_0x08c5('0x17')](_0x08c5('0x1d'),util['inspect'](_0x1d5963,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x08c5('0x1a')]()['then'](ami['actionSipPeerStatus']())['catch'](function(_0x59347e){logger[_0x08c5('0x17')](_0x08c5('0x1e'),util[_0x08c5('0x19')](_0x59347e,{'showHidden':![],'depth':null}));});}UserReport['prototype']['syncRealtimeShow']=function(){setInterval(function(){BPromise[_0x08c5('0x1a')]()['then'](showSipRegistrations())['then'](listDeviceStates())[_0x08c5('0x15')](showPeersStatus());},0x32c8);};UserReport[_0x08c5('0x1f')][_0x08c5('0x20')]=function(_0x217c04){return _0x217c04!==null&&!_[_0x08c5('0x21')](_0x217c04);};UserReport[_0x08c5('0x1f')][_0x08c5('0x22')]=function(_0x248219,_0x4e8192,_0x4fc31b){io['to'](_0x248219)[_0x08c5('0x22')](_0x4e8192,_0x4fc31b);};UserReport[_0x08c5('0x1f')]['syncRegistry']=function(_0x3d8c1a){try{if(this['isNotNull'](_0x3d8c1a)){logger[_0x08c5('0x23')](_0x08c5('0x24'),_0x3d8c1a['username'],_0x3d8c1a[_0x08c5('0x25')]);logger[_0x08c5('0x26')]('[userReport][registry]',util[_0x08c5('0x19')](_0x3d8c1a,{'showHidden':![],'depth':null}));var _0x4d82a6=_[_0x08c5('0x27')](this[_0x08c5('0xb')],{'defaultuser':_0x3d8c1a[_0x08c5('0x28')]});if(_0x4d82a6){_0x3d8c1a[_0x08c5('0x29')]=_0x3d8c1a[_0x08c5('0x25')];_[_0x08c5('0x2a')](_0x4d82a6,_[_0x08c5('0x2b')](_0x3d8c1a,['event',_0x08c5('0x2c'),_0x08c5('0x28'),_0x08c5('0x25')]));logger['debug'](_0x08c5('0x2d'),util['inspect'](_0x4d82a6,{'showHidden':![],'depth':null}));this['emit'](util['format']('trunk:%s',_0x4d82a6[_0x08c5('0x2e')]),'trunk:save',_0x4d82a6);}}}catch(_0x37a150){logger[_0x08c5('0x17')]('[userReport][registry]',util['inspect'](_0x37a150,{'showHidden':![],'depth':null}));}};UserReport[_0x08c5('0x1f')][_0x08c5('0x2f')]=function(_0x30eb23){try{if(this[_0x08c5('0x20')](_0x30eb23)){logger['info'](_0x08c5('0x30'),_0x30eb23['device'],_0x30eb23['state']);logger[_0x08c5('0x26')](_0x08c5('0x31'),util[_0x08c5('0x19')](_0x30eb23,{'showHidden':![],'depth':null}));if(this['agents'][_0x30eb23['device']]){if(!this[_0x08c5('0xc')][_0x30eb23['device']][_0x08c5('0x32')]||_0x30eb23[_0x08c5('0x25')]['toLowerCase']()=='inuse'){this[_0x08c5('0xc')][_0x30eb23[_0x08c5('0x33')]][_0x08c5('0x32')]=![];if(this[_0x08c5('0xc')][_0x30eb23[_0x08c5('0x33')]][_0x08c5('0x25')]!==_0x30eb23[_0x08c5('0x25')]['toLowerCase']()){this[_0x08c5('0xc')][_0x30eb23['device']]['stateTime']=_[_0x08c5('0x34')](moment()['format']('x'));}this['agents'][_0x30eb23[_0x08c5('0x33')]][_0x08c5('0x25')]=_0x30eb23[_0x08c5('0x25')][_0x08c5('0x35')]();this['agents'][_0x30eb23['device']]['updateStatusRealtime'](_0x30eb23);}}else if(this[_0x08c5('0xd')][_0x30eb23[_0x08c5('0x33')]]){if(this['telephones'][_0x30eb23[_0x08c5('0x33')]][_0x08c5('0x25')]!==_0x30eb23[_0x08c5('0x25')][_0x08c5('0x35')]()){this[_0x08c5('0xd')][_0x30eb23[_0x08c5('0x33')]]['stateTime']=_['toNumber'](moment()[_0x08c5('0x36')]('x'));}this[_0x08c5('0xd')][_0x30eb23['device']]['state']=_0x30eb23[_0x08c5('0x25')][_0x08c5('0x35')]();logger[_0x08c5('0x26')](_0x08c5('0x37'),util[_0x08c5('0x19')](this[_0x08c5('0xd')][_0x30eb23[_0x08c5('0x33')]],{'showHidden':![],'depth':null}));this['emit'](util[_0x08c5('0x36')](_0x08c5('0x38'),this['telephones'][_0x30eb23['device']][_0x08c5('0x2e')]),'telephone:save',this[_0x08c5('0xd')][_0x30eb23[_0x08c5('0x33')]]);}else if(this['trunks'][_0x30eb23[_0x08c5('0x33')]]){if(this[_0x08c5('0xb')][_0x30eb23['device']][_0x08c5('0x25')]!==_0x30eb23[_0x08c5('0x25')][_0x08c5('0x35')]()){this[_0x08c5('0xb')][_0x30eb23['device']][_0x08c5('0x39')]=_[_0x08c5('0x34')](moment()[_0x08c5('0x36')]('x'));}this[_0x08c5('0xb')][_0x30eb23[_0x08c5('0x33')]]['state']=_0x30eb23['state'][_0x08c5('0x35')]();logger[_0x08c5('0x26')](_0x08c5('0x3a'),util['inspect'](this[_0x08c5('0xb')][_0x30eb23[_0x08c5('0x33')]],{'showHidden':![],'depth':null}));this['emit'](util[_0x08c5('0x36')](_0x08c5('0x3b'),this[_0x08c5('0xb')][_0x30eb23['device']][_0x08c5('0x2e')]),_0x08c5('0x3c'),this[_0x08c5('0xb')][_0x30eb23['device']]);}else if(_[_0x08c5('0x3d')](_0x30eb23[_0x08c5('0x33')],_0x08c5('0x3e'))){var _0x54b21d=_0x30eb23[_0x08c5('0x33')];var _0x512d3d=_0x54b21d[_0x08c5('0x3f')](_0x54b21d[_0x08c5('0x40')]('/')+0x1,_0x54b21d[_0x08c5('0x40')]('@'));var _0x47ac1d=_[_0x08c5('0x27')](this['agents'],function(_0x43b541){return _0x43b541[_0x08c5('0x41')]==_0x512d3d||_0x43b541[_0x08c5('0x42')]==_0x512d3d||_0x43b541[_0x08c5('0x43')]==_0x512d3d;});if(_0x47ac1d){if(_0x47ac1d['state']!==_0x30eb23[_0x08c5('0x25')][_0x08c5('0x35')]()){_0x47ac1d[_0x08c5('0x39')]=_[_0x08c5('0x34')](moment()[_0x08c5('0x36')]('x'));}_0x47ac1d[_0x08c5('0x25')]=_0x30eb23[_0x08c5('0x25')][_0x08c5('0x35')]();_0x47ac1d['local']=!![];_0x47ac1d[_0x08c5('0x44')](_0x30eb23);}}}}catch(_0x135de4){logger[_0x08c5('0x17')](_0x08c5('0x31'),util[_0x08c5('0x19')](_0x135de4,{'showHidden':![],'depth':null}));}};UserReport['prototype']['syncPeerStatus']=function(_0x15321b){try{if(this[_0x08c5('0x20')](_0x15321b)&&this[_0x08c5('0x20')](_0x15321b['peerstatus'])){logger[_0x08c5('0x23')](_0x08c5('0x45'),_0x15321b[_0x08c5('0x46')],_0x15321b['address'],_0x15321b[_0x08c5('0x12')]);logger[_0x08c5('0x26')](_0x08c5('0x47'),util['inspect'](_0x15321b,{'showHidden':![],'depth':null}));if(this[_0x08c5('0xc')][_0x15321b[_0x08c5('0x46')]]){if(!this['agents'][_0x15321b['peer']][_0x08c5('0x32')]||_0x15321b['peerstatus'][_0x08c5('0x35')]()==_0x08c5('0x48')){this[_0x08c5('0xc')][_0x15321b[_0x08c5('0x46')]][_0x08c5('0x32')]=![];this[_0x08c5('0xc')][_0x15321b['peer']][_0x08c5('0x49')]=_0x15321b[_0x08c5('0x12')][_0x08c5('0x35')]();this[_0x08c5('0xc')][_0x15321b[_0x08c5('0x46')]]['address']=_0x15321b[_0x08c5('0x4a')];this[_0x08c5('0xc')][_0x15321b['peer']]['updateStatusRealtime'](_0x15321b);}}else if(this['telephones'][_0x15321b[_0x08c5('0x46')]]){this[_0x08c5('0xd')][_0x15321b['peer']][_0x08c5('0x49')]=_0x15321b[_0x08c5('0x12')][_0x08c5('0x35')]();this['telephones'][_0x15321b[_0x08c5('0x46')]][_0x08c5('0x4a')]=_0x15321b[_0x08c5('0x4a')];logger['debug']('[userReport][peerstatus]\x20sending\x20telephone:save\x20event:',util[_0x08c5('0x19')](this['telephones'][_0x15321b[_0x08c5('0x46')]],{'showHidden':![],'depth':null}));this[_0x08c5('0x22')](util[_0x08c5('0x36')](_0x08c5('0x38'),this[_0x08c5('0xd')][_0x15321b['peer']]['name']),_0x08c5('0x4b'),this[_0x08c5('0xd')][_0x15321b[_0x08c5('0x46')]]);}else if(this['trunks'][_0x15321b[_0x08c5('0x46')]]){this[_0x08c5('0xb')][_0x15321b[_0x08c5('0x46')]][_0x08c5('0x49')]=_0x15321b[_0x08c5('0x12')][_0x08c5('0x35')]();this[_0x08c5('0xb')][_0x15321b[_0x08c5('0x46')]][_0x08c5('0x4a')]=_0x15321b[_0x08c5('0x4a')];logger[_0x08c5('0x26')](_0x08c5('0x4c'),util[_0x08c5('0x19')](this[_0x08c5('0xb')][_0x15321b['peer']],{'showHidden':![],'depth':null}));this[_0x08c5('0x22')](util['format']('trunk:%s',this[_0x08c5('0xb')][_0x15321b['peer']][_0x08c5('0x2e')]),'trunk:save',this[_0x08c5('0xb')][_0x15321b['peer']]);}}}catch(_0x4b34fd){logger[_0x08c5('0x17')](_0x08c5('0x47'),util[_0x08c5('0x19')](_0x4b34fd,{'showHidden':![],'depth':null}));}};module[_0x08c5('0x4d')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index ce1d9dc..5738737 100644 --- a/server/services/ami/report/voiceAgentReport.js +++ b/server/services/ami/report/voiceAgentReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbde7=['origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','agentconnectAt','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20event:','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','syncMusicOnHoldStart','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','lastIndexOf','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','channels','voiceChannels','agents','variables','agentcalled','bind','agentconnect','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','musiconholdstart','syncMusicOnHoldStop','syncAttendedTransfer','blindtransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','membername','destuniqueid','uniqueid','inspect','interface','voiceQueues','queue','YYYY-MM-DD\x20HH:mm:ss','called','mandatoryDisposition','type','voice','assign','omit','event','privilege','custom:agentcalled','calleridnum','debug','format','user:called','[%s][voiceAgentReport][agentcalled]','hasOwnProperty','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','routealias','merge','pick','destconnectedlinenum','name','accountcode','exten','custom:agentconnect','user:%s','user:agentconnect','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answeredelsewheredestinationuniqueid','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','user:agentringnoanswer','custom:agentringnoanswer','error','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','transfer','agent','talktime','acw','acwtime','acwTimeout','agentacw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','destaccountcode','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','value','variable','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','custom:voiceAgentReport','values','[%s][voiceAgentReport][hangup]','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid'];(function(_0x3d78d7,_0x44acea){var _0x4b6784=function(_0x284157){while(--_0x284157){_0x3d78d7['push'](_0x3d78d7['shift']());}};_0x4b6784(++_0x44acea);}(_0xbde7,0x152));var _0x7bde=function(_0x448545,_0x293e6f){_0x448545=_0x448545-0x0;var _0x4e7c06=_0xbde7[_0x448545];return _0x4e7c06;};'use strict';var _=require(_0x7bde('0x0'));var moment=require(_0x7bde('0x1'));var util=require(_0x7bde('0x2'));var Redis=require(_0x7bde('0x3'));var config=require(_0x7bde('0x4'));var logger=require(_0x7bde('0x5'))(_0x7bde('0x6'));var ami=require(_0x7bde('0x7'));config[_0x7bde('0x8')]=_[_0x7bde('0x9')](config[_0x7bde('0x8')],{'host':_0x7bde('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x7bde('0x8')]));function VoiceAgentReport(_0x29e5e3){this[_0x7bde('0xb')]={};this[_0x7bde('0xc')]=_0x29e5e3[_0x7bde('0xb')];this['voiceQueues']=_0x29e5e3['voiceQueues'];this[_0x7bde('0xd')]=_0x29e5e3[_0x7bde('0xd')];this[_0x7bde('0xe')]={};ami['on'](_0x7bde('0xf'),this['syncAgentCalled'][_0x7bde('0x10')](this));ami['on'](_0x7bde('0x11'),this[_0x7bde('0x12')][_0x7bde('0x10')](this));ami['on'](_0x7bde('0x13'),this[_0x7bde('0x14')][_0x7bde('0x10')](this));ami['on'](_0x7bde('0x15'),this[_0x7bde('0x16')][_0x7bde('0x10')](this));ami['on'](_0x7bde('0x17'),this[_0x7bde('0x18')][_0x7bde('0x10')](this));ami['on'](_0x7bde('0x19'),this[_0x7bde('0x1a')][_0x7bde('0x10')](this));ami['on'](_0x7bde('0x1b'),this[_0x7bde('0x1c')]['bind'](this));ami['on'](_0x7bde('0x1d'),this['syncMusicOnHoldStart'][_0x7bde('0x10')](this));ami['on']('musiconholdstop',this[_0x7bde('0x1e')]['bind'](this));ami['on']('attendedtransfer',this[_0x7bde('0x1f')][_0x7bde('0x10')](this));ami['on'](_0x7bde('0x20'),this[_0x7bde('0x21')][_0x7bde('0x10')](this));}VoiceAgentReport[_0x7bde('0x22')][_0x7bde('0x23')]=function(_0x2b11ac,_0x3667e0,_0x232ecf){io['to'](_0x2b11ac)['emit'](_0x3667e0,_0x232ecf);};VoiceAgentReport[_0x7bde('0x22')][_0x7bde('0x24')]=function(_0x385393){return _0x385393!==null&&!_[_0x7bde('0x25')](_0x385393);};VoiceAgentReport['prototype']['syncAgentCalled']=function(_0x2d8729){try{if(this['isNotNull'](_0x2d8729)){logger[_0x7bde('0x26')](_0x7bde('0x27'),_0x2d8729['uniqueid'],_0x2d8729[_0x7bde('0x28')],_0x2d8729[_0x7bde('0x29')]);logger['debug']('[%s][voiceAgentReport][agentcalled]\x20event:',_0x2d8729[_0x7bde('0x2a')],util[_0x7bde('0x2b')](_0x2d8729,{'showHidden':![],'depth':null}));if(_[_0x7bde('0x25')](this[_0x7bde('0xb')][_0x2d8729[_0x7bde('0x2a')]])){this[_0x7bde('0xb')][_0x2d8729['uniqueid']]={};}var _0x58969e=this[_0x7bde('0xd')][_0x2d8729[_0x7bde('0x2c')]];var _0x1457d5=this[_0x7bde('0xb')][_0x2d8729[_0x7bde('0x2a')]][_0x2d8729[_0x7bde('0x29')]];var _0x41be22=this[_0x7bde('0x2d')][_0x2d8729[_0x7bde('0x2e')]];var _0x36b581=this[_0x7bde('0xe')][_0x2d8729['uniqueid']];if(_[_0x7bde('0x25')](_0x1457d5)){_0x1457d5={'agentcalledAt':moment()['format'](_0x7bde('0x2f')),'lastevent':_0x7bde('0x30'),'mandatoryDisposition':_0x41be22&&_0x41be22[_0x7bde('0x31')]?_0x41be22['mandatoryDisposition']:![],'type':_0x41be22&&_0x41be22[_0x7bde('0x32')]?_0x41be22[_0x7bde('0x32')]:'inbound','variables':_0x36b581,'motionChannel':_0x7bde('0x33')};}Object[_0x7bde('0x34')](_0x1457d5,_[_0x7bde('0x35')](_0x2d8729,[_0x7bde('0x36'),_0x7bde('0x37')]));this[_0x7bde('0xb')][_0x2d8729[_0x7bde('0x2a')]][_0x2d8729[_0x7bde('0x29')]]=_0x1457d5;logger['debug']('[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:',_0x2d8729[_0x7bde('0x2a')],util[_0x7bde('0x2b')](_0x1457d5,{'showHidden':![],'depth':null}));ami[_0x7bde('0x23')](_0x7bde('0x38'),_0x1457d5);var _0x51c7f4={'id':_0x58969e['id'],'calleridnum':_0x1457d5[_0x7bde('0x39')],'queue':_0x1457d5[_0x7bde('0x2e')],'variables':_0x1457d5[_0x7bde('0xe')],'uniqueid':_0x2d8729['uniqueid']};logger[_0x7bde('0x3a')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:',_0x2d8729[_0x7bde('0x2a')],util[_0x7bde('0x2b')](_0x51c7f4,{'showHidden':![],'depth':null}));this[_0x7bde('0x23')](util[_0x7bde('0x3b')]('user:%s',_0x2d8729[_0x7bde('0x28')]),_0x7bde('0x3c'),_0x51c7f4);}}catch(_0x8bb9ed){logger['error'](_0x7bde('0x3d'),_0x2d8729[_0x7bde('0x2a')],util[_0x7bde('0x2b')](_0x8bb9ed,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7bde('0x22')][_0x7bde('0x12')]=function(_0xa36e29){try{if(this['isNotNull'](_0xa36e29)){if(this[_0x7bde('0xb')][_0xa36e29[_0x7bde('0x2a')]]){for(var _0x38376b in this['channels'][_0xa36e29['uniqueid']]){if(this[_0x7bde('0xb')][_0xa36e29['uniqueid']][_0x7bde('0x3e')](_0x38376b)){if(_0xa36e29[_0x7bde('0x29')]===_0x38376b){logger[_0x7bde('0x26')](_0x7bde('0x3f'),_0xa36e29['uniqueid'],_0xa36e29[_0x7bde('0x28')],_0xa36e29[_0x7bde('0x29')]);this[_0x7bde('0xb')][_0xa36e29['uniqueid']][_0x38376b]['agentconnectAt']=moment()[_0x7bde('0x3b')](_0x7bde('0x2f'));this[_0x7bde('0xb')][_0xa36e29[_0x7bde('0x2a')]][_0x38376b][_0x7bde('0x40')]=_0xa36e29[_0x7bde('0x40')];this[_0x7bde('0xb')][_0xa36e29['uniqueid']][_0x38376b]['connectedlinenum']=_0xa36e29[_0x7bde('0x41')];this[_0x7bde('0xb')][_0xa36e29[_0x7bde('0x2a')]][_0x38376b]['destchannelstate']=_0xa36e29[_0x7bde('0x42')];this['channels'][_0xa36e29[_0x7bde('0x2a')]][_0x38376b]['destchannelstatedesc']=_0xa36e29[_0x7bde('0x43')];this[_0x7bde('0xb')][_0xa36e29[_0x7bde('0x2a')]][_0x38376b][_0x7bde('0x44')]=_0xa36e29[_0x7bde('0x44')];this['channels'][_0xa36e29[_0x7bde('0x2a')]][_0x38376b][_0x7bde('0x45')]='connect';if(this[_0x7bde('0xc')][this['channels'][_0xa36e29['uniqueid']][_0x38376b][_0x7bde('0x2a')]]){var _0x2cda92=this[_0x7bde('0xc')][this[_0x7bde('0xb')][_0xa36e29[_0x7bde('0x2a')]][_0x38376b][_0x7bde('0x2a')]][_0x7bde('0x46')];this[_0x7bde('0xb')][_0xa36e29['uniqueid']][_0x38376b]['routealias']=_0x2cda92;_0xa36e29[_0x7bde('0x46')]=_0x2cda92;}_[_0x7bde('0x47')](this[_0x7bde('0xd')][_0xa36e29[_0x7bde('0x2c')]],_[_0x7bde('0x48')](_0xa36e29,['queue',_0x7bde('0x49'),_0x7bde('0x46')]));var _0x1c0e48=this[_0x7bde('0xd')][_0xa36e29[_0x7bde('0x2c')]];var _0x556e77={'id':_0x1c0e48['id'],'name':_0x1c0e48[_0x7bde('0x4a')],'agentconnected':!![],'destaccountcode':_0x1c0e48[_0x7bde('0x4b')],'destconnectedlinenum':this[_0x7bde('0xb')][_0xa36e29[_0x7bde('0x2a')]][_0xa36e29['destuniqueid']][_0x7bde('0x4c')],'queue':this['channels'][_0xa36e29[_0x7bde('0x2a')]][_0xa36e29[_0x7bde('0x29')]][_0x7bde('0x2e')],'routealias':this['channels'][_0xa36e29[_0x7bde('0x2a')]][_0xa36e29[_0x7bde('0x29')]][_0x7bde('0x46')],'uniqueid':this[_0x7bde('0xb')][_0xa36e29[_0x7bde('0x2a')]][_0xa36e29[_0x7bde('0x29')]]['uniqueid']};ami[_0x7bde('0x23')](_0x7bde('0x4d'),this[_0x7bde('0xb')][_0xa36e29[_0x7bde('0x2a')]][_0xa36e29[_0x7bde('0x29')]]);this[_0x7bde('0x23')](util[_0x7bde('0x3b')](_0x7bde('0x4e'),_0xa36e29['membername']),_0x7bde('0x4f'),_0x556e77);}else if(!this[_0x7bde('0xb')][_0xa36e29[_0x7bde('0x2a')]][_0x38376b][_0x7bde('0x13')]&&!this[_0x7bde('0xb')][_0xa36e29[_0x7bde('0x2a')]][_0x38376b][_0x7bde('0x17')]){logger[_0x7bde('0x26')](_0x7bde('0x50'),_0xa36e29[_0x7bde('0x2a')],this[_0x7bde('0xb')][_0xa36e29[_0x7bde('0x2a')]][_0x38376b][_0x7bde('0x28')],_0x38376b);this[_0x7bde('0xb')][_0xa36e29['uniqueid']][_0x38376b][_0x7bde('0x13')]=!![];this['channels'][_0xa36e29[_0x7bde('0x2a')]][_0x38376b][_0x7bde('0x51')]=moment()[_0x7bde('0x3b')](_0x7bde('0x2f'));this[_0x7bde('0xb')][_0xa36e29[_0x7bde('0x2a')]][_0x38376b][_0x7bde('0x52')]=_0xa36e29[_0x7bde('0x29')];this[_0x7bde('0xb')][_0xa36e29[_0x7bde('0x2a')]][_0x38376b]['answeredelsewheremembername']=_0xa36e29[_0x7bde('0x28')];this[_0x7bde('0xb')][_0xa36e29[_0x7bde('0x2a')]][_0x38376b][_0x7bde('0x45')]=_0x7bde('0x53');this[_0x7bde('0xb')][_0xa36e29[_0x7bde('0x2a')]][_0x38376b][_0x7bde('0x54')]='answered_elsewhere';logger[_0x7bde('0x3a')](_0x7bde('0x55'),_0xa36e29[_0x7bde('0x2a')],util[_0x7bde('0x2b')](this[_0x7bde('0xb')][_0xa36e29['uniqueid']][_0x38376b],{'showHidden':![],'depth':null}));ami['emit'](_0x7bde('0x56'),this[_0x7bde('0xb')][_0xa36e29[_0x7bde('0x2a')]][_0x38376b]);}else{logger[_0x7bde('0x3a')]('[%s][voiceAgentReport][agentconnect]\x20Else\x20path\x20should\x20never\x20be\x20taken',_0xa36e29[_0x7bde('0x2a')]);}}}}}}catch(_0x4f88d9){logger['error'](_0x7bde('0x57'),_0xa36e29[_0x7bde('0x2a')],util[_0x7bde('0x2b')](_0x4f88d9,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7bde('0x22')][_0x7bde('0x14')]=function(_0x7bd51f){try{if(this[_0x7bde('0x24')](_0x7bd51f)){logger[_0x7bde('0x3a')](_0x7bde('0x58'),_0x7bd51f['uniqueid'],util[_0x7bde('0x2b')](_0x7bd51f,{'showHidden':![],'depth':null}));if(this[_0x7bde('0xb')][_0x7bd51f['uniqueid']]&&this[_0x7bde('0xb')][_0x7bd51f[_0x7bde('0x2a')]][_0x7bd51f['destuniqueid']]){logger[_0x7bde('0x26')](_0x7bde('0x59'),_0x7bd51f['uniqueid'],_0x7bd51f[_0x7bde('0x28')],_0x7bd51f[_0x7bde('0x29')]);var _0x483c28=this[_0x7bde('0xd')][_0x7bd51f['interface']];var _0x1265c5=this[_0x7bde('0xb')][_0x7bd51f['uniqueid']][_0x7bd51f[_0x7bde('0x29')]];_0x1265c5[_0x7bde('0x13')]=!![];_0x1265c5['agentringnoanswerAt']=moment()[_0x7bde('0x3b')]('YYYY-MM-DD\x20HH:mm:ss');_0x1265c5['lastevent']='rejected';_0x1265c5[_0x7bde('0x54')]=_0x7bde('0x5a');var _0x112924={'id':_0x483c28['id'],'name':_0x483c28[_0x7bde('0x4a')],'queue':_0x1265c5['queue'],'uniqueid':_0x1265c5[_0x7bde('0x2a')]};logger[_0x7bde('0x3a')](_0x7bde('0x5b'),_0x7bd51f[_0x7bde('0x2a')],util[_0x7bde('0x2b')](_0x112924,{'showHidden':![],'depth':null}));this[_0x7bde('0x23')](util['format'](_0x7bde('0x4e'),_0x483c28['name']),_0x7bde('0x5c'),_0x112924);ami[_0x7bde('0x23')](_0x7bde('0x5d'),_0x1265c5);this[_0x7bde('0xb')][_0x7bd51f[_0x7bde('0x2a')]][_0x7bd51f[_0x7bde('0x29')]]=Object[_0x7bde('0x34')]({},_0x1265c5);}}}catch(_0x4d4ca3){logger[_0x7bde('0x5e')](_0x7bde('0x5f'),_0x7bd51f[_0x7bde('0x2a')],util[_0x7bde('0x2b')](_0x4d4ca3,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7bde('0x22')][_0x7bde('0x16')]=function(_0x57bdc6){try{if(this['isNotNull'](_0x57bdc6)){logger[_0x7bde('0x3a')](_0x7bde('0x60'),_0x57bdc6['uniqueid'],util[_0x7bde('0x2b')](_0x57bdc6,{'showHidden':![],'depth':null}));if(this[_0x7bde('0xb')][_0x57bdc6['uniqueid']]){for(var _0x37ee1d in this[_0x7bde('0xb')][_0x57bdc6['uniqueid']]){if(this['channels'][_0x57bdc6[_0x7bde('0x2a')]][_0x7bde('0x3e')](_0x37ee1d)&&!this[_0x7bde('0xb')][_0x57bdc6[_0x7bde('0x2a')]][_0x37ee1d][_0x7bde('0x13')]&&!this[_0x7bde('0xb')][_0x57bdc6['uniqueid']][_0x37ee1d][_0x7bde('0x17')]){logger[_0x7bde('0x26')](_0x7bde('0x61'),_0x57bdc6['uniqueid'],this[_0x7bde('0xb')][_0x57bdc6[_0x7bde('0x2a')]][_0x37ee1d][_0x7bde('0x28')],_0x37ee1d);this['channels'][_0x57bdc6[_0x7bde('0x2a')]][_0x37ee1d][_0x7bde('0x13')]=!![];this[_0x7bde('0xb')][_0x57bdc6[_0x7bde('0x2a')]][_0x37ee1d][_0x7bde('0x51')]=moment()[_0x7bde('0x3b')](_0x7bde('0x2f'));this[_0x7bde('0xb')][_0x57bdc6[_0x7bde('0x2a')]][_0x37ee1d][_0x7bde('0x45')]=_0x7bde('0x62');this[_0x7bde('0xb')][_0x57bdc6[_0x7bde('0x2a')]][_0x37ee1d][_0x7bde('0x54')]=_0x7bde('0x62');logger['debug'](_0x7bde('0x63'),_0x57bdc6[_0x7bde('0x2a')],util[_0x7bde('0x2b')](this[_0x7bde('0xb')][_0x57bdc6[_0x7bde('0x2a')]][_0x37ee1d],{'showHidden':![],'depth':null}));ami[_0x7bde('0x23')](_0x7bde('0x64'),this[_0x7bde('0xb')][_0x57bdc6['uniqueid']][_0x37ee1d]);}}}}}catch(_0x5ca834){logger['error']('[%s][voiceAgentReport][queuecallerabandon]',_0x57bdc6[_0x7bde('0x2a')],util[_0x7bde('0x2b')](_0x5ca834,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x7bde('0x18')]=function(_0x359060){try{if(this[_0x7bde('0x24')](_0x359060)){logger['debug'](_0x7bde('0x65'),_0x359060[_0x7bde('0x2a')],util[_0x7bde('0x2b')](_0x359060,{'showHidden':![],'depth':null}));if(this[_0x7bde('0xb')][_0x359060[_0x7bde('0x2a')]]){for(var _0xc92dac in this[_0x7bde('0xb')][_0x359060[_0x7bde('0x2a')]]){if(this['channels'][_0x359060[_0x7bde('0x2a')]][_0x7bde('0x3e')](_0xc92dac)){if(this[_0x7bde('0xb')][_0x359060[_0x7bde('0x2a')]][_0xc92dac]['agentconnectAt']&&!this[_0x7bde('0xb')][_0x359060[_0x7bde('0x2a')]][_0xc92dac][_0x7bde('0x17')]){logger[_0x7bde('0x26')](_0x7bde('0x66'),_0x359060['uniqueid'],this[_0x7bde('0xb')][_0x359060[_0x7bde('0x2a')]][_0xc92dac]['membername'],_0xc92dac);this[_0x7bde('0xb')][_0x359060[_0x7bde('0x2a')]][_0xc92dac]['agentcomplete']=!![];this[_0x7bde('0xb')][_0x359060[_0x7bde('0x2a')]][_0xc92dac][_0x7bde('0x67')]=moment()[_0x7bde('0x3b')](_0x7bde('0x2f'));this[_0x7bde('0xb')][_0x359060[_0x7bde('0x2a')]][_0xc92dac]['lastevent']=_0x7bde('0x68');this[_0x7bde('0xb')][_0x359060[_0x7bde('0x2a')]][_0xc92dac][_0x7bde('0x54')]=_0x359060[_0x7bde('0x54')]==_0x7bde('0x69')?_0x7bde('0x6a'):_0x359060[_0x7bde('0x54')];this[_0x7bde('0xb')][_0x359060['uniqueid']][_0xc92dac][_0x7bde('0x6b')]=_0x359060['talktime'];if(this[_0x7bde('0x2d')][_0x359060['queue']]&&this[_0x7bde('0x2d')][_0x359060['queue']][_0x7bde('0x6c')]){this['channels'][_0x359060[_0x7bde('0x2a')]][_0xc92dac][_0x7bde('0x6d')]=this[_0x7bde('0x2d')][_0x359060[_0x7bde('0x2e')]][_0x7bde('0x6e')];this[_0x7bde('0xb')][_0x359060[_0x7bde('0x2a')]][_0xc92dac][_0x7bde('0x6f')]=!![];}this[_0x7bde('0xd')][_0x359060['interface']]=_[_0x7bde('0x35')](this['agents'][_0x359060[_0x7bde('0x2c')]],['queue','destconnectedlinenum']);logger['debug']('[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:',_0x359060['uniqueid'],util['inspect'](this[_0x7bde('0xb')][_0x359060[_0x7bde('0x2a')]][_0xc92dac],{'showHidden':![],'depth':null}));ami[_0x7bde('0x23')]('custom:agentcomplete',this[_0x7bde('0xb')][_0x359060['uniqueid']][_0xc92dac]);logger[_0x7bde('0x3a')](_0x7bde('0x70'),_0x359060['uniqueid'],util['inspect']({'id':this[_0x7bde('0xd')][_0x359060[_0x7bde('0x2c')]]['id'],'destaccountcode':_0x359060['destaccountcode']},{'showHidden':![],'depth':null}));this['emit'](util[_0x7bde('0x3b')]('user:%s',_0x359060[_0x7bde('0x28')]),'user:agentcomplete',{'id':this['agents'][_0x359060[_0x7bde('0x2c')]]['id'],'destaccountcode':Number(_0x359060[_0x7bde('0x71')])});}}}}}}catch(_0x249ad7){logger[_0x7bde('0x5e')]('[%s][voiceAgentReport][agentcomplete]',_0x359060[_0x7bde('0x2a')],util['inspect'](_0x249ad7,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x7bde('0x1a')]=function(_0x443b2d){try{if(this['isNotNull'](_0x443b2d)){logger['debug'](_0x7bde('0x72'),_0x443b2d[_0x7bde('0x2a')],util['inspect'](_0x443b2d,{'showHidden':![],'depth':null}));this[_0x7bde('0x73')](_0x443b2d[_0x7bde('0x2a')],_[_0x7bde('0x74')](_0x443b2d['variable'])[0x0],_0x443b2d[_0x7bde('0x75')]);if(this['channels'][_0x443b2d['uniqueid']]){for(var _0x257f39 in this['channels'][_0x443b2d[_0x7bde('0x2a')]]){if(this[_0x7bde('0xb')][_0x443b2d[_0x7bde('0x2a')]][_0x7bde('0x3e')](_0x257f39)){logger[_0x7bde('0x26')]('[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s',_0x443b2d[_0x7bde('0x2a')],_0x257f39,_[_0x7bde('0x74')](_0x443b2d[_0x7bde('0x76')])[0x0],_0x443b2d[_0x7bde('0x75')]);if(_[_0x7bde('0x25')](this[_0x7bde('0xb')][_0x443b2d[_0x7bde('0x2a')]][_0x257f39][_0x7bde('0xe')])){this['channels'][_0x443b2d['uniqueid']][_0x257f39]['variables']={};}this[_0x7bde('0xb')][_0x443b2d['uniqueid']][_0x257f39][_0x7bde('0xe')]=this[_0x7bde('0xe')][_0x443b2d['uniqueid']];}}}}}catch(_0xcde862){logger['error']('[%s][voiceAgentReport][varset]',_0x443b2d[_0x7bde('0x2a')],util[_0x7bde('0x2b')](_0xcde862,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7bde('0x22')]['addVariable']=function(_0x884761,_0x428cdd,_0x27fe3f){var _0x76f981=[_0x7bde('0x77'),_0x7bde('0x78'),_0x7bde('0x79'),'rtpaudioqosjitterbridged','rtpaudioqosloss',_0x7bde('0x7a'),_0x7bde('0x7b'),_0x7bde('0x7c'),_0x7bde('0x7d'),'sipuri',_0x7bde('0x7e'),_0x7bde('0x7f'),_0x7bde('0x80'),_0x7bde('0x81'),_0x7bde('0x82'),_0x7bde('0x83'),_0x7bde('0x28'),_0x7bde('0x84'),_0x7bde('0x85')];if(!_[_0x7bde('0x86')](_0x428cdd)&&!_[_0x7bde('0x87')](_0x76f981,_0x428cdd)){if(_[_0x7bde('0x25')](this[_0x7bde('0xe')][_0x884761])){this[_0x7bde('0xe')][_0x884761]={};}this[_0x7bde('0xe')][_0x884761][_0x428cdd]=_0x27fe3f;}};VoiceAgentReport[_0x7bde('0x22')][_0x7bde('0x1c')]=function(_0x256d44){try{if(this[_0x7bde('0x24')](_0x256d44)){logger['debug'](_0x7bde('0x88'),_0x256d44['uniqueid'],util['inspect'](_0x256d44,{'showHidden':![],'depth':null}));if(this['channels'][_0x256d44[_0x7bde('0x2a')]]){for(var _0x3ef742 in this['channels'][_0x256d44[_0x7bde('0x2a')]]){if(this[_0x7bde('0xb')][_0x256d44[_0x7bde('0x2a')]]['hasOwnProperty'](_0x3ef742)){if(this[_0x7bde('0xb')][_0x256d44[_0x7bde('0x2a')]][_0x3ef742][_0x7bde('0x54')]==_0x7bde('0x69')&&this[_0x7bde('0xb')][_0x256d44[_0x7bde('0x2a')]][_0x3ef742][_0x7bde('0x17')]){logger[_0x7bde('0x26')]('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x256d44[_0x7bde('0x2a')],_0x3ef742);this[_0x7bde('0xb')][_0x256d44[_0x7bde('0x2a')]][_0x3ef742][_0x7bde('0x67')]=moment()[_0x7bde('0x3b')](_0x7bde('0x2f'));}}}logger[_0x7bde('0x3a')]('[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:',_0x256d44['uniqueid'],util[_0x7bde('0x2b')](_['values'](this[_0x7bde('0xb')][_0x256d44[_0x7bde('0x2a')]]),{'showHidden':![],'depth':null}));ami[_0x7bde('0x23')](_0x7bde('0x89'),_[_0x7bde('0x8a')](this['channels'][_0x256d44[_0x7bde('0x2a')]]));delete this[_0x7bde('0xb')][_0x256d44[_0x7bde('0x2a')]];}if(this[_0x7bde('0xe')][_0x256d44[_0x7bde('0x2a')]]){delete this[_0x7bde('0xe')][_0x256d44[_0x7bde('0x2a')]];}}}catch(_0x32810c){logger['error'](_0x7bde('0x8b'),_0x256d44['uniqueid'],util[_0x7bde('0x2b')](_0x32810c,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x7bde('0x1f')]=function(_0x440f47){try{if(this['isNotNull'](_0x440f47)){logger[_0x7bde('0x3a')](_0x7bde('0x8c'),_0x440f47['uniqueid'],util['inspect'](_0x440f47,{'showHidden':![],'depth':null}));if(this[_0x7bde('0xb')][_0x440f47[_0x7bde('0x8d')]]){for(var _0xe8cca1 in this[_0x7bde('0xb')][_0x440f47[_0x7bde('0x8d')]]){if(this[_0x7bde('0xb')][_0x440f47[_0x7bde('0x8d')]][_0x7bde('0x3e')](_0xe8cca1)){if(_0x440f47[_0x7bde('0x8e')]===_0xe8cca1){logger[_0x7bde('0x26')](_0x7bde('0x8f'),_0x440f47['uniqueid'],this[_0x7bde('0xb')][_0x440f47[_0x7bde('0x8d')]][_0xe8cca1][_0x7bde('0x28')],_0xe8cca1);var _0x1cc11e=moment();this[_0x7bde('0xb')][_0x440f47[_0x7bde('0x8d')]][_0xe8cca1]['agentcomplete']=!![];this[_0x7bde('0xb')][_0x440f47['transfereeuniqueid']][_0xe8cca1][_0x7bde('0x67')]=moment()[_0x7bde('0x3b')](_0x7bde('0x2f'));this[_0x7bde('0xb')][_0x440f47[_0x7bde('0x8d')]][_0xe8cca1][_0x7bde('0x45')]=_0x7bde('0x68');this[_0x7bde('0xb')][_0x440f47[_0x7bde('0x8d')]][_0xe8cca1][_0x7bde('0x54')]=_0x7bde('0x69');this['channels'][_0x440f47[_0x7bde('0x8d')]][_0xe8cca1][_0x7bde('0x6b')]=_0x1cc11e[_0x7bde('0x90')](this[_0x7bde('0xb')][_0x440f47[_0x7bde('0x8d')]][_0xe8cca1][_0x7bde('0x91')],_0x7bde('0x92'));}}}}if(this[_0x7bde('0xb')][_0x440f47['secondtransfereruniqueid']]){var _0x14d1df=this['channels'][_0x440f47[_0x7bde('0x93')]];this[_0x7bde('0xb')][_0x440f47[_0x7bde('0x93')]]=this['channels'][_0x440f47[_0x7bde('0x8d')]];this[_0x7bde('0xb')][_0x440f47[_0x7bde('0x8d')]]=_0x14d1df;}}}catch(_0x518c3a){logger['error']('[%s][voiceAgentReport][attendedtransfer]',_0x440f47[_0x7bde('0x2a')],util['inspect'](_0x518c3a,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7bde('0x22')][_0x7bde('0x21')]=function(_0x4ff2ae){try{if(this[_0x7bde('0x24')](_0x4ff2ae)){logger['debug'](_0x7bde('0x94'),_0x4ff2ae['uniqueid'],util[_0x7bde('0x2b')](_0x4ff2ae,{'showHidden':![],'depth':null}));if(this[_0x7bde('0xb')][_0x4ff2ae[_0x7bde('0x8d')]]){for(var _0x1337db in this[_0x7bde('0xb')][_0x4ff2ae[_0x7bde('0x8d')]]){if(this[_0x7bde('0xb')][_0x4ff2ae[_0x7bde('0x8d')]]['hasOwnProperty'](_0x1337db)){if(_0x4ff2ae['transfereruniqueid']===_0x1337db){logger[_0x7bde('0x26')](_0x7bde('0x95'),_0x4ff2ae[_0x7bde('0x2a')],this['channels'][_0x4ff2ae[_0x7bde('0x8d')]][_0x1337db]['membername'],_0x1337db);var _0x49bcae=moment();this[_0x7bde('0xb')][_0x4ff2ae[_0x7bde('0x8d')]][_0x1337db][_0x7bde('0x17')]=!![];this[_0x7bde('0xb')][_0x4ff2ae[_0x7bde('0x8d')]][_0x1337db]['agentcompleteAt']=_0x49bcae;this[_0x7bde('0xb')][_0x4ff2ae[_0x7bde('0x8d')]][_0x1337db][_0x7bde('0x45')]=_0x7bde('0x68');this['channels'][_0x4ff2ae['transfereeuniqueid']][_0x1337db][_0x7bde('0x54')]=_0x7bde('0x69');this['channels'][_0x4ff2ae[_0x7bde('0x8d')]][_0x1337db][_0x7bde('0x6b')]=_0x49bcae[_0x7bde('0x90')](this[_0x7bde('0xb')][_0x4ff2ae[_0x7bde('0x8d')]][_0x1337db][_0x7bde('0x91')],_0x7bde('0x92'));}}}}}}catch(_0x4fbab4){logger[_0x7bde('0x5e')]('[%s][voiceAgentReport][blindtransfer]',_0x4ff2ae[_0x7bde('0x2a')],util[_0x7bde('0x2b')](_0x4fbab4,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x7bde('0x96')]=function(_0x45851c){var _0x386fff='';try{if(this[_0x7bde('0x24')](_0x45851c)){logger[_0x7bde('0x3a')](_0x7bde('0x97'),_0x45851c[_0x7bde('0x2a')],util[_0x7bde('0x2b')](_0x45851c,{'showHidden':![],'depth':null}));if(_0x45851c['channel']){_0x386fff=_0x45851c[_0x7bde('0x98')][_0x7bde('0x99')](0x0,_0x45851c[_0x7bde('0x98')][_0x7bde('0x9a')]('-'));if(this[_0x7bde('0xd')][_0x386fff]){logger[_0x7bde('0x26')]('[%s][voiceAgentReport][musiconholdstart]\x20interface:%s',_0x45851c[_0x7bde('0x2a')],_0x386fff);this['agents'][_0x386fff][_0x7bde('0x9b')]=!![];}}}}catch(_0x1529e4){logger[_0x7bde('0x5e')](_0x7bde('0x9c'),_0x45851c[_0x7bde('0x2a')],util[_0x7bde('0x2b')](_0x1529e4,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7bde('0x22')][_0x7bde('0x1e')]=function(_0x530768){var _0x5389c7='';try{if(this[_0x7bde('0x24')](_0x530768)){logger[_0x7bde('0x3a')](_0x7bde('0x9d'),_0x530768['uniqueid'],util['inspect'](_0x530768,{'showHidden':![],'depth':null}));if(_0x530768[_0x7bde('0x98')]){_0x5389c7=_0x530768[_0x7bde('0x98')][_0x7bde('0x99')](0x0,_0x530768[_0x7bde('0x98')][_0x7bde('0x9a')]('-'));if(this['agents'][_0x5389c7]){logger[_0x7bde('0x26')](_0x7bde('0x9e'),_0x530768[_0x7bde('0x2a')],_0x5389c7);this[_0x7bde('0xd')][_0x5389c7]['onhold']=![];}}}}catch(_0x4bc1fc){logger[_0x7bde('0x5e')](_0x7bde('0x9f'),_0x530768[_0x7bde('0x2a')],util[_0x7bde('0x2b')](_0x4bc1fc,{'showHidden':![],'depth':null}));}};module['exports']=VoiceAgentReport; \ No newline at end of file +var _0xa9f1=['values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','talktime','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','onhold','exports','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','defaults','redis','localhost','channels','voiceChannels','voiceQueues','agents','variables','syncAgentCalled','bind','agentconnect','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','queue','YYYY-MM-DD\x20HH:mm:ss','called','mandatoryDisposition','type','inbound','assign','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','calleridnum','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','format','user:%s','user:called','error','info','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','connect','routealias','merge','pick','destconnectedlinenum','accountcode','exten','custom:agentconnect','user:agentconnect','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answeredelsewheredestinationuniqueid','answeredelsewheremembername','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','interface','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','name','user:agentringnoanswer','custom:agentringnoanswer','[%s][voiceAgentReport][queuecallerabandon]\x20event:','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','hasOwnProperty','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','complete','transfer','agent','acwtime','acwTimeout','agentacw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','destaccountcode','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','variable','[%s][voiceAgentReport][varset]','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','membercalls','memberlastcall','memberpenalty','memberrealtime','includes','agentcompleteAt'];(function(_0x79dc51,_0x2ada04){var _0x108bc9=function(_0x17f11a){while(--_0x17f11a){_0x79dc51['push'](_0x79dc51['shift']());}};_0x108bc9(++_0x2ada04);}(_0xa9f1,0xb4));var _0x1a9f=function(_0x64ea63,_0x4c32d3){_0x64ea63=_0x64ea63-0x0;var _0x45d9a1=_0xa9f1[_0x64ea63];return _0x45d9a1;};'use strict';var _=require('lodash');var moment=require(_0x1a9f('0x0'));var util=require(_0x1a9f('0x1'));var Redis=require(_0x1a9f('0x2'));var config=require(_0x1a9f('0x3'));var logger=require(_0x1a9f('0x4'))(_0x1a9f('0x5'));var ami=require(_0x1a9f('0x6'));config['redis']=_[_0x1a9f('0x7')](config[_0x1a9f('0x8')],{'host':_0x1a9f('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1a9f('0x8')]));function VoiceAgentReport(_0x220a51){this[_0x1a9f('0xa')]={};this[_0x1a9f('0xb')]=_0x220a51[_0x1a9f('0xa')];this[_0x1a9f('0xc')]=_0x220a51[_0x1a9f('0xc')];this[_0x1a9f('0xd')]=_0x220a51[_0x1a9f('0xd')];this[_0x1a9f('0xe')]={};ami['on']('agentcalled',this[_0x1a9f('0xf')][_0x1a9f('0x10')](this));ami['on'](_0x1a9f('0x11'),this[_0x1a9f('0x12')][_0x1a9f('0x10')](this));ami['on'](_0x1a9f('0x13'),this[_0x1a9f('0x14')][_0x1a9f('0x10')](this));ami['on'](_0x1a9f('0x15'),this[_0x1a9f('0x16')][_0x1a9f('0x10')](this));ami['on'](_0x1a9f('0x17'),this[_0x1a9f('0x18')][_0x1a9f('0x10')](this));ami['on'](_0x1a9f('0x19'),this[_0x1a9f('0x1a')][_0x1a9f('0x10')](this));ami['on'](_0x1a9f('0x1b'),this[_0x1a9f('0x1c')]['bind'](this));ami['on'](_0x1a9f('0x1d'),this[_0x1a9f('0x1e')][_0x1a9f('0x10')](this));ami['on'](_0x1a9f('0x1f'),this[_0x1a9f('0x20')][_0x1a9f('0x10')](this));ami['on'](_0x1a9f('0x21'),this[_0x1a9f('0x22')][_0x1a9f('0x10')](this));ami['on']('blindtransfer',this[_0x1a9f('0x23')][_0x1a9f('0x10')](this));}VoiceAgentReport[_0x1a9f('0x24')][_0x1a9f('0x25')]=function(_0x573d2d,_0x580a1e,_0x241629){io['to'](_0x573d2d)[_0x1a9f('0x25')](_0x580a1e,_0x241629);};VoiceAgentReport[_0x1a9f('0x24')][_0x1a9f('0x26')]=function(_0x1a8789){return _0x1a8789!==null&&!_[_0x1a9f('0x27')](_0x1a8789);};VoiceAgentReport[_0x1a9f('0x24')]['syncAgentCalled']=function(_0x1a9b48){try{if(this[_0x1a9f('0x26')](_0x1a9b48)){logger['info'](_0x1a9f('0x28'),_0x1a9b48[_0x1a9f('0x29')],_0x1a9b48[_0x1a9f('0x2a')],_0x1a9b48[_0x1a9f('0x2b')]);logger[_0x1a9f('0x2c')](_0x1a9f('0x2d'),_0x1a9b48[_0x1a9f('0x29')],util[_0x1a9f('0x2e')](_0x1a9b48,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0x1a9f('0xa')][_0x1a9b48[_0x1a9f('0x29')]])){this[_0x1a9f('0xa')][_0x1a9b48['uniqueid']]={};}var _0x58873b=this[_0x1a9f('0xd')][_0x1a9b48['interface']];var _0x1c5151=this[_0x1a9f('0xa')][_0x1a9b48[_0x1a9f('0x29')]][_0x1a9b48[_0x1a9f('0x2b')]];var _0x4751ff=this[_0x1a9f('0xc')][_0x1a9b48[_0x1a9f('0x2f')]];var _0x97a123=this[_0x1a9f('0xe')][_0x1a9b48['uniqueid']];if(_['isUndefined'](_0x1c5151)){_0x1c5151={'agentcalledAt':moment()['format'](_0x1a9f('0x30')),'lastevent':_0x1a9f('0x31'),'mandatoryDisposition':_0x4751ff&&_0x4751ff[_0x1a9f('0x32')]?_0x4751ff[_0x1a9f('0x32')]:![],'type':_0x4751ff&&_0x4751ff[_0x1a9f('0x33')]?_0x4751ff['type']:_0x1a9f('0x34'),'variables':_0x97a123,'motionChannel':'voice'};}Object[_0x1a9f('0x35')](_0x1c5151,_['omit'](_0x1a9b48,['event','privilege']));this[_0x1a9f('0xa')][_0x1a9b48['uniqueid']][_0x1a9b48[_0x1a9f('0x2b')]]=_0x1c5151;logger['debug'](_0x1a9f('0x36'),_0x1a9b48['uniqueid'],util['inspect'](_0x1c5151,{'showHidden':![],'depth':null}));ami[_0x1a9f('0x25')]('custom:agentcalled',_0x1c5151);var _0x311c5a={'id':_0x58873b['id'],'calleridnum':_0x1c5151[_0x1a9f('0x37')],'queue':_0x1c5151[_0x1a9f('0x2f')],'variables':_0x1c5151[_0x1a9f('0xe')],'uniqueid':_0x1a9b48[_0x1a9f('0x29')]};logger[_0x1a9f('0x2c')](_0x1a9f('0x38'),_0x1a9b48[_0x1a9f('0x29')],util[_0x1a9f('0x2e')](_0x311c5a,{'showHidden':![],'depth':null}));this[_0x1a9f('0x25')](util[_0x1a9f('0x39')](_0x1a9f('0x3a'),_0x1a9b48[_0x1a9f('0x2a')]),_0x1a9f('0x3b'),_0x311c5a);}}catch(_0x105678){logger[_0x1a9f('0x3c')]('[%s][voiceAgentReport][agentcalled]',_0x1a9b48[_0x1a9f('0x29')],util[_0x1a9f('0x2e')](_0x105678,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x1a9f('0x12')]=function(_0x4a0bd5){try{if(this[_0x1a9f('0x26')](_0x4a0bd5)){if(this[_0x1a9f('0xa')][_0x4a0bd5[_0x1a9f('0x29')]]){for(var _0x2fd629 in this[_0x1a9f('0xa')][_0x4a0bd5['uniqueid']]){if(this[_0x1a9f('0xa')][_0x4a0bd5[_0x1a9f('0x29')]]['hasOwnProperty'](_0x2fd629)){if(_0x4a0bd5[_0x1a9f('0x2b')]===_0x2fd629){logger[_0x1a9f('0x3d')](_0x1a9f('0x3e'),_0x4a0bd5['uniqueid'],_0x4a0bd5[_0x1a9f('0x2a')],_0x4a0bd5[_0x1a9f('0x2b')]);this[_0x1a9f('0xa')][_0x4a0bd5[_0x1a9f('0x29')]][_0x2fd629][_0x1a9f('0x3f')]=moment()[_0x1a9f('0x39')](_0x1a9f('0x30'));this[_0x1a9f('0xa')][_0x4a0bd5['uniqueid']][_0x2fd629][_0x1a9f('0x40')]=_0x4a0bd5[_0x1a9f('0x40')];this[_0x1a9f('0xa')][_0x4a0bd5['uniqueid']][_0x2fd629][_0x1a9f('0x41')]=_0x4a0bd5[_0x1a9f('0x41')];this[_0x1a9f('0xa')][_0x4a0bd5['uniqueid']][_0x2fd629]['destchannelstate']=_0x4a0bd5[_0x1a9f('0x42')];this[_0x1a9f('0xa')][_0x4a0bd5[_0x1a9f('0x29')]][_0x2fd629][_0x1a9f('0x43')]=_0x4a0bd5[_0x1a9f('0x43')];this[_0x1a9f('0xa')][_0x4a0bd5[_0x1a9f('0x29')]][_0x2fd629][_0x1a9f('0x44')]=_0x4a0bd5[_0x1a9f('0x44')];this[_0x1a9f('0xa')][_0x4a0bd5[_0x1a9f('0x29')]][_0x2fd629][_0x1a9f('0x45')]=_0x1a9f('0x46');if(this[_0x1a9f('0xb')][this[_0x1a9f('0xa')][_0x4a0bd5['uniqueid']][_0x2fd629][_0x1a9f('0x29')]]){var _0x1a5605=this[_0x1a9f('0xb')][this[_0x1a9f('0xa')][_0x4a0bd5[_0x1a9f('0x29')]][_0x2fd629][_0x1a9f('0x29')]][_0x1a9f('0x47')];this[_0x1a9f('0xa')][_0x4a0bd5[_0x1a9f('0x29')]][_0x2fd629][_0x1a9f('0x47')]=_0x1a5605;_0x4a0bd5[_0x1a9f('0x47')]=_0x1a5605;}_[_0x1a9f('0x48')](this[_0x1a9f('0xd')][_0x4a0bd5['interface']],_[_0x1a9f('0x49')](_0x4a0bd5,['queue',_0x1a9f('0x4a'),_0x1a9f('0x47')]));var _0x3aa27c=this[_0x1a9f('0xd')][_0x4a0bd5['interface']];var _0x4f6852={'id':_0x3aa27c['id'],'name':_0x3aa27c['name'],'agentconnected':!![],'destaccountcode':_0x3aa27c[_0x1a9f('0x4b')],'destconnectedlinenum':this['channels'][_0x4a0bd5[_0x1a9f('0x29')]][_0x4a0bd5[_0x1a9f('0x2b')]][_0x1a9f('0x4c')],'queue':this[_0x1a9f('0xa')][_0x4a0bd5[_0x1a9f('0x29')]][_0x4a0bd5[_0x1a9f('0x2b')]][_0x1a9f('0x2f')],'routealias':this[_0x1a9f('0xa')][_0x4a0bd5['uniqueid']][_0x4a0bd5[_0x1a9f('0x2b')]][_0x1a9f('0x47')],'uniqueid':this[_0x1a9f('0xa')][_0x4a0bd5['uniqueid']][_0x4a0bd5[_0x1a9f('0x2b')]][_0x1a9f('0x29')]};ami[_0x1a9f('0x25')](_0x1a9f('0x4d'),this[_0x1a9f('0xa')][_0x4a0bd5['uniqueid']][_0x4a0bd5['destuniqueid']]);this[_0x1a9f('0x25')](util[_0x1a9f('0x39')](_0x1a9f('0x3a'),_0x4a0bd5['membername']),_0x1a9f('0x4e'),_0x4f6852);}else if(!this[_0x1a9f('0xa')][_0x4a0bd5[_0x1a9f('0x29')]][_0x2fd629][_0x1a9f('0x13')]&&!this[_0x1a9f('0xa')][_0x4a0bd5['uniqueid']][_0x2fd629][_0x1a9f('0x17')]){logger[_0x1a9f('0x3d')](_0x1a9f('0x4f'),_0x4a0bd5['uniqueid'],this[_0x1a9f('0xa')][_0x4a0bd5[_0x1a9f('0x29')]][_0x2fd629]['membername'],_0x2fd629);this['channels'][_0x4a0bd5[_0x1a9f('0x29')]][_0x2fd629][_0x1a9f('0x13')]=!![];this[_0x1a9f('0xa')][_0x4a0bd5[_0x1a9f('0x29')]][_0x2fd629][_0x1a9f('0x50')]=moment()[_0x1a9f('0x39')](_0x1a9f('0x30'));this[_0x1a9f('0xa')][_0x4a0bd5[_0x1a9f('0x29')]][_0x2fd629][_0x1a9f('0x51')]=_0x4a0bd5['destuniqueid'];this[_0x1a9f('0xa')][_0x4a0bd5[_0x1a9f('0x29')]][_0x2fd629][_0x1a9f('0x52')]=_0x4a0bd5[_0x1a9f('0x2a')];this[_0x1a9f('0xa')][_0x4a0bd5[_0x1a9f('0x29')]][_0x2fd629][_0x1a9f('0x45')]=_0x1a9f('0x53');this[_0x1a9f('0xa')][_0x4a0bd5[_0x1a9f('0x29')]][_0x2fd629][_0x1a9f('0x54')]=_0x1a9f('0x53');logger['debug'](_0x1a9f('0x55'),_0x4a0bd5[_0x1a9f('0x29')],util['inspect'](this[_0x1a9f('0xa')][_0x4a0bd5[_0x1a9f('0x29')]][_0x2fd629],{'showHidden':![],'depth':null}));ami[_0x1a9f('0x25')]('custom:agentansweredelsewhere',this[_0x1a9f('0xa')][_0x4a0bd5[_0x1a9f('0x29')]][_0x2fd629]);}else{logger[_0x1a9f('0x2c')]('[%s][voiceAgentReport][agentconnect]\x20Else\x20path\x20should\x20never\x20be\x20taken',_0x4a0bd5['uniqueid']);}}}}}}catch(_0x58c2a4){logger['error']('[%s][voiceAgentReport][agentconnect]',_0x4a0bd5[_0x1a9f('0x29')],util[_0x1a9f('0x2e')](_0x58c2a4,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1a9f('0x24')][_0x1a9f('0x14')]=function(_0x288937){try{if(this[_0x1a9f('0x26')](_0x288937)){logger['debug'](_0x1a9f('0x56'),_0x288937[_0x1a9f('0x29')],util[_0x1a9f('0x2e')](_0x288937,{'showHidden':![],'depth':null}));if(this[_0x1a9f('0xa')][_0x288937['uniqueid']]&&this[_0x1a9f('0xa')][_0x288937[_0x1a9f('0x29')]][_0x288937[_0x1a9f('0x2b')]]){logger[_0x1a9f('0x3d')](_0x1a9f('0x57'),_0x288937[_0x1a9f('0x29')],_0x288937[_0x1a9f('0x2a')],_0x288937[_0x1a9f('0x2b')]);var _0x4f49f6=this[_0x1a9f('0xd')][_0x288937[_0x1a9f('0x58')]];var _0x11f1b6=this[_0x1a9f('0xa')][_0x288937['uniqueid']][_0x288937[_0x1a9f('0x2b')]];_0x11f1b6[_0x1a9f('0x13')]=!![];_0x11f1b6[_0x1a9f('0x50')]=moment()[_0x1a9f('0x39')]('YYYY-MM-DD\x20HH:mm:ss');_0x11f1b6[_0x1a9f('0x45')]=_0x1a9f('0x59');_0x11f1b6['reason']='rejected';var _0x4d912f={'id':_0x4f49f6['id'],'name':_0x4f49f6['name'],'queue':_0x11f1b6['queue'],'uniqueid':_0x11f1b6['uniqueid']};logger[_0x1a9f('0x2c')](_0x1a9f('0x5a'),_0x288937[_0x1a9f('0x29')],util[_0x1a9f('0x2e')](_0x4d912f,{'showHidden':![],'depth':null}));this[_0x1a9f('0x25')](util[_0x1a9f('0x39')](_0x1a9f('0x3a'),_0x4f49f6[_0x1a9f('0x5b')]),_0x1a9f('0x5c'),_0x4d912f);ami['emit'](_0x1a9f('0x5d'),_0x11f1b6);this[_0x1a9f('0xa')][_0x288937[_0x1a9f('0x29')]][_0x288937[_0x1a9f('0x2b')]]=Object[_0x1a9f('0x35')]({},_0x11f1b6);}}}catch(_0x4fe0a0){logger[_0x1a9f('0x3c')]('[%s][voiceAgentReport][agentringnoanswer]',_0x288937[_0x1a9f('0x29')],util[_0x1a9f('0x2e')](_0x4fe0a0,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1a9f('0x24')][_0x1a9f('0x16')]=function(_0x494502){try{if(this[_0x1a9f('0x26')](_0x494502)){logger['debug'](_0x1a9f('0x5e'),_0x494502['uniqueid'],util['inspect'](_0x494502,{'showHidden':![],'depth':null}));if(this['channels'][_0x494502[_0x1a9f('0x29')]]){for(var _0x233aee in this[_0x1a9f('0xa')][_0x494502[_0x1a9f('0x29')]]){if(this[_0x1a9f('0xa')][_0x494502[_0x1a9f('0x29')]]['hasOwnProperty'](_0x233aee)&&!this[_0x1a9f('0xa')][_0x494502[_0x1a9f('0x29')]][_0x233aee]['agentringnoanswer']&&!this['channels'][_0x494502[_0x1a9f('0x29')]][_0x233aee]['agentcomplete']){logger[_0x1a9f('0x3d')]('[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x494502['uniqueid'],this[_0x1a9f('0xa')][_0x494502[_0x1a9f('0x29')]][_0x233aee]['membername'],_0x233aee);this[_0x1a9f('0xa')][_0x494502['uniqueid']][_0x233aee][_0x1a9f('0x13')]=!![];this[_0x1a9f('0xa')][_0x494502[_0x1a9f('0x29')]][_0x233aee][_0x1a9f('0x50')]=moment()[_0x1a9f('0x39')](_0x1a9f('0x30'));this[_0x1a9f('0xa')][_0x494502['uniqueid']][_0x233aee][_0x1a9f('0x45')]=_0x1a9f('0x5f');this[_0x1a9f('0xa')][_0x494502['uniqueid']][_0x233aee][_0x1a9f('0x54')]=_0x1a9f('0x5f');logger['debug'](_0x1a9f('0x60'),_0x494502[_0x1a9f('0x29')],util['inspect'](this[_0x1a9f('0xa')][_0x494502['uniqueid']][_0x233aee],{'showHidden':![],'depth':null}));ami[_0x1a9f('0x25')](_0x1a9f('0x61'),this['channels'][_0x494502['uniqueid']][_0x233aee]);}}}}}catch(_0x144dcc){logger[_0x1a9f('0x3c')](_0x1a9f('0x62'),_0x494502[_0x1a9f('0x29')],util[_0x1a9f('0x2e')](_0x144dcc,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1a9f('0x24')]['syncAgentComplete']=function(_0x17e697){try{if(this[_0x1a9f('0x26')](_0x17e697)){logger[_0x1a9f('0x2c')](_0x1a9f('0x63'),_0x17e697[_0x1a9f('0x29')],util['inspect'](_0x17e697,{'showHidden':![],'depth':null}));if(this[_0x1a9f('0xa')][_0x17e697[_0x1a9f('0x29')]]){for(var _0x3af8c3 in this[_0x1a9f('0xa')][_0x17e697[_0x1a9f('0x29')]]){if(this['channels'][_0x17e697[_0x1a9f('0x29')]][_0x1a9f('0x64')](_0x3af8c3)){if(this[_0x1a9f('0xa')][_0x17e697['uniqueid']][_0x3af8c3][_0x1a9f('0x3f')]&&!this[_0x1a9f('0xa')][_0x17e697[_0x1a9f('0x29')]][_0x3af8c3][_0x1a9f('0x17')]){logger[_0x1a9f('0x3d')](_0x1a9f('0x65'),_0x17e697[_0x1a9f('0x29')],this[_0x1a9f('0xa')][_0x17e697[_0x1a9f('0x29')]][_0x3af8c3][_0x1a9f('0x2a')],_0x3af8c3);this[_0x1a9f('0xa')][_0x17e697[_0x1a9f('0x29')]][_0x3af8c3]['agentcomplete']=!![];this[_0x1a9f('0xa')][_0x17e697[_0x1a9f('0x29')]][_0x3af8c3]['agentcompleteAt']=moment()[_0x1a9f('0x39')](_0x1a9f('0x30'));this['channels'][_0x17e697[_0x1a9f('0x29')]][_0x3af8c3][_0x1a9f('0x45')]=_0x1a9f('0x66');this['channels'][_0x17e697[_0x1a9f('0x29')]][_0x3af8c3][_0x1a9f('0x54')]=_0x17e697[_0x1a9f('0x54')]==_0x1a9f('0x67')?_0x1a9f('0x68'):_0x17e697['reason'];this['channels'][_0x17e697[_0x1a9f('0x29')]][_0x3af8c3]['talktime']=_0x17e697['talktime'];if(this[_0x1a9f('0xc')][_0x17e697[_0x1a9f('0x2f')]]&&this['voiceQueues'][_0x17e697['queue']]['acw']){this[_0x1a9f('0xa')][_0x17e697['uniqueid']][_0x3af8c3][_0x1a9f('0x69')]=this['voiceQueues'][_0x17e697['queue']][_0x1a9f('0x6a')];this[_0x1a9f('0xa')][_0x17e697[_0x1a9f('0x29')]][_0x3af8c3][_0x1a9f('0x6b')]=!![];}this[_0x1a9f('0xd')][_0x17e697[_0x1a9f('0x58')]]=_['omit'](this['agents'][_0x17e697[_0x1a9f('0x58')]],[_0x1a9f('0x2f'),_0x1a9f('0x4a')]);logger[_0x1a9f('0x2c')](_0x1a9f('0x6c'),_0x17e697[_0x1a9f('0x29')],util['inspect'](this[_0x1a9f('0xa')][_0x17e697[_0x1a9f('0x29')]][_0x3af8c3],{'showHidden':![],'depth':null}));ami[_0x1a9f('0x25')](_0x1a9f('0x6d'),this[_0x1a9f('0xa')][_0x17e697[_0x1a9f('0x29')]][_0x3af8c3]);logger[_0x1a9f('0x2c')](_0x1a9f('0x6e'),_0x17e697[_0x1a9f('0x29')],util[_0x1a9f('0x2e')]({'id':this[_0x1a9f('0xd')][_0x17e697[_0x1a9f('0x58')]]['id'],'destaccountcode':_0x17e697[_0x1a9f('0x6f')]},{'showHidden':![],'depth':null}));this['emit'](util['format'](_0x1a9f('0x3a'),_0x17e697[_0x1a9f('0x2a')]),_0x1a9f('0x70'),{'id':this['agents'][_0x17e697[_0x1a9f('0x58')]]['id'],'destaccountcode':Number(_0x17e697[_0x1a9f('0x6f')])});}}}}}}catch(_0x26acbf){logger[_0x1a9f('0x3c')](_0x1a9f('0x71'),_0x17e697[_0x1a9f('0x29')],util[_0x1a9f('0x2e')](_0x26acbf,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1a9f('0x24')]['syncVarSet']=function(_0x1a3654){try{if(this[_0x1a9f('0x26')](_0x1a3654)){logger[_0x1a9f('0x2c')](_0x1a9f('0x72'),_0x1a3654[_0x1a9f('0x29')],util['inspect'](_0x1a3654,{'showHidden':![],'depth':null}));this[_0x1a9f('0x73')](_0x1a3654[_0x1a9f('0x29')],_[_0x1a9f('0x74')](_0x1a3654['variable'])[0x0],_0x1a3654[_0x1a9f('0x75')]);if(this[_0x1a9f('0xa')][_0x1a3654['uniqueid']]){for(var _0x458d32 in this[_0x1a9f('0xa')][_0x1a3654[_0x1a9f('0x29')]]){if(this[_0x1a9f('0xa')][_0x1a3654['uniqueid']][_0x1a9f('0x64')](_0x458d32)){logger[_0x1a9f('0x3d')](_0x1a9f('0x76'),_0x1a3654['uniqueid'],_0x458d32,_[_0x1a9f('0x74')](_0x1a3654[_0x1a9f('0x77')])[0x0],_0x1a3654[_0x1a9f('0x75')]);if(_[_0x1a9f('0x27')](this[_0x1a9f('0xa')][_0x1a3654[_0x1a9f('0x29')]][_0x458d32][_0x1a9f('0xe')])){this[_0x1a9f('0xa')][_0x1a3654[_0x1a9f('0x29')]][_0x458d32][_0x1a9f('0xe')]={};}this[_0x1a9f('0xa')][_0x1a3654[_0x1a9f('0x29')]][_0x458d32][_0x1a9f('0xe')]=this['variables'][_0x1a3654[_0x1a9f('0x29')]];}}}}}catch(_0x2e5312){logger[_0x1a9f('0x3c')](_0x1a9f('0x78'),_0x1a3654[_0x1a9f('0x29')],util[_0x1a9f('0x2e')](_0x2e5312,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['addVariable']=function(_0x3ba7b2,_0x35a38a,_0x2c2712){var _0x559a66=['rtpaudioqos',_0x1a9f('0x79'),_0x1a9f('0x7a'),_0x1a9f('0x7b'),_0x1a9f('0x7c'),_0x1a9f('0x7d'),_0x1a9f('0x7e'),_0x1a9f('0x7f'),'sipcallid','sipuri','bridgepeer','bridgepvtcallid',_0x1a9f('0x80'),'memberdynamic','memberinterface',_0x1a9f('0x81'),_0x1a9f('0x2a'),_0x1a9f('0x82'),_0x1a9f('0x83')];if(!_['isNil'](_0x35a38a)&&!_[_0x1a9f('0x84')](_0x559a66,_0x35a38a)){if(_[_0x1a9f('0x27')](this[_0x1a9f('0xe')][_0x3ba7b2])){this['variables'][_0x3ba7b2]={};}this['variables'][_0x3ba7b2][_0x35a38a]=_0x2c2712;}};VoiceAgentReport[_0x1a9f('0x24')][_0x1a9f('0x1c')]=function(_0x38523a){try{if(this['isNotNull'](_0x38523a)){logger[_0x1a9f('0x2c')]('[%s][voiceAgentReport][hangup]\x20event:',_0x38523a[_0x1a9f('0x29')],util[_0x1a9f('0x2e')](_0x38523a,{'showHidden':![],'depth':null}));if(this['channels'][_0x38523a['uniqueid']]){for(var _0x318c97 in this[_0x1a9f('0xa')][_0x38523a[_0x1a9f('0x29')]]){if(this[_0x1a9f('0xa')][_0x38523a[_0x1a9f('0x29')]]['hasOwnProperty'](_0x318c97)){if(this[_0x1a9f('0xa')][_0x38523a['uniqueid']][_0x318c97]['reason']==_0x1a9f('0x67')&&this[_0x1a9f('0xa')][_0x38523a['uniqueid']][_0x318c97][_0x1a9f('0x17')]){logger[_0x1a9f('0x3d')]('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x38523a[_0x1a9f('0x29')],_0x318c97);this[_0x1a9f('0xa')][_0x38523a[_0x1a9f('0x29')]][_0x318c97][_0x1a9f('0x85')]=moment()[_0x1a9f('0x39')](_0x1a9f('0x30'));}}}logger[_0x1a9f('0x2c')]('[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:',_0x38523a[_0x1a9f('0x29')],util[_0x1a9f('0x2e')](_[_0x1a9f('0x86')](this[_0x1a9f('0xa')][_0x38523a[_0x1a9f('0x29')]]),{'showHidden':![],'depth':null}));ami[_0x1a9f('0x25')](_0x1a9f('0x87'),_[_0x1a9f('0x86')](this[_0x1a9f('0xa')][_0x38523a[_0x1a9f('0x29')]]));delete this[_0x1a9f('0xa')][_0x38523a['uniqueid']];}if(this[_0x1a9f('0xe')][_0x38523a[_0x1a9f('0x29')]]){delete this[_0x1a9f('0xe')][_0x38523a[_0x1a9f('0x29')]];}}}catch(_0x9683b2){logger['error'](_0x1a9f('0x88'),_0x38523a['uniqueid'],util['inspect'](_0x9683b2,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1a9f('0x24')][_0x1a9f('0x22')]=function(_0x172f1d){try{if(this['isNotNull'](_0x172f1d)){logger[_0x1a9f('0x2c')](_0x1a9f('0x89'),_0x172f1d[_0x1a9f('0x29')],util[_0x1a9f('0x2e')](_0x172f1d,{'showHidden':![],'depth':null}));if(this[_0x1a9f('0xa')][_0x172f1d[_0x1a9f('0x8a')]]){for(var _0x4e7d29 in this[_0x1a9f('0xa')][_0x172f1d[_0x1a9f('0x8a')]]){if(this[_0x1a9f('0xa')][_0x172f1d[_0x1a9f('0x8a')]][_0x1a9f('0x64')](_0x4e7d29)){if(_0x172f1d[_0x1a9f('0x8b')]===_0x4e7d29){logger[_0x1a9f('0x3d')](_0x1a9f('0x8c'),_0x172f1d[_0x1a9f('0x29')],this['channels'][_0x172f1d['transfereeuniqueid']][_0x4e7d29][_0x1a9f('0x2a')],_0x4e7d29);var _0x3ffcdd=moment();this[_0x1a9f('0xa')][_0x172f1d[_0x1a9f('0x8a')]][_0x4e7d29]['agentcomplete']=!![];this[_0x1a9f('0xa')][_0x172f1d['transfereeuniqueid']][_0x4e7d29][_0x1a9f('0x85')]=moment()[_0x1a9f('0x39')](_0x1a9f('0x30'));this['channels'][_0x172f1d['transfereeuniqueid']][_0x4e7d29]['lastevent']=_0x1a9f('0x66');this['channels'][_0x172f1d[_0x1a9f('0x8a')]][_0x4e7d29][_0x1a9f('0x54')]=_0x1a9f('0x67');this[_0x1a9f('0xa')][_0x172f1d['transfereeuniqueid']][_0x4e7d29][_0x1a9f('0x8d')]=_0x3ffcdd[_0x1a9f('0x8e')](this['channels'][_0x172f1d[_0x1a9f('0x8a')]][_0x4e7d29][_0x1a9f('0x3f')],_0x1a9f('0x8f'));}}}}if(this[_0x1a9f('0xa')][_0x172f1d[_0x1a9f('0x90')]]){var _0x265c15=this[_0x1a9f('0xa')][_0x172f1d[_0x1a9f('0x90')]];this[_0x1a9f('0xa')][_0x172f1d[_0x1a9f('0x90')]]=this[_0x1a9f('0xa')][_0x172f1d[_0x1a9f('0x8a')]];this['channels'][_0x172f1d[_0x1a9f('0x8a')]]=_0x265c15;}}}catch(_0x488117){logger[_0x1a9f('0x3c')](_0x1a9f('0x91'),_0x172f1d[_0x1a9f('0x29')],util['inspect'](_0x488117,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1a9f('0x24')][_0x1a9f('0x23')]=function(_0x55c25d){try{if(this[_0x1a9f('0x26')](_0x55c25d)){logger['debug'](_0x1a9f('0x92'),_0x55c25d['uniqueid'],util[_0x1a9f('0x2e')](_0x55c25d,{'showHidden':![],'depth':null}));if(this[_0x1a9f('0xa')][_0x55c25d[_0x1a9f('0x8a')]]){for(var _0xee7619 in this[_0x1a9f('0xa')][_0x55c25d['transfereeuniqueid']]){if(this['channels'][_0x55c25d['transfereeuniqueid']]['hasOwnProperty'](_0xee7619)){if(_0x55c25d[_0x1a9f('0x93')]===_0xee7619){logger[_0x1a9f('0x3d')]('[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x55c25d[_0x1a9f('0x29')],this[_0x1a9f('0xa')][_0x55c25d['transfereeuniqueid']][_0xee7619][_0x1a9f('0x2a')],_0xee7619);var _0x4f92b5=moment();this['channels'][_0x55c25d[_0x1a9f('0x8a')]][_0xee7619][_0x1a9f('0x17')]=!![];this[_0x1a9f('0xa')][_0x55c25d['transfereeuniqueid']][_0xee7619][_0x1a9f('0x85')]=_0x4f92b5;this['channels'][_0x55c25d[_0x1a9f('0x8a')]][_0xee7619]['lastevent']=_0x1a9f('0x66');this[_0x1a9f('0xa')][_0x55c25d[_0x1a9f('0x8a')]][_0xee7619][_0x1a9f('0x54')]=_0x1a9f('0x67');this[_0x1a9f('0xa')][_0x55c25d[_0x1a9f('0x8a')]][_0xee7619]['talktime']=_0x4f92b5[_0x1a9f('0x8e')](this['channels'][_0x55c25d['transfereeuniqueid']][_0xee7619]['agentconnectAt'],_0x1a9f('0x8f'));}}}}}}catch(_0x45e06e){logger['error']('[%s][voiceAgentReport][blindtransfer]',_0x55c25d[_0x1a9f('0x29')],util[_0x1a9f('0x2e')](_0x45e06e,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1a9f('0x24')][_0x1a9f('0x1e')]=function(_0xcf7ce7){var _0x1e6c48='';try{if(this['isNotNull'](_0xcf7ce7)){logger[_0x1a9f('0x2c')](_0x1a9f('0x94'),_0xcf7ce7[_0x1a9f('0x29')],util[_0x1a9f('0x2e')](_0xcf7ce7,{'showHidden':![],'depth':null}));if(_0xcf7ce7[_0x1a9f('0x95')]){_0x1e6c48=_0xcf7ce7[_0x1a9f('0x95')][_0x1a9f('0x96')](0x0,_0xcf7ce7[_0x1a9f('0x95')][_0x1a9f('0x97')]('-'));if(this['agents'][_0x1e6c48]){logger[_0x1a9f('0x3d')]('[%s][voiceAgentReport][musiconholdstart]\x20interface:%s',_0xcf7ce7[_0x1a9f('0x29')],_0x1e6c48);this['agents'][_0x1e6c48]['onhold']=!![];}}}}catch(_0x56624b){logger[_0x1a9f('0x3c')](_0x1a9f('0x98'),_0xcf7ce7[_0x1a9f('0x29')],util[_0x1a9f('0x2e')](_0x56624b,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1a9f('0x24')][_0x1a9f('0x20')]=function(_0x4429e9){var _0x472307='';try{if(this[_0x1a9f('0x26')](_0x4429e9)){logger[_0x1a9f('0x2c')](_0x1a9f('0x99'),_0x4429e9[_0x1a9f('0x29')],util[_0x1a9f('0x2e')](_0x4429e9,{'showHidden':![],'depth':null}));if(_0x4429e9[_0x1a9f('0x95')]){_0x472307=_0x4429e9[_0x1a9f('0x95')][_0x1a9f('0x96')](0x0,_0x4429e9['channel'][_0x1a9f('0x97')]('-'));if(this['agents'][_0x472307]){logger[_0x1a9f('0x3d')](_0x1a9f('0x9a'),_0x4429e9[_0x1a9f('0x29')],_0x472307);this[_0x1a9f('0xd')][_0x472307][_0x1a9f('0x9b')]=![];}}}}catch(_0x357f36){logger[_0x1a9f('0x3c')]('[%s][voiceAgentReport][musiconholdstop]',_0x4429e9['uniqueid'],util[_0x1a9f('0x2e')](_0x357f36,{'showHidden':![],'depth':null}));}};module[_0x1a9f('0x9c')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 43ead75..8c76cb7 100644 --- a/server/services/ami/report/voiceCallReport.js +++ b/server/services/ami/report/voiceCallReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7db6=['coreshowchannel','syncNewExten','newexten','bind','syncNewChannel','newstate','varset','syncVarSet','hangup','syncHangup','newcallerid','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','prototype','isNotNull','isUndefined','emit','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','calleridnum','[%s][voiceCallReport][newcallerid]\x20event:','inspect','merge','keys','context','exten','channel','split','destconnectedlinenum','connectedlinenum','user:%s','agents','name','user:agentconnect','accountcode','[%s][voiceCallReport][newcallerid]','debug','[%s][voiceCallReport][newchannel]\x20event:','OutgoingSpoolFailed','linkedid','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','channelstate','pick','from-sip','undefined','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','format','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','appdata','applicationdata','duration','subtract','seconds','includes','lastapplication','startsWith','match','type','isNil','[%s][voiceCallReport][newexten]','syncNewState','[%s][voiceCallReport][newstate]\x20event:','answered','answertime','starttime','holdtime','diff','xcally-motion-preview','connectedlinename','destinationchannel','UserId','membername','[%s][voiceCallReport][newstate]','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','endsWith','.wav49','.WAV','monitors','push','rec','[%s][voiceCallReport][varset]\x20event:','variable','value','syncMixMonitorFilename','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','mixmonitor_filename','parse','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','endtime','billableseconds','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','length','transferType','then','isEmpty','stopRecordingOnTransfer','resolve','Action','StopMixMonitor','catch','finally','webbar:stopmonitors','event','BlindTransfer','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','secondtransfereruniqueid','ATTENDED','transfertargetuniqueid','origtransfereruniqueid','origtransfererlinkedid','some','routeid','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','[%s][voiceCallReport][blindtransfer]\x20event:','transferconnectedlinenum','extension','BLIND','transfereruniqueid','transfererchannel','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','exports','lodash','moment','util','path','ioredis','ami','../model/channel','../rpc/setting','set','queue','agi','playback','voicemail','FAILED','NO\x20ANSWER','ANSWERED','redis','defaults','localhost','socket.io-emitter','channels','blindTransfers'];(function(_0x4a4789,_0x1d421c){var _0x48858c=function(_0x57224f){while(--_0x57224f){_0x4a4789['push'](_0x4a4789['shift']());}};_0x48858c(++_0x1d421c);}(_0x7db6,0xb5));var _0x67db=function(_0x1fb37e,_0x49de19){_0x1fb37e=_0x1fb37e-0x0;var _0x15177d=_0x7db6[_0x1fb37e];return _0x15177d;};'use strict';var _=require(_0x67db('0x0'));var moment=require(_0x67db('0x1'));var util=require(_0x67db('0x2'));var path=require(_0x67db('0x3'));var Redis=require(_0x67db('0x4'));var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x67db('0x5'));var ami=require('../ami');var Channel=require(_0x67db('0x6'));var RpcSetting=require(_0x67db('0x7'));var applications=[_0x67db('0x8'),_0x67db('0x9'),_0x67db('0xa'),'dial',_0x67db('0xb'),_0x67db('0xc')];var dispositions=['NO\x20ANSWER',_0x67db('0xd'),_0x67db('0xd'),_0x67db('0xe'),_0x67db('0xe'),_0x67db('0xe'),_0x67db('0xf'),'BUSY',_0x67db('0xd'),'FAILED','FAILED'];config[_0x67db('0x10')]=_[_0x67db('0x11')](config[_0x67db('0x10')],{'host':_0x67db('0x12'),'port':0x18eb});var io=require(_0x67db('0x13'))(new Redis(config['redis']));function VoiceCallReport(_0x3ed3e2){this[_0x67db('0x14')]=_0x3ed3e2[_0x67db('0x14')];this['agents']=_0x3ed3e2['agents'];this[_0x67db('0x15')]={};ami['on'](_0x67db('0x16'),this[_0x67db('0x17')]['bind'](this));ami['on'](_0x67db('0x18'),this[_0x67db('0x17')][_0x67db('0x19')](this));ami['on']('newchannel',this[_0x67db('0x1a')][_0x67db('0x19')](this));ami['on'](_0x67db('0x1b'),this['syncNewState']['bind'](this));ami['on'](_0x67db('0x1c'),this[_0x67db('0x1d')][_0x67db('0x19')](this));ami['on'](_0x67db('0x1e'),this[_0x67db('0x1f')]['bind'](this));ami['on'](_0x67db('0x20'),this['syncNewCallerId'][_0x67db('0x19')](this));ami['on'](_0x67db('0x21'),this[_0x67db('0x22')][_0x67db('0x19')](this));ami['on'](_0x67db('0x23'),this[_0x67db('0x24')]['bind'](this));ami['on']('musiconholdstart',this[_0x67db('0x25')][_0x67db('0x19')](this));ami['on'](_0x67db('0x26'),this[_0x67db('0x27')]['bind'](this));try{logger[_0x67db('0x28')](_0x67db('0x29'));ami[_0x67db('0x2a')]();}catch(_0xee33ee){logger[_0x67db('0x2b')]('[voiceCallReport][coreshowchannels]',util['inspect'](_0xee33ee,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x67db('0x2c')][_0x67db('0x2d')]=function(_0x527cfe){return _0x527cfe!==null&&!_[_0x67db('0x2e')](_0x527cfe);};VoiceCallReport[_0x67db('0x2c')]['emit']=function(_0x5c3ad6,_0x14d34a,_0x3dff9f){io['to'](_0x5c3ad6)[_0x67db('0x2f')](_0x14d34a,_0x3dff9f);};VoiceCallReport[_0x67db('0x2c')]['syncNewCallerId']=function(_0x24c6aa){try{if(this['isNotNull'](_0x24c6aa)){logger[_0x67db('0x28')](_0x67db('0x30'),_0x24c6aa[_0x67db('0x31')],_0x24c6aa[_0x67db('0x32')],_0x24c6aa[_0x67db('0x33')]);logger['debug'](_0x67db('0x34'),_0x24c6aa['uniqueid'],util[_0x67db('0x35')](_0x24c6aa,{'showHidden':![],'depth':null}));if(_0x24c6aa[_0x67db('0x31')]===_0x24c6aa['linkedid']){if(!_[_0x67db('0x2e')](this[_0x67db('0x14')][_0x24c6aa[_0x67db('0x31')]])){_[_0x67db('0x36')](this[_0x67db('0x14')][_0x24c6aa[_0x67db('0x31')]],_['pick'](_0x24c6aa,_[_0x67db('0x37')](this[_0x67db('0x14')][_0x24c6aa[_0x67db('0x31')]])));}}if(_0x24c6aa[_0x67db('0x38')]==='from-sip'){if(this['agents'][_0x24c6aa['channel']['split']('-')[0x0]]){if(_0x24c6aa[_0x67db('0x39')]=='xcally-motion-preview'){this['agents'][_0x24c6aa[_0x67db('0x3a')][_0x67db('0x3b')]('-')[0x0]][_0x67db('0x3c')]=_0x24c6aa[_0x67db('0x3d')];this['emit'](util['format'](_0x67db('0x3e'),this[_0x67db('0x3f')][_0x24c6aa['channel'][_0x67db('0x3b')]('-')[0x0]][_0x67db('0x40')]),_0x67db('0x41'),{'destaccountcode':this['agents'][_0x24c6aa[_0x67db('0x3a')][_0x67db('0x3b')]('-')[0x0]][_0x67db('0x42')],'destconnectedlinenum':_0x24c6aa[_0x67db('0x3d')]});}}}}}catch(_0x2bce59){logger[_0x67db('0x2b')](_0x67db('0x43'),_0x24c6aa['uniqueid'],util['inspect'](_0x2bce59,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x67db('0x2c')]['syncNewChannel']=function(_0x223850){try{if(this[_0x67db('0x2d')](_0x223850)){logger[_0x67db('0x44')](_0x67db('0x45'),_0x223850[_0x67db('0x31')],util['inspect'](_0x223850,{'showHidden':![],'depth':null}));if(this[_0x67db('0x14')][_0x223850[_0x67db('0x31')]]){return;}if(_0x223850['channel']===_0x67db('0x46')){return;}if(_0x223850['uniqueid']!==_0x223850[_0x67db('0x47')]&&!this['blindTransfers'][_0x223850[_0x67db('0x47')]]){return;}logger[_0x67db('0x28')](_0x67db('0x48'),_0x223850[_0x67db('0x31')],_0x223850[_0x67db('0x38')],_0x223850[_0x67db('0x39')]);this[_0x67db('0x14')][_0x223850[_0x67db('0x31')]]=new Channel();this['channels'][_0x223850[_0x67db('0x31')]]['starttime']=moment()['format'](_0x67db('0x49'));this['channels'][_0x223850[_0x67db('0x31')]][_0x67db('0x4a')]=dispositions[_[_0x67db('0x4b')](_0x223850[_0x67db('0x4c')])];_['merge'](this['channels'][_0x223850[_0x67db('0x31')]],_[_0x67db('0x4d')](_0x223850,_['keys'](this['channels'][_0x223850[_0x67db('0x31')]])));if(_0x223850[_0x67db('0x38')]===_0x67db('0x4e')){var _0x573e5a=this[_0x67db('0x3f')][_0x223850[_0x67db('0x3a')][_0x67db('0x3b')]('-')[0x0]];if(_0x573e5a&&typeof _0x573e5a[_0x67db('0x3c')]===_0x67db('0x4f')){_0x573e5a[_0x67db('0x3c')]=_0x223850[_0x67db('0x39')];logger[_0x67db('0x44')](_0x67db('0x50'),_0x223850[_0x67db('0x31')],util[_0x67db('0x35')]({'id':_0x573e5a['id'],'destaccountcode':_0x573e5a[_0x67db('0x42')],'destconnectedlinenum':_0x223850['exten']},{'showHidden':![],'depth':null}));this[_0x67db('0x2f')](util[_0x67db('0x51')](_0x67db('0x3e'),_0x573e5a[_0x67db('0x40')]),_0x67db('0x41'),{'id':_0x573e5a['id'],'destaccountcode':_0x573e5a[_0x67db('0x42')],'destconnectedlinenum':_0x223850[_0x67db('0x39')]});}}}}catch(_0x48cdc2){logger[_0x67db('0x2b')](_0x67db('0x52'),_0x223850[_0x67db('0x31')],util['inspect'](_0x48cdc2,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x67db('0x2c')][_0x67db('0x17')]=function(_0x473878){try{if(this[_0x67db('0x2d')](_0x473878)){logger[_0x67db('0x44')](_0x67db('0x53'),_0x473878[_0x67db('0x31')],util[_0x67db('0x35')](_0x473878,{'showHidden':![],'depth':null}));if(_0x473878['channel']==='OutgoingSpoolFailed'||_0x473878[_0x67db('0x39')]==='h')return;if(_0x473878['uniqueid']===_0x473878[_0x67db('0x47')]||this['blindTransfers'][_0x473878['linkedid']]){_0x473878['application']=_0x473878[_0x67db('0x54')]?_0x473878[_0x67db('0x54')][_0x67db('0x55')]():undefined;_0x473878['applicationdata']=_0x473878[_0x67db('0x56')]||_0x473878[_0x67db('0x57')];if(_0x473878[_0x67db('0x56')]&&!_0x473878['appdata']['startsWith']('CDR(routeAlias)')&&_0x473878[_0x67db('0x54')]!==_0x67db('0x9')){_0x473878[_0x67db('0x57')]=_0x473878['applicationdata'][_0x67db('0x55')]();}logger[_0x67db('0x28')]('[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s',_0x473878['uniqueid'],_0x473878[_0x67db('0x54')],_0x473878['applicationdata']);if(_[_0x67db('0x2e')](this['channels'][_0x473878[_0x67db('0x31')]])){this['channels'][_0x473878['uniqueid']]=new Channel();this[_0x67db('0x14')][_0x473878[_0x67db('0x31')]]['starttime']=_0x473878[_0x67db('0x58')]?moment()[_0x67db('0x59')](moment[_0x67db('0x58')](_0x473878['duration'])[_0x67db('0x5a')](),_0x67db('0x5a'))[_0x67db('0x51')](_0x67db('0x49')):moment()[_0x67db('0x51')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x473878[_0x67db('0x31')]][_0x67db('0x4a')]='NO\x20ANSWER';}_[_0x67db('0x36')](this[_0x67db('0x14')][_0x473878[_0x67db('0x31')]],_['pick'](_0x473878,_['keys'](this[_0x67db('0x14')][_0x473878[_0x67db('0x31')]])));if(_[_0x67db('0x5b')](applications,_0x473878[_0x67db('0x54')])){this[_0x67db('0x14')][_0x473878[_0x67db('0x31')]][_0x67db('0x5c')]=_0x473878['application'];this['channels'][_0x473878[_0x67db('0x31')]]['lastdata']=_0x473878['applicationdata'];if(_0x473878[_0x67db('0x54')]===_0x67db('0x8')&&_[_0x67db('0x5d')](_0x473878[_0x67db('0x57')]['toLowerCase'](),'cdr(')){var _0x1a3998=_0x473878[_0x67db('0x57')][_0x67db('0x3b')]('=');var _0x5eb9b6=_0x1a3998[0x0][_0x67db('0x55')]()[_0x67db('0x5e')](/cdr\((.*)\)/);if(_0x5eb9b6){if(_0x5eb9b6[0x1]===_0x67db('0x5f')&&!_[_0x67db('0x60')](this[_0x67db('0x14')][_0x473878[_0x67db('0x31')]][_0x5eb9b6[0x1]]))return;this[_0x67db('0x14')][_0x473878[_0x67db('0x31')]][_0x5eb9b6[0x1]]=_0x1a3998[0x1];}}else if(_0x473878['application']===_0x67db('0x9')){this[_0x67db('0x14')][_0x473878['uniqueid']][_0x67db('0x9')]=_0x473878['applicationdata'][_0x67db('0x3b')](',')[0x0];}}}}}catch(_0x3b6f68){logger[_0x67db('0x2b')](_0x67db('0x61'),_0x473878[_0x67db('0x31')],util[_0x67db('0x35')](_0x3b6f68,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x67db('0x62')]=function(_0x76edc4){try{if(this[_0x67db('0x2d')](_0x76edc4)){logger[_0x67db('0x28')]('[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s',_0x76edc4[_0x67db('0x31')],_0x76edc4['linkedid'],_0x76edc4['calleridname'],_0x76edc4[_0x67db('0x33')]);logger[_0x67db('0x44')](_0x67db('0x63'),_0x76edc4[_0x67db('0x31')],util[_0x67db('0x35')](_0x76edc4,{'showHidden':![],'depth':null}));if(_0x76edc4['channelstate']!=='6')return;var _0x2c30b1=this['agents'][_0x76edc4[_0x67db('0x3a')][_0x67db('0x3b')]('-')[0x0]];if(_0x76edc4[_0x67db('0x31')]!==_0x76edc4[_0x67db('0x47')]){var _0x521523=moment();if(this[_0x67db('0x14')][_0x76edc4[_0x67db('0x47')]]){if(!this['channels'][_0x76edc4[_0x67db('0x47')]][_0x67db('0x64')]){this[_0x67db('0x14')][_0x76edc4[_0x67db('0x47')]][_0x67db('0x64')]=!![];this[_0x67db('0x14')][_0x76edc4[_0x67db('0x47')]][_0x67db('0x65')]=_0x521523[_0x67db('0x51')](_0x67db('0x49'));if(this['channels'][_0x76edc4[_0x67db('0x47')]][_0x67db('0x66')]){this[_0x67db('0x14')][_0x76edc4['linkedid']][_0x67db('0x67')]=_0x521523[_0x67db('0x68')](this[_0x67db('0x14')][_0x76edc4[_0x67db('0x47')]][_0x67db('0x66')],_0x67db('0x5a'));}}this['channels'][_0x76edc4[_0x67db('0x47')]]['linkedid']=_0x76edc4[_0x67db('0x31')];if(_0x76edc4[_0x67db('0x33')]!==_0x67db('0x69')){this[_0x67db('0x14')][_0x76edc4['linkedid']][_0x67db('0x3d')]=_0x76edc4[_0x67db('0x33')];}this[_0x67db('0x14')][_0x76edc4[_0x67db('0x47')]][_0x67db('0x6a')]=_0x76edc4[_0x67db('0x32')];this[_0x67db('0x14')][_0x76edc4[_0x67db('0x47')]][_0x67db('0x6b')]=_0x76edc4[_0x67db('0x3a')];this[_0x67db('0x14')][_0x76edc4[_0x67db('0x47')]]['disposition']=dispositions[_[_0x67db('0x4b')](_0x76edc4[_0x67db('0x4c')])];if(_0x2c30b1){this[_0x67db('0x14')][_0x76edc4[_0x67db('0x47')]][_0x67db('0x6c')]=_0x2c30b1['id'];this[_0x67db('0x14')][_0x76edc4[_0x67db('0x47')]][_0x67db('0x6d')]=_0x2c30b1[_0x67db('0x40')];}}if(this[_0x67db('0x14')][_0x76edc4['uniqueid']]){if(!this['channels'][_0x76edc4['uniqueid']][_0x67db('0x64')]){this['channels'][_0x76edc4['uniqueid']][_0x67db('0x64')]=!![];this[_0x67db('0x14')][_0x76edc4[_0x67db('0x31')]]['answertime']=_0x521523[_0x67db('0x51')](_0x67db('0x49'));if(this[_0x67db('0x14')][_0x76edc4['uniqueid']][_0x67db('0x66')]){this[_0x67db('0x14')][_0x76edc4[_0x67db('0x31')]][_0x67db('0x67')]=_0x521523[_0x67db('0x68')](this['channels'][_0x76edc4[_0x67db('0x31')]][_0x67db('0x66')],_0x67db('0x5a'));}}if(_0x76edc4[_0x67db('0x33')]!==_0x67db('0x69')){this[_0x67db('0x14')][_0x76edc4['uniqueid']]['connectedlinenum']=_0x76edc4[_0x67db('0x33')];}this[_0x67db('0x14')][_0x76edc4[_0x67db('0x31')]][_0x67db('0x6a')]=_0x76edc4[_0x67db('0x32')];this['channels'][_0x76edc4['uniqueid']][_0x67db('0x6b')]=_0x76edc4['channel'];this[_0x67db('0x14')][_0x76edc4[_0x67db('0x31')]][_0x67db('0x4a')]=dispositions[_[_0x67db('0x4b')](_0x76edc4[_0x67db('0x4c')])];}}else{if(this[_0x67db('0x14')][_0x76edc4[_0x67db('0x31')]]){if(_0x2c30b1){this['channels'][_0x76edc4[_0x67db('0x31')]][_0x67db('0x6c')]=_0x2c30b1['id'];this['channels'][_0x76edc4[_0x67db('0x31')]][_0x67db('0x6d')]=_0x2c30b1['name'];}}}if(_0x76edc4[_0x67db('0x38')]==='from-sip'){if(_0x2c30b1){_0x2c30b1[_0x67db('0x3c')]=_0x76edc4[_0x67db('0x39')];var _0x5ef409,_0x54bb92;if(this[_0x67db('0x14')][_0x76edc4[_0x67db('0x31')]]){_0x5ef409=this['channels'][_0x76edc4[_0x67db('0x31')]]['routealias'];_0x54bb92=this[_0x67db('0x14')][_0x76edc4[_0x67db('0x31')]][_0x67db('0x9')];}else if(this[_0x67db('0x14')][_0x76edc4[_0x67db('0x47')]]){_0x5ef409=this['channels'][_0x76edc4[_0x67db('0x47')]]['routealias'];_0x54bb92=this['channels'][_0x76edc4[_0x67db('0x47')]][_0x67db('0x9')];}_0x2c30b1[_0x67db('0x9')]=_0x54bb92;_0x2c30b1['routealias']=_0x5ef409;var _0x1565bb={'id':_0x2c30b1['id'],'name':_0x2c30b1[_0x67db('0x40')],'agentconnected':!![],'destaccountcode':_0x2c30b1[_0x67db('0x42')],'destconnectedlinenum':_0x76edc4[_0x67db('0x39')],'queue':_0x54bb92||undefined,'routealias':_0x5ef409,'uniqueid':_0x76edc4['linkedid']};logger[_0x67db('0x44')]('[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:',_0x76edc4[_0x67db('0x31')],util[_0x67db('0x35')](_0x1565bb,{'showHidden':![],'depth':null}));this[_0x67db('0x2f')](util[_0x67db('0x51')]('user:%s',_0x2c30b1[_0x67db('0x40')]),_0x67db('0x41'),_0x1565bb);}}}}catch(_0x250b51){logger[_0x67db('0x2b')](_0x67db('0x6e'),_0x76edc4[_0x67db('0x31')],util[_0x67db('0x35')](_0x250b51,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x67db('0x2c')]['syncMixMonitorFilename']=function(_0x535270,_0x470447){try{if(this['channels'][_0x535270]){logger[_0x67db('0x28')](_0x67db('0x6f'),_0x535270,_0x470447);this[_0x67db('0x14')][_0x535270]['monitor']=!![];if(_[_0x67db('0x70')](_0x470447,_0x67db('0x71'))){_0x470447=_0x470447['replace'](_0x67db('0x71'),_0x67db('0x72'));}this[_0x67db('0x14')][_0x535270]['monitorFilename']=_0x470447;var _0x454956=_['find'](this[_0x67db('0x14')][_0x535270][_0x67db('0x73')],{'filename':_0x470447});if(_[_0x67db('0x60')](_0x454956)){this[_0x67db('0x14')][_0x535270][_0x67db('0x73')][_0x67db('0x74')]({'filename':_0x470447,'createdAt':moment()[_0x67db('0x51')](_0x67db('0x49')),'mixmonitorid':'','status':_0x67db('0x75')});}}}catch(_0x38f68d){logger[_0x67db('0x2b')]('[%s][voiceCallReport][mixMonitorFilename]',_0x535270,util[_0x67db('0x35')](_0x38f68d,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x67db('0x2c')]['syncVarSet']=function(_0x43ec63){try{if(this[_0x67db('0x2d')](_0x43ec63)){logger[_0x67db('0x44')](_0x67db('0x76'),_0x43ec63[_0x67db('0x31')],util[_0x67db('0x35')](_0x43ec63,{'showHidden':![],'depth':null}));if(this[_0x67db('0x14')][_0x43ec63['uniqueid']]&&_0x43ec63['channel']!=_0x67db('0x46')){if(this['isNotNull'](_0x43ec63['variable'])){if(this[_0x67db('0x2d')](_0x43ec63[_0x67db('0x77')]['mixmonitor_filename'])){logger[_0x67db('0x28')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x43ec63[_0x67db('0x31')],_0x43ec63[_0x67db('0x78')]);this[_0x67db('0x79')](_0x43ec63[_0x67db('0x31')],_0x43ec63[_0x67db('0x78')]);}else if(this[_0x67db('0x2d')](_0x43ec63[_0x67db('0x77')][_0x67db('0x7a')])){logger[_0x67db('0x28')](_0x67db('0x7b'),_0x43ec63[_0x67db('0x31')],_0x43ec63[_0x67db('0x78')]);this['channels'][_0x43ec63['uniqueid']][_0x67db('0x33')]=_0x43ec63[_0x67db('0x78')];}else if(this[_0x67db('0x2d')](_0x43ec63[_0x67db('0x77')]['xmd-callerid'])){logger['info'](_0x67db('0x7c'),_0x43ec63[_0x67db('0x31')],_0x43ec63[_0x67db('0x78')]);this['channels'][_0x43ec63[_0x67db('0x31')]][_0x67db('0x7d')]=_0x43ec63[_0x67db('0x78')];}else if(this[_0x67db('0x2d')](_0x43ec63[_0x67db('0x77')][_0x67db('0x7e')])){logger[_0x67db('0x28')](_0x67db('0x7f'),_0x43ec63[_0x67db('0x31')],_0x43ec63[_0x67db('0x78')]);this['channels'][_0x43ec63[_0x67db('0x31')]][_0x67db('0x5f')]=_0x43ec63[_0x67db('0x78')];}else if(this[_0x67db('0x2d')](_0x43ec63['variable'][_0x67db('0x80')])){logger['info'](_0x67db('0x81'),_0x43ec63[_0x67db('0x31')],_0x43ec63[_0x67db('0x78')]['split'](',')[0x0]);this['channels'][_0x43ec63[_0x67db('0x31')]][_0x67db('0x9')]=_0x43ec63[_0x67db('0x78')][_0x67db('0x3b')](',')[0x0];}else if(this['isNotNull'](_0x43ec63[_0x67db('0x77')][_0x67db('0x82')])){logger[_0x67db('0x28')](_0x67db('0x83'),_0x43ec63[_0x67db('0x31')],_0x43ec63['value']);this[_0x67db('0x14')][_0x43ec63[_0x67db('0x31')]][_0x67db('0x84')]=_0x43ec63['value'];}else if(this[_0x67db('0x2d')](_0x43ec63['variable'][_0x67db('0x85')])){logger[_0x67db('0x28')](_0x67db('0x86'),_0x43ec63[_0x67db('0x31')],_0x43ec63[_0x67db('0x78')]);this[_0x67db('0x14')][_0x43ec63[_0x67db('0x31')]][_0x67db('0x87')]=_0x43ec63[_0x67db('0x78')];}else if(this[_0x67db('0x2d')](_0x43ec63[_0x67db('0x77')]['xmd-callerid-preview'])){logger['info'](_0x67db('0x88'),_0x43ec63['uniqueid'],_0x43ec63[_0x67db('0x78')]);this['channels'][_0x43ec63[_0x67db('0x31')]][_0x67db('0x89')]=_0x43ec63['value'];}else if(this[_0x67db('0x2d')](_0x43ec63['variable']['xmcs-queue'])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s',_0x43ec63[_0x67db('0x31')],_0x43ec63[_0x67db('0x78')]);this[_0x67db('0x14')][_0x43ec63['uniqueid']][_0x67db('0x9')]=_0x43ec63[_0x67db('0x78')];}else if(this[_0x67db('0x2d')](_0x43ec63[_0x67db('0x77')][_0x67db('0x8a')])){logger[_0x67db('0x28')](_0x67db('0x8b'),_0x43ec63['uniqueid'],_0x43ec63[_0x67db('0x78')]);this[_0x67db('0x14')][_0x43ec63[_0x67db('0x31')]][_0x67db('0x8c')]=_0x43ec63['value'];}}}else if(this[_0x67db('0x2d')](_0x43ec63[_0x67db('0x77')][_0x67db('0x8d')])){if(_0x43ec63['value']){var _0x297288=path[_0x67db('0x8e')](_0x43ec63['value'])[_0x67db('0x40')];logger[_0x67db('0x28')](_0x67db('0x8f'),_0x297288,_0x43ec63[_0x67db('0x78')]);this[_0x67db('0x79')](_0x297288,_0x43ec63['value']);}}else if(this['channels'][_0x43ec63[_0x67db('0x47')]]){if(this[_0x67db('0x2d')](_0x43ec63['variable'])){if(this[_0x67db('0x2d')](_0x43ec63[_0x67db('0x77')][_0x67db('0x8a')])){logger[_0x67db('0x28')](_0x67db('0x8b'),_0x43ec63[_0x67db('0x47')],_0x43ec63[_0x67db('0x78')]);this['channels'][_0x43ec63[_0x67db('0x47')]][_0x67db('0x90')]=_0x43ec63[_0x67db('0x78')];}}}}}catch(_0x19eb83){logger[_0x67db('0x2b')](_0x67db('0x91'),_0x43ec63['uniqueid'],util['inspect'](_0x19eb83,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x67db('0x2c')]['syncHangup']=function(_0x4c693c){try{if(this[_0x67db('0x2d')](_0x4c693c)){logger['debug'](_0x67db('0x92'),_0x4c693c['uniqueid'],util['inspect'](_0x4c693c,{'showHidden':![],'depth':null}));if(this[_0x67db('0x15')][_0x4c693c[_0x67db('0x47')]]){if(this['channels'][this[_0x67db('0x15')][_0x4c693c[_0x67db('0x47')]][_0x67db('0x47')]]){this['channels'][this[_0x67db('0x15')][_0x4c693c[_0x67db('0x47')]]['linkedid']][_0x67db('0x31')]=_0x4c693c['uniqueid'];this[_0x67db('0x14')][this[_0x67db('0x15')][_0x4c693c[_0x67db('0x47')]][_0x67db('0x47')]][_0x67db('0x64')]=this['channels'][_0x4c693c['uniqueid']][_0x67db('0x64')];this['channels'][this[_0x67db('0x15')][_0x4c693c[_0x67db('0x47')]]['linkedid']]['answertime']=this[_0x67db('0x14')][_0x4c693c[_0x67db('0x31')]][_0x67db('0x65')];this[_0x67db('0x14')][this[_0x67db('0x15')][_0x4c693c[_0x67db('0x47')]][_0x67db('0x47')]][_0x67db('0x6b')]=this[_0x67db('0x14')][this['blindTransfers'][_0x4c693c[_0x67db('0x47')]][_0x67db('0x47')]][_0x67db('0x3a')];this[_0x67db('0x14')][this['blindTransfers'][_0x4c693c[_0x67db('0x47')]][_0x67db('0x47')]]['disposition']=this[_0x67db('0x14')][_0x4c693c['uniqueid']][_0x67db('0x4a')];this[_0x67db('0x14')][_0x4c693c['uniqueid']]=this[_0x67db('0x14')][this['blindTransfers'][_0x4c693c['linkedid']][_0x67db('0x47')]];delete this[_0x67db('0x14')][this[_0x67db('0x15')][_0x4c693c[_0x67db('0x47')]]['linkedid']];}else if(this[_0x67db('0x14')][this['blindTransfers'][_0x4c693c[_0x67db('0x47')]][_0x67db('0x31')]]){this[_0x67db('0x14')][this[_0x67db('0x15')][_0x4c693c[_0x67db('0x47')]]['uniqueid']][_0x67db('0x31')]=[this['channels'][this['blindTransfers'][_0x4c693c['linkedid']][_0x67db('0x31')]][_0x67db('0x47')],this['channels'][this['blindTransfers'][_0x4c693c[_0x67db('0x47')]][_0x67db('0x31')]]['linkedid']=this[_0x67db('0x14')][this[_0x67db('0x15')][_0x4c693c[_0x67db('0x47')]][_0x67db('0x31')]][_0x67db('0x31')]][0x0];this['channels'][this['blindTransfers'][_0x4c693c[_0x67db('0x47')]][_0x67db('0x31')]]['answered']=this['channels'][_0x4c693c['uniqueid']][_0x67db('0x64')];this[_0x67db('0x14')][this[_0x67db('0x15')][_0x4c693c[_0x67db('0x47')]][_0x67db('0x31')]]['answertime']=this[_0x67db('0x14')][_0x4c693c[_0x67db('0x31')]][_0x67db('0x65')];this['channels'][this[_0x67db('0x15')][_0x4c693c[_0x67db('0x47')]]['uniqueid']]['destinationchannel']=this[_0x67db('0x14')][this[_0x67db('0x15')][_0x4c693c[_0x67db('0x47')]][_0x67db('0x31')]][_0x67db('0x3a')];this[_0x67db('0x14')][this[_0x67db('0x15')][_0x4c693c[_0x67db('0x47')]][_0x67db('0x31')]][_0x67db('0x4a')]=this[_0x67db('0x14')][_0x4c693c[_0x67db('0x31')]]['disposition'];this[_0x67db('0x14')][_0x4c693c[_0x67db('0x31')]]=this[_0x67db('0x14')][this['blindTransfers'][_0x4c693c[_0x67db('0x47')]][_0x67db('0x31')]];delete this[_0x67db('0x14')][this[_0x67db('0x15')][_0x4c693c[_0x67db('0x47')]][_0x67db('0x31')]];}}if(this[_0x67db('0x14')][_0x4c693c['uniqueid']]){logger[_0x67db('0x28')](_0x67db('0x93'),_0x4c693c['uniqueid'],_0x4c693c[_0x67db('0x94')]);var _0x164cb3=moment();this[_0x67db('0x14')][_0x4c693c['uniqueid']][_0x67db('0x95')]=_0x164cb3[_0x67db('0x51')](_0x67db('0x49'));this[_0x67db('0x14')][_0x4c693c[_0x67db('0x31')]]['duration']=_0x164cb3[_0x67db('0x68')](this['channels'][_0x4c693c['uniqueid']][_0x67db('0x66')],_0x67db('0x5a'));if(this['channels'][_0x4c693c[_0x67db('0x31')]][_0x67db('0x64')]){this['channels'][_0x4c693c[_0x67db('0x31')]][_0x67db('0x96')]=_0x164cb3[_0x67db('0x68')](this['channels'][_0x4c693c[_0x67db('0x31')]][_0x67db('0x65')],_0x67db('0x5a'));this[_0x67db('0x14')][_0x4c693c[_0x67db('0x31')]][_0x67db('0x67')]=this['channels'][_0x4c693c[_0x67db('0x31')]][_0x67db('0x58')]-this['channels'][_0x4c693c[_0x67db('0x31')]][_0x67db('0x96')];}if(_0x4c693c[_0x67db('0x38')]===_0x67db('0x4e')){if(this[_0x67db('0x3f')][_0x4c693c[_0x67db('0x3a')][_0x67db('0x3b')]('-')[0x0]]){this[_0x67db('0x3f')][_0x4c693c[_0x67db('0x3a')][_0x67db('0x3b')]('-')[0x0]]=_[_0x67db('0x97')](this[_0x67db('0x3f')][_0x4c693c[_0x67db('0x3a')][_0x67db('0x3b')]('-')[0x0]],[_0x67db('0x3c')]);logger['debug'](_0x67db('0x98'),_0x4c693c[_0x67db('0x31')],util[_0x67db('0x35')]({'id':this['agents'][_0x4c693c[_0x67db('0x3a')][_0x67db('0x3b')]('-')[0x0]]['id'],'destaccountcode':this[_0x67db('0x3f')][_0x4c693c['channel'][_0x67db('0x3b')]('-')[0x0]][_0x67db('0x42')]},{'showHidden':![],'depth':null}));this[_0x67db('0x2f')](util[_0x67db('0x51')](_0x67db('0x3e'),this[_0x67db('0x3f')][_0x4c693c[_0x67db('0x3a')][_0x67db('0x3b')]('-')[0x0]][_0x67db('0x40')]),_0x67db('0x99'),{'id':this[_0x67db('0x3f')][_0x4c693c[_0x67db('0x3a')][_0x67db('0x3b')]('-')[0x0]]['id'],'destaccountcode':this['agents'][_0x4c693c[_0x67db('0x3a')][_0x67db('0x3b')]('-')[0x0]]['accountcode']});for(var _0x5e090d=0x0;_0x5e090d0x0?!![]:![];if(!_0x2b6396){return this['syncQueueSummaryComplete'](this[_0x6a2c('0x49')][_0x6a2c('0x6b')]);}};VoiceQueueReport[_0x6a2c('0xc')][_0x6a2c('0x1e')]=function(_0x4db820){var _0x41c764=this['summary']['id'];if(this['summary'][_0x6a2c('0x68')][_0x41c764]&&this[_0x6a2c('0x49')][_0x6a2c('0x68')][_0x41c764][_0x4db820[_0x6a2c('0x60')]]){this['summary'][_0x6a2c('0x68')][_0x41c764][_0x4db820[_0x6a2c('0x60')]][_0x6a2c('0x13')][_0x6a2c('0x6c')](_0x4db820);}};VoiceQueueReport[_0x6a2c('0xc')][_0x6a2c('0x1a')]=function(_0x231327){var _0x22a1c3=this;try{if(this[_0x6a2c('0x5a')](_0x231327)&&this['isNotNull'](_0x231327[_0x6a2c('0x55')])){logger['debug'](_0x6a2c('0x6d'),util[_0x6a2c('0x44')](_0x231327,{'showHidden':![],'depth':null}));var _0x139b67=this[_0x6a2c('0x16')][_0x231327[_0x6a2c('0x55')]];if(_0x139b67){logger[_0x6a2c('0x4d')](_0x6a2c('0x6e'),_0x139b67[_0x6a2c('0x59')]);this[_0x6a2c('0x49')][_0x6a2c('0x5d')][_0x139b67[_0x6a2c('0x59')]]={'summaryEvent':_0x231327};this[_0x6a2c('0x49')][_0x6a2c('0x6a')]+=0x1;return ami[_0x6a2c('0x5c')]({'action':'queuestatus','queue':_0x139b67[_0x6a2c('0x59')]})[_0x6a2c('0x6f')](function(_0xc4930b){if(!_0x22a1c3['summary'][_0x6a2c('0x68')][_0x231327[_0x6a2c('0x60')]]){_0x22a1c3[_0x6a2c('0x49')]['queuestatus'][_0x231327['actionid']]={};}_0x22a1c3[_0x6a2c('0x49')][_0x6a2c('0x68')][_0x231327[_0x6a2c('0x60')]][_0xc4930b[_0x6a2c('0x60')]]={'queue':_0x139b67[_0x6a2c('0x59')],'agents':[]};})[_0x6a2c('0x40')](function(_0x29ead8){throw _0x29ead8;});}}}catch(_0x11ca53){logger[_0x6a2c('0x41')]('[voiceQueueReport][queuesummary]',util[_0x6a2c('0x44')](_0x11ca53,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6a2c('0xc')][_0x6a2c('0x1c')]=function(_0x6931af){if(this['summary'][_0x6a2c('0x6a')]>0x0){this['summary']['completeEvent']=_0x6931af;return;}logger[_0x6a2c('0x4d')]('[voiceQueueReport][queuesummarycomplete]\x20event:',util[_0x6a2c('0x44')](_0x6931af,{'showHidden':![],'depth':null}));this[_0x6a2c('0x49')]=initializeSummary();ami[_0x6a2c('0x4b')](_0x6a2c('0x70'),{});};VoiceQueueReport[_0x6a2c('0xc')][_0x6a2c('0x22')]=function(_0x259172){try{if(this['isNotNull'](_0x259172)){logger['debug']('[%s][voiceQueueReport][queuecallerjoin]',_0x259172[_0x6a2c('0x50')],util[_0x6a2c('0x44')](_0x259172,{'showHidden':![],'depth':null}));if(_[_0x6a2c('0x71')](this[_0x6a2c('0x11')][_0x259172[_0x6a2c('0x50')]])){this[_0x6a2c('0x11')][_0x259172['uniqueid']]=[];}if(_[_0x6a2c('0x71')](this[_0x6a2c('0x14')][_0x259172[_0x6a2c('0x50')]])){this[_0x6a2c('0x14')][_0x259172['uniqueid']]={};}var _0x22b32c=new QueueReport();_0x22b32c['queue']=_0x259172['queue'];_0x22b32c['type']=this[_0x6a2c('0x16')][_0x22b32c[_0x6a2c('0x55')]]&&this[_0x6a2c('0x16')][_0x22b32c['queue']][_0x6a2c('0x57')]?this['voiceQueues'][_0x22b32c[_0x6a2c('0x55')]][_0x6a2c('0x57')]||'inbound':_0x6a2c('0x72');_0x22b32c[_0x6a2c('0x73')]=moment()[_0x6a2c('0x51')](_0x6a2c('0x74'));_0x22b32c[_0x6a2c('0x75')]=_0x259172[_0x6a2c('0x75')];_0x22b32c['count']=_0x259172[_0x6a2c('0x76')];_0x22b32c[_0x6a2c('0x50')]=_0x259172['uniqueid'];_0x22b32c[_0x6a2c('0x77')]=this[_0x6a2c('0x14')][_0x259172[_0x6a2c('0x50')]][_0x6a2c('0x77')];logger[_0x6a2c('0x78')]('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x22b32c[_0x6a2c('0x55')],_0x22b32c[_0x6a2c('0x57')]);Object[_0x6a2c('0x67')](_0x22b32c,_[_0x6a2c('0x79')](_0x259172,_[_0x6a2c('0x7a')](_0x22b32c)));this['queueReports'][_0x259172[_0x6a2c('0x50')]][_0x6a2c('0x6c')](_0x22b32c);this[_0x6a2c('0x14')][_0x259172[_0x6a2c('0x50')]]=_0x22b32c;this[_0x6a2c('0x4c')](_0x22b32c,_0x6a2c('0x21'));}}catch(_0xdd61d9){logger[_0x6a2c('0x41')](_0x6a2c('0x7b'),_0x259172[_0x6a2c('0x50')],util[_0x6a2c('0x44')](_0xdd61d9,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6a2c('0xc')][_0x6a2c('0x24')]=function(_0x5bf5fb){try{if(this['isNotNull'](_0x5bf5fb)){logger[_0x6a2c('0x4d')](_0x6a2c('0x7c'),_0x5bf5fb[_0x6a2c('0x50')],util[_0x6a2c('0x44')](_0x5bf5fb,{'showHidden':![],'depth':null}));if(this[_0x6a2c('0x11')][_0x5bf5fb[_0x6a2c('0x50')]]){var _0x467f19=_['last'](this[_0x6a2c('0x11')][_0x5bf5fb[_0x6a2c('0x50')]]);_0x467f19[_0x6a2c('0x7d')]=![];_0x467f19['queuecallercompleteAt']=null;_0x467f19[_0x6a2c('0x7e')]=_0x5bf5fb['holdtime'];_0x467f19[_0x6a2c('0x7f')]=_0x5bf5fb[_0x6a2c('0x7f')];_0x467f19[_0x6a2c('0x23')]=!![];_0x467f19['queuecallerabandonAt']=moment()[_0x6a2c('0x51')](_0x6a2c('0x74'));_0x467f19[_0x6a2c('0x80')]='ABANDONED';_0x467f19['lastAssignedTo']=null;logger[_0x6a2c('0x78')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x467f19[_0x6a2c('0x55')],_0x467f19[_0x6a2c('0x57')]);this[_0x6a2c('0x14')][_0x5bf5fb[_0x6a2c('0x50')]]=_0x467f19;this[_0x6a2c('0x4a')](_0x467f19,_0x6a2c('0x23'));}}}catch(_0x2e4194){logger['error'](_0x6a2c('0x7c'),_0x5bf5fb[_0x6a2c('0x50')],util['inspect'](_0x2e4194,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6a2c('0xc')][_0x6a2c('0x26')]=function(_0x19770c){try{if(this[_0x6a2c('0x5a')](_0x19770c)){logger[_0x6a2c('0x4d')](_0x6a2c('0x81'),_0x19770c[_0x6a2c('0x50')],util[_0x6a2c('0x44')](_0x19770c,{'showHidden':![],'depth':null}));if(this[_0x6a2c('0x11')][_0x19770c['uniqueid']]){var _0x3278e8=_[_0x6a2c('0x82')](this[_0x6a2c('0x11')][_0x19770c[_0x6a2c('0x50')]]);_0x3278e8[_0x6a2c('0x83')]=moment()['format'](_0x6a2c('0x74'));_0x3278e8[_0x6a2c('0x84')]=_0x19770c['connectedlinenum'];_0x3278e8['connectedlinename']=_0x19770c[_0x6a2c('0x85')];logger[_0x6a2c('0x78')](_0x6a2c('0x86'),_0x3278e8['queue'],_0x3278e8['type'],_0x19770c[_0x6a2c('0x84')],_0x19770c[_0x6a2c('0x85')]);this[_0x6a2c('0x14')][_0x19770c['uniqueid']]=_0x3278e8;this['emitVoiceQueueChannelSave'](_0x3278e8,_0x6a2c('0x25'));}}}catch(_0x33f08d){logger[_0x6a2c('0x41')](_0x6a2c('0x81'),_0x19770c['uniqueid'],util[_0x6a2c('0x44')](_0x33f08d,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x6a2c('0x29')]=function(_0x486525){try{if(this[_0x6a2c('0x5a')](_0x486525)){logger['debug']('[%s][voiceQueueReport][agentconnect]',_0x486525[_0x6a2c('0x50')],util[_0x6a2c('0x44')](_0x486525,{'showHidden':![],'depth':null}));if(this[_0x6a2c('0x11')][_0x486525['uniqueid']]){var _0xe6bc68=_[_0x6a2c('0x82')](this[_0x6a2c('0x11')][_0x486525[_0x6a2c('0x50')]]);_0xe6bc68[_0x6a2c('0x7d')]=!![];_0xe6bc68[_0x6a2c('0x80')]='COMPLETEDBYAGENT';logger['info']('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0xe6bc68['queue'],_0xe6bc68['type']);}}}catch(_0x28ad1d){logger[_0x6a2c('0x41')](_0x6a2c('0x87'),_0x486525[_0x6a2c('0x50')],util[_0x6a2c('0x44')](_0x28ad1d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6a2c('0xc')][_0x6a2c('0x27')]=function(_0x3ce8ee){try{if(this['isNotNull'](_0x3ce8ee)){logger[_0x6a2c('0x4d')]('[%s][voiceQueueReport][agentcomplete]',_0x3ce8ee[_0x6a2c('0x50')],util[_0x6a2c('0x44')](_0x3ce8ee,{'showHidden':![],'depth':null}));if(this[_0x6a2c('0x11')][_0x3ce8ee['uniqueid']]){var _0x1961e1=_['last'](this[_0x6a2c('0x11')][_0x3ce8ee[_0x6a2c('0x50')]]);_0x1961e1[_0x6a2c('0x23')]=![];_0x1961e1['queuecallerabandonAt']=null;_0x1961e1[_0x6a2c('0x88')]=!![];_0x1961e1[_0x6a2c('0x89')]=_0x3ce8ee['membername'];_0x1961e1[_0x6a2c('0x7e')]=_0x3ce8ee['holdtime'];_0x1961e1[_0x6a2c('0x7d')]=!![];_0x1961e1[_0x6a2c('0x8a')]=![];_0x1961e1[_0x6a2c('0x8b')]=null;if(!_0x1961e1['transfer']){if(_0x3ce8ee[_0x6a2c('0x8c')]==_0x6a2c('0x8d')){_0x1961e1[_0x6a2c('0x80')]=_0x6a2c('0x8e');logger[_0x6a2c('0x78')](_0x6a2c('0x8f'),_0x1961e1[_0x6a2c('0x55')],_0x1961e1[_0x6a2c('0x57')]);}else{if(_[_0x6a2c('0x90')](_0x3ce8ee['channel']['toLowerCase'](),'local/')){if(this[_0x6a2c('0x11')][_0x3ce8ee[_0x6a2c('0x91')]]){var _0xa871bb=_[_0x6a2c('0x82')](this[_0x6a2c('0x11')][_0x3ce8ee[_0x6a2c('0x91')]]);_0xa871bb[_0x6a2c('0x7d')]=![];_0xa871bb[_0x6a2c('0x8a')]=!![];_0xa871bb[_0x6a2c('0x8b')]=moment(_0x1961e1[_0x6a2c('0x73')])['add'](_0x3ce8ee[_0x6a2c('0x7e')],_0x6a2c('0x92'))['format'](_0x6a2c('0x74'));_0xa871bb[_0x6a2c('0x80')]=_0x6a2c('0x93');_0xa871bb[_0x6a2c('0x8d')]=!![];_0xa871bb['transfertype']=_0x6a2c('0x94');_0xa871bb['transferexten']=_0x3ce8ee['destexten'];_0xa871bb[_0x6a2c('0x95')]=_0x3ce8ee['uniqueid'];logger[_0x6a2c('0x78')](_0x6a2c('0x96'),_0xa871bb[_0x6a2c('0x55')],_0xa871bb['type']);var _0x1e1374=this[_0x6a2c('0x11')][_0x3ce8ee[_0x6a2c('0x91')]];this['queueReports'][_0x3ce8ee[_0x6a2c('0x91')]]=this[_0x6a2c('0x11')][_0x3ce8ee[_0x6a2c('0x50')]];this[_0x6a2c('0x11')][_0x3ce8ee[_0x6a2c('0x50')]]=_0x1e1374;}}else{_0x1961e1[_0x6a2c('0x80')]=_0x6a2c('0x97')+_0x3ce8ee[_0x6a2c('0x8c')][_0x6a2c('0x98')]();logger[_0x6a2c('0x78')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x1961e1['queue'],_0x1961e1[_0x6a2c('0x57')],_0x1961e1[_0x6a2c('0x80')]);}}}this[_0x6a2c('0x14')][_0x3ce8ee['uniqueid']]=_0x1961e1;}}}catch(_0x29294c){logger[_0x6a2c('0x41')](_0x6a2c('0x99'),_0x3ce8ee[_0x6a2c('0x50')],util[_0x6a2c('0x44')](_0x29294c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6a2c('0xc')][_0x6a2c('0x2b')]=function(_0x312c3f){try{if(this[_0x6a2c('0x5a')](_0x312c3f)){logger[_0x6a2c('0x4d')]('[%s][voiceQueueReport][varset]',_0x312c3f[_0x6a2c('0x50')],util['inspect'](_0x312c3f,{'showHidden':![],'depth':null}));this['addVariable'](_0x312c3f[_0x6a2c('0x50')],_[_0x6a2c('0x7a')](_0x312c3f[_0x6a2c('0x9a')])[0x0],_0x312c3f[_0x6a2c('0x9b')]);if(this['queueReports'][_0x312c3f[_0x6a2c('0x50')]]){var _0x16da05=_[_0x6a2c('0x82')](this['queueReports'][_0x312c3f['uniqueid']]);if(_0x16da05){if(this['isNotNull'](_0x312c3f[_0x6a2c('0x9a')])&&this[_0x6a2c('0x5a')](_0x312c3f[_0x6a2c('0x9a')][_0x6a2c('0x68')])){switch(_0x312c3f['value']){case'CONTINUE':_0x16da05['queuecallerexit']=![];_0x16da05[_0x6a2c('0x8b')]=null;break;case'TIMEOUT':_0x16da05[_0x6a2c('0x9c')]='timeout';_0x16da05[_0x6a2c('0x8a')]=!![];_0x16da05[_0x6a2c('0x8b')]=moment()[_0x6a2c('0x51')](_0x6a2c('0x74'));_0x16da05[_0x6a2c('0x83')]=moment()[_0x6a2c('0x51')](_0x6a2c('0x74'));logger[_0x6a2c('0x4d')](_0x6a2c('0x9d'),_0x312c3f[_0x6a2c('0x50')],util[_0x6a2c('0x44')](_0x16da05,{'showHidden':![],'depth':null}));ami[_0x6a2c('0x4b')](_0x6a2c('0x9e'),_0x16da05);break;default:_0x16da05['queuecallerexit']=!![];_0x16da05[_0x6a2c('0x8b')]=moment()[_0x6a2c('0x51')](_0x6a2c('0x74'));_0x16da05[_0x6a2c('0x83')]=moment()[_0x6a2c('0x51')](_0x6a2c('0x74'));}_0x16da05[_0x6a2c('0x23')]=![];_0x16da05[_0x6a2c('0x9f')]=null;_0x16da05[_0x6a2c('0x80')]=_0x312c3f[_0x6a2c('0x9b')];this[_0x6a2c('0x14')][_0x312c3f[_0x6a2c('0x50')]]=_0x16da05;this[_0x6a2c('0x4a')](_0x16da05,_0x6a2c('0x2a'));}else if(this['isNotNull'](_0x312c3f['variable'])&&this[_0x6a2c('0x5a')](_0x312c3f[_0x6a2c('0x9a')]['queueposition'])){if(!_0x16da05[_0x6a2c('0x23')]){_0x16da05['queuecallerexit']=!![];_0x16da05[_0x6a2c('0x8b')]=moment()[_0x6a2c('0x51')](_0x6a2c('0x74'));_0x16da05[_0x6a2c('0x80')]=_0x6a2c('0xa0');_0x16da05['queuecallerleaveAt']=moment()[_0x6a2c('0x51')](_0x6a2c('0x74'));this['channels'][_0x312c3f[_0x6a2c('0x50')]]=_0x16da05;}}logger['info'](_0x6a2c('0xa1'),_0x312c3f['uniqueid'],_0x16da05['queue'],_0x16da05['type'],_[_0x6a2c('0x7a')](_0x312c3f[_0x6a2c('0x9a')])[0x0],_0x312c3f['value']);_0x16da05['variables']=this[_0x6a2c('0x18')][_0x312c3f[_0x6a2c('0x50')]];}}}}catch(_0x421fbd){logger[_0x6a2c('0x41')](_0x6a2c('0xa2'),_0x312c3f[_0x6a2c('0x50')],util[_0x6a2c('0x44')](_0x421fbd,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['addVariable']=function(_0x572f0d,_0x1dd7c7,_0x1fba0a){var _0x5ce9e5=['rtpaudioqos',_0x6a2c('0xa3'),_0x6a2c('0xa4'),_0x6a2c('0xa5'),_0x6a2c('0xa6'),'rtpaudioqoslossbridged',_0x6a2c('0xa7'),'rtpaudioqosrttbridged',_0x6a2c('0xa8'),_0x6a2c('0xa9'),'bridgepeer',_0x6a2c('0xaa'),_0x6a2c('0xab'),_0x6a2c('0xac'),'memberinterface','memberlastcall',_0x6a2c('0xad'),_0x6a2c('0xae'),_0x6a2c('0xaf')];if(!_[_0x6a2c('0xb0')](_0x1dd7c7)&&!_[_0x6a2c('0xb1')](_0x5ce9e5,_0x1dd7c7)){if(_[_0x6a2c('0x71')](this[_0x6a2c('0x18')][_0x572f0d])){this[_0x6a2c('0x18')][_0x572f0d]={};}this['variables'][_0x572f0d][_0x1dd7c7]=_0x1fba0a;}};VoiceQueueReport[_0x6a2c('0xc')][_0x6a2c('0xb2')]=function(_0x5a12d5,_0x2e1764,_0x2178e3){try{var _0x1e592d={};if(this[_0x6a2c('0x11')][_0x5a12d5]){for(var _0x37ca86=0x0;_0x37ca860x0?!![]:![];if(!_0x3dcc3c){return this['syncQueueSummaryComplete'](this['summary'][_0x47d3('0x70')]);}};VoiceQueueReport[_0x47d3('0xb')][_0x47d3('0x14')]=function(_0x5c1b29){var _0x447686=this[_0x47d3('0x10')]['id'];if(this[_0x47d3('0x10')][_0x47d3('0x63')][_0x447686]&&this[_0x47d3('0x10')][_0x47d3('0x63')][_0x447686][_0x5c1b29[_0x47d3('0x62')]]){this[_0x47d3('0x10')][_0x47d3('0x63')][_0x447686][_0x5c1b29[_0x47d3('0x62')]][_0x47d3('0x48')]['push'](_0x5c1b29);}};VoiceQueueReport[_0x47d3('0xb')][_0x47d3('0x71')]=function(_0x3bd818){var _0x5013a2=this;try{if(this[_0x47d3('0x5c')](_0x3bd818)&&this[_0x47d3('0x5c')](_0x3bd818['queue'])){logger[_0x47d3('0x4c')](_0x47d3('0x72'),util[_0x47d3('0x44')](_0x3bd818,{'showHidden':![],'depth':null}));var _0x6fe106=this[_0x47d3('0xf')][_0x3bd818[_0x47d3('0x51')]];if(_0x6fe106){logger[_0x47d3('0x4c')](_0x47d3('0x73'),_0x6fe106[_0x47d3('0x67')]);this[_0x47d3('0x10')][_0x47d3('0x66')][_0x6fe106['name']]={'summaryEvent':_0x3bd818};this[_0x47d3('0x10')]['statusRequests']+=0x1;return ami[_0x47d3('0x3d')]({'action':_0x47d3('0x63'),'queue':_0x6fe106[_0x47d3('0x67')]})[_0x47d3('0x74')](function(_0x18451b){if(!_0x5013a2['summary'][_0x47d3('0x63')][_0x3bd818[_0x47d3('0x62')]]){_0x5013a2[_0x47d3('0x10')][_0x47d3('0x63')][_0x3bd818[_0x47d3('0x62')]]={};}_0x5013a2['summary']['queuestatus'][_0x3bd818[_0x47d3('0x62')]][_0x18451b[_0x47d3('0x62')]]={'queue':_0x6fe106['name'],'agents':[]};})[_0x47d3('0x5f')](function(_0x2d4f5b){throw _0x2d4f5b;});}}}catch(_0x411d96){logger[_0x47d3('0x42')](_0x47d3('0x64'),util['inspect'](_0x411d96,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x47d3('0xb')][_0x47d3('0x75')]=function(_0x48dbb5){if(this['summary']['statusRequests']>0x0){this[_0x47d3('0x10')]['completeEvent']=_0x48dbb5;return;}logger[_0x47d3('0x4c')](_0x47d3('0x76'),util[_0x47d3('0x44')](_0x48dbb5,{'showHidden':![],'depth':null}));this[_0x47d3('0x10')]=initializeSummary();ami[_0x47d3('0x4b')]('custom:queuesummarycomplete',{});};VoiceQueueReport[_0x47d3('0xb')]['syncQueueCallerJoin']=function(_0x29f76d){try{if(this[_0x47d3('0x5c')](_0x29f76d)){logger[_0x47d3('0x4c')](_0x47d3('0x77'),_0x29f76d['uniqueid'],util[_0x47d3('0x44')](_0x29f76d,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0x47d3('0xe')][_0x29f76d[_0x47d3('0x4f')]])){this['queueReports'][_0x29f76d[_0x47d3('0x4f')]]=[];}if(_[_0x47d3('0x5d')](this[_0x47d3('0x38')][_0x29f76d[_0x47d3('0x4f')]])){this[_0x47d3('0x38')][_0x29f76d['uniqueid']]={};}var _0x219d9b=new QueueReport();_0x219d9b[_0x47d3('0x51')]=_0x29f76d[_0x47d3('0x51')];_0x219d9b[_0x47d3('0x6d')]=this[_0x47d3('0xf')][_0x219d9b['queue']]&&this['voiceQueues'][_0x219d9b[_0x47d3('0x51')]][_0x47d3('0x6d')]?this[_0x47d3('0xf')][_0x219d9b[_0x47d3('0x51')]][_0x47d3('0x6d')]||_0x47d3('0x5a'):_0x47d3('0x5a');_0x219d9b['queuecallerjoinAt']=moment()[_0x47d3('0x56')](_0x47d3('0x78'));_0x219d9b['position']=_0x29f76d['position'];_0x219d9b[_0x47d3('0x79')]=_0x29f76d[_0x47d3('0x79')];_0x219d9b[_0x47d3('0x4f')]=_0x29f76d[_0x47d3('0x4f')];_0x219d9b[_0x47d3('0x7a')]=this[_0x47d3('0x38')][_0x29f76d['uniqueid']][_0x47d3('0x7a')];logger['info']('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x219d9b[_0x47d3('0x51')],_0x219d9b[_0x47d3('0x6d')]);Object[_0x47d3('0x6b')](_0x219d9b,_['pick'](_0x29f76d,_[_0x47d3('0x7b')](_0x219d9b)));this[_0x47d3('0xe')][_0x29f76d['uniqueid']][_0x47d3('0x7c')](_0x219d9b);this[_0x47d3('0x38')][_0x29f76d[_0x47d3('0x4f')]]=_0x219d9b;this['emitVoiceQueueChannelSave'](_0x219d9b,_0x47d3('0x7d'));}}catch(_0x2519d4){logger[_0x47d3('0x42')](_0x47d3('0x77'),_0x29f76d[_0x47d3('0x4f')],util['inspect'](_0x2519d4,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x47d3('0xb')]['syncQueueCallerAbandon']=function(_0x42ba79){try{if(this[_0x47d3('0x5c')](_0x42ba79)){logger[_0x47d3('0x4c')](_0x47d3('0x7e'),_0x42ba79['uniqueid'],util['inspect'](_0x42ba79,{'showHidden':![],'depth':null}));if(this[_0x47d3('0xe')][_0x42ba79['uniqueid']]){var _0x81757=_['last'](this[_0x47d3('0xe')][_0x42ba79[_0x47d3('0x4f')]]);_0x81757['queuecallercomplete']=![];_0x81757[_0x47d3('0x7f')]=null;_0x81757[_0x47d3('0x80')]=_0x42ba79['holdtime'];_0x81757[_0x47d3('0x81')]=_0x42ba79[_0x47d3('0x81')];_0x81757[_0x47d3('0x19')]=!![];_0x81757[_0x47d3('0x82')]=moment()[_0x47d3('0x56')](_0x47d3('0x78'));_0x81757[_0x47d3('0x55')]=_0x47d3('0x83');_0x81757['lastAssignedTo']=null;logger[_0x47d3('0x84')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x81757[_0x47d3('0x51')],_0x81757[_0x47d3('0x6d')]);this[_0x47d3('0x38')][_0x42ba79[_0x47d3('0x4f')]]=_0x81757;this['emitVoiceQueueChannelRemove'](_0x81757,_0x47d3('0x19'));}}}catch(_0x50ed72){logger[_0x47d3('0x42')](_0x47d3('0x7e'),_0x42ba79['uniqueid'],util[_0x47d3('0x44')](_0x50ed72,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x47d3('0xb')][_0x47d3('0x1c')]=function(_0x311df2){try{if(this[_0x47d3('0x5c')](_0x311df2)){logger[_0x47d3('0x4c')]('[%s][voiceQueueReport][queuecallerleave]',_0x311df2[_0x47d3('0x4f')],util[_0x47d3('0x44')](_0x311df2,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x311df2[_0x47d3('0x4f')]]){var _0x3f5081=_['last'](this[_0x47d3('0xe')][_0x311df2['uniqueid']]);_0x3f5081[_0x47d3('0x85')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x3f5081[_0x47d3('0x86')]=_0x311df2[_0x47d3('0x86')];_0x3f5081['connectedlinename']=_0x311df2[_0x47d3('0x87')];logger[_0x47d3('0x84')](_0x47d3('0x88'),_0x3f5081[_0x47d3('0x51')],_0x3f5081[_0x47d3('0x6d')],_0x311df2[_0x47d3('0x86')],_0x311df2['connectedlinename']);this[_0x47d3('0x38')][_0x311df2[_0x47d3('0x4f')]]=_0x3f5081;this['emitVoiceQueueChannelSave'](_0x3f5081,'queuecallerleave');}}}catch(_0x4b00f6){logger[_0x47d3('0x42')]('[%s][voiceQueueReport][queuecallerleave]',_0x311df2[_0x47d3('0x4f')],util[_0x47d3('0x44')](_0x4b00f6,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x47d3('0x20')]=function(_0x757e18){try{if(this[_0x47d3('0x5c')](_0x757e18)){logger[_0x47d3('0x4c')](_0x47d3('0x89'),_0x757e18['uniqueid'],util['inspect'](_0x757e18,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x757e18[_0x47d3('0x4f')]]){var _0x5b6275=_['last'](this[_0x47d3('0xe')][_0x757e18['uniqueid']]);_0x5b6275['queuecallercomplete']=!![];_0x5b6275['queuecallerexitreason']=_0x47d3('0x8a');logger[_0x47d3('0x84')](_0x47d3('0x8b'),_0x5b6275[_0x47d3('0x51')],_0x5b6275[_0x47d3('0x6d')]);}}}catch(_0x1fa792){logger[_0x47d3('0x42')](_0x47d3('0x89'),_0x757e18[_0x47d3('0x4f')],util[_0x47d3('0x44')](_0x1fa792,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x47d3('0xb')][_0x47d3('0x1e')]=function(_0x5c9ab1){try{if(this[_0x47d3('0x5c')](_0x5c9ab1)){logger['debug'](_0x47d3('0x8c'),_0x5c9ab1[_0x47d3('0x4f')],util[_0x47d3('0x44')](_0x5c9ab1,{'showHidden':![],'depth':null}));if(this[_0x47d3('0xe')][_0x5c9ab1[_0x47d3('0x4f')]]){var _0x5292f1=_[_0x47d3('0x8d')](this['queueReports'][_0x5c9ab1[_0x47d3('0x4f')]]);_0x5292f1[_0x47d3('0x19')]=![];_0x5292f1[_0x47d3('0x82')]=null;_0x5292f1[_0x47d3('0x8e')]=!![];_0x5292f1['lastAssignedTo']=_0x5c9ab1['membername'];_0x5292f1[_0x47d3('0x80')]=_0x5c9ab1[_0x47d3('0x80')];_0x5292f1['queuecallercomplete']=!![];_0x5292f1[_0x47d3('0x35')]=![];_0x5292f1[_0x47d3('0x8f')]=null;if(!_0x5292f1[_0x47d3('0x90')]){if(_0x5c9ab1[_0x47d3('0x91')]==_0x47d3('0x90')){_0x5292f1['queuecallerexitreason']=_0x47d3('0x92');logger['info'](_0x47d3('0x93'),_0x5292f1[_0x47d3('0x51')],_0x5292f1[_0x47d3('0x6d')]);}else{if(_[_0x47d3('0x94')](_0x5c9ab1[_0x47d3('0x3f')][_0x47d3('0x95')](),_0x47d3('0x96'))){if(this[_0x47d3('0xe')][_0x5c9ab1[_0x47d3('0x97')]]){var _0x28f09c=_[_0x47d3('0x8d')](this[_0x47d3('0xe')][_0x5c9ab1[_0x47d3('0x97')]]);_0x28f09c['queuecallercomplete']=![];_0x28f09c[_0x47d3('0x35')]=!![];_0x28f09c[_0x47d3('0x8f')]=moment(_0x5292f1[_0x47d3('0x98')])[_0x47d3('0x99')](_0x5c9ab1[_0x47d3('0x80')],_0x47d3('0x9a'))['format'](_0x47d3('0x78'));_0x28f09c[_0x47d3('0x55')]=_0x47d3('0x9b');_0x28f09c['transfer']=!![];_0x28f09c[_0x47d3('0x9c')]=_0x47d3('0x9d');_0x28f09c[_0x47d3('0x9e')]=_0x5c9ab1[_0x47d3('0x9f')];_0x28f09c['transferuniqueid']=_0x5c9ab1[_0x47d3('0x4f')];logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x28f09c[_0x47d3('0x51')],_0x28f09c[_0x47d3('0x6d')]);var _0x1ff5e3=this[_0x47d3('0xe')][_0x5c9ab1['linkedid']];this['queueReports'][_0x5c9ab1[_0x47d3('0x97')]]=this[_0x47d3('0xe')][_0x5c9ab1[_0x47d3('0x4f')]];this[_0x47d3('0xe')][_0x5c9ab1[_0x47d3('0x4f')]]=_0x1ff5e3;}}else{_0x5292f1[_0x47d3('0x55')]='COMPLETEDBY'+_0x5c9ab1[_0x47d3('0x91')][_0x47d3('0xa0')]();logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x5292f1[_0x47d3('0x51')],_0x5292f1['type'],_0x5292f1[_0x47d3('0x55')]);}}}this[_0x47d3('0x38')][_0x5c9ab1[_0x47d3('0x4f')]]=_0x5292f1;}}}catch(_0x3a8161){logger[_0x47d3('0x42')](_0x47d3('0x8c'),_0x5c9ab1[_0x47d3('0x4f')],util[_0x47d3('0x44')](_0x3a8161,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x47d3('0xb')][_0x47d3('0x22')]=function(_0x4d6aca){try{if(this[_0x47d3('0x5c')](_0x4d6aca)){logger[_0x47d3('0x4c')](_0x47d3('0xa1'),_0x4d6aca[_0x47d3('0x4f')],util[_0x47d3('0x44')](_0x4d6aca,{'showHidden':![],'depth':null}));this[_0x47d3('0xa2')](_0x4d6aca[_0x47d3('0x4f')],_[_0x47d3('0x7b')](_0x4d6aca[_0x47d3('0xa3')])[0x0],_0x4d6aca['value']);if(this[_0x47d3('0xe')][_0x4d6aca['uniqueid']]){var _0x1baa54=_['last'](this[_0x47d3('0xe')][_0x4d6aca['uniqueid']]);if(_0x1baa54){if(this[_0x47d3('0x5c')](_0x4d6aca[_0x47d3('0xa3')])&&this[_0x47d3('0x5c')](_0x4d6aca[_0x47d3('0xa3')]['queuestatus'])){switch(_0x4d6aca[_0x47d3('0xa4')]){case _0x47d3('0xa5'):_0x1baa54[_0x47d3('0x35')]=![];_0x1baa54[_0x47d3('0x8f')]=null;break;case _0x47d3('0xa6'):_0x1baa54[_0x47d3('0xa7')]='timeout';_0x1baa54[_0x47d3('0x35')]=!![];_0x1baa54['queuecallerexitAt']=moment()[_0x47d3('0x56')](_0x47d3('0x78'));_0x1baa54['queuecallerleaveAt']=moment()[_0x47d3('0x56')](_0x47d3('0x78'));logger[_0x47d3('0x4c')](_0x47d3('0xa8'),_0x4d6aca[_0x47d3('0x4f')],util[_0x47d3('0x44')](_0x1baa54,{'showHidden':![],'depth':null}));ami[_0x47d3('0x4b')]('custom:timeout',_0x1baa54);break;default:_0x1baa54[_0x47d3('0x35')]=!![];_0x1baa54[_0x47d3('0x8f')]=moment()[_0x47d3('0x56')](_0x47d3('0x78'));_0x1baa54[_0x47d3('0x85')]=moment()[_0x47d3('0x56')]('YYYY-MM-DD\x20HH:mm:ss');}_0x1baa54[_0x47d3('0x19')]=![];_0x1baa54[_0x47d3('0x82')]=null;_0x1baa54[_0x47d3('0x55')]=_0x4d6aca[_0x47d3('0xa4')];this['channels'][_0x4d6aca['uniqueid']]=_0x1baa54;this[_0x47d3('0x49')](_0x1baa54,_0x47d3('0x21'));}else if(this[_0x47d3('0x5c')](_0x4d6aca[_0x47d3('0xa3')])&&this['isNotNull'](_0x4d6aca[_0x47d3('0xa3')][_0x47d3('0xa9')])){if(!_0x1baa54[_0x47d3('0x19')]){_0x1baa54[_0x47d3('0x35')]=!![];_0x1baa54[_0x47d3('0x8f')]=moment()[_0x47d3('0x56')](_0x47d3('0x78'));_0x1baa54[_0x47d3('0x55')]=_0x47d3('0xaa');_0x1baa54[_0x47d3('0x85')]=moment()[_0x47d3('0x56')](_0x47d3('0x78'));this[_0x47d3('0x38')][_0x4d6aca[_0x47d3('0x4f')]]=_0x1baa54;}}logger[_0x47d3('0x84')](_0x47d3('0xab'),_0x4d6aca['uniqueid'],_0x1baa54['queue'],_0x1baa54[_0x47d3('0x6d')],_[_0x47d3('0x7b')](_0x4d6aca['variable'])[0x0],_0x4d6aca[_0x47d3('0xa4')]);_0x1baa54[_0x47d3('0x11')]=this[_0x47d3('0x11')][_0x4d6aca[_0x47d3('0x4f')]];}}}}catch(_0x55101d){logger[_0x47d3('0x42')](_0x47d3('0xa1'),_0x4d6aca[_0x47d3('0x4f')],util[_0x47d3('0x44')](_0x55101d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x47d3('0xb')][_0x47d3('0xa2')]=function(_0x261c4b,_0x3d55be,_0x8f0c25){var _0xd79549=[_0x47d3('0xac'),_0x47d3('0xad'),'rtpaudioqosjitter',_0x47d3('0xae'),_0x47d3('0xaf'),_0x47d3('0xb0'),_0x47d3('0xb1'),_0x47d3('0xb2'),_0x47d3('0xb3'),_0x47d3('0xb4'),_0x47d3('0xb5'),_0x47d3('0xb6'),_0x47d3('0xb7'),_0x47d3('0xb8'),_0x47d3('0xb9'),_0x47d3('0xba'),'membername',_0x47d3('0xbb'),'memberrealtime'];if(!_['isNil'](_0x3d55be)&&!_[_0x47d3('0xbc')](_0xd79549,_0x3d55be)){if(_[_0x47d3('0x5d')](this[_0x47d3('0x11')][_0x261c4b])){this[_0x47d3('0x11')][_0x261c4b]={};}this[_0x47d3('0x11')][_0x261c4b][_0x3d55be]=_0x8f0c25;}};VoiceQueueReport[_0x47d3('0xb')][_0x47d3('0xbd')]=function(_0x400e34,_0x371c41,_0x221642){try{var _0x1818bf={};if(this[_0x47d3('0xe')][_0x400e34]){for(var _0x739054=0x0;_0x739054=0x0?moment(_0x289a0c[_0x0c5a('0x14')])[_0x0c5a('0x15')](_0x289a0c['starttime'],_0x0c5a('0xc')):null,'data1':_0x0c5a('0x16'),'data2':_0x289a0c[_0x0c5a('0xf')],'data3':_0x289a0c[_0x0c5a('0xd')],'data4':_0x289a0c[_0x0c5a('0x17')]||null,'role':_0x0c5a('0x18'),'internal':_0x289a0c[_0x0c5a('0xf')]?_[_0x0c5a('0x19')](_0x289a0c[_0x0c5a('0xf')]):undefined,'uniqueid':_0x289a0c[_0x0c5a('0x10')]},'log':_0x0c5a('0x11')});}; \ No newline at end of file +var _0x9831=['diff','seconds','inbound','queue','agent','toNumber','uniqueid','CreateMemberReport','voiceDialReport','voice','starttime','endtime','outbound','accountcode','exten','dialstring','moment','lodash','util','../client','queuecallercompleteAt','queuecallerexitAt','Request','isNil','interface','format','SIP/%s','lastAssignedTo','TALKING','queuecallerleaveAt'];(function(_0x4be687,_0xe630cc){var _0x42156f=function(_0x5ae44b){while(--_0x5ae44b){_0x4be687['push'](_0x4be687['shift']());}};_0x42156f(++_0xe630cc);}(_0x9831,0x11e));var _0x1983=function(_0x4d97e5,_0x501455){_0x4d97e5=_0x4d97e5-0x0;var _0x5a8c94=_0x9831[_0x4d97e5];return _0x5a8c94;};'use strict';var moment=require(_0x1983('0x0'));var _=require(_0x1983('0x1'));var util=require(_0x1983('0x2'));var client=require(_0x1983('0x3'));exports['voiceQueueReport']=function(_0x51b707){var _0x40a8a1=_0x51b707[_0x1983('0x4')]||_0x51b707[_0x1983('0x5')];return client[_0x1983('0x6')]('CreateMemberReport',{'body':{'channel':'voice','membername':_0x51b707['lastAssignedTo'],'interface':_[_0x1983('0x7')](_0x51b707[_0x1983('0x8')])?util[_0x1983('0x9')](_0x1983('0xa'),_0x51b707[_0x1983('0xb')]):_0x51b707[_0x1983('0x8')],'type':_0x1983('0xc'),'enterAt':_0x51b707[_0x1983('0xd')],'exitAt':_0x40a8a1,'duration':moment(_0x40a8a1)[_0x1983('0xe')](_0x51b707[_0x1983('0xd')],_0x1983('0xf')),'data1':_0x1983('0x10'),'data2':_0x51b707['calleridnum'],'data3':_0x51b707['exten'],'data4':null,'data5':_0x51b707[_0x1983('0x11')],'role':_0x1983('0x12'),'internal':_0x51b707['accountcode']?_[_0x1983('0x13')](_0x51b707['accountcode']):undefined,'uniqueid':_0x51b707[_0x1983('0x14')]},'log':_0x1983('0x15')});};exports[_0x1983('0x16')]=function(_0x161a16){return client['Request'](_0x1983('0x15'),{'body':{'channel':_0x1983('0x17'),'membername':_0x161a16['membername'],'interface':_0x161a16[_0x1983('0x8')],'type':_0x1983('0xc'),'enterAt':_0x161a16[_0x1983('0x18')],'exitAt':_0x161a16[_0x1983('0x19')],'duration':moment(_0x161a16[_0x1983('0x19')])['diff'](_0x161a16['starttime'],_0x1983('0xf'))>=0x0?moment(_0x161a16[_0x1983('0x19')])[_0x1983('0xe')](_0x161a16[_0x1983('0x18')],_0x1983('0xf')):null,'data1':_0x1983('0x1a'),'data2':_0x161a16[_0x1983('0x1b')],'data3':_0x161a16[_0x1983('0x1c')],'data4':_0x161a16[_0x1983('0x1d')]||null,'role':_0x1983('0x12'),'internal':_0x161a16['accountcode']?_[_0x1983('0x13')](_0x161a16[_0x1983('0x1b')]):undefined,'uniqueid':_0x161a16[_0x1983('0x14')]},'log':_0x1983('0x15')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index a3c0c21..98ca137 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 _0x71d3=['GetSettings','../client','getSettings','Request','stopRecordingOnTransfer','previewRecallmeReminderInterval'];(function(_0x4c04c4,_0x80379a){var _0x18d6ad=function(_0x465680){while(--_0x465680){_0x4c04c4['push'](_0x4c04c4['shift']());}};_0x18d6ad(++_0x80379a);}(_0x71d3,0x67));var _0x371d=function(_0x45f928,_0xbfdeb0){_0x45f928=_0x45f928-0x0;var _0xc2b6d7=_0x71d3[_0x45f928];return _0xc2b6d7;};'use strict';var client=require(_0x371d('0x0'));exports[_0x371d('0x1')]=function(){return client[_0x371d('0x2')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x371d('0x3'),_0x371d('0x4')]},'log':_0x371d('0x5')});}; \ No newline at end of file +var _0xcb9c=['getSettings','Request','ShowSetting','stopRecordingOnTransfer','previewRecallmeReminderInterval','GetSettings','../client'];(function(_0x410fd4,_0x3daf45){var _0x48df45=function(_0x5b08c7){while(--_0x5b08c7){_0x410fd4['push'](_0x410fd4['shift']());}};_0x48df45(++_0x3daf45);}(_0xcb9c,0x110));var _0xccb9=function(_0x42988e,_0x2be06d){_0x42988e=_0x42988e-0x0;var _0x1b472a=_0xcb9c[_0x42988e];return _0x1b472a;};'use strict';var client=require(_0xccb9('0x0'));exports[_0xccb9('0x1')]=function(){return client[_0xccb9('0x2')](_0xccb9('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xccb9('0x4'),_0xccb9('0x5')]},'log':_0xccb9('0x6')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 112def4..80cc61b 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 _0x5b25=['html','../client','Request','GetTemplate'];(function(_0xbb1684,_0x4224ae){var _0x176790=function(_0x4bc038){while(--_0x4bc038){_0xbb1684['push'](_0xbb1684['shift']());}};_0x176790(++_0x4224ae);}(_0x5b25,0xc9));var _0x55b2=function(_0x57d558,_0xa5c6a4){_0x57d558=_0x57d558-0x0;var _0x576836=_0x5b25[_0x57d558];return _0x576836;};'use strict';var client=require(_0x55b2('0x0'));exports['getTemplates']=function(_0x1f3daf){return function(_0x36cace){return client[_0x55b2('0x1')](_0x55b2('0x2'),{'options':{'raw':!![],'attributes':['id','name',_0x55b2('0x3')]},'log':_0x55b2('0x2')});};}; \ No newline at end of file +var _0xd1bf=['name','GetTemplate','../client','getTemplates'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0xd1bf,0x162));var _0xfd1b=function(_0x1b9310,_0x5d76cd){_0x1b9310=_0x1b9310-0x0;var _0x53b4a8=_0xd1bf[_0x1b9310];return _0x53b4a8;};'use strict';var client=require(_0xfd1b('0x0'));exports[_0xfd1b('0x1')]=function(_0x10f4a0){return function(_0x422132){return client['Request']('GetTemplate',{'options':{'raw':!![],'attributes':['id',_0xfd1b('0x2'),'html']},'log':_0xfd1b('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 9a833a8..5ac4cb1 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 _0xe46b=['operator','value','Action','action','data2','data3','data4','data5','data6','../client','Request','GetTrigger','name','channel','Condition','field'];(function(_0x1861d4,_0x295ec8){var _0x4df574=function(_0x3838bf){while(--_0x3838bf){_0x1861d4['push'](_0x1861d4['shift']());}};_0x4df574(++_0x295ec8);}(_0xe46b,0x169));var _0xbe46=function(_0x8a2c79,_0x44600b){_0x8a2c79=_0x8a2c79-0x0;var _0x5f3ea3=_0xe46b[_0x8a2c79];return _0x5f3ea3;};'use strict';var client=require(_0xbe46('0x0'));exports['getTriggers']=function(_0xf3abfe){return function(_0x17ae0c){return client[_0xbe46('0x1')](_0xbe46('0x2'),{'options':{'raw':![],'attributes':['id',_0xbe46('0x3'),_0xbe46('0x4'),'status'],'include':[{'model':_0xbe46('0x5'),'as':'AllConditions','attributes':['id',_0xbe46('0x6'),_0xbe46('0x7'),_0xbe46('0x8')]},{'model':_0xbe46('0x5'),'as':'AnyConditions','attributes':['id','field','operator',_0xbe46('0x8')]},{'model':_0xbe46('0x9'),'as':'Actions','attributes':['id',_0xbe46('0xa'),'data1',_0xbe46('0xb'),_0xbe46('0xc'),_0xbe46('0xd'),_0xbe46('0xe'),_0xbe46('0xf'),'data7']}]},'log':_0xbe46('0x2')});};}; \ No newline at end of file +var _0xe684=['data1','data5','data6','data7','../client','getTriggers','Request','GetTrigger','name','channel','status','Condition','AllConditions','operator','value','AnyConditions','Actions','action'];(function(_0x5575cd,_0x73ab7a){var _0x4979a0=function(_0x1ac744){while(--_0x1ac744){_0x5575cd['push'](_0x5575cd['shift']());}};_0x4979a0(++_0x73ab7a);}(_0xe684,0x1c6));var _0x4e68=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xe684[_0x21a9d9];return _0x46adce;};'use strict';var client=require(_0x4e68('0x0'));exports[_0x4e68('0x1')]=function(_0x2f7164){return function(_0x18e69e){return client[_0x4e68('0x2')](_0x4e68('0x3'),{'options':{'raw':![],'attributes':['id',_0x4e68('0x4'),_0x4e68('0x5'),_0x4e68('0x6')],'include':[{'model':_0x4e68('0x7'),'as':_0x4e68('0x8'),'attributes':['id','field',_0x4e68('0x9'),_0x4e68('0xa')]},{'model':_0x4e68('0x7'),'as':_0x4e68('0xb'),'attributes':['id','field',_0x4e68('0x9'),'value']},{'model':'Action','as':_0x4e68('0xc'),'attributes':['id',_0x4e68('0xd'),_0x4e68('0xe'),'data2','data3','data4',_0x4e68('0xf'),_0x4e68('0x10'),_0x4e68('0x11')]}]},'log':_0x4e68('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 3a0ed61..4eee931 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 _0x8e51=['Request','GetTrunk','registry','defaultuser','../client','getTrunks'];(function(_0x215eab,_0x3c3938){var _0x31d024=function(_0x1389a7){while(--_0x1389a7){_0x215eab['push'](_0x215eab['shift']());}};_0x31d024(++_0x3c3938);}(_0x8e51,0x1e4));var _0x18e5=function(_0x19eee6,_0x28d61c){_0x19eee6=_0x19eee6-0x0;var _0x46fd52=_0x8e51[_0x19eee6];return _0x46fd52;};'use strict';var client=require(_0x18e5('0x0'));exports[_0x18e5('0x1')]=function(_0x5461c7){return function(_0x335d4c){return client[_0x18e5('0x2')](_0x18e5('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0x18e5('0x4'),_0x18e5('0x5')]},'log':_0x18e5('0x3')});};}; \ No newline at end of file +var _0x4680=['GetTrunk','name','registry','defaultuser','../client','getTrunks'];(function(_0x4c305c,_0x49de54){var _0x5cdb06=function(_0x56c0ea){while(--_0x56c0ea){_0x4c305c['push'](_0x4c305c['shift']());}};_0x5cdb06(++_0x49de54);}(_0x4680,0x106));var _0x0468=function(_0x5c6cd2,_0x3649e5){_0x5c6cd2=_0x5c6cd2-0x0;var _0x158d09=_0x4680[_0x5c6cd2];return _0x158d09;};'use strict';var client=require(_0x0468('0x0'));exports[_0x0468('0x1')]=function(_0x5569a9){return function(_0x3dced4){return client['Request'](_0x0468('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x0468('0x3'),_0x0468('0x4'),_0x0468('0x5')]},'log':_0x0468('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 0ac70e0..f9e66b2 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 _0x70e0=['getAgents','Request','name','email','accountcode','fullname','lastLoginAt','lastPauseAt','interface','getTelephones','GetUser','telephone','savePause','PauseUser','saveUnpause','getAgent','agent','online','pauseType','../client'];(function(_0x477117,_0xd27452){var _0x31dcfa=function(_0xa2abed){while(--_0xa2abed){_0x477117['push'](_0x477117['shift']());}};_0x31dcfa(++_0xd27452);}(_0x70e0,0x17b));var _0x070e=function(_0xb7f253,_0x3cde5b){_0xb7f253=_0xb7f253-0x0;var _0x116e81=_0x70e0[_0xb7f253];return _0x116e81;};'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 +var _0x9c44=['online','pauseType','Request','GetUser','agent','name','email','accountcode','lastLoginAt','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','telephone','internal','PauseUser','savePause','getAgent','ShowUser','fullname'];(function(_0x19270b,_0x4969d0){var _0x3c3156=function(_0x520d44){while(--_0x520d44){_0x19270b['push'](_0x19270b['shift']());}};_0x3c3156(++_0x4969d0);}(_0x9c44,0x178));var _0x49c4=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x9c44[_0x8c43de];return _0xa6591b;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2')},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5'),'fullname','online',_0x49c4('0x6'),'pauseType',_0x49c4('0x7'),_0x49c4('0x8'),_0x49c4('0x9'),_0x49c4('0xa'),_0x49c4('0xb')]},'log':'getAgents'});};};exports[_0x49c4('0xc')]=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':!![],'where':{'role':_0x49c4('0xd')},'attributes':['id','name','accountcode',_0x49c4('0xe')]},'log':_0x49c4('0xc')});};};exports['savePause']=function(_0xb611a1,_0x459d09,_0x4adb3c){return client['Request'](_0x49c4('0xf'),{'body':{'type':_0x459d09,'uniqueid':_0x4adb3c},'options':{'where':{'id':_0xb611a1['id']}},'log':_0x49c4('0x10')});};exports['saveUnpause']=function(_0x7df3a9){return client[_0x49c4('0x0')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x7df3a9['id']}},'log':_0x49c4('0x10')});};exports[_0x49c4('0x11')]=function(_0x21f15a){return client[_0x49c4('0x0')](_0x49c4('0x12'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2'),'id':_0x21f15a},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),'accountcode',_0x49c4('0x13'),_0x49c4('0x14'),_0x49c4('0x6'),_0x49c4('0x15'),_0x49c4('0x7'),'voicePause',_0x49c4('0xb')]},'log':_0x49c4('0x11')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index edf4835..72f31d2 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 _0xbf3c=['create','Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport','../client'];(function(_0x517db2,_0x22e5f6){var _0x636271=function(_0x4af022){while(--_0x4af022){_0x517db2['push'](_0x517db2['shift']());}};_0x636271(++_0x22e5f6);}(_0xbf3c,0x1c7));var _0xcbf3=function(_0x3aae99,_0x2c436d){_0x3aae99=_0x3aae99-0x0;var _0x1093fe=_0xbf3c[_0x3aae99];return _0x1093fe;};'use strict';var client=require(_0xcbf3('0x0'));exports[_0xcbf3('0x1')]=function(_0x2ef3f8){return client[_0xcbf3('0x2')]('CreateVoiceAgentReport',{'body':_0x2ef3f8,'log':_0xcbf3('0x3')});};exports[_0xcbf3('0x4')]=function(_0x3ea8ed,_0x4d2494,_0x383d28){return client[_0xcbf3('0x2')](_0xcbf3('0x5'),{'body':_0x3ea8ed,'options':{'where':{'uniqueid':_0x4d2494,'interface':_0x383d28,'agentcomplete':!![]}},'log':_0xcbf3('0x5')});}; \ No newline at end of file +var _0x307b=['UpdateVoiceAgentReport','../client','Request','CreateVoiceAgentReport','update'];(function(_0xdb7391,_0x3a69cf){var _0x53d9d0=function(_0x5a97fd){while(--_0x5a97fd){_0xdb7391['push'](_0xdb7391['shift']());}};_0x53d9d0(++_0x3a69cf);}(_0x307b,0xfb));var _0xb307=function(_0x32b2ee,_0x254347){_0x32b2ee=_0x32b2ee-0x0;var _0x3df6c3=_0x307b[_0x32b2ee];return _0x3df6c3;};'use strict';var client=require(_0xb307('0x0'));exports['create']=function(_0x427bd7){return client[_0xb307('0x1')]('CreateVoiceAgentReport',{'body':_0x427bd7,'log':_0xb307('0x2')});};exports[_0xb307('0x3')]=function(_0x5b0b35,_0x3e8f49,_0x1aa701){return client[_0xb307('0x1')](_0xb307('0x4'),{'body':_0x5b0b35,'options':{'where':{'uniqueid':_0x3e8f49,'interface':_0x1aa701,'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 08f58c6..20c5bf0 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 _0x4aa8=['duration','billableseconds','moment','lodash','../client','create','Request','CreateVoiceCallReport','merge','calleridnum','context','callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type'];(function(_0x131415,_0x28607d){var _0x2b4605=function(_0x560bf3){while(--_0x560bf3){_0x131415['push'](_0x131415['shift']());}};_0x2b4605(++_0x28607d);}(_0x4aa8,0x162));var _0x84aa=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0x4aa8[_0x50007c];return _0x5c1ec7;};'use strict';var moment=require(_0x84aa('0x0'));var util=require('util');var _=require(_0x84aa('0x1'));var client=require(_0x84aa('0x2'));exports[_0x84aa('0x3')]=function(_0x13e73f){return client[_0x84aa('0x4')](_0x84aa('0x5'),{'body':_[_0x84aa('0x6')](_0x13e73f,{'source':_0x13e73f[_0x84aa('0x7')],'destinationcontext':_0x13e73f[_0x84aa('0x8')],'callerid':_0x13e73f[_0x84aa('0x9')],'amaflags':_0x84aa('0xa')}),'log':'CreateVoiceCallReport'});};exports[_0x84aa('0xb')]=function(){return function(){return client[_0x84aa('0x4')](_0x84aa('0xc'),{'options':{'where':{'type':[_0x84aa('0xd')],'createdAt':{'$between':[moment()[_0x84aa('0xe')](_0x84aa('0xf'))[_0x84aa('0x10')](_0x84aa('0x11')),moment()[_0x84aa('0x12')]('day')[_0x84aa('0x10')](_0x84aa('0x11'))]}},'attributes':[_0x84aa('0x13'),'disposition',_0x84aa('0x14'),_0x84aa('0x15')]},'log':'GetVoiceCallReports'});};}; \ No newline at end of file +var _0x7e92=['lodash','../client','create','Request','CreateVoiceCallReport','merge','calleridnum','context','callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','day','format','YYYY-MM-DD\x20HH:mm:ss','disposition','billableseconds','GetVoiceCallReports'];(function(_0x4e594c,_0xbe926){var _0x10e116=function(_0x4952dc){while(--_0x4952dc){_0x4e594c['push'](_0x4e594c['shift']());}};_0x10e116(++_0xbe926);}(_0x7e92,0xd1));var _0x27e9=function(_0x4c32cc,_0x3aafc7){_0x4c32cc=_0x4c32cc-0x0;var _0x1332dc=_0x7e92[_0x4c32cc];return _0x1332dc;};'use strict';var moment=require('moment');var util=require('util');var _=require(_0x27e9('0x0'));var client=require(_0x27e9('0x1'));exports[_0x27e9('0x2')]=function(_0x2138da){return client[_0x27e9('0x3')](_0x27e9('0x4'),{'body':_[_0x27e9('0x5')](_0x2138da,{'source':_0x2138da[_0x27e9('0x6')],'destinationcontext':_0x2138da[_0x27e9('0x7')],'callerid':_0x2138da[_0x27e9('0x8')],'amaflags':_0x27e9('0x9')}),'log':_0x27e9('0x4')});};exports[_0x27e9('0xa')]=function(){return function(){return client['Request'](_0x27e9('0xb'),{'options':{'where':{'type':[_0x27e9('0xc')],'createdAt':{'$between':[moment()['startOf'](_0x27e9('0xd'))[_0x27e9('0xe')](_0x27e9('0xf')),moment()['endOf'](_0x27e9('0xd'))['format'](_0x27e9('0xf'))]}},'attributes':['type',_0x27e9('0x10'),'duration',_0x27e9('0x11')]},'log':_0x27e9('0x12')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 2f107e6..7c8d3c6 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 _0x1c8d=['create','CreateVoiceDialReport'];(function(_0x543a4e,_0x544f2e){var _0x27a3a9=function(_0x5aac67){while(--_0x5aac67){_0x543a4e['push'](_0x543a4e['shift']());}};_0x27a3a9(++_0x544f2e);}(_0x1c8d,0xc8));var _0xd1c8=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x1c8d[_0x2dafbe];return _0x58a45a;};'use strict';var client=require('../client');exports[_0xd1c8('0x0')]=function(_0x3dfd0f){return client['Request'](_0xd1c8('0x1'),{'body':_0x3dfd0f,'log':_0xd1c8('0x1')});}; \ No newline at end of file +var _0x29e0=['CreateVoiceDialReport','create','Request'];(function(_0xb09638,_0x13570b){var _0x3b8c0c=function(_0x1b7702){while(--_0x1b7702){_0xb09638['push'](_0xb09638['shift']());}};_0x3b8c0c(++_0x13570b);}(_0x29e0,0x6d));var _0x029e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x29e0[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports[_0x029e('0x0')]=function(_0x442fc8){return client[_0x029e('0x1')](_0x029e('0x2'),{'body':_0x442fc8,'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 0a68c48..6a5f9ae 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 _0xfb3f=['GetVoiceExtension','../client','getVoiceExtensions'];(function(_0x54edcf,_0x1ff4fc){var _0x4a394a=function(_0x495d83){while(--_0x495d83){_0x54edcf['push'](_0x54edcf['shift']());}};_0x4a394a(++_0x1ff4fc);}(_0xfb3f,0xd9));var _0xffb3=function(_0x4841f6,_0x44edef){_0x4841f6=_0x4841f6-0x0;var _0x474154=_0xfb3f[_0x4841f6];return _0x474154;};'use strict';var client=require(_0xffb3('0x0'));exports[_0xffb3('0x1')]=function(){return function(){return client['Request'](_0xffb3('0x2'),{'options':{'raw':!![],'attributes':['id','exten','recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0xffb3('0x1')});};}; \ No newline at end of file +var _0x2e35=['getVoiceExtensions','Request','exten','recordingFormat','../client'];(function(_0x114242,_0x5bd60d){var _0x4cee14=function(_0x4e2459){while(--_0x4e2459){_0x114242['push'](_0x114242['shift']());}};_0x4cee14(++_0x5bd60d);}(_0x2e35,0x1d0));var _0x52e3=function(_0x2290da,_0xf89480){_0x2290da=_0x2290da-0x0;var _0x5c1838=_0x2e35[_0x2290da];return _0x5c1838;};'use strict';var client=require(_0x52e3('0x0'));exports[_0x52e3('0x1')]=function(){return function(){return client[_0x52e3('0x2')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0x52e3('0x3'),_0x52e3('0x4')],'where':{'VoiceExtensionId':null}},'log':_0x52e3('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index a85e111..25c0cc0 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 _0xb951=['dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','Trunk','callerid','Pause','TrunkBackup','active','Interval','Intervals','../client','getVoiceQueues','GetVoiceQueue','name','acwTimeout','autopause','type','dialActive','dialMethod','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialRecallMeTimeout','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','monitor_format','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry'];(function(_0x5ed55c,_0x53ef39){var _0x47d111=function(_0x58e3c2){while(--_0x58e3c2){_0x5ed55c['push'](_0x5ed55c['shift']());}};_0x47d111(++_0x53ef39);}(_0xb951,0x139));var _0x1b95=function(_0x40967b,_0x561a83){_0x40967b=_0x40967b-0x0;var _0x5328bb=_0xb951[_0x40967b];return _0x5328bb;};'use strict';var client=require(_0x1b95('0x0'));exports[_0x1b95('0x1')]=function(){return function(){return client['Request'](_0x1b95('0x2'),{'options':{'raw':![],'attributes':['id',_0x1b95('0x3'),'acw',_0x1b95('0x4'),_0x1b95('0x5'),'monitor_format',_0x1b95('0x6'),_0x1b95('0x7'),_0x1b95('0x8'),_0x1b95('0x9'),'dialLimitQueue',_0x1b95('0xa'),_0x1b95('0xb'),_0x1b95('0xc'),_0x1b95('0xd'),'dialOriginateCallerIdName',_0x1b95('0xe'),_0x1b95('0xf'),'dialQueueOptions',_0x1b95('0x10'),_0x1b95('0x11'),_0x1b95('0x12'),_0x1b95('0x13'),_0x1b95('0x14'),_0x1b95('0x15'),'dialNoAnswerMaxRetry',_0x1b95('0x16'),_0x1b95('0x17'),_0x1b95('0x18'),_0x1b95('0x19'),_0x1b95('0x1a'),_0x1b95('0x1b'),_0x1b95('0x1c'),_0x1b95('0x1d'),_0x1b95('0x1e'),_0x1b95('0x1f'),'dialAMDTotalAnalysisTime',_0x1b95('0x20'),_0x1b95('0x21'),_0x1b95('0x22'),_0x1b95('0x23'),'dialAMDMaximumWordLength','timeout',_0x1b95('0x24'),'dialRecallInQueue','dialOrderByScheduledAt',_0x1b95('0x25'),_0x1b95('0x26'),'dialQueueProject2',_0x1b95('0x27'),_0x1b95('0x28'),_0x1b95('0x29'),_0x1b95('0x2a'),_0x1b95('0x2b'),_0x1b95('0x2c'),_0x1b95('0x2d'),'dialDropRetryFrequency',_0x1b95('0x2e'),_0x1b95('0x2f'),_0x1b95('0x30'),_0x1b95('0x31'),_0x1b95('0x32'),'dialAgentRejectRetryFrequency',_0x1b95('0x33'),_0x1b95('0x34'),'dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder'],'include':[{'model':_0x1b95('0x35'),'as':_0x1b95('0x35'),'attributes':['id','name',_0x1b95('0x36'),'active']},{'model':_0x1b95('0x37'),'as':'mandatoryDispositionPause','attributes':['id',_0x1b95('0x3')]},{'model':_0x1b95('0x35'),'as':_0x1b95('0x38'),'attributes':['id',_0x1b95('0x3'),'callerid',_0x1b95('0x39')]},{'model':_0x1b95('0x3a'),'as':_0x1b95('0x3a'),'attributes':['id','name'],'include':[{'model':_0x1b95('0x3a'),'as':_0x1b95('0x3b'),'attributes':['id',_0x1b95('0x3'),'interval']}]}]},'log':_0x1b95('0x1')});};}; \ No newline at end of file +var _0xee25=['strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewRecallmeReminder','Trunk','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialLimitChannel','dialLimitQueue','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient'];(function(_0x62121e,_0x55f25a){var _0x4b6e52=function(_0x445266){while(--_0x445266){_0x62121e['push'](_0x62121e['shift']());}};_0x4b6e52(++_0x55f25a);}(_0xee25,0xe2));var _0x5ee2=function(_0x40de27,_0x6915b3){_0x40de27=_0x40de27-0x0;var _0x27ffbe=_0xee25[_0x40de27];return _0x27ffbe;};'use strict';var client=require(_0x5ee2('0x0'));exports[_0x5ee2('0x1')]=function(){return function(){return client[_0x5ee2('0x2')](_0x5ee2('0x3'),{'options':{'raw':![],'attributes':['id',_0x5ee2('0x4'),_0x5ee2('0x5'),_0x5ee2('0x6'),_0x5ee2('0x7'),_0x5ee2('0x8'),_0x5ee2('0x9'),_0x5ee2('0xa'),'dialMethod',_0x5ee2('0xb'),_0x5ee2('0xc'),'dialPowerLevel',_0x5ee2('0xd'),_0x5ee2('0xe'),_0x5ee2('0xf'),'dialOriginateCallerIdName',_0x5ee2('0x10'),_0x5ee2('0x11'),_0x5ee2('0x12'),_0x5ee2('0x13'),_0x5ee2('0x14'),_0x5ee2('0x15'),_0x5ee2('0x16'),_0x5ee2('0x17'),_0x5ee2('0x18'),_0x5ee2('0x19'),_0x5ee2('0x1a'),_0x5ee2('0x1b'),_0x5ee2('0x1c'),_0x5ee2('0x1d'),_0x5ee2('0x1e'),'dialCheckDuplicateType','dialAMDActive',_0x5ee2('0x1f'),_0x5ee2('0x20'),_0x5ee2('0x21'),_0x5ee2('0x22'),_0x5ee2('0x23'),_0x5ee2('0x24'),_0x5ee2('0x25'),_0x5ee2('0x26'),_0x5ee2('0x27'),_0x5ee2('0x28'),_0x5ee2('0x29'),_0x5ee2('0x2a'),_0x5ee2('0x2b'),_0x5ee2('0x2c'),_0x5ee2('0x2d'),'dialQueueProject2',_0x5ee2('0x8'),_0x5ee2('0x2e'),_0x5ee2('0x2f'),_0x5ee2('0x30'),'dialNoSuchNumberMaxRetry',_0x5ee2('0x31'),_0x5ee2('0x32'),_0x5ee2('0x33'),_0x5ee2('0x34'),_0x5ee2('0x35'),_0x5ee2('0x36'),'dialMachineRetryFrequency',_0x5ee2('0x37'),'dialAgentRejectRetryFrequency',_0x5ee2('0x38'),_0x5ee2('0x39'),_0x5ee2('0x3a'),'dialPreviewAutoRecallMe',_0x5ee2('0x3b')],'include':[{'model':_0x5ee2('0x3c'),'as':_0x5ee2('0x3c'),'attributes':['id','name',_0x5ee2('0x3d'),_0x5ee2('0x3e')]},{'model':_0x5ee2('0x3f'),'as':_0x5ee2('0x40'),'attributes':['id','name']},{'model':_0x5ee2('0x3c'),'as':_0x5ee2('0x41'),'attributes':['id','name',_0x5ee2('0x3d'),_0x5ee2('0x3e')]},{'model':'Interval','as':_0x5ee2('0x42'),'attributes':['id',_0x5ee2('0x4')],'include':[{'model':_0x5ee2('0x42'),'as':_0x5ee2('0x43'),'attributes':['id',_0x5ee2('0x4'),'interval']}]}]},'log':_0x5ee2('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 6f20b4e..34f4bc6 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(_0x1b2a30,_0x1a22eb){var _0x4c50b5=function(_0xe86c82){while(--_0xe86c82){_0x1b2a30['push'](_0x1b2a30['shift']());}};_0x4c50b5(++_0x1a22eb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'use strict';var moment=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var client=require(_0x0a9e('0x2'));exports['create']=function(_0x550fbc){return client[_0x0a9e('0x3')]('CreateVoiceQueueReport',{'body':_0x550fbc,'log':_0x0a9e('0x4')});};exports[_0x0a9e('0x5')]=function(){return function(){return client[_0x0a9e('0x3')](_0x0a9e('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x0a9e('0x7')]('day')[_0x0a9e('0x8')](_0x0a9e('0x9')),moment()[_0x0a9e('0xa')]('day')['format'](_0x0a9e('0x9'))]}},'attributes':['uniqueid','queue',_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe'),_0x0a9e('0xf'),_0x0a9e('0x10'),'queuecallerabandon','queuecallerabandonAt']},'log':'GetVoiceQueueReports'});};}; \ No newline at end of file +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(_0x53d644,_0xfafc16){var _0x25f9c0=function(_0x5374d7){while(--_0x5374d7){_0x53d644['push'](_0x53d644['shift']());}};_0x25f9c0(++_0xfafc16);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'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 583c8a9..cb53025 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 _0x1643=['../client','getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses'];(function(_0x7f4c14,_0x3997f0){var _0x213318=function(_0x277678){while(--_0x277678){_0x7f4c14['push'](_0x7f4c14['shift']());}};_0x213318(++_0x3997f0);}(_0x1643,0x1e4));var _0x3164=function(_0x1dc268,_0x478c8a){_0x1dc268=_0x1dc268-0x0;var _0x416471=_0x1643[_0x1dc268];return _0x416471;};'use strict';var client=require(_0x3164('0x0'));exports[_0x3164('0x1')]=function(_0x455361){return function(){return client[_0x3164('0x2')](_0x3164('0x3'),{'options':{'where':{'VoiceQueueId':_0x455361,'paused':!![]},'raw':!![]},'log':_0x3164('0x1')});};}; \ No newline at end of file +var _0xe65a=['getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses','../client'];(function(_0x34c5a3,_0x5e5b13){var _0x1a3adf=function(_0x6269b6){while(--_0x6269b6){_0x34c5a3['push'](_0x34c5a3['shift']());}};_0x1a3adf(++_0x5e5b13);}(_0xe65a,0x12f));var _0xae65=function(_0x609988,_0x507944){_0x609988=_0x609988-0x0;var _0x159984=_0xe65a[_0x609988];return _0x159984;};'use strict';var client=require(_0xae65('0x0'));exports[_0xae65('0x1')]=function(_0x5689d4){return function(){return client[_0xae65('0x2')](_0xae65('0x3'),{'options':{'where':{'VoiceQueueId':_0x5689d4,'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 0ee8f7c..1659537 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(_0x179921,_0x4266df){var _0x3ae802=function(_0x5beafa){while(--_0x5beafa){_0x179921['push'](_0x179921['shift']());}};_0x3ae802(++_0x4266df);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'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 _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x5e1f84,_0x4746ee){var _0x4c4bf8=function(_0x1da621){while(--_0x1da621){_0x5e1f84['push'](_0x5e1f84['shift']());}};_0x4c4bf8(++_0x4746ee);}(_0x7a54,0x106));var _0x47a5=function(_0x5bc0e3,_0x3367eb){_0x5bc0e3=_0x5bc0e3-0x0;var _0x5385d0=_0x7a54[_0x5bc0e3];return _0x5385d0;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 8a6cb99..deccd44 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 _0xb8a2=['transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeaccountcode','transfereecontext','transfereeexten','context','extension','blind','CreateVoiceTransferReport','attendedTransfer','Request','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','transfertargetlinkedid','isexternal','origtransfererexten','attended','transfers','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfereraccountcode'];(function(_0x544e61,_0x1a2d5b){var _0x2e4dc8=function(_0x45ad96){while(--_0x45ad96){_0x544e61['push'](_0x544e61['shift']());}};_0x2e4dc8(++_0x1a2d5b);}(_0xb8a2,0x1e4));var _0x2b8a=function(_0x39ca1a,_0x6cd5e1){_0x39ca1a=_0x39ca1a-0x0;var _0x1178fc=_0xb8a2[_0x39ca1a];return _0x1178fc;};'use strict';var client=require('../client');exports[_0x2b8a('0x0')]={};exports['blindTransfer']=function(_0x3e9e99){return client['Request']('CreateVoiceTransferReport',{'body':{'result':_0x3e9e99['result'],'transfererchannel':_0x3e9e99[_0x2b8a('0x1')],'transferercalleridnum':_0x3e9e99[_0x2b8a('0x2')],'transferercalleridname':_0x3e9e99[_0x2b8a('0x3')],'transfererconnectedlinenum':_0x3e9e99[_0x2b8a('0x4')],'transfererconnectedlinename':_0x3e9e99['transfererconnectedlinename'],'transfereraccountcode':_0x3e9e99[_0x2b8a('0x5')],'transferercontext':_0x3e9e99['transferercontext'],'transfererexten':_0x3e9e99[_0x2b8a('0x6')],'transfererlinkedid':_0x3e9e99[_0x2b8a('0x7')],'transfereechannel':_0x3e9e99[_0x2b8a('0x8')],'transfereecalleridnum':_0x3e9e99[_0x2b8a('0x9')],'transfereecalleridname':_0x3e9e99[_0x2b8a('0xa')],'transfereeconnectedlinenum':_0x3e9e99[_0x2b8a('0xb')],'transfereeconnectedlinename':_0x3e9e99['transfereeconnectedlinename'],'transfereeaccountcode':_0x3e9e99[_0x2b8a('0xc')],'transfereecontext':_0x3e9e99[_0x2b8a('0xd')],'transfereeexten':_0x3e9e99[_0x2b8a('0xe')],'transfereelinkedid':_0x3e9e99['transfereelinkedid'],'isexternal':_0x3e9e99['isexternal'],'context':_0x3e9e99[_0x2b8a('0xf')],'extension':_0x3e9e99[_0x2b8a('0x10')],'type':_0x2b8a('0x11')},'log':_0x2b8a('0x12')});};exports[_0x2b8a('0x13')]=function(_0x1fc2cd){return client[_0x2b8a('0x14')](_0x2b8a('0x12'),{'body':{'result':_0x1fc2cd['result'],'transfererchannel':_0x1fc2cd[_0x2b8a('0x15')],'transferercalleridnum':_0x1fc2cd[_0x2b8a('0x16')],'transferercalleridname':_0x1fc2cd['origtransferercalleridname'],'transfererconnectedlinenum':_0x1fc2cd['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x1fc2cd[_0x2b8a('0x17')],'transfereraccountcode':_0x1fc2cd[_0x2b8a('0x18')],'transferercontext':_0x1fc2cd[_0x2b8a('0x19')],'transfererexten':_0x1fc2cd['secondtransfererexten'],'transfererlinkedid':_0x1fc2cd['origtransfererlinkedid'],'transfereechannel':_0x1fc2cd[_0x2b8a('0x1a')],'transfereecalleridnum':_0x1fc2cd['transfertargetcalleridnum'],'transfereecalleridname':_0x1fc2cd['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x1fc2cd[_0x2b8a('0x1b')],'transfereeconnectedlinename':_0x1fc2cd[_0x2b8a('0x1c')],'transfereeaccountcode':_0x1fc2cd['transfertargetaccountcode'],'transfereecontext':_0x1fc2cd[_0x2b8a('0x1d')],'transfereeexten':_0x1fc2cd[_0x2b8a('0x1e')],'transfereelinkedid':_0x1fc2cd[_0x2b8a('0x1f')],'isexternal':_0x1fc2cd[_0x2b8a('0x20')],'context':_0x1fc2cd['origtransferercontext'],'extension':_0x1fc2cd[_0x2b8a('0x21')],'type':_0x2b8a('0x22')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file +var _0x7043=['attendedTransfer','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','isexternal','origtransferercontext','origtransfererexten','../client','transfers','Request','result','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridname','transfereeconnectedlinenum','transfereeaccountcode','transfereecontext','transfereelinkedid','context','CreateVoiceTransferReport'];(function(_0x5b328e,_0x58090a){var _0x4a1ff7=function(_0x1317ac){while(--_0x1317ac){_0x5b328e['push'](_0x5b328e['shift']());}};_0x4a1ff7(++_0x58090a);}(_0x7043,0x1cc));var _0x3704=function(_0x35c94a,_0x1a3b01){_0x35c94a=_0x35c94a-0x0;var _0x77751c=_0x7043[_0x35c94a];return _0x77751c;};'use strict';var client=require(_0x3704('0x0'));exports[_0x3704('0x1')]={};exports['blindTransfer']=function(_0x34c4b3){return client[_0x3704('0x2')]('CreateVoiceTransferReport',{'body':{'result':_0x34c4b3[_0x3704('0x3')],'transfererchannel':_0x34c4b3['transfererchannel'],'transferercalleridnum':_0x34c4b3[_0x3704('0x4')],'transferercalleridname':_0x34c4b3[_0x3704('0x5')],'transfererconnectedlinenum':_0x34c4b3[_0x3704('0x6')],'transfererconnectedlinename':_0x34c4b3[_0x3704('0x7')],'transfereraccountcode':_0x34c4b3[_0x3704('0x8')],'transferercontext':_0x34c4b3[_0x3704('0x9')],'transfererexten':_0x34c4b3[_0x3704('0xa')],'transfererlinkedid':_0x34c4b3[_0x3704('0xb')],'transfereechannel':_0x34c4b3[_0x3704('0xc')],'transfereecalleridnum':_0x34c4b3['transfereecalleridnum'],'transfereecalleridname':_0x34c4b3[_0x3704('0xd')],'transfereeconnectedlinenum':_0x34c4b3[_0x3704('0xe')],'transfereeconnectedlinename':_0x34c4b3['transfereeconnectedlinename'],'transfereeaccountcode':_0x34c4b3[_0x3704('0xf')],'transfereecontext':_0x34c4b3[_0x3704('0x10')],'transfereeexten':_0x34c4b3['transfereeexten'],'transfereelinkedid':_0x34c4b3[_0x3704('0x11')],'isexternal':_0x34c4b3['isexternal'],'context':_0x34c4b3[_0x3704('0x12')],'extension':_0x34c4b3['extension'],'type':'blind'},'log':_0x3704('0x13')});};exports[_0x3704('0x14')]=function(_0x3c7d5a){return client[_0x3704('0x2')](_0x3704('0x13'),{'body':{'result':_0x3c7d5a[_0x3704('0x3')],'transfererchannel':_0x3c7d5a[_0x3704('0x15')],'transferercalleridnum':_0x3c7d5a[_0x3704('0x16')],'transferercalleridname':_0x3c7d5a[_0x3704('0x17')],'transfererconnectedlinenum':_0x3c7d5a[_0x3704('0x18')],'transfererconnectedlinename':_0x3c7d5a['secondtransfererconnectedlinename'],'transfereraccountcode':_0x3c7d5a[_0x3704('0x19')],'transferercontext':_0x3c7d5a['secondtransferercontext'],'transfererexten':_0x3c7d5a[_0x3704('0x1a')],'transfererlinkedid':_0x3c7d5a[_0x3704('0x1b')],'transfereechannel':_0x3c7d5a[_0x3704('0x1c')],'transfereecalleridnum':_0x3c7d5a[_0x3704('0x1d')],'transfereecalleridname':_0x3c7d5a[_0x3704('0x1e')],'transfereeconnectedlinenum':_0x3c7d5a[_0x3704('0x1f')],'transfereeconnectedlinename':_0x3c7d5a[_0x3704('0x20')],'transfereeaccountcode':_0x3c7d5a[_0x3704('0x21')],'transfereecontext':_0x3c7d5a[_0x3704('0x22')],'transfereeexten':_0x3c7d5a[_0x3704('0x23')],'transfereelinkedid':_0x3c7d5a[_0x3704('0x24')],'isexternal':_0x3c7d5a[_0x3704('0x25')],'context':_0x3c7d5a[_0x3704('0x26')],'extension':_0x3c7d5a[_0x3704('0x27')],'type':'attended'},'log':_0x3704('0x13')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index e2954e4..49cf71c 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 _0x7fbe=['omit','undefined','values','voicechannel','join','channels','uniqueid','channel','filename','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','status','rec','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','map','catch','destinationchannel','StopMixMonitor','stop','StopMixMonitor\x20Success','queueChannels','type','includes','count','rows','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','exten','telephones','trunks','outbound','campaigns','run','event','Event\x20name\x20mandatory','custom:','server','http','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','validate','moment','../../../config/environment','../properties','../ami','../model/voiceQueueSummary','listen','format','%s/%s','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','error','asterisk','username','ami\x20disconnected','pick','reload','module','action','Reload','then','message','isConnected','command','Action','voiceQueues','hasOwnProperty','push','length','find'];(function(_0x5495d1,_0x578392){var _0xec42a9=function(_0x599f96){while(--_0x599f96){_0x5495d1['push'](_0x5495d1['shift']());}};_0xec42a9(++_0x578392);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x2c3f37,_0x5a46b6){_0x2c3f37=_0x2c3f37-0x0;var _0x12a453=_0x7fbe[_0x2c3f37];return _0x12a453;};'use strict';var _=require('lodash');var util=require('util');var jayson=require(_0xe7fb('0x0'));var schema=require(_0xe7fb('0x1'));var moment=require(_0xe7fb('0x2'));var config=require(_0xe7fb('0x3'));var properties=require(_0xe7fb('0x4'));var ami=require(_0xe7fb('0x5'));var VoiceQueueSummary=require(_0xe7fb('0x6'));exports[_0xe7fb('0x7')]=function(_0x36ab90,_0x5dbf04,_0x290172){return new Promise(function(_0x12d1b0,_0x24cd67){var _0x1f943f={'QueuePause':function(_0x5ad75b){return new Promise(function(_0x213ebc){var _0x228f6b=util[_0xe7fb('0x8')](_0xe7fb('0x9'),'SIP',_0x5ad75b['name']);if(_0x36ab90[_0xe7fb('0xa')]&&_0x36ab90[_0xe7fb('0xa')][_0x228f6b]&&_0x36ab90[_0xe7fb('0xa')][_0x228f6b][_0xe7fb('0xb')]){_0x36ab90[_0xe7fb('0xa')][_0x228f6b][_0xe7fb('0xc')]();}if(_0x36ab90[_0xe7fb('0xd')][_0x228f6b]){_0x36ab90[_0xe7fb('0xd')][_0x228f6b][_0xe7fb('0xe')]({'statePause':_0x5ad75b[_0xe7fb('0xf')]?!![]:![]});}_0x213ebc({'code':0xc8,'message':_0xe7fb('0x10')});});},'Reload':function(_0x188e1d){var _0xdf9760=this;return new Promise(function(_0x45fe75,_0x7fe4d3){if(ami['isConnected']()==![]){return _0x7fe4d3(_0xdf9760[_0xe7fb('0x11')](0x1f4,[config[_0xe7fb('0x12')]['ip'],config['asterisk'][_0xe7fb('0x13')],_0xe7fb('0x14')]['join']('\x20')));}_0x188e1d=_[_0xe7fb('0x15')](_0x188e1d,_['keys'](properties[_0xe7fb('0x16')][_0xe7fb('0x17')]));_0x188e1d[_0xe7fb('0x18')]=_0xe7fb('0x19');return ami['Action'](_0x188e1d)[_0xe7fb('0x1a')](function(_0x5ebc87){_0x45fe75({'code':0xc8,'message':_0x5ebc87[_0xe7fb('0x1b')]});})['catch'](function(_0x1e77fd){_0x7fe4d3(_0xdf9760[_0xe7fb('0x11')](0x1f5,_0x1e77fd[_0xe7fb('0x1b')]));});});},'Command':function(_0x182269){var _0x5df1a1=this;return new Promise(function(_0x44466e,_0x5d1c87){if(ami[_0xe7fb('0x1c')]()==![]){return _0x5d1c87(_0x5df1a1['error'](0x1f4,[config[_0xe7fb('0x12')]['ip'],config['asterisk'][_0xe7fb('0x13')],_0xe7fb('0x14')]['join']('\x20')));}_0x182269=_[_0xe7fb('0x15')](_0x182269,_0xe7fb('0x1d'));_0x182269[_0xe7fb('0x18')]='Command';return ami[_0xe7fb('0x1e')](_0x182269)[_0xe7fb('0x1a')](function(_0x5da3d9){_0x44466e({'code':0xc8,'message':_0x5da3d9['content']});})['catch'](function(_0x35e4db){_0x5d1c87(_0x5df1a1['error'](0x1f5,_0x35e4db['message']));});});},'VoiceQueues':function(){return new Promise(function(_0x4026b1){var _0x32e8b2=[];for(var _0x2996ae in _0x36ab90['voiceQueues']){if(_0x36ab90[_0xe7fb('0x1f')][_0xe7fb('0x20')](_0x2996ae)){var _0x390f32=_0x36ab90[_0xe7fb('0x1f')][_0x2996ae];var _0x392d75=new VoiceQueueSummary(_0x390f32);_0x32e8b2[_0xe7fb('0x21')](_0x392d75);}}_0x4026b1({'count':_0x32e8b2[_0xe7fb('0x22')],'rows':_0x32e8b2});});},'UpdateVoiceQueue':function(_0x59e015){return new Promise(function(_0x5df9f2,_0x1086e6){var _0x3bdee9=_[_0xe7fb('0x23')](_0x36ab90['voiceQueues'],{'id':parseInt(_0x59e015['id'])});var _0xb1f2f4=_[_0xe7fb('0x24')](_0x59e015,['id']);if(_0x3bdee9){for(var _0xd3fffe in _0xb1f2f4){if(typeof _0xb1f2f4[_0xd3fffe]!==_0xe7fb('0x25')&&typeof _0x3bdee9[_0xd3fffe]!==_0xe7fb('0x25')){_0x3bdee9[_0xd3fffe]=_0xb1f2f4[_0xd3fffe];}}_0x5df9f2(_0x3bdee9);}else{_0x1086e6();}});},'VoiceChannels':function(){return new Promise(function(_0x1256d4){var _0x1d57a7=_[_0xe7fb('0x26')](_0x36ab90['channels']);_0x1256d4({'count':_0x1d57a7[_0xe7fb('0x22')],'rows':_0x1d57a7});});},'VoiceChannelMixMonitor':function(_0x1742f3){var _0x29d1ca=this;return new Promise(function(_0x547a04,_0x517d70){if(ami[_0xe7fb('0x1c')]()==![]){return _0x517d70(_0x29d1ca['error'](0x1f4,[config[_0xe7fb('0x12')]['ip'],config[_0xe7fb('0x12')][_0xe7fb('0x13')],_0xe7fb('0x14')]['join']('\x20')));}var _0x1af472=schema(properties[_0xe7fb('0x27')])[_0xe7fb('0x1')](_0x1742f3);if(_0x1af472[_0xe7fb('0x22')]>0x0){return _0x517d70(_0x29d1ca[_0xe7fb('0x11')](0x1f4,_['map'](_0x1af472,_0xe7fb('0x1b'))[_0xe7fb('0x28')](',\x20')));}var _0x209eaa=_[_0xe7fb('0x23')](_0x36ab90[_0xe7fb('0x29')],{'uniqueid':_0x1742f3[_0xe7fb('0x2a')]});if(_0x209eaa&&_0x209eaa[_0xe7fb('0x2b')]){var _0x147eb1=util[_0xe7fb('0x8')]('%s.%s',_0x1742f3[_0xe7fb('0x2c')]||_0x1742f3[_0xe7fb('0x2a')],_0x1742f3[_0xe7fb('0x8')]||'wav');return ami[_0xe7fb('0x1e')]({'action':_0xe7fb('0x2d'),'channel':_0x209eaa[_0xe7fb('0x2b')],'file':_0x147eb1,'options':_0xe7fb('0x2e')})[_0xe7fb('0x1a')](function(_0x35b828){var _0xfeefb1=_[_0xe7fb('0x23')](_0x209eaa[_0xe7fb('0x2f')],{'filename':_0xe7fb('0x30')+_0x147eb1[_0xe7fb('0x31')]()});if(_[_0xe7fb('0x32')](_0xfeefb1)){_0x209eaa[_0xe7fb('0x2f')][_0xe7fb('0x21')]({'filename':_0xe7fb('0x30')+_0x147eb1[_0xe7fb('0x31')](),'createdAt':moment()[_0xe7fb('0x8')](_0xe7fb('0x33')),'mixmonitorid':_0x35b828[_0xe7fb('0x34')],'status':'rec'});}else{_0xfeefb1[_0xe7fb('0x34')]=_0x35b828[_0xe7fb('0x34')];_0xfeefb1[_0xe7fb('0x35')]=_0xe7fb('0x36');}_0x547a04({'code':0xc8,'message':[_0x1742f3['uniqueid'],_0xe7fb('0x37'),_0x35b828[_0xe7fb('0x34')]][_0xe7fb('0x28')]('\x20'),'mixmonitorid':_0x35b828[_0xe7fb('0x34')]});})['catch'](function(_0x2f976f){_0x517d70(_0x29d1ca[_0xe7fb('0x11')](0x1f5,[_0x1742f3[_0xe7fb('0x2a')],_0x2f976f[_0xe7fb('0x1b')][_0xe7fb('0x31')]()][_0xe7fb('0x28')]('\x20')));});}else{return _0x517d70(_0x29d1ca['error'](0x1f5,_0xe7fb('0x38')));}});},'VoiceChannelStopMixMonitor':function(_0x35139f){var _0x3a96cd=this;return new Promise(function(_0x4b263d,_0x36a341){if(ami[_0xe7fb('0x1c')]()==![]){return _0x36a341(_0x3a96cd['error'](0x1f4,[config['asterisk']['ip'],config['asterisk']['username'],'ami\x20disconnected'][_0xe7fb('0x28')]('\x20')));}var _0x957ca3=schema(properties[_0xe7fb('0x27')])['validate'](_0x35139f);if(_0x957ca3[_0xe7fb('0x22')]>0x0){return _0x36a341(_0x3a96cd['error'](0x1f4,_[_0xe7fb('0x39')](_0x957ca3,_0xe7fb('0x1b'))['join'](',\x20')));}var _0x108a16=_[_0xe7fb('0x23')](_0x36ab90[_0xe7fb('0x29')],{'uniqueid':_0x35139f[_0xe7fb('0x2a')]});if(_0x108a16){return Promise['resolve']()[_0xe7fb('0x1a')](function(){if(_0x108a16[_0xe7fb('0x2b')]){return ami[_0xe7fb('0x1e')]({'action':'StopMixMonitor','channel':_0x108a16[_0xe7fb('0x2b')],'mixmonitorid':_0x35139f[_0xe7fb('0x34')]})[_0xe7fb('0x3a')](function(){});}})[_0xe7fb('0x1a')](function(){if(_0x108a16[_0xe7fb('0x3b')]){return ami['Action']({'action':_0xe7fb('0x3c'),'channel':_0x108a16['destinationchannel'],'mixmonitorid':_0x35139f[_0xe7fb('0x34')]})[_0xe7fb('0x3a')](function(){});}})[_0xe7fb('0x1a')](function(){var _0x1ecbfd=_[_0xe7fb('0x23')](_0x108a16['monitors'],{'mixmonitorid':_0x35139f[_0xe7fb('0x34')]});if(_0x1ecbfd){_0x1ecbfd['status']='stop';}})[_0xe7fb('0x1a')](function(){var _0x3d740f=util[_0xe7fb('0x8')]('%s.%s',_0x35139f[_0xe7fb('0x2c')]||_0x35139f[_0xe7fb('0x2a')],_0x35139f['format']||'wav');var _0x284bcb=_[_0xe7fb('0x23')](_0x108a16[_0xe7fb('0x2f')],{'filename':_0xe7fb('0x30')+_0x3d740f[_0xe7fb('0x31')]()});if(_0x284bcb){_0x284bcb[_0xe7fb('0x35')]=_0xe7fb('0x3d');}})[_0xe7fb('0x1a')](function(){_0x4b263d({'code':0xc8,'message':[_0x35139f['uniqueid'],_0xe7fb('0x3e')]['join']('\x20')});})[_0xe7fb('0x3a')](function(_0x102da9){_0x36a341(_0x3a96cd['error'](0x1f5,[_0x35139f[_0xe7fb('0x2a')],_0x102da9['message'][_0xe7fb('0x31')]()]['join']('\x20')));});}else{return _0x36a341(_0x3a96cd[_0xe7fb('0x11')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x467c5a){var _0x59158c=this;return new Promise(function(_0x1fff6c){var _0x1b6442=_[_0xe7fb('0x26')](_0x36ab90[_0xe7fb('0x3f')]);var _0xb8179a={'count':_0x1b6442[_0xe7fb('0x22')],'rows':_0x1b6442};if(_0x467c5a&&_0x467c5a[_0xe7fb('0x40')]){if(!['inbound','outbound'][_0xe7fb('0x41')](_0x467c5a['type'])){return _0x24cd67(_0x59158c['error'](0x190,'Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound'));}var _0x50b8df=_['filter'](_0x1b6442,function(_0x18773c){return _0x18773c[_0xe7fb('0x40')]===_0x467c5a[_0xe7fb('0x40')];});_0xb8179a[_0xe7fb('0x42')]=_0x50b8df['length'];_0xb8179a[_0xe7fb('0x43')]=_0x50b8df;}_0x1fff6c(_0xb8179a);});},'VoiceQueuesChannel':function(_0x236b35){var _0x195e52=this;return new Promise(function(_0x4a9372,_0x56c512){var _0x2f3b72=schema(properties[_0xe7fb('0x44')])[_0xe7fb('0x1')](_0x236b35);if(_0x2f3b72['length']>0x0){return _0x56c512(_0x195e52[_0xe7fb('0x11')](0x1f4,_[_0xe7fb('0x39')](_0x2f3b72,_0xe7fb('0x1b'))[_0xe7fb('0x28')](',\x20')));}var _0x548cd4=_['find'](_0x36ab90[_0xe7fb('0x3f')],{'uniqueid':_0x236b35[_0xe7fb('0x2a')]});if(_0x548cd4){_0x4a9372(_0x548cd4);}else{return _0x56c512(_0x195e52[_0xe7fb('0x11')](0x1f5,_0xe7fb('0x38')));}});},'VoiceQueuesChannelHangup':function(_0x3b0147){var _0x5dd7c8=this;return new Promise(function(_0x9c45a,_0x349a2a){if(ami[_0xe7fb('0x1c')]()==![]){return _0x349a2a(_0x5dd7c8['error'](0x1f4,[config['asterisk']['ip'],config[_0xe7fb('0x12')][_0xe7fb('0x13')],_0xe7fb('0x14')][_0xe7fb('0x28')]('\x20')));}var _0x40f546=schema(properties[_0xe7fb('0x45')])['validate'](_0x3b0147);if(_0x40f546[_0xe7fb('0x22')]>0x0){return _0x349a2a(_0x5dd7c8[_0xe7fb('0x11')](0x1f4,_[_0xe7fb('0x39')](_0x40f546,_0xe7fb('0x1b'))[_0xe7fb('0x28')](',\x20')));}var _0x1e0d69=_['find'](_0x36ab90[_0xe7fb('0x3f')],{'uniqueid':_0x3b0147['uniqueid']});if(_0x1e0d69&&_0x1e0d69[_0xe7fb('0x2b')]){return ami[_0xe7fb('0x1e')]({'action':_0xe7fb('0x46'),'channel':_0x1e0d69[_0xe7fb('0x2b')]})['then'](function(_0x47ac92){_0x9c45a({'code':0xc8,'message':[_0x3b0147[_0xe7fb('0x2a')],_0x47ac92[_0xe7fb('0x1b')][_0xe7fb('0x31')]()][_0xe7fb('0x28')]('\x20')});})[_0xe7fb('0x3a')](function(_0x50dc34){_0x349a2a(_0x5dd7c8[_0xe7fb('0x11')](0x1f5,[_0x3b0147['uniqueid'],_0x50dc34[_0xe7fb('0x1b')]['toLowerCase']()]['join']('\x20')));});}else{return _0x349a2a(_0x5dd7c8[_0xe7fb('0x11')](0x1f5,_0xe7fb('0x38')));}});},'VoiceQueuesChannelRedirect':function(_0x1b2fc7){var _0x5da884=this;return new Promise(function(_0x475716,_0x34b7a5){if(ami[_0xe7fb('0x1c')]()==![]){return _0x34b7a5(_0x5da884[_0xe7fb('0x11')](0x1f4,[config[_0xe7fb('0x12')]['ip'],config['asterisk'][_0xe7fb('0x13')],_0xe7fb('0x14')]['join']('\x20')));}var _0x4136ae=schema(properties[_0xe7fb('0x47')])['validate'](_0x1b2fc7);if(_0x4136ae[_0xe7fb('0x22')]>0x0){return _0x34b7a5(_0x5da884['error'](0x1f4,_[_0xe7fb('0x39')](_0x4136ae,_0xe7fb('0x1b'))[_0xe7fb('0x28')](',\x20')));}var _0x5c0104=_[_0xe7fb('0x23')](_0x36ab90[_0xe7fb('0x3f')],{'uniqueid':_0x1b2fc7[_0xe7fb('0x2a')]});if(_0x5c0104&&_0x5c0104[_0xe7fb('0x2b')]){return ami[_0xe7fb('0x1e')]({'action':_0xe7fb('0x48'),'channel':_0x5c0104[_0xe7fb('0x2b')],'exten':_0x1b2fc7[_0xe7fb('0x49')],'context':_0x1b2fc7['context']||_0x5c0104['context'],'priority':0x1})[_0xe7fb('0x1a')](function(_0x3a674e){_0x475716({'code':0xc8,'message':[_0x1b2fc7[_0xe7fb('0x2a')],_0x3a674e['message']['toLowerCase']()][_0xe7fb('0x28')]('\x20')});})[_0xe7fb('0x3a')](function(_0xad7c53){_0x34b7a5(_0x5da884[_0xe7fb('0x11')](0x1f5,[_0x1b2fc7[_0xe7fb('0x2a')],_0xad7c53[_0xe7fb('0x1b')][_0xe7fb('0x31')]()][_0xe7fb('0x28')]('\x20')));});}else{return _0x34b7a5(_0x5da884[_0xe7fb('0x11')](0x1f5,_0xe7fb('0x38')));}});},'Agents':function(_0x1ff5e7){return new Promise(function(_0xf423ab){var _0x12b91f=_['values'](_0x36ab90['agents']);if(_0x1ff5e7&&_0x1ff5e7['id']){var _0x125427=_[_0xe7fb('0x23')](_0x12b91f,function(_0x178395){return _0x178395['id']===_0x1ff5e7['id'];});_0xf423ab(_0x125427);}else{_0xf423ab({'count':_0x12b91f[_0xe7fb('0x22')],'rows':_0x12b91f});}});},'Telephones':function(){return new Promise(function(_0x8dd368){var _0x562493=_[_0xe7fb('0x26')](_0x36ab90[_0xe7fb('0x4a')]);_0x8dd368({'count':_0x562493[_0xe7fb('0x22')],'rows':_0x562493});});},'Trunks':function(){return new Promise(function(_0x1457fc){var _0x16553c=_[_0xe7fb('0x26')](_0x36ab90[_0xe7fb('0x4b')]);_0x1457fc({'count':_0x16553c[_0xe7fb('0x22')],'rows':_0x16553c});});},'OutboundChannels':function(){return new Promise(function(_0xa7fa61){var _0x51eaec=_[_0xe7fb('0x26')](_0x36ab90['outboundChannels']);_0xa7fa61({'count':_0x51eaec[_0xe7fb('0x22')],'rows':_0x51eaec});});},'Outbound':function(){return new Promise(function(_0x2f13f2){_0x2f13f2(_0x36ab90[_0xe7fb('0x4c')]);});},'Campaigns':function(){return new Promise(function(_0x31c159){var _0x318d06=_['values'](_0x36ab90[_0xe7fb('0x4d')]);_0x31c159({'count':_0x318d06[_0xe7fb('0x22')],'rows':_0x318d06});});},'VoiceQueuesPreview':function(_0x4fd57a){var _0x2bf4aa=this;return new Promise(function(_0x15d881,_0x172547){_0x5dbf04[_0xe7fb('0x4e')](_0x4fd57a['id'])[_0xe7fb('0x1a')](function(_0x3d139f){_0x15d881({'code':0xc8,'message':_0x3d139f[_0xe7fb('0x1b')]});})[_0xe7fb('0x3a')](function(_0x14b028){_0x172547(_0x2bf4aa[_0xe7fb('0x11')](0x1f4,_0x14b028[_0xe7fb('0x1b')]));});});},'EventManager':function(_0x52b8a1){var _0x4b5f7e=this;return new Promise(function(_0x48a015,_0x13265b){if(!_0x52b8a1[_0xe7fb('0x4f')]){return _0x13265b(_0x4b5f7e[_0xe7fb('0x11')](0x1f4,_0xe7fb('0x50')));}ami['emit'](_0xe7fb('0x51')+_0x52b8a1[_0xe7fb('0x4f')],_0x52b8a1[_0xe7fb('0x1b')]);_0x48a015({'code':0xc8,'message':_0x52b8a1});});},'FaxAccounts':function(){return new Promise(function(_0x138a5e){var _0x5982f9=_[_0xe7fb('0x26')](_0x36ab90['faxAccounts']);_0x138a5e({'count':_0x5982f9[_0xe7fb('0x22')],'rows':_0x5982f9});});},'SendFax':function(_0x325c51){var _0xd49119=this;return new Promise(function(_0x1d278d,_0x7c3f19){_0x290172['send'](_0x325c51)[_0xe7fb('0x1a')](function(_0x5b8f3e){_0x1d278d({'code':0xc8,'message':_0x5b8f3e[_0xe7fb('0x1b')]});})['catch'](function(_0x2aeeed){_0x7c3f19(_0xd49119[_0xe7fb('0x11')](0x1f4,_0x2aeeed['message']));});});},'CheckAfterSend':function(_0x2b6d69){var _0x31642f=this;return new Promise(function(_0xb19e94,_0x4181fd){_0x290172['checkAfterSend'](_0x2b6d69)[_0xe7fb('0x1a')](function(_0x277335){_0xb19e94({'code':0xc8,'message':_0x277335[_0xe7fb('0x1b')]});})['catch'](function(_0x11d5b6){_0x4181fd(_0x31642f['error'](0x1f4,_0x11d5b6['message']));});});}};var _0x511bdc=jayson[_0xe7fb('0x52')](_0x1f943f)[_0xe7fb('0x53')]();_0x511bdc['on']('error',function(_0xf40e0a){return _0x24cd67(_0xf40e0a);});_0x511bdc[_0xe7fb('0x7')](0x232a,_0xe7fb('0x54'),function(){console[_0xe7fb('0x55')](_0xe7fb('0x56'),0x232a);return _0x12d1b0(_0xe7fb('0x57')+0x232a);});});}; \ No newline at end of file +var _0xa630=['values','trunks','outboundChannels','campaigns','run','Event\x20name\x20mandatory','emit','custom:','event','faxAccounts','send','checkAfterSend','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','moment','../properties','../model/voiceQueueSummary','listen','format','SIP','name','timers','timer','updateAcw','agents','pause','QueuePause','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','Reload','Action','then','message','catch','isConnected','action','content','voiceQueues','push','length','omit','undefined','channels','voicechannel','uniqueid','channel','wav','MixMonitor','find','toLowerCase','isNil','monitors','/var/spool/asterisk/monitor/','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','validate','map','resolve','destinationchannel','StopMixMonitor','stop','%s.%s','StopMixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','queueChannels','type','outbound','includes','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','count','Hangup','voicequeuechannelredirect','Redirect','exten','context'];(function(_0x3800b3,_0x2a3e68){var _0x41e5a0=function(_0x2cb222){while(--_0x2cb222){_0x3800b3['push'](_0x3800b3['shift']());}};_0x41e5a0(++_0x2a3e68);}(_0xa630,0xbe));var _0x0a63=function(_0x13096d,_0x5bb1cc){_0x13096d=_0x13096d-0x0;var _0x1c0ebb=_0xa630[_0x13096d];return _0x1c0ebb;};'use strict';var _=require(_0x0a63('0x0'));var util=require(_0x0a63('0x1'));var jayson=require('jayson/promise');var schema=require('validate');var moment=require(_0x0a63('0x2'));var config=require('../../../config/environment');var properties=require(_0x0a63('0x3'));var ami=require('../ami');var VoiceQueueSummary=require(_0x0a63('0x4'));exports[_0x0a63('0x5')]=function(_0x2cfdeb,_0x2380f8,_0x37b4c9){return new Promise(function(_0x4b7474,_0x2760b0){var _0x3d5f0b={'QueuePause':function(_0xc2dcd7){return new Promise(function(_0x41d21d){var _0x12a7df=util[_0x0a63('0x6')]('%s/%s',_0x0a63('0x7'),_0xc2dcd7[_0x0a63('0x8')]);if(_0x2cfdeb[_0x0a63('0x9')]&&_0x2cfdeb[_0x0a63('0x9')][_0x12a7df]&&_0x2cfdeb[_0x0a63('0x9')][_0x12a7df][_0x0a63('0xa')]){_0x2cfdeb[_0x0a63('0x9')][_0x12a7df][_0x0a63('0xb')]();}if(_0x2cfdeb[_0x0a63('0xc')][_0x12a7df]){_0x2cfdeb[_0x0a63('0xc')][_0x12a7df]['updateStatusRealtime']({'statePause':_0xc2dcd7[_0x0a63('0xd')]?!![]:![]});}_0x41d21d({'code':0xc8,'message':_0x0a63('0xe')});});},'Reload':function(_0x2fce86){var _0x3d6323=this;return new Promise(function(_0x55cb2f,_0x23f655){if(ami['isConnected']()==![]){return _0x23f655(_0x3d6323[_0x0a63('0xf')](0x1f4,[config[_0x0a63('0x10')]['ip'],config[_0x0a63('0x10')][_0x0a63('0x11')],_0x0a63('0x12')][_0x0a63('0x13')]('\x20')));}_0x2fce86=_[_0x0a63('0x14')](_0x2fce86,_[_0x0a63('0x15')](properties['reload'][_0x0a63('0x16')]));_0x2fce86['action']=_0x0a63('0x17');return ami[_0x0a63('0x18')](_0x2fce86)[_0x0a63('0x19')](function(_0x221f07){_0x55cb2f({'code':0xc8,'message':_0x221f07[_0x0a63('0x1a')]});})[_0x0a63('0x1b')](function(_0x30f292){_0x23f655(_0x3d6323[_0x0a63('0xf')](0x1f5,_0x30f292[_0x0a63('0x1a')]));});});},'Command':function(_0x3cc74d){var _0x2ad167=this;return new Promise(function(_0x4ea56f,_0x550568){if(ami[_0x0a63('0x1c')]()==![]){return _0x550568(_0x2ad167['error'](0x1f4,[config[_0x0a63('0x10')]['ip'],config['asterisk'][_0x0a63('0x11')],_0x0a63('0x12')][_0x0a63('0x13')]('\x20')));}_0x3cc74d=_[_0x0a63('0x14')](_0x3cc74d,'command');_0x3cc74d[_0x0a63('0x1d')]='Command';return ami[_0x0a63('0x18')](_0x3cc74d)[_0x0a63('0x19')](function(_0x1bf64a){_0x4ea56f({'code':0xc8,'message':_0x1bf64a[_0x0a63('0x1e')]});})[_0x0a63('0x1b')](function(_0x1f929f){_0x550568(_0x2ad167[_0x0a63('0xf')](0x1f5,_0x1f929f[_0x0a63('0x1a')]));});});},'VoiceQueues':function(){return new Promise(function(_0x567017){var _0x5e5987=[];for(var _0x55fb70 in _0x2cfdeb['voiceQueues']){if(_0x2cfdeb[_0x0a63('0x1f')]['hasOwnProperty'](_0x55fb70)){var _0x496c93=_0x2cfdeb[_0x0a63('0x1f')][_0x55fb70];var _0x1d5448=new VoiceQueueSummary(_0x496c93);_0x5e5987[_0x0a63('0x20')](_0x1d5448);}}_0x567017({'count':_0x5e5987[_0x0a63('0x21')],'rows':_0x5e5987});});},'UpdateVoiceQueue':function(_0x52e7ef){return new Promise(function(_0x402692,_0x498371){var _0x25ab82=_['find'](_0x2cfdeb[_0x0a63('0x1f')],{'id':parseInt(_0x52e7ef['id'])});var _0xcf409=_[_0x0a63('0x22')](_0x52e7ef,['id']);if(_0x25ab82){for(var _0x145090 in _0xcf409){if(typeof _0xcf409[_0x145090]!==_0x0a63('0x23')&&typeof _0x25ab82[_0x145090]!==_0x0a63('0x23')){_0x25ab82[_0x145090]=_0xcf409[_0x145090];}}_0x402692(_0x25ab82);}else{_0x498371();}});},'VoiceChannels':function(){return new Promise(function(_0x23fcf3){var _0x33f5d3=_['values'](_0x2cfdeb[_0x0a63('0x24')]);_0x23fcf3({'count':_0x33f5d3['length'],'rows':_0x33f5d3});});},'VoiceChannelMixMonitor':function(_0x151cb6){var _0xc8caf6=this;return new Promise(function(_0x30cebd,_0x26de7a){if(ami[_0x0a63('0x1c')]()==![]){return _0x26de7a(_0xc8caf6['error'](0x1f4,[config[_0x0a63('0x10')]['ip'],config[_0x0a63('0x10')][_0x0a63('0x11')],_0x0a63('0x12')]['join']('\x20')));}var _0x28f321=schema(properties[_0x0a63('0x25')])['validate'](_0x151cb6);if(_0x28f321['length']>0x0){return _0x26de7a(_0xc8caf6[_0x0a63('0xf')](0x1f4,_['map'](_0x28f321,'message')[_0x0a63('0x13')](',\x20')));}var _0x3fd128=_['find'](_0x2cfdeb[_0x0a63('0x24')],{'uniqueid':_0x151cb6[_0x0a63('0x26')]});if(_0x3fd128&&_0x3fd128[_0x0a63('0x27')]){var _0x333130=util[_0x0a63('0x6')]('%s.%s',_0x151cb6['filename']||_0x151cb6[_0x0a63('0x26')],_0x151cb6[_0x0a63('0x6')]||_0x0a63('0x28'));return ami[_0x0a63('0x18')]({'action':_0x0a63('0x29'),'channel':_0x3fd128[_0x0a63('0x27')],'file':_0x333130,'options':'ai(mixmonitorid)'})[_0x0a63('0x19')](function(_0x276156){var _0x4807b9=_[_0x0a63('0x2a')](_0x3fd128['monitors'],{'filename':'/var/spool/asterisk/monitor/'+_0x333130[_0x0a63('0x2b')]()});if(_[_0x0a63('0x2c')](_0x4807b9)){_0x3fd128[_0x0a63('0x2d')]['push']({'filename':_0x0a63('0x2e')+_0x333130[_0x0a63('0x2b')](),'createdAt':moment()[_0x0a63('0x6')](_0x0a63('0x2f')),'mixmonitorid':_0x276156[_0x0a63('0x30')],'status':_0x0a63('0x31')});}else{_0x4807b9[_0x0a63('0x30')]=_0x276156['mixmonitorid'];_0x4807b9[_0x0a63('0x32')]=_0x0a63('0x31');}_0x30cebd({'code':0xc8,'message':[_0x151cb6[_0x0a63('0x26')],'MixMonitor\x20Success',_0x276156['mixmonitorid']][_0x0a63('0x13')]('\x20'),'mixmonitorid':_0x276156['mixmonitorid']});})[_0x0a63('0x1b')](function(_0x1e1aec){_0x26de7a(_0xc8caf6[_0x0a63('0xf')](0x1f5,[_0x151cb6['uniqueid'],_0x1e1aec[_0x0a63('0x1a')][_0x0a63('0x2b')]()][_0x0a63('0x13')]('\x20')));});}else{return _0x26de7a(_0xc8caf6[_0x0a63('0xf')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x1e3b70){var _0x236617=this;return new Promise(function(_0x4234cd,_0x2ccd99){if(ami[_0x0a63('0x1c')]()==![]){return _0x2ccd99(_0x236617[_0x0a63('0xf')](0x1f4,[config['asterisk']['ip'],config[_0x0a63('0x10')][_0x0a63('0x11')],_0x0a63('0x12')][_0x0a63('0x13')]('\x20')));}var _0x20fa0d=schema(properties[_0x0a63('0x25')])[_0x0a63('0x33')](_0x1e3b70);if(_0x20fa0d[_0x0a63('0x21')]>0x0){return _0x2ccd99(_0x236617[_0x0a63('0xf')](0x1f4,_[_0x0a63('0x34')](_0x20fa0d,_0x0a63('0x1a'))[_0x0a63('0x13')](',\x20')));}var _0xed7787=_[_0x0a63('0x2a')](_0x2cfdeb[_0x0a63('0x24')],{'uniqueid':_0x1e3b70[_0x0a63('0x26')]});if(_0xed7787){return Promise[_0x0a63('0x35')]()[_0x0a63('0x19')](function(){if(_0xed7787['channel']){return ami[_0x0a63('0x18')]({'action':'StopMixMonitor','channel':_0xed7787['channel'],'mixmonitorid':_0x1e3b70[_0x0a63('0x30')]})[_0x0a63('0x1b')](function(){});}})[_0x0a63('0x19')](function(){if(_0xed7787[_0x0a63('0x36')]){return ami[_0x0a63('0x18')]({'action':_0x0a63('0x37'),'channel':_0xed7787[_0x0a63('0x36')],'mixmonitorid':_0x1e3b70[_0x0a63('0x30')]})[_0x0a63('0x1b')](function(){});}})[_0x0a63('0x19')](function(){var _0x9e5009=_[_0x0a63('0x2a')](_0xed7787[_0x0a63('0x2d')],{'mixmonitorid':_0x1e3b70[_0x0a63('0x30')]});if(_0x9e5009){_0x9e5009[_0x0a63('0x32')]=_0x0a63('0x38');}})[_0x0a63('0x19')](function(){var _0x20b864=util[_0x0a63('0x6')](_0x0a63('0x39'),_0x1e3b70['filename']||_0x1e3b70[_0x0a63('0x26')],_0x1e3b70[_0x0a63('0x6')]||'wav');var _0x511b0f=_['find'](_0xed7787['monitors'],{'filename':_0x0a63('0x2e')+_0x20b864[_0x0a63('0x2b')]()});if(_0x511b0f){_0x511b0f['status']=_0x0a63('0x38');}})['then'](function(){_0x4234cd({'code':0xc8,'message':[_0x1e3b70[_0x0a63('0x26')],_0x0a63('0x3a')]['join']('\x20')});})['catch'](function(_0x4b16ea){_0x2ccd99(_0x236617[_0x0a63('0xf')](0x1f5,[_0x1e3b70[_0x0a63('0x26')],_0x4b16ea[_0x0a63('0x1a')][_0x0a63('0x2b')]()][_0x0a63('0x13')]('\x20')));});}else{return _0x2ccd99(_0x236617['error'](0x1f5,_0x0a63('0x3b')));}});},'VoiceQueuesChannels':function(_0x38327a){var _0x22b3ea=this;return new Promise(function(_0x10adf1){var _0x3575ae=_['values'](_0x2cfdeb[_0x0a63('0x3c')]);var _0x3c9326={'count':_0x3575ae[_0x0a63('0x21')],'rows':_0x3575ae};if(_0x38327a&&_0x38327a[_0x0a63('0x3d')]){if(!['inbound',_0x0a63('0x3e')][_0x0a63('0x3f')](_0x38327a[_0x0a63('0x3d')])){return _0x2760b0(_0x22b3ea[_0x0a63('0xf')](0x190,_0x0a63('0x40')));}var _0x258ed3=_['filter'](_0x3575ae,function(_0x7e79e3){return _0x7e79e3[_0x0a63('0x3d')]===_0x38327a[_0x0a63('0x3d')];});_0x3c9326[_0x0a63('0x41')]=_0x258ed3['length'];_0x3c9326['rows']=_0x258ed3;}_0x10adf1(_0x3c9326);});},'VoiceQueuesChannel':function(_0x2ac98b){var _0x1f2a59=this;return new Promise(function(_0x42514e,_0x2f32ae){var _0x12c3e5=schema(properties['voicequeuechannel'])['validate'](_0x2ac98b);if(_0x12c3e5['length']>0x0){return _0x2f32ae(_0x1f2a59[_0x0a63('0xf')](0x1f4,_['map'](_0x12c3e5,_0x0a63('0x1a'))[_0x0a63('0x13')](',\x20')));}var _0x2a7269=_['find'](_0x2cfdeb['queueChannels'],{'uniqueid':_0x2ac98b[_0x0a63('0x26')]});if(_0x2a7269){_0x42514e(_0x2a7269);}else{return _0x2f32ae(_0x1f2a59[_0x0a63('0xf')](0x1f5,_0x0a63('0x3b')));}});},'VoiceQueuesChannelHangup':function(_0x41d014){var _0x2d39d7=this;return new Promise(function(_0x15f937,_0x21502e){if(ami[_0x0a63('0x1c')]()==![]){return _0x21502e(_0x2d39d7[_0x0a63('0xf')](0x1f4,[config[_0x0a63('0x10')]['ip'],config[_0x0a63('0x10')][_0x0a63('0x11')],_0x0a63('0x12')][_0x0a63('0x13')]('\x20')));}var _0x5ec1bd=schema(properties['voicequeuechannelhangup'])[_0x0a63('0x33')](_0x41d014);if(_0x5ec1bd[_0x0a63('0x21')]>0x0){return _0x21502e(_0x2d39d7['error'](0x1f4,_[_0x0a63('0x34')](_0x5ec1bd,_0x0a63('0x1a'))['join'](',\x20')));}var _0x3379b5=_[_0x0a63('0x2a')](_0x2cfdeb['queueChannels'],{'uniqueid':_0x41d014['uniqueid']});if(_0x3379b5&&_0x3379b5[_0x0a63('0x27')]){return ami[_0x0a63('0x18')]({'action':_0x0a63('0x42'),'channel':_0x3379b5['channel']})[_0x0a63('0x19')](function(_0x375acd){_0x15f937({'code':0xc8,'message':[_0x41d014[_0x0a63('0x26')],_0x375acd[_0x0a63('0x1a')][_0x0a63('0x2b')]()]['join']('\x20')});})[_0x0a63('0x1b')](function(_0x28becf){_0x21502e(_0x2d39d7[_0x0a63('0xf')](0x1f5,[_0x41d014[_0x0a63('0x26')],_0x28becf[_0x0a63('0x1a')][_0x0a63('0x2b')]()][_0x0a63('0x13')]('\x20')));});}else{return _0x21502e(_0x2d39d7['error'](0x1f5,_0x0a63('0x3b')));}});},'VoiceQueuesChannelRedirect':function(_0x1e25cd){var _0x252f70=this;return new Promise(function(_0x1155f1,_0xd52d09){if(ami[_0x0a63('0x1c')]()==![]){return _0xd52d09(_0x252f70[_0x0a63('0xf')](0x1f4,[config[_0x0a63('0x10')]['ip'],config['asterisk']['username'],_0x0a63('0x12')][_0x0a63('0x13')]('\x20')));}var _0x4137bc=schema(properties[_0x0a63('0x43')])[_0x0a63('0x33')](_0x1e25cd);if(_0x4137bc['length']>0x0){return _0xd52d09(_0x252f70[_0x0a63('0xf')](0x1f4,_[_0x0a63('0x34')](_0x4137bc,_0x0a63('0x1a'))[_0x0a63('0x13')](',\x20')));}var _0x5de083=_[_0x0a63('0x2a')](_0x2cfdeb[_0x0a63('0x3c')],{'uniqueid':_0x1e25cd[_0x0a63('0x26')]});if(_0x5de083&&_0x5de083[_0x0a63('0x27')]){return ami[_0x0a63('0x18')]({'action':_0x0a63('0x44'),'channel':_0x5de083['channel'],'exten':_0x1e25cd[_0x0a63('0x45')],'context':_0x1e25cd['context']||_0x5de083[_0x0a63('0x46')],'priority':0x1})[_0x0a63('0x19')](function(_0x5a1622){_0x1155f1({'code':0xc8,'message':[_0x1e25cd['uniqueid'],_0x5a1622['message'][_0x0a63('0x2b')]()][_0x0a63('0x13')]('\x20')});})[_0x0a63('0x1b')](function(_0x4684dc){_0xd52d09(_0x252f70[_0x0a63('0xf')](0x1f5,[_0x1e25cd[_0x0a63('0x26')],_0x4684dc['message']['toLowerCase']()]['join']('\x20')));});}else{return _0xd52d09(_0x252f70[_0x0a63('0xf')](0x1f5,_0x0a63('0x3b')));}});},'Agents':function(_0x72c1fe){return new Promise(function(_0x38d4f0){var _0x522387=_[_0x0a63('0x47')](_0x2cfdeb['agents']);if(_0x72c1fe&&_0x72c1fe['id']){var _0x5de3de=_[_0x0a63('0x2a')](_0x522387,function(_0x54d9b9){return _0x54d9b9['id']===_0x72c1fe['id'];});_0x38d4f0(_0x5de3de);}else{_0x38d4f0({'count':_0x522387[_0x0a63('0x21')],'rows':_0x522387});}});},'Telephones':function(){return new Promise(function(_0x3ae1bd){var _0x49ab73=_[_0x0a63('0x47')](_0x2cfdeb['telephones']);_0x3ae1bd({'count':_0x49ab73[_0x0a63('0x21')],'rows':_0x49ab73});});},'Trunks':function(){return new Promise(function(_0x482837){var _0x463687=_[_0x0a63('0x47')](_0x2cfdeb[_0x0a63('0x48')]);_0x482837({'count':_0x463687['length'],'rows':_0x463687});});},'OutboundChannels':function(){return new Promise(function(_0x3b8442){var _0x2df35e=_[_0x0a63('0x47')](_0x2cfdeb[_0x0a63('0x49')]);_0x3b8442({'count':_0x2df35e[_0x0a63('0x21')],'rows':_0x2df35e});});},'Outbound':function(){return new Promise(function(_0x500f96){_0x500f96(_0x2cfdeb['outbound']);});},'Campaigns':function(){return new Promise(function(_0x550dbb){var _0x2f3e6a=_['values'](_0x2cfdeb[_0x0a63('0x4a')]);_0x550dbb({'count':_0x2f3e6a[_0x0a63('0x21')],'rows':_0x2f3e6a});});},'VoiceQueuesPreview':function(_0x42e6d0){var _0x253fb1=this;return new Promise(function(_0x5540c6,_0x1ff938){_0x2380f8[_0x0a63('0x4b')](_0x42e6d0['id'])['then'](function(_0x711025){_0x5540c6({'code':0xc8,'message':_0x711025[_0x0a63('0x1a')]});})[_0x0a63('0x1b')](function(_0x32f108){_0x1ff938(_0x253fb1[_0x0a63('0xf')](0x1f4,_0x32f108['message']));});});},'EventManager':function(_0x206221){var _0x11012f=this;return new Promise(function(_0x3941f6,_0x53c2fc){if(!_0x206221['event']){return _0x53c2fc(_0x11012f['error'](0x1f4,_0x0a63('0x4c')));}ami[_0x0a63('0x4d')](_0x0a63('0x4e')+_0x206221[_0x0a63('0x4f')],_0x206221[_0x0a63('0x1a')]);_0x3941f6({'code':0xc8,'message':_0x206221});});},'FaxAccounts':function(){return new Promise(function(_0x3e2205){var _0x3f7f78=_[_0x0a63('0x47')](_0x2cfdeb[_0x0a63('0x50')]);_0x3e2205({'count':_0x3f7f78[_0x0a63('0x21')],'rows':_0x3f7f78});});},'SendFax':function(_0x5c6e18){var _0x7bd890=this;return new Promise(function(_0x10cf0d,_0xdfacb3){_0x37b4c9[_0x0a63('0x51')](_0x5c6e18)[_0x0a63('0x19')](function(_0x1388fc){_0x10cf0d({'code':0xc8,'message':_0x1388fc['message']});})['catch'](function(_0x2412b8){_0xdfacb3(_0x7bd890[_0x0a63('0xf')](0x1f4,_0x2412b8[_0x0a63('0x1a')]));});});},'CheckAfterSend':function(_0x3caea6){var _0x50f07e=this;return new Promise(function(_0x3c3366,_0x5e4293){_0x37b4c9[_0x0a63('0x52')](_0x3caea6)[_0x0a63('0x19')](function(_0x1e256e){_0x3c3366({'code':0xc8,'message':_0x1e256e[_0x0a63('0x1a')]});})['catch'](function(_0x3710fa){_0x5e4293(_0x50f07e[_0x0a63('0xf')](0x1f4,_0x3710fa[_0x0a63('0x1a')]));});});}};var _0x3f309e=jayson['server'](_0x3d5f0b)['http']();_0x3f309e['on'](_0x0a63('0xf'),function(_0x5e3e7a){return _0x2760b0(_0x5e3e7a);});_0x3f309e[_0x0a63('0x5')](0x232a,_0x0a63('0x53'),function(){console[_0x0a63('0x54')](_0x0a63('0x55'),0x232a);return _0x4b7474(_0x0a63('0x56')+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 46a5a58..da3f840 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 _0x2cc0=['length','lodash','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','[CM][%s][%s]','stringify','emit','exec','data1','data2','isNil','data5','xmd-contactid','ListId','data3','split','phone','$or','map','routeId','destcalleridnum','calleridnum','lastName','mobile','createdAt','scheduledAt','resolve','then','getContacts','isEmpty','info','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','firstName','user:%s','format','trigger:%s','action','merge'];(function(_0x507c4d,_0x2d41a7){var _0x31d098=function(_0x487ca9){while(--_0x487ca9){_0x507c4d['push'](_0x507c4d['shift']());}};_0x31d098(++_0x2d41a7);}(_0x2cc0,0x132));var _0x02cc=function(_0x8e361b,_0x18ed0e){_0x8e361b=_0x8e361b-0x0;var _0x364d97=_0x2cc0[_0x8e361b];return _0x364d97;};'use strict';var _=require(_0x02cc('0x0'));var BPromise=require(_0x02cc('0x1'));var Redis=require(_0x02cc('0x2'));var util=require(_0x02cc('0x3'));var config=require(_0x02cc('0x4'));var logger=require(_0x02cc('0x5'))(_0x02cc('0x6'));var cmContactRpc=require(_0x02cc('0x7'));config[_0x02cc('0x8')]=_[_0x02cc('0x9')](config[_0x02cc('0x8')],{'host':_0x02cc('0xa'),'port':0x18eb});var io=require(_0x02cc('0xb'))(new Redis(config[_0x02cc('0x8')]));function emit(_0x3179c9,_0x37fe8f,_0x224539,_0x5aa11f,_0x129bf2){logger['info'](_0x02cc('0xc'),_0x3179c9,_0x37fe8f['id'],_0x224539,_0x5aa11f,JSON[_0x02cc('0xd')](_0x129bf2));io['to'](_0x224539)[_0x02cc('0xe')](_0x5aa11f,_0x129bf2);}exports[_0x02cc('0xf')]=function(_0xc38870,_0x5a777c,_0x318390,_0x46e3d9){var _0x409fc4,_0xcc627b;var _0x2e6032={};var _0x5b6bed;var _0xbbdb7b=Number(_0x318390[_0x02cc('0x10')]);var _0x290492=_0x318390[_0x02cc('0x11')]?Boolean(Number(_0x318390[_0x02cc('0x11')])):![];var _0x5aea78;var _0x37a383=![];if(!_[_0x02cc('0x12')](_0x318390['data5'])){if(_0x318390[_0x02cc('0x13')]=='1')_0x37a383=!![];}if(!_0x37a383){if(_0x46e3d9['xmd-contactid']){_0x2e6032['id']=_0x46e3d9[_0x02cc('0x14')];}}if(!_0x2e6032['id']){_0x2e6032[_0x02cc('0x15')]=_0xbbdb7b;_0x5aea78=_0x318390[_0x02cc('0x16')]&&_0x318390[_0x02cc('0x16')]!=='0'?_0x318390[_0x02cc('0x16')][_0x02cc('0x17')](','):[_0x02cc('0x18')];_0x2e6032[_0x02cc('0x19')]=_[_0x02cc('0x1a')](_0x5aea78,function(_0x463553){var _0x249451={};_0x249451[_0x463553]=_0x46e3d9[_0x02cc('0x1b')]?_0x46e3d9[_0x02cc('0x1c')]:_0x46e3d9[_0x02cc('0x1d')];return _0x249451;});_0x5b6bed=_0x46e3d9[_0x02cc('0x1b')]?_0x46e3d9[_0x02cc('0x1c')]:_0x46e3d9['calleridnum'];}var _0x19ad35=['id','firstName',_0x02cc('0x1e'),'phone',_0x02cc('0x1f'),'fax',_0x02cc('0x15'),_0x02cc('0x20'),_0x02cc('0x21'),'updatedAt'];var _0x41037c=_['union'](_0x19ad35,_0x5aea78);BPromise[_0x02cc('0x22')]()[_0x02cc('0x23')](cmContactRpc[_0x02cc('0x24')]({'attributes':_0x41037c,'where':_0x2e6032,'phone':_0x5b6bed}))[_0x02cc('0x23')](function(_0x2092bb){_0xcc627b=_0x2092bb;if(!_[_0x02cc('0x25')](_0xcc627b)){if(_0xcc627b['length']===0x1){_0x409fc4=_0xcc627b[0x0];logger[_0x02cc('0x26')](_0x02cc('0x27'),_0x46e3d9[_0x02cc('0x28')],_0x5a777c['id'],_0x409fc4['id']);}else{logger[_0x02cc('0x26')](_0x02cc('0x29'),_0x46e3d9[_0x02cc('0x28')],_0x5a777c['id'],_[_0x02cc('0x1a')](_0xcc627b,'id')[_0x02cc('0x2a')](','));}return;}else{logger[_0x02cc('0x26')](_0x02cc('0x2b'),_0x46e3d9['uniqueid'],_0x5a777c['id']);var _0xfb5d15={'ListId':_0xbbdb7b};var _0x3ea336=_0x318390[_0x02cc('0x2c')]&&_0x318390[_0x02cc('0x2c')]!=='0'?_0x318390[_0x02cc('0x2c')]:_0x02cc('0x18');if(_0x290492){logger['info'](_0x02cc('0x2d'),_0x46e3d9[_0x02cc('0x28')],_0x5a777c['id']);_0xfb5d15[_0x3ea336]=_[_0x02cc('0x12')](_0x46e3d9[_0x02cc('0x1b')])?_0x46e3d9[_0x02cc('0x1d')]:_0x46e3d9[_0x02cc('0x1c')];if(_[_0x02cc('0x12')](_0x46e3d9[_0x02cc('0x1b')])){_0xfb5d15['firstName']=_0x46e3d9[_0x02cc('0x2e')]&&_0x46e3d9[_0x02cc('0x2e')]!==_0x02cc('0x2f')?_0x46e3d9[_0x02cc('0x2e')]:_0x02cc('0x30');}else{_0xfb5d15['firstName']=_0x46e3d9[_0x02cc('0x31')]&&_0x46e3d9[_0x02cc('0x31')]!==_0x02cc('0x2f')?_0x46e3d9['destcalleridname']:_0x02cc('0x30');}return BPromise[_0x02cc('0x22')]()[_0x02cc('0x23')](cmContactRpc[_0x02cc('0x32')](_0xfb5d15))[_0x02cc('0x23')](function(_0xa0ab18){_0x409fc4=_0xa0ab18;_0xcc627b[_0x02cc('0x33')](_0xa0ab18);if(_0x409fc4){logger[_0x02cc('0x26')](_0x02cc('0x34'),_0x46e3d9[_0x02cc('0x28')],_0x5a777c['id'],_0x409fc4['id']);}return;});}else{logger[_0x02cc('0x26')](_0x02cc('0x35'),_0x46e3d9[_0x02cc('0x28')],_0x5a777c['id']);_0xfb5d15[_0x3ea336]=_[_0x02cc('0x12')](_0x46e3d9['routeId'])?_0x46e3d9[_0x02cc('0x1d')]:_0x46e3d9[_0x02cc('0x1c')];if(_[_0x02cc('0x12')](_0x46e3d9[_0x02cc('0x1b')])){_0xfb5d15[_0x02cc('0x36')]=_0x46e3d9[_0x02cc('0x2e')]&&_0x46e3d9[_0x02cc('0x2e')]!==_0x02cc('0x2f')?_0x46e3d9[_0x02cc('0x2e')]:'Unknown';}else{_0xfb5d15[_0x02cc('0x36')]=_0x46e3d9[_0x02cc('0x31')]&&_0x46e3d9[_0x02cc('0x31')]!==_0x02cc('0x2f')?_0x46e3d9[_0x02cc('0x31')]:'Unknown';}_0x409fc4=_0xfb5d15;_0xcc627b['push'](_0xfb5d15);return;}}})['then'](function(){if(_0xc38870){emit(_0x46e3d9[_0x02cc('0x28')],_0x5a777c,util['format'](_0x02cc('0x37'),_0xc38870['name']),util[_0x02cc('0x38')](_0x02cc('0x39'),_0x318390[_0x02cc('0x3a')]['toLowerCase']()),{'evt':_[_0x02cc('0x3b')](_0x46e3d9,{'autoCreate':_0x290492}),'contact':_0x409fc4===undefined?{}:_0x409fc4,'contacts':_0xcc627b[_0x02cc('0x3c')]===0x0?undefined:_0xcc627b});}});}; \ No newline at end of file +var _0xac54=['length','lodash','bluebird','ioredis','../../../../config/environment','trigger','../../rpc/cmContact','redis','defaults','localhost','info','[CM][%s][%s]','stringify','exec','data1','data2','isNil','data5','xmd-contactid','ListId','data3','phone','$or','routeId','calleridnum','mobile','createdAt','scheduledAt','updatedAt','then','getContacts','isEmpty','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','map','[CM][%s][%s]\x20Contact\x20not\x20found','data4','destcalleridnum','firstName','calleridname','Unknown','destcalleridname','','resolve','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','trigger:%s','action'];(function(_0x5af97c,_0x24a49f){var _0x3472ae=function(_0x54cdc3){while(--_0x54cdc3){_0x5af97c['push'](_0x5af97c['shift']());}};_0x3472ae(++_0x24a49f);}(_0xac54,0xd1));var _0x4ac5=function(_0x1dd045,_0x3c62df){_0x1dd045=_0x1dd045-0x0;var _0x2e532e=_0xac54[_0x1dd045];return _0x2e532e;};'use strict';var _=require(_0x4ac5('0x0'));var BPromise=require(_0x4ac5('0x1'));var Redis=require(_0x4ac5('0x2'));var util=require('util');var config=require(_0x4ac5('0x3'));var logger=require('../../../../config/logger')(_0x4ac5('0x4'));var cmContactRpc=require(_0x4ac5('0x5'));config[_0x4ac5('0x6')]=_[_0x4ac5('0x7')](config[_0x4ac5('0x6')],{'host':_0x4ac5('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x1739b4,_0x24a9d3,_0x474a8e,_0x45e8d5,_0xed01ee){logger[_0x4ac5('0x9')](_0x4ac5('0xa'),_0x1739b4,_0x24a9d3['id'],_0x474a8e,_0x45e8d5,JSON[_0x4ac5('0xb')](_0xed01ee));io['to'](_0x474a8e)['emit'](_0x45e8d5,_0xed01ee);}exports[_0x4ac5('0xc')]=function(_0x1e4d68,_0x1f92a9,_0x4e16c3,_0x3dc193){var _0x188235,_0x113ac4;var _0x542ae7={};var _0x48543c;var _0x5f0016=Number(_0x4e16c3[_0x4ac5('0xd')]);var _0x4a0ef5=_0x4e16c3[_0x4ac5('0xe')]?Boolean(Number(_0x4e16c3[_0x4ac5('0xe')])):![];var _0x3e45ad;var _0x273006=![];if(!_[_0x4ac5('0xf')](_0x4e16c3[_0x4ac5('0x10')])){if(_0x4e16c3[_0x4ac5('0x10')]=='1')_0x273006=!![];}if(!_0x273006){if(_0x3dc193[_0x4ac5('0x11')]){_0x542ae7['id']=_0x3dc193[_0x4ac5('0x11')];}}if(!_0x542ae7['id']){_0x542ae7[_0x4ac5('0x12')]=_0x5f0016;_0x3e45ad=_0x4e16c3[_0x4ac5('0x13')]&&_0x4e16c3[_0x4ac5('0x13')]!=='0'?_0x4e16c3[_0x4ac5('0x13')]['split'](','):[_0x4ac5('0x14')];_0x542ae7[_0x4ac5('0x15')]=_['map'](_0x3e45ad,function(_0x1f22a4){var _0x21bbd2={};_0x21bbd2[_0x1f22a4]=_0x3dc193[_0x4ac5('0x16')]?_0x3dc193['destcalleridnum']:_0x3dc193[_0x4ac5('0x17')];return _0x21bbd2;});_0x48543c=_0x3dc193[_0x4ac5('0x16')]?_0x3dc193['destcalleridnum']:_0x3dc193['calleridnum'];}var _0x5eaa28=['id','firstName','lastName',_0x4ac5('0x14'),_0x4ac5('0x18'),'fax',_0x4ac5('0x12'),_0x4ac5('0x19'),_0x4ac5('0x1a'),_0x4ac5('0x1b')];var _0x1e0b67=_['union'](_0x5eaa28,_0x3e45ad);BPromise['resolve']()[_0x4ac5('0x1c')](cmContactRpc[_0x4ac5('0x1d')]({'attributes':_0x1e0b67,'where':_0x542ae7,'phone':_0x48543c}))[_0x4ac5('0x1c')](function(_0x40cded){_0x113ac4=_0x40cded;if(!_[_0x4ac5('0x1e')](_0x113ac4)){if(_0x113ac4['length']===0x1){_0x188235=_0x113ac4[0x0];logger[_0x4ac5('0x9')](_0x4ac5('0x1f'),_0x3dc193['uniqueid'],_0x1f92a9['id'],_0x188235['id']);}else{logger[_0x4ac5('0x9')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x3dc193[_0x4ac5('0x20')],_0x1f92a9['id'],_[_0x4ac5('0x21')](_0x113ac4,'id')['join'](','));}return;}else{logger[_0x4ac5('0x9')](_0x4ac5('0x22'),_0x3dc193[_0x4ac5('0x20')],_0x1f92a9['id']);var _0x27f2b2={'ListId':_0x5f0016};var _0x307465=_0x4e16c3[_0x4ac5('0x23')]&&_0x4e16c3[_0x4ac5('0x23')]!=='0'?_0x4e16c3['data4']:_0x4ac5('0x14');if(_0x4a0ef5){logger[_0x4ac5('0x9')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0x3dc193['uniqueid'],_0x1f92a9['id']);_0x27f2b2[_0x307465]=_['isNil'](_0x3dc193['routeId'])?_0x3dc193[_0x4ac5('0x17')]:_0x3dc193[_0x4ac5('0x24')];if(_[_0x4ac5('0xf')](_0x3dc193[_0x4ac5('0x16')])){_0x27f2b2[_0x4ac5('0x25')]=_0x3dc193[_0x4ac5('0x26')]&&_0x3dc193[_0x4ac5('0x26')]!==''?_0x3dc193[_0x4ac5('0x26')]:_0x4ac5('0x27');}else{_0x27f2b2[_0x4ac5('0x25')]=_0x3dc193['destcalleridname']&&_0x3dc193[_0x4ac5('0x28')]!==_0x4ac5('0x29')?_0x3dc193[_0x4ac5('0x28')]:_0x4ac5('0x27');}return BPromise[_0x4ac5('0x2a')]()['then'](cmContactRpc[_0x4ac5('0x2b')](_0x27f2b2))[_0x4ac5('0x1c')](function(_0x387738){_0x188235=_0x387738;_0x113ac4[_0x4ac5('0x2c')](_0x387738);if(_0x188235){logger['info'](_0x4ac5('0x2d'),_0x3dc193[_0x4ac5('0x20')],_0x1f92a9['id'],_0x188235['id']);}return;});}else{logger[_0x4ac5('0x9')](_0x4ac5('0x2e'),_0x3dc193[_0x4ac5('0x20')],_0x1f92a9['id']);_0x27f2b2[_0x307465]=_[_0x4ac5('0xf')](_0x3dc193['routeId'])?_0x3dc193['calleridnum']:_0x3dc193['destcalleridnum'];if(_[_0x4ac5('0xf')](_0x3dc193[_0x4ac5('0x16')])){_0x27f2b2['firstName']=_0x3dc193[_0x4ac5('0x26')]&&_0x3dc193['calleridname']!==_0x4ac5('0x29')?_0x3dc193['calleridname']:'Unknown';}else{_0x27f2b2[_0x4ac5('0x25')]=_0x3dc193[_0x4ac5('0x28')]&&_0x3dc193[_0x4ac5('0x28')]!==_0x4ac5('0x29')?_0x3dc193[_0x4ac5('0x28')]:_0x4ac5('0x27');}_0x188235=_0x27f2b2;_0x113ac4[_0x4ac5('0x2c')](_0x27f2b2);return;}}})[_0x4ac5('0x1c')](function(){if(_0x1e4d68){emit(_0x3dc193[_0x4ac5('0x20')],_0x1f92a9,util[_0x4ac5('0x2f')](_0x4ac5('0x30'),_0x1e4d68['name']),util[_0x4ac5('0x2f')](_0x4ac5('0x31'),_0x4e16c3[_0x4ac5('0x32')]['toLowerCase']()),{'evt':_['merge'](_0x3dc193,{'autoCreate':_0x4a0ef5}),'contact':_0x188235===undefined?{}:_0x188235,'contacts':_0x113ac4[_0x4ac5('0x33')]===0x0?undefined:_0x113ac4});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 3386377..4254b70 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 _0x4e85=['agents','voiceQueues','templates','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','deskAccounts','syncCustomEvent','bind','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentreject','custom:amd','custom:queuecallerabandon','custom:timeout','custom:dialconnect','syncAgentDial','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:substatus','custom:outgoingmessage','custom:acceptmessage','prototype','emit','info','stringify','clone','undefined','motionChannel','voice','inspect','checkTriggers','interface','status','checkTrigger','merge','length','Actions','action','browser','data1','TemplateId','data2','html','render','template\x20not\x20found','uri','buildUri','isNil','data3','data4','location','uriLocation','data5','800','windowHeight','data6','winApplication','format','user:%s','name','trigger:%s:%s','toLowerCase','jscripty','trigger:%s','contactmanager','exec','integration','queue','voiceExtensions','routeId','urlforward','parse','query','replace','channel','AllConditions','checkConditions','some','AnyConditions','debug','evt','field','chat','ChatWebsiteId','operator','value','upperFirst','AccountId','message','event','membername','lastevent','mailSubstatus','null','substatus','offlineMessage','created','equals','exports','lodash','url','mustache','ioredis','./urlforward','./script','../../../config/environment','../../../config/logger','../ami','redis','defaults','localhost','popup','winapp','triggers'];(function(_0x2e85df,_0x3c512a){var _0x1c5a22=function(_0x54281c){while(--_0x54281c){_0x2e85df['push'](_0x2e85df['shift']());}};_0x1c5a22(++_0x3c512a);}(_0x4e85,0x16b));var _0x54e8=function(_0x513a84,_0x2a5b7f){_0x513a84=_0x513a84-0x0;var _0x7d206=_0x4e85[_0x513a84];return _0x7d206;};'use strict';var util=require('util');var _=require(_0x54e8('0x0'));var url=require(_0x54e8('0x1'));var Mustache=require(_0x54e8('0x2'));var Redis=require(_0x54e8('0x3'));var urlforward=require(_0x54e8('0x4'));var integration=require('./integration');var cmContact=require('./cmContact');var script=require(_0x54e8('0x5'));var config=require(_0x54e8('0x6'));var logger=require(_0x54e8('0x7'))('trigger');var ami=require(_0x54e8('0x8'));config[_0x54e8('0x9')]=_[_0x54e8('0xa')](config[_0x54e8('0x9')],{'host':_0x54e8('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x54e8('0x9')]));var operators={'equals':function(_0x52c3ce,_0x3b4cdb){return _0x52c3ce==_0x3b4cdb;},'not_equals':function(_0x5bd729,_0x42d4a5){return _0x5bd729!=_0x42d4a5;}};var barAndWebActions=[_0x54e8('0xc'),_0x54e8('0x1'),_0x54e8('0xd')];function Trigger(_0x20a053){this['triggers']=_0x20a053[_0x54e8('0xe')];this[_0x54e8('0xf')]=_0x20a053[_0x54e8('0xf')];this[_0x54e8('0x10')]=_0x20a053[_0x54e8('0x10')];this[_0x54e8('0x11')]=_0x20a053[_0x54e8('0x11')];this['voiceExtensions']=_0x20a053['voiceExtensions'];this['zendeskAccounts']=_0x20a053[_0x54e8('0x12')];this[_0x54e8('0x13')]=_0x20a053['freshdeskAccounts'];this[_0x54e8('0x14')]=_0x20a053[_0x54e8('0x14')];this[_0x54e8('0x15')]=_0x20a053['sugarcrmAccounts'];this[_0x54e8('0x16')]=_0x20a053[_0x54e8('0x16')];this['deskAccounts']=_0x20a053['deskAccounts'];this[_0x54e8('0x17')]=_0x20a053['vtigerAccounts'];this[_0x54e8('0x18')]=_0x20a053['servicenowAccounts'];this[_0x54e8('0x19')]=_0x20a053['dynamics365Accounts'];this[_0x54e8('0x1a')]=_0x20a053[_0x54e8('0x1a')];this[_0x54e8('0x1b')]={'zendesk':this[_0x54e8('0x12')],'salesforce':this['salesforceAccounts'],'freshdesk':this[_0x54e8('0x13')],'sugarcrm':this[_0x54e8('0x15')],'zoho':this[_0x54e8('0x16')],'desk':this[_0x54e8('0x1c')],'vtiger':this['vtigerAccounts'],'dynamics365':this[_0x54e8('0x19')],'freshsales':this[_0x54e8('0x1a')],'servicenow':this[_0x54e8('0x18')]};ami['on']('custom:agentcalled',this[_0x54e8('0x1d')][_0x54e8('0x1e')](this));ami['on']('custom:agentconnect',this[_0x54e8('0x1d')]['bind'](this));ami['on'](_0x54e8('0x1f'),this[_0x54e8('0x1d')][_0x54e8('0x1e')](this));ami['on'](_0x54e8('0x20'),this['syncCustomEvent']['bind'](this));ami['on'](_0x54e8('0x21'),this[_0x54e8('0x1d')][_0x54e8('0x1e')](this));ami['on'](_0x54e8('0x22'),this['syncCustomEvent']['bind'](this));ami['on'](_0x54e8('0x23'),this[_0x54e8('0x1d')]['bind'](this));ami['on']('custom:agentcongestion',this['syncCustomEvent'][_0x54e8('0x1e')](this));ami['on'](_0x54e8('0x24'),this[_0x54e8('0x1d')][_0x54e8('0x1e')](this));ami['on'](_0x54e8('0x25'),this[_0x54e8('0x1d')][_0x54e8('0x1e')](this));ami['on'](_0x54e8('0x26'),this['syncCustomEvent'][_0x54e8('0x1e')](this));ami['on'](_0x54e8('0x27'),this[_0x54e8('0x1d')][_0x54e8('0x1e')](this));ami['on']('custom:dialbegin',this['syncAgentDial'][_0x54e8('0x1e')](this));ami['on'](_0x54e8('0x28'),this[_0x54e8('0x29')]['bind'](this));ami['on'](_0x54e8('0x2a'),this[_0x54e8('0x29')]['bind'](this));ami['on'](_0x54e8('0x2b'),this[_0x54e8('0x1d')][_0x54e8('0x1e')](this));ami['on'](_0x54e8('0x2c'),this[_0x54e8('0x1d')]['bind'](this));ami['on'](_0x54e8('0x2d'),this['syncCustomEvent']['bind'](this));ami['on']('custom:incomingmessage',this['syncCustomEvent'][_0x54e8('0x1e')](this));ami['on'](_0x54e8('0x2e'),this['syncCustomEvent']['bind'](this));ami['on'](_0x54e8('0x2f'),this[_0x54e8('0x1d')][_0x54e8('0x1e')](this));ami['on']('custom:rejectmessage',this[_0x54e8('0x1d')]['bind'](this));ami['on']('custom:offlineMessage',this['syncCustomEvent'][_0x54e8('0x1e')](this));}Trigger[_0x54e8('0x30')][_0x54e8('0x31')]=function(_0x4dd3e1,_0x17d634,_0x5d9ab0){logger[_0x54e8('0x32')](_0x4dd3e1,_0x17d634,JSON[_0x54e8('0x33')](_0x5d9ab0));io['to'](_0x4dd3e1)[_0x54e8('0x31')](_0x17d634,_0x5d9ab0);};Trigger[_0x54e8('0x30')]['syncCustomEvent']=function(_0x68713b){var _0x26b314=_[_0x54e8('0x34')](_0x68713b);if(typeof _0x26b314['motionChannel']===_0x54e8('0x35')){_0x26b314[_0x54e8('0x36')]=_0x54e8('0x37');}logger['debug']('syncCustomEvent',util[_0x54e8('0x38')](_0x26b314,{'showHidden':!![],'depth':null}));this[_0x54e8('0x39')](_0x26b314);};Trigger['prototype'][_0x54e8('0x29')]=function(_0x5275a3){if(this['agents'][_0x5275a3[_0x54e8('0x3a')]]){this[_0x54e8('0x1d')](_0x5275a3);}};Trigger[_0x54e8('0x30')][_0x54e8('0x39')]=function(_0x5f27c9){var _0x52b95d;for(var _0x412dfc in this['triggers']){if(this[_0x54e8('0xe')]['hasOwnProperty'](_0x412dfc)){if(this[_0x54e8('0xe')][_0x412dfc][_0x54e8('0x3b')]){_0x52b95d=this[_0x54e8('0x3c')](this[_0x54e8('0xe')][_0x412dfc],_0x5f27c9);if(_0x52b95d){_[_0x54e8('0x3d')](_0x5f27c9,_0x5f27c9['variables']);for(var _0xd41690=0x0,_0x25ce70,_0xbd22d9,_0x56219d;_0xd416900x0){_0x55ad0f=_[_0xf326('0x25')](_0x581531,_0x1617d2);}return _0x55ad0f;}function getCustomFields(_0x1ae23a,_0x2fa28e){var _0x5dbe63=[];var _0xc115d9={'custom_fields':{}};if(_0x1ae23a[_0xf326('0x26')]>0x0){_['forEach'](_0x1ae23a,function(_0x225776){if(_[_0xf326('0x27')]([_0xf326('0x28'),_0xf326('0x29')],_0x225776[_0xf326('0x2a')])&&_0x225776[_0xf326('0x2b')]&&!_0x225776[_0xf326('0x2c')]){_0xc115d9[_0x225776[_0xf326('0x2b')][_0xf326('0x2d')]()]=_0x225776[_0xf326('0x2e')]['toString']();}else if(_[_0xf326('0x27')]([_0xf326('0x28'),_0xf326('0x29')],_0x225776['type'])&&_0x225776[_0xf326('0x2f')]&&_0x225776[_0xf326('0x2c')]){_0xc115d9[_0xf326('0x30')][_0x225776['idField']]=_0x225776['content'][_0xf326('0x31')]();}else if(_0x225776[_0xf326('0x2a')]===_0xf326('0x32')&&_0x225776[_0xf326('0x33')]&&_0x225776[_0xf326('0x2f')]&&_0x225776[_0xf326('0x2c')]){_0x2fa28e[_0x225776[_0xf326('0x33')]]&&(_0xc115d9[_0xf326('0x30')][_0x225776['idField']]=_0x2fa28e[_0x225776[_0xf326('0x33')]][_0xf326('0x31')]());}else if(_0x225776['type']===_0xf326('0x34')&&_0x225776['Variable']&&_0x225776[_0xf326('0x35')]['name']&&_0x225776['idField']&&_0x225776[_0xf326('0x2c')]){_0x2fa28e[_0x225776['Variable'][_0xf326('0x36')]['toLowerCase']()]&&(_0xc115d9[_0xf326('0x30')][_0x225776[_0xf326('0x2f')]]=_0x2fa28e[_0x225776[_0xf326('0x35')]['name'][_0xf326('0x2d')]()][_0xf326('0x31')]());}});}if(_0xc115d9['priority']){_0xc115d9[_0xf326('0x37')]=Number(_0xc115d9[_0xf326('0x37')]);}return _0xc115d9;}function getTicket(_0x40fa7a,_0xaf65e0,_0x51076c,_0x2c4416,_0xb1ef35){logger[_0xf326('0xb')](_0xf326('0x38'));var _0x1d88ed=_['merge']({'subject':intUtil[_0xf326('0x39')](_0x2c4416[_0xf326('0x3a')],_0xb1ef35,'\x20'),'type':'phone','status':'new','labels':[_0xf326('0x3b'),'Motion','CTI'][_0xf326('0x3c')](getTags(_0x2c4416['Tags'],_0xf326('0x36'))),'description':intUtil[_0xf326('0x39')](_0x2c4416[_0xf326('0x3d')],_0xb1ef35,'\x0a'),'_links':{'assigned_user':{'href':util[_0xf326('0x13')]('/api/v2/users/%d',_0xaf65e0['id']),'class':_0xf326('0x3e')}},'message':{'direction':'in','body':intUtil[_0xf326('0x39')](_0x2c4416[_0xf326('0x3d')],_0xb1ef35,'\x0a')}},getCustomFields(_0x2c4416[_0xf326('0x3f')],_0xb1ef35));return request({'uri':util[_0xf326('0x13')](_0xf326('0x40'),_0x40fa7a[_0xf326('0x16')],_0x51076c['id']),'method':_0xf326('0x23'),'body':_0x1d88ed});}exports[_0xf326('0x41')]=function(_0x1227d3,_0x361776,_0x2bab13,_0x50d63f,_0x1b6126,_0x1637dc){var _0x2ed1a7,_0x270288;_0x1637dc[_0xf326('0x16')]=intUtil[_0xf326('0x42')](_0x1637dc['remoteUri']);_0x1637dc[_0xf326('0x43')]=intUtil[_0xf326('0x42')](_0x1637dc['serverUrl']);if(_0x1b6126&&_0x1b6126[_0xf326('0x44')]){logger[_0xf326('0xb')](_0xf326('0x45'),_0xf326('0x46'));_0x361776[_0xf326('0x47')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1637dc[_0xf326('0x43')],_0x361776[_0xf326('0x48')],md5(_0x361776['uniqueid']));}else{_0x361776['recordingURL']='';}headers[_0xf326('0x49')]=getAuth(_0x1637dc);return getUser(_0x1637dc,_0x50d63f[_0xf326('0x4a')])[_0xf326('0xe')](function(_0x5b3705){_0x2ed1a7=_0x5b3705;logger[_0xf326('0xb')](_0xf326('0x4b'),_0x2ed1a7['id']);return getEndUser(_0x1637dc,_0x361776[_0xf326('0x4c')],_0x361776[_0xf326('0x4d')]);})[_0xf326('0xe')](function(_0x2d9bba){_0x270288=_0x2d9bba;logger[_0xf326('0xb')](_0xf326('0x4e'),_0x270288['id']);return getTicket(_0x1637dc,_0x2ed1a7,_0x270288,_0x2bab13,_0x361776);})[_0xf326('0xe')](function(_0x27ced1){if(_0x27ced1){logger[_0xf326('0xb')](_0xf326('0x4f'));logger[_0xf326('0xb')](_0xf326('0x50'),_0x27ced1['id']);switch(_0x1637dc[_0xf326('0x2a')]){case'integrationTab':logger[_0xf326('0xb')](_0xf326('0x45'),_0xf326('0x51'));emit(util[_0xf326('0x13')]('user:%s',_0x50d63f[_0xf326('0x36')]),_0xf326('0x52'),{'recordId':_0x27ced1['id']});break;case _0xf326('0x53'):logger[_0xf326('0xb')]('[QUEUE]',_0xf326('0x54'));emit(util[_0xf326('0x13')](_0xf326('0x55'),_0x50d63f[_0xf326('0x36')]),_0xf326('0x56'),{'uri':util['format']('https://xcally.desk.com/web/agent/case/%d',_0x27ced1['id'])});break;default:logger[_0xf326('0x57')](_0xf326('0x45'),_0xf326('0x58'));}}})['catch'](function(_0x102fba){console[_0xf326('0x57')](_0x102fba);logger[_0xf326('0x57')]('[QUEUE]',JSON['stringify'](_0x102fba));});};exports[_0xf326('0x59')]=function(_0x5b4832,_0x1cf58f,_0x554277,_0x458e5f,_0x7ee57,_0x28c959,_0x25e091){var _0x212594,_0x35d3c8;_0x28c959[_0xf326('0x16')]=intUtil['stripTrailingSlash'](_0x28c959[_0xf326('0x16')]);_0x28c959[_0xf326('0x43')]=intUtil[_0xf326('0x42')](_0x28c959['serverUrl']);if(_0x25e091&&_0x25e091[_0xf326('0x5a')]&&_0x25e091[_0xf326('0x5a')]!==_0xf326('0x5b')){logger[_0xf326('0xb')](_0xf326('0x5c'),'Recording\x20is\x20enabled!');_0x1cf58f[_0xf326('0x47')]=util[_0xf326('0x13')](_0xf326('0x5d'),_0x28c959[_0xf326('0x43')],_0x1cf58f['uniqueid'],md5(_0x1cf58f[_0xf326('0x48')]));}headers[_0xf326('0x49')]=getAuth(_0x28c959);return getUser(_0x28c959,_0x458e5f[_0xf326('0x4a')])[_0xf326('0xe')](function(_0x4d3b9e){_0x212594=_0x4d3b9e;logger['info'](_0xf326('0x4b'),_0x212594['id']);return getEndUser(_0x28c959,_0x1cf58f[_0xf326('0x5e')],_0x1cf58f['destcalleridnum']);})[_0xf326('0xe')](function(_0x29de71){_0x35d3c8=_0x29de71;logger[_0xf326('0xb')](_0xf326('0x4e'),_0x35d3c8['id']);return getTicket(_0x28c959,_0x212594,_0x35d3c8,_0x554277,_0x1cf58f);})['then'](function(_0xb1c18c){if(_0xb1c18c){logger['info']('Ticket\x20created!');logger[_0xf326('0xb')]('The\x20Ticket\x20ID\x20is:',_0xb1c18c['id']);switch(_0x28c959[_0xf326('0x2a')]){case _0xf326('0x5f'):logger[_0xf326('0xb')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');emit(util[_0xf326('0x13')](_0xf326('0x55'),_0x458e5f[_0xf326('0x36')]),'trigger:desk:display',{'recordId':_0xb1c18c['id']});break;case _0xf326('0x53'):logger['info'](_0xf326('0x45'),_0xf326('0x54'));emit(util[_0xf326('0x13')](_0xf326('0x55'),_0x458e5f[_0xf326('0x36')]),_0xf326('0x56'),{'uri':util[_0xf326('0x13')](_0xf326('0x60'),_0x28c959[_0xf326('0x16')],_0xb1c18c['id'])});break;default:logger[_0xf326('0x57')](_0xf326('0x5c'),_0xf326('0x58'));}}})[_0xf326('0x61')](function(_0x4ca1b8){logger[_0xf326('0x57')]('[OUTBOUND]',JSON[_0xf326('0x62')](_0x4ca1b8));});};exports[_0xf326('0x63')]=function(_0x5e858d,_0x2b770c,_0x5283da,_0x3255b2,_0xd55246,_0x28f3cb){var _0x2d45c9,_0x31b6dd;_0x28f3cb['remoteUri']=intUtil['stripTrailingSlash'](_0x28f3cb[_0xf326('0x16')]);_0x28f3cb[_0xf326('0x43')]=intUtil[_0xf326('0x42')](_0x28f3cb[_0xf326('0x43')]);if(_0xd55246&&_0xd55246[_0xf326('0x44')]){logger['info']('['+_0x2b770c[_0xf326('0x64')][_0xf326('0x65')]()+']','Recording\x20is\x20enabled!');_0x2b770c['recordingURL']=util['format'](_0xf326('0x5d'),_0x28f3cb[_0xf326('0x43')],_0x2b770c[_0xf326('0x48')],md5(_0x2b770c[_0xf326('0x48')]));}else{_0x2b770c[_0xf326('0x47')]='';}headers[_0xf326('0x49')]=getAuth(_0x28f3cb);return getUser(_0x28f3cb)[_0xf326('0xe')](function(_0x4b9013){_0x2d45c9=_0x4b9013;logger[_0xf326('0xb')](_0xf326('0x4b'),_0x2d45c9['id']);return getEndUser(_0x28f3cb,_0x2b770c[_0xf326('0x4c')],_0x2b770c[_0xf326('0x4d')]);})['then'](function(_0x3717fe){_0x31b6dd=_0x3717fe;logger['info']('The\x20Enduser\x20ID\x20is:',_0x31b6dd['id']);return getTicket(_0x28f3cb,_0x2d45c9,_0x31b6dd,_0x5283da,_0x2b770c);})[_0xf326('0xe')](function(_0x540fa0){if(_0x540fa0){logger[_0xf326('0xb')](_0xf326('0x4f'));logger[_0xf326('0xb')](_0xf326('0x50'),_0x540fa0['id']);}})[_0xf326('0x61')](function(_0x541491){logger['error']('['+_0x2b770c['lastevent'][_0xf326('0x65')]()+']',JSON[_0xf326('0x62')](_0x541491));});}; \ No newline at end of file +var _0x55ca=['debug','[HTTP]','stringify','GET','authType','basic','%s:%s','username','token','%s/token:%s','toString','base64','Searching\x20enduser\x20with\x20phone','Enduser\x20found!','_embedded','entries','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/customers','POST','length','forEach','includes','picklist','type','nameField','customField','toLowerCase','content','string','idField','custom_fields','variable','variableName','customVariable','Variable','name','priority','merge','xCALLY','Motion','CTI','concat','Tags','getString','Descriptions','/api/v2/users/%d','user','Fields','stripTrailingSlash','serverUrl','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','calleridname','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','integrationTab','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','error','Desk\x20account\x20type\x20not\x20recognized','outbound','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','%s/agent/tickets/%s','catch','unmanaged','monitor_format','lastevent','toUpperCase','Recording\x20is\x20enabled!','lodash','request-promise','./util','../../../../config/environment','desk','redis','defaults','localhost','socket.io-emitter','application/json','validateEmail','info','Getting\x20agent\x20with\x20email','format','%s/users','remoteUri','then','total_entries','find','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me'];(function(_0x56a072,_0x6db6a9){var _0x175be9=function(_0x20c281){while(--_0x20c281){_0x56a072['push'](_0x56a072['shift']());}};_0x175be9(++_0x6db6a9);}(_0x55ca,0x126));var _0xa55c=function(_0x2c34ff,_0x1e8bee){_0x2c34ff=_0x2c34ff-0x0;var _0x476508=_0x55ca[_0x2c34ff];return _0x476508;};'use strict';var _=require(_0xa55c('0x0'));var rp=require(_0xa55c('0x1'));var md5=require('md5');var util=require('util');var Redis=require('ioredis');var intUtil=require(_0xa55c('0x2'));var config=require(_0xa55c('0x3'));var logger=require('../../../../config/logger')(_0xa55c('0x4'));config[_0xa55c('0x5')]=_[_0xa55c('0x6')](config[_0xa55c('0x5')],{'host':_0xa55c('0x7'),'port':0x18eb});var io=require(_0xa55c('0x8'))(new Redis(config[_0xa55c('0x5')]));function emit(_0x4d0624,_0x2121fd,_0x2537f0){io['to'](_0x4d0624)['emit'](_0x2121fd,_0x2537f0);}var headers={'Content-Type':_0xa55c('0x9'),'Accept':_0xa55c('0x9')};function getUser(_0x52a3bc,_0x5849ad){if(intUtil[_0xa55c('0xa')](_0x5849ad)===!![]){logger[_0xa55c('0xb')](_0xa55c('0xc'),_0x5849ad);return request({'uri':util[_0xa55c('0xd')](_0xa55c('0xe'),_0x52a3bc[_0xa55c('0xf')])})[_0xa55c('0x10')](function(_0x70c2de){if(_0x70c2de[_0xa55c('0x11')]){return _[_0xa55c('0x12')](_0x70c2de['_embedded']['entries'],{'email':_0x5849ad});}})[_0xa55c('0x10')](function(_0x576044){if(_0x576044){logger['info']('Agent\x20found!');return _0x576044;}else{logger[_0xa55c('0xb')](_0xa55c('0x13'));return request({'uri':util[_0xa55c('0xd')](_0xa55c('0x14'),_0x52a3bc[_0xa55c('0xf')])});}});}else{logger[_0xa55c('0xb')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xa55c('0xd')](_0xa55c('0x14'),_0x52a3bc[_0xa55c('0xf')])});}}function request(_0x31e10d){logger[_0xa55c('0x15')](_0xa55c('0x16'),JSON[_0xa55c('0x17')](_0x31e10d));return rp(_[_0xa55c('0x6')](_0x31e10d,{'method':_0xa55c('0x18'),'headers':headers,'json':!![]}));}function getAuth(_0x4cee3c){var _0x3d4c9e;if(_0x4cee3c[_0xa55c('0x19')]===_0xa55c('0x1a')){_0x3d4c9e=util[_0xa55c('0xd')](_0xa55c('0x1b'),_0x4cee3c[_0xa55c('0x1c')],_0x4cee3c['password']);}else if(_0x4cee3c['authType']===_0xa55c('0x1d')){_0x3d4c9e=util[_0xa55c('0xd')](_0xa55c('0x1e'),_0x4cee3c['username'],_0x4cee3c[_0xa55c('0x1d')]);}return util[_0xa55c('0xd')]('Basic\x20%s',new Buffer(_0x3d4c9e)[_0xa55c('0x1f')](_0xa55c('0x20')));}function getEndUser(_0x940f28,_0x1965f1,_0x234372){logger['info'](_0xa55c('0x21'),_0x234372);return request({'uri':util['format']('%s/customers/search',_0x940f28['remoteUri']),'qs':{'phone':_0x234372}})[_0xa55c('0x10')](function(_0x54b038){if(_0x54b038[_0xa55c('0x11')]){logger[_0xa55c('0xb')](_0xa55c('0x22'));return _0x54b038[_0xa55c('0x23')][_0xa55c('0x24')][0x0];}else{logger[_0xa55c('0xb')](_0xa55c('0x25'));return request({'uri':util[_0xa55c('0xd')](_0xa55c('0x26'),_0x940f28[_0xa55c('0xf')]),'method':_0xa55c('0x27'),'body':{'first_name':_0x1965f1,'title':_0x1965f1,'phone_numbers':[{'type':'work','value':_0x234372}]}});}});}function getTags(_0x430d55,_0x28814f){var _0x1c9f6b=[];if(_0x430d55&&_0x430d55[_0xa55c('0x28')]>0x0){_0x1c9f6b=_['map'](_0x430d55,_0x28814f);}return _0x1c9f6b;}function getCustomFields(_0x1377b0,_0x22f6b6){var _0x1b8388=[];var _0x201941={'custom_fields':{}};if(_0x1377b0[_0xa55c('0x28')]>0x0){_[_0xa55c('0x29')](_0x1377b0,function(_0x52d37f){if(_[_0xa55c('0x2a')](['string',_0xa55c('0x2b')],_0x52d37f[_0xa55c('0x2c')])&&_0x52d37f[_0xa55c('0x2d')]&&!_0x52d37f[_0xa55c('0x2e')]){_0x201941[_0x52d37f['nameField'][_0xa55c('0x2f')]()]=_0x52d37f[_0xa55c('0x30')][_0xa55c('0x1f')]();}else if(_[_0xa55c('0x2a')]([_0xa55c('0x31'),_0xa55c('0x2b')],_0x52d37f[_0xa55c('0x2c')])&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x201941[_0xa55c('0x33')][_0x52d37f[_0xa55c('0x32')]]=_0x52d37f['content']['toString']();}else if(_0x52d37f[_0xa55c('0x2c')]===_0xa55c('0x34')&&_0x52d37f['variableName']&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x22f6b6[_0x52d37f[_0xa55c('0x35')]]&&(_0x201941[_0xa55c('0x33')][_0x52d37f[_0xa55c('0x32')]]=_0x22f6b6[_0x52d37f[_0xa55c('0x35')]][_0xa55c('0x1f')]());}else if(_0x52d37f[_0xa55c('0x2c')]===_0xa55c('0x36')&&_0x52d37f['Variable']&&_0x52d37f['Variable']['name']&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x22f6b6[_0x52d37f[_0xa55c('0x37')]['name'][_0xa55c('0x2f')]()]&&(_0x201941['custom_fields'][_0x52d37f[_0xa55c('0x32')]]=_0x22f6b6[_0x52d37f['Variable'][_0xa55c('0x38')][_0xa55c('0x2f')]()][_0xa55c('0x1f')]());}});}if(_0x201941['priority']){_0x201941[_0xa55c('0x39')]=Number(_0x201941[_0xa55c('0x39')]);}return _0x201941;}function getTicket(_0x47e93c,_0x6f9c4c,_0x194e78,_0x4d9083,_0x529ff8){logger[_0xa55c('0xb')]('Creating\x20new\x20ticket...');var _0x1e75dc=_[_0xa55c('0x3a')]({'subject':intUtil['getString'](_0x4d9083['Subjects'],_0x529ff8,'\x20'),'type':'phone','status':'new','labels':[_0xa55c('0x3b'),_0xa55c('0x3c'),_0xa55c('0x3d')][_0xa55c('0x3e')](getTags(_0x4d9083[_0xa55c('0x3f')],'name')),'description':intUtil[_0xa55c('0x40')](_0x4d9083[_0xa55c('0x41')],_0x529ff8,'\x0a'),'_links':{'assigned_user':{'href':util[_0xa55c('0xd')](_0xa55c('0x42'),_0x6f9c4c['id']),'class':_0xa55c('0x43')}},'message':{'direction':'in','body':intUtil[_0xa55c('0x40')](_0x4d9083['Descriptions'],_0x529ff8,'\x0a')}},getCustomFields(_0x4d9083[_0xa55c('0x44')],_0x529ff8));return request({'uri':util['format']('%s/customers/%d/cases',_0x47e93c[_0xa55c('0xf')],_0x194e78['id']),'method':_0xa55c('0x27'),'body':_0x1e75dc});}exports['queue']=function(_0x2bd98b,_0x508bd3,_0x5f25f7,_0x2f8449,_0x3fea03,_0x1630ac){var _0x540337,_0x1b2708;_0x1630ac[_0xa55c('0xf')]=intUtil['stripTrailingSlash'](_0x1630ac[_0xa55c('0xf')]);_0x1630ac['serverUrl']=intUtil[_0xa55c('0x45')](_0x1630ac[_0xa55c('0x46')]);if(_0x3fea03&&_0x3fea03['monitor_format']){logger[_0xa55c('0xb')](_0xa55c('0x47'),'Recording\x20is\x20enabled!');_0x508bd3[_0xa55c('0x48')]=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x1630ac['serverUrl'],_0x508bd3[_0xa55c('0x4a')],md5(_0x508bd3['uniqueid']));}else{_0x508bd3[_0xa55c('0x48')]='';}headers[_0xa55c('0x4b')]=getAuth(_0x1630ac);return getUser(_0x1630ac,_0x2f8449[_0xa55c('0x4c')])['then'](function(_0x41eab1){_0x540337=_0x41eab1;logger[_0xa55c('0xb')]('The\x20User\x20ID\x20is:',_0x540337['id']);return getEndUser(_0x1630ac,_0x508bd3[_0xa55c('0x4d')],_0x508bd3[_0xa55c('0x4e')]);})['then'](function(_0x11ff1d){_0x1b2708=_0x11ff1d;logger[_0xa55c('0xb')]('The\x20Enduser\x20ID\x20is:',_0x1b2708['id']);return getTicket(_0x1630ac,_0x540337,_0x1b2708,_0x5f25f7,_0x508bd3);})[_0xa55c('0x10')](function(_0x81cee8){if(_0x81cee8){logger[_0xa55c('0xb')](_0xa55c('0x4f'));logger['info'](_0xa55c('0x50'),_0x81cee8['id']);switch(_0x1630ac['type']){case _0xa55c('0x51'):logger[_0xa55c('0xb')](_0xa55c('0x47'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2f8449['name']),_0xa55c('0x53'),{'recordId':_0x81cee8['id']});break;case _0xa55c('0x54'):logger[_0xa55c('0xb')](_0xa55c('0x47'),_0xa55c('0x55'));emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2f8449[_0xa55c('0x38')]),_0xa55c('0x56'),{'uri':util[_0xa55c('0xd')]('https://xcally.desk.com/web/agent/case/%d',_0x81cee8['id'])});break;default:logger[_0xa55c('0x57')](_0xa55c('0x47'),_0xa55c('0x58'));}}})['catch'](function(_0x4c3095){console[_0xa55c('0x57')](_0x4c3095);logger['error'](_0xa55c('0x47'),JSON['stringify'](_0x4c3095));});};exports[_0xa55c('0x59')]=function(_0x228df4,_0x181802,_0x3f9313,_0x2ecf79,_0x5b1cf3,_0x44b7c1,_0x4607ca){var _0x4b85cc,_0x3929a6;_0x44b7c1[_0xa55c('0xf')]=intUtil[_0xa55c('0x45')](_0x44b7c1[_0xa55c('0xf')]);_0x44b7c1['serverUrl']=intUtil['stripTrailingSlash'](_0x44b7c1[_0xa55c('0x46')]);if(_0x4607ca&&_0x4607ca[_0xa55c('0x5a')]&&_0x4607ca[_0xa55c('0x5a')]!==_0xa55c('0x5b')){logger['info'](_0xa55c('0x5c'),'Recording\x20is\x20enabled!');_0x181802[_0xa55c('0x48')]=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x44b7c1[_0xa55c('0x46')],_0x181802[_0xa55c('0x4a')],md5(_0x181802['uniqueid']));}headers[_0xa55c('0x4b')]=getAuth(_0x44b7c1);return getUser(_0x44b7c1,_0x2ecf79['email'])[_0xa55c('0x10')](function(_0x157afe){_0x4b85cc=_0x157afe;logger[_0xa55c('0xb')](_0xa55c('0x5d'),_0x4b85cc['id']);return getEndUser(_0x44b7c1,_0x181802[_0xa55c('0x5e')],_0x181802[_0xa55c('0x5f')]);})[_0xa55c('0x10')](function(_0x53e2be){_0x3929a6=_0x53e2be;logger[_0xa55c('0xb')](_0xa55c('0x60'),_0x3929a6['id']);return getTicket(_0x44b7c1,_0x4b85cc,_0x3929a6,_0x3f9313,_0x181802);})[_0xa55c('0x10')](function(_0x23a30e){if(_0x23a30e){logger[_0xa55c('0xb')]('Ticket\x20created!');logger[_0xa55c('0xb')](_0xa55c('0x50'),_0x23a30e['id']);switch(_0x44b7c1[_0xa55c('0x2c')]){case _0xa55c('0x51'):logger[_0xa55c('0xb')]('[QUEUE]',_0xa55c('0x61'));emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2ecf79[_0xa55c('0x38')]),_0xa55c('0x53'),{'recordId':_0x23a30e['id']});break;case'newTab':logger[_0xa55c('0xb')]('[QUEUE]',_0xa55c('0x55'));emit(util['format'](_0xa55c('0x52'),_0x2ecf79['name']),_0xa55c('0x56'),{'uri':util[_0xa55c('0xd')](_0xa55c('0x62'),_0x44b7c1[_0xa55c('0xf')],_0x23a30e['id'])});break;default:logger[_0xa55c('0x57')](_0xa55c('0x5c'),_0xa55c('0x58'));}}})[_0xa55c('0x63')](function(_0x14b515){logger[_0xa55c('0x57')]('[OUTBOUND]',JSON[_0xa55c('0x17')](_0x14b515));});};exports[_0xa55c('0x64')]=function(_0x4ef914,_0x18b928,_0x2b8b88,_0x3e3b4b,_0x9fe234,_0x1b8b06){var _0xa38271,_0x3cef1f;_0x1b8b06[_0xa55c('0xf')]=intUtil['stripTrailingSlash'](_0x1b8b06[_0xa55c('0xf')]);_0x1b8b06[_0xa55c('0x46')]=intUtil[_0xa55c('0x45')](_0x1b8b06[_0xa55c('0x46')]);if(_0x9fe234&&_0x9fe234[_0xa55c('0x65')]){logger[_0xa55c('0xb')]('['+_0x18b928[_0xa55c('0x66')][_0xa55c('0x67')]()+']',_0xa55c('0x68'));_0x18b928['recordingURL']=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x1b8b06[_0xa55c('0x46')],_0x18b928[_0xa55c('0x4a')],md5(_0x18b928[_0xa55c('0x4a')]));}else{_0x18b928[_0xa55c('0x48')]='';}headers[_0xa55c('0x4b')]=getAuth(_0x1b8b06);return getUser(_0x1b8b06)[_0xa55c('0x10')](function(_0x2e4cf7){_0xa38271=_0x2e4cf7;logger[_0xa55c('0xb')](_0xa55c('0x5d'),_0xa38271['id']);return getEndUser(_0x1b8b06,_0x18b928['calleridname'],_0x18b928[_0xa55c('0x4e')]);})['then'](function(_0x1228a4){_0x3cef1f=_0x1228a4;logger[_0xa55c('0xb')](_0xa55c('0x60'),_0x3cef1f['id']);return getTicket(_0x1b8b06,_0xa38271,_0x3cef1f,_0x2b8b88,_0x18b928);})['then'](function(_0x4d9722){if(_0x4d9722){logger[_0xa55c('0xb')](_0xa55c('0x4f'));logger[_0xa55c('0xb')](_0xa55c('0x50'),_0x4d9722['id']);}})['catch'](function(_0x149cb9){logger[_0xa55c('0x57')]('['+_0x18b928[_0xa55c('0x66')][_0xa55c('0x67')]()+']',JSON[_0xa55c('0x17')](_0x149cb9));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index 6a1af50..39d356e 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 _0xf97b=['nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','length','forEach','string','picklist','nameField','idField','substring','indexOf','ticketType','incident','incidents','assign','getString','Descriptions','/systemusers(','phonecall','queue','callDirection','phonecalls','Subjects','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','recordingURL',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','ticketId',']\x20Call\x20direction:\x20%s','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','lodash','util','./util','md5','ioredis','../../../../config/logger','dynamics365','redis','defaults','localhost','modernAuthentication','CloudProvider','data7','tenantId','data2','data5','POST','remoteUri','password','clientSecret','then','access_token','catch','error',']\x20Wrong\x20credentials!','message','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','value','isNil','validateEmail','email','userEmail','info','toUpperCase',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','username','internalemailaddress','userId','toLowerCase','outbound','destcalleridnum','4.0','body','headers','odata-entityid','lastIndexOf','calleridnum','telephone1','GET','contacts?$select=','\x20eq\x20\x27','replace','%2b','enduserId','contactid'];(function(_0x346159,_0x3c5ee9){var _0x274bc9=function(_0x483ef8){while(--_0x483ef8){_0x346159['push'](_0x346159['shift']());}};_0x274bc9(++_0x3c5ee9);}(_0xf97b,0x174));var _0xbf97=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xf97b[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0xbf97('0x0'));var rp=require('request-promise');var util=require(_0xbf97('0x1'));var intUtil=require(_0xbf97('0x2'));var md5=require(_0xbf97('0x3'));var Redis=require(_0xbf97('0x4'));var logger=require(_0xbf97('0x5'))(_0xbf97('0x6'));var config=require('../../../../config/environment');config[_0xbf97('0x7')]=_[_0xbf97('0x8')](config[_0xbf97('0x7')],{'host':_0xbf97('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xbf97('0x7')]));function getAuthToken(_0x2115f2,_0x46550e,_0x274d15){if(_0x2115f2[_0xbf97('0xa')]){_0x2115f2['remoteUri']=_0x2115f2[_0xbf97('0xb')][_0xbf97('0xc')];_0x2115f2[_0xbf97('0xd')]=_0x2115f2[_0xbf97('0xb')][_0xbf97('0xe')];return Promise['resolve'](_0x2115f2[_0xbf97('0xb')][_0xbf97('0xf')]);}var _0x15f87d={'method':_0xbf97('0x10'),'uri':_0x46550e,'form':{'client_id':_0x2115f2['clientId'],'resource':_0x2115f2[_0xbf97('0x11')],'username':_0x2115f2['username'],'password':_0x2115f2[_0xbf97('0x12')],'grant_type':_0xbf97('0x12'),'client_secret':_0x2115f2[_0xbf97('0x13')]},'json':!![]};return rp(_0x15f87d)[_0xbf97('0x14')](function(_0x5c9e70){return _0x5c9e70[_0xbf97('0x15')];})[_0xbf97('0x16')](function(_0x28ac31){logger[_0xbf97('0x17')]('['+[_0x274d15['toUpperCase']()]+_0xbf97('0x18'));return _0x28ac31[_0xbf97('0x19')];});}function getUser(_0x4830b4,_0x52267e,_0x591d1c,_0x336a36,_0x4b18d7,_0x2d9583){return new Promise(function(_0x5ebfb6,_0x3381f3){return getAuthToken(_0x52267e,_0x336a36,_0x2d9583)[_0xbf97('0x14')](function(_0x20ee06){var _0x47eb87={'method':'GET','uri':_0x4b18d7+_0xbf97('0x1a'),'headers':{'Authorization':_0xbf97('0x1b')+_0x20ee06,'OData-Version':'4.0'},'json':!![]};return rp(_0x47eb87);})[_0xbf97('0x14')](function(_0xa177f){var _0x328bbc=_0xa177f[_0xbf97('0x1c')];var _0x22751a=![];var _0x27e0b3=null;if(!_[_0xbf97('0x1d')](_0x591d1c)){if(intUtil[_0xbf97('0x1e')](_0x591d1c[_0xbf97('0x1f')])){_0x4830b4[_0xbf97('0x20')]=_0x591d1c['email'];for(_0x27e0b3=0x0;_0x27e0b3<_0x328bbc['length'];_0x27e0b3++){if(_0x328bbc[_0x27e0b3]['internalemailaddress']===_0x591d1c['email']&&!_0x328bbc[_0x27e0b3]['isdisabled']){_0x22751a=!![];logger[_0xbf97('0x21')]('['+[_0x2d9583[_0xbf97('0x22')]()]+']\x20Agent\x20found\x20'+_0x328bbc[_0x27e0b3]['systemuserid']+'!');_0x4830b4['userId']=_0x328bbc[_0x27e0b3]['systemuserid'];}}}}if(!_0x22751a){logger['info']('['+[_0x2d9583[_0xbf97('0x22')]()]+_0xbf97('0x23'));_0x4830b4[_0xbf97('0x20')]=_0x52267e[_0xbf97('0x24')];for(_0x27e0b3=0x0;_0x27e0b3<_0x328bbc['length'];_0x27e0b3++){if(_0x328bbc[_0x27e0b3][_0xbf97('0x25')]===_0x52267e['username']){_0x4830b4[_0xbf97('0x26')]=_0x328bbc[_0x27e0b3]['systemuserid'];}}}_0x5ebfb6(_0x4830b4);})[_0xbf97('0x16')](function(_0x22821a){_0x3381f3(_0x22821a[_0xbf97('0x19')]);});});}function createEndUser(_0x3ad673,_0x2f5f83,_0x22c73f,_0x2f4cfd,_0xa99a74,_0x4a1fba,_0x2f54b2){return new Promise(function(_0x44528b,_0x39d6eb){return getAuthToken(_0x2f5f83,_0x22c73f,_0x4a1fba)[_0xbf97('0x14')](function(_0x1dea77){var _0x67ee87=_0x4a1fba[_0xbf97('0x27')]()===_0xbf97('0x28')?_0xa99a74[_0xbf97('0x29')]:_0xa99a74['calleridnum'];var _0x5c2c97={'method':'POST','uri':_0x2f4cfd+'contacts','body':{'fullname':_0x67ee87,'firstname':_0x67ee87,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x3ad673[_0xbf97('0x26')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x1dea77,'OData-Version':_0xbf97('0x2a')},'json':!![],'resolveWithFullResponse':!![]};_0x5c2c97[_0xbf97('0x2b')][_0x2f54b2]=_0x67ee87;return rp(_0x5c2c97);})[_0xbf97('0x14')](function(_0x4063eb){var _0x1aab0e=_0x4063eb[_0xbf97('0x2c')][_0xbf97('0x2d')];var _0xe4cc60=_0x1aab0e['substring'](_0x1aab0e['lastIndexOf']('(')+0x1,_0x1aab0e[_0xbf97('0x2e')](')'));_0x3ad673['enduserId']=_0xe4cc60;_0x44528b(_0x3ad673);})[_0xbf97('0x16')](function(_0x51d6e8){_0x39d6eb(_0x51d6e8['message']);});});}function getEndUser(_0x106f30,_0x3722a4,_0x255ff5,_0x291f72,_0xe46582,_0x3f9d80,_0x52cef3,_0x170213){var _0x4a0e0b=_0x3f9d80[_0xbf97('0x27')]()===_0xbf97('0x28')?_0xe46582[_0xbf97('0x29')]:_0xe46582[_0xbf97('0x2f')];return getAuthToken(_0x3722a4,_0x255ff5,_0x3f9d80)['then'](function(_0x2ae42f){_0x170213=_0x170213?_0x170213:_0xbf97('0x30');var _0x881a04={'method':_0xbf97('0x31'),'uri':_0x291f72+_0xbf97('0x32')+_0x170213+'&$filter='+_0x170213+_0xbf97('0x33')+_0x4a0e0b[_0xbf97('0x34')]('+',_0xbf97('0x35'))+'\x27','headers':{'Authorization':'Bearer\x20'+_0x2ae42f,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x881a04);})[_0xbf97('0x14')](function(_0x59dcbd){var _0x567d43=![];if(!_0x59dcbd)return _0x567d43;var _0x2b7adc=_0x59dcbd['value'];for(var _0x1c8edb=0x0;_0x1c8edb<_0x2b7adc['length'];_0x1c8edb++){if(_0x2b7adc[_0x1c8edb][_0x170213]===_0x4a0e0b){_0x567d43=!![];_0x106f30[_0xbf97('0x36')]=_0x2b7adc[_0x1c8edb][_0xbf97('0x37')];}}return _0x567d43;})[_0xbf97('0x14')](function(_0x3c727e){if(_0x3c727e)return _0x106f30;if(_0x52cef3===_0xbf97('0x38')){logger['info']('['+[_0x3f9d80['toUpperCase']()]+_0xbf97('0x39'));return _0x106f30;}return createEndUser(_0x106f30,_0x3722a4,_0x255ff5,_0x291f72,_0xe46582,_0x3f9d80,_0x170213)['then'](function(_0x510116){logger[_0xbf97('0x21')]('['+[_0x3f9d80[_0xbf97('0x22')]()]+_0xbf97('0x3a'),_0x510116[_0xbf97('0x36')]);return _0x510116;});});}function getCustomFields(_0x5a9b6d,_0x15289a,_0x35ac87){var _0x31f190={};if(_0x5a9b6d[_0xbf97('0x3b')]>0x0){_[_0xbf97('0x3c')](_0x5a9b6d,function(_0x17e8b5){if(_['includes']([_0xbf97('0x3d'),_0xbf97('0x3e')],_0x17e8b5['type'])&&_0x17e8b5[_0xbf97('0x3f')]&&!_0x17e8b5['customField']){var _0x587823=_0x17e8b5[_0xbf97('0x40')][_0xbf97('0x27')]();var _0x108b17=_0x587823[_0xbf97('0x41')](0x0,_0x587823[_0xbf97('0x42')]('_'));var _0xd655c7=_0x587823[_0xbf97('0x41')](_0x587823['indexOf']('_')+0x1);if(_0x108b17===_0x35ac87){_0x31f190[_0xd655c7]=_0x17e8b5['content'];}}});}return _0x31f190;}function getTicket(_0x3ad2e9,_0x5ed61b,_0x39b27b,_0x14aa75,_0x3ff926,_0x5bd432,_0x5db6cb){return new Promise(function(_0x4d4c53,_0x50ad7a){var _0x724462;return getAuthToken(_0x5ed61b,_0x39b27b,_0x5db6cb)['then'](function(_0x34ce7d){if(_0x5bd432[_0xbf97('0x43')]===_0xbf97('0x44')){_0x724462={'method':_0xbf97('0x10'),'uri':_0x14aa75+_0xbf97('0x45'),'body':Object[_0xbf97('0x46')]({},{'title':intUtil['getString'](_0x5bd432['Subjects'],_0x3ff926,'\x20'),'description':intUtil[_0xbf97('0x47')](_0x5bd432[_0xbf97('0x48')],_0x3ff926,'\x0a'),'customerid_contact@odata.bind':_0x3ad2e9[_0xbf97('0x36')]?'/contacts('+_0x3ad2e9[_0xbf97('0x36')]+')':undefined,'ownerid@odata.bind':_0xbf97('0x49')+_0x3ad2e9['userId']+')','caseorigincode':'1'},getCustomFields(_0x5bd432['Fields'],_0x3ff926,_0x5bd432['ticketType'])),'headers':{'Authorization':_0xbf97('0x1b')+_0x34ce7d,'OData-Version':_0xbf97('0x2a')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x5bd432['ticketType']===_0xbf97('0x4a')){var _0x44a5fe=_0x3ad2e9[_0xbf97('0x36')]?[{'partyid_systemuser@odata.bind':_0xbf97('0x49')+_0x3ad2e9[_0xbf97('0x26')]+')','participationtypemask':_0x3ad2e9['callDirection']===_0xbf97('0x4b')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x3ad2e9[_0xbf97('0x36')]+')','participationtypemask':_0x3ad2e9[_0xbf97('0x4c')]===_0xbf97('0x4b')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0xbf97('0x49')+_0x3ad2e9['userId']+')','participationtypemask':_0x3ad2e9[_0xbf97('0x4c')]===_0xbf97('0x4b')?0x2:0x1}];_0x724462={'method':_0xbf97('0x10'),'uri':_0x14aa75+_0xbf97('0x4d'),'body':Object['assign']({},{'subject':intUtil[_0xbf97('0x47')](_0x5bd432[_0xbf97('0x4e')],_0x3ff926,'\x20'),'phonenumber':String(_0x3ff926[_0xbf97('0x2f')]),'description':intUtil[_0xbf97('0x47')](_0x5bd432['Descriptions'],_0x3ff926,'\x0a'),'regardingobjectid_contact@odata.bind':_0x3ad2e9[_0xbf97('0x36')]?'/contacts('+_0x3ad2e9[_0xbf97('0x36')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x3ad2e9[_0xbf97('0x26')]+')','directioncode':_0x3ad2e9[_0xbf97('0x4c')]===_0xbf97('0x4b')?![]:!![],'phonecall_activity_parties':_0x44a5fe},getCustomFields(_0x5bd432['Fields'],_0x3ff926,_0x5bd432[_0xbf97('0x43')])),'headers':{'Authorization':_0xbf97('0x1b')+_0x34ce7d,'OData-Version':_0xbf97('0x2a')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x724462);})[_0xbf97('0x14')](function(_0x7a541a){var _0x584735=_0x7a541a[_0xbf97('0x2c')][_0xbf97('0x2d')];var _0x1d2cef=_0x584735[_0xbf97('0x41')](_0x584735[_0xbf97('0x2e')]('(')+0x1,_0x584735[_0xbf97('0x2e')](')'));_0x3ad2e9['ticketId']=_0x1d2cef;_0x4d4c53(_0x3ad2e9);})['catch'](function(_0x139e8a){_0x50ad7a(_0x139e8a['message']);});});}function emit(_0x301668,_0x3efe37,_0x313e32,_0x2a5380){var _0x22fc29={'uri':util[_0xbf97('0x4f')](_0xbf97('0x50'),_0x301668,_0x313e32,_0x2a5380)};io['to'](util[_0xbf97('0x4f')](_0xbf97('0x51'),_0x3efe37))[_0xbf97('0x52')]('trigger:browser:url',_0x22fc29);}exports['cs']=function(_0x195707,_0x5c35ef,_0x86fa34,_0x547faf,_0x25ead5,_0x56f668,_0x3e1b83,_0x87735b){var _0x17177f={};_0x56f668[_0xbf97('0x11')]=_0x56f668[_0xbf97('0xa')]?intUtil[_0xbf97('0x53')](_0x56f668[_0xbf97('0xb')][_0xbf97('0xc')]):intUtil['stripTrailingSlash'](_0x56f668[_0xbf97('0x11')]);_0x56f668[_0xbf97('0x54')]=intUtil[_0xbf97('0x53')](_0x56f668[_0xbf97('0x54')]);_0x17177f[_0xbf97('0x4c')]=_0x87735b===_0xbf97('0x4b')||_0x87735b===_0xbf97('0x55')?_0xbf97('0x4b'):_0xbf97('0x28');var _0x1ac9d2=_0x56f668[_0xbf97('0xa')]?util['format'](_0xbf97('0x56'),_0x56f668[_0xbf97('0xb')][_0xbf97('0xc')]):util[_0xbf97('0x4f')](_0xbf97('0x56'),_0x56f668['remoteUri']);var _0x3f20ec=util[_0xbf97('0x4f')]('https://login.microsoftonline.com/%s/oauth2/token',_0x56f668[_0xbf97('0xd')]);var _0x472360=util[_0xbf97('0x4f')](_0xbf97('0x57'),_0x56f668[_0xbf97('0x54')],_0x5c35ef[_0xbf97('0x58')],md5(_0x5c35ef[_0xbf97('0x58')]));if(_0x25ead5&&_0x25ead5[_0xbf97('0x59')]){logger['info'](_0xbf97('0x5a'),_0xbf97('0x5b'));_0x5c35ef['recordingURL']=_0x472360;}else if(_0x3e1b83&&_0x3e1b83[_0xbf97('0x5c')]&&_0x3e1b83[_0xbf97('0x5c')]!==_0xbf97('0x5d')){logger[_0xbf97('0x21')]('[OUTBOUND]',_0xbf97('0x5b'));_0x5c35ef[_0xbf97('0x5e')]=_0x472360;}else{_0x5c35ef[_0xbf97('0x5e')]='';}return getUser(_0x17177f,_0x56f668,_0x547faf,_0x3f20ec,_0x1ac9d2,_0x87735b)[_0xbf97('0x14')](function(_0x113770){logger[_0xbf97('0x21')]('['+_0x87735b['toUpperCase']()+_0xbf97('0x5f'),_0x113770['userId']);logger[_0xbf97('0x21')]('['+_0x87735b[_0xbf97('0x22')]()+_0xbf97('0x60'),_0x113770['userEmail']);return getEndUser(_0x113770,_0x56f668,_0x3f20ec,_0x1ac9d2,_0x5c35ef,_0x87735b,_0x86fa34[_0xbf97('0x61')],_0x86fa34[_0xbf97('0x62')]);})[_0xbf97('0x14')](function(_0x5aa78b){logger['info']('['+_0x87735b[_0xbf97('0x22')]()+_0xbf97('0x63'),_0x5aa78b[_0xbf97('0x36')]);logger[_0xbf97('0x21')]('['+_0x87735b[_0xbf97('0x22')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x5c35ef['calleridnum']);return getTicket(_0x5aa78b,_0x56f668,_0x3f20ec,_0x1ac9d2,_0x5c35ef,_0x86fa34,_0x87735b);})[_0xbf97('0x14')](function(_0x26a939){logger[_0xbf97('0x21')](util['format']('['+_0x87735b[_0xbf97('0x22')]()+_0xbf97('0x64'),_0x86fa34[_0xbf97('0x43')],_0x26a939[_0xbf97('0x65')]));logger[_0xbf97('0x21')](util['format']('['+_0x87735b[_0xbf97('0x22')]()+_0xbf97('0x66'),_0x87735b));if(_0x87735b!==_0xbf97('0x55')&&_0x86fa34[_0xbf97('0x67')]){logger[_0xbf97('0x21')]('['+_0x87735b['toUpperCase']()+']',_0xbf97('0x68'));emit(_0x56f668[_0xbf97('0x11')],_0x547faf[_0xbf97('0x69')],_0x86fa34[_0xbf97('0x43')],_0x26a939[_0xbf97('0x65')]);}})['catch'](function(_0x4f9349){logger['error']('['+_0x87735b[_0xbf97('0x22')]()+_0xbf97('0x6a'),_0x4f9349['message']);console[_0xbf97('0x17')]('Error\x20running\x20Dynamics365\x20integration',_0x4f9349);});}; \ No newline at end of file +var _0xdcd1=['username','outbound','destcalleridnum','/systemusers(','body','odata-entityid','lastIndexOf','toLowerCase','calleridnum','telephone1','&$filter=','\x20eq\x20\x27','replace','%2b','value','enduserId','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','includes','type','nameField','idField','substring','indexOf','content','ticketType','incidents','getString','Subjects','Descriptions','/contacts(','Fields','phonecall','queue','callDirection','phonecalls','assign','headers','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','trigger:browser:url','serverUrl','stripTrailingSlash','%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!','recordingFormat','none','recordingURL',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','unmanaged','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','lodash','request-promise','util','./util','md5','ioredis','../../../../config/logger','dynamics365','redis','localhost','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','data7','tenantId','data2','resolve','data5','POST','clientId','password','clientSecret','catch','error','toUpperCase','message','then','Bearer\x20','4.0','isNil','validateEmail','email','userEmail','length','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!'];(function(_0x405ec7,_0x250c61){var _0xcee8c6=function(_0x274725){while(--_0x274725){_0x405ec7['push'](_0x405ec7['shift']());}};_0xcee8c6(++_0x250c61);}(_0xdcd1,0x11d));var _0x1dcd=function(_0x364077,_0x23c4bb){_0x364077=_0x364077-0x0;var _0x5eed17=_0xdcd1[_0x364077];return _0x5eed17;};'use strict';var _=require(_0x1dcd('0x0'));var rp=require(_0x1dcd('0x1'));var util=require(_0x1dcd('0x2'));var intUtil=require(_0x1dcd('0x3'));var md5=require(_0x1dcd('0x4'));var Redis=require(_0x1dcd('0x5'));var logger=require(_0x1dcd('0x6'))(_0x1dcd('0x7'));var config=require('../../../../config/environment');config[_0x1dcd('0x8')]=_['defaults'](config['redis'],{'host':_0x1dcd('0x9'),'port':0x18eb});var io=require(_0x1dcd('0xa'))(new Redis(config[_0x1dcd('0x8')]));function getAuthToken(_0x20ebb9,_0x41e089,_0x268d12){if(_0x20ebb9[_0x1dcd('0xb')]){_0x20ebb9[_0x1dcd('0xc')]=_0x20ebb9[_0x1dcd('0xd')][_0x1dcd('0xe')];_0x20ebb9[_0x1dcd('0xf')]=_0x20ebb9['CloudProvider'][_0x1dcd('0x10')];return Promise[_0x1dcd('0x11')](_0x20ebb9['CloudProvider'][_0x1dcd('0x12')]);}var _0x527209={'method':_0x1dcd('0x13'),'uri':_0x41e089,'form':{'client_id':_0x20ebb9[_0x1dcd('0x14')],'resource':_0x20ebb9[_0x1dcd('0xc')],'username':_0x20ebb9['username'],'password':_0x20ebb9[_0x1dcd('0x15')],'grant_type':'password','client_secret':_0x20ebb9[_0x1dcd('0x16')]},'json':!![]};return rp(_0x527209)['then'](function(_0x171795){return _0x171795['access_token'];})[_0x1dcd('0x17')](function(_0x1c54ca){logger[_0x1dcd('0x18')]('['+[_0x268d12[_0x1dcd('0x19')]()]+']\x20Wrong\x20credentials!');return _0x1c54ca[_0x1dcd('0x1a')];});}function getUser(_0x29abda,_0x327e1f,_0x441b2c,_0x3c04ee,_0x904cc1,_0x325602){return new Promise(function(_0x286fb1,_0x5e4fd3){return getAuthToken(_0x327e1f,_0x3c04ee,_0x325602)[_0x1dcd('0x1b')](function(_0x19649c){var _0x1820b4={'method':'GET','uri':_0x904cc1+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':_0x1dcd('0x1c')+_0x19649c,'OData-Version':_0x1dcd('0x1d')},'json':!![]};return rp(_0x1820b4);})[_0x1dcd('0x1b')](function(_0x54675d){var _0x31c31b=_0x54675d['value'];var _0x3d7a39=![];var _0xc88122=null;if(!_[_0x1dcd('0x1e')](_0x441b2c)){if(intUtil[_0x1dcd('0x1f')](_0x441b2c[_0x1dcd('0x20')])){_0x29abda[_0x1dcd('0x21')]=_0x441b2c['email'];for(_0xc88122=0x0;_0xc88122<_0x31c31b[_0x1dcd('0x22')];_0xc88122++){if(_0x31c31b[_0xc88122][_0x1dcd('0x23')]===_0x441b2c[_0x1dcd('0x20')]&&!_0x31c31b[_0xc88122][_0x1dcd('0x24')]){_0x3d7a39=!![];logger[_0x1dcd('0x25')]('['+[_0x325602[_0x1dcd('0x19')]()]+_0x1dcd('0x26')+_0x31c31b[_0xc88122][_0x1dcd('0x27')]+'!');_0x29abda[_0x1dcd('0x28')]=_0x31c31b[_0xc88122][_0x1dcd('0x27')];}}}}if(!_0x3d7a39){logger[_0x1dcd('0x25')]('['+[_0x325602[_0x1dcd('0x19')]()]+_0x1dcd('0x29'));_0x29abda['userEmail']=_0x327e1f[_0x1dcd('0x2a')];for(_0xc88122=0x0;_0xc88122<_0x31c31b[_0x1dcd('0x22')];_0xc88122++){if(_0x31c31b[_0xc88122][_0x1dcd('0x23')]===_0x327e1f[_0x1dcd('0x2a')]){_0x29abda['userId']=_0x31c31b[_0xc88122][_0x1dcd('0x27')];}}}_0x286fb1(_0x29abda);})['catch'](function(_0xf0287c){_0x5e4fd3(_0xf0287c[_0x1dcd('0x1a')]);});});}function createEndUser(_0x910f87,_0x4ab547,_0x1340f0,_0x4e9dcc,_0x48cbe1,_0x48038b,_0x232a14){return new Promise(function(_0x29b745,_0x5981a2){return getAuthToken(_0x4ab547,_0x1340f0,_0x48038b)['then'](function(_0x57b367){var _0xc9476c=_0x48038b['toLowerCase']()===_0x1dcd('0x2b')?_0x48cbe1[_0x1dcd('0x2c')]:_0x48cbe1['calleridnum'];var _0x35d4ea={'method':'POST','uri':_0x4e9dcc+'contacts','body':{'fullname':_0xc9476c,'firstname':_0xc9476c,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x1dcd('0x2d')+_0x910f87[_0x1dcd('0x28')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x57b367,'OData-Version':_0x1dcd('0x1d')},'json':!![],'resolveWithFullResponse':!![]};_0x35d4ea[_0x1dcd('0x2e')][_0x232a14]=_0xc9476c;return rp(_0x35d4ea);})[_0x1dcd('0x1b')](function(_0x14a10d){var _0x5aeaba=_0x14a10d['headers'][_0x1dcd('0x2f')];var _0xbc4e94=_0x5aeaba['substring'](_0x5aeaba[_0x1dcd('0x30')]('(')+0x1,_0x5aeaba[_0x1dcd('0x30')](')'));_0x910f87['enduserId']=_0xbc4e94;_0x29b745(_0x910f87);})[_0x1dcd('0x17')](function(_0x4d7f1e){_0x5981a2(_0x4d7f1e[_0x1dcd('0x1a')]);});});}function getEndUser(_0x162ece,_0x236f02,_0xf4cc4c,_0x2bde11,_0x3cece0,_0x395487,_0x480275,_0x5112fc){var _0x49e8eb=_0x395487[_0x1dcd('0x31')]()===_0x1dcd('0x2b')?_0x3cece0[_0x1dcd('0x2c')]:_0x3cece0[_0x1dcd('0x32')];return getAuthToken(_0x236f02,_0xf4cc4c,_0x395487)[_0x1dcd('0x1b')](function(_0x10f3f6){_0x5112fc=_0x5112fc?_0x5112fc:_0x1dcd('0x33');var _0x399ced={'method':'GET','uri':_0x2bde11+'contacts?$select='+_0x5112fc+_0x1dcd('0x34')+_0x5112fc+_0x1dcd('0x35')+_0x49e8eb[_0x1dcd('0x36')]('+',_0x1dcd('0x37'))+'\x27','headers':{'Authorization':_0x1dcd('0x1c')+_0x10f3f6,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x399ced);})['then'](function(_0x30b422){var _0x56d5f7=![];if(!_0x30b422)return _0x56d5f7;var _0x14fd02=_0x30b422[_0x1dcd('0x38')];for(var _0x45df20=0x0;_0x45df20<_0x14fd02[_0x1dcd('0x22')];_0x45df20++){if(_0x14fd02[_0x45df20][_0x5112fc]===_0x49e8eb){_0x56d5f7=!![];_0x162ece[_0x1dcd('0x39')]=_0x14fd02[_0x45df20][_0x1dcd('0x3a')];}}return _0x56d5f7;})['then'](function(_0x145b16){if(_0x145b16)return _0x162ece;if(_0x480275===_0x1dcd('0x3b')){logger[_0x1dcd('0x25')]('['+[_0x395487[_0x1dcd('0x19')]()]+_0x1dcd('0x3c'));return _0x162ece;}return createEndUser(_0x162ece,_0x236f02,_0xf4cc4c,_0x2bde11,_0x3cece0,_0x395487,_0x5112fc)[_0x1dcd('0x1b')](function(_0x142646){logger[_0x1dcd('0x25')]('['+[_0x395487[_0x1dcd('0x19')]()]+_0x1dcd('0x3d'),_0x142646[_0x1dcd('0x39')]);return _0x142646;});});}function getCustomFields(_0x1eee15,_0x388d2f,_0x61940d){var _0x5cfb48={};if(_0x1eee15[_0x1dcd('0x22')]>0x0){_[_0x1dcd('0x3e')](_0x1eee15,function(_0x1fd619){if(_[_0x1dcd('0x3f')](['string','picklist'],_0x1fd619[_0x1dcd('0x40')])&&_0x1fd619[_0x1dcd('0x41')]&&!_0x1fd619['customField']){var _0x53f163=_0x1fd619[_0x1dcd('0x42')][_0x1dcd('0x31')]();var _0x1e08ba=_0x53f163[_0x1dcd('0x43')](0x0,_0x53f163[_0x1dcd('0x44')]('_'));var _0x55c728=_0x53f163[_0x1dcd('0x43')](_0x53f163[_0x1dcd('0x44')]('_')+0x1);if(_0x1e08ba===_0x61940d){_0x5cfb48[_0x55c728]=_0x1fd619[_0x1dcd('0x45')];}}});}return _0x5cfb48;}function getTicket(_0x18c55a,_0x160329,_0x1f50c1,_0x3cd0f8,_0x4b8387,_0x48f4fd,_0x147998){return new Promise(function(_0xb94821,_0x2cc199){var _0x2aa3b6;return getAuthToken(_0x160329,_0x1f50c1,_0x147998)['then'](function(_0x5d43ae){if(_0x48f4fd[_0x1dcd('0x46')]==='incident'){_0x2aa3b6={'method':_0x1dcd('0x13'),'uri':_0x3cd0f8+_0x1dcd('0x47'),'body':Object['assign']({},{'title':intUtil[_0x1dcd('0x48')](_0x48f4fd[_0x1dcd('0x49')],_0x4b8387,'\x20'),'description':intUtil[_0x1dcd('0x48')](_0x48f4fd[_0x1dcd('0x4a')],_0x4b8387,'\x0a'),'customerid_contact@odata.bind':_0x18c55a[_0x1dcd('0x39')]?_0x1dcd('0x4b')+_0x18c55a['enduserId']+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x18c55a[_0x1dcd('0x28')]+')','caseorigincode':'1'},getCustomFields(_0x48f4fd[_0x1dcd('0x4c')],_0x4b8387,_0x48f4fd[_0x1dcd('0x46')])),'headers':{'Authorization':_0x1dcd('0x1c')+_0x5d43ae,'OData-Version':_0x1dcd('0x1d')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x48f4fd[_0x1dcd('0x46')]===_0x1dcd('0x4d')){var _0x373a8a=_0x18c55a['enduserId']?[{'partyid_systemuser@odata.bind':_0x1dcd('0x2d')+_0x18c55a['userId']+')','participationtypemask':_0x18c55a['callDirection']===_0x1dcd('0x4e')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x18c55a[_0x1dcd('0x39')]+')','participationtypemask':_0x18c55a[_0x1dcd('0x4f')]==='queue'?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x1dcd('0x2d')+_0x18c55a[_0x1dcd('0x28')]+')','participationtypemask':_0x18c55a[_0x1dcd('0x4f')]===_0x1dcd('0x4e')?0x2:0x1}];_0x2aa3b6={'method':_0x1dcd('0x13'),'uri':_0x3cd0f8+_0x1dcd('0x50'),'body':Object[_0x1dcd('0x51')]({},{'subject':intUtil[_0x1dcd('0x48')](_0x48f4fd[_0x1dcd('0x49')],_0x4b8387,'\x20'),'phonenumber':String(_0x4b8387[_0x1dcd('0x32')]),'description':intUtil[_0x1dcd('0x48')](_0x48f4fd[_0x1dcd('0x4a')],_0x4b8387,'\x0a'),'regardingobjectid_contact@odata.bind':_0x18c55a[_0x1dcd('0x39')]?_0x1dcd('0x4b')+_0x18c55a[_0x1dcd('0x39')]+')':undefined,'ownerid@odata.bind':_0x1dcd('0x2d')+_0x18c55a[_0x1dcd('0x28')]+')','directioncode':_0x18c55a['callDirection']==='queue'?![]:!![],'phonecall_activity_parties':_0x373a8a},getCustomFields(_0x48f4fd[_0x1dcd('0x4c')],_0x4b8387,_0x48f4fd[_0x1dcd('0x46')])),'headers':{'Authorization':_0x1dcd('0x1c')+_0x5d43ae,'OData-Version':_0x1dcd('0x1d')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x2aa3b6);})['then'](function(_0x4d1a68){var _0x1c8337=_0x4d1a68[_0x1dcd('0x52')][_0x1dcd('0x2f')];var _0x197efd=_0x1c8337[_0x1dcd('0x43')](_0x1c8337[_0x1dcd('0x30')]('(')+0x1,_0x1c8337['lastIndexOf'](')'));_0x18c55a[_0x1dcd('0x53')]=_0x197efd;_0xb94821(_0x18c55a);})[_0x1dcd('0x17')](function(_0x553f8a){_0x2cc199(_0x553f8a[_0x1dcd('0x1a')]);});});}function emit(_0x376554,_0x30a70c,_0x3f0c8a,_0x174cf5){var _0x56f3a9={'uri':util[_0x1dcd('0x54')](_0x1dcd('0x55'),_0x376554,_0x3f0c8a,_0x174cf5)};io['to'](util[_0x1dcd('0x54')](_0x1dcd('0x56'),_0x30a70c))['emit'](_0x1dcd('0x57'),_0x56f3a9);}exports['cs']=function(_0x289483,_0x31a700,_0x4bcd43,_0x5ef15f,_0x11a119,_0x1da327,_0x8fde97,_0x33da28){var _0x39e4ea={};_0x1da327[_0x1dcd('0xc')]=_0x1da327['modernAuthentication']?intUtil['stripTrailingSlash'](_0x1da327['CloudProvider'][_0x1dcd('0xe')]):intUtil['stripTrailingSlash'](_0x1da327['remoteUri']);_0x1da327[_0x1dcd('0x58')]=intUtil[_0x1dcd('0x59')](_0x1da327[_0x1dcd('0x58')]);_0x39e4ea['callDirection']=_0x33da28==='queue'||_0x33da28==='unmanaged'?_0x1dcd('0x4e'):_0x1dcd('0x2b');var _0x3349dd=_0x1da327['modernAuthentication']?util[_0x1dcd('0x54')](_0x1dcd('0x5a'),_0x1da327[_0x1dcd('0xd')]['data7']):util['format'](_0x1dcd('0x5a'),_0x1da327[_0x1dcd('0xc')]);var _0x540982=util['format'](_0x1dcd('0x5b'),_0x1da327['tenantId']);var _0x473774=util[_0x1dcd('0x54')](_0x1dcd('0x5c'),_0x1da327['serverUrl'],_0x31a700['uniqueid'],md5(_0x31a700[_0x1dcd('0x5d')]));if(_0x11a119&&_0x11a119[_0x1dcd('0x5e')]){logger['info'](_0x1dcd('0x5f'),_0x1dcd('0x60'));_0x31a700['recordingURL']=_0x473774;}else if(_0x8fde97&&_0x8fde97[_0x1dcd('0x61')]&&_0x8fde97['recordingFormat']!==_0x1dcd('0x62')){logger[_0x1dcd('0x25')]('[OUTBOUND]',_0x1dcd('0x60'));_0x31a700[_0x1dcd('0x63')]=_0x473774;}else{_0x31a700[_0x1dcd('0x63')]='';}return getUser(_0x39e4ea,_0x1da327,_0x5ef15f,_0x540982,_0x3349dd,_0x33da28)[_0x1dcd('0x1b')](function(_0x1cf29f){logger[_0x1dcd('0x25')]('['+_0x33da28['toUpperCase']()+']\x20The\x20User\x20ID\x20is:',_0x1cf29f[_0x1dcd('0x28')]);logger['info']('['+_0x33da28[_0x1dcd('0x19')]()+_0x1dcd('0x64'),_0x1cf29f['userEmail']);return getEndUser(_0x1cf29f,_0x1da327,_0x540982,_0x3349dd,_0x31a700,_0x33da28,_0x4bcd43[_0x1dcd('0x65')],_0x4bcd43[_0x1dcd('0x66')]);})[_0x1dcd('0x1b')](function(_0xb55403){logger['info']('['+_0x33da28[_0x1dcd('0x19')]()+']\x20The\x20Enduser\x20ID\x20is:',_0xb55403[_0x1dcd('0x39')]);logger['info']('['+_0x33da28['toUpperCase']()+']\x20The\x20Enduser\x20phone\x20is:',_0x31a700[_0x1dcd('0x32')]);return getTicket(_0xb55403,_0x1da327,_0x540982,_0x3349dd,_0x31a700,_0x4bcd43,_0x33da28);})[_0x1dcd('0x1b')](function(_0x3ddf91){logger[_0x1dcd('0x25')](util['format']('['+_0x33da28[_0x1dcd('0x19')]()+_0x1dcd('0x67'),_0x4bcd43[_0x1dcd('0x46')],_0x3ddf91[_0x1dcd('0x53')]));logger[_0x1dcd('0x25')](util['format']('['+_0x33da28[_0x1dcd('0x19')]()+_0x1dcd('0x68'),_0x33da28));if(_0x33da28!==_0x1dcd('0x69')&&_0x4bcd43[_0x1dcd('0x6a')]){logger[_0x1dcd('0x25')]('['+_0x33da28['toUpperCase']()+']',_0x1dcd('0x6b'));emit(_0x1da327[_0x1dcd('0xc')],_0x5ef15f[_0x1dcd('0x6c')],_0x4bcd43['ticketType'],_0x3ddf91['ticketId']);}})['catch'](function(_0x2d8889){logger['error']('['+_0x33da28[_0x1dcd('0x19')]()+']\x20Error\x20running\x20Dynamics365\x20integration',_0x2d8889[_0x1dcd('0x1a')]);console[_0x1dcd('0x18')]('Error\x20running\x20Dynamics365\x20integration',_0x2d8889);});}; \ 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 a019155..8cd6dea 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 _0x1972=['includes','string','customField','content','type','custom_fields','push','idField','variable','variableName','customVariable','Variable','toLowerCase','serverUrl','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','outbound','recordingFormat','none','destcalleridname','destcalleridnum','[OUTBOUND]','%s/helpdesk/tickets/%d','unmanaged','monitor_format','lastevent','toUpperCase','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','socket.io-emitter','application/json','info','Creating\x20new\x20ticket...','merge','format','calleridname','calleridnum','getString','Subjects','Descriptions','Tags','name','Fields','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','toString','base64','[HTTP]','stringify','GET','map','forEach'];(function(_0x28efa9,_0x2ea57b){var _0x39add7=function(_0x4220fc){while(--_0x4220fc){_0x28efa9['push'](_0x28efa9['shift']());}};_0x39add7(++_0x2ea57b);}(_0x1972,0x187));var _0x2197=function(_0x426393,_0x12640e){_0x426393=_0x426393-0x0;var _0x47549b=_0x1972[_0x426393];return _0x47549b;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0x2197('0x0'));var util=require('util');var Redis=require(_0x2197('0x1'));var intUtil=require(_0x2197('0x2'));var config=require(_0x2197('0x3'));var logger=require(_0x2197('0x4'))(_0x2197('0x5'));config[_0x2197('0x6')]=_[_0x2197('0x7')](config[_0x2197('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x2197('0x8'))(new Redis(config[_0x2197('0x6')]));var headers={'Content-Type':'application/json','Accept':_0x2197('0x9')};function emit(_0x201c81,_0x10a0d2,_0x22fece){io['to'](_0x201c81)['emit'](_0x10a0d2,_0x22fece);}function getTicket(_0x2b3ad6,_0x567840,_0x13de3f,_0x3b2965,_0x36f00a){logger[_0x2197('0xa')](_0x2197('0xb'));var _0x3afc36=_[_0x2197('0xc')]({'responder_id':_0x567840['id'],'requester_id':_0x13de3f['id'],'name':util[_0x2197('0xd')]('Caller\x20-\x20%s',_0x36f00a[_0x2197('0xe')]),'phone':_0x36f00a[_0x2197('0xf')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x2197('0x10')](_0x3b2965[_0x2197('0x11')],_0x36f00a,'\x20'),'description':intUtil['getString'](_0x3b2965[_0x2197('0x12')],_0x36f00a,'
'),'tags':getTags(_0x3b2965[_0x2197('0x13')],_0x2197('0x14'))},getCustomFields(_0x3b2965[_0x2197('0x15')],_0x36f00a));_0x3afc36['custom_fields']=_['mapValues'](_['keyBy'](_0x3afc36['custom_fields'],'id'),'value');return request({'uri':util[_0x2197('0xd')](_0x2197('0x16'),_0x2b3ad6[_0x2197('0x17')]),'method':_0x2197('0x18'),'body':_0x3afc36})[_0x2197('0x19')](function(_0x2aab86){logger[_0x2197('0xa')](_0x2197('0x1a'));return _0x2aab86;});}function getUser(_0x518271,_0x239e20){if(intUtil[_0x2197('0x1b')](_0x239e20)){return request({'uri':util[_0x2197('0xd')](_0x2197('0x1c'),_0x518271[_0x2197('0x17')]),'qs':{'email':_0x239e20}})[_0x2197('0x19')](function(_0x143b94){if(_0x143b94[_0x2197('0x1d')]){logger['info'](_0x2197('0x1e'));return _[_0x2197('0x1f')](_0x143b94,function(_0x5ba1fa){return _0x5ba1fa[_0x2197('0x20')][_0x2197('0x21')]===_0x239e20;});}else{logger[_0x2197('0xa')](_0x2197('0x22'));return request({'uri':util['format'](_0x2197('0x23'),_0x518271[_0x2197('0x17')])})[_0x2197('0x19')](function(_0x3581c6){logger[_0x2197('0xa')](_0x2197('0x24'));return _0x3581c6;});}});}else{logger['info'](_0x2197('0x25'));return request({'uri':util[_0x2197('0xd')](_0x2197('0x23'),_0x518271[_0x2197('0x17')])})[_0x2197('0x19')](function(_0x48317c){logger['info']('Admin\x20account\x20selected.');return _0x48317c;});}}function getEndUser(_0x226c43,_0xc77b9f,_0x4c5c65){logger[_0x2197('0xa')]('Searching\x20enduser\x20with\x20phone',_0x4c5c65);return request({'uri':util['format'](_0x2197('0x26'),_0x226c43['remoteUri']),'qs':{'phone':_0x4c5c65}})[_0x2197('0x19')](function(_0x2ea13b){if(_0x2ea13b['length']){logger[_0x2197('0xa')](_0x2197('0x27'));return _['find'](_0x2ea13b,{'phone':_0x4c5c65});}else{logger[_0x2197('0xa')](_0x2197('0x28'));return request({'uri':util[_0x2197('0xd')](_0x2197('0x26'),_0x226c43[_0x2197('0x17')]),'method':_0x2197('0x18'),'body':{'name':_0xc77b9f,'phone':_0x4c5c65}})[_0x2197('0x19')](function(_0xc5262e){logger[_0x2197('0xa')](_0x2197('0x29'));return _0xc5262e;});}});}function getAuth(_0x1c7688){return util[_0x2197('0xd')]('Basic\x20%s',new Buffer(_0x1c7688['apiKey']+':X')[_0x2197('0x2a')](_0x2197('0x2b')));}function request(_0x35356a){logger['debug'](_0x2197('0x2c'),JSON[_0x2197('0x2d')](_0x35356a));return rp(_['defaults'](_0x35356a,{'method':_0x2197('0x2e'),'headers':headers,'json':!![]}));}function getTags(_0xa8fd69,_0x4f4b0b){var _0x587a54=[];if(_0xa8fd69&&_0xa8fd69['length']>0x0){_0x587a54=_[_0x2197('0x2f')](_0xa8fd69,_0x4f4b0b);}return _0x587a54;}function getCustomFields(_0x467a8e,_0x22eb87){var _0x850dbe=[];var _0x58531d={'custom_fields':[]};if(_0x467a8e['length']>0x0){_[_0x2197('0x30')](_0x467a8e,function(_0x504205){if(_[_0x2197('0x31')]([_0x2197('0x32'),'picklist'],_0x504205['type'])&&_0x504205['nameField']&&!_0x504205[_0x2197('0x33')]){_0x58531d[_0x504205['nameField']['toLowerCase']()]=_0x504205[_0x2197('0x34')][_0x2197('0x2a')]();}else if(_[_0x2197('0x31')](['string','picklist'],_0x504205[_0x2197('0x35')])&&_0x504205['idField']&&_0x504205[_0x2197('0x33')]){_0x58531d[_0x2197('0x36')][_0x2197('0x37')]({'id':_0x504205[_0x2197('0x38')],'value':_0x504205['content']['toString']()});}else if(_0x504205[_0x2197('0x35')]===_0x2197('0x39')&&_0x504205[_0x2197('0x3a')]&&_0x504205[_0x2197('0x38')]&&_0x504205['customField']){_0x22eb87[_0x504205[_0x2197('0x3a')]]&&_0x58531d['custom_fields'][_0x2197('0x37')]({'id':_0x504205[_0x2197('0x38')],'value':_0x22eb87[_0x504205[_0x2197('0x3a')]][_0x2197('0x2a')]()});}else if(_0x504205['type']===_0x2197('0x3b')&&_0x504205[_0x2197('0x3c')]&&_0x504205[_0x2197('0x3c')][_0x2197('0x14')]&&_0x504205[_0x2197('0x38')]&&_0x504205[_0x2197('0x33')]){_0x22eb87[_0x504205['Variable'][_0x2197('0x14')][_0x2197('0x3d')]()]&&_0x58531d[_0x2197('0x36')][_0x2197('0x37')]({'id':_0x504205[_0x2197('0x38')],'value':_0x22eb87[_0x504205[_0x2197('0x3c')][_0x2197('0x14')]['toLowerCase']()][_0x2197('0x2a')]()});}});}return _0x58531d;}exports['queue']=function(_0x57adef,_0x1423e9,_0x141cdf,_0x536dc0,_0x386ce6,_0x2d3ed1){var _0xa818ac,_0x242794;_0x2d3ed1[_0x2197('0x17')]=intUtil['stripTrailingSlash'](_0x2d3ed1[_0x2197('0x17')]);_0x2d3ed1[_0x2197('0x3e')]=intUtil[_0x2197('0x3f')](_0x2d3ed1[_0x2197('0x3e')]);if(_0x386ce6&&_0x386ce6['monitor_format']){logger[_0x2197('0xa')](_0x2197('0x40'),_0x2197('0x41'));_0x1423e9['recordingURL']=util[_0x2197('0xd')](_0x2197('0x42'),_0x2d3ed1[_0x2197('0x3e')],_0x1423e9[_0x2197('0x43')],md5(_0x1423e9['uniqueid']));}else{_0x1423e9[_0x2197('0x44')]='';}headers[_0x2197('0x45')]=getAuth(_0x2d3ed1);return getUser(_0x2d3ed1,_0x536dc0[_0x2197('0x21')])['then'](function(_0x37a023){_0xa818ac=_0x37a023;logger[_0x2197('0xa')](_0x2197('0x46'),_0xa818ac['id']);return getEndUser(_0x2d3ed1,_0x1423e9['calleridname'],_0x1423e9[_0x2197('0xf')]);})['then'](function(_0x1dec54){_0x242794=_0x1dec54;logger[_0x2197('0xa')](_0x2197('0x47'),_0x242794['id']);return getTicket(_0x2d3ed1,_0xa818ac,_0x242794,_0x141cdf,_0x1423e9);})[_0x2197('0x19')](function(_0x44cac7){if(_0x44cac7&&_0x44cac7['id']){logger[_0x2197('0xa')](_0x2197('0x1a'));logger[_0x2197('0xa')]('The\x20Ticket\x20ID\x20is:',_0x44cac7['id']);logger[_0x2197('0xa')]('[QUEUE]',_0x2197('0x48'));emit(util[_0x2197('0xd')](_0x2197('0x49'),_0x536dc0[_0x2197('0x14')]),_0x2197('0x4a'),{'uri':util[_0x2197('0xd')]('%s/helpdesk/tickets/%d',_0x2d3ed1[_0x2197('0x17')],_0x44cac7['id'])});}})[_0x2197('0x4b')](function(_0x36c3b3){logger[_0x2197('0x4c')](_0x2197('0x40'),JSON[_0x2197('0x2d')](_0x36c3b3));});};exports[_0x2197('0x4d')]=function(_0x4ce587,_0x41cee8,_0x49cdc0,_0x3941fb,_0x501288,_0x1b50e6,_0x3a5ff7){var _0x4fd9ba,_0x2569ba;_0x1b50e6[_0x2197('0x17')]=intUtil[_0x2197('0x3f')](_0x1b50e6[_0x2197('0x17')]);_0x1b50e6['serverUrl']=intUtil[_0x2197('0x3f')](_0x1b50e6['serverUrl']);if(_0x3a5ff7&&_0x3a5ff7[_0x2197('0x4e')]&&_0x3a5ff7['recordingFormat']!==_0x2197('0x4f')){logger[_0x2197('0xa')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x41cee8[_0x2197('0x44')]=util[_0x2197('0xd')](_0x2197('0x42'),_0x1b50e6[_0x2197('0x3e')],_0x41cee8[_0x2197('0x43')],md5(_0x41cee8[_0x2197('0x43')]));}headers[_0x2197('0x45')]=getAuth(_0x1b50e6);return getUser(_0x1b50e6,_0x3941fb[_0x2197('0x21')])['then'](function(_0x1a245f){_0x4fd9ba=_0x1a245f;logger[_0x2197('0xa')](_0x2197('0x46'),_0x4fd9ba['id']);return getEndUser(_0x1b50e6,_0x41cee8[_0x2197('0x50')],_0x41cee8[_0x2197('0x51')]);})[_0x2197('0x19')](function(_0x469b73){_0x2569ba=_0x469b73;logger['info'](_0x2197('0x47'),_0x2569ba['id']);return getTicket(_0x1b50e6,_0x4fd9ba,_0x2569ba,_0x49cdc0,_0x41cee8);})['then'](function(_0xb0753e){if(_0xb0753e&&_0xb0753e['id']){logger[_0x2197('0xa')](_0x2197('0x1a'));logger[_0x2197('0xa')]('The\x20Ticket\x20ID\x20is:',_0xb0753e['id']);logger[_0x2197('0xa')](_0x2197('0x52'),_0x2197('0x48'));emit(util[_0x2197('0xd')]('user:%s',_0x3941fb[_0x2197('0x14')]),_0x2197('0x4a'),{'uri':util['format'](_0x2197('0x53'),_0x1b50e6[_0x2197('0x17')],_0xb0753e['id'])});}})[_0x2197('0x4b')](function(_0x1dea2e){logger[_0x2197('0x4c')]('[OUTBOUND]',JSON[_0x2197('0x2d')](_0x1dea2e));});};exports[_0x2197('0x54')]=function(_0x356560,_0x5d0a9e,_0x3cf7d2,_0x582642,_0x42f234,_0x4f8a07){var _0x475ff5,_0xbe8bcd;_0x4f8a07[_0x2197('0x17')]=intUtil[_0x2197('0x3f')](_0x4f8a07[_0x2197('0x17')]);_0x4f8a07[_0x2197('0x3e')]=intUtil[_0x2197('0x3f')](_0x4f8a07[_0x2197('0x3e')]);if(_0x42f234&&_0x42f234[_0x2197('0x55')]){logger['info']('['+_0x5d0a9e[_0x2197('0x56')][_0x2197('0x57')]()+']',_0x2197('0x41'));_0x5d0a9e[_0x2197('0x44')]=util[_0x2197('0xd')](_0x2197('0x42'),_0x4f8a07[_0x2197('0x3e')],_0x5d0a9e['uniqueid'],md5(_0x5d0a9e[_0x2197('0x43')]));}else{_0x5d0a9e[_0x2197('0x44')]='';}headers[_0x2197('0x45')]=getAuth(_0x4f8a07);return getUser(_0x4f8a07,'')[_0x2197('0x19')](function(_0x2b27b7){_0x475ff5=_0x2b27b7;logger['info'](_0x2197('0x46'),_0x475ff5['id']);return getEndUser(_0x4f8a07,_0x5d0a9e[_0x2197('0xe')],_0x5d0a9e[_0x2197('0xf')]);})['then'](function(_0x1e03e5){_0xbe8bcd=_0x1e03e5;logger['info'](_0x2197('0x47'),_0xbe8bcd['id']);return getTicket(_0x4f8a07,_0x475ff5,_0xbe8bcd,_0x3cf7d2,_0x5d0a9e);})[_0x2197('0x19')](function(_0x78989){if(_0x78989){logger[_0x2197('0xa')](_0x2197('0x1a'));logger[_0x2197('0xa')]('The\x20Ticket\x20ID\x20is:',_0x78989['id']);}})[_0x2197('0x4b')](function(_0x292c12){logger[_0x2197('0x4c')]('['+_0x5d0a9e[_0x2197('0x56')][_0x2197('0x57')]()+']',JSON[_0x2197('0x2d')](_0x292c12));});}; \ No newline at end of file +var _0x439c=['unmanaged','toUpperCase','The\x20User\x20ID\x20is:','catch','lastevent','lodash','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','application/json','emit','info','merge','Caller\x20-\x20%s','calleridname','calleridnum','Subjects','getString','
','Tags','name','custom_fields','mapValues','keyBy','value','format','%s/api/v2/tickets','remoteUri','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','Agent\x20found!','contact','email','%s/api/v2/agents/me','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','length','Enduser\x20found!','find','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','Enduser\x20created.','Basic\x20%s','apiKey','toString','debug','[HTTP]','stringify','GET','map','string','nameField','customField','toLowerCase','includes','type','push','idField','variableName','customVariable','Variable','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','The\x20Enduser\x20ID\x20is:','user:%s','%s/helpdesk/tickets/%d','error','none','[OUTBOUND]','destcalleridnum','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...'];(function(_0x5ec569,_0x17c7bc){var _0x15091=function(_0xf1cc8e){while(--_0xf1cc8e){_0x5ec569['push'](_0x5ec569['shift']());}};_0x15091(++_0x17c7bc);}(_0x439c,0x110));var _0xc439=function(_0x13b7ab,_0x590916){_0x13b7ab=_0x13b7ab-0x0;var _0x152fe2=_0x439c[_0x13b7ab];return _0x152fe2;};'use strict';var _=require(_0xc439('0x0'));var rp=require(_0xc439('0x1'));var md5=require('md5');var util=require(_0xc439('0x2'));var Redis=require(_0xc439('0x3'));var intUtil=require(_0xc439('0x4'));var config=require(_0xc439('0x5'));var logger=require(_0xc439('0x6'))('freshdesk');config[_0xc439('0x7')]=_[_0xc439('0x8')](config[_0xc439('0x7')],{'host':_0xc439('0x9'),'port':0x18eb});var io=require(_0xc439('0xa'))(new Redis(config[_0xc439('0x7')]));var headers={'Content-Type':_0xc439('0xb'),'Accept':_0xc439('0xb')};function emit(_0x1d735c,_0x26b1a8,_0x219297){io['to'](_0x1d735c)[_0xc439('0xc')](_0x26b1a8,_0x219297);}function getTicket(_0x16df7e,_0x46a4b3,_0x529cca,_0x184db8,_0x4d9dcf){logger[_0xc439('0xd')]('Creating\x20new\x20ticket...');var _0x1350cb=_[_0xc439('0xe')]({'responder_id':_0x46a4b3['id'],'requester_id':_0x529cca['id'],'name':util['format'](_0xc439('0xf'),_0x4d9dcf[_0xc439('0x10')]),'phone':_0x4d9dcf[_0xc439('0x11')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x184db8[_0xc439('0x12')],_0x4d9dcf,'\x20'),'description':intUtil[_0xc439('0x13')](_0x184db8['Descriptions'],_0x4d9dcf,_0xc439('0x14')),'tags':getTags(_0x184db8[_0xc439('0x15')],_0xc439('0x16'))},getCustomFields(_0x184db8['Fields'],_0x4d9dcf));_0x1350cb[_0xc439('0x17')]=_[_0xc439('0x18')](_[_0xc439('0x19')](_0x1350cb[_0xc439('0x17')],'id'),_0xc439('0x1a'));return request({'uri':util[_0xc439('0x1b')](_0xc439('0x1c'),_0x16df7e[_0xc439('0x1d')]),'method':'POST','body':_0x1350cb})[_0xc439('0x1e')](function(_0x4a6fd2){logger[_0xc439('0xd')](_0xc439('0x1f'));return _0x4a6fd2;});}function getUser(_0x37d240,_0x4b51f1){if(intUtil[_0xc439('0x20')](_0x4b51f1)){return request({'uri':util[_0xc439('0x1b')](_0xc439('0x21'),_0x37d240[_0xc439('0x1d')]),'qs':{'email':_0x4b51f1}})['then'](function(_0x3fd93d){if(_0x3fd93d['length']){logger[_0xc439('0xd')](_0xc439('0x22'));return _['find'](_0x3fd93d,function(_0xcd81d9){return _0xcd81d9[_0xc439('0x23')][_0xc439('0x24')]===_0x4b51f1;});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xc439('0x1b')](_0xc439('0x25'),_0x37d240['remoteUri'])})['then'](function(_0x5a99c9){logger[_0xc439('0xd')](_0xc439('0x26'));return _0x5a99c9;});}});}else{logger[_0xc439('0xd')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xc439('0x1b')]('%s/api/v2/agents/me',_0x37d240[_0xc439('0x1d')])})[_0xc439('0x1e')](function(_0x381d42){logger[_0xc439('0xd')](_0xc439('0x26'));return _0x381d42;});}}function getEndUser(_0x188498,_0x44e819,_0x2dfd4d){logger[_0xc439('0xd')](_0xc439('0x27'),_0x2dfd4d);return request({'uri':util[_0xc439('0x1b')](_0xc439('0x28'),_0x188498[_0xc439('0x1d')]),'qs':{'phone':_0x2dfd4d}})[_0xc439('0x1e')](function(_0x582d8a){if(_0x582d8a[_0xc439('0x29')]){logger[_0xc439('0xd')](_0xc439('0x2a'));return _[_0xc439('0x2b')](_0x582d8a,{'phone':_0x2dfd4d});}else{logger[_0xc439('0xd')](_0xc439('0x2c'));return request({'uri':util[_0xc439('0x1b')]('%s/api/v2/contacts',_0x188498['remoteUri']),'method':_0xc439('0x2d'),'body':{'name':_0x44e819,'phone':_0x2dfd4d}})[_0xc439('0x1e')](function(_0x4336f1){logger[_0xc439('0xd')](_0xc439('0x2e'));return _0x4336f1;});}});}function getAuth(_0x361764){return util['format'](_0xc439('0x2f'),new Buffer(_0x361764[_0xc439('0x30')]+':X')[_0xc439('0x31')]('base64'));}function request(_0x196b12){logger[_0xc439('0x32')](_0xc439('0x33'),JSON[_0xc439('0x34')](_0x196b12));return rp(_[_0xc439('0x8')](_0x196b12,{'method':_0xc439('0x35'),'headers':headers,'json':!![]}));}function getTags(_0x384f28,_0x2a4612){var _0x3ce8ba=[];if(_0x384f28&&_0x384f28[_0xc439('0x29')]>0x0){_0x3ce8ba=_[_0xc439('0x36')](_0x384f28,_0x2a4612);}return _0x3ce8ba;}function getCustomFields(_0x31aa96,_0x30d2ea){var _0x5f1f5e=[];var _0x25509={'custom_fields':[]};if(_0x31aa96[_0xc439('0x29')]>0x0){_['forEach'](_0x31aa96,function(_0x171b98){if(_['includes']([_0xc439('0x37'),'picklist'],_0x171b98['type'])&&_0x171b98[_0xc439('0x38')]&&!_0x171b98[_0xc439('0x39')]){_0x25509[_0x171b98[_0xc439('0x38')][_0xc439('0x3a')]()]=_0x171b98['content'][_0xc439('0x31')]();}else if(_[_0xc439('0x3b')](['string','picklist'],_0x171b98[_0xc439('0x3c')])&&_0x171b98['idField']&&_0x171b98['customField']){_0x25509[_0xc439('0x17')][_0xc439('0x3d')]({'id':_0x171b98['idField'],'value':_0x171b98['content'][_0xc439('0x31')]()});}else if(_0x171b98[_0xc439('0x3c')]==='variable'&&_0x171b98['variableName']&&_0x171b98[_0xc439('0x3e')]&&_0x171b98[_0xc439('0x39')]){_0x30d2ea[_0x171b98['variableName']]&&_0x25509[_0xc439('0x17')][_0xc439('0x3d')]({'id':_0x171b98['idField'],'value':_0x30d2ea[_0x171b98[_0xc439('0x3f')]][_0xc439('0x31')]()});}else if(_0x171b98['type']===_0xc439('0x40')&&_0x171b98[_0xc439('0x41')]&&_0x171b98['Variable'][_0xc439('0x16')]&&_0x171b98[_0xc439('0x3e')]&&_0x171b98[_0xc439('0x39')]){_0x30d2ea[_0x171b98['Variable'][_0xc439('0x16')][_0xc439('0x3a')]()]&&_0x25509[_0xc439('0x17')]['push']({'id':_0x171b98[_0xc439('0x3e')],'value':_0x30d2ea[_0x171b98[_0xc439('0x41')][_0xc439('0x16')]['toLowerCase']()][_0xc439('0x31')]()});}});}return _0x25509;}exports['queue']=function(_0x4a5c67,_0x47e6ab,_0x1e7d83,_0x1fa347,_0x4e7ea2,_0x14feba){var _0x28d1be,_0x30fe48;_0x14feba['remoteUri']=intUtil[_0xc439('0x42')](_0x14feba['remoteUri']);_0x14feba[_0xc439('0x43')]=intUtil[_0xc439('0x42')](_0x14feba[_0xc439('0x43')]);if(_0x4e7ea2&&_0x4e7ea2[_0xc439('0x44')]){logger[_0xc439('0xd')](_0xc439('0x45'),_0xc439('0x46'));_0x47e6ab['recordingURL']=util[_0xc439('0x1b')](_0xc439('0x47'),_0x14feba[_0xc439('0x43')],_0x47e6ab[_0xc439('0x48')],md5(_0x47e6ab[_0xc439('0x48')]));}else{_0x47e6ab[_0xc439('0x49')]='';}headers[_0xc439('0x4a')]=getAuth(_0x14feba);return getUser(_0x14feba,_0x1fa347[_0xc439('0x24')])['then'](function(_0x422f16){_0x28d1be=_0x422f16;logger[_0xc439('0xd')]('The\x20User\x20ID\x20is:',_0x28d1be['id']);return getEndUser(_0x14feba,_0x47e6ab[_0xc439('0x10')],_0x47e6ab[_0xc439('0x11')]);})[_0xc439('0x1e')](function(_0x583b22){_0x30fe48=_0x583b22;logger[_0xc439('0xd')](_0xc439('0x4b'),_0x30fe48['id']);return getTicket(_0x14feba,_0x28d1be,_0x30fe48,_0x1e7d83,_0x47e6ab);})[_0xc439('0x1e')](function(_0x4f0eb4){if(_0x4f0eb4&&_0x4f0eb4['id']){logger[_0xc439('0xd')]('Ticket\x20created!');logger[_0xc439('0xd')]('The\x20Ticket\x20ID\x20is:',_0x4f0eb4['id']);logger[_0xc439('0xd')](_0xc439('0x45'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xc439('0x1b')](_0xc439('0x4c'),_0x1fa347[_0xc439('0x16')]),'trigger:browser:url',{'uri':util[_0xc439('0x1b')](_0xc439('0x4d'),_0x14feba[_0xc439('0x1d')],_0x4f0eb4['id'])});}})['catch'](function(_0x139d23){logger[_0xc439('0x4e')](_0xc439('0x45'),JSON[_0xc439('0x34')](_0x139d23));});};exports['outbound']=function(_0x27f655,_0x4bf663,_0x32c150,_0x177eaa,_0x414fd7,_0x2c2807,_0x23ea01){var _0x203996,_0x51dcb9;_0x2c2807['remoteUri']=intUtil[_0xc439('0x42')](_0x2c2807[_0xc439('0x1d')]);_0x2c2807[_0xc439('0x43')]=intUtil[_0xc439('0x42')](_0x2c2807[_0xc439('0x43')]);if(_0x23ea01&&_0x23ea01['recordingFormat']&&_0x23ea01['recordingFormat']!==_0xc439('0x4f')){logger[_0xc439('0xd')](_0xc439('0x50'),_0xc439('0x46'));_0x4bf663[_0xc439('0x49')]=util[_0xc439('0x1b')](_0xc439('0x47'),_0x2c2807[_0xc439('0x43')],_0x4bf663['uniqueid'],md5(_0x4bf663[_0xc439('0x48')]));}headers[_0xc439('0x4a')]=getAuth(_0x2c2807);return getUser(_0x2c2807,_0x177eaa[_0xc439('0x24')])[_0xc439('0x1e')](function(_0x4cf808){_0x203996=_0x4cf808;logger[_0xc439('0xd')]('The\x20User\x20ID\x20is:',_0x203996['id']);return getEndUser(_0x2c2807,_0x4bf663['destcalleridname'],_0x4bf663[_0xc439('0x51')]);})['then'](function(_0x2d83e7){_0x51dcb9=_0x2d83e7;logger[_0xc439('0xd')]('The\x20Enduser\x20ID\x20is:',_0x51dcb9['id']);return getTicket(_0x2c2807,_0x203996,_0x51dcb9,_0x32c150,_0x4bf663);})[_0xc439('0x1e')](function(_0x29bd12){if(_0x29bd12&&_0x29bd12['id']){logger[_0xc439('0xd')](_0xc439('0x1f'));logger[_0xc439('0xd')](_0xc439('0x52'),_0x29bd12['id']);logger[_0xc439('0xd')](_0xc439('0x50'),_0xc439('0x53'));emit(util['format'](_0xc439('0x4c'),_0x177eaa[_0xc439('0x16')]),'trigger:browser:url',{'uri':util[_0xc439('0x1b')](_0xc439('0x4d'),_0x2c2807[_0xc439('0x1d')],_0x29bd12['id'])});}})['catch'](function(_0x2a02b8){logger[_0xc439('0x4e')]('[OUTBOUND]',JSON[_0xc439('0x34')](_0x2a02b8));});};exports[_0xc439('0x54')]=function(_0xeb7a59,_0x1e412e,_0x21636f,_0x300604,_0x21670a,_0x45be13){var _0x7877f9,_0x27873c;_0x45be13[_0xc439('0x1d')]=intUtil[_0xc439('0x42')](_0x45be13[_0xc439('0x1d')]);_0x45be13[_0xc439('0x43')]=intUtil[_0xc439('0x42')](_0x45be13[_0xc439('0x43')]);if(_0x21670a&&_0x21670a['monitor_format']){logger[_0xc439('0xd')]('['+_0x1e412e['lastevent'][_0xc439('0x55')]()+']','Recording\x20is\x20enabled!');_0x1e412e[_0xc439('0x49')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x45be13[_0xc439('0x43')],_0x1e412e['uniqueid'],md5(_0x1e412e[_0xc439('0x48')]));}else{_0x1e412e['recordingURL']='';}headers[_0xc439('0x4a')]=getAuth(_0x45be13);return getUser(_0x45be13,'')[_0xc439('0x1e')](function(_0x42586d){_0x7877f9=_0x42586d;logger['info'](_0xc439('0x56'),_0x7877f9['id']);return getEndUser(_0x45be13,_0x1e412e[_0xc439('0x10')],_0x1e412e['calleridnum']);})[_0xc439('0x1e')](function(_0x4bf45b){_0x27873c=_0x4bf45b;logger[_0xc439('0xd')]('The\x20Enduser\x20ID\x20is:',_0x27873c['id']);return getTicket(_0x45be13,_0x7877f9,_0x27873c,_0x21636f,_0x1e412e);})[_0xc439('0x1e')](function(_0x46cef4){if(_0x46cef4){logger[_0xc439('0xd')]('Ticket\x20created!');logger[_0xc439('0xd')](_0xc439('0x52'),_0x46cef4['id']);}})[_0xc439('0x57')](function(_0x4e58ec){logger[_0xc439('0x4e')]('['+_0x1e412e[_0xc439('0x58')][_0xc439('0x55')]()+']',JSON[_0xc439('0x34')](_0x4e58ec));});}; \ 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 2ceef8f..b464ca6 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 _0x2b4a=['Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','/api/tasks','getString','Subjects','Descriptions','Contact','add','ticketId','task','Task\x20created:','emit','trigger:browser:url','Token\x20token=','apiKey','stripTrailingSlash','remoteUri','serverUrl','username','toLowerCase','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','lodash','md5','util','bluebird','./util','../../../../config/environment','freshsales','redis','socket.io-emitter','GET','headers','info','Getting\x20admin\x20information','then','users','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','error','toUpperCase','message','/api/selector/owners','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','User\x20found:','userId','Admin\x20selected','userEmail','catch','/api/lookup?q=','&f=','&entities=contact','find','contacts','format','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','Contact\x20found\x20work_number:'];(function(_0x491468,_0x42f169){var _0x5b8c22=function(_0x407a9b){while(--_0x407a9b){_0x491468['push'](_0x491468['shift']());}};_0x5b8c22(++_0x42f169);}(_0x2b4a,0x187));var _0xa2b4=function(_0x124f88,_0x3ad501){_0x124f88=_0x124f88-0x0;var _0xed0e3b=_0x2b4a[_0x124f88];return _0xed0e3b;};'use strict';var _=require(_0xa2b4('0x0'));var rp=require('request-promise');var md5=require(_0xa2b4('0x1'));var util=require(_0xa2b4('0x2'));var moment=require('moment');var Promise=require(_0xa2b4('0x3'));var Redis=require('ioredis');var intUtil=require(_0xa2b4('0x4'));var config=require(_0xa2b4('0x5'));var logger=require('../../../../config/logger')(_0xa2b4('0x6'));config[_0xa2b4('0x7')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xa2b4('0x8'))(new Redis(config[_0xa2b4('0x7')]));function getAdminId(_0x37039f,_0x3f4fec,_0x57177c,_0x351796){return new Promise(function(_0x142c8c,_0x35ebdd){var _0x269cc0=![];var _0xd0b022={'method':_0xa2b4('0x9'),'uri':_0x351796+'/api/selector/owners','json':!![]};_0xd0b022[_0xa2b4('0xa')]=_0x57177c;logger[_0xa2b4('0xb')](_0xa2b4('0xc'));return rp(_0xd0b022)[_0xa2b4('0xd')](function(_0x418021){if(_0x418021){var _0x5c8a98=_0x418021[_0xa2b4('0xe')];var _0x12a20b=null;for(_0x12a20b=0x0;_0x12a20b<_0x5c8a98[_0xa2b4('0xf')];_0x12a20b++){if(_0x5c8a98[_0x12a20b][_0xa2b4('0x10')]===_0x37039f[_0xa2b4('0x11')]){_0x37039f[_0xa2b4('0x12')]=_0x5c8a98[_0x12a20b]['id'];_0x269cc0=!![];}}if(_0x269cc0){logger[_0xa2b4('0xb')](_0xa2b4('0x13'),_0x37039f['adminId']);_0x142c8c(_0x37039f);}else{_0x35ebdd({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x35ebdd({'statusCode':0x194,'message':_0xa2b4('0x14')});}})['catch'](function(_0x39f053){logger[_0xa2b4('0x15')]('['+[_0x3f4fec[_0xa2b4('0x16')]()]+']',_0x39f053[_0xa2b4('0x17')]);_0x35ebdd(_0x39f053);});});}function getUser(_0x180078,_0x153b47,_0x286d2c){return function(_0x1397ee){return new Promise(function(_0x40830d,_0x3c68d2){var _0x1dbed1={'method':_0xa2b4('0x9'),'uri':_0x286d2c+_0xa2b4('0x18'),'json':!![]};_0x1dbed1[_0xa2b4('0xa')]=_0x153b47;logger[_0xa2b4('0xb')](_0xa2b4('0x19'));return rp(_0x1dbed1)[_0xa2b4('0xd')](function(_0x59d9a0){if(_0x59d9a0){var _0x1b4651=_0x59d9a0[_0xa2b4('0xe')];var _0x141100=![];var _0x3f33c3=null;if(_0x1397ee[_0xa2b4('0x1a')]!==null){logger['info'](_0xa2b4('0x1b'),_0x1397ee[_0xa2b4('0x1a')]);_0x1397ee['userEmail']=_0x1397ee[_0xa2b4('0x1a')];for(_0x3f33c3=0x0;_0x3f33c3<_0x1b4651[_0xa2b4('0xf')];_0x3f33c3++){if(_0x1b4651[_0x3f33c3][_0xa2b4('0x10')]===_0x1397ee[_0xa2b4('0x1a')]){_0x141100=!![];_0x1397ee['userId']=_0x1b4651[_0x3f33c3]['id'];logger['info'](_0xa2b4('0x1c'),_0x1397ee[_0xa2b4('0x1d')]);}}}if(!_0x141100){logger['info'](_0xa2b4('0x1e'));_0x1397ee[_0xa2b4('0x1f')]=_0x1397ee['adminEmail'];_0x1397ee[_0xa2b4('0x1d')]=_0x1397ee[_0xa2b4('0x12')];_0x141100=!![];}if(_0x141100){_0x40830d(_0x1397ee);}else{_0x3c68d2({'statusCode':0x194,'message':_0xa2b4('0x14')});}}else{_0x3c68d2({'statusCode':0x194,'message':_0xa2b4('0x14')});}})[_0xa2b4('0x20')](function(_0x5b3078){logger[_0xa2b4('0x15')]('['+[_0x180078['toUpperCase']()]+']',_0x5b3078[_0xa2b4('0x17')]);_0x3c68d2(_0x5b3078);});});};}function searchContact(_0x48a5ed,_0x18c8e0,_0x4cb468,_0xaf3c4d){return new Promise(function(_0x4e83fd,_0x536e71){var _0x4ed2b5={'method':_0xa2b4('0x9'),'headers':_0x18c8e0,'uri':_0x48a5ed+_0xa2b4('0x21')+_0xaf3c4d+_0xa2b4('0x22')+_0x4cb468+_0xa2b4('0x23'),'json':!![]};rp(_0x4ed2b5)[_0xa2b4('0xd')](function(_0x53c4db){var _0x3aca2b=_[_0xa2b4('0x24')](_0x53c4db[_0xa2b4('0x25')][_0xa2b4('0x25')],[_0x4cb468,_0xaf3c4d]);_0x4e83fd(_0x3aca2b);})[_0xa2b4('0x20')](function(_0x43bed0){_0x536e71(_0x43bed0);});});}function getEndUser(_0x3c8ce9,_0x122758,_0x231203){return function(_0x80d5db){return new Promise(function(_0x16ad10,_0x69b506){logger['info'](util[_0xa2b4('0x26')]('Searching\x20contact\x20with\x20phone\x20%s',_0x80d5db[_0xa2b4('0x27')]));searchContact(_0x231203,_0x122758,_0xa2b4('0x28'),_0x80d5db['contactNumber'])[_0xa2b4('0xd')](function(_0x1239ba){if(_0x1239ba){_0x80d5db[_0xa2b4('0x29')]=_0x1239ba['id'];logger[_0xa2b4('0xb')](_0xa2b4('0x2a'),_0x80d5db[_0xa2b4('0x29')]);return _0x16ad10(_0x80d5db);}searchContact(_0x231203,_0x122758,'work_number',_0x80d5db['contactNumber'])['then'](function(_0x2003b4){if(_0x2003b4){_0x80d5db[_0xa2b4('0x29')]=_0x2003b4['id'];logger[_0xa2b4('0xb')](_0xa2b4('0x2b'),_0x80d5db['endUserId']);return _0x16ad10(_0x80d5db);}createEndUser(_0x80d5db,_0x3c8ce9,_0x122758,_0x231203)['then'](function(_0x100dfa){logger['info'](_0xa2b4('0x2c'),_0x100dfa[_0xa2b4('0x29')]);return _0x16ad10(_0x100dfa);});});})[_0xa2b4('0x20')](function(_0x498a4f){_0x69b506(_0x498a4f);});});};}function createEndUser(_0xe23df3,_0x38d57d,_0x1f664a,_0xc23b30){return new Promise(function(_0x245c07,_0x106609){var _0x54e4c5=moment();var _0x27bf8a={'method':_0xa2b4('0x2d'),'uri':_0xc23b30+_0xa2b4('0x2e'),'body':{'contact':{'last_name':_0xe23df3['contactNumber'],'work_number':_0xe23df3[_0xa2b4('0x27')],'mobile_number':_0xe23df3[_0xa2b4('0x27')],'owner_id':_0xe23df3['userId'],'created_at':_0x54e4c5[_0xa2b4('0x26')](_0xa2b4('0x2f'))}},'json':!![]};_0x27bf8a[_0xa2b4('0xa')]=_0x1f664a;logger[_0xa2b4('0xb')](_0xa2b4('0x30'));return rp(_0x27bf8a)['then'](function(_0x330169){_0xe23df3[_0xa2b4('0x29')]=_0x330169[_0xa2b4('0x31')]['id'];_0x245c07(_0xe23df3);})[_0xa2b4('0x20')](function(_0x347dec){logger['error']('['+[_0x38d57d[_0xa2b4('0x16')]()]+']',_0x347dec['message']);_0x106609(_0x347dec['message']);});});}function getTicket(_0x2c0110,_0x3b932a,_0x217a3d,_0x27daa2,_0x319cf6){return function(_0x5d5a58){logger[_0xa2b4('0xb')]('Creating\x20new\x20task');return new Promise(function(_0x21023b,_0x526ed2){var _0x263688=moment();var _0x3edfc4={'method':_0xa2b4('0x2d'),'uri':_0x217a3d+_0xa2b4('0x32'),'body':{'title':intUtil[_0xa2b4('0x33')](_0x27daa2[_0xa2b4('0x34')],_0x319cf6,'\x20'),'description':intUtil[_0xa2b4('0x33')](_0x27daa2[_0xa2b4('0x35')],_0x319cf6,'\x0a'),'owner_id':_0x5d5a58[_0xa2b4('0x1d')],'creater_id':_0x5d5a58[_0xa2b4('0x12')],'targetable_id':_0x5d5a58[_0xa2b4('0x29')],'targetable_type':_0xa2b4('0x36'),'created_at':_0x263688[_0xa2b4('0x26')](_0xa2b4('0x2f')),'due_date':_0x263688[_0xa2b4('0x37')](0x1e,'m')['format'](_0xa2b4('0x2f'))},'json':!![]};_0x3edfc4['headers']=_0x3b932a;return rp(_0x3edfc4)[_0xa2b4('0xd')](function(_0x248f51){_0x5d5a58[_0xa2b4('0x38')]=_0x248f51[_0xa2b4('0x39')]['id'];logger[_0xa2b4('0xb')](_0xa2b4('0x3a'),_0x5d5a58['ticketId']);_0x21023b(_0x5d5a58);})[_0xa2b4('0x20')](function(_0x37dbfc){logger['error']('['+[_0x2c0110[_0xa2b4('0x16')]()]+']',_0x37dbfc[_0xa2b4('0x17')]);_0x526ed2(_0x37dbfc[_0xa2b4('0x17')]);});});};}function emit(_0x1835da,_0x28cf27,_0x39cce6){var _0x4edeb2={'uri':_0x1835da+'/contacts/'+_0x39cce6};io['to'](util[_0xa2b4('0x26')]('user:%s',_0x28cf27))[_0xa2b4('0x3b')](_0xa2b4('0x3c'),_0x4edeb2);}exports['cs']=function(_0x460bba,_0x3fa33b,_0x4c2d7d,_0x354c0a,_0x3a8fc6,_0x5a5956,_0x413626,_0x14cf0e){var _0x5cf50b={};var _0x258fe1={'Authorization':_0xa2b4('0x3d')+_0x5a5956[_0xa2b4('0x3e')]};_0x5a5956['remoteUri']=intUtil[_0xa2b4('0x3f')](_0x5a5956[_0xa2b4('0x40')]);_0x5a5956[_0xa2b4('0x41')]=intUtil[_0xa2b4('0x3f')](_0x5a5956[_0xa2b4('0x41')]);var _0x38b396=_0x5a5956[_0xa2b4('0x40')];_0x5cf50b[_0xa2b4('0x11')]=_0x5a5956[_0xa2b4('0x42')];_0x5cf50b[_0xa2b4('0x27')]=_0x14cf0e[_0xa2b4('0x43')]()===_0xa2b4('0x44')?_0x3fa33b[_0xa2b4('0x45')]:_0x3fa33b[_0xa2b4('0x46')];_0x5cf50b[_0xa2b4('0x47')]=_0x14cf0e===_0xa2b4('0x48')||_0x14cf0e===_0xa2b4('0x49')?_0xa2b4('0x48'):_0xa2b4('0x44');if(_0x354c0a){_0x5cf50b[_0xa2b4('0x1a')]=_0x354c0a['email'];}var _0xb2ebbd=util[_0xa2b4('0x26')](_0xa2b4('0x4a'),_0x5a5956[_0xa2b4('0x41')],_0x3fa33b[_0xa2b4('0x4b')],md5(_0x3fa33b[_0xa2b4('0x4b')]));if(_0x3a8fc6&&_0x3a8fc6[_0xa2b4('0x4c')]){logger[_0xa2b4('0xb')](_0xa2b4('0x4d'),_0xa2b4('0x4e'));_0x3fa33b[_0xa2b4('0x4f')]=_0xb2ebbd;}else if(_0x413626&&_0x413626[_0xa2b4('0x50')]&&_0x413626['recordingFormat']!==_0xa2b4('0x51')){logger[_0xa2b4('0xb')](_0xa2b4('0x52'),'Recording\x20is\x20enabled!');_0x3fa33b[_0xa2b4('0x4f')]=_0xb2ebbd;}else{_0x3fa33b[_0xa2b4('0x4f')]='';}return getAdminId(_0x5cf50b,_0x14cf0e,_0x258fe1,_0x38b396)['then'](getUser(_0x14cf0e,_0x258fe1,_0x38b396))[_0xa2b4('0xd')](getEndUser(_0x14cf0e,_0x258fe1,_0x38b396))['then'](getTicket(_0x14cf0e,_0x258fe1,_0x38b396,_0x4c2d7d,_0x3fa33b))[_0xa2b4('0xd')](function(_0x25725a){logger[_0xa2b4('0xb')](util[_0xa2b4('0x26')](_0xa2b4('0x53'),_0x25725a['ticketId']));if(_0x14cf0e!=='unmanaged'){logger[_0xa2b4('0xb')]('['+[_0x14cf0e[_0xa2b4('0x16')]()]+']',_0xa2b4('0x54'));emit(_0x38b396,_0x354c0a[_0xa2b4('0x55')],_0x25725a[_0xa2b4('0x29')]);}})[_0xa2b4('0x20')](function(_0x5ca4a8){logger[_0xa2b4('0x15')]('['+[_0x14cf0e[_0xa2b4('0x16')]()]+_0xa2b4('0x56'),util['inspect'](_0x5ca4a8,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x3373=['Token\x20token=','apiKey','stripTrailingSlash','remoteUri','serverUrl','username','toLowerCase','outbound','destcalleridnum','calleridnum','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','moment','bluebird','ioredis','./util','freshsales','redis','defaults','GET','info','Getting\x20admin\x20information','then','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','error','toUpperCase','message','/api/selector/owners','headers','Getting\x20user\x20list','agentEmail','userId','userEmail','catch','/api/lookup?q=','&f=','&entities=contact','find','contacts','format','contactNumber','endUserId','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','contact','Creating\x20new\x20task','/api/tasks','Subjects','getString','Descriptions','YYYY-MM-DDTHH:mm:ss','task','Task\x20created:','ticketId','/contacts/'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x3373,0x68));var _0x3337=function(_0x164fa4,_0x43c615){_0x164fa4=_0x164fa4-0x0;var _0x4583c7=_0x3373[_0x164fa4];return _0x4583c7;};'use strict';var _=require(_0x3337('0x0'));var rp=require(_0x3337('0x1'));var md5=require(_0x3337('0x2'));var util=require('util');var moment=require(_0x3337('0x3'));var Promise=require(_0x3337('0x4'));var Redis=require(_0x3337('0x5'));var intUtil=require(_0x3337('0x6'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x3337('0x7'));config[_0x3337('0x8')]=_[_0x3337('0x9')](config[_0x3337('0x8')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3337('0x8')]));function getAdminId(_0x19f75f,_0x45f560,_0x5afa11,_0x36442c){return new Promise(function(_0x57bb77,_0x17b43a){var _0x32f94a=![];var _0x408cdf={'method':_0x3337('0xa'),'uri':_0x36442c+'/api/selector/owners','json':!![]};_0x408cdf['headers']=_0x5afa11;logger[_0x3337('0xb')](_0x3337('0xc'));return rp(_0x408cdf)[_0x3337('0xd')](function(_0x3dd047){if(_0x3dd047){var _0x4fdd18=_0x3dd047['users'];var _0x3296a4=null;for(_0x3296a4=0x0;_0x3296a4<_0x4fdd18[_0x3337('0xe')];_0x3296a4++){if(_0x4fdd18[_0x3296a4][_0x3337('0xf')]===_0x19f75f[_0x3337('0x10')]){_0x19f75f[_0x3337('0x11')]=_0x4fdd18[_0x3296a4]['id'];_0x32f94a=!![];}}if(_0x32f94a){logger[_0x3337('0xb')](_0x3337('0x12'),_0x19f75f[_0x3337('0x11')]);_0x57bb77(_0x19f75f);}else{_0x17b43a({'statusCode':0x194,'message':_0x3337('0x13')});}}else{_0x17b43a({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})['catch'](function(_0x34219e){logger[_0x3337('0x14')]('['+[_0x45f560[_0x3337('0x15')]()]+']',_0x34219e[_0x3337('0x16')]);_0x17b43a(_0x34219e);});});}function getUser(_0x1ee681,_0x13890d,_0x262058){return function(_0x85e8ec){return new Promise(function(_0x548beb,_0x163bba){var _0x1b610d={'method':_0x3337('0xa'),'uri':_0x262058+_0x3337('0x17'),'json':!![]};_0x1b610d[_0x3337('0x18')]=_0x13890d;logger['info'](_0x3337('0x19'));return rp(_0x1b610d)[_0x3337('0xd')](function(_0x2e42cf){if(_0x2e42cf){var _0x47a9a0=_0x2e42cf['users'];var _0x47ea9f=![];var _0x55c4b0=null;if(_0x85e8ec[_0x3337('0x1a')]!==null){logger[_0x3337('0xb')]('Getting\x20user\x20with\x20email',_0x85e8ec[_0x3337('0x1a')]);_0x85e8ec['userEmail']=_0x85e8ec[_0x3337('0x1a')];for(_0x55c4b0=0x0;_0x55c4b0<_0x47a9a0[_0x3337('0xe')];_0x55c4b0++){if(_0x47a9a0[_0x55c4b0][_0x3337('0xf')]===_0x85e8ec[_0x3337('0x1a')]){_0x47ea9f=!![];_0x85e8ec[_0x3337('0x1b')]=_0x47a9a0[_0x55c4b0]['id'];logger[_0x3337('0xb')]('User\x20found:',_0x85e8ec[_0x3337('0x1b')]);}}}if(!_0x47ea9f){logger[_0x3337('0xb')]('Admin\x20selected');_0x85e8ec[_0x3337('0x1c')]=_0x85e8ec['adminEmail'];_0x85e8ec[_0x3337('0x1b')]=_0x85e8ec[_0x3337('0x11')];_0x47ea9f=!![];}if(_0x47ea9f){_0x548beb(_0x85e8ec);}else{_0x163bba({'statusCode':0x194,'message':_0x3337('0x13')});}}else{_0x163bba({'statusCode':0x194,'message':_0x3337('0x13')});}})[_0x3337('0x1d')](function(_0x50a30e){logger['error']('['+[_0x1ee681[_0x3337('0x15')]()]+']',_0x50a30e['message']);_0x163bba(_0x50a30e);});});};}function searchContact(_0x2d712c,_0xd10a24,_0x510ee3,_0x2fc41a){return new Promise(function(_0x5b1d06,_0x3f4497){var _0x45b03d={'method':'GET','headers':_0xd10a24,'uri':_0x2d712c+_0x3337('0x1e')+_0x2fc41a+_0x3337('0x1f')+_0x510ee3+_0x3337('0x20'),'json':!![]};rp(_0x45b03d)[_0x3337('0xd')](function(_0x1ee697){var _0x15daaa=_[_0x3337('0x21')](_0x1ee697['contacts'][_0x3337('0x22')],[_0x510ee3,_0x2fc41a]);_0x5b1d06(_0x15daaa);})[_0x3337('0x1d')](function(_0x1ca95a){_0x3f4497(_0x1ca95a);});});}function getEndUser(_0x496644,_0x13c917,_0x415ddf){return function(_0x5509d8){return new Promise(function(_0x1c95c2,_0x16adf9){logger[_0x3337('0xb')](util[_0x3337('0x23')]('Searching\x20contact\x20with\x20phone\x20%s',_0x5509d8[_0x3337('0x24')]));searchContact(_0x415ddf,_0x13c917,'mobile_number',_0x5509d8[_0x3337('0x24')])[_0x3337('0xd')](function(_0x165600){if(_0x165600){_0x5509d8['endUserId']=_0x165600['id'];logger['info']('Contact\x20found\x20mobile_number:',_0x5509d8[_0x3337('0x25')]);return _0x1c95c2(_0x5509d8);}searchContact(_0x415ddf,_0x13c917,_0x3337('0x26'),_0x5509d8['contactNumber'])[_0x3337('0xd')](function(_0x177802){if(_0x177802){_0x5509d8['endUserId']=_0x177802['id'];logger[_0x3337('0xb')](_0x3337('0x27'),_0x5509d8['endUserId']);return _0x1c95c2(_0x5509d8);}createEndUser(_0x5509d8,_0x496644,_0x13c917,_0x415ddf)[_0x3337('0xd')](function(_0x4eb4de){logger[_0x3337('0xb')](_0x3337('0x28'),_0x4eb4de[_0x3337('0x25')]);return _0x1c95c2(_0x4eb4de);});});})[_0x3337('0x1d')](function(_0xd81d69){_0x16adf9(_0xd81d69);});});};}function createEndUser(_0x412b62,_0x1583ef,_0x3226cb,_0x599173){return new Promise(function(_0x105973,_0xe7beb1){var _0x1d2ad3=moment();var _0x1e436a={'method':_0x3337('0x29'),'uri':_0x599173+_0x3337('0x2a'),'body':{'contact':{'last_name':_0x412b62[_0x3337('0x24')],'work_number':_0x412b62[_0x3337('0x24')],'mobile_number':_0x412b62[_0x3337('0x24')],'owner_id':_0x412b62[_0x3337('0x1b')],'created_at':_0x1d2ad3[_0x3337('0x23')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x1e436a[_0x3337('0x18')]=_0x3226cb;logger[_0x3337('0xb')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x1e436a)['then'](function(_0x1a72aa){_0x412b62[_0x3337('0x25')]=_0x1a72aa[_0x3337('0x2b')]['id'];_0x105973(_0x412b62);})[_0x3337('0x1d')](function(_0xfae30d){logger[_0x3337('0x14')]('['+[_0x1583ef[_0x3337('0x15')]()]+']',_0xfae30d[_0x3337('0x16')]);_0xe7beb1(_0xfae30d[_0x3337('0x16')]);});});}function getTicket(_0x5069f1,_0x296e76,_0x50a7af,_0x163f0f,_0x33da1e){return function(_0x363f18){logger[_0x3337('0xb')](_0x3337('0x2c'));return new Promise(function(_0x350a55,_0x18aa51){var _0x41b7c2=moment();var _0x378a6a={'method':_0x3337('0x29'),'uri':_0x50a7af+_0x3337('0x2d'),'body':{'title':intUtil['getString'](_0x163f0f[_0x3337('0x2e')],_0x33da1e,'\x20'),'description':intUtil[_0x3337('0x2f')](_0x163f0f[_0x3337('0x30')],_0x33da1e,'\x0a'),'owner_id':_0x363f18[_0x3337('0x1b')],'creater_id':_0x363f18['adminId'],'targetable_id':_0x363f18[_0x3337('0x25')],'targetable_type':'Contact','created_at':_0x41b7c2[_0x3337('0x23')](_0x3337('0x31')),'due_date':_0x41b7c2['add'](0x1e,'m')['format']('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x378a6a[_0x3337('0x18')]=_0x296e76;return rp(_0x378a6a)[_0x3337('0xd')](function(_0x32f9d7){_0x363f18['ticketId']=_0x32f9d7[_0x3337('0x32')]['id'];logger[_0x3337('0xb')](_0x3337('0x33'),_0x363f18[_0x3337('0x34')]);_0x350a55(_0x363f18);})['catch'](function(_0x4f7601){logger[_0x3337('0x14')]('['+[_0x5069f1[_0x3337('0x15')]()]+']',_0x4f7601[_0x3337('0x16')]);_0x18aa51(_0x4f7601['message']);});});};}function emit(_0x5a1227,_0x56ad71,_0x31c044){var _0x990ec4={'uri':_0x5a1227+_0x3337('0x35')+_0x31c044};io['to'](util[_0x3337('0x23')]('user:%s',_0x56ad71))['emit']('trigger:browser:url',_0x990ec4);}exports['cs']=function(_0x811c25,_0x4daf1e,_0x256ff2,_0x3d888a,_0x3bd09d,_0x33a12f,_0x5b5b0f,_0x515a0e){var _0x447384={};var _0x2869dc={'Authorization':_0x3337('0x36')+_0x33a12f[_0x3337('0x37')]};_0x33a12f['remoteUri']=intUtil[_0x3337('0x38')](_0x33a12f[_0x3337('0x39')]);_0x33a12f[_0x3337('0x3a')]=intUtil[_0x3337('0x38')](_0x33a12f[_0x3337('0x3a')]);var _0x57d831=_0x33a12f[_0x3337('0x39')];_0x447384['adminEmail']=_0x33a12f[_0x3337('0x3b')];_0x447384[_0x3337('0x24')]=_0x515a0e[_0x3337('0x3c')]()===_0x3337('0x3d')?_0x4daf1e[_0x3337('0x3e')]:_0x4daf1e[_0x3337('0x3f')];_0x447384['callDirection']=_0x515a0e===_0x3337('0x40')||_0x515a0e==='unmanaged'?'queue':_0x3337('0x3d');if(_0x3d888a){_0x447384[_0x3337('0x1a')]=_0x3d888a[_0x3337('0xf')];}var _0x2eb164=util[_0x3337('0x23')](_0x3337('0x41'),_0x33a12f['serverUrl'],_0x4daf1e[_0x3337('0x42')],md5(_0x4daf1e[_0x3337('0x42')]));if(_0x3bd09d&&_0x3bd09d[_0x3337('0x43')]){logger[_0x3337('0xb')](_0x3337('0x44'),_0x3337('0x45'));_0x4daf1e['recordingURL']=_0x2eb164;}else if(_0x5b5b0f&&_0x5b5b0f[_0x3337('0x46')]&&_0x5b5b0f['recordingFormat']!==_0x3337('0x47')){logger[_0x3337('0xb')](_0x3337('0x48'),'Recording\x20is\x20enabled!');_0x4daf1e['recordingURL']=_0x2eb164;}else{_0x4daf1e[_0x3337('0x49')]='';}return getAdminId(_0x447384,_0x515a0e,_0x2869dc,_0x57d831)[_0x3337('0xd')](getUser(_0x515a0e,_0x2869dc,_0x57d831))[_0x3337('0xd')](getEndUser(_0x515a0e,_0x2869dc,_0x57d831))['then'](getTicket(_0x515a0e,_0x2869dc,_0x57d831,_0x256ff2,_0x4daf1e))[_0x3337('0xd')](function(_0x50f91e){logger['info'](util[_0x3337('0x23')](_0x3337('0x4a'),_0x50f91e[_0x3337('0x34')]));if(_0x515a0e!=='unmanaged'){logger[_0x3337('0xb')]('['+[_0x515a0e[_0x3337('0x15')]()]+']',_0x3337('0x4b'));emit(_0x57d831,_0x3d888a[_0x3337('0x4c')],_0x50f91e['endUserId']);}})[_0x3337('0x1d')](function(_0x5712fa){logger[_0x3337('0x14')]('['+[_0x515a0e[_0x3337('0x15')]()]+_0x3337('0x4d'),util[_0x3337('0x4e')](_0x5712fa,{'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 8f61370..2ab2b50 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 _0x8dfa=['data1','toLowerCase','find','data3','queue','routeId','outbound','EVENT\x20UNKNOWN','servicenow','log','../../../../config/logger','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','error','%s\x20account\x20#%s\x20not\x20found','data2','lodash','util','./zendesk','./salesforce','./sugarcrm','./zoho','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','zoho','desk','vtiger','dynamics365','freshsales','exec','includes'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x8dfa,0x155));var _0xa8df=function(_0x5e5568,_0x300d0d){_0x5e5568=_0x5e5568-0x0;var _0x557045=_0x8dfa[_0x5e5568];return _0x557045;};'use strict';var _=require(_0xa8df('0x0'));var util=require(_0xa8df('0x1'));var zendesk=require(_0xa8df('0x2'));var salesforce=require(_0xa8df('0x3'));var sugarcrm=require(_0xa8df('0x4'));var freshdesk=require('./freshdesk');var zoho=require(_0xa8df('0x5'));var desk=require('./desk');var vtiger=require('./vtiger');var servicenow=require(_0xa8df('0x6'));var dynamics365=require(_0xa8df('0x7'));var freshsales=require(_0xa8df('0x8'));var integrations=[_0xa8df('0x9'),_0xa8df('0xa'),_0xa8df('0xb'),'freshdesk',_0xa8df('0xc'),_0xa8df('0xd'),_0xa8df('0xe'),_0xa8df('0xf'),_0xa8df('0x10'),'servicenow'];exports[_0xa8df('0x11')]=function(_0x4981fd,_0x4df8ae,_0x5e3d04,_0x398011,_0x183aa5,_0x24b38e){if(_0x5e3d04){if(_[_0xa8df('0x12')](integrations,_0x4981fd[_0xa8df('0x13')][_0xa8df('0x14')]())){try{var _0x2474fe=null;var _0x34b739='';var _0x40bdcb=_0x5e3d04[_0x4981fd[_0xa8df('0x13')][_0xa8df('0x14')]()];if(_0x40bdcb){var _0x10975a=_0x40bdcb[_0x4981fd['data2']];if(_0x10975a){var _0x475ac7=_[_0xa8df('0x15')](_0x10975a['Configurations'],{'id':parseInt(_0x4981fd[_0xa8df('0x16')],0xa)});if(_0x475ac7){if(_0x398011){if(_0x183aa5&&_0x4df8ae['queue']){_0x34b739=_0xa8df('0x17');}else if(_0x4df8ae[_0xa8df('0x18')]){_0x34b739=_0xa8df('0x19');}else{console['log'](_0xa8df('0x1a'),_0x4df8ae);}}else{_0x34b739='unmanaged';}switch(_0x4981fd['data1']['toLowerCase']()){case _0xa8df('0x9'):zendesk[_0x34b739](_0x4981fd,_0x4df8ae,_0x475ac7,_0x398011,_0x183aa5,_0x10975a,_0x24b38e);break;case _0xa8df('0xa'):salesforce[_0x34b739](_0x4981fd,_0x4df8ae,_0x475ac7,_0x398011,_0x183aa5,_0x10975a,_0x24b38e);break;case _0xa8df('0xb'):sugarcrm[_0x34b739](_0x4981fd,_0x4df8ae,_0x475ac7,_0x398011,_0x183aa5,_0x10975a,_0x24b38e);break;case'freshdesk':freshdesk[_0x34b739](_0x4981fd,_0x4df8ae,_0x475ac7,_0x398011,_0x183aa5,_0x10975a,_0x24b38e);break;case _0xa8df('0xc'):zoho[_0x34b739](_0x4981fd,_0x4df8ae,_0x475ac7,_0x398011,_0x183aa5,_0x10975a,_0x24b38e);break;case _0xa8df('0xd'):desk[_0x34b739](_0x4981fd,_0x4df8ae,_0x475ac7,_0x398011,_0x183aa5,_0x10975a,_0x24b38e);break;case _0xa8df('0xe'):vtiger[_0x34b739](_0x4981fd,_0x4df8ae,_0x475ac7,_0x398011,_0x183aa5,_0x10975a,_0x24b38e);break;case _0xa8df('0x10'):freshsales['cs'](_0x4981fd,_0x4df8ae,_0x475ac7,_0x398011,_0x183aa5,_0x10975a,_0x24b38e,_0x34b739);break;case _0xa8df('0x1b'):servicenow['cs'](_0x4981fd,_0x4df8ae,_0x475ac7,_0x398011,_0x183aa5,_0x10975a,_0x24b38e,_0x34b739);break;case _0xa8df('0xf'):dynamics365['cs'](_0x4981fd,_0x4df8ae,_0x475ac7,_0x398011,_0x183aa5,_0x10975a,_0x24b38e,_0x34b739);break;default:console[_0xa8df('0x1c')]('unknown\x20integration');}}else{_0x2474fe=require(_0xa8df('0x1d'))(_0x4981fd[_0xa8df('0x13')][_0xa8df('0x14')]());_0x2474fe['error'](_0xa8df('0x1e'),util[_0xa8df('0x1f')](_0xa8df('0x20'),_0x4981fd[_0xa8df('0x13')][_0xa8df('0x14')](),_0x4981fd[_0xa8df('0x16')]));}}else{_0x2474fe=require('../../../../config/logger')(_0x4981fd[_0xa8df('0x13')]['toLowerCase']());_0x2474fe[_0xa8df('0x21')](_0xa8df('0x1e'),util[_0xa8df('0x1f')](_0xa8df('0x22'),_0x4981fd[_0xa8df('0x13')][_0xa8df('0x14')](),_0x4981fd[_0xa8df('0x23')]));}}else{}}catch(_0x59b48a){console[_0xa8df('0x21')](_0x59b48a);}}}}; \ No newline at end of file +var _0xacf7=['servicenow','exec','includes','toLowerCase','data1','data2','find','Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','zoho','vtiger','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./freshsales','zendesk','salesforce','sugarcrm','freshdesk','desk','dynamics365','freshsales'];(function(_0x539e7a,_0x486b31){var _0x402f1a=function(_0x27baf7){while(--_0x27baf7){_0x539e7a['push'](_0x539e7a['shift']());}};_0x402f1a(++_0x486b31);}(_0xacf7,0x14f));var _0x7acf=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xacf7[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x7acf('0x0'));var util=require(_0x7acf('0x1'));var zendesk=require(_0x7acf('0x2'));var salesforce=require(_0x7acf('0x3'));var sugarcrm=require(_0x7acf('0x4'));var freshdesk=require(_0x7acf('0x5'));var zoho=require(_0x7acf('0x6'));var desk=require(_0x7acf('0x7'));var vtiger=require('./vtiger');var servicenow=require('./servicenow');var dynamics365=require('./dynamics365');var freshsales=require(_0x7acf('0x8'));var integrations=[_0x7acf('0x9'),_0x7acf('0xa'),_0x7acf('0xb'),_0x7acf('0xc'),'zoho',_0x7acf('0xd'),'vtiger',_0x7acf('0xe'),_0x7acf('0xf'),_0x7acf('0x10')];exports[_0x7acf('0x11')]=function(_0x2f4e08,_0xaa91c1,_0x2ba347,_0x470bae,_0x310f3b,_0x3cc1cf){if(_0x2ba347){if(_[_0x7acf('0x12')](integrations,_0x2f4e08['data1'][_0x7acf('0x13')]())){try{var _0xbfd54e=null;var _0x3553cd='';var _0x577723=_0x2ba347[_0x2f4e08[_0x7acf('0x14')][_0x7acf('0x13')]()];if(_0x577723){var _0x243064=_0x577723[_0x2f4e08[_0x7acf('0x15')]];if(_0x243064){var _0x4972db=_[_0x7acf('0x16')](_0x243064[_0x7acf('0x17')],{'id':parseInt(_0x2f4e08[_0x7acf('0x18')],0xa)});if(_0x4972db){if(_0x470bae){if(_0x310f3b&&_0xaa91c1[_0x7acf('0x19')]){_0x3553cd=_0x7acf('0x19');}else if(_0xaa91c1[_0x7acf('0x1a')]){_0x3553cd=_0x7acf('0x1b');}else{console[_0x7acf('0x1c')](_0x7acf('0x1d'),_0xaa91c1);}}else{_0x3553cd=_0x7acf('0x1e');}switch(_0x2f4e08['data1'][_0x7acf('0x13')]()){case _0x7acf('0x9'):zendesk[_0x3553cd](_0x2f4e08,_0xaa91c1,_0x4972db,_0x470bae,_0x310f3b,_0x243064,_0x3cc1cf);break;case'salesforce':salesforce[_0x3553cd](_0x2f4e08,_0xaa91c1,_0x4972db,_0x470bae,_0x310f3b,_0x243064,_0x3cc1cf);break;case _0x7acf('0xb'):sugarcrm[_0x3553cd](_0x2f4e08,_0xaa91c1,_0x4972db,_0x470bae,_0x310f3b,_0x243064,_0x3cc1cf);break;case'freshdesk':freshdesk[_0x3553cd](_0x2f4e08,_0xaa91c1,_0x4972db,_0x470bae,_0x310f3b,_0x243064,_0x3cc1cf);break;case _0x7acf('0x1f'):zoho[_0x3553cd](_0x2f4e08,_0xaa91c1,_0x4972db,_0x470bae,_0x310f3b,_0x243064,_0x3cc1cf);break;case _0x7acf('0xd'):desk[_0x3553cd](_0x2f4e08,_0xaa91c1,_0x4972db,_0x470bae,_0x310f3b,_0x243064,_0x3cc1cf);break;case _0x7acf('0x20'):vtiger[_0x3553cd](_0x2f4e08,_0xaa91c1,_0x4972db,_0x470bae,_0x310f3b,_0x243064,_0x3cc1cf);break;case _0x7acf('0xf'):freshsales['cs'](_0x2f4e08,_0xaa91c1,_0x4972db,_0x470bae,_0x310f3b,_0x243064,_0x3cc1cf,_0x3553cd);break;case _0x7acf('0x10'):servicenow['cs'](_0x2f4e08,_0xaa91c1,_0x4972db,_0x470bae,_0x310f3b,_0x243064,_0x3cc1cf,_0x3553cd);break;case _0x7acf('0xe'):dynamics365['cs'](_0x2f4e08,_0xaa91c1,_0x4972db,_0x470bae,_0x310f3b,_0x243064,_0x3cc1cf,_0x3553cd);break;default:console[_0x7acf('0x1c')](_0x7acf('0x21'));}}else{_0xbfd54e=require(_0x7acf('0x22'))(_0x2f4e08[_0x7acf('0x14')]['toLowerCase']());_0xbfd54e[_0x7acf('0x23')](_0x7acf('0x24'),util[_0x7acf('0x25')]('%s\x20configuration\x20#%s\x20not\x20found',_0x2f4e08[_0x7acf('0x14')][_0x7acf('0x13')](),_0x2f4e08['data3']));}}else{_0xbfd54e=require(_0x7acf('0x22'))(_0x2f4e08[_0x7acf('0x14')][_0x7acf('0x13')]());_0xbfd54e[_0x7acf('0x23')](_0x7acf('0x24'),util[_0x7acf('0x25')](_0x7acf('0x26'),_0x2f4e08['data1']['toLowerCase'](),_0x2f4e08[_0x7acf('0x15')]));}}else{}}catch(_0x4412c8){console['error'](_0x4412c8);}}}}; \ 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 dddc978..3a7321c 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 _0x563f=['ticketType','utc','endUserType','contact','lead','WhoId','account','WhatId','Case','ContactId','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','isNil','validateEmail','User','find','execute','Email','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','then','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','Contact','length','additionalSearchLead','account_contact_lead','Account','Lead','additionalSearchAccount','first','Phone','attributes','type','toLowerCase','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','format','upperFirst','forEach','string','picklist','toString','variable','variableName','idField','customVariable','Variable','name','password','concat','securityToken','Connection','https://login.salesforce.com','clientSecret','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','remoteUri','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','integrationTab','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','instanceUrl','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','error','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','Fields','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','Salesforce\x20account\x20type\x20not\x20recognized','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','md5','jsforce','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','emit','assign','getString'];(function(_0x2bdfc4,_0x5551b7){var _0x43711a=function(_0x296a8e){while(--_0x296a8e){_0x2bdfc4['push'](_0x2bdfc4['shift']());}};_0x43711a(++_0x5551b7);}(_0x563f,0xed));var _0xf563=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x563f[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0xf563('0x0'));var rp=require(_0xf563('0x1'));var moment=require(_0xf563('0x2'));var BPromise=require(_0xf563('0x3'));var md5=require(_0xf563('0x4'));var jsforce=require(_0xf563('0x5'));var util=require('util');var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0xf563('0x6'));var logger=require(_0xf563('0x7'))(_0xf563('0x8'));config[_0xf563('0x9')]=_[_0xf563('0xa')](config[_0xf563('0x9')],{'host':_0xf563('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf563('0x9')]));function emit(_0x5bed5d,_0x16f33a,_0x2e66c8){io['to'](_0x5bed5d)[_0xf563('0xc')](_0x16f33a,_0x2e66c8);}function getTicket(_0x34d634,_0x495cc1,_0x396cc9,_0x4c11ef,_0x22bf7f,_0x12d17b,_0x53c349,_0x21882d){var _0x147afe=Object[_0xf563('0xd')]({},{'OwnerId':_0x495cc1['id'],'Subject':intUtil['getString'](_0x4c11ef['Subjects'],_0x22bf7f,'\x20'),'Description':intUtil[_0xf563('0xe')](_0x4c11ef['Descriptions'],_0x22bf7f,'\x0a')},getCustomFields(_0x12d17b,_0x22bf7f));if(_0x396cc9){if(_0x4c11ef[_0xf563('0xf')]==='Task'){_0x147afe['ActivityDate']=moment[_0xf563('0x10')]();_0x147afe['IsReminderSet']=![];_0x147afe['IsRecurrence']=![];if(_0x396cc9[_0xf563('0x11')]===_0xf563('0x12')||_0x396cc9[_0xf563('0x11')]===_0xf563('0x13')){_0x147afe[_0xf563('0x14')]=_0x396cc9['id'];}else if(_0x396cc9['endUserType']===_0xf563('0x15')){_0x147afe[_0xf563('0x16')]=_0x396cc9['id'];}}else if(_0x4c11ef[_0xf563('0xf')]===_0xf563('0x17')){if(_0x396cc9['endUserType']==='contact'){_0x147afe[_0xf563('0x18')]=_0x396cc9['id'];}else if(_0x396cc9[_0xf563('0x11')]===_0xf563('0x15')){_0x147afe[_0xf563('0x19')]=_0x396cc9['id'];}else if(_0x396cc9['endUserType']==='lead'&&_0x4c11ef[_0xf563('0x1a')]){_0x147afe[_0x4c11ef[_0xf563('0x1a')]]=_0x396cc9['id'];}else{logger[_0xf563('0x1b')](_0xf563('0x1c'));}}}return _0x53c349[_0xf563('0x1d')](_0x4c11ef[_0xf563('0xf')])['create'](_0x147afe);}function getUser(_0x50875d,_0x3ec604,_0x55b8e2){if(!_[_0xf563('0x1e')](_0x3ec604)&&intUtil[_0xf563('0x1f')](_0x3ec604)){var _0x28d2b7={'Email':_0x3ec604};var _0x4e1425={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x55b8e2[_0xf563('0x1d')](_0xf563('0x20'))[_0xf563('0x21')](_0x28d2b7,_0x4e1425)[_0xf563('0x22')]()['then'](function(_0x45aded){if(_0x45aded['length']){var _0x1139e9=_[_0xf563('0x21')](_0x45aded,function(_0x12c72b){return _0x12c72b[_0xf563('0x23')]===_0x3ec604;});if(_0x1139e9){logger[_0xf563('0x1b')](_0xf563('0x24'),_0x3ec604);return BPromise[_0xf563('0x25')]({'id':_0x1139e9['Id'],'name':_0x1139e9[_0xf563('0x26')]});}}else{logger[_0xf563('0x1b')](_0xf563('0x27'),_0x3ec604);return _0x55b8e2[_0xf563('0x28')]()[_0xf563('0x29')](function(_0x2c422f){return BPromise['resolve']({'id':_0x2c422f[_0xf563('0x2a')],'name':_0x2c422f[_0xf563('0x2b')]});});}});}else{logger['info']('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x3ec604);return _0x55b8e2['identity']()[_0xf563('0x29')](function(_0x4bd50f){return BPromise[_0xf563('0x25')]({'id':_0x4bd50f['user_id'],'name':_0x4bd50f['display_name']});});}}function getEndUser(_0x2ed4f4,_0x525b59,_0x19abe3,_0x1855e7,_0x131810){var _0x4d5357={'$or':{'Phone':_0x1855e7}};var _0x4c00af={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0xf563('0x29')](function(){logger['info'](_0xf563('0x2c'),_0x1855e7,_0x525b59[_0xf563('0x2d')]);switch(_0x525b59[_0xf563('0x2d')]){case _0xf563('0x2e'):var _0x4cb630=_[_0xf563('0x2f')](_0x4d5357);if(_0x525b59[_0xf563('0x30')]){var _0x990650={};_0x990650[_0x525b59['additionalSearchContact']]=_0x1855e7;_[_0xf563('0x31')](_0x4cb630[_0xf563('0x32')],_0x990650);}return _0x131810[_0xf563('0x1d')](_0xf563('0x33'))[_0xf563('0x21')](_0x4cb630,_0x4c00af)[_0xf563('0x22')]()[_0xf563('0x29')](function(_0x5a60f0){if(_0x5a60f0&&_0x5a60f0[_0xf563('0x34')]){return _0x5a60f0;}else{var _0x48864f=_['cloneDeep'](_0x4d5357);if(_0x525b59[_0xf563('0x35')]){var _0x3b9a76={};_0x3b9a76[_0x525b59['additionalSearchLead']]=_0x1855e7;_[_0xf563('0x31')](_0x48864f[_0xf563('0x32')],_0x3b9a76);}return _0x131810['sobject']('Lead')[_0xf563('0x21')](_0x48864f,_0x4c00af);}});case _0xf563('0x36'):var _0x5b914c=_['cloneDeep'](_0x4d5357);if(_0x525b59['additionalSearchAccount']){var _0x990650={};_0x990650[_0x525b59['additionalSearchAccount']]=_0x1855e7;_[_0xf563('0x31')](_0x5b914c['$or'],_0x990650);}return _0x131810[_0xf563('0x1d')](_0xf563('0x37'))['find'](_0x5b914c,_0x4c00af)[_0xf563('0x22')]()[_0xf563('0x29')](function(_0x5a40cc){if(_0x5a40cc&&_0x5a40cc[_0xf563('0x34')]){return _0x5a40cc;}else{var _0x4ed5a6=_['cloneDeep'](_0x4d5357);if(_0x525b59[_0xf563('0x30')]){var _0x108956={};_0x108956[_0x525b59[_0xf563('0x30')]]=_0x1855e7;_[_0xf563('0x31')](_0x4ed5a6[_0xf563('0x32')],_0x108956);}return _0x131810['sobject'](_0xf563('0x33'))[_0xf563('0x21')](_0x4ed5a6,_0x4c00af)['then'](function(_0x15872f){if(_0x15872f&&_0x15872f[_0xf563('0x34')]){return _0x15872f;}else{var _0x163202=_['cloneDeep'](_0x4d5357);if(_0x525b59[_0xf563('0x35')]){var _0x2a31f6={};_0x2a31f6[_0x525b59['additionalSearchLead']]=_0x1855e7;_[_0xf563('0x31')](_0x163202[_0xf563('0x32')],_0x2a31f6);}return _0x131810[_0xf563('0x1d')](_0xf563('0x38'))[_0xf563('0x21')](_0x163202,_0x4c00af);}});}});case'contact':var _0x4cb630=_[_0xf563('0x2f')](_0x4d5357);if(_0x525b59['additionalSearchContact']){var _0x990650={};_0x990650[_0x525b59[_0xf563('0x30')]]=_0x1855e7;_['merge'](_0x4cb630[_0xf563('0x32')],_0x990650);}return _0x131810[_0xf563('0x1d')]('Contact')[_0xf563('0x21')](_0x4cb630,_0x4c00af)[_0xf563('0x22')]();case _0xf563('0x13'):var _0x218f1d=_[_0xf563('0x2f')](_0x4d5357);if(_0x525b59[_0xf563('0x35')]){var _0x990650={};_0x990650[_0x525b59[_0xf563('0x35')]]=_0x1855e7;_[_0xf563('0x31')](_0x218f1d[_0xf563('0x32')],_0x990650);}return _0x131810[_0xf563('0x1d')](_0xf563('0x38'))[_0xf563('0x21')](_0x218f1d,_0x4c00af);case _0xf563('0x15'):var _0x5b914c=_[_0xf563('0x2f')](_0x4d5357);if(_0x525b59[_0xf563('0x39')]){var _0x990650={};_0x990650[_0x525b59[_0xf563('0x39')]]=_0x1855e7;_[_0xf563('0x31')](_0x5b914c[_0xf563('0x32')],_0x990650);}return _0x131810[_0xf563('0x1d')](_0xf563('0x37'))['find'](_0x5b914c,_0x4c00af);default:return null;}})[_0xf563('0x29')](function(_0x456115){if(_0x456115&&_0x456115['length']){var _0x4392e2=_[_0xf563('0x3a')](_0x456115);if(_0x4392e2){return BPromise[_0xf563('0x25')]({'id':_0x4392e2['Id'],'name':_0x4392e2['Name'],'phone':_0x4392e2[_0xf563('0x3b')],'endUserType':_0x4392e2[_0xf563('0x3c')][_0xf563('0x3d')][_0xf563('0x3e')]()});}}})[_0xf563('0x29')](function(_0x5d181c){if(_0x5d181c){logger[_0xf563('0x1b')](_0xf563('0x3f'),_0x5d181c[_0xf563('0x11')],_0x1855e7);return BPromise[_0xf563('0x25')](_0x5d181c);}else{logger[_0xf563('0x1b')](_0xf563('0x40'),_0x1855e7);var _0x54666f={'Phone':_0x1855e7};if(_0x525b59[_0xf563('0x41')]){if(_0x525b59[_0xf563('0x41')]===_0xf563('0x12')){logger['info']('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x1855e7,_0x525b59[_0xf563('0x41')]);_0x54666f[_0xf563('0x42')]=_0x19abe3!==_0xf563('0x43')?_0x19abe3:util['format'](_0xf563('0x44'),_0x1855e7);}else if(_0x525b59[_0xf563('0x41')]==='lead'){logger[_0xf563('0x1b')](_0xf563('0x45'),_0x1855e7,_0x525b59[_0xf563('0x41')]);_0x54666f[_0xf563('0x42')]=_0x19abe3!==_0xf563('0x43')?_0x19abe3:util['format'](_0xf563('0x44'),_0x1855e7);_0x54666f[_0xf563('0x46')]='No\x20Company';}else if(_0x525b59[_0xf563('0x41')]===_0xf563('0x15')){logger[_0xf563('0x1b')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x1855e7,_0x525b59['moduleCreate']);_0x54666f[_0xf563('0x26')]=_0x19abe3!==_0xf563('0x43')?_0x19abe3:util[_0xf563('0x47')](_0xf563('0x44'),_0x1855e7);}else{return null;}}return _0x131810[_0xf563('0x1d')](_[_0xf563('0x48')](_0x525b59[_0xf563('0x41')]))['create'](_0x54666f)[_0xf563('0x29')](function(_0x11b83f){return BPromise['resolve']({'id':_0x11b83f['id'],'endUserType':_0x525b59[_0xf563('0x41')]});});}});}function getCustomFields(_0x22f133,_0x505e7c){var _0x57f469={};if(_0x22f133['length']>0x0){_[_0xf563('0x49')](_0x22f133,function(_0x24a973){if(_['includes']([_0xf563('0x4a'),_0xf563('0x4b')],_0x24a973['type'])&&_0x24a973['idField']){_0x57f469[_0x24a973['idField']]=_0x24a973['content'][_0xf563('0x4c')]();}else if(_0x24a973[_0xf563('0x3d')]===_0xf563('0x4d')&&_0x24a973[_0xf563('0x4e')]&&_0x24a973['idField']){_0x505e7c[_0x24a973[_0xf563('0x4e')]]&&(_0x57f469[_0x24a973[_0xf563('0x4f')]]=_0x505e7c[_0x24a973['variableName']][_0xf563('0x4c')]());}else if(_0x24a973[_0xf563('0x3d')]===_0xf563('0x50')&&_0x24a973[_0xf563('0x51')]&&_0x24a973[_0xf563('0x51')][_0xf563('0x52')]&&_0x24a973[_0xf563('0x4f')]){_0x505e7c[_0x24a973['Variable'][_0xf563('0x52')][_0xf563('0x3e')]()]&&(_0x57f469[_0x24a973[_0xf563('0x4f')]]=_0x505e7c[_0x24a973['Variable'][_0xf563('0x52')][_0xf563('0x3e')]()][_0xf563('0x4c')]());}});}return _0x57f469;}function getConnection(_0x4b9fdc){var _0x63ce3=_0x4b9fdc[_0xf563('0x53')][_0xf563('0x54')](_0x4b9fdc[_0xf563('0x55')]);var _0x43b70c=new jsforce[(_0xf563('0x56'))]({'oauth2':{'loginUrl':_0x4b9fdc['remoteUri']||_0xf563('0x57'),'clientId':_0x4b9fdc['clientId'],'clientSecret':_0x4b9fdc[_0xf563('0x58')]}});return _0x43b70c['login'](_0x4b9fdc[_0xf563('0x59')],_0x63ce3)[_0xf563('0x29')](function(){logger[_0xf563('0x1b')](_0xf563('0x5a'));return _0x43b70c;});}exports[_0xf563('0x5b')]=function(_0x50de5c,_0x357c9a,_0x4be668,_0x3a0548,_0x3844c5,_0x506fb5){var _0x2983dd,_0x526db2,_0x598b2c,_0xf84b57;_0x506fb5[_0xf563('0x5c')]=intUtil[_0xf563('0x5d')](_0x506fb5[_0xf563('0x5c')]);_0x506fb5[_0xf563('0x5e')]=intUtil['stripTrailingSlash'](_0x506fb5[_0xf563('0x5e')]);if(_0x3844c5&&_0x3844c5[_0xf563('0x5f')]){logger[_0xf563('0x1b')](_0xf563('0x60'),'Recording\x20is\x20enabled!');_0x357c9a[_0xf563('0x61')]=util[_0xf563('0x47')](_0xf563('0x62'),_0x506fb5['serverUrl'],_0x357c9a[_0xf563('0x63')],md5(_0x357c9a[_0xf563('0x63')]));}else{_0x357c9a['recordingURL']='';}return getConnection(_0x506fb5)['then'](function(_0x4a34ab){_0xf84b57=_0x4a34ab;return getUser(_0x506fb5,_0x3a0548[_0xf563('0x64')],_0xf84b57);})[_0xf563('0x29')](function(_0x84779b){_0x2983dd=_0x84779b;return getEndUser(_0x506fb5,_0x4be668,_0x357c9a[_0xf563('0x65')],_0x357c9a[_0xf563('0x66')],_0xf84b57);})[_0xf563('0x29')](function(_0x170ef9){_0x526db2=_0x170ef9;return getTicket(_0x506fb5,_0x2983dd,_0x526db2,_0x4be668,_0x357c9a,_0x4be668['Fields'],_0xf84b57,_0xf563('0x5b'));})[_0xf563('0x29')](function(_0x539753){_0x598b2c=_0x539753;logger[_0xf563('0x1b')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x598b2c['id']);logger[_0xf563('0x1b')]('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x598b2c['id'],_0x3a0548['name'],_0x506fb5['type']);switch(_0x506fb5[_0xf563('0x3d')]){case _0xf563('0x67'):emit(util[_0xf563('0x47')](_0xf563('0x68'),_0x3a0548['name']),_0xf563('0x69'),{'recordId':_0x598b2c['id']});break;case _0xf563('0x6a'):emit(util['format']('user:%s',_0x3a0548[_0xf563('0x52')]),_0xf563('0x6b'),{'uri':util['format'](_0xf563('0x6c'),_0xf84b57[_0xf563('0x6d')],_0x598b2c['id'])});break;default:logger['error'](_0xf563('0x6e'));}})[_0xf563('0x6f')](function(_0x807f60){logger[_0xf563('0x70')](_0xf563('0x60'),_0x807f60);});};exports[_0xf563('0x71')]=function(_0x244b38,_0x63c488,_0x2bfeec,_0x3b8c8a,_0xac3126,_0x386ce2,_0x48eccb){var _0x1cdbd0,_0x3b8711,_0x2a7638,_0xfebbd;_0x386ce2[_0xf563('0x5c')]=intUtil[_0xf563('0x5d')](_0x386ce2[_0xf563('0x5c')]);_0x386ce2['remoteUri']=intUtil[_0xf563('0x5d')](_0x386ce2[_0xf563('0x5e')]);if(_0x48eccb&&_0x48eccb['recordingFormat']&&_0x48eccb[_0xf563('0x72')]!==_0xf563('0x73')){logger[_0xf563('0x1b')](_0xf563('0x74'),_0xf563('0x75'));_0x63c488['recordingURL']=util['format'](_0xf563('0x62'),_0x386ce2[_0xf563('0x5c')],_0x63c488['uniqueid'],md5(_0x63c488['uniqueid']));}return getConnection(_0x386ce2)[_0xf563('0x29')](function(_0x5e55f1){_0xfebbd=_0x5e55f1;return getUser(_0x386ce2,_0x3b8c8a[_0xf563('0x64')],_0xfebbd);})[_0xf563('0x29')](function(_0x4579d2){_0x1cdbd0=_0x4579d2;return getEndUser(_0x386ce2,_0x2bfeec,_0x63c488[_0xf563('0x76')],_0x63c488['destcalleridnum'],_0xfebbd);})[_0xf563('0x29')](function(_0x44dbc0){_0x3b8711=_0x44dbc0;return getTicket(_0x386ce2,_0x1cdbd0,_0x3b8711,_0x2bfeec,_0x63c488,_0x2bfeec[_0xf563('0x77')],_0xfebbd,_0xf563('0x71'));})['then'](function(_0x229f3f){_0x2a7638=_0x229f3f;logger[_0xf563('0x1b')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x2a7638['id']);logger[_0xf563('0x1b')](_0xf563('0x78'),_0x2a7638['id'],_0x3b8c8a[_0xf563('0x52')],_0x386ce2[_0xf563('0x3d')]);switch(_0x386ce2[_0xf563('0x3d')]){case _0xf563('0x67'):emit(util[_0xf563('0x47')]('user:%s',_0x3b8c8a[_0xf563('0x52')]),'trigger:salesforce:display',{'recordId':_0x2a7638['id']});break;case _0xf563('0x6a'):emit(util[_0xf563('0x47')]('user:%s',_0x3b8c8a[_0xf563('0x52')]),_0xf563('0x6b'),{'uri':util[_0xf563('0x47')]('%s/%s/e',_0xfebbd['instanceUrl'],_0x2a7638['id'])});break;default:logger[_0xf563('0x70')](_0xf563('0x74'),_0xf563('0x79'));}})[_0xf563('0x6f')](function(_0x395fe5){logger[_0xf563('0x70')]('[OUTBOUND]',_0x395fe5);});};exports['unmanaged']=function(_0x1a7de8,_0x230f1a,_0x10c907,_0x5d1647,_0xed0381,_0x2baf5f){var _0x49d294,_0x1278bc,_0xa11b0f,_0x1540e8;_0x2baf5f[_0xf563('0x5c')]=intUtil[_0xf563('0x5d')](_0x2baf5f[_0xf563('0x5c')]);_0x2baf5f[_0xf563('0x5e')]=intUtil[_0xf563('0x5d')](_0x2baf5f[_0xf563('0x5e')]);if(_0xed0381&&_0xed0381[_0xf563('0x5f')]){logger['info']('['+_0x230f1a[_0xf563('0x7a')][_0xf563('0x7b')]()+']',_0xf563('0x75'));_0x230f1a[_0xf563('0x61')]=util[_0xf563('0x47')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2baf5f[_0xf563('0x5c')],_0x230f1a[_0xf563('0x63')],md5(_0x230f1a[_0xf563('0x63')]));}else{_0x230f1a[_0xf563('0x61')]='';}return getConnection(_0x2baf5f)[_0xf563('0x29')](function(_0x261017){_0x1540e8=_0x261017;if(!_['isNil'](_0x5d1647)){return getUser(_0x2baf5f,_0x5d1647[_0xf563('0x52')],_0x1540e8);}else{return getUser(_0x2baf5f,null,_0x1540e8);}})['then'](function(_0x4a3c8d){_0x49d294=_0x4a3c8d;return getEndUser(_0x2baf5f,_0x10c907,_0x230f1a[_0xf563('0x65')],_0x230f1a[_0xf563('0x66')],_0x1540e8);})['then'](function(_0xda2b82){_0x1278bc=_0xda2b82;return getTicket(_0x2baf5f,_0x49d294,_0x1278bc,_0x10c907,_0x230f1a,_0x10c907['Fields'],_0x1540e8);})[_0xf563('0x29')](function(_0x421574){_0xa11b0f=_0x421574;logger[_0xf563('0x1b')]('['+_0x230f1a[_0xf563('0x7a')][_0xf563('0x7b')]()+_0xf563('0x7c'),_0xa11b0f['id']);logger['info']('['+_0x230f1a[_0xf563('0x7a')]['toUpperCase']()+_0xf563('0x7d'),_0x2baf5f[_0xf563('0x3d')]);})[_0xf563('0x6f')](function(_0x34e689){logger['error']('['+_0x230f1a[_0xf563('0x7a')][_0xf563('0x7b')]()+']',_0x34e689);});}; \ No newline at end of file +var _0x09aa=['variableName','customVariable','Variable','name','password','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','calleridname','calleridnum','Fields','queue','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','trigger:salesforce:display','user:%s','trigger:browser:url','%s/%s/e','instanceUrl','error','recordingFormat','none','[OUTBOUND]','email','destcalleridname','destcalleridnum','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','newTab','Salesforce\x20account\x20type\x20not\x20recognized','catch','stripTrailingSlash','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','moment','bluebird','md5','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','socket.io-emitter','emit','assign','getString','Subjects','Descriptions','ticketType','Task','ActivityDate','utc','IsReminderSet','endUserType','contact','lead','WhoId','WhatId','ContactId','account','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','isNil','validateEmail','find','execute','then','Email','Agent\x20%s\x20found.','resolve','user_id','display_name','identity','moduleSearch','contact_lead','additionalSearchContact','merge','$or','Contact','cloneDeep','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','Account','length','first','Name','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','Company','No\x20Company','upperFirst','forEach','includes','string','picklist','idField','toString','variable'];(function(_0x557383,_0x227505){var _0x4afb9c=function(_0x3aa220){while(--_0x3aa220){_0x557383['push'](_0x557383['shift']());}};_0x4afb9c(++_0x227505);}(_0x09aa,0x134));var _0xa09a=function(_0x4a8e82,_0x4c53c1){_0x4a8e82=_0x4a8e82-0x0;var _0x3ba3e6=_0x09aa[_0x4a8e82];return _0x3ba3e6;};'use strict';var _=require(_0xa09a('0x0'));var rp=require('request-promise');var moment=require(_0xa09a('0x1'));var BPromise=require(_0xa09a('0x2'));var md5=require(_0xa09a('0x3'));var jsforce=require(_0xa09a('0x4'));var util=require(_0xa09a('0x5'));var Redis=require(_0xa09a('0x6'));var intUtil=require(_0xa09a('0x7'));var config=require(_0xa09a('0x8'));var logger=require(_0xa09a('0x9'))(_0xa09a('0xa'));config[_0xa09a('0xb')]=_['defaults'](config[_0xa09a('0xb')],{'host':'localhost','port':0x18eb});var io=require(_0xa09a('0xc'))(new Redis(config['redis']));function emit(_0xc8ec2b,_0x56be71,_0x5d2a8c){io['to'](_0xc8ec2b)[_0xa09a('0xd')](_0x56be71,_0x5d2a8c);}function getTicket(_0x885761,_0x2f586f,_0x5e822c,_0x52d892,_0x1306e6,_0x2038f8,_0x49136c,_0x507b80){var _0x32d7e3=Object[_0xa09a('0xe')]({},{'OwnerId':_0x2f586f['id'],'Subject':intUtil[_0xa09a('0xf')](_0x52d892[_0xa09a('0x10')],_0x1306e6,'\x20'),'Description':intUtil['getString'](_0x52d892[_0xa09a('0x11')],_0x1306e6,'\x0a')},getCustomFields(_0x2038f8,_0x1306e6));if(_0x5e822c){if(_0x52d892[_0xa09a('0x12')]===_0xa09a('0x13')){_0x32d7e3[_0xa09a('0x14')]=moment[_0xa09a('0x15')]();_0x32d7e3[_0xa09a('0x16')]=![];_0x32d7e3['IsRecurrence']=![];if(_0x5e822c[_0xa09a('0x17')]===_0xa09a('0x18')||_0x5e822c[_0xa09a('0x17')]===_0xa09a('0x19')){_0x32d7e3[_0xa09a('0x1a')]=_0x5e822c['id'];}else if(_0x5e822c[_0xa09a('0x17')]==='account'){_0x32d7e3[_0xa09a('0x1b')]=_0x5e822c['id'];}}else if(_0x52d892['ticketType']==='Case'){if(_0x5e822c[_0xa09a('0x17')]==='contact'){_0x32d7e3[_0xa09a('0x1c')]=_0x5e822c['id'];}else if(_0x5e822c[_0xa09a('0x17')]===_0xa09a('0x1d')){_0x32d7e3[_0xa09a('0x1e')]=_0x5e822c['id'];}else if(_0x5e822c[_0xa09a('0x17')]==='lead'&&_0x52d892[_0xa09a('0x1f')]){_0x32d7e3[_0x52d892[_0xa09a('0x1f')]]=_0x5e822c['id'];}else{logger[_0xa09a('0x20')](_0xa09a('0x21'));}}}return _0x49136c[_0xa09a('0x22')](_0x52d892[_0xa09a('0x12')])['create'](_0x32d7e3);}function getUser(_0x27730c,_0x115e38,_0x33f9fc){if(!_[_0xa09a('0x23')](_0x115e38)&&intUtil[_0xa09a('0x24')](_0x115e38)){var _0x219dab={'Email':_0x115e38};var _0x693e97={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x33f9fc[_0xa09a('0x22')]('User')[_0xa09a('0x25')](_0x219dab,_0x693e97)[_0xa09a('0x26')]()[_0xa09a('0x27')](function(_0x385b3c){if(_0x385b3c['length']){var _0x11f234=_[_0xa09a('0x25')](_0x385b3c,function(_0x5dfcd4){return _0x5dfcd4[_0xa09a('0x28')]===_0x115e38;});if(_0x11f234){logger[_0xa09a('0x20')](_0xa09a('0x29'),_0x115e38);return BPromise[_0xa09a('0x2a')]({'id':_0x11f234['Id'],'name':_0x11f234['Name']});}}else{logger[_0xa09a('0x20')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x115e38);return _0x33f9fc['identity']()[_0xa09a('0x27')](function(_0x1044c1){return BPromise[_0xa09a('0x2a')]({'id':_0x1044c1[_0xa09a('0x2b')],'name':_0x1044c1[_0xa09a('0x2c')]});});}});}else{logger[_0xa09a('0x20')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x115e38);return _0x33f9fc[_0xa09a('0x2d')]()['then'](function(_0x250e7e){return BPromise[_0xa09a('0x2a')]({'id':_0x250e7e['user_id'],'name':_0x250e7e[_0xa09a('0x2c')]});});}}function getEndUser(_0x492ef2,_0x3fe2d8,_0xf41fc,_0xff0337,_0x8ac8dc){var _0x163509={'$or':{'Phone':_0xff0337}};var _0x182b70={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xa09a('0x2a')]()['then'](function(){logger[_0xa09a('0x20')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0xff0337,_0x3fe2d8[_0xa09a('0x2e')]);switch(_0x3fe2d8[_0xa09a('0x2e')]){case _0xa09a('0x2f'):var _0x48d44c=_['cloneDeep'](_0x163509);if(_0x3fe2d8[_0xa09a('0x30')]){var _0x389ade={};_0x389ade[_0x3fe2d8[_0xa09a('0x30')]]=_0xff0337;_[_0xa09a('0x31')](_0x48d44c[_0xa09a('0x32')],_0x389ade);}return _0x8ac8dc['sobject'](_0xa09a('0x33'))[_0xa09a('0x25')](_0x48d44c,_0x182b70)[_0xa09a('0x26')]()[_0xa09a('0x27')](function(_0x56d67e){if(_0x56d67e&&_0x56d67e['length']){return _0x56d67e;}else{var _0xc42203=_[_0xa09a('0x34')](_0x163509);if(_0x3fe2d8[_0xa09a('0x35')]){var _0x525ca1={};_0x525ca1[_0x3fe2d8[_0xa09a('0x35')]]=_0xff0337;_[_0xa09a('0x31')](_0xc42203['$or'],_0x525ca1);}return _0x8ac8dc[_0xa09a('0x22')](_0xa09a('0x36'))[_0xa09a('0x25')](_0xc42203,_0x182b70);}});case _0xa09a('0x37'):var _0x229736=_['cloneDeep'](_0x163509);if(_0x3fe2d8[_0xa09a('0x38')]){var _0x389ade={};_0x389ade[_0x3fe2d8[_0xa09a('0x38')]]=_0xff0337;_[_0xa09a('0x31')](_0x229736[_0xa09a('0x32')],_0x389ade);}return _0x8ac8dc['sobject'](_0xa09a('0x39'))[_0xa09a('0x25')](_0x229736,_0x182b70)[_0xa09a('0x26')]()[_0xa09a('0x27')](function(_0x27866a){if(_0x27866a&&_0x27866a[_0xa09a('0x3a')]){return _0x27866a;}else{var _0x11728d=_[_0xa09a('0x34')](_0x163509);if(_0x3fe2d8[_0xa09a('0x30')]){var _0x376739={};_0x376739[_0x3fe2d8['additionalSearchContact']]=_0xff0337;_['merge'](_0x11728d[_0xa09a('0x32')],_0x376739);}return _0x8ac8dc[_0xa09a('0x22')](_0xa09a('0x33'))[_0xa09a('0x25')](_0x11728d,_0x182b70)[_0xa09a('0x27')](function(_0x2241b8){if(_0x2241b8&&_0x2241b8[_0xa09a('0x3a')]){return _0x2241b8;}else{var _0x517d80=_[_0xa09a('0x34')](_0x163509);if(_0x3fe2d8[_0xa09a('0x35')]){var _0x5acbde={};_0x5acbde[_0x3fe2d8[_0xa09a('0x35')]]=_0xff0337;_[_0xa09a('0x31')](_0x517d80['$or'],_0x5acbde);}return _0x8ac8dc[_0xa09a('0x22')]('Lead')[_0xa09a('0x25')](_0x517d80,_0x182b70);}});}});case _0xa09a('0x18'):var _0x48d44c=_['cloneDeep'](_0x163509);if(_0x3fe2d8[_0xa09a('0x30')]){var _0x389ade={};_0x389ade[_0x3fe2d8[_0xa09a('0x30')]]=_0xff0337;_[_0xa09a('0x31')](_0x48d44c[_0xa09a('0x32')],_0x389ade);}return _0x8ac8dc['sobject']('Contact')[_0xa09a('0x25')](_0x48d44c,_0x182b70)[_0xa09a('0x26')]();case'lead':var _0x2e77fb=_['cloneDeep'](_0x163509);if(_0x3fe2d8[_0xa09a('0x35')]){var _0x389ade={};_0x389ade[_0x3fe2d8[_0xa09a('0x35')]]=_0xff0337;_[_0xa09a('0x31')](_0x2e77fb[_0xa09a('0x32')],_0x389ade);}return _0x8ac8dc[_0xa09a('0x22')](_0xa09a('0x36'))[_0xa09a('0x25')](_0x2e77fb,_0x182b70);case _0xa09a('0x1d'):var _0x229736=_[_0xa09a('0x34')](_0x163509);if(_0x3fe2d8[_0xa09a('0x38')]){var _0x389ade={};_0x389ade[_0x3fe2d8['additionalSearchAccount']]=_0xff0337;_[_0xa09a('0x31')](_0x229736[_0xa09a('0x32')],_0x389ade);}return _0x8ac8dc[_0xa09a('0x22')](_0xa09a('0x39'))[_0xa09a('0x25')](_0x229736,_0x182b70);default:return null;}})[_0xa09a('0x27')](function(_0x44880a){if(_0x44880a&&_0x44880a[_0xa09a('0x3a')]){var _0x31852c=_[_0xa09a('0x3b')](_0x44880a);if(_0x31852c){return BPromise['resolve']({'id':_0x31852c['Id'],'name':_0x31852c[_0xa09a('0x3c')],'phone':_0x31852c[_0xa09a('0x3d')],'endUserType':_0x31852c[_0xa09a('0x3e')][_0xa09a('0x3f')][_0xa09a('0x40')]()});}}})[_0xa09a('0x27')](function(_0x3d577e){if(_0x3d577e){logger['info'](_0xa09a('0x41'),_0x3d577e[_0xa09a('0x17')],_0xff0337);return BPromise[_0xa09a('0x2a')](_0x3d577e);}else{logger['info']('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0xff0337);var _0xae6f72={'Phone':_0xff0337};if(_0x3fe2d8[_0xa09a('0x42')]){if(_0x3fe2d8[_0xa09a('0x42')]===_0xa09a('0x18')){logger[_0xa09a('0x20')](_0xa09a('0x43'),_0xff0337,_0x3fe2d8['moduleCreate']);_0xae6f72[_0xa09a('0x44')]=_0xf41fc!==_0xa09a('0x45')?_0xf41fc:util[_0xa09a('0x46')](_0xa09a('0x47'),_0xff0337);}else if(_0x3fe2d8[_0xa09a('0x42')]===_0xa09a('0x19')){logger[_0xa09a('0x20')](_0xa09a('0x43'),_0xff0337,_0x3fe2d8['moduleCreate']);_0xae6f72['LastName']=_0xf41fc!==_0xa09a('0x45')?_0xf41fc:util['format'](_0xa09a('0x47'),_0xff0337);_0xae6f72[_0xa09a('0x48')]=_0xa09a('0x49');}else if(_0x3fe2d8[_0xa09a('0x42')]===_0xa09a('0x1d')){logger[_0xa09a('0x20')](_0xa09a('0x43'),_0xff0337,_0x3fe2d8['moduleCreate']);_0xae6f72[_0xa09a('0x3c')]=_0xf41fc!==_0xa09a('0x45')?_0xf41fc:util[_0xa09a('0x46')](_0xa09a('0x47'),_0xff0337);}else{return null;}}return _0x8ac8dc[_0xa09a('0x22')](_[_0xa09a('0x4a')](_0x3fe2d8[_0xa09a('0x42')]))['create'](_0xae6f72)[_0xa09a('0x27')](function(_0x5dd820){return BPromise[_0xa09a('0x2a')]({'id':_0x5dd820['id'],'endUserType':_0x3fe2d8[_0xa09a('0x42')]});});}});}function getCustomFields(_0x4fb85f,_0x2cc4fe){var _0x181faf={};if(_0x4fb85f[_0xa09a('0x3a')]>0x0){_[_0xa09a('0x4b')](_0x4fb85f,function(_0x258dbd){if(_[_0xa09a('0x4c')]([_0xa09a('0x4d'),_0xa09a('0x4e')],_0x258dbd[_0xa09a('0x3f')])&&_0x258dbd[_0xa09a('0x4f')]){_0x181faf[_0x258dbd[_0xa09a('0x4f')]]=_0x258dbd['content'][_0xa09a('0x50')]();}else if(_0x258dbd[_0xa09a('0x3f')]===_0xa09a('0x51')&&_0x258dbd[_0xa09a('0x52')]&&_0x258dbd[_0xa09a('0x4f')]){_0x2cc4fe[_0x258dbd['variableName']]&&(_0x181faf[_0x258dbd[_0xa09a('0x4f')]]=_0x2cc4fe[_0x258dbd[_0xa09a('0x52')]][_0xa09a('0x50')]());}else if(_0x258dbd[_0xa09a('0x3f')]===_0xa09a('0x53')&&_0x258dbd['Variable']&&_0x258dbd[_0xa09a('0x54')][_0xa09a('0x55')]&&_0x258dbd[_0xa09a('0x4f')]){_0x2cc4fe[_0x258dbd[_0xa09a('0x54')][_0xa09a('0x55')]['toLowerCase']()]&&(_0x181faf[_0x258dbd[_0xa09a('0x4f')]]=_0x2cc4fe[_0x258dbd[_0xa09a('0x54')][_0xa09a('0x55')][_0xa09a('0x40')]()][_0xa09a('0x50')]());}});}return _0x181faf;}function getConnection(_0xa81745){var _0x2a1ed3=_0xa81745[_0xa09a('0x56')]['concat'](_0xa81745[_0xa09a('0x57')]);var _0x50fa8e=new jsforce[(_0xa09a('0x58'))]({'oauth2':{'loginUrl':_0xa81745[_0xa09a('0x59')]||_0xa09a('0x5a'),'clientId':_0xa81745[_0xa09a('0x5b')],'clientSecret':_0xa81745[_0xa09a('0x5c')]}});return _0x50fa8e[_0xa09a('0x5d')](_0xa81745[_0xa09a('0x5e')],_0x2a1ed3)[_0xa09a('0x27')](function(){logger['info'](_0xa09a('0x5f'));return _0x50fa8e;});}exports['queue']=function(_0x1d81e3,_0x3a4ae0,_0x258394,_0x5cb66b,_0x3e6c9c,_0x74e50a){var _0xbffd,_0x4ea4ef,_0x5582f7,_0xfe1ee4;_0x74e50a[_0xa09a('0x60')]=intUtil['stripTrailingSlash'](_0x74e50a['serverUrl']);_0x74e50a[_0xa09a('0x59')]=intUtil['stripTrailingSlash'](_0x74e50a[_0xa09a('0x59')]);if(_0x3e6c9c&&_0x3e6c9c[_0xa09a('0x61')]){logger[_0xa09a('0x20')](_0xa09a('0x62'),_0xa09a('0x63'));_0x3a4ae0[_0xa09a('0x64')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x74e50a[_0xa09a('0x60')],_0x3a4ae0['uniqueid'],md5(_0x3a4ae0[_0xa09a('0x65')]));}else{_0x3a4ae0[_0xa09a('0x64')]='';}return getConnection(_0x74e50a)[_0xa09a('0x27')](function(_0x42c3db){_0xfe1ee4=_0x42c3db;return getUser(_0x74e50a,_0x5cb66b['email'],_0xfe1ee4);})['then'](function(_0x2839a8){_0xbffd=_0x2839a8;return getEndUser(_0x74e50a,_0x258394,_0x3a4ae0[_0xa09a('0x66')],_0x3a4ae0[_0xa09a('0x67')],_0xfe1ee4);})[_0xa09a('0x27')](function(_0x2e3875){_0x4ea4ef=_0x2e3875;return getTicket(_0x74e50a,_0xbffd,_0x4ea4ef,_0x258394,_0x3a4ae0,_0x258394[_0xa09a('0x68')],_0xfe1ee4,_0xa09a('0x69'));})[_0xa09a('0x27')](function(_0x1bd004){_0x5582f7=_0x1bd004;logger['info'](_0xa09a('0x6a'),_0x5582f7['id']);logger[_0xa09a('0x20')](_0xa09a('0x6b'),_0x5582f7['id'],_0x5cb66b[_0xa09a('0x55')],_0x74e50a['type']);switch(_0x74e50a['type']){case _0xa09a('0x6c'):emit(util[_0xa09a('0x46')]('user:%s',_0x5cb66b['name']),_0xa09a('0x6d'),{'recordId':_0x5582f7['id']});break;case'newTab':emit(util[_0xa09a('0x46')](_0xa09a('0x6e'),_0x5cb66b['name']),_0xa09a('0x6f'),{'uri':util[_0xa09a('0x46')](_0xa09a('0x70'),_0xfe1ee4[_0xa09a('0x71')],_0x5582f7['id'])});break;default:logger[_0xa09a('0x72')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})['catch'](function(_0x3e769a){logger[_0xa09a('0x72')]('[QUEUE]',_0x3e769a);});};exports['outbound']=function(_0x2738b6,_0x5a405c,_0x9f80d0,_0x5856c3,_0x11e7f5,_0x8d0052,_0x136347){var _0xe84a8,_0x2cdf10,_0x2c4199,_0x2e608c;_0x8d0052[_0xa09a('0x60')]=intUtil['stripTrailingSlash'](_0x8d0052[_0xa09a('0x60')]);_0x8d0052[_0xa09a('0x59')]=intUtil['stripTrailingSlash'](_0x8d0052[_0xa09a('0x59')]);if(_0x136347&&_0x136347[_0xa09a('0x73')]&&_0x136347[_0xa09a('0x73')]!==_0xa09a('0x74')){logger[_0xa09a('0x20')](_0xa09a('0x75'),'Recording\x20is\x20enabled!');_0x5a405c[_0xa09a('0x64')]=util[_0xa09a('0x46')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x8d0052[_0xa09a('0x60')],_0x5a405c[_0xa09a('0x65')],md5(_0x5a405c[_0xa09a('0x65')]));}return getConnection(_0x8d0052)[_0xa09a('0x27')](function(_0x5b3a90){_0x2e608c=_0x5b3a90;return getUser(_0x8d0052,_0x5856c3[_0xa09a('0x76')],_0x2e608c);})[_0xa09a('0x27')](function(_0x4e5830){_0xe84a8=_0x4e5830;return getEndUser(_0x8d0052,_0x9f80d0,_0x5a405c[_0xa09a('0x77')],_0x5a405c[_0xa09a('0x78')],_0x2e608c);})[_0xa09a('0x27')](function(_0x878b00){_0x2cdf10=_0x878b00;return getTicket(_0x8d0052,_0xe84a8,_0x2cdf10,_0x9f80d0,_0x5a405c,_0x9f80d0['Fields'],_0x2e608c,'outbound');})['then'](function(_0x4493fe){_0x2c4199=_0x4493fe;logger['info']('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x2c4199['id']);logger['info'](_0xa09a('0x79'),_0x2c4199['id'],_0x5856c3[_0xa09a('0x55')],_0x8d0052[_0xa09a('0x3f')]);switch(_0x8d0052[_0xa09a('0x3f')]){case _0xa09a('0x6c'):emit(util[_0xa09a('0x46')](_0xa09a('0x6e'),_0x5856c3['name']),_0xa09a('0x6d'),{'recordId':_0x2c4199['id']});break;case _0xa09a('0x7a'):emit(util[_0xa09a('0x46')](_0xa09a('0x6e'),_0x5856c3['name']),_0xa09a('0x6f'),{'uri':util[_0xa09a('0x46')](_0xa09a('0x70'),_0x2e608c[_0xa09a('0x71')],_0x2c4199['id'])});break;default:logger['error'](_0xa09a('0x75'),_0xa09a('0x7b'));}})[_0xa09a('0x7c')](function(_0x239f8e){logger[_0xa09a('0x72')](_0xa09a('0x75'),_0x239f8e);});};exports['unmanaged']=function(_0x55f2d1,_0xe7c8ea,_0x1fac63,_0x2c31c9,_0x22d902,_0x44a5d5){var _0x4d4789,_0x4f3e29,_0x284a48,_0x2fca0c;_0x44a5d5[_0xa09a('0x60')]=intUtil[_0xa09a('0x7d')](_0x44a5d5[_0xa09a('0x60')]);_0x44a5d5['remoteUri']=intUtil['stripTrailingSlash'](_0x44a5d5['remoteUri']);if(_0x22d902&&_0x22d902['monitor_format']){logger[_0xa09a('0x20')]('['+_0xe7c8ea[_0xa09a('0x7e')][_0xa09a('0x7f')]()+']',_0xa09a('0x63'));_0xe7c8ea[_0xa09a('0x64')]=util[_0xa09a('0x46')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x44a5d5[_0xa09a('0x60')],_0xe7c8ea[_0xa09a('0x65')],md5(_0xe7c8ea['uniqueid']));}else{_0xe7c8ea[_0xa09a('0x64')]='';}return getConnection(_0x44a5d5)['then'](function(_0x55498e){_0x2fca0c=_0x55498e;if(!_[_0xa09a('0x23')](_0x2c31c9)){return getUser(_0x44a5d5,_0x2c31c9[_0xa09a('0x55')],_0x2fca0c);}else{return getUser(_0x44a5d5,null,_0x2fca0c);}})['then'](function(_0x144398){_0x4d4789=_0x144398;return getEndUser(_0x44a5d5,_0x1fac63,_0xe7c8ea[_0xa09a('0x66')],_0xe7c8ea[_0xa09a('0x67')],_0x2fca0c);})[_0xa09a('0x27')](function(_0x49ea5f){_0x4f3e29=_0x49ea5f;return getTicket(_0x44a5d5,_0x4d4789,_0x4f3e29,_0x1fac63,_0xe7c8ea,_0x1fac63['Fields'],_0x2fca0c);})['then'](function(_0x6f1f87){_0x284a48=_0x6f1f87;logger['info']('['+_0xe7c8ea[_0xa09a('0x7e')][_0xa09a('0x7f')]()+_0xa09a('0x80'),_0x284a48['id']);logger[_0xa09a('0x20')]('['+_0xe7c8ea[_0xa09a('0x7e')]['toUpperCase']()+_0xa09a('0x81'),_0x44a5d5['type']);})[_0xa09a('0x7c')](function(_0x5a5926){logger['error']('['+_0xe7c8ea['lastevent'][_0xa09a('0x7f')]()+']',_0x5a5926);});}; \ 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 350bacb..57f414e 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 _0xb92a=['username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','%s/api/now/table/','isNil','email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','lodash','bluebird','md5','ioredis','./util','../../../../config/logger','servicenow','redis','defaults','localhost','socket.io-emitter','GET','then','length','adminId','result','sys_id','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','],\x20getUser\x20rp\x20obj','info','active','true','userId','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','adminEmail','POST','sys_user?','endUserNumber','user','System','],\x20EndUser\x20schema','sys_user?sysparm_query=phone%3D','endUserId','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','toString','idField','variable','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Subjects','Descriptions','Fields','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident','Incident\x20-\x20','all','push','Tags','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url'];(function(_0xdb8964,_0x292b19){var _0x50f39e=function(_0x317bc5){while(--_0x317bc5){_0xdb8964['push'](_0xdb8964['shift']());}};_0x50f39e(++_0x292b19);}(_0xb92a,0x166));var _0xab92=function(_0xd2f7d1,_0x436302){_0xd2f7d1=_0xd2f7d1-0x0;var _0x2db76e=_0xb92a[_0xd2f7d1];return _0x2db76e;};'use strict';var _=require(_0xab92('0x0'));var Promise=require(_0xab92('0x1'));var rp=require('request-promise');var util=require('util');var md5=require(_0xab92('0x2'));var Redis=require(_0xab92('0x3'));var intUtil=require(_0xab92('0x4'));var config=require('../../../../config/environment');var logger=require(_0xab92('0x5'))(_0xab92('0x6'));config[_0xab92('0x7')]=_[_0xab92('0x8')](config[_0xab92('0x7')],{'host':_0xab92('0x9'),'port':0x18eb});var io=require(_0xab92('0xa'))(new Redis(config[_0xab92('0x7')]));function getAdminUser(_0x2b413d,_0x3c09e1,_0x10c1a8,_0x18ea82,_0x1239e2,_0x2637c6){return new Promise(function(_0x278024,_0x5a0ce4){var _0x528bcc={'method':_0xab92('0xb'),'uri':_0x18ea82+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x1239e2+'&'+_0x2637c6,'auth':_0x3c09e1,'json':!![]};return rp(_0x528bcc)[_0xab92('0xc')](function(_0x529ffe){if(_0x529ffe['result'][_0xab92('0xd')]>0x0){_0x10c1a8[_0xab92('0xe')]=_0x529ffe[_0xab92('0xf')][0x0][_0xab92('0x10')];}logger['info']('['+[_0x2b413d[_0xab92('0x11')]()]+_0xab92('0x12'),_0x10c1a8);_0x278024(_0x10c1a8);})[_0xab92('0x13')](function(_0x3ec6a6){logger[_0xab92('0x14')]('['+[_0x2b413d[_0xab92('0x11')]()]+']',_0x3ec6a6[_0xab92('0x15')]);_0x5a0ce4(_0x3ec6a6[_0xab92('0x15')]);});});}function getUser(_0x5435d4,_0x56177a,_0x5a4b17,_0x54178c,_0x45c606){return function(_0x392bcb){logger['info']('['+[_0x5435d4[_0xab92('0x11')]()]+_0xab92('0x16'),_0x392bcb);return new Promise(function(_0x449f3f,_0x1bce57){if(intUtil[_0xab92('0x17')](_0x392bcb[_0xab92('0x18')])){var _0x495972={'method':_0xab92('0xb'),'uri':_0x5a4b17+'sys_user?sysparm_query=email%3D'+_0x392bcb[_0xab92('0x18')]+'&'+_0x54178c+'&'+_0x45c606,'auth':_0x56177a,'json':!![]};logger['info']('['+[_0x5435d4[_0xab92('0x11')]()]+_0xab92('0x19'),_0x495972);return rp(_0x495972)[_0xab92('0xc')](function(_0x3c0b77){logger[_0xab92('0x1a')]('['+[_0x5435d4[_0xab92('0x11')]()]+'],\x20getUser\x20entity',_0x3c0b77);if(_0x3c0b77[_0xab92('0xf')][_0xab92('0xd')]>0x0&&String(_0x3c0b77[_0xab92('0xf')][0x0][_0xab92('0x1b')])===_0xab92('0x1c')){_0x392bcb[_0xab92('0x1d')]=_0x3c0b77[_0xab92('0xf')][0x0][_0xab92('0x10')];}else{_0x392bcb['userId']=_0x392bcb[_0xab92('0xe')];_0x392bcb['userEmail']=_0x392bcb['adminEmail'];}logger[_0xab92('0x1a')]('['+[_0x5435d4['toUpperCase']()]+_0xab92('0x1e'),_0x392bcb);_0x449f3f(_0x392bcb);})[_0xab92('0x13')](function(_0x3b9639){logger[_0xab92('0x14')]('['+[_0x5435d4[_0xab92('0x11')]()]+']',_0x3b9639[_0xab92('0x15')]);_0x1bce57(_0x3b9639[_0xab92('0x15')]);});}else{logger[_0xab92('0x1a')]('['+[_0x5435d4[_0xab92('0x11')]()]+_0xab92('0x1f'));_0x392bcb['userId']=_0x392bcb[_0xab92('0xe')];_0x392bcb[_0xab92('0x18')]=_0x392bcb[_0xab92('0x20')];_0x449f3f(_0x392bcb);}});};}function createEndUser(_0x58686b,_0xace89e,_0x38357b,_0x1b6c4a,_0x1cacb9){logger[_0xab92('0x1a')]('['+[_0x58686b[_0xab92('0x11')]()]+'],\x20createEndUser\x20input\x20crm',_0x38357b);return new Promise(function(_0x23cab7,_0x4e06ed){var _0x12529f={'method':_0xab92('0x21'),'uri':_0x1b6c4a+_0xab92('0x22')+_0x1cacb9,'body':{'user_name':_0x38357b[_0xab92('0x23')],'roles':_0xab92('0x24'),'first_name':_0x38357b['endUserNumber'],'active':_0xab92('0x1c'),'date_format':_0xab92('0x25'),'phone':_0x38357b[_0xab92('0x23')]},'auth':_0xace89e,'json':!![]};return rp(_0x12529f)[_0xab92('0xc')](function(_0x39a1d9){logger[_0xab92('0x1a')]('['+[_0x58686b['toUpperCase']()]+_0xab92('0x26'),_0x39a1d9[_0xab92('0xf')]);_0x38357b['endUserId']=_0x39a1d9[_0xab92('0xf')][_0xab92('0x10')];_0x23cab7(_0x38357b);})[_0xab92('0x13')](function(_0x126689){logger['error']('['+[_0x58686b['toUpperCase']()]+']',_0x126689[_0xab92('0x15')]);_0x4e06ed(_0x126689[_0xab92('0x15')]);});});}function getEndUser(_0x2c8c9a,_0x4d9039,_0x5b2f68,_0x394422,_0x51a143){return function(_0x570504){logger[_0xab92('0x1a')]('['+[_0x2c8c9a[_0xab92('0x11')]()]+'],\x20getEndUser\x20input\x20crm',_0x570504);return new Promise(function(_0x2c75a5,_0x45b581){var _0x1bfd46={'method':_0xab92('0xb'),'uri':_0x5b2f68+_0xab92('0x27')+_0x570504['endUserNumber']+'&'+_0x394422+'&'+_0x51a143,'auth':_0x4d9039,'json':!![]};return rp(_0x1bfd46)[_0xab92('0xc')](function(_0x331e5f){if(_0x331e5f[_0xab92('0xf')]['length']>0x0){_0x570504[_0xab92('0x28')]=_0x331e5f[_0xab92('0xf')][0x0][_0xab92('0x10')];logger['info']('['+[_0x2c8c9a[_0xab92('0x11')]()]+_0xab92('0x29'),_0x570504);_0x2c75a5(_0x570504);}else{return createEndUser(_0x2c8c9a,_0x4d9039,_0x570504,_0x5b2f68,_0x394422)['then'](function(_0x154fa5){logger[_0xab92('0x1a')]('['+[_0x2c8c9a[_0xab92('0x11')]()]+_0xab92('0x2a'),_0x154fa5);_0x2c75a5(_0x154fa5);});}})['catch'](function(_0x2c3817){logger[_0xab92('0x14')]('['+[_0x2c8c9a[_0xab92('0x11')]()]+']',_0x2c3817[_0xab92('0x15')]);_0x45b581(_0x2c3817[_0xab92('0x15')]);});});};}function getCustomFields(_0xd569d0,_0x83d719){var _0x1a0571={};if(_0xd569d0[_0xab92('0xd')]>0x0){_[_0xab92('0x2b')](_0xd569d0,function(_0x2a35eb){if(_[_0xab92('0x2c')]([_0xab92('0x2d'),_0xab92('0x2e')],_0x2a35eb[_0xab92('0x2f')])&&_0x2a35eb[_0xab92('0x30')]&&!_0x2a35eb[_0xab92('0x31')]){_0x1a0571[_0x2a35eb[_0xab92('0x30')][_0xab92('0x32')]()]=_0x2a35eb[_0xab92('0x33')][_0xab92('0x34')]();}else if(_['includes']([_0xab92('0x2d'),'picklist'],_0x2a35eb[_0xab92('0x2f')])&&_0x2a35eb[_0xab92('0x35')]&&_0x2a35eb[_0xab92('0x31')]){_0x1a0571[_0x2a35eb['idField'][_0xab92('0x32')]()]=_0x2a35eb[_0xab92('0x33')][_0xab92('0x34')]();}else if(_0x2a35eb['type']===_0xab92('0x36')&&_0x2a35eb['variableName']&&_0x2a35eb['idField']&&_0x2a35eb[_0xab92('0x31')]){_0x1a0571[_0x2a35eb['idField'][_0xab92('0x32')]()]=_0x83d719[_0x2a35eb['variableName']][_0xab92('0x34')]();}else if(_0x2a35eb[_0xab92('0x2f')]===_0xab92('0x37')&&_0x2a35eb[_0xab92('0x38')]&&_0x2a35eb[_0xab92('0x38')][_0xab92('0x39')]&&_0x2a35eb[_0xab92('0x35')]&&_0x2a35eb[_0xab92('0x31')]){_0x1a0571[_0x2a35eb['idField']['toLowerCase']()]=_0x83d719[_0x2a35eb[_0xab92('0x38')][_0xab92('0x39')]['toLowerCase']()]['toString']();}});}return _0x1a0571;}function getTicket(_0x43dbe8,_0x117f66,_0x159b0f,_0x5df044,_0xe257b9,_0x2078b8){return function(_0x357cc1){logger[_0xab92('0x1a')]('['+[_0x43dbe8[_0xab92('0x11')]()]+_0xab92('0x3a'),_0x357cc1);return new Promise(function(_0x136cf9,_0x27747d){var _0x3fef70=_0x43dbe8['toLowerCase']()===_0xab92('0x3b')?_0x357cc1['userId']:_0x357cc1[_0xab92('0x28')];var _0x3a2d84={'method':_0xab92('0x21'),'uri':_0x159b0f+_0xab92('0x3c')+'?'+_0x2078b8,'body':Object[_0xab92('0x3d')]({},{'active':'true','caller_id':_0x3fef70,'assigned_to':_0x357cc1[_0xab92('0x1d')],'short_description':intUtil[_0xab92('0x3e')](_0x5df044[_0xab92('0x3f')],_0xe257b9,'\x20'),'description':intUtil[_0xab92('0x3e')](_0x5df044[_0xab92('0x40')],_0xe257b9,'\x0a')},getCustomFields(_0x5df044[_0xab92('0x41')],_0xe257b9)),'auth':_0x117f66,'json':!![]};return rp(_0x3a2d84)[_0xab92('0xc')](function(_0x3d0d80){logger['info']('['+[_0x43dbe8[_0xab92('0x11')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x3d0d80[_0xab92('0xf')]);_0x357cc1[_0xab92('0x42')]=_0x3d0d80[_0xab92('0xf')][_0xab92('0x10')];_0x357cc1[_0xab92('0x43')]=_0x3d0d80['result'][_0xab92('0x44')];logger['info']('['+[_0x43dbe8[_0xab92('0x11')]()]+_0xab92('0x45'),_0x357cc1);_0x136cf9(_0x357cc1);})[_0xab92('0x13')](function(_0x32a2dd){logger[_0xab92('0x14')]('['+[_0x43dbe8[_0xab92('0x11')]()]+']',_0x32a2dd[_0xab92('0x15')]);_0x27747d(_0x32a2dd[_0xab92('0x15')]);});});};}function createRemoteTag(_0x267416,_0x7356b3,_0x1340af,_0x22fc4e){return new Promise(function(_0x434fb9,_0x3f22bc){var _0x27d4f0={'method':'POST','uri':_0x1340af+'label'+'?'+_0x22fc4e,'body':{'short_description':_0x267416,'global':!![],'active':!![],'name':_0x267416},'auth':_0x7356b3,'json':!![]};return rp(_0x27d4f0)[_0xab92('0xc')](function(_0x29a36b){var _0x34d324=_0x29a36b[_0xab92('0xf')]['sys_id'];_0x434fb9(_0x34d324);});});}function getRemoteTag(_0xd9762a,_0x41b847,_0x227e6c,_0x18b4b2,_0x3ff5df){return new Promise(function(_0x5811de,_0xb4394c){var _0xdb4050={'method':_0xab92('0xb'),'uri':_0x227e6c+_0xab92('0x46')+_0xab92('0x47')+_0xd9762a+'&'+_0x18b4b2,'auth':_0x41b847,'json':!![]};return rp(_0xdb4050)[_0xab92('0xc')](function(_0x50ec3c){if(_0x50ec3c[_0xab92('0xf')][_0xab92('0xd')]>0x0){var _0xad519d=_0x50ec3c[_0xab92('0xf')][0x0][_0xab92('0x10')];_0x5811de(_0xad519d);}else{return createRemoteTag(_0xd9762a,_0x41b847,_0x227e6c,_0x18b4b2)['then'](function(_0x2116a2){_0x5811de(_0x2116a2);});}});});}function assignTagToIncident(_0x1b17e4,_0x4e314d,_0x511598,_0x52b863,_0x450a93){return new Promise(function(_0x4d01d3,_0x3aa93a){var _0x211c5a={'method':'POST','uri':_0x511598+_0xab92('0x48')+'?'+_0x450a93,'body':{'label':_0x1b17e4,'table':_0xab92('0x3c'),'id_type':_0xab92('0x49'),'table_key':_0x52b863[_0xab92('0x42')],'title':_0xab92('0x4a')+_0x52b863['ticketNumber'],'id_display':_0x52b863[_0xab92('0x43')]},'auth':_0x4e314d,'json':!![]};return rp(_0x211c5a)['then'](function(_0x5c1e89){_0x4d01d3();})[_0xab92('0x13')](function(){_0x4d01d3();});});}function manageTags(_0x117cb7,_0x595e2d,_0x1b85ee,_0xc74a3d,_0x25190e,_0x17666f,_0x1cf786){return new Promise(function(_0x2532d0,_0x4d1f48){var _0x34ba95=[];_0x595e2d[_0xab92('0x2b')](function(_0x529d48){_0x34ba95['push'](getRemoteTag(_0x529d48,_0x1b85ee,_0xc74a3d,_0x17666f,_0x1cf786));});return Promise[_0xab92('0x4b')](_0x34ba95)[_0xab92('0xc')](function(_0x44e252){if(_0x44e252[_0xab92('0xd')]){logger[_0xab92('0x1a')]('['+[_0x117cb7[_0xab92('0x11')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x44e252);var _0x19d1bb=[];_0x44e252['forEach'](function(_0x4bc3f2){_0x19d1bb[_0xab92('0x4c')](assignTagToIncident(_0x4bc3f2,_0x1b85ee,_0xc74a3d,_0x25190e,_0x17666f));});return Promise[_0xab92('0x4b')](_0x19d1bb)[_0xab92('0xc')](function(){_0x2532d0();})['catch'](function(){_0x2532d0();});}else{_0x2532d0();}});});}function getTags(_0x3bdd75,_0x248623,_0xb03260,_0x5a020f,_0x3b88c3,_0x38fff9){return function(_0x1d6cf1){return new Promise(function(_0x512af8,_0x1521e2){var _0xcdf407=[];var _0x3b91b5=_0x5a020f[_0xab92('0x4d')];if(_0x3b91b5&&_0x3b91b5[_0xab92('0xd')]>0x0){_0xcdf407=_['map'](_0x3b91b5,_0xab92('0x39'));}if(_0xcdf407['length']>0x0){return manageTags(_0x3bdd75,_0xcdf407,_0x248623,_0xb03260,_0x1d6cf1,_0x3b88c3,_0x38fff9)[_0xab92('0xc')](function(){_0x512af8(_0x1d6cf1);});}else{_0x512af8(_0x1d6cf1);}});};}function emit(_0xf118d9,_0x393ce7,_0x5070e4){var _0x140591='%26sysparm_record_target%3Dincident'+_0xab92('0x4e')+_0xab92('0x4f')+_0xab92('0x50');var _0x18ce15={'uri':_0xf118d9+_0xab92('0x51')+_0x5070e4+_0x140591};io['to'](util[_0xab92('0x52')](_0xab92('0x53'),_0x393ce7))[_0xab92('0x54')](_0xab92('0x55'),_0x18ce15);}exports['cs']=function(_0x1c8345,_0x379a53,_0x3dcb9f,_0x22c2ee,_0x2297b6,_0x354652,_0x43f00d,_0x10c921){var _0x8a00ac={};var _0x14bc21={'user':_0x354652[_0xab92('0x56')],'pass':_0x354652[_0xab92('0x57')]};var _0x1c88b8=_0xab92('0x58');var _0x1f80c1=_0xab92('0x59');_0x354652[_0xab92('0x5a')]=intUtil[_0xab92('0x5b')](_0x354652[_0xab92('0x5a')]);_0x354652['serverUrl']=intUtil['stripTrailingSlash'](_0x354652['serverUrl']);var _0x560bd9=util[_0xab92('0x52')](_0xab92('0x5c'),_0x354652[_0xab92('0x5a')]);_0x8a00ac[_0xab92('0x18')]=!_[_0xab92('0x5d')](_0x22c2ee)?_0x22c2ee['email']:null;_0x8a00ac[_0xab92('0x20')]=_0x354652[_0xab92('0x5e')];_0x8a00ac[_0xab92('0x23')]=_0x10c921[_0xab92('0x32')]()===_0xab92('0x3b')?_0x379a53[_0xab92('0x5f')]:_0x379a53[_0xab92('0x60')];_0x8a00ac[_0xab92('0x61')]=_0x10c921===_0xab92('0x62')||_0x10c921===_0xab92('0x63')?'queue':_0xab92('0x3b');var _0x34d369=util['format'](_0xab92('0x64'),_0x354652['serverUrl'],_0x379a53[_0xab92('0x65')],md5(_0x379a53[_0xab92('0x65')]));if(_0x2297b6&&_0x2297b6[_0xab92('0x66')]){logger[_0xab92('0x1a')](_0xab92('0x67'),_0xab92('0x68'));_0x379a53[_0xab92('0x69')]=_0x34d369;}else if(_0x43f00d&&_0x43f00d[_0xab92('0x6a')]&&_0x43f00d[_0xab92('0x6a')]!==_0xab92('0x6b')){logger['info']('[OUTBOUND]',_0xab92('0x68'));_0x379a53[_0xab92('0x69')]=_0x34d369;}else{_0x379a53['recordingURL']='';}return getAdminUser(_0x10c921,_0x14bc21,_0x8a00ac,_0x560bd9,_0x1f80c1,_0x1c88b8)[_0xab92('0xc')](getUser(_0x10c921,_0x14bc21,_0x560bd9,_0x1f80c1,_0x1c88b8))[_0xab92('0xc')](getEndUser(_0x10c921,_0x14bc21,_0x560bd9,_0x1f80c1,_0x1c88b8))['then'](getTicket(_0x10c921,_0x14bc21,_0x560bd9,_0x3dcb9f,_0x379a53,_0x1f80c1))[_0xab92('0xc')](function(_0x2af374){logger[_0xab92('0x1a')](util['format']('The\x20ticket\x20ID\x20is:\x20%s',_0x2af374[_0xab92('0x42')]));logger[_0xab92('0x1a')](util['format'](_0xab92('0x6c'),_0x10c921));if(_0x10c921!==_0xab92('0x63')){logger[_0xab92('0x1a')]('['+[_0x10c921[_0xab92('0x11')]()]+']',_0xab92('0x6d'));emit(_0x354652[_0xab92('0x5a')],_0x22c2ee['name'],_0x2af374[_0xab92('0x42')]);}})['catch'](function(_0x3139a3){logger[_0xab92('0x14')]('['+[_0x10c921['toUpperCase']()]+_0xab92('0x6e'),util['inspect'](_0x3139a3,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x0ea7=['unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...','request-promise','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','socket.io-emitter','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','info','toUpperCase','],\x20getAdminUser\x20crm','catch','message','],\x20getUser\x20input\x20crm','GET','userEmail','],\x20getUser\x20rp\x20obj','true','userId','sys_id','adminEmail','],\x20getUser\x20crm','error',']\x20using\x20admin\x20profile','POST','sys_user?','endUserNumber','user','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','string','picklist','type','nameField','toString','idField','customField','toLowerCase','content','variable','variableName','Variable','name',']\x20getTicket\x20input\x20crm','outbound','assign','getString','Subjects','Descriptions',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','label_entry','incident','Incident','Incident\x20-\x20','push',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','all','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','password','sysparm_display_value=true','remoteUri','serverUrl','stripTrailingSlash','%s/api/now/table/','isNil','email','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','recordingURL','recordingFormat','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s'];(function(_0x566667,_0x51ae8f){var _0x34e450=function(_0x168acc){while(--_0x168acc){_0x566667['push'](_0x566667['shift']());}};_0x34e450(++_0x51ae8f);}(_0x0ea7,0x13d));var _0x70ea=function(_0xf0276c,_0x4e2ca4){_0xf0276c=_0xf0276c-0x0;var _0x1a2327=_0x0ea7[_0xf0276c];return _0x1a2327;};'use strict';var _=require('lodash');var Promise=require('bluebird');var rp=require(_0x70ea('0x0'));var util=require(_0x70ea('0x1'));var md5=require(_0x70ea('0x2'));var Redis=require(_0x70ea('0x3'));var intUtil=require(_0x70ea('0x4'));var config=require(_0x70ea('0x5'));var logger=require(_0x70ea('0x6'))(_0x70ea('0x7'));config[_0x70ea('0x8')]=_['defaults'](config[_0x70ea('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x70ea('0x9'))(new Redis(config[_0x70ea('0x8')]));function getAdminUser(_0x4c2df6,_0x5b6138,_0x28ac30,_0x3ac3b6,_0x30c6d8,_0x2512f9){return new Promise(function(_0x482693,_0x3f5f39){var _0x3fd19b={'method':'GET','uri':_0x3ac3b6+_0x70ea('0xa')+'&'+_0x30c6d8+'&'+_0x2512f9,'auth':_0x5b6138,'json':!![]};return rp(_0x3fd19b)[_0x70ea('0xb')](function(_0x21cac7){if(_0x21cac7[_0x70ea('0xc')][_0x70ea('0xd')]>0x0){_0x28ac30[_0x70ea('0xe')]=_0x21cac7[_0x70ea('0xc')][0x0]['sys_id'];}logger[_0x70ea('0xf')]('['+[_0x4c2df6[_0x70ea('0x10')]()]+_0x70ea('0x11'),_0x28ac30);_0x482693(_0x28ac30);})[_0x70ea('0x12')](function(_0xfcf84c){logger['error']('['+[_0x4c2df6['toUpperCase']()]+']',_0xfcf84c[_0x70ea('0x13')]);_0x3f5f39(_0xfcf84c[_0x70ea('0x13')]);});});}function getUser(_0x5005ba,_0x1a9a5d,_0x3c8ebb,_0x4fb99a,_0x33a973){return function(_0x3794b4){logger[_0x70ea('0xf')]('['+[_0x5005ba['toUpperCase']()]+_0x70ea('0x14'),_0x3794b4);return new Promise(function(_0xa3ff5e,_0x395da8){if(intUtil['validateEmail'](_0x3794b4['userEmail'])){var _0x4710ef={'method':_0x70ea('0x15'),'uri':_0x3c8ebb+'sys_user?sysparm_query=email%3D'+_0x3794b4[_0x70ea('0x16')]+'&'+_0x4fb99a+'&'+_0x33a973,'auth':_0x1a9a5d,'json':!![]};logger[_0x70ea('0xf')]('['+[_0x5005ba[_0x70ea('0x10')]()]+_0x70ea('0x17'),_0x4710ef);return rp(_0x4710ef)[_0x70ea('0xb')](function(_0x57bb20){logger['info']('['+[_0x5005ba[_0x70ea('0x10')]()]+'],\x20getUser\x20entity',_0x57bb20);if(_0x57bb20[_0x70ea('0xc')][_0x70ea('0xd')]>0x0&&String(_0x57bb20['result'][0x0]['active'])===_0x70ea('0x18')){_0x3794b4[_0x70ea('0x19')]=_0x57bb20[_0x70ea('0xc')][0x0][_0x70ea('0x1a')];}else{_0x3794b4[_0x70ea('0x19')]=_0x3794b4[_0x70ea('0xe')];_0x3794b4['userEmail']=_0x3794b4[_0x70ea('0x1b')];}logger[_0x70ea('0xf')]('['+[_0x5005ba[_0x70ea('0x10')]()]+_0x70ea('0x1c'),_0x3794b4);_0xa3ff5e(_0x3794b4);})['catch'](function(_0xbcc3e){logger[_0x70ea('0x1d')]('['+[_0x5005ba['toUpperCase']()]+']',_0xbcc3e[_0x70ea('0x13')]);_0x395da8(_0xbcc3e[_0x70ea('0x13')]);});}else{logger[_0x70ea('0xf')]('['+[_0x5005ba[_0x70ea('0x10')]()]+_0x70ea('0x1e'));_0x3794b4['userId']=_0x3794b4[_0x70ea('0xe')];_0x3794b4[_0x70ea('0x16')]=_0x3794b4[_0x70ea('0x1b')];_0xa3ff5e(_0x3794b4);}});};}function createEndUser(_0x5d105a,_0x222a1c,_0x272e01,_0x3a4be3,_0x1da55a){logger[_0x70ea('0xf')]('['+[_0x5d105a[_0x70ea('0x10')]()]+'],\x20createEndUser\x20input\x20crm',_0x272e01);return new Promise(function(_0x33b093,_0x207817){var _0x408d5a={'method':_0x70ea('0x1f'),'uri':_0x3a4be3+_0x70ea('0x20')+_0x1da55a,'body':{'user_name':_0x272e01[_0x70ea('0x21')],'roles':_0x70ea('0x22'),'first_name':_0x272e01[_0x70ea('0x21')],'active':_0x70ea('0x18'),'date_format':_0x70ea('0x23'),'phone':_0x272e01[_0x70ea('0x21')]},'auth':_0x222a1c,'json':!![]};return rp(_0x408d5a)[_0x70ea('0xb')](function(_0x2d039f){logger['info']('['+[_0x5d105a['toUpperCase']()]+_0x70ea('0x24'),_0x2d039f[_0x70ea('0xc')]);_0x272e01[_0x70ea('0x25')]=_0x2d039f[_0x70ea('0xc')][_0x70ea('0x1a')];_0x33b093(_0x272e01);})['catch'](function(_0x288418){logger[_0x70ea('0x1d')]('['+[_0x5d105a[_0x70ea('0x10')]()]+']',_0x288418[_0x70ea('0x13')]);_0x207817(_0x288418['message']);});});}function getEndUser(_0x3629d6,_0x33a46e,_0x32d9b5,_0x1bcafb,_0x3ab6bd){return function(_0x5d194d){logger['info']('['+[_0x3629d6[_0x70ea('0x10')]()]+_0x70ea('0x26'),_0x5d194d);return new Promise(function(_0x1ceee8,_0x5def7a){var _0x35b7f6={'method':'GET','uri':_0x32d9b5+_0x70ea('0x27')+_0x5d194d[_0x70ea('0x21')]+'&'+_0x1bcafb+'&'+_0x3ab6bd,'auth':_0x33a46e,'json':!![]};return rp(_0x35b7f6)[_0x70ea('0xb')](function(_0x12b728){if(_0x12b728[_0x70ea('0xc')][_0x70ea('0xd')]>0x0){_0x5d194d[_0x70ea('0x25')]=_0x12b728[_0x70ea('0xc')][0x0][_0x70ea('0x1a')];logger['info']('['+[_0x3629d6['toUpperCase']()]+_0x70ea('0x28'),_0x5d194d);_0x1ceee8(_0x5d194d);}else{return createEndUser(_0x3629d6,_0x33a46e,_0x5d194d,_0x32d9b5,_0x1bcafb)['then'](function(_0x4398aa){logger[_0x70ea('0xf')]('['+[_0x3629d6[_0x70ea('0x10')]()]+_0x70ea('0x29'),_0x4398aa);_0x1ceee8(_0x4398aa);});}})['catch'](function(_0x26de77){logger['error']('['+[_0x3629d6['toUpperCase']()]+']',_0x26de77['message']);_0x5def7a(_0x26de77[_0x70ea('0x13')]);});});};}function getCustomFields(_0x41da90,_0x365a60){var _0x370c8a={};if(_0x41da90[_0x70ea('0xd')]>0x0){_[_0x70ea('0x2a')](_0x41da90,function(_0x3e43f3){if(_[_0x70ea('0x2b')]([_0x70ea('0x2c'),_0x70ea('0x2d')],_0x3e43f3[_0x70ea('0x2e')])&&_0x3e43f3[_0x70ea('0x2f')]&&!_0x3e43f3['customField']){_0x370c8a[_0x3e43f3[_0x70ea('0x2f')]['toLowerCase']()]=_0x3e43f3['content'][_0x70ea('0x30')]();}else if(_[_0x70ea('0x2b')]([_0x70ea('0x2c'),_0x70ea('0x2d')],_0x3e43f3[_0x70ea('0x2e')])&&_0x3e43f3[_0x70ea('0x31')]&&_0x3e43f3[_0x70ea('0x32')]){_0x370c8a[_0x3e43f3['idField'][_0x70ea('0x33')]()]=_0x3e43f3[_0x70ea('0x34')][_0x70ea('0x30')]();}else if(_0x3e43f3[_0x70ea('0x2e')]===_0x70ea('0x35')&&_0x3e43f3[_0x70ea('0x36')]&&_0x3e43f3[_0x70ea('0x31')]&&_0x3e43f3[_0x70ea('0x32')]){_0x370c8a[_0x3e43f3[_0x70ea('0x31')][_0x70ea('0x33')]()]=_0x365a60[_0x3e43f3[_0x70ea('0x36')]]['toString']();}else if(_0x3e43f3[_0x70ea('0x2e')]==='customVariable'&&_0x3e43f3[_0x70ea('0x37')]&&_0x3e43f3['Variable']['name']&&_0x3e43f3[_0x70ea('0x31')]&&_0x3e43f3[_0x70ea('0x32')]){_0x370c8a[_0x3e43f3[_0x70ea('0x31')]['toLowerCase']()]=_0x365a60[_0x3e43f3[_0x70ea('0x37')][_0x70ea('0x38')][_0x70ea('0x33')]()][_0x70ea('0x30')]();}});}return _0x370c8a;}function getTicket(_0x1c5479,_0xe08422,_0x1c46ac,_0x5c3a6a,_0x17a7d7,_0x23e939){return function(_0x519baf){logger[_0x70ea('0xf')]('['+[_0x1c5479[_0x70ea('0x10')]()]+_0x70ea('0x39'),_0x519baf);return new Promise(function(_0x5e4459,_0x451137){var _0x309788=_0x1c5479[_0x70ea('0x33')]()===_0x70ea('0x3a')?_0x519baf[_0x70ea('0x19')]:_0x519baf['endUserId'];var _0x21b758={'method':'POST','uri':_0x1c46ac+'incident'+'?'+_0x23e939,'body':Object[_0x70ea('0x3b')]({},{'active':'true','caller_id':_0x309788,'assigned_to':_0x519baf[_0x70ea('0x19')],'short_description':intUtil[_0x70ea('0x3c')](_0x5c3a6a[_0x70ea('0x3d')],_0x17a7d7,'\x20'),'description':intUtil[_0x70ea('0x3c')](_0x5c3a6a[_0x70ea('0x3e')],_0x17a7d7,'\x0a')},getCustomFields(_0x5c3a6a['Fields'],_0x17a7d7)),'auth':_0xe08422,'json':!![]};return rp(_0x21b758)[_0x70ea('0xb')](function(_0x558ae1){logger['info']('['+[_0x1c5479[_0x70ea('0x10')]()]+_0x70ea('0x3f'),_0x558ae1[_0x70ea('0xc')]);_0x519baf[_0x70ea('0x40')]=_0x558ae1[_0x70ea('0xc')][_0x70ea('0x1a')];_0x519baf[_0x70ea('0x41')]=_0x558ae1[_0x70ea('0xc')][_0x70ea('0x42')];logger['info']('['+[_0x1c5479[_0x70ea('0x10')]()]+_0x70ea('0x43'),_0x519baf);_0x5e4459(_0x519baf);})[_0x70ea('0x12')](function(_0x31ecf8){logger['error']('['+[_0x1c5479[_0x70ea('0x10')]()]+']',_0x31ecf8[_0x70ea('0x13')]);_0x451137(_0x31ecf8['message']);});});};}function createRemoteTag(_0x23060c,_0x1109b0,_0x3e0bde,_0x15f30f){return new Promise(function(_0x3f142a,_0x4402cd){var _0x50973d={'method':_0x70ea('0x1f'),'uri':_0x3e0bde+'label'+'?'+_0x15f30f,'body':{'short_description':_0x23060c,'global':!![],'active':!![],'name':_0x23060c},'auth':_0x1109b0,'json':!![]};return rp(_0x50973d)[_0x70ea('0xb')](function(_0x439184){var _0x49f647=_0x439184['result'][_0x70ea('0x1a')];_0x3f142a(_0x49f647);});});}function getRemoteTag(_0x2e584c,_0x265d85,_0x2d34c6,_0x296e8b,_0x5c5196){return new Promise(function(_0x121ec1,_0x12faca){var _0x539944={'method':_0x70ea('0x15'),'uri':_0x2d34c6+_0x70ea('0x44')+'?sysparm_query=name%3D'+_0x2e584c+'&'+_0x296e8b,'auth':_0x265d85,'json':!![]};return rp(_0x539944)[_0x70ea('0xb')](function(_0x294fbf){if(_0x294fbf['result'][_0x70ea('0xd')]>0x0){var _0x1bcbe8=_0x294fbf[_0x70ea('0xc')][0x0][_0x70ea('0x1a')];_0x121ec1(_0x1bcbe8);}else{return createRemoteTag(_0x2e584c,_0x265d85,_0x2d34c6,_0x296e8b)[_0x70ea('0xb')](function(_0x214b9e){_0x121ec1(_0x214b9e);});}});});}function assignTagToIncident(_0x284555,_0x2e52e0,_0x4618b7,_0x50a19d,_0x2565e0){return new Promise(function(_0x5ca141,_0x66d1fd){var _0x2d189a={'method':_0x70ea('0x1f'),'uri':_0x4618b7+_0x70ea('0x45')+'?'+_0x2565e0,'body':{'label':_0x284555,'table':_0x70ea('0x46'),'id_type':_0x70ea('0x47'),'table_key':_0x50a19d[_0x70ea('0x40')],'title':_0x70ea('0x48')+_0x50a19d[_0x70ea('0x41')],'id_display':_0x50a19d[_0x70ea('0x41')]},'auth':_0x2e52e0,'json':!![]};return rp(_0x2d189a)[_0x70ea('0xb')](function(_0x1d1615){_0x5ca141();})[_0x70ea('0x12')](function(){_0x5ca141();});});}function manageTags(_0x4d0d41,_0x58b0e4,_0x4a8356,_0x4fbd58,_0x3de80f,_0x24dcb5,_0x1c02ce){return new Promise(function(_0x2c7d1b,_0x3ea47a){var _0x891cd=[];_0x58b0e4[_0x70ea('0x2a')](function(_0x238662){_0x891cd[_0x70ea('0x49')](getRemoteTag(_0x238662,_0x4a8356,_0x4fbd58,_0x24dcb5,_0x1c02ce));});return Promise['all'](_0x891cd)[_0x70ea('0xb')](function(_0x311096){if(_0x311096['length']){logger[_0x70ea('0xf')]('['+[_0x4d0d41['toUpperCase']()]+_0x70ea('0x4a'),_0x311096);var _0x2f13aa=[];_0x311096[_0x70ea('0x2a')](function(_0x58df30){_0x2f13aa['push'](assignTagToIncident(_0x58df30,_0x4a8356,_0x4fbd58,_0x3de80f,_0x24dcb5));});return Promise[_0x70ea('0x4b')](_0x2f13aa)[_0x70ea('0xb')](function(){_0x2c7d1b();})[_0x70ea('0x12')](function(){_0x2c7d1b();});}else{_0x2c7d1b();}});});}function getTags(_0x396422,_0x24af99,_0x2b37cd,_0x4d8eaf,_0x2aed5f,_0x589861){return function(_0x5eb455){return new Promise(function(_0x376b1c,_0xdee193){var _0x172418=[];var _0x28e681=_0x4d8eaf[_0x70ea('0x4c')];if(_0x28e681&&_0x28e681[_0x70ea('0xd')]>0x0){_0x172418=_[_0x70ea('0x4d')](_0x28e681,_0x70ea('0x38'));}if(_0x172418['length']>0x0){return manageTags(_0x396422,_0x172418,_0x24af99,_0x2b37cd,_0x5eb455,_0x2aed5f,_0x589861)[_0x70ea('0xb')](function(){_0x376b1c(_0x5eb455);});}else{_0x376b1c(_0x5eb455);}});};}function emit(_0x3094b9,_0x14e1cb,_0x1cfd6d){var _0x183df1=_0x70ea('0x4e')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0x70ea('0x4f')+_0x70ea('0x50');var _0x3f39e4={'uri':_0x3094b9+_0x70ea('0x51')+_0x1cfd6d+_0x183df1};io['to'](util[_0x70ea('0x52')](_0x70ea('0x53'),_0x14e1cb))[_0x70ea('0x54')](_0x70ea('0x55'),_0x3f39e4);}exports['cs']=function(_0x3c41e6,_0x4fcef7,_0x2e2633,_0x4ca0dc,_0x232d2e,_0x114007,_0x5a62a2,_0x453fc1){var _0x199920={};var _0x5d2ea7={'user':_0x114007['username'],'pass':_0x114007[_0x70ea('0x56')]};var _0x5686f4='sysparm_limit=1';var _0x3019a3=_0x70ea('0x57');_0x114007['remoteUri']=intUtil['stripTrailingSlash'](_0x114007[_0x70ea('0x58')]);_0x114007[_0x70ea('0x59')]=intUtil[_0x70ea('0x5a')](_0x114007[_0x70ea('0x59')]);var _0x19c653=util[_0x70ea('0x52')](_0x70ea('0x5b'),_0x114007[_0x70ea('0x58')]);_0x199920[_0x70ea('0x16')]=!_[_0x70ea('0x5c')](_0x4ca0dc)?_0x4ca0dc[_0x70ea('0x5d')]:null;_0x199920[_0x70ea('0x1b')]=_0x114007[_0x70ea('0x5d')];_0x199920[_0x70ea('0x21')]=_0x453fc1[_0x70ea('0x33')]()===_0x70ea('0x3a')?_0x4fcef7['destcalleridnum']:_0x4fcef7['calleridnum'];_0x199920[_0x70ea('0x5e')]=_0x453fc1===_0x70ea('0x5f')||_0x453fc1==='unmanaged'?_0x70ea('0x5f'):_0x70ea('0x3a');var _0x5d811a=util[_0x70ea('0x52')](_0x70ea('0x60'),_0x114007[_0x70ea('0x59')],_0x4fcef7[_0x70ea('0x61')],md5(_0x4fcef7[_0x70ea('0x61')]));if(_0x232d2e&&_0x232d2e[_0x70ea('0x62')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x4fcef7[_0x70ea('0x63')]=_0x5d811a;}else if(_0x5a62a2&&_0x5a62a2[_0x70ea('0x64')]&&_0x5a62a2[_0x70ea('0x64')]!=='none'){logger[_0x70ea('0xf')]('[OUTBOUND]',_0x70ea('0x65'));_0x4fcef7[_0x70ea('0x63')]=_0x5d811a;}else{_0x4fcef7[_0x70ea('0x63')]='';}return getAdminUser(_0x453fc1,_0x5d2ea7,_0x199920,_0x19c653,_0x3019a3,_0x5686f4)[_0x70ea('0xb')](getUser(_0x453fc1,_0x5d2ea7,_0x19c653,_0x3019a3,_0x5686f4))[_0x70ea('0xb')](getEndUser(_0x453fc1,_0x5d2ea7,_0x19c653,_0x3019a3,_0x5686f4))[_0x70ea('0xb')](getTicket(_0x453fc1,_0x5d2ea7,_0x19c653,_0x2e2633,_0x4fcef7,_0x3019a3))[_0x70ea('0xb')](function(_0x2d6b04){logger[_0x70ea('0xf')](util['format'](_0x70ea('0x66'),_0x2d6b04[_0x70ea('0x40')]));logger[_0x70ea('0xf')](util[_0x70ea('0x52')]('call\x20direction:\x20%s',_0x453fc1));if(_0x453fc1!==_0x70ea('0x67')){logger[_0x70ea('0xf')]('['+[_0x453fc1[_0x70ea('0x10')]()]+']',_0x70ea('0x68'));emit(_0x114007['remoteUri'],_0x4ca0dc[_0x70ea('0x38')],_0x2d6b04[_0x70ea('0x40')]);}})[_0x70ea('0x12')](function(_0x3551be){logger['error']('['+[_0x453fc1['toUpperCase']()]+']\x20Error\x20running\x20ServiceNow\x20integration',util['inspect'](_0x3551be,{'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 a0b2d6e..ebea0d6 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 _0x6119=['calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','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','catch','outbound','recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum','Outbound','contacts','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','error','unmanaged','toUpperCase','The\x20User\x20ID\x20is:','lodash','request-promise','bluebird','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','localhost','socket.io-emitter','POST','emit','Creating\x20new\x20ticket...','getString','Subjects','assigned_user_id','created_by','description','date_start','toISOString','duration_minutes','parent_id','parent_type','parent_name','direction','forEach','variableName','push','set_entry','JSON','stringify','Calls','format','apiKey','base64','isNil','info','Getting\x20agent\x20with\x20name','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','name','user_name','then','entry_list','find','name_value_list','value','Agent\x20found!','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','get_entry_list','Contacts','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','merge','length','map','type','string','nameField','customField','toLowerCase','content','toString','idField','custom_fields','variable','Variable','login','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','stripTrailingSlash','remoteUri','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6119,0x195));var _0x9611=function(_0x5130fb,_0x44dbec){_0x5130fb=_0x5130fb-0x0;var _0x232bd7=_0x6119[_0x5130fb];return _0x232bd7;};'use strict';var _=require(_0x9611('0x0'));var rp=require(_0x9611('0x1'));var BPromise=require(_0x9611('0x2'));var md5=require(_0x9611('0x3'));var util=require('util');var Redis=require(_0x9611('0x4'));var intUtil=require(_0x9611('0x5'));var config=require(_0x9611('0x6'));var logger=require(_0x9611('0x7'))(_0x9611('0x8'));config[_0x9611('0x9')]=_['defaults'](config['redis'],{'host':_0x9611('0xa'),'port':0x18eb});var io=require(_0x9611('0xb'))(new Redis(config['redis']));var def={'method':_0x9611('0xc'),'json':!![]};function emit(_0x3b614f,_0x47daf5,_0x182c6d){io['to'](_0x3b614f)[_0x9611('0xd')](_0x47daf5,_0x182c6d);}function getTicket(_0x1754d9,_0x68c7f,_0x3ba1e1,_0x53ab93,_0x46b06a,_0x460ce5,_0xb35278,_0x2727c7){logger['info'](_0x9611('0xe'));var _0x5fd885=new Date();var _0x32376b=[{'name':'name','value':intUtil[_0x9611('0xf')](_0x53ab93[_0x9611('0x10')],_0x46b06a,'\x20')},{'name':_0x9611('0x11'),'value':_0x68c7f['id']},{'name':_0x9611('0x12'),'value':_0x68c7f['id']},{'name':_0x9611('0x13'),'value':intUtil['getString'](_0x53ab93['Descriptions'],_0x46b06a,'\x0a')},{'name':_0x9611('0x14'),'value':_0x5fd885[_0x9611('0x15')]()['slice'](0x0,0x13)['replace']('T','\x20')},{'name':'duration_hours','value':'0'},{'name':_0x9611('0x16'),'value':'15'},{'name':_0x9611('0x17'),'value':_0x3ba1e1['id']},{'name':_0x9611('0x18'),'value':'Contacts'},{'name':_0x9611('0x19'),'value':_0x3ba1e1['name']},{'name':_0x9611('0x1a'),'value':_0x2727c7}];if(_0x460ce5['length']){_[_0x9611('0x1b')](_0x460ce5,function(_0x931dd5){if(_0x46b06a[_0x931dd5[_0x9611('0x1c')]]){_0x32376b[_0x9611('0x1d')]({'name':_0x931dd5['idField'],'value':_0x46b06a[_0x931dd5['variableName']]});}});}return request({'form':{'method':_0x9611('0x1e'),'input_type':_0x9611('0x1f'),'response_type':_0x9611('0x1f'),'rest_data':JSON[_0x9611('0x20')]({'session':_0xb35278['id'],'module_name':_0x9611('0x21'),'name_value_list':_0x32376b})}});}function getAuth(_0x1abd89){return util[_0x9611('0x22')]('Basic\x20%s',new Buffer(_0x1abd89[_0x9611('0x23')]+':X')['toString'](_0x9611('0x24')));}function getServerInfo(_0x456009){return request({'form':{'method':'get_server_info','input_type':'JSON','response_type':_0x9611('0x1f'),'rest_data':JSON[_0x9611('0x20')]({'session':_0x456009['id']})}});}function getUser(_0x46b0bb,_0xd7197,_0x50ad81){if(!_[_0x9611('0x25')](_0xd7197)){logger[_0x9611('0x26')](_0x9611('0x27'),_0xd7197);return request({'form':{'method':'get_entry_list','input_type':_0x9611('0x1f'),'response_type':_0x9611('0x1f'),'rest_data':JSON[_0x9611('0x20')]({'session':_0x50ad81['id'],'module_name':_0x9611('0x28'),'query':util[_0x9611('0x22')](_0x9611('0x29'),_0xd7197),'order_by':'','offset':'0','select_fields':['id',_0x9611('0x2a'),_0x9611('0x2b')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x9611('0x2c')](function(_0x42b3b2){if(_0x42b3b2[_0x9611('0x2d')]['length']){var _0x4b6909=_[_0x9611('0x2e')](_0x42b3b2[_0x9611('0x2d')],function(_0x41899f){return _0x41899f[_0x9611('0x2f')][_0x9611('0x2b')][_0x9611('0x30')]===_0xd7197;});if(_0x4b6909){logger[_0x9611('0x26')](_0x9611('0x31'));return BPromise[_0x9611('0x32')]({'id':_0x4b6909[_0x9611('0x2f')]['id'][_0x9611('0x30')],'name':_0x4b6909[_0x9611('0x2f')]['name'][_0x9611('0x30')]});}}logger[_0x9611('0x26')](_0x9611('0x33'));return BPromise['resolve']({'id':_0x50ad81[_0x9611('0x2f')][_0x9611('0x34')][_0x9611('0x30')],'name':_0x50ad81[_0x9611('0x2f')][_0x9611('0x2b')][_0x9611('0x30')]});});}else{logger[_0x9611('0x26')](_0x9611('0x35'));return BPromise['resolve']({'id':_0x50ad81[_0x9611('0x2f')][_0x9611('0x34')][_0x9611('0x30')],'name':_0x50ad81[_0x9611('0x2f')]['user_name'][_0x9611('0x30')]});}}function getEndUser(_0x2deec8,_0x43e536,_0x48c8c7,_0x3a63b4){logger[_0x9611('0x26')](_0x9611('0x36'),_0x48c8c7);return request({'form':{'method':_0x9611('0x37'),'input_type':'JSON','response_type':_0x9611('0x1f'),'rest_data':JSON[_0x9611('0x20')]({'session':_0x3a63b4['id'],'module_name':_0x9611('0x38'),'query':util['format'](_0x9611('0x39'),_0x48c8c7),'order_by':'','offset':'0','select_fields':['id',_0x9611('0x2a'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x9611('0x2c')](function(_0x53f966){if(_0x53f966[_0x9611('0x2d')]['length']){var _0x324a07=_[_0x9611('0x2e')](_0x53f966[_0x9611('0x2d')],function(_0x2786dc){return _0x2786dc[_0x9611('0x2f')][_0x9611('0x3a')][_0x9611('0x30')]===_0x48c8c7;});if(_0x324a07){logger[_0x9611('0x26')](_0x9611('0x3b'));return BPromise['resolve']({'id':_0x324a07['name_value_list']['id'][_0x9611('0x30')],'name':_0x324a07[_0x9611('0x2f')][_0x9611('0x2a')][_0x9611('0x30')],'phone':_0x324a07[_0x9611('0x2f')][_0x9611('0x3a')][_0x9611('0x30')]});}}else{logger[_0x9611('0x26')](_0x9611('0x3c'));return request({'form':{'method':'set_entry','input_type':'JSON','response_type':_0x9611('0x1f'),'rest_data':JSON['stringify']({'session':_0x3a63b4['id'],'module_name':_0x9611('0x38'),'name_value_list':[{'name':_0x9611('0x3d'),'value':_0x43e536!==''?_0x43e536:util[_0x9611('0x22')](_0x9611('0x3e'),_0x48c8c7)},{'name':_0x9611('0x3a'),'value':_0x48c8c7}]})}})[_0x9611('0x2c')](function(_0x338a46){logger[_0x9611('0x26')](_0x9611('0x3f'));return BPromise['resolve']({'id':_0x338a46['id'],'name':_0x338a46['entry_list'][_0x9611('0x3d')][_0x9611('0x30')],'phone':_0x338a46['entry_list']['phone_home'][_0x9611('0x30')]});});}});}function request(_0x155e20){logger[_0x9611('0x40')](_0x9611('0x41'),JSON[_0x9611('0x20')](_0x155e20));return rp(_[_0x9611('0x42')](def,_0x155e20));}function getTags(_0x4c8661,_0x435645){var _0x2cebd7=[];if(_0x4c8661&&_0x4c8661[_0x9611('0x43')]>0x0){_0x2cebd7=_[_0x9611('0x44')](_0x4c8661,_0x435645);}return _0x2cebd7;}function getCustomFields(_0x458ebd,_0x2cd846){var _0x22d92c=[];var _0x91ff9f={'custom_fields':[]};if(_0x458ebd[_0x9611('0x43')]>0x0){_[_0x9611('0x1b')](_0x458ebd,function(_0x157927){if(_0x157927[_0x9611('0x45')]===_0x9611('0x46')&&_0x157927[_0x9611('0x47')]&&!_0x157927[_0x9611('0x48')]){_0x91ff9f[_0x157927['nameField'][_0x9611('0x49')]()]=_0x157927[_0x9611('0x4a')][_0x9611('0x4b')]();}else if(_0x157927[_0x9611('0x45')]==='string'&&_0x157927[_0x9611('0x4c')]&&_0x157927[_0x9611('0x48')]){_0x91ff9f[_0x9611('0x4d')]['push']({'id':_0x157927[_0x9611('0x4c')],'value':_0x157927[_0x9611('0x4a')][_0x9611('0x4b')]()});}else if(_0x157927[_0x9611('0x45')]===_0x9611('0x4e')&&_0x157927[_0x9611('0x1c')]&&_0x157927[_0x9611('0x4c')]&&_0x157927[_0x9611('0x48')]){_0x2cd846[_0x157927[_0x9611('0x1c')]]&&_0x91ff9f[_0x9611('0x4d')][_0x9611('0x1d')]({'id':_0x157927[_0x9611('0x4c')],'value':_0x2cd846[_0x157927[_0x9611('0x1c')]][_0x9611('0x4b')]()});}else if(_0x157927['type']==='customVariable'&&_0x157927['Variable']&&_0x157927[_0x9611('0x4f')][_0x9611('0x2a')]&&_0x157927['idField']&&_0x157927['customField']){_0x2cd846[_0x157927[_0x9611('0x4f')]['name'][_0x9611('0x49')]()]&&_0x91ff9f[_0x9611('0x4d')][_0x9611('0x1d')]({'id':_0x157927[_0x9611('0x4c')],'value':_0x2cd846[_0x157927[_0x9611('0x4f')][_0x9611('0x2a')][_0x9611('0x49')]()][_0x9611('0x4b')]()});}});}return _0x91ff9f;}function getConnection(_0x1f44b1){return request({'method':_0x9611('0xc'),'form':{'method':_0x9611('0x50'),'input_type':_0x9611('0x1f'),'response_type':_0x9611('0x1f'),'rest_data':JSON[_0x9611('0x20')]({'user_auth':{'user_name':_0x1f44b1['username'],'password':_0x1f44b1[_0x9611('0x51')],'encryption':_0x9611('0x52')},'application':_0x9611('0x53')})}})['then'](function(_0xf96165){var _0x2a837b=_0xf96165;if(_0x2a837b['id']){def[_0x9611('0x54')]=_0x2a837b['id'];return BPromise[_0x9611('0x32')](_0x2a837b);}else{throw new Error(util[_0x9611('0x22')](_0x9611('0x55'),_0x1f44b1['id']));}});}function setRelationship(_0x30a42e,_0x3324fc,_0x1b4f42,_0x220a8b){return request({'form':{'method':_0x9611('0x56'),'input_type':_0x9611('0x1f'),'response_type':_0x9611('0x1f'),'rest_data':JSON[_0x9611('0x20')]({'session':_0x30a42e['id'],'module_name':'Calls','module_id':_0x1b4f42['id'],'link_field_name':_0x220a8b,'related_ids':[_0x3324fc['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x9611('0x57')]=function(_0x1c04e7,_0x7fc953,_0x52382a,_0x5da7c7,_0x4347f0,_0x48659c){var _0x389b7a,_0x37b79e,_0x75a4c1,_0x13483b;_0x48659c['remoteUri']=intUtil[_0x9611('0x58')](_0x48659c[_0x9611('0x59')]);_0x48659c['serverUrl']=intUtil[_0x9611('0x58')](_0x48659c[_0x9611('0x5a')]);def[_0x9611('0x5b')]=util[_0x9611('0x22')](_0x9611('0x5c'),_0x48659c[_0x9611('0x59')]);if(_0x4347f0&&_0x4347f0[_0x9611('0x5d')]){logger['info'](_0x9611('0x5e'),_0x9611('0x5f'));_0x7fc953[_0x9611('0x60')]=util['format'](_0x9611('0x61'),_0x48659c[_0x9611('0x5a')],_0x7fc953[_0x9611('0x62')],md5(_0x7fc953[_0x9611('0x62')]));}else{_0x7fc953['recordingURL']='';}return getConnection(_0x48659c)[_0x9611('0x2c')](function(_0x4f9467){_0x13483b=_0x4f9467;return getUser(_0x48659c,_0x5da7c7['name'],_0x13483b);})[_0x9611('0x2c')](function(_0x1917c8){_0x389b7a=_0x1917c8;logger[_0x9611('0x26')]('The\x20User\x20ID\x20is:',_0x389b7a['id']);return getEndUser(_0x48659c,_0x7fc953[_0x9611('0x63')],_0x7fc953[_0x9611('0x64')],_0x13483b);})[_0x9611('0x2c')](function(_0x93b850){_0x37b79e=_0x93b850;logger[_0x9611('0x26')](_0x9611('0x65'),_0x37b79e['id']);return getTicket(_0x48659c,_0x389b7a,_0x37b79e,_0x52382a,_0x7fc953,_0x52382a[_0x9611('0x66')],_0x13483b,_0x9611('0x67'));})[_0x9611('0x2c')](function(_0x3957d5){_0x75a4c1=_0x3957d5;logger['info'](_0x9611('0x68'));logger[_0x9611('0x26')](_0x9611('0x69'),_0x75a4c1['id']);return setRelationship(_0x13483b,_0x389b7a,_0x75a4c1,_0x9611('0x6a'));})[_0x9611('0x2c')](function(){return setRelationship(_0x13483b,_0x37b79e,_0x75a4c1,'contacts');})[_0x9611('0x2c')](function(){return getServerInfo(_0x13483b);})[_0x9611('0x2c')](function(_0x4909b4){var _0x50db5e=parseInt(_0x4909b4[_0x9611('0x6b')][_0x9611('0x6c')](0x0));var _0x1bc8cf=util[_0x9611('0x22')](_0x9611('0x6d'),_0x48659c[_0x9611('0x59')],_0x75a4c1['id']);if(_0x50db5e>0x6){_0x1bc8cf=util[_0x9611('0x22')](_0x9611('0x6e'),_0x48659c[_0x9611('0x59')],_0x75a4c1['id']);}logger['info'](_0x9611('0x5e'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x9611('0x22')](_0x9611('0x6f'),_0x5da7c7['name']),'trigger:browser:url',{'uri':_0x1bc8cf});})[_0x9611('0x70')](function(_0x1f3dbf){logger['error'](_0x9611('0x5e'),JSON[_0x9611('0x20')](_0x1f3dbf));});};exports[_0x9611('0x71')]=function(_0x18574b,_0x4c983c,_0x4e1ef4,_0x203901,_0x309c57,_0x2edbd7,_0x4deeea){var _0x551a2a,_0x2060bb,_0x387c3c,_0x1168b4;_0x2edbd7[_0x9611('0x59')]=intUtil[_0x9611('0x58')](_0x2edbd7[_0x9611('0x59')]);_0x2edbd7[_0x9611('0x5a')]=intUtil['stripTrailingSlash'](_0x2edbd7['serverUrl']);def[_0x9611('0x5b')]=util[_0x9611('0x22')](_0x9611('0x5c'),_0x2edbd7['remoteUri']);if(_0x4deeea&&_0x4deeea[_0x9611('0x72')]&&_0x4deeea[_0x9611('0x72')]!=='none'){logger['info'](_0x9611('0x73'),_0x9611('0x5f'));_0x4c983c[_0x9611('0x60')]=util[_0x9611('0x22')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2edbd7[_0x9611('0x5a')],_0x4c983c[_0x9611('0x62')],md5(_0x4c983c['uniqueid']));}return getConnection(_0x2edbd7)[_0x9611('0x2c')](function(_0x556a22){_0x1168b4=_0x556a22;return getUser(_0x2edbd7,_0x203901[_0x9611('0x2a')],_0x1168b4);})[_0x9611('0x2c')](function(_0x44d477){_0x551a2a=_0x44d477;logger[_0x9611('0x26')]('The\x20User\x20ID\x20is:',_0x551a2a['id']);return getEndUser(_0x2edbd7,_0x4c983c[_0x9611('0x74')],_0x4c983c[_0x9611('0x75')],_0x1168b4);})['then'](function(_0x479396){_0x2060bb=_0x479396;logger[_0x9611('0x26')](_0x9611('0x65'),_0x2060bb['id']);return getTicket(_0x2edbd7,_0x551a2a,_0x2060bb,_0x4e1ef4,_0x4c983c,_0x4e1ef4[_0x9611('0x66')],_0x1168b4,_0x9611('0x76'));})['then'](function(_0x5cb6f6){_0x387c3c=_0x5cb6f6;logger[_0x9611('0x26')](_0x9611('0x68'));logger[_0x9611('0x26')](_0x9611('0x69'),_0x387c3c['id']);return setRelationship(_0x1168b4,_0x551a2a,_0x387c3c,_0x9611('0x6a'));})[_0x9611('0x2c')](function(){return setRelationship(_0x1168b4,_0x2060bb,_0x387c3c,_0x9611('0x77'));})[_0x9611('0x2c')](function(){return getServerInfo(_0x1168b4);})[_0x9611('0x2c')](function(_0x379df2){var _0x17e892=parseInt(_0x379df2[_0x9611('0x6b')][_0x9611('0x6c')](0x0));var _0x580d12=util[_0x9611('0x22')](_0x9611('0x6d'),_0x2edbd7[_0x9611('0x59')],_0x387c3c['id']);if(_0x17e892>0x6){_0x580d12=util[_0x9611('0x22')](_0x9611('0x6e'),_0x2edbd7['remoteUri'],_0x387c3c['id']);}logger[_0x9611('0x26')](_0x9611('0x73'),_0x9611('0x78'));emit(util[_0x9611('0x22')]('user:%s',_0x203901['name']),_0x9611('0x79'),{'uri':_0x580d12});})['catch'](function(_0x16dca6){logger[_0x9611('0x7a')]('[OUTBOUND]',JSON[_0x9611('0x20')](_0x16dca6));});};exports[_0x9611('0x7b')]=function(_0x3860ad,_0x45101b,_0x2049ce,_0x4b59da,_0x7909e6,_0x2c9a2a){var _0x1d24e3,_0x27dc02,_0x992d68,_0x5a7283;_0x2c9a2a[_0x9611('0x59')]=intUtil[_0x9611('0x58')](_0x2c9a2a[_0x9611('0x59')]);_0x2c9a2a[_0x9611('0x5a')]=intUtil[_0x9611('0x58')](_0x2c9a2a[_0x9611('0x5a')]);def[_0x9611('0x5b')]=util[_0x9611('0x22')](_0x9611('0x5c'),_0x2c9a2a['remoteUri']);if(_0x7909e6&&_0x7909e6[_0x9611('0x5d')]){logger['info']('['+_0x45101b['lastevent'][_0x9611('0x7c')]()+']',_0x9611('0x5f'));_0x45101b[_0x9611('0x60')]=util[_0x9611('0x22')](_0x9611('0x61'),_0x2c9a2a[_0x9611('0x5a')],_0x45101b[_0x9611('0x62')],md5(_0x45101b[_0x9611('0x62')]));}else{_0x45101b[_0x9611('0x60')]='';}return getConnection(_0x2c9a2a)['then'](function(_0x33e62e){_0x5a7283=_0x33e62e;if(!_[_0x9611('0x25')](_0x4b59da)){return getUser(_0x2c9a2a,_0x4b59da[_0x9611('0x2a')],_0x5a7283);}else{return getUser(_0x2c9a2a,null,_0x5a7283);}})[_0x9611('0x2c')](function(_0x23cf45){_0x1d24e3=_0x23cf45;logger[_0x9611('0x26')](_0x9611('0x7d'),_0x1d24e3['id']);return getEndUser(_0x2c9a2a,_0x45101b[_0x9611('0x63')],_0x45101b['calleridnum'],_0x5a7283);})['then'](function(_0x19fe85){_0x27dc02=_0x19fe85;logger['info']('The\x20Enduser\x20ID\x20is:',_0x27dc02['id']);return getTicket(_0x2c9a2a,_0x1d24e3,_0x27dc02,_0x2049ce,_0x45101b,_0x2049ce[_0x9611('0x66')],_0x5a7283,'Inbound');})[_0x9611('0x2c')](function(_0x39b768){_0x992d68=_0x39b768;logger[_0x9611('0x26')](_0x9611('0x68'));logger['info'](_0x9611('0x69'),_0x992d68['id']);return setRelationship(_0x5a7283,_0x1d24e3,_0x992d68,_0x9611('0x6a'));})[_0x9611('0x2c')](function(){return setRelationship(_0x5a7283,_0x27dc02,_0x992d68,_0x9611('0x77'));})[_0x9611('0x2c')](function(){return getServerInfo(_0x5a7283);})[_0x9611('0x70')](function(_0x1cab8e){logger[_0x9611('0x7a')]('['+_0x45101b['lastevent'][_0x9611('0x7c')]()+']',JSON[_0x9611('0x20')](_0x1cab8e));});}; \ No newline at end of file +var _0x6def=['Contacts','parent_name','direction','length','forEach','variableName','idField','set_entry','JSON','stringify','Calls','format','Basic\x20%s','apiKey','toString','base64','isNil','info','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','find','entry_list','name_value_list','value','resolve','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','merge','map','type','nameField','content','string','customField','custom_fields','variable','push','customVariable','Variable','toLowerCase','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','user:%s','trigger:browser:url','catch','error','outbound','recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum','Outbound','users','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','unmanaged','lastevent','toUpperCase','recordingURL','calleridname','Inbound','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','localhost','POST','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by','description','Descriptions','date_start','toISOString','slice','duration_hours','duration_minutes','parent_id'];(function(_0x9cc7a1,_0x26cc4b){var _0x5ce50a=function(_0x16b7fb){while(--_0x16b7fb){_0x9cc7a1['push'](_0x9cc7a1['shift']());}};_0x5ce50a(++_0x26cc4b);}(_0x6def,0x15a));var _0xf6de=function(_0x4ed9a1,_0x10d683){_0x4ed9a1=_0x4ed9a1-0x0;var _0x22ba48=_0x6def[_0x4ed9a1];return _0x22ba48;};'use strict';var _=require(_0xf6de('0x0'));var rp=require(_0xf6de('0x1'));var BPromise=require(_0xf6de('0x2'));var md5=require('md5');var util=require(_0xf6de('0x3'));var Redis=require(_0xf6de('0x4'));var intUtil=require(_0xf6de('0x5'));var config=require(_0xf6de('0x6'));var logger=require(_0xf6de('0x7'))(_0xf6de('0x8'));config[_0xf6de('0x9')]=_['defaults'](config[_0xf6de('0x9')],{'host':_0xf6de('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var def={'method':_0xf6de('0xb'),'json':!![]};function emit(_0x257d42,_0x44ea91,_0x4f7986){io['to'](_0x257d42)['emit'](_0x44ea91,_0x4f7986);}function getTicket(_0x39cc1f,_0x137a65,_0x2a6795,_0x70270d,_0x5ff093,_0x4fe0fc,_0x60236c,_0x294e37){logger['info'](_0xf6de('0xc'));var _0x302d42=new Date();var _0x478994=[{'name':_0xf6de('0xd'),'value':intUtil[_0xf6de('0xe')](_0x70270d[_0xf6de('0xf')],_0x5ff093,'\x20')},{'name':_0xf6de('0x10'),'value':_0x137a65['id']},{'name':_0xf6de('0x11'),'value':_0x137a65['id']},{'name':_0xf6de('0x12'),'value':intUtil[_0xf6de('0xe')](_0x70270d[_0xf6de('0x13')],_0x5ff093,'\x0a')},{'name':_0xf6de('0x14'),'value':_0x302d42[_0xf6de('0x15')]()[_0xf6de('0x16')](0x0,0x13)['replace']('T','\x20')},{'name':_0xf6de('0x17'),'value':'0'},{'name':_0xf6de('0x18'),'value':'15'},{'name':_0xf6de('0x19'),'value':_0x2a6795['id']},{'name':'parent_type','value':_0xf6de('0x1a')},{'name':_0xf6de('0x1b'),'value':_0x2a6795['name']},{'name':_0xf6de('0x1c'),'value':_0x294e37}];if(_0x4fe0fc[_0xf6de('0x1d')]){_[_0xf6de('0x1e')](_0x4fe0fc,function(_0x39b845){if(_0x5ff093[_0x39b845[_0xf6de('0x1f')]]){_0x478994['push']({'name':_0x39b845[_0xf6de('0x20')],'value':_0x5ff093[_0x39b845[_0xf6de('0x1f')]]});}});}return request({'form':{'method':_0xf6de('0x21'),'input_type':_0xf6de('0x22'),'response_type':_0xf6de('0x22'),'rest_data':JSON[_0xf6de('0x23')]({'session':_0x60236c['id'],'module_name':_0xf6de('0x24'),'name_value_list':_0x478994})}});}function getAuth(_0x1653c6){return util[_0xf6de('0x25')](_0xf6de('0x26'),new Buffer(_0x1653c6[_0xf6de('0x27')]+':X')[_0xf6de('0x28')](_0xf6de('0x29')));}function getServerInfo(_0x2e0630){return request({'form':{'method':'get_server_info','input_type':_0xf6de('0x22'),'response_type':_0xf6de('0x22'),'rest_data':JSON['stringify']({'session':_0x2e0630['id']})}});}function getUser(_0x2cc3b8,_0x4af7f2,_0x1303fe){if(!_[_0xf6de('0x2a')](_0x4af7f2)){logger[_0xf6de('0x2b')](_0xf6de('0x2c'),_0x4af7f2);return request({'form':{'method':_0xf6de('0x2d'),'input_type':_0xf6de('0x22'),'response_type':_0xf6de('0x22'),'rest_data':JSON[_0xf6de('0x23')]({'session':_0x1303fe['id'],'module_name':_0xf6de('0x2e'),'query':util['format'](_0xf6de('0x2f'),_0x4af7f2),'order_by':'','offset':'0','select_fields':['id',_0xf6de('0xd'),_0xf6de('0x30')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xf6de('0x31')](function(_0xc2dbd8){if(_0xc2dbd8['entry_list'][_0xf6de('0x1d')]){var _0xa56aa9=_[_0xf6de('0x32')](_0xc2dbd8[_0xf6de('0x33')],function(_0xf8d23){return _0xf8d23[_0xf6de('0x34')][_0xf6de('0x30')]['value']===_0x4af7f2;});if(_0xa56aa9){logger[_0xf6de('0x2b')]('Agent\x20found!');return BPromise['resolve']({'id':_0xa56aa9['name_value_list']['id'][_0xf6de('0x35')],'name':_0xa56aa9[_0xf6de('0x34')][_0xf6de('0xd')][_0xf6de('0x35')]});}}logger[_0xf6de('0x2b')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0xf6de('0x36')]({'id':_0x1303fe['name_value_list']['user_id'][_0xf6de('0x35')],'name':_0x1303fe[_0xf6de('0x34')][_0xf6de('0x30')][_0xf6de('0x35')]});});}else{logger[_0xf6de('0x2b')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0x1303fe['name_value_list']['user_id'][_0xf6de('0x35')],'name':_0x1303fe[_0xf6de('0x34')][_0xf6de('0x30')][_0xf6de('0x35')]});}}function getEndUser(_0x25e8a2,_0x15b5e5,_0x3f3f1f,_0x280232){logger[_0xf6de('0x2b')](_0xf6de('0x37'),_0x3f3f1f);return request({'form':{'method':'get_entry_list','input_type':_0xf6de('0x22'),'response_type':_0xf6de('0x22'),'rest_data':JSON['stringify']({'session':_0x280232['id'],'module_name':_0xf6de('0x1a'),'query':util[_0xf6de('0x25')](_0xf6de('0x38'),_0x3f3f1f),'order_by':'','offset':'0','select_fields':['id',_0xf6de('0xd'),_0xf6de('0x39')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x2b5703){if(_0x2b5703[_0xf6de('0x33')][_0xf6de('0x1d')]){var _0x56ab30=_[_0xf6de('0x32')](_0x2b5703[_0xf6de('0x33')],function(_0x5f4039){return _0x5f4039['name_value_list']['phone_home'][_0xf6de('0x35')]===_0x3f3f1f;});if(_0x56ab30){logger['info'](_0xf6de('0x3a'));return BPromise[_0xf6de('0x36')]({'id':_0x56ab30[_0xf6de('0x34')]['id'][_0xf6de('0x35')],'name':_0x56ab30['name_value_list'][_0xf6de('0xd')][_0xf6de('0x35')],'phone':_0x56ab30[_0xf6de('0x34')][_0xf6de('0x39')][_0xf6de('0x35')]});}}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0xf6de('0x21'),'input_type':_0xf6de('0x22'),'response_type':_0xf6de('0x22'),'rest_data':JSON[_0xf6de('0x23')]({'session':_0x280232['id'],'module_name':_0xf6de('0x1a'),'name_value_list':[{'name':_0xf6de('0x3b'),'value':_0x15b5e5!==_0xf6de('0x3c')?_0x15b5e5:util[_0xf6de('0x25')](_0xf6de('0x3d'),_0x3f3f1f)},{'name':_0xf6de('0x39'),'value':_0x3f3f1f}]})}})[_0xf6de('0x31')](function(_0x4e6e0b){logger[_0xf6de('0x2b')](_0xf6de('0x3e'));return BPromise[_0xf6de('0x36')]({'id':_0x4e6e0b['id'],'name':_0x4e6e0b['entry_list']['first_name'][_0xf6de('0x35')],'phone':_0x4e6e0b['entry_list'][_0xf6de('0x39')][_0xf6de('0x35')]});});}});}function request(_0x5f1c93){logger[_0xf6de('0x3f')](_0xf6de('0x40'),JSON[_0xf6de('0x23')](_0x5f1c93));return rp(_[_0xf6de('0x41')](def,_0x5f1c93));}function getTags(_0x49dc0a,_0x1737c2){var _0x2e851b=[];if(_0x49dc0a&&_0x49dc0a[_0xf6de('0x1d')]>0x0){_0x2e851b=_[_0xf6de('0x42')](_0x49dc0a,_0x1737c2);}return _0x2e851b;}function getCustomFields(_0xca2ecf,_0x48c887){var _0x702e9a=[];var _0x4a2709={'custom_fields':[]};if(_0xca2ecf[_0xf6de('0x1d')]>0x0){_['forEach'](_0xca2ecf,function(_0x3ea3bd){if(_0x3ea3bd[_0xf6de('0x43')]==='string'&&_0x3ea3bd[_0xf6de('0x44')]&&!_0x3ea3bd['customField']){_0x4a2709[_0x3ea3bd[_0xf6de('0x44')]['toLowerCase']()]=_0x3ea3bd[_0xf6de('0x45')][_0xf6de('0x28')]();}else if(_0x3ea3bd[_0xf6de('0x43')]===_0xf6de('0x46')&&_0x3ea3bd[_0xf6de('0x20')]&&_0x3ea3bd[_0xf6de('0x47')]){_0x4a2709[_0xf6de('0x48')]['push']({'id':_0x3ea3bd[_0xf6de('0x20')],'value':_0x3ea3bd[_0xf6de('0x45')][_0xf6de('0x28')]()});}else if(_0x3ea3bd['type']===_0xf6de('0x49')&&_0x3ea3bd[_0xf6de('0x1f')]&&_0x3ea3bd[_0xf6de('0x20')]&&_0x3ea3bd['customField']){_0x48c887[_0x3ea3bd[_0xf6de('0x1f')]]&&_0x4a2709[_0xf6de('0x48')][_0xf6de('0x4a')]({'id':_0x3ea3bd[_0xf6de('0x20')],'value':_0x48c887[_0x3ea3bd['variableName']]['toString']()});}else if(_0x3ea3bd['type']===_0xf6de('0x4b')&&_0x3ea3bd[_0xf6de('0x4c')]&&_0x3ea3bd[_0xf6de('0x4c')][_0xf6de('0xd')]&&_0x3ea3bd[_0xf6de('0x20')]&&_0x3ea3bd[_0xf6de('0x47')]){_0x48c887[_0x3ea3bd[_0xf6de('0x4c')][_0xf6de('0xd')][_0xf6de('0x4d')]()]&&_0x4a2709[_0xf6de('0x48')][_0xf6de('0x4a')]({'id':_0x3ea3bd[_0xf6de('0x20')],'value':_0x48c887[_0x3ea3bd['Variable'][_0xf6de('0xd')]['toLowerCase']()][_0xf6de('0x28')]()});}});}return _0x4a2709;}function getConnection(_0x1bcbb5){return request({'method':_0xf6de('0xb'),'form':{'method':_0xf6de('0x4e'),'input_type':_0xf6de('0x22'),'response_type':_0xf6de('0x22'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x1bcbb5[_0xf6de('0x4f')],'password':_0x1bcbb5[_0xf6de('0x50')],'encryption':_0xf6de('0x51')},'application':_0xf6de('0x52')})}})[_0xf6de('0x31')](function(_0x2a8539){var _0x350985=_0x2a8539;if(_0x350985['id']){def[_0xf6de('0x53')]=_0x350985['id'];return BPromise[_0xf6de('0x36')](_0x350985);}else{throw new Error(util[_0xf6de('0x25')](_0xf6de('0x54'),_0x1bcbb5['id']));}});}function setRelationship(_0x5b4a71,_0x3f51fd,_0x53ab52,_0x310837){return request({'form':{'method':'set_relationship','input_type':_0xf6de('0x22'),'response_type':'JSON','rest_data':JSON[_0xf6de('0x23')]({'session':_0x5b4a71['id'],'module_name':_0xf6de('0x24'),'module_id':_0x53ab52['id'],'link_field_name':_0x310837,'related_ids':[_0x3f51fd['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xf6de('0x55')]=function(_0x4c8cde,_0x13374e,_0x15e786,_0x1fd965,_0x461680,_0x20270c){var _0x3d18ae,_0x53bd2e,_0x1bee62,_0x21aad4;_0x20270c[_0xf6de('0x56')]=intUtil[_0xf6de('0x57')](_0x20270c['remoteUri']);_0x20270c[_0xf6de('0x58')]=intUtil[_0xf6de('0x57')](_0x20270c[_0xf6de('0x58')]);def[_0xf6de('0x59')]=util[_0xf6de('0x25')](_0xf6de('0x5a'),_0x20270c[_0xf6de('0x56')]);if(_0x461680&&_0x461680[_0xf6de('0x5b')]){logger[_0xf6de('0x2b')](_0xf6de('0x5c'),_0xf6de('0x5d'));_0x13374e['recordingURL']=util['format'](_0xf6de('0x5e'),_0x20270c['serverUrl'],_0x13374e['uniqueid'],md5(_0x13374e[_0xf6de('0x5f')]));}else{_0x13374e['recordingURL']='';}return getConnection(_0x20270c)['then'](function(_0x1a26b5){_0x21aad4=_0x1a26b5;return getUser(_0x20270c,_0x1fd965[_0xf6de('0xd')],_0x21aad4);})[_0xf6de('0x31')](function(_0x3542a3){_0x3d18ae=_0x3542a3;logger['info'](_0xf6de('0x60'),_0x3d18ae['id']);return getEndUser(_0x20270c,_0x13374e['calleridname'],_0x13374e[_0xf6de('0x61')],_0x21aad4);})['then'](function(_0x30b53f){_0x53bd2e=_0x30b53f;logger[_0xf6de('0x2b')](_0xf6de('0x62'),_0x53bd2e['id']);return getTicket(_0x20270c,_0x3d18ae,_0x53bd2e,_0x15e786,_0x13374e,_0x15e786[_0xf6de('0x63')],_0x21aad4,'Inbound');})[_0xf6de('0x31')](function(_0x5d4d3c){_0x1bee62=_0x5d4d3c;logger[_0xf6de('0x2b')](_0xf6de('0x64'));logger[_0xf6de('0x2b')](_0xf6de('0x65'),_0x1bee62['id']);return setRelationship(_0x21aad4,_0x3d18ae,_0x1bee62,'users');})['then'](function(){return setRelationship(_0x21aad4,_0x53bd2e,_0x1bee62,_0xf6de('0x66'));})[_0xf6de('0x31')](function(){return getServerInfo(_0x21aad4);})['then'](function(_0x367884){var _0x21063c=parseInt(_0x367884[_0xf6de('0x67')][_0xf6de('0x68')](0x0));var _0x42848e=util[_0xf6de('0x25')](_0xf6de('0x69'),_0x20270c[_0xf6de('0x56')],_0x1bee62['id']);if(_0x21063c>0x6){_0x42848e=util[_0xf6de('0x25')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x20270c[_0xf6de('0x56')],_0x1bee62['id']);}logger[_0xf6de('0x2b')](_0xf6de('0x5c'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xf6de('0x25')](_0xf6de('0x6a'),_0x1fd965['name']),_0xf6de('0x6b'),{'uri':_0x42848e});})[_0xf6de('0x6c')](function(_0x25a482){logger[_0xf6de('0x6d')](_0xf6de('0x5c'),JSON[_0xf6de('0x23')](_0x25a482));});};exports[_0xf6de('0x6e')]=function(_0x4904d0,_0xdd213f,_0x16b2f2,_0x2e6f6d,_0x4f6156,_0x41f55a,_0x2e37d4){var _0x336f42,_0x1f6f26,_0xad78be,_0x3c5007;_0x41f55a[_0xf6de('0x56')]=intUtil[_0xf6de('0x57')](_0x41f55a[_0xf6de('0x56')]);_0x41f55a['serverUrl']=intUtil[_0xf6de('0x57')](_0x41f55a[_0xf6de('0x58')]);def[_0xf6de('0x59')]=util[_0xf6de('0x25')]('%s/service/v4_1/rest.php',_0x41f55a['remoteUri']);if(_0x2e37d4&&_0x2e37d4['recordingFormat']&&_0x2e37d4[_0xf6de('0x6f')]!=='none'){logger[_0xf6de('0x2b')](_0xf6de('0x70'),_0xf6de('0x5d'));_0xdd213f['recordingURL']=util['format'](_0xf6de('0x5e'),_0x41f55a[_0xf6de('0x58')],_0xdd213f[_0xf6de('0x5f')],md5(_0xdd213f[_0xf6de('0x5f')]));}return getConnection(_0x41f55a)[_0xf6de('0x31')](function(_0x3c6210){_0x3c5007=_0x3c6210;return getUser(_0x41f55a,_0x2e6f6d[_0xf6de('0xd')],_0x3c5007);})[_0xf6de('0x31')](function(_0x407755){_0x336f42=_0x407755;logger[_0xf6de('0x2b')]('The\x20User\x20ID\x20is:',_0x336f42['id']);return getEndUser(_0x41f55a,_0xdd213f[_0xf6de('0x71')],_0xdd213f[_0xf6de('0x72')],_0x3c5007);})[_0xf6de('0x31')](function(_0x3de29c){_0x1f6f26=_0x3de29c;logger[_0xf6de('0x2b')](_0xf6de('0x62'),_0x1f6f26['id']);return getTicket(_0x41f55a,_0x336f42,_0x1f6f26,_0x16b2f2,_0xdd213f,_0x16b2f2[_0xf6de('0x63')],_0x3c5007,_0xf6de('0x73'));})[_0xf6de('0x31')](function(_0x180abb){_0xad78be=_0x180abb;logger[_0xf6de('0x2b')]('Ticket\x20created!');logger[_0xf6de('0x2b')](_0xf6de('0x65'),_0xad78be['id']);return setRelationship(_0x3c5007,_0x336f42,_0xad78be,_0xf6de('0x74'));})[_0xf6de('0x31')](function(){return setRelationship(_0x3c5007,_0x1f6f26,_0xad78be,_0xf6de('0x66'));})[_0xf6de('0x31')](function(){return getServerInfo(_0x3c5007);})['then'](function(_0x1905b0){var _0x3965c7=parseInt(_0x1905b0['version']['charAt'](0x0));var _0xb75ba6=util[_0xf6de('0x25')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x41f55a[_0xf6de('0x56')],_0xad78be['id']);if(_0x3965c7>0x6){_0xb75ba6=util[_0xf6de('0x25')](_0xf6de('0x75'),_0x41f55a[_0xf6de('0x56')],_0xad78be['id']);}logger[_0xf6de('0x2b')](_0xf6de('0x70'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xf6de('0x25')](_0xf6de('0x6a'),_0x2e6f6d['name']),_0xf6de('0x6b'),{'uri':_0xb75ba6});})[_0xf6de('0x6c')](function(_0xa04f97){logger[_0xf6de('0x6d')](_0xf6de('0x70'),JSON[_0xf6de('0x23')](_0xa04f97));});};exports[_0xf6de('0x76')]=function(_0x1b28ba,_0x5b6478,_0x5e5148,_0x1962ee,_0x2c2ab8,_0xa22611){var _0x431328,_0x1ea106,_0x277747,_0xd76077;_0xa22611[_0xf6de('0x56')]=intUtil[_0xf6de('0x57')](_0xa22611['remoteUri']);_0xa22611[_0xf6de('0x58')]=intUtil[_0xf6de('0x57')](_0xa22611[_0xf6de('0x58')]);def['uri']=util[_0xf6de('0x25')](_0xf6de('0x5a'),_0xa22611['remoteUri']);if(_0x2c2ab8&&_0x2c2ab8[_0xf6de('0x5b')]){logger[_0xf6de('0x2b')]('['+_0x5b6478[_0xf6de('0x77')][_0xf6de('0x78')]()+']',_0xf6de('0x5d'));_0x5b6478[_0xf6de('0x79')]=util[_0xf6de('0x25')](_0xf6de('0x5e'),_0xa22611[_0xf6de('0x58')],_0x5b6478[_0xf6de('0x5f')],md5(_0x5b6478[_0xf6de('0x5f')]));}else{_0x5b6478['recordingURL']='';}return getConnection(_0xa22611)['then'](function(_0x3e3393){_0xd76077=_0x3e3393;if(!_[_0xf6de('0x2a')](_0x1962ee)){return getUser(_0xa22611,_0x1962ee[_0xf6de('0xd')],_0xd76077);}else{return getUser(_0xa22611,null,_0xd76077);}})[_0xf6de('0x31')](function(_0x550d02){_0x431328=_0x550d02;logger[_0xf6de('0x2b')]('The\x20User\x20ID\x20is:',_0x431328['id']);return getEndUser(_0xa22611,_0x5b6478[_0xf6de('0x7a')],_0x5b6478[_0xf6de('0x61')],_0xd76077);})[_0xf6de('0x31')](function(_0x9736b1){_0x1ea106=_0x9736b1;logger[_0xf6de('0x2b')](_0xf6de('0x62'),_0x1ea106['id']);return getTicket(_0xa22611,_0x431328,_0x1ea106,_0x5e5148,_0x5b6478,_0x5e5148[_0xf6de('0x63')],_0xd76077,_0xf6de('0x7b'));})[_0xf6de('0x31')](function(_0x9107cc){_0x277747=_0x9107cc;logger['info'](_0xf6de('0x64'));logger[_0xf6de('0x2b')](_0xf6de('0x65'),_0x277747['id']);return setRelationship(_0xd76077,_0x431328,_0x277747,_0xf6de('0x74'));})['then'](function(){return setRelationship(_0xd76077,_0x1ea106,_0x277747,_0xf6de('0x66'));})[_0xf6de('0x31')](function(){return getServerInfo(_0xd76077);})[_0xf6de('0x6c')](function(_0xd9f1ed){logger[_0xf6de('0x6d')]('['+_0x5b6478['lastevent']['toUpperCase']()+']',JSON[_0xf6de('0x23')](_0xd9f1ed));});}; \ 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 397bb8e..027297d 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 _0xf18e=['keyType','key','%s:\x20%s','keyContent','variableName','format','join','stripTrailingSlash','slice','lastIndexOf','test','lodash','util','length','sortBy','type','string','content','variable','push','customVariable','Variable','name','toLowerCase','toString','keyValue'];(function(_0x956556,_0x11ee46){var _0x1dddae=function(_0x1b06ad){while(--_0x1b06ad){_0x956556['push'](_0x956556['shift']());}};_0x1dddae(++_0x11ee46);}(_0xf18e,0x191));var _0xef18=function(_0x490048,_0x32c740){_0x490048=_0x490048-0x0;var _0x34212d=_0xf18e[_0x490048];return _0x34212d;};'use strict';var _=require(_0xef18('0x0'));var util=require(_0xef18('0x1'));exports['getString']=function(_0x1a66de,_0x5d63da,_0x404929){var _0x51b5fb=[];if(_0x1a66de[_0xef18('0x2')]>0x0){var _0x3ba7b5=_[_0xef18('0x3')](_0x1a66de,['id']);for(var _0x1439a5=0x0;_0x1439a5<_0x3ba7b5[_0xef18('0x2')];_0x1439a5++){var _0x353341=_0x3ba7b5[_0x1439a5];if(_0x353341[_0xef18('0x4')]===_0xef18('0x5')){_0x51b5fb['push'](_0x353341[_0xef18('0x6')]);}else if(_0x353341[_0xef18('0x4')]===_0xef18('0x7')&&_0x353341['variableName']){_0x5d63da[_0x353341['variableName']]&&_0x51b5fb[_0xef18('0x8')](_0x5d63da[_0x353341['variableName']]['toString']());}else if(_0x353341[_0xef18('0x4')]===_0xef18('0x9')&&_0x353341[_0xef18('0xa')]&&_0x353341[_0xef18('0xa')][_0xef18('0xb')]){_0x5d63da[_0x353341[_0xef18('0xa')][_0xef18('0xb')][_0xef18('0xc')]()]&&_0x51b5fb[_0xef18('0x8')](_0x5d63da[_0x353341[_0xef18('0xa')][_0xef18('0xb')][_0xef18('0xc')]()][_0xef18('0xd')]());}else if(_0x353341[_0xef18('0x4')]===_0xef18('0xe')){if(_0x353341[_0xef18('0xf')]===_0xef18('0x5')&&_0x353341[_0xef18('0x10')]){_0x51b5fb['push'](util['format'](_0xef18('0x11'),_0x353341[_0xef18('0x10')],_0x353341[_0xef18('0x12')]));}else if(_0x353341['keyType']===_0xef18('0x7')&&_0x353341[_0xef18('0x13')]&&_0x353341[_0xef18('0x10')]){_0x5d63da[_0x353341['variableName']]&&_0x51b5fb['push'](util[_0xef18('0x14')](_0xef18('0x11'),_0x353341[_0xef18('0x10')],_0x5d63da[_0x353341[_0xef18('0x13')]]));}else if(_0x353341[_0xef18('0xf')]===_0xef18('0x9')&&_0x353341[_0xef18('0xa')]&&_0x353341[_0xef18('0xa')][_0xef18('0xb')]&&_0x353341['key']){_0x5d63da[_0x353341[_0xef18('0xa')]['name'][_0xef18('0xc')]()]&&_0x51b5fb[_0xef18('0x8')](util['format'](_0xef18('0x11'),_0x353341[_0xef18('0x10')],_0x5d63da[_0x353341[_0xef18('0xa')][_0xef18('0xb')][_0xef18('0xc')]()]));}}}}return _0x51b5fb[_0xef18('0x15')](_0x404929);};exports[_0xef18('0x16')]=function(_0x5327c8){var _0x5d89a8=_0x5327c8[_0xef18('0x17')](-0x1);if(_0x5d89a8==='/'){_0x5327c8=_0x5327c8['substring'](0x0,_0x5327c8[_0xef18('0x18')](_0x5d89a8));}return _0x5327c8;};exports['validateEmail']=function(_0x16169f){if(!_['isNil'](_0x16169f)&&_0x16169f!==''){var _0x5afac=/^(([^<>()\[\]\\.,;:\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 _0x5afac[_0xef18('0x19')](String(_0x16169f)['toLowerCase']());}else{return![];}}; \ No newline at end of file +var _0x8522=['length','sortBy','type','push','content','variableName','customVariable','Variable','name','toLowerCase','toString','keyValue','keyType','string','key','keyContent','variable','format','%s:\x20%s','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','test','lodash','util'];(function(_0x56350e,_0x2d5066){var _0x279f6c=function(_0x30da99){while(--_0x30da99){_0x56350e['push'](_0x56350e['shift']());}};_0x279f6c(++_0x2d5066);}(_0x8522,0xbb));var _0x2852=function(_0x59e862,_0x477bf2){_0x59e862=_0x59e862-0x0;var _0x1a25ee=_0x8522[_0x59e862];return _0x1a25ee;};'use strict';var _=require(_0x2852('0x0'));var util=require(_0x2852('0x1'));exports['getString']=function(_0x130b9c,_0x1e409b,_0xe0eb93){var _0x54c2df=[];if(_0x130b9c[_0x2852('0x2')]>0x0){var _0x1fe657=_[_0x2852('0x3')](_0x130b9c,['id']);for(var _0x416343=0x0;_0x416343<_0x1fe657[_0x2852('0x2')];_0x416343++){var _0x553f1e=_0x1fe657[_0x416343];if(_0x553f1e[_0x2852('0x4')]==='string'){_0x54c2df[_0x2852('0x5')](_0x553f1e[_0x2852('0x6')]);}else if(_0x553f1e[_0x2852('0x4')]==='variable'&&_0x553f1e[_0x2852('0x7')]){_0x1e409b[_0x553f1e[_0x2852('0x7')]]&&_0x54c2df[_0x2852('0x5')](_0x1e409b[_0x553f1e[_0x2852('0x7')]]['toString']());}else if(_0x553f1e[_0x2852('0x4')]===_0x2852('0x8')&&_0x553f1e['Variable']&&_0x553f1e[_0x2852('0x9')][_0x2852('0xa')]){_0x1e409b[_0x553f1e[_0x2852('0x9')]['name'][_0x2852('0xb')]()]&&_0x54c2df['push'](_0x1e409b[_0x553f1e[_0x2852('0x9')][_0x2852('0xa')][_0x2852('0xb')]()][_0x2852('0xc')]());}else if(_0x553f1e[_0x2852('0x4')]===_0x2852('0xd')){if(_0x553f1e[_0x2852('0xe')]===_0x2852('0xf')&&_0x553f1e[_0x2852('0x10')]){_0x54c2df['push'](util['format']('%s:\x20%s',_0x553f1e[_0x2852('0x10')],_0x553f1e[_0x2852('0x11')]));}else if(_0x553f1e['keyType']===_0x2852('0x12')&&_0x553f1e[_0x2852('0x7')]&&_0x553f1e[_0x2852('0x10')]){_0x1e409b[_0x553f1e[_0x2852('0x7')]]&&_0x54c2df[_0x2852('0x5')](util[_0x2852('0x13')](_0x2852('0x14'),_0x553f1e['key'],_0x1e409b[_0x553f1e['variableName']]));}else if(_0x553f1e['keyType']===_0x2852('0x8')&&_0x553f1e['Variable']&&_0x553f1e[_0x2852('0x9')]['name']&&_0x553f1e[_0x2852('0x10')]){_0x1e409b[_0x553f1e[_0x2852('0x9')]['name']['toLowerCase']()]&&_0x54c2df[_0x2852('0x5')](util[_0x2852('0x13')](_0x2852('0x14'),_0x553f1e[_0x2852('0x10')],_0x1e409b[_0x553f1e['Variable'][_0x2852('0xa')][_0x2852('0xb')]()]));}}}}return _0x54c2df['join'](_0xe0eb93);};exports[_0x2852('0x15')]=function(_0x508264){var _0x28996b=_0x508264[_0x2852('0x16')](-0x1);if(_0x28996b==='/'){_0x508264=_0x508264[_0x2852('0x17')](0x0,_0x508264[_0x2852('0x18')](_0x28996b));}return _0x508264;};exports[_0x2852('0x19')]=function(_0x3a4c52){if(!_['isNil'](_0x3a4c52)&&_0x3a4c52!==''){var _0x9abc25=/^(([^<>()\[\]\\.,;:\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 _0x9abc25[_0x2852('0x1a')](String(_0x3a4c52)[_0x2852('0xb')]());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index a4c49e1..669a8b2 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['redis','defaults','localhost','emit','length','forEach','includes','string','picklist','type','idField','toString','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','getString','Subjects','POST','format','remoteUri','create','sessionName','HelpDesk','stringify','success','error','catch','statusCode','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','query','username','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','result','Agent\x20found!','resolve','email1','first_name','last_name','userId','[vTiger],\x20%s,\x20%s,\x20%s','getUser','admin','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','phone','getEndUser','accessKey','getchallenge','then','login','token','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','recordingURL','email','The\x20User\x20ID\x20is:','calleridnum','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','outbound','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','uniqueid','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','split','unmanaged','lastevent','toUpperCase','calleridname','lodash','request-promise','bluebird','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger'];(function(_0x4d309f,_0x42b836){var _0x5dae3f=function(_0x5a0b18){while(--_0x5a0b18){_0x4d309f['push'](_0x4d309f['shift']());}};_0x5dae3f(++_0x42b836);}(_0x34e8,0x12c));var _0x834e=function(_0x3cf472,_0xc06468){_0x3cf472=_0x3cf472-0x0;var _0x15c951=_0x34e8[_0x3cf472];return _0x15c951;};'use strict';var _=require(_0x834e('0x0'));var rp=require(_0x834e('0x1'));var BPromise=require(_0x834e('0x2'));var md5=require(_0x834e('0x3'));var util=require('util');var Redis=require(_0x834e('0x4'));var intUtil=require(_0x834e('0x5'));var config=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));config[_0x834e('0x9')]=_[_0x834e('0xa')](config['redis'],{'host':_0x834e('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x834e('0x9')]));function emit(_0x3cc2e3,_0x3a3ef6,_0x2e69e2){io['to'](_0x3cc2e3)[_0x834e('0xc')](_0x3a3ef6,_0x2e69e2);}function getCustomFields(_0x23501c,_0x363786){var _0x1af45a={};if(_0x23501c[_0x834e('0xd')]>0x0){_[_0x834e('0xe')](_0x23501c,function(_0x1e41fe){if(_[_0x834e('0xf')]([_0x834e('0x10'),_0x834e('0x11')],_0x1e41fe[_0x834e('0x12')])&&_0x1e41fe[_0x834e('0x13')]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x1e41fe['content'][_0x834e('0x14')]();}else if(_0x1e41fe[_0x834e('0x12')]==='variable'&&_0x1e41fe[_0x834e('0x15')]&&_0x1e41fe[_0x834e('0x13')]&&_0x363786[_0x1e41fe[_0x834e('0x15')]]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x363786[_0x1e41fe['variableName']][_0x834e('0x14')]();}else if(_0x1e41fe[_0x834e('0x12')]==='customVariable'&&_0x1e41fe[_0x834e('0x16')]&&_0x1e41fe['Variable'][_0x834e('0x17')]&&_0x1e41fe[_0x834e('0x13')]&&_0x363786[_0x1e41fe['Variable'][_0x834e('0x17')][_0x834e('0x18')]()]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x363786[_0x1e41fe['Variable'][_0x834e('0x17')][_0x834e('0x18')]()][_0x834e('0x14')]();}});}return _0x1af45a;}function createTicket(_0xb993a1,_0x237947,_0x254677,_0x1dd214,_0x595515,_0x2545b4,_0x1fd2c6){logger[_0x834e('0x19')](_0x834e('0x1a'));var _0x4ab05d=_[_0x834e('0x1b')]({'parent_id':'','assigned_user_id':_0x237947['id'],'ticketpriorities':_0x834e('0x1c'),'ticketstatus':'Open','ticket_title':intUtil[_0x834e('0x1d')](_0x1dd214[_0x834e('0x1e')],_0x595515,'\x20'),'description':intUtil[_0x834e('0x1d')](_0x1dd214['Descriptions'],_0x595515,'\x0a'),'contact_id':_0x254677['id']},getCustomFields(_0x2545b4,_0x595515));var _0x4e3f48={'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')]('%s/webservice.php',_0xb993a1[_0x834e('0x21')]),'form':{'operation':_0x834e('0x22'),'username':_0xb993a1['username'],'sessionName':_0x1fd2c6[_0x834e('0x23')],'elementType':_0x834e('0x24'),'element':JSON[_0x834e('0x25')](_0x4ab05d)},'json':!![]};return request(_0x4e3f48)['then'](function(_0x24fcf7){if(_0x24fcf7[_0x834e('0x26')]){return BPromise['resolve']({'id':_0x24fcf7['result']['id']});}else{throw new Error(util[_0x834e('0x20')]('Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s',JSON[_0x834e('0x25')](_0x24fcf7[_0x834e('0x27')])));}})[_0x834e('0x28')](function(_0x2cc2eb){var _0x3cd928=_0x2cc2eb[_0x834e('0x29')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s','createTicket',_0x3cd928,JSON['stringify'](_0x2cc2eb));});}function getUser(_0x2c7a8d,_0x567cea,_0x106d6a){if(intUtil['validateEmail'](_0x567cea)){logger[_0x834e('0x19')](_0x834e('0x2a'),_0x567cea);return request({'method':_0x834e('0x2b'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x2c7a8d[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x2d'),'username':_0x2c7a8d[_0x834e('0x2e')],'sessionName':_0x106d6a[_0x834e('0x23')],'query':util['format'](_0x834e('0x2f'),_0x567cea)},'json':!![]})['then'](function(_0x2c75c2){if(_0x2c75c2[_0x834e('0x26')]&&_0x2c75c2[_0x834e('0x30')][_0x834e('0xd')]){logger[_0x834e('0x19')](_0x834e('0x31'));return BPromise[_0x834e('0x32')]({'id':_0x2c75c2[_0x834e('0x30')][0x0]['id'],'email':_0x2c75c2[_0x834e('0x30')][0x0][_0x834e('0x33')],'name':_0x2c75c2['result'][0x0][_0x834e('0x34')]+'\x20'+_0x2c75c2[_0x834e('0x30')][_0x834e('0x35')]});}else{logger[_0x834e('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x834e('0x32')]({'id':_0x106d6a[_0x834e('0x36')],'email':_0x2c7a8d['username'],'name':'admin'});}})['catch'](function(_0x3e58fa){var _0x41bf4d=_0x3e58fa[_0x834e('0x29')]||0x1f4;logger[_0x834e('0x27')](_0x834e('0x37'),_0x834e('0x38'),_0x41bf4d,JSON['stringify'](_0x3e58fa));});}else{logger[_0x834e('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x834e('0x32')]({'id':_0x106d6a[_0x834e('0x36')],'email':_0x2c7a8d['username'],'name':_0x834e('0x39')})[_0x834e('0x28')](function(_0x491c28){var _0x481f70=_0x491c28[_0x834e('0x29')]||0x1f4;logger[_0x834e('0x27')](_0x834e('0x37'),_0x834e('0x38'),_0x481f70,JSON[_0x834e('0x25')](_0x491c28));});}}function getEndUser(_0x4ca43c,_0x1c5ed6,_0x548d1d,_0x50c243){logger[_0x834e('0x19')]('Searching\x20end\x20user\x20with\x20phone',_0x548d1d);return request({'method':_0x834e('0x2b'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x4ca43c[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x2d'),'username':_0x4ca43c['username'],'sessionName':_0x50c243[_0x834e('0x23')],'query':util[_0x834e('0x20')](_0x834e('0x3a'),_0x548d1d,_0x548d1d,_0x548d1d,_0x548d1d,_0x548d1d)},'json':!![]})['then'](function(_0x35380e){if(_0x35380e[_0x834e('0x26')]&&_0x35380e['result'][_0x834e('0xd')]){logger['info'](_0x834e('0x3b'));return BPromise[_0x834e('0x32')]({'id':_0x35380e['result'][0x0]['id'],'name':_0x35380e['result'][0x0][_0x834e('0x3c')]+'\x20'+_0x35380e[_0x834e('0x30')][0x0][_0x834e('0x3d')],'phone':_0x548d1d});}else{logger[_0x834e('0x19')](_0x834e('0x3e'));return request({'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')]('%s/webservice.php',_0x4ca43c[_0x834e('0x21')]),'form':{'operation':'create','sessionName':_0x50c243[_0x834e('0x23')],'elementType':'Contacts','element':JSON[_0x834e('0x25')]({'lastname':_0x1c5ed6,'phone':_0x548d1d,'assigned_user_id':'\x20'})},'json':!![]})['then'](function(_0x361f60){logger[_0x834e('0x19')]('Enduser\x20created.');return BPromise[_0x834e('0x32')]({'id':_0x361f60[_0x834e('0x30')]['id'],'name':_0x361f60[_0x834e('0x30')][_0x834e('0x3d')],'phone':_0x361f60[_0x834e('0x30')][_0x834e('0x3f')]});})[_0x834e('0x28')](function(_0x3ccd8e){var _0x5dc63b=_0x3ccd8e[_0x834e('0x29')]||0x1f4;logger['error'](_0x834e('0x37'),_0x834e('0x40'),_0x5dc63b,JSON['stringify'](_0x3ccd8e));});}});}function getConnection(_0x112306){var _0x42fd90=_0x112306[_0x834e('0x2e')];var _0x2112d5=_0x112306[_0x834e('0x41')];return request({'method':_0x834e('0x2b'),'uri':util['format']('%s/webservice.php',_0x112306[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x42'),'username':_0x42fd90},'json':!![]})[_0x834e('0x43')](function(_0x40ff5a){if(_0x40ff5a[_0x834e('0x26')]){return request({'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x112306[_0x834e('0x21')]),'form':{'operation':_0x834e('0x44'),'username':_0x42fd90,'accessKey':md5(_0x40ff5a[_0x834e('0x30')][_0x834e('0x45')]+_0x2112d5)},'json':!![]});}})[_0x834e('0x43')](function(_0x1a3237){if(_0x1a3237[_0x834e('0x26')]){return BPromise[_0x834e('0x32')](_0x1a3237[_0x834e('0x30')]);}else{throw new Error(util[_0x834e('0x20')](_0x834e('0x46'),_0x112306['id']));}})[_0x834e('0x28')](function(_0x4cfacd){var _0x1cc0b8=_0x4cfacd[_0x834e('0x29')]||0x1f4;logger['error'](_0x834e('0x37'),_0x834e('0x47'),_0x1cc0b8,JSON['stringify'](_0x4cfacd));});}function request(_0x3dcca3){logger[_0x834e('0x19')](_0x834e('0x48'),JSON[_0x834e('0x25')](_0x3dcca3));return rp(_0x3dcca3);}exports[_0x834e('0x49')]=function(_0xb77aab,_0x4549ba,_0x4a8b32,_0x1ad7fe,_0x8bc6c6,_0x3e0550){var _0x363675,_0x86ad2b,_0x396bbe,_0x344b51;_0x3e0550[_0x834e('0x21')]=intUtil['stripTrailingSlash'](_0x3e0550[_0x834e('0x21')]);if(_0x8bc6c6&&_0x8bc6c6['monitor_format']){logger[_0x834e('0x19')]('[QUEUE]',_0x834e('0x4a'));_0x4549ba['recordingURL']=util['format'](_0x834e('0x4b'),_0x3e0550[_0x834e('0x4c')],_0x4549ba['uniqueid'],md5(_0x4549ba['uniqueid']));}else{_0x4549ba[_0x834e('0x4d')]='';}return getConnection(_0x3e0550)[_0x834e('0x43')](function(_0x138ed2){_0x344b51=_0x138ed2;return getUser(_0x3e0550,_0x1ad7fe[_0x834e('0x4e')],_0x344b51);})[_0x834e('0x43')](function(_0x315858){_0x363675=_0x315858;logger[_0x834e('0x19')](_0x834e('0x4f'),_0x363675['id']);return getEndUser(_0x3e0550,_0x4549ba['calleridname'],_0x4549ba[_0x834e('0x50')],_0x344b51);})[_0x834e('0x43')](function(_0x5d5ac2){_0x86ad2b=_0x5d5ac2;logger[_0x834e('0x19')]('The\x20Enduser\x20ID\x20is:',_0x86ad2b['id']);return createTicket(_0x3e0550,_0x363675,_0x86ad2b,_0x4a8b32,_0x4549ba,_0x4a8b32[_0x834e('0x51')],_0x344b51);})[_0x834e('0x43')](function(_0x5160c4){_0x396bbe=_0x5160c4;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')](_0x834e('0x53'),_0x396bbe['id']);var _0x5a2924=util[_0x834e('0x20')](_0x834e('0x54'),_0x3e0550[_0x834e('0x21')],_['split'](_0x396bbe['id'],'x')[0x1]);logger[_0x834e('0x19')](_0x834e('0x55'),_0x834e('0x56'));emit(util[_0x834e('0x20')](_0x834e('0x57'),_0x1ad7fe[_0x834e('0x17')]),_0x834e('0x58'),{'uri':_0x5a2924});})[_0x834e('0x28')](function(_0x208c21){logger[_0x834e('0x27')](_0x834e('0x55'),JSON[_0x834e('0x25')](_0x208c21));});};exports[_0x834e('0x59')]=function(_0x1659c8,_0x460a7a,_0x17b8e3,_0x297cce,_0x14ed83,_0x193a15,_0x3e3467){var _0xed4081,_0x2cb233,_0x5c83eb,_0x2145cf;_0x193a15[_0x834e('0x21')]=intUtil[_0x834e('0x5a')](_0x193a15[_0x834e('0x21')]);_0x193a15['serverUrl']=intUtil[_0x834e('0x5a')](_0x193a15['serverUrl']);if(_0x3e3467&&_0x3e3467['recordingFormat']&&_0x3e3467[_0x834e('0x5b')]!==_0x834e('0x5c')){logger[_0x834e('0x19')](_0x834e('0x5d'),_0x834e('0x4a'));_0x460a7a[_0x834e('0x4d')]=util[_0x834e('0x20')](_0x834e('0x4b'),_0x193a15['serverUrl'],_0x460a7a[_0x834e('0x5e')],md5(_0x460a7a['uniqueid']));}return getConnection(_0x193a15)[_0x834e('0x43')](function(_0xd35dda){_0x2145cf=_0xd35dda;return getUser(_0x193a15,_0x297cce['email'],_0x2145cf);})['then'](function(_0x4a4def){_0xed4081=_0x4a4def;logger[_0x834e('0x19')](_0x834e('0x4f'),_0xed4081['id']);return getEndUser(_0x193a15,_0x460a7a[_0x834e('0x5f')],_0x460a7a[_0x834e('0x60')],_0x2145cf);})['then'](function(_0x2b0d93){_0x2cb233=_0x2b0d93;logger[_0x834e('0x19')](_0x834e('0x61'),_0x2cb233['id']);return createTicket(_0x193a15,_0xed4081,_0x2cb233,_0x17b8e3,_0x460a7a,_0x17b8e3[_0x834e('0x51')],_0x2145cf);})[_0x834e('0x43')](function(_0x28b5c9){_0x5c83eb=_0x28b5c9;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')](_0x834e('0x53'),_0x5c83eb['id']);var _0x5b2bf6=util[_0x834e('0x20')](_0x834e('0x54'),_0x193a15[_0x834e('0x21')],_[_0x834e('0x62')](_0x5c83eb['id'],'x')[0x1]);logger['info'](_0x834e('0x5d'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x297cce[_0x834e('0x17')]),_0x834e('0x58'),{'uri':_0x5b2bf6});})['catch'](function(_0x2645df){logger[_0x834e('0x27')]('[OUTBOUND]',JSON[_0x834e('0x25')](_0x2645df));});};exports[_0x834e('0x63')]=function(_0x4b88e7,_0x5df169,_0x346be5,_0x2a42a3,_0x8bc7d9,_0x44c909){var _0x1d8e7,_0x493239,_0x264a6f,_0x520367;_0x44c909[_0x834e('0x21')]=intUtil[_0x834e('0x5a')](_0x44c909[_0x834e('0x21')]);_0x44c909['serverUrl']=intUtil[_0x834e('0x5a')](_0x44c909[_0x834e('0x4c')]);if(_0x8bc7d9&&_0x8bc7d9['monitor_format']){logger[_0x834e('0x19')]('['+_0x5df169[_0x834e('0x64')][_0x834e('0x65')]()+']','Recording\x20is\x20enabled!');_0x5df169[_0x834e('0x4d')]=util[_0x834e('0x20')](_0x834e('0x4b'),_0x44c909[_0x834e('0x4c')],_0x5df169[_0x834e('0x5e')],md5(_0x5df169[_0x834e('0x5e')]));}else{_0x5df169[_0x834e('0x4d')]='';}return getConnection(_0x44c909)[_0x834e('0x43')](function(_0xd49002){_0x520367=_0xd49002;return getUser(_0x44c909,'',_0x520367);})[_0x834e('0x43')](function(_0x57d898){_0x1d8e7=_0x57d898;logger['info']('The\x20User\x20ID\x20is:',_0x1d8e7['id']);return getEndUser(_0x44c909,_0x5df169[_0x834e('0x66')],_0x5df169[_0x834e('0x50')],_0x520367);})[_0x834e('0x43')](function(_0x37fa2c){_0x493239=_0x37fa2c;logger[_0x834e('0x19')]('The\x20Enduser\x20ID\x20is:',_0x493239['id']);return createTicket(_0x44c909,_0x1d8e7,_0x493239,_0x346be5,_0x5df169,_0x346be5['Fields'],_0x520367);})[_0x834e('0x43')](function(_0x1ad428){_0x264a6f=_0x1ad428;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')]('The\x20Ticket\x20ID\x20is:',_0x264a6f['id']);})[_0x834e('0x28')](function(_0x2b162a){logger[_0x834e('0x27')]('['+_0x5df169['lastevent'][_0x834e('0x65')]()+']',JSON[_0x834e('0x25')](_0x2b162a));});}; \ No newline at end of file +var _0xa9e0=['variable','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','Normal','Open','Subjects','POST','format','%s/webservice.php','create','username','sessionName','HelpDesk','stringify','then','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','error','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','resolve','email1','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','statusCode','getUser','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','The\x20Enduser\x20ID\x20is:','Fields','split','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridname','lastevent','lodash','request-promise','bluebird','ioredis','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','length','forEach','includes','idField','content','toString','type'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xa9e0,0x123));var _0x0a9e=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xa9e0[_0x55f8b4];return _0x2475f9;};'use strict';var _=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var BPromise=require(_0x0a9e('0x2'));var md5=require('md5');var util=require('util');var Redis=require(_0x0a9e('0x3'));var intUtil=require('./util');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var io=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));function emit(_0x5f41ea,_0x503809,_0xe42b77){io['to'](_0x5f41ea)['emit'](_0x503809,_0xe42b77);}function getCustomFields(_0x52cace,_0x39753a){var _0xf81284={};if(_0x52cace[_0x0a9e('0xb')]>0x0){_[_0x0a9e('0xc')](_0x52cace,function(_0xfeb75b){if(_[_0x0a9e('0xd')](['string','picklist'],_0xfeb75b['type'])&&_0xfeb75b['idField']){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0xfeb75b[_0x0a9e('0xf')][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x12')&&_0xfeb75b[_0x0a9e('0x13')]&&_0xfeb75b['idField']&&_0x39753a[_0xfeb75b[_0x0a9e('0x13')]]){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0x39753a[_0xfeb75b[_0x0a9e('0x13')]][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x14')&&_0xfeb75b['Variable']&&_0xfeb75b[_0x0a9e('0x15')]['name']&&_0xfeb75b[_0x0a9e('0xe')]&&_0x39753a[_0xfeb75b['Variable'][_0x0a9e('0x16')][_0x0a9e('0x17')]()]){_0xf81284[_0xfeb75b['idField']]=_0x39753a[_0xfeb75b[_0x0a9e('0x15')]['name'][_0x0a9e('0x17')]()][_0x0a9e('0x10')]();}});}return _0xf81284;}function createTicket(_0x106033,_0x205fd6,_0x31b1ca,_0x2eb11f,_0x530eb7,_0x20559e,_0x1314ae){logger[_0x0a9e('0x18')](_0x0a9e('0x19'));var _0x105080=_['merge']({'parent_id':'','assigned_user_id':_0x205fd6['id'],'ticketpriorities':_0x0a9e('0x1a'),'ticketstatus':_0x0a9e('0x1b'),'ticket_title':intUtil['getString'](_0x2eb11f[_0x0a9e('0x1c')],_0x530eb7,'\x20'),'description':intUtil['getString'](_0x2eb11f['Descriptions'],_0x530eb7,'\x0a'),'contact_id':_0x31b1ca['id']},getCustomFields(_0x20559e,_0x530eb7));var _0x3a02e1={'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033['remoteUri']),'form':{'operation':_0x0a9e('0x20'),'username':_0x106033[_0x0a9e('0x21')],'sessionName':_0x1314ae[_0x0a9e('0x22')],'elementType':_0x0a9e('0x23'),'element':JSON[_0x0a9e('0x24')](_0x105080)},'json':!![]};return request(_0x3a02e1)[_0x0a9e('0x25')](function(_0x16b1ca){if(_0x16b1ca['success']){return BPromise['resolve']({'id':_0x16b1ca[_0x0a9e('0x26')]['id']});}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x27'),JSON[_0x0a9e('0x24')](_0x16b1ca['error'])));}})[_0x0a9e('0x28')](function(_0x479bc4){var _0x45a1e7=_0x479bc4['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x2b'),_0x45a1e7,JSON[_0x0a9e('0x24')](_0x479bc4));});}function getUser(_0x140511,_0x1538a4,_0x11c3b6){if(intUtil[_0x0a9e('0x2c')](_0x1538a4)){logger['info'](_0x0a9e('0x2d'),_0x1538a4);return request({'method':_0x0a9e('0x2e'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x140511['remoteUri']),'qs':{'operation':_0x0a9e('0x2f'),'username':_0x140511[_0x0a9e('0x21')],'sessionName':_0x11c3b6[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x30'),_0x1538a4)},'json':!![]})[_0x0a9e('0x25')](function(_0x296f41){if(_0x296f41[_0x0a9e('0x31')]&&_0x296f41[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')]('Agent\x20found!');return BPromise[_0x0a9e('0x32')]({'id':_0x296f41[_0x0a9e('0x26')][0x0]['id'],'email':_0x296f41[_0x0a9e('0x26')][0x0][_0x0a9e('0x33')],'name':_0x296f41[_0x0a9e('0x26')][0x0]['first_name']+'\x20'+_0x296f41[_0x0a9e('0x26')][_0x0a9e('0x34')]});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511[_0x0a9e('0x21')],'name':_0x0a9e('0x37')});}})['catch'](function(_0x44295a){var _0x5e7238=_0x44295a[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x39'),_0x5e7238,JSON['stringify'](_0x44295a));});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511['username'],'name':'admin'})[_0x0a9e('0x28')](function(_0x5640eb){var _0x24936a=_0x5640eb[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getUser',_0x24936a,JSON[_0x0a9e('0x24')](_0x5640eb));});}}function getEndUser(_0x3bfce8,_0x3cae,_0x533942,_0x1dbf74){logger[_0x0a9e('0x18')](_0x0a9e('0x3a'),_0x533942);return request({'method':'GET','uri':util['format'](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'qs':{'operation':'query','username':_0x3bfce8[_0x0a9e('0x21')],'sessionName':_0x1dbf74[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x3c'),_0x533942,_0x533942,_0x533942,_0x533942,_0x533942)},'json':!![]})['then'](function(_0x5a594b){if(_0x5a594b[_0x0a9e('0x31')]&&_0x5a594b[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')](_0x0a9e('0x3d'));return BPromise[_0x0a9e('0x32')]({'id':_0x5a594b['result'][0x0]['id'],'name':_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3e')]+'\x20'+_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3f')],'phone':_0x533942});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x40'));return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x20'),'sessionName':_0x1dbf74[_0x0a9e('0x22')],'elementType':_0x0a9e('0x41'),'element':JSON[_0x0a9e('0x24')]({'lastname':_0x3cae,'phone':_0x533942,'assigned_user_id':'\x20'})},'json':!![]})[_0x0a9e('0x25')](function(_0x4d04c8){logger['info'](_0x0a9e('0x42'));return BPromise[_0x0a9e('0x32')]({'id':_0x4d04c8[_0x0a9e('0x26')]['id'],'name':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x3f')],'phone':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x43')]});})[_0x0a9e('0x28')](function(_0x432fcc){var _0x25c6e6=_0x432fcc[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x0a9e('0x44'),_0x25c6e6,JSON[_0x0a9e('0x24')](_0x432fcc));});}});}function getConnection(_0xdd268f){var _0xfbd5ad=_0xdd268f[_0x0a9e('0x21')];var _0xbe9d19=_0xdd268f[_0x0a9e('0x45')];return request({'method':_0x0a9e('0x2e'),'uri':util['format'](_0x0a9e('0x1f'),_0xdd268f['remoteUri']),'qs':{'operation':_0x0a9e('0x46'),'username':_0xfbd5ad},'json':!![]})[_0x0a9e('0x25')](function(_0x8d6dd1){if(_0x8d6dd1['success']){return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0xdd268f[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x47'),'username':_0xfbd5ad,'accessKey':md5(_0x8d6dd1[_0x0a9e('0x26')][_0x0a9e('0x48')]+_0xbe9d19)},'json':!![]});}})['then'](function(_0x13f44d){if(_0x13f44d[_0x0a9e('0x31')]){return BPromise[_0x0a9e('0x32')](_0x13f44d[_0x0a9e('0x26')]);}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x49'),_0xdd268f['id']));}})[_0x0a9e('0x28')](function(_0x19383e){var _0x34febd=_0x19383e['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getConnection',_0x34febd,JSON['stringify'](_0x19383e));});}function request(_0x5ddf84){logger[_0x0a9e('0x18')](_0x0a9e('0x4a'),JSON[_0x0a9e('0x24')](_0x5ddf84));return rp(_0x5ddf84);}exports[_0x0a9e('0x4b')]=function(_0x61bb17,_0x30decb,_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f){var _0x53975a,_0x39d77d,_0x204173,_0x14d602;_0x4b1b9f['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x4b1b9f[_0x0a9e('0x3b')]);if(_0x5d38ae&&_0x5d38ae['monitor_format']){logger['info'](_0x0a9e('0x4d'),'Recording\x20is\x20enabled!');_0x30decb[_0x0a9e('0x4e')]=util['format'](_0x0a9e('0x4f'),_0x4b1b9f[_0x0a9e('0x50')],_0x30decb[_0x0a9e('0x51')],md5(_0x30decb['uniqueid']));}else{_0x30decb[_0x0a9e('0x4e')]='';}return getConnection(_0x4b1b9f)[_0x0a9e('0x25')](function(_0x508b47){_0x14d602=_0x508b47;return getUser(_0x4b1b9f,_0x375c18['email'],_0x14d602);})[_0x0a9e('0x25')](function(_0x3aedd0){_0x53975a=_0x3aedd0;logger['info'](_0x0a9e('0x52'),_0x53975a['id']);return getEndUser(_0x4b1b9f,_0x30decb['calleridname'],_0x30decb[_0x0a9e('0x53')],_0x14d602);})['then'](function(_0xe22ccc){_0x39d77d=_0xe22ccc;logger['info']('The\x20Enduser\x20ID\x20is:',_0x39d77d['id']);return createTicket(_0x4b1b9f,_0x53975a,_0x39d77d,_0x2e5165,_0x30decb,_0x2e5165['Fields'],_0x14d602);})[_0x0a9e('0x25')](function(_0x47de4c){_0x204173=_0x47de4c;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x204173['id']);var _0x232830=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x4b1b9f[_0x0a9e('0x3b')],_['split'](_0x204173['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x4d'),_0x0a9e('0x57'));emit(util[_0x0a9e('0x1e')](_0x0a9e('0x58'),_0x375c18[_0x0a9e('0x16')]),'trigger:browser:url',{'uri':_0x232830});})[_0x0a9e('0x28')](function(_0x26bc80){logger['error'](_0x0a9e('0x4d'),JSON['stringify'](_0x26bc80));});};exports[_0x0a9e('0x59')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee,_0x273cb5,_0x49d231,_0x2244d6,_0x1fc70e){var _0x261adb,_0x7be420,_0x1cca9f,_0x26d7db;_0x2244d6['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x2244d6['remoteUri']);_0x2244d6[_0x0a9e('0x50')]=intUtil[_0x0a9e('0x4c')](_0x2244d6[_0x0a9e('0x50')]);if(_0x1fc70e&&_0x1fc70e['recordingFormat']&&_0x1fc70e[_0x0a9e('0x5a')]!==_0x0a9e('0x5b')){logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),'Recording\x20is\x20enabled!');_0x4b3c1a[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2244d6[_0x0a9e('0x50')],_0x4b3c1a[_0x0a9e('0x51')],md5(_0x4b3c1a[_0x0a9e('0x51')]));}return getConnection(_0x2244d6)[_0x0a9e('0x25')](function(_0x401837){_0x26d7db=_0x401837;return getUser(_0x2244d6,_0x273cb5['email'],_0x26d7db);})[_0x0a9e('0x25')](function(_0x2937e0){_0x261adb=_0x2937e0;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x261adb['id']);return getEndUser(_0x2244d6,_0x4b3c1a[_0x0a9e('0x5d')],_0x4b3c1a['destcalleridnum'],_0x26d7db);})['then'](function(_0x242745){_0x7be420=_0x242745;logger[_0x0a9e('0x18')](_0x0a9e('0x5e'),_0x7be420['id']);return createTicket(_0x2244d6,_0x261adb,_0x7be420,_0x5674ee,_0x4b3c1a,_0x5674ee[_0x0a9e('0x5f')],_0x26d7db);})[_0x0a9e('0x25')](function(_0xc8c264){_0x1cca9f=_0xc8c264;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1cca9f['id']);var _0x2e89b7=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x2244d6[_0x0a9e('0x3b')],_[_0x0a9e('0x60')](_0x1cca9f['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),_0x0a9e('0x57'));emit(util['format'](_0x0a9e('0x58'),_0x273cb5[_0x0a9e('0x16')]),_0x0a9e('0x61'),{'uri':_0x2e89b7});})['catch'](function(_0x1148a1){logger[_0x0a9e('0x29')]('[OUTBOUND]',JSON[_0x0a9e('0x24')](_0x1148a1));});};exports[_0x0a9e('0x62')]=function(_0x3ef315,_0x427946,_0x13b5c0,_0x4a43a8,_0x50cdce,_0x4a2438){var _0x40fb85,_0x18bf5d,_0x1104ad,_0x23a7d3;_0x4a2438[_0x0a9e('0x3b')]=intUtil[_0x0a9e('0x4c')](_0x4a2438[_0x0a9e('0x3b')]);_0x4a2438[_0x0a9e('0x50')]=intUtil['stripTrailingSlash'](_0x4a2438[_0x0a9e('0x50')]);if(_0x50cdce&&_0x50cdce[_0x0a9e('0x63')]){logger[_0x0a9e('0x18')]('['+_0x427946['lastevent'][_0x0a9e('0x64')]()+']','Recording\x20is\x20enabled!');_0x427946[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4a2438[_0x0a9e('0x50')],_0x427946[_0x0a9e('0x51')],md5(_0x427946[_0x0a9e('0x51')]));}else{_0x427946[_0x0a9e('0x4e')]='';}return getConnection(_0x4a2438)['then'](function(_0x1d442c){_0x23a7d3=_0x1d442c;return getUser(_0x4a2438,'',_0x23a7d3);})[_0x0a9e('0x25')](function(_0x371533){_0x40fb85=_0x371533;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x40fb85['id']);return getEndUser(_0x4a2438,_0x427946[_0x0a9e('0x65')],_0x427946[_0x0a9e('0x53')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0x361b21){_0x18bf5d=_0x361b21;logger['info'](_0x0a9e('0x5e'),_0x18bf5d['id']);return createTicket(_0x4a2438,_0x40fb85,_0x18bf5d,_0x13b5c0,_0x427946,_0x13b5c0[_0x0a9e('0x5f')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0xf410e5){_0x1104ad=_0xf410e5;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1104ad['id']);})[_0x0a9e('0x28')](function(_0x336dc3){logger[_0x0a9e('0x29')]('['+_0x427946[_0x0a9e('0x66')][_0x0a9e('0x64')]()+']',JSON[_0x0a9e('0x24')](_0x336dc3));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index 6d358ec..20d4f5e 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 _0x6d4c=['./util','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','info','Creating\x20new\x20ticket...','format','%s/tickets.json','POST','Tags','getString','Subjects','Descriptions','then','ticket','validateEmail','Getting\x20agent\x20with\x20email','remoteUri','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','agent','Admin\x20account\x20selected.','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','user','Searching\x20enduser\x20with\x20phone','%s/search.json','length','filter','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','end-user','Enduser\x20created.','authType','password','token','%s/token:%s','username','Basic\x20%s','base64','debug','[HTTP]','stringify','map','picklist','type','nameField','customField','toLowerCase','includes','string','idField','push','toString','variableName','custom_fields','Variable','name','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','%s/agent/tickets/%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','outbound','email','destcalleridname','destcalleridnum','[OUTBOUND]','trigger:browser:url','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','inspect','unmanaged','lastevent','toUpperCase','request-promise','md5','util','ioredis'];(function(_0x7ceeac,_0x1c9973){var _0x330ac0=function(_0x54e645){while(--_0x54e645){_0x7ceeac['push'](_0x7ceeac['shift']());}};_0x330ac0(++_0x1c9973);}(_0x6d4c,0x1a8));var _0xc6d4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6d4c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var rp=require(_0xc6d4('0x0'));var md5=require(_0xc6d4('0x1'));var util=require(_0xc6d4('0x2'));var Redis=require(_0xc6d4('0x3'));var intUtil=require(_0xc6d4('0x4'));var config=require('../../../../config/environment');var logger=require(_0xc6d4('0x5'))(_0xc6d4('0x6'));config[_0xc6d4('0x7')]=_[_0xc6d4('0x8')](config[_0xc6d4('0x7')],{'host':_0xc6d4('0x9'),'port':0x18eb});var io=require(_0xc6d4('0xa'))(new Redis(config[_0xc6d4('0x7')]));function emit(_0x41d457,_0xe327e9,_0x418022){io['to'](_0x41d457)['emit'](_0xe327e9,_0x418022);}var headers={'Content-Type':'application/json','Accept':'application/json'};function getTicket(_0x50c588,_0x5b7f85,_0x5d174c,_0x204acb,_0x2fa2e0){logger[_0xc6d4('0xb')](_0xc6d4('0xc'));return request({'uri':util[_0xc6d4('0xd')](_0xc6d4('0xe'),_0x50c588['remoteUri']),'method':_0xc6d4('0xf'),'body':{'ticket':_['merge']({'requester_id':_0x5d174c['id'],'submitter_id':_0x5b7f85?_0x5b7f85['id']:undefined,'assignee_id':_0x5b7f85?_0x5b7f85['id']:undefined,'tags':getTags(_0x204acb[_0xc6d4('0x10')],'name'),'subject':intUtil[_0xc6d4('0x11')](_0x204acb[_0xc6d4('0x12')],_0x2fa2e0,'\x20'),'description':intUtil[_0xc6d4('0x11')](_0x204acb[_0xc6d4('0x13')],_0x2fa2e0,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x204acb[_0xc6d4('0x13')],_0x2fa2e0,'\x0a')}},getCustomFields(_0x204acb['Fields'],_0x2fa2e0))}})[_0xc6d4('0x14')](function(_0x59c798){logger[_0xc6d4('0xb')]('Ticket\x20created!');return _0x59c798[_0xc6d4('0x15')];});}function getUser(_0x313ac1,_0x1ae2a6){if(intUtil[_0xc6d4('0x16')](_0x1ae2a6)){logger[_0xc6d4('0xb')](_0xc6d4('0x17'),_0x1ae2a6);return request({'uri':util[_0xc6d4('0xd')]('%s/search.json',_0x313ac1[_0xc6d4('0x18')]),'qs':{'query':util[_0xc6d4('0xd')](_0xc6d4('0x19'),_0x1ae2a6)}})['then'](function(_0x273f8b){if(_0x273f8b[_0xc6d4('0x1a')]){logger[_0xc6d4('0xb')](_0xc6d4('0x1b'));return _[_0xc6d4('0x1c')](_0x273f8b[_0xc6d4('0x1d')],{'email':_0x1ae2a6,'role':_0xc6d4('0x1e')});}else{logger[_0xc6d4('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xc6d4('0xd')]('%s/users/me.json',_0x313ac1['remoteUri'])})[_0xc6d4('0x14')](function(_0x52619f){logger[_0xc6d4('0xb')](_0xc6d4('0x1f'));return _0x52619f['user'];});}});}else{logger[_0xc6d4('0xb')](_0xc6d4('0x20'));return request({'uri':util['format'](_0xc6d4('0x21'),_0x313ac1[_0xc6d4('0x18')])})['then'](function(_0x27c9ec){logger[_0xc6d4('0xb')](_0xc6d4('0x1f'));return _0x27c9ec[_0xc6d4('0x22')];});}}function getEndUser(_0x105949,_0x5eb2d8,_0xad9a3f){logger['info'](_0xc6d4('0x23'),_0xad9a3f);return request({'uri':util[_0xc6d4('0xd')](_0xc6d4('0x24'),_0x105949[_0xc6d4('0x18')]),'qs':{'query':util[_0xc6d4('0xd')]('type:user\x20role:end-user\x20phone:%s',_0xad9a3f)}})[_0xc6d4('0x14')](function(_0x5ea640){var _0x209c67;if(_0x5ea640[_0xc6d4('0x1d')][_0xc6d4('0x25')]){_0x5ea640[_0xc6d4('0x1d')]=_[_0xc6d4('0x26')](_0x5ea640[_0xc6d4('0x1d')],{'suspended':![],'role':'end-user'});if(_0x5ea640[_0xc6d4('0x1d')][_0xc6d4('0x25')]){_0x209c67=_[_0xc6d4('0x27')](_0x5ea640[_0xc6d4('0x1d')]);}}if(_0x209c67){logger[_0xc6d4('0xb')](_0xc6d4('0x28'));return _0x209c67;}else{logger['info'](_0xc6d4('0x29'));return request({'uri':util[_0xc6d4('0xd')]('%s/users.json',_0x105949[_0xc6d4('0x18')]),'method':_0xc6d4('0xf'),'body':{'user':{'role':_0xc6d4('0x2a'),'name':util[_0xc6d4('0xd')]('Caller\x20-\x20%s',_0x5eb2d8||_0xad9a3f),'phone':_0xad9a3f}}})[_0xc6d4('0x14')](function(_0x5a265d){logger[_0xc6d4('0xb')](_0xc6d4('0x2b'));return _0x5a265d['user'];});}});}function getAuth(_0x3cef98){var _0x3d46b5;if(_0x3cef98[_0xc6d4('0x2c')]===_0xc6d4('0x2d')){_0x3d46b5=util[_0xc6d4('0xd')]('%s:%s',_0x3cef98['username'],_0x3cef98[_0xc6d4('0x2d')]);}else if(_0x3cef98[_0xc6d4('0x2c')]===_0xc6d4('0x2e')){_0x3d46b5=util[_0xc6d4('0xd')](_0xc6d4('0x2f'),_0x3cef98[_0xc6d4('0x30')],_0x3cef98[_0xc6d4('0x2e')]);}return util['format'](_0xc6d4('0x31'),new Buffer(_0x3d46b5)['toString'](_0xc6d4('0x32')));}function request(_0x1278de){logger[_0xc6d4('0x33')](_0xc6d4('0x34'),JSON[_0xc6d4('0x35')](_0x1278de));return rp(_[_0xc6d4('0x8')](_0x1278de,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x4c9b8d,_0x5b60fe){var _0x41923b=[];if(_0x4c9b8d&&_0x4c9b8d[_0xc6d4('0x25')]>0x0){_0x41923b=_[_0xc6d4('0x36')](_0x4c9b8d,_0x5b60fe);}return _0x41923b;}function getCustomFields(_0x15e194,_0x1011ac){var _0x298dbc=[];var _0x4762e0={'custom_fields':[]};if(_0x15e194['length']>0x0){_['forEach'](_0x15e194,function(_0x12ef96){if(_['includes'](['string',_0xc6d4('0x37')],_0x12ef96[_0xc6d4('0x38')])&&_0x12ef96[_0xc6d4('0x39')]&&!_0x12ef96[_0xc6d4('0x3a')]){_0x4762e0[_0x12ef96[_0xc6d4('0x39')][_0xc6d4('0x3b')]()]=_0x12ef96['content']['toString']();}else if(_[_0xc6d4('0x3c')]([_0xc6d4('0x3d'),'picklist'],_0x12ef96[_0xc6d4('0x38')])&&_0x12ef96[_0xc6d4('0x3e')]&&_0x12ef96['customField']){_0x4762e0['custom_fields'][_0xc6d4('0x3f')]({'id':_0x12ef96[_0xc6d4('0x3e')],'value':_0x12ef96['content'][_0xc6d4('0x40')]()});}else if(_0x12ef96[_0xc6d4('0x38')]==='variable'&&_0x12ef96[_0xc6d4('0x41')]&&_0x12ef96[_0xc6d4('0x3e')]&&_0x12ef96[_0xc6d4('0x3a')]){_0x1011ac[_0x12ef96[_0xc6d4('0x41')]]&&_0x4762e0[_0xc6d4('0x42')][_0xc6d4('0x3f')]({'id':_0x12ef96[_0xc6d4('0x3e')],'value':_0x1011ac[_0x12ef96[_0xc6d4('0x41')]][_0xc6d4('0x40')]()});}else if(_0x12ef96[_0xc6d4('0x38')]==='customVariable'&&_0x12ef96[_0xc6d4('0x43')]&&_0x12ef96[_0xc6d4('0x43')][_0xc6d4('0x44')]&&_0x12ef96['idField']&&_0x12ef96[_0xc6d4('0x3a')]){_0x1011ac[_0x12ef96['Variable'][_0xc6d4('0x44')][_0xc6d4('0x3b')]()]&&_0x4762e0[_0xc6d4('0x42')]['push']({'id':_0x12ef96[_0xc6d4('0x3e')],'value':_0x1011ac[_0x12ef96[_0xc6d4('0x43')][_0xc6d4('0x44')]['toLowerCase']()][_0xc6d4('0x40')]()});}});}return _0x4762e0;}exports['queue']=function(_0x14b9a6,_0x21d111,_0x5bdeec,_0x4838cc,_0x2629c4,_0x54f6f4){var _0x35efa5,_0x5b50c2;_0x54f6f4[_0xc6d4('0x18')]=intUtil['stripTrailingSlash'](_0x54f6f4[_0xc6d4('0x18')]);_0x54f6f4['serverUrl']=intUtil[_0xc6d4('0x45')](_0x54f6f4[_0xc6d4('0x46')]);if(_0x2629c4&&_0x2629c4[_0xc6d4('0x47')]){logger[_0xc6d4('0xb')](_0xc6d4('0x48'),_0xc6d4('0x49'));_0x21d111[_0xc6d4('0x4a')]=util['format'](_0xc6d4('0x4b'),_0x54f6f4[_0xc6d4('0x46')],_0x21d111[_0xc6d4('0x4c')],md5(_0x21d111[_0xc6d4('0x4c')]));}else{_0x21d111['recordingURL']='';}headers[_0xc6d4('0x4d')]=getAuth(_0x54f6f4);return getUser(_0x54f6f4,_0x4838cc['email'])[_0xc6d4('0x14')](function(_0x51f0dd){_0x35efa5=_0x51f0dd;logger[_0xc6d4('0xb')](_0xc6d4('0x4e'),_0x35efa5['id']);return getEndUser(_0x54f6f4,_0x21d111[_0xc6d4('0x4f')],_0x21d111[_0xc6d4('0x50')]);})[_0xc6d4('0x14')](function(_0x5c0777){_0x5b50c2=_0x5c0777;logger[_0xc6d4('0xb')](_0xc6d4('0x51'),_0x5b50c2['id']);return getTicket(_0x54f6f4,_0x35efa5,_0x5b50c2,_0x5bdeec,_0x21d111);})[_0xc6d4('0x14')](function(_0x5fb36b){if(_0x5fb36b){logger[_0xc6d4('0xb')](_0xc6d4('0x52'),_0x5fb36b['id']);switch(_0x54f6f4['type']){case _0xc6d4('0x53'):logger['info'](_0xc6d4('0x48'),_0xc6d4('0x54'));return request({'uri':util[_0xc6d4('0xd')](_0xc6d4('0x55'),_0x54f6f4['remoteUri'],_0x35efa5['id'],_0x5fb36b['id']),'method':_0xc6d4('0xf')});case _0xc6d4('0x56'):logger['info'](_0xc6d4('0x48'),_0xc6d4('0x57'));emit(util['format'](_0xc6d4('0x58'),_0x4838cc[_0xc6d4('0x44')]),'trigger:browser:url',{'uri':util['format'](_0xc6d4('0x59'),_0x54f6f4['remoteUri'][_0xc6d4('0x5a')](_0xc6d4('0x5b'),''),_0x5fb36b['id'])});break;default:logger[_0xc6d4('0x5c')](_0xc6d4('0x48'),_0xc6d4('0x5d'));}}})[_0xc6d4('0x5e')](function(_0xf0259f){logger['error'](_0xc6d4('0x5f'),util['inspect'](_0xf0259f,{'showHidden':!![],'depth':null}));});};exports[_0xc6d4('0x60')]=function(_0x258279,_0x108e78,_0x2e7560,_0x41f4a5,_0xb90d17,_0x4d981f,_0x476e2b){var _0x40556d,_0x425f56;_0x4d981f[_0xc6d4('0x18')]=intUtil[_0xc6d4('0x45')](_0x4d981f[_0xc6d4('0x18')]);_0x4d981f[_0xc6d4('0x46')]=intUtil['stripTrailingSlash'](_0x4d981f[_0xc6d4('0x46')]);if(_0x476e2b&&_0x476e2b['recordingFormat']&&_0x476e2b['recordingFormat']!=='none'){logger[_0xc6d4('0xb')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x108e78[_0xc6d4('0x4a')]=util[_0xc6d4('0xd')](_0xc6d4('0x4b'),_0x4d981f['serverUrl'],_0x108e78[_0xc6d4('0x4c')],md5(_0x108e78['uniqueid']));}headers[_0xc6d4('0x4d')]=getAuth(_0x4d981f);return getUser(_0x4d981f,_0x41f4a5[_0xc6d4('0x61')])['then'](function(_0x459687){_0x40556d=_0x459687;logger[_0xc6d4('0xb')](_0xc6d4('0x4e'),_0x40556d['id']);return getEndUser(_0x4d981f,_0x108e78[_0xc6d4('0x62')],_0x108e78[_0xc6d4('0x63')]);})['then'](function(_0x1b3803){_0x425f56=_0x1b3803;logger['info'](_0xc6d4('0x51'),_0x425f56['id']);return getTicket(_0x4d981f,_0x40556d,_0x425f56,_0x2e7560,_0x108e78);})['then'](function(_0xf4cf9c){if(_0xf4cf9c){logger[_0xc6d4('0xb')](_0xc6d4('0x52'),_0xf4cf9c['id']);switch(_0x4d981f[_0xc6d4('0x38')]){case _0xc6d4('0x53'):logger[_0xc6d4('0xb')](_0xc6d4('0x64'),_0xc6d4('0x54'));return request({'uri':util[_0xc6d4('0xd')](_0xc6d4('0x55'),_0x4d981f[_0xc6d4('0x18')],_0x40556d['id'],_0xf4cf9c['id']),'method':_0xc6d4('0xf')});case _0xc6d4('0x56'):logger['info'](_0xc6d4('0x64'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xc6d4('0xd')](_0xc6d4('0x58'),_0x41f4a5[_0xc6d4('0x44')]),_0xc6d4('0x65'),{'uri':util[_0xc6d4('0xd')](_0xc6d4('0x59'),_0x4d981f[_0xc6d4('0x18')][_0xc6d4('0x5a')]('/api/v2',''),_0xf4cf9c['id'])});break;default:logger[_0xc6d4('0x5c')](_0xc6d4('0x64'),_0xc6d4('0x5d'));}}})[_0xc6d4('0x5e')](function(_0x16c130){logger['error'](_0xc6d4('0x66'),util[_0xc6d4('0x67')](_0x16c130,{'showHidden':!![],'depth':null}));});};exports[_0xc6d4('0x68')]=function(_0x19df25,_0x5c3831,_0x50f238,_0x2763c5,_0x3fc476,_0x5c7838){var _0x3427cb,_0x3b3f4d;_0x5c7838[_0xc6d4('0x18')]=intUtil[_0xc6d4('0x45')](_0x5c7838[_0xc6d4('0x18')]);_0x5c7838[_0xc6d4('0x46')]=intUtil[_0xc6d4('0x45')](_0x5c7838['serverUrl']);if(_0x3fc476&&_0x3fc476['monitor_format']){logger['info']('['+_0x5c3831[_0xc6d4('0x69')][_0xc6d4('0x6a')]()+']',_0xc6d4('0x49'));_0x5c3831[_0xc6d4('0x4a')]=util[_0xc6d4('0xd')](_0xc6d4('0x4b'),_0x5c7838['serverUrl'],_0x5c3831[_0xc6d4('0x4c')],md5(_0x5c3831[_0xc6d4('0x4c')]));}else{_0x5c3831[_0xc6d4('0x4a')]='';}headers['Authorization']=getAuth(_0x5c7838);return getUser(_0x5c7838)[_0xc6d4('0x14')](function(_0x452d53){_0x3427cb=_0x452d53;logger[_0xc6d4('0xb')](_0xc6d4('0x4e'),_0x3427cb['id']);return getEndUser(_0x5c7838,_0x5c3831[_0xc6d4('0x4f')],_0x5c3831[_0xc6d4('0x50')]);})[_0xc6d4('0x14')](function(_0x1221bb){_0x3b3f4d=_0x1221bb;logger[_0xc6d4('0xb')](_0xc6d4('0x51'),_0x3b3f4d['id']);return getTicket(_0x5c7838,_0x3427cb,_0x3b3f4d,_0x50f238,_0x5c3831);})[_0xc6d4('0x14')](function(_0x57d1b1){if(_0x57d1b1){logger[_0xc6d4('0xb')]('The\x20Ticket\x20ID\x20is:',_0x57d1b1['id']);}})[_0xc6d4('0x5e')](function(_0x2e5710){logger['error']('['+_0x5c3831[_0xc6d4('0x69')]['toUpperCase']()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util[_0xc6d4('0x67')](_0x2e5710,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x3569=['../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','merge','name','getString','Subjects','Descriptions','Fields','ticket','validateEmail','type:user\x20role:agent\x20email:%s','then','count','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','%s/search.json','end-user','length','first','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','%s:%s','password','username','token','Basic\x20%s','toString','base64','[HTTP]','stringify','GET','includes','string','picklist','nameField','toLowerCase','content','idField','customField','custom_fields','push','variableName','type','customVariable','Variable','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','user:%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','integrationTab','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','catch','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','toUpperCase','calleridnum','lastevent','\x20Error\x20running\x20Zendesk\x20integration','lodash','md5','util','ioredis'];(function(_0x19ac6e,_0x435862){var _0x1cdcf3=function(_0x23151c){while(--_0x23151c){_0x19ac6e['push'](_0x19ac6e['shift']());}};_0x1cdcf3(++_0x435862);}(_0x3569,0xd4));var _0x9356=function(_0x43e97d,_0x56a06b){_0x43e97d=_0x43e97d-0x0;var _0x424cd9=_0x3569[_0x43e97d];return _0x424cd9;};'use strict';var _=require(_0x9356('0x0'));var rp=require('request-promise');var md5=require(_0x9356('0x1'));var util=require(_0x9356('0x2'));var Redis=require(_0x9356('0x3'));var intUtil=require('./util');var config=require(_0x9356('0x4'));var logger=require(_0x9356('0x5'))(_0x9356('0x6'));config[_0x9356('0x7')]=_[_0x9356('0x8')](config[_0x9356('0x7')],{'host':_0x9356('0x9'),'port':0x18eb});var io=require(_0x9356('0xa'))(new Redis(config['redis']));function emit(_0xe30783,_0x29d622,_0x2ae4a4){io['to'](_0xe30783)[_0x9356('0xb')](_0x29d622,_0x2ae4a4);}var headers={'Content-Type':_0x9356('0xc'),'Accept':'application/json'};function getTicket(_0xb68d83,_0x5b4c4d,_0x2000a8,_0x159a4c,_0x3f23fa){logger[_0x9356('0xd')](_0x9356('0xe'));return request({'uri':util[_0x9356('0xf')](_0x9356('0x10'),_0xb68d83[_0x9356('0x11')]),'method':_0x9356('0x12'),'body':{'ticket':_[_0x9356('0x13')]({'requester_id':_0x2000a8['id'],'submitter_id':_0x5b4c4d?_0x5b4c4d['id']:undefined,'assignee_id':_0x5b4c4d?_0x5b4c4d['id']:undefined,'tags':getTags(_0x159a4c['Tags'],_0x9356('0x14')),'subject':intUtil[_0x9356('0x15')](_0x159a4c[_0x9356('0x16')],_0x3f23fa,'\x20'),'description':intUtil[_0x9356('0x15')](_0x159a4c[_0x9356('0x17')],_0x3f23fa,'\x0a'),'comment':{'public':![],'body':intUtil[_0x9356('0x15')](_0x159a4c[_0x9356('0x17')],_0x3f23fa,'\x0a')}},getCustomFields(_0x159a4c[_0x9356('0x18')],_0x3f23fa))}})['then'](function(_0x5e7630){logger[_0x9356('0xd')]('Ticket\x20created!');return _0x5e7630[_0x9356('0x19')];});}function getUser(_0x1cec2f,_0x481297){if(intUtil[_0x9356('0x1a')](_0x481297)){logger[_0x9356('0xd')]('Getting\x20agent\x20with\x20email',_0x481297);return request({'uri':util[_0x9356('0xf')]('%s/search.json',_0x1cec2f['remoteUri']),'qs':{'query':util[_0x9356('0xf')](_0x9356('0x1b'),_0x481297)}})[_0x9356('0x1c')](function(_0x3712ee){if(_0x3712ee[_0x9356('0x1d')]){logger[_0x9356('0xd')]('Agent\x20found!');return _[_0x9356('0x1e')](_0x3712ee[_0x9356('0x1f')],{'email':_0x481297,'role':_0x9356('0x20')});}else{logger[_0x9356('0xd')](_0x9356('0x21'));return request({'uri':util[_0x9356('0xf')](_0x9356('0x22'),_0x1cec2f[_0x9356('0x11')])})[_0x9356('0x1c')](function(_0x594118){logger['info'](_0x9356('0x23'));return _0x594118[_0x9356('0x24')];});}});}else{logger['info'](_0x9356('0x21'));return request({'uri':util[_0x9356('0xf')](_0x9356('0x22'),_0x1cec2f[_0x9356('0x11')])})['then'](function(_0x2585f4){logger[_0x9356('0xd')]('Admin\x20account\x20selected.');return _0x2585f4[_0x9356('0x24')];});}}function getEndUser(_0xee04db,_0x42fa2d,_0x4dd197){logger[_0x9356('0xd')](_0x9356('0x25'),_0x4dd197);return request({'uri':util['format'](_0x9356('0x26'),_0xee04db[_0x9356('0x11')]),'qs':{'query':util[_0x9356('0xf')]('type:user\x20role:end-user\x20phone:%s',_0x4dd197)}})['then'](function(_0xf95c70){var _0x5febf8;if(_0xf95c70[_0x9356('0x1f')]['length']){_0xf95c70[_0x9356('0x1f')]=_['filter'](_0xf95c70[_0x9356('0x1f')],{'suspended':![],'role':_0x9356('0x27')});if(_0xf95c70[_0x9356('0x1f')][_0x9356('0x28')]){_0x5febf8=_[_0x9356('0x29')](_0xf95c70['results']);}}if(_0x5febf8){logger[_0x9356('0xd')]('Enduser\x20found!');return _0x5febf8;}else{logger[_0x9356('0xd')](_0x9356('0x2a'));return request({'uri':util[_0x9356('0xf')](_0x9356('0x2b'),_0xee04db[_0x9356('0x11')]),'method':_0x9356('0x12'),'body':{'user':{'role':_0x9356('0x27'),'name':util['format'](_0x9356('0x2c'),_0x42fa2d||_0x4dd197),'phone':_0x4dd197}}})[_0x9356('0x1c')](function(_0x513ea9){logger['info'](_0x9356('0x2d'));return _0x513ea9['user'];});}});}function getAuth(_0x131568){var _0x24c01a;if(_0x131568[_0x9356('0x2e')]==='password'){_0x24c01a=util[_0x9356('0xf')](_0x9356('0x2f'),_0x131568['username'],_0x131568[_0x9356('0x30')]);}else if(_0x131568[_0x9356('0x2e')]==='token'){_0x24c01a=util['format']('%s/token:%s',_0x131568[_0x9356('0x31')],_0x131568[_0x9356('0x32')]);}return util['format'](_0x9356('0x33'),new Buffer(_0x24c01a)[_0x9356('0x34')](_0x9356('0x35')));}function request(_0xa7d0b){logger['debug'](_0x9356('0x36'),JSON[_0x9356('0x37')](_0xa7d0b));return rp(_[_0x9356('0x8')](_0xa7d0b,{'method':_0x9356('0x38'),'headers':headers,'json':!![]}));}function getTags(_0xdebe3e,_0xa17242){var _0x2c189b=[];if(_0xdebe3e&&_0xdebe3e[_0x9356('0x28')]>0x0){_0x2c189b=_['map'](_0xdebe3e,_0xa17242);}return _0x2c189b;}function getCustomFields(_0xea2ad6,_0x4caec7){var _0x462ae0=[];var _0x322954={'custom_fields':[]};if(_0xea2ad6['length']>0x0){_['forEach'](_0xea2ad6,function(_0x43af36){if(_[_0x9356('0x39')]([_0x9356('0x3a'),_0x9356('0x3b')],_0x43af36['type'])&&_0x43af36[_0x9356('0x3c')]&&!_0x43af36['customField']){_0x322954[_0x43af36[_0x9356('0x3c')][_0x9356('0x3d')]()]=_0x43af36[_0x9356('0x3e')]['toString']();}else if(_[_0x9356('0x39')]([_0x9356('0x3a'),_0x9356('0x3b')],_0x43af36['type'])&&_0x43af36[_0x9356('0x3f')]&&_0x43af36[_0x9356('0x40')]){_0x322954[_0x9356('0x41')][_0x9356('0x42')]({'id':_0x43af36[_0x9356('0x3f')],'value':_0x43af36[_0x9356('0x3e')][_0x9356('0x34')]()});}else if(_0x43af36['type']==='variable'&&_0x43af36[_0x9356('0x43')]&&_0x43af36[_0x9356('0x3f')]&&_0x43af36[_0x9356('0x40')]){_0x4caec7[_0x43af36[_0x9356('0x43')]]&&_0x322954[_0x9356('0x41')]['push']({'id':_0x43af36[_0x9356('0x3f')],'value':_0x4caec7[_0x43af36[_0x9356('0x43')]]['toString']()});}else if(_0x43af36[_0x9356('0x44')]===_0x9356('0x45')&&_0x43af36['Variable']&&_0x43af36['Variable']['name']&&_0x43af36[_0x9356('0x3f')]&&_0x43af36[_0x9356('0x40')]){_0x4caec7[_0x43af36[_0x9356('0x46')]['name'][_0x9356('0x3d')]()]&&_0x322954['custom_fields'][_0x9356('0x42')]({'id':_0x43af36[_0x9356('0x3f')],'value':_0x4caec7[_0x43af36[_0x9356('0x46')][_0x9356('0x14')][_0x9356('0x3d')]()][_0x9356('0x34')]()});}});}return _0x322954;}exports['queue']=function(_0x3ab5f0,_0x2df91a,_0xaeebd2,_0x1f7029,_0x438b68,_0x4acec7){var _0x4a23dd,_0x53ea4a;_0x4acec7['remoteUri']=intUtil[_0x9356('0x47')](_0x4acec7[_0x9356('0x11')]);_0x4acec7['serverUrl']=intUtil[_0x9356('0x47')](_0x4acec7[_0x9356('0x48')]);if(_0x438b68&&_0x438b68[_0x9356('0x49')]){logger['info']('[QUEUE]',_0x9356('0x4a'));_0x2df91a[_0x9356('0x4b')]=util[_0x9356('0xf')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4acec7[_0x9356('0x48')],_0x2df91a[_0x9356('0x4c')],md5(_0x2df91a[_0x9356('0x4c')]));}else{_0x2df91a['recordingURL']='';}headers[_0x9356('0x4d')]=getAuth(_0x4acec7);return getUser(_0x4acec7,_0x1f7029[_0x9356('0x4e')])[_0x9356('0x1c')](function(_0x53feef){_0x4a23dd=_0x53feef;logger['info'](_0x9356('0x4f'),_0x4a23dd['id']);return getEndUser(_0x4acec7,_0x2df91a[_0x9356('0x50')],_0x2df91a['calleridnum']);})['then'](function(_0x373abe){_0x53ea4a=_0x373abe;logger[_0x9356('0xd')](_0x9356('0x51'),_0x53ea4a['id']);return getTicket(_0x4acec7,_0x4a23dd,_0x53ea4a,_0xaeebd2,_0x2df91a);})[_0x9356('0x1c')](function(_0x1a43d9){if(_0x1a43d9){logger[_0x9356('0xd')](_0x9356('0x52'),_0x1a43d9['id']);switch(_0x4acec7[_0x9356('0x44')]){case'integrationTab':logger[_0x9356('0xd')](_0x9356('0x53'),_0x9356('0x54'));return request({'uri':util[_0x9356('0xf')](_0x9356('0x55'),_0x4acec7[_0x9356('0x11')],_0x4a23dd['id'],_0x1a43d9['id']),'method':'POST'});case'newTab':logger[_0x9356('0xd')](_0x9356('0x53'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x9356('0xf')](_0x9356('0x56'),_0x1f7029['name']),'trigger:browser:url',{'uri':util[_0x9356('0xf')]('%s/agent/tickets/%s',_0x4acec7[_0x9356('0x11')][_0x9356('0x57')](_0x9356('0x58'),''),_0x1a43d9['id'])});break;default:logger[_0x9356('0x59')](_0x9356('0x53'),_0x9356('0x5a'));}}})['catch'](function(_0x54b117){logger['error'](_0x9356('0x5b'),util[_0x9356('0x5c')](_0x54b117,{'showHidden':!![],'depth':null}));});};exports[_0x9356('0x5d')]=function(_0xb27ef0,_0x1cca3a,_0x5d1f28,_0x33c2b1,_0x2b2878,_0x3faaf2,_0xaa9d60){var _0x180dbf,_0xb16e00;_0x3faaf2[_0x9356('0x11')]=intUtil[_0x9356('0x47')](_0x3faaf2[_0x9356('0x11')]);_0x3faaf2[_0x9356('0x48')]=intUtil['stripTrailingSlash'](_0x3faaf2[_0x9356('0x48')]);if(_0xaa9d60&&_0xaa9d60[_0x9356('0x5e')]&&_0xaa9d60[_0x9356('0x5e')]!=='none'){logger[_0x9356('0xd')](_0x9356('0x5f'),'Recording\x20is\x20enabled!');_0x1cca3a[_0x9356('0x4b')]=util['format'](_0x9356('0x60'),_0x3faaf2[_0x9356('0x48')],_0x1cca3a[_0x9356('0x4c')],md5(_0x1cca3a[_0x9356('0x4c')]));}headers[_0x9356('0x4d')]=getAuth(_0x3faaf2);return getUser(_0x3faaf2,_0x33c2b1['email'])[_0x9356('0x1c')](function(_0x41338a){_0x180dbf=_0x41338a;logger[_0x9356('0xd')](_0x9356('0x4f'),_0x180dbf['id']);return getEndUser(_0x3faaf2,_0x1cca3a[_0x9356('0x61')],_0x1cca3a['destcalleridnum']);})[_0x9356('0x1c')](function(_0x569fc5){_0xb16e00=_0x569fc5;logger['info'](_0x9356('0x51'),_0xb16e00['id']);return getTicket(_0x3faaf2,_0x180dbf,_0xb16e00,_0x5d1f28,_0x1cca3a);})[_0x9356('0x1c')](function(_0x3fabcc){if(_0x3fabcc){logger[_0x9356('0xd')]('The\x20Ticket\x20ID\x20is:',_0x3fabcc['id']);switch(_0x3faaf2[_0x9356('0x44')]){case _0x9356('0x62'):logger[_0x9356('0xd')](_0x9356('0x5f'),_0x9356('0x54'));return request({'uri':util['format']('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x3faaf2[_0x9356('0x11')],_0x180dbf['id'],_0x3fabcc['id']),'method':_0x9356('0x12')});case _0x9356('0x63'):logger[_0x9356('0xd')](_0x9356('0x5f'),_0x9356('0x64'));emit(util['format'](_0x9356('0x56'),_0x33c2b1[_0x9356('0x14')]),_0x9356('0x65'),{'uri':util[_0x9356('0xf')]('%s/agent/tickets/%s',_0x3faaf2[_0x9356('0x11')][_0x9356('0x57')](_0x9356('0x58'),''),_0x3fabcc['id'])});break;default:logger['error'](_0x9356('0x5f'),_0x9356('0x5a'));}}})[_0x9356('0x66')](function(_0x293b5c){logger[_0x9356('0x59')](_0x9356('0x67'),util[_0x9356('0x5c')](_0x293b5c,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x23271a,_0x26a9a0,_0x3bc588,_0x2106ab,_0x5aef1c,_0x12dac1){var _0x22ee78,_0x5cfb10;_0x12dac1['remoteUri']=intUtil[_0x9356('0x47')](_0x12dac1[_0x9356('0x11')]);_0x12dac1[_0x9356('0x48')]=intUtil[_0x9356('0x47')](_0x12dac1['serverUrl']);if(_0x5aef1c&&_0x5aef1c[_0x9356('0x49')]){logger['info']('['+_0x26a9a0['lastevent'][_0x9356('0x68')]()+']',_0x9356('0x4a'));_0x26a9a0[_0x9356('0x4b')]=util[_0x9356('0xf')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x12dac1[_0x9356('0x48')],_0x26a9a0[_0x9356('0x4c')],md5(_0x26a9a0['uniqueid']));}else{_0x26a9a0[_0x9356('0x4b')]='';}headers[_0x9356('0x4d')]=getAuth(_0x12dac1);return getUser(_0x12dac1)[_0x9356('0x1c')](function(_0x125a12){_0x22ee78=_0x125a12;logger[_0x9356('0xd')](_0x9356('0x4f'),_0x22ee78['id']);return getEndUser(_0x12dac1,_0x26a9a0['calleridname'],_0x26a9a0[_0x9356('0x69')]);})[_0x9356('0x1c')](function(_0x38a032){_0x5cfb10=_0x38a032;logger[_0x9356('0xd')](_0x9356('0x51'),_0x5cfb10['id']);return getTicket(_0x12dac1,_0x22ee78,_0x5cfb10,_0x3bc588,_0x26a9a0);})[_0x9356('0x1c')](function(_0x294513){if(_0x294513){logger[_0x9356('0xd')](_0x9356('0x52'),_0x294513['id']);}})[_0x9356('0x66')](function(_0x1a798d){logger[_0x9356('0x59')]('['+_0x26a9a0[_0x9356('0x6a')]['toUpperCase']()+']'+_0x9356('0x6b'),util[_0x9356('0x5c')](_0x1a798d,{'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 f9ba414..3dd5c03 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 _0xa101=['diff','starttime','lastevent','called','Call_Result','connect','Answered','rejected','Rejected','abandoned','Abandoned','timeout','Timeout','outbound','Call_Type','Inbound','/crm/v2/Calls','SUCCESS','Call\x20created!','err','host','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','com','The\x20User\x20ID\x20is:','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','none','[OUTBOUND]','/api/voice/recordings/','/downloads?type=uniqueid&token=','zoho.eu','destcalleridname','destcalleridnum','https://crm.','/crm/EntityInfo.do?module=Calls&id=','unmanaged','monitor_format','toUpperCase','calleridname','calleridnum','lodash','request-promise','util','./util','ioredis','bluebird','../../../../config/logger','zoho','redis','defaults','localhost','emit','debug','[HTTP]','forEach','includes','picklist','type','idField','content','variableName','toString','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','expires_in','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','POST','/oauth/v2/token','clientId','clientSecret','refresh_token','then','add','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','email','Using\x20the\x20admin\x20account!','findIndex','profile','Administrator','user','The\x20failing\x20result\x20is','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','catch','data','enduserType','https://www.zohoapis.','role','first_name','last_name','code','details','startCase','moduleCreate','Error:\x20','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','lead','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','Call_Duration','talktime','format','mm:ss','endtime','utc','YYYY-MM-DDTHH:mm:ss'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0xa101,0x15f));var _0x1a10=function(_0x9c2427,_0x17c865){_0x9c2427=_0x9c2427-0x0;var _0x51984f=_0xa101[_0x9c2427];return _0x51984f;};'use strict';var _=require(_0x1a10('0x0'));var rp=require(_0x1a10('0x1'));var md5=require('md5');var util=require(_0x1a10('0x2'));var intUtil=require(_0x1a10('0x3'));var moment=require('moment');var Redis=require(_0x1a10('0x4'));var BPromise=require(_0x1a10('0x5'));var config=require('../../../../config/environment');var logger=require(_0x1a10('0x6'))(_0x1a10('0x7'));config[_0x1a10('0x8')]=_[_0x1a10('0x9')](config[_0x1a10('0x8')],{'host':_0x1a10('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x3c90fa,_0x2df5ef,_0x278bfd){io['to'](_0x3c90fa)[_0x1a10('0xb')](_0x2df5ef,_0x278bfd);}function request(_0x7c7a8a){logger[_0x1a10('0xc')](_0x1a10('0xd'),JSON['stringify'](_0x7c7a8a));return rp(_0x7c7a8a);}function getCustomFields(_0xa8d743,_0x24dd2f){var _0x467d62={};if(_0xa8d743['length']>0x0){_[_0x1a10('0xe')](_0xa8d743,function(_0x8496b4){if(_[_0x1a10('0xf')](['string',_0x1a10('0x10')],_0x8496b4[_0x1a10('0x11')])&&_0x8496b4[_0x1a10('0x12')]){_0x467d62[_0x8496b4[_0x1a10('0x12')]]=_0x8496b4[_0x1a10('0x13')]['toString']();}else if(_0x8496b4[_0x1a10('0x11')]==='variable'&&_0x8496b4['variableName']&&_0x8496b4['idField']&&_0x24dd2f[_0x8496b4[_0x1a10('0x14')]]){_0x467d62[_0x8496b4[_0x1a10('0x12')]]=_0x24dd2f[_0x8496b4[_0x1a10('0x14')]][_0x1a10('0x15')]();}else if(_0x8496b4['type']===_0x1a10('0x16')&&_0x8496b4[_0x1a10('0x17')]&&_0x8496b4['Variable'][_0x1a10('0x18')]&&_0x8496b4[_0x1a10('0x12')]&&_0x24dd2f[_0x8496b4[_0x1a10('0x17')][_0x1a10('0x18')]['toLowerCase']()]){_0x467d62[_0x8496b4[_0x1a10('0x12')]]=_0x24dd2f[_0x8496b4[_0x1a10('0x17')][_0x1a10('0x18')][_0x1a10('0x19')]()][_0x1a10('0x15')]();}});}return _0x467d62;}function getName(_0xe0057f){if(_0xe0057f[_0x1a10('0x1a')]('\x20')>0x0){var _0xd01708=_0xe0057f[_0x1a10('0x1b')](/ (.+)/);if(_0xd01708[0x1]){return _0xd01708;}}return[_0xe0057f,_0xe0057f];}var accountsTokens={};function getAccessToken(_0x203561){return new Promise(function(_0x473ae3,_0x222fa3){if(!_[_0x1a10('0x1c')](accountsTokens[_0x203561['id']])&&!_[_0x1a10('0x1c')](accountsTokens[_0x203561['id']][_0x1a10('0x1d')])){if(moment()['isBefore'](accountsTokens[_0x203561['id']][_0x1a10('0x1e')])){_0x473ae3(accountsTokens[_0x203561['id']]['access_token']);}}var _0x1198e1;switch(_0x203561['zone']){case'US':_0x1198e1=_0x1a10('0x1f');break;case'AU':_0x1198e1='https://accounts.zoho.com.au';break;case'EU':_0x1198e1=_0x1a10('0x20');break;case'IN':_0x1198e1=_0x1a10('0x21');break;case'CN':_0x1198e1='https://accounts.zoho.com.cn';break;default:_0x1198e1=_0x1a10('0x20');break;}var _0x2e618a={'method':_0x1a10('0x22'),'uri':_0x1198e1+_0x1a10('0x23'),'qs':{'refresh_token':_0x203561['refreshToken'],'client_id':_0x203561[_0x1a10('0x24')],'client_secret':_0x203561[_0x1a10('0x25')],'grant_type':_0x1a10('0x26')},'json':!![]};return rp(_0x2e618a)[_0x1a10('0x27')](function(_0xc093f6){accountsTokens[_0x203561['id']]={'access_token':_0xc093f6[_0x1a10('0x1d')],'expires_in':moment()[_0x1a10('0x28')](_0xc093f6[_0x1a10('0x1e')],'seconds')};_0x473ae3(_0xc093f6['access_token']);})['catch'](function(_0x9e9cc){logger[_0x1a10('0x29')](_0x1a10('0x2a'),_0x9e9cc[_0x1a10('0x2b')]);_0x222fa3(_0x9e9cc);});});}function getUser(_0x4c2d92,_0x3bb1e1,_0x62d55b,_0x524e9e){logger[_0x1a10('0x2c')](_0x1a10('0x2d'));return request({'method':_0x1a10('0x2e'),'uri':util['format'](_0x1a10('0x2f'),_0x3bb1e1),'qs':{'type':_0x1a10('0x30')},'headers':{'Authorization':_0x1a10('0x31')+_0x4c2d92},'json':!![]})[_0x1a10('0x27')](function(_0x2fccdd){if(_0x2fccdd['users']){var _0x30eb67=-0x1;if(_['isArrayLikeObject'](_0x2fccdd[_0x1a10('0x32')])){if(!_[_0x1a10('0x1c')](_0x524e9e)){_0x30eb67=_['findIndex'](_0x2fccdd[_0x1a10('0x32')],function(_0x4437a9){return _0x4437a9[_0x1a10('0x33')]===_0x524e9e;});}if(_0x30eb67>=0x0){logger['info']('Agent\x20found!');}else{logger[_0x1a10('0x2c')](_0x1a10('0x34'));_0x30eb67=_[_0x1a10('0x35')](_0x2fccdd[_0x1a10('0x32')],function(_0x2f854f){return _0x2f854f[_0x1a10('0x36')][_0x1a10('0x18')]===_0x1a10('0x37');});}return _0x2fccdd['users'][_0x30eb67];}else{if(_0x2fccdd[_0x1a10('0x38')][_0x1a10('0x36')][_0x1a10('0x18')]===_0x1a10('0x37')){logger[_0x1a10('0x2c')](_0x1a10('0x34'));user=_0x2fccdd['user'];return user;}else{logger[_0x1a10('0x29')](_0x1a10('0x39'),JSON[_0x1a10('0x3a')](_0x2fccdd));throw new Error(_0x1a10('0x3b')+JSON[_0x1a10('0x3a')](_0x2fccdd));}}}else{logger[_0x1a10('0x29')](_0x1a10('0x39'),JSON[_0x1a10('0x3a')](_0x2fccdd));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x1a10('0x3a')](_0x2fccdd));}})[_0x1a10('0x3c')](function(_0x1e6811){console[_0x1a10('0x29')](_0x1e6811);});}function getZohoUser(_0x5137c6,_0x423be8){return new BPromise(function(_0x5614b5,_0x206c65){request(_0x5137c6)[_0x1a10('0x27')](function(_0x1bdc4c){var _0x129a38=null;if(_0x1bdc4c){_0x129a38=_0x1bdc4c[_0x1a10('0x3d')][0x0];_0x129a38[_0x1a10('0x3e')]=_0x423be8;}_0x5614b5(_0x129a38);})[_0x1a10('0x3c')](function(_0x3a65fe){_0x206c65(_0x3a65fe);});});}function createEndUser(_0x5eb723,_0x33c514,_0x1d191c,_0x120318,_0x4445e8,_0x52880b){var _0x1d191c=getName(_0x1d191c);return request({'method':_0x1a10('0x22'),'uri':_0x1a10('0x3f')+_0x33c514+'/crm/v2/'+_['startCase'](_0x52880b['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x1d191c[0x1],'First_Name':_0x1d191c[0x0],'Phone':_0x120318,'Owner':{'name':!_[_0x1a10('0x1c')](_0x4445e8['role']['name'])?_0x4445e8[_0x1a10('0x40')][_0x1a10('0x18')]:!_[_0x1a10('0x1c')](_0x4445e8[_0x1a10('0x41')])?_0x4445e8[_0x1a10('0x41')]+'\x20'+_0x4445e8['last_name']:_0x4445e8[_0x1a10('0x42')],'id':_0x4445e8['id']}}]},'headers':{'Authorization':_0x1a10('0x31')+_0x5eb723},'json':!![]})[_0x1a10('0x27')](function(_0x551278){if(_0x551278&&_0x551278[_0x1a10('0x3d')][0x0][_0x1a10('0x43')]==='SUCCESS'){var _0xa8e0b7=_0x551278[_0x1a10('0x3d')][0x0][_0x1a10('0x44')];_0xa8e0b7['enduserType']=_[_0x1a10('0x45')](_0x52880b[_0x1a10('0x46')])+'s';return _0xa8e0b7;}logger[_0x1a10('0x29')](_0x1a10('0x39'),JSON['stringify'](data));throw new Error(_0x1a10('0x47')+JSON[_0x1a10('0x3a')](data));})['catch'](function(_0x4ead84){console[_0x1a10('0x48')](_0x1a10('0x49'),_0x4ead84);});}function getEndUser(_0x3c14e9,_0x5d9582,_0x3e8f7a,_0xb53055,_0xf6a7c1,_0x398735,_0x386a94){var _0x14a492={'method':_0x1a10('0x2e'),'uri':'','headers':{'Authorization':_0x1a10('0x31')+_0x3c14e9},'json':!![]};switch(_0x386a94[_0x1a10('0x4a')]){case _0x1a10('0x4b'):_0x14a492[_0x1a10('0x4c')]=_0x1a10('0x3f')+_0x5d9582+_0x1a10('0x4d')+_0xf6a7c1+'))';return getZohoUser(_0x14a492,_0x1a10('0x4e'))[_0x1a10('0x27')](function(_0x3cf5fe){if(_0x3cf5fe)return _0x3cf5fe;_0x14a492[_0x1a10('0x4c')]='https://www.zohoapis.'+_0x5d9582+_0x1a10('0x4f')+_0xf6a7c1+'))';return getZohoUser(_0x14a492,_0x1a10('0x50'))[_0x1a10('0x27')](function(_0x52a273){if(_0x52a273)return _0x52a273;if(_0x386a94[_0x1a10('0x46')]!=_0x1a10('0x51')){return createEndUser(_0x3c14e9,_0x5d9582,_0xb53055,_0xf6a7c1,_0x398735,_0x386a94);}else{return{};}});});break;case _0x1a10('0x52'):_0x14a492[_0x1a10('0x4c')]=_0x1a10('0x3f')+_0x5d9582+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0xf6a7c1+'))';return getZohoUser(_0x14a492,_0x1a10('0x4e'))[_0x1a10('0x27')](function(_0x55ce9e){if(_0x55ce9e)return _0x55ce9e;if(_0x386a94[_0x1a10('0x46')]!=_0x1a10('0x51')){return createEndUser(_0x3c14e9,_0x5d9582,_0xb53055,_0xf6a7c1,_0x398735,_0x386a94);}else{return{};}});break;case _0x1a10('0x53'):_0x14a492['uri']=_0x1a10('0x3f')+_0x5d9582+_0x1a10('0x4f')+_0xf6a7c1+'))';return getZohoUser(_0x14a492,_0x1a10('0x50'))['then'](function(_0x5e117a){if(_0x5e117a)return _0x5e117a;if(_0x386a94['moduleCreate']!=_0x1a10('0x51')){return createEndUser(_0x3c14e9,_0x5d9582,_0xb53055,_0xf6a7c1,_0x398735,_0x386a94);}else{return{};}});break;}}function getCall(_0x269af4,_0x45823e,_0x1f067c,_0x4a29f2,_0x49bab6,_0x3862e4,_0x56c85d,_0x43712a){logger[_0x1a10('0x2c')](_0x1a10('0x54'));var _0x51c49b={};_0x51c49b[_0x1a10('0x55')]={'name':!_[_0x1a10('0x1c')](_0x4a29f2[_0x1a10('0x40')][_0x1a10('0x18')])&&!_[_0x1a10('0x1c')](_0x4a29f2[_0x1a10('0x36')][_0x1a10('0x18')])&&_0x4a29f2[_0x1a10('0x36')][_0x1a10('0x18')]===_0x1a10('0x56')?_0x4a29f2[_0x1a10('0x40')][_0x1a10('0x18')]:!_[_0x1a10('0x1c')](_0x4a29f2[_0x1a10('0x41')])?_0x4a29f2['first_name']+'\x20'+_0x4a29f2[_0x1a10('0x42')]:_0x4a29f2[_0x1a10('0x42')],'id':_0x4a29f2['id']};_0x51c49b[_0x1a10('0x57')]=intUtil[_0x1a10('0x58')](_0x3862e4[_0x1a10('0x59')],_0x56c85d,'\x20');_0x51c49b[_0x1a10('0x5a')]=intUtil['getString'](_0x3862e4[_0x1a10('0x5b')],_0x56c85d,'\x0a');if(_0x49bab6[_0x1a10('0x3e')]===_0x1a10('0x4e')){_0x51c49b[_0x1a10('0x5c')]={'name':!_[_0x1a10('0x1c')](_0x49bab6[_0x1a10('0x5d')])?_0x49bab6[_0x1a10('0x5d')]:!_[_0x1a10('0x1c')](_0x49bab6['First_Name'])?_0x49bab6[_0x1a10('0x5e')]+'\x20'+_0x49bab6[_0x1a10('0x5f')]:_0x49bab6['Last_Name'],'id':_0x49bab6['id']};}if(_0x49bab6['enduserType']===_0x1a10('0x50')){_0x51c49b[_0x1a10('0x60')]={'name':!_['isNil'](_0x49bab6['Full_Name'])?_0x49bab6[_0x1a10('0x5d')]:!_['isNil'](_0x49bab6['First_Name'])?_0x49bab6[_0x1a10('0x5e')]+'\x20'+_0x49bab6[_0x1a10('0x5f')]:_0x49bab6[_0x1a10('0x5f')],'id':_0x49bab6['id']};_0x51c49b[_0x1a10('0x61')]=_[_0x1a10('0x45')](_0x49bab6[_0x1a10('0x3e')]);}if(_0x56c85d['talktime']){_0x51c49b[_0x1a10('0x62')]=moment['utc'](parseInt(_0x56c85d[_0x1a10('0x63')])*0x3e8)[_0x1a10('0x64')](_0x1a10('0x65'));}else if(_0x56c85d['answertime']&&_0x56c85d[_0x1a10('0x66')]){_0x51c49b['Call_Duration']=moment[_0x1a10('0x67')](moment(_0x56c85d[_0x1a10('0x66')],_0x1a10('0x68'))[_0x1a10('0x69')](moment(_0x56c85d[_0x1a10('0x6a')],'YYYY-MM-DDTHH:mm:ss')))[_0x1a10('0x64')](_0x1a10('0x65'));}switch(_0x56c85d[_0x1a10('0x6b')]){case _0x1a10('0x6c'):_0x51c49b[_0x1a10('0x6d')]='Called';break;case'complete':case _0x1a10('0x6e'):_0x51c49b['Call_Result']=_0x1a10('0x6f');break;case _0x1a10('0x70'):_0x51c49b['Call_Result']=_0x1a10('0x71');break;case _0x1a10('0x72'):_0x51c49b[_0x1a10('0x6d')]=_0x1a10('0x73');break;case _0x1a10('0x74'):_0x51c49b['Call_Result']=_0x1a10('0x75');default:}_0x51c49b['Call_Start_Time']=(_0x43712a===_0x1a10('0x76')?moment(_0x56c85d[_0x1a10('0x6a')])[_0x1a10('0x64')](_0x1a10('0x68')):moment(_0x56c85d['agentcalledAt'])['format'](_0x1a10('0x68')))||moment()[_0x1a10('0x64')](_0x1a10('0x68'));_0x51c49b[_0x1a10('0x77')]=_0x43712a||_0x1a10('0x78');_0x51c49b=_['merge'](_0x51c49b,getCustomFields(_0x3862e4['Fields'],_0x56c85d));return request({'method':'POST','uri':'https://www.zohoapis.'+_0x45823e+_0x1a10('0x79'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x269af4},'body':{'data':[_0x51c49b]},'json':!![]})[_0x1a10('0x27')](function(_0x4c3bff){if(_0x4c3bff&&_0x4c3bff['data'][0x0][_0x1a10('0x43')]===_0x1a10('0x7a')){logger[_0x1a10('0x2c')](_0x1a10('0x7b'));return{'id':_0x4c3bff[_0x1a10('0x3d')][0x0][_0x1a10('0x44')]['id']};}})[_0x1a10('0x3c')](function(_0x2df7bf){logger['info'](_0x1a10('0x7c'),_0x2df7bf[_0x1a10('0x2b')]);console[_0x1a10('0x48')]('err',_0x2df7bf);});}exports['queue']=function(_0x488a94,_0x4126f9,_0x2b5b9b,_0x5de369,_0x299460,_0x3fa3cd){var _0x49db58,_0x4fb55e,_0x440c8b;_0x3fa3cd[_0x1a10('0x7d')]=intUtil[_0x1a10('0x7e')](_0x3fa3cd[_0x1a10('0x7d')]);_0x3fa3cd[_0x1a10('0x7f')]=intUtil[_0x1a10('0x7e')](_0x3fa3cd[_0x1a10('0x7f')]);if(_0x299460&&_0x299460['monitor_format']){logger[_0x1a10('0x2c')](_0x1a10('0x80'),_0x1a10('0x81'));_0x4126f9[_0x1a10('0x82')]=_0x3fa3cd['serverUrl']+'/api/voice/recordings/'+_0x4126f9[_0x1a10('0x83')]+'/downloads?type=uniqueid&token='+md5(_0x4126f9[_0x1a10('0x83')]);}else{_0x4126f9[_0x1a10('0x82')]='';}var _0x3196e5=_0x3fa3cd[_0x1a10('0x7d')]==='zoho.eu'?'eu':_0x1a10('0x84');return getAccessToken(_0x3fa3cd)[_0x1a10('0x27')](function(_0x125c1b){_0x440c8b=_0x125c1b;return getUser(_0x440c8b,_0x3196e5,_0x3fa3cd,_0x5de369['email']);})[_0x1a10('0x27')](function(_0x2f0644){_0x49db58=_0x2f0644;logger[_0x1a10('0x2c')](_0x1a10('0x85'),_0x49db58['id']);return getEndUser(_0x440c8b,_0x3196e5,_0x3fa3cd,_0x4126f9['calleridname'],_0x4126f9['calleridnum'],_0x49db58,_0x2b5b9b);})[_0x1a10('0x27')](function(_0x152188){_0x4fb55e=_0x152188;return getCall(_0x440c8b,_0x3196e5,_0x3fa3cd,_0x49db58,_0x4fb55e,_0x2b5b9b,_0x4126f9,'Inbound');})['then'](function(_0x55ad33){if(_0x55ad33){logger[_0x1a10('0x2c')](_0x1a10('0x86'),_0x55ad33['id']);logger['info'](_0x1a10('0x80'),_0x1a10('0x87'));emit(util['format'](_0x1a10('0x88'),_0x5de369[_0x1a10('0x18')]),_0x1a10('0x89'),{'uri':'https://crm.'+_0x3fa3cd[_0x1a10('0x7d')]+'/crm/EntityInfo.do?module=Calls&id='+_0x55ad33['id']});}})[_0x1a10('0x3c')](function(_0x1f7048){logger['error'](_0x1a10('0x80'),JSON[_0x1a10('0x3a')](_0x1f7048));});};exports[_0x1a10('0x76')]=function(_0x138590,_0x11b7f8,_0x901ab2,_0x48208a,_0xa3708e,_0x2a6b58,_0x45dc5d){var _0x20904a,_0xbd8047,_0x566f2b;_0x2a6b58['host']=intUtil[_0x1a10('0x7e')](_0x2a6b58[_0x1a10('0x7d')]);_0x2a6b58[_0x1a10('0x7f')]=intUtil['stripTrailingSlash'](_0x2a6b58[_0x1a10('0x7f')]);if(_0x45dc5d&&_0x45dc5d['recordingFormat']&&_0x45dc5d['recordingFormat']!==_0x1a10('0x8a')){logger['info'](_0x1a10('0x8b'),'Recording\x20is\x20enabled!');_0x11b7f8[_0x1a10('0x82')]=_0x2a6b58['serverUrl']+_0x1a10('0x8c')+_0x11b7f8['uniqueid']+_0x1a10('0x8d')+md5(_0x11b7f8[_0x1a10('0x83')]);}var _0x34799c=_0x2a6b58[_0x1a10('0x7d')]===_0x1a10('0x8e')?'eu':_0x1a10('0x84');return getAccessToken(_0x2a6b58)[_0x1a10('0x27')](function(_0x4efc18){_0x566f2b=_0x4efc18;return getUser(_0x566f2b,_0x34799c,_0x2a6b58,_0x48208a[_0x1a10('0x33')]);})[_0x1a10('0x27')](function(_0x14de26){_0x20904a=_0x14de26;logger['info'](_0x1a10('0x85'),_0x20904a['id']);return getEndUser(_0x566f2b,_0x34799c,_0x2a6b58,_0x11b7f8[_0x1a10('0x8f')],_0x11b7f8[_0x1a10('0x90')],_0x20904a,_0x901ab2);})['then'](function(_0x1d9fc8){_0xbd8047=_0x1d9fc8;return getCall(_0x566f2b,_0x34799c,_0x2a6b58,_0x20904a,_0xbd8047,_0x901ab2,_0x11b7f8,'Outbound');})[_0x1a10('0x27')](function(_0x234389){if(_0x234389){logger[_0x1a10('0x2c')](_0x1a10('0x86'),_0x234389['id']);logger['info'](_0x1a10('0x8b'),_0x1a10('0x87'));emit(util['format'](_0x1a10('0x88'),_0x48208a[_0x1a10('0x18')]),_0x1a10('0x89'),{'uri':_0x1a10('0x91')+_0x2a6b58[_0x1a10('0x7d')]+_0x1a10('0x92')+_0x234389['id']});}})[_0x1a10('0x3c')](function(_0x2ed86b){logger[_0x1a10('0x29')]('[OUTBOUND]',JSON[_0x1a10('0x3a')](_0x2ed86b));});};exports[_0x1a10('0x93')]=function(_0x367bc0,_0x773da6,_0x5e8dc3,_0x4f1d8c,_0x43f508,_0x182acf){var _0x4915e3,_0x4630a1,_0x2af6c5;_0x182acf[_0x1a10('0x7d')]=intUtil[_0x1a10('0x7e')](_0x182acf[_0x1a10('0x7d')]);_0x182acf['serverUrl']=intUtil['stripTrailingSlash'](_0x182acf[_0x1a10('0x7f')]);if(_0x43f508&&_0x43f508[_0x1a10('0x94')]){logger['info']('['+_0x773da6['lastevent'][_0x1a10('0x95')]()+']',_0x1a10('0x81'));_0x773da6[_0x1a10('0x82')]=_0x182acf[_0x1a10('0x7f')]+_0x1a10('0x8c')+_0x773da6[_0x1a10('0x83')]+_0x1a10('0x8d')+md5(_0x773da6[_0x1a10('0x83')]);}else{_0x773da6[_0x1a10('0x82')]='';}var _0x58cfe8=_0x182acf[_0x1a10('0x7d')]===_0x1a10('0x8e')?'eu':'com';return getAccessToken(_0x182acf)[_0x1a10('0x27')](function(_0x15aec2){_0x2af6c5=_0x15aec2;return getUser(_0x2af6c5,_0x58cfe8,_0x182acf);})[_0x1a10('0x27')](function(_0x527d0c){_0x4915e3=_0x527d0c;logger[_0x1a10('0x2c')]('The\x20User\x20ID\x20is:',_0x4915e3['id']);return getEndUser(_0x2af6c5,_0x58cfe8,_0x182acf,_0x773da6[_0x1a10('0x96')],_0x773da6[_0x1a10('0x97')],_0x4915e3,_0x5e8dc3);})[_0x1a10('0x27')](function(_0x4d93ad){_0x4630a1=_0x4d93ad;return getCall(_0x2af6c5,_0x58cfe8,_0x182acf,_0x4915e3,_0x4630a1,_0x5e8dc3,_0x773da6,_0x1a10('0x78'));})[_0x1a10('0x27')](function(_0xcdbfb1){if(_0xcdbfb1){logger[_0x1a10('0x2c')](_0x1a10('0x86'),_0xcdbfb1['id']);}})['catch'](function(_0x2c8151){logger['error']('['+_0x773da6[_0x1a10('0x6b')][_0x1a10('0x95')]()+']',JSON['stringify'](_0x2c8151));});}; \ No newline at end of file +var _0xe48f=['https://crm.','toUpperCase','The\x20Call\x20ID\x20is:','lodash','request-promise','md5','util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','defaults','localhost','redis','emit','debug','includes','picklist','type','idField','content','toString','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','isBefore','expires_in','access_token','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','POST','refreshToken','clientId','clientSecret','refresh_token','then','add','catch','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','user','Administrator','error','The\x20failing\x20result\x20is','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','startCase','moduleCreate','role','first_name','code','SUCCESS','details','Error:\x20','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','https://www.zohoapis.','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','contact','nothing','lead','Creating\x20new\x20call...','administrator','Subject','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','utc','endtime','Call_Duration','YYYY-MM-DDTHH:mm:ss','diff','starttime','mm:ss','lastevent','called','Call_Result','Called','complete','connect','Answered','rejected','abandoned','timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','merge','Fields','/crm/v2/Calls','stack','err','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','uniqueid','/downloads?type=uniqueid&token=','recordingURL','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','Inbound','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','/crm/EntityInfo.do?module=Calls&id=','none','destcalleridname','destcalleridnum','Outbound'];(function(_0x1afabf,_0x56fdcc){var _0x497ff1=function(_0x2f6104){while(--_0x2f6104){_0x1afabf['push'](_0x1afabf['shift']());}};_0x497ff1(++_0x56fdcc);}(_0xe48f,0x9c));var _0xfe48=function(_0x4abab9,_0xde21a4){_0x4abab9=_0x4abab9-0x0;var _0x374eba=_0xe48f[_0x4abab9];return _0x374eba;};'use strict';var _=require(_0xfe48('0x0'));var rp=require(_0xfe48('0x1'));var md5=require(_0xfe48('0x2'));var util=require(_0xfe48('0x3'));var intUtil=require('./util');var moment=require(_0xfe48('0x4'));var Redis=require(_0xfe48('0x5'));var BPromise=require(_0xfe48('0x6'));var config=require(_0xfe48('0x7'));var logger=require(_0xfe48('0x8'))(_0xfe48('0x9'));config['redis']=_[_0xfe48('0xa')](config['redis'],{'host':_0xfe48('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xfe48('0xc')]));function emit(_0x4b6f9b,_0x367d87,_0x3c60fa){io['to'](_0x4b6f9b)[_0xfe48('0xd')](_0x367d87,_0x3c60fa);}function request(_0x498eac){logger[_0xfe48('0xe')]('[HTTP]',JSON['stringify'](_0x498eac));return rp(_0x498eac);}function getCustomFields(_0x26933d,_0x53d625){var _0x33e0fe={};if(_0x26933d['length']>0x0){_['forEach'](_0x26933d,function(_0x3183f3){if(_[_0xfe48('0xf')](['string',_0xfe48('0x10')],_0x3183f3[_0xfe48('0x11')])&&_0x3183f3[_0xfe48('0x12')]){_0x33e0fe[_0x3183f3[_0xfe48('0x12')]]=_0x3183f3[_0xfe48('0x13')][_0xfe48('0x14')]();}else if(_0x3183f3[_0xfe48('0x11')]==='variable'&&_0x3183f3[_0xfe48('0x15')]&&_0x3183f3[_0xfe48('0x12')]&&_0x53d625[_0x3183f3[_0xfe48('0x15')]]){_0x33e0fe[_0x3183f3[_0xfe48('0x12')]]=_0x53d625[_0x3183f3['variableName']][_0xfe48('0x14')]();}else if(_0x3183f3[_0xfe48('0x11')]===_0xfe48('0x16')&&_0x3183f3[_0xfe48('0x17')]&&_0x3183f3[_0xfe48('0x17')][_0xfe48('0x18')]&&_0x3183f3[_0xfe48('0x12')]&&_0x53d625[_0x3183f3[_0xfe48('0x17')][_0xfe48('0x18')][_0xfe48('0x19')]()]){_0x33e0fe[_0x3183f3[_0xfe48('0x12')]]=_0x53d625[_0x3183f3[_0xfe48('0x17')][_0xfe48('0x18')][_0xfe48('0x19')]()]['toString']();}});}return _0x33e0fe;}function getName(_0x538190){if(_0x538190[_0xfe48('0x1a')]('\x20')>0x0){var _0x1f247b=_0x538190[_0xfe48('0x1b')](/ (.+)/);if(_0x1f247b[0x1]){return _0x1f247b;}}return[_0x538190,_0x538190];}var accountsTokens={};function getAccessToken(_0x23019e){return new Promise(function(_0x74b23a,_0x2dd606){if(!_[_0xfe48('0x1c')](accountsTokens[_0x23019e['id']])&&!_[_0xfe48('0x1c')](accountsTokens[_0x23019e['id']]['access_token'])){if(moment()[_0xfe48('0x1d')](accountsTokens[_0x23019e['id']][_0xfe48('0x1e')])){_0x74b23a(accountsTokens[_0x23019e['id']][_0xfe48('0x1f')]);}}var _0x464f46;switch(_0x23019e['zone']){case'US':_0x464f46=_0xfe48('0x20');break;case'AU':_0x464f46=_0xfe48('0x21');break;case'EU':_0x464f46=_0xfe48('0x22');break;case'IN':_0x464f46=_0xfe48('0x23');break;case'CN':_0x464f46='https://accounts.zoho.com.cn';break;default:_0x464f46=_0xfe48('0x22');break;}var _0x26b2d7={'method':_0xfe48('0x24'),'uri':_0x464f46+'/oauth/v2/token','qs':{'refresh_token':_0x23019e[_0xfe48('0x25')],'client_id':_0x23019e[_0xfe48('0x26')],'client_secret':_0x23019e[_0xfe48('0x27')],'grant_type':_0xfe48('0x28')},'json':!![]};return rp(_0x26b2d7)[_0xfe48('0x29')](function(_0x5e0010){accountsTokens[_0x23019e['id']]={'access_token':_0x5e0010[_0xfe48('0x1f')],'expires_in':moment()[_0xfe48('0x2a')](_0x5e0010[_0xfe48('0x1e')],'seconds')};_0x74b23a(_0x5e0010[_0xfe48('0x1f')]);})[_0xfe48('0x2b')](function(_0x583a29){logger['error']('Failing\x20creating\x20the\x20access_token',_0x583a29['stack']);_0x2dd606(_0x583a29);});});}function getUser(_0x4bcd09,_0xd113a4,_0x4c8f3c,_0x86a8ba){logger[_0xfe48('0x2c')](_0xfe48('0x2d'));return request({'method':_0xfe48('0x2e'),'uri':util[_0xfe48('0x2f')](_0xfe48('0x30'),_0xd113a4),'qs':{'type':_0xfe48('0x31')},'headers':{'Authorization':_0xfe48('0x32')+_0x4bcd09},'json':!![]})['then'](function(_0x7ffff2){if(_0x7ffff2[_0xfe48('0x33')]){var _0x817572=-0x1;if(_[_0xfe48('0x34')](_0x7ffff2[_0xfe48('0x33')])){if(!_[_0xfe48('0x1c')](_0x86a8ba)){_0x817572=_[_0xfe48('0x35')](_0x7ffff2['users'],function(_0x21898d){return _0x21898d[_0xfe48('0x36')]===_0x86a8ba;});}if(_0x817572>=0x0){logger['info'](_0xfe48('0x37'));}else{logger[_0xfe48('0x2c')](_0xfe48('0x38'));_0x817572=_[_0xfe48('0x35')](_0x7ffff2[_0xfe48('0x33')],function(_0x15548b){return _0x15548b[_0xfe48('0x39')][_0xfe48('0x18')]==='Administrator';});}return _0x7ffff2['users'][_0x817572];}else{if(_0x7ffff2[_0xfe48('0x3a')][_0xfe48('0x39')][_0xfe48('0x18')]===_0xfe48('0x3b')){logger['info'](_0xfe48('0x38'));user=_0x7ffff2['user'];return user;}else{logger[_0xfe48('0x3c')](_0xfe48('0x3d'),JSON[_0xfe48('0x3e')](_0x7ffff2));throw new Error(_0xfe48('0x3f')+JSON['stringify'](_0x7ffff2));}}}else{logger[_0xfe48('0x3c')](_0xfe48('0x3d'),JSON[_0xfe48('0x3e')](_0x7ffff2));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON['stringify'](_0x7ffff2));}})[_0xfe48('0x2b')](function(_0x285009){console[_0xfe48('0x3c')](_0x285009);});}function getZohoUser(_0x3a593b,_0x203952){return new BPromise(function(_0xff5548,_0x3354b2){request(_0x3a593b)[_0xfe48('0x29')](function(_0x23eae7){var _0x3e661a=null;if(_0x23eae7){_0x3e661a=_0x23eae7[_0xfe48('0x40')][0x0];_0x3e661a[_0xfe48('0x41')]=_0x203952;}_0xff5548(_0x3e661a);})[_0xfe48('0x2b')](function(_0x165064){_0x3354b2(_0x165064);});});}function createEndUser(_0x4a4b41,_0x50aef6,_0xbc6c02,_0x31b6e7,_0x1fbd4a,_0x1dc053){var _0xbc6c02=getName(_0xbc6c02);return request({'method':_0xfe48('0x24'),'uri':'https://www.zohoapis.'+_0x50aef6+'/crm/v2/'+_[_0xfe48('0x42')](_0x1dc053[_0xfe48('0x43')])+'s','body':{'data':[{'Last_Name':_0xbc6c02[0x1],'First_Name':_0xbc6c02[0x0],'Phone':_0x31b6e7,'Owner':{'name':!_[_0xfe48('0x1c')](_0x1fbd4a['role'][_0xfe48('0x18')])?_0x1fbd4a[_0xfe48('0x44')][_0xfe48('0x18')]:!_[_0xfe48('0x1c')](_0x1fbd4a[_0xfe48('0x45')])?_0x1fbd4a['first_name']+'\x20'+_0x1fbd4a['last_name']:_0x1fbd4a['last_name'],'id':_0x1fbd4a['id']}}]},'headers':{'Authorization':_0xfe48('0x32')+_0x4a4b41},'json':!![]})[_0xfe48('0x29')](function(_0x27f33b){if(_0x27f33b&&_0x27f33b[_0xfe48('0x40')][0x0][_0xfe48('0x46')]===_0xfe48('0x47')){var _0x218efa=_0x27f33b[_0xfe48('0x40')][0x0][_0xfe48('0x48')];_0x218efa[_0xfe48('0x41')]=_[_0xfe48('0x42')](_0x1dc053[_0xfe48('0x43')])+'s';return _0x218efa;}logger['error'](_0xfe48('0x3d'),JSON[_0xfe48('0x3e')](data));throw new Error(_0xfe48('0x49')+JSON[_0xfe48('0x3e')](data));})[_0xfe48('0x2b')](function(_0x2f51a7){console[_0xfe48('0x4a')](_0xfe48('0x4b'),_0x2f51a7);});}function getEndUser(_0x194c8b,_0x3bcb0e,_0x10abec,_0xc1ab60,_0x1a0b8f,_0x3c2087,_0x89f7e0){var _0x367e7c={'method':_0xfe48('0x2e'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x194c8b},'json':!![]};switch(_0x89f7e0[_0xfe48('0x4c')]){case _0xfe48('0x4d'):_0x367e7c[_0xfe48('0x4e')]='https://www.zohoapis.'+_0x3bcb0e+_0xfe48('0x4f')+_0x1a0b8f+'))';return getZohoUser(_0x367e7c,_0xfe48('0x50'))[_0xfe48('0x29')](function(_0x12931e){if(_0x12931e)return _0x12931e;_0x367e7c[_0xfe48('0x4e')]=_0xfe48('0x51')+_0x3bcb0e+_0xfe48('0x52')+_0x1a0b8f+'))';return getZohoUser(_0x367e7c,_0xfe48('0x53'))[_0xfe48('0x29')](function(_0x32b562){if(_0x32b562)return _0x32b562;if(_0x89f7e0[_0xfe48('0x43')]!='nothing'){return createEndUser(_0x194c8b,_0x3bcb0e,_0xc1ab60,_0x1a0b8f,_0x3c2087,_0x89f7e0);}else{return{};}});});break;case _0xfe48('0x54'):_0x367e7c[_0xfe48('0x4e')]='https://www.zohoapis.'+_0x3bcb0e+_0xfe48('0x4f')+_0x1a0b8f+'))';return getZohoUser(_0x367e7c,_0xfe48('0x50'))['then'](function(_0x543abe){if(_0x543abe)return _0x543abe;if(_0x89f7e0['moduleCreate']!=_0xfe48('0x55')){return createEndUser(_0x194c8b,_0x3bcb0e,_0xc1ab60,_0x1a0b8f,_0x3c2087,_0x89f7e0);}else{return{};}});break;case _0xfe48('0x56'):_0x367e7c[_0xfe48('0x4e')]='https://www.zohoapis.'+_0x3bcb0e+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x1a0b8f+'))';return getZohoUser(_0x367e7c,_0xfe48('0x53'))[_0xfe48('0x29')](function(_0x657258){if(_0x657258)return _0x657258;if(_0x89f7e0[_0xfe48('0x43')]!='nothing'){return createEndUser(_0x194c8b,_0x3bcb0e,_0xc1ab60,_0x1a0b8f,_0x3c2087,_0x89f7e0);}else{return{};}});break;}}function getCall(_0xef9245,_0x51ce4e,_0x5cc113,_0x5f2260,_0x3efd27,_0x1d4d6b,_0x448a2c,_0x34a72e){logger[_0xfe48('0x2c')](_0xfe48('0x57'));var _0x190208={};_0x190208['Owner']={'name':!_[_0xfe48('0x1c')](_0x5f2260[_0xfe48('0x44')][_0xfe48('0x18')])&&!_[_0xfe48('0x1c')](_0x5f2260[_0xfe48('0x39')][_0xfe48('0x18')])&&_0x5f2260[_0xfe48('0x39')][_0xfe48('0x18')]===_0xfe48('0x58')?_0x5f2260[_0xfe48('0x44')][_0xfe48('0x18')]:!_[_0xfe48('0x1c')](_0x5f2260[_0xfe48('0x45')])?_0x5f2260['first_name']+'\x20'+_0x5f2260['last_name']:_0x5f2260['last_name'],'id':_0x5f2260['id']};_0x190208[_0xfe48('0x59')]=intUtil[_0xfe48('0x5a')](_0x1d4d6b[_0xfe48('0x5b')],_0x448a2c,'\x20');_0x190208[_0xfe48('0x5c')]=intUtil[_0xfe48('0x5a')](_0x1d4d6b[_0xfe48('0x5d')],_0x448a2c,'\x0a');if(_0x3efd27['enduserType']===_0xfe48('0x50')){_0x190208[_0xfe48('0x5e')]={'name':!_[_0xfe48('0x1c')](_0x3efd27[_0xfe48('0x5f')])?_0x3efd27['Full_Name']:!_[_0xfe48('0x1c')](_0x3efd27['First_Name'])?_0x3efd27[_0xfe48('0x60')]+'\x20'+_0x3efd27[_0xfe48('0x61')]:_0x3efd27[_0xfe48('0x61')],'id':_0x3efd27['id']};}if(_0x3efd27['enduserType']===_0xfe48('0x53')){_0x190208[_0xfe48('0x62')]={'name':!_['isNil'](_0x3efd27[_0xfe48('0x5f')])?_0x3efd27[_0xfe48('0x5f')]:!_['isNil'](_0x3efd27[_0xfe48('0x60')])?_0x3efd27['First_Name']+'\x20'+_0x3efd27[_0xfe48('0x61')]:_0x3efd27[_0xfe48('0x61')],'id':_0x3efd27['id']};_0x190208[_0xfe48('0x63')]=_[_0xfe48('0x42')](_0x3efd27[_0xfe48('0x41')]);}if(_0x448a2c[_0xfe48('0x64')]){_0x190208['Call_Duration']=moment[_0xfe48('0x65')](parseInt(_0x448a2c[_0xfe48('0x64')])*0x3e8)[_0xfe48('0x2f')]('mm:ss');}else if(_0x448a2c['answertime']&&_0x448a2c[_0xfe48('0x66')]){_0x190208[_0xfe48('0x67')]=moment['utc'](moment(_0x448a2c[_0xfe48('0x66')],_0xfe48('0x68'))[_0xfe48('0x69')](moment(_0x448a2c[_0xfe48('0x6a')],_0xfe48('0x68'))))[_0xfe48('0x2f')](_0xfe48('0x6b'));}switch(_0x448a2c[_0xfe48('0x6c')]){case _0xfe48('0x6d'):_0x190208[_0xfe48('0x6e')]=_0xfe48('0x6f');break;case _0xfe48('0x70'):case _0xfe48('0x71'):_0x190208['Call_Result']=_0xfe48('0x72');break;case _0xfe48('0x73'):_0x190208['Call_Result']='Rejected';break;case _0xfe48('0x74'):_0x190208[_0xfe48('0x6e')]='Abandoned';break;case _0xfe48('0x75'):_0x190208[_0xfe48('0x6e')]='Timeout';default:}_0x190208[_0xfe48('0x76')]=(_0x34a72e===_0xfe48('0x77')?moment(_0x448a2c[_0xfe48('0x6a')])[_0xfe48('0x2f')](_0xfe48('0x68')):moment(_0x448a2c[_0xfe48('0x78')])['format'](_0xfe48('0x68')))||moment()[_0xfe48('0x2f')](_0xfe48('0x68'));_0x190208[_0xfe48('0x79')]=_0x34a72e||'Inbound';_0x190208=_[_0xfe48('0x7a')](_0x190208,getCustomFields(_0x1d4d6b[_0xfe48('0x7b')],_0x448a2c));return request({'method':_0xfe48('0x24'),'uri':_0xfe48('0x51')+_0x51ce4e+_0xfe48('0x7c'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0xef9245},'body':{'data':[_0x190208]},'json':!![]})['then'](function(_0x317264){if(_0x317264&&_0x317264[_0xfe48('0x40')][0x0][_0xfe48('0x46')]===_0xfe48('0x47')){logger[_0xfe48('0x2c')]('Call\x20created!');return{'id':_0x317264['data'][0x0][_0xfe48('0x48')]['id']};}})[_0xfe48('0x2b')](function(_0x146fe6){logger[_0xfe48('0x2c')]('err',_0x146fe6[_0xfe48('0x7d')]);console[_0xfe48('0x4a')](_0xfe48('0x7e'),_0x146fe6);});}exports['queue']=function(_0x2a9fab,_0x4f1a29,_0x480603,_0x9f9953,_0x4b5a72,_0x4e4a2f){var _0x199828,_0x3a9129,_0x387654;_0x4e4a2f[_0xfe48('0x7f')]=intUtil[_0xfe48('0x80')](_0x4e4a2f[_0xfe48('0x7f')]);_0x4e4a2f[_0xfe48('0x81')]=intUtil[_0xfe48('0x80')](_0x4e4a2f[_0xfe48('0x81')]);if(_0x4b5a72&&_0x4b5a72[_0xfe48('0x82')]){logger[_0xfe48('0x2c')](_0xfe48('0x83'),_0xfe48('0x84'));_0x4f1a29['recordingURL']=_0x4e4a2f[_0xfe48('0x81')]+'/api/voice/recordings/'+_0x4f1a29[_0xfe48('0x85')]+_0xfe48('0x86')+md5(_0x4f1a29[_0xfe48('0x85')]);}else{_0x4f1a29[_0xfe48('0x87')]='';}var _0x409af9=_0x4e4a2f[_0xfe48('0x7f')]===_0xfe48('0x88')?'eu':_0xfe48('0x89');return getAccessToken(_0x4e4a2f)[_0xfe48('0x29')](function(_0x3532e8){_0x387654=_0x3532e8;return getUser(_0x387654,_0x409af9,_0x4e4a2f,_0x9f9953['email']);})[_0xfe48('0x29')](function(_0x3b8957){_0x199828=_0x3b8957;logger[_0xfe48('0x2c')](_0xfe48('0x8a'),_0x199828['id']);return getEndUser(_0x387654,_0x409af9,_0x4e4a2f,_0x4f1a29[_0xfe48('0x8b')],_0x4f1a29[_0xfe48('0x8c')],_0x199828,_0x480603);})[_0xfe48('0x29')](function(_0x58e362){_0x3a9129=_0x58e362;return getCall(_0x387654,_0x409af9,_0x4e4a2f,_0x199828,_0x3a9129,_0x480603,_0x4f1a29,_0xfe48('0x8d'));})['then'](function(_0x5bfa70){if(_0x5bfa70){logger[_0xfe48('0x2c')]('The\x20Call\x20ID\x20is:',_0x5bfa70['id']);logger[_0xfe48('0x2c')]('[QUEUE]',_0xfe48('0x8e'));emit(util[_0xfe48('0x2f')](_0xfe48('0x8f'),_0x9f9953[_0xfe48('0x18')]),_0xfe48('0x90'),{'uri':'https://crm.'+_0x4e4a2f['host']+_0xfe48('0x91')+_0x5bfa70['id']});}})[_0xfe48('0x2b')](function(_0x560338){logger['error']('[QUEUE]',JSON['stringify'](_0x560338));});};exports[_0xfe48('0x77')]=function(_0x1310e2,_0x3d0cbe,_0x19608c,_0x591645,_0xeb0707,_0x15ae46,_0x5da8f5){var _0x39e9af,_0x464ed0,_0xd5ae42;_0x15ae46[_0xfe48('0x7f')]=intUtil['stripTrailingSlash'](_0x15ae46['host']);_0x15ae46[_0xfe48('0x81')]=intUtil[_0xfe48('0x80')](_0x15ae46['serverUrl']);if(_0x5da8f5&&_0x5da8f5['recordingFormat']&&_0x5da8f5['recordingFormat']!==_0xfe48('0x92')){logger[_0xfe48('0x2c')]('[OUTBOUND]',_0xfe48('0x84'));_0x3d0cbe['recordingURL']=_0x15ae46['serverUrl']+'/api/voice/recordings/'+_0x3d0cbe[_0xfe48('0x85')]+'/downloads?type=uniqueid&token='+md5(_0x3d0cbe[_0xfe48('0x85')]);}var _0x7ce72b=_0x15ae46['host']===_0xfe48('0x88')?'eu':'com';return getAccessToken(_0x15ae46)[_0xfe48('0x29')](function(_0x1c729f){_0xd5ae42=_0x1c729f;return getUser(_0xd5ae42,_0x7ce72b,_0x15ae46,_0x591645['email']);})['then'](function(_0x1138de){_0x39e9af=_0x1138de;logger['info'](_0xfe48('0x8a'),_0x39e9af['id']);return getEndUser(_0xd5ae42,_0x7ce72b,_0x15ae46,_0x3d0cbe[_0xfe48('0x93')],_0x3d0cbe[_0xfe48('0x94')],_0x39e9af,_0x19608c);})[_0xfe48('0x29')](function(_0x55115b){_0x464ed0=_0x55115b;return getCall(_0xd5ae42,_0x7ce72b,_0x15ae46,_0x39e9af,_0x464ed0,_0x19608c,_0x3d0cbe,_0xfe48('0x95'));})[_0xfe48('0x29')](function(_0x3c01c5){if(_0x3c01c5){logger['info']('The\x20Call\x20ID\x20is:',_0x3c01c5['id']);logger[_0xfe48('0x2c')]('[OUTBOUND]',_0xfe48('0x8e'));emit(util[_0xfe48('0x2f')](_0xfe48('0x8f'),_0x591645[_0xfe48('0x18')]),_0xfe48('0x90'),{'uri':_0xfe48('0x96')+_0x15ae46[_0xfe48('0x7f')]+_0xfe48('0x91')+_0x3c01c5['id']});}})[_0xfe48('0x2b')](function(_0x1fcc1b){logger[_0xfe48('0x3c')]('[OUTBOUND]',JSON[_0xfe48('0x3e')](_0x1fcc1b));});};exports['unmanaged']=function(_0x1cad0c,_0x5714f8,_0x50009e,_0x19a1f6,_0x374987,_0x1fa52e){var _0x5c90a6,_0x3f40e6,_0x26291f;_0x1fa52e['host']=intUtil[_0xfe48('0x80')](_0x1fa52e[_0xfe48('0x7f')]);_0x1fa52e[_0xfe48('0x81')]=intUtil[_0xfe48('0x80')](_0x1fa52e[_0xfe48('0x81')]);if(_0x374987&&_0x374987[_0xfe48('0x82')]){logger[_0xfe48('0x2c')]('['+_0x5714f8[_0xfe48('0x6c')][_0xfe48('0x97')]()+']',_0xfe48('0x84'));_0x5714f8[_0xfe48('0x87')]=_0x1fa52e[_0xfe48('0x81')]+'/api/voice/recordings/'+_0x5714f8['uniqueid']+_0xfe48('0x86')+md5(_0x5714f8[_0xfe48('0x85')]);}else{_0x5714f8[_0xfe48('0x87')]='';}var _0x475770=_0x1fa52e[_0xfe48('0x7f')]===_0xfe48('0x88')?'eu':'com';return getAccessToken(_0x1fa52e)[_0xfe48('0x29')](function(_0x2baa85){_0x26291f=_0x2baa85;return getUser(_0x26291f,_0x475770,_0x1fa52e);})[_0xfe48('0x29')](function(_0x2f5bb3){_0x5c90a6=_0x2f5bb3;logger[_0xfe48('0x2c')](_0xfe48('0x8a'),_0x5c90a6['id']);return getEndUser(_0x26291f,_0x475770,_0x1fa52e,_0x5714f8[_0xfe48('0x8b')],_0x5714f8[_0xfe48('0x8c')],_0x5c90a6,_0x50009e);})[_0xfe48('0x29')](function(_0x2a1c64){_0x3f40e6=_0x2a1c64;return getCall(_0x26291f,_0x475770,_0x1fa52e,_0x5c90a6,_0x3f40e6,_0x50009e,_0x5714f8,_0xfe48('0x8d'));})[_0xfe48('0x29')](function(_0x30920f){if(_0x30920f){logger[_0xfe48('0x2c')](_0xfe48('0x98'),_0x30920f['id']);}})[_0xfe48('0x2b')](function(_0xf8ba06){logger[_0xfe48('0x3c')]('['+_0x5714f8['lastevent'][_0xfe48('0x97')]()+']',JSON[_0xfe48('0x3e')](_0xf8ba06));});}; \ 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 d6ad136..fdfe3d3 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 _0xd9b8=['Script','render','error','format','info','util','shelljs','mustache','trigger','exec','data2'];(function(_0x20fd36,_0x431dab){var _0x1a08c9=function(_0x127874){while(--_0x127874){_0x20fd36['push'](_0x20fd36['shift']());}};_0x1a08c9(++_0x431dab);}(_0xd9b8,0x10d));var _0x8d9b=function(_0x3f7598,_0x212e37){_0x3f7598=_0x3f7598-0x0;var _0x51fb16=_0xd9b8[_0x3f7598];return _0x51fb16;};'use strict';var util=require(_0x8d9b('0x0'));var sh=require(_0x8d9b('0x1'));var Mustache=require(_0x8d9b('0x2'));var logger=require('../../../../config/logger')(_0x8d9b('0x3'));exports[_0x8d9b('0x4')]=function(_0x46dcc8,_0x2b2286){var _0x1b3e97=_0x46dcc8['data2']?_0x46dcc8[_0x8d9b('0x5')]:_0x8d9b('0x6');var _0x183dc7=_0x46dcc8['data3']?Mustache[_0x8d9b('0x7')](_0x46dcc8['data3'],_0x2b2286):_0x2b2286;sh['exec'](_0x183dc7,function(_0x37336e,_0x14d88a,_0xbec05b){if(_0x37336e!==0x0){logger[_0x8d9b('0x8')](util[_0x8d9b('0x9')]('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0x1b3e97,_0x183dc7,_0x37336e,_0xbec05b));}else{logger[_0x8d9b('0xa')](util[_0x8d9b('0x9')]('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0x1b3e97,_0x183dc7,_0x14d88a));}});}; \ No newline at end of file +var _0x26c5=['render','exec','error','format','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','mustache','../../../../config/logger','trigger','data3'];(function(_0xbe7d8a,_0x53cada){var _0x1e9ecf=function(_0x9a5e0d){while(--_0x9a5e0d){_0xbe7d8a['push'](_0xbe7d8a['shift']());}};_0x1e9ecf(++_0x53cada);}(_0x26c5,0x1b6));var _0x526c=function(_0x3eedbc,_0x22b734){_0x3eedbc=_0x3eedbc-0x0;var _0x465af2=_0x26c5[_0x3eedbc];return _0x465af2;};'use strict';var util=require(_0x526c('0x0'));var sh=require(_0x526c('0x1'));var Mustache=require(_0x526c('0x2'));var logger=require(_0x526c('0x3'))(_0x526c('0x4'));exports['exec']=function(_0x6a8eba,_0x11a441){var _0x50f4f5=_0x6a8eba['data2']?_0x6a8eba['data2']:'Script';var _0x4dd8fc=_0x6a8eba[_0x526c('0x5')]?Mustache[_0x526c('0x6')](_0x6a8eba[_0x526c('0x5')],_0x11a441):_0x11a441;sh[_0x526c('0x7')](_0x4dd8fc,function(_0x395581,_0x8018b8,_0x59c197){if(_0x395581!==0x0){logger[_0x526c('0x8')](util[_0x526c('0x9')]('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0x50f4f5,_0x4dd8fc,_0x395581,_0x59c197));}else{logger[_0x526c('0xa')](util['format'](_0x526c('0xb'),_0x50f4f5,_0x4dd8fc,_0x8018b8));}});}; \ 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 4fdb41a..14e9864 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 _0x8e45=['stringify','then','isNil','body','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','catch','statusCode','name','message','request-promise','util','mustache','trigger','exec','data1','toUpperCase','render','data2','number','data5','headers','data6','error','stack','GET','POST','PUT','data7','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s'];(function(_0x5a3785,_0x2de636){var _0x4d058a=function(_0x2852fc){while(--_0x2852fc){_0x5a3785['push'](_0x5a3785['shift']());}};_0x4d058a(++_0x2de636);}(_0x8e45,0x14a));var _0x58e4=function(_0x265ba0,_0xc84c77){_0x265ba0=_0x265ba0-0x0;var _0x43ce71=_0x8e45[_0x265ba0];return _0x43ce71;};'use strict';var rp=require(_0x58e4('0x0'));var util=require(_0x58e4('0x1'));var _=require('lodash');var Mustache=require(_0x58e4('0x2'));var logger=require('../../../../config/logger')(_0x58e4('0x3'));exports[_0x58e4('0x4')]=function(_0x289b64,_0x5ed9df){var _0x3805ef,_0x42fb7f;var _0x22b989={'method':_0x289b64[_0x58e4('0x5')][_0x58e4('0x6')](),'uri':Mustache[_0x58e4('0x7')](_0x289b64[_0x58e4('0x8')],_0x5ed9df),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x289b64['data5'])===_0x58e4('0x9')&&parseInt(_0x289b64['data5'])>=0x1&&parseInt(_0x289b64[_0x58e4('0xa')])<=0xa?parseInt(_0x289b64[_0x58e4('0xa')])*0x3e8:0x5*0x3e8};try{_0x22b989[_0x58e4('0xb')]=_0x289b64[_0x58e4('0xc')]?JSON['parse'](Mustache[_0x58e4('0x7')](_0x289b64[_0x58e4('0xc')],_0x5ed9df)):{};}catch(_0x23b561){logger[_0x58e4('0xd')](_0x23b561[_0x58e4('0xe')]);}switch(_0x289b64[_0x58e4('0x5')][_0x58e4('0x6')]()){case _0x58e4('0xf'):case'DELETE':_0x3805ef=null;_0x22b989['qs']=_0x5ed9df;break;case _0x58e4('0x10'):case _0x58e4('0x11'):if(_0x289b64[_0x58e4('0x12')]){try{_0x3805ef=JSON['parse'](Mustache[_0x58e4('0x7')](_0x289b64[_0x58e4('0x12')],_0x5ed9df));_0x22b989['body']=_0x3805ef;}catch(_0x54d841){logger[_0x58e4('0xd')](_0x54d841[_0x58e4('0xe')]);logger[_0x58e4('0xd')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x3805ef=_0x5ed9df;_0x22b989['body']=_0x3805ef;}break;}logger[_0x58e4('0x13')](util[_0x58e4('0x14')](_0x58e4('0x15'),_0x289b64[_0x58e4('0x5')],_0x289b64[_0x58e4('0x8')],JSON[_0x58e4('0x16')](_0x22b989)));rp(_0x22b989)[_0x58e4('0x17')](function(_0x344554){_0x3805ef=!_[_0x58e4('0x18')](_0x3805ef)?',\x20request\x20body:\x20'+_0x3805ef:'';_0x42fb7f=typeof _0x344554[_0x58e4('0x19')]===_0x58e4('0x1a')?JSON[_0x58e4('0x16')](_0x344554[_0x58e4('0x19')]):_0x344554[_0x58e4('0x19')];logger[_0x58e4('0x13')](util['format'](_0x58e4('0x1b'),_0x289b64[_0x58e4('0x5')],_0x289b64[_0x58e4('0x8')],_0x344554['statusCode'],_0x42fb7f));})[_0x58e4('0x1c')](function(_0x44d01d){logger[_0x58e4('0xd')](util[_0x58e4('0x14')]('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x289b64[_0x58e4('0x5')],_0x289b64[_0x58e4('0x8')],_0x44d01d[_0x58e4('0x1d')],_0x44d01d[_0x58e4('0x1e')],_0x44d01d[_0x58e4('0x1f')]));});}; \ No newline at end of file +var _0xcab0=['exec','data1','render','data2','data5','headers','data6','parse','error','stack','toUpperCase','DELETE','POST','PUT','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','body','info','format','stringify','then','isNil','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util','lodash','mustache'];(function(_0x1aff31,_0x2bc06f){var _0x419989=function(_0x2e06a9){while(--_0x2e06a9){_0x1aff31['push'](_0x1aff31['shift']());}};_0x419989(++_0x2bc06f);}(_0xcab0,0x1ae));var _0x0cab=function(_0x44fb5c,_0x2a9ccf){_0x44fb5c=_0x44fb5c-0x0;var _0x3e2c4a=_0xcab0[_0x44fb5c];return _0x3e2c4a;};'use strict';var rp=require(_0x0cab('0x0'));var util=require(_0x0cab('0x1'));var _=require(_0x0cab('0x2'));var Mustache=require(_0x0cab('0x3'));var logger=require('../../../../config/logger')('trigger');exports[_0x0cab('0x4')]=function(_0x127e38,_0x1d7e7){var _0x55f908,_0x47a80e;var _0x437a8d={'method':_0x127e38[_0x0cab('0x5')]['toUpperCase'](),'uri':Mustache[_0x0cab('0x6')](_0x127e38[_0x0cab('0x7')],_0x1d7e7),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x127e38[_0x0cab('0x8')])==='number'&&parseInt(_0x127e38[_0x0cab('0x8')])>=0x1&&parseInt(_0x127e38['data5'])<=0xa?parseInt(_0x127e38[_0x0cab('0x8')])*0x3e8:0x5*0x3e8};try{_0x437a8d[_0x0cab('0x9')]=_0x127e38[_0x0cab('0xa')]?JSON[_0x0cab('0xb')](Mustache[_0x0cab('0x6')](_0x127e38[_0x0cab('0xa')],_0x1d7e7)):{};}catch(_0x34e11c){logger[_0x0cab('0xc')](_0x34e11c[_0x0cab('0xd')]);}switch(_0x127e38[_0x0cab('0x5')][_0x0cab('0xe')]()){case'GET':case _0x0cab('0xf'):_0x55f908=null;_0x437a8d['qs']=_0x1d7e7;break;case _0x0cab('0x10'):case _0x0cab('0x11'):if(_0x127e38['data7']){try{_0x55f908=JSON[_0x0cab('0xb')](Mustache[_0x0cab('0x6')](_0x127e38['data7'],_0x1d7e7));_0x437a8d['body']=_0x55f908;}catch(_0x46caf5){logger[_0x0cab('0xc')](_0x46caf5['stack']);logger[_0x0cab('0xc')](_0x0cab('0x12'));}}else{_0x55f908=_0x1d7e7;_0x437a8d[_0x0cab('0x13')]=_0x55f908;}break;}logger[_0x0cab('0x14')](util[_0x0cab('0x15')]('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0x127e38['data1'],_0x127e38[_0x0cab('0x7')],JSON[_0x0cab('0x16')](_0x437a8d)));rp(_0x437a8d)[_0x0cab('0x17')](function(_0x58e59c){_0x55f908=!_[_0x0cab('0x18')](_0x55f908)?',\x20request\x20body:\x20'+_0x55f908:'';_0x47a80e=typeof _0x58e59c['body']===_0x0cab('0x19')?JSON[_0x0cab('0x16')](_0x58e59c[_0x0cab('0x13')]):_0x58e59c[_0x0cab('0x13')];logger[_0x0cab('0x14')](util[_0x0cab('0x15')](_0x0cab('0x1a'),_0x127e38[_0x0cab('0x5')],_0x127e38[_0x0cab('0x7')],_0x58e59c[_0x0cab('0x1b')],_0x47a80e));})['catch'](function(_0x1079c5){logger[_0x0cab('0xc')](util[_0x0cab('0x15')](_0x0cab('0x1c'),_0x127e38['data1'],_0x127e38[_0x0cab('0x7')],_0x1079c5[_0x0cab('0x1b')],_0x1079c5[_0x0cab('0x1d')],_0x1079c5[_0x0cab('0x1e')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 64fc367..1cd24c2 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 _0xc8cf=['Request','request','then','routing','error','rpc','result','catch','../../config/logger','http'];(function(_0x462fe4,_0x394d3e){var _0x82b23a=function(_0x2c071f){while(--_0x2c071f){_0x462fe4['push'](_0x462fe4['shift']());}};_0x82b23a(++_0x394d3e);}(_0xc8cf,0x94));var _0xfc8c=function(_0x30671b,_0x24f8ed){_0x30671b=_0x30671b-0x0;var _0x157c5e=_0xc8cf[_0x30671b];return _0x157c5e;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0xfc8c('0x0'))('routing');var client=jayson['client'][_0xfc8c('0x1')]({'port':0x2329});client[_0xfc8c('0x2')]=function(_0x1ddd7b,_0x38bf7a){return new BPromise(function(_0xa5c3f4,_0x4cdf33){return client[_0xfc8c('0x3')](_0x1ddd7b,_0x38bf7a)[_0xfc8c('0x4')](function(_0x29ea0b){logger['debug']('rpc',_0xfc8c('0x5'),_0x1ddd7b,_0x38bf7a,_0x29ea0b);if(_0x29ea0b[_0xfc8c('0x6')]){logger[_0xfc8c('0x6')](_0xfc8c('0x7'),_0xfc8c('0x5'),_0x1ddd7b,_0x29ea0b[_0xfc8c('0x6')]['message'],_0x38bf7a);return _0x4cdf33(_0x29ea0b[_0xfc8c('0x6')]['message']);}else{return _0xa5c3f4(_0x29ea0b[_0xfc8c('0x8')]);}})[_0xfc8c('0x9')](function(_0x2b0e32){logger[_0xfc8c('0x6')]('rpc',_0xfc8c('0x5'),_0x1ddd7b,_0x2b0e32,_0x38bf7a);return _0x4cdf33(_0x2b0e32);});});};module['exports']=client; \ No newline at end of file +var _0x014b=['error','message','catch','exports','jayson/promise','bluebird','../../config/logger','routing','http','Request','request','then','debug','rpc'];(function(_0x32a617,_0x4c8f62){var _0x5412da=function(_0x12c60a){while(--_0x12c60a){_0x32a617['push'](_0x32a617['shift']());}};_0x5412da(++_0x4c8f62);}(_0x014b,0x18c));var _0xb014=function(_0x549dc8,_0x4b83bc){_0x549dc8=_0x549dc8-0x0;var _0x138e37=_0x014b[_0x549dc8];return _0x138e37;};'use strict';var jayson=require(_0xb014('0x0'));var BPromise=require(_0xb014('0x1'));var logger=require(_0xb014('0x2'))(_0xb014('0x3'));var client=jayson['client'][_0xb014('0x4')]({'port':0x2329});client[_0xb014('0x5')]=function(_0xbd74e4,_0x3cffd4){return new BPromise(function(_0x163400,_0x48c563){return client[_0xb014('0x6')](_0xbd74e4,_0x3cffd4)[_0xb014('0x7')](function(_0x50584c){logger[_0xb014('0x8')](_0xb014('0x9'),_0xb014('0x3'),_0xbd74e4,_0x3cffd4,_0x50584c);if(_0x50584c['error']){logger['error']('rpc',_0xb014('0x3'),_0xbd74e4,_0x50584c[_0xb014('0xa')][_0xb014('0xb')],_0x3cffd4);return _0x48c563(_0x50584c['error'][_0xb014('0xb')]);}else{return _0x163400(_0x50584c['result']);}})[_0xb014('0xc')](function(_0x42e014){logger[_0xb014('0xa')](_0xb014('0x9'),_0xb014('0x3'),_0xbd74e4,_0x42e014,_0x3cffd4);return _0x48c563(_0x42e014);});});};module[_0xb014('0xd')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index e641493..1a7d23b 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 _0x9f52=['./server','./lib/email','./rpc/setting','resolve','then','getMailAccounts','mailAccounts','getSettings','loginMailFrequency','catch','error'];(function(_0x4e15f4,_0x5a72f2){var _0x5a9643=function(_0x26c1d6){while(--_0x26c1d6){_0x4e15f4['push'](_0x4e15f4['shift']());}};_0x5a9643(++_0x5a72f2);}(_0x9f52,0x1ce));var _0x29f5=function(_0x56fb8d,_0x3f176a){_0x56fb8d=_0x56fb8d-0x0;var _0x40d9fe=_0x9f52[_0x56fb8d];return _0x40d9fe;};'use strict';var server=require(_0x29f5('0x0'));var Realtime=require('./realtime');var EmailChannel=require(_0x29f5('0x1'));var mailAccount=require('./rpc/mailAccount');var setting=require(_0x29f5('0x2'));var logger=require('../../config/logger')('email');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x29f5('0x3')]()[_0x29f5('0x4')](mailAccount[_0x29f5('0x5')]())[_0x29f5('0x4')](realtime['initMailAccounts']())['then'](function(){email['refresh'](realtime[_0x29f5('0x6')]);return realtime;});}function main(){return server['listen'](realtime,email)[_0x29f5('0x4')](function(){return initRealtime();})[_0x29f5('0x4')](function(){return setting[_0x29f5('0x7')]();})['then'](function(_0x58cb34){return setInterval(initRealtime,_0x58cb34[_0x29f5('0x8')]*0x3e8);})[_0x29f5('0x9')](function(_0x21da0a){logger[_0x29f5('0xa')]('Email\x20service\x20initialization',_0x21da0a);});}main(); \ No newline at end of file +var _0x9220=['loginMailFrequency','catch','error','./server','./lib/email','./rpc/mailAccount','./rpc/setting','email','resolve','then','initMailAccounts','mailAccounts','listen','getSettings'];(function(_0x14b2dd,_0x8130a0){var _0x5defab=function(_0x22eef2){while(--_0x22eef2){_0x14b2dd['push'](_0x14b2dd['shift']());}};_0x5defab(++_0x8130a0);}(_0x9220,0x1d1));var _0x0922=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0x9220[_0x4ff09b];return _0x3f5c2e;};'use strict';var server=require(_0x0922('0x0'));var Realtime=require('./realtime');var EmailChannel=require(_0x0922('0x1'));var mailAccount=require(_0x0922('0x2'));var setting=require(_0x0922('0x3'));var logger=require('../../config/logger')(_0x0922('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x0922('0x5')]()['then'](mailAccount['getMailAccounts']())[_0x0922('0x6')](realtime[_0x0922('0x7')]())['then'](function(){email['refresh'](realtime[_0x0922('0x8')]);return realtime;});}function main(){return server[_0x0922('0x9')](realtime,email)['then'](function(){return initRealtime();})['then'](function(){return setting[_0x0922('0xa')]();})['then'](function(_0x394421){return setInterval(initRealtime,_0x394421[_0x0922('0xb')]*0x3e8);})[_0x0922('0xc')](function(_0x4286ee){logger[_0x0922('0xd')]('Email\x20service\x20initialization',_0x4286ee);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index fae0e83..5338d82 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 _0xe6c9=['notify','then','catch','error','Mail\x20not\x20accepted\x20from\x20routing\x20%s','stringify','lastSync','smtp','send','verifySmtp','Smtp','verify','verified','lodash','moment','bluebird','md5','../../../config/logger','email','localhost','socket.io-emitter','redis','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','emit','key','active','Imap','status','total','hasOwnProperty','service','provider','custom','box','handleImapBox','bind','handleImapEmail','end','handleImapEnd','handleImapError','isNil','disabled','prototype','messageStatus','name','messages','from'];(function(_0x2db667,_0x193cf5){var _0x83ff9=function(_0x5da022){while(--_0x5da022){_0x2db667['push'](_0x2db667['shift']());}};_0x83ff9(++_0x193cf5);}(_0xe6c9,0xa9));var _0x9e6c=function(_0x43fa3a,_0x11c4ea){_0x43fa3a=_0x43fa3a-0x0;var _0x35fd7d=_0xe6c9[_0x43fa3a];return _0x35fd7d;};'use strict';var _=require(_0x9e6c('0x0'));var moment=require(_0x9e6c('0x1'));var BPromise=require(_0x9e6c('0x2'));var md5=require(_0x9e6c('0x3'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x9e6c('0x4'))(_0x9e6c('0x5'));config['redis']=_['defaults'](config['redis'],{'host':_0x9e6c('0x6'),'port':0x18eb});var io=require(_0x9e6c('0x7'))(new Redis(config[_0x9e6c('0x8')]));var EmailImap=require('./imap');var EmailSmtp=require(_0x9e6c('0x9'));var mailAccount=require(_0x9e6c('0xa'));var md5Accounts={};function EmailChannel(_0x5152c9){logger[_0x9e6c('0xb')](_0x9e6c('0xc'));this[_0x9e6c('0xd')]=_0x5152c9[_0x9e6c('0xd')];this[_0x9e6c('0xe')]={};this['smtp']=new EmailSmtp();}EmailChannel['prototype'][_0x9e6c('0xf')]=function(_0x262f9b){var _0x5b1e35=this[_0x9e6c('0xd')][_0x262f9b];var _0x28f772={'id':_0x5b1e35['id'],'name':_0x5b1e35['name'],'key':_0x5b1e35[_0x9e6c('0x10')],'active':_0x5b1e35[_0x9e6c('0x11')],'Imap':{'status':_0x5b1e35[_0x9e6c('0x12')][_0x9e6c('0x13')],'messageStatus':_0x5b1e35[_0x9e6c('0x12')]['messageStatus'],'total':_0x5b1e35[_0x9e6c('0x12')][_0x9e6c('0x14')]}};if(_['isNil'](md5Accounts[_0x262f9b])){md5Accounts[_0x262f9b]={};}var _0x652279=md5(JSON['stringify'](_0x28f772));if(md5Accounts[_0x262f9b][_0x9e6c('0x3')]!==_0x652279){md5Accounts[_0x262f9b][_0x9e6c('0x3')]=_0x652279;io[_0x9e6c('0xf')]('mailAccount:update',_0x28f772);}};EmailChannel['prototype']['refresh']=function(_0x34ea1d){for(var _0x570b05 in _0x34ea1d){if(_0x34ea1d[_0x9e6c('0x15')](_0x570b05)){if(_0x34ea1d[_0x570b05]['Imap']&&_0x34ea1d[_0x570b05]['active']){var _0x3120d5=_0x34ea1d[_0x570b05][_0x9e6c('0x12')];if(!_0x3120d5[_0x9e6c('0x16')]&&_0x34ea1d[_0x570b05][_0x9e6c('0x17')]!==_0x9e6c('0x18'))_0x3120d5[_0x9e6c('0x16')]=_0x34ea1d[_0x570b05][_0x9e6c('0x17')];if(!this['imapAccounts'][_0x9e6c('0x15')](_0x3120d5['id'])){this[_0x9e6c('0xe')][_0x3120d5['id']]=new EmailImap(_0x3120d5,_0x34ea1d[_0x570b05]['email']);this[_0x9e6c('0xe')][_0x3120d5['id']]['on'](_0x9e6c('0x19'),this[_0x9e6c('0x1a')][_0x9e6c('0x1b')](this,_0x570b05));this[_0x9e6c('0xe')][_0x3120d5['id']]['on'](_0x9e6c('0x5'),this[_0x9e6c('0x1c')][_0x9e6c('0x1b')](this,_0x570b05));this[_0x9e6c('0xe')][_0x3120d5['id']]['on'](_0x9e6c('0x1d'),this[_0x9e6c('0x1e')][_0x9e6c('0x1b')](this,_0x570b05));this[_0x9e6c('0xe')][_0x3120d5['id']]['on']('error',this[_0x9e6c('0x1f')][_0x9e6c('0x1b')](this,_0x570b05));}}else{if(_[_0x9e6c('0x20')](this[_0x9e6c('0xd')][_0x570b05]['Imap'])){this[_0x9e6c('0xd')][_0x570b05]['Imap']={};}this[_0x9e6c('0xd')][_0x570b05][_0x9e6c('0x12')][_0x9e6c('0x13')]=_0x9e6c('0x21');this['mailAccounts'][_0x570b05][_0x9e6c('0x12')]['messageStatus']='';this[_0x9e6c('0xf')](_0x570b05);}}}};EmailChannel[_0x9e6c('0x22')][_0x9e6c('0x1a')]=function(_0x42f092,_0xa204f2){if(this[_0x9e6c('0xd')][_0x42f092]){this['mailAccounts'][_0x42f092]['Imap'][_0x9e6c('0x13')]='connected';this[_0x9e6c('0xd')][_0x42f092][_0x9e6c('0x12')][_0x9e6c('0x23')]=_0xa204f2[_0x9e6c('0x24')];if(_0xa204f2['messages']){this[_0x9e6c('0xd')][_0x42f092]['Imap'][_0x9e6c('0x14')]=_0xa204f2[_0x9e6c('0x25')][_0x9e6c('0x14')];}return this[_0x9e6c('0xf')](_0x42f092);}};EmailChannel[_0x9e6c('0x22')][_0x9e6c('0x1c')]=function(_0x2af8d1,_0x3ef397){logger[_0x9e6c('0xb')]('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x3ef397['firstName'],_0x3ef397['lastName'],_0x3ef397[_0x9e6c('0x26')],_0x2af8d1);if(this[_0x9e6c('0xd')][_0x2af8d1]){return mailAccount[_0x9e6c('0x27')](_0x2af8d1,_0x3ef397)[_0x9e6c('0x28')](function(_0x9030b2){if(_0x9030b2){logger[_0x9e6c('0xb')]('Mail\x20accepted\x20from\x20routing');}})[_0x9e6c('0x29')](function(_0x163a56){logger[_0x9e6c('0x2a')](_0x9e6c('0x2b'),JSON[_0x9e6c('0x2c')](_0x163a56));});}};EmailChannel[_0x9e6c('0x22')]['handleImapEnd']=function(_0x19bd2c){if(this['mailAccounts'][_0x19bd2c]&&this[_0x9e6c('0xd')][_0x19bd2c][_0x9e6c('0x12')]){if(this[_0x9e6c('0xe')][this[_0x9e6c('0xd')][_0x19bd2c][_0x9e6c('0x12')]['id']]){delete this[_0x9e6c('0xe')][this[_0x9e6c('0xd')][_0x19bd2c][_0x9e6c('0x12')]['id']];}this['mailAccounts'][_0x19bd2c][_0x9e6c('0x12')][_0x9e6c('0x2d')]=moment();this[_0x9e6c('0xf')](_0x19bd2c);}};EmailChannel[_0x9e6c('0x22')][_0x9e6c('0x1f')]=function(_0x1592b5,_0x2cc81d){if(this[_0x9e6c('0xd')][_0x1592b5]){this[_0x9e6c('0xd')][_0x1592b5][_0x9e6c('0x12')][_0x9e6c('0x13')]=_0x9e6c('0x2a');this[_0x9e6c('0xd')][_0x1592b5][_0x9e6c('0x12')][_0x9e6c('0x23')]=_0x2cc81d;return this['emit'](_0x1592b5);}};EmailChannel[_0x9e6c('0x22')]['sendMail']=function(_0x474466,_0x2e2047){return this[_0x9e6c('0x2e')][_0x9e6c('0x2f')](_0x474466,_0x2e2047);};EmailChannel['prototype'][_0x9e6c('0x30')]=function(_0x2bab5e){var _0x4924da=this;if(this['mailAccounts'][_0x2bab5e['id']]){if(_[_0x9e6c('0x20')](this['mailAccounts'][_0x2bab5e['id']]['Smtp'])){this[_0x9e6c('0xd')][_0x2bab5e['id']][_0x9e6c('0x31')]={};}this['mailAccounts'][_0x2bab5e['id']]['Smtp']['lastSync']=moment();return new BPromise(function(_0x23386e,_0x9f236f){return _0x4924da[_0x9e6c('0x2e')][_0x9e6c('0x32')](_0x2bab5e)[_0x9e6c('0x28')](function(_0x4f6930){_0x4924da[_0x9e6c('0xd')][_0x2bab5e['id']][_0x9e6c('0x31')][_0x9e6c('0x13')]=_0x9e6c('0x33');_0x4924da[_0x9e6c('0xd')][_0x2bab5e['id']][_0x9e6c('0x31')]['messageStatus']='';_0x4924da[_0x9e6c('0xf')](_0x2bab5e['id']);_0x23386e(_0x4f6930);})[_0x9e6c('0x29')](function(_0x4c8895){_0x4924da['mailAccounts'][_0x2bab5e['id']]['Smtp']['status']=_0x9e6c('0x2a');_0x4924da[_0x9e6c('0xd')][_0x2bab5e['id']][_0x9e6c('0x31')]['messageStatus']=_0x4c8895;_0x4924da[_0x9e6c('0xf')](_0x2bab5e['id']);_0x9f236f(_0x4c8895);});});}return this[_0x9e6c('0x2e')][_0x9e6c('0x32')](_0x2bab5e);};module['exports']=EmailChannel; \ No newline at end of file +var _0x22a2=['Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','verifySmtp','Smtp','verify','then','verified','exports','lodash','moment','bluebird','md5','ioredis','../../../config/environment','email','redis','localhost','socket.io-emitter','./smtp','../rpc/mailAccount','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','active','Imap','status','messageStatus','stringify','refresh','hasOwnProperty','service','provider','custom','box','handleImapBox','handleImapEmail','bind','end','handleImapEnd','handleImapError','isNil','disabled','connected','total','messages','info','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','Mail\x20accepted\x20from\x20routing','catch','error'];(function(_0x11ed92,_0x33491e){var _0x5f28d1=function(_0x5ef925){while(--_0x5ef925){_0x11ed92['push'](_0x11ed92['shift']());}};_0x5f28d1(++_0x33491e);}(_0x22a2,0xf0));var _0x222a=function(_0x49ed67,_0x5d5d06){_0x49ed67=_0x49ed67-0x0;var _0x2f0e59=_0x22a2[_0x49ed67];return _0x2f0e59;};'use strict';var _=require(_0x222a('0x0'));var moment=require(_0x222a('0x1'));var BPromise=require(_0x222a('0x2'));var md5=require(_0x222a('0x3'));var Redis=require(_0x222a('0x4'));var config=require(_0x222a('0x5'));var logger=require('../../../config/logger')(_0x222a('0x6'));config[_0x222a('0x7')]=_['defaults'](config[_0x222a('0x7')],{'host':_0x222a('0x8'),'port':0x18eb});var io=require(_0x222a('0x9'))(new Redis(config[_0x222a('0x7')]));var EmailImap=require('./imap');var EmailSmtp=require(_0x222a('0xa'));var mailAccount=require(_0x222a('0xb'));var md5Accounts={};function EmailChannel(_0x2b223f){logger['info']('start\x20email\x20channel');this[_0x222a('0xc')]=_0x2b223f['mailAccounts'];this[_0x222a('0xd')]={};this[_0x222a('0xe')]=new EmailSmtp();}EmailChannel[_0x222a('0xf')][_0x222a('0x10')]=function(_0x5d2be5){var _0x229f83=this[_0x222a('0xc')][_0x5d2be5];var _0x26a5e1={'id':_0x229f83['id'],'name':_0x229f83[_0x222a('0x11')],'key':_0x229f83[_0x222a('0x12')],'active':_0x229f83[_0x222a('0x13')],'Imap':{'status':_0x229f83[_0x222a('0x14')][_0x222a('0x15')],'messageStatus':_0x229f83[_0x222a('0x14')][_0x222a('0x16')],'total':_0x229f83['Imap']['total']}};if(_['isNil'](md5Accounts[_0x5d2be5])){md5Accounts[_0x5d2be5]={};}var _0x2c33e2=md5(JSON[_0x222a('0x17')](_0x26a5e1));if(md5Accounts[_0x5d2be5]['md5']!==_0x2c33e2){md5Accounts[_0x5d2be5][_0x222a('0x3')]=_0x2c33e2;io['emit']('mailAccount:update',_0x26a5e1);}};EmailChannel[_0x222a('0xf')][_0x222a('0x18')]=function(_0x387073){for(var _0x1b305f in _0x387073){if(_0x387073[_0x222a('0x19')](_0x1b305f)){if(_0x387073[_0x1b305f][_0x222a('0x14')]&&_0x387073[_0x1b305f][_0x222a('0x13')]){var _0x52caed=_0x387073[_0x1b305f][_0x222a('0x14')];if(!_0x52caed[_0x222a('0x1a')]&&_0x387073[_0x1b305f][_0x222a('0x1b')]!==_0x222a('0x1c'))_0x52caed[_0x222a('0x1a')]=_0x387073[_0x1b305f][_0x222a('0x1b')];if(!this[_0x222a('0xd')][_0x222a('0x19')](_0x52caed['id'])){this['imapAccounts'][_0x52caed['id']]=new EmailImap(_0x52caed,_0x387073[_0x1b305f]['email']);this['imapAccounts'][_0x52caed['id']]['on'](_0x222a('0x1d'),this[_0x222a('0x1e')]['bind'](this,_0x1b305f));this[_0x222a('0xd')][_0x52caed['id']]['on'](_0x222a('0x6'),this[_0x222a('0x1f')][_0x222a('0x20')](this,_0x1b305f));this[_0x222a('0xd')][_0x52caed['id']]['on'](_0x222a('0x21'),this[_0x222a('0x22')][_0x222a('0x20')](this,_0x1b305f));this[_0x222a('0xd')][_0x52caed['id']]['on']('error',this[_0x222a('0x23')][_0x222a('0x20')](this,_0x1b305f));}}else{if(_[_0x222a('0x24')](this[_0x222a('0xc')][_0x1b305f][_0x222a('0x14')])){this[_0x222a('0xc')][_0x1b305f]['Imap']={};}this[_0x222a('0xc')][_0x1b305f][_0x222a('0x14')][_0x222a('0x15')]=_0x222a('0x25');this[_0x222a('0xc')][_0x1b305f][_0x222a('0x14')][_0x222a('0x16')]='';this[_0x222a('0x10')](_0x1b305f);}}}};EmailChannel[_0x222a('0xf')][_0x222a('0x1e')]=function(_0x3b8a54,_0x195816){if(this['mailAccounts'][_0x3b8a54]){this[_0x222a('0xc')][_0x3b8a54][_0x222a('0x14')]['status']=_0x222a('0x26');this['mailAccounts'][_0x3b8a54]['Imap'][_0x222a('0x16')]=_0x195816[_0x222a('0x11')];if(_0x195816['messages']){this['mailAccounts'][_0x3b8a54][_0x222a('0x14')][_0x222a('0x27')]=_0x195816[_0x222a('0x28')][_0x222a('0x27')];}return this[_0x222a('0x10')](_0x3b8a54);}};EmailChannel[_0x222a('0xf')][_0x222a('0x1f')]=function(_0x3f961e,_0x4b3e0c){logger[_0x222a('0x29')](_0x222a('0x2a'),_0x4b3e0c[_0x222a('0x2b')],_0x4b3e0c[_0x222a('0x2c')],_0x4b3e0c[_0x222a('0x2d')],_0x3f961e);if(this[_0x222a('0xc')][_0x3f961e]){return mailAccount[_0x222a('0x2e')](_0x3f961e,_0x4b3e0c)['then'](function(_0x1f39d5){if(_0x1f39d5){logger['info'](_0x222a('0x2f'));}})[_0x222a('0x30')](function(_0x1a4ce1){logger[_0x222a('0x31')](_0x222a('0x32'),JSON[_0x222a('0x17')](_0x1a4ce1));});}};EmailChannel['prototype'][_0x222a('0x22')]=function(_0x1fa240){if(this['mailAccounts'][_0x1fa240]&&this[_0x222a('0xc')][_0x1fa240][_0x222a('0x14')]){if(this[_0x222a('0xd')][this[_0x222a('0xc')][_0x1fa240][_0x222a('0x14')]['id']]){delete this[_0x222a('0xd')][this[_0x222a('0xc')][_0x1fa240]['Imap']['id']];}this['mailAccounts'][_0x1fa240][_0x222a('0x14')][_0x222a('0x33')]=moment();this[_0x222a('0x10')](_0x1fa240);}};EmailChannel[_0x222a('0xf')][_0x222a('0x23')]=function(_0x11e384,_0x330ad4){if(this[_0x222a('0xc')][_0x11e384]){this[_0x222a('0xc')][_0x11e384]['Imap']['status']=_0x222a('0x31');this[_0x222a('0xc')][_0x11e384][_0x222a('0x14')][_0x222a('0x16')]=_0x330ad4;return this[_0x222a('0x10')](_0x11e384);}};EmailChannel['prototype']['sendMail']=function(_0xbdccf8,_0x185f67){return this[_0x222a('0xe')]['send'](_0xbdccf8,_0x185f67);};EmailChannel[_0x222a('0xf')][_0x222a('0x34')]=function(_0x4725fe){var _0x1f2d80=this;if(this['mailAccounts'][_0x4725fe['id']]){if(_[_0x222a('0x24')](this[_0x222a('0xc')][_0x4725fe['id']][_0x222a('0x35')])){this[_0x222a('0xc')][_0x4725fe['id']][_0x222a('0x35')]={};}this[_0x222a('0xc')][_0x4725fe['id']][_0x222a('0x35')][_0x222a('0x33')]=moment();return new BPromise(function(_0x442fdb,_0xc5d910){return _0x1f2d80[_0x222a('0xe')][_0x222a('0x36')](_0x4725fe)[_0x222a('0x37')](function(_0x2406af){_0x1f2d80[_0x222a('0xc')][_0x4725fe['id']][_0x222a('0x35')]['status']=_0x222a('0x38');_0x1f2d80[_0x222a('0xc')][_0x4725fe['id']][_0x222a('0x35')]['messageStatus']='';_0x1f2d80[_0x222a('0x10')](_0x4725fe['id']);_0x442fdb(_0x2406af);})[_0x222a('0x30')](function(_0x456d53){_0x1f2d80[_0x222a('0xc')][_0x4725fe['id']][_0x222a('0x35')]['status']=_0x222a('0x31');_0x1f2d80[_0x222a('0xc')][_0x4725fe['id']][_0x222a('0x35')]['messageStatus']=_0x456d53;_0x1f2d80[_0x222a('0x10')](_0x4725fe['id']);_0xc5d910(_0x456d53);});});}return this[_0x222a('0xe')][_0x222a('0x36')](_0x4725fe);};module[_0x222a('0x39')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 4027b53..30aeb8c 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 _0x97cb=['port','tls','autotls','required','handleReady','openBox','handleOpenBox','bind','prototype','box','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','length','fetch','handleFetchMessage','error','closeBox','handleMessageBody','attributes','handleMessageAttributes','handleSimpleParser','handleMessageEnd','parser','emit','handleFetchEnd','handleFetchError','stringify','textCode','hasOwnProperty','upperFirst','exports','util','imap','mailparser','simpleParser','iconv','Iconv','events','EventEmitter','./utils','../../../config/logger','email','mailbox','account','getAccount','once','ready','end','handleEnd','handleError','connect','inherits','connTimeout','authTimeout','service','user','xoauth2','generateXOAuth2Token','CloudProvider','data5','password','authentication','anonymous@xcally.com','host'];(function(_0x4ca7a6,_0x2a9f22){var _0x1c4da7=function(_0x341120){while(--_0x341120){_0x4ca7a6['push'](_0x4ca7a6['shift']());}};_0x1c4da7(++_0x2a9f22);}(_0x97cb,0xeb));var _0xb97c=function(_0x367bdc,_0x746265){_0x367bdc=_0x367bdc-0x0;var _0x336ae1=_0x97cb[_0x367bdc];return _0x336ae1;};'use strict';var _=require('lodash');var util=require(_0xb97c('0x0'));var Imap=require(_0xb97c('0x1'));var simpleParser=require(_0xb97c('0x2'))[_0xb97c('0x3')];var Iconv=require(_0xb97c('0x4'))[_0xb97c('0x5')];var EventEmitter=require(_0xb97c('0x6'))[_0xb97c('0x7')];var utils=require(_0xb97c('0x8'));var logger=require(_0xb97c('0x9'))(_0xb97c('0xa'));function EmailImap(_0x47472c,_0x5ddf69){this[_0xb97c('0xb')]=_0x47472c[_0xb97c('0xb')];this[_0xb97c('0xc')]=this[_0xb97c('0xd')](_0x47472c,_0x5ddf69);this[_0xb97c('0x1')]=new Imap(this[_0xb97c('0xc')]);this[_0xb97c('0x1')][_0xb97c('0xe')](_0xb97c('0xf'),this['handleReady']['bind'](this));this['imap'][_0xb97c('0xe')](_0xb97c('0x10'),this[_0xb97c('0x11')]['bind'](this));this[_0xb97c('0x1')]['on']('error',this[_0xb97c('0x12')]['bind'](this));this[_0xb97c('0x1')][_0xb97c('0x13')]();}util[_0xb97c('0x14')](EmailImap,EventEmitter);EmailImap['prototype'][_0xb97c('0xd')]=function(_0xa53b3d,_0x52dbf0){var _0x387c30={'connTimeout':_0xa53b3d[_0xb97c('0x15')]?_0xa53b3d[_0xb97c('0x15')]*0x3e8:0x2710,'authTimeout':_0xa53b3d['authTimeout']?_0xa53b3d[_0xb97c('0x16')]*0x3e8:0x1388};if(_0xa53b3d[_0xb97c('0x17')]){_0x387c30['user']=_0xa53b3d[_0xb97c('0x18')];if(_0xa53b3d['modernAuthentication']){_0x387c30[_0xb97c('0x19')]=utils[_0xb97c('0x1a')](_0xa53b3d[_0xb97c('0x1b')][_0xb97c('0x1c')],_0xa53b3d[_0xb97c('0x18')]);}else{_0x387c30[_0xb97c('0x1d')]=_0xa53b3d['password'];}}else{if(_0xa53b3d[_0xb97c('0x1e')]){_0x387c30[_0xb97c('0x18')]=_0xa53b3d[_0xb97c('0x18')];_0x387c30[_0xb97c('0x1d')]=_0xa53b3d[_0xb97c('0x1d')];}}_0x387c30['email']=_0x52dbf0||_0xa53b3d[_0xb97c('0x18')]||_0xb97c('0x1f');_0x387c30[_0xb97c('0x20')]=_0xa53b3d[_0xb97c('0x20')];_0x387c30[_0xb97c('0x21')]=_0xa53b3d[_0xb97c('0x21')]||0x3e1;if(_0xa53b3d['tls']){_0x387c30[_0xb97c('0x22')]=!![];}else{_0x387c30[_0xb97c('0x22')]=![];_0x387c30[_0xb97c('0x23')]=_0xb97c('0x24');}return _0x387c30;};EmailImap['prototype'][_0xb97c('0x25')]=function(){this[_0xb97c('0x1')][_0xb97c('0x26')](this['mailbox'],![],this[_0xb97c('0x27')][_0xb97c('0x28')](this));};EmailImap[_0xb97c('0x29')]['handleOpenBox']=function(_0x19b6e0,_0x24dbb8){if(_0x19b6e0){this[_0xb97c('0x12')](_0x19b6e0,!![]);}else{this['emit'](_0xb97c('0x2a'),_0x24dbb8);this[_0xb97c('0x2b')]();}};EmailImap[_0xb97c('0x29')][_0xb97c('0x2c')]=function(_0x1d9add){if(_0x1d9add){this[_0xb97c('0x12')](_0x1d9add,!![]);}else{this['imap']['end']();}};EmailImap[_0xb97c('0x29')][_0xb97c('0x2b')]=function(){this[_0xb97c('0x1')][_0xb97c('0x2d')]([_0xb97c('0x2e')],this[_0xb97c('0x2f')][_0xb97c('0x28')](this));};EmailImap[_0xb97c('0x29')][_0xb97c('0x2f')]=function(_0x375d2a,_0x3bf3bc){if(_0x375d2a){this[_0xb97c('0x12')](_0x375d2a,!![]);}else{if(_0x3bf3bc[_0xb97c('0x30')]){try{var _0x8135e9=this[_0xb97c('0x1')][_0xb97c('0x31')](_0x3bf3bc,{'bodies':'','markSeen':!![]});_0x8135e9['on']('message',this[_0xb97c('0x32')][_0xb97c('0x28')](this));_0x8135e9['once'](_0xb97c('0x33'),this['handleFetchError'][_0xb97c('0x28')](this));_0x8135e9[_0xb97c('0xe')](_0xb97c('0x10'),this['handleFetchEnd'][_0xb97c('0x28')](this));}catch(_0x468a0a){logger[_0xb97c('0x33')](_0x468a0a);}}else{this[_0xb97c('0x1')][_0xb97c('0x34')](!![],this[_0xb97c('0x2c')]['bind'](this));}}};EmailImap['prototype'][_0xb97c('0x32')]=function(_0x44fa48){_0x44fa48['on']('body',this[_0xb97c('0x35')]['bind'](this));_0x44fa48[_0xb97c('0xe')](_0xb97c('0x36'),this[_0xb97c('0x37')][_0xb97c('0x28')](this));_0x44fa48[_0xb97c('0xe')](_0xb97c('0x10'),this['handleMessageEnd'][_0xb97c('0x28')](this));};EmailImap[_0xb97c('0x29')][_0xb97c('0x35')]=function(_0x133e1a){simpleParser(_0x133e1a,{'Iconv':Iconv},this[_0xb97c('0x38')][_0xb97c('0x28')](this));};EmailImap['prototype'][_0xb97c('0x37')]=function(){};EmailImap[_0xb97c('0x29')][_0xb97c('0x39')]=function(){};EmailImap[_0xb97c('0x29')][_0xb97c('0x38')]=function(_0x5ba2ab,_0x15e7ab){if(_0x5ba2ab){logger[_0xb97c('0x33')](_0x5ba2ab);}else{var _0x4a37fd=this;utils[_0xb97c('0x3a')](this[_0xb97c('0xc')],_0x15e7ab,function(_0x3111d2){_0x4a37fd[_0xb97c('0x3b')](_0xb97c('0xa'),_0x3111d2);});}};EmailImap[_0xb97c('0x29')][_0xb97c('0x3c')]=function(){this[_0xb97c('0x1')][_0xb97c('0x34')](!![],this[_0xb97c('0x2c')][_0xb97c('0x28')](this));};EmailImap['prototype'][_0xb97c('0x3d')]=function(_0x44014a){this[_0xb97c('0x12')](_0x44014a);this['imap'][_0xb97c('0x34')](!![],this[_0xb97c('0x2c')][_0xb97c('0x28')](this));};EmailImap['prototype']['handleEnd']=function(){this[_0xb97c('0x3b')](_0xb97c('0x10'));};EmailImap[_0xb97c('0x29')][_0xb97c('0x12')]=function(_0x27ebd0,_0x10b065){logger[_0xb97c('0x33')](_0xb97c('0x12'),this[_0xb97c('0xc')][_0xb97c('0xa')],JSON[_0xb97c('0x3e')](_0x27ebd0));var _0x42265d='';if(_0x27ebd0){if(_0x27ebd0[_0xb97c('0x3f')]){_0x42265d=_0x27ebd0[_0xb97c('0x3f')];}else{for(var _0x5a21e0 in _0x27ebd0){if(_0x27ebd0[_0xb97c('0x40')](_0x5a21e0)){_0x42265d+=_[_0xb97c('0x41')](_0x5a21e0)+':\x20'+_0x27ebd0[_0x5a21e0]+'\x0a';}}}}if(_0x10b065){this[_0xb97c('0x1')][_0xb97c('0x10')]();}else{this[_0xb97c('0x3b')](_0xb97c('0x33'),_0x42265d);this[_0xb97c('0x3b')]('end');}};module[_0xb97c('0x42')]=EmailImap; \ No newline at end of file +var _0xa7ff=['mailbox','account','getAccount','once','ready','handleEnd','bind','error','handleError','connTimeout','authTimeout','service','user','modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider','data5','password','authentication','anonymous@xcally.com','host','port','tls','autotls','prototype','openBox','handleOpenBox','box','readUnseen','handleCloseBox','end','search','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','handleFetchError','handleFetchEnd','handleMessageAttributes','handleSimpleParser','handleMessageEnd','parser','emit','closeBox','stringify','textCode','exports','lodash','util','imap','mailparser','simpleParser','iconv','Iconv','events','EventEmitter','./utils','email'];(function(_0x1ed116,_0x23bc80){var _0x574066=function(_0x424f9e){while(--_0x424f9e){_0x1ed116['push'](_0x1ed116['shift']());}};_0x574066(++_0x23bc80);}(_0xa7ff,0x1a0));var _0xfa7f=function(_0x576170,_0x1712ae){_0x576170=_0x576170-0x0;var _0x397c70=_0xa7ff[_0x576170];return _0x397c70;};'use strict';var _=require(_0xfa7f('0x0'));var util=require(_0xfa7f('0x1'));var Imap=require(_0xfa7f('0x2'));var simpleParser=require(_0xfa7f('0x3'))[_0xfa7f('0x4')];var Iconv=require(_0xfa7f('0x5'))[_0xfa7f('0x6')];var EventEmitter=require(_0xfa7f('0x7'))[_0xfa7f('0x8')];var utils=require(_0xfa7f('0x9'));var logger=require('../../../config/logger')(_0xfa7f('0xa'));function EmailImap(_0x3a0ded,_0x50963d){this['mailbox']=_0x3a0ded[_0xfa7f('0xb')];this[_0xfa7f('0xc')]=this[_0xfa7f('0xd')](_0x3a0ded,_0x50963d);this[_0xfa7f('0x2')]=new Imap(this[_0xfa7f('0xc')]);this[_0xfa7f('0x2')][_0xfa7f('0xe')](_0xfa7f('0xf'),this['handleReady']['bind'](this));this[_0xfa7f('0x2')]['once']('end',this[_0xfa7f('0x10')][_0xfa7f('0x11')](this));this[_0xfa7f('0x2')]['on'](_0xfa7f('0x12'),this[_0xfa7f('0x13')][_0xfa7f('0x11')](this));this[_0xfa7f('0x2')]['connect']();}util['inherits'](EmailImap,EventEmitter);EmailImap['prototype'][_0xfa7f('0xd')]=function(_0x71b630,_0x5082e1){var _0x38cec8={'connTimeout':_0x71b630[_0xfa7f('0x14')]?_0x71b630[_0xfa7f('0x14')]*0x3e8:0x2710,'authTimeout':_0x71b630[_0xfa7f('0x15')]?_0x71b630[_0xfa7f('0x15')]*0x3e8:0x1388};if(_0x71b630[_0xfa7f('0x16')]){_0x38cec8[_0xfa7f('0x17')]=_0x71b630[_0xfa7f('0x17')];if(_0x71b630[_0xfa7f('0x18')]){_0x38cec8[_0xfa7f('0x19')]=utils[_0xfa7f('0x1a')](_0x71b630[_0xfa7f('0x1b')][_0xfa7f('0x1c')],_0x71b630[_0xfa7f('0x17')]);}else{_0x38cec8[_0xfa7f('0x1d')]=_0x71b630['password'];}}else{if(_0x71b630[_0xfa7f('0x1e')]){_0x38cec8['user']=_0x71b630[_0xfa7f('0x17')];_0x38cec8[_0xfa7f('0x1d')]=_0x71b630[_0xfa7f('0x1d')];}}_0x38cec8[_0xfa7f('0xa')]=_0x5082e1||_0x71b630[_0xfa7f('0x17')]||_0xfa7f('0x1f');_0x38cec8[_0xfa7f('0x20')]=_0x71b630[_0xfa7f('0x20')];_0x38cec8[_0xfa7f('0x21')]=_0x71b630[_0xfa7f('0x21')]||0x3e1;if(_0x71b630['tls']){_0x38cec8[_0xfa7f('0x22')]=!![];}else{_0x38cec8['tls']=![];_0x38cec8[_0xfa7f('0x23')]='required';}return _0x38cec8;};EmailImap[_0xfa7f('0x24')]['handleReady']=function(){this[_0xfa7f('0x2')][_0xfa7f('0x25')](this[_0xfa7f('0xb')],![],this[_0xfa7f('0x26')][_0xfa7f('0x11')](this));};EmailImap[_0xfa7f('0x24')]['handleOpenBox']=function(_0x51d1e4,_0x22b82d){if(_0x51d1e4){this[_0xfa7f('0x13')](_0x51d1e4,!![]);}else{this['emit'](_0xfa7f('0x27'),_0x22b82d);this[_0xfa7f('0x28')]();}};EmailImap[_0xfa7f('0x24')][_0xfa7f('0x29')]=function(_0x4c4b51){if(_0x4c4b51){this['handleError'](_0x4c4b51,!![]);}else{this[_0xfa7f('0x2')][_0xfa7f('0x2a')]();}};EmailImap[_0xfa7f('0x24')][_0xfa7f('0x28')]=function(){this[_0xfa7f('0x2')][_0xfa7f('0x2b')]([_0xfa7f('0x2c')],this[_0xfa7f('0x2d')][_0xfa7f('0x11')](this));};EmailImap[_0xfa7f('0x24')][_0xfa7f('0x2d')]=function(_0x20bcc9,_0x45f87b){if(_0x20bcc9){this['handleError'](_0x20bcc9,!![]);}else{if(_0x45f87b[_0xfa7f('0x2e')]){try{var _0x848cf1=this[_0xfa7f('0x2')][_0xfa7f('0x2f')](_0x45f87b,{'bodies':'','markSeen':!![]});_0x848cf1['on'](_0xfa7f('0x30'),this[_0xfa7f('0x31')][_0xfa7f('0x11')](this));_0x848cf1[_0xfa7f('0xe')](_0xfa7f('0x12'),this[_0xfa7f('0x32')][_0xfa7f('0x11')](this));_0x848cf1[_0xfa7f('0xe')](_0xfa7f('0x2a'),this[_0xfa7f('0x33')]['bind'](this));}catch(_0x2a8a4a){logger[_0xfa7f('0x12')](_0x2a8a4a);}}else{this[_0xfa7f('0x2')]['closeBox'](!![],this['handleCloseBox'][_0xfa7f('0x11')](this));}}};EmailImap[_0xfa7f('0x24')]['handleFetchMessage']=function(_0x4292fb){_0x4292fb['on']('body',this['handleMessageBody'][_0xfa7f('0x11')](this));_0x4292fb[_0xfa7f('0xe')]('attributes',this[_0xfa7f('0x34')]['bind'](this));_0x4292fb[_0xfa7f('0xe')]('end',this['handleMessageEnd'][_0xfa7f('0x11')](this));};EmailImap['prototype']['handleMessageBody']=function(_0x2f768c){simpleParser(_0x2f768c,{'Iconv':Iconv},this[_0xfa7f('0x35')][_0xfa7f('0x11')](this));};EmailImap[_0xfa7f('0x24')][_0xfa7f('0x34')]=function(){};EmailImap['prototype'][_0xfa7f('0x36')]=function(){};EmailImap[_0xfa7f('0x24')][_0xfa7f('0x35')]=function(_0x372f54,_0x3f28ed){if(_0x372f54){logger[_0xfa7f('0x12')](_0x372f54);}else{var _0x55e7c5=this;utils[_0xfa7f('0x37')](this[_0xfa7f('0xc')],_0x3f28ed,function(_0x2f21b9){_0x55e7c5[_0xfa7f('0x38')](_0xfa7f('0xa'),_0x2f21b9);});}};EmailImap[_0xfa7f('0x24')][_0xfa7f('0x33')]=function(){this[_0xfa7f('0x2')][_0xfa7f('0x39')](!![],this[_0xfa7f('0x29')]['bind'](this));};EmailImap[_0xfa7f('0x24')][_0xfa7f('0x32')]=function(_0x43be3b){this[_0xfa7f('0x13')](_0x43be3b);this[_0xfa7f('0x2')]['closeBox'](!![],this[_0xfa7f('0x29')]['bind'](this));};EmailImap[_0xfa7f('0x24')][_0xfa7f('0x10')]=function(){this[_0xfa7f('0x38')](_0xfa7f('0x2a'));};EmailImap[_0xfa7f('0x24')][_0xfa7f('0x13')]=function(_0x58c147,_0x3083c2){logger[_0xfa7f('0x12')](_0xfa7f('0x13'),this[_0xfa7f('0xc')][_0xfa7f('0xa')],JSON[_0xfa7f('0x3a')](_0x58c147));var _0x54c81b='';if(_0x58c147){if(_0x58c147[_0xfa7f('0x3b')]){_0x54c81b=_0x58c147[_0xfa7f('0x3b')];}else{for(var _0x309599 in _0x58c147){if(_0x58c147['hasOwnProperty'](_0x309599)){_0x54c81b+=_['upperFirst'](_0x309599)+':\x20'+_0x58c147[_0x309599]+'\x0a';}}}}if(_0x3083c2){this[_0xfa7f('0x2')][_0xfa7f('0x2a')]();}else{this['emit'](_0xfa7f('0x12'),_0x54c81b);this[_0xfa7f('0x38')]('end');}};module[_0xfa7f('0x3c')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index d256598..be92183 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 _0x27a8=['send','use','compile','sendMail','verify','createTransport','toString','exports','nodemailer-plugin-inline-base64','prototype'];(function(_0x3fe444,_0x44e441){var _0x2c94bc=function(_0x193bcd){while(--_0x193bcd){_0x3fe444['push'](_0x3fe444['shift']());}};_0x2c94bc(++_0x44e441);}(_0x27a8,0xee));var _0x827a=function(_0x1978a4,_0x3c9196){_0x1978a4=_0x1978a4-0x0;var _0x1fcb5f=_0x27a8[_0x1978a4];return _0x1fcb5f;};'use strict';var nodemailer=require('nodemailer');var inlineBase64=require(_0x827a('0x0'));function EmailSmtp(){}EmailSmtp[_0x827a('0x1')][_0x827a('0x2')]=function(_0x50a752,_0x1e25d3){return new Promise(function(_0x3b93fe,_0x552995){var _0x118a32=nodemailer['createTransport'](_0x50a752);_0x118a32[_0x827a('0x3')](_0x827a('0x4'),inlineBase64());_0x118a32[_0x827a('0x5')](_0x1e25d3,function(_0x10c2eb,_0x12e265){if(_0x10c2eb){_0x552995(_0x10c2eb['toString']());}else{_0x3b93fe(_0x12e265);}});});};EmailSmtp[_0x827a('0x1')][_0x827a('0x6')]=function(_0xc722c0){return new Promise(function(_0x441413,_0x170ed3){var _0x15ce4a=nodemailer[_0x827a('0x7')](_0xc722c0);_0x15ce4a['verify'](function(_0x46311d,_0x27ad2e){if(_0x46311d){_0x170ed3(_0x46311d[_0x827a('0x8')]());}else{if(_0x27ad2e){_0x441413(_0x27ad2e);}else{_0x170ed3('Not\x20verifired');}}});});};module[_0x827a('0x9')]=EmailSmtp; \ No newline at end of file +var _0x694e=['exports','nodemailer-plugin-inline-base64','prototype','send','createTransport','compile','sendMail','verify','toString','Not\x20verifired'];(function(_0x485b5a,_0x2b289b){var _0xd2b34d=function(_0x34dcbd){while(--_0x34dcbd){_0x485b5a['push'](_0x485b5a['shift']());}};_0xd2b34d(++_0x2b289b);}(_0x694e,0x15f));var _0xe694=function(_0x19438d,_0x3a2232){_0x19438d=_0x19438d-0x0;var _0x352188=_0x694e[_0x19438d];return _0x352188;};'use strict';var nodemailer=require('nodemailer');var inlineBase64=require(_0xe694('0x0'));function EmailSmtp(){}EmailSmtp[_0xe694('0x1')][_0xe694('0x2')]=function(_0x97c746,_0x248129){return new Promise(function(_0x21d3e8,_0x2a001b){var _0x59d91a=nodemailer[_0xe694('0x3')](_0x97c746);_0x59d91a['use'](_0xe694('0x4'),inlineBase64());_0x59d91a[_0xe694('0x5')](_0x248129,function(_0x2682b6,_0x27419c){if(_0x2682b6){_0x2a001b(_0x2682b6['toString']());}else{_0x21d3e8(_0x27419c);}});});};EmailSmtp['prototype'][_0xe694('0x6')]=function(_0x3b41d5){return new Promise(function(_0xf951d0,_0x5844e4){var _0x37692f=nodemailer['createTransport'](_0x3b41d5);_0x37692f['verify'](function(_0x4e708f,_0x39b504){if(_0x4e708f){_0x5844e4(_0x4e708f[_0xe694('0x7')]());}else{if(_0x39b504){_0xf951d0(_0x39b504);}else{_0x5844e4(_0xe694('0x8'));}}});});};module[_0xe694('0x9')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 6fe2a29..9711026 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 _0x7c9b=['messageId','inReplyTo','textAsHtml','application/ms-tnef','info','first','content','

Empty\x20message

','Attachments','Title','Data','generateXOAuth2Token','auth=Bearer\x20','utf-8','base64','lodash','randomstring','path','util','node-tnef','../../../config/logger','../../../config/environment','head','value','address','generate','name','indexOf','split','length','slice','join','pop','isEmpty','html','test','replace','includes','\x20[Attachment:\x20','\x20]','body','0x1?_0xe33fa3[_0xb7c9('0xf')](0x0,-0x1)[_0xb7c9('0x10')]('\x20'):_0x4c1ab9['name'];}return'Anonymous';}function getLastName(_0x3ba515){var _0x95bc01=_[_0xb7c9('0x7')](_0x3ba515[_0xb7c9('0x8')]);if(_0x95bc01&&_0x95bc01[_0xb7c9('0xb')]){var _0x3f57ee=_0x95bc01[_0xb7c9('0xb')][_0xb7c9('0xd')](/\s+/);return _0x3f57ee[_0xb7c9('0xe')]>0x1?_0x3f57ee[_0xb7c9('0x11')]():'';}return'';}function getMails(_0x587c62,_0x23c6bd){var _0x351484='';for(var _0x592038=0x0;_0x592038<_0x23c6bd[_0xb7c9('0x8')][_0xb7c9('0xe')];_0x592038+=0x1){if(_0x23c6bd[_0xb7c9('0x8')][_0x592038][_0xb7c9('0x9')]!==_0x587c62){if(!_[_0xb7c9('0x12')](_0x351484)){_0x351484+=',';}_0x351484+=_0x23c6bd[_0xb7c9('0x8')][_0x592038][_0xb7c9('0xb')]||_0x23c6bd[_0xb7c9('0x8')][_0x592038]['address']||'';_0x351484+='\x20<';_0x351484+=_0x23c6bd[_0xb7c9('0x8')][_0x592038]['address']?_0x23c6bd[_0xb7c9('0x8')][_0x592038][_0xb7c9('0x9')]:'anonymous'+random[_0xb7c9('0xa')](0x6)+'@xcally.com';_0x351484+='>';}}return _0x351484;}function parseEmail(_0x2582ca,_0x10d536,_0xba5752){if(_0x10d536[_0xb7c9('0x13')]){var _0x1b943d=/)<[^<]*)*<\/script>/gi;while(_0x1b943d[_0xb7c9('0x14')](_0x10d536[_0xb7c9('0x13')])){_0x10d536[_0xb7c9('0x13')]=_0x10d536[_0xb7c9('0x13')][_0xb7c9('0x15')](_0x1b943d,'');}if(_0x10d536[_0xb7c9('0x13')][_0xb7c9('0x16')](_0xb7c9('0x17'))){var _0x2c4a1f=[];_0x10d536[_0xb7c9('0x18')][_0xb7c9('0x19')](_0x4e03d3=>{_0x2c4a1f[_0xb7c9('0x1a')](_0x4e03d3[_0xb7c9('0x1b')]);});var _0x135da7=/]+>/g;var _0x1f6ea0=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x41468c=_0x10d536['html']['replace'](_0x1f6ea0,_0xb7c9('0x1c'));var _0x3d455c=_0x41468c[_0xb7c9('0x15')](_0x135da7,_0xb7c9('0x1d'));for(let _0x5cb22c=0x0;_0x5cb22c<_0x2c4a1f[_0xb7c9('0xe')];_0x5cb22c++){var _0x5d1c26=_0x3d455c[_0xb7c9('0x15')](_0xb7c9('0x1d'),_0xb7c9('0x1e')+_0x2c4a1f[_0x5cb22c]+_0xb7c9('0x1f'));_0x3d455c=_0x5d1c26;}_0x10d536[_0xb7c9('0x13')]=_0x3d455c;}_0xba5752[_0xb7c9('0x20')]=_0x10d536[_0xb7c9('0x13')];}else{_0xba5752['body']=_0x10d536['textAsHtml'];}if(_0xba5752[_0xb7c9('0x20')]){_0xba5752['body']=_0xba5752[_0xb7c9('0x20')]['replace'](/0x0){var _0x2d3e86=[_0xb7c9('0x30'),_0xb7c9('0x31'),_0xb7c9('0x32')];for(var _0xb8c4f5=0x0;_0xb8c4f5<_0x10d536[_0xb7c9('0x2f')][_0xb7c9('0xe')];_0xb8c4f5++){var _0x28e4aa=_[_0xb7c9('0xc')](_0x2d3e86,_0x10d536[_0xb7c9('0x2f')][_0xb8c4f5][_0xb7c9('0x33')]);if(_0x28e4aa>=0x0){_0xba5752['isAutoreply']=!![];}}}return _0xba5752;}exports[_0xb7c9('0x34')]=function(_0x5d64c3,_0x558db1,_0x4f2229){var _0x40d2b5={'from':getAddress(_0x558db1[_0xb7c9('0x35')]),'firstName':getFirstName(_0x558db1['from']),'lastName':getLastName(_0x558db1[_0xb7c9('0x35')]),'mapKey':_0xb7c9('0x25'),'message':{'from':getMails(_0x5d64c3[_0xb7c9('0x25')],_0x558db1[_0xb7c9('0x35')]),'to':_0x5d64c3[_0xb7c9('0x25')],'cc':'','subject':_0x558db1[_0xb7c9('0x36')]||'','messageId':_0x558db1[_0xb7c9('0x37')],'inReplyTo':_0x558db1[_0xb7c9('0x38')],'sentAt':moment(_0x558db1['date'])['format']('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(!_0x558db1[_0xb7c9('0x13')]&&!_0x558db1[_0xb7c9('0x39')]){var _0x102eb8=_['filter'](_0x558db1[_0xb7c9('0x18')],{'contentType':_0xb7c9('0x3a')});if(_0x102eb8[_0xb7c9('0xe')]){logger[_0xb7c9('0x3b')](util[_0xb7c9('0x29')]('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x558db1[_0xb7c9('0x37')]));tnef['parseBuffer'](_[_0xb7c9('0x3c')](_0x102eb8)[_0xb7c9('0x3d')],function(_0x421279,_0x5f4f41){if(_0x5f4f41){_0x558db1[_0xb7c9('0x13')]=_0x5f4f41['BodyHTML']||_0xb7c9('0x3e');if(_0x5f4f41[_0xb7c9('0x3f')]){for(var _0x22d81f=0x0;_0x22d81f<_0x5f4f41['Attachments'][_0xb7c9('0xe')];_0x22d81f++){var _0x55deec=_0x5f4f41[_0xb7c9('0x3f')][_0x22d81f];_0x40d2b5[_0xb7c9('0x22')][_0xb7c9('0x18')][_0xb7c9('0x1a')]({'filename':_0x55deec[_0xb7c9('0x40')],'content':Buffer[_0xb7c9('0x35')](_0x55deec[_0xb7c9('0x41')])});}}}_0x4f2229(parseEmail(_0x5d64c3,_0x558db1,_0x40d2b5));});}else{_0x558db1[_0xb7c9('0x13')]=_0xb7c9('0x3e');_0x4f2229(parseEmail(_0x5d64c3,_0x558db1,_0x40d2b5));}}else{_0x4f2229(parseEmail(_0x5d64c3,_0x558db1,_0x40d2b5));}};exports[_0xb7c9('0x42')]=function(_0x55d0c4,_0x19dfb9){var _0x5037ce=['user='+(_0x19dfb9||''),_0xb7c9('0x43')+_0x55d0c4,'',''];return Buffer[_0xb7c9('0x35')](_0x5037ce['join'](''),_0xb7c9('0x44'))['toString'](_0xb7c9('0x45'));}; \ No newline at end of file +var _0xf7c3=['\x20]','body','textAsHtml','message','originTo','originCc','isEmpty','bcc','attach','attachment','attachment-','now','server/files/attachments/','writeFileSync','content','contentType','headerLines','Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','line','isAutoreply','from','messageId','inReplyTo','date','format','YYYY-MM-DD\x20HH:mm:ss','filter','application/ms-tnef','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','BodyHTML','

Empty\x20message

','Attachments','Title','Data','auth=Bearer\x20','utf-8','lodash','moment','randomstring','util','node-tnef','../../../config/logger','email','head','value','address','anonymous','generate','@xcally.com','name','substring','indexOf','split','length','slice','join','pop','html','replace','includes','\x20[Attachment:\x20'];(function(_0x5e78f6,_0x56d814){var _0x20fe50=function(_0x236bd0){while(--_0x236bd0){_0x5e78f6['push'](_0x5e78f6['shift']());}};_0x20fe50(++_0x56d814);}(_0xf7c3,0x70));var _0x3f7c=function(_0x3ac5fe,_0x4b44af){_0x3ac5fe=_0x3ac5fe-0x0;var _0x1e7151=_0xf7c3[_0x3ac5fe];return _0x1e7151;};'use strict';var _=require(_0x3f7c('0x0'));var moment=require(_0x3f7c('0x1'));var random=require(_0x3f7c('0x2'));var fs=require('fs');var path=require('path');var util=require(_0x3f7c('0x3'));var tnef=require(_0x3f7c('0x4'));var logger=require(_0x3f7c('0x5'))(_0x3f7c('0x6'));var config=require('../../../config/environment');function getAddress(_0x41d4ed){var _0x3a04a9=_[_0x3f7c('0x7')](_0x41d4ed[_0x3f7c('0x8')]);return _0x3a04a9&&_0x3a04a9[_0x3f7c('0x9')]?_0x3a04a9[_0x3f7c('0x9')]:_0x3f7c('0xa')+random[_0x3f7c('0xb')](0x6)+_0x3f7c('0xc');}function getFirstName(_0x22d097){var _0x537725=_[_0x3f7c('0x7')](_0x22d097['value']);if(_0x537725&&_0x537725[_0x3f7c('0xd')]){if(_0x537725[_0x3f7c('0xd')]==_0x537725['address']){return _0x537725[_0x3f7c('0xd')][_0x3f7c('0xe')](0x0,_0x537725[_0x3f7c('0xd')][_0x3f7c('0xf')]('@'));}var _0x240ae7=_0x537725['name'][_0x3f7c('0x10')](/\s+/);return _0x240ae7[_0x3f7c('0x11')]>0x1?_0x240ae7[_0x3f7c('0x12')](0x0,-0x1)[_0x3f7c('0x13')]('\x20'):_0x537725[_0x3f7c('0xd')];}return'Anonymous';}function getLastName(_0x5bd920){var _0x40bc15=_[_0x3f7c('0x7')](_0x5bd920[_0x3f7c('0x8')]);if(_0x40bc15&&_0x40bc15[_0x3f7c('0xd')]){var _0xe58068=_0x40bc15[_0x3f7c('0xd')]['split'](/\s+/);return _0xe58068[_0x3f7c('0x11')]>0x1?_0xe58068[_0x3f7c('0x14')]():'';}return'';}function getMails(_0x339756,_0x21eab9){var _0x2e65b3='';for(var _0x32ab13=0x0;_0x32ab13<_0x21eab9['value'][_0x3f7c('0x11')];_0x32ab13+=0x1){if(_0x21eab9[_0x3f7c('0x8')][_0x32ab13][_0x3f7c('0x9')]!==_0x339756){if(!_['isEmpty'](_0x2e65b3)){_0x2e65b3+=',';}_0x2e65b3+=_0x21eab9['value'][_0x32ab13]['name']||_0x21eab9[_0x3f7c('0x8')][_0x32ab13]['address']||'';_0x2e65b3+='\x20<';_0x2e65b3+=_0x21eab9[_0x3f7c('0x8')][_0x32ab13][_0x3f7c('0x9')]?_0x21eab9[_0x3f7c('0x8')][_0x32ab13][_0x3f7c('0x9')]:'anonymous'+random['generate'](0x6)+_0x3f7c('0xc');_0x2e65b3+='>';}}return _0x2e65b3;}function parseEmail(_0x2d4f1d,_0x48520d,_0x339c9d){if(_0x48520d['html']){var _0x2065cc=/)<[^<]*)*<\/script>/gi;while(_0x2065cc['test'](_0x48520d[_0x3f7c('0x15')])){_0x48520d[_0x3f7c('0x15')]=_0x48520d[_0x3f7c('0x15')][_0x3f7c('0x16')](_0x2065cc,'');}if(_0x48520d[_0x3f7c('0x15')][_0x3f7c('0x17')](_0x3f7c('0x18'))){var _0x3a70c9=[];_0x48520d[_0x3f7c('0x19')][_0x3f7c('0x1a')](_0x34f75d=>{_0x3a70c9[_0x3f7c('0x1b')](_0x34f75d[_0x3f7c('0x1c')]);});var _0x10a842=/]+>/g;var _0x3cce36=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x50354f=_0x48520d[_0x3f7c('0x15')][_0x3f7c('0x16')](_0x3cce36,_0x3f7c('0x1d'));var _0x2b0fd9=_0x50354f['replace'](_0x10a842,_0x3f7c('0x1e'));for(let _0x186778=0x0;_0x186778<_0x3a70c9[_0x3f7c('0x11')];_0x186778++){var _0x5a65de=_0x2b0fd9[_0x3f7c('0x16')](_0x3f7c('0x1e'),_0x3f7c('0x1f')+_0x3a70c9[_0x186778]+_0x3f7c('0x20'));_0x2b0fd9=_0x5a65de;}_0x48520d[_0x3f7c('0x15')]=_0x2b0fd9;}_0x339c9d[_0x3f7c('0x21')]=_0x48520d[_0x3f7c('0x15')];}else{_0x339c9d[_0x3f7c('0x21')]=_0x48520d[_0x3f7c('0x22')];}if(_0x339c9d['body']){_0x339c9d[_0x3f7c('0x21')]=_0x339c9d[_0x3f7c('0x21')][_0x3f7c('0x16')](/0x0){var _0x52ee8a=[_0x3f7c('0x31'),_0x3f7c('0x32'),_0x3f7c('0x33')];for(var _0x2e13a3=0x0;_0x2e13a3<_0x48520d[_0x3f7c('0x30')][_0x3f7c('0x11')];_0x2e13a3++){var _0x2d0251=_[_0x3f7c('0xf')](_0x52ee8a,_0x48520d['headerLines'][_0x2e13a3][_0x3f7c('0x34')]);if(_0x2d0251>=0x0){_0x339c9d[_0x3f7c('0x35')]=!![];}}}return _0x339c9d;}exports['parser']=function(_0xaeb562,_0x4cec53,_0x3e7692){var _0x2333d4={'from':getAddress(_0x4cec53[_0x3f7c('0x36')]),'firstName':getFirstName(_0x4cec53[_0x3f7c('0x36')]),'lastName':getLastName(_0x4cec53[_0x3f7c('0x36')]),'mapKey':'email','message':{'from':getMails(_0xaeb562[_0x3f7c('0x6')],_0x4cec53[_0x3f7c('0x36')]),'to':_0xaeb562['email'],'cc':'','subject':_0x4cec53['subject']||'','messageId':_0x4cec53[_0x3f7c('0x37')],'inReplyTo':_0x4cec53[_0x3f7c('0x38')],'sentAt':moment(_0x4cec53[_0x3f7c('0x39')])[_0x3f7c('0x3a')](_0x3f7c('0x3b')),'attach':![],'attachments':[]}};if(!_0x4cec53[_0x3f7c('0x15')]&&!_0x4cec53[_0x3f7c('0x22')]){var _0x55d37c=_[_0x3f7c('0x3c')](_0x4cec53[_0x3f7c('0x19')],{'contentType':_0x3f7c('0x3d')});if(_0x55d37c[_0x3f7c('0x11')]){logger[_0x3f7c('0x3e')](util[_0x3f7c('0x3a')](_0x3f7c('0x3f'),_0x4cec53[_0x3f7c('0x37')]));tnef[_0x3f7c('0x40')](_['first'](_0x55d37c)[_0x3f7c('0x2e')],function(_0x549c92,_0x246ad9){if(_0x246ad9){_0x4cec53[_0x3f7c('0x15')]=_0x246ad9[_0x3f7c('0x41')]||_0x3f7c('0x42');if(_0x246ad9['Attachments']){for(var _0x428cfb=0x0;_0x428cfb<_0x246ad9['Attachments'][_0x3f7c('0x11')];_0x428cfb++){var _0x558fa6=_0x246ad9[_0x3f7c('0x43')][_0x428cfb];_0x2333d4['message'][_0x3f7c('0x19')]['push']({'filename':_0x558fa6[_0x3f7c('0x44')],'content':Buffer[_0x3f7c('0x36')](_0x558fa6[_0x3f7c('0x45')])});}}}_0x3e7692(parseEmail(_0xaeb562,_0x4cec53,_0x2333d4));});}else{_0x4cec53[_0x3f7c('0x15')]='

Empty\x20message

';_0x3e7692(parseEmail(_0xaeb562,_0x4cec53,_0x2333d4));}}else{_0x3e7692(parseEmail(_0xaeb562,_0x4cec53,_0x2333d4));}};exports['generateXOAuth2Token']=function(_0x741b77,_0x139cc1){var _0x5ba006=['user='+(_0x139cc1||''),_0x3f7c('0x46')+_0x741b77,'',''];return Buffer[_0x3f7c('0x36')](_0x5ba006[_0x3f7c('0x13')](''),_0x3f7c('0x47'))['toString']('base64');}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 257b81d..49cafdc 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 _0xe845=['Imap','Smtp','exports','lodash','name','Service','key','SERV','active'];(function(_0x4bc52a,_0xeb7ab){var _0x1d81eb=function(_0x2c98d0){while(--_0x2c98d0){_0x4bc52a['push'](_0x4bc52a['shift']());}};_0x1d81eb(++_0xeb7ab);}(_0xe845,0x66));var _0x5e84=function(_0x46e2fa,_0x208d37){_0x46e2fa=_0x46e2fa-0x0;var _0x309a92=_0xe845[_0x46e2fa];return _0x309a92;};'use strict';var _=require(_0x5e84('0x0'));function MailAccount(_0x5cf9f7){this['id']=_0x5cf9f7['id']||0x0;this['name']=_0x5cf9f7[_0x5e84('0x1')]||_0x5e84('0x2');this[_0x5e84('0x3')]=_0x5cf9f7[_0x5e84('0x3')]||_0x5e84('0x4');this[_0x5e84('0x5')]=_0x5cf9f7[_0x5e84('0x5')]||![];this[_0x5e84('0x6')]=_0x5cf9f7[_0x5e84('0x6')]||[];this[_0x5e84('0x7')]=_0x5cf9f7[_0x5e84('0x7')]||[];}module[_0x5e84('0x8')]=MailAccount; \ No newline at end of file +var _0x5e0f=['SERV','active','Imap','Smtp','exports','lodash','name','Service','key'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5e0f,0xdd));var _0xf5e0=function(_0x32b56a,_0x5004f6){_0x32b56a=_0x32b56a-0x0;var _0x53078e=_0x5e0f[_0x32b56a];return _0x53078e;};'use strict';var _=require(_0xf5e0('0x0'));function MailAccount(_0x53223e){this['id']=_0x53223e['id']||0x0;this[_0xf5e0('0x1')]=_0x53223e[_0xf5e0('0x1')]||_0xf5e0('0x2');this[_0xf5e0('0x3')]=_0x53223e[_0xf5e0('0x3')]||_0xf5e0('0x4');this[_0xf5e0('0x5')]=_0x53223e[_0xf5e0('0x5')]||![];this[_0xf5e0('0x6')]=_0x53223e[_0xf5e0('0x6')]||[];this[_0xf5e0('0x7')]=_0x53223e[_0xf5e0('0x7')]||[];}module[_0xf5e0('0x8')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index d1be2c4..60d6340 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 _0x5c6e=['merge','exports','../model/mailAccount','mapKeys','hasOwnProperty','prototype','initMailAccounts','mailAccounts','length'];(function(_0x215954,_0x59b51e){var _0x2f8a10=function(_0x5f0033){while(--_0x5f0033){_0x215954['push'](_0x215954['shift']());}};_0x2f8a10(++_0x59b51e);}(_0x5c6e,0xc8));var _0xe5c6=function(_0x5c1345,_0x40116e){_0x5c1345=_0x5c1345-0x0;var _0x1c070d=_0x5c6e[_0x5c1345];return _0x1c070d;};'use strict';var _=require('lodash');var MailAccount=require(_0xe5c6('0x0'));var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x551fa0,_0x259b43,_0x54eaab){var _0x1e9bee=_[_0xe5c6('0x1')](_0x551fa0,function(_0x323c6e,_0x20935d){return _0x323c6e[_0x54eaab];});for(var _0xc33c91 in _0x259b43){if(_0x259b43[_0xe5c6('0x2')](_0xc33c91)){if(!_0x1e9bee[_0xc33c91]){delete _0x259b43[_0xc33c91];}}}}Realtime[_0xe5c6('0x3')]['mergeFromDatabase']=function(_0x5ade0e,_0x5bde10){for(var _0x598bd4 in _0x5bde10){if(_0x5ade0e[_0xe5c6('0x2')](_0x598bd4)){_0x5ade0e[_0x598bd4]=_0x5bde10[_0x598bd4];}}};Realtime[_0xe5c6('0x3')][_0xe5c6('0x4')]=function(){var _0x4afc84=this;return function(_0x4465bc){if(_0x4465bc){freeIsNotKey(_0x4465bc,_0x4afc84[_0xe5c6('0x5')],'id');for(var _0x526c53=0x0,_0x12242c={},_0x4749dd={};_0x526c53<_0x4465bc[_0xe5c6('0x6')];_0x526c53+=0x1){_0x12242c=_0x4465bc[_0x526c53];if(_['isUndefined'](_0x4afc84[_0xe5c6('0x5')][_0x12242c['id']])){_0x4afc84[_0xe5c6('0x5')][_0x12242c['id']]=new MailAccount(_0x12242c);}else{_[_0xe5c6('0x7')](_0x4afc84[_0xe5c6('0x5')][_0x12242c['id']],_0x12242c);}}}return _0x4afc84[_0xe5c6('0x5')];};};module[_0xe5c6('0x8')]=Realtime; \ No newline at end of file +var _0x4f10=['hasOwnProperty','prototype','mergeFromDatabase','initMailAccounts','length','isUndefined','exports','lodash','mailAccounts','mapKeys'];(function(_0x270340,_0x368e68){var _0x6074e8=function(_0x102ba7){while(--_0x102ba7){_0x270340['push'](_0x270340['shift']());}};_0x6074e8(++_0x368e68);}(_0x4f10,0x89));var _0x04f1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4f10[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x04f1('0x0'));var MailAccount=require('../model/mailAccount');var Realtime=function(){this[_0x04f1('0x1')]={};};function freeIsNotKey(_0x11f9e3,_0x3afe3c,_0x2d4968){var _0x464513=_[_0x04f1('0x2')](_0x11f9e3,function(_0x961358,_0x2c7404){return _0x961358[_0x2d4968];});for(var _0x1deae1 in _0x3afe3c){if(_0x3afe3c[_0x04f1('0x3')](_0x1deae1)){if(!_0x464513[_0x1deae1]){delete _0x3afe3c[_0x1deae1];}}}}Realtime[_0x04f1('0x4')][_0x04f1('0x5')]=function(_0x22f6a8,_0x2c5cc5){for(var _0x196b08 in _0x2c5cc5){if(_0x22f6a8[_0x04f1('0x3')](_0x196b08)){_0x22f6a8[_0x196b08]=_0x2c5cc5[_0x196b08];}}};Realtime['prototype'][_0x04f1('0x6')]=function(){var _0x554a9e=this;return function(_0x14fae2){if(_0x14fae2){freeIsNotKey(_0x14fae2,_0x554a9e[_0x04f1('0x1')],'id');for(var _0x307f6b=0x0,_0x1e4fcd={},_0x1f2a08={};_0x307f6b<_0x14fae2[_0x04f1('0x7')];_0x307f6b+=0x1){_0x1e4fcd=_0x14fae2[_0x307f6b];if(_[_0x04f1('0x8')](_0x554a9e[_0x04f1('0x1')][_0x1e4fcd['id']])){_0x554a9e[_0x04f1('0x1')][_0x1e4fcd['id']]=new MailAccount(_0x1e4fcd);}else{_['merge'](_0x554a9e['mailAccounts'][_0x1e4fcd['id']],_0x1e4fcd);}}}return _0x554a9e[_0x04f1('0x1')];};};module[_0x04f1('0x9')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index f91cdcd..0b526e8 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 _0x5084=['notify','NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount','name','provider','service','email','active','key','ListId','TemplateId','MailServerIn','CloudProvider','type','Smtp','data5','getMailAccount'];(function(_0xa7963b,_0x376dc0){var _0x52c918=function(_0x46ba6e){while(--_0x46ba6e){_0xa7963b['push'](_0xa7963b['shift']());}};_0x52c918(++_0x376dc0);}(_0x5084,0xde));var _0x4508=function(_0x80cbd6,_0xedb5a0){_0x80cbd6=_0x80cbd6-0x0;var _0x48672f=_0x5084[_0x80cbd6];return _0x48672f;};'use strict';var client=require(_0x4508('0x0'));exports[_0x4508('0x1')]=function(){return function(){return client[_0x4508('0x2')](_0x4508('0x3'),{'options':{'attributes':['id',_0x4508('0x4'),_0x4508('0x5'),_0x4508('0x6'),_0x4508('0x7'),_0x4508('0x8'),_0x4508('0x9'),_0x4508('0xa'),_0x4508('0xb')],'raw':![],'include':[{'model':_0x4508('0xc'),'as':'Imap','include':[{'model':_0x4508('0xd'),'attributes':['id',_0x4508('0x4'),_0x4508('0x6'),_0x4508('0xe'),'data5'],'as':_0x4508('0xd')}]},{'model':'MailServerOut','as':_0x4508('0xf'),'include':[{'model':_0x4508('0xd'),'attributes':['id',_0x4508('0x4'),'service',_0x4508('0xe'),_0x4508('0x10')],'as':'CloudProvider'}]}]},'log':_0x4508('0x11')});};};exports[_0x4508('0x12')]=function(_0x22afae,_0x63f905){return client[_0x4508('0x2')](_0x4508('0x13'),{'account':{'id':_0x22afae},'body':_0x63f905,'log':_0x4508('0x13')});}; \ No newline at end of file +var _0xea68=['Smtp','getMailAccount','notify','Request','NotifyMailAccount','name','provider','service','email','active','key','ListId','TemplateId','MailServerIn','Imap','type','data5','CloudProvider','MailServerOut'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xea68,0x77));var _0x8ea6=function(_0x513c32,_0x3a04d0){_0x513c32=_0x513c32-0x0;var _0x51a57e=_0xea68[_0x513c32];return _0x51a57e;};'use strict';var client=require('../client');exports['getMailAccounts']=function(){return function(){return client['Request']('GetMailAccount',{'options':{'attributes':['id',_0x8ea6('0x0'),_0x8ea6('0x1'),_0x8ea6('0x2'),_0x8ea6('0x3'),_0x8ea6('0x4'),_0x8ea6('0x5'),_0x8ea6('0x6'),_0x8ea6('0x7')],'raw':![],'include':[{'model':_0x8ea6('0x8'),'as':_0x8ea6('0x9'),'include':[{'model':'CloudProvider','attributes':['id',_0x8ea6('0x0'),_0x8ea6('0x2'),_0x8ea6('0xa'),_0x8ea6('0xb')],'as':_0x8ea6('0xc')}]},{'model':_0x8ea6('0xd'),'as':_0x8ea6('0xe'),'include':[{'model':'CloudProvider','attributes':['id',_0x8ea6('0x0'),_0x8ea6('0x2'),_0x8ea6('0xa'),_0x8ea6('0xb')],'as':'CloudProvider'}]}]},'log':_0x8ea6('0xf')});};};exports[_0x8ea6('0x10')]=function(_0x3acf9a,_0x36ed15){return client[_0x8ea6('0x11')](_0x8ea6('0x12'),{'account':{'id':_0x3acf9a},'body':_0x36ed15,'log':_0x8ea6('0x12')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 9d04829..b8da3c4 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 _0xb883=['loginMailFrequency','GetSettings','../client','ShowSetting'];(function(_0x2102d9,_0x146f55){var _0x4fad49=function(_0x280c33){while(--_0x280c33){_0x2102d9['push'](_0x2102d9['shift']());}};_0x4fad49(++_0x146f55);}(_0xb883,0x146));var _0x3b88=function(_0x4b98ea,_0x48ef21){_0x4b98ea=_0x4b98ea-0x0;var _0x37b2eb=_0xb883[_0x4b98ea];return _0x37b2eb;};'use strict';var client=require(_0x3b88('0x0'));exports['getSettings']=function(){return client['Request'](_0x3b88('0x1'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x3b88('0x2')]},'log':_0x3b88('0x3')});}; \ No newline at end of file +var _0xdc61=['loginMailFrequency','Request','ShowSetting'];(function(_0x474376,_0x385824){var _0x9141b=function(_0x229a9f){while(--_0x229a9f){_0x474376['push'](_0x474376['shift']());}};_0x9141b(++_0x385824);}(_0xdc61,0xfa));var _0x1dc6=function(_0x4b0fde,_0x252672){_0x4b0fde=_0x4b0fde-0x0;var _0x4cf198=_0xdc61[_0x4b0fde];return _0x4cf198;};'use strict';var client=require('../client');exports['getSettings']=function(){return client[_0x1dc6('0x0')](_0x1dc6('0x1'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x1dc6('0x2')]},'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 7806e41..d6a668a 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(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'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 407e286..74043a8 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 _0xbc32=['websocket','polling','defaults','localhost','adapter','redis','../../config/triggers','../../config/express','default','../../routes','once','listening','Express\x20server\x20listening\x20on\x20port\x20%d!','port','exports','lodash','http','express','sticky-session','createServer','timeout','listen','socket.io'];(function(_0x539cd4,_0x2f8931){var _0x2c59b7=function(_0x1e72f7){while(--_0x1e72f7){_0x539cd4['push'](_0x539cd4['shift']());}};_0x2c59b7(++_0x2f8931);}(_0xbc32,0x1c4));var _0x2bc3=function(_0x4052c8,_0x3f776b){_0x4052c8=_0x4052c8-0x0;var _0x1fbe17=_0xbc32[_0x4052c8];return _0x1fbe17;};'use strict';var _=require(_0x2bc3('0x0'));var http=require(_0x2bc3('0x1'));var express=require(_0x2bc3('0x2'));var sticky=require(_0x2bc3('0x3'));var Redis=require('ioredis');var config=require('../../config/environment');var app=express();var server=http[_0x2bc3('0x4')](app);server[_0x2bc3('0x5')]=0xdbba0;if(sticky[_0x2bc3('0x6')](server,config['port'])){var socketio=require(_0x2bc3('0x7'))(server,{'transports':[_0x2bc3('0x8'),_0x2bc3('0x9')]});config['redis']=_[_0x2bc3('0xa')](config['redis'],{'host':_0x2bc3('0xb'),'port':0x18eb});socketio[_0x2bc3('0xc')](require('socket.io-redis')({'pubClient':new Redis(config[_0x2bc3('0xd')]),'subClient':new Redis(config[_0x2bc3('0xd')])}));require(_0x2bc3('0xe'))['default']();require('../../config/socketio')['default'](socketio);require(_0x2bc3('0xf'))[_0x2bc3('0x10')](app);require(_0x2bc3('0x11'))[_0x2bc3('0x10')](app);}else{server[_0x2bc3('0x12')](_0x2bc3('0x13'),function(){console['log'](_0x2bc3('0x14'),config[_0x2bc3('0x15')]);});}exports=module[_0x2bc3('0x16')]=app; \ No newline at end of file +var _0x404c=['listen','port','socket.io','websocket','polling','defaults','localhost','socket.io-redis','redis','../../config/triggers','default','../../config/express','../../routes','once','listening','exports','lodash','http','express','ioredis','../../config/environment','createServer','timeout'];(function(_0x1c81ff,_0x4090d0){var _0x20f592=function(_0x27389b){while(--_0x27389b){_0x1c81ff['push'](_0x1c81ff['shift']());}};_0x20f592(++_0x4090d0);}(_0x404c,0x1c5));var _0xc404=function(_0x2406d7,_0x2b02c2){_0x2406d7=_0x2406d7-0x0;var _0x1cdb50=_0x404c[_0x2406d7];return _0x1cdb50;};'use strict';var _=require(_0xc404('0x0'));var http=require(_0xc404('0x1'));var express=require(_0xc404('0x2'));var sticky=require('sticky-session');var Redis=require(_0xc404('0x3'));var config=require(_0xc404('0x4'));var app=express();var server=http[_0xc404('0x5')](app);server[_0xc404('0x6')]=0xdbba0;if(sticky[_0xc404('0x7')](server,config[_0xc404('0x8')])){var socketio=require(_0xc404('0x9'))(server,{'transports':[_0xc404('0xa'),_0xc404('0xb')]});config['redis']=_[_0xc404('0xc')](config['redis'],{'host':_0xc404('0xd'),'port':0x18eb});socketio['adapter'](require(_0xc404('0xe'))({'pubClient':new Redis(config[_0xc404('0xf')]),'subClient':new Redis(config['redis'])}));require(_0xc404('0x10'))[_0xc404('0x11')]();require('../../config/socketio')[_0xc404('0x11')](socketio);require(_0xc404('0x12'))[_0xc404('0x11')](app);require(_0xc404('0x13'))[_0xc404('0x11')](app);}else{server[_0xc404('0x14')](_0xc404('0x15'),function(){console['log']('Express\x20server\x20listening\x20on\x20port\x20%d!',config[_0xc404('0x8')]);});}exports=module[_0xc404('0x16')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 0f0e70d..073712c 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 _0x0b90=['result','exports','bluebird','../../config/logger','routing','http','Request','request','then','rpc','error','message'];(function(_0x2384ab,_0x5a2094){var _0x2711ae=function(_0x56741f){while(--_0x56741f){_0x2384ab['push'](_0x2384ab['shift']());}};_0x2711ae(++_0x5a2094);}(_0x0b90,0x19a));var _0x00b9=function(_0x1203ca,_0x5934af){_0x1203ca=_0x1203ca-0x0;var _0x177dd3=_0x0b90[_0x1203ca];return _0x177dd3;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x00b9('0x0'));var logger=require(_0x00b9('0x1'))(_0x00b9('0x2'));var client=jayson['client'][_0x00b9('0x3')]({'port':0x2329});client[_0x00b9('0x4')]=function(_0x1dbb45,_0x47416c){return new BPromise(function(_0xd2b9bf,_0x3b0fb7){return client[_0x00b9('0x5')](_0x1dbb45,_0x47416c)[_0x00b9('0x6')](function(_0x40a9a6){logger['debug'](_0x00b9('0x7'),'routing',_0x1dbb45,_0x47416c,_0x40a9a6);if(_0x40a9a6[_0x00b9('0x8')]){logger[_0x00b9('0x8')](_0x00b9('0x7'),'routing',_0x1dbb45,_0x40a9a6[_0x00b9('0x8')][_0x00b9('0x9')],_0x47416c);return _0x3b0fb7(_0x40a9a6[_0x00b9('0x8')][_0x00b9('0x9')]);}else{return _0xd2b9bf(_0x40a9a6[_0x00b9('0xa')]);}})['catch'](function(_0x348492){logger[_0x00b9('0x8')]('rpc',_0x00b9('0x2'),_0x1dbb45,_0x348492,_0x47416c);return _0x3b0fb7(_0x348492);});});};module[_0x00b9('0xb')]=client; \ No newline at end of file +var _0x78e6=['rpc','error','message','result','catch','exports','jayson/promise','bluebird','routing','client','http','Request','request','then'];(function(_0x37c193,_0x4d2ef2){var _0xc3d287=function(_0x3870a7){while(--_0x3870a7){_0x37c193['push'](_0x37c193['shift']());}};_0xc3d287(++_0x4d2ef2);}(_0x78e6,0x11e));var _0x678e=function(_0x40a825,_0x3bac79){_0x40a825=_0x40a825-0x0;var _0x273a54=_0x78e6[_0x40a825];return _0x273a54;};'use strict';var jayson=require(_0x678e('0x0'));var BPromise=require(_0x678e('0x1'));var logger=require('../../config/logger')(_0x678e('0x2'));var client=jayson[_0x678e('0x3')][_0x678e('0x4')]({'port':0x2329});client[_0x678e('0x5')]=function(_0x491da8,_0x860db0){return new BPromise(function(_0xd218bf,_0xd904fc){return client[_0x678e('0x6')](_0x491da8,_0x860db0)[_0x678e('0x7')](function(_0x24991a){logger['debug'](_0x678e('0x8'),_0x678e('0x2'),_0x491da8,_0x860db0,_0x24991a);if(_0x24991a[_0x678e('0x9')]){logger['error'](_0x678e('0x8'),_0x678e('0x2'),_0x491da8,_0x24991a[_0x678e('0x9')][_0x678e('0xa')],_0x860db0);return _0xd904fc(_0x24991a[_0x678e('0x9')]['message']);}else{return _0xd218bf(_0x24991a[_0x678e('0xb')]);}})[_0x678e('0xc')](function(_0x4ee37e){logger[_0x678e('0x9')](_0x678e('0x8'),_0x678e('0x2'),_0x491da8,_0x4ee37e,_0x860db0);return _0xd904fc(_0x4ee37e);});});};module[_0x678e('0xd')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 5bb5ba8..0c816d2 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 _0xd43b=['bluebird','./server','./realtime','./rpc/user','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/faxQueue','./rpc/whatsappQueue','then','getAgents','initAgents','getIntervals','initIntervals','getOpenchannelQueues','getChatQueues','initChatQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','catch','log'];(function(_0x4198ce,_0x3671eb){var _0x1c5b60=function(_0x4ca91a){while(--_0x4ca91a){_0x4198ce['push'](_0x4198ce['shift']());}};_0x1c5b60(++_0x3671eb);}(_0xd43b,0x1f4));var _0xbd43=function(_0x117f20,_0x527821){_0x117f20=_0x117f20-0x0;var _0x465346=_0xd43b[_0x117f20];return _0x465346;};'use strict';var BPromise=require(_0xbd43('0x0'));var server=require(_0xbd43('0x1'));var Realtime=require(_0xbd43('0x2'));var user=require(_0xbd43('0x3'));var interval=require('./rpc/interval');var openchannelQueue=require(_0xbd43('0x4'));var chatQueue=require(_0xbd43('0x5'));var smsQueue=require('./rpc/smsQueue');var mailQueue=require('./rpc/mailQueue');var faxQueue=require(_0xbd43('0x6'));var whatsappQueue=require(_0xbd43('0x7'));var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()[_0xbd43('0x8')](user[_0xbd43('0x9')]())[_0xbd43('0x8')](realtime[_0xbd43('0xa')]())[_0xbd43('0x8')](interval[_0xbd43('0xb')]())[_0xbd43('0x8')](realtime[_0xbd43('0xc')]())[_0xbd43('0x8')](openchannelQueue[_0xbd43('0xd')]())['then'](realtime['initOpenchannelQueues']())[_0xbd43('0x8')](chatQueue[_0xbd43('0xe')]())[_0xbd43('0x8')](realtime[_0xbd43('0xf')]())[_0xbd43('0x8')](smsQueue['getSmsQueues']())[_0xbd43('0x8')](realtime[_0xbd43('0x10')]())[_0xbd43('0x8')](mailQueue[_0xbd43('0x11')]())['then'](realtime[_0xbd43('0x12')]())[_0xbd43('0x8')](faxQueue[_0xbd43('0x13')]())['then'](realtime[_0xbd43('0x14')]())[_0xbd43('0x8')](whatsappQueue[_0xbd43('0x15')]())[_0xbd43('0x8')](realtime[_0xbd43('0x16')]())[_0xbd43('0x8')](function(){return realtime;});}function main(){return server['listen'](realtime)[_0xbd43('0x8')](function(_0x2708c9){return initRealtime();})[_0xbd43('0x8')](function(_0x3de3dd){return setInterval(initRealtime,0x1388);})[_0xbd43('0x17')](function(_0x1cd092){console[_0xbd43('0x18')](_0x1cd092);});}main(); \ No newline at end of file +var _0xe3ba=['./realtime','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/mailQueue','./rpc/faxQueue','resolve','getAgents','then','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','getWhatsappQueues','listen','log','bluebird','./server'];(function(_0x3f563c,_0x29e611){var _0x2ebc3b=function(_0x197902){while(--_0x197902){_0x3f563c['push'](_0x3f563c['shift']());}};_0x2ebc3b(++_0x29e611);}(_0xe3ba,0xa6));var _0xae3b=function(_0x4b6804,_0x301b24){_0x4b6804=_0x4b6804-0x0;var _0x11b4f1=_0xe3ba[_0x4b6804];return _0x11b4f1;};'use strict';var BPromise=require(_0xae3b('0x0'));var server=require(_0xae3b('0x1'));var Realtime=require(_0xae3b('0x2'));var user=require('./rpc/user');var interval=require('./rpc/interval');var openchannelQueue=require(_0xae3b('0x3'));var chatQueue=require(_0xae3b('0x4'));var smsQueue=require('./rpc/smsQueue');var mailQueue=require(_0xae3b('0x5'));var faxQueue=require(_0xae3b('0x6'));var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise[_0xae3b('0x7')]()['then'](user[_0xae3b('0x8')]())[_0xae3b('0x9')](realtime['initAgents']())['then'](interval['getIntervals']())[_0xae3b('0x9')](realtime['initIntervals']())[_0xae3b('0x9')](openchannelQueue[_0xae3b('0xa')]())[_0xae3b('0x9')](realtime[_0xae3b('0xb')]())[_0xae3b('0x9')](chatQueue[_0xae3b('0xc')]())[_0xae3b('0x9')](realtime[_0xae3b('0xd')]())[_0xae3b('0x9')](smsQueue[_0xae3b('0xe')]())[_0xae3b('0x9')](realtime[_0xae3b('0xf')]())['then'](mailQueue[_0xae3b('0x10')]())[_0xae3b('0x9')](realtime[_0xae3b('0x11')]())[_0xae3b('0x9')](faxQueue['getFaxQueues']())[_0xae3b('0x9')](realtime['initFaxQueues']())[_0xae3b('0x9')](whatsappQueue[_0xae3b('0x12')]())['then'](realtime['initWhatsappQueues']())[_0xae3b('0x9')](function(){return realtime;});}function main(){return server[_0xae3b('0x13')](realtime)[_0xae3b('0x9')](function(_0x572092){return initRealtime();})[_0xae3b('0x9')](function(_0x5a595e){return setInterval(initRealtime,0x1388);})['catch'](function(_0x41bd8c){console[_0xae3b('0x14')](_0x41bd8c);});}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 fd79f33..efd301a 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 _0x814b=['init','parse','map','object','lodash','util','events','EventEmitter','isNil','register','ignoreFactChanges','inherits','prototype','rules','isArray','concat','isObject','push','sync','filter','activeRules','orderBy','asc','execute','result','clone','name','ruleRef','call','next','isEqual','nextTick','restart','length','condition','matchPath','noop','findRules','matches','turn','prioritize','priority','toJSON','toString','consequence','fromJSON'];(function(_0x499fa3,_0x5f9a57){var _0x27199c=function(_0x30a609){while(--_0x30a609){_0x499fa3['push'](_0x499fa3['shift']());}};_0x27199c(++_0x5f9a57);}(_0x814b,0x1a2));var _0xb814=function(_0x38f5f8,_0xefe164){_0x38f5f8=_0x38f5f8-0x0;var _0x34e820=_0x814b[_0x38f5f8];return _0x34e820;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var EventEmitter=require(_0xb814('0x2'))[_0xb814('0x3')];function RuleEngine(_0xfbb64b,_0x477725){this['init']();if(!_[_0xb814('0x4')](_0xfbb64b)){this[_0xb814('0x5')](_0xfbb64b);}if(_0x477725){this[_0xb814('0x6')]=_0x477725[_0xb814('0x6')];}return this;}util[_0xb814('0x7')](RuleEngine,EventEmitter);RuleEngine[_0xb814('0x8')]['init']=function(_0x3b0829){this[_0xb814('0x9')]=[];this['activeRules']=[];};RuleEngine[_0xb814('0x8')][_0xb814('0x5')]=function(_0x186d5a){if(Array[_0xb814('0xa')](_0x186d5a)){this[_0xb814('0x9')]=this[_0xb814('0x9')][_0xb814('0xb')](_0x186d5a);}else if(_0x186d5a!==null&&_[_0xb814('0xc')](_0x186d5a)){this[_0xb814('0x9')][_0xb814('0xd')](_0x186d5a);}this[_0xb814('0xe')]();};RuleEngine['prototype'][_0xb814('0xe')]=function(){this['activeRules']=this[_0xb814('0x9')][_0xb814('0xf')](function(_0x35b10d){if(_[_0xb814('0x4')](_0x35b10d['on'])){_0x35b10d['on']=!![];}if(_0x35b10d['on']===!![]){return _0x35b10d;}});this[_0xb814('0x10')]=_[_0xb814('0x11')](this[_0xb814('0x10')],['p'],[_0xb814('0x12')]);};RuleEngine[_0xb814('0x8')][_0xb814('0x13')]=function(_0x3f4881,_0x44fb96){var _0x17f5bd=![];_0x3f4881[_0xb814('0x14')]=!![];var _0x303aca=_[_0xb814('0x15')](_0x3f4881);var _0x45e0d0=_[_0xb814('0x15')](_0x3f4881);var _0x125ce2=this[_0xb814('0x10')];var _0x7a21ef=[];var _0x48c9df=this[_0xb814('0x6')];(function FnRuleLoop(_0x55ba16){var _0x270598={'rules':function(){return _0x125ce2;},'rule':function(){return _0x125ce2[_0x55ba16];},'when':function(_0xfac75b){if(_0xfac75b){var _0x4c3007=_0x125ce2[_0x55ba16]['consequence'];_0x4c3007['ruleRef']=_0x125ce2[_0x55ba16]['id']||_0x125ce2[_0x55ba16][_0xb814('0x16')]||'index_'+_0x55ba16;process['nextTick'](function(){_0x7a21ef[_0xb814('0xd')](_0x4c3007[_0xb814('0x17')]);_0x4c3007[_0xb814('0x18')](_0x303aca,_0x270598);});}else{process['nextTick'](function(){_0x270598[_0xb814('0x19')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x17f5bd=!![];return FnRuleLoop(0x0);},'next':function(_0x531032){if(!_0x48c9df&&!_[_0xb814('0x1a')](_0x45e0d0,_0x303aca)){_0x45e0d0=_[_0xb814('0x15')](_0x303aca);process[_0xb814('0x1b')](function(){_0x270598[_0xb814('0x1c')]();});}else{process[_0xb814('0x1b')](function(){if(_[_0xb814('0x4')](_0x531032)){return FnRuleLoop(_0x55ba16+0x1);}else{return FnRuleLoop(_0x531032);}});}}};if(_0x55ba16<_0x125ce2[_0xb814('0x1d')]&&_0x17f5bd===![]){var _0x594470=_0x125ce2[_0x55ba16][_0xb814('0x1e')];_0x594470['call'](_0x303aca,_0x270598);}else{process[_0xb814('0x1b')](function(){_0x303aca[_0xb814('0x1f')]=_0x7a21ef;return _0x44fb96?_0x44fb96(_0x303aca):_[_0xb814('0x20')]();});}}(0x0));};RuleEngine[_0xb814('0x8')][_0xb814('0x21')]=function(_0xb9e57d){if(_[_0xb814('0x4')](_0xb9e57d)){return this['rules'];}else{var _0x392222=_[_0xb814('0x22')](_0xb9e57d);return _[_0xb814('0xf')](this[_0xb814('0x9')],_0x392222);}};RuleEngine[_0xb814('0x8')][_0xb814('0x23')]=function(_0x3f0150,_0x1e4e89){var _0x5a6291=_0x3f0150==='on'||_0x3f0150==='ON'?!![]:![];var _0x271aa8=this[_0xb814('0x21')](_0x1e4e89);for(var _0x52ed64=0x0,_0x9008b2=_0x271aa8[_0xb814('0x1d')];_0x52ed64<_0x9008b2;_0x52ed64+=0x1){_0x271aa8[_0x52ed64]['on']=_0x5a6291;}this[_0xb814('0xe')]();};RuleEngine['prototype'][_0xb814('0x24')]=function(_0x2051d0,_0x58c3ca){_0x2051d0=parseInt(_0x2051d0,0xa);var _0x338a28=this['findRules'](_0x58c3ca);for(var _0x6efe9a=0x0,_0x5f3e9b=_0x338a28['length'];_0x6efe9a<_0x5f3e9b;_0x6efe9a+=0x1){_0x338a28[_0x6efe9a][_0xb814('0x25')]=_0x2051d0;}this['sync']();};RuleEngine[_0xb814('0x8')][_0xb814('0x26')]=function(){var _0x2b91bd=this['rules'];if(_0x2b91bd instanceof Array){_0x2b91bd=_0x2b91bd['map'](function(_0x26d3a9){_0x26d3a9[_0xb814('0x1e')]=_0x26d3a9['condition'][_0xb814('0x27')]();_0x26d3a9[_0xb814('0x28')]=_0x26d3a9[_0xb814('0x28')][_0xb814('0x27')]();return _0x26d3a9;});}else if(!_[_0xb814('0x4')](_0x2b91bd)){_0x2b91bd[_0xb814('0x1e')]=_0x2b91bd[_0xb814('0x1e')]['toString']();_0x2b91bd[_0xb814('0x28')]=_0x2b91bd[_0xb814('0x28')][_0xb814('0x27')]();}return _0x2b91bd;};RuleEngine[_0xb814('0x8')][_0xb814('0x29')]=function(_0x4ff31a){this[_0xb814('0x2a')]();if(_['isString'](_0x4ff31a)){_0x4ff31a=JSON[_0xb814('0x2b')](_0x4ff31a);}if(_0x4ff31a instanceof Array){_0x4ff31a=_0x4ff31a[_0xb814('0x2c')](function(_0xe0f509){_0xe0f509['condition']=eval('('+_0xe0f509[_0xb814('0x1e')]+')');_0xe0f509[_0xb814('0x28')]=eval('('+_0xe0f509['consequence']+')');return _0xe0f509;});}else if(_0x4ff31a!==null&&typeof _0x4ff31a==_0xb814('0x2d')){_0x4ff31a[_0xb814('0x1e')]=eval('('+_0x4ff31a[_0xb814('0x1e')]+')');_0x4ff31a[_0xb814('0x28')]=eval('('+_0x4ff31a[_0xb814('0x28')]+')');}this[_0xb814('0x5')](_0x4ff31a);};module['exports']=RuleEngine; \ No newline at end of file +var _0x5fc3=['lodash','util','EventEmitter','init','isNil','ignoreFactChanges','inherits','activeRules','prototype','register','isArray','rules','isObject','sync','orderBy','asc','execute','clone','ruleRef','name','index_','push','call','nextTick','next','isEqual','restart','length','condition','matchPath','noop','findRules','filter','prioritize','priority','toJSON','map','consequence','toString','fromJSON','isString','parse'];(function(_0x1501a0,_0x5c7781){var _0xbe9139=function(_0x1ec193){while(--_0x1ec193){_0x1501a0['push'](_0x1501a0['shift']());}};_0xbe9139(++_0x5c7781);}(_0x5fc3,0xa8));var _0x35fc=function(_0x2f4c1c,_0x5a3dd4){_0x2f4c1c=_0x2f4c1c-0x0;var _0x25e0f2=_0x5fc3[_0x2f4c1c];return _0x25e0f2;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var EventEmitter=require('events')[_0x35fc('0x2')];function RuleEngine(_0x2ac6da,_0x196bc2){this[_0x35fc('0x3')]();if(!_[_0x35fc('0x4')](_0x2ac6da)){this['register'](_0x2ac6da);}if(_0x196bc2){this[_0x35fc('0x5')]=_0x196bc2[_0x35fc('0x5')];}return this;}util[_0x35fc('0x6')](RuleEngine,EventEmitter);RuleEngine['prototype']['init']=function(_0x19a0d1){this['rules']=[];this[_0x35fc('0x7')]=[];};RuleEngine[_0x35fc('0x8')][_0x35fc('0x9')]=function(_0x1e5f90){if(Array[_0x35fc('0xa')](_0x1e5f90)){this[_0x35fc('0xb')]=this[_0x35fc('0xb')]['concat'](_0x1e5f90);}else if(_0x1e5f90!==null&&_[_0x35fc('0xc')](_0x1e5f90)){this[_0x35fc('0xb')]['push'](_0x1e5f90);}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')]['sync']=function(){this[_0x35fc('0x7')]=this[_0x35fc('0xb')]['filter'](function(_0x4cbe74){if(_[_0x35fc('0x4')](_0x4cbe74['on'])){_0x4cbe74['on']=!![];}if(_0x4cbe74['on']===!![]){return _0x4cbe74;}});this['activeRules']=_[_0x35fc('0xe')](this[_0x35fc('0x7')],['p'],[_0x35fc('0xf')]);};RuleEngine[_0x35fc('0x8')][_0x35fc('0x10')]=function(_0x5cfe94,_0x59507a){var _0x5eac0f=![];_0x5cfe94['result']=!![];var _0x398b67=_[_0x35fc('0x11')](_0x5cfe94);var _0x53b898=_[_0x35fc('0x11')](_0x5cfe94);var _0x227a49=this[_0x35fc('0x7')];var _0x480851=[];var _0x26ba54=this[_0x35fc('0x5')];(function FnRuleLoop(_0x553677){var _0x41e165={'rules':function(){return _0x227a49;},'rule':function(){return _0x227a49[_0x553677];},'when':function(_0x363e47){if(_0x363e47){var _0x2e513b=_0x227a49[_0x553677]['consequence'];_0x2e513b[_0x35fc('0x12')]=_0x227a49[_0x553677]['id']||_0x227a49[_0x553677][_0x35fc('0x13')]||_0x35fc('0x14')+_0x553677;process['nextTick'](function(){_0x480851[_0x35fc('0x15')](_0x2e513b[_0x35fc('0x12')]);_0x2e513b[_0x35fc('0x16')](_0x398b67,_0x41e165);});}else{process[_0x35fc('0x17')](function(){_0x41e165[_0x35fc('0x18')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x5eac0f=!![];return FnRuleLoop(0x0);},'next':function(_0x21f1a9){if(!_0x26ba54&&!_[_0x35fc('0x19')](_0x53b898,_0x398b67)){_0x53b898=_[_0x35fc('0x11')](_0x398b67);process[_0x35fc('0x17')](function(){_0x41e165[_0x35fc('0x1a')]();});}else{process['nextTick'](function(){if(_[_0x35fc('0x4')](_0x21f1a9)){return FnRuleLoop(_0x553677+0x1);}else{return FnRuleLoop(_0x21f1a9);}});}}};if(_0x553677<_0x227a49[_0x35fc('0x1b')]&&_0x5eac0f===![]){var _0x257719=_0x227a49[_0x553677][_0x35fc('0x1c')];_0x257719[_0x35fc('0x16')](_0x398b67,_0x41e165);}else{process['nextTick'](function(){_0x398b67[_0x35fc('0x1d')]=_0x480851;return _0x59507a?_0x59507a(_0x398b67):_[_0x35fc('0x1e')]();});}}(0x0));};RuleEngine['prototype'][_0x35fc('0x1f')]=function(_0x5a93df){if(_[_0x35fc('0x4')](_0x5a93df)){return this['rules'];}else{var _0x4086e9=_['matches'](_0x5a93df);return _[_0x35fc('0x20')](this[_0x35fc('0xb')],_0x4086e9);}};RuleEngine['prototype']['turn']=function(_0x47774c,_0x58edb6){var _0x274208=_0x47774c==='on'||_0x47774c==='ON'?!![]:![];var _0x1a5d92=this['findRules'](_0x58edb6);for(var _0x26b7cb=0x0,_0x645eac=_0x1a5d92[_0x35fc('0x1b')];_0x26b7cb<_0x645eac;_0x26b7cb+=0x1){_0x1a5d92[_0x26b7cb]['on']=_0x274208;}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')][_0x35fc('0x21')]=function(_0x11ccdb,_0x451f0c){_0x11ccdb=parseInt(_0x11ccdb,0xa);var _0x54aedc=this[_0x35fc('0x1f')](_0x451f0c);for(var _0x220931=0x0,_0x22af18=_0x54aedc['length'];_0x220931<_0x22af18;_0x220931+=0x1){_0x54aedc[_0x220931][_0x35fc('0x22')]=_0x11ccdb;}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')][_0x35fc('0x23')]=function(){var _0xd8a4ca=this[_0x35fc('0xb')];if(_0xd8a4ca instanceof Array){_0xd8a4ca=_0xd8a4ca[_0x35fc('0x24')](function(_0x37b435){_0x37b435[_0x35fc('0x1c')]=_0x37b435[_0x35fc('0x1c')]['toString']();_0x37b435['consequence']=_0x37b435[_0x35fc('0x25')]['toString']();return _0x37b435;});}else if(!_[_0x35fc('0x4')](_0xd8a4ca)){_0xd8a4ca[_0x35fc('0x1c')]=_0xd8a4ca[_0x35fc('0x1c')][_0x35fc('0x26')]();_0xd8a4ca[_0x35fc('0x25')]=_0xd8a4ca[_0x35fc('0x25')]['toString']();}return _0xd8a4ca;};RuleEngine[_0x35fc('0x8')][_0x35fc('0x27')]=function(_0x46b9ef){this[_0x35fc('0x3')]();if(_[_0x35fc('0x28')](_0x46b9ef)){_0x46b9ef=JSON[_0x35fc('0x29')](_0x46b9ef);}if(_0x46b9ef instanceof Array){_0x46b9ef=_0x46b9ef['map'](function(_0x2483be){_0x2483be[_0x35fc('0x1c')]=eval('('+_0x2483be[_0x35fc('0x1c')]+')');_0x2483be['consequence']=eval('('+_0x2483be[_0x35fc('0x25')]+')');return _0x2483be;});}else if(_0x46b9ef!==null&&typeof _0x46b9ef=='object'){_0x46b9ef[_0x35fc('0x1c')]=eval('('+_0x46b9ef[_0x35fc('0x1c')]+')');_0x46b9ef[_0x35fc('0x25')]=eval('('+_0x46b9ef[_0x35fc('0x25')]+')');}this['register'](_0x46b9ef);};module['exports']=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 25c212c..04e15f6 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 _0x3e28=['SendMail','jayson/promise','client','request','then','error','message','result','catch','sendMailMessage'];(function(_0x5cfd35,_0x245a8f){var _0x1e8ab9=function(_0x461520){while(--_0x461520){_0x5cfd35['push'](_0x5cfd35['shift']());}};_0x1e8ab9(++_0x245a8f);}(_0x3e28,0x1a5));var _0x83e2=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0x3e28[_0x2070da];return _0x4f9fe1;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x83e2('0x0'));var client=jayson[_0x83e2('0x1')]['http']({'port':0x232b});function request(_0x3c0baf,_0x1ad04b){return new BPromise(function(_0x336b8f,_0x146ec1){return client[_0x83e2('0x2')](_0x3c0baf,_0x1ad04b)[_0x83e2('0x3')](function(_0x69afcc){if(_0x69afcc['error']){return _0x146ec1(_0x69afcc[_0x83e2('0x4')][_0x83e2('0x5')]);}else{return _0x336b8f(_0x69afcc[_0x83e2('0x6')]);}})[_0x83e2('0x7')](function(_0x2319f9){return _0x146ec1(_0x2319f9);});});}exports[_0x83e2('0x8')]=function(_0x28439f,_0x2ece14){return request(_0x83e2('0x9'),{'account':_0x28439f,'message':_0x2ece14});}; \ No newline at end of file +var _0xd444=['request','then','error','message','jayson/promise','client','http'];(function(_0x2b12dc,_0x35f578){var _0x2f5ef8=function(_0x20919c){while(--_0x20919c){_0x2b12dc['push'](_0x2b12dc['shift']());}};_0x2f5ef8(++_0x35f578);}(_0xd444,0x13f));var _0x4d44=function(_0x197185,_0x251145){_0x197185=_0x197185-0x0;var _0x2c8af1=_0xd444[_0x197185];return _0x2c8af1;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x4d44('0x0'));var client=jayson[_0x4d44('0x1')][_0x4d44('0x2')]({'port':0x232b});function request(_0x881eed,_0x342499){return new BPromise(function(_0x24e379,_0x44a589){return client[_0x4d44('0x3')](_0x881eed,_0x342499)[_0x4d44('0x4')](function(_0x15a2b4){if(_0x15a2b4['error']){return _0x44a589(_0x15a2b4[_0x4d44('0x5')][_0x4d44('0x6')]);}else{return _0x24e379(_0x15a2b4['result']);}})['catch'](function(_0x52c774){return _0x44a589(_0x52c774);});});}exports['sendMailMessage']=function(_0x4bd6c9,_0x344787){return request('SendMail',{'account':_0x4bd6c9,'message':_0x344787});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index a160a76..06a4e97 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 _0xa230=['smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','chatWaitingInteractions','faxWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','updateRealtime','prototype','Capacity','CurrentCapacity','maxcapacity','working','idle','mail','chat','openchannel','fax','sms','length','getChannelStatus','format','chatCurrentCapacity','smsStatusTime','whatsappWaitingInteractions','stringify','emit','exports','lodash','moment','md5','../../../config/environment','redis','defaults','localhost','name','online','voicePause','chatPause','mailPause','faxPause'];(function(_0x149319,_0x27d4e2){var _0x48054a=function(_0x23d553){while(--_0x23d553){_0x149319['push'](_0x149319['shift']());}};_0x48054a(++_0x27d4e2);}(_0xa230,0xb6));var _0x0a23=function(_0x18d8df,_0x183ef0){_0x18d8df=_0x18d8df-0x0;var _0x322056=_0xa230[_0x18d8df];return _0x322056;};'use strict';var _=require(_0x0a23('0x0'));var moment=require(_0x0a23('0x1'));var md5=require(_0x0a23('0x2'));var Redis=require('ioredis');var config=require(_0x0a23('0x3'));config[_0x0a23('0x4')]=_[_0x0a23('0x5')](config['redis'],{'host':_0x0a23('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a23('0x4')]));function Agent(_0x674ef0){this['id']=_0x674ef0['id']||0x0;this[_0x0a23('0x7')]=_0x674ef0['name']||'';this[_0x0a23('0x8')]=_0x674ef0[_0x0a23('0x8')]||!![];this['voicePause']=_0x674ef0[_0x0a23('0x9')]||![];this[_0x0a23('0xa')]=_0x674ef0[_0x0a23('0xa')]||![];this['mailPause']=_0x674ef0[_0x0a23('0xb')]||![];this[_0x0a23('0xc')]=_0x674ef0[_0x0a23('0xc')]||![];this['smsPause']=_0x674ef0[_0x0a23('0xd')]||![];this[_0x0a23('0xe')]=_0x674ef0[_0x0a23('0xe')]||![];this[_0x0a23('0xf')]=_0x0a23('0x10');this[_0x0a23('0x11')]=0x0;this[_0x0a23('0x12')]=_0x674ef0[_0x0a23('0x12')]||0x0;this['chatCurrentCapacity']=0x0;this['mailStatus']='unknown';this[_0x0a23('0x13')]=0x0;this[_0x0a23('0x14')]=_0x674ef0[_0x0a23('0x14')]||0x0;this[_0x0a23('0x15')]=0x0;this[_0x0a23('0x16')]=_0x0a23('0x10');this[_0x0a23('0x17')]=0x0;this[_0x0a23('0x18')]=_0x674ef0['faxCapacity']||0x0;this[_0x0a23('0x19')]=0x0;this[_0x0a23('0x1a')]='unknown';this['smsStatusTime']=0x0;this['smsCapacity']=_0x674ef0[_0x0a23('0x1b')]||0x0;this[_0x0a23('0x1c')]=0x0;this[_0x0a23('0x1d')]=_0x0a23('0x10');this[_0x0a23('0x1e')]=0x0;this['whatsappCapacity']=_0x674ef0[_0x0a23('0x1f')]||0x0;this[_0x0a23('0x20')]=0x0;this[_0x0a23('0x21')]=_0x0a23('0x10');this[_0x0a23('0x22')]=0x0;this['openchannelCapacity']=_0x674ef0[_0x0a23('0x23')]||0x0;this[_0x0a23('0x24')]=0x0;this[_0x0a23('0x25')]=![];this[_0x0a23('0x26')]=undefined;this[_0x0a23('0x2')]='';this[_0x0a23('0x27')]={};this[_0x0a23('0x28')]={};this[_0x0a23('0x29')]={};this[_0x0a23('0x2a')]={};this[_0x0a23('0x2b')]={};this['whatsappWaitingInteractions']={};this[_0x0a23('0x2c')]();}Agent[_0x0a23('0x2d')]['getChannelStatus']=function(_0x3f1be4){if(this[_0x3f1be4+'CurrentCapacity']>0x0){if(this[_0x3f1be4+_0x0a23('0x2e')]>0x0&&this[_0x3f1be4+_0x0a23('0x2f')]>=this[_0x3f1be4+_0x0a23('0x2e')]){return _0x0a23('0x30');}else{return _0x0a23('0x31');}}else{return _0x0a23('0x32');}};Agent['prototype'][_0x0a23('0x2c')]=function(){var _0x4a6ee4=[_0x0a23('0x33'),_0x0a23('0x34'),_0x0a23('0x35'),_0x0a23('0x36'),_0x0a23('0x37'),'whatsapp'];for(var _0x35aec7=0x0;_0x35aec7<_0x4a6ee4[_0x0a23('0x38')];_0x35aec7+=0x1){var _0xa42672=this[_0x0a23('0x39')](_0x4a6ee4[_0x35aec7]);if(this[_0x4a6ee4[_0x35aec7]+'Status']!==_0xa42672){this[_0x4a6ee4[_0x35aec7]+'StatusTime']=_['toNumber'](moment()[_0x0a23('0x3a')]('x'));}this[_0x4a6ee4[_0x35aec7]+'Status']=_0xa42672;}var _0x1c48eb={'id':this['id'],'name':this[_0x0a23('0x7')],'online':this[_0x0a23('0x8')],'voicePause':this[_0x0a23('0x9')],'chatPause':this[_0x0a23('0xa')],'mailPause':this[_0x0a23('0xb')],'smsPause':this[_0x0a23('0xd')],'faxPause':this[_0x0a23('0xc')],'openchannelPause':this[_0x0a23('0xe')],'chatStatus':this[_0x0a23('0xf')],'chatStatusTime':this[_0x0a23('0x11')],'chatCapacity':this[_0x0a23('0x12')],'chatCurrentCapacity':this[_0x0a23('0x3b')],'mailStatus':this['mailStatus'],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0x0a23('0x17')],'faxCapacity':this[_0x0a23('0x18')],'faxCurrentCapacity':this[_0x0a23('0x19')],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0x0a23('0x3c')],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0x0a23('0x1c')],'whatsappStatus':this[_0x0a23('0x1d')],'whatsappStatusTime':this[_0x0a23('0x1e')],'whatsappCapacity':this[_0x0a23('0x1f')],'whatsappCurrentCapacity':this[_0x0a23('0x20')],'openchannelStatus':this[_0x0a23('0x21')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this[_0x0a23('0x23')],'openchannelCurrentCapacity':this[_0x0a23('0x24')],'busy':this[_0x0a23('0x25')],'busyQueue':this[_0x0a23('0x26')],'chatWaitingInteractions':this[_0x0a23('0x27')],'faxWaitingInteractions':this[_0x0a23('0x28')],'mailWaitingInteractions':this[_0x0a23('0x29')],'openchannelWaitingInteractions':this['openchannelWaitingInteractions'],'smsWaitingInteractions':this[_0x0a23('0x2b')],'whatsappWaitingInteractions':this[_0x0a23('0x3d')]};var _0x4fb003=md5(JSON[_0x0a23('0x3e')](_0x1c48eb));if(this[_0x0a23('0x2')]!==_0x4fb003){this['md5']=_0x4fb003;io[_0x0a23('0x3f')]('user:save',_0x1c48eb);}};module[_0x0a23('0x40')]=Agent; \ No newline at end of file +var _0xa74a=['CurrentCapacity','Capacity','maxcapacity','idle','mail','openchannel','fax','sms','whatsapp','length','Status','StatusTime','toNumber','format','openchannelPause','chatStatusTime','chatCurrentCapacity','mailStatus','mailStatusTime','faxStatusTime','smsStatus','busyQueue','stringify','emit','user:save','lodash','moment','md5','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','chatStatus','unknown','chatCapacity','mailCapacity','mailCurrentCapacity','faxStatus','faxCapacity','faxCurrentCapacity','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','chatWaitingInteractions','faxWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','updateRealtime','prototype','getChannelStatus'];(function(_0x87506e,_0x5680ec){var _0x5496a4=function(_0x1e29ab){while(--_0x1e29ab){_0x87506e['push'](_0x87506e['shift']());}};_0x5496a4(++_0x5680ec);}(_0xa74a,0x16d));var _0xaa74=function(_0x329685,_0x21a23c){_0x329685=_0x329685-0x0;var _0x5e4f5a=_0xa74a[_0x329685];return _0x5e4f5a;};'use strict';var _=require(_0xaa74('0x0'));var moment=require(_0xaa74('0x1'));var md5=require(_0xaa74('0x2'));var Redis=require('ioredis');var config=require(_0xaa74('0x3'));config[_0xaa74('0x4')]=_[_0xaa74('0x5')](config[_0xaa74('0x4')],{'host':_0xaa74('0x6'),'port':0x18eb});var io=require(_0xaa74('0x7'))(new Redis(config[_0xaa74('0x4')]));function Agent(_0x257194){this['id']=_0x257194['id']||0x0;this['name']=_0x257194[_0xaa74('0x8')]||'';this[_0xaa74('0x9')]=_0x257194[_0xaa74('0x9')]||!![];this[_0xaa74('0xa')]=_0x257194[_0xaa74('0xa')]||![];this['chatPause']=_0x257194[_0xaa74('0xb')]||![];this[_0xaa74('0xc')]=_0x257194[_0xaa74('0xc')]||![];this[_0xaa74('0xd')]=_0x257194[_0xaa74('0xd')]||![];this[_0xaa74('0xe')]=_0x257194[_0xaa74('0xe')]||![];this['openchannelPause']=_0x257194['openchannelPause']||![];this[_0xaa74('0xf')]=_0xaa74('0x10');this['chatStatusTime']=0x0;this[_0xaa74('0x11')]=_0x257194[_0xaa74('0x11')]||0x0;this['chatCurrentCapacity']=0x0;this['mailStatus']='unknown';this['mailStatusTime']=0x0;this[_0xaa74('0x12')]=_0x257194[_0xaa74('0x12')]||0x0;this[_0xaa74('0x13')]=0x0;this[_0xaa74('0x14')]='unknown';this['faxStatusTime']=0x0;this[_0xaa74('0x15')]=_0x257194['faxCapacity']||0x0;this[_0xaa74('0x16')]=0x0;this['smsStatus']=_0xaa74('0x10');this[_0xaa74('0x17')]=0x0;this[_0xaa74('0x18')]=_0x257194['smsCapacity']||0x0;this[_0xaa74('0x19')]=0x0;this[_0xaa74('0x1a')]='unknown';this['whatsappStatusTime']=0x0;this[_0xaa74('0x1b')]=_0x257194[_0xaa74('0x1b')]||0x0;this[_0xaa74('0x1c')]=0x0;this[_0xaa74('0x1d')]=_0xaa74('0x10');this[_0xaa74('0x1e')]=0x0;this[_0xaa74('0x1f')]=_0x257194[_0xaa74('0x1f')]||0x0;this[_0xaa74('0x20')]=0x0;this[_0xaa74('0x21')]=![];this['busyQueue']=undefined;this[_0xaa74('0x2')]='';this[_0xaa74('0x22')]={};this[_0xaa74('0x23')]={};this[_0xaa74('0x24')]={};this[_0xaa74('0x25')]={};this[_0xaa74('0x26')]={};this[_0xaa74('0x27')]={};this[_0xaa74('0x28')]();}Agent[_0xaa74('0x29')][_0xaa74('0x2a')]=function(_0x529757){if(this[_0x529757+_0xaa74('0x2b')]>0x0){if(this[_0x529757+_0xaa74('0x2c')]>0x0&&this[_0x529757+'CurrentCapacity']>=this[_0x529757+_0xaa74('0x2c')]){return _0xaa74('0x2d');}else{return'working';}}else{return _0xaa74('0x2e');}};Agent[_0xaa74('0x29')]['updateRealtime']=function(){var _0x59cb3a=[_0xaa74('0x2f'),'chat',_0xaa74('0x30'),_0xaa74('0x31'),_0xaa74('0x32'),_0xaa74('0x33')];for(var _0x5717f5=0x0;_0x5717f5<_0x59cb3a[_0xaa74('0x34')];_0x5717f5+=0x1){var _0x3a8357=this[_0xaa74('0x2a')](_0x59cb3a[_0x5717f5]);if(this[_0x59cb3a[_0x5717f5]+_0xaa74('0x35')]!==_0x3a8357){this[_0x59cb3a[_0x5717f5]+_0xaa74('0x36')]=_[_0xaa74('0x37')](moment()[_0xaa74('0x38')]('x'));}this[_0x59cb3a[_0x5717f5]+_0xaa74('0x35')]=_0x3a8357;}var _0x1bcff9={'id':this['id'],'name':this['name'],'online':this['online'],'voicePause':this[_0xaa74('0xa')],'chatPause':this[_0xaa74('0xb')],'mailPause':this['mailPause'],'smsPause':this[_0xaa74('0xe')],'faxPause':this[_0xaa74('0xd')],'openchannelPause':this[_0xaa74('0x39')],'chatStatus':this[_0xaa74('0xf')],'chatStatusTime':this[_0xaa74('0x3a')],'chatCapacity':this[_0xaa74('0x11')],'chatCurrentCapacity':this[_0xaa74('0x3b')],'mailStatus':this[_0xaa74('0x3c')],'mailStatusTime':this[_0xaa74('0x3d')],'mailCapacity':this[_0xaa74('0x12')],'mailCurrentCapacity':this[_0xaa74('0x13')],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0xaa74('0x3e')],'faxCapacity':this[_0xaa74('0x15')],'faxCurrentCapacity':this[_0xaa74('0x16')],'smsStatus':this[_0xaa74('0x3f')],'smsStatusTime':this[_0xaa74('0x17')],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0xaa74('0x19')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this[_0xaa74('0x1b')],'whatsappCurrentCapacity':this[_0xaa74('0x1c')],'openchannelStatus':this[_0xaa74('0x1d')],'openchannelStatusTime':this[_0xaa74('0x1e')],'openchannelCapacity':this[_0xaa74('0x1f')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0xaa74('0x21')],'busyQueue':this[_0xaa74('0x40')],'chatWaitingInteractions':this[_0xaa74('0x22')],'faxWaitingInteractions':this['faxWaitingInteractions'],'mailWaitingInteractions':this[_0xaa74('0x24')],'openchannelWaitingInteractions':this['openchannelWaitingInteractions'],'smsWaitingInteractions':this[_0xaa74('0x26')],'whatsappWaitingInteractions':this[_0xaa74('0x27')]};var _0x24492b=md5(JSON[_0xaa74('0x41')](_0x1bcff9));if(this[_0xaa74('0x2')]!==_0x24492b){this[_0xaa74('0x2')]=_0x24492b;io[_0xaa74('0x42')](_0xaa74('0x43'),_0x1bcff9);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 2251a06..0f42390 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 _0x0ffc=['localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','prototype','updateRouting','map','_rr','loggedIn','paused','online','chatPause','available','stringify','format','chat:queue:%s','emit','chat_queue:save','exports','md5','util','ioredis','redis'];(function(_0x3fbdd2,_0x5db6b8){var _0x2df08b=function(_0x5dbbcb){while(--_0x5dbbcb){_0x3fbdd2['push'](_0x3fbdd2['shift']());}};_0x2df08b(++_0x5db6b8);}(_0x0ffc,0x1a0));var _0xc0ff=function(_0x1e630d,_0x3783a8){_0x1e630d=_0x1e630d-0x0;var _0x15b835=_0x0ffc[_0x1e630d];return _0x15b835;};'use strict';var _=require('lodash');var md5=require(_0xc0ff('0x0'));var util=require(_0xc0ff('0x1'));var Redis=require(_0xc0ff('0x2'));var config=require('../../../config/environment');config[_0xc0ff('0x3')]=_['defaults'](config[_0xc0ff('0x3')],{'host':_0xc0ff('0x4'),'port':0x18eb});var io=require(_0xc0ff('0x5'))(new Redis(config['redis']));function ChatQueue(_0xe5fa69){this['id']=_0xe5fa69['id']||0x0;this[_0xc0ff('0x6')]=_0xe5fa69[_0xc0ff('0x6')]||'';this['timeout']=_0xe5fa69[_0xc0ff('0x7')]||0xa;this[_0xc0ff('0x8')]=_0xe5fa69[_0xc0ff('0x8')]||_0xc0ff('0x9');this['Agents']=_0xe5fa69[_0xc0ff('0xa')];this[_0xc0ff('0xb')]={};this[_0xc0ff('0xc')]=0x0;this[_0xc0ff('0x0')]='';this['updateRouting']();this['updateRealtime']();}ChatQueue[_0xc0ff('0xd')][_0xc0ff('0xe')]=function(){var _0xac1b4f=this[_0xc0ff('0xb')]['_rr'];this['mapAgentsId']=_[_0xc0ff('0xf')](this[_0xc0ff('0xa')],'id');this[_0xc0ff('0xb')][_0xc0ff('0x10')]=_0xac1b4f;};ChatQueue[_0xc0ff('0xd')]['updateRealtime']=function(){this[_0xc0ff('0x11')]=0x0;this[_0xc0ff('0x12')]=0x0;for(var _0x2fb860=0x0;_0x2fb860=0x0?this[_0xc0ff('0x15')]:0x0;var _0x5c4438={'id':this['id'],'available':this['available'],'loggedIn':this[_0xc0ff('0x11')],'name':this[_0xc0ff('0x6')],'paused':this['paused'],'waiting':this['waiting']};var _0x4f0d4b=md5(JSON[_0xc0ff('0x16')](_0x5c4438));if(this['md5']!==_0x4f0d4b){this['md5']=_0x4f0d4b;io['to'](util[_0xc0ff('0x17')](_0xc0ff('0x18'),_0x5c4438['name']))[_0xc0ff('0x19')](_0xc0ff('0x1a'),_0x5c4438);}};module[_0xc0ff('0x1b')]=ChatQueue; \ No newline at end of file +var _0x7eb9=['online','chatPause','available','name','stringify','format','chat:queue:%s','exports','lodash','md5','util','redis','localhost','socket.io-emitter','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','loggedIn','paused','length'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x7eb9,0x19d));var _0x97eb=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7eb9[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x97eb('0x0'));var md5=require(_0x97eb('0x1'));var util=require(_0x97eb('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x97eb('0x3')]=_['defaults'](config[_0x97eb('0x3')],{'host':_0x97eb('0x4'),'port':0x18eb});var io=require(_0x97eb('0x5'))(new Redis(config[_0x97eb('0x3')]));function ChatQueue(_0x6ebf87){this['id']=_0x6ebf87['id']||0x0;this['name']=_0x6ebf87['name']||'';this[_0x97eb('0x6')]=_0x6ebf87['timeout']||0xa;this[_0x97eb('0x7')]=_0x6ebf87[_0x97eb('0x7')]||_0x97eb('0x8');this[_0x97eb('0x9')]=_0x6ebf87['Agents'];this['mapAgentsId']={};this[_0x97eb('0xa')]=0x0;this[_0x97eb('0x1')]='';this[_0x97eb('0xb')]();this[_0x97eb('0xc')]();}ChatQueue[_0x97eb('0xd')][_0x97eb('0xb')]=function(){var _0x419a6e=this[_0x97eb('0xe')]['_rr'];this[_0x97eb('0xe')]=_['map'](this['Agents'],'id');this[_0x97eb('0xe')][_0x97eb('0xf')]=_0x419a6e;};ChatQueue[_0x97eb('0xd')][_0x97eb('0xc')]=function(){this[_0x97eb('0x10')]=0x0;this[_0x97eb('0x11')]=0x0;for(var _0x4003f2=0x0;_0x4003f2=0x0?this[_0x97eb('0x15')]:0x0;var _0x4e869a={'id':this['id'],'available':this['available'],'loggedIn':this[_0x97eb('0x10')],'name':this[_0x97eb('0x16')],'paused':this[_0x97eb('0x11')],'waiting':this['waiting']};var _0x2a76c3=md5(JSON[_0x97eb('0x17')](_0x4e869a));if(this[_0x97eb('0x1')]!==_0x2a76c3){this['md5']=_0x2a76c3;io['to'](util[_0x97eb('0x18')](_0x97eb('0x19'),_0x4e869a[_0x97eb('0x16')]))['emit']('chat_queue:save',_0x4e869a);}};module[_0x97eb('0x1a')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 1a81c6a..cc117e0 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 _0x53f1=['available','name','stringify','format','fax:queue:%s','emit','fax_queue:save','exports','lodash','md5','util','../../../config/environment','redis','defaults','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','online','loggedIn','faxPause','paused'];(function(_0x257577,_0x6b7251){var _0x486d04=function(_0x225149){while(--_0x225149){_0x257577['push'](_0x257577['shift']());}};_0x486d04(++_0x6b7251);}(_0x53f1,0xe8));var _0x153f=function(_0x275ddc,_0x12bb88){_0x275ddc=_0x275ddc-0x0;var _0xfb9d8d=_0x53f1[_0x275ddc];return _0xfb9d8d;};'use strict';var _=require(_0x153f('0x0'));var md5=require(_0x153f('0x1'));var util=require(_0x153f('0x2'));var Redis=require('ioredis');var config=require(_0x153f('0x3'));config[_0x153f('0x4')]=_[_0x153f('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x153f('0x4')]));function FaxQueue(_0x1ee6a6){this['id']=_0x1ee6a6['id']||0x0;this['name']=_0x1ee6a6['name']||'';this[_0x153f('0x6')]=_0x1ee6a6[_0x153f('0x6')]||0xa;this[_0x153f('0x7')]=_0x1ee6a6[_0x153f('0x7')]||'beepall';this['Agents']=_0x1ee6a6[_0x153f('0x8')];this[_0x153f('0x9')]={};this[_0x153f('0xa')]=0x0;this['md5']='';this[_0x153f('0xb')]();this[_0x153f('0xc')]();}FaxQueue[_0x153f('0xd')][_0x153f('0xb')]=function(){var _0x3c688f=this[_0x153f('0x9')][_0x153f('0xe')];this['mapAgentsId']=_[_0x153f('0xf')](this['Agents'],'id');this[_0x153f('0x9')][_0x153f('0xe')]=_0x3c688f;};FaxQueue[_0x153f('0xd')][_0x153f('0xc')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x2e5c22=0x0;_0x2e5c22=0x0?this[_0x153f('0x14')]:0x0;var _0x27df48={'id':this['id'],'available':this['available'],'loggedIn':this[_0x153f('0x11')],'name':this[_0x153f('0x15')],'paused':this[_0x153f('0x13')],'waiting':this[_0x153f('0xa')]};var _0x4d817f=md5(JSON[_0x153f('0x16')](_0x27df48));if(this[_0x153f('0x1')]!==_0x4d817f){this[_0x153f('0x1')]=_0x4d817f;io['to'](util[_0x153f('0x17')](_0x153f('0x18'),_0x27df48[_0x153f('0x15')]))[_0x153f('0x19')](_0x153f('0x1a'),_0x27df48);}};module[_0x153f('0x1b')]=FaxQueue; \ No newline at end of file +var _0x4f59=['paused','length','available','format','fax:queue:%s','emit','fax_queue:save','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','Agents','waiting','updateRealtime','prototype','mapAgentsId','_rr','loggedIn'];(function(_0x21baad,_0xe08137){var _0x326501=function(_0x21182a){while(--_0x21182a){_0x21baad['push'](_0x21baad['shift']());}};_0x326501(++_0xe08137);}(_0x4f59,0x127));var _0x94f5=function(_0xea6018,_0x4cf082){_0xea6018=_0xea6018-0x0;var _0x57b54d=_0x4f59[_0xea6018];return _0x57b54d;};'use strict';var _=require('lodash');var md5=require(_0x94f5('0x0'));var util=require(_0x94f5('0x1'));var Redis=require(_0x94f5('0x2'));var config=require(_0x94f5('0x3'));config[_0x94f5('0x4')]=_['defaults'](config['redis'],{'host':_0x94f5('0x5'),'port':0x18eb});var io=require(_0x94f5('0x6'))(new Redis(config[_0x94f5('0x4')]));function FaxQueue(_0x2ca546){this['id']=_0x2ca546['id']||0x0;this[_0x94f5('0x7')]=_0x2ca546[_0x94f5('0x7')]||'';this[_0x94f5('0x8')]=_0x2ca546['timeout']||0xa;this[_0x94f5('0x9')]=_0x2ca546[_0x94f5('0x9')]||'beepall';this[_0x94f5('0xa')]=_0x2ca546[_0x94f5('0xa')];this['mapAgentsId']={};this[_0x94f5('0xb')]=0x0;this[_0x94f5('0x0')]='';this['updateRouting']();this[_0x94f5('0xc')]();}FaxQueue[_0x94f5('0xd')]['updateRouting']=function(){var _0x2552e3=this[_0x94f5('0xe')][_0x94f5('0xf')];this[_0x94f5('0xe')]=_['map'](this['Agents'],'id');this[_0x94f5('0xe')][_0x94f5('0xf')]=_0x2552e3;};FaxQueue[_0x94f5('0xd')][_0x94f5('0xc')]=function(){this[_0x94f5('0x10')]=0x0;this[_0x94f5('0x11')]=0x0;for(var _0x64b5aa=0x0;_0x64b5aa=0x0?this[_0x94f5('0x13')]:0x0;var _0x4ab2d8={'id':this['id'],'available':this[_0x94f5('0x13')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this[_0x94f5('0xb')]};var _0x1eb502=md5(JSON['stringify'](_0x4ab2d8));if(this[_0x94f5('0x0')]!==_0x1eb502){this[_0x94f5('0x0')]=_0x1eb502;io['to'](util[_0x94f5('0x14')](_0x94f5('0x15'),_0x4ab2d8['name']))[_0x94f5('0x16')](_0x94f5('0x17'),_0x4ab2d8);}};module['exports']=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 1121f73..2f7afdc 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 _0xba5a=['exports','name','Intervals'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0xba5a,0x64));var _0xaba5=function(_0x4f3f71,_0x1e35ce){_0x4f3f71=_0x4f3f71-0x0;var _0x559c25=_0xba5a[_0x4f3f71];return _0x559c25;};'use strict';function Interval(_0x261fb8){this['id']=_0x261fb8['id']||0x0;this['name']=_0x261fb8[_0xaba5('0x0')]||'';this[_0xaba5('0x1')]=_0x261fb8[_0xaba5('0x1')]||{};}module[_0xaba5('0x2')]=Interval; \ No newline at end of file +var _0xb7d4=['Intervals','exports','name'];(function(_0x4e6361,_0x482731){var _0x520f76=function(_0x6c77f0){while(--_0x6c77f0){_0x4e6361['push'](_0x4e6361['shift']());}};_0x520f76(++_0x482731);}(_0xb7d4,0x13a));var _0x4b7d=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xb7d4[_0x413feb];return _0x40ee88;};'use strict';function Interval(_0x5b3553){this['id']=_0x5b3553['id']||0x0;this[_0x4b7d('0x0')]=_0x5b3553['name']||'';this[_0x4b7d('0x1')]=_0x5b3553[_0x4b7d('0x1')]||{};}module[_0x4b7d('0x2')]=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index 56ab808..bdacb41 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 _0xed57=['online','mailPause','available','stringify','format','mail:queue:%s','emit','mail_queue:save','exports','lodash','util','ioredis','redis','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','prototype','_rr','loggedIn','paused'];(function(_0x5538af,_0x10faad){var _0x34bb16=function(_0x1a8924){while(--_0x1a8924){_0x5538af['push'](_0x5538af['shift']());}};_0x34bb16(++_0x10faad);}(_0xed57,0x121));var _0x7ed5=function(_0x123dae,_0x21919d){_0x123dae=_0x123dae-0x0;var _0x3b3a0d=_0xed57[_0x123dae];return _0x3b3a0d;};'use strict';var _=require(_0x7ed5('0x0'));var md5=require('md5');var util=require(_0x7ed5('0x1'));var Redis=require(_0x7ed5('0x2'));var config=require('../../../config/environment');config[_0x7ed5('0x3')]=_['defaults'](config['redis'],{'host':_0x7ed5('0x4'),'port':0x18eb});var io=require(_0x7ed5('0x5'))(new Redis(config['redis']));function MailQueue(_0x4e8563){this['id']=_0x4e8563['id']||0x0;this[_0x7ed5('0x6')]=_0x4e8563[_0x7ed5('0x6')]||'';this[_0x7ed5('0x7')]=_0x4e8563[_0x7ed5('0x7')]||0xa;this[_0x7ed5('0x8')]=_0x4e8563[_0x7ed5('0x8')]||'beepall';this[_0x7ed5('0x9')]=_0x4e8563[_0x7ed5('0x9')];this[_0x7ed5('0xa')]={};this[_0x7ed5('0xb')]=0x0;this[_0x7ed5('0xc')]='';this[_0x7ed5('0xd')]();this[_0x7ed5('0xe')]();}MailQueue[_0x7ed5('0xf')][_0x7ed5('0xd')]=function(){var _0x176318=this[_0x7ed5('0xa')][_0x7ed5('0x10')];this[_0x7ed5('0xa')]=_['map'](this[_0x7ed5('0x9')],'id');this[_0x7ed5('0xa')][_0x7ed5('0x10')]=_0x176318;};MailQueue['prototype'][_0x7ed5('0xe')]=function(){this[_0x7ed5('0x11')]=0x0;this[_0x7ed5('0x12')]=0x0;for(var _0x43feb7=0x0;_0x43feb7=0x0?this['available']:0x0;var _0x108d98={'id':this['id'],'available':this[_0x7ed5('0x15')],'loggedIn':this['loggedIn'],'name':this[_0x7ed5('0x6')],'paused':this['paused'],'waiting':this[_0x7ed5('0xb')]};var _0x510225=md5(JSON[_0x7ed5('0x16')](_0x108d98));if(this[_0x7ed5('0xc')]!==_0x510225){this[_0x7ed5('0xc')]=_0x510225;io['to'](util[_0x7ed5('0x17')](_0x7ed5('0x18'),_0x108d98['name']))[_0x7ed5('0x19')](_0x7ed5('0x1a'),_0x108d98);}};module[_0x7ed5('0x1b')]=MailQueue; \ No newline at end of file +var _0xc78a=['../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','md5','updateRealtime','prototype','updateRouting','mapAgentsId','_rr','map','loggedIn','paused','length','available','format','mail:queue:%s','mail_queue:save','lodash','util','ioredis'];(function(_0x2ceedb,_0x3d4af3){var _0x1eef5c=function(_0xee38c1){while(--_0xee38c1){_0x2ceedb['push'](_0x2ceedb['shift']());}};_0x1eef5c(++_0x3d4af3);}(_0xc78a,0x169));var _0xac78=function(_0x1e896c,_0x3f9948){_0x1e896c=_0x1e896c-0x0;var _0xd149d9=_0xc78a[_0x1e896c];return _0xd149d9;};'use strict';var _=require(_0xac78('0x0'));var md5=require('md5');var util=require(_0xac78('0x1'));var Redis=require(_0xac78('0x2'));var config=require(_0xac78('0x3'));config[_0xac78('0x4')]=_[_0xac78('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xac78('0x6'))(new Redis(config[_0xac78('0x4')]));function MailQueue(_0x4df963){this['id']=_0x4df963['id']||0x0;this[_0xac78('0x7')]=_0x4df963[_0xac78('0x7')]||'';this[_0xac78('0x8')]=_0x4df963[_0xac78('0x8')]||0xa;this[_0xac78('0x9')]=_0x4df963[_0xac78('0x9')]||_0xac78('0xa');this[_0xac78('0xb')]=_0x4df963['Agents'];this['mapAgentsId']={};this['waiting']=0x0;this[_0xac78('0xc')]='';this['updateRouting']();this[_0xac78('0xd')]();}MailQueue[_0xac78('0xe')][_0xac78('0xf')]=function(){var _0x4543a7=this[_0xac78('0x10')][_0xac78('0x11')];this[_0xac78('0x10')]=_[_0xac78('0x12')](this[_0xac78('0xb')],'id');this['mapAgentsId'][_0xac78('0x11')]=_0x4543a7;};MailQueue[_0xac78('0xe')][_0xac78('0xd')]=function(){this[_0xac78('0x13')]=0x0;this[_0xac78('0x14')]=0x0;for(var _0x44ac2a=0x0;_0x44ac2a=0x0?this[_0xac78('0x16')]:0x0;var _0x276824={'id':this['id'],'available':this[_0xac78('0x16')],'loggedIn':this[_0xac78('0x13')],'name':this[_0xac78('0x7')],'paused':this['paused'],'waiting':this['waiting']};var _0x43741e=md5(JSON['stringify'](_0x276824));if(this[_0xac78('0xc')]!==_0x43741e){this['md5']=_0x43741e;io['to'](util[_0xac78('0x17')](_0xac78('0x18'),_0x276824[_0xac78('0x7')]))['emit'](_0xac78('0x19'),_0x276824);}};module['exports']=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 473adaa..3bec5d5 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 _0x1261=['available','stringify','openchannel:queue:%s','openchannel_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','prototype','mapAgentsId','map','_rr','updateRealtime','loggedIn','paused','length','online'];(function(_0x3c4a7c,_0x2f4e3c){var _0xf13d1e=function(_0x24cb78){while(--_0x24cb78){_0x3c4a7c['push'](_0x3c4a7c['shift']());}};_0xf13d1e(++_0x2f4e3c);}(_0x1261,0x144));var _0x1126=function(_0x584b87,_0x3542b8){_0x584b87=_0x584b87-0x0;var _0x3e7b7e=_0x1261[_0x584b87];return _0x3e7b7e;};'use strict';var _=require('lodash');var md5=require(_0x1126('0x0'));var util=require(_0x1126('0x1'));var Redis=require(_0x1126('0x2'));var config=require(_0x1126('0x3'));config[_0x1126('0x4')]=_[_0x1126('0x5')](config[_0x1126('0x4')],{'host':_0x1126('0x6'),'port':0x18eb});var io=require(_0x1126('0x7'))(new Redis(config[_0x1126('0x4')]));function OpenchannelQueue(_0x5a2189){this['id']=_0x5a2189['id']||0x0;this['name']=_0x5a2189[_0x1126('0x8')]||'';this[_0x1126('0x9')]=_0x5a2189['timeout']||0xa;this[_0x1126('0xa')]=_0x5a2189[_0x1126('0xa')]||_0x1126('0xb');this[_0x1126('0xc')]=_0x5a2189[_0x1126('0xc')];this['mapAgentsId']={};this[_0x1126('0xd')]=0x0;this[_0x1126('0x0')]='';this[_0x1126('0xe')]();this['updateRealtime']();}OpenchannelQueue[_0x1126('0xf')]['updateRouting']=function(){var _0x52ef15=this[_0x1126('0x10')]['_rr'];this[_0x1126('0x10')]=_[_0x1126('0x11')](this[_0x1126('0xc')],'id');this[_0x1126('0x10')][_0x1126('0x12')]=_0x52ef15;};OpenchannelQueue[_0x1126('0xf')][_0x1126('0x13')]=function(){this[_0x1126('0x14')]=0x0;this[_0x1126('0x15')]=0x0;for(var _0x53a8f0=0x0;_0x53a8f0=0x0?this['available']:0x0;var _0x4d2b38={'id':this['id'],'available':this[_0x1126('0x18')],'loggedIn':this[_0x1126('0x14')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x1126('0xd')]};var _0x58b109=md5(JSON[_0x1126('0x19')](_0x4d2b38));if(this[_0x1126('0x0')]!==_0x58b109){this[_0x1126('0x0')]=_0x58b109;io['to'](util['format'](_0x1126('0x1a'),_0x4d2b38['name']))['emit'](_0x1126('0x1b'),_0x4d2b38);}};module[_0x1126('0x1c')]=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(_0x40a825,_0x3bac79){var _0x273a54=function(_0x5628d8){while(--_0x5628d8){_0x40a825['push'](_0x40a825['shift']());}};_0x273a54(++_0x3bac79);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0xc4aa[_0x36c5b0];return _0xf19333;};'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 c21cdec..1150cd5 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 _0xb717=['updateRouting','updateRealtime','map','_rr','paused','length','online','smsPause','available','loggedIn','stringify','format','sms:queue:%s','emit','sms_queue:save','exports','lodash','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','md5'];(function(_0x52121d,_0x1d1704){var _0x448627=function(_0x495bf0){while(--_0x495bf0){_0x52121d['push'](_0x52121d['shift']());}};_0x448627(++_0x1d1704);}(_0xb717,0x1b4));var _0x7b71=function(_0x19609f,_0x2cfae5){_0x19609f=_0x19609f-0x0;var _0x552a9c=_0xb717[_0x19609f];return _0x552a9c;};'use strict';var _=require(_0x7b71('0x0'));var md5=require('md5');var util=require(_0x7b71('0x1'));var Redis=require('ioredis');var config=require(_0x7b71('0x2'));config[_0x7b71('0x3')]=_[_0x7b71('0x4')](config['redis'],{'host':_0x7b71('0x5'),'port':0x18eb});var io=require(_0x7b71('0x6'))(new Redis(config[_0x7b71('0x3')]));function SmsQueue(_0x26044f){this['id']=_0x26044f['id']||0x0;this[_0x7b71('0x7')]=_0x26044f['name']||'';this[_0x7b71('0x8')]=_0x26044f[_0x7b71('0x8')]||0xa;this[_0x7b71('0x9')]=_0x26044f[_0x7b71('0x9')]||_0x7b71('0xa');this['Agents']=_0x26044f[_0x7b71('0xb')];this[_0x7b71('0xc')]={};this['waiting']=0x0;this[_0x7b71('0xd')]='';this[_0x7b71('0xe')]();this[_0x7b71('0xf')]();}SmsQueue['prototype'][_0x7b71('0xe')]=function(){var _0x4a39d4=this[_0x7b71('0xc')]['_rr'];this[_0x7b71('0xc')]=_[_0x7b71('0x10')](this[_0x7b71('0xb')],'id');this[_0x7b71('0xc')][_0x7b71('0x11')]=_0x4a39d4;};SmsQueue['prototype'][_0x7b71('0xf')]=function(){this['loggedIn']=0x0;this[_0x7b71('0x12')]=0x0;for(var _0x22114a=0x0;_0x22114a=0x0?this['available']:0x0;var _0x1fd67d={'id':this['id'],'available':this[_0x7b71('0x16')],'loggedIn':this[_0x7b71('0x17')],'name':this[_0x7b71('0x7')],'paused':this[_0x7b71('0x12')],'waiting':this['waiting']};var _0xa1ba78=md5(JSON[_0x7b71('0x18')](_0x1fd67d));if(this[_0x7b71('0xd')]!==_0xa1ba78){this[_0x7b71('0xd')]=_0xa1ba78;io['to'](util[_0x7b71('0x19')](_0x7b71('0x1a'),_0x1fd67d['name']))[_0x7b71('0x1b')](_0x7b71('0x1c'),_0x1fd67d);}};module[_0x7b71('0x1d')]=SmsQueue; \ No newline at end of file +var _0xd52d=['localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','smsPause','available','stringify','sms:queue:%s','sms_queue:save','md5','util','../../../config/environment','redis'];(function(_0xd9a3f2,_0x1e6574){var _0x182fb7=function(_0x1912fa){while(--_0x1912fa){_0xd9a3f2['push'](_0xd9a3f2['shift']());}};_0x182fb7(++_0x1e6574);}(_0xd52d,0x1c7));var _0xdd52=function(_0x5930cb,_0x4f0423){_0x5930cb=_0x5930cb-0x0;var _0x56444c=_0xd52d[_0x5930cb];return _0x56444c;};'use strict';var _=require('lodash');var md5=require(_0xdd52('0x0'));var util=require(_0xdd52('0x1'));var Redis=require('ioredis');var config=require(_0xdd52('0x2'));config['redis']=_['defaults'](config[_0xdd52('0x3')],{'host':_0xdd52('0x4'),'port':0x18eb});var io=require(_0xdd52('0x5'))(new Redis(config[_0xdd52('0x3')]));function SmsQueue(_0x3b9337){this['id']=_0x3b9337['id']||0x0;this[_0xdd52('0x6')]=_0x3b9337[_0xdd52('0x6')]||'';this[_0xdd52('0x7')]=_0x3b9337['timeout']||0xa;this[_0xdd52('0x8')]=_0x3b9337[_0xdd52('0x8')]||_0xdd52('0x9');this[_0xdd52('0xa')]=_0x3b9337[_0xdd52('0xa')];this[_0xdd52('0xb')]={};this[_0xdd52('0xc')]=0x0;this[_0xdd52('0x0')]='';this[_0xdd52('0xd')]();this[_0xdd52('0xe')]();}SmsQueue[_0xdd52('0xf')][_0xdd52('0xd')]=function(){var _0x1cfc7f=this['mapAgentsId'][_0xdd52('0x10')];this[_0xdd52('0xb')]=_[_0xdd52('0x11')](this[_0xdd52('0xa')],'id');this[_0xdd52('0xb')][_0xdd52('0x10')]=_0x1cfc7f;};SmsQueue['prototype'][_0xdd52('0xe')]=function(){this[_0xdd52('0x12')]=0x0;this[_0xdd52('0x13')]=0x0;for(var _0x55b823=0x0;_0x55b823=0x0?this[_0xdd52('0x17')]:0x0;var _0x45062e={'id':this['id'],'available':this['available'],'loggedIn':this[_0xdd52('0x12')],'name':this[_0xdd52('0x6')],'paused':this[_0xdd52('0x13')],'waiting':this[_0xdd52('0xc')]};var _0x5de47a=md5(JSON[_0xdd52('0x18')](_0x45062e));if(this['md5']!==_0x5de47a){this[_0xdd52('0x0')]=_0x5de47a;io['to'](util['format'](_0xdd52('0x19'),_0x45062e[_0xdd52('0x6')]))['emit'](_0xdd52('0x1a'),_0x45062e);}};module['exports']=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index ec3472b..74783f8 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 _0xc0a6=['redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','prototype','_rr','map','updateRealtime','paused','length','loggedIn','whatsappPause','available','waiting','stringify','format','emit','whatsapp_queue:save','lodash','md5','ioredis','../../../config/environment'];(function(_0x4f33bd,_0x507ac9){var _0x34ab1c=function(_0x4bb632){while(--_0x4bb632){_0x4f33bd['push'](_0x4f33bd['shift']());}};_0x34ab1c(++_0x507ac9);}(_0xc0a6,0xc0));var _0x6c0a=function(_0x32c83f,_0x4cb2d6){_0x32c83f=_0x32c83f-0x0;var _0x15e3cd=_0xc0a6[_0x32c83f];return _0x15e3cd;};'use strict';var _=require(_0x6c0a('0x0'));var md5=require(_0x6c0a('0x1'));var util=require('util');var Redis=require(_0x6c0a('0x2'));var config=require(_0x6c0a('0x3'));config[_0x6c0a('0x4')]=_['defaults'](config[_0x6c0a('0x4')],{'host':_0x6c0a('0x5'),'port':0x18eb});var io=require(_0x6c0a('0x6'))(new Redis(config[_0x6c0a('0x4')]));function WhatsappQueue(_0x5a3fea){this['id']=_0x5a3fea['id']||0x0;this[_0x6c0a('0x7')]=_0x5a3fea[_0x6c0a('0x7')]||'';this[_0x6c0a('0x8')]=_0x5a3fea[_0x6c0a('0x8')]||0xa;this[_0x6c0a('0x9')]=_0x5a3fea['strategy']||_0x6c0a('0xa');this[_0x6c0a('0xb')]=_0x5a3fea[_0x6c0a('0xb')];this[_0x6c0a('0xc')]={};this['waiting']=0x0;this[_0x6c0a('0x1')]='';this[_0x6c0a('0xd')]();this['updateRealtime']();}WhatsappQueue[_0x6c0a('0xe')][_0x6c0a('0xd')]=function(){var _0x22a11e=this['mapAgentsId'][_0x6c0a('0xf')];this[_0x6c0a('0xc')]=_[_0x6c0a('0x10')](this['Agents'],'id');this[_0x6c0a('0xc')][_0x6c0a('0xf')]=_0x22a11e;};WhatsappQueue[_0x6c0a('0xe')][_0x6c0a('0x11')]=function(){this['loggedIn']=0x0;this[_0x6c0a('0x12')]=0x0;for(var _0x2006dc=0x0;_0x2006dc=0x0?this['available']:0x0;var _0x3b21ed={'id':this['id'],'available':this['available'],'loggedIn':this[_0x6c0a('0x14')],'name':this[_0x6c0a('0x7')],'paused':this['paused'],'waiting':this[_0x6c0a('0x17')]};var _0x12e882=md5(JSON[_0x6c0a('0x18')](_0x3b21ed));if(this[_0x6c0a('0x1')]!==_0x12e882){this[_0x6c0a('0x1')]=_0x12e882;io['to'](util[_0x6c0a('0x19')]('whatsapp:queue:%s',_0x3b21ed[_0x6c0a('0x7')]))[_0x6c0a('0x1a')](_0x6c0a('0x1b'),_0x3b21ed);}};module['exports']=WhatsappQueue; \ No newline at end of file +var _0xcf8e=['map','_rr','paused','online','loggedIn','whatsappPause','available','stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','Agents','updateRouting','updateRealtime','mapAgentsId'];(function(_0x5065c6,_0x801eaa){var _0x1f2dea=function(_0x4af0af){while(--_0x4af0af){_0x5065c6['push'](_0x5065c6['shift']());}};_0x1f2dea(++_0x801eaa);}(_0xcf8e,0xff));var _0xecf8=function(_0x2c4882,_0x5444ce){_0x2c4882=_0x2c4882-0x0;var _0x52b544=_0xcf8e[_0x2c4882];return _0x52b544;};'use strict';var _=require(_0xecf8('0x0'));var md5=require(_0xecf8('0x1'));var util=require(_0xecf8('0x2'));var Redis=require(_0xecf8('0x3'));var config=require(_0xecf8('0x4'));config[_0xecf8('0x5')]=_[_0xecf8('0x6')](config[_0xecf8('0x5')],{'host':_0xecf8('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xecf8('0x5')]));function WhatsappQueue(_0x3edde1){this['id']=_0x3edde1['id']||0x0;this[_0xecf8('0x8')]=_0x3edde1[_0xecf8('0x8')]||'';this[_0xecf8('0x9')]=_0x3edde1['timeout']||0xa;this[_0xecf8('0xa')]=_0x3edde1[_0xecf8('0xa')]||'beepall';this['Agents']=_0x3edde1[_0xecf8('0xb')];this['mapAgentsId']={};this['waiting']=0x0;this['md5']='';this[_0xecf8('0xc')]();this[_0xecf8('0xd')]();}WhatsappQueue['prototype']['updateRouting']=function(){var _0x28b4bc=this[_0xecf8('0xe')]['_rr'];this[_0xecf8('0xe')]=_[_0xecf8('0xf')](this['Agents'],'id');this['mapAgentsId'][_0xecf8('0x10')]=_0x28b4bc;};WhatsappQueue['prototype'][_0xecf8('0xd')]=function(){this['loggedIn']=0x0;this[_0xecf8('0x11')]=0x0;for(var _0x407441=0x0;_0x407441=0x0?this[_0xecf8('0x15')]:0x0;var _0x5879e4={'id':this['id'],'available':this[_0xecf8('0x15')],'loggedIn':this[_0xecf8('0x13')],'name':this[_0xecf8('0x8')],'paused':this[_0xecf8('0x11')],'waiting':this['waiting']};var _0x14651d=md5(JSON[_0xecf8('0x16')](_0x5879e4));if(this[_0xecf8('0x1')]!==_0x14651d){this[_0xecf8('0x1')]=_0x14651d;io['to'](util[_0xecf8('0x17')](_0xecf8('0x18'),_0x5879e4[_0xecf8('0x8')]))[_0xecf8('0x19')](_0xecf8('0x1a'),_0x5879e4);}};module['exports']=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 4d94b20..3182ac1 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 _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(_0x3f37a7,_0x2dcd3d){var _0x537fe1=function(_0x215694){while(--_0x215694){_0x3f37a7['push'](_0x3f37a7['shift']());}};_0x537fe1(++_0x2dcd3d);}(_0xb10b,0x12a));var _0xbb10=function(_0x3c8832,_0x16e93e){_0x3c8832=_0x3c8832-0x0;var _0xacf303=_0xb10b[_0x3c8832];return _0xacf303;};'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 +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(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 9c45f04..7b5627c 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 _0xf24c=['addTags','Request','AddTagsToChatInteraction','addTagsToChatInteraction','../client','UpdateChatInteraction','updateChatInteraction'];(function(_0x2f387c,_0x3017a6){var _0x3965a5=function(_0x4534f2){while(--_0x4534f2){_0x2f387c['push'](_0x2f387c['shift']());}};_0x3965a5(++_0x3017a6);}(_0xf24c,0xdd));var _0xcf24=function(_0x5bbb21,_0x4d0b03){_0x5bbb21=_0x5bbb21-0x0;var _0x59130c=_0xf24c[_0x5bbb21];return _0x59130c;};'use strict';var client=require(_0xcf24('0x0'));exports['update']=function(_0x33259f,_0x3b70eb){return client['Request'](_0xcf24('0x1'),{'body':_0x3b70eb,'options':{'where':{'id':_0x33259f}},'log':_0xcf24('0x2')});};exports[_0xcf24('0x3')]=function(_0x2cbbd3,_0x2ac453){return client[_0xcf24('0x4')](_0xcf24('0x5'),{'body':_0x2ac453,'options':{'where':{'id':_0x2cbbd3}},'log':_0xcf24('0x6')});}; \ No newline at end of file +var _0x2453=['../client','update','Request','updateChatInteraction','addTags','AddTagsToChatInteraction','addTagsToChatInteraction'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x2453,0x16c));var _0x3245=function(_0x4ad857,_0x72116){_0x4ad857=_0x4ad857-0x0;var _0x2bf535=_0x2453[_0x4ad857];return _0x2bf535;};'use strict';var client=require(_0x3245('0x0'));exports[_0x3245('0x1')]=function(_0x13f558,_0x22d213){return client[_0x3245('0x2')]('UpdateChatInteraction',{'body':_0x22d213,'options':{'where':{'id':_0x13f558}},'log':_0x3245('0x3')});};exports[_0x3245('0x4')]=function(_0xe6b66c,_0x3034cc){return client[_0x3245('0x2')](_0x3245('0x5'),{'body':_0x3034cc,'options':{'where':{'id':_0xe6b66c}},'log':_0x3245('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 56c10d3..609a1a3 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 _0xd05a=['create','CreateChatMessage','createChatMessage','../client'];(function(_0x2984d0,_0x1a7211){var _0x2885f2=function(_0x42f3da){while(--_0x42f3da){_0x2984d0['push'](_0x2984d0['shift']());}};_0x2885f2(++_0x1a7211);}(_0xd05a,0x1af));var _0xad05=function(_0x24fad8,_0xc24b2c){_0x24fad8=_0x24fad8-0x0;var _0x3f340d=_0xd05a[_0x24fad8];return _0x3f340d;};'use strict';var client=require(_0xad05('0x0'));exports[_0xad05('0x1')]=function(_0x4dbde4){return client['Request'](_0xad05('0x2'),{'body':_0x4dbde4,'log':_0xad05('0x3')});}; \ No newline at end of file +var _0xc634=['create','CreateChatMessage','createChatMessage','../client'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0xc634,0x173));var _0x4c63=function(_0x303401,_0xb09078){_0x303401=_0x303401-0x0;var _0x3a753d=_0xc634[_0x303401];return _0x3a753d;};'use strict';var client=require(_0x4c63('0x0'));exports[_0x4c63('0x1')]=function(_0xd36461){return client['Request'](_0x4c63('0x2'),{'body':_0xd36461,'log':_0x4c63('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 3596f31..6eee4e9 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 _0x45d1=['Agents','online','chatPause','../client','getChatQueues','GetChatQueue','name','strategy'];(function(_0x630d2f,_0x3a2481){var _0x1c4c48=function(_0x59c926){while(--_0x59c926){_0x630d2f['push'](_0x630d2f['shift']());}};_0x1c4c48(++_0x3a2481);}(_0x45d1,0x1cb));var _0x145d=function(_0x786e9,_0x1a029){_0x786e9=_0x786e9-0x0;var _0x1f891b=_0x45d1[_0x786e9];return _0x1f891b;};'use strict';var client=require(_0x145d('0x0'));exports[_0x145d('0x1')]=function(){return function(){return client['Request'](_0x145d('0x2'),{'options':{'raw':![],'attributes':['id',_0x145d('0x3'),'timeout',_0x145d('0x4')],'include':[{'model':'User','as':_0x145d('0x5'),'attributes':['id',_0x145d('0x3'),_0x145d('0x6'),_0x145d('0x7')]}]},'log':_0x145d('0x1')});};}; \ No newline at end of file +var _0x0f3c=['strategy','User','Agents','name','online','chatPause','../client','getChatQueues','timeout'];(function(_0xa002f7,_0x18fdf5){var _0x23ad9f=function(_0x55a9e8){while(--_0x55a9e8){_0xa002f7['push'](_0xa002f7['shift']());}};_0x23ad9f(++_0x18fdf5);}(_0x0f3c,0x189));var _0xc0f3=function(_0x316f57,_0x53b7c9){_0x316f57=_0x316f57-0x0;var _0x5324b6=_0x0f3c[_0x316f57];return _0x5324b6;};'use strict';var client=require(_0xc0f3('0x0'));exports[_0xc0f3('0x1')]=function(){return function(){return client['Request']('GetChatQueue',{'options':{'raw':![],'attributes':['id','name',_0xc0f3('0x2'),_0xc0f3('0x3')],'include':[{'model':_0xc0f3('0x4'),'as':_0xc0f3('0x5'),'attributes':['id',_0xc0f3('0x6'),_0xc0f3('0x7'),_0xc0f3('0x8')]}]},'log':_0xc0f3('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 82a44b9..f088779 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 _0xd58c=['../client','create','CreateChatQueueReport','update','Request','UpdateChatQueueReport','DESC'];(function(_0x5528c3,_0x35a416){var _0x47ec1b=function(_0x54a18e){while(--_0x54a18e){_0x5528c3['push'](_0x5528c3['shift']());}};_0x47ec1b(++_0x35a416);}(_0xd58c,0xb6));var _0xcd58=function(_0x1b9fc4,_0x35147a){_0x1b9fc4=_0x1b9fc4-0x0;var _0x264a89=_0xd58c[_0x1b9fc4];return _0x264a89;};'use strict';var client=require(_0xcd58('0x0'));exports[_0xcd58('0x1')]=function(_0x240323){return client['Request'](_0xcd58('0x2'),{'body':_0x240323,'log':'CreateChatQueueReport'});};exports[_0xcd58('0x3')]=function(_0x4be7d0,_0xe6c68){return client[_0xcd58('0x4')](_0xcd58('0x5'),{'body':_0xe6c68,'options':{'where':{'uniqueid':_0x4be7d0},'order':[['id',_0xcd58('0x6')]],'limit':0x1},'log':_0xcd58('0x5')});}; \ No newline at end of file +var _0x4f88=['CreateChatQueueReport','UpdateChatQueueReport','DESC','../client','create','Request'];(function(_0x49dd84,_0x34babe){var _0x1d0d00=function(_0x49d9b1){while(--_0x49d9b1){_0x49dd84['push'](_0x49dd84['shift']());}};_0x1d0d00(++_0x34babe);}(_0x4f88,0xf3));var _0x84f8=function(_0xf2628e,_0x521bf7){_0xf2628e=_0xf2628e-0x0;var _0x13863a=_0x4f88[_0xf2628e];return _0x13863a;};'use strict';var client=require(_0x84f8('0x0'));exports[_0x84f8('0x1')]=function(_0x5b8988){return client[_0x84f8('0x2')](_0x84f8('0x3'),{'body':_0x5b8988,'log':_0x84f8('0x3')});};exports['update']=function(_0x5c24f1,_0xef8394){return client[_0x84f8('0x2')](_0x84f8('0x4'),{'body':_0xef8394,'options':{'where':{'uniqueid':_0x5c24f1},'order':[['id',_0x84f8('0x5')]],'limit':0x1},'log':_0x84f8('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 140a2c5..cd1b60e 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x5d1f2f,_0x562de1){var _0x4029a2=function(_0x5a51f2){while(--_0x5a51f2){_0x5d1f2f['push'](_0x5d1f2f['shift']());}};_0x4029a2(++_0x562de1);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file +var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x43778d,_0xbb03c7){var _0x56605e=function(_0x4a94db){while(--_0x4a94db){_0x43778d['push'](_0x43778d['shift']());}};_0x56605e(++_0xbb03c7);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 2bbfb3e..d6a8de5 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 _0xe196=['Request','../client','create'];(function(_0x2070e9,_0x9f34ea){var _0x153b5d=function(_0x2ece59){while(--_0x2ece59){_0x2070e9['push'](_0x2070e9['shift']());}};_0x153b5d(++_0x9f34ea);}(_0xe196,0x13f));var _0x6e19=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe196[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0x6e19('0x0'));exports[_0x6e19('0x1')]=function(_0x437b4e){return client[_0x6e19('0x2')]('CreateFaxMessage',{'body':_0x437b4e,'log':'createFaxMessage'});}; \ No newline at end of file +var _0xf4da=['../client','Request','CreateFaxMessage','createFaxMessage'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xf4da,0x184));var _0xaf4d=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xf4da[_0x1ddedd];return _0xa3e1ac;};'use strict';var client=require(_0xaf4d('0x0'));exports['create']=function(_0x588221){return client[_0xaf4d('0x1')](_0xaf4d('0x2'),{'body':_0x588221,'log':_0xaf4d('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 80a103e..36ef02f 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 _0xe989=['Agents','online','faxPause','../client','getFaxQueues','GetFaxQueue','name','timeout','strategy','User'];(function(_0x46ad10,_0x55f736){var _0x3ff9ea=function(_0x3e347a){while(--_0x3e347a){_0x46ad10['push'](_0x46ad10['shift']());}};_0x3ff9ea(++_0x55f736);}(_0xe989,0x1ed));var _0x9e98=function(_0x1a0daa,_0x2a4634){_0x1a0daa=_0x1a0daa-0x0;var _0x1dbe15=_0xe989[_0x1a0daa];return _0x1dbe15;};'use strict';var client=require(_0x9e98('0x0'));exports[_0x9e98('0x1')]=function(){return function(){return client['Request'](_0x9e98('0x2'),{'options':{'raw':![],'attributes':['id',_0x9e98('0x3'),_0x9e98('0x4'),_0x9e98('0x5')],'include':[{'model':_0x9e98('0x6'),'as':_0x9e98('0x7'),'attributes':['id','name',_0x9e98('0x8'),_0x9e98('0x9')]}]},'log':'getFaxQueues'});};}; \ No newline at end of file +var _0xba48=['getFaxQueues','Request','strategy','User','Agents','name','faxPause'];(function(_0x158268,_0x4008bd){var _0x5928dd=function(_0x1ab5af){while(--_0x1ab5af){_0x158268['push'](_0x158268['shift']());}};_0x5928dd(++_0x4008bd);}(_0xba48,0x18f));var _0x8ba4=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xba48[_0x4243a3];return _0x1b2a33;};'use strict';var client=require('../client');exports[_0x8ba4('0x0')]=function(){return function(){return client[_0x8ba4('0x1')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id','name','timeout',_0x8ba4('0x2')],'include':[{'model':_0x8ba4('0x3'),'as':_0x8ba4('0x4'),'attributes':['id',_0x8ba4('0x5'),'online',_0x8ba4('0x6')]}]},'log':_0x8ba4('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 5b94d03..de2cd9e 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 _0x03a8=['Request','CreateFaxQueueReport','update','DESC','UpdateFaxQueueReport','../client','create'];(function(_0x484c4a,_0x473d1e){var _0x3dcbd5=function(_0x489140){while(--_0x489140){_0x484c4a['push'](_0x484c4a['shift']());}};_0x3dcbd5(++_0x473d1e);}(_0x03a8,0x15c));var _0x803a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x03a8[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x803a('0x0'));exports[_0x803a('0x1')]=function(_0x52202f){return client[_0x803a('0x2')](_0x803a('0x3'),{'body':_0x52202f,'log':_0x803a('0x3')});};exports[_0x803a('0x4')]=function(_0x3277ec,_0x1e8e50){return client['Request']('UpdateFaxQueueReport',{'body':_0x1e8e50,'options':{'where':{'uniqueid':_0x3277ec},'order':[['id',_0x803a('0x5')]],'limit':0x1},'log':_0x803a('0x6')});}; \ No newline at end of file +var _0x8ade=['Request','CreateFaxQueueReport','UpdateFaxQueueReport','DESC','create'];(function(_0x1668b5,_0x2d626e){var _0x474443=function(_0x3c03f7){while(--_0x3c03f7){_0x1668b5['push'](_0x1668b5['shift']());}};_0x474443(++_0x2d626e);}(_0x8ade,0x1a8));var _0xe8ad=function(_0x9bf63b,_0x495057){_0x9bf63b=_0x9bf63b-0x0;var _0x3baffc=_0x8ade[_0x9bf63b];return _0x3baffc;};'use strict';var client=require('../client');exports[_0xe8ad('0x0')]=function(_0xa09f8c){return client[_0xe8ad('0x1')](_0xe8ad('0x2'),{'body':_0xa09f8c,'log':_0xe8ad('0x2')});};exports['update']=function(_0x1ae598,_0x43bced){return client[_0xe8ad('0x1')](_0xe8ad('0x3'),{'body':_0x43bced,'options':{'where':{'uniqueid':_0x1ae598},'order':[['id',_0xe8ad('0x4')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index b107fa9..42ff5f1 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 _0xec8c=['Intervals','getIntervals','Request','name','Interval'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0xec8c,0x115));var _0xcec8=function(_0x16cf22,_0x504218){_0x16cf22=_0x16cf22-0x0;var _0x113c09=_0xec8c[_0x16cf22];return _0x113c09;};'use strict';var client=require('../client');exports['getIntervals']=function(){return function(){return client[_0xcec8('0x0')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xcec8('0x1')],'include':[{'model':_0xcec8('0x2'),'as':_0xcec8('0x3'),'attributes':['id','name','interval']}]},'log':_0xcec8('0x4')});};}; \ No newline at end of file +var _0xf257=['Intervals','interval','getIntervals','name'];(function(_0x4027fb,_0x20e4ea){var _0x15e88d=function(_0x24b73f){while(--_0x24b73f){_0x4027fb['push'](_0x4027fb['shift']());}};_0x15e88d(++_0x20e4ea);}(_0xf257,0xd2));var _0x7f25=function(_0x36b611,_0x1e42e7){_0x36b611=_0x36b611-0x0;var _0x2d6dd8=_0xf257[_0x36b611];return _0x2d6dd8;};'use strict';var client=require('../client');exports[_0x7f25('0x0')]=function(){return function(){return client['Request']('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x7f25('0x1')],'include':[{'model':'Interval','as':_0x7f25('0x2'),'attributes':['id','name',_0x7f25('0x3')]}]},'log':'getIntervals'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index b3bd837..83070e0 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 _0xc2c7=['update','Request','UpdateMailInteraction','updateMailInteraction','addTags','AddTagsToMailInteraction','addTagsToChatInteraction'];(function(_0x3110d7,_0x1a9b39){var _0x21c07a=function(_0x59d4f6){while(--_0x59d4f6){_0x3110d7['push'](_0x3110d7['shift']());}};_0x21c07a(++_0x1a9b39);}(_0xc2c7,0x134));var _0x7c2c=function(_0x3de78e,_0x499c81){_0x3de78e=_0x3de78e-0x0;var _0x32c8a3=_0xc2c7[_0x3de78e];return _0x32c8a3;};'use strict';var client=require('../client');exports[_0x7c2c('0x0')]=function(_0x30ed31,_0xdb8a29){return client[_0x7c2c('0x1')](_0x7c2c('0x2'),{'body':_0xdb8a29,'options':{'where':{'id':_0x30ed31}},'log':_0x7c2c('0x3')});};exports[_0x7c2c('0x4')]=function(_0x116f8a,_0x4bbc14){return client['Request'](_0x7c2c('0x5'),{'body':_0x4bbc14,'options':{'where':{'id':_0x116f8a}},'log':_0x7c2c('0x6')});}; \ No newline at end of file +var _0xc2c7=['update','Request','UpdateMailInteraction','updateMailInteraction','addTags','AddTagsToMailInteraction','addTagsToChatInteraction'];(function(_0x21e3d5,_0x443510){var _0x37fff5=function(_0x177dbc){while(--_0x177dbc){_0x21e3d5['push'](_0x21e3d5['shift']());}};_0x37fff5(++_0x443510);}(_0xc2c7,0x134));var _0x7c2c=function(_0x3c0f40,_0x10ed30){_0x3c0f40=_0x3c0f40-0x0;var _0x59a557=_0xc2c7[_0x3c0f40];return _0x59a557;};'use strict';var client=require('../client');exports[_0x7c2c('0x0')]=function(_0x30ed31,_0xdb8a29){return client[_0x7c2c('0x1')](_0x7c2c('0x2'),{'body':_0xdb8a29,'options':{'where':{'id':_0x30ed31}},'log':_0x7c2c('0x3')});};exports[_0x7c2c('0x4')]=function(_0x116f8a,_0x4bbc14){return client['Request'](_0x7c2c('0x5'),{'body':_0x4bbc14,'options':{'where':{'id':_0x116f8a}},'log':_0x7c2c('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 2b70700..d8eef38 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 _0xb35e=['create','CreateMailMessage','createMailMessage','../client'];(function(_0x17a28b,_0x5d1465){var _0x9cbb5a=function(_0x24e3c9){while(--_0x24e3c9){_0x17a28b['push'](_0x17a28b['shift']());}};_0x9cbb5a(++_0x5d1465);}(_0xb35e,0x7f));var _0xeb35=function(_0x49f0b7,_0x1cf297){_0x49f0b7=_0x49f0b7-0x0;var _0x21a877=_0xb35e[_0x49f0b7];return _0x21a877;};'use strict';var client=require(_0xeb35('0x0'));exports[_0xeb35('0x1')]=function(_0x29228b){return client['Request'](_0xeb35('0x2'),{'body':_0x29228b,'log':_0xeb35('0x3')});}; \ No newline at end of file +var _0x10a6=['Request','CreateMailMessage','createMailMessage','../client','create'];(function(_0x2f71f6,_0x3a1f4d){var _0x2b23ea=function(_0x285980){while(--_0x285980){_0x2f71f6['push'](_0x2f71f6['shift']());}};_0x2b23ea(++_0x3a1f4d);}(_0x10a6,0x1d9));var _0x610a=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0x10a6[_0x3c4737];return _0x2bb926;};'use strict';var client=require(_0x610a('0x0'));exports[_0x610a('0x1')]=function(_0xa90e7){return client[_0x610a('0x2')](_0x610a('0x3'),{'body':_0xa90e7,'log':_0x610a('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 692f222..63a7052 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 _0xcd0e=['online','mailPause','../client','getMailQueues','Request','GetMailQueue','name','timeout','strategy','User','Agents'];(function(_0x4b1f49,_0x3b50c0){var _0x368484=function(_0x1518b5){while(--_0x1518b5){_0x4b1f49['push'](_0x4b1f49['shift']());}};_0x368484(++_0x3b50c0);}(_0xcd0e,0xe9));var _0xecd0=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xcd0e[_0x3c2a69];return _0x596bc8;};'use strict';var client=require(_0xecd0('0x0'));exports[_0xecd0('0x1')]=function(){return function(){return client[_0xecd0('0x2')](_0xecd0('0x3'),{'options':{'raw':![],'attributes':['id',_0xecd0('0x4'),_0xecd0('0x5'),_0xecd0('0x6')],'include':[{'model':_0xecd0('0x7'),'as':_0xecd0('0x8'),'attributes':['id',_0xecd0('0x4'),_0xecd0('0x9'),_0xecd0('0xa')]}]},'log':_0xecd0('0x1')});};}; \ No newline at end of file +var _0x8cb8=['getMailQueues','GetMailQueue','strategy','User','Agents','mailPause'];(function(_0x156f06,_0x5edbb4){var _0x3be31a=function(_0x415faa){while(--_0x415faa){_0x156f06['push'](_0x156f06['shift']());}};_0x3be31a(++_0x5edbb4);}(_0x8cb8,0x1da));var _0x88cb=function(_0x2faddb,_0xc18b78){_0x2faddb=_0x2faddb-0x0;var _0x273c05=_0x8cb8[_0x2faddb];return _0x273c05;};'use strict';var client=require('../client');exports[_0x88cb('0x0')]=function(){return function(){return client['Request'](_0x88cb('0x1'),{'options':{'raw':![],'attributes':['id','name','timeout',_0x88cb('0x2')],'include':[{'model':_0x88cb('0x3'),'as':_0x88cb('0x4'),'attributes':['id','name','online',_0x88cb('0x5')]}]},'log':_0x88cb('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 664fec8..b00f15e 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 _0x16cc=['UpdateMailQueueReport','create','CreateMailQueueReport','Request'];(function(_0x453bc4,_0x1a31a0){var _0x55476c=function(_0x52e2b3){while(--_0x52e2b3){_0x453bc4['push'](_0x453bc4['shift']());}};_0x55476c(++_0x1a31a0);}(_0x16cc,0x1c1));var _0xc16c=function(_0x44febd,_0x4d63ca){_0x44febd=_0x44febd-0x0;var _0x3a0745=_0x16cc[_0x44febd];return _0x3a0745;};'use strict';var client=require('../client');exports[_0xc16c('0x0')]=function(_0x2d87f6){return client['Request'](_0xc16c('0x1'),{'body':_0x2d87f6,'log':_0xc16c('0x1')});};exports['update']=function(_0x4f38a0,_0x5b95d9){return client[_0xc16c('0x2')](_0xc16c('0x3'),{'body':_0x5b95d9,'options':{'where':{'uniqueid':_0x4f38a0},'order':[['id','DESC']],'limit':0x1},'log':_0xc16c('0x3')});}; \ No newline at end of file +var _0xdd14=['DESC','../client','create','Request','CreateMailQueueReport','update','UpdateMailQueueReport'];(function(_0x4095fc,_0x279332){var _0x5bbe31=function(_0xda20cb){while(--_0xda20cb){_0x4095fc['push'](_0x4095fc['shift']());}};_0x5bbe31(++_0x279332);}(_0xdd14,0x1d6));var _0x4dd1=function(_0x161204,_0x58d834){_0x161204=_0x161204-0x0;var _0x39a4bb=_0xdd14[_0x161204];return _0x39a4bb;};'use strict';var client=require(_0x4dd1('0x0'));exports[_0x4dd1('0x1')]=function(_0x208d3d){return client[_0x4dd1('0x2')]('CreateMailQueueReport',{'body':_0x208d3d,'log':_0x4dd1('0x3')});};exports[_0x4dd1('0x4')]=function(_0x1bdaa5,_0x5a3f75){return client[_0x4dd1('0x2')](_0x4dd1('0x5'),{'body':_0x5a3f75,'options':{'where':{'uniqueid':_0x1bdaa5},'order':[['id',_0x4dd1('0x6')]],'limit':0x1},'log':_0x4dd1('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index ac72720..b748d5e 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 _0x150a=['AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update','Request','updateOpenchannelInteraction','addTags'];(function(_0x272ad0,_0x4af3da){var _0x4c09e9=function(_0x2d015f){while(--_0x2d015f){_0x272ad0['push'](_0x272ad0['shift']());}};_0x4c09e9(++_0x4af3da);}(_0x150a,0x1c2));var _0xa150=function(_0x50a805,_0x514091){_0x50a805=_0x50a805-0x0;var _0xb33c67=_0x150a[_0x50a805];return _0xb33c67;};'use strict';var client=require(_0xa150('0x0'));exports[_0xa150('0x1')]=function(_0x4f2784,_0x5742d6){return client[_0xa150('0x2')]('UpdateOpenchannelInteraction',{'body':_0x5742d6,'options':{'where':{'id':_0x4f2784}},'log':_0xa150('0x3')});};exports[_0xa150('0x4')]=function(_0x14e2d4,_0x47f2d7){return client[_0xa150('0x2')](_0xa150('0x5'),{'body':_0x47f2d7,'options':{'where':{'id':_0x14e2d4}},'log':_0xa150('0x6')});}; \ No newline at end of file +var _0x430f=['../client','UpdateOpenchannelInteraction','updateOpenchannelInteraction','Request','AddTagsToOpenchannelInteraction','addTagsToChatInteraction'];(function(_0x1c85ce,_0x502bd7){var _0x5a2d6a=function(_0x545ea6){while(--_0x545ea6){_0x1c85ce['push'](_0x1c85ce['shift']());}};_0x5a2d6a(++_0x502bd7);}(_0x430f,0x84));var _0xf430=function(_0x4dfbe6,_0x2eecb9){_0x4dfbe6=_0x4dfbe6-0x0;var _0x1b3e0f=_0x430f[_0x4dfbe6];return _0x1b3e0f;};'use strict';var client=require(_0xf430('0x0'));exports['update']=function(_0x11ffea,_0x3c8c52){return client['Request'](_0xf430('0x1'),{'body':_0x3c8c52,'options':{'where':{'id':_0x11ffea}},'log':_0xf430('0x2')});};exports['addTags']=function(_0x2d9593,_0x3ac946){return client[_0xf430('0x3')](_0xf430('0x4'),{'body':_0x3ac946,'options':{'where':{'id':_0x2d9593}},'log':_0xf430('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index f4c0bf0..9ca32d5 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 _0x5c0d=['../client','create','Request','CreateOpenchannelMessage','createOpenchannelMessage'];(function(_0x374ca7,_0x199084){var _0x44cac2=function(_0x31c418){while(--_0x31c418){_0x374ca7['push'](_0x374ca7['shift']());}};_0x44cac2(++_0x199084);}(_0x5c0d,0x1d6));var _0xd5c0=function(_0x874cf1,_0x2a4954){_0x874cf1=_0x874cf1-0x0;var _0x233579=_0x5c0d[_0x874cf1];return _0x233579;};'use strict';var client=require(_0xd5c0('0x0'));exports[_0xd5c0('0x1')]=function(_0x26586b){return client[_0xd5c0('0x2')](_0xd5c0('0x3'),{'body':_0x26586b,'log':_0xd5c0('0x4')});}; \ No newline at end of file +var _0x5574=['Request','createOpenchannelMessage','create'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x5574,0x1ac));var _0x4557=function(_0x1eba85,_0x3ad49b){_0x1eba85=_0x1eba85-0x0;var _0x50bf27=_0x5574[_0x1eba85];return _0x50bf27;};'use strict';var client=require('../client');exports[_0x4557('0x0')]=function(_0x3cd498){return client[_0x4557('0x1')]('CreateOpenchannelMessage',{'body':_0x3cd498,'log':_0x4557('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 91f8d89..40cb90b 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 _0xa650=['../client','getOpenchannelQueues','Request','name','timeout','strategy','Agents','online','openchannelPause'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xa650,0xf3));var _0x0a65=function(_0x489397,_0x4aadb7){_0x489397=_0x489397-0x0;var _0xea1b91=_0xa650[_0x489397];return _0xea1b91;};'use strict';var client=require(_0x0a65('0x0'));exports[_0x0a65('0x1')]=function(){return function(){return client[_0x0a65('0x2')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id',_0x0a65('0x3'),_0x0a65('0x4'),_0x0a65('0x5')],'include':[{'model':'User','as':_0x0a65('0x6'),'attributes':['id',_0x0a65('0x3'),_0x0a65('0x7'),_0x0a65('0x8')]}]},'log':_0x0a65('0x1')});};}; \ No newline at end of file +var _0xe7b3=['online','getOpenchannelQueues','Request','name','strategy','Agents'];(function(_0x2cb1bd,_0x42b64c){var _0x393fdf=function(_0x532988){while(--_0x532988){_0x2cb1bd['push'](_0x2cb1bd['shift']());}};_0x393fdf(++_0x42b64c);}(_0xe7b3,0x193));var _0x3e7b=function(_0x3364f0,_0x2c1c9b){_0x3364f0=_0x3364f0-0x0;var _0x5f2d27=_0xe7b3[_0x3364f0];return _0x5f2d27;};'use strict';var client=require('../client');exports[_0x3e7b('0x0')]=function(){return function(){return client[_0x3e7b('0x1')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id',_0x3e7b('0x2'),'timeout',_0x3e7b('0x3')],'include':[{'model':'User','as':_0x3e7b('0x4'),'attributes':['id',_0x3e7b('0x2'),_0x3e7b('0x5'),'openchannelPause']}]},'log':_0x3e7b('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 3106fa4..8b2db6e 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 _0x3c9c=['create','CreateOpenchannelQueueReport','update','Request','UpdateOpenchannelQueueReport'];(function(_0x29a42a,_0x232d76){var _0x101c2a=function(_0x5126a9){while(--_0x5126a9){_0x29a42a['push'](_0x29a42a['shift']());}};_0x101c2a(++_0x232d76);}(_0x3c9c,0x131));var _0xc3c9=function(_0x417038,_0x2e0cdc){_0x417038=_0x417038-0x0;var _0x56425d=_0x3c9c[_0x417038];return _0x56425d;};'use strict';var client=require('../client');exports[_0xc3c9('0x0')]=function(_0x40d4c9){return client['Request'](_0xc3c9('0x1'),{'body':_0x40d4c9,'log':_0xc3c9('0x1')});};exports[_0xc3c9('0x2')]=function(_0x38a13e,_0x1b839f){return client[_0xc3c9('0x3')](_0xc3c9('0x4'),{'body':_0x1b839f,'options':{'where':{'uniqueid':_0x38a13e},'order':[['id','DESC']],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file +var _0x44f8=['Request','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','../client','create'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x44f8,0x1de));var _0x844f=function(_0x1c3bbd,_0x1c5af4){_0x1c3bbd=_0x1c3bbd-0x0;var _0x3a2b9d=_0x44f8[_0x1c3bbd];return _0x3a2b9d;};'use strict';var client=require(_0x844f('0x0'));exports[_0x844f('0x1')]=function(_0x1d704c){return client[_0x844f('0x2')](_0x844f('0x3'),{'body':_0x1d704c,'log':_0x844f('0x3')});};exports['update']=function(_0x51cee4,_0x26151e){return client['Request']('UpdateOpenchannelQueueReport',{'body':_0x26151e,'options':{'where':{'uniqueid':_0x51cee4},'order':[['id','DESC']],'limit':0x1},'log':_0x844f('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 0c2f310..64d5873 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 _0x56a6=['addTagsToSmsInteraction','../client','update','updateSmsInteraction','addTags','Request','AddTagsToSmsInteraction'];(function(_0x221fbe,_0x16bc47){var _0x51c3eb=function(_0x1dc3c3){while(--_0x1dc3c3){_0x221fbe['push'](_0x221fbe['shift']());}};_0x51c3eb(++_0x16bc47);}(_0x56a6,0x17b));var _0x656a=function(_0x1b249b,_0x45e4c7){_0x1b249b=_0x1b249b-0x0;var _0xc7304e=_0x56a6[_0x1b249b];return _0xc7304e;};'use strict';var client=require(_0x656a('0x0'));exports[_0x656a('0x1')]=function(_0xe679b,_0xaa8734){return client['Request']('UpdateSmsInteraction',{'body':_0xaa8734,'options':{'where':{'id':_0xe679b}},'log':_0x656a('0x2')});};exports[_0x656a('0x3')]=function(_0x67844b,_0x4d764b){return client[_0x656a('0x4')](_0x656a('0x5'),{'body':_0x4d764b,'options':{'where':{'id':_0x67844b}},'log':_0x656a('0x6')});}; \ No newline at end of file +var _0xe700=['updateSmsInteraction','addTagsToSmsInteraction','../client','update','Request'];(function(_0x49c057,_0xc808ed){var _0xd8f0e6=function(_0x5b9042){while(--_0x5b9042){_0x49c057['push'](_0x49c057['shift']());}};_0xd8f0e6(++_0xc808ed);}(_0xe700,0x16a));var _0x0e70=function(_0x5c44e5,_0x508866){_0x5c44e5=_0x5c44e5-0x0;var _0x462ca2=_0xe700[_0x5c44e5];return _0x462ca2;};'use strict';var client=require(_0x0e70('0x0'));exports[_0x0e70('0x1')]=function(_0x245ff7,_0x1c63f0){return client[_0x0e70('0x2')]('UpdateSmsInteraction',{'body':_0x1c63f0,'options':{'where':{'id':_0x245ff7}},'log':_0x0e70('0x3')});};exports['addTags']=function(_0x20335e,_0x2cc22e){return client['Request']('AddTagsToSmsInteraction',{'body':_0x2cc22e,'options':{'where':{'id':_0x20335e}},'log':_0x0e70('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 9375698..fe73b42 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 _0xb94a=['CreateSmsMessage','../client','Request'];(function(_0x50a30b,_0x11f18b){var _0x588fca=function(_0x3ae254){while(--_0x3ae254){_0x50a30b['push'](_0x50a30b['shift']());}};_0x588fca(++_0x11f18b);}(_0xb94a,0x136));var _0xab94=function(_0x49bd34,_0x2ff56e){_0x49bd34=_0x49bd34-0x0;var _0x1d8ba3=_0xb94a[_0x49bd34];return _0x1d8ba3;};'use strict';var client=require(_0xab94('0x0'));exports['create']=function(_0x915f45){return client[_0xab94('0x1')](_0xab94('0x2'),{'body':_0x915f45,'log':'createSmsMessage'});}; \ No newline at end of file +var _0x81c2=['create','Request','createSmsMessage'];(function(_0x1ae38d,_0xb3ce59){var _0x5ea74d=function(_0x66cda7){while(--_0x66cda7){_0x1ae38d['push'](_0x1ae38d['shift']());}};_0x5ea74d(++_0xb3ce59);}(_0x81c2,0x108));var _0x281c=function(_0x21a0cb,_0x5a4cc5){_0x21a0cb=_0x21a0cb-0x0;var _0x2e9bb4=_0x81c2[_0x21a0cb];return _0x2e9bb4;};'use strict';var client=require('../client');exports[_0x281c('0x0')]=function(_0xb18afb){return client[_0x281c('0x1')]('CreateSmsMessage',{'body':_0xb18afb,'log':_0x281c('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index e97f387..8e752b9 100644 --- a/server/services/routing/rpc/smsQueue.js +++ b/server/services/routing/rpc/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['online','../client','Request','name','strategy','Agents'];(function(_0x5ef194,_0x3a7893){var _0x34d067=function(_0x2b0c0f){while(--_0x2b0c0f){_0x5ef194['push'](_0x5ef194['shift']());}};_0x34d067(++_0x3a7893);}(_0xb7e7,0x121));var _0x7b7e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xb7e7[_0x49ca18];return _0x145d54;};'use strict';var client=require(_0x7b7e('0x0'));exports['getSmsQueues']=function(){return function(){return client[_0x7b7e('0x1')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x7b7e('0x2'),'timeout',_0x7b7e('0x3')],'include':[{'model':'User','as':_0x7b7e('0x4'),'attributes':['id',_0x7b7e('0x2'),_0x7b7e('0x5'),'smsPause']}]},'log':'getSmsQueues'});};}; \ No newline at end of file +var _0x70e0=['User','Agents','online','../client','getSmsQueues','Request','timeout','strategy'];(function(_0x41ef00,_0x1f285b){var _0x349b15=function(_0x591410){while(--_0x591410){_0x41ef00['push'](_0x41ef00['shift']());}};_0x349b15(++_0x1f285b);}(_0x70e0,0x17b));var _0x070e=function(_0xbecfcc,_0x4fa93b){_0xbecfcc=_0xbecfcc-0x0;var _0x46863d=_0x70e0[_0xbecfcc];return _0x46863d;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(){return function(){return client[_0x070e('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x070e('0x3'),_0x070e('0x4')],'include':[{'model':_0x070e('0x5'),'as':_0x070e('0x6'),'attributes':['id','name',_0x070e('0x7'),'smsPause']}]},'log':_0x070e('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 671a58f..e617528 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 _0x008c=['../client','create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x4bbcc1,_0x594e19){var _0x34435b=function(_0x124582){while(--_0x124582){_0x4bbcc1['push'](_0x4bbcc1['shift']());}};_0x34435b(++_0x594e19);}(_0x008c,0x188));var _0xc008=function(_0x277607,_0x345a06){_0x277607=_0x277607-0x0;var _0x15fe23=_0x008c[_0x277607];return _0x15fe23;};'use strict';var client=require(_0xc008('0x0'));exports[_0xc008('0x1')]=function(_0x15aadc){return client[_0xc008('0x2')](_0xc008('0x3'),{'body':_0x15aadc,'log':'CreateSmsQueueReport'});};exports[_0xc008('0x4')]=function(_0x47063f,_0x10b33c){return client[_0xc008('0x2')](_0xc008('0x5'),{'body':_0x10b33c,'options':{'where':{'uniqueid':_0x47063f},'order':[['id',_0xc008('0x6')]],'limit':0x1},'log':_0xc008('0x5')});}; \ No newline at end of file +var _0x70e0=['create','CreateSmsQueueReport','update','UpdateSmsQueueReport','../client'];(function(_0x320889,_0x4e1b11){var _0x5e049a=function(_0x162f8a){while(--_0x162f8a){_0x320889['push'](_0x320889['shift']());}};_0x5e049a(++_0x4e1b11);}(_0x70e0,0x17b));var _0x070e=function(_0x5dbf26,_0x52c777){_0x5dbf26=_0x5dbf26-0x0;var _0x547e2c=_0x70e0[_0x5dbf26];return _0x547e2c;};'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 13ddad0..238ba17 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(_0x41c76d,_0x5d09a6){var _0x4fd396=function(_0xddaa9a){while(--_0xddaa9a){_0x41c76d['push'](_0x41c76d['shift']());}};_0x4fd396(++_0x5d09a6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'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(_0x3387d9,_0x9f28d9){var _0x512706=function(_0x6b28f9){while(--_0x6b28f9){_0x3387d9['push'](_0x3387d9['shift']());}};_0x512706(++_0x9f28d9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'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 10d1946..d10f529 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 _0x4815=['updateWhatsappInteraction','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','update','Request','UpdateWhatsappInteraction'];(function(_0x11c2b8,_0x4e5d68){var _0x2ef559=function(_0x208b7b){while(--_0x208b7b){_0x11c2b8['push'](_0x11c2b8['shift']());}};_0x2ef559(++_0x4e5d68);}(_0x4815,0xff));var _0x5481=function(_0xe326da,_0x24c68d){_0xe326da=_0xe326da-0x0;var _0x190f06=_0x4815[_0xe326da];return _0x190f06;};'use strict';var client=require(_0x5481('0x0'));exports[_0x5481('0x1')]=function(_0x325314,_0x3ac100){return client[_0x5481('0x2')](_0x5481('0x3'),{'body':_0x3ac100,'options':{'where':{'id':_0x325314}},'log':_0x5481('0x4')});};exports['addTags']=function(_0x4a7db7,_0x2e5eec){return client[_0x5481('0x2')](_0x5481('0x5'),{'body':_0x2e5eec,'options':{'where':{'id':_0x4a7db7}},'log':_0x5481('0x6')});}; \ No newline at end of file +var _0x46ed=['addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','update','Request','UpdateWhatsappInteraction'];(function(_0x3e9af0,_0xb82e07){var _0x243da8=function(_0x24e37d){while(--_0x24e37d){_0x3e9af0['push'](_0x3e9af0['shift']());}};_0x243da8(++_0xb82e07);}(_0x46ed,0x168));var _0xd46e=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x46ed[_0x19950b];return _0x3c6b41;};'use strict';var client=require(_0xd46e('0x0'));exports[_0xd46e('0x1')]=function(_0x493012,_0x392bc1){return client[_0xd46e('0x2')](_0xd46e('0x3'),{'body':_0x392bc1,'options':{'where':{'id':_0x493012}},'log':'updateWhatsappInteraction'});};exports[_0xd46e('0x4')]=function(_0x4518b8,_0x54ef98){return client[_0xd46e('0x2')](_0xd46e('0x5'),{'body':_0x54ef98,'options':{'where':{'id':_0x4518b8}},'log':_0xd46e('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 3e9d0bf..8b8e036 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 _0x9b83=['createWhatsappMessage','create','Request','CreateWhatsappMessage'];(function(_0x5810a0,_0x5558e4){var _0x557835=function(_0x57ed8d){while(--_0x57ed8d){_0x5810a0['push'](_0x5810a0['shift']());}};_0x557835(++_0x5558e4);}(_0x9b83,0x79));var _0x39b8=function(_0xd0a847,_0x72562b){_0xd0a847=_0xd0a847-0x0;var _0x2536ec=_0x9b83[_0xd0a847];return _0x2536ec;};'use strict';var client=require('../client');exports[_0x39b8('0x0')]=function(_0x132b02){return client[_0x39b8('0x1')](_0x39b8('0x2'),{'body':_0x132b02,'log':_0x39b8('0x3')});}; \ No newline at end of file +var _0xe68f=['createWhatsappMessage','create','Request','CreateWhatsappMessage'];(function(_0x115093,_0x56aaa9){var _0xc87398=function(_0x3270f8){while(--_0x3270f8){_0x115093['push'](_0x115093['shift']());}};_0xc87398(++_0x56aaa9);}(_0xe68f,0x139));var _0xfe68=function(_0x53a597,_0x44a8f8){_0x53a597=_0x53a597-0x0;var _0x4549e1=_0xe68f[_0x53a597];return _0x4549e1;};'use strict';var client=require('../client');exports[_0xfe68('0x0')]=function(_0x341b2e){return client[_0xfe68('0x1')](_0xfe68('0x2'),{'body':_0x341b2e,'log':_0xfe68('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index e2e1672..5bb2316 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 _0x90ee=['GetWhatsappQueue','name','timeout','strategy','User','Agents','online','whatsappPause','../client','getWhatsappQueues','Request'];(function(_0x158da6,_0x3cb06d){var _0x429c30=function(_0x2d5895){while(--_0x2d5895){_0x158da6['push'](_0x158da6['shift']());}};_0x429c30(++_0x3cb06d);}(_0x90ee,0x19f));var _0xe90e=function(_0x5d43b5,_0x3d1c74){_0x5d43b5=_0x5d43b5-0x0;var _0x2c5fba=_0x90ee[_0x5d43b5];return _0x2c5fba;};'use strict';var client=require(_0xe90e('0x0'));exports[_0xe90e('0x1')]=function(){return function(){return client[_0xe90e('0x2')](_0xe90e('0x3'),{'options':{'raw':![],'attributes':['id',_0xe90e('0x4'),_0xe90e('0x5'),_0xe90e('0x6')],'include':[{'model':_0xe90e('0x7'),'as':_0xe90e('0x8'),'attributes':['id',_0xe90e('0x4'),_0xe90e('0x9'),_0xe90e('0xa')]}]},'log':_0xe90e('0x1')});};}; \ No newline at end of file +var _0xd307=['User','Agents','online','whatsappPause','getWhatsappQueues','GetWhatsappQueue','name','timeout'];(function(_0x1827ad,_0x491934){var _0x16e185=function(_0x583351){while(--_0x583351){_0x1827ad['push'](_0x1827ad['shift']());}};_0x16e185(++_0x491934);}(_0xd307,0x184));var _0x7d30=function(_0x41798e,_0x3f185d){_0x41798e=_0x41798e-0x0;var _0x31a389=_0xd307[_0x41798e];return _0x31a389;};'use strict';var client=require('../client');exports[_0x7d30('0x0')]=function(){return function(){return client['Request'](_0x7d30('0x1'),{'options':{'raw':![],'attributes':['id',_0x7d30('0x2'),_0x7d30('0x3'),'strategy'],'include':[{'model':_0x7d30('0x4'),'as':_0x7d30('0x5'),'attributes':['id',_0x7d30('0x2'),_0x7d30('0x6'),_0x7d30('0x7')]}]},'log':_0x7d30('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 6c2119e..0773236 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 _0x6153=['CreateWhatsappQueueReport','update','Request','UpdateWhatsappQueueReport','DESC','create'];(function(_0x3ee9f0,_0x2cf80d){var _0x339410=function(_0x140810){while(--_0x140810){_0x3ee9f0['push'](_0x3ee9f0['shift']());}};_0x339410(++_0x2cf80d);}(_0x6153,0x1f1));var _0x3615=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x6153[_0x40a045];return _0x1a687c;};'use strict';var client=require('../client');exports[_0x3615('0x0')]=function(_0x3294fb){return client['Request'](_0x3615('0x1'),{'body':_0x3294fb,'log':_0x3615('0x1')});};exports[_0x3615('0x2')]=function(_0x18db86,_0x4da023){return client[_0x3615('0x3')](_0x3615('0x4'),{'body':_0x4da023,'options':{'where':{'uniqueid':_0x18db86},'order':[['id',_0x3615('0x5')]],'limit':0x1},'log':_0x3615('0x4')});}; \ No newline at end of file +var _0xc9d2=['../client','Request','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','DESC'];(function(_0x660ce3,_0x186b9f){var _0xa9ceb5=function(_0x2c9db0){while(--_0x2c9db0){_0x660ce3['push'](_0x660ce3['shift']());}};_0xa9ceb5(++_0x186b9f);}(_0xc9d2,0x10e));var _0x2c9d=function(_0x576443,_0x1a2661){_0x576443=_0x576443-0x0;var _0x379cf4=_0xc9d2[_0x576443];return _0x379cf4;};'use strict';var client=require(_0x2c9d('0x0'));exports['create']=function(_0x985958){return client[_0x2c9d('0x1')](_0x2c9d('0x2'),{'body':_0x985958,'log':_0x2c9d('0x2')});};exports['update']=function(_0x43ab01,_0x4d11d6){return client[_0x2c9d('0x1')](_0x2c9d('0x3'),{'body':_0x4d11d6,'options':{'where':{'uniqueid':_0x43ab01},'order':[['id',_0x2c9d('0x4')]],'limit':0x1},'log':_0x2c9d('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index eede1e2..865cda8 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 _0xf52c=['join','stop','timeout','createQueue','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','info','[%s][AGENT]\x20ROUTING\x20END','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','stack','lodash','util','seq-queue','../../../../config/logger','string','timeout\x20is\x20a\x20number','format','name','toLowerCase','consequence','validate','length','error','map','message'];(function(_0x58068a,_0x171793){var _0x2dc60b=function(_0x1446f4){while(--_0x1446f4){_0x58068a['push'](_0x58068a['shift']());}};_0x2dc60b(++_0x171793);}(_0xf52c,0xb1));var _0xcf52=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf52c[_0x3dd15e];return _0x231fd0;};'use strict';var schema=require('validate');var _=require(_0xcf52('0x0'));var util=require(_0xcf52('0x1'));var seqqueue=require(_0xcf52('0x2'));var logger=require(_0xcf52('0x3'))('routing');var strategy=require('./strategy');var queue=schema({'name':{'type':_0xcf52('0x4'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':'number','message':_0xcf52('0x5')}});function writeLog(_0x235c7d,_0xfe4ae2,_0x392b75){return logger['info'](util[_0xcf52('0x6')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x235c7d,_0xfe4ae2[_0xcf52('0x7')],_0x392b75));}function handleFindAgent(_0x3c0362){return function(_0xff7de9){return _0xff7de9[_0xcf52('0x7')][_0xcf52('0x8')]()===_0x3c0362[_0xcf52('0x8')]();};}exports[_0xcf52('0x9')]=function(_0x4350b7,_0x23ded7,_0x37b6d9,_0x256139){return function(_0x1dadbc){try{var _0x1fb4d3={'name':_0x23ded7[0x0],'timeout':_0x23ded7[0x1]};var _0x522bfc=queue[_0xcf52('0xa')](_0x1fb4d3,{'typecast':!![]});if(_0x522bfc[_0xcf52('0xb')]){logger[_0xcf52('0xc')]('[%s][AGENT]\x20%s',_0x4350b7,_[_0xcf52('0xd')](_0x522bfc,_0xcf52('0xe'))[_0xcf52('0xf')](',\x20'));_0x1dadbc[_0xcf52('0x10')]();}else{var _0xbdbead=_['find'](_0x37b6d9['agents'],handleFindAgent(_0x1fb4d3[_0xcf52('0x7')]));if(_0xbdbead){var _0x4702dc=(_0x1fb4d3[_0xcf52('0x11')]||0xa)*0x3e8;var _0x854451,_0x3dd97c;var _0x3e583d=seqqueue[_0xcf52('0x12')](_0x4702dc);_0x3e583d['id']=_0x4350b7;_0x3e583d['atimeout']=_0x4702dc;_0x3e583d['channel']=_0x256139[_0xcf52('0x13')];writeLog(_0x4350b7,_0xbdbead,util['format'](_0xcf52('0x14'),_0x4702dc));_0x37b6d9[_0xcf52('0x15')][_0x4350b7]['on'](_0xcf52('0x16'),function(){logger['info'](_0xcf52('0x17'),_0x4350b7);clearTimeout(_0x3dd97c);_0x3dd97c=undefined;_0x3e583d[_0xcf52('0x18')]();if(_0x37b6d9[_0xcf52('0x15')][_0x4350b7]){delete _0x37b6d9[_0xcf52('0x15')][_0x4350b7];}_0x1dadbc['stop']();});_0x37b6d9[_0xcf52('0x15')][_0x4350b7]['on'](_0xcf52('0x19'),function(){if(_0x37b6d9[_0xcf52('0x15')][_0x4350b7]){delete _0x37b6d9[_0xcf52('0x15')][_0x4350b7];}});_0x3dd97c=setTimeout(function(){logger[_0xcf52('0x1a')](_0xcf52('0x1b'),_0x4350b7);clearTimeout(_0x3dd97c);_0x3e583d['close']();_0x1dadbc['next']();},_0x4702dc);strategy[_0xcf52('0x1c')](_0x3e583d,_0xbdbead,_0x37b6d9,_0x256139);}else{logger[_0xcf52('0xc')](_0xcf52('0x1d'),_0x4350b7,_0x1fb4d3['name']);_0x1dadbc[_0xcf52('0x10')]();}}}catch(_0x3a2a12){console[_0xcf52('0x1e')](_0x3a2a12);logger[_0xcf52('0xc')]('[%s][QUEUE]\x20%s',_0x4350b7,_0x3a2a12[_0xcf52('0x1f')]);_0x1dadbc['stop']();}};}; \ No newline at end of file +var _0xdf87=['name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','toLowerCase','length','error','[%s][AGENT]\x20%s','map','message','join','stop','find','agents','name','createQueue','atimeout','channel','START:%s','[%s][AGENT]\x20ROUTING\x20STOPPED','rules','complete','[%s][AGENT]\x20ROUTING\x20END','close','next','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','../../../../config/logger','routing','./strategy','string'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0xdf87,0x174));var _0x7df8=function(_0x3f81f2,_0x2eb9ed){_0x3f81f2=_0x3f81f2-0x0;var _0x5ab8f6=_0xdf87[_0x3f81f2];return _0x5ab8f6;};'use strict';var schema=require(_0x7df8('0x0'));var _=require(_0x7df8('0x1'));var util=require(_0x7df8('0x2'));var seqqueue=require(_0x7df8('0x3'));var logger=require(_0x7df8('0x4'))(_0x7df8('0x5'));var strategy=require(_0x7df8('0x6'));var queue=schema({'name':{'type':_0x7df8('0x7'),'required':!![],'message':_0x7df8('0x8')},'timeout':{'type':'number','message':_0x7df8('0x9')}});function writeLog(_0x2f3a38,_0x5a0e92,_0x8aa5f1){return logger[_0x7df8('0xa')](util[_0x7df8('0xb')](_0x7df8('0xc'),_0x2f3a38,_0x5a0e92['name'],_0x8aa5f1));}function handleFindAgent(_0x385fba){return function(_0x3951a7){return _0x3951a7['name'][_0x7df8('0xd')]()===_0x385fba[_0x7df8('0xd')]();};}exports['consequence']=function(_0x1cc4f4,_0x45c4b8,_0x6a60d5,_0x497fd9){return function(_0x430a65){try{var _0x549f1a={'name':_0x45c4b8[0x0],'timeout':_0x45c4b8[0x1]};var _0x5b8d72=queue[_0x7df8('0x0')](_0x549f1a,{'typecast':!![]});if(_0x5b8d72[_0x7df8('0xe')]){logger[_0x7df8('0xf')](_0x7df8('0x10'),_0x1cc4f4,_[_0x7df8('0x11')](_0x5b8d72,_0x7df8('0x12'))[_0x7df8('0x13')](',\x20'));_0x430a65[_0x7df8('0x14')]();}else{var _0x1cd60e=_[_0x7df8('0x15')](_0x6a60d5[_0x7df8('0x16')],handleFindAgent(_0x549f1a[_0x7df8('0x17')]));if(_0x1cd60e){var _0x40c698=(_0x549f1a['timeout']||0xa)*0x3e8;var _0x3844b2,_0xf867ef;var _0x153124=seqqueue[_0x7df8('0x18')](_0x40c698);_0x153124['id']=_0x1cc4f4;_0x153124[_0x7df8('0x19')]=_0x40c698;_0x153124['channel']=_0x497fd9[_0x7df8('0x1a')];writeLog(_0x1cc4f4,_0x1cd60e,util[_0x7df8('0xb')](_0x7df8('0x1b'),_0x40c698));_0x6a60d5['rules'][_0x1cc4f4]['on']('end',function(){logger[_0x7df8('0xa')](_0x7df8('0x1c'),_0x1cc4f4);clearTimeout(_0xf867ef);_0xf867ef=undefined;_0x153124['close']();if(_0x6a60d5[_0x7df8('0x1d')][_0x1cc4f4]){delete _0x6a60d5[_0x7df8('0x1d')][_0x1cc4f4];}_0x430a65[_0x7df8('0x14')]();});_0x6a60d5[_0x7df8('0x1d')][_0x1cc4f4]['on'](_0x7df8('0x1e'),function(){if(_0x6a60d5['rules'][_0x1cc4f4]){delete _0x6a60d5[_0x7df8('0x1d')][_0x1cc4f4];}});_0xf867ef=setTimeout(function(){logger[_0x7df8('0xa')](_0x7df8('0x1f'),_0x1cc4f4);clearTimeout(_0xf867ef);_0x153124[_0x7df8('0x20')]();_0x430a65[_0x7df8('0x21')]();},_0x40c698);strategy['agent'](_0x153124,_0x1cd60e,_0x6a60d5,_0x497fd9);}else{logger[_0x7df8('0xf')](_0x7df8('0x22'),_0x1cc4f4,_0x549f1a[_0x7df8('0x17')]);_0x430a65[_0x7df8('0x14')]();}}}catch(_0x367a05){console[_0x7df8('0x23')](_0x367a05);logger[_0x7df8('0xf')](_0x7df8('0x24'),_0x1cc4f4,_0x367a05[_0x7df8('0x25')]);_0x430a65[_0x7df8('0x14')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/amazonlex.js b/server/services/routing/server/applications/amazonlex.js index a8b5a2d..cba4e0b 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 _0xd35f=['getMustacheRender','Message','then','catch','error','stringify','finally','info','[%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','amazonlex','providerName','providerResponse','create','dialogState','lodash','moment','aws-sdk','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','isNil','UserId','[%s][AMAZONLEX]\x20%s','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','sms','channel','whatsapp','interaction','phone','account','upperFirst','AccountId','created','isEmpty','body'];(function(_0x12f250,_0x5d00cd){var _0x21ef50=function(_0x5c29d2){while(--_0x5c29d2){_0x12f250['push'](_0x12f250['shift']());}};_0x21ef50(++_0x5d00cd);}(_0xd35f,0x183));var _0xfd35=function(_0x135704,_0x539aee){_0x135704=_0x135704-0x0;var _0x24e9fd=_0xd35f[_0x135704];return _0x24e9fd;};'use strict';var _=require(_0xfd35('0x0'));var moment=require(_0xfd35('0x1'));var AWS=require(_0xfd35('0x2'));var utils=require('./utils');var logger=require(_0xfd35('0x3'))(_0xfd35('0x4'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xfd35('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xfd35('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xfd35('0x7'))};exports[_0xfd35('0x8')]=function(_0x3644ac,_0x3e3b71){return function(_0x88c74a){try{if(!_[_0xfd35('0x9')](this['interaction'][_0xfd35('0xa')])){logger['info'](_0xfd35('0xb'),_0x3644ac,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x88c74a[_0xfd35('0xc')]();}var _0x52f9d3={'ContactId':this[_0xfd35('0xd')]['id'],'sentAt':moment()[_0xfd35('0xe')](_0xfd35('0xf')),'direction':'out'};if(this['channel']===_0xfd35('0x10')||this[_0xfd35('0x11')]===_0xfd35('0x12')){_0x52f9d3['phone']=this[_0xfd35('0x13')][_0xfd35('0x14')];}var _0x5e574c=this['channel'];if(_0x5e574c==='chat'){_0x52f9d3['ChatWebsiteId']=this[_0xfd35('0x15')]['id'];}else{_0x52f9d3[_[_0xfd35('0x16')](_0x5e574c)+_0xfd35('0x17')]=this['account']['id'];}_0x52f9d3[_['upperFirst'](_0x5e574c)+'InteractionId']=this[_0xfd35('0x13')]['id'];if(this[_0xfd35('0x13')][_0xfd35('0x18')]){var _0x232963=_0x3e3b71[0x4];if(!_[_0xfd35('0x19')](_0x232963)){_0x52f9d3[_0xfd35('0x1a')]=utils[_0xfd35('0x1b')](_0x232963,this);return rpc[_0x5e574c+_0xfd35('0x1c')]['create'](_0x52f9d3)[_0xfd35('0x1d')](function(_0x5a5a19){logger['info'](_0xfd35('0xb'),_0x3644ac,_0x52f9d3['body']);})[_0xfd35('0x1e')](function(_0x783cd3){logger[_0xfd35('0x1f')](_0xfd35('0xb'),_0x3644ac,JSON[_0xfd35('0x20')](_0x783cd3));})[_0xfd35('0x21')](function(){logger[_0xfd35('0x22')](_0xfd35('0x23'),_0x3644ac);_0x88c74a[_0xfd35('0x24')]();});}else{logger[_0xfd35('0x22')](_0xfd35('0x25'),_0x3644ac);_0x88c74a[_0xfd35('0x24')]();}}else{var _0x4865ea=this;var _0x4d7c35=new AWS[(_0xfd35('0x26'))]({'accessKeyId':_0x3e3b71[0x0],'secretAccessKey':_0x3e3b71[0x1],'region':_0x3e3b71[0x2]});var _0x1b2b5e={'botAlias':_0xfd35('0x27'),'botName':_0x3e3b71[0x3],'inputText':this[_0xfd35('0x28')]['body'],'userId':this[_0xfd35('0x11')]+':'+this[_0xfd35('0x13')]['id']['toString']()};_0x4d7c35['postText'](_0x1b2b5e,function(_0x13ac16,_0x15a24f){if(_0x13ac16){logger[_0xfd35('0x1f')](_0xfd35('0xb'),_0x3644ac,_0x13ac16[_0xfd35('0x28')]);_0x88c74a[_0xfd35('0xc')]();}else if(_0x15a24f&&_0x15a24f['message']){_0x4865ea[_0xfd35('0x1a')][_0xfd35('0x29')]=_0x15a24f;_0x52f9d3['body']=_0x15a24f['message'];_0x52f9d3[_0xfd35('0x2a')]=_0xfd35('0x29');_0x52f9d3[_0xfd35('0x2b')]=JSON['stringify'](_0x15a24f);return rpc[_0x5e574c+_0xfd35('0x1c')][_0xfd35('0x2c')](_0x52f9d3)['then'](function(_0x288151){logger['info'](_0xfd35('0xb'),_0x3644ac,_0x52f9d3[_0xfd35('0x1a')]);if(_0x15a24f[_0xfd35('0x2d')]=='Failed'){_0x88c74a[_0xfd35('0xc')]();}else{_0x88c74a[_0xfd35('0x24')]();}})[_0xfd35('0x1e')](function(_0x2e243b){logger[_0xfd35('0x1f')](_0xfd35('0xb'),_0x3644ac,JSON[_0xfd35('0x20')](_0x2e243b));_0x88c74a['next']();});}else{_0x88c74a[_0xfd35('0xc')]();}});}}catch(_0x269ff6){logger[_0xfd35('0x1f')](_0xfd35('0xb'),_0x3644ac,JSON[_0xfd35('0x20')](_0x269ff6));_0x88c74a[_0xfd35('0x24')]();}};}; \ No newline at end of file +var _0xff71=['account','upperFirst','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','then','error','stringify','finally','stop','LexRuntime','$LATEST','message','toString','postText','amazonlex','providerName','providerResponse','dialogState','Failed','lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','whatsapp','phone','channel','ChatWebsiteId'];(function(_0x2993c9,_0x2d31a1){var _0x31eea5=function(_0x463f2f){while(--_0x463f2f){_0x2993c9['push'](_0x2993c9['shift']());}};_0x31eea5(++_0x2d31a1);}(_0xff71,0x1b0));var _0x1ff7=function(_0x1da436,_0x2fab9d){_0x1da436=_0x1da436-0x0;var _0xe4468d=_0xff71[_0x1da436];return _0xe4468d;};'use strict';var _=require(_0x1ff7('0x0'));var moment=require(_0x1ff7('0x1'));var AWS=require(_0x1ff7('0x2'));var utils=require(_0x1ff7('0x3'));var logger=require(_0x1ff7('0x4'))(_0x1ff7('0x5'));var rpc={'chatMessage':require(_0x1ff7('0x6')),'openchannelMessage':require(_0x1ff7('0x7')),'mailMessage':require(_0x1ff7('0x8')),'smsMessage':require(_0x1ff7('0x9')),'faxMessage':require(_0x1ff7('0xa')),'whatsappMessage':require(_0x1ff7('0xb'))};exports[_0x1ff7('0xc')]=function(_0x3cc94e,_0x1c37b9){return function(_0x4caaf4){try{if(!_[_0x1ff7('0xd')](this[_0x1ff7('0xe')]['UserId'])){logger[_0x1ff7('0xf')](_0x1ff7('0x10'),_0x3cc94e,_0x1ff7('0x11'));return _0x4caaf4[_0x1ff7('0x12')]();}var _0xe99f24={'ContactId':this[_0x1ff7('0x13')]['id'],'sentAt':moment()[_0x1ff7('0x14')](_0x1ff7('0x15')),'direction':_0x1ff7('0x16')};if(this['channel']==='sms'||this['channel']===_0x1ff7('0x17')){_0xe99f24[_0x1ff7('0x18')]=this[_0x1ff7('0xe')][_0x1ff7('0x18')];}var _0x5089cd=this[_0x1ff7('0x19')];if(_0x5089cd==='chat'){_0xe99f24[_0x1ff7('0x1a')]=this[_0x1ff7('0x1b')]['id'];}else{_0xe99f24[_[_0x1ff7('0x1c')](_0x5089cd)+'AccountId']=this[_0x1ff7('0x1b')]['id'];}_0xe99f24[_['upperFirst'](_0x5089cd)+_0x1ff7('0x1d')]=this[_0x1ff7('0xe')]['id'];if(this[_0x1ff7('0xe')][_0x1ff7('0x1e')]){var _0x4e0ccf=_0x1c37b9[0x4];if(!_[_0x1ff7('0x1f')](_0x4e0ccf)){_0xe99f24[_0x1ff7('0x20')]=utils[_0x1ff7('0x21')](_0x4e0ccf,this);return rpc[_0x5089cd+_0x1ff7('0x22')][_0x1ff7('0x23')](_0xe99f24)[_0x1ff7('0x24')](function(_0x287786){logger[_0x1ff7('0xf')](_0x1ff7('0x10'),_0x3cc94e,_0xe99f24[_0x1ff7('0x20')]);})['catch'](function(_0x48151a){logger[_0x1ff7('0x25')](_0x1ff7('0x10'),_0x3cc94e,JSON[_0x1ff7('0x26')](_0x48151a));})[_0x1ff7('0x27')](function(){logger[_0x1ff7('0xf')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x3cc94e);_0x4caaf4['stop']();});}else{logger[_0x1ff7('0xf')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x3cc94e);_0x4caaf4[_0x1ff7('0x28')]();}}else{var _0xa33139=this;var _0x231e4d=new AWS[(_0x1ff7('0x29'))]({'accessKeyId':_0x1c37b9[0x0],'secretAccessKey':_0x1c37b9[0x1],'region':_0x1c37b9[0x2]});var _0x44cd72={'botAlias':_0x1ff7('0x2a'),'botName':_0x1c37b9[0x3],'inputText':this[_0x1ff7('0x2b')][_0x1ff7('0x20')],'userId':this[_0x1ff7('0x19')]+':'+this['interaction']['id'][_0x1ff7('0x2c')]()};_0x231e4d[_0x1ff7('0x2d')](_0x44cd72,function(_0x2bfbed,_0x2329f7){if(_0x2bfbed){logger[_0x1ff7('0x25')](_0x1ff7('0x10'),_0x3cc94e,_0x2bfbed[_0x1ff7('0x2b')]);_0x4caaf4[_0x1ff7('0x12')]();}else if(_0x2329f7&&_0x2329f7[_0x1ff7('0x2b')]){_0xa33139['body'][_0x1ff7('0x2e')]=_0x2329f7;_0xe99f24['body']=_0x2329f7[_0x1ff7('0x2b')];_0xe99f24[_0x1ff7('0x2f')]=_0x1ff7('0x2e');_0xe99f24[_0x1ff7('0x30')]=JSON[_0x1ff7('0x26')](_0x2329f7);return rpc[_0x5089cd+_0x1ff7('0x22')][_0x1ff7('0x23')](_0xe99f24)[_0x1ff7('0x24')](function(_0xb9f151){logger['info']('[%s][AMAZONLEX]\x20%s',_0x3cc94e,_0xe99f24[_0x1ff7('0x20')]);if(_0x2329f7[_0x1ff7('0x31')]==_0x1ff7('0x32')){_0x4caaf4[_0x1ff7('0x12')]();}else{_0x4caaf4[_0x1ff7('0x28')]();}})['catch'](function(_0x233489){logger['error']('[%s][AMAZONLEX]\x20%s',_0x3cc94e,JSON[_0x1ff7('0x26')](_0x233489));_0x4caaf4[_0x1ff7('0x12')]();});}else{_0x4caaf4[_0x1ff7('0x12')]();}});}}catch(_0x3ccdf9){logger[_0x1ff7('0x25')](_0x1ff7('0x10'),_0x3cc94e,JSON[_0x1ff7('0x26')](_0x3ccdf9));_0x4caaf4[_0x1ff7('0x28')]();}};}; \ 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 39ed894..c11a063 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 _0x3881=['mail','body','isAutoreply','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','created','interaction','Autoreply\x20already\x20sent','autoreplyExecuted','YYYY-MM-DD\x20HH:mm:ss','getMustacheRender','message','from','phone','read','subject','startsWith','Re:','Re:\x20','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Message','inReplyTo','messageId','html','','replace','','headers','auto-replied','auto_reply','sendMailMessage','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','Interaction','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','resolve','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','lodash','moment','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','consequence','channel'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3881,0xc3));var _0x1388=function(_0x344bc8,_0x2fa54a){_0x344bc8=_0x344bc8-0x0;var _0x1e83a4=_0x3881[_0x344bc8];return _0x1e83a4;};'use strict';var _=require(_0x1388('0x0'));var moment=require(_0x1388('0x1'));var utils=require(_0x1388('0x2'));var logger=require(_0x1388('0x3'))('routing');var rpc={'chatMessage':require(_0x1388('0x4')),'openchannelMessage':require(_0x1388('0x5')),'mailMessage':require(_0x1388('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x1388('0x7')),'whatsappMessage':require(_0x1388('0x8')),'chatInteraction':require(_0x1388('0x9')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'mailInteraction':require(_0x1388('0xa')),'smsInteraction':require(_0x1388('0xb')),'faxInteraction':require(_0x1388('0xc')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var mailRpc=require('../../mailRpc');exports[_0x1388('0xd')]=function(_0x1fbf36,_0x49029b,_0x32dc7d,_0x59007e){return function(_0xea5cc3){try{var _0x1eb2cb=this[_0x1388('0xe')];if(_0x1eb2cb===_0x1388('0xf')&&_0x59007e[_0x1388('0x10')][_0x1388('0x11')]){logger[_0x1388('0x12')](_0x1388('0x13'),_0x1fbf36,_0x1388('0x14'));return _0xea5cc3[_0x1388('0x15')]();}if(_0x49029b[0x0]==='1'&&(_[_0x1388('0x16')](this['interaction'][_0x1388('0x17')])||!this[_0x1388('0x18')]['created'])){logger[_0x1388('0x12')](_0x1388('0x13'),_0x1fbf36,_0x1388('0x19'));return _0xea5cc3[_0x1388('0x15')]();}if(_0x49029b[0x0]==='2'&&this[_0x1388('0x18')][_0x1388('0x1a')]){logger[_0x1388('0x12')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x1fbf36,'One\x20Time\x20already\x20sent');return _0xea5cc3[_0x1388('0x15')]();}var _0x5e9865={'ContactId':this['contact']['id'],'sentAt':moment()['format'](_0x1388('0x1b')),'direction':'out'};if(this['channel']===_0x1388('0xf')){_0x5e9865[_0x1388('0x10')]=utils[_0x1388('0x1c')](_0x49029b[0x2],this);}else{_0x5e9865[_0x1388('0x10')]=utils[_0x1388('0x1c')](_0x49029b[0x1],this);}if(this[_0x1388('0x1d')]){_0x5e9865['to']=this[_0x1388('0x1d')][_0x1388('0x1e')]||'';if(this[_0x1388('0xe')]===_0x1388('0xf')&&_0x49029b[0x1]==='1'){_0x5e9865['cc']=this[_0x1388('0x1d')]['cc']||'';}_0x5e9865['from']=this[_0x1388('0x1d')]['to']||'';_0x5e9865[_0x1388('0x1f')]=this[_0x1388('0x1d')]['phone']||'';_0x5e9865[_0x1388('0x20')]=!![];if(this['message'][_0x1388('0x21')]){_0x5e9865[_0x1388('0x21')]='';_0x5e9865['subject']+=_[_0x1388('0x22')](this[_0x1388('0x1d')]['subject'],_0x1388('0x23'))?'':_0x1388('0x24');_0x5e9865[_0x1388('0x21')]+=this[_0x1388('0x1d')][_0x1388('0x21')];}}if(this[_0x1388('0xe')]==='chat'){_0x5e9865[_0x1388('0x25')]=this[_0x1388('0x26')]['id'];}else{_0x5e9865[_[_0x1388('0x27')](this['channel'])+_0x1388('0x28')]=this['account']['id'];}_0x5e9865[_[_0x1388('0x27')](this['channel'])+_0x1388('0x29')]=this['interaction']['id'];var _0x2f3b48=this[_0x1388('0x18')];if(rpc[this[_0x1388('0xe')]+_0x1388('0x2a')]){if(this['channel']===_0x1388('0xf')){_0x5e9865[_0x1388('0x2b')]=this[_0x1388('0x1d')][_0x1388('0x2c')];_0x5e9865[_0x1388('0x2d')]=_0x1388('0x2e')+_[_0x1388('0x2f')](_0x5e9865['body'],_0x1388('0x30'),_0x1388('0x31'))+_0x1388('0x32');_0x5e9865[_0x1388('0x33')]={'Auto-Submitted':_0x1388('0x34'),'X-Auto-Response-Suppress':'All','Precedence':_0x1388('0x35')};return mailRpc[_0x1388('0x36')](this['account'][_0x1388('0x37')],_0x5e9865)[_0x1388('0x38')](function(_0x5e686e){logger[_0x1388('0x12')](_0x1388('0x39'),_0x1fbf36);_0x5e9865[_0x1388('0x2c')]=_0x5e686e[_0x1388('0x1d')][_0x1388('0x2c')];return rpc[_0x1eb2cb+_0x1388('0x2a')][_0x1388('0x3a')](_0x5e9865);})['then'](function(_0x17176e){logger[_0x1388('0x12')](_0x1388('0x13'),_0x1fbf36,JSON[_0x1388('0x3b')](_0x17176e));})[_0x1388('0x3c')](function(_0xe6eda1){logger[_0x1388('0x3d')](_0x1388('0x3e'),_0x1fbf36,JSON[_0x1388('0x3b')](_0xe6eda1));})[_0x1388('0x3f')](function(){Promise['resolve']()[_0x1388('0x38')](function(){if(_0x49029b[0x0]!=='2'||_0x2f3b48['autoreplyExecuted'])return;return rpc[_0x1eb2cb+_0x1388('0x40')]['update'](_0x2f3b48['id'],{'autoreplyExecuted':!![]})[_0x1388('0x38')](function(_0x434940){logger[_0x1388('0x12')](_0x1388('0x41'),_0x1fbf36,JSON['stringify'](_0x434940));})[_0x1388('0x3c')](function(_0x5adbe2){logger['error']('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x1fbf36,JSON[_0x1388('0x3b')](_0x5adbe2));});})[_0x1388('0x38')](function(){_0xea5cc3[_0x1388('0x15')]();});});}else{return rpc[this[_0x1388('0xe')]+_0x1388('0x2a')]['create'](_0x5e9865)[_0x1388('0x38')](function(){logger[_0x1388('0x12')](_0x1388('0x13'),_0x1fbf36,_0x5e9865[_0x1388('0x10')]);})['catch'](function(_0x4cc1ed){logger[_0x1388('0x3d')]('[%s][AUTOREPLY]\x20%s',_0x1fbf36,JSON['stringify'](_0x4cc1ed));})[_0x1388('0x3f')](function(){Promise[_0x1388('0x42')]()['then'](function(){if(_0x49029b[0x0]!=='2'||_0x2f3b48['autoreplyExecuted'])return;return rpc[_0x1eb2cb+_0x1388('0x40')][_0x1388('0x43')](_0x2f3b48['id'],{'autoreplyExecuted':!![]})[_0x1388('0x38')](function(_0x3b3416){logger[_0x1388('0x12')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x1fbf36,JSON['stringify'](_0x3b3416));})[_0x1388('0x3c')](function(_0x12c822){logger[_0x1388('0x3d')](_0x1388('0x44'),_0x1fbf36,JSON[_0x1388('0x3b')](_0x12c822));});})[_0x1388('0x38')](function(){_0xea5cc3[_0x1388('0x15')]();});});}}}catch(_0xe08fc9){logger[_0x1388('0x3d')](_0x1388('0x13'),_0x1fbf36,JSON[_0x1388('0x3b')](_0xe08fc9));_0xea5cc3[_0x1388('0x45')]();}};}; \ No newline at end of file +var _0xa28e=['chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Message','messageId','html','','','auto-replied','All','sendMailMessage','then','create','stringify','catch','[RPC][%s][AUTOREPLY]\x20%s','finally','Interaction','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','error','resolve','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','lodash','moment','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','mail','body','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','interaction','created','Autoreply\x20already\x20sent','autoreplyExecuted','One\x20Time\x20already\x20sent','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','getMustacheRender','message','from','phone','read','subject','startsWith','Re:'];(function(_0xe20333,_0x2bce45){var _0x5ef2ad=function(_0xcc07de){while(--_0xcc07de){_0xe20333['push'](_0xe20333['shift']());}};_0x5ef2ad(++_0x2bce45);}(_0xa28e,0x12c));var _0xea28=function(_0x503055,_0x304102){_0x503055=_0x503055-0x0;var _0x30fb63=_0xa28e[_0x503055];return _0x30fb63;};'use strict';var _=require(_0xea28('0x0'));var moment=require(_0xea28('0x1'));var utils=require(_0xea28('0x2'));var logger=require(_0xea28('0x3'))('routing');var rpc={'chatMessage':require(_0xea28('0x4')),'openchannelMessage':require(_0xea28('0x5')),'mailMessage':require(_0xea28('0x6')),'smsMessage':require(_0xea28('0x7')),'faxMessage':require(_0xea28('0x8')),'whatsappMessage':require(_0xea28('0x9')),'chatInteraction':require(_0xea28('0xa')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'mailInteraction':require(_0xea28('0xb')),'smsInteraction':require(_0xea28('0xc')),'faxInteraction':require(_0xea28('0xd')),'whatsappInteraction':require(_0xea28('0xe'))};var mailRpc=require(_0xea28('0xf'));exports[_0xea28('0x10')]=function(_0x4730f3,_0x2b6356,_0x49500b,_0x360ba4){return function(_0x4e6902){try{var _0x521c64=this['channel'];if(_0x521c64===_0xea28('0x11')&&_0x360ba4[_0xea28('0x12')]['isAutoreply']){logger[_0xea28('0x13')](_0xea28('0x14'),_0x4730f3,_0xea28('0x15'));return _0x4e6902[_0xea28('0x16')]();}if(_0x2b6356[0x0]==='1'&&(_['isNil'](this[_0xea28('0x17')]['created'])||!this[_0xea28('0x17')][_0xea28('0x18')])){logger[_0xea28('0x13')](_0xea28('0x14'),_0x4730f3,_0xea28('0x19'));return _0x4e6902[_0xea28('0x16')]();}if(_0x2b6356[0x0]==='2'&&this['interaction'][_0xea28('0x1a')]){logger['info']('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x4730f3,_0xea28('0x1b'));return _0x4e6902['next']();}var _0x20af1a={'ContactId':this[_0xea28('0x1c')]['id'],'sentAt':moment()[_0xea28('0x1d')](_0xea28('0x1e')),'direction':'out'};if(this[_0xea28('0x1f')]==='mail'){_0x20af1a[_0xea28('0x12')]=utils[_0xea28('0x20')](_0x2b6356[0x2],this);}else{_0x20af1a[_0xea28('0x12')]=utils[_0xea28('0x20')](_0x2b6356[0x1],this);}if(this[_0xea28('0x21')]){_0x20af1a['to']=this[_0xea28('0x21')][_0xea28('0x22')]||'';if(this[_0xea28('0x1f')]===_0xea28('0x11')&&_0x2b6356[0x1]==='1'){_0x20af1a['cc']=this[_0xea28('0x21')]['cc']||'';}_0x20af1a[_0xea28('0x22')]=this[_0xea28('0x21')]['to']||'';_0x20af1a[_0xea28('0x23')]=this['message']['phone']||'';_0x20af1a[_0xea28('0x24')]=!![];if(this[_0xea28('0x21')]['subject']){_0x20af1a[_0xea28('0x25')]='';_0x20af1a[_0xea28('0x25')]+=_[_0xea28('0x26')](this[_0xea28('0x21')][_0xea28('0x25')],_0xea28('0x27'))?'':'Re:\x20';_0x20af1a[_0xea28('0x25')]+=this[_0xea28('0x21')][_0xea28('0x25')];}}if(this['channel']===_0xea28('0x28')){_0x20af1a[_0xea28('0x29')]=this[_0xea28('0x2a')]['id'];}else{_0x20af1a[_[_0xea28('0x2b')](this[_0xea28('0x1f')])+_0xea28('0x2c')]=this['account']['id'];}_0x20af1a[_[_0xea28('0x2b')](this[_0xea28('0x1f')])+_0xea28('0x2d')]=this[_0xea28('0x17')]['id'];var _0x3222b7=this[_0xea28('0x17')];if(rpc[this[_0xea28('0x1f')]+_0xea28('0x2e')]){if(this['channel']==='mail'){_0x20af1a['inReplyTo']=this[_0xea28('0x21')][_0xea28('0x2f')];_0x20af1a[_0xea28('0x30')]=_0xea28('0x31')+_['replace'](_0x20af1a[_0xea28('0x12')],_0xea28('0x32'),_0xea28('0x33'))+_0xea28('0x34');_0x20af1a['headers']={'Auto-Submitted':_0xea28('0x35'),'X-Auto-Response-Suppress':_0xea28('0x36'),'Precedence':'auto_reply'};return mailRpc[_0xea28('0x37')](this[_0xea28('0x2a')]['smtpOptions'],_0x20af1a)[_0xea28('0x38')](function(_0x2f4072){logger[_0xea28('0x13')]('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0x4730f3);_0x20af1a['messageId']=_0x2f4072[_0xea28('0x21')][_0xea28('0x2f')];return rpc[_0x521c64+_0xea28('0x2e')][_0xea28('0x39')](_0x20af1a);})[_0xea28('0x38')](function(_0x44b56e){logger['info'](_0xea28('0x14'),_0x4730f3,JSON[_0xea28('0x3a')](_0x44b56e));})[_0xea28('0x3b')](function(_0x4a605a){logger['error'](_0xea28('0x3c'),_0x4730f3,JSON['stringify'](_0x4a605a));})[_0xea28('0x3d')](function(){Promise['resolve']()[_0xea28('0x38')](function(){if(_0x2b6356[0x0]!=='2'||_0x3222b7['autoreplyExecuted'])return;return rpc[_0x521c64+_0xea28('0x3e')]['update'](_0x3222b7['id'],{'autoreplyExecuted':!![]})[_0xea28('0x38')](function(_0x280b91){logger[_0xea28('0x13')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x4730f3,JSON[_0xea28('0x3a')](_0x280b91));})[_0xea28('0x3b')](function(_0x23f600){logger['error'](_0xea28('0x3f'),_0x4730f3,JSON['stringify'](_0x23f600));});})[_0xea28('0x38')](function(){_0x4e6902[_0xea28('0x16')]();});});}else{return rpc[this[_0xea28('0x1f')]+_0xea28('0x2e')][_0xea28('0x39')](_0x20af1a)[_0xea28('0x38')](function(){logger[_0xea28('0x13')](_0xea28('0x14'),_0x4730f3,_0x20af1a[_0xea28('0x12')]);})[_0xea28('0x3b')](function(_0x1c3aad){logger[_0xea28('0x40')](_0xea28('0x14'),_0x4730f3,JSON[_0xea28('0x3a')](_0x1c3aad));})[_0xea28('0x3d')](function(){Promise[_0xea28('0x41')]()[_0xea28('0x38')](function(){if(_0x2b6356[0x0]!=='2'||_0x3222b7[_0xea28('0x1a')])return;return rpc[_0x521c64+_0xea28('0x3e')]['update'](_0x3222b7['id'],{'autoreplyExecuted':!![]})[_0xea28('0x38')](function(_0x2474a1){logger[_0xea28('0x13')](_0xea28('0x42'),_0x4730f3,JSON[_0xea28('0x3a')](_0x2474a1));})[_0xea28('0x3b')](function(_0x5edbd7){logger[_0xea28('0x40')](_0xea28('0x3f'),_0x4730f3,JSON[_0xea28('0x3a')](_0x5edbd7));});})[_0xea28('0x38')](function(){_0x4e6902[_0xea28('0x16')]();});});}}}catch(_0x4fd7f6){logger[_0xea28('0x40')](_0xea28('0x14'),_0x4730f3,JSON[_0xea28('0x3a')](_0x4fd7f6));_0x4e6902[_0xea28('0x43')]();}};}; \ 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 c1a0841..96e2689 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 _0x4cb4=['format','YYYY-MM-DD\x20HH:mm:ss','channel','Interaction','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','[%s][CLOSE]\x20%s','stringify','finally','stop','error','moment','../../../../config/logger','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence'];(function(_0x36d14b,_0x1ba5eb){var _0x4be643=function(_0x2f638f){while(--_0x2f638f){_0x36d14b['push'](_0x36d14b['shift']());}};_0x4be643(++_0x1ba5eb);}(_0x4cb4,0x1ef));var _0x44cb=function(_0xa5a920,_0x2d8772){_0xa5a920=_0xa5a920-0x0;var _0x596618=_0x4cb4[_0xa5a920];return _0x596618;};'use strict';var moment=require(_0x44cb('0x0'));var logger=require(_0x44cb('0x1'))('routing');var rpc={'chatInteraction':require(_0x44cb('0x2')),'openchannelInteraction':require(_0x44cb('0x3')),'smsInteraction':require(_0x44cb('0x4')),'mailInteraction':require(_0x44cb('0x5')),'faxInteraction':require(_0x44cb('0x6')),'whatsappInteraction':require(_0x44cb('0x7'))};exports[_0x44cb('0x8')]=function(_0x52b3df,_0x2a80c5,_0x7a10a0,_0x113ed0){return function(_0x42e8c9){try{logger['info']('[%s][CLOSE]\x20reason\x20%s',_0x52b3df,_0x2a80c5[0x0]);var _0x14457b={'closed':0x1,'closedAt':moment()[_0x44cb('0x9')](_0x44cb('0xa')),'closeReason':'system','disposition':_0x2a80c5[0x0]};if(rpc[_0x113ed0[_0x44cb('0xb')]+_0x44cb('0xc')]){rpc[_0x113ed0[_0x44cb('0xb')]+_0x44cb('0xc')]['update'](_0x113ed0[_0x44cb('0xd')]['id'],_0x14457b)[_0x44cb('0xe')](function(_0x542b4c){logger['info'](_0x44cb('0xf'),_0x52b3df,_0x113ed0[_0x44cb('0xd')]['id']);})['catch'](function(_0x247df4){logger['error'](_0x44cb('0x10'),_0x52b3df,JSON[_0x44cb('0x11')](_0x247df4));})[_0x44cb('0x12')](function(){_0x42e8c9[_0x44cb('0x13')]();});}}catch(_0x2b8fc0){logger[_0x44cb('0x14')](_0x44cb('0x10'),_0x52b3df,JSON[_0x44cb('0x11')](_0x2b8fc0));_0x42e8c9[_0x44cb('0x13')]();}};}; \ No newline at end of file +var _0x6986=['routing','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','format','system','channel','Interaction','update','interaction','then','catch','error','[%s][CLOSE]\x20%s','finally','stop'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x6986,0x118));var _0x6698=function(_0x5a7dd3,_0x26b7cf){_0x5a7dd3=_0x5a7dd3-0x0;var _0x2f4d07=_0x6986[_0x5a7dd3];return _0x2f4d07;};'use strict';var moment=require('moment');var logger=require('../../../../config/logger')(_0x6698('0x0'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x6698('0x1')),'smsInteraction':require(_0x6698('0x2')),'mailInteraction':require(_0x6698('0x3')),'faxInteraction':require(_0x6698('0x4')),'whatsappInteraction':require(_0x6698('0x5'))};exports[_0x6698('0x6')]=function(_0x34b0b0,_0x13e946,_0x40f8ab,_0x23294d){return function(_0x1a9b34){try{logger[_0x6698('0x7')]('[%s][CLOSE]\x20reason\x20%s',_0x34b0b0,_0x13e946[0x0]);var _0x1d6be5={'closed':0x1,'closedAt':moment()[_0x6698('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'closeReason':_0x6698('0x9'),'disposition':_0x13e946[0x0]};if(rpc[_0x23294d[_0x6698('0xa')]+'Interaction']){rpc[_0x23294d[_0x6698('0xa')]+_0x6698('0xb')][_0x6698('0xc')](_0x23294d[_0x6698('0xd')]['id'],_0x1d6be5)[_0x6698('0xe')](function(_0x246969){logger[_0x6698('0x7')]('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0x34b0b0,_0x23294d[_0x6698('0xd')]['id']);})[_0x6698('0xf')](function(_0x3fb986){logger[_0x6698('0x10')](_0x6698('0x11'),_0x34b0b0,JSON['stringify'](_0x3fb986));})[_0x6698('0x12')](function(){_0x1a9b34[_0x6698('0x13')]();});}}catch(_0x319a87){logger[_0x6698('0x10')]('[%s][CLOSE]\x20%s',_0x34b0b0,JSON['stringify'](_0x319a87));_0x1a9b34[_0x6698('0x13')]();}};}; \ 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 729019d..f015760 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 _0x2484=['Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','out','channel','sms','phone','chat','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','then','catch','error','stringify','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','message','dialogflow','result','speech','providerName','providerResponse','metadata','endConversation','lodash','moment','md5','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s'];(function(_0x3168e3,_0x9d4dcd){var _0x447d23=function(_0xb263e0){while(--_0xb263e0){_0x3168e3['push'](_0x3168e3['shift']());}};_0x447d23(++_0x9d4dcd);}(_0x2484,0x178));var _0x4248=function(_0x3f7855,_0x535342){_0x3f7855=_0x3f7855-0x0;var _0x301fb7=_0x2484[_0x3f7855];return _0x301fb7;};'use strict';var _=require(_0x4248('0x0'));var moment=require(_0x4248('0x1'));var apiai=require('apiai-promise');var md5=require(_0x4248('0x2'));var utils=require(_0x4248('0x3'));var logger=require(_0x4248('0x4'))(_0x4248('0x5'));var rpc={'chatMessage':require(_0x4248('0x6')),'openchannelMessage':require(_0x4248('0x7')),'mailMessage':require(_0x4248('0x8')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x4248('0x9')),'whatsappMessage':require(_0x4248('0xa'))};exports[_0x4248('0xb')]=function(_0x189f42,_0x412c18){return function(_0x14500e){try{if(!_['isNil'](this[_0x4248('0xc')][_0x4248('0xd')])){logger[_0x4248('0xe')](_0x4248('0xf'),_0x189f42,_0x4248('0x10'));return _0x14500e[_0x4248('0x11')]();}var _0x13cb06={'ContactId':this['contact']['id'],'sentAt':moment()[_0x4248('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x4248('0x13')};if(this[_0x4248('0x14')]===_0x4248('0x15')||this['channel']==='whatsapp'){_0x13cb06[_0x4248('0x16')]=this['interaction'][_0x4248('0x16')];}var _0xf4efc8=this[_0x4248('0x14')];if(_0xf4efc8===_0x4248('0x17')){_0x13cb06[_0x4248('0x18')]=this['account']['id'];}else{_0x13cb06[_[_0x4248('0x19')](_0xf4efc8)+_0x4248('0x1a')]=this[_0x4248('0x1b')]['id'];}_0x13cb06[_[_0x4248('0x19')](_0xf4efc8)+_0x4248('0x1c')]=this['interaction']['id'];if(this[_0x4248('0xc')][_0x4248('0x1d')]){var _0x3283f2=_0x412c18[0x2];if(!_[_0x4248('0x1e')](_0x3283f2)){_0x13cb06[_0x4248('0x1f')]=utils[_0x4248('0x20')](_0x3283f2,this);return rpc[_0xf4efc8+_0x4248('0x21')][_0x4248('0x22')](_0x13cb06)[_0x4248('0x23')](function(_0xd03b87){logger[_0x4248('0xe')](_0x4248('0xf'),_0x189f42,_0x13cb06[_0x4248('0x1f')]);})[_0x4248('0x24')](function(_0x1d8821){logger[_0x4248('0x25')](_0x4248('0xf'),_0x189f42,JSON[_0x4248('0x26')](_0x1d8821));})['finally'](function(){logger[_0x4248('0xe')](_0x4248('0x27'),_0x189f42);_0x14500e[_0x4248('0x28')]();});}else{logger[_0x4248('0xe')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x189f42);_0x14500e[_0x4248('0x28')]();}}else{var _0x37b1b3=this;var _0x30b232=apiai(_0x412c18[0x0],{'language':_0x412c18[0x1]||'en'});return _0x30b232['textRequest'](this[_0x4248('0x29')][_0x4248('0x1f')],{'sessionId':md5(this['interaction']['id'])})[_0x4248('0x23')](function(_0x598681){_0x37b1b3[_0x4248('0x1f')][_0x4248('0x2a')]=_0x598681;_0x13cb06[_0x4248('0x1f')]=_0x598681[_0x4248('0x2b')]['fulfillment'][_0x4248('0x2c')];_0x13cb06[_0x4248('0x2d')]=_0x4248('0x2a');_0x13cb06[_0x4248('0x2e')]=JSON[_0x4248('0x26')](_0x598681);return rpc[_0xf4efc8+_0x4248('0x21')][_0x4248('0x22')](_0x13cb06)[_0x4248('0x23')](function(_0x74b7e0){logger[_0x4248('0xe')](_0x4248('0xf'),_0x189f42,_0x13cb06[_0x4248('0x1f')]);if(_0x598681[_0x4248('0x2b')][_0x4248('0x2f')][_0x4248('0x30')]){_0x14500e[_0x4248('0x11')]();}else{_0x14500e['stop']();}})[_0x4248('0x24')](function(_0x40ca90){logger[_0x4248('0x25')]('[%s][DIALOGFLOW]\x20%s',_0x189f42,JSON[_0x4248('0x26')](_0x40ca90));_0x14500e[_0x4248('0x11')]();});})[_0x4248('0x24')](function(_0x45dd44){logger[_0x4248('0x25')](_0x4248('0xf'),_0x189f42,_0x45dd44[_0x4248('0x29')]);_0x14500e['next']();});}}catch(_0x5d665d){logger['error']('[%s][DIALOGFLOW]\x20%s',_0x189f42,JSON['stringify'](_0x5d665d));_0x14500e['stop']();}};}; \ No newline at end of file +var _0xee3c=['../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','phone','upperFirst','AccountId','InteractionId','isEmpty','getMustacheRender','Message','create','then','body','catch','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','result','providerName','providerResponse','endConversation','next','message','lodash','moment','apiai-promise','md5','./utils','../../../../config/logger'];(function(_0xf98d90,_0x2f6f8c){var _0xd67583=function(_0x476676){while(--_0x476676){_0xf98d90['push'](_0xf98d90['shift']());}};_0xd67583(++_0x2f6f8c);}(_0xee3c,0x14a));var _0xcee3=function(_0x331c17,_0x583eae){_0x331c17=_0x331c17-0x0;var _0x257d6f=_0xee3c[_0x331c17];return _0x257d6f;};'use strict';var _=require(_0xcee3('0x0'));var moment=require(_0xcee3('0x1'));var apiai=require(_0xcee3('0x2'));var md5=require(_0xcee3('0x3'));var utils=require(_0xcee3('0x4'));var logger=require(_0xcee3('0x5'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xcee3('0x6')),'mailMessage':require(_0xcee3('0x7')),'smsMessage':require(_0xcee3('0x8')),'faxMessage':require(_0xcee3('0x9')),'whatsappMessage':require(_0xcee3('0xa'))};exports[_0xcee3('0xb')]=function(_0x3b8ffe,_0x97f00e){return function(_0x22953c){try{if(!_[_0xcee3('0xc')](this[_0xcee3('0xd')][_0xcee3('0xe')])){logger[_0xcee3('0xf')](_0xcee3('0x10'),_0x3b8ffe,_0xcee3('0x11'));return _0x22953c['next']();}var _0x1ed6a6={'ContactId':this[_0xcee3('0x12')]['id'],'sentAt':moment()[_0xcee3('0x13')](_0xcee3('0x14')),'direction':_0xcee3('0x15')};if(this[_0xcee3('0x16')]==='sms'||this[_0xcee3('0x16')]===_0xcee3('0x17')){_0x1ed6a6[_0xcee3('0x18')]=this[_0xcee3('0xd')][_0xcee3('0x18')];}var _0x520ac6=this[_0xcee3('0x16')];if(_0x520ac6==='chat'){_0x1ed6a6['ChatWebsiteId']=this['account']['id'];}else{_0x1ed6a6[_[_0xcee3('0x19')](_0x520ac6)+_0xcee3('0x1a')]=this['account']['id'];}_0x1ed6a6[_['upperFirst'](_0x520ac6)+_0xcee3('0x1b')]=this['interaction']['id'];if(this[_0xcee3('0xd')]['created']){var _0x3471d1=_0x97f00e[0x2];if(!_[_0xcee3('0x1c')](_0x3471d1)){_0x1ed6a6['body']=utils[_0xcee3('0x1d')](_0x3471d1,this);return rpc[_0x520ac6+_0xcee3('0x1e')][_0xcee3('0x1f')](_0x1ed6a6)[_0xcee3('0x20')](function(_0x50bf6e){logger[_0xcee3('0xf')](_0xcee3('0x10'),_0x3b8ffe,_0x1ed6a6[_0xcee3('0x21')]);})[_0xcee3('0x22')](function(_0x52f4d7){logger[_0xcee3('0x23')](_0xcee3('0x10'),_0x3b8ffe,JSON[_0xcee3('0x24')](_0x52f4d7));})[_0xcee3('0x25')](function(){logger[_0xcee3('0xf')](_0xcee3('0x26'),_0x3b8ffe);_0x22953c[_0xcee3('0x27')]();});}else{logger[_0xcee3('0xf')](_0xcee3('0x28'),_0x3b8ffe);_0x22953c[_0xcee3('0x27')]();}}else{var _0x40dd10=this;var _0xa1efbf=apiai(_0x97f00e[0x0],{'language':_0x97f00e[0x1]||'en'});return _0xa1efbf[_0xcee3('0x29')](this['message'][_0xcee3('0x21')],{'sessionId':md5(this[_0xcee3('0xd')]['id'])})[_0xcee3('0x20')](function(_0x1ee247){_0x40dd10[_0xcee3('0x21')]['dialogflow']=_0x1ee247;_0x1ed6a6['body']=_0x1ee247[_0xcee3('0x2a')]['fulfillment']['speech'];_0x1ed6a6[_0xcee3('0x2b')]='dialogflow';_0x1ed6a6[_0xcee3('0x2c')]=JSON[_0xcee3('0x24')](_0x1ee247);return rpc[_0x520ac6+_0xcee3('0x1e')]['create'](_0x1ed6a6)[_0xcee3('0x20')](function(_0x47f32c){logger[_0xcee3('0xf')]('[%s][DIALOGFLOW]\x20%s',_0x3b8ffe,_0x1ed6a6[_0xcee3('0x21')]);if(_0x1ee247[_0xcee3('0x2a')]['metadata'][_0xcee3('0x2d')]){_0x22953c[_0xcee3('0x2e')]();}else{_0x22953c['stop']();}})[_0xcee3('0x22')](function(_0x4ef9da){logger['error'](_0xcee3('0x10'),_0x3b8ffe,JSON['stringify'](_0x4ef9da));_0x22953c[_0xcee3('0x2e')]();});})[_0xcee3('0x22')](function(_0x375cab){logger[_0xcee3('0x23')](_0xcee3('0x10'),_0x3b8ffe,_0x375cab[_0xcee3('0x2f')]);_0x22953c[_0xcee3('0x2e')]();});}}catch(_0x5ce5be){logger[_0xcee3('0x23')]('[%s][DIALOGFLOW]\x20%s',_0x3b8ffe,JSON[_0xcee3('0x24')](_0x5ce5be));_0x22953c[_0xcee3('0x27')]();}};}; \ 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 2e1293c..671ce70 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 _0xf5ac=['message','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ENDCONVERSATION','end_conversation','DIALOGFLOWV2_INTENTNAME','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','DIALOGFLOWV2_QUERYTEXT','intentDetectionConfidence','fulfillmentText','push','all','next','stack','lodash','dialogflow','moment','bluebird','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','Message','create','then','info','[%s][DIALOGFLOWV2]\x20%s','catch','error','stringify','consequence','isNil','UserId','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','AccountId','upperFirst','InteractionId','interaction','created','getMustacheRender','body','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','replace','SessionsClient','sessionPath'];(function(_0x23a089,_0x4b040a){var _0x45b4d3=function(_0x4c93d7){while(--_0x4c93d7){_0x23a089['push'](_0x23a089['shift']());}};_0x45b4d3(++_0x4b040a);}(_0xf5ac,0x136));var _0xcf5a=function(_0x4b2375,_0x428645){_0x4b2375=_0x4b2375-0x0;var _0x1dbd13=_0xf5ac[_0x4b2375];return _0x1dbd13;};'use strict';var _=require(_0xcf5a('0x0'));var dialogflow=require(_0xcf5a('0x1'));var md5=require('md5');var moment=require(_0xcf5a('0x2'));var Promise=require(_0xcf5a('0x3'));var logger=require('../../../../config/logger')(_0xcf5a('0x4'));var utils=require('./utils');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xcf5a('0x5')),'mailMessage':require(_0xcf5a('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xcf5a('0x7')),'whatsappMessage':require(_0xcf5a('0x8'))};function createMessage(_0x48462b,_0x347ef8,_0x497880,_0x2fe275){return new Promise(function(_0x1244d4,_0x3d6e48){var _0x1b8517=_[_0xcf5a('0x9')](_0x497880);_0x1b8517['body']=_0x2fe275;return rpc[_0x347ef8+_0xcf5a('0xa')][_0xcf5a('0xb')](_0x1b8517)[_0xcf5a('0xc')](function(){logger[_0xcf5a('0xd')](_0xcf5a('0xe'),_0x48462b,_0x1b8517['body']);_0x1244d4();})[_0xcf5a('0xf')](function(_0x220278){logger[_0xcf5a('0x10')](_0xcf5a('0xe'),_0x48462b,JSON[_0xcf5a('0x11')](_0x220278));_0x3d6e48(_0x220278);});});}exports[_0xcf5a('0x12')]=function(_0x3da9fc,_0x3c3c80){return function(_0x57f8e9){try{if(!_[_0xcf5a('0x13')](this['interaction'][_0xcf5a('0x14')])){logger['info'](_0xcf5a('0xe'),_0x3da9fc,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x57f8e9['next']();}var _0x1960a1={'ContactId':this['contact']['id'],'sentAt':moment()[_0xcf5a('0x15')](_0xcf5a('0x16')),'direction':_0xcf5a('0x17')};if(this[_0xcf5a('0x18')]===_0xcf5a('0x19')||this[_0xcf5a('0x18')]===_0xcf5a('0x1a')){_0x1960a1[_0xcf5a('0x1b')]=this['interaction']['phone'];}var _0x13b7cf=this[_0xcf5a('0x18')];if(_0x13b7cf===_0xcf5a('0x1c')){_0x1960a1[_0xcf5a('0x1d')]=this[_0xcf5a('0x1e')]['id'];}else{_0x1960a1[_['upperFirst'](_0x13b7cf)+_0xcf5a('0x1f')]=this['account']['id'];}_0x1960a1[_[_0xcf5a('0x20')](_0x13b7cf)+_0xcf5a('0x21')]=this[_0xcf5a('0x22')]['id'];if(this[_0xcf5a('0x22')][_0xcf5a('0x23')]){var _0x3861b1=_0x3c3c80[0x4];if(!_['isEmpty'](_0x3861b1)){_0x1960a1['body']=utils[_0xcf5a('0x24')](_0x3861b1,this);return rpc[_0x13b7cf+_0xcf5a('0xa')]['create'](_0x1960a1)['then'](function(_0x53e2b1){logger['info'](_0xcf5a('0xe'),_0x3da9fc,_0x1960a1[_0xcf5a('0x25')]);})[_0xcf5a('0xf')](function(_0x3e2dfc){logger[_0xcf5a('0x10')](_0xcf5a('0xe'),_0x3da9fc,JSON[_0xcf5a('0x11')](_0x3e2dfc));})[_0xcf5a('0x26')](function(){logger['info'](_0xcf5a('0x27'),_0x3da9fc);_0x57f8e9['stop']();});}else{logger[_0xcf5a('0xd')](_0xcf5a('0x28'),_0x3da9fc);_0x57f8e9[_0xcf5a('0x29')]();}}else{var _0x4c9508=this;var _0x155c54=_0x3c3c80[0x2][_0xcf5a('0x2a')](/\\n/g,'\x0a');var _0x1b1628={'credentials':{'private_key':_0x155c54,'client_email':_0x3c3c80[0x1]}};var _0xed0910=new dialogflow[(_0xcf5a('0x2b'))](_0x1b1628);var _0x3417a3=_0xed0910[_0xcf5a('0x2c')](_0x3c3c80[0x0],md5(_0x4c9508['interaction']['id']));var _0xc4d066={'session':_0x3417a3,'queryInput':{'text':{'text':_0x4c9508[_0xcf5a('0x2d')][_0xcf5a('0x25')],'languageCode':_0x3c3c80[0x3]||'en'}}};return _0xed0910[_0xcf5a('0x2e')](_0xc4d066)[_0xcf5a('0xc')](function(_0x2afeb6){if(_0x2afeb6&&_0x2afeb6[_0xcf5a('0x2f')]){_0x4c9508[_0xcf5a('0x25')][_0xcf5a('0x30')]=_0x2afeb6;var _0x4017d8=_0x2afeb6[0x0];var _0x4e9158=_0x4017d8[_0xcf5a('0x31')][_0xcf5a('0x32')]&&_0x4017d8[_0xcf5a('0x31')][_0xcf5a('0x32')][_0xcf5a('0x33')]?_0x4017d8['queryResult'][_0xcf5a('0x32')][_0xcf5a('0x33')]['end_conversation'][_0xcf5a('0x34')]:![];_0x4c9508[_0xcf5a('0x25')][_0xcf5a('0x35')]=_0x4017d8[_0xcf5a('0x31')][_0xcf5a('0x36')];_0x4c9508[_0xcf5a('0x25')]['DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT']=_0x4017d8['queryResult']['allRequiredParamsPresent'];_0x4c9508[_0xcf5a('0x25')][_0xcf5a('0x37')]=_0x4017d8[_0xcf5a('0x31')]['diagnosticInfo']&&_0x4017d8['queryResult'][_0xcf5a('0x32')][_0xcf5a('0x33')]?_0x4017d8[_0xcf5a('0x31')][_0xcf5a('0x32')]['fields'][_0xcf5a('0x38')]['boolValue']:![];_0x4c9508[_0xcf5a('0x25')][_0xcf5a('0x39')]=_0x4017d8[_0xcf5a('0x31')][_0xcf5a('0x3a')][_0xcf5a('0x3b')];_0x4c9508[_0xcf5a('0x25')][_0xcf5a('0x3c')]=_0x4017d8[_0xcf5a('0x31')][_0xcf5a('0x3a')]['displayName'];_0x4c9508[_0xcf5a('0x25')][_0xcf5a('0x3d')]=_0x4017d8[_0xcf5a('0x31')][_0xcf5a('0x3a')][_0xcf5a('0x3e')];_0x4c9508['body'][_0xcf5a('0x3f')]=_0x4017d8['queryResult']['languageCode'];_0x4c9508[_0xcf5a('0x25')][_0xcf5a('0x40')]=_0x4017d8[_0xcf5a('0x31')]['queryText'];_0x4c9508[_0xcf5a('0x25')]['DIALOGFLOWV2_SCORE']=_0x4017d8['queryResult'][_0xcf5a('0x41')];_0x1960a1['providerName']=_0xcf5a('0x30');_0x1960a1['providerResponse']=JSON[_0xcf5a('0x11')](_0x2afeb6);var _0x53ac32=[];for(var _0x3968a6=0x0;_0x3968a6<_0x2afeb6[_0xcf5a('0x2f')];_0x3968a6++){var _0x49bde3=_0x2afeb6[_0x3968a6];if(_0x49bde3&&_0x49bde3[_0xcf5a('0x31')]&&_0x49bde3[_0xcf5a('0x31')][_0xcf5a('0x42')]){_0x53ac32[_0xcf5a('0x43')](createMessage(_0x3da9fc,_0x13b7cf,_0x1960a1,_0x49bde3['queryResult']['fulfillmentText']));}}return Promise[_0xcf5a('0x44')](_0x53ac32)['then'](function(){if(_0x4e9158){_0x57f8e9[_0xcf5a('0x45')]();}else{_0x57f8e9[_0xcf5a('0x29')]();}})['catch'](function(_0x4d088d){logger['error'](_0xcf5a('0xe'),_0x3da9fc,JSON[_0xcf5a('0x11')](_0x4d088d));_0x57f8e9[_0xcf5a('0x45')]();});}})[_0xcf5a('0xf')](function(_0x1dcdb7){logger['error'](_0xcf5a('0xe'),_0x3da9fc,_0x1dcdb7[_0xcf5a('0x2d')],_0x1dcdb7[_0xcf5a('0x46')]);_0x57f8e9[_0xcf5a('0x45')]();});}}catch(_0x1d0c3){logger[_0xcf5a('0x10')]('[%s][DIALOGFLOWV2]\x20%s',_0x3da9fc,JSON[_0xcf5a('0x11')](_0x1d0c3));_0x57f8e9[_0xcf5a('0x29')]();}};}; \ No newline at end of file +var _0xe226=['name','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','languageCode','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','providerResponse','fulfillmentText','push','all','next','stack','dialogflow','md5','moment','bluebird','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body','Message','create','then','info','[%s][DIALOGFLOWV2]\x20%s','catch','error','stringify','consequence','isNil','interaction','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','sms','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','created','isEmpty','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','SessionsClient','message','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','end_conversation','intent'];(function(_0x5d74ba,_0x480528){var _0x23d620=function(_0x2cfea5){while(--_0x2cfea5){_0x5d74ba['push'](_0x5d74ba['shift']());}};_0x23d620(++_0x480528);}(_0xe226,0xe4));var _0x6e22=function(_0x2daac4,_0x4e8fa4){_0x2daac4=_0x2daac4-0x0;var _0x4f5e65=_0xe226[_0x2daac4];return _0x4f5e65;};'use strict';var _=require('lodash');var dialogflow=require(_0x6e22('0x0'));var md5=require(_0x6e22('0x1'));var moment=require(_0x6e22('0x2'));var Promise=require(_0x6e22('0x3'));var logger=require('../../../../config/logger')('routing');var utils=require(_0x6e22('0x4'));var rpc={'chatMessage':require(_0x6e22('0x5')),'openchannelMessage':require(_0x6e22('0x6')),'mailMessage':require(_0x6e22('0x7')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x6e22('0x8')),'whatsappMessage':require(_0x6e22('0x9'))};function createMessage(_0x5ec2be,_0x58f94e,_0x1bafaf,_0x2d7140){return new Promise(function(_0x22dedd,_0x2a4e33){var _0x1e15bc=_[_0x6e22('0xa')](_0x1bafaf);_0x1e15bc[_0x6e22('0xb')]=_0x2d7140;return rpc[_0x58f94e+_0x6e22('0xc')][_0x6e22('0xd')](_0x1e15bc)[_0x6e22('0xe')](function(){logger[_0x6e22('0xf')](_0x6e22('0x10'),_0x5ec2be,_0x1e15bc[_0x6e22('0xb')]);_0x22dedd();})[_0x6e22('0x11')](function(_0x19295a){logger[_0x6e22('0x12')]('[%s][DIALOGFLOWV2]\x20%s',_0x5ec2be,JSON[_0x6e22('0x13')](_0x19295a));_0x2a4e33(_0x19295a);});});}exports[_0x6e22('0x14')]=function(_0xdfe156,_0x35f645){return function(_0x4ecaaf){try{if(!_[_0x6e22('0x15')](this[_0x6e22('0x16')]['UserId'])){logger[_0x6e22('0xf')](_0x6e22('0x10'),_0xdfe156,_0x6e22('0x17'));return _0x4ecaaf['next']();}var _0x4f22c5={'ContactId':this[_0x6e22('0x18')]['id'],'sentAt':moment()[_0x6e22('0x19')](_0x6e22('0x1a')),'direction':_0x6e22('0x1b')};if(this['channel']===_0x6e22('0x1c')||this['channel']===_0x6e22('0x1d')){_0x4f22c5[_0x6e22('0x1e')]=this[_0x6e22('0x16')][_0x6e22('0x1e')];}var _0x402538=this['channel'];if(_0x402538===_0x6e22('0x1f')){_0x4f22c5[_0x6e22('0x20')]=this[_0x6e22('0x21')]['id'];}else{_0x4f22c5[_[_0x6e22('0x22')](_0x402538)+_0x6e22('0x23')]=this[_0x6e22('0x21')]['id'];}_0x4f22c5[_[_0x6e22('0x22')](_0x402538)+'InteractionId']=this['interaction']['id'];if(this['interaction'][_0x6e22('0x24')]){var _0x24b5dd=_0x35f645[0x4];if(!_[_0x6e22('0x25')](_0x24b5dd)){_0x4f22c5[_0x6e22('0xb')]=utils['getMustacheRender'](_0x24b5dd,this);return rpc[_0x402538+'Message'][_0x6e22('0xd')](_0x4f22c5)['then'](function(_0x53544f){logger[_0x6e22('0xf')]('[%s][DIALOGFLOWV2]\x20%s',_0xdfe156,_0x4f22c5[_0x6e22('0xb')]);})[_0x6e22('0x11')](function(_0x31dfa2){logger[_0x6e22('0x12')](_0x6e22('0x10'),_0xdfe156,JSON['stringify'](_0x31dfa2));})[_0x6e22('0x26')](function(){logger[_0x6e22('0xf')](_0x6e22('0x27'),_0xdfe156);_0x4ecaaf['stop']();});}else{logger[_0x6e22('0xf')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0xdfe156);_0x4ecaaf[_0x6e22('0x28')]();}}else{var _0x1379f3=this;var _0x26bc00=_0x35f645[0x2]['replace'](/\\n/g,'\x0a');var _0x1d0cc3={'credentials':{'private_key':_0x26bc00,'client_email':_0x35f645[0x1]}};var _0x2530b2=new dialogflow[(_0x6e22('0x29'))](_0x1d0cc3);var _0x484e9c=_0x2530b2['sessionPath'](_0x35f645[0x0],md5(_0x1379f3[_0x6e22('0x16')]['id']));var _0xf29ded={'session':_0x484e9c,'queryInput':{'text':{'text':_0x1379f3[_0x6e22('0x2a')]['body'],'languageCode':_0x35f645[0x3]||'en'}}};return _0x2530b2[_0x6e22('0x2b')](_0xf29ded)[_0x6e22('0xe')](function(_0x1c42ca){if(_0x1c42ca&&_0x1c42ca[_0x6e22('0x2c')]){_0x1379f3[_0x6e22('0xb')][_0x6e22('0x2d')]=_0x1c42ca;var _0x17b81e=_0x1c42ca[0x0];var _0x3e5505=_0x17b81e[_0x6e22('0x2e')][_0x6e22('0x2f')]&&_0x17b81e['queryResult'][_0x6e22('0x2f')][_0x6e22('0x30')]?_0x17b81e[_0x6e22('0x2e')]['diagnosticInfo'][_0x6e22('0x30')]['end_conversation'][_0x6e22('0x31')]:![];_0x1379f3[_0x6e22('0xb')][_0x6e22('0x32')]=_0x17b81e['queryResult'][_0x6e22('0x33')];_0x1379f3[_0x6e22('0xb')][_0x6e22('0x34')]=_0x17b81e[_0x6e22('0x2e')][_0x6e22('0x35')];_0x1379f3[_0x6e22('0xb')]['DIALOGFLOWV2_ENDCONVERSATION']=_0x17b81e[_0x6e22('0x2e')][_0x6e22('0x2f')]&&_0x17b81e[_0x6e22('0x2e')][_0x6e22('0x2f')][_0x6e22('0x30')]?_0x17b81e[_0x6e22('0x2e')][_0x6e22('0x2f')]['fields'][_0x6e22('0x36')][_0x6e22('0x31')]:![];_0x1379f3[_0x6e22('0xb')]['DIALOGFLOWV2_INTENTNAME']=_0x17b81e[_0x6e22('0x2e')][_0x6e22('0x37')][_0x6e22('0x38')];_0x1379f3[_0x6e22('0xb')]['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0x17b81e['queryResult'][_0x6e22('0x37')][_0x6e22('0x39')];_0x1379f3[_0x6e22('0xb')][_0x6e22('0x3a')]=_0x17b81e['queryResult'][_0x6e22('0x37')][_0x6e22('0x3b')];_0x1379f3['body']['DIALOGFLOWV2_LANGUAGECODE']=_0x17b81e['queryResult'][_0x6e22('0x3c')];_0x1379f3[_0x6e22('0xb')]['DIALOGFLOWV2_QUERYTEXT']=_0x17b81e[_0x6e22('0x2e')][_0x6e22('0x3d')];_0x1379f3[_0x6e22('0xb')][_0x6e22('0x3e')]=_0x17b81e[_0x6e22('0x2e')][_0x6e22('0x3f')];_0x4f22c5[_0x6e22('0x40')]=_0x6e22('0x2d');_0x4f22c5[_0x6e22('0x41')]=JSON[_0x6e22('0x13')](_0x1c42ca);var _0x3f8d57=[];for(var _0x4bcbbd=0x0;_0x4bcbbd<_0x1c42ca[_0x6e22('0x2c')];_0x4bcbbd++){var _0x24f018=_0x1c42ca[_0x4bcbbd];if(_0x24f018&&_0x24f018[_0x6e22('0x2e')]&&_0x24f018['queryResult'][_0x6e22('0x42')]){_0x3f8d57[_0x6e22('0x43')](createMessage(_0xdfe156,_0x402538,_0x4f22c5,_0x24f018[_0x6e22('0x2e')][_0x6e22('0x42')]));}}return Promise[_0x6e22('0x44')](_0x3f8d57)[_0x6e22('0xe')](function(){if(_0x3e5505){_0x4ecaaf[_0x6e22('0x45')]();}else{_0x4ecaaf[_0x6e22('0x28')]();}})[_0x6e22('0x11')](function(_0x12f244){logger['error'](_0x6e22('0x10'),_0xdfe156,JSON[_0x6e22('0x13')](_0x12f244));_0x4ecaaf[_0x6e22('0x45')]();});}})['catch'](function(_0x467932){logger[_0x6e22('0x12')](_0x6e22('0x10'),_0xdfe156,_0x467932[_0x6e22('0x2a')],_0x467932[_0x6e22('0x46')]);_0x4ecaaf['next']();});}}catch(_0x15e189){logger[_0x6e22('0x12')]('[%s][DIALOGFLOWV2]\x20%s',_0xdfe156,JSON[_0x6e22('0x13')](_0x15e189));_0x4ecaaf[_0x6e22('0x28')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index d375bf8..dc6eaa2 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 _0xd1a2=['message','join','stop','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','condition','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','lodash','html-to-text','../../../../config/logger','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','length','error','[%s][GOTOIF]\x20%s'];(function(_0x46a8d1,_0x27a3d0){var _0x5f00bc=function(_0x392410){while(--_0x392410){_0x46a8d1['push'](_0x46a8d1['shift']());}};_0x5f00bc(++_0x27a3d0);}(_0xd1a2,0x1d1));var _0x2d1a=function(_0x3dd152,_0x4a221c){_0x3dd152=_0x3dd152-0x0;var _0x186359=_0xd1a2[_0x3dd152];return _0x186359;};'use strict';var schema=require(_0x2d1a('0x0'));var _=require(_0x2d1a('0x1'));var htmlToText=require(_0x2d1a('0x2'));var utils=require('./utils');var logger=require(_0x2d1a('0x3'))('routing');var gotoif=schema({'condition':{'type':'string','required':!![],'message':_0x2d1a('0x4')},'priorityTrue':{'type':_0x2d1a('0x5'),'message':_0x2d1a('0x6')},'priorityFalse':{'type':'number','message':_0x2d1a('0x7')}});exports[_0x2d1a('0x8')]=function(_0xa882b8,_0x14e241){return function(_0x23bc7b){try{var _0x1281e5={'condition':htmlToText[_0x2d1a('0x9')](utils[_0x2d1a('0xa')](_0x14e241[0x0],this),{'wordwrap':![]})[_0x2d1a('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x14e241[0x1],'priorityFalse':_0x14e241[0x2]};var _0x37d3aa=gotoif[_0x2d1a('0x0')](_0x1281e5,{'typecast':!![]});if(_0x37d3aa[_0x2d1a('0xc')]){logger[_0x2d1a('0xd')](_0x2d1a('0xe'),_0xa882b8,_['map'](_0x37d3aa,_0x2d1a('0xf'))[_0x2d1a('0x10')](',\x20'));_0x23bc7b[_0x2d1a('0x11')]();}else{try{var _0x1d8a02=eval('('+_0x1281e5['condition']+')');var _0x267ff3=_0x1d8a02?_0x1281e5[_0x2d1a('0x12')]:_0x1281e5[_0x2d1a('0x13')];logger[_0x2d1a('0x14')](_0x2d1a('0x15'),_0xa882b8,_0x1281e5[_0x2d1a('0x16')],_0x1d8a02,_0x267ff3||'next');if(_0x267ff3){var _0x19ed4e=_[_0x2d1a('0x17')](_0x23bc7b[_0x2d1a('0x18')](),{'p':_0x267ff3});if(_0x19ed4e>=0x0){logger[_0x2d1a('0x14')](_0x2d1a('0x19'),_0xa882b8,_0x267ff3||'next',_0x19ed4e);_0x23bc7b[_0x2d1a('0x1a')](_0x19ed4e);}else{logger[_0x2d1a('0x14')](_0x2d1a('0x1b'),_0xa882b8,_0x267ff3||_0x2d1a('0x1a'));_0x23bc7b[_0x2d1a('0x11')]();}}else{_0x23bc7b[_0x2d1a('0x1a')]();}}catch(_0x4ee228){logger[_0x2d1a('0xd')](_0x2d1a('0x1c'),_0xa882b8,_0x4ee228[_0x2d1a('0xf')]);_0x23bc7b['stop']();}}}catch(_0xe47f02){logger[_0x2d1a('0xd')](_0x2d1a('0xe'),_0xa882b8,JSON[_0x2d1a('0x1d')](_0xe47f02));_0x23bc7b['stop']();}};}; \ No newline at end of file +var _0xf1e7=['number','consequence','fromString','getMustacheRender','validate','length','error','[%s][GOTOIF]\x20%s','map','message','join','stop','priorityTrue','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','condition','next','findIndex','info','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','stringify','./utils','../../../../config/logger','routing','string','priority\x20true\x20is\x20a\x20number'];(function(_0x17bfea,_0x1be4f8){var _0x130fd0=function(_0x21b6d4){while(--_0x21b6d4){_0x17bfea['push'](_0x17bfea['shift']());}};_0x130fd0(++_0x1be4f8);}(_0xf1e7,0x19b));var _0x7f1e=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xf1e7[_0x2c91e9];return _0x13f0ff;};'use strict';var schema=require('validate');var _=require('lodash');var htmlToText=require('html-to-text');var utils=require(_0x7f1e('0x0'));var logger=require(_0x7f1e('0x1'))(_0x7f1e('0x2'));var gotoif=schema({'condition':{'type':_0x7f1e('0x3'),'required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':'number','message':_0x7f1e('0x4')},'priorityFalse':{'type':_0x7f1e('0x5'),'message':'priority\x20false\x20is\x20a\x20number'}});exports[_0x7f1e('0x6')]=function(_0x1b2907,_0x515bb2){return function(_0x4e7099){try{var _0x2a9a25={'condition':htmlToText[_0x7f1e('0x7')](utils[_0x7f1e('0x8')](_0x515bb2[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x515bb2[0x1],'priorityFalse':_0x515bb2[0x2]};var _0x44c721=gotoif[_0x7f1e('0x9')](_0x2a9a25,{'typecast':!![]});if(_0x44c721[_0x7f1e('0xa')]){logger[_0x7f1e('0xb')](_0x7f1e('0xc'),_0x1b2907,_[_0x7f1e('0xd')](_0x44c721,_0x7f1e('0xe'))[_0x7f1e('0xf')](',\x20'));_0x4e7099[_0x7f1e('0x10')]();}else{try{var _0x4d9e82=eval('('+_0x2a9a25['condition']+')');var _0x39e95d=_0x4d9e82?_0x2a9a25[_0x7f1e('0x11')]:_0x2a9a25['priorityFalse'];logger['info'](_0x7f1e('0x12'),_0x1b2907,_0x2a9a25[_0x7f1e('0x13')],_0x4d9e82,_0x39e95d||_0x7f1e('0x14'));if(_0x39e95d){var _0x54b7cb=_[_0x7f1e('0x15')](_0x4e7099['rules'](),{'p':_0x39e95d});if(_0x54b7cb>=0x0){logger[_0x7f1e('0x16')](_0x7f1e('0x17'),_0x1b2907,_0x39e95d||_0x7f1e('0x14'),_0x54b7cb);_0x4e7099[_0x7f1e('0x14')](_0x54b7cb);}else{logger[_0x7f1e('0x16')](_0x7f1e('0x18'),_0x1b2907,_0x39e95d||_0x7f1e('0x14'));_0x4e7099[_0x7f1e('0x10')]();}}else{_0x4e7099['next']();}}catch(_0x23b4c1){logger[_0x7f1e('0xb')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x1b2907,_0x23b4c1[_0x7f1e('0xe')]);_0x4e7099['stop']();}}}catch(_0x24f3cd){logger[_0x7f1e('0xb')](_0x7f1e('0xc'),_0x1b2907,JSON[_0x7f1e('0x19')](_0x24f3cd));_0x4e7099[_0x7f1e('0x10')]();}};}; \ 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 a3a469a..97a9d95 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 _0xeb06=['[%s][GOTOP]\x20priority\x20%s','priority','findIndex','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','error','stringify','validate','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','length','[%s][GOTOP]\x20%s','map','message','join','stop','info'];(function(_0x4807b4,_0x462c76){var _0x3528c4=function(_0x36e54b){while(--_0x36e54b){_0x4807b4['push'](_0x4807b4['shift']());}};_0x3528c4(++_0x462c76);}(_0xeb06,0x1e7));var _0x6eb0=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xeb06[_0x1facfa];return _0x9ec701;};'use strict';var schema=require(_0x6eb0('0x0'));var _=require(_0x6eb0('0x1'));var logger=require(_0x6eb0('0x2'))(_0x6eb0('0x3'));var gotop=schema({'priority':{'type':_0x6eb0('0x4'),'required':!![],'message':_0x6eb0('0x5')}});exports['consequence']=function(_0x5ab90b,_0x583256){return function(_0x4a2079){try{var _0x11a259={'priority':_0x583256[0x0]};var _0x1ea9db=gotop['validate'](_0x11a259,{'typecast':!![]});if(_0x1ea9db[_0x6eb0('0x6')]){logger['error'](_0x6eb0('0x7'),_0x5ab90b,_[_0x6eb0('0x8')](_0x1ea9db,_0x6eb0('0x9'))[_0x6eb0('0xa')](',\x20'));_0x4a2079[_0x6eb0('0xb')]();}else{logger[_0x6eb0('0xc')](_0x6eb0('0xd'),_0x5ab90b,_0x11a259['priority']);if(_0x11a259[_0x6eb0('0xe')]){var _0x23950b=_[_0x6eb0('0xf')](_0x4a2079['rules'](),{'p':_0x11a259['priority']});if(_0x23950b>=0x0){logger['info'](_0x6eb0('0x10'),_0x5ab90b,_0x11a259[_0x6eb0('0xe')]||'next',_0x23950b);_0x4a2079[_0x6eb0('0x11')](_0x23950b);}else{logger[_0x6eb0('0xc')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x5ab90b,_0x11a259[_0x6eb0('0xe')]||_0x6eb0('0x11'));_0x4a2079[_0x6eb0('0xb')]();}}else{_0x4a2079['next']();}}}catch(_0x50c6c4){logger[_0x6eb0('0x12')](_0x6eb0('0x7'),_0x5ab90b,JSON[_0x6eb0('0x13')](_0x50c6c4));_0x4a2079[_0x6eb0('0xb')]();}};}; \ No newline at end of file +var _0x43dc=['error','stringify','lodash','../../../../config/logger','routing','number','consequence','validate','[%s][GOTOP]\x20%s','map','message','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found'];(function(_0x382e89,_0x4768c0){var _0x3a1318=function(_0x79e1ce){while(--_0x79e1ce){_0x382e89['push'](_0x382e89['shift']());}};_0x3a1318(++_0x4768c0);}(_0x43dc,0x1a6));var _0xc43d=function(_0x44946b,_0xf874ec){_0x44946b=_0x44946b-0x0;var _0x249bc4=_0x43dc[_0x44946b];return _0x249bc4;};'use strict';var schema=require('validate');var _=require(_0xc43d('0x0'));var logger=require(_0xc43d('0x1'))(_0xc43d('0x2'));var gotop=schema({'priority':{'type':_0xc43d('0x3'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0xc43d('0x4')]=function(_0x5c4f6a,_0x4c6735){return function(_0x2a8268){try{var _0x5f4009={'priority':_0x4c6735[0x0]};var _0x5a2616=gotop[_0xc43d('0x5')](_0x5f4009,{'typecast':!![]});if(_0x5a2616['length']){logger['error'](_0xc43d('0x6'),_0x5c4f6a,_[_0xc43d('0x7')](_0x5a2616,_0xc43d('0x8'))[_0xc43d('0x9')](',\x20'));_0x2a8268[_0xc43d('0xa')]();}else{logger[_0xc43d('0xb')](_0xc43d('0xc'),_0x5c4f6a,_0x5f4009[_0xc43d('0xd')]);if(_0x5f4009[_0xc43d('0xd')]){var _0x68ffa7=_[_0xc43d('0xe')](_0x2a8268[_0xc43d('0xf')](),{'p':_0x5f4009['priority']});if(_0x68ffa7>=0x0){logger['info'](_0xc43d('0x10'),_0x5c4f6a,_0x5f4009[_0xc43d('0xd')]||'next',_0x68ffa7);_0x2a8268[_0xc43d('0x11')](_0x68ffa7);}else{logger[_0xc43d('0xb')](_0xc43d('0x12'),_0x5c4f6a,_0x5f4009[_0xc43d('0xd')]||_0xc43d('0x11'));_0x2a8268[_0xc43d('0xa')]();}}else{_0x2a8268['next']();}}}catch(_0x59d416){logger[_0xc43d('0x13')](_0xc43d('0x6'),_0x5c4f6a,JSON[_0xc43d('0x14')](_0x59d416));_0x2a8268[_0xc43d('0xa')]();}};}; \ 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 62b70a2..1ebedb0 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 _0xddcc=['routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','chat','ChatWebsiteId','channel','account','upperFirst','InteractionId','interaction','Message','create','then','body','next','error','stringify','stop','[%s][MESSAGE]\x20%s','lodash','./utils'];(function(_0x3eb017,_0x145f85){var _0x54f041=function(_0x1a65bf){while(--_0x1a65bf){_0x3eb017['push'](_0x3eb017['shift']());}};_0x54f041(++_0x145f85);}(_0xddcc,0x8a));var _0xcddc=function(_0x4cee33,_0x41734b){_0x4cee33=_0x4cee33-0x0;var _0x1e3bed=_0xddcc[_0x4cee33];return _0x1e3bed;};'use strict';var _=require(_0xcddc('0x0'));var utils=require(_0xcddc('0x1'));var logger=require('../../../../config/logger')(_0xcddc('0x2'));var rpc={'chatMessage':require(_0xcddc('0x3')),'openchannelMessage':require(_0xcddc('0x4')),'mailMessage':require(_0xcddc('0x5')),'smsMessage':require(_0xcddc('0x6')),'faxMessage':require(_0xcddc('0x7')),'whatsappMessage':require(_0xcddc('0x8'))};exports[_0xcddc('0x9')]=function(_0x326e63,_0x5766e7){return function(_0x4b25d7){try{var _0x17fd40={'body':utils[_0xcddc('0xa')](_0x5766e7[0x0],this),'ContactId':this[_0xcddc('0xb')]['id']};if(this['channel']===_0xcddc('0xc')){_0x17fd40[_0xcddc('0xd')]=this['account']['id'];}else{_0x17fd40[_['upperFirst'](this[_0xcddc('0xe')])+'AccountId']=this[_0xcddc('0xf')]['id'];}_0x17fd40[_[_0xcddc('0x10')](this[_0xcddc('0xe')])+_0xcddc('0x11')]=this[_0xcddc('0x12')]['id'];if(rpc[this[_0xcddc('0xe')]+_0xcddc('0x13')]){return rpc[this[_0xcddc('0xe')]+'Message'][_0xcddc('0x14')](_0x17fd40)[_0xcddc('0x15')](function(_0x3859ed){logger['info']('[%s][MESSAGE]\x20%s',_0x326e63,_0x17fd40[_0xcddc('0x16')]);_0x4b25d7[_0xcddc('0x17')]();})['catch'](function(_0x3e0327){logger[_0xcddc('0x18')]('[%s][MESSAGE]\x20%s',_0x326e63,JSON[_0xcddc('0x19')](_0x3e0327));_0x4b25d7[_0xcddc('0x1a')]();});}}catch(_0x125599){logger[_0xcddc('0x18')](_0xcddc('0x1b'),_0x326e63,JSON['stringify'](_0x125599));_0x4b25d7[_0xcddc('0x1a')]();}};}; \ No newline at end of file +var _0xf6f6=['channel','AccountId','account','InteractionId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','next','error','stringify','stop','lodash','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','getMustacheRender','contact','chat','ChatWebsiteId','upperFirst'];(function(_0x1b70e3,_0x3a15b1){var _0x1452ab=function(_0x692883){while(--_0x692883){_0x1b70e3['push'](_0x1b70e3['shift']());}};_0x1452ab(++_0x3a15b1);}(_0xf6f6,0x15e));var _0x6f6f=function(_0x3b7b8a,_0x52c3b0){_0x3b7b8a=_0x3b7b8a-0x0;var _0x441206=_0xf6f6[_0x3b7b8a];return _0x441206;};'use strict';var _=require(_0x6f6f('0x0'));var utils=require('./utils');var logger=require(_0x6f6f('0x1'))(_0x6f6f('0x2'));var rpc={'chatMessage':require(_0x6f6f('0x3')),'openchannelMessage':require(_0x6f6f('0x4')),'mailMessage':require(_0x6f6f('0x5')),'smsMessage':require(_0x6f6f('0x6')),'faxMessage':require(_0x6f6f('0x7')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x6f6f('0x8')]=function(_0x32526a,_0xa2d4e7){return function(_0xa0a462){try{var _0x3a2da7={'body':utils[_0x6f6f('0x9')](_0xa2d4e7[0x0],this),'ContactId':this[_0x6f6f('0xa')]['id']};if(this['channel']===_0x6f6f('0xb')){_0x3a2da7[_0x6f6f('0xc')]=this['account']['id'];}else{_0x3a2da7[_[_0x6f6f('0xd')](this[_0x6f6f('0xe')])+_0x6f6f('0xf')]=this[_0x6f6f('0x10')]['id'];}_0x3a2da7[_[_0x6f6f('0xd')](this[_0x6f6f('0xe')])+_0x6f6f('0x11')]=this[_0x6f6f('0x12')]['id'];if(rpc[this['channel']+_0x6f6f('0x13')]){return rpc[this['channel']+'Message'][_0x6f6f('0x14')](_0x3a2da7)[_0x6f6f('0x15')](function(_0x5f1fc5){logger[_0x6f6f('0x16')](_0x6f6f('0x17'),_0x32526a,_0x3a2da7['body']);_0xa0a462[_0x6f6f('0x18')]();})['catch'](function(_0x2482d6){logger[_0x6f6f('0x19')](_0x6f6f('0x17'),_0x32526a,JSON['stringify'](_0x2482d6));_0xa0a462['stop']();});}}catch(_0x34a259){logger[_0x6f6f('0x19')]('[%s][MESSAGE]\x20%s',_0x32526a,JSON[_0x6f6f('0x1a')](_0x34a259));_0xa0a462[_0x6f6f('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 1f48c39..7bc8059 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 _0x1f89=['stringify','stop','./utils','../../../../config/logger','routing','consequence','info','getMustacheRender','next','[%s][NOOP]\x20%s'];(function(_0x10d26e,_0x304ba4){var _0x24c727=function(_0x4e6bba){while(--_0x4e6bba){_0x10d26e['push'](_0x10d26e['shift']());}};_0x24c727(++_0x304ba4);}(_0x1f89,0x14c));var _0x91f8=function(_0x31e8e5,_0x2dded1){_0x31e8e5=_0x31e8e5-0x0;var _0x48bf2d=_0x1f89[_0x31e8e5];return _0x48bf2d;};'use strict';var utils=require(_0x91f8('0x0'));var logger=require(_0x91f8('0x1'))(_0x91f8('0x2'));exports[_0x91f8('0x3')]=function(_0x1e1e76,_0x2373fc){return function(_0x4cbfee){try{logger[_0x91f8('0x4')]('[%s][NOOP]\x20%s',_0x1e1e76,utils[_0x91f8('0x5')](_0x2373fc[0x0],this));_0x4cbfee[_0x91f8('0x6')]();}catch(_0x2a6da3){logger['error'](_0x91f8('0x7'),_0x1e1e76,JSON[_0x91f8('0x8')](_0x2a6da3));_0x4cbfee[_0x91f8('0x9')]();}};}; \ No newline at end of file +var _0xc3eb=['routing','info','getMustacheRender','next','[%s][NOOP]\x20%s','stringify','stop'];(function(_0x10e5d9,_0x52e4fd){var _0x5df441=function(_0x235127){while(--_0x235127){_0x10e5d9['push'](_0x10e5d9['shift']());}};_0x5df441(++_0x52e4fd);}(_0xc3eb,0x173));var _0xbc3e=function(_0x48a96f,_0x530059){_0x48a96f=_0x48a96f-0x0;var _0x3ff3ef=_0xc3eb[_0x48a96f];return _0x3ff3ef;};'use strict';var utils=require('./utils');var logger=require('../../../../config/logger')(_0xbc3e('0x0'));exports['consequence']=function(_0x1e543f,_0x2a4f6b){return function(_0x4d08cb){try{logger[_0xbc3e('0x1')]('[%s][NOOP]\x20%s',_0x1e543f,utils[_0xbc3e('0x2')](_0x2a4f6b[0x0],this));_0x4d08cb[_0xbc3e('0x3')]();}catch(_0x52a917){logger['error'](_0xbc3e('0x4'),_0x1e543f,JSON[_0xbc3e('0x5')](_0x52a917));_0x4d08cb[_0xbc3e('0x6')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index 0fb62b0..a0f5665 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 _0x1cf2=['[%s][END:QUEUE][NAME:%s]','update','toLowerCase','length','map','join','stop','createQueue','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','validate','moment','ioredis','../../../../config/logger','routing','./strategy','redis','defaults','socket.io-emitter','queue_id','account','from','joinAt','emit','clone','push','capitalize','InteractionId','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','channel','QueueId','upperFirst','interaction','message','AccountId','info','name','QueueReport','catch','error','create\x20queue\x20report','waiting','accepted','[%s][STOP:QUEUE][NAME:%s]','update\x20queue\x20report','timeout'];(function(_0x59d89e,_0x55edf5){var _0x554e93=function(_0x3d40bc){while(--_0x3d40bc){_0x59d89e['push'](_0x59d89e['shift']());}};_0x554e93(++_0x55edf5);}(_0x1cf2,0xe9));var _0x21cf=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x1cf2[_0x321bb2];return _0x9c12ed;};'use strict';var schema=require(_0x21cf('0x0'));var _=require('lodash');var util=require('util');var seqqueue=require('seq-queue');var moment=require(_0x21cf('0x1'));var Redis=require(_0x21cf('0x2'));var config=require('../../../../config/environment');var logger=require(_0x21cf('0x3'))(_0x21cf('0x4'));var strategy=require(_0x21cf('0x5'));config[_0x21cf('0x6')]=_[_0x21cf('0x7')](config[_0x21cf('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x21cf('0x8'))(new Redis(config[_0x21cf('0x6')]));var attributes=['id',_0x21cf('0x9'),_0x21cf('0xa'),'queue',_0x21cf('0xb'),_0x21cf('0xc')];function emit(_0xb4c523,_0x5ed003,_0x1a5704){io['to'](_0xb4c523)[_0x21cf('0xd')](_0x5ed003,_0x1a5704);}function emitChannelQueueInteraction(_0x2691af,_0x54ef0b,_0x5cd773,_0x48d007,_0x8ae64e,_0x33c382,_0x4b2f06,_0x4a56d0){var _0x4c1923=_[_0x21cf('0xe')](_0x5cd773);_0x4c1923[_0x21cf('0x9')]=_0x4a56d0;_0x4c1923['queue']=_0x54ef0b;_0x4c1923[_0x21cf('0xa')]=_0x48d007;_0x4c1923['id']=_0x8ae64e;if(_0x33c382){attributes[_0x21cf('0xf')](_[_0x21cf('0x10')](_0x2691af)+_0x21cf('0x11'));_0x4b2f06[util[_0x21cf('0x12')](_0x21cf('0x13'),_0x2691af)][_0x8ae64e]=_[_0x21cf('0x14')](_0x4c1923,attributes);}else{delete _0x4b2f06[util['format'](_0x21cf('0x13'),_0x2691af)][_0x8ae64e];}emit(util['format'](_0x21cf('0x15'),_0x2691af,_0x54ef0b),util['format']('%s_queue_waiting_interaction:%s',_0x2691af,_0x33c382?_0x21cf('0x16'):_0x21cf('0x17')),_['pick'](_0x4c1923,attributes));}var rpc={'openchannelQueueReport':require(_0x21cf('0x18')),'mailQueueReport':require(_0x21cf('0x19')),'chatQueueReport':require(_0x21cf('0x1a')),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0x21cf('0x1b'),'required':!![],'message':_0x21cf('0x1c')},'timeout':{'type':'number','message':_0x21cf('0x1d')}});function startRouting(_0x48556e,_0xfe196e,_0x57ca47,_0x5ed3b2){if(_0x48556e&&_0xfe196e&&_0x57ca47){_0xfe196e['waiting']+=0x1;var _0x5ced4a={'uniqueid':_0x48556e,'from':_0x57ca47[_0x21cf('0x1e')]?_0x57ca47[_0x21cf('0x1e')][_0x21cf('0xb')]:'','joinAt':moment()[_0x21cf('0x12')](_0x21cf('0x1f')),'ContactId':_0x57ca47[_0x21cf('0x20')]?_0x57ca47[_0x21cf('0x20')]['id']:null,'ListId':_0x57ca47[_0x21cf('0x21')]?_0x57ca47[_0x21cf('0x21')]['id']:null};_0x5ced4a[_['upperFirst'](_0x57ca47[_0x21cf('0x22')])+_0x21cf('0x23')]=_0xfe196e['id']||null;_0x5ced4a[_[_0x21cf('0x24')](_0x57ca47[_0x21cf('0x22')])+_0x21cf('0x11')]=_0x57ca47[_0x21cf('0x25')]?_0x57ca47[_0x21cf('0x25')]['id']:null;_0x5ced4a[_['upperFirst'](_0x57ca47[_0x21cf('0x22')])+'MessageId']=_0x57ca47['message']?_0x57ca47[_0x21cf('0x26')]['id']:null;_0x5ced4a[_[_0x21cf('0x24')](_0x57ca47[_0x21cf('0x22')])+(_0x57ca47[_0x21cf('0x22')]!=='chat'?_0x21cf('0x27'):'WebsiteId')]=_0x57ca47[_0x21cf('0xa')]?_0x57ca47['account']['id']:null;logger[_0x21cf('0x28')](util[_0x21cf('0x12')]('[%s][START:QUEUE][NAME:%s]',_0x48556e,_0xfe196e[_0x21cf('0x29')]));emitChannelQueueInteraction(_0x57ca47['channel'],_0xfe196e[_0x21cf('0x29')],_0x5ced4a,_0x57ca47[_0x21cf('0xa')][_0x21cf('0x29')],_0x57ca47['message']['id'],!![],_0x5ed3b2,_0xfe196e['id']);if(rpc[_0x57ca47[_0x21cf('0x22')]+_0x21cf('0x2a')]){return rpc[_0x57ca47[_0x21cf('0x22')]+_0x21cf('0x2a')]['create'](_0x5ced4a)[_0x21cf('0x2b')](function(_0x2cdefe){logger[_0x21cf('0x2c')](_0x21cf('0x2d'));});}}}function stopRouting(_0x807a30,_0x133f14,_0x7ab4c9,_0x44ceaf){if(_0x807a30&&_0x133f14){_0x133f14[_0x21cf('0x2e')]-=0x1;var _0x1d4314={'leaveAt':moment()[_0x21cf('0x12')](_0x21cf('0x1f')),'acceptAt':moment()[_0x21cf('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x21cf('0x2f')};logger[_0x21cf('0x28')](util[_0x21cf('0x12')](_0x21cf('0x30'),_0x807a30,_0x133f14[_0x21cf('0x29')]));emitChannelQueueInteraction(_0x7ab4c9[_0x21cf('0x22')],_0x133f14[_0x21cf('0x29')],_0x7ab4c9[_0x21cf('0x1e')],_0x7ab4c9[_0x21cf('0xa')]['name'],_0x7ab4c9['message']['id'],![],_0x44ceaf,_0x133f14['id']);if(rpc[_0x7ab4c9[_0x21cf('0x22')]+_0x21cf('0x2a')]){return rpc[_0x7ab4c9['channel']+_0x21cf('0x2a')]['update'](_0x807a30,_0x1d4314)[_0x21cf('0x2b')](function(_0xb4a737){logger[_0x21cf('0x2c')](_0x21cf('0x31'));});}}}function endRouting(_0x10a5cc,_0x241c76,_0x3ccc12,_0x3c717d){if(_0x10a5cc&&_0x241c76){_0x241c76[_0x21cf('0x2e')]-=0x1;var _0x2afdb4={'leaveAt':moment()[_0x21cf('0x12')](_0x21cf('0x1f')),'exitAt':moment()[_0x21cf('0x12')](_0x21cf('0x1f')),'reason':_0x21cf('0x32')};logger[_0x21cf('0x28')](util[_0x21cf('0x12')](_0x21cf('0x33'),_0x10a5cc,_0x241c76['name']));emitChannelQueueInteraction(_0x3ccc12[_0x21cf('0x22')],_0x241c76[_0x21cf('0x29')],_0x3ccc12[_0x21cf('0x1e')],_0x3ccc12['account'][_0x21cf('0x29')],_0x3ccc12['message']['id'],![],_0x3c717d);if(rpc[_0x3ccc12[_0x21cf('0x22')]+_0x21cf('0x2a')]){return rpc[_0x3ccc12['channel']+_0x21cf('0x2a')][_0x21cf('0x34')](_0x10a5cc,_0x2afdb4)[_0x21cf('0x2b')](function(_0xbee384){logger[_0x21cf('0x2c')](_0x21cf('0x31'));});}}}function handleFindQueue(_0x8b5477){return function(_0xfc27c){return _0xfc27c['name'][_0x21cf('0x35')]()===_0x8b5477[_0x21cf('0x35')]();};}exports['consequence']=function(_0x1e98e1,_0x166dd0,_0x49a032,_0x1e8ef5){return function(_0x67a4ab){try{var _0x13e23e={'name':_0x166dd0[0x0],'timeout':_0x166dd0[0x1]};var _0x4e46dd=queue[_0x21cf('0x0')](_0x13e23e,{'typecast':!![]});if(_0x4e46dd[_0x21cf('0x36')]){logger[_0x21cf('0x2c')]('[%s][QUEUE]\x20%s',_0x1e98e1,_[_0x21cf('0x37')](_0x4e46dd,'message')[_0x21cf('0x38')](',\x20'));_0x67a4ab[_0x21cf('0x39')]();}else{var _0x3f3d29=_['find'](_0x49a032[_0x1e8ef5[_0x21cf('0x22')]+'Queues'],handleFindQueue(_0x13e23e['name']));if(_0x3f3d29){startRouting(_0x1e98e1,_0x3f3d29,_0x1e8ef5,_0x49a032);var _0x4f58a6=(_0x3f3d29[_0x21cf('0x32')]||0xa)*0x3e8;var _0x287844=(_0x13e23e[_0x21cf('0x32')]||0x14)*0x3e8;var _0x5494af;if(_0x4f58a6>_0x287844){_0x287844=_0x4f58a6;}var _0x1c1e91=seqqueue[_0x21cf('0x3a')](_0x4f58a6);_0x1c1e91['id']=_0x1e98e1;_0x1c1e91['atimeout']=_0x4f58a6;_0x1c1e91['qtimeout']=_0x287844;_0x1c1e91[_0x21cf('0x22')]=_0x1e8ef5[_0x21cf('0x22')];_0x49a032[_0x21cf('0x3b')][_0x1e98e1]['on'](_0x21cf('0x3c'),function(){logger[_0x21cf('0x28')](_0x21cf('0x3d'),_0x1e98e1);stopRouting(_0x1e98e1,_0x3f3d29,_0x1e8ef5,_0x49a032);clearTimeout(_0x5494af);_0x5494af=undefined;_0x1c1e91[_0x21cf('0x3e')](!![]);if(_0x49a032['rules'][_0x1e98e1]){delete _0x49a032[_0x21cf('0x3b')][_0x1e98e1];}_0x67a4ab['stop']();});_0x49a032['rules'][_0x1e98e1]['on'](_0x21cf('0x3f'),function(){if(_0x49a032[_0x21cf('0x3b')][_0x1e98e1]){delete _0x49a032['rules'][_0x1e98e1];}});_0x5494af=setTimeout(function(){logger[_0x21cf('0x28')]('[%s][QUEUE]\x20APPLICATION\x20END',_0x1e98e1);endRouting(_0x1e98e1,_0x3f3d29,_0x1e8ef5,_0x49a032);clearTimeout(_0x5494af);_0x1c1e91[_0x21cf('0x3e')](!![]);_0x67a4ab[_0x21cf('0x40')]();},_0x287844);switch(_0x3f3d29[_0x21cf('0x41')]){case'rrmemory':strategy[_0x21cf('0x42')](_0x1c1e91,_0x3f3d29,_0x49a032,_0x1e8ef5);break;default:strategy[_0x21cf('0x43')](_0x1c1e91,_0x3f3d29,_0x49a032,_0x1e8ef5);}}else{logger[_0x21cf('0x2c')](_0x21cf('0x44'),_0x1e98e1,_0x13e23e[_0x21cf('0x29')]);_0x67a4ab['stop']();}}}catch(_0x4eb107){console[_0x21cf('0x45')](_0x4eb107);logger[_0x21cf('0x2c')](_0x21cf('0x46'),_0x1e98e1,_0x4eb107['stack']);_0x67a4ab[_0x21cf('0x39')]();}};}; \ No newline at end of file +var _0x53af=['../../../../config/logger','routing','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','account','queue','from','joinAt','emit','clone','InteractionId','%sQueuesWaitingInteractions','pick','format','%s:queue:%s','%s_queue_waiting_interaction:%s','remove','../../rpc/openchannelQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','interaction','MessageId','message','chat','AccountId','info','name','QueueReport','create','catch','error','waiting','accepted','[%s][STOP:QUEUE][NAME:%s]','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','update','toLowerCase','consequence','map','stop','Queues','atimeout','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','rules','[%s][QUEUE]\x20APPLICATION\x20END','next','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','[%s][QUEUE]\x20%s','stack','validate','lodash','util','moment','ioredis','../../../../config/environment'];(function(_0x577a4b,_0x22c300){var _0x3f512f=function(_0x5ba009){while(--_0x5ba009){_0x577a4b['push'](_0x577a4b['shift']());}};_0x3f512f(++_0x22c300);}(_0x53af,0x171));var _0xf53a=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x53af[_0xfae23b];return _0x200640;};'use strict';var schema=require(_0xf53a('0x0'));var _=require(_0xf53a('0x1'));var util=require(_0xf53a('0x2'));var seqqueue=require('seq-queue');var moment=require(_0xf53a('0x3'));var Redis=require(_0xf53a('0x4'));var config=require(_0xf53a('0x5'));var logger=require(_0xf53a('0x6'))(_0xf53a('0x7'));var strategy=require(_0xf53a('0x8'));config[_0xf53a('0x9')]=_[_0xf53a('0xa')](config[_0xf53a('0x9')],{'host':_0xf53a('0xb'),'port':0x18eb});var io=require(_0xf53a('0xc'))(new Redis(config['redis']));var attributes=['id',_0xf53a('0xd'),_0xf53a('0xe'),_0xf53a('0xf'),_0xf53a('0x10'),_0xf53a('0x11')];function emit(_0x2828ba,_0x4789c0,_0x5709ce){io['to'](_0x2828ba)[_0xf53a('0x12')](_0x4789c0,_0x5709ce);}function emitChannelQueueInteraction(_0x230778,_0x1e92a1,_0x497ea0,_0x5ef4a2,_0xa9dcd5,_0x333d70,_0x1a3a47,_0x2493d1){var _0x44392b=_[_0xf53a('0x13')](_0x497ea0);_0x44392b[_0xf53a('0xd')]=_0x2493d1;_0x44392b[_0xf53a('0xf')]=_0x1e92a1;_0x44392b[_0xf53a('0xe')]=_0x5ef4a2;_0x44392b['id']=_0xa9dcd5;if(_0x333d70){attributes['push'](_['capitalize'](_0x230778)+_0xf53a('0x14'));_0x1a3a47[util['format'](_0xf53a('0x15'),_0x230778)][_0xa9dcd5]=_[_0xf53a('0x16')](_0x44392b,attributes);}else{delete _0x1a3a47[util[_0xf53a('0x17')](_0xf53a('0x15'),_0x230778)][_0xa9dcd5];}emit(util[_0xf53a('0x17')](_0xf53a('0x18'),_0x230778,_0x1e92a1),util[_0xf53a('0x17')](_0xf53a('0x19'),_0x230778,_0x333d70?'save':_0xf53a('0x1a')),_[_0xf53a('0x16')](_0x44392b,attributes));}var rpc={'openchannelQueueReport':require(_0xf53a('0x1b')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0xf53a('0x1c')),'smsQueueReport':require(_0xf53a('0x1d')),'faxQueueReport':require(_0xf53a('0x1e')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0xf53a('0x1f'),'required':!![],'message':_0xf53a('0x20')},'timeout':{'type':_0xf53a('0x21'),'message':_0xf53a('0x22')}});function startRouting(_0x46913d,_0x52fb32,_0x48682d,_0x13683a){if(_0x46913d&&_0x52fb32&&_0x48682d){_0x52fb32['waiting']+=0x1;var _0x11814e={'uniqueid':_0x46913d,'from':_0x48682d[_0xf53a('0x23')]?_0x48682d['body'][_0xf53a('0x10')]:'','joinAt':moment()[_0xf53a('0x17')](_0xf53a('0x24')),'ContactId':_0x48682d[_0xf53a('0x25')]?_0x48682d['contact']['id']:null,'ListId':_0x48682d[_0xf53a('0x26')]?_0x48682d['list']['id']:null};_0x11814e[_[_0xf53a('0x27')](_0x48682d[_0xf53a('0x28')])+'QueueId']=_0x52fb32['id']||null;_0x11814e[_[_0xf53a('0x27')](_0x48682d[_0xf53a('0x28')])+_0xf53a('0x14')]=_0x48682d[_0xf53a('0x29')]?_0x48682d[_0xf53a('0x29')]['id']:null;_0x11814e[_[_0xf53a('0x27')](_0x48682d[_0xf53a('0x28')])+_0xf53a('0x2a')]=_0x48682d[_0xf53a('0x2b')]?_0x48682d[_0xf53a('0x2b')]['id']:null;_0x11814e[_[_0xf53a('0x27')](_0x48682d[_0xf53a('0x28')])+(_0x48682d['channel']!==_0xf53a('0x2c')?_0xf53a('0x2d'):'WebsiteId')]=_0x48682d['account']?_0x48682d[_0xf53a('0xe')]['id']:null;logger[_0xf53a('0x2e')](util[_0xf53a('0x17')]('[%s][START:QUEUE][NAME:%s]',_0x46913d,_0x52fb32[_0xf53a('0x2f')]));emitChannelQueueInteraction(_0x48682d[_0xf53a('0x28')],_0x52fb32[_0xf53a('0x2f')],_0x11814e,_0x48682d[_0xf53a('0xe')][_0xf53a('0x2f')],_0x48682d[_0xf53a('0x2b')]['id'],!![],_0x13683a,_0x52fb32['id']);if(rpc[_0x48682d['channel']+'QueueReport']){return rpc[_0x48682d[_0xf53a('0x28')]+_0xf53a('0x30')][_0xf53a('0x31')](_0x11814e)[_0xf53a('0x32')](function(_0xdcd1a8){logger[_0xf53a('0x33')]('create\x20queue\x20report');});}}}function stopRouting(_0xffd7ee,_0x4b3b75,_0x2b0d42,_0x580982){if(_0xffd7ee&&_0x4b3b75){_0x4b3b75[_0xf53a('0x34')]-=0x1;var _0x255cae={'leaveAt':moment()[_0xf53a('0x17')](_0xf53a('0x24')),'acceptAt':moment()['format'](_0xf53a('0x24')),'reason':_0xf53a('0x35')};logger['info'](util[_0xf53a('0x17')](_0xf53a('0x36'),_0xffd7ee,_0x4b3b75[_0xf53a('0x2f')]));emitChannelQueueInteraction(_0x2b0d42[_0xf53a('0x28')],_0x4b3b75[_0xf53a('0x2f')],_0x2b0d42[_0xf53a('0x23')],_0x2b0d42[_0xf53a('0xe')]['name'],_0x2b0d42[_0xf53a('0x2b')]['id'],![],_0x580982,_0x4b3b75['id']);if(rpc[_0x2b0d42['channel']+_0xf53a('0x30')]){return rpc[_0x2b0d42[_0xf53a('0x28')]+_0xf53a('0x30')]['update'](_0xffd7ee,_0x255cae)[_0xf53a('0x32')](function(_0x5084be){logger[_0xf53a('0x33')](_0xf53a('0x37'));});}}}function endRouting(_0x2ad5cb,_0x2465e5,_0x39a48f,_0x114a0c){if(_0x2ad5cb&&_0x2465e5){_0x2465e5[_0xf53a('0x34')]-=0x1;var _0x2267b8={'leaveAt':moment()[_0xf53a('0x17')](_0xf53a('0x24')),'exitAt':moment()['format'](_0xf53a('0x24')),'reason':_0xf53a('0x38')};logger[_0xf53a('0x2e')](util[_0xf53a('0x17')](_0xf53a('0x39'),_0x2ad5cb,_0x2465e5[_0xf53a('0x2f')]));emitChannelQueueInteraction(_0x39a48f[_0xf53a('0x28')],_0x2465e5['name'],_0x39a48f[_0xf53a('0x23')],_0x39a48f[_0xf53a('0xe')][_0xf53a('0x2f')],_0x39a48f[_0xf53a('0x2b')]['id'],![],_0x114a0c);if(rpc[_0x39a48f['channel']+_0xf53a('0x30')]){return rpc[_0x39a48f['channel']+_0xf53a('0x30')][_0xf53a('0x3a')](_0x2ad5cb,_0x2267b8)['catch'](function(_0x2e37ee){logger[_0xf53a('0x33')](_0xf53a('0x37'));});}}}function handleFindQueue(_0x3786de){return function(_0x2d5ee1){return _0x2d5ee1[_0xf53a('0x2f')][_0xf53a('0x3b')]()===_0x3786de[_0xf53a('0x3b')]();};}exports[_0xf53a('0x3c')]=function(_0x299732,_0x5268a4,_0x1bb43c,_0x319bb0){return function(_0x3d42b4){try{var _0x109517={'name':_0x5268a4[0x0],'timeout':_0x5268a4[0x1]};var _0x313888=queue['validate'](_0x109517,{'typecast':!![]});if(_0x313888['length']){logger[_0xf53a('0x33')]('[%s][QUEUE]\x20%s',_0x299732,_[_0xf53a('0x3d')](_0x313888,'message')['join'](',\x20'));_0x3d42b4[_0xf53a('0x3e')]();}else{var _0x1300b3=_['find'](_0x1bb43c[_0x319bb0['channel']+_0xf53a('0x3f')],handleFindQueue(_0x109517[_0xf53a('0x2f')]));if(_0x1300b3){startRouting(_0x299732,_0x1300b3,_0x319bb0,_0x1bb43c);var _0x4c8b37=(_0x1300b3[_0xf53a('0x38')]||0xa)*0x3e8;var _0x3ae33c=(_0x109517[_0xf53a('0x38')]||0x14)*0x3e8;var _0x43d966;if(_0x4c8b37>_0x3ae33c){_0x3ae33c=_0x4c8b37;}var _0x5e4fad=seqqueue['createQueue'](_0x4c8b37);_0x5e4fad['id']=_0x299732;_0x5e4fad[_0xf53a('0x40')]=_0x4c8b37;_0x5e4fad['qtimeout']=_0x3ae33c;_0x5e4fad['channel']=_0x319bb0[_0xf53a('0x28')];_0x1bb43c['rules'][_0x299732]['on']('end',function(){logger[_0xf53a('0x2e')](_0xf53a('0x41'),_0x299732);stopRouting(_0x299732,_0x1300b3,_0x319bb0,_0x1bb43c);clearTimeout(_0x43d966);_0x43d966=undefined;_0x5e4fad[_0xf53a('0x42')](!![]);if(_0x1bb43c[_0xf53a('0x43')][_0x299732]){delete _0x1bb43c['rules'][_0x299732];}_0x3d42b4['stop']();});_0x1bb43c['rules'][_0x299732]['on']('complete',function(){if(_0x1bb43c[_0xf53a('0x43')][_0x299732]){delete _0x1bb43c[_0xf53a('0x43')][_0x299732];}});_0x43d966=setTimeout(function(){logger['info'](_0xf53a('0x44'),_0x299732);endRouting(_0x299732,_0x1300b3,_0x319bb0,_0x1bb43c);clearTimeout(_0x43d966);_0x5e4fad[_0xf53a('0x42')](!![]);_0x3d42b4[_0xf53a('0x45')]();},_0x3ae33c);switch(_0x1300b3['strategy']){case _0xf53a('0x46'):strategy[_0xf53a('0x46')](_0x5e4fad,_0x1300b3,_0x1bb43c,_0x319bb0);break;default:strategy[_0xf53a('0x47')](_0x5e4fad,_0x1300b3,_0x1bb43c,_0x319bb0);}}else{logger['error'](_0xf53a('0x48'),_0x299732,_0x109517['name']);_0x3d42b4[_0xf53a('0x3e')]();}}}catch(_0x12e7e3){console['log'](_0x12e7e3);logger[_0xf53a('0x33')](_0xf53a('0x49'),_0x299732,_0x12e7e3[_0xf53a('0x4a')]);_0x3d42b4['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/agent.js b/server/services/routing/server/applications/strategy/agent.js index beaf120..262dbff 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 _0xfd28=['routing','squeue','agent','realtime','bind','handleTimeout','timeout','drained','push','handleRun','prototype','handleDrained','debug','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','forcedOwnership','isAgentAvailable','channel','busy','saveWaitingNotification','notificationId','writeLog','RINGING','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s','removeWaitingNotification','STOP','TIMEOUT','exports','uuid','./util'];(function(_0x2730da,_0x1098bd){var _0xfe9991=function(_0x2ea521){while(--_0x2ea521){_0x2730da['push'](_0x2730da['shift']());}};_0xfe9991(++_0x1098bd);}(_0xfd28,0x148));var _0x8fd2=function(_0x510b98,_0x4c4cbb){_0x510b98=_0x510b98-0x0;var _0x45e775=_0xfd28[_0x510b98];return _0x45e775;};'use strict';var _=require('lodash');var uuid=require(_0x8fd2('0x0'));var util=require(_0x8fd2('0x1'));var logger=require('../../../../../config/logger')(_0x8fd2('0x2'));var Agent=function(_0x4e5c5e,_0x37baf5,_0xf7417d,_0x4e2108){this['notificationId']=uuid['v4']();this[_0x8fd2('0x3')]=_0x4e5c5e;this[_0x8fd2('0x4')]=_0x37baf5;this[_0x8fd2('0x5')]=_0xf7417d;this[_0x8fd2('0x2')]=_0x4e2108;this[_0x8fd2('0x3')]['push'](this['handleRun'][_0x8fd2('0x6')](this),this[_0x8fd2('0x7')][_0x8fd2('0x6')](this));this['squeue']['on'](_0x8fd2('0x8'),this['handleTimeout'][_0x8fd2('0x6')](this));this['squeue']['on'](_0x8fd2('0x9'),this['handleDrained'][_0x8fd2('0x6')](this));};Agent['prototype'][_0x8fd2('0xa')]=function(){this['squeue'][_0x8fd2('0xa')](this[_0x8fd2('0xb')][_0x8fd2('0x6')](this),this[_0x8fd2('0x7')][_0x8fd2('0x6')](this));};Agent[_0x8fd2('0xc')][_0x8fd2('0xd')]=function(){this[_0x8fd2('0x7')](!![]);};Agent[_0x8fd2('0xc')][_0x8fd2('0xb')]=function(){logger[_0x8fd2('0xe')](_0x8fd2('0xf'),this[_0x8fd2('0x3')]['id'],this[_0x8fd2('0x4')]['id']);if(_[_0x8fd2('0x10')](this['realtime'][_0x8fd2('0x11')][this['agent']['id']])){logger['debug']('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x8fd2('0x3')]['id'],this[_0x8fd2('0x4')]['id']);setTimeout(this[_0x8fd2('0xa')][_0x8fd2('0x6')](this),0x3e8);}else{if(this['routing'][_0x8fd2('0x12')]||util[_0x8fd2('0x13')](this[_0x8fd2('0x3')]['id'],this[_0x8fd2('0x5')][_0x8fd2('0x11')][this['agent']['id']],this['squeue'][_0x8fd2('0x14')],![])){this['realtime'][_0x8fd2('0x11')][this['agent']['id']][_0x8fd2('0x15')]=!![];this[_0x8fd2('0x5')]['agents'][this[_0x8fd2('0x4')]['id']]['busyQueue']=undefined;util[_0x8fd2('0x16')](this[_0x8fd2('0x5')],this['routing'],this[_0x8fd2('0x4')],this[_0x8fd2('0x3')][_0x8fd2('0x14')]);util['showNotification'](this[_0x8fd2('0x17')],this[_0x8fd2('0x3')]['id'],this[_0x8fd2('0x5')][_0x8fd2('0x11')][this[_0x8fd2('0x4')]['id']],null,this[_0x8fd2('0x2')]);util[_0x8fd2('0x18')](this[_0x8fd2('0x3')]['id'],this[_0x8fd2('0x5')][_0x8fd2('0x11')][this[_0x8fd2('0x4')]['id']],_0x8fd2('0x19')+(this[_0x8fd2('0x2')]['forcedOwnership']?':FORCED':''));}else{logger[_0x8fd2('0xe')](_0x8fd2('0x1a'),this[_0x8fd2('0x3')]['id'],this['agent']['id']);setTimeout(this[_0x8fd2('0xa')][_0x8fd2('0x6')](this),0x3e8);}}};Agent[_0x8fd2('0xc')][_0x8fd2('0x7')]=function(_0x119439){if(_[_0x8fd2('0x10')](this[_0x8fd2('0x5')]['agents'][this[_0x8fd2('0x4')]['id']])){return logger[_0x8fd2('0xe')](_0x8fd2('0x1b'),this[_0x8fd2('0x3')]['id'],this[_0x8fd2('0x4')]['id']);}else{logger[_0x8fd2('0xe')](_0x8fd2('0x1c'),this['squeue']['id'],this['agent']['id']);util['hideNotification'](this[_0x8fd2('0x17')],this[_0x8fd2('0x3')]['id'],this[_0x8fd2('0x5')][_0x8fd2('0x11')][this['agent']['id']],null,this['routing']);this[_0x8fd2('0x5')][_0x8fd2('0x11')][this[_0x8fd2('0x4')]['id']][_0x8fd2('0x15')]=![];this[_0x8fd2('0x5')]['agents'][this[_0x8fd2('0x4')]['id']]['busyQueue']=undefined;util[_0x8fd2('0x1d')](this['realtime'],this[_0x8fd2('0x2')],this['agent'],this[_0x8fd2('0x3')][_0x8fd2('0x14')]);util[_0x8fd2('0x18')](this['squeue']['id'],this[_0x8fd2('0x5')]['agents'][this[_0x8fd2('0x4')]['id']],_0x119439?_0x8fd2('0x1e'):_0x8fd2('0x1f'));}if(!_0x119439){setTimeout(this['push'][_0x8fd2('0x6')](this),0x3e8);}};function agent(_0x199a85,_0x21adc6,_0x58ce31,_0x11ef3b){return new Agent(_0x199a85,_0x21adc6,_0x58ce31,_0x11ef3b);}module[_0x8fd2('0x20')]=agent; \ No newline at end of file +var _0xf2ca=['channel','busy','busyQueue','saveWaitingNotification','showNotification','writeLog','RINGING','STOP','TIMEOUT','exports','lodash','uuid','./util','routing','notificationId','agent','realtime','squeue','handleRun','bind','timeout','drained','handleDrained','push','prototype','handleTimeout','debug','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership'];(function(_0x1be79b,_0x183333){var _0x4365d5=function(_0x8874e5){while(--_0x8874e5){_0x1be79b['push'](_0x1be79b['shift']());}};_0x4365d5(++_0x183333);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x403db1,_0x59018e){_0x403db1=_0x403db1-0x0;var _0x47c48f=_0xf2ca[_0x403db1];return _0x47c48f;};'use strict';var _=require(_0xaf2c('0x0'));var uuid=require(_0xaf2c('0x1'));var util=require(_0xaf2c('0x2'));var logger=require('../../../../../config/logger')(_0xaf2c('0x3'));var Agent=function(_0x2102e2,_0x1271a9,_0x219511,_0x3a724c){this[_0xaf2c('0x4')]=uuid['v4']();this['squeue']=_0x2102e2;this[_0xaf2c('0x5')]=_0x1271a9;this[_0xaf2c('0x6')]=_0x219511;this[_0xaf2c('0x3')]=_0x3a724c;this[_0xaf2c('0x7')]['push'](this[_0xaf2c('0x8')][_0xaf2c('0x9')](this),this['handleTimeout'][_0xaf2c('0x9')](this));this['squeue']['on'](_0xaf2c('0xa'),this['handleTimeout'][_0xaf2c('0x9')](this));this[_0xaf2c('0x7')]['on'](_0xaf2c('0xb'),this[_0xaf2c('0xc')]['bind'](this));};Agent['prototype'][_0xaf2c('0xd')]=function(){this[_0xaf2c('0x7')][_0xaf2c('0xd')](this[_0xaf2c('0x8')][_0xaf2c('0x9')](this),this['handleTimeout']['bind'](this));};Agent[_0xaf2c('0xe')][_0xaf2c('0xc')]=function(){this[_0xaf2c('0xf')](!![]);};Agent[_0xaf2c('0xe')][_0xaf2c('0x8')]=function(){logger[_0xaf2c('0x10')](_0xaf2c('0x11'),this[_0xaf2c('0x7')]['id'],this[_0xaf2c('0x5')]['id']);if(_[_0xaf2c('0x12')](this[_0xaf2c('0x6')][_0xaf2c('0x13')][this[_0xaf2c('0x5')]['id']])){logger[_0xaf2c('0x10')](_0xaf2c('0x14'),this['squeue']['id'],this[_0xaf2c('0x5')]['id']);setTimeout(this['push'][_0xaf2c('0x9')](this),0x3e8);}else{if(this[_0xaf2c('0x3')][_0xaf2c('0x15')]||util['isAgentAvailable'](this[_0xaf2c('0x7')]['id'],this[_0xaf2c('0x6')][_0xaf2c('0x13')][this[_0xaf2c('0x5')]['id']],this[_0xaf2c('0x7')][_0xaf2c('0x16')],![])){this['realtime'][_0xaf2c('0x13')][this[_0xaf2c('0x5')]['id']][_0xaf2c('0x17')]=!![];this[_0xaf2c('0x6')][_0xaf2c('0x13')][this['agent']['id']][_0xaf2c('0x18')]=undefined;util[_0xaf2c('0x19')](this[_0xaf2c('0x6')],this['routing'],this['agent'],this[_0xaf2c('0x7')][_0xaf2c('0x16')]);util[_0xaf2c('0x1a')](this[_0xaf2c('0x4')],this['squeue']['id'],this[_0xaf2c('0x6')][_0xaf2c('0x13')][this[_0xaf2c('0x5')]['id']],null,this[_0xaf2c('0x3')]);util[_0xaf2c('0x1b')](this[_0xaf2c('0x7')]['id'],this[_0xaf2c('0x6')]['agents'][this[_0xaf2c('0x5')]['id']],_0xaf2c('0x1c')+(this[_0xaf2c('0x3')][_0xaf2c('0x15')]?':FORCED':''));}else{logger[_0xaf2c('0x10')]('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this[_0xaf2c('0x7')]['id'],this[_0xaf2c('0x5')]['id']);setTimeout(this[_0xaf2c('0xd')]['bind'](this),0x3e8);}}};Agent[_0xaf2c('0xe')][_0xaf2c('0xf')]=function(_0x3baee2){if(_['isNil'](this[_0xaf2c('0x6')][_0xaf2c('0x13')][this[_0xaf2c('0x5')]['id']])){return logger[_0xaf2c('0x10')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xaf2c('0x7')]['id'],this[_0xaf2c('0x5')]['id']);}else{logger[_0xaf2c('0x10')]('[%s][AGENT]\x20timeout\x20with\x20%s',this['squeue']['id'],this[_0xaf2c('0x5')]['id']);util['hideNotification'](this[_0xaf2c('0x4')],this['squeue']['id'],this[_0xaf2c('0x6')][_0xaf2c('0x13')][this['agent']['id']],null,this[_0xaf2c('0x3')]);this[_0xaf2c('0x6')]['agents'][this[_0xaf2c('0x5')]['id']][_0xaf2c('0x17')]=![];this[_0xaf2c('0x6')][_0xaf2c('0x13')][this[_0xaf2c('0x5')]['id']][_0xaf2c('0x18')]=undefined;util['removeWaitingNotification'](this[_0xaf2c('0x6')],this['routing'],this[_0xaf2c('0x5')],this['squeue'][_0xaf2c('0x16')]);util['writeLog'](this[_0xaf2c('0x7')]['id'],this['realtime'][_0xaf2c('0x13')][this['agent']['id']],_0x3baee2?_0xaf2c('0x1d'):_0xaf2c('0x1e'));}if(!_0x3baee2){setTimeout(this[_0xaf2c('0xd')][_0xaf2c('0x9')](this),0x3e8);}};function agent(_0x470aff,_0x598adb,_0x4cba13,_0x6f428d){return new Agent(_0x470aff,_0x598adb,_0x4cba13,_0x6f428d);}module[_0xaf2c('0x1f')]=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index 5ace4fb..c67d16b 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 _0x93f7=['isAgentAvailable','agents','channel','writeLog','busyQueue','name','saveWaitingNotification','showNotification','[%s][QUEUE]\x20EMPTY','hideNotification','TIMEOUT','busy','removeWaitingNotification','exports','uuid','./util','routing','notificationId','squeue','queue','push','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','isNil','Agents','length','realtime','debug','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s'];(function(_0x3826ad,_0x49a30d){var _0x17b900=function(_0x38474f){while(--_0x38474f){_0x3826ad['push'](_0x3826ad['shift']());}};_0x17b900(++_0x49a30d);}(_0x93f7,0x140));var _0x793f=function(_0x16316c,_0x5211d9){_0x16316c=_0x16316c-0x0;var _0x13b0ae=_0x93f7[_0x16316c];return _0x13b0ae;};'use strict';var _=require('lodash');var uuid=require(_0x793f('0x0'));var util=require(_0x793f('0x1'));var logger=require('../../../../../config/logger')(_0x793f('0x2'));var Beepall=function(_0x3fecec,_0x2d1086,_0x3630b8,_0x513739){this[_0x793f('0x3')]=uuid['v4']();this[_0x793f('0x4')]=_0x3fecec;this[_0x793f('0x5')]=_0x2d1086;this['realtime']=_0x3630b8;this[_0x793f('0x2')]=_0x513739;this['squeue'][_0x793f('0x6')](this[_0x793f('0x7')][_0x793f('0x8')](this),this[_0x793f('0x9')][_0x793f('0x8')](this));this[_0x793f('0x4')]['on'](_0x793f('0xa'),this[_0x793f('0x9')][_0x793f('0x8')](this));this[_0x793f('0x4')]['on'](_0x793f('0xb'),this[_0x793f('0xc')][_0x793f('0x8')](this));};Beepall[_0x793f('0xd')][_0x793f('0x6')]=function(){this[_0x793f('0x4')][_0x793f('0x6')](this[_0x793f('0x7')][_0x793f('0x8')](this),this['handleTimeout'][_0x793f('0x8')](this));};Beepall[_0x793f('0xd')][_0x793f('0xc')]=function(){this['handleTimeout'](!![]);};Beepall[_0x793f('0xd')][_0x793f('0x7')]=function(){var _0x4fcbc1=!![];if(!_['isNil'](this[_0x793f('0x5')])&&!_[_0x793f('0xe')](this[_0x793f('0x5')][_0x793f('0xf')])&&this[_0x793f('0x5')][_0x793f('0xf')]['length']>0x0){for(var _0x326532=0x0,_0x44a9f2;_0x3265320x0){for(var _0x4e083d=0x0,_0x1e192f;_0x4e083d0x0&&_0x18e388[_0x3d5c93+_0x278e('0x28')]>=_0x18e388[_0x3d5c93+_0x278e('0x27')]){writeLog(_0x18e43a,_0x18e388,_0x3d5c93[_0x278e('0x29')]()+_0x278e('0x2a'));return![];}}return!![];};exports[_0x278e('0x2b')]=function(_0x36039f,_0x143554,_0xede9b3,_0x8697ce,_0xf662d8){return sendNotification(!![],_0x36039f,_0x143554,_0xede9b3,_0x8697ce,_0xf662d8);};exports[_0x278e('0x2c')]=function(_0x5aa89f,_0x2d920e,_0x3650c6,_0x3663b5,_0x4248e7){return sendNotification(![],_0x5aa89f,_0x2d920e,_0x3650c6,_0x3663b5,_0x4248e7);};exports[_0x278e('0x2d')]=function(_0x1b81bb,_0x5224b3,_0x355406){var _0x1f4055=_0x5224b3[_0x278e('0x2e')][_0x278e('0x2f')];if(!_0x1f4055&&_0x355406){_0x1f4055=_0x355406['id'];}var _0x333968=_[_0x278e('0x30')](_0x1b81bb[_0x5224b3[_0x278e('0x31')]+_0x278e('0x32')],function(_0x48216d){var _0xbfb28=_[_0x278e('0x33')](_0x5224b3[_0x278e('0x31')])+_0x278e('0x34');return _0x48216d[_0xbfb28]===_0x5224b3[_0x278e('0x2e')]['id'];});if(!_0x333968&&_0x1f4055){_0x333968=_[_0x278e('0x30')](_0x1b81bb[_0x278e('0x35')][_0x1f4055][_0x5224b3[_0x278e('0x31')]+_0x278e('0x36')],function(_0x172b13){return _0x172b13['id']===_0x5224b3[_0x278e('0x2e')]['id'];});}return _0x333968;};exports['saveWaitingNotification']=function(_0x5bb05d,_0x5a4421,_0x60d319,_0x2d671e){_0x5bb05d[_0x278e('0x35')][_0x60d319['id']][_0x2d671e+'WaitingInteractions'][_0x5a4421['message']['id']]={'id':_0x5a4421[_0x278e('0x2e')]['id']};};exports[_0x278e('0x37')]=function(_0x2f7c8a,_0x60def6,_0x56f4d2,_0x547217){delete _0x2f7c8a[_0x278e('0x35')][_0x56f4d2['id']][_0x547217+_0x278e('0x36')][_0x60def6[_0x278e('0x1b')]['id']];};exports[_0x278e('0x38')]=writeLog; \ No newline at end of file +var _0x4d3f=['capitalize','InteractionId','agents','WaitingInteractions','saveWaitingNotification','message','removeWaitingNotification','writeLog','util','ioredis','../../../../../config/logger','routing','redis','defaults','socket.io-emitter','format','user:%s','name','emit','user:save','split','\x20interaction','account','notificationSound','notificationShake','body','queue','msg','I\x20can\x27t\x20render\x20your\x20template','error','[%s][QUEUE]\x20%s','notification:%s','save','remove','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','BUSY','Pause','PAUSE','Capacity','hasOwnProperty','CurrentCapacity','toUpperCase','showNotification','checkWaitingNotifications','interaction','some','channel','QueuesWaitingInteractions'];(function(_0x1d8119,_0xc98f17){var _0x3e30f6=function(_0x2c7f3e){while(--_0x2c7f3e){_0x1d8119['push'](_0x1d8119['shift']());}};_0x3e30f6(++_0xc98f17);}(_0x4d3f,0x198));var _0xf4d3=function(_0x39a545,_0x2e80ad){_0x39a545=_0x39a545-0x0;var _0x8d15db=_0x4d3f[_0x39a545];return _0x8d15db;};'use strict';var _=require('lodash');var util=require(_0xf4d3('0x0'));var utils=require('../utils');var Redis=require(_0xf4d3('0x1'));var config=require('../../../../../config/environment');var logger=require(_0xf4d3('0x2'))(_0xf4d3('0x3'));config[_0xf4d3('0x4')]=_[_0xf4d3('0x5')](config[_0xf4d3('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xf4d3('0x6'))(new Redis(config[_0xf4d3('0x4')]));function sendNotification(_0x524fe3,_0x7d1b1a,_0x15e9d4,_0x4d9add,_0x1a6514,_0x54b7e1){io['to'](util[_0xf4d3('0x7')](_0xf4d3('0x8'),_0x4d9add[_0xf4d3('0x9')]))[_0xf4d3('0xa')](_0xf4d3('0xb'),_0x4d9add);var _0x21d688=_0x54b7e1||{};var _0x39f4e7=_0x15e9d4[_0xf4d3('0xc')]('.');var _0x1d5ec5={'uniqueid':_0x7d1b1a,'channel':_0x39f4e7[0x0],'id':_0x39f4e7[0x1],'title':_0x39f4e7[0x0]+_0xf4d3('0xd'),'interactionId':_0x39f4e7[0x2],'queue':_0x1a6514?_0x1a6514['name']:null,'sound':_0x21d688[_0xf4d3('0xe')][_0xf4d3('0xf')],'shake':_0x21d688[_0xf4d3('0xe')][_0xf4d3('0x10')]};try{if(!_0x21d688['body']){_0x21d688['body']={};}if(_0x1a6514){_0x21d688[_0xf4d3('0x11')][_0xf4d3('0x12')]=_0x1a6514;}else if(_0x21d688[_0xf4d3('0x11')][_0xf4d3('0x12')]){delete _0x21d688[_0xf4d3('0x11')][_0xf4d3('0x12')];}_0x1d5ec5[_0xf4d3('0x13')]=utils['getMustacheRender'](_0x21d688[_0xf4d3('0xe')]['notificationTemplate'],_0x21d688);}catch(_0x59050f){_0x1d5ec5['msg']=_0xf4d3('0x14');logger[_0xf4d3('0x15')](util[_0xf4d3('0x7')](_0xf4d3('0x16'),_0x7d1b1a,_0x59050f['message']));}io['to'](util[_0xf4d3('0x7')]('user:%s',_0x4d9add[_0xf4d3('0x9')]))['emit'](util[_0xf4d3('0x7')](_0xf4d3('0x17'),_0x524fe3?_0xf4d3('0x18'):_0xf4d3('0x19')),_0x1d5ec5);}function writeLog(_0x346e14,_0x1c7e22,_0x144b25){return logger['debug'](util[_0xf4d3('0x7')](_0xf4d3('0x1a'),_0x346e14,_0x1c7e22[_0xf4d3('0x9')],_0x144b25));}exports[_0xf4d3('0x1b')]=function(_0xeb911c,_0x5bf951,_0x393dfb,_0x4c0b79){if(_0x5bf951[_0xf4d3('0x1c')]){writeLog(_0xeb911c,_0x5bf951,_0xf4d3('0x1d'));return![];}if(!_0x5bf951['online']){writeLog(_0xeb911c,_0x5bf951,'OFFLINE');return![];}if(_0x5bf951[_0x393dfb+_0xf4d3('0x1e')]){writeLog(_0xeb911c,_0x5bf951,_0xf4d3('0x1f'));return![];}if(_0x4c0b79&&_0x5bf951['hasOwnProperty'](_0x393dfb+_0xf4d3('0x20'))&&_0x5bf951[_0xf4d3('0x21')](_0x393dfb+_0xf4d3('0x22'))){if(_0x5bf951[_0x393dfb+'Capacity']>0x0&&_0x5bf951[_0x393dfb+'CurrentCapacity']>=_0x5bf951[_0x393dfb+_0xf4d3('0x20')]){writeLog(_0xeb911c,_0x5bf951,_0x393dfb[_0xf4d3('0x23')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0xf4d3('0x24')]=function(_0x3ebace,_0x130447,_0x352df3,_0x14c4f5,_0xf45884){return sendNotification(!![],_0x3ebace,_0x130447,_0x352df3,_0x14c4f5,_0xf45884);};exports['hideNotification']=function(_0x17371c,_0x36273b,_0x34f9ac,_0xef4f8b,_0x37b417){return sendNotification(![],_0x17371c,_0x36273b,_0x34f9ac,_0xef4f8b,_0x37b417);};exports[_0xf4d3('0x25')]=function(_0x1020ec,_0x28661d,_0x53c0a3){var _0x2ff0f9=_0x28661d[_0xf4d3('0x26')]['UserId'];if(!_0x2ff0f9&&_0x53c0a3){_0x2ff0f9=_0x53c0a3['id'];}var _0x591334=_[_0xf4d3('0x27')](_0x1020ec[_0x28661d[_0xf4d3('0x28')]+_0xf4d3('0x29')],function(_0xa9353c){var _0x256006=_[_0xf4d3('0x2a')](_0x28661d[_0xf4d3('0x28')])+_0xf4d3('0x2b');return _0xa9353c[_0x256006]===_0x28661d['interaction']['id'];});if(!_0x591334&&_0x2ff0f9){_0x591334=_[_0xf4d3('0x27')](_0x1020ec[_0xf4d3('0x2c')][_0x2ff0f9][_0x28661d[_0xf4d3('0x28')]+_0xf4d3('0x2d')],function(_0x35e1eb){return _0x35e1eb['id']===_0x28661d['interaction']['id'];});}return _0x591334;};exports[_0xf4d3('0x2e')]=function(_0x297030,_0x3b7641,_0x1a8c20,_0x37a3b0){_0x297030[_0xf4d3('0x2c')][_0x1a8c20['id']][_0x37a3b0+_0xf4d3('0x2d')][_0x3b7641[_0xf4d3('0x2f')]['id']]={'id':_0x3b7641[_0xf4d3('0x26')]['id']};};exports[_0xf4d3('0x30')]=function(_0x1ee0b3,_0x29d8ec,_0x4f3e1f,_0x48dfd8){delete _0x1ee0b3[_0xf4d3('0x2c')][_0x4f3e1f['id']][_0x48dfd8+'WaitingInteractions'][_0x29d8ec['message']['id']];};exports[_0xf4d3('0x31')]=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 9a1555c..b2ab82a 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 _0x0fbb=['body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','next','stringify','validate','shelljs','lodash','./utils','../../../../config/logger','routing','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','error','[%s][SYSTEM]\x20%s','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty'];(function(_0x5416db,_0x55683a){var _0x243e35=function(_0x1eb623){while(--_0x1eb623){_0x5416db['push'](_0x5416db['shift']());}};_0x243e35(++_0x55683a);}(_0x0fbb,0x17e));var _0xb0fb=function(_0x457672,_0x5d3cb3){_0x457672=_0x457672-0x0;var _0x10f577=_0x0fbb[_0x457672];return _0x10f577;};'use strict';var schema=require(_0xb0fb('0x0'));var sh=require(_0xb0fb('0x1'));var _=require(_0xb0fb('0x2'));var utils=require(_0xb0fb('0x3'));var logger=require(_0xb0fb('0x4'))(_0xb0fb('0x5'));var system=schema({'command':{'type':'string','required':!![],'message':_0xb0fb('0x6')}});exports['consequence']=function(_0x139dd8,_0x492f61){return function(_0x346477){try{var _0xc778bb={'command':_0x492f61[0x0]};var _0x5b7f5e=system[_0xb0fb('0x0')](_0xc778bb,{'typecast':!![]});if(_0x5b7f5e[_0xb0fb('0x7')]){logger[_0xb0fb('0x8')](_0xb0fb('0x9'),_0x139dd8,_[_0xb0fb('0xa')](_0x5b7f5e,_0xb0fb('0xb'))[_0xb0fb('0xc')](',\x20'));logger[_0xb0fb('0xd')](_0xb0fb('0xe'),_0x139dd8);_0x346477['next']();}else{var _0x5a774a=this;var _0x3dc8af=utils[_0xb0fb('0xf')](_0x492f61[0x0],this);logger[_0xb0fb('0xd')](_0xb0fb('0x10'),_0x139dd8,_0x3dc8af);sh[_0xb0fb('0x11')](_[_0xb0fb('0x12')](_0x3dc8af),function(_0x5672c8,_0x31ab0f){logger[_0xb0fb('0xd')](_0xb0fb('0x13'),_0x139dd8,_0x5672c8);if(_0x5672c8==0x0){var _0x5785ef=_0x31ab0f[_0xb0fb('0x14')](/(\r\n|\n|\r)/gm,'');if(_[_0xb0fb('0x15')](_0x492f61[0x1])||_[_0xb0fb('0x16')](_0x492f61[0x1])){logger[_0xb0fb('0xd')]('[%s][SYSTEM]\x20no\x20variable',_0x139dd8);_0x5a774a[_0xb0fb('0x17')][_0x492f61[0x1]]=_0x5785ef;}else{logger[_0xb0fb('0xd')](_0xb0fb('0x18'),_0x139dd8,_0x492f61[0x1],_0x5785ef);_0x5a774a[_0xb0fb('0x17')][_0x492f61[0x1]]=_0x5785ef;}}_0x346477[_0xb0fb('0x19')]();});}}catch(_0x176520){logger[_0xb0fb('0x8')](_0xb0fb('0x9'),_0x139dd8,_['isObject'](_0x176520)?JSON[_0xb0fb('0x1a')](_0x176520):_0x176520);logger['info'](_0xb0fb('0xe'),_0x139dd8);_0x346477[_0xb0fb('0x19')]();}};}; \ No newline at end of file +var _0xef60=['[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify','validate','shelljs','lodash','./utils','../../../../config/logger','routing','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','map','message','info'];(function(_0x3f6d7a,_0x561052){var _0x5eb532=function(_0x2bf5f8){while(--_0x2bf5f8){_0x3f6d7a['push'](_0x3f6d7a['shift']());}};_0x5eb532(++_0x561052);}(_0xef60,0xa0));var _0x0ef6=function(_0x3b7ec8,_0x35ec06){_0x3b7ec8=_0x3b7ec8-0x0;var _0x597f11=_0xef60[_0x3b7ec8];return _0x597f11;};'use strict';var schema=require(_0x0ef6('0x0'));var sh=require(_0x0ef6('0x1'));var _=require(_0x0ef6('0x2'));var utils=require(_0x0ef6('0x3'));var logger=require(_0x0ef6('0x4'))(_0x0ef6('0x5'));var system=schema({'command':{'type':'string','required':!![],'message':_0x0ef6('0x6')}});exports[_0x0ef6('0x7')]=function(_0x4ab639,_0x32efaa){return function(_0x15a422){try{var _0x5f149b={'command':_0x32efaa[0x0]};var _0x1d664b=system[_0x0ef6('0x0')](_0x5f149b,{'typecast':!![]});if(_0x1d664b[_0x0ef6('0x8')]){logger[_0x0ef6('0x9')](_0x0ef6('0xa'),_0x4ab639,_[_0x0ef6('0xb')](_0x1d664b,_0x0ef6('0xc'))['join'](',\x20'));logger[_0x0ef6('0xd')](_0x0ef6('0xe'),_0x4ab639);_0x15a422[_0x0ef6('0xf')]();}else{var _0x44a6e1=this;var _0x5ec3ec=utils[_0x0ef6('0x10')](_0x32efaa[0x0],this);logger['info'](_0x0ef6('0x11'),_0x4ab639,_0x5ec3ec);sh[_0x0ef6('0x12')](_[_0x0ef6('0x13')](_0x5ec3ec),function(_0x529ca8,_0x1f8dd2){logger[_0x0ef6('0xd')](_0x0ef6('0x14'),_0x4ab639,_0x529ca8);if(_0x529ca8==0x0){var _0x29eecf=_0x1f8dd2[_0x0ef6('0x15')](/(\r\n|\n|\r)/gm,'');if(_[_0x0ef6('0x16')](_0x32efaa[0x1])||_[_0x0ef6('0x17')](_0x32efaa[0x1])){logger['info'](_0x0ef6('0x18'),_0x4ab639);_0x44a6e1[_0x0ef6('0x19')][_0x32efaa[0x1]]=_0x29eecf;}else{logger['info'](_0x0ef6('0x1a'),_0x4ab639,_0x32efaa[0x1],_0x29eecf);_0x44a6e1[_0x0ef6('0x19')][_0x32efaa[0x1]]=_0x29eecf;}}_0x15a422[_0x0ef6('0xf')]();});}}catch(_0x3dc698){logger[_0x0ef6('0x9')](_0x0ef6('0xa'),_0x4ab639,_[_0x0ef6('0x1b')](_0x3dc698)?JSON[_0x0ef6('0x1c')](_0x3dc698):_0x3dc698);logger[_0x0ef6('0xd')](_0x0ef6('0xe'),_0x4ab639);_0x15a422[_0x0ef6('0xf')]();}};}; \ 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 f2cfa9b..5930fef 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 _0x33eb=['info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel','Interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','interaction','stringify','finally','next','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][TAG]\x20%s','map','message','join'];(function(_0x3ce764,_0x5d151f){var _0x56a018=function(_0x22ef28){while(--_0x22ef28){_0x3ce764['push'](_0x3ce764['shift']());}};_0x56a018(++_0x5d151f);}(_0x33eb,0x166));var _0xb33e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x33eb[_0x20a584];return _0x4b41a8;};'use strict';var schema=require(_0xb33e('0x0'));var _=require(_0xb33e('0x1'));var rpc={'chatInteraction':require(_0xb33e('0x2')),'openchannelInteraction':require(_0xb33e('0x3')),'smsInteraction':require(_0xb33e('0x4')),'mailInteraction':require(_0xb33e('0x5')),'faxInteraction':require(_0xb33e('0x6')),'whatsappInteraction':require(_0xb33e('0x7'))};var logger=require(_0xb33e('0x8'))(_0xb33e('0x9'));var tag=schema({'tag':{'type':_0xb33e('0xa'),'required':!![],'message':_0xb33e('0xb')}});exports[_0xb33e('0xc')]=function(_0x3e2bb6,_0x2c625a,_0x355990,_0x277746){return function(_0x19b3a2){try{var _0x31dc47={'tag':_0x2c625a[0x0]};var _0x2b295e=tag['validate'](_0x31dc47,{'typecast':!![]});if(_0x2b295e[_0xb33e('0xd')]){logger[_0xb33e('0xe')](_0xb33e('0xf'),_0x3e2bb6,_[_0xb33e('0x10')](_0x2b295e,_0xb33e('0x11'))[_0xb33e('0x12')](',\x20'));logger[_0xb33e('0x13')](_0xb33e('0x14'),_0x3e2bb6);_0x19b3a2['next']();}else{var _0x364e3f={'ids':[_0x2c625a[0x0]]};if(rpc[_0x277746['channel']+'Interaction']){rpc[_0x277746[_0xb33e('0x15')]+_0xb33e('0x16')]['addTags'](_0x277746['interaction']['id'],_0x364e3f)[_0xb33e('0x17')](function(_0x48e245){logger[_0xb33e('0x13')](_0xb33e('0x18'),_0x3e2bb6,_0x2c625a[0x1],_0x277746[_0xb33e('0x15')],_0x277746[_0xb33e('0x19')]['id']);})['catch'](function(_0x1618ce){logger[_0xb33e('0xe')](_0xb33e('0xf'),_0x3e2bb6,JSON[_0xb33e('0x1a')](_0x1618ce));logger[_0xb33e('0x13')](_0xb33e('0x14'),_0x3e2bb6);})[_0xb33e('0x1b')](function(){_0x19b3a2[_0xb33e('0x1c')]();});}}}catch(_0x3f82d3){logger['error'](_0xb33e('0xf'),_0x3e2bb6,_['isObject'](_0x3f82d3)?JSON[_0xb33e('0x1a')](_0x3f82d3):_0x3f82d3);logger[_0xb33e('0x13')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x3e2bb6);_0x19b3a2[_0xb33e('0x1c')]();}};}; \ No newline at end of file +var _0x276e=['addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','[%s][TAG]\x20%s','stringify','finally','isObject','next','validate','lodash','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','map','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','Interaction'];(function(_0x54f21a,_0x103714){var _0x3d7ede=function(_0x23ef78){while(--_0x23ef78){_0x54f21a['push'](_0x54f21a['shift']());}};_0x3d7ede(++_0x103714);}(_0x276e,0x1ae));var _0xe276=function(_0x44c974,_0x1bcfde){_0x44c974=_0x44c974-0x0;var _0x5214c6=_0x276e[_0x44c974];return _0x5214c6;};'use strict';var schema=require(_0xe276('0x0'));var _=require(_0xe276('0x1'));var rpc={'chatInteraction':require(_0xe276('0x2')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0xe276('0x3')),'mailInteraction':require(_0xe276('0x4')),'faxInteraction':require(_0xe276('0x5')),'whatsappInteraction':require(_0xe276('0x6'))};var logger=require(_0xe276('0x7'))(_0xe276('0x8'));var tag=schema({'tag':{'type':_0xe276('0x9'),'required':!![],'message':_0xe276('0xa')}});exports[_0xe276('0xb')]=function(_0x4a0a69,_0x4377ff,_0xdb50fa,_0x3c9fc0){return function(_0x488fcc){try{var _0xe7d862={'tag':_0x4377ff[0x0]};var _0x58a6f9=tag[_0xe276('0x0')](_0xe7d862,{'typecast':!![]});if(_0x58a6f9[_0xe276('0xc')]){logger[_0xe276('0xd')]('[%s][TAG]\x20%s',_0x4a0a69,_[_0xe276('0xe')](_0x58a6f9,'message')['join'](',\x20'));logger[_0xe276('0xf')](_0xe276('0x10'),_0x4a0a69);_0x488fcc['next']();}else{var _0x2a7197={'ids':[_0x4377ff[0x0]]};if(rpc[_0x3c9fc0['channel']+_0xe276('0x11')]){rpc[_0x3c9fc0['channel']+_0xe276('0x11')][_0xe276('0x12')](_0x3c9fc0[_0xe276('0x13')]['id'],_0x2a7197)[_0xe276('0x14')](function(_0x217ebc){logger[_0xe276('0xf')](_0xe276('0x15'),_0x4a0a69,_0x4377ff[0x1],_0x3c9fc0['channel'],_0x3c9fc0[_0xe276('0x13')]['id']);})[_0xe276('0x16')](function(_0xc3e399){logger[_0xe276('0xd')](_0xe276('0x17'),_0x4a0a69,JSON[_0xe276('0x18')](_0xc3e399));logger[_0xe276('0xf')](_0xe276('0x10'),_0x4a0a69);})[_0xe276('0x19')](function(){_0x488fcc['next']();});}}}catch(_0xd72a96){logger[_0xe276('0xd')](_0xe276('0x17'),_0x4a0a69,_[_0xe276('0x1a')](_0xd72a96)?JSON['stringify'](_0xd72a96):_0xd72a96);logger[_0xe276('0xf')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x4a0a69);_0x488fcc[_0xe276('0x1b')]();}};}; \ 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 063c32c..2197d45 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 _0x95d8=['utf8','POST','parse','result','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','&data=','then','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','error','[%s][TVOX]\x20%s','info','next','consequence','replace','\x20-\x20','includes','push','?params=','urlOnRing','title','jsonrpc','2.0','login','params','stringify'];(function(_0x475db7,_0x1cfbd9){var _0x1f06f9=function(_0x4c2646){while(--_0x4c2646){_0x475db7['push'](_0x475db7['shift']());}};_0x1f06f9(++_0x1cfbd9);}(_0x95d8,0x1a6));var _0x895d=function(_0x2e0c73,_0x17db18){_0x2e0c73=_0x2e0c73-0x0;var _0x3e3938=_0x95d8[_0x2e0c73];return _0x3e3938;};'use strict';var rp=require('request-promise');var logger=require('../../../../config/logger')('routing');var _=require('lodash');var arr=[];exports[_0x895d('0x0')]=function(_0x4537fe,_0x333761){return function(_0x5854d1){var _0x543396=_0x333761[0xa];var _0x575ddf=_0x333761[0xb];var _0x2f4fa6=_0x333761[0xc];var _0x2a3fed=_0x333761[0xd];var _0x47dc13=_0x333761[0xe];var _0x536060=_0x333761[0xf][_0x895d('0x1')](/\n/g,_0x895d('0x2'));var _0x531209=_0x333761[0x10][_0x895d('0x1')](/\n/g,'\x20');if(!arr[_0x895d('0x3')](_0x575ddf)){arr[_0x895d('0x4')](_0x575ddf);var _0xea6ab2=_0x333761[0x3];var _0x4946df=_0x333761[0x4];var _0x263454=_0x333761[0x1];var _0x4fbf2b=_0x333761[0x0];var _0xc1a508={};_0xc1a508['urlOnAnswer']=_0x333761[0x8]+_0x895d('0x5')+_0x2f4fa6+'|'+_0x543396+'|'+_0x2a3fed+'|'+_0x575ddf+'|'+_0x47dc13;_0xc1a508[_0x895d('0x6')]=_0x333761[0x7]+_0x895d('0x5')+_0x2f4fa6+'|'+_0x543396+'|'+_0x2a3fed+'|'+_0x575ddf+'|'+_0x47dc13+'|'+_0x536060+'|'+_0x531209;_0xc1a508[_0x895d('0x7')]=_0x333761[0x9];var _0x1e3726={};_0x1e3726[_0x895d('0x8')]=_0x895d('0x9');_0x1e3726['method']=_0x895d('0xa');var _0x360a3b=[];_0x360a3b[_0x895d('0x4')](_0x333761[0x2]);_0x360a3b['push'](_0x333761[0x5]);_0x360a3b[_0x895d('0x4')](_0x333761[0x6]);_0x1e3726[_0x895d('0xb')]=_0x360a3b;_0x1e3726['id']=0x1;var _0x5ebcea=JSON[_0x895d('0xc')](_0x1e3726);var _0x3c7be8={'encoding':_0x895d('0xd'),'method':_0x895d('0xe'),'timeout':0x2710,'url':_0xea6ab2,'headers':{'Content-Type':'application/json-rpc'},'body':_0x5ebcea};return rp(_0x3c7be8)['then'](function(_0x51f04d){const _0x3b49e1=JSON[_0x895d('0xf')](_0x51f04d);if(!_0x3b49e1[_0x895d('0x10')]['logged']){throw new Error(_0x895d('0x11'));}var _0x23cff1=_0x575ddf;var _0x34cf42=_0x895d('0x12')+_0x263454+_0x895d('0x13')+_0x4fbf2b+_0x895d('0x14')+_0x23cff1+_0x895d('0x15')+JSON['stringify'](_0xc1a508);var _0x11a32d=_0x4946df+'?'+_0x34cf42;return rp(_0x11a32d);})[_0x895d('0x16')](function(_0x9ac574){logger['info'](_0x895d('0x17'),_0x4537fe,_0x9ac574);_0x5854d1[_0x895d('0x18')]();})['catch'](function(_0x37bd6e){logger[_0x895d('0x19')](_0x895d('0x1a'),_0x4537fe,_['isObject'](_0x37bd6e)?JSON['stringify'](_0x37bd6e):_0x37bd6e);_0x5854d1[_0x895d('0x18')]();});}else{logger[_0x895d('0x1b')]('[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next',_0x4537fe);_0x5854d1[_0x895d('0x1c')]();}};}; \ No newline at end of file +var _0xf85a=['params','stringify','utf8','then','parse','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&sessionId=','&data=','info','stop','catch','error','[%s][TVOX]\x20%s','isObject','next','request-promise','../../../../config/logger','routing','consequence','replace','\x20-\x20','push','urlOnAnswer','title','jsonrpc','2.0','method','login'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xf85a,0x1a5));var _0xaf85=function(_0x4787b9,_0x51614c){_0x4787b9=_0x4787b9-0x0;var _0x64cc20=_0xf85a[_0x4787b9];return _0x64cc20;};'use strict';var rp=require(_0xaf85('0x0'));var logger=require(_0xaf85('0x1'))(_0xaf85('0x2'));var _=require('lodash');var arr=[];exports[_0xaf85('0x3')]=function(_0x4a7a0d,_0x271929){return function(_0x35bbac){var _0x3efe6c=_0x271929[0xa];var _0x2b13f0=_0x271929[0xb];var _0x53410e=_0x271929[0xc];var _0x3939a4=_0x271929[0xd];var _0x1a13cb=_0x271929[0xe];var _0x581cdb=_0x271929[0xf][_0xaf85('0x4')](/\n/g,_0xaf85('0x5'));var _0x225ad1=_0x271929[0x10][_0xaf85('0x4')](/\n/g,'\x20');if(!arr['includes'](_0x2b13f0)){arr[_0xaf85('0x6')](_0x2b13f0);var _0x41b9ee=_0x271929[0x3];var _0x504f6b=_0x271929[0x4];var _0x32367f=_0x271929[0x1];var _0x2c7507=_0x271929[0x0];var _0xc7cb59={};_0xc7cb59[_0xaf85('0x7')]=_0x271929[0x8]+'?params='+_0x53410e+'|'+_0x3efe6c+'|'+_0x3939a4+'|'+_0x2b13f0+'|'+_0x1a13cb;_0xc7cb59['urlOnRing']=_0x271929[0x7]+'?params='+_0x53410e+'|'+_0x3efe6c+'|'+_0x3939a4+'|'+_0x2b13f0+'|'+_0x1a13cb+'|'+_0x581cdb+'|'+_0x225ad1;_0xc7cb59[_0xaf85('0x8')]=_0x271929[0x9];var _0x287e1e={};_0x287e1e[_0xaf85('0x9')]=_0xaf85('0xa');_0x287e1e[_0xaf85('0xb')]=_0xaf85('0xc');var _0x104cbe=[];_0x104cbe[_0xaf85('0x6')](_0x271929[0x2]);_0x104cbe['push'](_0x271929[0x5]);_0x104cbe['push'](_0x271929[0x6]);_0x287e1e[_0xaf85('0xd')]=_0x104cbe;_0x287e1e['id']=0x1;var _0x170946=JSON[_0xaf85('0xe')](_0x287e1e);var _0xe05f71={'encoding':_0xaf85('0xf'),'method':'POST','timeout':0x2710,'url':_0x41b9ee,'headers':{'Content-Type':'application/json-rpc'},'body':_0x170946};return rp(_0xe05f71)[_0xaf85('0x10')](function(_0x8896f1){const _0x2f646c=JSON[_0xaf85('0x11')](_0x8896f1);if(!_0x2f646c[_0xaf85('0x12')][_0xaf85('0x13')]){throw new Error(_0xaf85('0x14'));}var _0x5136d0=_0x2b13f0;var _0x2528c8=_0xaf85('0x15')+_0x32367f+'&serviceId='+_0x2c7507+_0xaf85('0x16')+_0x5136d0+_0xaf85('0x17')+JSON['stringify'](_0xc7cb59);var _0x2409dc=_0x504f6b+'?'+_0x2528c8;return rp(_0x2409dc);})['then'](function(_0x34af50){logger[_0xaf85('0x18')]('[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s',_0x4a7a0d,_0x34af50);_0x35bbac[_0xaf85('0x19')]();})[_0xaf85('0x1a')](function(_0x2b230f){logger[_0xaf85('0x1b')](_0xaf85('0x1c'),_0x4a7a0d,_[_0xaf85('0x1d')](_0x2b230f)?JSON[_0xaf85('0xe')](_0x2b230f):_0x2b230f);_0x35bbac[_0xaf85('0x19')]();});}else{logger[_0xaf85('0x18')]('[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next',_0x4a7a0d);_0x35bbac[_0xaf85('0x1e')]();}};}; \ 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 ff99202..2c98d42 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x291d5b,_0x3651f6){var _0x4ed8ed=function(_0x287c05){while(--_0x287c05){_0x291d5b['push'](_0x291d5b['shift']());}};_0x4ed8ed(++_0x3651f6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa9e0[_0x6131cd];return _0x47e916;};'use strict';var Mustache=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'getMustacheRender':function(_0x5dd881,_0x550fbc){return Mustache[_0x0a9e('0x3')](_0x5dd881,_['merge'](_0x550fbc[_0x0a9e('0x4')],{'contact':_0x550fbc[_0x0a9e('0x5')],'message':_0x550fbc[_0x0a9e('0x6')],'account':_0x550fbc[_0x0a9e('0x7')],'interaction':_0x550fbc[_0x0a9e('0x8')],'list':_0x550fbc['list']}))||'';}}; \ No newline at end of file +var _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x28231b,_0x1e11d2){var _0x207be5=function(_0x251e0b){while(--_0x251e0b){_0x28231b['push'](_0x28231b['shift']());}};_0x207be5(++_0x1e11d2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xa9e0[_0x220dbb];return _0x2b77de;};'use strict';var Mustache=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'getMustacheRender':function(_0x5dd881,_0x550fbc){return Mustache[_0x0a9e('0x3')](_0x5dd881,_['merge'](_0x550fbc[_0x0a9e('0x4')],{'contact':_0x550fbc[_0x0a9e('0x5')],'message':_0x550fbc[_0x0a9e('0x6')],'account':_0x550fbc[_0x0a9e('0x7')],'interaction':_0x550fbc[_0x0a9e('0x8')],'list':_0x550fbc['list']}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index b66f1fc..f497c40 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 _0x0325=['name','waiting','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','faxQueuesWaitingInteractions','server','http','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','bluebird','./applications/utils','../../../config/logger','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','IntervalId','isNil','Intervals','map','interval','listen','rules','channel','message','interaction','checkWaitingNotifications','applications','length','existsSync','join','app','toLowerCase','autoreply','split','mail','push','slice','dialogflow','appdata','dialogflowv2','amazonlex','tag','TagId','tvox','getMustacheRender','account','notificationTemplate','ContactId','body','./interval','intervals','consequence','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','.js','execute','stringify','matchPath','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agents','agent','busy','emit','QueueReport','UserId','error\x20update\x20queue\x20report','message\x20is\x20empty','busyQueue','end','capacity','hasOwnProperty','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','find','chatQueues','available','paused','mailQueues','loggedIn'];(function(_0x468a77,_0x1382be){var _0x2d1c33=function(_0x2f2e83){while(--_0x2f2e83){_0x468a77['push'](_0x468a77['shift']());}};_0x2d1c33(++_0x1382be);}(_0x0325,0x71));var _0x5032=function(_0x15d5e7,_0x5979f7){_0x15d5e7=_0x15d5e7-0x0;var _0x3bfb0a=_0x0325[_0x15d5e7];return _0x3bfb0a;};'use strict';var _=require(_0x5032('0x0'));var util=require(_0x5032('0x1'));var path=require(_0x5032('0x2'));var fs=require('fs');var jayson=require(_0x5032('0x3'));var BPromise=require(_0x5032('0x4'));var utils=require(_0x5032('0x5'));var sUtils=require('./applications/strategy/util');var logger=require(_0x5032('0x6'))('routing');var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x5032('0x7')),'chatQueueReport':require(_0x5032('0x8')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0x5032('0x9')),'whatsappQueueReport':require(_0x5032('0xa'))};var RuleEngine=require(_0x5032('0xb'));function getId(_0x307133,_0x20ee60,_0x1567f2){return util[_0x5032('0xc')]('%s.%s.%s',_0x307133,_0x20ee60||0x0,_0x1567f2||0x0);}function getIntervals(_0x2af4ea,_0x2be816){var _0x3eec28=[];if(!_['isNil'](_0x2be816['IntervalId'])&&!_['isNil'](_0x2af4ea[_0x2be816[_0x5032('0xd')]])&&!_[_0x5032('0xe')](_0x2af4ea[_0x2be816['IntervalId']][_0x5032('0xf')])){_0x3eec28=_[_0x5032('0x10')](_0x2af4ea[_0x2be816[_0x5032('0xd')]][_0x5032('0xf')],_0x5032('0x11'));}else if(!_['isNil'](_0x2be816[_0x5032('0x11')])){_0x3eec28=[_0x2be816['interval']];}return _0x3eec28;}exports[_0x5032('0x12')]=function(_0x34397d){_0x34397d[_0x5032('0x13')]={};return new BPromise(function(_0x4a7bd0,_0x19d663){var _0xa7d285={'Start':function(_0x59310d){var _0x1c608c=this;return new Promise(function(_0x545e75,_0x48a3ae){if(_0x59310d){try{var _0x5e5f72=[];var _0x128e39=getId(_0x59310d[_0x5032('0x14')],_0x59310d[_0x5032('0x15')]?_0x59310d[_0x5032('0x15')]['id']:0x0,_0x59310d[_0x5032('0x16')]?_0x59310d[_0x5032('0x16')]['id']:0x0);var _0xdcf6d8=sUtils[_0x5032('0x17')](_0x34397d,_0x59310d);if(!_0xdcf6d8&&_0x59310d[_0x5032('0x18')]&&_['isArray'](_0x59310d[_0x5032('0x18')])&&_0x59310d[_0x5032('0x18')][_0x5032('0x19')]){for(var _0x47ad46=0x0;_0x47ad46<_0x59310d[_0x5032('0x18')]['length'];_0x47ad46+=0x1){var _0x4d1498=_0x59310d[_0x5032('0x18')][_0x47ad46];if(fs[_0x5032('0x1a')](path[_0x5032('0x1b')](__dirname,_0x5032('0x18'),_0x4d1498[_0x5032('0x1c')]+'.js'))){var _0x4f3d2d=[];switch(_0x4d1498[_0x5032('0x1c')][_0x5032('0x1d')]()){case _0x5032('0x1e'):var _0x180435=_0x4d1498['appdata'][_0x5032('0x1f')](',');if(_0x59310d[_0x5032('0x14')]===_0x5032('0x20')){_0x4f3d2d[_0x5032('0x21')](_0x180435[0x0]);_0x4f3d2d['push'](_0x180435[0x1]);_0x4f3d2d[_0x5032('0x21')](_0x180435[_0x5032('0x22')](0x2,_0x180435[_0x5032('0x19')])[_0x5032('0x1b')](','));}else{_0x4f3d2d[_0x5032('0x21')](_0x180435[0x0]);_0x4f3d2d['push'](_0x180435[_0x5032('0x22')](0x1,_0x180435[_0x5032('0x19')])[_0x5032('0x1b')](','));}break;case _0x5032('0x23'):var _0xa79d75=_0x4d1498[_0x5032('0x24')]['split'](',');_0x4f3d2d[_0x5032('0x21')](_0xa79d75[0x0]);_0x4f3d2d['push'](_0xa79d75[0x1]);_0x4f3d2d['push'](_0xa79d75['slice'](0x2,_0xa79d75[_0x5032('0x19')])[_0x5032('0x1b')](','));break;case _0x5032('0x25'):var _0x13ecb4=_0x4d1498[_0x5032('0x24')]['split'](',');_0x4f3d2d['push'](_0x13ecb4[0x0]);_0x4f3d2d[_0x5032('0x21')](_0x13ecb4[0x1]);_0x4f3d2d[_0x5032('0x21')](_0x13ecb4[0x2]);_0x4f3d2d['push'](_0x13ecb4[0x3]);_0x4f3d2d['push'](_0x13ecb4[_0x5032('0x22')](0x4,_0x13ecb4[_0x5032('0x19')])[_0x5032('0x1b')](','));break;case _0x5032('0x26'):var _0x1213c2=_0x4d1498[_0x5032('0x24')][_0x5032('0x1f')](',');_0x4f3d2d[_0x5032('0x21')](_0x1213c2[0x0]);_0x4f3d2d[_0x5032('0x21')](_0x1213c2[0x1]);_0x4f3d2d['push'](_0x1213c2[0x2]);_0x4f3d2d[_0x5032('0x21')](_0x1213c2[0x3]);_0x4f3d2d[_0x5032('0x21')](_0x1213c2[_0x5032('0x22')](0x4,_0x1213c2['length'])[_0x5032('0x1b')](','));break;case'message':_0x4f3d2d[_0x5032('0x21')](_0x4d1498[_0x5032('0x24')]);break;case _0x5032('0x27'):_0x4f3d2d[_0x5032('0x21')](_0x4d1498[_0x5032('0x28')]);_0x4f3d2d['push'](_0x4d1498['appdata']);break;case _0x5032('0x29'):var _0x21570f=utils[_0x5032('0x2a')](_0x59310d[_0x5032('0x2b')][_0x5032('0x2c')],_0x59310d);var _0x14fc09=_0x4d1498['appdata']['split'](',');_0x4f3d2d[_0x5032('0x21')](_0x14fc09[0x0]);_0x4f3d2d[_0x5032('0x21')](_0x14fc09[0x1]);_0x4f3d2d[_0x5032('0x21')](_0x14fc09[0x2]);_0x4f3d2d[_0x5032('0x21')](_0x14fc09[0x3]);_0x4f3d2d[_0x5032('0x21')](_0x14fc09[0x4]);_0x4f3d2d[_0x5032('0x21')](_0x14fc09[0x5]);_0x4f3d2d[_0x5032('0x21')](_0x14fc09[0x6]);_0x4f3d2d[_0x5032('0x21')](_0x14fc09[0x7]);_0x4f3d2d[_0x5032('0x21')](_0x14fc09[0x8]);_0x4f3d2d[_0x5032('0x21')](_0x14fc09[0x9]);_0x4f3d2d[_0x5032('0x21')](_0x14fc09[0xa]);_0x4f3d2d[_0x5032('0x21')](_0x59310d[_0x5032('0x16')]['id']);_0x4f3d2d[_0x5032('0x21')](_0x59310d['message']['id']);_0x4f3d2d[_0x5032('0x21')](_0x4d1498['ChatWebsiteId']);_0x4f3d2d['push'](_0x59310d['interaction'][_0x5032('0x2d')]);_0x4f3d2d[_0x5032('0x21')](_0x59310d[_0x5032('0x2e')]['body']);_0x4f3d2d[_0x5032('0x21')](_0x21570f);break;default:_0x4f3d2d=_['isNil'](_0x4d1498['appdata'])?[]:_0x4d1498['appdata'][_0x5032('0x1f')](',');}var _0x7ea58c={'id':util[_0x5032('0xc')]('%s:%s:%s',_0x128e39,_0x4d1498['id'],_0x4d1498['app']),'condition':require(_0x5032('0x2f'))['condition'](_0x128e39,getIntervals(_0x34397d[_0x5032('0x30')],_0x4d1498),_0x34397d),'consequence':require('./applications/'+_0x4d1498[_0x5032('0x1c')])[_0x5032('0x31')](_0x128e39,_0x4f3d2d,_0x34397d,_0x59310d),'p':_0x4d1498['priority']||0x0};logger[_0x5032('0x32')](_0x5032('0x33'),_0x7ea58c['id'],_0x5032('0x34'),getIntervals(_0x34397d[_0x5032('0x30')],_0x4d1498)[_0x5032('0x1b')](_0x5032('0x35')));_0x5e5f72[_0x5032('0x21')](_0x7ea58c);}else{logger[_0x5032('0x36')]('Please\x20create\x20a\x20new\x20file\x20under',path['join'](__dirname,'applications',_0x4d1498['app']+_0x5032('0x37')));}}_0x34397d[_0x5032('0x13')][_0x128e39]=new RuleEngine(_0x5e5f72);_0x34397d['rules'][_0x128e39][_0x5032('0x38')](_0x59310d,function(_0x1b9839){logger[_0x5032('0x32')]('Applications\x20executed',JSON[_0x5032('0x39')](_0x1b9839[_0x5032('0x3a')]));if(_0x34397d[_0x5032('0x13')][_0x128e39]){_0x34397d[_0x5032('0x13')][_0x128e39]['emit']('complete');}});return _0x545e75({'code':0xc8,'message':_0x59310d});}else{if(_0xdcf6d8){logger[_0x5032('0x32')](util[_0x5032('0xc')](_0x5032('0x3b'),_0x128e39));}else{logger[_0x5032('0x32')](_0x5032('0x3c'));}return _0x545e75({'code':0xc8,'message':_0x59310d});}}catch(_0xad274c){logger[_0x5032('0x36')](_0xad274c[_0x5032('0x3d')]);return _0x48a3ae(_0x1c608c['error'](0x1f4,_0xad274c));}}return _0x48a3ae(_0x5032('0x3e'));});},'AcceptMessage':function(_0x2d1b7c){var _0x1989e4=this;return new Promise(function(_0x249ee7,_0x1788b4){if(_0x2d1b7c['agent']&&_0x2d1b7c['agent']['id']){if(_0x34397d[_0x5032('0x3f')][_0x2d1b7c[_0x5032('0x40')]['id']]){_0x34397d[_0x5032('0x3f')][_0x2d1b7c['agent']['id']][_0x5032('0x41')]=![];_0x34397d[_0x5032('0x3f')][_0x2d1b7c[_0x5032('0x40')]['id']]['busyQueue']=undefined;}}if(_0x2d1b7c[_0x5032('0x15')]&&_0x2d1b7c[_0x5032('0x15')]['id']){try{var _0x464d84=getId(_0x2d1b7c['channel'],_0x2d1b7c[_0x5032('0x15')]?_0x2d1b7c[_0x5032('0x15')]['id']:0x0,_0x2d1b7c[_0x5032('0x16')]?_0x2d1b7c[_0x5032('0x16')]['id']:0x0);if(_0x34397d[_0x5032('0x13')][_0x464d84]){_0x34397d[_0x5032('0x13')][_0x464d84][_0x5032('0x42')]('end');if(rpc[_0x2d1b7c['channel']+_0x5032('0x43')]){rpc[_0x2d1b7c[_0x5032('0x14')]+'QueueReport']['update'](_0x464d84,{'UserId':_0x2d1b7c[_0x5032('0x15')][_0x5032('0x44')]})['catch'](function(){logger[_0x5032('0x36')](_0x5032('0x45'));});}}return _0x249ee7({'code':0xc8,'message':_0x2d1b7c});}catch(_0xa38ce3){logger['error'](_0xa38ce3[_0x5032('0x3d')]);return _0x1788b4(_0x1989e4['error'](0x1f4,_0xa38ce3));}}logger['error'](_0x5032('0x46'));return _0x1788b4(_0x1989e4['error'](0x1f4,_0x5032('0x46')));});},'RejectMessage':function(_0x15d17c){var _0x25dc96=this;return new Promise(function(_0x4e2b04,_0x49a7a2){if(_0x15d17c[_0x5032('0x40')]&&_0x15d17c[_0x5032('0x40')]['id']){try{if(_0x34397d[_0x5032('0x3f')][_0x15d17c[_0x5032('0x40')]['id']]){_0x34397d[_0x5032('0x3f')][_0x15d17c[_0x5032('0x40')]['id']][_0x5032('0x41')]=![];_0x34397d[_0x5032('0x3f')][_0x15d17c[_0x5032('0x40')]['id']][_0x5032('0x47')]=undefined;}return _0x4e2b04({'code':0xc8,'message':_0x15d17c});}catch(_0x38ba32){logger[_0x5032('0x36')](_0x38ba32[_0x5032('0x3d')]);return _0x49a7a2(_0x25dc96['error'](0x1f4,_0x38ba32));}}logger[_0x5032('0x36')](_0x5032('0x46'));return _0x49a7a2(_0x25dc96[_0x5032('0x36')](0x1f4,_0x5032('0x46')));});},'AbandonInteraction':function(_0x1a45ae){var _0x28cf30=this;return new Promise(function(_0x32fc69,_0x1652ff){if(_0x1a45ae[_0x5032('0x14')]&&_0x1a45ae['interaction']&&_0x1a45ae[_0x5032('0x16')]['id']){try{var _0x3d226c=getId(_0x1a45ae['channel'],_0x1a45ae['message']?_0x1a45ae['message']['id']:0x0,_0x1a45ae[_0x5032('0x16')]?_0x1a45ae[_0x5032('0x16')]['id']:0x0);if(_0x34397d['rules'][_0x3d226c]){_0x34397d['rules'][_0x3d226c]['emit'](_0x5032('0x48'));}return _0x32fc69({'code':0xc8,'message':_0x1a45ae});}catch(_0x4f1417){logger[_0x5032('0x36')](_0x4f1417[_0x5032('0x3d')]);return _0x1652ff(_0x28cf30['error'](0x1f4,_0x4f1417));}}logger[_0x5032('0x36')]('message\x20is\x20empty');return _0x1652ff(_0x28cf30[_0x5032('0x36')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x13f8c1){var _0x4a10eb=this;return new Promise(function(_0xc04a4,_0x370c0f){if(_0x34397d['agents']['hasOwnProperty'](_0x13f8c1['id'])){for(var _0x4f2191 in _0x13f8c1[_0x5032('0x49')]){if(_0x13f8c1[_0x5032('0x49')][_0x5032('0x4a')](_0x4f2191)){if(_0x34397d[_0x5032('0x3f')][_0x13f8c1['id']][_0x5032('0x4a')](_0x4f2191+_0x5032('0x4b'))){_0x34397d[_0x5032('0x3f')][_0x13f8c1['id']][_0x4f2191+_0x5032('0x4b')]=parseInt(_0x13f8c1[_0x5032('0x49')][_0x4f2191],0xa);}}}_0x34397d[_0x5032('0x3f')][_0x13f8c1['id']][_0x5032('0x4c')]();return _0xc04a4({'code':0xc8,'message':_0x34397d[_0x5032('0x3f')][_0x13f8c1['id']]});}else{return _0x370c0f(_0x4a10eb['error'](0x1f4,_0x5032('0x4d')));}});},'Agents':function(_0x70fb9a){return new Promise(function(_0x230262){var _0x5ca335=_[_0x5032('0x4e')](_0x34397d[_0x5032('0x3f')]);if(_0x70fb9a&&_0x70fb9a['id']){var _0x26127a=_[_0x5032('0x4f')](_0x5ca335,function(_0x2c0fe9){return _0x2c0fe9['id']===_0x70fb9a['id'];});_0x230262(_0x26127a);}else{_0x230262({'count':_0x5ca335[_0x5032('0x19')],'rows':_0x5ca335});}});},'ChatQueues':function(){return new Promise(function(_0x47afe4){var _0x29be6b=[];for(var _0x42afc7 in _0x34397d['chatQueues']){if(_0x34397d[_0x5032('0x50')][_0x5032('0x4a')](_0x42afc7)){var _0x480d39=_0x34397d[_0x5032('0x50')][_0x42afc7];var _0x1640d2={'id':_0x480d39['id'],'available':_0x480d39[_0x5032('0x51')],'loggedIn':_0x480d39['loggedIn'],'name':_0x480d39['name'],'paused':_0x480d39[_0x5032('0x52')],'waiting':_0x480d39['waiting']};_0x29be6b[_0x5032('0x21')](_0x1640d2);}}_0x47afe4({'count':_0x29be6b[_0x5032('0x19')],'rows':_0x29be6b});});},'MailQueues':function(){return new Promise(function(_0x3b0ef5){var _0x3b976d=[];for(var _0x3521d5 in _0x34397d['mailQueues']){if(_0x34397d[_0x5032('0x53')]['hasOwnProperty'](_0x3521d5)){var _0x3634c1=_0x34397d[_0x5032('0x53')][_0x3521d5];var _0x2087fb={'id':_0x3634c1['id'],'available':_0x3634c1['available'],'loggedIn':_0x3634c1[_0x5032('0x54')],'name':_0x3634c1[_0x5032('0x55')],'paused':_0x3634c1[_0x5032('0x52')],'waiting':_0x3634c1[_0x5032('0x56')]};_0x3b976d[_0x5032('0x21')](_0x2087fb);}}_0x3b0ef5({'count':_0x3b976d[_0x5032('0x19')],'rows':_0x3b976d});});},'OpenchannelQueues':function(){return new Promise(function(_0x34ffec){var _0x2e5693=[];for(var _0x10b504 in _0x34397d[_0x5032('0x57')]){if(_0x34397d['openchannelQueues'][_0x5032('0x4a')](_0x10b504)){var _0x11dd8f=_0x34397d[_0x5032('0x57')][_0x10b504];var _0x48777d={'id':_0x11dd8f['id'],'available':_0x11dd8f['available'],'loggedIn':_0x11dd8f[_0x5032('0x54')],'name':_0x11dd8f[_0x5032('0x55')],'paused':_0x11dd8f[_0x5032('0x52')],'waiting':_0x11dd8f['waiting']};_0x2e5693[_0x5032('0x21')](_0x48777d);}}_0x34ffec({'count':_0x2e5693[_0x5032('0x19')],'rows':_0x2e5693});});},'SmsQueues':function(){return new Promise(function(_0x43427c){var _0x827b36=[];for(var _0xdaf668 in _0x34397d['smsQueues']){if(_0x34397d['smsQueues'][_0x5032('0x4a')](_0xdaf668)){var _0x554b9b=_0x34397d[_0x5032('0x58')][_0xdaf668];var _0xb486e6={'id':_0x554b9b['id'],'available':_0x554b9b[_0x5032('0x51')],'loggedIn':_0x554b9b[_0x5032('0x54')],'name':_0x554b9b[_0x5032('0x55')],'paused':_0x554b9b[_0x5032('0x52')],'waiting':_0x554b9b[_0x5032('0x56')]};_0x827b36['push'](_0xb486e6);}}_0x43427c({'count':_0x827b36['length'],'rows':_0x827b36});});},'FaxQueues':function(){return new Promise(function(_0x2f3a40){var _0x15cf5d=[];for(var _0x487098 in _0x34397d[_0x5032('0x59')]){if(_0x34397d['faxQueues'][_0x5032('0x4a')](_0x487098)){var _0x2a28f1=_0x34397d[_0x5032('0x59')][_0x487098];var _0x27e092={'id':_0x2a28f1['id'],'available':_0x2a28f1[_0x5032('0x51')],'loggedIn':_0x2a28f1[_0x5032('0x54')],'name':_0x2a28f1[_0x5032('0x55')],'paused':_0x2a28f1['paused'],'waiting':_0x2a28f1['waiting']};_0x15cf5d[_0x5032('0x21')](_0x27e092);}}_0x2f3a40({'count':_0x15cf5d[_0x5032('0x19')],'rows':_0x15cf5d});});},'WhatsappQueues':function(){return new Promise(function(_0x3106d4){var _0x1876c3=[];for(var _0x4abe77 in _0x34397d['whatsappQueues']){if(_0x34397d[_0x5032('0x5a')][_0x5032('0x4a')](_0x4abe77)){var _0x4b5432=_0x34397d[_0x5032('0x5a')][_0x4abe77];var _0x171a5c={'id':_0x4b5432['id'],'available':_0x4b5432[_0x5032('0x51')],'loggedIn':_0x4b5432['loggedIn'],'name':_0x4b5432['name'],'paused':_0x4b5432[_0x5032('0x52')],'waiting':_0x4b5432[_0x5032('0x56')]};_0x1876c3[_0x5032('0x21')](_0x171a5c);}}_0x3106d4({'count':_0x1876c3['length'],'rows':_0x1876c3});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x359b35){var _0x417b82=_[_0x5032('0x4e')](_0x34397d[_0x5032('0x5b')]);_0x359b35({'count':_0x417b82[_0x5032('0x19')],'rows':_0x417b82});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x22c7c8){var _0x56a2d9=_['values'](_0x34397d[_0x5032('0x5c')]);_0x22c7c8({'count':_0x56a2d9[_0x5032('0x19')],'rows':_0x56a2d9});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x2b327c){var _0x4b4845=_['values'](_0x34397d['openchannelQueuesWaitingInteractions']);_0x2b327c({'count':_0x4b4845[_0x5032('0x19')],'rows':_0x4b4845});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x1b4548){var _0x503e13=_[_0x5032('0x4e')](_0x34397d['smsQueuesWaitingInteractions']);_0x1b4548({'count':_0x503e13[_0x5032('0x19')],'rows':_0x503e13});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x225ec1){var _0x419c35=_[_0x5032('0x4e')](_0x34397d[_0x5032('0x5d')]);_0x225ec1({'count':_0x419c35['length'],'rows':_0x419c35});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x176b22){var _0xc33570=_['values'](_0x34397d['whatsappQueuesWaitingInteractions']);_0x176b22({'count':_0xc33570[_0x5032('0x19')],'rows':_0xc33570});});}};var _0x4f8de5=jayson[_0x5032('0x5e')](_0xa7d285)[_0x5032('0x5f')]();_0x4f8de5['on'](_0x5032('0x36'),function(_0x3ff3b2){logger['error'](JSON[_0x5032('0x39')](_0x3ff3b2));return _0x19d663(_0x3ff3b2);});_0x4f8de5['listen'](0x232c,'127.0.0.1',function(){console[_0x5032('0x60')](_0x5032('0x61'),0x232c);return _0x4a7bd0(_0x5032('0x62')+0x232c);});});}; \ No newline at end of file +var _0xa2b3=['RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','bluebird','./applications/utils','./applications/strategy/util','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','format','%s.%s.%s','isNil','IntervalId','map','interval','listen','rules','message','interaction','checkWaitingNotifications','applications','length','existsSync','join','app','.js','toLowerCase','autoreply','appdata','split','channel','mail','push','slice','amazonlex','tag','TagId','tvox','getMustacheRender','account','notificationTemplate','body','%s:%s:%s','intervals','./applications/','consequence','info','Push\x20new\x20rule','on\x20interval','error','Please\x20create\x20a\x20new\x20file\x20under','Applications\x20executed','matchPath','emit','complete','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','agent','agents','busy','busyQueue','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','stack','message\x20is\x20empty','end','capacity','hasOwnProperty','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','find','chatQueues','available','name','paused','mailQueues','loggedIn','waiting','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!'];(function(_0x4dcc2d,_0x422839){var _0x1bbd79=function(_0x173341){while(--_0x173341){_0x4dcc2d['push'](_0x4dcc2d['shift']());}};_0x1bbd79(++_0x422839);}(_0xa2b3,0xc7));var _0x3a2b=function(_0x54ef1e,_0x218d4a){_0x54ef1e=_0x54ef1e-0x0;var _0x19c745=_0xa2b3[_0x54ef1e];return _0x19c745;};'use strict';var _=require(_0x3a2b('0x0'));var util=require(_0x3a2b('0x1'));var path=require('path');var fs=require('fs');var jayson=require(_0x3a2b('0x2'));var BPromise=require(_0x3a2b('0x3'));var utils=require(_0x3a2b('0x4'));var sUtils=require(_0x3a2b('0x5'));var logger=require(_0x3a2b('0x6'))(_0x3a2b('0x7'));var rpc={'openchannelQueueReport':require(_0x3a2b('0x8')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0x3a2b('0x9')),'smsQueueReport':require(_0x3a2b('0xa')),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require('../lib/rule-engine');function getId(_0xe981a2,_0xf14522,_0xd2928c){return util[_0x3a2b('0xb')](_0x3a2b('0xc'),_0xe981a2,_0xf14522||0x0,_0xd2928c||0x0);}function getIntervals(_0x5c7f30,_0x2b6255){var _0x111149=[];if(!_[_0x3a2b('0xd')](_0x2b6255[_0x3a2b('0xe')])&&!_[_0x3a2b('0xd')](_0x5c7f30[_0x2b6255['IntervalId']])&&!_['isNil'](_0x5c7f30[_0x2b6255[_0x3a2b('0xe')]]['Intervals'])){_0x111149=_[_0x3a2b('0xf')](_0x5c7f30[_0x2b6255[_0x3a2b('0xe')]]['Intervals'],_0x3a2b('0x10'));}else if(!_[_0x3a2b('0xd')](_0x2b6255[_0x3a2b('0x10')])){_0x111149=[_0x2b6255[_0x3a2b('0x10')]];}return _0x111149;}exports[_0x3a2b('0x11')]=function(_0x5281e4){_0x5281e4[_0x3a2b('0x12')]={};return new BPromise(function(_0x1820f4,_0x406441){var _0x406c32={'Start':function(_0x25a4a9){var _0x545489=this;return new Promise(function(_0x7d5d07,_0x14cde9){if(_0x25a4a9){try{var _0x237eee=[];var _0x139f5b=getId(_0x25a4a9['channel'],_0x25a4a9[_0x3a2b('0x13')]?_0x25a4a9[_0x3a2b('0x13')]['id']:0x0,_0x25a4a9[_0x3a2b('0x14')]?_0x25a4a9[_0x3a2b('0x14')]['id']:0x0);var _0xa045f6=sUtils[_0x3a2b('0x15')](_0x5281e4,_0x25a4a9);if(!_0xa045f6&&_0x25a4a9['applications']&&_['isArray'](_0x25a4a9[_0x3a2b('0x16')])&&_0x25a4a9['applications'][_0x3a2b('0x17')]){for(var _0x1fd9df=0x0;_0x1fd9df<_0x25a4a9[_0x3a2b('0x16')]['length'];_0x1fd9df+=0x1){var _0x3af498=_0x25a4a9['applications'][_0x1fd9df];if(fs[_0x3a2b('0x18')](path[_0x3a2b('0x19')](__dirname,_0x3a2b('0x16'),_0x3af498[_0x3a2b('0x1a')]+_0x3a2b('0x1b')))){var _0x1b2171=[];switch(_0x3af498[_0x3a2b('0x1a')][_0x3a2b('0x1c')]()){case _0x3a2b('0x1d'):var _0x473d51=_0x3af498[_0x3a2b('0x1e')][_0x3a2b('0x1f')](',');if(_0x25a4a9[_0x3a2b('0x20')]===_0x3a2b('0x21')){_0x1b2171['push'](_0x473d51[0x0]);_0x1b2171[_0x3a2b('0x22')](_0x473d51[0x1]);_0x1b2171[_0x3a2b('0x22')](_0x473d51[_0x3a2b('0x23')](0x2,_0x473d51['length'])['join'](','));}else{_0x1b2171[_0x3a2b('0x22')](_0x473d51[0x0]);_0x1b2171[_0x3a2b('0x22')](_0x473d51[_0x3a2b('0x23')](0x1,_0x473d51[_0x3a2b('0x17')])[_0x3a2b('0x19')](','));}break;case'dialogflow':var _0x51d878=_0x3af498['appdata']['split'](',');_0x1b2171['push'](_0x51d878[0x0]);_0x1b2171['push'](_0x51d878[0x1]);_0x1b2171[_0x3a2b('0x22')](_0x51d878[_0x3a2b('0x23')](0x2,_0x51d878[_0x3a2b('0x17')])['join'](','));break;case'dialogflowv2':var _0x1bc4b6=_0x3af498[_0x3a2b('0x1e')][_0x3a2b('0x1f')](',');_0x1b2171[_0x3a2b('0x22')](_0x1bc4b6[0x0]);_0x1b2171[_0x3a2b('0x22')](_0x1bc4b6[0x1]);_0x1b2171[_0x3a2b('0x22')](_0x1bc4b6[0x2]);_0x1b2171[_0x3a2b('0x22')](_0x1bc4b6[0x3]);_0x1b2171[_0x3a2b('0x22')](_0x1bc4b6['slice'](0x4,_0x1bc4b6[_0x3a2b('0x17')])[_0x3a2b('0x19')](','));break;case _0x3a2b('0x24'):var _0x2e106a=_0x3af498[_0x3a2b('0x1e')][_0x3a2b('0x1f')](',');_0x1b2171['push'](_0x2e106a[0x0]);_0x1b2171['push'](_0x2e106a[0x1]);_0x1b2171[_0x3a2b('0x22')](_0x2e106a[0x2]);_0x1b2171[_0x3a2b('0x22')](_0x2e106a[0x3]);_0x1b2171[_0x3a2b('0x22')](_0x2e106a[_0x3a2b('0x23')](0x4,_0x2e106a['length'])[_0x3a2b('0x19')](','));break;case'message':_0x1b2171[_0x3a2b('0x22')](_0x3af498[_0x3a2b('0x1e')]);break;case _0x3a2b('0x25'):_0x1b2171[_0x3a2b('0x22')](_0x3af498[_0x3a2b('0x26')]);_0x1b2171[_0x3a2b('0x22')](_0x3af498[_0x3a2b('0x1e')]);break;case _0x3a2b('0x27'):var _0x5ab1a2=utils[_0x3a2b('0x28')](_0x25a4a9[_0x3a2b('0x29')][_0x3a2b('0x2a')],_0x25a4a9);var _0x320fce=_0x3af498[_0x3a2b('0x1e')][_0x3a2b('0x1f')](',');_0x1b2171['push'](_0x320fce[0x0]);_0x1b2171[_0x3a2b('0x22')](_0x320fce[0x1]);_0x1b2171[_0x3a2b('0x22')](_0x320fce[0x2]);_0x1b2171[_0x3a2b('0x22')](_0x320fce[0x3]);_0x1b2171[_0x3a2b('0x22')](_0x320fce[0x4]);_0x1b2171[_0x3a2b('0x22')](_0x320fce[0x5]);_0x1b2171[_0x3a2b('0x22')](_0x320fce[0x6]);_0x1b2171[_0x3a2b('0x22')](_0x320fce[0x7]);_0x1b2171[_0x3a2b('0x22')](_0x320fce[0x8]);_0x1b2171[_0x3a2b('0x22')](_0x320fce[0x9]);_0x1b2171['push'](_0x320fce[0xa]);_0x1b2171[_0x3a2b('0x22')](_0x25a4a9[_0x3a2b('0x14')]['id']);_0x1b2171['push'](_0x25a4a9[_0x3a2b('0x13')]['id']);_0x1b2171[_0x3a2b('0x22')](_0x3af498['ChatWebsiteId']);_0x1b2171[_0x3a2b('0x22')](_0x25a4a9[_0x3a2b('0x14')]['ContactId']);_0x1b2171[_0x3a2b('0x22')](_0x25a4a9[_0x3a2b('0x2b')][_0x3a2b('0x2b')]);_0x1b2171['push'](_0x5ab1a2);break;default:_0x1b2171=_[_0x3a2b('0xd')](_0x3af498[_0x3a2b('0x1e')])?[]:_0x3af498['appdata'][_0x3a2b('0x1f')](',');}var _0x46bbed={'id':util[_0x3a2b('0xb')](_0x3a2b('0x2c'),_0x139f5b,_0x3af498['id'],_0x3af498[_0x3a2b('0x1a')]),'condition':require('./interval')['condition'](_0x139f5b,getIntervals(_0x5281e4[_0x3a2b('0x2d')],_0x3af498),_0x5281e4),'consequence':require(_0x3a2b('0x2e')+_0x3af498[_0x3a2b('0x1a')])[_0x3a2b('0x2f')](_0x139f5b,_0x1b2171,_0x5281e4,_0x25a4a9),'p':_0x3af498['priority']||0x0};logger[_0x3a2b('0x30')](_0x3a2b('0x31'),_0x46bbed['id'],_0x3a2b('0x32'),getIntervals(_0x5281e4[_0x3a2b('0x2d')],_0x3af498)[_0x3a2b('0x19')]('\x20|\x20'));_0x237eee[_0x3a2b('0x22')](_0x46bbed);}else{logger[_0x3a2b('0x33')](_0x3a2b('0x34'),path[_0x3a2b('0x19')](__dirname,_0x3a2b('0x16'),_0x3af498[_0x3a2b('0x1a')]+'.js'));}}_0x5281e4[_0x3a2b('0x12')][_0x139f5b]=new RuleEngine(_0x237eee);_0x5281e4[_0x3a2b('0x12')][_0x139f5b]['execute'](_0x25a4a9,function(_0x4b1ffb){logger['info'](_0x3a2b('0x35'),JSON['stringify'](_0x4b1ffb[_0x3a2b('0x36')]));if(_0x5281e4[_0x3a2b('0x12')][_0x139f5b]){_0x5281e4[_0x3a2b('0x12')][_0x139f5b][_0x3a2b('0x37')](_0x3a2b('0x38'));}});return _0x7d5d07({'code':0xc8,'message':_0x25a4a9});}else{if(_0xa045f6){logger['info'](util['format'](_0x3a2b('0x39'),_0x139f5b));}else{logger[_0x3a2b('0x30')](_0x3a2b('0x3a'));}return _0x7d5d07({'code':0xc8,'message':_0x25a4a9});}}catch(_0x4be00c){logger[_0x3a2b('0x33')](_0x4be00c['stack']);return _0x14cde9(_0x545489['error'](0x1f4,_0x4be00c));}}return _0x14cde9('routing\x20is\x20empty');});},'AcceptMessage':function(_0x32c59a){var _0x56d22c=this;return new Promise(function(_0x1f8e3d,_0x26ddc4){if(_0x32c59a[_0x3a2b('0x3b')]&&_0x32c59a[_0x3a2b('0x3b')]['id']){if(_0x5281e4[_0x3a2b('0x3c')][_0x32c59a[_0x3a2b('0x3b')]['id']]){_0x5281e4[_0x3a2b('0x3c')][_0x32c59a[_0x3a2b('0x3b')]['id']][_0x3a2b('0x3d')]=![];_0x5281e4[_0x3a2b('0x3c')][_0x32c59a[_0x3a2b('0x3b')]['id']][_0x3a2b('0x3e')]=undefined;}}if(_0x32c59a[_0x3a2b('0x13')]&&_0x32c59a[_0x3a2b('0x13')]['id']){try{var _0x47924b=getId(_0x32c59a[_0x3a2b('0x20')],_0x32c59a['message']?_0x32c59a[_0x3a2b('0x13')]['id']:0x0,_0x32c59a['interaction']?_0x32c59a[_0x3a2b('0x14')]['id']:0x0);if(_0x5281e4['rules'][_0x47924b]){_0x5281e4['rules'][_0x47924b]['emit']('end');if(rpc[_0x32c59a['channel']+_0x3a2b('0x3f')]){rpc[_0x32c59a[_0x3a2b('0x20')]+_0x3a2b('0x3f')][_0x3a2b('0x40')](_0x47924b,{'UserId':_0x32c59a['message'][_0x3a2b('0x41')]})[_0x3a2b('0x42')](function(){logger[_0x3a2b('0x33')](_0x3a2b('0x43'));});}}return _0x1f8e3d({'code':0xc8,'message':_0x32c59a});}catch(_0xa6fe3d){logger[_0x3a2b('0x33')](_0xa6fe3d[_0x3a2b('0x44')]);return _0x26ddc4(_0x56d22c[_0x3a2b('0x33')](0x1f4,_0xa6fe3d));}}logger[_0x3a2b('0x33')]('message\x20is\x20empty');return _0x26ddc4(_0x56d22c['error'](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x3d5a28){var _0x107e59=this;return new Promise(function(_0x3159a,_0x56378d){if(_0x3d5a28[_0x3a2b('0x3b')]&&_0x3d5a28[_0x3a2b('0x3b')]['id']){try{if(_0x5281e4[_0x3a2b('0x3c')][_0x3d5a28['agent']['id']]){_0x5281e4[_0x3a2b('0x3c')][_0x3d5a28[_0x3a2b('0x3b')]['id']][_0x3a2b('0x3d')]=![];_0x5281e4[_0x3a2b('0x3c')][_0x3d5a28['agent']['id']]['busyQueue']=undefined;}return _0x3159a({'code':0xc8,'message':_0x3d5a28});}catch(_0x43b2fb){logger[_0x3a2b('0x33')](_0x43b2fb[_0x3a2b('0x44')]);return _0x56378d(_0x107e59['error'](0x1f4,_0x43b2fb));}}logger[_0x3a2b('0x33')]('message\x20is\x20empty');return _0x56378d(_0x107e59[_0x3a2b('0x33')](0x1f4,_0x3a2b('0x45')));});},'AbandonInteraction':function(_0x4508fb){var _0x3318f5=this;return new Promise(function(_0x1a3b20,_0x40431b){if(_0x4508fb[_0x3a2b('0x20')]&&_0x4508fb['interaction']&&_0x4508fb['interaction']['id']){try{var _0x36c55d=getId(_0x4508fb[_0x3a2b('0x20')],_0x4508fb[_0x3a2b('0x13')]?_0x4508fb[_0x3a2b('0x13')]['id']:0x0,_0x4508fb[_0x3a2b('0x14')]?_0x4508fb[_0x3a2b('0x14')]['id']:0x0);if(_0x5281e4['rules'][_0x36c55d]){_0x5281e4[_0x3a2b('0x12')][_0x36c55d][_0x3a2b('0x37')](_0x3a2b('0x46'));}return _0x1a3b20({'code':0xc8,'message':_0x4508fb});}catch(_0x5bb4d1){logger[_0x3a2b('0x33')](_0x5bb4d1['stack']);return _0x40431b(_0x3318f5[_0x3a2b('0x33')](0x1f4,_0x5bb4d1));}}logger[_0x3a2b('0x33')](_0x3a2b('0x45'));return _0x40431b(_0x3318f5[_0x3a2b('0x33')](0x1f4,_0x3a2b('0x45')));});},'AgentCapacity':function(_0x19cc23){var _0xde8f97=this;return new Promise(function(_0x50f3f3,_0x365d69){if(_0x5281e4[_0x3a2b('0x3c')]['hasOwnProperty'](_0x19cc23['id'])){for(var _0x476695 in _0x19cc23[_0x3a2b('0x47')]){if(_0x19cc23[_0x3a2b('0x47')][_0x3a2b('0x48')](_0x476695)){if(_0x5281e4[_0x3a2b('0x3c')][_0x19cc23['id']][_0x3a2b('0x48')](_0x476695+_0x3a2b('0x49'))){_0x5281e4[_0x3a2b('0x3c')][_0x19cc23['id']][_0x476695+'CurrentCapacity']=parseInt(_0x19cc23[_0x3a2b('0x47')][_0x476695],0xa);}}}_0x5281e4[_0x3a2b('0x3c')][_0x19cc23['id']][_0x3a2b('0x4a')]();return _0x50f3f3({'code':0xc8,'message':_0x5281e4[_0x3a2b('0x3c')][_0x19cc23['id']]});}else{return _0x365d69(_0xde8f97[_0x3a2b('0x33')](0x1f4,_0x3a2b('0x4b')));}});},'Agents':function(_0x4959e7){return new Promise(function(_0x3aca03){var _0xa616f4=_[_0x3a2b('0x4c')](_0x5281e4[_0x3a2b('0x3c')]);if(_0x4959e7&&_0x4959e7['id']){var _0x2073a7=_[_0x3a2b('0x4d')](_0xa616f4,function(_0x40153e){return _0x40153e['id']===_0x4959e7['id'];});_0x3aca03(_0x2073a7);}else{_0x3aca03({'count':_0xa616f4[_0x3a2b('0x17')],'rows':_0xa616f4});}});},'ChatQueues':function(){return new Promise(function(_0x5f37cf){var _0x1bea4f=[];for(var _0x3b9522 in _0x5281e4[_0x3a2b('0x4e')]){if(_0x5281e4[_0x3a2b('0x4e')]['hasOwnProperty'](_0x3b9522)){var _0x4e4ba8=_0x5281e4[_0x3a2b('0x4e')][_0x3b9522];var _0x40fa08={'id':_0x4e4ba8['id'],'available':_0x4e4ba8[_0x3a2b('0x4f')],'loggedIn':_0x4e4ba8['loggedIn'],'name':_0x4e4ba8[_0x3a2b('0x50')],'paused':_0x4e4ba8[_0x3a2b('0x51')],'waiting':_0x4e4ba8['waiting']};_0x1bea4f[_0x3a2b('0x22')](_0x40fa08);}}_0x5f37cf({'count':_0x1bea4f[_0x3a2b('0x17')],'rows':_0x1bea4f});});},'MailQueues':function(){return new Promise(function(_0x5c1de1){var _0x3b4da8=[];for(var _0x8a4960 in _0x5281e4[_0x3a2b('0x52')]){if(_0x5281e4[_0x3a2b('0x52')][_0x3a2b('0x48')](_0x8a4960)){var _0x1e5352=_0x5281e4[_0x3a2b('0x52')][_0x8a4960];var _0x304eda={'id':_0x1e5352['id'],'available':_0x1e5352[_0x3a2b('0x4f')],'loggedIn':_0x1e5352[_0x3a2b('0x53')],'name':_0x1e5352['name'],'paused':_0x1e5352[_0x3a2b('0x51')],'waiting':_0x1e5352[_0x3a2b('0x54')]};_0x3b4da8['push'](_0x304eda);}}_0x5c1de1({'count':_0x3b4da8['length'],'rows':_0x3b4da8});});},'OpenchannelQueues':function(){return new Promise(function(_0x218757){var _0x449a33=[];for(var _0x117c72 in _0x5281e4[_0x3a2b('0x55')]){if(_0x5281e4[_0x3a2b('0x55')]['hasOwnProperty'](_0x117c72)){var _0x565000=_0x5281e4[_0x3a2b('0x55')][_0x117c72];var _0x51e864={'id':_0x565000['id'],'available':_0x565000[_0x3a2b('0x4f')],'loggedIn':_0x565000[_0x3a2b('0x53')],'name':_0x565000['name'],'paused':_0x565000[_0x3a2b('0x51')],'waiting':_0x565000[_0x3a2b('0x54')]};_0x449a33[_0x3a2b('0x22')](_0x51e864);}}_0x218757({'count':_0x449a33[_0x3a2b('0x17')],'rows':_0x449a33});});},'SmsQueues':function(){return new Promise(function(_0x514999){var _0x223cc7=[];for(var _0x19a424 in _0x5281e4['smsQueues']){if(_0x5281e4['smsQueues'][_0x3a2b('0x48')](_0x19a424)){var _0x59cc6a=_0x5281e4[_0x3a2b('0x56')][_0x19a424];var _0x1bac37={'id':_0x59cc6a['id'],'available':_0x59cc6a['available'],'loggedIn':_0x59cc6a[_0x3a2b('0x53')],'name':_0x59cc6a[_0x3a2b('0x50')],'paused':_0x59cc6a[_0x3a2b('0x51')],'waiting':_0x59cc6a['waiting']};_0x223cc7['push'](_0x1bac37);}}_0x514999({'count':_0x223cc7[_0x3a2b('0x17')],'rows':_0x223cc7});});},'FaxQueues':function(){return new Promise(function(_0x151175){var _0x5b24d0=[];for(var _0x5cbbf8 in _0x5281e4[_0x3a2b('0x57')]){if(_0x5281e4[_0x3a2b('0x57')][_0x3a2b('0x48')](_0x5cbbf8)){var _0x58eccb=_0x5281e4[_0x3a2b('0x57')][_0x5cbbf8];var _0x462624={'id':_0x58eccb['id'],'available':_0x58eccb[_0x3a2b('0x4f')],'loggedIn':_0x58eccb[_0x3a2b('0x53')],'name':_0x58eccb[_0x3a2b('0x50')],'paused':_0x58eccb[_0x3a2b('0x51')],'waiting':_0x58eccb[_0x3a2b('0x54')]};_0x5b24d0['push'](_0x462624);}}_0x151175({'count':_0x5b24d0[_0x3a2b('0x17')],'rows':_0x5b24d0});});},'WhatsappQueues':function(){return new Promise(function(_0x42d598){var _0xa9b76b=[];for(var _0x437bc6 in _0x5281e4[_0x3a2b('0x58')]){if(_0x5281e4[_0x3a2b('0x58')][_0x3a2b('0x48')](_0x437bc6)){var _0x207300=_0x5281e4['whatsappQueues'][_0x437bc6];var _0x2d243d={'id':_0x207300['id'],'available':_0x207300[_0x3a2b('0x4f')],'loggedIn':_0x207300[_0x3a2b('0x53')],'name':_0x207300[_0x3a2b('0x50')],'paused':_0x207300[_0x3a2b('0x51')],'waiting':_0x207300[_0x3a2b('0x54')]};_0xa9b76b[_0x3a2b('0x22')](_0x2d243d);}}_0x42d598({'count':_0xa9b76b['length'],'rows':_0xa9b76b});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x300a5d){var _0x1b0058=_[_0x3a2b('0x4c')](_0x5281e4[_0x3a2b('0x59')]);_0x300a5d({'count':_0x1b0058[_0x3a2b('0x17')],'rows':_0x1b0058});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x5f0d21){var _0x66eae0=_[_0x3a2b('0x4c')](_0x5281e4[_0x3a2b('0x5a')]);_0x5f0d21({'count':_0x66eae0['length'],'rows':_0x66eae0});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x43c032){var _0x2816e1=_['values'](_0x5281e4['openchannelQueuesWaitingInteractions']);_0x43c032({'count':_0x2816e1['length'],'rows':_0x2816e1});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x32f86f){var _0x426551=_[_0x3a2b('0x4c')](_0x5281e4[_0x3a2b('0x5b')]);_0x32f86f({'count':_0x426551[_0x3a2b('0x17')],'rows':_0x426551});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x161009){var _0x2977f9=_[_0x3a2b('0x4c')](_0x5281e4['faxQueuesWaitingInteractions']);_0x161009({'count':_0x2977f9[_0x3a2b('0x17')],'rows':_0x2977f9});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x3fa640){var _0x2e791f=_[_0x3a2b('0x4c')](_0x5281e4[_0x3a2b('0x5c')]);_0x3fa640({'count':_0x2e791f[_0x3a2b('0x17')],'rows':_0x2e791f});});}};var _0x5cc543=jayson[_0x3a2b('0x5d')](_0x406c32)[_0x3a2b('0x5e')]();_0x5cc543['on']('error',function(_0x4943e8){logger['error'](JSON['stringify'](_0x4943e8));return _0x406441(_0x4943e8);});_0x5cc543[_0x3a2b('0x11')](0x232c,_0x3a2b('0x5f'),function(){console[_0x3a2b('0x60')](_0x3a2b('0x61'),0x232c);return _0x1820f4(_0x3a2b('0x62')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index fecd94d..1adc67c 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 _0x5f5e=['http','request','error','message','result','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','format','indexOf','true','catch','all','then','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','stack','util','bluebird','jayson/promise','lodash','client'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x5f5e,0x11d));var _0xe5f5=function(_0x1fd9c3,_0x4e4c92){_0x1fd9c3=_0x1fd9c3-0x0;var _0x1ac0fb=_0x5f5e[_0x1fd9c3];return _0x1ac0fb;};'use strict';var util=require(_0xe5f5('0x0'));var BPromise=require(_0xe5f5('0x1'));var jayson=require(_0xe5f5('0x2'));var _=require(_0xe5f5('0x3'));var logger=require('../../../config/logger')('routing');var client=jayson[_0xe5f5('0x4')][_0xe5f5('0x5')]({'port':0x232a});function request(_0x4673ae,_0x19f4ba){return new BPromise(function(_0x109dde,_0x20024f){return client[_0xe5f5('0x6')](_0x4673ae,_0x19f4ba)['then'](function(_0x180d28){if(_0x180d28['error']){return _0x20024f(_0x180d28[_0xe5f5('0x7')][_0xe5f5('0x8')]);}else{return _0x109dde(_0x180d28[_0xe5f5('0x9')]);}})['catch'](function(_0x4eb0cc){return _0x20024f(_0x4eb0cc);});});}exports['condition']=function(_0x4b9214,_0x28de8e,_0xe00e61){return function(_0x4df1e6){if(_0xe00e61[_0xe5f5('0xa')]&&!_0xe00e61[_0xe5f5('0xa')][_0x4b9214]){logger[_0xe5f5('0xb')](_0xe5f5('0xc'),_0x4b9214);return _0x4df1e6[_0xe5f5('0xd')]();}var _0x391969=[];for(var _0x121ac3=0x0;_0x121ac3<_0x28de8e[_0xe5f5('0xe')];_0x121ac3+=0x1){_0x391969[_0xe5f5('0xf')](request(_0xe5f5('0x10'),{'command':util[_0xe5f5('0x11')]('iftime\x20%s',_0x28de8e[_0x121ac3])})['then'](function(_0x2cb086){return _0x2cb086&&_0x2cb086[_0xe5f5('0x8')]&&_0x2cb086[_0xe5f5('0x8')][_0xe5f5('0x12')](_0xe5f5('0x13'))>=0x0?!![]:![];})[_0xe5f5('0x14')](function(_0x401100){logger['error']('[%s][INTERVAL]\x20%s',_0x4b9214,_0x28de8e[_0x121ac3]);}));}BPromise[_0xe5f5('0x15')](_0x391969)[_0xe5f5('0x16')](function(_0x583d98){var _0x19dfc1=_[_0xe5f5('0x17')](_0x583d98);logger['info'](_0xe5f5('0x18'),_0x4b9214,_0x28de8e[_0xe5f5('0x19')](_0xe5f5('0x1a')),_0x19dfc1);_0x4df1e6[_0xe5f5('0x1b')](_0x19dfc1);})[_0xe5f5('0x14')](function(_0x104a7b){console['log'](_0x104a7b);logger[_0xe5f5('0x7')]('[%s][INTERVAL]\x20%s\x20%s',_0x4b9214,_0x28de8e['join'](_0xe5f5('0x1a')),_0x104a7b[_0xe5f5('0x1c')]);_0x4df1e6[_0xe5f5('0xd')]();});};}; \ No newline at end of file +var _0x022e=['stop','util','bluebird','jayson/promise','../../../config/logger','routing','client','http','request','then','error','message','result','catch','condition','rules','info','push','format','iftime\x20%s','true','[%s][INTERVAL]\x20%s','all','some','join','\x20|\x20','when','[%s][INTERVAL]\x20%s\x20%s','stack'];(function(_0x3944ef,_0x1b443e){var _0x518cb7=function(_0x4fc4a5){while(--_0x4fc4a5){_0x3944ef['push'](_0x3944ef['shift']());}};_0x518cb7(++_0x1b443e);}(_0x022e,0xcc));var _0xe022=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0x022e[_0x51020b];return _0x371e47;};'use strict';var util=require(_0xe022('0x0'));var BPromise=require(_0xe022('0x1'));var jayson=require(_0xe022('0x2'));var _=require('lodash');var logger=require(_0xe022('0x3'))(_0xe022('0x4'));var client=jayson[_0xe022('0x5')][_0xe022('0x6')]({'port':0x232a});function request(_0x262cd5,_0x586be0){return new BPromise(function(_0x44bfbd,_0x375dee){return client[_0xe022('0x7')](_0x262cd5,_0x586be0)[_0xe022('0x8')](function(_0x4598c9){if(_0x4598c9[_0xe022('0x9')]){return _0x375dee(_0x4598c9[_0xe022('0x9')][_0xe022('0xa')]);}else{return _0x44bfbd(_0x4598c9[_0xe022('0xb')]);}})[_0xe022('0xc')](function(_0x2b4464){return _0x375dee(_0x2b4464);});});}exports[_0xe022('0xd')]=function(_0x20f89e,_0x384a8f,_0x414dd7){return function(_0x58aafe){if(_0x414dd7[_0xe022('0xe')]&&!_0x414dd7[_0xe022('0xe')][_0x20f89e]){logger[_0xe022('0xf')]('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x20f89e);return _0x58aafe['stop']();}var _0x5f6bf6=[];for(var _0x38b399=0x0;_0x38b399<_0x384a8f['length'];_0x38b399+=0x1){_0x5f6bf6[_0xe022('0x10')](request('Command',{'command':util[_0xe022('0x11')](_0xe022('0x12'),_0x384a8f[_0x38b399])})[_0xe022('0x8')](function(_0x2dd0b1){return _0x2dd0b1&&_0x2dd0b1[_0xe022('0xa')]&&_0x2dd0b1[_0xe022('0xa')]['indexOf'](_0xe022('0x13'))>=0x0?!![]:![];})[_0xe022('0xc')](function(_0x5a2fd3){logger['error'](_0xe022('0x14'),_0x20f89e,_0x384a8f[_0x38b399]);}));}BPromise[_0xe022('0x15')](_0x5f6bf6)[_0xe022('0x8')](function(_0x64df03){var _0x779856=_[_0xe022('0x16')](_0x64df03);logger[_0xe022('0xf')]('[%s][INTERVAL]\x20%s\x20%s',_0x20f89e,_0x384a8f[_0xe022('0x17')](_0xe022('0x18')),_0x779856);_0x58aafe[_0xe022('0x19')](_0x779856);})[_0xe022('0xc')](function(_0x177f24){console['log'](_0x177f24);logger['error'](_0xe022('0x1a'),_0x20f89e,_0x384a8f['join']('\x20|\x20'),_0x177f24[_0xe022('0x1b')]);_0x58aafe[_0xe022('0x1c')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index a459b42..12358c0 100644 --- a/server/services/xdr/agents.controller.js +++ b/server/services/xdr/agents.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x44a3=['agentacw','request','CreateVoiceAgentReport','agentcalled','debug','[%s][agents][agentcalled]','uniqueid','destuniqueid','agentcalledAt','now','connectedlinenum','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','holdtime','ringtime','talktime','push','forIn','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][agents][queuecallerabandon]','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','lastevent','answered_elsewhere','answeredelsewheredestinationuniqueid','isNil','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diffTime','agentcompleteAt','complete','blindtransfer','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','transfer','transfertype','blind','transferexten','extension','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','origtransfererexten','transferuniqueid','transfereeuniqueid','agententerreason','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','clone','calleridname','hangup','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','[%s][agents][hangup]','lodash','util','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','interface','calleridnum','then','type','agentcomplete','acw'];(function(_0x24d279,_0x27556f){var _0x5075be=function(_0x2650bd){while(--_0x2650bd){_0x24d279['push'](_0x24d279['shift']());}};_0x5075be(++_0x27556f);}(_0x44a3,0x1a9));var _0x344a=function(_0x5a5c11,_0x358f6b){_0x5a5c11=_0x5a5c11-0x0;var _0x5d6ba7=_0x44a3[_0x5a5c11];return _0x5d6ba7;};'use strict';var _=require(_0x344a('0x0'));var util=require(_0x344a('0x1'));var utils=require(_0x344a('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x23cef2,_0xdffe0b){utils[_0x344a('0x3')](util[_0x344a('0x4')](_0x344a('0x5'),_0x23cef2['uniqueid'],_0x23cef2[_0x344a('0x6')],_0x23cef2[_0x344a('0x7')],_0x23cef2[_0x344a('0x8')],_0x23cef2[_0x344a('0x9')],_0x23cef2[_0x344a('0xa')],_0x23cef2['connectedlinenum'],_0x23cef2['lastevent']));if(_0x23cef2['queue']){utils['getVoiceQueueByName'](_0x23cef2[_0x344a('0x7')])[_0x344a('0xb')](function(_0x3c725e){if(_0x3c725e){_0x23cef2[_0x344a('0xc')]=_0x3c725e[_0x344a('0xc')];_0x23cef2['agentacw']=_0x23cef2[_0x344a('0xd')]?_0x3c725e[_0x344a('0xe')]:![];_0x23cef2['acwtime']=_0x23cef2[_0x344a('0xf')]?_0x3c725e['acwTimeout']:0x0;}utils[_0x344a('0x10')]('CreateVoiceAgentReport',_0x23cef2);});}else{utils[_0x344a('0x10')](_0x344a('0x11'),_0x23cef2);}if(_0xdffe0b){delete transfers[_0x23cef2['uniqueid']];}else{delete agents[_0x23cef2['destuniqueid']];}}exports[_0x344a('0x12')]=function(_0x2ad7eb){try{utils[_0x344a('0x13')](util[_0x344a('0x4')](_0x344a('0x14'),_0x2ad7eb[_0x344a('0x15')]),_0x2ad7eb);agents[_0x2ad7eb['destuniqueid']]=_0x2ad7eb;agents[_0x2ad7eb[_0x344a('0x16')]][_0x344a('0x17')]=utils[_0x344a('0x18')]();agents[_0x2ad7eb[_0x344a('0x16')]]['lastevent']='called';agents[_0x2ad7eb[_0x344a('0x16')]][_0x344a('0x19')]=null;agents[_0x2ad7eb[_0x344a('0x16')]][_0x344a('0x1a')]=null;utils['info'](util[_0x344a('0x4')](_0x344a('0x1b'),_0x2ad7eb['uniqueid'],agents[_0x2ad7eb[_0x344a('0x16')]][_0x344a('0x8')],_0x2ad7eb[_0x344a('0x16')]));}catch(_0x45a827){utils[_0x344a('0x1c')](util[_0x344a('0x4')](_0x344a('0x14'),_0x2ad7eb[_0x344a('0x15')]),_0x45a827);}};exports[_0x344a('0x1d')]=function(_0x450922){try{if(!_['isNil'](agents[_0x450922[_0x344a('0x16')]])){utils[_0x344a('0x13')](util[_0x344a('0x4')](_0x344a('0x1e'),_0x450922[_0x344a('0x15')]),_0x450922);utils[_0x344a('0x3')](util[_0x344a('0x4')](_0x344a('0x1f'),_0x450922[_0x344a('0x15')],agents[_0x450922[_0x344a('0x16')]][_0x344a('0x8')],_0x450922[_0x344a('0x16')]));agents[_0x450922[_0x344a('0x16')]][_0x344a('0x1d')]=!![];agents[_0x450922['destuniqueid']][_0x344a('0x20')]=utils['now']();agents[_0x450922[_0x344a('0x16')]]['lastevent']=_0x344a('0x21');agents[_0x450922[_0x344a('0x16')]][_0x344a('0x22')]=_0x344a('0x21');agents[_0x450922[_0x344a('0x16')]][_0x344a('0x23')]=_0x450922[_0x344a('0x24')]?parseInt(_0x450922[_0x344a('0x24')])/0x3e8:0x0;agents[_0x450922['destuniqueid']][_0x344a('0x25')]=0x0;unanswered[_0x344a('0x26')](_0x450922[_0x344a('0x16')]);}}catch(_0xc02d6){utils[_0x344a('0x1c')](util[_0x344a('0x4')]('[%s][agents][agentringnoanswer]',_0x450922[_0x344a('0x15')]),_0xc02d6);}};exports['queuecallerabandon']=function(_0x593cf6){try{_[_0x344a('0x27')](agents,function(_0x14fa86,_0x5a36bb){if(_0x14fa86['uniqueid']==_0x593cf6['uniqueid']&&!_['includes'](unanswered,_0x14fa86[_0x344a('0x16')])){utils[_0x344a('0x13')](util[_0x344a('0x4')]('[%s][agents][queuecallerabandon]',_0x593cf6[_0x344a('0x15')]),_0x593cf6);utils[_0x344a('0x3')](util[_0x344a('0x4')](_0x344a('0x28'),_0x593cf6[_0x344a('0x15')],_0x14fa86[_0x344a('0x8')],_0x14fa86[_0x344a('0x16')]));_0x14fa86['agentringnoanswer']=!![];_0x14fa86[_0x344a('0x20')]=utils['now']();_0x14fa86['lastevent']='abandoned';_0x14fa86[_0x344a('0x22')]=_0x344a('0x29');_0x14fa86[_0x344a('0x23')]=_0x593cf6[_0x344a('0x23')];_0x14fa86[_0x344a('0x25')]=0x0;writeDB(_0x14fa86);}});}catch(_0xdf6a8f){utils['error'](util[_0x344a('0x4')](_0x344a('0x2a'),_0x593cf6[_0x344a('0x15')]),_0xdf6a8f);}};exports['agentconnect']=function(_0x3698eb){try{if(agents[_0x3698eb[_0x344a('0x16')]]){utils[_0x344a('0x13')](util[_0x344a('0x4')](_0x344a('0x2b'),_0x3698eb['uniqueid']),_0x3698eb);utils[_0x344a('0x3')](util[_0x344a('0x4')](_0x344a('0x2c'),_0x3698eb[_0x344a('0x15')],agents[_0x3698eb[_0x344a('0x16')]]['membername'],_0x3698eb[_0x344a('0x16')]));agents[_0x3698eb[_0x344a('0x16')]][_0x344a('0x2d')]=utils[_0x344a('0x18')]();agents[_0x3698eb[_0x344a('0x16')]]['connectedlinenum']=_0x3698eb[_0x344a('0x19')];agents[_0x3698eb[_0x344a('0x16')]][_0x344a('0x1a')]=_0x3698eb[_0x344a('0x1a')];agents[_0x3698eb[_0x344a('0x16')]][_0x344a('0x23')]=_0x3698eb[_0x344a('0x24')];agents[_0x3698eb[_0x344a('0x16')]]['lastevent']=_0x344a('0x2e');_[_0x344a('0x27')](agents,function(_0x3d34c3,_0x28bad9){if(_0x3d34c3[_0x344a('0x16')]!=_0x3698eb['destuniqueid']&&_0x3d34c3[_0x344a('0x15')]==_0x3698eb[_0x344a('0x15')]){_0x3d34c3[_0x344a('0x25')]=0x0;_0x3d34c3[_0x344a('0x23')]=_0x3698eb[_0x344a('0x24')];_0x3d34c3[_0x344a('0x1d')]=!![];_0x3d34c3[_0x344a('0x20')]=utils[_0x344a('0x18')]();_0x3d34c3[_0x344a('0x2f')]='answered_elsewhere';_0x3d34c3[_0x344a('0x22')]=_0x344a('0x30');_0x3d34c3[_0x344a('0x31')]=_0x3698eb[_0x344a('0x16')];_0x3d34c3['answeredelsewheremembername']=_0x3698eb[_0x344a('0x8')];writeDB(_0x3d34c3);}});}}catch(_0x3069ca){utils[_0x344a('0x1c')](util[_0x344a('0x4')](_0x344a('0x2b'),_0x3698eb[_0x344a('0x15')]),_0x3069ca);}};exports[_0x344a('0xd')]=function(_0x372e7d){try{if(!_[_0x344a('0x32')](agents[_0x372e7d[_0x344a('0x16')]])){utils[_0x344a('0x13')](util['format'](_0x344a('0x33'),_0x372e7d[_0x344a('0x15')]),_0x372e7d);utils['info'](util[_0x344a('0x4')](_0x344a('0x34'),_0x372e7d['uniqueid'],agents[_0x372e7d[_0x344a('0x16')]][_0x344a('0x8')],_0x372e7d['destuniqueid']));agents[_0x372e7d[_0x344a('0x16')]][_0x344a('0xd')]=!![];agents[_0x372e7d[_0x344a('0x16')]]['agentcompleteAt']=utils[_0x344a('0x18')]();agents[_0x372e7d['destuniqueid']][_0x344a('0x25')]=utils[_0x344a('0x35')](agents[_0x372e7d[_0x344a('0x16')]][_0x344a('0x36')],agents[_0x372e7d['destuniqueid']]['agentconnectAt']);agents[_0x372e7d[_0x344a('0x16')]][_0x344a('0x22')]=_0x372e7d[_0x344a('0x22')];agents[_0x372e7d[_0x344a('0x16')]][_0x344a('0x2f')]=_0x344a('0x37');writeDB(agents[_0x372e7d[_0x344a('0x16')]]);}}catch(_0x23c214){utils[_0x344a('0x1c')](util[_0x344a('0x4')]('[%s][agents][agentcomplete]',_0x372e7d[_0x344a('0x15')]),_0x23c214);}};exports[_0x344a('0x38')]=function(_0x6fad37){try{if(!_[_0x344a('0x32')](agents[_0x6fad37['transfereruniqueid']])){utils[_0x344a('0x13')](util['format']('[%s][agents][blindtransfer]',_0x6fad37[_0x344a('0x15')]),_0x6fad37);utils[_0x344a('0x3')](util['format'](_0x344a('0x39'),_0x6fad37[_0x344a('0x15')],agents[_0x6fad37[_0x344a('0x3a')]][_0x344a('0x8')],agents[_0x6fad37['transfereruniqueid']][_0x344a('0x15')]));agents[_0x6fad37[_0x344a('0x3a')]][_0x344a('0x3b')]=!![];agents[_0x6fad37[_0x344a('0x3a')]][_0x344a('0x3c')]=_0x344a('0x3d');agents[_0x6fad37[_0x344a('0x3a')]][_0x344a('0x3e')]=_0x6fad37[_0x344a('0x3f')];agents[_0x6fad37[_0x344a('0x3a')]]['transferuniqueid']=agents[_0x6fad37[_0x344a('0x3a')]]['uniqueid'];}}catch(_0x1b7f6c){utils[_0x344a('0x1c')](util[_0x344a('0x4')]('[%s][agents][blindtransfer]',_0x6fad37[_0x344a('0x15')]),_0x1b7f6c);}};exports[_0x344a('0x40')]=function(_0x188c6b){try{utils[_0x344a('0x13')](util[_0x344a('0x4')](_0x344a('0x41'),_0x188c6b[_0x344a('0x42')]),_0x188c6b);if(_0x188c6b[_0x344a('0x42')]==_0x188c6b[_0x344a('0x43')]){if(!_['isNil'](agents[_0x188c6b[_0x344a('0x44')]])){utils[_0x344a('0x3')](util[_0x344a('0x4')](_0x344a('0x45'),_0x188c6b[_0x344a('0x42')],agents[_0x188c6b['secondtransfereruniqueid']][_0x344a('0x8')]));agents[_0x188c6b[_0x344a('0x44')]][_0x344a('0x3b')]=!![];agents[_0x188c6b[_0x344a('0x44')]]['transfertype']=_0x344a('0x46');agents[_0x188c6b[_0x344a('0x44')]]['transferexten']=_0x188c6b[_0x344a('0x47')];agents[_0x188c6b[_0x344a('0x44')]][_0x344a('0x48')]=_0x188c6b[_0x344a('0x42')];}if(_0x188c6b[_0x344a('0x49')]&&agents[_0x188c6b[_0x344a('0x49')]]){agents[_0x188c6b[_0x344a('0x49')]]['agententerreason']=0x1;transfers[_0x188c6b['transfereeuniqueid']]=_['clone'](agents[_0x188c6b[_0x344a('0x49')]]);transfers[_0x188c6b[_0x344a('0x49')]][_0x344a('0xa')]=agents[_0x188c6b[_0x344a('0x44')]]['calleridnum'];transfers[_0x188c6b[_0x344a('0x49')]]['calleridname']=agents[_0x188c6b['secondtransfereruniqueid']]['calleridname'];transfers[_0x188c6b['transfereeuniqueid']][_0x344a('0x17')]=utils[_0x344a('0x18')]();transfers[_0x188c6b[_0x344a('0x49')]][_0x344a('0x2d')]=utils['now']();transfers[_0x188c6b['transfereeuniqueid']]['holdtime']=0x0;transfers[_0x188c6b[_0x344a('0x49')]][_0x344a('0x4a')]=0x2;}}else if(_0x188c6b[_0x344a('0x44')]==_0x188c6b[_0x344a('0x4b')]){if(!_[_0x344a('0x32')](agents[_0x188c6b['origtransfereruniqueid']])){utils[_0x344a('0x3')](util[_0x344a('0x4')](_0x344a('0x45'),_0x188c6b['origtransfereruniqueid'],agents[_0x188c6b[_0x344a('0x42')]]['membername']));agents[_0x188c6b['origtransfereruniqueid']][_0x344a('0x3b')]=!![];agents[_0x188c6b['origtransfereruniqueid']]['transfertype']=_0x344a('0x46');agents[_0x188c6b[_0x344a('0x42')]]['transferexten']=_0x188c6b[_0x344a('0x4c')];agents[_0x188c6b['origtransfereruniqueid']][_0x344a('0x48')]=_0x188c6b[_0x344a('0x44')];}if(_0x188c6b[_0x344a('0x4d')]&&agents[_0x188c6b['transfertargetuniqueid']]){agents[_0x188c6b['transfertargetuniqueid']][_0x344a('0x4a')]=0x1;transfers[_0x188c6b[_0x344a('0x4d')]]=_[_0x344a('0x4e')](agents[_0x188c6b[_0x344a('0x4d')]]);transfers[_0x188c6b['transfertargetuniqueid']]['calleridnum']=agents[_0x188c6b[_0x344a('0x42')]][_0x344a('0xa')];transfers[_0x188c6b[_0x344a('0x4d')]]['calleridname']=agents[_0x188c6b[_0x344a('0x42')]][_0x344a('0x4f')];transfers[_0x188c6b['transfertargetuniqueid']][_0x344a('0x17')]=utils['now']();transfers[_0x188c6b[_0x344a('0x4d')]]['agentconnectAt']=utils['now']();transfers[_0x188c6b['transfertargetuniqueid']][_0x344a('0x23')]=0x0;transfers[_0x188c6b[_0x344a('0x4d')]][_0x344a('0x4a')]=0x2;}}}catch(_0xce0446){utils[_0x344a('0x1c')](util[_0x344a('0x4')]('[%s][agents][attendedtransfer]',_0x188c6b[_0x344a('0x42')]),_0xce0446);}};exports[_0x344a('0x50')]=function(_0x20a892){try{utils[_0x344a('0x13')](util[_0x344a('0x4')]('[%s][agents][hangup]',_0x20a892[_0x344a('0x15')]),_0x20a892);if(agents[_0x20a892[_0x344a('0x15')]]&&agents[_0x20a892['uniqueid']][_0x344a('0x22')]===_0x344a('0x21')){if(_0x20a892[_0x344a('0x51')]==='21'){agents[_0x20a892[_0x344a('0x15')]]['reason']=_0x344a('0x52');agents[_0x20a892[_0x344a('0x15')]][_0x344a('0x2f')]=_0x344a('0x52');}utils[_0x344a('0x3')](util[_0x344a('0x4')](_0x344a('0x53'),_0x20a892[_0x344a('0x15')],agents[_0x20a892['uniqueid']][_0x344a('0x8')],agents[_0x20a892[_0x344a('0x15')]][_0x344a('0x22')],agents[_0x20a892[_0x344a('0x15')]][_0x344a('0x2f')]));writeDB(agents[_0x20a892[_0x344a('0x15')]]);var _0x212b08=unanswered[_0x344a('0x54')](_0x20a892['uniqueid']);if(_0x212b08>-0x1){unanswered[_0x344a('0x55')](_0x212b08,0x1);}}if(transfers[_0x20a892[_0x344a('0x15')]]){transfers[_0x20a892[_0x344a('0x15')]][_0x344a('0xd')]=!![];transfers[_0x20a892['uniqueid']][_0x344a('0x36')]=utils[_0x344a('0x18')]();transfers[_0x20a892[_0x344a('0x15')]][_0x344a('0x25')]=utils[_0x344a('0x35')](transfers[_0x20a892[_0x344a('0x15')]][_0x344a('0x36')],transfers[_0x20a892[_0x344a('0x15')]]['agentconnectAt']);transfers[_0x20a892[_0x344a('0x15')]][_0x344a('0x22')]=_0x344a('0x56');transfers[_0x20a892[_0x344a('0x15')]]['lastevent']=_0x344a('0x37');utils[_0x344a('0x3')](util[_0x344a('0x4')](_0x344a('0x53'),_0x20a892[_0x344a('0x15')],transfers[_0x20a892[_0x344a('0x15')]]['membername'],transfers[_0x20a892[_0x344a('0x15')]][_0x344a('0x22')],transfers[_0x20a892[_0x344a('0x15')]]['lastevent']));writeDB(transfers[_0x20a892[_0x344a('0x15')]],!![]);}if(agents[_0x20a892[_0x344a('0x15')]]&&agents[_0x20a892[_0x344a('0x15')]][_0x344a('0x2d')]){agents[_0x20a892[_0x344a('0x15')]]['agentcomplete']=!![];agents[_0x20a892[_0x344a('0x15')]][_0x344a('0x36')]=utils[_0x344a('0x18')]();agents[_0x20a892['uniqueid']][_0x344a('0x25')]=utils['diffTime'](agents[_0x20a892['uniqueid']][_0x344a('0x36')],agents[_0x20a892[_0x344a('0x15')]][_0x344a('0x2d')]);agents[_0x20a892[_0x344a('0x15')]][_0x344a('0x22')]=agents[_0x20a892[_0x344a('0x15')]][_0x344a('0x3b')]?_0x344a('0x3b'):'agent';agents[_0x20a892[_0x344a('0x15')]][_0x344a('0x2f')]='complete';utils['info'](util[_0x344a('0x4')](_0x344a('0x53'),_0x20a892[_0x344a('0x15')],agents[_0x20a892[_0x344a('0x15')]]['membername'],agents[_0x20a892[_0x344a('0x15')]][_0x344a('0x22')],agents[_0x20a892[_0x344a('0x15')]]['lastevent']));writeDB(agents[_0x20a892[_0x344a('0x15')]]);}}catch(_0x1c50c3){utils[_0x344a('0x1c')](util['format'](_0x344a('0x57'),_0x20a892[_0x344a('0x15')]),_0x1c50c3);}}; \ No newline at end of file +var _0xf4eb=['request','debug','format','[%s][agents][agentcalled]','destuniqueid','now','lastevent','connectedlinename','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','agentringnoanswerAt','timeout','reason','holdtime','ringtime','talktime','push','forIn','includes','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','agentconnect','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','answered_elsewhere','answeredelsewheremembername','[%s][agents][agentconnect]','agentcompleteAt','diffTime','complete','[%s][agents][agentcomplete]','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','blind','transferexten','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','origtransfereruniqueid','secondtransfereruniqueid','ATTENDED','origtransfererexten','transfereeuniqueid','clone','calleridname','agentcalledAt','agententerreason','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','lodash','info','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','then','type','agentacw','agentcomplete','acw','acwTimeout','CreateVoiceAgentReport'];(function(_0x4a3553,_0x12e68f){var _0x569d42=function(_0x28860d){while(--_0x28860d){_0x4a3553['push'](_0x4a3553['shift']());}};_0x569d42(++_0x12e68f);}(_0xf4eb,0xec));var _0xbf4e=function(_0x11e855,_0x5857b5){_0x11e855=_0x11e855-0x0;var _0x21a222=_0xf4eb[_0x11e855];return _0x21a222;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x479210,_0x5ed5b9){utils[_0xbf4e('0x1')](util['format']('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x479210[_0xbf4e('0x2')],_0x479210[_0xbf4e('0x3')],_0x479210[_0xbf4e('0x4')],_0x479210[_0xbf4e('0x5')],_0x479210[_0xbf4e('0x6')],_0x479210[_0xbf4e('0x7')],_0x479210[_0xbf4e('0x8')],_0x479210['lastevent']));if(_0x479210[_0xbf4e('0x4')]){utils['getVoiceQueueByName'](_0x479210['queue'])[_0xbf4e('0x9')](function(_0x3761c1){if(_0x3761c1){_0x479210[_0xbf4e('0xa')]=_0x3761c1[_0xbf4e('0xa')];_0x479210[_0xbf4e('0xb')]=_0x479210[_0xbf4e('0xc')]?_0x3761c1[_0xbf4e('0xd')]:![];_0x479210['acwtime']=_0x479210['agentacw']?_0x3761c1[_0xbf4e('0xe')]:0x0;}utils['request'](_0xbf4e('0xf'),_0x479210);});}else{utils[_0xbf4e('0x10')]('CreateVoiceAgentReport',_0x479210);}if(_0x5ed5b9){delete transfers[_0x479210[_0xbf4e('0x2')]];}else{delete agents[_0x479210['destuniqueid']];}}exports['agentcalled']=function(_0x209b25){try{utils[_0xbf4e('0x11')](util[_0xbf4e('0x12')](_0xbf4e('0x13'),_0x209b25[_0xbf4e('0x2')]),_0x209b25);agents[_0x209b25[_0xbf4e('0x14')]]=_0x209b25;agents[_0x209b25['destuniqueid']]['agentcalledAt']=utils[_0xbf4e('0x15')]();agents[_0x209b25[_0xbf4e('0x14')]][_0xbf4e('0x16')]='called';agents[_0x209b25[_0xbf4e('0x14')]][_0xbf4e('0x8')]=null;agents[_0x209b25[_0xbf4e('0x14')]][_0xbf4e('0x17')]=null;utils['info'](util[_0xbf4e('0x12')]('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x209b25['uniqueid'],agents[_0x209b25['destuniqueid']]['membername'],_0x209b25[_0xbf4e('0x14')]));}catch(_0x1ca73c){utils[_0xbf4e('0x18')](util['format']('[%s][agents][agentcalled]',_0x209b25[_0xbf4e('0x2')]),_0x1ca73c);}};exports[_0xbf4e('0x19')]=function(_0x3be138){try{if(!_[_0xbf4e('0x1a')](agents[_0x3be138[_0xbf4e('0x14')]])){utils[_0xbf4e('0x11')](util[_0xbf4e('0x12')](_0xbf4e('0x1b'),_0x3be138[_0xbf4e('0x2')]),_0x3be138);utils[_0xbf4e('0x1')](util[_0xbf4e('0x12')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x3be138[_0xbf4e('0x2')],agents[_0x3be138[_0xbf4e('0x14')]]['membername'],_0x3be138[_0xbf4e('0x14')]));agents[_0x3be138[_0xbf4e('0x14')]][_0xbf4e('0x19')]=!![];agents[_0x3be138[_0xbf4e('0x14')]][_0xbf4e('0x1c')]=utils['now']();agents[_0x3be138[_0xbf4e('0x14')]][_0xbf4e('0x16')]=_0xbf4e('0x1d');agents[_0x3be138['destuniqueid']][_0xbf4e('0x1e')]='timeout';agents[_0x3be138['destuniqueid']][_0xbf4e('0x1f')]=_0x3be138['ringtime']?parseInt(_0x3be138[_0xbf4e('0x20')])/0x3e8:0x0;agents[_0x3be138[_0xbf4e('0x14')]][_0xbf4e('0x21')]=0x0;unanswered[_0xbf4e('0x22')](_0x3be138['destuniqueid']);}}catch(_0x2d4686){utils[_0xbf4e('0x18')](util[_0xbf4e('0x12')]('[%s][agents][agentringnoanswer]',_0x3be138[_0xbf4e('0x2')]),_0x2d4686);}};exports['queuecallerabandon']=function(_0x1dfa81){try{_[_0xbf4e('0x23')](agents,function(_0xb8b58e,_0x498dbd){if(_0xb8b58e[_0xbf4e('0x2')]==_0x1dfa81[_0xbf4e('0x2')]&&!_[_0xbf4e('0x24')](unanswered,_0xb8b58e[_0xbf4e('0x14')])){utils[_0xbf4e('0x11')](util[_0xbf4e('0x12')]('[%s][agents][queuecallerabandon]',_0x1dfa81[_0xbf4e('0x2')]),_0x1dfa81);utils[_0xbf4e('0x1')](util['format'](_0xbf4e('0x25'),_0x1dfa81[_0xbf4e('0x2')],_0xb8b58e['membername'],_0xb8b58e[_0xbf4e('0x14')]));_0xb8b58e['agentringnoanswer']=!![];_0xb8b58e[_0xbf4e('0x1c')]=utils['now']();_0xb8b58e[_0xbf4e('0x16')]=_0xbf4e('0x26');_0xb8b58e[_0xbf4e('0x1e')]='abandoned';_0xb8b58e[_0xbf4e('0x1f')]=_0x1dfa81[_0xbf4e('0x1f')];_0xb8b58e[_0xbf4e('0x21')]=0x0;writeDB(_0xb8b58e);}});}catch(_0x29d6aa){utils[_0xbf4e('0x18')](util[_0xbf4e('0x12')]('[%s][agents][queuecallerabandon]',_0x1dfa81[_0xbf4e('0x2')]),_0x29d6aa);}};exports[_0xbf4e('0x27')]=function(_0x25b837){try{if(agents[_0x25b837[_0xbf4e('0x14')]]){utils[_0xbf4e('0x11')](util['format']('[%s][agents][agentconnect]',_0x25b837['uniqueid']),_0x25b837);utils['info'](util[_0xbf4e('0x12')](_0xbf4e('0x28'),_0x25b837[_0xbf4e('0x2')],agents[_0x25b837[_0xbf4e('0x14')]][_0xbf4e('0x5')],_0x25b837[_0xbf4e('0x14')]));agents[_0x25b837[_0xbf4e('0x14')]][_0xbf4e('0x29')]=utils[_0xbf4e('0x15')]();agents[_0x25b837['destuniqueid']]['connectedlinenum']=_0x25b837[_0xbf4e('0x8')];agents[_0x25b837[_0xbf4e('0x14')]][_0xbf4e('0x17')]=_0x25b837['connectedlinename'];agents[_0x25b837[_0xbf4e('0x14')]]['holdtime']=_0x25b837[_0xbf4e('0x20')];agents[_0x25b837[_0xbf4e('0x14')]][_0xbf4e('0x16')]=_0xbf4e('0x2a');_['forIn'](agents,function(_0x31d8dc,_0x78ab2d){if(_0x31d8dc[_0xbf4e('0x14')]!=_0x25b837[_0xbf4e('0x14')]&&_0x31d8dc['uniqueid']==_0x25b837[_0xbf4e('0x2')]){_0x31d8dc[_0xbf4e('0x21')]=0x0;_0x31d8dc[_0xbf4e('0x1f')]=_0x25b837[_0xbf4e('0x20')];_0x31d8dc[_0xbf4e('0x19')]=!![];_0x31d8dc[_0xbf4e('0x1c')]=utils[_0xbf4e('0x15')]();_0x31d8dc['lastevent']=_0xbf4e('0x2b');_0x31d8dc[_0xbf4e('0x1e')]='answered_elsewhere';_0x31d8dc['answeredelsewheredestinationuniqueid']=_0x25b837[_0xbf4e('0x14')];_0x31d8dc[_0xbf4e('0x2c')]=_0x25b837['membername'];writeDB(_0x31d8dc);}});}}catch(_0x5bfc4d){utils[_0xbf4e('0x18')](util[_0xbf4e('0x12')](_0xbf4e('0x2d'),_0x25b837[_0xbf4e('0x2')]),_0x5bfc4d);}};exports[_0xbf4e('0xc')]=function(_0x3ad0a4){try{if(!_['isNil'](agents[_0x3ad0a4[_0xbf4e('0x14')]])){utils[_0xbf4e('0x11')](util['format']('[%s][agents][agentcomplete]',_0x3ad0a4['uniqueid']),_0x3ad0a4);utils['info'](util[_0xbf4e('0x12')]('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x3ad0a4[_0xbf4e('0x2')],agents[_0x3ad0a4[_0xbf4e('0x14')]]['membername'],_0x3ad0a4['destuniqueid']));agents[_0x3ad0a4[_0xbf4e('0x14')]][_0xbf4e('0xc')]=!![];agents[_0x3ad0a4[_0xbf4e('0x14')]][_0xbf4e('0x2e')]=utils[_0xbf4e('0x15')]();agents[_0x3ad0a4['destuniqueid']][_0xbf4e('0x21')]=utils[_0xbf4e('0x2f')](agents[_0x3ad0a4[_0xbf4e('0x14')]][_0xbf4e('0x2e')],agents[_0x3ad0a4[_0xbf4e('0x14')]][_0xbf4e('0x29')]);agents[_0x3ad0a4[_0xbf4e('0x14')]][_0xbf4e('0x1e')]=_0x3ad0a4['reason'];agents[_0x3ad0a4[_0xbf4e('0x14')]][_0xbf4e('0x16')]=_0xbf4e('0x30');writeDB(agents[_0x3ad0a4[_0xbf4e('0x14')]]);}}catch(_0x9bc1fe){utils[_0xbf4e('0x18')](util[_0xbf4e('0x12')](_0xbf4e('0x31'),_0x3ad0a4[_0xbf4e('0x2')]),_0x9bc1fe);}};exports[_0xbf4e('0x32')]=function(_0x2fdba9){try{if(!_[_0xbf4e('0x1a')](agents[_0x2fdba9[_0xbf4e('0x33')]])){utils[_0xbf4e('0x11')](util[_0xbf4e('0x12')](_0xbf4e('0x34'),_0x2fdba9[_0xbf4e('0x2')]),_0x2fdba9);utils['info'](util[_0xbf4e('0x12')](_0xbf4e('0x35'),_0x2fdba9[_0xbf4e('0x2')],agents[_0x2fdba9['transfereruniqueid']][_0xbf4e('0x5')],agents[_0x2fdba9['transfereruniqueid']]['uniqueid']));agents[_0x2fdba9[_0xbf4e('0x33')]][_0xbf4e('0x36')]=!![];agents[_0x2fdba9['transfereruniqueid']][_0xbf4e('0x37')]=_0xbf4e('0x38');agents[_0x2fdba9[_0xbf4e('0x33')]][_0xbf4e('0x39')]=_0x2fdba9[_0xbf4e('0x3a')];agents[_0x2fdba9[_0xbf4e('0x33')]][_0xbf4e('0x3b')]=agents[_0x2fdba9[_0xbf4e('0x33')]][_0xbf4e('0x2')];}}catch(_0xc058e1){utils[_0xbf4e('0x18')](util['format']('[%s][agents][blindtransfer]',_0x2fdba9[_0xbf4e('0x2')]),_0xc058e1);}};exports[_0xbf4e('0x3c')]=function(_0x3d0b4a){try{utils['debug'](util[_0xbf4e('0x12')](_0xbf4e('0x3d'),_0x3d0b4a['origtransfereruniqueid']),_0x3d0b4a);if(_0x3d0b4a['origtransfereruniqueid']==_0x3d0b4a[_0xbf4e('0x3e')]){if(!_['isNil'](agents[_0x3d0b4a['secondtransfereruniqueid']])){utils[_0xbf4e('0x1')](util[_0xbf4e('0x12')](_0xbf4e('0x3f'),_0x3d0b4a[_0xbf4e('0x40')],agents[_0x3d0b4a[_0xbf4e('0x41')]]['membername']));agents[_0x3d0b4a[_0xbf4e('0x41')]]['transfer']=!![];agents[_0x3d0b4a[_0xbf4e('0x41')]]['transfertype']=_0xbf4e('0x42');agents[_0x3d0b4a['secondtransfereruniqueid']][_0xbf4e('0x39')]=_0x3d0b4a[_0xbf4e('0x43')];agents[_0x3d0b4a[_0xbf4e('0x41')]][_0xbf4e('0x3b')]=_0x3d0b4a[_0xbf4e('0x40')];}if(_0x3d0b4a['transfereeuniqueid']&&agents[_0x3d0b4a['transfereeuniqueid']]){agents[_0x3d0b4a['transfereeuniqueid']]['agententerreason']=0x1;transfers[_0x3d0b4a[_0xbf4e('0x44')]]=_[_0xbf4e('0x45')](agents[_0x3d0b4a['transfereeuniqueid']]);transfers[_0x3d0b4a[_0xbf4e('0x44')]][_0xbf4e('0x7')]=agents[_0x3d0b4a[_0xbf4e('0x41')]][_0xbf4e('0x7')];transfers[_0x3d0b4a[_0xbf4e('0x44')]][_0xbf4e('0x46')]=agents[_0x3d0b4a[_0xbf4e('0x41')]]['calleridname'];transfers[_0x3d0b4a[_0xbf4e('0x44')]][_0xbf4e('0x47')]=utils[_0xbf4e('0x15')]();transfers[_0x3d0b4a['transfereeuniqueid']]['agentconnectAt']=utils[_0xbf4e('0x15')]();transfers[_0x3d0b4a[_0xbf4e('0x44')]][_0xbf4e('0x1f')]=0x0;transfers[_0x3d0b4a['transfereeuniqueid']][_0xbf4e('0x48')]=0x2;}}else if(_0x3d0b4a[_0xbf4e('0x41')]==_0x3d0b4a[_0xbf4e('0x49')]){if(!_[_0xbf4e('0x1a')](agents[_0x3d0b4a[_0xbf4e('0x40')]])){utils[_0xbf4e('0x1')](util[_0xbf4e('0x12')](_0xbf4e('0x3f'),_0x3d0b4a[_0xbf4e('0x40')],agents[_0x3d0b4a[_0xbf4e('0x40')]][_0xbf4e('0x5')]));agents[_0x3d0b4a[_0xbf4e('0x40')]]['transfer']=!![];agents[_0x3d0b4a[_0xbf4e('0x40')]]['transfertype']=_0xbf4e('0x42');agents[_0x3d0b4a[_0xbf4e('0x40')]][_0xbf4e('0x39')]=_0x3d0b4a[_0xbf4e('0x4a')];agents[_0x3d0b4a[_0xbf4e('0x40')]][_0xbf4e('0x3b')]=_0x3d0b4a[_0xbf4e('0x41')];}if(_0x3d0b4a[_0xbf4e('0x4b')]&&agents[_0x3d0b4a['transfertargetuniqueid']]){agents[_0x3d0b4a[_0xbf4e('0x4b')]][_0xbf4e('0x48')]=0x1;transfers[_0x3d0b4a[_0xbf4e('0x4b')]]=_[_0xbf4e('0x45')](agents[_0x3d0b4a[_0xbf4e('0x4b')]]);transfers[_0x3d0b4a['transfertargetuniqueid']][_0xbf4e('0x7')]=agents[_0x3d0b4a[_0xbf4e('0x40')]][_0xbf4e('0x7')];transfers[_0x3d0b4a[_0xbf4e('0x4b')]][_0xbf4e('0x46')]=agents[_0x3d0b4a[_0xbf4e('0x40')]]['calleridname'];transfers[_0x3d0b4a[_0xbf4e('0x4b')]]['agentcalledAt']=utils[_0xbf4e('0x15')]();transfers[_0x3d0b4a[_0xbf4e('0x4b')]][_0xbf4e('0x29')]=utils[_0xbf4e('0x15')]();transfers[_0x3d0b4a['transfertargetuniqueid']][_0xbf4e('0x1f')]=0x0;transfers[_0x3d0b4a['transfertargetuniqueid']]['agententerreason']=0x2;}}}catch(_0x2c0dbd){utils[_0xbf4e('0x18')](util[_0xbf4e('0x12')]('[%s][agents][attendedtransfer]',_0x3d0b4a[_0xbf4e('0x40')]),_0x2c0dbd);}};exports[_0xbf4e('0x4c')]=function(_0x4d7241){try{utils[_0xbf4e('0x11')](util[_0xbf4e('0x12')](_0xbf4e('0x4d'),_0x4d7241[_0xbf4e('0x2')]),_0x4d7241);if(agents[_0x4d7241[_0xbf4e('0x2')]]&&agents[_0x4d7241[_0xbf4e('0x2')]][_0xbf4e('0x1e')]===_0xbf4e('0x1d')){if(_0x4d7241[_0xbf4e('0x4e')]==='21'){agents[_0x4d7241['uniqueid']][_0xbf4e('0x1e')]=_0xbf4e('0x4f');agents[_0x4d7241[_0xbf4e('0x2')]][_0xbf4e('0x16')]='rejected';}utils[_0xbf4e('0x1')](util[_0xbf4e('0x12')](_0xbf4e('0x50'),_0x4d7241[_0xbf4e('0x2')],agents[_0x4d7241[_0xbf4e('0x2')]][_0xbf4e('0x5')],agents[_0x4d7241[_0xbf4e('0x2')]][_0xbf4e('0x1e')],agents[_0x4d7241[_0xbf4e('0x2')]]['lastevent']));writeDB(agents[_0x4d7241[_0xbf4e('0x2')]]);var _0x47ef56=unanswered[_0xbf4e('0x51')](_0x4d7241[_0xbf4e('0x2')]);if(_0x47ef56>-0x1){unanswered[_0xbf4e('0x52')](_0x47ef56,0x1);}}if(transfers[_0x4d7241[_0xbf4e('0x2')]]){transfers[_0x4d7241[_0xbf4e('0x2')]]['agentcomplete']=!![];transfers[_0x4d7241[_0xbf4e('0x2')]][_0xbf4e('0x2e')]=utils[_0xbf4e('0x15')]();transfers[_0x4d7241['uniqueid']][_0xbf4e('0x21')]=utils[_0xbf4e('0x2f')](transfers[_0x4d7241[_0xbf4e('0x2')]]['agentcompleteAt'],transfers[_0x4d7241[_0xbf4e('0x2')]][_0xbf4e('0x29')]);transfers[_0x4d7241[_0xbf4e('0x2')]][_0xbf4e('0x1e')]=_0xbf4e('0x53');transfers[_0x4d7241['uniqueid']][_0xbf4e('0x16')]='complete';utils[_0xbf4e('0x1')](util['format'](_0xbf4e('0x50'),_0x4d7241['uniqueid'],transfers[_0x4d7241[_0xbf4e('0x2')]]['membername'],transfers[_0x4d7241[_0xbf4e('0x2')]][_0xbf4e('0x1e')],transfers[_0x4d7241[_0xbf4e('0x2')]][_0xbf4e('0x16')]));writeDB(transfers[_0x4d7241[_0xbf4e('0x2')]],!![]);}if(agents[_0x4d7241[_0xbf4e('0x2')]]&&agents[_0x4d7241[_0xbf4e('0x2')]]['agentconnectAt']){agents[_0x4d7241[_0xbf4e('0x2')]][_0xbf4e('0xc')]=!![];agents[_0x4d7241[_0xbf4e('0x2')]][_0xbf4e('0x2e')]=utils[_0xbf4e('0x15')]();agents[_0x4d7241[_0xbf4e('0x2')]]['talktime']=utils[_0xbf4e('0x2f')](agents[_0x4d7241[_0xbf4e('0x2')]]['agentcompleteAt'],agents[_0x4d7241[_0xbf4e('0x2')]][_0xbf4e('0x29')]);agents[_0x4d7241[_0xbf4e('0x2')]][_0xbf4e('0x1e')]=agents[_0x4d7241[_0xbf4e('0x2')]][_0xbf4e('0x36')]?_0xbf4e('0x36'):_0xbf4e('0x53');agents[_0x4d7241[_0xbf4e('0x2')]]['lastevent']=_0xbf4e('0x30');utils[_0xbf4e('0x1')](util[_0xbf4e('0x12')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x4d7241[_0xbf4e('0x2')],agents[_0x4d7241[_0xbf4e('0x2')]]['membername'],agents[_0x4d7241[_0xbf4e('0x2')]][_0xbf4e('0x1e')],agents[_0x4d7241[_0xbf4e('0x2')]][_0xbf4e('0x16')]));writeDB(agents[_0x4d7241[_0xbf4e('0x2')]]);}}catch(_0x1cc939){utils[_0xbf4e('0x18')](util[_0xbf4e('0x12')](_0xbf4e('0x4d'),_0x4d7241[_0xbf4e('0x2')]),_0x1cc939);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 802390a..dd89b0c 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 _0x5353=['format','[%s][calls][newchannel]','linkedid','channel','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','now','DOCUMENTATION','error','[%s][calls][newstate]','isNil','[%s][calls][newstate]\x20context:%s\x20channel:%s','context','systemanswertime','channelstate','destinationchannel','answertime','disposition','toNumber','hangup','callerid','calleridname','cause-txt','endtime','duration','diffTime','starttime','[%s][calls][hangup]','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstartAt','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','\x22\x20<','variable','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','startsWith','toLowerCase','cdr','split','substring','lastIndexOf','includes','noop','execif','gotoif','lodash','./utils','./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','BUSY','blinds','uniqueid','transfereeuniqueid','info','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','queue','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','then','UserId','CreateVoiceCallReport','request','recording','debug'];(function(_0x117ae4,_0x6de6c8){var _0x5d9a89=function(_0x2fca34){while(--_0x2fca34){_0x117ae4['push'](_0x117ae4['shift']());}};_0x5d9a89(++_0x6de6c8);}(_0x5353,0x12f));var _0x3535=function(_0x420192,_0x28e98c){_0x420192=_0x420192-0x0;var _0x5226c2=_0x5353[_0x420192];return _0x5226c2;};'use strict';var _=require(_0x3535('0x0'));var util=require('util');var utils=require(_0x3535('0x1'));var transfers=require(_0x3535('0x2'));var dispositions=[_0x3535('0x3'),_0x3535('0x4'),_0x3535('0x4'),_0x3535('0x3'),_0x3535('0x3'),_0x3535('0x3'),_0x3535('0x5'),_0x3535('0x6'),'FAILED',_0x3535('0x4'),'FAILED'];var channels={};function writeDB(_0x1c92fd){var _0x268873;if(transfers[_0x3535('0x7')][_0x1c92fd['uniqueid']]){_0x268873=_0x1c92fd[_0x3535('0x8')];_0x1c92fd[_0x3535('0x8')]=transfers[_0x3535('0x7')][_0x1c92fd[_0x3535('0x8')]][_0x3535('0x9')];}utils[_0x3535('0xa')](util['format'](_0x3535('0xb'),_0x1c92fd[_0x3535('0x8')],_0x1c92fd['channel'],_0x1c92fd[_0x3535('0xc')],_0x1c92fd['membername'],_0x1c92fd['interface'],_0x1c92fd[_0x3535('0xd')],_0x1c92fd[_0x3535('0xe')],_0x1c92fd[_0x3535('0xf')]));if(_0x1c92fd[_0x3535('0x10')]){utils[_0x3535('0x11')](_0x1c92fd[_0x3535('0x10')])[_0x3535('0x12')](function(_0x5115bd){if(_0x5115bd){_0x1c92fd[_0x3535('0x13')]=_0x5115bd['id'];}utils['request'](_0x3535('0x14'),_0x1c92fd);});}else{utils[_0x3535('0x15')](_0x3535('0x14'),_0x1c92fd);}if(channels[_0x1c92fd['uniqueid']]){delete channels[_0x1c92fd[_0x3535('0x8')]];}else if(_0x268873&&channels[_0x268873]){if(!transfers['blinds'][_0x268873][_0x3535('0x16')])delete transfers['blinds'][_0x268873];delete channels[_0x268873];}}exports['newchannel']=function(_0x4243c1){try{utils[_0x3535('0x17')](util[_0x3535('0x18')](_0x3535('0x19'),_0x4243c1[_0x3535('0x8')]),_0x4243c1);if(_0x4243c1[_0x3535('0x8')]==_0x4243c1[_0x3535('0x1a')]&&_0x4243c1[_0x3535('0x1b')]!=_0x3535('0x1c')){utils[_0x3535('0xa')](util[_0x3535('0x18')](_0x3535('0x1d'),_0x4243c1['uniqueid'],_0x4243c1['context'],_0x4243c1[_0x3535('0x1e')]));channels[_0x4243c1['uniqueid']]={'uniqueid':_0x4243c1['uniqueid'],'accountcode':_0x4243c1[_0x3535('0x10')],'source':_0x4243c1[_0x3535('0xd')],'destination':_0x4243c1[_0x3535('0x1e')],'destinationcontext':_0x4243c1['context'],'channel':_0x4243c1['channel'],'starttime':utils[_0x3535('0x1f')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0x3535('0x20')};}}catch(_0x542372){utils[_0x3535('0x21')](util['format'](_0x3535('0x19'),_0x4243c1['uniqueid']),_0x542372);}};exports['newstate']=function(_0x333946){try{utils[_0x3535('0x17')](util['format'](_0x3535('0x22'),_0x333946[_0x3535('0x8')]),_0x333946);if(!_[_0x3535('0x23')](channels[_0x333946[_0x3535('0x8')]])&&_0x333946['channelstate']==0x6){utils[_0x3535('0xa')](util[_0x3535('0x18')](_0x3535('0x24'),_0x333946[_0x3535('0x8')],_0x333946[_0x3535('0x25')],_0x333946[_0x3535('0x1b')]));if(_[_0x3535('0x23')](channels[_0x333946[_0x3535('0x8')]]['systemanswertime'])){channels[_0x333946[_0x3535('0x8')]][_0x3535('0x26')]=utils['now']();}}else if(!_[_0x3535('0x23')](channels[_0x333946[_0x3535('0x1a')]])&&_0x333946[_0x3535('0x27')]==0x6&&_0x333946['context']!='transfer'){utils[_0x3535('0xa')](util[_0x3535('0x18')]('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x333946[_0x3535('0x8')],_0x333946[_0x3535('0x1a')],_0x333946[_0x3535('0x25')],_0x333946[_0x3535('0x1b')]));channels[_0x333946['linkedid']][_0x3535('0x10')]=_0x333946[_0x3535('0x10')];channels[_0x333946['linkedid']][_0x3535('0x28')]=_0x333946[_0x3535('0x1b')];if(_[_0x3535('0x23')](channels[_0x333946[_0x3535('0x1a')]][_0x3535('0x29')])){channels[_0x333946[_0x3535('0x1a')]][_0x3535('0x29')]=utils['now']();}channels[_0x333946['linkedid']][_0x3535('0x2a')]=dispositions[_[_0x3535('0x2b')](_0x333946[_0x3535('0x27')])]||_0x3535('0x5');}}catch(_0x3f5558){utils[_0x3535('0x21')](util[_0x3535('0x18')](_0x3535('0x22'),_0x333946['uniqueid']),_0x3f5558);}};exports[_0x3535('0x2c')]=function(_0x36d865){try{if(!_[_0x3535('0x23')](channels[_0x36d865[_0x3535('0x8')]])){utils[_0x3535('0x17')](util[_0x3535('0x18')]('[%s][calls][hangup]',_0x36d865[_0x3535('0x8')]),_0x36d865);if(_['isNil'](channels[_0x36d865[_0x3535('0x8')]][_0x3535('0x2d')])){channels[_0x36d865['uniqueid']][_0x3535('0x2d')]=_0x36d865[_0x3535('0x2e')]+'\x20<'+_0x36d865[_0x3535('0xd')]+'>';}utils[_0x3535('0xa')](util['format']('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x36d865[_0x3535('0x8')],channels[_0x36d865[_0x3535('0x8')]][_0x3535('0x2d')],_0x36d865[_0x3535('0x2f')]));channels[_0x36d865[_0x3535('0x8')]][_0x3535('0x30')]=utils[_0x3535('0x1f')]();channels[_0x36d865[_0x3535('0x8')]][_0x3535('0x31')]=utils[_0x3535('0x32')](channels[_0x36d865[_0x3535('0x8')]][_0x3535('0x30')],channels[_0x36d865['uniqueid']][_0x3535('0x33')]);channels[_0x36d865[_0x3535('0x8')]]['billableseconds']=channels[_0x36d865[_0x3535('0x8')]][_0x3535('0x29')]?utils[_0x3535('0x32')](channels[_0x36d865[_0x3535('0x8')]][_0x3535('0x30')],channels[_0x36d865[_0x3535('0x8')]]['answertime']):0x0;writeDB(channels[_0x36d865[_0x3535('0x8')]]);}}catch(_0x3c3691){utils[_0x3535('0x21')](util['format'](_0x3535('0x34'),_0x36d865[_0x3535('0x8')]),_0x3c3691);}};exports[_0x3535('0x35')]=function(_0x3990f7){try{if(!_[_0x3535('0x23')](channels[_0x3990f7[_0x3535('0x36')]])){utils[_0x3535('0x17')](util[_0x3535('0x18')](_0x3535('0x37'),_0x3990f7[_0x3535('0x38')]),_0x3990f7);if(channels[_0x3990f7[_0x3535('0x36')]][_0x3535('0x1b')]==_0x3990f7['transfereechannel']){utils[_0x3535('0xa')](util['format'](_0x3535('0x39'),_0x3990f7['origtransfereruniqueid'],_0x3990f7[_0x3535('0x36')],_0x3990f7[_0x3535('0x3a')]));channels[_0x3990f7[_0x3535('0x36')]][_0x3535('0x28')]=_0x3990f7[_0x3535('0x3a')];channels[_0x3990f7['localtwolinkedid']][_0x3535('0x3b')]=_0x3535('0x3c');}else if(channels[_0x3990f7['localtwolinkedid']][_0x3535('0x1b')]=_0x3990f7[_0x3535('0x3d')]){utils[_0x3535('0xa')](util[_0x3535('0x18')](_0x3535('0x39'),_0x3990f7[_0x3535('0x38')],_0x3990f7['localtwolinkedid'],_0x3990f7[_0x3535('0x3e')]));channels[_0x3990f7[_0x3535('0x36')]]['destinationchannel']=_0x3990f7[_0x3535('0x3e')];channels[_0x3990f7['localtwolinkedid']][_0x3535('0x3b')]=_0x3535('0x3c');}}}catch(_0x234518){utils[_0x3535('0x21')](util[_0x3535('0x18')](_0x3535('0x37'),_0x3990f7[_0x3535('0x38')]),_0x234518);}};exports[_0x3535('0x3f')]=function(_0x5f2ea8){try{if(!_[_0x3535('0x23')](channels[_0x5f2ea8[_0x3535('0x8')]])){utils[_0x3535('0x17')](util['format'](_0x3535('0x40'),_0x5f2ea8[_0x3535('0x8')]),_0x5f2ea8);channels[_0x5f2ea8[_0x3535('0x8')]]['musiconholdstartAt']=utils['now']();utils[_0x3535('0xa')](util[_0x3535('0x18')](_0x3535('0x41'),_0x5f2ea8[_0x3535('0x8')],channels[_0x5f2ea8[_0x3535('0x8')]][_0x3535('0x42')]));}}catch(_0x4c9e13){utils[_0x3535('0x21')](util[_0x3535('0x18')](_0x3535('0x40'),_0x5f2ea8[_0x3535('0x8')]),_0x4c9e13);}};exports['musiconholdstop']=function(_0x5b59b2){try{if(!_['isNil'](channels[_0x5b59b2[_0x3535('0x8')]])){utils[_0x3535('0x17')](util[_0x3535('0x18')](_0x3535('0x43'),_0x5b59b2[_0x3535('0x8')]),_0x5b59b2);if(!_[_0x3535('0x23')](channels[_0x5b59b2[_0x3535('0x8')]][_0x3535('0x42')])){channels[_0x5b59b2[_0x3535('0x8')]][_0x3535('0x44')]+=utils[_0x3535('0x32')](utils[_0x3535('0x1f')](),channels[_0x5b59b2[_0x3535('0x8')]][_0x3535('0x42')]);utils[_0x3535('0xa')](util[_0x3535('0x18')](_0x3535('0x45'),_0x5b59b2[_0x3535('0x8')],channels[_0x5b59b2[_0x3535('0x8')]]['mohtime']));delete channels[_0x5b59b2['uniqueid']][_0x3535('0x42')];}}}catch(_0x5786da){utils[_0x3535('0x21')](util[_0x3535('0x18')]('[%s][calls][musiconholdstop]',_0x5b59b2[_0x3535('0x8')]),_0x5786da);}};exports[_0x3535('0x46')]=function(_0x130112){try{if(!_[_0x3535('0x23')](channels[_0x130112[_0x3535('0x8')]])){utils['debug'](util[_0x3535('0x18')](_0x3535('0x47'),_0x130112['uniqueid']),_0x130112);if(!_['isNil'](_0x130112['variable']['xmd-originatecalleridnum'])){utils[_0x3535('0xa')](util[_0x3535('0x18')](_0x3535('0x48'),_0x130112[_0x3535('0x8')],_0x130112[_0x3535('0x49')]));channels[_0x130112['uniqueid']][_0x3535('0x4a')]=_0x130112[_0x3535('0x49')];}if(!_[_0x3535('0x23')](_0x130112['variable'][_0x3535('0x4b')])){utils[_0x3535('0xa')](util['format']('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x130112[_0x3535('0x8')],_0x130112['value']));channels[_0x130112[_0x3535('0x8')]]['destination']=_0x130112['value'];channels[_0x130112[_0x3535('0x8')]][_0x3535('0x2d')]='\x22'+_0x130112['value']+_0x3535('0x4c')+_0x130112[_0x3535('0x49')]+'>';}if(!_[_0x3535('0x23')](_0x130112[_0x3535('0x4d')][_0x3535('0x4e')])||!_[_0x3535('0x23')](_0x130112[_0x3535('0x4d')][_0x3535('0x4f')])){utils[_0x3535('0xa')](util['format'](_0x3535('0x50'),_0x130112[_0x3535('0x8')],!_[_0x3535('0x23')](_0x130112['variable']['xmd-callerid-preview'])?'xmd-callerid-preview':_0x3535('0x4f'),_0x130112['value']));channels[_0x130112[_0x3535('0x8')]]['callerid']=_0x130112[_0x3535('0x49')];}if(!_[_0x3535('0x23')](_0x130112[_0x3535('0x4d')][_0x3535('0x51')])||!_[_0x3535('0x23')](_0x130112['variable']['xmcs-queue'])){utils['info'](util[_0x3535('0x18')](_0x3535('0x50'),_0x130112[_0x3535('0x8')],!_[_0x3535('0x23')](_0x130112[_0x3535('0x4d')][_0x3535('0x51')])?'xmd-queue':_0x3535('0x52'),_0x130112['value']));channels[_0x130112[_0x3535('0x8')]][_0x3535('0x53')]='Queue';channels[_0x130112['uniqueid']][_0x3535('0x54')]=_0x130112[_0x3535('0x49')];channels[_0x130112[_0x3535('0x8')]]['queue']=!![];}if(!_[_0x3535('0x23')](_0x130112[_0x3535('0x4d')][_0x3535('0x55')])){utils['info'](util[_0x3535('0x18')](_0x3535('0x56'),_0x130112[_0x3535('0x8')],_0x130112['value']));channels[_0x130112[_0x3535('0x8')]][_0x3535('0x57')]=_0x130112[_0x3535('0x49')];}if(!_[_0x3535('0x23')](_0x130112['variable']['xmd-cdrtype'])){utils[_0x3535('0xa')](util[_0x3535('0x18')](_0x3535('0x58'),_0x130112[_0x3535('0x8')],_0x130112[_0x3535('0x49')]));channels[_0x130112[_0x3535('0x8')]][_0x3535('0x59')]=_0x130112[_0x3535('0x49')];}if(!_[_0x3535('0x23')](_0x130112[_0x3535('0x4d')][_0x3535('0x5a')])){utils[_0x3535('0xa')](util[_0x3535('0x18')](_0x3535('0x5b'),_0x130112[_0x3535('0x8')],_0x130112['value']));channels[_0x130112['uniqueid']]['routeid']=_0x130112[_0x3535('0x49')];}if(!_[_0x3535('0x23')](_0x130112[_0x3535('0x4d')][_0x3535('0x5c')])){utils[_0x3535('0xa')](util[_0x3535('0x18')](_0x3535('0x5d'),_0x130112[_0x3535('0x8')],_0x130112[_0x3535('0x49')]));channels[_0x130112[_0x3535('0x8')]]['sipcallid']=_0x130112['value'];}}}catch(_0x5810fd){utils['error'](util[_0x3535('0x18')]('[%s][calls][varset]',_0x130112[_0x3535('0x8')]),_0x5810fd);}};exports['newexten']=function(_0x13a475){try{if(!_[_0x3535('0x23')](channels[_0x13a475[_0x3535('0x8')]])){utils[_0x3535('0x17')](util[_0x3535('0x18')](_0x3535('0x5e'),_0x13a475[_0x3535('0x8')]),_0x13a475);utils[_0x3535('0xa')](util[_0x3535('0x18')](_0x3535('0x5f'),_0x13a475['uniqueid'],_0x13a475[_0x3535('0x60')],_0x13a475[_0x3535('0x61')]));if(_0x13a475[_0x3535('0x60')]['toLowerCase']()==_0x3535('0x62')&&_[_0x3535('0x63')](_0x13a475[_0x3535('0x61')][_0x3535('0x64')](),_0x3535('0x65'))){var _0x5db2ad=_0x13a475[_0x3535('0x61')][_0x3535('0x66')]('=');var _0x152d07=_0x5db2ad[0x0][_0x3535('0x67')](_0x5db2ad[0x0][_0x3535('0x68')]('(')+0x1,_0x5db2ad[0x0]['lastIndexOf'](')'));var _0x56001f=_0x5db2ad[0x1];channels[_0x13a475[_0x3535('0x8')]][_0x152d07]=_0x56001f;}if(!_[_0x3535('0x69')](['hangup',_0x3535('0x6a'),_0x3535('0x6b'),_0x3535('0x62'),_0x3535('0x6c')],_0x13a475['application'][_0x3535('0x64')]())){channels[_0x13a475[_0x3535('0x8')]][_0x3535('0x53')]=_0x13a475['application'];channels[_0x13a475['uniqueid']][_0x3535('0x54')]=_0x13a475[_0x3535('0x61')];}}}catch(_0x11429d){utils[_0x3535('0x21')](util[_0x3535('0x18')]('[%s][calls][newexten]',_0x13a475[_0x3535('0x8')]),_0x11429d);}}; \ No newline at end of file +var _0x0a93=['lodash','util','./utils','NO\x20ANSWER','FAILED','blinds','uniqueid','transfereeuniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','interface','calleridnum','connectedlinenum','lastevent','getUserByInternal','then','CreateVoiceCallReport','request','recording','newchannel','debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','context','exten','DOCUMENTATION','error','[%s][calls][newstate]','isNil','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','now','channelstate','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','accountcode','destinationchannel','answertime','toNumber','ANSWERED','hangup','[%s][calls][hangup]','callerid','calleridname','cause-txt','endtime','diffTime','billableseconds','[%s][calls][attendedtransfer]','origtransfereruniqueid','localtwolinkedid','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','musiconholdstop','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','sipcallid','application','appdata','toLowerCase','set','startsWith','cdr','split','lastIndexOf','includes','execif','gotoif','[%s][calls][newexten]'];(function(_0x7c4829,_0x582c23){var _0x28bbec=function(_0x226285){while(--_0x226285){_0x7c4829['push'](_0x7c4829['shift']());}};_0x28bbec(++_0x582c23);}(_0x0a93,0x6a));var _0x30a9=function(_0x4fbc17,_0x3e3731){_0x4fbc17=_0x4fbc17-0x0;var _0x12174c=_0x0a93[_0x4fbc17];return _0x12174c;};'use strict';var _=require(_0x30a9('0x0'));var util=require(_0x30a9('0x1'));var utils=require(_0x30a9('0x2'));var transfers=require('./transfers.controller');var dispositions=[_0x30a9('0x3'),_0x30a9('0x4'),_0x30a9('0x4'),_0x30a9('0x3'),'NO\x20ANSWER','NO\x20ANSWER','ANSWERED','BUSY','FAILED',_0x30a9('0x4'),_0x30a9('0x4')];var channels={};function writeDB(_0x5ae289){var _0x5ed9b4;if(transfers[_0x30a9('0x5')][_0x5ae289[_0x30a9('0x6')]]){_0x5ed9b4=_0x5ae289[_0x30a9('0x6')];_0x5ae289['uniqueid']=transfers[_0x30a9('0x5')][_0x5ae289[_0x30a9('0x6')]][_0x30a9('0x7')];}utils[_0x30a9('0x8')](util[_0x30a9('0x9')](_0x30a9('0xa'),_0x5ae289[_0x30a9('0x6')],_0x5ae289[_0x30a9('0xb')],_0x5ae289[_0x30a9('0xc')],_0x5ae289['membername'],_0x5ae289[_0x30a9('0xd')],_0x5ae289[_0x30a9('0xe')],_0x5ae289[_0x30a9('0xf')],_0x5ae289[_0x30a9('0x10')]));if(_0x5ae289['accountcode']){utils[_0x30a9('0x11')](_0x5ae289['accountcode'])[_0x30a9('0x12')](function(_0x3f641d){if(_0x3f641d){_0x5ae289['UserId']=_0x3f641d['id'];}utils['request'](_0x30a9('0x13'),_0x5ae289);});}else{utils[_0x30a9('0x14')]('CreateVoiceCallReport',_0x5ae289);}if(channels[_0x5ae289[_0x30a9('0x6')]]){delete channels[_0x5ae289[_0x30a9('0x6')]];}else if(_0x5ed9b4&&channels[_0x5ed9b4]){if(!transfers[_0x30a9('0x5')][_0x5ed9b4][_0x30a9('0x15')])delete transfers[_0x30a9('0x5')][_0x5ed9b4];delete channels[_0x5ed9b4];}}exports[_0x30a9('0x16')]=function(_0x5a2c34){try{utils[_0x30a9('0x17')](util[_0x30a9('0x9')](_0x30a9('0x18'),_0x5a2c34[_0x30a9('0x6')]),_0x5a2c34);if(_0x5a2c34[_0x30a9('0x6')]==_0x5a2c34[_0x30a9('0x19')]&&_0x5a2c34[_0x30a9('0xb')]!=_0x30a9('0x1a')){utils[_0x30a9('0x8')](util[_0x30a9('0x9')]('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x5a2c34[_0x30a9('0x6')],_0x5a2c34[_0x30a9('0x1b')],_0x5a2c34[_0x30a9('0x1c')]));channels[_0x5a2c34[_0x30a9('0x6')]]={'uniqueid':_0x5a2c34['uniqueid'],'accountcode':_0x5a2c34['accountcode'],'source':_0x5a2c34[_0x30a9('0xe')],'destination':_0x5a2c34[_0x30a9('0x1c')],'destinationcontext':_0x5a2c34['context'],'channel':_0x5a2c34[_0x30a9('0xb')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x30a9('0x3'),'amaflags':_0x30a9('0x1d')};}}catch(_0x5a6e49){utils[_0x30a9('0x1e')](util[_0x30a9('0x9')]('[%s][calls][newchannel]',_0x5a2c34[_0x30a9('0x6')]),_0x5a6e49);}};exports['newstate']=function(_0x3c4046){try{utils[_0x30a9('0x17')](util[_0x30a9('0x9')](_0x30a9('0x1f'),_0x3c4046[_0x30a9('0x6')]),_0x3c4046);if(!_[_0x30a9('0x20')](channels[_0x3c4046[_0x30a9('0x6')]])&&_0x3c4046['channelstate']==0x6){utils[_0x30a9('0x8')](util[_0x30a9('0x9')](_0x30a9('0x21'),_0x3c4046[_0x30a9('0x6')],_0x3c4046[_0x30a9('0x1b')],_0x3c4046[_0x30a9('0xb')]));if(_[_0x30a9('0x20')](channels[_0x3c4046[_0x30a9('0x6')]][_0x30a9('0x22')])){channels[_0x3c4046[_0x30a9('0x6')]]['systemanswertime']=utils[_0x30a9('0x23')]();}}else if(!_['isNil'](channels[_0x3c4046[_0x30a9('0x19')]])&&_0x3c4046[_0x30a9('0x24')]==0x6&&_0x3c4046[_0x30a9('0x1b')]!=_0x30a9('0x25')){utils[_0x30a9('0x8')](util[_0x30a9('0x9')](_0x30a9('0x26'),_0x3c4046[_0x30a9('0x6')],_0x3c4046[_0x30a9('0x19')],_0x3c4046[_0x30a9('0x1b')],_0x3c4046['channel']));channels[_0x3c4046[_0x30a9('0x19')]]['accountcode']=_0x3c4046[_0x30a9('0x27')];channels[_0x3c4046[_0x30a9('0x19')]][_0x30a9('0x28')]=_0x3c4046['channel'];if(_[_0x30a9('0x20')](channels[_0x3c4046[_0x30a9('0x19')]][_0x30a9('0x29')])){channels[_0x3c4046[_0x30a9('0x19')]]['answertime']=utils[_0x30a9('0x23')]();}channels[_0x3c4046['linkedid']]['disposition']=dispositions[_[_0x30a9('0x2a')](_0x3c4046['channelstate'])]||_0x30a9('0x2b');}}catch(_0x3d6396){utils[_0x30a9('0x1e')](util['format'](_0x30a9('0x1f'),_0x3c4046[_0x30a9('0x6')]),_0x3d6396);}};exports[_0x30a9('0x2c')]=function(_0x1245d8){try{if(!_['isNil'](channels[_0x1245d8[_0x30a9('0x6')]])){utils[_0x30a9('0x17')](util['format'](_0x30a9('0x2d'),_0x1245d8[_0x30a9('0x6')]),_0x1245d8);if(_[_0x30a9('0x20')](channels[_0x1245d8['uniqueid']][_0x30a9('0x2e')])){channels[_0x1245d8['uniqueid']][_0x30a9('0x2e')]=_0x1245d8[_0x30a9('0x2f')]+'\x20<'+_0x1245d8[_0x30a9('0xe')]+'>';}utils[_0x30a9('0x8')](util[_0x30a9('0x9')]('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x1245d8[_0x30a9('0x6')],channels[_0x1245d8[_0x30a9('0x6')]]['callerid'],_0x1245d8[_0x30a9('0x30')]));channels[_0x1245d8[_0x30a9('0x6')]][_0x30a9('0x31')]=utils[_0x30a9('0x23')]();channels[_0x1245d8[_0x30a9('0x6')]]['duration']=utils[_0x30a9('0x32')](channels[_0x1245d8[_0x30a9('0x6')]]['endtime'],channels[_0x1245d8[_0x30a9('0x6')]]['starttime']);channels[_0x1245d8['uniqueid']][_0x30a9('0x33')]=channels[_0x1245d8[_0x30a9('0x6')]][_0x30a9('0x29')]?utils['diffTime'](channels[_0x1245d8[_0x30a9('0x6')]]['endtime'],channels[_0x1245d8[_0x30a9('0x6')]][_0x30a9('0x29')]):0x0;writeDB(channels[_0x1245d8['uniqueid']]);}}catch(_0x110b7a){utils[_0x30a9('0x1e')](util[_0x30a9('0x9')](_0x30a9('0x2d'),_0x1245d8[_0x30a9('0x6')]),_0x110b7a);}};exports['attendedtransfer']=function(_0x140916){try{if(!_[_0x30a9('0x20')](channels[_0x140916['localtwolinkedid']])){utils[_0x30a9('0x17')](util[_0x30a9('0x9')](_0x30a9('0x34'),_0x140916[_0x30a9('0x35')]),_0x140916);if(channels[_0x140916[_0x30a9('0x36')]]['channel']==_0x140916['transfereechannel']){utils[_0x30a9('0x8')](util['format'](_0x30a9('0x37'),_0x140916[_0x30a9('0x35')],_0x140916[_0x30a9('0x36')],_0x140916[_0x30a9('0x38')]));channels[_0x140916[_0x30a9('0x36')]][_0x30a9('0x28')]=_0x140916[_0x30a9('0x38')];channels[_0x140916[_0x30a9('0x36')]][_0x30a9('0x39')]=_0x30a9('0x3a');}else if(channels[_0x140916[_0x30a9('0x36')]][_0x30a9('0xb')]=_0x140916[_0x30a9('0x3b')]){utils[_0x30a9('0x8')](util[_0x30a9('0x9')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x140916[_0x30a9('0x35')],_0x140916[_0x30a9('0x36')],_0x140916[_0x30a9('0x3c')]));channels[_0x140916['localtwolinkedid']][_0x30a9('0x28')]=_0x140916[_0x30a9('0x3c')];channels[_0x140916[_0x30a9('0x36')]][_0x30a9('0x39')]='_attended';}}}catch(_0x2ac6b9){utils[_0x30a9('0x1e')](util['format'](_0x30a9('0x34'),_0x140916[_0x30a9('0x35')]),_0x2ac6b9);}};exports[_0x30a9('0x3d')]=function(_0x18e0c4){try{if(!_[_0x30a9('0x20')](channels[_0x18e0c4['uniqueid']])){utils['debug'](util[_0x30a9('0x9')](_0x30a9('0x3e'),_0x18e0c4['uniqueid']),_0x18e0c4);channels[_0x18e0c4[_0x30a9('0x6')]]['musiconholdstartAt']=utils[_0x30a9('0x23')]();utils[_0x30a9('0x8')](util[_0x30a9('0x9')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x18e0c4['uniqueid'],channels[_0x18e0c4[_0x30a9('0x6')]][_0x30a9('0x3f')]));}}catch(_0x27b549){utils[_0x30a9('0x1e')](util[_0x30a9('0x9')](_0x30a9('0x3e'),_0x18e0c4[_0x30a9('0x6')]),_0x27b549);}};exports[_0x30a9('0x40')]=function(_0x562492){try{if(!_['isNil'](channels[_0x562492[_0x30a9('0x6')]])){utils['debug'](util[_0x30a9('0x9')]('[%s][calls][musiconholdstop]',_0x562492['uniqueid']),_0x562492);if(!_['isNil'](channels[_0x562492[_0x30a9('0x6')]][_0x30a9('0x3f')])){channels[_0x562492[_0x30a9('0x6')]][_0x30a9('0x41')]+=utils[_0x30a9('0x32')](utils['now'](),channels[_0x562492[_0x30a9('0x6')]][_0x30a9('0x3f')]);utils[_0x30a9('0x8')](util[_0x30a9('0x9')](_0x30a9('0x42'),_0x562492[_0x30a9('0x6')],channels[_0x562492[_0x30a9('0x6')]][_0x30a9('0x41')]));delete channels[_0x562492[_0x30a9('0x6')]][_0x30a9('0x3f')];}}}catch(_0x3f6537){utils['error'](util[_0x30a9('0x9')]('[%s][calls][musiconholdstop]',_0x562492[_0x30a9('0x6')]),_0x3f6537);}};exports[_0x30a9('0x43')]=function(_0x2c59f1){try{if(!_[_0x30a9('0x20')](channels[_0x2c59f1[_0x30a9('0x6')]])){utils['debug'](util[_0x30a9('0x9')](_0x30a9('0x44'),_0x2c59f1['uniqueid']),_0x2c59f1);if(!_[_0x30a9('0x20')](_0x2c59f1[_0x30a9('0x45')][_0x30a9('0x46')])){utils[_0x30a9('0x8')](util[_0x30a9('0x9')](_0x30a9('0x47'),_0x2c59f1[_0x30a9('0x6')],_0x2c59f1[_0x30a9('0x48')]));channels[_0x2c59f1[_0x30a9('0x6')]][_0x30a9('0x49')]=_0x2c59f1[_0x30a9('0x48')];}if(!_[_0x30a9('0x20')](_0x2c59f1['variable']['xmd-phone'])){utils['info'](util[_0x30a9('0x9')](_0x30a9('0x4a'),_0x2c59f1[_0x30a9('0x6')],_0x2c59f1[_0x30a9('0x48')]));channels[_0x2c59f1[_0x30a9('0x6')]][_0x30a9('0x4b')]=_0x2c59f1['value'];channels[_0x2c59f1['uniqueid']][_0x30a9('0x2e')]='\x22'+_0x2c59f1[_0x30a9('0x48')]+_0x30a9('0x4c')+_0x2c59f1[_0x30a9('0x48')]+'>';}if(!_[_0x30a9('0x20')](_0x2c59f1[_0x30a9('0x45')][_0x30a9('0x4d')])||!_[_0x30a9('0x20')](_0x2c59f1[_0x30a9('0x45')][_0x30a9('0x4e')])){utils[_0x30a9('0x8')](util[_0x30a9('0x9')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x2c59f1[_0x30a9('0x6')],!_[_0x30a9('0x20')](_0x2c59f1['variable'][_0x30a9('0x4d')])?_0x30a9('0x4d'):_0x30a9('0x4e'),_0x2c59f1[_0x30a9('0x48')]));channels[_0x2c59f1['uniqueid']][_0x30a9('0x2e')]=_0x2c59f1[_0x30a9('0x48')];}if(!_[_0x30a9('0x20')](_0x2c59f1['variable']['xmd-queue'])||!_[_0x30a9('0x20')](_0x2c59f1[_0x30a9('0x45')]['xmcs-queue'])){utils[_0x30a9('0x8')](util['format'](_0x30a9('0x4f'),_0x2c59f1[_0x30a9('0x6')],!_[_0x30a9('0x20')](_0x2c59f1[_0x30a9('0x45')][_0x30a9('0x50')])?'xmd-queue':_0x30a9('0x51'),_0x2c59f1[_0x30a9('0x48')]));channels[_0x2c59f1[_0x30a9('0x6')]][_0x30a9('0x52')]=_0x30a9('0x53');channels[_0x2c59f1[_0x30a9('0x6')]][_0x30a9('0x54')]=_0x2c59f1['value'];channels[_0x2c59f1[_0x30a9('0x6')]]['queue']=!![];}if(!_[_0x30a9('0x20')](_0x2c59f1['variable'][_0x30a9('0x55')])){utils[_0x30a9('0x8')](util['format'](_0x30a9('0x56'),_0x2c59f1[_0x30a9('0x6')],_0x2c59f1[_0x30a9('0x48')]));channels[_0x2c59f1['uniqueid']]['ContactId']=_0x2c59f1[_0x30a9('0x48')];}if(!_[_0x30a9('0x20')](_0x2c59f1['variable'][_0x30a9('0x57')])){utils[_0x30a9('0x8')](util['format'](_0x30a9('0x58'),_0x2c59f1[_0x30a9('0x6')],_0x2c59f1[_0x30a9('0x48')]));channels[_0x2c59f1[_0x30a9('0x6')]][_0x30a9('0x59')]=_0x2c59f1[_0x30a9('0x48')];}if(!_['isNil'](_0x2c59f1[_0x30a9('0x45')]['outboundrouteid'])){utils['info'](util[_0x30a9('0x9')](_0x30a9('0x5a'),_0x2c59f1[_0x30a9('0x6')],_0x2c59f1[_0x30a9('0x48')]));channels[_0x2c59f1[_0x30a9('0x6')]][_0x30a9('0x5b')]=_0x2c59f1[_0x30a9('0x48')];}if(!_[_0x30a9('0x20')](_0x2c59f1[_0x30a9('0x45')]['sipcallid'])){utils[_0x30a9('0x8')](util['format'](_0x30a9('0x5c'),_0x2c59f1['uniqueid'],_0x2c59f1['value']));channels[_0x2c59f1['uniqueid']][_0x30a9('0x5d')]=_0x2c59f1[_0x30a9('0x48')];}}}catch(_0x348f04){utils[_0x30a9('0x1e')](util['format'](_0x30a9('0x44'),_0x2c59f1['uniqueid']),_0x348f04);}};exports['newexten']=function(_0x233669){try{if(!_[_0x30a9('0x20')](channels[_0x233669[_0x30a9('0x6')]])){utils[_0x30a9('0x17')](util[_0x30a9('0x9')]('[%s][calls][newexten]',_0x233669[_0x30a9('0x6')]),_0x233669);utils[_0x30a9('0x8')](util[_0x30a9('0x9')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x233669[_0x30a9('0x6')],_0x233669[_0x30a9('0x5e')],_0x233669[_0x30a9('0x5f')]));if(_0x233669[_0x30a9('0x5e')][_0x30a9('0x60')]()==_0x30a9('0x61')&&_[_0x30a9('0x62')](_0x233669[_0x30a9('0x5f')][_0x30a9('0x60')](),_0x30a9('0x63'))){var _0x5ce48e=_0x233669[_0x30a9('0x5f')][_0x30a9('0x64')]('=');var _0x18409b=_0x5ce48e[0x0]['substring'](_0x5ce48e[0x0][_0x30a9('0x65')]('(')+0x1,_0x5ce48e[0x0][_0x30a9('0x65')](')'));var _0x487f14=_0x5ce48e[0x1];channels[_0x233669[_0x30a9('0x6')]][_0x18409b]=_0x487f14;}if(!_[_0x30a9('0x66')]([_0x30a9('0x2c'),'noop',_0x30a9('0x67'),_0x30a9('0x61'),_0x30a9('0x68')],_0x233669[_0x30a9('0x5e')][_0x30a9('0x60')]())){channels[_0x233669[_0x30a9('0x6')]][_0x30a9('0x52')]=_0x233669['application'];channels[_0x233669['uniqueid']]['lastdata']=_0x233669[_0x30a9('0x5f')];}}}catch(_0x4212ef){utils[_0x30a9('0x1e')](util[_0x30a9('0x9')](_0x30a9('0x69'),_0x233669['uniqueid']),_0x4212ef);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 63fca4f..9b8f821 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 _0xcd10=['error','[core]\x20error','close','[core]\x20close','managerevent','connect','info','[core]\x20connected','shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted'];(function(_0x270b31,_0x234254){var _0x396380=function(_0x48a7f9){while(--_0x48a7f9){_0x270b31['push'](_0x270b31['shift']());}};_0x396380(++_0x234254);}(_0xcd10,0x16d));var _0x0cd1=function(_0x91abe,_0x5cf926){_0x91abe=_0x91abe-0x0;var _0x373873=_0xcd10[_0x91abe];return _0x373873;};'use strict';var utils=require('./utils');exports[_0x0cd1('0x0')]=function(){utils[_0x0cd1('0x1')](_0x0cd1('0x2'));};exports[_0x0cd1('0x3')]=function(){utils[_0x0cd1('0x1')](_0x0cd1('0x4'));};exports[_0x0cd1('0x5')]=function(){utils[_0x0cd1('0x1')](_0x0cd1('0x6'));};exports['error']=function(_0x8ceaa0){utils[_0x0cd1('0x7')](_0x0cd1('0x8'),_0x8ceaa0);};exports[_0x0cd1('0x9')]=function(){utils[_0x0cd1('0x1')](_0x0cd1('0xa'));};exports[_0x0cd1('0xb')]=function(_0x6740b7){}; \ No newline at end of file +var _0x6497=['info','[core]\x20connected','[core]\x20shutdown','fullybooted','error','[core]\x20error','close','managerevent','./utils','connect'];(function(_0x2292a2,_0x1353ba){var _0x31e8a6=function(_0x353238){while(--_0x353238){_0x2292a2['push'](_0x2292a2['shift']());}};_0x31e8a6(++_0x1353ba);}(_0x6497,0x9e));var _0x7649=function(_0x398294,_0x5ceb9d){_0x398294=_0x398294-0x0;var _0x2a872d=_0x6497[_0x398294];return _0x2a872d;};'use strict';var utils=require(_0x7649('0x0'));exports[_0x7649('0x1')]=function(){utils[_0x7649('0x2')](_0x7649('0x3'));};exports['shutdown']=function(){utils['info'](_0x7649('0x4'));};exports[_0x7649('0x5')]=function(){utils[_0x7649('0x2')]('[core]\x20fullybooted');};exports['error']=function(_0x352020){utils[_0x7649('0x6')](_0x7649('0x7'),_0x352020);};exports[_0x7649('0x8')]=function(){utils['info']('[core]\x20close');};exports[_0x7649('0x9')]=function(_0x306471){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index a7175e4..425ffb1 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 _0xa1e9=['info','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','startsWith','appdata','error','varset','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','[%s][dials][dialbegin]','assign','starttime','now','lastevent','called','dialend','[%s][dials][dialend]','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','duration','diffTime','endtime','holdtime','billableseconds','lodash','util','./utils','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]'];(function(_0x32802a,_0x339b50){var _0x364b94=function(_0x3c3064){while(--_0x3c3064){_0x32802a['push'](_0x32802a['shift']());}};_0x364b94(++_0x339b50);}(_0xa1e9,0x117));var _0x9a1e=function(_0x475ace,_0x42d817){_0x475ace=_0x475ace-0x0;var _0xaa85a5=_0xa1e9[_0x475ace];return _0xaa85a5;};'use strict';var _=require(_0x9a1e('0x0'));var util=require(_0x9a1e('0x1'));var utils=require(_0x9a1e('0x2'));var dials={};function writeDB(_0xa5f418){utils['info'](util[_0x9a1e('0x3')](_0x9a1e('0x4'),_0xa5f418[_0x9a1e('0x5')],_0xa5f418[_0x9a1e('0x6')],_0xa5f418['dialstring'],_0xa5f418[_0x9a1e('0x7')],_0xa5f418[_0x9a1e('0x8')],_0xa5f418[_0x9a1e('0x9')]));utils[_0x9a1e('0xa')](_0x9a1e('0xb'),_0xa5f418);delete dials[_0xa5f418[_0x9a1e('0x5')]];}exports[_0x9a1e('0xc')]=function(_0xeec555){try{utils[_0x9a1e('0xd')](util[_0x9a1e('0x3')](_0x9a1e('0xe'),_0xeec555['uniqueid']),_0xeec555);utils[_0x9a1e('0xf')](util['format'](_0x9a1e('0x10'),_0xeec555['uniqueid'],_0xeec555[_0x9a1e('0x11')],_0xeec555['appdata']));if(_0xeec555[_0x9a1e('0x11')][_0x9a1e('0x12')]()=='set'&&_[_0x9a1e('0x13')](_0xeec555[_0x9a1e('0x14')][_0x9a1e('0x12')](),'cdr(routeid)')){var _0x1ebb06=_0xeec555['appdata']['split']('=');dials[_0xeec555[_0x9a1e('0x5')]]={'routeId':_0x1ebb06[0x1]};}}catch(_0x4d769b){utils[_0x9a1e('0x15')](util['format'](_0x9a1e('0xe'),_0xeec555[_0x9a1e('0x5')]),_0x4d769b);}};exports[_0x9a1e('0x16')]=function(_0x44d7ea){try{utils['debug'](util[_0x9a1e('0x3')]('[%s][dials][varset]',_0x44d7ea[_0x9a1e('0x5')]),_0x44d7ea);if(!_[_0x9a1e('0x17')](_0x44d7ea[_0x9a1e('0x18')][_0x9a1e('0x19')])){utils[_0x9a1e('0xf')](util['format'](_0x9a1e('0x1a'),_0x44d7ea[_0x9a1e('0x5')],_0x44d7ea[_0x9a1e('0x1b')]));dials[_0x44d7ea[_0x9a1e('0x5')]]={'routeId':_0x44d7ea[_0x9a1e('0x1b')]};}}catch(_0x297905){utils[_0x9a1e('0x15')](util['format']('[%s][dials][varset]',_0x44d7ea[_0x9a1e('0x5')]),_0x297905);}};exports['dialbegin']=function(_0x43ffde){try{if(!_[_0x9a1e('0x17')](dials[_0x43ffde[_0x9a1e('0x5')]])){utils[_0x9a1e('0xd')](util[_0x9a1e('0x3')](_0x9a1e('0x1c'),_0x43ffde[_0x9a1e('0x5')]),_0x43ffde);dials[_0x43ffde[_0x9a1e('0x5')]]=_[_0x9a1e('0x1d')](dials[_0x43ffde['uniqueid']],_0x43ffde);dials[_0x43ffde[_0x9a1e('0x5')]][_0x9a1e('0x1e')]=utils[_0x9a1e('0x1f')]();dials[_0x43ffde['uniqueid']][_0x9a1e('0x20')]=_0x9a1e('0x21');utils[_0x9a1e('0xf')](util[_0x9a1e('0x3')]('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x43ffde[_0x9a1e('0x5')],dials[_0x43ffde[_0x9a1e('0x5')]]['starttime']));}}catch(_0x2ab6f3){utils[_0x9a1e('0x15')](util[_0x9a1e('0x3')](_0x9a1e('0x1c'),_0x43ffde[_0x9a1e('0x5')]),_0x2ab6f3);}};exports[_0x9a1e('0x22')]=function(_0x5edbbc){try{if(!_[_0x9a1e('0x17')](dials[_0x5edbbc[_0x9a1e('0x5')]])){utils[_0x9a1e('0xd')](util[_0x9a1e('0x3')](_0x9a1e('0x23'),_0x5edbbc[_0x9a1e('0x5')]),_0x5edbbc);dials[_0x5edbbc[_0x9a1e('0x5')]][_0x9a1e('0x9')]=_0x5edbbc[_0x9a1e('0x9')];if(_0x5edbbc[_0x9a1e('0x9')]=='ANSWER'){dials[_0x5edbbc[_0x9a1e('0x5')]]=_[_0x9a1e('0x1d')](dials[_0x5edbbc[_0x9a1e('0x5')]],_0x5edbbc);dials[_0x5edbbc[_0x9a1e('0x5')]][_0x9a1e('0x24')]=utils['now']();dials[_0x5edbbc[_0x9a1e('0x5')]][_0x9a1e('0x20')]=_0x9a1e('0x25');utils[_0x9a1e('0xf')](util[_0x9a1e('0x3')]('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x5edbbc['uniqueid'],_0x5edbbc[_0x9a1e('0x9')],dials[_0x5edbbc[_0x9a1e('0x5')]]['answertime']));}else{utils[_0x9a1e('0xf')](util['format'](_0x9a1e('0x26'),_0x5edbbc[_0x9a1e('0x5')],_0x5edbbc[_0x9a1e('0x9')]));}}}catch(_0x30862e){utils[_0x9a1e('0x15')](util['format'](_0x9a1e('0x23'),_0x5edbbc[_0x9a1e('0x5')]),_0x30862e);}};exports[_0x9a1e('0x27')]=function(_0x454d23){try{if(!_['isNil'](dials[_0x454d23['uniqueid']])){utils['debug'](util['format'](_0x9a1e('0x28'),_0x454d23['uniqueid']),_0x454d23);utils[_0x9a1e('0xf')](util[_0x9a1e('0x3')](_0x9a1e('0x29'),_0x454d23[_0x9a1e('0x5')],_0x454d23[_0x9a1e('0x7')],_0x454d23[_0x9a1e('0x2a')],_0x454d23[_0x9a1e('0x2b')]));dials[_0x454d23[_0x9a1e('0x5')]]=_['assign'](dials[_0x454d23['uniqueid']],{'endtime':utils[_0x9a1e('0x1f')](),'lastevent':'complete'});dials[_0x454d23[_0x9a1e('0x5')]][_0x9a1e('0x2c')]=utils[_0x9a1e('0x2d')](dials[_0x454d23[_0x9a1e('0x5')]][_0x9a1e('0x2e')],dials[_0x454d23[_0x9a1e('0x5')]][_0x9a1e('0x1e')]);dials[_0x454d23['uniqueid']][_0x9a1e('0x2f')]=utils['diffTime'](dials[_0x454d23[_0x9a1e('0x5')]][_0x9a1e('0x24')]||dials[_0x454d23[_0x9a1e('0x5')]][_0x9a1e('0x2e')],dials[_0x454d23[_0x9a1e('0x5')]][_0x9a1e('0x1e')]);dials[_0x454d23[_0x9a1e('0x5')]][_0x9a1e('0x30')]=dials[_0x454d23[_0x9a1e('0x5')]][_0x9a1e('0x24')]?utils[_0x9a1e('0x2d')](dials[_0x454d23[_0x9a1e('0x5')]]['endtime'],dials[_0x454d23[_0x9a1e('0x5')]][_0x9a1e('0x24')]):0x0;writeDB(dials[_0x454d23['uniqueid']]);}}catch(_0x2c6dc0){utils[_0x9a1e('0x15')](util[_0x9a1e('0x3')](_0x9a1e('0x28'),_0x454d23[_0x9a1e('0x5')]),_0x2c6dc0);}}; \ No newline at end of file +var _0x68a0=['starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','ANSWER','assign','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','cause-txt','complete','duration','diffTime','endtime','holdtime','billableseconds','lodash','util','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','calleridnum','dialstatus','request','CreateVoiceDialReport','newexten','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','appdata','split','varset','debug','isNil','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','error','[%s][dials][varset]','dialbegin','[%s][dials][dialbegin]'];(function(_0x53de8a,_0x382f4e){var _0x57b1e4=function(_0x30e6a7){while(--_0x30e6a7){_0x53de8a['push'](_0x53de8a['shift']());}};_0x57b1e4(++_0x382f4e);}(_0x68a0,0x17b));var _0x068a=function(_0x4bda95,_0x3dd9b1){_0x4bda95=_0x4bda95-0x0;var _0x2dd15f=_0x68a0[_0x4bda95];return _0x2dd15f;};'use strict';var _=require(_0x068a('0x0'));var util=require(_0x068a('0x1'));var utils=require('./utils');var dials={};function writeDB(_0xf30689){utils[_0x068a('0x2')](util[_0x068a('0x3')](_0x068a('0x4'),_0xf30689[_0x068a('0x5')],_0xf30689[_0x068a('0x6')],_0xf30689['dialstring'],_0xf30689[_0x068a('0x7')],_0xf30689['connectedlinenum'],_0xf30689[_0x068a('0x8')]));utils[_0x068a('0x9')](_0x068a('0xa'),_0xf30689);delete dials[_0xf30689[_0x068a('0x5')]];}exports[_0x068a('0xb')]=function(_0x2fcc07){try{utils['debug'](util[_0x068a('0x3')](_0x068a('0xc'),_0x2fcc07[_0x068a('0x5')]),_0x2fcc07);utils['info'](util[_0x068a('0x3')](_0x068a('0xd'),_0x2fcc07['uniqueid'],_0x2fcc07[_0x068a('0xe')],_0x2fcc07['appdata']));if(_0x2fcc07[_0x068a('0xe')][_0x068a('0xf')]()==_0x068a('0x10')&&_['startsWith'](_0x2fcc07[_0x068a('0x11')][_0x068a('0xf')](),'cdr(routeid)')){var _0x15dd59=_0x2fcc07[_0x068a('0x11')][_0x068a('0x12')]('=');dials[_0x2fcc07[_0x068a('0x5')]]={'routeId':_0x15dd59[0x1]};}}catch(_0x2d3fbe){utils['error'](util[_0x068a('0x3')](_0x068a('0xc'),_0x2fcc07['uniqueid']),_0x2d3fbe);}};exports[_0x068a('0x13')]=function(_0x3d45fe){try{utils[_0x068a('0x14')](util[_0x068a('0x3')]('[%s][dials][varset]',_0x3d45fe[_0x068a('0x5')]),_0x3d45fe);if(!_[_0x068a('0x15')](_0x3d45fe['variable'][_0x068a('0x16')])){utils['info'](util[_0x068a('0x3')](_0x068a('0x17'),_0x3d45fe[_0x068a('0x5')],_0x3d45fe[_0x068a('0x18')]));dials[_0x3d45fe[_0x068a('0x5')]]={'routeId':_0x3d45fe[_0x068a('0x18')]};}}catch(_0x269c3f){utils[_0x068a('0x19')](util[_0x068a('0x3')](_0x068a('0x1a'),_0x3d45fe['uniqueid']),_0x269c3f);}};exports[_0x068a('0x1b')]=function(_0x488ce0){try{if(!_['isNil'](dials[_0x488ce0['uniqueid']])){utils[_0x068a('0x14')](util[_0x068a('0x3')](_0x068a('0x1c'),_0x488ce0['uniqueid']),_0x488ce0);dials[_0x488ce0[_0x068a('0x5')]]=_['assign'](dials[_0x488ce0[_0x068a('0x5')]],_0x488ce0);dials[_0x488ce0[_0x068a('0x5')]][_0x068a('0x1d')]=utils[_0x068a('0x1e')]();dials[_0x488ce0[_0x068a('0x5')]][_0x068a('0x1f')]=_0x068a('0x20');utils[_0x068a('0x2')](util[_0x068a('0x3')](_0x068a('0x21'),_0x488ce0[_0x068a('0x5')],dials[_0x488ce0[_0x068a('0x5')]][_0x068a('0x1d')]));}}catch(_0x5e3308){utils['error'](util['format'](_0x068a('0x1c'),_0x488ce0[_0x068a('0x5')]),_0x5e3308);}};exports[_0x068a('0x22')]=function(_0x3f20f7){try{if(!_[_0x068a('0x15')](dials[_0x3f20f7['uniqueid']])){utils[_0x068a('0x14')](util['format'](_0x068a('0x23'),_0x3f20f7[_0x068a('0x5')]),_0x3f20f7);dials[_0x3f20f7[_0x068a('0x5')]]['dialstatus']=_0x3f20f7['dialstatus'];if(_0x3f20f7['dialstatus']==_0x068a('0x24')){dials[_0x3f20f7[_0x068a('0x5')]]=_[_0x068a('0x25')](dials[_0x3f20f7[_0x068a('0x5')]],_0x3f20f7);dials[_0x3f20f7['uniqueid']][_0x068a('0x26')]=utils[_0x068a('0x1e')]();dials[_0x3f20f7['uniqueid']][_0x068a('0x1f')]=_0x068a('0x27');utils['info'](util['format'](_0x068a('0x28'),_0x3f20f7['uniqueid'],_0x3f20f7[_0x068a('0x8')],dials[_0x3f20f7['uniqueid']][_0x068a('0x26')]));}else{utils[_0x068a('0x2')](util[_0x068a('0x3')](_0x068a('0x29'),_0x3f20f7[_0x068a('0x5')],_0x3f20f7[_0x068a('0x8')]));}}}catch(_0x2e2e4b){utils['error'](util[_0x068a('0x3')](_0x068a('0x23'),_0x3f20f7['uniqueid']),_0x2e2e4b);}};exports[_0x068a('0x2a')]=function(_0x59254a){try{if(!_[_0x068a('0x15')](dials[_0x59254a[_0x068a('0x5')]])){utils[_0x068a('0x14')](util[_0x068a('0x3')](_0x068a('0x2b'),_0x59254a['uniqueid']),_0x59254a);utils[_0x068a('0x2')](util[_0x068a('0x3')]('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x59254a[_0x068a('0x5')],_0x59254a[_0x068a('0x7')],_0x59254a['calleridname'],_0x59254a[_0x068a('0x2c')]));dials[_0x59254a[_0x068a('0x5')]]=_[_0x068a('0x25')](dials[_0x59254a[_0x068a('0x5')]],{'endtime':utils[_0x068a('0x1e')](),'lastevent':_0x068a('0x2d')});dials[_0x59254a[_0x068a('0x5')]][_0x068a('0x2e')]=utils[_0x068a('0x2f')](dials[_0x59254a[_0x068a('0x5')]][_0x068a('0x30')],dials[_0x59254a['uniqueid']][_0x068a('0x1d')]);dials[_0x59254a[_0x068a('0x5')]][_0x068a('0x31')]=utils[_0x068a('0x2f')](dials[_0x59254a['uniqueid']][_0x068a('0x26')]||dials[_0x59254a[_0x068a('0x5')]][_0x068a('0x30')],dials[_0x59254a[_0x068a('0x5')]][_0x068a('0x1d')]);dials[_0x59254a['uniqueid']][_0x068a('0x32')]=dials[_0x59254a[_0x068a('0x5')]][_0x068a('0x26')]?utils['diffTime'](dials[_0x59254a[_0x068a('0x5')]][_0x068a('0x30')],dials[_0x59254a[_0x068a('0x5')]][_0x068a('0x26')]):0x0;writeDB(dials[_0x59254a[_0x068a('0x5')]]);}}catch(_0xa12fc0){utils[_0x068a('0x19')](util[_0x068a('0x3')]('[%s][dials][hangup]',_0x59254a[_0x068a('0x5')]),_0xa12fc0);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 2607759..ab0febd 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 _0xf711=['[%s][index][dialend]','../../config/environment','./utils','xdr','disabled','env','asterisk','username','password','XDR\x20DISABLED','info','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','debug','[%s][index][devicestatechange]','device','devicestatechange','format','[%s][index][agentcalled]','uniqueid','agentcalled','[%s][index][agentringnoanswer]','agentringnoanswer','agentconnect','[%s][index][agentconnect]','[%s][index][agentcomplete]','agentcomplete','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','[%s][index][musiconholdstart]','musiconholdstart','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','newchannel','dialbegin','[%s]dialbegin','dialend'];(function(_0x5a71d4,_0xe52ffa){var _0x5b4072=function(_0x347e18){while(--_0x347e18){_0x5a71d4['push'](_0x5a71d4['shift']());}};_0x5b4072(++_0xe52ffa);}(_0xf711,0x111));var _0x1f71=function(_0x5b2b74,_0x3b7d11){_0x5b2b74=_0x5b2b74-0x0;var _0x402920=_0xf711[_0x5b2b74];return _0x402920;};var AsteriskManager=require('asterisk-manager');var config=require(_0x1f71('0x0'));var utils=require(_0x1f71('0x1'));var util=require('util');var isXDREnabled=config[_0x1f71('0x2')]&&config['xdr'][_0x1f71('0x3')]?!config['xdr']['disabled']:!![];var isProduction=config[_0x1f71('0x4')]==='production'||![];var isLocalAsterisk=config[_0x1f71('0x2')]&&config[_0x1f71('0x2')]['local']===!![]||![];var ami=new AsteriskManager(config[_0x1f71('0x5')]['port'],config[_0x1f71('0x5')]['ip'],config[_0x1f71('0x5')][_0x1f71('0x6')],config[_0x1f71('0x5')][_0x1f71('0x7')],!![]);ami['keepConnected']();if(!isXDREnabled){utils['info'](_0x1f71('0x8'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x1f71('0x9')](_0x1f71('0xa'));}else{var agents=require(_0x1f71('0xb'));var calls=require(_0x1f71('0xc'));var queues=require(_0x1f71('0xd'));var recordings=require(_0x1f71('0xe'));var members=require(_0x1f71('0xf'));var dials=require(_0x1f71('0x10'));var transfers=require(_0x1f71('0x11'));var core=require(_0x1f71('0x12'));ami['on']('connect',core[_0x1f71('0x13')]);ami['on'](_0x1f71('0x14'),core['shutdown']);ami['on'](_0x1f71('0x15'),core[_0x1f71('0x15')]);ami['on'](_0x1f71('0x16'),core[_0x1f71('0x16')]);ami['on'](_0x1f71('0x17'),core['close']);ami['on'](_0x1f71('0x18'),core[_0x1f71('0x18')]);ami['on']('devicestatechange',function(_0x5e5c13){try{utils[_0x1f71('0x19')](util['format'](_0x1f71('0x1a'),_0x5e5c13[_0x1f71('0x1b')]),_0x5e5c13);members[_0x1f71('0x1c')](_0x5e5c13);}catch(_0x2865a2){utils[_0x1f71('0x16')](util[_0x1f71('0x1d')](_0x1f71('0x1a'),_0x5e5c13[_0x1f71('0x1b')]),_0x2865a2);}});ami['on']('agentcalled',function(_0x207c8f){try{utils[_0x1f71('0x19')](util[_0x1f71('0x1d')](_0x1f71('0x1e'),_0x207c8f[_0x1f71('0x1f')]),_0x207c8f);agents[_0x1f71('0x20')](_0x207c8f);}catch(_0xad1ee0){utils[_0x1f71('0x16')](util[_0x1f71('0x1d')](_0x1f71('0x1e'),_0x207c8f[_0x1f71('0x1f')]),_0xad1ee0);}});ami['on']('agentringnoanswer',function(_0x225889){try{utils[_0x1f71('0x19')](util[_0x1f71('0x1d')](_0x1f71('0x21'),_0x225889['uniqueid']),_0x225889);agents[_0x1f71('0x22')](_0x225889);}catch(_0x4dcbfd){utils[_0x1f71('0x16')](util[_0x1f71('0x1d')](_0x1f71('0x21'),_0x225889[_0x1f71('0x1f')]),_0x4dcbfd);}});ami['on'](_0x1f71('0x23'),function(_0x19913d){try{utils[_0x1f71('0x19')](util[_0x1f71('0x1d')](_0x1f71('0x24'),_0x19913d[_0x1f71('0x1f')]),_0x19913d);agents[_0x1f71('0x23')](_0x19913d);queues['agentconnect'](_0x19913d);}catch(_0x50e845){utils['error'](util[_0x1f71('0x1d')](_0x1f71('0x24'),_0x19913d[_0x1f71('0x1f')]),_0x50e845);}});ami['on']('agentcomplete',function(_0x58f357){try{utils['debug'](util[_0x1f71('0x1d')](_0x1f71('0x25'),_0x58f357[_0x1f71('0x1f')]),_0x58f357);agents[_0x1f71('0x26')](_0x58f357);queues[_0x1f71('0x26')](_0x58f357);members[_0x1f71('0x26')](_0x58f357);}catch(_0x360bbb){utils[_0x1f71('0x16')](util['format'](_0x1f71('0x25'),_0x58f357['uniqueid']),_0x360bbb);}});ami['on'](_0x1f71('0x27'),function(_0x2a875b){try{utils[_0x1f71('0x19')](util[_0x1f71('0x1d')]('[%s][index][queuecallerabandon]',_0x2a875b['uniqueid']),_0x2a875b);agents['queuecallerabandon'](_0x2a875b);queues[_0x1f71('0x27')](_0x2a875b);}catch(_0x37d89d){utils[_0x1f71('0x16')](util[_0x1f71('0x1d')](_0x1f71('0x28'),_0x2a875b[_0x1f71('0x1f')]),_0x37d89d);}});ami['on'](_0x1f71('0x29'),function(_0x247beb){try{utils[_0x1f71('0x19')](util[_0x1f71('0x1d')]('[%s][index][queuecallerjoin]',_0x247beb[_0x1f71('0x1f')]),_0x247beb);queues[_0x1f71('0x29')](_0x247beb);recordings['queuecallerjoin'](_0x247beb);}catch(_0x4ff6db){utils[_0x1f71('0x16')](util[_0x1f71('0x1d')](_0x1f71('0x2a'),_0x247beb['uniqueid']),_0x4ff6db);}});ami['on'](_0x1f71('0x2b'),function(_0x2ddb59){try{utils['debug'](util[_0x1f71('0x1d')]('[%s][index][queuecallerleave]',_0x2ddb59[_0x1f71('0x1f')]),_0x2ddb59);queues['queuecallerleave'](_0x2ddb59);}catch(_0x34a364){utils[_0x1f71('0x16')](util['format'](_0x1f71('0x2c'),_0x2ddb59[_0x1f71('0x1f')]),_0x34a364);}});ami['on']('musiconholdstart',function(_0x585741){try{utils[_0x1f71('0x19')](util[_0x1f71('0x1d')](_0x1f71('0x2d'),_0x585741['uniqueid']),_0x585741);queues['musiconholdstart'](_0x585741);calls[_0x1f71('0x2e')](_0x585741);}catch(_0x2ce86a){utils[_0x1f71('0x16')](util['format'](_0x1f71('0x2d'),_0x585741[_0x1f71('0x1f')]),_0x2ce86a);}});ami['on'](_0x1f71('0x2f'),function(_0x2c301a){try{utils[_0x1f71('0x19')](util[_0x1f71('0x1d')](_0x1f71('0x30'),_0x2c301a[_0x1f71('0x1f')]),_0x2c301a);queues[_0x1f71('0x2f')](_0x2c301a);calls['musiconholdstop'](_0x2c301a);}catch(_0x4989c8){utils[_0x1f71('0x16')](util[_0x1f71('0x1d')](_0x1f71('0x30'),_0x2c301a[_0x1f71('0x1f')]),_0x4989c8);}});ami['on'](_0x1f71('0x31'),function(_0x95dc7c){try{utils[_0x1f71('0x19')](util['format']('[%s][index][newstate]',_0x95dc7c[_0x1f71('0x1f')]),_0x95dc7c);calls['newstate'](_0x95dc7c);recordings[_0x1f71('0x31')](_0x95dc7c);}catch(_0x1a9242){utils[_0x1f71('0x16')](util[_0x1f71('0x1d')](_0x1f71('0x32'),_0x95dc7c['uniqueid']),_0x1a9242);}});ami['on'](_0x1f71('0x33'),function(_0x119855){try{utils['debug'](util[_0x1f71('0x1d')](_0x1f71('0x34'),_0x119855[_0x1f71('0x1f')]),_0x119855);calls[_0x1f71('0x33')](_0x119855);recordings[_0x1f71('0x33')](_0x119855);dials[_0x1f71('0x33')](_0x119855);agents[_0x1f71('0x33')](_0x119855);queues[_0x1f71('0x33')](_0x119855);}catch(_0x294cd7){utils[_0x1f71('0x16')](util['format']('[%s][index][hangup]',_0x119855[_0x1f71('0x1f')]),_0x294cd7);}});ami['on'](_0x1f71('0x35'),function(_0x3c02e5){try{utils[_0x1f71('0x19')](util['format']('[%s][index][cdr]',_0x3c02e5['uniqueid']),_0x3c02e5);members[_0x1f71('0x35')](_0x3c02e5);}catch(_0x5ba0e5){utils['error'](util[_0x1f71('0x1d')](_0x1f71('0x36'),_0x3c02e5['uniqueid']),_0x5ba0e5);}});ami['on'](_0x1f71('0x37'),function(_0x3019ee){try{utils[_0x1f71('0x19')](util[_0x1f71('0x1d')](_0x1f71('0x38'),_0x3019ee['uniqueid']),_0x3019ee);queues[_0x1f71('0x37')](_0x3019ee);agents[_0x1f71('0x37')](_0x3019ee);transfers[_0x1f71('0x37')](_0x3019ee);recordings[_0x1f71('0x37')](_0x3019ee);}catch(_0x1e75a8){utils[_0x1f71('0x16')](util[_0x1f71('0x1d')](_0x1f71('0x38'),_0x3019ee['uniqueid']),_0x1e75a8);}});ami['on'](_0x1f71('0x39'),function(_0xbeb554){try{utils[_0x1f71('0x19')](util[_0x1f71('0x1d')](_0x1f71('0x3a'),_0xbeb554[_0x1f71('0x3b')]),_0xbeb554);queues[_0x1f71('0x39')](_0xbeb554);transfers['attendedtransfer'](_0xbeb554);agents[_0x1f71('0x39')](_0xbeb554);calls[_0x1f71('0x39')](_0xbeb554);}catch(_0x8ed0c4){utils['error'](util[_0x1f71('0x1d')]('[%s][index][attendedtransfer]',_0xbeb554[_0x1f71('0x3b')]),_0x8ed0c4);}});ami['on'](_0x1f71('0x3c'),function(_0x5d8af6){try{utils[_0x1f71('0x19')](util['format']('[%s][index][varset]',_0x5d8af6[_0x1f71('0x1f')]),_0x5d8af6);queues[_0x1f71('0x3c')](_0x5d8af6);recordings['varset'](_0x5d8af6);calls[_0x1f71('0x3c')](_0x5d8af6);dials[_0x1f71('0x3c')](_0x5d8af6);}catch(_0x12e425){utils[_0x1f71('0x16')](util[_0x1f71('0x1d')](_0x1f71('0x3d'),_0x5d8af6[_0x1f71('0x1f')]),_0x12e425);}});ami['on'](_0x1f71('0x3e'),function(_0x191420){try{utils[_0x1f71('0x19')](util[_0x1f71('0x1d')]('[%s][index][newexten]',_0x191420['uniqueid']),_0x191420);calls[_0x1f71('0x3e')](_0x191420);recordings[_0x1f71('0x3e')](_0x191420);dials[_0x1f71('0x3e')](_0x191420);}catch(_0x501390){utils[_0x1f71('0x16')](util[_0x1f71('0x1d')]('[%s][index][newexten]',_0x191420[_0x1f71('0x1f')]),_0x501390);}});ami['on'](_0x1f71('0x3f'),function(_0x558835){try{utils['debug'](util[_0x1f71('0x1d')]('[%s][index][newchannel]',_0x558835['uniqueid']),_0x558835);calls['newchannel'](_0x558835);recordings[_0x1f71('0x3f')](_0x558835);}catch(_0x408c08){utils['error'](util[_0x1f71('0x1d')]('[%s][index][newchannel]',_0x558835['uniqueid']),_0x408c08);}});ami['on']('dialbegin',function(_0x27937c){try{utils[_0x1f71('0x19')](util[_0x1f71('0x1d')]('[%s][index][dialbegin]',_0x27937c[_0x1f71('0x1f')]),_0x27937c);dials[_0x1f71('0x40')](_0x27937c);}catch(_0x23d2fd){utils[_0x1f71('0x16')](util[_0x1f71('0x1d')](_0x1f71('0x41'),_0x27937c['uniqueid']),_0x23d2fd);}});ami['on'](_0x1f71('0x42'),function(_0x1b8ec8){try{utils[_0x1f71('0x19')](util[_0x1f71('0x1d')](_0x1f71('0x43'),_0x1b8ec8[_0x1f71('0x1f')]),_0x1b8ec8);dials[_0x1f71('0x42')](_0x1b8ec8);}catch(_0x31d082){utils[_0x1f71('0x16')](util[_0x1f71('0x1d')](_0x1f71('0x43'),_0x1b8ec8['uniqueid']),_0x31d082);}});} \ No newline at end of file +var _0x37ed=['[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][newstate]','newstate','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','[%s][index][dialend]','dialend','asterisk-manager','util','xdr','env','local','asterisk','username','password','keepConnected','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./calls.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','agentcalled'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0x37ed,0xf3));var _0xd37e=function(_0x3dc7dd,_0x45cd61){_0x3dc7dd=_0x3dc7dd-0x0;var _0x40bbfa=_0x37ed[_0x3dc7dd];return _0x40bbfa;};var AsteriskManager=require(_0xd37e('0x0'));var config=require('../../config/environment');var utils=require('./utils');var util=require(_0xd37e('0x1'));var isXDREnabled=config['xdr']&&config[_0xd37e('0x2')]['disabled']?!config[_0xd37e('0x2')]['disabled']:!![];var isProduction=config[_0xd37e('0x3')]==='production'||![];var isLocalAsterisk=config[_0xd37e('0x2')]&&config['xdr'][_0xd37e('0x4')]===!![]||![];var ami=new AsteriskManager(config[_0xd37e('0x5')]['port'],config[_0xd37e('0x5')]['ip'],config[_0xd37e('0x5')][_0xd37e('0x6')],config[_0xd37e('0x5')][_0xd37e('0x7')],!![]);ami[_0xd37e('0x8')]();if(!isXDREnabled){utils[_0xd37e('0x9')](_0xd37e('0xa'));}else if(!isProduction&&!isLocalAsterisk){utils[_0xd37e('0x9')](_0xd37e('0xb'));}else{var agents=require('./agents.controller');var calls=require(_0xd37e('0xc'));var queues=require('./queues.controller');var recordings=require(_0xd37e('0xd'));var members=require(_0xd37e('0xe'));var dials=require(_0xd37e('0xf'));var transfers=require(_0xd37e('0x10'));var core=require(_0xd37e('0x11'));ami['on'](_0xd37e('0x12'),core[_0xd37e('0x12')]);ami['on'](_0xd37e('0x13'),core[_0xd37e('0x13')]);ami['on'](_0xd37e('0x14'),core[_0xd37e('0x14')]);ami['on'](_0xd37e('0x15'),core[_0xd37e('0x15')]);ami['on'](_0xd37e('0x16'),core[_0xd37e('0x16')]);ami['on'](_0xd37e('0x17'),core[_0xd37e('0x17')]);ami['on'](_0xd37e('0x18'),function(_0x55a682){try{utils[_0xd37e('0x19')](util[_0xd37e('0x1a')](_0xd37e('0x1b'),_0x55a682['device']),_0x55a682);members[_0xd37e('0x18')](_0x55a682);}catch(_0x204c34){utils[_0xd37e('0x15')](util[_0xd37e('0x1a')]('[%s][index][devicestatechange]',_0x55a682['device']),_0x204c34);}});ami['on'](_0xd37e('0x1c'),function(_0x3bbc6c){try{utils[_0xd37e('0x19')](util[_0xd37e('0x1a')](_0xd37e('0x1d'),_0x3bbc6c[_0xd37e('0x1e')]),_0x3bbc6c);agents['agentcalled'](_0x3bbc6c);}catch(_0x2d6541){utils['error'](util['format'](_0xd37e('0x1d'),_0x3bbc6c[_0xd37e('0x1e')]),_0x2d6541);}});ami['on'](_0xd37e('0x1f'),function(_0x43e967){try{utils[_0xd37e('0x19')](util[_0xd37e('0x1a')](_0xd37e('0x20'),_0x43e967['uniqueid']),_0x43e967);agents[_0xd37e('0x1f')](_0x43e967);}catch(_0x14d78c){utils[_0xd37e('0x15')](util['format'](_0xd37e('0x20'),_0x43e967[_0xd37e('0x1e')]),_0x14d78c);}});ami['on'](_0xd37e('0x21'),function(_0x23bf44){try{utils['debug'](util['format'](_0xd37e('0x22'),_0x23bf44[_0xd37e('0x1e')]),_0x23bf44);agents[_0xd37e('0x21')](_0x23bf44);queues['agentconnect'](_0x23bf44);}catch(_0x530231){utils['error'](util[_0xd37e('0x1a')](_0xd37e('0x22'),_0x23bf44[_0xd37e('0x1e')]),_0x530231);}});ami['on'](_0xd37e('0x23'),function(_0x1fdf14){try{utils['debug'](util['format'](_0xd37e('0x24'),_0x1fdf14[_0xd37e('0x1e')]),_0x1fdf14);agents['agentcomplete'](_0x1fdf14);queues[_0xd37e('0x23')](_0x1fdf14);members[_0xd37e('0x23')](_0x1fdf14);}catch(_0x51adf0){utils['error'](util[_0xd37e('0x1a')](_0xd37e('0x24'),_0x1fdf14[_0xd37e('0x1e')]),_0x51adf0);}});ami['on'](_0xd37e('0x25'),function(_0x141e37){try{utils[_0xd37e('0x19')](util['format'](_0xd37e('0x26'),_0x141e37[_0xd37e('0x1e')]),_0x141e37);agents[_0xd37e('0x25')](_0x141e37);queues[_0xd37e('0x25')](_0x141e37);}catch(_0x2c6d16){utils[_0xd37e('0x15')](util[_0xd37e('0x1a')](_0xd37e('0x26'),_0x141e37[_0xd37e('0x1e')]),_0x2c6d16);}});ami['on'](_0xd37e('0x27'),function(_0x5ede85){try{utils[_0xd37e('0x19')](util[_0xd37e('0x1a')](_0xd37e('0x28'),_0x5ede85[_0xd37e('0x1e')]),_0x5ede85);queues[_0xd37e('0x27')](_0x5ede85);recordings[_0xd37e('0x27')](_0x5ede85);}catch(_0x5bfbb1){utils[_0xd37e('0x15')](util[_0xd37e('0x1a')](_0xd37e('0x28'),_0x5ede85['uniqueid']),_0x5bfbb1);}});ami['on']('queuecallerleave',function(_0x551259){try{utils['debug'](util[_0xd37e('0x1a')]('[%s][index][queuecallerleave]',_0x551259['uniqueid']),_0x551259);queues[_0xd37e('0x29')](_0x551259);}catch(_0x462d6f){utils[_0xd37e('0x15')](util['format'](_0xd37e('0x2a'),_0x551259[_0xd37e('0x1e')]),_0x462d6f);}});ami['on'](_0xd37e('0x2b'),function(_0x3b2852){try{utils[_0xd37e('0x19')](util[_0xd37e('0x1a')]('[%s][index][musiconholdstart]',_0x3b2852[_0xd37e('0x1e')]),_0x3b2852);queues[_0xd37e('0x2b')](_0x3b2852);calls[_0xd37e('0x2b')](_0x3b2852);}catch(_0x1a8c31){utils[_0xd37e('0x15')](util[_0xd37e('0x1a')](_0xd37e('0x2c'),_0x3b2852[_0xd37e('0x1e')]),_0x1a8c31);}});ami['on'](_0xd37e('0x2d'),function(_0x5670e9){try{utils[_0xd37e('0x19')](util['format']('[%s][index][musiconholdstop]',_0x5670e9[_0xd37e('0x1e')]),_0x5670e9);queues['musiconholdstop'](_0x5670e9);calls['musiconholdstop'](_0x5670e9);}catch(_0x389680){utils['error'](util[_0xd37e('0x1a')]('[%s][index][musiconholdstop]',_0x5670e9['uniqueid']),_0x389680);}});ami['on']('newstate',function(_0x33797a){try{utils[_0xd37e('0x19')](util[_0xd37e('0x1a')](_0xd37e('0x2e'),_0x33797a[_0xd37e('0x1e')]),_0x33797a);calls[_0xd37e('0x2f')](_0x33797a);recordings[_0xd37e('0x2f')](_0x33797a);}catch(_0x16f43b){utils[_0xd37e('0x15')](util[_0xd37e('0x1a')](_0xd37e('0x2e'),_0x33797a[_0xd37e('0x1e')]),_0x16f43b);}});ami['on'](_0xd37e('0x30'),function(_0x33de3e){try{utils['debug'](util[_0xd37e('0x1a')](_0xd37e('0x31'),_0x33de3e[_0xd37e('0x1e')]),_0x33de3e);calls[_0xd37e('0x30')](_0x33de3e);recordings['hangup'](_0x33de3e);dials[_0xd37e('0x30')](_0x33de3e);agents['hangup'](_0x33de3e);queues['hangup'](_0x33de3e);}catch(_0x5abb7a){utils[_0xd37e('0x15')](util[_0xd37e('0x1a')](_0xd37e('0x31'),_0x33de3e[_0xd37e('0x1e')]),_0x5abb7a);}});ami['on'](_0xd37e('0x32'),function(_0x113498){try{utils[_0xd37e('0x19')](util['format']('[%s][index][cdr]',_0x113498[_0xd37e('0x1e')]),_0x113498);members['cdr'](_0x113498);}catch(_0x109450){utils[_0xd37e('0x15')](util[_0xd37e('0x1a')](_0xd37e('0x33'),_0x113498[_0xd37e('0x1e')]),_0x109450);}});ami['on'](_0xd37e('0x34'),function(_0x457c4f){try{utils['debug'](util['format'](_0xd37e('0x35'),_0x457c4f['uniqueid']),_0x457c4f);queues[_0xd37e('0x34')](_0x457c4f);agents['blindtransfer'](_0x457c4f);transfers['blindtransfer'](_0x457c4f);recordings[_0xd37e('0x34')](_0x457c4f);}catch(_0x2c8ce6){utils['error'](util[_0xd37e('0x1a')]('[%s][index][blindtransfer]',_0x457c4f['uniqueid']),_0x2c8ce6);}});ami['on'](_0xd37e('0x36'),function(_0x16649e){try{utils[_0xd37e('0x19')](util[_0xd37e('0x1a')](_0xd37e('0x37'),_0x16649e['origtransfereruniqueid']),_0x16649e);queues[_0xd37e('0x36')](_0x16649e);transfers['attendedtransfer'](_0x16649e);agents[_0xd37e('0x36')](_0x16649e);calls[_0xd37e('0x36')](_0x16649e);}catch(_0x48383d){utils[_0xd37e('0x15')](util[_0xd37e('0x1a')]('[%s][index][attendedtransfer]',_0x16649e[_0xd37e('0x38')]),_0x48383d);}});ami['on'](_0xd37e('0x39'),function(_0x380188){try{utils[_0xd37e('0x19')](util[_0xd37e('0x1a')]('[%s][index][varset]',_0x380188[_0xd37e('0x1e')]),_0x380188);queues[_0xd37e('0x39')](_0x380188);recordings['varset'](_0x380188);calls[_0xd37e('0x39')](_0x380188);dials[_0xd37e('0x39')](_0x380188);}catch(_0x23a704){utils[_0xd37e('0x15')](util[_0xd37e('0x1a')](_0xd37e('0x3a'),_0x380188[_0xd37e('0x1e')]),_0x23a704);}});ami['on'](_0xd37e('0x3b'),function(_0x3ead3d){try{utils[_0xd37e('0x19')](util[_0xd37e('0x1a')](_0xd37e('0x3c'),_0x3ead3d[_0xd37e('0x1e')]),_0x3ead3d);calls[_0xd37e('0x3b')](_0x3ead3d);recordings[_0xd37e('0x3b')](_0x3ead3d);dials[_0xd37e('0x3b')](_0x3ead3d);}catch(_0xe31f68){utils[_0xd37e('0x15')](util[_0xd37e('0x1a')](_0xd37e('0x3c'),_0x3ead3d['uniqueid']),_0xe31f68);}});ami['on'](_0xd37e('0x3d'),function(_0x3dd5e4){try{utils[_0xd37e('0x19')](util[_0xd37e('0x1a')](_0xd37e('0x3e'),_0x3dd5e4[_0xd37e('0x1e')]),_0x3dd5e4);calls['newchannel'](_0x3dd5e4);recordings[_0xd37e('0x3d')](_0x3dd5e4);}catch(_0x3c230b){utils['error'](util['format']('[%s][index][newchannel]',_0x3dd5e4[_0xd37e('0x1e')]),_0x3c230b);}});ami['on'](_0xd37e('0x3f'),function(_0x2daf1b){try{utils[_0xd37e('0x19')](util[_0xd37e('0x1a')](_0xd37e('0x40'),_0x2daf1b[_0xd37e('0x1e')]),_0x2daf1b);dials[_0xd37e('0x3f')](_0x2daf1b);}catch(_0xd0cbb9){utils[_0xd37e('0x15')](util[_0xd37e('0x1a')](_0xd37e('0x41'),_0x2daf1b[_0xd37e('0x1e')]),_0xd0cbb9);}});ami['on']('dialend',function(_0x57a60c){try{utils[_0xd37e('0x19')](util['format'](_0xd37e('0x42'),_0x57a60c[_0xd37e('0x1e')]),_0x57a60c);dials[_0xd37e('0x43')](_0x57a60c);}catch(_0x4862c1){utils[_0xd37e('0x15')](util[_0xd37e('0x1a')]('[%s][index][dialend]',_0x57a60c['uniqueid']),_0x4862c1);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 82dc9f0..7848bbb 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 _0x5304=['NOT_INUSE','isNil','exitAt','duration','diffTime','enterAt','[%s][members][devicestatechange]','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','cdr','[%s][members][cdr]','split','assign','data1','type','data2','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','lodash','util','info','format','uniqueid','channel','membername','interface','getUserByInterface','then','name','internal','request','CreateMemberReport','catch','error','startsWith','devicestatechange','debug','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','BUSY','voice','now','agent'];(function(_0x4debec,_0x51302d){var _0x257a33=function(_0x26483d){while(--_0x26483d){_0x4debec['push'](_0x4debec['shift']());}};_0x257a33(++_0x51302d);}(_0x5304,0x167));var _0x4530=function(_0x2c1e7a,_0x155f86){_0x2c1e7a=_0x2c1e7a-0x0;var _0xcacb4f=_0x5304[_0x2c1e7a];return _0xcacb4f;};'use strict';var _=require(_0x4530('0x0'));var util=require(_0x4530('0x1'));var utils=require('./utils');var members={};var exclude=['Local/_attended@transfer','Queue:'];function writeDB(_0x719e6b){utils[_0x4530('0x2')](util[_0x4530('0x3')]('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x719e6b[_0x4530('0x4')],_0x719e6b['interface'],_0x719e6b[_0x4530('0x5')],_0x719e6b['data2'],_0x719e6b[_0x4530('0x6')],_0x719e6b['type']));if(_0x719e6b[_0x4530('0x7')]){utils[_0x4530('0x8')](_0x719e6b[_0x4530('0x7')])[_0x4530('0x9')](function(_0x230db3){if(_0x230db3){_0x719e6b['membername']=_0x230db3[_0x4530('0xa')];_0x719e6b[_0x4530('0xb')]=_0x230db3[_0x4530('0xb')];utils['request']('CreateMemberReport',_0x719e6b);}else{utils['getUserByName'](_0x719e6b['interface']['split']('/')[0x1])['then'](function(_0x485c63){if(_0x485c63){_0x719e6b['membername']=_0x485c63[_0x4530('0xa')];_0x719e6b[_0x4530('0xb')]=_0x485c63[_0x4530('0xb')];utils[_0x4530('0xc')](_0x4530('0xd'),_0x719e6b);}});}})[_0x4530('0xe')](function(_0x20a07f){utils[_0x4530('0xf')](util[_0x4530('0x3')]('[%s][members][writeDB]',_0x719e6b[_0x4530('0x4')]),_0x20a07f);});}delete members[_0x719e6b[_0x4530('0x7')]];}function startsWith(_0x1ab39b,_0x18b1df){return _['some'](_0x1ab39b,function(_0x31999b){return _[_0x4530('0x10')](_0x18b1df,_0x31999b);});}exports[_0x4530('0x11')]=function(_0x126da1){try{utils[_0x4530('0x12')](util[_0x4530('0x3')]('[%s][members][devicestatechange]',members[_0x126da1[_0x4530('0x13')]]?members[_0x126da1[_0x4530('0x13')]][_0x4530('0x4')]:_0x126da1[_0x4530('0x13')]),_0x126da1);utils[_0x4530('0x2')](util['format'](_0x4530('0x14'),members[_0x126da1['device']]?members[_0x126da1[_0x4530('0x13')]][_0x4530('0x4')]:_0x126da1[_0x4530('0x13')],_0x126da1['state'],_0x126da1['device']));switch(_0x126da1['state']){case'INUSE':case _0x4530('0x15'):if(!startsWith(exclude,_0x126da1['device'])){members[_0x126da1[_0x4530('0x13')]]={'channel':_0x4530('0x16'),'interface':_0x126da1[_0x4530('0x13')],'type':'TALKING','enterAt':utils[_0x4530('0x17')](),'role':_0x4530('0x18')};}break;case _0x4530('0x19'):if(!_[_0x4530('0x1a')](members[_0x126da1[_0x4530('0x13')]])){members[_0x126da1['device']][_0x4530('0x1b')]=utils[_0x4530('0x17')]();members[_0x126da1[_0x4530('0x13')]][_0x4530('0x1c')]=utils[_0x4530('0x1d')](members[_0x126da1[_0x4530('0x13')]][_0x4530('0x1b')],members[_0x126da1[_0x4530('0x13')]][_0x4530('0x1e')]);if(members[_0x126da1[_0x4530('0x13')]]['uniqueid']){writeDB(members[_0x126da1[_0x4530('0x13')]]);}}break;default:break;}}catch(_0x1cbf7e){utils[_0x4530('0xf')](util['format'](_0x4530('0x1f'),members[_0x126da1[_0x4530('0x13')]]?members[_0x126da1['device']]['uniqueid']:_0x126da1['device']),_0x1cbf7e);}};exports[_0x4530('0x20')]=function(_0x235356){try{if(!_[_0x4530('0x1a')](members[_0x235356[_0x4530('0x7')]])){utils['debug'](util['format'](_0x4530('0x21'),_0x235356[_0x4530('0x4')]),_0x235356);utils[_0x4530('0x2')](util[_0x4530('0x3')](_0x4530('0x22'),_0x235356['uniqueid'],_0x235356[_0x4530('0x7')],_0x235356[_0x4530('0x23')]));members[_0x235356['interface']]=_['assign'](members[_0x235356['interface']],{'data4':_0x235356[_0x4530('0x23')],'uniqueid':_0x235356[_0x4530('0x4')]});}}catch(_0x294711){utils[_0x4530('0xf')](util[_0x4530('0x3')](_0x4530('0x21'),_0x235356['uniqueid']),_0x294711);}};exports[_0x4530('0x24')]=function(_0x37df0d){try{utils['debug'](util[_0x4530('0x3')](_0x4530('0x25'),_0x37df0d['uniqueid']),_0x37df0d);if(_0x37df0d[_0x4530('0x5')]){var _0x45a419=_0x37df0d[_0x4530('0x5')][_0x4530('0x26')]('-')[0x0];if(!_[_0x4530('0x1a')](members[_0x45a419])){members[_0x45a419]=_[_0x4530('0x27')](members[_0x45a419],{'data1':members[_0x45a419][_0x4530('0x28')]||_0x37df0d[_0x4530('0x29')],'data2':members[_0x45a419][_0x4530('0x2a')]||_0x37df0d[_0x4530('0x2b')],'data3':members[_0x45a419][_0x4530('0x2c')]||_0x37df0d[_0x4530('0x2d')],'uniqueid':members[_0x45a419]['uniqueid']||_0x37df0d[_0x4530('0x4')]});utils['info'](util['format'](_0x4530('0x2e'),_0x37df0d[_0x4530('0x4')],members[_0x45a419][_0x4530('0x28')],members[_0x45a419][_0x4530('0x2a')],members[_0x45a419]['data3']));if(members[_0x45a419]['exitAt']){writeDB(members[_0x45a419]);}}}if(_0x37df0d['destinationchannel']){var _0x19ad51=_0x37df0d[_0x4530('0x2f')][_0x4530('0x26')]('-')[0x0];if(!_[_0x4530('0x1a')](members[_0x19ad51])){members[_0x19ad51]=_[_0x4530('0x27')](members[_0x19ad51],{'data1':members[_0x19ad51][_0x4530('0x28')]||_0x37df0d[_0x4530('0x29')],'data2':members[_0x19ad51][_0x4530('0x2a')]||_0x37df0d[_0x4530('0x2b')],'data3':members[_0x19ad51][_0x4530('0x2c')]||_0x37df0d[_0x4530('0x2d')],'uniqueid':members[_0x19ad51][_0x4530('0x4')]||_0x37df0d[_0x4530('0x4')]});utils[_0x4530('0x2')](util[_0x4530('0x3')](_0x4530('0x2e'),_0x37df0d[_0x4530('0x4')],members[_0x19ad51][_0x4530('0x28')],members[_0x19ad51][_0x4530('0x2a')],members[_0x19ad51][_0x4530('0x2c')]));if(members[_0x19ad51][_0x4530('0x1b')]){writeDB(members[_0x19ad51]);}}}}catch(_0x386cb5){utils[_0x4530('0xf')](util['format'](_0x4530('0x25'),_0x37df0d[_0x4530('0x4')]),_0x386cb5);}}; \ No newline at end of file +var _0x8ec1=['INUSE','BUSY','voice','now','agent','NOT_INUSE','isNil','diffTime','exitAt','enterAt','agentcomplete','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','[%s][members][agentcomplete]','cdr','[%s][members][cdr]','assign','data2','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data1','destinationchannel','source','util','./utils','Local/_attended@transfer','Queue:','info','uniqueid','interface','channel','membername','type','getUserByInterface','then','name','internal','request','CreateMemberReport','split','error','format','[%s][members][writeDB]','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state'];(function(_0x38f34e,_0x287825){var _0x3f3adf=function(_0x40c089){while(--_0x40c089){_0x38f34e['push'](_0x38f34e['shift']());}};_0x3f3adf(++_0x287825);}(_0x8ec1,0x1e3));var _0x18ec=function(_0x27ac32,_0x42771f){_0x27ac32=_0x27ac32-0x0;var _0x20c811=_0x8ec1[_0x27ac32];return _0x20c811;};'use strict';var _=require('lodash');var util=require(_0x18ec('0x0'));var utils=require(_0x18ec('0x1'));var members={};var exclude=[_0x18ec('0x2'),_0x18ec('0x3')];function writeDB(_0x3cf2ab){utils[_0x18ec('0x4')](util['format']('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x3cf2ab[_0x18ec('0x5')],_0x3cf2ab[_0x18ec('0x6')],_0x3cf2ab[_0x18ec('0x7')],_0x3cf2ab['data2'],_0x3cf2ab[_0x18ec('0x8')],_0x3cf2ab[_0x18ec('0x9')]));if(_0x3cf2ab[_0x18ec('0x6')]){utils[_0x18ec('0xa')](_0x3cf2ab[_0x18ec('0x6')])[_0x18ec('0xb')](function(_0x3134e5){if(_0x3134e5){_0x3cf2ab['membername']=_0x3134e5[_0x18ec('0xc')];_0x3cf2ab[_0x18ec('0xd')]=_0x3134e5[_0x18ec('0xd')];utils[_0x18ec('0xe')](_0x18ec('0xf'),_0x3cf2ab);}else{utils['getUserByName'](_0x3cf2ab['interface'][_0x18ec('0x10')]('/')[0x1])[_0x18ec('0xb')](function(_0x3de3b1){if(_0x3de3b1){_0x3cf2ab['membername']=_0x3de3b1[_0x18ec('0xc')];_0x3cf2ab['internal']=_0x3de3b1[_0x18ec('0xd')];utils['request']('CreateMemberReport',_0x3cf2ab);}});}})['catch'](function(_0x3f912f){utils[_0x18ec('0x11')](util[_0x18ec('0x12')](_0x18ec('0x13'),_0x3cf2ab[_0x18ec('0x5')]),_0x3f912f);});}delete members[_0x3cf2ab[_0x18ec('0x6')]];}function startsWith(_0x564265,_0x58ed94){return _['some'](_0x564265,function(_0x2a5119){return _[_0x18ec('0x14')](_0x58ed94,_0x2a5119);});}exports[_0x18ec('0x15')]=function(_0x5d872e){try{utils[_0x18ec('0x16')](util[_0x18ec('0x12')](_0x18ec('0x17'),members[_0x5d872e['device']]?members[_0x5d872e[_0x18ec('0x18')]]['uniqueid']:_0x5d872e[_0x18ec('0x18')]),_0x5d872e);utils[_0x18ec('0x4')](util[_0x18ec('0x12')](_0x18ec('0x19'),members[_0x5d872e[_0x18ec('0x18')]]?members[_0x5d872e[_0x18ec('0x18')]][_0x18ec('0x5')]:_0x5d872e[_0x18ec('0x18')],_0x5d872e['state'],_0x5d872e[_0x18ec('0x18')]));switch(_0x5d872e[_0x18ec('0x1a')]){case _0x18ec('0x1b'):case _0x18ec('0x1c'):if(!startsWith(exclude,_0x5d872e[_0x18ec('0x18')])){members[_0x5d872e[_0x18ec('0x18')]]={'channel':_0x18ec('0x1d'),'interface':_0x5d872e['device'],'type':'TALKING','enterAt':utils[_0x18ec('0x1e')](),'role':_0x18ec('0x1f')};}break;case _0x18ec('0x20'):if(!_[_0x18ec('0x21')](members[_0x5d872e['device']])){members[_0x5d872e[_0x18ec('0x18')]]['exitAt']=utils[_0x18ec('0x1e')]();members[_0x5d872e[_0x18ec('0x18')]]['duration']=utils[_0x18ec('0x22')](members[_0x5d872e[_0x18ec('0x18')]][_0x18ec('0x23')],members[_0x5d872e[_0x18ec('0x18')]][_0x18ec('0x24')]);if(members[_0x5d872e[_0x18ec('0x18')]][_0x18ec('0x5')]){writeDB(members[_0x5d872e['device']]);}}break;default:break;}}catch(_0x1c4d31){utils['error'](util[_0x18ec('0x12')](_0x18ec('0x17'),members[_0x5d872e[_0x18ec('0x18')]]?members[_0x5d872e[_0x18ec('0x18')]][_0x18ec('0x5')]:_0x5d872e[_0x18ec('0x18')]),_0x1c4d31);}};exports[_0x18ec('0x25')]=function(_0xd237ab){try{if(!_['isNil'](members[_0xd237ab[_0x18ec('0x6')]])){utils[_0x18ec('0x16')](util[_0x18ec('0x12')]('[%s][members][agentcomplete]',_0xd237ab['uniqueid']),_0xd237ab);utils['info'](util[_0x18ec('0x12')](_0x18ec('0x26'),_0xd237ab[_0x18ec('0x5')],_0xd237ab['interface'],_0xd237ab[_0x18ec('0x27')]));members[_0xd237ab['interface']]=_['assign'](members[_0xd237ab[_0x18ec('0x6')]],{'data4':_0xd237ab[_0x18ec('0x27')],'uniqueid':_0xd237ab[_0x18ec('0x5')]});}}catch(_0x86cd0a){utils[_0x18ec('0x11')](util['format'](_0x18ec('0x28'),_0xd237ab[_0x18ec('0x5')]),_0x86cd0a);}};exports[_0x18ec('0x29')]=function(_0x31ba0d){try{utils[_0x18ec('0x16')](util[_0x18ec('0x12')](_0x18ec('0x2a'),_0x31ba0d[_0x18ec('0x5')]),_0x31ba0d);if(_0x31ba0d[_0x18ec('0x7')]){var _0xd1cdd=_0x31ba0d[_0x18ec('0x7')][_0x18ec('0x10')]('-')[0x0];if(!_[_0x18ec('0x21')](members[_0xd1cdd])){members[_0xd1cdd]=_[_0x18ec('0x2b')](members[_0xd1cdd],{'data1':members[_0xd1cdd]['data1']||_0x31ba0d[_0x18ec('0x9')],'data2':members[_0xd1cdd][_0x18ec('0x2c')]||_0x31ba0d['source'],'data3':members[_0xd1cdd][_0x18ec('0x2d')]||_0x31ba0d[_0x18ec('0x2e')],'uniqueid':members[_0xd1cdd][_0x18ec('0x5')]||_0x31ba0d['uniqueid']});utils[_0x18ec('0x4')](util[_0x18ec('0x12')](_0x18ec('0x2f'),_0x31ba0d[_0x18ec('0x5')],members[_0xd1cdd][_0x18ec('0x30')],members[_0xd1cdd][_0x18ec('0x2c')],members[_0xd1cdd][_0x18ec('0x2d')]));if(members[_0xd1cdd][_0x18ec('0x23')]){writeDB(members[_0xd1cdd]);}}}if(_0x31ba0d[_0x18ec('0x31')]){var _0x287feb=_0x31ba0d[_0x18ec('0x31')][_0x18ec('0x10')]('-')[0x0];if(!_[_0x18ec('0x21')](members[_0x287feb])){members[_0x287feb]=_['assign'](members[_0x287feb],{'data1':members[_0x287feb]['data1']||_0x31ba0d['type'],'data2':members[_0x287feb][_0x18ec('0x2c')]||_0x31ba0d[_0x18ec('0x32')],'data3':members[_0x287feb]['data3']||_0x31ba0d[_0x18ec('0x2e')],'uniqueid':members[_0x287feb][_0x18ec('0x5')]||_0x31ba0d[_0x18ec('0x5')]});utils[_0x18ec('0x4')](util[_0x18ec('0x12')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x31ba0d['uniqueid'],members[_0x287feb][_0x18ec('0x30')],members[_0x287feb][_0x18ec('0x2c')],members[_0x287feb][_0x18ec('0x2d')]));if(members[_0x287feb][_0x18ec('0x23')]){writeDB(members[_0x287feb]);}}}}catch(_0x5cf5fa){utils[_0x18ec('0x11')](util[_0x18ec('0x12')]('[%s][members][cdr]',_0x31ba0d[_0x18ec('0x5')]),_0x5cf5fa);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 0946513..ec4b14a 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 _0x4be0=['transfertargetlinkedid','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]','diffTime','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','info','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo','queuecallerexitreason','getVoiceQueueByName','then','type','request','transfereduniqueid','queuecallerjoin','format','position','error','[%s][queues][queuecallerjoin]','hangup','isNil','queuecallerleaveAt','queuecallerexit','queuecallercomplete','now','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','varset','debug','[%s][queues][varset]','variable','toUpperCase','CONTINUE','queuecallerabandon','queuecallerexitAt','value','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queuecallerabandonAt','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','holdtime','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','destaccountcode','assigned','accountcode','membername','agentcomplete','[%s][queues][agentcomplete]','queuecallercompleteAt','transfer','TRANSFER','COMPLETEDBY','reason','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','[%s][queues][blindtransfer]','transfereeuniqueid','transfertype','BLIND','extension','transferuniqueid','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','transfereelinkedid','clone','transfertargetuniqueid','calleridnum','calleridname','[%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','ATTENDED','transferexten','ATTENDEDTRANSFER'];(function(_0x11c6d6,_0x4bb0b2){var _0x17c6ed=function(_0x4735c1){while(--_0x4735c1){_0x11c6d6['push'](_0x11c6d6['shift']());}};_0x17c6ed(++_0x4bb0b2);}(_0x4be0,0x137));var _0x04be=function(_0xfe9f69,_0x4c4e1a){_0xfe9f69=_0xfe9f69-0x0;var _0x3366ad=_0x4be0[_0xfe9f69];return _0x3366ad;};'use strict';var _=require(_0x04be('0x0'));var util=require(_0x04be('0x1'));var utils=require(_0x04be('0x2'));var queues={};function writeDB(_0x14bb71){utils[_0x04be('0x3')](util['format'](_0x04be('0x4'),_0x14bb71[_0x04be('0x5')],_0x14bb71[_0x04be('0x6')],_0x14bb71[_0x04be('0x7')],_0x14bb71[_0x04be('0x8')],_0x14bb71['calleridnum'],_0x14bb71['accountcode'],_0x14bb71[_0x04be('0x9')]));if(_0x14bb71[_0x04be('0x7')]){utils[_0x04be('0xa')](_0x14bb71[_0x04be('0x7')])[_0x04be('0xb')](function(_0x460aca){if(_0x460aca){_0x14bb71[_0x04be('0xc')]=_0x460aca[_0x04be('0xc')];}utils[_0x04be('0xd')]('CreateVoiceQueueReport',_0x14bb71);});}else{utils[_0x04be('0xd')]('CreateVoiceQueueReport',_0x14bb71);}if(_0x14bb71[_0x04be('0xe')]){delete queues[_0x14bb71[_0x04be('0xe')]];}else{delete queues[_0x14bb71[_0x04be('0x5')]];}}exports[_0x04be('0xf')]=function(_0x1952fa){try{utils['debug'](util[_0x04be('0x10')]('[%s][queues][queuecallerjoin]',_0x1952fa[_0x04be('0x5')]),_0x1952fa);utils[_0x04be('0x3')](util[_0x04be('0x10')]('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x1952fa[_0x04be('0x5')],_0x1952fa[_0x04be('0x7')],_0x1952fa[_0x04be('0x11')]));queues[_0x1952fa[_0x04be('0x5')]]=_['assign'](_0x1952fa,{'originalposition':_0x1952fa[_0x04be('0x11')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x55c0ff){utils[_0x04be('0x12')](util[_0x04be('0x10')](_0x04be('0x13'),_0x1952fa[_0x04be('0x5')]),_0x55c0ff);}};exports[_0x04be('0x14')]=function(_0x268eca){try{if(!_[_0x04be('0x15')](queues[_0x268eca[_0x04be('0x5')]])){utils['debug'](util[_0x04be('0x10')]('[%s][queues][hangup]',_0x268eca[_0x04be('0x5')]),_0x268eca);if(queues[_0x268eca[_0x04be('0x5')]][_0x04be('0x16')]){if(!queues[_0x268eca[_0x04be('0x5')]]['queuecallerabandon']&&!queues[_0x268eca[_0x04be('0x5')]][_0x04be('0x17')]){queues[_0x268eca[_0x04be('0x5')]][_0x04be('0x18')]=!![];queues[_0x268eca[_0x04be('0x5')]]['queuecallercompleteAt']=utils[_0x04be('0x19')]();queues[_0x268eca[_0x04be('0x5')]]['queuecallerexitreason']=_0x04be('0x1a');}utils[_0x04be('0x3')](util[_0x04be('0x10')](_0x04be('0x1b'),_0x268eca['uniqueid'],queues[_0x268eca['uniqueid']][_0x04be('0x1c')],queues[_0x268eca[_0x04be('0x5')]][_0x04be('0x9')]));writeDB(queues[_0x268eca[_0x04be('0x5')]]);}else if(queues[_0x268eca[_0x04be('0x5')]][_0x04be('0xe')]){utils[_0x04be('0x3')](util['format'](_0x04be('0x1d'),_0x268eca['uniqueid'],queues[_0x268eca[_0x04be('0x5')]][_0x04be('0x1c')],queues[_0x268eca[_0x04be('0x5')]][_0x04be('0xe')]));queues[queues[_0x268eca[_0x04be('0x5')]][_0x04be('0xe')]]=queues[_0x268eca[_0x04be('0x5')]];queues[queues[_0x268eca['uniqueid']][_0x04be('0xe')]][_0x04be('0x1e')]=0x2;delete queues[_0x268eca['uniqueid']];}}}catch(_0xf157fd){utils['error'](util[_0x04be('0x10')]('[%s][queues][hangup]',_0x268eca[_0x04be('0x5')]),_0xf157fd);}};exports[_0x04be('0x1f')]=function(_0x3e40ab){try{utils[_0x04be('0x20')](util['format'](_0x04be('0x21'),_0x3e40ab[_0x04be('0x5')]),_0x3e40ab);if(!_[_0x04be('0x15')](_0x3e40ab[_0x04be('0x22')]['queuestatus'])&&_0x3e40ab['value'][_0x04be('0x23')]()!==_0x04be('0x24')){if(!_[_0x04be('0x15')](queues[_0x3e40ab['uniqueid']])){queues[_0x3e40ab[_0x04be('0x5')]][_0x04be('0x25')]=![];queues[_0x3e40ab[_0x04be('0x5')]]['queuecallerabandonAt']=null;queues[_0x3e40ab[_0x04be('0x5')]][_0x04be('0x17')]=!![];queues[_0x3e40ab['uniqueid']][_0x04be('0x26')]=utils[_0x04be('0x19')]();queues[_0x3e40ab[_0x04be('0x5')]][_0x04be('0x9')]=_0x3e40ab[_0x04be('0x27')][_0x04be('0x23')]();utils[_0x04be('0x3')](util['format'](_0x04be('0x28'),_0x3e40ab[_0x04be('0x5')],queues[_0x3e40ab[_0x04be('0x5')]][_0x04be('0x1c')],_0x3e40ab['value'],queues[_0x3e40ab[_0x04be('0x5')]][_0x04be('0x9')]));writeDB(queues[_0x3e40ab[_0x04be('0x5')]]);}}else if(!_[_0x04be('0x15')](_0x3e40ab[_0x04be('0x22')]['queueposition'])){if(!_[_0x04be('0x15')](queues[_0x3e40ab[_0x04be('0x5')]])&&!queues[_0x3e40ab['uniqueid']][_0x04be('0x25')]){queues[_0x3e40ab[_0x04be('0x5')]][_0x04be('0x25')]=![];queues[_0x3e40ab[_0x04be('0x5')]][_0x04be('0x29')]=null;queues[_0x3e40ab['uniqueid']][_0x04be('0x17')]=!![];queues[_0x3e40ab[_0x04be('0x5')]][_0x04be('0x26')]=utils['now']();queues[_0x3e40ab[_0x04be('0x5')]][_0x04be('0x9')]='EXITWITHKEY';utils[_0x04be('0x3')](util[_0x04be('0x10')](_0x04be('0x2a'),_0x3e40ab[_0x04be('0x5')],queues[_0x3e40ab[_0x04be('0x5')]][_0x04be('0x1c')],_0x3e40ab[_0x04be('0x27')],queues[_0x3e40ab['uniqueid']][_0x04be('0x9')]));}}}catch(_0x52d0ba){utils[_0x04be('0x12')](util['format'](_0x04be('0x21'),_0x3e40ab[_0x04be('0x5')]),_0x52d0ba);}};exports[_0x04be('0x25')]=function(_0x22867e){try{if(!_[_0x04be('0x15')](queues[_0x22867e['uniqueid']])){utils[_0x04be('0x20')](util['format'](_0x04be('0x2b'),_0x22867e[_0x04be('0x5')]),_0x22867e);queues[_0x22867e[_0x04be('0x5')]][_0x04be('0x17')]=![];queues[_0x22867e[_0x04be('0x5')]]['queuecallerexitAt']=null;queues[_0x22867e['uniqueid']][_0x04be('0x25')]=!![];queues[_0x22867e[_0x04be('0x5')]][_0x04be('0x29')]=utils['now']();queues[_0x22867e[_0x04be('0x5')]][_0x04be('0x9')]=_0x04be('0x2c');utils[_0x04be('0x3')](util['format'](_0x04be('0x2d'),_0x22867e[_0x04be('0x5')],queues[_0x22867e['uniqueid']][_0x04be('0x1c')],queues[_0x22867e[_0x04be('0x5')]][_0x04be('0x9')]));}}catch(_0x430943){utils[_0x04be('0x12')](util[_0x04be('0x10')](_0x04be('0x2b'),_0x22867e[_0x04be('0x5')]),_0x430943);}};exports[_0x04be('0x2e')]=function(_0xed762a){try{if(!_[_0x04be('0x15')](queues[_0xed762a[_0x04be('0x5')]])){utils[_0x04be('0x20')](util[_0x04be('0x10')](_0x04be('0x2f'),_0xed762a['uniqueid']),_0xed762a);utils[_0x04be('0x3')](util[_0x04be('0x10')](_0x04be('0x30'),_0xed762a[_0x04be('0x5')],queues[_0xed762a['uniqueid']]['name'],_0xed762a[_0x04be('0x31')],_0xed762a[_0x04be('0x32')]));queues[_0xed762a[_0x04be('0x5')]][_0x04be('0x2e')]=!![];queues[_0xed762a['uniqueid']][_0x04be('0x16')]=utils[_0x04be('0x19')]();queues[_0xed762a[_0x04be('0x5')]][_0x04be('0x33')]=utils['diffTime'](queues[_0xed762a[_0x04be('0x5')]][_0x04be('0x16')],queues[_0xed762a['uniqueid']][_0x04be('0x34')]);queues[_0xed762a['uniqueid']][_0x04be('0x11')]=_0xed762a['position'];queues[_0xed762a['uniqueid']]['count']=_0xed762a[_0x04be('0x35')];queues[_0xed762a[_0x04be('0x5')]][_0x04be('0x31')]=_0xed762a[_0x04be('0x31')];queues[_0xed762a['uniqueid']][_0x04be('0x32')]=_0xed762a['connectedlinename'];}}catch(_0x41f3c0){utils[_0x04be('0x12')](util[_0x04be('0x10')](_0x04be('0x2f'),_0xed762a[_0x04be('0x5')]),_0x41f3c0);}};exports[_0x04be('0x36')]=function(_0x18c8ec){try{if(!_[_0x04be('0x15')](queues[_0x18c8ec[_0x04be('0x5')]])){utils['debug'](util[_0x04be('0x10')](_0x04be('0x37'),_0x18c8ec[_0x04be('0x5')]),_0x18c8ec);utils[_0x04be('0x3')](util[_0x04be('0x10')](_0x04be('0x38'),_0x18c8ec[_0x04be('0x5')],queues[_0x18c8ec[_0x04be('0x5')]][_0x04be('0x1c')],_0x18c8ec['membername'],_0x18c8ec[_0x04be('0x39')]));queues[_0x18c8ec[_0x04be('0x5')]][_0x04be('0x25')]=![];queues[_0x18c8ec[_0x04be('0x5')]]['queuecallerabandon']=![];queues[_0x18c8ec['uniqueid']][_0x04be('0x29')]=null;queues[_0x18c8ec[_0x04be('0x5')]][_0x04be('0x17')]=![];queues[_0x18c8ec['uniqueid']]['queuecallerexitreason']=null;queues[_0x18c8ec[_0x04be('0x5')]][_0x04be('0x26')]=null;queues[_0x18c8ec['uniqueid']][_0x04be('0x3a')]=!![];queues[_0x18c8ec[_0x04be('0x5')]][_0x04be('0x3b')]=_0x18c8ec[_0x04be('0x39')];queues[_0x18c8ec[_0x04be('0x5')]][_0x04be('0x8')]=_0x18c8ec[_0x04be('0x3c')];}}catch(_0x4d8430){utils[_0x04be('0x12')](util[_0x04be('0x10')](_0x04be('0x37'),_0x18c8ec[_0x04be('0x5')]),_0x4d8430);}};exports[_0x04be('0x3d')]=function(_0x426103){try{if(!_[_0x04be('0x15')](queues[_0x426103[_0x04be('0x5')]])){if(queues[_0x426103[_0x04be('0x5')]][_0x04be('0x16')]){utils[_0x04be('0x20')](util[_0x04be('0x10')](_0x04be('0x3e'),_0x426103[_0x04be('0x5')]),_0x426103);queues[_0x426103[_0x04be('0x5')]]['queuecallerabandon']=![];queues[_0x426103[_0x04be('0x5')]][_0x04be('0x25')]=![];queues[_0x426103[_0x04be('0x5')]][_0x04be('0x29')]=null;queues[_0x426103['uniqueid']]['queuecallerexit']=![];queues[_0x426103['uniqueid']][_0x04be('0x26')]=null;queues[_0x426103[_0x04be('0x5')]][_0x04be('0x3a')]=!![];queues[_0x426103['uniqueid']]['lastAssignedTo']=_0x426103[_0x04be('0x3c')];queues[_0x426103[_0x04be('0x5')]]['queuecallercomplete']=!![];queues[_0x426103[_0x04be('0x5')]][_0x04be('0x3f')]=utils['now']();if(_0x426103['reason']==_0x04be('0x40')){if(!queues[_0x426103[_0x04be('0x5')]]['transfer']){queues[_0x426103['uniqueid']][_0x04be('0x9')]=_0x04be('0x41');}}else{queues[_0x426103['uniqueid']][_0x04be('0x9')]=_0x04be('0x42')+_0x426103[_0x04be('0x43')][_0x04be('0x23')]();}utils[_0x04be('0x3')](util[_0x04be('0x10')](_0x04be('0x44'),_0x426103[_0x04be('0x5')],queues[_0x426103[_0x04be('0x5')]]['name'],_0x426103[_0x04be('0x3c')],queues[_0x426103[_0x04be('0x5')]][_0x04be('0x9')]));writeDB(queues[_0x426103[_0x04be('0x5')]]);}}}catch(_0x3625a8){utils[_0x04be('0x12')](util[_0x04be('0x10')](_0x04be('0x3e'),_0x426103['uniqueid']),_0x3625a8);}};exports['blindtransfer']=function(_0x3c005c){try{if(!_['isNil'](queues[_0x3c005c['transfereeuniqueid']])){utils[_0x04be('0x20')](util[_0x04be('0x10')](_0x04be('0x45'),_0x3c005c['uniqueid']),_0x3c005c);queues[_0x3c005c[_0x04be('0x46')]]['transfer']=!![];queues[_0x3c005c[_0x04be('0x46')]][_0x04be('0x47')]=_0x04be('0x48');queues[_0x3c005c[_0x04be('0x46')]]['transferexten']=_0x3c005c[_0x04be('0x49')];queues[_0x3c005c[_0x04be('0x46')]][_0x04be('0x4a')]=_0x3c005c[_0x04be('0x46')];queues[_0x3c005c['transfereeuniqueid']]['queuecallerexitreason']='BLINDTRANSFER';utils['info'](util[_0x04be('0x10')]('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x3c005c['uniqueid'],queues[_0x3c005c[_0x04be('0x46')]][_0x04be('0x1c')],_0x3c005c[_0x04be('0x46')],_0x3c005c[_0x04be('0x49')]));}}catch(_0x3d264b){utils[_0x04be('0x12')](util[_0x04be('0x10')](_0x04be('0x45'),_0x3c005c[_0x04be('0x5')]),_0x3d264b);}};exports[_0x04be('0x4b')]=function(_0x2219e7){try{utils[_0x04be('0x20')](util[_0x04be('0x10')](_0x04be('0x4c'),_0x2219e7[_0x04be('0x4d')]),_0x2219e7);if(_0x2219e7[_0x04be('0x4d')]==_0x2219e7[_0x04be('0x4e')]){if(!_['isNil'](queues[_0x2219e7[_0x04be('0x4f')]])){utils[_0x04be('0x3')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x2219e7[_0x04be('0x4d')],queues[_0x2219e7[_0x04be('0x4f')]][_0x04be('0x1c')],_0x2219e7['origtransfererexten']));queues[_0x2219e7[_0x04be('0x4f')]]['transfer']=!![];queues[_0x2219e7[_0x04be('0x4f')]][_0x04be('0x47')]='ATTENDED';queues[_0x2219e7[_0x04be('0x4f')]]['transferexten']=_0x2219e7['origtransfererexten'];queues[_0x2219e7[_0x04be('0x4f')]][_0x04be('0x4a')]=_0x2219e7[_0x04be('0x4d')];queues[_0x2219e7[_0x04be('0x4f')]][_0x04be('0x9')]='ATTENDEDTRANSFER';}if(!_[_0x04be('0x15')](queues[_0x2219e7[_0x04be('0x4e')]])){if(_0x2219e7['transfereelinkedid']&&queues[_0x2219e7[_0x04be('0x50')]]){queues[_0x2219e7['transfereelinkedid']][_0x04be('0x1e')]=0x1;queues[_0x2219e7[_0x04be('0x46')]]=_[_0x04be('0x51')](queues[_0x2219e7[_0x04be('0x50')]]);queues[_0x2219e7[_0x04be('0x46')]][_0x04be('0xe')]=_0x2219e7[_0x04be('0x52')];queues[_0x2219e7['transfereeuniqueid']][_0x04be('0x1e')]=0x2;queues[_0x2219e7['transfereeuniqueid']]['calleridnum']=queues[_0x2219e7[_0x04be('0x4f')]][_0x04be('0x53')];queues[_0x2219e7[_0x04be('0x46')]]['calleridname']=queues[_0x2219e7[_0x04be('0x4f')]][_0x04be('0x54')];queues[_0x2219e7['transfereeuniqueid']]['queuecallerjoinAt']=utils[_0x04be('0x19')]();queues[_0x2219e7['transfereeuniqueid']][_0x04be('0x16')]=utils[_0x04be('0x19')]();queues[_0x2219e7[_0x04be('0x46')]]['holdtime']=0x0;queues[_0x2219e7[_0x04be('0x46')]]['mohtime']=0x0;utils['info'](util[_0x04be('0x10')](_0x04be('0x55'),_0x2219e7[_0x04be('0x4d')],queues[_0x2219e7['transfereeuniqueid']]['name'],queues[_0x2219e7[_0x04be('0x46')]]['calleridnum'],queues[_0x2219e7[_0x04be('0x46')]]['calleridname']));}else{utils[_0x04be('0x3')](util[_0x04be('0x10')](_0x04be('0x56'),_0x2219e7[_0x04be('0x4d')],queues[_0x2219e7[_0x04be('0x4e')]][_0x04be('0x1c')],_0x2219e7[_0x04be('0x4f')]));queues[_0x2219e7['origtransfererlinkedid']][_0x04be('0xe')]=_0x2219e7[_0x04be('0x4f')];}}}else if(_0x2219e7[_0x04be('0x57')]==_0x2219e7[_0x04be('0x4f')]){if(!_[_0x04be('0x15')](queues[_0x2219e7['origtransfererlinkedid']])){utils[_0x04be('0x3')](util[_0x04be('0x10')](_0x04be('0x58'),_0x2219e7[_0x04be('0x4d')],queues[_0x2219e7[_0x04be('0x4e')]]['name'],_0x2219e7[_0x04be('0x57')],_0x2219e7[_0x04be('0x59')]));queues[_0x2219e7[_0x04be('0x4e')]]['transfer']=!![];queues[_0x2219e7[_0x04be('0x4e')]][_0x04be('0x47')]=_0x04be('0x5a');queues[_0x2219e7['origtransfererlinkedid']][_0x04be('0x5b')]=_0x2219e7[_0x04be('0x59')];queues[_0x2219e7[_0x04be('0x4e')]][_0x04be('0x4a')]=_0x2219e7['secondtransfereruniqueid'];queues[_0x2219e7[_0x04be('0x4e')]][_0x04be('0x9')]=_0x04be('0x5c');}if(!_['isNil'](queues[_0x2219e7[_0x04be('0x4f')]])){if(_0x2219e7[_0x04be('0x5d')]&&queues[_0x2219e7[_0x04be('0x5d')]]){queues[_0x2219e7[_0x04be('0x5d')]][_0x04be('0x1e')]=0x1;queues[_0x2219e7[_0x04be('0x52')]]=_[_0x04be('0x51')](queues[_0x2219e7[_0x04be('0x5d')]]);queues[_0x2219e7[_0x04be('0x52')]][_0x04be('0xe')]=_0x2219e7[_0x04be('0x52')];queues[_0x2219e7['transfertargetuniqueid']]['queuecallerenterreason']=0x2;queues[_0x2219e7[_0x04be('0x52')]][_0x04be('0x53')]=queues[_0x2219e7[_0x04be('0x4e')]][_0x04be('0x53')];queues[_0x2219e7[_0x04be('0x52')]][_0x04be('0x54')]=queues[_0x2219e7[_0x04be('0x4e')]][_0x04be('0x54')];queues[_0x2219e7['transfertargetuniqueid']][_0x04be('0x34')]=utils[_0x04be('0x19')]();queues[_0x2219e7[_0x04be('0x52')]][_0x04be('0x16')]=utils[_0x04be('0x19')]();queues[_0x2219e7[_0x04be('0x52')]][_0x04be('0x33')]=0x0;queues[_0x2219e7['transfertargetuniqueid']][_0x04be('0x5e')]=0x0;utils[_0x04be('0x3')](util[_0x04be('0x10')](_0x04be('0x5f'),_0x2219e7[_0x04be('0x4d')],queues[_0x2219e7['transfertargetuniqueid']]['name'],queues[_0x2219e7[_0x04be('0x52')]][_0x04be('0xe')],queues[_0x2219e7[_0x04be('0x52')]]['calleridnum'],queues[_0x2219e7[_0x04be('0x52')]]['calleridname']));}else{utils[_0x04be('0x3')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x2219e7['origtransfereruniqueid'],queues[_0x2219e7[_0x04be('0x4f')]][_0x04be('0x1c')],_0x2219e7['origtransfererlinkedid']));queues[_0x2219e7['secondtransfererlinkedid']][_0x04be('0xe')]=_0x2219e7[_0x04be('0x4e')];}}}}catch(_0x753dbe){utils[_0x04be('0x12')](util[_0x04be('0x10')](_0x04be('0x4c'),_0x2219e7[_0x04be('0x4d')]),_0x753dbe);}};exports['musiconholdstart']=function(_0x994a10){try{if(!_[_0x04be('0x15')](queues[_0x994a10['uniqueid']])){utils[_0x04be('0x20')](util[_0x04be('0x10')](_0x04be('0x60'),_0x994a10[_0x04be('0x5')]),_0x994a10);queues[_0x994a10[_0x04be('0x5')]][_0x04be('0x61')]=utils[_0x04be('0x19')]();utils['info'](util['format']('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x994a10['uniqueid'],queues[_0x994a10['uniqueid']][_0x04be('0x1c')],queues[_0x994a10[_0x04be('0x5')]][_0x04be('0x61')]));}}catch(_0x4f83ea){utils[_0x04be('0x12')](util[_0x04be('0x10')](_0x04be('0x60'),_0x994a10[_0x04be('0x5')]),_0x4f83ea);}};exports['musiconholdstop']=function(_0x20777a){try{if(!_[_0x04be('0x15')](queues[_0x20777a[_0x04be('0x5')]])){if(!_['isNil'](queues[_0x20777a[_0x04be('0x5')]][_0x04be('0x61')])){utils['debug'](util[_0x04be('0x10')](_0x04be('0x62'),_0x20777a[_0x04be('0x5')]),_0x20777a);queues[_0x20777a[_0x04be('0x5')]][_0x04be('0x5e')]+=utils[_0x04be('0x63')](utils[_0x04be('0x19')](),queues[_0x20777a[_0x04be('0x5')]][_0x04be('0x61')]);utils['info'](util['format'](_0x04be('0x64'),_0x20777a['uniqueid'],queues[_0x20777a[_0x04be('0x5')]][_0x04be('0x1c')],queues[_0x20777a[_0x04be('0x5')]]['mohtime']));delete queues[_0x20777a[_0x04be('0x5')]]['musiconholdstartAt'];}}}catch(_0x4564b6){utils['error'](util[_0x04be('0x10')](_0x04be('0x62'),_0x20777a[_0x04be('0x5')]),_0x4564b6);}}; \ No newline at end of file +var _0x461a=['[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','connectedlinenum','queuecallerleave','diffTime','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','destaccountcode','assigned','membername','agentcomplete','queuecallerleaveAt','[%s][queues][agentcomplete]','reason','transfer','TRANSFER','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transferexten','extension','transferuniqueid','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','origtransfererexten','transfertype','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridname','holdtime','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','[%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','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','[%s][queues][musiconholdstop]','lodash','util','./utils','info','format','uniqueid','channel','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','then','type','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','now','error','hangup','isNil','[%s][queues][hangup]','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','varset','[%s][queues][varset]','variable','queuestatus','value','toUpperCase','CONTINUE','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','queuecallerabandonAt','queuecallerexitAt','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s'];(function(_0x175ac5,_0x60c8a3){var _0x2f1ae3=function(_0x3584e){while(--_0x3584e){_0x175ac5['push'](_0x175ac5['shift']());}};_0x2f1ae3(++_0x60c8a3);}(_0x461a,0x9c));var _0xa461=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x461a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa461('0x0'));var util=require(_0xa461('0x1'));var utils=require(_0xa461('0x2'));var queues={};function writeDB(_0x26bf9c){utils[_0xa461('0x3')](util[_0xa461('0x4')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x26bf9c[_0xa461('0x5')],_0x26bf9c[_0xa461('0x6')],_0x26bf9c[_0xa461('0x7')],_0x26bf9c[_0xa461('0x8')],_0x26bf9c[_0xa461('0x9')],_0x26bf9c[_0xa461('0xa')],_0x26bf9c[_0xa461('0xb')]));if(_0x26bf9c[_0xa461('0x7')]){utils['getVoiceQueueByName'](_0x26bf9c[_0xa461('0x7')])[_0xa461('0xc')](function(_0x50df93){if(_0x50df93){_0x26bf9c[_0xa461('0xd')]=_0x50df93[_0xa461('0xd')];}utils['request']('CreateVoiceQueueReport',_0x26bf9c);});}else{utils['request']('CreateVoiceQueueReport',_0x26bf9c);}if(_0x26bf9c[_0xa461('0xe')]){delete queues[_0x26bf9c[_0xa461('0xe')]];}else{delete queues[_0x26bf9c[_0xa461('0x5')]];}}exports[_0xa461('0xf')]=function(_0x346358){try{utils[_0xa461('0x10')](util[_0xa461('0x4')]('[%s][queues][queuecallerjoin]',_0x346358['uniqueid']),_0x346358);utils[_0xa461('0x3')](util['format'](_0xa461('0x11'),_0x346358[_0xa461('0x5')],_0x346358[_0xa461('0x7')],_0x346358[_0xa461('0x12')]));queues[_0x346358[_0xa461('0x5')]]=_['assign'](_0x346358,{'originalposition':_0x346358[_0xa461('0x12')],'queuecallerjoinAt':utils[_0xa461('0x13')](),'mohtime':0x0});}catch(_0x51fe74){utils[_0xa461('0x14')](util[_0xa461('0x4')]('[%s][queues][queuecallerjoin]',_0x346358[_0xa461('0x5')]),_0x51fe74);}};exports[_0xa461('0x15')]=function(_0x4100c7){try{if(!_[_0xa461('0x16')](queues[_0x4100c7[_0xa461('0x5')]])){utils[_0xa461('0x10')](util[_0xa461('0x4')](_0xa461('0x17'),_0x4100c7[_0xa461('0x5')]),_0x4100c7);if(queues[_0x4100c7[_0xa461('0x5')]]['queuecallerleaveAt']){if(!queues[_0x4100c7['uniqueid']][_0xa461('0x18')]&&!queues[_0x4100c7['uniqueid']][_0xa461('0x19')]){queues[_0x4100c7[_0xa461('0x5')]][_0xa461('0x1a')]=!![];queues[_0x4100c7[_0xa461('0x5')]][_0xa461('0x1b')]=utils[_0xa461('0x13')]();queues[_0x4100c7[_0xa461('0x5')]]['queuecallerexitreason']=_0xa461('0x1c');}utils['info'](util[_0xa461('0x4')](_0xa461('0x1d'),_0x4100c7['uniqueid'],queues[_0x4100c7[_0xa461('0x5')]][_0xa461('0x1e')],queues[_0x4100c7[_0xa461('0x5')]][_0xa461('0xb')]));writeDB(queues[_0x4100c7[_0xa461('0x5')]]);}else if(queues[_0x4100c7[_0xa461('0x5')]][_0xa461('0xe')]){utils[_0xa461('0x3')](util[_0xa461('0x4')](_0xa461('0x1f'),_0x4100c7[_0xa461('0x5')],queues[_0x4100c7[_0xa461('0x5')]]['name'],queues[_0x4100c7[_0xa461('0x5')]][_0xa461('0xe')]));queues[queues[_0x4100c7['uniqueid']][_0xa461('0xe')]]=queues[_0x4100c7['uniqueid']];queues[queues[_0x4100c7[_0xa461('0x5')]][_0xa461('0xe')]][_0xa461('0x20')]=0x2;delete queues[_0x4100c7[_0xa461('0x5')]];}}}catch(_0x2451d4){utils[_0xa461('0x14')](util[_0xa461('0x4')](_0xa461('0x17'),_0x4100c7[_0xa461('0x5')]),_0x2451d4);}};exports[_0xa461('0x21')]=function(_0x366d03){try{utils[_0xa461('0x10')](util['format'](_0xa461('0x22'),_0x366d03[_0xa461('0x5')]),_0x366d03);if(!_[_0xa461('0x16')](_0x366d03[_0xa461('0x23')][_0xa461('0x24')])&&_0x366d03[_0xa461('0x25')][_0xa461('0x26')]()!==_0xa461('0x27')){if(!_[_0xa461('0x16')](queues[_0x366d03[_0xa461('0x5')]])){queues[_0x366d03[_0xa461('0x5')]][_0xa461('0x18')]=![];queues[_0x366d03[_0xa461('0x5')]]['queuecallerabandonAt']=null;queues[_0x366d03['uniqueid']]['queuecallerexit']=!![];queues[_0x366d03['uniqueid']]['queuecallerexitAt']=utils[_0xa461('0x13')]();queues[_0x366d03[_0xa461('0x5')]][_0xa461('0xb')]=_0x366d03[_0xa461('0x25')]['toUpperCase']();utils[_0xa461('0x3')](util[_0xa461('0x4')](_0xa461('0x28'),_0x366d03['uniqueid'],queues[_0x366d03[_0xa461('0x5')]][_0xa461('0x1e')],_0x366d03['value'],queues[_0x366d03[_0xa461('0x5')]]['queuecallerexitreason']));writeDB(queues[_0x366d03['uniqueid']]);}}else if(!_['isNil'](_0x366d03[_0xa461('0x23')][_0xa461('0x29')])){if(!_[_0xa461('0x16')](queues[_0x366d03[_0xa461('0x5')]])&&!queues[_0x366d03['uniqueid']][_0xa461('0x18')]){queues[_0x366d03['uniqueid']]['queuecallerabandon']=![];queues[_0x366d03[_0xa461('0x5')]][_0xa461('0x2a')]=null;queues[_0x366d03[_0xa461('0x5')]][_0xa461('0x19')]=!![];queues[_0x366d03[_0xa461('0x5')]][_0xa461('0x2b')]=utils[_0xa461('0x13')]();queues[_0x366d03[_0xa461('0x5')]][_0xa461('0xb')]=_0xa461('0x2c');utils[_0xa461('0x3')](util[_0xa461('0x4')](_0xa461('0x2d'),_0x366d03[_0xa461('0x5')],queues[_0x366d03[_0xa461('0x5')]][_0xa461('0x1e')],_0x366d03[_0xa461('0x25')],queues[_0x366d03['uniqueid']][_0xa461('0xb')]));}}}catch(_0x5238e4){utils[_0xa461('0x14')](util['format']('[%s][queues][varset]',_0x366d03['uniqueid']),_0x5238e4);}};exports[_0xa461('0x18')]=function(_0x4cf957){try{if(!_[_0xa461('0x16')](queues[_0x4cf957[_0xa461('0x5')]])){utils[_0xa461('0x10')](util[_0xa461('0x4')](_0xa461('0x2e'),_0x4cf957['uniqueid']),_0x4cf957);queues[_0x4cf957[_0xa461('0x5')]][_0xa461('0x19')]=![];queues[_0x4cf957['uniqueid']][_0xa461('0x2b')]=null;queues[_0x4cf957[_0xa461('0x5')]][_0xa461('0x18')]=!![];queues[_0x4cf957[_0xa461('0x5')]]['queuecallerabandonAt']=utils['now']();queues[_0x4cf957[_0xa461('0x5')]][_0xa461('0xb')]=_0xa461('0x2f');utils[_0xa461('0x3')](util['format'](_0xa461('0x30'),_0x4cf957[_0xa461('0x5')],queues[_0x4cf957[_0xa461('0x5')]]['name'],queues[_0x4cf957['uniqueid']][_0xa461('0xb')]));}}catch(_0x29d7ef){utils[_0xa461('0x14')](util[_0xa461('0x4')](_0xa461('0x2e'),_0x4cf957[_0xa461('0x5')]),_0x29d7ef);}};exports['queuecallerleave']=function(_0x416880){try{if(!_[_0xa461('0x16')](queues[_0x416880[_0xa461('0x5')]])){utils[_0xa461('0x10')](util[_0xa461('0x4')]('[%s][queues][queuecallerleave]',_0x416880['uniqueid']),_0x416880);utils[_0xa461('0x3')](util[_0xa461('0x4')]('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x416880[_0xa461('0x5')],queues[_0x416880['uniqueid']][_0xa461('0x1e')],_0x416880[_0xa461('0x31')],_0x416880['connectedlinename']));queues[_0x416880[_0xa461('0x5')]][_0xa461('0x32')]=!![];queues[_0x416880['uniqueid']]['queuecallerleaveAt']=utils['now']();queues[_0x416880[_0xa461('0x5')]]['holdtime']=utils[_0xa461('0x33')](queues[_0x416880['uniqueid']]['queuecallerleaveAt'],queues[_0x416880[_0xa461('0x5')]][_0xa461('0x34')]);queues[_0x416880['uniqueid']]['position']=_0x416880[_0xa461('0x12')];queues[_0x416880['uniqueid']][_0xa461('0x35')]=_0x416880['count'];queues[_0x416880[_0xa461('0x5')]]['connectedlinenum']=_0x416880[_0xa461('0x31')];queues[_0x416880[_0xa461('0x5')]]['connectedlinename']=_0x416880['connectedlinename'];}}catch(_0x301611){utils[_0xa461('0x14')](util[_0xa461('0x4')]('[%s][queues][queuecallerleave]',_0x416880[_0xa461('0x5')]),_0x301611);}};exports[_0xa461('0x36')]=function(_0x2d640a){try{if(!_[_0xa461('0x16')](queues[_0x2d640a[_0xa461('0x5')]])){utils[_0xa461('0x10')](util[_0xa461('0x4')](_0xa461('0x37'),_0x2d640a['uniqueid']),_0x2d640a);utils[_0xa461('0x3')](util[_0xa461('0x4')](_0xa461('0x38'),_0x2d640a['uniqueid'],queues[_0x2d640a[_0xa461('0x5')]][_0xa461('0x1e')],_0x2d640a['membername'],_0x2d640a[_0xa461('0x39')]));queues[_0x2d640a[_0xa461('0x5')]][_0xa461('0x18')]=![];queues[_0x2d640a[_0xa461('0x5')]]['queuecallerabandon']=![];queues[_0x2d640a[_0xa461('0x5')]][_0xa461('0x2a')]=null;queues[_0x2d640a['uniqueid']]['queuecallerexit']=![];queues[_0x2d640a[_0xa461('0x5')]][_0xa461('0xb')]=null;queues[_0x2d640a['uniqueid']][_0xa461('0x2b')]=null;queues[_0x2d640a[_0xa461('0x5')]][_0xa461('0x3a')]=!![];queues[_0x2d640a[_0xa461('0x5')]][_0xa461('0xa')]=_0x2d640a[_0xa461('0x39')];queues[_0x2d640a[_0xa461('0x5')]]['lastAssignedTo']=_0x2d640a[_0xa461('0x3b')];}}catch(_0x20a9e4){utils[_0xa461('0x14')](util[_0xa461('0x4')](_0xa461('0x37'),_0x2d640a['uniqueid']),_0x20a9e4);}};exports[_0xa461('0x3c')]=function(_0x4faf0d){try{if(!_[_0xa461('0x16')](queues[_0x4faf0d[_0xa461('0x5')]])){if(queues[_0x4faf0d[_0xa461('0x5')]][_0xa461('0x3d')]){utils[_0xa461('0x10')](util[_0xa461('0x4')](_0xa461('0x3e'),_0x4faf0d[_0xa461('0x5')]),_0x4faf0d);queues[_0x4faf0d['uniqueid']][_0xa461('0x18')]=![];queues[_0x4faf0d['uniqueid']][_0xa461('0x18')]=![];queues[_0x4faf0d[_0xa461('0x5')]][_0xa461('0x2a')]=null;queues[_0x4faf0d['uniqueid']]['queuecallerexit']=![];queues[_0x4faf0d['uniqueid']][_0xa461('0x2b')]=null;queues[_0x4faf0d[_0xa461('0x5')]][_0xa461('0x3a')]=!![];queues[_0x4faf0d['uniqueid']][_0xa461('0x8')]=_0x4faf0d[_0xa461('0x3b')];queues[_0x4faf0d['uniqueid']][_0xa461('0x1a')]=!![];queues[_0x4faf0d[_0xa461('0x5')]][_0xa461('0x1b')]=utils['now']();if(_0x4faf0d[_0xa461('0x3f')]==_0xa461('0x40')){if(!queues[_0x4faf0d['uniqueid']][_0xa461('0x40')]){queues[_0x4faf0d[_0xa461('0x5')]][_0xa461('0xb')]=_0xa461('0x41');}}else{queues[_0x4faf0d[_0xa461('0x5')]]['queuecallerexitreason']='COMPLETEDBY'+_0x4faf0d[_0xa461('0x3f')][_0xa461('0x26')]();}utils['info'](util[_0xa461('0x4')](_0xa461('0x42'),_0x4faf0d[_0xa461('0x5')],queues[_0x4faf0d[_0xa461('0x5')]][_0xa461('0x1e')],_0x4faf0d[_0xa461('0x3b')],queues[_0x4faf0d['uniqueid']][_0xa461('0xb')]));writeDB(queues[_0x4faf0d[_0xa461('0x5')]]);}}}catch(_0x1cfc34){utils['error'](util[_0xa461('0x4')](_0xa461('0x3e'),_0x4faf0d[_0xa461('0x5')]),_0x1cfc34);}};exports[_0xa461('0x43')]=function(_0x52a020){try{if(!_[_0xa461('0x16')](queues[_0x52a020[_0xa461('0x44')]])){utils['debug'](util[_0xa461('0x4')](_0xa461('0x45'),_0x52a020[_0xa461('0x5')]),_0x52a020);queues[_0x52a020[_0xa461('0x44')]]['transfer']=!![];queues[_0x52a020[_0xa461('0x44')]]['transfertype']='BLIND';queues[_0x52a020[_0xa461('0x44')]][_0xa461('0x46')]=_0x52a020[_0xa461('0x47')];queues[_0x52a020[_0xa461('0x44')]][_0xa461('0x48')]=_0x52a020['transfereeuniqueid'];queues[_0x52a020[_0xa461('0x44')]][_0xa461('0xb')]='BLINDTRANSFER';utils[_0xa461('0x3')](util[_0xa461('0x4')](_0xa461('0x49'),_0x52a020[_0xa461('0x5')],queues[_0x52a020[_0xa461('0x44')]]['name'],_0x52a020[_0xa461('0x44')],_0x52a020['extension']));}}catch(_0x25a7da){utils[_0xa461('0x14')](util[_0xa461('0x4')](_0xa461('0x45'),_0x52a020[_0xa461('0x5')]),_0x25a7da);}};exports['attendedtransfer']=function(_0x3f2bde){try{utils[_0xa461('0x10')](util[_0xa461('0x4')](_0xa461('0x4a'),_0x3f2bde[_0xa461('0x4b')]),_0x3f2bde);if(_0x3f2bde[_0xa461('0x4b')]==_0x3f2bde[_0xa461('0x4c')]){if(!_[_0xa461('0x16')](queues[_0x3f2bde[_0xa461('0x4d')]])){utils['info'](util[_0xa461('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x3f2bde[_0xa461('0x4b')],queues[_0x3f2bde[_0xa461('0x4d')]]['name'],_0x3f2bde[_0xa461('0x4e')]));queues[_0x3f2bde['secondtransfererlinkedid']][_0xa461('0x40')]=!![];queues[_0x3f2bde[_0xa461('0x4d')]][_0xa461('0x4f')]=_0xa461('0x50');queues[_0x3f2bde[_0xa461('0x4d')]][_0xa461('0x46')]=_0x3f2bde['origtransfererexten'];queues[_0x3f2bde[_0xa461('0x4d')]][_0xa461('0x48')]=_0x3f2bde['origtransfereruniqueid'];queues[_0x3f2bde[_0xa461('0x4d')]][_0xa461('0xb')]=_0xa461('0x51');}if(!_[_0xa461('0x16')](queues[_0x3f2bde['origtransfererlinkedid']])){if(_0x3f2bde[_0xa461('0x52')]&&queues[_0x3f2bde[_0xa461('0x52')]]){queues[_0x3f2bde[_0xa461('0x52')]][_0xa461('0x20')]=0x1;queues[_0x3f2bde['transfereeuniqueid']]=_[_0xa461('0x53')](queues[_0x3f2bde[_0xa461('0x52')]]);queues[_0x3f2bde[_0xa461('0x44')]]['transfereduniqueid']=_0x3f2bde[_0xa461('0x54')];queues[_0x3f2bde['transfereeuniqueid']][_0xa461('0x20')]=0x2;queues[_0x3f2bde[_0xa461('0x44')]][_0xa461('0x9')]=queues[_0x3f2bde[_0xa461('0x4d')]][_0xa461('0x9')];queues[_0x3f2bde['transfereeuniqueid']][_0xa461('0x55')]=queues[_0x3f2bde[_0xa461('0x4d')]][_0xa461('0x55')];queues[_0x3f2bde[_0xa461('0x44')]][_0xa461('0x34')]=utils['now']();queues[_0x3f2bde['transfereeuniqueid']][_0xa461('0x3d')]=utils[_0xa461('0x13')]();queues[_0x3f2bde[_0xa461('0x44')]][_0xa461('0x56')]=0x0;queues[_0x3f2bde['transfereeuniqueid']][_0xa461('0x57')]=0x0;utils[_0xa461('0x3')](util['format'](_0xa461('0x58'),_0x3f2bde[_0xa461('0x4b')],queues[_0x3f2bde[_0xa461('0x44')]][_0xa461('0x1e')],queues[_0x3f2bde[_0xa461('0x44')]][_0xa461('0x9')],queues[_0x3f2bde[_0xa461('0x44')]][_0xa461('0x55')]));}else{utils['info'](util[_0xa461('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x3f2bde[_0xa461('0x4b')],queues[_0x3f2bde[_0xa461('0x4c')]][_0xa461('0x1e')],_0x3f2bde[_0xa461('0x4d')]));queues[_0x3f2bde[_0xa461('0x4c')]][_0xa461('0xe')]=_0x3f2bde[_0xa461('0x4d')];}}}else if(_0x3f2bde[_0xa461('0x59')]==_0x3f2bde['secondtransfererlinkedid']){if(!_['isNil'](queues[_0x3f2bde[_0xa461('0x4c')]])){utils[_0xa461('0x3')](util[_0xa461('0x4')](_0xa461('0x5a'),_0x3f2bde[_0xa461('0x4b')],queues[_0x3f2bde[_0xa461('0x4c')]][_0xa461('0x1e')],_0x3f2bde['secondtransfereruniqueid'],_0x3f2bde['secondtransfererexten']));queues[_0x3f2bde['origtransfererlinkedid']][_0xa461('0x40')]=!![];queues[_0x3f2bde[_0xa461('0x4c')]][_0xa461('0x4f')]=_0xa461('0x50');queues[_0x3f2bde[_0xa461('0x4c')]][_0xa461('0x46')]=_0x3f2bde[_0xa461('0x5b')];queues[_0x3f2bde['origtransfererlinkedid']][_0xa461('0x48')]=_0x3f2bde[_0xa461('0x59')];queues[_0x3f2bde['origtransfererlinkedid']][_0xa461('0xb')]=_0xa461('0x51');}if(!_[_0xa461('0x16')](queues[_0x3f2bde[_0xa461('0x4d')]])){if(_0x3f2bde[_0xa461('0x5c')]&&queues[_0x3f2bde['transfertargetlinkedid']]){queues[_0x3f2bde[_0xa461('0x5c')]]['queuecallerenterreason']=0x1;queues[_0x3f2bde['transfertargetuniqueid']]=_[_0xa461('0x53')](queues[_0x3f2bde[_0xa461('0x5c')]]);queues[_0x3f2bde[_0xa461('0x54')]][_0xa461('0xe')]=_0x3f2bde[_0xa461('0x54')];queues[_0x3f2bde[_0xa461('0x54')]][_0xa461('0x20')]=0x2;queues[_0x3f2bde[_0xa461('0x54')]][_0xa461('0x9')]=queues[_0x3f2bde[_0xa461('0x4c')]][_0xa461('0x9')];queues[_0x3f2bde[_0xa461('0x54')]][_0xa461('0x55')]=queues[_0x3f2bde[_0xa461('0x4c')]][_0xa461('0x55')];queues[_0x3f2bde['transfertargetuniqueid']][_0xa461('0x34')]=utils[_0xa461('0x13')]();queues[_0x3f2bde['transfertargetuniqueid']][_0xa461('0x3d')]=utils[_0xa461('0x13')]();queues[_0x3f2bde['transfertargetuniqueid']][_0xa461('0x56')]=0x0;queues[_0x3f2bde['transfertargetuniqueid']][_0xa461('0x57')]=0x0;utils[_0xa461('0x3')](util[_0xa461('0x4')](_0xa461('0x5d'),_0x3f2bde[_0xa461('0x4b')],queues[_0x3f2bde[_0xa461('0x54')]][_0xa461('0x1e')],queues[_0x3f2bde[_0xa461('0x54')]]['transfereduniqueid'],queues[_0x3f2bde[_0xa461('0x54')]][_0xa461('0x9')],queues[_0x3f2bde['transfertargetuniqueid']][_0xa461('0x55')]));}else{utils[_0xa461('0x3')](util[_0xa461('0x4')](_0xa461('0x5e'),_0x3f2bde[_0xa461('0x4b')],queues[_0x3f2bde[_0xa461('0x4d')]][_0xa461('0x1e')],_0x3f2bde[_0xa461('0x4c')]));queues[_0x3f2bde[_0xa461('0x4d')]][_0xa461('0xe')]=_0x3f2bde[_0xa461('0x4c')];}}}}catch(_0x486401){utils[_0xa461('0x14')](util[_0xa461('0x4')](_0xa461('0x4a'),_0x3f2bde[_0xa461('0x4b')]),_0x486401);}};exports[_0xa461('0x5f')]=function(_0x19f3ff){try{if(!_[_0xa461('0x16')](queues[_0x19f3ff[_0xa461('0x5')]])){utils[_0xa461('0x10')](util['format'](_0xa461('0x60'),_0x19f3ff[_0xa461('0x5')]),_0x19f3ff);queues[_0x19f3ff[_0xa461('0x5')]][_0xa461('0x61')]=utils[_0xa461('0x13')]();utils['info'](util[_0xa461('0x4')](_0xa461('0x62'),_0x19f3ff[_0xa461('0x5')],queues[_0x19f3ff['uniqueid']]['name'],queues[_0x19f3ff[_0xa461('0x5')]][_0xa461('0x61')]));}}catch(_0x2a664a){utils['error'](util[_0xa461('0x4')](_0xa461('0x60'),_0x19f3ff[_0xa461('0x5')]),_0x2a664a);}};exports['musiconholdstop']=function(_0x56b9be){try{if(!_[_0xa461('0x16')](queues[_0x56b9be[_0xa461('0x5')]])){if(!_[_0xa461('0x16')](queues[_0x56b9be[_0xa461('0x5')]][_0xa461('0x61')])){utils[_0xa461('0x10')](util[_0xa461('0x4')]('[%s][queues][musiconholdstop]',_0x56b9be[_0xa461('0x5')]),_0x56b9be);queues[_0x56b9be[_0xa461('0x5')]][_0xa461('0x57')]+=utils[_0xa461('0x33')](utils[_0xa461('0x13')](),queues[_0x56b9be[_0xa461('0x5')]][_0xa461('0x61')]);utils[_0xa461('0x3')](util[_0xa461('0x4')](_0xa461('0x63'),_0x56b9be[_0xa461('0x5')],queues[_0x56b9be[_0xa461('0x5')]][_0xa461('0x1e')],queues[_0x56b9be['uniqueid']][_0xa461('0x57')]));delete queues[_0x56b9be[_0xa461('0x5')]][_0xa461('0x61')];}}}catch(_0x1306ce){utils[_0xa461('0x14')](util['format'](_0xa461('0x64'),_0x56b9be[_0xa461('0x5')]),_0x1306ce);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 4a9444b..fce8784 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 _0x2fa9=['accountcode','then','membername','name','UserId','request','CreateVoiceRecording','debug','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','newstate','[%s][recordings][newstate]','isNil','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','error','varset','variable','mixmonitor_filename','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','.wav49','replace','find','monitors','push','[%s][recordings][varset]','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','forEach','clone','newexten','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','appdata','split','lastIndexOf','[%s][recordings][newexten]','queue','[%s][recordings][queuecallerjoin]','[%s][recordings][blindtransfer]','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','transfereecalleridname','transfereruniqueid','recording','util','./transfers.controller','info','format','[%s][recordings][writeDB]','uniqueid','blinds'];(function(_0x241846,_0x17d261){var _0xa940de=function(_0xc68639){while(--_0xc68639){_0x241846['push'](_0x241846['shift']());}};_0xa940de(++_0x17d261);}(_0x2fa9,0xb9));var _0x92fa=function(_0x342773,_0x386fd7){_0x342773=_0x342773-0x0;var _0x4f023e=_0x2fa9[_0x342773];return _0x4f023e;};'use strict';var _=require('lodash');var util=require(_0x92fa('0x0'));var utils=require('./utils');var transfers=require(_0x92fa('0x1'));var recordings={};function writeDB(_0x118c3b){var _0x41c34b;utils[_0x92fa('0x2')](util[_0x92fa('0x3')](_0x92fa('0x4'),_0x118c3b[_0x92fa('0x5')]));if(transfers[_0x92fa('0x6')][_0x118c3b['uniqueid']]){_0x41c34b=_0x118c3b[_0x92fa('0x5')];_0x118c3b[_0x92fa('0x5')]=transfers['blinds'][_0x118c3b[_0x92fa('0x5')]]['transfereeuniqueid'];}if(_0x118c3b[_0x92fa('0x7')]){utils['getUserByInternal'](_0x118c3b[_0x92fa('0x7')])[_0x92fa('0x8')](function(_0x8ed2db){if(_0x8ed2db){_0x118c3b[_0x92fa('0x9')]=_0x8ed2db[_0x92fa('0xa')];_0x118c3b[_0x92fa('0xb')]=_0x8ed2db['id'];}utils[_0x92fa('0xc')](_0x92fa('0xd'),_0x118c3b);});}else{utils[_0x92fa('0xc')]('CreateVoiceRecording',_0x118c3b);}if(_0x41c34b)delete transfers[_0x92fa('0x6')][_0x41c34b];}exports['newchannel']=function(_0x529978){try{utils[_0x92fa('0xe')](util[_0x92fa('0x3')](_0x92fa('0xf'),_0x529978[_0x92fa('0x5')]),_0x529978);if(_0x529978[_0x92fa('0x5')]==_0x529978[_0x92fa('0x10')]){utils[_0x92fa('0x2')](util['format'](_0x92fa('0x11'),_0x529978[_0x92fa('0x5')],_0x529978[_0x92fa('0x12')],_0x529978[_0x92fa('0x13')]));recordings[_0x529978[_0x92fa('0x5')]]={'uniqueid':_0x529978[_0x92fa('0x5')],'accountcode':_0x529978[_0x92fa('0x7')],'exten':_0x529978[_0x92fa('0x13')],'context':_0x529978[_0x92fa('0x12')],'channel':_0x529978[_0x92fa('0x14')],'monitors':[]};}}catch(_0x1335a5){utils['error'](util['format'](_0x92fa('0xf'),_0x529978[_0x92fa('0x5')]),_0x1335a5);}};exports[_0x92fa('0x15')]=function(_0x99ea91){try{utils[_0x92fa('0xe')](util[_0x92fa('0x3')](_0x92fa('0x16'),_0x99ea91['uniqueid']),_0x99ea91);if(!_[_0x92fa('0x17')](recordings[_0x99ea91['uniqueid']])&&_0x99ea91['channelstate']==0x6){utils[_0x92fa('0x2')](util[_0x92fa('0x3')]('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0x99ea91['uniqueid'],_0x99ea91[_0x92fa('0x12')],_0x99ea91[_0x92fa('0x14')]));}else if(!_[_0x92fa('0x17')](recordings[_0x99ea91[_0x92fa('0x10')]])&&_0x99ea91['channelstate']==0x6&&_0x99ea91[_0x92fa('0x12')]!=_0x92fa('0x18')){utils[_0x92fa('0x2')](util[_0x92fa('0x3')](_0x92fa('0x19'),_0x99ea91[_0x92fa('0x5')],_0x99ea91[_0x92fa('0x10')],_0x99ea91['context'],_0x99ea91[_0x92fa('0x14')]));recordings[_0x99ea91[_0x92fa('0x10')]][_0x92fa('0x7')]=_0x99ea91['accountcode'];}}catch(_0x41e5e6){utils[_0x92fa('0x1a')](util[_0x92fa('0x3')](_0x92fa('0x16'),_0x99ea91[_0x92fa('0x5')]),_0x41e5e6);}};exports[_0x92fa('0x1b')]=function(_0x5392f2){try{if(!_['isNil'](_0x5392f2['variable'])&&!_[_0x92fa('0x17')](_0x5392f2[_0x92fa('0x1c')][_0x92fa('0x1d')])){utils[_0x92fa('0xe')](util[_0x92fa('0x3')]('[%s][recordings][varset]',_0x5392f2['uniqueid']),_0x5392f2);utils['info'](util[_0x92fa('0x3')](_0x92fa('0x1e'),_0x5392f2[_0x92fa('0x5')],_0x5392f2['variable'],_0x5392f2[_0x92fa('0x1f')]));if(_['endsWith'](_0x5392f2[_0x92fa('0x1f')],_0x92fa('0x20'))){_0x5392f2[_0x92fa('0x1f')]=_0x5392f2[_0x92fa('0x1f')][_0x92fa('0x21')](_0x92fa('0x20'),'.WAV');}if(recordings[_0x5392f2[_0x92fa('0x10')]]){var _0x25ccc9=_[_0x92fa('0x22')](recordings[_0x5392f2[_0x92fa('0x10')]][_0x92fa('0x23')],{'value':_0x5392f2['value']});if(_[_0x92fa('0x17')](_0x25ccc9)){recordings[_0x5392f2[_0x92fa('0x10')]][_0x92fa('0x23')][_0x92fa('0x24')]({'value':_0x5392f2[_0x92fa('0x1f')]});}}}}catch(_0x58b26a){utils[_0x92fa('0x1a')](util[_0x92fa('0x3')](_0x92fa('0x25'),_0x5392f2[_0x92fa('0x5')]),_0x58b26a);}};exports['hangup']=function(_0x4f15b4){try{if(!_[_0x92fa('0x17')](recordings[_0x4f15b4[_0x92fa('0x5')]])){utils['debug'](util[_0x92fa('0x3')](_0x92fa('0x26'),_0x4f15b4[_0x92fa('0x5')]),_0x4f15b4);utils[_0x92fa('0x2')](util[_0x92fa('0x3')](_0x92fa('0x27'),_0x4f15b4[_0x92fa('0x5')],_0x4f15b4[_0x92fa('0x28')],_0x4f15b4[_0x92fa('0x29')],_0x4f15b4[_0x92fa('0x2a')]));recordings[_0x4f15b4[_0x92fa('0x5')]][_0x92fa('0x28')]=_0x4f15b4['calleridnum'];recordings[_0x4f15b4[_0x92fa('0x5')]][_0x92fa('0x29')]=_0x4f15b4[_0x92fa('0x29')];recordings[_0x4f15b4[_0x92fa('0x5')]]['connectedlinenum']=_0x4f15b4[_0x92fa('0x2b')];recordings[_0x4f15b4[_0x92fa('0x5')]][_0x92fa('0x2c')]=_0x4f15b4['connectedlinename'];if(recordings[_0x4f15b4[_0x92fa('0x5')]]['type']=='outbound'&&recordings[_0x4f15b4[_0x92fa('0x5')]]['accountcode']){recordings[_0x4f15b4['uniqueid']][_0x92fa('0x2b')]=recordings[_0x4f15b4[_0x92fa('0x5')]][_0x92fa('0x7')];recordings[_0x4f15b4[_0x92fa('0x5')]]['connectedlinename']='';}recordings[_0x4f15b4[_0x92fa('0x5')]][_0x92fa('0x23')][_0x92fa('0x2d')](function(_0x248651){var _0x5a37b7=_[_0x92fa('0x2e')](recordings[_0x4f15b4[_0x92fa('0x5')]]);_0x5a37b7[_0x92fa('0x1f')]=_0x248651[_0x92fa('0x1f')];writeDB(_0x5a37b7);});delete recordings[_0x4f15b4[_0x92fa('0x5')]];}}catch(_0x599533){utils['error'](util[_0x92fa('0x3')](_0x92fa('0x26'),_0x4f15b4[_0x92fa('0x5')]),_0x599533);}};exports[_0x92fa('0x2f')]=function(_0x1fa5ee){try{if(!_[_0x92fa('0x17')](recordings[_0x1fa5ee[_0x92fa('0x5')]])){utils[_0x92fa('0xe')](util[_0x92fa('0x3')]('[%s][recordings][newexten]',_0x1fa5ee['uniqueid']),_0x1fa5ee);utils[_0x92fa('0x2')](util[_0x92fa('0x3')](_0x92fa('0x30'),_0x1fa5ee[_0x92fa('0x5')],_0x1fa5ee[_0x92fa('0x31')],_0x1fa5ee['appdata']));if(_0x1fa5ee[_0x92fa('0x31')][_0x92fa('0x32')]()==_0x92fa('0x33')&&_['startsWith'](_0x1fa5ee[_0x92fa('0x34')]['toLowerCase'](),'cdr')){var _0x17a635=_0x1fa5ee[_0x92fa('0x34')][_0x92fa('0x35')]('=');var _0x167ae=_0x17a635[0x0]['substring'](_0x17a635[0x0][_0x92fa('0x36')]('(')+0x1,_0x17a635[0x0]['lastIndexOf'](')'));var _0x17d3d9=_0x17a635[0x1];recordings[_0x1fa5ee[_0x92fa('0x5')]][_0x167ae]=_0x17d3d9;}}}catch(_0x3c7712){utils[_0x92fa('0x1a')](util[_0x92fa('0x3')](_0x92fa('0x37'),_0x1fa5ee[_0x92fa('0x5')]),_0x3c7712);}};exports['queuecallerjoin']=function(_0x25c51a){try{if(!_[_0x92fa('0x17')](recordings[_0x25c51a['uniqueid']])){utils[_0x92fa('0xe')](util['format']('[%s][recordings][queuecallerjoin]',_0x25c51a[_0x92fa('0x5')]),_0x25c51a);utils['info'](util[_0x92fa('0x3')]('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x25c51a['uniqueid'],_0x25c51a[_0x92fa('0x38')]));recordings[_0x25c51a[_0x92fa('0x5')]][_0x92fa('0x38')]=_0x25c51a[_0x92fa('0x38')];}}catch(_0x5f0ef3){utils[_0x92fa('0x1a')](util[_0x92fa('0x3')](_0x92fa('0x39'),_0x25c51a['uniqueid']),_0x5f0ef3);}};exports['blindtransfer']=function(_0x2955eb){try{utils[_0x92fa('0xe')](util[_0x92fa('0x3')](_0x92fa('0x3a'),_0x2955eb['uniqueid']),_0x2955eb);utils[_0x92fa('0x2')](util[_0x92fa('0x3')](_0x92fa('0x3b'),_0x2955eb[_0x92fa('0x5')],_0x2955eb['transferercalleridnum'],_0x2955eb[_0x92fa('0x3c')],_0x2955eb['transfereecalleridnum'],_0x2955eb[_0x92fa('0x3d')]));if(recordings[_0x2955eb[_0x92fa('0x3e')]]&&transfers['blinds'][_0x2955eb['transfereruniqueid']]){transfers[_0x92fa('0x6')][_0x2955eb[_0x92fa('0x3e')]][_0x92fa('0x3f')]=!![];}}catch(_0x53a6d2){utils['error'](util['format'](_0x92fa('0x3a'),_0x2955eb['uniqueid']),_0x53a6d2);}}; \ No newline at end of file +var _0x7fb6=['accountcode','then','membername','name','request','CreateVoiceRecording','newchannel','format','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','debug','[%s][recordings][varset]','value','endsWith','replace','.wav49','.WAV','monitors','hangup','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','cause-txt','calleridname','connectedlinenum','connectedlinename','type','forEach','clone','[%s][recordings][hangup]','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','appdata','toLowerCase','set','startsWith','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','[%s][recordings][blindtransfer]','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transfereecalleridnum','transfereecalleridname','transfereruniqueid','recording','lodash','./utils','./transfers.controller','info','uniqueid','blinds'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x7fb6,0x192));var _0x67fb=function(_0x4a98be,_0x274857){_0x4a98be=_0x4a98be-0x0;var _0x45607c=_0x7fb6[_0x4a98be];return _0x45607c;};'use strict';var _=require(_0x67fb('0x0'));var util=require('util');var utils=require(_0x67fb('0x1'));var transfers=require(_0x67fb('0x2'));var recordings={};function writeDB(_0x5e66b8){var _0x45e129;utils[_0x67fb('0x3')](util['format']('[%s][recordings][writeDB]',_0x5e66b8[_0x67fb('0x4')]));if(transfers['blinds'][_0x5e66b8[_0x67fb('0x4')]]){_0x45e129=_0x5e66b8[_0x67fb('0x4')];_0x5e66b8[_0x67fb('0x4')]=transfers[_0x67fb('0x5')][_0x5e66b8[_0x67fb('0x4')]]['transfereeuniqueid'];}if(_0x5e66b8[_0x67fb('0x6')]){utils['getUserByInternal'](_0x5e66b8['accountcode'])[_0x67fb('0x7')](function(_0x18acac){if(_0x18acac){_0x5e66b8[_0x67fb('0x8')]=_0x18acac[_0x67fb('0x9')];_0x5e66b8['UserId']=_0x18acac['id'];}utils[_0x67fb('0xa')](_0x67fb('0xb'),_0x5e66b8);});}else{utils[_0x67fb('0xa')](_0x67fb('0xb'),_0x5e66b8);}if(_0x45e129)delete transfers['blinds'][_0x45e129];}exports[_0x67fb('0xc')]=function(_0x2609c9){try{utils['debug'](util[_0x67fb('0xd')](_0x67fb('0xe'),_0x2609c9[_0x67fb('0x4')]),_0x2609c9);if(_0x2609c9[_0x67fb('0x4')]==_0x2609c9[_0x67fb('0xf')]){utils[_0x67fb('0x3')](util['format'](_0x67fb('0x10'),_0x2609c9[_0x67fb('0x4')],_0x2609c9[_0x67fb('0x11')],_0x2609c9['exten']));recordings[_0x2609c9[_0x67fb('0x4')]]={'uniqueid':_0x2609c9['uniqueid'],'accountcode':_0x2609c9[_0x67fb('0x6')],'exten':_0x2609c9[_0x67fb('0x12')],'context':_0x2609c9[_0x67fb('0x11')],'channel':_0x2609c9[_0x67fb('0x13')],'monitors':[]};}}catch(_0x30192f){utils[_0x67fb('0x14')](util[_0x67fb('0xd')](_0x67fb('0xe'),_0x2609c9[_0x67fb('0x4')]),_0x30192f);}};exports['newstate']=function(_0x4efeac){try{utils['debug'](util[_0x67fb('0xd')](_0x67fb('0x15'),_0x4efeac[_0x67fb('0x4')]),_0x4efeac);if(!_[_0x67fb('0x16')](recordings[_0x4efeac[_0x67fb('0x4')]])&&_0x4efeac[_0x67fb('0x17')]==0x6){utils[_0x67fb('0x3')](util[_0x67fb('0xd')](_0x67fb('0x18'),_0x4efeac[_0x67fb('0x4')],_0x4efeac[_0x67fb('0x11')],_0x4efeac[_0x67fb('0x13')]));}else if(!_[_0x67fb('0x16')](recordings[_0x4efeac[_0x67fb('0xf')]])&&_0x4efeac[_0x67fb('0x17')]==0x6&&_0x4efeac[_0x67fb('0x11')]!=_0x67fb('0x19')){utils[_0x67fb('0x3')](util[_0x67fb('0xd')](_0x67fb('0x1a'),_0x4efeac['uniqueid'],_0x4efeac[_0x67fb('0xf')],_0x4efeac['context'],_0x4efeac[_0x67fb('0x13')]));recordings[_0x4efeac[_0x67fb('0xf')]][_0x67fb('0x6')]=_0x4efeac[_0x67fb('0x6')];}}catch(_0x252dfe){utils[_0x67fb('0x14')](util['format']('[%s][recordings][newstate]',_0x4efeac[_0x67fb('0x4')]),_0x252dfe);}};exports[_0x67fb('0x1b')]=function(_0x27ba5d){try{if(!_['isNil'](_0x27ba5d[_0x67fb('0x1c')])&&!_[_0x67fb('0x16')](_0x27ba5d[_0x67fb('0x1c')]['mixmonitor_filename'])){utils[_0x67fb('0x1d')](util[_0x67fb('0xd')](_0x67fb('0x1e'),_0x27ba5d[_0x67fb('0x4')]),_0x27ba5d);utils[_0x67fb('0x3')](util['format']('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x27ba5d[_0x67fb('0x4')],_0x27ba5d[_0x67fb('0x1c')],_0x27ba5d[_0x67fb('0x1f')]));if(_[_0x67fb('0x20')](_0x27ba5d[_0x67fb('0x1f')],'.wav49')){_0x27ba5d[_0x67fb('0x1f')]=_0x27ba5d[_0x67fb('0x1f')][_0x67fb('0x21')](_0x67fb('0x22'),_0x67fb('0x23'));}if(recordings[_0x27ba5d[_0x67fb('0xf')]]){var _0x449cab=_['find'](recordings[_0x27ba5d[_0x67fb('0xf')]][_0x67fb('0x24')],{'value':_0x27ba5d['value']});if(_[_0x67fb('0x16')](_0x449cab)){recordings[_0x27ba5d[_0x67fb('0xf')]][_0x67fb('0x24')]['push']({'value':_0x27ba5d[_0x67fb('0x1f')]});}}}}catch(_0x166050){utils[_0x67fb('0x14')](util[_0x67fb('0xd')](_0x67fb('0x1e'),_0x27ba5d[_0x67fb('0x4')]),_0x166050);}};exports[_0x67fb('0x25')]=function(_0x5642d5){try{if(!_[_0x67fb('0x16')](recordings[_0x5642d5[_0x67fb('0x4')]])){utils[_0x67fb('0x1d')](util[_0x67fb('0xd')]('[%s][recordings][hangup]',_0x5642d5['uniqueid']),_0x5642d5);utils[_0x67fb('0x3')](util[_0x67fb('0xd')](_0x67fb('0x26'),_0x5642d5[_0x67fb('0x4')],_0x5642d5[_0x67fb('0x27')],_0x5642d5['calleridname'],_0x5642d5[_0x67fb('0x28')]));recordings[_0x5642d5['uniqueid']]['calleridnum']=_0x5642d5[_0x67fb('0x27')];recordings[_0x5642d5[_0x67fb('0x4')]][_0x67fb('0x29')]=_0x5642d5['calleridname'];recordings[_0x5642d5['uniqueid']][_0x67fb('0x2a')]=_0x5642d5[_0x67fb('0x2a')];recordings[_0x5642d5['uniqueid']][_0x67fb('0x2b')]=_0x5642d5[_0x67fb('0x2b')];if(recordings[_0x5642d5[_0x67fb('0x4')]][_0x67fb('0x2c')]=='outbound'&&recordings[_0x5642d5[_0x67fb('0x4')]][_0x67fb('0x6')]){recordings[_0x5642d5[_0x67fb('0x4')]][_0x67fb('0x2a')]=recordings[_0x5642d5[_0x67fb('0x4')]][_0x67fb('0x6')];recordings[_0x5642d5[_0x67fb('0x4')]][_0x67fb('0x2b')]='';}recordings[_0x5642d5[_0x67fb('0x4')]][_0x67fb('0x24')][_0x67fb('0x2d')](function(_0x73fe95){var _0x59a8a9=_[_0x67fb('0x2e')](recordings[_0x5642d5[_0x67fb('0x4')]]);_0x59a8a9[_0x67fb('0x1f')]=_0x73fe95[_0x67fb('0x1f')];writeDB(_0x59a8a9);});delete recordings[_0x5642d5[_0x67fb('0x4')]];}}catch(_0x36aab7){utils[_0x67fb('0x14')](util[_0x67fb('0xd')](_0x67fb('0x2f'),_0x5642d5[_0x67fb('0x4')]),_0x36aab7);}};exports[_0x67fb('0x30')]=function(_0x43a539){try{if(!_[_0x67fb('0x16')](recordings[_0x43a539[_0x67fb('0x4')]])){utils[_0x67fb('0x1d')](util['format'](_0x67fb('0x31'),_0x43a539[_0x67fb('0x4')]),_0x43a539);utils[_0x67fb('0x3')](util[_0x67fb('0xd')](_0x67fb('0x32'),_0x43a539['uniqueid'],_0x43a539['application'],_0x43a539[_0x67fb('0x33')]));if(_0x43a539['application'][_0x67fb('0x34')]()==_0x67fb('0x35')&&_[_0x67fb('0x36')](_0x43a539['appdata']['toLowerCase'](),'cdr')){var _0x4d90d3=_0x43a539['appdata']['split']('=');var _0xa1fbd7=_0x4d90d3[0x0][_0x67fb('0x37')](_0x4d90d3[0x0][_0x67fb('0x38')]('(')+0x1,_0x4d90d3[0x0][_0x67fb('0x38')](')'));var _0xf77eb0=_0x4d90d3[0x1];recordings[_0x43a539[_0x67fb('0x4')]][_0xa1fbd7]=_0xf77eb0;}}}catch(_0x5ce801){utils[_0x67fb('0x14')](util[_0x67fb('0xd')](_0x67fb('0x31'),_0x43a539[_0x67fb('0x4')]),_0x5ce801);}};exports[_0x67fb('0x39')]=function(_0x4f61f2){try{if(!_[_0x67fb('0x16')](recordings[_0x4f61f2['uniqueid']])){utils[_0x67fb('0x1d')](util[_0x67fb('0xd')](_0x67fb('0x3a'),_0x4f61f2['uniqueid']),_0x4f61f2);utils[_0x67fb('0x3')](util[_0x67fb('0xd')](_0x67fb('0x3b'),_0x4f61f2[_0x67fb('0x4')],_0x4f61f2[_0x67fb('0x3c')]));recordings[_0x4f61f2[_0x67fb('0x4')]]['queue']=_0x4f61f2['queue'];}}catch(_0x11992c){utils['error'](util[_0x67fb('0xd')]('[%s][recordings][queuecallerjoin]',_0x4f61f2['uniqueid']),_0x11992c);}};exports['blindtransfer']=function(_0x1529ce){try{utils[_0x67fb('0x1d')](util[_0x67fb('0xd')](_0x67fb('0x3d'),_0x1529ce[_0x67fb('0x4')]),_0x1529ce);utils['info'](util[_0x67fb('0xd')](_0x67fb('0x3e'),_0x1529ce['uniqueid'],_0x1529ce[_0x67fb('0x3f')],_0x1529ce['transferercalleridname'],_0x1529ce[_0x67fb('0x40')],_0x1529ce[_0x67fb('0x41')]));if(recordings[_0x1529ce['transfereruniqueid']]&&transfers[_0x67fb('0x5')][_0x1529ce[_0x67fb('0x42')]]){transfers[_0x67fb('0x5')][_0x1529ce[_0x67fb('0x42')]][_0x67fb('0x43')]=!![];}}catch(_0x5233f7){utils['error'](util[_0x67fb('0xd')](_0x67fb('0x3d'),_0x1529ce[_0x67fb('0x4')]),_0x5233f7);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 7d90e87..bde4291 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 _0x0079=['debug','[%s][transfers][blindtransfer]','uniqueid','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','blind','blinds','transfereruniqueid','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransfererexten','origtransfererlinkedid','origtransferercontext','isNil','transfereechannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','error','lodash','util','info','format','[%s][transfers][writeDB]\x20type:%s','type','origtransfereruniqueid','request','CreateVoiceTransferReport','blindtransfer'];(function(_0x2ccc78,_0x2769e1){var _0x292a45=function(_0x119576){while(--_0x119576){_0x2ccc78['push'](_0x2ccc78['shift']());}};_0x292a45(++_0x2769e1);}(_0x0079,0x9e));var _0x9007=function(_0x338779,_0x359875){_0x338779=_0x338779-0x0;var _0x53c8c0=_0x0079[_0x338779];return _0x53c8c0;};'use strict';var _=require(_0x9007('0x0'));var util=require(_0x9007('0x1'));var utils=require('./utils');function writeDB(_0x45f400){utils[_0x9007('0x2')](util[_0x9007('0x3')](_0x9007('0x4'),_0x45f400[_0x9007('0x5')]==='attended'?_0x45f400[_0x9007('0x6')]:_0x45f400['uniqueid'],_0x45f400[_0x9007('0x5')]));utils[_0x9007('0x7')](_0x9007('0x8'),_0x45f400);}exports['blinds']={};exports[_0x9007('0x9')]=function(_0x77045e){try{utils[_0x9007('0xa')](util[_0x9007('0x3')](_0x9007('0xb'),_0x77045e[_0x9007('0xc')]),_0x77045e);utils[_0x9007('0x2')](util[_0x9007('0x3')](_0x9007('0xd'),_0x77045e[_0x9007('0xc')],_0x77045e[_0x9007('0xe')],_0x77045e[_0x9007('0xf')],_0x77045e['transfereecalleridnum'],_0x77045e['transfereecalleridname']));_0x77045e[_0x9007('0x5')]=_0x9007('0x10');exports[_0x9007('0x11')][_0x77045e[_0x9007('0x12')]]=_0x77045e;writeDB(_0x77045e);}catch(_0x1bd3ae){utils['error'](util[_0x9007('0x3')](_0x9007('0xb'),_0x77045e[_0x9007('0xc')]),_0x1bd3ae);}};exports[_0x9007('0x13')]=function(_0x495e91){try{utils['debug'](util['format'](_0x9007('0x14'),_0x495e91['origtransfereruniqueid']),_0x495e91);utils['info'](util[_0x9007('0x3')](_0x9007('0x15'),_0x495e91[_0x9007('0x6')],_0x495e91[_0x9007('0x16')],_0x495e91[_0x9007('0x17')],_0x495e91[_0x9007('0x18')],_0x495e91[_0x9007('0x19')]));_0x495e91=_[_0x9007('0x1a')](_0x495e91,{'transfererchannel':_0x495e91[_0x9007('0x1b')],'transferercalleridnum':_0x495e91[_0x9007('0x16')],'transferercalleridname':_0x495e91[_0x9007('0x17')],'transfererconnectedlinenum':_0x495e91[_0x9007('0x1c')],'transfererconnectedlinename':_0x495e91[_0x9007('0x1d')],'transfereraccountcode':_0x495e91['origtransfereraccountcode'],'transferercontext':_0x495e91['secondtransferercontext'],'transfererexten':_0x495e91[_0x9007('0x1e')],'transfererlinkedid':_0x495e91[_0x9007('0x1f')],'context':_0x495e91[_0x9007('0x20')],'extension':_0x495e91['origtransfererexten'],'type':'attended'});if(_[_0x9007('0x21')](_0x495e91[_0x9007('0x22')])){_0x495e91=_[_0x9007('0x1a')](_0x495e91,{'transfereechannel':_0x495e91['transfertargetchannel'],'transfereecalleridnum':_0x495e91[_0x9007('0x18')],'transfereecalleridname':_0x495e91['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x495e91[_0x9007('0x23')],'transfereeconnectedlinename':_0x495e91[_0x9007('0x24')],'transfereeaccountcode':_0x495e91[_0x9007('0x25')],'transfereecontext':_0x495e91[_0x9007('0x26')],'transfereeexten':_0x495e91[_0x9007('0x27')],'transfereelinkedid':_0x495e91[_0x9007('0x28')]});}writeDB(_0x495e91);}catch(_0x11febe){utils[_0x9007('0x29')](util[_0x9007('0x3')](_0x9007('0x14'),_0x495e91[_0x9007('0x6')]),_0x11febe);}}; \ No newline at end of file +var _0xf315=['origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','util','./utils','format','type','attended','origtransfereruniqueid','uniqueid','CreateVoiceTransferReport','blinds','blindtransfer','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','blind','transfereruniqueid','error','attendedtransfer','[%s][transfers][attendedtransfer]','info','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s'];(function(_0x20268d,_0x205323){var _0xd010db=function(_0x476e08){while(--_0x476e08){_0x20268d['push'](_0x20268d['shift']());}};_0xd010db(++_0x205323);}(_0xf315,0xb8));var _0x5f31=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf315[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x5f31('0x0'));var utils=require(_0x5f31('0x1'));function writeDB(_0x439319){utils['info'](util[_0x5f31('0x2')]('[%s][transfers][writeDB]\x20type:%s',_0x439319[_0x5f31('0x3')]===_0x5f31('0x4')?_0x439319[_0x5f31('0x5')]:_0x439319[_0x5f31('0x6')],_0x439319['type']));utils['request'](_0x5f31('0x7'),_0x439319);}exports[_0x5f31('0x8')]={};exports[_0x5f31('0x9')]=function(_0x5107ea){try{utils[_0x5f31('0xa')](util[_0x5f31('0x2')](_0x5f31('0xb'),_0x5107ea['uniqueid']),_0x5107ea);utils['info'](util['format'](_0x5f31('0xc'),_0x5107ea[_0x5f31('0x6')],_0x5107ea[_0x5f31('0xd')],_0x5107ea['transferercalleridname'],_0x5107ea['transfereecalleridnum'],_0x5107ea['transfereecalleridname']));_0x5107ea[_0x5f31('0x3')]=_0x5f31('0xe');exports[_0x5f31('0x8')][_0x5107ea[_0x5f31('0xf')]]=_0x5107ea;writeDB(_0x5107ea);}catch(_0x5991a9){utils[_0x5f31('0x10')](util[_0x5f31('0x2')](_0x5f31('0xb'),_0x5107ea[_0x5f31('0x6')]),_0x5991a9);}};exports[_0x5f31('0x11')]=function(_0x3db4a0){try{utils[_0x5f31('0xa')](util[_0x5f31('0x2')](_0x5f31('0x12'),_0x3db4a0[_0x5f31('0x5')]),_0x3db4a0);utils[_0x5f31('0x13')](util[_0x5f31('0x2')](_0x5f31('0x14'),_0x3db4a0[_0x5f31('0x5')],_0x3db4a0[_0x5f31('0x15')],_0x3db4a0[_0x5f31('0x16')],_0x3db4a0[_0x5f31('0x17')],_0x3db4a0[_0x5f31('0x18')]));_0x3db4a0=_[_0x5f31('0x19')](_0x3db4a0,{'transfererchannel':_0x3db4a0[_0x5f31('0x1a')],'transferercalleridnum':_0x3db4a0[_0x5f31('0x15')],'transferercalleridname':_0x3db4a0[_0x5f31('0x16')],'transfererconnectedlinenum':_0x3db4a0[_0x5f31('0x1b')],'transfererconnectedlinename':_0x3db4a0[_0x5f31('0x1c')],'transfereraccountcode':_0x3db4a0['origtransfereraccountcode'],'transferercontext':_0x3db4a0[_0x5f31('0x1d')],'transfererexten':_0x3db4a0[_0x5f31('0x1e')],'transfererlinkedid':_0x3db4a0[_0x5f31('0x1f')],'context':_0x3db4a0[_0x5f31('0x20')],'extension':_0x3db4a0[_0x5f31('0x21')],'type':_0x5f31('0x4')});if(_['isNil'](_0x3db4a0['transfereechannel'])){_0x3db4a0=_[_0x5f31('0x19')](_0x3db4a0,{'transfereechannel':_0x3db4a0[_0x5f31('0x22')],'transfereecalleridnum':_0x3db4a0[_0x5f31('0x17')],'transfereecalleridname':_0x3db4a0[_0x5f31('0x18')],'transfereeconnectedlinenum':_0x3db4a0[_0x5f31('0x23')],'transfereeconnectedlinename':_0x3db4a0[_0x5f31('0x24')],'transfereeaccountcode':_0x3db4a0[_0x5f31('0x25')],'transfereecontext':_0x3db4a0[_0x5f31('0x26')],'transfereeexten':_0x3db4a0[_0x5f31('0x27')],'transfereelinkedid':_0x3db4a0[_0x5f31('0x28')]});}writeDB(_0x3db4a0);}catch(_0x4f80ff){utils[_0x5f31('0x10')](util[_0x5f31('0x2')]('[%s][transfers][attendedtransfer]',_0x3db4a0[_0x5f31('0x5')]),_0x4f80ff);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index b895288..14a5b34 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 _0x867e=['GetVoiceQueue','type','acw','[utils][getVoiceQueueByName]','add','seconds','YYYY-MM-DD\x20HH:mm:ss','subtract','format','diff','now','isAfter','isBefore','bluebird','jayson/promise','moment','client','../../config/logger','info','inspect','debug','error','request','then','[utils][request]\x20name:%s','catch','internal','name','[utils][getUser]\x20where:%s','length','result','getUserByInternal','found','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]'];(function(_0x2a538a,_0x2c5c72){var _0x3dbe25=function(_0x27b5de){while(--_0x27b5de){_0x2a538a['push'](_0x2a538a['shift']());}};_0x3dbe25(++_0x2c5c72);}(_0x867e,0x1c5));var _0xe867=function(_0xcffe4,_0x772be4){_0xcffe4=_0xcffe4-0x0;var _0x3ab98c=_0x867e[_0xcffe4];return _0x3ab98c;};'use strict';var BPromise=require(_0xe867('0x0'));var jayson=require(_0xe867('0x1'));var moment=require(_0xe867('0x2'));var util=require('util');var client=jayson[_0xe867('0x3')]['http']({'port':0x2329});var logger=require(_0xe867('0x4'))('xdr');exports[_0xe867('0x5')]=function(_0xa59225,_0x36a967){logger[_0xe867('0x5')](_0xa59225,_0x36a967?util[_0xe867('0x6')](_0x36a967,{'showHidden':![],'depth':null}):'');};exports[_0xe867('0x7')]=function(_0x20609b,_0x395784){logger[_0xe867('0x7')](_0x20609b,_0x395784?util[_0xe867('0x6')](_0x395784,{'showHidden':![],'depth':null}):'');};exports[_0xe867('0x8')]=function(_0x3a852b,_0x2b0ff4){logger['error'](_0x3a852b,_0x2b0ff4?util['inspect'](_0x2b0ff4,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x166941,_0x1a8da8){return client[_0xe867('0x9')](_0x166941,{'body':_0x1a8da8})[_0xe867('0xa')](function(_0x2846fd){logger[_0xe867('0x7')](_0xe867('0xb'),_0x166941,_0x2846fd?util[_0xe867('0x6')](_0x2846fd,{'showHidden':![],'depth':null}):'');})[_0xe867('0xc')](function(_0x7d193){logger[_0xe867('0x8')](_0xe867('0xb'),_0x166941,_0x7d193?util[_0xe867('0x6')](_0x7d193,{'showHidden':![],'depth':null}):'');});};function getUser(_0x208254){return client['request']('GetUser',{'options':{'raw':!![],'attributes':['id',_0xe867('0xd'),_0xe867('0xe'),'interface'],'where':_0x208254,'limit':0x1}})[_0xe867('0xa')](function(_0x92abf0){logger['debug'](_0xe867('0xf'),JSON['stringify'](_0x208254),_0x92abf0?util[_0xe867('0x6')](_0x92abf0,{'showHidden':![],'depth':null}):'');return _0x92abf0['result'][_0xe867('0x10')]?_0x92abf0[_0xe867('0x11')][0x0]:null;});}exports[_0xe867('0x12')]=function(_0x329763){return new BPromise(function(_0x455aae,_0x4c624d){if(_0x329763){return getUser({'internal':_0x329763})['then'](function(_0x594580){logger[_0xe867('0x5')]('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x329763,_0x594580?_0xe867('0x13'):_0xe867('0x14'));return _0x455aae(_0x594580);})[_0xe867('0xc')](function(_0x21a471){logger[_0xe867('0x8')](_0xe867('0x15'),_0x21a471?util[_0xe867('0x6')](_0x21a471,{'showHidden':![],'depth':null}):'');return _0x455aae(null);});}return _0x455aae(null);});};exports[_0xe867('0x16')]=function(_0x5aeda6){return new BPromise(function(_0xecbca9,_0x594e0d){if(_0x5aeda6){return getUser({'interface':_0x5aeda6})['then'](function(_0x138dec){logger[_0xe867('0x5')](_0xe867('0x17'),_0x5aeda6,_0x138dec?'found':'notfound');return _0xecbca9(_0x138dec);})['catch'](function(_0x226e92){logger[_0xe867('0x8')](_0xe867('0x18'),_0x226e92?util[_0xe867('0x6')](_0x226e92,{'showHidden':![],'depth':null}):'');return _0xecbca9(null);});}return _0xecbca9(null);});};exports[_0xe867('0x19')]=function(_0xecad84){return new BPromise(function(_0x583c39,_0x21cd0a){if(_0xecad84){return getUser({'name':_0xecad84})[_0xe867('0xa')](function(_0x3c1385){logger[_0xe867('0x5')]('[utils][getUserByName]\x20name:%s\x20%s',_0xecad84,_0x3c1385?_0xe867('0x13'):_0xe867('0x14'));return _0x583c39(_0x3c1385);})[_0xe867('0xc')](function(_0x301997){logger[_0xe867('0x8')](_0xe867('0x1a'),_0x301997?util[_0xe867('0x6')](_0x301997,{'showHidden':![],'depth':null}):'');return _0x583c39(null);});}return _0x583c39(null);});};exports['getVoiceQueueByName']=function(_0x29c190){return new BPromise(function(_0x41d7ae,_0x214a80){if(_0x29c190){return client[_0xe867('0x9')](_0xe867('0x1b'),{'options':{'raw':!![],'attributes':['id',_0xe867('0xe'),_0xe867('0x1c'),_0xe867('0x1d'),'acwTimeout'],'where':{'name':_0x29c190},'limit':0x1}})[_0xe867('0xa')](function(_0x14d4b6){logger[_0xe867('0x7')]('[utils][getVoiceQueueByName]\x20name:%s',_0x29c190,_0x14d4b6?util[_0xe867('0x6')](_0x14d4b6,{'showHidden':![],'depth':null}):'');logger[_0xe867('0x5')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x29c190,_0x14d4b6?_0xe867('0x13'):'notfound');return _0x41d7ae(_0x14d4b6['result'][_0xe867('0x10')]?_0x14d4b6['result'][0x0]:null);})[_0xe867('0xc')](function(_0x44e8bb){logger['error'](_0xe867('0x1e'),_0x44e8bb?util[_0xe867('0x6')](_0x44e8bb,{'showHidden':![],'depth':null}):'');return _0x41d7ae(null);});}return _0x41d7ae(null);});};exports['addTime']=function(_0x2034e7,_0x45e712){return moment(_0x2034e7)[_0xe867('0x1f')](_0x45e712,_0xe867('0x20'))['format'](_0xe867('0x21'));};exports['subtractTime']=function(_0x4d1609,_0x4452f7){return moment(_0x4d1609)[_0xe867('0x22')](_0x4452f7,'seconds')[_0xe867('0x23')](_0xe867('0x21'));};exports['diffTime']=function(_0x170ab0,_0x34dd29){return moment(_0x170ab0)[_0xe867('0x24')](moment(_0x34dd29),_0xe867('0x20'));};exports['sumTime']=function(_0x1ce2f6,_0x41e26b){return parseInt(_0x1ce2f6,0xa)+parseInt(_0x41e26b,0xa);};exports[_0xe867('0x25')]=function(){return moment()[_0xe867('0x23')](_0xe867('0x21'));};exports[_0xe867('0x26')]=function(_0x1a9d8f,_0x380307){if(_0x380307){return moment(_0x1a9d8f)['isAfter'](_0x380307);}return!![];};exports['isBefore']=function(_0x42db02,_0x4043d2){if(_0x4043d2){return moment(_0x42db02)[_0xe867('0x27')](_0x4043d2);}else if(_0x42db02){return!![];}return![];}; \ No newline at end of file +var _0x008a=['error','request','then','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','result','length','getUserByInternal','notfound','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','found','getUserByName','getVoiceQueueByName','GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]','addTime','add','seconds','format','subtract','YYYY-MM-DD\x20HH:mm:ss','diffTime','diff','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','moment','util','client','http','../../config/logger','xdr','info','inspect','debug'];(function(_0x374302,_0x68aeb){var _0x16431f=function(_0x39c238){while(--_0x39c238){_0x374302['push'](_0x374302['shift']());}};_0x16431f(++_0x68aeb);}(_0x008a,0x1ef));var _0xa008=function(_0x39142a,_0x451b6a){_0x39142a=_0x39142a-0x0;var _0x271ddf=_0x008a[_0x39142a];return _0x271ddf;};'use strict';var BPromise=require(_0xa008('0x0'));var jayson=require(_0xa008('0x1'));var moment=require(_0xa008('0x2'));var util=require(_0xa008('0x3'));var client=jayson[_0xa008('0x4')][_0xa008('0x5')]({'port':0x2329});var logger=require(_0xa008('0x6'))(_0xa008('0x7'));exports[_0xa008('0x8')]=function(_0x1883d4,_0x5eff15){logger[_0xa008('0x8')](_0x1883d4,_0x5eff15?util[_0xa008('0x9')](_0x5eff15,{'showHidden':![],'depth':null}):'');};exports[_0xa008('0xa')]=function(_0x4699a6,_0x33c5ef){logger['debug'](_0x4699a6,_0x33c5ef?util[_0xa008('0x9')](_0x33c5ef,{'showHidden':![],'depth':null}):'');};exports['error']=function(_0xab19ca,_0x461349){logger[_0xa008('0xb')](_0xab19ca,_0x461349?util[_0xa008('0x9')](_0x461349,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x4f8aa9,_0x40aadc){return client[_0xa008('0xc')](_0x4f8aa9,{'body':_0x40aadc})[_0xa008('0xd')](function(_0x3a3bc9){logger[_0xa008('0xa')](_0xa008('0xe'),_0x4f8aa9,_0x3a3bc9?util[_0xa008('0x9')](_0x3a3bc9,{'showHidden':![],'depth':null}):'');})[_0xa008('0xf')](function(_0x3e57cb){logger[_0xa008('0xb')](_0xa008('0xe'),_0x4f8aa9,_0x3e57cb?util[_0xa008('0x9')](_0x3e57cb,{'showHidden':![],'depth':null}):'');});};function getUser(_0x3c9e0e){return client[_0xa008('0xc')](_0xa008('0x10'),{'options':{'raw':!![],'attributes':['id',_0xa008('0x11'),_0xa008('0x12'),_0xa008('0x13')],'where':_0x3c9e0e,'limit':0x1}})[_0xa008('0xd')](function(_0xfa6065){logger[_0xa008('0xa')]('[utils][getUser]\x20where:%s',JSON['stringify'](_0x3c9e0e),_0xfa6065?util[_0xa008('0x9')](_0xfa6065,{'showHidden':![],'depth':null}):'');return _0xfa6065[_0xa008('0x14')][_0xa008('0x15')]?_0xfa6065[_0xa008('0x14')][0x0]:null;});}exports[_0xa008('0x16')]=function(_0x5c32fd){return new BPromise(function(_0x225e9a,_0x3e492c){if(_0x5c32fd){return getUser({'internal':_0x5c32fd})['then'](function(_0x379f7b){logger[_0xa008('0x8')]('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x5c32fd,_0x379f7b?'found':_0xa008('0x17'));return _0x225e9a(_0x379f7b);})['catch'](function(_0x370678){logger[_0xa008('0xb')]('[utils][getUserByInternal]',_0x370678?util['inspect'](_0x370678,{'showHidden':![],'depth':null}):'');return _0x225e9a(null);});}return _0x225e9a(null);});};exports[_0xa008('0x18')]=function(_0x5523f2){return new BPromise(function(_0x5c5ec8,_0x235c2f){if(_0x5523f2){return getUser({'interface':_0x5523f2})[_0xa008('0xd')](function(_0x5cdac0){logger['info'](_0xa008('0x19'),_0x5523f2,_0x5cdac0?_0xa008('0x1a'):_0xa008('0x17'));return _0x5c5ec8(_0x5cdac0);})[_0xa008('0xf')](function(_0x35ced8){logger['error']('[utils][getUserByInterface]',_0x35ced8?util[_0xa008('0x9')](_0x35ced8,{'showHidden':![],'depth':null}):'');return _0x5c5ec8(null);});}return _0x5c5ec8(null);});};exports[_0xa008('0x1b')]=function(_0xd403cf){return new BPromise(function(_0x3f44d3,_0x19b885){if(_0xd403cf){return getUser({'name':_0xd403cf})[_0xa008('0xd')](function(_0x443702){logger[_0xa008('0x8')]('[utils][getUserByName]\x20name:%s\x20%s',_0xd403cf,_0x443702?_0xa008('0x1a'):_0xa008('0x17'));return _0x3f44d3(_0x443702);})[_0xa008('0xf')](function(_0x555b21){logger[_0xa008('0xb')]('[utils][getUserByName]',_0x555b21?util[_0xa008('0x9')](_0x555b21,{'showHidden':![],'depth':null}):'');return _0x3f44d3(null);});}return _0x3f44d3(null);});};exports[_0xa008('0x1c')]=function(_0x4c9837){return new BPromise(function(_0x224efd,_0x33f88a){if(_0x4c9837){return client['request'](_0xa008('0x1d'),{'options':{'raw':!![],'attributes':['id',_0xa008('0x12'),_0xa008('0x1e'),_0xa008('0x1f'),_0xa008('0x20')],'where':{'name':_0x4c9837},'limit':0x1}})[_0xa008('0xd')](function(_0x3786bb){logger[_0xa008('0xa')]('[utils][getVoiceQueueByName]\x20name:%s',_0x4c9837,_0x3786bb?util[_0xa008('0x9')](_0x3786bb,{'showHidden':![],'depth':null}):'');logger[_0xa008('0x8')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x4c9837,_0x3786bb?_0xa008('0x1a'):'notfound');return _0x224efd(_0x3786bb['result'][_0xa008('0x15')]?_0x3786bb['result'][0x0]:null);})[_0xa008('0xf')](function(_0x114d14){logger['error'](_0xa008('0x21'),_0x114d14?util[_0xa008('0x9')](_0x114d14,{'showHidden':![],'depth':null}):'');return _0x224efd(null);});}return _0x224efd(null);});};exports[_0xa008('0x22')]=function(_0x3b5149,_0x36f885){return moment(_0x3b5149)[_0xa008('0x23')](_0x36f885,_0xa008('0x24'))[_0xa008('0x25')]('YYYY-MM-DD\x20HH:mm:ss');};exports['subtractTime']=function(_0x13bc2c,_0x3bc658){return moment(_0x13bc2c)[_0xa008('0x26')](_0x3bc658,_0xa008('0x24'))[_0xa008('0x25')](_0xa008('0x27'));};exports[_0xa008('0x28')]=function(_0x356810,_0x28f446){return moment(_0x356810)[_0xa008('0x29')](moment(_0x28f446),_0xa008('0x24'));};exports[_0xa008('0x2a')]=function(_0xda73b5,_0x52f111){return parseInt(_0xda73b5,0xa)+parseInt(_0x52f111,0xa);};exports[_0xa008('0x2b')]=function(){return moment()['format']('YYYY-MM-DD\x20HH:mm:ss');};exports['isAfter']=function(_0xa914ef,_0x2c5a9c){if(_0x2c5a9c){return moment(_0xa914ef)[_0xa008('0x2c')](_0x2c5a9c);}return!![];};exports[_0xa008('0x2d')]=function(_0xadc7ca,_0x2d4532){if(_0x2d4532){return moment(_0xadc7ca)['isBefore'](_0x2d4532);}else if(_0xadc7ca){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 eee11ad..7b1ef8d 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 _0x1426=['fs-extra','lodash','util','./loggers','fileLogger','./safe-template','./mask-sensitive-data','maskSensitiveData','join','log','xcally','client','role','name','then','catch','user','no-user','data','timestamp','error','api','auth','set','client-side-logger','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','\x20body=%s','body','method','x-forwarded-for','headers','connection','remoteAddress','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','format','statusCode','responseTime','other','agent_name','url','setupLoggers'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1426,0x150));var _0x6142=function(_0x5cfbec,_0x46ec16){_0x5cfbec=_0x5cfbec-0x0;var _0x4382dc=_0x1426[_0x5cfbec];return _0x4382dc;};var fs=require(_0x6142('0x0'));var _=require(_0x6142('0x1'));var ewinston=require('express-winston');var path=require('path');var util=require(_0x6142('0x2'));var fileLogger=require(_0x6142('0x3'))[_0x6142('0x4')];var safeTemplate=require(_0x6142('0x5'))['safeTemplate'];var maskSensitiveData=require(_0x6142('0x6'))[_0x6142('0x7')];function ClientSideLogger(){function _0x2442fe(_0xe0648c){var _0x50b1c1=path[_0x6142('0x8')]('/var',_0x6142('0x9'),_0x6142('0xa'));var _0x5d87b6=path['join'](_0x6142('0xb'),_0xe0648c[_0x6142('0xc')]+'-'+_0xe0648c[_0x6142('0xd')]);return fs['ensureDir'](path['join'](_0x50b1c1,_0x5d87b6))[_0x6142('0xe')](function(){var _0x3b8948=fileLogger(_0x6142('0xb'),path[_0x6142('0x8')](_0x50b1c1,_0x5d87b6));return _0x3b8948;})[_0x6142('0xf')](function(_0x3d648c){throw _0x3d648c;});}this[_0x6142('0x9')]=function(_0x1eec89,_0xe3b21e,_0x427200,_0x4694b2){return _0x2442fe(_0x1eec89['user'])[_0x6142('0xe')](function(_0x1e80f0){var _0x226b1d=_0x1e80f0[_0xe3b21e];return _0x226b1d;})[_0x6142('0xe')](function(_0x209cef){var _0x3be422=_0x1eec89[_0x6142('0x10')]?_0x1eec89[_0x6142('0x10')]['id']:_0x6142('0x11');var _0x481056=_0x4694b2[_0x6142('0x12')];var _0x34b212=_0x4694b2[_0x6142('0x13')];var _0x55159f=new Date(Number(_0x34b212));return _0x209cef(_0x3be422,_0x55159f,_0x427200,_0x481056);})[_0x6142('0xf')](function(_0x4b0984){fileLogger(_0x6142('0xb'))[_0x6142('0x14')](_0x4b0984);});};}function setupLoggers(_0x4b3e1e){return new Promise(function(_0xb5937a){var _0x269478=new ClientSideLogger();var _0x5e1fef=fileLogger(_0x6142('0x15'));var _0x15f79a=fileLogger(_0x6142('0x16'));_0x4b3e1e[_0x6142('0x17')](_0x6142('0x18'),_0x269478);_0x4b3e1e[_0x6142('0x19')](ewinston[_0x6142('0x1a')]({'winstonInstance':_0x5e1fef,'meta':![],'statusLevels':!![],'msg':function(_0x2ede61,_0x461bc1){var _0x194c95=_0x6142('0x1b');if(!_[_0x6142('0x1c')](_0x2ede61['body'])){_0x194c95+=_0x6142('0x1d');var _0x1a9174=_0x2ede61[_0x6142('0x1e')];maskSensitiveData(_0x1a9174);}return safeTemplate(util['format'](_0x194c95,_0x2ede61[_0x6142('0x1f')],_0x2ede61['headers'][_0x6142('0x20')]?_0x2ede61[_0x6142('0x21')][_0x6142('0x20')]:_0x2ede61[_0x6142('0x22')][_0x6142('0x23')]||_0x2ede61['ip'],_0x2ede61['url'],_0x461bc1['statusCode'],_0x461bc1['responseTime'],_0x2ede61['user']?_0x2ede61[_0x6142('0x10')]['id']:null,_0x2ede61[_0x6142('0x10')]?_0x2ede61[_0x6142('0x10')][_0x6142('0xd')]:null,_0x2ede61['user']?_0x2ede61[_0x6142('0x10')][_0x6142('0xc')]:null,_0x1a9174?util[_0x6142('0x24')](_0x1a9174,![],null):''));}}));_0x4b3e1e[_0x6142('0x19')](ewinston['logger']({'winstonInstance':_0x15f79a,'meta':![],'statusLevels':!![],'msg':function(_0x4b53a5,_0x1362ce){var _0x107c48=_0x6142('0x25');if(_0x4b53a5[_0x6142('0x1e')]&&_0x4b53a5[_0x6142('0x1e')][_0x6142('0x26')]&&_0x4b53a5[_0x6142('0x1e')][_0x6142('0x27')]){_0x107c48=_0x6142('0x28');}return util[_0x6142('0x29')](_0x107c48,_0x4b53a5[_0x6142('0x1f')],_0x4b53a5['headers']['x-forwarded-for']?_0x4b53a5['headers'][_0x6142('0x20')]:_0x4b53a5[_0x6142('0x22')][_0x6142('0x23')]||_0x4b53a5['ip'],_0x4b53a5['url'],_0x1362ce[_0x6142('0x2a')],_0x1362ce[_0x6142('0x2b')],_0x4b53a5[_0x6142('0x10')]?_0x4b53a5[_0x6142('0x10')]['id']:null,_0x4b53a5[_0x6142('0x10')]?_0x4b53a5[_0x6142('0x10')][_0x6142('0xd')]:null,_0x4b53a5['user']?_0x4b53a5['user']['role']:null,_0x4b53a5[_0x6142('0x1e')]&&_0x4b53a5[_0x6142('0x1e')]['device']?_0x4b53a5[_0x6142('0x1e')][_0x6142('0x26')]:_0x6142('0x2c'),_0x4b53a5[_0x6142('0x1e')]&&_0x4b53a5['body'][_0x6142('0x27')]?_0x4b53a5[_0x6142('0x1e')][_0x6142('0x27')]:'',_0x4b53a5[_0x6142('0x1e')]&&_0x4b53a5[_0x6142('0x1e')][_0x6142('0x2d')]?_0x4b53a5['body']['agent_name']:'');},'ignoreRoute':function(_0x2be978){var _0x24da56=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x24da56['test'](_0x2be978[_0x6142('0x2e')]);}}));return _0xb5937a();});}exports[_0x6142('0x2f')]=setupLoggers; \ No newline at end of file +var _0x78e6=['client','user','no-user','data','timestamp','catch','error','auth','set','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','method','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','responseTime','role','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','device','other','agent_name','setupLoggers','fs-extra','lodash','express-winston','path','util','./loggers','./safe-template','./mask-sensitive-data','join','/var','log','xcally','name','ensureDir','then'];(function(_0x1cfc6c,_0x48a10d){var _0x4eaa85=function(_0x5253ba){while(--_0x5253ba){_0x1cfc6c['push'](_0x1cfc6c['shift']());}};_0x4eaa85(++_0x48a10d);}(_0x78e6,0x7e));var _0x678e=function(_0xfa634c,_0x414e0e){_0xfa634c=_0xfa634c-0x0;var _0x73e478=_0x78e6[_0xfa634c];return _0x73e478;};var fs=require(_0x678e('0x0'));var _=require(_0x678e('0x1'));var ewinston=require(_0x678e('0x2'));var path=require(_0x678e('0x3'));var util=require(_0x678e('0x4'));var fileLogger=require(_0x678e('0x5'))['fileLogger'];var safeTemplate=require(_0x678e('0x6'))['safeTemplate'];var maskSensitiveData=require(_0x678e('0x7'))['maskSensitiveData'];function ClientSideLogger(){function _0x4ecab4(_0x2f36de){var _0x4a7ae2=path[_0x678e('0x8')](_0x678e('0x9'),_0x678e('0xa'),_0x678e('0xb'));var _0x4ce6c0=path[_0x678e('0x8')]('client',_0x2f36de['role']+'-'+_0x2f36de[_0x678e('0xc')]);return fs[_0x678e('0xd')](path['join'](_0x4a7ae2,_0x4ce6c0))[_0x678e('0xe')](function(){var _0x3b2c3c=fileLogger(_0x678e('0xf'),path[_0x678e('0x8')](_0x4a7ae2,_0x4ce6c0));return _0x3b2c3c;})['catch'](function(_0x57c49f){throw _0x57c49f;});}this[_0x678e('0xa')]=function(_0xe03ec7,_0x2aa840,_0x5d8b5a,_0x18b661){return _0x4ecab4(_0xe03ec7[_0x678e('0x10')])[_0x678e('0xe')](function(_0x52d795){var _0x1ab854=_0x52d795[_0x2aa840];return _0x1ab854;})[_0x678e('0xe')](function(_0x4ae335){var _0x512d85=_0xe03ec7['user']?_0xe03ec7[_0x678e('0x10')]['id']:_0x678e('0x11');var _0x415f8f=_0x18b661[_0x678e('0x12')];var _0x1156b9=_0x18b661[_0x678e('0x13')];var _0x5713da=new Date(Number(_0x1156b9));return _0x4ae335(_0x512d85,_0x5713da,_0x5d8b5a,_0x415f8f);})[_0x678e('0x14')](function(_0x1f8157){fileLogger(_0x678e('0xf'))[_0x678e('0x15')](_0x1f8157);});};}function setupLoggers(_0x3d18ae){return new Promise(function(_0x35e430){var _0x38716b=new ClientSideLogger();var _0x36df57=fileLogger('api');var _0x16a041=fileLogger(_0x678e('0x16'));_0x3d18ae[_0x678e('0x17')]('client-side-logger',_0x38716b);_0x3d18ae[_0x678e('0x18')](ewinston[_0x678e('0x19')]({'winstonInstance':_0x36df57,'meta':![],'statusLevels':!![],'msg':function(_0x445220,_0x3d1424){var _0x42b432=_0x678e('0x1a');if(!_[_0x678e('0x1b')](_0x445220[_0x678e('0x1c')])){_0x42b432+=_0x678e('0x1d');var _0x27d1ed=_0x445220[_0x678e('0x1c')];maskSensitiveData(_0x27d1ed);}return safeTemplate(util[_0x678e('0x1e')](_0x42b432,_0x445220[_0x678e('0x1f')],_0x445220[_0x678e('0x20')]['x-forwarded-for']?_0x445220['headers'][_0x678e('0x21')]:_0x445220[_0x678e('0x22')][_0x678e('0x23')]||_0x445220['ip'],_0x445220[_0x678e('0x24')],_0x3d1424[_0x678e('0x25')],_0x3d1424[_0x678e('0x26')],_0x445220[_0x678e('0x10')]?_0x445220[_0x678e('0x10')]['id']:null,_0x445220['user']?_0x445220[_0x678e('0x10')][_0x678e('0xc')]:null,_0x445220['user']?_0x445220['user'][_0x678e('0x27')]:null,_0x27d1ed?util['inspect'](_0x27d1ed,![],null):''));}}));_0x3d18ae[_0x678e('0x18')](ewinston[_0x678e('0x19')]({'winstonInstance':_0x16a041,'meta':![],'statusLevels':!![],'msg':function(_0x3c825a,_0x13081f){var _0x2174c7=_0x678e('0x28');if(_0x3c825a[_0x678e('0x1c')]&&_0x3c825a[_0x678e('0x1c')]['device']&&_0x3c825a['body'][_0x678e('0x29')]){_0x2174c7=_0x678e('0x2a');}return util[_0x678e('0x1e')](_0x2174c7,_0x3c825a['method'],_0x3c825a[_0x678e('0x20')][_0x678e('0x21')]?_0x3c825a[_0x678e('0x20')][_0x678e('0x21')]:_0x3c825a[_0x678e('0x22')][_0x678e('0x23')]||_0x3c825a['ip'],_0x3c825a[_0x678e('0x24')],_0x13081f[_0x678e('0x25')],_0x13081f[_0x678e('0x26')],_0x3c825a[_0x678e('0x10')]?_0x3c825a[_0x678e('0x10')]['id']:null,_0x3c825a['user']?_0x3c825a[_0x678e('0x10')][_0x678e('0xc')]:null,_0x3c825a[_0x678e('0x10')]?_0x3c825a[_0x678e('0x10')]['role']:null,_0x3c825a[_0x678e('0x1c')]&&_0x3c825a[_0x678e('0x1c')][_0x678e('0x2b')]?_0x3c825a[_0x678e('0x1c')]['device']:_0x678e('0x2c'),_0x3c825a[_0x678e('0x1c')]&&_0x3c825a[_0x678e('0x1c')][_0x678e('0x29')]?_0x3c825a[_0x678e('0x1c')]['agent_id']:'',_0x3c825a['body']&&_0x3c825a[_0x678e('0x1c')][_0x678e('0x2d')]?_0x3c825a[_0x678e('0x1c')][_0x678e('0x2d')]:'');},'ignoreRoute':function(_0x36f62c){var _0x57135a=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x57135a['test'](_0x36f62c['url']);}}));return _0x35e430();});}exports[_0x678e('0x2e')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index 0871dcc..95d8d56 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x652b=['iftime','moment-timezone','source','join','Interval\x20string\x20not\x20valid','isValid','split','locale','weekdaysShort','map','indexOf','slice','concat','exports','monthsShort','toLowerCase','circularMonthInterval','clone','hours','minutes','day','endOf','isBetween','timeCompare','ddd','dowCompare','date','daysInMonth','max','min','format','includes','monthCompare','guess','isMoment','length','padStart'];(function(_0x16f5f8,_0x3537e5){var _0x55198f=function(_0x1dd530){while(--_0x1dd530){_0x16f5f8['push'](_0x16f5f8['shift']());}};_0x55198f(++_0x3537e5);}(_0x652b,0x104));var _0xb652=function(_0x3efe87,_0x35ad48){_0x3efe87=_0x3efe87-0x0;var _0x56a4cc=_0x652b[_0x3efe87];return _0x56a4cc;};var _=require('lodash');var moment=require(_0xb652('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]['map'](function(_0xfb9fc7){return _0xfb9fc7[_0xb652('0x1')];})[_0xb652('0x2')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0xb652('0x3');var EINVALID_DATE='Date\x20not\x20valid';function throwIfDateNotValid(_0x1a50c5){if(!_0x1a50c5[_0xb652('0x4')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x4450c7){var _0x573004=_0x4450c7[_0xb652('0x5')](':')['map'](function(_0x531833){return parseInt(_0x531833,0xa);});var _0x1d4d68=_0x573004[0x0];var _0x586695=_0x573004[0x1];if(_0x1d4d68<0x0||_0x1d4d68>0x17||_0x586695<0x0||_0x586695>0x3b){throw new Error(EINVALID_DATE);}return[_0x1d4d68,_0x586695];}function circularDoWInterval(_0x22d6f0,_0x7d4efa){if(_0x22d6f0===_0x7d4efa){return[_0x22d6f0];}else{var _0x3e367a=moment['locale']();moment[_0xb652('0x6')]('en');var _0x55580a=moment[_0xb652('0x7')]()[_0xb652('0x8')](function(_0x490d3c){return _0x490d3c['toLowerCase']();});moment[_0xb652('0x6')](_0x3e367a);var _0x14d14e=_0x55580a[_0xb652('0x9')](_0x22d6f0);var _0x1afd01=_0x55580a[_0xb652('0x9')](_0x7d4efa);if(_0x1afd01>_0x14d14e){return _0x55580a[_0xb652('0xa')](_0x14d14e,_0x1afd01+0x1);}else{var _0x402ad2=_0x55580a['slice'](0x0,_0x1afd01+0x1);var _0x20df79=_0x55580a['slice'](_0x14d14e);return _0x20df79[_0xb652('0xb')](_0x402ad2);}}}module[_0xb652('0xc')]['circularDoWInterval']=circularDoWInterval;function circularMonthInterval(_0x1dbd13,_0x4a8831){if(_0x1dbd13===_0x4a8831){return[_0x1dbd13];}else{var _0x50aba4=moment['locale']();moment[_0xb652('0x6')]('en');var _0x47bdee=moment[_0xb652('0xd')]()[_0xb652('0x8')](function(_0x351b45){return _0x351b45[_0xb652('0xe')]();});moment[_0xb652('0x6')](_0x50aba4);var _0x359fb8=_0x47bdee[_0xb652('0x9')](_0x1dbd13);var _0x4837c6=_0x47bdee[_0xb652('0x9')](_0x4a8831);if(_0x4837c6>_0x359fb8){return _0x47bdee[_0xb652('0xa')](_0x359fb8,_0x4837c6+0x1);}else{var _0x38b80c=_0x47bdee[_0xb652('0xa')](0x0,_0x4837c6+0x1);var _0xf3bf79=_0x47bdee[_0xb652('0xa')](_0x359fb8);return _0xf3bf79[_0xb652('0xb')](_0x38b80c);}}}module['exports'][_0xb652('0xf')]=circularMonthInterval;function parseDom(_0x4190b6){var _0x1acf6b=parseInt(_0x4190b6,0xa);if(_0x1acf6b<0x1||_0x1acf6b>0x1f){throw new Error(EINVALID_DATE);}return _0x1acf6b;}function timeCompare(_0x35be53,_0x3a4222,_0x2fea0b){var _0x21845d=_0x35be53[_0xb652('0x10')]();var _0x9e0f88=extractTime(_0x3a4222);var _0x13e5a4=_0x9e0f88[0x0];var _0x5307a6=_0x9e0f88[0x1];var _0x40a8f1=_0x35be53[_0xb652('0x10')]()[_0xb652('0x11')](_0x13e5a4)[_0xb652('0x12')](_0x5307a6);throwIfDateNotValid(_0x40a8f1);var _0x1ae5eb=extractTime(_0x2fea0b);var _0x3e64b3=_0x1ae5eb[0x0];var _0x588fb3=_0x1ae5eb[0x1];var _0x581a49=_0x35be53[_0xb652('0x10')]()[_0xb652('0x11')](_0x3e64b3)[_0xb652('0x12')](_0x588fb3);throwIfDateNotValid(_0x581a49);if(_0x581a49['isBefore'](_0x40a8f1)){var _0x45c238=_0x21845d[_0xb652('0x10')]()['startOf'](_0xb652('0x13'));var _0xb27ef5=_0x21845d[_0xb652('0x10')]()[_0xb652('0x14')](_0xb652('0x13'));return _0x21845d[_0xb652('0x15')](_0x40a8f1,_0xb27ef5,undefined,'[]')||_0x21845d[_0xb652('0x15')](_0x45c238,_0x581a49,undefined,'[]');}else{return _0x21845d['isBetween'](_0x40a8f1,_0x581a49,undefined,'[]');}}module[_0xb652('0xc')][_0xb652('0x16')]=timeCompare;function dowCompare(_0x374e33,_0x38b140,_0x6424a4){var _0xe61dd7=_0x374e33[_0xb652('0x6')]('en')['format'](_0xb652('0x17'))[_0xb652('0xe')]();return circularDoWInterval(_0x38b140,_0x6424a4)['includes'](_0xe61dd7);}module[_0xb652('0xc')][_0xb652('0x18')]=dowCompare;function domCompare(_0x166772,_0x522f1f,_0x57ee9c){var _0x164127=_0x166772[_0xb652('0x19')]();if(_0x522f1f===_0x57ee9c){return _0x164127===_0x522f1f;}else{var _0x1e7a40=_0x166772[_0xb652('0x1a')]();var _0x8b04fb=_0x522f1f<_0x57ee9c;let _0xe58a98=![];var _0x13c06b=0x0;var _0x405fb6=0x0;if(_0x8b04fb){_0x13c06b=Math[_0xb652('0x1b')](0x1,_0x522f1f);_0x405fb6=Math[_0xb652('0x1c')](_0x57ee9c,_0x1e7a40);_0xe58a98=_0x164127>=_0x13c06b&&_0x164127<=_0x405fb6;}else{_0x13c06b=Math[_0xb652('0x1c')](_0x522f1f,_0x1e7a40);_0x405fb6=Math[_0xb652('0x1b')](0x1,_0x57ee9c);_0xe58a98=_0x164127>=_0x13c06b||_0x164127<=_0x405fb6;}return _0xe58a98;}}module['exports']['domCompare']=domCompare;function monthCompare(_0x37efde,_0x25e321,_0x181c49){var _0x25b4e8=_0x37efde[_0xb652('0x6')]('en')[_0xb652('0x1d')]('MMM')[_0xb652('0xe')]();return circularMonthInterval(_0x25e321,_0x181c49)[_0xb652('0x1e')](_0x25b4e8);}module[_0xb652('0xc')][_0xb652('0x1f')]=monthCompare;function iftime(_0xfd68a2,_0x59bccf=moment['tz'][_0xb652('0x20')](),_0x2ccc90=moment()){if(!validateRx['test'](_0xfd68a2)){throw new Error(EINVALID_STRING);}else{var _0x4e3acf=(moment[_0xb652('0x21')](_0x2ccc90)?_0x2ccc90['clone']():moment(_0x2ccc90))['tz'](_0x59bccf)['locale']('en');throwIfDateNotValid(_0x4e3acf);var _0x2e87c7=_0xfd68a2['split'](',');var _0x619556=_0x2e87c7[0x0];var _0x26dac0=_0x2e87c7[0x1];var _0x299023=_0x2e87c7[0x2];var _0x5395c3=_0x2e87c7[0x3];let _0x519e23=!![];if(_0x619556!=='*'){var _0x67ba73=_0x619556[_0xb652('0x5')]('-');var _0x2a57d7=_['padStart'](_0x67ba73[0x0],0x5,'0');var _0x3823f6=_0x67ba73[_0xb652('0x22')]===0x2?_[_0xb652('0x23')](_0x67ba73[0x1],0x5,'0'):_0x2a57d7;_0x519e23=timeCompare(_0x4e3acf,_0x2a57d7,_0x3823f6);}let _0x5e4904=!![];if(_0x26dac0!=='*'){var _0x38699f=_0x26dac0[_0xb652('0x5')]('-');var _0x43569=_0x38699f[0x0];var _0x5e0806=_0x38699f[_0xb652('0x22')]===0x2?_0x38699f[0x1]:_0x43569;_0x5e4904=dowCompare(_0x4e3acf,_0x43569,_0x5e0806);}let _0x54a893=!![];if(_0x299023!=='*'){var _0x3a8c94=_0x299023[_0xb652('0x5')]('-');var _0x26b4f5=parseDom(_0x3a8c94[0x0]);var _0x2ab8bb=_0x3a8c94['length']===0x2?parseDom(_0x3a8c94[0x1]):_0x26b4f5;_0x54a893=domCompare(_0x4e3acf,_0x26b4f5,_0x2ab8bb);}let _0x2db7dd=!![];if(_0x5395c3!=='*'){var _0x1a3faa=_0x5395c3[_0xb652('0x5')]('-');var _0x35bcab=_0x1a3faa[0x0];var _0x4b46b5=_0x1a3faa[_0xb652('0x22')]===0x2?_0x1a3faa[0x1]:_0x1a3faa[0x0];_0x2db7dd=monthCompare(_0x4e3acf,_0x35bcab,_0x4b46b5);}return _0x519e23&&_0x5e4904&&_0x54a893&&_0x2db7dd;}}module[_0xb652('0xc')][_0xb652('0x24')]=iftime; \ No newline at end of file +var _0xacaa=['dowCompare','daysInMonth','min','max','domCompare','monthCompare','isMoment','split','length','lodash','moment-timezone','source','join','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','isValid','map','locale','weekdaysShort','toLowerCase','indexOf','slice','exports','monthsShort','circularMonthInterval','clone','hours','minutes','isBefore','day','isBetween','format','includes'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xacaa,0xf0));var _0xaaca=function(_0xdf9694,_0x5798d){_0xdf9694=_0xdf9694-0x0;var _0x357322=_0xacaa[_0xdf9694];return _0x357322;};var _=require(_0xaaca('0x0'));var moment=require(_0xaaca('0x1'));var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx]['map'](function(_0x17310b){return _0x17310b[_0xaaca('0x2')];})[_0xaaca('0x3')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0xaaca('0x4');var EINVALID_DATE=_0xaaca('0x5');function throwIfDateNotValid(_0x24aad1){if(!_0x24aad1[_0xaaca('0x6')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x28092c){var _0xd97344=_0x28092c['split'](':')[_0xaaca('0x7')](function(_0xcfb020){return parseInt(_0xcfb020,0xa);});var _0x2cf30a=_0xd97344[0x0];var _0x292d72=_0xd97344[0x1];if(_0x2cf30a<0x0||_0x2cf30a>0x17||_0x292d72<0x0||_0x292d72>0x3b){throw new Error(EINVALID_DATE);}return[_0x2cf30a,_0x292d72];}function circularDoWInterval(_0x350596,_0x1b5f32){if(_0x350596===_0x1b5f32){return[_0x350596];}else{var _0x3565b7=moment[_0xaaca('0x8')]();moment[_0xaaca('0x8')]('en');var _0x152f6c=moment[_0xaaca('0x9')]()[_0xaaca('0x7')](function(_0x35bb41){return _0x35bb41[_0xaaca('0xa')]();});moment['locale'](_0x3565b7);var _0x52918f=_0x152f6c[_0xaaca('0xb')](_0x350596);var _0x3d275a=_0x152f6c[_0xaaca('0xb')](_0x1b5f32);if(_0x3d275a>_0x52918f){return _0x152f6c[_0xaaca('0xc')](_0x52918f,_0x3d275a+0x1);}else{var _0x59d58a=_0x152f6c['slice'](0x0,_0x3d275a+0x1);var _0x20c2cc=_0x152f6c['slice'](_0x52918f);return _0x20c2cc['concat'](_0x59d58a);}}}module[_0xaaca('0xd')]['circularDoWInterval']=circularDoWInterval;function circularMonthInterval(_0x1b3f23,_0x180041){if(_0x1b3f23===_0x180041){return[_0x1b3f23];}else{var _0x489b8d=moment[_0xaaca('0x8')]();moment[_0xaaca('0x8')]('en');var _0x5198ff=moment[_0xaaca('0xe')]()[_0xaaca('0x7')](function(_0x38781e){return _0x38781e[_0xaaca('0xa')]();});moment['locale'](_0x489b8d);var _0x2b4276=_0x5198ff[_0xaaca('0xb')](_0x1b3f23);var _0x150fcc=_0x5198ff[_0xaaca('0xb')](_0x180041);if(_0x150fcc>_0x2b4276){return _0x5198ff['slice'](_0x2b4276,_0x150fcc+0x1);}else{var _0x19e477=_0x5198ff[_0xaaca('0xc')](0x0,_0x150fcc+0x1);var _0x204793=_0x5198ff['slice'](_0x2b4276);return _0x204793['concat'](_0x19e477);}}}module[_0xaaca('0xd')][_0xaaca('0xf')]=circularMonthInterval;function parseDom(_0x5c1813){var _0x41a511=parseInt(_0x5c1813,0xa);if(_0x41a511<0x1||_0x41a511>0x1f){throw new Error(EINVALID_DATE);}return _0x41a511;}function timeCompare(_0x2847f8,_0x2a5473,_0x5bf8d5){var _0x1b219d=_0x2847f8[_0xaaca('0x10')]();var _0x3d69bd=extractTime(_0x2a5473);var _0x6b7bdf=_0x3d69bd[0x0];var _0x3035d1=_0x3d69bd[0x1];var _0x148988=_0x2847f8[_0xaaca('0x10')]()[_0xaaca('0x11')](_0x6b7bdf)['minutes'](_0x3035d1);throwIfDateNotValid(_0x148988);var _0x2b83a5=extractTime(_0x5bf8d5);var _0x5584da=_0x2b83a5[0x0];var _0x31b153=_0x2b83a5[0x1];var _0x1e4ca7=_0x2847f8['clone']()[_0xaaca('0x11')](_0x5584da)[_0xaaca('0x12')](_0x31b153);throwIfDateNotValid(_0x1e4ca7);if(_0x1e4ca7[_0xaaca('0x13')](_0x148988)){var _0x3d49c7=_0x1b219d['clone']()['startOf'](_0xaaca('0x14'));var _0x17e822=_0x1b219d['clone']()['endOf']('day');return _0x1b219d[_0xaaca('0x15')](_0x148988,_0x17e822,undefined,'[]')||_0x1b219d[_0xaaca('0x15')](_0x3d49c7,_0x1e4ca7,undefined,'[]');}else{return _0x1b219d[_0xaaca('0x15')](_0x148988,_0x1e4ca7,undefined,'[]');}}module['exports']['timeCompare']=timeCompare;function dowCompare(_0x1e4ad2,_0x3f0062,_0xedff75){var _0x46936a=_0x1e4ad2[_0xaaca('0x8')]('en')[_0xaaca('0x16')]('ddd')['toLowerCase']();return circularDoWInterval(_0x3f0062,_0xedff75)[_0xaaca('0x17')](_0x46936a);}module[_0xaaca('0xd')][_0xaaca('0x18')]=dowCompare;function domCompare(_0x4bd654,_0x68c0f,_0x3c8852){var _0x129367=_0x4bd654['date']();if(_0x68c0f===_0x3c8852){return _0x129367===_0x68c0f;}else{var _0x5db0c0=_0x4bd654[_0xaaca('0x19')]();var _0x15d6c7=_0x68c0f<_0x3c8852;let _0x43ecee=![];var _0xacebd5=0x0;var _0x25c9d6=0x0;if(_0x15d6c7){_0xacebd5=Math['max'](0x1,_0x68c0f);_0x25c9d6=Math[_0xaaca('0x1a')](_0x3c8852,_0x5db0c0);_0x43ecee=_0x129367>=_0xacebd5&&_0x129367<=_0x25c9d6;}else{_0xacebd5=Math[_0xaaca('0x1a')](_0x68c0f,_0x5db0c0);_0x25c9d6=Math[_0xaaca('0x1b')](0x1,_0x3c8852);_0x43ecee=_0x129367>=_0xacebd5||_0x129367<=_0x25c9d6;}return _0x43ecee;}}module[_0xaaca('0xd')][_0xaaca('0x1c')]=domCompare;function monthCompare(_0x5ca37c,_0x221867,_0x4efb05){var _0x75aa7b=_0x5ca37c[_0xaaca('0x8')]('en')[_0xaaca('0x16')]('MMM')[_0xaaca('0xa')]();return circularMonthInterval(_0x221867,_0x4efb05)[_0xaaca('0x17')](_0x75aa7b);}module['exports'][_0xaaca('0x1d')]=monthCompare;function iftime(_0x2c9885,_0xae2f24=moment['tz']['guess'](),_0x277907=moment()){if(!validateRx['test'](_0x2c9885)){throw new Error(EINVALID_STRING);}else{var _0x4d3bf9=(moment[_0xaaca('0x1e')](_0x277907)?_0x277907[_0xaaca('0x10')]():moment(_0x277907))['tz'](_0xae2f24)[_0xaaca('0x8')]('en');throwIfDateNotValid(_0x4d3bf9);var _0x2cdd89=_0x2c9885[_0xaaca('0x1f')](',');var _0x35fa6e=_0x2cdd89[0x0];var _0x7e6b8d=_0x2cdd89[0x1];var _0xd03089=_0x2cdd89[0x2];var _0x5d670c=_0x2cdd89[0x3];let _0x1f1c14=!![];if(_0x35fa6e!=='*'){var _0x38ea50=_0x35fa6e[_0xaaca('0x1f')]('-');var _0x3f00d5=_['padStart'](_0x38ea50[0x0],0x5,'0');var _0x598557=_0x38ea50[_0xaaca('0x20')]===0x2?_['padStart'](_0x38ea50[0x1],0x5,'0'):_0x3f00d5;_0x1f1c14=timeCompare(_0x4d3bf9,_0x3f00d5,_0x598557);}let _0x4d8dc0=!![];if(_0x7e6b8d!=='*'){var _0x2a93da=_0x7e6b8d[_0xaaca('0x1f')]('-');var _0x554d38=_0x2a93da[0x0];var _0x1d4680=_0x2a93da[_0xaaca('0x20')]===0x2?_0x2a93da[0x1]:_0x554d38;_0x4d8dc0=dowCompare(_0x4d3bf9,_0x554d38,_0x1d4680);}let _0x1c4f27=!![];if(_0xd03089!=='*'){var _0x3beb4b=_0xd03089[_0xaaca('0x1f')]('-');var _0x136f5c=parseDom(_0x3beb4b[0x0]);var _0x26ed75=_0x3beb4b[_0xaaca('0x20')]===0x2?parseDom(_0x3beb4b[0x1]):_0x136f5c;_0x1c4f27=domCompare(_0x4d3bf9,_0x136f5c,_0x26ed75);}let _0x383991=!![];if(_0x5d670c!=='*'){var _0x42238d=_0x5d670c[_0xaaca('0x1f')]('-');var _0x90d8b5=_0x42238d[0x0];var _0x14c726=_0x42238d[_0xaaca('0x20')]===0x2?_0x42238d[0x1]:_0x42238d[0x0];_0x383991=monthCompare(_0x4d3bf9,_0x90d8b5,_0x14c726);}return _0x1f1c14&&_0x4d8dc0&&_0x1c4f27&&_0x383991;}}module['exports']['iftime']=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index c9239e4..b171a6c 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xea85=['keys','length','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','transports','Console','warn','File','%s-%s','error','consoleLogger','path','util','moment','winston','../config/environment','debugLevel','toLowerCase','info','redBG\x20white','red','bold\x20yellow','white','bold\x20white','bold\x20green','gray','bold\x20blue','bold\x20cyan','/var/log/xcally','join','%s-%s.log','message','replace','format','{{{','meta'];(function(_0x142b97,_0x88f2ed){var _0x472db0=function(_0x13bcb8){while(--_0x13bcb8){_0x142b97['push'](_0x142b97['shift']());}};_0x472db0(++_0x88f2ed);}(_0xea85,0x159));var _0x5ea8=function(_0x39762e,_0x42e66c){_0x39762e=_0x39762e-0x0;var _0x108448=_0xea85[_0x39762e];return _0x108448;};'use strict';var path=require(_0x5ea8('0x0'));var util=require(_0x5ea8('0x1'));var moment=require(_0x5ea8('0x2'));var winston=require(_0x5ea8('0x3'));var config=require(_0x5ea8('0x4'));var debugLevel=config[_0x5ea8('0x5')]?config[_0x5ea8('0x5')][_0x5ea8('0x6')]():_0x5ea8('0x7');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0x5ea8('0x8'),'error':_0x5ea8('0x9'),'warn':_0x5ea8('0xa'),'info':_0x5ea8('0xb'),'print':_0x5ea8('0xc'),'success':_0x5ea8('0xd'),'http':_0x5ea8('0xe'),'verbose':'bold\x20magenta','debug':_0x5ea8('0xf'),'silly':_0x5ea8('0x10')};winston['addColors'](XC_LOG_COLORS);function getLogFileName(_0x35cf42,_0x23625f,_0x48fa7b){var _0x423588=_0x35cf42||_0x5ea8('0x11');return path[_0x5ea8('0x12')](_0x423588,util['format'](_0x5ea8('0x13'),_0x23625f,_0x48fa7b));}function formatter(_0x58cbf1,_0x597567){_0x597567['message']=_0x597567[_0x5ea8('0x14')]['replace'](/@@{/g,'{{{')[_0x5ea8('0x15')](/}@@/g,'}}}')[_0x5ea8('0x15')](/@{/g,'{{')['replace'](/}@/g,'}}');return util['format']('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0x5ea8('0x16')]('YYYY-MM-DD\x20HH:mm:ss'),_0x597567['level']['toUpperCase'](),_0x58cbf1,_0x597567['message']);}function fileFormat(_0x468ade,_0x1f5f05){_0x1f5f05['message']=_0x1f5f05['message'][_0x5ea8('0x15')](/@@{/g,_0x5ea8('0x17'))[_0x5ea8('0x15')](/}@@/g,'}}}')['replace'](/@{/g,'{{')[_0x5ea8('0x15')](/}@/g,'}}');var _0x2d9a3d=_0x1f5f05[_0x5ea8('0x18')]&&Object[_0x5ea8('0x19')](_0x1f5f05['meta'])[_0x5ea8('0x1a')]?'\x0a\x09'+JSON['stringify'](_0x1f5f05[_0x5ea8('0x18')]):'';return util['format'](_0x5ea8('0x1b'),moment()[_0x5ea8('0x16')](_0x5ea8('0x1c')),_0x1f5f05[_0x5ea8('0x1d')]['toUpperCase'](),_0x468ade,_0x1f5f05[_0x5ea8('0x14')],_0x2d9a3d);}function consoleLogger(){var _0x124c2c=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x5ea8('0x1e'))][(_0x5ea8('0x1f'))]({'level':_0x5ea8('0x20'),'json':![],'formatter':function(_0x4ead09){return formatter('',_0x4ead09);}})]});return _0x124c2c;}function fileLogger(_0x46016a,_0x377260){var _0x4f6a59=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x5ea8('0x1e'))][(_0x5ea8('0x21'))]({'name':util['format'](_0x5ea8('0x22'),_0x46016a,_0x5ea8('0x23')),'filename':getLogFileName(_0x377260,_0x46016a,_0x5ea8('0x23')),'level':_0x5ea8('0x23'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x208f32){return fileFormat(_0x46016a,_0x208f32);}}),new winston[(_0x5ea8('0x1e'))][(_0x5ea8('0x21'))]({'name':util['format'](_0x5ea8('0x22'),_0x46016a,debugLevel),'filename':getLogFileName(_0x377260,_0x46016a,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1d9f15){return fileFormat(_0x46016a,_0x1d9f15);}}),new winston[(_0x5ea8('0x1e'))][(_0x5ea8('0x1f'))]({'level':_0x5ea8('0x20'),'json':![],'formatter':function(_0x5e9378){return fileFormat(_0x46016a,_0x5e9378);}})]});return _0x4f6a59;}exports[_0x5ea8('0x24')]=consoleLogger;exports['fileLogger']=fileLogger; \ No newline at end of file +var _0x07fa=['%s-%s','error','util','moment','../config/environment','debugLevel','toLowerCase','info','redBG\x20white','bold\x20yellow','white','bold\x20white','gray','bold\x20magenta','bold\x20blue','bold\x20cyan','addColors','/var/log/xcally','join','format','%s-%s.log','message','replace','{{{','level','toUpperCase','meta','length','YYYY-MM-DD\x20HH:mm:ss','Logger','transports','Console','warn','File'];(function(_0x461886,_0x4fc171){var _0x295e0a=function(_0x451524){while(--_0x451524){_0x461886['push'](_0x461886['shift']());}};_0x295e0a(++_0x4fc171);}(_0x07fa,0xac));var _0xa07f=function(_0x2adbeb,_0x5581be){_0x2adbeb=_0x2adbeb-0x0;var _0x5e18a6=_0x07fa[_0x2adbeb];return _0x5e18a6;};'use strict';var path=require('path');var util=require(_0xa07f('0x0'));var moment=require(_0xa07f('0x1'));var winston=require('winston');var config=require(_0xa07f('0x2'));var debugLevel=config['debugLevel']?config[_0xa07f('0x3')][_0xa07f('0x4')]():_0xa07f('0x5');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0xa07f('0x6'),'error':'red','warn':_0xa07f('0x7'),'info':_0xa07f('0x8'),'print':_0xa07f('0x9'),'success':'bold\x20green','http':_0xa07f('0xa'),'verbose':_0xa07f('0xb'),'debug':_0xa07f('0xc'),'silly':_0xa07f('0xd')};winston[_0xa07f('0xe')](XC_LOG_COLORS);function getLogFileName(_0x20a1bb,_0x1093d,_0x42a153){var _0x2947d5=_0x20a1bb||_0xa07f('0xf');return path[_0xa07f('0x10')](_0x2947d5,util[_0xa07f('0x11')](_0xa07f('0x12'),_0x1093d,_0x42a153));}function formatter(_0x3bad1a,_0x3211dc){_0x3211dc[_0xa07f('0x13')]=_0x3211dc[_0xa07f('0x13')][_0xa07f('0x14')](/@@{/g,_0xa07f('0x15'))[_0xa07f('0x14')](/}@@/g,'}}}')[_0xa07f('0x14')](/@{/g,'{{')[_0xa07f('0x14')](/}@/g,'}}');return util[_0xa07f('0x11')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),_0x3211dc[_0xa07f('0x16')][_0xa07f('0x17')](),_0x3bad1a,_0x3211dc[_0xa07f('0x13')]);}function fileFormat(_0x52e984,_0x39f7dd){_0x39f7dd['message']=_0x39f7dd[_0xa07f('0x13')]['replace'](/@@{/g,_0xa07f('0x15'))[_0xa07f('0x14')](/}@@/g,'}}}')[_0xa07f('0x14')](/@{/g,'{{')[_0xa07f('0x14')](/}@/g,'}}');var _0x1f231e=_0x39f7dd[_0xa07f('0x18')]&&Object['keys'](_0x39f7dd['meta'])[_0xa07f('0x19')]?'\x0a\x09'+JSON['stringify'](_0x39f7dd['meta']):'';return util['format']('[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s',moment()[_0xa07f('0x11')](_0xa07f('0x1a')),_0x39f7dd[_0xa07f('0x16')][_0xa07f('0x17')](),_0x52e984,_0x39f7dd[_0xa07f('0x13')],_0x1f231e);}function consoleLogger(){var _0x5decc0=new winston[(_0xa07f('0x1b'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xa07f('0x1c'))][(_0xa07f('0x1d'))]({'level':_0xa07f('0x1e'),'json':![],'formatter':function(_0xbb2772){return formatter('',_0xbb2772);}})]});return _0x5decc0;}function fileLogger(_0xfe6405,_0x1359b9){var _0x275121=new winston[(_0xa07f('0x1b'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0xa07f('0x1f'))]({'name':util[_0xa07f('0x11')](_0xa07f('0x20'),_0xfe6405,_0xa07f('0x21')),'filename':getLogFileName(_0x1359b9,_0xfe6405,'error'),'level':_0xa07f('0x21'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5e9948){return fileFormat(_0xfe6405,_0x5e9948);}}),new winston[(_0xa07f('0x1c'))][(_0xa07f('0x1f'))]({'name':util[_0xa07f('0x11')](_0xa07f('0x20'),_0xfe6405,debugLevel),'filename':getLogFileName(_0x1359b9,_0xfe6405,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1eedeb){return fileFormat(_0xfe6405,_0x1eedeb);}}),new winston[(_0xa07f('0x1c'))]['Console']({'level':'warn','json':![],'formatter':function(_0x1cc234){return fileFormat(_0xfe6405,_0x1cc234);}})]});return _0x275121;}exports['consoleLogger']=consoleLogger;exports['fileLogger']=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index d73fb9f..8d7b217 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 _0x2ef3=['email','securityToken','code','accessKey','tenantId','token','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','calleridname','calleridnum','exten','vidaooApiKey','privateKey','secretaccesskey','user','pass','dsn','registry','oldPassword','length','isPlainObject','@@{','replace','}@@','includes','exports','maskSensitiveData','lodash','username','password','newPassword','apiKey','firstName','street','phone','fax'];(function(_0x9b5bb2,_0x5db315){var _0x2e1e92=function(_0x5621c9){while(--_0x5621c9){_0x9b5bb2['push'](_0x9b5bb2['shift']());}};_0x2e1e92(++_0x5db315);}(_0x2ef3,0xba));var _0x32ef=function(_0x13201d,_0x53c61c){_0x13201d=_0x13201d-0x0;var _0x335eec=_0x2ef3[_0x13201d];return _0x335eec;};var _=require(_0x32ef('0x0'));var sensitiveFields=[_0x32ef('0x1'),_0x32ef('0x2'),_0x32ef('0x3'),_0x32ef('0x4'),_0x32ef('0x5'),'lastName',_0x32ef('0x6'),_0x32ef('0x7'),'mobile',_0x32ef('0x8'),_0x32ef('0x9'),'clientId','clientSecret',_0x32ef('0xa'),_0x32ef('0xb'),_0x32ef('0xc'),_0x32ef('0xd'),_0x32ef('0xe'),_0x32ef('0xf'),_0x32ef('0x10'),_0x32ef('0x11'),_0x32ef('0x12'),_0x32ef('0x13'),'consumerSecret','membername',_0x32ef('0x14'),_0x32ef('0x15'),_0x32ef('0x16'),_0x32ef('0x17'),'clientEmail',_0x32ef('0x18'),'accesskeyid',_0x32ef('0x19'),'key',_0x32ef('0x1a'),_0x32ef('0x1b'),'accountSid','localstationid',_0x32ef('0x1c'),'secret',_0x32ef('0x1d'),_0x32ef('0x1e')];function maskSensitiveData(_0x93d492){const _0x54c7f5=/(?!^)[\s\S](?!$)/g;if(_['isPlainObject'](_0x93d492)){for(const _0x55bf0b in _0x93d492){if(_['isArray'](_0x93d492[_0x55bf0b])){for(let _0x13db1a=0x0;_0x13db1a<_0x93d492[_0x55bf0b][_0x32ef('0x1f')];_0x13db1a++){maskSensitiveData(_0x93d492[_0x55bf0b][_0x13db1a]);}}else if(_[_0x32ef('0x20')](_0x93d492[_0x55bf0b])){maskSensitiveData(_0x93d492[_0x55bf0b]);}else if(_['isString'](_0x93d492[_0x55bf0b])){_0x93d492[_0x55bf0b]=_0x93d492[_0x55bf0b]['replace'](/{{{/g,_0x32ef('0x21'))[_0x32ef('0x22')](/}}}/g,_0x32ef('0x23'))['replace'](/{{/g,'@{')[_0x32ef('0x22')](/}}/g,'}@');if(_[_0x32ef('0x24')](sensitiveFields,_0x55bf0b)){_0x93d492[_0x55bf0b]=_0x93d492[_0x55bf0b]['replace'](_0x54c7f5,'*');}}}}}module[_0x32ef('0x25')][_0x32ef('0x26')]=maskSensitiveData; \ No newline at end of file +var _0xdb28=['registry','oldPassword','isPlainObject','length','isString','replace','@@{','}@@','exports','maskSensitiveData','lodash','username','password','newPassword','firstName','lastName','street','phone','mobile','email','clientId','code','accessKey','tenantId','token','channelSecret','accessToken','accessTokenSecret','consumerKey','consumerSecret','membername','calleridnum','exten','clientEmail','privateKey','accesskeyid','secretaccesskey','key','accountSid','localstationid','dsn','secret'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xdb28,0x106));var _0x8db2=function(_0x3f2395,_0x20e645){_0x3f2395=_0x3f2395-0x0;var _0x317906=_0xdb28[_0x3f2395];return _0x317906;};var _=require(_0x8db2('0x0'));var sensitiveFields=[_0x8db2('0x1'),_0x8db2('0x2'),_0x8db2('0x3'),'apiKey',_0x8db2('0x4'),_0x8db2('0x5'),_0x8db2('0x6'),_0x8db2('0x7'),_0x8db2('0x8'),'fax',_0x8db2('0x9'),_0x8db2('0xa'),'clientSecret','securityToken',_0x8db2('0xb'),_0x8db2('0xc'),_0x8db2('0xd'),_0x8db2('0xe'),_0x8db2('0xf'),_0x8db2('0x10'),_0x8db2('0x11'),'authToken',_0x8db2('0x12'),_0x8db2('0x13'),_0x8db2('0x14'),'calleridname',_0x8db2('0x15'),_0x8db2('0x16'),'vidaooApiKey',_0x8db2('0x17'),_0x8db2('0x18'),_0x8db2('0x19'),_0x8db2('0x1a'),_0x8db2('0x1b'),'user','pass',_0x8db2('0x1c'),_0x8db2('0x1d'),_0x8db2('0x1e'),_0x8db2('0x1f'),_0x8db2('0x20'),_0x8db2('0x21')];function maskSensitiveData(_0x2f177a){const _0x3c96a7=/(?!^)[\s\S](?!$)/g;if(_[_0x8db2('0x22')](_0x2f177a)){for(const _0x16c8c2 in _0x2f177a){if(_['isArray'](_0x2f177a[_0x16c8c2])){for(let _0x13b0f5=0x0;_0x13b0f5<_0x2f177a[_0x16c8c2][_0x8db2('0x23')];_0x13b0f5++){maskSensitiveData(_0x2f177a[_0x16c8c2][_0x13b0f5]);}}else if(_['isPlainObject'](_0x2f177a[_0x16c8c2])){maskSensitiveData(_0x2f177a[_0x16c8c2]);}else if(_[_0x8db2('0x24')](_0x2f177a[_0x16c8c2])){_0x2f177a[_0x16c8c2]=_0x2f177a[_0x16c8c2][_0x8db2('0x25')](/{{{/g,_0x8db2('0x26'))[_0x8db2('0x25')](/}}}/g,_0x8db2('0x27'))[_0x8db2('0x25')](/{{/g,'@{')['replace'](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x16c8c2)){_0x2f177a[_0x16c8c2]=_0x2f177a[_0x16c8c2][_0x8db2('0x25')](_0x3c96a7,'*');}}}}}module[_0x8db2('0x28')][_0x8db2('0x29')]=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index 79d55ed..1df3fcc 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 _0x7708=['lodash','\x20}\x20}','isArray','map','isPlainObject','reduce','exports','safeTemplate'];(function(_0x3e82c1,_0x1df8a7){var _0x18c57d=function(_0x4a5eae){while(--_0x4a5eae){_0x3e82c1['push'](_0x3e82c1['shift']());}};_0x18c57d(++_0x1df8a7);}(_0x7708,0x188));var _0x8770=function(_0x57d370,_0x3ed0f6){_0x57d370=_0x57d370-0x0;var _0x550fd2=_0x7708[_0x57d370];return _0x550fd2;};var _=require(_0x8770('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x24909b){return _0x24909b==='{{'?'{\x20{\x20':_0x8770('0x1');}function safeTemplate(_0x5a8b5b){var _0x5ca46f=_0x5a8b5b;if(typeof _0x5a8b5b==='string'){_0x5ca46f=_0x5a8b5b['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x8770('0x2')](_0x5a8b5b)){_0x5ca46f=_0x5a8b5b[_0x8770('0x3')](function(_0x577b13){return safeTemplate(_0x577b13);});}else if(_[_0x8770('0x4')](_0x5a8b5b)){_0x5ca46f=Object['keys'](_0x5a8b5b)[_0x8770('0x5')](function(_0x42d305,_0x2b0295){_0x42d305[_0x2b0295]=safeTemplate(_0x5a8b5b[_0x2b0295]);return _0x42d305;},{});}return _0x5ca46f;}module[_0x8770('0x6')][_0x8770('0x7')]=safeTemplate; \ No newline at end of file +var _0x4213=['{\x20{\x20','\x20}\x20}','string','isArray','isPlainObject','keys','reduce','exports','safeTemplate','lodash'];(function(_0x548c47,_0x380390){var _0x31ff3a=function(_0x343bb5){while(--_0x343bb5){_0x548c47['push'](_0x548c47['shift']());}};_0x31ff3a(++_0x380390);}(_0x4213,0x77));var _0x3421=function(_0x39b54d,_0x188444){_0x39b54d=_0x39b54d-0x0;var _0x9209af=_0x4213[_0x39b54d];return _0x9209af;};var _=require(_0x3421('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x445ef6){return _0x445ef6==='{{'?_0x3421('0x1'):_0x3421('0x2');}function safeTemplate(_0x2613b6){var _0x153f3a=_0x2613b6;if(typeof _0x2613b6===_0x3421('0x3')){_0x153f3a=_0x2613b6['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x3421('0x4')](_0x2613b6)){_0x153f3a=_0x2613b6['map'](function(_0x459c5e){return safeTemplate(_0x459c5e);});}else if(_[_0x3421('0x5')](_0x2613b6)){_0x153f3a=Object[_0x3421('0x6')](_0x2613b6)[_0x3421('0x7')](function(_0x5469d8,_0x50e464){_0x5469d8[_0x50e464]=safeTemplate(_0x2613b6[_0x50e464]);return _0x5469d8;},{});}return _0x153f3a;}module[_0x3421('0x8')][_0x3421('0x9')]=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index b22173e..c6f0c2f 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 _0x7d9d=['isArray','apps','name','motion2','string','env','NODE_PATH','then','readJSON','info','exports','fs-extra','path','../config/environment','root','server/app.json','resolve'];(function(_0x68639b,_0x205b8c){var _0x7e996c=function(_0x12ced5){while(--_0x12ced5){_0x68639b['push'](_0x68639b['shift']());}};_0x7e996c(++_0x205b8c);}(_0x7d9d,0x1a3));var _0xd7d9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7d9d[_0x3dd15e];return _0x231fd0;};var fs=require(_0xd7d9('0x0'));var path=require(_0xd7d9('0x1'));var config=require(_0xd7d9('0x2'));var root=config[_0xd7d9('0x3')];var APP_JSON_PATH=path['resolve'](root,_0xd7d9('0x4'));var NODEPATH=path[_0xd7d9('0x5')](root,'legacy-libs');function setLegacyLibsNodeEnvPath(_0x58f12b){let _0x2198c8=![];if(Array[_0xd7d9('0x6')](_0x58f12b[_0xd7d9('0x7')])){var _0x16fd52=_0x58f12b[_0xd7d9('0x7')]['findIndex'](function(_0x32b766){return _0x32b766[_0xd7d9('0x8')]===_0xd7d9('0x9');});if(_0x16fd52>-0x1){var _0x15bec6=_0x58f12b[_0xd7d9('0x7')][_0x16fd52];if(typeof _0x15bec6['env']['NODE_PATH']!==_0xd7d9('0xa')){_0x15bec6[_0xd7d9('0xb')][_0xd7d9('0xc')]=NODEPATH;_0x2198c8=!![];}}return{'appConfig':_0x58f12b,'updated':_0x2198c8};}}function updateAppConfig(_0x5ec035){return fs['pathExists'](APP_JSON_PATH)[_0xd7d9('0xd')](function(_0x30d3f9){if(_0x30d3f9){return fs[_0xd7d9('0xe')](APP_JSON_PATH)[_0xd7d9('0xd')](function(_0x173973){var _0x20cb73=setLegacyLibsNodeEnvPath(_0x173973);if(_0x20cb73['updated']){_0x5ec035[_0xd7d9('0xf')]('Updating\x20app.json');return fs['writeJSON'](APP_JSON_PATH,_0x173973,{'spaces':0x2});}else{return Promise[_0xd7d9('0x5')]();}});}else{return Promise['resolve']();}});}module[_0xd7d9('0x10')]=updateAppConfig; \ No newline at end of file +var _0x1179=['legacy-libs','apps','findIndex','name','motion2','NODE_PATH','string','env','then','readJSON','updated','Updating\x20app.json','exports','path','../config/environment','root','resolve','server/app.json'];(function(_0x37b3f5,_0x40ed5d){var _0x28f283=function(_0x569bc4){while(--_0x569bc4){_0x37b3f5['push'](_0x37b3f5['shift']());}};_0x28f283(++_0x40ed5d);}(_0x1179,0xd3));var _0x9117=function(_0x2aa296,_0x31bfda){_0x2aa296=_0x2aa296-0x0;var _0xe9b5eb=_0x1179[_0x2aa296];return _0xe9b5eb;};var fs=require('fs-extra');var path=require(_0x9117('0x0'));var config=require(_0x9117('0x1'));var root=config[_0x9117('0x2')];var APP_JSON_PATH=path[_0x9117('0x3')](root,_0x9117('0x4'));var NODEPATH=path[_0x9117('0x3')](root,_0x9117('0x5'));function setLegacyLibsNodeEnvPath(_0x4fb041){let _0x4e1b1b=![];if(Array['isArray'](_0x4fb041[_0x9117('0x6')])){var _0x464a5d=_0x4fb041[_0x9117('0x6')][_0x9117('0x7')](function(_0x25227d){return _0x25227d[_0x9117('0x8')]===_0x9117('0x9');});if(_0x464a5d>-0x1){var _0x49555e=_0x4fb041[_0x9117('0x6')][_0x464a5d];if(typeof _0x49555e['env'][_0x9117('0xa')]!==_0x9117('0xb')){_0x49555e[_0x9117('0xc')][_0x9117('0xa')]=NODEPATH;_0x4e1b1b=!![];}}return{'appConfig':_0x4fb041,'updated':_0x4e1b1b};}}function updateAppConfig(_0x40fece){return fs['pathExists'](APP_JSON_PATH)[_0x9117('0xd')](function(_0x4a7cde){if(_0x4a7cde){return fs[_0x9117('0xe')](APP_JSON_PATH)[_0x9117('0xd')](function(_0x14a132){var _0x46b6f8=setLegacyLibsNodeEnvPath(_0x14a132);if(_0x46b6f8[_0x9117('0xf')]){_0x40fece['info'](_0x9117('0x10'));return fs['writeJSON'](APP_JSON_PATH,_0x14a132,{'spaces':0x2});}else{return Promise[_0x9117('0x3')]();}});}else{return Promise[_0x9117('0x3')]();}});}module[_0x9117('0x11')]=updateAppConfig; \ No newline at end of file